From: Andrea Amorese Date: Wed, 24 Nov 2021 08:51:28 +0000 (+0100) Subject: Built motion from commit 424679b1.|2.5.38 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%22%7B%7Blicense.mail?a=commitdiff_plain;h=5270898b35106dd65985d7dfd257176a689c26cb;p=motion2.git Built motion from commit 424679b1.|2.5.38 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index b59a346..fe826c6 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-11-23T15:08:00.280Z", + "time": "2021-11-24T08:24:50.950Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index c02e701..79c44e6 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-11-23T15:08:00.280Z", + "time": "2021-11-24T08:24:50.950Z", "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 919800e..696a27d 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 _0xee87=['jscripty','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','exports','action','STRING','contactManager','motionbar'];(function(_0x18502e,_0x227285){var _0x135c44=function(_0x521e30){while(--_0x521e30){_0x18502e['push'](_0x18502e['shift']());}};_0x135c44(++_0x227285);}(_0xee87,0x193));var _0x7ee8=function(_0x3f7474,_0x927e0c){_0x3f7474=_0x3f7474-0x0;var _0x2a6311=_0xee87[_0x3f7474];return _0x2a6311;};'use strict';var Sequelize=require('sequelize');module[_0x7ee8('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4de157){return this['getDataValue'](_0x7ee8('0x1'));}},'action':{'type':Sequelize[_0x7ee8('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0x7ee8('0x3'),'integration',_0x7ee8('0x4'),_0x7ee8('0x5'),'urlForward',_0x7ee8('0x6'),_0x7ee8('0x7'),_0x7ee8('0x8')]],'msg':_0x7ee8('0x9')}},'comment':_0x7ee8('0x9')},'data1':{'type':Sequelize[_0x7ee8('0x2')](0x1000),'comment':_0x7ee8('0xa')},'data2':{'type':Sequelize[_0x7ee8('0x2')](0x1000),'comment':_0x7ee8('0xb')},'data3':{'type':Sequelize[_0x7ee8('0x2')](0x1000),'comment':_0x7ee8('0xc')},'data4':{'type':Sequelize[_0x7ee8('0x2')](0x1000),'comments':_0x7ee8('0xd')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x7ee8('0xe')},'data6':{'type':Sequelize[_0x7ee8('0x2')],'comments':_0x7ee8('0xf')},'data7':{'type':Sequelize[_0x7ee8('0x10')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0xad94=['action','STRING','contactManager','motionbar','urlForward','browser','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]','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x3a89f2,_0x42ee9a){var _0x3629dc=function(_0x3a0d35){while(--_0x3a0d35){_0x3a89f2['push'](_0x3a89f2['shift']());}};_0x3629dc(++_0x42ee9a);}(_0xad94,0x1dc));var _0x4ad9=function(_0x38209b,_0x2d8db0){_0x38209b=_0x38209b-0x0;var _0x1a4766=_0xad94[_0x38209b];return _0x1a4766;};'use strict';var Sequelize=require(_0x4ad9('0x0'));module[_0x4ad9('0x1')]={'name':{'type':Sequelize[_0x4ad9('0x2')],'get':function(_0x35c255){return this[_0x4ad9('0x3')](_0x4ad9('0x4'));}},'action':{'type':Sequelize[_0x4ad9('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x4ad9('0x6'),'integration',_0x4ad9('0x7'),'jscripty',_0x4ad9('0x8'),_0x4ad9('0x9'),'bot','script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x4ad9('0xa')},'data1':{'type':Sequelize[_0x4ad9('0x5')](0x1000),'comment':_0x4ad9('0xb')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x4ad9('0xc')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x4ad9('0xd')},'data4':{'type':Sequelize[_0x4ad9('0x5')](0x1000),'comments':_0x4ad9('0xe')},'data5':{'type':Sequelize[_0x4ad9('0x5')](0x1000),'comments':_0x4ad9('0xf')},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize['TEXT'],'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 72005ab..8375dbd 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 _0xdda4=['count','set','Content-Range','apply','reject','then','destroy','end','stack','name','send','update','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit'];(function(_0x1f9b24,_0x3c1f01){var _0x115072=function(_0x411879){while(--_0x411879){_0x1f9b24['push'](_0x1f9b24['shift']());}};_0x115072(++_0x3c1f01);}(_0xdda4,0x179));var _0x4dda=function(_0x1526e1,_0x5ed5a5){_0x1526e1=_0x1526e1-0x0;var _0x249a1e=_0xdda4[_0x1526e1];return _0x249a1e;};'use strict';var emlformat=require(_0x4dda('0x0'));var rimraf=require(_0x4dda('0x1'));var zipdir=require(_0x4dda('0x2'));var jsonpatch=require(_0x4dda('0x3'));var rp=require(_0x4dda('0x4'));var moment=require('moment');var BPromise=require(_0x4dda('0x5'));var Mustache=require(_0x4dda('0x6'));var util=require(_0x4dda('0x7'));var path=require('path');var sox=require(_0x4dda('0x8'));var csv=require(_0x4dda('0x9'));var ejs=require(_0x4dda('0xa'));var fs=require('fs');var fs_extra=require(_0x4dda('0xb'));var _=require('lodash');var squel=require(_0x4dda('0xc'));var crypto=require(_0x4dda('0xd'));var jsforce=require(_0x4dda('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4dda('0x9'));var querystring=require('querystring');var Papa=require(_0x4dda('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4dda('0x10'));var hardwareService=require(_0x4dda('0x11'));var logger=require(_0x4dda('0x12'))(_0x4dda('0x13'));var utils=require(_0x4dda('0x14'));var config=require(_0x4dda('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28b671,_0x1d0e5b){_0x1d0e5b=_0x1d0e5b||0xcc;return function(_0x347634){if(_0x347634){return _0x28b671[_0x4dda('0x16')](_0x1d0e5b);}return _0x28b671[_0x4dda('0x17')](_0x1d0e5b)['end']();};}function respondWithResult(_0x3bf0d0,_0x18ee08){_0x18ee08=_0x18ee08||0xc8;return function(_0xe8b254){if(_0xe8b254){return _0x3bf0d0[_0x4dda('0x17')](_0x18ee08)[_0x4dda('0x18')](_0xe8b254);}};}function respondWithFilteredResult(_0x33d5ef,_0x28e748){return function(_0x4cc0f2){if(_0x4cc0f2){var _0x21a1b0=typeof _0x28e748[_0x4dda('0x19')]===_0x4dda('0x1a')&&typeof _0x28e748[_0x4dda('0x1b')]===_0x4dda('0x1a');var _0x3f03f0=_0x4cc0f2[_0x4dda('0x1c')];var _0x4bdc05=_0x21a1b0?0x0:_0x28e748[_0x4dda('0x19')];var _0x6ec987=_0x21a1b0?_0x4cc0f2[_0x4dda('0x1c')]:_0x28e748[_0x4dda('0x19')]+_0x28e748['limit'];var _0x5f4ba2;if(_0x6ec987>=_0x3f03f0){_0x6ec987=_0x3f03f0;_0x5f4ba2=0xc8;}else{_0x5f4ba2=0xce;}_0x33d5ef[_0x4dda('0x17')](_0x5f4ba2);return _0x33d5ef[_0x4dda('0x1d')](_0x4dda('0x1e'),_0x4bdc05+'-'+_0x6ec987+'/'+_0x3f03f0)[_0x4dda('0x18')](_0x4cc0f2);}return null;};}function patchUpdates(_0xf6c3c1){return function(_0x15b179){try{jsonpatch[_0x4dda('0x1f')](_0x15b179,_0xf6c3c1,!![]);}catch(_0x3a4ae4){return BPromise[_0x4dda('0x20')](_0x3a4ae4);}return _0x15b179['save']();};}function saveUpdates(_0x454d1e,_0x5e801b){return function(_0x49963b){if(_0x49963b){return _0x49963b['update'](_0x454d1e)[_0x4dda('0x21')](function(_0x3bbe7e){return _0x3bbe7e;});}return null;};}function removeEntity(_0x27c0a7,_0x3f3ee9){return function(_0x52d2a0){if(_0x52d2a0){return _0x52d2a0[_0x4dda('0x22')]()[_0x4dda('0x21')](function(){_0x27c0a7[_0x4dda('0x17')](0xcc)[_0x4dda('0x23')]();});}};}function handleEntityNotFound(_0x30c68e,_0x26296c){return function(_0x12cad6){if(!_0x12cad6){_0x30c68e['sendStatus'](0x194);}return _0x12cad6;};}function handleError(_0x3ef2e7,_0xae5a6e){_0xae5a6e=_0xae5a6e||0x1f4;return function(_0x385a9d){logger['error'](_0x385a9d[_0x4dda('0x24')]);if(_0x385a9d[_0x4dda('0x25')]){delete _0x385a9d[_0x4dda('0x25')];}_0x3ef2e7['status'](_0xae5a6e)[_0x4dda('0x26')](_0x385a9d);};}exports[_0x4dda('0x27')]=function(_0x329d2f,_0x15a3fe){if(_0x329d2f[_0x4dda('0x28')]['id']){delete _0x329d2f[_0x4dda('0x28')]['id'];}return db[_0x4dda('0x29')][_0x4dda('0x2a')]({'where':{'id':_0x329d2f[_0x4dda('0x2b')]['id']}})[_0x4dda('0x21')](handleEntityNotFound(_0x15a3fe,null))['then'](saveUpdates(_0x329d2f[_0x4dda('0x28')],null))[_0x4dda('0x21')](respondWithResult(_0x15a3fe,null))['catch'](handleError(_0x15a3fe,null));};exports[_0x4dda('0x22')]=function(_0x32ba92,_0x271c18){return db[_0x4dda('0x29')]['find']({'where':{'id':_0x32ba92[_0x4dda('0x2b')]['id']}})[_0x4dda('0x21')](handleEntityNotFound(_0x271c18,null))[_0x4dda('0x21')](removeEntity(_0x271c18,null))[_0x4dda('0x2c')](handleError(_0x271c18,null));}; \ No newline at end of file +var _0x8767=['undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','body','Action','params','catch','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset'];(function(_0x2ca6c6,_0x59dfdf){var _0xb82cd6=function(_0x3b2d2d){while(--_0x3b2d2d){_0x2ca6c6['push'](_0x2ca6c6['shift']());}};_0xb82cd6(++_0x59dfdf);}(_0x8767,0xcb));var _0x7876=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8767[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7876('0x0'));var rimraf=require(_0x7876('0x1'));var zipdir=require(_0x7876('0x2'));var jsonpatch=require(_0x7876('0x3'));var rp=require(_0x7876('0x4'));var moment=require(_0x7876('0x5'));var BPromise=require(_0x7876('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x7876('0x7'));var csv=require('to-csv');var ejs=require(_0x7876('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7876('0x9'));var squel=require(_0x7876('0xa'));var crypto=require(_0x7876('0xb'));var jsforce=require(_0x7876('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7876('0xd'));var querystring=require(_0x7876('0xe'));var Papa=require(_0x7876('0xf'));var Redis=require('ioredis');var authService=require(_0x7876('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7876('0x11'));var hardwareService=require(_0x7876('0x12'));var logger=require('../../config/logger')(_0x7876('0x13'));var utils=require(_0x7876('0x14'));var config=require(_0x7876('0x15'));var licenseUtil=require(_0x7876('0x16'));var db=require(_0x7876('0x17'))['db'];function respondWithStatusCode(_0x5607e9,_0x1b2e48){_0x1b2e48=_0x1b2e48||0xcc;return function(_0x4c6e27){if(_0x4c6e27){return _0x5607e9[_0x7876('0x18')](_0x1b2e48);}return _0x5607e9[_0x7876('0x19')](_0x1b2e48)['end']();};}function respondWithResult(_0x4edac9,_0x25be9f){_0x25be9f=_0x25be9f||0xc8;return function(_0x55a08c){if(_0x55a08c){return _0x4edac9[_0x7876('0x19')](_0x25be9f)['json'](_0x55a08c);}};}function respondWithFilteredResult(_0x1d179b,_0x578d1e){return function(_0x20452e){if(_0x20452e){var _0x73b700=typeof _0x578d1e[_0x7876('0x1a')]===_0x7876('0x1b')&&typeof _0x578d1e[_0x7876('0x1c')]===_0x7876('0x1b');var _0x59bc87=_0x20452e[_0x7876('0x1d')];var _0x22ce31=_0x73b700?0x0:_0x578d1e[_0x7876('0x1a')];var _0x4a30e1=_0x73b700?_0x20452e[_0x7876('0x1d')]:_0x578d1e[_0x7876('0x1a')]+_0x578d1e[_0x7876('0x1c')];var _0x5b0087;if(_0x4a30e1>=_0x59bc87){_0x4a30e1=_0x59bc87;_0x5b0087=0xc8;}else{_0x5b0087=0xce;}_0x1d179b[_0x7876('0x19')](_0x5b0087);return _0x1d179b[_0x7876('0x1e')](_0x7876('0x1f'),_0x22ce31+'-'+_0x4a30e1+'/'+_0x59bc87)[_0x7876('0x20')](_0x20452e);}return null;};}function patchUpdates(_0x5b5daf){return function(_0x44a839){try{jsonpatch[_0x7876('0x21')](_0x44a839,_0x5b5daf,!![]);}catch(_0x49b88d){return BPromise[_0x7876('0x22')](_0x49b88d);}return _0x44a839[_0x7876('0x23')]();};}function saveUpdates(_0x3711c6,_0x496a39){return function(_0x44ebdc){if(_0x44ebdc){return _0x44ebdc[_0x7876('0x24')](_0x3711c6)[_0x7876('0x25')](function(_0x4473ea){return _0x4473ea;});}return null;};}function removeEntity(_0x24c201,_0x2dac26){return function(_0x4b2ac6){if(_0x4b2ac6){return _0x4b2ac6['destroy']()[_0x7876('0x25')](function(){_0x24c201[_0x7876('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x119a02,_0x19f7ab){return function(_0x6aa456){if(!_0x6aa456){_0x119a02[_0x7876('0x18')](0x194);}return _0x6aa456;};}function handleError(_0x3347c3,_0x1adf32){_0x1adf32=_0x1adf32||0x1f4;return function(_0x374a0d){logger[_0x7876('0x26')](_0x374a0d[_0x7876('0x27')]);if(_0x374a0d[_0x7876('0x28')]){delete _0x374a0d[_0x7876('0x28')];}_0x3347c3[_0x7876('0x19')](_0x1adf32)['send'](_0x374a0d);};}exports[_0x7876('0x24')]=function(_0x2f78ab,_0x39aac2){if(_0x2f78ab['body']['id']){delete _0x2f78ab[_0x7876('0x29')]['id'];}return db[_0x7876('0x2a')]['find']({'where':{'id':_0x2f78ab[_0x7876('0x2b')]['id']}})[_0x7876('0x25')](handleEntityNotFound(_0x39aac2,null))['then'](saveUpdates(_0x2f78ab['body'],null))[_0x7876('0x25')](respondWithResult(_0x39aac2,null))[_0x7876('0x2c')](handleError(_0x39aac2,null));};exports['destroy']=function(_0x55d4a1,_0x3dd832){return db[_0x7876('0x2a')][_0x7876('0x2d')]({'where':{'id':_0x55d4a1['params']['id']}})[_0x7876('0x25')](handleEntityNotFound(_0x3dd832,null))[_0x7876('0x25')](removeEntity(_0x3dd832,null))[_0x7876('0x2c')](handleError(_0x3dd832,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index efcef9c..345dcc7 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 _0x6e9b=['rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1ba969,_0x410b91){var _0x3e8d2e=function(_0x5861e5){while(--_0x5861e5){_0x1ba969['push'](_0x1ba969['shift']());}};_0x3e8d2e(++_0x410b91);}(_0x6e9b,0xf7));var _0xb6e9=function(_0x520e27,_0x1bd811){_0x520e27=_0x520e27-0x0;var _0x5e7b6f=_0x6e9b[_0x520e27];return _0x5e7b6f;};'use strict';var _=require(_0xb6e9('0x0'));var util=require(_0xb6e9('0x1'));var logger=require(_0xb6e9('0x2'))(_0xb6e9('0x3'));var moment=require(_0xb6e9('0x4'));var BPromise=require(_0xb6e9('0x5'));var rp=require(_0xb6e9('0x6'));var fs=require('fs');var path=require(_0xb6e9('0x7'));var rimraf=require(_0xb6e9('0x8'));var config=require(_0xb6e9('0x9'));var attributes=require(_0xb6e9('0xa'));module[_0xb6e9('0xb')]=function(_0x20e874,_0x1412c5){return _0x20e874[_0xb6e9('0xc')](_0xb6e9('0xd'),attributes,{'tableName':_0xb6e9('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bc2=['Action','lodash','api','request-promise','rimraf','./action.attributes','define'];(function(_0x4c4a6e,_0x2baf3d){var _0x313c7e=function(_0x44e09a){while(--_0x44e09a){_0x4c4a6e['push'](_0x4c4a6e['shift']());}};_0x313c7e(++_0x2baf3d);}(_0x2bc2,0x1ac));var _0x22bc=function(_0x2254f3,_0x36ed5c){_0x2254f3=_0x2254f3-0x0;var _0x2e3ec5=_0x2bc2[_0x2254f3];return _0x2e3ec5;};'use strict';var _=require(_0x22bc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x22bc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x22bc('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22bc('0x3'));var config=require('../../config/environment');var attributes=require(_0x22bc('0x4'));module['exports']=function(_0x12232a,_0x130212){return _0x12232a[_0x22bc('0x5')](_0x22bc('0x6'),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 0dd792b..0badad7 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 _0x326f=['info','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5ea9d0,_0x319b4a){var _0xa42b35=function(_0x47803c){while(--_0x47803c){_0x5ea9d0['push'](_0x5ea9d0['shift']());}};_0xa42b35(++_0x319b4a);}(_0x326f,0xd1));var _0xf326=function(_0x1fa714,_0x22292a){_0x1fa714=_0x1fa714-0x0;var _0x504ebb=_0x326f[_0x1fa714];return _0x504ebb;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Action,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file +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(_0x1f4d02,_0x12e8f4){var _0x411305=function(_0x1ce2f7){while(--_0x1ce2f7){_0x1f4d02['push'](_0x1f4d02['shift']());}};_0x411305(++_0x12e8f4);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3865ea,_0x45f818){_0x3865ea=_0x3865ea-0x0;var _0x9845a6=_0x7fbe[_0x3865ea];return _0x9845a6;};'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 diff --git a/server/api/action/index.js b/server/api/action/index.js index e678bad..6dc99a6 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 _0xd506=['update','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated'];(function(_0x3e838b,_0x289433){var _0xb4a284=function(_0x2db976){while(--_0x2db976){_0x3e838b['push'](_0x3e838b['shift']());}};_0xb4a284(++_0x289433);}(_0xd506,0xf9));var _0x6d50=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xd506[_0x68ee8b];return _0x5148f7;};'use strict';var multer=require(_0x6d50('0x0'));var util=require('util');var path=require(_0x6d50('0x1'));var timeout=require(_0x6d50('0x2'));var express=require('express');var router=express[_0x6d50('0x3')]();var fs_extra=require(_0x6d50('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6d50('0x5'));var config=require(_0x6d50('0x6'));var controller=require(_0x6d50('0x7'));router[_0x6d50('0x8')](_0x6d50('0x9'),auth[_0x6d50('0xa')](),controller[_0x6d50('0xb')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6d50('0xc')]=router; \ No newline at end of file +var _0x9b22=['connect-timeout','express','../../components/interaction/service','./action.controller','put','/:id','isAuthenticated','update','delete','util','path'];(function(_0x2efe3e,_0xa47705){var _0xa7b505=function(_0x5db695){while(--_0x5db695){_0x2efe3e['push'](_0x2efe3e['shift']());}};_0xa7b505(++_0xa47705);}(_0x9b22,0x98));var _0x29b2=function(_0x58d126,_0xab1870){_0x58d126=_0x58d126-0x0;var _0x31daf0=_0x9b22[_0x58d126];return _0x31daf0;};'use strict';var multer=require('multer');var util=require(_0x29b2('0x0'));var path=require(_0x29b2('0x1'));var timeout=require(_0x29b2('0x2'));var express=require(_0x29b2('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x29b2('0x4'));var config=require('../../config/environment');var controller=require(_0x29b2('0x5'));router[_0x29b2('0x6')](_0x29b2('0x7'),auth[_0x29b2('0x8')](),controller[_0x29b2('0x9')]);router[_0x29b2('0xa')](_0x29b2('0x7'),auth[_0x29b2('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index d8f3f84..2601d3f 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 _0x33c5=['STRING','TEXT','exports'];(function(_0x1afda1,_0x6c653b){var _0x228fa3=function(_0x30ed56){while(--_0x30ed56){_0x1afda1['push'](_0x1afda1['shift']());}};_0x228fa3(++_0x6c653b);}(_0x33c5,0xe6));var _0x533c=function(_0xe1a3a5,_0xd3e341){_0xe1a3a5=_0xe1a3a5-0x0;var _0x362646=_0x33c5[_0xe1a3a5];return _0x362646;};'use strict';var Sequelize=require('sequelize');module[_0x533c('0x0')]={'name':{'type':Sequelize[_0x533c('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x533c('0x1')]},'table':{'type':Sequelize[_0x533c('0x1')]},'conditions':{'type':Sequelize[_0x533c('0x2')]},'joins':{'type':Sequelize[_0x533c('0x2')]}}; \ No newline at end of file +var _0x7da7=['TEXT','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7da7,0x10d));var _0x77da=function(_0x5b36bd,_0x4dfb36){_0x5b36bd=_0x5b36bd-0x0;var _0x1614fe=_0x7da7[_0x5b36bd];return _0x1614fe;};'use strict';var Sequelize=require(_0x77da('0x0'));module[_0x77da('0x1')]={'name':{'type':Sequelize[_0x77da('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x77da('0x2')]},'conditions':{'type':Sequelize[_0x77da('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index bdb261a..34f09ef 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 _0x3e1a=['value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','table','MetricId','metric','function','replace','format','orderBy','order','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','ValidationErrorItem','AnalyticMetric','findAll','select','from','output','web','fullPath','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','reject','save','destroy','then','CustomReports','UserProfileResource','error','stack','name','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','where','pick','filter','merge','options','includeAll','rows','catch','show','params','include','find','create','body','user','role','get','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','left_join','cross_join','SUM(%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\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition'];(function(_0x59e79d,_0x1bbd40){var _0x4a4ac2=function(_0xfad242){while(--_0xfad242){_0x59e79d['push'](_0x59e79d['shift']());}};_0x4a4ac2(++_0x1bbd40);}(_0x3e1a,0x18b));var _0xa3e1=function(_0x3111cf,_0x54a483){_0x3111cf=_0x3111cf-0x0;var _0x2ed32c=_0x3e1a[_0x3111cf];return _0x2ed32c;};'use strict';var emlformat=require(_0xa3e1('0x0'));var rimraf=require(_0xa3e1('0x1'));var zipdir=require(_0xa3e1('0x2'));var jsonpatch=require(_0xa3e1('0x3'));var rp=require(_0xa3e1('0x4'));var moment=require(_0xa3e1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa3e1('0x6'));var util=require(_0xa3e1('0x7'));var path=require(_0xa3e1('0x8'));var sox=require(_0xa3e1('0x9'));var csv=require(_0xa3e1('0xa'));var ejs=require(_0xa3e1('0xb'));var fs=require('fs');var fs_extra=require(_0xa3e1('0xc'));var _=require(_0xa3e1('0xd'));var squel=require(_0xa3e1('0xe'));var crypto=require(_0xa3e1('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa3e1('0xa'));var querystring=require(_0xa3e1('0x10'));var Papa=require(_0xa3e1('0x11'));var Redis=require(_0xa3e1('0x12'));var authService=require(_0xa3e1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa3e1('0x14'));var hardwareService=require(_0xa3e1('0x15'));var logger=require(_0xa3e1('0x16'))(_0xa3e1('0x17'));var utils=require(_0xa3e1('0x18'));var config=require(_0xa3e1('0x19'));var licenseUtil=require(_0xa3e1('0x1a'));var db=require(_0xa3e1('0x1b'))['db'];var dbH=require(_0xa3e1('0x1b'))[_0xa3e1('0x1c')];function respondWithStatusCode(_0x5c259f,_0x2b91af){_0x2b91af=_0x2b91af||0xcc;return function(_0xd7fc59){if(_0xd7fc59){return _0x5c259f[_0xa3e1('0x1d')](_0x2b91af);}return _0x5c259f['status'](_0x2b91af)['end']();};}function respondWithResult(_0x5e0b82,_0x1d41a1){_0x1d41a1=_0x1d41a1||0xc8;return function(_0xee89be){if(_0xee89be){return _0x5e0b82[_0xa3e1('0x1e')](_0x1d41a1)['json'](_0xee89be);}};}function respondWithFilteredResult(_0x5127af,_0x66d32b){return function(_0x5a3ce0){if(_0x5a3ce0){var _0x23aea8=typeof _0x66d32b['offset']===_0xa3e1('0x1f')&&typeof _0x66d32b[_0xa3e1('0x20')]===_0xa3e1('0x1f');var _0x198189=_0x5a3ce0[_0xa3e1('0x21')];var _0x1fa733=_0x23aea8?0x0:_0x66d32b[_0xa3e1('0x22')];var _0x4019d1=_0x23aea8?_0x5a3ce0[_0xa3e1('0x21')]:_0x66d32b[_0xa3e1('0x22')]+_0x66d32b['limit'];var _0x2ed079;if(_0x4019d1>=_0x198189){_0x4019d1=_0x198189;_0x2ed079=0xc8;}else{_0x2ed079=0xce;}_0x5127af[_0xa3e1('0x1e')](_0x2ed079);return _0x5127af[_0xa3e1('0x23')](_0xa3e1('0x24'),_0x1fa733+'-'+_0x4019d1+'/'+_0x198189)[_0xa3e1('0x25')](_0x5a3ce0);}return null;};}function patchUpdates(_0x3deb1c){return function(_0x87d988){try{jsonpatch['apply'](_0x87d988,_0x3deb1c,!![]);}catch(_0x19f303){return BPromise[_0xa3e1('0x26')](_0x19f303);}return _0x87d988[_0xa3e1('0x27')]();};}function saveUpdates(_0x2a1451,_0x24c345){return function(_0x522df0){if(_0x522df0){return _0x522df0['update'](_0x2a1451)['then'](function(_0x5f3cb6){return _0x5f3cb6;});}return null;};}function removeEntity(_0x3e2434,_0x426d73){return function(_0x37fe5d){if(_0x37fe5d){return _0x37fe5d[_0xa3e1('0x28')]()[_0xa3e1('0x29')](function(){var _0x49d059=_0x37fe5d['get']({'plain':!![]});var _0x6c0ece=_0xa3e1('0x2a');return db[_0xa3e1('0x2b')][_0xa3e1('0x28')]({'where':{'type':_0x6c0ece,'resourceId':_0x49d059['id']}})['then'](function(){return _0x37fe5d;});})['then'](function(){_0x3e2434[_0xa3e1('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b0c07,_0x51b3ba){return function(_0x1c7a0c){if(!_0x1c7a0c){_0x3b0c07['sendStatus'](0x194);}return _0x1c7a0c;};}function handleError(_0x123636,_0x36ffd9){_0x36ffd9=_0x36ffd9||0x1f4;return function(_0x5191f6){logger[_0xa3e1('0x2c')](_0x5191f6[_0xa3e1('0x2d')]);if(_0x5191f6[_0xa3e1('0x2e')]){delete _0x5191f6['name'];}_0x123636['status'](_0x36ffd9)['send'](_0x5191f6);};}exports['index']=function(_0x16ae1e,_0x20249c){var _0x863b3e={},_0xe0977c={},_0x495af5={'count':0x0,'rows':[]};var _0x427f45=_[_0xa3e1('0x2f')](db[_0xa3e1('0x30')][_0xa3e1('0x31')],function(_0x309b44){return{'name':_0x309b44[_0xa3e1('0x32')],'type':_0x309b44[_0xa3e1('0x33')][_0xa3e1('0x34')]};});_0xe0977c[_0xa3e1('0x35')]=_[_0xa3e1('0x2f')](_0x427f45,'name');_0xe0977c[_0xa3e1('0x36')]=_[_0xa3e1('0x37')](_0x16ae1e[_0xa3e1('0x36')]);_0xe0977c[_0xa3e1('0x38')]=_[_0xa3e1('0x39')](_0xe0977c[_0xa3e1('0x35')],_0xe0977c[_0xa3e1('0x36')]);_0x863b3e[_0xa3e1('0x3a')]=_[_0xa3e1('0x39')](_0xe0977c[_0xa3e1('0x35')],qs[_0xa3e1('0x3b')](_0x16ae1e[_0xa3e1('0x36')]['fields']));_0x863b3e[_0xa3e1('0x3a')]=_0x863b3e[_0xa3e1('0x3a')][_0xa3e1('0x3c')]?_0x863b3e[_0xa3e1('0x3a')]:_0xe0977c[_0xa3e1('0x35')];if(!_0x16ae1e[_0xa3e1('0x36')]['hasOwnProperty']('nolimit')){_0x863b3e['limit']=qs[_0xa3e1('0x20')](_0x16ae1e[_0xa3e1('0x36')][_0xa3e1('0x20')]);_0x863b3e[_0xa3e1('0x22')]=qs[_0xa3e1('0x22')](_0x16ae1e[_0xa3e1('0x36')][_0xa3e1('0x22')]);}_0x863b3e['order']=qs['sort'](_0x16ae1e[_0xa3e1('0x36')]['sort']);_0x863b3e[_0xa3e1('0x3d')]=qs[_0xa3e1('0x38')](_[_0xa3e1('0x3e')](_0x16ae1e[_0xa3e1('0x36')],_0xe0977c[_0xa3e1('0x38')]),_0x427f45);if(_0x16ae1e[_0xa3e1('0x36')]['filter']){_0x863b3e['where']=_['merge'](_0x863b3e['where'],{'$or':_[_0xa3e1('0x2f')](_0x427f45,function(_0x2e1788){if(_0x2e1788[_0xa3e1('0x33')]!=='VIRTUAL'){var _0x36d4ac={};_0x36d4ac[_0x2e1788[_0xa3e1('0x2e')]]={'$like':'%'+_0x16ae1e[_0xa3e1('0x36')][_0xa3e1('0x3f')]+'%'};return _0x36d4ac;}})});}_0x863b3e=_[_0xa3e1('0x40')]({},_0x863b3e,_0x16ae1e[_0xa3e1('0x41')]);var _0x45b501={'where':_0x863b3e[_0xa3e1('0x3d')]};return db[_0xa3e1('0x30')][_0xa3e1('0x21')](_0x45b501)['then'](function(_0x1cfed3){_0x495af5[_0xa3e1('0x21')]=_0x1cfed3;if(_0x16ae1e['query'][_0xa3e1('0x42')]){_0x863b3e['include']=[{'all':!![]}];}return db[_0xa3e1('0x30')]['findAll'](_0x863b3e);})[_0xa3e1('0x29')](function(_0x26c891){_0x495af5[_0xa3e1('0x43')]=_0x26c891;return _0x495af5;})['then'](respondWithFilteredResult(_0x20249c,_0x863b3e))[_0xa3e1('0x44')](handleError(_0x20249c,null));};exports[_0xa3e1('0x45')]=function(_0xea3434,_0x1e8a07){var _0x27ddd6={'raw':![],'where':{'id':_0xea3434[_0xa3e1('0x46')]['id']}},_0x383334={};_0x383334['model']=_['keys'](db[_0xa3e1('0x30')]['rawAttributes']);_0x383334[_0xa3e1('0x36')]=_[_0xa3e1('0x37')](_0xea3434[_0xa3e1('0x36')]);_0x383334[_0xa3e1('0x38')]=_[_0xa3e1('0x39')](_0x383334['model'],_0x383334['query']);_0x27ddd6[_0xa3e1('0x3a')]=_['intersection'](_0x383334[_0xa3e1('0x35')],qs[_0xa3e1('0x3b')](_0xea3434[_0xa3e1('0x36')]['fields']));_0x27ddd6[_0xa3e1('0x3a')]=_0x27ddd6[_0xa3e1('0x3a')][_0xa3e1('0x3c')]?_0x27ddd6[_0xa3e1('0x3a')]:_0x383334[_0xa3e1('0x35')];if(_0xea3434[_0xa3e1('0x36')]['includeAll']){_0x27ddd6[_0xa3e1('0x47')]=[{'all':!![]}];}_0x27ddd6=_[_0xa3e1('0x40')]({},_0x27ddd6,_0xea3434['options']);return db[_0xa3e1('0x30')][_0xa3e1('0x48')](_0x27ddd6)[_0xa3e1('0x29')](handleEntityNotFound(_0x1e8a07,null))['then'](respondWithResult(_0x1e8a07,null))[_0xa3e1('0x44')](handleError(_0x1e8a07,null));};exports[_0xa3e1('0x49')]=function(_0x46152d,_0x21b21d){return db['AnalyticCustomReport'][_0xa3e1('0x49')](_0x46152d[_0xa3e1('0x4a')],{})[_0xa3e1('0x29')](function(_0x2ff172){var _0x2aa9a8=_0x46152d[_0xa3e1('0x4b')]['get']({'plain':!![]});if(!_0x2aa9a8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2aa9a8[_0xa3e1('0x4c')]==='user'){var _0x577512=_0x2ff172[_0xa3e1('0x4d')]({'plain':!![]});var _0x467202=_0xa3e1('0x4e');return db[_0xa3e1('0x4f')][_0xa3e1('0x48')]({'where':{'name':_0x467202,'userProfileId':_0x2aa9a8[_0xa3e1('0x50')]},'raw':!![]})[_0xa3e1('0x29')](function(_0x22c26c){if(_0x22c26c&&_0x22c26c['autoAssociation']===0x0){return db[_0xa3e1('0x2b')][_0xa3e1('0x49')]({'name':_0x577512[_0xa3e1('0x2e')],'resourceId':_0x577512['id'],'type':_0xa3e1('0x2a'),'sectionId':_0x22c26c['id']},{})[_0xa3e1('0x29')](function(){return _0x2ff172;});}else{return _0x2ff172;}})[_0xa3e1('0x44')](function(_0x41eb13){logger[_0xa3e1('0x2c')](_0xa3e1('0x51'),_0x41eb13);throw _0x41eb13;});}return _0x2ff172;})[_0xa3e1('0x29')](respondWithResult(_0x21b21d,0xc9))[_0xa3e1('0x44')](handleError(_0x21b21d,null));};exports['update']=function(_0x5e2091,_0x2b0232){if(_0x5e2091[_0xa3e1('0x4a')]['id']){delete _0x5e2091[_0xa3e1('0x4a')]['id'];}return db[_0xa3e1('0x30')][_0xa3e1('0x48')]({'where':{'id':_0x5e2091[_0xa3e1('0x46')]['id']}})[_0xa3e1('0x29')](handleEntityNotFound(_0x2b0232,null))['then'](saveUpdates(_0x5e2091[_0xa3e1('0x4a')],null))['then'](respondWithResult(_0x2b0232,null))[_0xa3e1('0x44')](handleError(_0x2b0232,null));};exports[_0xa3e1('0x28')]=function(_0x8c53e5,_0xf8e49d){return db[_0xa3e1('0x30')]['find']({'where':{'id':_0x8c53e5[_0xa3e1('0x46')]['id']}})[_0xa3e1('0x29')](handleEntityNotFound(_0xf8e49d,null))['then'](removeEntity(_0xf8e49d,null))[_0xa3e1('0x44')](handleError(_0xf8e49d,null));};exports['preview']=function(_0x5162fc,_0x4a60d3){var _0x3ec862=0xa;var _0x5924ee=['join',_0xa3e1('0x52'),'right_join',_0xa3e1('0x53')];var _0x5caac1={'SUM':_0xa3e1('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xa3e1('0x55'),'MIN':_0xa3e1('0x56'),'AVG':_0xa3e1('0x57'),'GROUP_CONCAT':_0xa3e1('0x58'),'GROUP_CONCAT ASC':_0xa3e1('0x59'),'GROUP_CONCAT DESC':_0xa3e1('0x5a')};var _0x21d5f1={'SEC_TO_TIME':_0xa3e1('0x5b'),'DATE':_0xa3e1('0x5c'),'HOUR':_0xa3e1('0x5d'),'ROUND':_0xa3e1('0x5e'),'UNIX_TIMESTAMP':_0xa3e1('0x5f')};var _0x497dde=function(_0x269caa){return!_[_0xa3e1('0x60')]([_0xa3e1('0x61'),_0xa3e1('0x62'),_0xa3e1('0x63'),_0xa3e1('0x64')],_0x269caa);};var _0x55c8ed=function(_0x15909b){if(!_0x15909b||!_0x15909b[_0xa3e1('0x65')][_0xa3e1('0x3c')]){return'';}for(var _0x3649a9='(',_0x1246cb=0x0;_0x1246cb<_0x15909b[_0xa3e1('0x65')][_0xa3e1('0x3c')];_0x1246cb+=0x1){_0x1246cb>0x0&&(_0x3649a9+='\x20'+_0x15909b[_0xa3e1('0x66')]+'\x20');_0x3649a9+=_0x15909b[_0xa3e1('0x65')][_0x1246cb][_0xa3e1('0x67')]?_0x55c8ed(_0x15909b['rules'][_0x1246cb][_0xa3e1('0x67')]):_0x15909b['rules'][_0x1246cb][_0xa3e1('0x68')]+'\x20'+_0x15909b['rules'][_0x1246cb][_0xa3e1('0x69')]+(_0x497dde(_0x15909b['rules'][_0x1246cb][_0xa3e1('0x69')])?'\x20'+_0x15909b[_0xa3e1('0x65')][_0x1246cb][_0xa3e1('0x6a')]:'');}return _0x3649a9+')';};var _0x5d3c85={'where':{'id':_0x5162fc[_0xa3e1('0x46')]['id']}},_0xce546f,_0x3f17cc,_0x4729f9,_0x2b4ed5,_0xc2ed26;_0x5d3c85=_[_0xa3e1('0x40')]({},_0x5d3c85,_0x5162fc[_0xa3e1('0x41')]);return db[_0xa3e1('0x30')][_0xa3e1('0x48')](_0x5d3c85)[_0xa3e1('0x29')](function(_0x36f7aa){if(_0x36f7aa){_0xce546f=_0x36f7aa;return _0x36f7aa[_0xa3e1('0x6b')]();}return null;})[_0xa3e1('0x29')](function(_0x1d11af){if(_0x1d11af){if(!_0x1d11af['length']){throw new db[(_0xa3e1('0x6c'))]['ValidationErrorItem'](_0xa3e1('0x6d'),0x193);}_0x3f17cc=_0x1d11af;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xa3e1('0x29')](function(_0x182f1c){if(_0x182f1c){_0x4729f9=_[_0xa3e1('0x6e')](_0x182f1c,'id');var _0x4c82dc;var _0xb95e69=squel['select']();_0xb95e69['from'](_0xce546f[_0xa3e1('0x6f')]);for(var _0x339b15=0x0;_0x339b15<_0x3f17cc[_0xa3e1('0x3c')];_0x339b15+=0x1){_0x4c82dc=_0x3f17cc[_0x339b15][_0xa3e1('0x70')]?_0x4729f9[_0x3f17cc[_0x339b15][_0xa3e1('0x70')]][_0xa3e1('0x71')]:_0x3f17cc[_0x339b15]['field'];_0x4c82dc=_0x3f17cc[_0x339b15][_0xa3e1('0x72')]?_[_0xa3e1('0x73')](_0x5caac1[_0x3f17cc[_0x339b15][_0xa3e1('0x72')]],'%s',_0x4c82dc):_0x4c82dc;_0x4c82dc=_0x3f17cc[_0x339b15]['format']?_[_0xa3e1('0x73')](_0x21d5f1[_0x3f17cc[_0x339b15][_0xa3e1('0x74')]],'%s',_0x4c82dc):_0x4c82dc;if(_0x3f17cc[_0x339b15]['groupBy']){_0xb95e69['group'](_0x4c82dc);}_0x3f17cc[_0x339b15][_0xa3e1('0x75')]&&_0xb95e69[_0xa3e1('0x76')](_0x4c82dc,_0x3f17cc[_0x339b15][_0xa3e1('0x75')]===_0xa3e1('0x77')?![]:!![]);_0xb95e69[_0xa3e1('0x68')](_0x4c82dc,_0x3f17cc[_0x339b15][_0xa3e1('0x78')]||_0x4c82dc);}if(_0xce546f[_0xa3e1('0x79')]){_0xce546f[_0xa3e1('0x79')]=JSON[_0xa3e1('0x7a')](_0xce546f[_0xa3e1('0x79')]);for(var _0x5877c0=0x0;_0x5877c0<_0xce546f[_0xa3e1('0x79')][_0xa3e1('0x3c')];_0x5877c0+=0x1){if(_0xce546f[_0xa3e1('0x79')][_0x5877c0]['type']&&_[_0xa3e1('0x60')](_0x5924ee,_0xce546f[_0xa3e1('0x79')][_0x5877c0]['type'])&&_0xce546f[_0xa3e1('0x79')][_0x5877c0][_0xa3e1('0x7b')]&&_0xce546f[_0xa3e1('0x79')][_0x5877c0][_0xa3e1('0x7c')]&&_0xce546f[_0xa3e1('0x79')][_0x5877c0]['foreignKey']){_0xb95e69[_0xce546f['joins'][_0x5877c0]['type']](_0xce546f[_0xa3e1('0x79')][_0x5877c0][_0xa3e1('0x7c')],null,util[_0xa3e1('0x74')](_0xa3e1('0x7d'),_0xce546f[_0xa3e1('0x6f')],_0xce546f[_0xa3e1('0x79')][_0x5877c0][_0xa3e1('0x7b')],_0xce546f[_0xa3e1('0x79')][_0x5877c0]['foreignTable'],_0xce546f[_0xa3e1('0x79')][_0x5877c0][_0xa3e1('0x7e')]));}}}if(_0xce546f[_0xa3e1('0x7f')]){_0xce546f[_0xa3e1('0x7f')]=JSON[_0xa3e1('0x7a')](_0xce546f['conditions']);_0xb95e69[_0xa3e1('0x3d')](_0x55c8ed(_0xce546f[_0xa3e1('0x7f')]['group']));}_0xc2ed26=_0xb95e69[_0xa3e1('0x80')]();_0xb95e69['limit'](_0x3ec862);_0xb95e69[_0xa3e1('0x22')](0x0);logger[_0xa3e1('0x81')](_0xa3e1('0x82'),_0xb95e69[_0xa3e1('0x83')]());return dbH[_0xa3e1('0x84')][_0xa3e1('0x36')](_0xb95e69[_0xa3e1('0x83')](),{'type':dbH[_0xa3e1('0x84')][_0xa3e1('0x85')][_0xa3e1('0x86')]});}})[_0xa3e1('0x29')](respondWithResult(_0x4a60d3,null))[_0xa3e1('0x44')](handleError(_0x4a60d3,null));};function runReport(_0x555a3d,_0x68c584,_0x2c27a3){var _0x3cac26=_0x68c584['name'];var _0xf479d4=0xa;var _0x272cc1=[_0xa3e1('0x87'),_0xa3e1('0x52'),_0xa3e1('0x88'),_0xa3e1('0x53')];var _0x7e6454={'SUM':_0xa3e1('0x54'),'COUNT':_0xa3e1('0x89'),'COUNT DISTINCT':_0xa3e1('0x8a'),'MAX':'MAX(%s)','MIN':_0xa3e1('0x56'),'AVG':_0xa3e1('0x57'),'GROUP_CONCAT':_0xa3e1('0x58'),'GROUP_CONCAT ASC':_0xa3e1('0x59'),'GROUP_CONCAT DESC':_0xa3e1('0x5a')};var _0x11fb4a={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xa3e1('0x5c'),'HOUR':'HOUR(%s)','ROUND':_0xa3e1('0x5e'),'UNIX_TIMESTAMP':_0xa3e1('0x5f')};var _0x173c73=function(_0xc681a0){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0xa3e1('0x64')],_0xc681a0);};var _0x461591=function(_0xd7de30){if(!_0xd7de30||!_0xd7de30[_0xa3e1('0x65')]['length']){return'';}for(var _0x35d6ff='(',_0x4f91b0=0x0;_0x4f91b0<_0xd7de30[_0xa3e1('0x65')][_0xa3e1('0x3c')];_0x4f91b0+=0x1){_0x4f91b0>0x0&&(_0x35d6ff+='\x20'+_0xd7de30[_0xa3e1('0x66')]+'\x20');_0x35d6ff+=_0xd7de30[_0xa3e1('0x65')][_0x4f91b0]['group']?_0x461591(_0xd7de30['rules'][_0x4f91b0][_0xa3e1('0x67')]):_0xd7de30['rules'][_0x4f91b0]['field']+'\x20'+_0xd7de30['rules'][_0x4f91b0][_0xa3e1('0x69')]+(_0x173c73(_0xd7de30[_0xa3e1('0x65')][_0x4f91b0][_0xa3e1('0x69')])?'\x20'+_0xd7de30[_0xa3e1('0x65')][_0x4f91b0][_0xa3e1('0x6a')]:'');}return _0x35d6ff+')';};var _0x4c5970={'where':{'id':_0x555a3d['id']}},_0x5c36df,_0x2e4496,_0x28b5de,_0x4c9382,_0xdfb901;_0x4c5970=_[_0xa3e1('0x40')]({},_0x4c5970,_0x2c27a3);return db[_0xa3e1('0x30')][_0xa3e1('0x48')](_0x4c5970)[_0xa3e1('0x29')](function(_0x3e8679){if(_0x3e8679){_0x5c36df=_0x3e8679;return _0x3e8679[_0xa3e1('0x6b')]();}return null;})[_0xa3e1('0x29')](function(_0xfd3ba3){if(_0xfd3ba3){if(!_0xfd3ba3[_0xa3e1('0x3c')]){throw new db[(_0xa3e1('0x6c'))][(_0xa3e1('0x8b'))](_0xa3e1('0x6d'),0x193);}_0x2e4496=_0xfd3ba3;return db[_0xa3e1('0x8c')][_0xa3e1('0x8d')]({'raw':!![]});}return null;})[_0xa3e1('0x29')](function(_0x72e22b){if(_0x72e22b){_0x28b5de=_[_0xa3e1('0x6e')](_0x72e22b,'id');var _0x88d60d;var _0x48c7b7=squel[_0xa3e1('0x8e')]();_0x48c7b7[_0xa3e1('0x8f')](_0x5c36df[_0xa3e1('0x6f')]);for(var _0x2d2853=0x0;_0x2d2853<_0x2e4496[_0xa3e1('0x3c')];_0x2d2853+=0x1){_0x88d60d=_0x2e4496[_0x2d2853][_0xa3e1('0x70')]?_0x28b5de[_0x2e4496[_0x2d2853][_0xa3e1('0x70')]]['metric']:_0x2e4496[_0x2d2853]['field'];_0x88d60d=_0x2e4496[_0x2d2853][_0xa3e1('0x72')]?_[_0xa3e1('0x73')](_0x7e6454[_0x2e4496[_0x2d2853]['function']],'%s',_0x88d60d):_0x88d60d;_0x88d60d=_0x2e4496[_0x2d2853]['format']?_[_0xa3e1('0x73')](_0x11fb4a[_0x2e4496[_0x2d2853]['format']],'%s',_0x88d60d):_0x88d60d;if(_0x2e4496[_0x2d2853]['groupBy']){_0x48c7b7['group'](_0x88d60d);}_0x2e4496[_0x2d2853][_0xa3e1('0x75')]&&_0x48c7b7[_0xa3e1('0x76')](_0x88d60d,_0x2e4496[_0x2d2853][_0xa3e1('0x75')]===_0xa3e1('0x77')?![]:!![]);_0x48c7b7[_0xa3e1('0x68')](_0x88d60d,_0x2e4496[_0x2d2853]['alias']||_0x88d60d);}if(_0x5c36df[_0xa3e1('0x79')]){_0x5c36df[_0xa3e1('0x79')]=JSON[_0xa3e1('0x7a')](_0x5c36df[_0xa3e1('0x79')]);for(var _0x339542=0x0;_0x339542<_0x5c36df[_0xa3e1('0x79')][_0xa3e1('0x3c')];_0x339542+=0x1){if(_0x5c36df[_0xa3e1('0x79')][_0x339542][_0xa3e1('0x33')]&&_[_0xa3e1('0x60')](_0x272cc1,_0x5c36df[_0xa3e1('0x79')][_0x339542][_0xa3e1('0x33')])&&_0x5c36df[_0xa3e1('0x79')][_0x339542][_0xa3e1('0x7b')]&&_0x5c36df['joins'][_0x339542]['foreignTable']&&_0x5c36df[_0xa3e1('0x79')][_0x339542][_0xa3e1('0x7e')]){_0x48c7b7[_0x5c36df[_0xa3e1('0x79')][_0x339542]['type']](_0x5c36df['joins'][_0x339542][_0xa3e1('0x7c')],null,util[_0xa3e1('0x74')](_0xa3e1('0x7d'),_0x5c36df['table'],_0x5c36df[_0xa3e1('0x79')][_0x339542][_0xa3e1('0x7b')],_0x5c36df[_0xa3e1('0x79')][_0x339542]['foreignTable'],_0x5c36df['joins'][_0x339542][_0xa3e1('0x7e')]));}}}if(_0x5c36df[_0xa3e1('0x7f')]){_0x5c36df[_0xa3e1('0x7f')]=JSON[_0xa3e1('0x7a')](_0x5c36df[_0xa3e1('0x7f')]);_0x48c7b7['where'](_0x461591(_0x5c36df['conditions'][_0xa3e1('0x67')]));}_0xdfb901=_0x48c7b7['clone']();_0x48c7b7[_0xa3e1('0x20')](_0xf479d4);_0x48c7b7[_0xa3e1('0x22')](0x0);return;}})[_0xa3e1('0x29')](function(){if(_0x68c584[_0xa3e1('0x90')]===_0xa3e1('0x91')){return null;}var _0x555722=_[_0xa3e1('0x40')](_0x68c584,{'name':_0x68c584[_0xa3e1('0x92')]||_0x68c584['name']||_0x5c36df['name'],'basename':_0x3cac26,'savename':util[_0xa3e1('0x74')]('%s-%s.%s',_0x68c584['name']||_0x5c36df[_0xa3e1('0x2e')],require(_0xa3e1('0x93'))[_0xa3e1('0x94')](0x4),_0x68c584[_0xa3e1('0x90')]||_0xa3e1('0x95')),'reportId':_0x5c36df['id'],'reportType':_0xa3e1('0x96')});return db[_0xa3e1('0x97')][_0xa3e1('0x49')](_0x555722,{'raw':!![]});})[_0xa3e1('0x29')](function(_0x1d25ce){if(_0x5c36df['table']===_0xa3e1('0x98')){_0xdfb901[_0xa3e1('0x3d')](_0x5c36df[_0xa3e1('0x6f')]+_0xa3e1('0x99'),_0x68c584[_0xa3e1('0x9a')],_0x68c584[_0xa3e1('0x9b')]);}else{_0xdfb901[_0xa3e1('0x3d')](_0x5c36df[_0xa3e1('0x6f')]+_0xa3e1('0x9c'),_0x68c584['startDate'],_0x68c584[_0xa3e1('0x9b')]);}if(_0x1d25ce){logger[_0xa3e1('0x9d')]('Run\x20Query:',_0xdfb901[_0xa3e1('0x83')]());require(_0xa3e1('0x9e'))[_0xa3e1('0x9f')](path[_0xa3e1('0x87')](__dirname,_0xa3e1('0xa0'),_0x1d25ce['output']),[_0x1d25ce['id'],_0xdfb901[_0xa3e1('0x83')](),path[_0xa3e1('0x87')](__dirname,_0xa3e1('0xa1'),_0x1d25ce[_0xa3e1('0xa2')]),_0x3cac26]);return _0x1d25ce;}else{var _0x1cabd3=squel[_0xa3e1('0x8e')]();_0x1cabd3[_0xa3e1('0x8f')]('('+_0xdfb901['toString']()+')',_0xa3e1('0xa3'));_0x1cabd3[_0xa3e1('0x68')](_0xa3e1('0xa4'),_0xa3e1('0x21'));_0xdfb901['limit'](_0x68c584[_0xa3e1('0x20')]||_0xf479d4);_0xdfb901['offset'](_0x68c584[_0xa3e1('0x22')]||0x0);return dbH[_0xa3e1('0x84')][_0xa3e1('0x36')](_0x1cabd3['toString'](),{'type':dbH[_0xa3e1('0x84')]['QueryTypes'][_0xa3e1('0x86')]})['then'](function(_0x6ef443){if(!_0x6ef443[_0xa3e1('0x3c')]){_0x4c9382=0x0;}else{_0x4c9382=_0x6ef443[0x0][_0xa3e1('0x21')]||0x0;}return dbH[_0xa3e1('0x84')]['query'](_0xdfb901[_0xa3e1('0x83')](),{'type':dbH[_0xa3e1('0x84')]['QueryTypes'][_0xa3e1('0x86')]});})['then'](function(_0x97f31e){return{'rows':_0x97f31e||[],'count':_0x4c9382};});}});}exports[_0xa3e1('0xa5')]=function(_0x29d7c3,_0x519754){return runReport(_0x29d7c3[_0xa3e1('0x46')],_0x29d7c3['query'],_0x29d7c3[_0xa3e1('0x41')])[_0xa3e1('0x29')](respondWithResult(_0x519754,null))['catch'](handleError(_0x519754,null));};exports[_0xa3e1('0xa6')]=runReport;exports[_0xa3e1('0x36')]=function(_0x286475,_0x453c9f){var _0x241d22=0xa;var _0x1376ca=['join',_0xa3e1('0x52'),'right_join',_0xa3e1('0x53')];var _0x318243={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xa3e1('0x55'),'MIN':_0xa3e1('0x56'),'AVG':_0xa3e1('0x57'),'GROUP_CONCAT':_0xa3e1('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xa3e1('0x5a')};var _0x368d87={'SEC_TO_TIME':_0xa3e1('0x5b'),'DATE':_0xa3e1('0x5c'),'HOUR':_0xa3e1('0x5d'),'ROUND':_0xa3e1('0x5e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2a5e1e=function(_0x3df39b){return!_[_0xa3e1('0x60')]([_0xa3e1('0x61'),_0xa3e1('0x62'),_0xa3e1('0x63'),_0xa3e1('0x64')],_0x3df39b);};var _0x2ccf10=function(_0x4faa15){if(!_0x4faa15||!_0x4faa15['rules'][_0xa3e1('0x3c')]){return'';}for(var _0x11c92e='(',_0x48dc7e=0x0;_0x48dc7e<_0x4faa15[_0xa3e1('0x65')][_0xa3e1('0x3c')];_0x48dc7e+=0x1){_0x48dc7e>0x0&&(_0x11c92e+='\x20'+_0x4faa15[_0xa3e1('0x66')]+'\x20');_0x11c92e+=_0x4faa15[_0xa3e1('0x65')][_0x48dc7e][_0xa3e1('0x67')]?_0x2ccf10(_0x4faa15[_0xa3e1('0x65')][_0x48dc7e][_0xa3e1('0x67')]):_0x4faa15[_0xa3e1('0x65')][_0x48dc7e][_0xa3e1('0x68')]+'\x20'+_0x4faa15[_0xa3e1('0x65')][_0x48dc7e][_0xa3e1('0x69')]+(_0x2a5e1e(_0x4faa15[_0xa3e1('0x65')][_0x48dc7e][_0xa3e1('0x69')])?'\x20'+_0x4faa15[_0xa3e1('0x65')][_0x48dc7e]['value']:'');}return _0x11c92e+')';};var _0x4af1c7={'where':{'id':_0x286475[_0xa3e1('0x46')]['id']}},_0x5de641,_0x3ecc50,_0x1f8046,_0x179f17,_0x44c584;_0x4af1c7=_[_0xa3e1('0x40')]({},_0x4af1c7,_0x286475[_0xa3e1('0x41')]);return db['AnalyticCustomReport']['find'](_0x4af1c7)[_0xa3e1('0x29')](function(_0x32c5a5){if(_0x32c5a5){_0x5de641=_0x32c5a5;return _0x32c5a5[_0xa3e1('0x6b')]();}return null;})[_0xa3e1('0x29')](function(_0x1e4ab5){if(_0x1e4ab5){if(!_0x1e4ab5[_0xa3e1('0x3c')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3ecc50=_0x1e4ab5;return db['AnalyticMetric'][_0xa3e1('0x8d')]({'raw':!![]});}return null;})[_0xa3e1('0x29')](function(_0x36b9e8){if(_0x36b9e8){_0x1f8046=_['keyBy'](_0x36b9e8,'id');var _0x20e8a6;var _0x281676=squel[_0xa3e1('0x8e')]();_0x281676['from'](_0x5de641['table']);for(var _0x51e8b1=0x0;_0x51e8b1<_0x3ecc50[_0xa3e1('0x3c')];_0x51e8b1+=0x1){_0x20e8a6=_0x3ecc50[_0x51e8b1][_0xa3e1('0x70')]?_0x1f8046[_0x3ecc50[_0x51e8b1][_0xa3e1('0x70')]][_0xa3e1('0x71')]:_0x3ecc50[_0x51e8b1][_0xa3e1('0x68')];_0x20e8a6=_0x3ecc50[_0x51e8b1][_0xa3e1('0x72')]?_[_0xa3e1('0x73')](_0x318243[_0x3ecc50[_0x51e8b1][_0xa3e1('0x72')]],'%s',_0x20e8a6):_0x20e8a6;_0x20e8a6=_0x3ecc50[_0x51e8b1][_0xa3e1('0x74')]?_[_0xa3e1('0x73')](_0x368d87[_0x3ecc50[_0x51e8b1][_0xa3e1('0x74')]],'%s',_0x20e8a6):_0x20e8a6;if(_0x3ecc50[_0x51e8b1]['groupBy']){_0x281676[_0xa3e1('0x67')](_0x20e8a6);}_0x3ecc50[_0x51e8b1][_0xa3e1('0x75')]&&_0x281676[_0xa3e1('0x76')](_0x20e8a6,_0x3ecc50[_0x51e8b1][_0xa3e1('0x75')]==='DESC'?![]:!![]);_0x281676[_0xa3e1('0x68')](_0x20e8a6,_0x3ecc50[_0x51e8b1][_0xa3e1('0x78')]||_0x20e8a6);}if(_0x5de641[_0xa3e1('0x79')]){_0x5de641[_0xa3e1('0x79')]=JSON['parse'](_0x5de641['joins']);for(var _0x3393e1=0x0;_0x3393e1<_0x5de641[_0xa3e1('0x79')][_0xa3e1('0x3c')];_0x3393e1+=0x1){if(_0x5de641[_0xa3e1('0x79')][_0x3393e1]['type']&&_[_0xa3e1('0x60')](_0x1376ca,_0x5de641[_0xa3e1('0x79')][_0x3393e1][_0xa3e1('0x33')])&&_0x5de641[_0xa3e1('0x79')][_0x3393e1]['parentKey']&&_0x5de641[_0xa3e1('0x79')][_0x3393e1][_0xa3e1('0x7c')]&&_0x5de641[_0xa3e1('0x79')][_0x3393e1][_0xa3e1('0x7e')]){_0x281676[_0x5de641['joins'][_0x3393e1][_0xa3e1('0x33')]](_0x5de641[_0xa3e1('0x79')][_0x3393e1][_0xa3e1('0x7c')],null,util[_0xa3e1('0x74')]('%s.%s\x20=\x20%s.%s',_0x5de641[_0xa3e1('0x6f')],_0x5de641[_0xa3e1('0x79')][_0x3393e1][_0xa3e1('0x7b')],_0x5de641['joins'][_0x3393e1]['foreignTable'],_0x5de641[_0xa3e1('0x79')][_0x3393e1][_0xa3e1('0x7e')]));}}}if(_0x5de641[_0xa3e1('0x7f')]){_0x5de641[_0xa3e1('0x7f')]=JSON[_0xa3e1('0x7a')](_0x5de641[_0xa3e1('0x7f')]);_0x281676['where'](_0x2ccf10(_0x5de641[_0xa3e1('0x7f')][_0xa3e1('0x67')]));}_0x44c584=_0x281676[_0xa3e1('0x80')]();_0x281676[_0xa3e1('0x20')](_0x241d22);_0x281676[_0xa3e1('0x22')](0x0);logger[_0xa3e1('0x81')](_0xa3e1('0x82'),_0x281676[_0xa3e1('0x83')]());return dbH[_0xa3e1('0x84')][_0xa3e1('0x36')](_0x281676['toString'](),{'type':dbH[_0xa3e1('0x84')][_0xa3e1('0x85')][_0xa3e1('0x86')]});}})['then'](function(){return{'sql':_0x44c584[_0xa3e1('0x83')]()};})[_0xa3e1('0x29')](respondWithResult(_0x453c9f,null))[_0xa3e1('0x44')](handleError(_0x453c9f,null));}; \ No newline at end of file +var _0x8306=['error','name','send','index','map','AnalyticCustomReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','replace','format','groupBy','orderBy','order','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','sequelize','toString','QueryTypes','left_join','COUNT(DISTINCT\x20%s)','DATE(%s)','getFields','ValidationErrorItem','from','function','foreignKey','output','web','fullPath','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','right_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','debug','Limited\x20Query:','SELECT','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then','get','CustomReports','UserProfileResource'];(function(_0x4f4e5e,_0x2ca3ed){var _0x195bd6=function(_0x3ab10c){while(--_0x3ab10c){_0x4f4e5e['push'](_0x4f4e5e['shift']());}};_0x195bd6(++_0x2ca3ed);}(_0x8306,0x125));var _0x6830=function(_0x570cbd,_0x555f4b){_0x570cbd=_0x570cbd-0x0;var _0x3e3470=_0x8306[_0x570cbd];return _0x3e3470;};'use strict';var emlformat=require(_0x6830('0x0'));var rimraf=require(_0x6830('0x1'));var zipdir=require(_0x6830('0x2'));var jsonpatch=require(_0x6830('0x3'));var rp=require('request-promise');var moment=require(_0x6830('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6830('0x5'));var util=require(_0x6830('0x6'));var path=require(_0x6830('0x7'));var sox=require(_0x6830('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6830('0x9'));var _=require(_0x6830('0xa'));var squel=require(_0x6830('0xb'));var crypto=require('crypto');var jsforce=require(_0x6830('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6830('0xd'));var querystring=require(_0x6830('0xe'));var Papa=require(_0x6830('0xf'));var Redis=require(_0x6830('0x10'));var authService=require(_0x6830('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6830('0x12'));var hardwareService=require(_0x6830('0x13'));var logger=require('../../config/logger')(_0x6830('0x14'));var utils=require(_0x6830('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6830('0x16'));var db=require('../../mysqldb')['db'];var dbH=require(_0x6830('0x17'))[_0x6830('0x18')];function respondWithStatusCode(_0x1ea247,_0x4bd61d){_0x4bd61d=_0x4bd61d||0xcc;return function(_0x32241b){if(_0x32241b){return _0x1ea247[_0x6830('0x19')](_0x4bd61d);}return _0x1ea247[_0x6830('0x1a')](_0x4bd61d)[_0x6830('0x1b')]();};}function respondWithResult(_0x185a1e,_0x280364){_0x280364=_0x280364||0xc8;return function(_0xc6b156){if(_0xc6b156){return _0x185a1e[_0x6830('0x1a')](_0x280364)['json'](_0xc6b156);}};}function respondWithFilteredResult(_0xbad3c3,_0x5186c6){return function(_0x1305ab){if(_0x1305ab){var _0x13ac5c=typeof _0x5186c6[_0x6830('0x1c')]===_0x6830('0x1d')&&typeof _0x5186c6[_0x6830('0x1e')]===_0x6830('0x1d');var _0x4d7fc6=_0x1305ab[_0x6830('0x1f')];var _0x319231=_0x13ac5c?0x0:_0x5186c6[_0x6830('0x1c')];var _0x158bfe=_0x13ac5c?_0x1305ab['count']:_0x5186c6[_0x6830('0x1c')]+_0x5186c6[_0x6830('0x1e')];var _0x1dcbda;if(_0x158bfe>=_0x4d7fc6){_0x158bfe=_0x4d7fc6;_0x1dcbda=0xc8;}else{_0x1dcbda=0xce;}_0xbad3c3['status'](_0x1dcbda);return _0xbad3c3[_0x6830('0x20')]('Content-Range',_0x319231+'-'+_0x158bfe+'/'+_0x4d7fc6)[_0x6830('0x21')](_0x1305ab);}return null;};}function patchUpdates(_0x35acb2){return function(_0x492012){try{jsonpatch[_0x6830('0x22')](_0x492012,_0x35acb2,!![]);}catch(_0x41475b){return BPromise[_0x6830('0x23')](_0x41475b);}return _0x492012[_0x6830('0x24')]();};}function saveUpdates(_0x26e9d4,_0x1ee78d){return function(_0xd5629c){if(_0xd5629c){return _0xd5629c[_0x6830('0x25')](_0x26e9d4)['then'](function(_0x478d9b){return _0x478d9b;});}return null;};}function removeEntity(_0x108082,_0xdeaac8){return function(_0x13d487){if(_0x13d487){return _0x13d487[_0x6830('0x26')]()[_0x6830('0x27')](function(){var _0x55a23a=_0x13d487[_0x6830('0x28')]({'plain':!![]});var _0x30e654=_0x6830('0x29');return db[_0x6830('0x2a')]['destroy']({'where':{'type':_0x30e654,'resourceId':_0x55a23a['id']}})[_0x6830('0x27')](function(){return _0x13d487;});})[_0x6830('0x27')](function(){_0x108082[_0x6830('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x257aa1,_0x5234b7){return function(_0x56b93a){if(!_0x56b93a){_0x257aa1[_0x6830('0x19')](0x194);}return _0x56b93a;};}function handleError(_0x12fcdd,_0x2221a9){_0x2221a9=_0x2221a9||0x1f4;return function(_0x36e3ac){logger[_0x6830('0x2b')](_0x36e3ac['stack']);if(_0x36e3ac['name']){delete _0x36e3ac[_0x6830('0x2c')];}_0x12fcdd[_0x6830('0x1a')](_0x2221a9)[_0x6830('0x2d')](_0x36e3ac);};}exports[_0x6830('0x2e')]=function(_0x2a915a,_0xdb0d5e){var _0x2330b8={},_0x46e7a3={},_0x5346a7={'count':0x0,'rows':[]};var _0x5aa539=_[_0x6830('0x2f')](db[_0x6830('0x30')]['rawAttributes'],function(_0xa0af39){return{'name':_0xa0af39[_0x6830('0x31')],'type':_0xa0af39[_0x6830('0x32')][_0x6830('0x33')]};});_0x46e7a3[_0x6830('0x34')]=_['map'](_0x5aa539,'name');_0x46e7a3[_0x6830('0x35')]=_['keys'](_0x2a915a[_0x6830('0x35')]);_0x46e7a3[_0x6830('0x36')]=_[_0x6830('0x37')](_0x46e7a3['model'],_0x46e7a3['query']);_0x2330b8[_0x6830('0x38')]=_[_0x6830('0x37')](_0x46e7a3['model'],qs['fields'](_0x2a915a[_0x6830('0x35')][_0x6830('0x39')]));_0x2330b8[_0x6830('0x38')]=_0x2330b8[_0x6830('0x38')][_0x6830('0x3a')]?_0x2330b8[_0x6830('0x38')]:_0x46e7a3[_0x6830('0x34')];if(!_0x2a915a['query'][_0x6830('0x3b')](_0x6830('0x3c'))){_0x2330b8['limit']=qs[_0x6830('0x1e')](_0x2a915a[_0x6830('0x35')][_0x6830('0x1e')]);_0x2330b8[_0x6830('0x1c')]=qs[_0x6830('0x1c')](_0x2a915a[_0x6830('0x35')][_0x6830('0x1c')]);}_0x2330b8['order']=qs[_0x6830('0x3d')](_0x2a915a[_0x6830('0x35')]['sort']);_0x2330b8[_0x6830('0x3e')]=qs['filters'](_[_0x6830('0x3f')](_0x2a915a['query'],_0x46e7a3[_0x6830('0x36')]),_0x5aa539);if(_0x2a915a[_0x6830('0x35')][_0x6830('0x40')]){_0x2330b8[_0x6830('0x3e')]=_[_0x6830('0x41')](_0x2330b8[_0x6830('0x3e')],{'$or':_[_0x6830('0x2f')](_0x5aa539,function(_0xaff06e){if(_0xaff06e[_0x6830('0x32')]!==_0x6830('0x42')){var _0x144ce6={};_0x144ce6[_0xaff06e[_0x6830('0x2c')]]={'$like':'%'+_0x2a915a['query'][_0x6830('0x40')]+'%'};return _0x144ce6;}})});}_0x2330b8=_[_0x6830('0x41')]({},_0x2330b8,_0x2a915a[_0x6830('0x43')]);var _0x564bca={'where':_0x2330b8[_0x6830('0x3e')]};return db[_0x6830('0x30')]['count'](_0x564bca)[_0x6830('0x27')](function(_0x2c1e3d){_0x5346a7[_0x6830('0x1f')]=_0x2c1e3d;if(_0x2a915a['query'][_0x6830('0x44')]){_0x2330b8[_0x6830('0x45')]=[{'all':!![]}];}return db[_0x6830('0x30')][_0x6830('0x46')](_0x2330b8);})[_0x6830('0x27')](function(_0xb93a51){_0x5346a7[_0x6830('0x47')]=_0xb93a51;return _0x5346a7;})[_0x6830('0x27')](respondWithFilteredResult(_0xdb0d5e,_0x2330b8))[_0x6830('0x48')](handleError(_0xdb0d5e,null));};exports[_0x6830('0x49')]=function(_0x41883f,_0x5b79e1){var _0x5c675f={'raw':![],'where':{'id':_0x41883f[_0x6830('0x4a')]['id']}},_0x23347b={};_0x23347b['model']=_[_0x6830('0x4b')](db[_0x6830('0x30')][_0x6830('0x4c')]);_0x23347b['query']=_[_0x6830('0x4b')](_0x41883f[_0x6830('0x35')]);_0x23347b[_0x6830('0x36')]=_['intersection'](_0x23347b[_0x6830('0x34')],_0x23347b[_0x6830('0x35')]);_0x5c675f[_0x6830('0x38')]=_['intersection'](_0x23347b[_0x6830('0x34')],qs[_0x6830('0x39')](_0x41883f['query'][_0x6830('0x39')]));_0x5c675f['attributes']=_0x5c675f[_0x6830('0x38')][_0x6830('0x3a')]?_0x5c675f['attributes']:_0x23347b[_0x6830('0x34')];if(_0x41883f[_0x6830('0x35')][_0x6830('0x44')]){_0x5c675f['include']=[{'all':!![]}];}_0x5c675f=_[_0x6830('0x41')]({},_0x5c675f,_0x41883f[_0x6830('0x43')]);return db[_0x6830('0x30')][_0x6830('0x4d')](_0x5c675f)[_0x6830('0x27')](handleEntityNotFound(_0x5b79e1,null))['then'](respondWithResult(_0x5b79e1,null))[_0x6830('0x48')](handleError(_0x5b79e1,null));};exports['create']=function(_0x4eb390,_0x229f09){return db[_0x6830('0x30')][_0x6830('0x4e')](_0x4eb390[_0x6830('0x4f')],{})[_0x6830('0x27')](function(_0x4df29f){var _0x2db5e1=_0x4eb390[_0x6830('0x50')]['get']({'plain':!![]});if(!_0x2db5e1)throw new Error(_0x6830('0x51'));if(_0x2db5e1[_0x6830('0x52')]===_0x6830('0x50')){var _0x28f24f=_0x4df29f['get']({'plain':!![]});var _0x394f9d=_0x6830('0x53');return db['UserProfileSection'][_0x6830('0x4d')]({'where':{'name':_0x394f9d,'userProfileId':_0x2db5e1[_0x6830('0x54')]},'raw':!![]})[_0x6830('0x27')](function(_0x3222fe){if(_0x3222fe&&_0x3222fe[_0x6830('0x55')]===0x0){return db[_0x6830('0x2a')][_0x6830('0x4e')]({'name':_0x28f24f[_0x6830('0x2c')],'resourceId':_0x28f24f['id'],'type':'CustomReports','sectionId':_0x3222fe['id']},{})[_0x6830('0x27')](function(){return _0x4df29f;});}else{return _0x4df29f;}})['catch'](function(_0x126a44){logger[_0x6830('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x126a44);throw _0x126a44;});}return _0x4df29f;})[_0x6830('0x27')](respondWithResult(_0x229f09,0xc9))[_0x6830('0x48')](handleError(_0x229f09,null));};exports[_0x6830('0x25')]=function(_0x53e553,_0x19afc2){if(_0x53e553['body']['id']){delete _0x53e553[_0x6830('0x4f')]['id'];}return db[_0x6830('0x30')][_0x6830('0x4d')]({'where':{'id':_0x53e553[_0x6830('0x4a')]['id']}})['then'](handleEntityNotFound(_0x19afc2,null))[_0x6830('0x27')](saveUpdates(_0x53e553[_0x6830('0x4f')],null))['then'](respondWithResult(_0x19afc2,null))[_0x6830('0x48')](handleError(_0x19afc2,null));};exports[_0x6830('0x26')]=function(_0x1d81e4,_0x1be37a){return db[_0x6830('0x30')][_0x6830('0x4d')]({'where':{'id':_0x1d81e4[_0x6830('0x4a')]['id']}})[_0x6830('0x27')](handleEntityNotFound(_0x1be37a,null))[_0x6830('0x27')](removeEntity(_0x1be37a,null))['catch'](handleError(_0x1be37a,null));};exports['preview']=function(_0x18e3aa,_0xa1a310){var _0x4e1561=0xa;var _0xc1aa26=[_0x6830('0x56'),'left_join','right_join',_0x6830('0x57')];var _0x5e6e13={'SUM':_0x6830('0x58'),'COUNT':_0x6830('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x6830('0x5a'),'MIN':_0x6830('0x5b'),'AVG':_0x6830('0x5c'),'GROUP_CONCAT':_0x6830('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x6830('0x5e')};var _0x44a062={'SEC_TO_TIME':_0x6830('0x5f'),'DATE':'DATE(%s)','HOUR':_0x6830('0x60'),'ROUND':_0x6830('0x61'),'UNIX_TIMESTAMP':_0x6830('0x62')};var _0x4e1c97=function(_0x5c8adc){return!_[_0x6830('0x63')]([_0x6830('0x64'),_0x6830('0x65'),_0x6830('0x66'),_0x6830('0x67')],_0x5c8adc);};var _0x2c0d90=function(_0x5bb981){if(!_0x5bb981||!_0x5bb981[_0x6830('0x68')][_0x6830('0x3a')]){return'';}for(var _0x2e079f='(',_0x4effe0=0x0;_0x4effe0<_0x5bb981['rules'][_0x6830('0x3a')];_0x4effe0+=0x1){_0x4effe0>0x0&&(_0x2e079f+='\x20'+_0x5bb981[_0x6830('0x69')]+'\x20');_0x2e079f+=_0x5bb981['rules'][_0x4effe0]['group']?_0x2c0d90(_0x5bb981[_0x6830('0x68')][_0x4effe0][_0x6830('0x6a')]):_0x5bb981['rules'][_0x4effe0][_0x6830('0x6b')]+'\x20'+_0x5bb981[_0x6830('0x68')][_0x4effe0][_0x6830('0x6c')]+(_0x4e1c97(_0x5bb981['rules'][_0x4effe0][_0x6830('0x6c')])?'\x20'+_0x5bb981['rules'][_0x4effe0][_0x6830('0x6d')]:'');}return _0x2e079f+')';};var _0x52bb11={'where':{'id':_0x18e3aa[_0x6830('0x4a')]['id']}},_0x24e045,_0x1b334b,_0x58acd8,_0x832745,_0x1d6034;_0x52bb11=_[_0x6830('0x41')]({},_0x52bb11,_0x18e3aa[_0x6830('0x43')]);return db[_0x6830('0x30')][_0x6830('0x4d')](_0x52bb11)[_0x6830('0x27')](function(_0x31ce48){if(_0x31ce48){_0x24e045=_0x31ce48;return _0x31ce48['getFields']();}return null;})[_0x6830('0x27')](function(_0x213eec){if(_0x213eec){if(!_0x213eec[_0x6830('0x3a')]){throw new db[(_0x6830('0x6e'))]['ValidationErrorItem'](_0x6830('0x6f'),0x193);}_0x1b334b=_0x213eec;return db[_0x6830('0x70')][_0x6830('0x46')]({'raw':!![]});}return null;})[_0x6830('0x27')](function(_0x195839){if(_0x195839){_0x58acd8=_[_0x6830('0x71')](_0x195839,'id');var _0x2fa8e5;var _0x3d7645=squel[_0x6830('0x72')]();_0x3d7645['from'](_0x24e045[_0x6830('0x73')]);for(var _0x299a43=0x0;_0x299a43<_0x1b334b['length'];_0x299a43+=0x1){_0x2fa8e5=_0x1b334b[_0x299a43][_0x6830('0x74')]?_0x58acd8[_0x1b334b[_0x299a43][_0x6830('0x74')]][_0x6830('0x75')]:_0x1b334b[_0x299a43][_0x6830('0x6b')];_0x2fa8e5=_0x1b334b[_0x299a43]['function']?_[_0x6830('0x76')](_0x5e6e13[_0x1b334b[_0x299a43]['function']],'%s',_0x2fa8e5):_0x2fa8e5;_0x2fa8e5=_0x1b334b[_0x299a43][_0x6830('0x77')]?_['replace'](_0x44a062[_0x1b334b[_0x299a43][_0x6830('0x77')]],'%s',_0x2fa8e5):_0x2fa8e5;if(_0x1b334b[_0x299a43][_0x6830('0x78')]){_0x3d7645[_0x6830('0x6a')](_0x2fa8e5);}_0x1b334b[_0x299a43][_0x6830('0x79')]&&_0x3d7645[_0x6830('0x7a')](_0x2fa8e5,_0x1b334b[_0x299a43][_0x6830('0x79')]===_0x6830('0x7b')?![]:!![]);_0x3d7645[_0x6830('0x6b')](_0x2fa8e5,_0x1b334b[_0x299a43][_0x6830('0x7c')]||_0x2fa8e5);}if(_0x24e045['joins']){_0x24e045[_0x6830('0x7d')]=JSON[_0x6830('0x7e')](_0x24e045['joins']);for(var _0x5a4a04=0x0;_0x5a4a04<_0x24e045[_0x6830('0x7d')][_0x6830('0x3a')];_0x5a4a04+=0x1){if(_0x24e045[_0x6830('0x7d')][_0x5a4a04][_0x6830('0x32')]&&_[_0x6830('0x63')](_0xc1aa26,_0x24e045[_0x6830('0x7d')][_0x5a4a04][_0x6830('0x32')])&&_0x24e045[_0x6830('0x7d')][_0x5a4a04][_0x6830('0x7f')]&&_0x24e045[_0x6830('0x7d')][_0x5a4a04][_0x6830('0x80')]&&_0x24e045[_0x6830('0x7d')][_0x5a4a04]['foreignKey']){_0x3d7645[_0x24e045['joins'][_0x5a4a04]['type']](_0x24e045[_0x6830('0x7d')][_0x5a4a04]['foreignTable'],null,util[_0x6830('0x77')](_0x6830('0x81'),_0x24e045[_0x6830('0x73')],_0x24e045[_0x6830('0x7d')][_0x5a4a04][_0x6830('0x7f')],_0x24e045[_0x6830('0x7d')][_0x5a4a04][_0x6830('0x80')],_0x24e045[_0x6830('0x7d')][_0x5a4a04]['foreignKey']));}}}if(_0x24e045[_0x6830('0x82')]){_0x24e045[_0x6830('0x82')]=JSON[_0x6830('0x7e')](_0x24e045[_0x6830('0x82')]);_0x3d7645['where'](_0x2c0d90(_0x24e045[_0x6830('0x82')][_0x6830('0x6a')]));}_0x1d6034=_0x3d7645[_0x6830('0x83')]();_0x3d7645[_0x6830('0x1e')](_0x4e1561);_0x3d7645[_0x6830('0x1c')](0x0);logger['debug']('Limited\x20Query:',_0x3d7645['toString']());return dbH[_0x6830('0x84')][_0x6830('0x35')](_0x3d7645[_0x6830('0x85')](),{'type':dbH[_0x6830('0x84')][_0x6830('0x86')]['SELECT']});}})['then'](respondWithResult(_0xa1a310,null))[_0x6830('0x48')](handleError(_0xa1a310,null));};function runReport(_0x4e54f4,_0x317ce7,_0x1d0cfd){var _0x48f01a=_0x317ce7['name'];var _0x48470d=0xa;var _0x1cf849=[_0x6830('0x56'),_0x6830('0x87'),'right_join',_0x6830('0x57')];var _0x289edc={'SUM':_0x6830('0x58'),'COUNT':_0x6830('0x59'),'COUNT DISTINCT':_0x6830('0x88'),'MAX':_0x6830('0x5a'),'MIN':_0x6830('0x5b'),'AVG':_0x6830('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x165902={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x6830('0x89'),'HOUR':_0x6830('0x60'),'ROUND':_0x6830('0x61'),'UNIX_TIMESTAMP':_0x6830('0x62')};var _0x21448e=function(_0xeb7f2e){return!_[_0x6830('0x63')]([_0x6830('0x64'),_0x6830('0x65'),_0x6830('0x66'),_0x6830('0x67')],_0xeb7f2e);};var _0x23db58=function(_0x306e7d){if(!_0x306e7d||!_0x306e7d[_0x6830('0x68')][_0x6830('0x3a')]){return'';}for(var _0x2f85af='(',_0x2f25d2=0x0;_0x2f25d2<_0x306e7d[_0x6830('0x68')][_0x6830('0x3a')];_0x2f25d2+=0x1){_0x2f25d2>0x0&&(_0x2f85af+='\x20'+_0x306e7d[_0x6830('0x69')]+'\x20');_0x2f85af+=_0x306e7d[_0x6830('0x68')][_0x2f25d2]['group']?_0x23db58(_0x306e7d[_0x6830('0x68')][_0x2f25d2][_0x6830('0x6a')]):_0x306e7d['rules'][_0x2f25d2][_0x6830('0x6b')]+'\x20'+_0x306e7d[_0x6830('0x68')][_0x2f25d2]['condition']+(_0x21448e(_0x306e7d[_0x6830('0x68')][_0x2f25d2][_0x6830('0x6c')])?'\x20'+_0x306e7d[_0x6830('0x68')][_0x2f25d2]['value']:'');}return _0x2f85af+')';};var _0x2af0e8={'where':{'id':_0x4e54f4['id']}},_0x22bbff,_0x4b4529,_0xd806a2,_0x9c05c6,_0x50d04e;_0x2af0e8=_[_0x6830('0x41')]({},_0x2af0e8,_0x1d0cfd);return db['AnalyticCustomReport'][_0x6830('0x4d')](_0x2af0e8)[_0x6830('0x27')](function(_0x12ebb7){if(_0x12ebb7){_0x22bbff=_0x12ebb7;return _0x12ebb7[_0x6830('0x8a')]();}return null;})[_0x6830('0x27')](function(_0x60bad1){if(_0x60bad1){if(!_0x60bad1[_0x6830('0x3a')]){throw new db[(_0x6830('0x6e'))][(_0x6830('0x8b'))](_0x6830('0x6f'),0x193);}_0x4b4529=_0x60bad1;return db['AnalyticMetric'][_0x6830('0x46')]({'raw':!![]});}return null;})[_0x6830('0x27')](function(_0x4d25b0){if(_0x4d25b0){_0xd806a2=_[_0x6830('0x71')](_0x4d25b0,'id');var _0x176c6c;var _0x2c8bc6=squel[_0x6830('0x72')]();_0x2c8bc6[_0x6830('0x8c')](_0x22bbff[_0x6830('0x73')]);for(var _0x594e10=0x0;_0x594e10<_0x4b4529[_0x6830('0x3a')];_0x594e10+=0x1){_0x176c6c=_0x4b4529[_0x594e10][_0x6830('0x74')]?_0xd806a2[_0x4b4529[_0x594e10][_0x6830('0x74')]]['metric']:_0x4b4529[_0x594e10]['field'];_0x176c6c=_0x4b4529[_0x594e10][_0x6830('0x8d')]?_[_0x6830('0x76')](_0x289edc[_0x4b4529[_0x594e10]['function']],'%s',_0x176c6c):_0x176c6c;_0x176c6c=_0x4b4529[_0x594e10][_0x6830('0x77')]?_[_0x6830('0x76')](_0x165902[_0x4b4529[_0x594e10][_0x6830('0x77')]],'%s',_0x176c6c):_0x176c6c;if(_0x4b4529[_0x594e10]['groupBy']){_0x2c8bc6[_0x6830('0x6a')](_0x176c6c);}_0x4b4529[_0x594e10]['orderBy']&&_0x2c8bc6[_0x6830('0x7a')](_0x176c6c,_0x4b4529[_0x594e10][_0x6830('0x79')]===_0x6830('0x7b')?![]:!![]);_0x2c8bc6[_0x6830('0x6b')](_0x176c6c,_0x4b4529[_0x594e10][_0x6830('0x7c')]||_0x176c6c);}if(_0x22bbff[_0x6830('0x7d')]){_0x22bbff[_0x6830('0x7d')]=JSON['parse'](_0x22bbff[_0x6830('0x7d')]);for(var _0x216246=0x0;_0x216246<_0x22bbff[_0x6830('0x7d')][_0x6830('0x3a')];_0x216246+=0x1){if(_0x22bbff[_0x6830('0x7d')][_0x216246][_0x6830('0x32')]&&_[_0x6830('0x63')](_0x1cf849,_0x22bbff['joins'][_0x216246]['type'])&&_0x22bbff[_0x6830('0x7d')][_0x216246]['parentKey']&&_0x22bbff[_0x6830('0x7d')][_0x216246][_0x6830('0x80')]&&_0x22bbff[_0x6830('0x7d')][_0x216246][_0x6830('0x8e')]){_0x2c8bc6[_0x22bbff[_0x6830('0x7d')][_0x216246][_0x6830('0x32')]](_0x22bbff[_0x6830('0x7d')][_0x216246]['foreignTable'],null,util['format'](_0x6830('0x81'),_0x22bbff[_0x6830('0x73')],_0x22bbff['joins'][_0x216246][_0x6830('0x7f')],_0x22bbff['joins'][_0x216246]['foreignTable'],_0x22bbff[_0x6830('0x7d')][_0x216246][_0x6830('0x8e')]));}}}if(_0x22bbff[_0x6830('0x82')]){_0x22bbff[_0x6830('0x82')]=JSON['parse'](_0x22bbff[_0x6830('0x82')]);_0x2c8bc6['where'](_0x23db58(_0x22bbff[_0x6830('0x82')][_0x6830('0x6a')]));}_0x50d04e=_0x2c8bc6['clone']();_0x2c8bc6['limit'](_0x48470d);_0x2c8bc6['offset'](0x0);return;}})['then'](function(){if(_0x317ce7[_0x6830('0x8f')]===_0x6830('0x90')){return null;}var _0x2ce75a=_[_0x6830('0x41')](_0x317ce7,{'name':_0x317ce7[_0x6830('0x91')]||_0x317ce7[_0x6830('0x2c')]||_0x22bbff['name'],'basename':_0x48f01a,'savename':util[_0x6830('0x77')]('%s-%s.%s',_0x317ce7[_0x6830('0x2c')]||_0x22bbff[_0x6830('0x2c')],require(_0x6830('0x92'))[_0x6830('0x93')](0x4),_0x317ce7[_0x6830('0x8f')]||_0x6830('0x94')),'reportId':_0x22bbff['id'],'reportType':_0x6830('0x95')});return db[_0x6830('0x96')][_0x6830('0x4e')](_0x2ce75a,{'raw':!![]});})[_0x6830('0x27')](function(_0x458fdd){if(_0x22bbff[_0x6830('0x73')]==='cdr'){_0x50d04e[_0x6830('0x3e')](_0x22bbff[_0x6830('0x73')]+_0x6830('0x97'),_0x317ce7[_0x6830('0x98')],_0x317ce7[_0x6830('0x99')]);}else{_0x50d04e[_0x6830('0x3e')](_0x22bbff[_0x6830('0x73')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x317ce7[_0x6830('0x98')],_0x317ce7[_0x6830('0x99')]);}if(_0x458fdd){logger['info'](_0x6830('0x9a'),_0x50d04e['toString']());require(_0x6830('0x9b'))[_0x6830('0x9c')](path[_0x6830('0x56')](__dirname,_0x6830('0x9d'),_0x458fdd[_0x6830('0x8f')]),[_0x458fdd['id'],_0x50d04e['toString'](),path[_0x6830('0x56')](__dirname,_0x6830('0x9e'),_0x458fdd[_0x6830('0x9f')]),_0x48f01a]);return _0x458fdd;}else{var _0x513ec7=squel[_0x6830('0x72')]();_0x513ec7[_0x6830('0x8c')]('('+_0x50d04e[_0x6830('0x85')]()+')','countTable');_0x513ec7[_0x6830('0x6b')](_0x6830('0xa0'),_0x6830('0x1f'));_0x50d04e[_0x6830('0x1e')](_0x317ce7['limit']||_0x48470d);_0x50d04e[_0x6830('0x1c')](_0x317ce7[_0x6830('0x1c')]||0x0);return dbH['sequelize'][_0x6830('0x35')](_0x513ec7[_0x6830('0x85')](),{'type':dbH[_0x6830('0x84')]['QueryTypes']['SELECT']})[_0x6830('0x27')](function(_0x5e6ce2){if(!_0x5e6ce2[_0x6830('0x3a')]){_0x9c05c6=0x0;}else{_0x9c05c6=_0x5e6ce2[0x0][_0x6830('0x1f')]||0x0;}return dbH[_0x6830('0x84')][_0x6830('0x35')](_0x50d04e[_0x6830('0x85')](),{'type':dbH[_0x6830('0x84')][_0x6830('0x86')]['SELECT']});})[_0x6830('0x27')](function(_0xf67826){return{'rows':_0xf67826||[],'count':_0x9c05c6};});}});}exports[_0x6830('0xa1')]=function(_0x4573bc,_0x30e99e){return runReport(_0x4573bc['params'],_0x4573bc[_0x6830('0x35')],_0x4573bc['options'])[_0x6830('0x27')](respondWithResult(_0x30e99e,null))['catch'](handleError(_0x30e99e,null));};exports[_0x6830('0xa2')]=runReport;exports[_0x6830('0x35')]=function(_0x5988de,_0x5b7b0f){var _0x329212=0xa;var _0x282809=[_0x6830('0x56'),_0x6830('0x87'),_0x6830('0xa3'),_0x6830('0x57')];var _0x493ebf={'SUM':_0x6830('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x6830('0x88'),'MAX':'MAX(%s)','MIN':_0x6830('0x5b'),'AVG':_0x6830('0x5c'),'GROUP_CONCAT':_0x6830('0x5d'),'GROUP_CONCAT ASC':_0x6830('0xa4'),'GROUP_CONCAT DESC':_0x6830('0x5e')};var _0x90b03c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x6830('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x32322d=function(_0x4b25ed){return!_['includes']([_0x6830('0x64'),_0x6830('0x65'),_0x6830('0x66'),_0x6830('0x67')],_0x4b25ed);};var _0x3262d6=function(_0x251986){if(!_0x251986||!_0x251986[_0x6830('0x68')][_0x6830('0x3a')]){return'';}for(var _0x10c7a9='(',_0x26b4f6=0x0;_0x26b4f6<_0x251986[_0x6830('0x68')][_0x6830('0x3a')];_0x26b4f6+=0x1){_0x26b4f6>0x0&&(_0x10c7a9+='\x20'+_0x251986[_0x6830('0x69')]+'\x20');_0x10c7a9+=_0x251986['rules'][_0x26b4f6]['group']?_0x3262d6(_0x251986[_0x6830('0x68')][_0x26b4f6][_0x6830('0x6a')]):_0x251986[_0x6830('0x68')][_0x26b4f6][_0x6830('0x6b')]+'\x20'+_0x251986[_0x6830('0x68')][_0x26b4f6][_0x6830('0x6c')]+(_0x32322d(_0x251986[_0x6830('0x68')][_0x26b4f6]['condition'])?'\x20'+_0x251986[_0x6830('0x68')][_0x26b4f6][_0x6830('0x6d')]:'');}return _0x10c7a9+')';};var _0x18a89e={'where':{'id':_0x5988de[_0x6830('0x4a')]['id']}},_0x150bff,_0x20217e,_0x30c1c9,_0xd7a54,_0x112b21;_0x18a89e=_[_0x6830('0x41')]({},_0x18a89e,_0x5988de[_0x6830('0x43')]);return db[_0x6830('0x30')]['find'](_0x18a89e)[_0x6830('0x27')](function(_0x8a6617){if(_0x8a6617){_0x150bff=_0x8a6617;return _0x8a6617[_0x6830('0x8a')]();}return null;})[_0x6830('0x27')](function(_0x49df47){if(_0x49df47){if(!_0x49df47[_0x6830('0x3a')]){throw new db[(_0x6830('0x6e'))]['ValidationErrorItem'](_0x6830('0x6f'),0x193);}_0x20217e=_0x49df47;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x495eb0){if(_0x495eb0){_0x30c1c9=_[_0x6830('0x71')](_0x495eb0,'id');var _0x50ad50;var _0xb584ec=squel['select']();_0xb584ec[_0x6830('0x8c')](_0x150bff[_0x6830('0x73')]);for(var _0x1ba986=0x0;_0x1ba986<_0x20217e[_0x6830('0x3a')];_0x1ba986+=0x1){_0x50ad50=_0x20217e[_0x1ba986][_0x6830('0x74')]?_0x30c1c9[_0x20217e[_0x1ba986]['MetricId']][_0x6830('0x75')]:_0x20217e[_0x1ba986][_0x6830('0x6b')];_0x50ad50=_0x20217e[_0x1ba986][_0x6830('0x8d')]?_[_0x6830('0x76')](_0x493ebf[_0x20217e[_0x1ba986][_0x6830('0x8d')]],'%s',_0x50ad50):_0x50ad50;_0x50ad50=_0x20217e[_0x1ba986][_0x6830('0x77')]?_['replace'](_0x90b03c[_0x20217e[_0x1ba986]['format']],'%s',_0x50ad50):_0x50ad50;if(_0x20217e[_0x1ba986][_0x6830('0x78')]){_0xb584ec[_0x6830('0x6a')](_0x50ad50);}_0x20217e[_0x1ba986][_0x6830('0x79')]&&_0xb584ec[_0x6830('0x7a')](_0x50ad50,_0x20217e[_0x1ba986]['orderBy']==='DESC'?![]:!![]);_0xb584ec[_0x6830('0x6b')](_0x50ad50,_0x20217e[_0x1ba986][_0x6830('0x7c')]||_0x50ad50);}if(_0x150bff[_0x6830('0x7d')]){_0x150bff['joins']=JSON[_0x6830('0x7e')](_0x150bff[_0x6830('0x7d')]);for(var _0x3eab9c=0x0;_0x3eab9c<_0x150bff[_0x6830('0x7d')]['length'];_0x3eab9c+=0x1){if(_0x150bff[_0x6830('0x7d')][_0x3eab9c][_0x6830('0x32')]&&_[_0x6830('0x63')](_0x282809,_0x150bff['joins'][_0x3eab9c][_0x6830('0x32')])&&_0x150bff[_0x6830('0x7d')][_0x3eab9c]['parentKey']&&_0x150bff['joins'][_0x3eab9c][_0x6830('0x80')]&&_0x150bff['joins'][_0x3eab9c][_0x6830('0x8e')]){_0xb584ec[_0x150bff[_0x6830('0x7d')][_0x3eab9c][_0x6830('0x32')]](_0x150bff['joins'][_0x3eab9c]['foreignTable'],null,util[_0x6830('0x77')](_0x6830('0x81'),_0x150bff['table'],_0x150bff[_0x6830('0x7d')][_0x3eab9c][_0x6830('0x7f')],_0x150bff['joins'][_0x3eab9c][_0x6830('0x80')],_0x150bff[_0x6830('0x7d')][_0x3eab9c]['foreignKey']));}}}if(_0x150bff[_0x6830('0x82')]){_0x150bff[_0x6830('0x82')]=JSON[_0x6830('0x7e')](_0x150bff[_0x6830('0x82')]);_0xb584ec['where'](_0x3262d6(_0x150bff[_0x6830('0x82')][_0x6830('0x6a')]));}_0x112b21=_0xb584ec[_0x6830('0x83')]();_0xb584ec[_0x6830('0x1e')](_0x329212);_0xb584ec[_0x6830('0x1c')](0x0);logger[_0x6830('0xa5')](_0x6830('0xa6'),_0xb584ec['toString']());return dbH[_0x6830('0x84')][_0x6830('0x35')](_0xb584ec['toString'](),{'type':dbH[_0x6830('0x84')]['QueryTypes'][_0x6830('0xa7')]});}})[_0x6830('0x27')](function(){return{'sql':_0x112b21['toString']()};})[_0x6830('0x27')](respondWithResult(_0x5b7b0f,null))[_0x6830('0x48')](handleError(_0x5b7b0f,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index fa7de25..b5f001f 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 _0x9be6=['AnalyticCustomReport','analytics_custom_reports','lodash','util','api','moment','bluebird','path','./analyticCustomReport.attributes','exports','define'];(function(_0x155775,_0x1709e9){var _0x5189be=function(_0x46af44){while(--_0x46af44){_0x155775['push'](_0x155775['shift']());}};_0x5189be(++_0x1709e9);}(_0x9be6,0x9c));var _0x69be=function(_0x5498aa,_0x3feb67){_0x5498aa=_0x5498aa-0x0;var _0x202f15=_0x9be6[_0x5498aa];return _0x202f15;};'use strict';var _=require(_0x69be('0x0'));var util=require(_0x69be('0x1'));var logger=require('../../config/logger')(_0x69be('0x2'));var moment=require(_0x69be('0x3'));var BPromise=require(_0x69be('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x69be('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x69be('0x6'));module[_0x69be('0x7')]=function(_0x33246b,_0x6499dd){return _0x33246b[_0x69be('0x8')](_0x69be('0x9'),attributes,{'tableName':_0x69be('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84cd=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util'];(function(_0x1c4ce5,_0x1091a4){var _0x52822e=function(_0x3ccce7){while(--_0x3ccce7){_0x1c4ce5['push'](_0x1c4ce5['shift']());}};_0x52822e(++_0x1091a4);}(_0x84cd,0x193));var _0xd84c=function(_0x5aed8e,_0x48d372){_0x5aed8e=_0x5aed8e-0x0;var _0x4890d4=_0x84cd[_0x5aed8e];return _0x4890d4;};'use strict';var _=require(_0xd84c('0x0'));var util=require(_0xd84c('0x1'));var logger=require(_0xd84c('0x2'))(_0xd84c('0x3'));var moment=require(_0xd84c('0x4'));var BPromise=require(_0xd84c('0x5'));var rp=require(_0xd84c('0x6'));var fs=require('fs');var path=require(_0xd84c('0x7'));var rimraf=require(_0xd84c('0x8'));var config=require(_0xd84c('0x9'));var attributes=require(_0xd84c('0xa'));module[_0xd84c('0xb')]=function(_0x3ff9c4,_0x3f05d2){return _0x3ff9c4[_0xd84c('0xc')](_0xd84c('0xd'),attributes,{'tableName':_0xd84c('0xe'),'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 ee650e6..84be106 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 _0xcb7b=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0xcb7b,0x10b));var _0xbcb7=function(_0x162e01,_0x57b508){_0x162e01=_0x162e01-0x0;var _0x198aa1=_0xcb7b[_0x162e01];return _0x198aa1;};'use strict';var _=require('lodash');var util=require(_0xbcb7('0x0'));var moment=require(_0xbcb7('0x1'));var BPromise=require(_0xbcb7('0x2'));var rs=require(_0xbcb7('0x3'));var fs=require('fs');var Redis=require(_0xbcb7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbcb7('0x5'))(_0xbcb7('0x6'));var config=require('../../config/environment');var jayson=require(_0xbcb7('0x7'));var client=jayson[_0xbcb7('0x8')][_0xbcb7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x197666,_0x341adb,_0x591c7f){return new BPromise(function(_0x1d1bcc,_0x58931c){return client[_0xbcb7('0xa')](_0x197666,_0x591c7f)[_0xbcb7('0xb')](function(_0x5000c2){logger[_0xbcb7('0xc')](_0xbcb7('0xd'),_0x341adb,_0xbcb7('0xe'));logger['debug'](_0xbcb7('0xf'),_0x341adb,_0xbcb7('0xe'),JSON[_0xbcb7('0x10')](_0x5000c2));if(_0x5000c2[_0xbcb7('0x11')]){if(_0x5000c2[_0xbcb7('0x11')][_0xbcb7('0x12')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x341adb,_0x5000c2[_0xbcb7('0x11')][_0xbcb7('0x13')]);return _0x58931c(_0x5000c2[_0xbcb7('0x11')][_0xbcb7('0x13')]);}logger[_0xbcb7('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x341adb,_0x5000c2[_0xbcb7('0x11')][_0xbcb7('0x13')]);return _0x1d1bcc(_0x5000c2['error'][_0xbcb7('0x13')]);}else{logger[_0xbcb7('0xc')](_0xbcb7('0xd'),_0x341adb,_0xbcb7('0xe'));_0x1d1bcc(_0x5000c2[_0xbcb7('0x14')][_0xbcb7('0x13')]);}})[_0xbcb7('0x15')](function(_0x1a3fec){logger['error'](_0xbcb7('0xd'),_0x341adb,_0x1a3fec);_0x58931c(_0x1a3fec);});});} \ No newline at end of file +var _0x7c7f=['catch','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info'];(function(_0x22663b,_0xc8c6e3){var _0x310d0a=function(_0x151e66){while(--_0x151e66){_0x22663b['push'](_0x22663b['shift']());}};_0x310d0a(++_0xc8c6e3);}(_0x7c7f,0x78));var _0xf7c7=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0x7c7f[_0x3b5ad9];return _0x611ae9;};'use strict';var _=require('lodash');var util=require(_0xf7c7('0x0'));var moment=require('moment');var BPromise=require(_0xf7c7('0x1'));var rs=require(_0xf7c7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf7c7('0x3'));var logger=require(_0xf7c7('0x4'))(_0xf7c7('0x5'));var config=require(_0xf7c7('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf7c7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x38a0bf,_0x533625,_0x43df7a){return new BPromise(function(_0x715a56,_0x6c34c0){return client[_0xf7c7('0x8')](_0x38a0bf,_0x43df7a)['then'](function(_0xac07f7){logger['info'](_0xf7c7('0x9'),_0x533625,_0xf7c7('0xa'));logger[_0xf7c7('0xb')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x533625,_0xf7c7('0xa'),JSON[_0xf7c7('0xc')](_0xac07f7));if(_0xac07f7[_0xf7c7('0xd')]){if(_0xac07f7[_0xf7c7('0xd')]['code']===0x1f4){logger[_0xf7c7('0xd')](_0xf7c7('0x9'),_0x533625,_0xac07f7[_0xf7c7('0xd')][_0xf7c7('0xe')]);return _0x6c34c0(_0xac07f7['error'][_0xf7c7('0xe')]);}logger[_0xf7c7('0xd')](_0xf7c7('0x9'),_0x533625,_0xac07f7[_0xf7c7('0xd')]['message']);return _0x715a56(_0xac07f7[_0xf7c7('0xd')][_0xf7c7('0xe')]);}else{logger[_0xf7c7('0xf')](_0xf7c7('0x9'),_0x533625,_0xf7c7('0xa'));_0x715a56(_0xac07f7['result'][_0xf7c7('0xe')]);}})[_0xf7c7('0x10')](function(_0x1cb717){logger['error'](_0xf7c7('0x9'),_0x533625,_0x1cb717);_0x6c34c0(_0x1cb717);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 2db958a..edb3628 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 _0x3abe=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/preview','preview','/:id/run','run','query','post','create','put','/:id','update','destroy','multer','path','connect-timeout'];(function(_0x24d22f,_0xfa6241){var _0x33b153=function(_0x28caa6){while(--_0x28caa6){_0x24d22f['push'](_0x24d22f['shift']());}};_0x33b153(++_0xfa6241);}(_0x3abe,0x13f));var _0xe3ab=function(_0x401333,_0x1b5130){_0x401333=_0x401333-0x0;var _0x759692=_0x3abe[_0x401333];return _0x759692;};'use strict';var multer=require(_0xe3ab('0x0'));var util=require('util');var path=require(_0xe3ab('0x1'));var timeout=require(_0xe3ab('0x2'));var express=require(_0xe3ab('0x3'));var router=express['Router']();var fs_extra=require(_0xe3ab('0x4'));var auth=require(_0xe3ab('0x5'));var interaction=require(_0xe3ab('0x6'));var config=require(_0xe3ab('0x7'));var controller=require('./analyticCustomReport.controller');router[_0xe3ab('0x8')]('/',auth['isAuthenticated'](),controller[_0xe3ab('0x9')]);router[_0xe3ab('0x8')]('/:id',auth[_0xe3ab('0xa')](),controller[_0xe3ab('0xb')]);router[_0xe3ab('0x8')](_0xe3ab('0xc'),auth[_0xe3ab('0xa')](),controller[_0xe3ab('0xd')]);router['get'](_0xe3ab('0xe'),auth['isAuthenticated'](),controller[_0xe3ab('0xf')]);router[_0xe3ab('0x8')]('/:id/query',auth[_0xe3ab('0xa')](),controller[_0xe3ab('0x10')]);router[_0xe3ab('0x11')]('/',auth[_0xe3ab('0xa')](),controller[_0xe3ab('0x12')]);router[_0xe3ab('0x13')](_0xe3ab('0x14'),auth[_0xe3ab('0xa')](),controller[_0xe3ab('0x15')]);router['delete'](_0xe3ab('0x14'),auth[_0xe3ab('0xa')](),controller[_0xe3ab('0x16')]);module['exports']=router; \ No newline at end of file +var _0x2ab9=['get','isAuthenticated','index','/:id','show','preview','/:id/run','/:id/query','query','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x5ee0c6,_0x2d1d69){var _0x150b84=function(_0x42164c){while(--_0x42164c){_0x5ee0c6['push'](_0x5ee0c6['shift']());}};_0x150b84(++_0x2d1d69);}(_0x2ab9,0x64));var _0x92ab=function(_0x5e1830,_0x3727eb){_0x5e1830=_0x5e1830-0x0;var _0x2cdc5c=_0x2ab9[_0x5e1830];return _0x2cdc5c;};'use strict';var multer=require(_0x92ab('0x0'));var util=require('util');var path=require(_0x92ab('0x1'));var timeout=require(_0x92ab('0x2'));var express=require(_0x92ab('0x3'));var router=express[_0x92ab('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router[_0x92ab('0x5')]('/',auth[_0x92ab('0x6')](),controller[_0x92ab('0x7')]);router[_0x92ab('0x5')](_0x92ab('0x8'),auth[_0x92ab('0x6')](),controller[_0x92ab('0x9')]);router[_0x92ab('0x5')]('/:id/preview',auth['isAuthenticated'](),controller[_0x92ab('0xa')]);router[_0x92ab('0x5')](_0x92ab('0xb'),auth['isAuthenticated'](),controller['run']);router[_0x92ab('0x5')](_0x92ab('0xc'),auth['isAuthenticated'](),controller[_0x92ab('0xd')]);router[_0x92ab('0xe')]('/',auth['isAuthenticated'](),controller[_0x92ab('0xf')]);router[_0x92ab('0x10')](_0x92ab('0x8'),auth[_0x92ab('0x6')](),controller[_0x92ab('0x11')]);router[_0x92ab('0x12')]('/:id',auth[_0x92ab('0x6')](),controller[_0x92ab('0x13')]);module[_0x92ab('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 475bf59..c605afd 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 _0xdc97=['exports','STRING','TEXT','sequelize'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0xdc97,0x13b));var _0x7dc9=function(_0x434007,_0x4c502a){_0x434007=_0x434007-0x0;var _0x395c87=_0xdc97[_0x434007];return _0x395c87;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'name':{'type':Sequelize[_0x7dc9('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x7dc9('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7dc9('0x3')]},'joins':{'type':Sequelize[_0x7dc9('0x3')]}}; \ No newline at end of file +var _0x31f0=['sequelize','STRING','TEXT'];(function(_0x575d97,_0x457408){var _0x21a19d=function(_0x1fac39){while(--_0x1fac39){_0x575d97['push'](_0x575d97['shift']());}};_0x21a19d(++_0x457408);}(_0x31f0,0xb7));var _0x031f=function(_0x4f9aef,_0x48f7fa){_0x4f9aef=_0x4f9aef-0x0;var _0x58c6c2=_0x31f0[_0x4f9aef];return _0x58c6c2;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'name':{'type':Sequelize[_0x031f('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x031f('0x1')]},'table':{'type':Sequelize[_0x031f('0x1')]},'conditions':{'type':Sequelize[_0x031f('0x2')]},'joins':{'type':Sequelize[_0x031f('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index cbf7a95..d80572d 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 _0x687b=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','sendStatus','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','options','findAll','catch','params','intersection','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','merge','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ValidationErrorItem','DESC','parentKey','web','fullPath','%s-%s.%s','output','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','cross_join','%s.%s\x20=\x20%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x687b,0x14a));var _0xb687=function(_0x3522c8,_0x1e7c82){_0x3522c8=_0x3522c8-0x0;var _0x22f498=_0x687b[_0x3522c8];return _0x22f498;};'use strict';var emlformat=require(_0xb687('0x0'));var rimraf=require(_0xb687('0x1'));var zipdir=require(_0xb687('0x2'));var jsonpatch=require(_0xb687('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb687('0x4'));var Mustache=require(_0xb687('0x5'));var util=require(_0xb687('0x6'));var path=require(_0xb687('0x7'));var sox=require(_0xb687('0x8'));var csv=require(_0xb687('0x9'));var ejs=require(_0xb687('0xa'));var fs=require('fs');var fs_extra=require(_0xb687('0xb'));var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];var dbH=require(_0xb687('0x1b'))['dbH'];function respondWithStatusCode(_0x4c97ed,_0x3e85b3){_0x3e85b3=_0x3e85b3||0xcc;return function(_0x155ebe){if(_0x155ebe){return _0x4c97ed['sendStatus'](_0x3e85b3);}return _0x4c97ed[_0xb687('0x1c')](_0x3e85b3)[_0xb687('0x1d')]();};}function respondWithResult(_0x1f1f35,_0x30d502){_0x30d502=_0x30d502||0xc8;return function(_0x838dd4){if(_0x838dd4){return _0x1f1f35[_0xb687('0x1c')](_0x30d502)[_0xb687('0x1e')](_0x838dd4);}};}function respondWithFilteredResult(_0x141375,_0x263085){return function(_0x2c7a18){if(_0x2c7a18){var _0x25124a=typeof _0x263085[_0xb687('0x1f')]==='undefined'&&typeof _0x263085[_0xb687('0x20')]===_0xb687('0x21');var _0x30d370=_0x2c7a18['count'];var _0x48958d=_0x25124a?0x0:_0x263085[_0xb687('0x1f')];var _0x3a10ef=_0x25124a?_0x2c7a18[_0xb687('0x22')]:_0x263085['offset']+_0x263085[_0xb687('0x20')];var _0x481f1d;if(_0x3a10ef>=_0x30d370){_0x3a10ef=_0x30d370;_0x481f1d=0xc8;}else{_0x481f1d=0xce;}_0x141375[_0xb687('0x1c')](_0x481f1d);return _0x141375[_0xb687('0x23')](_0xb687('0x24'),_0x48958d+'-'+_0x3a10ef+'/'+_0x30d370)[_0xb687('0x1e')](_0x2c7a18);}return null;};}function patchUpdates(_0x49d5a1){return function(_0x3a73d5){try{jsonpatch['apply'](_0x3a73d5,_0x49d5a1,!![]);}catch(_0x335541){return BPromise[_0xb687('0x25')](_0x335541);}return _0x3a73d5[_0xb687('0x26')]();};}function saveUpdates(_0x546fde,_0x1dc06b){return function(_0x491623){if(_0x491623){return _0x491623[_0xb687('0x27')](_0x546fde)[_0xb687('0x28')](function(_0xbf6c58){return _0xbf6c58;});}return null;};}function removeEntity(_0x38866c,_0xf48ba4){return function(_0x2f0a0a){if(_0x2f0a0a){return _0x2f0a0a['destroy']()[_0xb687('0x28')](function(){var _0x129347=_0x2f0a0a[_0xb687('0x29')]({'plain':!![]});var _0x1a0261=_0xb687('0x2a');return db[_0xb687('0x2b')][_0xb687('0x2c')]({'where':{'type':_0x1a0261,'resourceId':_0x129347['id']}})[_0xb687('0x28')](function(){return _0x2f0a0a;});})[_0xb687('0x28')](function(){_0x38866c[_0xb687('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3712cf,_0x192966){return function(_0x392721){if(!_0x392721){_0x3712cf[_0xb687('0x2d')](0x194);}return _0x392721;};}function handleError(_0x2e5c8d,_0x173c58){_0x173c58=_0x173c58||0x1f4;return function(_0x4e9a06){logger[_0xb687('0x2e')](_0x4e9a06['stack']);if(_0x4e9a06[_0xb687('0x2f')]){delete _0x4e9a06[_0xb687('0x2f')];}_0x2e5c8d[_0xb687('0x1c')](_0x173c58)[_0xb687('0x30')](_0x4e9a06);};}exports[_0xb687('0x31')]=function(_0x43d20d,_0xf1f0dd){var _0x556815={},_0x3da2be={},_0xe3428f={'count':0x0,'rows':[]};var _0x3c08ab=_[_0xb687('0x32')](db[_0xb687('0x33')][_0xb687('0x34')],function(_0x44be88){return{'name':_0x44be88[_0xb687('0x35')],'type':_0x44be88[_0xb687('0x36')][_0xb687('0x37')]};});_0x3da2be[_0xb687('0x38')]=_['map'](_0x3c08ab,'name');_0x3da2be[_0xb687('0x39')]=_[_0xb687('0x3a')](_0x43d20d[_0xb687('0x39')]);_0x3da2be[_0xb687('0x3b')]=_['intersection'](_0x3da2be['model'],_0x3da2be[_0xb687('0x39')]);_0x556815[_0xb687('0x3c')]=_['intersection'](_0x3da2be[_0xb687('0x38')],qs[_0xb687('0x3d')](_0x43d20d['query'][_0xb687('0x3d')]));_0x556815['attributes']=_0x556815[_0xb687('0x3c')][_0xb687('0x3e')]?_0x556815[_0xb687('0x3c')]:_0x3da2be[_0xb687('0x38')];if(!_0x43d20d[_0xb687('0x39')][_0xb687('0x3f')]('nolimit')){_0x556815[_0xb687('0x20')]=qs[_0xb687('0x20')](_0x43d20d[_0xb687('0x39')][_0xb687('0x20')]);_0x556815['offset']=qs[_0xb687('0x1f')](_0x43d20d[_0xb687('0x39')][_0xb687('0x1f')]);}_0x556815[_0xb687('0x40')]=qs[_0xb687('0x41')](_0x43d20d['query'][_0xb687('0x41')]);_0x556815[_0xb687('0x42')]=qs[_0xb687('0x3b')](_[_0xb687('0x43')](_0x43d20d[_0xb687('0x39')],_0x3da2be[_0xb687('0x3b')]),_0x3c08ab);if(_0x43d20d['query']['filter']){_0x556815[_0xb687('0x42')]=_['merge'](_0x556815[_0xb687('0x42')],{'$or':_[_0xb687('0x32')](_0x3c08ab,function(_0x48d3b1){if(_0x48d3b1[_0xb687('0x36')]!==_0xb687('0x44')){var _0x57776b={};_0x57776b[_0x48d3b1[_0xb687('0x2f')]]={'$like':'%'+_0x43d20d[_0xb687('0x39')][_0xb687('0x45')]+'%'};return _0x57776b;}})});}_0x556815=_['merge']({},_0x556815,_0x43d20d[_0xb687('0x46')]);var _0x9cffb2={'where':_0x556815[_0xb687('0x42')]};return db[_0xb687('0x33')][_0xb687('0x22')](_0x9cffb2)[_0xb687('0x28')](function(_0x21b9ef){_0xe3428f['count']=_0x21b9ef;if(_0x43d20d[_0xb687('0x39')]['includeAll']){_0x556815['include']=[{'all':!![]}];}return db[_0xb687('0x33')][_0xb687('0x47')](_0x556815);})['then'](function(_0x19a21c){_0xe3428f['rows']=_0x19a21c;return _0xe3428f;})[_0xb687('0x28')](respondWithFilteredResult(_0xf1f0dd,_0x556815))[_0xb687('0x48')](handleError(_0xf1f0dd,null));};exports['show']=function(_0x4cb7a0,_0x3a8509){var _0x5d9cb0={'raw':!![],'where':{'id':_0x4cb7a0[_0xb687('0x49')]['id']}},_0x247c67={};_0x247c67[_0xb687('0x38')]=_[_0xb687('0x3a')](db[_0xb687('0x33')][_0xb687('0x34')]);_0x247c67[_0xb687('0x39')]=_[_0xb687('0x3a')](_0x4cb7a0[_0xb687('0x39')]);_0x247c67[_0xb687('0x3b')]=_[_0xb687('0x4a')](_0x247c67[_0xb687('0x38')],_0x247c67['query']);_0x5d9cb0[_0xb687('0x3c')]=_['intersection'](_0x247c67[_0xb687('0x38')],qs[_0xb687('0x3d')](_0x4cb7a0[_0xb687('0x39')][_0xb687('0x3d')]));_0x5d9cb0[_0xb687('0x3c')]=_0x5d9cb0[_0xb687('0x3c')]['length']?_0x5d9cb0['attributes']:_0x247c67[_0xb687('0x38')];if(_0x4cb7a0[_0xb687('0x39')][_0xb687('0x4b')]){_0x5d9cb0[_0xb687('0x4c')]=[{'all':!![]}];}_0x5d9cb0=_['merge']({},_0x5d9cb0,_0x4cb7a0[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x5d9cb0)[_0xb687('0x28')](handleEntityNotFound(_0x3a8509,null))['then'](respondWithResult(_0x3a8509,null))[_0xb687('0x48')](handleError(_0x3a8509,null));};exports[_0xb687('0x4e')]=function(_0x162b19,_0x401b99){return db['AnalyticDefaultReport']['create'](_0x162b19[_0xb687('0x4f')],{})[_0xb687('0x28')](function(_0x42b61a){var _0x508862=_0x162b19['user'][_0xb687('0x29')]({'plain':!![]});if(!_0x508862)throw new Error(_0xb687('0x50'));if(_0x508862[_0xb687('0x51')]===_0xb687('0x52')){var _0x34205d=_0x42b61a[_0xb687('0x29')]({'plain':!![]});var _0x602864=_0xb687('0x53');return db['UserProfileSection'][_0xb687('0x4d')]({'where':{'name':_0x602864,'userProfileId':_0x508862[_0xb687('0x54')]},'raw':!![]})[_0xb687('0x28')](function(_0x4f5784){if(_0x4f5784&&_0x4f5784['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x34205d[_0xb687('0x2f')],'resourceId':_0x34205d['id'],'type':_0xb687('0x2a'),'sectionId':_0x4f5784['id']},{})[_0xb687('0x28')](function(){return _0x42b61a;});}else{return _0x42b61a;}})[_0xb687('0x48')](function(_0x1ddfd4){logger[_0xb687('0x2e')](_0xb687('0x55'),_0x1ddfd4);throw _0x1ddfd4;});}return _0x42b61a;})[_0xb687('0x28')](respondWithResult(_0x401b99,0xc9))[_0xb687('0x48')](handleError(_0x401b99,null));};exports[_0xb687('0x27')]=function(_0x128264,_0x166900){if(_0x128264[_0xb687('0x4f')]['id']){delete _0x128264[_0xb687('0x4f')]['id'];}return db[_0xb687('0x33')][_0xb687('0x4d')]({'where':{'id':_0x128264[_0xb687('0x49')]['id']}})['then'](handleEntityNotFound(_0x166900,null))['then'](saveUpdates(_0x128264[_0xb687('0x4f')],null))[_0xb687('0x28')](respondWithResult(_0x166900,null))[_0xb687('0x48')](handleError(_0x166900,null));};exports[_0xb687('0x2c')]=function(_0x4e5642,_0xfa8790){return db[_0xb687('0x33')]['find']({'where':{'id':_0x4e5642[_0xb687('0x49')]['id']}})['then'](handleEntityNotFound(_0xfa8790,null))[_0xb687('0x28')](removeEntity(_0xfa8790,null))[_0xb687('0x48')](handleError(_0xfa8790,null));};exports['preview']=function(_0x4fb188,_0x13ad6a){var _0x4ab9c5=0xa;var _0x5ea8fd=[_0xb687('0x56'),_0xb687('0x57'),_0xb687('0x58'),'cross_join'];var _0x25e140={'SUM':'SUM(%s)','COUNT':_0xb687('0x59'),'COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':_0xb687('0x5c'),'AVG':_0xb687('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb687('0x5e')};var _0x58ec8b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':_0xb687('0x60')};var _0xbc3a94=function(_0x4bc18f){return!_[_0xb687('0x61')]([_0xb687('0x62'),_0xb687('0x63'),_0xb687('0x64'),_0xb687('0x65')],_0x4bc18f);};var _0x17505c=function(_0x132e3a){if(!_0x132e3a||!_0x132e3a['rules']['length']){return'';}for(var _0x2714c6='(',_0x4906df=0x0;_0x4906df<_0x132e3a[_0xb687('0x66')][_0xb687('0x3e')];_0x4906df+=0x1){_0x4906df>0x0&&(_0x2714c6+='\x20'+_0x132e3a[_0xb687('0x67')]+'\x20');_0x2714c6+=_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x68')]?_0x17505c(_0x132e3a['rules'][_0x4906df][_0xb687('0x68')]):_0x132e3a['rules'][_0x4906df][_0xb687('0x69')]+'\x20'+_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6a')]+(_0xbc3a94(_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6a')])?'\x20'+_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6b')]:'');}return _0x2714c6+')';};var _0x5deb7a={'where':{'id':_0x4fb188['params']['id']}},_0x28a6aa,_0x31ed20,_0x8942b7,_0x36bb4b,_0x258caf;_0x5deb7a=_[_0xb687('0x6c')]({},_0x5deb7a,_0x4fb188[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x5deb7a)[_0xb687('0x28')](function(_0x15ef44){if(_0x15ef44){_0x28a6aa=_0x15ef44;return _0x15ef44[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x177ea4){if(_0x177ea4){if(!_0x177ea4[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))]['ValidationErrorItem'](_0xb687('0x6f'),0x193);}_0x31ed20=_0x177ea4;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x505f7a){if(_0x505f7a){_0x8942b7=_[_0xb687('0x71')](_0x505f7a,'id');var _0x1a6075;var _0x53b00a=squel[_0xb687('0x72')]();_0x53b00a[_0xb687('0x73')](_0x28a6aa[_0xb687('0x74')]);for(var _0x5eeb75=0x0;_0x5eeb75<_0x31ed20[_0xb687('0x3e')];_0x5eeb75+=0x1){_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x75')]?_0x8942b7[_0x31ed20[_0x5eeb75]['MetricId']][_0xb687('0x76')]:_0x31ed20[_0x5eeb75][_0xb687('0x69')];_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x77')]?_[_0xb687('0x78')](_0x25e140[_0x31ed20[_0x5eeb75]['function']],'%s',_0x1a6075):_0x1a6075;_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x79')]?_[_0xb687('0x78')](_0x58ec8b[_0x31ed20[_0x5eeb75]['format']],'%s',_0x1a6075):_0x1a6075;if(_0x31ed20[_0x5eeb75][_0xb687('0x7a')]){_0x53b00a[_0xb687('0x68')](_0x1a6075);}_0x31ed20[_0x5eeb75]['orderBy']&&_0x53b00a['order'](_0x1a6075,_0x31ed20[_0x5eeb75][_0xb687('0x7b')]==='DESC'?![]:!![]);_0x53b00a[_0xb687('0x69')](_0x1a6075,_0x31ed20[_0x5eeb75][_0xb687('0x7c')]||_0x1a6075);}if(_0x28a6aa[_0xb687('0x7d')]){_0x28a6aa[_0xb687('0x7d')]=JSON[_0xb687('0x7e')](_0x28a6aa[_0xb687('0x7d')]);for(var _0x229bc4=0x0;_0x229bc4<_0x28a6aa[_0xb687('0x7d')]['length'];_0x229bc4+=0x1){if(_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')]&&_[_0xb687('0x61')](_0x5ea8fd,_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')])&&_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['parentKey']&&_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x7f')]&&_0x28a6aa['joins'][_0x229bc4][_0xb687('0x80')]){_0x53b00a[_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')]](_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['foreignTable'],null,util[_0xb687('0x79')]('%s.%s\x20=\x20%s.%s',_0x28a6aa['table'],_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['parentKey'],_0x28a6aa['joins'][_0x229bc4][_0xb687('0x7f')],_0x28a6aa['joins'][_0x229bc4][_0xb687('0x80')]));}}}if(_0x28a6aa[_0xb687('0x81')]){_0x28a6aa['conditions']=JSON[_0xb687('0x7e')](_0x28a6aa[_0xb687('0x81')]);_0x53b00a['where'](_0x17505c(_0x28a6aa[_0xb687('0x81')][_0xb687('0x68')]));}_0x258caf=_0x53b00a[_0xb687('0x82')]();_0x53b00a[_0xb687('0x20')](_0x4ab9c5);_0x53b00a[_0xb687('0x1f')](0x0);logger[_0xb687('0x83')](_0xb687('0x84'),_0x53b00a[_0xb687('0x85')]());return dbH[_0xb687('0x86')][_0xb687('0x39')](_0x53b00a[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')]['SELECT']});}})['then'](respondWithResult(_0x13ad6a,null))[_0xb687('0x48')](handleError(_0x13ad6a,null));};function runReport(_0x29e830,_0x22ebca,_0xfecb8d){var _0x3a7339=_0x22ebca['name'];var _0x59c94b=0xa;var _0x29e27e=[_0xb687('0x56'),_0xb687('0x57'),_0xb687('0x58'),'cross_join'];var _0x448d59={'SUM':_0xb687('0x88'),'COUNT':_0xb687('0x59'),'COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':_0xb687('0x5c'),'AVG':_0xb687('0x5d'),'GROUP_CONCAT':_0xb687('0x89'),'GROUP_CONCAT ASC':_0xb687('0x8a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x25f5c3={'SEC_TO_TIME':_0xb687('0x8b'),'DATE':_0xb687('0x8c'),'HOUR':_0xb687('0x8d'),'ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1037b1=function(_0x3bf480){return!_['includes']([_0xb687('0x62'),'IS\x20NOT\x20NULL',_0xb687('0x64'),_0xb687('0x65')],_0x3bf480);};var _0x5ec5f6=function(_0x1c683e){if(!_0x1c683e||!_0x1c683e[_0xb687('0x66')]['length']){return'';}for(var _0x231caa='(',_0x3479c5=0x0;_0x3479c5<_0x1c683e[_0xb687('0x66')][_0xb687('0x3e')];_0x3479c5+=0x1){_0x3479c5>0x0&&(_0x231caa+='\x20'+_0x1c683e[_0xb687('0x67')]+'\x20');_0x231caa+=_0x1c683e[_0xb687('0x66')][_0x3479c5]['group']?_0x5ec5f6(_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x68')]):_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x69')]+'\x20'+_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6a')]+(_0x1037b1(_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6a')])?'\x20'+_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6b')]:'');}return _0x231caa+')';};var _0x290ddf={'where':{'id':_0x29e830['id']}},_0x5ee585,_0x10fb0,_0x5be566,_0x3d98e2,_0x3aa1c8;_0x290ddf=_['merge']({},_0x290ddf,_0xfecb8d);return db['AnalyticDefaultReport'][_0xb687('0x4d')](_0x290ddf)[_0xb687('0x28')](function(_0x3b4acf){if(_0x3b4acf){_0x5ee585=_0x3b4acf;return _0x3b4acf[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x1c3de0){if(_0x1c3de0){if(!_0x1c3de0[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))][(_0xb687('0x8e'))](_0xb687('0x6f'),0x193);}_0x10fb0=_0x1c3de0;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x1ea6fd){if(_0x1ea6fd){_0x5be566=_[_0xb687('0x71')](_0x1ea6fd,'id');var _0x3f45b7;var _0x508550=squel['select']();_0x508550[_0xb687('0x73')](_0x5ee585['table']);for(var _0x5f2557=0x0;_0x5f2557<_0x10fb0[_0xb687('0x3e')];_0x5f2557+=0x1){_0x3f45b7=_0x10fb0[_0x5f2557][_0xb687('0x75')]?_0x5be566[_0x10fb0[_0x5f2557]['MetricId']][_0xb687('0x76')]:_0x10fb0[_0x5f2557][_0xb687('0x69')];_0x3f45b7=_0x10fb0[_0x5f2557]['function']?_[_0xb687('0x78')](_0x448d59[_0x10fb0[_0x5f2557][_0xb687('0x77')]],'%s',_0x3f45b7):_0x3f45b7;_0x3f45b7=_0x10fb0[_0x5f2557][_0xb687('0x79')]?_[_0xb687('0x78')](_0x25f5c3[_0x10fb0[_0x5f2557][_0xb687('0x79')]],'%s',_0x3f45b7):_0x3f45b7;if(_0x10fb0[_0x5f2557][_0xb687('0x7a')]){_0x508550[_0xb687('0x68')](_0x3f45b7);}_0x10fb0[_0x5f2557][_0xb687('0x7b')]&&_0x508550[_0xb687('0x40')](_0x3f45b7,_0x10fb0[_0x5f2557]['orderBy']===_0xb687('0x8f')?![]:!![]);_0x508550[_0xb687('0x69')](_0x3f45b7,_0x10fb0[_0x5f2557]['alias']||_0x3f45b7);}if(_0x5ee585[_0xb687('0x7d')]){_0x5ee585['joins']=JSON[_0xb687('0x7e')](_0x5ee585[_0xb687('0x7d')]);for(var _0x59166c=0x0;_0x59166c<_0x5ee585[_0xb687('0x7d')][_0xb687('0x3e')];_0x59166c+=0x1){if(_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')]&&_[_0xb687('0x61')](_0x29e27e,_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')])&&_0x5ee585['joins'][_0x59166c]['parentKey']&&_0x5ee585[_0xb687('0x7d')][_0x59166c]['foreignTable']&&_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x80')]){_0x508550[_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')]](_0x5ee585['joins'][_0x59166c][_0xb687('0x7f')],null,util[_0xb687('0x79')]('%s.%s\x20=\x20%s.%s',_0x5ee585[_0xb687('0x74')],_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x90')],_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x7f')],_0x5ee585[_0xb687('0x7d')][_0x59166c]['foreignKey']));}}}if(_0x5ee585[_0xb687('0x81')]){_0x5ee585[_0xb687('0x81')]=JSON[_0xb687('0x7e')](_0x5ee585[_0xb687('0x81')]);_0x508550[_0xb687('0x42')](_0x5ec5f6(_0x5ee585[_0xb687('0x81')][_0xb687('0x68')]));}_0x3aa1c8=_0x508550[_0xb687('0x82')]();_0x508550[_0xb687('0x20')](_0x59c94b);_0x508550[_0xb687('0x1f')](0x0);return;}})['then'](function(){if(_0x22ebca['output']===_0xb687('0x91')){return null;}var _0x1a7cd8=_[_0xb687('0x6c')](_0x22ebca,{'name':_0x22ebca[_0xb687('0x92')]||_0x22ebca[_0xb687('0x2f')]||_0x5ee585[_0xb687('0x2f')],'basename':_0x3a7339,'savename':util[_0xb687('0x79')](_0xb687('0x93'),_0x22ebca[_0xb687('0x2f')]||_0x5ee585['name'],require('randomstring')['generate'](0x4),_0x22ebca[_0xb687('0x94')]||_0xb687('0x95')),'reportId':_0x5ee585['id'],'reportType':_0xb687('0x96')});return db[_0xb687('0x97')][_0xb687('0x4e')](_0x1a7cd8,{'raw':!![]});})[_0xb687('0x28')](function(_0x473130){if(_0x5ee585[_0xb687('0x74')]==='cdr'){_0x3aa1c8[_0xb687('0x42')](_0x5ee585[_0xb687('0x74')]+_0xb687('0x98'),_0x22ebca[_0xb687('0x99')],_0x22ebca[_0xb687('0x9a')]);}else{_0x3aa1c8[_0xb687('0x42')](_0x5ee585[_0xb687('0x74')]+_0xb687('0x9b'),_0x22ebca['startDate'],_0x22ebca[_0xb687('0x9a')]);}if(_0x473130){logger['info'](_0xb687('0x9c'),_0x3aa1c8[_0xb687('0x85')]());require('child_process')[_0xb687('0x9d')](path[_0xb687('0x56')](__dirname,_0xb687('0x9e'),_0x473130['output']),[_0x473130['id'],_0x3aa1c8[_0xb687('0x85')](),path[_0xb687('0x56')](__dirname,_0xb687('0x9f'),_0x473130[_0xb687('0xa0')]),_0x3a7339]);return _0x473130;}else{var _0x3d4596=squel[_0xb687('0x72')]();_0x3d4596[_0xb687('0x73')]('('+_0x3aa1c8['toString']()+')',_0xb687('0xa1'));_0x3d4596[_0xb687('0x69')](_0xb687('0xa2'),_0xb687('0x22'));_0x3aa1c8[_0xb687('0x20')](_0x22ebca['limit']||_0x59c94b);_0x3aa1c8[_0xb687('0x1f')](_0x22ebca[_0xb687('0x1f')]||0x0);return dbH[_0xb687('0x86')]['query'](_0x3d4596[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')][_0xb687('0xa3')]})['then'](function(_0x3dbbd6){if(!_0x3dbbd6[_0xb687('0x3e')]){_0x3d98e2=0x0;}else{_0x3d98e2=_0x3dbbd6[0x0][_0xb687('0x22')]||0x0;}return dbH['sequelize'][_0xb687('0x39')](_0x3aa1c8[_0xb687('0x85')](),{'type':dbH[_0xb687('0x86')][_0xb687('0x87')][_0xb687('0xa3')]});})[_0xb687('0x28')](function(_0x15e599){return{'rows':_0x15e599||[],'count':_0x3d98e2};});}});}exports[_0xb687('0xa4')]=function(_0x8f6ba0,_0x568aca){return runReport(_0x8f6ba0[_0xb687('0x49')],_0x8f6ba0[_0xb687('0x39')],_0x8f6ba0[_0xb687('0x46')])['then'](respondWithResult(_0x568aca,null))['catch'](handleError(_0x568aca,null));};exports[_0xb687('0xa5')]=runReport;exports['query']=function(_0x187810,_0x1d21ef){var _0x386d12=0xa;var _0x4dd8f4=['join',_0xb687('0x57'),_0xb687('0x58'),_0xb687('0xa6')];var _0x295795={'SUM':_0xb687('0x88'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':'MIN(%s)','AVG':_0xb687('0x5d'),'GROUP_CONCAT':_0xb687('0x89'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb687('0x5e')};var _0xe7056c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb687('0x8c'),'HOUR':_0xb687('0x8d'),'ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':_0xb687('0x60')};var _0x1b1cf5=function(_0x46283c){return!_[_0xb687('0x61')](['IS\x20NULL',_0xb687('0x63'),'IS\x20EMPTY',_0xb687('0x65')],_0x46283c);};var _0x394ed6=function(_0x875169){if(!_0x875169||!_0x875169[_0xb687('0x66')]['length']){return'';}for(var _0x1ec485='(',_0x55a919=0x0;_0x55a919<_0x875169['rules'][_0xb687('0x3e')];_0x55a919+=0x1){_0x55a919>0x0&&(_0x1ec485+='\x20'+_0x875169[_0xb687('0x67')]+'\x20');_0x1ec485+=_0x875169[_0xb687('0x66')][_0x55a919]['group']?_0x394ed6(_0x875169[_0xb687('0x66')][_0x55a919][_0xb687('0x68')]):_0x875169['rules'][_0x55a919][_0xb687('0x69')]+'\x20'+_0x875169['rules'][_0x55a919][_0xb687('0x6a')]+(_0x1b1cf5(_0x875169[_0xb687('0x66')][_0x55a919]['condition'])?'\x20'+_0x875169[_0xb687('0x66')][_0x55a919]['value']:'');}return _0x1ec485+')';};var _0x2aecd5={'where':{'id':_0x187810[_0xb687('0x49')]['id']}},_0x58955e,_0x488a2a,_0x303738,_0x3904a3,_0x581338;_0x2aecd5=_['merge']({},_0x2aecd5,_0x187810[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x2aecd5)['then'](function(_0xc29834){if(_0xc29834){_0x58955e=_0xc29834;return _0xc29834[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x1f2f2b){if(_0x1f2f2b){if(!_0x1f2f2b[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))]['ValidationErrorItem'](_0xb687('0x6f'),0x193);}_0x488a2a=_0x1f2f2b;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x3591e2){if(_0x3591e2){_0x303738=_['keyBy'](_0x3591e2,'id');var _0x4d0c14;var _0x200b55=squel[_0xb687('0x72')]();_0x200b55[_0xb687('0x73')](_0x58955e[_0xb687('0x74')]);for(var _0x33f4de=0x0;_0x33f4de<_0x488a2a[_0xb687('0x3e')];_0x33f4de+=0x1){_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x75')]?_0x303738[_0x488a2a[_0x33f4de]['MetricId']][_0xb687('0x76')]:_0x488a2a[_0x33f4de][_0xb687('0x69')];_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x77')]?_['replace'](_0x295795[_0x488a2a[_0x33f4de][_0xb687('0x77')]],'%s',_0x4d0c14):_0x4d0c14;_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x79')]?_[_0xb687('0x78')](_0xe7056c[_0x488a2a[_0x33f4de]['format']],'%s',_0x4d0c14):_0x4d0c14;if(_0x488a2a[_0x33f4de][_0xb687('0x7a')]){_0x200b55[_0xb687('0x68')](_0x4d0c14);}_0x488a2a[_0x33f4de]['orderBy']&&_0x200b55[_0xb687('0x40')](_0x4d0c14,_0x488a2a[_0x33f4de][_0xb687('0x7b')]===_0xb687('0x8f')?![]:!![]);_0x200b55[_0xb687('0x69')](_0x4d0c14,_0x488a2a[_0x33f4de]['alias']||_0x4d0c14);}if(_0x58955e[_0xb687('0x7d')]){_0x58955e[_0xb687('0x7d')]=JSON[_0xb687('0x7e')](_0x58955e[_0xb687('0x7d')]);for(var _0xcff220=0x0;_0xcff220<_0x58955e['joins'][_0xb687('0x3e')];_0xcff220+=0x1){if(_0x58955e[_0xb687('0x7d')][_0xcff220]['type']&&_[_0xb687('0x61')](_0x4dd8f4,_0x58955e[_0xb687('0x7d')][_0xcff220]['type'])&&_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x90')]&&_0x58955e[_0xb687('0x7d')][_0xcff220]['foreignTable']&&_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x80')]){_0x200b55[_0x58955e['joins'][_0xcff220]['type']](_0x58955e['joins'][_0xcff220][_0xb687('0x7f')],null,util['format'](_0xb687('0xa7'),_0x58955e[_0xb687('0x74')],_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x90')],_0x58955e[_0xb687('0x7d')][_0xcff220]['foreignTable'],_0x58955e['joins'][_0xcff220][_0xb687('0x80')]));}}}if(_0x58955e[_0xb687('0x81')]){_0x58955e[_0xb687('0x81')]=JSON[_0xb687('0x7e')](_0x58955e[_0xb687('0x81')]);_0x200b55[_0xb687('0x42')](_0x394ed6(_0x58955e[_0xb687('0x81')]['group']));}_0x581338=_0x200b55['clone']();_0x200b55['limit'](_0x386d12);_0x200b55[_0xb687('0x1f')](0x0);logger[_0xb687('0x83')](_0xb687('0x84'),_0x200b55['toString']());return dbH['sequelize']['query'](_0x200b55[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')][_0xb687('0xa3')]});}})[_0xb687('0x28')](function(){return{'sql':_0x581338[_0xb687('0x85')]()};})[_0xb687('0x28')](respondWithResult(_0x1d21ef,null))[_0xb687('0x48')](handleError(_0x1d21ef,null));}; \ No newline at end of file +var _0xba34=['save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','create','body','user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','COUNT(%s)','AVG(%s)','IS\x20NOT\x20NULL','value','order','output','%s-%s.%s','randomstring','generate','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','fork','countTable','QueryTypes','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','Please\x20insert\x20at\x20least\x20one\x20field','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject'];(function(_0x2238b1,_0x2cf83b){var _0x3bffa6=function(_0x5dd314){while(--_0x5dd314){_0x2238b1['push'](_0x2238b1['shift']());}};_0x3bffa6(++_0x2cf83b);}(_0xba34,0x119));var _0x4ba3=function(_0x3d5375,_0x505b92){_0x3d5375=_0x3d5375-0x0;var _0x14ac11=_0xba34[_0x3d5375];return _0x14ac11;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0x4ba3('0x19'))['dbH'];function respondWithStatusCode(_0x256f02,_0x4419b4){_0x4419b4=_0x4419b4||0xcc;return function(_0x29e498){if(_0x29e498){return _0x256f02[_0x4ba3('0x1a')](_0x4419b4);}return _0x256f02[_0x4ba3('0x1b')](_0x4419b4)[_0x4ba3('0x1c')]();};}function respondWithResult(_0x3a74f7,_0x12ac90){_0x12ac90=_0x12ac90||0xc8;return function(_0x1dec48){if(_0x1dec48){return _0x3a74f7[_0x4ba3('0x1b')](_0x12ac90)[_0x4ba3('0x1d')](_0x1dec48);}};}function respondWithFilteredResult(_0x301359,_0x29a9d1){return function(_0x25f584){if(_0x25f584){var _0x40e75b=typeof _0x29a9d1[_0x4ba3('0x1e')]==='undefined'&&typeof _0x29a9d1[_0x4ba3('0x1f')]===_0x4ba3('0x20');var _0x5ff7ce=_0x25f584[_0x4ba3('0x21')];var _0x556290=_0x40e75b?0x0:_0x29a9d1[_0x4ba3('0x1e')];var _0xe4eff9=_0x40e75b?_0x25f584[_0x4ba3('0x21')]:_0x29a9d1[_0x4ba3('0x1e')]+_0x29a9d1[_0x4ba3('0x1f')];var _0x125944;if(_0xe4eff9>=_0x5ff7ce){_0xe4eff9=_0x5ff7ce;_0x125944=0xc8;}else{_0x125944=0xce;}_0x301359['status'](_0x125944);return _0x301359['set'](_0x4ba3('0x22'),_0x556290+'-'+_0xe4eff9+'/'+_0x5ff7ce)['json'](_0x25f584);}return null;};}function patchUpdates(_0x18dff5){return function(_0x163967){try{jsonpatch[_0x4ba3('0x23')](_0x163967,_0x18dff5,!![]);}catch(_0xbc7023){return BPromise[_0x4ba3('0x24')](_0xbc7023);}return _0x163967[_0x4ba3('0x25')]();};}function saveUpdates(_0x4a0823,_0x143c78){return function(_0x1f87e1){if(_0x1f87e1){return _0x1f87e1['update'](_0x4a0823)[_0x4ba3('0x26')](function(_0x4ffe39){return _0x4ffe39;});}return null;};}function removeEntity(_0x1ae4de,_0x18abb3){return function(_0x11a917){if(_0x11a917){return _0x11a917[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){var _0xe29a49=_0x11a917[_0x4ba3('0x28')]({'plain':!![]});var _0xe1f7d2=_0x4ba3('0x29');return db[_0x4ba3('0x2a')]['destroy']({'where':{'type':_0xe1f7d2,'resourceId':_0xe29a49['id']}})[_0x4ba3('0x26')](function(){return _0x11a917;});})[_0x4ba3('0x26')](function(){_0x1ae4de[_0x4ba3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10537e,_0x1fe5e2){return function(_0x44d78c){if(!_0x44d78c){_0x10537e['sendStatus'](0x194);}return _0x44d78c;};}function handleError(_0x10cae6,_0x843276){_0x843276=_0x843276||0x1f4;return function(_0x34ecb4){logger[_0x4ba3('0x2b')](_0x34ecb4['stack']);if(_0x34ecb4['name']){delete _0x34ecb4[_0x4ba3('0x2c')];}_0x10cae6[_0x4ba3('0x1b')](_0x843276)[_0x4ba3('0x2d')](_0x34ecb4);};}exports[_0x4ba3('0x2e')]=function(_0x2cb5d5,_0x11f88f){var _0x48b3b7={},_0x27444b={},_0x28f36c={'count':0x0,'rows':[]};var _0x24d8fc=_[_0x4ba3('0x2f')](db[_0x4ba3('0x30')][_0x4ba3('0x31')],function(_0x457236){return{'name':_0x457236[_0x4ba3('0x32')],'type':_0x457236[_0x4ba3('0x33')][_0x4ba3('0x34')]};});_0x27444b['model']=_['map'](_0x24d8fc,'name');_0x27444b[_0x4ba3('0x35')]=_[_0x4ba3('0x36')](_0x2cb5d5[_0x4ba3('0x35')]);_0x27444b[_0x4ba3('0x37')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],_0x27444b[_0x4ba3('0x35')]);_0x48b3b7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x2cb5d5[_0x4ba3('0x35')]['fields']));_0x48b3b7[_0x4ba3('0x3a')]=_0x48b3b7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x48b3b7['attributes']:_0x27444b[_0x4ba3('0x39')];if(!_0x2cb5d5['query'][_0x4ba3('0x3d')](_0x4ba3('0x3e'))){_0x48b3b7[_0x4ba3('0x1f')]=qs[_0x4ba3('0x1f')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1f')]);_0x48b3b7['offset']=qs[_0x4ba3('0x1e')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1e')]);}_0x48b3b7['order']=qs[_0x4ba3('0x3f')](_0x2cb5d5[_0x4ba3('0x35')]['sort']);_0x48b3b7[_0x4ba3('0x40')]=qs['filters'](_['pick'](_0x2cb5d5[_0x4ba3('0x35')],_0x27444b[_0x4ba3('0x37')]),_0x24d8fc);if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x41')]){_0x48b3b7[_0x4ba3('0x40')]=_['merge'](_0x48b3b7[_0x4ba3('0x40')],{'$or':_[_0x4ba3('0x2f')](_0x24d8fc,function(_0x46d2ca){if(_0x46d2ca[_0x4ba3('0x33')]!==_0x4ba3('0x42')){var _0x2acc92={};_0x2acc92[_0x46d2ca[_0x4ba3('0x2c')]]={'$like':'%'+_0x2cb5d5[_0x4ba3('0x35')]['filter']+'%'};return _0x2acc92;}})});}_0x48b3b7=_[_0x4ba3('0x43')]({},_0x48b3b7,_0x2cb5d5[_0x4ba3('0x44')]);var _0x3cb07f={'where':_0x48b3b7[_0x4ba3('0x40')]};return db[_0x4ba3('0x30')][_0x4ba3('0x21')](_0x3cb07f)[_0x4ba3('0x26')](function(_0xdcc2a2){_0x28f36c[_0x4ba3('0x21')]=_0xdcc2a2;if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x45')]){_0x48b3b7[_0x4ba3('0x46')]=[{'all':!![]}];}return db[_0x4ba3('0x30')][_0x4ba3('0x47')](_0x48b3b7);})['then'](function(_0x5af671){_0x28f36c['rows']=_0x5af671;return _0x28f36c;})['then'](respondWithFilteredResult(_0x11f88f,_0x48b3b7))['catch'](handleError(_0x11f88f,null));};exports[_0x4ba3('0x48')]=function(_0x5c4659,_0x29e74d){var _0x5567c7={'raw':!![],'where':{'id':_0x5c4659[_0x4ba3('0x49')]['id']}},_0x53d6eb={};_0x53d6eb[_0x4ba3('0x39')]=_[_0x4ba3('0x36')](db[_0x4ba3('0x30')]['rawAttributes']);_0x53d6eb[_0x4ba3('0x35')]=_['keys'](_0x5c4659[_0x4ba3('0x35')]);_0x53d6eb['filters']=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],_0x53d6eb[_0x4ba3('0x35')]);_0x5567c7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x5c4659['query'][_0x4ba3('0x3b')]));_0x5567c7[_0x4ba3('0x3a')]=_0x5567c7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x5567c7[_0x4ba3('0x3a')]:_0x53d6eb['model'];if(_0x5c4659['query'][_0x4ba3('0x45')]){_0x5567c7[_0x4ba3('0x46')]=[{'all':!![]}];}_0x5567c7=_[_0x4ba3('0x43')]({},_0x5567c7,_0x5c4659['options']);return db[_0x4ba3('0x30')][_0x4ba3('0x4a')](_0x5567c7)[_0x4ba3('0x26')](handleEntityNotFound(_0x29e74d,null))['then'](respondWithResult(_0x29e74d,null))['catch'](handleError(_0x29e74d,null));};exports[_0x4ba3('0x4b')]=function(_0x482a83,_0x439acf){return db[_0x4ba3('0x30')][_0x4ba3('0x4b')](_0x482a83[_0x4ba3('0x4c')],{})[_0x4ba3('0x26')](function(_0x213eb0){var _0x590739=_0x482a83[_0x4ba3('0x4d')][_0x4ba3('0x28')]({'plain':!![]});if(!_0x590739)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x590739[_0x4ba3('0x4e')]===_0x4ba3('0x4d')){var _0x156c2d=_0x213eb0[_0x4ba3('0x28')]({'plain':!![]});var _0x360472='Reports';return db[_0x4ba3('0x4f')][_0x4ba3('0x4a')]({'where':{'name':_0x360472,'userProfileId':_0x590739['userProfileId']},'raw':!![]})[_0x4ba3('0x26')](function(_0x19d70f){if(_0x19d70f&&_0x19d70f[_0x4ba3('0x50')]===0x0){return db[_0x4ba3('0x2a')][_0x4ba3('0x4b')]({'name':_0x156c2d[_0x4ba3('0x2c')],'resourceId':_0x156c2d['id'],'type':_0x4ba3('0x29'),'sectionId':_0x19d70f['id']},{})[_0x4ba3('0x26')](function(){return _0x213eb0;});}else{return _0x213eb0;}})[_0x4ba3('0x51')](function(_0x428a27){logger[_0x4ba3('0x2b')](_0x4ba3('0x52'),_0x428a27);throw _0x428a27;});}return _0x213eb0;})[_0x4ba3('0x26')](respondWithResult(_0x439acf,0xc9))[_0x4ba3('0x51')](handleError(_0x439acf,null));};exports[_0x4ba3('0x53')]=function(_0x48a3d4,_0x5e7ed5){if(_0x48a3d4['body']['id']){delete _0x48a3d4[_0x4ba3('0x4c')]['id'];}return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x48a3d4[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x5e7ed5,null))['then'](saveUpdates(_0x48a3d4[_0x4ba3('0x4c')],null))[_0x4ba3('0x26')](respondWithResult(_0x5e7ed5,null))[_0x4ba3('0x51')](handleError(_0x5e7ed5,null));};exports[_0x4ba3('0x27')]=function(_0x5359d1,_0x1e83fb){return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x5359d1[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x1e83fb,null))[_0x4ba3('0x26')](removeEntity(_0x1e83fb,null))[_0x4ba3('0x51')](handleError(_0x1e83fb,null));};exports[_0x4ba3('0x54')]=function(_0x328314,_0x4fa64d){var _0x20c849=0xa;var _0x42bb4b=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x40827a={'SUM':_0x4ba3('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':_0x4ba3('0x5b'),'MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x4cc10a={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4ba3('0x62')};var _0xaef1b=function(_0x2a48fe){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),'IS\x20NOT\x20NULL',_0x4ba3('0x65'),_0x4ba3('0x66')],_0x2a48fe);};var _0x34cc21=function(_0x469ef0){if(!_0x469ef0||!_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')]){return'';}for(var _0x3fdf7f='(',_0x38699e=0x0;_0x38699e<_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')];_0x38699e+=0x1){_0x38699e>0x0&&(_0x3fdf7f+='\x20'+_0x469ef0[_0x4ba3('0x68')]+'\x20');_0x3fdf7f+=_0x469ef0['rules'][_0x38699e][_0x4ba3('0x69')]?_0x34cc21(_0x469ef0[_0x4ba3('0x67')][_0x38699e]['group']):_0x469ef0['rules'][_0x38699e][_0x4ba3('0x6a')]+'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['condition']+(_0xaef1b(_0x469ef0[_0x4ba3('0x67')][_0x38699e][_0x4ba3('0x6b')])?'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['value']:'');}return _0x3fdf7f+')';};var _0x1f5815={'where':{'id':_0x328314['params']['id']}},_0x46224,_0x1af489,_0x11209b,_0x24a75a,_0x3a4838;_0x1f5815=_[_0x4ba3('0x43')]({},_0x1f5815,_0x328314[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x1f5815)[_0x4ba3('0x26')](function(_0x2f8bcc){if(_0x2f8bcc){_0x46224=_0x2f8bcc;return _0x2f8bcc[_0x4ba3('0x6c')]();}return null;})[_0x4ba3('0x26')](function(_0x21c8b1){if(_0x21c8b1){if(!_0x21c8b1[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1af489=_0x21c8b1;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})['then'](function(_0x13ee2c){if(_0x13ee2c){_0x11209b=_[_0x4ba3('0x6f')](_0x13ee2c,'id');var _0x442d66;var _0x5c7fc2=squel[_0x4ba3('0x70')]();_0x5c7fc2[_0x4ba3('0x71')](_0x46224[_0x4ba3('0x72')]);for(var _0x5baf26=0x0;_0x5baf26<_0x1af489[_0x4ba3('0x3c')];_0x5baf26+=0x1){_0x442d66=_0x1af489[_0x5baf26]['MetricId']?_0x11209b[_0x1af489[_0x5baf26][_0x4ba3('0x73')]][_0x4ba3('0x74')]:_0x1af489[_0x5baf26]['field'];_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x40827a[_0x1af489[_0x5baf26][_0x4ba3('0x75')]],'%s',_0x442d66):_0x442d66;_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x4cc10a[_0x1af489[_0x5baf26][_0x4ba3('0x77')]],'%s',_0x442d66):_0x442d66;if(_0x1af489[_0x5baf26][_0x4ba3('0x78')]){_0x5c7fc2[_0x4ba3('0x69')](_0x442d66);}_0x1af489[_0x5baf26][_0x4ba3('0x79')]&&_0x5c7fc2['order'](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x5c7fc2[_0x4ba3('0x6a')](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x7b')]||_0x442d66);}if(_0x46224[_0x4ba3('0x7c')]){_0x46224[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x7c')]);for(var _0x365d94=0x0;_0x365d94<_0x46224[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x365d94+=0x1){if(_0x46224[_0x4ba3('0x7c')][_0x365d94]['type']&&_[_0x4ba3('0x63')](_0x42bb4b,_0x46224[_0x4ba3('0x7c')][_0x365d94]['type'])&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7e')]&&_0x46224['joins'][_0x365d94]['foreignTable']&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]){_0x5c7fc2[_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x33')]](_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x46224['table'],_0x46224[_0x4ba3('0x7c')][_0x365d94]['parentKey'],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]));}}}if(_0x46224[_0x4ba3('0x82')]){_0x46224[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x82')]);_0x5c7fc2['where'](_0x34cc21(_0x46224[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x3a4838=_0x5c7fc2[_0x4ba3('0x83')]();_0x5c7fc2['limit'](_0x20c849);_0x5c7fc2[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x5c7fc2[_0x4ba3('0x86')]());return dbH[_0x4ba3('0x87')][_0x4ba3('0x35')](_0x5c7fc2[_0x4ba3('0x86')](),{'type':dbH['sequelize']['QueryTypes'][_0x4ba3('0x88')]});}})['then'](respondWithResult(_0x4fa64d,null))[_0x4ba3('0x51')](handleError(_0x4fa64d,null));};function runReport(_0x15508f,_0x108679,_0x20f7db){var _0x5a3c63=_0x108679['name'];var _0x2d16e5=0xa;var _0x2b2132=['join',_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x1e8232={'SUM':_0x4ba3('0x59'),'COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':_0x4ba3('0x8a'),'GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x13dbc4={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5aa412=function(_0x4ec70e){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),_0x4ba3('0x65'),_0x4ba3('0x66')],_0x4ec70e);};var _0x333a97=function(_0x30d7a9){if(!_0x30d7a9||!_0x30d7a9['rules'][_0x4ba3('0x3c')]){return'';}for(var _0x4cd4a2='(',_0x31a725=0x0;_0x31a725<_0x30d7a9['rules'][_0x4ba3('0x3c')];_0x31a725+=0x1){_0x31a725>0x0&&(_0x4cd4a2+='\x20'+_0x30d7a9[_0x4ba3('0x68')]+'\x20');_0x4cd4a2+=_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x69')]?_0x333a97(_0x30d7a9[_0x4ba3('0x67')][_0x31a725]['group']):_0x30d7a9['rules'][_0x31a725][_0x4ba3('0x6a')]+'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')]+(_0x5aa412(_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')])?'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x8c')]:'');}return _0x4cd4a2+')';};var _0x3d8606={'where':{'id':_0x15508f['id']}},_0x2d00e3,_0x35441e,_0x217ea4,_0x40dcee,_0x5ea9d0;_0x3d8606=_[_0x4ba3('0x43')]({},_0x3d8606,_0x20f7db);return db['AnalyticDefaultReport'][_0x4ba3('0x4a')](_0x3d8606)[_0x4ba3('0x26')](function(_0x17b970){if(_0x17b970){_0x2d00e3=_0x17b970;return _0x17b970[_0x4ba3('0x6c')]();}return null;})['then'](function(_0x2a2dc2){if(_0x2a2dc2){if(!_0x2a2dc2[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x35441e=_0x2a2dc2;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0x3188c8){if(_0x3188c8){_0x217ea4=_['keyBy'](_0x3188c8,'id');var _0x2f793a;var _0x1194a5=squel[_0x4ba3('0x70')]();_0x1194a5[_0x4ba3('0x71')](_0x2d00e3[_0x4ba3('0x72')]);for(var _0x1e2134=0x0;_0x1e2134<_0x35441e['length'];_0x1e2134+=0x1){_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x73')]?_0x217ea4[_0x35441e[_0x1e2134]['MetricId']][_0x4ba3('0x74')]:_0x35441e[_0x1e2134][_0x4ba3('0x6a')];_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x1e8232[_0x35441e[_0x1e2134]['function']],'%s',_0x2f793a):_0x2f793a;_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x13dbc4[_0x35441e[_0x1e2134]['format']],'%s',_0x2f793a):_0x2f793a;if(_0x35441e[_0x1e2134][_0x4ba3('0x78')]){_0x1194a5['group'](_0x2f793a);}_0x35441e[_0x1e2134][_0x4ba3('0x79')]&&_0x1194a5[_0x4ba3('0x8d')](_0x2f793a,_0x35441e[_0x1e2134][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x1194a5[_0x4ba3('0x6a')](_0x2f793a,_0x35441e[_0x1e2134]['alias']||_0x2f793a);}if(_0x2d00e3['joins']){_0x2d00e3[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x7c')]);for(var _0x56244e=0x0;_0x56244e<_0x2d00e3[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x56244e+=0x1){if(_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x2b2132,_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')])&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')]&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')]&&_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x7f')]){_0x1194a5[_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')]](_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x2d00e3[_0x4ba3('0x72')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e]['foreignKey']));}}}if(_0x2d00e3['conditions']){_0x2d00e3[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x82')]);_0x1194a5[_0x4ba3('0x40')](_0x333a97(_0x2d00e3[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x5ea9d0=_0x1194a5[_0x4ba3('0x83')]();_0x1194a5['limit'](_0x2d16e5);_0x1194a5['offset'](0x0);return;}})[_0x4ba3('0x26')](function(){if(_0x108679[_0x4ba3('0x8e')]==='web'){return null;}var _0x4fb6b5=_['merge'](_0x108679,{'name':_0x108679['fullPath']||_0x108679[_0x4ba3('0x2c')]||_0x2d00e3[_0x4ba3('0x2c')],'basename':_0x5a3c63,'savename':util[_0x4ba3('0x77')](_0x4ba3('0x8f'),_0x108679[_0x4ba3('0x2c')]||_0x2d00e3['name'],require(_0x4ba3('0x90'))[_0x4ba3('0x91')](0x4),_0x108679[_0x4ba3('0x8e')]||'csv'),'reportId':_0x2d00e3['id'],'reportType':'default'});return db['AnalyticExtractedReport']['create'](_0x4fb6b5,{'raw':!![]});})[_0x4ba3('0x26')](function(_0x17d501){if(_0x2d00e3[_0x4ba3('0x72')]===_0x4ba3('0x92')){_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3['table']+_0x4ba3('0x93'),_0x108679['startDate'],_0x108679[_0x4ba3('0x94')]);}else{_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3[_0x4ba3('0x72')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x108679[_0x4ba3('0x95')],_0x108679[_0x4ba3('0x94')]);}if(_0x17d501){logger[_0x4ba3('0x96')](_0x4ba3('0x97'),_0x5ea9d0['toString']());require('child_process')[_0x4ba3('0x98')](path[_0x4ba3('0x55')](__dirname,'../../components/export/',_0x17d501[_0x4ba3('0x8e')]),[_0x17d501['id'],_0x5ea9d0['toString'](),path['join'](__dirname,'../../files/reports',_0x17d501['savename']),_0x5a3c63]);return _0x17d501;}else{var _0x2d2ca3=squel[_0x4ba3('0x70')]();_0x2d2ca3[_0x4ba3('0x71')]('('+_0x5ea9d0[_0x4ba3('0x86')]()+')',_0x4ba3('0x99'));_0x2d2ca3['field']('COUNT(*)',_0x4ba3('0x21'));_0x5ea9d0['limit'](_0x108679[_0x4ba3('0x1f')]||_0x2d16e5);_0x5ea9d0[_0x4ba3('0x1e')](_0x108679[_0x4ba3('0x1e')]||0x0);return dbH['sequelize'][_0x4ba3('0x35')](_0x2d2ca3[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]})[_0x4ba3('0x26')](function(_0xc938c){if(!_0xc938c[_0x4ba3('0x3c')]){_0x40dcee=0x0;}else{_0x40dcee=_0xc938c[0x0][_0x4ba3('0x21')]||0x0;}return dbH['sequelize']['query'](_0x5ea9d0[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]});})[_0x4ba3('0x26')](function(_0xd97c26){return{'rows':_0xd97c26||[],'count':_0x40dcee};});}});}exports['run']=function(_0x1fbdc7,_0x9e45ec){return runReport(_0x1fbdc7['params'],_0x1fbdc7[_0x4ba3('0x35')],_0x1fbdc7[_0x4ba3('0x44')])[_0x4ba3('0x26')](respondWithResult(_0x9e45ec,null))[_0x4ba3('0x51')](handleError(_0x9e45ec,null));};exports[_0x4ba3('0x9b')]=runReport;exports[_0x4ba3('0x35')]=function(_0xddfb0c,_0x41c531){var _0x25bf75=0xa;var _0x18bd77=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x2e812b={'SUM':'SUM(%s)','COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':_0x4ba3('0x9c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5dc74f={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':'DATE(%s)','HOUR':_0x4ba3('0x61'),'ROUND':_0x4ba3('0x9d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1590f0=function(_0x5efab9){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),'IS\x20EMPTY',_0x4ba3('0x66')],_0x5efab9);};var _0x4d3262=function(_0x4ad4d3){if(!_0x4ad4d3||!_0x4ad4d3[_0x4ba3('0x67')]['length']){return'';}for(var _0x4529a3='(',_0x9b9c64=0x0;_0x9b9c64<_0x4ad4d3[_0x4ba3('0x67')]['length'];_0x9b9c64+=0x1){_0x9b9c64>0x0&&(_0x4529a3+='\x20'+_0x4ad4d3['operator']+'\x20');_0x4529a3+=_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]?_0x4d3262(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]):_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64]['field']+'\x20'+_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')]+(_0x1590f0(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')])?'\x20'+_0x4ad4d3['rules'][_0x9b9c64][_0x4ba3('0x8c')]:'');}return _0x4529a3+')';};var _0x3073c5={'where':{'id':_0xddfb0c[_0x4ba3('0x49')]['id']}},_0x3d1c11,_0xa41747,_0x25c92c,_0x422a8d,_0x225746;_0x3073c5=_[_0x4ba3('0x43')]({},_0x3073c5,_0xddfb0c[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x3073c5)[_0x4ba3('0x26')](function(_0x3db4c2){if(_0x3db4c2){_0x3d1c11=_0x3db4c2;return _0x3db4c2['getFields']();}return null;})[_0x4ba3('0x26')](function(_0x4a8449){if(_0x4a8449){if(!_0x4a8449[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))](_0x4ba3('0x9e'),0x193);}_0xa41747=_0x4a8449;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0xfaf98a){if(_0xfaf98a){_0x25c92c=_['keyBy'](_0xfaf98a,'id');var _0x30c904;var _0x267801=squel[_0x4ba3('0x70')]();_0x267801[_0x4ba3('0x71')](_0x3d1c11['table']);for(var _0x1bae1b=0x0;_0x1bae1b<_0xa41747[_0x4ba3('0x3c')];_0x1bae1b+=0x1){_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x73')]?_0x25c92c[_0xa41747[_0x1bae1b][_0x4ba3('0x73')]]['metric']:_0xa41747[_0x1bae1b][_0x4ba3('0x6a')];_0x30c904=_0xa41747[_0x1bae1b]['function']?_[_0x4ba3('0x76')](_0x2e812b[_0xa41747[_0x1bae1b][_0x4ba3('0x75')]],'%s',_0x30c904):_0x30c904;_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x5dc74f[_0xa41747[_0x1bae1b]['format']],'%s',_0x30c904):_0x30c904;if(_0xa41747[_0x1bae1b]['groupBy']){_0x267801[_0x4ba3('0x69')](_0x30c904);}_0xa41747[_0x1bae1b][_0x4ba3('0x79')]&&_0x267801[_0x4ba3('0x8d')](_0x30c904,_0xa41747[_0x1bae1b]['orderBy']==='DESC'?![]:!![]);_0x267801[_0x4ba3('0x6a')](_0x30c904,_0xa41747[_0x1bae1b][_0x4ba3('0x7b')]||_0x30c904);}if(_0x3d1c11[_0x4ba3('0x7c')]){_0x3d1c11[_0x4ba3('0x7c')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x7c')]);for(var _0x2f4966=0x0;_0x2f4966<_0x3d1c11[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x2f4966+=0x1){if(_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x18bd77,_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')])&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x80')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7f')]){_0x267801[_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]](_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x3d1c11[_0x4ba3('0x72')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],_0x3d1c11['joins'][_0x2f4966][_0x4ba3('0x7f')]));}}}if(_0x3d1c11[_0x4ba3('0x82')]){_0x3d1c11[_0x4ba3('0x82')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x82')]);_0x267801[_0x4ba3('0x40')](_0x4d3262(_0x3d1c11[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x225746=_0x267801[_0x4ba3('0x83')]();_0x267801[_0x4ba3('0x1f')](_0x25bf75);_0x267801[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x267801['toString']());return dbH[_0x4ba3('0x87')]['query'](_0x267801['toString'](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')]['SELECT']});}})[_0x4ba3('0x26')](function(){return{'sql':_0x225746[_0x4ba3('0x86')]()};})[_0x4ba3('0x26')](respondWithResult(_0x41c531,null))[_0x4ba3('0x51')](handleError(_0x41c531,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 82bbf15..32455f4 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 _0xd962=['define','analytics_default_reports','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports'];(function(_0x21deb4,_0x5a8ae2){var _0x19251e=function(_0x3fc15e){while(--_0x3fc15e){_0x21deb4['push'](_0x21deb4['shift']());}};_0x19251e(++_0x5a8ae2);}(_0xd962,0x1ba));var _0x2d96=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0xd962[_0x1b4b23];return _0x2a325b;};'use strict';var _=require(_0x2d96('0x0'));var util=require(_0x2d96('0x1'));var logger=require(_0x2d96('0x2'))('api');var moment=require(_0x2d96('0x3'));var BPromise=require(_0x2d96('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2d96('0x5'));var config=require(_0x2d96('0x6'));var attributes=require(_0x2d96('0x7'));module[_0x2d96('0x8')]=function(_0x4d8379,_0x3ca7e6){return _0x4d8379[_0x2d96('0x9')]('AnalyticDefaultReport',attributes,{'tableName':_0x2d96('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6392=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','analytics_default_reports','lodash','util','../../config/logger'];(function(_0x2175be,_0x2c0a00){var _0x2c0259=function(_0x5c690e){while(--_0x5c690e){_0x2175be['push'](_0x2175be['shift']());}};_0x2c0259(++_0x2c0a00);}(_0x6392,0x1c5));var _0x2639=function(_0x4e8401,_0x51b328){_0x4e8401=_0x4e8401-0x0;var _0x17269f=_0x6392[_0x4e8401];return _0x17269f;};'use strict';var _=require(_0x2639('0x0'));var util=require(_0x2639('0x1'));var logger=require(_0x2639('0x2'))('api');var moment=require(_0x2639('0x3'));var BPromise=require(_0x2639('0x4'));var rp=require(_0x2639('0x5'));var fs=require('fs');var path=require(_0x2639('0x6'));var rimraf=require(_0x2639('0x7'));var config=require(_0x2639('0x8'));var attributes=require(_0x2639('0x9'));module[_0x2639('0xa')]=function(_0x288bc2,_0xb1815c){return _0x288bc2['define']('AnalyticDefaultReport',attributes,{'tableName':_0x2639('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 99146f1..46833e2 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 _0x2a4a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x2a4a,0xa3));var _0xa2a4=function(_0x4e5b6d,_0x272aa9){_0x4e5b6d=_0x4e5b6d-0x0;var _0x3f5aae=_0x2a4a[_0x4e5b6d];return _0x3f5aae;};'use strict';var _=require(_0xa2a4('0x0'));var util=require('util');var moment=require(_0xa2a4('0x1'));var BPromise=require('bluebird');var rs=require(_0xa2a4('0x2'));var fs=require('fs');var Redis=require(_0xa2a4('0x3'));var db=require(_0xa2a4('0x4'))['db'];var utils=require(_0xa2a4('0x5'));var logger=require(_0xa2a4('0x6'))(_0xa2a4('0x7'));var config=require(_0xa2a4('0x8'));var jayson=require(_0xa2a4('0x9'));var client=jayson['client'][_0xa2a4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43c366,_0x32c5ed,_0x46ee28){return new BPromise(function(_0x5d7d8e,_0x3fc911){return client[_0xa2a4('0xb')](_0x43c366,_0x46ee28)[_0xa2a4('0xc')](function(_0x506f43){logger[_0xa2a4('0xd')](_0xa2a4('0xe'),_0x32c5ed,'request\x20sent');logger['debug'](_0xa2a4('0xf'),_0x32c5ed,_0xa2a4('0x10'),JSON[_0xa2a4('0x11')](_0x506f43));if(_0x506f43[_0xa2a4('0x12')]){if(_0x506f43[_0xa2a4('0x12')]['code']===0x1f4){logger[_0xa2a4('0x12')](_0xa2a4('0xe'),_0x32c5ed,_0x506f43['error'][_0xa2a4('0x13')]);return _0x3fc911(_0x506f43['error'][_0xa2a4('0x13')]);}logger[_0xa2a4('0x12')](_0xa2a4('0xe'),_0x32c5ed,_0x506f43[_0xa2a4('0x12')][_0xa2a4('0x13')]);return _0x5d7d8e(_0x506f43[_0xa2a4('0x12')][_0xa2a4('0x13')]);}else{logger[_0xa2a4('0xd')](_0xa2a4('0xe'),_0x32c5ed,_0xa2a4('0x10'));_0x5d7d8e(_0x506f43['result'][_0xa2a4('0x13')]);}})[_0xa2a4('0x14')](function(_0x1c0149){logger[_0xa2a4('0x12')](_0xa2a4('0xe'),_0x32c5ed,_0x1c0149);_0x3fc911(_0x1c0149);});});} \ No newline at end of file +var _0x2c51=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x2c51,0x1e3));var _0x12c5=function(_0xe662fc,_0x45d7b5){_0xe662fc=_0xe662fc-0x0;var _0x24cffe=_0x2c51[_0xe662fc];return _0x24cffe;};'use strict';var _=require(_0x12c5('0x0'));var util=require(_0x12c5('0x1'));var moment=require(_0x12c5('0x2'));var BPromise=require('bluebird');var rs=require(_0x12c5('0x3'));var fs=require('fs');var Redis=require(_0x12c5('0x4'));var db=require(_0x12c5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x12c5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x12c5('0x7'));var client=jayson['client'][_0x12c5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d0cdf,_0x1d71e6,_0xa89d90){return new BPromise(function(_0x42e06f,_0x41ca55){return client[_0x12c5('0x9')](_0x2d0cdf,_0xa89d90)[_0x12c5('0xa')](function(_0x4a7f9d){logger[_0x12c5('0xb')](_0x12c5('0xc'),_0x1d71e6,_0x12c5('0xd'));logger[_0x12c5('0xe')](_0x12c5('0xf'),_0x1d71e6,_0x12c5('0xd'),JSON['stringify'](_0x4a7f9d));if(_0x4a7f9d[_0x12c5('0x10')]){if(_0x4a7f9d[_0x12c5('0x10')]['code']===0x1f4){logger[_0x12c5('0x10')](_0x12c5('0xc'),_0x1d71e6,_0x4a7f9d[_0x12c5('0x10')]['message']);return _0x41ca55(_0x4a7f9d[_0x12c5('0x10')][_0x12c5('0x11')]);}logger['error'](_0x12c5('0xc'),_0x1d71e6,_0x4a7f9d[_0x12c5('0x10')]['message']);return _0x42e06f(_0x4a7f9d[_0x12c5('0x10')][_0x12c5('0x11')]);}else{logger[_0x12c5('0xb')](_0x12c5('0xc'),_0x1d71e6,_0x12c5('0xd'));_0x42e06f(_0x4a7f9d[_0x12c5('0x12')][_0x12c5('0x11')]);}})[_0x12c5('0x13')](function(_0x385ecc){logger[_0x12c5('0x10')](_0x12c5('0xc'),_0x1d71e6,_0x385ecc);_0x41ca55(_0x385ecc);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 969f474..4e8c68a 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 _0x58d3=['query','post','create','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','./analyticDefaultReport.controller','get','index','isAuthenticated','show','/:id/preview','preview','/:id/run','/:id/query'];(function(_0x40dac3,_0x1332a2){var _0x8367fe=function(_0x11887a){while(--_0x11887a){_0x40dac3['push'](_0x40dac3['shift']());}};_0x8367fe(++_0x1332a2);}(_0x58d3,0x92));var _0x358d=function(_0x25f14f,_0x204b99){_0x25f14f=_0x25f14f-0x0;var _0x2f3ea3=_0x58d3[_0x25f14f];return _0x2f3ea3;};'use strict';var multer=require(_0x358d('0x0'));var util=require(_0x358d('0x1'));var path=require('path');var timeout=require(_0x358d('0x2'));var express=require(_0x358d('0x3'));var router=express[_0x358d('0x4')]();var fs_extra=require(_0x358d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x358d('0x6'));router[_0x358d('0x7')]('/',auth['isAuthenticated'](),controller[_0x358d('0x8')]);router['get']('/:id',auth[_0x358d('0x9')](),controller[_0x358d('0xa')]);router[_0x358d('0x7')](_0x358d('0xb'),auth[_0x358d('0x9')](),controller[_0x358d('0xc')]);router[_0x358d('0x7')](_0x358d('0xd'),auth[_0x358d('0x9')](),controller['run']);router[_0x358d('0x7')](_0x358d('0xe'),auth['isAuthenticated'](),controller[_0x358d('0xf')]);router[_0x358d('0x10')]('/',auth[_0x358d('0x9')](),controller[_0x358d('0x11')]);router[_0x358d('0x12')](_0x358d('0x13'),auth[_0x358d('0x9')](),controller[_0x358d('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x358d('0x15')]);module[_0x358d('0x16')]=router; \ No newline at end of file +var _0x85b7=['/:id/preview','preview','/:id/run','/:id/query','query','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','show'];(function(_0x127130,_0x5b7d62){var _0x189725=function(_0x118d57){while(--_0x118d57){_0x127130['push'](_0x127130['shift']());}};_0x189725(++_0x5b7d62);}(_0x85b7,0x11b));var _0x785b=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x85b7[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x785b('0x0'));var util=require(_0x785b('0x1'));var path=require(_0x785b('0x2'));var timeout=require(_0x785b('0x3'));var express=require(_0x785b('0x4'));var router=express[_0x785b('0x5')]();var fs_extra=require(_0x785b('0x6'));var auth=require(_0x785b('0x7'));var interaction=require(_0x785b('0x8'));var config=require(_0x785b('0x9'));var controller=require(_0x785b('0xa'));router[_0x785b('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x785b('0xb')]('/:id',auth[_0x785b('0xc')](),controller[_0x785b('0xd')]);router[_0x785b('0xb')](_0x785b('0xe'),auth['isAuthenticated'](),controller[_0x785b('0xf')]);router['get'](_0x785b('0x10'),auth[_0x785b('0xc')](),controller['run']);router[_0x785b('0xb')](_0x785b('0x11'),auth[_0x785b('0xc')](),controller[_0x785b('0x12')]);router[_0x785b('0x13')]('/',auth[_0x785b('0xc')](),controller[_0x785b('0x14')]);router[_0x785b('0x15')]('/:id',auth[_0x785b('0xc')](),controller[_0x785b('0x16')]);router[_0x785b('0x17')](_0x785b('0x18'),auth[_0x785b('0xc')](),controller[_0x785b('0x19')]);module[_0x785b('0x1a')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 568fdf6..d37272d 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 _0xe04d=['DATE','Loading','ENUM','manual','UNSIGNED','sequelize','moment','exports','STRING','pdf','xlsx'];(function(_0x4c9915,_0x406b1a){var _0x473218=function(_0x2536ba){while(--_0x2536ba){_0x4c9915['push'](_0x4c9915['shift']());}};_0x473218(++_0x406b1a);}(_0xe04d,0x123));var _0xde04=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xe04d[_0x5834bc];return _0x3e183a;};'use strict';var Sequelize=require(_0xde04('0x0'));var moment=require(_0xde04('0x1'));module[_0xde04('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xde04('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv',_0xde04('0x4'),_0xde04('0x5')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xde04('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xde04('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0xde04('0x7')},'type':{'type':Sequelize[_0xde04('0x8')](_0xde04('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0xde04('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xde04('0xa')]},'reportType':{'type':Sequelize[_0xde04('0x3')]}}; \ No newline at end of file +var _0x5cea=['manual','scheduled','INTEGER','UNSIGNED','exports','STRING','ENUM','csv','xlsx','DATE','Loading'];(function(_0x4a58f7,_0x4078be){var _0x53ea50=function(_0x2fcb6c){while(--_0x2fcb6c){_0x4a58f7['push'](_0x4a58f7['shift']());}};_0x53ea50(++_0x4078be);}(_0x5cea,0x122));var _0xa5ce=function(_0x2ae9ae,_0xcc3b68){_0x2ae9ae=_0x2ae9ae-0x0;var _0x353507=_0x5cea[_0x2ae9ae];return _0x353507;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xa5ce('0x0')]={'name':{'type':Sequelize[_0xa5ce('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0xa5ce('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0xa5ce('0x2')](_0xa5ce('0x3'),'pdf',_0xa5ce('0x4')),'allowNull':![],'defaultValue':_0xa5ce('0x3')},'savename':{'type':Sequelize[_0xa5ce('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0xa5ce('0x5')]},'endDate':{'type':Sequelize[_0xa5ce('0x5')]},'status':{'type':Sequelize[_0xa5ce('0x1')],'defaultValue':_0xa5ce('0x6')},'type':{'type':Sequelize[_0xa5ce('0x2')](_0xa5ce('0x7'),_0xa5ce('0x8')),'allowNull':![],'defaultValue':_0xa5ce('0x7')},'reportId':{'type':Sequelize[_0xa5ce('0x9')](0xb)[_0xa5ce('0xa')]},'reportType':{'type':Sequelize[_0xa5ce('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 0ef54fb..cad382a 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 _0xeb2c=['undefined','limit','count','set','apply','reject','update','then','destroy','get','ExtractedReports','sendStatus','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','create','body','user','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','output','existsSync','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','format','%s.%s','toLowerCase','rimraf','zip-dir','fast-json-patch','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','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x5ccfb8,_0x3fb2dc){var _0x4d1d99=function(_0x15b4d1){while(--_0x15b4d1){_0x5ccfb8['push'](_0x5ccfb8['shift']());}};_0x4d1d99(++_0x3fb2dc);}(_0xeb2c,0xa3));var _0xceb2=function(_0x38680d,_0x5da44b){_0x38680d=_0x38680d-0x0;var _0xb5528a=_0xeb2c[_0x38680d];return _0xb5528a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xceb2('0x0'));var zipdir=require(_0xceb2('0x1'));var jsonpatch=require(_0xceb2('0x2'));var rp=require('request-promise');var moment=require(_0xceb2('0x3'));var BPromise=require(_0xceb2('0x4'));var Mustache=require(_0xceb2('0x5'));var util=require(_0xceb2('0x6'));var path=require(_0xceb2('0x7'));var sox=require(_0xceb2('0x8'));var csv=require(_0xceb2('0x9'));var ejs=require(_0xceb2('0xa'));var fs=require('fs');var fs_extra=require(_0xceb2('0xb'));var _=require('lodash');var squel=require(_0xceb2('0xc'));var crypto=require(_0xceb2('0xd'));var jsforce=require(_0xceb2('0xe'));var deskjs=require(_0xceb2('0xf'));var toCsv=require('to-csv');var querystring=require(_0xceb2('0x10'));var Papa=require(_0xceb2('0x11'));var Redis=require(_0xceb2('0x12'));var authService=require(_0xceb2('0x13'));var qs=require(_0xceb2('0x14'));var as=require(_0xceb2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xceb2('0x16'))(_0xceb2('0x17'));var utils=require(_0xceb2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xceb2('0x19'));var db=require(_0xceb2('0x1a'))['db'];function respondWithStatusCode(_0x344a82,_0x41efe8){_0x41efe8=_0x41efe8||0xcc;return function(_0x41a8f1){if(_0x41a8f1){return _0x344a82['sendStatus'](_0x41efe8);}return _0x344a82[_0xceb2('0x1b')](_0x41efe8)[_0xceb2('0x1c')]();};}function respondWithResult(_0x505bc0,_0x31df44){_0x31df44=_0x31df44||0xc8;return function(_0x181c1e){if(_0x181c1e){return _0x505bc0[_0xceb2('0x1b')](_0x31df44)[_0xceb2('0x1d')](_0x181c1e);}};}function respondWithFilteredResult(_0x407a76,_0x1bb800){return function(_0x2d2fe3){if(_0x2d2fe3){var _0xd6885c=typeof _0x1bb800[_0xceb2('0x1e')]===_0xceb2('0x1f')&&typeof _0x1bb800[_0xceb2('0x20')]===_0xceb2('0x1f');var _0x1773cb=_0x2d2fe3[_0xceb2('0x21')];var _0x1aa7bc=_0xd6885c?0x0:_0x1bb800[_0xceb2('0x1e')];var _0x58e41e=_0xd6885c?_0x2d2fe3[_0xceb2('0x21')]:_0x1bb800[_0xceb2('0x1e')]+_0x1bb800[_0xceb2('0x20')];var _0x3238a1;if(_0x58e41e>=_0x1773cb){_0x58e41e=_0x1773cb;_0x3238a1=0xc8;}else{_0x3238a1=0xce;}_0x407a76[_0xceb2('0x1b')](_0x3238a1);return _0x407a76[_0xceb2('0x22')]('Content-Range',_0x1aa7bc+'-'+_0x58e41e+'/'+_0x1773cb)['json'](_0x2d2fe3);}return null;};}function patchUpdates(_0x2ad300){return function(_0x43d5f9){try{jsonpatch[_0xceb2('0x23')](_0x43d5f9,_0x2ad300,!![]);}catch(_0x3559e7){return BPromise[_0xceb2('0x24')](_0x3559e7);}return _0x43d5f9['save']();};}function saveUpdates(_0x4e95be,_0x45a1db){return function(_0x4e4004){if(_0x4e4004){return _0x4e4004[_0xceb2('0x25')](_0x4e95be)[_0xceb2('0x26')](function(_0x186daf){return _0x186daf;});}return null;};}function removeEntity(_0x11ddc5,_0xc163e2){return function(_0x2d4dd7){if(_0x2d4dd7){return _0x2d4dd7[_0xceb2('0x27')]()[_0xceb2('0x26')](function(){var _0x4e44fb=_0x2d4dd7[_0xceb2('0x28')]({'plain':!![]});var _0x265d7f=_0xceb2('0x29');return db['UserProfileResource'][_0xceb2('0x27')]({'where':{'type':_0x265d7f,'resourceId':_0x4e44fb['id']}})[_0xceb2('0x26')](function(){return _0x2d4dd7;});})['then'](function(){_0x11ddc5[_0xceb2('0x1b')](0xcc)[_0xceb2('0x1c')]();});}};}function handleEntityNotFound(_0x5d302d,_0x1e4c3){return function(_0x1a36c4){if(!_0x1a36c4){_0x5d302d[_0xceb2('0x2a')](0x194);}return _0x1a36c4;};}function handleError(_0x3693e2,_0x13c3e2){_0x13c3e2=_0x13c3e2||0x1f4;return function(_0x41639f){logger[_0xceb2('0x2b')](_0x41639f[_0xceb2('0x2c')]);if(_0x41639f[_0xceb2('0x2d')]){delete _0x41639f['name'];}_0x3693e2[_0xceb2('0x1b')](_0x13c3e2)[_0xceb2('0x2e')](_0x41639f);};}exports[_0xceb2('0x2f')]=function(_0x2dfb9e,_0x179392){var _0x3f3c90={},_0x2afb18={},_0x17e192={'count':0x0,'rows':[]};var _0x31659d=_[_0xceb2('0x30')](db[_0xceb2('0x31')][_0xceb2('0x32')],function(_0x46cbc3){return{'name':_0x46cbc3[_0xceb2('0x33')],'type':_0x46cbc3['type'][_0xceb2('0x34')]};});_0x2afb18['model']=_['map'](_0x31659d,_0xceb2('0x2d'));_0x2afb18[_0xceb2('0x35')]=_[_0xceb2('0x36')](_0x2dfb9e[_0xceb2('0x35')]);_0x2afb18[_0xceb2('0x37')]=_[_0xceb2('0x38')](_0x2afb18[_0xceb2('0x39')],_0x2afb18['query']);_0x3f3c90['attributes']=_[_0xceb2('0x38')](_0x2afb18[_0xceb2('0x39')],qs['fields'](_0x2dfb9e['query'][_0xceb2('0x3a')]));_0x3f3c90[_0xceb2('0x3b')]=_0x3f3c90[_0xceb2('0x3b')]['length']?_0x3f3c90[_0xceb2('0x3b')]:_0x2afb18[_0xceb2('0x39')];if(!_0x2dfb9e[_0xceb2('0x35')][_0xceb2('0x3c')](_0xceb2('0x3d'))){_0x3f3c90[_0xceb2('0x20')]=qs[_0xceb2('0x20')](_0x2dfb9e[_0xceb2('0x35')]['limit']);_0x3f3c90[_0xceb2('0x1e')]=qs[_0xceb2('0x1e')](_0x2dfb9e['query'][_0xceb2('0x1e')]);}_0x3f3c90['order']=qs['sort'](_0x2dfb9e[_0xceb2('0x35')][_0xceb2('0x3e')]);_0x3f3c90[_0xceb2('0x3f')]=qs[_0xceb2('0x37')](_['pick'](_0x2dfb9e['query'],_0x2afb18[_0xceb2('0x37')]),_0x31659d);if(_0x2dfb9e[_0xceb2('0x35')][_0xceb2('0x40')]){_0x3f3c90['where']=_[_0xceb2('0x41')](_0x3f3c90[_0xceb2('0x3f')],{'$or':_[_0xceb2('0x30')](_0x31659d,function(_0x5cf520){if(_0x5cf520[_0xceb2('0x42')]!==_0xceb2('0x43')){var _0x5cac8d={};_0x5cac8d[_0x5cf520[_0xceb2('0x2d')]]={'$like':'%'+_0x2dfb9e[_0xceb2('0x35')][_0xceb2('0x40')]+'%'};return _0x5cac8d;}})});}_0x3f3c90=_[_0xceb2('0x41')]({},_0x3f3c90,_0x2dfb9e[_0xceb2('0x44')]);var _0x1a1c78={'where':_0x3f3c90[_0xceb2('0x3f')]};return db['AnalyticExtractedReport'][_0xceb2('0x21')](_0x1a1c78)['then'](function(_0xce6689){_0x17e192['count']=_0xce6689;if(_0x2dfb9e['query'][_0xceb2('0x45')]){_0x3f3c90['include']=[{'all':!![]}];}return db[_0xceb2('0x31')][_0xceb2('0x46')](_0x3f3c90);})['then'](function(_0x1e694b){_0x17e192[_0xceb2('0x47')]=_0x1e694b;return _0x17e192;})[_0xceb2('0x26')](respondWithFilteredResult(_0x179392,_0x3f3c90))[_0xceb2('0x48')](handleError(_0x179392,null));};exports['show']=function(_0x4e8d4f,_0x16a16c){var _0x264cb5={'raw':!![],'where':{'id':_0x4e8d4f[_0xceb2('0x49')]['id']}},_0x5268ed={};_0x5268ed[_0xceb2('0x39')]=_['keys'](db[_0xceb2('0x31')][_0xceb2('0x32')]);_0x5268ed[_0xceb2('0x35')]=_[_0xceb2('0x36')](_0x4e8d4f[_0xceb2('0x35')]);_0x5268ed[_0xceb2('0x37')]=_[_0xceb2('0x38')](_0x5268ed[_0xceb2('0x39')],_0x5268ed['query']);_0x264cb5[_0xceb2('0x3b')]=_[_0xceb2('0x38')](_0x5268ed[_0xceb2('0x39')],qs[_0xceb2('0x3a')](_0x4e8d4f['query'][_0xceb2('0x3a')]));_0x264cb5['attributes']=_0x264cb5[_0xceb2('0x3b')][_0xceb2('0x4a')]?_0x264cb5[_0xceb2('0x3b')]:_0x5268ed[_0xceb2('0x39')];if(_0x4e8d4f['query'][_0xceb2('0x45')]){_0x264cb5['include']=[{'all':!![]}];}_0x264cb5=_[_0xceb2('0x41')]({},_0x264cb5,_0x4e8d4f[_0xceb2('0x44')]);return db[_0xceb2('0x31')]['find'](_0x264cb5)[_0xceb2('0x26')](handleEntityNotFound(_0x16a16c,null))[_0xceb2('0x26')](respondWithResult(_0x16a16c,null))[_0xceb2('0x48')](handleError(_0x16a16c,null));};exports[_0xceb2('0x4b')]=function(_0x211262,_0x579bc3){return db[_0xceb2('0x31')][_0xceb2('0x4b')](_0x211262[_0xceb2('0x4c')],{})[_0xceb2('0x26')](function(_0x5a8bcf){var _0x212fad=_0x211262[_0xceb2('0x4d')][_0xceb2('0x28')]({'plain':!![]});if(!_0x212fad)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x212fad['role']===_0xceb2('0x4d')){var _0x4f6226=_0x5a8bcf[_0xceb2('0x28')]({'plain':!![]});var _0x3c0293=_0xceb2('0x29');return db['UserProfileSection'][_0xceb2('0x4e')]({'where':{'name':_0x3c0293,'userProfileId':_0x212fad[_0xceb2('0x4f')]},'raw':!![]})[_0xceb2('0x26')](function(_0x241be8){if(_0x241be8&&_0x241be8[_0xceb2('0x50')]===0x0){return db[_0xceb2('0x51')][_0xceb2('0x4b')]({'name':_0x4f6226[_0xceb2('0x2d')],'resourceId':_0x4f6226['id'],'type':_0x241be8[_0xceb2('0x2d')],'sectionId':_0x241be8['id']},{})[_0xceb2('0x26')](function(){return _0x5a8bcf;});}else{return _0x5a8bcf;}})[_0xceb2('0x48')](function(_0x14108b){logger['error'](_0xceb2('0x52'),_0x14108b);throw _0x14108b;});}return _0x5a8bcf;})[_0xceb2('0x26')](respondWithResult(_0x579bc3,0xc9))[_0xceb2('0x48')](handleError(_0x579bc3,null));};exports['update']=function(_0x9461f6,_0x1cd150){if(_0x9461f6['body']['id']){delete _0x9461f6['body']['id'];}return db[_0xceb2('0x31')][_0xceb2('0x4e')]({'where':{'id':_0x9461f6['params']['id']}})[_0xceb2('0x26')](handleEntityNotFound(_0x1cd150,null))[_0xceb2('0x26')](saveUpdates(_0x9461f6[_0xceb2('0x4c')],null))[_0xceb2('0x26')](respondWithResult(_0x1cd150,null))[_0xceb2('0x48')](handleError(_0x1cd150,null));};exports[_0xceb2('0x27')]=function(_0x4afc0a,_0x5001a2){return db[_0xceb2('0x31')][_0xceb2('0x4e')]({'where':{'id':_0x4afc0a['params']['id']}})[_0xceb2('0x26')](handleEntityNotFound(_0x5001a2,null))[_0xceb2('0x26')](removeEntity(_0x5001a2,null))['catch'](handleError(_0x5001a2,null));};exports[_0xceb2('0x53')]=function(_0x8b2400,_0x46c29b,_0x5bde7b){return db[_0xceb2('0x31')][_0xceb2('0x4e')]({'where':{'id':_0x8b2400[_0xceb2('0x49')]['id']},'attributes':[_0xceb2('0x2d'),_0xceb2('0x54'),'savename',_0xceb2('0x55')],'raw':!![]})[_0xceb2('0x26')](handleEntityNotFound(_0x46c29b,null))[_0xceb2('0x26')](function(_0x4514ab){if(_0x4514ab){if(!fs[_0xceb2('0x56')](path[_0xceb2('0x57')](config[_0xceb2('0x58')],'server/files/reports',_0x4514ab['savename']))){throw new db[(_0xceb2('0x59'))][(_0xceb2('0x5a'))](_0xceb2('0x5b'));}if(_0x8b2400[_0xceb2('0x35')][_0xceb2('0x5c')]){return _0x46c29b['sendStatus'](0xc8);}return _0x46c29b[_0xceb2('0x53')](path['join'](config[_0xceb2('0x58')],_0xceb2('0x5d'),_0x4514ab['savename']),util[_0xceb2('0x5e')](_0xceb2('0x5f'),_0x4514ab[_0xceb2('0x54')]||_0x4514ab[_0xceb2('0x2d')],_0x4514ab['output'][_0xceb2('0x60')]()));}})[_0xceb2('0x48')](handleError(_0x46c29b,null));}; \ No newline at end of file +var _0x59a8=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','ExtractedReports','UserProfileResource','then','sendStatus','error','stack','name','index','fieldName','key','model','map','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','where','filter','merge','type','AnalyticExtractedReport','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','savename','output','existsSync','join','root','server/files/reports','ValidationError','exists','download','format','basename','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x59a8,0x16e));var _0x859a=function(_0x51da3e,_0x13da07){_0x51da3e=_0x51da3e-0x0;var _0x3bf7f5=_0x59a8[_0x51da3e];return _0x3bf7f5;};'use strict';var emlformat=require(_0x859a('0x0'));var rimraf=require(_0x859a('0x1'));var zipdir=require(_0x859a('0x2'));var jsonpatch=require(_0x859a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x859a('0x4'));var Mustache=require(_0x859a('0x5'));var util=require(_0x859a('0x6'));var path=require(_0x859a('0x7'));var sox=require(_0x859a('0x8'));var csv=require(_0x859a('0x9'));var ejs=require(_0x859a('0xa'));var fs=require('fs');var fs_extra=require(_0x859a('0xb'));var _=require(_0x859a('0xc'));var squel=require(_0x859a('0xd'));var crypto=require(_0x859a('0xe'));var jsforce=require(_0x859a('0xf'));var deskjs=require(_0x859a('0x10'));var toCsv=require('to-csv');var querystring=require(_0x859a('0x11'));var Papa=require(_0x859a('0x12'));var Redis=require(_0x859a('0x13'));var authService=require(_0x859a('0x14'));var qs=require(_0x859a('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x859a('0x16'));var logger=require('../../config/logger')(_0x859a('0x17'));var utils=require('../../config/utils');var config=require(_0x859a('0x18'));var licenseUtil=require(_0x859a('0x19'));var db=require(_0x859a('0x1a'))['db'];function respondWithStatusCode(_0x4f3e25,_0x3dde98){_0x3dde98=_0x3dde98||0xcc;return function(_0x404ffa){if(_0x404ffa){return _0x4f3e25['sendStatus'](_0x3dde98);}return _0x4f3e25[_0x859a('0x1b')](_0x3dde98)[_0x859a('0x1c')]();};}function respondWithResult(_0x2fc390,_0x604582){_0x604582=_0x604582||0xc8;return function(_0x3af9e){if(_0x3af9e){return _0x2fc390[_0x859a('0x1b')](_0x604582)[_0x859a('0x1d')](_0x3af9e);}};}function respondWithFilteredResult(_0x19fbd7,_0x26d80f){return function(_0x56d09e){if(_0x56d09e){var _0x8a07f9=typeof _0x26d80f[_0x859a('0x1e')]===_0x859a('0x1f')&&typeof _0x26d80f[_0x859a('0x20')]==='undefined';var _0x338587=_0x56d09e['count'];var _0x367624=_0x8a07f9?0x0:_0x26d80f[_0x859a('0x1e')];var _0x1470d6=_0x8a07f9?_0x56d09e[_0x859a('0x21')]:_0x26d80f[_0x859a('0x1e')]+_0x26d80f[_0x859a('0x20')];var _0x34139e;if(_0x1470d6>=_0x338587){_0x1470d6=_0x338587;_0x34139e=0xc8;}else{_0x34139e=0xce;}_0x19fbd7['status'](_0x34139e);return _0x19fbd7[_0x859a('0x22')](_0x859a('0x23'),_0x367624+'-'+_0x1470d6+'/'+_0x338587)[_0x859a('0x1d')](_0x56d09e);}return null;};}function patchUpdates(_0x176d6f){return function(_0x46a0e2){try{jsonpatch[_0x859a('0x24')](_0x46a0e2,_0x176d6f,!![]);}catch(_0x26168c){return BPromise[_0x859a('0x25')](_0x26168c);}return _0x46a0e2[_0x859a('0x26')]();};}function saveUpdates(_0x4fbc0c,_0x4dc1bd){return function(_0x17d1ab){if(_0x17d1ab){return _0x17d1ab[_0x859a('0x27')](_0x4fbc0c)['then'](function(_0x365269){return _0x365269;});}return null;};}function removeEntity(_0x1929ef,_0x94f30b){return function(_0x133d54){if(_0x133d54){return _0x133d54[_0x859a('0x28')]()['then'](function(){var _0x5e8f92=_0x133d54['get']({'plain':!![]});var _0x245171=_0x859a('0x29');return db[_0x859a('0x2a')][_0x859a('0x28')]({'where':{'type':_0x245171,'resourceId':_0x5e8f92['id']}})[_0x859a('0x2b')](function(){return _0x133d54;});})[_0x859a('0x2b')](function(){_0x1929ef[_0x859a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1518eb,_0x118054){return function(_0x309b23){if(!_0x309b23){_0x1518eb[_0x859a('0x2c')](0x194);}return _0x309b23;};}function handleError(_0xafabb4,_0x1ebbb1){_0x1ebbb1=_0x1ebbb1||0x1f4;return function(_0x2271ef){logger[_0x859a('0x2d')](_0x2271ef[_0x859a('0x2e')]);if(_0x2271ef[_0x859a('0x2f')]){delete _0x2271ef[_0x859a('0x2f')];}_0xafabb4[_0x859a('0x1b')](_0x1ebbb1)['send'](_0x2271ef);};}exports[_0x859a('0x30')]=function(_0x5af033,_0x2af373){var _0x17f45a={},_0x5b2883={},_0x51792a={'count':0x0,'rows':[]};var _0x5ebe13=_['map'](db['AnalyticExtractedReport']['rawAttributes'],function(_0xa7a895){return{'name':_0xa7a895[_0x859a('0x31')],'type':_0xa7a895['type'][_0x859a('0x32')]};});_0x5b2883[_0x859a('0x33')]=_[_0x859a('0x34')](_0x5ebe13,_0x859a('0x2f'));_0x5b2883[_0x859a('0x35')]=_['keys'](_0x5af033[_0x859a('0x35')]);_0x5b2883[_0x859a('0x36')]=_['intersection'](_0x5b2883[_0x859a('0x33')],_0x5b2883[_0x859a('0x35')]);_0x17f45a[_0x859a('0x37')]=_[_0x859a('0x38')](_0x5b2883[_0x859a('0x33')],qs['fields'](_0x5af033[_0x859a('0x35')]['fields']));_0x17f45a[_0x859a('0x37')]=_0x17f45a[_0x859a('0x37')][_0x859a('0x39')]?_0x17f45a[_0x859a('0x37')]:_0x5b2883[_0x859a('0x33')];if(!_0x5af033['query'][_0x859a('0x3a')](_0x859a('0x3b'))){_0x17f45a[_0x859a('0x20')]=qs[_0x859a('0x20')](_0x5af033[_0x859a('0x35')]['limit']);_0x17f45a[_0x859a('0x1e')]=qs[_0x859a('0x1e')](_0x5af033[_0x859a('0x35')]['offset']);}_0x17f45a['order']=qs['sort'](_0x5af033[_0x859a('0x35')]['sort']);_0x17f45a[_0x859a('0x3c')]=qs[_0x859a('0x36')](_['pick'](_0x5af033[_0x859a('0x35')],_0x5b2883[_0x859a('0x36')]),_0x5ebe13);if(_0x5af033[_0x859a('0x35')][_0x859a('0x3d')]){_0x17f45a[_0x859a('0x3c')]=_[_0x859a('0x3e')](_0x17f45a[_0x859a('0x3c')],{'$or':_[_0x859a('0x34')](_0x5ebe13,function(_0x136b74){if(_0x136b74[_0x859a('0x3f')]!=='VIRTUAL'){var _0x4b61ef={};_0x4b61ef[_0x136b74[_0x859a('0x2f')]]={'$like':'%'+_0x5af033[_0x859a('0x35')][_0x859a('0x3d')]+'%'};return _0x4b61ef;}})});}_0x17f45a=_['merge']({},_0x17f45a,_0x5af033['options']);var _0x4c49e6={'where':_0x17f45a[_0x859a('0x3c')]};return db[_0x859a('0x40')]['count'](_0x4c49e6)[_0x859a('0x2b')](function(_0x379f62){_0x51792a['count']=_0x379f62;if(_0x5af033[_0x859a('0x35')][_0x859a('0x41')]){_0x17f45a[_0x859a('0x42')]=[{'all':!![]}];}return db[_0x859a('0x40')][_0x859a('0x43')](_0x17f45a);})[_0x859a('0x2b')](function(_0x276db6){_0x51792a[_0x859a('0x44')]=_0x276db6;return _0x51792a;})[_0x859a('0x2b')](respondWithFilteredResult(_0x2af373,_0x17f45a))[_0x859a('0x45')](handleError(_0x2af373,null));};exports[_0x859a('0x46')]=function(_0x5f09c2,_0x2daac0){var _0x12a633={'raw':!![],'where':{'id':_0x5f09c2[_0x859a('0x47')]['id']}},_0x5d5590={};_0x5d5590[_0x859a('0x33')]=_[_0x859a('0x48')](db[_0x859a('0x40')][_0x859a('0x49')]);_0x5d5590[_0x859a('0x35')]=_[_0x859a('0x48')](_0x5f09c2[_0x859a('0x35')]);_0x5d5590[_0x859a('0x36')]=_[_0x859a('0x38')](_0x5d5590['model'],_0x5d5590['query']);_0x12a633[_0x859a('0x37')]=_['intersection'](_0x5d5590[_0x859a('0x33')],qs['fields'](_0x5f09c2['query']['fields']));_0x12a633[_0x859a('0x37')]=_0x12a633[_0x859a('0x37')][_0x859a('0x39')]?_0x12a633[_0x859a('0x37')]:_0x5d5590[_0x859a('0x33')];if(_0x5f09c2[_0x859a('0x35')]['includeAll']){_0x12a633[_0x859a('0x42')]=[{'all':!![]}];}_0x12a633=_['merge']({},_0x12a633,_0x5f09c2[_0x859a('0x4a')]);return db[_0x859a('0x40')]['find'](_0x12a633)[_0x859a('0x2b')](handleEntityNotFound(_0x2daac0,null))[_0x859a('0x2b')](respondWithResult(_0x2daac0,null))[_0x859a('0x45')](handleError(_0x2daac0,null));};exports[_0x859a('0x4b')]=function(_0x25c086,_0x239e13){return db[_0x859a('0x40')]['create'](_0x25c086[_0x859a('0x4c')],{})[_0x859a('0x2b')](function(_0x1d784e){var _0x62920b=_0x25c086['user'][_0x859a('0x4d')]({'plain':!![]});if(!_0x62920b)throw new Error(_0x859a('0x4e'));if(_0x62920b['role']===_0x859a('0x4f')){var _0xc4edd5=_0x1d784e['get']({'plain':!![]});var _0x246a0b=_0x859a('0x29');return db[_0x859a('0x50')][_0x859a('0x51')]({'where':{'name':_0x246a0b,'userProfileId':_0x62920b[_0x859a('0x52')]},'raw':!![]})[_0x859a('0x2b')](function(_0x55a765){if(_0x55a765&&_0x55a765['autoAssociation']===0x0){return db[_0x859a('0x2a')][_0x859a('0x4b')]({'name':_0xc4edd5[_0x859a('0x2f')],'resourceId':_0xc4edd5['id'],'type':_0x55a765['name'],'sectionId':_0x55a765['id']},{})['then'](function(){return _0x1d784e;});}else{return _0x1d784e;}})[_0x859a('0x45')](function(_0x2f1dc6){logger['error'](_0x859a('0x53'),_0x2f1dc6);throw _0x2f1dc6;});}return _0x1d784e;})[_0x859a('0x2b')](respondWithResult(_0x239e13,0xc9))[_0x859a('0x45')](handleError(_0x239e13,null));};exports['update']=function(_0x678225,_0x5090b1){if(_0x678225[_0x859a('0x4c')]['id']){delete _0x678225[_0x859a('0x4c')]['id'];}return db[_0x859a('0x40')][_0x859a('0x51')]({'where':{'id':_0x678225['params']['id']}})[_0x859a('0x2b')](handleEntityNotFound(_0x5090b1,null))[_0x859a('0x2b')](saveUpdates(_0x678225[_0x859a('0x4c')],null))['then'](respondWithResult(_0x5090b1,null))['catch'](handleError(_0x5090b1,null));};exports[_0x859a('0x28')]=function(_0x4ca4f7,_0x1c07b5){return db[_0x859a('0x40')][_0x859a('0x51')]({'where':{'id':_0x4ca4f7['params']['id']}})['then'](handleEntityNotFound(_0x1c07b5,null))['then'](removeEntity(_0x1c07b5,null))[_0x859a('0x45')](handleError(_0x1c07b5,null));};exports['download']=function(_0x188377,_0x349a50,_0x533b99){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x188377[_0x859a('0x47')]['id']},'attributes':[_0x859a('0x2f'),'basename',_0x859a('0x54'),_0x859a('0x55')],'raw':!![]})[_0x859a('0x2b')](handleEntityNotFound(_0x349a50,null))[_0x859a('0x2b')](function(_0x58cffb){if(_0x58cffb){if(!fs[_0x859a('0x56')](path[_0x859a('0x57')](config[_0x859a('0x58')],_0x859a('0x59'),_0x58cffb[_0x859a('0x54')]))){throw new db['Sequelize'][(_0x859a('0x5a'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x188377[_0x859a('0x35')][_0x859a('0x5b')]){return _0x349a50['sendStatus'](0xc8);}return _0x349a50[_0x859a('0x5c')](path[_0x859a('0x57')](config['root'],_0x859a('0x59'),_0x58cffb['savename']),util[_0x859a('0x5d')]('%s.%s',_0x58cffb[_0x859a('0x5e')]||_0x58cffb['name'],_0x58cffb[_0x859a('0x55')][_0x859a('0x5f')]()));}})['catch'](handleError(_0x349a50,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index c2a548c..64cfedb 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 _0x0dfc=['request-promise','rimraf','./analyticExtractedReport.attributes','analytics_extracted_reports','lodash','util','../../config/logger','api','moment'];(function(_0x2ddea0,_0x434267){var _0x5e17a0=function(_0x47425d){while(--_0x47425d){_0x2ddea0['push'](_0x2ddea0['shift']());}};_0x5e17a0(++_0x434267);}(_0x0dfc,0x67));var _0xc0df=function(_0x2384ce,_0x1742bb){_0x2384ce=_0x2384ce-0x0;var _0x3102fe=_0x0dfc[_0x2384ce];return _0x3102fe;};'use strict';var _=require(_0xc0df('0x0'));var util=require(_0xc0df('0x1'));var logger=require(_0xc0df('0x2'))(_0xc0df('0x3'));var moment=require(_0xc0df('0x4'));var BPromise=require('bluebird');var rp=require(_0xc0df('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc0df('0x6'));var config=require('../../config/environment');var attributes=require(_0xc0df('0x7'));module['exports']=function(_0x3d931d,_0x2ea458){return _0x3d931d['define']('AnalyticExtractedReport',attributes,{'tableName':_0xc0df('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b4d=['path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x2d5ac3,_0x51fbf1){var _0x49f523=function(_0x2bd546){while(--_0x2bd546){_0x2d5ac3['push'](_0x2d5ac3['shift']());}};_0x49f523(++_0x51fbf1);}(_0x2b4d,0x1f2));var _0xd2b4=function(_0x40911a,_0x55ec99){_0x40911a=_0x40911a-0x0;var _0x27e8e3=_0x2b4d[_0x40911a];return _0x27e8e3;};'use strict';var _=require(_0xd2b4('0x0'));var util=require(_0xd2b4('0x1'));var logger=require(_0xd2b4('0x2'))(_0xd2b4('0x3'));var moment=require(_0xd2b4('0x4'));var BPromise=require('bluebird');var rp=require(_0xd2b4('0x5'));var fs=require('fs');var path=require(_0xd2b4('0x6'));var rimraf=require(_0xd2b4('0x7'));var config=require(_0xd2b4('0x8'));var attributes=require(_0xd2b4('0x9'));module[_0xd2b4('0xa')]=function(_0x1132ba,_0x2227a6){return _0x1132ba[_0xd2b4('0xb')](_0xd2b4('0xc'),attributes,{'tableName':_0xd2b4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index d5a8f18..3e07d9e 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 _0xe3e8=['then','info','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticExtractedReport,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xe3e8,0x1ad));var _0x8e3e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xe3e8[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x8e3e('0x0'));var util=require(_0x8e3e('0x1'));var moment=require('moment');var BPromise=require(_0x8e3e('0x2'));var rs=require(_0x8e3e('0x3'));var fs=require('fs');var Redis=require(_0x8e3e('0x4'));var db=require(_0x8e3e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e3e('0x6'))(_0x8e3e('0x7'));var config=require('../../config/environment');var jayson=require(_0x8e3e('0x8'));var client=jayson[_0x8e3e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a82eb,_0x5c2495,_0x203d2e){return new BPromise(function(_0x35a92e,_0x2b856c){return client[_0x8e3e('0xa')](_0x1a82eb,_0x203d2e)[_0x8e3e('0xb')](function(_0x20cd3b){logger[_0x8e3e('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5c2495,_0x8e3e('0xd'));logger['debug'](_0x8e3e('0xe'),_0x5c2495,'request\x20sent',JSON[_0x8e3e('0xf')](_0x20cd3b));if(_0x20cd3b['error']){if(_0x20cd3b[_0x8e3e('0x10')]['code']===0x1f4){logger[_0x8e3e('0x10')](_0x8e3e('0x11'),_0x5c2495,_0x20cd3b[_0x8e3e('0x10')]['message']);return _0x2b856c(_0x20cd3b[_0x8e3e('0x10')][_0x8e3e('0x12')]);}logger[_0x8e3e('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5c2495,_0x20cd3b[_0x8e3e('0x10')][_0x8e3e('0x12')]);return _0x35a92e(_0x20cd3b[_0x8e3e('0x10')][_0x8e3e('0x12')]);}else{logger[_0x8e3e('0xc')](_0x8e3e('0x11'),_0x5c2495,'request\x20sent');_0x35a92e(_0x20cd3b[_0x8e3e('0x13')][_0x8e3e('0x12')]);}})['catch'](function(_0x1ca3ee){logger['error'](_0x8e3e('0x11'),_0x5c2495,_0x1ca3ee);_0x2b856c(_0x1ca3ee);});});} \ No newline at end of file +var _0x4801=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x36e74d,_0x1b1017){var _0x278f89=function(_0x312963){while(--_0x312963){_0x36e74d['push'](_0x36e74d['shift']());}};_0x278f89(++_0x1b1017);}(_0x4801,0x95));var _0x1480=function(_0x25bb9d,_0x4f12cc){_0x25bb9d=_0x25bb9d-0x0;var _0x5e7a45=_0x4801[_0x25bb9d];return _0x5e7a45;};'use strict';var _=require(_0x1480('0x0'));var util=require(_0x1480('0x1'));var moment=require('moment');var BPromise=require(_0x1480('0x2'));var rs=require(_0x1480('0x3'));var fs=require('fs');var Redis=require(_0x1480('0x4'));var db=require(_0x1480('0x5'))['db'];var utils=require(_0x1480('0x6'));var logger=require(_0x1480('0x7'))(_0x1480('0x8'));var config=require(_0x1480('0x9'));var jayson=require(_0x1480('0xa'));var client=jayson[_0x1480('0xb')][_0x1480('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5783cf,_0x28fd6a,_0x41396c){return new BPromise(function(_0xf8e38e,_0x27b072){return client[_0x1480('0xd')](_0x5783cf,_0x41396c)[_0x1480('0xe')](function(_0x4cf8fd){logger[_0x1480('0xf')](_0x1480('0x10'),_0x28fd6a,'request\x20sent');logger[_0x1480('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x28fd6a,_0x1480('0x12'),JSON[_0x1480('0x13')](_0x4cf8fd));if(_0x4cf8fd[_0x1480('0x14')]){if(_0x4cf8fd['error'][_0x1480('0x15')]===0x1f4){logger[_0x1480('0x14')](_0x1480('0x10'),_0x28fd6a,_0x4cf8fd[_0x1480('0x14')][_0x1480('0x16')]);return _0x27b072(_0x4cf8fd['error'][_0x1480('0x16')]);}logger[_0x1480('0x14')](_0x1480('0x10'),_0x28fd6a,_0x4cf8fd[_0x1480('0x14')][_0x1480('0x16')]);return _0xf8e38e(_0x4cf8fd['error'][_0x1480('0x16')]);}else{logger['info'](_0x1480('0x10'),_0x28fd6a,'request\x20sent');_0xf8e38e(_0x4cf8fd[_0x1480('0x17')][_0x1480('0x16')]);}})[_0x1480('0x18')](function(_0x3a402a){logger[_0x1480('0x14')](_0x1480('0x10'),_0x28fd6a,_0x3a402a);_0x27b072(_0x3a402a);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 3f88271..812573f 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 _0xd104=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','put'];(function(_0x343dcf,_0x261e21){var _0x28c659=function(_0x347566){while(--_0x347566){_0x343dcf['push'](_0x343dcf['shift']());}};_0x28c659(++_0x261e21);}(_0xd104,0x101));var _0x4d10=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xd104[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x4d10('0x0'));var util=require('util');var path=require(_0x4d10('0x1'));var timeout=require(_0x4d10('0x2'));var express=require(_0x4d10('0x3'));var router=express[_0x4d10('0x4')]();var fs_extra=require(_0x4d10('0x5'));var auth=require(_0x4d10('0x6'));var interaction=require(_0x4d10('0x7'));var config=require(_0x4d10('0x8'));var controller=require(_0x4d10('0x9'));router[_0x4d10('0xa')]('/',auth[_0x4d10('0xb')](),controller[_0x4d10('0xc')]);router[_0x4d10('0xa')](_0x4d10('0xd'),auth[_0x4d10('0xb')](),controller[_0x4d10('0xe')]);router[_0x4d10('0xa')](_0x4d10('0xf'),auth[_0x4d10('0xb')](),controller[_0x4d10('0x10')]);router[_0x4d10('0x11')]('/',auth[_0x4d10('0xb')](),controller['create']);router[_0x4d10('0x12')](_0x4d10('0xd'),auth['isAuthenticated'](),controller[_0x4d10('0x13')]);router[_0x4d10('0x14')](_0x4d10('0xd'),auth[_0x4d10('0xb')](),controller[_0x4d10('0x15')]);module[_0x4d10('0x16')]=router; \ No newline at end of file +var _0x587b=['/:id/download','download','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','show'];(function(_0x372670,_0x3f4b9a){var _0x1c0597=function(_0x3da5cc){while(--_0x3da5cc){_0x372670['push'](_0x372670['shift']());}};_0x1c0597(++_0x3f4b9a);}(_0x587b,0x197));var _0xb587=function(_0x38eaca,_0xf9508b){_0x38eaca=_0x38eaca-0x0;var _0x41df0d=_0x587b[_0x38eaca];return _0x41df0d;};'use strict';var multer=require(_0xb587('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb587('0x1'));var express=require(_0xb587('0x2'));var router=express[_0xb587('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb587('0x4'));var config=require(_0xb587('0x5'));var controller=require(_0xb587('0x6'));router[_0xb587('0x7')]('/',auth[_0xb587('0x8')](),controller[_0xb587('0x9')]);router[_0xb587('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xb587('0xa')]);router['get'](_0xb587('0xb'),auth[_0xb587('0x8')](),controller[_0xb587('0xc')]);router['post']('/',auth[_0xb587('0x8')](),controller['create']);router[_0xb587('0xd')](_0xb587('0xe'),auth[_0xb587('0x8')](),controller[_0xb587('0xf')]);router[_0xb587('0x10')](_0xb587('0xe'),auth[_0xb587('0x8')](),controller[_0xb587('0x11')]);module[_0xb587('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 6047f45..53165ec 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 _0xff57=['exports','STRING','BOOLEAN','sequelize'];(function(_0x521ec6,_0x26c897){var _0x213874=function(_0x5520bc){while(--_0x5520bc){_0x521ec6['push'](_0x521ec6['shift']());}};_0x213874(++_0x26c897);}(_0xff57,0x16b));var _0x7ff5=function(_0x4cf8d3,_0x5786b6){_0x4cf8d3=_0x4cf8d3-0x0;var _0x511cd0=_0xff57[_0x4cf8d3];return _0x511cd0;};'use strict';var Sequelize=require(_0x7ff5('0x0'));module[_0x7ff5('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x7ff5('0x2')]},'format':{'type':Sequelize[_0x7ff5('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x7ff5('0x2')]},'custom':{'type':Sequelize[_0x7ff5('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf187=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x48974e,_0x15ba68){var _0xe9ac05=function(_0x52d101){while(--_0x52d101){_0x48974e['push'](_0x48974e['shift']());}};_0xe9ac05(++_0x15ba68);}(_0xf187,0xf7));var _0x7f18=function(_0x3cbebc,_0x28a8be){_0x3cbebc=_0x3cbebc-0x0;var _0x3eca98=_0xf187[_0x3cbebc];return _0x3eca98;};'use strict';var Sequelize=require(_0x7f18('0x0'));module[_0x7f18('0x1')]={'field':{'type':Sequelize[_0x7f18('0x2')]},'alias':{'type':Sequelize[_0x7f18('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x7f18('0x3')]},'groupBy':{'type':Sequelize[_0x7f18('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x7f18('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 16c5aaa..9030e32 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 _0x29fb=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','create','body','bulkCreate','update','find','bulkDestroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x1eb1b0,_0x34bc97){var _0x44522f=function(_0x582da0){while(--_0x582da0){_0x1eb1b0['push'](_0x1eb1b0['shift']());}};_0x44522f(++_0x34bc97);}(_0x29fb,0x13d));var _0xb29f=function(_0x5cb919,_0x549a21){_0x5cb919=_0x5cb919-0x0;var _0x2ee145=_0x29fb[_0x5cb919];return _0x2ee145;};'use strict';var emlformat=require(_0xb29f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb29f('0x1'));var jsonpatch=require(_0xb29f('0x2'));var rp=require(_0xb29f('0x3'));var moment=require(_0xb29f('0x4'));var BPromise=require(_0xb29f('0x5'));var Mustache=require('mustache');var util=require(_0xb29f('0x6'));var path=require('path');var sox=require(_0xb29f('0x7'));var csv=require(_0xb29f('0x8'));var ejs=require(_0xb29f('0x9'));var fs=require('fs');var fs_extra=require(_0xb29f('0xa'));var _=require(_0xb29f('0xb'));var squel=require(_0xb29f('0xc'));var crypto=require(_0xb29f('0xd'));var jsforce=require(_0xb29f('0xe'));var deskjs=require(_0xb29f('0xf'));var toCsv=require(_0xb29f('0x8'));var querystring=require(_0xb29f('0x10'));var Papa=require(_0xb29f('0x11'));var Redis=require(_0xb29f('0x12'));var authService=require(_0xb29f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb29f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb29f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb29f('0x16'));var db=require(_0xb29f('0x17'))['db'];function respondWithStatusCode(_0x223c68,_0x2a5d12){_0x2a5d12=_0x2a5d12||0xcc;return function(_0x2c0d06){if(_0x2c0d06){return _0x223c68['sendStatus'](_0x2a5d12);}return _0x223c68[_0xb29f('0x18')](_0x2a5d12)[_0xb29f('0x19')]();};}function respondWithResult(_0x547dea,_0x435f42){_0x435f42=_0x435f42||0xc8;return function(_0x4c3a94){if(_0x4c3a94){return _0x547dea[_0xb29f('0x18')](_0x435f42)[_0xb29f('0x1a')](_0x4c3a94);}};}function respondWithFilteredResult(_0xb48c64,_0x486268){return function(_0x2c92c1){if(_0x2c92c1){var _0x1000d0=typeof _0x486268[_0xb29f('0x1b')]===_0xb29f('0x1c')&&typeof _0x486268[_0xb29f('0x1d')]===_0xb29f('0x1c');var _0x1e1795=_0x2c92c1[_0xb29f('0x1e')];var _0x5a1445=_0x1000d0?0x0:_0x486268[_0xb29f('0x1b')];var _0x22e7a3=_0x1000d0?_0x2c92c1[_0xb29f('0x1e')]:_0x486268[_0xb29f('0x1b')]+_0x486268['limit'];var _0x20f85a;if(_0x22e7a3>=_0x1e1795){_0x22e7a3=_0x1e1795;_0x20f85a=0xc8;}else{_0x20f85a=0xce;}_0xb48c64[_0xb29f('0x18')](_0x20f85a);return _0xb48c64[_0xb29f('0x1f')](_0xb29f('0x20'),_0x5a1445+'-'+_0x22e7a3+'/'+_0x1e1795)[_0xb29f('0x1a')](_0x2c92c1);}return null;};}function patchUpdates(_0x32120c){return function(_0xb1ab1b){try{jsonpatch[_0xb29f('0x21')](_0xb1ab1b,_0x32120c,!![]);}catch(_0x47a355){return BPromise[_0xb29f('0x22')](_0x47a355);}return _0xb1ab1b[_0xb29f('0x23')]();};}function saveUpdates(_0x13c200,_0x136031){return function(_0x2ef939){if(_0x2ef939){return _0x2ef939['update'](_0x13c200)[_0xb29f('0x24')](function(_0x5c0e34){return _0x5c0e34;});}return null;};}function removeEntity(_0x4bb858,_0x4054e8){return function(_0x25739a){if(_0x25739a){return _0x25739a[_0xb29f('0x25')]()[_0xb29f('0x24')](function(){_0x4bb858[_0xb29f('0x18')](0xcc)[_0xb29f('0x19')]();});}};}function handleEntityNotFound(_0x2ec092,_0x378c7b){return function(_0x8c4a95){if(!_0x8c4a95){_0x2ec092['sendStatus'](0x194);}return _0x8c4a95;};}function handleError(_0x2fa4ea,_0x3adcf7){_0x3adcf7=_0x3adcf7||0x1f4;return function(_0x542c72){logger[_0xb29f('0x26')](_0x542c72[_0xb29f('0x27')]);if(_0x542c72['name']){delete _0x542c72[_0xb29f('0x28')];}_0x2fa4ea[_0xb29f('0x18')](_0x3adcf7)[_0xb29f('0x29')](_0x542c72);};}exports[_0xb29f('0x2a')]=function(_0xeb6480,_0x5cbe6d){var _0x34142c={},_0x20aacb={},_0x22ed8a={'count':0x0,'rows':[]};var _0xb3c309=_[_0xb29f('0x2b')](db[_0xb29f('0x2c')][_0xb29f('0x2d')],function(_0x4762a4){return{'name':_0x4762a4[_0xb29f('0x2e')],'type':_0x4762a4[_0xb29f('0x2f')][_0xb29f('0x30')]};});_0x20aacb[_0xb29f('0x31')]=_[_0xb29f('0x2b')](_0xb3c309,_0xb29f('0x28'));_0x20aacb[_0xb29f('0x32')]=_[_0xb29f('0x33')](_0xeb6480[_0xb29f('0x32')]);_0x20aacb[_0xb29f('0x34')]=_[_0xb29f('0x35')](_0x20aacb[_0xb29f('0x31')],_0x20aacb[_0xb29f('0x32')]);_0x34142c[_0xb29f('0x36')]=_[_0xb29f('0x35')](_0x20aacb['model'],qs[_0xb29f('0x37')](_0xeb6480[_0xb29f('0x32')]['fields']));_0x34142c[_0xb29f('0x36')]=_0x34142c['attributes'][_0xb29f('0x38')]?_0x34142c[_0xb29f('0x36')]:_0x20aacb[_0xb29f('0x31')];if(!_0xeb6480['query'][_0xb29f('0x39')](_0xb29f('0x3a'))){_0x34142c[_0xb29f('0x1d')]=qs[_0xb29f('0x1d')](_0xeb6480[_0xb29f('0x32')][_0xb29f('0x1d')]);_0x34142c['offset']=qs[_0xb29f('0x1b')](_0xeb6480['query'][_0xb29f('0x1b')]);}_0x34142c['order']=qs[_0xb29f('0x3b')](_0xeb6480[_0xb29f('0x32')][_0xb29f('0x3b')]);_0x34142c[_0xb29f('0x3c')]=qs[_0xb29f('0x34')](_[_0xb29f('0x3d')](_0xeb6480[_0xb29f('0x32')],_0x20aacb[_0xb29f('0x34')]),_0xb3c309);if(_0xeb6480[_0xb29f('0x32')][_0xb29f('0x3e')]){_0x34142c['where']=_[_0xb29f('0x3f')](_0x34142c[_0xb29f('0x3c')],{'$or':_[_0xb29f('0x2b')](_0xb3c309,function(_0x107173){if(_0x107173['type']!==_0xb29f('0x40')){var _0x430f0d={};_0x430f0d[_0x107173['name']]={'$like':'%'+_0xeb6480[_0xb29f('0x32')]['filter']+'%'};return _0x430f0d;}})});}_0x34142c=_[_0xb29f('0x3f')]({},_0x34142c,_0xeb6480[_0xb29f('0x41')]);var _0x5cdca7={'where':_0x34142c[_0xb29f('0x3c')]};return db[_0xb29f('0x2c')]['count'](_0x5cdca7)[_0xb29f('0x24')](function(_0x861589){_0x22ed8a[_0xb29f('0x1e')]=_0x861589;if(_0xeb6480[_0xb29f('0x32')][_0xb29f('0x42')]){_0x34142c[_0xb29f('0x43')]=[{'all':!![]}];}return db[_0xb29f('0x2c')][_0xb29f('0x44')](_0x34142c);})[_0xb29f('0x24')](function(_0x2d9f3f){_0x22ed8a['rows']=_0x2d9f3f;return _0x22ed8a;})[_0xb29f('0x24')](respondWithFilteredResult(_0x5cbe6d,_0x34142c))[_0xb29f('0x45')](handleError(_0x5cbe6d,null));};exports['show']=function(_0x528f28,_0x1d6e68){var _0x5774ca={'raw':![],'where':{'id':_0x528f28[_0xb29f('0x46')]['id']}},_0x5cda07={};_0x5cda07[_0xb29f('0x31')]=_['keys'](db['AnalyticFieldReport']['rawAttributes']);_0x5cda07[_0xb29f('0x32')]=_[_0xb29f('0x33')](_0x528f28[_0xb29f('0x32')]);_0x5cda07[_0xb29f('0x34')]=_[_0xb29f('0x35')](_0x5cda07[_0xb29f('0x31')],_0x5cda07[_0xb29f('0x32')]);_0x5774ca[_0xb29f('0x36')]=_[_0xb29f('0x35')](_0x5cda07[_0xb29f('0x31')],qs[_0xb29f('0x37')](_0x528f28[_0xb29f('0x32')][_0xb29f('0x37')]));_0x5774ca[_0xb29f('0x36')]=_0x5774ca[_0xb29f('0x36')]['length']?_0x5774ca[_0xb29f('0x36')]:_0x5cda07['model'];if(_0x528f28[_0xb29f('0x32')][_0xb29f('0x42')]){_0x5774ca[_0xb29f('0x43')]=[{'all':!![]}];}_0x5774ca=_['merge']({},_0x5774ca,_0x528f28['options']);return db[_0xb29f('0x2c')]['find'](_0x5774ca)['then'](handleEntityNotFound(_0x1d6e68,null))[_0xb29f('0x24')](respondWithResult(_0x1d6e68,null))[_0xb29f('0x45')](handleError(_0x1d6e68,null));};exports[_0xb29f('0x47')]=function(_0x51a055,_0x51dec0){return db[_0xb29f('0x2c')][_0xb29f('0x47')](_0x51a055[_0xb29f('0x48')],{})[_0xb29f('0x24')](respondWithResult(_0x51dec0,0xc9))[_0xb29f('0x45')](handleError(_0x51dec0,null));};exports[_0xb29f('0x49')]=function(_0x1fea12,_0x167729){return db[_0xb29f('0x2c')][_0xb29f('0x49')](_0x1fea12[_0xb29f('0x48')],{'raw':![],'individualHooks':!![]})[_0xb29f('0x24')](respondWithResult(_0x167729,0xc9))[_0xb29f('0x45')](handleError(_0x167729,null));};exports[_0xb29f('0x4a')]=function(_0x4e8e2b,_0x5909ff){if(_0x4e8e2b[_0xb29f('0x48')]['id']){delete _0x4e8e2b[_0xb29f('0x48')]['id'];}return db[_0xb29f('0x2c')][_0xb29f('0x4b')]({'where':{'id':_0x4e8e2b['params']['id']}})[_0xb29f('0x24')](handleEntityNotFound(_0x5909ff,null))[_0xb29f('0x24')](saveUpdates(_0x4e8e2b[_0xb29f('0x48')],null))[_0xb29f('0x24')](respondWithResult(_0x5909ff,null))[_0xb29f('0x45')](handleError(_0x5909ff,null));};exports['destroy']=function(_0x841d4a,_0x467262){return db[_0xb29f('0x2c')]['find']({'where':{'id':_0x841d4a['params']['id']}})[_0xb29f('0x24')](handleEntityNotFound(_0x467262,null))['then'](removeEntity(_0x467262,null))[_0xb29f('0x45')](handleError(_0x467262,null));};exports[_0xb29f('0x4c')]=function(_0x250401,_0x585e86){return db[_0xb29f('0x2c')][_0xb29f('0x25')]({'where':{'id':_0x250401[_0xb29f('0x32')][_0xb29f('0x4d')]||[]},'raw':![],'individualHooks':!![]})[_0xb29f('0x24')](respondWithResult(_0x585e86,0xcc))[_0xb29f('0x45')](handleError(_0x585e86,null));};exports['addFields']=function(_0x54b43e,_0x4663e9,_0x4611c5){return db[_0xb29f('0x4e')][_0xb29f('0x4f')]({'where':{'id':_0x54b43e[_0xb29f('0x46')]['id']}})[_0xb29f('0x24')](handleEntityNotFound(_0x4663e9,null))[_0xb29f('0x24')](function(_0x9138be){if(_0x9138be){return db[_0xb29f('0x50')][_0xb29f('0x51')](function(_0x53232b){return db['AnalyticFieldReport'][_0xb29f('0x25')]({'where':{'CustomReportId':_0x54b43e[_0xb29f('0x46')]['id']},'transaction':_0x53232b})[_0xb29f('0x24')](function(_0x557cbe){var _0x49aa20=_[_0xb29f('0x2b')](_0x54b43e[_0xb29f('0x48')],function(_0x1b4ed8){delete _0x1b4ed8['id'];_0x1b4ed8[_0xb29f('0x52')]=_0x54b43e[_0xb29f('0x46')]['id'];return _0x1b4ed8;});return db[_0xb29f('0x2c')]['bulkCreate'](_0x49aa20,{'transaction':_0x53232b});});})[_0xb29f('0x24')](function(){return db[_0xb29f('0x2c')][_0xb29f('0x44')]({'where':{'CustomReportId':_0x54b43e[_0xb29f('0x46')]['id']}});});}})['then'](respondWithResult(_0x4663e9,null))[_0xb29f('0x45')](handleError(_0x4663e9,null));}; \ No newline at end of file +var _0x611f=['lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','params','keys','length','includeAll','include','create','body','bulkCreate','find','destroy','ids','sequelize','transaction','CustomReportId','findAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x34070b,_0x56a6cf){var _0x245735=function(_0x510e05){while(--_0x510e05){_0x34070b['push'](_0x34070b['shift']());}};_0x245735(++_0x56a6cf);}(_0x611f,0x94));var _0xf611=function(_0x445d92,_0x22c321){_0x445d92=_0x445d92-0x0;var _0x2bac4d=_0x611f[_0x445d92];return _0x2bac4d;};'use strict';var emlformat=require(_0xf611('0x0'));var rimraf=require(_0xf611('0x1'));var zipdir=require(_0xf611('0x2'));var jsonpatch=require(_0xf611('0x3'));var rp=require('request-promise');var moment=require(_0xf611('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf611('0x5'));var util=require(_0xf611('0x6'));var path=require(_0xf611('0x7'));var sox=require(_0xf611('0x8'));var csv=require(_0xf611('0x9'));var ejs=require(_0xf611('0xa'));var fs=require('fs');var fs_extra=require(_0xf611('0xb'));var _=require(_0xf611('0xc'));var squel=require('squel');var crypto=require(_0xf611('0xd'));var jsforce=require(_0xf611('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf611('0x9'));var querystring=require(_0xf611('0xf'));var Papa=require(_0xf611('0x10'));var Redis=require(_0xf611('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf611('0x12'));var as=require(_0xf611('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf611('0x14'))(_0xf611('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf611('0x16'));var db=require(_0xf611('0x17'))['db'];function respondWithStatusCode(_0x2bfd8d,_0x507f1d){_0x507f1d=_0x507f1d||0xcc;return function(_0x5b0613){if(_0x5b0613){return _0x2bfd8d[_0xf611('0x18')](_0x507f1d);}return _0x2bfd8d[_0xf611('0x19')](_0x507f1d)[_0xf611('0x1a')]();};}function respondWithResult(_0x1af265,_0xbb96d7){_0xbb96d7=_0xbb96d7||0xc8;return function(_0x3ed076){if(_0x3ed076){return _0x1af265[_0xf611('0x19')](_0xbb96d7)[_0xf611('0x1b')](_0x3ed076);}};}function respondWithFilteredResult(_0x458c19,_0x30d730){return function(_0x41ffba){if(_0x41ffba){var _0x21c055=typeof _0x30d730['offset']===_0xf611('0x1c')&&typeof _0x30d730['limit']===_0xf611('0x1c');var _0x4f7a02=_0x41ffba[_0xf611('0x1d')];var _0x166a60=_0x21c055?0x0:_0x30d730[_0xf611('0x1e')];var _0x4ec80d=_0x21c055?_0x41ffba['count']:_0x30d730[_0xf611('0x1e')]+_0x30d730[_0xf611('0x1f')];var _0x97778e;if(_0x4ec80d>=_0x4f7a02){_0x4ec80d=_0x4f7a02;_0x97778e=0xc8;}else{_0x97778e=0xce;}_0x458c19[_0xf611('0x19')](_0x97778e);return _0x458c19[_0xf611('0x20')](_0xf611('0x21'),_0x166a60+'-'+_0x4ec80d+'/'+_0x4f7a02)[_0xf611('0x1b')](_0x41ffba);}return null;};}function patchUpdates(_0x32e37a){return function(_0x149ed4){try{jsonpatch[_0xf611('0x22')](_0x149ed4,_0x32e37a,!![]);}catch(_0x3ea046){return BPromise[_0xf611('0x23')](_0x3ea046);}return _0x149ed4[_0xf611('0x24')]();};}function saveUpdates(_0x212cd5,_0x15ff0f){return function(_0xf35a2){if(_0xf35a2){return _0xf35a2[_0xf611('0x25')](_0x212cd5)[_0xf611('0x26')](function(_0x2afc39){return _0x2afc39;});}return null;};}function removeEntity(_0xcf9ec8,_0x37729b){return function(_0x484ab4){if(_0x484ab4){return _0x484ab4['destroy']()[_0xf611('0x26')](function(){_0xcf9ec8['status'](0xcc)[_0xf611('0x1a')]();});}};}function handleEntityNotFound(_0x1fd2e0,_0x16d01a){return function(_0x5c7678){if(!_0x5c7678){_0x1fd2e0['sendStatus'](0x194);}return _0x5c7678;};}function handleError(_0xc22e3d,_0x2e2250){_0x2e2250=_0x2e2250||0x1f4;return function(_0x30880e){logger['error'](_0x30880e['stack']);if(_0x30880e['name']){delete _0x30880e[_0xf611('0x27')];}_0xc22e3d[_0xf611('0x19')](_0x2e2250)[_0xf611('0x28')](_0x30880e);};}exports[_0xf611('0x29')]=function(_0x1d47a7,_0x1fb833){var _0x27a2b6={},_0x2f817c={},_0xdc40fa={'count':0x0,'rows':[]};var _0x2eff4f=_['map'](db[_0xf611('0x2a')][_0xf611('0x2b')],function(_0x4f2e47){return{'name':_0x4f2e47[_0xf611('0x2c')],'type':_0x4f2e47[_0xf611('0x2d')][_0xf611('0x2e')]};});_0x2f817c[_0xf611('0x2f')]=_[_0xf611('0x30')](_0x2eff4f,_0xf611('0x27'));_0x2f817c[_0xf611('0x31')]=_['keys'](_0x1d47a7['query']);_0x2f817c[_0xf611('0x32')]=_[_0xf611('0x33')](_0x2f817c[_0xf611('0x2f')],_0x2f817c['query']);_0x27a2b6[_0xf611('0x34')]=_[_0xf611('0x33')](_0x2f817c['model'],qs[_0xf611('0x35')](_0x1d47a7[_0xf611('0x31')]['fields']));_0x27a2b6[_0xf611('0x34')]=_0x27a2b6[_0xf611('0x34')]['length']?_0x27a2b6[_0xf611('0x34')]:_0x2f817c['model'];if(!_0x1d47a7[_0xf611('0x31')][_0xf611('0x36')]('nolimit')){_0x27a2b6[_0xf611('0x1f')]=qs['limit'](_0x1d47a7[_0xf611('0x31')][_0xf611('0x1f')]);_0x27a2b6[_0xf611('0x1e')]=qs['offset'](_0x1d47a7[_0xf611('0x31')]['offset']);}_0x27a2b6[_0xf611('0x37')]=qs['sort'](_0x1d47a7[_0xf611('0x31')][_0xf611('0x38')]);_0x27a2b6[_0xf611('0x39')]=qs[_0xf611('0x32')](_[_0xf611('0x3a')](_0x1d47a7[_0xf611('0x31')],_0x2f817c[_0xf611('0x32')]),_0x2eff4f);if(_0x1d47a7[_0xf611('0x31')][_0xf611('0x3b')]){_0x27a2b6[_0xf611('0x39')]=_[_0xf611('0x3c')](_0x27a2b6[_0xf611('0x39')],{'$or':_[_0xf611('0x30')](_0x2eff4f,function(_0x31906e){if(_0x31906e[_0xf611('0x2d')]!==_0xf611('0x3d')){var _0xce0fb2={};_0xce0fb2[_0x31906e[_0xf611('0x27')]]={'$like':'%'+_0x1d47a7[_0xf611('0x31')][_0xf611('0x3b')]+'%'};return _0xce0fb2;}})});}_0x27a2b6=_[_0xf611('0x3c')]({},_0x27a2b6,_0x1d47a7[_0xf611('0x3e')]);var _0x28648a={'where':_0x27a2b6['where']};return db[_0xf611('0x2a')][_0xf611('0x1d')](_0x28648a)[_0xf611('0x26')](function(_0x18850c){_0xdc40fa[_0xf611('0x1d')]=_0x18850c;if(_0x1d47a7['query']['includeAll']){_0x27a2b6['include']=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x27a2b6);})['then'](function(_0x3e2f28){_0xdc40fa[_0xf611('0x3f')]=_0x3e2f28;return _0xdc40fa;})[_0xf611('0x26')](respondWithFilteredResult(_0x1fb833,_0x27a2b6))[_0xf611('0x40')](handleError(_0x1fb833,null));};exports['show']=function(_0x3ab0d5,_0x5b7619){var _0x471827={'raw':![],'where':{'id':_0x3ab0d5[_0xf611('0x41')]['id']}},_0x5f0968={};_0x5f0968[_0xf611('0x2f')]=_[_0xf611('0x42')](db[_0xf611('0x2a')][_0xf611('0x2b')]);_0x5f0968[_0xf611('0x31')]=_[_0xf611('0x42')](_0x3ab0d5[_0xf611('0x31')]);_0x5f0968[_0xf611('0x32')]=_['intersection'](_0x5f0968[_0xf611('0x2f')],_0x5f0968['query']);_0x471827[_0xf611('0x34')]=_[_0xf611('0x33')](_0x5f0968[_0xf611('0x2f')],qs[_0xf611('0x35')](_0x3ab0d5['query'][_0xf611('0x35')]));_0x471827[_0xf611('0x34')]=_0x471827[_0xf611('0x34')][_0xf611('0x43')]?_0x471827['attributes']:_0x5f0968[_0xf611('0x2f')];if(_0x3ab0d5[_0xf611('0x31')][_0xf611('0x44')]){_0x471827[_0xf611('0x45')]=[{'all':!![]}];}_0x471827=_[_0xf611('0x3c')]({},_0x471827,_0x3ab0d5[_0xf611('0x3e')]);return db[_0xf611('0x2a')]['find'](_0x471827)[_0xf611('0x26')](handleEntityNotFound(_0x5b7619,null))['then'](respondWithResult(_0x5b7619,null))[_0xf611('0x40')](handleError(_0x5b7619,null));};exports[_0xf611('0x46')]=function(_0x8fc59f,_0x3f7cc2){return db[_0xf611('0x2a')][_0xf611('0x46')](_0x8fc59f[_0xf611('0x47')],{})[_0xf611('0x26')](respondWithResult(_0x3f7cc2,0xc9))[_0xf611('0x40')](handleError(_0x3f7cc2,null));};exports[_0xf611('0x48')]=function(_0x561e02,_0x3a2040){return db[_0xf611('0x2a')][_0xf611('0x48')](_0x561e02[_0xf611('0x47')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3a2040,0xc9))[_0xf611('0x40')](handleError(_0x3a2040,null));};exports['update']=function(_0x252d59,_0x139e0e){if(_0x252d59[_0xf611('0x47')]['id']){delete _0x252d59['body']['id'];}return db[_0xf611('0x2a')][_0xf611('0x49')]({'where':{'id':_0x252d59[_0xf611('0x41')]['id']}})[_0xf611('0x26')](handleEntityNotFound(_0x139e0e,null))[_0xf611('0x26')](saveUpdates(_0x252d59[_0xf611('0x47')],null))['then'](respondWithResult(_0x139e0e,null))['catch'](handleError(_0x139e0e,null));};exports['destroy']=function(_0x339ad8,_0x519504){return db[_0xf611('0x2a')]['find']({'where':{'id':_0x339ad8['params']['id']}})[_0xf611('0x26')](handleEntityNotFound(_0x519504,null))['then'](removeEntity(_0x519504,null))[_0xf611('0x40')](handleError(_0x519504,null));};exports['bulkDestroy']=function(_0x3ff0dd,_0x4efc78){return db[_0xf611('0x2a')][_0xf611('0x4a')]({'where':{'id':_0x3ff0dd[_0xf611('0x31')][_0xf611('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0xf611('0x26')](respondWithResult(_0x4efc78,0xcc))[_0xf611('0x40')](handleError(_0x4efc78,null));};exports['addFields']=function(_0x4e8248,_0xd09559,_0x582936){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x4e8248[_0xf611('0x41')]['id']}})['then'](handleEntityNotFound(_0xd09559,null))[_0xf611('0x26')](function(_0x3bd0ac){if(_0x3bd0ac){return db[_0xf611('0x4c')][_0xf611('0x4d')](function(_0x3824dd){return db[_0xf611('0x2a')]['destroy']({'where':{'CustomReportId':_0x4e8248[_0xf611('0x41')]['id']},'transaction':_0x3824dd})[_0xf611('0x26')](function(_0x5527e1){var _0x2ddbda=_['map'](_0x4e8248[_0xf611('0x47')],function(_0x3cc5ae){delete _0x3cc5ae['id'];_0x3cc5ae[_0xf611('0x4e')]=_0x4e8248[_0xf611('0x41')]['id'];return _0x3cc5ae;});return db[_0xf611('0x2a')][_0xf611('0x48')](_0x2ddbda,{'transaction':_0x3824dd});});})[_0xf611('0x26')](function(){return db[_0xf611('0x2a')][_0xf611('0x4f')]({'where':{'CustomReportId':_0x4e8248['params']['id']}});});}})[_0xf611('0x26')](respondWithResult(_0xd09559,null))[_0xf611('0x40')](handleError(_0xd09559,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 7a56011..b893fbe 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 _0x1c25=['analytics_report_fields','lodash','util','../../config/logger','moment','bluebird','rimraf','define','AnalyticFieldReport'];(function(_0x2a979e,_0x4ee2d3){var _0x42a5e8=function(_0x1bdf5f){while(--_0x1bdf5f){_0x2a979e['push'](_0x2a979e['shift']());}};_0x42a5e8(++_0x4ee2d3);}(_0x1c25,0x1ba));var _0x51c2=function(_0x4911ee,_0x171d2f){_0x4911ee=_0x4911ee-0x0;var _0x17d1e3=_0x1c25[_0x4911ee];return _0x17d1e3;};'use strict';var _=require(_0x51c2('0x0'));var util=require(_0x51c2('0x1'));var logger=require(_0x51c2('0x2'))('api');var moment=require(_0x51c2('0x3'));var BPromise=require(_0x51c2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x51c2('0x5'));var config=require('../../config/environment');var attributes=require('./analyticFieldReport.attributes');module['exports']=function(_0x56fafa,_0x22ee9d){return _0x56fafa[_0x51c2('0x6')](_0x51c2('0x7'),attributes,{'tableName':_0x51c2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe497=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','analytics_report_fields','lodash','util','../../config/logger'];(function(_0xb3192b,_0x7d4ca8){var _0x55c461=function(_0x3f280a){while(--_0x3f280a){_0xb3192b['push'](_0xb3192b['shift']());}};_0x55c461(++_0x7d4ca8);}(_0xe497,0x11b));var _0x7e49=function(_0x3d9bc5,_0x3528c5){_0x3d9bc5=_0x3d9bc5-0x0;var _0x26f994=_0xe497[_0x3d9bc5];return _0x26f994;};'use strict';var _=require(_0x7e49('0x0'));var util=require(_0x7e49('0x1'));var logger=require(_0x7e49('0x2'))(_0x7e49('0x3'));var moment=require(_0x7e49('0x4'));var BPromise=require(_0x7e49('0x5'));var rp=require(_0x7e49('0x6'));var fs=require('fs');var path=require(_0x7e49('0x7'));var rimraf=require(_0x7e49('0x8'));var config=require(_0x7e49('0x9'));var attributes=require('./analyticFieldReport.attributes');module[_0x7e49('0xa')]=function(_0x15769e,_0x393dea){return _0x15769e[_0x7e49('0xb')]('AnalyticFieldReport',attributes,{'tableName':_0x7e49('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 4c9b82f..f3879fc 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 _0xa0b9=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','util','moment'];(function(_0x4be06c,_0x229f25){var _0x2a0fb6=function(_0x4dac43){while(--_0x4dac43){_0x4be06c['push'](_0x4be06c['shift']());}};_0x2a0fb6(++_0x229f25);}(_0xa0b9,0x1c5));var _0x9a0b=function(_0x194b80,_0x1eae61){_0x194b80=_0x194b80-0x0;var _0x1158e0=_0xa0b9[_0x194b80];return _0x1158e0;};'use strict';var _=require(_0x9a0b('0x0'));var util=require(_0x9a0b('0x1'));var moment=require(_0x9a0b('0x2'));var BPromise=require(_0x9a0b('0x3'));var rs=require(_0x9a0b('0x4'));var fs=require('fs');var Redis=require(_0x9a0b('0x5'));var db=require(_0x9a0b('0x6'))['db'];var utils=require(_0x9a0b('0x7'));var logger=require('../../config/logger')(_0x9a0b('0x8'));var config=require(_0x9a0b('0x9'));var jayson=require(_0x9a0b('0xa'));var client=jayson['client'][_0x9a0b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x143704,_0x236edf,_0x57a528){return new BPromise(function(_0x2ec052,_0x4e58df){return client[_0x9a0b('0xc')](_0x143704,_0x57a528)[_0x9a0b('0xd')](function(_0x1567d3){logger[_0x9a0b('0xe')](_0x9a0b('0xf'),_0x236edf,'request\x20sent');logger[_0x9a0b('0x10')](_0x9a0b('0x11'),_0x236edf,'request\x20sent',JSON[_0x9a0b('0x12')](_0x1567d3));if(_0x1567d3[_0x9a0b('0x13')]){if(_0x1567d3[_0x9a0b('0x13')]['code']===0x1f4){logger[_0x9a0b('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x236edf,_0x1567d3['error'][_0x9a0b('0x14')]);return _0x4e58df(_0x1567d3['error'][_0x9a0b('0x14')]);}logger[_0x9a0b('0x13')](_0x9a0b('0xf'),_0x236edf,_0x1567d3[_0x9a0b('0x13')][_0x9a0b('0x14')]);return _0x2ec052(_0x1567d3[_0x9a0b('0x13')][_0x9a0b('0x14')]);}else{logger[_0x9a0b('0xe')](_0x9a0b('0xf'),_0x236edf,_0x9a0b('0x15'));_0x2ec052(_0x1567d3[_0x9a0b('0x16')][_0x9a0b('0x14')]);}})[_0x9a0b('0x17')](function(_0x27acfc){logger[_0x9a0b('0x13')](_0x9a0b('0xf'),_0x236edf,_0x27acfc);_0x4e58df(_0x27acfc);});});} \ No newline at end of file +var _0xf468=['request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','message','info','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4081fb,_0x25601b){var _0xc8f9f3=function(_0x14fdf2){while(--_0x14fdf2){_0x4081fb['push'](_0x4081fb['shift']());}};_0xc8f9f3(++_0x25601b);}(_0xf468,0x1d6));var _0x8f46=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xf468[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x8f46('0x0'));var util=require('util');var moment=require(_0x8f46('0x1'));var BPromise=require(_0x8f46('0x2'));var rs=require(_0x8f46('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f46('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8f46('0x5'))(_0x8f46('0x6'));var config=require(_0x8f46('0x7'));var jayson=require(_0x8f46('0x8'));var client=jayson[_0x8f46('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38b3c6,_0x9f2be2,_0x587f21){return new BPromise(function(_0x2ec247,_0xb3d084){return client[_0x8f46('0xa')](_0x38b3c6,_0x587f21)[_0x8f46('0xb')](function(_0x56577c){logger['info'](_0x8f46('0xc'),_0x9f2be2,_0x8f46('0xd'));logger[_0x8f46('0xe')](_0x8f46('0xf'),_0x9f2be2,_0x8f46('0xd'),JSON['stringify'](_0x56577c));if(_0x56577c[_0x8f46('0x10')]){if(_0x56577c['error']['code']===0x1f4){logger['error'](_0x8f46('0xc'),_0x9f2be2,_0x56577c[_0x8f46('0x10')]['message']);return _0xb3d084(_0x56577c[_0x8f46('0x10')][_0x8f46('0x11')]);}logger[_0x8f46('0x10')](_0x8f46('0xc'),_0x9f2be2,_0x56577c[_0x8f46('0x10')][_0x8f46('0x11')]);return _0x2ec247(_0x56577c['error'][_0x8f46('0x11')]);}else{logger[_0x8f46('0x12')](_0x8f46('0xc'),_0x9f2be2,_0x8f46('0xd'));_0x2ec247(_0x56577c['result']['message']);}})[_0x8f46('0x13')](function(_0x2211c4){logger[_0x8f46('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x9f2be2,_0x2211c4);_0xb3d084(_0x2211c4);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index ce6e21a..4b89e1b 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(_0x1282f0,_0x28701b){var _0x423057=function(_0x2c96de){while(--_0x2c96de){_0x1282f0['push'](_0x1282f0['shift']());}};_0x423057(++_0x28701b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file +var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x5e9b5b,_0xffe1fe){var _0x2868a7=function(_0x103ee3){while(--_0x103ee3){_0x5e9b5b['push'](_0x5e9b5b['shift']());}};_0x2868a7(++_0xffe1fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 893da18..29b3ed4 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 _0xc664=['exports','name','STRING','TEXT','sequelize'];(function(_0x29e314,_0x19d592){var _0x4c9fcb=function(_0xcb1c9){while(--_0xcb1c9){_0x29e314['push'](_0x29e314['shift']());}};_0x4c9fcb(++_0x19d592);}(_0xc664,0x90));var _0x4c66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc664[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4c66('0x0'));module[_0x4c66('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4c66('0x2')},'table':{'type':Sequelize[_0x4c66('0x3')]},'metric':{'type':Sequelize[_0x4c66('0x4')]},'description':{'type':Sequelize[_0x4c66('0x3')]}}; \ No newline at end of file +var _0x3d15=['TEXT','exports','STRING'];(function(_0x2ecca9,_0x51463a){var _0x5b5de3=function(_0x523cf7){while(--_0x523cf7){_0x2ecca9['push'](_0x2ecca9['shift']());}};_0x5b5de3(++_0x51463a);}(_0x3d15,0x127));var _0x53d1=function(_0xb15db6,_0x388d94){_0xb15db6=_0xb15db6-0x0;var _0x1db34d=_0x3d15[_0xb15db6];return _0x1db34d;};'use strict';var Sequelize=require('sequelize');module[_0x53d1('0x0')]={'name':{'type':Sequelize[_0x53d1('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x53d1('0x1')]},'metric':{'type':Sequelize[_0x53d1('0x2')]},'description':{'type':Sequelize[_0x53d1('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index c68b4b2..150d6e0 100644 --- a/server/api/analyticMetric/analyticMetric.controller.js +++ b/server/api/analyticMetric/analyticMetric.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','show','params','keys','length','find','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x579cab,_0x242a91){_0x579cab=_0x579cab-0x0;var _0x12e462=_0x1cb9[_0x579cab];return _0x12e462;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=typeof _0x576369['offset']===_0x91cb('0x1c')&&typeof _0x576369[_0x91cb('0x1d')]==='undefined';var _0xc594e3=_0xc3629e[_0x91cb('0x1e')];var _0x1cd34b=_0x347980?0x0:_0x576369[_0x91cb('0x1f')];var _0x5cc1c3=_0x347980?_0xc3629e[_0x91cb('0x1e')]:_0x576369[_0x91cb('0x1f')]+_0x576369['limit'];var _0x123847;if(_0x5cc1c3>=_0xc594e3){_0x5cc1c3=_0xc594e3;_0x123847=0xc8;}else{_0x123847=0xce;}_0x528f73['status'](_0x123847);return _0x528f73['set'](_0x91cb('0x20'),_0x1cd34b+'-'+_0x5cc1c3+'/'+_0xc594e3)[_0x91cb('0x21')](_0xc3629e);}return null;};}function patchUpdates(_0x56e409){return function(_0x51a1d5){try{jsonpatch['apply'](_0x51a1d5,_0x56e409,!![]);}catch(_0x438162){return BPromise[_0x91cb('0x22')](_0x438162);}return _0x51a1d5[_0x91cb('0x23')]();};}function saveUpdates(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')](_0x1dbee2)[_0x91cb('0x25')](function(_0x55fa78){return _0x55fa78;});}return null;};}function removeEntity(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(_0x2447e7){return _0x2447e7[_0x91cb('0x26')]()[_0x91cb('0x25')](function(){var _0x7ad361=_0x2447e7[_0x91cb('0x27')]({'plain':!![]});var _0x423c4f=_0x91cb('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x423c4f,'resourceId':_0x7ad361['id']}})[_0x91cb('0x25')](function(){return _0x2447e7;});})['then'](function(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x318031,_0x5595c5){return function(_0x9b26a6){if(!_0x9b26a6){_0x318031['sendStatus'](0x194);}return _0x9b26a6;};}function handleError(_0x4572f6,_0x308e8c){_0x308e8c=_0x308e8c||0x1f4;return function(_0x3b3ee6){logger[_0x91cb('0x29')](_0x3b3ee6[_0x91cb('0x2a')]);if(_0x3b3ee6['name']){delete _0x3b3ee6[_0x91cb('0x2b')];}_0x4572f6['status'](_0x308e8c)[_0x91cb('0x2c')](_0x3b3ee6);};}exports[_0x91cb('0x2d')]=function(_0x445fe1,_0x4944bd){var _0x775c25={},_0x146e1f={},_0x25bbf9={'count':0x0,'rows':[]};var _0x361e4c=_[_0x91cb('0x2e')](db[_0x91cb('0x2f')][_0x91cb('0x30')],function(_0x3bbde3){return{'name':_0x3bbde3[_0x91cb('0x31')],'type':_0x3bbde3['type'][_0x91cb('0x32')]};});_0x146e1f[_0x91cb('0x33')]=_[_0x91cb('0x2e')](_0x361e4c,_0x91cb('0x2b'));_0x146e1f[_0x91cb('0x34')]=_['keys'](_0x445fe1[_0x91cb('0x34')]);_0x146e1f[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x146e1f[_0x91cb('0x33')],_0x146e1f[_0x91cb('0x34')]);_0x775c25['attributes']=_[_0x91cb('0x36')](_0x146e1f['model'],qs['fields'](_0x445fe1['query'][_0x91cb('0x37')]));_0x775c25['attributes']=_0x775c25[_0x91cb('0x38')]['length']?_0x775c25['attributes']:_0x146e1f[_0x91cb('0x33')];if(!_0x445fe1[_0x91cb('0x34')][_0x91cb('0x39')](_0x91cb('0x3a'))){_0x775c25[_0x91cb('0x1d')]=qs['limit'](_0x445fe1[_0x91cb('0x34')][_0x91cb('0x1d')]);_0x775c25[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x445fe1['query']['offset']);}_0x775c25[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_0x445fe1['query'][_0x91cb('0x3c')]);_0x775c25[_0x91cb('0x3d')]=qs['filters'](_[_0x91cb('0x3e')](_0x445fe1[_0x91cb('0x34')],_0x146e1f['filters']),_0x361e4c);if(_0x445fe1[_0x91cb('0x34')]['filter']){_0x775c25[_0x91cb('0x3d')]=_[_0x91cb('0x3f')](_0x775c25[_0x91cb('0x3d')],{'$or':_[_0x91cb('0x2e')](_0x361e4c,function(_0x51d0ea){if(_0x51d0ea[_0x91cb('0x40')]!=='VIRTUAL'){var _0xa90111={};_0xa90111[_0x51d0ea[_0x91cb('0x2b')]]={'$like':'%'+_0x445fe1['query'][_0x91cb('0x41')]+'%'};return _0xa90111;}})});}_0x775c25=_['merge']({},_0x775c25,_0x445fe1[_0x91cb('0x42')]);var _0x2eac87={'where':_0x775c25[_0x91cb('0x3d')]};return db[_0x91cb('0x2f')]['count'](_0x2eac87)[_0x91cb('0x25')](function(_0x5af0e6){_0x25bbf9[_0x91cb('0x1e')]=_0x5af0e6;if(_0x445fe1[_0x91cb('0x34')][_0x91cb('0x43')]){_0x775c25[_0x91cb('0x44')]=[{'all':!![]}];}return db[_0x91cb('0x2f')][_0x91cb('0x45')](_0x775c25);})[_0x91cb('0x25')](function(_0x3cc4c1){_0x25bbf9['rows']=_0x3cc4c1;return _0x25bbf9;})[_0x91cb('0x25')](respondWithFilteredResult(_0x4944bd,_0x775c25))['catch'](handleError(_0x4944bd,null));};exports[_0x91cb('0x46')]=function(_0x5537a0,_0x335879){var _0x52e82c={'raw':!![],'where':{'id':_0x5537a0[_0x91cb('0x47')]['id']}},_0x138f48={};_0x138f48[_0x91cb('0x33')]=_[_0x91cb('0x48')](db['AnalyticMetric'][_0x91cb('0x30')]);_0x138f48[_0x91cb('0x34')]=_['keys'](_0x5537a0[_0x91cb('0x34')]);_0x138f48[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],_0x138f48[_0x91cb('0x34')]);_0x52e82c[_0x91cb('0x38')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],qs[_0x91cb('0x37')](_0x5537a0['query'][_0x91cb('0x37')]));_0x52e82c[_0x91cb('0x38')]=_0x52e82c[_0x91cb('0x38')][_0x91cb('0x49')]?_0x52e82c[_0x91cb('0x38')]:_0x138f48[_0x91cb('0x33')];if(_0x5537a0[_0x91cb('0x34')][_0x91cb('0x43')]){_0x52e82c['include']=[{'all':!![]}];}_0x52e82c=_[_0x91cb('0x3f')]({},_0x52e82c,_0x5537a0[_0x91cb('0x42')]);return db[_0x91cb('0x2f')][_0x91cb('0x4a')](_0x52e82c)['then'](handleEntityNotFound(_0x335879,null))[_0x91cb('0x25')](respondWithResult(_0x335879,null))[_0x91cb('0x4b')](handleError(_0x335879,null));};exports['create']=function(_0x212473,_0x47cdb7){return db[_0x91cb('0x2f')]['create'](_0x212473['body'],{})['then'](function(_0x98245b){var _0xff3d11=_0x212473[_0x91cb('0x4c')][_0x91cb('0x27')]({'plain':!![]});if(!_0xff3d11)throw new Error(_0x91cb('0x4d'));if(_0xff3d11['role']==='user'){var _0x1d26b8=_0x98245b[_0x91cb('0x27')]({'plain':!![]});var _0x140994=_0x91cb('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x140994,'userProfileId':_0xff3d11['userProfileId']},'raw':!![]})[_0x91cb('0x25')](function(_0x490417){if(_0x490417&&_0x490417[_0x91cb('0x4e')]===0x0){return db['UserProfileResource'][_0x91cb('0x4f')]({'name':_0x1d26b8[_0x91cb('0x2b')],'resourceId':_0x1d26b8['id'],'type':_0x490417[_0x91cb('0x2b')],'sectionId':_0x490417['id']},{})[_0x91cb('0x25')](function(){return _0x98245b;});}else{return _0x98245b;}})[_0x91cb('0x4b')](function(_0x362532){logger[_0x91cb('0x29')](_0x91cb('0x50'),_0x362532);throw _0x362532;});}return _0x98245b;})[_0x91cb('0x25')](respondWithResult(_0x47cdb7,0xc9))[_0x91cb('0x4b')](handleError(_0x47cdb7,null));};exports[_0x91cb('0x24')]=function(_0x5752ed,_0x1e445a){if(_0x5752ed[_0x91cb('0x51')]['id']){delete _0x5752ed['body']['id'];}return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x5752ed['params']['id']}})[_0x91cb('0x25')](handleEntityNotFound(_0x1e445a,null))[_0x91cb('0x25')](saveUpdates(_0x5752ed[_0x91cb('0x51')],null))[_0x91cb('0x25')](respondWithResult(_0x1e445a,null))[_0x91cb('0x4b')](handleError(_0x1e445a,null));};exports[_0x91cb('0x26')]=function(_0x1d4b96,_0x274fff){return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x1d4b96[_0x91cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x274fff,null))[_0x91cb('0x25')](removeEntity(_0x274fff,null))['catch'](handleError(_0x274fff,null));}; \ No newline at end of file +var _0x8ef6=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','map','fieldName','key','model','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','AnalyticMetric','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x5c9e06,_0x11a35b){var _0x38ea14=function(_0x100a70){while(--_0x100a70){_0x5c9e06['push'](_0x5c9e06['shift']());}};_0x38ea14(++_0x11a35b);}(_0x8ef6,0xf2));var _0x68ef=function(_0x53a0f3,_0x9cd4b0){_0x53a0f3=_0x53a0f3-0x0;var _0xb18f83=_0x8ef6[_0x53a0f3];return _0xb18f83;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xcc;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0x1b')](_0x454ef4);}return _0x1e117a['status'](_0x454ef4)[_0x68ef('0x1c')]();};}function respondWithResult(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0xc8;return function(_0x47fbb5){if(_0x47fbb5){return _0xc50cce[_0x68ef('0x1d')](_0x2657c5)[_0x68ef('0x1e')](_0x47fbb5);}};}function respondWithFilteredResult(_0x24682d,_0x5005ba){return function(_0x35493d){if(_0x35493d){var _0x37c4cc=typeof _0x5005ba[_0x68ef('0x1f')]===_0x68ef('0x20')&&typeof _0x5005ba['limit']===_0x68ef('0x20');var _0x54139e=_0x35493d['count'];var _0x2633c1=_0x37c4cc?0x0:_0x5005ba[_0x68ef('0x1f')];var _0x4ade0d=_0x37c4cc?_0x35493d['count']:_0x5005ba[_0x68ef('0x1f')]+_0x5005ba[_0x68ef('0x21')];var _0x318514;if(_0x4ade0d>=_0x54139e){_0x4ade0d=_0x54139e;_0x318514=0xc8;}else{_0x318514=0xce;}_0x24682d['status'](_0x318514);return _0x24682d[_0x68ef('0x22')](_0x68ef('0x23'),_0x2633c1+'-'+_0x4ade0d+'/'+_0x54139e)[_0x68ef('0x1e')](_0x35493d);}return null;};}function patchUpdates(_0x5b246b){return function(_0x3c46d4){try{jsonpatch[_0x68ef('0x24')](_0x3c46d4,_0x5b246b,!![]);}catch(_0x5af19f){return BPromise[_0x68ef('0x25')](_0x5af19f);}return _0x3c46d4[_0x68ef('0x26')]();};}function saveUpdates(_0x19aa3d,_0x5ddec7){return function(_0x59723c){if(_0x59723c){return _0x59723c['update'](_0x19aa3d)[_0x68ef('0x27')](function(_0x2023f2){return _0x2023f2;});}return null;};}function removeEntity(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(_0x438b4c){return _0x438b4c[_0x68ef('0x28')]()[_0x68ef('0x27')](function(){var _0x49374f=_0x438b4c[_0x68ef('0x29')]({'plain':!![]});var _0x13280b='Metrics';return db[_0x68ef('0x2a')]['destroy']({'where':{'type':_0x13280b,'resourceId':_0x49374f['id']}})['then'](function(){return _0x438b4c;});})['then'](function(){_0x312cc9[_0x68ef('0x1d')](0xcc)[_0x68ef('0x1c')]();});}};}function handleEntityNotFound(_0x123041,_0x29518e){return function(_0x52e67e){if(!_0x52e67e){_0x123041['sendStatus'](0x194);}return _0x52e67e;};}function handleError(_0x1cbe4f,_0x28907a){_0x28907a=_0x28907a||0x1f4;return function(_0x7bf96){logger[_0x68ef('0x2b')](_0x7bf96[_0x68ef('0x2c')]);if(_0x7bf96[_0x68ef('0x2d')]){delete _0x7bf96[_0x68ef('0x2d')];}_0x1cbe4f[_0x68ef('0x1d')](_0x28907a)['send'](_0x7bf96);};}exports[_0x68ef('0x2e')]=function(_0x4314bd,_0x132d9e){var _0x4c25aa={},_0x370a8f={},_0x523120={'count':0x0,'rows':[]};var _0x133788=_[_0x68ef('0x2f')](db['AnalyticMetric']['rawAttributes'],function(_0x159395){return{'name':_0x159395[_0x68ef('0x30')],'type':_0x159395['type'][_0x68ef('0x31')]};});_0x370a8f[_0x68ef('0x32')]=_[_0x68ef('0x2f')](_0x133788,_0x68ef('0x2d'));_0x370a8f['query']=_[_0x68ef('0x33')](_0x4314bd[_0x68ef('0x34')]);_0x370a8f['filters']=_[_0x68ef('0x35')](_0x370a8f['model'],_0x370a8f[_0x68ef('0x34')]);_0x4c25aa[_0x68ef('0x36')]=_['intersection'](_0x370a8f[_0x68ef('0x32')],qs['fields'](_0x4314bd[_0x68ef('0x34')]['fields']));_0x4c25aa[_0x68ef('0x36')]=_0x4c25aa[_0x68ef('0x36')][_0x68ef('0x37')]?_0x4c25aa['attributes']:_0x370a8f[_0x68ef('0x32')];if(!_0x4314bd['query'][_0x68ef('0x38')]('nolimit')){_0x4c25aa[_0x68ef('0x21')]=qs[_0x68ef('0x21')](_0x4314bd[_0x68ef('0x34')][_0x68ef('0x21')]);_0x4c25aa[_0x68ef('0x1f')]=qs[_0x68ef('0x1f')](_0x4314bd['query'][_0x68ef('0x1f')]);}_0x4c25aa[_0x68ef('0x39')]=qs[_0x68ef('0x3a')](_0x4314bd['query'][_0x68ef('0x3a')]);_0x4c25aa[_0x68ef('0x3b')]=qs[_0x68ef('0x3c')](_['pick'](_0x4314bd['query'],_0x370a8f[_0x68ef('0x3c')]),_0x133788);if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x3d')]){_0x4c25aa[_0x68ef('0x3b')]=_[_0x68ef('0x3e')](_0x4c25aa[_0x68ef('0x3b')],{'$or':_[_0x68ef('0x2f')](_0x133788,function(_0x5b1246){if(_0x5b1246[_0x68ef('0x3f')]!==_0x68ef('0x40')){var _0x2f6ee0={};_0x2f6ee0[_0x5b1246[_0x68ef('0x2d')]]={'$like':'%'+_0x4314bd['query'][_0x68ef('0x3d')]+'%'};return _0x2f6ee0;}})});}_0x4c25aa=_[_0x68ef('0x3e')]({},_0x4c25aa,_0x4314bd[_0x68ef('0x41')]);var _0x410c10={'where':_0x4c25aa[_0x68ef('0x3b')]};return db[_0x68ef('0x42')]['count'](_0x410c10)[_0x68ef('0x27')](function(_0x3f7699){_0x523120[_0x68ef('0x43')]=_0x3f7699;if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x44')]){_0x4c25aa[_0x68ef('0x45')]=[{'all':!![]}];}return db[_0x68ef('0x42')][_0x68ef('0x46')](_0x4c25aa);})[_0x68ef('0x27')](function(_0x531096){_0x523120[_0x68ef('0x47')]=_0x531096;return _0x523120;})[_0x68ef('0x27')](respondWithFilteredResult(_0x132d9e,_0x4c25aa))[_0x68ef('0x48')](handleError(_0x132d9e,null));};exports[_0x68ef('0x49')]=function(_0xdeacf2,_0x183377){var _0xcac58f={'raw':!![],'where':{'id':_0xdeacf2[_0x68ef('0x4a')]['id']}},_0x576767={};_0x576767['model']=_[_0x68ef('0x33')](db[_0x68ef('0x42')][_0x68ef('0x4b')]);_0x576767[_0x68ef('0x34')]=_['keys'](_0xdeacf2[_0x68ef('0x34')]);_0x576767['filters']=_[_0x68ef('0x35')](_0x576767['model'],_0x576767[_0x68ef('0x34')]);_0xcac58f[_0x68ef('0x36')]=_[_0x68ef('0x35')](_0x576767['model'],qs['fields'](_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x4c')]));_0xcac58f['attributes']=_0xcac58f['attributes']['length']?_0xcac58f[_0x68ef('0x36')]:_0x576767[_0x68ef('0x32')];if(_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x44')]){_0xcac58f[_0x68ef('0x45')]=[{'all':!![]}];}_0xcac58f=_['merge']({},_0xcac58f,_0xdeacf2['options']);return db[_0x68ef('0x42')][_0x68ef('0x4d')](_0xcac58f)[_0x68ef('0x27')](handleEntityNotFound(_0x183377,null))[_0x68ef('0x27')](respondWithResult(_0x183377,null))['catch'](handleError(_0x183377,null));};exports[_0x68ef('0x4e')]=function(_0x474e5a,_0x1c9b6f){return db[_0x68ef('0x42')]['create'](_0x474e5a['body'],{})[_0x68ef('0x27')](function(_0x3c3074){var _0x566e7c=_0x474e5a[_0x68ef('0x4f')][_0x68ef('0x29')]({'plain':!![]});if(!_0x566e7c)throw new Error(_0x68ef('0x50'));if(_0x566e7c[_0x68ef('0x51')]===_0x68ef('0x4f')){var _0x4f0f77=_0x3c3074[_0x68ef('0x29')]({'plain':!![]});var _0x3984ca=_0x68ef('0x52');return db['UserProfileSection'][_0x68ef('0x4d')]({'where':{'name':_0x3984ca,'userProfileId':_0x566e7c[_0x68ef('0x53')]},'raw':!![]})[_0x68ef('0x27')](function(_0x50ef1f){if(_0x50ef1f&&_0x50ef1f[_0x68ef('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x4f0f77[_0x68ef('0x2d')],'resourceId':_0x4f0f77['id'],'type':_0x50ef1f['name'],'sectionId':_0x50ef1f['id']},{})[_0x68ef('0x27')](function(){return _0x3c3074;});}else{return _0x3c3074;}})[_0x68ef('0x48')](function(_0x53ebd){logger[_0x68ef('0x2b')](_0x68ef('0x55'),_0x53ebd);throw _0x53ebd;});}return _0x3c3074;})[_0x68ef('0x27')](respondWithResult(_0x1c9b6f,0xc9))[_0x68ef('0x48')](handleError(_0x1c9b6f,null));};exports[_0x68ef('0x56')]=function(_0x2b35f4,_0x247915){if(_0x2b35f4['body']['id']){delete _0x2b35f4['body']['id'];}return db[_0x68ef('0x42')][_0x68ef('0x4d')]({'where':{'id':_0x2b35f4[_0x68ef('0x4a')]['id']}})[_0x68ef('0x27')](handleEntityNotFound(_0x247915,null))[_0x68ef('0x27')](saveUpdates(_0x2b35f4[_0x68ef('0x57')],null))[_0x68ef('0x27')](respondWithResult(_0x247915,null))[_0x68ef('0x48')](handleError(_0x247915,null));};exports[_0x68ef('0x28')]=function(_0x4c2e9c,_0x5685bb){return db[_0x68ef('0x42')]['find']({'where':{'id':_0x4c2e9c[_0x68ef('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5685bb,null))[_0x68ef('0x27')](removeEntity(_0x5685bb,null))[_0x68ef('0x48')](handleError(_0x5685bb,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 7c9ef63..2c30a0c 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 _0x9fc5=['define','AnalyticMetric','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports'];(function(_0x175013,_0x2dac67){var _0x17e48=function(_0x16401c){while(--_0x16401c){_0x175013['push'](_0x175013['shift']());}};_0x17e48(++_0x2dac67);}(_0x9fc5,0xb6));var _0x59fc=function(_0x4178af,_0x388652){_0x4178af=_0x4178af-0x0;var _0x20f4b1=_0x9fc5[_0x4178af];return _0x20f4b1;};'use strict';var _=require('lodash');var util=require(_0x59fc('0x0'));var logger=require(_0x59fc('0x1'))('api');var moment=require(_0x59fc('0x2'));var BPromise=require(_0x59fc('0x3'));var rp=require(_0x59fc('0x4'));var fs=require('fs');var path=require(_0x59fc('0x5'));var rimraf=require(_0x59fc('0x6'));var config=require(_0x59fc('0x7'));var attributes=require(_0x59fc('0x8'));module[_0x59fc('0x9')]=function(_0x4cb94d,_0x3bde0b){return _0x4cb94d[_0x59fc('0xa')](_0x59fc('0xb'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8098=['define','analytics_metrics','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticMetric.attributes','exports'];(function(_0xae01dd,_0xbd8a3c){var _0x8c26df=function(_0x359827){while(--_0x359827){_0xae01dd['push'](_0xae01dd['shift']());}};_0x8c26df(++_0xbd8a3c);}(_0x8098,0x1ba));var _0x8809=function(_0x30f89f,_0x5a5a6a){_0x30f89f=_0x30f89f-0x0;var _0x27cb7e=_0x8098[_0x30f89f];return _0x27cb7e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8809('0x0'))(_0x8809('0x1'));var moment=require(_0x8809('0x2'));var BPromise=require(_0x8809('0x3'));var rp=require(_0x8809('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8809('0x5'));var config=require(_0x8809('0x6'));var attributes=require(_0x8809('0x7'));module[_0x8809('0x8')]=function(_0x5804f0,_0xeb811){return _0x5804f0[_0x8809('0x9')]('AnalyticMetric',attributes,{'tableName':_0x8809('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 123bab0..3a91651 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 _0x31e9=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x236c13,_0x50cc9f){var _0x35aa66=function(_0x251e3c){while(--_0x251e3c){_0x236c13['push'](_0x236c13['shift']());}};_0x35aa66(++_0x50cc9f);}(_0x31e9,0xfc));var _0x931e=function(_0x547d41,_0xd7369){_0x547d41=_0x547d41-0x0;var _0x766cec=_0x31e9[_0x547d41];return _0x766cec;};'use strict';var _=require(_0x931e('0x0'));var util=require(_0x931e('0x1'));var moment=require(_0x931e('0x2'));var BPromise=require(_0x931e('0x3'));var rs=require(_0x931e('0x4'));var fs=require('fs');var Redis=require(_0x931e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x931e('0x6'))(_0x931e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x931e('0x8')][_0x931e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1661c4,_0x56ed3f,_0x3dc9b9){return new BPromise(function(_0x3cd4c4,_0x1daddb){return client[_0x931e('0xa')](_0x1661c4,_0x3dc9b9)[_0x931e('0xb')](function(_0x71e4b1){logger[_0x931e('0xc')](_0x931e('0xd'),_0x56ed3f,_0x931e('0xe'));logger[_0x931e('0xf')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x56ed3f,'request\x20sent',JSON[_0x931e('0x10')](_0x71e4b1));if(_0x71e4b1[_0x931e('0x11')]){if(_0x71e4b1['error'][_0x931e('0x12')]===0x1f4){logger[_0x931e('0x11')](_0x931e('0xd'),_0x56ed3f,_0x71e4b1['error']['message']);return _0x1daddb(_0x71e4b1[_0x931e('0x11')][_0x931e('0x13')]);}logger[_0x931e('0x11')](_0x931e('0xd'),_0x56ed3f,_0x71e4b1[_0x931e('0x11')]['message']);return _0x3cd4c4(_0x71e4b1[_0x931e('0x11')][_0x931e('0x13')]);}else{logger[_0x931e('0xc')](_0x931e('0xd'),_0x56ed3f,_0x931e('0xe'));_0x3cd4c4(_0x71e4b1[_0x931e('0x14')][_0x931e('0x13')]);}})['catch'](function(_0x43b950){logger[_0x931e('0x11')](_0x931e('0xd'),_0x56ed3f,_0x43b950);_0x1daddb(_0x43b950);});});} \ No newline at end of file +var _0xb9e6=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x539b49,_0x21e9ca){var _0x30a963=function(_0x5d3467){while(--_0x5d3467){_0x539b49['push'](_0x539b49['shift']());}};_0x30a963(++_0x21e9ca);}(_0xb9e6,0x171));var _0x6b9e=function(_0x4572a6,_0x1c596e){_0x4572a6=_0x4572a6-0x0;var _0x18fe48=_0xb9e6[_0x4572a6];return _0x18fe48;};'use strict';var _=require(_0x6b9e('0x0'));var util=require(_0x6b9e('0x1'));var moment=require(_0x6b9e('0x2'));var BPromise=require('bluebird');var rs=require(_0x6b9e('0x3'));var fs=require('fs');var Redis=require(_0x6b9e('0x4'));var db=require(_0x6b9e('0x5'))['db'];var utils=require(_0x6b9e('0x6'));var logger=require(_0x6b9e('0x7'))(_0x6b9e('0x8'));var config=require(_0x6b9e('0x9'));var jayson=require(_0x6b9e('0xa'));var client=jayson[_0x6b9e('0xb')][_0x6b9e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2fb6c3,_0x10cf5d,_0x39aea2){return new BPromise(function(_0xbdd321,_0xf8cac6){return client['request'](_0x2fb6c3,_0x39aea2)[_0x6b9e('0xd')](function(_0x37d9af){logger['info'](_0x6b9e('0xe'),_0x10cf5d,_0x6b9e('0xf'));logger[_0x6b9e('0x10')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x10cf5d,_0x6b9e('0xf'),JSON[_0x6b9e('0x11')](_0x37d9af));if(_0x37d9af['error']){if(_0x37d9af[_0x6b9e('0x12')][_0x6b9e('0x13')]===0x1f4){logger[_0x6b9e('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x10cf5d,_0x37d9af[_0x6b9e('0x12')]['message']);return _0xf8cac6(_0x37d9af[_0x6b9e('0x12')][_0x6b9e('0x14')]);}logger[_0x6b9e('0x12')](_0x6b9e('0xe'),_0x10cf5d,_0x37d9af[_0x6b9e('0x12')][_0x6b9e('0x14')]);return _0xbdd321(_0x37d9af['error'][_0x6b9e('0x14')]);}else{logger[_0x6b9e('0x15')](_0x6b9e('0xe'),_0x10cf5d,_0x6b9e('0xf'));_0xbdd321(_0x37d9af[_0x6b9e('0x16')]['message']);}})['catch'](function(_0xfa5d4e){logger[_0x6b9e('0x12')](_0x6b9e('0xe'),_0x10cf5d,_0xfa5d4e);_0xf8cac6(_0xfa5d4e);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 46a8af8..79cb169 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 _0x7fd6=['destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','put','update','delete'];(function(_0x238bae,_0x4100fd){var _0xe4e60d=function(_0x3d372a){while(--_0x3d372a){_0x238bae['push'](_0x238bae['shift']());}};_0xe4e60d(++_0x4100fd);}(_0x7fd6,0x157));var _0x67fd=function(_0x441990,_0x27be4d){_0x441990=_0x441990-0x0;var _0x514bf1=_0x7fd6[_0x441990];return _0x514bf1;};'use strict';var multer=require(_0x67fd('0x0'));var util=require('util');var path=require(_0x67fd('0x1'));var timeout=require(_0x67fd('0x2'));var express=require(_0x67fd('0x3'));var router=express[_0x67fd('0x4')]();var fs_extra=require(_0x67fd('0x5'));var auth=require(_0x67fd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x67fd('0x7'));var controller=require('./analyticMetric.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x67fd('0x8')](_0x67fd('0x9'),auth[_0x67fd('0xa')](),controller[_0x67fd('0xb')]);router[_0x67fd('0xc')]('/',auth[_0x67fd('0xa')](),controller[_0x67fd('0xd')]);router[_0x67fd('0xe')]('/:id',auth[_0x67fd('0xa')](),controller[_0x67fd('0xf')]);router[_0x67fd('0x10')](_0x67fd('0x9'),auth[_0x67fd('0xa')](),controller[_0x67fd('0x11')]);module['exports']=router; \ No newline at end of file +var _0x52ad=['index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated'];(function(_0x2dee03,_0xaa15f4){var _0x59e9a1=function(_0x59e004){while(--_0x59e004){_0x2dee03['push'](_0x2dee03['shift']());}};_0x59e9a1(++_0xaa15f4);}(_0x52ad,0x1d8));var _0xd52a=function(_0x37186b,_0x4304da){_0x37186b=_0x37186b-0x0;var _0x10660c=_0x52ad[_0x37186b];return _0x10660c;};'use strict';var multer=require(_0xd52a('0x0'));var util=require(_0xd52a('0x1'));var path=require(_0xd52a('0x2'));var timeout=require(_0xd52a('0x3'));var express=require('express');var router=express[_0xd52a('0x4')]();var fs_extra=require(_0xd52a('0x5'));var auth=require(_0xd52a('0x6'));var interaction=require(_0xd52a('0x7'));var config=require(_0xd52a('0x8'));var controller=require(_0xd52a('0x9'));router[_0xd52a('0xa')]('/',auth[_0xd52a('0xb')](),controller[_0xd52a('0xc')]);router['get'](_0xd52a('0xd'),auth[_0xd52a('0xb')](),controller[_0xd52a('0xe')]);router[_0xd52a('0xf')]('/',auth['isAuthenticated'](),controller[_0xd52a('0x10')]);router[_0xd52a('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd52a('0x12')]);router[_0xd52a('0x13')](_0xd52a('0xd'),auth[_0xd52a('0xb')](),controller[_0xd52a('0x14')]);module[_0xd52a('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 2f3dd2d..8b97daf 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 _0x45b6=['sequelize','exports','TEXT'];(function(_0x402569,_0x35ff32){var _0x5bb1e4=function(_0x40fd6b){while(--_0x40fd6b){_0x402569['push'](_0x402569['shift']());}};_0x5bb1e4(++_0x35ff32);}(_0x45b6,0xf3));var _0x645b=function(_0x22d020,_0x23beb9){_0x22d020=_0x22d020-0x0;var _0x403305=_0x45b6[_0x22d020];return _0x403305;};'use strict';var Sequelize=require(_0x645b('0x0'));module[_0x645b('0x1')]={'tree':{'type':Sequelize[_0x645b('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5080=['TEXT'];(function(_0x56490e,_0x1f9ece){var _0x5dd04c=function(_0x1c9249){while(--_0x1c9249){_0x56490e['push'](_0x56490e['shift']());}};_0x5dd04c(++_0x1f9ece);}(_0x5080,0x12d));var _0x0508=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5080[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize[_0x0508('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index aafe671..c33370b 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 _0xfa59=['count','set','Content-Range','json','apply','reject','save','destroy','then','error','stack','name','send','rawAttributes','fieldName','type','key','map','query','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','AnalyticTreeReport','includeAll','include','findAll','rows','catch','show','params','keys','intersection','options','find','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined'];(function(_0x5ca3cb,_0x2cc500){var _0x26862b=function(_0x43216c){while(--_0x43216c){_0x5ca3cb['push'](_0x5ca3cb['shift']());}};_0x26862b(++_0x2cc500);}(_0xfa59,0x173));var _0x9fa5=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xfa59[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9fa5('0x0'));var zipdir=require(_0x9fa5('0x1'));var jsonpatch=require(_0x9fa5('0x2'));var rp=require(_0x9fa5('0x3'));var moment=require(_0x9fa5('0x4'));var BPromise=require(_0x9fa5('0x5'));var Mustache=require(_0x9fa5('0x6'));var util=require(_0x9fa5('0x7'));var path=require(_0x9fa5('0x8'));var sox=require('sox');var csv=require(_0x9fa5('0x9'));var ejs=require(_0x9fa5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9fa5('0xb'));var crypto=require(_0x9fa5('0xc'));var jsforce=require(_0x9fa5('0xd'));var deskjs=require(_0x9fa5('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9fa5('0xf'));var Papa=require(_0x9fa5('0x10'));var Redis=require(_0x9fa5('0x11'));var authService=require(_0x9fa5('0x12'));var qs=require(_0x9fa5('0x13'));var as=require(_0x9fa5('0x14'));var hardwareService=require(_0x9fa5('0x15'));var logger=require(_0x9fa5('0x16'))(_0x9fa5('0x17'));var utils=require(_0x9fa5('0x18'));var config=require(_0x9fa5('0x19'));var licenseUtil=require(_0x9fa5('0x1a'));var db=require(_0x9fa5('0x1b'))['db'];function respondWithStatusCode(_0x4b454b,_0x138b92){_0x138b92=_0x138b92||0xcc;return function(_0x160df2){if(_0x160df2){return _0x4b454b[_0x9fa5('0x1c')](_0x138b92);}return _0x4b454b[_0x9fa5('0x1d')](_0x138b92)[_0x9fa5('0x1e')]();};}function respondWithResult(_0xf8495b,_0x403b06){_0x403b06=_0x403b06||0xc8;return function(_0x51afab){if(_0x51afab){return _0xf8495b[_0x9fa5('0x1d')](_0x403b06)['json'](_0x51afab);}};}function respondWithFilteredResult(_0x31669f,_0x3d923a){return function(_0x4869a1){if(_0x4869a1){var _0x14a243=typeof _0x3d923a[_0x9fa5('0x1f')]==='undefined'&&typeof _0x3d923a[_0x9fa5('0x20')]===_0x9fa5('0x21');var _0x58ff4d=_0x4869a1[_0x9fa5('0x22')];var _0x56e1b1=_0x14a243?0x0:_0x3d923a[_0x9fa5('0x1f')];var _0x386e8e=_0x14a243?_0x4869a1[_0x9fa5('0x22')]:_0x3d923a[_0x9fa5('0x1f')]+_0x3d923a[_0x9fa5('0x20')];var _0x29eed6;if(_0x386e8e>=_0x58ff4d){_0x386e8e=_0x58ff4d;_0x29eed6=0xc8;}else{_0x29eed6=0xce;}_0x31669f[_0x9fa5('0x1d')](_0x29eed6);return _0x31669f[_0x9fa5('0x23')](_0x9fa5('0x24'),_0x56e1b1+'-'+_0x386e8e+'/'+_0x58ff4d)[_0x9fa5('0x25')](_0x4869a1);}return null;};}function patchUpdates(_0x3ef68d){return function(_0x5bfb13){try{jsonpatch[_0x9fa5('0x26')](_0x5bfb13,_0x3ef68d,!![]);}catch(_0x434018){return BPromise[_0x9fa5('0x27')](_0x434018);}return _0x5bfb13[_0x9fa5('0x28')]();};}function saveUpdates(_0x5e48ff,_0x202c09){return function(_0x3cd440){if(_0x3cd440){return _0x3cd440['update'](_0x5e48ff)['then'](function(_0x2ae537){return _0x2ae537;});}return null;};}function removeEntity(_0x4974c2,_0x41bd72){return function(_0x4de68d){if(_0x4de68d){return _0x4de68d[_0x9fa5('0x29')]()[_0x9fa5('0x2a')](function(){_0x4974c2[_0x9fa5('0x1d')](0xcc)[_0x9fa5('0x1e')]();});}};}function handleEntityNotFound(_0x25b6f4,_0x57a16f){return function(_0x15f2ae){if(!_0x15f2ae){_0x25b6f4[_0x9fa5('0x1c')](0x194);}return _0x15f2ae;};}function handleError(_0x40a674,_0x147b0a){_0x147b0a=_0x147b0a||0x1f4;return function(_0x8a902){logger[_0x9fa5('0x2b')](_0x8a902[_0x9fa5('0x2c')]);if(_0x8a902[_0x9fa5('0x2d')]){delete _0x8a902['name'];}_0x40a674[_0x9fa5('0x1d')](_0x147b0a)[_0x9fa5('0x2e')](_0x8a902);};}exports['index']=function(_0x37f85a,_0x1ad359){var _0x5bb521={},_0x56cc89={},_0x69d10a={'count':0x0,'rows':[]};var _0x526c0a=_['map'](db['AnalyticTreeReport'][_0x9fa5('0x2f')],function(_0x149073){return{'name':_0x149073[_0x9fa5('0x30')],'type':_0x149073[_0x9fa5('0x31')][_0x9fa5('0x32')]};});_0x56cc89['model']=_[_0x9fa5('0x33')](_0x526c0a,'name');_0x56cc89[_0x9fa5('0x34')]=_['keys'](_0x37f85a['query']);_0x56cc89['filters']=_['intersection'](_0x56cc89[_0x9fa5('0x35')],_0x56cc89['query']);_0x5bb521[_0x9fa5('0x36')]=_['intersection'](_0x56cc89[_0x9fa5('0x35')],qs[_0x9fa5('0x37')](_0x37f85a[_0x9fa5('0x34')][_0x9fa5('0x37')]));_0x5bb521[_0x9fa5('0x36')]=_0x5bb521[_0x9fa5('0x36')][_0x9fa5('0x38')]?_0x5bb521[_0x9fa5('0x36')]:_0x56cc89[_0x9fa5('0x35')];if(!_0x37f85a['query'][_0x9fa5('0x39')](_0x9fa5('0x3a'))){_0x5bb521[_0x9fa5('0x20')]=qs[_0x9fa5('0x20')](_0x37f85a[_0x9fa5('0x34')][_0x9fa5('0x20')]);_0x5bb521[_0x9fa5('0x1f')]=qs[_0x9fa5('0x1f')](_0x37f85a[_0x9fa5('0x34')][_0x9fa5('0x1f')]);}_0x5bb521[_0x9fa5('0x3b')]=qs['sort'](_0x37f85a[_0x9fa5('0x34')]['sort']);_0x5bb521[_0x9fa5('0x3c')]=qs[_0x9fa5('0x3d')](_[_0x9fa5('0x3e')](_0x37f85a[_0x9fa5('0x34')],_0x56cc89['filters']),_0x526c0a);if(_0x37f85a[_0x9fa5('0x34')][_0x9fa5('0x3f')]){_0x5bb521[_0x9fa5('0x3c')]=_[_0x9fa5('0x40')](_0x5bb521[_0x9fa5('0x3c')],{'$or':_[_0x9fa5('0x33')](_0x526c0a,function(_0x443906){if(_0x443906['type']!==_0x9fa5('0x41')){var _0x1a0f84={};_0x1a0f84[_0x443906[_0x9fa5('0x2d')]]={'$like':'%'+_0x37f85a['query'][_0x9fa5('0x3f')]+'%'};return _0x1a0f84;}})});}_0x5bb521=_[_0x9fa5('0x40')]({},_0x5bb521,_0x37f85a['options']);var _0xa892e0={'where':_0x5bb521[_0x9fa5('0x3c')]};return db[_0x9fa5('0x42')][_0x9fa5('0x22')](_0xa892e0)[_0x9fa5('0x2a')](function(_0x58142f){_0x69d10a[_0x9fa5('0x22')]=_0x58142f;if(_0x37f85a[_0x9fa5('0x34')][_0x9fa5('0x43')]){_0x5bb521[_0x9fa5('0x44')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x9fa5('0x45')](_0x5bb521);})['then'](function(_0x48a8f3){_0x69d10a[_0x9fa5('0x46')]=_0x48a8f3;return _0x69d10a;})['then'](respondWithFilteredResult(_0x1ad359,_0x5bb521))[_0x9fa5('0x47')](handleError(_0x1ad359,null));};exports[_0x9fa5('0x48')]=function(_0x471e28,_0x5ef2db){var _0x1078a6={'raw':!![],'where':{'id':_0x471e28[_0x9fa5('0x49')]['id']}},_0x1a6818={};_0x1a6818['model']=_[_0x9fa5('0x4a')](db['AnalyticTreeReport'][_0x9fa5('0x2f')]);_0x1a6818[_0x9fa5('0x34')]=_['keys'](_0x471e28['query']);_0x1a6818[_0x9fa5('0x3d')]=_[_0x9fa5('0x4b')](_0x1a6818['model'],_0x1a6818[_0x9fa5('0x34')]);_0x1078a6[_0x9fa5('0x36')]=_[_0x9fa5('0x4b')](_0x1a6818[_0x9fa5('0x35')],qs[_0x9fa5('0x37')](_0x471e28[_0x9fa5('0x34')][_0x9fa5('0x37')]));_0x1078a6[_0x9fa5('0x36')]=_0x1078a6['attributes'][_0x9fa5('0x38')]?_0x1078a6[_0x9fa5('0x36')]:_0x1a6818[_0x9fa5('0x35')];if(_0x471e28[_0x9fa5('0x34')]['includeAll']){_0x1078a6['include']=[{'all':!![]}];}_0x1078a6=_[_0x9fa5('0x40')]({},_0x1078a6,_0x471e28[_0x9fa5('0x4c')]);return db[_0x9fa5('0x42')][_0x9fa5('0x4d')](_0x1078a6)[_0x9fa5('0x2a')](handleEntityNotFound(_0x5ef2db,null))[_0x9fa5('0x2a')](respondWithResult(_0x5ef2db,null))[_0x9fa5('0x47')](handleError(_0x5ef2db,null));};exports[_0x9fa5('0x4e')]=function(_0x1e6b71,_0x42d54a){return db[_0x9fa5('0x42')][_0x9fa5('0x4e')](_0x1e6b71[_0x9fa5('0x4f')],{})[_0x9fa5('0x2a')](respondWithResult(_0x42d54a,0xc9))['catch'](handleError(_0x42d54a,null));};exports[_0x9fa5('0x50')]=function(_0xd89736,_0x524b97){if(_0xd89736[_0x9fa5('0x4f')]['id']){delete _0xd89736[_0x9fa5('0x4f')]['id'];}return db['AnalyticTreeReport'][_0x9fa5('0x4d')]({'where':{'id':_0xd89736['params']['id']}})[_0x9fa5('0x2a')](handleEntityNotFound(_0x524b97,null))[_0x9fa5('0x2a')](saveUpdates(_0xd89736[_0x9fa5('0x4f')],null))[_0x9fa5('0x2a')](respondWithResult(_0x524b97,null))[_0x9fa5('0x47')](handleError(_0x524b97,null));};exports[_0x9fa5('0x29')]=function(_0x10f7c3,_0x310c2a){return db[_0x9fa5('0x42')][_0x9fa5('0x4d')]({'where':{'id':_0x10f7c3['params']['id']}})['then'](handleEntityNotFound(_0x310c2a,null))['then'](removeEntity(_0x310c2a,null))['catch'](handleError(_0x310c2a,null));}; \ No newline at end of file +var _0xf3d5=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','end','error','stack','name','send','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','length','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','fields','include','find','create','body','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x1f2b53,_0x270508){var _0x59e2ac=function(_0xc22c84){while(--_0xc22c84){_0x1f2b53['push'](_0x1f2b53['shift']());}};_0x59e2ac(++_0x270508);}(_0xf3d5,0x1c2));var _0x5f3d=function(_0x2fba6f,_0x46cea4){_0x2fba6f=_0x2fba6f-0x0;var _0x4731c9=_0xf3d5[_0x2fba6f];return _0x4731c9;};'use strict';var emlformat=require(_0x5f3d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5f3d('0x1'));var rp=require(_0x5f3d('0x2'));var moment=require(_0x5f3d('0x3'));var BPromise=require(_0x5f3d('0x4'));var Mustache=require(_0x5f3d('0x5'));var util=require(_0x5f3d('0x6'));var path=require(_0x5f3d('0x7'));var sox=require(_0x5f3d('0x8'));var csv=require(_0x5f3d('0x9'));var ejs=require(_0x5f3d('0xa'));var fs=require('fs');var fs_extra=require(_0x5f3d('0xb'));var _=require(_0x5f3d('0xc'));var squel=require(_0x5f3d('0xd'));var crypto=require(_0x5f3d('0xe'));var jsforce=require(_0x5f3d('0xf'));var deskjs=require(_0x5f3d('0x10'));var toCsv=require(_0x5f3d('0x9'));var querystring=require(_0x5f3d('0x11'));var Papa=require(_0x5f3d('0x12'));var Redis=require(_0x5f3d('0x13'));var authService=require(_0x5f3d('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x5f3d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5f3d('0x16'))(_0x5f3d('0x17'));var utils=require('../../config/utils');var config=require(_0x5f3d('0x18'));var licenseUtil=require(_0x5f3d('0x19'));var db=require(_0x5f3d('0x1a'))['db'];function respondWithStatusCode(_0x109ec1,_0x39756d){_0x39756d=_0x39756d||0xcc;return function(_0x2e5443){if(_0x2e5443){return _0x109ec1[_0x5f3d('0x1b')](_0x39756d);}return _0x109ec1[_0x5f3d('0x1c')](_0x39756d)['end']();};}function respondWithResult(_0x5bdeaf,_0x3e0fe5){_0x3e0fe5=_0x3e0fe5||0xc8;return function(_0x236c15){if(_0x236c15){return _0x5bdeaf[_0x5f3d('0x1c')](_0x3e0fe5)['json'](_0x236c15);}};}function respondWithFilteredResult(_0x3b4b0b,_0x35299c){return function(_0x97ad41){if(_0x97ad41){var _0x4ea4e9=typeof _0x35299c[_0x5f3d('0x1d')]===_0x5f3d('0x1e')&&typeof _0x35299c[_0x5f3d('0x1f')]===_0x5f3d('0x1e');var _0x4f89a9=_0x97ad41[_0x5f3d('0x20')];var _0x20960e=_0x4ea4e9?0x0:_0x35299c[_0x5f3d('0x1d')];var _0x344512=_0x4ea4e9?_0x97ad41[_0x5f3d('0x20')]:_0x35299c[_0x5f3d('0x1d')]+_0x35299c[_0x5f3d('0x1f')];var _0x2e508f;if(_0x344512>=_0x4f89a9){_0x344512=_0x4f89a9;_0x2e508f=0xc8;}else{_0x2e508f=0xce;}_0x3b4b0b[_0x5f3d('0x1c')](_0x2e508f);return _0x3b4b0b[_0x5f3d('0x21')](_0x5f3d('0x22'),_0x20960e+'-'+_0x344512+'/'+_0x4f89a9)[_0x5f3d('0x23')](_0x97ad41);}return null;};}function patchUpdates(_0x58e926){return function(_0x56bc08){try{jsonpatch[_0x5f3d('0x24')](_0x56bc08,_0x58e926,!![]);}catch(_0x39a37f){return BPromise['reject'](_0x39a37f);}return _0x56bc08[_0x5f3d('0x25')]();};}function saveUpdates(_0x40206a,_0x2b7a24){return function(_0x435ee4){if(_0x435ee4){return _0x435ee4[_0x5f3d('0x26')](_0x40206a)[_0x5f3d('0x27')](function(_0x1a57e5){return _0x1a57e5;});}return null;};}function removeEntity(_0x475a4e,_0x3dd0e7){return function(_0x4e19e2){if(_0x4e19e2){return _0x4e19e2['destroy']()['then'](function(){_0x475a4e[_0x5f3d('0x1c')](0xcc)[_0x5f3d('0x28')]();});}};}function handleEntityNotFound(_0xd8a088,_0x5bc9a0){return function(_0x2db2ab){if(!_0x2db2ab){_0xd8a088[_0x5f3d('0x1b')](0x194);}return _0x2db2ab;};}function handleError(_0x2cf935,_0x58bdb9){_0x58bdb9=_0x58bdb9||0x1f4;return function(_0x79536e){logger[_0x5f3d('0x29')](_0x79536e[_0x5f3d('0x2a')]);if(_0x79536e[_0x5f3d('0x2b')]){delete _0x79536e[_0x5f3d('0x2b')];}_0x2cf935['status'](_0x58bdb9)[_0x5f3d('0x2c')](_0x79536e);};}exports['index']=function(_0x592d5d,_0x5dc40e){var _0x296c82={},_0x36667f={},_0xb8b0e2={'count':0x0,'rows':[]};var _0x154d89=_[_0x5f3d('0x2d')](db[_0x5f3d('0x2e')][_0x5f3d('0x2f')],function(_0x4d4fc6){return{'name':_0x4d4fc6[_0x5f3d('0x30')],'type':_0x4d4fc6[_0x5f3d('0x31')][_0x5f3d('0x32')]};});_0x36667f[_0x5f3d('0x33')]=_[_0x5f3d('0x2d')](_0x154d89,'name');_0x36667f['query']=_[_0x5f3d('0x34')](_0x592d5d[_0x5f3d('0x35')]);_0x36667f['filters']=_[_0x5f3d('0x36')](_0x36667f['model'],_0x36667f[_0x5f3d('0x35')]);_0x296c82[_0x5f3d('0x37')]=_['intersection'](_0x36667f[_0x5f3d('0x33')],qs['fields'](_0x592d5d[_0x5f3d('0x35')]['fields']));_0x296c82[_0x5f3d('0x37')]=_0x296c82[_0x5f3d('0x37')][_0x5f3d('0x38')]?_0x296c82[_0x5f3d('0x37')]:_0x36667f[_0x5f3d('0x33')];if(!_0x592d5d[_0x5f3d('0x35')]['hasOwnProperty']('nolimit')){_0x296c82[_0x5f3d('0x1f')]=qs['limit'](_0x592d5d[_0x5f3d('0x35')]['limit']);_0x296c82['offset']=qs[_0x5f3d('0x1d')](_0x592d5d[_0x5f3d('0x35')][_0x5f3d('0x1d')]);}_0x296c82[_0x5f3d('0x39')]=qs[_0x5f3d('0x3a')](_0x592d5d[_0x5f3d('0x35')][_0x5f3d('0x3a')]);_0x296c82[_0x5f3d('0x3b')]=qs[_0x5f3d('0x3c')](_[_0x5f3d('0x3d')](_0x592d5d['query'],_0x36667f[_0x5f3d('0x3c')]),_0x154d89);if(_0x592d5d[_0x5f3d('0x35')]['filter']){_0x296c82[_0x5f3d('0x3b')]=_[_0x5f3d('0x3e')](_0x296c82[_0x5f3d('0x3b')],{'$or':_['map'](_0x154d89,function(_0x438ab9){if(_0x438ab9[_0x5f3d('0x31')]!==_0x5f3d('0x3f')){var _0x672218={};_0x672218[_0x438ab9[_0x5f3d('0x2b')]]={'$like':'%'+_0x592d5d[_0x5f3d('0x35')][_0x5f3d('0x40')]+'%'};return _0x672218;}})});}_0x296c82=_[_0x5f3d('0x3e')]({},_0x296c82,_0x592d5d['options']);var _0x52c23e={'where':_0x296c82[_0x5f3d('0x3b')]};return db[_0x5f3d('0x2e')][_0x5f3d('0x20')](_0x52c23e)['then'](function(_0x591af7){_0xb8b0e2['count']=_0x591af7;if(_0x592d5d['query'][_0x5f3d('0x41')]){_0x296c82['include']=[{'all':!![]}];}return db[_0x5f3d('0x2e')][_0x5f3d('0x42')](_0x296c82);})[_0x5f3d('0x27')](function(_0x161c1c){_0xb8b0e2[_0x5f3d('0x43')]=_0x161c1c;return _0xb8b0e2;})[_0x5f3d('0x27')](respondWithFilteredResult(_0x5dc40e,_0x296c82))[_0x5f3d('0x44')](handleError(_0x5dc40e,null));};exports[_0x5f3d('0x45')]=function(_0x4228fb,_0x49f0bd){var _0x1b968a={'raw':!![],'where':{'id':_0x4228fb[_0x5f3d('0x46')]['id']}},_0x3aedb8={};_0x3aedb8[_0x5f3d('0x33')]=_[_0x5f3d('0x34')](db['AnalyticTreeReport'][_0x5f3d('0x2f')]);_0x3aedb8[_0x5f3d('0x35')]=_[_0x5f3d('0x34')](_0x4228fb[_0x5f3d('0x35')]);_0x3aedb8[_0x5f3d('0x3c')]=_['intersection'](_0x3aedb8[_0x5f3d('0x33')],_0x3aedb8[_0x5f3d('0x35')]);_0x1b968a['attributes']=_[_0x5f3d('0x36')](_0x3aedb8[_0x5f3d('0x33')],qs[_0x5f3d('0x47')](_0x4228fb[_0x5f3d('0x35')]['fields']));_0x1b968a[_0x5f3d('0x37')]=_0x1b968a['attributes']['length']?_0x1b968a[_0x5f3d('0x37')]:_0x3aedb8['model'];if(_0x4228fb[_0x5f3d('0x35')][_0x5f3d('0x41')]){_0x1b968a[_0x5f3d('0x48')]=[{'all':!![]}];}_0x1b968a=_[_0x5f3d('0x3e')]({},_0x1b968a,_0x4228fb['options']);return db['AnalyticTreeReport'][_0x5f3d('0x49')](_0x1b968a)['then'](handleEntityNotFound(_0x49f0bd,null))['then'](respondWithResult(_0x49f0bd,null))[_0x5f3d('0x44')](handleError(_0x49f0bd,null));};exports[_0x5f3d('0x4a')]=function(_0x594c52,_0x52c8da){return db[_0x5f3d('0x2e')][_0x5f3d('0x4a')](_0x594c52['body'],{})[_0x5f3d('0x27')](respondWithResult(_0x52c8da,0xc9))[_0x5f3d('0x44')](handleError(_0x52c8da,null));};exports[_0x5f3d('0x26')]=function(_0x1afe00,_0xeb22a5){if(_0x1afe00[_0x5f3d('0x4b')]['id']){delete _0x1afe00[_0x5f3d('0x4b')]['id'];}return db[_0x5f3d('0x2e')][_0x5f3d('0x49')]({'where':{'id':_0x1afe00[_0x5f3d('0x46')]['id']}})[_0x5f3d('0x27')](handleEntityNotFound(_0xeb22a5,null))[_0x5f3d('0x27')](saveUpdates(_0x1afe00['body'],null))[_0x5f3d('0x27')](respondWithResult(_0xeb22a5,null))[_0x5f3d('0x44')](handleError(_0xeb22a5,null));};exports[_0x5f3d('0x4c')]=function(_0x329ae1,_0x502fd4){return db[_0x5f3d('0x2e')][_0x5f3d('0x49')]({'where':{'id':_0x329ae1[_0x5f3d('0x46')]['id']}})[_0x5f3d('0x27')](handleEntityNotFound(_0x502fd4,null))[_0x5f3d('0x27')](removeEntity(_0x502fd4,null))[_0x5f3d('0x44')](handleError(_0x502fd4,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 9161019..9a0e1c9 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 _0x21a8=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','lodash','util'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x21a8,0x140));var _0x821a=function(_0x1d5b13,_0x52c7f7){_0x1d5b13=_0x1d5b13-0x0;var _0x1b41bd=_0x21a8[_0x1d5b13];return _0x1b41bd;};'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(_0x821a('0x9'));var attributes=require(_0x821a('0xa'));module['exports']=function(_0x1eaf94,_0x164afa){return _0x1eaf94[_0x821a('0xb')](_0x821a('0xc'),attributes,{'tableName':_0x821a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96e1=['lodash','util','../../config/logger','api','moment','request-promise','path','define','AnalyticTreeReport','analytics_report_trees'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x96e1,0x14a));var _0x196e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x96e1[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x196e('0x0'));var util=require(_0x196e('0x1'));var logger=require(_0x196e('0x2'))(_0x196e('0x3'));var moment=require(_0x196e('0x4'));var BPromise=require('bluebird');var rp=require(_0x196e('0x5'));var fs=require('fs');var path=require(_0x196e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x1f7eae,_0x1a80bd){return _0x1f7eae[_0x196e('0x7')](_0x196e('0x8'),attributes,{'tableName':_0x196e('0x9'),'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 502c7db..61a7feb 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x4ed33c,_0x438979){var _0x32d5b4=function(_0x87c811){while(--_0x87c811){_0x4ed33c['push'](_0x4ed33c['shift']());}};_0x32d5b4(++_0x438979);}(_0x5f2f,0x73));var _0xf5f2=function(_0x307bf7,_0x315dce){_0x307bf7=_0x307bf7-0x0;var _0x578e59=_0x5f2f[_0x307bf7];return _0x578e59;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x5b7ed9,_0x5146ae){var _0x547d8f=function(_0x183c91){while(--_0x183c91){_0x5b7ed9['push'](_0x5b7ed9['shift']());}};_0x547d8f(++_0x5146ae);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4b85ee,_0x1a9354){_0x4b85ee=_0x4b85ee-0x0;var _0x1cb607=_0x5f2f[_0x4b85ee];return _0x1cb607;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index c958c6a..529982f 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 _0x1040=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','show','post','create','put','/:id','update','delete','exports'];(function(_0x3513df,_0x29ddb7){var _0x3c3c7e=function(_0x241182){while(--_0x241182){_0x3513df['push'](_0x3513df['shift']());}};_0x3c3c7e(++_0x29ddb7);}(_0x1040,0xc6));var _0x0104=function(_0x58b6c7,_0x3bf35e){_0x58b6c7=_0x58b6c7-0x0;var _0x5f50d0=_0x1040[_0x58b6c7];return _0x5f50d0;};'use strict';var multer=require(_0x0104('0x0'));var util=require(_0x0104('0x1'));var path=require(_0x0104('0x2'));var timeout=require(_0x0104('0x3'));var express=require(_0x0104('0x4'));var router=express[_0x0104('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0104('0x6'));var config=require(_0x0104('0x7'));var controller=require('./analyticTreeReport.controller');router['get']('/',auth[_0x0104('0x8')](),controller[_0x0104('0x9')]);router['get']('/:id',auth[_0x0104('0x8')](),controller[_0x0104('0xa')]);router[_0x0104('0xb')]('/',auth['isAuthenticated'](),controller[_0x0104('0xc')]);router[_0x0104('0xd')](_0x0104('0xe'),auth[_0x0104('0x8')](),controller[_0x0104('0xf')]);router[_0x0104('0x10')](_0x0104('0xe'),auth[_0x0104('0x8')](),controller['destroy']);module[_0x0104('0x11')]=router; \ No newline at end of file +var _0xc43c=['exports','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','post','create','update','delete','destroy'];(function(_0x42122b,_0x46740f){var _0x30f519=function(_0xdf78f3){while(--_0xdf78f3){_0x42122b['push'](_0x42122b['shift']());}};_0x30f519(++_0x46740f);}(_0xc43c,0x127));var _0xcc43=function(_0x26692f,_0x4846d1){_0x26692f=_0x26692f-0x0;var _0x4bc0d3=_0xc43c[_0x26692f];return _0x4bc0d3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcc43('0x0'));var router=express[_0xcc43('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcc43('0x2'));var config=require(_0xcc43('0x3'));var controller=require('./analyticTreeReport.controller');router['get']('/',auth[_0xcc43('0x4')](),controller[_0xcc43('0x5')]);router[_0xcc43('0x6')](_0xcc43('0x7'),auth['isAuthenticated'](),controller['show']);router[_0xcc43('0x8')]('/',auth[_0xcc43('0x4')](),controller[_0xcc43('0x9')]);router['put'](_0xcc43('0x7'),auth['isAuthenticated'](),controller[_0xcc43('0xa')]);router[_0xcc43('0xb')](_0xcc43('0x7'),auth[_0xcc43('0x4')](),controller[_0xcc43('0xc')]);module[_0xcc43('0xd')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index c581d1f..414a428 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 _0xe105=['sequelize'];(function(_0x283093,_0x366972){var _0x5778d6=function(_0x48de6f){while(--_0x48de6f){_0x283093['push'](_0x283093['shift']());}};_0x5778d6(++_0x366972);}(_0xe105,0xef));var _0x5e10=function(_0x38685d,_0x3366bd){_0x38685d=_0x38685d-0x0;var _0x578b78=_0xe105[_0x38685d];return _0x578b78;};'use strict';var Sequelize=require(_0x5e10('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa739=['STRING','exports'];(function(_0x2eee46,_0x318a8a){var _0x115471=function(_0x1bcc13){while(--_0x1bcc13){_0x2eee46['push'](_0x2eee46['shift']());}};_0x115471(++_0x318a8a);}(_0xa739,0x1e1));var _0x9a73=function(_0x85a21,_0x4e78b9){_0x85a21=_0x85a21-0x0;var _0x9084c6=_0xa739[_0x85a21];return _0x9084c6;};'use strict';var Sequelize=require('sequelize');module[_0x9a73('0x0')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x9a73('0x1')]},'type':{'type':Sequelize[_0x9a73('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index c759ee8..5abeb0d 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 _0xd269=['keys','find','clone','omit','body','createdAt','updatedAt','create','includeAll','file','basename','filename','download','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params'];(function(_0xb24676,_0x456325){var _0xd982f3=function(_0x420b0b){while(--_0x420b0b){_0xb24676['push'](_0xb24676['shift']());}};_0xd982f3(++_0x456325);}(_0xd269,0x107));var _0x9d26=function(_0x5703c1,_0x2f3f49){_0x5703c1=_0x5703c1-0x0;var _0x5f1fce=_0xd269[_0x5703c1];return _0x5f1fce;};'use strict';var emlformat=require(_0x9d26('0x0'));var rimraf=require(_0x9d26('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9d26('0x2'));var BPromise=require(_0x9d26('0x3'));var Mustache=require(_0x9d26('0x4'));var util=require('util');var path=require(_0x9d26('0x5'));var sox=require(_0x9d26('0x6'));var csv=require(_0x9d26('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d26('0x8'));var squel=require(_0x9d26('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9d26('0xa'));var toCsv=require(_0x9d26('0x7'));var querystring=require('querystring');var Papa=require(_0x9d26('0xb'));var Redis=require(_0x9d26('0xc'));var authService=require(_0x9d26('0xd'));var qs=require(_0x9d26('0xe'));var as=require(_0x9d26('0xf'));var hardwareService=require(_0x9d26('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x9d26('0x11'));var config=require(_0x9d26('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d26('0x13'))['db'];function respondWithStatusCode(_0xbffb17,_0x20749d){_0x20749d=_0x20749d||0xcc;return function(_0x415590){if(_0x415590){return _0xbffb17[_0x9d26('0x14')](_0x20749d);}return _0xbffb17[_0x9d26('0x15')](_0x20749d)[_0x9d26('0x16')]();};}function respondWithResult(_0xafca2a,_0x83656c){_0x83656c=_0x83656c||0xc8;return function(_0x1229dd){if(_0x1229dd){return _0xafca2a[_0x9d26('0x15')](_0x83656c)['json'](_0x1229dd);}};}function respondWithFilteredResult(_0x8c9a8d,_0x2c6b67){return function(_0x2ef08c){if(_0x2ef08c){var _0x5ed44f=typeof _0x2c6b67[_0x9d26('0x17')]==='undefined'&&typeof _0x2c6b67[_0x9d26('0x18')]===_0x9d26('0x19');var _0x90537e=_0x2ef08c[_0x9d26('0x1a')];var _0x16d935=_0x5ed44f?0x0:_0x2c6b67[_0x9d26('0x17')];var _0x508921=_0x5ed44f?_0x2ef08c[_0x9d26('0x1a')]:_0x2c6b67[_0x9d26('0x17')]+_0x2c6b67[_0x9d26('0x18')];var _0x18c956;if(_0x508921>=_0x90537e){_0x508921=_0x90537e;_0x18c956=0xc8;}else{_0x18c956=0xce;}_0x8c9a8d[_0x9d26('0x15')](_0x18c956);return _0x8c9a8d[_0x9d26('0x1b')]('Content-Range',_0x16d935+'-'+_0x508921+'/'+_0x90537e)['json'](_0x2ef08c);}return null;};}function patchUpdates(_0x43b094){return function(_0x4054e1){try{jsonpatch[_0x9d26('0x1c')](_0x4054e1,_0x43b094,!![]);}catch(_0x3443c5){return BPromise[_0x9d26('0x1d')](_0x3443c5);}return _0x4054e1[_0x9d26('0x1e')]();};}function saveUpdates(_0x843f43,_0x152988){return function(_0x5dee53){if(_0x5dee53){return _0x5dee53[_0x9d26('0x1f')](_0x843f43)[_0x9d26('0x20')](function(_0xe2f1ea){return _0xe2f1ea;});}return null;};}function removeEntity(_0x419ff1,_0xf0374b){return function(_0x5cc0fb){if(_0x5cc0fb){return _0x5cc0fb[_0x9d26('0x21')]()[_0x9d26('0x20')](function(){_0x419ff1['status'](0xcc)[_0x9d26('0x16')]();});}};}function handleEntityNotFound(_0x2145a6,_0x5e3567){return function(_0x204bc0){if(!_0x204bc0){_0x2145a6[_0x9d26('0x14')](0x194);}return _0x204bc0;};}function handleError(_0x29609f,_0x423130){_0x423130=_0x423130||0x1f4;return function(_0x1bfc19){logger['error'](_0x1bfc19[_0x9d26('0x22')]);if(_0x1bfc19[_0x9d26('0x23')]){delete _0x1bfc19[_0x9d26('0x23')];}_0x29609f[_0x9d26('0x15')](_0x423130)[_0x9d26('0x24')](_0x1bfc19);};}exports[_0x9d26('0x25')]=function(_0x5444ff,_0x41c2b2){var _0x2096e6={},_0x48004f={},_0x33cfac={'count':0x0,'rows':[]};var _0x506942=_[_0x9d26('0x26')](db[_0x9d26('0x27')][_0x9d26('0x28')],function(_0x6586cd){return{'name':_0x6586cd[_0x9d26('0x29')],'type':_0x6586cd[_0x9d26('0x2a')][_0x9d26('0x2b')]};});_0x48004f[_0x9d26('0x2c')]=_['map'](_0x506942,_0x9d26('0x23'));_0x48004f[_0x9d26('0x2d')]=_['keys'](_0x5444ff[_0x9d26('0x2d')]);_0x48004f['filters']=_[_0x9d26('0x2e')](_0x48004f[_0x9d26('0x2c')],_0x48004f[_0x9d26('0x2d')]);_0x2096e6[_0x9d26('0x2f')]=_[_0x9d26('0x2e')](_0x48004f[_0x9d26('0x2c')],qs[_0x9d26('0x30')](_0x5444ff[_0x9d26('0x2d')][_0x9d26('0x30')]));_0x2096e6[_0x9d26('0x2f')]=_0x2096e6[_0x9d26('0x2f')][_0x9d26('0x31')]?_0x2096e6[_0x9d26('0x2f')]:_0x48004f[_0x9d26('0x2c')];if(!_0x5444ff[_0x9d26('0x2d')][_0x9d26('0x32')]('nolimit')){_0x2096e6[_0x9d26('0x18')]=qs[_0x9d26('0x18')](_0x5444ff[_0x9d26('0x2d')]['limit']);_0x2096e6[_0x9d26('0x17')]=qs[_0x9d26('0x17')](_0x5444ff[_0x9d26('0x2d')][_0x9d26('0x17')]);}_0x2096e6[_0x9d26('0x33')]=qs['sort'](_0x5444ff['query'][_0x9d26('0x34')]);_0x2096e6[_0x9d26('0x35')]=qs[_0x9d26('0x36')](_[_0x9d26('0x37')](_0x5444ff[_0x9d26('0x2d')],_0x48004f[_0x9d26('0x36')]),_0x506942);if(_0x5444ff[_0x9d26('0x2d')][_0x9d26('0x38')]){_0x2096e6[_0x9d26('0x35')]=_[_0x9d26('0x39')](_0x2096e6[_0x9d26('0x35')],{'$or':_[_0x9d26('0x26')](_0x506942,function(_0x4184ad){if(_0x4184ad[_0x9d26('0x2a')]!==_0x9d26('0x3a')){var _0x3301aa={};_0x3301aa[_0x4184ad[_0x9d26('0x23')]]={'$like':'%'+_0x5444ff[_0x9d26('0x2d')][_0x9d26('0x38')]+'%'};return _0x3301aa;}})});}_0x2096e6=_[_0x9d26('0x39')]({},_0x2096e6,_0x5444ff[_0x9d26('0x3b')]);var _0x15ee11={'where':_0x2096e6[_0x9d26('0x35')]};return db[_0x9d26('0x27')][_0x9d26('0x1a')](_0x15ee11)[_0x9d26('0x20')](function(_0x1a8f8c){_0x33cfac[_0x9d26('0x1a')]=_0x1a8f8c;if(_0x5444ff['query']['includeAll']){_0x2096e6[_0x9d26('0x3c')]=[{'all':!![]}];}return db[_0x9d26('0x27')][_0x9d26('0x3d')](_0x2096e6);})[_0x9d26('0x20')](function(_0x75958f){_0x33cfac['rows']=_0x75958f;return _0x33cfac;})[_0x9d26('0x20')](respondWithFilteredResult(_0x41c2b2,_0x2096e6))[_0x9d26('0x3e')](handleError(_0x41c2b2,null));};exports[_0x9d26('0x3f')]=function(_0x5ee437,_0x5cb3f5){var _0x572c21={'raw':!![],'where':{'id':_0x5ee437[_0x9d26('0x40')]['id']}},_0x5ea5c9={};_0x5ea5c9[_0x9d26('0x2c')]=_[_0x9d26('0x41')](db[_0x9d26('0x27')][_0x9d26('0x28')]);_0x5ea5c9['query']=_[_0x9d26('0x41')](_0x5ee437[_0x9d26('0x2d')]);_0x5ea5c9[_0x9d26('0x36')]=_[_0x9d26('0x2e')](_0x5ea5c9['model'],_0x5ea5c9[_0x9d26('0x2d')]);_0x572c21[_0x9d26('0x2f')]=_[_0x9d26('0x2e')](_0x5ea5c9[_0x9d26('0x2c')],qs[_0x9d26('0x30')](_0x5ee437[_0x9d26('0x2d')][_0x9d26('0x30')]));_0x572c21['attributes']=_0x572c21[_0x9d26('0x2f')][_0x9d26('0x31')]?_0x572c21[_0x9d26('0x2f')]:_0x5ea5c9[_0x9d26('0x2c')];if(_0x5ee437[_0x9d26('0x2d')]['includeAll']){_0x572c21['include']=[{'all':!![]}];}_0x572c21=_[_0x9d26('0x39')]({},_0x572c21,_0x5ee437['options']);return db['Attachment'][_0x9d26('0x42')](_0x572c21)['then'](handleEntityNotFound(_0x5cb3f5,null))[_0x9d26('0x20')](respondWithResult(_0x5cb3f5,null))[_0x9d26('0x3e')](handleError(_0x5cb3f5,null));};exports[_0x9d26('0x43')]=function(_0x3dc902,_0x27af59){var _0x24470f={'where':{'id':_0x3dc902[_0x9d26('0x40')]['id']}},_0x11d60c={};_0x11d60c['model']=_[_0x9d26('0x41')](db[_0x9d26('0x27')][_0x9d26('0x28')]);_0x24470f[_0x9d26('0x2f')]=_[_0x9d26('0x2e')](_0x11d60c[_0x9d26('0x2c')],qs[_0x9d26('0x30')](_0x3dc902['query'][_0x9d26('0x30')]));_0x24470f[_0x9d26('0x2f')]=_0x24470f[_0x9d26('0x2f')][_0x9d26('0x31')]?_0x24470f[_0x9d26('0x2f')]:_0x11d60c[_0x9d26('0x2c')];if(_0x3dc902['query']['includeAll']){_0x24470f[_0x9d26('0x3c')]=[{'all':!![]}];}_0x24470f=_[_0x9d26('0x39')]({},_0x24470f,_0x3dc902[_0x9d26('0x3b')]);return db['Attachment']['find'](_0x24470f)[_0x9d26('0x20')](handleEntityNotFound(_0x27af59,null))['then'](function(_0x2d5e6b){if(_0x2d5e6b){var _0x275f38=_0x2d5e6b['get']({'plain':!![]});_0x275f38=qs[_0x9d26('0x44')](_0x275f38,['id','createdAt','updatedAt']);_0x3dc902[_0x9d26('0x45')]=_[_0x9d26('0x44')](_0x3dc902[_0x9d26('0x45')],['id',_0x9d26('0x46'),_0x9d26('0x47')]);return db[_0x9d26('0x27')][_0x9d26('0x48')](_[_0x9d26('0x39')](_0x275f38,_0x3dc902[_0x9d26('0x45')]),{'include':_0x3dc902[_0x9d26('0x2d')][_0x9d26('0x49')]?[{'all':!![]}]:undefined});}})[_0x9d26('0x20')](respondWithResult(_0x27af59,0xc9))[_0x9d26('0x3e')](handleError(_0x27af59,null));};exports['update']=function(_0x2f7d5a,_0x42c370){if(_0x2f7d5a['body']['id']){delete _0x2f7d5a[_0x9d26('0x45')]['id'];}return db['Attachment'][_0x9d26('0x42')]({'where':{'id':_0x2f7d5a[_0x9d26('0x40')]['id']}})[_0x9d26('0x20')](handleEntityNotFound(_0x42c370,null))[_0x9d26('0x20')](saveUpdates(_0x2f7d5a['body'],null))[_0x9d26('0x20')](respondWithResult(_0x42c370,null))['catch'](handleError(_0x42c370,null));};exports[_0x9d26('0x21')]=function(_0x5e0232,_0x55cfbc){return db[_0x9d26('0x27')][_0x9d26('0x42')]({'where':{'id':_0x5e0232[_0x9d26('0x40')]['id']}})[_0x9d26('0x20')](handleEntityNotFound(_0x55cfbc,null))[_0x9d26('0x20')](removeEntity(_0x55cfbc,null))[_0x9d26('0x3e')](handleError(_0x55cfbc,null));};exports[_0x9d26('0x48')]=function(_0xe45bdc,_0x909fd4,_0x3ec8b6){_0xe45bdc[_0x9d26('0x45')][_0x9d26('0x23')]=_0xe45bdc[_0x9d26('0x4a')]['originalname'];_0xe45bdc[_0x9d26('0x45')][_0x9d26('0x4b')]=_0xe45bdc[_0x9d26('0x4a')][_0x9d26('0x4c')];_0xe45bdc['body']['type']=_0xe45bdc['file']['mimetype'];return db[_0x9d26('0x27')][_0x9d26('0x48')](_0xe45bdc['body'])['then'](respondWithResult(_0x909fd4,0xc9))[_0x9d26('0x3e')](handleError(_0x909fd4,null));};exports[_0x9d26('0x4d')]=function(_0x3a0a32,_0x29915f,_0x15cdac){return db[_0x9d26('0x27')]['findOne']({'where':{'id':_0x3a0a32[_0x9d26('0x40')]['id']},'raw':!![]})[_0x9d26('0x20')](handleEntityNotFound(_0x29915f,null))[_0x9d26('0x20')](function(_0x37936a){if(_0x37936a){var _0x15c8fc=_0x37936a['ChatOfflineMessageId']!==null;var _0x4c899a=path[_0x9d26('0x4e')](config[_0x9d26('0x4f')],_0x9d26('0x50'));if(_0x15c8fc){_0x4c899a=path['join'](_0x4c899a,_0x9d26('0x51'));}var _0x517dc7=path[_0x9d26('0x4e')](_0x4c899a,_0x37936a[_0x9d26('0x4b')]);return _0x29915f[_0x9d26('0x4d')](_0x517dc7);}})[_0x9d26('0x3e')](handleError(_0x29915f,null));}; \ No newline at end of file +var _0x3ec0=['basename','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','Attachment','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','params','rawAttributes','clone','find','get','createdAt','omit','body','create','file','originalname','filename','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/'];(function(_0xdf5dd5,_0x3394c1){var _0x127c7e=function(_0x183948){while(--_0x183948){_0xdf5dd5['push'](_0xdf5dd5['shift']());}};_0x127c7e(++_0x3394c1);}(_0x3ec0,0x106));var _0x03ec=function(_0x43934b,_0x543842){_0x43934b=_0x43934b-0x0;var _0x399646=_0x3ec0[_0x43934b];return _0x399646;};'use strict';var emlformat=require(_0x03ec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x03ec('0x1'));var jsonpatch=require(_0x03ec('0x2'));var rp=require(_0x03ec('0x3'));var moment=require(_0x03ec('0x4'));var BPromise=require(_0x03ec('0x5'));var Mustache=require(_0x03ec('0x6'));var util=require(_0x03ec('0x7'));var path=require('path');var sox=require(_0x03ec('0x8'));var csv=require(_0x03ec('0x9'));var ejs=require(_0x03ec('0xa'));var fs=require('fs');var fs_extra=require(_0x03ec('0xb'));var _=require(_0x03ec('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x03ec('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x03ec('0xe'));var Papa=require('papaparse');var Redis=require(_0x03ec('0xf'));var authService=require(_0x03ec('0x10'));var qs=require(_0x03ec('0x11'));var as=require(_0x03ec('0x12'));var hardwareService=require(_0x03ec('0x13'));var logger=require(_0x03ec('0x14'))(_0x03ec('0x15'));var utils=require(_0x03ec('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x03ec('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56e8eb,_0x522755){_0x522755=_0x522755||0xcc;return function(_0x417f26){if(_0x417f26){return _0x56e8eb[_0x03ec('0x18')](_0x522755);}return _0x56e8eb['status'](_0x522755)[_0x03ec('0x19')]();};}function respondWithResult(_0x2a98bd,_0x3ad53a){_0x3ad53a=_0x3ad53a||0xc8;return function(_0x2e1730){if(_0x2e1730){return _0x2a98bd[_0x03ec('0x1a')](_0x3ad53a)[_0x03ec('0x1b')](_0x2e1730);}};}function respondWithFilteredResult(_0x26ac5b,_0xa363b8){return function(_0x1ff47f){if(_0x1ff47f){var _0x160280=typeof _0xa363b8[_0x03ec('0x1c')]===_0x03ec('0x1d')&&typeof _0xa363b8[_0x03ec('0x1e')]===_0x03ec('0x1d');var _0x34720c=_0x1ff47f['count'];var _0x56b226=_0x160280?0x0:_0xa363b8['offset'];var _0x5ca189=_0x160280?_0x1ff47f[_0x03ec('0x1f')]:_0xa363b8[_0x03ec('0x1c')]+_0xa363b8[_0x03ec('0x1e')];var _0xdc84d2;if(_0x5ca189>=_0x34720c){_0x5ca189=_0x34720c;_0xdc84d2=0xc8;}else{_0xdc84d2=0xce;}_0x26ac5b[_0x03ec('0x1a')](_0xdc84d2);return _0x26ac5b[_0x03ec('0x20')](_0x03ec('0x21'),_0x56b226+'-'+_0x5ca189+'/'+_0x34720c)[_0x03ec('0x1b')](_0x1ff47f);}return null;};}function patchUpdates(_0x2dc18a){return function(_0x350d88){try{jsonpatch[_0x03ec('0x22')](_0x350d88,_0x2dc18a,!![]);}catch(_0x2f8551){return BPromise[_0x03ec('0x23')](_0x2f8551);}return _0x350d88[_0x03ec('0x24')]();};}function saveUpdates(_0x2c8a6e,_0x86e9e3){return function(_0x585834){if(_0x585834){return _0x585834[_0x03ec('0x25')](_0x2c8a6e)[_0x03ec('0x26')](function(_0x4d5854){return _0x4d5854;});}return null;};}function removeEntity(_0x2e6fdb,_0x3c49f7){return function(_0x11d3b4){if(_0x11d3b4){return _0x11d3b4[_0x03ec('0x27')]()[_0x03ec('0x26')](function(){_0x2e6fdb['status'](0xcc)[_0x03ec('0x19')]();});}};}function handleEntityNotFound(_0xad9427,_0x2fecf9){return function(_0x232dad){if(!_0x232dad){_0xad9427['sendStatus'](0x194);}return _0x232dad;};}function handleError(_0x21720e,_0x1a43a6){_0x1a43a6=_0x1a43a6||0x1f4;return function(_0x115494){logger['error'](_0x115494[_0x03ec('0x28')]);if(_0x115494[_0x03ec('0x29')]){delete _0x115494[_0x03ec('0x29')];}_0x21720e[_0x03ec('0x1a')](_0x1a43a6)[_0x03ec('0x2a')](_0x115494);};}exports[_0x03ec('0x2b')]=function(_0x2f3f29,_0x1c4664){var _0x17cb36={},_0x27ad66={},_0x525bb5={'count':0x0,'rows':[]};var _0x29b8b7=_['map'](db[_0x03ec('0x2c')]['rawAttributes'],function(_0x329b99){return{'name':_0x329b99[_0x03ec('0x2d')],'type':_0x329b99[_0x03ec('0x2e')]['key']};});_0x27ad66[_0x03ec('0x2f')]=_[_0x03ec('0x30')](_0x29b8b7,_0x03ec('0x29'));_0x27ad66[_0x03ec('0x31')]=_[_0x03ec('0x32')](_0x2f3f29['query']);_0x27ad66[_0x03ec('0x33')]=_[_0x03ec('0x34')](_0x27ad66[_0x03ec('0x2f')],_0x27ad66[_0x03ec('0x31')]);_0x17cb36['attributes']=_[_0x03ec('0x34')](_0x27ad66[_0x03ec('0x2f')],qs[_0x03ec('0x35')](_0x2f3f29[_0x03ec('0x31')][_0x03ec('0x35')]));_0x17cb36['attributes']=_0x17cb36[_0x03ec('0x36')][_0x03ec('0x37')]?_0x17cb36[_0x03ec('0x36')]:_0x27ad66[_0x03ec('0x2f')];if(!_0x2f3f29[_0x03ec('0x31')][_0x03ec('0x38')](_0x03ec('0x39'))){_0x17cb36['limit']=qs[_0x03ec('0x1e')](_0x2f3f29[_0x03ec('0x31')][_0x03ec('0x1e')]);_0x17cb36[_0x03ec('0x1c')]=qs[_0x03ec('0x1c')](_0x2f3f29[_0x03ec('0x31')][_0x03ec('0x1c')]);}_0x17cb36['order']=qs[_0x03ec('0x3a')](_0x2f3f29[_0x03ec('0x31')]['sort']);_0x17cb36[_0x03ec('0x3b')]=qs['filters'](_[_0x03ec('0x3c')](_0x2f3f29[_0x03ec('0x31')],_0x27ad66[_0x03ec('0x33')]),_0x29b8b7);if(_0x2f3f29[_0x03ec('0x31')]['filter']){_0x17cb36['where']=_['merge'](_0x17cb36['where'],{'$or':_[_0x03ec('0x30')](_0x29b8b7,function(_0x3520e5){if(_0x3520e5[_0x03ec('0x2e')]!=='VIRTUAL'){var _0x28afff={};_0x28afff[_0x3520e5['name']]={'$like':'%'+_0x2f3f29['query'][_0x03ec('0x3d')]+'%'};return _0x28afff;}})});}_0x17cb36=_[_0x03ec('0x3e')]({},_0x17cb36,_0x2f3f29[_0x03ec('0x3f')]);var _0x3fbc6a={'where':_0x17cb36['where']};return db[_0x03ec('0x2c')][_0x03ec('0x1f')](_0x3fbc6a)[_0x03ec('0x26')](function(_0x233490){_0x525bb5[_0x03ec('0x1f')]=_0x233490;if(_0x2f3f29[_0x03ec('0x31')][_0x03ec('0x40')]){_0x17cb36[_0x03ec('0x41')]=[{'all':!![]}];}return db[_0x03ec('0x2c')]['findAll'](_0x17cb36);})[_0x03ec('0x26')](function(_0x559bb8){_0x525bb5[_0x03ec('0x42')]=_0x559bb8;return _0x525bb5;})[_0x03ec('0x26')](respondWithFilteredResult(_0x1c4664,_0x17cb36))[_0x03ec('0x43')](handleError(_0x1c4664,null));};exports['show']=function(_0x127e8e,_0x11fbc8){var _0x12ff5e={'raw':!![],'where':{'id':_0x127e8e[_0x03ec('0x44')]['id']}},_0x31266a={};_0x31266a[_0x03ec('0x2f')]=_[_0x03ec('0x32')](db[_0x03ec('0x2c')][_0x03ec('0x45')]);_0x31266a[_0x03ec('0x31')]=_['keys'](_0x127e8e[_0x03ec('0x31')]);_0x31266a['filters']=_[_0x03ec('0x34')](_0x31266a['model'],_0x31266a[_0x03ec('0x31')]);_0x12ff5e['attributes']=_[_0x03ec('0x34')](_0x31266a['model'],qs[_0x03ec('0x35')](_0x127e8e[_0x03ec('0x31')][_0x03ec('0x35')]));_0x12ff5e['attributes']=_0x12ff5e[_0x03ec('0x36')][_0x03ec('0x37')]?_0x12ff5e['attributes']:_0x31266a[_0x03ec('0x2f')];if(_0x127e8e[_0x03ec('0x31')][_0x03ec('0x40')]){_0x12ff5e[_0x03ec('0x41')]=[{'all':!![]}];}_0x12ff5e=_['merge']({},_0x12ff5e,_0x127e8e['options']);return db[_0x03ec('0x2c')]['find'](_0x12ff5e)[_0x03ec('0x26')](handleEntityNotFound(_0x11fbc8,null))[_0x03ec('0x26')](respondWithResult(_0x11fbc8,null))[_0x03ec('0x43')](handleError(_0x11fbc8,null));};exports[_0x03ec('0x46')]=function(_0x3da8fd,_0x33f5f7){var _0x175394={'where':{'id':_0x3da8fd[_0x03ec('0x44')]['id']}},_0x257072={};_0x257072[_0x03ec('0x2f')]=_[_0x03ec('0x32')](db[_0x03ec('0x2c')][_0x03ec('0x45')]);_0x175394['attributes']=_[_0x03ec('0x34')](_0x257072[_0x03ec('0x2f')],qs['fields'](_0x3da8fd[_0x03ec('0x31')][_0x03ec('0x35')]));_0x175394[_0x03ec('0x36')]=_0x175394[_0x03ec('0x36')][_0x03ec('0x37')]?_0x175394['attributes']:_0x257072[_0x03ec('0x2f')];if(_0x3da8fd[_0x03ec('0x31')][_0x03ec('0x40')]){_0x175394[_0x03ec('0x41')]=[{'all':!![]}];}_0x175394=_[_0x03ec('0x3e')]({},_0x175394,_0x3da8fd[_0x03ec('0x3f')]);return db['Attachment'][_0x03ec('0x47')](_0x175394)[_0x03ec('0x26')](handleEntityNotFound(_0x33f5f7,null))[_0x03ec('0x26')](function(_0x42423d){if(_0x42423d){var _0x5c41ea=_0x42423d[_0x03ec('0x48')]({'plain':!![]});_0x5c41ea=qs['omit'](_0x5c41ea,['id',_0x03ec('0x49'),'updatedAt']);_0x3da8fd['body']=_[_0x03ec('0x4a')](_0x3da8fd[_0x03ec('0x4b')],['id',_0x03ec('0x49'),'updatedAt']);return db[_0x03ec('0x2c')]['create'](_[_0x03ec('0x3e')](_0x5c41ea,_0x3da8fd[_0x03ec('0x4b')]),{'include':_0x3da8fd[_0x03ec('0x31')][_0x03ec('0x40')]?[{'all':!![]}]:undefined});}})[_0x03ec('0x26')](respondWithResult(_0x33f5f7,0xc9))[_0x03ec('0x43')](handleError(_0x33f5f7,null));};exports[_0x03ec('0x25')]=function(_0x373082,_0x552275){if(_0x373082[_0x03ec('0x4b')]['id']){delete _0x373082['body']['id'];}return db['Attachment'][_0x03ec('0x47')]({'where':{'id':_0x373082[_0x03ec('0x44')]['id']}})[_0x03ec('0x26')](handleEntityNotFound(_0x552275,null))[_0x03ec('0x26')](saveUpdates(_0x373082['body'],null))[_0x03ec('0x26')](respondWithResult(_0x552275,null))[_0x03ec('0x43')](handleError(_0x552275,null));};exports[_0x03ec('0x27')]=function(_0x1d4f09,_0x1d7cb1){return db[_0x03ec('0x2c')][_0x03ec('0x47')]({'where':{'id':_0x1d4f09[_0x03ec('0x44')]['id']}})[_0x03ec('0x26')](handleEntityNotFound(_0x1d7cb1,null))[_0x03ec('0x26')](removeEntity(_0x1d7cb1,null))[_0x03ec('0x43')](handleError(_0x1d7cb1,null));};exports[_0x03ec('0x4c')]=function(_0x4d14c3,_0x4c025b,_0x19cbc7){_0x4d14c3[_0x03ec('0x4b')]['name']=_0x4d14c3[_0x03ec('0x4d')][_0x03ec('0x4e')];_0x4d14c3[_0x03ec('0x4b')]['basename']=_0x4d14c3[_0x03ec('0x4d')][_0x03ec('0x4f')];_0x4d14c3[_0x03ec('0x4b')][_0x03ec('0x2e')]=_0x4d14c3[_0x03ec('0x4d')]['mimetype'];return db['Attachment'][_0x03ec('0x4c')](_0x4d14c3[_0x03ec('0x4b')])[_0x03ec('0x26')](respondWithResult(_0x4c025b,0xc9))[_0x03ec('0x43')](handleError(_0x4c025b,null));};exports[_0x03ec('0x50')]=function(_0x43e684,_0x6e1ec9,_0x1fbef9){return db[_0x03ec('0x2c')][_0x03ec('0x51')]({'where':{'id':_0x43e684[_0x03ec('0x44')]['id']},'raw':!![]})[_0x03ec('0x26')](handleEntityNotFound(_0x6e1ec9,null))[_0x03ec('0x26')](function(_0x52b093){if(_0x52b093){var _0x147a4f=_0x52b093[_0x03ec('0x52')]!==null;var _0x2d4a0f=path[_0x03ec('0x53')](config[_0x03ec('0x54')],_0x03ec('0x55'));if(_0x147a4f){_0x2d4a0f=path[_0x03ec('0x53')](_0x2d4a0f,'offline-chat/');}var _0x532d0b=path[_0x03ec('0x53')](_0x2d4a0f,_0x52b093[_0x03ec('0x56')]);return _0x6e1ec9[_0x03ec('0x50')](_0x532d0b);}})[_0x03ec('0x43')](handleError(_0x6e1ec9,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 095c516..4fbc54b 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 _0xf2ee=['path','rimraf','../../config/environment','./attachment.attributes','exports','Attachment','attachments','lodash','util','api','moment','bluebird'];(function(_0x4f1dff,_0x57f026){var _0x4c1eb3=function(_0x6ca07d){while(--_0x6ca07d){_0x4f1dff['push'](_0x4f1dff['shift']());}};_0x4c1eb3(++_0x57f026);}(_0xf2ee,0x11b));var _0xef2e=function(_0x402d5f,_0xed6d6b){_0x402d5f=_0x402d5f-0x0;var _0x429877=_0xf2ee[_0x402d5f];return _0x429877;};'use strict';var _=require(_0xef2e('0x0'));var util=require(_0xef2e('0x1'));var logger=require('../../config/logger')(_0xef2e('0x2'));var moment=require(_0xef2e('0x3'));var BPromise=require(_0xef2e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef2e('0x5'));var rimraf=require(_0xef2e('0x6'));var config=require(_0xef2e('0x7'));var attributes=require(_0xef2e('0x8'));module[_0xef2e('0x9')]=function(_0x19aa31,_0xf0cedd){return _0x19aa31['define'](_0xef2e('0xa'),attributes,{'tableName':_0xef2e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba83=['../../config/environment','Attachment','attachments','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x28e924,_0xf59559){var _0xafe29a=function(_0x139189){while(--_0x139189){_0x28e924['push'](_0x28e924['shift']());}};_0xafe29a(++_0xf59559);}(_0xba83,0xc9));var _0x3ba8=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xba83[_0x344a3f];return _0x264712;};'use strict';var _=require('lodash');var util=require(_0x3ba8('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3ba8('0x1'));var BPromise=require(_0x3ba8('0x2'));var rp=require(_0x3ba8('0x3'));var fs=require('fs');var path=require(_0x3ba8('0x4'));var rimraf=require(_0x3ba8('0x5'));var config=require(_0x3ba8('0x6'));var attributes=require('./attachment.attributes');module['exports']=function(_0x38bb12,_0xa435a9){return _0x38bb12['define'](_0x3ba8('0x7'),attributes,{'tableName':_0x3ba8('0x8'),'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 cd6f55c..e1b77a7 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 _0x0eec=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateAttachment','Attachment','body','options','then','lodash','bluebird','randomstring'];(function(_0x22af4d,_0x29edda){var _0x520fbc=function(_0x107baa){while(--_0x107baa){_0x22af4d['push'](_0x22af4d['shift']());}};_0x520fbc(++_0x29edda);}(_0x0eec,0xac));var _0xc0ee=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0eec[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc0ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc0ee('0x1'));var rs=require(_0xc0ee('0x2'));var fs=require('fs');var Redis=require(_0xc0ee('0x3'));var db=require(_0xc0ee('0x4'))['db'];var utils=require(_0xc0ee('0x5'));var logger=require(_0xc0ee('0x6'))(_0xc0ee('0x7'));var config=require('../../config/environment');var jayson=require(_0xc0ee('0x8'));var client=jayson['client'][_0xc0ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39022a,_0x2d364d,_0x3aaca5){return new BPromise(function(_0x38b387,_0x1d9dca){return client[_0xc0ee('0xa')](_0x39022a,_0x3aaca5)['then'](function(_0x141f4a){logger[_0xc0ee('0xb')](_0xc0ee('0xc'),_0x2d364d,_0xc0ee('0xd'));logger[_0xc0ee('0xe')](_0xc0ee('0xf'),_0x2d364d,_0xc0ee('0xd'),JSON['stringify'](_0x141f4a));if(_0x141f4a[_0xc0ee('0x10')]){if(_0x141f4a[_0xc0ee('0x10')][_0xc0ee('0x11')]===0x1f4){logger[_0xc0ee('0x10')](_0xc0ee('0xc'),_0x2d364d,_0x141f4a[_0xc0ee('0x10')][_0xc0ee('0x12')]);return _0x1d9dca(_0x141f4a[_0xc0ee('0x10')][_0xc0ee('0x12')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x2d364d,_0x141f4a[_0xc0ee('0x10')][_0xc0ee('0x12')]);return _0x38b387(_0x141f4a[_0xc0ee('0x10')]['message']);}else{logger[_0xc0ee('0xb')](_0xc0ee('0xc'),_0x2d364d,_0xc0ee('0xd'));_0x38b387(_0x141f4a['result']['message']);}})[_0xc0ee('0x13')](function(_0x4dc6de){logger[_0xc0ee('0x10')](_0xc0ee('0xc'),_0x2d364d,_0x4dc6de);_0x1d9dca(_0x4dc6de);});});}exports[_0xc0ee('0x14')]=function(_0x59aad9){var _0x4e7e82=this;return new Promise(function(_0x16d050,_0x276e2e){return db[_0xc0ee('0x15')]['create'](_0x59aad9[_0xc0ee('0x16')],{'raw':_0x59aad9[_0xc0ee('0x17')]?_0x59aad9['options']['raw']===undefined?!![]:![]:!![]})[_0xc0ee('0x18')](function(_0x233333){logger['info'](_0xc0ee('0x14'),_0x59aad9);logger[_0xc0ee('0xe')](_0xc0ee('0x14'),_0x59aad9,JSON['stringify'](_0x233333));_0x16d050(_0x233333);})['catch'](function(_0x5af925){logger[_0xc0ee('0x10')](_0xc0ee('0x14'),_0x5af925['message'],_0x59aad9);_0x276e2e(_0x4e7e82[_0xc0ee('0x10')](0x1f4,_0x5af925[_0xc0ee('0x12')]));});});}; \ No newline at end of file +var _0xe14d=['debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateAttachment','Attachment','create','body','options','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s'];(function(_0xb6a1ba,_0x5877cf){var _0x35b1cb=function(_0x1a32a5){while(--_0x1a32a5){_0xb6a1ba['push'](_0xb6a1ba['shift']());}};_0x35b1cb(++_0x5877cf);}(_0xe14d,0x1ee));var _0xde14=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xe14d[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1f6b,_0x5a1344,_0x1bd49d){return new BPromise(function(_0x115b7d,_0x2b0e7c){return client[_0xde14('0xc')](_0x4b1f6b,_0x1bd49d)[_0xde14('0xd')](function(_0x176909){logger[_0xde14('0xe')](_0xde14('0xf'),_0x5a1344,'request\x20sent');logger[_0xde14('0x10')](_0xde14('0x11'),_0x5a1344,_0xde14('0x12'),JSON[_0xde14('0x13')](_0x176909));if(_0x176909[_0xde14('0x14')]){if(_0x176909[_0xde14('0x14')][_0xde14('0x15')]===0x1f4){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909[_0xde14('0x14')][_0xde14('0x16')]);return _0x2b0e7c(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909['error']['message']);return _0x115b7d(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}else{logger[_0xde14('0xe')]('Attachment,\x20%s,\x20%s',_0x5a1344,_0xde14('0x12'));_0x115b7d(_0x176909[_0xde14('0x17')][_0xde14('0x16')]);}})[_0xde14('0x18')](function(_0x3de959){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x3de959);_0x2b0e7c(_0x3de959);});});}exports[_0xde14('0x19')]=function(_0x3cc317){var _0x10c4ab=this;return new Promise(function(_0x590a8b,_0x3f5fcf){return db[_0xde14('0x1a')][_0xde14('0x1b')](_0x3cc317[_0xde14('0x1c')],{'raw':_0x3cc317['options']?_0x3cc317[_0xde14('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xde14('0xd')](function(_0x4c24a8){logger[_0xde14('0xe')](_0xde14('0x19'),_0x3cc317);logger[_0xde14('0x10')](_0xde14('0x19'),_0x3cc317,JSON[_0xde14('0x13')](_0x4c24a8));_0x590a8b(_0x4c24a8);})[_0xde14('0x18')](function(_0x40b648){logger[_0xde14('0x14')](_0xde14('0x19'),_0x40b648[_0xde14('0x16')],_0x3cc317);_0x3f5fcf(_0x10c4ab[_0xde14('0x14')](0x1f4,_0x40b648[_0xde14('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index a4affd7..86b1d4e 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 _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x599415,_0x1aad98){var _0x57ccb1=function(_0x28993b){while(--_0x28993b){_0x599415['push'](_0x599415['shift']());}};_0x57ccb1(++_0x1aad98);}(_0x2032,0xd9));var _0x2203=function(_0x34cace,_0x127f11){_0x34cace=_0x34cace-0x0;var _0x1e6c2f=_0x2032[_0x34cace];return _0x1e6c2f;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file +var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x0b0e,0x187));var _0xe0b0=function(_0x53b8e0,_0x55d46e){_0x53b8e0=_0x53b8e0-0x0;var _0x10630c=_0x0b0e[_0x53b8e0];return _0x10630c;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 08d2344..3728abd 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['salt','role','disabled','blocked','admin','user','then','minutes','clearBlockUser','getLicense','catch','status','message','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','use','User','passport','passport-local','Strategy','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','activedirectory','baseDN','domain','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','blockDuration','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var passport=require(_0x0a9e('0x0'));var LocalStrategy=require(_0x0a9e('0x1'))[_0x0a9e('0x2')];var moment=require('moment');var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x0a9e('0x3'));var util=require('util');var db=require(_0x0a9e('0x4'))['db'];var authService=require(_0x0a9e('0x5'));var utils=require(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var logger=require(_0x0a9e('0x8'))('api');function isActiveDirectoryConfigured(_0x219af0){var _0x441e3a=![];if(typeof _0x219af0[_0x0a9e('0x9')]!=='undefined'){_0x441e3a=_0x219af0['activedirectory'][_0x0a9e('0xa')]&&_0x219af0['activedirectory']['url']&&_0x219af0[_0x0a9e('0x9')][_0x0a9e('0xb')];}return _0x441e3a;}function adAuthenticate(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){try{var _0x50dfb2=new ActiveDirectory(_0x307b3e);_0x50dfb2['authenticate'](_0x3ab53f,_0xfeb75b,function(_0x4cfe67,_0x273d4d){if(_0x4cfe67){logger[_0x0a9e('0xc')](_0x0a9e('0xd'),_0x3ab53f,util[_0x0a9e('0xe')](_0x4cfe67,{'showHidden':![],'depth':null}));_0x4a4c56(_0x0a9e('0xf'));}else if(!_0x273d4d){logger[_0x0a9e('0xc')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x3ab53f);_0x4a4c56(_0x0a9e('0xf'));}else{_0xbd1168(_0x273d4d);}});}catch(_0x239b12){_0x4a4c56(_0x239b12);}});}function ActiveDirectoryAuthenticate(_0x2b4227,_0x281129,_0x44dcfd,_0x4d5611){var _0x52a03d,_0x22dccb;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x0a9e('0x10'),_0x281129);return _0x4d5611(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x0a9e('0x11')][_0x0a9e('0x12')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x0a9e('0x13')],'raw':!![]})['then'](function(_0x459eb1){_0x52a03d=_0x459eb1;if(!_0x52a03d[_0x0a9e('0x14')]){logger[_0x0a9e('0xc')](_0x0a9e('0x15'),_0x281129);throw new Error(_0x0a9e('0xf'));}return _0x2b4227[_0x0a9e('0x12')]({'logging':!![],'attributes':['id',_0x0a9e('0x16'),_0x0a9e('0x17'),_0x0a9e('0x18'),_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),'blockedAt'],'where':{'name':_0x281129,'role':{'$or':[_0x0a9e('0x1c'),_0x0a9e('0x1d'),'agent']},'adSsoEnabled':!![]}});})[_0x0a9e('0x1e')](function(_0x5a09ef){if(!_0x5a09ef||_0x5a09ef&&_0x5a09ef['name']!==_0x281129){throw new Error(_0x0a9e('0xf'));}_0x22dccb=_0x5a09ef;var _0x432e56=_0x22dccb[_0x0a9e('0x16')]+'@'+config[_0x0a9e('0x9')]['domain'];return adAuthenticate(config[_0x0a9e('0x9')],_0x432e56,_0x44dcfd);})[_0x0a9e('0x1e')](function(_0x3b45bc){if(_0x22dccb[_0x0a9e('0x1a')]){throw new Error(_0x0a9e('0xf'));}if(_0x52a03d[_0x0a9e('0x13')]>0x0){if(_0x22dccb[_0x0a9e('0x1b')]){if(moment(_0x22dccb['blockedAt'])['add'](_0x52a03d[_0x0a9e('0x13')],_0x0a9e('0x1f'))>moment()){throw new Error(_0x0a9e('0xf'));}return utils[_0x0a9e('0x20')](_0x22dccb,0x0,![],null)['then'](function(){return utils[_0x0a9e('0x21')](_0x22dccb);})['then'](function(){return _0x4d5611(null,_0x22dccb);});}else{return utils[_0x0a9e('0x21')](_0x22dccb)['then'](function(){return _0x4d5611(null,_0x22dccb);});}}else{return utils[_0x0a9e('0x21')](_0x22dccb)[_0x0a9e('0x1e')](function(){return _0x4d5611(null,_0x22dccb);});}})[_0x0a9e('0x22')](function(_0x14433c){return _0x4d5611(null,![],_0x14433c);});}function handleError(_0x140511,_0x1538a4,_0x11c3b6){return _0x140511[_0x0a9e('0x23')](_0x1538a4||0x1f4)['send']({'message':_0x11c3b6?_0x11c3b6[_0x0a9e('0x24')]||_0x11c3b6:''});}exports[_0x0a9e('0x25')]=function(_0x2b1f27,_0x2ec755,_0x5c877d){passport[_0x0a9e('0x26')](_0x0a9e('0x27'),function(_0x1843b2,_0x824a4f,_0x58b06f){var _0x563b45=_0x1843b2||_0x58b06f;if(_0x563b45){return handleError(_0x2ec755,0x191,_0x563b45);}if(!_0x824a4f){return handleError(_0x2ec755,0x194,{'message':_0x0a9e('0x28')});}else{var _0x2e8759={'payload':{'id':_0x824a4f['id'],'role':_0x824a4f[_0x0a9e('0x19')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x2e8759)[_0x0a9e('0x1e')](function(_0x5d1e0e){_0x2ec755[_0x0a9e('0x29')]({'id':_0x824a4f['id'],'token':_0x5d1e0e,'statusCall':'','isAlreadyLogged':_0x824a4f[_0x0a9e('0x2a')]});});}})(_0x2b1f27,_0x2ec755,_0x5c877d);};passport[_0x0a9e('0x2b')](_0x0a9e('0x27'),new LocalStrategy({'usernameField':_0x0a9e('0x16'),'passwordField':'password'},function(_0x66c1d2,_0x46f0a5,_0x40cb85){return ActiveDirectoryAuthenticate(db[_0x0a9e('0x2c')],_0x66c1d2,_0x46f0a5,_0x40cb85);})); \ No newline at end of file +var _0xa9e0=['salt','role','disabled','blocked','admin','user','then','minutes','clearBlockUser','getLicense','catch','status','message','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','use','User','passport','passport-local','Strategy','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','activedirectory','baseDN','domain','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','blockDuration','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var passport=require(_0x0a9e('0x0'));var LocalStrategy=require(_0x0a9e('0x1'))[_0x0a9e('0x2')];var moment=require('moment');var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x0a9e('0x3'));var util=require('util');var db=require(_0x0a9e('0x4'))['db'];var authService=require(_0x0a9e('0x5'));var utils=require(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var logger=require(_0x0a9e('0x8'))('api');function isActiveDirectoryConfigured(_0x219af0){var _0x441e3a=![];if(typeof _0x219af0[_0x0a9e('0x9')]!=='undefined'){_0x441e3a=_0x219af0['activedirectory'][_0x0a9e('0xa')]&&_0x219af0['activedirectory']['url']&&_0x219af0[_0x0a9e('0x9')][_0x0a9e('0xb')];}return _0x441e3a;}function adAuthenticate(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){try{var _0x50dfb2=new ActiveDirectory(_0x307b3e);_0x50dfb2['authenticate'](_0x3ab53f,_0xfeb75b,function(_0x4cfe67,_0x273d4d){if(_0x4cfe67){logger[_0x0a9e('0xc')](_0x0a9e('0xd'),_0x3ab53f,util[_0x0a9e('0xe')](_0x4cfe67,{'showHidden':![],'depth':null}));_0x4a4c56(_0x0a9e('0xf'));}else if(!_0x273d4d){logger[_0x0a9e('0xc')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x3ab53f);_0x4a4c56(_0x0a9e('0xf'));}else{_0xbd1168(_0x273d4d);}});}catch(_0x239b12){_0x4a4c56(_0x239b12);}});}function ActiveDirectoryAuthenticate(_0x2b4227,_0x281129,_0x44dcfd,_0x4d5611){var _0x52a03d,_0x22dccb;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x0a9e('0x10'),_0x281129);return _0x4d5611(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x0a9e('0x11')][_0x0a9e('0x12')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x0a9e('0x13')],'raw':!![]})['then'](function(_0x459eb1){_0x52a03d=_0x459eb1;if(!_0x52a03d[_0x0a9e('0x14')]){logger[_0x0a9e('0xc')](_0x0a9e('0x15'),_0x281129);throw new Error(_0x0a9e('0xf'));}return _0x2b4227[_0x0a9e('0x12')]({'logging':!![],'attributes':['id',_0x0a9e('0x16'),_0x0a9e('0x17'),_0x0a9e('0x18'),_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),'blockedAt'],'where':{'name':_0x281129,'role':{'$or':[_0x0a9e('0x1c'),_0x0a9e('0x1d'),'agent']},'adSsoEnabled':!![]}});})[_0x0a9e('0x1e')](function(_0x5a09ef){if(!_0x5a09ef||_0x5a09ef&&_0x5a09ef['name']!==_0x281129){throw new Error(_0x0a9e('0xf'));}_0x22dccb=_0x5a09ef;var _0x432e56=_0x22dccb[_0x0a9e('0x16')]+'@'+config[_0x0a9e('0x9')]['domain'];return adAuthenticate(config[_0x0a9e('0x9')],_0x432e56,_0x44dcfd);})[_0x0a9e('0x1e')](function(_0x3b45bc){if(_0x22dccb[_0x0a9e('0x1a')]){throw new Error(_0x0a9e('0xf'));}if(_0x52a03d[_0x0a9e('0x13')]>0x0){if(_0x22dccb[_0x0a9e('0x1b')]){if(moment(_0x22dccb['blockedAt'])['add'](_0x52a03d[_0x0a9e('0x13')],_0x0a9e('0x1f'))>moment()){throw new Error(_0x0a9e('0xf'));}return utils[_0x0a9e('0x20')](_0x22dccb,0x0,![],null)['then'](function(){return utils[_0x0a9e('0x21')](_0x22dccb);})['then'](function(){return _0x4d5611(null,_0x22dccb);});}else{return utils[_0x0a9e('0x21')](_0x22dccb)['then'](function(){return _0x4d5611(null,_0x22dccb);});}}else{return utils[_0x0a9e('0x21')](_0x22dccb)[_0x0a9e('0x1e')](function(){return _0x4d5611(null,_0x22dccb);});}})[_0x0a9e('0x22')](function(_0x14433c){return _0x4d5611(null,![],_0x14433c);});}function handleError(_0x140511,_0x1538a4,_0x11c3b6){return _0x140511[_0x0a9e('0x23')](_0x1538a4||0x1f4)['send']({'message':_0x11c3b6?_0x11c3b6[_0x0a9e('0x24')]||_0x11c3b6:''});}exports[_0x0a9e('0x25')]=function(_0x2b1f27,_0x2ec755,_0x5c877d){passport[_0x0a9e('0x26')](_0x0a9e('0x27'),function(_0x1843b2,_0x824a4f,_0x58b06f){var _0x563b45=_0x1843b2||_0x58b06f;if(_0x563b45){return handleError(_0x2ec755,0x191,_0x563b45);}if(!_0x824a4f){return handleError(_0x2ec755,0x194,{'message':_0x0a9e('0x28')});}else{var _0x2e8759={'payload':{'id':_0x824a4f['id'],'role':_0x824a4f[_0x0a9e('0x19')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x2e8759)[_0x0a9e('0x1e')](function(_0x5d1e0e){_0x2ec755[_0x0a9e('0x29')]({'id':_0x824a4f['id'],'token':_0x5d1e0e,'statusCall':'','isAlreadyLogged':_0x824a4f[_0x0a9e('0x2a')]});});}})(_0x2b1f27,_0x2ec755,_0x5c877d);};passport[_0x0a9e('0x2b')](_0x0a9e('0x27'),new LocalStrategy({'usernameField':_0x0a9e('0x16'),'passwordField':'password'},function(_0x66c1d2,_0x46f0a5,_0x40cb85){return ActiveDirectoryAuthenticate(db[_0x0a9e('0x2c')],_0x66c1d2,_0x46f0a5,_0x40cb85);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 3b71bda..e0b9297 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfcf3=['exports','express','Router','./authActiveDirectory.controller'];(function(_0x1bf787,_0x515fc5){var _0x3e4bcc=function(_0xdac71){while(--_0xdac71){_0x1bf787['push'](_0x1bf787['shift']());}};_0x3e4bcc(++_0x515fc5);}(_0xfcf3,0x7d));var _0x3fcf=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xfcf3[_0x36eaaa];return _0x461349;};'use strict';var express=require(_0x3fcf('0x0'));var router=express[_0x3fcf('0x1')]();var controller=require(_0x3fcf('0x2'));router['post']('/',controller['login']);module[_0x3fcf('0x3')]=router; \ No newline at end of file +var _0x295e=['./authActiveDirectory.controller','login','express'];(function(_0x5a6644,_0x45d612){var _0x3a2a5d=function(_0x54159e){while(--_0x54159e){_0x5a6644['push'](_0x5a6644['shift']());}};_0x3a2a5d(++_0x45d612);}(_0x295e,0x188));var _0xe295=function(_0x418407,_0x35097c){_0x418407=_0x418407-0x0;var _0x56882e=_0x295e[_0x418407];return _0x56882e;};'use strict';var express=require(_0xe295('0x0'));var router=express['Router']();var controller=require(_0xe295('0x1'));router['post']('/',controller[_0xe295('0x2')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 67519a4..1780914 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x7a54,0x106));var _0x47a5=function(_0x2c350e,_0x35a472){_0x2c350e=_0x2c350e-0x0;var _0x10955c=_0x7a54[_0x2c350e];return _0x10955c;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x5a37c5,_0x4912a7){var _0x128402=function(_0xb29c19){while(--_0xb29c19){_0x5a37c5['push'](_0x5a37c5['shift']());}};_0x128402(++_0x4912a7);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index f1e5fa2..d7c9afb 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 _0xa8b4=['Router','./authGoogle.controller','../user/user.controller.js','get','/callback','callback','isMiddleware','login','exports','express','passport'];(function(_0x436825,_0x337236){var _0x5ae709=function(_0x43c644){while(--_0x43c644){_0x436825['push'](_0x436825['shift']());}};_0x5ae709(++_0x337236);}(_0xa8b4,0xc4));var _0x4a8b=function(_0x4a7c98,_0x3ba49e){_0x4a7c98=_0x4a7c98-0x0;var _0x146efd=_0xa8b4[_0x4a7c98];return _0x146efd;};'use strict';var express=require(_0x4a8b('0x0'));var passport=require(_0x4a8b('0x1'));var router=express[_0x4a8b('0x2')]();var controller=require(_0x4a8b('0x3'));var userController=require(_0x4a8b('0x4'));var authService=require('../../components/auth/service');router[_0x4a8b('0x5')]('/',controller['login']);router['get'](_0x4a8b('0x6'),controller[_0x4a8b('0x7')],authService[_0x4a8b('0x8')],userController[_0x4a8b('0x9')],authService['setTokenCookie']);module[_0x4a8b('0xa')]=router; \ No newline at end of file +var _0x1901=['isMiddleware','setTokenCookie','express','passport','Router','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback'];(function(_0x23ae5d,_0x47067e){var _0x3155f4=function(_0x54373d){while(--_0x54373d){_0x23ae5d['push'](_0x23ae5d['shift']());}};_0x3155f4(++_0x47067e);}(_0x1901,0x1af));var _0x1190=function(_0x4eff95,_0x329594){_0x4eff95=_0x4eff95-0x0;var _0xf1d5df=_0x1901[_0x4eff95];return _0xf1d5df;};'use strict';var express=require(_0x1190('0x0'));var passport=require(_0x1190('0x1'));var router=express[_0x1190('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0x1190('0x3'));var authService=require(_0x1190('0x4'));router[_0x1190('0x5')]('/',controller[_0x1190('0x6')]);router[_0x1190('0x5')](_0x1190('0x7'),controller[_0x1190('0x8')],authService[_0x1190('0x9')],userController[_0x1190('0x6')],authService[_0x1190('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 9e94ec7..82fcc66 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 _0x02ea=['token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','validatePasswordHistory','resetPasswordExpires','Password\x20reset!','use','util','passport','passport-local','randomstring','moment','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','blocked','blockedAt','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','authentication','auth','user','pass','merge','format','\x22%s\x22\x20<%s>','error','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params'];(function(_0xa56b53,_0x53dbb7){var _0x19849f=function(_0x503946){while(--_0x503946){_0xa56b53['push'](_0xa56b53['shift']());}};_0x19849f(++_0x53dbb7);}(_0x02ea,0x1c2));var _0xa02e=function(_0x1857c6,_0x48840c){_0x1857c6=_0x1857c6-0x0;var _0x51011c=_0x02ea[_0x1857c6];return _0x51011c;};'use strict';var util=require(_0xa02e('0x0'));var passport=require(_0xa02e('0x1'));var LocalStrategy=require(_0xa02e('0x2'))['Strategy'];var jayson=require('jayson/promise');var _=require('lodash');var rs=require(_0xa02e('0x3'));var moment=require(_0xa02e('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0xa02e('0x5'));var utils=require(_0xa02e('0x6'));var client=jayson[_0xa02e('0x7')][_0xa02e('0x8')]({'port':0x232b});function localAuthenticate(_0x2fcf37,_0x339ad8,_0x3a863e,_0x3eb5d4){var _0x523583,_0x57179c;return db[_0xa02e('0x9')][_0xa02e('0xa')]({'where':{'id':0x1},'attributes':[_0xa02e('0xb'),_0xa02e('0xc')],'raw':!![]})[_0xa02e('0xd')](function(_0x38c3e9){_0x523583=_0x38c3e9;return _0x2fcf37[_0xa02e('0xa')]({'attributes':['id',_0xa02e('0xe'),_0xa02e('0xf'),_0xa02e('0x10'),_0xa02e('0x11'),'disabled',_0xa02e('0x12'),_0xa02e('0x13'),_0xa02e('0x14')],'where':{'name':_0x339ad8,'role':{'$or':[_0xa02e('0x15'),'user',_0xa02e('0x16')]}}});})['then'](function(_0x296e5d){if(!_0x296e5d||_0x296e5d&&_0x296e5d[_0xa02e('0xe')]!==_0x339ad8){throw new Error(_0xa02e('0x17'));}else{_0x57179c=_0x296e5d;return _0x57179c;}})[_0xa02e('0xd')](function(){_0x57179c[_0xa02e('0x18')](_0x3a863e,function(_0x46ac32,_0x4006bc){var _0x16cb3d=_0x57179c[_0xa02e('0x14')]+0x1;if(_0x46ac32){return _0x3eb5d4(_0x46ac32);}else if(!_0x4006bc){if(_0x57179c[_0xa02e('0x19')]){return _0x3eb5d4(null,![],{'message':_0xa02e('0x17')});}else if(_0x523583['allowedLoginAttempts']>0x0){if(_0x57179c[_0xa02e('0x12')]){if(_0x523583[_0xa02e('0xc')]>0x0){if(moment(_0x57179c[_0xa02e('0x13')])[_0xa02e('0x1a')](_0x523583[_0xa02e('0xc')],_0xa02e('0x1b'))>moment()){return _0x3eb5d4(null,![],{'message':_0xa02e('0x17')});}else{return utils[_0xa02e('0x1c')](_0x57179c,_0x16cb3d,![],null)[_0xa02e('0xd')](function(){return _0x3eb5d4(null,![],{'message':_0xa02e('0x17')});});}}else{return _0x3eb5d4(null,![],{'message':_0xa02e('0x17')});}}else{if(_0x16cb3d>=_0x523583[_0xa02e('0xb')]){return utils['clearBlockUser'](_0x57179c,0x0,!![],moment())['then'](function(){return _0x3eb5d4(null,![],{'message':_0xa02e('0x17')});});}else{return utils[_0xa02e('0x1c')](_0x57179c,_0x16cb3d,![],null)['then'](function(){return _0x3eb5d4(null,![],{'message':_0xa02e('0x17')});});}}}else{return _0x3eb5d4(null,![],{'message':_0xa02e('0x17')});}}else{if(_0x57179c[_0xa02e('0x19')]){return _0x3eb5d4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x523583[_0xa02e('0xb')]>0x0){if(_0x57179c[_0xa02e('0x12')]){if(_0x523583[_0xa02e('0xc')]>0x0){if(moment(_0x57179c['blockedAt'])[_0xa02e('0x1a')](_0x523583['blockDuration'],_0xa02e('0x1b'))>moment()){return _0x3eb5d4(null,![],{'message':_0xa02e('0x17')});}else{return utils[_0xa02e('0x1c')](_0x57179c,0x0,![],null)[_0xa02e('0xd')](function(){return utils['getLicense'](_0x57179c);})[_0xa02e('0xd')](function(){return _0x3eb5d4(null,_0x57179c);});}}else{return _0x3eb5d4(null,![],{'message':_0xa02e('0x17')});}}else{return utils['clearBlockUser'](_0x57179c,0x0,![],null)['then'](function(){return utils[_0xa02e('0x1d')](_0x57179c);})[_0xa02e('0xd')](function(){return _0x3eb5d4(null,_0x57179c);})[_0xa02e('0x1e')](function(_0x347ac9){return _0x3eb5d4(null,![],_0x347ac9);});}}else{if(_0x57179c[_0xa02e('0x12')]){return _0x3eb5d4(null,![],{'message':_0xa02e('0x17')});}else{return utils['getLicense'](_0x57179c)[_0xa02e('0xd')](function(){return _0x3eb5d4(null,_0x57179c);});}}}});})[_0xa02e('0x1e')](function(_0x41c497){return _0x3eb5d4(null,![],_0x41c497);});}function sendServiceMail(_0x1f4397){return db[_0xa02e('0x1f')][_0xa02e('0x20')]({'where':{'service':!![]},'attributes':['id','name',_0xa02e('0x21')],'include':[{'model':db[_0xa02e('0x22')],'as':'Smtp'}]})[_0xa02e('0xd')](function(_0x11fc56){if(!_0x11fc56){throw new Error(_0xa02e('0x23'));}var _0x910301={'tls':{'rejectUnauthorized':![]}};if(_0x11fc56[_0xa02e('0x24')][_0xa02e('0x25')]){_0x910301['service']=_0x11fc56['Smtp'][_0xa02e('0x25')];}else{_0x910301[_0xa02e('0x26')]=_0x11fc56[_0xa02e('0x24')][_0xa02e('0x26')];_0x910301[_0xa02e('0x27')]=_0x11fc56['Smtp'][_0xa02e('0x27')];_0x910301[_0xa02e('0x28')]=_0x11fc56['Smtp']['secure'];}if(_0x11fc56[_0xa02e('0x24')][_0xa02e('0x29')]){_0x910301[_0xa02e('0x2a')]={'user':_0x11fc56[_0xa02e('0x24')][_0xa02e('0x2b')],'pass':_0x11fc56[_0xa02e('0x24')][_0xa02e('0x2c')]};}var _0x54c429={'account':_0x910301,'message':_[_0xa02e('0x2d')]({'from':util[_0xa02e('0x2e')](_0xa02e('0x2f'),_0x11fc56[_0xa02e('0xe')],_0x11fc56['email']||_0x11fc56[_0xa02e('0x24')][_0xa02e('0x2b')])},_0x1f4397)};return client['request']('SendMail',_0x54c429);})[_0xa02e('0xd')](function(_0x262ff5){if(_0x262ff5[_0xa02e('0x30')]){throw new Error(util[_0xa02e('0x2e')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x262ff5[_0xa02e('0x30')][_0xa02e('0x31')]||JSON[_0xa02e('0x32')](_0x262ff5['error'])));}return!![];});}function handleError(_0x5a483d,_0x4e7767,_0x1aa7e0){return _0x5a483d[_0xa02e('0x33')](_0x4e7767||0x1f4)[_0xa02e('0x34')]({'message':_0x1aa7e0?_0x1aa7e0[_0xa02e('0x31')]||_0x1aa7e0:''});}exports[_0xa02e('0x35')]=function(_0x53d0d6,_0x3b12d7,_0x3c101a){passport[_0xa02e('0x18')](_0xa02e('0x36'),function(_0x4a78f9,_0xf67ab5,_0x5532e8){var _0xad9043=_0x4a78f9||_0x5532e8;if(_0xad9043){return handleError(_0x3b12d7,0x191,_0xad9043);}if(!_0xf67ab5){return handleError(_0x3b12d7,0x194,{'message':_0xa02e('0x37')});}else{var _0x4da8cc={'payload':{'id':_0xf67ab5['id'],'role':_0xf67ab5[_0xa02e('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0xa02e('0x38')](_0x4da8cc)[_0xa02e('0xd')](function(_0x39d29a){_0x3b12d7[_0xa02e('0x39')]({'id':_0xf67ab5['id'],'token':_0x39d29a,'statusCall':'','isAlreadyLogged':_0xf67ab5['online']});});}})(_0x53d0d6,_0x3b12d7,_0x3c101a);};exports['forgot']=function(_0x382353,_0xf42e8c,_0x2cacdf){if(!_0x382353[_0xa02e('0x3a')][_0xa02e('0x21')]){return handleError(_0xf42e8c,0x1f4,{'message':_0xa02e('0x3b')});}var _0x52cb01=rs['generate']();_0x382353[_0xa02e('0x3a')]['email']=_0x382353[_0xa02e('0x3a')][_0xa02e('0x21')][_0xa02e('0x3c')]()[_0xa02e('0x3d')]();var _0x169447;return db[_0xa02e('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0xa02e('0xb'),'blockDuration'],'raw':!![]})[_0xa02e('0xd')](function(_0xc38ae4){_0x169447=_0xc38ae4;return db[_0xa02e('0x3e')]['find']({'where':{'email':_0x382353[_0xa02e('0x3a')][_0xa02e('0x21')]}});})[_0xa02e('0xd')](function(_0x35bbb6){if(!_0x35bbb6){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x35bbb6[_0xa02e('0x19')]){throw new Error(_0xa02e('0x3f'));}if(_0x35bbb6[_0xa02e('0x12')]){if(moment(_0x35bbb6[_0xa02e('0x13')])[_0xa02e('0x1a')](_0x169447[_0xa02e('0xc')],'minutes')>moment()){throw new Error(_0xa02e('0x40'));}else{_0x35bbb6[_0xa02e('0x12')]=![];_0x35bbb6[_0xa02e('0x13')]=null;}}_0x35bbb6[_0xa02e('0x41')]=_0x52cb01;_0x35bbb6['resetPasswordExpires']=Date[_0xa02e('0x42')]()+0x36ee80;return _0x35bbb6[_0xa02e('0x43')]();})[_0xa02e('0xd')](function(){return sendServiceMail({'to':_0x382353[_0xa02e('0x3a')][_0xa02e('0x21')],'subject':_0xa02e('0x44'),'text':_0xa02e('0x45')+_0xa02e('0x46')+_0xa02e('0x47')+_0x382353[_0xa02e('0x48')][_0xa02e('0x26')]+_0xa02e('0x49')+_0x52cb01+'\x0a\x0a'+_0xa02e('0x4a')});})['then'](function(){_0xf42e8c['status'](0xc8)[_0xa02e('0x34')]({'message':_0xa02e('0x4b')});})['catch'](function(_0x13afac){return handleError(_0xf42e8c,0x1f4,_0x13afac);});};exports[_0xa02e('0x4c')]=function(_0x425015,_0x1b1f88,_0x50bbd7){return db[_0xa02e('0x3e')][_0xa02e('0x20')]({'where':{'resetPasswordToken':_0x425015[_0xa02e('0x4d')][_0xa02e('0x4e')],'resetPasswordExpires':{'$gt':Date[_0xa02e('0x42')]()}}})[_0xa02e('0xd')](function(_0x28fbd4){if(!_0x28fbd4){throw new Error(_0xa02e('0x4f'));}return db[_0xa02e('0x9')]['findOne']({'attributes':['id',_0xa02e('0x50'),'enforcePasswordHistory',_0xa02e('0x51')]})[_0xa02e('0xd')](function(_0x3c80c8){if(_0x3c80c8['securePassword'])authService[_0xa02e('0x52')](_0x425015[_0xa02e('0x3a')][_0xa02e('0xf')]);if(!_0x3c80c8[_0xa02e('0x53')]||!_0x28fbd4['previousPasswords'])return _0x28fbd4;authService[_0xa02e('0x54')](_0x425015[_0xa02e('0x3a')][_0xa02e('0xf')],_0x28fbd4['previousPasswords'],_0x3c80c8[_0xa02e('0x51')]);return _0x28fbd4;})[_0xa02e('0xd')](function(){_0x28fbd4[_0xa02e('0xf')]=_0x425015['body']['password'];_0x28fbd4['resetPasswordToken']=null;_0x28fbd4[_0xa02e('0x55')]=null;return _0x28fbd4[_0xa02e('0x43')]();});})[_0xa02e('0xd')](function(){_0x1b1f88['status'](0xc8)[_0xa02e('0x34')]({'message':_0xa02e('0x56')});})[_0xa02e('0x1e')](function(_0xd61ff0){return handleError(_0x1b1f88,0x1f4,_0xd61ff0);});};passport[_0xa02e('0x57')](_0xa02e('0x36'),new LocalStrategy({'usernameField':_0xa02e('0xe'),'passwordField':_0xa02e('0xf')},function(_0x1b2707,_0x1bd1d4,_0xc84879){return localAuthenticate(db[_0xa02e('0x3e')],_0x1b2707,_0x1bd1d4,_0xc84879);})); \ No newline at end of file +var _0x3aa9=['name','password','salt','role','disabled','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','blocked','blockDuration','blockedAt','clearBlockUser','add','getLicense','catch','MailAccount','find','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','authentication','user','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','stringify','status','message','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','minutes','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','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','validatePasswordHistory','previousPasswords','use','util','passport','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','client','http','Setting','findOne','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3aa9,0xfb));var _0x93aa=function(_0x5809da,_0x1f14ba){_0x5809da=_0x5809da-0x0;var _0x498ab2=_0x3aa9[_0x5809da];return _0x498ab2;};'use strict';var util=require(_0x93aa('0x0'));var passport=require(_0x93aa('0x1'));var LocalStrategy=require('passport-local')[_0x93aa('0x2')];var jayson=require(_0x93aa('0x3'));var _=require(_0x93aa('0x4'));var rs=require('randomstring');var moment=require(_0x93aa('0x5'));var db=require(_0x93aa('0x6'))['db'];var authService=require(_0x93aa('0x7'));var utils=require('../../config/utils');var client=jayson[_0x93aa('0x8')][_0x93aa('0x9')]({'port':0x232b});function localAuthenticate(_0x5224f9,_0x1375b2,_0x4b7ed6,_0x326308){var _0xdb1599,_0x33b42a;return db[_0x93aa('0xa')][_0x93aa('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x93aa('0xc')](function(_0x2970d9){_0xdb1599=_0x2970d9;return _0x5224f9[_0x93aa('0xb')]({'attributes':['id',_0x93aa('0xd'),_0x93aa('0xe'),_0x93aa('0xf'),_0x93aa('0x10'),_0x93aa('0x11'),'blocked','blockedAt',_0x93aa('0x12')],'where':{'name':_0x1375b2,'role':{'$or':[_0x93aa('0x13'),'user',_0x93aa('0x14')]}}});})[_0x93aa('0xc')](function(_0x4b9940){if(!_0x4b9940||_0x4b9940&&_0x4b9940['name']!==_0x1375b2){throw new Error(_0x93aa('0x15'));}else{_0x33b42a=_0x4b9940;return _0x33b42a;}})['then'](function(){_0x33b42a[_0x93aa('0x16')](_0x4b7ed6,function(_0xc43345,_0x14b85b){var _0x1cd680=_0x33b42a[_0x93aa('0x12')]+0x1;if(_0xc43345){return _0x326308(_0xc43345);}else if(!_0x14b85b){if(_0x33b42a[_0x93aa('0x11')]){return _0x326308(null,![],{'message':_0x93aa('0x15')});}else if(_0xdb1599[_0x93aa('0x17')]>0x0){if(_0x33b42a[_0x93aa('0x18')]){if(_0xdb1599[_0x93aa('0x19')]>0x0){if(moment(_0x33b42a[_0x93aa('0x1a')])['add'](_0xdb1599['blockDuration'],'minutes')>moment()){return _0x326308(null,![],{'message':_0x93aa('0x15')});}else{return utils[_0x93aa('0x1b')](_0x33b42a,_0x1cd680,![],null)[_0x93aa('0xc')](function(){return _0x326308(null,![],{'message':_0x93aa('0x15')});});}}else{return _0x326308(null,![],{'message':_0x93aa('0x15')});}}else{if(_0x1cd680>=_0xdb1599['allowedLoginAttempts']){return utils[_0x93aa('0x1b')](_0x33b42a,0x0,!![],moment())[_0x93aa('0xc')](function(){return _0x326308(null,![],{'message':_0x93aa('0x15')});});}else{return utils[_0x93aa('0x1b')](_0x33b42a,_0x1cd680,![],null)[_0x93aa('0xc')](function(){return _0x326308(null,![],{'message':_0x93aa('0x15')});});}}}else{return _0x326308(null,![],{'message':_0x93aa('0x15')});}}else{if(_0x33b42a[_0x93aa('0x11')]){return _0x326308(null,![],{'message':_0x93aa('0x15')});}else if(_0xdb1599[_0x93aa('0x17')]>0x0){if(_0x33b42a[_0x93aa('0x18')]){if(_0xdb1599[_0x93aa('0x19')]>0x0){if(moment(_0x33b42a[_0x93aa('0x1a')])[_0x93aa('0x1c')](_0xdb1599[_0x93aa('0x19')],'minutes')>moment()){return _0x326308(null,![],{'message':_0x93aa('0x15')});}else{return utils[_0x93aa('0x1b')](_0x33b42a,0x0,![],null)['then'](function(){return utils[_0x93aa('0x1d')](_0x33b42a);})[_0x93aa('0xc')](function(){return _0x326308(null,_0x33b42a);});}}else{return _0x326308(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0x33b42a,0x0,![],null)[_0x93aa('0xc')](function(){return utils[_0x93aa('0x1d')](_0x33b42a);})['then'](function(){return _0x326308(null,_0x33b42a);})[_0x93aa('0x1e')](function(_0x4ab9fc){return _0x326308(null,![],_0x4ab9fc);});}}else{if(_0x33b42a[_0x93aa('0x18')]){return _0x326308(null,![],{'message':_0x93aa('0x15')});}else{return utils[_0x93aa('0x1d')](_0x33b42a)['then'](function(){return _0x326308(null,_0x33b42a);});}}}});})[_0x93aa('0x1e')](function(_0x2d093c){return _0x326308(null,![],_0x2d093c);});}function sendServiceMail(_0x338dc8){return db[_0x93aa('0x1f')][_0x93aa('0x20')]({'where':{'service':!![]},'attributes':['id',_0x93aa('0xd'),_0x93aa('0x21')],'include':[{'model':db[_0x93aa('0x22')],'as':'Smtp'}]})[_0x93aa('0xc')](function(_0x9d4986){if(!_0x9d4986){throw new Error(_0x93aa('0x23'));}var _0x40b219={'tls':{'rejectUnauthorized':![]}};if(_0x9d4986[_0x93aa('0x24')][_0x93aa('0x25')]){_0x40b219[_0x93aa('0x25')]=_0x9d4986[_0x93aa('0x24')][_0x93aa('0x25')];}else{_0x40b219[_0x93aa('0x26')]=_0x9d4986[_0x93aa('0x24')]['host'];_0x40b219[_0x93aa('0x27')]=_0x9d4986[_0x93aa('0x24')][_0x93aa('0x27')];_0x40b219[_0x93aa('0x28')]=_0x9d4986[_0x93aa('0x24')][_0x93aa('0x28')];}if(_0x9d4986[_0x93aa('0x24')][_0x93aa('0x29')]){_0x40b219['auth']={'user':_0x9d4986[_0x93aa('0x24')][_0x93aa('0x2a')],'pass':_0x9d4986[_0x93aa('0x24')][_0x93aa('0x2b')]};}var _0xabdb27={'account':_0x40b219,'message':_[_0x93aa('0x2c')]({'from':util[_0x93aa('0x2d')](_0x93aa('0x2e'),_0x9d4986[_0x93aa('0xd')],_0x9d4986[_0x93aa('0x21')]||_0x9d4986[_0x93aa('0x24')][_0x93aa('0x2a')])},_0x338dc8)};return client[_0x93aa('0x2f')](_0x93aa('0x30'),_0xabdb27);})['then'](function(_0x42576e){if(_0x42576e[_0x93aa('0x31')]){throw new Error(util[_0x93aa('0x2d')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x42576e[_0x93aa('0x31')]['message']||JSON[_0x93aa('0x32')](_0x42576e['error'])));}return!![];});}function handleError(_0x2b967f,_0x2de23a,_0x2f4251){return _0x2b967f[_0x93aa('0x33')](_0x2de23a||0x1f4)['send']({'message':_0x2f4251?_0x2f4251[_0x93aa('0x34')]||_0x2f4251:''});}exports[_0x93aa('0x35')]=function(_0x3848f9,_0x4a9552,_0x30eac2){passport[_0x93aa('0x16')](_0x93aa('0x36'),function(_0x1c8c65,_0xe89953,_0xabc570){var _0x32d657=_0x1c8c65||_0xabc570;if(_0x32d657){return handleError(_0x4a9552,0x191,_0x32d657);}if(!_0xe89953){return handleError(_0x4a9552,0x194,{'message':_0x93aa('0x37')});}else{var _0x396c85={'payload':{'id':_0xe89953['id'],'role':_0xe89953['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x396c85)[_0x93aa('0xc')](function(_0x3c0fec){_0x4a9552[_0x93aa('0x38')]({'id':_0xe89953['id'],'token':_0x3c0fec,'statusCall':'','isAlreadyLogged':_0xe89953[_0x93aa('0x39')]});});}})(_0x3848f9,_0x4a9552,_0x30eac2);};exports[_0x93aa('0x3a')]=function(_0x3c0c33,_0x29aab2,_0x5d9a9f){if(!_0x3c0c33[_0x93aa('0x3b')][_0x93aa('0x21')]){return handleError(_0x29aab2,0x1f4,{'message':_0x93aa('0x3c')});}var _0xbad3c3=rs['generate']();_0x3c0c33[_0x93aa('0x3b')][_0x93aa('0x21')]=_0x3c0c33['body'][_0x93aa('0x21')][_0x93aa('0x3d')]()[_0x93aa('0x3e')]();var _0x52f4be;return db[_0x93aa('0xa')][_0x93aa('0xb')]({'where':{'id':0x1},'attributes':[_0x93aa('0x17'),'blockDuration'],'raw':!![]})[_0x93aa('0xc')](function(_0x57b87b){_0x52f4be=_0x57b87b;return db[_0x93aa('0x3f')]['find']({'where':{'email':_0x3c0c33[_0x93aa('0x3b')][_0x93aa('0x21')]}});})['then'](function(_0x4cfe5c){if(!_0x4cfe5c){throw new Error(_0x93aa('0x40'));}if(_0x4cfe5c[_0x93aa('0x11')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x4cfe5c[_0x93aa('0x18')]){if(moment(_0x4cfe5c[_0x93aa('0x1a')])[_0x93aa('0x1c')](_0x52f4be[_0x93aa('0x19')],_0x93aa('0x41'))>moment()){throw new Error(_0x93aa('0x42'));}else{_0x4cfe5c[_0x93aa('0x18')]=![];_0x4cfe5c[_0x93aa('0x1a')]=null;}}_0x4cfe5c[_0x93aa('0x43')]=_0xbad3c3;_0x4cfe5c[_0x93aa('0x44')]=Date[_0x93aa('0x45')]()+0x36ee80;return _0x4cfe5c[_0x93aa('0x46')]();})[_0x93aa('0xc')](function(){return sendServiceMail({'to':_0x3c0c33[_0x93aa('0x3b')][_0x93aa('0x21')],'subject':_0x93aa('0x47'),'text':_0x93aa('0x48')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x93aa('0x49')+_0x3c0c33[_0x93aa('0x4a')][_0x93aa('0x26')]+'/reset/'+_0xbad3c3+'\x0a\x0a'+_0x93aa('0x4b')});})['then'](function(){_0x29aab2[_0x93aa('0x33')](0xc8)['send']({'message':_0x93aa('0x4c')});})[_0x93aa('0x1e')](function(_0x291ee7){return handleError(_0x29aab2,0x1f4,_0x291ee7);});};exports[_0x93aa('0x4d')]=function(_0x256659,_0x2cee1d,_0x29feb3){return db[_0x93aa('0x3f')][_0x93aa('0x20')]({'where':{'resetPasswordToken':_0x256659[_0x93aa('0x4e')][_0x93aa('0x4f')],'resetPasswordExpires':{'$gt':Date[_0x93aa('0x45')]()}}})[_0x93aa('0xc')](function(_0x5221e3){if(!_0x5221e3){throw new Error(_0x93aa('0x50'));}return db[_0x93aa('0xa')][_0x93aa('0xb')]({'attributes':['id',_0x93aa('0x51'),_0x93aa('0x52'),_0x93aa('0x53')]})[_0x93aa('0xc')](function(_0x11ce76){if(_0x11ce76['securePassword'])authService[_0x93aa('0x54')](_0x256659[_0x93aa('0x3b')][_0x93aa('0xe')]);if(!_0x11ce76[_0x93aa('0x52')]||!_0x5221e3['previousPasswords'])return _0x5221e3;authService[_0x93aa('0x55')](_0x256659[_0x93aa('0x3b')][_0x93aa('0xe')],_0x5221e3[_0x93aa('0x56')],_0x11ce76[_0x93aa('0x53')]);return _0x5221e3;})[_0x93aa('0xc')](function(){_0x5221e3[_0x93aa('0xe')]=_0x256659[_0x93aa('0x3b')][_0x93aa('0xe')];_0x5221e3['resetPasswordToken']=null;_0x5221e3['resetPasswordExpires']=null;return _0x5221e3[_0x93aa('0x46')]();});})[_0x93aa('0xc')](function(){_0x2cee1d[_0x93aa('0x33')](0xc8)['send']({'message':'Password\x20reset!'});})[_0x93aa('0x1e')](function(_0x2f6783){return handleError(_0x2cee1d,0x1f4,_0x2f6783);});};passport[_0x93aa('0x57')](_0x93aa('0x36'),new LocalStrategy({'usernameField':_0x93aa('0xd'),'passwordField':_0x93aa('0xe')},function(_0x446090,_0x3cdb6b,_0x7de3ef){return localAuthenticate(db[_0x93aa('0x3f')],_0x446090,_0x3cdb6b,_0x7de3ef);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index ae79e23..824b4e0 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 _0x4e9f=['exports','./authLocal.controller','post','login','/forgot','/reset/:token','reset'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4e9f,0xa2));var _0xf4e9=function(_0x5f3196,_0x41d61a){_0x5f3196=_0x5f3196-0x0;var _0x5d1188=_0x4e9f[_0x5f3196];return _0x5d1188;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0xf4e9('0x0'));router[_0xf4e9('0x1')]('/',controller[_0xf4e9('0x2')]);router[_0xf4e9('0x1')](_0xf4e9('0x3'),controller['forgot']);router[_0xf4e9('0x1')](_0xf4e9('0x4'),controller[_0xf4e9('0x5')]);module[_0xf4e9('0x6')]=router; \ No newline at end of file +var _0x3958=['/forgot','forgot','/reset/:token','reset','express','./authLocal.controller','post','login'];(function(_0x382491,_0x239cee){var _0x16707f=function(_0x40327b){while(--_0x40327b){_0x382491['push'](_0x382491['shift']());}};_0x16707f(++_0x239cee);}(_0x3958,0x15c));var _0x8395=function(_0x3fa7cd,_0x38da9d){_0x3fa7cd=_0x3fa7cd-0x0;var _0x22b96a=_0x3958[_0x3fa7cd];return _0x22b96a;};'use strict';var express=require(_0x8395('0x0'));var router=express['Router']();var controller=require(_0x8395('0x1'));router[_0x8395('0x2')]('/',controller[_0x8395('0x3')]);router[_0x8395('0x2')](_0x8395('0x4'),controller[_0x8395('0x5')]);router[_0x8395('0x2')](_0x8395('0x6'),controller[_0x8395('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 483388a..edec603 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 _0xafd7=['exports','STRING','BOOLEAN','sequelize'];(function(_0x5aee10,_0x56f9b4){var _0xe4f2e7=function(_0x964ee5){while(--_0x964ee5){_0x5aee10['push'](_0x5aee10['shift']());}};_0xe4f2e7(++_0x56f9b4);}(_0xafd7,0x8b));var _0x7afd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xafd7[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x7afd('0x0'));module[_0x7afd('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x7afd('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x7afd('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x461c=['INTEGER','exports','STRING'];(function(_0x4c3673,_0x222148){var _0xf65418=function(_0x3c6c6e){while(--_0x3c6c6e){_0x4c3673['push'](_0x4c3673['shift']());}};_0xf65418(++_0x222148);}(_0x461c,0x17e));var _0xc461=function(_0x3f860c,_0x3412fb){_0x3f860c=_0x3f860c-0x0;var _0x23b21b=_0x461c[_0x3f860c];return _0x23b21b;};'use strict';var Sequelize=require('sequelize');module[_0xc461('0x0')]={'name':{'type':Sequelize[_0xc461('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xc461('0x1')]},'description':{'type':Sequelize[_0xc461('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xc461('0x2')],'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 dcbf5a7..9e9059c 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 _0xc832=['sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','include','find','create','body','params','addConditions','Condition','ids','getConditions','omit','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x5c8d1e,_0x458578){var _0x99ed5d=function(_0xcd7ab7){while(--_0xcd7ab7){_0x5c8d1e['push'](_0x5c8d1e['shift']());}};_0x99ed5d(++_0x458578);}(_0xc832,0xa4));var _0x2c83=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xc832[_0x4e9628];return _0x27bc8c;};'use strict';var emlformat=require(_0x2c83('0x0'));var rimraf=require(_0x2c83('0x1'));var zipdir=require(_0x2c83('0x2'));var jsonpatch=require(_0x2c83('0x3'));var rp=require(_0x2c83('0x4'));var moment=require(_0x2c83('0x5'));var BPromise=require(_0x2c83('0x6'));var Mustache=require(_0x2c83('0x7'));var util=require('util');var path=require('path');var sox=require(_0x2c83('0x8'));var csv=require(_0x2c83('0x9'));var ejs=require(_0x2c83('0xa'));var fs=require('fs');var fs_extra=require(_0x2c83('0xb'));var _=require(_0x2c83('0xc'));var squel=require('squel');var crypto=require(_0x2c83('0xd'));var jsforce=require(_0x2c83('0xe'));var deskjs=require(_0x2c83('0xf'));var toCsv=require(_0x2c83('0x9'));var querystring=require(_0x2c83('0x10'));var Papa=require(_0x2c83('0x11'));var Redis=require(_0x2c83('0x12'));var authService=require(_0x2c83('0x13'));var qs=require(_0x2c83('0x14'));var as=require(_0x2c83('0x15'));var hardwareService=require(_0x2c83('0x16'));var logger=require(_0x2c83('0x17'))(_0x2c83('0x18'));var utils=require(_0x2c83('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x2c83('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x269852,_0x251714){_0x251714=_0x251714||0xcc;return function(_0x22297e){if(_0x22297e){return _0x269852[_0x2c83('0x1b')](_0x251714);}return _0x269852['status'](_0x251714)['end']();};}function respondWithResult(_0x4e7625,_0x484024){_0x484024=_0x484024||0xc8;return function(_0x5d1e61){if(_0x5d1e61){return _0x4e7625[_0x2c83('0x1c')](_0x484024)['json'](_0x5d1e61);}};}function respondWithFilteredResult(_0xe3448b,_0x3002b4){return function(_0x475592){if(_0x475592){var _0x1dd492=typeof _0x3002b4['offset']===_0x2c83('0x1d')&&typeof _0x3002b4[_0x2c83('0x1e')]===_0x2c83('0x1d');var _0x552141=_0x475592[_0x2c83('0x1f')];var _0x36179e=_0x1dd492?0x0:_0x3002b4[_0x2c83('0x20')];var _0x3b6bce=_0x1dd492?_0x475592[_0x2c83('0x1f')]:_0x3002b4['offset']+_0x3002b4[_0x2c83('0x1e')];var _0x4fe696;if(_0x3b6bce>=_0x552141){_0x3b6bce=_0x552141;_0x4fe696=0xc8;}else{_0x4fe696=0xce;}_0xe3448b['status'](_0x4fe696);return _0xe3448b['set'](_0x2c83('0x21'),_0x36179e+'-'+_0x3b6bce+'/'+_0x552141)[_0x2c83('0x22')](_0x475592);}return null;};}function patchUpdates(_0x511547){return function(_0xd3160c){try{jsonpatch[_0x2c83('0x23')](_0xd3160c,_0x511547,!![]);}catch(_0x390be3){return BPromise[_0x2c83('0x24')](_0x390be3);}return _0xd3160c[_0x2c83('0x25')]();};}function saveUpdates(_0x5070a5,_0x479865){return function(_0x46046a){if(_0x46046a){return _0x46046a[_0x2c83('0x26')](_0x5070a5)[_0x2c83('0x27')](function(_0x550062){return _0x550062;});}return null;};}function removeEntity(_0x127d1e,_0x3a6e88){return function(_0x182608){if(_0x182608){return _0x182608[_0x2c83('0x28')]()[_0x2c83('0x27')](function(){_0x127d1e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x501964,_0x4b55ca){return function(_0x48244c){if(!_0x48244c){_0x501964[_0x2c83('0x1b')](0x194);}return _0x48244c;};}function handleError(_0x59ed29,_0xafdc46){_0xafdc46=_0xafdc46||0x1f4;return function(_0x18cadf){logger[_0x2c83('0x29')](_0x18cadf[_0x2c83('0x2a')]);if(_0x18cadf[_0x2c83('0x2b')]){delete _0x18cadf['name'];}_0x59ed29['status'](_0xafdc46)[_0x2c83('0x2c')](_0x18cadf);};}exports[_0x2c83('0x2d')]=function(_0x559467,_0x203efe){var _0x402560={},_0xc511c5={},_0x3277ee={'count':0x0,'rows':[]};var _0x5221f3=_[_0x2c83('0x2e')](db[_0x2c83('0x2f')][_0x2c83('0x30')],function(_0x54c32b){return{'name':_0x54c32b[_0x2c83('0x31')],'type':_0x54c32b[_0x2c83('0x32')][_0x2c83('0x33')]};});_0xc511c5[_0x2c83('0x34')]=_['map'](_0x5221f3,'name');_0xc511c5[_0x2c83('0x35')]=_[_0x2c83('0x36')](_0x559467['query']);_0xc511c5[_0x2c83('0x37')]=_[_0x2c83('0x38')](_0xc511c5[_0x2c83('0x34')],_0xc511c5[_0x2c83('0x35')]);_0x402560[_0x2c83('0x39')]=_[_0x2c83('0x38')](_0xc511c5[_0x2c83('0x34')],qs['fields'](_0x559467[_0x2c83('0x35')][_0x2c83('0x3a')]));_0x402560[_0x2c83('0x39')]=_0x402560[_0x2c83('0x39')][_0x2c83('0x3b')]?_0x402560['attributes']:_0xc511c5[_0x2c83('0x34')];if(!_0x559467['query'][_0x2c83('0x3c')](_0x2c83('0x3d'))){_0x402560[_0x2c83('0x1e')]=qs[_0x2c83('0x1e')](_0x559467[_0x2c83('0x35')][_0x2c83('0x1e')]);_0x402560[_0x2c83('0x20')]=qs[_0x2c83('0x20')](_0x559467[_0x2c83('0x35')][_0x2c83('0x20')]);}_0x402560[_0x2c83('0x3e')]=qs[_0x2c83('0x3f')](_0x559467['query'][_0x2c83('0x3f')]);_0x402560[_0x2c83('0x40')]=qs[_0x2c83('0x37')](_[_0x2c83('0x41')](_0x559467[_0x2c83('0x35')],_0xc511c5['filters']),_0x5221f3);if(_0x559467[_0x2c83('0x35')][_0x2c83('0x42')]){_0x402560['where']=_[_0x2c83('0x43')](_0x402560[_0x2c83('0x40')],{'$or':_[_0x2c83('0x2e')](_0x5221f3,function(_0x525456){if(_0x525456[_0x2c83('0x32')]!==_0x2c83('0x44')){var _0x2f4fbf={};_0x2f4fbf[_0x525456[_0x2c83('0x2b')]]={'$like':'%'+_0x559467[_0x2c83('0x35')][_0x2c83('0x42')]+'%'};return _0x2f4fbf;}})});}_0x402560=_[_0x2c83('0x43')]({},_0x402560,_0x559467[_0x2c83('0x45')]);var _0x1c0f59={'where':_0x402560['where']};return db[_0x2c83('0x2f')][_0x2c83('0x1f')](_0x1c0f59)[_0x2c83('0x27')](function(_0x2eeb03){_0x3277ee['count']=_0x2eeb03;if(_0x559467[_0x2c83('0x35')][_0x2c83('0x46')]){_0x402560['include']=[{'all':!![]}];}return db[_0x2c83('0x2f')][_0x2c83('0x47')](_0x402560);})[_0x2c83('0x27')](function(_0x3de156){_0x3277ee['rows']=_0x3de156;return _0x3277ee;})[_0x2c83('0x27')](respondWithFilteredResult(_0x203efe,_0x402560))[_0x2c83('0x48')](handleError(_0x203efe,null));};exports[_0x2c83('0x49')]=function(_0x36a912,_0xca6619){var _0x54f422={'raw':![],'where':{'id':_0x36a912['params']['id']}},_0x371336={};_0x371336[_0x2c83('0x34')]=_[_0x2c83('0x36')](db[_0x2c83('0x2f')][_0x2c83('0x30')]);_0x371336[_0x2c83('0x35')]=_['keys'](_0x36a912[_0x2c83('0x35')]);_0x371336[_0x2c83('0x37')]=_[_0x2c83('0x38')](_0x371336[_0x2c83('0x34')],_0x371336[_0x2c83('0x35')]);_0x54f422[_0x2c83('0x39')]=_['intersection'](_0x371336[_0x2c83('0x34')],qs[_0x2c83('0x3a')](_0x36a912[_0x2c83('0x35')][_0x2c83('0x3a')]));_0x54f422['attributes']=_0x54f422[_0x2c83('0x39')][_0x2c83('0x3b')]?_0x54f422[_0x2c83('0x39')]:_0x371336[_0x2c83('0x34')];if(_0x36a912[_0x2c83('0x35')]['includeAll']){_0x54f422[_0x2c83('0x4a')]=[{'all':!![]}];}_0x54f422=_['merge']({},_0x54f422,_0x36a912[_0x2c83('0x45')]);return db[_0x2c83('0x2f')][_0x2c83('0x4b')](_0x54f422)[_0x2c83('0x27')](handleEntityNotFound(_0xca6619,null))[_0x2c83('0x27')](respondWithResult(_0xca6619,null))[_0x2c83('0x48')](handleError(_0xca6619,null));};exports[_0x2c83('0x4c')]=function(_0x4c1eeb,_0x5777b1){return db['Automation'][_0x2c83('0x4c')](_0x4c1eeb[_0x2c83('0x4d')],{})[_0x2c83('0x27')](respondWithResult(_0x5777b1,0xc9))[_0x2c83('0x48')](handleError(_0x5777b1,null));};exports[_0x2c83('0x26')]=function(_0x42c490,_0x14a874){if(_0x42c490['body']['id']){delete _0x42c490[_0x2c83('0x4d')]['id'];}return db[_0x2c83('0x2f')][_0x2c83('0x4b')]({'where':{'id':_0x42c490[_0x2c83('0x4e')]['id']}})[_0x2c83('0x27')](handleEntityNotFound(_0x14a874,null))[_0x2c83('0x27')](saveUpdates(_0x42c490['body'],null))[_0x2c83('0x27')](respondWithResult(_0x14a874,null))[_0x2c83('0x48')](handleError(_0x14a874,null));};exports['destroy']=function(_0x50577f,_0x1a2881){return db[_0x2c83('0x2f')][_0x2c83('0x4b')]({'where':{'id':_0x50577f[_0x2c83('0x4e')]['id']}})[_0x2c83('0x27')](handleEntityNotFound(_0x1a2881,null))[_0x2c83('0x27')](removeEntity(_0x1a2881,null))['catch'](handleError(_0x1a2881,null));};exports[_0x2c83('0x4f')]=function(_0x5821c6,_0x352d0b,_0x3e6a74){return db[_0x2c83('0x50')][_0x2c83('0x4b')]({'where':{'id':_0x5821c6['params']['id']}})[_0x2c83('0x27')](handleEntityNotFound(_0x352d0b,null))[_0x2c83('0x27')](function(_0x34bd03){if(_0x34bd03){return _0x34bd03[_0x2c83('0x4f')](_0x5821c6[_0x2c83('0x4d')][_0x2c83('0x51')],_['omit'](_0x5821c6[_0x2c83('0x4d')],[_0x2c83('0x51'),'id'])||{});}})['then'](respondWithResult(_0x352d0b,null))[_0x2c83('0x48')](handleError(_0x352d0b,null));};exports['getConditions']=function(_0x4acea6,_0x5c2e45,_0x3b0e4e){var _0x12d8a2={};var _0x4a8c1b={};var _0x225bf2;var _0xd628fb;return db['Automation']['findOne']({'where':{'id':_0x4acea6[_0x2c83('0x4e')]['id']}})[_0x2c83('0x27')](handleEntityNotFound(_0x5c2e45,null))[_0x2c83('0x27')](function(_0x577d93){if(_0x577d93){_0x225bf2=_0x577d93;_0x4a8c1b['model']=_['keys'](db[_0x2c83('0x50')][_0x2c83('0x30')]);_0x4a8c1b[_0x2c83('0x35')]=_[_0x2c83('0x36')](_0x4acea6[_0x2c83('0x35')]);_0x4a8c1b[_0x2c83('0x37')]=_[_0x2c83('0x38')](_0x4a8c1b['model'],_0x4a8c1b['query']);_0x12d8a2['attributes']=_[_0x2c83('0x38')](_0x4a8c1b[_0x2c83('0x34')],qs['fields'](_0x4acea6['query'][_0x2c83('0x3a')]));_0x12d8a2[_0x2c83('0x39')]=_0x12d8a2[_0x2c83('0x39')][_0x2c83('0x3b')]?_0x12d8a2[_0x2c83('0x39')]:_0x4a8c1b[_0x2c83('0x34')];_0x12d8a2[_0x2c83('0x3e')]=qs[_0x2c83('0x3f')](_0x4acea6[_0x2c83('0x35')][_0x2c83('0x3f')]);_0x12d8a2['where']=qs[_0x2c83('0x37')](_[_0x2c83('0x41')](_0x4acea6[_0x2c83('0x35')],_0x4a8c1b[_0x2c83('0x37')]));if(_0x4acea6[_0x2c83('0x35')]['filter']){_0x12d8a2[_0x2c83('0x40')]=_[_0x2c83('0x43')](_0x12d8a2[_0x2c83('0x40')],{'$or':_['map'](_0x12d8a2[_0x2c83('0x39')],function(_0x53fd8e){var _0x37b305={};_0x37b305[_0x53fd8e]={'$like':'%'+_0x4acea6[_0x2c83('0x35')][_0x2c83('0x42')]+'%'};return _0x37b305;})});}_0x12d8a2=_[_0x2c83('0x43')]({},_0x12d8a2,_0x4acea6['options']);return _0x225bf2[_0x2c83('0x52')](_0x12d8a2);}})[_0x2c83('0x27')](function(_0x5570aa){if(_0x5570aa){_0xd628fb=_0x5570aa[_0x2c83('0x3b')];if(!_0x4acea6[_0x2c83('0x35')][_0x2c83('0x3c')]('nolimit')){_0x12d8a2[_0x2c83('0x1e')]=qs[_0x2c83('0x1e')](_0x4acea6[_0x2c83('0x35')][_0x2c83('0x1e')]);_0x12d8a2[_0x2c83('0x20')]=qs[_0x2c83('0x20')](_0x4acea6[_0x2c83('0x35')][_0x2c83('0x20')]);}return _0x225bf2[_0x2c83('0x52')](_0x12d8a2);}})[_0x2c83('0x27')](function(_0x468f7f){if(_0x468f7f){return _0x468f7f?{'count':_0xd628fb,'rows':_0x468f7f}:null;}})['then'](respondWithResult(_0x5c2e45,null))['catch'](handleError(_0x5c2e45,null));};exports['addActions']=function(_0xa0dfa8,_0x5d529d,_0x5529c2){return db['Action']['find']({'where':{'id':_0xa0dfa8['params']['id']}})['then'](handleEntityNotFound(_0x5d529d,null))['then'](function(_0x18e83b){if(_0x18e83b){return _0x18e83b['addActions'](_0xa0dfa8[_0x2c83('0x4d')]['ids'],_[_0x2c83('0x53')](_0xa0dfa8['body'],['ids','id'])||{});}})[_0x2c83('0x27')](respondWithResult(_0x5d529d,null))[_0x2c83('0x48')](handleError(_0x5d529d,null));};exports[_0x2c83('0x54')]=function(_0x3ea4b4,_0x2a566e,_0x57c557){var _0x4d8bc6={};var _0x3b7a92={};var _0x1b6a84;var _0x350612;return db[_0x2c83('0x2f')]['findOne']({'where':{'id':_0x3ea4b4[_0x2c83('0x4e')]['id']}})[_0x2c83('0x27')](handleEntityNotFound(_0x2a566e,null))['then'](function(_0x44b002){if(_0x44b002){_0x1b6a84=_0x44b002;_0x3b7a92[_0x2c83('0x34')]=_[_0x2c83('0x36')](db[_0x2c83('0x55')]['rawAttributes']);_0x3b7a92[_0x2c83('0x35')]=_[_0x2c83('0x36')](_0x3ea4b4['query']);_0x3b7a92['filters']=_[_0x2c83('0x38')](_0x3b7a92[_0x2c83('0x34')],_0x3b7a92[_0x2c83('0x35')]);_0x4d8bc6[_0x2c83('0x39')]=_[_0x2c83('0x38')](_0x3b7a92[_0x2c83('0x34')],qs[_0x2c83('0x3a')](_0x3ea4b4[_0x2c83('0x35')][_0x2c83('0x3a')]));_0x4d8bc6[_0x2c83('0x39')]=_0x4d8bc6[_0x2c83('0x39')][_0x2c83('0x3b')]?_0x4d8bc6[_0x2c83('0x39')]:_0x3b7a92[_0x2c83('0x34')];_0x4d8bc6[_0x2c83('0x3e')]=qs['sort'](_0x3ea4b4[_0x2c83('0x35')][_0x2c83('0x3f')]);_0x4d8bc6['where']=qs[_0x2c83('0x37')](_[_0x2c83('0x41')](_0x3ea4b4[_0x2c83('0x35')],_0x3b7a92[_0x2c83('0x37')]));if(_0x3ea4b4['query'][_0x2c83('0x42')]){_0x4d8bc6[_0x2c83('0x40')]=_[_0x2c83('0x43')](_0x4d8bc6[_0x2c83('0x40')],{'$or':_['map'](_0x4d8bc6[_0x2c83('0x39')],function(_0x4696e8){var _0x1ecd70={};_0x1ecd70[_0x4696e8]={'$like':'%'+_0x3ea4b4['query'][_0x2c83('0x42')]+'%'};return _0x1ecd70;})});}_0x4d8bc6=_[_0x2c83('0x43')]({},_0x4d8bc6,_0x3ea4b4[_0x2c83('0x45')]);return _0x1b6a84[_0x2c83('0x54')](_0x4d8bc6);}})[_0x2c83('0x27')](function(_0x4e6109){if(_0x4e6109){_0x350612=_0x4e6109[_0x2c83('0x3b')];if(!_0x3ea4b4[_0x2c83('0x35')][_0x2c83('0x3c')](_0x2c83('0x3d'))){_0x4d8bc6[_0x2c83('0x1e')]=qs[_0x2c83('0x1e')](_0x3ea4b4['query'][_0x2c83('0x1e')]);_0x4d8bc6[_0x2c83('0x20')]=qs[_0x2c83('0x20')](_0x3ea4b4[_0x2c83('0x35')][_0x2c83('0x20')]);}return _0x1b6a84['getActions'](_0x4d8bc6);}})['then'](function(_0x164d81){if(_0x164d81){return _0x164d81?{'count':_0x350612,'rows':_0x164d81}:null;}})['then'](respondWithResult(_0x2a566e,null))['catch'](handleError(_0x2a566e,null));}; \ No newline at end of file +var _0x3c23=['model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','Automation','findAll','params','includeAll','find','catch','create','body','Condition','addConditions','ids','order','getConditions','Action','addActions','getActions','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','json','apply','save','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','key'];(function(_0x4bd5f2,_0x28106f){var _0x11a2db=function(_0x186fff){while(--_0x186fff){_0x4bd5f2['push'](_0x4bd5f2['shift']());}};_0x11a2db(++_0x28106f);}(_0x3c23,0xcd));var _0x33c2=function(_0x5272e0,_0x169ce5){_0x5272e0=_0x5272e0-0x0;var _0xa4fc96=_0x3c23[_0x5272e0];return _0xa4fc96;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x33c2('0x0'));var zipdir=require(_0x33c2('0x1'));var jsonpatch=require(_0x33c2('0x2'));var rp=require(_0x33c2('0x3'));var moment=require(_0x33c2('0x4'));var BPromise=require(_0x33c2('0x5'));var Mustache=require(_0x33c2('0x6'));var util=require(_0x33c2('0x7'));var path=require('path');var sox=require(_0x33c2('0x8'));var csv=require(_0x33c2('0x9'));var ejs=require(_0x33c2('0xa'));var fs=require('fs');var fs_extra=require(_0x33c2('0xb'));var _=require('lodash');var squel=require(_0x33c2('0xc'));var crypto=require(_0x33c2('0xd'));var jsforce=require(_0x33c2('0xe'));var deskjs=require(_0x33c2('0xf'));var toCsv=require(_0x33c2('0x9'));var querystring=require(_0x33c2('0x10'));var Papa=require(_0x33c2('0x11'));var Redis=require(_0x33c2('0x12'));var authService=require(_0x33c2('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x33c2('0x14'));var hardwareService=require(_0x33c2('0x15'));var logger=require(_0x33c2('0x16'))(_0x33c2('0x17'));var utils=require(_0x33c2('0x18'));var config=require(_0x33c2('0x19'));var licenseUtil=require(_0x33c2('0x1a'));var db=require(_0x33c2('0x1b'))['db'];function respondWithStatusCode(_0xc703c7,_0x1a3510){_0x1a3510=_0x1a3510||0xcc;return function(_0x240945){if(_0x240945){return _0xc703c7[_0x33c2('0x1c')](_0x1a3510);}return _0xc703c7[_0x33c2('0x1d')](_0x1a3510)[_0x33c2('0x1e')]();};}function respondWithResult(_0x34f8fd,_0x30c423){_0x30c423=_0x30c423||0xc8;return function(_0x120633){if(_0x120633){return _0x34f8fd[_0x33c2('0x1d')](_0x30c423)['json'](_0x120633);}};}function respondWithFilteredResult(_0x34f442,_0x2b4d54){return function(_0x239078){if(_0x239078){var _0x25f860=typeof _0x2b4d54['offset']===_0x33c2('0x1f')&&typeof _0x2b4d54[_0x33c2('0x20')]===_0x33c2('0x1f');var _0x3274d1=_0x239078[_0x33c2('0x21')];var _0x673f80=_0x25f860?0x0:_0x2b4d54['offset'];var _0x2a1ebe=_0x25f860?_0x239078['count']:_0x2b4d54['offset']+_0x2b4d54[_0x33c2('0x20')];var _0x3ca5db;if(_0x2a1ebe>=_0x3274d1){_0x2a1ebe=_0x3274d1;_0x3ca5db=0xc8;}else{_0x3ca5db=0xce;}_0x34f442[_0x33c2('0x1d')](_0x3ca5db);return _0x34f442['set']('Content-Range',_0x673f80+'-'+_0x2a1ebe+'/'+_0x3274d1)[_0x33c2('0x22')](_0x239078);}return null;};}function patchUpdates(_0x56516d){return function(_0x46da8e){try{jsonpatch[_0x33c2('0x23')](_0x46da8e,_0x56516d,!![]);}catch(_0x184a50){return BPromise['reject'](_0x184a50);}return _0x46da8e[_0x33c2('0x24')]();};}function saveUpdates(_0x497165,_0x5755f3){return function(_0x3c559f){if(_0x3c559f){return _0x3c559f['update'](_0x497165)[_0x33c2('0x25')](function(_0x3a62e2){return _0x3a62e2;});}return null;};}function removeEntity(_0x4b66df,_0x3f6aa1){return function(_0x71c384){if(_0x71c384){return _0x71c384[_0x33c2('0x26')]()[_0x33c2('0x25')](function(){_0x4b66df[_0x33c2('0x1d')](0xcc)[_0x33c2('0x1e')]();});}};}function handleEntityNotFound(_0x2d96e6,_0x274141){return function(_0xcb4e10){if(!_0xcb4e10){_0x2d96e6[_0x33c2('0x1c')](0x194);}return _0xcb4e10;};}function handleError(_0x1fe2d8,_0x34f5a2){_0x34f5a2=_0x34f5a2||0x1f4;return function(_0x46621c){logger[_0x33c2('0x27')](_0x46621c[_0x33c2('0x28')]);if(_0x46621c[_0x33c2('0x29')]){delete _0x46621c[_0x33c2('0x29')];}_0x1fe2d8[_0x33c2('0x1d')](_0x34f5a2)[_0x33c2('0x2a')](_0x46621c);};}exports[_0x33c2('0x2b')]=function(_0x22a092,_0x1b6b6b){var _0x2a1f84={},_0x82b53f={},_0x3ed742={'count':0x0,'rows':[]};var _0x27c0d1=_['map'](db['Automation'][_0x33c2('0x2c')],function(_0x565311){return{'name':_0x565311[_0x33c2('0x2d')],'type':_0x565311['type'][_0x33c2('0x2e')]};});_0x82b53f[_0x33c2('0x2f')]=_[_0x33c2('0x30')](_0x27c0d1,_0x33c2('0x29'));_0x82b53f[_0x33c2('0x31')]=_[_0x33c2('0x32')](_0x22a092[_0x33c2('0x31')]);_0x82b53f['filters']=_[_0x33c2('0x33')](_0x82b53f[_0x33c2('0x2f')],_0x82b53f[_0x33c2('0x31')]);_0x2a1f84[_0x33c2('0x34')]=_[_0x33c2('0x33')](_0x82b53f['model'],qs[_0x33c2('0x35')](_0x22a092[_0x33c2('0x31')]['fields']));_0x2a1f84[_0x33c2('0x34')]=_0x2a1f84['attributes'][_0x33c2('0x36')]?_0x2a1f84[_0x33c2('0x34')]:_0x82b53f[_0x33c2('0x2f')];if(!_0x22a092['query'][_0x33c2('0x37')](_0x33c2('0x38'))){_0x2a1f84[_0x33c2('0x20')]=qs[_0x33c2('0x20')](_0x22a092[_0x33c2('0x31')][_0x33c2('0x20')]);_0x2a1f84[_0x33c2('0x39')]=qs[_0x33c2('0x39')](_0x22a092[_0x33c2('0x31')][_0x33c2('0x39')]);}_0x2a1f84['order']=qs[_0x33c2('0x3a')](_0x22a092[_0x33c2('0x31')][_0x33c2('0x3a')]);_0x2a1f84[_0x33c2('0x3b')]=qs[_0x33c2('0x3c')](_[_0x33c2('0x3d')](_0x22a092[_0x33c2('0x31')],_0x82b53f[_0x33c2('0x3c')]),_0x27c0d1);if(_0x22a092[_0x33c2('0x31')]['filter']){_0x2a1f84[_0x33c2('0x3b')]=_[_0x33c2('0x3e')](_0x2a1f84[_0x33c2('0x3b')],{'$or':_['map'](_0x27c0d1,function(_0x51f086){if(_0x51f086[_0x33c2('0x3f')]!==_0x33c2('0x40')){var _0x1d15fb={};_0x1d15fb[_0x51f086['name']]={'$like':'%'+_0x22a092[_0x33c2('0x31')][_0x33c2('0x41')]+'%'};return _0x1d15fb;}})});}_0x2a1f84=_[_0x33c2('0x3e')]({},_0x2a1f84,_0x22a092[_0x33c2('0x42')]);var _0x20e25f={'where':_0x2a1f84[_0x33c2('0x3b')]};return db[_0x33c2('0x43')][_0x33c2('0x21')](_0x20e25f)[_0x33c2('0x25')](function(_0x3aafe5){_0x3ed742[_0x33c2('0x21')]=_0x3aafe5;if(_0x22a092[_0x33c2('0x31')]['includeAll']){_0x2a1f84['include']=[{'all':!![]}];}return db[_0x33c2('0x43')][_0x33c2('0x44')](_0x2a1f84);})['then'](function(_0xf5a8d){_0x3ed742['rows']=_0xf5a8d;return _0x3ed742;})[_0x33c2('0x25')](respondWithFilteredResult(_0x1b6b6b,_0x2a1f84))['catch'](handleError(_0x1b6b6b,null));};exports['show']=function(_0x5e2fa2,_0x11c59a){var _0x18e8f6={'raw':![],'where':{'id':_0x5e2fa2[_0x33c2('0x45')]['id']}},_0x3ebc76={};_0x3ebc76['model']=_[_0x33c2('0x32')](db[_0x33c2('0x43')][_0x33c2('0x2c')]);_0x3ebc76[_0x33c2('0x31')]=_['keys'](_0x5e2fa2[_0x33c2('0x31')]);_0x3ebc76[_0x33c2('0x3c')]=_[_0x33c2('0x33')](_0x3ebc76[_0x33c2('0x2f')],_0x3ebc76[_0x33c2('0x31')]);_0x18e8f6[_0x33c2('0x34')]=_[_0x33c2('0x33')](_0x3ebc76[_0x33c2('0x2f')],qs[_0x33c2('0x35')](_0x5e2fa2[_0x33c2('0x31')]['fields']));_0x18e8f6[_0x33c2('0x34')]=_0x18e8f6[_0x33c2('0x34')][_0x33c2('0x36')]?_0x18e8f6[_0x33c2('0x34')]:_0x3ebc76[_0x33c2('0x2f')];if(_0x5e2fa2[_0x33c2('0x31')][_0x33c2('0x46')]){_0x18e8f6['include']=[{'all':!![]}];}_0x18e8f6=_[_0x33c2('0x3e')]({},_0x18e8f6,_0x5e2fa2[_0x33c2('0x42')]);return db[_0x33c2('0x43')][_0x33c2('0x47')](_0x18e8f6)[_0x33c2('0x25')](handleEntityNotFound(_0x11c59a,null))[_0x33c2('0x25')](respondWithResult(_0x11c59a,null))[_0x33c2('0x48')](handleError(_0x11c59a,null));};exports['create']=function(_0x3c9f00,_0x23ed44){return db['Automation'][_0x33c2('0x49')](_0x3c9f00[_0x33c2('0x4a')],{})[_0x33c2('0x25')](respondWithResult(_0x23ed44,0xc9))['catch'](handleError(_0x23ed44,null));};exports['update']=function(_0x2cc4bc,_0x5aa45b){if(_0x2cc4bc[_0x33c2('0x4a')]['id']){delete _0x2cc4bc['body']['id'];}return db[_0x33c2('0x43')][_0x33c2('0x47')]({'where':{'id':_0x2cc4bc[_0x33c2('0x45')]['id']}})[_0x33c2('0x25')](handleEntityNotFound(_0x5aa45b,null))['then'](saveUpdates(_0x2cc4bc['body'],null))[_0x33c2('0x25')](respondWithResult(_0x5aa45b,null))[_0x33c2('0x48')](handleError(_0x5aa45b,null));};exports['destroy']=function(_0x39b41a,_0x1e5841){return db[_0x33c2('0x43')][_0x33c2('0x47')]({'where':{'id':_0x39b41a['params']['id']}})[_0x33c2('0x25')](handleEntityNotFound(_0x1e5841,null))[_0x33c2('0x25')](removeEntity(_0x1e5841,null))[_0x33c2('0x48')](handleError(_0x1e5841,null));};exports['addConditions']=function(_0x51a451,_0x346745,_0x157777){return db[_0x33c2('0x4b')][_0x33c2('0x47')]({'where':{'id':_0x51a451[_0x33c2('0x45')]['id']}})['then'](handleEntityNotFound(_0x346745,null))['then'](function(_0x52399a){if(_0x52399a){return _0x52399a[_0x33c2('0x4c')](_0x51a451[_0x33c2('0x4a')]['ids'],_['omit'](_0x51a451[_0x33c2('0x4a')],[_0x33c2('0x4d'),'id'])||{});}})[_0x33c2('0x25')](respondWithResult(_0x346745,null))['catch'](handleError(_0x346745,null));};exports['getConditions']=function(_0x12b7a5,_0x3994eb,_0x39a19a){var _0x2e0430={};var _0xeb46a5={};var _0x3f49ea;var _0x512c7c;return db[_0x33c2('0x43')]['findOne']({'where':{'id':_0x12b7a5[_0x33c2('0x45')]['id']}})[_0x33c2('0x25')](handleEntityNotFound(_0x3994eb,null))[_0x33c2('0x25')](function(_0x3d7185){if(_0x3d7185){_0x3f49ea=_0x3d7185;_0xeb46a5[_0x33c2('0x2f')]=_[_0x33c2('0x32')](db[_0x33c2('0x4b')][_0x33c2('0x2c')]);_0xeb46a5[_0x33c2('0x31')]=_[_0x33c2('0x32')](_0x12b7a5[_0x33c2('0x31')]);_0xeb46a5[_0x33c2('0x3c')]=_[_0x33c2('0x33')](_0xeb46a5[_0x33c2('0x2f')],_0xeb46a5[_0x33c2('0x31')]);_0x2e0430[_0x33c2('0x34')]=_['intersection'](_0xeb46a5[_0x33c2('0x2f')],qs['fields'](_0x12b7a5[_0x33c2('0x31')]['fields']));_0x2e0430[_0x33c2('0x34')]=_0x2e0430[_0x33c2('0x34')][_0x33c2('0x36')]?_0x2e0430['attributes']:_0xeb46a5[_0x33c2('0x2f')];_0x2e0430[_0x33c2('0x4e')]=qs[_0x33c2('0x3a')](_0x12b7a5[_0x33c2('0x31')]['sort']);_0x2e0430[_0x33c2('0x3b')]=qs[_0x33c2('0x3c')](_['pick'](_0x12b7a5[_0x33c2('0x31')],_0xeb46a5[_0x33c2('0x3c')]));if(_0x12b7a5[_0x33c2('0x31')][_0x33c2('0x41')]){_0x2e0430[_0x33c2('0x3b')]=_[_0x33c2('0x3e')](_0x2e0430['where'],{'$or':_['map'](_0x2e0430[_0x33c2('0x34')],function(_0x1f9b28){var _0x11f18e={};_0x11f18e[_0x1f9b28]={'$like':'%'+_0x12b7a5[_0x33c2('0x31')][_0x33c2('0x41')]+'%'};return _0x11f18e;})});}_0x2e0430=_[_0x33c2('0x3e')]({},_0x2e0430,_0x12b7a5[_0x33c2('0x42')]);return _0x3f49ea[_0x33c2('0x4f')](_0x2e0430);}})[_0x33c2('0x25')](function(_0x406480){if(_0x406480){_0x512c7c=_0x406480[_0x33c2('0x36')];if(!_0x12b7a5[_0x33c2('0x31')][_0x33c2('0x37')](_0x33c2('0x38'))){_0x2e0430[_0x33c2('0x20')]=qs[_0x33c2('0x20')](_0x12b7a5['query'][_0x33c2('0x20')]);_0x2e0430[_0x33c2('0x39')]=qs['offset'](_0x12b7a5[_0x33c2('0x31')]['offset']);}return _0x3f49ea[_0x33c2('0x4f')](_0x2e0430);}})[_0x33c2('0x25')](function(_0x361c5d){if(_0x361c5d){return _0x361c5d?{'count':_0x512c7c,'rows':_0x361c5d}:null;}})['then'](respondWithResult(_0x3994eb,null))['catch'](handleError(_0x3994eb,null));};exports['addActions']=function(_0x39e9c3,_0x7b4d97,_0x140682){return db[_0x33c2('0x50')][_0x33c2('0x47')]({'where':{'id':_0x39e9c3['params']['id']}})[_0x33c2('0x25')](handleEntityNotFound(_0x7b4d97,null))[_0x33c2('0x25')](function(_0x1391e6){if(_0x1391e6){return _0x1391e6[_0x33c2('0x51')](_0x39e9c3[_0x33c2('0x4a')][_0x33c2('0x4d')],_['omit'](_0x39e9c3[_0x33c2('0x4a')],['ids','id'])||{});}})[_0x33c2('0x25')](respondWithResult(_0x7b4d97,null))['catch'](handleError(_0x7b4d97,null));};exports[_0x33c2('0x52')]=function(_0x546683,_0x532300,_0x1df5cb){var _0x34382c={};var _0x5c0eba={};var _0x5c9fea;var _0x3f81b0;return db[_0x33c2('0x43')][_0x33c2('0x53')]({'where':{'id':_0x546683[_0x33c2('0x45')]['id']}})[_0x33c2('0x25')](handleEntityNotFound(_0x532300,null))[_0x33c2('0x25')](function(_0x5f4fe0){if(_0x5f4fe0){_0x5c9fea=_0x5f4fe0;_0x5c0eba['model']=_[_0x33c2('0x32')](db[_0x33c2('0x50')][_0x33c2('0x2c')]);_0x5c0eba['query']=_[_0x33c2('0x32')](_0x546683['query']);_0x5c0eba[_0x33c2('0x3c')]=_[_0x33c2('0x33')](_0x5c0eba['model'],_0x5c0eba[_0x33c2('0x31')]);_0x34382c[_0x33c2('0x34')]=_[_0x33c2('0x33')](_0x5c0eba[_0x33c2('0x2f')],qs[_0x33c2('0x35')](_0x546683[_0x33c2('0x31')][_0x33c2('0x35')]));_0x34382c['attributes']=_0x34382c[_0x33c2('0x34')][_0x33c2('0x36')]?_0x34382c[_0x33c2('0x34')]:_0x5c0eba['model'];_0x34382c[_0x33c2('0x4e')]=qs['sort'](_0x546683['query'][_0x33c2('0x3a')]);_0x34382c[_0x33c2('0x3b')]=qs[_0x33c2('0x3c')](_[_0x33c2('0x3d')](_0x546683['query'],_0x5c0eba[_0x33c2('0x3c')]));if(_0x546683[_0x33c2('0x31')]['filter']){_0x34382c[_0x33c2('0x3b')]=_[_0x33c2('0x3e')](_0x34382c[_0x33c2('0x3b')],{'$or':_[_0x33c2('0x30')](_0x34382c[_0x33c2('0x34')],function(_0x5e27c0){var _0x34c3df={};_0x34c3df[_0x5e27c0]={'$like':'%'+_0x546683[_0x33c2('0x31')][_0x33c2('0x41')]+'%'};return _0x34c3df;})});}_0x34382c=_[_0x33c2('0x3e')]({},_0x34382c,_0x546683['options']);return _0x5c9fea[_0x33c2('0x52')](_0x34382c);}})['then'](function(_0x5e0e18){if(_0x5e0e18){_0x3f81b0=_0x5e0e18[_0x33c2('0x36')];if(!_0x546683[_0x33c2('0x31')][_0x33c2('0x37')]('nolimit')){_0x34382c[_0x33c2('0x20')]=qs[_0x33c2('0x20')](_0x546683[_0x33c2('0x31')]['limit']);_0x34382c[_0x33c2('0x39')]=qs[_0x33c2('0x39')](_0x546683['query'][_0x33c2('0x39')]);}return _0x5c9fea['getActions'](_0x34382c);}})[_0x33c2('0x25')](function(_0x3b8567){if(_0x3b8567){return _0x3b8567?{'count':_0x3f81b0,'rows':_0x3b8567}:null;}})[_0x33c2('0x25')](respondWithResult(_0x532300,null))[_0x33c2('0x48')](handleError(_0x532300,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 8a7f323..bd0398f 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 _0x27ae=['tools_automations','util','api','moment','bluebird','path','rimraf','./automation.attributes','exports','define','Automation'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x27ae,0x177));var _0xe27a=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x27ae[_0x2aa0e7];return _0x1472c0;};'use strict';var _=require('lodash');var util=require(_0xe27a('0x0'));var logger=require('../../config/logger')(_0xe27a('0x1'));var moment=require(_0xe27a('0x2'));var BPromise=require(_0xe27a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe27a('0x4'));var rimraf=require(_0xe27a('0x5'));var config=require('../../config/environment');var attributes=require(_0xe27a('0x6'));module[_0xe27a('0x7')]=function(_0x2e4b65,_0xfbb02f){return _0x2e4b65[_0xe27a('0x8')](_0xe27a('0x9'),attributes,{'tableName':_0xe27a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd724=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./automation.attributes','define','tools_automations'];(function(_0x399c0c,_0x453269){var _0x478b03=function(_0x84406f){while(--_0x84406f){_0x399c0c['push'](_0x399c0c['shift']());}};_0x478b03(++_0x453269);}(_0xd724,0x1d9));var _0x4d72=function(_0x44ff0f,_0x83c6cb){_0x44ff0f=_0x44ff0f-0x0;var _0x4c1282=_0xd724[_0x44ff0f];return _0x4c1282;};'use strict';var _=require(_0x4d72('0x0'));var util=require(_0x4d72('0x1'));var logger=require(_0x4d72('0x2'))(_0x4d72('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4d72('0x4'));var fs=require('fs');var path=require(_0x4d72('0x5'));var rimraf=require(_0x4d72('0x6'));var config=require(_0x4d72('0x7'));var attributes=require(_0x4d72('0x8'));module['exports']=function(_0x36e991,_0x3c8236){return _0x36e991[_0x4d72('0x9')]('Automation',attributes,{'tableName':_0x4d72('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index bc93d08..ea7e6f3 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 _0x7177=['stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7177,0x101));var _0x7717=function(_0x16ffe2,_0x2f73ed){_0x16ffe2=_0x16ffe2-0x0;var _0x4193e5=_0x7177[_0x16ffe2];return _0x4193e5;};'use strict';var _=require(_0x7717('0x0'));var util=require('util');var moment=require(_0x7717('0x1'));var BPromise=require('bluebird');var rs=require(_0x7717('0x2'));var fs=require('fs');var Redis=require(_0x7717('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7717('0x4'));var logger=require(_0x7717('0x5'))('rpc');var config=require(_0x7717('0x6'));var jayson=require(_0x7717('0x7'));var client=jayson[_0x7717('0x8')][_0x7717('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe3d36b,_0x3db511,_0xaca6aa){return new BPromise(function(_0x2ded67,_0x29a980){return client[_0x7717('0xa')](_0xe3d36b,_0xaca6aa)[_0x7717('0xb')](function(_0x51d2a6){logger[_0x7717('0xc')](_0x7717('0xd'),_0x3db511,'request\x20sent');logger[_0x7717('0xe')]('Automation,\x20%s,\x20%s,\x20%s',_0x3db511,_0x7717('0xf'),JSON[_0x7717('0x10')](_0x51d2a6));if(_0x51d2a6[_0x7717('0x11')]){if(_0x51d2a6[_0x7717('0x11')][_0x7717('0x12')]===0x1f4){logger['error'](_0x7717('0xd'),_0x3db511,_0x51d2a6[_0x7717('0x11')][_0x7717('0x13')]);return _0x29a980(_0x51d2a6[_0x7717('0x11')][_0x7717('0x13')]);}logger[_0x7717('0x11')](_0x7717('0xd'),_0x3db511,_0x51d2a6['error'][_0x7717('0x13')]);return _0x2ded67(_0x51d2a6[_0x7717('0x11')][_0x7717('0x13')]);}else{logger[_0x7717('0xc')](_0x7717('0xd'),_0x3db511,_0x7717('0xf'));_0x2ded67(_0x51d2a6[_0x7717('0x14')]['message']);}})['catch'](function(_0x4071ff){logger['error'](_0x7717('0xd'),_0x3db511,_0x4071ff);_0x29a980(_0x4071ff);});});} \ No newline at end of file +var _0x79a3=['http','request','then','info','Automation,\x20%s,\x20%s','Automation,\x20%s,\x20%s,\x20%s','error','code','message','lodash','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client'];(function(_0x443d18,_0x2a8df2){var _0x305168=function(_0x3886a9){while(--_0x3886a9){_0x443d18['push'](_0x443d18['shift']());}};_0x305168(++_0x2a8df2);}(_0x79a3,0x80));var _0x379a=function(_0x165eb7,_0x39ec5c){_0x165eb7=_0x165eb7-0x0;var _0x3a5082=_0x79a3[_0x165eb7];return _0x3a5082;};'use strict';var _=require(_0x379a('0x0'));var util=require('util');var moment=require(_0x379a('0x1'));var BPromise=require(_0x379a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x379a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x379a('0x4'));var config=require(_0x379a('0x5'));var jayson=require(_0x379a('0x6'));var client=jayson[_0x379a('0x7')][_0x379a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4eacbe,_0x4d0435,_0x484a91){return new BPromise(function(_0x23e684,_0x11d27d){return client[_0x379a('0x9')](_0x4eacbe,_0x484a91)[_0x379a('0xa')](function(_0x37a440){logger[_0x379a('0xb')](_0x379a('0xc'),_0x4d0435,'request\x20sent');logger['debug'](_0x379a('0xd'),_0x4d0435,'request\x20sent',JSON['stringify'](_0x37a440));if(_0x37a440[_0x379a('0xe')]){if(_0x37a440[_0x379a('0xe')][_0x379a('0xf')]===0x1f4){logger[_0x379a('0xe')]('Automation,\x20%s,\x20%s',_0x4d0435,_0x37a440['error']['message']);return _0x11d27d(_0x37a440[_0x379a('0xe')][_0x379a('0x10')]);}logger[_0x379a('0xe')](_0x379a('0xc'),_0x4d0435,_0x37a440['error']['message']);return _0x23e684(_0x37a440[_0x379a('0xe')][_0x379a('0x10')]);}else{logger[_0x379a('0xb')](_0x379a('0xc'),_0x4d0435,'request\x20sent');_0x23e684(_0x37a440['result'][_0x379a('0x10')]);}})['catch'](function(_0x3124f1){logger[_0x379a('0xe')](_0x379a('0xc'),_0x4d0435,_0x3124f1);_0x11d27d(_0x3124f1);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index f4edcf2..a80b5b0 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 _0xa2ab=['/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','get','show','/:id/conditions','getConditions','/:id/actions','getActions','create','post','addConditions','addActions'];(function(_0x2fd0f0,_0x4b634e){var _0x57f71a=function(_0x400d6f){while(--_0x400d6f){_0x2fd0f0['push'](_0x2fd0f0['shift']());}};_0x57f71a(++_0x4b634e);}(_0xa2ab,0xa7));var _0xba2a=function(_0x382189,_0x4c38a9){_0x382189=_0x382189-0x0;var _0x36f350=_0xa2ab[_0x382189];return _0x36f350;};'use strict';var multer=require(_0xba2a('0x0'));var util=require(_0xba2a('0x1'));var path=require(_0xba2a('0x2'));var timeout=require('connect-timeout');var express=require(_0xba2a('0x3'));var router=express[_0xba2a('0x4')]();var fs_extra=require(_0xba2a('0x5'));var auth=require(_0xba2a('0x6'));var interaction=require(_0xba2a('0x7'));var config=require(_0xba2a('0x8'));var controller=require(_0xba2a('0x9'));router['get']('/',auth[_0xba2a('0xa')](),controller[_0xba2a('0xb')]);router[_0xba2a('0xc')]('/:id',auth[_0xba2a('0xa')](),controller[_0xba2a('0xd')]);router[_0xba2a('0xc')](_0xba2a('0xe'),auth['isAuthenticated'](),controller[_0xba2a('0xf')]);router[_0xba2a('0xc')](_0xba2a('0x10'),auth[_0xba2a('0xa')](),controller[_0xba2a('0x11')]);router['post']('/',auth[_0xba2a('0xa')](),controller[_0xba2a('0x12')]);router[_0xba2a('0x13')](_0xba2a('0xe'),auth['isAuthenticated'](),controller[_0xba2a('0x14')]);router[_0xba2a('0x13')](_0xba2a('0x10'),auth[_0xba2a('0xa')](),controller[_0xba2a('0x15')]);router['put'](_0xba2a('0x16'),auth[_0xba2a('0xa')](),controller[_0xba2a('0x17')]);router[_0xba2a('0x18')]('/:id',auth[_0xba2a('0xa')](),controller[_0xba2a('0x19')]);module[_0xba2a('0x1a')]=router; \ No newline at end of file +var _0x0f50=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','index','/:id','isAuthenticated','getConditions','getActions','post','create','/:id/conditions','addActions','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x14b1e3,_0x44d1ed){var _0x36b443=function(_0x3705fa){while(--_0x3705fa){_0x14b1e3['push'](_0x14b1e3['shift']());}};_0x36b443(++_0x44d1ed);}(_0x0f50,0x1ce));var _0x00f5=function(_0x58be4a,_0x19d2e0){_0x58be4a=_0x58be4a-0x0;var _0x25985c=_0x0f50[_0x58be4a];return _0x25985c;};'use strict';var multer=require(_0x00f5('0x0'));var util=require(_0x00f5('0x1'));var path=require(_0x00f5('0x2'));var timeout=require(_0x00f5('0x3'));var express=require(_0x00f5('0x4'));var router=express[_0x00f5('0x5')]();var fs_extra=require(_0x00f5('0x6'));var auth=require(_0x00f5('0x7'));var interaction=require(_0x00f5('0x8'));var config=require(_0x00f5('0x9'));var controller=require(_0x00f5('0xa'));router[_0x00f5('0xb')]('/',auth['isAuthenticated'](),controller[_0x00f5('0xc')]);router[_0x00f5('0xb')](_0x00f5('0xd'),auth[_0x00f5('0xe')](),controller['show']);router['get']('/:id/conditions',auth['isAuthenticated'](),controller[_0x00f5('0xf')]);router[_0x00f5('0xb')]('/:id/actions',auth[_0x00f5('0xe')](),controller[_0x00f5('0x10')]);router[_0x00f5('0x11')]('/',auth[_0x00f5('0xe')](),controller[_0x00f5('0x12')]);router[_0x00f5('0x11')](_0x00f5('0x13'),auth['isAuthenticated'](),controller['addConditions']);router['post']('/:id/actions',auth[_0x00f5('0xe')](),controller[_0x00f5('0x14')]);router[_0x00f5('0x15')](_0x00f5('0xd'),auth['isAuthenticated'](),controller[_0x00f5('0x16')]);router[_0x00f5('0x17')](_0x00f5('0xd'),auth[_0x00f5('0xe')](),controller[_0x00f5('0x18')]);module[_0x00f5('0x19')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index ad7b1fa..bfb3f12 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 _0x5885=['#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','name','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x507ac5,_0x33aaee){var _0x12c1bc=function(_0x5c953c){while(--_0x5c953c){_0x507ac5['push'](_0x507ac5['shift']());}};_0x12c1bc(++_0x33aaee);}(_0x5885,0x7f));var _0x5588=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5885[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x5588('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x5588('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x5588('0x2')](_0x5588('0x3')),'allowNull':![],'defaultValue':_0x5588('0x3')},'description':{'type':Sequelize[_0x5588('0x4')]},'active':{'type':Sequelize[_0x5588('0x5')],'defaultValue':0x0,'comment':_0x5588('0x6')},'limitCalls':{'type':Sequelize[_0x5588('0x7')](0x4)[_0x5588('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x5588('0x7')](0x3)[_0x5588('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x5588('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5588('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5588('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5588('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x5588('0x7')](0x3)[_0x5588('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5588('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5588('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5588('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5588('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0x5588('0x7')](0x3)[_0x5588('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5588('0xd')},'dialTimezone':{'type':Sequelize[_0x5588('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5588('0x4')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x5588('0x2')]('always',_0x5588('0xe'),_0x5588('0xf')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x5588('0x5')],'defaultValue':0x0,'comment':_0x5588('0x10')},'dialAMDInitialSilence':{'type':Sequelize[_0x5588('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x5588('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5588('0x11')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x5588('0x12')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x5588('0x7')](0x9)[_0x5588('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x5588('0x7')](0x9)[_0x5588('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5588('0x13')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5588('0x7')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5588('0x14')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5588('0x7')](0x9)[_0x5588('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5588('0x15')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5588('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5588('0x7')](0x9)[_0x5588('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5588('0x16')},'dialOrderByScheduledAt':{'type':Sequelize[_0x5588('0x2')]('DESC','ASC'),'defaultValue':_0x5588('0x17')},'dialPrefix':{'type':Sequelize[_0x5588('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5588('0x7')](0x3)[_0x5588('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5588('0x18')},'dialCutDigit':{'type':Sequelize[_0x5588('0x7')](0x3)[_0x5588('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5588('0x19')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5588('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5588('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5588('0x1a')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5588('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5588('0x1b')},'dialDropRetryFrequency':{'type':Sequelize[_0x5588('0x7')](0x5)[_0x5588('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5588('0x1c')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5588('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5588('0x1d')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5588('0x7')](0x5)[_0x5588('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5588('0x1e')},'dialMachineMaxRetry':{'type':Sequelize[_0x5588('0x7')](0x3)[_0x5588('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5588('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5588('0x7')](0x5)[_0x5588('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5588('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5588('0x7')](0x3)[_0x5588('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5588('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5588('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5588('0x22')}}; \ No newline at end of file +var _0x7d5d=['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,*,*,*','always','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#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)','sequelize','exports','STRING','name','ENUM','ivr','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','INTEGER'];(function(_0x47c420,_0x2d67b3){var _0x1b3e28=function(_0x653ad0){while(--_0x653ad0){_0x47c420['push'](_0x47c420['shift']());}};_0x1b3e28(++_0x2d67b3);}(_0x7d5d,0x99));var _0xd7d5=function(_0x4cee58,_0x207356){_0x4cee58=_0x4cee58-0x0;var _0x429867=_0x7d5d[_0x4cee58];return _0x429867;};'use strict';var Sequelize=require(_0xd7d5('0x0'));module[_0xd7d5('0x1')]={'name':{'type':Sequelize[_0xd7d5('0x2')],'unique':_0xd7d5('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xd7d5('0x4')](_0xd7d5('0x5')),'allowNull':![],'defaultValue':_0xd7d5('0x5')},'description':{'type':Sequelize[_0xd7d5('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xd7d5('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xd7d5('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xd7d5('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xd7d5('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xd7d5('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd7d5('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xd7d5('0xa')](0x3)[_0xd7d5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd7d5('0xa')](0x5)[_0xd7d5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd7d5('0xb')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd7d5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd7d5('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0xd7d5('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd7d5('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd7d5('0xa')](0x3)[_0xd7d5('0x7')],'defaultValue':0x3,'comment':_0xd7d5('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd7d5('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xd7d5('0xa')](0x3)[_0xd7d5('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xd7d5('0xf')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xd7d5('0x2')],'defaultValue':_0xd7d5('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xd7d5('0x4')](_0xd7d5('0x11'),'never',_0xd7d5('0x12')),'defaultValue':_0xd7d5('0x11')},'dialAMDActive':{'type':Sequelize[_0xd7d5('0x13')],'defaultValue':0x0,'comment':_0xd7d5('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0xd7d5('0xa')](0x9)[_0xd7d5('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xd7d5('0xa')](0x9)[_0xd7d5('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xd7d5('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd7d5('0xa')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd7d5('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd7d5('0xa')](0x9)[_0xd7d5('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd7d5('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0xd7d5('0xa')](0x9)[_0xd7d5('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd7d5('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd7d5('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd7d5('0xa')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xd7d5('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd7d5('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd7d5('0xa')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd7d5('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0xd7d5('0x4')]('DESC',_0xd7d5('0x1c')),'defaultValue':_0xd7d5('0x1d')},'dialPrefix':{'type':Sequelize[_0xd7d5('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xd7d5('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd7d5('0x1e')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xd7d5('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd7d5('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd7d5('0xa')](0x3)[_0xd7d5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd7d5('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xd7d5('0xa')](0x5)[_0xd7d5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd7d5('0x21')},'dialDropMaxRetry':{'type':Sequelize[_0xd7d5('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd7d5('0x22')},'dialDropRetryFrequency':{'type':Sequelize[_0xd7d5('0xa')](0x5)[_0xd7d5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xd7d5('0xa')](0x3)[_0xd7d5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd7d5('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd7d5('0xa')](0x5)[_0xd7d5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd7d5('0x24')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd7d5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd7d5('0x25')},'dialMachineRetryFrequency':{'type':Sequelize[_0xd7d5('0xa')](0x5)[_0xd7d5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd7d5('0x26')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd7d5('0xa')](0x3)[_0xd7d5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd7d5('0x27')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xd7d5('0xa')](0x5)[_0xd7d5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd7d5('0x28')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 4471c4b..6ac0d54 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 _0x2bfd=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','get','error','name','send','map','Campaign','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','options','catch','show','params','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','createdAt','updatedAt','omit','IvrCampaigns','UserProfileSection','getHoppers','findOne','CmHopper','hasOwnProperty','CampaignId','filter','findAll','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0xb77fe1,_0x39aa4d){var _0x350e00=function(_0x405131){while(--_0x405131){_0xb77fe1['push'](_0xb77fe1['shift']());}};_0x350e00(++_0x39aa4d);}(_0x2bfd,0x18a));var _0xd2bf=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x2bfd[_0x243b2f];return _0xcb3c2d;};'use strict';var emlformat=require(_0xd2bf('0x0'));var rimraf=require(_0xd2bf('0x1'));var zipdir=require(_0xd2bf('0x2'));var jsonpatch=require(_0xd2bf('0x3'));var rp=require(_0xd2bf('0x4'));var moment=require(_0xd2bf('0x5'));var BPromise=require(_0xd2bf('0x6'));var Mustache=require(_0xd2bf('0x7'));var util=require(_0xd2bf('0x8'));var path=require(_0xd2bf('0x9'));var sox=require('sox');var csv=require(_0xd2bf('0xa'));var ejs=require(_0xd2bf('0xb'));var fs=require('fs');var fs_extra=require(_0xd2bf('0xc'));var _=require(_0xd2bf('0xd'));var squel=require(_0xd2bf('0xe'));var crypto=require(_0xd2bf('0xf'));var jsforce=require(_0xd2bf('0x10'));var deskjs=require(_0xd2bf('0x11'));var toCsv=require(_0xd2bf('0xa'));var querystring=require(_0xd2bf('0x12'));var Papa=require(_0xd2bf('0x13'));var Redis=require('ioredis');var authService=require(_0xd2bf('0x14'));var qs=require(_0xd2bf('0x15'));var as=require(_0xd2bf('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd2bf('0x17'));var utils=require(_0xd2bf('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd2bf('0x19'))['db'];function respondWithStatusCode(_0x5420bc,_0x5edcee){_0x5edcee=_0x5edcee||0xcc;return function(_0x5cdd78){if(_0x5cdd78){return _0x5420bc[_0xd2bf('0x1a')](_0x5edcee);}return _0x5420bc['status'](_0x5edcee)['end']();};}function respondWithResult(_0xa33d96,_0x59b5b6){_0x59b5b6=_0x59b5b6||0xc8;return function(_0x373fcb){if(_0x373fcb){return _0xa33d96[_0xd2bf('0x1b')](_0x59b5b6)['json'](_0x373fcb);}};}function respondWithFilteredResult(_0x5a3491,_0xe07062){return function(_0x16159e){if(_0x16159e){var _0x5b70b3=typeof _0xe07062[_0xd2bf('0x1c')]===_0xd2bf('0x1d')&&typeof _0xe07062['limit']===_0xd2bf('0x1d');var _0xd1878c=_0x16159e[_0xd2bf('0x1e')];var _0x463dc9=_0x5b70b3?0x0:_0xe07062[_0xd2bf('0x1c')];var _0x31df74=_0x5b70b3?_0x16159e[_0xd2bf('0x1e')]:_0xe07062['offset']+_0xe07062[_0xd2bf('0x1f')];var _0x1443d7;if(_0x31df74>=_0xd1878c){_0x31df74=_0xd1878c;_0x1443d7=0xc8;}else{_0x1443d7=0xce;}_0x5a3491[_0xd2bf('0x1b')](_0x1443d7);return _0x5a3491[_0xd2bf('0x20')](_0xd2bf('0x21'),_0x463dc9+'-'+_0x31df74+'/'+_0xd1878c)[_0xd2bf('0x22')](_0x16159e);}return null;};}function patchUpdates(_0x314b82){return function(_0x332173){try{jsonpatch['apply'](_0x332173,_0x314b82,!![]);}catch(_0x5a6722){return BPromise[_0xd2bf('0x23')](_0x5a6722);}return _0x332173[_0xd2bf('0x24')]();};}function saveUpdates(_0x2037ab,_0x54d570){return function(_0x417f10){if(_0x417f10){return _0x417f10[_0xd2bf('0x25')](_0x2037ab)[_0xd2bf('0x26')](function(_0x51bddc){return _0x51bddc;});}return null;};}function removeEntity(_0x58b0f4,_0x10a971){return function(_0x42f311){if(_0x42f311){return _0x42f311[_0xd2bf('0x27')]()['then'](function(){var _0x35195a=_0x42f311[_0xd2bf('0x28')]({'plain':!![]});var _0x108881='IvrCampaigns';return db['UserProfileResource'][_0xd2bf('0x27')]({'where':{'type':_0x108881,'resourceId':_0x35195a['id']}})[_0xd2bf('0x26')](function(){return _0x42f311;});})[_0xd2bf('0x26')](function(){_0x58b0f4[_0xd2bf('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf57b81,_0x58de41){return function(_0x2cd4da){if(!_0x2cd4da){_0xf57b81[_0xd2bf('0x1a')](0x194);}return _0x2cd4da;};}function handleError(_0x5a7595,_0x588cbc){_0x588cbc=_0x588cbc||0x1f4;return function(_0x51c666){logger[_0xd2bf('0x29')](_0x51c666['stack']);if(_0x51c666['name']){delete _0x51c666[_0xd2bf('0x2a')];}_0x5a7595[_0xd2bf('0x1b')](_0x588cbc)[_0xd2bf('0x2b')](_0x51c666);};}exports['index']=function(_0x16a3ac,_0x6eb76d){var _0x19e939={},_0x57e765={},_0x30881b={'count':0x0,'rows':[]};var _0x281c9b=_[_0xd2bf('0x2c')](db[_0xd2bf('0x2d')][_0xd2bf('0x2e')],function(_0x13476a){return{'name':_0x13476a['fieldName'],'type':_0x13476a[_0xd2bf('0x2f')][_0xd2bf('0x30')]};});_0x57e765[_0xd2bf('0x31')]=_['map'](_0x281c9b,_0xd2bf('0x2a'));_0x57e765[_0xd2bf('0x32')]=_[_0xd2bf('0x33')](_0x16a3ac[_0xd2bf('0x32')]);_0x57e765[_0xd2bf('0x34')]=_[_0xd2bf('0x35')](_0x57e765[_0xd2bf('0x31')],_0x57e765[_0xd2bf('0x32')]);_0x19e939[_0xd2bf('0x36')]=_['intersection'](_0x57e765[_0xd2bf('0x31')],qs[_0xd2bf('0x37')](_0x16a3ac[_0xd2bf('0x32')][_0xd2bf('0x37')]));_0x19e939[_0xd2bf('0x36')]=_0x19e939['attributes']['length']?_0x19e939[_0xd2bf('0x36')]:_0x57e765[_0xd2bf('0x31')];if(!_0x16a3ac[_0xd2bf('0x32')]['hasOwnProperty'](_0xd2bf('0x38'))){_0x19e939[_0xd2bf('0x1f')]=qs[_0xd2bf('0x1f')](_0x16a3ac[_0xd2bf('0x32')]['limit']);_0x19e939[_0xd2bf('0x1c')]=qs['offset'](_0x16a3ac[_0xd2bf('0x32')][_0xd2bf('0x1c')]);}_0x19e939[_0xd2bf('0x39')]=qs[_0xd2bf('0x3a')](_0x16a3ac[_0xd2bf('0x32')][_0xd2bf('0x3a')]);_0x19e939[_0xd2bf('0x3b')]=qs[_0xd2bf('0x34')](_[_0xd2bf('0x3c')](_0x16a3ac[_0xd2bf('0x32')],_0x57e765[_0xd2bf('0x34')]),_0x281c9b);if(_0x16a3ac[_0xd2bf('0x32')]['filter']){_0x19e939[_0xd2bf('0x3b')]=_[_0xd2bf('0x3d')](_0x19e939['where'],{'$or':_[_0xd2bf('0x2c')](_0x281c9b,function(_0x5d7a0f){if(_0x5d7a0f[_0xd2bf('0x2f')]!=='VIRTUAL'){var _0x489911={};_0x489911[_0x5d7a0f[_0xd2bf('0x2a')]]={'$like':'%'+_0x16a3ac[_0xd2bf('0x32')]['filter']+'%'};return _0x489911;}})});}_0x19e939=_['merge']({},_0x19e939,_0x16a3ac[_0xd2bf('0x3e')]);var _0x52eb8f={'where':_0x19e939['where']};return db[_0xd2bf('0x2d')][_0xd2bf('0x1e')](_0x52eb8f)[_0xd2bf('0x26')](function(_0x9091c){_0x30881b[_0xd2bf('0x1e')]=_0x9091c;if(_0x16a3ac[_0xd2bf('0x32')]['includeAll']){_0x19e939['include']=[{'all':!![]}];}return db[_0xd2bf('0x2d')]['findAll'](_0x19e939);})[_0xd2bf('0x26')](function(_0x5b697a){_0x30881b['rows']=_0x5b697a;return _0x30881b;})[_0xd2bf('0x26')](respondWithFilteredResult(_0x6eb76d,_0x19e939))[_0xd2bf('0x3f')](handleError(_0x6eb76d,null));};exports[_0xd2bf('0x40')]=function(_0x18732f,_0xe3a2cb){var _0x205672={'raw':![],'where':{'id':_0x18732f[_0xd2bf('0x41')]['id']}},_0x21c8fb={};_0x21c8fb['model']=_[_0xd2bf('0x33')](db[_0xd2bf('0x2d')]['rawAttributes']);_0x21c8fb['query']=_[_0xd2bf('0x33')](_0x18732f[_0xd2bf('0x32')]);_0x21c8fb[_0xd2bf('0x34')]=_[_0xd2bf('0x35')](_0x21c8fb[_0xd2bf('0x31')],_0x21c8fb[_0xd2bf('0x32')]);_0x205672[_0xd2bf('0x36')]=_[_0xd2bf('0x35')](_0x21c8fb[_0xd2bf('0x31')],qs[_0xd2bf('0x37')](_0x18732f[_0xd2bf('0x32')][_0xd2bf('0x37')]));_0x205672[_0xd2bf('0x36')]=_0x205672['attributes']['length']?_0x205672[_0xd2bf('0x36')]:_0x21c8fb['model'];if(_0x18732f[_0xd2bf('0x32')][_0xd2bf('0x42')]){_0x205672[_0xd2bf('0x43')]=[{'all':!![]}];}_0x205672=_[_0xd2bf('0x3d')]({},_0x205672,_0x18732f['options']);return db[_0xd2bf('0x2d')][_0xd2bf('0x44')](_0x205672)[_0xd2bf('0x26')](handleEntityNotFound(_0xe3a2cb,null))[_0xd2bf('0x26')](respondWithResult(_0xe3a2cb,null))[_0xd2bf('0x3f')](handleError(_0xe3a2cb,null));};exports[_0xd2bf('0x45')]=function(_0x4f0252,_0x50681b){return db[_0xd2bf('0x2d')]['create'](_0x4f0252[_0xd2bf('0x46')],{})[_0xd2bf('0x26')](function(_0x2f02ab){var _0x520460=_0x4f0252[_0xd2bf('0x47')]['get']({'plain':!![]});if(!_0x520460)throw new Error(_0xd2bf('0x48'));if(_0x520460[_0xd2bf('0x49')]==='user'){var _0x12c8a7=_0x2f02ab[_0xd2bf('0x28')]({'plain':!![]});var _0x5f43b5='IvrCampaigns';return db['UserProfileSection'][_0xd2bf('0x44')]({'where':{'name':_0x5f43b5,'userProfileId':_0x520460['userProfileId']},'raw':!![]})[_0xd2bf('0x26')](function(_0x59f317){if(_0x59f317&&_0x59f317[_0xd2bf('0x4a')]===0x0){return db[_0xd2bf('0x4b')][_0xd2bf('0x45')]({'name':_0x12c8a7[_0xd2bf('0x2a')],'resourceId':_0x12c8a7['id'],'type':_0x59f317['name'],'sectionId':_0x59f317['id']},{})['then'](function(){return _0x2f02ab;});}else{return _0x2f02ab;}})[_0xd2bf('0x3f')](function(_0x28d2d4){logger[_0xd2bf('0x29')](_0xd2bf('0x4c'),_0x28d2d4);throw _0x28d2d4;});}return _0x2f02ab;})[_0xd2bf('0x26')](respondWithResult(_0x50681b,0xc9))[_0xd2bf('0x3f')](handleError(_0x50681b,null));};exports[_0xd2bf('0x4d')]=function(_0x2df752,_0x196284){var _0x1a31e1={'where':{'id':_0x2df752[_0xd2bf('0x41')]['id']}},_0x40784a={};_0x40784a[_0xd2bf('0x31')]=_[_0xd2bf('0x33')](db['Campaign']['rawAttributes']);_0x1a31e1[_0xd2bf('0x36')]=_['intersection'](_0x40784a['model'],qs['fields'](_0x2df752[_0xd2bf('0x32')][_0xd2bf('0x37')]));_0x1a31e1['attributes']=_0x1a31e1[_0xd2bf('0x36')][_0xd2bf('0x4e')]?_0x1a31e1['attributes']:_0x40784a[_0xd2bf('0x31')];if(_0x2df752[_0xd2bf('0x32')][_0xd2bf('0x42')]){_0x1a31e1[_0xd2bf('0x43')]=[{'all':!![]}];}_0x1a31e1=_[_0xd2bf('0x3d')]({},_0x1a31e1,_0x2df752['options']);return db[_0xd2bf('0x2d')]['find'](_0x1a31e1)[_0xd2bf('0x26')](handleEntityNotFound(_0x196284,null))[_0xd2bf('0x26')](function(_0x42cee5){if(_0x42cee5){var _0x12c4cd=_0x42cee5[_0xd2bf('0x28')]({'plain':!![]});_0x12c4cd=qs['omit'](_0x12c4cd,['id',_0xd2bf('0x4f'),_0xd2bf('0x50')]);_0x2df752[_0xd2bf('0x46')]=_[_0xd2bf('0x51')](_0x2df752[_0xd2bf('0x46')],['id',_0xd2bf('0x4f'),_0xd2bf('0x50')]);return db[_0xd2bf('0x2d')][_0xd2bf('0x45')](_[_0xd2bf('0x3d')](_0x12c4cd,_0x2df752[_0xd2bf('0x46')]),{'include':_0x2df752[_0xd2bf('0x32')][_0xd2bf('0x42')]?[{'all':!![]}]:undefined})[_0xd2bf('0x26')](function(_0x4c54bd){var _0x3ad336=_0x2df752[_0xd2bf('0x47')]['get']({'plain':!![]});if(!_0x3ad336)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ad336[_0xd2bf('0x49')]===_0xd2bf('0x47')){var _0x3394cd=_0x4c54bd[_0xd2bf('0x28')]({'plain':!![]});var _0x1e2617=_0xd2bf('0x52');return db[_0xd2bf('0x53')][_0xd2bf('0x44')]({'where':{'name':_0x1e2617,'userProfileId':_0x3ad336['userProfileId']},'raw':!![]})[_0xd2bf('0x26')](function(_0x3759af){if(_0x3759af&&_0x3759af[_0xd2bf('0x4a')]===0x0){return db[_0xd2bf('0x4b')][_0xd2bf('0x45')]({'name':_0x3394cd['name'],'resourceId':_0x3394cd['id'],'type':_0x3759af[_0xd2bf('0x2a')],'sectionId':_0x3759af['id']},{})[_0xd2bf('0x26')](function(){return _0x4c54bd;});}else{return _0x4c54bd;}})[_0xd2bf('0x3f')](function(_0x468c4c){logger[_0xd2bf('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x468c4c);throw _0x468c4c;});}return _0x4c54bd;});}})[_0xd2bf('0x26')](respondWithResult(_0x196284,0xc9))[_0xd2bf('0x3f')](handleError(_0x196284,null));};exports[_0xd2bf('0x25')]=function(_0x379e0d,_0x21ff6d){if(_0x379e0d[_0xd2bf('0x46')]['id']){delete _0x379e0d[_0xd2bf('0x46')]['id'];}return db[_0xd2bf('0x2d')][_0xd2bf('0x44')]({'where':{'id':_0x379e0d['params']['id']}})[_0xd2bf('0x26')](handleEntityNotFound(_0x21ff6d,null))[_0xd2bf('0x26')](saveUpdates(_0x379e0d[_0xd2bf('0x46')],null))[_0xd2bf('0x26')](respondWithResult(_0x21ff6d,null))['catch'](handleError(_0x21ff6d,null));};exports[_0xd2bf('0x27')]=function(_0x80144c,_0xda9ad9){return db[_0xd2bf('0x2d')]['find']({'where':{'id':_0x80144c[_0xd2bf('0x41')]['id']}})['then'](handleEntityNotFound(_0xda9ad9,null))['then'](removeEntity(_0xda9ad9,null))['catch'](handleError(_0xda9ad9,null));};exports[_0xd2bf('0x54')]=function(_0x1dc917,_0x266f12,_0x2a81ef){var _0xa43faf={'raw':!![],'where':{}};var _0x2a15e7={};var _0x2a3b53={'count':0x0,'rows':[]};return db[_0xd2bf('0x2d')][_0xd2bf('0x55')]({'where':{'id':_0x1dc917[_0xd2bf('0x41')]['id']}})[_0xd2bf('0x26')](handleEntityNotFound(_0x266f12,null))[_0xd2bf('0x26')](function(_0x42e6f8){if(_0x42e6f8){_0x2a15e7[_0xd2bf('0x31')]=_[_0xd2bf('0x33')](db[_0xd2bf('0x56')]['rawAttributes']);_0x2a15e7[_0xd2bf('0x32')]=_[_0xd2bf('0x33')](_0x1dc917['query']);_0x2a15e7[_0xd2bf('0x34')]=_['intersection'](_0x2a15e7[_0xd2bf('0x31')],_0x2a15e7['query']);_0xa43faf[_0xd2bf('0x36')]=_[_0xd2bf('0x35')](_0x2a15e7[_0xd2bf('0x31')],qs[_0xd2bf('0x37')](_0x1dc917[_0xd2bf('0x32')][_0xd2bf('0x37')]));_0xa43faf[_0xd2bf('0x36')]=_0xa43faf[_0xd2bf('0x36')][_0xd2bf('0x4e')]?_0xa43faf[_0xd2bf('0x36')]:_0x2a15e7[_0xd2bf('0x31')];if(!_0x1dc917[_0xd2bf('0x32')][_0xd2bf('0x57')](_0xd2bf('0x38'))){_0xa43faf['limit']=qs['limit'](_0x1dc917[_0xd2bf('0x32')][_0xd2bf('0x1f')]);_0xa43faf[_0xd2bf('0x1c')]=qs[_0xd2bf('0x1c')](_0x1dc917[_0xd2bf('0x32')][_0xd2bf('0x1c')]);}_0xa43faf['order']=qs[_0xd2bf('0x3a')](_0x1dc917[_0xd2bf('0x32')][_0xd2bf('0x3a')]);_0xa43faf[_0xd2bf('0x3b')]=qs[_0xd2bf('0x34')](_[_0xd2bf('0x3c')](_0x1dc917['query'],_0x2a15e7['filters']));_0xa43faf[_0xd2bf('0x3b')][_0xd2bf('0x58')]=_0x42e6f8['id'];if(_0x1dc917['query'][_0xd2bf('0x59')]){_0xa43faf[_0xd2bf('0x3b')]=_[_0xd2bf('0x3d')](_0xa43faf[_0xd2bf('0x3b')],{'$or':_[_0xd2bf('0x2c')](_0xa43faf[_0xd2bf('0x36')],function(_0x55b8d9){var _0x5953cc={};_0x5953cc[_0x55b8d9]={'$like':'%'+_0x1dc917['query'][_0xd2bf('0x59')]+'%'};return _0x5953cc;})});}_0xa43faf=_[_0xd2bf('0x3d')]({},_0xa43faf,_0x1dc917['options']);return db[_0xd2bf('0x56')][_0xd2bf('0x1e')]({'where':_0xa43faf[_0xd2bf('0x3b')]})[_0xd2bf('0x26')](function(_0x5a0250){_0x2a3b53[_0xd2bf('0x1e')]=_0x5a0250;if(_0x1dc917[_0xd2bf('0x32')][_0xd2bf('0x42')]){_0xa43faf[_0xd2bf('0x43')]=[{'all':!![]}];}return db['CmHopper'][_0xd2bf('0x5a')](_0xa43faf);})[_0xd2bf('0x26')](function(_0x11ce3a){_0x2a3b53[_0xd2bf('0x5b')]=_0x11ce3a;return _0x2a3b53;});}})[_0xd2bf('0x26')](respondWithFilteredResult(_0x266f12,_0xa43faf))[_0xd2bf('0x3f')](handleError(_0x266f12,null));};exports[_0xd2bf('0x5c')]=function(_0x2ca41a,_0x2ce1fd,_0xa84d62){var _0x5bfe1d={'raw':!![],'where':{}};var _0x3a33d8={};var _0x1b3823={'count':0x0,'rows':[]};return db['Campaign'][_0xd2bf('0x55')]({'where':{'id':_0x2ca41a[_0xd2bf('0x41')]['id']}})['then'](handleEntityNotFound(_0x2ce1fd,null))[_0xd2bf('0x26')](function(_0x549334){if(_0x549334){_0x3a33d8[_0xd2bf('0x31')]=_['keys'](db['CmHopperHistory'][_0xd2bf('0x2e')]);_0x3a33d8[_0xd2bf('0x32')]=_[_0xd2bf('0x33')](_0x2ca41a['query']);_0x3a33d8['filters']=_['intersection'](_0x3a33d8[_0xd2bf('0x31')],_0x3a33d8[_0xd2bf('0x32')]);_0x5bfe1d['attributes']=_['intersection'](_0x3a33d8[_0xd2bf('0x31')],qs[_0xd2bf('0x37')](_0x2ca41a['query'][_0xd2bf('0x37')]));_0x5bfe1d['attributes']=_0x5bfe1d[_0xd2bf('0x36')][_0xd2bf('0x4e')]?_0x5bfe1d[_0xd2bf('0x36')]:_0x3a33d8['model'];if(!_0x2ca41a['query'][_0xd2bf('0x57')]('nolimit')){_0x5bfe1d[_0xd2bf('0x1f')]=qs['limit'](_0x2ca41a['query']['limit']);_0x5bfe1d[_0xd2bf('0x1c')]=qs[_0xd2bf('0x1c')](_0x2ca41a[_0xd2bf('0x32')][_0xd2bf('0x1c')]);}_0x5bfe1d[_0xd2bf('0x39')]=qs[_0xd2bf('0x3a')](_0x2ca41a[_0xd2bf('0x32')][_0xd2bf('0x3a')]);_0x5bfe1d['where']=qs[_0xd2bf('0x34')](_[_0xd2bf('0x3c')](_0x2ca41a[_0xd2bf('0x32')],_0x3a33d8[_0xd2bf('0x34')]));_0x5bfe1d[_0xd2bf('0x3b')][_0xd2bf('0x58')]=_0x549334['id'];if(_0x2ca41a['query']['filter']){_0x5bfe1d['where']=_[_0xd2bf('0x3d')](_0x5bfe1d[_0xd2bf('0x3b')],{'$or':_[_0xd2bf('0x2c')](_0x5bfe1d[_0xd2bf('0x36')],function(_0x480bea){var _0x380cb4={};_0x380cb4[_0x480bea]={'$like':'%'+_0x2ca41a[_0xd2bf('0x32')][_0xd2bf('0x59')]+'%'};return _0x380cb4;})});}_0x5bfe1d=_['merge']({},_0x5bfe1d,_0x2ca41a['options']);return db[_0xd2bf('0x5d')]['count']({'where':_0x5bfe1d['where']})[_0xd2bf('0x26')](function(_0x589d84){_0x1b3823['count']=_0x589d84;if(_0x2ca41a['query'][_0xd2bf('0x42')]){_0x5bfe1d['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xd2bf('0x5a')](_0x5bfe1d);})[_0xd2bf('0x26')](function(_0x509942){_0x1b3823[_0xd2bf('0x5b')]=_0x509942;return _0x1b3823;});}})[_0xd2bf('0x26')](respondWithFilteredResult(_0x2ce1fd,_0x5bfe1d))[_0xd2bf('0x3f')](handleError(_0x2ce1fd,null));};exports[_0xd2bf('0x5e')]=function(_0x571c86,_0x2a9e71,_0x5df8a5){var _0x9cbcdf={'raw':!![],'where':{}};var _0x1421e8={};var _0x414626={'count':0x0,'rows':[]};return db[_0xd2bf('0x2d')][_0xd2bf('0x55')]({'where':{'id':_0x571c86[_0xd2bf('0x41')]['id']}})[_0xd2bf('0x26')](handleEntityNotFound(_0x2a9e71,null))[_0xd2bf('0x26')](function(_0x1a3d24){if(_0x1a3d24){_0x1421e8[_0xd2bf('0x31')]=_[_0xd2bf('0x33')](db[_0xd2bf('0x5f')][_0xd2bf('0x2e')]);_0x1421e8[_0xd2bf('0x32')]=_[_0xd2bf('0x33')](_0x571c86[_0xd2bf('0x32')]);_0x1421e8[_0xd2bf('0x34')]=_[_0xd2bf('0x35')](_0x1421e8[_0xd2bf('0x31')],_0x1421e8[_0xd2bf('0x32')]);_0x9cbcdf[_0xd2bf('0x36')]=_[_0xd2bf('0x35')](_0x1421e8[_0xd2bf('0x31')],qs['fields'](_0x571c86['query'][_0xd2bf('0x37')]));_0x9cbcdf[_0xd2bf('0x36')]=_0x9cbcdf['attributes']['length']?_0x9cbcdf[_0xd2bf('0x36')]:_0x1421e8[_0xd2bf('0x31')];if(!_0x571c86[_0xd2bf('0x32')][_0xd2bf('0x57')](_0xd2bf('0x38'))){_0x9cbcdf[_0xd2bf('0x1f')]=qs['limit'](_0x571c86[_0xd2bf('0x32')][_0xd2bf('0x1f')]);_0x9cbcdf[_0xd2bf('0x1c')]=qs['offset'](_0x571c86[_0xd2bf('0x32')][_0xd2bf('0x1c')]);}_0x9cbcdf[_0xd2bf('0x39')]=qs[_0xd2bf('0x3a')](_0x571c86[_0xd2bf('0x32')][_0xd2bf('0x3a')]);_0x9cbcdf[_0xd2bf('0x3b')]=qs['filters'](_['pick'](_0x571c86[_0xd2bf('0x32')],_0x1421e8[_0xd2bf('0x34')]));_0x9cbcdf[_0xd2bf('0x3b')][_0xd2bf('0x58')]=_0x1a3d24['id'];if(_0x571c86[_0xd2bf('0x32')]['filter']){_0x9cbcdf['where']=_[_0xd2bf('0x3d')](_0x9cbcdf[_0xd2bf('0x3b')],{'$or':_[_0xd2bf('0x2c')](_0x9cbcdf[_0xd2bf('0x36')],function(_0x54c046){var _0x248598={};_0x248598[_0x54c046]={'$like':'%'+_0x571c86['query'][_0xd2bf('0x59')]+'%'};return _0x248598;})});}_0x9cbcdf=_[_0xd2bf('0x3d')]({},_0x9cbcdf,_0x571c86['options']);return db['CmHopperFinal'][_0xd2bf('0x1e')]({'where':_0x9cbcdf[_0xd2bf('0x3b')]})[_0xd2bf('0x26')](function(_0x5782d7){_0x414626[_0xd2bf('0x1e')]=_0x5782d7;if(_0x571c86[_0xd2bf('0x32')][_0xd2bf('0x42')]){_0x9cbcdf[_0xd2bf('0x43')]=[{'all':!![]}];}return db[_0xd2bf('0x5f')][_0xd2bf('0x5a')](_0x9cbcdf);})[_0xd2bf('0x26')](function(_0x58477e){_0x414626[_0xd2bf('0x5b')]=_0x58477e;return _0x414626;});}})[_0xd2bf('0x26')](respondWithFilteredResult(_0x2a9e71,_0x9cbcdf))[_0xd2bf('0x3f')](handleError(_0x2a9e71,null));};exports[_0xd2bf('0x60')]=function(_0x2f5b37,_0x155b0d,_0x5bace0){var _0x51fc2b={'raw':!![],'where':{}};var _0x4c5010={};var _0xbacc31={'count':0x0,'rows':[]};return db[_0xd2bf('0x2d')]['findOne']({'where':{'id':_0x2f5b37[_0xd2bf('0x41')]['id']}})[_0xd2bf('0x26')](handleEntityNotFound(_0x155b0d,null))['then'](function(_0x404389){if(_0x404389){_0x4c5010[_0xd2bf('0x31')]=_['keys'](db[_0xd2bf('0x61')]['rawAttributes']);_0x4c5010[_0xd2bf('0x32')]=_['keys'](_0x2f5b37[_0xd2bf('0x32')]);_0x4c5010['filters']=_[_0xd2bf('0x35')](_0x4c5010[_0xd2bf('0x31')],_0x4c5010[_0xd2bf('0x32')]);_0x51fc2b['attributes']=_[_0xd2bf('0x35')](_0x4c5010[_0xd2bf('0x31')],qs['fields'](_0x2f5b37['query'][_0xd2bf('0x37')]));_0x51fc2b[_0xd2bf('0x36')]=_0x51fc2b[_0xd2bf('0x36')]['length']?_0x51fc2b[_0xd2bf('0x36')]:_0x4c5010[_0xd2bf('0x31')];if(!_0x2f5b37[_0xd2bf('0x32')][_0xd2bf('0x57')](_0xd2bf('0x38'))){_0x51fc2b[_0xd2bf('0x1f')]=qs[_0xd2bf('0x1f')](_0x2f5b37['query']['limit']);_0x51fc2b['offset']=qs['offset'](_0x2f5b37[_0xd2bf('0x32')][_0xd2bf('0x1c')]);}_0x51fc2b[_0xd2bf('0x39')]=qs[_0xd2bf('0x3a')](_0x2f5b37['query']['sort']);_0x51fc2b['where']=qs[_0xd2bf('0x34')](_[_0xd2bf('0x3c')](_0x2f5b37[_0xd2bf('0x32')],_0x4c5010[_0xd2bf('0x34')]));_0x51fc2b['where'][_0xd2bf('0x58')]=_0x404389['id'];if(_0x2f5b37[_0xd2bf('0x32')]['filter']){_0x51fc2b['where']=_['merge'](_0x51fc2b[_0xd2bf('0x3b')],{'$or':_[_0xd2bf('0x2c')](_0x51fc2b[_0xd2bf('0x36')],function(_0x1ab884){var _0x442bca={};_0x442bca[_0x1ab884]={'$like':'%'+_0x2f5b37[_0xd2bf('0x32')][_0xd2bf('0x59')]+'%'};return _0x442bca;})});}_0x51fc2b=_[_0xd2bf('0x3d')]({},_0x51fc2b,_0x2f5b37[_0xd2bf('0x3e')]);return db[_0xd2bf('0x61')][_0xd2bf('0x1e')]({'where':_0x51fc2b[_0xd2bf('0x3b')]})[_0xd2bf('0x26')](function(_0x8ce225){_0xbacc31['count']=_0x8ce225;if(_0x2f5b37[_0xd2bf('0x32')][_0xd2bf('0x42')]){_0x51fc2b[_0xd2bf('0x43')]=[{'all':!![]}];}return db[_0xd2bf('0x61')]['findAll'](_0x51fc2b);})[_0xd2bf('0x26')](function(_0x42ec60){_0xbacc31['rows']=_0x42ec60;return _0xbacc31;});}})[_0xd2bf('0x26')](respondWithFilteredResult(_0x155b0d,_0x51fc2b))['catch'](handleError(_0x155b0d,null));};exports[_0xd2bf('0x62')]=function(_0x169227,_0x23050b,_0x1ae136){var _0x2693bb={};var _0x9034a3={};var _0x3d7868;var _0x5a99a5;return db[_0xd2bf('0x2d')][_0xd2bf('0x55')]({'where':{'id':_0x169227[_0xd2bf('0x41')]['id']}})['then'](handleEntityNotFound(_0x23050b,null))[_0xd2bf('0x26')](function(_0x6930bd){if(_0x6930bd){_0x3d7868=_0x6930bd;_0x9034a3['model']=_['keys'](db[_0xd2bf('0x63')][_0xd2bf('0x2e')]);_0x9034a3['query']=_[_0xd2bf('0x33')](_0x169227['query']);_0x9034a3['filters']=_['intersection'](_0x9034a3[_0xd2bf('0x31')],_0x9034a3[_0xd2bf('0x32')]);_0x2693bb[_0xd2bf('0x36')]=_['intersection'](_0x9034a3[_0xd2bf('0x31')],qs[_0xd2bf('0x37')](_0x169227[_0xd2bf('0x32')][_0xd2bf('0x37')]));_0x2693bb[_0xd2bf('0x36')]=_0x2693bb[_0xd2bf('0x36')][_0xd2bf('0x4e')]?_0x2693bb[_0xd2bf('0x36')]:_0x9034a3[_0xd2bf('0x31')];_0x2693bb[_0xd2bf('0x39')]=qs[_0xd2bf('0x3a')](_0x169227[_0xd2bf('0x32')][_0xd2bf('0x3a')]);_0x2693bb[_0xd2bf('0x3b')]=qs[_0xd2bf('0x34')](_[_0xd2bf('0x3c')](_0x169227[_0xd2bf('0x32')],_0x9034a3[_0xd2bf('0x34')]));if(_0x169227[_0xd2bf('0x32')][_0xd2bf('0x59')]){_0x2693bb[_0xd2bf('0x3b')]=_['merge'](_0x2693bb['where'],{'$or':_[_0xd2bf('0x2c')](_0x2693bb[_0xd2bf('0x36')],function(_0x1bd2c1){var _0x4acb6c={};_0x4acb6c[_0x1bd2c1]={'$like':'%'+_0x169227[_0xd2bf('0x32')][_0xd2bf('0x59')]+'%'};return _0x4acb6c;})});}_0x2693bb=_['merge']({},_0x2693bb,_0x169227['options']);return _0x3d7868[_0xd2bf('0x62')](_0x2693bb);}})['then'](function(_0x4b3b57){if(_0x4b3b57){_0x5a99a5=_0x4b3b57['length'];if(!_0x169227[_0xd2bf('0x32')][_0xd2bf('0x57')]('nolimit')){_0x2693bb[_0xd2bf('0x1f')]=qs['limit'](_0x169227['query'][_0xd2bf('0x1f')]);_0x2693bb[_0xd2bf('0x1c')]=qs[_0xd2bf('0x1c')](_0x169227[_0xd2bf('0x32')]['offset']);}return _0x3d7868['getLists'](_0x2693bb);}})[_0xd2bf('0x26')](function(_0x259351){if(_0x259351){return _0x259351?{'count':_0x5a99a5,'rows':_0x259351}:null;}})[_0xd2bf('0x26')](respondWithResult(_0x23050b,null))[_0xd2bf('0x3f')](handleError(_0x23050b,null));};exports[_0xd2bf('0x64')]=function(_0x18c75a,_0x3e9e7b,_0x1ac3c2){var _0x79f4b8,_0x3f7efd;return db[_0xd2bf('0x2d')][_0xd2bf('0x44')]({'where':{'id':_0x18c75a[_0xd2bf('0x41')]['id']}})[_0xd2bf('0x26')](handleEntityNotFound(_0x3e9e7b,null))[_0xd2bf('0x26')](function(_0x124d22){if(_0x124d22){_0x3f7efd=_0x124d22;return _0x124d22['addLists'](_0x18c75a[_0xd2bf('0x46')][_0xd2bf('0x65')],_['omit'](_0x18c75a[_0xd2bf('0x46')],['ids','id'])||{});}return null;})[_0xd2bf('0x66')](function(_0xf9ab1){var _0x44a93a;_0x79f4b8=_0xf9ab1||[];var _0x340f48=[];if(_0xf9ab1){for(var _0x595a32=0x0;_0x595a32<_0xf9ab1['length'];_0x595a32+=0x1){var _0x28b416=_0xf9ab1[_0x595a32][_0xd2bf('0x28')]({'plain':!![]});_0x3f7efd[_0xd2bf('0x67')]=_0x18c75a[_0xd2bf('0x46')][_0xd2bf('0x67')]?_0x18c75a['body'][_0xd2bf('0x67')]:_0x3f7efd['dialCheckDuplicateType'];switch(_0x3f7efd[_0xd2bf('0x67')]){case'always':_0x44a93a=squel[_0xd2bf('0x68')]()[_0xd2bf('0x69')](_0xd2bf('0x6a'))[_0xd2bf('0x6b')]([_0xd2bf('0x6c'),_0xd2bf('0x6d'),_0xd2bf('0x6e'),_0xd2bf('0x6f'),_0xd2bf('0x58'),_0xd2bf('0x4f'),_0xd2bf('0x50')],squel[_0xd2bf('0x70')]()[_0xd2bf('0x71')](_0xd2bf('0x6c'),_0xd2bf('0x6c'))['field'](_0xd2bf('0x72'),_0xd2bf('0x6d'))['field']('id','ContactId')['field'](_0x28b416['CmListId']['toString'](),_0xd2bf('0x6f'))[_0xd2bf('0x71')](_0x18c75a[_0xd2bf('0x41')]['id'][_0xd2bf('0x73')](),'CampaignId')[_0xd2bf('0x71')]('NOW()',_0xd2bf('0x4f'))[_0xd2bf('0x71')]('NOW()',_0xd2bf('0x50'))[_0xd2bf('0x74')](_0xd2bf('0x75'))[_0xd2bf('0x3b')](_0xd2bf('0x76'))[_0xd2bf('0x3b')](_0xd2bf('0x77'),_0x28b416[_0xd2bf('0x78')][_0xd2bf('0x73')]())[_0xd2bf('0x3b')](_0xd2bf('0x79'))[_0xd2bf('0x3b')](_0xd2bf('0x7a'),squel['select']()[_0xd2bf('0x71')]('COALESCE(calleridnum,\x27\x27)')[_0xd2bf('0x74')](_0xd2bf('0x7b'))[_0xd2bf('0x3b')]('CampaignId\x20=\x20?',_0x18c75a['params']['id'][_0xd2bf('0x73')]()))[_0xd2bf('0x3b')](_0xd2bf('0x7a'),squel[_0xd2bf('0x70')]()[_0xd2bf('0x71')](_0xd2bf('0x7c'))[_0xd2bf('0x74')](_0xd2bf('0x6a'))[_0xd2bf('0x3b')](_0xd2bf('0x7d'),_0x18c75a[_0xd2bf('0x41')]['id'][_0xd2bf('0x73')]())))[_0xd2bf('0x73')]();break;case _0xd2bf('0x7e'):_0x44a93a=squel[_0xd2bf('0x68')]()['into'](_0xd2bf('0x6a'))[_0xd2bf('0x6b')]([_0xd2bf('0x6c'),'scheduledAt',_0xd2bf('0x6e'),_0xd2bf('0x6f'),_0xd2bf('0x58'),_0xd2bf('0x4f'),_0xd2bf('0x50')],squel['select']()[_0xd2bf('0x71')](_0xd2bf('0x6c'),_0xd2bf('0x6c'))[_0xd2bf('0x71')](_0xd2bf('0x72'),'scheduledAt')[_0xd2bf('0x71')]('id',_0xd2bf('0x6e'))[_0xd2bf('0x71')](_0x28b416['CmListId'][_0xd2bf('0x73')](),_0xd2bf('0x6f'))[_0xd2bf('0x71')](_0x18c75a[_0xd2bf('0x41')]['id'][_0xd2bf('0x73')](),'CampaignId')[_0xd2bf('0x71')](_0xd2bf('0x72'),_0xd2bf('0x4f'))['field'](_0xd2bf('0x72'),_0xd2bf('0x50'))[_0xd2bf('0x74')](_0xd2bf('0x75'))['where'](_0xd2bf('0x76'))['where']('ListId\x20=\x20?',_0x28b416[_0xd2bf('0x78')][_0xd2bf('0x73')]())['where'](_0xd2bf('0x79'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xd2bf('0x70')]()[_0xd2bf('0x71')](_0xd2bf('0x7c'))[_0xd2bf('0x74')](_0xd2bf('0x6a'))['where'](_0xd2bf('0x7d'),_0x18c75a['params']['id'][_0xd2bf('0x73')]())))[_0xd2bf('0x73')]();break;default:_0x44a93a=squel[_0xd2bf('0x68')]()[_0xd2bf('0x69')](_0xd2bf('0x6a'))[_0xd2bf('0x6b')](['phone',_0xd2bf('0x6d'),'ContactId',_0xd2bf('0x6f'),_0xd2bf('0x58'),_0xd2bf('0x4f'),'updatedAt'],squel['select']()[_0xd2bf('0x71')](_0xd2bf('0x6c'),_0xd2bf('0x6c'))[_0xd2bf('0x71')](_0xd2bf('0x72'),'scheduledAt')[_0xd2bf('0x71')]('id','ContactId')[_0xd2bf('0x71')](_0x28b416['CmListId'][_0xd2bf('0x73')](),_0xd2bf('0x6f'))['field'](_0x18c75a[_0xd2bf('0x41')]['id'][_0xd2bf('0x73')](),'CampaignId')['field'](_0xd2bf('0x72'),_0xd2bf('0x4f'))[_0xd2bf('0x71')]('NOW()',_0xd2bf('0x50'))[_0xd2bf('0x74')](_0xd2bf('0x75'))[_0xd2bf('0x3b')](_0xd2bf('0x76'))[_0xd2bf('0x3b')](_0xd2bf('0x77'),_0x28b416[_0xd2bf('0x78')]['toString']())[_0xd2bf('0x3b')](_0xd2bf('0x79')))['toString']();}_0x340f48[_0xd2bf('0x7f')](db[_0xd2bf('0x80')][_0xd2bf('0x32')](_0x44a93a));}return BPromise[_0xd2bf('0x81')](_0x340f48);}})[_0xd2bf('0x26')](function(){return _0x79f4b8;})['then'](respondWithResult(_0x3e9e7b,null))[_0xd2bf('0x3f')](handleError(_0x3e9e7b,null));};exports[_0xd2bf('0x82')]=function(_0x1e4c2c,_0x3c7c42,_0x19dbb9){return db['Campaign']['find']({'where':{'id':_0x1e4c2c[_0xd2bf('0x41')]['id']}})[_0xd2bf('0x26')](handleEntityNotFound(_0x3c7c42,null))[_0xd2bf('0x26')](function(_0x4183af){if(_0x4183af){return _0x4183af[_0xd2bf('0x82')](_0x1e4c2c[_0xd2bf('0x32')]['ids']);}})[_0xd2bf('0x26')](function(_0x41f68e){if(_0x41f68e){return db[_0xd2bf('0x56')][_0xd2bf('0x27')]({'where':{'ListId':_0x1e4c2c['query'][_0xd2bf('0x65')],'CampaignId':_0x1e4c2c['params']['id']}})['then'](function(){return _0x41f68e;});}})['then'](respondWithStatusCode(_0x3c7c42,null))['catch'](handleError(_0x3c7c42,null));};exports[_0xd2bf('0x83')]=function(_0x1c7eac,_0x1814b3,_0x520975){var _0x58fb8c={};var _0x4e9bd0={};var _0x16d526;var _0x5d7535;return db[_0xd2bf('0x2d')][_0xd2bf('0x55')]({'where':{'id':_0x1c7eac[_0xd2bf('0x41')]['id']}})[_0xd2bf('0x26')](handleEntityNotFound(_0x1814b3,null))[_0xd2bf('0x26')](function(_0x45175c){if(_0x45175c){_0x16d526=_0x45175c;_0x4e9bd0[_0xd2bf('0x31')]=_['keys'](db[_0xd2bf('0x63')][_0xd2bf('0x2e')]);_0x4e9bd0[_0xd2bf('0x32')]=_['keys'](_0x1c7eac[_0xd2bf('0x32')]);_0x4e9bd0['filters']=_[_0xd2bf('0x35')](_0x4e9bd0['model'],_0x4e9bd0[_0xd2bf('0x32')]);_0x58fb8c['attributes']=_[_0xd2bf('0x35')](_0x4e9bd0[_0xd2bf('0x31')],qs[_0xd2bf('0x37')](_0x1c7eac['query'][_0xd2bf('0x37')]));_0x58fb8c[_0xd2bf('0x36')]=_0x58fb8c[_0xd2bf('0x36')][_0xd2bf('0x4e')]?_0x58fb8c[_0xd2bf('0x36')]:_0x4e9bd0['model'];_0x58fb8c[_0xd2bf('0x39')]=qs[_0xd2bf('0x3a')](_0x1c7eac[_0xd2bf('0x32')]['sort']);_0x58fb8c[_0xd2bf('0x3b')]=qs[_0xd2bf('0x34')](_[_0xd2bf('0x3c')](_0x1c7eac['query'],_0x4e9bd0['filters']));if(_0x1c7eac[_0xd2bf('0x32')][_0xd2bf('0x59')]){_0x58fb8c[_0xd2bf('0x3b')]=_[_0xd2bf('0x3d')](_0x58fb8c['where'],{'$or':_[_0xd2bf('0x2c')](_0x58fb8c[_0xd2bf('0x36')],function(_0x391b13){var _0x36a60a={};_0x36a60a[_0x391b13]={'$like':'%'+_0x1c7eac[_0xd2bf('0x32')]['filter']+'%'};return _0x36a60a;})});}_0x58fb8c=_['merge']({},_0x58fb8c,_0x1c7eac['options']);return _0x16d526[_0xd2bf('0x83')](_0x58fb8c);}})['then'](function(_0xe08919){if(_0xe08919){_0x5d7535=_0xe08919[_0xd2bf('0x4e')];if(!_0x1c7eac[_0xd2bf('0x32')]['hasOwnProperty'](_0xd2bf('0x38'))){_0x58fb8c[_0xd2bf('0x1f')]=qs[_0xd2bf('0x1f')](_0x1c7eac[_0xd2bf('0x32')][_0xd2bf('0x1f')]);_0x58fb8c[_0xd2bf('0x1c')]=qs['offset'](_0x1c7eac['query']['offset']);}return _0x16d526[_0xd2bf('0x83')](_0x58fb8c);}})[_0xd2bf('0x26')](function(_0x307990){if(_0x307990){return _0x307990?{'count':_0x5d7535,'rows':_0x307990}:null;}})[_0xd2bf('0x26')](respondWithResult(_0x1814b3,null))[_0xd2bf('0x3f')](handleError(_0x1814b3,null));};exports['addBlackLists']=function(_0x2bfeaf,_0x478bdd,_0x29a1cc){var _0x2e0ae2,_0x1499c6;return db[_0xd2bf('0x2d')][_0xd2bf('0x44')]({'where':{'id':_0x2bfeaf['params']['id']}})[_0xd2bf('0x26')](handleEntityNotFound(_0x478bdd,null))[_0xd2bf('0x26')](function(_0x569e2a){if(_0x569e2a){_0x1499c6=_0x569e2a;return _0x569e2a[_0xd2bf('0x84')](_0x2bfeaf[_0xd2bf('0x46')]['ids'],_['omit'](_0x2bfeaf[_0xd2bf('0x46')],['ids','id'])||{});}return null;})[_0xd2bf('0x66')](function(_0x43430b){var _0x1fdb15;_0x2e0ae2=_0x43430b||[];var _0x7d6858=[];if(_0x43430b){for(var _0x512df0=0x0;_0x512df0<_0x43430b[_0xd2bf('0x4e')];_0x512df0+=0x1){var _0x5e73e5=_0x43430b[_0x512df0][_0xd2bf('0x28')]({'plain':!![]});_0x1fdb15=squel[_0xd2bf('0x68')]()[_0xd2bf('0x69')](_0xd2bf('0x85'))[_0xd2bf('0x6b')]([_0xd2bf('0x6c'),'ContactId',_0xd2bf('0x6f'),_0xd2bf('0x58'),_0xd2bf('0x4f'),'updatedAt'],squel[_0xd2bf('0x70')]()[_0xd2bf('0x71')](_0xd2bf('0x6c'),_0xd2bf('0x6c'))[_0xd2bf('0x71')]('id',_0xd2bf('0x6e'))['field'](_0x5e73e5[_0xd2bf('0x78')]['toString'](),_0xd2bf('0x6f'))[_0xd2bf('0x71')](_0x2bfeaf[_0xd2bf('0x41')]['id'][_0xd2bf('0x73')](),'CampaignId')[_0xd2bf('0x71')]('NOW()','createdAt')['field']('NOW()',_0xd2bf('0x50'))[_0xd2bf('0x74')](_0xd2bf('0x75'))[_0xd2bf('0x3b')](_0xd2bf('0x76'))[_0xd2bf('0x3b')]('ListId\x20=\x20?',_0x5e73e5['CmListId'][_0xd2bf('0x73')]())[_0xd2bf('0x3b')](_0xd2bf('0x79')))[_0xd2bf('0x73')]();_0x7d6858['push'](db[_0xd2bf('0x80')][_0xd2bf('0x32')](_0x1fdb15));}return BPromise[_0xd2bf('0x81')](_0x7d6858);}})[_0xd2bf('0x26')](function(){return _0x2e0ae2;})[_0xd2bf('0x26')](respondWithResult(_0x478bdd,null))['catch'](handleError(_0x478bdd,null));};exports[_0xd2bf('0x86')]=function(_0x19383f,_0x57c3f3,_0x432501){return db[_0xd2bf('0x2d')][_0xd2bf('0x44')]({'where':{'id':_0x19383f[_0xd2bf('0x41')]['id']}})[_0xd2bf('0x26')](handleEntityNotFound(_0x57c3f3,null))[_0xd2bf('0x26')](function(_0x3c327b){if(_0x3c327b){return _0x3c327b['removeBlackLists'](_0x19383f[_0xd2bf('0x32')][_0xd2bf('0x65')]);}})['then'](function(_0x1a21e7){if(_0x1a21e7){return db[_0xd2bf('0x61')][_0xd2bf('0x27')]({'where':{'ListId':_0x19383f['query'][_0xd2bf('0x65')],'CampaignId':_0x19383f[_0xd2bf('0x41')]['id']}})[_0xd2bf('0x26')](function(){return _0x1a21e7;});}})['then'](respondWithStatusCode(_0x57c3f3,null))['catch'](handleError(_0x57c3f3,null));}; \ No newline at end of file +var _0xf270=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','reject','save','then','get','IvrCampaigns','UserProfileResource','destroy','error','stack','name','index','Campaign','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','filter','options','findAll','catch','show','includeAll','include','find','body','user','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','update','params','getHoppers','findOne','CmHopper','order','pick','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CampaignId','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','select','field','NOW()','CmListId','toString','ListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','from','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','bluebird'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0xf270,0x103));var _0x0f27=function(_0x44cb92,_0x59afa3){_0x44cb92=_0x44cb92-0x0;var _0x56b9e6=_0xf270[_0x44cb92];return _0x56b9e6;};'use strict';var emlformat=require(_0x0f27('0x0'));var rimraf=require(_0x0f27('0x1'));var zipdir=require(_0x0f27('0x2'));var jsonpatch=require(_0x0f27('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0f27('0x4'));var Mustache=require(_0x0f27('0x5'));var util=require(_0x0f27('0x6'));var path=require(_0x0f27('0x7'));var sox=require(_0x0f27('0x8'));var csv=require(_0x0f27('0x9'));var ejs=require(_0x0f27('0xa'));var fs=require('fs');var fs_extra=require(_0x0f27('0xb'));var _=require(_0x0f27('0xc'));var squel=require(_0x0f27('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0f27('0xe'));var toCsv=require(_0x0f27('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0f27('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0f27('0x10'));var as=require(_0x0f27('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0f27('0x12'))(_0x0f27('0x13'));var utils=require(_0x0f27('0x14'));var config=require(_0x0f27('0x15'));var licenseUtil=require(_0x0f27('0x16'));var db=require(_0x0f27('0x17'))['db'];function respondWithStatusCode(_0x51320b,_0x4efc4b){_0x4efc4b=_0x4efc4b||0xcc;return function(_0x4082a5){if(_0x4082a5){return _0x51320b[_0x0f27('0x18')](_0x4efc4b);}return _0x51320b['status'](_0x4efc4b)[_0x0f27('0x19')]();};}function respondWithResult(_0x266897,_0xc18a67){_0xc18a67=_0xc18a67||0xc8;return function(_0x4c109c){if(_0x4c109c){return _0x266897[_0x0f27('0x1a')](_0xc18a67)[_0x0f27('0x1b')](_0x4c109c);}};}function respondWithFilteredResult(_0xfc526c,_0x336bbf){return function(_0x19ae28){if(_0x19ae28){var _0x3c1685=typeof _0x336bbf['offset']===_0x0f27('0x1c')&&typeof _0x336bbf[_0x0f27('0x1d')]===_0x0f27('0x1c');var _0xe34243=_0x19ae28['count'];var _0x21f296=_0x3c1685?0x0:_0x336bbf[_0x0f27('0x1e')];var _0x212109=_0x3c1685?_0x19ae28[_0x0f27('0x1f')]:_0x336bbf[_0x0f27('0x1e')]+_0x336bbf['limit'];var _0x3f811a;if(_0x212109>=_0xe34243){_0x212109=_0xe34243;_0x3f811a=0xc8;}else{_0x3f811a=0xce;}_0xfc526c[_0x0f27('0x1a')](_0x3f811a);return _0xfc526c['set']('Content-Range',_0x21f296+'-'+_0x212109+'/'+_0xe34243)[_0x0f27('0x1b')](_0x19ae28);}return null;};}function patchUpdates(_0x4be9ee){return function(_0x27903c){try{jsonpatch['apply'](_0x27903c,_0x4be9ee,!![]);}catch(_0x13c5cc){return BPromise[_0x0f27('0x20')](_0x13c5cc);}return _0x27903c[_0x0f27('0x21')]();};}function saveUpdates(_0x456e97,_0x1bd9c7){return function(_0x18d1e7){if(_0x18d1e7){return _0x18d1e7['update'](_0x456e97)[_0x0f27('0x22')](function(_0x39a529){return _0x39a529;});}return null;};}function removeEntity(_0x367011,_0x1cdc61){return function(_0xeca663){if(_0xeca663){return _0xeca663['destroy']()[_0x0f27('0x22')](function(){var _0x4d302b=_0xeca663[_0x0f27('0x23')]({'plain':!![]});var _0x522040=_0x0f27('0x24');return db[_0x0f27('0x25')][_0x0f27('0x26')]({'where':{'type':_0x522040,'resourceId':_0x4d302b['id']}})['then'](function(){return _0xeca663;});})['then'](function(){_0x367011[_0x0f27('0x1a')](0xcc)[_0x0f27('0x19')]();});}};}function handleEntityNotFound(_0x5f2325,_0x39cfe4){return function(_0x21a883){if(!_0x21a883){_0x5f2325[_0x0f27('0x18')](0x194);}return _0x21a883;};}function handleError(_0x47ddab,_0x2c54b8){_0x2c54b8=_0x2c54b8||0x1f4;return function(_0x49c0a3){logger[_0x0f27('0x27')](_0x49c0a3[_0x0f27('0x28')]);if(_0x49c0a3[_0x0f27('0x29')]){delete _0x49c0a3[_0x0f27('0x29')];}_0x47ddab[_0x0f27('0x1a')](_0x2c54b8)['send'](_0x49c0a3);};}exports[_0x0f27('0x2a')]=function(_0x2bcf9b,_0xa94cdf){var _0x1628fb={},_0xbaf871={},_0x2d1471={'count':0x0,'rows':[]};var _0x2a1643=_['map'](db[_0x0f27('0x2b')][_0x0f27('0x2c')],function(_0x4ccdde){return{'name':_0x4ccdde[_0x0f27('0x2d')],'type':_0x4ccdde[_0x0f27('0x2e')][_0x0f27('0x2f')]};});_0xbaf871['model']=_[_0x0f27('0x30')](_0x2a1643,_0x0f27('0x29'));_0xbaf871[_0x0f27('0x31')]=_[_0x0f27('0x32')](_0x2bcf9b['query']);_0xbaf871[_0x0f27('0x33')]=_[_0x0f27('0x34')](_0xbaf871[_0x0f27('0x35')],_0xbaf871[_0x0f27('0x31')]);_0x1628fb['attributes']=_['intersection'](_0xbaf871[_0x0f27('0x35')],qs['fields'](_0x2bcf9b[_0x0f27('0x31')][_0x0f27('0x36')]));_0x1628fb['attributes']=_0x1628fb[_0x0f27('0x37')][_0x0f27('0x38')]?_0x1628fb[_0x0f27('0x37')]:_0xbaf871[_0x0f27('0x35')];if(!_0x2bcf9b['query'][_0x0f27('0x39')](_0x0f27('0x3a'))){_0x1628fb[_0x0f27('0x1d')]=qs[_0x0f27('0x1d')](_0x2bcf9b['query'][_0x0f27('0x1d')]);_0x1628fb[_0x0f27('0x1e')]=qs[_0x0f27('0x1e')](_0x2bcf9b[_0x0f27('0x31')][_0x0f27('0x1e')]);}_0x1628fb['order']=qs['sort'](_0x2bcf9b[_0x0f27('0x31')][_0x0f27('0x3b')]);_0x1628fb[_0x0f27('0x3c')]=qs[_0x0f27('0x33')](_['pick'](_0x2bcf9b[_0x0f27('0x31')],_0xbaf871['filters']),_0x2a1643);if(_0x2bcf9b[_0x0f27('0x31')]['filter']){_0x1628fb[_0x0f27('0x3c')]=_[_0x0f27('0x3d')](_0x1628fb[_0x0f27('0x3c')],{'$or':_[_0x0f27('0x30')](_0x2a1643,function(_0x2a5769){if(_0x2a5769[_0x0f27('0x2e')]!=='VIRTUAL'){var _0x43ffa7={};_0x43ffa7[_0x2a5769[_0x0f27('0x29')]]={'$like':'%'+_0x2bcf9b[_0x0f27('0x31')][_0x0f27('0x3e')]+'%'};return _0x43ffa7;}})});}_0x1628fb=_['merge']({},_0x1628fb,_0x2bcf9b[_0x0f27('0x3f')]);var _0x59197e={'where':_0x1628fb[_0x0f27('0x3c')]};return db[_0x0f27('0x2b')][_0x0f27('0x1f')](_0x59197e)[_0x0f27('0x22')](function(_0x332af8){_0x2d1471[_0x0f27('0x1f')]=_0x332af8;if(_0x2bcf9b[_0x0f27('0x31')]['includeAll']){_0x1628fb['include']=[{'all':!![]}];}return db[_0x0f27('0x2b')][_0x0f27('0x40')](_0x1628fb);})[_0x0f27('0x22')](function(_0x5035f4){_0x2d1471['rows']=_0x5035f4;return _0x2d1471;})['then'](respondWithFilteredResult(_0xa94cdf,_0x1628fb))[_0x0f27('0x41')](handleError(_0xa94cdf,null));};exports[_0x0f27('0x42')]=function(_0x42ed0e,_0x2c37cd){var _0x5352ad={'raw':![],'where':{'id':_0x42ed0e['params']['id']}},_0x52ab1b={};_0x52ab1b[_0x0f27('0x35')]=_['keys'](db['Campaign'][_0x0f27('0x2c')]);_0x52ab1b['query']=_[_0x0f27('0x32')](_0x42ed0e[_0x0f27('0x31')]);_0x52ab1b[_0x0f27('0x33')]=_[_0x0f27('0x34')](_0x52ab1b[_0x0f27('0x35')],_0x52ab1b[_0x0f27('0x31')]);_0x5352ad['attributes']=_['intersection'](_0x52ab1b[_0x0f27('0x35')],qs['fields'](_0x42ed0e[_0x0f27('0x31')]['fields']));_0x5352ad[_0x0f27('0x37')]=_0x5352ad[_0x0f27('0x37')]['length']?_0x5352ad[_0x0f27('0x37')]:_0x52ab1b[_0x0f27('0x35')];if(_0x42ed0e['query'][_0x0f27('0x43')]){_0x5352ad[_0x0f27('0x44')]=[{'all':!![]}];}_0x5352ad=_[_0x0f27('0x3d')]({},_0x5352ad,_0x42ed0e[_0x0f27('0x3f')]);return db[_0x0f27('0x2b')][_0x0f27('0x45')](_0x5352ad)[_0x0f27('0x22')](handleEntityNotFound(_0x2c37cd,null))[_0x0f27('0x22')](respondWithResult(_0x2c37cd,null))[_0x0f27('0x41')](handleError(_0x2c37cd,null));};exports['create']=function(_0xfb48b2,_0x3eee66){return db[_0x0f27('0x2b')]['create'](_0xfb48b2[_0x0f27('0x46')],{})[_0x0f27('0x22')](function(_0x3a1421){var _0x17304f=_0xfb48b2[_0x0f27('0x47')]['get']({'plain':!![]});if(!_0x17304f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17304f['role']===_0x0f27('0x47')){var _0x3c94db=_0x3a1421['get']({'plain':!![]});var _0x34b8ab=_0x0f27('0x24');return db[_0x0f27('0x48')][_0x0f27('0x45')]({'where':{'name':_0x34b8ab,'userProfileId':_0x17304f[_0x0f27('0x49')]},'raw':!![]})['then'](function(_0x531706){if(_0x531706&&_0x531706['autoAssociation']===0x0){return db[_0x0f27('0x25')][_0x0f27('0x4a')]({'name':_0x3c94db[_0x0f27('0x29')],'resourceId':_0x3c94db['id'],'type':_0x531706[_0x0f27('0x29')],'sectionId':_0x531706['id']},{})[_0x0f27('0x22')](function(){return _0x3a1421;});}else{return _0x3a1421;}})[_0x0f27('0x41')](function(_0x122b99){logger[_0x0f27('0x27')](_0x0f27('0x4b'),_0x122b99);throw _0x122b99;});}return _0x3a1421;})[_0x0f27('0x22')](respondWithResult(_0x3eee66,0xc9))[_0x0f27('0x41')](handleError(_0x3eee66,null));};exports['clone']=function(_0x2f64e4,_0x4ea254){var _0x33c051={'where':{'id':_0x2f64e4['params']['id']}},_0x4d1088={};_0x4d1088[_0x0f27('0x35')]=_[_0x0f27('0x32')](db[_0x0f27('0x2b')]['rawAttributes']);_0x33c051['attributes']=_['intersection'](_0x4d1088[_0x0f27('0x35')],qs[_0x0f27('0x36')](_0x2f64e4[_0x0f27('0x31')]['fields']));_0x33c051[_0x0f27('0x37')]=_0x33c051[_0x0f27('0x37')][_0x0f27('0x38')]?_0x33c051['attributes']:_0x4d1088[_0x0f27('0x35')];if(_0x2f64e4[_0x0f27('0x31')]['includeAll']){_0x33c051[_0x0f27('0x44')]=[{'all':!![]}];}_0x33c051=_['merge']({},_0x33c051,_0x2f64e4[_0x0f27('0x3f')]);return db['Campaign'][_0x0f27('0x45')](_0x33c051)[_0x0f27('0x22')](handleEntityNotFound(_0x4ea254,null))[_0x0f27('0x22')](function(_0x2f40b3){if(_0x2f40b3){var _0x38d1a9=_0x2f40b3[_0x0f27('0x23')]({'plain':!![]});_0x38d1a9=qs[_0x0f27('0x4c')](_0x38d1a9,['id',_0x0f27('0x4d'),_0x0f27('0x4e')]);_0x2f64e4[_0x0f27('0x46')]=_['omit'](_0x2f64e4[_0x0f27('0x46')],['id','createdAt',_0x0f27('0x4e')]);return db[_0x0f27('0x2b')][_0x0f27('0x4a')](_[_0x0f27('0x3d')](_0x38d1a9,_0x2f64e4[_0x0f27('0x46')]),{'include':_0x2f64e4[_0x0f27('0x31')][_0x0f27('0x43')]?[{'all':!![]}]:undefined})[_0x0f27('0x22')](function(_0x2dff36){var _0x112867=_0x2f64e4['user'][_0x0f27('0x23')]({'plain':!![]});if(!_0x112867)throw new Error(_0x0f27('0x4f'));if(_0x112867['role']===_0x0f27('0x47')){var _0x447163=_0x2dff36[_0x0f27('0x23')]({'plain':!![]});var _0x86fd06=_0x0f27('0x24');return db[_0x0f27('0x48')]['find']({'where':{'name':_0x86fd06,'userProfileId':_0x112867[_0x0f27('0x49')]},'raw':!![]})[_0x0f27('0x22')](function(_0xaf1a6c){if(_0xaf1a6c&&_0xaf1a6c[_0x0f27('0x50')]===0x0){return db[_0x0f27('0x25')][_0x0f27('0x4a')]({'name':_0x447163[_0x0f27('0x29')],'resourceId':_0x447163['id'],'type':_0xaf1a6c[_0x0f27('0x29')],'sectionId':_0xaf1a6c['id']},{})['then'](function(){return _0x2dff36;});}else{return _0x2dff36;}})['catch'](function(_0x5628f2){logger[_0x0f27('0x27')](_0x0f27('0x4b'),_0x5628f2);throw _0x5628f2;});}return _0x2dff36;});}})['then'](respondWithResult(_0x4ea254,0xc9))[_0x0f27('0x41')](handleError(_0x4ea254,null));};exports[_0x0f27('0x51')]=function(_0x5913b9,_0x46be08){if(_0x5913b9[_0x0f27('0x46')]['id']){delete _0x5913b9[_0x0f27('0x46')]['id'];}return db[_0x0f27('0x2b')][_0x0f27('0x45')]({'where':{'id':_0x5913b9[_0x0f27('0x52')]['id']}})[_0x0f27('0x22')](handleEntityNotFound(_0x46be08,null))['then'](saveUpdates(_0x5913b9[_0x0f27('0x46')],null))['then'](respondWithResult(_0x46be08,null))[_0x0f27('0x41')](handleError(_0x46be08,null));};exports[_0x0f27('0x26')]=function(_0x3498c9,_0x58540c){return db['Campaign'][_0x0f27('0x45')]({'where':{'id':_0x3498c9[_0x0f27('0x52')]['id']}})[_0x0f27('0x22')](handleEntityNotFound(_0x58540c,null))['then'](removeEntity(_0x58540c,null))[_0x0f27('0x41')](handleError(_0x58540c,null));};exports[_0x0f27('0x53')]=function(_0x49e868,_0x5621e0,_0x4ad6df){var _0xd4fcbb={'raw':!![],'where':{}};var _0x42bcf7={};var _0xd8bbf4={'count':0x0,'rows':[]};return db[_0x0f27('0x2b')][_0x0f27('0x54')]({'where':{'id':_0x49e868['params']['id']}})[_0x0f27('0x22')](handleEntityNotFound(_0x5621e0,null))['then'](function(_0x4afb7f){if(_0x4afb7f){_0x42bcf7[_0x0f27('0x35')]=_[_0x0f27('0x32')](db[_0x0f27('0x55')][_0x0f27('0x2c')]);_0x42bcf7[_0x0f27('0x31')]=_[_0x0f27('0x32')](_0x49e868['query']);_0x42bcf7[_0x0f27('0x33')]=_[_0x0f27('0x34')](_0x42bcf7[_0x0f27('0x35')],_0x42bcf7[_0x0f27('0x31')]);_0xd4fcbb[_0x0f27('0x37')]=_[_0x0f27('0x34')](_0x42bcf7[_0x0f27('0x35')],qs['fields'](_0x49e868['query'][_0x0f27('0x36')]));_0xd4fcbb[_0x0f27('0x37')]=_0xd4fcbb['attributes']['length']?_0xd4fcbb['attributes']:_0x42bcf7[_0x0f27('0x35')];if(!_0x49e868[_0x0f27('0x31')][_0x0f27('0x39')](_0x0f27('0x3a'))){_0xd4fcbb[_0x0f27('0x1d')]=qs[_0x0f27('0x1d')](_0x49e868[_0x0f27('0x31')][_0x0f27('0x1d')]);_0xd4fcbb[_0x0f27('0x1e')]=qs[_0x0f27('0x1e')](_0x49e868[_0x0f27('0x31')][_0x0f27('0x1e')]);}_0xd4fcbb[_0x0f27('0x56')]=qs[_0x0f27('0x3b')](_0x49e868[_0x0f27('0x31')]['sort']);_0xd4fcbb['where']=qs[_0x0f27('0x33')](_[_0x0f27('0x57')](_0x49e868[_0x0f27('0x31')],_0x42bcf7[_0x0f27('0x33')]));_0xd4fcbb[_0x0f27('0x3c')]['CampaignId']=_0x4afb7f['id'];if(_0x49e868[_0x0f27('0x31')][_0x0f27('0x3e')]){_0xd4fcbb[_0x0f27('0x3c')]=_['merge'](_0xd4fcbb[_0x0f27('0x3c')],{'$or':_['map'](_0xd4fcbb['attributes'],function(_0x69826a){var _0x37c8dd={};_0x37c8dd[_0x69826a]={'$like':'%'+_0x49e868[_0x0f27('0x31')][_0x0f27('0x3e')]+'%'};return _0x37c8dd;})});}_0xd4fcbb=_['merge']({},_0xd4fcbb,_0x49e868[_0x0f27('0x3f')]);return db['CmHopper'][_0x0f27('0x1f')]({'where':_0xd4fcbb[_0x0f27('0x3c')]})[_0x0f27('0x22')](function(_0x59432a){_0xd8bbf4[_0x0f27('0x1f')]=_0x59432a;if(_0x49e868[_0x0f27('0x31')][_0x0f27('0x43')]){_0xd4fcbb[_0x0f27('0x44')]=[{'all':!![]}];}return db['CmHopper'][_0x0f27('0x40')](_0xd4fcbb);})[_0x0f27('0x22')](function(_0x49a8ed){_0xd8bbf4[_0x0f27('0x58')]=_0x49a8ed;return _0xd8bbf4;});}})[_0x0f27('0x22')](respondWithFilteredResult(_0x5621e0,_0xd4fcbb))[_0x0f27('0x41')](handleError(_0x5621e0,null));};exports[_0x0f27('0x59')]=function(_0x2ebba7,_0x5ece3d,_0x16afac){var _0x14f191={'raw':!![],'where':{}};var _0x34fdc6={};var _0x574f7b={'count':0x0,'rows':[]};return db[_0x0f27('0x2b')][_0x0f27('0x54')]({'where':{'id':_0x2ebba7['params']['id']}})['then'](handleEntityNotFound(_0x5ece3d,null))['then'](function(_0x166eb3){if(_0x166eb3){_0x34fdc6[_0x0f27('0x35')]=_[_0x0f27('0x32')](db['CmHopperHistory']['rawAttributes']);_0x34fdc6[_0x0f27('0x31')]=_[_0x0f27('0x32')](_0x2ebba7[_0x0f27('0x31')]);_0x34fdc6[_0x0f27('0x33')]=_[_0x0f27('0x34')](_0x34fdc6[_0x0f27('0x35')],_0x34fdc6[_0x0f27('0x31')]);_0x14f191[_0x0f27('0x37')]=_[_0x0f27('0x34')](_0x34fdc6[_0x0f27('0x35')],qs[_0x0f27('0x36')](_0x2ebba7[_0x0f27('0x31')][_0x0f27('0x36')]));_0x14f191[_0x0f27('0x37')]=_0x14f191[_0x0f27('0x37')][_0x0f27('0x38')]?_0x14f191['attributes']:_0x34fdc6[_0x0f27('0x35')];if(!_0x2ebba7[_0x0f27('0x31')][_0x0f27('0x39')]('nolimit')){_0x14f191[_0x0f27('0x1d')]=qs['limit'](_0x2ebba7[_0x0f27('0x31')][_0x0f27('0x1d')]);_0x14f191['offset']=qs['offset'](_0x2ebba7['query'][_0x0f27('0x1e')]);}_0x14f191[_0x0f27('0x56')]=qs[_0x0f27('0x3b')](_0x2ebba7[_0x0f27('0x31')]['sort']);_0x14f191[_0x0f27('0x3c')]=qs[_0x0f27('0x33')](_[_0x0f27('0x57')](_0x2ebba7[_0x0f27('0x31')],_0x34fdc6['filters']));_0x14f191['where']['CampaignId']=_0x166eb3['id'];if(_0x2ebba7['query'][_0x0f27('0x3e')]){_0x14f191[_0x0f27('0x3c')]=_[_0x0f27('0x3d')](_0x14f191[_0x0f27('0x3c')],{'$or':_['map'](_0x14f191[_0x0f27('0x37')],function(_0x453ba4){var _0x32b83c={};_0x32b83c[_0x453ba4]={'$like':'%'+_0x2ebba7[_0x0f27('0x31')][_0x0f27('0x3e')]+'%'};return _0x32b83c;})});}_0x14f191=_['merge']({},_0x14f191,_0x2ebba7[_0x0f27('0x3f')]);return db['CmHopperHistory']['count']({'where':_0x14f191['where']})['then'](function(_0x6c3c1d){_0x574f7b[_0x0f27('0x1f')]=_0x6c3c1d;if(_0x2ebba7[_0x0f27('0x31')][_0x0f27('0x43')]){_0x14f191[_0x0f27('0x44')]=[{'all':!![]}];}return db[_0x0f27('0x5a')]['findAll'](_0x14f191);})[_0x0f27('0x22')](function(_0xf95396){_0x574f7b[_0x0f27('0x58')]=_0xf95396;return _0x574f7b;});}})[_0x0f27('0x22')](respondWithFilteredResult(_0x5ece3d,_0x14f191))[_0x0f27('0x41')](handleError(_0x5ece3d,null));};exports[_0x0f27('0x5b')]=function(_0x164239,_0x1dba64,_0x1f6378){var _0x2c5f3b={'raw':!![],'where':{}};var _0x1e82c6={};var _0x56dff3={'count':0x0,'rows':[]};return db[_0x0f27('0x2b')][_0x0f27('0x54')]({'where':{'id':_0x164239[_0x0f27('0x52')]['id']}})[_0x0f27('0x22')](handleEntityNotFound(_0x1dba64,null))[_0x0f27('0x22')](function(_0x360ff4){if(_0x360ff4){_0x1e82c6[_0x0f27('0x35')]=_[_0x0f27('0x32')](db[_0x0f27('0x5c')]['rawAttributes']);_0x1e82c6[_0x0f27('0x31')]=_[_0x0f27('0x32')](_0x164239[_0x0f27('0x31')]);_0x1e82c6[_0x0f27('0x33')]=_[_0x0f27('0x34')](_0x1e82c6[_0x0f27('0x35')],_0x1e82c6[_0x0f27('0x31')]);_0x2c5f3b[_0x0f27('0x37')]=_[_0x0f27('0x34')](_0x1e82c6[_0x0f27('0x35')],qs[_0x0f27('0x36')](_0x164239[_0x0f27('0x31')][_0x0f27('0x36')]));_0x2c5f3b[_0x0f27('0x37')]=_0x2c5f3b['attributes'][_0x0f27('0x38')]?_0x2c5f3b[_0x0f27('0x37')]:_0x1e82c6[_0x0f27('0x35')];if(!_0x164239[_0x0f27('0x31')][_0x0f27('0x39')](_0x0f27('0x3a'))){_0x2c5f3b['limit']=qs[_0x0f27('0x1d')](_0x164239[_0x0f27('0x31')][_0x0f27('0x1d')]);_0x2c5f3b[_0x0f27('0x1e')]=qs['offset'](_0x164239[_0x0f27('0x31')][_0x0f27('0x1e')]);}_0x2c5f3b[_0x0f27('0x56')]=qs[_0x0f27('0x3b')](_0x164239[_0x0f27('0x31')][_0x0f27('0x3b')]);_0x2c5f3b[_0x0f27('0x3c')]=qs[_0x0f27('0x33')](_['pick'](_0x164239[_0x0f27('0x31')],_0x1e82c6[_0x0f27('0x33')]));_0x2c5f3b['where'][_0x0f27('0x5d')]=_0x360ff4['id'];if(_0x164239['query'][_0x0f27('0x3e')]){_0x2c5f3b[_0x0f27('0x3c')]=_[_0x0f27('0x3d')](_0x2c5f3b[_0x0f27('0x3c')],{'$or':_[_0x0f27('0x30')](_0x2c5f3b[_0x0f27('0x37')],function(_0x333f92){var _0x3fc67c={};_0x3fc67c[_0x333f92]={'$like':'%'+_0x164239['query'][_0x0f27('0x3e')]+'%'};return _0x3fc67c;})});}_0x2c5f3b=_[_0x0f27('0x3d')]({},_0x2c5f3b,_0x164239[_0x0f27('0x3f')]);return db[_0x0f27('0x5c')][_0x0f27('0x1f')]({'where':_0x2c5f3b[_0x0f27('0x3c')]})[_0x0f27('0x22')](function(_0x4239c5){_0x56dff3[_0x0f27('0x1f')]=_0x4239c5;if(_0x164239[_0x0f27('0x31')]['includeAll']){_0x2c5f3b[_0x0f27('0x44')]=[{'all':!![]}];}return db[_0x0f27('0x5c')][_0x0f27('0x40')](_0x2c5f3b);})[_0x0f27('0x22')](function(_0x357ec0){_0x56dff3['rows']=_0x357ec0;return _0x56dff3;});}})['then'](respondWithFilteredResult(_0x1dba64,_0x2c5f3b))[_0x0f27('0x41')](handleError(_0x1dba64,null));};exports['getHopperBlacks']=function(_0x4454b4,_0x1cab6c,_0xf020ba){var _0x3c840d={'raw':!![],'where':{}};var _0x37b8a7={};var _0x26b28d={'count':0x0,'rows':[]};return db[_0x0f27('0x2b')][_0x0f27('0x54')]({'where':{'id':_0x4454b4[_0x0f27('0x52')]['id']}})[_0x0f27('0x22')](handleEntityNotFound(_0x1cab6c,null))[_0x0f27('0x22')](function(_0x53baa6){if(_0x53baa6){_0x37b8a7[_0x0f27('0x35')]=_[_0x0f27('0x32')](db[_0x0f27('0x5e')][_0x0f27('0x2c')]);_0x37b8a7['query']=_[_0x0f27('0x32')](_0x4454b4[_0x0f27('0x31')]);_0x37b8a7[_0x0f27('0x33')]=_[_0x0f27('0x34')](_0x37b8a7[_0x0f27('0x35')],_0x37b8a7[_0x0f27('0x31')]);_0x3c840d[_0x0f27('0x37')]=_[_0x0f27('0x34')](_0x37b8a7[_0x0f27('0x35')],qs[_0x0f27('0x36')](_0x4454b4[_0x0f27('0x31')][_0x0f27('0x36')]));_0x3c840d[_0x0f27('0x37')]=_0x3c840d['attributes'][_0x0f27('0x38')]?_0x3c840d[_0x0f27('0x37')]:_0x37b8a7[_0x0f27('0x35')];if(!_0x4454b4[_0x0f27('0x31')][_0x0f27('0x39')](_0x0f27('0x3a'))){_0x3c840d[_0x0f27('0x1d')]=qs[_0x0f27('0x1d')](_0x4454b4[_0x0f27('0x31')][_0x0f27('0x1d')]);_0x3c840d[_0x0f27('0x1e')]=qs['offset'](_0x4454b4[_0x0f27('0x31')][_0x0f27('0x1e')]);}_0x3c840d[_0x0f27('0x56')]=qs[_0x0f27('0x3b')](_0x4454b4[_0x0f27('0x31')][_0x0f27('0x3b')]);_0x3c840d[_0x0f27('0x3c')]=qs[_0x0f27('0x33')](_[_0x0f27('0x57')](_0x4454b4[_0x0f27('0x31')],_0x37b8a7[_0x0f27('0x33')]));_0x3c840d[_0x0f27('0x3c')][_0x0f27('0x5d')]=_0x53baa6['id'];if(_0x4454b4[_0x0f27('0x31')][_0x0f27('0x3e')]){_0x3c840d[_0x0f27('0x3c')]=_[_0x0f27('0x3d')](_0x3c840d[_0x0f27('0x3c')],{'$or':_[_0x0f27('0x30')](_0x3c840d[_0x0f27('0x37')],function(_0x1b566a){var _0x236e3f={};_0x236e3f[_0x1b566a]={'$like':'%'+_0x4454b4[_0x0f27('0x31')][_0x0f27('0x3e')]+'%'};return _0x236e3f;})});}_0x3c840d=_[_0x0f27('0x3d')]({},_0x3c840d,_0x4454b4['options']);return db[_0x0f27('0x5e')][_0x0f27('0x1f')]({'where':_0x3c840d[_0x0f27('0x3c')]})[_0x0f27('0x22')](function(_0x1b1ff0){_0x26b28d['count']=_0x1b1ff0;if(_0x4454b4[_0x0f27('0x31')][_0x0f27('0x43')]){_0x3c840d[_0x0f27('0x44')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0f27('0x40')](_0x3c840d);})[_0x0f27('0x22')](function(_0x57c018){_0x26b28d['rows']=_0x57c018;return _0x26b28d;});}})[_0x0f27('0x22')](respondWithFilteredResult(_0x1cab6c,_0x3c840d))[_0x0f27('0x41')](handleError(_0x1cab6c,null));};exports['getLists']=function(_0x594eb2,_0xee6436,_0x2bafc0){var _0x176540={};var _0x8bdfb9={};var _0x1a458e;var _0x3c9a01;return db[_0x0f27('0x2b')]['findOne']({'where':{'id':_0x594eb2[_0x0f27('0x52')]['id']}})[_0x0f27('0x22')](handleEntityNotFound(_0xee6436,null))[_0x0f27('0x22')](function(_0x1acc85){if(_0x1acc85){_0x1a458e=_0x1acc85;_0x8bdfb9['model']=_[_0x0f27('0x32')](db[_0x0f27('0x5f')][_0x0f27('0x2c')]);_0x8bdfb9[_0x0f27('0x31')]=_[_0x0f27('0x32')](_0x594eb2['query']);_0x8bdfb9['filters']=_[_0x0f27('0x34')](_0x8bdfb9['model'],_0x8bdfb9[_0x0f27('0x31')]);_0x176540[_0x0f27('0x37')]=_[_0x0f27('0x34')](_0x8bdfb9[_0x0f27('0x35')],qs['fields'](_0x594eb2[_0x0f27('0x31')][_0x0f27('0x36')]));_0x176540[_0x0f27('0x37')]=_0x176540['attributes'][_0x0f27('0x38')]?_0x176540[_0x0f27('0x37')]:_0x8bdfb9[_0x0f27('0x35')];_0x176540[_0x0f27('0x56')]=qs['sort'](_0x594eb2[_0x0f27('0x31')][_0x0f27('0x3b')]);_0x176540['where']=qs[_0x0f27('0x33')](_[_0x0f27('0x57')](_0x594eb2[_0x0f27('0x31')],_0x8bdfb9['filters']));if(_0x594eb2['query'][_0x0f27('0x3e')]){_0x176540[_0x0f27('0x3c')]=_[_0x0f27('0x3d')](_0x176540[_0x0f27('0x3c')],{'$or':_[_0x0f27('0x30')](_0x176540[_0x0f27('0x37')],function(_0xa5d55c){var _0x3500ab={};_0x3500ab[_0xa5d55c]={'$like':'%'+_0x594eb2[_0x0f27('0x31')][_0x0f27('0x3e')]+'%'};return _0x3500ab;})});}_0x176540=_[_0x0f27('0x3d')]({},_0x176540,_0x594eb2[_0x0f27('0x3f')]);return _0x1a458e['getLists'](_0x176540);}})['then'](function(_0x3a1fad){if(_0x3a1fad){_0x3c9a01=_0x3a1fad[_0x0f27('0x38')];if(!_0x594eb2['query'][_0x0f27('0x39')]('nolimit')){_0x176540['limit']=qs[_0x0f27('0x1d')](_0x594eb2[_0x0f27('0x31')][_0x0f27('0x1d')]);_0x176540[_0x0f27('0x1e')]=qs[_0x0f27('0x1e')](_0x594eb2['query'][_0x0f27('0x1e')]);}return _0x1a458e[_0x0f27('0x60')](_0x176540);}})[_0x0f27('0x22')](function(_0x3e86b6){if(_0x3e86b6){return _0x3e86b6?{'count':_0x3c9a01,'rows':_0x3e86b6}:null;}})[_0x0f27('0x22')](respondWithResult(_0xee6436,null))[_0x0f27('0x41')](handleError(_0xee6436,null));};exports['addLists']=function(_0x542760,_0x574b11,_0x597cc6){var _0x2daa8f,_0x4a0875;return db[_0x0f27('0x2b')][_0x0f27('0x45')]({'where':{'id':_0x542760[_0x0f27('0x52')]['id']}})[_0x0f27('0x22')](handleEntityNotFound(_0x574b11,null))[_0x0f27('0x22')](function(_0x4efe5a){if(_0x4efe5a){_0x4a0875=_0x4efe5a;return _0x4efe5a[_0x0f27('0x61')](_0x542760[_0x0f27('0x46')][_0x0f27('0x62')],_['omit'](_0x542760[_0x0f27('0x46')],['ids','id'])||{});}return null;})[_0x0f27('0x63')](function(_0xa503f3){var _0x5c694f;_0x2daa8f=_0xa503f3||[];var _0xcf15fd=[];if(_0xa503f3){for(var _0x504f38=0x0;_0x504f38<_0xa503f3['length'];_0x504f38+=0x1){var _0x5928b7=_0xa503f3[_0x504f38]['get']({'plain':!![]});_0x4a0875[_0x0f27('0x64')]=_0x542760[_0x0f27('0x46')]['dialCheckDuplicateType']?_0x542760[_0x0f27('0x46')]['dialCheckDuplicateType']:_0x4a0875[_0x0f27('0x64')];switch(_0x4a0875[_0x0f27('0x64')]){case'always':_0x5c694f=squel[_0x0f27('0x65')]()[_0x0f27('0x66')](_0x0f27('0x67'))[_0x0f27('0x68')]([_0x0f27('0x69'),_0x0f27('0x6a'),_0x0f27('0x6b'),'ListId',_0x0f27('0x5d'),_0x0f27('0x4d'),'updatedAt'],squel[_0x0f27('0x6c')]()[_0x0f27('0x6d')](_0x0f27('0x69'),_0x0f27('0x69'))[_0x0f27('0x6d')](_0x0f27('0x6e'),_0x0f27('0x6a'))[_0x0f27('0x6d')]('id',_0x0f27('0x6b'))[_0x0f27('0x6d')](_0x5928b7[_0x0f27('0x6f')][_0x0f27('0x70')](),_0x0f27('0x71'))[_0x0f27('0x6d')](_0x542760[_0x0f27('0x52')]['id'][_0x0f27('0x70')](),_0x0f27('0x5d'))[_0x0f27('0x6d')]('NOW()',_0x0f27('0x4d'))['field'](_0x0f27('0x6e'),_0x0f27('0x4e'))['from'](_0x0f27('0x72'))[_0x0f27('0x3c')]('deletedAt\x20IS\x20NULL')[_0x0f27('0x3c')](_0x0f27('0x73'),_0x5928b7[_0x0f27('0x6f')][_0x0f27('0x70')]())[_0x0f27('0x3c')](_0x0f27('0x74'))[_0x0f27('0x3c')](_0x0f27('0x75'),squel['select']()['field'](_0x0f27('0x76'))['from'](_0x0f27('0x77'))[_0x0f27('0x3c')](_0x0f27('0x78'),_0x542760[_0x0f27('0x52')]['id']['toString']()))[_0x0f27('0x3c')](_0x0f27('0x75'),squel[_0x0f27('0x6c')]()[_0x0f27('0x6d')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0x0f27('0x3c')](_0x0f27('0x78'),_0x542760[_0x0f27('0x52')]['id'][_0x0f27('0x70')]())))['toString']();break;case'onlyIfOpen':_0x5c694f=squel['insert']()[_0x0f27('0x66')](_0x0f27('0x67'))[_0x0f27('0x68')]([_0x0f27('0x69'),_0x0f27('0x6a'),_0x0f27('0x6b'),_0x0f27('0x71'),_0x0f27('0x5d'),'createdAt',_0x0f27('0x4e')],squel[_0x0f27('0x6c')]()[_0x0f27('0x6d')](_0x0f27('0x69'),'phone')[_0x0f27('0x6d')](_0x0f27('0x6e'),_0x0f27('0x6a'))['field']('id',_0x0f27('0x6b'))[_0x0f27('0x6d')](_0x5928b7[_0x0f27('0x6f')][_0x0f27('0x70')](),_0x0f27('0x71'))[_0x0f27('0x6d')](_0x542760['params']['id']['toString'](),_0x0f27('0x5d'))[_0x0f27('0x6d')]('NOW()',_0x0f27('0x4d'))[_0x0f27('0x6d')](_0x0f27('0x6e'),_0x0f27('0x4e'))[_0x0f27('0x79')]('cm_contacts')[_0x0f27('0x3c')](_0x0f27('0x7a'))[_0x0f27('0x3c')](_0x0f27('0x73'),_0x5928b7[_0x0f27('0x6f')][_0x0f27('0x70')]())['where'](_0x0f27('0x74'))['where'](_0x0f27('0x75'),squel['select']()[_0x0f27('0x6d')](_0x0f27('0x7b'))['from'](_0x0f27('0x67'))[_0x0f27('0x3c')]('CampaignId\x20=\x20?',_0x542760[_0x0f27('0x52')]['id'][_0x0f27('0x70')]())))[_0x0f27('0x70')]();break;default:_0x5c694f=squel[_0x0f27('0x65')]()['into'](_0x0f27('0x67'))['fromQuery']([_0x0f27('0x69'),'scheduledAt','ContactId',_0x0f27('0x71'),_0x0f27('0x5d'),_0x0f27('0x4d'),_0x0f27('0x4e')],squel['select']()[_0x0f27('0x6d')](_0x0f27('0x69'),'phone')[_0x0f27('0x6d')](_0x0f27('0x6e'),_0x0f27('0x6a'))[_0x0f27('0x6d')]('id','ContactId')[_0x0f27('0x6d')](_0x5928b7[_0x0f27('0x6f')]['toString'](),_0x0f27('0x71'))[_0x0f27('0x6d')](_0x542760[_0x0f27('0x52')]['id'][_0x0f27('0x70')](),'CampaignId')['field'](_0x0f27('0x6e'),'createdAt')[_0x0f27('0x6d')](_0x0f27('0x6e'),'updatedAt')['from'](_0x0f27('0x72'))[_0x0f27('0x3c')](_0x0f27('0x7a'))[_0x0f27('0x3c')]('ListId\x20=\x20?',_0x5928b7[_0x0f27('0x6f')][_0x0f27('0x70')]())[_0x0f27('0x3c')](_0x0f27('0x74')))[_0x0f27('0x70')]();}_0xcf15fd[_0x0f27('0x7c')](db[_0x0f27('0x7d')][_0x0f27('0x31')](_0x5c694f));}return BPromise[_0x0f27('0x7e')](_0xcf15fd);}})['then'](function(){return _0x2daa8f;})[_0x0f27('0x22')](respondWithResult(_0x574b11,null))[_0x0f27('0x41')](handleError(_0x574b11,null));};exports['removeLists']=function(_0x50586a,_0x12c71d,_0x523812){return db[_0x0f27('0x2b')][_0x0f27('0x45')]({'where':{'id':_0x50586a['params']['id']}})[_0x0f27('0x22')](handleEntityNotFound(_0x12c71d,null))[_0x0f27('0x22')](function(_0x865cb2){if(_0x865cb2){return _0x865cb2[_0x0f27('0x7f')](_0x50586a['query'][_0x0f27('0x62')]);}})[_0x0f27('0x22')](function(_0x53aa3e){if(_0x53aa3e){return db[_0x0f27('0x55')][_0x0f27('0x26')]({'where':{'ListId':_0x50586a['query'][_0x0f27('0x62')],'CampaignId':_0x50586a[_0x0f27('0x52')]['id']}})[_0x0f27('0x22')](function(){return _0x53aa3e;});}})[_0x0f27('0x22')](respondWithStatusCode(_0x12c71d,null))[_0x0f27('0x41')](handleError(_0x12c71d,null));};exports[_0x0f27('0x80')]=function(_0x49ebca,_0x305746,_0x12c793){var _0x3c5bdf={};var _0x262038={};var _0x5c06a5;var _0x4e902a;return db['Campaign'][_0x0f27('0x54')]({'where':{'id':_0x49ebca[_0x0f27('0x52')]['id']}})[_0x0f27('0x22')](handleEntityNotFound(_0x305746,null))[_0x0f27('0x22')](function(_0x295ee7){if(_0x295ee7){_0x5c06a5=_0x295ee7;_0x262038[_0x0f27('0x35')]=_['keys'](db['CmList'][_0x0f27('0x2c')]);_0x262038['query']=_[_0x0f27('0x32')](_0x49ebca[_0x0f27('0x31')]);_0x262038[_0x0f27('0x33')]=_[_0x0f27('0x34')](_0x262038[_0x0f27('0x35')],_0x262038[_0x0f27('0x31')]);_0x3c5bdf[_0x0f27('0x37')]=_[_0x0f27('0x34')](_0x262038['model'],qs[_0x0f27('0x36')](_0x49ebca[_0x0f27('0x31')]['fields']));_0x3c5bdf[_0x0f27('0x37')]=_0x3c5bdf['attributes'][_0x0f27('0x38')]?_0x3c5bdf[_0x0f27('0x37')]:_0x262038[_0x0f27('0x35')];_0x3c5bdf[_0x0f27('0x56')]=qs['sort'](_0x49ebca[_0x0f27('0x31')]['sort']);_0x3c5bdf[_0x0f27('0x3c')]=qs['filters'](_[_0x0f27('0x57')](_0x49ebca['query'],_0x262038['filters']));if(_0x49ebca['query'][_0x0f27('0x3e')]){_0x3c5bdf['where']=_[_0x0f27('0x3d')](_0x3c5bdf[_0x0f27('0x3c')],{'$or':_['map'](_0x3c5bdf['attributes'],function(_0x5defcc){var _0x104651={};_0x104651[_0x5defcc]={'$like':'%'+_0x49ebca[_0x0f27('0x31')][_0x0f27('0x3e')]+'%'};return _0x104651;})});}_0x3c5bdf=_[_0x0f27('0x3d')]({},_0x3c5bdf,_0x49ebca[_0x0f27('0x3f')]);return _0x5c06a5[_0x0f27('0x80')](_0x3c5bdf);}})['then'](function(_0x5060a4){if(_0x5060a4){_0x4e902a=_0x5060a4[_0x0f27('0x38')];if(!_0x49ebca[_0x0f27('0x31')][_0x0f27('0x39')](_0x0f27('0x3a'))){_0x3c5bdf[_0x0f27('0x1d')]=qs[_0x0f27('0x1d')](_0x49ebca['query'][_0x0f27('0x1d')]);_0x3c5bdf[_0x0f27('0x1e')]=qs[_0x0f27('0x1e')](_0x49ebca[_0x0f27('0x31')][_0x0f27('0x1e')]);}return _0x5c06a5[_0x0f27('0x80')](_0x3c5bdf);}})[_0x0f27('0x22')](function(_0x31a508){if(_0x31a508){return _0x31a508?{'count':_0x4e902a,'rows':_0x31a508}:null;}})[_0x0f27('0x22')](respondWithResult(_0x305746,null))[_0x0f27('0x41')](handleError(_0x305746,null));};exports[_0x0f27('0x81')]=function(_0x44bbc6,_0x312377,_0x2d4bbf){var _0x350b6c,_0x17bea0;return db[_0x0f27('0x2b')][_0x0f27('0x45')]({'where':{'id':_0x44bbc6[_0x0f27('0x52')]['id']}})[_0x0f27('0x22')](handleEntityNotFound(_0x312377,null))['then'](function(_0x52bf4e){if(_0x52bf4e){_0x17bea0=_0x52bf4e;return _0x52bf4e['addBlackLists'](_0x44bbc6['body'][_0x0f27('0x62')],_[_0x0f27('0x4c')](_0x44bbc6[_0x0f27('0x46')],[_0x0f27('0x62'),'id'])||{});}return null;})[_0x0f27('0x63')](function(_0x23b87e){var _0x5d9480;_0x350b6c=_0x23b87e||[];var _0x2491b3=[];if(_0x23b87e){for(var _0x4619e1=0x0;_0x4619e1<_0x23b87e[_0x0f27('0x38')];_0x4619e1+=0x1){var _0x1a3ec2=_0x23b87e[_0x4619e1][_0x0f27('0x23')]({'plain':!![]});_0x5d9480=squel['insert']()[_0x0f27('0x66')](_0x0f27('0x82'))[_0x0f27('0x68')](['phone',_0x0f27('0x6b'),'ListId',_0x0f27('0x5d'),_0x0f27('0x4d'),_0x0f27('0x4e')],squel[_0x0f27('0x6c')]()[_0x0f27('0x6d')](_0x0f27('0x69'),_0x0f27('0x69'))[_0x0f27('0x6d')]('id',_0x0f27('0x6b'))[_0x0f27('0x6d')](_0x1a3ec2['CmListId'][_0x0f27('0x70')](),'ListId')[_0x0f27('0x6d')](_0x44bbc6[_0x0f27('0x52')]['id'][_0x0f27('0x70')](),_0x0f27('0x5d'))['field']('NOW()',_0x0f27('0x4d'))[_0x0f27('0x6d')]('NOW()',_0x0f27('0x4e'))[_0x0f27('0x79')](_0x0f27('0x72'))['where'](_0x0f27('0x7a'))[_0x0f27('0x3c')](_0x0f27('0x73'),_0x1a3ec2[_0x0f27('0x6f')][_0x0f27('0x70')]())[_0x0f27('0x3c')](_0x0f27('0x74')))[_0x0f27('0x70')]();_0x2491b3[_0x0f27('0x7c')](db[_0x0f27('0x7d')][_0x0f27('0x31')](_0x5d9480));}return BPromise[_0x0f27('0x7e')](_0x2491b3);}})[_0x0f27('0x22')](function(){return _0x350b6c;})[_0x0f27('0x22')](respondWithResult(_0x312377,null))[_0x0f27('0x41')](handleError(_0x312377,null));};exports[_0x0f27('0x83')]=function(_0x2d6038,_0x21d3f2,_0x4deb0b){return db[_0x0f27('0x2b')][_0x0f27('0x45')]({'where':{'id':_0x2d6038['params']['id']}})[_0x0f27('0x22')](handleEntityNotFound(_0x21d3f2,null))[_0x0f27('0x22')](function(_0x3943c5){if(_0x3943c5){return _0x3943c5[_0x0f27('0x83')](_0x2d6038[_0x0f27('0x31')][_0x0f27('0x62')]);}})[_0x0f27('0x22')](function(_0x486ee0){if(_0x486ee0){return db[_0x0f27('0x5e')][_0x0f27('0x26')]({'where':{'ListId':_0x2d6038[_0x0f27('0x31')][_0x0f27('0x62')],'CampaignId':_0x2d6038['params']['id']}})[_0x0f27('0x22')](function(){return _0x486ee0;});}})[_0x0f27('0x22')](respondWithStatusCode(_0x21d3f2,null))[_0x0f27('0x41')](handleError(_0x21d3f2,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 8d56162..f2e5e0c 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x168113,_0x462638){var _0x3e60cf=function(_0x2dce4a){while(--_0x2dce4a){_0x168113['push'](_0x168113['shift']());}};_0x3e60cf(++_0x462638);}(_0x7a54,0x106));var _0x47a5=function(_0x5772cd,_0x51abb9){_0x5772cd=_0x5772cd-0x0;var _0xa8e51b=_0x7a54[_0x5772cd];return _0xa8e51b;};'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 b201ebb..8b2ecff 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 _0xfa12=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','Campaign,\x20%s,\x20%s','message','catch','GetCampaign','options','raw','attributes','limit','include','map','model','then'];(function(_0x393bf5,_0x225cac){var _0xcb023=function(_0x4e671d){while(--_0x4e671d){_0x393bf5['push'](_0x393bf5['shift']());}};_0xcb023(++_0x225cac);}(_0xfa12,0x1b2));var _0x2fa1=function(_0x4beb42,_0x3066df){_0x4beb42=_0x4beb42-0x0;var _0x198c48=_0xfa12[_0x4beb42];return _0x198c48;};'use strict';var _=require(_0x2fa1('0x0'));var util=require(_0x2fa1('0x1'));var moment=require('moment');var BPromise=require(_0x2fa1('0x2'));var rs=require(_0x2fa1('0x3'));var fs=require('fs');var Redis=require(_0x2fa1('0x4'));var db=require(_0x2fa1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2fa1('0x6'))(_0x2fa1('0x7'));var config=require(_0x2fa1('0x8'));var jayson=require(_0x2fa1('0x9'));var client=jayson['client'][_0x2fa1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25b233,_0x58a81e,_0x3449c3){return new BPromise(function(_0x30a897,_0x2a9dc4){return client[_0x2fa1('0xb')](_0x25b233,_0x3449c3)['then'](function(_0x3ac971){logger[_0x2fa1('0xc')]('Campaign,\x20%s,\x20%s',_0x58a81e,_0x2fa1('0xd'));logger[_0x2fa1('0xe')](_0x2fa1('0xf'),_0x58a81e,_0x2fa1('0xd'),JSON[_0x2fa1('0x10')](_0x3ac971));if(_0x3ac971[_0x2fa1('0x11')]){if(_0x3ac971[_0x2fa1('0x11')][_0x2fa1('0x12')]===0x1f4){logger['error'](_0x2fa1('0x13'),_0x58a81e,_0x3ac971[_0x2fa1('0x11')][_0x2fa1('0x14')]);return _0x2a9dc4(_0x3ac971[_0x2fa1('0x11')][_0x2fa1('0x14')]);}logger[_0x2fa1('0x11')]('Campaign,\x20%s,\x20%s',_0x58a81e,_0x3ac971[_0x2fa1('0x11')][_0x2fa1('0x14')]);return _0x30a897(_0x3ac971[_0x2fa1('0x11')][_0x2fa1('0x14')]);}else{logger['info'](_0x2fa1('0x13'),_0x58a81e,_0x2fa1('0xd'));_0x30a897(_0x3ac971['result'][_0x2fa1('0x14')]);}})[_0x2fa1('0x15')](function(_0x453d24){logger[_0x2fa1('0x11')](_0x2fa1('0x13'),_0x58a81e,_0x453d24);_0x2a9dc4(_0x453d24);});});}exports[_0x2fa1('0x16')]=function(_0x21004a){var _0x3722db=this;return new Promise(function(_0x4d16ac,_0x31b4ab){return db['Campaign']['findAll']({'raw':_0x21004a[_0x2fa1('0x17')]?_0x21004a[_0x2fa1('0x17')][_0x2fa1('0x18')]===undefined?!![]:![]:!![],'where':_0x21004a[_0x2fa1('0x17')]?_0x21004a[_0x2fa1('0x17')]['where']||null:null,'attributes':_0x21004a[_0x2fa1('0x17')]?_0x21004a['options'][_0x2fa1('0x19')]||null:null,'limit':_0x21004a[_0x2fa1('0x17')]?_0x21004a[_0x2fa1('0x17')][_0x2fa1('0x1a')]||null:null,'include':_0x21004a[_0x2fa1('0x17')]?_0x21004a[_0x2fa1('0x17')][_0x2fa1('0x1b')]?_[_0x2fa1('0x1c')](_0x21004a[_0x2fa1('0x17')][_0x2fa1('0x1b')],function(_0x5021fb){return{'model':db[_0x5021fb[_0x2fa1('0x1d')]],'as':_0x5021fb['as'],'attributes':_0x5021fb['attributes'],'include':_0x5021fb['include']?_['map'](_0x5021fb[_0x2fa1('0x1b')],function(_0x5c89fc){return{'model':db[_0x5c89fc['model']],'as':_0x5c89fc['as'],'attributes':_0x5c89fc[_0x2fa1('0x19')],'include':_0x5c89fc[_0x2fa1('0x1b')]?_[_0x2fa1('0x1c')](_0x5c89fc[_0x2fa1('0x1b')],function(_0x42cc71){return{'model':db[_0x42cc71[_0x2fa1('0x1d')]],'as':_0x42cc71['as'],'attributes':_0x42cc71[_0x2fa1('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2fa1('0x1e')](function(_0x255974){logger[_0x2fa1('0xc')](_0x2fa1('0x16'),_0x21004a);logger[_0x2fa1('0xe')](_0x2fa1('0x16'),_0x21004a,JSON[_0x2fa1('0x10')](_0x255974));_0x4d16ac(_0x255974);})[_0x2fa1('0x15')](function(_0xdb4308){logger[_0x2fa1('0x11')](_0x2fa1('0x16'),_0xdb4308['message'],_0x21004a);_0x31b4ab(_0x3722db[_0x2fa1('0x11')](0x1f4,_0xdb4308[_0x2fa1('0x14')]));});});}; \ No newline at end of file +var _0xacb8=['../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','findAll','options','raw','where','attributes','include','map','model','info','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xacb8,0x119));var _0x8acb=function(_0x12fc36,_0x6530d3){_0x12fc36=_0x12fc36-0x0;var _0x55c667=_0xacb8[_0x12fc36];return _0x55c667;};'use strict';var _=require(_0x8acb('0x0'));var util=require('util');var moment=require(_0x8acb('0x1'));var BPromise=require(_0x8acb('0x2'));var rs=require(_0x8acb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8acb('0x4'))['db'];var utils=require(_0x8acb('0x5'));var logger=require('../../config/logger')(_0x8acb('0x6'));var config=require(_0x8acb('0x7'));var jayson=require(_0x8acb('0x8'));var client=jayson[_0x8acb('0x9')][_0x8acb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xeaa656,_0x534b6d,_0x369502){return new BPromise(function(_0x16e318,_0x131299){return client[_0x8acb('0xb')](_0xeaa656,_0x369502)[_0x8acb('0xc')](function(_0x42845d){logger['info']('Campaign,\x20%s,\x20%s',_0x534b6d,_0x8acb('0xd'));logger[_0x8acb('0xe')](_0x8acb('0xf'),_0x534b6d,_0x8acb('0xd'),JSON['stringify'](_0x42845d));if(_0x42845d[_0x8acb('0x10')]){if(_0x42845d[_0x8acb('0x10')]['code']===0x1f4){logger[_0x8acb('0x10')](_0x8acb('0x11'),_0x534b6d,_0x42845d[_0x8acb('0x10')][_0x8acb('0x12')]);return _0x131299(_0x42845d[_0x8acb('0x10')]['message']);}logger[_0x8acb('0x10')](_0x8acb('0x11'),_0x534b6d,_0x42845d[_0x8acb('0x10')][_0x8acb('0x12')]);return _0x16e318(_0x42845d[_0x8acb('0x10')][_0x8acb('0x12')]);}else{logger['info'](_0x8acb('0x11'),_0x534b6d,_0x8acb('0xd'));_0x16e318(_0x42845d[_0x8acb('0x13')][_0x8acb('0x12')]);}})[_0x8acb('0x14')](function(_0x35c7a8){logger[_0x8acb('0x10')](_0x8acb('0x11'),_0x534b6d,_0x35c7a8);_0x131299(_0x35c7a8);});});}exports[_0x8acb('0x15')]=function(_0x5c8edc){var _0x2a2427=this;return new Promise(function(_0x49dee5,_0x4799fe){return db['Campaign'][_0x8acb('0x16')]({'raw':_0x5c8edc['options']?_0x5c8edc[_0x8acb('0x17')][_0x8acb('0x18')]===undefined?!![]:![]:!![],'where':_0x5c8edc['options']?_0x5c8edc[_0x8acb('0x17')][_0x8acb('0x19')]||null:null,'attributes':_0x5c8edc[_0x8acb('0x17')]?_0x5c8edc[_0x8acb('0x17')][_0x8acb('0x1a')]||null:null,'limit':_0x5c8edc[_0x8acb('0x17')]?_0x5c8edc[_0x8acb('0x17')]['limit']||null:null,'include':_0x5c8edc['options']?_0x5c8edc[_0x8acb('0x17')][_0x8acb('0x1b')]?_[_0x8acb('0x1c')](_0x5c8edc[_0x8acb('0x17')][_0x8acb('0x1b')],function(_0x3db998){return{'model':db[_0x3db998[_0x8acb('0x1d')]],'as':_0x3db998['as'],'attributes':_0x3db998[_0x8acb('0x1a')],'include':_0x3db998['include']?_[_0x8acb('0x1c')](_0x3db998['include'],function(_0x273a4c){return{'model':db[_0x273a4c['model']],'as':_0x273a4c['as'],'attributes':_0x273a4c[_0x8acb('0x1a')],'include':_0x273a4c[_0x8acb('0x1b')]?_['map'](_0x273a4c[_0x8acb('0x1b')],function(_0x4e0c59){return{'model':db[_0x4e0c59[_0x8acb('0x1d')]],'as':_0x4e0c59['as'],'attributes':_0x4e0c59[_0x8acb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8acb('0xc')](function(_0x30edf2){logger[_0x8acb('0x1e')]('GetCampaign',_0x5c8edc);logger[_0x8acb('0xe')](_0x8acb('0x15'),_0x5c8edc,JSON[_0x8acb('0x1f')](_0x30edf2));_0x49dee5(_0x30edf2);})[_0x8acb('0x14')](function(_0x88a7e0){logger[_0x8acb('0x10')](_0x8acb('0x15'),_0x88a7e0[_0x8acb('0x12')],_0x5c8edc);_0x4799fe(_0x2a2427[_0x8acb('0x10')](0x1f4,_0x88a7e0['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index b9605ee..ca5d5fa 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 _0x4b1d=['getLists','/:id/blacklists','getBlackLists','create','post','/:id/clone','addLists','addBlackLists','update','delete','destroy','removeLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists'];(function(_0x4bde70,_0x3ac3aa){var _0x22195b=function(_0x7bf2c0){while(--_0x7bf2c0){_0x4bde70['push'](_0x4bde70['shift']());}};_0x22195b(++_0x3ac3aa);}(_0x4b1d,0x16b));var _0xd4b1=function(_0x240a26,_0x15b6c3){_0x240a26=_0x240a26-0x0;var _0x36c6f2=_0x4b1d[_0x240a26];return _0x36c6f2;};'use strict';var multer=require(_0xd4b1('0x0'));var util=require(_0xd4b1('0x1'));var path=require(_0xd4b1('0x2'));var timeout=require(_0xd4b1('0x3'));var express=require(_0xd4b1('0x4'));var router=express[_0xd4b1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd4b1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd4b1('0x7'));var controller=require(_0xd4b1('0x8'));router[_0xd4b1('0x9')]('/',auth[_0xd4b1('0xa')](),controller['index']);router[_0xd4b1('0x9')](_0xd4b1('0xb'),auth['isAuthenticated'](),controller[_0xd4b1('0xc')]);router['get'](_0xd4b1('0xd'),auth[_0xd4b1('0xa')](),controller[_0xd4b1('0xe')]);router[_0xd4b1('0x9')](_0xd4b1('0xf'),auth[_0xd4b1('0xa')](),controller[_0xd4b1('0x10')]);router[_0xd4b1('0x9')](_0xd4b1('0x11'),auth[_0xd4b1('0xa')](),controller[_0xd4b1('0x12')]);router['get'](_0xd4b1('0x13'),auth['isAuthenticated'](),controller[_0xd4b1('0x14')]);router[_0xd4b1('0x9')](_0xd4b1('0x15'),auth[_0xd4b1('0xa')](),controller[_0xd4b1('0x16')]);router[_0xd4b1('0x9')](_0xd4b1('0x17'),auth['isAuthenticated'](),controller[_0xd4b1('0x18')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd4b1('0x19')]);router[_0xd4b1('0x1a')](_0xd4b1('0x1b'),auth['isAuthenticated'](),controller['clone']);router['post'](_0xd4b1('0x15'),auth[_0xd4b1('0xa')](),controller[_0xd4b1('0x1c')]);router[_0xd4b1('0x1a')](_0xd4b1('0x17'),auth[_0xd4b1('0xa')](),controller[_0xd4b1('0x1d')]);router['put']('/:id',auth[_0xd4b1('0xa')](),controller[_0xd4b1('0x1e')]);router[_0xd4b1('0x1f')](_0xd4b1('0xb'),auth['isAuthenticated'](),controller[_0xd4b1('0x20')]);router[_0xd4b1('0x1f')](_0xd4b1('0x15'),auth['isAuthenticated'](),controller[_0xd4b1('0x21')]);router[_0xd4b1('0x1f')](_0xd4b1('0x17'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0xd4b1('0x22')]=router; \ No newline at end of file +var _0xd088=['/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','/:id/lists','addLists','addBlackLists','put','update','delete','removeLists','removeBlackLists','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index'];(function(_0x55d74c,_0x1ad8fc){var _0x43da87=function(_0x26eb7d){while(--_0x26eb7d){_0x55d74c['push'](_0x55d74c['shift']());}};_0x43da87(++_0x1ad8fc);}(_0xd088,0x160));var _0x8d08=function(_0x55ba7,_0x46c5d6){_0x55ba7=_0x55ba7-0x0;var _0x4e3b3e=_0xd088[_0x55ba7];return _0x4e3b3e;};'use strict';var multer=require(_0x8d08('0x0'));var util=require(_0x8d08('0x1'));var path=require(_0x8d08('0x2'));var timeout=require(_0x8d08('0x3'));var express=require(_0x8d08('0x4'));var router=express['Router']();var fs_extra=require(_0x8d08('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8d08('0x6'));var config=require('../../config/environment');var controller=require(_0x8d08('0x7'));router[_0x8d08('0x8')]('/',auth[_0x8d08('0x9')](),controller[_0x8d08('0xa')]);router['get'](_0x8d08('0xb'),auth[_0x8d08('0x9')](),controller['show']);router['get'](_0x8d08('0xc'),auth[_0x8d08('0x9')](),controller[_0x8d08('0xd')]);router['get'](_0x8d08('0xe'),auth[_0x8d08('0x9')](),controller['getHopperHistories']);router[_0x8d08('0x8')](_0x8d08('0xf'),auth['isAuthenticated'](),controller[_0x8d08('0x10')]);router['get'](_0x8d08('0x11'),auth[_0x8d08('0x9')](),controller['getHopperBlacks']);router['get']('/:id/lists',auth[_0x8d08('0x9')](),controller[_0x8d08('0x12')]);router[_0x8d08('0x8')](_0x8d08('0x13'),auth[_0x8d08('0x9')](),controller[_0x8d08('0x14')]);router[_0x8d08('0x15')]('/',auth[_0x8d08('0x9')](),controller[_0x8d08('0x16')]);router['post'](_0x8d08('0x17'),auth['isAuthenticated'](),controller[_0x8d08('0x18')]);router[_0x8d08('0x15')](_0x8d08('0x19'),auth[_0x8d08('0x9')](),controller[_0x8d08('0x1a')]);router['post'](_0x8d08('0x13'),auth[_0x8d08('0x9')](),controller[_0x8d08('0x1b')]);router[_0x8d08('0x1c')](_0x8d08('0xb'),auth['isAuthenticated'](),controller[_0x8d08('0x1d')]);router[_0x8d08('0x1e')](_0x8d08('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0x8d08('0x1e')](_0x8d08('0x19'),auth[_0x8d08('0x9')](),controller[_0x8d08('0x1f')]);router[_0x8d08('0x1e')](_0x8d08('0x13'),auth[_0x8d08('0x9')](),controller[_0x8d08('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 5db7391..29e6870 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 _0x31f4=['VIRTUAL','getDataValue','key','sequelize','exports','STRING'];(function(_0x136d6d,_0x3354f3){var _0x49e2d3=function(_0x180c70){while(--_0x180c70){_0x136d6d['push'](_0x136d6d['shift']());}};_0x49e2d3(++_0x3354f3);}(_0x31f4,0x1c5));var _0x431f=function(_0x71e493,_0x4308b7){_0x71e493=_0x71e493-0x0;var _0x3d40ab=_0x31f4[_0x71e493];return _0x3d40ab;};'use strict';var Sequelize=require(_0x431f('0x0'));module[_0x431f('0x1')]={'key':{'type':Sequelize[_0x431f('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x431f('0x3')],'get':function(){return this[_0x431f('0x4')](_0x431f('0x5'));}}}; \ No newline at end of file +var _0xe9f1=['key','sequelize','exports','STRING','VIRTUAL','getDataValue'];(function(_0x2f3338,_0x17e127){var _0x13d4c9=function(_0x261d12){while(--_0x261d12){_0x2f3338['push'](_0x2f3338['shift']());}};_0x13d4c9(++_0x17e127);}(_0xe9f1,0x9d));var _0x1e9f=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xe9f1[_0x54d4a8];return _0x3b321b;};'use strict';var Sequelize=require(_0x1e9f('0x0'));module[_0x1e9f('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x1e9f('0x2')]},'name':{'type':Sequelize[_0x1e9f('0x3')],'get':function(){return this[_0x1e9f('0x4')](_0x1e9f('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 9fb3d49..bb52bb5 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 _0xfdf3=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','CannedAnswer','includeAll','include','findAll','catch','show','params','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','destroy','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','attributes'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xfdf3,0x17c));var _0x3fdf=function(_0x1f0ac6,_0x57c088){_0x1f0ac6=_0x1f0ac6-0x0;var _0x395e7b=_0xfdf3[_0x1f0ac6];return _0x395e7b;};'use strict';var emlformat=require(_0x3fdf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3fdf('0x1'));var jsonpatch=require(_0x3fdf('0x2'));var rp=require(_0x3fdf('0x3'));var moment=require(_0x3fdf('0x4'));var BPromise=require(_0x3fdf('0x5'));var Mustache=require(_0x3fdf('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x3fdf('0x7'));var ejs=require(_0x3fdf('0x8'));var fs=require('fs');var fs_extra=require(_0x3fdf('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3fdf('0x7'));var querystring=require(_0x3fdf('0xa'));var Papa=require(_0x3fdf('0xb'));var Redis=require('ioredis');var authService=require(_0x3fdf('0xc'));var qs=require(_0x3fdf('0xd'));var as=require(_0x3fdf('0xe'));var hardwareService=require(_0x3fdf('0xf'));var logger=require(_0x3fdf('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x3fdf('0x11'));var licenseUtil=require(_0x3fdf('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x540981,_0x52c115){_0x52c115=_0x52c115||0xcc;return function(_0x7a8882){if(_0x7a8882){return _0x540981[_0x3fdf('0x13')](_0x52c115);}return _0x540981[_0x3fdf('0x14')](_0x52c115)[_0x3fdf('0x15')]();};}function respondWithResult(_0x229fa7,_0x834e00){_0x834e00=_0x834e00||0xc8;return function(_0x493045){if(_0x493045){return _0x229fa7[_0x3fdf('0x14')](_0x834e00)[_0x3fdf('0x16')](_0x493045);}};}function respondWithFilteredResult(_0x3b93e0,_0x452392){return function(_0x10f841){if(_0x10f841){var _0x235670=typeof _0x452392[_0x3fdf('0x17')]===_0x3fdf('0x18')&&typeof _0x452392[_0x3fdf('0x19')]==='undefined';var _0x3e39f3=_0x10f841['count'];var _0x3b00ad=_0x235670?0x0:_0x452392[_0x3fdf('0x17')];var _0x3abe02=_0x235670?_0x10f841[_0x3fdf('0x1a')]:_0x452392[_0x3fdf('0x17')]+_0x452392['limit'];var _0x547f2c;if(_0x3abe02>=_0x3e39f3){_0x3abe02=_0x3e39f3;_0x547f2c=0xc8;}else{_0x547f2c=0xce;}_0x3b93e0[_0x3fdf('0x14')](_0x547f2c);return _0x3b93e0[_0x3fdf('0x1b')](_0x3fdf('0x1c'),_0x3b00ad+'-'+_0x3abe02+'/'+_0x3e39f3)['json'](_0x10f841);}return null;};}function patchUpdates(_0xfe3c30){return function(_0x3a8c57){try{jsonpatch[_0x3fdf('0x1d')](_0x3a8c57,_0xfe3c30,!![]);}catch(_0x2c5974){return BPromise[_0x3fdf('0x1e')](_0x2c5974);}return _0x3a8c57[_0x3fdf('0x1f')]();};}function saveUpdates(_0x4b8ecf,_0x152836){return function(_0x2876d6){if(_0x2876d6){return _0x2876d6[_0x3fdf('0x20')](_0x4b8ecf)[_0x3fdf('0x21')](function(_0x1d8f24){return _0x1d8f24;});}return null;};}function removeEntity(_0x19c199,_0x420609){return function(_0x369cda){if(_0x369cda){return _0x369cda['destroy']()[_0x3fdf('0x21')](function(){var _0x1fd941=_0x369cda[_0x3fdf('0x22')]({'plain':!![]});var _0x273a9d='CannedAnswers';return db['UserProfileResource'][_0x3fdf('0x23')]({'where':{'type':_0x273a9d,'resourceId':_0x1fd941['id']}})[_0x3fdf('0x21')](function(){return _0x369cda;});})[_0x3fdf('0x21')](function(){_0x19c199['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45dec,_0x49f1ed){return function(_0x477c19){if(!_0x477c19){_0x45dec['sendStatus'](0x194);}return _0x477c19;};}function handleError(_0x5e1f13,_0x235467){_0x235467=_0x235467||0x1f4;return function(_0x37a3d1){logger[_0x3fdf('0x24')](_0x37a3d1[_0x3fdf('0x25')]);if(_0x37a3d1[_0x3fdf('0x26')]){delete _0x37a3d1[_0x3fdf('0x26')];}_0x5e1f13['status'](_0x235467)[_0x3fdf('0x27')](_0x37a3d1);};}exports[_0x3fdf('0x28')]=function(_0x4a6677,_0x8a3270){var _0x901491={},_0x5a51a4={},_0xb3fe2e={'count':0x0,'rows':[]};var _0x5ecb6d=_['map'](db['CannedAnswer'][_0x3fdf('0x29')],function(_0x36a136){return{'name':_0x36a136['fieldName'],'type':_0x36a136[_0x3fdf('0x2a')][_0x3fdf('0x2b')]};});_0x5a51a4[_0x3fdf('0x2c')]=_[_0x3fdf('0x2d')](_0x5ecb6d,_0x3fdf('0x26'));_0x5a51a4[_0x3fdf('0x2e')]=_[_0x3fdf('0x2f')](_0x4a6677[_0x3fdf('0x2e')]);_0x5a51a4[_0x3fdf('0x30')]=_['intersection'](_0x5a51a4[_0x3fdf('0x2c')],_0x5a51a4[_0x3fdf('0x2e')]);_0x901491[_0x3fdf('0x31')]=_[_0x3fdf('0x32')](_0x5a51a4[_0x3fdf('0x2c')],qs[_0x3fdf('0x33')](_0x4a6677['query'][_0x3fdf('0x33')]));_0x901491[_0x3fdf('0x31')]=_0x901491['attributes'][_0x3fdf('0x34')]?_0x901491['attributes']:_0x5a51a4[_0x3fdf('0x2c')];if(!_0x4a6677[_0x3fdf('0x2e')][_0x3fdf('0x35')](_0x3fdf('0x36'))){_0x901491[_0x3fdf('0x19')]=qs['limit'](_0x4a6677[_0x3fdf('0x2e')][_0x3fdf('0x19')]);_0x901491[_0x3fdf('0x17')]=qs[_0x3fdf('0x17')](_0x4a6677[_0x3fdf('0x2e')][_0x3fdf('0x17')]);}_0x901491[_0x3fdf('0x37')]=qs['sort'](_0x4a6677[_0x3fdf('0x2e')][_0x3fdf('0x38')]);_0x901491[_0x3fdf('0x39')]=qs[_0x3fdf('0x30')](_[_0x3fdf('0x3a')](_0x4a6677[_0x3fdf('0x2e')],_0x5a51a4[_0x3fdf('0x30')]),_0x5ecb6d);if(_0x4a6677['query'][_0x3fdf('0x3b')]){_0x901491['where']=_[_0x3fdf('0x3c')](_0x901491[_0x3fdf('0x39')],{'$or':[{'key':{'$like':'%'+_0x4a6677[_0x3fdf('0x2e')][_0x3fdf('0x3b')]+'%'}},{'value':{'$like':'%'+_0x4a6677[_0x3fdf('0x2e')]['filter']+'%'}}]});}_0x901491=_['merge']({},_0x901491,_0x4a6677[_0x3fdf('0x3d')]);var _0x331fee={'where':_0x901491['where']};return db[_0x3fdf('0x3e')][_0x3fdf('0x1a')](_0x331fee)[_0x3fdf('0x21')](function(_0x2f3c6d){_0xb3fe2e[_0x3fdf('0x1a')]=_0x2f3c6d;if(_0x4a6677[_0x3fdf('0x2e')][_0x3fdf('0x3f')]){_0x901491[_0x3fdf('0x40')]=[{'all':!![]}];}return db[_0x3fdf('0x3e')][_0x3fdf('0x41')](_0x901491);})[_0x3fdf('0x21')](function(_0x518bbf){_0xb3fe2e['rows']=_0x518bbf;return _0xb3fe2e;})[_0x3fdf('0x21')](respondWithFilteredResult(_0x8a3270,_0x901491))[_0x3fdf('0x42')](handleError(_0x8a3270,null));};exports[_0x3fdf('0x43')]=function(_0x4f9a01,_0x472d11){var _0x1d22d9={'raw':!![],'where':{'id':_0x4f9a01[_0x3fdf('0x44')]['id']}},_0x4972ea={};_0x4972ea[_0x3fdf('0x2c')]=_[_0x3fdf('0x2f')](db[_0x3fdf('0x3e')][_0x3fdf('0x29')]);_0x4972ea[_0x3fdf('0x2e')]=_[_0x3fdf('0x2f')](_0x4f9a01[_0x3fdf('0x2e')]);_0x4972ea[_0x3fdf('0x30')]=_[_0x3fdf('0x32')](_0x4972ea[_0x3fdf('0x2c')],_0x4972ea['query']);_0x1d22d9[_0x3fdf('0x31')]=_[_0x3fdf('0x32')](_0x4972ea[_0x3fdf('0x2c')],qs[_0x3fdf('0x33')](_0x4f9a01['query'][_0x3fdf('0x33')]));_0x1d22d9[_0x3fdf('0x31')]=_0x1d22d9[_0x3fdf('0x31')][_0x3fdf('0x34')]?_0x1d22d9[_0x3fdf('0x31')]:_0x4972ea[_0x3fdf('0x2c')];if(_0x4f9a01['query'][_0x3fdf('0x3f')]){_0x1d22d9[_0x3fdf('0x40')]=[{'all':!![]}];}_0x1d22d9=_['merge']({},_0x1d22d9,_0x4f9a01[_0x3fdf('0x3d')]);return db[_0x3fdf('0x3e')][_0x3fdf('0x45')](_0x1d22d9)['then'](handleEntityNotFound(_0x472d11,null))[_0x3fdf('0x21')](respondWithResult(_0x472d11,null))[_0x3fdf('0x42')](handleError(_0x472d11,null));};exports[_0x3fdf('0x20')]=function(_0x379250,_0x6439db){if(_0x379250[_0x3fdf('0x46')]['id']){delete _0x379250[_0x3fdf('0x46')]['id'];}return db['CannedAnswer'][_0x3fdf('0x45')]({'where':{'id':_0x379250[_0x3fdf('0x44')]['id']}})['then'](handleEntityNotFound(_0x6439db,null))[_0x3fdf('0x21')](saveUpdates(_0x379250['body'],null))[_0x3fdf('0x21')](respondWithResult(_0x6439db,null))[_0x3fdf('0x42')](handleError(_0x6439db,null));};exports['destroy']=function(_0x55f80a,_0x396626){return db['CannedAnswer'][_0x3fdf('0x45')]({'where':{'id':_0x55f80a[_0x3fdf('0x44')]['id']}})[_0x3fdf('0x21')](handleEntityNotFound(_0x396626,null))[_0x3fdf('0x21')](removeEntity(_0x396626,null))[_0x3fdf('0x42')](handleError(_0x396626,null));};exports[_0x3fdf('0x47')]=function(_0xd902e4,_0xdb3745){var _0x298891={'key':_0xd902e4[_0x3fdf('0x46')][_0x3fdf('0x2b')]};if(_0xd902e4['body'][_0x3fdf('0x48')]){_0x298891[_0x3fdf('0x48')]=_0xd902e4[_0x3fdf('0x46')][_0x3fdf('0x48')];}else if(_0xd902e4[_0x3fdf('0x46')][_0x3fdf('0x49')]){_0x298891['SmsAccountId']=_0xd902e4[_0x3fdf('0x46')][_0x3fdf('0x49')];}else if(_0xd902e4[_0x3fdf('0x46')][_0x3fdf('0x4a')]){_0x298891['OpenchannelAccountId']=_0xd902e4[_0x3fdf('0x46')][_0x3fdf('0x4a')];}else if(_0xd902e4[_0x3fdf('0x46')][_0x3fdf('0x4b')]){_0x298891[_0x3fdf('0x4b')]=_0xd902e4[_0x3fdf('0x46')][_0x3fdf('0x4b')];}return db[_0x3fdf('0x3e')][_0x3fdf('0x45')]({'where':_0x298891})['then'](function(_0x9fd159){if(_0x9fd159){throw new db[(_0x3fdf('0x4c'))][(_0x3fdf('0x4d'))](_0x3fdf('0x4e'));}return db[_0x3fdf('0x3e')][_0x3fdf('0x47')](_0xd902e4['body']);})['then'](function(_0x2a526b){var _0xe2e74c=_0xd902e4[_0x3fdf('0x4f')][_0x3fdf('0x22')]({'plain':!![]});if(!_0xe2e74c)throw new Error(_0x3fdf('0x50'));if(_0xe2e74c[_0x3fdf('0x51')]===_0x3fdf('0x4f')){var _0x4c1413=_0x2a526b[_0x3fdf('0x22')]({'plain':!![]});return db[_0x3fdf('0x52')][_0x3fdf('0x45')]({'where':{'name':'CannedAnswers','userProfileId':_0xe2e74c[_0x3fdf('0x53')]},'raw':!![]})[_0x3fdf('0x21')](function(_0x51f3fb){if(_0x51f3fb&&_0x51f3fb['autoAssociation']===0x0){return db[_0x3fdf('0x54')]['create']({'name':_0x4c1413[_0x3fdf('0x26')],'resourceId':_0x4c1413['id'],'type':_0x51f3fb['name'],'sectionId':_0x51f3fb['id']},{})[_0x3fdf('0x21')](function(){return _0x2a526b;});}else{return _0x2a526b;}})['catch'](function(_0x45c927){logger[_0x3fdf('0x24')](_0x3fdf('0x55'),_0x45c927);throw _0x45c927;});}return _0x2a526b;})[_0x3fdf('0x21')](respondWithResult(_0xdb3745,0xc9))[_0x3fdf('0x42')](handleError(_0xdb3745,null));}; \ No newline at end of file +var _0x51ab=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','CannedAnswers','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','CannedAnswer','includeAll','findAll','rows','catch','show','params','keys','include','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x51ab,0x1b7));var _0xb51a=function(_0x3488e2,_0x4d5ce0){_0x3488e2=_0x3488e2-0x0;var _0x299dc8=_0x51ab[_0x3488e2];return _0x299dc8;};'use strict';var emlformat=require(_0xb51a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb51a('0x1'));var jsonpatch=require(_0xb51a('0x2'));var rp=require(_0xb51a('0x3'));var moment=require(_0xb51a('0x4'));var BPromise=require(_0xb51a('0x5'));var Mustache=require('mustache');var util=require(_0xb51a('0x6'));var path=require(_0xb51a('0x7'));var sox=require(_0xb51a('0x8'));var csv=require(_0xb51a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb51a('0xa'));var _=require(_0xb51a('0xb'));var squel=require(_0xb51a('0xc'));var crypto=require(_0xb51a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb51a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb51a('0xf'));var Papa=require(_0xb51a('0x10'));var Redis=require(_0xb51a('0x11'));var authService=require(_0xb51a('0x12'));var qs=require(_0xb51a('0x13'));var as=require(_0xb51a('0x14'));var hardwareService=require(_0xb51a('0x15'));var logger=require(_0xb51a('0x16'))('api');var utils=require(_0xb51a('0x17'));var config=require(_0xb51a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb51a('0x19'))['db'];function respondWithStatusCode(_0x9c92ab,_0x4af1e6){_0x4af1e6=_0x4af1e6||0xcc;return function(_0x156b45){if(_0x156b45){return _0x9c92ab[_0xb51a('0x1a')](_0x4af1e6);}return _0x9c92ab[_0xb51a('0x1b')](_0x4af1e6)[_0xb51a('0x1c')]();};}function respondWithResult(_0x293db4,_0x5bd127){_0x5bd127=_0x5bd127||0xc8;return function(_0xeae35f){if(_0xeae35f){return _0x293db4['status'](_0x5bd127)['json'](_0xeae35f);}};}function respondWithFilteredResult(_0x10807a,_0x42347a){return function(_0x10c324){if(_0x10c324){var _0x167fc4=typeof _0x42347a[_0xb51a('0x1d')]==='undefined'&&typeof _0x42347a['limit']===_0xb51a('0x1e');var _0x3de1b5=_0x10c324[_0xb51a('0x1f')];var _0x455a73=_0x167fc4?0x0:_0x42347a[_0xb51a('0x1d')];var _0x32d86e=_0x167fc4?_0x10c324[_0xb51a('0x1f')]:_0x42347a[_0xb51a('0x1d')]+_0x42347a['limit'];var _0x5b8db8;if(_0x32d86e>=_0x3de1b5){_0x32d86e=_0x3de1b5;_0x5b8db8=0xc8;}else{_0x5b8db8=0xce;}_0x10807a[_0xb51a('0x1b')](_0x5b8db8);return _0x10807a[_0xb51a('0x20')](_0xb51a('0x21'),_0x455a73+'-'+_0x32d86e+'/'+_0x3de1b5)['json'](_0x10c324);}return null;};}function patchUpdates(_0xe3f11){return function(_0x15dc55){try{jsonpatch[_0xb51a('0x22')](_0x15dc55,_0xe3f11,!![]);}catch(_0x3dca77){return BPromise['reject'](_0x3dca77);}return _0x15dc55[_0xb51a('0x23')]();};}function saveUpdates(_0x47fdb1,_0xf6ab5a){return function(_0x29ef0f){if(_0x29ef0f){return _0x29ef0f[_0xb51a('0x24')](_0x47fdb1)[_0xb51a('0x25')](function(_0x43fcc9){return _0x43fcc9;});}return null;};}function removeEntity(_0x5f4c1f,_0x302dd6){return function(_0x1ee41d){if(_0x1ee41d){return _0x1ee41d[_0xb51a('0x26')]()[_0xb51a('0x25')](function(){var _0x4605f8=_0x1ee41d[_0xb51a('0x27')]({'plain':!![]});var _0x2387e2=_0xb51a('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x2387e2,'resourceId':_0x4605f8['id']}})['then'](function(){return _0x1ee41d;});})['then'](function(){_0x5f4c1f[_0xb51a('0x1b')](0xcc)[_0xb51a('0x1c')]();});}};}function handleEntityNotFound(_0x114bcf,_0x1dc44c){return function(_0x50bac1){if(!_0x50bac1){_0x114bcf[_0xb51a('0x1a')](0x194);}return _0x50bac1;};}function handleError(_0x3066b5,_0x3a15d4){_0x3a15d4=_0x3a15d4||0x1f4;return function(_0x71490b){logger[_0xb51a('0x29')](_0x71490b[_0xb51a('0x2a')]);if(_0x71490b[_0xb51a('0x2b')]){delete _0x71490b['name'];}_0x3066b5[_0xb51a('0x1b')](_0x3a15d4)[_0xb51a('0x2c')](_0x71490b);};}exports[_0xb51a('0x2d')]=function(_0xf61470,_0x156bc6){var _0x17a7ff={},_0x5a2ed6={},_0x4ab056={'count':0x0,'rows':[]};var _0xe9b535=_[_0xb51a('0x2e')](db['CannedAnswer'][_0xb51a('0x2f')],function(_0x4c660b){return{'name':_0x4c660b[_0xb51a('0x30')],'type':_0x4c660b[_0xb51a('0x31')][_0xb51a('0x32')]};});_0x5a2ed6[_0xb51a('0x33')]=_[_0xb51a('0x2e')](_0xe9b535,_0xb51a('0x2b'));_0x5a2ed6[_0xb51a('0x34')]=_['keys'](_0xf61470['query']);_0x5a2ed6[_0xb51a('0x35')]=_[_0xb51a('0x36')](_0x5a2ed6[_0xb51a('0x33')],_0x5a2ed6[_0xb51a('0x34')]);_0x17a7ff[_0xb51a('0x37')]=_[_0xb51a('0x36')](_0x5a2ed6[_0xb51a('0x33')],qs[_0xb51a('0x38')](_0xf61470['query'][_0xb51a('0x38')]));_0x17a7ff[_0xb51a('0x37')]=_0x17a7ff[_0xb51a('0x37')][_0xb51a('0x39')]?_0x17a7ff['attributes']:_0x5a2ed6[_0xb51a('0x33')];if(!_0xf61470[_0xb51a('0x34')][_0xb51a('0x3a')]('nolimit')){_0x17a7ff[_0xb51a('0x3b')]=qs[_0xb51a('0x3b')](_0xf61470[_0xb51a('0x34')][_0xb51a('0x3b')]);_0x17a7ff[_0xb51a('0x1d')]=qs[_0xb51a('0x1d')](_0xf61470['query'][_0xb51a('0x1d')]);}_0x17a7ff[_0xb51a('0x3c')]=qs[_0xb51a('0x3d')](_0xf61470[_0xb51a('0x34')]['sort']);_0x17a7ff[_0xb51a('0x3e')]=qs[_0xb51a('0x35')](_[_0xb51a('0x3f')](_0xf61470[_0xb51a('0x34')],_0x5a2ed6[_0xb51a('0x35')]),_0xe9b535);if(_0xf61470['query'][_0xb51a('0x40')]){_0x17a7ff[_0xb51a('0x3e')]=_['merge'](_0x17a7ff[_0xb51a('0x3e')],{'$or':[{'key':{'$like':'%'+_0xf61470['query']['filter']+'%'}},{'value':{'$like':'%'+_0xf61470[_0xb51a('0x34')][_0xb51a('0x40')]+'%'}}]});}_0x17a7ff=_[_0xb51a('0x41')]({},_0x17a7ff,_0xf61470[_0xb51a('0x42')]);var _0x407b4d={'where':_0x17a7ff['where']};return db[_0xb51a('0x43')]['count'](_0x407b4d)[_0xb51a('0x25')](function(_0x14c78b){_0x4ab056[_0xb51a('0x1f')]=_0x14c78b;if(_0xf61470[_0xb51a('0x34')][_0xb51a('0x44')]){_0x17a7ff['include']=[{'all':!![]}];}return db[_0xb51a('0x43')][_0xb51a('0x45')](_0x17a7ff);})[_0xb51a('0x25')](function(_0x27b719){_0x4ab056[_0xb51a('0x46')]=_0x27b719;return _0x4ab056;})[_0xb51a('0x25')](respondWithFilteredResult(_0x156bc6,_0x17a7ff))[_0xb51a('0x47')](handleError(_0x156bc6,null));};exports[_0xb51a('0x48')]=function(_0x332c46,_0x4f5784){var _0x192edf={'raw':!![],'where':{'id':_0x332c46[_0xb51a('0x49')]['id']}},_0x304602={};_0x304602[_0xb51a('0x33')]=_[_0xb51a('0x4a')](db[_0xb51a('0x43')][_0xb51a('0x2f')]);_0x304602[_0xb51a('0x34')]=_[_0xb51a('0x4a')](_0x332c46[_0xb51a('0x34')]);_0x304602['filters']=_[_0xb51a('0x36')](_0x304602[_0xb51a('0x33')],_0x304602[_0xb51a('0x34')]);_0x192edf[_0xb51a('0x37')]=_[_0xb51a('0x36')](_0x304602[_0xb51a('0x33')],qs[_0xb51a('0x38')](_0x332c46[_0xb51a('0x34')][_0xb51a('0x38')]));_0x192edf[_0xb51a('0x37')]=_0x192edf['attributes'][_0xb51a('0x39')]?_0x192edf[_0xb51a('0x37')]:_0x304602[_0xb51a('0x33')];if(_0x332c46['query'][_0xb51a('0x44')]){_0x192edf[_0xb51a('0x4b')]=[{'all':!![]}];}_0x192edf=_[_0xb51a('0x41')]({},_0x192edf,_0x332c46[_0xb51a('0x42')]);return db[_0xb51a('0x43')][_0xb51a('0x4c')](_0x192edf)[_0xb51a('0x25')](handleEntityNotFound(_0x4f5784,null))['then'](respondWithResult(_0x4f5784,null))['catch'](handleError(_0x4f5784,null));};exports[_0xb51a('0x24')]=function(_0x254660,_0x56406a){if(_0x254660['body']['id']){delete _0x254660[_0xb51a('0x4d')]['id'];}return db[_0xb51a('0x43')][_0xb51a('0x4c')]({'where':{'id':_0x254660[_0xb51a('0x49')]['id']}})['then'](handleEntityNotFound(_0x56406a,null))[_0xb51a('0x25')](saveUpdates(_0x254660[_0xb51a('0x4d')],null))['then'](respondWithResult(_0x56406a,null))[_0xb51a('0x47')](handleError(_0x56406a,null));};exports[_0xb51a('0x26')]=function(_0x426d1e,_0x7e787c){return db['CannedAnswer'][_0xb51a('0x4c')]({'where':{'id':_0x426d1e['params']['id']}})[_0xb51a('0x25')](handleEntityNotFound(_0x7e787c,null))[_0xb51a('0x25')](removeEntity(_0x7e787c,null))[_0xb51a('0x47')](handleError(_0x7e787c,null));};exports['create']=function(_0xdd1540,_0x55ca33){var _0x19d996={'key':_0xdd1540[_0xb51a('0x4d')]['key']};if(_0xdd1540[_0xb51a('0x4d')][_0xb51a('0x4e')]){_0x19d996[_0xb51a('0x4e')]=_0xdd1540[_0xb51a('0x4d')][_0xb51a('0x4e')];}else if(_0xdd1540[_0xb51a('0x4d')][_0xb51a('0x4f')]){_0x19d996[_0xb51a('0x4f')]=_0xdd1540['body']['SmsAccountId'];}else if(_0xdd1540[_0xb51a('0x4d')][_0xb51a('0x50')]){_0x19d996[_0xb51a('0x50')]=_0xdd1540[_0xb51a('0x4d')][_0xb51a('0x50')];}else if(_0xdd1540[_0xb51a('0x4d')][_0xb51a('0x51')]){_0x19d996[_0xb51a('0x51')]=_0xdd1540[_0xb51a('0x4d')][_0xb51a('0x51')];}return db[_0xb51a('0x43')][_0xb51a('0x4c')]({'where':_0x19d996})['then'](function(_0x318e65){if(_0x318e65){throw new db[(_0xb51a('0x52'))][(_0xb51a('0x53'))](_0xb51a('0x54'));}return db['CannedAnswer']['create'](_0xdd1540[_0xb51a('0x4d')]);})[_0xb51a('0x25')](function(_0x16142b){var _0x307075=_0xdd1540['user']['get']({'plain':!![]});if(!_0x307075)throw new Error(_0xb51a('0x55'));if(_0x307075[_0xb51a('0x56')]==='user'){var _0x12fdba=_0x16142b[_0xb51a('0x27')]({'plain':!![]});return db[_0xb51a('0x57')][_0xb51a('0x4c')]({'where':{'name':_0xb51a('0x28'),'userProfileId':_0x307075[_0xb51a('0x58')]},'raw':!![]})[_0xb51a('0x25')](function(_0x1b60b6){if(_0x1b60b6&&_0x1b60b6[_0xb51a('0x59')]===0x0){return db['UserProfileResource'][_0xb51a('0x5a')]({'name':_0x12fdba[_0xb51a('0x2b')],'resourceId':_0x12fdba['id'],'type':_0x1b60b6[_0xb51a('0x2b')],'sectionId':_0x1b60b6['id']},{})[_0xb51a('0x25')](function(){return _0x16142b;});}else{return _0x16142b;}})[_0xb51a('0x47')](function(_0xaaec95){logger[_0xb51a('0x29')](_0xb51a('0x5b'),_0xaaec95);throw _0xaaec95;});}return _0x16142b;})[_0xb51a('0x25')](respondWithResult(_0x55ca33,0xc9))[_0xb51a('0x47')](handleError(_0x55ca33,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 8fda4a3..5fbe2ea 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 _0xeb5e=['tools_canned_answers','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer'];(function(_0x525847,_0x240458){var _0x4b8fb9=function(_0x421075){while(--_0x421075){_0x525847['push'](_0x525847['shift']());}};_0x4b8fb9(++_0x240458);}(_0xeb5e,0x17c));var _0xeeb5=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0xeb5e[_0x58afd5];return _0x3e503b;};'use strict';var _=require(_0xeeb5('0x0'));var util=require('util');var logger=require(_0xeeb5('0x1'))(_0xeeb5('0x2'));var moment=require(_0xeeb5('0x3'));var BPromise=require(_0xeeb5('0x4'));var rp=require(_0xeeb5('0x5'));var fs=require('fs');var path=require(_0xeeb5('0x6'));var rimraf=require(_0xeeb5('0x7'));var config=require(_0xeeb5('0x8'));var attributes=require(_0xeeb5('0x9'));module[_0xeeb5('0xa')]=function(_0x571898,_0x3b7a2c){return _0x571898['define'](_0xeeb5('0xb'),attributes,{'tableName':_0xeeb5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeeb5('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xaa54=['./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0xaa54,0x166));var _0x4aa5=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xaa54[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x4aa5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4aa5('0x1'));var BPromise=require(_0x4aa5('0x2'));var rp=require(_0x4aa5('0x3'));var fs=require('fs');var path=require(_0x4aa5('0x4'));var rimraf=require('rimraf');var config=require(_0x4aa5('0x5'));var attributes=require(_0x4aa5('0x6'));module[_0x4aa5('0x7')]=function(_0x129dd2,_0x9625e9){return _0x129dd2[_0x4aa5('0x8')](_0x4aa5('0x9'),attributes,{'tableName':_0x4aa5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4aa5('0xb'),'collate':_0x4aa5('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index eba5404..7690016 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(_0x52c959,_0x5cd081){var _0x26c576=function(_0x450ed1){while(--_0x450ed1){_0x52c959['push'](_0x52c959['shift']());}};_0x26c576(++_0x5cd081);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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(_0x3911a5,_0x42dc5f){var _0x44b411=function(_0x2cab20){while(--_0x2cab20){_0x3911a5['push'](_0x3911a5['shift']());}};_0x44b411(++_0x42dc5f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 1404be4..e771144 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 _0x0784=['../../config/environment','get','isAuthenticated','index','/:id','show','post','put','delete','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4a61a8,_0x24aafe){var _0x18746f=function(_0x510b62){while(--_0x510b62){_0x4a61a8['push'](_0x4a61a8['shift']());}};_0x18746f(++_0x24aafe);}(_0x0784,0xd9));var _0x4078=function(_0x24341c,_0x3e9ad1){_0x24341c=_0x24341c-0x0;var _0x9c4913=_0x0784[_0x24341c];return _0x9c4913;};'use strict';var multer=require(_0x4078('0x0'));var util=require('util');var path=require(_0x4078('0x1'));var timeout=require('connect-timeout');var express=require(_0x4078('0x2'));var router=express[_0x4078('0x3')]();var fs_extra=require(_0x4078('0x4'));var auth=require(_0x4078('0x5'));var interaction=require(_0x4078('0x6'));var config=require(_0x4078('0x7'));var controller=require('./cannedAnswer.controller');router[_0x4078('0x8')]('/',auth[_0x4078('0x9')](),controller[_0x4078('0xa')]);router[_0x4078('0x8')](_0x4078('0xb'),auth[_0x4078('0x9')](),controller[_0x4078('0xc')]);router[_0x4078('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4078('0xe')]('/:id',auth[_0x4078('0x9')](),controller['update']);router[_0x4078('0xf')](_0x4078('0xb'),auth[_0x4078('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8445=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id','show','post','put','update','delete','destroy'];(function(_0x439cdf,_0xf578a){var _0x3c8ac8=function(_0x54cbd4){while(--_0x54cbd4){_0x439cdf['push'](_0x439cdf['shift']());}};_0x3c8ac8(++_0xf578a);}(_0x8445,0x157));var _0x5844=function(_0xa9b632,_0xa63f62){_0xa9b632=_0xa9b632-0x0;var _0x199708=_0x8445[_0xa9b632];return _0x199708;};'use strict';var multer=require('multer');var util=require(_0x5844('0x0'));var path=require(_0x5844('0x1'));var timeout=require(_0x5844('0x2'));var express=require(_0x5844('0x3'));var router=express[_0x5844('0x4')]();var fs_extra=require(_0x5844('0x5'));var auth=require(_0x5844('0x6'));var interaction=require(_0x5844('0x7'));var config=require('../../config/environment');var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0x5844('0x8')](),controller['index']);router[_0x5844('0x9')](_0x5844('0xa'),auth[_0x5844('0x8')](),controller[_0x5844('0xb')]);router[_0x5844('0xc')]('/',auth[_0x5844('0x8')](),controller['create']);router[_0x5844('0xd')](_0x5844('0xa'),auth[_0x5844('0x8')](),controller[_0x5844('0xe')]);router[_0x5844('0xf')](_0x5844('0xa'),auth[_0x5844('0x8')](),controller[_0x5844('0x10')]);module[_0x5844('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 d60b82d..489f1fc 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 _0xc6fe=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x12bb5c,_0x71fd52){var _0x3a533e=function(_0x190065){while(--_0x190065){_0x12bb5c['push'](_0x12bb5c['shift']());}};_0x3a533e(++_0x71fd52);}(_0xc6fe,0xbc));var _0xec6f=function(_0x9cb3a8,_0x42950d){_0x9cb3a8=_0x9cb3a8-0x0;var _0x24a5f6=_0xc6fe[_0x9cb3a8];return _0x24a5f6;};'use strict';var Sequelize=require(_0xec6f('0x0'));module[_0xec6f('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xec6f('0x2')},'clid':{'type':Sequelize[_0xec6f('0x3')]},'src':{'type':Sequelize[_0xec6f('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xec6f('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xec6f('0x3')]},'lastapp':{'type':Sequelize[_0xec6f('0x3')]},'lastdata':{'type':Sequelize[_0xec6f('0x3')]},'duration':{'type':Sequelize[_0xec6f('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xec6f('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xec6f('0x3')]},'amaflags':{'type':Sequelize[_0xec6f('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xec6f('0x3')]},'userfield':{'type':Sequelize[_0xec6f('0x3')]},'uniqueid':{'type':Sequelize[_0xec6f('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xec6f('0x3')]},'peeraccount':{'type':Sequelize[_0xec6f('0x3')]},'type':{'type':Sequelize[_0xec6f('0x3')]},'tag':{'type':Sequelize[_0xec6f('0x3')]}}; \ No newline at end of file +var _0x6c6f=['sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x19a5d8,_0x347207){var _0x30104a=function(_0x292695){while(--_0x292695){_0x19a5d8['push'](_0x19a5d8['shift']());}};_0x30104a(++_0x347207);}(_0x6c6f,0x17a));var _0xf6c6=function(_0x32d40f,_0x584a3b){_0x32d40f=_0x32d40f-0x0;var _0x3feb12=_0x6c6f[_0x32d40f];return _0x3feb12;};'use strict';var Sequelize=require(_0xf6c6('0x0'));module[_0xf6c6('0x1')]={'calldate':{'type':Sequelize[_0xf6c6('0x2')],'allowNull':![],'defaultValue':_0xf6c6('0x3')},'clid':{'type':Sequelize[_0xf6c6('0x4')]},'src':{'type':Sequelize[_0xf6c6('0x4')]},'dst':{'type':Sequelize[_0xf6c6('0x4')]},'dcontext':{'type':Sequelize[_0xf6c6('0x4')]},'channel':{'type':Sequelize[_0xf6c6('0x4')]},'dstchannel':{'type':Sequelize[_0xf6c6('0x4')]},'lastapp':{'type':Sequelize[_0xf6c6('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xf6c6('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xf6c6('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xf6c6('0x4')]},'uniqueid':{'type':Sequelize[_0xf6c6('0x4')]},'linkedid':{'type':Sequelize[_0xf6c6('0x4')]},'sequence':{'type':Sequelize[_0xf6c6('0x4')]},'peeraccount':{'type':Sequelize[_0xf6c6('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xf6c6('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 2f2a661..54d298d 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 _0x0f4d=['query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','merge','type','options','include','findAll','rows','catch','rawAttributes','find','create','body','params','describe','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','index','map','Cdr','model'];(function(_0x5e65c5,_0x343dfc){var _0x24fe1a=function(_0x409b78){while(--_0x409b78){_0x5e65c5['push'](_0x5e65c5['shift']());}};_0x24fe1a(++_0x343dfc);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x1f9ba1,_0x10a396){_0x1f9ba1=_0x1f9ba1-0x0;var _0x4fe8b1=_0x0f4d[_0x1f9ba1];return _0x4fe8b1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd0f4('0x0'));var rp=require('request-promise');var moment=require(_0xd0f4('0x1'));var BPromise=require(_0xd0f4('0x2'));var Mustache=require(_0xd0f4('0x3'));var util=require(_0xd0f4('0x4'));var path=require(_0xd0f4('0x5'));var sox=require(_0xd0f4('0x6'));var csv=require(_0xd0f4('0x7'));var ejs=require(_0xd0f4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd0f4('0x9'));var squel=require(_0xd0f4('0xa'));var crypto=require('crypto');var jsforce=require(_0xd0f4('0xb'));var deskjs=require(_0xd0f4('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd0f4('0xd'));var Papa=require(_0xd0f4('0xe'));var Redis=require('ioredis');var authService=require(_0xd0f4('0xf'));var qs=require(_0xd0f4('0x10'));var as=require(_0xd0f4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd0f4('0x12'));var utils=require(_0xd0f4('0x13'));var config=require(_0xd0f4('0x14'));var licenseUtil=require(_0xd0f4('0x15'));var db=require(_0xd0f4('0x16'))['db'];function respondWithStatusCode(_0x64232c,_0x134492){_0x134492=_0x134492||0xcc;return function(_0x5679a7){if(_0x5679a7){return _0x64232c[_0xd0f4('0x17')](_0x134492);}return _0x64232c[_0xd0f4('0x18')](_0x134492)['end']();};}function respondWithResult(_0x104d48,_0x536d71){_0x536d71=_0x536d71||0xc8;return function(_0x828792){if(_0x828792){return _0x104d48['status'](_0x536d71)[_0xd0f4('0x19')](_0x828792);}};}function respondWithFilteredResult(_0x4d5aef,_0x4afe4d){return function(_0x54b806){if(_0x54b806){var _0x45b32e=typeof _0x4afe4d[_0xd0f4('0x1a')]===_0xd0f4('0x1b')&&typeof _0x4afe4d[_0xd0f4('0x1c')]===_0xd0f4('0x1b');var _0x10acbe=_0x54b806[_0xd0f4('0x1d')];var _0x35be48=_0x45b32e?0x0:_0x4afe4d[_0xd0f4('0x1a')];var _0x5de07b=_0x45b32e?_0x54b806[_0xd0f4('0x1d')]:_0x4afe4d[_0xd0f4('0x1a')]+_0x4afe4d[_0xd0f4('0x1c')];var _0xa0662;if(_0x5de07b>=_0x10acbe){_0x5de07b=_0x10acbe;_0xa0662=0xc8;}else{_0xa0662=0xce;}_0x4d5aef['status'](_0xa0662);return _0x4d5aef[_0xd0f4('0x1e')](_0xd0f4('0x1f'),_0x35be48+'-'+_0x5de07b+'/'+_0x10acbe)[_0xd0f4('0x19')](_0x54b806);}return null;};}function patchUpdates(_0x208a6f){return function(_0x4e1689){try{jsonpatch[_0xd0f4('0x20')](_0x4e1689,_0x208a6f,!![]);}catch(_0xda1d14){return BPromise[_0xd0f4('0x21')](_0xda1d14);}return _0x4e1689[_0xd0f4('0x22')]();};}function saveUpdates(_0x14ba70,_0x2a1df0){return function(_0x25ee43){if(_0x25ee43){return _0x25ee43['update'](_0x14ba70)[_0xd0f4('0x23')](function(_0x327696){return _0x327696;});}return null;};}function removeEntity(_0x20e0c8,_0x299904){return function(_0x4d49c0){if(_0x4d49c0){return _0x4d49c0[_0xd0f4('0x24')]()['then'](function(){_0x20e0c8[_0xd0f4('0x18')](0xcc)[_0xd0f4('0x25')]();});}};}function handleEntityNotFound(_0x1cf493,_0x567eb4){return function(_0x42d944){if(!_0x42d944){_0x1cf493[_0xd0f4('0x17')](0x194);}return _0x42d944;};}function handleError(_0x459931,_0x1ed6e2){_0x1ed6e2=_0x1ed6e2||0x1f4;return function(_0x366af6){logger['error'](_0x366af6[_0xd0f4('0x26')]);if(_0x366af6[_0xd0f4('0x27')]){delete _0x366af6[_0xd0f4('0x27')];}_0x459931[_0xd0f4('0x18')](_0x1ed6e2)[_0xd0f4('0x28')](_0x366af6);};}exports[_0xd0f4('0x29')]=function(_0x1d3246,_0x33eb58){var _0x3cb97c={},_0x4cff90={},_0x42a44f={'count':0x0,'rows':[]};var _0x2df1ed=_[_0xd0f4('0x2a')](db[_0xd0f4('0x2b')]['rawAttributes'],function(_0x4058d7){return{'name':_0x4058d7['fieldName'],'type':_0x4058d7['type']['key']};});_0x4cff90[_0xd0f4('0x2c')]=_[_0xd0f4('0x2a')](_0x2df1ed,_0xd0f4('0x27'));_0x4cff90[_0xd0f4('0x2d')]=_[_0xd0f4('0x2e')](_0x1d3246[_0xd0f4('0x2d')]);_0x4cff90[_0xd0f4('0x2f')]=_[_0xd0f4('0x30')](_0x4cff90['model'],_0x4cff90[_0xd0f4('0x2d')]);_0x3cb97c['attributes']=_[_0xd0f4('0x30')](_0x4cff90[_0xd0f4('0x2c')],qs['fields'](_0x1d3246['query'][_0xd0f4('0x31')]));_0x3cb97c['attributes']=_0x3cb97c[_0xd0f4('0x32')][_0xd0f4('0x33')]?_0x3cb97c['attributes']:_0x4cff90[_0xd0f4('0x2c')];if(!_0x1d3246[_0xd0f4('0x2d')]['hasOwnProperty']('nolimit')){_0x3cb97c[_0xd0f4('0x1c')]=qs[_0xd0f4('0x1c')](_0x1d3246['query'][_0xd0f4('0x1c')]);_0x3cb97c['offset']=qs[_0xd0f4('0x1a')](_0x1d3246[_0xd0f4('0x2d')]['offset']);}_0x3cb97c[_0xd0f4('0x34')]=qs[_0xd0f4('0x35')](_0x1d3246[_0xd0f4('0x2d')][_0xd0f4('0x35')]);_0x3cb97c[_0xd0f4('0x36')]=qs['filters'](_[_0xd0f4('0x37')](_0x1d3246[_0xd0f4('0x2d')],_0x4cff90[_0xd0f4('0x2f')]),_0x2df1ed);if(_0x1d3246[_0xd0f4('0x2d')]['filter']){_0x3cb97c[_0xd0f4('0x36')]=_[_0xd0f4('0x38')](_0x3cb97c[_0xd0f4('0x36')],{'$or':_[_0xd0f4('0x2a')](_0x2df1ed,function(_0xd109a4){if(_0xd109a4[_0xd0f4('0x39')]!=='VIRTUAL'){var _0x269629={};_0x269629[_0xd109a4[_0xd0f4('0x27')]]={'$like':'%'+_0x1d3246[_0xd0f4('0x2d')]['filter']+'%'};return _0x269629;}})});}_0x3cb97c=_[_0xd0f4('0x38')]({},_0x3cb97c,_0x1d3246[_0xd0f4('0x3a')]);var _0x4bebe8={'where':_0x3cb97c[_0xd0f4('0x36')]};return db[_0xd0f4('0x2b')]['count'](_0x4bebe8)['then'](function(_0x3bb4ab){_0x42a44f[_0xd0f4('0x1d')]=_0x3bb4ab;if(_0x1d3246[_0xd0f4('0x2d')]['includeAll']){_0x3cb97c[_0xd0f4('0x3b')]=[{'all':!![]}];}return db['Cdr'][_0xd0f4('0x3c')](_0x3cb97c);})['then'](function(_0x29439d){_0x42a44f[_0xd0f4('0x3d')]=_0x29439d;return _0x42a44f;})[_0xd0f4('0x23')](respondWithFilteredResult(_0x33eb58,_0x3cb97c))[_0xd0f4('0x3e')](handleError(_0x33eb58,null));};exports['show']=function(_0x10509e,_0x198e47){var _0xb02892={'raw':!![],'where':{'id':_0x10509e['params']['id']}},_0x4c8b9a={};_0x4c8b9a[_0xd0f4('0x2c')]=_[_0xd0f4('0x2e')](db[_0xd0f4('0x2b')][_0xd0f4('0x3f')]);_0x4c8b9a[_0xd0f4('0x2d')]=_[_0xd0f4('0x2e')](_0x10509e[_0xd0f4('0x2d')]);_0x4c8b9a[_0xd0f4('0x2f')]=_[_0xd0f4('0x30')](_0x4c8b9a[_0xd0f4('0x2c')],_0x4c8b9a[_0xd0f4('0x2d')]);_0xb02892[_0xd0f4('0x32')]=_['intersection'](_0x4c8b9a[_0xd0f4('0x2c')],qs[_0xd0f4('0x31')](_0x10509e['query'][_0xd0f4('0x31')]));_0xb02892[_0xd0f4('0x32')]=_0xb02892[_0xd0f4('0x32')][_0xd0f4('0x33')]?_0xb02892[_0xd0f4('0x32')]:_0x4c8b9a[_0xd0f4('0x2c')];if(_0x10509e[_0xd0f4('0x2d')]['includeAll']){_0xb02892[_0xd0f4('0x3b')]=[{'all':!![]}];}_0xb02892=_[_0xd0f4('0x38')]({},_0xb02892,_0x10509e[_0xd0f4('0x3a')]);return db['Cdr'][_0xd0f4('0x40')](_0xb02892)[_0xd0f4('0x23')](handleEntityNotFound(_0x198e47,null))[_0xd0f4('0x23')](respondWithResult(_0x198e47,null))[_0xd0f4('0x3e')](handleError(_0x198e47,null));};exports[_0xd0f4('0x41')]=function(_0x563759,_0x54bb8d){return db['Cdr'][_0xd0f4('0x41')](_0x563759[_0xd0f4('0x42')],{})[_0xd0f4('0x23')](respondWithResult(_0x54bb8d,0xc9))[_0xd0f4('0x3e')](handleError(_0x54bb8d,null));};exports['update']=function(_0x31db89,_0x1b1baa){if(_0x31db89['body']['id']){delete _0x31db89[_0xd0f4('0x42')]['id'];}return db[_0xd0f4('0x2b')][_0xd0f4('0x40')]({'where':{'id':_0x31db89[_0xd0f4('0x43')]['id']}})[_0xd0f4('0x23')](handleEntityNotFound(_0x1b1baa,null))[_0xd0f4('0x23')](saveUpdates(_0x31db89[_0xd0f4('0x42')],null))[_0xd0f4('0x23')](respondWithResult(_0x1b1baa,null))[_0xd0f4('0x3e')](handleError(_0x1b1baa,null));};exports[_0xd0f4('0x24')]=function(_0x431df3,_0x120c17){return db[_0xd0f4('0x2b')]['find']({'where':{'id':_0x431df3[_0xd0f4('0x43')]['id']}})[_0xd0f4('0x23')](handleEntityNotFound(_0x120c17,null))[_0xd0f4('0x23')](removeEntity(_0x120c17,null))['catch'](handleError(_0x120c17,null));};exports[_0xd0f4('0x44')]=function(_0x3f8bcc,_0x1d8543){return db['Cdr'][_0xd0f4('0x44')]()['then'](respondWithResult(_0x1d8543,null))[_0xd0f4('0x3e')](handleError(_0x1d8543,null));}; \ No newline at end of file +var _0xf9d5=['lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','then','sendStatus','error','stack','name','index','map','Cdr','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','destroy','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x51042f,_0x2377bb){var _0x39308a=function(_0x2761cc){while(--_0x2761cc){_0x51042f['push'](_0x51042f['shift']());}};_0x39308a(++_0x2377bb);}(_0xf9d5,0x122));var _0x5f9d=function(_0x55e492,_0x398035){_0x55e492=_0x55e492-0x0;var _0x27b6a7=_0xf9d5[_0x55e492];return _0x27b6a7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5f9d('0x0'));var zipdir=require(_0x5f9d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f9d('0x2'));var moment=require(_0x5f9d('0x3'));var BPromise=require(_0x5f9d('0x4'));var Mustache=require(_0x5f9d('0x5'));var util=require(_0x5f9d('0x6'));var path=require(_0x5f9d('0x7'));var sox=require(_0x5f9d('0x8'));var csv=require('to-csv');var ejs=require(_0x5f9d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5f9d('0xa'));var squel=require(_0x5f9d('0xb'));var crypto=require('crypto');var jsforce=require(_0x5f9d('0xc'));var deskjs=require(_0x5f9d('0xd'));var toCsv=require(_0x5f9d('0xe'));var querystring=require(_0x5f9d('0xf'));var Papa=require(_0x5f9d('0x10'));var Redis=require(_0x5f9d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5f9d('0x12'));var as=require(_0x5f9d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5f9d('0x14'));var utils=require(_0x5f9d('0x15'));var config=require(_0x5f9d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5f9d('0x17'))['db'];function respondWithStatusCode(_0x10f5b1,_0x257910){_0x257910=_0x257910||0xcc;return function(_0x23a39f){if(_0x23a39f){return _0x10f5b1['sendStatus'](_0x257910);}return _0x10f5b1[_0x5f9d('0x18')](_0x257910)[_0x5f9d('0x19')]();};}function respondWithResult(_0x234902,_0x5aacdc){_0x5aacdc=_0x5aacdc||0xc8;return function(_0x8e2381){if(_0x8e2381){return _0x234902[_0x5f9d('0x18')](_0x5aacdc)['json'](_0x8e2381);}};}function respondWithFilteredResult(_0x4fd1cb,_0x2f0154){return function(_0x334cea){if(_0x334cea){var _0x3d4a1c=typeof _0x2f0154[_0x5f9d('0x1a')]===_0x5f9d('0x1b')&&typeof _0x2f0154['limit']==='undefined';var _0x54bd00=_0x334cea[_0x5f9d('0x1c')];var _0x4fb9a5=_0x3d4a1c?0x0:_0x2f0154[_0x5f9d('0x1a')];var _0x48448e=_0x3d4a1c?_0x334cea[_0x5f9d('0x1c')]:_0x2f0154[_0x5f9d('0x1a')]+_0x2f0154[_0x5f9d('0x1d')];var _0x55a31c;if(_0x48448e>=_0x54bd00){_0x48448e=_0x54bd00;_0x55a31c=0xc8;}else{_0x55a31c=0xce;}_0x4fd1cb[_0x5f9d('0x18')](_0x55a31c);return _0x4fd1cb[_0x5f9d('0x1e')](_0x5f9d('0x1f'),_0x4fb9a5+'-'+_0x48448e+'/'+_0x54bd00)[_0x5f9d('0x20')](_0x334cea);}return null;};}function patchUpdates(_0x320182){return function(_0xa62826){try{jsonpatch[_0x5f9d('0x21')](_0xa62826,_0x320182,!![]);}catch(_0x2563d5){return BPromise[_0x5f9d('0x22')](_0x2563d5);}return _0xa62826['save']();};}function saveUpdates(_0x4a2eeb,_0x5465b1){return function(_0x1bc76b){if(_0x1bc76b){return _0x1bc76b['update'](_0x4a2eeb)[_0x5f9d('0x23')](function(_0x5a3472){return _0x5a3472;});}return null;};}function removeEntity(_0x9d86ce,_0x564886){return function(_0x4875c5){if(_0x4875c5){return _0x4875c5['destroy']()[_0x5f9d('0x23')](function(){_0x9d86ce[_0x5f9d('0x18')](0xcc)[_0x5f9d('0x19')]();});}};}function handleEntityNotFound(_0x234511,_0x542bbc){return function(_0x379d2d){if(!_0x379d2d){_0x234511[_0x5f9d('0x24')](0x194);}return _0x379d2d;};}function handleError(_0x190402,_0x74f212){_0x74f212=_0x74f212||0x1f4;return function(_0x2d097f){logger[_0x5f9d('0x25')](_0x2d097f[_0x5f9d('0x26')]);if(_0x2d097f[_0x5f9d('0x27')]){delete _0x2d097f[_0x5f9d('0x27')];}_0x190402[_0x5f9d('0x18')](_0x74f212)['send'](_0x2d097f);};}exports[_0x5f9d('0x28')]=function(_0x1b9054,_0x1496c0){var _0x13cc7c={},_0x10e542={},_0x24233e={'count':0x0,'rows':[]};var _0x38b10d=_[_0x5f9d('0x29')](db[_0x5f9d('0x2a')]['rawAttributes'],function(_0x4ed27d){return{'name':_0x4ed27d['fieldName'],'type':_0x4ed27d[_0x5f9d('0x2b')]['key']};});_0x10e542[_0x5f9d('0x2c')]=_['map'](_0x38b10d,_0x5f9d('0x27'));_0x10e542['query']=_[_0x5f9d('0x2d')](_0x1b9054[_0x5f9d('0x2e')]);_0x10e542[_0x5f9d('0x2f')]=_[_0x5f9d('0x30')](_0x10e542[_0x5f9d('0x2c')],_0x10e542['query']);_0x13cc7c[_0x5f9d('0x31')]=_['intersection'](_0x10e542[_0x5f9d('0x2c')],qs['fields'](_0x1b9054[_0x5f9d('0x2e')][_0x5f9d('0x32')]));_0x13cc7c['attributes']=_0x13cc7c[_0x5f9d('0x31')][_0x5f9d('0x33')]?_0x13cc7c[_0x5f9d('0x31')]:_0x10e542['model'];if(!_0x1b9054[_0x5f9d('0x2e')][_0x5f9d('0x34')](_0x5f9d('0x35'))){_0x13cc7c[_0x5f9d('0x1d')]=qs[_0x5f9d('0x1d')](_0x1b9054['query'][_0x5f9d('0x1d')]);_0x13cc7c[_0x5f9d('0x1a')]=qs[_0x5f9d('0x1a')](_0x1b9054[_0x5f9d('0x2e')][_0x5f9d('0x1a')]);}_0x13cc7c[_0x5f9d('0x36')]=qs['sort'](_0x1b9054[_0x5f9d('0x2e')][_0x5f9d('0x37')]);_0x13cc7c[_0x5f9d('0x38')]=qs['filters'](_['pick'](_0x1b9054[_0x5f9d('0x2e')],_0x10e542[_0x5f9d('0x2f')]),_0x38b10d);if(_0x1b9054[_0x5f9d('0x2e')][_0x5f9d('0x39')]){_0x13cc7c[_0x5f9d('0x38')]=_['merge'](_0x13cc7c['where'],{'$or':_[_0x5f9d('0x29')](_0x38b10d,function(_0x3c5737){if(_0x3c5737['type']!==_0x5f9d('0x3a')){var _0x4e15be={};_0x4e15be[_0x3c5737[_0x5f9d('0x27')]]={'$like':'%'+_0x1b9054[_0x5f9d('0x2e')]['filter']+'%'};return _0x4e15be;}})});}_0x13cc7c=_[_0x5f9d('0x3b')]({},_0x13cc7c,_0x1b9054[_0x5f9d('0x3c')]);var _0x4d3288={'where':_0x13cc7c['where']};return db[_0x5f9d('0x2a')][_0x5f9d('0x1c')](_0x4d3288)[_0x5f9d('0x23')](function(_0x3c43f6){_0x24233e[_0x5f9d('0x1c')]=_0x3c43f6;if(_0x1b9054[_0x5f9d('0x2e')][_0x5f9d('0x3d')]){_0x13cc7c[_0x5f9d('0x3e')]=[{'all':!![]}];}return db[_0x5f9d('0x2a')][_0x5f9d('0x3f')](_0x13cc7c);})[_0x5f9d('0x23')](function(_0x227ef6){_0x24233e[_0x5f9d('0x40')]=_0x227ef6;return _0x24233e;})[_0x5f9d('0x23')](respondWithFilteredResult(_0x1496c0,_0x13cc7c))[_0x5f9d('0x41')](handleError(_0x1496c0,null));};exports[_0x5f9d('0x42')]=function(_0x45ba15,_0x1590b5){var _0xf02211={'raw':!![],'where':{'id':_0x45ba15[_0x5f9d('0x43')]['id']}},_0x21b5d1={};_0x21b5d1[_0x5f9d('0x2c')]=_[_0x5f9d('0x2d')](db[_0x5f9d('0x2a')][_0x5f9d('0x44')]);_0x21b5d1[_0x5f9d('0x2e')]=_[_0x5f9d('0x2d')](_0x45ba15[_0x5f9d('0x2e')]);_0x21b5d1[_0x5f9d('0x2f')]=_[_0x5f9d('0x30')](_0x21b5d1['model'],_0x21b5d1[_0x5f9d('0x2e')]);_0xf02211['attributes']=_[_0x5f9d('0x30')](_0x21b5d1[_0x5f9d('0x2c')],qs[_0x5f9d('0x32')](_0x45ba15[_0x5f9d('0x2e')][_0x5f9d('0x32')]));_0xf02211[_0x5f9d('0x31')]=_0xf02211[_0x5f9d('0x31')]['length']?_0xf02211[_0x5f9d('0x31')]:_0x21b5d1[_0x5f9d('0x2c')];if(_0x45ba15[_0x5f9d('0x2e')]['includeAll']){_0xf02211[_0x5f9d('0x3e')]=[{'all':!![]}];}_0xf02211=_['merge']({},_0xf02211,_0x45ba15[_0x5f9d('0x3c')]);return db[_0x5f9d('0x2a')][_0x5f9d('0x45')](_0xf02211)['then'](handleEntityNotFound(_0x1590b5,null))['then'](respondWithResult(_0x1590b5,null))[_0x5f9d('0x41')](handleError(_0x1590b5,null));};exports[_0x5f9d('0x46')]=function(_0x4c9645,_0x2a43a3){return db['Cdr'][_0x5f9d('0x46')](_0x4c9645[_0x5f9d('0x47')],{})[_0x5f9d('0x23')](respondWithResult(_0x2a43a3,0xc9))[_0x5f9d('0x41')](handleError(_0x2a43a3,null));};exports[_0x5f9d('0x48')]=function(_0x16a9fa,_0x3aa63c){if(_0x16a9fa[_0x5f9d('0x47')]['id']){delete _0x16a9fa[_0x5f9d('0x47')]['id'];}return db[_0x5f9d('0x2a')]['find']({'where':{'id':_0x16a9fa[_0x5f9d('0x43')]['id']}})[_0x5f9d('0x23')](handleEntityNotFound(_0x3aa63c,null))['then'](saveUpdates(_0x16a9fa[_0x5f9d('0x47')],null))[_0x5f9d('0x23')](respondWithResult(_0x3aa63c,null))[_0x5f9d('0x41')](handleError(_0x3aa63c,null));};exports[_0x5f9d('0x49')]=function(_0xc9a152,_0x414868){return db[_0x5f9d('0x2a')][_0x5f9d('0x45')]({'where':{'id':_0xc9a152['params']['id']}})['then'](handleEntityNotFound(_0x414868,null))[_0x5f9d('0x23')](removeEntity(_0x414868,null))[_0x5f9d('0x41')](handleError(_0x414868,null));};exports[_0x5f9d('0x4a')]=function(_0x101616,_0x97aac2){return db[_0x5f9d('0x2a')][_0x5f9d('0x4a')]()[_0x5f9d('0x23')](respondWithResult(_0x97aac2,null))[_0x5f9d('0x41')](handleError(_0x97aac2,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index a6c8763..58ece08 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x56ef7d,_0x4ccd7d){var _0x1c0414=function(_0x31f054){while(--_0x31f054){_0x56ef7d['push'](_0x56ef7d['shift']());}};_0x1c0414(++_0x4ccd7d);}(_0x7a54,0x106));var _0x47a5=function(_0x1a093b,_0x19cd62){_0x1a093b=_0x1a093b-0x0;var _0x14fb88=_0x7a54[_0x1a093b];return _0x14fb88;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0xd16e6c,_0x184a52){var _0x26b7fe=function(_0x1491a4){while(--_0x1491a4){_0xd16e6c['push'](_0xd16e6c['shift']());}};_0x26b7fe(++_0x184a52);}(_0x7a54,0x106));var _0x47a5=function(_0x51f50d,_0x45a9fd){_0x51f50d=_0x51f50d-0x0;var _0x45fe52=_0x7a54[_0x51f50d];return _0x45fe52;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 589cffe..5309481 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 _0x0b72=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0b72,0xdc));var _0x20b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b72[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x20b7('0x0'));var util=require('util');var moment=require(_0x20b7('0x1'));var BPromise=require(_0x20b7('0x2'));var rs=require(_0x20b7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x20b7('0x4'))['db'];var utils=require(_0x20b7('0x5'));var logger=require(_0x20b7('0x6'))(_0x20b7('0x7'));var config=require(_0x20b7('0x8'));var jayson=require(_0x20b7('0x9'));var client=jayson[_0x20b7('0xa')][_0x20b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d5759,_0x487843,_0x36c4b4){return new BPromise(function(_0x2279e4,_0x31ba17){return client[_0x20b7('0xc')](_0x5d5759,_0x36c4b4)['then'](function(_0x3bf07f){logger[_0x20b7('0xd')](_0x20b7('0xe'),_0x487843,_0x20b7('0xf'));logger[_0x20b7('0x10')](_0x20b7('0x11'),_0x487843,_0x20b7('0xf'),JSON[_0x20b7('0x12')](_0x3bf07f));if(_0x3bf07f[_0x20b7('0x13')]){if(_0x3bf07f[_0x20b7('0x13')]['code']===0x1f4){logger['error'](_0x20b7('0xe'),_0x487843,_0x3bf07f[_0x20b7('0x13')][_0x20b7('0x14')]);return _0x31ba17(_0x3bf07f['error']['message']);}logger[_0x20b7('0x13')]('Cdr,\x20%s,\x20%s',_0x487843,_0x3bf07f[_0x20b7('0x13')]['message']);return _0x2279e4(_0x3bf07f[_0x20b7('0x13')][_0x20b7('0x14')]);}else{logger[_0x20b7('0xd')](_0x20b7('0xe'),_0x487843,_0x20b7('0xf'));_0x2279e4(_0x3bf07f['result'][_0x20b7('0x14')]);}})[_0x20b7('0x15')](function(_0x25f9eb){logger[_0x20b7('0x13')](_0x20b7('0xe'),_0x487843,_0x25f9eb);_0x31ba17(_0x25f9eb);});});} \ No newline at end of file +var _0xd665=['message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','Cdr,\x20%s,\x20%s','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2d7f4b,_0x47b512){var _0x462d8f=function(_0x54ea56){while(--_0x54ea56){_0x2d7f4b['push'](_0x2d7f4b['shift']());}};_0x462d8f(++_0x47b512);}(_0xd665,0xd5));var _0x5d66=function(_0xbed490,_0x2789a8){_0xbed490=_0xbed490-0x0;var _0x7a565f=_0xd665[_0xbed490];return _0x7a565f;};'use strict';var _=require(_0x5d66('0x0'));var util=require(_0x5d66('0x1'));var moment=require(_0x5d66('0x2'));var BPromise=require(_0x5d66('0x3'));var rs=require(_0x5d66('0x4'));var fs=require('fs');var Redis=require(_0x5d66('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5d66('0x6'));var logger=require(_0x5d66('0x7'))(_0x5d66('0x8'));var config=require(_0x5d66('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5d66('0xa')][_0x5d66('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35b59f,_0x205113,_0x39f465){return new BPromise(function(_0x3e5125,_0x164b40){return client[_0x5d66('0xc')](_0x35b59f,_0x39f465)['then'](function(_0x34cc4d){logger['info'](_0x5d66('0xd'),_0x205113,'request\x20sent');logger['debug'](_0x5d66('0xe'),_0x205113,_0x5d66('0xf'),JSON[_0x5d66('0x10')](_0x34cc4d));if(_0x34cc4d[_0x5d66('0x11')]){if(_0x34cc4d[_0x5d66('0x11')]['code']===0x1f4){logger[_0x5d66('0x11')]('Cdr,\x20%s,\x20%s',_0x205113,_0x34cc4d[_0x5d66('0x11')][_0x5d66('0x12')]);return _0x164b40(_0x34cc4d[_0x5d66('0x11')]['message']);}logger['error'](_0x5d66('0xd'),_0x205113,_0x34cc4d['error'][_0x5d66('0x12')]);return _0x3e5125(_0x34cc4d[_0x5d66('0x11')][_0x5d66('0x12')]);}else{logger[_0x5d66('0x13')](_0x5d66('0xd'),_0x205113,_0x5d66('0xf'));_0x3e5125(_0x34cc4d['result'][_0x5d66('0x12')]);}})[_0x5d66('0x14')](function(_0xc732a7){logger[_0x5d66('0x11')](_0x5d66('0xd'),_0x205113,_0xc732a7);_0x164b40(_0xc732a7);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index e05b7c5..22c6084 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x60286b,_0x3247c1){var _0x5dff69=function(_0x4ecfcf){while(--_0x4ecfcf){_0x60286b['push'](_0x60286b['shift']());}};_0x5dff69(++_0x3247c1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +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(_0xadde88,_0x58ad47){var _0x3b8eb6=function(_0x15535a){while(--_0x15535a){_0xadde88['push'](_0xadde88['shift']());}};_0x3b8eb6(++_0x58ad47);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index d70b916..970ada4 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 _0x4969=['INTEGER','STRING','noop','*,*,*,*','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4969,0xfe));var _0x9496=function(_0xf9e76,_0x2e6b9a){_0xf9e76=_0xf9e76-0x0;var _0x119a9b=_0x4969[_0xf9e76];return _0x119a9b;};'use strict';var Sequelize=require('sequelize');module[_0x9496('0x0')]={'priority':{'type':Sequelize[_0x9496('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9496('0x2')],'allowNull':![],'defaultValue':_0x9496('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9496('0x2')]},'interval':{'type':Sequelize[_0x9496('0x2')],'defaultValue':_0x9496('0x4')}}; \ No newline at end of file +var _0xf01a=['noop','TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xf01a,0x17e));var _0xaf01=function(_0x2cc7f0,_0x1e5523){_0x2cc7f0=_0x2cc7f0-0x0;var _0x43d885=_0xf01a[_0x2cc7f0];return _0x43d885;};'use strict';var Sequelize=require(_0xaf01('0x0'));module[_0xaf01('0x1')]={'priority':{'type':Sequelize[_0xaf01('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xaf01('0x3')},'appdata':{'type':Sequelize[_0xaf01('0x4')]()},'description':{'type':Sequelize[_0xaf01('0x5')]},'interval':{'type':Sequelize[_0xaf01('0x5')],'defaultValue':_0xaf01('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 7ac1a83..1cad100 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 _0x5712=['end','json','undefined','count','limit','set','Content-Range','apply','save','then','destroy','name','send','show','params','keys','ChatApplication','rawAttributes','query','model','attributes','intersection','fields','length','includeAll','merge','find','update','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status'];(function(_0x57f0c4,_0x1532d4){var _0x3601e9=function(_0xd1cc1a){while(--_0xd1cc1a){_0x57f0c4['push'](_0x57f0c4['shift']());}};_0x3601e9(++_0x1532d4);}(_0x5712,0x140));var _0x2571=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5712[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x2571('0x0'));var rimraf=require(_0x2571('0x1'));var zipdir=require(_0x2571('0x2'));var jsonpatch=require(_0x2571('0x3'));var rp=require(_0x2571('0x4'));var moment=require(_0x2571('0x5'));var BPromise=require(_0x2571('0x6'));var Mustache=require(_0x2571('0x7'));var util=require(_0x2571('0x8'));var path=require(_0x2571('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2571('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2571('0xb'));var squel=require(_0x2571('0xc'));var crypto=require(_0x2571('0xd'));var jsforce=require(_0x2571('0xe'));var deskjs=require(_0x2571('0xf'));var toCsv=require(_0x2571('0x10'));var querystring=require('querystring');var Papa=require(_0x2571('0x11'));var Redis=require('ioredis');var authService=require(_0x2571('0x12'));var qs=require(_0x2571('0x13'));var as=require(_0x2571('0x14'));var hardwareService=require(_0x2571('0x15'));var logger=require(_0x2571('0x16'))(_0x2571('0x17'));var utils=require(_0x2571('0x18'));var config=require(_0x2571('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33d3ed,_0x1ab846){_0x1ab846=_0x1ab846||0xcc;return function(_0x10823d){if(_0x10823d){return _0x33d3ed[_0x2571('0x1a')](_0x1ab846);}return _0x33d3ed[_0x2571('0x1b')](_0x1ab846)[_0x2571('0x1c')]();};}function respondWithResult(_0x241129,_0x130ab1){_0x130ab1=_0x130ab1||0xc8;return function(_0xdf8c3a){if(_0xdf8c3a){return _0x241129[_0x2571('0x1b')](_0x130ab1)[_0x2571('0x1d')](_0xdf8c3a);}};}function respondWithFilteredResult(_0x3c1a08,_0x5b0392){return function(_0x30b0f2){if(_0x30b0f2){var _0x47b5e9=typeof _0x5b0392['offset']==='undefined'&&typeof _0x5b0392['limit']===_0x2571('0x1e');var _0x371ae2=_0x30b0f2[_0x2571('0x1f')];var _0x75af2a=_0x47b5e9?0x0:_0x5b0392['offset'];var _0x7707=_0x47b5e9?_0x30b0f2[_0x2571('0x1f')]:_0x5b0392['offset']+_0x5b0392[_0x2571('0x20')];var _0x7303ad;if(_0x7707>=_0x371ae2){_0x7707=_0x371ae2;_0x7303ad=0xc8;}else{_0x7303ad=0xce;}_0x3c1a08[_0x2571('0x1b')](_0x7303ad);return _0x3c1a08[_0x2571('0x21')](_0x2571('0x22'),_0x75af2a+'-'+_0x7707+'/'+_0x371ae2)['json'](_0x30b0f2);}return null;};}function patchUpdates(_0x52da27){return function(_0x5fe030){try{jsonpatch[_0x2571('0x23')](_0x5fe030,_0x52da27,!![]);}catch(_0x58f6aa){return BPromise['reject'](_0x58f6aa);}return _0x5fe030[_0x2571('0x24')]();};}function saveUpdates(_0x2e7d89,_0x2218fb){return function(_0xb6dfa6){if(_0xb6dfa6){return _0xb6dfa6['update'](_0x2e7d89)[_0x2571('0x25')](function(_0x55ec06){return _0x55ec06;});}return null;};}function removeEntity(_0x1ec23c,_0x4316b1){return function(_0x5d6778){if(_0x5d6778){return _0x5d6778[_0x2571('0x26')]()[_0x2571('0x25')](function(){_0x1ec23c[_0x2571('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d455d,_0x77e02){return function(_0x1cbbdc){if(!_0x1cbbdc){_0x5d455d[_0x2571('0x1a')](0x194);}return _0x1cbbdc;};}function handleError(_0x1547d2,_0x2f5cae){_0x2f5cae=_0x2f5cae||0x1f4;return function(_0x246bbd){logger['error'](_0x246bbd['stack']);if(_0x246bbd[_0x2571('0x27')]){delete _0x246bbd[_0x2571('0x27')];}_0x1547d2[_0x2571('0x1b')](_0x2f5cae)[_0x2571('0x28')](_0x246bbd);};}exports[_0x2571('0x29')]=function(_0x165aa8,_0x3d5660){var _0x315dc1={'raw':!![],'where':{'id':_0x165aa8[_0x2571('0x2a')]['id']}},_0x1f7562={};_0x1f7562['model']=_[_0x2571('0x2b')](db[_0x2571('0x2c')][_0x2571('0x2d')]);_0x1f7562[_0x2571('0x2e')]=_[_0x2571('0x2b')](_0x165aa8[_0x2571('0x2e')]);_0x1f7562['filters']=_['intersection'](_0x1f7562[_0x2571('0x2f')],_0x1f7562[_0x2571('0x2e')]);_0x315dc1[_0x2571('0x30')]=_[_0x2571('0x31')](_0x1f7562['model'],qs[_0x2571('0x32')](_0x165aa8[_0x2571('0x2e')]['fields']));_0x315dc1['attributes']=_0x315dc1[_0x2571('0x30')][_0x2571('0x33')]?_0x315dc1[_0x2571('0x30')]:_0x1f7562['model'];if(_0x165aa8[_0x2571('0x2e')][_0x2571('0x34')]){_0x315dc1['include']=[{'all':!![]}];}_0x315dc1=_[_0x2571('0x35')]({},_0x315dc1,_0x165aa8['options']);return db[_0x2571('0x2c')][_0x2571('0x36')](_0x315dc1)[_0x2571('0x25')](handleEntityNotFound(_0x3d5660,null))['then'](respondWithResult(_0x3d5660,null))['catch'](handleError(_0x3d5660,null));};exports[_0x2571('0x37')]=function(_0x55d7cc,_0x37ca7c){if(_0x55d7cc[_0x2571('0x38')]['id']){delete _0x55d7cc[_0x2571('0x38')]['id'];}return db[_0x2571('0x2c')]['find']({'where':{'id':_0x55d7cc[_0x2571('0x2a')]['id']}})[_0x2571('0x25')](handleEntityNotFound(_0x37ca7c,null))['then'](saveUpdates(_0x55d7cc[_0x2571('0x38')],null))[_0x2571('0x25')](respondWithResult(_0x37ca7c,null))['catch'](handleError(_0x37ca7c,null));};exports[_0x2571('0x26')]=function(_0x202c96,_0xe220ba){return db[_0x2571('0x2c')][_0x2571('0x36')]({'where':{'id':_0x202c96[_0x2571('0x2a')]['id']}})[_0x2571('0x25')](handleEntityNotFound(_0xe220ba,null))[_0x2571('0x25')](removeEntity(_0xe220ba,null))[_0x2571('0x39')](handleError(_0xe220ba,null));}; \ No newline at end of file +var _0xe9ad=['fields','length','merge','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','show','params','keys','ChatApplication','rawAttributes','query','filters','model','attributes','intersection'];(function(_0x36845e,_0x51a165){var _0x45a9f4=function(_0x133f9e){while(--_0x133f9e){_0x36845e['push'](_0x36845e['shift']());}};_0x45a9f4(++_0x51a165);}(_0xe9ad,0x82));var _0xde9a=function(_0x97eb75,_0x17c7c5){_0x97eb75=_0x97eb75-0x0;var _0x5bb240=_0xe9ad[_0x97eb75];return _0x5bb240;};'use strict';var emlformat=require(_0xde9a('0x0'));var rimraf=require(_0xde9a('0x1'));var zipdir=require(_0xde9a('0x2'));var jsonpatch=require(_0xde9a('0x3'));var rp=require(_0xde9a('0x4'));var moment=require(_0xde9a('0x5'));var BPromise=require(_0xde9a('0x6'));var Mustache=require('mustache');var util=require(_0xde9a('0x7'));var path=require(_0xde9a('0x8'));var sox=require(_0xde9a('0x9'));var csv=require(_0xde9a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xde9a('0xb'));var _=require(_0xde9a('0xc'));var squel=require(_0xde9a('0xd'));var crypto=require('crypto');var jsforce=require(_0xde9a('0xe'));var deskjs=require(_0xde9a('0xf'));var toCsv=require(_0xde9a('0xa'));var querystring=require(_0xde9a('0x10'));var Papa=require(_0xde9a('0x11'));var Redis=require(_0xde9a('0x12'));var authService=require(_0xde9a('0x13'));var qs=require(_0xde9a('0x14'));var as=require(_0xde9a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xde9a('0x16'))(_0xde9a('0x17'));var utils=require(_0xde9a('0x18'));var config=require(_0xde9a('0x19'));var licenseUtil=require(_0xde9a('0x1a'));var db=require(_0xde9a('0x1b'))['db'];function respondWithStatusCode(_0x1cb3bd,_0x3a9b1a){_0x3a9b1a=_0x3a9b1a||0xcc;return function(_0xd81956){if(_0xd81956){return _0x1cb3bd['sendStatus'](_0x3a9b1a);}return _0x1cb3bd[_0xde9a('0x1c')](_0x3a9b1a)[_0xde9a('0x1d')]();};}function respondWithResult(_0x2f2e11,_0x267d5b){_0x267d5b=_0x267d5b||0xc8;return function(_0x1c1873){if(_0x1c1873){return _0x2f2e11[_0xde9a('0x1c')](_0x267d5b)[_0xde9a('0x1e')](_0x1c1873);}};}function respondWithFilteredResult(_0x432d3c,_0x3f0e39){return function(_0x474713){if(_0x474713){var _0x50ffb8=typeof _0x3f0e39[_0xde9a('0x1f')]===_0xde9a('0x20')&&typeof _0x3f0e39[_0xde9a('0x21')]===_0xde9a('0x20');var _0x454156=_0x474713['count'];var _0x12ba7f=_0x50ffb8?0x0:_0x3f0e39[_0xde9a('0x1f')];var _0x3b89ef=_0x50ffb8?_0x474713['count']:_0x3f0e39[_0xde9a('0x1f')]+_0x3f0e39['limit'];var _0x8f481a;if(_0x3b89ef>=_0x454156){_0x3b89ef=_0x454156;_0x8f481a=0xc8;}else{_0x8f481a=0xce;}_0x432d3c['status'](_0x8f481a);return _0x432d3c[_0xde9a('0x22')](_0xde9a('0x23'),_0x12ba7f+'-'+_0x3b89ef+'/'+_0x454156)[_0xde9a('0x1e')](_0x474713);}return null;};}function patchUpdates(_0x4add81){return function(_0x43b1bb){try{jsonpatch[_0xde9a('0x24')](_0x43b1bb,_0x4add81,!![]);}catch(_0x4e4e02){return BPromise['reject'](_0x4e4e02);}return _0x43b1bb[_0xde9a('0x25')]();};}function saveUpdates(_0x416b36,_0x56550b){return function(_0x290d8d){if(_0x290d8d){return _0x290d8d[_0xde9a('0x26')](_0x416b36)[_0xde9a('0x27')](function(_0x402b06){return _0x402b06;});}return null;};}function removeEntity(_0xa48b6b,_0x284c96){return function(_0x544f9d){if(_0x544f9d){return _0x544f9d[_0xde9a('0x28')]()[_0xde9a('0x27')](function(){_0xa48b6b[_0xde9a('0x1c')](0xcc)[_0xde9a('0x1d')]();});}};}function handleEntityNotFound(_0xfd4b9d,_0xdcc5d2){return function(_0xbc8e99){if(!_0xbc8e99){_0xfd4b9d[_0xde9a('0x29')](0x194);}return _0xbc8e99;};}function handleError(_0x125720,_0x490b11){_0x490b11=_0x490b11||0x1f4;return function(_0x5ab5e5){logger[_0xde9a('0x2a')](_0x5ab5e5[_0xde9a('0x2b')]);if(_0x5ab5e5[_0xde9a('0x2c')]){delete _0x5ab5e5[_0xde9a('0x2c')];}_0x125720['status'](_0x490b11)[_0xde9a('0x2d')](_0x5ab5e5);};}exports[_0xde9a('0x2e')]=function(_0x467ce2,_0x51806d){var _0x3bd254={'raw':!![],'where':{'id':_0x467ce2[_0xde9a('0x2f')]['id']}},_0x5890c5={};_0x5890c5['model']=_[_0xde9a('0x30')](db[_0xde9a('0x31')][_0xde9a('0x32')]);_0x5890c5[_0xde9a('0x33')]=_[_0xde9a('0x30')](_0x467ce2[_0xde9a('0x33')]);_0x5890c5[_0xde9a('0x34')]=_['intersection'](_0x5890c5[_0xde9a('0x35')],_0x5890c5[_0xde9a('0x33')]);_0x3bd254[_0xde9a('0x36')]=_[_0xde9a('0x37')](_0x5890c5[_0xde9a('0x35')],qs[_0xde9a('0x38')](_0x467ce2[_0xde9a('0x33')][_0xde9a('0x38')]));_0x3bd254[_0xde9a('0x36')]=_0x3bd254[_0xde9a('0x36')][_0xde9a('0x39')]?_0x3bd254[_0xde9a('0x36')]:_0x5890c5[_0xde9a('0x35')];if(_0x467ce2[_0xde9a('0x33')]['includeAll']){_0x3bd254['include']=[{'all':!![]}];}_0x3bd254=_[_0xde9a('0x3a')]({},_0x3bd254,_0x467ce2['options']);return db[_0xde9a('0x31')][_0xde9a('0x3b')](_0x3bd254)['then'](handleEntityNotFound(_0x51806d,null))[_0xde9a('0x27')](respondWithResult(_0x51806d,null))[_0xde9a('0x3c')](handleError(_0x51806d,null));};exports[_0xde9a('0x26')]=function(_0x4d45a2,_0x4f93d2){if(_0x4d45a2[_0xde9a('0x3d')]['id']){delete _0x4d45a2[_0xde9a('0x3d')]['id'];}return db['ChatApplication'][_0xde9a('0x3b')]({'where':{'id':_0x4d45a2[_0xde9a('0x2f')]['id']}})[_0xde9a('0x27')](handleEntityNotFound(_0x4f93d2,null))[_0xde9a('0x27')](saveUpdates(_0x4d45a2[_0xde9a('0x3d')],null))[_0xde9a('0x27')](respondWithResult(_0x4f93d2,null))[_0xde9a('0x3c')](handleError(_0x4f93d2,null));};exports[_0xde9a('0x28')]=function(_0x32c6f0,_0x463dc5){return db['ChatApplication'][_0xde9a('0x3b')]({'where':{'id':_0x32c6f0[_0xde9a('0x2f')]['id']}})[_0xde9a('0x27')](handleEntityNotFound(_0x463dc5,null))[_0xde9a('0x27')](removeEntity(_0x463dc5,null))['catch'](handleError(_0x463dc5,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 3ebf693..95fa4bd 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 _0x46b9=['chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./chatApplication.attributes','exports','define','ChatApplication'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x46b9,0x13e));var _0x946b=function(_0x157738,_0x226ff3){_0x157738=_0x157738-0x0;var _0x3e48f4=_0x46b9[_0x157738];return _0x3e48f4;};'use strict';var _=require(_0x946b('0x0'));var util=require(_0x946b('0x1'));var logger=require('../../config/logger')(_0x946b('0x2'));var moment=require(_0x946b('0x3'));var BPromise=require(_0x946b('0x4'));var rp=require(_0x946b('0x5'));var fs=require('fs');var path=require(_0x946b('0x6'));var rimraf=require(_0x946b('0x7'));var config=require('../../config/environment');var attributes=require(_0x946b('0x8'));module[_0x946b('0x9')]=function(_0x3aa36e,_0x52417a){return _0x3aa36e[_0x946b('0xa')](_0x946b('0xb'),attributes,{'tableName':_0x946b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x946b('0xd'),'collate':_0x946b('0xe')});}; \ No newline at end of file +var _0xcee0=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatApplication.attributes','exports','define','chat_applications','utf8mb4'];(function(_0x49aca1,_0x31d9b2){var _0x4512c9=function(_0x11cfaa){while(--_0x11cfaa){_0x49aca1['push'](_0x49aca1['shift']());}};_0x4512c9(++_0x31d9b2);}(_0xcee0,0x1e1));var _0x0cee=function(_0x4843f9,_0x4af459){_0x4843f9=_0x4843f9-0x0;var _0x193c6a=_0xcee0[_0x4843f9];return _0x193c6a;};'use strict';var _=require(_0x0cee('0x0'));var util=require(_0x0cee('0x1'));var logger=require(_0x0cee('0x2'))(_0x0cee('0x3'));var moment=require(_0x0cee('0x4'));var BPromise=require(_0x0cee('0x5'));var rp=require(_0x0cee('0x6'));var fs=require('fs');var path=require(_0x0cee('0x7'));var rimraf=require(_0x0cee('0x8'));var config=require('../../config/environment');var attributes=require(_0x0cee('0x9'));module[_0x0cee('0xa')]=function(_0x1b3abb,_0x465e67){return _0x1b3abb[_0x0cee('0xb')]('ChatApplication',attributes,{'tableName':_0x0cee('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0cee('0xd'),'collate':_0x0cee('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 85435bd..775569c 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 _0x0bcd=['message','result','catch','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x4df3e2,_0x16a89c){var _0x584415=function(_0xb03a21){while(--_0xb03a21){_0x4df3e2['push'](_0x4df3e2['shift']());}};_0x584415(++_0x16a89c);}(_0x0bcd,0x8f));var _0xd0bc=function(_0x136087,_0x390765){_0x136087=_0x136087-0x0;var _0x56c8ba=_0x0bcd[_0x136087];return _0x56c8ba;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd0bc('0x0'));var BPromise=require(_0xd0bc('0x1'));var rs=require(_0xd0bc('0x2'));var fs=require('fs');var Redis=require(_0xd0bc('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd0bc('0x4'))(_0xd0bc('0x5'));var config=require(_0xd0bc('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd0bc('0x7')][_0xd0bc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e98ae,_0x2afd85,_0x488599){return new BPromise(function(_0x351a56,_0x3fcbf3){return client[_0xd0bc('0x9')](_0x1e98ae,_0x488599)[_0xd0bc('0xa')](function(_0x3474ba){logger[_0xd0bc('0xb')](_0xd0bc('0xc'),_0x2afd85,_0xd0bc('0xd'));logger[_0xd0bc('0xe')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x2afd85,_0xd0bc('0xd'),JSON[_0xd0bc('0xf')](_0x3474ba));if(_0x3474ba[_0xd0bc('0x10')]){if(_0x3474ba[_0xd0bc('0x10')]['code']===0x1f4){logger[_0xd0bc('0x10')](_0xd0bc('0xc'),_0x2afd85,_0x3474ba['error'][_0xd0bc('0x11')]);return _0x3fcbf3(_0x3474ba[_0xd0bc('0x10')][_0xd0bc('0x11')]);}logger[_0xd0bc('0x10')](_0xd0bc('0xc'),_0x2afd85,_0x3474ba[_0xd0bc('0x10')][_0xd0bc('0x11')]);return _0x351a56(_0x3474ba[_0xd0bc('0x10')][_0xd0bc('0x11')]);}else{logger[_0xd0bc('0xb')](_0xd0bc('0xc'),_0x2afd85,_0xd0bc('0xd'));_0x351a56(_0x3474ba[_0xd0bc('0x12')]['message']);}})[_0xd0bc('0x13')](function(_0x124362){logger[_0xd0bc('0x10')](_0xd0bc('0xc'),_0x2afd85,_0x124362);_0x3fcbf3(_0x124362);});});} \ No newline at end of file +var _0xd13c=['client','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xb1af8a,_0x2741f5){var _0x407067=function(_0xf5ac93){while(--_0xf5ac93){_0xb1af8a['push'](_0xb1af8a['shift']());}};_0x407067(++_0x2741f5);}(_0xd13c,0xd4));var _0xcd13=function(_0x44a23e,_0x7edadc){_0x44a23e=_0x44a23e-0x0;var _0x22a34c=_0xd13c[_0x44a23e];return _0x22a34c;};'use strict';var _=require(_0xcd13('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcd13('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcd13('0x2'));var db=require(_0xcd13('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd13('0x4'))(_0xcd13('0x5'));var config=require(_0xcd13('0x6'));var jayson=require(_0xcd13('0x7'));var client=jayson[_0xcd13('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16f70f,_0x4106cd,_0x3c054a){return new BPromise(function(_0x402c36,_0x252c33){return client[_0xcd13('0x9')](_0x16f70f,_0x3c054a)['then'](function(_0x4ef404){logger[_0xcd13('0xa')](_0xcd13('0xb'),_0x4106cd,_0xcd13('0xc'));logger[_0xcd13('0xd')](_0xcd13('0xe'),_0x4106cd,'request\x20sent',JSON[_0xcd13('0xf')](_0x4ef404));if(_0x4ef404[_0xcd13('0x10')]){if(_0x4ef404[_0xcd13('0x10')][_0xcd13('0x11')]===0x1f4){logger['error'](_0xcd13('0xb'),_0x4106cd,_0x4ef404[_0xcd13('0x10')]['message']);return _0x252c33(_0x4ef404['error'][_0xcd13('0x12')]);}logger[_0xcd13('0x10')](_0xcd13('0xb'),_0x4106cd,_0x4ef404[_0xcd13('0x10')][_0xcd13('0x12')]);return _0x402c36(_0x4ef404['error'][_0xcd13('0x12')]);}else{logger[_0xcd13('0xa')](_0xcd13('0xb'),_0x4106cd,_0xcd13('0xc'));_0x402c36(_0x4ef404['result'][_0xcd13('0x12')]);}})[_0xcd13('0x13')](function(_0xf15048){logger[_0xcd13('0x10')](_0xcd13('0xb'),_0x4106cd,_0xf15048);_0x252c33(_0xf15048);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index d08eb73..ddd72a6 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 _0x8a51=['Router','fs-extra','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','update','destroy','exports','multer','util','path','express'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x8a51,0xb0));var _0x18a5=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x8a51[_0x2be8c2];return _0x97f531;};'use strict';var multer=require(_0x18a5('0x0'));var util=require(_0x18a5('0x1'));var path=require(_0x18a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x18a5('0x3'));var router=express[_0x18a5('0x4')]();var fs_extra=require(_0x18a5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x18a5('0x6'));var config=require(_0x18a5('0x7'));var controller=require(_0x18a5('0x8'));router[_0x18a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['put'](_0x18a5('0xa'),auth[_0x18a5('0xb')](),controller[_0x18a5('0xc')]);router['delete']('/:id',auth[_0x18a5('0xb')](),controller[_0x18a5('0xd')]);module[_0x18a5('0xe')]=router; \ No newline at end of file +var _0x6d8a=['show','put','update','exports','multer','path','express','Router','fs-extra','../../components/auth/service','./chatApplication.controller','/:id','isAuthenticated'];(function(_0x5b5cde,_0x1f7c5f){var _0x364ad2=function(_0x4a1172){while(--_0x4a1172){_0x5b5cde['push'](_0x5b5cde['shift']());}};_0x364ad2(++_0x1f7c5f);}(_0x6d8a,0x197));var _0xa6d8=function(_0x3c81b5,_0x3f5ed7){_0x3c81b5=_0x3c81b5-0x0;var _0x5888c4=_0x6d8a[_0x3c81b5];return _0x5888c4;};'use strict';var multer=require(_0xa6d8('0x0'));var util=require('util');var path=require(_0xa6d8('0x1'));var timeout=require('connect-timeout');var express=require(_0xa6d8('0x2'));var router=express[_0xa6d8('0x3')]();var fs_extra=require(_0xa6d8('0x4'));var auth=require(_0xa6d8('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa6d8('0x6'));router['get'](_0xa6d8('0x7'),auth[_0xa6d8('0x8')](),controller[_0xa6d8('0x9')]);router[_0xa6d8('0xa')](_0xa6d8('0x7'),auth[_0xa6d8('0x8')](),controller[_0xa6d8('0xb')]);router['delete'](_0xa6d8('0x7'),auth[_0xa6d8('0x8')](),controller['destroy']);module[_0xa6d8('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 09f6f97..2cd17b1 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 _0x048f=['exports','STRING','sequelize'];(function(_0x2cba41,_0x3a64bf){var _0x179eb3=function(_0x85aa92){while(--_0x85aa92){_0x2cba41['push'](_0x2cba41['shift']());}};_0x179eb3(++_0x3a64bf);}(_0x048f,0x1c7));var _0xf048=function(_0x202957,_0x1010f2){_0x202957=_0x202957-0x0;var _0x2c5a44=_0x048f[_0x202957];return _0x2c5a44;};'use strict';var Sequelize=require(_0xf048('0x0'));module[_0xf048('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xf048('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x2d95=['BOOLEAN','sequelize','STRING'];(function(_0x5c15b0,_0x32348a){var _0x2e3489=function(_0x56cb58){while(--_0x56cb58){_0x5c15b0['push'](_0x5c15b0['shift']());}};_0x2e3489(++_0x32348a);}(_0x2d95,0xca));var _0x52d9=function(_0x5ddcf5,_0x198db8){_0x5ddcf5=_0x5ddcf5-0x0;var _0x5cbccf=_0x2d95[_0x5ddcf5];return _0x5cbccf;};'use strict';var Sequelize=require(_0x52d9('0x0'));module['exports']={'name':{'type':Sequelize[_0x52d9('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x52d9('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index a92b296..0cccd2a 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 _0xe908=['apply','reject','save','then','stack','send','map','ChatGroup','fieldName','type','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','destroy','find','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','length','removeMembers','addMessage','$gte','format','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','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range'];(function(_0x20c7f3,_0x2677f2){var _0x5ef9c9=function(_0x33eea5){while(--_0x33eea5){_0x20c7f3['push'](_0x20c7f3['shift']());}};_0x5ef9c9(++_0x2677f2);}(_0xe908,0xf7));var _0x8e90=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xe908[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require(_0x8e90('0x0'));var rimraf=require(_0x8e90('0x1'));var zipdir=require(_0x8e90('0x2'));var jsonpatch=require(_0x8e90('0x3'));var rp=require(_0x8e90('0x4'));var moment=require(_0x8e90('0x5'));var BPromise=require(_0x8e90('0x6'));var Mustache=require(_0x8e90('0x7'));var util=require(_0x8e90('0x8'));var path=require(_0x8e90('0x9'));var sox=require(_0x8e90('0xa'));var csv=require(_0x8e90('0xb'));var ejs=require(_0x8e90('0xc'));var fs=require('fs');var fs_extra=require(_0x8e90('0xd'));var _=require(_0x8e90('0xe'));var squel=require(_0x8e90('0xf'));var crypto=require(_0x8e90('0x10'));var jsforce=require(_0x8e90('0x11'));var deskjs=require(_0x8e90('0x12'));var toCsv=require('to-csv');var querystring=require(_0x8e90('0x13'));var Papa=require(_0x8e90('0x14'));var Redis=require(_0x8e90('0x15'));var authService=require(_0x8e90('0x16'));var qs=require('../../components/parsers/qs');var as=require(_0x8e90('0x17'));var hardwareService=require(_0x8e90('0x18'));var logger=require('../../config/logger')('api');var utils=require(_0x8e90('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8e90('0x1a'))['db'];config[_0x8e90('0x1b')]=_[_0x8e90('0x1c')](config[_0x8e90('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x8e90('0x1d'))(new Redis(config['redis']));require(_0x8e90('0x1e'))[_0x8e90('0x1f')](socket);function respondWithStatusCode(_0x34ee29,_0x685319){_0x685319=_0x685319||0xcc;return function(_0x5ecda6){if(_0x5ecda6){return _0x34ee29[_0x8e90('0x20')](_0x685319);}return _0x34ee29[_0x8e90('0x21')](_0x685319)[_0x8e90('0x22')]();};}function respondWithResult(_0x29d2f2,_0xc2c7e4){_0xc2c7e4=_0xc2c7e4||0xc8;return function(_0x10179d){if(_0x10179d){return _0x29d2f2[_0x8e90('0x21')](_0xc2c7e4)[_0x8e90('0x23')](_0x10179d);}};}function respondWithFilteredResult(_0x33f6d7,_0x154073){return function(_0xa36a5d){if(_0xa36a5d){var _0x44c6d0=typeof _0x154073['offset']===_0x8e90('0x24')&&typeof _0x154073['limit']===_0x8e90('0x24');var _0x49f66b=_0xa36a5d[_0x8e90('0x25')];var _0x14f9fb=_0x44c6d0?0x0:_0x154073[_0x8e90('0x26')];var _0x37afdb=_0x44c6d0?_0xa36a5d['count']:_0x154073[_0x8e90('0x26')]+_0x154073[_0x8e90('0x27')];var _0x35acc6;if(_0x37afdb>=_0x49f66b){_0x37afdb=_0x49f66b;_0x35acc6=0xc8;}else{_0x35acc6=0xce;}_0x33f6d7[_0x8e90('0x21')](_0x35acc6);return _0x33f6d7['set'](_0x8e90('0x28'),_0x14f9fb+'-'+_0x37afdb+'/'+_0x49f66b)['json'](_0xa36a5d);}return null;};}function patchUpdates(_0x349a57){return function(_0x20fb30){try{jsonpatch[_0x8e90('0x29')](_0x20fb30,_0x349a57,!![]);}catch(_0x37956b){return BPromise[_0x8e90('0x2a')](_0x37956b);}return _0x20fb30[_0x8e90('0x2b')]();};}function saveUpdates(_0x98ca6a,_0x3142ef){return function(_0x4f4017){if(_0x4f4017){return _0x4f4017['update'](_0x98ca6a)['then'](function(_0x9c1e0){return _0x9c1e0;});}return null;};}function removeEntity(_0x1dd93d,_0x1cfe0e){return function(_0x4d4f72){if(_0x4d4f72){return _0x4d4f72['destroy']()[_0x8e90('0x2c')](function(){_0x1dd93d[_0x8e90('0x21')](0xcc)[_0x8e90('0x22')]();});}};}function handleEntityNotFound(_0x2c0595,_0x57bdd5){return function(_0x5b5981){if(!_0x5b5981){_0x2c0595[_0x8e90('0x20')](0x194);}return _0x5b5981;};}function handleError(_0x3c9ed3,_0x2fd545){_0x2fd545=_0x2fd545||0x1f4;return function(_0x585eee){logger['error'](_0x585eee[_0x8e90('0x2d')]);if(_0x585eee['name']){delete _0x585eee['name'];}_0x3c9ed3['status'](_0x2fd545)[_0x8e90('0x2e')](_0x585eee);};}exports['index']=function(_0x41ba5f,_0x2d8a7d){var _0x5bfd4e={},_0x116090={},_0x4727ce={'count':0x0,'rows':[]};var _0x220387=_[_0x8e90('0x2f')](db[_0x8e90('0x30')]['rawAttributes'],function(_0x5d87d4){return{'name':_0x5d87d4[_0x8e90('0x31')],'type':_0x5d87d4[_0x8e90('0x32')]['key']};});_0x116090[_0x8e90('0x33')]=_[_0x8e90('0x2f')](_0x220387,_0x8e90('0x34'));_0x116090[_0x8e90('0x35')]=_[_0x8e90('0x36')](_0x41ba5f[_0x8e90('0x35')]);_0x116090[_0x8e90('0x37')]=_[_0x8e90('0x38')](_0x116090['model'],_0x116090[_0x8e90('0x35')]);_0x5bfd4e['attributes']=_[_0x8e90('0x38')](_0x116090[_0x8e90('0x33')],qs[_0x8e90('0x39')](_0x41ba5f[_0x8e90('0x35')][_0x8e90('0x39')]));_0x5bfd4e[_0x8e90('0x3a')]=_0x5bfd4e[_0x8e90('0x3a')]['length']?_0x5bfd4e[_0x8e90('0x3a')]:_0x116090[_0x8e90('0x33')];if(!_0x41ba5f[_0x8e90('0x35')][_0x8e90('0x3b')](_0x8e90('0x3c'))){_0x5bfd4e['limit']=qs['limit'](_0x41ba5f[_0x8e90('0x35')][_0x8e90('0x27')]);_0x5bfd4e[_0x8e90('0x26')]=qs[_0x8e90('0x26')](_0x41ba5f[_0x8e90('0x35')]['offset']);}_0x5bfd4e[_0x8e90('0x3d')]=qs[_0x8e90('0x3e')](_0x41ba5f[_0x8e90('0x35')][_0x8e90('0x3e')]);_0x5bfd4e[_0x8e90('0x3f')]=qs[_0x8e90('0x37')](_[_0x8e90('0x40')](_0x41ba5f[_0x8e90('0x35')],_0x116090[_0x8e90('0x37')]),_0x220387);if(_0x41ba5f['query'][_0x8e90('0x41')]){_0x5bfd4e['where']=_[_0x8e90('0x42')](_0x5bfd4e[_0x8e90('0x3f')],{'$or':_[_0x8e90('0x2f')](_0x220387,function(_0x56e61f){if(_0x56e61f['type']!==_0x8e90('0x43')){var _0x477719={};_0x477719[_0x56e61f['name']]={'$like':'%'+_0x41ba5f[_0x8e90('0x35')][_0x8e90('0x41')]+'%'};return _0x477719;}})});}_0x5bfd4e=_['merge']({},_0x5bfd4e,_0x41ba5f[_0x8e90('0x44')]);var _0x5e755f={'where':_0x5bfd4e[_0x8e90('0x3f')]};return db[_0x8e90('0x30')]['count'](_0x5e755f)[_0x8e90('0x2c')](function(_0x20c6fb){_0x4727ce[_0x8e90('0x25')]=_0x20c6fb;if(_0x41ba5f[_0x8e90('0x35')]['includeAll']){_0x5bfd4e['include']=[{'all':!![]}];}return db[_0x8e90('0x30')][_0x8e90('0x45')](_0x5bfd4e);})[_0x8e90('0x2c')](function(_0x4c4c8f){_0x4727ce[_0x8e90('0x46')]=_0x4c4c8f;return _0x4727ce;})[_0x8e90('0x2c')](respondWithFilteredResult(_0x2d8a7d,_0x5bfd4e))[_0x8e90('0x47')](handleError(_0x2d8a7d,null));};exports[_0x8e90('0x48')]=function(_0x16fe65,_0x45f7a6){var _0x2d48f8={'raw':!![],'where':{'id':_0x16fe65[_0x8e90('0x49')]['id']}},_0x594580={};_0x594580[_0x8e90('0x33')]=_[_0x8e90('0x36')](db[_0x8e90('0x30')][_0x8e90('0x4a')]);_0x594580['query']=_[_0x8e90('0x36')](_0x16fe65[_0x8e90('0x35')]);_0x594580[_0x8e90('0x37')]=_[_0x8e90('0x38')](_0x594580[_0x8e90('0x33')],_0x594580[_0x8e90('0x35')]);_0x2d48f8[_0x8e90('0x3a')]=_[_0x8e90('0x38')](_0x594580[_0x8e90('0x33')],qs[_0x8e90('0x39')](_0x16fe65[_0x8e90('0x35')][_0x8e90('0x39')]));_0x2d48f8['attributes']=_0x2d48f8[_0x8e90('0x3a')]['length']?_0x2d48f8[_0x8e90('0x3a')]:_0x594580[_0x8e90('0x33')];if(_0x16fe65[_0x8e90('0x35')][_0x8e90('0x4b')]){_0x2d48f8['include']=[{'all':!![]}];}_0x2d48f8=_[_0x8e90('0x42')]({},_0x2d48f8,_0x16fe65['options']);return db[_0x8e90('0x30')]['find'](_0x2d48f8)['then'](handleEntityNotFound(_0x45f7a6,null))[_0x8e90('0x2c')](respondWithResult(_0x45f7a6,null))[_0x8e90('0x47')](handleError(_0x45f7a6,null));};exports[_0x8e90('0x4c')]=function(_0x45578d,_0x5bf00b){return db[_0x8e90('0x30')][_0x8e90('0x4c')](_0x45578d['body'],{})[_0x8e90('0x2c')](respondWithResult(_0x5bf00b,0xc9))[_0x8e90('0x47')](handleError(_0x5bf00b,null));};exports['update']=function(_0x4a6de1,_0x4b8b2f){if(_0x4a6de1[_0x8e90('0x4d')]['id']){delete _0x4a6de1['body']['id'];}return db[_0x8e90('0x30')]['find']({'where':{'id':_0x4a6de1['params']['id']}})['then'](handleEntityNotFound(_0x4b8b2f,null))[_0x8e90('0x2c')](saveUpdates(_0x4a6de1[_0x8e90('0x4d')],null))[_0x8e90('0x2c')](respondWithResult(_0x4b8b2f,null))[_0x8e90('0x47')](handleError(_0x4b8b2f,null));};exports[_0x8e90('0x4e')]=function(_0x2b23b9,_0xf3d2b1){return db[_0x8e90('0x30')][_0x8e90('0x4f')]({'where':{'id':_0x2b23b9[_0x8e90('0x49')]['id']}})[_0x8e90('0x2c')](handleEntityNotFound(_0xf3d2b1,null))[_0x8e90('0x2c')](removeEntity(_0xf3d2b1,null))['catch'](handleError(_0xf3d2b1,null));};exports['describe']=function(_0xb09424,_0x4c4d61){return db[_0x8e90('0x30')][_0x8e90('0x50')]()[_0x8e90('0x2c')](respondWithResult(_0x4c4d61,null))['catch'](handleError(_0x4c4d61,null));};exports[_0x8e90('0x51')]=function(_0x595d39,_0x72eb80,_0xe8b588){return db[_0x8e90('0x52')][_0x8e90('0x25')]({'where':{'ChatGroupId':_0x595d39[_0x8e90('0x49')]['id'],'ToId':_0x595d39[_0x8e90('0x53')]['id'],'read':![]}})[_0x8e90('0x2c')](function(_0x277b59){return{'id':_[_0x8e90('0x54')](_0x595d39[_0x8e90('0x49')]['id']),'count':_0x277b59};})[_0x8e90('0x2c')](respondWithResult(_0x72eb80,null))[_0x8e90('0x47')](handleError(_0x72eb80,null));};exports[_0x8e90('0x55')]=function(_0x565e46,_0x1de266,_0x2a13cc){return db[_0x8e90('0x30')][_0x8e90('0x4f')]({'where':{'id':_0x565e46[_0x8e90('0x49')]['id']}})[_0x8e90('0x2c')](handleEntityNotFound(_0x1de266,null))[_0x8e90('0x2c')](function(_0x2f020a){if(_0x2f020a){return _0x2f020a[_0x8e90('0x55')](_0x565e46[_0x8e90('0x4d')][_0x8e90('0x56')],_[_0x8e90('0x57')](_0x565e46[_0x8e90('0x4d')],['ids','id'])||{});}})[_0x8e90('0x2c')](respondWithResult(_0x1de266,null))['catch'](handleError(_0x1de266,null));};exports[_0x8e90('0x58')]=function(_0x1e17bc,_0xc4cc77,_0x30742c){var _0xbc6c2f={};var _0x50a7ed={};var _0x1892a8;var _0x592706;return db['ChatGroup'][_0x8e90('0x59')]({'where':{'id':_0x1e17bc[_0x8e90('0x49')]['id']}})[_0x8e90('0x2c')](handleEntityNotFound(_0xc4cc77,null))['then'](function(_0x53b700){if(_0x53b700){_0x1892a8=_0x53b700;_0x50a7ed[_0x8e90('0x33')]=_[_0x8e90('0x36')](db['User'][_0x8e90('0x4a')]);_0x50a7ed[_0x8e90('0x35')]=_[_0x8e90('0x36')](_0x1e17bc[_0x8e90('0x35')]);_0x50a7ed[_0x8e90('0x37')]=_[_0x8e90('0x38')](_0x50a7ed[_0x8e90('0x33')],_0x50a7ed[_0x8e90('0x35')]);_0xbc6c2f[_0x8e90('0x3a')]=_[_0x8e90('0x38')](_0x50a7ed['model'],qs[_0x8e90('0x39')](_0x1e17bc['query']['fields']));_0xbc6c2f[_0x8e90('0x3a')]=_0xbc6c2f[_0x8e90('0x3a')][_0x8e90('0x5a')]?_0xbc6c2f[_0x8e90('0x3a')]:_0x50a7ed['model'];_0xbc6c2f[_0x8e90('0x3d')]=qs[_0x8e90('0x3e')](_0x1e17bc[_0x8e90('0x35')]['sort']);_0xbc6c2f['where']=qs[_0x8e90('0x37')](_[_0x8e90('0x40')](_0x1e17bc['query'],_0x50a7ed[_0x8e90('0x37')]));if(_0x1e17bc['query'][_0x8e90('0x41')]){_0xbc6c2f[_0x8e90('0x3f')]=_[_0x8e90('0x42')](_0xbc6c2f['where'],{'$or':_['map'](_0xbc6c2f['attributes'],function(_0x2aa9b3){var _0x325424={};_0x325424[_0x2aa9b3]={'$like':'%'+_0x1e17bc[_0x8e90('0x35')][_0x8e90('0x41')]+'%'};return _0x325424;})});}_0xbc6c2f=_['merge']({},_0xbc6c2f,_0x1e17bc[_0x8e90('0x44')]);return _0x1892a8[_0x8e90('0x58')](_0xbc6c2f);}})[_0x8e90('0x2c')](function(_0x3c5327){if(_0x3c5327){_0x592706=_0x3c5327[_0x8e90('0x5a')];if(!_0x1e17bc[_0x8e90('0x35')][_0x8e90('0x3b')](_0x8e90('0x3c'))){_0xbc6c2f[_0x8e90('0x27')]=qs[_0x8e90('0x27')](_0x1e17bc['query'][_0x8e90('0x27')]);_0xbc6c2f[_0x8e90('0x26')]=qs['offset'](_0x1e17bc[_0x8e90('0x35')]['offset']);}return _0x1892a8[_0x8e90('0x58')](_0xbc6c2f);}})[_0x8e90('0x2c')](function(_0x407598){if(_0x407598){return _0x407598?{'count':_0x592706,'rows':_0x407598}:null;}})['then'](respondWithResult(_0xc4cc77,null))[_0x8e90('0x47')](handleError(_0xc4cc77,null));};exports[_0x8e90('0x5b')]=function(_0x4ec472,_0x80b4e5,_0x4368f1){return db[_0x8e90('0x30')][_0x8e90('0x4f')]({'where':{'id':_0x4ec472[_0x8e90('0x49')]['id']}})['then'](handleEntityNotFound(_0x80b4e5,null))[_0x8e90('0x2c')](function(_0x3332d7){if(_0x3332d7){return _0x3332d7[_0x8e90('0x5b')](_0x4ec472['query']['ids']);}})[_0x8e90('0x2c')](respondWithStatusCode(_0x80b4e5,null))[_0x8e90('0x47')](handleError(_0x80b4e5,null));};exports[_0x8e90('0x5c')]=function(_0x268280,_0x26f632,_0x2e0d56){if(_0x268280[_0x8e90('0x4d')]['id']){delete _0x268280[_0x8e90('0x4d')]['id'];}return db[_0x8e90('0x30')][_0x8e90('0x4f')]({'where':{'id':_0x268280['params']['id']}})[_0x8e90('0x2c')](handleEntityNotFound(_0x26f632,null))[_0x8e90('0x2c')](function(_0x25754a){if(_0x25754a){_0x268280['body']['ChatGroupId']=_0x25754a['id'];return db[_0x8e90('0x52')]['create'](_0x268280[_0x8e90('0x4d')]);}})[_0x8e90('0x2c')](respondWithResult(_0x26f632,null))['catch'](handleError(_0x26f632,null));};exports['getMessages']=function(_0xf72c33,_0xe9f36e,_0x179204){var _0x25d8d4={};var _0x45d36d={};var _0x421bb4;var _0x28a2d6;return db[_0x8e90('0x30')][_0x8e90('0x59')]({'where':{'id':_0xf72c33[_0x8e90('0x49')]['id']}})[_0x8e90('0x2c')](handleEntityNotFound(_0xe9f36e,null))[_0x8e90('0x2c')](function(_0x5c3972){if(_0x5c3972){_0x421bb4=_0x5c3972;_0x45d36d['model']=_[_0x8e90('0x36')](db[_0x8e90('0x52')]['rawAttributes']);_0x45d36d[_0x8e90('0x35')]=_[_0x8e90('0x36')](_0xf72c33[_0x8e90('0x35')]);_0x45d36d[_0x8e90('0x37')]=_[_0x8e90('0x38')](_0x45d36d[_0x8e90('0x33')],_0x45d36d[_0x8e90('0x35')]);_0x25d8d4[_0x8e90('0x3a')]=_[_0x8e90('0x38')](_0x45d36d['model'],qs['fields'](_0xf72c33[_0x8e90('0x35')][_0x8e90('0x39')]));_0x25d8d4['attributes']=_0x25d8d4[_0x8e90('0x3a')][_0x8e90('0x5a')]?_0x25d8d4[_0x8e90('0x3a')]:_0x45d36d['model'];_0x25d8d4[_0x8e90('0x3d')]=qs[_0x8e90('0x3e')](_0xf72c33[_0x8e90('0x35')][_0x8e90('0x3e')]);_0x25d8d4[_0x8e90('0x3f')]=qs[_0x8e90('0x37')](_['pick'](_0xf72c33['query'],_0x45d36d[_0x8e90('0x37')]));if(_0xf72c33[_0x8e90('0x35')][_0x8e90('0x41')]){_0x25d8d4['where']=_[_0x8e90('0x42')](_0x25d8d4['where'],{'$or':_[_0x8e90('0x2f')](_0x25d8d4[_0x8e90('0x3a')],function(_0x12f493){var _0x33e59={};_0x33e59[_0x12f493]={'$like':'%'+_0xf72c33[_0x8e90('0x35')][_0x8e90('0x41')]+'%'};return _0x33e59;})});}if(_0xf72c33['query'][_0x8e90('0x5d')]){var _0x220dce=_0xf72c33['query'][_0x8e90('0x5d')]['split'](',');var _0x5cd7f0={};_0x5cd7f0[_0x220dce[0x0]]={'$gte':moment(_0x220dce[0x1])[_0x8e90('0x5e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x25d8d4[_0x8e90('0x3f')]=_['merge'](_0x25d8d4[_0x8e90('0x3f')],_0x5cd7f0);}_0x25d8d4=_[_0x8e90('0x42')]({},_0x25d8d4,_0xf72c33[_0x8e90('0x44')]);return _0x421bb4[_0x8e90('0x5f')](_0x25d8d4);}})[_0x8e90('0x2c')](function(_0x66f64){if(_0x66f64){_0x28a2d6=_0x66f64['length'];if(!_0xf72c33[_0x8e90('0x35')][_0x8e90('0x3b')]('nolimit')){_0x25d8d4[_0x8e90('0x27')]=qs[_0x8e90('0x27')](_0xf72c33[_0x8e90('0x35')][_0x8e90('0x27')]);_0x25d8d4[_0x8e90('0x26')]=qs[_0x8e90('0x26')](_0xf72c33[_0x8e90('0x35')]['offset']);}return _0x421bb4[_0x8e90('0x5f')](_0x25d8d4);}})['then'](function(_0x41c334){if(_0x41c334){return _0x41c334?{'count':_0x28a2d6,'rows':_0x41c334}:null;}})[_0x8e90('0x2c')](respondWithResult(_0xe9f36e,null))[_0x8e90('0x47')](handleError(_0xe9f36e,null));}; \ No newline at end of file +var _0x3429=['order','sort','pick','filter','where','merge','type','VIRTUAL','options','findAll','rows','show','params','length','includeAll','find','body','catch','destroy','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','findOne','getMembers','nolimit','removeMembers','addMessage','ChatGroupId','create','getMessages','$gte','split','format','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','ChatGroup','rawAttributes','fieldName','map','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty'];(function(_0x28ee32,_0x449973){var _0x29ae39=function(_0x518cb2){while(--_0x518cb2){_0x28ee32['push'](_0x28ee32['shift']());}};_0x29ae39(++_0x449973);}(_0x3429,0xdf));var _0x9342=function(_0x149b14,_0x4b2ba1){_0x149b14=_0x149b14-0x0;var _0x33e637=_0x3429[_0x149b14];return _0x33e637;};'use strict';var emlformat=require(_0x9342('0x0'));var rimraf=require(_0x9342('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9342('0x2'));var BPromise=require(_0x9342('0x3'));var Mustache=require(_0x9342('0x4'));var util=require('util');var path=require(_0x9342('0x5'));var sox=require(_0x9342('0x6'));var csv=require(_0x9342('0x7'));var ejs=require(_0x9342('0x8'));var fs=require('fs');var fs_extra=require(_0x9342('0x9'));var _=require(_0x9342('0xa'));var squel=require(_0x9342('0xb'));var crypto=require('crypto');var jsforce=require(_0x9342('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9342('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9342('0xd'));var authService=require(_0x9342('0xe'));var qs=require(_0x9342('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9342('0x10'));var logger=require('../../config/logger')(_0x9342('0x11'));var utils=require('../../config/utils');var config=require(_0x9342('0x12'));var licenseUtil=require(_0x9342('0x13'));var db=require('../../mysqldb')['db'];config[_0x9342('0x14')]=_[_0x9342('0x15')](config[_0x9342('0x14')],{'host':_0x9342('0x16'),'port':0x18eb});var socket=require(_0x9342('0x17'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x9342('0x18')](socket);function respondWithStatusCode(_0x5454e3,_0x5a3636){_0x5a3636=_0x5a3636||0xcc;return function(_0x1794c8){if(_0x1794c8){return _0x5454e3[_0x9342('0x19')](_0x5a3636);}return _0x5454e3[_0x9342('0x1a')](_0x5a3636)[_0x9342('0x1b')]();};}function respondWithResult(_0x4dfcae,_0x3a1f52){_0x3a1f52=_0x3a1f52||0xc8;return function(_0x2cf1fc){if(_0x2cf1fc){return _0x4dfcae[_0x9342('0x1a')](_0x3a1f52)[_0x9342('0x1c')](_0x2cf1fc);}};}function respondWithFilteredResult(_0x5f3de8,_0x56e650){return function(_0x554675){if(_0x554675){var _0x1ceadd=typeof _0x56e650[_0x9342('0x1d')]==='undefined'&&typeof _0x56e650[_0x9342('0x1e')]==='undefined';var _0x373038=_0x554675[_0x9342('0x1f')];var _0x38106f=_0x1ceadd?0x0:_0x56e650['offset'];var _0x5aaf5c=_0x1ceadd?_0x554675['count']:_0x56e650['offset']+_0x56e650[_0x9342('0x1e')];var _0x4480f9;if(_0x5aaf5c>=_0x373038){_0x5aaf5c=_0x373038;_0x4480f9=0xc8;}else{_0x4480f9=0xce;}_0x5f3de8[_0x9342('0x1a')](_0x4480f9);return _0x5f3de8[_0x9342('0x20')](_0x9342('0x21'),_0x38106f+'-'+_0x5aaf5c+'/'+_0x373038)[_0x9342('0x1c')](_0x554675);}return null;};}function patchUpdates(_0x28bb6d){return function(_0x1dc531){try{jsonpatch[_0x9342('0x22')](_0x1dc531,_0x28bb6d,!![]);}catch(_0x4008ac){return BPromise[_0x9342('0x23')](_0x4008ac);}return _0x1dc531[_0x9342('0x24')]();};}function saveUpdates(_0x55c167,_0x453c20){return function(_0x465ee9){if(_0x465ee9){return _0x465ee9[_0x9342('0x25')](_0x55c167)[_0x9342('0x26')](function(_0x1f4c19){return _0x1f4c19;});}return null;};}function removeEntity(_0x21b53a,_0x22c2bd){return function(_0x303321){if(_0x303321){return _0x303321['destroy']()[_0x9342('0x26')](function(){_0x21b53a[_0x9342('0x1a')](0xcc)[_0x9342('0x1b')]();});}};}function handleEntityNotFound(_0x57445e,_0x41cb81){return function(_0x14b45a){if(!_0x14b45a){_0x57445e[_0x9342('0x19')](0x194);}return _0x14b45a;};}function handleError(_0x5a9a14,_0x3dede8){_0x3dede8=_0x3dede8||0x1f4;return function(_0x5c43d2){logger[_0x9342('0x27')](_0x5c43d2[_0x9342('0x28')]);if(_0x5c43d2[_0x9342('0x29')]){delete _0x5c43d2[_0x9342('0x29')];}_0x5a9a14[_0x9342('0x1a')](_0x3dede8)[_0x9342('0x2a')](_0x5c43d2);};}exports[_0x9342('0x2b')]=function(_0x3638ff,_0x3ac167){var _0x39625a={},_0x50ed7d={},_0x1a2666={'count':0x0,'rows':[]};var _0x137c0f=_['map'](db[_0x9342('0x2c')][_0x9342('0x2d')],function(_0x4b506a){return{'name':_0x4b506a[_0x9342('0x2e')],'type':_0x4b506a['type']['key']};});_0x50ed7d['model']=_[_0x9342('0x2f')](_0x137c0f,_0x9342('0x29'));_0x50ed7d[_0x9342('0x30')]=_[_0x9342('0x31')](_0x3638ff['query']);_0x50ed7d[_0x9342('0x32')]=_['intersection'](_0x50ed7d[_0x9342('0x33')],_0x50ed7d[_0x9342('0x30')]);_0x39625a[_0x9342('0x34')]=_[_0x9342('0x35')](_0x50ed7d['model'],qs['fields'](_0x3638ff[_0x9342('0x30')][_0x9342('0x36')]));_0x39625a[_0x9342('0x34')]=_0x39625a['attributes']['length']?_0x39625a[_0x9342('0x34')]:_0x50ed7d[_0x9342('0x33')];if(!_0x3638ff[_0x9342('0x30')][_0x9342('0x37')]('nolimit')){_0x39625a[_0x9342('0x1e')]=qs[_0x9342('0x1e')](_0x3638ff[_0x9342('0x30')][_0x9342('0x1e')]);_0x39625a[_0x9342('0x1d')]=qs[_0x9342('0x1d')](_0x3638ff[_0x9342('0x30')][_0x9342('0x1d')]);}_0x39625a[_0x9342('0x38')]=qs[_0x9342('0x39')](_0x3638ff[_0x9342('0x30')][_0x9342('0x39')]);_0x39625a['where']=qs[_0x9342('0x32')](_[_0x9342('0x3a')](_0x3638ff[_0x9342('0x30')],_0x50ed7d['filters']),_0x137c0f);if(_0x3638ff[_0x9342('0x30')][_0x9342('0x3b')]){_0x39625a[_0x9342('0x3c')]=_[_0x9342('0x3d')](_0x39625a[_0x9342('0x3c')],{'$or':_[_0x9342('0x2f')](_0x137c0f,function(_0x23a078){if(_0x23a078[_0x9342('0x3e')]!==_0x9342('0x3f')){var _0x59a041={};_0x59a041[_0x23a078['name']]={'$like':'%'+_0x3638ff[_0x9342('0x30')]['filter']+'%'};return _0x59a041;}})});}_0x39625a=_[_0x9342('0x3d')]({},_0x39625a,_0x3638ff[_0x9342('0x40')]);var _0x4a6181={'where':_0x39625a['where']};return db[_0x9342('0x2c')][_0x9342('0x1f')](_0x4a6181)['then'](function(_0x19ec8c){_0x1a2666['count']=_0x19ec8c;if(_0x3638ff['query']['includeAll']){_0x39625a['include']=[{'all':!![]}];}return db[_0x9342('0x2c')][_0x9342('0x41')](_0x39625a);})[_0x9342('0x26')](function(_0x530f0d){_0x1a2666[_0x9342('0x42')]=_0x530f0d;return _0x1a2666;})[_0x9342('0x26')](respondWithFilteredResult(_0x3ac167,_0x39625a))['catch'](handleError(_0x3ac167,null));};exports[_0x9342('0x43')]=function(_0x5d64e2,_0x17014e){var _0x2e9aad={'raw':!![],'where':{'id':_0x5d64e2[_0x9342('0x44')]['id']}},_0x348ef5={};_0x348ef5[_0x9342('0x33')]=_[_0x9342('0x31')](db['ChatGroup']['rawAttributes']);_0x348ef5[_0x9342('0x30')]=_['keys'](_0x5d64e2[_0x9342('0x30')]);_0x348ef5[_0x9342('0x32')]=_[_0x9342('0x35')](_0x348ef5[_0x9342('0x33')],_0x348ef5[_0x9342('0x30')]);_0x2e9aad['attributes']=_['intersection'](_0x348ef5['model'],qs['fields'](_0x5d64e2['query'][_0x9342('0x36')]));_0x2e9aad[_0x9342('0x34')]=_0x2e9aad[_0x9342('0x34')][_0x9342('0x45')]?_0x2e9aad['attributes']:_0x348ef5[_0x9342('0x33')];if(_0x5d64e2[_0x9342('0x30')][_0x9342('0x46')]){_0x2e9aad['include']=[{'all':!![]}];}_0x2e9aad=_[_0x9342('0x3d')]({},_0x2e9aad,_0x5d64e2[_0x9342('0x40')]);return db[_0x9342('0x2c')][_0x9342('0x47')](_0x2e9aad)['then'](handleEntityNotFound(_0x17014e,null))[_0x9342('0x26')](respondWithResult(_0x17014e,null))['catch'](handleError(_0x17014e,null));};exports['create']=function(_0x41a5f6,_0x279e0f){return db[_0x9342('0x2c')]['create'](_0x41a5f6[_0x9342('0x48')],{})[_0x9342('0x26')](respondWithResult(_0x279e0f,0xc9))[_0x9342('0x49')](handleError(_0x279e0f,null));};exports['update']=function(_0x2ab211,_0x5e048a){if(_0x2ab211[_0x9342('0x48')]['id']){delete _0x2ab211['body']['id'];}return db[_0x9342('0x2c')]['find']({'where':{'id':_0x2ab211[_0x9342('0x44')]['id']}})['then'](handleEntityNotFound(_0x5e048a,null))[_0x9342('0x26')](saveUpdates(_0x2ab211['body'],null))['then'](respondWithResult(_0x5e048a,null))['catch'](handleError(_0x5e048a,null));};exports[_0x9342('0x4a')]=function(_0x153b79,_0x3819bf){return db['ChatGroup'][_0x9342('0x47')]({'where':{'id':_0x153b79[_0x9342('0x44')]['id']}})[_0x9342('0x26')](handleEntityNotFound(_0x3819bf,null))[_0x9342('0x26')](removeEntity(_0x3819bf,null))['catch'](handleError(_0x3819bf,null));};exports[_0x9342('0x4b')]=function(_0x1b695b,_0x5837d5){return db['ChatGroup'][_0x9342('0x4b')]()['then'](respondWithResult(_0x5837d5,null))['catch'](handleError(_0x5837d5,null));};exports[_0x9342('0x4c')]=function(_0x2e8c0a,_0xbe5de,_0x592ba8){return db[_0x9342('0x4d')]['count']({'where':{'ChatGroupId':_0x2e8c0a[_0x9342('0x44')]['id'],'ToId':_0x2e8c0a[_0x9342('0x4e')]['id'],'read':![]}})[_0x9342('0x26')](function(_0x3059af){return{'id':_[_0x9342('0x4f')](_0x2e8c0a[_0x9342('0x44')]['id']),'count':_0x3059af};})[_0x9342('0x26')](respondWithResult(_0xbe5de,null))[_0x9342('0x49')](handleError(_0xbe5de,null));};exports[_0x9342('0x50')]=function(_0x3ba5be,_0x2b386a,_0x1aab1d){return db[_0x9342('0x2c')][_0x9342('0x47')]({'where':{'id':_0x3ba5be['params']['id']}})[_0x9342('0x26')](handleEntityNotFound(_0x2b386a,null))[_0x9342('0x26')](function(_0x906c73){if(_0x906c73){return _0x906c73[_0x9342('0x50')](_0x3ba5be[_0x9342('0x48')][_0x9342('0x51')],_['omit'](_0x3ba5be['body'],[_0x9342('0x51'),'id'])||{});}})[_0x9342('0x26')](respondWithResult(_0x2b386a,null))[_0x9342('0x49')](handleError(_0x2b386a,null));};exports['getMembers']=function(_0x7d7802,_0x404f17,_0x24519d){var _0x5539af={};var _0x1983a5={};var _0x5c3caf;var _0x53f2e0;return db[_0x9342('0x2c')][_0x9342('0x52')]({'where':{'id':_0x7d7802[_0x9342('0x44')]['id']}})[_0x9342('0x26')](handleEntityNotFound(_0x404f17,null))[_0x9342('0x26')](function(_0x2f7fa8){if(_0x2f7fa8){_0x5c3caf=_0x2f7fa8;_0x1983a5['model']=_[_0x9342('0x31')](db['User'][_0x9342('0x2d')]);_0x1983a5['query']=_['keys'](_0x7d7802[_0x9342('0x30')]);_0x1983a5[_0x9342('0x32')]=_[_0x9342('0x35')](_0x1983a5[_0x9342('0x33')],_0x1983a5[_0x9342('0x30')]);_0x5539af[_0x9342('0x34')]=_[_0x9342('0x35')](_0x1983a5[_0x9342('0x33')],qs[_0x9342('0x36')](_0x7d7802['query'][_0x9342('0x36')]));_0x5539af[_0x9342('0x34')]=_0x5539af[_0x9342('0x34')][_0x9342('0x45')]?_0x5539af['attributes']:_0x1983a5[_0x9342('0x33')];_0x5539af[_0x9342('0x38')]=qs[_0x9342('0x39')](_0x7d7802[_0x9342('0x30')]['sort']);_0x5539af[_0x9342('0x3c')]=qs[_0x9342('0x32')](_[_0x9342('0x3a')](_0x7d7802[_0x9342('0x30')],_0x1983a5[_0x9342('0x32')]));if(_0x7d7802[_0x9342('0x30')][_0x9342('0x3b')]){_0x5539af[_0x9342('0x3c')]=_[_0x9342('0x3d')](_0x5539af[_0x9342('0x3c')],{'$or':_[_0x9342('0x2f')](_0x5539af['attributes'],function(_0x4c1da9){var _0x5abddd={};_0x5abddd[_0x4c1da9]={'$like':'%'+_0x7d7802['query'][_0x9342('0x3b')]+'%'};return _0x5abddd;})});}_0x5539af=_[_0x9342('0x3d')]({},_0x5539af,_0x7d7802[_0x9342('0x40')]);return _0x5c3caf[_0x9342('0x53')](_0x5539af);}})['then'](function(_0x3d65df){if(_0x3d65df){_0x53f2e0=_0x3d65df[_0x9342('0x45')];if(!_0x7d7802[_0x9342('0x30')][_0x9342('0x37')](_0x9342('0x54'))){_0x5539af['limit']=qs[_0x9342('0x1e')](_0x7d7802[_0x9342('0x30')][_0x9342('0x1e')]);_0x5539af[_0x9342('0x1d')]=qs[_0x9342('0x1d')](_0x7d7802[_0x9342('0x30')][_0x9342('0x1d')]);}return _0x5c3caf[_0x9342('0x53')](_0x5539af);}})[_0x9342('0x26')](function(_0xfa7928){if(_0xfa7928){return _0xfa7928?{'count':_0x53f2e0,'rows':_0xfa7928}:null;}})['then'](respondWithResult(_0x404f17,null))[_0x9342('0x49')](handleError(_0x404f17,null));};exports[_0x9342('0x55')]=function(_0x29c2e1,_0x124f82,_0xd0b1f4){return db['ChatGroup'][_0x9342('0x47')]({'where':{'id':_0x29c2e1['params']['id']}})[_0x9342('0x26')](handleEntityNotFound(_0x124f82,null))[_0x9342('0x26')](function(_0x3d8f3d){if(_0x3d8f3d){return _0x3d8f3d[_0x9342('0x55')](_0x29c2e1[_0x9342('0x30')][_0x9342('0x51')]);}})[_0x9342('0x26')](respondWithStatusCode(_0x124f82,null))['catch'](handleError(_0x124f82,null));};exports[_0x9342('0x56')]=function(_0x5b5c64,_0x4bee49,_0xea74a4){if(_0x5b5c64[_0x9342('0x48')]['id']){delete _0x5b5c64[_0x9342('0x48')]['id'];}return db[_0x9342('0x2c')]['find']({'where':{'id':_0x5b5c64['params']['id']}})[_0x9342('0x26')](handleEntityNotFound(_0x4bee49,null))['then'](function(_0x25990b){if(_0x25990b){_0x5b5c64['body'][_0x9342('0x57')]=_0x25990b['id'];return db[_0x9342('0x4d')][_0x9342('0x58')](_0x5b5c64[_0x9342('0x48')]);}})[_0x9342('0x26')](respondWithResult(_0x4bee49,null))['catch'](handleError(_0x4bee49,null));};exports[_0x9342('0x59')]=function(_0x423893,_0x5996f0,_0x413d1e){var _0x18c538={};var _0x113fcf={};var _0x40127b;var _0x5ee995;return db[_0x9342('0x2c')][_0x9342('0x52')]({'where':{'id':_0x423893[_0x9342('0x44')]['id']}})[_0x9342('0x26')](handleEntityNotFound(_0x5996f0,null))[_0x9342('0x26')](function(_0x5e6042){if(_0x5e6042){_0x40127b=_0x5e6042;_0x113fcf[_0x9342('0x33')]=_[_0x9342('0x31')](db[_0x9342('0x4d')][_0x9342('0x2d')]);_0x113fcf[_0x9342('0x30')]=_[_0x9342('0x31')](_0x423893[_0x9342('0x30')]);_0x113fcf[_0x9342('0x32')]=_[_0x9342('0x35')](_0x113fcf[_0x9342('0x33')],_0x113fcf[_0x9342('0x30')]);_0x18c538[_0x9342('0x34')]=_[_0x9342('0x35')](_0x113fcf['model'],qs['fields'](_0x423893['query']['fields']));_0x18c538[_0x9342('0x34')]=_0x18c538['attributes']['length']?_0x18c538['attributes']:_0x113fcf[_0x9342('0x33')];_0x18c538[_0x9342('0x38')]=qs[_0x9342('0x39')](_0x423893[_0x9342('0x30')][_0x9342('0x39')]);_0x18c538[_0x9342('0x3c')]=qs[_0x9342('0x32')](_['pick'](_0x423893[_0x9342('0x30')],_0x113fcf[_0x9342('0x32')]));if(_0x423893[_0x9342('0x30')][_0x9342('0x3b')]){_0x18c538['where']=_[_0x9342('0x3d')](_0x18c538[_0x9342('0x3c')],{'$or':_[_0x9342('0x2f')](_0x18c538[_0x9342('0x34')],function(_0x23b573){var _0x55940e={};_0x55940e[_0x23b573]={'$like':'%'+_0x423893[_0x9342('0x30')][_0x9342('0x3b')]+'%'};return _0x55940e;})});}if(_0x423893[_0x9342('0x30')][_0x9342('0x5a')]){var _0xfbb27a=_0x423893[_0x9342('0x30')][_0x9342('0x5a')][_0x9342('0x5b')](',');var _0x51562d={};_0x51562d[_0xfbb27a[0x0]]={'$gte':moment(_0xfbb27a[0x1])[_0x9342('0x5c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x18c538['where']=_['merge'](_0x18c538['where'],_0x51562d);}_0x18c538=_[_0x9342('0x3d')]({},_0x18c538,_0x423893[_0x9342('0x40')]);return _0x40127b['getMessages'](_0x18c538);}})[_0x9342('0x26')](function(_0x3bac08){if(_0x3bac08){_0x5ee995=_0x3bac08[_0x9342('0x45')];if(!_0x423893[_0x9342('0x30')]['hasOwnProperty'](_0x9342('0x54'))){_0x18c538[_0x9342('0x1e')]=qs[_0x9342('0x1e')](_0x423893[_0x9342('0x30')][_0x9342('0x1e')]);_0x18c538[_0x9342('0x1d')]=qs[_0x9342('0x1d')](_0x423893[_0x9342('0x30')][_0x9342('0x1d')]);}return _0x40127b[_0x9342('0x59')](_0x18c538);}})[_0x9342('0x26')](function(_0xc61da1){if(_0xc61da1){return _0xc61da1?{'count':_0x5ee995,'rows':_0xc61da1}:null;}})['then'](respondWithResult(_0x5996f0,null))[_0x9342('0x49')](handleError(_0x5996f0,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index b007c9a..d61b7b0 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 _0x02c1=['save','update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0xc4ec02,_0x237ec6){var _0xed1192=function(_0x3e0427){while(--_0x3e0427){_0xc4ec02['push'](_0xc4ec02['shift']());}};_0xed1192(++_0x237ec6);}(_0x02c1,0xdf));var _0x102c=function(_0x3c7354,_0x4ff563){_0x3c7354=_0x3c7354-0x0;var _0x22cc09=_0x02c1[_0x3c7354];return _0x22cc09;};'use strict';var EventEmitter=require(_0x102c('0x0'));var ChatGroup=require('../../mysqldb')['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x102c('0x1')](0x0);var events={'afterCreate':_0x102c('0x2'),'afterUpdate':_0x102c('0x3'),'afterDestroy':_0x102c('0x4')};function emitEvent(_0x543a54){return function(_0x2e194e,_0x48501f,_0x20d2a0){ChatGroupEvents[_0x102c('0x5')](_0x543a54+':'+_0x2e194e['id'],_0x2e194e);ChatGroupEvents[_0x102c('0x5')](_0x543a54,_0x2e194e);_0x20d2a0(null);};}for(var e in events){if(events[_0x102c('0x6')](e)){var event=events[e];ChatGroup[_0x102c('0x7')](e,emitEvent(event));}}module[_0x102c('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x96bd=['emit','hasOwnProperty','hook','exports','events','ChatGroup','setMaxListeners','save','update','remove'];(function(_0x44a0e9,_0x959f63){var _0x3b8e8c=function(_0x11b3e1){while(--_0x11b3e1){_0x44a0e9['push'](_0x44a0e9['shift']());}};_0x3b8e8c(++_0x959f63);}(_0x96bd,0x112));var _0xd96b=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x96bd[_0x4a9fb1];return _0x348672;};'use strict';var EventEmitter=require(_0xd96b('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xd96b('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xd96b('0x2')](0x0);var events={'afterCreate':_0xd96b('0x3'),'afterUpdate':_0xd96b('0x4'),'afterDestroy':_0xd96b('0x5')};function emitEvent(_0x5acdce){return function(_0x25d57c,_0x5c6c7f,_0x241bd4){ChatGroupEvents[_0xd96b('0x6')](_0x5acdce+':'+_0x25d57c['id'],_0x25d57c);ChatGroupEvents[_0xd96b('0x6')](_0x5acdce,_0x25d57c);_0x241bd4(null);};}for(var e in events){if(events[_0xd96b('0x7')](e)){var event=events[e];ChatGroup[_0xd96b('0x8')](e,emitEvent(event));}}module[_0xd96b('0x9')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index b7c72c9..5d0bd7f 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 _0x2d8c=['ChatGroup','chat_groups','lodash','api','moment','bluebird','../../config/environment','./chatGroup.attributes','exports','define'];(function(_0x33f940,_0x426f44){var _0x38d865=function(_0x41c06f){while(--_0x41c06f){_0x33f940['push'](_0x33f940['shift']());}};_0x38d865(++_0x426f44);}(_0x2d8c,0x84));var _0xc2d8=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0x2d8c[_0x3e25c1];return _0x52e7f2;};'use strict';var _=require(_0xc2d8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc2d8('0x1'));var moment=require(_0xc2d8('0x2'));var BPromise=require(_0xc2d8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc2d8('0x4'));var attributes=require(_0xc2d8('0x5'));module[_0xc2d8('0x6')]=function(_0x290695,_0x11335f){return _0x290695[_0xc2d8('0x7')](_0xc2d8('0x8'),attributes,{'tableName':_0xc2d8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa016=['chat_groups','util','../../config/logger','api','bluebird','request-promise','rimraf','./chatGroup.attributes','exports','define'];(function(_0xa7e493,_0xd42fb0){var _0x5e1d36=function(_0x2b0761){while(--_0x2b0761){_0xa7e493['push'](_0xa7e493['shift']());}};_0x5e1d36(++_0xd42fb0);}(_0xa016,0x6f));var _0x6a01=function(_0x2943b8,_0x1077b0){_0x2943b8=_0x2943b8-0x0;var _0x3303bf=_0xa016[_0x2943b8];return _0x3303bf;};'use strict';var _=require('lodash');var util=require(_0x6a01('0x0'));var logger=require(_0x6a01('0x1'))(_0x6a01('0x2'));var moment=require('moment');var BPromise=require(_0x6a01('0x3'));var rp=require(_0x6a01('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a01('0x5'));var config=require('../../config/environment');var attributes=require(_0x6a01('0x6'));module[_0x6a01('0x7')]=function(_0x556408,_0x27c726){return _0x556408[_0x6a01('0x8')]('ChatGroup',attributes,{'tableName':_0x6a01('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 2ea10ce..8aab2af 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 _0xb0b9=['./chatGroup.socket','register','request','then','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','ChatGroup,\x20%s,\x20%s','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x1020b8,_0x12dc99){var _0xe32a5d=function(_0x5c4338){while(--_0x5c4338){_0x1020b8['push'](_0x1020b8['shift']());}};_0xe32a5d(++_0x12dc99);}(_0xb0b9,0x1f3));var _0x9b0b=function(_0xb39f48,_0x2bad8b){_0xb39f48=_0xb39f48-0x0;var _0x449457=_0xb0b9[_0xb39f48];return _0x449457;};'use strict';var _=require(_0x9b0b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9b0b('0x1'));var rs=require(_0x9b0b('0x2'));var fs=require('fs');var Redis=require(_0x9b0b('0x3'));var db=require(_0x9b0b('0x4'))['db'];var utils=require(_0x9b0b('0x5'));var logger=require(_0x9b0b('0x6'))(_0x9b0b('0x7'));var config=require(_0x9b0b('0x8'));var jayson=require(_0x9b0b('0x9'));var client=jayson[_0x9b0b('0xa')][_0x9b0b('0xb')]({'port':0x232a});config[_0x9b0b('0xc')]=_[_0x9b0b('0xd')](config[_0x9b0b('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9b0b('0xc')]));require(_0x9b0b('0xe'))[_0x9b0b('0xf')](socket);function respondWithRpcPromise(_0x2b0384,_0x2b0fd2,_0xc07d94){return new BPromise(function(_0x5713db,_0x426bc4){return client[_0x9b0b('0x10')](_0x2b0384,_0xc07d94)[_0x9b0b('0x11')](function(_0x40c06b){logger['info']('ChatGroup,\x20%s,\x20%s',_0x2b0fd2,_0x9b0b('0x12'));logger['debug'](_0x9b0b('0x13'),_0x2b0fd2,'request\x20sent',JSON[_0x9b0b('0x14')](_0x40c06b));if(_0x40c06b[_0x9b0b('0x15')]){if(_0x40c06b['error']['code']===0x1f4){logger[_0x9b0b('0x15')](_0x9b0b('0x16'),_0x2b0fd2,_0x40c06b[_0x9b0b('0x15')]['message']);return _0x426bc4(_0x40c06b[_0x9b0b('0x15')][_0x9b0b('0x17')]);}logger[_0x9b0b('0x15')](_0x9b0b('0x16'),_0x2b0fd2,_0x40c06b[_0x9b0b('0x15')][_0x9b0b('0x17')]);return _0x5713db(_0x40c06b[_0x9b0b('0x15')][_0x9b0b('0x17')]);}else{logger[_0x9b0b('0x18')](_0x9b0b('0x16'),_0x2b0fd2,_0x9b0b('0x12'));_0x5713db(_0x40c06b[_0x9b0b('0x19')][_0x9b0b('0x17')]);}})[_0x9b0b('0x1a')](function(_0x51277a){logger[_0x9b0b('0x15')](_0x9b0b('0x16'),_0x2b0fd2,_0x51277a);_0x426bc4(_0x51277a);});});} \ No newline at end of file +var _0x8255=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash'];(function(_0x286864,_0x85d92a){var _0x2c4792=function(_0x1e858e){while(--_0x1e858e){_0x286864['push'](_0x286864['shift']());}};_0x2c4792(++_0x85d92a);}(_0x8255,0x176));var _0x5825=function(_0x5b2006,_0x214057){_0x5b2006=_0x5b2006-0x0;var _0x57bb61=_0x8255[_0x5b2006];return _0x57bb61;};'use strict';var _=require(_0x5825('0x0'));var util=require(_0x5825('0x1'));var moment=require(_0x5825('0x2'));var BPromise=require(_0x5825('0x3'));var rs=require(_0x5825('0x4'));var fs=require('fs');var Redis=require(_0x5825('0x5'));var db=require(_0x5825('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5825('0x7'));var jayson=require(_0x5825('0x8'));var client=jayson[_0x5825('0x9')][_0x5825('0xa')]({'port':0x232a});config[_0x5825('0xb')]=_[_0x5825('0xc')](config[_0x5825('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5825('0xb')]));require(_0x5825('0xd'))[_0x5825('0xe')](socket);function respondWithRpcPromise(_0x5d71cd,_0x4c522a,_0x2e0eaa){return new BPromise(function(_0x3aeea8,_0x4f05fe){return client[_0x5825('0xf')](_0x5d71cd,_0x2e0eaa)[_0x5825('0x10')](function(_0x57c8fb){logger[_0x5825('0x11')](_0x5825('0x12'),_0x4c522a,_0x5825('0x13'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x4c522a,_0x5825('0x13'),JSON[_0x5825('0x14')](_0x57c8fb));if(_0x57c8fb[_0x5825('0x15')]){if(_0x57c8fb[_0x5825('0x15')]['code']===0x1f4){logger[_0x5825('0x15')]('ChatGroup,\x20%s,\x20%s',_0x4c522a,_0x57c8fb[_0x5825('0x15')][_0x5825('0x16')]);return _0x4f05fe(_0x57c8fb[_0x5825('0x15')][_0x5825('0x16')]);}logger[_0x5825('0x15')]('ChatGroup,\x20%s,\x20%s',_0x4c522a,_0x57c8fb['error'][_0x5825('0x16')]);return _0x3aeea8(_0x57c8fb[_0x5825('0x15')][_0x5825('0x16')]);}else{logger[_0x5825('0x11')]('ChatGroup,\x20%s,\x20%s',_0x4c522a,'request\x20sent');_0x3aeea8(_0x57c8fb[_0x5825('0x17')][_0x5825('0x16')]);}})[_0x5825('0x18')](function(_0x32df6d){logger['error'](_0x5825('0x12'),_0x4c522a,_0x32df6d);_0x4f05fe(_0x32df6d);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 2aa494f..7b94f37 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 _0xeab5=['emit','register','length','chatGroup:','./chatGroup.events','save','update'];(function(_0x243cca,_0x514c2d){var _0xf94771=function(_0x42d3de){while(--_0x42d3de){_0x243cca['push'](_0x243cca['shift']());}};_0xf94771(++_0x514c2d);}(_0xeab5,0xba));var _0x5eab=function(_0x14e624,_0x56d8d3){_0x14e624=_0x14e624-0x0;var _0x5ad09e=_0xeab5[_0x14e624];return _0x5ad09e;};'use strict';var ChatGroupEvents=require(_0x5eab('0x0'));var events=[_0x5eab('0x1'),'remove',_0x5eab('0x2')];function createListener(_0x3d7a86,_0x4754b8){return function(_0x57e991){_0x4754b8[_0x5eab('0x3')](_0x3d7a86,_0x57e991);};}function removeListener(_0x1b5ac3,_0x822530){return function(){ChatGroupEvents['removeListener'](_0x1b5ac3,_0x822530);};}exports[_0x5eab('0x4')]=function(_0x32a02e){for(var _0x32362e=0x0,_0x5e1368=events[_0x5eab('0x5')];_0x32362e<_0x5e1368;_0x32362e++){var _0x1c52e9=events[_0x32362e];var _0x4463e9=createListener(_0x5eab('0x6')+_0x1c52e9,_0x32a02e);ChatGroupEvents['on'](_0x1c52e9,_0x4463e9);}}; \ No newline at end of file +var _0x94af=['length','chatGroup:','./chatGroup.events','save','remove','update','emit','removeListener','register'];(function(_0x38de1b,_0x3df9e1){var _0xac5947=function(_0x373981){while(--_0x373981){_0x38de1b['push'](_0x38de1b['shift']());}};_0xac5947(++_0x3df9e1);}(_0x94af,0x1f1));var _0xf94a=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x94af[_0x38a7ac];return _0x53061a;};'use strict';var ChatGroupEvents=require(_0xf94a('0x0'));var events=[_0xf94a('0x1'),_0xf94a('0x2'),_0xf94a('0x3')];function createListener(_0x2f3aeb,_0x2a75d5){return function(_0x103ed0){_0x2a75d5[_0xf94a('0x4')](_0x2f3aeb,_0x103ed0);};}function removeListener(_0x15fe16,_0x595e63){return function(){ChatGroupEvents[_0xf94a('0x5')](_0x15fe16,_0x595e63);};}exports[_0xf94a('0x6')]=function(_0x592d5c){for(var _0x2d3c57=0x0,_0x2f01eb=events[_0xf94a('0x7')];_0x2d3c57<_0x2f01eb;_0x2d3c57++){var _0x2fc405=events[_0x2d3c57];var _0x452616=createListener(_0xf94a('0x8')+_0x2fc405,_0x592d5c);ChatGroupEvents['on'](_0x2fc405,_0x452616);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 974d8bf..b978224 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 _0xf43b=['/:id/members','getMembers','/:id/messages','getMessages','create','post','addMembers','addMessage','update','destroy','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','/:id/unread','getUnread'];(function(_0x5c7a79,_0x3ead47){var _0x475a1d=function(_0x564fa4){while(--_0x564fa4){_0x5c7a79['push'](_0x5c7a79['shift']());}};_0x475a1d(++_0x3ead47);}(_0xf43b,0x108));var _0xbf43=function(_0x2ba66e,_0x88b3ee){_0x2ba66e=_0x2ba66e-0x0;var _0x22283d=_0xf43b[_0x2ba66e];return _0x22283d;};'use strict';var multer=require('multer');var util=require(_0xbf43('0x0'));var path=require('path');var timeout=require(_0xbf43('0x1'));var express=require(_0xbf43('0x2'));var router=express[_0xbf43('0x3')]();var fs_extra=require(_0xbf43('0x4'));var auth=require(_0xbf43('0x5'));var interaction=require(_0xbf43('0x6'));var config=require(_0xbf43('0x7'));var controller=require('./chatGroup.controller');router[_0xbf43('0x8')]('/',auth['isAuthenticated'](),controller[_0xbf43('0x9')]);router[_0xbf43('0x8')]('/describe',auth[_0xbf43('0xa')](),controller[_0xbf43('0xb')]);router[_0xbf43('0x8')](_0xbf43('0xc'),auth[_0xbf43('0xa')](),controller[_0xbf43('0xd')]);router['get'](_0xbf43('0xe'),auth['isAuthenticated'](),controller[_0xbf43('0xf')]);router['get'](_0xbf43('0x10'),auth[_0xbf43('0xa')](),controller[_0xbf43('0x11')]);router[_0xbf43('0x8')](_0xbf43('0x12'),auth['isAuthenticated'](),controller[_0xbf43('0x13')]);router['post']('/',auth[_0xbf43('0xa')](),controller[_0xbf43('0x14')]);router[_0xbf43('0x15')](_0xbf43('0x10'),auth[_0xbf43('0xa')](),controller[_0xbf43('0x16')]);router['post'](_0xbf43('0x12'),auth[_0xbf43('0xa')](),controller[_0xbf43('0x17')]);router['put'](_0xbf43('0xc'),auth[_0xbf43('0xa')](),controller[_0xbf43('0x18')]);router['delete'](_0xbf43('0xc'),auth[_0xbf43('0xa')](),controller[_0xbf43('0x19')]);router[_0xbf43('0x1a')]('/:id/members',auth[_0xbf43('0xa')](),controller['removeMembers']);module[_0xbf43('0x1b')]=router; \ No newline at end of file +var _0x2b91=['getMessages','post','create','addMessage','put','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','/describe','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages'];(function(_0x1ed40e,_0x2aedc6){var _0x5ec065=function(_0x282b09){while(--_0x282b09){_0x1ed40e['push'](_0x1ed40e['shift']());}};_0x5ec065(++_0x2aedc6);}(_0x2b91,0xc0));var _0x12b9=function(_0x4f8881,_0x4e2e1b){_0x4f8881=_0x4f8881-0x0;var _0x5352fb=_0x2b91[_0x4f8881];return _0x5352fb;};'use strict';var multer=require(_0x12b9('0x0'));var util=require('util');var path=require(_0x12b9('0x1'));var timeout=require(_0x12b9('0x2'));var express=require(_0x12b9('0x3'));var router=express['Router']();var fs_extra=require(_0x12b9('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x12b9('0x5'));var controller=require('./chatGroup.controller');router[_0x12b9('0x6')]('/',auth[_0x12b9('0x7')](),controller['index']);router[_0x12b9('0x6')](_0x12b9('0x8'),auth[_0x12b9('0x7')](),controller['describe']);router[_0x12b9('0x6')](_0x12b9('0x9'),auth[_0x12b9('0x7')](),controller[_0x12b9('0xa')]);router[_0x12b9('0x6')](_0x12b9('0xb'),auth[_0x12b9('0x7')](),controller[_0x12b9('0xc')]);router[_0x12b9('0x6')](_0x12b9('0xd'),auth['isAuthenticated'](),controller['getMembers']);router[_0x12b9('0x6')](_0x12b9('0xe'),auth[_0x12b9('0x7')](),controller[_0x12b9('0xf')]);router[_0x12b9('0x10')]('/',auth[_0x12b9('0x7')](),controller[_0x12b9('0x11')]);router[_0x12b9('0x10')](_0x12b9('0xd'),auth[_0x12b9('0x7')](),controller['addMembers']);router[_0x12b9('0x10')](_0x12b9('0xe'),auth[_0x12b9('0x7')](),controller[_0x12b9('0x12')]);router[_0x12b9('0x13')](_0x12b9('0x9'),auth[_0x12b9('0x7')](),controller[_0x12b9('0x14')]);router[_0x12b9('0x15')]('/:id',auth[_0x12b9('0x7')](),controller['destroy']);router[_0x12b9('0x15')](_0x12b9('0xd'),auth['isAuthenticated'](),controller['removeMembers']);module[_0x12b9('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 7d6a2d8..62de4d5 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 _0x3264=['ENUM','star','STRING','DATE','TEXT','long','out','exports','BOOLEAN','INTEGER'];(function(_0x3efc48,_0x5b89b0){var _0x58cc0e=function(_0x16ad3a){while(--_0x16ad3a){_0x3efc48['push'](_0x3efc48['shift']());}};_0x58cc0e(++_0x5b89b0);}(_0x3264,0x7f));var _0x4326=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x3264[_0xdea41a];return _0x15d0d8;};'use strict';var Sequelize=require('sequelize');module[_0x4326('0x0')]={'closed':{'type':Sequelize[_0x4326('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x4326('0x2')]},'ratingType':{'type':Sequelize[_0x4326('0x3')]('star','thumb'),'defaultValue':_0x4326('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x4326('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x4326('0x6')]},'disposition':{'type':Sequelize[_0x4326('0x5')]},'secondDisposition':{'type':Sequelize[_0x4326('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x4326('0x5')]},'browserName':{'type':Sequelize[_0x4326('0x5')]},'browserVersion':{'type':Sequelize[_0x4326('0x5')]},'osName':{'type':Sequelize[_0x4326('0x5')]},'osVersion':{'type':Sequelize[_0x4326('0x5')]},'deviceModel':{'type':Sequelize[_0x4326('0x5')]},'deviceVendor':{'type':Sequelize[_0x4326('0x5')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x4326('0x5')]},'formData':{'type':Sequelize[_0x4326('0x7')](_0x4326('0x8'))},'read1stAt':{'type':Sequelize[_0x4326('0x6')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x4326('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x4326('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x4326('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0x4326('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xd71d=['out','sequelize','exports','BOOLEAN','INTEGER','ENUM','thumb','star','TEXT','STRING','DATE','long'];(function(_0x484afe,_0x4c43c9){var _0x4a6956=function(_0x40a910){while(--_0x40a910){_0x484afe['push'](_0x484afe['shift']());}};_0x4a6956(++_0x4c43c9);}(_0xd71d,0x1a5));var _0xdd71=function(_0x7791d5,_0xdab65f){_0x7791d5=_0x7791d5-0x0;var _0x5ce288=_0xd71d[_0x7791d5];return _0x5ce288;};'use strict';var Sequelize=require(_0xdd71('0x0'));module[_0xdd71('0x1')]={'closed':{'type':Sequelize[_0xdd71('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xdd71('0x3')]},'ratingType':{'type':Sequelize[_0xdd71('0x4')]('star',_0xdd71('0x5')),'defaultValue':_0xdd71('0x6')},'ratingMessage':{'type':Sequelize[_0xdd71('0x7')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xdd71('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xdd71('0x9')]},'disposition':{'type':Sequelize[_0xdd71('0x8')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xdd71('0x8')]},'note':{'type':Sequelize[_0xdd71('0x8')]},'browserName':{'type':Sequelize[_0xdd71('0x8')]},'browserVersion':{'type':Sequelize[_0xdd71('0x8')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xdd71('0x8')]},'deviceModel':{'type':Sequelize[_0xdd71('0x8')]},'deviceVendor':{'type':Sequelize[_0xdd71('0x8')]},'deviceType':{'type':Sequelize[_0xdd71('0x8')]},'referer':{'type':Sequelize[_0xdd71('0x7')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xdd71('0x7')](_0xdd71('0xa'))},'read1stAt':{'type':Sequelize[_0xdd71('0x9')]},'lastMsgAt':{'type':Sequelize[_0xdd71('0x9')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xdd71('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xdd71('0x8')]},'customerPort':{'type':Sequelize[_0xdd71('0x8')]},'vidaooSessionId':{'type':Sequelize[_0xdd71('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0xdd71('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 3d5f8fd..c7bcb55 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 _0xd0d6=['rawAttributes','type','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','sort','where','pick','select','field','color','from','tools_tags','u.id','ui.ChatInteractionId','left_join','chat_interactions','cm_contacts','users','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','value','having','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','role','agent','user','i.ChatWebsiteId\x20IS\x20NULL','ChatWebsiteId','sequelize','toString','keyBy','ChatInteraction','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','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','push','rows','show','params','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooTopic','vidaooMetadata','vidaooApiKey','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','metadata','ValidationError','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','join','root','offline-chat/','close','mailTranscript','format','transcript-%s.txt','pathTranscript','ChatMessage','Messages','agentAlias','customer','%s%d','agentIdentifier','website_alias','System','agent_alias','alias','agent_fullname','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','SendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','include','findAll','includeAgent','includeAll','addTags','setTags','ids','omit','spread','emit','chatInteractionTags:save','removeTags','download','unix','server','files','tmp','attachments','Contact','lastName','Account','Owner','get','mkdirSync','Chat','closedAt','browserName','osName','referer','customerPort','N.A.','createReadStream','pipe','renderFile','views','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','then','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','ChatInteraction,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','stack','name','send','render','merge','body','contact','account','Users','map','fullname','TagIds','Tags','split','forEach','talking','answered','unmanaged','abandoned','total','closed','UserId','waiting','disposition'];(function(_0x130775,_0x5e5169){var _0x56208f=function(_0x100c76){while(--_0x100c76){_0x130775['push'](_0x130775['shift']());}};_0x56208f(++_0x5e5169);}(_0xd0d6,0xdf));var _0x6d0d=function(_0x40fbbd,_0x116a6a){_0x40fbbd=_0x40fbbd-0x0;var _0x1c18d7=_0xd0d6[_0x40fbbd];return _0x1c18d7;};'use strict';var emlformat=require(_0x6d0d('0x0'));var rimraf=require(_0x6d0d('0x1'));var zipdir=require(_0x6d0d('0x2'));var jsonpatch=require(_0x6d0d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6d0d('0x4'));var Mustache=require('mustache');var util=require(_0x6d0d('0x5'));var path=require('path');var sox=require(_0x6d0d('0x6'));var csv=require(_0x6d0d('0x7'));var ejs=require(_0x6d0d('0x8'));var fs=require('fs');var fs_extra=require(_0x6d0d('0x9'));var _=require(_0x6d0d('0xa'));var squel=require(_0x6d0d('0xb'));var crypto=require('crypto');var jsforce=require(_0x6d0d('0xc'));var deskjs=require(_0x6d0d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6d0d('0xe'));var Papa=require(_0x6d0d('0xf'));var Redis=require(_0x6d0d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6d0d('0x11'));var as=require(_0x6d0d('0x12'));var pdf=require(_0x6d0d('0x13'));var hardwareService=require(_0x6d0d('0x14'));var logger=require('../../config/logger')(_0x6d0d('0x15'));var utils=require(_0x6d0d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6d0d('0x17'));var db=require('../../mysqldb')['db'];config[_0x6d0d('0x18')]=_[_0x6d0d('0x19')](config[_0x6d0d('0x18')],{'host':_0x6d0d('0x1a'),'port':0x18eb});var socket=require(_0x6d0d('0x1b'))(new Redis(config[_0x6d0d('0x18')]));require(_0x6d0d('0x1c'))[_0x6d0d('0x1d')](socket);var jayson=require(_0x6d0d('0x1e'));var client=jayson[_0x6d0d('0x1f')][_0x6d0d('0x20')]({'port':0x232b});var client9004=jayson[_0x6d0d('0x1f')][_0x6d0d('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x3b9a3b,_0x47b30f,_0x2f1aa2,_0x2e6d0c){return new BPromise(function(_0x5dfbd0,_0x1a1a84){var _0x120b5c=_0x2e6d0c||client;return _0x120b5c['request'](_0x3b9a3b,_0x2f1aa2)[_0x6d0d('0x21')](function(_0x2a3e70){logger[_0x6d0d('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x47b30f,_0x6d0d('0x23'));logger['debug'](_0x6d0d('0x24'),_0x47b30f,_0x6d0d('0x23'),JSON[_0x6d0d('0x25')](_0x2a3e70));if(_0x2a3e70[_0x6d0d('0x26')]){if(_0x2a3e70['error']['code']===0x1f4){logger['error'](_0x6d0d('0x27'),_0x47b30f,_0x2a3e70[_0x6d0d('0x26')][_0x6d0d('0x28')]);return _0x1a1a84(_0x2a3e70[_0x6d0d('0x26')][_0x6d0d('0x28')]);}logger[_0x6d0d('0x26')](_0x6d0d('0x27'),_0x47b30f,_0x2a3e70[_0x6d0d('0x26')][_0x6d0d('0x28')]);return _0x5dfbd0(_0x2a3e70['error'][_0x6d0d('0x28')]);}else{logger['info'](_0x6d0d('0x27'),_0x47b30f,_0x6d0d('0x23'));_0x5dfbd0(_0x2a3e70[_0x6d0d('0x29')][_0x6d0d('0x28')]);}})[_0x6d0d('0x2a')](function(_0x4ca151){logger[_0x6d0d('0x26')](_0x6d0d('0x27'),_0x47b30f,_0x4ca151);_0x1a1a84(_0x4ca151);});});}function respondWithStatusCode(_0xcb5aa3,_0xc5d44d){_0xc5d44d=_0xc5d44d||0xcc;return function(_0x2a1065){if(_0x2a1065){return _0xcb5aa3[_0x6d0d('0x2b')](_0xc5d44d);}return _0xcb5aa3[_0x6d0d('0x2c')](_0xc5d44d)[_0x6d0d('0x2d')]();};}function respondWithResult(_0x96b4f8,_0x56c25f){_0x56c25f=_0x56c25f||0xc8;return function(_0x415520){if(_0x415520){return _0x96b4f8[_0x6d0d('0x2c')](_0x56c25f)[_0x6d0d('0x2e')](_0x415520);}};}function respondWithFilteredResult(_0x2969fa,_0x42e3ef){return function(_0x1fab06){if(_0x1fab06){var _0x25058b=typeof _0x42e3ef[_0x6d0d('0x2f')]===_0x6d0d('0x30')&&typeof _0x42e3ef[_0x6d0d('0x31')]===_0x6d0d('0x30');var _0x5b4766=_0x1fab06['count'];var _0x5eebe7=_0x25058b?0x0:_0x42e3ef[_0x6d0d('0x2f')];var _0x80dfcd=_0x25058b?_0x1fab06[_0x6d0d('0x32')]:_0x42e3ef[_0x6d0d('0x2f')]+_0x42e3ef[_0x6d0d('0x31')];var _0x498b38;if(_0x80dfcd>=_0x5b4766){_0x80dfcd=_0x5b4766;_0x498b38=0xc8;}else{_0x498b38=0xce;}_0x2969fa[_0x6d0d('0x2c')](_0x498b38);return _0x2969fa[_0x6d0d('0x33')]('Content-Range',_0x5eebe7+'-'+_0x80dfcd+'/'+_0x5b4766)['json'](_0x1fab06);}return null;};}function patchUpdates(_0x499bde){return function(_0x446925){try{jsonpatch[_0x6d0d('0x34')](_0x446925,_0x499bde,!![]);}catch(_0x3df2f8){return BPromise[_0x6d0d('0x35')](_0x3df2f8);}return _0x446925[_0x6d0d('0x36')]();};}function saveUpdates(_0x24186a,_0x3ea45e){return function(_0x26a317){if(_0x26a317){return _0x26a317[_0x6d0d('0x37')](_0x24186a)[_0x6d0d('0x21')](function(_0x2acdb3){return _0x2acdb3;});}return null;};}function removeEntity(_0x5c40cd,_0x54fb31){return function(_0x7222bc){if(_0x7222bc){return _0x7222bc[_0x6d0d('0x38')]()[_0x6d0d('0x21')](function(){_0x5c40cd['status'](0xcc)[_0x6d0d('0x2d')]();});}};}function handleEntityNotFound(_0x283d56,_0x1369dd){return function(_0x3b3b1c){if(!_0x3b3b1c){_0x283d56[_0x6d0d('0x2b')](0x194);}return _0x3b3b1c;};}function handleError(_0x3d2b9a,_0x5231ba){_0x5231ba=_0x5231ba||0x1f4;return function(_0x581921){logger['error'](_0x581921[_0x6d0d('0x39')]);if(_0x581921[_0x6d0d('0x3a')]){delete _0x581921[_0x6d0d('0x3a')];}_0x3d2b9a[_0x6d0d('0x2c')](_0x5231ba)[_0x6d0d('0x3b')](_0x581921);};}function getMustacheRender(_0x192c5c,_0x3c58f9){return Mustache[_0x6d0d('0x3c')](_0x192c5c,_[_0x6d0d('0x3d')](_0x3c58f9[_0x6d0d('0x3e')],{'contact':_0x3c58f9[_0x6d0d('0x3f')],'message':_0x3c58f9[_0x6d0d('0x28')],'agent':_0x3c58f9['agent'],'interaction':_0x3c58f9['interaction'],'account':_0x3c58f9[_0x6d0d('0x40')]}))||'';}function getInteractionUsers(_0x357d5d,_0x234cc6){return new BPromise(function(_0x55a105,_0x42273c){try{if(_0x234cc6[_0x357d5d['id']]){_0x357d5d[_0x6d0d('0x41')]=_[_0x6d0d('0x42')](_0x234cc6[_0x357d5d['id']],function(_0x23d3a7){return{'id':_0x23d3a7['id'],'fullname':_0x23d3a7[_0x6d0d('0x43')]};});}}catch(_0x3d913e){_0x42273c(_0x3d913e);}_0x55a105(_0x357d5d);});}function getInteractionTags(_0x586834,_0x48f387){return new BPromise(function(_0x577069,_0x32e2d6){try{if(_0x586834[_0x6d0d('0x44')]){_0x586834[_0x6d0d('0x45')]=[];_0x586834[_0x6d0d('0x44')][_0x6d0d('0x46')](',')[_0x6d0d('0x47')](function(_0x12e973){_0x586834[_0x6d0d('0x45')]['push'](_0x48f387[_0x12e973]);});}delete _0x586834[_0x6d0d('0x44')];}catch(_0x54f0fa){_0x32e2d6(_0x54f0fa);}_0x577069(_0x586834);});}function updateChatInteraction(_0x21b5e2,_0x97dad0,_0x203ecd){return new BPromise(function(_0x4b6ebd,_0x44d6d9){return getInteractionUsers(_0x21b5e2,_0x203ecd)[_0x6d0d('0x21')](function(_0x3efccf){return getInteractionTags(_0x3efccf,_0x97dad0);})[_0x6d0d('0x21')](function(_0x3ed73d){return getStateInteraction(_0x3ed73d);})[_0x6d0d('0x21')](function(_0x3b9d98){_0x4b6ebd(_0x3b9d98);})[_0x6d0d('0x2a')](function(_0x4c13c0){_0x44d6d9(_0x4c13c0);});});}function getStateInteraction(_0x3bdd3a){return new BPromise(function(_0x1ad327){_0x3bdd3a['waiting']=0x0;_0x3bdd3a[_0x6d0d('0x48')]=0x0;_0x3bdd3a[_0x6d0d('0x49')]=0x0;_0x3bdd3a[_0x6d0d('0x4a')]=0x0;_0x3bdd3a[_0x6d0d('0x4b')]=0x0;_0x3bdd3a[_0x6d0d('0x4c')]=0x0;if(!_0x3bdd3a[_0x6d0d('0x4d')]&&!_0x3bdd3a[_0x6d0d('0x4e')]){_0x3bdd3a[_0x6d0d('0x4f')]+=0x1;}if(!_0x3bdd3a[_0x6d0d('0x4d')]&&_0x3bdd3a[_0x6d0d('0x4e')]){_0x3bdd3a[_0x6d0d('0x48')]+=0x1;if(_0x3bdd3a['waiting']){_0x3bdd3a[_0x6d0d('0x4f')]-=0x1;}}if(_0x3bdd3a[_0x6d0d('0x4d')]&&_0x3bdd3a[_0x6d0d('0x50')]===_0x6d0d('0x4b')){_0x3bdd3a[_0x6d0d('0x4b')]+=0x1;if(_0x3bdd3a[_0x6d0d('0x4f')]){_0x3bdd3a[_0x6d0d('0x4f')]-=0x1;}}else if(_0x3bdd3a[_0x6d0d('0x4d')]&&!_0x3bdd3a[_0x6d0d('0x4e')]&&_0x3bdd3a[_0x6d0d('0x50')]){_0x3bdd3a['unmanaged']+=0x1;if(_0x3bdd3a[_0x6d0d('0x4f')]){_0x3bdd3a[_0x6d0d('0x4f')]-=0x1;}}else if(_0x3bdd3a['closed']&&_0x3bdd3a[_0x6d0d('0x4e')]){_0x3bdd3a[_0x6d0d('0x49')]+=0x1;if(_0x3bdd3a['talking']){_0x3bdd3a[_0x6d0d('0x48')]-=0x1;}}_0x3bdd3a[_0x6d0d('0x4c')]+=0x1;_0x1ad327(_0x3bdd3a);});}exports['index']=function(_0x16e75f,_0x451c2b){var _0x310f64={},_0x3169e3={},_0x128c59={'count':0x0,'rows':[]};var _0x44b7fc=_['map'](db['ChatInteraction'][_0x6d0d('0x51')],function(_0x1766e1){return{'name':_0x1766e1['fieldName'],'type':_0x1766e1[_0x6d0d('0x52')]['key']};});_0x3169e3[_0x6d0d('0x53')]=_['map'](_0x44b7fc,_0x6d0d('0x3a'));_0x3169e3['query']=_[_0x6d0d('0x54')](_0x16e75f['query']);_0x3169e3[_0x6d0d('0x55')]=_[_0x6d0d('0x56')](_0x3169e3[_0x6d0d('0x53')],_0x3169e3['query']);_0x310f64[_0x6d0d('0x57')]=_[_0x6d0d('0x56')](_0x3169e3[_0x6d0d('0x53')],qs[_0x6d0d('0x58')](_0x16e75f[_0x6d0d('0x59')][_0x6d0d('0x58')]));_0x310f64['attributes']=_0x310f64[_0x6d0d('0x57')][_0x6d0d('0x5a')]?_0x310f64[_0x6d0d('0x57')]:_0x3169e3[_0x6d0d('0x53')];if(!_0x16e75f[_0x6d0d('0x59')][_0x6d0d('0x5b')]('nolimit')){_0x310f64[_0x6d0d('0x31')]=qs['limit'](_0x16e75f[_0x6d0d('0x59')]['limit']);_0x310f64[_0x6d0d('0x2f')]=qs[_0x6d0d('0x2f')](_0x16e75f['query'][_0x6d0d('0x2f')]);}_0x310f64['order']=qs[_0x6d0d('0x5c')](_0x16e75f[_0x6d0d('0x59')][_0x6d0d('0x5c')]);_0x310f64[_0x6d0d('0x5d')]=qs['filters'](_[_0x6d0d('0x5e')](_0x16e75f[_0x6d0d('0x59')],_0x3169e3['filters']),_0x44b7fc);var _0x1465d9=[];var _0x36ddb0=squel[_0x6d0d('0x5f')]()[_0x6d0d('0x60')]('id')[_0x6d0d('0x60')]('name')[_0x6d0d('0x60')](_0x6d0d('0x61'))[_0x6d0d('0x62')](_0x6d0d('0x63'));var _0x2a916b=squel[_0x6d0d('0x5f')]()[_0x6d0d('0x60')](_0x6d0d('0x64'))[_0x6d0d('0x60')]('u.fullname')[_0x6d0d('0x60')](_0x6d0d('0x65'))[_0x6d0d('0x62')]('user_has_chat_interactions','ui')[_0x6d0d('0x66')]('users','u','u.id\x20=\x20ui.UserId');var _0x56e6d4=squel[_0x6d0d('0x5f')]()[_0x6d0d('0x62')](_0x6d0d('0x67'),'i')[_0x6d0d('0x66')](_0x6d0d('0x68'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x6d0d('0x66')](_0x6d0d('0x69'),'o','o.id\x20=\x20i.UserId')[_0x6d0d('0x66')]('chat_websites','a','a.id\x20=\x20i.ChatWebsiteId')[_0x6d0d('0x66')]('chat_messages','me','me.ChatInteractionId\x20=\x20i.id')['left_join'](_0x6d0d('0x6a'),'it',_0x6d0d('0x6b'))['left_join'](_0x6d0d('0x63'),'t','t.id\x20=\x20it.TagId');var _0x12b947=squel[_0x6d0d('0x6c')]();var _0x2b6ee2=[];var _0x5bbafe=squel[_0x6d0d('0x6c')]();var _0x281293;if(_0x16e75f['query'][_0x6d0d('0x6d')]){_0x281293=as[_0x6d0d('0x6e')](_0x16e75f[_0x6d0d('0x59')][_0x6d0d('0x6d')]);var _0x56574b=_0x281293[_0x6d0d('0x6f')];for(var _0x2e0748=0x0;_0x2e0748<_0x281293[_0x6d0d('0x70')][_0x6d0d('0x5a')];_0x2e0748++){var _0x27179d=_0x281293[_0x6d0d('0x70')][_0x2e0748];var _0x59b7d1='i';var _0x1e1909=_[_0x6d0d('0x71')](_0x44b7fc,[_0x6d0d('0x3a'),_0x27179d[_0x6d0d('0x60')]]);if(!_0x1e1909){switch(_0x27179d[_0x6d0d('0x60')]){case'unreadMessages':if(_0x27179d[_0x6d0d('0x72')]==0x1){_0x56e6d4[_0x6d0d('0x73')]('`'+_0x27179d['field']+'`\x20=\x200');}else{_0x56e6d4[_0x6d0d('0x73')]('`'+_0x27179d[_0x6d0d('0x60')]+'`\x20>\x200');}break;case'Contact':if(_0x27179d[_0x6d0d('0x74')]===_0x6d0d('0x75')){if(_0x27179d[_0x6d0d('0x72')]['split']('\x20')['length']>0x1){_0x12b947[_0x56574b](_0x6d0d('0x76'),qs['getFullTextValue'](_0x27179d['value']),null);}else{var _0x346131='%'+_0x27179d[_0x6d0d('0x72')]+'%';_0x12b947[_0x56574b](_0x6d0d('0x77'),_0x346131,_0x346131,_0x346131);}}else{_0x1e1909=_[_0x6d0d('0x71')](_0x44b7fc,[_0x6d0d('0x3a'),_0x6d0d('0x78')]);_0x27179d['field']='ContactId';_0xff5709=as['buildExpression'](_0x59b7d1,_0x1e1909[_0x6d0d('0x52')],_0x27179d);_0x12b947[_0x56574b](_0xff5709[_0x6d0d('0x79')],_0xff5709[_0x6d0d('0x72')][_0x6d0d('0x7a')],_0xff5709[_0x6d0d('0x72')]['end']);}break;case _0x6d0d('0x7b'):var _0x96de4d=_0x27179d[_0x6d0d('0x72')]['split'](',')[_0x6d0d('0x42')](function(_0x46652f){return Number(_0x46652f);});_0x96de4d['forEach'](function(_0x14edef){_0x5bbafe['or'](_0x6d0d('0x7c'),'%,'+_0x14edef+',%');});_0x2b6ee2=_['union'](_0x2b6ee2,_0x96de4d);break;case _0x6d0d('0x7d'):if(_0x27179d[_0x6d0d('0x74')]===_0x6d0d('0x75')){_0x12b947[_0x56574b](_0x6d0d('0x7e'),'%'+_0x27179d[_0x6d0d('0x72')]+'%',null);}else{_0x1e1909=_[_0x6d0d('0x71')](_0x44b7fc,[_0x6d0d('0x3a'),_0x6d0d('0x4e')]);_0x27179d[_0x6d0d('0x60')]='UserId';_0xff5709=as['buildExpression'](_0x59b7d1,_0x1e1909[_0x6d0d('0x52')],_0x27179d);_0x12b947[_0x56574b](_0xff5709[_0x6d0d('0x79')],_0xff5709[_0x6d0d('0x72')]['start'],_0xff5709[_0x6d0d('0x72')][_0x6d0d('0x2d')]);}break;case _0x6d0d('0x3e'):_0xff5709=as['buildExpression']('me',null,_0x27179d);_0x12b947[_0x56574b](_0xff5709['text'],_0xff5709[_0x6d0d('0x72')][_0x6d0d('0x7a')],_0xff5709[_0x6d0d('0x72')][_0x6d0d('0x2d')]);break;}}else{var _0xff5709=as['buildExpression'](_0x59b7d1,_0x1e1909[_0x6d0d('0x52')],_0x27179d);_0x12b947[_0x56574b](_0xff5709[_0x6d0d('0x79')],_0xff5709[_0x6d0d('0x72')][_0x6d0d('0x7a')],_0xff5709[_0x6d0d('0x72')][_0x6d0d('0x2d')]);}}}else{var _0x3935c9=_(_0x16e75f[_0x6d0d('0x59')])['keys']()[_0x6d0d('0x42')](function(_0x24e99b){return _[_0x6d0d('0x7f')](_0x44b7fc,['name',_0x24e99b])?_0x24e99b:undefined;})['compact']()['value']();if(!_['isEmpty'](_0x3935c9)){_0x3935c9[_0x6d0d('0x47')](function(_0x5aca87){if(_0x5aca87==='ChatWebsiteId'){_0x56e6d4['where'](_0x6d0d('0x80'),[]['concat'](_0x16e75f[_0x6d0d('0x59')][_0x5aca87]));}else if(_0x5aca87===_0x6d0d('0x81')){var _0x51a99b=JSON[_0x6d0d('0x82')](_0x16e75f['query'][_0x5aca87])[_0x6d0d('0x83')];var _0x598d36=JSON[_0x6d0d('0x82')](_0x16e75f[_0x6d0d('0x59')][_0x5aca87])['$lte'];_0x56e6d4[_0x6d0d('0x5d')](_0x6d0d('0x84'),_0x51a99b,_0x598d36);}else{if(_0x16e75f['query'][_0x5aca87]===_0x6d0d('0x85')){_0x56e6d4[_0x6d0d('0x5d')]('i.'+_0x5aca87+_0x6d0d('0x86'));}else{_0x56e6d4[_0x6d0d('0x5d')]('i.'+_0x5aca87+_0x6d0d('0x87'),_0x16e75f[_0x6d0d('0x59')][_0x5aca87]);}}});}if(_0x16e75f['query'][_0x6d0d('0x88')]){if(_0x16e75f[_0x6d0d('0x59')]['read']==0x1){_0x56e6d4['having'](_0x6d0d('0x89'));}else{_0x56e6d4['having']('`unreadMessages`\x20>\x200');}}if(_0x16e75f[_0x6d0d('0x59')][_0x6d0d('0x8a')]){_0x2b6ee2=_[_0x6d0d('0x8b')](_0x16e75f[_0x6d0d('0x59')][_0x6d0d('0x8a')])?_0x16e75f['query'][_0x6d0d('0x8a')]:new Array(_0x16e75f['query'][_0x6d0d('0x8a')]);_0x2b6ee2['forEach'](function(_0x2d1e8d){_0x5bbafe['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2d1e8d+',%');});}if(_0x16e75f[_0x6d0d('0x59')][_0x6d0d('0x8c')]){var _0x69241b=_0x16e75f['query'][_0x6d0d('0x8c')]['replace']('\x5c','\x5c\x5c')[_0x6d0d('0x8d')](/'/g,'\x27\x27');if(qs[_0x6d0d('0x8e')](_0x69241b)){_0x12b947['or'](_0x6d0d('0x8f'),_0x69241b+'%');}else{_0x12b947['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x69241b))['or'](_0x6d0d('0x90'),_0x69241b+'%');}}}_0x56e6d4[_0x6d0d('0x5d')](_0x12b947);_0x56e6d4['group'](_0x6d0d('0x91'));var _0xe08c52={'type':db[_0x6d0d('0x92')][_0x6d0d('0x93')][_0x6d0d('0x94')],'raw':!![]};var _0xb628bf=_0x56e6d4['clone']();_0xb628bf[_0x6d0d('0x60')](_0x6d0d('0x91'));_0xb628bf['field'](_0x6d0d('0x95'),_0x6d0d('0x96'));if(_0x310f64['order']){_0x310f64[_0x6d0d('0x97')][_0x6d0d('0x47')](function(_0x1f25a5){var _0x5583f1=_0x1f25a5[0x0]===_0x6d0d('0x98')?_0x1f25a5[0x0]:'i.'+_0x1f25a5[0x0];_0x56e6d4[_0x6d0d('0x97')](_0x5583f1,_0x1f25a5[0x1]===_0x6d0d('0x99')?![]:!![]);});}if(!_[_0x6d0d('0x9a')](_0x2b6ee2)){_0x56e6d4['having'](_0x5bbafe);_0xb628bf[_0x6d0d('0x5d')](_0x6d0d('0x9b'),_0x2b6ee2);}BPromise[_0x6d0d('0x9c')]()[_0x6d0d('0x21')](function(){if(!_0x281293){if(_0x16e75f[_0x6d0d('0x59')]['ChatWebsiteId'])return;_0xb628bf[_0x6d0d('0x5d')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x56e6d4[_0x6d0d('0x5d')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x16e75f['user'][_0x6d0d('0x9d')]!==_0x6d0d('0x9e'))return;return _0x16e75f[_0x6d0d('0x9f')]['getChatWebsites']({'attributes':['id'],'raw':!![]})['then'](function(_0x2c5cda){if(_['isEmpty'](_0x2c5cda)){_0xb628bf[_0x6d0d('0x5d')](_0x6d0d('0xa0'));_0x56e6d4[_0x6d0d('0x5d')](_0x6d0d('0xa0'));}else{_0xb628bf['where']('i.ChatWebsiteId\x20IN\x20?',_[_0x6d0d('0x42')](_0x2c5cda,'id'));_0x56e6d4[_0x6d0d('0x5d')](_0x6d0d('0x80'),_[_0x6d0d('0x42')](_0x2c5cda,'id'));}});})[_0x6d0d('0x21')](function(){if(_0x16e75f['user'][_0x6d0d('0x9d')]===_0x6d0d('0x9e')&&!_0x281293&&!_0x16e75f[_0x6d0d('0x59')][_0x6d0d('0xa1')])return[];return db[_0x6d0d('0xa2')]['query'](_0xb628bf[_0x6d0d('0xa3')](),_0xe08c52);})[_0x6d0d('0x21')](function(_0x219652){_0x128c59['count']=_0x219652['length'];if(_0x128c59[_0x6d0d('0x32')]===0x0)return[];return db['sequelize'][_0x6d0d('0x59')](_0x36ddb0[_0x6d0d('0xa3')](),_0xe08c52)[_0x6d0d('0x21')](function(_0x40c67f){_0x1465d9=_[_0x6d0d('0xa4')](_0x40c67f,'id');_0xe08c52=_[_0x6d0d('0x3d')](_0xe08c52,{'model':db[_0x6d0d('0xa5')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x16e75f[_0x6d0d('0x59')][_0x6d0d('0x58')]){_0x310f64[_0x6d0d('0x57')][_0x6d0d('0x47')](function(_0x216ec9){_0x56e6d4[_0x6d0d('0x60')]('i.'+_0x216ec9);});}else{_0x56e6d4[_0x6d0d('0x60')](_0x6d0d('0x95'),_0x6d0d('0x96'));_0x56e6d4[_0x6d0d('0x60')](_0x6d0d('0xa6'),_0x6d0d('0xa7'));_0x56e6d4[_0x6d0d('0x60')](_0x6d0d('0xa8'),_0x6d0d('0xa9'));_0x56e6d4[_0x6d0d('0x60')](_0x6d0d('0xaa'),_0x6d0d('0x98'));_0x56e6d4['field'](_0x6d0d('0xab'));_0x56e6d4[_0x6d0d('0x60')](_0x6d0d('0xac'),_0x6d0d('0xad'));_0x56e6d4['field'](_0x6d0d('0xae'),_0x6d0d('0xaf'));_0x56e6d4[_0x6d0d('0x60')](_0x6d0d('0xb0'),_0x6d0d('0xb1'));_0x56e6d4[_0x6d0d('0x60')](_0x6d0d('0xb2'),_0x6d0d('0xb3'));_0x56e6d4[_0x6d0d('0x60')](_0x6d0d('0xb4'),_0x6d0d('0xb5'));_0x56e6d4[_0x6d0d('0x60')]('c.fax',_0x6d0d('0xb6'));_0x56e6d4[_0x6d0d('0x60')](_0x6d0d('0xb7'),_0x6d0d('0xb8'));_0x56e6d4['field']('o.internal',_0x6d0d('0xb9'));_0x56e6d4['field'](_0x6d0d('0xba'),_0x6d0d('0x44'));}if(_0x310f64[_0x6d0d('0x31')])_0x56e6d4['limit'](_0x310f64[_0x6d0d('0x31')]);if(_0x310f64[_0x6d0d('0x2f')])_0x56e6d4[_0x6d0d('0x2f')](_0x310f64[_0x6d0d('0x2f')]);return db[_0x6d0d('0xa2')][_0x6d0d('0x59')](_0x56e6d4['toString'](),_0xe08c52);})[_0x6d0d('0x21')](function(_0x589dad){if(_0x589dad[_0x6d0d('0x5a')]>0x0)_0x2a916b[_0x6d0d('0x5d')]('ui.ChatInteractionId\x20IN\x20?',_[_0x6d0d('0x42')](_0x589dad,'id'));return db[_0x6d0d('0xa2')][_0x6d0d('0x59')](_0x2a916b[_0x6d0d('0xa3')](),_0xe08c52)[_0x6d0d('0x21')](function(_0xe03721){var _0x29a48d=_[_0x6d0d('0xbb')](_0xe03721,'ChatInteractionId');var _0x51b1eb=[];_0x589dad[_0x6d0d('0x47')](function(_0x5c42ef){_0x51b1eb[_0x6d0d('0xbc')](updateChatInteraction(_0x5c42ef,_0x1465d9,_0x29a48d));});return BPromise['all'](_0x51b1eb);});});})[_0x6d0d('0x21')](function(_0x4babd2){_0x128c59[_0x6d0d('0xbd')]=_0x4babd2;return _0x128c59;})[_0x6d0d('0x21')](respondWithFilteredResult(_0x451c2b,_0x310f64))[_0x6d0d('0x2a')](handleError(_0x451c2b,null));};exports[_0x6d0d('0xbe')]=function(_0x3e3243,_0x4d3bc6){var _0x54970a={'raw':![],'where':{'id':_0x3e3243[_0x6d0d('0xbf')]['id']}},_0x59f757={};_0x59f757[_0x6d0d('0x53')]=_[_0x6d0d('0x54')](db[_0x6d0d('0xa5')]['rawAttributes']);_0x59f757['query']=_[_0x6d0d('0x54')](_0x3e3243[_0x6d0d('0x59')]);_0x59f757['filters']=_[_0x6d0d('0x56')](_0x59f757['model'],_0x59f757[_0x6d0d('0x59')]);_0x54970a[_0x6d0d('0x57')]=_[_0x6d0d('0x56')](_0x59f757[_0x6d0d('0x53')],qs[_0x6d0d('0x58')](_0x3e3243[_0x6d0d('0x59')][_0x6d0d('0x58')]));_0x54970a[_0x6d0d('0x57')]=_0x54970a[_0x6d0d('0x57')][_0x6d0d('0x5a')]?_0x54970a[_0x6d0d('0x57')]:_0x59f757[_0x6d0d('0x53')];if(_0x3e3243[_0x6d0d('0x59')]['includeAll']){_0x54970a['include']=[{'all':!![]}];}_0x54970a=_[_0x6d0d('0x3d')]({},_0x54970a,_0x3e3243[_0x6d0d('0xc0')]);return db[_0x6d0d('0xa5')][_0x6d0d('0x71')](_0x54970a)[_0x6d0d('0x21')](handleEntityNotFound(_0x4d3bc6,null))[_0x6d0d('0x21')](respondWithResult(_0x4d3bc6,null))[_0x6d0d('0x2a')](handleError(_0x4d3bc6,null));};exports[_0x6d0d('0xc1')]=function(_0x58cf21,_0x5f5d3f){return db[_0x6d0d('0xa5')][_0x6d0d('0xc1')](_0x58cf21[_0x6d0d('0x3e')],{})[_0x6d0d('0x21')](respondWithResult(_0x5f5d3f,0xc9))[_0x6d0d('0x2a')](handleError(_0x5f5d3f,null));};exports['update']=function(_0x4fc76c,_0x3b8c8a){if(_0x4fc76c[_0x6d0d('0x3e')]['id']){delete _0x4fc76c['body']['id'];}return db[_0x6d0d('0xa5')]['find']({'where':{'id':_0x4fc76c[_0x6d0d('0xbf')]['id']}})[_0x6d0d('0x21')](handleEntityNotFound(_0x3b8c8a,null))[_0x6d0d('0x21')](saveUpdates(_0x4fc76c[_0x6d0d('0x3e')],null))['then'](respondWithResult(_0x3b8c8a,null))['catch'](handleError(_0x3b8c8a,null));};exports[_0x6d0d('0x38')]=function(_0xe7e084,_0x4a1e18){return db[_0x6d0d('0xa5')][_0x6d0d('0x71')]({'where':{'id':_0xe7e084[_0x6d0d('0xbf')]['id']}})[_0x6d0d('0x21')](handleEntityNotFound(_0x4a1e18,null))[_0x6d0d('0x21')](removeEntity(_0x4a1e18,null))[_0x6d0d('0x2a')](handleError(_0x4a1e18,null));};exports['describe']=function(_0x1e09ff,_0x1ac19f){return db['ChatInteraction'][_0x6d0d('0xc2')]()[_0x6d0d('0x21')](respondWithResult(_0x1ac19f,null))[_0x6d0d('0x2a')](handleError(_0x1ac19f,null));};exports[_0x6d0d('0xc3')]=function(_0x42cc2b,_0x57218b){var _0x2ea738=_0x42cc2b['params']['id'];var _0x4e0484;var _0x58740b;var _0x3929a0;return db[_0x6d0d('0xa5')][_0x6d0d('0xc4')]({'where':{'id':_0x2ea738}})['then'](function(_0x49202b){_0x4e0484=_0x49202b;return db[_0x6d0d('0xc5')][_0x6d0d('0xc4')]({'where':{'id':_0x49202b[_0x6d0d('0xa1')]},'attributes':['id','vidaooApiKey','vidaooEscalation',_0x6d0d('0xc6'),'vidaooNote',_0x6d0d('0xc7')],'raw':!![]});})[_0x6d0d('0x21')](function(_0x5f3ec7){if(_0x5f3ec7&&_0x5f3ec7[_0x6d0d('0xc8')]&&_0x5f3ec7['vidaooEscalation']){_0x58740b=_0x5f3ec7;var _0x5a1dd7={'interaction':{'id':_0x2ea738},'agent':{'id':_0x42cc2b[_0x6d0d('0x9f')]['id'],'name':_0x42cc2b[_0x6d0d('0x9f')][_0x6d0d('0x3a')],'fullname':_0x42cc2b['user'][_0x6d0d('0x43')],'email':_0x42cc2b[_0x6d0d('0x9f')][_0x6d0d('0xc9')]},'contact':_0x42cc2b[_0x6d0d('0x3e')]['contact'],'account':_0x42cc2b[_0x6d0d('0x3e')][_0x6d0d('0x40')]};var _0x4e4eca={'rejectUnauthorized':![],'method':_0x6d0d('0xca'),'url':_0x6d0d('0xcb'),'headers':{'X-APIKEY':_0x5f3ec7[_0x6d0d('0xc8')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x42cc2b['user'][_0x6d0d('0xc9')]],'buttons':null,'topic':_0x58740b[_0x6d0d('0xc6')],'note':_[_0x6d0d('0xcc')](_0x58740b['vidaooNote'])?null:getMustacheRender(_0x58740b[_0x6d0d('0xcd')],_0x5a1dd7),'metadata':null},'redirect':_0x6d0d('0xce'),'json':!![]};try{if(!_[_0x6d0d('0xcc')](_0x58740b[_0x6d0d('0xc7')])){var _0x4d6afc=getMustacheRender(_0x58740b[_0x6d0d('0xc7')],_0x5a1dd7);var _0x310866=JSON[_0x6d0d('0x82')](_0x4d6afc);_0x4e4eca['body'][_0x6d0d('0xcf')]=_0x310866;}}catch(_0x463843){throw new db['Sequelize'][(_0x6d0d('0xd0'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x4e4eca);}else{throw new db[(_0x6d0d('0x92'))][(_0x6d0d('0xd0'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x6d0d('0x21')](function(_0x42b46b){_0x3929a0=_0x42b46b;if(_0x3929a0['id']){var _0x8df417={'body':_0x3929a0[_0x6d0d('0xd1')],'ChatWebsiteId':_0x58740b['id'],'ChatInteractionId':_0x4e0484['id'],'direction':_0x6d0d('0xd2'),'UserId':_0x42cc2b[_0x6d0d('0x9f')]['id']};return db['ChatMessage'][_0x6d0d('0xc1')](_0x8df417,{});}else{throw new db[(_0x6d0d('0x92'))][(_0x6d0d('0xd0'))](_0x6d0d('0xd3'));}})['then'](function(){return _0x4e0484[_0x6d0d('0xd4')]({'vidaooSessionId':_0x3929a0['id']});})[_0x6d0d('0x21')](respondWithResult(_0x57218b,null))[_0x6d0d('0x2a')](handleError(_0x57218b,null));};exports['customUpdate']=function(_0x381bef,_0x23b5da){if(_0x381bef[_0x6d0d('0x3e')]['id']){delete _0x381bef['body']['id'];}return db[_0x6d0d('0xa5')][_0x6d0d('0x71')]({'where':{'id':_0x381bef[_0x6d0d('0xbf')]['id']},'include':[{'model':db[_0x6d0d('0xd5')],'as':'Contact'}]})[_0x6d0d('0x21')](handleEntityNotFound(_0x23b5da,null))[_0x6d0d('0x21')](saveUpdates(_0x381bef[_0x6d0d('0x3e')],null))['then'](respondWithResult(_0x23b5da,null))[_0x6d0d('0x2a')](handleError(_0x23b5da,null));};exports[_0x6d0d('0xd6')]=function(_0x1a99c6,_0x20a3b4,_0x20e1ec){if(_0x1a99c6[_0x6d0d('0x3e')]['id']){delete _0x1a99c6[_0x6d0d('0x3e')]['id'];}return db[_0x6d0d('0xa5')][_0x6d0d('0x71')]({'where':{'id':_0x1a99c6['params']['id']}})[_0x6d0d('0x21')](function(_0x30807b){if(!_0x30807b){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x6d0d('0xd6'),0x194,_0x6d0d('0xd7'));_0x20a3b4[_0x6d0d('0x2b')](0x194);}else{if(_0x30807b[_0x6d0d('0x4e')]){throw new db[(_0x6d0d('0x92'))][(_0x6d0d('0xd0'))](_0x6d0d('0xd8'));}}return _0x30807b;})[_0x6d0d('0x21')](function(_0x26610d){if(_0x26610d){return _0x26610d[_0x6d0d('0x37')]({'closed':_0x1a99c6[_0x6d0d('0x3e')][_0x6d0d('0x4d')],'disposition':_0x1a99c6[_0x6d0d('0x3e')][_0x6d0d('0x50')]})[_0x6d0d('0x21')](function(_0x366bf){return _0x366bf;});}})[_0x6d0d('0x21')](function(_0x420bf6){return respondWithRpcPromise(_0x6d0d('0xd9'),_0x6d0d('0xd6'),_0x1a99c6[_0x6d0d('0x3e')],client9004);})[_0x6d0d('0x21')](respondWithResult(_0x20a3b4,null))[_0x6d0d('0x2a')](handleError(_0x20a3b4,null));};exports['attachmentUpload']=function(_0x25e242,_0x5ca6e2,_0x49f445){_0x25e242[_0x6d0d('0x3e')][_0x6d0d('0x3a')]=_0x25e242[_0x6d0d('0xda')][_0x6d0d('0xdb')];_0x25e242[_0x6d0d('0x3e')][_0x6d0d('0xdc')]=_0x25e242['file'][_0x6d0d('0xdd')];_0x25e242[_0x6d0d('0x3e')]['type']=_0x25e242[_0x6d0d('0xda')][_0x6d0d('0xde')];return db[_0x6d0d('0xdf')]['create'](_0x25e242[_0x6d0d('0x3e')])[_0x6d0d('0x21')](respondWithResult(_0x5ca6e2,0xc9))[_0x6d0d('0x2a')](handleError(_0x5ca6e2,null));};exports[_0x6d0d('0xe0')]=function(_0x5d3e08,_0xacd0b9,_0x4d02b3){return db['ChatInteraction']['findOne']({'where':{'id':_0x5d3e08[_0x6d0d('0xbf')]['id']},'raw':!![]})[_0x6d0d('0x21')](handleEntityNotFound(_0xacd0b9,null))['then'](function(_0x4a607c){if(_0x4a607c){if(_0x4a607c[_0x6d0d('0x4d')]){return _0xacd0b9[_0x6d0d('0x2c')](0x193)[_0x6d0d('0x2e')]({'status':0x193,'message':_0x6d0d('0xe1')});}return db[_0x6d0d('0xdf')]['findOne']({'where':{'id':_0x5d3e08['query'][_0x6d0d('0xe2')]},'raw':!![]})[_0x6d0d('0x21')](handleEntityNotFound(_0xacd0b9,null));}})[_0x6d0d('0x21')](function(_0x323c9d){if(_0x323c9d){var _0x30b8c1=_0x323c9d['ChatOfflineMessageId']!==null;var _0x36bcf=path[_0x6d0d('0xe3')](config[_0x6d0d('0xe4')],'server/files/attachments/');if(_0x30b8c1){_0x36bcf=path['join'](_0x36bcf,_0x6d0d('0xe5'));}var _0x391abf=path[_0x6d0d('0xe3')](_0x36bcf,_0x323c9d[_0x6d0d('0xdc')]);return _0xacd0b9['download'](_0x391abf);}})[_0x6d0d('0x2a')](handleError(_0xacd0b9,null));};exports[_0x6d0d('0xe6')]=function(_0x4bca19,_0x304e99){var _0x3a95ea=null;var _0xa661f6=null;var _0x363300=null;var _0x13e0e0=null;if(_0x4bca19[_0x6d0d('0x3e')]['id']){delete _0x4bca19[_0x6d0d('0x3e')]['id'];}if(_0x4bca19[_0x6d0d('0x3e')][_0x6d0d('0xe7')]){_0x13e0e0=path[_0x6d0d('0xe3')](config[_0x6d0d('0xe4')],'server/files/chat/upload/',util[_0x6d0d('0xe8')](_0x6d0d('0xe9'),Date['now']()));_0x4bca19['body'][_0x6d0d('0xea')]=_0x13e0e0;}return db[_0x6d0d('0xa5')]['find']({'where':{'id':_0x4bca19[_0x6d0d('0xbf')]['id']},'include':[{'model':db[_0x6d0d('0xeb')],'as':_0x6d0d('0xec'),'include':[{'model':db[_0x6d0d('0x7d')],'as':_0x6d0d('0x7d')}]}]})[_0x6d0d('0x21')](handleEntityNotFound(_0x304e99,null))['then'](saveUpdates(_0x4bca19[_0x6d0d('0x3e')],null))[_0x6d0d('0x21')](function(_0x3b1fb2){if(_0x3b1fb2){_0x3a95ea=_0x3b1fb2;return db[_0x6d0d('0xc5')][_0x6d0d('0x71')]({'where':{'id':_0x3a95ea[_0x6d0d('0xa1')]}});}})['then'](function(_0x5d7ca7){if(_0x5d7ca7){_0x363300=_0x5d7ca7;return db[_0x6d0d('0xd5')]['find']({'where':{'id':_0x3a95ea[_0x6d0d('0x78')]}});}})['then'](function(_0x2dbd2e){if(_0x2dbd2e){_0xa661f6=_0x2dbd2e;if(_0x13e0e0){var _0x69006c=null;for(var _0x2e4ea5=0x1;_0x2e4ea5<_0x3a95ea[_0x6d0d('0xec')]['length'];++_0x2e4ea5){_0x69006c=_0x3a95ea[_0x6d0d('0xec')][_0x2e4ea5];var _0x326541=_0x69006c[_0x6d0d('0x4e')]?util[_0x6d0d('0xe8')]('%s%d',_0x363300[_0x6d0d('0xed')],_0x69006c['UserId']):'System';var _0xa958ee=_0x4bca19['body'][_0x6d0d('0xee')]||util[_0x6d0d('0xe8')](_0x6d0d('0xef'),'Visitor',_0x69006c['ContactId']);switch(_0x363300[_0x6d0d('0xf0')]){case _0x6d0d('0xf1'):_0x326541=_0x69006c[_0x6d0d('0x4e')]?util[_0x6d0d('0xe8')](_0x6d0d('0xef'),_0x363300[_0x6d0d('0xed')],_0x69006c['UserId']):_0x6d0d('0xf2');break;case _0x6d0d('0xf3'):_0x326541=_0x69006c[_0x6d0d('0x4e')]?_0x69006c[_0x6d0d('0x7d')][_0x6d0d('0xf4')]||_0x69006c['User']['fullname']:_0x6d0d('0xf2');break;case _0x6d0d('0xf5'):_0x326541=_0x69006c['UserId']?_0x69006c['User'][_0x6d0d('0x43')]:_0x6d0d('0xf2');break;default:_0x326541=_0x69006c[_0x6d0d('0x4e')]?util[_0x6d0d('0xe8')](_0x6d0d('0xef'),_0x363300[_0x6d0d('0xed')],_0x69006c[_0x6d0d('0x4e')]):'System';}var _0x27fdeb=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x69006c[_0x6d0d('0x81')])[_0x6d0d('0xe8')]('MM/DD/YYYY\x20HH:mm:ss'),_0x69006c[_0x6d0d('0xf6')]==='in'?_0xa958ee:_0x326541,_0x69006c[_0x6d0d('0x3e')]);if(!_0x69006c[_0x6d0d('0xf7')]){fs[_0x6d0d('0xf8')](_0x13e0e0,_0x27fdeb);}}return db[_0x6d0d('0xf9')][_0x6d0d('0xc4')]({'where':{'service':!![]},'include':[{'model':db[_0x6d0d('0xfa')],'as':_0x6d0d('0xfb'),'raw':!![]}]});}}})[_0x6d0d('0x21')](function(_0x93293){if(_0x93293&&_0x93293[_0x6d0d('0xfb')]&&_0x4bca19[_0x6d0d('0x3e')]){var _0x2a833f={'tls':{'rejectUnauthorized':![]}};if(_0x93293['Smtp']['service']){_0x2a833f[_0x6d0d('0xfc')]=_0x93293[_0x6d0d('0xfb')][_0x6d0d('0xfc')];}else{_0x2a833f['host']=_0x93293[_0x6d0d('0xfb')][_0x6d0d('0xfd')];_0x2a833f[_0x6d0d('0xfe')]=_0x93293[_0x6d0d('0xfb')][_0x6d0d('0xfe')];_0x2a833f[_0x6d0d('0xff')]=_0x93293[_0x6d0d('0xfb')]['secure'];}if(_0x93293[_0x6d0d('0xfb')][_0x6d0d('0x100')]){_0x2a833f[_0x6d0d('0x101')]={'user':_0x93293[_0x6d0d('0xfb')][_0x6d0d('0x9f')],'pass':_0x93293[_0x6d0d('0xfb')]['pass']};}return respondWithRpcPromise(_0x6d0d('0x102'),'sendMail',{'account':_0x2a833f,'message':{'from':util[_0x6d0d('0xe8')](_0x6d0d('0x103'),_0x93293[_0x6d0d('0x3a')],_0x93293[_0x6d0d('0xc9')]||_0x93293['Smtp'][_0x6d0d('0x9f')]),'to':_0x4bca19[_0x6d0d('0x3e')][_0x6d0d('0xe7')],'subject':'Mail\x20Transcript','text':util[_0x6d0d('0xe8')](_0x6d0d('0x104'),_0x4bca19[_0x6d0d('0x3e')][_0x6d0d('0xe7')]),'attachments':[{'path':_0x13e0e0}]}})[_0x6d0d('0x21')](function(){return _0x3a95ea;})['catch'](function(_0x38dd83){console['error'](_0x38dd83);});}else{return _0x3a95ea;}})[_0x6d0d('0x21')](respondWithStatusCode(_0x304e99,0xc8))[_0x6d0d('0x2a')](handleError(_0x304e99,null));};exports[_0x6d0d('0x105')]=function(_0x59a2c4,_0x19114c,_0x47da18){return db['ChatMessage'][_0x6d0d('0x71')]({'where':{'id':_0x59a2c4[_0x6d0d('0xbf')]['id']}})[_0x6d0d('0x21')](handleEntityNotFound(_0x19114c,null))['then'](function(_0xc2554c){if(_0xc2554c){return _0xc2554c[_0x6d0d('0x105')](_0x59a2c4[_0x6d0d('0x3e')]['ids'],_['omit'](_0x59a2c4['body'],['ids','id'])||{});}})[_0x6d0d('0x21')](respondWithResult(_0x19114c,null))[_0x6d0d('0x2a')](handleError(_0x19114c,null));};exports['getMessages']=function(_0x114feb,_0x2bd76f,_0x3d00b4){var _0x2adec4={'raw':![],'where':{}};var _0x589a60={};var _0x4360ed={'count':0x0,'rows':[]};return db[_0x6d0d('0xa5')][_0x6d0d('0xc4')]({'where':{'id':_0x114feb['params']['id']}})[_0x6d0d('0x21')](handleEntityNotFound(_0x2bd76f,null))['then'](function(_0x2528b0){if(_0x2528b0){_0x589a60[_0x6d0d('0x53')]=_['keys'](db[_0x6d0d('0xeb')][_0x6d0d('0x51')]);_0x589a60[_0x6d0d('0x59')]=_['keys'](_0x114feb[_0x6d0d('0x59')]);_0x589a60[_0x6d0d('0x55')]=_['intersection'](_0x589a60[_0x6d0d('0x53')],_0x589a60[_0x6d0d('0x59')]);_0x2adec4[_0x6d0d('0x57')]=_[_0x6d0d('0x56')](_0x589a60['model'],qs[_0x6d0d('0x58')](_0x114feb[_0x6d0d('0x59')][_0x6d0d('0x58')]));_0x2adec4['attributes']=_0x2adec4[_0x6d0d('0x57')][_0x6d0d('0x5a')]?_0x2adec4['attributes']:_0x589a60[_0x6d0d('0x53')];if(!_0x114feb[_0x6d0d('0x59')][_0x6d0d('0x5b')]('nolimit')){_0x2adec4[_0x6d0d('0x31')]=qs['limit'](_0x114feb[_0x6d0d('0x59')][_0x6d0d('0x31')]);_0x2adec4[_0x6d0d('0x2f')]=qs[_0x6d0d('0x2f')](_0x114feb['query'][_0x6d0d('0x2f')]);}_0x2adec4[_0x6d0d('0x97')]=qs[_0x6d0d('0x5c')](_0x114feb['query'][_0x6d0d('0x5c')]);_0x2adec4[_0x6d0d('0x5d')]=qs['filters'](_[_0x6d0d('0x5e')](_0x114feb[_0x6d0d('0x59')],_0x589a60[_0x6d0d('0x55')]));_0x2adec4[_0x6d0d('0x5d')][_0x6d0d('0x106')]=_0x2528b0['id'];if(_0x114feb[_0x6d0d('0x59')][_0x6d0d('0x8c')]){_0x2adec4[_0x6d0d('0x5d')]=_[_0x6d0d('0x3d')](_0x2adec4[_0x6d0d('0x5d')],{'$or':_[_0x6d0d('0x42')](_0x2adec4[_0x6d0d('0x57')],function(_0x5d0d24){var _0x179246={};_0x179246[_0x5d0d24]={'$like':'%'+_0x114feb['query'][_0x6d0d('0x8c')]+'%'};return _0x179246;})});}if(_0x114feb[_0x6d0d('0x59')][_0x6d0d('0x83')]){var _0x2f0514=_0x114feb['query'][_0x6d0d('0x83')][_0x6d0d('0x46')](',');var _0x148b14={};_0x148b14[_0x2f0514[0x0]]={'$gte':moment(_0x2f0514[0x1])[_0x6d0d('0xe8')](_0x6d0d('0x107'))};_0x2adec4[_0x6d0d('0x5d')]=_[_0x6d0d('0x3d')](_0x2adec4[_0x6d0d('0x5d')],_0x148b14);}_0x2adec4=_[_0x6d0d('0x3d')]({},_0x2adec4,_0x114feb[_0x6d0d('0xc0')]);return db[_0x6d0d('0xeb')][_0x6d0d('0x32')]({'where':_0x2adec4['where']})['then'](function(_0x690604){_0x4360ed[_0x6d0d('0x32')]=_0x690604;if(_0x114feb[_0x6d0d('0x59')]['includeAll']){_0x2adec4[_0x6d0d('0x108')]=[{'all':!![]}];}return db[_0x6d0d('0xeb')][_0x6d0d('0x109')](_0x2adec4);})[_0x6d0d('0x21')](function(_0x5b3117){_0x4360ed[_0x6d0d('0xbd')]=_0x5b3117;return _0x4360ed;});}})['then'](respondWithFilteredResult(_0x2bd76f,_0x2adec4))[_0x6d0d('0x2a')](handleError(_0x2bd76f,null));};exports['getMyMessages']=function(_0x49bdc5,_0x1176b2,_0x506828){var _0x13e228={'where':{}},_0x3121d2={},_0x4a7dd3={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x6d0d('0xc4')]({'where':{'id':_0x49bdc5[_0x6d0d('0xbf')]['id']}})[_0x6d0d('0x21')](handleEntityNotFound(_0x1176b2,null))['then'](function(_0x2ea9cd){if(_0x2ea9cd){_0x3121d2[_0x6d0d('0x53')]=_[_0x6d0d('0x54')](db[_0x6d0d('0xeb')]['rawAttributes']);_0x3121d2[_0x6d0d('0x59')]=_['keys'](_0x49bdc5[_0x6d0d('0x59')]);_0x3121d2[_0x6d0d('0x55')]=_[_0x6d0d('0x56')](_0x3121d2[_0x6d0d('0x53')],_0x3121d2[_0x6d0d('0x59')]);_0x13e228['attributes']=_[_0x6d0d('0x56')](_0x3121d2['model'],qs['fields'](_0x49bdc5[_0x6d0d('0x59')][_0x6d0d('0x58')]));_0x13e228[_0x6d0d('0x57')]=_0x13e228['attributes'][_0x6d0d('0x5a')]?_0x13e228[_0x6d0d('0x57')]:_0x3121d2[_0x6d0d('0x53')];if(!_0x49bdc5['query']['hasOwnProperty']('nolimit')){_0x13e228[_0x6d0d('0x31')]=qs[_0x6d0d('0x31')](_0x49bdc5['query'][_0x6d0d('0x31')]);_0x13e228[_0x6d0d('0x2f')]=qs[_0x6d0d('0x2f')](_0x49bdc5['query'][_0x6d0d('0x2f')]);}_0x13e228[_0x6d0d('0x97')]=qs[_0x6d0d('0x5c')](_0x49bdc5['query'][_0x6d0d('0x5c')]);_0x13e228['where']=qs['filters'](_[_0x6d0d('0x5e')](_0x49bdc5['query'],_0x3121d2['filters']));_0x13e228['where'][_0x6d0d('0x106')]=_0x2ea9cd['id'];if(_0x49bdc5[_0x6d0d('0x59')][_0x6d0d('0x8c')]){_0x13e228['where']=_[_0x6d0d('0x3d')](_0x13e228[_0x6d0d('0x5d')],{'$or':_[_0x6d0d('0x42')](_0x13e228[_0x6d0d('0x57')],function(_0x297444){var _0x20a7e7={};_0x20a7e7[_0x297444]={'$like':'%'+_0x49bdc5['query'][_0x6d0d('0x8c')]+'%'};return _0x20a7e7;})});}_0x13e228[_0x6d0d('0x5d')][_0x6d0d('0xf7')]=![];if(_0x49bdc5[_0x6d0d('0x59')]['id']){_0x13e228[_0x6d0d('0x5d')]['id']={'$gt':_0x49bdc5[_0x6d0d('0x59')]['id']};}_0x13e228=_[_0x6d0d('0x3d')]({},_0x13e228,_0x49bdc5[_0x6d0d('0xc0')]);return db[_0x6d0d('0xeb')][_0x6d0d('0x32')]({'where':_0x13e228[_0x6d0d('0x5d')]})[_0x6d0d('0x21')](function(_0x3f642a){_0x4a7dd3['count']=_0x3f642a;_0x13e228[_0x6d0d('0x108')]=[];if(_0x49bdc5[_0x6d0d('0x59')][_0x6d0d('0x10a')]){_0x13e228[_0x6d0d('0x108')]['push']({'model':db['User'],'as':_0x6d0d('0x7d'),'attributes':['id',_0x6d0d('0x43'),_0x6d0d('0xf4')]});}if(_0x49bdc5[_0x6d0d('0x59')][_0x6d0d('0x10b')]){_0x13e228[_0x6d0d('0x108')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x13e228);})[_0x6d0d('0x21')](function(_0x12a3c5){_0x4a7dd3[_0x6d0d('0xbd')]=_0x12a3c5;return _0x4a7dd3;});}})[_0x6d0d('0x21')](respondWithFilteredResult(_0x1176b2,_0x13e228))[_0x6d0d('0x2a')](handleError(_0x1176b2,null));};exports[_0x6d0d('0x10c')]=function(_0x154c2e,_0x238dad,_0x7dd0cd){return db['ChatInteraction'][_0x6d0d('0x71')]({'where':{'id':_0x154c2e['params']['id']}})[_0x6d0d('0x21')](handleEntityNotFound(_0x238dad,null))[_0x6d0d('0x21')](function(_0x2caacc){if(_0x2caacc){return _0x2caacc[_0x6d0d('0x10d')](_0x154c2e['body'][_0x6d0d('0x10e')],_[_0x6d0d('0x10f')](_0x154c2e['body'],[_0x6d0d('0x10e'),'id'])||{})[_0x6d0d('0x110')](function(){return db[_0x6d0d('0x7b')][_0x6d0d('0x109')]({'attributes':['id',_0x6d0d('0x3a'),'color'],'where':{'id':_0x154c2e[_0x6d0d('0x3e')][_0x6d0d('0x10e')]}});})[_0x6d0d('0x21')](function(_0xb873ad){socket[_0x6d0d('0x111')](_0x6d0d('0x112'),{'id':Number(_0x154c2e[_0x6d0d('0xbf')]['id']),'tags':_0xb873ad||[]});return{'id':Number(_0x154c2e['params']['id']),'tags':_0xb873ad||[]};});}})[_0x6d0d('0x21')](respondWithResult(_0x238dad,null))[_0x6d0d('0x2a')](handleError(_0x238dad,null));};exports[_0x6d0d('0x113')]=function(_0x368790,_0x5babfa,_0x4a5bd7){return db[_0x6d0d('0xa5')]['find']({'where':{'id':_0x368790[_0x6d0d('0xbf')]['id']}})[_0x6d0d('0x21')](handleEntityNotFound(_0x5babfa,null))[_0x6d0d('0x21')](function(_0x21be9e){if(_0x21be9e){return _0x21be9e[_0x6d0d('0x113')](_0x368790['query'][_0x6d0d('0x10e')]);}})[_0x6d0d('0x21')](respondWithStatusCode(_0x5babfa,null))[_0x6d0d('0x2a')](handleError(_0x5babfa,null));};exports[_0x6d0d('0x114')]=function(_0x1fa93c,_0xdf1423){var _0x380623=moment()[_0x6d0d('0x115')]()[_0x6d0d('0xa3')]();var _0x82668a=path[_0x6d0d('0xe3')](config['root'],_0x6d0d('0x116'),_0x6d0d('0x117'),_0x6d0d('0x118'));var _0x856b65=path[_0x6d0d('0xe3')](config[_0x6d0d('0xe4')],_0x6d0d('0x116'),_0x6d0d('0x117'),_0x6d0d('0x119'));var _0xe637eb=path['join'](_0x82668a,_0x380623);var _0x539297=util[_0x6d0d('0xe8')]('transcript-%d-%s.zip',_0x1fa93c[_0x6d0d('0xbf')]['id'],_0x380623);var _0x3b7d56=path['join'](_0x82668a,_0x539297);var _0x465091=[];_0x465091[_0x6d0d('0xbc')]({'model':db[_0x6d0d('0x7d')],'as':_0x6d0d('0x7d'),'attributes':['id','fullname'],'raw':!![]});_0x465091['push']({'model':db[_0x6d0d('0xd5')],'as':_0x6d0d('0x11a'),'attributes':['id','firstName',_0x6d0d('0x11b')],'raw':!![]});if(_0x1fa93c['query']['attachments']){_0x465091[_0x6d0d('0xbc')]({'model':db['Attachment'],'as':_0x6d0d('0xdf'),'raw':!![]});}var _0x51f5fd=[{'model':db[_0x6d0d('0xeb')],'as':_0x6d0d('0xec'),'attributes':['id','body',_0x6d0d('0x81'),_0x6d0d('0xf6'),_0x6d0d('0xf7'),_0x6d0d('0x88')],'include':_0x465091}];_0x51f5fd[_0x6d0d('0xbc')]({'model':db[_0x6d0d('0xc5')],'as':_0x6d0d('0x11c'),'attributes':['id',_0x6d0d('0x3a')]});_0x51f5fd[_0x6d0d('0xbc')]({'model':db[_0x6d0d('0x7d')],'as':_0x6d0d('0x11d'),'attributes':['id',_0x6d0d('0x43')]});return db['ChatInteraction'][_0x6d0d('0x71')]({'where':{'id':_0x1fa93c['params']['id']},'include':_0x51f5fd})[_0x6d0d('0x21')](handleEntityNotFound(_0xdf1423,null))['then'](function(_0x30f814){if(_0x30f814){var _0x46224c=_0x30f814[_0x6d0d('0x11e')]({'plain':!![]});fs[_0x6d0d('0x11f')](_0xe637eb);var _0x3a7e9b={'channel':_0x6d0d('0x120'),'account':_0x46224c[_0x6d0d('0x11c')][_0x6d0d('0x3a')],'agent':_0x46224c[_0x6d0d('0x11d')]?_0x46224c[_0x6d0d('0x11d')]['fullname']:'N.A.','createdAt':moment(_0x46224c[_0x6d0d('0x81')])['format'](_0x6d0d('0x107'))['toString'](),'closedAt':_0x46224c['closed']?moment(_0x46224c[_0x6d0d('0x121')])['format'](_0x6d0d('0x107'))[_0x6d0d('0xa3')]():'','disposition':_0x46224c[_0x6d0d('0x50')],'chatInfo':{'browser':_0x46224c[_0x6d0d('0x122')],'os':_0x46224c[_0x6d0d('0x123')],'referer':_0x46224c[_0x6d0d('0x124')],'customerIp':_0x46224c['customerIp'],'customerPort':_0x46224c[_0x6d0d('0x125')]?_0x46224c[_0x6d0d('0x125')]:_0x6d0d('0x126')},'messages':_(_0x46224c[_0x6d0d('0xec')])['tail']()[_0x6d0d('0x8c')]({'secret':![]})[_0x6d0d('0x42')](function(_0x236ba6){if(_0x236ba6['Attachment']){var _0x55b3c0=path[_0x6d0d('0xe3')](_0x856b65,_0x236ba6[_0x6d0d('0xdf')][_0x6d0d('0xdc')]);if(fs['existsSync'](_0x55b3c0)){fs[_0x6d0d('0x127')](_0x55b3c0)[_0x6d0d('0x128')](fs['createWriteStream'](path[_0x6d0d('0xe3')](_0xe637eb,_0x236ba6['Attachment']['basename'])));}}return{'date':moment(_0x236ba6[_0x6d0d('0x81')])[_0x6d0d('0xe8')](_0x6d0d('0x107'))[_0x6d0d('0xa3')](),'sender':_0x236ba6[_0x6d0d('0xf6')]===_0x6d0d('0xd2')?_0x236ba6[_0x6d0d('0x7d')]?_0x236ba6['User'][_0x6d0d('0x43')]:_0x6d0d('0xf2'):_0x236ba6[_0x6d0d('0x11a')]['firstName']+(_0x236ba6[_0x6d0d('0x11a')][_0x6d0d('0x11b')]?'\x20'+_0x236ba6[_0x6d0d('0x11a')]['lastName']:''),'body':_0x236ba6[_0x6d0d('0xdf')]?_0x236ba6[_0x6d0d('0xdf')][_0x6d0d('0xdc')]:_0x236ba6['body'],'direction':_0x236ba6[_0x6d0d('0xf6')]==='out'?'A':'C','secret':_0x236ba6[_0x6d0d('0xf7')],'read':_0x236ba6['read'],'attachment':_0x236ba6[_0x6d0d('0xdf')]};})[_0x6d0d('0x72')]()};return ejs[_0x6d0d('0x129')](path[_0x6d0d('0xe3')](config[_0x6d0d('0xe4')],_0x6d0d('0x116'),_0x6d0d('0x12a'),'downloadInteraction.ejs'),{'interaction':_0x3a7e9b})[_0x6d0d('0x21')](function(_0x2d00d0){var _0x2ac886=path[_0x6d0d('0xe3')](_0xe637eb,_0x6d0d('0x12b')+_0x46224c['id']+'-'+_0x380623+_0x6d0d('0x12c'));var _0x486d8f={'path':_0x2ac886,'channel':_0x6d0d('0x120'),'interactionId':_0x46224c['id']};return pdf['createPdfFromHTML'](_0x2d00d0,_0x486d8f);})['then'](function(){return new BPromise(function(_0x5331ed,_0x44330e){zipdir(_0xe637eb,{'saveTo':_0x3b7d56},function(_0x4b05a2,_0x2904b8){if(_0x4b05a2)return _0x44330e(_0x4b05a2);return _0x5331ed(_0x2904b8);});})[_0x6d0d('0x21')](function(){return new BPromise(function(_0x2aa582,_0x390bc2){rimraf(_0xe637eb,function(_0x53e004){if(_0x53e004)_0x390bc2(_0x53e004);return _0x2aa582();});});})['then'](function(){return _0xdf1423[_0x6d0d('0x114')](_0x3b7d56,_0x539297,function(_0x45d6a5){if(_0x45d6a5){console[_0x6d0d('0x12d')](_0x6d0d('0x12e'),_0x45d6a5);}else{fs[_0x6d0d('0x12f')](_0x3b7d56);}});});});}else{return _0xdf1423[_0x6d0d('0x2b')](0xc8);}})['catch'](handleError(_0xdf1423,null));}; \ No newline at end of file +var _0x6579=['union','start','body','some','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','replace','isNumeric','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.lastName','c.phone','Contact.phone','c.fax','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','push','all','params','include','create','describe','createVidaooSession','ChatWebsite','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','account','isNull','vidaooNote','parse','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','updateAttributes','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','originalname','file','filename','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','User','%s%d','customer','Visitor','agentIdentifier','website_alias','agentAlias','System','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','findAll','includeAgent','rows','addTags','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','files','server','attachments','transcript-%d-%s.zip','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','browserName','referer','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','eml-format','fast-json-patch','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','stack','name','send','render','contact','agent','Users','map','fullname','Tags','TagIds','split','forEach','waiting','talking','answered','unmanaged','abandoned','total','closed','disposition','UserId','index','ChatInteraction','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?'];(function(_0x431ae1,_0x385f06){var _0x27fcbd=function(_0x16e71f){while(--_0x16e71f){_0x431ae1['push'](_0x431ae1['shift']());}};_0x27fcbd(++_0x385f06);}(_0x6579,0xaf));var _0x9657=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6579[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9657('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9657('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9657('0x2'));var util=require(_0x9657('0x3'));var path=require(_0x9657('0x4'));var sox=require('sox');var csv=require(_0x9657('0x5'));var ejs=require(_0x9657('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9657('0x7'));var squel=require(_0x9657('0x8'));var crypto=require(_0x9657('0x9'));var jsforce=require(_0x9657('0xa'));var deskjs=require(_0x9657('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9657('0xc'));var Papa=require(_0x9657('0xd'));var Redis=require('ioredis');var authService=require(_0x9657('0xe'));var qs=require(_0x9657('0xf'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x9657('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9657('0x11'))(_0x9657('0x12'));var utils=require(_0x9657('0x13'));var config=require(_0x9657('0x14'));var licenseUtil=require(_0x9657('0x15'));var db=require(_0x9657('0x16'))['db'];config[_0x9657('0x17')]=_[_0x9657('0x18')](config[_0x9657('0x17')],{'host':_0x9657('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9657('0x17')]));require(_0x9657('0x1a'))[_0x9657('0x1b')](socket);var jayson=require(_0x9657('0x1c'));var client=jayson['client']['http']({'port':0x232b});var client9004=jayson[_0x9657('0x1d')][_0x9657('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x3bb728,_0x542c11,_0x262799,_0x2b170b){return new BPromise(function(_0x205fe2,_0x4d7974){var _0x4969df=_0x2b170b||client;return _0x4969df[_0x9657('0x1f')](_0x3bb728,_0x262799)[_0x9657('0x20')](function(_0x5559c5){logger[_0x9657('0x21')]('ChatInteraction,\x20%s,\x20%s',_0x542c11,_0x9657('0x22'));logger[_0x9657('0x23')](_0x9657('0x24'),_0x542c11,_0x9657('0x22'),JSON[_0x9657('0x25')](_0x5559c5));if(_0x5559c5[_0x9657('0x26')]){if(_0x5559c5[_0x9657('0x26')][_0x9657('0x27')]===0x1f4){logger[_0x9657('0x26')](_0x9657('0x28'),_0x542c11,_0x5559c5['error'][_0x9657('0x29')]);return _0x4d7974(_0x5559c5[_0x9657('0x26')][_0x9657('0x29')]);}logger[_0x9657('0x26')](_0x9657('0x28'),_0x542c11,_0x5559c5[_0x9657('0x26')][_0x9657('0x29')]);return _0x205fe2(_0x5559c5[_0x9657('0x26')][_0x9657('0x29')]);}else{logger[_0x9657('0x21')](_0x9657('0x28'),_0x542c11,'request\x20sent');_0x205fe2(_0x5559c5[_0x9657('0x2a')][_0x9657('0x29')]);}})[_0x9657('0x2b')](function(_0x462857){logger[_0x9657('0x26')](_0x9657('0x28'),_0x542c11,_0x462857);_0x4d7974(_0x462857);});});}function respondWithStatusCode(_0x417805,_0x428ef9){_0x428ef9=_0x428ef9||0xcc;return function(_0x17f23b){if(_0x17f23b){return _0x417805[_0x9657('0x2c')](_0x428ef9);}return _0x417805[_0x9657('0x2d')](_0x428ef9)[_0x9657('0x2e')]();};}function respondWithResult(_0x369b78,_0x114b0a){_0x114b0a=_0x114b0a||0xc8;return function(_0x27adae){if(_0x27adae){return _0x369b78[_0x9657('0x2d')](_0x114b0a)[_0x9657('0x2f')](_0x27adae);}};}function respondWithFilteredResult(_0x44a91f,_0x520c59){return function(_0x4b85db){if(_0x4b85db){var _0x44460c=typeof _0x520c59[_0x9657('0x30')]==='undefined'&&typeof _0x520c59[_0x9657('0x31')]==='undefined';var _0x2bd46f=_0x4b85db[_0x9657('0x32')];var _0x4bfdd6=_0x44460c?0x0:_0x520c59[_0x9657('0x30')];var _0x5bc1a7=_0x44460c?_0x4b85db[_0x9657('0x32')]:_0x520c59['offset']+_0x520c59['limit'];var _0x44dd74;if(_0x5bc1a7>=_0x2bd46f){_0x5bc1a7=_0x2bd46f;_0x44dd74=0xc8;}else{_0x44dd74=0xce;}_0x44a91f[_0x9657('0x2d')](_0x44dd74);return _0x44a91f[_0x9657('0x33')](_0x9657('0x34'),_0x4bfdd6+'-'+_0x5bc1a7+'/'+_0x2bd46f)[_0x9657('0x2f')](_0x4b85db);}return null;};}function patchUpdates(_0x4356f7){return function(_0x249d7b){try{jsonpatch['apply'](_0x249d7b,_0x4356f7,!![]);}catch(_0x723824){return BPromise[_0x9657('0x35')](_0x723824);}return _0x249d7b[_0x9657('0x36')]();};}function saveUpdates(_0x126399,_0x56b17d){return function(_0x257762){if(_0x257762){return _0x257762[_0x9657('0x37')](_0x126399)[_0x9657('0x20')](function(_0x30304f){return _0x30304f;});}return null;};}function removeEntity(_0x532a0a,_0x1b1e56){return function(_0x20affb){if(_0x20affb){return _0x20affb[_0x9657('0x38')]()[_0x9657('0x20')](function(){_0x532a0a[_0x9657('0x2d')](0xcc)[_0x9657('0x2e')]();});}};}function handleEntityNotFound(_0x4fd2b2,_0x4b2a11){return function(_0x32ca45){if(!_0x32ca45){_0x4fd2b2[_0x9657('0x2c')](0x194);}return _0x32ca45;};}function handleError(_0x348215,_0x3996fa){_0x3996fa=_0x3996fa||0x1f4;return function(_0x5b9735){logger[_0x9657('0x26')](_0x5b9735[_0x9657('0x39')]);if(_0x5b9735[_0x9657('0x3a')]){delete _0x5b9735[_0x9657('0x3a')];}_0x348215[_0x9657('0x2d')](_0x3996fa)[_0x9657('0x3b')](_0x5b9735);};}function getMustacheRender(_0x2a66bd,_0xeff4aa){return Mustache[_0x9657('0x3c')](_0x2a66bd,_['merge'](_0xeff4aa['body'],{'contact':_0xeff4aa[_0x9657('0x3d')],'message':_0xeff4aa[_0x9657('0x29')],'agent':_0xeff4aa[_0x9657('0x3e')],'interaction':_0xeff4aa['interaction'],'account':_0xeff4aa['account']}))||'';}function getInteractionUsers(_0x4a105a,_0x50abc7){return new BPromise(function(_0x4267ff,_0x5c7a0e){try{if(_0x50abc7[_0x4a105a['id']]){_0x4a105a[_0x9657('0x3f')]=_[_0x9657('0x40')](_0x50abc7[_0x4a105a['id']],function(_0x29c75a){return{'id':_0x29c75a['id'],'fullname':_0x29c75a[_0x9657('0x41')]};});}}catch(_0x4697ec){_0x5c7a0e(_0x4697ec);}_0x4267ff(_0x4a105a);});}function getInteractionTags(_0x9f9e0d,_0x2d2788){return new BPromise(function(_0x15a059,_0x56fd89){try{if(_0x9f9e0d['TagIds']){_0x9f9e0d[_0x9657('0x42')]=[];_0x9f9e0d[_0x9657('0x43')][_0x9657('0x44')](',')[_0x9657('0x45')](function(_0x4b90da){_0x9f9e0d['Tags']['push'](_0x2d2788[_0x4b90da]);});}delete _0x9f9e0d[_0x9657('0x43')];}catch(_0x70bd99){_0x56fd89(_0x70bd99);}_0x15a059(_0x9f9e0d);});}function updateChatInteraction(_0x2f9887,_0x189bf0,_0x393b6b){return new BPromise(function(_0x3177ad,_0x34bff3){return getInteractionUsers(_0x2f9887,_0x393b6b)[_0x9657('0x20')](function(_0x481ef){return getInteractionTags(_0x481ef,_0x189bf0);})[_0x9657('0x20')](function(_0x2e6428){return getStateInteraction(_0x2e6428);})[_0x9657('0x20')](function(_0x2f53c4){_0x3177ad(_0x2f53c4);})[_0x9657('0x2b')](function(_0x377cb3){_0x34bff3(_0x377cb3);});});}function getStateInteraction(_0x5e2ab4){return new BPromise(function(_0x8854f7){_0x5e2ab4[_0x9657('0x46')]=0x0;_0x5e2ab4[_0x9657('0x47')]=0x0;_0x5e2ab4[_0x9657('0x48')]=0x0;_0x5e2ab4[_0x9657('0x49')]=0x0;_0x5e2ab4[_0x9657('0x4a')]=0x0;_0x5e2ab4[_0x9657('0x4b')]=0x0;if(!_0x5e2ab4['closed']&&!_0x5e2ab4['UserId']){_0x5e2ab4[_0x9657('0x46')]+=0x1;}if(!_0x5e2ab4[_0x9657('0x4c')]&&_0x5e2ab4['UserId']){_0x5e2ab4[_0x9657('0x47')]+=0x1;if(_0x5e2ab4['waiting']){_0x5e2ab4['waiting']-=0x1;}}if(_0x5e2ab4[_0x9657('0x4c')]&&_0x5e2ab4[_0x9657('0x4d')]===_0x9657('0x4a')){_0x5e2ab4[_0x9657('0x4a')]+=0x1;if(_0x5e2ab4[_0x9657('0x46')]){_0x5e2ab4['waiting']-=0x1;}}else if(_0x5e2ab4[_0x9657('0x4c')]&&!_0x5e2ab4[_0x9657('0x4e')]&&_0x5e2ab4['disposition']){_0x5e2ab4['unmanaged']+=0x1;if(_0x5e2ab4[_0x9657('0x46')]){_0x5e2ab4[_0x9657('0x46')]-=0x1;}}else if(_0x5e2ab4[_0x9657('0x4c')]&&_0x5e2ab4['UserId']){_0x5e2ab4['answered']+=0x1;if(_0x5e2ab4[_0x9657('0x47')]){_0x5e2ab4[_0x9657('0x47')]-=0x1;}}_0x5e2ab4[_0x9657('0x4b')]+=0x1;_0x8854f7(_0x5e2ab4);});}exports[_0x9657('0x4f')]=function(_0x4a2ba7,_0x2002a8){var _0x26e131={},_0x3d8a6a={},_0x2503b0={'count':0x0,'rows':[]};var _0x1ee5ea=_['map'](db[_0x9657('0x50')][_0x9657('0x51')],function(_0x1cfb1d){return{'name':_0x1cfb1d[_0x9657('0x52')],'type':_0x1cfb1d[_0x9657('0x53')]['key']};});_0x3d8a6a['model']=_[_0x9657('0x40')](_0x1ee5ea,_0x9657('0x3a'));_0x3d8a6a[_0x9657('0x54')]=_[_0x9657('0x55')](_0x4a2ba7[_0x9657('0x54')]);_0x3d8a6a[_0x9657('0x56')]=_[_0x9657('0x57')](_0x3d8a6a[_0x9657('0x58')],_0x3d8a6a[_0x9657('0x54')]);_0x26e131[_0x9657('0x59')]=_[_0x9657('0x57')](_0x3d8a6a[_0x9657('0x58')],qs[_0x9657('0x5a')](_0x4a2ba7[_0x9657('0x54')][_0x9657('0x5a')]));_0x26e131['attributes']=_0x26e131[_0x9657('0x59')][_0x9657('0x5b')]?_0x26e131['attributes']:_0x3d8a6a[_0x9657('0x58')];if(!_0x4a2ba7[_0x9657('0x54')]['hasOwnProperty'](_0x9657('0x5c'))){_0x26e131[_0x9657('0x31')]=qs['limit'](_0x4a2ba7[_0x9657('0x54')]['limit']);_0x26e131[_0x9657('0x30')]=qs[_0x9657('0x30')](_0x4a2ba7[_0x9657('0x54')][_0x9657('0x30')]);}_0x26e131[_0x9657('0x5d')]=qs[_0x9657('0x5e')](_0x4a2ba7[_0x9657('0x54')][_0x9657('0x5e')]);_0x26e131[_0x9657('0x5f')]=qs['filters'](_[_0x9657('0x60')](_0x4a2ba7['query'],_0x3d8a6a['filters']),_0x1ee5ea);var _0x5dd8e3=[];var _0xc80c57=squel[_0x9657('0x61')]()[_0x9657('0x62')]('id')[_0x9657('0x62')](_0x9657('0x3a'))[_0x9657('0x62')](_0x9657('0x63'))[_0x9657('0x64')]('tools_tags');var _0x3f8651=squel[_0x9657('0x61')]()['field'](_0x9657('0x65'))[_0x9657('0x62')](_0x9657('0x66'))[_0x9657('0x62')](_0x9657('0x67'))[_0x9657('0x64')](_0x9657('0x68'),'ui')[_0x9657('0x69')](_0x9657('0x6a'),'u',_0x9657('0x6b'));var _0x5d1736=squel[_0x9657('0x61')]()[_0x9657('0x64')](_0x9657('0x6c'),'i')[_0x9657('0x69')](_0x9657('0x6d'),'c',_0x9657('0x6e'))[_0x9657('0x69')]('users','o',_0x9657('0x6f'))[_0x9657('0x69')](_0x9657('0x70'),'a',_0x9657('0x71'))[_0x9657('0x69')](_0x9657('0x72'),'me',_0x9657('0x73'))['left_join']('chat_interaction_has_tags','it',_0x9657('0x74'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x486822=squel[_0x9657('0x75')]();var _0x3a9bc0=[];var _0x5a4474=squel[_0x9657('0x75')]();var _0x243c22;if(_0x4a2ba7[_0x9657('0x54')][_0x9657('0x76')]){_0x243c22=as[_0x9657('0x77')](_0x4a2ba7['query'][_0x9657('0x76')]);var _0x109588=_0x243c22[_0x9657('0x78')];for(var _0x5ddd92=0x0;_0x5ddd92<_0x243c22[_0x9657('0x79')][_0x9657('0x5b')];_0x5ddd92++){var _0x3ffd0e=_0x243c22[_0x9657('0x79')][_0x5ddd92];var _0x46a478='i';var _0x10bcd3=_[_0x9657('0x7a')](_0x1ee5ea,['name',_0x3ffd0e[_0x9657('0x62')]]);if(!_0x10bcd3){switch(_0x3ffd0e[_0x9657('0x62')]){case _0x9657('0x7b'):if(_0x3ffd0e[_0x9657('0x7c')]==0x1){_0x5d1736[_0x9657('0x7d')]('`'+_0x3ffd0e[_0x9657('0x62')]+_0x9657('0x7e'));}else{_0x5d1736[_0x9657('0x7d')]('`'+_0x3ffd0e[_0x9657('0x62')]+_0x9657('0x7f'));}break;case _0x9657('0x80'):if(_0x3ffd0e[_0x9657('0x81')]===_0x9657('0x82')){if(_0x3ffd0e[_0x9657('0x7c')][_0x9657('0x44')]('\x20')[_0x9657('0x5b')]>0x1){_0x486822[_0x109588](_0x9657('0x83'),qs[_0x9657('0x84')](_0x3ffd0e[_0x9657('0x7c')]),null);}else{var _0x11476b='%'+_0x3ffd0e[_0x9657('0x7c')]+'%';_0x486822[_0x109588](_0x9657('0x85'),_0x11476b,_0x11476b,_0x11476b);}}else{_0x10bcd3=_[_0x9657('0x7a')](_0x1ee5ea,[_0x9657('0x3a'),_0x9657('0x86')]);_0x3ffd0e[_0x9657('0x62')]=_0x9657('0x86');_0x1d4052=as[_0x9657('0x87')](_0x46a478,_0x10bcd3[_0x9657('0x53')],_0x3ffd0e);_0x486822[_0x109588](_0x1d4052[_0x9657('0x88')],_0x1d4052[_0x9657('0x7c')]['start'],_0x1d4052[_0x9657('0x7c')]['end']);}break;case _0x9657('0x89'):var _0x115ac5=_0x3ffd0e['value'][_0x9657('0x44')](',')[_0x9657('0x40')](function(_0xc4f89f){return Number(_0xc4f89f);});_0x115ac5['forEach'](function(_0x481261){_0x5a4474['or'](_0x9657('0x8a'),'%,'+_0x481261+',%');});_0x3a9bc0=_[_0x9657('0x8b')](_0x3a9bc0,_0x115ac5);break;case'User':if(_0x3ffd0e['operator']===_0x9657('0x82')){_0x486822[_0x109588]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3ffd0e[_0x9657('0x7c')]+'%',null);}else{_0x10bcd3=_[_0x9657('0x7a')](_0x1ee5ea,[_0x9657('0x3a'),_0x9657('0x4e')]);_0x3ffd0e[_0x9657('0x62')]=_0x9657('0x4e');_0x1d4052=as[_0x9657('0x87')](_0x46a478,_0x10bcd3[_0x9657('0x53')],_0x3ffd0e);_0x486822[_0x109588](_0x1d4052['text'],_0x1d4052[_0x9657('0x7c')][_0x9657('0x8c')],_0x1d4052[_0x9657('0x7c')]['end']);}break;case _0x9657('0x8d'):_0x1d4052=as['buildExpression']('me',null,_0x3ffd0e);_0x486822[_0x109588](_0x1d4052[_0x9657('0x88')],_0x1d4052[_0x9657('0x7c')][_0x9657('0x8c')],_0x1d4052[_0x9657('0x7c')][_0x9657('0x2e')]);break;}}else{var _0x1d4052=as[_0x9657('0x87')](_0x46a478,_0x10bcd3[_0x9657('0x53')],_0x3ffd0e);_0x486822[_0x109588](_0x1d4052['text'],_0x1d4052[_0x9657('0x7c')][_0x9657('0x8c')],_0x1d4052[_0x9657('0x7c')][_0x9657('0x2e')]);}}}else{var _0x459426=_(_0x4a2ba7['query'])[_0x9657('0x55')]()[_0x9657('0x40')](function(_0x2ff84c){return _[_0x9657('0x8e')](_0x1ee5ea,[_0x9657('0x3a'),_0x2ff84c])?_0x2ff84c:undefined;})['compact']()[_0x9657('0x7c')]();if(!_[_0x9657('0x8f')](_0x459426)){_0x459426[_0x9657('0x45')](function(_0x4ad3c1){if(_0x4ad3c1===_0x9657('0x90')){_0x5d1736['where'](_0x9657('0x91'),[][_0x9657('0x92')](_0x4a2ba7[_0x9657('0x54')][_0x4ad3c1]));}else if(_0x4ad3c1===_0x9657('0x93')){var _0x37b5a1=JSON['parse'](_0x4a2ba7[_0x9657('0x54')][_0x4ad3c1])['$gte'];var _0x3c6e98=JSON['parse'](_0x4a2ba7[_0x9657('0x54')][_0x4ad3c1])['$lte'];_0x5d1736[_0x9657('0x5f')](_0x9657('0x94'),_0x37b5a1,_0x3c6e98);}else{if(_0x4a2ba7[_0x9657('0x54')][_0x4ad3c1]==='null'){_0x5d1736[_0x9657('0x5f')]('i.'+_0x4ad3c1+'\x20IS\x20NULL');}else{_0x5d1736[_0x9657('0x5f')]('i.'+_0x4ad3c1+_0x9657('0x95'),_0x4a2ba7['query'][_0x4ad3c1]);}}});}if(_0x4a2ba7['query'][_0x9657('0x96')]){if(_0x4a2ba7['query'][_0x9657('0x96')]==0x1){_0x5d1736['having'](_0x9657('0x97'));}else{_0x5d1736[_0x9657('0x7d')](_0x9657('0x98'));}}if(_0x4a2ba7[_0x9657('0x54')][_0x9657('0x99')]){_0x3a9bc0=_[_0x9657('0x9a')](_0x4a2ba7['query'][_0x9657('0x99')])?_0x4a2ba7[_0x9657('0x54')]['tag']:new Array(_0x4a2ba7[_0x9657('0x54')][_0x9657('0x99')]);_0x3a9bc0[_0x9657('0x45')](function(_0x17978f){_0x5a4474['or'](_0x9657('0x8a'),'%,'+_0x17978f+',%');});}if(_0x4a2ba7[_0x9657('0x54')]['filter']){var _0x4cbe60=_0x4a2ba7[_0x9657('0x54')]['filter']['replace']('\x5c','\x5c\x5c')[_0x9657('0x9b')](/'/g,'\x27\x27');if(qs[_0x9657('0x9c')](_0x4cbe60)){_0x486822['or']('i.id\x20LIKE\x20?',_0x4cbe60+'%');}else{_0x486822['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x9657('0x84')](_0x4cbe60))['or'](_0x9657('0x9d'),_0x4cbe60+'%');}}}_0x5d1736[_0x9657('0x5f')](_0x486822);_0x5d1736[_0x9657('0x9e')](_0x9657('0x9f'));var _0xc70656={'type':db[_0x9657('0xa0')][_0x9657('0xa1')][_0x9657('0xa2')],'raw':!![]};var _0x2e13f0=_0x5d1736['clone']();_0x2e13f0[_0x9657('0x62')](_0x9657('0x9f'));_0x2e13f0['field'](_0x9657('0xa3'),_0x9657('0x7b'));if(_0x26e131[_0x9657('0x5d')]){_0x26e131[_0x9657('0x5d')][_0x9657('0x45')](function(_0xfdc10f){var _0x3cc6f9=_0xfdc10f[0x0]===_0x9657('0xa4')?_0xfdc10f[0x0]:'i.'+_0xfdc10f[0x0];_0x5d1736[_0x9657('0x5d')](_0x3cc6f9,_0xfdc10f[0x1]===_0x9657('0xa5')?![]:!![]);});}if(!_[_0x9657('0x8f')](_0x3a9bc0)){_0x5d1736['having'](_0x5a4474);_0x2e13f0[_0x9657('0x5f')]('t.id\x20IN\x20?',_0x3a9bc0);}BPromise['resolve']()['then'](function(){if(!_0x243c22){if(_0x4a2ba7['query'][_0x9657('0x90')])return;_0x2e13f0['where'](_0x9657('0xa6'));_0x5d1736[_0x9657('0x5f')](_0x9657('0xa6'));return;}if(_0x4a2ba7[_0x9657('0xa7')][_0x9657('0xa8')]!=='agent')return;return _0x4a2ba7[_0x9657('0xa7')][_0x9657('0xa9')]({'attributes':['id'],'raw':!![]})['then'](function(_0x9ec761){if(_[_0x9657('0x8f')](_0x9ec761)){_0x2e13f0[_0x9657('0x5f')](_0x9657('0xaa'));_0x5d1736[_0x9657('0x5f')](_0x9657('0xaa'));}else{_0x2e13f0[_0x9657('0x5f')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0x9ec761,'id'));_0x5d1736[_0x9657('0x5f')](_0x9657('0x91'),_['map'](_0x9ec761,'id'));}});})[_0x9657('0x20')](function(){if(_0x4a2ba7['user'][_0x9657('0xa8')]===_0x9657('0x3e')&&!_0x243c22&&!_0x4a2ba7['query']['ChatWebsiteId'])return[];return db[_0x9657('0xab')][_0x9657('0x54')](_0x2e13f0[_0x9657('0xac')](),_0xc70656);})[_0x9657('0x20')](function(_0x12e59d){_0x2503b0[_0x9657('0x32')]=_0x12e59d[_0x9657('0x5b')];if(_0x2503b0[_0x9657('0x32')]===0x0)return[];return db['sequelize'][_0x9657('0x54')](_0xc80c57[_0x9657('0xac')](),_0xc70656)[_0x9657('0x20')](function(_0x6e68ab){_0x5dd8e3=_[_0x9657('0xad')](_0x6e68ab,'id');_0xc70656=_[_0x9657('0xae')](_0xc70656,{'model':db[_0x9657('0x50')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4a2ba7[_0x9657('0x54')]['fields']){_0x26e131['attributes'][_0x9657('0x45')](function(_0x42ba61){_0x5d1736['field']('i.'+_0x42ba61);});}else{_0x5d1736[_0x9657('0x62')](_0x9657('0xa3'),'unreadMessages');_0x5d1736[_0x9657('0x62')](_0x9657('0xaf'),_0x9657('0xb0'));_0x5d1736[_0x9657('0x62')](_0x9657('0xb1'),'Account.mandatoryDisposition');_0x5d1736[_0x9657('0x62')](_0x9657('0xb2'),_0x9657('0xa4'));_0x5d1736[_0x9657('0x62')](_0x9657('0xb3'));_0x5d1736[_0x9657('0x62')]('c.firstName','Contact.firstName');_0x5d1736['field']('c.lastName',_0x9657('0xb4'));_0x5d1736[_0x9657('0x62')]('c.email','Contact.email');_0x5d1736[_0x9657('0x62')](_0x9657('0xb5'),_0x9657('0xb6'));_0x5d1736['field']('c.mobile','Contact.mobile');_0x5d1736['field'](_0x9657('0xb7'),'Contact.fax');_0x5d1736[_0x9657('0x62')]('o.fullname','Owner.fullname');_0x5d1736[_0x9657('0x62')]('o.internal',_0x9657('0xb8'));_0x5d1736[_0x9657('0x62')](_0x9657('0xb9'),_0x9657('0x43'));}if(_0x26e131['limit'])_0x5d1736[_0x9657('0x31')](_0x26e131[_0x9657('0x31')]);if(_0x26e131['offset'])_0x5d1736[_0x9657('0x30')](_0x26e131['offset']);return db['sequelize'][_0x9657('0x54')](_0x5d1736['toString'](),_0xc70656);})[_0x9657('0x20')](function(_0x5c1f09){if(_0x5c1f09[_0x9657('0x5b')]>0x0)_0x3f8651[_0x9657('0x5f')](_0x9657('0xba'),_[_0x9657('0x40')](_0x5c1f09,'id'));return db[_0x9657('0xab')][_0x9657('0x54')](_0x3f8651[_0x9657('0xac')](),_0xc70656)[_0x9657('0x20')](function(_0xbfd360){var _0xdb9856=_['groupBy'](_0xbfd360,'ChatInteractionId');var _0xdbe625=[];_0x5c1f09[_0x9657('0x45')](function(_0x1d36d1){_0xdbe625[_0x9657('0xbb')](updateChatInteraction(_0x1d36d1,_0x5dd8e3,_0xdb9856));});return BPromise[_0x9657('0xbc')](_0xdbe625);});});})[_0x9657('0x20')](function(_0x48a452){_0x2503b0['rows']=_0x48a452;return _0x2503b0;})[_0x9657('0x20')](respondWithFilteredResult(_0x2002a8,_0x26e131))[_0x9657('0x2b')](handleError(_0x2002a8,null));};exports['show']=function(_0x25bee5,_0x52e969){var _0x403606={'raw':![],'where':{'id':_0x25bee5[_0x9657('0xbd')]['id']}},_0x571cfd={};_0x571cfd[_0x9657('0x58')]=_['keys'](db[_0x9657('0x50')][_0x9657('0x51')]);_0x571cfd[_0x9657('0x54')]=_[_0x9657('0x55')](_0x25bee5[_0x9657('0x54')]);_0x571cfd[_0x9657('0x56')]=_['intersection'](_0x571cfd[_0x9657('0x58')],_0x571cfd[_0x9657('0x54')]);_0x403606[_0x9657('0x59')]=_[_0x9657('0x57')](_0x571cfd[_0x9657('0x58')],qs['fields'](_0x25bee5[_0x9657('0x54')][_0x9657('0x5a')]));_0x403606[_0x9657('0x59')]=_0x403606[_0x9657('0x59')]['length']?_0x403606[_0x9657('0x59')]:_0x571cfd[_0x9657('0x58')];if(_0x25bee5[_0x9657('0x54')]['includeAll']){_0x403606[_0x9657('0xbe')]=[{'all':!![]}];}_0x403606=_['merge']({},_0x403606,_0x25bee5['options']);return db[_0x9657('0x50')]['find'](_0x403606)[_0x9657('0x20')](handleEntityNotFound(_0x52e969,null))[_0x9657('0x20')](respondWithResult(_0x52e969,null))[_0x9657('0x2b')](handleError(_0x52e969,null));};exports[_0x9657('0xbf')]=function(_0x94a9f1,_0x203cb8){return db[_0x9657('0x50')]['create'](_0x94a9f1['body'],{})[_0x9657('0x20')](respondWithResult(_0x203cb8,0xc9))[_0x9657('0x2b')](handleError(_0x203cb8,null));};exports['update']=function(_0x12165d,_0x4f670d){if(_0x12165d[_0x9657('0x8d')]['id']){delete _0x12165d[_0x9657('0x8d')]['id'];}return db[_0x9657('0x50')][_0x9657('0x7a')]({'where':{'id':_0x12165d[_0x9657('0xbd')]['id']}})[_0x9657('0x20')](handleEntityNotFound(_0x4f670d,null))[_0x9657('0x20')](saveUpdates(_0x12165d[_0x9657('0x8d')],null))[_0x9657('0x20')](respondWithResult(_0x4f670d,null))[_0x9657('0x2b')](handleError(_0x4f670d,null));};exports[_0x9657('0x38')]=function(_0x1a3435,_0x3536c3){return db[_0x9657('0x50')]['find']({'where':{'id':_0x1a3435[_0x9657('0xbd')]['id']}})[_0x9657('0x20')](handleEntityNotFound(_0x3536c3,null))[_0x9657('0x20')](removeEntity(_0x3536c3,null))['catch'](handleError(_0x3536c3,null));};exports[_0x9657('0xc0')]=function(_0x4d9f6a,_0x2c7135){return db[_0x9657('0x50')][_0x9657('0xc0')]()[_0x9657('0x20')](respondWithResult(_0x2c7135,null))[_0x9657('0x2b')](handleError(_0x2c7135,null));};exports[_0x9657('0xc1')]=function(_0x5eacf1,_0x5905f2){var _0x38a3c0=_0x5eacf1[_0x9657('0xbd')]['id'];var _0x2e2beb;var _0x525ffd;var _0x1be847;return db[_0x9657('0x50')]['findOne']({'where':{'id':_0x38a3c0}})[_0x9657('0x20')](function(_0x16e351){_0x2e2beb=_0x16e351;return db[_0x9657('0xc2')][_0x9657('0xc3')]({'where':{'id':_0x16e351[_0x9657('0x90')]},'attributes':['id',_0x9657('0xc4'),_0x9657('0xc5'),_0x9657('0xc6'),'vidaooNote',_0x9657('0xc7')],'raw':!![]});})['then'](function(_0x331d33){if(_0x331d33&&_0x331d33[_0x9657('0xc4')]&&_0x331d33[_0x9657('0xc5')]){_0x525ffd=_0x331d33;var _0xeb39fa={'interaction':{'id':_0x38a3c0},'agent':{'id':_0x5eacf1['user']['id'],'name':_0x5eacf1[_0x9657('0xa7')][_0x9657('0x3a')],'fullname':_0x5eacf1[_0x9657('0xa7')]['fullname'],'email':_0x5eacf1[_0x9657('0xa7')]['email']},'contact':_0x5eacf1[_0x9657('0x8d')][_0x9657('0x3d')],'account':_0x5eacf1[_0x9657('0x8d')][_0x9657('0xc8')]};var _0x28d729={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x331d33[_0x9657('0xc4')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5eacf1['user']['email']],'buttons':null,'topic':_0x525ffd[_0x9657('0xc6')],'note':_[_0x9657('0xc9')](_0x525ffd[_0x9657('0xca')])?null:getMustacheRender(_0x525ffd[_0x9657('0xca')],_0xeb39fa),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x9657('0xc9')](_0x525ffd['vidaooMetadata'])){var _0x394e21=getMustacheRender(_0x525ffd['vidaooMetadata'],_0xeb39fa);var _0x58ae12=JSON[_0x9657('0xcb')](_0x394e21);_0x28d729[_0x9657('0x8d')][_0x9657('0xcc')]=_0x58ae12;}}catch(_0x17bf6b){throw new db[(_0x9657('0xa0'))][(_0x9657('0xcd'))](_0x9657('0xce'));}return rp(_0x28d729);}else{throw new db[(_0x9657('0xa0'))][(_0x9657('0xcd'))](_0x9657('0xcf'));}})['then'](function(_0x2442b5){_0x1be847=_0x2442b5;if(_0x1be847['id']){var _0x15e317={'body':_0x1be847[_0x9657('0xd0')],'ChatWebsiteId':_0x525ffd['id'],'ChatInteractionId':_0x2e2beb['id'],'direction':_0x9657('0xd1'),'UserId':_0x5eacf1[_0x9657('0xa7')]['id']};return db[_0x9657('0xd2')][_0x9657('0xbf')](_0x15e317,{});}else{throw new db[(_0x9657('0xa0'))][(_0x9657('0xcd'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x9657('0x20')](function(){return _0x2e2beb[_0x9657('0xd3')]({'vidaooSessionId':_0x1be847['id']});})[_0x9657('0x20')](respondWithResult(_0x5905f2,null))[_0x9657('0x2b')](handleError(_0x5905f2,null));};exports['customUpdate']=function(_0x5089f0,_0x5aeb11){if(_0x5089f0[_0x9657('0x8d')]['id']){delete _0x5089f0[_0x9657('0x8d')]['id'];}return db[_0x9657('0x50')][_0x9657('0x7a')]({'where':{'id':_0x5089f0['params']['id']},'include':[{'model':db['CmContact'],'as':_0x9657('0x80')}]})[_0x9657('0x20')](handleEntityNotFound(_0x5aeb11,null))[_0x9657('0x20')](saveUpdates(_0x5089f0['body'],null))[_0x9657('0x20')](respondWithResult(_0x5aeb11,null))['catch'](handleError(_0x5aeb11,null));};exports[_0x9657('0xd4')]=function(_0x5121e7,_0x200173,_0x38fc2f){if(_0x5121e7[_0x9657('0x8d')]['id']){delete _0x5121e7['body']['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x5121e7[_0x9657('0xbd')]['id']}})[_0x9657('0x20')](function(_0x383020){if(!_0x383020){logger[_0x9657('0x26')]('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,_0x9657('0xd5'));_0x200173[_0x9657('0x2c')](0x194);}else{if(_0x383020[_0x9657('0x4e')]){throw new db[(_0x9657('0xa0'))][(_0x9657('0xcd'))](_0x9657('0xd6'));}}return _0x383020;})['then'](function(_0x5ba2e3){if(_0x5ba2e3){return _0x5ba2e3[_0x9657('0x37')]({'closed':_0x5121e7[_0x9657('0x8d')][_0x9657('0x4c')],'disposition':_0x5121e7[_0x9657('0x8d')][_0x9657('0x4d')]})['then'](function(_0x5325f8){return _0x5325f8;});}})['then'](function(_0x37bdf6){return respondWithRpcPromise(_0x9657('0xd7'),_0x9657('0xd4'),_0x5121e7[_0x9657('0x8d')],client9004);})[_0x9657('0x20')](respondWithResult(_0x200173,null))[_0x9657('0x2b')](handleError(_0x200173,null));};exports['attachmentUpload']=function(_0x55a664,_0x3e083a,_0x2963dc){_0x55a664['body'][_0x9657('0x3a')]=_0x55a664['file'][_0x9657('0xd8')];_0x55a664['body']['basename']=_0x55a664[_0x9657('0xd9')][_0x9657('0xda')];_0x55a664[_0x9657('0x8d')][_0x9657('0x53')]=_0x55a664[_0x9657('0xd9')]['mimetype'];return db[_0x9657('0xdb')][_0x9657('0xbf')](_0x55a664[_0x9657('0x8d')])['then'](respondWithResult(_0x3e083a,0xc9))[_0x9657('0x2b')](handleError(_0x3e083a,null));};exports[_0x9657('0xdc')]=function(_0x3cf9fc,_0x55cf64,_0x5ca6cf){return db[_0x9657('0x50')][_0x9657('0xc3')]({'where':{'id':_0x3cf9fc[_0x9657('0xbd')]['id']},'raw':!![]})[_0x9657('0x20')](handleEntityNotFound(_0x55cf64,null))[_0x9657('0x20')](function(_0x34cace){if(_0x34cace){if(_0x34cace[_0x9657('0x4c')]){return _0x55cf64[_0x9657('0x2d')](0x193)['json']({'status':0x193,'message':_0x9657('0xdd')});}return db[_0x9657('0xdb')][_0x9657('0xc3')]({'where':{'id':_0x3cf9fc[_0x9657('0x54')][_0x9657('0xde')]},'raw':!![]})[_0x9657('0x20')](handleEntityNotFound(_0x55cf64,null));}})[_0x9657('0x20')](function(_0x3745bf){if(_0x3745bf){var _0x1258aa=_0x3745bf[_0x9657('0xdf')]!==null;var _0x1b76bb=path[_0x9657('0xe0')](config[_0x9657('0xe1')],_0x9657('0xe2'));if(_0x1258aa){_0x1b76bb=path['join'](_0x1b76bb,_0x9657('0xe3'));}var _0x1e9a7f=path[_0x9657('0xe0')](_0x1b76bb,_0x3745bf[_0x9657('0xe4')]);return _0x55cf64[_0x9657('0xe5')](_0x1e9a7f);}})['catch'](handleError(_0x55cf64,null));};exports[_0x9657('0xe6')]=function(_0x60f11,_0x183316){var _0x24cdf2=null;var _0x12019f=null;var _0x55f0a4=null;var _0x1ee824=null;if(_0x60f11[_0x9657('0x8d')]['id']){delete _0x60f11[_0x9657('0x8d')]['id'];}if(_0x60f11['body'][_0x9657('0xe7')]){_0x1ee824=path[_0x9657('0xe0')](config['root'],_0x9657('0xe8'),util[_0x9657('0xe9')](_0x9657('0xea'),Date['now']()));_0x60f11[_0x9657('0x8d')][_0x9657('0xeb')]=_0x1ee824;}return db[_0x9657('0x50')]['find']({'where':{'id':_0x60f11[_0x9657('0xbd')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x9657('0xec'),'include':[{'model':db[_0x9657('0xed')],'as':'User'}]}]})['then'](handleEntityNotFound(_0x183316,null))[_0x9657('0x20')](saveUpdates(_0x60f11[_0x9657('0x8d')],null))['then'](function(_0x3a52c1){if(_0x3a52c1){_0x24cdf2=_0x3a52c1;return db['ChatWebsite'][_0x9657('0x7a')]({'where':{'id':_0x24cdf2[_0x9657('0x90')]}});}})[_0x9657('0x20')](function(_0x59ebd8){if(_0x59ebd8){_0x55f0a4=_0x59ebd8;return db['CmContact'][_0x9657('0x7a')]({'where':{'id':_0x24cdf2[_0x9657('0x86')]}});}})[_0x9657('0x20')](function(_0x4154e6){if(_0x4154e6){_0x12019f=_0x4154e6;if(_0x1ee824){var _0x3c54ca=null;for(var _0x43ad3b=0x1;_0x43ad3b<_0x24cdf2[_0x9657('0xec')][_0x9657('0x5b')];++_0x43ad3b){_0x3c54ca=_0x24cdf2[_0x9657('0xec')][_0x43ad3b];var _0x5f892b=_0x3c54ca[_0x9657('0x4e')]?util[_0x9657('0xe9')](_0x9657('0xee'),_0x55f0a4['agentAlias'],_0x3c54ca[_0x9657('0x4e')]):'System';var _0x5e995e=_0x60f11['body'][_0x9657('0xef')]||util[_0x9657('0xe9')]('%s%d',_0x9657('0xf0'),_0x3c54ca[_0x9657('0x86')]);switch(_0x55f0a4[_0x9657('0xf1')]){case _0x9657('0xf2'):_0x5f892b=_0x3c54ca[_0x9657('0x4e')]?util[_0x9657('0xe9')](_0x9657('0xee'),_0x55f0a4[_0x9657('0xf3')],_0x3c54ca[_0x9657('0x4e')]):_0x9657('0xf4');break;case'agent_alias':_0x5f892b=_0x3c54ca[_0x9657('0x4e')]?_0x3c54ca[_0x9657('0xed')][_0x9657('0xf5')]||_0x3c54ca[_0x9657('0xed')][_0x9657('0x41')]:_0x9657('0xf4');break;case'agent_fullname':_0x5f892b=_0x3c54ca['UserId']?_0x3c54ca['User'][_0x9657('0x41')]:_0x9657('0xf4');break;default:_0x5f892b=_0x3c54ca[_0x9657('0x4e')]?util[_0x9657('0xe9')](_0x9657('0xee'),_0x55f0a4[_0x9657('0xf3')],_0x3c54ca[_0x9657('0x4e')]):_0x9657('0xf4');}var _0x116a36=util[_0x9657('0xe9')](_0x9657('0xf6'),moment(_0x3c54ca[_0x9657('0x93')])[_0x9657('0xe9')](_0x9657('0xf7')),_0x3c54ca[_0x9657('0xf8')]==='in'?_0x5e995e:_0x5f892b,_0x3c54ca['body']);if(!_0x3c54ca[_0x9657('0xf9')]){fs[_0x9657('0xfa')](_0x1ee824,_0x116a36);}}return db[_0x9657('0xfb')][_0x9657('0xc3')]({'where':{'service':!![]},'include':[{'model':db[_0x9657('0xfc')],'as':_0x9657('0xfd'),'raw':!![]}]});}}})[_0x9657('0x20')](function(_0x387858){if(_0x387858&&_0x387858[_0x9657('0xfd')]&&_0x60f11[_0x9657('0x8d')]){var _0x473a1f={'tls':{'rejectUnauthorized':![]}};if(_0x387858[_0x9657('0xfd')][_0x9657('0xfe')]){_0x473a1f[_0x9657('0xfe')]=_0x387858[_0x9657('0xfd')][_0x9657('0xfe')];}else{_0x473a1f[_0x9657('0xff')]=_0x387858[_0x9657('0xfd')]['host'];_0x473a1f[_0x9657('0x100')]=_0x387858[_0x9657('0xfd')]['port'];_0x473a1f['secure']=_0x387858[_0x9657('0xfd')][_0x9657('0x101')];}if(_0x387858[_0x9657('0xfd')][_0x9657('0x102')]){_0x473a1f[_0x9657('0x103')]={'user':_0x387858[_0x9657('0xfd')]['user'],'pass':_0x387858[_0x9657('0xfd')][_0x9657('0x104')]};}return respondWithRpcPromise(_0x9657('0x105'),_0x9657('0x106'),{'account':_0x473a1f,'message':{'from':util['format'](_0x9657('0x107'),_0x387858[_0x9657('0x3a')],_0x387858[_0x9657('0x108')]||_0x387858[_0x9657('0xfd')][_0x9657('0xa7')]),'to':_0x60f11[_0x9657('0x8d')][_0x9657('0xe7')],'subject':_0x9657('0x109'),'text':util[_0x9657('0xe9')](_0x9657('0x10a'),_0x60f11[_0x9657('0x8d')]['mailTranscript']),'attachments':[{'path':_0x1ee824}]}})['then'](function(){return _0x24cdf2;})[_0x9657('0x2b')](function(_0x2a4884){console[_0x9657('0x26')](_0x2a4884);});}else{return _0x24cdf2;}})[_0x9657('0x20')](respondWithStatusCode(_0x183316,0xc8))[_0x9657('0x2b')](handleError(_0x183316,null));};exports[_0x9657('0x10b')]=function(_0x46dedf,_0x39e856,_0x46d3fd){return db[_0x9657('0xd2')][_0x9657('0x7a')]({'where':{'id':_0x46dedf[_0x9657('0xbd')]['id']}})[_0x9657('0x20')](handleEntityNotFound(_0x39e856,null))[_0x9657('0x20')](function(_0x9a858d){if(_0x9a858d){return _0x9a858d[_0x9657('0x10b')](_0x46dedf[_0x9657('0x8d')][_0x9657('0x10c')],_[_0x9657('0x10d')](_0x46dedf[_0x9657('0x8d')],['ids','id'])||{});}})[_0x9657('0x20')](respondWithResult(_0x39e856,null))[_0x9657('0x2b')](handleError(_0x39e856,null));};exports[_0x9657('0x10e')]=function(_0x1eb4da,_0x32c0de,_0x5608db){var _0x41fcac={'raw':![],'where':{}};var _0x378a66={};var _0x364803={'count':0x0,'rows':[]};return db[_0x9657('0x50')][_0x9657('0xc3')]({'where':{'id':_0x1eb4da[_0x9657('0xbd')]['id']}})[_0x9657('0x20')](handleEntityNotFound(_0x32c0de,null))[_0x9657('0x20')](function(_0x2f5cd6){if(_0x2f5cd6){_0x378a66['model']=_[_0x9657('0x55')](db[_0x9657('0xd2')][_0x9657('0x51')]);_0x378a66[_0x9657('0x54')]=_[_0x9657('0x55')](_0x1eb4da['query']);_0x378a66[_0x9657('0x56')]=_[_0x9657('0x57')](_0x378a66[_0x9657('0x58')],_0x378a66[_0x9657('0x54')]);_0x41fcac['attributes']=_[_0x9657('0x57')](_0x378a66[_0x9657('0x58')],qs[_0x9657('0x5a')](_0x1eb4da[_0x9657('0x54')][_0x9657('0x5a')]));_0x41fcac[_0x9657('0x59')]=_0x41fcac['attributes'][_0x9657('0x5b')]?_0x41fcac[_0x9657('0x59')]:_0x378a66[_0x9657('0x58')];if(!_0x1eb4da[_0x9657('0x54')][_0x9657('0x10f')](_0x9657('0x5c'))){_0x41fcac[_0x9657('0x31')]=qs[_0x9657('0x31')](_0x1eb4da[_0x9657('0x54')][_0x9657('0x31')]);_0x41fcac[_0x9657('0x30')]=qs[_0x9657('0x30')](_0x1eb4da[_0x9657('0x54')][_0x9657('0x30')]);}_0x41fcac[_0x9657('0x5d')]=qs[_0x9657('0x5e')](_0x1eb4da[_0x9657('0x54')][_0x9657('0x5e')]);_0x41fcac['where']=qs[_0x9657('0x56')](_['pick'](_0x1eb4da[_0x9657('0x54')],_0x378a66[_0x9657('0x56')]));_0x41fcac[_0x9657('0x5f')]['ChatInteractionId']=_0x2f5cd6['id'];if(_0x1eb4da['query'][_0x9657('0x110')]){_0x41fcac[_0x9657('0x5f')]=_[_0x9657('0xae')](_0x41fcac[_0x9657('0x5f')],{'$or':_['map'](_0x41fcac[_0x9657('0x59')],function(_0x2de65d){var _0x284a19={};_0x284a19[_0x2de65d]={'$like':'%'+_0x1eb4da['query'][_0x9657('0x110')]+'%'};return _0x284a19;})});}if(_0x1eb4da[_0x9657('0x54')][_0x9657('0x111')]){var _0x3ed185=_0x1eb4da[_0x9657('0x54')][_0x9657('0x111')]['split'](',');var _0x202551={};_0x202551[_0x3ed185[0x0]]={'$gte':moment(_0x3ed185[0x1])[_0x9657('0xe9')](_0x9657('0x112'))};_0x41fcac['where']=_[_0x9657('0xae')](_0x41fcac[_0x9657('0x5f')],_0x202551);}_0x41fcac=_[_0x9657('0xae')]({},_0x41fcac,_0x1eb4da[_0x9657('0x113')]);return db[_0x9657('0xd2')][_0x9657('0x32')]({'where':_0x41fcac[_0x9657('0x5f')]})['then'](function(_0x408a88){_0x364803['count']=_0x408a88;if(_0x1eb4da[_0x9657('0x54')][_0x9657('0x114')]){_0x41fcac[_0x9657('0xbe')]=[{'all':!![]}];}return db[_0x9657('0xd2')][_0x9657('0x115')](_0x41fcac);})[_0x9657('0x20')](function(_0xe073c7){_0x364803['rows']=_0xe073c7;return _0x364803;});}})[_0x9657('0x20')](respondWithFilteredResult(_0x32c0de,_0x41fcac))[_0x9657('0x2b')](handleError(_0x32c0de,null));};exports['getMyMessages']=function(_0x38be7b,_0x22094e,_0x277f5e){var _0x1a1bb5={'where':{}},_0x2b30f5={},_0x5df106={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x9657('0xc3')]({'where':{'id':_0x38be7b[_0x9657('0xbd')]['id']}})['then'](handleEntityNotFound(_0x22094e,null))[_0x9657('0x20')](function(_0x456fe6){if(_0x456fe6){_0x2b30f5[_0x9657('0x58')]=_[_0x9657('0x55')](db[_0x9657('0xd2')][_0x9657('0x51')]);_0x2b30f5[_0x9657('0x54')]=_[_0x9657('0x55')](_0x38be7b[_0x9657('0x54')]);_0x2b30f5[_0x9657('0x56')]=_[_0x9657('0x57')](_0x2b30f5[_0x9657('0x58')],_0x2b30f5['query']);_0x1a1bb5['attributes']=_[_0x9657('0x57')](_0x2b30f5[_0x9657('0x58')],qs[_0x9657('0x5a')](_0x38be7b['query'][_0x9657('0x5a')]));_0x1a1bb5['attributes']=_0x1a1bb5[_0x9657('0x59')][_0x9657('0x5b')]?_0x1a1bb5[_0x9657('0x59')]:_0x2b30f5[_0x9657('0x58')];if(!_0x38be7b[_0x9657('0x54')][_0x9657('0x10f')]('nolimit')){_0x1a1bb5[_0x9657('0x31')]=qs[_0x9657('0x31')](_0x38be7b[_0x9657('0x54')][_0x9657('0x31')]);_0x1a1bb5[_0x9657('0x30')]=qs['offset'](_0x38be7b['query'][_0x9657('0x30')]);}_0x1a1bb5['order']=qs[_0x9657('0x5e')](_0x38be7b[_0x9657('0x54')][_0x9657('0x5e')]);_0x1a1bb5[_0x9657('0x5f')]=qs[_0x9657('0x56')](_[_0x9657('0x60')](_0x38be7b[_0x9657('0x54')],_0x2b30f5[_0x9657('0x56')]));_0x1a1bb5['where']['ChatInteractionId']=_0x456fe6['id'];if(_0x38be7b[_0x9657('0x54')]['filter']){_0x1a1bb5[_0x9657('0x5f')]=_['merge'](_0x1a1bb5[_0x9657('0x5f')],{'$or':_[_0x9657('0x40')](_0x1a1bb5[_0x9657('0x59')],function(_0xc8af0b){var _0x5002a3={};_0x5002a3[_0xc8af0b]={'$like':'%'+_0x38be7b[_0x9657('0x54')][_0x9657('0x110')]+'%'};return _0x5002a3;})});}_0x1a1bb5[_0x9657('0x5f')][_0x9657('0xf9')]=![];if(_0x38be7b[_0x9657('0x54')]['id']){_0x1a1bb5[_0x9657('0x5f')]['id']={'$gt':_0x38be7b[_0x9657('0x54')]['id']};}_0x1a1bb5=_['merge']({},_0x1a1bb5,_0x38be7b['options']);return db[_0x9657('0xd2')][_0x9657('0x32')]({'where':_0x1a1bb5[_0x9657('0x5f')]})[_0x9657('0x20')](function(_0x33104c){_0x5df106[_0x9657('0x32')]=_0x33104c;_0x1a1bb5[_0x9657('0xbe')]=[];if(_0x38be7b[_0x9657('0x54')][_0x9657('0x116')]){_0x1a1bb5[_0x9657('0xbe')][_0x9657('0xbb')]({'model':db[_0x9657('0xed')],'as':_0x9657('0xed'),'attributes':['id',_0x9657('0x41'),_0x9657('0xf5')]});}if(_0x38be7b[_0x9657('0x54')][_0x9657('0x114')]){_0x1a1bb5[_0x9657('0xbe')]=[{'all':!![]}];}return db[_0x9657('0xd2')][_0x9657('0x115')](_0x1a1bb5);})[_0x9657('0x20')](function(_0xe369d3){_0x5df106[_0x9657('0x117')]=_0xe369d3;return _0x5df106;});}})[_0x9657('0x20')](respondWithFilteredResult(_0x22094e,_0x1a1bb5))[_0x9657('0x2b')](handleError(_0x22094e,null));};exports[_0x9657('0x118')]=function(_0x4fccc8,_0x367d66,_0xb90bbc){return db['ChatInteraction']['find']({'where':{'id':_0x4fccc8[_0x9657('0xbd')]['id']}})[_0x9657('0x20')](handleEntityNotFound(_0x367d66,null))[_0x9657('0x20')](function(_0x299d51){if(_0x299d51){return _0x299d51[_0x9657('0x119')](_0x4fccc8['body'][_0x9657('0x10c')],_[_0x9657('0x10d')](_0x4fccc8[_0x9657('0x8d')],[_0x9657('0x10c'),'id'])||{})[_0x9657('0x11a')](function(){return db['Tag'][_0x9657('0x115')]({'attributes':['id','name',_0x9657('0x63')],'where':{'id':_0x4fccc8[_0x9657('0x8d')]['ids']}});})[_0x9657('0x20')](function(_0x279727){socket[_0x9657('0x11b')](_0x9657('0x11c'),{'id':Number(_0x4fccc8[_0x9657('0xbd')]['id']),'tags':_0x279727||[]});return{'id':Number(_0x4fccc8['params']['id']),'tags':_0x279727||[]};});}})['then'](respondWithResult(_0x367d66,null))[_0x9657('0x2b')](handleError(_0x367d66,null));};exports['removeTags']=function(_0x5da13b,_0x3817e7,_0x5ce294){return db[_0x9657('0x50')][_0x9657('0x7a')]({'where':{'id':_0x5da13b['params']['id']}})[_0x9657('0x20')](handleEntityNotFound(_0x3817e7,null))[_0x9657('0x20')](function(_0x231c0f){if(_0x231c0f){return _0x231c0f[_0x9657('0x11d')](_0x5da13b[_0x9657('0x54')][_0x9657('0x10c')]);}})['then'](respondWithStatusCode(_0x3817e7,null))[_0x9657('0x2b')](handleError(_0x3817e7,null));};exports[_0x9657('0xe5')]=function(_0x5e2bcd,_0x1df534){var _0x24867f=moment()[_0x9657('0x11e')]()['toString']();var _0x3d2aab=path['join'](config[_0x9657('0xe1')],'server',_0x9657('0x11f'),'tmp');var _0x3b8adb=path['join'](config[_0x9657('0xe1')],_0x9657('0x120'),_0x9657('0x11f'),_0x9657('0x121'));var _0x1e3a22=path[_0x9657('0xe0')](_0x3d2aab,_0x24867f);var _0x16959b=util[_0x9657('0xe9')](_0x9657('0x122'),_0x5e2bcd[_0x9657('0xbd')]['id'],_0x24867f);var _0x16a207=path[_0x9657('0xe0')](_0x3d2aab,_0x16959b);var _0x4f8ada=[];_0x4f8ada[_0x9657('0xbb')]({'model':db[_0x9657('0xed')],'as':'User','attributes':['id',_0x9657('0x41')],'raw':!![]});_0x4f8ada[_0x9657('0xbb')]({'model':db['CmContact'],'as':_0x9657('0x80'),'attributes':['id','firstName',_0x9657('0x123')],'raw':!![]});if(_0x5e2bcd[_0x9657('0x54')][_0x9657('0x121')]){_0x4f8ada[_0x9657('0xbb')]({'model':db[_0x9657('0xdb')],'as':_0x9657('0xdb'),'raw':!![]});}var _0x5f5dd7=[{'model':db[_0x9657('0xd2')],'as':_0x9657('0xec'),'attributes':['id',_0x9657('0x8d'),_0x9657('0x93'),_0x9657('0xf8'),_0x9657('0xf9'),_0x9657('0x96')],'include':_0x4f8ada}];_0x5f5dd7['push']({'model':db[_0x9657('0xc2')],'as':_0x9657('0x124'),'attributes':['id',_0x9657('0x3a')]});_0x5f5dd7[_0x9657('0xbb')]({'model':db[_0x9657('0xed')],'as':_0x9657('0x125'),'attributes':['id',_0x9657('0x41')]});return db[_0x9657('0x50')][_0x9657('0x7a')]({'where':{'id':_0x5e2bcd[_0x9657('0xbd')]['id']},'include':_0x5f5dd7})['then'](handleEntityNotFound(_0x1df534,null))['then'](function(_0x50c0b0){if(_0x50c0b0){var _0xead43d=_0x50c0b0[_0x9657('0x126')]({'plain':!![]});fs[_0x9657('0x127')](_0x1e3a22);var _0xfbabbf={'channel':_0x9657('0x128'),'account':_0xead43d['Account'][_0x9657('0x3a')],'agent':_0xead43d[_0x9657('0x125')]?_0xead43d[_0x9657('0x125')]['fullname']:_0x9657('0x129'),'createdAt':moment(_0xead43d[_0x9657('0x93')])[_0x9657('0xe9')](_0x9657('0x112'))[_0x9657('0xac')](),'closedAt':_0xead43d[_0x9657('0x4c')]?moment(_0xead43d[_0x9657('0x12a')])[_0x9657('0xe9')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9657('0xac')]():'','disposition':_0xead43d[_0x9657('0x4d')],'chatInfo':{'browser':_0xead43d[_0x9657('0x12b')],'os':_0xead43d['osName'],'referer':_0xead43d[_0x9657('0x12c')],'customerIp':_0xead43d[_0x9657('0x12d')],'customerPort':_0xead43d[_0x9657('0x12e')]?_0xead43d[_0x9657('0x12e')]:_0x9657('0x129')},'messages':_(_0xead43d[_0x9657('0xec')])[_0x9657('0x12f')]()[_0x9657('0x110')]({'secret':![]})[_0x9657('0x40')](function(_0x4ebb6d){if(_0x4ebb6d['Attachment']){var _0x18bc40=path['join'](_0x3b8adb,_0x4ebb6d[_0x9657('0xdb')][_0x9657('0xe4')]);if(fs[_0x9657('0x130')](_0x18bc40)){fs[_0x9657('0x131')](_0x18bc40)['pipe'](fs[_0x9657('0x132')](path[_0x9657('0xe0')](_0x1e3a22,_0x4ebb6d[_0x9657('0xdb')][_0x9657('0xe4')])));}}return{'date':moment(_0x4ebb6d[_0x9657('0x93')])['format'](_0x9657('0x112'))[_0x9657('0xac')](),'sender':_0x4ebb6d[_0x9657('0xf8')]===_0x9657('0xd1')?_0x4ebb6d[_0x9657('0xed')]?_0x4ebb6d['User'][_0x9657('0x41')]:_0x9657('0xf4'):_0x4ebb6d[_0x9657('0x80')]['firstName']+(_0x4ebb6d[_0x9657('0x80')][_0x9657('0x123')]?'\x20'+_0x4ebb6d['Contact'][_0x9657('0x123')]:''),'body':_0x4ebb6d[_0x9657('0xdb')]?_0x4ebb6d[_0x9657('0xdb')][_0x9657('0xe4')]:_0x4ebb6d[_0x9657('0x8d')],'direction':_0x4ebb6d[_0x9657('0xf8')]===_0x9657('0xd1')?'A':'C','secret':_0x4ebb6d[_0x9657('0xf9')],'read':_0x4ebb6d[_0x9657('0x96')],'attachment':_0x4ebb6d[_0x9657('0xdb')]};})[_0x9657('0x7c')]()};return ejs[_0x9657('0x133')](path[_0x9657('0xe0')](config[_0x9657('0xe1')],_0x9657('0x120'),'views',_0x9657('0x134')),{'interaction':_0xfbabbf})[_0x9657('0x20')](function(_0x5b58a2){var _0x18e4cf=path[_0x9657('0xe0')](_0x1e3a22,_0x9657('0x135')+_0xead43d['id']+'-'+_0x24867f+_0x9657('0x136'));var _0x574878={'path':_0x18e4cf,'channel':_0x9657('0x128'),'interactionId':_0xead43d['id']};return pdf[_0x9657('0x137')](_0x5b58a2,_0x574878);})[_0x9657('0x20')](function(){return new BPromise(function(_0x4b68e3,_0x1145fd){zipdir(_0x1e3a22,{'saveTo':_0x16a207},function(_0x4500fb,_0x5588ac){if(_0x4500fb)return _0x1145fd(_0x4500fb);return _0x4b68e3(_0x5588ac);});})[_0x9657('0x20')](function(){return new BPromise(function(_0x1e9f13,_0x2a4da5){rimraf(_0x1e3a22,function(_0x57804c){if(_0x57804c)_0x2a4da5(_0x57804c);return _0x1e9f13();});});})[_0x9657('0x20')](function(){return _0x1df534[_0x9657('0xe5')](_0x16a207,_0x16959b,function(_0x3de8fa){if(_0x3de8fa){console[_0x9657('0x138')](_0x9657('0x139'),_0x3de8fa);}else{fs['unlinkSync'](_0x16a207);}});});});}else{return _0x1df534['sendStatus'](0xc8);}})[_0x9657('0x2b')](handleError(_0x1df534,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index d320d80..94f7e0a 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 _0xeedd=['ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','emit','catch','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x1e8d54,_0x334a60){var _0x58c69f=function(_0x52abc){while(--_0x52abc){_0x1e8d54['push'](_0x1e8d54['shift']());}};_0x58c69f(++_0x334a60);}(_0xeedd,0xa0));var _0xdeed=function(_0x5a5af1,_0xd66469){_0x5a5af1=_0x5a5af1-0x0;var _0xbdc6b4=_0xeedd[_0x5a5af1];return _0xbdc6b4;};'use strict';var EventEmitter=require(_0xdeed('0x0'));var ChatInteraction=require(_0xdeed('0x1'))['db'][_0xdeed('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0xdeed('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xdeed('0x4')](0x0);var events={'afterCreate':_0xdeed('0x5'),'afterUpdate':_0xdeed('0x6'),'afterDestroy':_0xdeed('0x7')};function emitEvent(_0x2128a1){return function(_0x21380a,_0x7155ac,_0x563fcf){_0x21380a[_0xdeed('0x8')]({'attributes':['id'],'raw':!![]})[_0xdeed('0x9')](function(_0x78f120){_0x21380a[_0xdeed('0xa')](_0xdeed('0xb'),_0x78f120[_0xdeed('0xc')](function(_0x25e0c6){return{'id':_0x25e0c6['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x21380a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x229efe){_0x21380a['setDataValue'](_0xdeed('0xd'),_0x229efe['length']);ChatInteractionEvents[_0xdeed('0xe')](_0x2128a1+':'+_0x21380a['id'],_0x21380a);ChatInteractionEvents['emit'](_0x2128a1,_0x21380a);_0x563fcf(null);})[_0xdeed('0xf')](_0x563fcf(null));};}for(var e in events){if(events[_0xdeed('0x10')](e)){var event=events[e];ChatInteraction[_0xdeed('0x11')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x3674=['events','../../mysqldb','ChatMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','emit','catch','hasOwnProperty','hook'];(function(_0x1be14b,_0xf3c294){var _0x18d30d=function(_0x249c39){while(--_0x249c39){_0x1be14b['push'](_0x1be14b['shift']());}};_0x18d30d(++_0xf3c294);}(_0x3674,0x1e0));var _0x4367=function(_0x2f1ac4,_0x236a72){_0x2f1ac4=_0x2f1ac4-0x0;var _0x18e1a5=_0x3674[_0x2f1ac4];return _0x18e1a5;};'use strict';var EventEmitter=require(_0x4367('0x0'));var ChatInteraction=require(_0x4367('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x4367('0x1'))['db'][_0x4367('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x4367('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4367('0x4'),'afterDestroy':_0x4367('0x5')};function emitEvent(_0x1c0c92){return function(_0x1542a7,_0x255a17,_0x2c2f0e){_0x1542a7[_0x4367('0x6')]({'attributes':['id'],'raw':!![]})[_0x4367('0x7')](function(_0x77ce6c){_0x1542a7[_0x4367('0x8')](_0x4367('0x9'),_0x77ce6c[_0x4367('0xa')](function(_0x4d363f){return{'id':_0x4d363f['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x1542a7['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4367('0x7')](function(_0x13b23c){_0x1542a7['setDataValue'](_0x4367('0xb'),_0x13b23c['length']);ChatInteractionEvents['emit'](_0x1c0c92+':'+_0x1542a7['id'],_0x1542a7);ChatInteractionEvents[_0x4367('0xc')](_0x1c0c92,_0x1542a7);_0x2c2f0e(null);})[_0x4367('0xd')](_0x2c2f0e(null));};}for(var e in events){if(events[_0x4367('0xe')](e)){var event=events[e];ChatInteraction[_0x4367('0xf')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 5504d93..2822469 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 _0xaed7=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','chat_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x52fcdd,_0x283934){var _0x598f0a=function(_0x7d9235){while(--_0x7d9235){_0x52fcdd['push'](_0x52fcdd['shift']());}};_0x598f0a(++_0x283934);}(_0xaed7,0x11e));var _0x7aed=function(_0x1c6949,_0x2e1ae7){_0x1c6949=_0x1c6949-0x0;var _0x41d16a=_0xaed7[_0x1c6949];return _0x41d16a;};'use strict';var _=require(_0x7aed('0x0'));var util=require('util');var logger=require(_0x7aed('0x1'))(_0x7aed('0x2'));var moment=require(_0x7aed('0x3'));var BPromise=require(_0x7aed('0x4'));var rp=require(_0x7aed('0x5'));var fs=require('fs');var path=require(_0x7aed('0x6'));var rimraf=require(_0x7aed('0x7'));var config=require(_0x7aed('0x8'));var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x55503a,_0x4001a0){return _0x55503a['define']('ChatInteraction',attributes,{'tableName':_0x7aed('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4b00c6,_0x341bef,_0x1bb78b){if(_0x4b00c6[_0x7aed('0xa')](_0x7aed('0xb'))){_0x4b00c6[_0x7aed('0xc')]=moment()['format'](_0x7aed('0xd'));}_0x1bb78b(null,_0x4b00c6);}},'charset':_0x7aed('0xe'),'collate':_0x7aed('0xf')});}; \ No newline at end of file +var _0xc605=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','util','../../config/logger','bluebird','request-promise','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xc605,0x110));var _0x5c60=function(_0x241d01,_0x58d8b8){_0x241d01=_0x241d01-0x0;var _0x410c5a=_0xc605[_0x241d01];return _0x410c5a;};'use strict';var _=require('lodash');var util=require(_0x5c60('0x0'));var logger=require(_0x5c60('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5c60('0x2'));var rp=require(_0x5c60('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5c60('0x4'));module[_0x5c60('0x5')]=function(_0x56686a,_0x16809e){return _0x56686a['define'](_0x5c60('0x6'),attributes,{'tableName':_0x5c60('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xd6861e,_0xfdf810,_0x1ae845){if(_0xd6861e[_0x5c60('0x8')](_0x5c60('0x9'))){_0xd6861e[_0x5c60('0xa')]=moment()[_0x5c60('0xb')](_0x5c60('0xc'));}_0x1ae845(null,_0xd6861e);}},'charset':'utf8mb4','collate':_0x5c60('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 37c4acc..2207703 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 _0xd9ff=['result','catch','UpdateChatInteraction','ChatInteraction','body','options','raw','where','attributes','limit','debug','find','then','ids','spread','AddTags','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatInteraction,\x20%s,\x20%s'];(function(_0x5436f2,_0x5e07a6){var _0x5c526e=function(_0x5769ff){while(--_0x5769ff){_0x5436f2['push'](_0x5436f2['shift']());}};_0x5c526e(++_0x5e07a6);}(_0xd9ff,0x196));var _0xfd9f=function(_0x43c33a,_0x3793d8){_0x43c33a=_0x43c33a-0x0;var _0x227317=_0xd9ff[_0x43c33a];return _0x227317;};'use strict';var _=require(_0xfd9f('0x0'));var util=require('util');var moment=require(_0xfd9f('0x1'));var BPromise=require(_0xfd9f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd9f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd9f('0x4'));var logger=require(_0xfd9f('0x5'))('rpc');var config=require(_0xfd9f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfd9f('0x7')][_0xfd9f('0x8')]({'port':0x232a});config[_0xfd9f('0x9')]=_[_0xfd9f('0xa')](config['redis'],{'host':_0xfd9f('0xb'),'port':0x18eb});var socket=require(_0xfd9f('0xc'))(new Redis(config['redis']));require(_0xfd9f('0xd'))[_0xfd9f('0xe')](socket);function respondWithRpcPromise(_0xb25971,_0x3886a4,_0x55d2a4){return new BPromise(function(_0x40bb,_0x530569){return client[_0xfd9f('0xf')](_0xb25971,_0x55d2a4)['then'](function(_0x19eabf){logger[_0xfd9f('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x3886a4,_0xfd9f('0x11'));logger['debug'](_0xfd9f('0x12'),_0x3886a4,'request\x20sent',JSON[_0xfd9f('0x13')](_0x19eabf));if(_0x19eabf[_0xfd9f('0x14')]){if(_0x19eabf[_0xfd9f('0x14')]['code']===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x3886a4,_0x19eabf[_0xfd9f('0x14')][_0xfd9f('0x15')]);return _0x530569(_0x19eabf[_0xfd9f('0x14')][_0xfd9f('0x15')]);}logger[_0xfd9f('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x3886a4,_0x19eabf[_0xfd9f('0x14')]['message']);return _0x40bb(_0x19eabf['error']['message']);}else{logger[_0xfd9f('0x10')](_0xfd9f('0x16'),_0x3886a4,_0xfd9f('0x11'));_0x40bb(_0x19eabf[_0xfd9f('0x17')][_0xfd9f('0x15')]);}})[_0xfd9f('0x18')](function(_0xec2256){logger[_0xfd9f('0x14')](_0xfd9f('0x16'),_0x3886a4,_0xec2256);_0x530569(_0xec2256);});});}exports[_0xfd9f('0x19')]=function(_0x5f146a){var _0x2a608=this;return new Promise(function(_0x2a8415,_0x5bd658){return db[_0xfd9f('0x1a')]['update'](_0x5f146a[_0xfd9f('0x1b')],{'raw':_0x5f146a[_0xfd9f('0x1c')]?_0x5f146a[_0xfd9f('0x1c')][_0xfd9f('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f146a['options']?_0x5f146a[_0xfd9f('0x1c')][_0xfd9f('0x1e')]||null:null,'attributes':_0x5f146a[_0xfd9f('0x1c')]?_0x5f146a[_0xfd9f('0x1c')][_0xfd9f('0x1f')]||null:null,'limit':_0x5f146a[_0xfd9f('0x1c')]?_0x5f146a['options'][_0xfd9f('0x20')]||null:null})['then'](function(_0x30a0b4){logger['info'](_0xfd9f('0x19'),_0x5f146a);logger[_0xfd9f('0x21')](_0xfd9f('0x19'),_0x5f146a,JSON[_0xfd9f('0x13')](_0x30a0b4));_0x2a8415(_0x30a0b4);})[_0xfd9f('0x18')](function(_0x50af4b){logger[_0xfd9f('0x14')](_0xfd9f('0x19'),_0x50af4b[_0xfd9f('0x15')],_0x5f146a);_0x5bd658(_0x2a608['error'](0x1f4,_0x50af4b[_0xfd9f('0x15')]));});});};exports['AddTagsToChatInteraction']=function(_0x183e52){return new Promise(function(_0x3a9c38,_0x1cc4f7){return db[_0xfd9f('0x1a')][_0xfd9f('0x22')]({'where':_0x183e52[_0xfd9f('0x1c')]?_0x183e52[_0xfd9f('0x1c')]['where']||null:null})[_0xfd9f('0x23')](function(_0x575913){if(_0x575913){return _0x575913['addTags'](_0x183e52[_0xfd9f('0x1b')][_0xfd9f('0x24')],_['omit'](_0x183e52['body'],[_0xfd9f('0x24'),'id'])||{});}})[_0xfd9f('0x25')](function(_0x4101d8){logger[_0xfd9f('0x10')]('AddTags',_0x183e52);logger[_0xfd9f('0x21')](_0xfd9f('0x26'),_0x183e52,JSON[_0xfd9f('0x13')](_0x4101d8));_0x3a9c38(_0x4101d8);})[_0xfd9f('0x18')](function(_0x5d54a8){logger[_0xfd9f('0x14')](_0xfd9f('0x26'),_0x5d54a8['message'],_0x183e52);_0x1cc4f7(_this[_0xfd9f('0x14')](0x1f4,_0x5d54a8['message']));});});}; \ No newline at end of file +var _0x4233=['request\x20sent','debug','stringify','error','code','message','result','catch','ChatInteraction','body','options','where','attributes','UpdateChatInteraction','find','ids','spread','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatInteraction,\x20%s,\x20%s'];(function(_0x57bb89,_0x2e6ba4){var _0x1dfe15=function(_0x39f815){while(--_0x39f815){_0x57bb89['push'](_0x57bb89['shift']());}};_0x1dfe15(++_0x2e6ba4);}(_0x4233,0xcb));var _0x3423=function(_0x538468,_0x505ab5){_0x538468=_0x538468-0x0;var _0x24c41b=_0x4233[_0x538468];return _0x24c41b;};'use strict';var _=require(_0x3423('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3423('0x1'));var rs=require(_0x3423('0x2'));var fs=require('fs');var Redis=require(_0x3423('0x3'));var db=require(_0x3423('0x4'))['db'];var utils=require(_0x3423('0x5'));var logger=require(_0x3423('0x6'))('rpc');var config=require(_0x3423('0x7'));var jayson=require(_0x3423('0x8'));var client=jayson['client'][_0x3423('0x9')]({'port':0x232a});config[_0x3423('0xa')]=_[_0x3423('0xb')](config[_0x3423('0xa')],{'host':_0x3423('0xc'),'port':0x18eb});var socket=require(_0x3423('0xd'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0x3423('0xe')](socket);function respondWithRpcPromise(_0xa6e2cc,_0x5ceb65,_0x5b7031){return new BPromise(function(_0x2079f8,_0x575993){return client[_0x3423('0xf')](_0xa6e2cc,_0x5b7031)[_0x3423('0x10')](function(_0x3eb897){logger[_0x3423('0x11')](_0x3423('0x12'),_0x5ceb65,_0x3423('0x13'));logger[_0x3423('0x14')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x5ceb65,_0x3423('0x13'),JSON[_0x3423('0x15')](_0x3eb897));if(_0x3eb897['error']){if(_0x3eb897[_0x3423('0x16')][_0x3423('0x17')]===0x1f4){logger[_0x3423('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x5ceb65,_0x3eb897[_0x3423('0x16')][_0x3423('0x18')]);return _0x575993(_0x3eb897[_0x3423('0x16')][_0x3423('0x18')]);}logger[_0x3423('0x16')](_0x3423('0x12'),_0x5ceb65,_0x3eb897[_0x3423('0x16')][_0x3423('0x18')]);return _0x2079f8(_0x3eb897[_0x3423('0x16')]['message']);}else{logger[_0x3423('0x11')](_0x3423('0x12'),_0x5ceb65,'request\x20sent');_0x2079f8(_0x3eb897[_0x3423('0x19')]['message']);}})[_0x3423('0x1a')](function(_0x1459b8){logger[_0x3423('0x16')](_0x3423('0x12'),_0x5ceb65,_0x1459b8);_0x575993(_0x1459b8);});});}exports['UpdateChatInteraction']=function(_0x5891bc){var _0x40e096=this;return new Promise(function(_0x637d35,_0xeede02){return db[_0x3423('0x1b')]['update'](_0x5891bc[_0x3423('0x1c')],{'raw':_0x5891bc[_0x3423('0x1d')]?_0x5891bc[_0x3423('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5891bc['options']?_0x5891bc['options'][_0x3423('0x1e')]||null:null,'attributes':_0x5891bc[_0x3423('0x1d')]?_0x5891bc[_0x3423('0x1d')][_0x3423('0x1f')]||null:null,'limit':_0x5891bc[_0x3423('0x1d')]?_0x5891bc[_0x3423('0x1d')]['limit']||null:null})[_0x3423('0x10')](function(_0x4f3447){logger['info'](_0x3423('0x20'),_0x5891bc);logger[_0x3423('0x14')]('UpdateChatInteraction',_0x5891bc,JSON[_0x3423('0x15')](_0x4f3447));_0x637d35(_0x4f3447);})[_0x3423('0x1a')](function(_0x4ad504){logger[_0x3423('0x16')](_0x3423('0x20'),_0x4ad504[_0x3423('0x18')],_0x5891bc);_0xeede02(_0x40e096[_0x3423('0x16')](0x1f4,_0x4ad504[_0x3423('0x18')]));});});};exports['AddTagsToChatInteraction']=function(_0x25d101){return new Promise(function(_0x5679fd,_0x4a4008){return db[_0x3423('0x1b')][_0x3423('0x21')]({'where':_0x25d101[_0x3423('0x1d')]?_0x25d101['options'][_0x3423('0x1e')]||null:null})[_0x3423('0x10')](function(_0x227abc){if(_0x227abc){return _0x227abc['addTags'](_0x25d101[_0x3423('0x1c')][_0x3423('0x22')],_['omit'](_0x25d101[_0x3423('0x1c')],[_0x3423('0x22'),'id'])||{});}})[_0x3423('0x23')](function(_0x1c8a84){logger[_0x3423('0x11')]('AddTags',_0x25d101);logger['debug'](_0x3423('0x24'),_0x25d101,JSON['stringify'](_0x1c8a84));_0x5679fd(_0x1c8a84);})['catch'](function(_0x2811c5){logger['error'](_0x3423('0x24'),_0x2811c5[_0x3423('0x18')],_0x25d101);_0x4a4008(_this[_0x3423('0x16')](0x1f4,_0x2811c5[_0x3423('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index d5be22b..31a6310 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 _0x58fb=['remove','update','emit','register','chatInteraction:','./chatInteraction.events'];(function(_0x3980b4,_0x4dab3c){var _0xc10171=function(_0x261fb1){while(--_0x261fb1){_0x3980b4['push'](_0x3980b4['shift']());}};_0xc10171(++_0x4dab3c);}(_0x58fb,0xef));var _0xb58f=function(_0x49db95,_0xaad728){_0x49db95=_0x49db95-0x0;var _0x8af73=_0x58fb[_0x49db95];return _0x8af73;};'use strict';var ChatInteractionEvents=require(_0xb58f('0x0'));var events=['save',_0xb58f('0x1'),_0xb58f('0x2')];function createListener(_0x29664e,_0x3a2f82){return function(_0x3e69a8){_0x3a2f82[_0xb58f('0x3')](_0x29664e,_0x3e69a8);};}function removeListener(_0x63f5f0,_0x305124){return function(){ChatInteractionEvents['removeListener'](_0x63f5f0,_0x305124);};}exports[_0xb58f('0x4')]=function(_0x315b8d){for(var _0x18a932=0x0,_0x96716c=events['length'];_0x18a932<_0x96716c;_0x18a932++){var _0x46fbc3=events[_0x18a932];var _0x4b538e=createListener(_0xb58f('0x5')+_0x46fbc3,_0x315b8d);ChatInteractionEvents['on'](_0x46fbc3,_0x4b538e);}}; \ No newline at end of file +var _0xc185=['emit','chatInteraction:','save','remove'];(function(_0x45502d,_0x5ca8b7){var _0x8813c9=function(_0xa53455){while(--_0xa53455){_0x45502d['push'](_0x45502d['shift']());}};_0x8813c9(++_0x5ca8b7);}(_0xc185,0x96));var _0x5c18=function(_0xf6237a,_0x1baa45){_0xf6237a=_0xf6237a-0x0;var _0xfa662f=_0xc185[_0xf6237a];return _0xfa662f;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x5c18('0x0'),_0x5c18('0x1'),'update'];function createListener(_0x1c5d9a,_0x3557b5){return function(_0x6551e7){_0x3557b5[_0x5c18('0x2')](_0x1c5d9a,_0x6551e7);};}function removeListener(_0x12682b,_0x40d99d){return function(){ChatInteractionEvents['removeListener'](_0x12682b,_0x40d99d);};}exports['register']=function(_0x4c5e6b){for(var _0xc354ac=0x0,_0x36584d=events['length'];_0xc354ac<_0x36584d;_0xc354ac++){var _0x1360a=events[_0xc354ac];var _0x3bf836=createListener(_0x5c18('0x3')+_0x1360a,_0x4c5e6b);ChatInteractionEvents['on'](_0x1360a,_0x3bf836);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 596dca4..d2da444 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 _0x9c77=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','/:id/attachment_download','isChatInteractionAuthorized','/:id/messages','getMessages','/:id/my_messages','getMyMessages','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','server/files/attachments/','format','%s-%s','/:id/attachment_upload','single','file','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','/:id','update','put','/:id/custom_update','/:id/abandon','destroy','delete','multer','util'];(function(_0xf72786,_0x1a0ddd){var _0x113f3e=function(_0x57337a){while(--_0x57337a){_0xf72786['push'](_0xf72786['shift']());}};_0x113f3e(++_0x1a0ddd);}(_0x9c77,0x1c0));var _0x79c7=function(_0x14fae2,_0x3f98ec){_0x14fae2=_0x14fae2-0x0;var _0x194d0b=_0x9c77[_0x14fae2];return _0x194d0b;};'use strict';var multer=require(_0x79c7('0x0'));var util=require(_0x79c7('0x1'));var path=require(_0x79c7('0x2'));var timeout=require(_0x79c7('0x3'));var express=require(_0x79c7('0x4'));var router=express[_0x79c7('0x5')]();var fs_extra=require(_0x79c7('0x6'));var auth=require(_0x79c7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x79c7('0x8'));var controller=require('./chatInteraction.controller');router[_0x79c7('0x9')]('/',auth['isAuthenticated'](),controller[_0x79c7('0xa')]);router[_0x79c7('0x9')](_0x79c7('0xb'),auth[_0x79c7('0xc')](),controller[_0x79c7('0xd')]);router['get']('/:id',auth['isChatInteractionAuthorized'](),controller[_0x79c7('0xe')]);router[_0x79c7('0x9')](_0x79c7('0xf'),auth[_0x79c7('0x10')](),controller['attachmentDownload']);router[_0x79c7('0x9')](_0x79c7('0x11'),auth[_0x79c7('0xc')](),controller[_0x79c7('0x12')]);router[_0x79c7('0x9')](_0x79c7('0x13'),auth['isChatInteractionAuthorized'](),controller[_0x79c7('0x14')]);router[_0x79c7('0x9')]('/:id/download',auth[_0x79c7('0xc')](),controller['download']);router[_0x79c7('0x15')]('/',auth['isAuthenticated'](),controller[_0x79c7('0x16')]);router[_0x79c7('0x15')](_0x79c7('0x17'),auth[_0x79c7('0xc')](),controller[_0x79c7('0x18')]);var upload=multer({'storage':multer[_0x79c7('0x19')]({'destination':function(_0x209af3,_0xc0dcd1,_0x44e22e){_0x44e22e(null,path[_0x79c7('0x1a')](config['root'],_0x79c7('0x1b')));},'filename':function(_0x8ceeeb,_0x8d10a1,_0x48abfd){_0x48abfd(null,util[_0x79c7('0x1c')](_0x79c7('0x1d'),Date['now'](),_0x8d10a1['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x79c7('0x15')](_0x79c7('0x1e'),upload[_0x79c7('0x1f')](_0x79c7('0x20')),controller['attachmentUpload']);router[_0x79c7('0x15')]('/:id/messages',auth[_0x79c7('0x10')](),controller['addMessage']);router['post'](_0x79c7('0x21'),auth[_0x79c7('0xc')](),interaction[_0x79c7('0x22')](_0x79c7('0x23'),_0x79c7('0x24')),controller[_0x79c7('0x25')]);router['put'](_0x79c7('0x26'),auth[_0x79c7('0xc')](),interaction[_0x79c7('0x22')](_0x79c7('0x23'),'chatinteraction:update'),controller[_0x79c7('0x27')]);router[_0x79c7('0x28')](_0x79c7('0x29'),controller['customUpdate']);router[_0x79c7('0x28')](_0x79c7('0x2a'),auth[_0x79c7('0x10')](),controller['abandon']);router['put']('/:id/close',controller['close']);router['delete'](_0x79c7('0x26'),auth[_0x79c7('0xc')](),interaction[_0x79c7('0x22')]('chat','chatinteraction:destroy'),controller[_0x79c7('0x2b')]);router[_0x79c7('0x2c')]('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xce51=['tracked','chatinteraction:addtags','addTags','/:id','chat','update','put','customUpdate','abandon','/:id/close','chatinteraction:destroy','destroy','delete','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index','isAuthenticated','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','format','%s-%s','now','originalname','replace','single','attachmentUpload','addMessage','/:id/tags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce51,0x1cf));var _0x1ce5=function(_0x336264,_0x32e1d9){_0x336264=_0x336264-0x0;var _0x53cf91=_0xce51[_0x336264];return _0x53cf91;};'use strict';var multer=require('multer');var util=require(_0x1ce5('0x0'));var path=require(_0x1ce5('0x1'));var timeout=require(_0x1ce5('0x2'));var express=require(_0x1ce5('0x3'));var router=express[_0x1ce5('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1ce5('0x5'));var config=require(_0x1ce5('0x6'));var controller=require(_0x1ce5('0x7'));router[_0x1ce5('0x8')]('/',auth['isAuthenticated'](),controller[_0x1ce5('0x9')]);router[_0x1ce5('0x8')]('/describe',auth[_0x1ce5('0xa')](),controller[_0x1ce5('0xb')]);router[_0x1ce5('0x8')]('/:id',auth[_0x1ce5('0xc')](),controller[_0x1ce5('0xd')]);router[_0x1ce5('0x8')](_0x1ce5('0xe'),auth[_0x1ce5('0xc')](),controller[_0x1ce5('0xf')]);router[_0x1ce5('0x8')](_0x1ce5('0x10'),auth[_0x1ce5('0xa')](),controller[_0x1ce5('0x11')]);router[_0x1ce5('0x8')](_0x1ce5('0x12'),auth[_0x1ce5('0xc')](),controller[_0x1ce5('0x13')]);router[_0x1ce5('0x8')](_0x1ce5('0x14'),auth['isAuthenticated'](),controller[_0x1ce5('0x15')]);router[_0x1ce5('0x16')]('/',auth[_0x1ce5('0xa')](),controller['create']);router[_0x1ce5('0x16')](_0x1ce5('0x17'),auth[_0x1ce5('0xa')](),controller[_0x1ce5('0x18')]);var upload=multer({'storage':multer[_0x1ce5('0x19')]({'destination':function(_0x2b3e87,_0x2f4a47,_0x4f3d96){_0x4f3d96(null,path['join'](config[_0x1ce5('0x1a')],_0x1ce5('0x1b')));},'filename':function(_0x428bb4,_0x40760d,_0x3d7fb9){_0x3d7fb9(null,util[_0x1ce5('0x1c')](_0x1ce5('0x1d'),Date[_0x1ce5('0x1e')](),_0x40760d[_0x1ce5('0x1f')][_0x1ce5('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x1ce5('0x16')]('/:id/attachment_upload',upload[_0x1ce5('0x21')]('file'),controller[_0x1ce5('0x22')]);router[_0x1ce5('0x16')](_0x1ce5('0x10'),auth['isChatInteractionAuthorized'](),controller[_0x1ce5('0x23')]);router[_0x1ce5('0x16')](_0x1ce5('0x24'),auth[_0x1ce5('0xa')](),interaction[_0x1ce5('0x25')]('chat',_0x1ce5('0x26')),controller[_0x1ce5('0x27')]);router['put'](_0x1ce5('0x28'),auth[_0x1ce5('0xa')](),interaction[_0x1ce5('0x25')](_0x1ce5('0x29'),'chatinteraction:update'),controller[_0x1ce5('0x2a')]);router[_0x1ce5('0x2b')]('/:id/custom_update',controller[_0x1ce5('0x2c')]);router['put']('/:id/abandon',auth[_0x1ce5('0xc')](),controller[_0x1ce5('0x2d')]);router[_0x1ce5('0x2b')](_0x1ce5('0x2e'),controller['close']);router['delete'](_0x1ce5('0x28'),auth[_0x1ce5('0xa')](),interaction['tracked']('chat',_0x1ce5('0x2f')),controller[_0x1ce5('0x30')]);router[_0x1ce5('0x31')](_0x1ce5('0x24'),auth[_0x1ce5('0xa')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 258fc6a..9a2fed9 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 _0x3bb4=['BOOLEAN','sequelize','exports','TEXT','medium'];(function(_0x4705aa,_0x5cee68){var _0x2a2ce0=function(_0x484359){while(--_0x484359){_0x4705aa['push'](_0x4705aa['shift']());}};_0x2a2ce0(++_0x5cee68);}(_0x3bb4,0x100));var _0x43bb=function(_0x5a893b,_0x402a16){_0x5a893b=_0x5a893b-0x0;var _0x4943bf=_0x3bb4[_0x5a893b];return _0x4943bf;};'use strict';var Sequelize=require(_0x43bb('0x0'));module[_0x43bb('0x1')]={'body':{'type':Sequelize[_0x43bb('0x2')](_0x43bb('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x43bb('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xd82a=['medium','BOOLEAN','exports','TEXT'];(function(_0xaab2db,_0x2e6b62){var _0x1d079d=function(_0x2db7ab){while(--_0x2db7ab){_0xaab2db['push'](_0xaab2db['shift']());}};_0x1d079d(++_0x2e6b62);}(_0xd82a,0x86));var _0xad82=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xd82a[_0x10004e];return _0x5af990;};'use strict';var Sequelize=require('sequelize');module[_0xad82('0x0')]={'body':{'type':Sequelize[_0xad82('0x1')](_0xad82('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xad82('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 16cf1e5..fb967fd 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 _0x2223=['attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatInternalMessage','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','resourceId','push','createdAt','FromId','ToId','read','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','type','model','map','query','keys','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2223,0xab));var _0x3222=function(_0x10351e,_0x5a2266){_0x10351e=_0x10351e-0x0;var _0x548ca9=_0x2223[_0x10351e];return _0x548ca9;};'use strict';var emlformat=require(_0x3222('0x0'));var rimraf=require(_0x3222('0x1'));var zipdir=require(_0x3222('0x2'));var jsonpatch=require(_0x3222('0x3'));var rp=require(_0x3222('0x4'));var moment=require(_0x3222('0x5'));var BPromise=require(_0x3222('0x6'));var Mustache=require(_0x3222('0x7'));var util=require(_0x3222('0x8'));var path=require('path');var sox=require(_0x3222('0x9'));var csv=require(_0x3222('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3222('0xb'));var _=require('lodash');var squel=require(_0x3222('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3222('0xd'));var toCsv=require(_0x3222('0xa'));var querystring=require(_0x3222('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3222('0xf'));var qs=require(_0x3222('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3222('0x11'));var logger=require(_0x3222('0x12'))(_0x3222('0x13'));var utils=require('../../config/utils');var config=require(_0x3222('0x14'));var licenseUtil=require(_0x3222('0x15'));var db=require(_0x3222('0x16'))['db'];config['redis']=_[_0x3222('0x17')](config[_0x3222('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x3222('0x19'))(new Redis(config[_0x3222('0x18')]));require('./chatInternalMessage.socket')[_0x3222('0x1a')](socket);function respondWithStatusCode(_0x424a59,_0x3089c1){_0x3089c1=_0x3089c1||0xcc;return function(_0x354adb){if(_0x354adb){return _0x424a59['sendStatus'](_0x3089c1);}return _0x424a59[_0x3222('0x1b')](_0x3089c1)[_0x3222('0x1c')]();};}function respondWithResult(_0x1f8ad7,_0x2b98f3){_0x2b98f3=_0x2b98f3||0xc8;return function(_0x7ab8a0){if(_0x7ab8a0){return _0x1f8ad7['status'](_0x2b98f3)[_0x3222('0x1d')](_0x7ab8a0);}};}function respondWithFilteredResult(_0x5b03f5,_0x3e99ec){return function(_0x543bc1){if(_0x543bc1){var _0xd32a23=typeof _0x3e99ec[_0x3222('0x1e')]===_0x3222('0x1f')&&typeof _0x3e99ec[_0x3222('0x20')]==='undefined';var _0x4bfee4=_0x543bc1[_0x3222('0x21')];var _0xc8f587=_0xd32a23?0x0:_0x3e99ec[_0x3222('0x1e')];var _0x36a9f3=_0xd32a23?_0x543bc1['count']:_0x3e99ec[_0x3222('0x1e')]+_0x3e99ec[_0x3222('0x20')];var _0x11edf6;if(_0x36a9f3>=_0x4bfee4){_0x36a9f3=_0x4bfee4;_0x11edf6=0xc8;}else{_0x11edf6=0xce;}_0x5b03f5['status'](_0x11edf6);return _0x5b03f5[_0x3222('0x22')](_0x3222('0x23'),_0xc8f587+'-'+_0x36a9f3+'/'+_0x4bfee4)[_0x3222('0x1d')](_0x543bc1);}return null;};}function patchUpdates(_0x436c30){return function(_0x19d991){try{jsonpatch[_0x3222('0x24')](_0x19d991,_0x436c30,!![]);}catch(_0x5d0ac2){return BPromise['reject'](_0x5d0ac2);}return _0x19d991[_0x3222('0x25')]();};}function saveUpdates(_0x138cd2,_0x4f7d80){return function(_0x5826e2){if(_0x5826e2){return _0x5826e2[_0x3222('0x26')](_0x138cd2)[_0x3222('0x27')](function(_0x176768){return _0x176768;});}return null;};}function removeEntity(_0x11afab,_0x18c9f5){return function(_0x1f0df2){if(_0x1f0df2){return _0x1f0df2[_0x3222('0x28')]()['then'](function(){_0x11afab[_0x3222('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57a088,_0x16190b){return function(_0x2f41bc){if(!_0x2f41bc){_0x57a088[_0x3222('0x29')](0x194);}return _0x2f41bc;};}function handleError(_0x232b57,_0x3e6aee){_0x3e6aee=_0x3e6aee||0x1f4;return function(_0x494f7f){logger['error'](_0x494f7f['stack']);if(_0x494f7f[_0x3222('0x2a')]){delete _0x494f7f['name'];}_0x232b57['status'](_0x3e6aee)['send'](_0x494f7f);};}exports['index']=function(_0x5ca158,_0x57b1f7){var _0x45373f={},_0x20f22a={},_0x5af54f={'count':0x0,'rows':[]};var _0x3233ce=_['map'](db['ChatInternalMessage']['rawAttributes'],function(_0x4493c1){return{'name':_0x4493c1['fieldName'],'type':_0x4493c1[_0x3222('0x2b')]['key']};});_0x20f22a[_0x3222('0x2c')]=_[_0x3222('0x2d')](_0x3233ce,'name');_0x20f22a[_0x3222('0x2e')]=_[_0x3222('0x2f')](_0x5ca158['query']);_0x20f22a[_0x3222('0x30')]=_['intersection'](_0x20f22a[_0x3222('0x2c')],_0x20f22a[_0x3222('0x2e')]);_0x45373f[_0x3222('0x31')]=_[_0x3222('0x32')](_0x20f22a[_0x3222('0x2c')],qs['fields'](_0x5ca158[_0x3222('0x2e')][_0x3222('0x33')]));_0x45373f['attributes']=_0x45373f['attributes'][_0x3222('0x34')]?_0x45373f['attributes']:_0x20f22a[_0x3222('0x2c')];if(!_0x5ca158['query'][_0x3222('0x35')](_0x3222('0x36'))){_0x45373f['limit']=qs[_0x3222('0x20')](_0x5ca158['query'][_0x3222('0x20')]);_0x45373f['offset']=qs[_0x3222('0x1e')](_0x5ca158['query'][_0x3222('0x1e')]);}_0x45373f[_0x3222('0x37')]=qs[_0x3222('0x38')](_0x5ca158['query'][_0x3222('0x38')]);_0x45373f[_0x3222('0x39')]=qs['filters'](_[_0x3222('0x3a')](_0x5ca158[_0x3222('0x2e')],_0x20f22a[_0x3222('0x30')]),_0x3233ce);if(_0x5ca158[_0x3222('0x2e')][_0x3222('0x3b')]){_0x45373f[_0x3222('0x39')]=_[_0x3222('0x3c')](_0x45373f['where'],{'$or':_[_0x3222('0x2d')](_0x3233ce,function(_0x1a866b){if(_0x1a866b['type']!==_0x3222('0x3d')){var _0x3520c6={};_0x3520c6[_0x1a866b[_0x3222('0x2a')]]={'$like':'%'+_0x5ca158[_0x3222('0x2e')][_0x3222('0x3b')]+'%'};return _0x3520c6;}})});}_0x45373f=_[_0x3222('0x3c')]({},_0x45373f,_0x5ca158[_0x3222('0x3e')]);var _0x288e8c={'where':_0x45373f[_0x3222('0x39')]};return db[_0x3222('0x3f')][_0x3222('0x21')](_0x288e8c)[_0x3222('0x27')](function(_0x43e4e9){_0x5af54f['count']=_0x43e4e9;if(_0x5ca158[_0x3222('0x2e')][_0x3222('0x40')]){_0x45373f[_0x3222('0x41')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x3222('0x42')](_0x45373f);})[_0x3222('0x27')](function(_0x303c1e){_0x5af54f[_0x3222('0x43')]=_0x303c1e;return _0x5af54f;})[_0x3222('0x27')](respondWithFilteredResult(_0x57b1f7,_0x45373f))[_0x3222('0x44')](handleError(_0x57b1f7,null));};exports[_0x3222('0x45')]=function(_0x197b2e,_0x2e3041){var _0x6400ee={'raw':!![],'where':{'id':_0x197b2e[_0x3222('0x46')]['id']}},_0x28e063={};_0x28e063['model']=_[_0x3222('0x2f')](db[_0x3222('0x3f')][_0x3222('0x47')]);_0x28e063[_0x3222('0x2e')]=_[_0x3222('0x2f')](_0x197b2e[_0x3222('0x2e')]);_0x28e063[_0x3222('0x30')]=_[_0x3222('0x32')](_0x28e063[_0x3222('0x2c')],_0x28e063[_0x3222('0x2e')]);_0x6400ee[_0x3222('0x31')]=_[_0x3222('0x32')](_0x28e063['model'],qs[_0x3222('0x33')](_0x197b2e[_0x3222('0x2e')][_0x3222('0x33')]));_0x6400ee[_0x3222('0x31')]=_0x6400ee[_0x3222('0x31')][_0x3222('0x34')]?_0x6400ee[_0x3222('0x31')]:_0x28e063[_0x3222('0x2c')];if(_0x197b2e[_0x3222('0x2e')][_0x3222('0x40')]){_0x6400ee[_0x3222('0x41')]=[{'all':!![]}];}_0x6400ee=_[_0x3222('0x3c')]({},_0x6400ee,_0x197b2e['options']);return db[_0x3222('0x3f')][_0x3222('0x48')](_0x6400ee)[_0x3222('0x27')](handleEntityNotFound(_0x2e3041,null))[_0x3222('0x27')](respondWithResult(_0x2e3041,null))['catch'](handleError(_0x2e3041,null));};exports[_0x3222('0x49')]=function(_0x1c7255,_0x181550){return db['ChatInternalMessage'][_0x3222('0x49')](_0x1c7255['body'],{})[_0x3222('0x27')](respondWithResult(_0x181550,0xc9))['catch'](handleError(_0x181550,null));};exports[_0x3222('0x26')]=function(_0x21bd88,_0x3ee5b0){if(_0x21bd88[_0x3222('0x4a')]['id']){delete _0x21bd88['body']['id'];}return db[_0x3222('0x3f')][_0x3222('0x48')]({'where':{'id':_0x21bd88[_0x3222('0x46')]['id']}})[_0x3222('0x27')](handleEntityNotFound(_0x3ee5b0,null))[_0x3222('0x27')](saveUpdates(_0x21bd88[_0x3222('0x4a')],null))[_0x3222('0x27')](respondWithResult(_0x3ee5b0,null))[_0x3222('0x44')](handleError(_0x3ee5b0,null));};exports[_0x3222('0x28')]=function(_0x34ef4c,_0x33ff4d){return db[_0x3222('0x3f')][_0x3222('0x48')]({'where':{'id':_0x34ef4c[_0x3222('0x46')]['id']}})[_0x3222('0x27')](handleEntityNotFound(_0x33ff4d,null))['then'](removeEntity(_0x33ff4d,null))['catch'](handleError(_0x33ff4d,null));};exports[_0x3222('0x4b')]=function(_0xbcbbca,_0x8a60ba){return db[_0x3222('0x3f')]['describe']()[_0x3222('0x27')](respondWithResult(_0x8a60ba,null))['catch'](handleError(_0x8a60ba,null));};function wrapUser(_0x2f591e){return function(_0x2676c3){var _0x416681=_0x2f591e['get']({'plain':!![]});_0x416681[_0x3222('0x4c')]=[];if(_0x2676c3){_0x416681[_0x3222('0x4d')]=_0x2676c3['createdAt'];_0x416681[_0x3222('0x4e')]=_0x2676c3;}else{_0x416681['lastMessageAt']=moment(0x0)[_0x3222('0x4f')](_0x3222('0x50'));_0x416681[_0x3222('0x4e')]={};}return _0x416681;};}exports[_0x3222('0x51')]=function(_0x28023b,_0x1e3716,_0x5e9bba){var _0x12c0c9=[];return db[_0x3222('0x52')][_0x3222('0x42')]({'where':{'role':[_0x3222('0x53'),_0x3222('0x54'),_0x3222('0x55')]},'attributes':['id',_0x3222('0x56'),_0x3222('0x2a'),_0x3222('0x57'),'userpic',_0x3222('0x58'),_0x3222('0x59'),_0x3222('0x5a'),_0x3222('0x5b'),_0x3222('0x5c')],'order':qs['sort'](_0x3222('0x5d')),'include':[{'model':db[_0x3222('0x5e')],'as':_0x3222('0x5f'),'attributes':['id',_0x3222('0x2a'),'type'],'through':{'attributes':[]}}]})['then'](function(_0xc6b913){if(_0xc6b913){var _0x7344e=_0x28023b[_0x3222('0x55')][_0x3222('0x60')]({'plain':!![]});if(!_0x7344e)throw new Error(_0x3222('0x61'));if(_0x7344e[_0x3222('0x57')]==='user'){return db[_0x3222('0x62')][_0x3222('0x48')]({'where':{'name':_0x3222('0x63'),'userProfileId':_0x7344e['userProfileId']},'raw':!![]})['then'](function(_0x10bde3){if(_0x10bde3){if(_0x10bde3[_0x3222('0x64')]===0x0){return db[_0x3222('0x65')][_0x3222('0x42')]({'where':{'sectionId':_0x10bde3['id']},'raw':!![]})[_0x3222('0x27')](function(_0x10a8a8){var _0x212d08=[];if(_[_0x3222('0x66')](_0x10a8a8)){_0x212d08=_[_0x3222('0x3b')](_0xc6b913,function(_0x2fab0e){if(_0x2fab0e[_0x3222('0x57')]!==_0x3222('0x53')){return _0x2fab0e;}});return _0x212d08;}else{for(var _0xf88195=0x0;_0xf88195<_0xc6b913['length'];_0xf88195++){var _0x3b42d0=_0xc6b913[_0xf88195];if(_0x3b42d0['role']===_0x3222('0x53')){var _0x2b251d=_[_0x3222('0x48')](_0x10a8a8,function(_0x47f595){return _0x47f595[_0x3222('0x67')]===_0x3b42d0['id'];});if(_0x2b251d)_0x212d08[_0x3222('0x68')](_0x3b42d0);}else{_0x212d08['push'](_0x3b42d0);}}return _0x212d08;}});}else{return _0xc6b913;}}else{var _0x4c5118=_[_0x3222('0x3b')](_0xc6b913,function(_0x37ba95){if(_0x37ba95['role']!==_0x3222('0x53')){return _0x37ba95;}});return _0x4c5118;}});}else{return _0xc6b913;}}})[_0x3222('0x27')](function(_0x29b891){var _0x4cf88e=[];if(_0x29b891){_0x12c0c9=_0x29b891;for(var _0x13d94c=0x0;_0x13d94c<_0x29b891[_0x3222('0x34')];_0x13d94c+=0x1){_0x12c0c9[_0x13d94c][_0x3222('0x4c')]=[];_0x4cf88e['push'](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x28023b['user']['id'],_0x29b891[_0x13d94c]['id']],'ToId':[_0x28023b[_0x3222('0x55')]['id'],_0x29b891[_0x13d94c]['id']],'ChatGroupId':null},'attributes':['id',_0x3222('0x69'),_0x3222('0x6a'),_0x3222('0x6b'),_0x3222('0x6c'),_0x3222('0x4a')],'order':qs[_0x3222('0x38')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x3222('0x27')](wrapUser(_0x29b891[_0x13d94c])));}return BPromise[_0x3222('0x6d')](_0x4cf88e);}return[];})['then'](function(_0x5594e3){return{'rows':_0x5594e3,'count':_0x5594e3[_0x3222('0x34')]};})[_0x3222('0x27')](respondWithResult(_0x1e3716,null))[_0x3222('0x44')](handleError(_0x1e3716,null));}; \ No newline at end of file +var _0xea47=['describe','get','messages','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','admin','user','fullname','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','findAll','isEmpty','agent','resourceId','push','createdAt','FromId','read','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','params','find','create','body'];(function(_0x3c7230,_0x46ead8){var _0x1176af=function(_0x38719a){while(--_0x38719a){_0x3c7230['push'](_0x3c7230['shift']());}};_0x1176af(++_0x46ead8);}(_0xea47,0xfc));var _0x7ea4=function(_0x4140ee,_0x3f0383){_0x4140ee=_0x4140ee-0x0;var _0x5160c3=_0xea47[_0x4140ee];return _0x5160c3;};'use strict';var emlformat=require(_0x7ea4('0x0'));var rimraf=require(_0x7ea4('0x1'));var zipdir=require(_0x7ea4('0x2'));var jsonpatch=require(_0x7ea4('0x3'));var rp=require(_0x7ea4('0x4'));var moment=require(_0x7ea4('0x5'));var BPromise=require(_0x7ea4('0x6'));var Mustache=require(_0x7ea4('0x7'));var util=require('util');var path=require(_0x7ea4('0x8'));var sox=require(_0x7ea4('0x9'));var csv=require('to-csv');var ejs=require(_0x7ea4('0xa'));var fs=require('fs');var fs_extra=require(_0x7ea4('0xb'));var _=require(_0x7ea4('0xc'));var squel=require(_0x7ea4('0xd'));var crypto=require(_0x7ea4('0xe'));var jsforce=require(_0x7ea4('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7ea4('0x10'));var querystring=require(_0x7ea4('0x11'));var Papa=require(_0x7ea4('0x12'));var Redis=require('ioredis');var authService=require(_0x7ea4('0x13'));var qs=require(_0x7ea4('0x14'));var as=require(_0x7ea4('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7ea4('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7ea4('0x17'))['db'];config[_0x7ea4('0x18')]=_[_0x7ea4('0x19')](config[_0x7ea4('0x18')],{'host':_0x7ea4('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ea4('0x18')]));require(_0x7ea4('0x1b'))[_0x7ea4('0x1c')](socket);function respondWithStatusCode(_0x27b642,_0x41580d){_0x41580d=_0x41580d||0xcc;return function(_0x26c6bc){if(_0x26c6bc){return _0x27b642[_0x7ea4('0x1d')](_0x41580d);}return _0x27b642[_0x7ea4('0x1e')](_0x41580d)[_0x7ea4('0x1f')]();};}function respondWithResult(_0x49db11,_0x941842){_0x941842=_0x941842||0xc8;return function(_0x6d14e0){if(_0x6d14e0){return _0x49db11[_0x7ea4('0x1e')](_0x941842)[_0x7ea4('0x20')](_0x6d14e0);}};}function respondWithFilteredResult(_0x45227b,_0x3277b6){return function(_0xc4d30b){if(_0xc4d30b){var _0x4267fa=typeof _0x3277b6[_0x7ea4('0x21')]===_0x7ea4('0x22')&&typeof _0x3277b6['limit']===_0x7ea4('0x22');var _0x1ca7a5=_0xc4d30b[_0x7ea4('0x23')];var _0x37a3d5=_0x4267fa?0x0:_0x3277b6['offset'];var _0x1e570d=_0x4267fa?_0xc4d30b[_0x7ea4('0x23')]:_0x3277b6[_0x7ea4('0x21')]+_0x3277b6[_0x7ea4('0x24')];var _0xa5e7f9;if(_0x1e570d>=_0x1ca7a5){_0x1e570d=_0x1ca7a5;_0xa5e7f9=0xc8;}else{_0xa5e7f9=0xce;}_0x45227b[_0x7ea4('0x1e')](_0xa5e7f9);return _0x45227b[_0x7ea4('0x25')](_0x7ea4('0x26'),_0x37a3d5+'-'+_0x1e570d+'/'+_0x1ca7a5)[_0x7ea4('0x20')](_0xc4d30b);}return null;};}function patchUpdates(_0x9abd98){return function(_0xb002b){try{jsonpatch[_0x7ea4('0x27')](_0xb002b,_0x9abd98,!![]);}catch(_0x329f31){return BPromise[_0x7ea4('0x28')](_0x329f31);}return _0xb002b[_0x7ea4('0x29')]();};}function saveUpdates(_0x5d49ae,_0x5d6f1e){return function(_0x5eca06){if(_0x5eca06){return _0x5eca06[_0x7ea4('0x2a')](_0x5d49ae)[_0x7ea4('0x2b')](function(_0x2883f1){return _0x2883f1;});}return null;};}function removeEntity(_0x448291,_0x2ce9e2){return function(_0x1f402f){if(_0x1f402f){return _0x1f402f['destroy']()[_0x7ea4('0x2b')](function(){_0x448291[_0x7ea4('0x1e')](0xcc)[_0x7ea4('0x1f')]();});}};}function handleEntityNotFound(_0x2a9f78,_0x3894c2){return function(_0x185040){if(!_0x185040){_0x2a9f78[_0x7ea4('0x1d')](0x194);}return _0x185040;};}function handleError(_0xbc9663,_0x103ba4){_0x103ba4=_0x103ba4||0x1f4;return function(_0x40d2e9){logger[_0x7ea4('0x2c')](_0x40d2e9[_0x7ea4('0x2d')]);if(_0x40d2e9[_0x7ea4('0x2e')]){delete _0x40d2e9[_0x7ea4('0x2e')];}_0xbc9663[_0x7ea4('0x1e')](_0x103ba4)[_0x7ea4('0x2f')](_0x40d2e9);};}exports[_0x7ea4('0x30')]=function(_0x54ad13,_0x1e965d){var _0x1e6584={},_0x1b2d10={},_0x794d40={'count':0x0,'rows':[]};var _0x435aa5=_[_0x7ea4('0x31')](db[_0x7ea4('0x32')][_0x7ea4('0x33')],function(_0x8cfb49){return{'name':_0x8cfb49['fieldName'],'type':_0x8cfb49[_0x7ea4('0x34')][_0x7ea4('0x35')]};});_0x1b2d10[_0x7ea4('0x36')]=_[_0x7ea4('0x31')](_0x435aa5,_0x7ea4('0x2e'));_0x1b2d10[_0x7ea4('0x37')]=_[_0x7ea4('0x38')](_0x54ad13[_0x7ea4('0x37')]);_0x1b2d10[_0x7ea4('0x39')]=_[_0x7ea4('0x3a')](_0x1b2d10[_0x7ea4('0x36')],_0x1b2d10['query']);_0x1e6584[_0x7ea4('0x3b')]=_[_0x7ea4('0x3a')](_0x1b2d10['model'],qs[_0x7ea4('0x3c')](_0x54ad13[_0x7ea4('0x37')][_0x7ea4('0x3c')]));_0x1e6584[_0x7ea4('0x3b')]=_0x1e6584[_0x7ea4('0x3b')][_0x7ea4('0x3d')]?_0x1e6584[_0x7ea4('0x3b')]:_0x1b2d10[_0x7ea4('0x36')];if(!_0x54ad13[_0x7ea4('0x37')][_0x7ea4('0x3e')]('nolimit')){_0x1e6584[_0x7ea4('0x24')]=qs[_0x7ea4('0x24')](_0x54ad13[_0x7ea4('0x37')]['limit']);_0x1e6584[_0x7ea4('0x21')]=qs[_0x7ea4('0x21')](_0x54ad13[_0x7ea4('0x37')][_0x7ea4('0x21')]);}_0x1e6584[_0x7ea4('0x3f')]=qs[_0x7ea4('0x40')](_0x54ad13[_0x7ea4('0x37')][_0x7ea4('0x40')]);_0x1e6584[_0x7ea4('0x41')]=qs[_0x7ea4('0x39')](_[_0x7ea4('0x42')](_0x54ad13[_0x7ea4('0x37')],_0x1b2d10[_0x7ea4('0x39')]),_0x435aa5);if(_0x54ad13[_0x7ea4('0x37')]['filter']){_0x1e6584[_0x7ea4('0x41')]=_['merge'](_0x1e6584[_0x7ea4('0x41')],{'$or':_['map'](_0x435aa5,function(_0x3a5b8e){if(_0x3a5b8e[_0x7ea4('0x34')]!=='VIRTUAL'){var _0x57373f={};_0x57373f[_0x3a5b8e[_0x7ea4('0x2e')]]={'$like':'%'+_0x54ad13[_0x7ea4('0x37')][_0x7ea4('0x43')]+'%'};return _0x57373f;}})});}_0x1e6584=_[_0x7ea4('0x44')]({},_0x1e6584,_0x54ad13[_0x7ea4('0x45')]);var _0x85470a={'where':_0x1e6584[_0x7ea4('0x41')]};return db[_0x7ea4('0x32')][_0x7ea4('0x23')](_0x85470a)['then'](function(_0x43e2ea){_0x794d40[_0x7ea4('0x23')]=_0x43e2ea;if(_0x54ad13[_0x7ea4('0x37')][_0x7ea4('0x46')]){_0x1e6584[_0x7ea4('0x47')]=[{'all':!![]}];}return db[_0x7ea4('0x32')]['findAll'](_0x1e6584);})['then'](function(_0x570e18){_0x794d40[_0x7ea4('0x48')]=_0x570e18;return _0x794d40;})[_0x7ea4('0x2b')](respondWithFilteredResult(_0x1e965d,_0x1e6584))[_0x7ea4('0x49')](handleError(_0x1e965d,null));};exports['show']=function(_0x5d325e,_0x5dee2b){var _0xbe52f1={'raw':!![],'where':{'id':_0x5d325e[_0x7ea4('0x4a')]['id']}},_0x599393={};_0x599393[_0x7ea4('0x36')]=_[_0x7ea4('0x38')](db[_0x7ea4('0x32')]['rawAttributes']);_0x599393[_0x7ea4('0x37')]=_[_0x7ea4('0x38')](_0x5d325e[_0x7ea4('0x37')]);_0x599393[_0x7ea4('0x39')]=_['intersection'](_0x599393[_0x7ea4('0x36')],_0x599393['query']);_0xbe52f1['attributes']=_[_0x7ea4('0x3a')](_0x599393[_0x7ea4('0x36')],qs[_0x7ea4('0x3c')](_0x5d325e[_0x7ea4('0x37')][_0x7ea4('0x3c')]));_0xbe52f1[_0x7ea4('0x3b')]=_0xbe52f1[_0x7ea4('0x3b')]['length']?_0xbe52f1[_0x7ea4('0x3b')]:_0x599393[_0x7ea4('0x36')];if(_0x5d325e[_0x7ea4('0x37')][_0x7ea4('0x46')]){_0xbe52f1[_0x7ea4('0x47')]=[{'all':!![]}];}_0xbe52f1=_[_0x7ea4('0x44')]({},_0xbe52f1,_0x5d325e[_0x7ea4('0x45')]);return db[_0x7ea4('0x32')][_0x7ea4('0x4b')](_0xbe52f1)[_0x7ea4('0x2b')](handleEntityNotFound(_0x5dee2b,null))[_0x7ea4('0x2b')](respondWithResult(_0x5dee2b,null))[_0x7ea4('0x49')](handleError(_0x5dee2b,null));};exports['create']=function(_0x2aac78,_0x1bebe0){return db[_0x7ea4('0x32')][_0x7ea4('0x4c')](_0x2aac78[_0x7ea4('0x4d')],{})['then'](respondWithResult(_0x1bebe0,0xc9))[_0x7ea4('0x49')](handleError(_0x1bebe0,null));};exports['update']=function(_0x1b1f05,_0x37dbe9){if(_0x1b1f05['body']['id']){delete _0x1b1f05[_0x7ea4('0x4d')]['id'];}return db[_0x7ea4('0x32')][_0x7ea4('0x4b')]({'where':{'id':_0x1b1f05[_0x7ea4('0x4a')]['id']}})[_0x7ea4('0x2b')](handleEntityNotFound(_0x37dbe9,null))[_0x7ea4('0x2b')](saveUpdates(_0x1b1f05[_0x7ea4('0x4d')],null))[_0x7ea4('0x2b')](respondWithResult(_0x37dbe9,null))[_0x7ea4('0x49')](handleError(_0x37dbe9,null));};exports['destroy']=function(_0x5dc02d,_0x1504e1){return db[_0x7ea4('0x32')][_0x7ea4('0x4b')]({'where':{'id':_0x5dc02d[_0x7ea4('0x4a')]['id']}})[_0x7ea4('0x2b')](handleEntityNotFound(_0x1504e1,null))[_0x7ea4('0x2b')](removeEntity(_0x1504e1,null))[_0x7ea4('0x49')](handleError(_0x1504e1,null));};exports[_0x7ea4('0x4e')]=function(_0x22e7d7,_0x33e89b){return db['ChatInternalMessage'][_0x7ea4('0x4e')]()['then'](respondWithResult(_0x33e89b,null))[_0x7ea4('0x49')](handleError(_0x33e89b,null));};function wrapUser(_0x528762){return function(_0x8bd52){var _0x5eba56=_0x528762[_0x7ea4('0x4f')]({'plain':!![]});_0x5eba56[_0x7ea4('0x50')]=[];if(_0x8bd52){_0x5eba56['lastMessageAt']=_0x8bd52['createdAt'];_0x5eba56['lastMessage']=_0x8bd52;}else{_0x5eba56[_0x7ea4('0x51')]=moment(0x0)[_0x7ea4('0x52')](_0x7ea4('0x53'));_0x5eba56[_0x7ea4('0x54')]={};}return _0x5eba56;};}exports[_0x7ea4('0x55')]=function(_0x29bcd8,_0x2a25ef,_0x3a2388){var _0x1c388c=[];return db[_0x7ea4('0x56')]['findAll']({'where':{'role':['agent',_0x7ea4('0x57'),_0x7ea4('0x58')]},'attributes':['id',_0x7ea4('0x59'),_0x7ea4('0x2e'),'role',_0x7ea4('0x5a'),_0x7ea4('0x5b'),_0x7ea4('0x5c'),_0x7ea4('0x5d'),_0x7ea4('0x5e'),_0x7ea4('0x5f')],'order':qs[_0x7ea4('0x40')](_0x7ea4('0x60')),'include':[{'model':db['VoiceQueue'],'as':_0x7ea4('0x61'),'attributes':['id','name',_0x7ea4('0x34')],'through':{'attributes':[]}}]})[_0x7ea4('0x2b')](function(_0xd48c71){if(_0xd48c71){var _0x45ded1=_0x29bcd8[_0x7ea4('0x58')][_0x7ea4('0x4f')]({'plain':!![]});if(!_0x45ded1)throw new Error(_0x7ea4('0x62'));if(_0x45ded1[_0x7ea4('0x63')]===_0x7ea4('0x58')){return db['UserProfileSection'][_0x7ea4('0x4b')]({'where':{'name':'Agents','userProfileId':_0x45ded1['userProfileId']},'raw':!![]})['then'](function(_0x40aefd){if(_0x40aefd){if(_0x40aefd[_0x7ea4('0x64')]===0x0){return db['UserProfileResource'][_0x7ea4('0x65')]({'where':{'sectionId':_0x40aefd['id']},'raw':!![]})[_0x7ea4('0x2b')](function(_0xf4003e){var _0x4d35ae=[];if(_[_0x7ea4('0x66')](_0xf4003e)){_0x4d35ae=_[_0x7ea4('0x43')](_0xd48c71,function(_0x1fca31){if(_0x1fca31[_0x7ea4('0x63')]!==_0x7ea4('0x67')){return _0x1fca31;}});return _0x4d35ae;}else{for(var _0x8ef094=0x0;_0x8ef094<_0xd48c71[_0x7ea4('0x3d')];_0x8ef094++){var _0x5b79e3=_0xd48c71[_0x8ef094];if(_0x5b79e3[_0x7ea4('0x63')]===_0x7ea4('0x67')){var _0x2297a7=_[_0x7ea4('0x4b')](_0xf4003e,function(_0x5b22ef){return _0x5b22ef[_0x7ea4('0x68')]===_0x5b79e3['id'];});if(_0x2297a7)_0x4d35ae['push'](_0x5b79e3);}else{_0x4d35ae[_0x7ea4('0x69')](_0x5b79e3);}}return _0x4d35ae;}});}else{return _0xd48c71;}}else{var _0x6ae843=_[_0x7ea4('0x43')](_0xd48c71,function(_0x18dcdc){if(_0x18dcdc[_0x7ea4('0x63')]!==_0x7ea4('0x67')){return _0x18dcdc;}});return _0x6ae843;}});}else{return _0xd48c71;}}})[_0x7ea4('0x2b')](function(_0x21bcaa){var _0x2807e8=[];if(_0x21bcaa){_0x1c388c=_0x21bcaa;for(var _0x2c4f1b=0x0;_0x2c4f1b<_0x21bcaa[_0x7ea4('0x3d')];_0x2c4f1b+=0x1){_0x1c388c[_0x2c4f1b][_0x7ea4('0x50')]=[];_0x2807e8[_0x7ea4('0x69')](db[_0x7ea4('0x32')][_0x7ea4('0x4b')]({'where':{'FromId':[_0x29bcd8[_0x7ea4('0x58')]['id'],_0x21bcaa[_0x2c4f1b]['id']],'ToId':[_0x29bcd8['user']['id'],_0x21bcaa[_0x2c4f1b]['id']],'ChatGroupId':null},'attributes':['id',_0x7ea4('0x6a'),_0x7ea4('0x6b'),'ToId',_0x7ea4('0x6c'),_0x7ea4('0x4d')],'order':qs[_0x7ea4('0x40')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x7ea4('0x2b')](wrapUser(_0x21bcaa[_0x2c4f1b])));}return BPromise[_0x7ea4('0x6d')](_0x2807e8);}return[];})[_0x7ea4('0x2b')](function(_0x750b91){return{'rows':_0x750b91,'count':_0x750b91[_0x7ea4('0x3d')]};})[_0x7ea4('0x2b')](respondWithResult(_0x2a25ef,null))['catch'](handleError(_0x2a25ef,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 9551f20..9db175f 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 _0xb08f=['save','remove','hasOwnProperty','hook','exports','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x2aafa9,_0x266a32){var _0xf31426=function(_0x5a2db0){while(--_0x5a2db0){_0x2aafa9['push'](_0x2aafa9['shift']());}};_0xf31426(++_0x266a32);}(_0xb08f,0x125));var _0xfb08=function(_0x42b502,_0x133d1a){_0x42b502=_0x42b502-0x0;var _0x36ab98=_0xb08f[_0x42b502];return _0x36ab98;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0xfb08('0x0'))['db'][_0xfb08('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xfb08('0x2')](0x0);var events={'afterCreate':_0xfb08('0x3'),'afterUpdate':'update','afterDestroy':_0xfb08('0x4')};function emitEvent(_0x2acfa3){return function(_0xbd6453,_0x1fc3ab,_0x26c99d){ChatInternalMessageEvents['emit'](_0x2acfa3+':'+_0xbd6453['id'],_0xbd6453);ChatInternalMessageEvents['emit'](_0x2acfa3,_0xbd6453);_0x26c99d(null);};}for(var e in events){if(events[_0xfb08('0x5')](e)){var event=events[e];ChatInternalMessage[_0xfb08('0x6')](e,emitEvent(event));}}module[_0xfb08('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x7b20=['hook','exports','events','ChatInternalMessage','setMaxListeners','save','update','remove','emit'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x7b20,0x1e8));var _0x07b2=function(_0x2965bf,_0xcbac52){_0x2965bf=_0x2965bf-0x0;var _0x26dade=_0x7b20[_0x2965bf];return _0x26dade;};'use strict';var EventEmitter=require(_0x07b2('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x07b2('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x07b2('0x2')](0x0);var events={'afterCreate':_0x07b2('0x3'),'afterUpdate':_0x07b2('0x4'),'afterDestroy':_0x07b2('0x5')};function emitEvent(_0x2fd421){return function(_0x54f280,_0x4a013d,_0xcdffc1){ChatInternalMessageEvents[_0x07b2('0x6')](_0x2fd421+':'+_0x54f280['id'],_0x54f280);ChatInternalMessageEvents[_0x07b2('0x6')](_0x2fd421,_0x54f280);_0xcdffc1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x07b2('0x7')](e,emitEvent(event));}}module[_0x07b2('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 771b69d..1df54d6 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 _0xd497=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','lodash'];(function(_0x41aa31,_0x409ae1){var _0x3f92e9=function(_0x5a5900){while(--_0x5a5900){_0x41aa31['push'](_0x41aa31['shift']());}};_0x3f92e9(++_0x409ae1);}(_0xd497,0x1b9));var _0x7d49=function(_0x74a191,_0x18dfb4){_0x74a191=_0x74a191-0x0;var _0x23050c=_0xd497[_0x74a191];return _0x23050c;};'use strict';var _=require(_0x7d49('0x0'));var util=require(_0x7d49('0x1'));var logger=require(_0x7d49('0x2'))('api');var moment=require(_0x7d49('0x3'));var BPromise=require('bluebird');var rp=require(_0x7d49('0x4'));var fs=require('fs');var path=require(_0x7d49('0x5'));var rimraf=require(_0x7d49('0x6'));var config=require(_0x7d49('0x7'));var attributes=require('./chatInternalMessage.attributes');module[_0x7d49('0x8')]=function(_0x317dff,_0x5504c6){return _0x317dff[_0x7d49('0x9')](_0x7d49('0xa'),attributes,{'tableName':_0x7d49('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7d49('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4932=['utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','ChatInternalMessage','chat_internal_messages','utf8mb4'];(function(_0x2ed8f3,_0x4aa12f){var _0x525a55=function(_0x4cfb58){while(--_0x4cfb58){_0x2ed8f3['push'](_0x2ed8f3['shift']());}};_0x525a55(++_0x4aa12f);}(_0x4932,0x16d));var _0x2493=function(_0x2ebf08,_0x49b46b){_0x2ebf08=_0x2ebf08-0x0;var _0x2bf0ac=_0x4932[_0x2ebf08];return _0x2bf0ac;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2493('0x0'))(_0x2493('0x1'));var moment=require(_0x2493('0x2'));var BPromise=require(_0x2493('0x3'));var rp=require(_0x2493('0x4'));var fs=require('fs');var path=require(_0x2493('0x5'));var rimraf=require(_0x2493('0x6'));var config=require(_0x2493('0x7'));var attributes=require(_0x2493('0x8'));module['exports']=function(_0x14faae,_0x2340eb){return _0x14faae['define'](_0x2493('0x9'),attributes,{'tableName':_0x2493('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2493('0xb'),'collate':_0x2493('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 029c98b..c9e94ff 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 _0x7ec7=['then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','request'];(function(_0x56880d,_0x315eb5){var _0x3ebe18=function(_0x14fa9c){while(--_0x14fa9c){_0x56880d['push'](_0x56880d['shift']());}};_0x3ebe18(++_0x315eb5);}(_0x7ec7,0x19b));var _0x77ec=function(_0xb84eb6,_0x296345){_0xb84eb6=_0xb84eb6-0x0;var _0x4c8f0c=_0x7ec7[_0xb84eb6];return _0x4c8f0c;};'use strict';var _=require(_0x77ec('0x0'));var util=require(_0x77ec('0x1'));var moment=require(_0x77ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x77ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x77ec('0x4'))['db'];var utils=require(_0x77ec('0x5'));var logger=require(_0x77ec('0x6'))('rpc');var config=require(_0x77ec('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x77ec('0x8')]({'port':0x232a});config['redis']=_[_0x77ec('0x9')](config[_0x77ec('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x77ec('0xb'))(new Redis(config[_0x77ec('0xa')]));require(_0x77ec('0xc'))['register'](socket);function respondWithRpcPromise(_0xd62db6,_0x329cb9,_0x3d87cc){return new BPromise(function(_0x300933,_0x4494c7){return client[_0x77ec('0xd')](_0xd62db6,_0x3d87cc)[_0x77ec('0xe')](function(_0x5c3bf4){logger[_0x77ec('0xf')](_0x77ec('0x10'),_0x329cb9,_0x77ec('0x11'));logger[_0x77ec('0x12')](_0x77ec('0x13'),_0x329cb9,'request\x20sent',JSON[_0x77ec('0x14')](_0x5c3bf4));if(_0x5c3bf4['error']){if(_0x5c3bf4['error'][_0x77ec('0x15')]===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x329cb9,_0x5c3bf4[_0x77ec('0x16')]['message']);return _0x4494c7(_0x5c3bf4[_0x77ec('0x16')][_0x77ec('0x17')]);}logger[_0x77ec('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x329cb9,_0x5c3bf4[_0x77ec('0x16')][_0x77ec('0x17')]);return _0x300933(_0x5c3bf4[_0x77ec('0x16')][_0x77ec('0x17')]);}else{logger[_0x77ec('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x329cb9,_0x77ec('0x11'));_0x300933(_0x5c3bf4[_0x77ec('0x18')]['message']);}})['catch'](function(_0x49a879){logger[_0x77ec('0x16')](_0x77ec('0x10'),_0x329cb9,_0x49a879);_0x4494c7(_0x49a879);});});} \ No newline at end of file +var _0xf1c7=['request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf1c7,0x193));var _0x7f1c=function(_0x1ab180,_0x382b2c){_0x1ab180=_0x1ab180-0x0;var _0xfb2c2d=_0xf1c7[_0x1ab180];return _0xfb2c2d;};'use strict';var _=require(_0x7f1c('0x0'));var util=require('util');var moment=require(_0x7f1c('0x1'));var BPromise=require('bluebird');var rs=require(_0x7f1c('0x2'));var fs=require('fs');var Redis=require(_0x7f1c('0x3'));var db=require(_0x7f1c('0x4'))['db'];var utils=require(_0x7f1c('0x5'));var logger=require(_0x7f1c('0x6'))(_0x7f1c('0x7'));var config=require(_0x7f1c('0x8'));var jayson=require(_0x7f1c('0x9'));var client=jayson[_0x7f1c('0xa')]['http']({'port':0x232a});config['redis']=_[_0x7f1c('0xb')](config[_0x7f1c('0xc')],{'host':_0x7f1c('0xd'),'port':0x18eb});var socket=require(_0x7f1c('0xe'))(new Redis(config[_0x7f1c('0xc')]));require(_0x7f1c('0xf'))[_0x7f1c('0x10')](socket);function respondWithRpcPromise(_0x452564,_0x32679b,_0x4e7435){return new BPromise(function(_0x150211,_0x4ece7d){return client[_0x7f1c('0x11')](_0x452564,_0x4e7435)[_0x7f1c('0x12')](function(_0x5ec58c){logger[_0x7f1c('0x13')](_0x7f1c('0x14'),_0x32679b,_0x7f1c('0x15'));logger[_0x7f1c('0x16')](_0x7f1c('0x17'),_0x32679b,_0x7f1c('0x15'),JSON[_0x7f1c('0x18')](_0x5ec58c));if(_0x5ec58c[_0x7f1c('0x19')]){if(_0x5ec58c[_0x7f1c('0x19')][_0x7f1c('0x1a')]===0x1f4){logger[_0x7f1c('0x19')](_0x7f1c('0x14'),_0x32679b,_0x5ec58c[_0x7f1c('0x19')][_0x7f1c('0x1b')]);return _0x4ece7d(_0x5ec58c[_0x7f1c('0x19')][_0x7f1c('0x1b')]);}logger[_0x7f1c('0x19')](_0x7f1c('0x14'),_0x32679b,_0x5ec58c['error'][_0x7f1c('0x1b')]);return _0x150211(_0x5ec58c[_0x7f1c('0x19')][_0x7f1c('0x1b')]);}else{logger[_0x7f1c('0x13')](_0x7f1c('0x14'),_0x32679b,_0x7f1c('0x15'));_0x150211(_0x5ec58c[_0x7f1c('0x1c')][_0x7f1c('0x1b')]);}})[_0x7f1c('0x1d')](function(_0x33dd8a){logger[_0x7f1c('0x19')](_0x7f1c('0x14'),_0x32679b,_0x33dd8a);_0x4ece7d(_0x33dd8a);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 818e092..dfc93ce 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 _0xe53f=['register','length','chatInternalMessage:','save','remove','update','emit'];(function(_0x23945f,_0x9d3e4e){var _0xa38592=function(_0x406b83){while(--_0x406b83){_0x23945f['push'](_0x23945f['shift']());}};_0xa38592(++_0x9d3e4e);}(_0xe53f,0x130));var _0xfe53=function(_0x1fb7c2,_0x2dc426){_0x1fb7c2=_0x1fb7c2-0x0;var _0x3b319d=_0xe53f[_0x1fb7c2];return _0x3b319d;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xfe53('0x0'),_0xfe53('0x1'),_0xfe53('0x2')];function createListener(_0x351ffb,_0x46f1f2){return function(_0xb12b36){_0x46f1f2[_0xfe53('0x3')](_0x351ffb,_0xb12b36);};}function removeListener(_0x36382c,_0x68a2ec){return function(){ChatInternalMessageEvents['removeListener'](_0x36382c,_0x68a2ec);};}exports[_0xfe53('0x4')]=function(_0x6749a8){for(var _0x5ad4eb=0x0,_0xdfb844=events[_0xfe53('0x5')];_0x5ad4eb<_0xdfb844;_0x5ad4eb++){var _0x2e4e61=events[_0x5ad4eb];var _0x365b3e=createListener(_0xfe53('0x6')+_0x2e4e61,_0x6749a8);ChatInternalMessageEvents['on'](_0x2e4e61,_0x365b3e);}}; \ No newline at end of file +var _0x37ef=['chatInternalMessage:','./chatInternalMessage.events','save','update','emit','removeListener','register','length'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x37ef,0x91));var _0xf37e=function(_0x233385,_0x2bc576){_0x233385=_0x233385-0x0;var _0x4d016a=_0x37ef[_0x233385];return _0x4d016a;};'use strict';var ChatInternalMessageEvents=require(_0xf37e('0x0'));var events=[_0xf37e('0x1'),'remove',_0xf37e('0x2')];function createListener(_0x39e706,_0x56b879){return function(_0x32f0e5){_0x56b879[_0xf37e('0x3')](_0x39e706,_0x32f0e5);};}function removeListener(_0x90429c,_0x5c724c){return function(){ChatInternalMessageEvents[_0xf37e('0x4')](_0x90429c,_0x5c724c);};}exports[_0xf37e('0x5')]=function(_0x38d2ab){for(var _0x1d40b9=0x0,_0x5cd6ed=events[_0xf37e('0x6')];_0x1d40b9<_0x5cd6ed;_0x1d40b9++){var _0x8195d1=events[_0x1d40b9];var _0x32aab9=createListener(_0xf37e('0x7')+_0x8195d1,_0x38d2ab);ChatInternalMessageEvents['on'](_0x8195d1,_0x32aab9);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 2af7280..6e3e838 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 _0x5d4b=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','getUsers','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5d4b,0x70));var _0xb5d4=function(_0x4d0e02,_0x39fe34){_0x4d0e02=_0x4d0e02-0x0;var _0x1c6652=_0x5d4b[_0x4d0e02];return _0x1c6652;};'use strict';var multer=require(_0xb5d4('0x0'));var util=require(_0xb5d4('0x1'));var path=require(_0xb5d4('0x2'));var timeout=require(_0xb5d4('0x3'));var express=require(_0xb5d4('0x4'));var router=express[_0xb5d4('0x5')]();var fs_extra=require(_0xb5d4('0x6'));var auth=require(_0xb5d4('0x7'));var interaction=require(_0xb5d4('0x8'));var config=require(_0xb5d4('0x9'));var controller=require('./chatInternalMessage.controller');router[_0xb5d4('0xa')]('/',auth[_0xb5d4('0xb')](),controller[_0xb5d4('0xc')]);router[_0xb5d4('0xa')](_0xb5d4('0xd'),auth[_0xb5d4('0xb')](),controller[_0xb5d4('0xe')]);router[_0xb5d4('0xa')]('/users',auth[_0xb5d4('0xb')](),controller[_0xb5d4('0xf')]);router[_0xb5d4('0xa')](_0xb5d4('0x10'),auth['isAuthenticated'](),controller[_0xb5d4('0x11')]);router[_0xb5d4('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb5d4('0x13')](_0xb5d4('0x10'),controller[_0xb5d4('0x14')]);router[_0xb5d4('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xb5d4('0x16')]);module[_0xb5d4('0x17')]=router; \ No newline at end of file +var _0x7050=['update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','index','/describe','isAuthenticated','describe','/users','getUsers','/:id','show','post','create'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x7050,0xf4));var _0x0705=function(_0x30c649,_0x2ebbac){_0x30c649=_0x30c649-0x0;var _0x3edfb9=_0x7050[_0x30c649];return _0x3edfb9;};'use strict';var multer=require(_0x0705('0x0'));var util=require('util');var path=require(_0x0705('0x1'));var timeout=require(_0x0705('0x2'));var express=require('express');var router=express[_0x0705('0x3')]();var fs_extra=require(_0x0705('0x4'));var auth=require(_0x0705('0x5'));var interaction=require(_0x0705('0x6'));var config=require(_0x0705('0x7'));var controller=require(_0x0705('0x8'));router[_0x0705('0x9')]('/',auth['isAuthenticated'](),controller[_0x0705('0xa')]);router[_0x0705('0x9')](_0x0705('0xb'),auth[_0x0705('0xc')](),controller[_0x0705('0xd')]);router[_0x0705('0x9')](_0x0705('0xe'),auth[_0x0705('0xc')](),controller[_0x0705('0xf')]);router[_0x0705('0x9')](_0x0705('0x10'),auth['isAuthenticated'](),controller[_0x0705('0x11')]);router[_0x0705('0x12')]('/',auth[_0x0705('0xc')](),controller[_0x0705('0x13')]);router['put'](_0x0705('0x10'),controller[_0x0705('0x14')]);router[_0x0705('0x15')](_0x0705('0x10'),auth[_0x0705('0xc')](),controller[_0x0705('0x16')]);module[_0x0705('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 2db8cb7..b8c2e69 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 _0x8769=['exports','medium','BOOLEAN','ENUM','DATE','STRING','sequelize'];(function(_0x611659,_0x51ff6e){var _0x4ef9e7=function(_0x2279bc){while(--_0x2279bc){_0x611659['push'](_0x611659['shift']());}};_0x4ef9e7(++_0x51ff6e);}(_0x8769,0x110));var _0x9876=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x8769[_0x29d94e];return _0x106237;};'use strict';var Sequelize=require(_0x9876('0x0'));module[_0x9876('0x1')]={'body':{'type':Sequelize['TEXT'](_0x9876('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x9876('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9876('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x9876('0x5')]},'providerName':{'type':Sequelize[_0x9876('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x0db9=['out','DATE','STRING','sequelize','BOOLEAN'];(function(_0x5b64a0,_0x1f823c){var _0x1783f5=function(_0x2e2170){while(--_0x2e2170){_0x5b64a0['push'](_0x5b64a0['shift']());}};_0x1783f5(++_0x1f823c);}(_0x0db9,0xa3));var _0x90db=function(_0x2b1551,_0x1776fe){_0x2b1551=_0x2b1551-0x0;var _0x2fc2a1=_0x0db9[_0x2b1551];return _0x2fc2a1;};'use strict';var Sequelize=require(_0x90db('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x90db('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0x90db('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x90db('0x2')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x90db('0x3')]},'providerName':{'type':Sequelize[_0x90db('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 348dd1d..89bebd8 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 _0x44dc=['chat','read','format','UserId','user','get','ChatInteractionId','read1stAt','interaction','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','agent','fullname','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','formData','../../config/logger','reject','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','Sequelize','User','email','event','rejectmessage','parse','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatMessage.socket','register','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','sendStatus','end','status','json','offset','limit','count','set','save','update','destroy','stack','send','map','ChatMessage','fieldName','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','create','body','find','describe','chat-interactions','accept'];(function(_0x22a42f,_0x3295a8){var _0x5ec443=function(_0x228927){while(--_0x228927){_0x22a42f['push'](_0x22a42f['shift']());}};_0x5ec443(++_0x3295a8);}(_0x44dc,0x1ab));var _0xc44d=function(_0x5732d6,_0x2c9500){_0x5732d6=_0x5732d6-0x0;var _0x3a1a0f=_0x44dc[_0x5732d6];return _0x3a1a0f;};'use strict';var emlformat=require(_0xc44d('0x0'));var rimraf=require(_0xc44d('0x1'));var zipdir=require(_0xc44d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc44d('0x3'));var BPromise=require(_0xc44d('0x4'));var Mustache=require(_0xc44d('0x5'));var util=require(_0xc44d('0x6'));var path=require(_0xc44d('0x7'));var sox=require(_0xc44d('0x8'));var csv=require(_0xc44d('0x9'));var ejs=require(_0xc44d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc44d('0xb'));var crypto=require(_0xc44d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc44d('0xd'));var toCsv=require(_0xc44d('0x9'));var querystring=require(_0xc44d('0xe'));var Papa=require(_0xc44d('0xf'));var Redis=require(_0xc44d('0x10'));var authService=require(_0xc44d('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc44d('0x12'));var logger=require('../../config/logger')(_0xc44d('0x13'));var utils=require('../../config/utils');var config=require(_0xc44d('0x14'));var licenseUtil=require(_0xc44d('0x15'));var db=require(_0xc44d('0x16'))['db'];config['redis']=_['defaults'](config[_0xc44d('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xc44d('0x18'))(new Redis(config[_0xc44d('0x17')]));require(_0xc44d('0x19'))[_0xc44d('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc44d('0x1b')][_0xc44d('0x1c')]({'port':0x232c});var client9002=jayson[_0xc44d('0x1b')][_0xc44d('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x75a119,_0xb71b69,_0x132607,_0x585279){return new BPromise(function(_0x7c478b,_0x4e9159){var _0x38d376=_0x585279||client;return _0x38d376[_0xc44d('0x1d')](_0x75a119,_0x132607)[_0xc44d('0x1e')](function(_0x8a6bda){logger[_0xc44d('0x1f')](_0xc44d('0x20'),_0xb71b69,'request\x20sent');logger[_0xc44d('0x21')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0xb71b69,_0xc44d('0x22'),JSON[_0xc44d('0x23')](_0x8a6bda));if(_0x8a6bda[_0xc44d('0x24')]){if(_0x8a6bda[_0xc44d('0x24')]['code']===0x1f4){logger[_0xc44d('0x24')](_0xc44d('0x20'),_0xb71b69,_0x8a6bda[_0xc44d('0x24')]['message']);return _0x4e9159(_0x8a6bda['error']['message']);}logger[_0xc44d('0x24')](_0xc44d('0x20'),_0xb71b69,_0x8a6bda['error'][_0xc44d('0x25')]);return _0x7c478b(_0x8a6bda[_0xc44d('0x24')][_0xc44d('0x25')]);}else{logger[_0xc44d('0x1f')](_0xc44d('0x20'),_0xb71b69,_0xc44d('0x22'));_0x7c478b(_0x8a6bda[_0xc44d('0x26')][_0xc44d('0x25')]);}})[_0xc44d('0x27')](function(_0x220bff){logger['error']('ChatMessage,\x20%s,\x20%s',_0xb71b69,_0x220bff);_0x4e9159(_0x220bff);});});}function respondWithStatusCode(_0x55b4d5,_0x248a3f){_0x248a3f=_0x248a3f||0xcc;return function(_0x48f29f){if(_0x48f29f){return _0x55b4d5[_0xc44d('0x28')](_0x248a3f);}return _0x55b4d5['status'](_0x248a3f)[_0xc44d('0x29')]();};}function respondWithResult(_0x3755a7,_0x28eda3){_0x28eda3=_0x28eda3||0xc8;return function(_0x57f31d){if(_0x57f31d){return _0x3755a7[_0xc44d('0x2a')](_0x28eda3)[_0xc44d('0x2b')](_0x57f31d);}};}function respondWithFilteredResult(_0x5aa0fa,_0x3c12af){return function(_0x218031){if(_0x218031){var _0x2adb97=typeof _0x3c12af[_0xc44d('0x2c')]==='undefined'&&typeof _0x3c12af[_0xc44d('0x2d')]==='undefined';var _0x54d0b2=_0x218031['count'];var _0xa92365=_0x2adb97?0x0:_0x3c12af[_0xc44d('0x2c')];var _0x2ac7a6=_0x2adb97?_0x218031[_0xc44d('0x2e')]:_0x3c12af[_0xc44d('0x2c')]+_0x3c12af[_0xc44d('0x2d')];var _0x5ec00e;if(_0x2ac7a6>=_0x54d0b2){_0x2ac7a6=_0x54d0b2;_0x5ec00e=0xc8;}else{_0x5ec00e=0xce;}_0x5aa0fa['status'](_0x5ec00e);return _0x5aa0fa[_0xc44d('0x2f')]('Content-Range',_0xa92365+'-'+_0x2ac7a6+'/'+_0x54d0b2)[_0xc44d('0x2b')](_0x218031);}return null;};}function patchUpdates(_0xc27ae6){return function(_0x5e31c7){try{jsonpatch['apply'](_0x5e31c7,_0xc27ae6,!![]);}catch(_0x213268){return BPromise['reject'](_0x213268);}return _0x5e31c7[_0xc44d('0x30')]();};}function saveUpdates(_0x6b6060,_0x4c42b1){return function(_0x273ab5){if(_0x273ab5){return _0x273ab5[_0xc44d('0x31')](_0x6b6060)[_0xc44d('0x1e')](function(_0x3a44bb){return _0x3a44bb;});}return null;};}function removeEntity(_0x55f597,_0x50a088){return function(_0x46bda4){if(_0x46bda4){return _0x46bda4[_0xc44d('0x32')]()['then'](function(){_0x55f597[_0xc44d('0x2a')](0xcc)[_0xc44d('0x29')]();});}};}function handleEntityNotFound(_0x47312a,_0x34b6fc){return function(_0x2f98da){if(!_0x2f98da){_0x47312a[_0xc44d('0x28')](0x194);}return _0x2f98da;};}function handleError(_0x14701d,_0x44c191){_0x44c191=_0x44c191||0x1f4;return function(_0x4edc57){logger[_0xc44d('0x24')](_0x4edc57[_0xc44d('0x33')]);if(_0x4edc57['name']){delete _0x4edc57['name'];}_0x14701d[_0xc44d('0x2a')](_0x44c191)[_0xc44d('0x34')](_0x4edc57);};}exports['index']=function(_0x49e108,_0x481444){var _0x84fbd2={},_0x28dcd8={},_0xa69a07={'count':0x0,'rows':[]};var _0x59d220=_[_0xc44d('0x35')](db[_0xc44d('0x36')]['rawAttributes'],function(_0x475bd3){return{'name':_0x475bd3[_0xc44d('0x37')],'type':_0x475bd3['type']['key']};});_0x28dcd8[_0xc44d('0x38')]=_['map'](_0x59d220,_0xc44d('0x39'));_0x28dcd8[_0xc44d('0x3a')]=_[_0xc44d('0x3b')](_0x49e108[_0xc44d('0x3a')]);_0x28dcd8[_0xc44d('0x3c')]=_['intersection'](_0x28dcd8['model'],_0x28dcd8['query']);_0x84fbd2[_0xc44d('0x3d')]=_[_0xc44d('0x3e')](_0x28dcd8['model'],qs[_0xc44d('0x3f')](_0x49e108[_0xc44d('0x3a')][_0xc44d('0x3f')]));_0x84fbd2[_0xc44d('0x3d')]=_0x84fbd2['attributes'][_0xc44d('0x40')]?_0x84fbd2['attributes']:_0x28dcd8['model'];if(!_0x49e108[_0xc44d('0x3a')][_0xc44d('0x41')](_0xc44d('0x42'))){_0x84fbd2[_0xc44d('0x2d')]=qs[_0xc44d('0x2d')](_0x49e108[_0xc44d('0x3a')][_0xc44d('0x2d')]);_0x84fbd2[_0xc44d('0x2c')]=qs[_0xc44d('0x2c')](_0x49e108['query'][_0xc44d('0x2c')]);}_0x84fbd2[_0xc44d('0x43')]=qs['sort'](_0x49e108[_0xc44d('0x3a')][_0xc44d('0x44')]);_0x84fbd2[_0xc44d('0x45')]=qs[_0xc44d('0x3c')](_[_0xc44d('0x46')](_0x49e108[_0xc44d('0x3a')],_0x28dcd8['filters']),_0x59d220);if(_0x49e108['query'][_0xc44d('0x47')]){_0x84fbd2[_0xc44d('0x45')]=_[_0xc44d('0x48')](_0x84fbd2[_0xc44d('0x45')],{'$or':_[_0xc44d('0x35')](_0x59d220,function(_0x5b2d24){if(_0x5b2d24[_0xc44d('0x49')]!==_0xc44d('0x4a')){var _0x4cbd9a={};_0x4cbd9a[_0x5b2d24['name']]={'$like':'%'+_0x49e108[_0xc44d('0x3a')][_0xc44d('0x47')]+'%'};return _0x4cbd9a;}})});}_0x84fbd2=_[_0xc44d('0x48')]({},_0x84fbd2,_0x49e108[_0xc44d('0x4b')]);var _0xa20197={'where':_0x84fbd2[_0xc44d('0x45')]};return db[_0xc44d('0x36')][_0xc44d('0x2e')](_0xa20197)[_0xc44d('0x1e')](function(_0x4d4088){_0xa69a07[_0xc44d('0x2e')]=_0x4d4088;if(_0x49e108[_0xc44d('0x3a')][_0xc44d('0x4c')]){_0x84fbd2[_0xc44d('0x4d')]=[{'all':!![]}];}return db['ChatMessage'][_0xc44d('0x4e')](_0x84fbd2);})[_0xc44d('0x1e')](function(_0x3def16){_0xa69a07[_0xc44d('0x4f')]=_0x3def16;return _0xa69a07;})[_0xc44d('0x1e')](respondWithFilteredResult(_0x481444,_0x84fbd2))[_0xc44d('0x27')](handleError(_0x481444,null));};exports[_0xc44d('0x50')]=function(_0x4d0c02,_0x5d1f7e){var _0x5642dc={'raw':!![],'where':{'id':_0x4d0c02[_0xc44d('0x51')]['id']}},_0x2c2fff={};_0x2c2fff[_0xc44d('0x38')]=_[_0xc44d('0x3b')](db['ChatMessage'][_0xc44d('0x52')]);_0x2c2fff['query']=_[_0xc44d('0x3b')](_0x4d0c02[_0xc44d('0x3a')]);_0x2c2fff[_0xc44d('0x3c')]=_['intersection'](_0x2c2fff['model'],_0x2c2fff[_0xc44d('0x3a')]);_0x5642dc[_0xc44d('0x3d')]=_[_0xc44d('0x3e')](_0x2c2fff['model'],qs[_0xc44d('0x3f')](_0x4d0c02[_0xc44d('0x3a')][_0xc44d('0x3f')]));_0x5642dc[_0xc44d('0x3d')]=_0x5642dc['attributes'][_0xc44d('0x40')]?_0x5642dc['attributes']:_0x2c2fff[_0xc44d('0x38')];if(_0x4d0c02['query'][_0xc44d('0x4c')]){_0x5642dc['include']=[{'all':!![]}];}_0x5642dc=_[_0xc44d('0x48')]({},_0x5642dc,_0x4d0c02['options']);return db['ChatMessage']['find'](_0x5642dc)[_0xc44d('0x1e')](handleEntityNotFound(_0x5d1f7e,null))[_0xc44d('0x1e')](respondWithResult(_0x5d1f7e,null))[_0xc44d('0x27')](handleError(_0x5d1f7e,null));};exports[_0xc44d('0x53')]=function(_0x109cae,_0x1b74a5){return db[_0xc44d('0x36')][_0xc44d('0x53')](_0x109cae[_0xc44d('0x54')],{})['then'](respondWithResult(_0x1b74a5,0xc9))[_0xc44d('0x27')](handleError(_0x1b74a5,null));};exports[_0xc44d('0x31')]=function(_0x1417c1,_0x54f81c){if(_0x1417c1[_0xc44d('0x54')]['id']){delete _0x1417c1['body']['id'];}return db[_0xc44d('0x36')]['find']({'where':{'id':_0x1417c1[_0xc44d('0x51')]['id']}})['then'](handleEntityNotFound(_0x54f81c,null))[_0xc44d('0x1e')](saveUpdates(_0x1417c1[_0xc44d('0x54')],null))[_0xc44d('0x1e')](respondWithResult(_0x54f81c,null))[_0xc44d('0x27')](handleError(_0x54f81c,null));};exports[_0xc44d('0x32')]=function(_0x494972,_0x51c774){return db['ChatMessage'][_0xc44d('0x55')]({'where':{'id':_0x494972[_0xc44d('0x51')]['id']}})[_0xc44d('0x1e')](handleEntityNotFound(_0x51c774,null))['then'](removeEntity(_0x51c774,null))[_0xc44d('0x27')](handleError(_0x51c774,null));};exports[_0xc44d('0x56')]=function(_0x143024,_0x1183bf){return db[_0xc44d('0x36')][_0xc44d('0x56')]()[_0xc44d('0x1e')](respondWithResult(_0x1183bf,null))[_0xc44d('0x27')](handleError(_0x1183bf,null));};var interaction_log=require('../../config/logger')(_0xc44d('0x57'));exports[_0xc44d('0x58')]=function(_0x486536,_0x2de8b2,_0x19a02b){var _0x583127={'agent':{},'channel':_0xc44d('0x59')};if(_0x486536[_0xc44d('0x54')]['id']){delete _0x486536[_0xc44d('0x54')]['id'];}_0x486536['body'][_0xc44d('0x5a')]=!![];_0x486536[_0xc44d('0x54')]['readAt']=moment()[_0xc44d('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x486536['body'][_0xc44d('0x5c')]=_0x486536[_0xc44d('0x54')][_0xc44d('0x5c')]||_0x486536[_0xc44d('0x5d')]['id'];_0x583127['agent']['id']=_0x486536[_0xc44d('0x54')][_0xc44d('0x5c')];return db[_0xc44d('0x36')]['find']({'where':{'id':_0x486536['params']['id'],'UserId':null}})[_0xc44d('0x1e')](handleEntityNotFound(_0x2de8b2,null))[_0xc44d('0x1e')](saveUpdates(_0x486536[_0xc44d('0x54')],null))['then'](function(_0x2595d3){if(_0x2595d3){_0x583127[_0xc44d('0x25')]=_0x2595d3[_0xc44d('0x5e')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x2595d3[_0xc44d('0x5f')]}});}return null;})[_0xc44d('0x1e')](handleEntityNotFound(_0x2de8b2,null))[_0xc44d('0x1e')](function(_0x1f3424){if(_0x1f3424){return _0x1f3424[_0xc44d('0x31')]({'UserId':_0x486536[_0xc44d('0x54')][_0xc44d('0x5c')],'read1stAt':_['isNil'](_0x1f3424[_0xc44d('0x60')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xc44d('0x1e')](function(_0x49b054){if(_0x49b054){_0x583127[_0xc44d('0x61')]=_0x49b054['get']({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x486536[_0xc44d('0x5d')]['id'],_0x486536[_0xc44d('0x5d')][_0xc44d('0x39')],_0x486536[_0xc44d('0x5d')][_0xc44d('0x62')],_0x583127[_0xc44d('0x61')]['id'],_0x486536[_0xc44d('0x54')]?JSON[_0xc44d('0x23')](_0x486536[_0xc44d('0x54')]):'null');return respondWithRpcPromise(_0xc44d('0x63'),'acceptMessage',_0x583127);}return null;})['then'](function(_0x2da754){var _0x59ea4e=_0xc44d('0x64')+_0x2da754[_0xc44d('0x25')][_0xc44d('0x65')];return db[_0xc44d('0x66')]['query'](_0x59ea4e,{'type':db['Sequelize'][_0xc44d('0x67')][_0xc44d('0x68')],'raw':!![]})[_0xc44d('0x1e')](function(_0x1717e0){return _0x1717e0;});})[_0xc44d('0x1e')](function(_0x2dd2ca){if(_0x2dd2ca){_0x583127[_0xc44d('0x25')][_0xc44d('0x69')]=_0x2dd2ca[0x0];if(!_0x486536[_0xc44d('0x54')]['UserId'])return;return db['User'][_0xc44d('0x55')]({'where':{'id':_0x486536[_0xc44d('0x54')][_0xc44d('0x5c')],'role':_0xc44d('0x6a')},'attributes':['id',_0xc44d('0x39'),_0xc44d('0x6b'),'email','internal'],'raw':!![]});}return null;})[_0xc44d('0x1e')](function(_0x4374a9){if(!_0x4374a9)return null;_0x583127[_0xc44d('0x25')][_0xc44d('0x6a')]=_0x4374a9;return _0x583127;})['then'](function(_0x52e0a5){if(_0x52e0a5){if(_0x486536['body'][_0xc44d('0x6c')]){_0x583127[_0xc44d('0x25')][_0xc44d('0x6d')]=util[_0xc44d('0x5b')](_0xc44d('0x6e'),_0x486536['user']['name']);_0x583127[_0xc44d('0x25')]['channel']=_0x583127[_0xc44d('0x6f')];_0x583127['message'][_0xc44d('0x70')]=_0x583127[_0xc44d('0x6f')];_0x583127[_0xc44d('0x25')]['event']=_0xc44d('0x58');return respondWithRpcPromise(_0xc44d('0x71'),_0xc44d('0x71'),{'event':_0xc44d('0x72'),'message':_['merge'](_0x583127[_0xc44d('0x25')],JSON['parse'](_0x583127[_0xc44d('0x61')][_0xc44d('0x73')]))},client9002)[_0xc44d('0x1e')](function(){return _0x583127;});}return _0x583127;}return null;})[_0xc44d('0x1e')](respondWithResult(_0x2de8b2,null))[_0xc44d('0x27')](handleError(_0x2de8b2,null));};var interaction_log=require(_0xc44d('0x74'))(_0xc44d('0x57'));exports[_0xc44d('0x75')]=function(_0x5ce238,_0x2bdd7d,_0xa081a2){var _0x27a4ac={'agent':{},'channel':_0xc44d('0x59')};if(_0x5ce238[_0xc44d('0x54')]['id']){delete _0x5ce238['body']['id'];}_0x5ce238[_0xc44d('0x54')][_0xc44d('0x5c')]=_0x5ce238[_0xc44d('0x54')]['UserId']||_0x5ce238['user']['id'];_0x27a4ac[_0xc44d('0x6a')]['id']=_0x5ce238[_0xc44d('0x54')][_0xc44d('0x5c')];return db['ChatMessage'][_0xc44d('0x55')]({'where':{'id':_0x5ce238[_0xc44d('0x51')]['id'],'UserId':null}})[_0xc44d('0x1e')](handleEntityNotFound(_0x2bdd7d,null))[_0xc44d('0x1e')](function(_0x42bc90){if(_0x42bc90){_0x27a4ac[_0xc44d('0x25')]=_0x42bc90['get']({'plain':!![]});return db[_0xc44d('0x76')]['find']({'where':{'id':_0x42bc90[_0xc44d('0x5f')]}});}return null;})[_0xc44d('0x1e')](handleEntityNotFound(_0x2bdd7d,null))[_0xc44d('0x1e')](function(_0x4b5b9b){if(_0x4b5b9b){_0x27a4ac[_0xc44d('0x61')]=_0x4b5b9b[_0xc44d('0x5e')]({'plain':!![]});interaction_log['info'](_0xc44d('0x77'),_0x5ce238[_0xc44d('0x5d')]['id'],_0x5ce238['user'][_0xc44d('0x39')],_0x5ce238['user'][_0xc44d('0x62')],_0x27a4ac[_0xc44d('0x61')]['id'],_0x5ce238[_0xc44d('0x54')]?JSON[_0xc44d('0x23')](_0x5ce238[_0xc44d('0x54')]):_0xc44d('0x78'));return respondWithRpcPromise(_0xc44d('0x79'),_0xc44d('0x7a'),_0x27a4ac);}return null;})[_0xc44d('0x1e')](function(_0x3c66a3){var _0x45415f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3c66a3['message'][_0xc44d('0x65')];return db[_0xc44d('0x66')][_0xc44d('0x3a')](_0x45415f,{'type':db[_0xc44d('0x7b')][_0xc44d('0x67')]['SELECT'],'raw':!![]})['then'](function(_0x5a008b){return _0x5a008b;});})[_0xc44d('0x1e')](function(_0x4213f1){if(_0x4213f1){_0x27a4ac[_0xc44d('0x25')][_0xc44d('0x69')]=_0x4213f1[0x0];if(!_0x5ce238['body'][_0xc44d('0x5c')])return;return db[_0xc44d('0x7c')][_0xc44d('0x55')]({'where':{'id':_0x5ce238['body'][_0xc44d('0x5c')],'role':_0xc44d('0x6a')},'attributes':['id','name',_0xc44d('0x6b'),_0xc44d('0x7d'),'internal'],'raw':!![]});}return null;})[_0xc44d('0x1e')](function(_0x2bbe43){if(!_0x2bbe43)return null;_0x27a4ac[_0xc44d('0x25')][_0xc44d('0x6a')]=_0x2bbe43;return _0x27a4ac;})[_0xc44d('0x1e')](function(_0x5dbd27){if(_0x5dbd27){_0x5dbd27[_0xc44d('0x25')][_0xc44d('0x6d')]=util[_0xc44d('0x5b')](_0xc44d('0x6e'),_0x5ce238[_0xc44d('0x5d')][_0xc44d('0x39')]);_0x5dbd27[_0xc44d('0x25')][_0xc44d('0x6f')]=_0x27a4ac[_0xc44d('0x6f')];_0x5dbd27[_0xc44d('0x25')][_0xc44d('0x70')]=_0x27a4ac[_0xc44d('0x6f')];_0x5dbd27[_0xc44d('0x25')][_0xc44d('0x7e')]='reject';respondWithRpcPromise(_0xc44d('0x71'),_0xc44d('0x71'),{'event':_0xc44d('0x7f'),'message':_[_0xc44d('0x48')](_0x27a4ac[_0xc44d('0x25')],JSON[_0xc44d('0x80')](_0x27a4ac[_0xc44d('0x61')][_0xc44d('0x73')]))},client9002);return _0x27a4ac;}return null;})['then'](respondWithResult(_0x2bdd7d,null))['catch'](handleError(_0x2bdd7d,null));}; \ No newline at end of file +var _0x0145=['destroy','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','describe','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','channel','motionChannel','EventManager','acceptmessage','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','email','interface','SIP/%s','event','reject','rejectmessage','parse','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update'];(function(_0x16d6e,_0x2713fe){var _0x5c3d1f=function(_0x493db9){while(--_0x493db9){_0x16d6e['push'](_0x16d6e['shift']());}};_0x5c3d1f(++_0x2713fe);}(_0x0145,0x1e8));var _0x5014=function(_0x3297ad,_0xb5fd4f){_0x3297ad=_0x3297ad-0x0;var _0x5f1c86=_0x0145[_0x3297ad];return _0x5f1c86;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5014('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5014('0x1'));var rp=require('request-promise');var moment=require(_0x5014('0x2'));var BPromise=require(_0x5014('0x3'));var Mustache=require(_0x5014('0x4'));var util=require(_0x5014('0x5'));var path=require(_0x5014('0x6'));var sox=require('sox');var csv=require(_0x5014('0x7'));var ejs=require(_0x5014('0x8'));var fs=require('fs');var fs_extra=require(_0x5014('0x9'));var _=require('lodash');var squel=require(_0x5014('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5014('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5014('0xc'));var Papa=require(_0x5014('0xd'));var Redis=require(_0x5014('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5014('0xf'));var as=require(_0x5014('0x10'));var hardwareService=require(_0x5014('0x11'));var logger=require(_0x5014('0x12'))(_0x5014('0x13'));var utils=require('../../config/utils');var config=require(_0x5014('0x14'));var licenseUtil=require(_0x5014('0x15'));var db=require('../../mysqldb')['db'];config[_0x5014('0x16')]=_['defaults'](config[_0x5014('0x16')],{'host':_0x5014('0x17'),'port':0x18eb});var socket=require(_0x5014('0x18'))(new Redis(config[_0x5014('0x16')]));require('./chatMessage.socket')[_0x5014('0x19')](socket);var jayson=require(_0x5014('0x1a'));var client=jayson[_0x5014('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x5014('0x1b')][_0x5014('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x53af66,_0x3bdc50,_0x131539,_0x3a4fc8){return new BPromise(function(_0x3f4738,_0x17f030){var _0x15ad05=_0x3a4fc8||client;return _0x15ad05[_0x5014('0x1d')](_0x53af66,_0x131539)[_0x5014('0x1e')](function(_0x393cd4){logger[_0x5014('0x1f')]('ChatMessage,\x20%s,\x20%s',_0x3bdc50,_0x5014('0x20'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x3bdc50,_0x5014('0x20'),JSON[_0x5014('0x21')](_0x393cd4));if(_0x393cd4[_0x5014('0x22')]){if(_0x393cd4[_0x5014('0x22')][_0x5014('0x23')]===0x1f4){logger['error'](_0x5014('0x24'),_0x3bdc50,_0x393cd4[_0x5014('0x22')][_0x5014('0x25')]);return _0x17f030(_0x393cd4['error'][_0x5014('0x25')]);}logger[_0x5014('0x22')](_0x5014('0x24'),_0x3bdc50,_0x393cd4[_0x5014('0x22')][_0x5014('0x25')]);return _0x3f4738(_0x393cd4[_0x5014('0x22')][_0x5014('0x25')]);}else{logger[_0x5014('0x1f')]('ChatMessage,\x20%s,\x20%s',_0x3bdc50,_0x5014('0x20'));_0x3f4738(_0x393cd4[_0x5014('0x26')][_0x5014('0x25')]);}})[_0x5014('0x27')](function(_0x57c1fa){logger[_0x5014('0x22')]('ChatMessage,\x20%s,\x20%s',_0x3bdc50,_0x57c1fa);_0x17f030(_0x57c1fa);});});}function respondWithStatusCode(_0x573603,_0x5422e6){_0x5422e6=_0x5422e6||0xcc;return function(_0x1775ac){if(_0x1775ac){return _0x573603[_0x5014('0x28')](_0x5422e6);}return _0x573603[_0x5014('0x29')](_0x5422e6)[_0x5014('0x2a')]();};}function respondWithResult(_0x2ddd54,_0x3d57ae){_0x3d57ae=_0x3d57ae||0xc8;return function(_0x2eca06){if(_0x2eca06){return _0x2ddd54[_0x5014('0x29')](_0x3d57ae)[_0x5014('0x2b')](_0x2eca06);}};}function respondWithFilteredResult(_0x11844d,_0x4d1468){return function(_0x28d825){if(_0x28d825){var _0x2b029c=typeof _0x4d1468[_0x5014('0x2c')]===_0x5014('0x2d')&&typeof _0x4d1468['limit']===_0x5014('0x2d');var _0x38469e=_0x28d825[_0x5014('0x2e')];var _0x3331cf=_0x2b029c?0x0:_0x4d1468['offset'];var _0x528c69=_0x2b029c?_0x28d825[_0x5014('0x2e')]:_0x4d1468[_0x5014('0x2c')]+_0x4d1468['limit'];var _0x24bc0b;if(_0x528c69>=_0x38469e){_0x528c69=_0x38469e;_0x24bc0b=0xc8;}else{_0x24bc0b=0xce;}_0x11844d[_0x5014('0x29')](_0x24bc0b);return _0x11844d[_0x5014('0x2f')](_0x5014('0x30'),_0x3331cf+'-'+_0x528c69+'/'+_0x38469e)[_0x5014('0x2b')](_0x28d825);}return null;};}function patchUpdates(_0x12be96){return function(_0x68986c){try{jsonpatch[_0x5014('0x31')](_0x68986c,_0x12be96,!![]);}catch(_0x8dee87){return BPromise['reject'](_0x8dee87);}return _0x68986c[_0x5014('0x32')]();};}function saveUpdates(_0x33bad9,_0x3ed519){return function(_0x3ebd3f){if(_0x3ebd3f){return _0x3ebd3f[_0x5014('0x33')](_0x33bad9)[_0x5014('0x1e')](function(_0x1df63c){return _0x1df63c;});}return null;};}function removeEntity(_0x263fa2,_0x2994aa){return function(_0x111072){if(_0x111072){return _0x111072[_0x5014('0x34')]()[_0x5014('0x1e')](function(){_0x263fa2[_0x5014('0x29')](0xcc)[_0x5014('0x2a')]();});}};}function handleEntityNotFound(_0x2910cb,_0x180fdf){return function(_0xf292d6){if(!_0xf292d6){_0x2910cb[_0x5014('0x28')](0x194);}return _0xf292d6;};}function handleError(_0x34ce61,_0x4bc59f){_0x4bc59f=_0x4bc59f||0x1f4;return function(_0x3657ee){logger[_0x5014('0x22')](_0x3657ee[_0x5014('0x35')]);if(_0x3657ee[_0x5014('0x36')]){delete _0x3657ee[_0x5014('0x36')];}_0x34ce61[_0x5014('0x29')](_0x4bc59f)[_0x5014('0x37')](_0x3657ee);};}exports[_0x5014('0x38')]=function(_0x21670,_0x141a30){var _0x49d4eb={},_0x4239b2={},_0x47e3ec={'count':0x0,'rows':[]};var _0x2faeb3=_[_0x5014('0x39')](db[_0x5014('0x3a')][_0x5014('0x3b')],function(_0x3093ae){return{'name':_0x3093ae[_0x5014('0x3c')],'type':_0x3093ae[_0x5014('0x3d')][_0x5014('0x3e')]};});_0x4239b2['model']=_['map'](_0x2faeb3,_0x5014('0x36'));_0x4239b2['query']=_[_0x5014('0x3f')](_0x21670[_0x5014('0x40')]);_0x4239b2[_0x5014('0x41')]=_[_0x5014('0x42')](_0x4239b2[_0x5014('0x43')],_0x4239b2[_0x5014('0x40')]);_0x49d4eb[_0x5014('0x44')]=_['intersection'](_0x4239b2[_0x5014('0x43')],qs[_0x5014('0x45')](_0x21670[_0x5014('0x40')][_0x5014('0x45')]));_0x49d4eb['attributes']=_0x49d4eb[_0x5014('0x44')][_0x5014('0x46')]?_0x49d4eb['attributes']:_0x4239b2[_0x5014('0x43')];if(!_0x21670['query']['hasOwnProperty'](_0x5014('0x47'))){_0x49d4eb[_0x5014('0x48')]=qs[_0x5014('0x48')](_0x21670['query'][_0x5014('0x48')]);_0x49d4eb['offset']=qs[_0x5014('0x2c')](_0x21670[_0x5014('0x40')][_0x5014('0x2c')]);}_0x49d4eb[_0x5014('0x49')]=qs[_0x5014('0x4a')](_0x21670[_0x5014('0x40')][_0x5014('0x4a')]);_0x49d4eb[_0x5014('0x4b')]=qs[_0x5014('0x41')](_[_0x5014('0x4c')](_0x21670[_0x5014('0x40')],_0x4239b2[_0x5014('0x41')]),_0x2faeb3);if(_0x21670[_0x5014('0x40')][_0x5014('0x4d')]){_0x49d4eb[_0x5014('0x4b')]=_[_0x5014('0x4e')](_0x49d4eb['where'],{'$or':_[_0x5014('0x39')](_0x2faeb3,function(_0x13a24a){if(_0x13a24a['type']!==_0x5014('0x4f')){var _0x57f337={};_0x57f337[_0x13a24a[_0x5014('0x36')]]={'$like':'%'+_0x21670[_0x5014('0x40')][_0x5014('0x4d')]+'%'};return _0x57f337;}})});}_0x49d4eb=_['merge']({},_0x49d4eb,_0x21670[_0x5014('0x50')]);var _0x4c4f4c={'where':_0x49d4eb[_0x5014('0x4b')]};return db[_0x5014('0x3a')][_0x5014('0x2e')](_0x4c4f4c)['then'](function(_0x15193a){_0x47e3ec[_0x5014('0x2e')]=_0x15193a;if(_0x21670[_0x5014('0x40')][_0x5014('0x51')]){_0x49d4eb[_0x5014('0x52')]=[{'all':!![]}];}return db[_0x5014('0x3a')][_0x5014('0x53')](_0x49d4eb);})[_0x5014('0x1e')](function(_0x5cb513){_0x47e3ec[_0x5014('0x54')]=_0x5cb513;return _0x47e3ec;})[_0x5014('0x1e')](respondWithFilteredResult(_0x141a30,_0x49d4eb))[_0x5014('0x27')](handleError(_0x141a30,null));};exports['show']=function(_0x28e1fd,_0x4523e6){var _0x10f69c={'raw':!![],'where':{'id':_0x28e1fd[_0x5014('0x55')]['id']}},_0xfa85a3={};_0xfa85a3[_0x5014('0x43')]=_[_0x5014('0x3f')](db[_0x5014('0x3a')][_0x5014('0x3b')]);_0xfa85a3[_0x5014('0x40')]=_[_0x5014('0x3f')](_0x28e1fd[_0x5014('0x40')]);_0xfa85a3[_0x5014('0x41')]=_[_0x5014('0x42')](_0xfa85a3['model'],_0xfa85a3['query']);_0x10f69c['attributes']=_[_0x5014('0x42')](_0xfa85a3[_0x5014('0x43')],qs['fields'](_0x28e1fd[_0x5014('0x40')][_0x5014('0x45')]));_0x10f69c['attributes']=_0x10f69c[_0x5014('0x44')][_0x5014('0x46')]?_0x10f69c['attributes']:_0xfa85a3[_0x5014('0x43')];if(_0x28e1fd['query'][_0x5014('0x51')]){_0x10f69c[_0x5014('0x52')]=[{'all':!![]}];}_0x10f69c=_[_0x5014('0x4e')]({},_0x10f69c,_0x28e1fd[_0x5014('0x50')]);return db[_0x5014('0x3a')][_0x5014('0x56')](_0x10f69c)[_0x5014('0x1e')](handleEntityNotFound(_0x4523e6,null))['then'](respondWithResult(_0x4523e6,null))[_0x5014('0x27')](handleError(_0x4523e6,null));};exports[_0x5014('0x57')]=function(_0x35f2ff,_0x5db174){return db[_0x5014('0x3a')][_0x5014('0x57')](_0x35f2ff[_0x5014('0x58')],{})['then'](respondWithResult(_0x5db174,0xc9))[_0x5014('0x27')](handleError(_0x5db174,null));};exports[_0x5014('0x33')]=function(_0x36ac64,_0x13dd11){if(_0x36ac64[_0x5014('0x58')]['id']){delete _0x36ac64['body']['id'];}return db[_0x5014('0x3a')][_0x5014('0x56')]({'where':{'id':_0x36ac64['params']['id']}})[_0x5014('0x1e')](handleEntityNotFound(_0x13dd11,null))[_0x5014('0x1e')](saveUpdates(_0x36ac64[_0x5014('0x58')],null))[_0x5014('0x1e')](respondWithResult(_0x13dd11,null))[_0x5014('0x27')](handleError(_0x13dd11,null));};exports[_0x5014('0x34')]=function(_0x1b3bfa,_0xed0f0f){return db[_0x5014('0x3a')][_0x5014('0x56')]({'where':{'id':_0x1b3bfa[_0x5014('0x55')]['id']}})['then'](handleEntityNotFound(_0xed0f0f,null))[_0x5014('0x1e')](removeEntity(_0xed0f0f,null))['catch'](handleError(_0xed0f0f,null));};exports[_0x5014('0x59')]=function(_0x357b16,_0x2217ce){return db[_0x5014('0x3a')][_0x5014('0x59')]()[_0x5014('0x1e')](respondWithResult(_0x2217ce,null))['catch'](handleError(_0x2217ce,null));};var interaction_log=require('../../config/logger')(_0x5014('0x5a'));exports[_0x5014('0x5b')]=function(_0x184556,_0x43c84a,_0xdbc02){var _0x8b04ab={'agent':{},'channel':_0x5014('0x5c')};if(_0x184556[_0x5014('0x58')]['id']){delete _0x184556[_0x5014('0x58')]['id'];}_0x184556['body'][_0x5014('0x5d')]=!![];_0x184556[_0x5014('0x58')]['readAt']=moment()[_0x5014('0x5e')](_0x5014('0x5f'));_0x184556['body']['UserId']=_0x184556['body'][_0x5014('0x60')]||_0x184556[_0x5014('0x61')]['id'];_0x8b04ab[_0x5014('0x62')]['id']=_0x184556[_0x5014('0x58')]['UserId'];return db[_0x5014('0x3a')][_0x5014('0x56')]({'where':{'id':_0x184556[_0x5014('0x55')]['id'],'UserId':null}})[_0x5014('0x1e')](handleEntityNotFound(_0x43c84a,null))[_0x5014('0x1e')](saveUpdates(_0x184556[_0x5014('0x58')],null))[_0x5014('0x1e')](function(_0x2d5719){if(_0x2d5719){_0x8b04ab['message']=_0x2d5719[_0x5014('0x63')]({'plain':!![]});return db[_0x5014('0x64')][_0x5014('0x56')]({'where':{'id':_0x2d5719[_0x5014('0x65')]}});}return null;})[_0x5014('0x1e')](handleEntityNotFound(_0x43c84a,null))['then'](function(_0x5c0491){if(_0x5c0491){return _0x5c0491['update']({'UserId':_0x184556[_0x5014('0x58')][_0x5014('0x60')],'read1stAt':_[_0x5014('0x66')](_0x5c0491[_0x5014('0x67')])?moment()[_0x5014('0x5e')](_0x5014('0x5f')):undefined});}return null;})['then'](function(_0x345318){if(_0x345318){_0x8b04ab[_0x5014('0x68')]=_0x345318['get']({'plain':!![]});interaction_log[_0x5014('0x1f')](_0x5014('0x69'),_0x184556['user']['id'],_0x184556[_0x5014('0x61')][_0x5014('0x36')],_0x184556[_0x5014('0x61')][_0x5014('0x6a')],_0x8b04ab['interaction']['id'],_0x184556[_0x5014('0x58')]?JSON[_0x5014('0x21')](_0x184556[_0x5014('0x58')]):'null');return respondWithRpcPromise(_0x5014('0x6b'),_0x5014('0x6c'),_0x8b04ab);}return null;})['then'](function(_0x542ca4){var _0x2c8774='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x542ca4[_0x5014('0x25')]['ContactId'];return db[_0x5014('0x6d')][_0x5014('0x40')](_0x2c8774,{'type':db['Sequelize'][_0x5014('0x6e')][_0x5014('0x6f')],'raw':!![]})[_0x5014('0x1e')](function(_0x1cbfaa){return _0x1cbfaa;});})[_0x5014('0x1e')](function(_0x38fe67){if(_0x38fe67){_0x8b04ab['message'][_0x5014('0x70')]=_0x38fe67[0x0];if(!_0x184556[_0x5014('0x58')][_0x5014('0x60')])return;return db[_0x5014('0x71')][_0x5014('0x56')]({'where':{'id':_0x184556[_0x5014('0x58')][_0x5014('0x60')],'role':_0x5014('0x62')},'attributes':['id','name',_0x5014('0x72'),'email',_0x5014('0x73')],'raw':!![]});}return null;})[_0x5014('0x1e')](function(_0x5c3a2d){if(!_0x5c3a2d)return null;_0x8b04ab[_0x5014('0x25')]['agent']=_0x5c3a2d;return _0x8b04ab;})[_0x5014('0x1e')](function(_0x442113){if(_0x442113){if(_0x184556[_0x5014('0x58')][_0x5014('0x74')]){_0x8b04ab[_0x5014('0x25')]['interface']=util[_0x5014('0x5e')]('SIP/%s',_0x184556[_0x5014('0x61')]['name']);_0x8b04ab[_0x5014('0x25')][_0x5014('0x75')]=_0x8b04ab[_0x5014('0x75')];_0x8b04ab[_0x5014('0x25')][_0x5014('0x76')]=_0x8b04ab[_0x5014('0x75')];_0x8b04ab[_0x5014('0x25')]['event']=_0x5014('0x5b');return respondWithRpcPromise(_0x5014('0x77'),_0x5014('0x77'),{'event':_0x5014('0x78'),'message':_[_0x5014('0x4e')](_0x8b04ab['message'],JSON['parse'](_0x8b04ab[_0x5014('0x68')][_0x5014('0x79')]))},client9002)[_0x5014('0x1e')](function(){return _0x8b04ab;});}return _0x8b04ab;}return null;})[_0x5014('0x1e')](respondWithResult(_0x43c84a,null))[_0x5014('0x27')](handleError(_0x43c84a,null));};var interaction_log=require(_0x5014('0x12'))(_0x5014('0x5a'));exports['reject']=function(_0x12902c,_0x2c03e4,_0x53df82){var _0x55f3d1={'agent':{},'channel':_0x5014('0x5c')};if(_0x12902c[_0x5014('0x58')]['id']){delete _0x12902c[_0x5014('0x58')]['id'];}_0x12902c[_0x5014('0x58')][_0x5014('0x60')]=_0x12902c[_0x5014('0x58')][_0x5014('0x60')]||_0x12902c[_0x5014('0x61')]['id'];_0x55f3d1[_0x5014('0x62')]['id']=_0x12902c[_0x5014('0x58')][_0x5014('0x60')];return db[_0x5014('0x3a')]['find']({'where':{'id':_0x12902c[_0x5014('0x55')]['id'],'UserId':null}})[_0x5014('0x1e')](handleEntityNotFound(_0x2c03e4,null))[_0x5014('0x1e')](function(_0x27fc4a){if(_0x27fc4a){_0x55f3d1[_0x5014('0x25')]=_0x27fc4a['get']({'plain':!![]});return db[_0x5014('0x64')][_0x5014('0x56')]({'where':{'id':_0x27fc4a[_0x5014('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x2c03e4,null))['then'](function(_0x46724c){if(_0x46724c){_0x55f3d1['interaction']=_0x46724c[_0x5014('0x63')]({'plain':!![]});interaction_log[_0x5014('0x1f')](_0x5014('0x7a'),_0x12902c['user']['id'],_0x12902c[_0x5014('0x61')][_0x5014('0x36')],_0x12902c['user']['role'],_0x55f3d1[_0x5014('0x68')]['id'],_0x12902c[_0x5014('0x58')]?JSON[_0x5014('0x21')](_0x12902c['body']):'null');return respondWithRpcPromise(_0x5014('0x7b'),_0x5014('0x7c'),_0x55f3d1);}return null;})[_0x5014('0x1e')](function(_0x1834cb){var _0x4e0718=_0x5014('0x7d')+_0x1834cb[_0x5014('0x25')][_0x5014('0x7e')];return db[_0x5014('0x6d')]['query'](_0x4e0718,{'type':db[_0x5014('0x7f')][_0x5014('0x6e')][_0x5014('0x6f')],'raw':!![]})[_0x5014('0x1e')](function(_0x2a528d){return _0x2a528d;});})['then'](function(_0x376f14){if(_0x376f14){_0x55f3d1['message']['contact']=_0x376f14[0x0];if(!_0x12902c['body'][_0x5014('0x60')])return;return db['User'][_0x5014('0x56')]({'where':{'id':_0x12902c[_0x5014('0x58')][_0x5014('0x60')],'role':_0x5014('0x62')},'attributes':['id',_0x5014('0x36'),_0x5014('0x72'),_0x5014('0x80'),_0x5014('0x73')],'raw':!![]});}return null;})['then'](function(_0x2baf2b){if(!_0x2baf2b)return null;_0x55f3d1[_0x5014('0x25')][_0x5014('0x62')]=_0x2baf2b;return _0x55f3d1;})[_0x5014('0x1e')](function(_0x38ab2d){if(_0x38ab2d){_0x38ab2d[_0x5014('0x25')][_0x5014('0x81')]=util[_0x5014('0x5e')](_0x5014('0x82'),_0x12902c['user'][_0x5014('0x36')]);_0x38ab2d[_0x5014('0x25')][_0x5014('0x75')]=_0x55f3d1[_0x5014('0x75')];_0x38ab2d[_0x5014('0x25')][_0x5014('0x76')]=_0x55f3d1[_0x5014('0x75')];_0x38ab2d['message'][_0x5014('0x83')]=_0x5014('0x84');respondWithRpcPromise(_0x5014('0x77'),_0x5014('0x77'),{'event':_0x5014('0x85'),'message':_[_0x5014('0x4e')](_0x55f3d1[_0x5014('0x25')],JSON[_0x5014('0x86')](_0x55f3d1[_0x5014('0x68')]['formData']))},client9002);return _0x55f3d1;}return null;})[_0x5014('0x1e')](respondWithResult(_0x2c03e4,null))['catch'](handleError(_0x2c03e4,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 1f96f6c..6fd7e37 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 _0xfc23=['hook','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x204836,_0x34d172){var _0x335884=function(_0x4e8e65){while(--_0x4e8e65){_0x204836['push'](_0x204836['shift']());}};_0x335884(++_0x34d172);}(_0xfc23,0x1cc));var _0x3fc2=function(_0x558cc0,_0x11832a){_0x558cc0=_0x558cc0-0x0;var _0x226a04=_0xfc23[_0x558cc0];return _0x226a04;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x3fc2('0x0'))['db'][_0x3fc2('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x3fc2('0x2')](0x0);var events={'afterCreate':_0x3fc2('0x3'),'afterUpdate':_0x3fc2('0x4'),'afterDestroy':_0x3fc2('0x5')};function emitEvent(_0x4727f7){return function(_0x167cc2,_0x53858b,_0x2c1190){ChatMessageEvents[_0x3fc2('0x6')](_0x4727f7+':'+_0x167cc2['id'],_0x167cc2);ChatMessageEvents[_0x3fc2('0x6')](_0x4727f7,_0x167cc2);_0x2c1190(null);};}for(var e in events){if(events[_0x3fc2('0x7')](e)){var event=events[e];ChatMessage[_0x3fc2('0x8')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x9ca9=['emit','hasOwnProperty','events','ChatMessage','save','update','remove'];(function(_0x4ec65b,_0x1ecbec){var _0x5bff8d=function(_0x15eb85){while(--_0x15eb85){_0x4ec65b['push'](_0x4ec65b['shift']());}};_0x5bff8d(++_0x1ecbec);}(_0x9ca9,0x1c2));var _0x99ca=function(_0x12f6ba,_0xdad761){_0x12f6ba=_0x12f6ba-0x0;var _0x4252f7=_0x9ca9[_0x12f6ba];return _0x4252f7;};'use strict';var EventEmitter=require(_0x99ca('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x99ca('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x99ca('0x2'),'afterUpdate':_0x99ca('0x3'),'afterDestroy':_0x99ca('0x4')};function emitEvent(_0x305863){return function(_0x3b7759,_0x3e0c26,_0xf6f586){ChatMessageEvents[_0x99ca('0x5')](_0x305863+':'+_0x3b7759['id'],_0x3b7759);ChatMessageEvents[_0x99ca('0x5')](_0x305863,_0x3b7759);_0xf6f586(null);};}for(var e in events){if(events[_0x99ca('0x6')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 5308720..d6723bb 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 _0x92d7=['createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','update'];(function(_0x34ab37,_0x20c6a4){var _0x252433=function(_0x6f3d50){while(--_0x6f3d50){_0x34ab37['push'](_0x34ab37['shift']());}};_0x252433(++_0x20c6a4);}(_0x92d7,0x79));var _0x792d=function(_0x4055bc,_0x2f8397){_0x4055bc=_0x4055bc-0x0;var _0x1fc74c=_0x92d7[_0x4055bc];return _0x1fc74c;};'use strict';var _=require(_0x792d('0x0'));var util=require(_0x792d('0x1'));var logger=require(_0x792d('0x2'))(_0x792d('0x3'));var moment=require('moment');var BPromise=require(_0x792d('0x4'));var rp=require(_0x792d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x792d('0x6'));var attributes=require(_0x792d('0x7'));module['exports']=function(_0x5b8320,_0x383b31){return _0x5b8320[_0x792d('0x8')](_0x792d('0x9'),attributes,{'tableName':_0x792d('0xa'),'paranoid':![],'indexes':[{'name':_0x792d('0xb'),'fields':[_0x792d('0xc')],'type':_0x792d('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x467177,_0x3bdf6e,_0x280b0a){var _0x47977e=_0x5b8320[_0x792d('0xe')];var _0x286898=_0x467177[_0x792d('0xf')]({'plain':!![]});if(_0x286898[_0x792d('0x10')][_0x792d('0x11')]()==='in'||_0x286898[_0x792d('0x10')][_0x792d('0x11')]()==='out'&&!_0x286898[_0x792d('0x12')]&&!_[_0x792d('0x13')](_0x286898[_0x792d('0x14')])){_0x47977e[_0x792d('0x15')][_0x792d('0x16')]({'where':{'id':_0x286898['ChatInteractionId']}})['then'](function(_0x44de9f){if(_0x44de9f){_0x44de9f[_0x792d('0x17')]({'lastMsgAt':_0x286898[_0x792d('0x18')],'lastMsgDirection':_0x286898[_0x792d('0x10')][_0x792d('0x11')]()});}})[_0x792d('0x19')](function(_0x498779){console[_0x792d('0x1a')](_0x498779);});}_0x280b0a();}},'charset':_0x792d('0x1b'),'collate':_0x792d('0x1c')});}; \ No newline at end of file +var _0x7604=['findOne','ChatInteractionId','then','update','createdAt','catch','error','lodash','util','../../config/logger','api','request-promise','path','rimraf','./chatMessage.attributes','exports','define','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId'];(function(_0x58f555,_0x552ef2){var _0x4eb99b=function(_0x110a86){while(--_0x110a86){_0x58f555['push'](_0x58f555['shift']());}};_0x4eb99b(++_0x552ef2);}(_0x7604,0xd2));var _0x4760=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7604[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x4760('0x0'));var util=require(_0x4760('0x1'));var logger=require(_0x4760('0x2'))(_0x4760('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4760('0x4'));var fs=require('fs');var path=require(_0x4760('0x5'));var rimraf=require(_0x4760('0x6'));var config=require('../../config/environment');var attributes=require(_0x4760('0x7'));module[_0x4760('0x8')]=function(_0x4b0681,_0x3d707b){return _0x4b0681[_0x4760('0x9')]('ChatMessage',attributes,{'tableName':_0x4760('0xa'),'paranoid':![],'indexes':[{'name':_0x4760('0xb'),'fields':[_0x4760('0xc')],'type':_0x4760('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x26bb27,_0x1969d0,_0x5f2c9d){var _0x3a3000=_0x4b0681[_0x4760('0xe')];var _0x30810b=_0x26bb27[_0x4760('0xf')]({'plain':!![]});if(_0x30810b[_0x4760('0x10')][_0x4760('0x11')]()==='in'||_0x30810b[_0x4760('0x10')][_0x4760('0x11')]()===_0x4760('0x12')&&!_0x30810b[_0x4760('0x13')]&&!_[_0x4760('0x14')](_0x30810b[_0x4760('0x15')])){_0x3a3000['ChatInteraction'][_0x4760('0x16')]({'where':{'id':_0x30810b[_0x4760('0x17')]}})[_0x4760('0x18')](function(_0x3073a7){if(_0x3073a7){_0x3073a7[_0x4760('0x19')]({'lastMsgAt':_0x30810b[_0x4760('0x1a')],'lastMsgDirection':_0x30810b[_0x4760('0x10')][_0x4760('0x11')]()});}})[_0x4760('0x1b')](function(_0x507cfa){console[_0x4760('0x1c')](_0x507cfa);});}_0x5f2c9d();}},'charset':'utf8mb4','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 982e04b..aa35c41 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 _0x14f8=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','CreateChatMessage','create','body','options','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x5ecbbc,_0x2541f5){var _0x219a19=function(_0x49d792){while(--_0x49d792){_0x5ecbbc['push'](_0x5ecbbc['shift']());}};_0x219a19(++_0x2541f5);}(_0x14f8,0x66));var _0x814f=function(_0x3151c1,_0x25d2c1){_0x3151c1=_0x3151c1-0x0;var _0x4ddce5=_0x14f8[_0x3151c1];return _0x4ddce5;};'use strict';var _=require('lodash');var util=require(_0x814f('0x0'));var moment=require(_0x814f('0x1'));var BPromise=require(_0x814f('0x2'));var rs=require(_0x814f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x814f('0x4'))(_0x814f('0x5'));var config=require('../../config/environment');var jayson=require(_0x814f('0x6'));var client=jayson['client'][_0x814f('0x7')]({'port':0x232a});config[_0x814f('0x8')]=_[_0x814f('0x9')](config['redis'],{'host':_0x814f('0xa'),'port':0x18eb});var socket=require(_0x814f('0xb'))(new Redis(config['redis']));require(_0x814f('0xc'))['register'](socket);function respondWithRpcPromise(_0x32644e,_0x411c5e,_0x3bfaf2){return new BPromise(function(_0x2ac7b9,_0x8e1a45){return client[_0x814f('0xd')](_0x32644e,_0x3bfaf2)[_0x814f('0xe')](function(_0x5bcb95){logger[_0x814f('0xf')](_0x814f('0x10'),_0x411c5e,_0x814f('0x11'));logger[_0x814f('0x12')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x411c5e,_0x814f('0x11'),JSON[_0x814f('0x13')](_0x5bcb95));if(_0x5bcb95[_0x814f('0x14')]){if(_0x5bcb95[_0x814f('0x14')]['code']===0x1f4){logger[_0x814f('0x14')](_0x814f('0x10'),_0x411c5e,_0x5bcb95[_0x814f('0x14')][_0x814f('0x15')]);return _0x8e1a45(_0x5bcb95[_0x814f('0x14')][_0x814f('0x15')]);}logger[_0x814f('0x14')](_0x814f('0x10'),_0x411c5e,_0x5bcb95[_0x814f('0x14')]['message']);return _0x2ac7b9(_0x5bcb95[_0x814f('0x14')][_0x814f('0x15')]);}else{logger[_0x814f('0xf')]('ChatMessage,\x20%s,\x20%s',_0x411c5e,_0x814f('0x11'));_0x2ac7b9(_0x5bcb95['result'][_0x814f('0x15')]);}})[_0x814f('0x16')](function(_0x1b86ce){logger['error']('ChatMessage,\x20%s,\x20%s',_0x411c5e,_0x1b86ce);_0x8e1a45(_0x1b86ce);});});}exports[_0x814f('0x17')]=function(_0x2b0f6b){var _0x549245=this;return new Promise(function(_0x3224b1,_0x383959){return db['ChatMessage'][_0x814f('0x18')](_0x2b0f6b[_0x814f('0x19')],{'raw':_0x2b0f6b['options']?_0x2b0f6b[_0x814f('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5aba5f){logger[_0x814f('0xf')]('CreateChatMessage',_0x2b0f6b);logger['debug'](_0x814f('0x17'),_0x2b0f6b,JSON[_0x814f('0x13')](_0x5aba5f));_0x3224b1(_0x5aba5f);})[_0x814f('0x16')](function(_0x4c1f47){logger['error']('CreateChatMessage',_0x4c1f47[_0x814f('0x15')],_0x2b0f6b);_0x383959(_0x549245['error'](0x1f4,_0x4c1f47['message']));});});}; \ No newline at end of file +var _0xa78c=['then','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatMessage,\x20%s,\x20%s','message','result','catch','CreateChatMessage','ChatMessage','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request'];(function(_0x440c9d,_0x4ea95b){var _0x4a6c8a=function(_0x169b61){while(--_0x169b61){_0x440c9d['push'](_0x440c9d['shift']());}};_0x4a6c8a(++_0x4ea95b);}(_0xa78c,0x185));var _0xca78=function(_0x2a571a,_0x48873e){_0x2a571a=_0x2a571a-0x0;var _0xdbed32=_0xa78c[_0x2a571a];return _0xdbed32;};'use strict';var _=require(_0xca78('0x0'));var util=require('util');var moment=require(_0xca78('0x1'));var BPromise=require(_0xca78('0x2'));var rs=require(_0xca78('0x3'));var fs=require('fs');var Redis=require(_0xca78('0x4'));var db=require(_0xca78('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xca78('0x6'))(_0xca78('0x7'));var config=require(_0xca78('0x8'));var jayson=require(_0xca78('0x9'));var client=jayson[_0xca78('0xa')][_0xca78('0xb')]({'port':0x232a});config[_0xca78('0xc')]=_[_0xca78('0xd')](config[_0xca78('0xc')],{'host':_0xca78('0xe'),'port':0x18eb});var socket=require(_0xca78('0xf'))(new Redis(config['redis']));require(_0xca78('0x10'))[_0xca78('0x11')](socket);function respondWithRpcPromise(_0x539912,_0x13cc01,_0x15be20){return new BPromise(function(_0x3a087c,_0x283497){return client[_0xca78('0x12')](_0x539912,_0x15be20)[_0xca78('0x13')](function(_0x358722){logger['info']('ChatMessage,\x20%s,\x20%s',_0x13cc01,_0xca78('0x14'));logger[_0xca78('0x15')](_0xca78('0x16'),_0x13cc01,_0xca78('0x14'),JSON[_0xca78('0x17')](_0x358722));if(_0x358722[_0xca78('0x18')]){if(_0x358722['error']['code']===0x1f4){logger[_0xca78('0x18')](_0xca78('0x19'),_0x13cc01,_0x358722[_0xca78('0x18')][_0xca78('0x1a')]);return _0x283497(_0x358722[_0xca78('0x18')][_0xca78('0x1a')]);}logger[_0xca78('0x18')](_0xca78('0x19'),_0x13cc01,_0x358722[_0xca78('0x18')]['message']);return _0x3a087c(_0x358722['error'][_0xca78('0x1a')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x13cc01,_0xca78('0x14'));_0x3a087c(_0x358722[_0xca78('0x1b')][_0xca78('0x1a')]);}})[_0xca78('0x1c')](function(_0x50ef4b){logger[_0xca78('0x18')](_0xca78('0x19'),_0x13cc01,_0x50ef4b);_0x283497(_0x50ef4b);});});}exports[_0xca78('0x1d')]=function(_0x4e9f70){var _0x5d62d4=this;return new Promise(function(_0x505a33,_0x3a868a){return db[_0xca78('0x1e')]['create'](_0x4e9f70[_0xca78('0x1f')],{'raw':_0x4e9f70['options']?_0x4e9f70[_0xca78('0x20')][_0xca78('0x21')]===undefined?!![]:![]:!![]})[_0xca78('0x13')](function(_0x2ca961){logger['info']('CreateChatMessage',_0x4e9f70);logger[_0xca78('0x15')](_0xca78('0x1d'),_0x4e9f70,JSON[_0xca78('0x17')](_0x2ca961));_0x505a33(_0x2ca961);})['catch'](function(_0xdafa){logger[_0xca78('0x18')]('CreateChatMessage',_0xdafa[_0xca78('0x1a')],_0x4e9f70);_0x3a868a(_0x5d62d4[_0xca78('0x18')](0x1f4,_0xdafa['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 6e53617..f335afc 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 _0x165d=['./chatMessage.events','save','remove','update','chatMessage:'];(function(_0x4596de,_0x49e8e7){var _0x3f2a40=function(_0x5a8564){while(--_0x5a8564){_0x4596de['push'](_0x4596de['shift']());}};_0x3f2a40(++_0x49e8e7);}(_0x165d,0x14a));var _0xd165=function(_0x422a38,_0xa0692){_0x422a38=_0x422a38-0x0;var _0x4bf9a9=_0x165d[_0x422a38];return _0x4bf9a9;};'use strict';var ChatMessageEvents=require(_0xd165('0x0'));var events=[_0xd165('0x1'),_0xd165('0x2'),_0xd165('0x3')];function createListener(_0x1d6b25,_0x31af22){return function(_0x43f2f9){_0x31af22['emit'](_0x1d6b25,_0x43f2f9);};}function removeListener(_0x405ee0,_0x27993b){return function(){ChatMessageEvents['removeListener'](_0x405ee0,_0x27993b);};}exports['register']=function(_0x5435f9){for(var _0x42d256=0x0,_0x2305bc=events['length'];_0x42d256<_0x2305bc;_0x42d256++){var _0x5eec53=events[_0x42d256];var _0x3fd82e=createListener(_0xd165('0x4')+_0x5eec53,_0x5435f9);ChatMessageEvents['on'](_0x5eec53,_0x3fd82e);}}; \ No newline at end of file +var _0xe198=['save','emit','removeListener','register','length','chatMessage:','./chatMessage.events'];(function(_0x286eb1,_0x2d15bd){var _0x30c63d=function(_0x45af80){while(--_0x45af80){_0x286eb1['push'](_0x286eb1['shift']());}};_0x30c63d(++_0x2d15bd);}(_0xe198,0x6f));var _0x8e19=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xe198[_0x5d2803];return _0xdcad2c;};'use strict';var ChatMessageEvents=require(_0x8e19('0x0'));var events=[_0x8e19('0x1'),'remove','update'];function createListener(_0x18c3af,_0x2b1b2b){return function(_0x2a2529){_0x2b1b2b[_0x8e19('0x2')](_0x18c3af,_0x2a2529);};}function removeListener(_0x32f52f,_0x4e3f58){return function(){ChatMessageEvents[_0x8e19('0x3')](_0x32f52f,_0x4e3f58);};}exports[_0x8e19('0x4')]=function(_0x2fb138){for(var _0x188ce0=0x0,_0x1175d6=events[_0x8e19('0x5')];_0x188ce0<_0x1175d6;_0x188ce0++){var _0x1e61ae=events[_0x188ce0];var _0xfc45e=createListener(_0x8e19('0x6')+_0x1e61ae,_0x2fb138);ChatMessageEvents['on'](_0x1e61ae,_0xfc45e);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 06957f3..d7f9466 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 _0xfbfd=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','tracked','chat','chatmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfbfd,0xb0));var _0xdfbf=function(_0x1aac26,_0x105d92){_0x1aac26=_0x1aac26-0x0;var _0x24b959=_0xfbfd[_0x1aac26];return _0x24b959;};'use strict';var multer=require(_0xdfbf('0x0'));var util=require(_0xdfbf('0x1'));var path=require(_0xdfbf('0x2'));var timeout=require(_0xdfbf('0x3'));var express=require(_0xdfbf('0x4'));var router=express[_0xdfbf('0x5')]();var fs_extra=require(_0xdfbf('0x6'));var auth=require(_0xdfbf('0x7'));var interaction=require(_0xdfbf('0x8'));var config=require(_0xdfbf('0x9'));var controller=require('./chatMessage.controller');router['get']('/',auth[_0xdfbf('0xa')](),controller[_0xdfbf('0xb')]);router[_0xdfbf('0xc')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xdfbf('0xd'),auth[_0xdfbf('0xa')](),controller[_0xdfbf('0xe')]);router['post']('/',auth[_0xdfbf('0xa')](),interaction[_0xdfbf('0xf')](_0xdfbf('0x10'),_0xdfbf('0x11')),controller[_0xdfbf('0x12')]);router[_0xdfbf('0x13')](_0xdfbf('0xd'),controller[_0xdfbf('0x14')]);router[_0xdfbf('0x13')](_0xdfbf('0x15'),auth[_0xdfbf('0xa')](),controller['accept']);router[_0xdfbf('0x13')](_0xdfbf('0x16'),auth['isAuthenticated'](),controller[_0xdfbf('0x17')]);router[_0xdfbf('0x18')]('/:id',auth[_0xdfbf('0xa')](),controller['destroy']);module[_0xdfbf('0x19')]=router; \ No newline at end of file +var _0x2fe7=['/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chatmessage:create','create','put','accept'];(function(_0x3c8dd0,_0x1a7d5d){var _0x1021b3=function(_0x2f2176){while(--_0x2f2176){_0x3c8dd0['push'](_0x3c8dd0['shift']());}};_0x1021b3(++_0x1a7d5d);}(_0x2fe7,0x171));var _0x72fe=function(_0x13197f,_0x4fb3bf){_0x13197f=_0x13197f-0x0;var _0x284998=_0x2fe7[_0x13197f];return _0x284998;};'use strict';var multer=require(_0x72fe('0x0'));var util=require(_0x72fe('0x1'));var path=require(_0x72fe('0x2'));var timeout=require(_0x72fe('0x3'));var express=require(_0x72fe('0x4'));var router=express['Router']();var fs_extra=require(_0x72fe('0x5'));var auth=require(_0x72fe('0x6'));var interaction=require(_0x72fe('0x7'));var config=require(_0x72fe('0x8'));var controller=require(_0x72fe('0x9'));router[_0x72fe('0xa')]('/',auth[_0x72fe('0xb')](),controller[_0x72fe('0xc')]);router[_0x72fe('0xa')](_0x72fe('0xd'),auth[_0x72fe('0xb')](),controller[_0x72fe('0xe')]);router[_0x72fe('0xa')](_0x72fe('0xf'),auth['isAuthenticated'](),controller[_0x72fe('0x10')]);router[_0x72fe('0x11')]('/',auth[_0x72fe('0xb')](),interaction[_0x72fe('0x12')]('chat',_0x72fe('0x13')),controller[_0x72fe('0x14')]);router[_0x72fe('0x15')](_0x72fe('0xf'),controller['update']);router[_0x72fe('0x15')]('/:id/accept',auth[_0x72fe('0xb')](),controller[_0x72fe('0x16')]);router[_0x72fe('0x15')](_0x72fe('0x17'),auth[_0x72fe('0xb')](),controller[_0x72fe('0x18')]);router[_0x72fe('0x19')]('/:id',auth[_0x72fe('0xb')](),controller[_0x72fe('0x1a')]);module[_0x72fe('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 74fbce3..a2c1db2 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 _0x01e2=['exports','TEXT','sequelize'];(function(_0xcc4d3a,_0x104f66){var _0x20bae1=function(_0x2403f8){while(--_0x2403f8){_0xcc4d3a['push'](_0xcc4d3a['shift']());}};_0x20bae1(++_0x104f66);}(_0x01e2,0x92));var _0x201e=function(_0x3a8809,_0xcef33b){_0x3a8809=_0x3a8809-0x0;var _0x5e37c4=_0x01e2[_0x3a8809];return _0x5e37c4;};'use strict';var Sequelize=require(_0x201e('0x0'));module[_0x201e('0x1')]={'body':{'type':Sequelize[_0x201e('0x2')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0xbd73=['sequelize','exports','TEXT','medium'];(function(_0x6341d6,_0x107c2d){var _0x50e641=function(_0x27c5ef){while(--_0x27c5ef){_0x6341d6['push'](_0x6341d6['shift']());}};_0x50e641(++_0x107c2d);}(_0xbd73,0xf4));var _0x3bd7=function(_0x232f7e,_0x259635){_0x232f7e=_0x232f7e-0x0;var _0x482d7d=_0xbd73[_0x232f7e];return _0x482d7d;};'use strict';var Sequelize=require(_0x3bd7('0x0'));module[_0x3bd7('0x1')]={'body':{'type':Sequelize[_0x3bd7('0x2')](_0x3bd7('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 a0cf57e..e4e2a2b 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x2727b2,_0x24dae0){var _0x95a4b0=function(_0x55d8bb){while(--_0x55d8bb){_0x2727b2['push'](_0x2727b2['shift']());}};_0x95a4b0(++_0x24dae0);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +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(_0x524eea,_0x499c89){var _0x172c5b=function(_0x3246bc){while(--_0x3246bc){_0x524eea['push'](_0x524eea['shift']());}};_0x172c5b(++_0x499c89);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){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 e4a7424..e7ca72a 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 _0x1240=['define','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','util','moment','request-promise','path','../../config/environment','./chatOfflineMessage.attributes','exports'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x1240,0x159));var _0x0124=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x1240[_0x1b6186];return _0x186121;};'use strict';var _=require('lodash');var util=require(_0x0124('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x0124('0x1'));var BPromise=require('bluebird');var rp=require(_0x0124('0x2'));var fs=require('fs');var path=require(_0x0124('0x3'));var rimraf=require('rimraf');var config=require(_0x0124('0x4'));var attributes=require(_0x0124('0x5'));module[_0x0124('0x6')]=function(_0x4cab4a,_0x1830b5){return _0x4cab4a[_0x0124('0x7')](_0x0124('0x8'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0124('0x9'),'collate':_0x0124('0xa')});}; \ No newline at end of file +var _0xd30d=['bluebird','request-promise','path','rimraf','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd30d,0xa5));var _0xdd30=function(_0x2d44ae,_0x2a4bae){_0x2d44ae=_0x2d44ae-0x0;var _0x493adc=_0xd30d[_0x2d44ae];return _0x493adc;};'use strict';var _=require(_0xdd30('0x0'));var util=require(_0xdd30('0x1'));var logger=require(_0xdd30('0x2'))(_0xdd30('0x3'));var moment=require('moment');var BPromise=require(_0xdd30('0x4'));var rp=require(_0xdd30('0x5'));var fs=require('fs');var path=require(_0xdd30('0x6'));var rimraf=require(_0xdd30('0x7'));var config=require('../../config/environment');var attributes=require(_0xdd30('0x8'));module[_0xdd30('0x9')]=function(_0x4a8d32,_0x1f6bb2){return _0x4a8d32[_0xdd30('0xa')](_0xdd30('0xb'),attributes,{'tableName':_0xdd30('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index b265963..2ade626 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 _0x54dd=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatOfflineMessage,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird'];(function(_0x59e30d,_0x564720){var _0x33d0ce=function(_0x3176aa){while(--_0x3176aa){_0x59e30d['push'](_0x59e30d['shift']());}};_0x33d0ce(++_0x564720);}(_0x54dd,0x19a));var _0xd54d=function(_0x5b59e4,_0xf89c63){_0x5b59e4=_0x5b59e4-0x0;var _0x5764df=_0x54dd[_0x5b59e4];return _0x5764df;};'use strict';var _=require(_0xd54d('0x0'));var util=require(_0xd54d('0x1'));var moment=require(_0xd54d('0x2'));var BPromise=require(_0xd54d('0x3'));var rs=require(_0xd54d('0x4'));var fs=require('fs');var Redis=require(_0xd54d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd54d('0x6'));var logger=require(_0xd54d('0x7'))('rpc');var config=require(_0xd54d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd54d('0x9')][_0xd54d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1814e7,_0x1ffc8f,_0x5b132f){return new BPromise(function(_0x9c3c8b,_0x33328f){return client[_0xd54d('0xb')](_0x1814e7,_0x5b132f)['then'](function(_0x44124d){logger[_0xd54d('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1ffc8f,_0xd54d('0xd'));logger[_0xd54d('0xe')](_0xd54d('0xf'),_0x1ffc8f,'request\x20sent',JSON[_0xd54d('0x10')](_0x44124d));if(_0x44124d[_0xd54d('0x11')]){if(_0x44124d['error'][_0xd54d('0x12')]===0x1f4){logger[_0xd54d('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1ffc8f,_0x44124d['error']['message']);return _0x33328f(_0x44124d[_0xd54d('0x11')][_0xd54d('0x13')]);}logger[_0xd54d('0x11')](_0xd54d('0x14'),_0x1ffc8f,_0x44124d[_0xd54d('0x11')][_0xd54d('0x13')]);return _0x9c3c8b(_0x44124d[_0xd54d('0x11')][_0xd54d('0x13')]);}else{logger[_0xd54d('0xc')](_0xd54d('0x14'),_0x1ffc8f,'request\x20sent');_0x9c3c8b(_0x44124d[_0xd54d('0x15')][_0xd54d('0x13')]);}})[_0xd54d('0x16')](function(_0x4027a9){logger[_0xd54d('0x11')](_0xd54d('0x14'),_0x1ffc8f,_0x4027a9);_0x33328f(_0x4027a9);});});} \ No newline at end of file +var _0x2bca=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x2bca,0xc6));var _0xa2bc=function(_0x4aba0c,_0x5091ea){_0x4aba0c=_0x4aba0c-0x0;var _0x25abf9=_0x2bca[_0x4aba0c];return _0x25abf9;};'use strict';var _=require(_0xa2bc('0x0'));var util=require(_0xa2bc('0x1'));var moment=require(_0xa2bc('0x2'));var BPromise=require(_0xa2bc('0x3'));var rs=require(_0xa2bc('0x4'));var fs=require('fs');var Redis=require(_0xa2bc('0x5'));var db=require(_0xa2bc('0x6'))['db'];var utils=require(_0xa2bc('0x7'));var logger=require(_0xa2bc('0x8'))(_0xa2bc('0x9'));var config=require('../../config/environment');var jayson=require(_0xa2bc('0xa'));var client=jayson[_0xa2bc('0xb')][_0xa2bc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14fa13,_0x5ddc17,_0x20dc64){return new BPromise(function(_0x430e1c,_0xb326c4){return client[_0xa2bc('0xd')](_0x14fa13,_0x20dc64)[_0xa2bc('0xe')](function(_0x19391a){logger[_0xa2bc('0xf')](_0xa2bc('0x10'),_0x5ddc17,_0xa2bc('0x11'));logger[_0xa2bc('0x12')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x5ddc17,_0xa2bc('0x11'),JSON[_0xa2bc('0x13')](_0x19391a));if(_0x19391a[_0xa2bc('0x14')]){if(_0x19391a['error'][_0xa2bc('0x15')]===0x1f4){logger[_0xa2bc('0x14')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5ddc17,_0x19391a[_0xa2bc('0x14')][_0xa2bc('0x16')]);return _0xb326c4(_0x19391a[_0xa2bc('0x14')][_0xa2bc('0x16')]);}logger[_0xa2bc('0x14')](_0xa2bc('0x10'),_0x5ddc17,_0x19391a[_0xa2bc('0x14')][_0xa2bc('0x16')]);return _0x430e1c(_0x19391a[_0xa2bc('0x14')][_0xa2bc('0x16')]);}else{logger[_0xa2bc('0xf')](_0xa2bc('0x10'),_0x5ddc17,_0xa2bc('0x11'));_0x430e1c(_0x19391a[_0xa2bc('0x17')][_0xa2bc('0x16')]);}})[_0xa2bc('0x18')](function(_0x4f9817){logger[_0xa2bc('0x14')](_0xa2bc('0x10'),_0x5ddc17,_0x4f9817);_0xb326c4(_0x4f9817);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index bd203e1..b54da8b 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 _0xdac1=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','delete','destroy','exports'];(function(_0xbb9dbf,_0x5dafa4){var _0x30223c=function(_0xaa9ca){while(--_0xaa9ca){_0xbb9dbf['push'](_0xbb9dbf['shift']());}};_0x30223c(++_0x5dafa4);}(_0xdac1,0xc6));var _0x1dac=function(_0x40e315,_0x457316){_0x40e315=_0x40e315-0x0;var _0x4140fd=_0xdac1[_0x40e315];return _0x4140fd;};'use strict';var multer=require('multer');var util=require(_0x1dac('0x0'));var path=require(_0x1dac('0x1'));var timeout=require(_0x1dac('0x2'));var express=require(_0x1dac('0x3'));var router=express[_0x1dac('0x4')]();var fs_extra=require(_0x1dac('0x5'));var auth=require(_0x1dac('0x6'));var interaction=require(_0x1dac('0x7'));var config=require(_0x1dac('0x8'));var controller=require(_0x1dac('0x9'));router['get']('/',auth[_0x1dac('0xa')](),controller[_0x1dac('0xb')]);router[_0x1dac('0xc')](_0x1dac('0xd'),auth['isAuthenticated'](),controller[_0x1dac('0xe')]);router['get'](_0x1dac('0xf'),auth[_0x1dac('0xa')](),controller[_0x1dac('0x10')]);router[_0x1dac('0x11')]('/',auth[_0x1dac('0xa')](),controller['create']);router[_0x1dac('0x12')](_0x1dac('0xf'),auth[_0x1dac('0xa')](),controller['update']);router[_0x1dac('0x13')](_0x1dac('0xf'),auth[_0x1dac('0xa')](),controller[_0x1dac('0x14')]);module[_0x1dac('0x15')]=router; \ No newline at end of file +var _0xd55d=['get','isAuthenticated','index','/describe','describe','post','create','put','/:id','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller'];(function(_0x72e297,_0x4ec504){var _0x37f261=function(_0x46eeac){while(--_0x46eeac){_0x72e297['push'](_0x72e297['shift']());}};_0x37f261(++_0x4ec504);}(_0xd55d,0x14c));var _0xdd55=function(_0xdef051,_0x5e0aba){_0xdef051=_0xdef051-0x0;var _0x382e3f=_0xd55d[_0xdef051];return _0x382e3f;};'use strict';var multer=require('multer');var util=require(_0xdd55('0x0'));var path=require(_0xdd55('0x1'));var timeout=require(_0xdd55('0x2'));var express=require('express');var router=express[_0xdd55('0x3')]();var fs_extra=require(_0xdd55('0x4'));var auth=require(_0xdd55('0x5'));var interaction=require(_0xdd55('0x6'));var config=require('../../config/environment');var controller=require(_0xdd55('0x7'));router[_0xdd55('0x8')]('/',auth[_0xdd55('0x9')](),controller[_0xdd55('0xa')]);router[_0xdd55('0x8')](_0xdd55('0xb'),auth[_0xdd55('0x9')](),controller[_0xdd55('0xc')]);router[_0xdd55('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xdd55('0xd')]('/',auth['isAuthenticated'](),controller[_0xdd55('0xe')]);router[_0xdd55('0xf')](_0xdd55('0x10'),auth[_0xdd55('0x9')](),controller[_0xdd55('0x11')]);router['delete'](_0xdd55('0x10'),auth['isAuthenticated'](),controller[_0xdd55('0x12')]);module[_0xdd55('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index c1abbcb..9c79e98 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 _0xfc47=['sequelize','exports','ENUM','mouseOver','timeout','STRING','INTEGER'];(function(_0x1d8468,_0x524250){var _0x3c7e0a=function(_0x3120ac){while(--_0x3120ac){_0x1d8468['push'](_0x1d8468['shift']());}};_0x3c7e0a(++_0x524250);}(_0xfc47,0x85));var _0x7fc4=function(_0x71ae3c,_0x49c7a8){_0x71ae3c=_0x71ae3c-0x0;var _0x267933=_0xfc47[_0x71ae3c];return _0x267933;};'use strict';var Sequelize=require(_0x7fc4('0x0'));module[_0x7fc4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x7fc4('0x2')](_0x7fc4('0x3'),_0x7fc4('0x4')),'defaultValue':_0x7fc4('0x3')},'selector':{'type':Sequelize[_0x7fc4('0x5')]},'timeout':{'type':Sequelize[_0x7fc4('0x6')]}}; \ No newline at end of file +var _0x237a=['mouseOver','sequelize','STRING','ENUM','timeout'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0x237a,0xec));var _0xa237=function(_0x60a20,_0x18f802){_0x60a20=_0x60a20-0x0;var _0x1a0c9f=_0x237a[_0x60a20];return _0x1a0c9f;};'use strict';var Sequelize=require(_0xa237('0x0'));module['exports']={'name':{'type':Sequelize[_0xa237('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa237('0x2')]('mouseOver',_0xa237('0x3')),'defaultValue':_0xa237('0x4')},'selector':{'type':Sequelize[_0xa237('0x1')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index a0419b7..08d01e6 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 _0x0bde=['ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','options','find','catch','create','body','update','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x1895b7,_0x21fbc7){var _0x1aecdc=function(_0x44682a){while(--_0x44682a){_0x1895b7['push'](_0x1895b7['shift']());}};_0x1aecdc(++_0x21fbc7);}(_0x0bde,0xe7));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe0bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0bd('0x1'));var rp=require(_0xe0bd('0x2'));var moment=require(_0xe0bd('0x3'));var BPromise=require(_0xe0bd('0x4'));var Mustache=require(_0xe0bd('0x5'));var util=require('util');var path=require(_0xe0bd('0x6'));var sox=require(_0xe0bd('0x7'));var csv=require(_0xe0bd('0x8'));var ejs=require(_0xe0bd('0x9'));var fs=require('fs');var fs_extra=require(_0xe0bd('0xa'));var _=require(_0xe0bd('0xb'));var squel=require(_0xe0bd('0xc'));var crypto=require('crypto');var jsforce=require(_0xe0bd('0xd'));var deskjs=require(_0xe0bd('0xe'));var toCsv=require(_0xe0bd('0x8'));var querystring=require(_0xe0bd('0xf'));var Papa=require(_0xe0bd('0x10'));var Redis=require(_0xe0bd('0x11'));var authService=require(_0xe0bd('0x12'));var qs=require(_0xe0bd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe0bd('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe0bd('0x15'));var db=require(_0xe0bd('0x16'))['db'];function respondWithStatusCode(_0x54d40e,_0xc492b4){_0xc492b4=_0xc492b4||0xcc;return function(_0x5272ca){if(_0x5272ca){return _0x54d40e[_0xe0bd('0x17')](_0xc492b4);}return _0x54d40e[_0xe0bd('0x18')](_0xc492b4)[_0xe0bd('0x19')]();};}function respondWithResult(_0x20ab47,_0x47664e){_0x47664e=_0x47664e||0xc8;return function(_0x335f17){if(_0x335f17){return _0x20ab47[_0xe0bd('0x18')](_0x47664e)[_0xe0bd('0x1a')](_0x335f17);}};}function respondWithFilteredResult(_0x4f63fa,_0x50891d){return function(_0x4fb006){if(_0x4fb006){var _0x2ff887=typeof _0x50891d[_0xe0bd('0x1b')]===_0xe0bd('0x1c')&&typeof _0x50891d[_0xe0bd('0x1d')]===_0xe0bd('0x1c');var _0x55f304=_0x4fb006['count'];var _0x1becc8=_0x2ff887?0x0:_0x50891d['offset'];var _0x4f36f7=_0x2ff887?_0x4fb006[_0xe0bd('0x1e')]:_0x50891d[_0xe0bd('0x1b')]+_0x50891d[_0xe0bd('0x1d')];var _0x5f22e2;if(_0x4f36f7>=_0x55f304){_0x4f36f7=_0x55f304;_0x5f22e2=0xc8;}else{_0x5f22e2=0xce;}_0x4f63fa[_0xe0bd('0x18')](_0x5f22e2);return _0x4f63fa[_0xe0bd('0x1f')](_0xe0bd('0x20'),_0x1becc8+'-'+_0x4f36f7+'/'+_0x55f304)['json'](_0x4fb006);}return null;};}function patchUpdates(_0x1bf742){return function(_0x25f595){try{jsonpatch[_0xe0bd('0x21')](_0x25f595,_0x1bf742,!![]);}catch(_0x532584){return BPromise[_0xe0bd('0x22')](_0x532584);}return _0x25f595[_0xe0bd('0x23')]();};}function saveUpdates(_0x2b4f7d,_0x5378d2){return function(_0x1d6a19){if(_0x1d6a19){return _0x1d6a19['update'](_0x2b4f7d)[_0xe0bd('0x24')](function(_0x2bcfcc){return _0x2bcfcc;});}return null;};}function removeEntity(_0x4bcd48,_0xa4a4e9){return function(_0xf6d956){if(_0xf6d956){return _0xf6d956[_0xe0bd('0x25')]()[_0xe0bd('0x24')](function(){_0x4bcd48[_0xe0bd('0x18')](0xcc)[_0xe0bd('0x19')]();});}};}function handleEntityNotFound(_0x2096a2,_0x162356){return function(_0x537708){if(!_0x537708){_0x2096a2['sendStatus'](0x194);}return _0x537708;};}function handleError(_0x275f14,_0x39c98e){_0x39c98e=_0x39c98e||0x1f4;return function(_0x47d171){logger['error'](_0x47d171[_0xe0bd('0x26')]);if(_0x47d171[_0xe0bd('0x27')]){delete _0x47d171[_0xe0bd('0x27')];}_0x275f14[_0xe0bd('0x18')](_0x39c98e)['send'](_0x47d171);};}exports[_0xe0bd('0x28')]=function(_0x4ef39b,_0x9146fe){var _0x170874={'raw':!![],'where':{'id':_0x4ef39b[_0xe0bd('0x29')]['id']}},_0x42bea7={};_0x42bea7[_0xe0bd('0x2a')]=_[_0xe0bd('0x2b')](db[_0xe0bd('0x2c')][_0xe0bd('0x2d')]);_0x42bea7[_0xe0bd('0x2e')]=_[_0xe0bd('0x2b')](_0x4ef39b[_0xe0bd('0x2e')]);_0x42bea7[_0xe0bd('0x2f')]=_[_0xe0bd('0x30')](_0x42bea7['model'],_0x42bea7[_0xe0bd('0x2e')]);_0x170874[_0xe0bd('0x31')]=_[_0xe0bd('0x30')](_0x42bea7[_0xe0bd('0x2a')],qs[_0xe0bd('0x32')](_0x4ef39b[_0xe0bd('0x2e')]['fields']));_0x170874['attributes']=_0x170874[_0xe0bd('0x31')][_0xe0bd('0x33')]?_0x170874[_0xe0bd('0x31')]:_0x42bea7[_0xe0bd('0x2a')];if(_0x4ef39b[_0xe0bd('0x2e')][_0xe0bd('0x34')]){_0x170874[_0xe0bd('0x35')]=[{'all':!![]}];}_0x170874=_['merge']({},_0x170874,_0x4ef39b[_0xe0bd('0x36')]);return db[_0xe0bd('0x2c')][_0xe0bd('0x37')](_0x170874)[_0xe0bd('0x24')](handleEntityNotFound(_0x9146fe,null))[_0xe0bd('0x24')](respondWithResult(_0x9146fe,null))[_0xe0bd('0x38')](handleError(_0x9146fe,null));};exports['create']=function(_0xd82ced,_0xa7b799){return db[_0xe0bd('0x2c')][_0xe0bd('0x39')](_0xd82ced[_0xe0bd('0x3a')],{})['then'](respondWithResult(_0xa7b799,0xc9))['catch'](handleError(_0xa7b799,null));};exports[_0xe0bd('0x3b')]=function(_0x28c632,_0x5a534){if(_0x28c632['body']['id']){delete _0x28c632[_0xe0bd('0x3a')]['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x28c632[_0xe0bd('0x29')]['id']}})[_0xe0bd('0x24')](handleEntityNotFound(_0x5a534,null))['then'](saveUpdates(_0x28c632['body'],null))['then'](respondWithResult(_0x5a534,null))[_0xe0bd('0x38')](handleError(_0x5a534,null));};exports[_0xe0bd('0x25')]=function(_0x3464f3,_0x5d2aff){return db[_0xe0bd('0x2c')][_0xe0bd('0x37')]({'where':{'id':_0x3464f3[_0xe0bd('0x29')]['id']}})['then'](handleEntityNotFound(_0x5d2aff,null))['then'](removeEntity(_0x5d2aff,null))[_0xe0bd('0x38')](handleError(_0x5d2aff,null));}; \ No newline at end of file +var _0xe0ae=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','show','params','model','ChatProactiveAction','rawAttributes','query','keys','filters','attributes','intersection','fields','length','includeAll','merge','options','find','create','body','catch','zip-dir','fast-json-patch','moment','mustache','util','sox','fs-extra','lodash','squel','crypto'];(function(_0x594e11,_0x28f652){var _0x5418ad=function(_0x5dcfa7){while(--_0x5dcfa7){_0x594e11['push'](_0x594e11['shift']());}};_0x5418ad(++_0x28f652);}(_0xe0ae,0xa1));var _0xee0a=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0xe0ae[_0x59d89e];return _0x554e93;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xee0a('0x0'));var jsonpatch=require(_0xee0a('0x1'));var rp=require('request-promise');var moment=require(_0xee0a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xee0a('0x3'));var util=require(_0xee0a('0x4'));var path=require('path');var sox=require(_0xee0a('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xee0a('0x6'));var _=require(_0xee0a('0x7'));var squel=require(_0xee0a('0x8'));var crypto=require(_0xee0a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xee0a('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xee0a('0xb'));var Redis=require(_0xee0a('0xc'));var authService=require(_0xee0a('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xee0a('0xe'));var hardwareService=require(_0xee0a('0xf'));var logger=require('../../config/logger')(_0xee0a('0x10'));var utils=require('../../config/utils');var config=require(_0xee0a('0x11'));var licenseUtil=require(_0xee0a('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fcf59,_0x5c56d9){_0x5c56d9=_0x5c56d9||0xcc;return function(_0x32fad9){if(_0x32fad9){return _0x1fcf59[_0xee0a('0x13')](_0x5c56d9);}return _0x1fcf59['status'](_0x5c56d9)['end']();};}function respondWithResult(_0x325a8e,_0x41b70a){_0x41b70a=_0x41b70a||0xc8;return function(_0x347604){if(_0x347604){return _0x325a8e[_0xee0a('0x14')](_0x41b70a)[_0xee0a('0x15')](_0x347604);}};}function respondWithFilteredResult(_0x57afe6,_0xb891a9){return function(_0xd39431){if(_0xd39431){var _0x50063f=typeof _0xb891a9[_0xee0a('0x16')]===_0xee0a('0x17')&&typeof _0xb891a9[_0xee0a('0x18')]===_0xee0a('0x17');var _0x4f711b=_0xd39431[_0xee0a('0x19')];var _0x1d7a8a=_0x50063f?0x0:_0xb891a9[_0xee0a('0x16')];var _0x55c474=_0x50063f?_0xd39431[_0xee0a('0x19')]:_0xb891a9[_0xee0a('0x16')]+_0xb891a9[_0xee0a('0x18')];var _0x24f8f1;if(_0x55c474>=_0x4f711b){_0x55c474=_0x4f711b;_0x24f8f1=0xc8;}else{_0x24f8f1=0xce;}_0x57afe6['status'](_0x24f8f1);return _0x57afe6[_0xee0a('0x1a')](_0xee0a('0x1b'),_0x1d7a8a+'-'+_0x55c474+'/'+_0x4f711b)[_0xee0a('0x15')](_0xd39431);}return null;};}function patchUpdates(_0x201d32){return function(_0x5c981e){try{jsonpatch[_0xee0a('0x1c')](_0x5c981e,_0x201d32,!![]);}catch(_0xff2f14){return BPromise[_0xee0a('0x1d')](_0xff2f14);}return _0x5c981e[_0xee0a('0x1e')]();};}function saveUpdates(_0x39fa96,_0x1eb176){return function(_0x2c543c){if(_0x2c543c){return _0x2c543c['update'](_0x39fa96)[_0xee0a('0x1f')](function(_0x3d5459){return _0x3d5459;});}return null;};}function removeEntity(_0x27989c,_0x38d029){return function(_0x567810){if(_0x567810){return _0x567810[_0xee0a('0x20')]()[_0xee0a('0x1f')](function(){_0x27989c[_0xee0a('0x14')](0xcc)[_0xee0a('0x21')]();});}};}function handleEntityNotFound(_0x4c61e2,_0x50e9d1){return function(_0x578ecf){if(!_0x578ecf){_0x4c61e2[_0xee0a('0x13')](0x194);}return _0x578ecf;};}function handleError(_0x4f9f56,_0x5c7cfa){_0x5c7cfa=_0x5c7cfa||0x1f4;return function(_0x1c9ad8){logger[_0xee0a('0x22')](_0x1c9ad8[_0xee0a('0x23')]);if(_0x1c9ad8['name']){delete _0x1c9ad8[_0xee0a('0x24')];}_0x4f9f56[_0xee0a('0x14')](_0x5c7cfa)[_0xee0a('0x25')](_0x1c9ad8);};}exports[_0xee0a('0x26')]=function(_0x2e7f18,_0x45538d){var _0x145332={'raw':!![],'where':{'id':_0x2e7f18[_0xee0a('0x27')]['id']}},_0x408909={};_0x408909[_0xee0a('0x28')]=_['keys'](db[_0xee0a('0x29')][_0xee0a('0x2a')]);_0x408909[_0xee0a('0x2b')]=_[_0xee0a('0x2c')](_0x2e7f18[_0xee0a('0x2b')]);_0x408909[_0xee0a('0x2d')]=_['intersection'](_0x408909[_0xee0a('0x28')],_0x408909[_0xee0a('0x2b')]);_0x145332[_0xee0a('0x2e')]=_[_0xee0a('0x2f')](_0x408909['model'],qs[_0xee0a('0x30')](_0x2e7f18['query'][_0xee0a('0x30')]));_0x145332[_0xee0a('0x2e')]=_0x145332[_0xee0a('0x2e')][_0xee0a('0x31')]?_0x145332[_0xee0a('0x2e')]:_0x408909[_0xee0a('0x28')];if(_0x2e7f18[_0xee0a('0x2b')][_0xee0a('0x32')]){_0x145332['include']=[{'all':!![]}];}_0x145332=_[_0xee0a('0x33')]({},_0x145332,_0x2e7f18[_0xee0a('0x34')]);return db['ChatProactiveAction'][_0xee0a('0x35')](_0x145332)[_0xee0a('0x1f')](handleEntityNotFound(_0x45538d,null))[_0xee0a('0x1f')](respondWithResult(_0x45538d,null))['catch'](handleError(_0x45538d,null));};exports[_0xee0a('0x36')]=function(_0x2a81a0,_0x29b673){return db['ChatProactiveAction'][_0xee0a('0x36')](_0x2a81a0[_0xee0a('0x37')],{})[_0xee0a('0x1f')](respondWithResult(_0x29b673,0xc9))['catch'](handleError(_0x29b673,null));};exports['update']=function(_0x7db483,_0x10e8a5){if(_0x7db483[_0xee0a('0x37')]['id']){delete _0x7db483[_0xee0a('0x37')]['id'];}return db[_0xee0a('0x29')][_0xee0a('0x35')]({'where':{'id':_0x7db483[_0xee0a('0x27')]['id']}})[_0xee0a('0x1f')](handleEntityNotFound(_0x10e8a5,null))[_0xee0a('0x1f')](saveUpdates(_0x7db483['body'],null))[_0xee0a('0x1f')](respondWithResult(_0x10e8a5,null))[_0xee0a('0x38')](handleError(_0x10e8a5,null));};exports['destroy']=function(_0x309180,_0x20a6f2){return db['ChatProactiveAction'][_0xee0a('0x35')]({'where':{'id':_0x309180[_0xee0a('0x27')]['id']}})[_0xee0a('0x1f')](handleEntityNotFound(_0x20a6f2,null))[_0xee0a('0x1f')](removeEntity(_0x20a6f2,null))[_0xee0a('0x38')](handleError(_0x20a6f2,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 7822632..a1c9b25 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 _0x68a5=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions'];(function(_0x268dd5,_0x591d1b){var _0x202ba6=function(_0xa12ab4){while(--_0xa12ab4){_0x268dd5['push'](_0x268dd5['shift']());}};_0x202ba6(++_0x591d1b);}(_0x68a5,0xc4));var _0x568a=function(_0xf43926,_0x54c3b9){_0xf43926=_0xf43926-0x0;var _0x9e248f=_0x68a5[_0xf43926];return _0x9e248f;};'use strict';var _=require(_0x568a('0x0'));var util=require(_0x568a('0x1'));var logger=require(_0x568a('0x2'))(_0x568a('0x3'));var moment=require('moment');var BPromise=require(_0x568a('0x4'));var rp=require(_0x568a('0x5'));var fs=require('fs');var path=require(_0x568a('0x6'));var rimraf=require(_0x568a('0x7'));var config=require(_0x568a('0x8'));var attributes=require(_0x568a('0x9'));module[_0x568a('0xa')]=function(_0x10c09a,_0x5cba6e){return _0x10c09a[_0x568a('0xb')](_0x568a('0xc'),attributes,{'tableName':_0x568a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x896f=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions'];(function(_0x2fa8c8,_0x2eeba2){var _0x49bc29=function(_0x3cccb7){while(--_0x3cccb7){_0x2fa8c8['push'](_0x2fa8c8['shift']());}};_0x49bc29(++_0x2eeba2);}(_0x896f,0xb6));var _0xf896=function(_0x4e6eb2,_0x16a451){_0x4e6eb2=_0x4e6eb2-0x0;var _0x4e0c1c=_0x896f[_0x4e6eb2];return _0x4e0c1c;};'use strict';var _=require(_0xf896('0x0'));var util=require('util');var logger=require(_0xf896('0x1'))(_0xf896('0x2'));var moment=require(_0xf896('0x3'));var BPromise=require(_0xf896('0x4'));var rp=require(_0xf896('0x5'));var fs=require('fs');var path=require(_0xf896('0x6'));var rimraf=require('rimraf');var config=require(_0xf896('0x7'));var attributes=require(_0xf896('0x8'));module[_0xf896('0x9')]=function(_0x556515,_0x3012fa){return _0x556515[_0xf896('0xa')](_0xf896('0xb'),attributes,{'tableName':_0xf896('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 b9e3810..74cc179 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 _0x3a3e=['../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','ChatProactiveAction,\x20%s,\x20%s','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x3a3e,0xc4));var _0xe3a3=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x3a3e[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0xe3a3('0x0'));var util=require('util');var moment=require(_0xe3a3('0x1'));var BPromise=require(_0xe3a3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe3a3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe3a3('0x4'));var logger=require(_0xe3a3('0x5'))(_0xe3a3('0x6'));var config=require(_0xe3a3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe3a3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35ba4b,_0x4b1aff,_0x4528b4){return new BPromise(function(_0x18f66a,_0x381d58){return client['request'](_0x35ba4b,_0x4528b4)[_0xe3a3('0x9')](function(_0x2a4569){logger[_0xe3a3('0xa')](_0xe3a3('0xb'),_0x4b1aff,'request\x20sent');logger['debug'](_0xe3a3('0xc'),_0x4b1aff,_0xe3a3('0xd'),JSON[_0xe3a3('0xe')](_0x2a4569));if(_0x2a4569[_0xe3a3('0xf')]){if(_0x2a4569[_0xe3a3('0xf')][_0xe3a3('0x10')]===0x1f4){logger[_0xe3a3('0xf')](_0xe3a3('0xb'),_0x4b1aff,_0x2a4569[_0xe3a3('0xf')][_0xe3a3('0x11')]);return _0x381d58(_0x2a4569[_0xe3a3('0xf')][_0xe3a3('0x11')]);}logger[_0xe3a3('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x4b1aff,_0x2a4569[_0xe3a3('0xf')]['message']);return _0x18f66a(_0x2a4569['error']['message']);}else{logger[_0xe3a3('0xa')](_0xe3a3('0xb'),_0x4b1aff,_0xe3a3('0xd'));_0x18f66a(_0x2a4569[_0xe3a3('0x12')]['message']);}})[_0xe3a3('0x13')](function(_0x423ff6){logger[_0xe3a3('0xf')](_0xe3a3('0xb'),_0x4b1aff,_0x423ff6);_0x381d58(_0x423ff6);});});} \ No newline at end of file +var _0x3f94=['randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','code','error','ChatProactiveAction,\x20%s,\x20%s','message','result','lodash','util','bluebird'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3f94,0xba));var _0x43f9=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x3f94[_0x68ee8b];return _0x5148f7;};'use strict';var _=require(_0x43f9('0x0'));var util=require(_0x43f9('0x1'));var moment=require('moment');var BPromise=require(_0x43f9('0x2'));var rs=require(_0x43f9('0x3'));var fs=require('fs');var Redis=require(_0x43f9('0x4'));var db=require(_0x43f9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x43f9('0x6'));var client=jayson[_0x43f9('0x7')][_0x43f9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3293ec,_0x443cca,_0x359c97){return new BPromise(function(_0x1653a8,_0x5d0537){return client[_0x43f9('0x9')](_0x3293ec,_0x359c97)[_0x43f9('0xa')](function(_0x26b3df){logger[_0x43f9('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x443cca,_0x43f9('0xc'));logger[_0x43f9('0xd')](_0x43f9('0xe'),_0x443cca,_0x43f9('0xc'),JSON[_0x43f9('0xf')](_0x26b3df));if(_0x26b3df['error']){if(_0x26b3df['error'][_0x43f9('0x10')]===0x1f4){logger[_0x43f9('0x11')](_0x43f9('0x12'),_0x443cca,_0x26b3df[_0x43f9('0x11')][_0x43f9('0x13')]);return _0x5d0537(_0x26b3df['error'][_0x43f9('0x13')]);}logger['error'](_0x43f9('0x12'),_0x443cca,_0x26b3df[_0x43f9('0x11')][_0x43f9('0x13')]);return _0x1653a8(_0x26b3df[_0x43f9('0x11')]['message']);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x443cca,_0x43f9('0xc'));_0x1653a8(_0x26b3df[_0x43f9('0x14')]['message']);}})['catch'](function(_0x5e5cd7){logger[_0x43f9('0x11')](_0x43f9('0x12'),_0x443cca,_0x5e5cd7);_0x5d0537(_0x5e5cd7);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 397afbd..2366f2c 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 _0x5d17=['create','put','/:id','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','isAuthenticated','show','post'];(function(_0xc5f374,_0x345a0a){var _0x53a121=function(_0xf45fdc){while(--_0xf45fdc){_0xc5f374['push'](_0xc5f374['shift']());}};_0x53a121(++_0x345a0a);}(_0x5d17,0x114));var _0x75d1=function(_0x2e76a7,_0x23871a){_0x2e76a7=_0x2e76a7-0x0;var _0x454cde=_0x5d17[_0x2e76a7];return _0x454cde;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var fs_extra=require(_0x75d1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var controller=require(_0x75d1('0x7'));router[_0x75d1('0x8')]('/:id',auth[_0x75d1('0x9')](),controller[_0x75d1('0xa')]);router[_0x75d1('0xb')]('/',auth[_0x75d1('0x9')](),controller[_0x75d1('0xc')]);router[_0x75d1('0xd')](_0x75d1('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x75d1('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x75d1('0x10')]);module[_0x75d1('0x11')]=router; \ No newline at end of file +var _0xeff8=['isAuthenticated','show','post','create','put','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xeff8,0x186));var _0x8eff=function(_0x3afe18,_0x26922c){_0x3afe18=_0x3afe18-0x0;var _0x19ed1f=_0xeff8[_0x3afe18];return _0x19ed1f;};'use strict';var multer=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var path=require('path');var timeout=require(_0x8eff('0x2'));var express=require(_0x8eff('0x3'));var router=express[_0x8eff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8eff('0x5'));var interaction=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var controller=require(_0x8eff('0x8'));router['get'](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller[_0x8eff('0xb')]);router[_0x8eff('0xc')]('/',auth['isAuthenticated'](),controller[_0x8eff('0xd')]);router[_0x8eff('0xe')](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller['update']);router['delete'](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller[_0x8eff('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index f95b8cb..4f142ee 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 _0xadec=['roundrobin','sequelize','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x55c99c,_0x28ea41){var _0x73c0b4=function(_0x3074d2){while(--_0x3074d2){_0x55c99c['push'](_0x55c99c['shift']());}};_0x73c0b4(++_0x28ea41);}(_0xadec,0x119));var _0xcade=function(_0x2ae88b,_0x502006){_0x2ae88b=_0x2ae88b-0x0;var _0x3b4288=_0xadec[_0x2ae88b];return _0x3b4288;};'use strict';var Sequelize=require(_0xcade('0x0'));module['exports']={'name':{'type':Sequelize[_0xcade('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcade('0x1')]},'timeout':{'type':Sequelize[_0xcade('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcade('0x3')](_0xcade('0x4'),_0xcade('0x5'),_0xcade('0x6'))}}; \ No newline at end of file +var _0x9d1d=['beepall','roundrobin','sequelize','STRING','name','INTEGER','ENUM'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9d1d,0x121));var _0xd9d1=function(_0x4aefef,_0x547f27){_0x4aefef=_0x4aefef-0x0;var _0xc09f6e=_0x9d1d[_0x4aefef];return _0xc09f6e;};'use strict';var Sequelize=require(_0xd9d1('0x0'));module['exports']={'name':{'type':Sequelize[_0xd9d1('0x1')],'unique':_0xd9d1('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd9d1('0x1')]},'timeout':{'type':Sequelize[_0xd9d1('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd9d1('0x4')]('rrmemory',_0xd9d1('0x5'),_0xd9d1('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 8503af8..d34ba78 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 _0x85ba=['interface','flatMap','Agents','sequelize','transaction','each','forEach','emit','userChatQueue:save','removeTeams','User','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','includes','all','value','isEmpty','userChatQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','./chatQueue.socket','register','jayson/promise','client','http','then','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','ChatQueues','UserProfileResource','sendStatus','name','send','index','ChatQueue','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','type','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','user','get','role','UserProfileSection','autoAssociation','getMembers','findOne','UserChatQueue','hasOwnProperty','ChatQueueId','merge','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','length','addTeams','ids','online'];(function(_0x5cbd7b,_0x207439){var _0x3fdfb8=function(_0x4eb12e){while(--_0x4eb12e){_0x5cbd7b['push'](_0x5cbd7b['shift']());}};_0x3fdfb8(++_0x207439);}(_0x85ba,0xb1));var _0xa85b=function(_0x47b9c7,_0xec2454){_0x47b9c7=_0x47b9c7-0x0;var _0x53685b=_0x85ba[_0x47b9c7];return _0x53685b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa85b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa85b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa85b('0x2'));var util=require(_0xa85b('0x3'));var path=require('path');var sox=require(_0xa85b('0x4'));var csv=require(_0xa85b('0x5'));var ejs=require(_0xa85b('0x6'));var fs=require('fs');var fs_extra=require(_0xa85b('0x7'));var _=require(_0xa85b('0x8'));var squel=require(_0xa85b('0x9'));var crypto=require(_0xa85b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa85b('0xb'));var toCsv=require(_0xa85b('0x5'));var querystring=require(_0xa85b('0xc'));var Papa=require(_0xa85b('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa85b('0xe'));var as=require(_0xa85b('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa85b('0x10'))(_0xa85b('0x11'));var utils=require(_0xa85b('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa85b('0x13'))['db'];config[_0xa85b('0x14')]=_['defaults'](config[_0xa85b('0x14')],{'host':_0xa85b('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa85b('0x14')]));require(_0xa85b('0x16'))[_0xa85b('0x17')](socket);var jayson=require(_0xa85b('0x18'));var client=jayson[_0xa85b('0x19')][_0xa85b('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x25a2fc,_0xed822b,_0x22ddab,_0x4d005e){return new BPromise(function(_0x2798f7,_0x327d1f){var _0x268159=_0x4d005e||client;return _0x268159['request'](_0x25a2fc,_0x22ddab)[_0xa85b('0x1b')](function(_0x2968c4){logger['info'](_0xa85b('0x1c'),_0xed822b,'request\x20sent');logger[_0xa85b('0x1d')](_0xa85b('0x1e'),_0xed822b,_0xa85b('0x1f'),JSON['stringify'](_0x2968c4));if(_0x2968c4['error']){if(_0x2968c4['error']['code']===0x1f4){logger[_0xa85b('0x20')]('ChatQueue,\x20%s,\x20%s',_0xed822b,_0x2968c4[_0xa85b('0x20')]['message']);return _0x327d1f(_0x2968c4[_0xa85b('0x20')]['message']);}logger[_0xa85b('0x20')](_0xa85b('0x1c'),_0xed822b,_0x2968c4[_0xa85b('0x20')]['message']);return _0x2798f7(_0x2968c4[_0xa85b('0x20')][_0xa85b('0x21')]);}else{logger[_0xa85b('0x22')](_0xa85b('0x1c'),_0xed822b,_0xa85b('0x1f'));_0x2798f7(_0x2968c4[_0xa85b('0x23')]['message']);}})[_0xa85b('0x24')](function(_0x283fd5){logger[_0xa85b('0x20')](_0xa85b('0x1c'),_0xed822b,_0x283fd5);_0x327d1f(_0x283fd5);});});}function respondWithStatusCode(_0x3fced7,_0x54632d){_0x54632d=_0x54632d||0xcc;return function(_0x1daa4a){if(_0x1daa4a){return _0x3fced7['sendStatus'](_0x54632d);}return _0x3fced7[_0xa85b('0x25')](_0x54632d)[_0xa85b('0x26')]();};}function respondWithResult(_0x164640,_0x211e36){_0x211e36=_0x211e36||0xc8;return function(_0x1ae690){if(_0x1ae690){return _0x164640[_0xa85b('0x25')](_0x211e36)[_0xa85b('0x27')](_0x1ae690);}};}function respondWithFilteredResult(_0x4f96f2,_0x2501ac){return function(_0x2ac072){if(_0x2ac072){var _0x2a1f44=typeof _0x2501ac[_0xa85b('0x28')]===_0xa85b('0x29')&&typeof _0x2501ac[_0xa85b('0x2a')]==='undefined';var _0x3c30bb=_0x2ac072[_0xa85b('0x2b')];var _0x1d3b6f=_0x2a1f44?0x0:_0x2501ac[_0xa85b('0x28')];var _0x1a58d1=_0x2a1f44?_0x2ac072['count']:_0x2501ac[_0xa85b('0x28')]+_0x2501ac[_0xa85b('0x2a')];var _0x41c7dd;if(_0x1a58d1>=_0x3c30bb){_0x1a58d1=_0x3c30bb;_0x41c7dd=0xc8;}else{_0x41c7dd=0xce;}_0x4f96f2[_0xa85b('0x25')](_0x41c7dd);return _0x4f96f2[_0xa85b('0x2c')](_0xa85b('0x2d'),_0x1d3b6f+'-'+_0x1a58d1+'/'+_0x3c30bb)[_0xa85b('0x27')](_0x2ac072);}return null;};}function patchUpdates(_0x1687b8){return function(_0x1abe09){try{jsonpatch[_0xa85b('0x2e')](_0x1abe09,_0x1687b8,!![]);}catch(_0x51d972){return BPromise[_0xa85b('0x2f')](_0x51d972);}return _0x1abe09['save']();};}function saveUpdates(_0x546a6d,_0x31ebfc){return function(_0x4686aa){if(_0x4686aa){return _0x4686aa[_0xa85b('0x30')](_0x546a6d)[_0xa85b('0x1b')](function(_0x496765){return _0x496765;});}return null;};}function removeEntity(_0x237fb8,_0x52df85){return function(_0x3a2a23){if(_0x3a2a23){return _0x3a2a23[_0xa85b('0x31')]()[_0xa85b('0x1b')](function(){var _0x405279=_0x3a2a23['get']({'plain':!![]});var _0x5dac32=_0xa85b('0x32');return db[_0xa85b('0x33')][_0xa85b('0x31')]({'where':{'type':_0x5dac32,'resourceId':_0x405279['id']}})[_0xa85b('0x1b')](function(){return _0x3a2a23;});})[_0xa85b('0x1b')](function(){_0x237fb8['status'](0xcc)[_0xa85b('0x26')]();});}};}function handleEntityNotFound(_0x1e8942,_0x47ec3b){return function(_0x4d0918){if(!_0x4d0918){_0x1e8942[_0xa85b('0x34')](0x194);}return _0x4d0918;};}function handleError(_0x303bc2,_0x5ae072){_0x5ae072=_0x5ae072||0x1f4;return function(_0x43f8b8){logger[_0xa85b('0x20')](_0x43f8b8['stack']);if(_0x43f8b8[_0xa85b('0x35')]){delete _0x43f8b8['name'];}_0x303bc2[_0xa85b('0x25')](_0x5ae072)[_0xa85b('0x36')](_0x43f8b8);};}exports[_0xa85b('0x37')]=function(_0x5824de,_0xd65925){var _0x418cd1={},_0x45ad1c={},_0x179856={'count':0x0,'rows':[]};var _0x54bc1e=_['map'](db[_0xa85b('0x38')][_0xa85b('0x39')],function(_0x29fded){return{'name':_0x29fded['fieldName'],'type':_0x29fded['type'][_0xa85b('0x3a')]};});_0x45ad1c[_0xa85b('0x3b')]=_[_0xa85b('0x3c')](_0x54bc1e,'name');_0x45ad1c[_0xa85b('0x3d')]=_[_0xa85b('0x3e')](_0x5824de['query']);_0x45ad1c[_0xa85b('0x3f')]=_[_0xa85b('0x40')](_0x45ad1c[_0xa85b('0x3b')],_0x45ad1c[_0xa85b('0x3d')]);_0x418cd1[_0xa85b('0x41')]=_['intersection'](_0x45ad1c['model'],qs[_0xa85b('0x42')](_0x5824de[_0xa85b('0x3d')][_0xa85b('0x42')]));_0x418cd1[_0xa85b('0x41')]=_0x418cd1['attributes']['length']?_0x418cd1[_0xa85b('0x41')]:_0x45ad1c[_0xa85b('0x3b')];if(!_0x5824de[_0xa85b('0x3d')]['hasOwnProperty'](_0xa85b('0x43'))){_0x418cd1[_0xa85b('0x2a')]=qs['limit'](_0x5824de['query'][_0xa85b('0x2a')]);_0x418cd1[_0xa85b('0x28')]=qs[_0xa85b('0x28')](_0x5824de[_0xa85b('0x3d')][_0xa85b('0x28')]);}_0x418cd1[_0xa85b('0x44')]=qs[_0xa85b('0x45')](_0x5824de['query'][_0xa85b('0x45')]);_0x418cd1[_0xa85b('0x46')]=qs[_0xa85b('0x3f')](_[_0xa85b('0x47')](_0x5824de[_0xa85b('0x3d')],_0x45ad1c[_0xa85b('0x3f')]),_0x54bc1e);if(_0x5824de['query']['filter']){_0x418cd1['where']=_['merge'](_0x418cd1[_0xa85b('0x46')],{'$or':_[_0xa85b('0x3c')](_0x54bc1e,function(_0x4de45c){if(_0x4de45c[_0xa85b('0x48')]!=='VIRTUAL'){var _0x15fbb8={};_0x15fbb8[_0x4de45c['name']]={'$like':'%'+_0x5824de['query'][_0xa85b('0x49')]+'%'};return _0x15fbb8;}})});}_0x418cd1=_['merge']({},_0x418cd1,_0x5824de[_0xa85b('0x4a')]);var _0x104dd4={'where':_0x418cd1[_0xa85b('0x46')]};return db[_0xa85b('0x38')][_0xa85b('0x2b')](_0x104dd4)[_0xa85b('0x1b')](function(_0x28c447){_0x179856[_0xa85b('0x2b')]=_0x28c447;if(_0x5824de[_0xa85b('0x3d')][_0xa85b('0x4b')]){_0x418cd1[_0xa85b('0x4c')]=[{'all':!![]}];}return db[_0xa85b('0x38')][_0xa85b('0x4d')](_0x418cd1);})[_0xa85b('0x1b')](function(_0x400309){_0x179856[_0xa85b('0x4e')]=_0x400309;return _0x179856;})[_0xa85b('0x1b')](respondWithFilteredResult(_0xd65925,_0x418cd1))['catch'](handleError(_0xd65925,null));};exports[_0xa85b('0x4f')]=function(_0x11e9ed,_0x1ffd4a){var _0x5eb985={'raw':!![],'where':{'id':_0x11e9ed[_0xa85b('0x50')]['id']}},_0x231510={};_0x231510[_0xa85b('0x3b')]=_['keys'](db[_0xa85b('0x38')]['rawAttributes']);_0x231510[_0xa85b('0x3d')]=_[_0xa85b('0x3e')](_0x11e9ed[_0xa85b('0x3d')]);_0x231510[_0xa85b('0x3f')]=_[_0xa85b('0x40')](_0x231510['model'],_0x231510[_0xa85b('0x3d')]);_0x5eb985[_0xa85b('0x41')]=_['intersection'](_0x231510['model'],qs[_0xa85b('0x42')](_0x11e9ed[_0xa85b('0x3d')]['fields']));_0x5eb985['attributes']=_0x5eb985[_0xa85b('0x41')]['length']?_0x5eb985[_0xa85b('0x41')]:_0x231510[_0xa85b('0x3b')];if(_0x11e9ed[_0xa85b('0x3d')]['includeAll']){_0x5eb985[_0xa85b('0x4c')]=[{'all':!![]}];}_0x5eb985=_['merge']({},_0x5eb985,_0x11e9ed['options']);return db[_0xa85b('0x38')][_0xa85b('0x51')](_0x5eb985)[_0xa85b('0x1b')](handleEntityNotFound(_0x1ffd4a,null))[_0xa85b('0x1b')](respondWithResult(_0x1ffd4a,null))[_0xa85b('0x24')](handleError(_0x1ffd4a,null));};exports[_0xa85b('0x52')]=function(_0x1f3c3d,_0x1a691e){return db[_0xa85b('0x38')]['create'](_0x1f3c3d[_0xa85b('0x53')],{})['then'](function(_0x22fc5f){var _0xd32e9=_0x1f3c3d[_0xa85b('0x54')][_0xa85b('0x55')]({'plain':!![]});if(!_0xd32e9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd32e9[_0xa85b('0x56')]===_0xa85b('0x54')){var _0x523f86=_0x22fc5f[_0xa85b('0x55')]({'plain':!![]});var _0x3121f4=_0xa85b('0x32');return db[_0xa85b('0x57')]['find']({'where':{'name':_0x3121f4,'userProfileId':_0xd32e9['userProfileId']},'raw':!![]})[_0xa85b('0x1b')](function(_0x219cac){if(_0x219cac&&_0x219cac[_0xa85b('0x58')]===0x0){return db[_0xa85b('0x33')]['create']({'name':_0x523f86[_0xa85b('0x35')],'resourceId':_0x523f86['id'],'type':_0x219cac['name'],'sectionId':_0x219cac['id']},{})[_0xa85b('0x1b')](function(){return _0x22fc5f;});}else{return _0x22fc5f;}})[_0xa85b('0x24')](function(_0x37992e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37992e);throw _0x37992e;});}return _0x22fc5f;})[_0xa85b('0x1b')](respondWithResult(_0x1a691e,0xc9))[_0xa85b('0x24')](handleError(_0x1a691e,null));};exports[_0xa85b('0x30')]=function(_0x2d6171,_0x51caf8){if(_0x2d6171['body']['id']){delete _0x2d6171[_0xa85b('0x53')]['id'];}return db[_0xa85b('0x38')][_0xa85b('0x51')]({'where':{'id':_0x2d6171['params']['id']}})[_0xa85b('0x1b')](handleEntityNotFound(_0x51caf8,null))[_0xa85b('0x1b')](saveUpdates(_0x2d6171['body'],null))['then'](respondWithResult(_0x51caf8,null))[_0xa85b('0x24')](handleError(_0x51caf8,null));};exports[_0xa85b('0x31')]=function(_0x46911f,_0x627c16){return db[_0xa85b('0x38')][_0xa85b('0x51')]({'where':{'id':_0x46911f[_0xa85b('0x50')]['id']}})[_0xa85b('0x1b')](handleEntityNotFound(_0x627c16,null))['then'](removeEntity(_0x627c16,null))[_0xa85b('0x24')](handleError(_0x627c16,null));};exports['describe']=function(_0x17c57a,_0x2b8b09){return db['ChatQueue']['describe']()[_0xa85b('0x1b')](respondWithResult(_0x2b8b09,null))[_0xa85b('0x24')](handleError(_0x2b8b09,null));};exports[_0xa85b('0x59')]=function(_0x32d58d,_0x353853,_0x1d7b09){var _0x14d6f4={'raw':!![],'where':{}},_0x5954a2={},_0xf150a8;return db['ChatQueue'][_0xa85b('0x5a')]({'where':{'id':_0x32d58d[_0xa85b('0x50')]['id']}})['then'](handleEntityNotFound(_0x353853,null))[_0xa85b('0x1b')](function(_0x5c3d55){if(_0x5c3d55){_0xf150a8=_0x5c3d55[_0xa85b('0x55')]({'plain':!![]});_0x5954a2['model']=_[_0xa85b('0x3e')](db[_0xa85b('0x5b')][_0xa85b('0x39')]);_0x5954a2[_0xa85b('0x3d')]=_[_0xa85b('0x3e')](_0x32d58d[_0xa85b('0x3d')]);_0x5954a2['filters']=_[_0xa85b('0x40')](_0x5954a2[_0xa85b('0x3b')],_0x5954a2[_0xa85b('0x3d')]);_0x14d6f4[_0xa85b('0x41')]=_[_0xa85b('0x40')](_0x5954a2['model'],qs[_0xa85b('0x42')](_0x32d58d['query'][_0xa85b('0x42')]));_0x14d6f4[_0xa85b('0x41')]=_0x14d6f4[_0xa85b('0x41')]['length']?_0x14d6f4['attributes']:_0x5954a2[_0xa85b('0x3b')];if(!_0x32d58d[_0xa85b('0x3d')][_0xa85b('0x5c')](_0xa85b('0x43'))){_0x14d6f4[_0xa85b('0x2a')]=qs[_0xa85b('0x2a')](_0x32d58d['query']['limit']);_0x14d6f4[_0xa85b('0x28')]=qs[_0xa85b('0x28')](_0x32d58d[_0xa85b('0x3d')]['offset']);}_0x14d6f4[_0xa85b('0x44')]=qs['sort'](_0x32d58d[_0xa85b('0x3d')][_0xa85b('0x45')]);_0x14d6f4[_0xa85b('0x46')]=qs[_0xa85b('0x3f')](_[_0xa85b('0x47')](_0x32d58d[_0xa85b('0x3d')],_0x5954a2[_0xa85b('0x3f')]));_0x14d6f4[_0xa85b('0x46')][_0xa85b('0x5d')]=_0x5c3d55['id'];if(_0x32d58d[_0xa85b('0x3d')][_0xa85b('0x49')]){_0x14d6f4[_0xa85b('0x46')]=_[_0xa85b('0x5e')](_0x14d6f4[_0xa85b('0x46')],{'$or':_[_0xa85b('0x3c')](_0x14d6f4['attributes'],function(_0x4dfa90){var _0x14b8c7={};_0x14b8c7[_0x4dfa90]={'$like':'%'+_0x32d58d[_0xa85b('0x3d')][_0xa85b('0x49')]+'%'};return _0x14b8c7;})});}_0x14d6f4=_[_0xa85b('0x5e')]({},_0x14d6f4,_0x32d58d[_0xa85b('0x4a')]);return db[_0xa85b('0x5b')][_0xa85b('0x4d')](_0x14d6f4);}})[_0xa85b('0x1b')](function(_0x25042d){if(_0x25042d){return db['User'][_0xa85b('0x5f')]({'where':{'id':_[_0xa85b('0x3c')](_0x25042d,_0xa85b('0x60')),'role':_0xa85b('0x61')},'attributes':['id',_0xa85b('0x35'),'chatPause',_0xa85b('0x62'),_0xa85b('0x63')]});}})['then'](function(_0x3eafee){if(_0x3eafee){return{'count':_0x3eafee['count'],'rows':_['map'](_0x3eafee['rows'],function(_0x4f4ed){return{'membername':_0x4f4ed[_0xa85b('0x35')],'UserId':_0x4f4ed['id'],'queue_name':_0xf150a8[_0xa85b('0x35')],'ChatQueueId':_0xf150a8['id'],'interface':util[_0xa85b('0x64')](_0xa85b('0x65'),_0xa85b('0x66'),_0x4f4ed[_0xa85b('0x35')]),'penalty':0x0,'paused':_0x4f4ed['chatPause'],'createdAt':_0x4f4ed[_0xa85b('0x63')],'updatedAt':_0x4f4ed[_0xa85b('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa85b('0x1b')](respondWithFilteredResult(_0x353853,_0x14d6f4))[_0xa85b('0x24')](handleError(_0x353853,null));};exports[_0xa85b('0x67')]=function(_0x4a9d74,_0x23106b,_0x349f09){var _0x16b442={};var _0x39da62={};var _0x5588d3;var _0x2a608f;return db[_0xa85b('0x38')][_0xa85b('0x5a')]({'where':{'id':_0x4a9d74[_0xa85b('0x50')]['id']}})[_0xa85b('0x1b')](handleEntityNotFound(_0x23106b,null))[_0xa85b('0x1b')](function(_0x25280c){if(_0x25280c){_0x5588d3=_0x25280c;_0x39da62['model']=_['keys'](db[_0xa85b('0x68')][_0xa85b('0x39')]);_0x39da62['query']=_[_0xa85b('0x3e')](_0x4a9d74[_0xa85b('0x3d')]);_0x39da62[_0xa85b('0x3f')]=_[_0xa85b('0x40')](_0x39da62[_0xa85b('0x3b')],_0x39da62[_0xa85b('0x3d')]);_0x16b442['attributes']=_[_0xa85b('0x40')](_0x39da62[_0xa85b('0x3b')],qs[_0xa85b('0x42')](_0x4a9d74[_0xa85b('0x3d')][_0xa85b('0x42')]));_0x16b442[_0xa85b('0x41')]=_0x16b442[_0xa85b('0x41')][_0xa85b('0x69')]?_0x16b442[_0xa85b('0x41')]:_0x39da62[_0xa85b('0x3b')];_0x16b442[_0xa85b('0x44')]=qs[_0xa85b('0x45')](_0x4a9d74['query'][_0xa85b('0x45')]);_0x16b442[_0xa85b('0x46')]=qs['filters'](_['pick'](_0x4a9d74[_0xa85b('0x3d')],_0x39da62[_0xa85b('0x3f')]));if(_0x4a9d74[_0xa85b('0x3d')][_0xa85b('0x49')]){_0x16b442[_0xa85b('0x46')]=_[_0xa85b('0x5e')](_0x16b442[_0xa85b('0x46')],{'$or':_[_0xa85b('0x3c')](_0x16b442[_0xa85b('0x41')],function(_0x2620e6){var _0x58f56f={};_0x58f56f[_0x2620e6]={'$like':'%'+_0x4a9d74[_0xa85b('0x3d')]['filter']+'%'};return _0x58f56f;})});}_0x16b442=_[_0xa85b('0x5e')]({},_0x16b442,_0x4a9d74[_0xa85b('0x4a')]);return _0x5588d3[_0xa85b('0x67')](_0x16b442);}})[_0xa85b('0x1b')](function(_0x545bc4){if(_0x545bc4){_0x2a608f=_0x545bc4[_0xa85b('0x69')];if(!_0x4a9d74[_0xa85b('0x3d')][_0xa85b('0x5c')](_0xa85b('0x43'))){_0x16b442[_0xa85b('0x2a')]=qs[_0xa85b('0x2a')](_0x4a9d74['query'][_0xa85b('0x2a')]);_0x16b442['offset']=qs[_0xa85b('0x28')](_0x4a9d74['query'][_0xa85b('0x28')]);}return _0x5588d3[_0xa85b('0x67')](_0x16b442);}})[_0xa85b('0x1b')](function(_0x3385a0){if(_0x3385a0){return _0x3385a0?{'count':_0x2a608f,'rows':_0x3385a0}:null;}})[_0xa85b('0x1b')](respondWithResult(_0x23106b,null))[_0xa85b('0x24')](handleError(_0x23106b,null));};exports[_0xa85b('0x6a')]=function(_0xba6365,_0x36ef77,_0x5593a7){var _0x41e679=_0xba6365[_0xa85b('0x53')][_0xa85b('0x6b')];return db[_0xa85b('0x68')][_0xa85b('0x4d')]({'where':{'id':_0x41e679},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xa85b('0x35'),_0xa85b('0x6c'),'voicePause',_0xa85b('0x6d')],'raw':!![]}]})[_0xa85b('0x1b')](function(_0x1fcca9){if(_0x1fcca9){var _0x3a1b7d=_[_0xa85b('0x6e')](_0x1fcca9,function(_0x40fc85){var _0xd79ee3=_0x40fc85[_0xa85b('0x55')]({'plain':!![]});return _0xd79ee3[_0xa85b('0x6f')];});return db[_0xa85b('0x38')]['find']({'where':{'id':_0xba6365[_0xa85b('0x50')]['id']}})[_0xa85b('0x1b')](function(_0x3919cb){return db[_0xa85b('0x70')][_0xa85b('0x71')](function(_0x2c850a){return _0x3919cb[_0xa85b('0x6a')](_0x41e679,{'transaction':_0x2c850a})[_0xa85b('0x1b')](function(){return BPromise[_0xa85b('0x72')](_0x3a1b7d,function(_0x2dd0fe){return db[_0xa85b('0x5b')]['findOrCreate']({'where':{'UserId':_0x2dd0fe['id'],'ChatQueueId':_0xba6365[_0xa85b('0x50')]['id']},'transaction':_0x2c850a});});})[_0xa85b('0x1b')](function(){_0x3a1b7d[_0xa85b('0x73')](function(_0x282365){socket[_0xa85b('0x74')](_0xa85b('0x75'),{'UserId':_0x282365['id'],'ChatQueueId':_0x3919cb['id']});});});});});}})[_0xa85b('0x1b')](respondWithStatusCode(_0x36ef77,null))[_0xa85b('0x24')](handleError(_0x36ef77,null));};exports[_0xa85b('0x76')]=function(_0x5dd11d,_0x2b307d,_0x5b8237){return db[_0xa85b('0x68')]['findAll']({'where':{'id':_0x5dd11d[_0xa85b('0x3d')]['ids']},'attributes':['id'],'include':[{'model':db[_0xa85b('0x77')],'as':_0xa85b('0x6f'),'attributes':['id'],'raw':!![]}]})[_0xa85b('0x1b')](handleEntityNotFound(_0x2b307d,null))[_0xa85b('0x1b')](function(_0x2117c9){var _0x35665c=_['map'](_0x2117c9,'id');var _0x52d8e8=[];var _0x2c1db0=[];var _0x19f401=squel[_0xa85b('0x78')]();_0x19f401[_0xa85b('0x79')](_0xa85b('0x7a'))[_0xa85b('0x7b')]('team_has_chat_queues','tq')[_0xa85b('0x7c')](_0xa85b('0x7d'),'ut',_0xa85b('0x7e'))[_0xa85b('0x46')](_0xa85b('0x7f'),_0x5dd11d[_0xa85b('0x50')]['id']);for(var _0x18aa71=0x0;_0x18aa71<_0x2117c9[_0xa85b('0x69')];_0x18aa71+=0x1){let _0x2bed0a=_0x2117c9[_0x18aa71];for(var _0x34f36d=0x0;_0x34f36d<_0x2bed0a[_0xa85b('0x6f')][_0xa85b('0x69')];_0x34f36d+=0x1){let _0x564fc3=_0x2bed0a['Agents'][_0x34f36d];var _0xe802f2=_0x19f401['clone']();_0xe802f2[_0xa85b('0x46')](_0xa85b('0x80'),_0x564fc3['id']);_0x2c1db0[_0xa85b('0x81')](db['sequelize'][_0xa85b('0x3d')](_0xe802f2['toString'](),{'type':db[_0xa85b('0x70')]['QueryTypes'][_0xa85b('0x82')]})[_0xa85b('0x1b')](function(_0xf97cf1){if(_0xf97cf1[_0xa85b('0x69')]===0x1){return _0x564fc3['id'];}else{var _0x1e6a3f=_[_0xa85b('0x83')](_['map'](_0xf97cf1,_0xa85b('0x84')),function(_0x2f5c77){return _[_0xa85b('0x85')](_0x35665c,_0x2f5c77);});if(_0x1e6a3f){return _0x564fc3['id'];}}}));}}return BPromise[_0xa85b('0x86')](_0x2c1db0)[_0xa85b('0x1b')](function(_0x52b434){_0x52d8e8=_(_0x52d8e8)['union'](_0x52b434)['compact']()[_0xa85b('0x87')]();return db[_0xa85b('0x38')][_0xa85b('0x51')]({'where':{'id':_0x5dd11d['params']['id']}})[_0xa85b('0x1b')](function(_0x39205f){return db['sequelize'][_0xa85b('0x71')](function(_0x5e8bcf){return _0x39205f[_0xa85b('0x76')](_0x5dd11d['query'][_0xa85b('0x6b')],{'transaction':_0x5e8bcf})[_0xa85b('0x1b')](function(){if(!_[_0xa85b('0x88')](_0x52d8e8)){return _0x39205f['removeAgents'](_0x52d8e8,{'transaction':_0x5e8bcf});}})[_0xa85b('0x1b')](function(){_0x52d8e8[_0xa85b('0x73')](function(_0x4777d2){socket[_0xa85b('0x74')](_0xa85b('0x89'),{'UserId':_0x4777d2,'ChatQueueId':_0x39205f['id']});});});});});});})['then'](respondWithStatusCode(_0x2b307d,null))[_0xa85b('0x24')](handleError(_0x2b307d,null));};exports[_0xa85b('0x8a')]=function(_0x472e55,_0x3ba014,_0x2cb7b9){return db[_0xa85b('0x38')][_0xa85b('0x51')]({'where':{'id':_0x472e55[_0xa85b('0x50')]['id']}})[_0xa85b('0x1b')](handleEntityNotFound(_0x3ba014,null))[_0xa85b('0x1b')](function(_0x4b59ff){if(_0x4b59ff){return _0x4b59ff['addAgents'](_0x472e55['body'][_0xa85b('0x6b')],_[_0xa85b('0x8b')](_0x472e55[_0xa85b('0x53')],[_0xa85b('0x6b'),'id'])||{})['spread'](function(_0xc8f57f){for(var _0x29856d=0x0;_0x29856d<_0x472e55[_0xa85b('0x53')]['ids'][_0xa85b('0x69')];_0x29856d+=0x1){socket[_0xa85b('0x74')](_0xa85b('0x75'),{'UserId':Number(_0x472e55['body'][_0xa85b('0x6b')][_0x29856d]),'ChatQueueId':Number(_0x472e55[_0xa85b('0x50')]['id'])});}return _0xc8f57f;});}})[_0xa85b('0x1b')](respondWithResult(_0x3ba014,null))[_0xa85b('0x24')](handleError(_0x3ba014,null));};exports[_0xa85b('0x8c')]=function(_0x3776e5,_0x409c41,_0x2540cd){return db['ChatQueue'][_0xa85b('0x51')]({'where':{'id':_0x3776e5[_0xa85b('0x50')]['id']}})[_0xa85b('0x1b')](handleEntityNotFound(_0x409c41,null))[_0xa85b('0x1b')](function(_0x23753f){if(_0x23753f){return _0x23753f[_0xa85b('0x8c')](_0x3776e5[_0xa85b('0x3d')][_0xa85b('0x6b')])[_0xa85b('0x1b')](function(){if(_[_0xa85b('0x8d')](_0x3776e5[_0xa85b('0x3d')][_0xa85b('0x6b')])){for(var _0x4afcc5=0x0;_0x4afcc5<_0x3776e5[_0xa85b('0x3d')][_0xa85b('0x6b')][_0xa85b('0x69')];_0x4afcc5+=0x1){socket[_0xa85b('0x74')](_0xa85b('0x89'),{'UserId':Number(_0x3776e5['query'][_0xa85b('0x6b')][_0x4afcc5]),'ChatQueueId':Number(_0x3776e5[_0xa85b('0x50')]['id'])});}}else{socket[_0xa85b('0x74')]('userChatQueue:remove',{'UserId':Number(_0x3776e5[_0xa85b('0x3d')][_0xa85b('0x6b')]),'ChatQueueId':Number(_0x3776e5[_0xa85b('0x50')]['id'])});}});}})[_0xa85b('0x1b')](respondWithStatusCode(_0x409c41,null))[_0xa85b('0x24')](handleError(_0x409c41,null));};exports['getAgents']=function(_0x544f7b,_0x70f4f1,_0x22c491){var _0x5b4f45={};var _0x30ff42={};var _0x14889c;var _0x14b923;return db['ChatQueue']['findOne']({'where':{'id':_0x544f7b[_0xa85b('0x50')]['id']}})[_0xa85b('0x1b')](handleEntityNotFound(_0x70f4f1,null))[_0xa85b('0x1b')](function(_0x3b7ee2){if(_0x3b7ee2){_0x14889c=_0x3b7ee2;_0x30ff42['model']=_['keys'](db[_0xa85b('0x77')][_0xa85b('0x39')]);_0x30ff42[_0xa85b('0x3d')]=_[_0xa85b('0x3e')](_0x544f7b['query']);_0x30ff42[_0xa85b('0x3f')]=_[_0xa85b('0x40')](_0x30ff42['model'],_0x30ff42['query']);_0x5b4f45[_0xa85b('0x41')]=_['intersection'](_0x30ff42[_0xa85b('0x3b')],qs[_0xa85b('0x42')](_0x544f7b[_0xa85b('0x3d')][_0xa85b('0x42')]));_0x5b4f45[_0xa85b('0x41')]=_0x5b4f45[_0xa85b('0x41')][_0xa85b('0x69')]?_0x5b4f45['attributes']:_0x30ff42['model'];_0x5b4f45[_0xa85b('0x44')]=qs['sort'](_0x544f7b[_0xa85b('0x3d')][_0xa85b('0x45')]);_0x5b4f45[_0xa85b('0x46')]=qs[_0xa85b('0x3f')](_[_0xa85b('0x47')](_0x544f7b[_0xa85b('0x3d')],_0x30ff42[_0xa85b('0x3f')]));if(_0x544f7b[_0xa85b('0x3d')][_0xa85b('0x49')]){_0x5b4f45[_0xa85b('0x46')]=_[_0xa85b('0x5e')](_0x5b4f45[_0xa85b('0x46')],{'$or':_['map'](_0x5b4f45[_0xa85b('0x41')],function(_0x3b1b94){var _0x4a3418={};_0x4a3418[_0x3b1b94]={'$like':'%'+_0x544f7b[_0xa85b('0x3d')][_0xa85b('0x49')]+'%'};return _0x4a3418;})});}_0x5b4f45=_[_0xa85b('0x5e')]({},_0x5b4f45,_0x544f7b[_0xa85b('0x4a')]);return _0x14889c[_0xa85b('0x8e')](_0x5b4f45);}})[_0xa85b('0x1b')](function(_0x25ff2e){if(_0x25ff2e){_0x14b923=_0x25ff2e[_0xa85b('0x69')];if(!_0x544f7b[_0xa85b('0x3d')][_0xa85b('0x5c')](_0xa85b('0x43'))){_0x5b4f45[_0xa85b('0x2a')]=qs[_0xa85b('0x2a')](_0x544f7b[_0xa85b('0x3d')][_0xa85b('0x2a')]);_0x5b4f45['offset']=qs[_0xa85b('0x28')](_0x544f7b[_0xa85b('0x3d')][_0xa85b('0x28')]);}return _0x14889c['getAgents'](_0x5b4f45);}})[_0xa85b('0x1b')](function(_0x395837){if(_0x395837){return _0x395837?{'count':_0x14b923,'rows':_0x395837}:null;}})[_0xa85b('0x1b')](respondWithResult(_0x70f4f1,null))[_0xa85b('0x24')](handleError(_0x70f4f1,null));}; \ No newline at end of file +var _0xd698=['getMembers','findOne','UserChatQueue','nolimit','pick','findAll','User','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','addTeams','ids','online','voicePause','interface','Agents','transaction','forEach','emit','userChatQueue:save','removeTeams','field','tq.TeamId','from','team_has_chat_queues','join','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','compact','value','sequelize','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','zip-dir','fast-json-patch','path','sox','ejs','fs-extra','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','end','status','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','options','ChatQueue','count','includeAll','rows','catch','params','rawAttributes','include','find','create','get','role','user','ChatQueues','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe'];(function(_0x222aca,_0x2f9b60){var _0x3edb64=function(_0xc38946){while(--_0xc38946){_0x222aca['push'](_0x222aca['shift']());}};_0x3edb64(++_0x2f9b60);}(_0xd698,0x14a));var _0x8d69=function(_0x26af18,_0x21a3e4){_0x26af18=_0x26af18-0x0;var _0x571047=_0xd698[_0x26af18];return _0x571047;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8d69('0x0'));var jsonpatch=require(_0x8d69('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8d69('0x2'));var sox=require(_0x8d69('0x3'));var csv=require('to-csv');var ejs=require(_0x8d69('0x4'));var fs=require('fs');var fs_extra=require(_0x8d69('0x5'));var _=require('lodash');var squel=require(_0x8d69('0x6'));var crypto=require('crypto');var jsforce=require(_0x8d69('0x7'));var deskjs=require('desk.js');var toCsv=require(_0x8d69('0x8'));var querystring=require('querystring');var Papa=require(_0x8d69('0x9'));var Redis=require(_0x8d69('0xa'));var authService=require(_0x8d69('0xb'));var qs=require(_0x8d69('0xc'));var as=require(_0x8d69('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8d69('0xe'))('api');var utils=require(_0x8d69('0xf'));var config=require(_0x8d69('0x10'));var licenseUtil=require(_0x8d69('0x11'));var db=require(_0x8d69('0x12'))['db'];config[_0x8d69('0x13')]=_[_0x8d69('0x14')](config[_0x8d69('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x8d69('0x15'))(new Redis(config[_0x8d69('0x13')]));require(_0x8d69('0x16'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5f5312,_0x3de70d,_0x4e329e,_0x15f7f0){return new BPromise(function(_0x547e55,_0x23a1b5){var _0x3e62b1=_0x15f7f0||client;return _0x3e62b1[_0x8d69('0x17')](_0x5f5312,_0x4e329e)['then'](function(_0x5c1e2e){logger[_0x8d69('0x18')](_0x8d69('0x19'),_0x3de70d,_0x8d69('0x1a'));logger[_0x8d69('0x1b')](_0x8d69('0x1c'),_0x3de70d,'request\x20sent',JSON['stringify'](_0x5c1e2e));if(_0x5c1e2e[_0x8d69('0x1d')]){if(_0x5c1e2e[_0x8d69('0x1d')][_0x8d69('0x1e')]===0x1f4){logger['error'](_0x8d69('0x19'),_0x3de70d,_0x5c1e2e[_0x8d69('0x1d')]['message']);return _0x23a1b5(_0x5c1e2e[_0x8d69('0x1d')][_0x8d69('0x1f')]);}logger['error'](_0x8d69('0x19'),_0x3de70d,_0x5c1e2e[_0x8d69('0x1d')][_0x8d69('0x1f')]);return _0x547e55(_0x5c1e2e[_0x8d69('0x1d')][_0x8d69('0x1f')]);}else{logger[_0x8d69('0x18')](_0x8d69('0x19'),_0x3de70d,_0x8d69('0x1a'));_0x547e55(_0x5c1e2e[_0x8d69('0x20')][_0x8d69('0x1f')]);}})['catch'](function(_0x79b14){logger[_0x8d69('0x1d')]('ChatQueue,\x20%s,\x20%s',_0x3de70d,_0x79b14);_0x23a1b5(_0x79b14);});});}function respondWithStatusCode(_0x55d5f3,_0x1d55f1){_0x1d55f1=_0x1d55f1||0xcc;return function(_0x44115d){if(_0x44115d){return _0x55d5f3[_0x8d69('0x21')](_0x1d55f1);}return _0x55d5f3['status'](_0x1d55f1)[_0x8d69('0x22')]();};}function respondWithResult(_0x5a3909,_0xae9fb0){_0xae9fb0=_0xae9fb0||0xc8;return function(_0x4add85){if(_0x4add85){return _0x5a3909[_0x8d69('0x23')](_0xae9fb0)[_0x8d69('0x24')](_0x4add85);}};}function respondWithFilteredResult(_0x5a6cdc,_0x8164fd){return function(_0x54b5bf){if(_0x54b5bf){var _0x525cad=typeof _0x8164fd['offset']===_0x8d69('0x25')&&typeof _0x8164fd[_0x8d69('0x26')]===_0x8d69('0x25');var _0x5f1ac7=_0x54b5bf['count'];var _0x128927=_0x525cad?0x0:_0x8164fd[_0x8d69('0x27')];var _0x3a1c8d=_0x525cad?_0x54b5bf['count']:_0x8164fd[_0x8d69('0x27')]+_0x8164fd[_0x8d69('0x26')];var _0x152f6c;if(_0x3a1c8d>=_0x5f1ac7){_0x3a1c8d=_0x5f1ac7;_0x152f6c=0xc8;}else{_0x152f6c=0xce;}_0x5a6cdc[_0x8d69('0x23')](_0x152f6c);return _0x5a6cdc[_0x8d69('0x28')](_0x8d69('0x29'),_0x128927+'-'+_0x3a1c8d+'/'+_0x5f1ac7)[_0x8d69('0x24')](_0x54b5bf);}return null;};}function patchUpdates(_0xe6af35){return function(_0x488aa6){try{jsonpatch[_0x8d69('0x2a')](_0x488aa6,_0xe6af35,!![]);}catch(_0x4a7996){return BPromise[_0x8d69('0x2b')](_0x4a7996);}return _0x488aa6[_0x8d69('0x2c')]();};}function saveUpdates(_0x362dae,_0x2bb7cd){return function(_0x4002e6){if(_0x4002e6){return _0x4002e6[_0x8d69('0x2d')](_0x362dae)[_0x8d69('0x2e')](function(_0x5ad9bf){return _0x5ad9bf;});}return null;};}function removeEntity(_0x4c31eb,_0x4f0fc4){return function(_0x3fa4d4){if(_0x3fa4d4){return _0x3fa4d4[_0x8d69('0x2f')]()['then'](function(){var _0x5c5afd=_0x3fa4d4['get']({'plain':!![]});var _0x5f41f4='ChatQueues';return db['UserProfileResource'][_0x8d69('0x2f')]({'where':{'type':_0x5f41f4,'resourceId':_0x5c5afd['id']}})['then'](function(){return _0x3fa4d4;});})[_0x8d69('0x2e')](function(){_0x4c31eb[_0x8d69('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d0e44,_0x272c54){return function(_0x4a0b76){if(!_0x4a0b76){_0x2d0e44[_0x8d69('0x21')](0x194);}return _0x4a0b76;};}function handleError(_0x5368d5,_0x3f7a8c){_0x3f7a8c=_0x3f7a8c||0x1f4;return function(_0x5272b0){logger[_0x8d69('0x1d')](_0x5272b0[_0x8d69('0x30')]);if(_0x5272b0[_0x8d69('0x31')]){delete _0x5272b0['name'];}_0x5368d5[_0x8d69('0x23')](_0x3f7a8c)[_0x8d69('0x32')](_0x5272b0);};}exports['index']=function(_0x4c578f,_0x4d2b6c){var _0x5b59cf={},_0x2a27ff={},_0x387fa1={'count':0x0,'rows':[]};var _0x508d2b=_[_0x8d69('0x33')](db['ChatQueue']['rawAttributes'],function(_0x4a6da7){return{'name':_0x4a6da7[_0x8d69('0x34')],'type':_0x4a6da7[_0x8d69('0x35')][_0x8d69('0x36')]};});_0x2a27ff[_0x8d69('0x37')]=_[_0x8d69('0x33')](_0x508d2b,_0x8d69('0x31'));_0x2a27ff[_0x8d69('0x38')]=_[_0x8d69('0x39')](_0x4c578f[_0x8d69('0x38')]);_0x2a27ff[_0x8d69('0x3a')]=_[_0x8d69('0x3b')](_0x2a27ff[_0x8d69('0x37')],_0x2a27ff[_0x8d69('0x38')]);_0x5b59cf['attributes']=_[_0x8d69('0x3b')](_0x2a27ff[_0x8d69('0x37')],qs[_0x8d69('0x3c')](_0x4c578f[_0x8d69('0x38')]['fields']));_0x5b59cf[_0x8d69('0x3d')]=_0x5b59cf[_0x8d69('0x3d')][_0x8d69('0x3e')]?_0x5b59cf[_0x8d69('0x3d')]:_0x2a27ff[_0x8d69('0x37')];if(!_0x4c578f[_0x8d69('0x38')][_0x8d69('0x3f')]('nolimit')){_0x5b59cf[_0x8d69('0x26')]=qs[_0x8d69('0x26')](_0x4c578f[_0x8d69('0x38')][_0x8d69('0x26')]);_0x5b59cf[_0x8d69('0x27')]=qs[_0x8d69('0x27')](_0x4c578f[_0x8d69('0x38')][_0x8d69('0x27')]);}_0x5b59cf[_0x8d69('0x40')]=qs[_0x8d69('0x41')](_0x4c578f[_0x8d69('0x38')]['sort']);_0x5b59cf[_0x8d69('0x42')]=qs['filters'](_['pick'](_0x4c578f['query'],_0x2a27ff['filters']),_0x508d2b);if(_0x4c578f[_0x8d69('0x38')][_0x8d69('0x43')]){_0x5b59cf[_0x8d69('0x42')]=_[_0x8d69('0x44')](_0x5b59cf[_0x8d69('0x42')],{'$or':_['map'](_0x508d2b,function(_0x8cd8a0){if(_0x8cd8a0[_0x8d69('0x35')]!=='VIRTUAL'){var _0x5297c7={};_0x5297c7[_0x8cd8a0['name']]={'$like':'%'+_0x4c578f[_0x8d69('0x38')][_0x8d69('0x43')]+'%'};return _0x5297c7;}})});}_0x5b59cf=_[_0x8d69('0x44')]({},_0x5b59cf,_0x4c578f[_0x8d69('0x45')]);var _0x59ced8={'where':_0x5b59cf[_0x8d69('0x42')]};return db[_0x8d69('0x46')]['count'](_0x59ced8)[_0x8d69('0x2e')](function(_0x536283){_0x387fa1[_0x8d69('0x47')]=_0x536283;if(_0x4c578f[_0x8d69('0x38')][_0x8d69('0x48')]){_0x5b59cf['include']=[{'all':!![]}];}return db[_0x8d69('0x46')]['findAll'](_0x5b59cf);})['then'](function(_0x1e9e6f){_0x387fa1[_0x8d69('0x49')]=_0x1e9e6f;return _0x387fa1;})[_0x8d69('0x2e')](respondWithFilteredResult(_0x4d2b6c,_0x5b59cf))[_0x8d69('0x4a')](handleError(_0x4d2b6c,null));};exports['show']=function(_0x344bcb,_0x1403f3){var _0x2356df={'raw':!![],'where':{'id':_0x344bcb[_0x8d69('0x4b')]['id']}},_0x54725b={};_0x54725b['model']=_['keys'](db[_0x8d69('0x46')][_0x8d69('0x4c')]);_0x54725b[_0x8d69('0x38')]=_[_0x8d69('0x39')](_0x344bcb[_0x8d69('0x38')]);_0x54725b[_0x8d69('0x3a')]=_['intersection'](_0x54725b['model'],_0x54725b[_0x8d69('0x38')]);_0x2356df[_0x8d69('0x3d')]=_['intersection'](_0x54725b['model'],qs[_0x8d69('0x3c')](_0x344bcb[_0x8d69('0x38')]['fields']));_0x2356df['attributes']=_0x2356df['attributes'][_0x8d69('0x3e')]?_0x2356df[_0x8d69('0x3d')]:_0x54725b[_0x8d69('0x37')];if(_0x344bcb[_0x8d69('0x38')][_0x8d69('0x48')]){_0x2356df[_0x8d69('0x4d')]=[{'all':!![]}];}_0x2356df=_[_0x8d69('0x44')]({},_0x2356df,_0x344bcb['options']);return db['ChatQueue'][_0x8d69('0x4e')](_0x2356df)[_0x8d69('0x2e')](handleEntityNotFound(_0x1403f3,null))[_0x8d69('0x2e')](respondWithResult(_0x1403f3,null))[_0x8d69('0x4a')](handleError(_0x1403f3,null));};exports[_0x8d69('0x4f')]=function(_0x43c926,_0x59ba28){return db[_0x8d69('0x46')][_0x8d69('0x4f')](_0x43c926['body'],{})[_0x8d69('0x2e')](function(_0x70aae5){var _0x2647f7=_0x43c926['user'][_0x8d69('0x50')]({'plain':!![]});if(!_0x2647f7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2647f7[_0x8d69('0x51')]===_0x8d69('0x52')){var _0x3d673d=_0x70aae5[_0x8d69('0x50')]({'plain':!![]});var _0x5380f5=_0x8d69('0x53');return db['UserProfileSection']['find']({'where':{'name':_0x5380f5,'userProfileId':_0x2647f7[_0x8d69('0x54')]},'raw':!![]})['then'](function(_0x29cea1){if(_0x29cea1&&_0x29cea1[_0x8d69('0x55')]===0x0){return db[_0x8d69('0x56')]['create']({'name':_0x3d673d[_0x8d69('0x31')],'resourceId':_0x3d673d['id'],'type':_0x29cea1['name'],'sectionId':_0x29cea1['id']},{})[_0x8d69('0x2e')](function(){return _0x70aae5;});}else{return _0x70aae5;}})['catch'](function(_0x40efa1){logger['error'](_0x8d69('0x57'),_0x40efa1);throw _0x40efa1;});}return _0x70aae5;})[_0x8d69('0x2e')](respondWithResult(_0x59ba28,0xc9))[_0x8d69('0x4a')](handleError(_0x59ba28,null));};exports[_0x8d69('0x2d')]=function(_0x5b66f5,_0x87ad7d){if(_0x5b66f5['body']['id']){delete _0x5b66f5[_0x8d69('0x58')]['id'];}return db[_0x8d69('0x46')][_0x8d69('0x4e')]({'where':{'id':_0x5b66f5[_0x8d69('0x4b')]['id']}})[_0x8d69('0x2e')](handleEntityNotFound(_0x87ad7d,null))[_0x8d69('0x2e')](saveUpdates(_0x5b66f5[_0x8d69('0x58')],null))[_0x8d69('0x2e')](respondWithResult(_0x87ad7d,null))['catch'](handleError(_0x87ad7d,null));};exports[_0x8d69('0x2f')]=function(_0xffd054,_0x5d1078){return db['ChatQueue']['find']({'where':{'id':_0xffd054[_0x8d69('0x4b')]['id']}})[_0x8d69('0x2e')](handleEntityNotFound(_0x5d1078,null))[_0x8d69('0x2e')](removeEntity(_0x5d1078,null))[_0x8d69('0x4a')](handleError(_0x5d1078,null));};exports[_0x8d69('0x59')]=function(_0x1203e5,_0x4a0982){return db[_0x8d69('0x46')][_0x8d69('0x59')]()[_0x8d69('0x2e')](respondWithResult(_0x4a0982,null))[_0x8d69('0x4a')](handleError(_0x4a0982,null));};exports[_0x8d69('0x5a')]=function(_0x4093d4,_0x51469d,_0x54d261){var _0x455ea7={'raw':!![],'where':{}},_0x4f7368={},_0x395175;return db[_0x8d69('0x46')][_0x8d69('0x5b')]({'where':{'id':_0x4093d4[_0x8d69('0x4b')]['id']}})[_0x8d69('0x2e')](handleEntityNotFound(_0x51469d,null))[_0x8d69('0x2e')](function(_0x5cb0a1){if(_0x5cb0a1){_0x395175=_0x5cb0a1[_0x8d69('0x50')]({'plain':!![]});_0x4f7368[_0x8d69('0x37')]=_[_0x8d69('0x39')](db[_0x8d69('0x5c')]['rawAttributes']);_0x4f7368[_0x8d69('0x38')]=_[_0x8d69('0x39')](_0x4093d4['query']);_0x4f7368[_0x8d69('0x3a')]=_[_0x8d69('0x3b')](_0x4f7368[_0x8d69('0x37')],_0x4f7368[_0x8d69('0x38')]);_0x455ea7[_0x8d69('0x3d')]=_[_0x8d69('0x3b')](_0x4f7368[_0x8d69('0x37')],qs[_0x8d69('0x3c')](_0x4093d4['query'][_0x8d69('0x3c')]));_0x455ea7['attributes']=_0x455ea7[_0x8d69('0x3d')][_0x8d69('0x3e')]?_0x455ea7['attributes']:_0x4f7368[_0x8d69('0x37')];if(!_0x4093d4[_0x8d69('0x38')][_0x8d69('0x3f')](_0x8d69('0x5d'))){_0x455ea7[_0x8d69('0x26')]=qs['limit'](_0x4093d4['query']['limit']);_0x455ea7[_0x8d69('0x27')]=qs['offset'](_0x4093d4[_0x8d69('0x38')][_0x8d69('0x27')]);}_0x455ea7[_0x8d69('0x40')]=qs[_0x8d69('0x41')](_0x4093d4[_0x8d69('0x38')][_0x8d69('0x41')]);_0x455ea7[_0x8d69('0x42')]=qs[_0x8d69('0x3a')](_[_0x8d69('0x5e')](_0x4093d4[_0x8d69('0x38')],_0x4f7368[_0x8d69('0x3a')]));_0x455ea7['where']['ChatQueueId']=_0x5cb0a1['id'];if(_0x4093d4['query'][_0x8d69('0x43')]){_0x455ea7[_0x8d69('0x42')]=_[_0x8d69('0x44')](_0x455ea7[_0x8d69('0x42')],{'$or':_['map'](_0x455ea7['attributes'],function(_0x1fba47){var _0x1d7629={};_0x1d7629[_0x1fba47]={'$like':'%'+_0x4093d4['query'][_0x8d69('0x43')]+'%'};return _0x1d7629;})});}_0x455ea7=_['merge']({},_0x455ea7,_0x4093d4[_0x8d69('0x45')]);return db[_0x8d69('0x5c')][_0x8d69('0x5f')](_0x455ea7);}})[_0x8d69('0x2e')](function(_0x3b5a26){if(_0x3b5a26){return db[_0x8d69('0x60')]['findAndCountAll']({'where':{'id':_['map'](_0x3b5a26,_0x8d69('0x61')),'role':_0x8d69('0x62')},'attributes':['id',_0x8d69('0x31'),_0x8d69('0x63'),_0x8d69('0x64'),_0x8d69('0x65')]});}})[_0x8d69('0x2e')](function(_0x3551d7){if(_0x3551d7){return{'count':_0x3551d7[_0x8d69('0x47')],'rows':_[_0x8d69('0x33')](_0x3551d7['rows'],function(_0x1a6494){return{'membername':_0x1a6494[_0x8d69('0x31')],'UserId':_0x1a6494['id'],'queue_name':_0x395175[_0x8d69('0x31')],'ChatQueueId':_0x395175['id'],'interface':util['format'](_0x8d69('0x66'),_0x8d69('0x67'),_0x1a6494['name']),'penalty':0x0,'paused':_0x1a6494[_0x8d69('0x63')],'createdAt':_0x1a6494['createdAt'],'updatedAt':_0x1a6494[_0x8d69('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x51469d,_0x455ea7))['catch'](handleError(_0x51469d,null));};exports[_0x8d69('0x68')]=function(_0x3713c5,_0x2a623d,_0xb2ff0f){var _0x4a313e={};var _0x9b5314={};var _0x356ce6;var _0x390f0b;return db[_0x8d69('0x46')][_0x8d69('0x5b')]({'where':{'id':_0x3713c5[_0x8d69('0x4b')]['id']}})[_0x8d69('0x2e')](handleEntityNotFound(_0x2a623d,null))[_0x8d69('0x2e')](function(_0x4e43a3){if(_0x4e43a3){_0x356ce6=_0x4e43a3;_0x9b5314[_0x8d69('0x37')]=_[_0x8d69('0x39')](db[_0x8d69('0x69')][_0x8d69('0x4c')]);_0x9b5314[_0x8d69('0x38')]=_[_0x8d69('0x39')](_0x3713c5['query']);_0x9b5314[_0x8d69('0x3a')]=_[_0x8d69('0x3b')](_0x9b5314[_0x8d69('0x37')],_0x9b5314[_0x8d69('0x38')]);_0x4a313e['attributes']=_[_0x8d69('0x3b')](_0x9b5314['model'],qs['fields'](_0x3713c5[_0x8d69('0x38')][_0x8d69('0x3c')]));_0x4a313e[_0x8d69('0x3d')]=_0x4a313e[_0x8d69('0x3d')]['length']?_0x4a313e[_0x8d69('0x3d')]:_0x9b5314[_0x8d69('0x37')];_0x4a313e[_0x8d69('0x40')]=qs[_0x8d69('0x41')](_0x3713c5[_0x8d69('0x38')][_0x8d69('0x41')]);_0x4a313e['where']=qs[_0x8d69('0x3a')](_[_0x8d69('0x5e')](_0x3713c5[_0x8d69('0x38')],_0x9b5314['filters']));if(_0x3713c5['query']['filter']){_0x4a313e['where']=_[_0x8d69('0x44')](_0x4a313e[_0x8d69('0x42')],{'$or':_[_0x8d69('0x33')](_0x4a313e[_0x8d69('0x3d')],function(_0x1fe254){var _0x46d155={};_0x46d155[_0x1fe254]={'$like':'%'+_0x3713c5[_0x8d69('0x38')]['filter']+'%'};return _0x46d155;})});}_0x4a313e=_['merge']({},_0x4a313e,_0x3713c5[_0x8d69('0x45')]);return _0x356ce6[_0x8d69('0x68')](_0x4a313e);}})[_0x8d69('0x2e')](function(_0x1c8f32){if(_0x1c8f32){_0x390f0b=_0x1c8f32[_0x8d69('0x3e')];if(!_0x3713c5[_0x8d69('0x38')][_0x8d69('0x3f')](_0x8d69('0x5d'))){_0x4a313e[_0x8d69('0x26')]=qs[_0x8d69('0x26')](_0x3713c5[_0x8d69('0x38')][_0x8d69('0x26')]);_0x4a313e[_0x8d69('0x27')]=qs['offset'](_0x3713c5[_0x8d69('0x38')][_0x8d69('0x27')]);}return _0x356ce6[_0x8d69('0x68')](_0x4a313e);}})[_0x8d69('0x2e')](function(_0x10994d){if(_0x10994d){return _0x10994d?{'count':_0x390f0b,'rows':_0x10994d}:null;}})[_0x8d69('0x2e')](respondWithResult(_0x2a623d,null))[_0x8d69('0x4a')](handleError(_0x2a623d,null));};exports[_0x8d69('0x6a')]=function(_0x24d2af,_0x51b405,_0x287f13){var _0x5b1432=_0x24d2af[_0x8d69('0x58')][_0x8d69('0x6b')];return db[_0x8d69('0x69')]['findAll']({'where':{'id':_0x5b1432},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x8d69('0x31'),_0x8d69('0x6c'),_0x8d69('0x6d'),_0x8d69('0x6e')],'raw':!![]}]})['then'](function(_0x4d5691){if(_0x4d5691){var _0x2b6075=_['flatMap'](_0x4d5691,function(_0x5895e4){var _0x2e71f8=_0x5895e4[_0x8d69('0x50')]({'plain':!![]});return _0x2e71f8[_0x8d69('0x6f')];});return db[_0x8d69('0x46')][_0x8d69('0x4e')]({'where':{'id':_0x24d2af[_0x8d69('0x4b')]['id']}})['then'](function(_0x3c2fb0){return db['sequelize'][_0x8d69('0x70')](function(_0x448e65){return _0x3c2fb0[_0x8d69('0x6a')](_0x5b1432,{'transaction':_0x448e65})['then'](function(){return BPromise['each'](_0x2b6075,function(_0x37fb58){return db[_0x8d69('0x5c')]['findOrCreate']({'where':{'UserId':_0x37fb58['id'],'ChatQueueId':_0x24d2af['params']['id']},'transaction':_0x448e65});});})['then'](function(){_0x2b6075[_0x8d69('0x71')](function(_0x525301){socket[_0x8d69('0x72')](_0x8d69('0x73'),{'UserId':_0x525301['id'],'ChatQueueId':_0x3c2fb0['id']});});});});});}})[_0x8d69('0x2e')](respondWithStatusCode(_0x51b405,null))[_0x8d69('0x4a')](handleError(_0x51b405,null));};exports[_0x8d69('0x74')]=function(_0x37e6a5,_0x3d6319,_0x1e489b){return db['Team'][_0x8d69('0x5f')]({'where':{'id':_0x37e6a5[_0x8d69('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0x8d69('0x60')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x8d69('0x2e')](handleEntityNotFound(_0x3d6319,null))[_0x8d69('0x2e')](function(_0x140141){var _0x28c80a=_[_0x8d69('0x33')](_0x140141,'id');var _0x1ea1b0=[];var _0x43698f=[];var _0x4b0e93=squel['select']();_0x4b0e93[_0x8d69('0x75')](_0x8d69('0x76'))[_0x8d69('0x77')](_0x8d69('0x78'),'tq')[_0x8d69('0x79')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8d69('0x42')]('ChatQueueId\x20=\x20?',_0x37e6a5[_0x8d69('0x4b')]['id']);for(var _0x3f8d47=0x0;_0x3f8d47<_0x140141[_0x8d69('0x3e')];_0x3f8d47+=0x1){let _0x3bc8d2=_0x140141[_0x3f8d47];for(var _0x581a7c=0x0;_0x581a7c<_0x3bc8d2[_0x8d69('0x6f')][_0x8d69('0x3e')];_0x581a7c+=0x1){let _0x39c786=_0x3bc8d2[_0x8d69('0x6f')][_0x581a7c];var _0x49cc15=_0x4b0e93[_0x8d69('0x7a')]();_0x49cc15[_0x8d69('0x42')](_0x8d69('0x7b'),_0x39c786['id']);_0x43698f[_0x8d69('0x7c')](db['sequelize']['query'](_0x49cc15[_0x8d69('0x7d')](),{'type':db['sequelize'][_0x8d69('0x7e')][_0x8d69('0x7f')]})[_0x8d69('0x2e')](function(_0x6cb123){if(_0x6cb123['length']===0x1){return _0x39c786['id'];}else{var _0x5151fa=_[_0x8d69('0x80')](_['map'](_0x6cb123,'TeamId'),function(_0x2e5d58){return _['includes'](_0x28c80a,_0x2e5d58);});if(_0x5151fa){return _0x39c786['id'];}}}));}}return BPromise['all'](_0x43698f)[_0x8d69('0x2e')](function(_0x451e81){_0x1ea1b0=_(_0x1ea1b0)['union'](_0x451e81)[_0x8d69('0x81')]()[_0x8d69('0x82')]();return db['ChatQueue'][_0x8d69('0x4e')]({'where':{'id':_0x37e6a5[_0x8d69('0x4b')]['id']}})['then'](function(_0x3890a3){return db[_0x8d69('0x83')]['transaction'](function(_0x52c222){return _0x3890a3[_0x8d69('0x74')](_0x37e6a5[_0x8d69('0x38')][_0x8d69('0x6b')],{'transaction':_0x52c222})['then'](function(){if(!_[_0x8d69('0x84')](_0x1ea1b0)){return _0x3890a3[_0x8d69('0x85')](_0x1ea1b0,{'transaction':_0x52c222});}})[_0x8d69('0x2e')](function(){_0x1ea1b0[_0x8d69('0x71')](function(_0xd00774){socket['emit'](_0x8d69('0x86'),{'UserId':_0xd00774,'ChatQueueId':_0x3890a3['id']});});});});});});})[_0x8d69('0x2e')](respondWithStatusCode(_0x3d6319,null))[_0x8d69('0x4a')](handleError(_0x3d6319,null));};exports[_0x8d69('0x87')]=function(_0x596c35,_0x3518e6,_0x3dfc69){return db[_0x8d69('0x46')][_0x8d69('0x4e')]({'where':{'id':_0x596c35[_0x8d69('0x4b')]['id']}})[_0x8d69('0x2e')](handleEntityNotFound(_0x3518e6,null))[_0x8d69('0x2e')](function(_0x481cec){if(_0x481cec){return _0x481cec[_0x8d69('0x87')](_0x596c35['body'][_0x8d69('0x6b')],_[_0x8d69('0x88')](_0x596c35['body'],[_0x8d69('0x6b'),'id'])||{})[_0x8d69('0x89')](function(_0xcb202e){for(var _0x2a4ba1=0x0;_0x2a4ba1<_0x596c35['body'][_0x8d69('0x6b')][_0x8d69('0x3e')];_0x2a4ba1+=0x1){socket[_0x8d69('0x72')](_0x8d69('0x73'),{'UserId':Number(_0x596c35[_0x8d69('0x58')]['ids'][_0x2a4ba1]),'ChatQueueId':Number(_0x596c35[_0x8d69('0x4b')]['id'])});}return _0xcb202e;});}})['then'](respondWithResult(_0x3518e6,null))[_0x8d69('0x4a')](handleError(_0x3518e6,null));};exports[_0x8d69('0x85')]=function(_0x457d9f,_0x2ebc09,_0x37a609){return db[_0x8d69('0x46')][_0x8d69('0x4e')]({'where':{'id':_0x457d9f[_0x8d69('0x4b')]['id']}})[_0x8d69('0x2e')](handleEntityNotFound(_0x2ebc09,null))[_0x8d69('0x2e')](function(_0x2b8ad9){if(_0x2b8ad9){return _0x2b8ad9[_0x8d69('0x85')](_0x457d9f[_0x8d69('0x38')][_0x8d69('0x6b')])[_0x8d69('0x2e')](function(){if(_[_0x8d69('0x8a')](_0x457d9f[_0x8d69('0x38')][_0x8d69('0x6b')])){for(var _0x3678b5=0x0;_0x3678b5<_0x457d9f[_0x8d69('0x38')][_0x8d69('0x6b')][_0x8d69('0x3e')];_0x3678b5+=0x1){socket[_0x8d69('0x72')](_0x8d69('0x86'),{'UserId':Number(_0x457d9f['query'][_0x8d69('0x6b')][_0x3678b5]),'ChatQueueId':Number(_0x457d9f['params']['id'])});}}else{socket[_0x8d69('0x72')](_0x8d69('0x86'),{'UserId':Number(_0x457d9f[_0x8d69('0x38')]['ids']),'ChatQueueId':Number(_0x457d9f[_0x8d69('0x4b')]['id'])});}});}})[_0x8d69('0x2e')](respondWithStatusCode(_0x2ebc09,null))[_0x8d69('0x4a')](handleError(_0x2ebc09,null));};exports[_0x8d69('0x8b')]=function(_0x3d1c5d,_0x22f6c6,_0x5a5c82){var _0x216453={};var _0x19add8={};var _0x20902c;var _0x37c75b;return db[_0x8d69('0x46')][_0x8d69('0x5b')]({'where':{'id':_0x3d1c5d[_0x8d69('0x4b')]['id']}})[_0x8d69('0x2e')](handleEntityNotFound(_0x22f6c6,null))[_0x8d69('0x2e')](function(_0x5baf82){if(_0x5baf82){_0x20902c=_0x5baf82;_0x19add8['model']=_[_0x8d69('0x39')](db['User'][_0x8d69('0x4c')]);_0x19add8[_0x8d69('0x38')]=_[_0x8d69('0x39')](_0x3d1c5d[_0x8d69('0x38')]);_0x19add8[_0x8d69('0x3a')]=_[_0x8d69('0x3b')](_0x19add8[_0x8d69('0x37')],_0x19add8['query']);_0x216453[_0x8d69('0x3d')]=_['intersection'](_0x19add8['model'],qs[_0x8d69('0x3c')](_0x3d1c5d[_0x8d69('0x38')]['fields']));_0x216453['attributes']=_0x216453[_0x8d69('0x3d')]['length']?_0x216453[_0x8d69('0x3d')]:_0x19add8[_0x8d69('0x37')];_0x216453['order']=qs[_0x8d69('0x41')](_0x3d1c5d[_0x8d69('0x38')][_0x8d69('0x41')]);_0x216453[_0x8d69('0x42')]=qs[_0x8d69('0x3a')](_[_0x8d69('0x5e')](_0x3d1c5d[_0x8d69('0x38')],_0x19add8[_0x8d69('0x3a')]));if(_0x3d1c5d[_0x8d69('0x38')][_0x8d69('0x43')]){_0x216453['where']=_[_0x8d69('0x44')](_0x216453[_0x8d69('0x42')],{'$or':_[_0x8d69('0x33')](_0x216453[_0x8d69('0x3d')],function(_0x10b48b){var _0x30f4df={};_0x30f4df[_0x10b48b]={'$like':'%'+_0x3d1c5d[_0x8d69('0x38')][_0x8d69('0x43')]+'%'};return _0x30f4df;})});}_0x216453=_[_0x8d69('0x44')]({},_0x216453,_0x3d1c5d[_0x8d69('0x45')]);return _0x20902c[_0x8d69('0x8b')](_0x216453);}})[_0x8d69('0x2e')](function(_0x3b0d31){if(_0x3b0d31){_0x37c75b=_0x3b0d31[_0x8d69('0x3e')];if(!_0x3d1c5d[_0x8d69('0x38')][_0x8d69('0x3f')](_0x8d69('0x5d'))){_0x216453[_0x8d69('0x26')]=qs[_0x8d69('0x26')](_0x3d1c5d[_0x8d69('0x38')][_0x8d69('0x26')]);_0x216453[_0x8d69('0x27')]=qs['offset'](_0x3d1c5d[_0x8d69('0x38')][_0x8d69('0x27')]);}return _0x20902c[_0x8d69('0x8b')](_0x216453);}})[_0x8d69('0x2e')](function(_0x74a3f7){if(_0x74a3f7){return _0x74a3f7?{'count':_0x37c75b,'rows':_0x74a3f7}:null;}})['then'](respondWithResult(_0x22f6c6,null))[_0x8d69('0x4a')](handleError(_0x22f6c6,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 24e0fee..4a1c695 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 _0xbf2a=['events','setMaxListeners','save','update','remove','emit','hook'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xbf2a,0x165));var _0xabf2=function(_0x5e9383,_0x268888){_0x5e9383=_0x5e9383-0x0;var _0x4e830a=_0xbf2a[_0x5e9383];return _0x4e830a;};'use strict';var EventEmitter=require(_0xabf2('0x0'));var ChatQueue=require('../../mysqldb')['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xabf2('0x1')](0x0);var events={'afterCreate':_0xabf2('0x2'),'afterUpdate':_0xabf2('0x3'),'afterDestroy':_0xabf2('0x4')};function emitEvent(_0x3b7030){return function(_0x25ee39,_0x535b32,_0x1651e8){ChatQueueEvents[_0xabf2('0x5')](_0x3b7030+':'+_0x25ee39['id'],_0x25ee39);ChatQueueEvents['emit'](_0x3b7030,_0x25ee39);_0x1651e8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0xabf2('0x6')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x57be=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x57be,0x1e6));var _0xe57b=function(_0x45dcdb,_0x4d4c5d){_0x45dcdb=_0x45dcdb-0x0;var _0x413917=_0x57be[_0x45dcdb];return _0x413917;};'use strict';var EventEmitter=require(_0xe57b('0x0'));var ChatQueue=require(_0xe57b('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xe57b('0x2')](0x0);var events={'afterCreate':_0xe57b('0x3'),'afterUpdate':_0xe57b('0x4'),'afterDestroy':_0xe57b('0x5')};function emitEvent(_0x50ff43){return function(_0x3e0756,_0x4f0f40,_0x1a3b47){ChatQueueEvents[_0xe57b('0x6')](_0x50ff43+':'+_0x3e0756['id'],_0x3e0756);ChatQueueEvents['emit'](_0x50ff43,_0x3e0756);_0x1a3b47(null);};}for(var e in events){if(events[_0xe57b('0x7')](e)){var event=events[e];ChatQueue[_0xe57b('0x8')](e,emitEvent(event));}}module[_0xe57b('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 5ae8555..c78bb99 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 _0xb48d=['api','moment','bluebird','path','rimraf','../../config/environment','exports','define','chat_queues','lodash','util','../../config/logger'];(function(_0xbea547,_0x18565e){var _0x3c1c54=function(_0x5da24e){while(--_0x5da24e){_0xbea547['push'](_0xbea547['shift']());}};_0x3c1c54(++_0x18565e);}(_0xb48d,0x75));var _0xdb48=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xb48d[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xdb48('0x0'));var util=require(_0xdb48('0x1'));var logger=require(_0xdb48('0x2'))(_0xdb48('0x3'));var moment=require(_0xdb48('0x4'));var BPromise=require(_0xdb48('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdb48('0x6'));var rimraf=require(_0xdb48('0x7'));var config=require(_0xdb48('0x8'));var attributes=require('./chatQueue.attributes');module[_0xdb48('0x9')]=function(_0x55adb4,_0x31524f){return _0x55adb4[_0xdb48('0xa')]('ChatQueue',attributes,{'tableName':_0xdb48('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b6f=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ChatQueue','chat_queues','lodash','util'];(function(_0x4dc2a0,_0x38c7d2){var _0x4cc1c4=function(_0x337214){while(--_0x337214){_0x4dc2a0['push'](_0x4dc2a0['shift']());}};_0x4cc1c4(++_0x38c7d2);}(_0x0b6f,0x102));var _0xf0b6=function(_0x39bfb6,_0x4272c8){_0x39bfb6=_0x39bfb6-0x0;var _0x23fef9=_0x0b6f[_0x39bfb6];return _0x23fef9;};'use strict';var _=require(_0xf0b6('0x0'));var util=require(_0xf0b6('0x1'));var logger=require(_0xf0b6('0x2'))(_0xf0b6('0x3'));var moment=require(_0xf0b6('0x4'));var BPromise=require(_0xf0b6('0x5'));var rp=require(_0xf0b6('0x6'));var fs=require('fs');var path=require(_0xf0b6('0x7'));var rimraf=require(_0xf0b6('0x8'));var config=require(_0xf0b6('0x9'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x6ff818,_0x17f588){return _0x6ff818[_0xf0b6('0xa')](_0xf0b6('0xb'),attributes,{'tableName':_0xf0b6('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 b178014..3835edb 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 _0xb79a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ChatQueue','options','raw','where','attributes','limit','include','map','model','GetChatQueue','debug','stringify','ShowChatQueue','lodash','util'];(function(_0x12d416,_0xa1a903){var _0x4397fc=function(_0x326519){while(--_0x326519){_0x12d416['push'](_0x12d416['shift']());}};_0x4397fc(++_0xa1a903);}(_0xb79a,0x18e));var _0xab79=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb79a[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xab79('0x0'));var util=require(_0xab79('0x1'));var moment=require('moment');var BPromise=require(_0xab79('0x2'));var rs=require(_0xab79('0x3'));var fs=require('fs');var Redis=require(_0xab79('0x4'));var db=require(_0xab79('0x5'))['db'];var utils=require(_0xab79('0x6'));var logger=require(_0xab79('0x7'))(_0xab79('0x8'));var config=require(_0xab79('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xab79('0xa')]['http']({'port':0x232a});config[_0xab79('0xb')]=_[_0xab79('0xc')](config[_0xab79('0xb')],{'host':_0xab79('0xd'),'port':0x18eb});var socket=require(_0xab79('0xe'))(new Redis(config[_0xab79('0xb')]));require(_0xab79('0xf'))[_0xab79('0x10')](socket);function respondWithRpcPromise(_0xf6b416,_0x283acc,_0x17767c){return new BPromise(function(_0x526b0b,_0x5b5009){return client[_0xab79('0x11')](_0xf6b416,_0x17767c)[_0xab79('0x12')](function(_0x2a06c7){logger[_0xab79('0x13')](_0xab79('0x14'),_0x283acc,_0xab79('0x15'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x283acc,_0xab79('0x15'),JSON['stringify'](_0x2a06c7));if(_0x2a06c7[_0xab79('0x16')]){if(_0x2a06c7[_0xab79('0x16')][_0xab79('0x17')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x283acc,_0x2a06c7['error']['message']);return _0x5b5009(_0x2a06c7[_0xab79('0x16')][_0xab79('0x18')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x283acc,_0x2a06c7['error'][_0xab79('0x18')]);return _0x526b0b(_0x2a06c7[_0xab79('0x16')]['message']);}else{logger[_0xab79('0x13')](_0xab79('0x14'),_0x283acc,_0xab79('0x15'));_0x526b0b(_0x2a06c7[_0xab79('0x19')]['message']);}})[_0xab79('0x1a')](function(_0x2c7b3e){logger[_0xab79('0x16')](_0xab79('0x14'),_0x283acc,_0x2c7b3e);_0x5b5009(_0x2c7b3e);});});}exports['GetChatQueue']=function(_0x1f93cb){var _0x2b49e8=this;return new Promise(function(_0x3777aa,_0x402c21){return db[_0xab79('0x1b')]['findAll']({'raw':_0x1f93cb[_0xab79('0x1c')]?_0x1f93cb['options'][_0xab79('0x1d')]===undefined?!![]:![]:!![],'where':_0x1f93cb[_0xab79('0x1c')]?_0x1f93cb[_0xab79('0x1c')][_0xab79('0x1e')]||null:null,'attributes':_0x1f93cb[_0xab79('0x1c')]?_0x1f93cb[_0xab79('0x1c')][_0xab79('0x1f')]||null:null,'limit':_0x1f93cb[_0xab79('0x1c')]?_0x1f93cb[_0xab79('0x1c')][_0xab79('0x20')]||null:null,'include':_0x1f93cb[_0xab79('0x1c')]?_0x1f93cb['options'][_0xab79('0x21')]?_[_0xab79('0x22')](_0x1f93cb[_0xab79('0x1c')][_0xab79('0x21')],function(_0x10b007){return{'model':db[_0x10b007[_0xab79('0x23')]],'as':_0x10b007['as'],'attributes':_0x10b007[_0xab79('0x1f')],'include':_0x10b007[_0xab79('0x21')]?_['map'](_0x10b007[_0xab79('0x21')],function(_0x260898){return{'model':db[_0x260898[_0xab79('0x23')]],'as':_0x260898['as'],'attributes':_0x260898['attributes'],'include':_0x260898['include']?_[_0xab79('0x22')](_0x260898[_0xab79('0x21')],function(_0x5f10ef){return{'model':db[_0x5f10ef[_0xab79('0x23')]],'as':_0x5f10ef['as'],'attributes':_0x5f10ef[_0xab79('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xab79('0x12')](function(_0x5049ce){logger['info'](_0xab79('0x24'),_0x1f93cb);logger[_0xab79('0x25')]('GetChatQueue',_0x1f93cb,JSON[_0xab79('0x26')](_0x5049ce));_0x3777aa(_0x5049ce);})['catch'](function(_0x3f8e22){logger[_0xab79('0x16')]('GetChatQueue',_0x3f8e22[_0xab79('0x18')],_0x1f93cb);_0x402c21(_0x2b49e8[_0xab79('0x16')](0x1f4,_0x3f8e22[_0xab79('0x18')]));});});};exports[_0xab79('0x27')]=function(_0x1bf844){var _0x5abac9=this;return new Promise(function(_0x3fac9b,_0x5dd893){return db[_0xab79('0x1b')]['find']({'raw':_0x1bf844[_0xab79('0x1c')]?_0x1bf844['options'][_0xab79('0x1d')]===undefined?!![]:![]:!![],'where':_0x1bf844[_0xab79('0x1c')]?_0x1bf844[_0xab79('0x1c')][_0xab79('0x1e')]||null:null,'attributes':_0x1bf844[_0xab79('0x1c')]?_0x1bf844['options'][_0xab79('0x1f')]||null:null,'include':_0x1bf844[_0xab79('0x1c')]?_0x1bf844['options'][_0xab79('0x21')]?_['map'](_0x1bf844[_0xab79('0x1c')]['include'],function(_0x3d9fa9){return{'model':db[_0x3d9fa9[_0xab79('0x23')]],'as':_0x3d9fa9['as'],'attributes':_0x3d9fa9[_0xab79('0x1f')],'include':_0x3d9fa9[_0xab79('0x21')]?_[_0xab79('0x22')](_0x3d9fa9['include'],function(_0x5e6fa4){return{'model':db[_0x5e6fa4['model']],'as':_0x5e6fa4['as'],'attributes':_0x5e6fa4['attributes'],'include':_0x5e6fa4[_0xab79('0x21')]?_[_0xab79('0x22')](_0x5e6fa4['include'],function(_0xe4246){return{'model':db[_0xe4246['model']],'as':_0xe4246['as'],'attributes':_0xe4246[_0xab79('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xab79('0x12')](function(_0x395b0a){logger[_0xab79('0x13')](_0xab79('0x27'),_0x1bf844);logger[_0xab79('0x25')](_0xab79('0x27'),_0x1bf844,JSON[_0xab79('0x26')](_0x395b0a));_0x3fac9b(_0x395b0a);})[_0xab79('0x1a')](function(_0x161a55){logger[_0xab79('0x16')]('ShowChatQueue',_0x161a55[_0xab79('0x18')],_0x1bf844);_0x5dd893(_0x5abac9['error'](0x1f4,_0x161a55['message']));});});}; \ No newline at end of file +var _0x64e6=['code','error','message','result','catch','GetChatQueue','options','raw','where','attributes','limit','include','map','find','model','ShowChatQueue','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x5a2f3a,_0x4de4f2){var _0xa430f=function(_0x385508){while(--_0x385508){_0x5a2f3a['push'](_0x5a2f3a['shift']());}};_0xa430f(++_0x4de4f2);}(_0x64e6,0x1b2));var _0x664e=function(_0x1bf6f6,_0x4b0bcd){_0x1bf6f6=_0x1bf6f6-0x0;var _0x87373e=_0x64e6[_0x1bf6f6];return _0x87373e;};'use strict';var _=require(_0x664e('0x0'));var util=require('util');var moment=require(_0x664e('0x1'));var BPromise=require(_0x664e('0x2'));var rs=require(_0x664e('0x3'));var fs=require('fs');var Redis=require(_0x664e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x664e('0x5'))('rpc');var config=require(_0x664e('0x6'));var jayson=require(_0x664e('0x7'));var client=jayson['client'][_0x664e('0x8')]({'port':0x232a});config[_0x664e('0x9')]=_[_0x664e('0xa')](config['redis'],{'host':_0x664e('0xb'),'port':0x18eb});var socket=require(_0x664e('0xc'))(new Redis(config[_0x664e('0x9')]));require(_0x664e('0xd'))[_0x664e('0xe')](socket);function respondWithRpcPromise(_0x2bc4cc,_0x5544aa,_0x294c98){return new BPromise(function(_0x2ded79,_0x245170){return client[_0x664e('0xf')](_0x2bc4cc,_0x294c98)[_0x664e('0x10')](function(_0x50b700){logger[_0x664e('0x11')](_0x664e('0x12'),_0x5544aa,'request\x20sent');logger[_0x664e('0x13')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x5544aa,_0x664e('0x14'),JSON[_0x664e('0x15')](_0x50b700));if(_0x50b700['error']){if(_0x50b700['error'][_0x664e('0x16')]===0x1f4){logger[_0x664e('0x17')]('ChatQueue,\x20%s,\x20%s',_0x5544aa,_0x50b700[_0x664e('0x17')][_0x664e('0x18')]);return _0x245170(_0x50b700[_0x664e('0x17')][_0x664e('0x18')]);}logger[_0x664e('0x17')]('ChatQueue,\x20%s,\x20%s',_0x5544aa,_0x50b700[_0x664e('0x17')]['message']);return _0x2ded79(_0x50b700[_0x664e('0x17')]['message']);}else{logger[_0x664e('0x11')]('ChatQueue,\x20%s,\x20%s',_0x5544aa,_0x664e('0x14'));_0x2ded79(_0x50b700[_0x664e('0x19')]['message']);}})[_0x664e('0x1a')](function(_0x39e9f0){logger[_0x664e('0x17')]('ChatQueue,\x20%s,\x20%s',_0x5544aa,_0x39e9f0);_0x245170(_0x39e9f0);});});}exports[_0x664e('0x1b')]=function(_0x49b444){var _0x1cf289=this;return new Promise(function(_0x896c86,_0x3b5c0a){return db['ChatQueue']['findAll']({'raw':_0x49b444[_0x664e('0x1c')]?_0x49b444['options'][_0x664e('0x1d')]===undefined?!![]:![]:!![],'where':_0x49b444[_0x664e('0x1c')]?_0x49b444[_0x664e('0x1c')][_0x664e('0x1e')]||null:null,'attributes':_0x49b444[_0x664e('0x1c')]?_0x49b444['options'][_0x664e('0x1f')]||null:null,'limit':_0x49b444[_0x664e('0x1c')]?_0x49b444[_0x664e('0x1c')][_0x664e('0x20')]||null:null,'include':_0x49b444[_0x664e('0x1c')]?_0x49b444['options'][_0x664e('0x21')]?_[_0x664e('0x22')](_0x49b444[_0x664e('0x1c')][_0x664e('0x21')],function(_0x7e3679){return{'model':db[_0x7e3679['model']],'as':_0x7e3679['as'],'attributes':_0x7e3679[_0x664e('0x1f')],'include':_0x7e3679[_0x664e('0x21')]?_['map'](_0x7e3679[_0x664e('0x21')],function(_0x28980d){return{'model':db[_0x28980d['model']],'as':_0x28980d['as'],'attributes':_0x28980d[_0x664e('0x1f')],'include':_0x28980d[_0x664e('0x21')]?_[_0x664e('0x22')](_0x28980d['include'],function(_0x35220f){return{'model':db[_0x35220f['model']],'as':_0x35220f['as'],'attributes':_0x35220f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x27ef96){logger[_0x664e('0x11')](_0x664e('0x1b'),_0x49b444);logger[_0x664e('0x13')](_0x664e('0x1b'),_0x49b444,JSON[_0x664e('0x15')](_0x27ef96));_0x896c86(_0x27ef96);})[_0x664e('0x1a')](function(_0x4d9612){logger['error'](_0x664e('0x1b'),_0x4d9612[_0x664e('0x18')],_0x49b444);_0x3b5c0a(_0x1cf289[_0x664e('0x17')](0x1f4,_0x4d9612[_0x664e('0x18')]));});});};exports['ShowChatQueue']=function(_0x32f8c8){var _0x22b618=this;return new Promise(function(_0x2904f8,_0x14b02b){return db['ChatQueue'][_0x664e('0x23')]({'raw':_0x32f8c8[_0x664e('0x1c')]?_0x32f8c8[_0x664e('0x1c')][_0x664e('0x1d')]===undefined?!![]:![]:!![],'where':_0x32f8c8[_0x664e('0x1c')]?_0x32f8c8[_0x664e('0x1c')][_0x664e('0x1e')]||null:null,'attributes':_0x32f8c8['options']?_0x32f8c8[_0x664e('0x1c')][_0x664e('0x1f')]||null:null,'include':_0x32f8c8[_0x664e('0x1c')]?_0x32f8c8['options'][_0x664e('0x21')]?_[_0x664e('0x22')](_0x32f8c8['options'][_0x664e('0x21')],function(_0x435c71){return{'model':db[_0x435c71['model']],'as':_0x435c71['as'],'attributes':_0x435c71[_0x664e('0x1f')],'include':_0x435c71[_0x664e('0x21')]?_['map'](_0x435c71[_0x664e('0x21')],function(_0x2e8c29){return{'model':db[_0x2e8c29['model']],'as':_0x2e8c29['as'],'attributes':_0x2e8c29['attributes'],'include':_0x2e8c29[_0x664e('0x21')]?_[_0x664e('0x22')](_0x2e8c29[_0x664e('0x21')],function(_0x6e5f91){return{'model':db[_0x6e5f91[_0x664e('0x24')]],'as':_0x6e5f91['as'],'attributes':_0x6e5f91['attributes']};}):[]};}):[]};}):[]:[]})[_0x664e('0x10')](function(_0x1f71f0){logger[_0x664e('0x11')](_0x664e('0x25'),_0x32f8c8);logger[_0x664e('0x13')](_0x664e('0x25'),_0x32f8c8,JSON[_0x664e('0x15')](_0x1f71f0));_0x2904f8(_0x1f71f0);})[_0x664e('0x1a')](function(_0x5af41c){logger[_0x664e('0x17')](_0x664e('0x25'),_0x5af41c[_0x664e('0x18')],_0x32f8c8);_0x14b02b(_0x22b618['error'](0x1f4,_0x5af41c['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 1796aea..03cf5fb 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 _0x2d17=['update','emit','register','chatQueue:','./chatQueue.events','save'];(function(_0x13145c,_0x5e59ec){var _0x2c4513=function(_0x910b82){while(--_0x910b82){_0x13145c['push'](_0x13145c['shift']());}};_0x2c4513(++_0x5e59ec);}(_0x2d17,0x17e));var _0x72d1=function(_0x321cfb,_0x1de787){_0x321cfb=_0x321cfb-0x0;var _0xfcddaa=_0x2d17[_0x321cfb];return _0xfcddaa;};'use strict';var ChatQueueEvents=require(_0x72d1('0x0'));var events=[_0x72d1('0x1'),'remove',_0x72d1('0x2')];function createListener(_0x4727f9,_0x531f4e){return function(_0x3687bc){_0x531f4e[_0x72d1('0x3')](_0x4727f9,_0x3687bc);};}function removeListener(_0x55b722,_0x1dd6d8){return function(){ChatQueueEvents['removeListener'](_0x55b722,_0x1dd6d8);};}exports[_0x72d1('0x4')]=function(_0x50f551){for(var _0x139ba0=0x0,_0x239d1f=events['length'];_0x139ba0<_0x239d1f;_0x139ba0++){var _0x477264=events[_0x139ba0];var _0x422f5a=createListener(_0x72d1('0x5')+_0x477264,_0x50f551);ChatQueueEvents['on'](_0x477264,_0x422f5a);}}; \ No newline at end of file +var _0x3140=['removeListener','register','length','chatQueue:','./chatQueue.events','save','remove','update','emit'];(function(_0x5c1dd7,_0x4b8b8c){var _0x60ca25=function(_0x240f8b){while(--_0x240f8b){_0x5c1dd7['push'](_0x5c1dd7['shift']());}};_0x60ca25(++_0x4b8b8c);}(_0x3140,0xaf));var _0x0314=function(_0x1bc42d,_0x1b8a92){_0x1bc42d=_0x1bc42d-0x0;var _0x2a4351=_0x3140[_0x1bc42d];return _0x2a4351;};'use strict';var ChatQueueEvents=require(_0x0314('0x0'));var events=[_0x0314('0x1'),_0x0314('0x2'),_0x0314('0x3')];function createListener(_0x4ac557,_0x4cf353){return function(_0x285be5){_0x4cf353[_0x0314('0x4')](_0x4ac557,_0x285be5);};}function removeListener(_0x1c0f66,_0x3e4284){return function(){ChatQueueEvents[_0x0314('0x5')](_0x1c0f66,_0x3e4284);};}exports[_0x0314('0x6')]=function(_0x9e308d){for(var _0xf87d26=0x0,_0x11ee94=events[_0x0314('0x7')];_0xf87d26<_0x11ee94;_0xf87d26++){var _0x176944=events[_0xf87d26];var _0x495b27=createListener(_0x0314('0x8')+_0x176944,_0x9e308d);ChatQueueEvents['on'](_0x176944,_0x495b27);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index f2a209b..2cf9d24 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 _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x5f0081,_0x1a991e){var _0x8c153f=function(_0xa28801){while(--_0xa28801){_0x5f0081['push'](_0x5f0081['shift']());}};_0x8c153f(++_0x1a991e);}(_0x7217,0x19e));var _0x7721=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x7217[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file +var _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x5fc3,0xa8));var _0x35fc=function(_0x49ad79,_0x48ee93){_0x49ad79=_0x49ad79-0x0;var _0xa4e38a=_0x5fc3[_0x49ad79];return _0xa4e38a;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index c79a3b3..3cd1cff 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 _0x8d19=['sequelize','exports','STRING','DATE','moment'];(function(_0x275043,_0x39887e){var _0x52f9dd=function(_0x1a3b0d){while(--_0x1a3b0d){_0x275043['push'](_0x275043['shift']());}};_0x52f9dd(++_0x39887e);}(_0x8d19,0xd1));var _0x98d1=function(_0x592d48,_0x23f1ba){_0x592d48=_0x592d48-0x0;var _0x5d789e=_0x8d19[_0x592d48];return _0x5d789e;};'use strict';var moment=require(_0x98d1('0x0'));var Sequelize=require(_0x98d1('0x1'));module[_0x98d1('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x98d1('0x3')]},'joinAt':{'type':Sequelize[_0x98d1('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x98d1('0x4')]},'exitAt':{'type':Sequelize[_0x98d1('0x4')]},'reason':{'type':Sequelize[_0x98d1('0x3')]}}; \ No newline at end of file +var _0x196e=['sequelize','exports','STRING','DATE','moment'];(function(_0x34c7dd,_0x3d6c2c){var _0x25ac9d=function(_0x4869ff){while(--_0x4869ff){_0x34c7dd['push'](_0x34c7dd['shift']());}};_0x25ac9d(++_0x3d6c2c);}(_0x196e,0xcc));var _0xe196=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0x196e[_0x519756];return _0x37047e;};'use strict';var moment=require(_0xe196('0x0'));var Sequelize=require(_0xe196('0x1'));module[_0xe196('0x2')]={'uniqueid':{'type':Sequelize[_0xe196('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xe196('0x3')]},'joinAt':{'type':Sequelize[_0xe196('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xe196('0x4')]},'exitAt':{'type':Sequelize[_0xe196('0x4')]},'reason':{'type':Sequelize[_0xe196('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 613c131..a8457b4 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 _0xde81=['reject','save','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','ChatQueueReport','includeAll','include','findAll','rows','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply'];(function(_0x192036,_0x5f3e56){var _0x4113d8=function(_0x45056a){while(--_0x45056a){_0x192036['push'](_0x192036['shift']());}};_0x4113d8(++_0x5f3e56);}(_0xde81,0x109));var _0x1de8=function(_0x213947,_0x13d60d){_0x213947=_0x213947-0x0;var _0x4f70d8=_0xde81[_0x213947];return _0x4f70d8;};'use strict';var emlformat=require(_0x1de8('0x0'));var rimraf=require(_0x1de8('0x1'));var zipdir=require(_0x1de8('0x2'));var jsonpatch=require(_0x1de8('0x3'));var rp=require(_0x1de8('0x4'));var moment=require(_0x1de8('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1de8('0x6'));var path=require('path');var sox=require(_0x1de8('0x7'));var csv=require(_0x1de8('0x8'));var ejs=require(_0x1de8('0x9'));var fs=require('fs');var fs_extra=require(_0x1de8('0xa'));var _=require(_0x1de8('0xb'));var squel=require(_0x1de8('0xc'));var crypto=require(_0x1de8('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1de8('0x8'));var querystring=require('querystring');var Papa=require(_0x1de8('0xe'));var Redis=require(_0x1de8('0xf'));var authService=require(_0x1de8('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1de8('0x11'));var hardwareService=require(_0x1de8('0x12'));var logger=require(_0x1de8('0x13'))(_0x1de8('0x14'));var utils=require(_0x1de8('0x15'));var config=require(_0x1de8('0x16'));var licenseUtil=require(_0x1de8('0x17'));var db=require(_0x1de8('0x18'))['db'];function respondWithStatusCode(_0x17096a,_0x430fcf){_0x430fcf=_0x430fcf||0xcc;return function(_0x56126e){if(_0x56126e){return _0x17096a[_0x1de8('0x19')](_0x430fcf);}return _0x17096a['status'](_0x430fcf)[_0x1de8('0x1a')]();};}function respondWithResult(_0x2cf750,_0x4d0ed6){_0x4d0ed6=_0x4d0ed6||0xc8;return function(_0x547627){if(_0x547627){return _0x2cf750[_0x1de8('0x1b')](_0x4d0ed6)[_0x1de8('0x1c')](_0x547627);}};}function respondWithFilteredResult(_0x17f089,_0x1b6ca1){return function(_0x578dbc){if(_0x578dbc){var _0x297130=typeof _0x1b6ca1[_0x1de8('0x1d')]===_0x1de8('0x1e')&&typeof _0x1b6ca1['limit']===_0x1de8('0x1e');var _0x197595=_0x578dbc['count'];var _0x322b64=_0x297130?0x0:_0x1b6ca1['offset'];var _0x4b166c=_0x297130?_0x578dbc[_0x1de8('0x1f')]:_0x1b6ca1['offset']+_0x1b6ca1[_0x1de8('0x20')];var _0x475c40;if(_0x4b166c>=_0x197595){_0x4b166c=_0x197595;_0x475c40=0xc8;}else{_0x475c40=0xce;}_0x17f089[_0x1de8('0x1b')](_0x475c40);return _0x17f089['set'](_0x1de8('0x21'),_0x322b64+'-'+_0x4b166c+'/'+_0x197595)[_0x1de8('0x1c')](_0x578dbc);}return null;};}function patchUpdates(_0xdf5e83){return function(_0x1e0dcf){try{jsonpatch[_0x1de8('0x22')](_0x1e0dcf,_0xdf5e83,!![]);}catch(_0x307426){return BPromise[_0x1de8('0x23')](_0x307426);}return _0x1e0dcf[_0x1de8('0x24')]();};}function saveUpdates(_0x4af449,_0x9d0996){return function(_0x441fcd){if(_0x441fcd){return _0x441fcd[_0x1de8('0x25')](_0x4af449)[_0x1de8('0x26')](function(_0x19f6fd){return _0x19f6fd;});}return null;};}function removeEntity(_0x240e87,_0x116942){return function(_0x4ee74f){if(_0x4ee74f){return _0x4ee74f[_0x1de8('0x27')]()['then'](function(){_0x240e87['status'](0xcc)[_0x1de8('0x1a')]();});}};}function handleEntityNotFound(_0x4600c7,_0x1a4f2f){return function(_0x1fa81a){if(!_0x1fa81a){_0x4600c7[_0x1de8('0x19')](0x194);}return _0x1fa81a;};}function handleError(_0x138dc7,_0x37cd96){_0x37cd96=_0x37cd96||0x1f4;return function(_0x49f8a6){logger[_0x1de8('0x28')](_0x49f8a6[_0x1de8('0x29')]);if(_0x49f8a6[_0x1de8('0x2a')]){delete _0x49f8a6[_0x1de8('0x2a')];}_0x138dc7[_0x1de8('0x1b')](_0x37cd96)['send'](_0x49f8a6);};}exports['index']=function(_0x9fcd44,_0x10fdf3){var _0x4229f8={},_0x2bd4b7={},_0x5aee91={'count':0x0,'rows':[]};var _0x402467=_[_0x1de8('0x2b')](db['ChatQueueReport'][_0x1de8('0x2c')],function(_0x30cb0c){return{'name':_0x30cb0c[_0x1de8('0x2d')],'type':_0x30cb0c[_0x1de8('0x2e')][_0x1de8('0x2f')]};});_0x2bd4b7[_0x1de8('0x30')]=_[_0x1de8('0x2b')](_0x402467,_0x1de8('0x2a'));_0x2bd4b7[_0x1de8('0x31')]=_[_0x1de8('0x32')](_0x9fcd44[_0x1de8('0x31')]);_0x2bd4b7[_0x1de8('0x33')]=_[_0x1de8('0x34')](_0x2bd4b7[_0x1de8('0x30')],_0x2bd4b7[_0x1de8('0x31')]);_0x4229f8['attributes']=_[_0x1de8('0x34')](_0x2bd4b7[_0x1de8('0x30')],qs[_0x1de8('0x35')](_0x9fcd44[_0x1de8('0x31')][_0x1de8('0x35')]));_0x4229f8[_0x1de8('0x36')]=_0x4229f8['attributes']['length']?_0x4229f8[_0x1de8('0x36')]:_0x2bd4b7[_0x1de8('0x30')];if(!_0x9fcd44[_0x1de8('0x31')][_0x1de8('0x37')](_0x1de8('0x38'))){_0x4229f8['limit']=qs[_0x1de8('0x20')](_0x9fcd44['query'][_0x1de8('0x20')]);_0x4229f8[_0x1de8('0x1d')]=qs[_0x1de8('0x1d')](_0x9fcd44['query']['offset']);}_0x4229f8[_0x1de8('0x39')]=qs[_0x1de8('0x3a')](_0x9fcd44[_0x1de8('0x31')]['sort']);_0x4229f8['where']=qs[_0x1de8('0x33')](_[_0x1de8('0x3b')](_0x9fcd44[_0x1de8('0x31')],_0x2bd4b7[_0x1de8('0x33')]),_0x402467);if(_0x9fcd44['query'][_0x1de8('0x3c')]){_0x4229f8[_0x1de8('0x3d')]=_[_0x1de8('0x3e')](_0x4229f8[_0x1de8('0x3d')],{'$or':_[_0x1de8('0x2b')](_0x402467,function(_0x32cf97){if(_0x32cf97[_0x1de8('0x2e')]!=='VIRTUAL'){var _0x17e7df={};_0x17e7df[_0x32cf97['name']]={'$like':'%'+_0x9fcd44['query'][_0x1de8('0x3c')]+'%'};return _0x17e7df;}})});}_0x4229f8=_[_0x1de8('0x3e')]({},_0x4229f8,_0x9fcd44[_0x1de8('0x3f')]);var _0x319034={'where':_0x4229f8['where']};return db[_0x1de8('0x40')]['count'](_0x319034)[_0x1de8('0x26')](function(_0x12cf7b){_0x5aee91[_0x1de8('0x1f')]=_0x12cf7b;if(_0x9fcd44[_0x1de8('0x31')][_0x1de8('0x41')]){_0x4229f8[_0x1de8('0x42')]=[{'all':!![]}];}return db[_0x1de8('0x40')][_0x1de8('0x43')](_0x4229f8);})['then'](function(_0x5bba82){_0x5aee91[_0x1de8('0x44')]=_0x5bba82;return _0x5aee91;})['then'](respondWithFilteredResult(_0x10fdf3,_0x4229f8))[_0x1de8('0x45')](handleError(_0x10fdf3,null));};exports['show']=function(_0x3b49eb,_0x5f4232){var _0x3adacd={'raw':!![],'where':{'id':_0x3b49eb['params']['id']}},_0x364a13={};_0x364a13['model']=_[_0x1de8('0x32')](db[_0x1de8('0x40')][_0x1de8('0x2c')]);_0x364a13[_0x1de8('0x31')]=_[_0x1de8('0x32')](_0x3b49eb[_0x1de8('0x31')]);_0x364a13[_0x1de8('0x33')]=_[_0x1de8('0x34')](_0x364a13['model'],_0x364a13[_0x1de8('0x31')]);_0x3adacd['attributes']=_[_0x1de8('0x34')](_0x364a13[_0x1de8('0x30')],qs[_0x1de8('0x35')](_0x3b49eb['query'][_0x1de8('0x35')]));_0x3adacd[_0x1de8('0x36')]=_0x3adacd[_0x1de8('0x36')]['length']?_0x3adacd['attributes']:_0x364a13[_0x1de8('0x30')];if(_0x3b49eb[_0x1de8('0x31')][_0x1de8('0x41')]){_0x3adacd[_0x1de8('0x42')]=[{'all':!![]}];}_0x3adacd=_[_0x1de8('0x3e')]({},_0x3adacd,_0x3b49eb[_0x1de8('0x3f')]);return db['ChatQueueReport']['find'](_0x3adacd)[_0x1de8('0x26')](handleEntityNotFound(_0x5f4232,null))['then'](respondWithResult(_0x5f4232,null))['catch'](handleError(_0x5f4232,null));};exports[_0x1de8('0x46')]=function(_0x14855b,_0xa4de0e){return db['ChatQueueReport'][_0x1de8('0x46')](_0x14855b[_0x1de8('0x47')],{})[_0x1de8('0x26')](respondWithResult(_0xa4de0e,0xc9))['catch'](handleError(_0xa4de0e,null));};exports[_0x1de8('0x25')]=function(_0x3ce31e,_0x5e5357){if(_0x3ce31e['body']['id']){delete _0x3ce31e[_0x1de8('0x47')]['id'];}return db['ChatQueueReport'][_0x1de8('0x48')]({'where':{'id':_0x3ce31e['params']['id']}})[_0x1de8('0x26')](handleEntityNotFound(_0x5e5357,null))['then'](saveUpdates(_0x3ce31e['body'],null))['then'](respondWithResult(_0x5e5357,null))['catch'](handleError(_0x5e5357,null));};exports[_0x1de8('0x27')]=function(_0x3840b7,_0x299d74){return db['ChatQueueReport'][_0x1de8('0x48')]({'where':{'id':_0x3840b7[_0x1de8('0x49')]['id']}})[_0x1de8('0x26')](handleEntityNotFound(_0x299d74,null))[_0x1de8('0x26')](removeEntity(_0x299d74,null))[_0x1de8('0x45')](handleError(_0x299d74,null));};exports[_0x1de8('0x4a')]=function(_0x13ba26,_0x482cb2){return db[_0x1de8('0x40')][_0x1de8('0x4a')]()[_0x1de8('0x26')](respondWithResult(_0x482cb2,null))[_0x1de8('0x45')](handleError(_0x482cb2,null));}; \ No newline at end of file +var _0x36fe=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','then','destroy','error','stack','name','index','ChatQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','includeAll','include','findAll','catch','params','intersection','fields','create','body','find','describe','eml-format'];(function(_0x49db80,_0x2d69b1){var _0x31dc28=function(_0xc7c4aa){while(--_0xc7c4aa){_0x49db80['push'](_0x49db80['shift']());}};_0x31dc28(++_0x2d69b1);}(_0x36fe,0x127));var _0xe36f=function(_0x5b360e,_0x494136){_0x5b360e=_0x5b360e-0x0;var _0x1bf752=_0x36fe[_0x5b360e];return _0x1bf752;};'use strict';var emlformat=require(_0xe36f('0x0'));var rimraf=require(_0xe36f('0x1'));var zipdir=require(_0xe36f('0x2'));var jsonpatch=require(_0xe36f('0x3'));var rp=require(_0xe36f('0x4'));var moment=require(_0xe36f('0x5'));var BPromise=require(_0xe36f('0x6'));var Mustache=require(_0xe36f('0x7'));var util=require(_0xe36f('0x8'));var path=require(_0xe36f('0x9'));var sox=require(_0xe36f('0xa'));var csv=require('to-csv');var ejs=require(_0xe36f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe36f('0xc'));var squel=require(_0xe36f('0xd'));var crypto=require('crypto');var jsforce=require(_0xe36f('0xe'));var deskjs=require(_0xe36f('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe36f('0x10'));var Papa=require(_0xe36f('0x11'));var Redis=require(_0xe36f('0x12'));var authService=require(_0xe36f('0x13'));var qs=require(_0xe36f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe36f('0x15'));var logger=require('../../config/logger')(_0xe36f('0x16'));var utils=require(_0xe36f('0x17'));var config=require(_0xe36f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe36f('0x19'))['db'];function respondWithStatusCode(_0x3caacb,_0x564d1e){_0x564d1e=_0x564d1e||0xcc;return function(_0x1bd5c2){if(_0x1bd5c2){return _0x3caacb[_0xe36f('0x1a')](_0x564d1e);}return _0x3caacb[_0xe36f('0x1b')](_0x564d1e)[_0xe36f('0x1c')]();};}function respondWithResult(_0x5f2407,_0x95f267){_0x95f267=_0x95f267||0xc8;return function(_0x8acac3){if(_0x8acac3){return _0x5f2407[_0xe36f('0x1b')](_0x95f267)['json'](_0x8acac3);}};}function respondWithFilteredResult(_0x2fcef3,_0x3ffb15){return function(_0x511de8){if(_0x511de8){var _0x1834a3=typeof _0x3ffb15[_0xe36f('0x1d')]===_0xe36f('0x1e')&&typeof _0x3ffb15[_0xe36f('0x1f')]===_0xe36f('0x1e');var _0x146efd=_0x511de8['count'];var _0x4d9df2=_0x1834a3?0x0:_0x3ffb15['offset'];var _0x5aed4f=_0x1834a3?_0x511de8[_0xe36f('0x20')]:_0x3ffb15[_0xe36f('0x1d')]+_0x3ffb15[_0xe36f('0x1f')];var _0x464164;if(_0x5aed4f>=_0x146efd){_0x5aed4f=_0x146efd;_0x464164=0xc8;}else{_0x464164=0xce;}_0x2fcef3['status'](_0x464164);return _0x2fcef3['set'](_0xe36f('0x21'),_0x4d9df2+'-'+_0x5aed4f+'/'+_0x146efd)[_0xe36f('0x22')](_0x511de8);}return null;};}function patchUpdates(_0x1502bf){return function(_0xb51dbf){try{jsonpatch[_0xe36f('0x23')](_0xb51dbf,_0x1502bf,!![]);}catch(_0x5c09ad){return BPromise[_0xe36f('0x24')](_0x5c09ad);}return _0xb51dbf['save']();};}function saveUpdates(_0x1fda7b,_0x395cc6){return function(_0x2dc212){if(_0x2dc212){return _0x2dc212['update'](_0x1fda7b)[_0xe36f('0x25')](function(_0xd00e9b){return _0xd00e9b;});}return null;};}function removeEntity(_0x5d8e84,_0xfd3899){return function(_0x12a473){if(_0x12a473){return _0x12a473[_0xe36f('0x26')]()['then'](function(){_0x5d8e84['status'](0xcc)[_0xe36f('0x1c')]();});}};}function handleEntityNotFound(_0x35ef46,_0x5edc48){return function(_0x1bd728){if(!_0x1bd728){_0x35ef46['sendStatus'](0x194);}return _0x1bd728;};}function handleError(_0xd0e82,_0x55f6d6){_0x55f6d6=_0x55f6d6||0x1f4;return function(_0x196183){logger[_0xe36f('0x27')](_0x196183[_0xe36f('0x28')]);if(_0x196183[_0xe36f('0x29')]){delete _0x196183[_0xe36f('0x29')];}_0xd0e82[_0xe36f('0x1b')](_0x55f6d6)['send'](_0x196183);};}exports[_0xe36f('0x2a')]=function(_0x5aa516,_0x13af30){var _0x253deb={},_0x471b91={},_0x1b8451={'count':0x0,'rows':[]};var _0x3296f2=_['map'](db[_0xe36f('0x2b')][_0xe36f('0x2c')],function(_0x1d8e72){return{'name':_0x1d8e72[_0xe36f('0x2d')],'type':_0x1d8e72[_0xe36f('0x2e')][_0xe36f('0x2f')]};});_0x471b91['model']=_['map'](_0x3296f2,_0xe36f('0x29'));_0x471b91[_0xe36f('0x30')]=_[_0xe36f('0x31')](_0x5aa516['query']);_0x471b91[_0xe36f('0x32')]=_['intersection'](_0x471b91[_0xe36f('0x33')],_0x471b91['query']);_0x253deb[_0xe36f('0x34')]=_['intersection'](_0x471b91[_0xe36f('0x33')],qs['fields'](_0x5aa516[_0xe36f('0x30')]['fields']));_0x253deb[_0xe36f('0x34')]=_0x253deb[_0xe36f('0x34')]['length']?_0x253deb[_0xe36f('0x34')]:_0x471b91[_0xe36f('0x33')];if(!_0x5aa516[_0xe36f('0x30')][_0xe36f('0x35')](_0xe36f('0x36'))){_0x253deb['limit']=qs['limit'](_0x5aa516[_0xe36f('0x30')][_0xe36f('0x1f')]);_0x253deb[_0xe36f('0x1d')]=qs['offset'](_0x5aa516[_0xe36f('0x30')]['offset']);}_0x253deb[_0xe36f('0x37')]=qs[_0xe36f('0x38')](_0x5aa516[_0xe36f('0x30')][_0xe36f('0x38')]);_0x253deb['where']=qs['filters'](_[_0xe36f('0x39')](_0x5aa516['query'],_0x471b91[_0xe36f('0x32')]),_0x3296f2);if(_0x5aa516[_0xe36f('0x30')][_0xe36f('0x3a')]){_0x253deb[_0xe36f('0x3b')]=_[_0xe36f('0x3c')](_0x253deb[_0xe36f('0x3b')],{'$or':_[_0xe36f('0x3d')](_0x3296f2,function(_0x5bfa56){if(_0x5bfa56[_0xe36f('0x2e')]!==_0xe36f('0x3e')){var _0x2593cf={};_0x2593cf[_0x5bfa56[_0xe36f('0x29')]]={'$like':'%'+_0x5aa516[_0xe36f('0x30')][_0xe36f('0x3a')]+'%'};return _0x2593cf;}})});}_0x253deb=_[_0xe36f('0x3c')]({},_0x253deb,_0x5aa516['options']);var _0x2e7dbd={'where':_0x253deb[_0xe36f('0x3b')]};return db[_0xe36f('0x2b')]['count'](_0x2e7dbd)[_0xe36f('0x25')](function(_0x573385){_0x1b8451[_0xe36f('0x20')]=_0x573385;if(_0x5aa516['query'][_0xe36f('0x3f')]){_0x253deb[_0xe36f('0x40')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xe36f('0x41')](_0x253deb);})['then'](function(_0x29f5e5){_0x1b8451['rows']=_0x29f5e5;return _0x1b8451;})[_0xe36f('0x25')](respondWithFilteredResult(_0x13af30,_0x253deb))[_0xe36f('0x42')](handleError(_0x13af30,null));};exports['show']=function(_0xd14f0d,_0x40c746){var _0x11e17e={'raw':!![],'where':{'id':_0xd14f0d[_0xe36f('0x43')]['id']}},_0x452314={};_0x452314[_0xe36f('0x33')]=_[_0xe36f('0x31')](db['ChatQueueReport'][_0xe36f('0x2c')]);_0x452314[_0xe36f('0x30')]=_['keys'](_0xd14f0d['query']);_0x452314['filters']=_[_0xe36f('0x44')](_0x452314['model'],_0x452314['query']);_0x11e17e[_0xe36f('0x34')]=_[_0xe36f('0x44')](_0x452314[_0xe36f('0x33')],qs['fields'](_0xd14f0d[_0xe36f('0x30')][_0xe36f('0x45')]));_0x11e17e[_0xe36f('0x34')]=_0x11e17e[_0xe36f('0x34')]['length']?_0x11e17e[_0xe36f('0x34')]:_0x452314[_0xe36f('0x33')];if(_0xd14f0d[_0xe36f('0x30')][_0xe36f('0x3f')]){_0x11e17e[_0xe36f('0x40')]=[{'all':!![]}];}_0x11e17e=_[_0xe36f('0x3c')]({},_0x11e17e,_0xd14f0d['options']);return db[_0xe36f('0x2b')]['find'](_0x11e17e)[_0xe36f('0x25')](handleEntityNotFound(_0x40c746,null))[_0xe36f('0x25')](respondWithResult(_0x40c746,null))[_0xe36f('0x42')](handleError(_0x40c746,null));};exports[_0xe36f('0x46')]=function(_0x4c3a2b,_0x58c3f6){return db[_0xe36f('0x2b')][_0xe36f('0x46')](_0x4c3a2b[_0xe36f('0x47')],{})[_0xe36f('0x25')](respondWithResult(_0x58c3f6,0xc9))[_0xe36f('0x42')](handleError(_0x58c3f6,null));};exports['update']=function(_0x66fa03,_0x4215b8){if(_0x66fa03['body']['id']){delete _0x66fa03[_0xe36f('0x47')]['id'];}return db[_0xe36f('0x2b')][_0xe36f('0x48')]({'where':{'id':_0x66fa03[_0xe36f('0x43')]['id']}})[_0xe36f('0x25')](handleEntityNotFound(_0x4215b8,null))[_0xe36f('0x25')](saveUpdates(_0x66fa03[_0xe36f('0x47')],null))[_0xe36f('0x25')](respondWithResult(_0x4215b8,null))[_0xe36f('0x42')](handleError(_0x4215b8,null));};exports['destroy']=function(_0x324def,_0x4f5f6a){return db['ChatQueueReport']['find']({'where':{'id':_0x324def[_0xe36f('0x43')]['id']}})[_0xe36f('0x25')](handleEntityNotFound(_0x4f5f6a,null))[_0xe36f('0x25')](removeEntity(_0x4f5f6a,null))['catch'](handleError(_0x4f5f6a,null));};exports[_0xe36f('0x49')]=function(_0x4639fb,_0x5745f9){return db[_0xe36f('0x2b')][_0xe36f('0x49')]()[_0xe36f('0x25')](respondWithResult(_0x5745f9,null))['catch'](handleError(_0x5745f9,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 8f26ecc..70f7feb 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 _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x3ed48,_0x2b80d3){var _0x34f11a=function(_0x552e71){while(--_0x552e71){_0x3ed48['push'](_0x3ed48['shift']());}};_0x34f11a(++_0x2b80d3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x5ba704,_0x38a053){var _0x2766fe=function(_0x519d13){while(--_0x519d13){_0x5ba704['push'](_0x5ba704['shift']());}};_0x2766fe(++_0x38a053);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0xb7e7[_0x1b5aea];return _0x15cfc6;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 0faea30..6e1b04a 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 _0x602a=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','update','where','attributes','limit','UpdateChatQueueReport','lodash','moment'];(function(_0x5f746f,_0x5b05ab){var _0x198d15=function(_0x58c7e7){while(--_0x58c7e7){_0x5f746f['push'](_0x5f746f['shift']());}};_0x198d15(++_0x5b05ab);}(_0x602a,0x1de));var _0xa602=function(_0x2a4854,_0x47064c){_0x2a4854=_0x2a4854-0x0;var _0x3023e1=_0x602a[_0x2a4854];return _0x3023e1;};'use strict';var _=require(_0xa602('0x0'));var util=require('util');var moment=require(_0xa602('0x1'));var BPromise=require(_0xa602('0x2'));var rs=require(_0xa602('0x3'));var fs=require('fs');var Redis=require(_0xa602('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa602('0x5'));var logger=require(_0xa602('0x6'))('rpc');var config=require(_0xa602('0x7'));var jayson=require(_0xa602('0x8'));var client=jayson[_0xa602('0x9')][_0xa602('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58d7d5,_0x271f6c,_0x1c4ee9){return new BPromise(function(_0x31bc1b,_0xf9f135){return client[_0xa602('0xb')](_0x58d7d5,_0x1c4ee9)[_0xa602('0xc')](function(_0x4a5c4c){logger[_0xa602('0xd')](_0xa602('0xe'),_0x271f6c,_0xa602('0xf'));logger['debug']('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x271f6c,'request\x20sent',JSON['stringify'](_0x4a5c4c));if(_0x4a5c4c[_0xa602('0x10')]){if(_0x4a5c4c[_0xa602('0x10')][_0xa602('0x11')]===0x1f4){logger[_0xa602('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x271f6c,_0x4a5c4c['error'][_0xa602('0x12')]);return _0xf9f135(_0x4a5c4c[_0xa602('0x10')][_0xa602('0x12')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x271f6c,_0x4a5c4c[_0xa602('0x10')][_0xa602('0x12')]);return _0x31bc1b(_0x4a5c4c[_0xa602('0x10')][_0xa602('0x12')]);}else{logger[_0xa602('0xd')](_0xa602('0xe'),_0x271f6c,_0xa602('0xf'));_0x31bc1b(_0x4a5c4c[_0xa602('0x13')][_0xa602('0x12')]);}})[_0xa602('0x14')](function(_0x8c5875){logger[_0xa602('0x10')](_0xa602('0xe'),_0x271f6c,_0x8c5875);_0xf9f135(_0x8c5875);});});}exports[_0xa602('0x15')]=function(_0x2b5c7e){var _0x52b277=this;return new Promise(function(_0x25bb91,_0xe80510){return db[_0xa602('0x16')][_0xa602('0x17')](_0x2b5c7e[_0xa602('0x18')],{'raw':_0x2b5c7e[_0xa602('0x19')]?_0x2b5c7e[_0xa602('0x19')][_0xa602('0x1a')]===undefined?!![]:![]:!![]})[_0xa602('0xc')](function(_0x5b3ad9){logger[_0xa602('0xd')](_0xa602('0x15'),_0x2b5c7e);logger['debug']('CreateChatQueueReport',_0x2b5c7e,JSON['stringify'](_0x5b3ad9));_0x25bb91(_0x5b3ad9);})[_0xa602('0x14')](function(_0x341dfe){logger[_0xa602('0x10')](_0xa602('0x15'),_0x341dfe[_0xa602('0x12')],_0x2b5c7e);_0xe80510(_0x52b277[_0xa602('0x10')](0x1f4,_0x341dfe[_0xa602('0x12')]));});});};exports['UpdateChatQueueReport']=function(_0x5927c2){var _0x3a9da1=this;return new Promise(function(_0x161751,_0x4f7859){return db[_0xa602('0x16')][_0xa602('0x1b')](_0x5927c2[_0xa602('0x18')],{'raw':_0x5927c2[_0xa602('0x19')]?_0x5927c2[_0xa602('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5927c2['options']?_0x5927c2[_0xa602('0x19')][_0xa602('0x1c')]||null:null,'attributes':_0x5927c2['options']?_0x5927c2[_0xa602('0x19')][_0xa602('0x1d')]||null:null,'limit':_0x5927c2[_0xa602('0x19')]?_0x5927c2[_0xa602('0x19')][_0xa602('0x1e')]||null:null})[_0xa602('0xc')](function(_0x38cf21){logger[_0xa602('0xd')](_0xa602('0x1f'),_0x5927c2);logger['debug']('UpdateChatQueueReport',_0x5927c2,JSON['stringify'](_0x38cf21));_0x161751(_0x38cf21);})[_0xa602('0x14')](function(_0x3997e5){logger['error'](_0xa602('0x1f'),_0x3997e5[_0xa602('0x12')],_0x5927c2);_0x4f7859(_0x3a9da1['error'](0x1f4,_0x3997e5[_0xa602('0x12')]));});});}; \ No newline at end of file +var _0x1a83=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','debug','stringify','update','body','where','attributes','UpdateChatQueueReport'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x1a83,0x1c0));var _0x31a8=function(_0x4275a8,_0x1646e3){_0x4275a8=_0x4275a8-0x0;var _0x2845ce=_0x1a83[_0x4275a8];return _0x2845ce;};'use strict';var _=require(_0x31a8('0x0'));var util=require(_0x31a8('0x1'));var moment=require(_0x31a8('0x2'));var BPromise=require('bluebird');var rs=require(_0x31a8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31a8('0x4'))['db'];var utils=require(_0x31a8('0x5'));var logger=require(_0x31a8('0x6'))(_0x31a8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x31a8('0x8')][_0x31a8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2bf3c7,_0x2c4b45,_0x471ae1){return new BPromise(function(_0x21f054,_0x1159a9){return client[_0x31a8('0xa')](_0x2bf3c7,_0x471ae1)[_0x31a8('0xb')](function(_0x2d4e94){logger['info'](_0x31a8('0xc'),_0x2c4b45,'request\x20sent');logger['debug'](_0x31a8('0xd'),_0x2c4b45,_0x31a8('0xe'),JSON['stringify'](_0x2d4e94));if(_0x2d4e94[_0x31a8('0xf')]){if(_0x2d4e94[_0x31a8('0xf')][_0x31a8('0x10')]===0x1f4){logger[_0x31a8('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x2c4b45,_0x2d4e94['error'][_0x31a8('0x11')]);return _0x1159a9(_0x2d4e94['error'][_0x31a8('0x11')]);}logger['error'](_0x31a8('0xc'),_0x2c4b45,_0x2d4e94[_0x31a8('0xf')][_0x31a8('0x11')]);return _0x21f054(_0x2d4e94['error'][_0x31a8('0x11')]);}else{logger[_0x31a8('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x2c4b45,_0x31a8('0xe'));_0x21f054(_0x2d4e94['result'][_0x31a8('0x11')]);}})[_0x31a8('0x13')](function(_0x507797){logger[_0x31a8('0xf')](_0x31a8('0xc'),_0x2c4b45,_0x507797);_0x1159a9(_0x507797);});});}exports[_0x31a8('0x14')]=function(_0xf7da4b){var _0x2c6561=this;return new Promise(function(_0x39105b,_0x4f0b8c){return db[_0x31a8('0x15')][_0x31a8('0x16')](_0xf7da4b['body'],{'raw':_0xf7da4b[_0x31a8('0x17')]?_0xf7da4b[_0x31a8('0x17')][_0x31a8('0x18')]===undefined?!![]:![]:!![]})[_0x31a8('0xb')](function(_0x552af8){logger[_0x31a8('0x12')](_0x31a8('0x14'),_0xf7da4b);logger[_0x31a8('0x19')](_0x31a8('0x14'),_0xf7da4b,JSON[_0x31a8('0x1a')](_0x552af8));_0x39105b(_0x552af8);})[_0x31a8('0x13')](function(_0x245e01){logger[_0x31a8('0xf')](_0x31a8('0x14'),_0x245e01['message'],_0xf7da4b);_0x4f0b8c(_0x2c6561['error'](0x1f4,_0x245e01[_0x31a8('0x11')]));});});};exports['UpdateChatQueueReport']=function(_0x20ef8c){var _0x497c0d=this;return new Promise(function(_0x3d641c,_0x4eaafd){return db[_0x31a8('0x15')][_0x31a8('0x1b')](_0x20ef8c[_0x31a8('0x1c')],{'raw':_0x20ef8c[_0x31a8('0x17')]?_0x20ef8c[_0x31a8('0x17')][_0x31a8('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20ef8c[_0x31a8('0x17')]?_0x20ef8c['options'][_0x31a8('0x1d')]||null:null,'attributes':_0x20ef8c['options']?_0x20ef8c[_0x31a8('0x17')][_0x31a8('0x1e')]||null:null,'limit':_0x20ef8c[_0x31a8('0x17')]?_0x20ef8c[_0x31a8('0x17')]['limit']||null:null})['then'](function(_0x5334a5){logger['info'](_0x31a8('0x1f'),_0x20ef8c);logger[_0x31a8('0x19')](_0x31a8('0x1f'),_0x20ef8c,JSON[_0x31a8('0x1a')](_0x5334a5));_0x3d641c(_0x5334a5);})[_0x31a8('0x13')](function(_0x47f9f9){logger[_0x31a8('0xf')]('UpdateChatQueueReport',_0x47f9f9['message'],_0x20ef8c);_0x4eaafd(_0x497c0d[_0x31a8('0xf')](0x1f4,_0x47f9f9[_0x31a8('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 50a93de..24dfeac 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 _0xf2a8=['../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','index','get','/describe','describe','show','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x28fcb6,_0x4108d5){var _0x402847=function(_0x149287){while(--_0x149287){_0x28fcb6['push'](_0x28fcb6['shift']());}};_0x402847(++_0x4108d5);}(_0xf2a8,0x10c));var _0x8f2a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xf2a8[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x8f2a('0x0'));var util=require(_0x8f2a('0x1'));var path=require(_0x8f2a('0x2'));var timeout=require(_0x8f2a('0x3'));var express=require(_0x8f2a('0x4'));var router=express[_0x8f2a('0x5')]();var fs_extra=require(_0x8f2a('0x6'));var auth=require(_0x8f2a('0x7'));var interaction=require(_0x8f2a('0x8'));var config=require(_0x8f2a('0x9'));var controller=require(_0x8f2a('0xa'));router['get']('/',auth[_0x8f2a('0xb')](),controller[_0x8f2a('0xc')]);router[_0x8f2a('0xd')](_0x8f2a('0xe'),auth[_0x8f2a('0xb')](),controller[_0x8f2a('0xf')]);router[_0x8f2a('0xd')]('/:id',auth[_0x8f2a('0xb')](),controller[_0x8f2a('0x10')]);router['post']('/',auth[_0x8f2a('0xb')](),controller[_0x8f2a('0x11')]);router['put'](_0x8f2a('0x12'),auth['isAuthenticated'](),controller[_0x8f2a('0x13')]);router[_0x8f2a('0x14')](_0x8f2a('0x12'),auth[_0x8f2a('0xb')](),controller[_0x8f2a('0x15')]);module[_0x8f2a('0x16')]=router; \ No newline at end of file +var _0x8970=['express','Router','./chatQueueReport.controller','isAuthenticated','index','get','/describe','/:id','post','create','put','update','delete','util','connect-timeout'];(function(_0x988eb1,_0x4fea88){var _0x5d11ec=function(_0x23624f){while(--_0x23624f){_0x988eb1['push'](_0x988eb1['shift']());}};_0x5d11ec(++_0x4fea88);}(_0x8970,0x67));var _0x0897=function(_0x29c893,_0x10e109){_0x29c893=_0x29c893-0x0;var _0x471e93=_0x8970[_0x29c893];return _0x471e93;};'use strict';var multer=require('multer');var util=require(_0x0897('0x0'));var path=require('path');var timeout=require(_0x0897('0x1'));var express=require(_0x0897('0x2'));var router=express[_0x0897('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(_0x0897('0x4'));router['get']('/',auth[_0x0897('0x5')](),controller[_0x0897('0x6')]);router[_0x0897('0x7')](_0x0897('0x8'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x0897('0x9'),auth[_0x0897('0x5')](),controller['show']);router[_0x0897('0xa')]('/',auth[_0x0897('0x5')](),controller[_0x0897('0xb')]);router[_0x0897('0xc')]('/:id',auth[_0x0897('0x5')](),controller[_0x0897('0xd')]);router[_0x0897('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);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 bf7d505..bce2e9c 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 _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x1eb1ab,_0x307aaa){var _0xa61729=function(_0x272231){while(--_0x272231){_0x1eb1ab['push'](_0x1eb1ab['shift']());}};_0xa61729(++_0x307aaa);}(_0xe706,0xa3));var _0x6e70=function(_0x29631f,_0xdb767){_0x29631f=_0x29631f-0x0;var _0x486d87=_0xe706[_0x29631f];return _0x486d87;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x2617dd,_0x226173){var _0x283502=function(_0x2dce05){while(--_0x2dce05){_0x2617dd['push'](_0x2617dd['shift']());}};_0x283502(++_0x226173);}(_0xedd9,0xfc));var _0x9edd=function(_0x51f179,_0x2966a5){_0x51f179=_0x51f179-0x0;var _0x39b5e8=_0xedd9[_0x51f179];return _0x39b5e8;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index e78f14d..850b04d 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 _0x46ff=['lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','update','then','destroy','error','stack','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','name','keys','query','intersection','attributes','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','fields','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs'];(function(_0x46e12d,_0x309eb6){var _0x2bf14f=function(_0x2f008a){while(--_0x2f008a){_0x46e12d['push'](_0x46e12d['shift']());}};_0x2bf14f(++_0x309eb6);}(_0x46ff,0x87));var _0xf46f=function(_0x4af23c,_0x50e294){_0x4af23c=_0x4af23c-0x0;var _0x194b63=_0x46ff[_0x4af23c];return _0x194b63;};'use strict';var emlformat=require(_0xf46f('0x0'));var rimraf=require(_0xf46f('0x1'));var zipdir=require(_0xf46f('0x2'));var jsonpatch=require(_0xf46f('0x3'));var rp=require(_0xf46f('0x4'));var moment=require(_0xf46f('0x5'));var BPromise=require(_0xf46f('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf46f('0x7'));var sox=require(_0xf46f('0x8'));var csv=require(_0xf46f('0x9'));var ejs=require(_0xf46f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf46f('0xb'));var squel=require('squel');var crypto=require(_0xf46f('0xc'));var jsforce=require(_0xf46f('0xd'));var deskjs=require(_0xf46f('0xe'));var toCsv=require(_0xf46f('0x9'));var querystring=require('querystring');var Papa=require(_0xf46f('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf46f('0x10'));var as=require(_0xf46f('0x11'));var hardwareService=require(_0xf46f('0x12'));var logger=require(_0xf46f('0x13'))(_0xf46f('0x14'));var utils=require('../../config/utils');var config=require(_0xf46f('0x15'));var licenseUtil=require(_0xf46f('0x16'));var db=require(_0xf46f('0x17'))['db'];function respondWithStatusCode(_0x40cd90,_0x2ef4c0){_0x2ef4c0=_0x2ef4c0||0xcc;return function(_0x1a9691){if(_0x1a9691){return _0x40cd90[_0xf46f('0x18')](_0x2ef4c0);}return _0x40cd90[_0xf46f('0x19')](_0x2ef4c0)[_0xf46f('0x1a')]();};}function respondWithResult(_0x1c52d6,_0x4ee730){_0x4ee730=_0x4ee730||0xc8;return function(_0x3149e9){if(_0x3149e9){return _0x1c52d6[_0xf46f('0x19')](_0x4ee730)['json'](_0x3149e9);}};}function respondWithFilteredResult(_0x520b2d,_0x4ce0de){return function(_0x20cb7c){if(_0x20cb7c){var _0x2e255d=typeof _0x4ce0de[_0xf46f('0x1b')]===_0xf46f('0x1c')&&typeof _0x4ce0de['limit']===_0xf46f('0x1c');var _0x50578b=_0x20cb7c[_0xf46f('0x1d')];var _0x397ca6=_0x2e255d?0x0:_0x4ce0de[_0xf46f('0x1b')];var _0x2b9dcb=_0x2e255d?_0x20cb7c[_0xf46f('0x1d')]:_0x4ce0de[_0xf46f('0x1b')]+_0x4ce0de[_0xf46f('0x1e')];var _0x3190e9;if(_0x2b9dcb>=_0x50578b){_0x2b9dcb=_0x50578b;_0x3190e9=0xc8;}else{_0x3190e9=0xce;}_0x520b2d[_0xf46f('0x19')](_0x3190e9);return _0x520b2d[_0xf46f('0x1f')]('Content-Range',_0x397ca6+'-'+_0x2b9dcb+'/'+_0x50578b)[_0xf46f('0x20')](_0x20cb7c);}return null;};}function patchUpdates(_0x2a3eb5){return function(_0x4b6ab0){try{jsonpatch[_0xf46f('0x21')](_0x4b6ab0,_0x2a3eb5,!![]);}catch(_0x5b24ac){return BPromise[_0xf46f('0x22')](_0x5b24ac);}return _0x4b6ab0['save']();};}function saveUpdates(_0x3020fc,_0x517b8f){return function(_0x7b8823){if(_0x7b8823){return _0x7b8823[_0xf46f('0x23')](_0x3020fc)[_0xf46f('0x24')](function(_0x4be87c){return _0x4be87c;});}return null;};}function removeEntity(_0x4b9ea0,_0x31d147){return function(_0xde6c5b){if(_0xde6c5b){return _0xde6c5b[_0xf46f('0x25')]()['then'](function(){_0x4b9ea0[_0xf46f('0x19')](0xcc)[_0xf46f('0x1a')]();});}};}function handleEntityNotFound(_0x254f7d,_0x36fd00){return function(_0x217d38){if(!_0x217d38){_0x254f7d[_0xf46f('0x18')](0x194);}return _0x217d38;};}function handleError(_0x51d63e,_0x5ac198){_0x5ac198=_0x5ac198||0x1f4;return function(_0x2de841){logger[_0xf46f('0x26')](_0x2de841[_0xf46f('0x27')]);if(_0x2de841['name']){delete _0x2de841['name'];}_0x51d63e[_0xf46f('0x19')](_0x5ac198)['send'](_0x2de841);};}exports['index']=function(_0x48331d,_0x361a40){var _0x45c97c={},_0x214563={},_0x3623e7={'count':0x0,'rows':[]};var _0x4eaf68=_[_0xf46f('0x28')](db[_0xf46f('0x29')][_0xf46f('0x2a')],function(_0x48f65e){return{'name':_0x48f65e[_0xf46f('0x2b')],'type':_0x48f65e[_0xf46f('0x2c')][_0xf46f('0x2d')]};});_0x214563[_0xf46f('0x2e')]=_[_0xf46f('0x28')](_0x4eaf68,_0xf46f('0x2f'));_0x214563['query']=_[_0xf46f('0x30')](_0x48331d[_0xf46f('0x31')]);_0x214563['filters']=_[_0xf46f('0x32')](_0x214563['model'],_0x214563[_0xf46f('0x31')]);_0x45c97c[_0xf46f('0x33')]=_[_0xf46f('0x32')](_0x214563[_0xf46f('0x2e')],qs['fields'](_0x48331d[_0xf46f('0x31')]['fields']));_0x45c97c[_0xf46f('0x33')]=_0x45c97c[_0xf46f('0x33')][_0xf46f('0x34')]?_0x45c97c[_0xf46f('0x33')]:_0x214563['model'];if(!_0x48331d[_0xf46f('0x31')]['hasOwnProperty'](_0xf46f('0x35'))){_0x45c97c[_0xf46f('0x1e')]=qs[_0xf46f('0x1e')](_0x48331d[_0xf46f('0x31')][_0xf46f('0x1e')]);_0x45c97c[_0xf46f('0x1b')]=qs[_0xf46f('0x1b')](_0x48331d[_0xf46f('0x31')][_0xf46f('0x1b')]);}_0x45c97c['order']=qs[_0xf46f('0x36')](_0x48331d['query'][_0xf46f('0x36')]);_0x45c97c[_0xf46f('0x37')]=qs[_0xf46f('0x38')](_[_0xf46f('0x39')](_0x48331d['query'],_0x214563[_0xf46f('0x38')]),_0x4eaf68);if(_0x48331d[_0xf46f('0x31')][_0xf46f('0x3a')]){_0x45c97c[_0xf46f('0x37')]=_[_0xf46f('0x3b')](_0x45c97c[_0xf46f('0x37')],{'$or':_['map'](_0x4eaf68,function(_0x24d0d8){if(_0x24d0d8[_0xf46f('0x2c')]!==_0xf46f('0x3c')){var _0x4606b7={};_0x4606b7[_0x24d0d8['name']]={'$like':'%'+_0x48331d['query'][_0xf46f('0x3a')]+'%'};return _0x4606b7;}})});}_0x45c97c=_['merge']({},_0x45c97c,_0x48331d[_0xf46f('0x3d')]);var _0x21a90a={'where':_0x45c97c['where']};return db[_0xf46f('0x29')][_0xf46f('0x1d')](_0x21a90a)['then'](function(_0x5417e3){_0x3623e7[_0xf46f('0x1d')]=_0x5417e3;if(_0x48331d[_0xf46f('0x31')][_0xf46f('0x3e')]){_0x45c97c[_0xf46f('0x3f')]=[{'all':!![]}];}return db[_0xf46f('0x29')][_0xf46f('0x40')](_0x45c97c);})[_0xf46f('0x24')](function(_0x3c05ff){_0x3623e7[_0xf46f('0x41')]=_0x3c05ff;return _0x3623e7;})[_0xf46f('0x24')](respondWithFilteredResult(_0x361a40,_0x45c97c))[_0xf46f('0x42')](handleError(_0x361a40,null));};exports['show']=function(_0x8b58,_0x4091ca){var _0x37be37={'raw':!![],'where':{'id':_0x8b58[_0xf46f('0x43')]['id']}},_0x43de50={};_0x43de50['model']=_[_0xf46f('0x30')](db[_0xf46f('0x29')]['rawAttributes']);_0x43de50[_0xf46f('0x31')]=_[_0xf46f('0x30')](_0x8b58[_0xf46f('0x31')]);_0x43de50[_0xf46f('0x38')]=_['intersection'](_0x43de50[_0xf46f('0x2e')],_0x43de50[_0xf46f('0x31')]);_0x37be37[_0xf46f('0x33')]=_[_0xf46f('0x32')](_0x43de50[_0xf46f('0x2e')],qs['fields'](_0x8b58[_0xf46f('0x31')][_0xf46f('0x44')]));_0x37be37[_0xf46f('0x33')]=_0x37be37[_0xf46f('0x33')][_0xf46f('0x34')]?_0x37be37['attributes']:_0x43de50[_0xf46f('0x2e')];if(_0x8b58[_0xf46f('0x31')][_0xf46f('0x3e')]){_0x37be37['include']=[{'all':!![]}];}_0x37be37=_[_0xf46f('0x3b')]({},_0x37be37,_0x8b58['options']);return db['ChatTransferReport']['find'](_0x37be37)[_0xf46f('0x24')](handleEntityNotFound(_0x4091ca,null))['then'](respondWithResult(_0x4091ca,null))[_0xf46f('0x42')](handleError(_0x4091ca,null));};exports['create']=function(_0x573b19,_0x4fea3a){return db['ChatTransferReport'][_0xf46f('0x45')](_0x573b19['body'],{})[_0xf46f('0x24')](respondWithResult(_0x4fea3a,0xc9))[_0xf46f('0x42')](handleError(_0x4fea3a,null));};exports[_0xf46f('0x23')]=function(_0x3815e6,_0x5e5ca4){if(_0x3815e6[_0xf46f('0x46')]['id']){delete _0x3815e6[_0xf46f('0x46')]['id'];}return db['ChatTransferReport'][_0xf46f('0x47')]({'where':{'id':_0x3815e6[_0xf46f('0x43')]['id']}})[_0xf46f('0x24')](handleEntityNotFound(_0x5e5ca4,null))[_0xf46f('0x24')](saveUpdates(_0x3815e6['body'],null))['then'](respondWithResult(_0x5e5ca4,null))[_0xf46f('0x42')](handleError(_0x5e5ca4,null));};exports[_0xf46f('0x25')]=function(_0x24e8d9,_0x4aaba1){return db[_0xf46f('0x29')][_0xf46f('0x47')]({'where':{'id':_0x24e8d9[_0xf46f('0x43')]['id']}})[_0xf46f('0x24')](handleEntityNotFound(_0x4aaba1,null))['then'](removeEntity(_0x4aaba1,null))[_0xf46f('0x42')](handleError(_0x4aaba1,null));};exports[_0xf46f('0x48')]=function(_0x222e87,_0x3ae4bd){return db[_0xf46f('0x29')][_0xf46f('0x48')]()['then'](respondWithResult(_0x3ae4bd,null))[_0xf46f('0x42')](handleError(_0x3ae4bd,null));}; \ No newline at end of file +var _0x90a2=['intersection','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','jsforce','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','limit','undefined','count','offset','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','rawAttributes','type','key','map','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','filter','where','VIRTUAL','merge','options','ChatTransferReport','include','findAll','keys'];(function(_0xfcbcb8,_0x35bf6b){var _0x1b1f97=function(_0x51e11d){while(--_0x51e11d){_0xfcbcb8['push'](_0xfcbcb8['shift']());}};_0x1b1f97(++_0x35bf6b);}(_0x90a2,0xe2));var _0x290a=function(_0x21a314,_0xbe022b){_0x21a314=_0x21a314-0x0;var _0x3eb9f6=_0x90a2[_0x21a314];return _0x3eb9f6;};'use strict';var emlformat=require(_0x290a('0x0'));var rimraf=require(_0x290a('0x1'));var zipdir=require(_0x290a('0x2'));var jsonpatch=require(_0x290a('0x3'));var rp=require(_0x290a('0x4'));var moment=require('moment');var BPromise=require(_0x290a('0x5'));var Mustache=require(_0x290a('0x6'));var util=require(_0x290a('0x7'));var path=require(_0x290a('0x8'));var sox=require('sox');var csv=require(_0x290a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x290a('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x290a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x290a('0x9'));var querystring=require(_0x290a('0xc'));var Papa=require(_0x290a('0xd'));var Redis=require(_0x290a('0xe'));var authService=require(_0x290a('0xf'));var qs=require(_0x290a('0x10'));var as=require(_0x290a('0x11'));var hardwareService=require(_0x290a('0x12'));var logger=require(_0x290a('0x13'))(_0x290a('0x14'));var utils=require('../../config/utils');var config=require(_0x290a('0x15'));var licenseUtil=require(_0x290a('0x16'));var db=require(_0x290a('0x17'))['db'];function respondWithStatusCode(_0x5d70a0,_0x8ea8f1){_0x8ea8f1=_0x8ea8f1||0xcc;return function(_0x4f6b3c){if(_0x4f6b3c){return _0x5d70a0[_0x290a('0x18')](_0x8ea8f1);}return _0x5d70a0[_0x290a('0x19')](_0x8ea8f1)[_0x290a('0x1a')]();};}function respondWithResult(_0x28ead8,_0x1dfc65){_0x1dfc65=_0x1dfc65||0xc8;return function(_0x279208){if(_0x279208){return _0x28ead8[_0x290a('0x19')](_0x1dfc65)[_0x290a('0x1b')](_0x279208);}};}function respondWithFilteredResult(_0x339d8c,_0x22f564){return function(_0x206b28){if(_0x206b28){var _0x22568d=typeof _0x22f564['offset']==='undefined'&&typeof _0x22f564[_0x290a('0x1c')]===_0x290a('0x1d');var _0x18e6c8=_0x206b28[_0x290a('0x1e')];var _0x5939c2=_0x22568d?0x0:_0x22f564[_0x290a('0x1f')];var _0x44b06d=_0x22568d?_0x206b28[_0x290a('0x1e')]:_0x22f564[_0x290a('0x1f')]+_0x22f564['limit'];var _0x3dd961;if(_0x44b06d>=_0x18e6c8){_0x44b06d=_0x18e6c8;_0x3dd961=0xc8;}else{_0x3dd961=0xce;}_0x339d8c[_0x290a('0x19')](_0x3dd961);return _0x339d8c[_0x290a('0x20')](_0x290a('0x21'),_0x5939c2+'-'+_0x44b06d+'/'+_0x18e6c8)['json'](_0x206b28);}return null;};}function patchUpdates(_0x259cb1){return function(_0x339a0a){try{jsonpatch['apply'](_0x339a0a,_0x259cb1,!![]);}catch(_0x46d127){return BPromise[_0x290a('0x22')](_0x46d127);}return _0x339a0a[_0x290a('0x23')]();};}function saveUpdates(_0xe5eafb,_0x3068d8){return function(_0x236c06){if(_0x236c06){return _0x236c06[_0x290a('0x24')](_0xe5eafb)['then'](function(_0x5e291d){return _0x5e291d;});}return null;};}function removeEntity(_0x2f68d9,_0x534276){return function(_0xac2931){if(_0xac2931){return _0xac2931[_0x290a('0x25')]()[_0x290a('0x26')](function(){_0x2f68d9['status'](0xcc)[_0x290a('0x1a')]();});}};}function handleEntityNotFound(_0x56b33e,_0x3b4fcb){return function(_0x542668){if(!_0x542668){_0x56b33e[_0x290a('0x18')](0x194);}return _0x542668;};}function handleError(_0x1e9f1e,_0x29d34b){_0x29d34b=_0x29d34b||0x1f4;return function(_0x2cdecd){logger[_0x290a('0x27')](_0x2cdecd[_0x290a('0x28')]);if(_0x2cdecd[_0x290a('0x29')]){delete _0x2cdecd[_0x290a('0x29')];}_0x1e9f1e['status'](_0x29d34b)[_0x290a('0x2a')](_0x2cdecd);};}exports[_0x290a('0x2b')]=function(_0x10c687,_0x34670c){var _0x21c67d={},_0x24cdfc={},_0x574b97={'count':0x0,'rows':[]};var _0x3088d0=_['map'](db['ChatTransferReport'][_0x290a('0x2c')],function(_0x5179a6){return{'name':_0x5179a6['fieldName'],'type':_0x5179a6[_0x290a('0x2d')][_0x290a('0x2e')]};});_0x24cdfc['model']=_[_0x290a('0x2f')](_0x3088d0,_0x290a('0x29'));_0x24cdfc['query']=_['keys'](_0x10c687[_0x290a('0x30')]);_0x24cdfc[_0x290a('0x31')]=_['intersection'](_0x24cdfc[_0x290a('0x32')],_0x24cdfc['query']);_0x21c67d[_0x290a('0x33')]=_['intersection'](_0x24cdfc[_0x290a('0x32')],qs[_0x290a('0x34')](_0x10c687[_0x290a('0x30')]['fields']));_0x21c67d['attributes']=_0x21c67d[_0x290a('0x33')][_0x290a('0x35')]?_0x21c67d[_0x290a('0x33')]:_0x24cdfc[_0x290a('0x32')];if(!_0x10c687['query'][_0x290a('0x36')](_0x290a('0x37'))){_0x21c67d[_0x290a('0x1c')]=qs[_0x290a('0x1c')](_0x10c687[_0x290a('0x30')][_0x290a('0x1c')]);_0x21c67d[_0x290a('0x1f')]=qs[_0x290a('0x1f')](_0x10c687[_0x290a('0x30')][_0x290a('0x1f')]);}_0x21c67d[_0x290a('0x38')]=qs['sort'](_0x10c687[_0x290a('0x30')]['sort']);_0x21c67d['where']=qs['filters'](_['pick'](_0x10c687['query'],_0x24cdfc[_0x290a('0x31')]),_0x3088d0);if(_0x10c687[_0x290a('0x30')][_0x290a('0x39')]){_0x21c67d['where']=_['merge'](_0x21c67d[_0x290a('0x3a')],{'$or':_[_0x290a('0x2f')](_0x3088d0,function(_0x4f4e3e){if(_0x4f4e3e[_0x290a('0x2d')]!==_0x290a('0x3b')){var _0x10c97c={};_0x10c97c[_0x4f4e3e[_0x290a('0x29')]]={'$like':'%'+_0x10c687[_0x290a('0x30')][_0x290a('0x39')]+'%'};return _0x10c97c;}})});}_0x21c67d=_[_0x290a('0x3c')]({},_0x21c67d,_0x10c687[_0x290a('0x3d')]);var _0x4f534e={'where':_0x21c67d[_0x290a('0x3a')]};return db[_0x290a('0x3e')][_0x290a('0x1e')](_0x4f534e)[_0x290a('0x26')](function(_0x579eb1){_0x574b97[_0x290a('0x1e')]=_0x579eb1;if(_0x10c687[_0x290a('0x30')]['includeAll']){_0x21c67d[_0x290a('0x3f')]=[{'all':!![]}];}return db[_0x290a('0x3e')][_0x290a('0x40')](_0x21c67d);})[_0x290a('0x26')](function(_0x126cc5){_0x574b97['rows']=_0x126cc5;return _0x574b97;})[_0x290a('0x26')](respondWithFilteredResult(_0x34670c,_0x21c67d))['catch'](handleError(_0x34670c,null));};exports['show']=function(_0x846431,_0x2b359b){var _0x5ea897={'raw':!![],'where':{'id':_0x846431['params']['id']}},_0x114ab9={};_0x114ab9['model']=_[_0x290a('0x41')](db['ChatTransferReport'][_0x290a('0x2c')]);_0x114ab9[_0x290a('0x30')]=_[_0x290a('0x41')](_0x846431[_0x290a('0x30')]);_0x114ab9['filters']=_['intersection'](_0x114ab9[_0x290a('0x32')],_0x114ab9[_0x290a('0x30')]);_0x5ea897[_0x290a('0x33')]=_[_0x290a('0x42')](_0x114ab9[_0x290a('0x32')],qs['fields'](_0x846431['query'][_0x290a('0x34')]));_0x5ea897[_0x290a('0x33')]=_0x5ea897[_0x290a('0x33')][_0x290a('0x35')]?_0x5ea897[_0x290a('0x33')]:_0x114ab9[_0x290a('0x32')];if(_0x846431['query'][_0x290a('0x43')]){_0x5ea897['include']=[{'all':!![]}];}_0x5ea897=_[_0x290a('0x3c')]({},_0x5ea897,_0x846431[_0x290a('0x3d')]);return db['ChatTransferReport'][_0x290a('0x44')](_0x5ea897)[_0x290a('0x26')](handleEntityNotFound(_0x2b359b,null))['then'](respondWithResult(_0x2b359b,null))[_0x290a('0x45')](handleError(_0x2b359b,null));};exports[_0x290a('0x46')]=function(_0x51758d,_0x4dc211){return db[_0x290a('0x3e')]['create'](_0x51758d[_0x290a('0x47')],{})[_0x290a('0x26')](respondWithResult(_0x4dc211,0xc9))[_0x290a('0x45')](handleError(_0x4dc211,null));};exports[_0x290a('0x24')]=function(_0x4ba207,_0x3b157e){if(_0x4ba207['body']['id']){delete _0x4ba207[_0x290a('0x47')]['id'];}return db['ChatTransferReport'][_0x290a('0x44')]({'where':{'id':_0x4ba207['params']['id']}})['then'](handleEntityNotFound(_0x3b157e,null))['then'](saveUpdates(_0x4ba207[_0x290a('0x47')],null))[_0x290a('0x26')](respondWithResult(_0x3b157e,null))[_0x290a('0x45')](handleError(_0x3b157e,null));};exports[_0x290a('0x25')]=function(_0x140c6f,_0x4673d5){return db[_0x290a('0x3e')][_0x290a('0x44')]({'where':{'id':_0x140c6f['params']['id']}})[_0x290a('0x26')](handleEntityNotFound(_0x4673d5,null))['then'](removeEntity(_0x4673d5,null))[_0x290a('0x45')](handleError(_0x4673d5,null));};exports[_0x290a('0x48')]=function(_0xf2ed55,_0x2aba14){return db[_0x290a('0x3e')][_0x290a('0x48')]()[_0x290a('0x26')](respondWithResult(_0x2aba14,null))[_0x290a('0x45')](handleError(_0x2aba14,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 62cc5ba..1f242b0 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 _0x53b3=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid','lodash','util'];(function(_0x2d0d9f,_0x22c0d8){var _0x30243d=function(_0x29a92b){while(--_0x29a92b){_0x2d0d9f['push'](_0x2d0d9f['shift']());}};_0x30243d(++_0x22c0d8);}(_0x53b3,0x1a2));var _0x353b=function(_0x4a39f2,_0x4ef331){_0x4a39f2=_0x4a39f2-0x0;var _0x1d8bc9=_0x53b3[_0x4a39f2];return _0x1d8bc9;};'use strict';var _=require(_0x353b('0x0'));var util=require(_0x353b('0x1'));var logger=require(_0x353b('0x2'))(_0x353b('0x3'));var moment=require(_0x353b('0x4'));var BPromise=require('bluebird');var rp=require(_0x353b('0x5'));var fs=require('fs');var path=require(_0x353b('0x6'));var rimraf=require(_0x353b('0x7'));var config=require(_0x353b('0x8'));var attributes=require(_0x353b('0x9'));module[_0x353b('0xa')]=function(_0x58cf5e,_0x46edf5){return _0x58cf5e[_0x353b('0xb')](_0x353b('0xc'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x353b('0xd'),'fields':[_0x353b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc101=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','define','report_chat_transfer'];(function(_0x28f047,_0x18156b){var _0x352808=function(_0x38100a){while(--_0x38100a){_0x28f047['push'](_0x28f047['shift']());}};_0x352808(++_0x18156b);}(_0xc101,0x1dd));var _0x1c10=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0xc101[_0x280f4a];return _0x1bb157;};'use strict';var _=require(_0x1c10('0x0'));var util=require(_0x1c10('0x1'));var logger=require(_0x1c10('0x2'))(_0x1c10('0x3'));var moment=require(_0x1c10('0x4'));var BPromise=require(_0x1c10('0x5'));var rp=require(_0x1c10('0x6'));var fs=require('fs');var path=require(_0x1c10('0x7'));var rimraf=require(_0x1c10('0x8'));var config=require(_0x1c10('0x9'));var attributes=require(_0x1c10('0xa'));module['exports']=function(_0x5669e0,_0xcc6851){return _0x5669e0[_0x1c10('0xb')]('ChatTransferReport',attributes,{'tableName':_0x1c10('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1c10('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 833b28d..824b928 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 _0xa35c=['info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatTransferReport,\x20%s,\x20%s','message'];(function(_0x45347a,_0x546c3e){var _0x24726e=function(_0x3fbb67){while(--_0x3fbb67){_0x45347a['push'](_0x45347a['shift']());}};_0x24726e(++_0x546c3e);}(_0xa35c,0x1b3));var _0xca35=function(_0x2b39a9,_0x1e0741){_0x2b39a9=_0x2b39a9-0x0;var _0x6142db=_0xa35c[_0x2b39a9];return _0x6142db;};'use strict';var _=require(_0xca35('0x0'));var util=require(_0xca35('0x1'));var moment=require(_0xca35('0x2'));var BPromise=require('bluebird');var rs=require(_0xca35('0x3'));var fs=require('fs');var Redis=require(_0xca35('0x4'));var db=require(_0xca35('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xca35('0x6'))(_0xca35('0x7'));var config=require(_0xca35('0x8'));var jayson=require(_0xca35('0x9'));var client=jayson[_0xca35('0xa')][_0xca35('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11d6ed,_0x4d8f53,_0x41c092){return new BPromise(function(_0x274726,_0x5280a7){return client[_0xca35('0xc')](_0x11d6ed,_0x41c092)[_0xca35('0xd')](function(_0x4f932a){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x4d8f53,'request\x20sent');logger[_0xca35('0xe')](_0xca35('0xf'),_0x4d8f53,_0xca35('0x10'),JSON[_0xca35('0x11')](_0x4f932a));if(_0x4f932a['error']){if(_0x4f932a[_0xca35('0x12')]['code']===0x1f4){logger[_0xca35('0x12')](_0xca35('0x13'),_0x4d8f53,_0x4f932a[_0xca35('0x12')][_0xca35('0x14')]);return _0x5280a7(_0x4f932a['error'][_0xca35('0x14')]);}logger[_0xca35('0x12')](_0xca35('0x13'),_0x4d8f53,_0x4f932a['error'][_0xca35('0x14')]);return _0x274726(_0x4f932a[_0xca35('0x12')][_0xca35('0x14')]);}else{logger[_0xca35('0x15')](_0xca35('0x13'),_0x4d8f53,_0xca35('0x10'));_0x274726(_0x4f932a[_0xca35('0x16')][_0xca35('0x14')]);}})[_0xca35('0x17')](function(_0x2565da){logger[_0xca35('0x12')](_0xca35('0x13'),_0x4d8f53,_0x2565da);_0x5280a7(_0x2565da);});});} \ No newline at end of file +var _0x45cd=['request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ChatTransferReport,\x20%s,\x20%s'];(function(_0x33a9e1,_0x54e7af){var _0x4cc6ae=function(_0x3aca6f){while(--_0x3aca6f){_0x33a9e1['push'](_0x33a9e1['shift']());}};_0x4cc6ae(++_0x54e7af);}(_0x45cd,0x1eb));var _0xd45c=function(_0x181f0c,_0x1c5555){_0x181f0c=_0x181f0c-0x0;var _0x134ee8=_0x45cd[_0x181f0c];return _0x134ee8;};'use strict';var _=require(_0xd45c('0x0'));var util=require(_0xd45c('0x1'));var moment=require(_0xd45c('0x2'));var BPromise=require(_0xd45c('0x3'));var rs=require(_0xd45c('0x4'));var fs=require('fs');var Redis=require(_0xd45c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd45c('0x6'));var logger=require(_0xd45c('0x7'))(_0xd45c('0x8'));var config=require(_0xd45c('0x9'));var jayson=require(_0xd45c('0xa'));var client=jayson['client'][_0xd45c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38287a,_0x46df68,_0x52a48f){return new BPromise(function(_0x67f829,_0x523903){return client[_0xd45c('0xc')](_0x38287a,_0x52a48f)[_0xd45c('0xd')](function(_0x1131df){logger['info'](_0xd45c('0xe'),_0x46df68,_0xd45c('0xf'));logger[_0xd45c('0x10')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x46df68,_0xd45c('0xf'),JSON[_0xd45c('0x11')](_0x1131df));if(_0x1131df[_0xd45c('0x12')]){if(_0x1131df[_0xd45c('0x12')][_0xd45c('0x13')]===0x1f4){logger[_0xd45c('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x46df68,_0x1131df['error'][_0xd45c('0x14')]);return _0x523903(_0x1131df['error'][_0xd45c('0x14')]);}logger[_0xd45c('0x12')](_0xd45c('0xe'),_0x46df68,_0x1131df[_0xd45c('0x12')]['message']);return _0x67f829(_0x1131df[_0xd45c('0x12')][_0xd45c('0x14')]);}else{logger['info'](_0xd45c('0xe'),_0x46df68,_0xd45c('0xf'));_0x67f829(_0x1131df['result']['message']);}})[_0xd45c('0x15')](function(_0x13afe7){logger[_0xd45c('0x12')](_0xd45c('0xe'),_0x46df68,_0x13afe7);_0x523903(_0x13afe7);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 8db5c1a..3b5e136 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 _0x8356=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','destroy','exports'];(function(_0x525354,_0x372901){var _0x406f57=function(_0x20c4a8){while(--_0x20c4a8){_0x525354['push'](_0x525354['shift']());}};_0x406f57(++_0x372901);}(_0x8356,0x18f));var _0x6835=function(_0x3ed0bf,_0x5bb8a9){_0x3ed0bf=_0x3ed0bf-0x0;var _0x1e618e=_0x8356[_0x3ed0bf];return _0x1e618e;};'use strict';var multer=require('multer');var util=require(_0x6835('0x0'));var path=require(_0x6835('0x1'));var timeout=require(_0x6835('0x2'));var express=require(_0x6835('0x3'));var router=express[_0x6835('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6835('0x5'));var interaction=require(_0x6835('0x6'));var config=require(_0x6835('0x7'));var controller=require(_0x6835('0x8'));router[_0x6835('0x9')]('/',auth[_0x6835('0xa')](),controller[_0x6835('0xb')]);router[_0x6835('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x6835('0xc')]);router[_0x6835('0x9')](_0x6835('0xd'),auth[_0x6835('0xa')](),controller[_0x6835('0xe')]);router[_0x6835('0xf')]('/',auth[_0x6835('0xa')](),controller[_0x6835('0x10')]);router[_0x6835('0x11')](_0x6835('0xd'),auth[_0x6835('0xa')](),controller[_0x6835('0x12')]);router['delete'](_0x6835('0xd'),auth[_0x6835('0xa')](),controller[_0x6835('0x13')]);module[_0x6835('0x14')]=router; \ No newline at end of file +var _0xec7a=['../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xec7a,0x77));var _0xaec7=function(_0x27b49f,_0x5609d2){_0x27b49f=_0x27b49f-0x0;var _0x1b75c2=_0xec7a[_0x27b49f];return _0x1b75c2;};'use strict';var multer=require(_0xaec7('0x0'));var util=require(_0xaec7('0x1'));var path=require(_0xaec7('0x2'));var timeout=require(_0xaec7('0x3'));var express=require('express');var router=express[_0xaec7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xaec7('0x5'));var interaction=require(_0xaec7('0x6'));var config=require(_0xaec7('0x7'));var controller=require(_0xaec7('0x8'));router[_0xaec7('0x9')]('/',auth[_0xaec7('0xa')](),controller[_0xaec7('0xb')]);router['get'](_0xaec7('0xc'),auth[_0xaec7('0xa')](),controller[_0xaec7('0xd')]);router[_0xaec7('0x9')](_0xaec7('0xe'),auth['isAuthenticated'](),controller[_0xaec7('0xf')]);router[_0xaec7('0x10')]('/',auth[_0xaec7('0xa')](),controller['create']);router[_0xaec7('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xaec7('0x12')]);router[_0xaec7('0x13')](_0xaec7('0xe'),auth[_0xaec7('0xa')](),controller['destroy']);module[_0xaec7('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 6dd053b..34fab25 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 _0x0519=['#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared','Send','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','thumb','INTEGER','stringify','name','input','getDataValue','parse','onlineForm','setDataValue','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT'];(function(_0x2a189e,_0x8130c3){var _0x46d76d=function(_0x5a87c6){while(--_0x5a87c6){_0x2a189e['push'](_0x2a189e['shift']());}};_0x46d76d(++_0x8130c3);}(_0x0519,0x106));var _0x9051=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x0519[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0x9051('0x0'));var rs=require(_0x9051('0x1'));module[_0x9051('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x9051('0x3')]},'mapKey':{'type':Sequelize[_0x9051('0x3')],'defaultValue':_0x9051('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x9051('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x9051('0x3')],'defaultValue':_0x9051('0x5')},'customerAlias':{'type':Sequelize[_0x9051('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x9051('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x9051('0x3')],'allowNull':![],'defaultValue':_0x9051('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x9051('0x3')],'allowNull':![],'defaultValue':_0x9051('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x9051('0x3')]},'animation':{'type':Sequelize[_0x9051('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x9051('0x9')](_0x9051('0xa'),_0x9051('0xb')),'defaultValue':_0x9051('0xa')},'header_online':{'type':Sequelize[_0x9051('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x9051('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x9051('0x3')],'defaultValue':_0x9051('0xc')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x9051('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x9051('0x3')],'defaultValue':_0x9051('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0x9051('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x9051('0xe')]},'closingQuestion':{'type':Sequelize[_0x9051('0x3')],'defaultValue':_0x9051('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x9051('0x3')],'defaultValue':_0x9051('0x10')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x9051('0x11')},'noteTitle':{'type':Sequelize[_0x9051('0x3')],'defaultValue':_0x9051('0x12')},'placeholderMessage':{'type':Sequelize[_0x9051('0x3')],'defaultValue':_0x9051('0x13')},'closingMessage':{'type':Sequelize[_0x9051('0x3')],'defaultValue':_0x9051('0x14')},'closingMessageButton':{'type':Sequelize[_0x9051('0x3')],'defaultValue':_0x9051('0xc')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x9051('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x9051('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x9051('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x9051('0x3')],'defaultValue':_0x9051('0x16')},'ratingType':{'type':Sequelize['ENUM']('star',_0x9051('0x17')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x9051('0x18')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x9051('0xe')],'defaultValue':function(){return JSON[_0x9051('0x19')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x9051('0x1a'),'type':'text','required':!![]},'props':{'title':_0x9051('0x1a'),'helpText':''}},{'type':_0x9051('0x1b'),'props':{'title':_0x9051('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x9051('0x4'),'type':_0x9051('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x9051('0x1c')]('onlineForm')?JSON[_0x9051('0x1d')](this[_0x9051('0x1c')](_0x9051('0x1e'))):{};},'set':function(_0x5212f1){return this[_0x9051('0x1f')](_0x9051('0x1e'),JSON[_0x9051('0x19')](_0x5212f1));}},'offlineForm':{'type':Sequelize[_0x9051('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','props':{'title':_0x9051('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x9051('0x4'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':_0x9051('0x20')},'props':{'title':'Comments','helpText':_0x9051('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x9051('0x1c')](_0x9051('0x22'))?JSON[_0x9051('0x1d')](this['getDataValue'](_0x9051('0x22'))):{};},'set':function(_0xf7b5b9){return this[_0x9051('0x1f')]('offlineForm',JSON[_0x9051('0x19')](_0xf7b5b9));}},'token':{'type':Sequelize[_0x9051('0x3')],'defaultValue':function(){return rs[_0x9051('0x23')]();}},'autoclose':{'type':Sequelize[_0x9051('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x9051('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x9051('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x9051('0x3')]},'forwardOffline':{'type':Sequelize[_0x9051('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x9051('0x3')]},'waitingTitle':{'type':Sequelize[_0x9051('0x3')],'defaultValue':_0x9051('0x24')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x9051('0x25')},'offlineMessageBody':{'type':Sequelize[_0x9051('0x3')],'defaultValue':_0x9051('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x9051('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x9051('0x3')],'defaultValue':_0x9051('0x27')},'skipUnmanaged':{'type':Sequelize[_0x9051('0x3')],'defaultValue':_0x9051('0x15')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x9051('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x9051('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x9051('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x9051('0xe')]},'showAgentAvatar':{'type':Sequelize[_0x9051('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x9051('0x3')]},'notificationTemplate':{'type':Sequelize[_0x9051('0xe')],'defaultValue':function(){return _0x9051('0x28');}},'notificationSound':{'type':Sequelize[_0x9051('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x9051('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x9051('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x9051('0x18')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x9051('0x2a')},'verticalAlignment':{'type':Sequelize[_0x9051('0x18')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x9051('0x3')],'defaultValue':_0x9051('0x2b')},'messagesAlignment':{'type':Sequelize[_0x9051('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x9051('0xe')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x9051('0x18')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x9051('0x3')],'allowNull':![],'defaultValue':_0x9051('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x9051('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9051('0x18')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9051('0x18')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x9051('0x3')],'defaultValue':_0x9051('0x2d')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x9051('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x9051('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1e9387){if(!_0x1e9387)this[_0x9051('0x1f')](_0x9051('0x2f'),null);this['setDataValue'](_0x9051('0x30'),_0x1e9387);}},'vidaooEscalation':{'type':Sequelize[_0x9051('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x9051('0x3')]},'vidaooTopic':{'type':Sequelize[_0x9051('0x3')],'allowNull':![],'defaultValue':_0x9051('0x31')},'vidaooNote':{'type':Sequelize[_0x9051('0x3')],'defaultValue':function(){return _0x9051('0x32');}},'vidaooMetadata':{'type':Sequelize[_0x9051('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x9051('0xe')]}}; \ No newline at end of file +var _0xa03c=['Skip','website_alias','bottom_right','CHAT','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','randomstring','STRING','email','Agent','#011F6A','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','star','thumb','input','name','getDataValue','onlineForm','setDataValue','stringify','TEXT','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','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.'];(function(_0x5b95d9,_0x24d08e){var _0x20523c=function(_0xdfd6e){while(--_0xdfd6e){_0x5b95d9['push'](_0x5b95d9['shift']());}};_0x20523c(++_0x24d08e);}(_0xa03c,0xfe));var _0xca03=function(_0x414533,_0x5082f6){_0x414533=_0x414533-0x0;var _0x3dfe7b=_0xa03c[_0x414533];return _0x3dfe7b;};'use strict';var Sequelize=require(_0xca03('0x0'));var rs=require(_0xca03('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xca03('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xca03('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xca03('0x3')},'mapKeyOffline':{'type':Sequelize[_0xca03('0x2')],'defaultValue':'email'},'key':{'type':Sequelize[_0xca03('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xca03('0x2')],'defaultValue':_0xca03('0x4')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xca03('0x2')],'allowNull':![],'defaultValue':_0xca03('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xca03('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xca03('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xca03('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xca03('0x2')]},'animation':{'type':Sequelize[_0xca03('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xca03('0x8')](_0xca03('0x9'),_0xca03('0xa')),'defaultValue':_0xca03('0x9')},'header_online':{'type':Sequelize[_0xca03('0x2')],'defaultValue':_0xca03('0xb')},'start_chat_button':{'type':Sequelize[_0xca03('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xca03('0x2')],'defaultValue':_0xca03('0xc')},'header_offline':{'type':Sequelize[_0xca03('0x2')],'defaultValue':_0xca03('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xca03('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xca03('0x2')],'defaultValue':_0xca03('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xca03('0x2')],'defaultValue':_0xca03('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xca03('0x2')],'defaultValue':_0xca03('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xca03('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xca03('0x2')],'defaultValue':_0xca03('0x11')},'placeholderMessage':{'type':Sequelize[_0xca03('0x2')],'defaultValue':_0xca03('0x12')},'closingMessage':{'type':Sequelize[_0xca03('0x2')],'defaultValue':_0xca03('0x13')},'closingMessageButton':{'type':Sequelize[_0xca03('0x2')],'defaultValue':_0xca03('0xc')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xca03('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xca03('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xca03('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xca03('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xca03('0x2')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xca03('0x8')](_0xca03('0x14'),_0xca03('0x15')),'defaultValue':_0xca03('0x14')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xca03('0x16'),'variable':null,'config':{'placeholder':_0xca03('0x17'),'type':'text','required':!![]},'props':{'title':_0xca03('0x17'),'helpText':''}},{'type':_0xca03('0x16'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xca03('0x3'),'type':_0xca03('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xca03('0x18')](_0xca03('0x19'))?JSON['parse'](this[_0xca03('0x18')](_0xca03('0x19'))):{};},'set':function(_0xcf6115){return this[_0xca03('0x1a')](_0xca03('0x19'),JSON[_0xca03('0x1b')](_0xcf6115));}},'offlineForm':{'type':Sequelize[_0xca03('0x1c')],'defaultValue':function(){return JSON[_0xca03('0x1b')]({'items':[{'type':_0xca03('0x16'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xca03('0x3'),'type':_0xca03('0x3')},'variable':null},{'type':_0xca03('0x1d'),'config':{'placeholder':_0xca03('0x1e')},'props':{'title':_0xca03('0x1e'),'helpText':_0xca03('0x1f')}}],'fromKey':0x0});},'get':function(){return this[_0xca03('0x18')](_0xca03('0x20'))?JSON[_0xca03('0x21')](this['getDataValue'](_0xca03('0x20'))):{};},'set':function(_0x1f94cc){return this[_0xca03('0x1a')](_0xca03('0x20'),JSON[_0xca03('0x1b')](_0x1f94cc));}},'token':{'type':Sequelize[_0xca03('0x2')],'defaultValue':function(){return rs[_0xca03('0x22')]();}},'autoclose':{'type':Sequelize[_0xca03('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xca03('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xca03('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xca03('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xca03('0x2')]},'waitingTitle':{'type':Sequelize[_0xca03('0x2')],'defaultValue':_0xca03('0x23')},'waitingMessage':{'type':Sequelize[_0xca03('0x2')],'defaultValue':_0xca03('0x24')},'offlineMessageSubject':{'type':Sequelize[_0xca03('0x2')],'defaultValue':_0xca03('0x25')},'offlineMessageBody':{'type':Sequelize[_0xca03('0x2')],'defaultValue':_0xca03('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0xca03('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xca03('0x27')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xca03('0x28')},'sendUnmanaged':{'type':Sequelize[_0xca03('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xca03('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xca03('0x1c')]},'showAgentAvatar':{'type':Sequelize[_0xca03('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xca03('0x2')]},'notificationTemplate':{'type':Sequelize[_0xca03('0x1c')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xca03('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xca03('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xca03('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xca03('0x2')],'defaultValue':_0xca03('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0xca03('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xca03('0x2')],'defaultValue':_0xca03('0x2a')},'verticalAlignment':{'type':Sequelize[_0xca03('0x6')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xca03('0x2')],'defaultValue':_0xca03('0x2b')},'messagesAlignment':{'type':Sequelize[_0xca03('0x2')],'defaultValue':_0xca03('0x2c')},'defaultTitle':{'type':Sequelize[_0xca03('0x2')]},'customerAvatar':{'type':Sequelize[_0xca03('0x1c')]},'showCustomerAvatar':{'type':Sequelize[_0xca03('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xca03('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xca03('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xca03('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xca03('0x2d')},'systemAvatar':{'type':Sequelize[_0xca03('0x1c')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xca03('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0xca03('0x7')],'defaultValue':![],'comment':_0xca03('0x2f'),'set':function(_0x3ad610){if(!_0x3ad610)this[_0xca03('0x1a')]('mandatoryDispositionPauseId',null);this[_0xca03('0x1a')](_0xca03('0x30'),_0x3ad610);}},'vidaooEscalation':{'type':Sequelize[_0xca03('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0xca03('0x2')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0xca03('0x2')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0xca03('0x1c')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xca03('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xca03('0x1c')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 7e90953..c4c1b08 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 _0xa82a=['getAnswers','findOne','removeAnswers','sitepic','agentAvatar','file','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','existsSync','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','user-agent','chat','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','List','CmContact','Contacts','ChatApplication','account','list','applications','orderBy','asc','Applications','defaults','contact','customerIp','headers','cf-connecting-ip','first','firstName','x-real-port','browser','version','format','%s\x20%s','unknown','vendor','%s\x20%s\x20%s','device','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','lastName','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','EventManager','offline','files','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','originalname','mimetype','server','attachments','basename','openNewInteraction','sequelize','transaction','Attachment','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','mapValues','Chat','NotifyMailAccount','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','Contact','Owner','fullname','internal','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','No\x20timezone','Interval','Intervals','getProactiveActions','increment','some','server/files/chat/iframe.ejs','remote','x-forwarded-for','x-real-ip','referer','replace','alignment','verticalAlignment','color','labelText','textColor','backgroundColor','addApplications','Transaction','ISOLATION_LEVELS','findAndCountAll','priority','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachments','addAgents','emit','removeAgents','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','http','client','then','info','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','update','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','map','ChatWebsite','fieldName','type','key','model','query','filters','intersection','fields','attributes','order','sort','pick','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','show','mandatoryDispositionPause','rawAttributes','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','params','destroy','describe','getDispositions','hasOwnProperty','nolimit','ChatWebsiteId','filter','Disposition','removeDispositions','ids','addAnswer','CannedAnswer'];(function(_0x4591d1,_0x5e44c8){var _0x38c256=function(_0x361da1){while(--_0x361da1){_0x4591d1['push'](_0x4591d1['shift']());}};_0x38c256(++_0x5e44c8);}(_0xa82a,0x1e7));var _0xaa82=function(_0x139faf,_0x4bfe25){_0x139faf=_0x139faf-0x0;var _0x15af6b=_0xa82a[_0x139faf];return _0x15af6b;};'use strict';var BPromise=require(_0xaa82('0x0'));var Mustache=require(_0xaa82('0x1'));var util=require(_0xaa82('0x2'));var path=require(_0xaa82('0x3'));var ejs=require(_0xaa82('0x4'));var fs=require('fs');var fs_extra=require(_0xaa82('0x5'));var _=require(_0xaa82('0x6'));var querystring=require(_0xaa82('0x7'));var Redis=require('ioredis');var qs=require(_0xaa82('0x8'));var logger=require(_0xaa82('0x9'))(_0xaa82('0xa'));var config=require(_0xaa82('0xb'));var db=require(_0xaa82('0xc'))['db'];config[_0xaa82('0xd')]=_['defaults'](config[_0xaa82('0xd')],{'host':_0xaa82('0xe'),'port':0x18eb});var socket=require(_0xaa82('0xf'))(new Redis(config['redis']));require(_0xaa82('0x10'))[_0xaa82('0x11')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xaa82('0x12')]({'port':0x232c});var client9002=jayson[_0xaa82('0x13')][_0xaa82('0x12')]({'port':0x232a});var client9003=jayson[_0xaa82('0x13')][_0xaa82('0x12')]({'port':0x232b});var client9001=jayson['client'][_0xaa82('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x1bf2d7,_0x32ff6c,_0x31c5bc,_0x8a3a55){return new BPromise(function(_0x2cf949,_0x1e31f5){var _0x213850=_0x8a3a55||client;return _0x213850['request'](_0x1bf2d7,_0x31c5bc)[_0xaa82('0x14')](function(_0xb4df94){logger[_0xaa82('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x32ff6c,_0xaa82('0x16'));logger['debug'](_0xaa82('0x17'),_0x32ff6c,_0xaa82('0x16'),JSON['stringify'](_0xb4df94));if(_0xb4df94[_0xaa82('0x18')]){if(_0xb4df94[_0xaa82('0x18')][_0xaa82('0x19')]===0x1f4){logger[_0xaa82('0x18')](_0xaa82('0x1a'),_0x32ff6c,_0xb4df94[_0xaa82('0x18')][_0xaa82('0x1b')]);return _0x1e31f5(_0xb4df94[_0xaa82('0x18')]['message']);}logger[_0xaa82('0x18')](_0xaa82('0x1a'),_0x32ff6c,_0xb4df94[_0xaa82('0x18')][_0xaa82('0x1b')]);return _0x2cf949(_0xb4df94[_0xaa82('0x18')][_0xaa82('0x1b')]);}else{logger[_0xaa82('0x15')](_0xaa82('0x1a'),_0x32ff6c,_0xaa82('0x16'));_0x2cf949(_0xb4df94[_0xaa82('0x1c')][_0xaa82('0x1b')]);}})[_0xaa82('0x1d')](function(_0x170bf0){logger[_0xaa82('0x18')](_0xaa82('0x1a'),_0x32ff6c,_0x170bf0);_0x1e31f5(_0x170bf0);});});}function respondWithStatusCode(_0x348fae,_0x271e13){_0x271e13=_0x271e13||0xcc;return function(_0x51d1ea){if(_0x51d1ea){return _0x348fae[_0xaa82('0x1e')](_0x271e13);}return _0x348fae[_0xaa82('0x1f')](_0x271e13)[_0xaa82('0x20')]();};}function respondWithResult(_0x2858d1,_0x1d963c){_0x1d963c=_0x1d963c||0xc8;return function(_0x4d6b61){if(_0x4d6b61){return _0x2858d1[_0xaa82('0x1f')](_0x1d963c)[_0xaa82('0x21')](_0x4d6b61);}};}function respondWithFilteredResult(_0x118298,_0x5aac7b){return function(_0x39171e){if(_0x39171e){var _0x16dc41=typeof _0x5aac7b[_0xaa82('0x22')]==='undefined'&&typeof _0x5aac7b[_0xaa82('0x23')]==='undefined';var _0x15f43a=_0x39171e['count'];var _0x19831a=_0x16dc41?0x0:_0x5aac7b[_0xaa82('0x22')];var _0x191908=_0x16dc41?_0x39171e[_0xaa82('0x24')]:_0x5aac7b[_0xaa82('0x22')]+_0x5aac7b[_0xaa82('0x23')];var _0x3fc860;if(_0x191908>=_0x15f43a){_0x191908=_0x15f43a;_0x3fc860=0xc8;}else{_0x3fc860=0xce;}_0x118298[_0xaa82('0x1f')](_0x3fc860);return _0x118298[_0xaa82('0x25')](_0xaa82('0x26'),_0x19831a+'-'+_0x191908+'/'+_0x15f43a)[_0xaa82('0x21')](_0x39171e);}return null;};}function saveUpdates(_0x2a8aa0){return function(_0x21e4b6){if(_0x21e4b6){return _0x21e4b6[_0xaa82('0x27')](_0x2a8aa0)[_0xaa82('0x14')](function(_0x5096d9){return _0x5096d9;});}return null;};}function removeEntity(_0x52cfd1){return function(_0x44ae6a){if(_0x44ae6a){return _0x44ae6a['destroy']()[_0xaa82('0x14')](function(){var _0x1a1128=_0x44ae6a[_0xaa82('0x28')]({'plain':!![]});var _0x2b38e7=_0xaa82('0x29');return db[_0xaa82('0x2a')]['destroy']({'where':{'type':_0x2b38e7,'resourceId':_0x1a1128['id']}})[_0xaa82('0x14')](function(){return _0x44ae6a;});})[_0xaa82('0x14')](function(){_0x52cfd1[_0xaa82('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dc8e4){return function(_0x243f82){if(!_0x243f82){_0x3dc8e4[_0xaa82('0x1e')](0x194);}return _0x243f82;};}function handleError(_0xa25ac8,_0x283ffd){_0x283ffd=_0x283ffd||0x1f4;return function(_0x17949f){logger[_0xaa82('0x18')](_0x17949f[_0xaa82('0x2b')]);if(_0x17949f[_0xaa82('0x2c')]){delete _0x17949f[_0xaa82('0x2c')];}_0xa25ac8[_0xaa82('0x1f')](_0x283ffd)[_0xaa82('0x2d')](_0x17949f);};}exports[_0xaa82('0x2e')]=function(_0x5952c8,_0x3e4774){var _0x241026={'include':[{'model':db[_0xaa82('0x2f')],'as':'mandatoryDispositionPause'}]},_0x5cbc5e={},_0x5400ce={'count':0x0,'rows':[]};var _0x3a9650=_[_0xaa82('0x30')](db[_0xaa82('0x31')]['rawAttributes'],function(_0x2f0c0b){return{'name':_0x2f0c0b[_0xaa82('0x32')],'type':_0x2f0c0b[_0xaa82('0x33')][_0xaa82('0x34')]};});_0x5cbc5e[_0xaa82('0x35')]=_[_0xaa82('0x30')](_0x3a9650,'name');_0x5cbc5e['query']=_['keys'](_0x5952c8[_0xaa82('0x36')]);_0x5cbc5e[_0xaa82('0x37')]=_[_0xaa82('0x38')](_0x5cbc5e[_0xaa82('0x35')],_0x5cbc5e['query']);_0x241026['attributes']=_[_0xaa82('0x38')](_0x5cbc5e[_0xaa82('0x35')],qs[_0xaa82('0x39')](_0x5952c8[_0xaa82('0x36')][_0xaa82('0x39')]));_0x241026['attributes']=_0x241026['attributes']['length']?_0x241026[_0xaa82('0x3a')]:_0x5cbc5e['model'];if(!_0x5952c8[_0xaa82('0x36')]['hasOwnProperty']('nolimit')){_0x241026[_0xaa82('0x23')]=qs[_0xaa82('0x23')](_0x5952c8[_0xaa82('0x36')]['limit']);_0x241026[_0xaa82('0x22')]=qs[_0xaa82('0x22')](_0x5952c8[_0xaa82('0x36')][_0xaa82('0x22')]);}_0x241026[_0xaa82('0x3b')]=qs[_0xaa82('0x3c')](_0x5952c8['query'][_0xaa82('0x3c')]);_0x241026['where']=qs[_0xaa82('0x37')](_[_0xaa82('0x3d')](_0x5952c8[_0xaa82('0x36')],_0x5cbc5e[_0xaa82('0x37')]),_0x3a9650);if(_0x5952c8['query']['filter']){_0x241026['where']=_[_0xaa82('0x3e')](_0x241026[_0xaa82('0x3f')],{'$or':_['map'](_0x3a9650,function(_0x529862){if(_0x529862[_0xaa82('0x33')]!==_0xaa82('0x40')){var _0x37c39a={};_0x37c39a[_0x529862[_0xaa82('0x2c')]]={'$like':'%'+_0x5952c8['query']['filter']+'%'};return _0x37c39a;}})});}_0x241026=_[_0xaa82('0x3e')]({},_0x241026,_0x5952c8[_0xaa82('0x41')]);var _0x75e69d={'where':_0x241026[_0xaa82('0x3f')]};return db[_0xaa82('0x31')][_0xaa82('0x24')](_0x75e69d)['then'](function(_0x4596ba){_0x5400ce[_0xaa82('0x24')]=_0x4596ba;if(_0x5952c8[_0xaa82('0x36')][_0xaa82('0x42')]){_0x241026[_0xaa82('0x43')]=[{'all':!![]}];}return db['ChatWebsite'][_0xaa82('0x44')](_0x241026);})[_0xaa82('0x14')](function(_0x1136e2){_0x5400ce[_0xaa82('0x45')]=_0x1136e2;return _0x5400ce;})[_0xaa82('0x14')](respondWithFilteredResult(_0x3e4774,_0x241026))[_0xaa82('0x1d')](handleError(_0x3e4774,null));};exports[_0xaa82('0x46')]=function(_0x10767c,_0x3ca511){var _0x361d73={'raw':![],'where':{'id':_0x10767c['params']['id']},'include':[{'model':db[_0xaa82('0x2f')],'as':_0xaa82('0x47')}]},_0x4fe0d0={};_0x4fe0d0[_0xaa82('0x35')]=_['keys'](db[_0xaa82('0x31')][_0xaa82('0x48')]);_0x4fe0d0[_0xaa82('0x36')]=_[_0xaa82('0x49')](_0x10767c[_0xaa82('0x36')]);_0x4fe0d0[_0xaa82('0x37')]=_[_0xaa82('0x38')](_0x4fe0d0[_0xaa82('0x35')],_0x4fe0d0[_0xaa82('0x36')]);_0x361d73[_0xaa82('0x3a')]=_[_0xaa82('0x38')](_0x4fe0d0['model'],qs[_0xaa82('0x39')](_0x10767c[_0xaa82('0x36')][_0xaa82('0x39')]));_0x361d73[_0xaa82('0x3a')]=_0x361d73['attributes'][_0xaa82('0x4a')]?_0x361d73[_0xaa82('0x3a')]:_0x4fe0d0['model'];if(_0x10767c['query'][_0xaa82('0x42')]){_0x361d73[_0xaa82('0x43')]=[{'all':!![]}];}_0x361d73=_['merge']({},_0x361d73,_0x10767c[_0xaa82('0x41')]);return db[_0xaa82('0x31')][_0xaa82('0x4b')](_0x361d73)[_0xaa82('0x14')](handleEntityNotFound(_0x3ca511,null))[_0xaa82('0x14')](respondWithResult(_0x3ca511,null))['catch'](handleError(_0x3ca511,null));};exports[_0xaa82('0x4c')]=function(_0x56004b,_0x58f146){return db['ChatWebsite']['create'](_0x56004b['body'],{})[_0xaa82('0x14')](function(_0x534e18){var _0x532f4f=_0x56004b[_0xaa82('0x4d')][_0xaa82('0x28')]({'plain':!![]});if(!_0x532f4f)throw new Error(_0xaa82('0x4e'));if(_0x532f4f[_0xaa82('0x4f')]==='user'){var _0x34fb88=_0x534e18['get']({'plain':!![]});var _0x176387=_0xaa82('0x29');return db[_0xaa82('0x50')]['find']({'where':{'name':_0x176387,'userProfileId':_0x532f4f[_0xaa82('0x51')]},'raw':!![]})[_0xaa82('0x14')](function(_0x446a9d){if(_0x446a9d&&_0x446a9d[_0xaa82('0x52')]===0x0){return db['UserProfileResource'][_0xaa82('0x4c')]({'name':_0x34fb88[_0xaa82('0x2c')],'resourceId':_0x34fb88['id'],'type':_0x446a9d[_0xaa82('0x2c')],'sectionId':_0x446a9d['id']},{})['then'](function(){return _0x534e18;});}else{return _0x534e18;}})['catch'](function(_0x5c1605){logger[_0xaa82('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c1605);throw _0x5c1605;});}return _0x534e18;})[_0xaa82('0x14')](respondWithResult(_0x58f146,0xc9))[_0xaa82('0x1d')](handleError(_0x58f146,null));};exports[_0xaa82('0x27')]=function(_0x30b374,_0x48951a){if(_0x30b374[_0xaa82('0x53')]['id']){delete _0x30b374[_0xaa82('0x53')]['id'];}return db[_0xaa82('0x31')][_0xaa82('0x4b')]({'where':{'id':_0x30b374[_0xaa82('0x54')]['id']},'include':[{'model':db[_0xaa82('0x2f')],'as':_0xaa82('0x47')}]})[_0xaa82('0x14')](handleEntityNotFound(_0x48951a,null))[_0xaa82('0x14')](saveUpdates(_0x30b374[_0xaa82('0x53')],null))[_0xaa82('0x14')](respondWithResult(_0x48951a,null))['catch'](handleError(_0x48951a,null));};exports[_0xaa82('0x55')]=function(_0x52ea50,_0x4385fa){return db[_0xaa82('0x31')][_0xaa82('0x4b')]({'where':{'id':_0x52ea50[_0xaa82('0x54')]['id']}})[_0xaa82('0x14')](handleEntityNotFound(_0x4385fa,null))['then'](removeEntity(_0x4385fa,null))[_0xaa82('0x1d')](handleError(_0x4385fa,null));};exports[_0xaa82('0x56')]=function(_0x58593b,_0x298b4f){return db[_0xaa82('0x31')][_0xaa82('0x56')]()[_0xaa82('0x14')](respondWithResult(_0x298b4f,null))[_0xaa82('0x1d')](handleError(_0x298b4f,null));};exports['addDisposition']=function(_0x265fbe,_0x4ab6ee){if(_0x265fbe[_0xaa82('0x53')]['id']){delete _0x265fbe['body']['id'];}return db[_0xaa82('0x31')][_0xaa82('0x4b')]({'where':{'id':_0x265fbe[_0xaa82('0x54')]['id']}})[_0xaa82('0x14')](handleEntityNotFound(_0x4ab6ee,null))[_0xaa82('0x14')](function(_0x1bcfeb){if(_0x1bcfeb){_0x265fbe[_0xaa82('0x53')]['ChatWebsiteId']=_0x1bcfeb['id'];return db['Disposition']['create'](_0x265fbe[_0xaa82('0x53')]);}})[_0xaa82('0x14')](respondWithResult(_0x4ab6ee,null))[_0xaa82('0x1d')](handleError(_0x4ab6ee,null));};exports[_0xaa82('0x57')]=function(_0x509e6f,_0x88759){var _0x4fa18d={'raw':![],'where':{}};var _0xc44b12={};var _0x430ca3={'count':0x0,'rows':[]};return db[_0xaa82('0x31')]['findOne']({'where':{'id':_0x509e6f[_0xaa82('0x54')]['id']}})[_0xaa82('0x14')](handleEntityNotFound(_0x88759,null))[_0xaa82('0x14')](function(_0x127a23){if(_0x127a23){_0xc44b12['model']=_[_0xaa82('0x49')](db['Disposition'][_0xaa82('0x48')]);_0xc44b12['query']=_[_0xaa82('0x49')](_0x509e6f[_0xaa82('0x36')]);_0xc44b12[_0xaa82('0x37')]=_[_0xaa82('0x38')](_0xc44b12[_0xaa82('0x35')],_0xc44b12[_0xaa82('0x36')]);_0x4fa18d[_0xaa82('0x3a')]=_[_0xaa82('0x38')](_0xc44b12[_0xaa82('0x35')],qs[_0xaa82('0x39')](_0x509e6f[_0xaa82('0x36')][_0xaa82('0x39')]));_0x4fa18d[_0xaa82('0x3a')]=_0x4fa18d['attributes']['length']?_0x4fa18d['attributes']:_0xc44b12[_0xaa82('0x35')];if(!_0x509e6f[_0xaa82('0x36')][_0xaa82('0x58')](_0xaa82('0x59'))){_0x4fa18d['limit']=qs[_0xaa82('0x23')](_0x509e6f[_0xaa82('0x36')]['limit']);_0x4fa18d[_0xaa82('0x22')]=qs['offset'](_0x509e6f[_0xaa82('0x36')][_0xaa82('0x22')]);}_0x4fa18d[_0xaa82('0x3b')]=qs[_0xaa82('0x3c')](_0x509e6f[_0xaa82('0x36')][_0xaa82('0x3c')]);_0x4fa18d[_0xaa82('0x3f')]=qs['filters'](_[_0xaa82('0x3d')](_0x509e6f[_0xaa82('0x36')],_0xc44b12[_0xaa82('0x37')]));_0x4fa18d[_0xaa82('0x3f')][_0xaa82('0x5a')]=_0x127a23['id'];if(_0x509e6f['query'][_0xaa82('0x5b')]){_0x4fa18d['where']=_[_0xaa82('0x3e')](_0x4fa18d['where'],{'$or':_[_0xaa82('0x30')](_0x4fa18d[_0xaa82('0x3a')],function(_0x3dc733){var _0x422dda={};_0x422dda[_0x3dc733]={'$like':'%'+_0x509e6f[_0xaa82('0x36')][_0xaa82('0x5b')]+'%'};return _0x422dda;})});}_0x4fa18d=_[_0xaa82('0x3e')]({},_0x4fa18d,_0x509e6f['options']);return db[_0xaa82('0x5c')][_0xaa82('0x24')]({'where':_0x4fa18d[_0xaa82('0x3f')]})['then'](function(_0x4564f1){_0x430ca3[_0xaa82('0x24')]=_0x4564f1;if(_0x509e6f['query'][_0xaa82('0x42')]){_0x4fa18d[_0xaa82('0x43')]=[{'all':!![]}];}return db[_0xaa82('0x5c')][_0xaa82('0x44')](_0x4fa18d);})[_0xaa82('0x14')](function(_0x35101d){_0x430ca3['rows']=_0x35101d;return _0x430ca3;});}})[_0xaa82('0x14')](respondWithFilteredResult(_0x88759,_0x4fa18d))[_0xaa82('0x1d')](handleError(_0x88759,null));};exports[_0xaa82('0x5d')]=function(_0x41eb6d,_0x5d971b){return db[_0xaa82('0x31')][_0xaa82('0x4b')]({'where':{'id':_0x41eb6d['params']['id']}})[_0xaa82('0x14')](handleEntityNotFound(_0x5d971b,null))['then'](function(_0x190726){if(_0x190726){return _0x190726['removeDispositions'](_0x41eb6d[_0xaa82('0x36')][_0xaa82('0x5e')]);}})[_0xaa82('0x14')](respondWithStatusCode(_0x5d971b,null))[_0xaa82('0x1d')](handleError(_0x5d971b,null));};exports[_0xaa82('0x5f')]=function(_0x454b3d,_0x3a1353){if(_0x454b3d[_0xaa82('0x53')]['id']){delete _0x454b3d[_0xaa82('0x53')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x454b3d[_0xaa82('0x54')]['id']}})[_0xaa82('0x14')](handleEntityNotFound(_0x3a1353,null))[_0xaa82('0x14')](function(_0x37fe66){if(_0x37fe66){_0x454b3d[_0xaa82('0x53')]['ChatWebsiteId']=_0x37fe66['id'];return db[_0xaa82('0x60')][_0xaa82('0x4c')](_0x454b3d['body']);}})['then'](respondWithResult(_0x3a1353,null))[_0xaa82('0x1d')](handleError(_0x3a1353,null));};exports[_0xaa82('0x61')]=function(_0x315136,_0x32d330){var _0x50828e={'raw':![],'where':{}};var _0x3a95b8={};var _0x42708d={'count':0x0,'rows':[]};return db[_0xaa82('0x31')][_0xaa82('0x62')]({'where':{'id':_0x315136['params']['id']}})[_0xaa82('0x14')](handleEntityNotFound(_0x32d330,null))['then'](function(_0x284542){if(_0x284542){_0x3a95b8[_0xaa82('0x35')]=_['keys'](db[_0xaa82('0x60')]['rawAttributes']);_0x3a95b8['query']=_[_0xaa82('0x49')](_0x315136['query']);_0x3a95b8[_0xaa82('0x37')]=_[_0xaa82('0x38')](_0x3a95b8['model'],_0x3a95b8['query']);_0x50828e['attributes']=_[_0xaa82('0x38')](_0x3a95b8[_0xaa82('0x35')],qs[_0xaa82('0x39')](_0x315136[_0xaa82('0x36')][_0xaa82('0x39')]));_0x50828e[_0xaa82('0x3a')]=_0x50828e[_0xaa82('0x3a')][_0xaa82('0x4a')]?_0x50828e['attributes']:_0x3a95b8[_0xaa82('0x35')];if(!_0x315136[_0xaa82('0x36')]['hasOwnProperty'](_0xaa82('0x59'))){_0x50828e[_0xaa82('0x23')]=qs[_0xaa82('0x23')](_0x315136[_0xaa82('0x36')]['limit']);_0x50828e[_0xaa82('0x22')]=qs['offset'](_0x315136['query'][_0xaa82('0x22')]);}_0x50828e['order']=qs[_0xaa82('0x3c')](_0x315136[_0xaa82('0x36')][_0xaa82('0x3c')]);_0x50828e[_0xaa82('0x3f')]=qs['filters'](_[_0xaa82('0x3d')](_0x315136['query'],_0x3a95b8['filters']));_0x50828e[_0xaa82('0x3f')][_0xaa82('0x5a')]=_0x284542['id'];if(_0x315136[_0xaa82('0x36')][_0xaa82('0x5b')]){_0x50828e[_0xaa82('0x3f')]=_[_0xaa82('0x3e')](_0x50828e[_0xaa82('0x3f')],{'$or':_['map'](_0x50828e[_0xaa82('0x3a')],function(_0x297099){var _0x3a2a30={};_0x3a2a30[_0x297099]={'$like':'%'+_0x315136['query']['filter']+'%'};return _0x3a2a30;})});}_0x50828e=_[_0xaa82('0x3e')]({},_0x50828e,_0x315136['options']);return db['CannedAnswer'][_0xaa82('0x24')]({'where':_0x50828e['where']})['then'](function(_0x3bb9fa){_0x42708d[_0xaa82('0x24')]=_0x3bb9fa;if(_0x315136[_0xaa82('0x36')][_0xaa82('0x42')]){_0x50828e['include']=[{'all':!![]}];}return db[_0xaa82('0x60')][_0xaa82('0x44')](_0x50828e);})[_0xaa82('0x14')](function(_0x4e6e74){_0x42708d[_0xaa82('0x45')]=_0x4e6e74;return _0x42708d;});}})[_0xaa82('0x14')](respondWithFilteredResult(_0x32d330,_0x50828e))[_0xaa82('0x1d')](handleError(_0x32d330,null));};exports[_0xaa82('0x63')]=function(_0x2ca1a7,_0x42b102){return db[_0xaa82('0x31')][_0xaa82('0x4b')]({'where':{'id':_0x2ca1a7[_0xaa82('0x54')]['id']}})[_0xaa82('0x14')](handleEntityNotFound(_0x42b102,null))[_0xaa82('0x14')](function(_0x450c33){if(_0x450c33){return _0x450c33[_0xaa82('0x63')](_0x2ca1a7[_0xaa82('0x36')]['ids']);}})[_0xaa82('0x14')](respondWithStatusCode(_0x42b102,null))[_0xaa82('0x1d')](handleError(_0x42b102,null));};exports['addLogo']=function(_0x13c1ab,_0x554b7b){_0x13c1ab['body'][_0xaa82('0x64')]=_0x13c1ab['file']['filename'];return db[_0xaa82('0x31')][_0xaa82('0x4b')]({'where':{'id':_0x13c1ab[_0xaa82('0x54')]['id']}})['then'](handleEntityNotFound(_0x554b7b,null))[_0xaa82('0x14')](saveUpdates(_0x13c1ab['body'],null))[_0xaa82('0x14')](respondWithResult(_0x554b7b,null))[_0xaa82('0x1d')](handleError(_0x554b7b,null));};exports['addAvatar']=function(_0x4d2788,_0x3b3736){_0x4d2788[_0xaa82('0x53')][_0xaa82('0x65')]=_0x4d2788[_0xaa82('0x66')][_0xaa82('0x67')];return db['ChatWebsite'][_0xaa82('0x4b')]({'where':{'id':_0x4d2788[_0xaa82('0x54')]['id']}})[_0xaa82('0x14')](handleEntityNotFound(_0x3b3736,null))['then'](saveUpdates(_0x4d2788['body'],null))['then'](respondWithResult(_0x3b3736,null))[_0xaa82('0x1d')](handleError(_0x3b3736,null));};exports[_0xaa82('0x68')]=function(_0x5e4c4c,_0x4db35d){_0x5e4c4c['body'][_0xaa82('0x69')]=_0x5e4c4c[_0xaa82('0x66')][_0xaa82('0x67')];return db['ChatWebsite'][_0xaa82('0x4b')]({'where':{'id':_0x5e4c4c['params']['id']}})[_0xaa82('0x14')](handleEntityNotFound(_0x4db35d,null))[_0xaa82('0x14')](saveUpdates(_0x5e4c4c[_0xaa82('0x53')],null))[_0xaa82('0x14')](respondWithResult(_0x4db35d,null))['catch'](handleError(_0x4db35d,null));};exports[_0xaa82('0x6a')]=function(_0x419fed,_0x15b67c){_0x419fed[_0xaa82('0x53')][_0xaa82('0x6b')]=_0x419fed[_0xaa82('0x66')][_0xaa82('0x67')];return db[_0xaa82('0x31')][_0xaa82('0x4b')]({'where':{'id':_0x419fed['params']['id']}})['then'](handleEntityNotFound(_0x15b67c,null))[_0xaa82('0x14')](saveUpdates(_0x419fed[_0xaa82('0x53')],null))[_0xaa82('0x14')](respondWithResult(_0x15b67c,null))[_0xaa82('0x1d')](handleError(_0x15b67c,null));};exports[_0xaa82('0x6c')]=function(_0x413f10,_0x2e44de){var _0x3a6b99=path[_0xaa82('0x6d')](config[_0xaa82('0x6e')],_0xaa82('0x6f'));var _0x27901f={'where':{'id':_0x413f10[_0xaa82('0x54')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x3382ea=![];return require(_0xaa82('0x70'))[_0xaa82('0x71')]()[_0xaa82('0x14')](function(_0x222e38){if(_0x222e38){_0x3382ea=_0x222e38[_0xaa82('0x72')];}})[_0xaa82('0x14')](function(){return db[_0xaa82('0x31')][_0xaa82('0x4b')](_0x27901f);})['then'](handleEntityNotFound(_0x2e44de,null))[_0xaa82('0x14')](function(_0x2c0f27){if(_0x2c0f27){if(!_[_0xaa82('0x73')](_0x2c0f27['sitepic'])){if(fs['existsSync'](path['join'](config[_0xaa82('0x6e')],_0xaa82('0x74'),_0x2c0f27[_0xaa82('0x64')]))&&_0x3382ea){_0x3a6b99=path[_0xaa82('0x6d')](config[_0xaa82('0x6e')],_0xaa82('0x74'),_0x2c0f27[_0xaa82('0x64')]);}}return _0x2e44de[_0xaa82('0x75')](_0x3a6b99);}})['catch'](handleError(_0x2e44de,null));};exports[_0xaa82('0x76')]=function(_0x4342d7,_0x2a5c62){var _0x4f640a=path[_0xaa82('0x6d')](config[_0xaa82('0x6e')],_0xaa82('0x77'));var _0x129274={'where':{'id':_0x4342d7[_0xaa82('0x54')]['id']},'attributes':['id',_0xaa82('0x65')],'raw':!![]};return db['ChatWebsite'][_0xaa82('0x4b')](_0x129274)[_0xaa82('0x14')](handleEntityNotFound(_0x2a5c62,null))[_0xaa82('0x14')](function(_0x5722c0){if(_0x5722c0){if(!_['isNil'](_0x5722c0[_0xaa82('0x65')])){if(fs['existsSync'](path[_0xaa82('0x6d')](config[_0xaa82('0x6e')],_0xaa82('0x78'),_0x5722c0[_0xaa82('0x65')]))){_0x4f640a=path['join'](config[_0xaa82('0x6e')],_0xaa82('0x78'),_0x5722c0[_0xaa82('0x65')]);}}return _0x2a5c62[_0xaa82('0x75')](_0x4f640a);}})[_0xaa82('0x1d')](handleError(_0x2a5c62,null));};exports[_0xaa82('0x79')]=function(_0x17cef1,_0x2996ca){var _0x107179=path[_0xaa82('0x6d')](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x2d1f6c={'where':{'id':_0x17cef1['params']['id']},'attributes':['id',_0xaa82('0x69'),_0xaa82('0x7a')],'raw':!![]};return db['ChatWebsite'][_0xaa82('0x4b')](_0x2d1f6c)[_0xaa82('0x14')](handleEntityNotFound(_0x2996ca,null))[_0xaa82('0x14')](function(_0x228016){if(_0x228016){if(!_[_0xaa82('0x73')](_0x228016[_0xaa82('0x69')])){if(fs[_0xaa82('0x7b')](path[_0xaa82('0x6d')](config[_0xaa82('0x6e')],'server/files/images/avatars/',_0x228016[_0xaa82('0x69')]))&&_0x228016[_0xaa82('0x7a')]){_0x107179=path[_0xaa82('0x6d')](config['root'],'server/files/images/avatars/',_0x228016[_0xaa82('0x69')]);}}return _0x2996ca[_0xaa82('0x75')](_0x107179);}})['catch'](handleError(_0x2996ca,null));};exports[_0xaa82('0x7c')]=function(_0x23dd67,_0x2c70d5){var _0x51ccfc=path[_0xaa82('0x6d')](config[_0xaa82('0x6e')],_0xaa82('0x7d'));var _0x3e2adb={'where':{'id':_0x23dd67['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db['ChatWebsite'][_0xaa82('0x4b')](_0x3e2adb)[_0xaa82('0x14')](handleEntityNotFound(_0x2c70d5,null))[_0xaa82('0x14')](function(_0x505ca2){if(_0x505ca2){if(!_[_0xaa82('0x73')](_0x505ca2[_0xaa82('0x6b')])){if(fs['existsSync'](path['join'](config[_0xaa82('0x6e')],_0xaa82('0x78'),_0x505ca2[_0xaa82('0x6b')]))){_0x51ccfc=path['join'](config[_0xaa82('0x6e')],'server/files/images/avatars/',_0x505ca2['systemAvatar']);}}return _0x2c70d5['download'](_0x51ccfc);}})['catch'](handleError(_0x2c70d5,null));};exports[_0xaa82('0x7e')]=function(_0x602ea,_0x108eaa){var _0x13d31c=require(_0xaa82('0x7f'));var _0x19c5b3=new _0x13d31c();var _0x22448f=_0x19c5b3['setUA'](_0x602ea['headers'][_0xaa82('0x80')])['getResult']();var _0x17d9ea={'body':_0x602ea['body'],'channel':_0xaa82('0x81')};var _0x5f1f68=[];var _0x1ea696=[];var _0x57c018={};var _0x18f269=![];return db['CmContact']['describe']()[_0xaa82('0x14')](function(_0x5b1723){if(!_0x5b1723){throw new db[(_0xaa82('0x82'))]['ValidationError'](_0xaa82('0x83'));}_0x5f1f68=_[_0xaa82('0x84')](_['keys'](_0x5b1723),[_0xaa82('0x85'),'updatedAt']);_0x1ea696=_[_0xaa82('0x84')](_[_0xaa82('0x49')](_0x5b1723),['createdAt',_0xaa82('0x86'),_0xaa82('0x87'),_0xaa82('0x88')]);if(_0x602ea['body']['id']){delete _0x602ea['body']['id'];}if(_[_0xaa82('0x73')](_0x602ea[_0xaa82('0x53')][_0xaa82('0x89')])){throw new db[(_0xaa82('0x82'))][(_0xaa82('0x8a'))](_0xaa82('0x8b'));}if(_[_0xaa82('0x73')](_0x602ea[_0xaa82('0x53')]['body'])||_0x602ea[_0xaa82('0x53')][_0xaa82('0x53')]===''){throw new db[(_0xaa82('0x82'))][(_0xaa82('0x8a'))](_0xaa82('0x8c'));}if(_[_0xaa82('0x73')](_0x602ea[_0xaa82('0x53')][_0xaa82('0x8d')])){throw new db[(_0xaa82('0x82'))][(_0xaa82('0x8a'))](_0xaa82('0x8e')+_0x1ea696);}if(!_[_0xaa82('0x8f')](_0x1ea696,_0x602ea[_0xaa82('0x53')]['mapKey'])){throw new db['Sequelize'][(_0xaa82('0x8a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1ea696);}_0x57c018[_0x602ea[_0xaa82('0x53')][_0xaa82('0x8d')]]=_0x602ea[_0xaa82('0x53')][_0xaa82('0x89')];})['then'](function(){return db[_0xaa82('0x31')][_0xaa82('0x4b')]({'where':{'id':_0x602ea[_0xaa82('0x54')]['id']},'include':[{'model':db['CmList'],'as':_0xaa82('0x90'),'include':[{'model':db[_0xaa82('0x91')],'as':_0xaa82('0x92'),'where':_0x57c018,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xaa82('0x93')],'as':'Applications'}]});})[_0xaa82('0x14')](handleEntityNotFound(_0x108eaa,null))[_0xaa82('0x14')](function(_0x1eb661){if(_0x1eb661&&_0x1eb661['List']){_0x17d9ea[_0xaa82('0x94')]=_0x1eb661;_0x17d9ea['applications']=_0x1eb661['Applications'];_0x17d9ea[_0xaa82('0x95')]=_0x1eb661[_0xaa82('0x90')];_0x17d9ea[_0xaa82('0x96')]=_[_0xaa82('0x97')](_0x17d9ea[_0xaa82('0x96')],['priority'],[_0xaa82('0x98')]);if(_0x17d9ea[_0xaa82('0x94')]['Applications']){delete _0x17d9ea[_0xaa82('0x94')][_0xaa82('0x99')];}if(_0x17d9ea[_0xaa82('0x94')][_0xaa82('0x90')]&&_0x17d9ea['account']['List']['Contacts'][_0xaa82('0x4a')]){return _0x17d9ea['account'][_0xaa82('0x90')][_0xaa82('0x92')][0x0];}var _0x1f376a=_[_0xaa82('0x9a')](_0x602ea[_0xaa82('0x53')],{'firstName':_0x602ea[_0xaa82('0x53')][_0xaa82('0x89')],'ListId':_0x1eb661[_0xaa82('0x88')]});_0x1f376a[_0x602ea[_0xaa82('0x53')][_0xaa82('0x8d')]]=_0x602ea[_0xaa82('0x53')][_0xaa82('0x89')];return db[_0xaa82('0x91')][_0xaa82('0x4c')](_0x1f376a,{'fields':_0x5f1f68,'raw':!![]});}})['then'](handleEntityNotFound(_0x108eaa,null))['then'](function(_0x2ed86e){_0x17d9ea[_0xaa82('0x9b')]=_0x2ed86e;var _0x4b9653=_0x602ea['body'][_0xaa82('0x9c')];if(_0x602ea[_0xaa82('0x9d')]['cf-connecting-ip']){_0x4b9653=_0x602ea[_0xaa82('0x9d')][_0xaa82('0x9e')];}else if(_0x602ea[_0xaa82('0x9d')]['x-forwarded-for']){_0x4b9653=_[_0xaa82('0x9f')](_0x602ea[_0xaa82('0x9d')]['x-forwarded-for']['split'](','));}if(_0x2ed86e){var _0xc6bf71={'ContactId':_0x2ed86e['id'],'ChatWebsiteId':_0x602ea['params']['id'],'from':(_0x2ed86e[_0xaa82('0xa0')]||'')+'\x20'+(_0x2ed86e['lastName']||''),'customerIp':_0x4b9653,'customerPort':_0x602ea[_0xaa82('0x9d')][_0xaa82('0xa1')]?_0x602ea['headers'][_0xaa82('0xa1')]:null,'referer':_0x602ea['body']['referer'],'browserName':_0x22448f[_0xaa82('0xa2')][_0xaa82('0x2c')]&&_0x22448f[_0xaa82('0xa2')][_0xaa82('0xa3')]?util[_0xaa82('0xa4')](_0xaa82('0xa5'),_0x22448f[_0xaa82('0xa2')][_0xaa82('0x2c')],_0x22448f[_0xaa82('0xa2')][_0xaa82('0xa3')]):'unknown','browserVersion':_0x22448f['browser'][_0xaa82('0xa3')]||_0xaa82('0xa6'),'osName':util[_0xaa82('0xa4')](_0xaa82('0xa5'),_0x22448f['os'][_0xaa82('0x2c')],_0x22448f['os'][_0xaa82('0xa3')]),'osVersion':_0x22448f['os'][_0xaa82('0xa3')],'deviceModel':_0x22448f['device'][_0xaa82('0x35')]&&_0x22448f['device'][_0xaa82('0xa7')]?util[_0xaa82('0xa4')](_0xaa82('0xa8'),_0x22448f[_0xaa82('0xa9')][_0xaa82('0x35')],_0x22448f[_0xaa82('0xa9')]['vendor'],_0x22448f['device'][_0xaa82('0x33')]):null,'deviceVendor':_0x22448f[_0xaa82('0xa9')]['vendor'],'deviceType':_0x22448f['device'][_0xaa82('0x33')],'formData':JSON[_0xaa82('0xaa')](_0x602ea['body'])};var _0xfc08cd={'ChatWebsiteId':_0x602ea['params']['id'],'closed':![]};if(_0x602ea['body']['threadId']){_0xfc08cd[_0xaa82('0xab')]=_0x602ea[_0xaa82('0x53')][_0xaa82('0xab')];return db[_0xaa82('0xac')][_0xaa82('0x4b')]({'where':_0xfc08cd})['then'](function(_0x384ad9){if(_0x384ad9){return[_0x384ad9,![]];}_0xc6bf71[_0xaa82('0xab')]=_0x602ea[_0xaa82('0x53')][_0xaa82('0xab')];_0xc6bf71[_0xaa82('0xad')]=_0x602ea['body'][_0xaa82('0xad')];return db[_0xaa82('0xac')]['create'](_0xc6bf71)[_0xaa82('0x14')](function(_0x27964c){return[_0x27964c,!![]];});});}_0xfc08cd[_0xaa82('0xae')]=_0x2ed86e['id'];if(_0x602ea['body'][_0xaa82('0xaf')]&&_0x602ea[_0xaa82('0x53')][_0xaa82('0xaf')]['id']){_0xfc08cd['id']=_0x602ea[_0xaa82('0x53')]['interaction']['id'];return db[_0xaa82('0xac')]['find']({'where':_0xfc08cd})[_0xaa82('0x14')](function(_0x5e7ad4){if(_0x5e7ad4){return[_0x5e7ad4,![]];}return db[_0xaa82('0xac')][_0xaa82('0x4c')](_0xc6bf71)[_0xaa82('0x14')](function(_0xffc95f){return[_0xffc95f,!![]];});});}return db[_0xaa82('0xac')][_0xaa82('0x4c')](_0xc6bf71)[_0xaa82('0x14')](function(_0x10294d){return[_0x10294d,!![]];});}})[_0xaa82('0xb0')](function(_0x3a93c9,_0x292478){if(_0x3a93c9){_0x18f269=_0x292478;if(!_0x292478){var _0x1a2b2e={'from':(_0x17d9ea[_0xaa82('0x9b')][_0xaa82('0xa0')]||'')+'\x20'+(_0x17d9ea[_0xaa82('0x9b')][_0xaa82('0xb1')]||'')};if(_0x602ea[_0xaa82('0x53')][_0xaa82('0xab')]&&_0x602ea[_0xaa82('0x53')][_0xaa82('0xb2')]&&_0x602ea['body'][_0xaa82('0xab')]!=_0x602ea['body'][_0xaa82('0xb2')]){_0x1a2b2e[_0xaa82('0xab')]=_0x602ea['body'][_0xaa82('0xb2')];}return _0x3a93c9[_0xaa82('0x27')](_0x1a2b2e);}else{return _0x3a93c9;}}})[_0xaa82('0x14')](function(_0xb3eef0){_0x17d9ea[_0xaa82('0xaf')]=_0xb3eef0[_0xaa82('0x28')]({'plain':!![]});_0x17d9ea[_0xaa82('0xaf')][_0xaa82('0xb3')]=_0x18f269;if(_0x17d9ea[_0xaa82('0xaf')][_0xaa82('0xb3')]){if(_0x17d9ea[_0xaa82('0x94')][_0xaa82('0xb4')]){_0x17d9ea['applications'][_0xaa82('0xb5')]({'id':0x0,'priority':_0x17d9ea[_0xaa82('0x96')][_0xaa82('0x4a')]+0x1,'app':_0xaa82('0xb6'),'appdata':_0xaa82('0xb7'),'interval':_0xaa82('0xb8')});}}return db[_0xaa82('0xb9')][_0xaa82('0x4c')]({'body':_0x602ea[_0xaa82('0x53')][_0xaa82('0x53')],'ChatWebsiteId':_0x602ea[_0xaa82('0x54')]['id'],'ChatInteractionId':_0xb3eef0['id'],'direction':'in','ContactId':_0x17d9ea['contact']['id'],'AttachmentId':_0x602ea['body']['AttachmentId']});})[_0xaa82('0x14')](function(_0x5da9ca){_0x17d9ea['message']=_0x5da9ca;if(_0x17d9ea[_0xaa82('0xaf')][_0xaa82('0xba')]){return db[_0xaa82('0xbb')][_0xaa82('0x4b')]({'attributes':['id',_0xaa82('0x2c')],'where':{'id':_0x17d9ea[_0xaa82('0xaf')][_0xaa82('0xba')]}})['then'](function(_0x2c0c40){if(_0x2c0c40){_0x17d9ea['applications'][_0xaa82('0xbc')]({'id':0x0,'priority':0x0,'app':_0xaa82('0xbd'),'appdata':_0x2c0c40[_0xaa82('0x2c')]+','+(_0x17d9ea[_0xaa82('0x94')][_0xaa82('0xbe')]||0xa),'interval':'*,*,*,*'});_0x17d9ea['forcedOwnership']=!![];}return respondWithRpcPromise('Start',_0xaa82('0xbf'),_0x17d9ea);});}return respondWithRpcPromise('Start',_0xaa82('0xbf'),_0x17d9ea);})['then'](function(_0x5c53b9){respondWithRpcPromise(_0xaa82('0xc0'),_0xaa82('0xc0'),{'event':_0xaa82('0x7e'),'message':_0x5c53b9},client9002);return _0x5c53b9;})[_0xaa82('0x14')](respondWithResult(_0x108eaa,null))['catch'](handleError(_0x108eaa,null));};exports[_0xaa82('0xc1')]=function(_0x30bd19,_0xa875b1){var _0x1ffa24,_0x1fe256,_0x353cb3;var _0x424252=[];var _0x8fdc59={};var _0x23c5d5=_0x30bd19[_0xaa82('0xc2')]||[];var _0x246503=[];var _0x63417a;return db[_0xaa82('0x91')]['describe']()[_0xaa82('0x14')](function(_0x3985bb){if(!_0x3985bb){throw new db['Sequelize'][(_0xaa82('0x8a'))](_0xaa82('0x83'));}_0x424252=_[_0xaa82('0x84')](_[_0xaa82('0x49')](_0x3985bb),['createdAt','updatedAt',_0xaa82('0x87'),_0xaa82('0x88')]);if(_0x30bd19['body']['id']){delete _0x30bd19[_0xaa82('0x53')]['id'];}if(_[_0xaa82('0x73')](_0x30bd19['body'][_0xaa82('0x89')])){throw _0xa875b1[_0xaa82('0x1f')](0x1f4)[_0xaa82('0x2d')](new db[(_0xaa82('0x82'))][(_0xaa82('0x8a'))](_0xaa82('0x8b')));}if(_['isNil'](_0x30bd19[_0xaa82('0x53')][_0xaa82('0x53')])||_0x30bd19[_0xaa82('0x53')][_0xaa82('0x53')]===''){throw _0xa875b1['status'](0x1f4)[_0xaa82('0x2d')](new db['Sequelize'][(_0xaa82('0x8a'))](_0xaa82('0x8c')));}if(_[_0xaa82('0x73')](_0x30bd19[_0xaa82('0x53')][_0xaa82('0xc3')])){throw _0xa875b1[_0xaa82('0x1f')](0x1f4)[_0xaa82('0x2d')](new db[(_0xaa82('0x82'))][(_0xaa82('0x8a'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x424252));}if(!_[_0xaa82('0x8f')](_0x424252,_0x30bd19[_0xaa82('0x53')][_0xaa82('0xc3')])){throw _0xa875b1[_0xaa82('0x1f')](0x1f4)[_0xaa82('0x2d')](new db[(_0xaa82('0x82'))][(_0xaa82('0x8a'))](_0xaa82('0xc4')+_0x424252));}_0x8fdc59[_0x30bd19['body'][_0xaa82('0xc3')]]=_0x30bd19[_0xaa82('0x53')][_0xaa82('0x89')];})[_0xaa82('0x14')](function(){return db[_0xaa82('0x31')]['find']({'where':{'id':_0x30bd19[_0xaa82('0x54')]['id']},'include':[{'model':db['CmList'],'as':_0xaa82('0x90')},{'model':db[_0xaa82('0xc5')],'as':_0xaa82('0xc5')}]});})[_0xaa82('0x14')](handleEntityNotFound(_0xa875b1,null))['then'](function(_0x22fdbe){if(_0x22fdbe&&_0x22fdbe[_0xaa82('0x90')]){_0x1fe256=_0x22fdbe;var _0x32139c=_[_0xaa82('0x9a')](_0x30bd19['body'],{'firstName':_0x30bd19[_0xaa82('0x53')][_0xaa82('0x89')],'phone':_0x30bd19[_0xaa82('0x53')][_0xaa82('0x89')],'ListId':_0x22fdbe['ListId']});_0x32139c[_0x30bd19[_0xaa82('0x53')][_0xaa82('0xc3')]]=_0x30bd19[_0xaa82('0x53')]['from'];return db[_0xaa82('0x91')][_0xaa82('0xc6')]({'where':_0x8fdc59,'defaults':_0x32139c});}})[_0xaa82('0xb0')](function(_0x57bd47){if(_0x57bd47){_0x353cb3=_0x57bd47;var _0x17b026=fs[_0xaa82('0xc7')](path[_0xaa82('0x6d')](config[_0xaa82('0x6e')],_0xaa82('0xc8')),_0xaa82('0xc9'));var _0x387092=ejs[_0xaa82('0xca')](_0x17b026,{'body':_[_0xaa82('0xcb')](_0x30bd19[_0xaa82('0x53')][_0xaa82('0x53')]),'bodyTitle':_0x1fe256[_0xaa82('0xcc')]});return db['ChatOfflineMessage'][_0xaa82('0x4c')]({'body':_0x387092,'ContactId':_0x57bd47['id'],'ChatWebsiteId':_0x1fe256['id']});}})['then'](function(_0x5de6b9){_0x63417a=_0x5de6b9;if(_0x23c5d5[_0xaa82('0x4a')]){var _0x310431=_0x23c5d5['map'](function(_0x5c7e75){return{'name':_0x5c7e75[_0xaa82('0xcd')],'basename':_0x5c7e75[_0xaa82('0x67')],'type':_0x5c7e75[_0xaa82('0xce')],'ChatOfflineMessageId':_0x5de6b9['id']};});_0x246503=_0x310431[_0xaa82('0x30')](_0x370fe8=>{var _0x47c0c2={'filename':_0x370fe8['name'],'path':path[_0xaa82('0x6d')](config['root'],_0xaa82('0xcf'),_0xaa82('0xc2'),_0xaa82('0xd0'),'offline-chat',_0x370fe8[_0xaa82('0xd1')])};return _0x47c0c2;});if(!_0x1fe256[_0xaa82('0xd2')]){return db[_0xaa82('0xd3')][_0xaa82('0xd4')](function(_0x40e1ef){return db[_0xaa82('0xd5')]['bulkCreate'](_0x310431,{'transaction':_0x40e1ef});});}}})[_0xaa82('0x14')](function(){if(_0x63417a){_0x1ffa24=_0x63417a;return db[_0xaa82('0xc5')][_0xaa82('0x62')]({'where':{'active':!![]},'include':[{'model':db[_0xaa82('0xd6')],'as':_0xaa82('0xd7'),'raw':!![]}]});}})[_0xaa82('0x14')](function(_0x1d8e25){if(_0x1d8e25&&_0x1d8e25[_0xaa82('0xd7')]&&_0x1fe256['forwardOffline']&&_0x1fe256[_0xaa82('0xd8')]){var _0x171c78={'tls':{'rejectUnauthorized':![]}};if(_0x1d8e25[_0xaa82('0xd7')][_0xaa82('0xd9')]){_0x171c78[_0xaa82('0xd9')]=_0x1d8e25[_0xaa82('0xd7')][_0xaa82('0xd9')];}else{_0x171c78[_0xaa82('0xda')]=_0x1d8e25[_0xaa82('0xd7')][_0xaa82('0xda')];_0x171c78[_0xaa82('0xdb')]=_0x1d8e25[_0xaa82('0xd7')][_0xaa82('0xdb')];_0x171c78[_0xaa82('0xdc')]=_0x1d8e25[_0xaa82('0xd7')][_0xaa82('0xdc')];}if(_0x1d8e25[_0xaa82('0xd7')]['authentication']){_0x171c78[_0xaa82('0xdd')]={'user':_0x1d8e25[_0xaa82('0xd7')][_0xaa82('0x4d')],'pass':_0x1d8e25[_0xaa82('0xd7')][_0xaa82('0xde')]};}return respondWithRpcPromise(_0xaa82('0xdf'),_0xaa82('0xe0'),{'account':_0x171c78,'message':{'from':util[_0xaa82('0xa4')](_0xaa82('0xe1'),_0x1d8e25[_0xaa82('0x2c')],_0x1d8e25[_0xaa82('0xe2')]||_0x1d8e25[_0xaa82('0xd7')][_0xaa82('0x4d')]),'to':_0x1fe256[_0xaa82('0xd8')],'subject':_0x1fe256[_0xaa82('0xe3')],'html':_0x1ffa24[_0xaa82('0x53')],'attachments':_0x246503}},client9003)[_0xaa82('0x14')](function(){return _0x1ffa24;})[_0xaa82('0x1d')](function(_0x4c08ad){console[_0xaa82('0x18')](_0x4c08ad);});}})['then'](function(){if(_0x1fe256&&_0x1fe256['openNewInteraction']&&_0x1fe256[_0xaa82('0xe4')]){var _0x11ae58=[];if(_0x23c5d5['length']){_0x11ae58=_0x23c5d5[_0xaa82('0x30')](function(_0x4151bb){return{'name':_0x4151bb[_0xaa82('0xcd')],'basename':_0x4151bb['filename'],'type':_0x4151bb['mimetype'],'ChatOfflineMessageId':_0x63417a['id']};});}var _0x42a6b3;if(!_[_0xaa82('0x73')](_0x1fe256[_0xaa82('0xe5')])){var _0x407f9a=_['map'](_0x30bd19[_0xaa82('0x53')],function(_0x3b8b29){return _0x3b8b29;});var _0x3657eb=_['toPairsIn'](_0x407f9a)[0x0];var _0x16ca97=_[_0xaa82('0xe6')](_0x3657eb,function(_0x51307a){return _0x51307a;});_0x42a6b3=_0x16ca97[0x1][_0x1fe256[_0xaa82('0xe5')]];}var _0x118308={'from':_0x353cb3['email'],'firstName':_0x353cb3[_0xaa82('0xa0')],'lastName':_0x353cb3[_0xaa82('0xb1')],'mapKey':'email','message':{'from':_0x353cb3[_0xaa82('0xe2')],'to':_0x1fe256[_0xaa82('0xc5')][_0xaa82('0xe2')],'cc':'','subject':_[_0xaa82('0x73')](_0x42a6b3)?_0x1fe256[_0xaa82('0xe3')]:_0x42a6b3,'messageId':'','sentAt':new Date(),'attach':_0x11ae58[_0xaa82('0x4a')],'attachments':_0x11ae58,'originChannel':_0xaa82('0xe7'),'ChatWebsiteId':_0x1fe256['id'],'ChatOfflineMessageId':_0x1ffa24['id'],'originTo':_0x1fe256[_0xaa82('0xc5')][_0xaa82('0xe2')]},'body':_0x1ffa24[_0xaa82('0x53')]};var _0x301950={'account':{'id':_0x1fe256['MailAccountId']},'body':_0x118308,'log':_0xaa82('0xe8')};return respondWithRpcPromise('NotifyMailAccount','notifyMail',_0x301950,client9001)[_0xaa82('0x14')](function(){return _0x1ffa24;})[_0xaa82('0x1d')](function(_0xcf35db){console[_0xaa82('0x18')](_0xcf35db);});}return;})[_0xaa82('0x14')](function(){if(_0x1ffa24){return _0x1ffa24;}})['then'](respondWithResult(_0xa875b1,null))[_0xaa82('0x1d')](function(_0x514ee6){console[_0xaa82('0x18')]('catch',_0x514ee6);for(var _0x52a372 of _0x23c5d5){var _0x501b0d=path[_0xaa82('0x6d')](config[_0xaa82('0x6e')],'server',_0xaa82('0xc2'),'attachments',_0xaa82('0xe9'),_0x52a372[_0xaa82('0x67')]);fs_extra[_0xaa82('0xea')](_0x501b0d)['catch'](function(_0x45daf7){console[_0xaa82('0x18')](_0xaa82('0xeb'),_0x501b0d,_0x45daf7);});}});};exports['addInteraction']=function(_0x1a63a6,_0x41347b){return db['ChatInteraction'][_0xaa82('0x4b')]({'where':{'id':_0x1a63a6['params']['id']}})[_0xaa82('0x14')](handleEntityNotFound(_0x41347b,null))[_0xaa82('0x14')](function(_0x28dd16){if(_0x28dd16){return _0x28dd16['addInteraction'](_0x1a63a6[_0xaa82('0x53')][_0xaa82('0x5e')],_['omit'](_0x1a63a6[_0xaa82('0x53')],[_0xaa82('0x5e'),'id'])||{});}})['then'](respondWithResult(_0x41347b,null))[_0xaa82('0x1d')](handleError(_0x41347b,null));};exports['getInteractions']=function(_0x23aeec,_0x6ce290){var _0x5ec94f={'raw':![],'where':{}};var _0x42c130={};var _0x278203={'count':0x0,'rows':[]};return db[_0xaa82('0x31')][_0xaa82('0x62')]({'where':{'id':_0x23aeec['params']['id']}})[_0xaa82('0x14')](handleEntityNotFound(_0x6ce290,null))[_0xaa82('0x14')](function(_0x480cb7){if(_0x480cb7){_0x42c130[_0xaa82('0x35')]=_[_0xaa82('0x49')](db[_0xaa82('0xac')][_0xaa82('0x48')]);_0x42c130[_0xaa82('0x36')]=_[_0xaa82('0x49')](_0x23aeec[_0xaa82('0x36')]);_0x42c130[_0xaa82('0x37')]=_[_0xaa82('0x38')](_0x42c130[_0xaa82('0x35')],_0x42c130[_0xaa82('0x36')]);_0x5ec94f[_0xaa82('0x3a')]=_['intersection'](_0x42c130[_0xaa82('0x35')],qs['fields'](_0x23aeec[_0xaa82('0x36')]['fields']));_0x5ec94f[_0xaa82('0x3a')]=_0x5ec94f[_0xaa82('0x3a')]['length']?_0x5ec94f[_0xaa82('0x3a')]:_0x42c130[_0xaa82('0x35')];if(!_0x23aeec[_0xaa82('0x36')][_0xaa82('0x58')](_0xaa82('0x59'))){_0x5ec94f[_0xaa82('0x23')]=qs['limit'](_0x23aeec['query'][_0xaa82('0x23')]);_0x5ec94f[_0xaa82('0x22')]=qs['offset'](_0x23aeec['query'][_0xaa82('0x22')]);}_0x5ec94f[_0xaa82('0x3b')]=qs['sort'](_0x23aeec[_0xaa82('0x36')][_0xaa82('0x3c')]);_0x5ec94f[_0xaa82('0x3f')]=qs[_0xaa82('0x37')](_[_0xaa82('0x3d')](_0x23aeec[_0xaa82('0x36')],_0x42c130[_0xaa82('0x37')]));_0x5ec94f['where'][_0xaa82('0x5a')]=_0x480cb7['id'];if(_0x23aeec['query']['filter']){_0x5ec94f[_0xaa82('0x3f')]=_[_0xaa82('0x3e')](_0x5ec94f[_0xaa82('0x3f')],{'$or':_[_0xaa82('0x30')](_0x5ec94f[_0xaa82('0x3a')],function(_0x4d27f8){var _0x3000b2={};_0x3000b2[_0x4d27f8]={'$like':'%'+_0x23aeec[_0xaa82('0x36')][_0xaa82('0x5b')]+'%'};return _0x3000b2;})});}_0x5ec94f=_['merge']({},_0x5ec94f,_0x23aeec[_0xaa82('0x41')]);return db[_0xaa82('0xac')][_0xaa82('0x24')]({'where':_0x5ec94f[_0xaa82('0x3f')]})['then'](function(_0xdd8b3c){_0x278203[_0xaa82('0x24')]=_0xdd8b3c;if(_0x23aeec['query'][_0xaa82('0x42')]){_0x5ec94f['include']=[{'model':db[_0xaa82('0x91')],'as':_0xaa82('0xec'),'required':![]},{'model':db[_0xaa82('0xbb')],'as':_0xaa82('0xed'),'attributes':[_0xaa82('0x2c'),_0xaa82('0xee'),_0xaa82('0xef')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name','color'],'where':_0x23aeec[_0xaa82('0x36')]['tag']?{'id':_0x23aeec['query']['tag']}:undefined,'required':_0x23aeec['query'][_0xaa82('0xf0')]?!![]:![]}];}return db['ChatInteraction'][_0xaa82('0x44')](_0x5ec94f);})['then'](function(_0x104aae){_0x278203[_0xaa82('0x45')]=_0x104aae;return _0x278203;});}})[_0xaa82('0x14')](respondWithFilteredResult(_0x6ce290,_0x5ec94f))[_0xaa82('0x1d')](handleError(_0x6ce290,null));};function iftimePromise(_0x33b62a,_0x54b4d6){return respondWithRpcPromise(_0xaa82('0xf1'),_0xaa82('0xf2'),{'command':_0x54b4d6[_0xaa82('0xf3')]?util[_0xaa82('0xa4')](_0xaa82('0xf4'),_0x33b62a[_0xaa82('0xf5')],_0x54b4d6[_0xaa82('0xf3')]):util[_0xaa82('0xa4')](_0xaa82('0xf6'),_0x33b62a[_0xaa82('0xf5')])},client9002)[_0xaa82('0x14')](function(_0x56baef){var _0x42bfe2=_0x56baef&&_0x56baef[_0xaa82('0xf7')](_0xaa82('0xf8'))>=0x0?!![]:![];logger[_0xaa82('0x15')](_0xaa82('0xf9'),_0x54b4d6['id'],_0x33b62a['id'],_0x33b62a['interval'],_0x42bfe2?'ONLINE':'OFFLINE',_0x54b4d6[_0xaa82('0xf3')]?_0x54b4d6[_0xaa82('0xf3')]:_0xaa82('0xfa'));return _0x42bfe2;})[_0xaa82('0x1d')](function(_0x1fbdc4){logger[_0xaa82('0x18')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x54b4d6['id'],_0x33b62a['id'],_0x33b62a['interval'],util['inspect'](_0x1fbdc4,{'showHidden':![],'depth':null}),_0x54b4d6[_0xaa82('0xf3')]?_0x54b4d6[_0xaa82('0xf3')]:_0xaa82('0xfa'));return![];});}exports['getSnippet']=function(_0x16b447,_0x2dacc8){var _0x4fa112=0x0;var _0x14b923=0x0;var _0x30be46=![];var _0x4605fa;var _0x102126;return db[_0xaa82('0x31')][_0xaa82('0x4b')]({'where':{'id':_0x16b447[_0xaa82('0x54')]['id']},'include':[{'model':db[_0xaa82('0xfb')],'as':_0xaa82('0xfb'),'include':[{'model':db[_0xaa82('0xfb')],'as':_0xaa82('0xfc'),'attributes':['id','interval'],'raw':!![]}]}]})[_0xaa82('0x14')](handleEntityNotFound(_0x2dacc8,null))[_0xaa82('0x14')](function(_0xee96cd){if(_0xee96cd){_0x4605fa=_0xee96cd;return _0xee96cd[_0xaa82('0xfd')]({'raw':!![]});}})[_0xaa82('0x14')](function(_0xfa8770){if(_0x4605fa){if(_0xfa8770){_0x102126=_0xfa8770;}}return require(_0xaa82('0x70'))['getLicense']();})[_0xaa82('0x14')](function(_0x21c86b){if(_0x21c86b){_0x14b923=_0x21c86b['virtual'];_0x30be46=_0x21c86b[_0xaa82('0x72')];}})[_0xaa82('0x14')](function(){return db['ChatInteraction'][_0xaa82('0x24')]({'where':{'closed':![]}});})['then'](function(_0x4242fd){_0x4fa112=_0x4242fd;if(_0x14b923&&_0x4242fd>_0x14b923){return db['License'][_0xaa82('0x62')]({'where':{'id':0x1}})[_0xaa82('0x14')](function(_0x3f4135){if(_0x3f4135){_0x3f4135[_0xaa82('0xfe')]('chatLicenseExceeded');}});}})['then'](function(){if(_0x4605fa[_0xaa82('0xfb')]&&_0x4605fa[_0xaa82('0xfb')]['Intervals']){var _0x43bae6=[];for(var _0x599193=0x0;_0x599193<_0x4605fa['Interval'][_0xaa82('0xfc')]['length'];_0x599193++){var _0x2ec08c=_0x4605fa['Interval'][_0xaa82('0xfc')][_0x599193][_0xaa82('0x28')]({'plain':!![]});_0x43bae6[_0xaa82('0xb5')](iftimePromise(_0x2ec08c,_0x4605fa));}return BPromise['all'](_0x43bae6)[_0xaa82('0x14')](function(_0xd1f8c9){return _[_0xaa82('0xff')](_0xd1f8c9);});}else{return!![];}})['then'](function(_0x463ae3){var _0x1c1723=fs[_0xaa82('0xc7')](path[_0xaa82('0x6d')](config[_0xaa82('0x6e')],_0xaa82('0x100')),_0xaa82('0xc9'));var _0x8bfd9f={'remote':_0x4605fa[_0xaa82('0x101')],'query':querystring[_0xaa82('0xaa')](_[_0xaa82('0x3e')](_0x4605fa['get']({'plain':!![]}),{'customerIp':_0x16b447[_0xaa82('0x9d')][_0xaa82('0x102')]||_0x16b447[_0xaa82('0x9d')][_0xaa82('0x103')]||_0x16b447['connection']['remoteAddress']||_0x16b447['ip'],'referer':_0x16b447[_0xaa82('0x9d')][_0xaa82('0x104')],'openedInteractions':_0x4fa112,'maxInteractions':_0x14b923,'virtual':_0x30be46['virtual'],'online':_0x463ae3,'custom':_0x30be46}))[_0xaa82('0x105')](/'/g,'\x5c\x27')};_0x2dacc8[_0xaa82('0x2d')](ejs[_0xaa82('0xca')](Mustache[_0xaa82('0xca')](_0x1c1723,_0x8bfd9f),{'proactiveActions':_0x102126,'alignment':_0x4605fa[_0xaa82('0x106')],'verticalAlignment':_0x4605fa[_0xaa82('0x107')],'div_color':_0x4605fa[_0xaa82('0x108')],'labelText':_0x4605fa[_0xaa82('0x109')],'text_color':_0x4605fa[_0xaa82('0x10a')],'button_color':_0x4605fa['color_button'],'background_color':_0x4605fa[_0xaa82('0x10b')]}));})['catch'](handleError(_0x2dacc8,null));};exports[_0xaa82('0x10c')]=function(_0x3d92bf,_0x4684eb){var _0x54f072=_0x3d92bf[_0xaa82('0x54')]['id'];var _0x22ca33=_0x3d92bf['body'];var _0x5c048e=0xc8;var _0x4e83bc=null;return db['sequelize'][_0xaa82('0xd4')]({'isolationLevel':db[_0xaa82('0xd3')][_0xaa82('0x10d')][_0xaa82('0x10e')]['READ_COMMITTED']},function(_0x36cdaf){return db[_0xaa82('0x31')][_0xaa82('0x62')]({'where':{'id':_0x54f072},'transaction':_0x36cdaf})[_0xaa82('0x14')](function(_0x25658f){if(_0x25658f){return db[_0xaa82('0x93')][_0xaa82('0x55')]({'where':{'ChatWebsiteId':_0x54f072},'transaction':_0x36cdaf})[_0xaa82('0x14')](function(){var _0x33875f=_[_0xaa82('0x30')](_0x22ca33,function(_0x470e83){_0x470e83[_0xaa82('0x5a')]=_0x54f072;return _0x470e83;});return db[_0xaa82('0x93')]['bulkCreate'](_0x33875f,{'transaction':_0x36cdaf});});}else{_0x5c048e=0x194;_0x4e83bc=[];}});})[_0xaa82('0x14')](function(){if(_0x5c048e!==0x194){return db[_0xaa82('0x93')][_0xaa82('0x10f')]({'where':{'ChatWebsiteId':_0x54f072},'order':_0xaa82('0x110')})[_0xaa82('0x14')](function(_0x2ff701){_0x4e83bc=_0x2ff701;});}})['catch'](function(_0xaec4e3){_0x5c048e=0x1f4;logger[_0xaa82('0x18')](_0xaec4e3[_0xaa82('0x2b')]);if(_0xaec4e3[_0xaa82('0x2c')]){delete _0xaec4e3[_0xaa82('0x2c')];}_0x4e83bc=_0xaec4e3;})['finally'](function(){if(_0x4e83bc===null){_0x4684eb[_0xaa82('0x1e')](_0x5c048e);}else{if(_0x5c048e===0x1f4){_0x4684eb[_0xaa82('0x1f')](_0x5c048e)[_0xaa82('0x2d')](_0x4e83bc);}else{_0x4684eb[_0xaa82('0x1f')](_0x5c048e)[_0xaa82('0x21')](_0x4e83bc);}}});};exports[_0xaa82('0x111')]=function(_0x1a3a9f,_0x57587f){var _0x5a5dd1={};var _0x32f2f5={};var _0x4e1674;var _0x2c24bb;return db[_0xaa82('0x31')][_0xaa82('0x62')]({'where':{'id':_0x1a3a9f[_0xaa82('0x54')]['id']}})[_0xaa82('0x14')](handleEntityNotFound(_0x57587f,null))[_0xaa82('0x14')](function(_0x2ce2f4){if(_0x2ce2f4){_0x4e1674=_0x2ce2f4;_0x32f2f5[_0xaa82('0x35')]=_['keys'](db[_0xaa82('0x93')][_0xaa82('0x48')]);_0x32f2f5[_0xaa82('0x36')]=_['keys'](_0x1a3a9f[_0xaa82('0x36')]);_0x32f2f5[_0xaa82('0x37')]=_[_0xaa82('0x38')](_0x32f2f5[_0xaa82('0x35')],_0x32f2f5['query']);_0x5a5dd1[_0xaa82('0x3a')]=_['intersection'](_0x32f2f5[_0xaa82('0x35')],qs['fields'](_0x1a3a9f[_0xaa82('0x36')]['fields']));_0x5a5dd1['attributes']=_0x5a5dd1[_0xaa82('0x3a')][_0xaa82('0x4a')]?_0x5a5dd1[_0xaa82('0x3a')]:_0x32f2f5[_0xaa82('0x35')];_0x5a5dd1['order']=qs[_0xaa82('0x3c')](_0x1a3a9f['query'][_0xaa82('0x3c')]);_0x5a5dd1['where']=qs['filters'](_[_0xaa82('0x3d')](_0x1a3a9f[_0xaa82('0x36')],_0x32f2f5[_0xaa82('0x37')]));if(_0x1a3a9f[_0xaa82('0x36')][_0xaa82('0x5b')]){_0x5a5dd1['where']=_[_0xaa82('0x3e')](_0x5a5dd1[_0xaa82('0x3f')],{'$or':_[_0xaa82('0x30')](_0x5a5dd1['attributes'],function(_0x1df9ee){var _0x40ac22={};_0x40ac22[_0x1df9ee]={'$like':'%'+_0x1a3a9f[_0xaa82('0x36')][_0xaa82('0x5b')]+'%'};return _0x40ac22;})});}_0x5a5dd1=_[_0xaa82('0x3e')]({},_0x5a5dd1,_0x1a3a9f[_0xaa82('0x41')]);return _0x4e1674['getApplications'](_0x5a5dd1);}})[_0xaa82('0x14')](function(_0x25aba0){if(_0x25aba0){_0x2c24bb=_0x25aba0[_0xaa82('0x4a')];if(!_0x1a3a9f['query'][_0xaa82('0x58')](_0xaa82('0x59'))){_0x5a5dd1[_0xaa82('0x23')]=qs['limit'](_0x1a3a9f[_0xaa82('0x36')][_0xaa82('0x23')]);_0x5a5dd1['offset']=qs[_0xaa82('0x22')](_0x1a3a9f[_0xaa82('0x36')][_0xaa82('0x22')]);}return _0x4e1674[_0xaa82('0x111')](_0x5a5dd1);}})['then'](function(_0x19d1cd){if(_0x19d1cd){return _0x19d1cd?{'count':_0x2c24bb,'rows':_0x19d1cd}:null;}})['then'](respondWithResult(_0x57587f,null))[_0xaa82('0x1d')](handleError(_0x57587f,null));};exports[_0xaa82('0x112')]=function(_0x1cf819,_0x5134f2){return db[_0xaa82('0x113')][_0xaa82('0x4b')]({'where':{'id':_0x1cf819[_0xaa82('0x54')]['id']}})['then'](handleEntityNotFound(_0x5134f2,null))[_0xaa82('0x14')](function(_0x7c224e){if(_0x7c224e){return _0x7c224e[_0xaa82('0x112')](_0x1cf819[_0xaa82('0x53')][_0xaa82('0x5e')],_[_0xaa82('0x114')](_0x1cf819[_0xaa82('0x53')],[_0xaa82('0x5e'),'id'])||{});}})[_0xaa82('0x14')](respondWithResult(_0x5134f2,null))['catch'](handleError(_0x5134f2,null));};exports[_0xaa82('0xfd')]=function(_0x4b93f5,_0x15c265){var _0xb257a0={};var _0x3e4fef={};var _0x15d2b2;var _0x3c134e;return db['ChatWebsite'][_0xaa82('0x62')]({'where':{'id':_0x4b93f5[_0xaa82('0x54')]['id']}})[_0xaa82('0x14')](handleEntityNotFound(_0x15c265,null))[_0xaa82('0x14')](function(_0x520631){if(_0x520631){_0x15d2b2=_0x520631;_0x3e4fef['model']=_[_0xaa82('0x49')](db[_0xaa82('0x115')]['rawAttributes']);_0x3e4fef[_0xaa82('0x36')]=_[_0xaa82('0x49')](_0x4b93f5[_0xaa82('0x36')]);_0x3e4fef[_0xaa82('0x37')]=_[_0xaa82('0x38')](_0x3e4fef[_0xaa82('0x35')],_0x3e4fef[_0xaa82('0x36')]);_0xb257a0[_0xaa82('0x3a')]=_[_0xaa82('0x38')](_0x3e4fef[_0xaa82('0x35')],qs[_0xaa82('0x39')](_0x4b93f5[_0xaa82('0x36')]['fields']));_0xb257a0['attributes']=_0xb257a0[_0xaa82('0x3a')]['length']?_0xb257a0['attributes']:_0x3e4fef[_0xaa82('0x35')];_0xb257a0['order']=qs[_0xaa82('0x3c')](_0x4b93f5[_0xaa82('0x36')][_0xaa82('0x3c')]);_0xb257a0[_0xaa82('0x3f')]=qs['filters'](_['pick'](_0x4b93f5[_0xaa82('0x36')],_0x3e4fef[_0xaa82('0x37')]));if(_0x4b93f5['query'][_0xaa82('0x5b')]){_0xb257a0[_0xaa82('0x3f')]=_['merge'](_0xb257a0[_0xaa82('0x3f')],{'$or':_[_0xaa82('0x30')](_0xb257a0[_0xaa82('0x3a')],function(_0x4d35bd){var _0x59cd51={};_0x59cd51[_0x4d35bd]={'$like':'%'+_0x4b93f5[_0xaa82('0x36')][_0xaa82('0x5b')]+'%'};return _0x59cd51;})});}_0xb257a0=_['merge']({},_0xb257a0,_0x4b93f5[_0xaa82('0x41')]);return _0x15d2b2['getProactiveActions'](_0xb257a0);}})['then'](function(_0x326a99){if(_0x326a99){_0x3c134e=_0x326a99['length'];if(!_0x4b93f5[_0xaa82('0x36')]['hasOwnProperty'](_0xaa82('0x59'))){_0xb257a0[_0xaa82('0x23')]=qs[_0xaa82('0x23')](_0x4b93f5[_0xaa82('0x36')][_0xaa82('0x23')]);_0xb257a0[_0xaa82('0x22')]=qs['offset'](_0x4b93f5[_0xaa82('0x36')][_0xaa82('0x22')]);}return _0x15d2b2[_0xaa82('0xfd')](_0xb257a0);}})['then'](function(_0x44b9fd){if(_0x44b9fd){return _0x44b9fd?{'count':_0x3c134e,'rows':_0x44b9fd}:null;}})[_0xaa82('0x14')](respondWithResult(_0x15c265,null))[_0xaa82('0x1d')](handleError(_0x15c265,null));};exports[_0xaa82('0x116')]=function(_0x2f270b,_0x24f8b5){var _0x5b3b58=_0x2f270b[_0xaa82('0x36')]['online']===_0xaa82('0x117')?_0xaa82('0x118'):_0xaa82('0x119');return db[_0xaa82('0x31')][_0xaa82('0x4b')]({'attributes':['id',_0x5b3b58],'where':{'id':_0x2f270b[_0xaa82('0x54')]['id']}})[_0xaa82('0x14')](handleEntityNotFound(_0x24f8b5,null))[_0xaa82('0x14')](function(_0x45c770){if(_0x45c770){var _0x196d94=_0x45c770[_0x5b3b58];var _0x2ac399=_0x196d94&&_0x196d94[_0xaa82('0x11a')]?_0x196d94['items']:[];_0x24f8b5[_0xaa82('0x2d')]({'fromKey':_[_0xaa82('0x73')](_0x196d94[_0xaa82('0x11b')])?undefined:_0x196d94[_0xaa82('0x11b')],'count':_0x2ac399[_0xaa82('0x4a')],'rows':_0x2ac399});}})[_0xaa82('0x1d')](handleError(_0x24f8b5,null));};exports[_0xaa82('0x11c')]=function(_0xe34702,_0x5f1ff2){var _0x1ed958={'raw':![],'where':{}};var _0x235cf9={};var _0x5b651b={'count':0x0,'rows':[]};return db[_0xaa82('0x31')][_0xaa82('0x62')]({'where':{'id':_0xe34702['params']['id']}})[_0xaa82('0x14')](handleEntityNotFound(_0x5f1ff2,null))[_0xaa82('0x14')](function(_0x52956c){if(_0x52956c){_0x235cf9['model']=_[_0xaa82('0x49')](db[_0xaa82('0x11d')]['rawAttributes']);_0x235cf9['query']=_['keys'](_0xe34702[_0xaa82('0x36')]);_0x235cf9[_0xaa82('0x37')]=_[_0xaa82('0x38')](_0x235cf9[_0xaa82('0x35')],_0x235cf9[_0xaa82('0x36')]);_0x1ed958['attributes']=_[_0xaa82('0x38')](_0x235cf9['model'],qs['fields'](_0xe34702[_0xaa82('0x36')]['fields']));_0x1ed958[_0xaa82('0x3a')]=_0x1ed958[_0xaa82('0x3a')]['length']?_0x1ed958[_0xaa82('0x3a')]:_0x235cf9['model'];if(!_0xe34702[_0xaa82('0x36')][_0xaa82('0x58')]('nolimit')){_0x1ed958['limit']=qs[_0xaa82('0x23')](_0xe34702[_0xaa82('0x36')][_0xaa82('0x23')]);_0x1ed958['offset']=qs[_0xaa82('0x22')](_0xe34702[_0xaa82('0x36')]['offset']);}_0x1ed958[_0xaa82('0x3b')]=qs[_0xaa82('0x3c')](_0xe34702[_0xaa82('0x36')][_0xaa82('0x3c')]);_0x1ed958[_0xaa82('0x3f')]=qs['filters'](_[_0xaa82('0x3d')](_0xe34702[_0xaa82('0x36')],_0x235cf9[_0xaa82('0x37')]));_0x1ed958[_0xaa82('0x3f')][_0xaa82('0x5a')]=_0x52956c['id'];if(_0xe34702[_0xaa82('0x36')]['filter']){_0x1ed958[_0xaa82('0x3f')]=_[_0xaa82('0x3e')](_0x1ed958[_0xaa82('0x3f')],{'$or':_[_0xaa82('0x30')](_0x1ed958['attributes'],function(_0x4104ab){var _0x5cdaf4={};_0x5cdaf4[_0x4104ab]={'$like':'%'+_0xe34702['query'][_0xaa82('0x5b')]+'%'};return _0x5cdaf4;})});}_0x1ed958=_[_0xaa82('0x3e')]({},_0x1ed958,_0xe34702[_0xaa82('0x41')]);return db[_0xaa82('0x11d')]['count']({'where':_0x1ed958[_0xaa82('0x3f')]})[_0xaa82('0x14')](function(_0x13417b){_0x5b651b[_0xaa82('0x24')]=_0x13417b;if(_0xe34702[_0xaa82('0x36')][_0xaa82('0x42')]){_0x1ed958[_0xaa82('0x43')]=[{'all':!![]}];}else{_0x1ed958[_0xaa82('0x43')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['Attachment'],'as':_0xaa82('0x11e'),'required':![]}];}return db['ChatOfflineMessage'][_0xaa82('0x44')](_0x1ed958);})[_0xaa82('0x14')](function(_0x2e00e4){_0x5b651b[_0xaa82('0x45')]=_0x2e00e4;return _0x5b651b;});}})[_0xaa82('0x14')](respondWithFilteredResult(_0x5f1ff2,_0x1ed958))[_0xaa82('0x1d')](handleError(_0x5f1ff2,null));};exports[_0xaa82('0x11f')]=function(_0x4d1b40,_0x57ad3){return db[_0xaa82('0x31')][_0xaa82('0x4b')]({'where':{'id':_0x4d1b40['params']['id']}})['then'](handleEntityNotFound(_0x57ad3,null))['then'](function(_0x43c646){if(_0x43c646){return _0x43c646['addAgents'](_0x4d1b40[_0xaa82('0x53')][_0xaa82('0x5e')],_[_0xaa82('0x114')](_0x4d1b40[_0xaa82('0x53')],[_0xaa82('0x5e'),'id'])||{})[_0xaa82('0xb0')](function(_0x4a0661){for(var _0x431a68=0x0;_0x431a68<_0x4d1b40[_0xaa82('0x53')][_0xaa82('0x5e')][_0xaa82('0x4a')];_0x431a68+=0x1){socket[_0xaa82('0x120')]('userChatWebsite:save',{'UserId':Number(_0x4d1b40[_0xaa82('0x53')][_0xaa82('0x5e')][_0x431a68]),'ChatWebsiteId':Number(_0x4d1b40[_0xaa82('0x54')]['id'])});}return _0x4a0661;});}})[_0xaa82('0x14')](respondWithResult(_0x57ad3,null))[_0xaa82('0x1d')](handleError(_0x57ad3,null));};exports['removeAgents']=function(_0xfe09e8,_0x5bc319){return db[_0xaa82('0x31')][_0xaa82('0x4b')]({'where':{'id':_0xfe09e8['params']['id']}})[_0xaa82('0x14')](handleEntityNotFound(_0x5bc319,null))[_0xaa82('0x14')](function(_0x1e2b5f){if(_0x1e2b5f){return _0x1e2b5f[_0xaa82('0x121')](_0xfe09e8[_0xaa82('0x36')]['ids'])[_0xaa82('0x14')](function(){if(_['isArray'](_0xfe09e8['query'][_0xaa82('0x5e')])){for(var _0x95d76f=0x0;_0x95d76f<_0xfe09e8[_0xaa82('0x36')][_0xaa82('0x5e')][_0xaa82('0x4a')];_0x95d76f+=0x1){socket[_0xaa82('0x120')](_0xaa82('0x122'),{'UserId':Number(_0xfe09e8[_0xaa82('0x36')][_0xaa82('0x5e')][_0x95d76f]),'ChatWebsiteId':Number(_0xfe09e8['params']['id'])});}}else{socket[_0xaa82('0x120')](_0xaa82('0x122'),{'UserId':Number(_0xfe09e8[_0xaa82('0x36')][_0xaa82('0x5e')]),'ChatWebsiteId':Number(_0xfe09e8[_0xaa82('0x54')]['id'])});}});}})[_0xaa82('0x14')](respondWithStatusCode(_0x5bc319,null))['catch'](handleError(_0x5bc319,null));};exports[_0xaa82('0x123')]=function(_0xb6a895,_0x215c61){var _0x546fd8={};var _0x26f86f={};var _0x450b07;var _0xac75ea;return db[_0xaa82('0x31')][_0xaa82('0x62')]({'where':{'id':_0xb6a895[_0xaa82('0x54')]['id']}})['then'](handleEntityNotFound(_0x215c61,null))[_0xaa82('0x14')](function(_0x20c413){if(_0x20c413){_0x450b07=_0x20c413;_0x26f86f[_0xaa82('0x35')]=_['keys'](db[_0xaa82('0xbb')][_0xaa82('0x48')]);_0x26f86f['query']=_[_0xaa82('0x49')](_0xb6a895['query']);_0x26f86f[_0xaa82('0x37')]=_[_0xaa82('0x38')](_0x26f86f[_0xaa82('0x35')],_0x26f86f[_0xaa82('0x36')]);_0x546fd8[_0xaa82('0x3a')]=_[_0xaa82('0x38')](_0x26f86f[_0xaa82('0x35')],qs[_0xaa82('0x39')](_0xb6a895[_0xaa82('0x36')][_0xaa82('0x39')]));_0x546fd8[_0xaa82('0x3a')]=_0x546fd8[_0xaa82('0x3a')][_0xaa82('0x4a')]?_0x546fd8[_0xaa82('0x3a')]:_0x26f86f[_0xaa82('0x35')];_0x546fd8['order']=qs[_0xaa82('0x3c')](_0xb6a895['query']['sort']);_0x546fd8[_0xaa82('0x3f')]=qs[_0xaa82('0x37')](_['pick'](_0xb6a895[_0xaa82('0x36')],_0x26f86f['filters']));if(_0xb6a895['query'][_0xaa82('0x5b')]){_0x546fd8[_0xaa82('0x3f')]=_[_0xaa82('0x3e')](_0x546fd8[_0xaa82('0x3f')],{'$or':_[_0xaa82('0x30')](_0x546fd8[_0xaa82('0x3a')],function(_0x3de529){var _0x413d4b={};_0x413d4b[_0x3de529]={'$like':'%'+_0xb6a895['query'][_0xaa82('0x5b')]+'%'};return _0x413d4b;})});}_0x546fd8=_[_0xaa82('0x3e')]({},_0x546fd8,_0xb6a895[_0xaa82('0x41')]);return _0x450b07[_0xaa82('0x123')](_0x546fd8);}})[_0xaa82('0x14')](function(_0x5deb8b){if(_0x5deb8b){_0xac75ea=_0x5deb8b[_0xaa82('0x4a')];if(!_0xb6a895[_0xaa82('0x36')][_0xaa82('0x58')]('nolimit')){_0x546fd8[_0xaa82('0x23')]=qs[_0xaa82('0x23')](_0xb6a895[_0xaa82('0x36')][_0xaa82('0x23')]);_0x546fd8[_0xaa82('0x22')]=qs[_0xaa82('0x22')](_0xb6a895[_0xaa82('0x36')][_0xaa82('0x22')]);}return _0x450b07[_0xaa82('0x123')](_0x546fd8);}})['then'](function(_0x4c4c69){if(_0x4c4c69){return _0x4c4c69?{'count':_0xac75ea,'rows':_0x4c4c69}:null;}})[_0xaa82('0x14')](respondWithResult(_0x215c61,null))[_0xaa82('0x1d')](handleError(_0x215c61,null));}; \ No newline at end of file +var _0xe1dc=['x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','contact','messageId','created','close','*,*,*,*','UserId','User','unshift','forcedOwnership','Start','startRouting','EventManager','offline','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','spread','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','files','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','forwardOffline','forwardOfflineAddress','Smtp','service','host','port','secure','authentication','auth','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','attachments','Could\x20not\x20remove\x20attachment\x20file','addInteraction','Owner','fullname','internal','Tag','Tags','color','tag','getSnippet','timezone','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','increment','push','all','some','readFileSync','server/files/chat/iframe.ejs','connection','remoteAddress','alignment','labelText','textColor','color_button','backgroundColor','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','finally','sendStatus','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','getOfflineMessages','Contact','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','ioredis','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','end','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','ChatWebsite','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','order','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','agentAvatar','isNil','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','headers','user-agent','getResult','chat','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','ChatApplication','List','applications','Applications','orderBy','priority','asc','account','customerIp','cf-connecting-ip'];(function(_0x52dc4f,_0x482831){var _0x5ba1e0=function(_0x3c3f37){while(--_0x3c3f37){_0x52dc4f['push'](_0x52dc4f['shift']());}};_0x5ba1e0(++_0x482831);}(_0xe1dc,0x8a));var _0xce1d=function(_0x40e9cf,_0x4524eb){_0x40e9cf=_0x40e9cf-0x0;var _0x704fea=_0xe1dc[_0x40e9cf];return _0x704fea;};'use strict';var BPromise=require(_0xce1d('0x0'));var Mustache=require(_0xce1d('0x1'));var util=require(_0xce1d('0x2'));var path=require(_0xce1d('0x3'));var ejs=require(_0xce1d('0x4'));var fs=require('fs');var fs_extra=require(_0xce1d('0x5'));var _=require(_0xce1d('0x6'));var querystring=require('querystring');var Redis=require(_0xce1d('0x7'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xce1d('0x8'));var config=require(_0xce1d('0x9'));var db=require(_0xce1d('0xa'))['db'];config[_0xce1d('0xb')]=_[_0xce1d('0xc')](config[_0xce1d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xce1d('0xd'))(new Redis(config[_0xce1d('0xb')]));require('./chatWebsite.socket')[_0xce1d('0xe')](socket);var jayson=require(_0xce1d('0xf'));var client=jayson[_0xce1d('0x10')][_0xce1d('0x11')]({'port':0x232c});var client9002=jayson[_0xce1d('0x10')][_0xce1d('0x11')]({'port':0x232a});var client9003=jayson[_0xce1d('0x10')][_0xce1d('0x11')]({'port':0x232b});var client9001=jayson['client'][_0xce1d('0x11')]({'port':0x2329});function respondWithRpcPromise(_0x33c4ec,_0x520e85,_0x194f8e,_0x4f23db){return new BPromise(function(_0x5ef4fd,_0x57b575){var _0x378ee5=_0x4f23db||client;return _0x378ee5['request'](_0x33c4ec,_0x194f8e)[_0xce1d('0x12')](function(_0x5cd1a1){logger[_0xce1d('0x13')](_0xce1d('0x14'),_0x520e85,'request\x20sent');logger[_0xce1d('0x15')](_0xce1d('0x16'),_0x520e85,_0xce1d('0x17'),JSON[_0xce1d('0x18')](_0x5cd1a1));if(_0x5cd1a1[_0xce1d('0x19')]){if(_0x5cd1a1[_0xce1d('0x19')][_0xce1d('0x1a')]===0x1f4){logger['error'](_0xce1d('0x14'),_0x520e85,_0x5cd1a1[_0xce1d('0x19')]['message']);return _0x57b575(_0x5cd1a1['error'][_0xce1d('0x1b')]);}logger['error'](_0xce1d('0x14'),_0x520e85,_0x5cd1a1[_0xce1d('0x19')]['message']);return _0x5ef4fd(_0x5cd1a1[_0xce1d('0x19')][_0xce1d('0x1b')]);}else{logger['info'](_0xce1d('0x14'),_0x520e85,'request\x20sent');_0x5ef4fd(_0x5cd1a1[_0xce1d('0x1c')]['message']);}})['catch'](function(_0xfc6cd9){logger[_0xce1d('0x19')](_0xce1d('0x14'),_0x520e85,_0xfc6cd9);_0x57b575(_0xfc6cd9);});});}function respondWithStatusCode(_0x11f69e,_0x18076d){_0x18076d=_0x18076d||0xcc;return function(_0x39e57c){if(_0x39e57c){return _0x11f69e['sendStatus'](_0x18076d);}return _0x11f69e['status'](_0x18076d)[_0xce1d('0x1d')]();};}function respondWithResult(_0x3b2b86,_0x40da9d){_0x40da9d=_0x40da9d||0xc8;return function(_0x12041e){if(_0x12041e){return _0x3b2b86[_0xce1d('0x1e')](_0x40da9d)[_0xce1d('0x1f')](_0x12041e);}};}function respondWithFilteredResult(_0xa8b8d5,_0x5353be){return function(_0x2ae659){if(_0x2ae659){var _0x52386c=typeof _0x5353be[_0xce1d('0x20')]==='undefined'&&typeof _0x5353be[_0xce1d('0x21')]===_0xce1d('0x22');var _0x1035f5=_0x2ae659[_0xce1d('0x23')];var _0x37365c=_0x52386c?0x0:_0x5353be[_0xce1d('0x20')];var _0x395eba=_0x52386c?_0x2ae659[_0xce1d('0x23')]:_0x5353be[_0xce1d('0x20')]+_0x5353be[_0xce1d('0x21')];var _0x11392d;if(_0x395eba>=_0x1035f5){_0x395eba=_0x1035f5;_0x11392d=0xc8;}else{_0x11392d=0xce;}_0xa8b8d5[_0xce1d('0x1e')](_0x11392d);return _0xa8b8d5[_0xce1d('0x24')](_0xce1d('0x25'),_0x37365c+'-'+_0x395eba+'/'+_0x1035f5)[_0xce1d('0x1f')](_0x2ae659);}return null;};}function saveUpdates(_0x20a71b){return function(_0x3f43f5){if(_0x3f43f5){return _0x3f43f5[_0xce1d('0x26')](_0x20a71b)[_0xce1d('0x12')](function(_0x4313a0){return _0x4313a0;});}return null;};}function removeEntity(_0x3e7074){return function(_0x16f2ad){if(_0x16f2ad){return _0x16f2ad[_0xce1d('0x27')]()[_0xce1d('0x12')](function(){var _0x2081c3=_0x16f2ad[_0xce1d('0x28')]({'plain':!![]});var _0xd51ea1=_0xce1d('0x29');return db[_0xce1d('0x2a')][_0xce1d('0x27')]({'where':{'type':_0xd51ea1,'resourceId':_0x2081c3['id']}})['then'](function(){return _0x16f2ad;});})['then'](function(){_0x3e7074[_0xce1d('0x1e')](0xcc)[_0xce1d('0x1d')]();});}};}function handleEntityNotFound(_0x411eb6){return function(_0x2e0c9d){if(!_0x2e0c9d){_0x411eb6['sendStatus'](0x194);}return _0x2e0c9d;};}function handleError(_0x3871bd,_0x281aee){_0x281aee=_0x281aee||0x1f4;return function(_0x32aead){logger[_0xce1d('0x19')](_0x32aead[_0xce1d('0x2b')]);if(_0x32aead[_0xce1d('0x2c')]){delete _0x32aead[_0xce1d('0x2c')];}_0x3871bd[_0xce1d('0x1e')](_0x281aee)['send'](_0x32aead);};}exports[_0xce1d('0x2d')]=function(_0x55bf05,_0x7719b3){var _0x22ab37={'include':[{'model':db[_0xce1d('0x2e')],'as':_0xce1d('0x2f')}]},_0x293808={},_0x11df75={'count':0x0,'rows':[]};var _0x51fa16=_[_0xce1d('0x30')](db['ChatWebsite'][_0xce1d('0x31')],function(_0x236c0a){return{'name':_0x236c0a[_0xce1d('0x32')],'type':_0x236c0a[_0xce1d('0x33')][_0xce1d('0x34')]};});_0x293808[_0xce1d('0x35')]=_[_0xce1d('0x30')](_0x51fa16,_0xce1d('0x2c'));_0x293808[_0xce1d('0x36')]=_[_0xce1d('0x37')](_0x55bf05['query']);_0x293808[_0xce1d('0x38')]=_[_0xce1d('0x39')](_0x293808[_0xce1d('0x35')],_0x293808[_0xce1d('0x36')]);_0x22ab37[_0xce1d('0x3a')]=_['intersection'](_0x293808['model'],qs[_0xce1d('0x3b')](_0x55bf05[_0xce1d('0x36')][_0xce1d('0x3b')]));_0x22ab37[_0xce1d('0x3a')]=_0x22ab37['attributes'][_0xce1d('0x3c')]?_0x22ab37[_0xce1d('0x3a')]:_0x293808[_0xce1d('0x35')];if(!_0x55bf05[_0xce1d('0x36')][_0xce1d('0x3d')](_0xce1d('0x3e'))){_0x22ab37[_0xce1d('0x21')]=qs[_0xce1d('0x21')](_0x55bf05[_0xce1d('0x36')]['limit']);_0x22ab37[_0xce1d('0x20')]=qs[_0xce1d('0x20')](_0x55bf05['query'][_0xce1d('0x20')]);}_0x22ab37['order']=qs[_0xce1d('0x3f')](_0x55bf05[_0xce1d('0x36')][_0xce1d('0x3f')]);_0x22ab37[_0xce1d('0x40')]=qs[_0xce1d('0x38')](_[_0xce1d('0x41')](_0x55bf05[_0xce1d('0x36')],_0x293808[_0xce1d('0x38')]),_0x51fa16);if(_0x55bf05[_0xce1d('0x36')][_0xce1d('0x42')]){_0x22ab37[_0xce1d('0x40')]=_[_0xce1d('0x43')](_0x22ab37[_0xce1d('0x40')],{'$or':_[_0xce1d('0x30')](_0x51fa16,function(_0x445b7a){if(_0x445b7a[_0xce1d('0x33')]!==_0xce1d('0x44')){var _0x50dc05={};_0x50dc05[_0x445b7a[_0xce1d('0x2c')]]={'$like':'%'+_0x55bf05[_0xce1d('0x36')]['filter']+'%'};return _0x50dc05;}})});}_0x22ab37=_['merge']({},_0x22ab37,_0x55bf05[_0xce1d('0x45')]);var _0x196c67={'where':_0x22ab37['where']};return db['ChatWebsite'][_0xce1d('0x23')](_0x196c67)['then'](function(_0x2f718a){_0x11df75[_0xce1d('0x23')]=_0x2f718a;if(_0x55bf05['query'][_0xce1d('0x46')]){_0x22ab37['include']=[{'all':!![]}];}return db[_0xce1d('0x47')][_0xce1d('0x48')](_0x22ab37);})[_0xce1d('0x12')](function(_0x9dcf18){_0x11df75[_0xce1d('0x49')]=_0x9dcf18;return _0x11df75;})[_0xce1d('0x12')](respondWithFilteredResult(_0x7719b3,_0x22ab37))[_0xce1d('0x4a')](handleError(_0x7719b3,null));};exports[_0xce1d('0x4b')]=function(_0x2115e0,_0x1e7903){var _0x43361d={'raw':![],'where':{'id':_0x2115e0[_0xce1d('0x4c')]['id']},'include':[{'model':db[_0xce1d('0x2e')],'as':_0xce1d('0x2f')}]},_0x1b4b2e={};_0x1b4b2e['model']=_[_0xce1d('0x37')](db['ChatWebsite'][_0xce1d('0x31')]);_0x1b4b2e['query']=_[_0xce1d('0x37')](_0x2115e0[_0xce1d('0x36')]);_0x1b4b2e['filters']=_[_0xce1d('0x39')](_0x1b4b2e['model'],_0x1b4b2e[_0xce1d('0x36')]);_0x43361d[_0xce1d('0x3a')]=_['intersection'](_0x1b4b2e[_0xce1d('0x35')],qs[_0xce1d('0x3b')](_0x2115e0[_0xce1d('0x36')]['fields']));_0x43361d[_0xce1d('0x3a')]=_0x43361d[_0xce1d('0x3a')][_0xce1d('0x3c')]?_0x43361d[_0xce1d('0x3a')]:_0x1b4b2e['model'];if(_0x2115e0['query'][_0xce1d('0x46')]){_0x43361d[_0xce1d('0x4d')]=[{'all':!![]}];}_0x43361d=_[_0xce1d('0x43')]({},_0x43361d,_0x2115e0['options']);return db[_0xce1d('0x47')][_0xce1d('0x4e')](_0x43361d)[_0xce1d('0x12')](handleEntityNotFound(_0x1e7903,null))[_0xce1d('0x12')](respondWithResult(_0x1e7903,null))[_0xce1d('0x4a')](handleError(_0x1e7903,null));};exports[_0xce1d('0x4f')]=function(_0x400045,_0x104295){return db[_0xce1d('0x47')][_0xce1d('0x4f')](_0x400045[_0xce1d('0x50')],{})[_0xce1d('0x12')](function(_0x1dea73){var _0x85f06c=_0x400045[_0xce1d('0x51')]['get']({'plain':!![]});if(!_0x85f06c)throw new Error(_0xce1d('0x52'));if(_0x85f06c[_0xce1d('0x53')]===_0xce1d('0x51')){var _0x1c47ce=_0x1dea73['get']({'plain':!![]});var _0x2a5bd3=_0xce1d('0x29');return db['UserProfileSection'][_0xce1d('0x4e')]({'where':{'name':_0x2a5bd3,'userProfileId':_0x85f06c[_0xce1d('0x54')]},'raw':!![]})[_0xce1d('0x12')](function(_0x5906e6){if(_0x5906e6&&_0x5906e6[_0xce1d('0x55')]===0x0){return db['UserProfileResource'][_0xce1d('0x4f')]({'name':_0x1c47ce[_0xce1d('0x2c')],'resourceId':_0x1c47ce['id'],'type':_0x5906e6['name'],'sectionId':_0x5906e6['id']},{})[_0xce1d('0x12')](function(){return _0x1dea73;});}else{return _0x1dea73;}})[_0xce1d('0x4a')](function(_0x1df982){logger['error'](_0xce1d('0x56'),_0x1df982);throw _0x1df982;});}return _0x1dea73;})['then'](respondWithResult(_0x104295,0xc9))[_0xce1d('0x4a')](handleError(_0x104295,null));};exports[_0xce1d('0x26')]=function(_0x4befdf,_0x2f0872){if(_0x4befdf[_0xce1d('0x50')]['id']){delete _0x4befdf[_0xce1d('0x50')]['id'];}return db[_0xce1d('0x47')][_0xce1d('0x4e')]({'where':{'id':_0x4befdf['params']['id']},'include':[{'model':db[_0xce1d('0x2e')],'as':_0xce1d('0x2f')}]})[_0xce1d('0x12')](handleEntityNotFound(_0x2f0872,null))[_0xce1d('0x12')](saveUpdates(_0x4befdf[_0xce1d('0x50')],null))[_0xce1d('0x12')](respondWithResult(_0x2f0872,null))[_0xce1d('0x4a')](handleError(_0x2f0872,null));};exports[_0xce1d('0x27')]=function(_0xf47ef7,_0x3ac203){return db[_0xce1d('0x47')]['find']({'where':{'id':_0xf47ef7[_0xce1d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3ac203,null))['then'](removeEntity(_0x3ac203,null))[_0xce1d('0x4a')](handleError(_0x3ac203,null));};exports[_0xce1d('0x57')]=function(_0xd311fc,_0x1e1eaa){return db[_0xce1d('0x47')][_0xce1d('0x57')]()['then'](respondWithResult(_0x1e1eaa,null))[_0xce1d('0x4a')](handleError(_0x1e1eaa,null));};exports[_0xce1d('0x58')]=function(_0x4fe54b,_0x3aedc0){if(_0x4fe54b['body']['id']){delete _0x4fe54b[_0xce1d('0x50')]['id'];}return db[_0xce1d('0x47')][_0xce1d('0x4e')]({'where':{'id':_0x4fe54b[_0xce1d('0x4c')]['id']}})[_0xce1d('0x12')](handleEntityNotFound(_0x3aedc0,null))[_0xce1d('0x12')](function(_0x35a300){if(_0x35a300){_0x4fe54b['body'][_0xce1d('0x59')]=_0x35a300['id'];return db[_0xce1d('0x5a')][_0xce1d('0x4f')](_0x4fe54b[_0xce1d('0x50')]);}})[_0xce1d('0x12')](respondWithResult(_0x3aedc0,null))['catch'](handleError(_0x3aedc0,null));};exports[_0xce1d('0x5b')]=function(_0xf8492b,_0x3fbab6){var _0x1b1c71={'raw':![],'where':{}};var _0x59ed20={};var _0x5a6581={'count':0x0,'rows':[]};return db[_0xce1d('0x47')][_0xce1d('0x5c')]({'where':{'id':_0xf8492b[_0xce1d('0x4c')]['id']}})[_0xce1d('0x12')](handleEntityNotFound(_0x3fbab6,null))[_0xce1d('0x12')](function(_0x3e2b8c){if(_0x3e2b8c){_0x59ed20[_0xce1d('0x35')]=_[_0xce1d('0x37')](db[_0xce1d('0x5a')]['rawAttributes']);_0x59ed20[_0xce1d('0x36')]=_[_0xce1d('0x37')](_0xf8492b[_0xce1d('0x36')]);_0x59ed20[_0xce1d('0x38')]=_[_0xce1d('0x39')](_0x59ed20[_0xce1d('0x35')],_0x59ed20[_0xce1d('0x36')]);_0x1b1c71[_0xce1d('0x3a')]=_[_0xce1d('0x39')](_0x59ed20[_0xce1d('0x35')],qs[_0xce1d('0x3b')](_0xf8492b['query'][_0xce1d('0x3b')]));_0x1b1c71[_0xce1d('0x3a')]=_0x1b1c71[_0xce1d('0x3a')]['length']?_0x1b1c71['attributes']:_0x59ed20[_0xce1d('0x35')];if(!_0xf8492b[_0xce1d('0x36')][_0xce1d('0x3d')](_0xce1d('0x3e'))){_0x1b1c71[_0xce1d('0x21')]=qs[_0xce1d('0x21')](_0xf8492b[_0xce1d('0x36')]['limit']);_0x1b1c71[_0xce1d('0x20')]=qs[_0xce1d('0x20')](_0xf8492b[_0xce1d('0x36')][_0xce1d('0x20')]);}_0x1b1c71[_0xce1d('0x5d')]=qs['sort'](_0xf8492b['query'][_0xce1d('0x3f')]);_0x1b1c71['where']=qs['filters'](_[_0xce1d('0x41')](_0xf8492b[_0xce1d('0x36')],_0x59ed20['filters']));_0x1b1c71[_0xce1d('0x40')][_0xce1d('0x59')]=_0x3e2b8c['id'];if(_0xf8492b['query'][_0xce1d('0x42')]){_0x1b1c71[_0xce1d('0x40')]=_[_0xce1d('0x43')](_0x1b1c71['where'],{'$or':_['map'](_0x1b1c71[_0xce1d('0x3a')],function(_0x2a1125){var _0x23dd71={};_0x23dd71[_0x2a1125]={'$like':'%'+_0xf8492b['query'][_0xce1d('0x42')]+'%'};return _0x23dd71;})});}_0x1b1c71=_['merge']({},_0x1b1c71,_0xf8492b[_0xce1d('0x45')]);return db['Disposition']['count']({'where':_0x1b1c71[_0xce1d('0x40')]})['then'](function(_0x155c5a){_0x5a6581[_0xce1d('0x23')]=_0x155c5a;if(_0xf8492b[_0xce1d('0x36')]['includeAll']){_0x1b1c71[_0xce1d('0x4d')]=[{'all':!![]}];}return db['Disposition'][_0xce1d('0x48')](_0x1b1c71);})[_0xce1d('0x12')](function(_0x5b3900){_0x5a6581[_0xce1d('0x49')]=_0x5b3900;return _0x5a6581;});}})[_0xce1d('0x12')](respondWithFilteredResult(_0x3fbab6,_0x1b1c71))[_0xce1d('0x4a')](handleError(_0x3fbab6,null));};exports[_0xce1d('0x5e')]=function(_0x2a57aa,_0x5d4714){return db[_0xce1d('0x47')][_0xce1d('0x4e')]({'where':{'id':_0x2a57aa[_0xce1d('0x4c')]['id']}})[_0xce1d('0x12')](handleEntityNotFound(_0x5d4714,null))[_0xce1d('0x12')](function(_0x3070e2){if(_0x3070e2){return _0x3070e2[_0xce1d('0x5e')](_0x2a57aa[_0xce1d('0x36')][_0xce1d('0x5f')]);}})[_0xce1d('0x12')](respondWithStatusCode(_0x5d4714,null))[_0xce1d('0x4a')](handleError(_0x5d4714,null));};exports[_0xce1d('0x60')]=function(_0x3b2143,_0x593a3d){if(_0x3b2143['body']['id']){delete _0x3b2143['body']['id'];}return db[_0xce1d('0x47')][_0xce1d('0x4e')]({'where':{'id':_0x3b2143[_0xce1d('0x4c')]['id']}})[_0xce1d('0x12')](handleEntityNotFound(_0x593a3d,null))[_0xce1d('0x12')](function(_0x4dcd81){if(_0x4dcd81){_0x3b2143[_0xce1d('0x50')][_0xce1d('0x59')]=_0x4dcd81['id'];return db['CannedAnswer']['create'](_0x3b2143[_0xce1d('0x50')]);}})[_0xce1d('0x12')](respondWithResult(_0x593a3d,null))[_0xce1d('0x4a')](handleError(_0x593a3d,null));};exports['getAnswers']=function(_0x437516,_0x33d45f){var _0x4bb484={'raw':![],'where':{}};var _0x19ab0a={};var _0x15ddad={'count':0x0,'rows':[]};return db[_0xce1d('0x47')][_0xce1d('0x5c')]({'where':{'id':_0x437516['params']['id']}})[_0xce1d('0x12')](handleEntityNotFound(_0x33d45f,null))[_0xce1d('0x12')](function(_0x2ff9fd){if(_0x2ff9fd){_0x19ab0a['model']=_[_0xce1d('0x37')](db[_0xce1d('0x61')][_0xce1d('0x31')]);_0x19ab0a[_0xce1d('0x36')]=_[_0xce1d('0x37')](_0x437516[_0xce1d('0x36')]);_0x19ab0a[_0xce1d('0x38')]=_[_0xce1d('0x39')](_0x19ab0a[_0xce1d('0x35')],_0x19ab0a['query']);_0x4bb484[_0xce1d('0x3a')]=_['intersection'](_0x19ab0a[_0xce1d('0x35')],qs['fields'](_0x437516['query']['fields']));_0x4bb484['attributes']=_0x4bb484[_0xce1d('0x3a')]['length']?_0x4bb484[_0xce1d('0x3a')]:_0x19ab0a['model'];if(!_0x437516['query']['hasOwnProperty'](_0xce1d('0x3e'))){_0x4bb484['limit']=qs[_0xce1d('0x21')](_0x437516[_0xce1d('0x36')][_0xce1d('0x21')]);_0x4bb484[_0xce1d('0x20')]=qs[_0xce1d('0x20')](_0x437516[_0xce1d('0x36')]['offset']);}_0x4bb484[_0xce1d('0x5d')]=qs[_0xce1d('0x3f')](_0x437516[_0xce1d('0x36')][_0xce1d('0x3f')]);_0x4bb484[_0xce1d('0x40')]=qs[_0xce1d('0x38')](_['pick'](_0x437516[_0xce1d('0x36')],_0x19ab0a['filters']));_0x4bb484[_0xce1d('0x40')][_0xce1d('0x59')]=_0x2ff9fd['id'];if(_0x437516[_0xce1d('0x36')]['filter']){_0x4bb484[_0xce1d('0x40')]=_[_0xce1d('0x43')](_0x4bb484[_0xce1d('0x40')],{'$or':_['map'](_0x4bb484[_0xce1d('0x3a')],function(_0x261a19){var _0x3a0b85={};_0x3a0b85[_0x261a19]={'$like':'%'+_0x437516[_0xce1d('0x36')]['filter']+'%'};return _0x3a0b85;})});}_0x4bb484=_['merge']({},_0x4bb484,_0x437516[_0xce1d('0x45')]);return db['CannedAnswer'][_0xce1d('0x23')]({'where':_0x4bb484[_0xce1d('0x40')]})[_0xce1d('0x12')](function(_0x4a9217){_0x15ddad['count']=_0x4a9217;if(_0x437516['query'][_0xce1d('0x46')]){_0x4bb484[_0xce1d('0x4d')]=[{'all':!![]}];}return db[_0xce1d('0x61')][_0xce1d('0x48')](_0x4bb484);})[_0xce1d('0x12')](function(_0x3e19fb){_0x15ddad['rows']=_0x3e19fb;return _0x15ddad;});}})['then'](respondWithFilteredResult(_0x33d45f,_0x4bb484))[_0xce1d('0x4a')](handleError(_0x33d45f,null));};exports[_0xce1d('0x62')]=function(_0x28b8b5,_0x5a168f){return db[_0xce1d('0x47')][_0xce1d('0x4e')]({'where':{'id':_0x28b8b5[_0xce1d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5a168f,null))[_0xce1d('0x12')](function(_0x5332bc){if(_0x5332bc){return _0x5332bc['removeAnswers'](_0x28b8b5[_0xce1d('0x36')][_0xce1d('0x5f')]);}})[_0xce1d('0x12')](respondWithStatusCode(_0x5a168f,null))[_0xce1d('0x4a')](handleError(_0x5a168f,null));};exports[_0xce1d('0x63')]=function(_0x27d0a1,_0x4bf2f7){_0x27d0a1['body'][_0xce1d('0x64')]=_0x27d0a1[_0xce1d('0x65')][_0xce1d('0x66')];return db[_0xce1d('0x47')]['find']({'where':{'id':_0x27d0a1[_0xce1d('0x4c')]['id']}})[_0xce1d('0x12')](handleEntityNotFound(_0x4bf2f7,null))[_0xce1d('0x12')](saveUpdates(_0x27d0a1[_0xce1d('0x50')],null))[_0xce1d('0x12')](respondWithResult(_0x4bf2f7,null))[_0xce1d('0x4a')](handleError(_0x4bf2f7,null));};exports[_0xce1d('0x67')]=function(_0x2be795,_0x392517){_0x2be795[_0xce1d('0x50')]['agentAvatar']=_0x2be795[_0xce1d('0x65')][_0xce1d('0x66')];return db[_0xce1d('0x47')][_0xce1d('0x4e')]({'where':{'id':_0x2be795[_0xce1d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x392517,null))[_0xce1d('0x12')](saveUpdates(_0x2be795[_0xce1d('0x50')],null))[_0xce1d('0x12')](respondWithResult(_0x392517,null))['catch'](handleError(_0x392517,null));};exports[_0xce1d('0x68')]=function(_0x37f3f6,_0xf66e94){_0x37f3f6[_0xce1d('0x50')][_0xce1d('0x69')]=_0x37f3f6[_0xce1d('0x65')]['filename'];return db[_0xce1d('0x47')][_0xce1d('0x4e')]({'where':{'id':_0x37f3f6[_0xce1d('0x4c')]['id']}})['then'](handleEntityNotFound(_0xf66e94,null))[_0xce1d('0x12')](saveUpdates(_0x37f3f6[_0xce1d('0x50')],null))['then'](respondWithResult(_0xf66e94,null))['catch'](handleError(_0xf66e94,null));};exports[_0xce1d('0x6a')]=function(_0x333a01,_0x22b7bd){_0x333a01[_0xce1d('0x50')][_0xce1d('0x6b')]=_0x333a01[_0xce1d('0x65')][_0xce1d('0x66')];return db['ChatWebsite'][_0xce1d('0x4e')]({'where':{'id':_0x333a01[_0xce1d('0x4c')]['id']}})[_0xce1d('0x12')](handleEntityNotFound(_0x22b7bd,null))['then'](saveUpdates(_0x333a01[_0xce1d('0x50')],null))[_0xce1d('0x12')](respondWithResult(_0x22b7bd,null))['catch'](handleError(_0x22b7bd,null));};exports[_0xce1d('0x6c')]=function(_0x52a574,_0x23e49f){var _0x49f4d5=path[_0xce1d('0x6d')](config[_0xce1d('0x6e')],_0xce1d('0x6f'));var _0x57c455={'where':{'id':_0x52a574['params']['id']},'attributes':['id',_0xce1d('0x64')],'raw':!![]};var _0x2571e1=![];return require(_0xce1d('0x70'))[_0xce1d('0x71')]()[_0xce1d('0x12')](function(_0x26e651){if(_0x26e651){_0x2571e1=_0x26e651[_0xce1d('0x72')];}})[_0xce1d('0x12')](function(){return db[_0xce1d('0x47')][_0xce1d('0x4e')](_0x57c455);})[_0xce1d('0x12')](handleEntityNotFound(_0x23e49f,null))[_0xce1d('0x12')](function(_0x535c7d){if(_0x535c7d){if(!_['isNil'](_0x535c7d[_0xce1d('0x64')])){if(fs[_0xce1d('0x73')](path[_0xce1d('0x6d')](config[_0xce1d('0x6e')],_0xce1d('0x74'),_0x535c7d['sitepic']))&&_0x2571e1){_0x49f4d5=path[_0xce1d('0x6d')](config[_0xce1d('0x6e')],_0xce1d('0x74'),_0x535c7d['sitepic']);}}return _0x23e49f[_0xce1d('0x75')](_0x49f4d5);}})[_0xce1d('0x4a')](handleError(_0x23e49f,null));};exports['getAvatar']=function(_0xf47df7,_0x2a1248){var _0x3617bc=path[_0xce1d('0x6d')](config[_0xce1d('0x6e')],_0xce1d('0x76'));var _0x2283f6={'where':{'id':_0xf47df7[_0xce1d('0x4c')]['id']},'attributes':['id',_0xce1d('0x77')],'raw':!![]};return db['ChatWebsite']['find'](_0x2283f6)['then'](handleEntityNotFound(_0x2a1248,null))[_0xce1d('0x12')](function(_0x14bba5){if(_0x14bba5){if(!_[_0xce1d('0x78')](_0x14bba5[_0xce1d('0x77')])){if(fs[_0xce1d('0x73')](path[_0xce1d('0x6d')](config['root'],_0xce1d('0x79'),_0x14bba5[_0xce1d('0x77')]))){_0x3617bc=path['join'](config['root'],_0xce1d('0x79'),_0x14bba5[_0xce1d('0x77')]);}}return _0x2a1248['download'](_0x3617bc);}})[_0xce1d('0x4a')](handleError(_0x2a1248,null));};exports[_0xce1d('0x7a')]=function(_0x4fcf7e,_0x19e7cc){var _0x2c700f=path[_0xce1d('0x6d')](config[_0xce1d('0x6e')],_0xce1d('0x7b'));var _0x15ce71={'where':{'id':_0x4fcf7e[_0xce1d('0x4c')]['id']},'attributes':['id',_0xce1d('0x69'),_0xce1d('0x7c')],'raw':!![]};return db[_0xce1d('0x47')]['find'](_0x15ce71)[_0xce1d('0x12')](handleEntityNotFound(_0x19e7cc,null))[_0xce1d('0x12')](function(_0x110b24){if(_0x110b24){if(!_[_0xce1d('0x78')](_0x110b24[_0xce1d('0x69')])){if(fs[_0xce1d('0x73')](path[_0xce1d('0x6d')](config[_0xce1d('0x6e')],_0xce1d('0x79'),_0x110b24[_0xce1d('0x69')]))&&_0x110b24[_0xce1d('0x7c')]){_0x2c700f=path[_0xce1d('0x6d')](config[_0xce1d('0x6e')],_0xce1d('0x79'),_0x110b24[_0xce1d('0x69')]);}}return _0x19e7cc[_0xce1d('0x75')](_0x2c700f);}})[_0xce1d('0x4a')](handleError(_0x19e7cc,null));};exports[_0xce1d('0x7d')]=function(_0x13c431,_0x5becc8){var _0x1e60cc=path[_0xce1d('0x6d')](config[_0xce1d('0x6e')],_0xce1d('0x7e'));var _0x17819f={'where':{'id':_0x13c431[_0xce1d('0x4c')]['id']},'attributes':['id',_0xce1d('0x6b')],'raw':!![]};return db['ChatWebsite'][_0xce1d('0x4e')](_0x17819f)['then'](handleEntityNotFound(_0x5becc8,null))['then'](function(_0x535013){if(_0x535013){if(!_[_0xce1d('0x78')](_0x535013['systemAvatar'])){if(fs[_0xce1d('0x73')](path[_0xce1d('0x6d')](config[_0xce1d('0x6e')],_0xce1d('0x79'),_0x535013['systemAvatar']))){_0x1e60cc=path[_0xce1d('0x6d')](config[_0xce1d('0x6e')],_0xce1d('0x79'),_0x535013['systemAvatar']);}}return _0x5becc8[_0xce1d('0x75')](_0x1e60cc);}})['catch'](handleError(_0x5becc8,null));};exports['notify']=function(_0x337d44,_0x391e0e){var _0x4bec1c=require(_0xce1d('0x7f'));var _0xa89b19=new _0x4bec1c();var _0x2f69da=_0xa89b19[_0xce1d('0x80')](_0x337d44[_0xce1d('0x81')][_0xce1d('0x82')])[_0xce1d('0x83')]();var _0xb064ed={'body':_0x337d44[_0xce1d('0x50')],'channel':_0xce1d('0x84')};var _0x40527a=[];var _0x7364a7=[];var _0x4fd336={};var _0x3b2e1f=![];return db['CmContact'][_0xce1d('0x57')]()['then'](function(_0x193983){if(!_0x193983){throw new db[(_0xce1d('0x85'))][(_0xce1d('0x86'))](_0xce1d('0x87'));}_0x40527a=_[_0xce1d('0x88')](_[_0xce1d('0x37')](_0x193983),[_0xce1d('0x89'),_0xce1d('0x8a')]);_0x7364a7=_['difference'](_[_0xce1d('0x37')](_0x193983),[_0xce1d('0x89'),_0xce1d('0x8a'),_0xce1d('0x8b'),_0xce1d('0x8c')]);if(_0x337d44[_0xce1d('0x50')]['id']){delete _0x337d44[_0xce1d('0x50')]['id'];}if(_[_0xce1d('0x78')](_0x337d44[_0xce1d('0x50')][_0xce1d('0x8d')])){throw new db['Sequelize'][(_0xce1d('0x86'))]('from\x20is\x20mandatory');}if(_[_0xce1d('0x78')](_0x337d44[_0xce1d('0x50')][_0xce1d('0x50')])||_0x337d44[_0xce1d('0x50')]['body']===''){throw new db[(_0xce1d('0x85'))][(_0xce1d('0x86'))](_0xce1d('0x8e'));}if(_[_0xce1d('0x78')](_0x337d44[_0xce1d('0x50')][_0xce1d('0x8f')])){throw new db[(_0xce1d('0x85'))][(_0xce1d('0x86'))](_0xce1d('0x90')+_0x7364a7);}if(!_['includes'](_0x7364a7,_0x337d44[_0xce1d('0x50')]['mapKey'])){throw new db['Sequelize'][(_0xce1d('0x86'))](_0xce1d('0x91')+_0x7364a7);}_0x4fd336[_0x337d44['body'][_0xce1d('0x8f')]]=_0x337d44[_0xce1d('0x50')]['from'];})[_0xce1d('0x12')](function(){return db['ChatWebsite'][_0xce1d('0x4e')]({'where':{'id':_0x337d44[_0xce1d('0x4c')]['id']},'include':[{'model':db[_0xce1d('0x92')],'as':'List','include':[{'model':db[_0xce1d('0x93')],'as':_0xce1d('0x94'),'where':_0x4fd336,'limit':0x1,'order':[[_0xce1d('0x8a'),_0xce1d('0x95')]]}]},{'model':db[_0xce1d('0x96')],'as':'Applications'}]});})[_0xce1d('0x12')](handleEntityNotFound(_0x391e0e,null))[_0xce1d('0x12')](function(_0x246f3f){if(_0x246f3f&&_0x246f3f[_0xce1d('0x97')]){_0xb064ed['account']=_0x246f3f;_0xb064ed[_0xce1d('0x98')]=_0x246f3f[_0xce1d('0x99')];_0xb064ed['list']=_0x246f3f['List'];_0xb064ed['applications']=_[_0xce1d('0x9a')](_0xb064ed['applications'],[_0xce1d('0x9b')],[_0xce1d('0x9c')]);if(_0xb064ed[_0xce1d('0x9d')][_0xce1d('0x99')]){delete _0xb064ed[_0xce1d('0x9d')][_0xce1d('0x99')];}if(_0xb064ed[_0xce1d('0x9d')][_0xce1d('0x97')]&&_0xb064ed['account'][_0xce1d('0x97')][_0xce1d('0x94')]['length']){return _0xb064ed[_0xce1d('0x9d')][_0xce1d('0x97')][_0xce1d('0x94')][0x0];}var _0x2c04de=_['defaults'](_0x337d44[_0xce1d('0x50')],{'firstName':_0x337d44[_0xce1d('0x50')]['from'],'ListId':_0x246f3f[_0xce1d('0x8c')]});_0x2c04de[_0x337d44[_0xce1d('0x50')]['mapKey']]=_0x337d44['body'][_0xce1d('0x8d')];return db[_0xce1d('0x93')]['create'](_0x2c04de,{'fields':_0x40527a,'raw':!![]});}})[_0xce1d('0x12')](handleEntityNotFound(_0x391e0e,null))['then'](function(_0x2dd4b6){_0xb064ed['contact']=_0x2dd4b6;var _0x566e24=_0x337d44[_0xce1d('0x50')][_0xce1d('0x9e')];if(_0x337d44[_0xce1d('0x81')][_0xce1d('0x9f')]){_0x566e24=_0x337d44['headers'][_0xce1d('0x9f')];}else if(_0x337d44['headers'][_0xce1d('0xa0')]){_0x566e24=_[_0xce1d('0xa1')](_0x337d44['headers'][_0xce1d('0xa0')][_0xce1d('0xa2')](','));}if(_0x2dd4b6){var _0x2dc7b2={'ContactId':_0x2dd4b6['id'],'ChatWebsiteId':_0x337d44[_0xce1d('0x4c')]['id'],'from':(_0x2dd4b6[_0xce1d('0xa3')]||'')+'\x20'+(_0x2dd4b6[_0xce1d('0xa4')]||''),'customerIp':_0x566e24,'customerPort':_0x337d44[_0xce1d('0x81')][_0xce1d('0xa5')]?_0x337d44[_0xce1d('0x81')]['x-real-port']:null,'referer':_0x337d44[_0xce1d('0x50')][_0xce1d('0xa6')],'browserName':_0x2f69da[_0xce1d('0xa7')]['name']&&_0x2f69da[_0xce1d('0xa7')][_0xce1d('0xa8')]?util[_0xce1d('0xa9')](_0xce1d('0xaa'),_0x2f69da['browser']['name'],_0x2f69da[_0xce1d('0xa7')]['version']):'unknown','browserVersion':_0x2f69da[_0xce1d('0xa7')][_0xce1d('0xa8')]||'unknown','osName':util[_0xce1d('0xa9')](_0xce1d('0xaa'),_0x2f69da['os'][_0xce1d('0x2c')],_0x2f69da['os'][_0xce1d('0xa8')]),'osVersion':_0x2f69da['os']['version'],'deviceModel':_0x2f69da['device'][_0xce1d('0x35')]&&_0x2f69da[_0xce1d('0xab')][_0xce1d('0xac')]?util[_0xce1d('0xa9')](_0xce1d('0xad'),_0x2f69da['device']['model'],_0x2f69da[_0xce1d('0xab')][_0xce1d('0xac')],_0x2f69da[_0xce1d('0xab')]['type']):null,'deviceVendor':_0x2f69da['device'][_0xce1d('0xac')],'deviceType':_0x2f69da['device'][_0xce1d('0x33')],'formData':JSON[_0xce1d('0x18')](_0x337d44[_0xce1d('0x50')])};var _0x5a53e1={'ChatWebsiteId':_0x337d44[_0xce1d('0x4c')]['id'],'closed':![]};if(_0x337d44[_0xce1d('0x50')][_0xce1d('0xae')]){_0x5a53e1[_0xce1d('0xae')]=_0x337d44[_0xce1d('0x50')]['threadId'];return db[_0xce1d('0xaf')][_0xce1d('0x4e')]({'where':_0x5a53e1})[_0xce1d('0x12')](function(_0xa7bbe8){if(_0xa7bbe8){return[_0xa7bbe8,![]];}_0x2dc7b2[_0xce1d('0xae')]=_0x337d44[_0xce1d('0x50')][_0xce1d('0xae')];_0x2dc7b2[_0xce1d('0xb0')]=_0x337d44['body'][_0xce1d('0xb0')];return db[_0xce1d('0xaf')][_0xce1d('0x4f')](_0x2dc7b2)[_0xce1d('0x12')](function(_0xa69541){return[_0xa69541,!![]];});});}_0x5a53e1[_0xce1d('0xb1')]=_0x2dd4b6['id'];if(_0x337d44['body']['interaction']&&_0x337d44['body'][_0xce1d('0xb2')]['id']){_0x5a53e1['id']=_0x337d44['body'][_0xce1d('0xb2')]['id'];return db[_0xce1d('0xaf')][_0xce1d('0x4e')]({'where':_0x5a53e1})[_0xce1d('0x12')](function(_0x5700b5){if(_0x5700b5){return[_0x5700b5,![]];}return db[_0xce1d('0xaf')]['create'](_0x2dc7b2)[_0xce1d('0x12')](function(_0x137ec1){return[_0x137ec1,!![]];});});}return db[_0xce1d('0xaf')][_0xce1d('0x4f')](_0x2dc7b2)[_0xce1d('0x12')](function(_0x468100){return[_0x468100,!![]];});}})['spread'](function(_0x18bf39,_0x1dc4bd){if(_0x18bf39){_0x3b2e1f=_0x1dc4bd;if(!_0x1dc4bd){var _0x511494={'from':(_0xb064ed[_0xce1d('0xb3')][_0xce1d('0xa3')]||'')+'\x20'+(_0xb064ed[_0xce1d('0xb3')][_0xce1d('0xa4')]||'')};if(_0x337d44[_0xce1d('0x50')][_0xce1d('0xae')]&&_0x337d44['body'][_0xce1d('0xb4')]&&_0x337d44[_0xce1d('0x50')][_0xce1d('0xae')]!=_0x337d44[_0xce1d('0x50')][_0xce1d('0xb4')]){_0x511494[_0xce1d('0xae')]=_0x337d44[_0xce1d('0x50')][_0xce1d('0xb4')];}return _0x18bf39[_0xce1d('0x26')](_0x511494);}else{return _0x18bf39;}}})[_0xce1d('0x12')](function(_0x1a1130){_0xb064ed[_0xce1d('0xb2')]=_0x1a1130[_0xce1d('0x28')]({'plain':!![]});_0xb064ed[_0xce1d('0xb2')][_0xce1d('0xb5')]=_0x3b2e1f;if(_0xb064ed[_0xce1d('0xb2')][_0xce1d('0xb5')]){if(_0xb064ed['account']['autoclose']){_0xb064ed[_0xce1d('0x98')]['push']({'id':0x0,'priority':_0xb064ed[_0xce1d('0x98')][_0xce1d('0x3c')]+0x1,'app':_0xce1d('0xb6'),'appdata':'unmanaged','interval':_0xce1d('0xb7')});}}return db['ChatMessage'][_0xce1d('0x4f')]({'body':_0x337d44[_0xce1d('0x50')][_0xce1d('0x50')],'ChatWebsiteId':_0x337d44[_0xce1d('0x4c')]['id'],'ChatInteractionId':_0x1a1130['id'],'direction':'in','ContactId':_0xb064ed[_0xce1d('0xb3')]['id'],'AttachmentId':_0x337d44[_0xce1d('0x50')]['AttachmentId']});})[_0xce1d('0x12')](function(_0x2fc63d){_0xb064ed[_0xce1d('0x1b')]=_0x2fc63d;if(_0xb064ed[_0xce1d('0xb2')][_0xce1d('0xb8')]){return db[_0xce1d('0xb9')][_0xce1d('0x4e')]({'attributes':['id','name'],'where':{'id':_0xb064ed[_0xce1d('0xb2')][_0xce1d('0xb8')]}})[_0xce1d('0x12')](function(_0x10b239){if(_0x10b239){_0xb064ed[_0xce1d('0x98')][_0xce1d('0xba')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x10b239[_0xce1d('0x2c')]+','+(_0xb064ed[_0xce1d('0x9d')]['waitForTheAssignedAgent']||0xa),'interval':_0xce1d('0xb7')});_0xb064ed[_0xce1d('0xbb')]=!![];}return respondWithRpcPromise(_0xce1d('0xbc'),_0xce1d('0xbd'),_0xb064ed);});}return respondWithRpcPromise('Start','startRouting',_0xb064ed);})[_0xce1d('0x12')](function(_0x380dd4){respondWithRpcPromise('EventManager',_0xce1d('0xbe'),{'event':'notify','message':_0x380dd4},client9002);return _0x380dd4;})[_0xce1d('0x12')](respondWithResult(_0x391e0e,null))['catch'](handleError(_0x391e0e,null));};exports[_0xce1d('0xbf')]=function(_0x420a9b,_0x2a373b){var _0x3b1eb7,_0x291ea7,_0x4de536;var _0x536f33=[];var _0x3f093f={};var _0xea8696=_0x420a9b['files']||[];var _0x1618d6=[];var _0x26d8fa;return db[_0xce1d('0x93')][_0xce1d('0x57')]()[_0xce1d('0x12')](function(_0x7458ff){if(!_0x7458ff){throw new db[(_0xce1d('0x85'))][(_0xce1d('0x86'))](_0xce1d('0x87'));}_0x536f33=_[_0xce1d('0x88')](_[_0xce1d('0x37')](_0x7458ff),['createdAt',_0xce1d('0x8a'),_0xce1d('0x8b'),'ListId']);if(_0x420a9b[_0xce1d('0x50')]['id']){delete _0x420a9b['body']['id'];}if(_[_0xce1d('0x78')](_0x420a9b[_0xce1d('0x50')][_0xce1d('0x8d')])){throw _0x2a373b[_0xce1d('0x1e')](0x1f4)[_0xce1d('0xc0')](new db[(_0xce1d('0x85'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0xce1d('0x78')](_0x420a9b[_0xce1d('0x50')][_0xce1d('0x50')])||_0x420a9b[_0xce1d('0x50')][_0xce1d('0x50')]===''){throw _0x2a373b[_0xce1d('0x1e')](0x1f4)[_0xce1d('0xc0')](new db[(_0xce1d('0x85'))]['ValidationError'](_0xce1d('0x8e')));}if(_['isNil'](_0x420a9b[_0xce1d('0x50')][_0xce1d('0xc1')])){throw _0x2a373b[_0xce1d('0x1e')](0x1f4)['send'](new db[(_0xce1d('0x85'))][(_0xce1d('0x86'))](_0xce1d('0xc2')+_0x536f33));}if(!_[_0xce1d('0xc3')](_0x536f33,_0x420a9b[_0xce1d('0x50')][_0xce1d('0xc1')])){throw _0x2a373b[_0xce1d('0x1e')](0x1f4)[_0xce1d('0xc0')](new db['Sequelize'][(_0xce1d('0x86'))](_0xce1d('0xc4')+_0x536f33));}_0x3f093f[_0x420a9b['body']['mapKeyOffline']]=_0x420a9b[_0xce1d('0x50')]['from'];})[_0xce1d('0x12')](function(){return db[_0xce1d('0x47')][_0xce1d('0x4e')]({'where':{'id':_0x420a9b[_0xce1d('0x4c')]['id']},'include':[{'model':db[_0xce1d('0x92')],'as':'List'},{'model':db['MailAccount'],'as':_0xce1d('0xc5')}]});})[_0xce1d('0x12')](handleEntityNotFound(_0x2a373b,null))[_0xce1d('0x12')](function(_0x87a12c){if(_0x87a12c&&_0x87a12c[_0xce1d('0x97')]){_0x291ea7=_0x87a12c;var _0x7123ac=_[_0xce1d('0xc')](_0x420a9b['body'],{'firstName':_0x420a9b[_0xce1d('0x50')][_0xce1d('0x8d')],'phone':_0x420a9b[_0xce1d('0x50')][_0xce1d('0x8d')],'ListId':_0x87a12c[_0xce1d('0x8c')]});_0x7123ac[_0x420a9b[_0xce1d('0x50')][_0xce1d('0xc1')]]=_0x420a9b[_0xce1d('0x50')][_0xce1d('0x8d')];return db[_0xce1d('0x93')]['findOrCreate']({'where':_0x3f093f,'defaults':_0x7123ac});}})[_0xce1d('0xc6')](function(_0x34db7f){if(_0x34db7f){_0x4de536=_0x34db7f;var _0x5c44e0=fs['readFileSync'](path[_0xce1d('0x6d')](config[_0xce1d('0x6e')],_0xce1d('0xc7')),_0xce1d('0xc8'));var _0x1f0419=ejs[_0xce1d('0xc9')](_0x5c44e0,{'body':_['toPairs'](_0x420a9b[_0xce1d('0x50')][_0xce1d('0x50')]),'bodyTitle':_0x291ea7[_0xce1d('0xca')]});return db[_0xce1d('0xcb')][_0xce1d('0x4f')]({'body':_0x1f0419,'ContactId':_0x34db7f['id'],'ChatWebsiteId':_0x291ea7['id']});}})[_0xce1d('0x12')](function(_0x5a827c){_0x26d8fa=_0x5a827c;if(_0xea8696[_0xce1d('0x3c')]){var _0x1fe595=_0xea8696[_0xce1d('0x30')](function(_0x3bcf4e){return{'name':_0x3bcf4e[_0xce1d('0xcc')],'basename':_0x3bcf4e[_0xce1d('0x66')],'type':_0x3bcf4e[_0xce1d('0xcd')],'ChatOfflineMessageId':_0x5a827c['id']};});_0x1618d6=_0x1fe595[_0xce1d('0x30')](_0x1de2b5=>{var _0x268293={'filename':_0x1de2b5[_0xce1d('0x2c')],'path':path[_0xce1d('0x6d')](config[_0xce1d('0x6e')],_0xce1d('0xce'),_0xce1d('0xcf'),'attachments',_0xce1d('0xd0'),_0x1de2b5['basename'])};return _0x268293;});if(!_0x291ea7[_0xce1d('0xd1')]){return db[_0xce1d('0xd2')][_0xce1d('0xd3')](function(_0x1ec06f){return db[_0xce1d('0xd4')][_0xce1d('0xd5')](_0x1fe595,{'transaction':_0x1ec06f});});}}})[_0xce1d('0x12')](function(){if(_0x26d8fa){_0x3b1eb7=_0x26d8fa;return db[_0xce1d('0xc5')]['findOne']({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}})[_0xce1d('0x12')](function(_0x2b277c){if(_0x2b277c&&_0x2b277c['Smtp']&&_0x291ea7[_0xce1d('0xd6')]&&_0x291ea7[_0xce1d('0xd7')]){var _0x150595={'tls':{'rejectUnauthorized':![]}};if(_0x2b277c[_0xce1d('0xd8')][_0xce1d('0xd9')]){_0x150595[_0xce1d('0xd9')]=_0x2b277c[_0xce1d('0xd8')][_0xce1d('0xd9')];}else{_0x150595[_0xce1d('0xda')]=_0x2b277c[_0xce1d('0xd8')][_0xce1d('0xda')];_0x150595[_0xce1d('0xdb')]=_0x2b277c[_0xce1d('0xd8')][_0xce1d('0xdb')];_0x150595[_0xce1d('0xdc')]=_0x2b277c[_0xce1d('0xd8')]['secure'];}if(_0x2b277c[_0xce1d('0xd8')][_0xce1d('0xdd')]){_0x150595[_0xce1d('0xde')]={'user':_0x2b277c[_0xce1d('0xd8')][_0xce1d('0x51')],'pass':_0x2b277c['Smtp']['pass']};}return respondWithRpcPromise('SendMail',_0xce1d('0xdf'),{'account':_0x150595,'message':{'from':util[_0xce1d('0xa9')](_0xce1d('0xe0'),_0x2b277c[_0xce1d('0x2c')],_0x2b277c[_0xce1d('0xe1')]||_0x2b277c['Smtp'][_0xce1d('0x51')]),'to':_0x291ea7['forwardOfflineAddress'],'subject':_0x291ea7[_0xce1d('0xe2')],'html':_0x3b1eb7[_0xce1d('0x50')],'attachments':_0x1618d6}},client9003)[_0xce1d('0x12')](function(){return _0x3b1eb7;})[_0xce1d('0x4a')](function(_0x4ff418){console[_0xce1d('0x19')](_0x4ff418);});}})[_0xce1d('0x12')](function(){if(_0x291ea7&&_0x291ea7[_0xce1d('0xd1')]&&_0x291ea7[_0xce1d('0xe3')]){var _0x3ab15a=[];if(_0xea8696[_0xce1d('0x3c')]){_0x3ab15a=_0xea8696['map'](function(_0x3da61d){return{'name':_0x3da61d['originalname'],'basename':_0x3da61d['filename'],'type':_0x3da61d[_0xce1d('0xcd')],'ChatOfflineMessageId':_0x26d8fa['id']};});}var _0x1b8081;if(!_[_0xce1d('0x78')](_0x291ea7[_0xce1d('0xe4')])){var _0x195efc=_[_0xce1d('0x30')](_0x420a9b['body'],function(_0x24a6ff){return _0x24a6ff;});var _0x355190=_[_0xce1d('0xe5')](_0x195efc)[0x0];var _0x2afef7=_[_0xce1d('0xe6')](_0x355190,function(_0x3d7e1e){return _0x3d7e1e;});_0x1b8081=_0x2afef7[0x1][_0x291ea7['subjectOffline']];}var _0x142a31={'from':_0x4de536[_0xce1d('0xe1')],'firstName':_0x4de536['firstName'],'lastName':_0x4de536[_0xce1d('0xa4')],'mapKey':'email','message':{'from':_0x4de536[_0xce1d('0xe1')],'to':_0x291ea7['MailAccount'][_0xce1d('0xe1')],'cc':'','subject':_[_0xce1d('0x78')](_0x1b8081)?_0x291ea7[_0xce1d('0xe2')]:_0x1b8081,'messageId':'','sentAt':new Date(),'attach':_0x3ab15a['length'],'attachments':_0x3ab15a,'originChannel':_0xce1d('0xe7'),'ChatWebsiteId':_0x291ea7['id'],'ChatOfflineMessageId':_0x3b1eb7['id'],'originTo':_0x291ea7['MailAccount'][_0xce1d('0xe1')]},'body':_0x3b1eb7[_0xce1d('0x50')]};var _0x50ccf0={'account':{'id':_0x291ea7['MailAccountId']},'body':_0x142a31,'log':_0xce1d('0xe8')};return respondWithRpcPromise(_0xce1d('0xe8'),'notifyMail',_0x50ccf0,client9001)[_0xce1d('0x12')](function(){return _0x3b1eb7;})[_0xce1d('0x4a')](function(_0x107a9d){console['error'](_0x107a9d);});}return;})['then'](function(){if(_0x3b1eb7){return _0x3b1eb7;}})[_0xce1d('0x12')](respondWithResult(_0x2a373b,null))[_0xce1d('0x4a')](function(_0x1ab266){console[_0xce1d('0x19')]('catch',_0x1ab266);for(var _0x4e3977 of _0xea8696){var _0x1e61f5=path[_0xce1d('0x6d')](config[_0xce1d('0x6e')],'server',_0xce1d('0xcf'),_0xce1d('0xe9'),'offline-chat',_0x4e3977[_0xce1d('0x66')]);fs_extra['remove'](_0x1e61f5)['catch'](function(_0x7b505){console[_0xce1d('0x19')](_0xce1d('0xea'),_0x1e61f5,_0x7b505);});}});};exports[_0xce1d('0xeb')]=function(_0x27e0eb,_0xa741d){return db[_0xce1d('0xaf')][_0xce1d('0x4e')]({'where':{'id':_0x27e0eb['params']['id']}})['then'](handleEntityNotFound(_0xa741d,null))[_0xce1d('0x12')](function(_0x584743){if(_0x584743){return _0x584743['addInteraction'](_0x27e0eb['body'][_0xce1d('0x5f')],_['omit'](_0x27e0eb['body'],[_0xce1d('0x5f'),'id'])||{});}})[_0xce1d('0x12')](respondWithResult(_0xa741d,null))[_0xce1d('0x4a')](handleError(_0xa741d,null));};exports['getInteractions']=function(_0xfb63f2,_0x25afef){var _0x443a13={'raw':![],'where':{}};var _0x2542fd={};var _0x4a9112={'count':0x0,'rows':[]};return db[_0xce1d('0x47')][_0xce1d('0x5c')]({'where':{'id':_0xfb63f2['params']['id']}})[_0xce1d('0x12')](handleEntityNotFound(_0x25afef,null))[_0xce1d('0x12')](function(_0x1eb126){if(_0x1eb126){_0x2542fd[_0xce1d('0x35')]=_[_0xce1d('0x37')](db[_0xce1d('0xaf')][_0xce1d('0x31')]);_0x2542fd[_0xce1d('0x36')]=_[_0xce1d('0x37')](_0xfb63f2[_0xce1d('0x36')]);_0x2542fd['filters']=_[_0xce1d('0x39')](_0x2542fd[_0xce1d('0x35')],_0x2542fd[_0xce1d('0x36')]);_0x443a13['attributes']=_[_0xce1d('0x39')](_0x2542fd['model'],qs[_0xce1d('0x3b')](_0xfb63f2[_0xce1d('0x36')][_0xce1d('0x3b')]));_0x443a13[_0xce1d('0x3a')]=_0x443a13[_0xce1d('0x3a')][_0xce1d('0x3c')]?_0x443a13[_0xce1d('0x3a')]:_0x2542fd[_0xce1d('0x35')];if(!_0xfb63f2['query']['hasOwnProperty'](_0xce1d('0x3e'))){_0x443a13['limit']=qs['limit'](_0xfb63f2['query'][_0xce1d('0x21')]);_0x443a13['offset']=qs['offset'](_0xfb63f2[_0xce1d('0x36')][_0xce1d('0x20')]);}_0x443a13[_0xce1d('0x5d')]=qs[_0xce1d('0x3f')](_0xfb63f2[_0xce1d('0x36')][_0xce1d('0x3f')]);_0x443a13[_0xce1d('0x40')]=qs[_0xce1d('0x38')](_['pick'](_0xfb63f2['query'],_0x2542fd[_0xce1d('0x38')]));_0x443a13[_0xce1d('0x40')][_0xce1d('0x59')]=_0x1eb126['id'];if(_0xfb63f2[_0xce1d('0x36')][_0xce1d('0x42')]){_0x443a13['where']=_[_0xce1d('0x43')](_0x443a13['where'],{'$or':_['map'](_0x443a13[_0xce1d('0x3a')],function(_0x1fbd03){var _0x579ec6={};_0x579ec6[_0x1fbd03]={'$like':'%'+_0xfb63f2[_0xce1d('0x36')][_0xce1d('0x42')]+'%'};return _0x579ec6;})});}_0x443a13=_[_0xce1d('0x43')]({},_0x443a13,_0xfb63f2[_0xce1d('0x45')]);return db[_0xce1d('0xaf')][_0xce1d('0x23')]({'where':_0x443a13[_0xce1d('0x40')]})[_0xce1d('0x12')](function(_0x37da3e){_0x4a9112['count']=_0x37da3e;if(_0xfb63f2[_0xce1d('0x36')][_0xce1d('0x46')]){_0x443a13[_0xce1d('0x4d')]=[{'model':db[_0xce1d('0x93')],'as':'Contact','required':![]},{'model':db[_0xce1d('0xb9')],'as':_0xce1d('0xec'),'attributes':[_0xce1d('0x2c'),_0xce1d('0xed'),_0xce1d('0xee')],'required':![]},{'model':db[_0xce1d('0xef')],'as':_0xce1d('0xf0'),'attributes':['id',_0xce1d('0x2c'),_0xce1d('0xf1')],'where':_0xfb63f2['query']['tag']?{'id':_0xfb63f2['query'][_0xce1d('0xf2')]}:undefined,'required':_0xfb63f2['query']['tag']?!![]:![]}];}return db[_0xce1d('0xaf')][_0xce1d('0x48')](_0x443a13);})[_0xce1d('0x12')](function(_0x5bdefb){_0x4a9112[_0xce1d('0x49')]=_0x5bdefb;return _0x4a9112;});}})[_0xce1d('0x12')](respondWithFilteredResult(_0x25afef,_0x443a13))[_0xce1d('0x4a')](handleError(_0x25afef,null));};function iftimePromise(_0x5c83ab,_0x309b0b){return respondWithRpcPromise('Command',_0xce1d('0xf3'),{'command':_0x309b0b[_0xce1d('0xf4')]?util[_0xce1d('0xa9')]('iftime\x20%s,%s',_0x5c83ab[_0xce1d('0xf5')],_0x309b0b[_0xce1d('0xf4')]):util['format'](_0xce1d('0xf6'),_0x5c83ab[_0xce1d('0xf5')])},client9002)[_0xce1d('0x12')](function(_0x44bf1c){var _0x1670ec=_0x44bf1c&&_0x44bf1c[_0xce1d('0xf7')](_0xce1d('0xf8'))>=0x0?!![]:![];logger[_0xce1d('0x13')](_0xce1d('0xf9'),_0x309b0b['id'],_0x5c83ab['id'],_0x5c83ab['interval'],_0x1670ec?_0xce1d('0xfa'):_0xce1d('0xfb'),_0x309b0b[_0xce1d('0xf4')]?_0x309b0b[_0xce1d('0xf4')]:'No\x20timezone');return _0x1670ec;})[_0xce1d('0x4a')](function(_0x8a4762){logger['error'](_0xce1d('0xf9'),_0x309b0b['id'],_0x5c83ab['id'],_0x5c83ab[_0xce1d('0xf5')],util[_0xce1d('0xfc')](_0x8a4762,{'showHidden':![],'depth':null}),_0x309b0b['timezone']?_0x309b0b['timezone']:_0xce1d('0xfd'));return![];});}exports['getSnippet']=function(_0x26acda,_0x27db7c){var _0x20cba6=0x0;var _0x5d949f=0x0;var _0x163dfb=![];var _0x2d1417;var _0x370a40;return db[_0xce1d('0x47')][_0xce1d('0x4e')]({'where':{'id':_0x26acda['params']['id']},'include':[{'model':db['Interval'],'as':_0xce1d('0xfe'),'include':[{'model':db[_0xce1d('0xfe')],'as':_0xce1d('0xff'),'attributes':['id',_0xce1d('0xf5')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x27db7c,null))[_0xce1d('0x12')](function(_0x5cd43d){if(_0x5cd43d){_0x2d1417=_0x5cd43d;return _0x5cd43d[_0xce1d('0x100')]({'raw':!![]});}})['then'](function(_0x3b133b){if(_0x2d1417){if(_0x3b133b){_0x370a40=_0x3b133b;}}return require(_0xce1d('0x70'))[_0xce1d('0x71')]();})[_0xce1d('0x12')](function(_0xf6a6fe){if(_0xf6a6fe){_0x5d949f=_0xf6a6fe[_0xce1d('0x101')];_0x163dfb=_0xf6a6fe[_0xce1d('0x72')];}})[_0xce1d('0x12')](function(){return db[_0xce1d('0xaf')]['count']({'where':{'closed':![]}});})[_0xce1d('0x12')](function(_0x5e0124){_0x20cba6=_0x5e0124;if(_0x5d949f&&_0x5e0124>_0x5d949f){return db['License'][_0xce1d('0x5c')]({'where':{'id':0x1}})['then'](function(_0x40cb1a){if(_0x40cb1a){_0x40cb1a[_0xce1d('0x102')]('chatLicenseExceeded');}});}})[_0xce1d('0x12')](function(){if(_0x2d1417[_0xce1d('0xfe')]&&_0x2d1417[_0xce1d('0xfe')][_0xce1d('0xff')]){var _0x2381ab=[];for(var _0x475627=0x0;_0x475627<_0x2d1417['Interval'][_0xce1d('0xff')]['length'];_0x475627++){var _0x1d8321=_0x2d1417[_0xce1d('0xfe')]['Intervals'][_0x475627][_0xce1d('0x28')]({'plain':!![]});_0x2381ab[_0xce1d('0x103')](iftimePromise(_0x1d8321,_0x2d1417));}return BPromise[_0xce1d('0x104')](_0x2381ab)['then'](function(_0x2b17fb){return _[_0xce1d('0x105')](_0x2b17fb);});}else{return!![];}})['then'](function(_0xd3a255){var _0x319763=fs[_0xce1d('0x106')](path[_0xce1d('0x6d')](config[_0xce1d('0x6e')],_0xce1d('0x107')),_0xce1d('0xc8'));var _0x1a62d7={'remote':_0x2d1417['remote'],'query':querystring[_0xce1d('0x18')](_[_0xce1d('0x43')](_0x2d1417[_0xce1d('0x28')]({'plain':!![]}),{'customerIp':_0x26acda[_0xce1d('0x81')][_0xce1d('0xa0')]||_0x26acda[_0xce1d('0x81')]['x-real-ip']||_0x26acda[_0xce1d('0x108')][_0xce1d('0x109')]||_0x26acda['ip'],'referer':_0x26acda['headers'][_0xce1d('0xa6')],'openedInteractions':_0x20cba6,'maxInteractions':_0x5d949f,'virtual':_0x163dfb[_0xce1d('0x101')],'online':_0xd3a255,'custom':_0x163dfb}))['replace'](/'/g,'\x5c\x27')};_0x27db7c[_0xce1d('0xc0')](ejs['render'](Mustache[_0xce1d('0xc9')](_0x319763,_0x1a62d7),{'proactiveActions':_0x370a40,'alignment':_0x2d1417[_0xce1d('0x10a')],'verticalAlignment':_0x2d1417['verticalAlignment'],'div_color':_0x2d1417['color'],'labelText':_0x2d1417[_0xce1d('0x10b')],'text_color':_0x2d1417[_0xce1d('0x10c')],'button_color':_0x2d1417[_0xce1d('0x10d')],'background_color':_0x2d1417[_0xce1d('0x10e')]}));})[_0xce1d('0x4a')](handleError(_0x27db7c,null));};exports[_0xce1d('0x10f')]=function(_0x905873,_0x56301c){var _0x45cde1=_0x905873[_0xce1d('0x4c')]['id'];var _0x387bed=_0x905873[_0xce1d('0x50')];var _0x18b003=0xc8;var _0x2be8fa=null;return db[_0xce1d('0xd2')]['transaction']({'isolationLevel':db[_0xce1d('0xd2')][_0xce1d('0x110')][_0xce1d('0x111')][_0xce1d('0x112')]},function(_0x1a1087){return db[_0xce1d('0x47')][_0xce1d('0x5c')]({'where':{'id':_0x45cde1},'transaction':_0x1a1087})[_0xce1d('0x12')](function(_0x13c7fb){if(_0x13c7fb){return db[_0xce1d('0x96')][_0xce1d('0x27')]({'where':{'ChatWebsiteId':_0x45cde1},'transaction':_0x1a1087})[_0xce1d('0x12')](function(){var _0x5b7e3c=_[_0xce1d('0x30')](_0x387bed,function(_0x5f4b7b){_0x5f4b7b[_0xce1d('0x59')]=_0x45cde1;return _0x5f4b7b;});return db[_0xce1d('0x96')][_0xce1d('0xd5')](_0x5b7e3c,{'transaction':_0x1a1087});});}else{_0x18b003=0x194;_0x2be8fa=[];}});})[_0xce1d('0x12')](function(){if(_0x18b003!==0x194){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x45cde1},'order':_0xce1d('0x9b')})['then'](function(_0x2f6d69){_0x2be8fa=_0x2f6d69;});}})[_0xce1d('0x4a')](function(_0x5c0405){_0x18b003=0x1f4;logger['error'](_0x5c0405[_0xce1d('0x2b')]);if(_0x5c0405[_0xce1d('0x2c')]){delete _0x5c0405[_0xce1d('0x2c')];}_0x2be8fa=_0x5c0405;})[_0xce1d('0x113')](function(){if(_0x2be8fa===null){_0x56301c[_0xce1d('0x114')](_0x18b003);}else{if(_0x18b003===0x1f4){_0x56301c[_0xce1d('0x1e')](_0x18b003)[_0xce1d('0xc0')](_0x2be8fa);}else{_0x56301c['status'](_0x18b003)[_0xce1d('0x1f')](_0x2be8fa);}}});};exports['getApplications']=function(_0x13ddf,_0x12165d){var _0x23ecf4={};var _0x54c645={};var _0x5f0a55;var _0x4273b4;return db[_0xce1d('0x47')]['findOne']({'where':{'id':_0x13ddf[_0xce1d('0x4c')]['id']}})[_0xce1d('0x12')](handleEntityNotFound(_0x12165d,null))[_0xce1d('0x12')](function(_0x554253){if(_0x554253){_0x5f0a55=_0x554253;_0x54c645[_0xce1d('0x35')]=_[_0xce1d('0x37')](db[_0xce1d('0x96')][_0xce1d('0x31')]);_0x54c645[_0xce1d('0x36')]=_[_0xce1d('0x37')](_0x13ddf['query']);_0x54c645[_0xce1d('0x38')]=_[_0xce1d('0x39')](_0x54c645['model'],_0x54c645[_0xce1d('0x36')]);_0x23ecf4['attributes']=_[_0xce1d('0x39')](_0x54c645[_0xce1d('0x35')],qs[_0xce1d('0x3b')](_0x13ddf[_0xce1d('0x36')][_0xce1d('0x3b')]));_0x23ecf4[_0xce1d('0x3a')]=_0x23ecf4[_0xce1d('0x3a')][_0xce1d('0x3c')]?_0x23ecf4[_0xce1d('0x3a')]:_0x54c645[_0xce1d('0x35')];_0x23ecf4[_0xce1d('0x5d')]=qs[_0xce1d('0x3f')](_0x13ddf['query']['sort']);_0x23ecf4[_0xce1d('0x40')]=qs[_0xce1d('0x38')](_[_0xce1d('0x41')](_0x13ddf[_0xce1d('0x36')],_0x54c645[_0xce1d('0x38')]));if(_0x13ddf['query'][_0xce1d('0x42')]){_0x23ecf4[_0xce1d('0x40')]=_[_0xce1d('0x43')](_0x23ecf4[_0xce1d('0x40')],{'$or':_[_0xce1d('0x30')](_0x23ecf4[_0xce1d('0x3a')],function(_0x1cec86){var _0x5ca2ff={};_0x5ca2ff[_0x1cec86]={'$like':'%'+_0x13ddf[_0xce1d('0x36')]['filter']+'%'};return _0x5ca2ff;})});}_0x23ecf4=_[_0xce1d('0x43')]({},_0x23ecf4,_0x13ddf[_0xce1d('0x45')]);return _0x5f0a55[_0xce1d('0x115')](_0x23ecf4);}})[_0xce1d('0x12')](function(_0x4dce14){if(_0x4dce14){_0x4273b4=_0x4dce14['length'];if(!_0x13ddf['query']['hasOwnProperty'](_0xce1d('0x3e'))){_0x23ecf4[_0xce1d('0x21')]=qs[_0xce1d('0x21')](_0x13ddf['query'][_0xce1d('0x21')]);_0x23ecf4[_0xce1d('0x20')]=qs[_0xce1d('0x20')](_0x13ddf[_0xce1d('0x36')][_0xce1d('0x20')]);}return _0x5f0a55[_0xce1d('0x115')](_0x23ecf4);}})[_0xce1d('0x12')](function(_0x22523d){if(_0x22523d){return _0x22523d?{'count':_0x4273b4,'rows':_0x22523d}:null;}})[_0xce1d('0x12')](respondWithResult(_0x12165d,null))[_0xce1d('0x4a')](handleError(_0x12165d,null));};exports[_0xce1d('0x116')]=function(_0x22979c,_0x2079e5){return db[_0xce1d('0x117')][_0xce1d('0x4e')]({'where':{'id':_0x22979c[_0xce1d('0x4c')]['id']}})[_0xce1d('0x12')](handleEntityNotFound(_0x2079e5,null))[_0xce1d('0x12')](function(_0x57a9b4){if(_0x57a9b4){return _0x57a9b4[_0xce1d('0x116')](_0x22979c['body']['ids'],_[_0xce1d('0x118')](_0x22979c[_0xce1d('0x50')],[_0xce1d('0x5f'),'id'])||{});}})[_0xce1d('0x12')](respondWithResult(_0x2079e5,null))['catch'](handleError(_0x2079e5,null));};exports[_0xce1d('0x100')]=function(_0x1e2205,_0x4102d1){var _0x6829bb={};var _0x2a3e87={};var _0x43ce90;var _0x4b5b69;return db[_0xce1d('0x47')][_0xce1d('0x5c')]({'where':{'id':_0x1e2205[_0xce1d('0x4c')]['id']}})[_0xce1d('0x12')](handleEntityNotFound(_0x4102d1,null))[_0xce1d('0x12')](function(_0x1f9adb){if(_0x1f9adb){_0x43ce90=_0x1f9adb;_0x2a3e87[_0xce1d('0x35')]=_[_0xce1d('0x37')](db[_0xce1d('0x119')][_0xce1d('0x31')]);_0x2a3e87['query']=_[_0xce1d('0x37')](_0x1e2205[_0xce1d('0x36')]);_0x2a3e87[_0xce1d('0x38')]=_['intersection'](_0x2a3e87[_0xce1d('0x35')],_0x2a3e87['query']);_0x6829bb['attributes']=_[_0xce1d('0x39')](_0x2a3e87[_0xce1d('0x35')],qs[_0xce1d('0x3b')](_0x1e2205[_0xce1d('0x36')][_0xce1d('0x3b')]));_0x6829bb[_0xce1d('0x3a')]=_0x6829bb[_0xce1d('0x3a')][_0xce1d('0x3c')]?_0x6829bb[_0xce1d('0x3a')]:_0x2a3e87[_0xce1d('0x35')];_0x6829bb[_0xce1d('0x5d')]=qs['sort'](_0x1e2205[_0xce1d('0x36')]['sort']);_0x6829bb[_0xce1d('0x40')]=qs['filters'](_[_0xce1d('0x41')](_0x1e2205[_0xce1d('0x36')],_0x2a3e87[_0xce1d('0x38')]));if(_0x1e2205[_0xce1d('0x36')]['filter']){_0x6829bb['where']=_[_0xce1d('0x43')](_0x6829bb[_0xce1d('0x40')],{'$or':_[_0xce1d('0x30')](_0x6829bb[_0xce1d('0x3a')],function(_0x11a18d){var _0x3bd0a8={};_0x3bd0a8[_0x11a18d]={'$like':'%'+_0x1e2205[_0xce1d('0x36')][_0xce1d('0x42')]+'%'};return _0x3bd0a8;})});}_0x6829bb=_[_0xce1d('0x43')]({},_0x6829bb,_0x1e2205[_0xce1d('0x45')]);return _0x43ce90[_0xce1d('0x100')](_0x6829bb);}})[_0xce1d('0x12')](function(_0x47edb0){if(_0x47edb0){_0x4b5b69=_0x47edb0[_0xce1d('0x3c')];if(!_0x1e2205[_0xce1d('0x36')]['hasOwnProperty'](_0xce1d('0x3e'))){_0x6829bb[_0xce1d('0x21')]=qs[_0xce1d('0x21')](_0x1e2205[_0xce1d('0x36')][_0xce1d('0x21')]);_0x6829bb[_0xce1d('0x20')]=qs[_0xce1d('0x20')](_0x1e2205[_0xce1d('0x36')][_0xce1d('0x20')]);}return _0x43ce90[_0xce1d('0x100')](_0x6829bb);}})[_0xce1d('0x12')](function(_0x454915){if(_0x454915){return _0x454915?{'count':_0x4b5b69,'rows':_0x454915}:null;}})[_0xce1d('0x12')](respondWithResult(_0x4102d1,null))[_0xce1d('0x4a')](handleError(_0x4102d1,null));};exports[_0xce1d('0x11a')]=function(_0x188579,_0x1e2c3f){var _0x4126e3=_0x188579[_0xce1d('0x36')][_0xce1d('0x11b')]===_0xce1d('0x11c')?_0xce1d('0x11d'):_0xce1d('0x11e');return db[_0xce1d('0x47')]['find']({'attributes':['id',_0x4126e3],'where':{'id':_0x188579[_0xce1d('0x4c')]['id']}})[_0xce1d('0x12')](handleEntityNotFound(_0x1e2c3f,null))['then'](function(_0x2558ce){if(_0x2558ce){var _0x5821f7=_0x2558ce[_0x4126e3];var _0x55da39=_0x5821f7&&_0x5821f7['items']?_0x5821f7[_0xce1d('0x11f')]:[];_0x1e2c3f['send']({'fromKey':_[_0xce1d('0x78')](_0x5821f7['fromKey'])?undefined:_0x5821f7['fromKey'],'count':_0x55da39[_0xce1d('0x3c')],'rows':_0x55da39});}})[_0xce1d('0x4a')](handleError(_0x1e2c3f,null));};exports[_0xce1d('0x120')]=function(_0x50ffa5,_0x52e0da){var _0x915298={'raw':![],'where':{}};var _0x3ce6e5={};var _0x56e687={'count':0x0,'rows':[]};return db[_0xce1d('0x47')]['findOne']({'where':{'id':_0x50ffa5[_0xce1d('0x4c')]['id']}})[_0xce1d('0x12')](handleEntityNotFound(_0x52e0da,null))[_0xce1d('0x12')](function(_0x20290e){if(_0x20290e){_0x3ce6e5['model']=_[_0xce1d('0x37')](db[_0xce1d('0xcb')][_0xce1d('0x31')]);_0x3ce6e5[_0xce1d('0x36')]=_[_0xce1d('0x37')](_0x50ffa5[_0xce1d('0x36')]);_0x3ce6e5[_0xce1d('0x38')]=_[_0xce1d('0x39')](_0x3ce6e5[_0xce1d('0x35')],_0x3ce6e5[_0xce1d('0x36')]);_0x915298[_0xce1d('0x3a')]=_[_0xce1d('0x39')](_0x3ce6e5[_0xce1d('0x35')],qs[_0xce1d('0x3b')](_0x50ffa5[_0xce1d('0x36')]['fields']));_0x915298[_0xce1d('0x3a')]=_0x915298[_0xce1d('0x3a')][_0xce1d('0x3c')]?_0x915298['attributes']:_0x3ce6e5[_0xce1d('0x35')];if(!_0x50ffa5['query'][_0xce1d('0x3d')](_0xce1d('0x3e'))){_0x915298[_0xce1d('0x21')]=qs[_0xce1d('0x21')](_0x50ffa5[_0xce1d('0x36')]['limit']);_0x915298['offset']=qs[_0xce1d('0x20')](_0x50ffa5[_0xce1d('0x36')]['offset']);}_0x915298[_0xce1d('0x5d')]=qs['sort'](_0x50ffa5[_0xce1d('0x36')][_0xce1d('0x3f')]);_0x915298['where']=qs['filters'](_['pick'](_0x50ffa5[_0xce1d('0x36')],_0x3ce6e5[_0xce1d('0x38')]));_0x915298['where'][_0xce1d('0x59')]=_0x20290e['id'];if(_0x50ffa5[_0xce1d('0x36')][_0xce1d('0x42')]){_0x915298[_0xce1d('0x40')]=_[_0xce1d('0x43')](_0x915298[_0xce1d('0x40')],{'$or':_[_0xce1d('0x30')](_0x915298[_0xce1d('0x3a')],function(_0x12f57b){var _0x29d523={};_0x29d523[_0x12f57b]={'$like':'%'+_0x50ffa5[_0xce1d('0x36')]['filter']+'%'};return _0x29d523;})});}_0x915298=_[_0xce1d('0x43')]({},_0x915298,_0x50ffa5[_0xce1d('0x45')]);return db[_0xce1d('0xcb')][_0xce1d('0x23')]({'where':_0x915298[_0xce1d('0x40')]})[_0xce1d('0x12')](function(_0x4e1a4f){_0x56e687[_0xce1d('0x23')]=_0x4e1a4f;if(_0x50ffa5['query'][_0xce1d('0x46')]){_0x915298[_0xce1d('0x4d')]=[{'all':!![]}];}else{_0x915298[_0xce1d('0x4d')]=[{'model':db['CmContact'],'as':_0xce1d('0x121'),'required':![]},{'model':db[_0xce1d('0xd4')],'as':_0xce1d('0x122'),'required':![]}];}return db[_0xce1d('0xcb')][_0xce1d('0x48')](_0x915298);})[_0xce1d('0x12')](function(_0x5d0bc3){_0x56e687[_0xce1d('0x49')]=_0x5d0bc3;return _0x56e687;});}})[_0xce1d('0x12')](respondWithFilteredResult(_0x52e0da,_0x915298))[_0xce1d('0x4a')](handleError(_0x52e0da,null));};exports[_0xce1d('0x123')]=function(_0x6130c1,_0x4c44c0){return db[_0xce1d('0x47')][_0xce1d('0x4e')]({'where':{'id':_0x6130c1[_0xce1d('0x4c')]['id']}})[_0xce1d('0x12')](handleEntityNotFound(_0x4c44c0,null))[_0xce1d('0x12')](function(_0x306004){if(_0x306004){return _0x306004['addAgents'](_0x6130c1[_0xce1d('0x50')]['ids'],_[_0xce1d('0x118')](_0x6130c1['body'],['ids','id'])||{})[_0xce1d('0xc6')](function(_0x4a3681){for(var _0x18a0b3=0x0;_0x18a0b3<_0x6130c1[_0xce1d('0x50')][_0xce1d('0x5f')][_0xce1d('0x3c')];_0x18a0b3+=0x1){socket[_0xce1d('0x124')](_0xce1d('0x125'),{'UserId':Number(_0x6130c1[_0xce1d('0x50')][_0xce1d('0x5f')][_0x18a0b3]),'ChatWebsiteId':Number(_0x6130c1[_0xce1d('0x4c')]['id'])});}return _0x4a3681;});}})[_0xce1d('0x12')](respondWithResult(_0x4c44c0,null))['catch'](handleError(_0x4c44c0,null));};exports[_0xce1d('0x126')]=function(_0x32a6b5,_0x16c007){return db['ChatWebsite']['find']({'where':{'id':_0x32a6b5[_0xce1d('0x4c')]['id']}})[_0xce1d('0x12')](handleEntityNotFound(_0x16c007,null))[_0xce1d('0x12')](function(_0x256f16){if(_0x256f16){return _0x256f16[_0xce1d('0x126')](_0x32a6b5[_0xce1d('0x36')][_0xce1d('0x5f')])[_0xce1d('0x12')](function(){if(_[_0xce1d('0x127')](_0x32a6b5[_0xce1d('0x36')][_0xce1d('0x5f')])){for(var _0x3cc6c7=0x0;_0x3cc6c7<_0x32a6b5[_0xce1d('0x36')][_0xce1d('0x5f')][_0xce1d('0x3c')];_0x3cc6c7+=0x1){socket[_0xce1d('0x124')]('userChatWebsite:remove',{'UserId':Number(_0x32a6b5[_0xce1d('0x36')]['ids'][_0x3cc6c7]),'ChatWebsiteId':Number(_0x32a6b5[_0xce1d('0x4c')]['id'])});}}else{socket[_0xce1d('0x124')](_0xce1d('0x128'),{'UserId':Number(_0x32a6b5[_0xce1d('0x36')]['ids']),'ChatWebsiteId':Number(_0x32a6b5['params']['id'])});}});}})[_0xce1d('0x12')](respondWithStatusCode(_0x16c007,null))[_0xce1d('0x4a')](handleError(_0x16c007,null));};exports[_0xce1d('0x129')]=function(_0x390bd9,_0x224602){var _0x1128d1={};var _0x2b722d={};var _0x36723f;var _0x28d058;return db[_0xce1d('0x47')][_0xce1d('0x5c')]({'where':{'id':_0x390bd9[_0xce1d('0x4c')]['id']}})[_0xce1d('0x12')](handleEntityNotFound(_0x224602,null))['then'](function(_0x317465){if(_0x317465){_0x36723f=_0x317465;_0x2b722d['model']=_['keys'](db[_0xce1d('0xb9')][_0xce1d('0x31')]);_0x2b722d['query']=_[_0xce1d('0x37')](_0x390bd9[_0xce1d('0x36')]);_0x2b722d[_0xce1d('0x38')]=_[_0xce1d('0x39')](_0x2b722d['model'],_0x2b722d[_0xce1d('0x36')]);_0x1128d1['attributes']=_[_0xce1d('0x39')](_0x2b722d[_0xce1d('0x35')],qs[_0xce1d('0x3b')](_0x390bd9['query'][_0xce1d('0x3b')]));_0x1128d1[_0xce1d('0x3a')]=_0x1128d1[_0xce1d('0x3a')][_0xce1d('0x3c')]?_0x1128d1[_0xce1d('0x3a')]:_0x2b722d[_0xce1d('0x35')];_0x1128d1[_0xce1d('0x5d')]=qs['sort'](_0x390bd9['query'][_0xce1d('0x3f')]);_0x1128d1[_0xce1d('0x40')]=qs[_0xce1d('0x38')](_['pick'](_0x390bd9[_0xce1d('0x36')],_0x2b722d[_0xce1d('0x38')]));if(_0x390bd9[_0xce1d('0x36')][_0xce1d('0x42')]){_0x1128d1[_0xce1d('0x40')]=_[_0xce1d('0x43')](_0x1128d1['where'],{'$or':_[_0xce1d('0x30')](_0x1128d1[_0xce1d('0x3a')],function(_0x1681ae){var _0x4628c2={};_0x4628c2[_0x1681ae]={'$like':'%'+_0x390bd9[_0xce1d('0x36')][_0xce1d('0x42')]+'%'};return _0x4628c2;})});}_0x1128d1=_[_0xce1d('0x43')]({},_0x1128d1,_0x390bd9[_0xce1d('0x45')]);return _0x36723f['getAgents'](_0x1128d1);}})[_0xce1d('0x12')](function(_0x3e479a){if(_0x3e479a){_0x28d058=_0x3e479a['length'];if(!_0x390bd9[_0xce1d('0x36')][_0xce1d('0x3d')](_0xce1d('0x3e'))){_0x1128d1['limit']=qs[_0xce1d('0x21')](_0x390bd9['query']['limit']);_0x1128d1[_0xce1d('0x20')]=qs['offset'](_0x390bd9[_0xce1d('0x36')][_0xce1d('0x20')]);}return _0x36723f[_0xce1d('0x129')](_0x1128d1);}})[_0xce1d('0x12')](function(_0x111f02){if(_0x111f02){return _0x111f02?{'count':_0x28d058,'rows':_0x111f02}:null;}})[_0xce1d('0x12')](respondWithResult(_0x224602,null))[_0xce1d('0x4a')](handleError(_0x224602,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index ba9c606..5b058ae 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 _0xb1d3=['update','remove','emit','exports','events','save'];(function(_0x2c6084,_0xa2f95c){var _0x2e5e0f=function(_0x4568f0){while(--_0x4568f0){_0x2c6084['push'](_0x2c6084['shift']());}};_0x2e5e0f(++_0xa2f95c);}(_0xb1d3,0xe8));var _0x3b1d=function(_0x5c5889,_0x18ba0b){_0x5c5889=_0x5c5889-0x0;var _0x483879=_0xb1d3[_0x5c5889];return _0x483879;};'use strict';var EventEmitter=require(_0x3b1d('0x0'));var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3b1d('0x1'),'afterUpdate':_0x3b1d('0x2'),'afterDestroy':_0x3b1d('0x3')};function emitEvent(_0x22b67a){return function(_0x5b94ab,_0x18e301,_0x32cd1d){ChatWebsiteEvents[_0x3b1d('0x4')](_0x22b67a+':'+_0x5b94ab['id'],_0x5b94ab);ChatWebsiteEvents[_0x3b1d('0x4')](_0x22b67a,_0x5b94ab);_0x32cd1d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x3b1d('0x5')]=ChatWebsiteEvents; \ No newline at end of file +var _0x1c9a=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x57b2d6,_0x255ca4){var _0x32c8c8=function(_0x6b7c11){while(--_0x6b7c11){_0x57b2d6['push'](_0x57b2d6['shift']());}};_0x32c8c8(++_0x255ca4);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x267ba1,_0x1dc345){_0x267ba1=_0x267ba1-0x0;var _0x2ce1a5=_0x1c9a[_0x267ba1];return _0x2ce1a5;};'use strict';var EventEmitter=require(_0xa1c9('0x0'));var ChatWebsite=require(_0xa1c9('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xa1c9('0x2')](0x0);var events={'afterCreate':_0xa1c9('0x3'),'afterUpdate':_0xa1c9('0x4'),'afterDestroy':_0xa1c9('0x5')};function emitEvent(_0x3d8576){return function(_0x4a0d3d,_0x2f883c,_0x5bccfd){ChatWebsiteEvents[_0xa1c9('0x6')](_0x3d8576+':'+_0x4a0d3d['id'],_0x4a0d3d);ChatWebsiteEvents[_0xa1c9('0x6')](_0x3d8576,_0x4a0d3d);_0x5bccfd(null);};}for(var e in events){if(events[_0xa1c9('0x7')](e)){var event=events[e];ChatWebsite[_0xa1c9('0x8')](e,emitEvent(event));}}module[_0xa1c9('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index d7b3fc7..8738ccb 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 _0x867b=['./chatWebsite.attributes','exports','define','ChatWebsite','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1e05c1,_0x3cffa3){var _0x15f1ca=function(_0x3a9594){while(--_0x3a9594){_0x1e05c1['push'](_0x1e05c1['shift']());}};_0x15f1ca(++_0x3cffa3);}(_0x867b,0x148));var _0xb867=function(_0x23ae1d,_0x36685c){_0x23ae1d=_0x23ae1d-0x0;var _0x10cc6d=_0x867b[_0x23ae1d];return _0x10cc6d;};'use strict';var _=require('lodash');var util=require(_0xb867('0x0'));var logger=require(_0xb867('0x1'))(_0xb867('0x2'));var moment=require(_0xb867('0x3'));var BPromise=require(_0xb867('0x4'));var rp=require(_0xb867('0x5'));var fs=require('fs');var path=require(_0xb867('0x6'));var rimraf=require(_0xb867('0x7'));var config=require('../../config/environment');var attributes=require(_0xb867('0x8'));module[_0xb867('0x9')]=function(_0x1eaa95,_0xe93172){return _0x1eaa95[_0xb867('0xa')](_0xb867('0xb'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44c1=['request-promise','path','rimraf','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x46678e,_0x51511e){var _0x1e52f7=function(_0xddd3c2){while(--_0xddd3c2){_0x46678e['push'](_0x46678e['shift']());}};_0x1e52f7(++_0x51511e);}(_0x44c1,0x94));var _0x144c=function(_0x18c55f,_0x327651){_0x18c55f=_0x18c55f-0x0;var _0x334690=_0x44c1[_0x18c55f];return _0x334690;};'use strict';var _=require(_0x144c('0x0'));var util=require(_0x144c('0x1'));var logger=require(_0x144c('0x2'))(_0x144c('0x3'));var moment=require(_0x144c('0x4'));var BPromise=require(_0x144c('0x5'));var rp=require(_0x144c('0x6'));var fs=require('fs');var path=require(_0x144c('0x7'));var rimraf=require(_0x144c('0x8'));var config=require('../../config/environment');var attributes=require(_0x144c('0x9'));module[_0x144c('0xa')]=function(_0xabe740,_0x4e319b){return _0xabe740[_0x144c('0xb')](_0x144c('0xc'),attributes,{'tableName':_0x144c('0xd'),'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 4b3e858..b6cac23 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 _0x8ccf=['client','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8ccf,0x1b5));var _0xf8cc=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x8ccf[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xf8cc('0x0'));var util=require(_0xf8cc('0x1'));var moment=require(_0xf8cc('0x2'));var BPromise=require(_0xf8cc('0x3'));var rs=require(_0xf8cc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf8cc('0x5'))['db'];var utils=require(_0xf8cc('0x6'));var logger=require(_0xf8cc('0x7'))(_0xf8cc('0x8'));var config=require(_0xf8cc('0x9'));var jayson=require(_0xf8cc('0xa'));var client=jayson[_0xf8cc('0xb')]['http']({'port':0x232a});config[_0xf8cc('0xc')]=_[_0xf8cc('0xd')](config[_0xf8cc('0xc')],{'host':_0xf8cc('0xe'),'port':0x18eb});var socket=require(_0xf8cc('0xf'))(new Redis(config[_0xf8cc('0xc')]));require(_0xf8cc('0x10'))[_0xf8cc('0x11')](socket);function respondWithRpcPromise(_0x551eef,_0x4b53a3,_0x487581){return new BPromise(function(_0x430b88,_0x7deb){return client[_0xf8cc('0x12')](_0x551eef,_0x487581)['then'](function(_0xa621b3){logger[_0xf8cc('0x13')](_0xf8cc('0x14'),_0x4b53a3,_0xf8cc('0x15'));logger[_0xf8cc('0x16')](_0xf8cc('0x17'),_0x4b53a3,_0xf8cc('0x15'),JSON[_0xf8cc('0x18')](_0xa621b3));if(_0xa621b3['error']){if(_0xa621b3[_0xf8cc('0x19')][_0xf8cc('0x1a')]===0x1f4){logger[_0xf8cc('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x4b53a3,_0xa621b3[_0xf8cc('0x19')][_0xf8cc('0x1b')]);return _0x7deb(_0xa621b3[_0xf8cc('0x19')]['message']);}logger[_0xf8cc('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x4b53a3,_0xa621b3[_0xf8cc('0x19')]['message']);return _0x430b88(_0xa621b3[_0xf8cc('0x19')][_0xf8cc('0x1b')]);}else{logger[_0xf8cc('0x13')](_0xf8cc('0x14'),_0x4b53a3,'request\x20sent');_0x430b88(_0xa621b3['result'][_0xf8cc('0x1b')]);}})['catch'](function(_0x43d508){logger[_0xf8cc('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x4b53a3,_0x43d508);_0x7deb(_0x43d508);});});} \ No newline at end of file +var _0x33f9=['request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x33f9,0x16c));var _0x933f=function(_0x4cb09a,_0x18aaac){_0x4cb09a=_0x4cb09a-0x0;var _0x20bfaf=_0x33f9[_0x4cb09a];return _0x20bfaf;};'use strict';var _=require(_0x933f('0x0'));var util=require(_0x933f('0x1'));var moment=require(_0x933f('0x2'));var BPromise=require(_0x933f('0x3'));var rs=require(_0x933f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x933f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x933f('0x6'));var config=require(_0x933f('0x7'));var jayson=require(_0x933f('0x8'));var client=jayson[_0x933f('0x9')][_0x933f('0xa')]({'port':0x232a});config[_0x933f('0xb')]=_['defaults'](config[_0x933f('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x933f('0xc'))(new Redis(config[_0x933f('0xb')]));require('./chatWebsite.socket')[_0x933f('0xd')](socket);function respondWithRpcPromise(_0x42b33d,_0x53cf01,_0x55d547){return new BPromise(function(_0xaa9a2c,_0x1beef4){return client[_0x933f('0xe')](_0x42b33d,_0x55d547)[_0x933f('0xf')](function(_0x258aed){logger['info'](_0x933f('0x10'),_0x53cf01,_0x933f('0x11'));logger[_0x933f('0x12')](_0x933f('0x13'),_0x53cf01,_0x933f('0x11'),JSON[_0x933f('0x14')](_0x258aed));if(_0x258aed['error']){if(_0x258aed[_0x933f('0x15')][_0x933f('0x16')]===0x1f4){logger[_0x933f('0x15')](_0x933f('0x10'),_0x53cf01,_0x258aed[_0x933f('0x15')]['message']);return _0x1beef4(_0x258aed[_0x933f('0x15')][_0x933f('0x17')]);}logger[_0x933f('0x15')](_0x933f('0x10'),_0x53cf01,_0x258aed[_0x933f('0x15')][_0x933f('0x17')]);return _0xaa9a2c(_0x258aed[_0x933f('0x15')][_0x933f('0x17')]);}else{logger[_0x933f('0x18')](_0x933f('0x10'),_0x53cf01,_0x933f('0x11'));_0xaa9a2c(_0x258aed[_0x933f('0x19')][_0x933f('0x17')]);}})[_0x933f('0x1a')](function(_0x26adaf){logger[_0x933f('0x15')](_0x933f('0x10'),_0x53cf01,_0x26adaf);_0x1beef4(_0x26adaf);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index fb5eace..ad9af17 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 _0x139b=['chatWebsite:','save','remove','emit','removeListener','length'];(function(_0x3da47e,_0x2c6839){var _0x43ab13=function(_0x2ceea8){while(--_0x2ceea8){_0x3da47e['push'](_0x3da47e['shift']());}};_0x43ab13(++_0x2c6839);}(_0x139b,0x1ab));var _0xb139=function(_0x1cfd80,_0x360be7){_0x1cfd80=_0x1cfd80-0x0;var _0x5e0f39=_0x139b[_0x1cfd80];return _0x5e0f39;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xb139('0x0'),_0xb139('0x1'),'update'];function createListener(_0x94e03b,_0x4e8e71){return function(_0x353993){_0x4e8e71[_0xb139('0x2')](_0x94e03b,_0x353993);};}function removeListener(_0x8febc0,_0x3d9ce8){return function(){ChatWebsiteEvents[_0xb139('0x3')](_0x8febc0,_0x3d9ce8);};}exports['register']=function(_0x57fcac){for(var _0x40b57b=0x0,_0x384330=events[_0xb139('0x4')];_0x40b57b<_0x384330;_0x40b57b++){var _0x5bd6ee=events[_0x40b57b];var _0x651be1=createListener(_0xb139('0x5')+_0x5bd6ee,_0x57fcac);ChatWebsiteEvents['on'](_0x5bd6ee,_0x651be1);}}; \ No newline at end of file +var _0x36c6=['emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save','remove','update'];(function(_0x2685a7,_0x450764){var _0x443d29=function(_0x5e41e7){while(--_0x5e41e7){_0x2685a7['push'](_0x2685a7['shift']());}};_0x443d29(++_0x450764);}(_0x36c6,0xb9));var _0x636c=function(_0x1f2be7,_0x5bd18a){_0x1f2be7=_0x1f2be7-0x0;var _0x57a6fb=_0x36c6[_0x1f2be7];return _0x57a6fb;};'use strict';var ChatWebsiteEvents=require(_0x636c('0x0'));var events=[_0x636c('0x1'),_0x636c('0x2'),_0x636c('0x3')];function createListener(_0x2c6350,_0x4130a8){return function(_0x57ad9a){_0x4130a8[_0x636c('0x4')](_0x2c6350,_0x57ad9a);};}function removeListener(_0x4432e3,_0x1d9892){return function(){ChatWebsiteEvents[_0x636c('0x5')](_0x4432e3,_0x1d9892);};}exports[_0x636c('0x6')]=function(_0x381420){for(var _0x364e31=0x0,_0x4fc94b=events[_0x636c('0x7')];_0x364e31<_0x4fc94b;_0x364e31++){var _0x1232aa=events[_0x364e31];var _0x56c626=createListener(_0x636c('0x8')+_0x1232aa,_0x381420);ChatWebsiteEvents['on'](_0x1232aa,_0x56c626);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index b196df8..8508080 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 _0x5349=['getCustomerAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','getAgents','post','create','addAnswer','join','root','server/files/images/logos/','%s-%s','originalname','single','file','diskStorage','server/files/images/avatars/','format','now','/:id/avatar','addAvatar','/:id/system_avatar','addSystemAvatar','notify','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','/:id/users','addAgents','delete','destroy','removeDispositions','removeAgents','multer','util','path','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getAvatar','/:id/customer_avatar'];(function(_0x1f2e5e,_0x36db41){var _0x16fcdb=function(_0x37fae9){while(--_0x37fae9){_0x1f2e5e['push'](_0x1f2e5e['shift']());}};_0x16fcdb(++_0x36db41);}(_0x5349,0x12f));var _0x9534=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x5349[_0x1d9aa0];return _0x226868;};'use strict';var multer=require(_0x9534('0x0'));var util=require(_0x9534('0x1'));var path=require(_0x9534('0x2'));var timeout=require('connect-timeout');var express=require(_0x9534('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9534('0x4'));var interaction=require(_0x9534('0x5'));var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router[_0x9534('0x6')]('/',auth[_0x9534('0x7')](),controller['index']);router[_0x9534('0x6')]('/describe',auth[_0x9534('0x7')](),controller[_0x9534('0x8')]);router[_0x9534('0x6')](_0x9534('0x9'),auth[_0x9534('0x7')](),controller['show']);router[_0x9534('0x6')](_0x9534('0xa'),auth[_0x9534('0x7')](),controller[_0x9534('0xb')]);router[_0x9534('0x6')](_0x9534('0xc'),auth[_0x9534('0x7')](),controller[_0x9534('0xd')]);router[_0x9534('0x6')](_0x9534('0xe'),controller['getLogo']);router[_0x9534('0x6')]('/:id/avatar',controller[_0x9534('0xf')]);router[_0x9534('0x6')](_0x9534('0x10'),controller[_0x9534('0x11')]);router[_0x9534('0x6')]('/:id/system_avatar',controller['getSystemAvatar']);router[_0x9534('0x6')](_0x9534('0x12'),auth[_0x9534('0x7')](),controller[_0x9534('0x13')]);router[_0x9534('0x6')](_0x9534('0x14'),controller[_0x9534('0x15')]);router[_0x9534('0x6')](_0x9534('0x16'),auth['isAuthenticated'](),controller[_0x9534('0x17')]);router[_0x9534('0x6')](_0x9534('0x18'),auth[_0x9534('0x7')](),controller['getProactiveActions']);router[_0x9534('0x6')](_0x9534('0x19'),controller[_0x9534('0x1a')]);router[_0x9534('0x6')](_0x9534('0x1b'),auth[_0x9534('0x7')](),controller[_0x9534('0x1c')]);router[_0x9534('0x6')]('/:id/users',auth[_0x9534('0x7')](),controller[_0x9534('0x1d')]);router[_0x9534('0x1e')]('/',auth[_0x9534('0x7')](),controller[_0x9534('0x1f')]);router[_0x9534('0x1e')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0x9534('0x1e')]('/:id/canned_answers',auth[_0x9534('0x7')](),controller[_0x9534('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x516390,_0x57bc58,_0x52e111){_0x52e111(null,path[_0x9534('0x21')](config[_0x9534('0x22')],_0x9534('0x23')));},'filename':function(_0x1ca722,_0x49ce08,_0x24cfef){_0x24cfef(null,util['format'](_0x9534('0x24'),Date['now'](),_0x49ce08[_0x9534('0x25')]));}})});router[_0x9534('0x1e')]('/:id/logo',upload[_0x9534('0x26')](_0x9534('0x27')),controller['addLogo']);var upload=multer({'storage':multer[_0x9534('0x28')]({'destination':function(_0x123d8e,_0x247e56,_0xd94d28){_0xd94d28(null,path[_0x9534('0x21')](config[_0x9534('0x22')],_0x9534('0x29')));},'filename':function(_0x1e5b47,_0x33e872,_0x42c661){_0x42c661(null,util[_0x9534('0x2a')](_0x9534('0x24'),Date[_0x9534('0x2b')](),_0x33e872[_0x9534('0x25')]));}})});router[_0x9534('0x1e')](_0x9534('0x2c'),upload[_0x9534('0x26')]('file'),controller[_0x9534('0x2d')]);var upload=multer({'storage':multer[_0x9534('0x28')]({'destination':function(_0x169c56,_0x397e81,_0x303de4){_0x303de4(null,path['join'](config[_0x9534('0x22')],'server/files/images/avatars/'));},'filename':function(_0xee9295,_0x1d9e87,_0x2b1f9a){_0x2b1f9a(null,util[_0x9534('0x2a')](_0x9534('0x24'),Date[_0x9534('0x2b')](),_0x1d9e87[_0x9534('0x25')]));}})});router['post'](_0x9534('0x10'),upload[_0x9534('0x26')]('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x9534('0x28')]({'destination':function(_0x851e46,_0x3fa061,_0x353401){_0x353401(null,path[_0x9534('0x21')](config[_0x9534('0x22')],_0x9534('0x29')));},'filename':function(_0x26b953,_0x5c6a44,_0x13a26c){_0x13a26c(null,util[_0x9534('0x2a')](_0x9534('0x24'),Date[_0x9534('0x2b')](),_0x5c6a44[_0x9534('0x25')]));}})});router[_0x9534('0x1e')](_0x9534('0x2e'),upload[_0x9534('0x26')](_0x9534('0x27')),controller[_0x9534('0x2f')]);router[_0x9534('0x1e')]('/:id/notify',controller[_0x9534('0x30')]);const offlineUploadMulter=multer({'storage':multer[_0x9534('0x28')]({'destination':function(_0x240a5d,_0x4f24e1,_0x4b9dd4){const _0x276120=path[_0x9534('0x21')](config[_0x9534('0x22')],'server/files',_0x9534('0x31'),_0x9534('0x32'));fs_extra[_0x9534('0x33')](_0x276120,function(){_0x4b9dd4(null,_0x276120);});},'filename':function(_0x335996,_0x2e3509,_0x1d74e5){const _0x2a7ca9=_0x2e3509[_0x9534('0x25')][_0x9534('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x34ddb6=path[_0x9534('0x35')](_0x2a7ca9);const _0x100e3a=Date[_0x9534('0x2b')]()+'-'+_0x2a7ca9[_0x9534('0x34')](_0x34ddb6,'')+_0x34ddb6;_0x1d74e5(null,_0x100e3a);}})});router[_0x9534('0x1e')](_0x9534('0x36'),offlineUploadMulter[_0x9534('0x37')](),controller[_0x9534('0x38')]);router[_0x9534('0x1e')](_0x9534('0x12'),auth['isAuthenticated'](),controller[_0x9534('0x39')]);router[_0x9534('0x1e')](_0x9534('0x16'),auth[_0x9534('0x7')](),controller['addApplications']);router[_0x9534('0x1e')](_0x9534('0x18'),auth[_0x9534('0x7')](),controller['addProactiveActions']);router[_0x9534('0x1e')](_0x9534('0x3a'),auth[_0x9534('0x7')](),controller[_0x9534('0x3b')]);router['put'](_0x9534('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x9534('0x3c')](_0x9534('0x9'),auth[_0x9534('0x7')](),controller[_0x9534('0x3d')]);router[_0x9534('0x3c')](_0x9534('0xa'),auth[_0x9534('0x7')](),controller[_0x9534('0x3e')]);router[_0x9534('0x3c')](_0x9534('0xc'),auth[_0x9534('0x7')](),controller['removeAnswers']);router[_0x9534('0x3c')](_0x9534('0x3a'),auth[_0x9534('0x7')](),controller[_0x9534('0x3f')]);module['exports']=router; \ No newline at end of file +var _0xe4b6=['create','addDisposition','/:id/canned_answers','addAnswer','diskStorage','format','%s-%s','originalname','single','file','addLogo','root','server/files/images/avatars/','now','join','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','extname','replace','/:id/offline','any','addApplications','/:id/proactive_actions','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAgents','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/fields','getFields','getOfflineMessages','/:id/users','post'];(function(_0x5f12b5,_0xaddf89){var _0x581586=function(_0x7f4294){while(--_0x7f4294){_0x5f12b5['push'](_0x5f12b5['shift']());}};_0x581586(++_0xaddf89);}(_0xe4b6,0xab));var _0x6e4b=function(_0x51e42a,_0x2e2098){_0x51e42a=_0x51e42a-0x0;var _0x483535=_0xe4b6[_0x51e42a];return _0x483535;};'use strict';var multer=require('multer');var util=require(_0x6e4b('0x0'));var path=require(_0x6e4b('0x1'));var timeout=require('connect-timeout');var express=require(_0x6e4b('0x2'));var router=express[_0x6e4b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6e4b('0x4'));var interaction=require(_0x6e4b('0x5'));var config=require(_0x6e4b('0x6'));var controller=require(_0x6e4b('0x7'));router[_0x6e4b('0x8')]('/',auth[_0x6e4b('0x9')](),controller[_0x6e4b('0xa')]);router[_0x6e4b('0x8')]('/describe',auth[_0x6e4b('0x9')](),controller[_0x6e4b('0xb')]);router[_0x6e4b('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x6e4b('0xc')]);router['get'](_0x6e4b('0xd'),auth[_0x6e4b('0x9')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0x6e4b('0x9')](),controller[_0x6e4b('0xe')]);router[_0x6e4b('0x8')](_0x6e4b('0xf'),controller[_0x6e4b('0x10')]);router['get'](_0x6e4b('0x11'),controller[_0x6e4b('0x12')]);router[_0x6e4b('0x8')](_0x6e4b('0x13'),controller['getCustomerAvatar']);router[_0x6e4b('0x8')]('/:id/system_avatar',controller[_0x6e4b('0x14')]);router['get'](_0x6e4b('0x15'),auth[_0x6e4b('0x9')](),controller[_0x6e4b('0x16')]);router['get'](_0x6e4b('0x17'),controller[_0x6e4b('0x18')]);router[_0x6e4b('0x8')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0x6e4b('0x8')]('/:id/proactive_actions',auth[_0x6e4b('0x9')](),controller['getProactiveActions']);router[_0x6e4b('0x8')](_0x6e4b('0x19'),controller[_0x6e4b('0x1a')]);router[_0x6e4b('0x8')]('/:id/offline_messages',auth['isAuthenticated'](),controller[_0x6e4b('0x1b')]);router[_0x6e4b('0x8')](_0x6e4b('0x1c'),auth[_0x6e4b('0x9')](),controller['getAgents']);router[_0x6e4b('0x1d')]('/',auth['isAuthenticated'](),controller[_0x6e4b('0x1e')]);router[_0x6e4b('0x1d')](_0x6e4b('0xd'),auth[_0x6e4b('0x9')](),controller[_0x6e4b('0x1f')]);router[_0x6e4b('0x1d')](_0x6e4b('0x20'),auth[_0x6e4b('0x9')](),controller[_0x6e4b('0x21')]);var upload=multer({'storage':multer[_0x6e4b('0x22')]({'destination':function(_0x31a483,_0x300c20,_0x24eb78){_0x24eb78(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x38a92d,_0x4317f7,_0xe65143){_0xe65143(null,util[_0x6e4b('0x23')](_0x6e4b('0x24'),Date['now'](),_0x4317f7[_0x6e4b('0x25')]));}})});router[_0x6e4b('0x1d')](_0x6e4b('0xf'),upload[_0x6e4b('0x26')](_0x6e4b('0x27')),controller[_0x6e4b('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x163a07,_0x4cd630,_0x51fd11){_0x51fd11(null,path['join'](config[_0x6e4b('0x29')],_0x6e4b('0x2a')));},'filename':function(_0x8e0aed,_0x1dd7b8,_0x1933f6){_0x1933f6(null,util[_0x6e4b('0x23')]('%s-%s',Date[_0x6e4b('0x2b')](),_0x1dd7b8[_0x6e4b('0x25')]));}})});router['post'](_0x6e4b('0x11'),upload['single'](_0x6e4b('0x27')),controller['addAvatar']);var upload=multer({'storage':multer[_0x6e4b('0x22')]({'destination':function(_0x46689d,_0x24300e,_0x41bba4){_0x41bba4(null,path[_0x6e4b('0x2c')](config[_0x6e4b('0x29')],_0x6e4b('0x2a')));},'filename':function(_0x5c39eb,_0x18945d,_0x4f152c){_0x4f152c(null,util[_0x6e4b('0x23')](_0x6e4b('0x24'),Date[_0x6e4b('0x2b')](),_0x18945d[_0x6e4b('0x25')]));}})});router[_0x6e4b('0x1d')]('/:id/customer_avatar',upload[_0x6e4b('0x26')](_0x6e4b('0x27')),controller[_0x6e4b('0x2d')]);var upload=multer({'storage':multer[_0x6e4b('0x22')]({'destination':function(_0x46a30f,_0x4d2715,_0x287ca3){_0x287ca3(null,path[_0x6e4b('0x2c')](config[_0x6e4b('0x29')],_0x6e4b('0x2a')));},'filename':function(_0x1b2068,_0xf568dd,_0x45a370){_0x45a370(null,util[_0x6e4b('0x23')]('%s-%s',Date[_0x6e4b('0x2b')](),_0xf568dd[_0x6e4b('0x25')]));}})});router[_0x6e4b('0x1d')](_0x6e4b('0x2e'),upload[_0x6e4b('0x26')]('file'),controller[_0x6e4b('0x2f')]);router['post'](_0x6e4b('0x30'),controller[_0x6e4b('0x31')]);const offlineUploadMulter=multer({'storage':multer[_0x6e4b('0x22')]({'destination':function(_0x57f8d8,_0xbf078f,_0x5da562){const _0x506366=path['join'](config[_0x6e4b('0x29')],_0x6e4b('0x32'),_0x6e4b('0x33'),'offline-chat');fs_extra['ensureDir'](_0x506366,function(){_0x5da562(null,_0x506366);});},'filename':function(_0x4d497b,_0x204f09,_0x5c750b){const _0x17f702=_0x204f09[_0x6e4b('0x25')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0xc0256d=path[_0x6e4b('0x34')](_0x17f702);const _0x13ba83=Date[_0x6e4b('0x2b')]()+'-'+_0x17f702[_0x6e4b('0x35')](_0xc0256d,'')+_0xc0256d;_0x5c750b(null,_0x13ba83);}})});router[_0x6e4b('0x1d')](_0x6e4b('0x36'),offlineUploadMulter[_0x6e4b('0x37')](),controller['offline']);router['post'](_0x6e4b('0x15'),auth[_0x6e4b('0x9')](),controller['addInteraction']);router[_0x6e4b('0x1d')]('/:id/applications',auth[_0x6e4b('0x9')](),controller[_0x6e4b('0x38')]);router[_0x6e4b('0x1d')](_0x6e4b('0x39'),auth[_0x6e4b('0x9')](),controller['addProactiveActions']);router[_0x6e4b('0x1d')](_0x6e4b('0x1c'),auth[_0x6e4b('0x9')](),controller[_0x6e4b('0x3a')]);router[_0x6e4b('0x3b')](_0x6e4b('0x3c'),auth[_0x6e4b('0x9')](),controller[_0x6e4b('0x3d')]);router[_0x6e4b('0x3e')](_0x6e4b('0x3c'),auth[_0x6e4b('0x9')](),controller[_0x6e4b('0x3f')]);router[_0x6e4b('0x3e')](_0x6e4b('0xd'),auth[_0x6e4b('0x9')](),controller[_0x6e4b('0x40')]);router[_0x6e4b('0x3e')](_0x6e4b('0x20'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x6e4b('0x3e')](_0x6e4b('0x1c'),auth[_0x6e4b('0x9')](),controller[_0x6e4b('0x41')]);module[_0x6e4b('0x42')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index b419ca7..dc6dc61 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 _0xd964=['MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT'];(function(_0x20ab9c,_0x230ca1){var _0x2d4d95=function(_0x46cb50){while(--_0x46cb50){_0x20ab9c['push'](_0x20ab9c['shift']());}};_0x2d4d95(++_0x230ca1);}(_0xd964,0x1c5));var _0x4d96=function(_0x4b1b8b,_0x43bdb6){_0x4b1b8b=_0x4b1b8b-0x0;var _0x5c5a88=_0xd964[_0x4b1b8b];return _0x5c5a88;};'use strict';var Sequelize=require(_0x4d96('0x0'));module[_0x4d96('0x1')]={'name':{'type':Sequelize[_0x4d96('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x4d96('0x3')](_0x4d96('0x4'),_0x4d96('0x5'),_0x4d96('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x4d96('0x7'),_0x4d96('0x8'))},'data1':{'type':Sequelize[_0x4d96('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize['STRING'],'comment':_0x4d96('0x9')},'data3':{'type':Sequelize[_0x4d96('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x4d96('0x2')],'comment':_0x4d96('0xa')},'data5':{'type':Sequelize[_0x4d96('0xb')],'comment':_0x4d96('0xc')},'data6':{'type':Sequelize['TEXT'],'comment':_0x4d96('0xd')},'data7':{'type':Sequelize['TEXT'],'comment':_0x4d96('0xe')}}; \ No newline at end of file +var _0xa0a5=['MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','Google','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id'];(function(_0x3cba90,_0x3a3927){var _0x2830ba=function(_0x343793){while(--_0x343793){_0x3cba90['push'](_0x3cba90['shift']());}};_0x2830ba(++_0x3a3927);}(_0xa0a5,0x123));var _0x5a0a=function(_0x3df223,_0x1740fc){_0x3df223=_0x3df223-0x0;var _0x562d11=_0xa0a5[_0x3df223];return _0x562d11;};'use strict';var Sequelize=require(_0x5a0a('0x0'));module[_0x5a0a('0x1')]={'name':{'type':Sequelize[_0x5a0a('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x5a0a('0x3')]('AmazonAWS',_0x5a0a('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x5a0a('0x3')](_0x5a0a('0x5'),_0x5a0a('0x6'))},'data1':{'type':Sequelize[_0x5a0a('0x2')],'comment':_0x5a0a('0x7')},'data2':{'type':Sequelize[_0x5a0a('0x2')],'comment':_0x5a0a('0x8')},'data3':{'type':Sequelize[_0x5a0a('0x2')],'comment':_0x5a0a('0x9')},'data4':{'type':Sequelize[_0x5a0a('0x2')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x5a0a('0xa')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x5a0a('0xa')],'comment':_0x5a0a('0xb')},'data7':{'type':Sequelize['TEXT'],'comment':_0x5a0a('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 1f6a824..7b99d38 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 _0xf5eb=['body','find','Dynamics365','/.default','Outlook365','data7','replace','{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','hex','client_id','data1','response_type','join','redirect_uri','data4','response_mode','form_post','scope','state','nonce','prompt','login','key','value','oauth2Claims','set','decode','payload','iss','issuer','aud','isAfter','exp','refresh_token','data6','data3','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s','POST','oauth2MicrosoftAuthorize','findOne','user','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','parse','del','access_token','data5','bind','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s','moment','crypto','jsonwebtoken','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','sendStatus','status','json','limit','undefined','count','offset','Content-Range','update','then','destroy','error','stack','name','send','index','map','fieldName','type','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','CloudProvider','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0xf5eb,0x1b5));var _0xbf5e=function(_0x37afa8,_0x4f64c5){_0x37afa8=_0x37afa8-0x0;var _0x4e8c24=_0xf5eb[_0x37afa8];return _0x4e8c24;};'use strict';var rp=require('request-promise');var _=require('lodash');var moment=require(_0xbf5e('0x0'));var crypto=require(_0xbf5e('0x1'));var jwt=require(_0xbf5e('0x2'));var Redis=require('ioredis');var qs=require(_0xbf5e('0x3'));var config=require('../../config/environment');var logger=require(_0xbf5e('0x4'))('api');var db=require(_0xbf5e('0x5'))['db'];config[_0xbf5e('0x6')]=_[_0xbf5e('0x7')](config[_0xbf5e('0x6')],{'host':_0xbf5e('0x8'),'port':0x18eb});var socket=require(_0xbf5e('0x9'))(new Redis(config[_0xbf5e('0x6')]));var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0xbf5e('0xa'),_0xbf5e('0xb'),_0xbf5e('0xc'),_0xbf5e('0xd'),_0xbf5e('0xe'),_0xbf5e('0xf')],'Dynamics365':['openid','offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xbf5e('0x10');var MICROSOFT_TOKEN_ENDPOINT='/token';function respondWithStatusCode(_0x57f351,_0x6deac6){_0x6deac6=_0x6deac6||0xcc;return function(_0x477344){if(_0x477344){return _0x57f351[_0xbf5e('0x11')](_0x6deac6);}return _0x57f351[_0xbf5e('0x12')](_0x6deac6)['end']();};}function respondWithResult(_0x31113a,_0x5245be){_0x5245be=_0x5245be||0xc8;return function(_0x2f143b){if(_0x2f143b){return _0x31113a[_0xbf5e('0x12')](_0x5245be)[_0xbf5e('0x13')](_0x2f143b);}};}function respondWithFilteredResult(_0x12288f,_0x4dca49){return function(_0x8d2e3c){if(_0x8d2e3c){var _0x5cc0dd=typeof _0x4dca49['offset']==='undefined'&&typeof _0x4dca49[_0xbf5e('0x14')]===_0xbf5e('0x15');var _0x79cc75=_0x8d2e3c[_0xbf5e('0x16')];var _0x45f270=_0x5cc0dd?0x0:_0x4dca49[_0xbf5e('0x17')];var _0x98a3bf=_0x5cc0dd?_0x8d2e3c[_0xbf5e('0x16')]:_0x4dca49[_0xbf5e('0x17')]+_0x4dca49[_0xbf5e('0x14')];var _0x384d74;if(_0x98a3bf>=_0x79cc75){_0x98a3bf=_0x79cc75;_0x384d74=0xc8;}else{_0x384d74=0xce;}_0x12288f[_0xbf5e('0x12')](_0x384d74);return _0x12288f['set'](_0xbf5e('0x18'),_0x45f270+'-'+_0x98a3bf+'/'+_0x79cc75)[_0xbf5e('0x13')](_0x8d2e3c);}return null;};}function saveUpdates(_0x5d3cfb){return function(_0x5d8931){if(_0x5d8931){return _0x5d8931[_0xbf5e('0x19')](_0x5d3cfb)[_0xbf5e('0x1a')](function(_0x3a50b4){return _0x3a50b4;});}return null;};}function removeEntity(_0x5e449a){return function(_0x3f9a21){if(_0x3f9a21){return _0x3f9a21[_0xbf5e('0x1b')]()[_0xbf5e('0x1a')](function(){_0x5e449a[_0xbf5e('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe61d3f){return function(_0x3585c9){if(!_0x3585c9){_0xe61d3f[_0xbf5e('0x11')](0x194);}return _0x3585c9;};}function handleError(_0x24ca59,_0x16404e){_0x16404e=_0x16404e||0x1f4;return function(_0x512118){logger[_0xbf5e('0x1c')](_0x512118[_0xbf5e('0x1d')]);if(_0x512118[_0xbf5e('0x1e')]){delete _0x512118[_0xbf5e('0x1e')];}_0x24ca59[_0xbf5e('0x12')](_0x16404e)[_0xbf5e('0x1f')](_0x512118);};}exports[_0xbf5e('0x20')]=function(_0x537978,_0x4e3f7d){var _0x319138={},_0x146fab={},_0x70baa3={'count':0x0,'rows':[]};var _0x22b9c7=_[_0xbf5e('0x21')](db['CloudProvider']['rawAttributes'],function(_0x29e029){return{'name':_0x29e029[_0xbf5e('0x22')],'type':_0x29e029[_0xbf5e('0x23')]['key']};});_0x146fab['model']=_[_0xbf5e('0x21')](_0x22b9c7,'name');_0x146fab[_0xbf5e('0x24')]=_[_0xbf5e('0x25')](_0x537978['query']);_0x146fab['filters']=_[_0xbf5e('0x26')](_0x146fab['model'],_0x146fab[_0xbf5e('0x24')]);_0x319138[_0xbf5e('0x27')]=_[_0xbf5e('0x26')](_0x146fab[_0xbf5e('0x28')],qs[_0xbf5e('0x29')](_0x537978[_0xbf5e('0x24')]['fields']));_0x319138[_0xbf5e('0x27')]=_0x319138[_0xbf5e('0x27')][_0xbf5e('0x2a')]?_0x319138[_0xbf5e('0x27')]:_0x146fab[_0xbf5e('0x28')];if(!_0x537978[_0xbf5e('0x24')][_0xbf5e('0x2b')](_0xbf5e('0x2c'))){_0x319138[_0xbf5e('0x14')]=qs[_0xbf5e('0x14')](_0x537978['query'][_0xbf5e('0x14')]);_0x319138[_0xbf5e('0x17')]=qs['offset'](_0x537978[_0xbf5e('0x24')]['offset']);}_0x319138[_0xbf5e('0x2d')]=qs[_0xbf5e('0x2e')](_0x537978[_0xbf5e('0x24')][_0xbf5e('0x2e')]);_0x319138[_0xbf5e('0x2f')]=qs['filters'](_['pick'](_0x537978['query'],_0x146fab[_0xbf5e('0x30')]),_0x22b9c7);if(_0x537978[_0xbf5e('0x24')][_0xbf5e('0x31')]){_0x319138['where']=_[_0xbf5e('0x32')](_0x319138[_0xbf5e('0x2f')],{'$or':_[_0xbf5e('0x21')](_0x22b9c7,function(_0x128c33){if(_0x128c33[_0xbf5e('0x23')]!==_0xbf5e('0x33')){var _0x308262={};_0x308262[_0x128c33['name']]={'$like':'%'+_0x537978[_0xbf5e('0x24')]['filter']+'%'};return _0x308262;}})});}_0x319138=_['merge']({},_0x319138,_0x537978[_0xbf5e('0x34')]);var _0x21c018={'where':_0x319138[_0xbf5e('0x2f')]};return db[_0xbf5e('0x35')][_0xbf5e('0x16')](_0x21c018)['then'](function(_0x36d049){_0x70baa3[_0xbf5e('0x16')]=_0x36d049;if(_0x537978[_0xbf5e('0x24')][_0xbf5e('0x36')]){_0x319138[_0xbf5e('0x37')]=[{'all':!![]}];}return db['CloudProvider'][_0xbf5e('0x38')](_0x319138);})[_0xbf5e('0x1a')](function(_0x4549f8){_0x70baa3[_0xbf5e('0x39')]=_0x4549f8;return _0x70baa3;})[_0xbf5e('0x1a')](respondWithFilteredResult(_0x4e3f7d,_0x319138))[_0xbf5e('0x3a')](handleError(_0x4e3f7d,null));};exports[_0xbf5e('0x3b')]=function(_0x33fa8d,_0x217459){var _0x445138={'raw':!![],'where':{'id':_0x33fa8d[_0xbf5e('0x3c')]['id']}},_0x147bad={};_0x147bad[_0xbf5e('0x28')]=_[_0xbf5e('0x25')](db[_0xbf5e('0x35')][_0xbf5e('0x3d')]);_0x147bad[_0xbf5e('0x24')]=_[_0xbf5e('0x25')](_0x33fa8d[_0xbf5e('0x24')]);_0x147bad[_0xbf5e('0x30')]=_['intersection'](_0x147bad['model'],_0x147bad[_0xbf5e('0x24')]);_0x445138[_0xbf5e('0x27')]=_[_0xbf5e('0x26')](_0x147bad[_0xbf5e('0x28')],qs[_0xbf5e('0x29')](_0x33fa8d[_0xbf5e('0x24')][_0xbf5e('0x29')]));_0x445138[_0xbf5e('0x27')]=_0x445138[_0xbf5e('0x27')][_0xbf5e('0x2a')]?_0x445138[_0xbf5e('0x27')]:_0x147bad[_0xbf5e('0x28')];if(_0x33fa8d['query'][_0xbf5e('0x36')]){_0x445138[_0xbf5e('0x37')]=[{'all':!![]}];}_0x445138=_[_0xbf5e('0x32')]({},_0x445138,_0x33fa8d[_0xbf5e('0x34')]);return db['CloudProvider']['find'](_0x445138)['then'](handleEntityNotFound(_0x217459,null))[_0xbf5e('0x1a')](respondWithResult(_0x217459,null))['catch'](handleError(_0x217459,null));};exports[_0xbf5e('0x3e')]=function(_0x1d5589,_0x26328d){return db[_0xbf5e('0x35')]['create'](_0x1d5589[_0xbf5e('0x3f')],{})[_0xbf5e('0x1a')](respondWithResult(_0x26328d,0xc9))[_0xbf5e('0x3a')](handleError(_0x26328d,null));};exports['update']=function(_0x2a159a,_0x35cdeb){if(_0x2a159a['body']['id']){delete _0x2a159a['body']['id'];}return db['CloudProvider'][_0xbf5e('0x40')]({'where':{'id':_0x2a159a['params']['id']}})[_0xbf5e('0x1a')](handleEntityNotFound(_0x35cdeb,null))[_0xbf5e('0x1a')](saveUpdates(_0x2a159a['body'],null))[_0xbf5e('0x1a')](respondWithResult(_0x35cdeb,null))['catch'](handleError(_0x35cdeb,null));};exports[_0xbf5e('0x1b')]=function(_0x2efbc4,_0x1b121b){return db[_0xbf5e('0x35')][_0xbf5e('0x40')]({'where':{'id':_0x2efbc4[_0xbf5e('0x3c')]['id']}})[_0xbf5e('0x1a')](handleEntityNotFound(_0x1b121b,null))[_0xbf5e('0x1a')](removeEntity(_0x1b121b,null))[_0xbf5e('0x3a')](handleError(_0x1b121b,null));};function getAuthorizationScopes(_0x537fa7){var _0x131c51=AZURE_AUTH_SCOPES[_0x537fa7['type']];if(_0x537fa7[_0xbf5e('0x23')]===_0xbf5e('0x41'))_0x131c51['push'](_0x537fa7['data7']+_0xbf5e('0x42'));return _0x131c51['join']('\x20');}function getAccessTokenScope(_0x2069aa){if(_0x2069aa[_0xbf5e('0x23')]===_0xbf5e('0x43'))return _0xbf5e('0xd');if(_0x2069aa['type']===_0xbf5e('0x41'))return _0x2069aa[_0xbf5e('0x44')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x539da8,_0x5219ce){var _0x4a7d88=MICROSOFT_AUTH_URL[_0xbf5e('0x45')](_0xbf5e('0x46'),_0x539da8[_0xbf5e('0x47')]);var _0x55f396=[_0xbf5e('0x48'),_0xbf5e('0x49')];var _0x32af34=Buffer[_0xbf5e('0x4a')](JSON[_0xbf5e('0x4b')]({'id':_0x5219ce}))[_0xbf5e('0x4c')](_0xbf5e('0x4d'));var _0xf92719=crypto['randomBytes'](0x10)[_0xbf5e('0x4c')](_0xbf5e('0x4e'));var _0x15cc09=getAuthorizationScopes(_0x539da8);var _0x86373b=[{'key':_0xbf5e('0x4f'),'value':_0x539da8[_0xbf5e('0x50')]},{'key':_0xbf5e('0x51'),'value':encodeURIComponent(_0x55f396[_0xbf5e('0x52')]('\x20'))},{'key':_0xbf5e('0x53'),'value':_0x539da8[_0xbf5e('0x54')]},{'key':_0xbf5e('0x55'),'value':_0xbf5e('0x56')},{'key':_0xbf5e('0x57'),'value':encodeURIComponent(_0x15cc09)},{'key':_0xbf5e('0x58'),'value':_0x32af34},{'key':_0xbf5e('0x59'),'value':_0xf92719},{'key':_0xbf5e('0x5a'),'value':_0xbf5e('0x5b')}];var _0x3cbe7f=_0x4a7d88+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xbf5e('0x21')](_0x86373b,function(_0x5e58ca){return _0x5e58ca[_0xbf5e('0x5c')]+'='+_0x5e58ca[_0xbf5e('0x5d')];})[_0xbf5e('0x52')]('&');_0x539da8[_0xbf5e('0x5e')]={'issuer':_0x4a7d88[_0xbf5e('0x45')]('oauth2/',''),'audience':_0x539da8[_0xbf5e('0x50')],'state':_0x32af34,'nonce':_0xf92719};redis[_0xbf5e('0x5f')](_0x32af34,JSON[_0xbf5e('0x4b')](_0x539da8));return _0x3cbe7f;}function isValidIdToken(_0x59f7ed,_0x130541){try{var _0xcd620c=jwt[_0xbf5e('0x60')](_0x59f7ed,{'complete':!![]});var _0x1b2572=_0xcd620c[_0xbf5e('0x61')];if(_0x1b2572[_0xbf5e('0x62')]!==_0x130541[_0xbf5e('0x63')])return![];if(_0x1b2572[_0xbf5e('0x64')]!==_0x130541['audience'])return![];if(_0x1b2572['nonce']!==_0x130541[_0xbf5e('0x59')])return![];if(moment()[_0xbf5e('0x65')](moment['unix'](_0x1b2572[_0xbf5e('0x66')])))return![];return!![];}catch(_0x575f0){throw _0x575f0;}}function refreshOauth2MicrosoftAccessToken(_0x42d237){var _0x3983a3={'grant_type':_0xbf5e('0x67'),'refresh_token':_0x42d237[_0xbf5e('0x68')],'scope':getAccessTokenScope(_0x42d237),'redirect_uri':_0x42d237[_0xbf5e('0x54')],'client_id':_0x42d237[_0xbf5e('0x50')],'client_secret':_0x42d237[_0xbf5e('0x69')]};var _0x3290ce={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xbf5e('0x45')]('{TENANT_ID}',_0x42d237['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3983a3,'json':!![]};return rp(_0x3290ce)[_0xbf5e('0x1a')](function(_0x3865bc){return db[_0xbf5e('0x35')][_0xbf5e('0x19')]({'data5':_0x3865bc['access_token'],'data6':_0x3865bc[_0xbf5e('0x67')]},{'where':{'id':_0x42d237['id']}});})[_0xbf5e('0x3a')](function(_0x1219eb){logger[_0xbf5e('0x1c')](_0xbf5e('0x6a'),_0x42d237['id'],_0x1219eb);});}function getOauth2MicrosoftAccessToken(_0x30d3f9,_0x1cd7e8){var _0x2cf35a={'grant_type':'authorization_code','code':_0x30d3f9,'scope':getAccessTokenScope(_0x1cd7e8),'redirect_uri':_0x1cd7e8[_0xbf5e('0x54')],'client_id':_0x1cd7e8[_0xbf5e('0x50')],'client_secret':_0x1cd7e8[_0xbf5e('0x69')]};var _0x195c44={'method':_0xbf5e('0x6b'),'uri':MICROSOFT_AUTH_URL[_0xbf5e('0x45')](_0xbf5e('0x46'),_0x1cd7e8[_0xbf5e('0x47')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2cf35a,'json':!![]};return rp(_0x195c44);}exports[_0xbf5e('0x6c')]=function(_0x295b22,_0x69364a){return db['CloudProvider'][_0xbf5e('0x6d')]({'where':{'id':_0x295b22['params']['id']},'raw':!![]})[_0xbf5e('0x1a')](function(_0xcccfc8){if(!_0xcccfc8)return _0x69364a[_0xbf5e('0x11')](0x194);return{'url':generateMicrosoftAuthorizationUrl(_0xcccfc8,_0x295b22[_0xbf5e('0x6e')]['id'])};})[_0xbf5e('0x1a')](respondWithResult(_0x69364a,null))['catch'](handleError(_0x69364a,null));};exports[_0xbf5e('0x6f')]=function(_0x10dc1f,_0x2c9d9e){var _0x57fd0f=_0x10dc1f[_0xbf5e('0x3f')];var _0x3d0cbc;var _0x2c0cb9;if(_0x57fd0f['error'])throw _0x57fd0f;redis[_0xbf5e('0x70')](_0x57fd0f[_0xbf5e('0x58')])[_0xbf5e('0x1a')](function(_0x4dfb1a){if(!_0x4dfb1a)throw new Error(_0xbf5e('0x71'));_0x3d0cbc=JSON['parse'](_0x4dfb1a);var _0x58b35d=Buffer[_0xbf5e('0x4a')](_0x57fd0f[_0xbf5e('0x58')],_0xbf5e('0x4d'))[_0xbf5e('0x4c')]('ascii');_0x2c0cb9=JSON[_0xbf5e('0x72')](_0x58b35d);if(!isValidIdToken(_0x57fd0f[_0xbf5e('0x49')],_0x3d0cbc[_0xbf5e('0x5e')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0xbf5e('0x73')](_0x57fd0f[_0xbf5e('0x58')]);return getOauth2MicrosoftAccessToken(_0x57fd0f['code'],_0x3d0cbc);})[_0xbf5e('0x1a')](function(_0x1ee45f){_0x3d0cbc['data5']=_0x1ee45f[_0xbf5e('0x74')];_0x3d0cbc[_0xbf5e('0x68')]=_0x1ee45f[_0xbf5e('0x67')];return db[_0xbf5e('0x35')][_0xbf5e('0x19')]({'data5':_0x3d0cbc[_0xbf5e('0x75')],'data6':_0x3d0cbc[_0xbf5e('0x68')]},{'where':{'id':_0x3d0cbc['id']}});})[_0xbf5e('0x1a')](function(){setInterval(refreshOauth2MicrosoftAccessToken[_0xbf5e('0x76')](this,_0x3d0cbc),0xfa*0x3e8);socket[_0xbf5e('0x77')](_0xbf5e('0x78'),{'id':_0x2c0cb9['id']});return;})[_0xbf5e('0x1a')](respondWithStatusCode(_0x2c9d9e,null))[_0xbf5e('0x3a')](function(_0x2bfb97){if(_0x2c0cb9){socket[_0xbf5e('0x77')](_0xbf5e('0x79'),{'id':_0x2c0cb9['id']});}if(!_0x3d0cbc){logger[_0xbf5e('0x1c')](_0xbf5e('0x7a'),_0x2bfb97);return _0x2c9d9e[_0xbf5e('0x12')](0x1f4)[_0xbf5e('0x1f')](_0x2bfb97[_0xbf5e('0x7b')]);}logger[_0xbf5e('0x1c')](_0xbf5e('0x7c'),_0x3d0cbc['id'],_0x2bfb97);});}; \ No newline at end of file +var _0xb2a6=['filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','fields','find','body','Dynamics365','/.default','Outlook365','data7','{TENANT_ID}','data2','from','stringify','toString','randomBytes','hex','client_id','response_type','redirect_uri','data4','form_post','scope','state','nonce','prompt','value','join','oauth2Claims','oauth2/','decode','payload','iss','issuer','aud','audience','isAfter','unix','refresh_token','data6','data1','data3','POST','access_token','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s','authorization_code','replace','findOne','user','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','parse','base64','ascii','id_token','del','code','data5','bind','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s','request-promise','lodash','crypto','jsonwebtoken','../../components/parsers/qs','../../config/environment','../../config/logger','api','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','update','then','stack','name','send','index','CloudProvider','rawAttributes','type','key','map','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick'];(function(_0x4b2ef8,_0x3d5e2d){var _0x50bc01=function(_0xf96df){while(--_0xf96df){_0x4b2ef8['push'](_0x4b2ef8['shift']());}};_0x50bc01(++_0x3d5e2d);}(_0xb2a6,0x1c2));var _0x6b2a=function(_0x2ccb9c,_0x2aa610){_0x2ccb9c=_0x2ccb9c-0x0;var _0x4aed28=_0xb2a6[_0x2ccb9c];return _0x4aed28;};'use strict';var rp=require(_0x6b2a('0x0'));var _=require(_0x6b2a('0x1'));var moment=require('moment');var crypto=require(_0x6b2a('0x2'));var jwt=require(_0x6b2a('0x3'));var Redis=require('ioredis');var qs=require(_0x6b2a('0x4'));var config=require(_0x6b2a('0x5'));var logger=require(_0x6b2a('0x6'))(_0x6b2a('0x7'));var db=require(_0x6b2a('0x8'))['db'];config[_0x6b2a('0x9')]=_[_0x6b2a('0xa')](config[_0x6b2a('0x9')],{'host':_0x6b2a('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var redis=new Redis(config[_0x6b2a('0x9')]);var MICROSOFT_AUTH_URL=_0x6b2a('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0x6b2a('0xd'),_0x6b2a('0xe'),'email',_0x6b2a('0xf'),_0x6b2a('0x10'),_0x6b2a('0x11'),_0x6b2a('0x12')],'Dynamics365':[_0x6b2a('0xd'),_0x6b2a('0xf')]};var MICROSOFT_AUTH_ENDPOINT=_0x6b2a('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0x6b2a('0x14');function respondWithStatusCode(_0x3f7305,_0x25e6db){_0x25e6db=_0x25e6db||0xcc;return function(_0x3da791){if(_0x3da791){return _0x3f7305[_0x6b2a('0x15')](_0x25e6db);}return _0x3f7305['status'](_0x25e6db)[_0x6b2a('0x16')]();};}function respondWithResult(_0x9e9862,_0x237fff){_0x237fff=_0x237fff||0xc8;return function(_0x3d5443){if(_0x3d5443){return _0x9e9862[_0x6b2a('0x17')](_0x237fff)[_0x6b2a('0x18')](_0x3d5443);}};}function respondWithFilteredResult(_0x53cf5a,_0x84b9a8){return function(_0x1f82b6){if(_0x1f82b6){var _0x289cf9=typeof _0x84b9a8['offset']===_0x6b2a('0x19')&&typeof _0x84b9a8[_0x6b2a('0x1a')]===_0x6b2a('0x19');var _0x1db6f9=_0x1f82b6[_0x6b2a('0x1b')];var _0x395bad=_0x289cf9?0x0:_0x84b9a8[_0x6b2a('0x1c')];var _0x591645=_0x289cf9?_0x1f82b6[_0x6b2a('0x1b')]:_0x84b9a8[_0x6b2a('0x1c')]+_0x84b9a8['limit'];var _0x547ae0;if(_0x591645>=_0x1db6f9){_0x591645=_0x1db6f9;_0x547ae0=0xc8;}else{_0x547ae0=0xce;}_0x53cf5a[_0x6b2a('0x17')](_0x547ae0);return _0x53cf5a[_0x6b2a('0x1d')](_0x6b2a('0x1e'),_0x395bad+'-'+_0x591645+'/'+_0x1db6f9)[_0x6b2a('0x18')](_0x1f82b6);}return null;};}function saveUpdates(_0x111109){return function(_0x15dd51){if(_0x15dd51){return _0x15dd51[_0x6b2a('0x1f')](_0x111109)[_0x6b2a('0x20')](function(_0x81f515){return _0x81f515;});}return null;};}function removeEntity(_0x435f0d){return function(_0x3d7eaf){if(_0x3d7eaf){return _0x3d7eaf['destroy']()[_0x6b2a('0x20')](function(){_0x435f0d[_0x6b2a('0x17')](0xcc)[_0x6b2a('0x16')]();});}};}function handleEntityNotFound(_0x905f25){return function(_0x3ac17){if(!_0x3ac17){_0x905f25[_0x6b2a('0x15')](0x194);}return _0x3ac17;};}function handleError(_0x4346de,_0x34639e){_0x34639e=_0x34639e||0x1f4;return function(_0x1df9be){logger['error'](_0x1df9be[_0x6b2a('0x21')]);if(_0x1df9be['name']){delete _0x1df9be[_0x6b2a('0x22')];}_0x4346de[_0x6b2a('0x17')](_0x34639e)[_0x6b2a('0x23')](_0x1df9be);};}exports[_0x6b2a('0x24')]=function(_0x2bdf85,_0x4a31d1){var _0x2f24c5={},_0x924709={},_0x59a9b4={'count':0x0,'rows':[]};var _0x583250=_['map'](db[_0x6b2a('0x25')][_0x6b2a('0x26')],function(_0x530713){return{'name':_0x530713['fieldName'],'type':_0x530713[_0x6b2a('0x27')][_0x6b2a('0x28')]};});_0x924709['model']=_[_0x6b2a('0x29')](_0x583250,_0x6b2a('0x22'));_0x924709[_0x6b2a('0x2a')]=_[_0x6b2a('0x2b')](_0x2bdf85['query']);_0x924709['filters']=_[_0x6b2a('0x2c')](_0x924709[_0x6b2a('0x2d')],_0x924709['query']);_0x2f24c5[_0x6b2a('0x2e')]=_[_0x6b2a('0x2c')](_0x924709['model'],qs['fields'](_0x2bdf85['query']['fields']));_0x2f24c5[_0x6b2a('0x2e')]=_0x2f24c5[_0x6b2a('0x2e')][_0x6b2a('0x2f')]?_0x2f24c5[_0x6b2a('0x2e')]:_0x924709[_0x6b2a('0x2d')];if(!_0x2bdf85[_0x6b2a('0x2a')][_0x6b2a('0x30')](_0x6b2a('0x31'))){_0x2f24c5['limit']=qs[_0x6b2a('0x1a')](_0x2bdf85[_0x6b2a('0x2a')]['limit']);_0x2f24c5[_0x6b2a('0x1c')]=qs[_0x6b2a('0x1c')](_0x2bdf85[_0x6b2a('0x2a')][_0x6b2a('0x1c')]);}_0x2f24c5['order']=qs[_0x6b2a('0x32')](_0x2bdf85['query'][_0x6b2a('0x32')]);_0x2f24c5[_0x6b2a('0x33')]=qs[_0x6b2a('0x34')](_[_0x6b2a('0x35')](_0x2bdf85[_0x6b2a('0x2a')],_0x924709[_0x6b2a('0x34')]),_0x583250);if(_0x2bdf85[_0x6b2a('0x2a')][_0x6b2a('0x36')]){_0x2f24c5[_0x6b2a('0x33')]=_[_0x6b2a('0x37')](_0x2f24c5[_0x6b2a('0x33')],{'$or':_[_0x6b2a('0x29')](_0x583250,function(_0x175714){if(_0x175714['type']!==_0x6b2a('0x38')){var _0x508373={};_0x508373[_0x175714[_0x6b2a('0x22')]]={'$like':'%'+_0x2bdf85['query'][_0x6b2a('0x36')]+'%'};return _0x508373;}})});}_0x2f24c5=_[_0x6b2a('0x37')]({},_0x2f24c5,_0x2bdf85[_0x6b2a('0x39')]);var _0xfee3eb={'where':_0x2f24c5[_0x6b2a('0x33')]};return db[_0x6b2a('0x25')][_0x6b2a('0x1b')](_0xfee3eb)[_0x6b2a('0x20')](function(_0x3de5d8){_0x59a9b4['count']=_0x3de5d8;if(_0x2bdf85['query'][_0x6b2a('0x3a')]){_0x2f24c5['include']=[{'all':!![]}];}return db[_0x6b2a('0x25')][_0x6b2a('0x3b')](_0x2f24c5);})['then'](function(_0x3b0aec){_0x59a9b4['rows']=_0x3b0aec;return _0x59a9b4;})[_0x6b2a('0x20')](respondWithFilteredResult(_0x4a31d1,_0x2f24c5))[_0x6b2a('0x3c')](handleError(_0x4a31d1,null));};exports[_0x6b2a('0x3d')]=function(_0x32e8e1,_0x1071f2){var _0x4bbbb4={'raw':!![],'where':{'id':_0x32e8e1[_0x6b2a('0x3e')]['id']}},_0x4c7266={};_0x4c7266['model']=_[_0x6b2a('0x2b')](db['CloudProvider'][_0x6b2a('0x26')]);_0x4c7266[_0x6b2a('0x2a')]=_[_0x6b2a('0x2b')](_0x32e8e1['query']);_0x4c7266[_0x6b2a('0x34')]=_['intersection'](_0x4c7266['model'],_0x4c7266[_0x6b2a('0x2a')]);_0x4bbbb4['attributes']=_['intersection'](_0x4c7266[_0x6b2a('0x2d')],qs[_0x6b2a('0x3f')](_0x32e8e1[_0x6b2a('0x2a')][_0x6b2a('0x3f')]));_0x4bbbb4[_0x6b2a('0x2e')]=_0x4bbbb4[_0x6b2a('0x2e')][_0x6b2a('0x2f')]?_0x4bbbb4['attributes']:_0x4c7266['model'];if(_0x32e8e1[_0x6b2a('0x2a')][_0x6b2a('0x3a')]){_0x4bbbb4['include']=[{'all':!![]}];}_0x4bbbb4=_[_0x6b2a('0x37')]({},_0x4bbbb4,_0x32e8e1[_0x6b2a('0x39')]);return db[_0x6b2a('0x25')][_0x6b2a('0x40')](_0x4bbbb4)[_0x6b2a('0x20')](handleEntityNotFound(_0x1071f2,null))[_0x6b2a('0x20')](respondWithResult(_0x1071f2,null))[_0x6b2a('0x3c')](handleError(_0x1071f2,null));};exports['create']=function(_0x4c654e,_0x1ecb6b){return db['CloudProvider']['create'](_0x4c654e['body'],{})['then'](respondWithResult(_0x1ecb6b,0xc9))['catch'](handleError(_0x1ecb6b,null));};exports[_0x6b2a('0x1f')]=function(_0x503df7,_0xdd3c0d){if(_0x503df7['body']['id']){delete _0x503df7[_0x6b2a('0x41')]['id'];}return db[_0x6b2a('0x25')][_0x6b2a('0x40')]({'where':{'id':_0x503df7['params']['id']}})[_0x6b2a('0x20')](handleEntityNotFound(_0xdd3c0d,null))[_0x6b2a('0x20')](saveUpdates(_0x503df7[_0x6b2a('0x41')],null))[_0x6b2a('0x20')](respondWithResult(_0xdd3c0d,null))[_0x6b2a('0x3c')](handleError(_0xdd3c0d,null));};exports['destroy']=function(_0x1938b7,_0xbc0f5){return db['CloudProvider'][_0x6b2a('0x40')]({'where':{'id':_0x1938b7[_0x6b2a('0x3e')]['id']}})[_0x6b2a('0x20')](handleEntityNotFound(_0xbc0f5,null))['then'](removeEntity(_0xbc0f5,null))[_0x6b2a('0x3c')](handleError(_0xbc0f5,null));};function getAuthorizationScopes(_0x4d4c25){var _0x31c245=AZURE_AUTH_SCOPES[_0x4d4c25[_0x6b2a('0x27')]];if(_0x4d4c25[_0x6b2a('0x27')]===_0x6b2a('0x42'))_0x31c245['push'](_0x4d4c25['data7']+_0x6b2a('0x43'));return _0x31c245['join']('\x20');}function getAccessTokenScope(_0x573042){if(_0x573042[_0x6b2a('0x27')]===_0x6b2a('0x44'))return _0x6b2a('0x10');if(_0x573042[_0x6b2a('0x27')]==='Dynamics365')return _0x573042[_0x6b2a('0x45')]+_0x6b2a('0x43');}function generateMicrosoftAuthorizationUrl(_0x342241,_0x18bbe1){var _0x5645c9=MICROSOFT_AUTH_URL['replace'](_0x6b2a('0x46'),_0x342241[_0x6b2a('0x47')]);var _0x2ff6c5=['code','id_token'];var _0x5c3409=Buffer[_0x6b2a('0x48')](JSON[_0x6b2a('0x49')]({'id':_0x18bbe1}))[_0x6b2a('0x4a')]('base64');var _0x2f9039=crypto[_0x6b2a('0x4b')](0x10)['toString'](_0x6b2a('0x4c'));var _0x475389=getAuthorizationScopes(_0x342241);var _0x4f2505=[{'key':_0x6b2a('0x4d'),'value':_0x342241['data1']},{'key':_0x6b2a('0x4e'),'value':encodeURIComponent(_0x2ff6c5['join']('\x20'))},{'key':_0x6b2a('0x4f'),'value':_0x342241[_0x6b2a('0x50')]},{'key':'response_mode','value':_0x6b2a('0x51')},{'key':_0x6b2a('0x52'),'value':encodeURIComponent(_0x475389)},{'key':_0x6b2a('0x53'),'value':_0x5c3409},{'key':_0x6b2a('0x54'),'value':_0x2f9039},{'key':_0x6b2a('0x55'),'value':'login'}];var _0x5b2631=_0x5645c9+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x6b2a('0x29')](_0x4f2505,function(_0x414258){return _0x414258['key']+'='+_0x414258[_0x6b2a('0x56')];})[_0x6b2a('0x57')]('&');_0x342241[_0x6b2a('0x58')]={'issuer':_0x5645c9['replace'](_0x6b2a('0x59'),''),'audience':_0x342241['data1'],'state':_0x5c3409,'nonce':_0x2f9039};redis['set'](_0x5c3409,JSON[_0x6b2a('0x49')](_0x342241));return _0x5b2631;}function isValidIdToken(_0x47a4db,_0x5a0d28){try{var _0x4d0da5=jwt[_0x6b2a('0x5a')](_0x47a4db,{'complete':!![]});var _0x39674c=_0x4d0da5[_0x6b2a('0x5b')];if(_0x39674c[_0x6b2a('0x5c')]!==_0x5a0d28[_0x6b2a('0x5d')])return![];if(_0x39674c[_0x6b2a('0x5e')]!==_0x5a0d28[_0x6b2a('0x5f')])return![];if(_0x39674c[_0x6b2a('0x54')]!==_0x5a0d28[_0x6b2a('0x54')])return![];if(moment()[_0x6b2a('0x60')](moment[_0x6b2a('0x61')](_0x39674c['exp'])))return![];return!![];}catch(_0x40bf3a){throw _0x40bf3a;}}function refreshOauth2MicrosoftAccessToken(_0x1c23d4){var _0x3c33b7={'grant_type':_0x6b2a('0x62'),'refresh_token':_0x1c23d4[_0x6b2a('0x63')],'scope':getAccessTokenScope(_0x1c23d4),'redirect_uri':_0x1c23d4[_0x6b2a('0x50')],'client_id':_0x1c23d4[_0x6b2a('0x64')],'client_secret':_0x1c23d4[_0x6b2a('0x65')]};var _0x790b77={'method':_0x6b2a('0x66'),'uri':MICROSOFT_AUTH_URL['replace'](_0x6b2a('0x46'),_0x1c23d4[_0x6b2a('0x47')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3c33b7,'json':!![]};return rp(_0x790b77)[_0x6b2a('0x20')](function(_0x27c766){return db[_0x6b2a('0x25')][_0x6b2a('0x1f')]({'data5':_0x27c766[_0x6b2a('0x67')],'data6':_0x27c766[_0x6b2a('0x62')]},{'where':{'id':_0x1c23d4['id']}});})[_0x6b2a('0x3c')](function(_0x4138a1){logger[_0x6b2a('0x68')](_0x6b2a('0x69'),_0x1c23d4['id'],_0x4138a1);});}function getOauth2MicrosoftAccessToken(_0x100383,_0x4ee286){var _0x1c8bd0={'grant_type':_0x6b2a('0x6a'),'code':_0x100383,'scope':getAccessTokenScope(_0x4ee286),'redirect_uri':_0x4ee286['data4'],'client_id':_0x4ee286['data1'],'client_secret':_0x4ee286[_0x6b2a('0x65')]};var _0x1bee5c={'method':_0x6b2a('0x66'),'uri':MICROSOFT_AUTH_URL[_0x6b2a('0x6b')](_0x6b2a('0x46'),_0x4ee286[_0x6b2a('0x47')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1c8bd0,'json':!![]};return rp(_0x1bee5c);}exports['oauth2MicrosoftAuthorize']=function(_0x199552,_0xc7e1bf){return db['CloudProvider'][_0x6b2a('0x6c')]({'where':{'id':_0x199552['params']['id']},'raw':!![]})['then'](function(_0x55a05f){if(!_0x55a05f)return _0xc7e1bf['sendStatus'](0x194);return{'url':generateMicrosoftAuthorizationUrl(_0x55a05f,_0x199552[_0x6b2a('0x6d')]['id'])};})[_0x6b2a('0x20')](respondWithResult(_0xc7e1bf,null))[_0x6b2a('0x3c')](handleError(_0xc7e1bf,null));};exports[_0x6b2a('0x6e')]=function(_0x19bf41,_0x25c041){var _0x150b1e=_0x19bf41[_0x6b2a('0x41')];var _0x1a73af;var _0x1b2173;if(_0x150b1e[_0x6b2a('0x68')])throw _0x150b1e;redis[_0x6b2a('0x6f')](_0x150b1e['state'])[_0x6b2a('0x20')](function(_0x31df8c){if(!_0x31df8c)throw new Error(_0x6b2a('0x70'));_0x1a73af=JSON[_0x6b2a('0x71')](_0x31df8c);var _0x3a6a07=Buffer[_0x6b2a('0x48')](_0x150b1e[_0x6b2a('0x53')],_0x6b2a('0x72'))[_0x6b2a('0x4a')](_0x6b2a('0x73'));_0x1b2173=JSON['parse'](_0x3a6a07);if(!isValidIdToken(_0x150b1e[_0x6b2a('0x74')],_0x1a73af[_0x6b2a('0x58')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x6b2a('0x75')](_0x150b1e[_0x6b2a('0x53')]);return getOauth2MicrosoftAccessToken(_0x150b1e[_0x6b2a('0x76')],_0x1a73af);})[_0x6b2a('0x20')](function(_0x5af304){_0x1a73af[_0x6b2a('0x77')]=_0x5af304['access_token'];_0x1a73af[_0x6b2a('0x63')]=_0x5af304[_0x6b2a('0x62')];return db[_0x6b2a('0x25')][_0x6b2a('0x1f')]({'data5':_0x1a73af[_0x6b2a('0x77')],'data6':_0x1a73af[_0x6b2a('0x63')]},{'where':{'id':_0x1a73af['id']}});})['then'](function(){setInterval(refreshOauth2MicrosoftAccessToken[_0x6b2a('0x78')](this,_0x1a73af),0xfa*0x3e8);socket[_0x6b2a('0x79')](_0x6b2a('0x7a'),{'id':_0x1b2173['id']});return;})[_0x6b2a('0x20')](respondWithStatusCode(_0x25c041,null))['catch'](function(_0x2a03ff){if(_0x1b2173){socket[_0x6b2a('0x79')](_0x6b2a('0x7b'),{'id':_0x1b2173['id']});}if(!_0x1a73af){logger[_0x6b2a('0x68')](_0x6b2a('0x7c'),_0x2a03ff);return _0x25c041[_0x6b2a('0x17')](0x1f4)[_0x6b2a('0x23')](_0x2a03ff['message']);}logger[_0x6b2a('0x68')](_0x6b2a('0x7d'),_0x1a73af['id'],_0x2a03ff);});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 2470cb4..9d0ddc6 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 _0x511c=['../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x4c0ce3,_0x5a8c94){var _0x50beec=function(_0x196034){while(--_0x196034){_0x4c0ce3['push'](_0x4c0ce3['shift']());}};_0x50beec(++_0x5a8c94);}(_0x511c,0x1c1));var _0xc511=function(_0x54bfa9,_0x424d55){_0x54bfa9=_0x54bfa9-0x0;var _0x160e13=_0x511c[_0x54bfa9];return _0x160e13;};'use strict';var _=require(_0xc511('0x0'));var util=require(_0xc511('0x1'));var logger=require('../../config/logger')(_0xc511('0x2'));var moment=require('moment');var BPromise=require(_0xc511('0x3'));var rp=require(_0xc511('0x4'));var fs=require('fs');var path=require(_0xc511('0x5'));var rimraf=require(_0xc511('0x6'));var config=require(_0xc511('0x7'));var attributes=require(_0xc511('0x8'));module[_0xc511('0x9')]=function(_0x27b46a,_0x12b8c5){return _0x27b46a[_0xc511('0xa')](_0xc511('0xb'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69ca=['rimraf','../../config/environment','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x2ec5b9,_0x56e0a3){var _0x10dcea=function(_0x1d403d){while(--_0x1d403d){_0x2ec5b9['push'](_0x2ec5b9['shift']());}};_0x10dcea(++_0x56e0a3);}(_0x69ca,0x8a));var _0xa69c=function(_0x19faae,_0x5697bc){_0x19faae=_0x19faae-0x0;var _0x363543=_0x69ca[_0x19faae];return _0x363543;};'use strict';var _=require(_0xa69c('0x0'));var util=require(_0xa69c('0x1'));var logger=require(_0xa69c('0x2'))(_0xa69c('0x3'));var moment=require('moment');var BPromise=require(_0xa69c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa69c('0x5'));var rimraf=require(_0xa69c('0x6'));var config=require(_0xa69c('0x7'));var attributes=require('./cloudProvider.attributes');module[_0xa69c('0x8')]=function(_0xd80722,_0x3f96a9){return _0xd80722[_0xa69c('0x9')](_0xa69c('0xa'),attributes,{'tableName':_0xa69c('0xb'),'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 dc3c92c..a873df4 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 _0x2d0b=['code','message','CloudProvider,\x20%s,\x20%s','request\x20sent','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','CloudProvider,\x20%s,\x20%s,\x20%s','error'];(function(_0x15a5f5,_0xdcc8d6){var _0x36a5d6=function(_0x28ba61){while(--_0x28ba61){_0x15a5f5['push'](_0x15a5f5['shift']());}};_0x36a5d6(++_0xdcc8d6);}(_0x2d0b,0x102));var _0xb2d0=function(_0x3e6278,_0x35054b){_0x3e6278=_0x3e6278-0x0;var _0x3a0fb4=_0x2d0b[_0x3e6278];return _0x3a0fb4;};'use strict';var _=require('lodash');var util=require(_0xb2d0('0x0'));var moment=require(_0xb2d0('0x1'));var BPromise=require(_0xb2d0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb2d0('0x3'));var db=require(_0xb2d0('0x4'))['db'];var utils=require(_0xb2d0('0x5'));var logger=require(_0xb2d0('0x6'))('rpc');var config=require(_0xb2d0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb2d0('0x8')][_0xb2d0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d3bff,_0x28fee3,_0xb1c30c){return new BPromise(function(_0x17f561,_0x31340b){return client[_0xb2d0('0xa')](_0x1d3bff,_0xb1c30c)[_0xb2d0('0xb')](function(_0x1a6fac){logger[_0xb2d0('0xc')]('CloudProvider,\x20%s,\x20%s',_0x28fee3,'request\x20sent');logger['debug'](_0xb2d0('0xd'),_0x28fee3,'request\x20sent',JSON['stringify'](_0x1a6fac));if(_0x1a6fac['error']){if(_0x1a6fac[_0xb2d0('0xe')][_0xb2d0('0xf')]===0x1f4){logger[_0xb2d0('0xe')]('CloudProvider,\x20%s,\x20%s',_0x28fee3,_0x1a6fac[_0xb2d0('0xe')]['message']);return _0x31340b(_0x1a6fac[_0xb2d0('0xe')][_0xb2d0('0x10')]);}logger[_0xb2d0('0xe')](_0xb2d0('0x11'),_0x28fee3,_0x1a6fac[_0xb2d0('0xe')][_0xb2d0('0x10')]);return _0x17f561(_0x1a6fac[_0xb2d0('0xe')][_0xb2d0('0x10')]);}else{logger[_0xb2d0('0xc')](_0xb2d0('0x11'),_0x28fee3,_0xb2d0('0x12'));_0x17f561(_0x1a6fac[_0xb2d0('0x13')][_0xb2d0('0x10')]);}})[_0xb2d0('0x14')](function(_0x223ae8){logger['error'](_0xb2d0('0x11'),_0x28fee3,_0x223ae8);_0x31340b(_0x223ae8);});});} \ No newline at end of file +var _0xbcff=['../../config/logger','rpc','../../config/environment','client','http','then','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','CloudProvider,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x12f451,_0x3b618f){var _0x5e9589=function(_0x3153d2){while(--_0x3153d2){_0x12f451['push'](_0x12f451['shift']());}};_0x5e9589(++_0x3b618f);}(_0xbcff,0x12e));var _0xfbcf=function(_0x2d290c,_0x397276){_0x2d290c=_0x2d290c-0x0;var _0x57b261=_0xbcff[_0x2d290c];return _0x57b261;};'use strict';var _=require(_0xfbcf('0x0'));var util=require(_0xfbcf('0x1'));var moment=require(_0xfbcf('0x2'));var BPromise=require('bluebird');var rs=require(_0xfbcf('0x3'));var fs=require('fs');var Redis=require(_0xfbcf('0x4'));var db=require(_0xfbcf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfbcf('0x6'))(_0xfbcf('0x7'));var config=require(_0xfbcf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfbcf('0x9')][_0xfbcf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b87de,_0x51ee67,_0x470fa8){return new BPromise(function(_0x520d5f,_0x1481ba){return client['request'](_0x4b87de,_0x470fa8)[_0xfbcf('0xb')](function(_0xc63f23){logger['info']('CloudProvider,\x20%s,\x20%s',_0x51ee67,_0xfbcf('0xc'));logger[_0xfbcf('0xd')](_0xfbcf('0xe'),_0x51ee67,_0xfbcf('0xc'),JSON['stringify'](_0xc63f23));if(_0xc63f23[_0xfbcf('0xf')]){if(_0xc63f23[_0xfbcf('0xf')][_0xfbcf('0x10')]===0x1f4){logger[_0xfbcf('0xf')](_0xfbcf('0x11'),_0x51ee67,_0xc63f23[_0xfbcf('0xf')][_0xfbcf('0x12')]);return _0x1481ba(_0xc63f23['error'][_0xfbcf('0x12')]);}logger['error'](_0xfbcf('0x11'),_0x51ee67,_0xc63f23[_0xfbcf('0xf')][_0xfbcf('0x12')]);return _0x520d5f(_0xc63f23[_0xfbcf('0xf')][_0xfbcf('0x12')]);}else{logger[_0xfbcf('0x13')](_0xfbcf('0x11'),_0x51ee67,_0xfbcf('0xc'));_0x520d5f(_0xc63f23[_0xfbcf('0x14')]['message']);}})[_0xfbcf('0x15')](function(_0xdb7a6a){logger[_0xfbcf('0xf')](_0xfbcf('0x11'),_0x51ee67,_0xdb7a6a);_0x1481ba(_0xdb7a6a);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index bf6020e..37d22c8 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x29f80e,_0x9027ff){var _0x5c7eaa=function(_0x48ec7c){while(--_0x48ec7c){_0x29f80e['push'](_0x29f80e['shift']());}};_0x5c7eaa(++_0x9027ff);}(_0x1261,0x144));var _0x1126=function(_0x4e9a22,_0x65e645){_0x4e9a22=_0x4e9a22-0x0;var _0x364420=_0x1261[_0x4e9a22];return _0x364420;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file +var _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x7a54,0x106));var _0x47a5=function(_0x5030b1,_0x52623d){_0x5030b1=_0x5030b1-0x0;var _0x1a5154=_0x7a54[_0x5030b1];return _0x1a5154;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index a9c2030..4db5be8 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 _0x6360=['name','sequelize','STRING'];(function(_0x193480,_0x49badb){var _0x34fa87=function(_0x17f390){while(--_0x17f390){_0x193480['push'](_0x193480['shift']());}};_0x34fa87(++_0x49badb);}(_0x6360,0x187));var _0x0636=function(_0x247377,_0x291a19){_0x247377=_0x247377-0x0;var _0x2f0bb8=_0x6360[_0x247377];return _0x2f0bb8;};'use strict';var Sequelize=require(_0x0636('0x0'));module['exports']={'name':{'type':Sequelize[_0x0636('0x1')],'unique':_0x0636('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x0636('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x0636('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x0636('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x0636('0x1')]},'postalCode':{'type':Sequelize[_0x0636('0x1')]},'city':{'type':Sequelize[_0x0636('0x1')]},'country':{'type':Sequelize[_0x0636('0x1')]},'email':{'type':Sequelize[_0x0636('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x0636('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x0636('0x1')]},'description':{'type':Sequelize[_0x0636('0x1')]}}; \ No newline at end of file +var _0xba5b=['STRING','sequelize','exports','name'];(function(_0x199d85,_0x58c6a3){var _0x3c9931=function(_0x204844){while(--_0x204844){_0x199d85['push'](_0x199d85['shift']());}};_0x3c9931(++_0x58c6a3);}(_0xba5b,0xa1));var _0xbba5=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xba5b[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0xbba5('0x0'));module[_0xbba5('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xbba5('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xbba5('0x3')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xbba5('0x3')]},'fax':{'type':Sequelize[_0xbba5('0x3')]},'type':{'type':Sequelize[_0xbba5('0x3')]},'street':{'type':Sequelize[_0xbba5('0x3')]},'postalCode':{'type':Sequelize[_0xbba5('0x3')]},'city':{'type':Sequelize[_0xbba5('0x3')]},'country':{'type':Sequelize[_0xbba5('0x3')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xbba5('0x3')]},'sStreet':{'type':Sequelize[_0xbba5('0x3')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbba5('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 88798a3..106291d 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 _0xe9d2=['order','getContacts','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','limit','set','Content-Range','reject','save','then','destroy','UserProfileResource','error','stack','name','send','index','CmCompany','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filters','pick','filter','merge','map','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addContacts','CmContact','ids','omit','findOne'];(function(_0x13cb6f,_0x318363){var _0x4f1094=function(_0x1e41b3){while(--_0x1e41b3){_0x13cb6f['push'](_0x13cb6f['shift']());}};_0x4f1094(++_0x318363);}(_0xe9d2,0x1ba));var _0x2e9d=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xe9d2[_0x403c20];return _0x2b271a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2e9d('0x0'));var zipdir=require(_0x2e9d('0x1'));var jsonpatch=require(_0x2e9d('0x2'));var rp=require(_0x2e9d('0x3'));var moment=require(_0x2e9d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2e9d('0x5'));var util=require(_0x2e9d('0x6'));var path=require('path');var sox=require(_0x2e9d('0x7'));var csv=require('to-csv');var ejs=require(_0x2e9d('0x8'));var fs=require('fs');var fs_extra=require(_0x2e9d('0x9'));var _=require(_0x2e9d('0xa'));var squel=require(_0x2e9d('0xb'));var crypto=require('crypto');var jsforce=require(_0x2e9d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2e9d('0xd'));var querystring=require('querystring');var Papa=require(_0x2e9d('0xe'));var Redis=require('ioredis');var authService=require(_0x2e9d('0xf'));var qs=require(_0x2e9d('0x10'));var as=require(_0x2e9d('0x11'));var hardwareService=require(_0x2e9d('0x12'));var logger=require(_0x2e9d('0x13'))('api');var utils=require(_0x2e9d('0x14'));var config=require(_0x2e9d('0x15'));var licenseUtil=require(_0x2e9d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20d417,_0xeeaa4b){_0xeeaa4b=_0xeeaa4b||0xcc;return function(_0x464126){if(_0x464126){return _0x20d417[_0x2e9d('0x17')](_0xeeaa4b);}return _0x20d417[_0x2e9d('0x18')](_0xeeaa4b)[_0x2e9d('0x19')]();};}function respondWithResult(_0x47580e,_0x4c6f55){_0x4c6f55=_0x4c6f55||0xc8;return function(_0x20bdb5){if(_0x20bdb5){return _0x47580e[_0x2e9d('0x18')](_0x4c6f55)[_0x2e9d('0x1a')](_0x20bdb5);}};}function respondWithFilteredResult(_0xdcd420,_0x1391bf){return function(_0x401a71){if(_0x401a71){var _0x90ff9a=typeof _0x1391bf['offset']===_0x2e9d('0x1b')&&typeof _0x1391bf['limit']===_0x2e9d('0x1b');var _0x1818f6=_0x401a71[_0x2e9d('0x1c')];var _0x168c6a=_0x90ff9a?0x0:_0x1391bf['offset'];var _0x209cb4=_0x90ff9a?_0x401a71['count']:_0x1391bf['offset']+_0x1391bf[_0x2e9d('0x1d')];var _0x9b349;if(_0x209cb4>=_0x1818f6){_0x209cb4=_0x1818f6;_0x9b349=0xc8;}else{_0x9b349=0xce;}_0xdcd420[_0x2e9d('0x18')](_0x9b349);return _0xdcd420[_0x2e9d('0x1e')](_0x2e9d('0x1f'),_0x168c6a+'-'+_0x209cb4+'/'+_0x1818f6)[_0x2e9d('0x1a')](_0x401a71);}return null;};}function patchUpdates(_0x437dab){return function(_0x3c5a4a){try{jsonpatch['apply'](_0x3c5a4a,_0x437dab,!![]);}catch(_0x308fc1){return BPromise[_0x2e9d('0x20')](_0x308fc1);}return _0x3c5a4a[_0x2e9d('0x21')]();};}function saveUpdates(_0x33a619,_0x4a7bf0){return function(_0x2fd46b){if(_0x2fd46b){return _0x2fd46b['update'](_0x33a619)[_0x2e9d('0x22')](function(_0x143e39){return _0x143e39;});}return null;};}function removeEntity(_0x3ad411,_0x5bd267){return function(_0x670414){if(_0x670414){return _0x670414[_0x2e9d('0x23')]()['then'](function(){var _0x2c6dce=_0x670414['get']({'plain':!![]});var _0xd1380b='Companies';return db[_0x2e9d('0x24')][_0x2e9d('0x23')]({'where':{'type':_0xd1380b,'resourceId':_0x2c6dce['id']}})['then'](function(){return _0x670414;});})['then'](function(){_0x3ad411[_0x2e9d('0x18')](0xcc)[_0x2e9d('0x19')]();});}};}function handleEntityNotFound(_0x491c38,_0xacac2){return function(_0x8f807b){if(!_0x8f807b){_0x491c38['sendStatus'](0x194);}return _0x8f807b;};}function handleError(_0x356cd7,_0x5a7af9){_0x5a7af9=_0x5a7af9||0x1f4;return function(_0x42e0a0){logger[_0x2e9d('0x25')](_0x42e0a0[_0x2e9d('0x26')]);if(_0x42e0a0['name']){delete _0x42e0a0[_0x2e9d('0x27')];}_0x356cd7[_0x2e9d('0x18')](_0x5a7af9)[_0x2e9d('0x28')](_0x42e0a0);};}exports[_0x2e9d('0x29')]=function(_0x4d67f3,_0x5eae4b){var _0x4200f8={},_0x431bac={},_0x4746bc={'count':0x0,'rows':[]};return db[_0x2e9d('0x2a')]['describe']()[_0x2e9d('0x22')](function(_0x203522){_0x431bac[_0x2e9d('0x2b')]=_['keys'](_0x203522);_0x431bac[_0x2e9d('0x2c')]=_['keys'](_0x4d67f3['query']);_0x431bac['filters']=_[_0x2e9d('0x2d')](_0x431bac['model'],_0x431bac[_0x2e9d('0x2c')]);_0x4200f8[_0x2e9d('0x2e')]=_[_0x2e9d('0x2d')](_0x431bac[_0x2e9d('0x2b')],qs[_0x2e9d('0x2f')](_0x4d67f3[_0x2e9d('0x2c')][_0x2e9d('0x2f')]));_0x4200f8[_0x2e9d('0x2e')]=_0x4200f8[_0x2e9d('0x2e')][_0x2e9d('0x30')]?_0x4200f8[_0x2e9d('0x2e')]:_0x431bac[_0x2e9d('0x2b')];if(!_0x4d67f3['query'][_0x2e9d('0x31')](_0x2e9d('0x32'))){_0x4200f8[_0x2e9d('0x1d')]=qs[_0x2e9d('0x1d')](_0x4d67f3[_0x2e9d('0x2c')][_0x2e9d('0x1d')]);_0x4200f8['offset']=qs[_0x2e9d('0x33')](_0x4d67f3[_0x2e9d('0x2c')][_0x2e9d('0x33')]);}_0x4200f8['order']=qs[_0x2e9d('0x34')](_0x4d67f3[_0x2e9d('0x2c')][_0x2e9d('0x34')]);_0x4200f8[_0x2e9d('0x35')]=qs[_0x2e9d('0x36')](_[_0x2e9d('0x37')](_0x4d67f3[_0x2e9d('0x2c')],_0x431bac['filters']),_0x203522);if(_0x4d67f3[_0x2e9d('0x2c')][_0x2e9d('0x38')]){_0x4200f8[_0x2e9d('0x35')]=_[_0x2e9d('0x39')](_0x4200f8[_0x2e9d('0x35')],{'$or':_[_0x2e9d('0x3a')](_0x4200f8['attributes'],function(_0x596382){var _0x6b921a={};_0x6b921a[_0x596382]={'$like':'%'+_0x4d67f3[_0x2e9d('0x2c')][_0x2e9d('0x38')]+'%'};return _0x6b921a;})});}_0x4200f8=_[_0x2e9d('0x39')]({},_0x4200f8,_0x4d67f3['options']);var _0x2005ea={'where':_0x4200f8[_0x2e9d('0x35')]};return db[_0x2e9d('0x2a')][_0x2e9d('0x1c')](_0x2005ea)[_0x2e9d('0x22')](function(_0xfe86b7){_0x4746bc[_0x2e9d('0x1c')]=_0xfe86b7;if(_0x4d67f3[_0x2e9d('0x2c')][_0x2e9d('0x3b')]){_0x4200f8[_0x2e9d('0x3c')]=[{'all':!![]}];}return db[_0x2e9d('0x2a')][_0x2e9d('0x3d')](_0x4200f8);})[_0x2e9d('0x22')](function(_0x1bef17){_0x4746bc[_0x2e9d('0x3e')]=_0x1bef17;return _0x4746bc;})['then'](respondWithFilteredResult(_0x5eae4b,_0x4200f8))[_0x2e9d('0x3f')](handleError(_0x5eae4b,null));})[_0x2e9d('0x3f')](handleError(_0x5eae4b,null));};exports[_0x2e9d('0x40')]=function(_0x4e6ea3,_0x57cf8b){var _0x39c95b={'raw':![],'where':{'id':_0x4e6ea3[_0x2e9d('0x41')]['id']}},_0x19fe58={};_0x19fe58['model']=_[_0x2e9d('0x42')](db[_0x2e9d('0x2a')][_0x2e9d('0x43')]);_0x19fe58[_0x2e9d('0x2c')]=_[_0x2e9d('0x42')](_0x4e6ea3['query']);_0x19fe58['filters']=_['intersection'](_0x19fe58['model'],_0x19fe58[_0x2e9d('0x2c')]);_0x39c95b[_0x2e9d('0x2e')]=_[_0x2e9d('0x2d')](_0x19fe58['model'],qs[_0x2e9d('0x2f')](_0x4e6ea3[_0x2e9d('0x2c')][_0x2e9d('0x2f')]));_0x39c95b[_0x2e9d('0x2e')]=_0x39c95b[_0x2e9d('0x2e')]['length']?_0x39c95b[_0x2e9d('0x2e')]:_0x19fe58[_0x2e9d('0x2b')];if(_0x4e6ea3[_0x2e9d('0x2c')][_0x2e9d('0x3b')]){_0x39c95b['include']=[{'all':!![]}];}_0x39c95b=_[_0x2e9d('0x39')]({},_0x39c95b,_0x4e6ea3[_0x2e9d('0x44')]);return db[_0x2e9d('0x2a')][_0x2e9d('0x45')](_0x39c95b)['then'](handleEntityNotFound(_0x57cf8b,null))[_0x2e9d('0x22')](respondWithResult(_0x57cf8b,null))[_0x2e9d('0x3f')](handleError(_0x57cf8b,null));};exports[_0x2e9d('0x46')]=function(_0x19258a,_0x71d134){return db[_0x2e9d('0x2a')][_0x2e9d('0x46')](_0x19258a[_0x2e9d('0x47')],{})[_0x2e9d('0x22')](function(_0x50f98a){var _0x4a26c6=_0x19258a[_0x2e9d('0x48')][_0x2e9d('0x49')]({'plain':!![]});if(!_0x4a26c6)throw new Error(_0x2e9d('0x4a'));if(_0x4a26c6[_0x2e9d('0x4b')]==='user'){var _0x4974dd=_0x50f98a[_0x2e9d('0x49')]({'plain':!![]});var _0x51dc67=_0x2e9d('0x4c');return db['UserProfileSection'][_0x2e9d('0x45')]({'where':{'name':_0x51dc67,'userProfileId':_0x4a26c6['userProfileId']},'raw':!![]})['then'](function(_0x639338){if(_0x639338&&_0x639338[_0x2e9d('0x4d')]===0x0){return db[_0x2e9d('0x24')][_0x2e9d('0x46')]({'name':_0x4974dd['name'],'resourceId':_0x4974dd['id'],'type':_0x639338[_0x2e9d('0x27')],'sectionId':_0x639338['id']},{})['then'](function(){return _0x50f98a;});}else{return _0x50f98a;}})[_0x2e9d('0x3f')](function(_0x25d76d){logger[_0x2e9d('0x25')](_0x2e9d('0x4e'),_0x25d76d);throw _0x25d76d;});}return _0x50f98a;})[_0x2e9d('0x22')](respondWithResult(_0x71d134,0xc9))[_0x2e9d('0x3f')](handleError(_0x71d134,null));};exports[_0x2e9d('0x4f')]=function(_0x27105f,_0xf817f1){if(_0x27105f['body']['id']){delete _0x27105f[_0x2e9d('0x47')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x27105f[_0x2e9d('0x41')]['id']}})[_0x2e9d('0x22')](handleEntityNotFound(_0xf817f1,null))[_0x2e9d('0x22')](saveUpdates(_0x27105f[_0x2e9d('0x47')],null))['then'](respondWithResult(_0xf817f1,null))[_0x2e9d('0x3f')](handleError(_0xf817f1,null));};exports[_0x2e9d('0x23')]=function(_0x4fa468,_0x55b185){return db[_0x2e9d('0x2a')]['find']({'where':{'id':_0x4fa468[_0x2e9d('0x41')]['id']}})[_0x2e9d('0x22')](handleEntityNotFound(_0x55b185,null))['then'](removeEntity(_0x55b185,null))[_0x2e9d('0x3f')](handleError(_0x55b185,null));};exports[_0x2e9d('0x50')]=function(_0xc73177,_0x4cb39f){return db['CmCompany']['describe']()['then'](respondWithResult(_0x4cb39f,null))[_0x2e9d('0x3f')](handleError(_0x4cb39f,null));};exports[_0x2e9d('0x51')]=function(_0x3eb450,_0x54682d,_0x1e2774){return db[_0x2e9d('0x52')][_0x2e9d('0x45')]({'where':{'id':_0x3eb450[_0x2e9d('0x41')]['id']}})[_0x2e9d('0x22')](handleEntityNotFound(_0x54682d,null))['then'](function(_0x3235c1){if(_0x3235c1){return _0x3235c1[_0x2e9d('0x51')](_0x3eb450['body'][_0x2e9d('0x53')],_[_0x2e9d('0x54')](_0x3eb450[_0x2e9d('0x47')],[_0x2e9d('0x53'),'id'])||{});}})[_0x2e9d('0x22')](respondWithResult(_0x54682d,null))[_0x2e9d('0x3f')](handleError(_0x54682d,null));};exports['getContacts']=function(_0x492831,_0x5736a9,_0x2e3edd){var _0x317d3f={};var _0x39f6c5={};var _0x430904;var _0x47cbc5;return db[_0x2e9d('0x2a')][_0x2e9d('0x55')]({'where':{'id':_0x492831['params']['id']}})[_0x2e9d('0x22')](handleEntityNotFound(_0x5736a9,null))['then'](function(_0x39a586){if(_0x39a586){_0x430904=_0x39a586;_0x39f6c5[_0x2e9d('0x2b')]=_['keys'](db[_0x2e9d('0x52')][_0x2e9d('0x43')]);_0x39f6c5[_0x2e9d('0x2c')]=_[_0x2e9d('0x42')](_0x492831[_0x2e9d('0x2c')]);_0x39f6c5[_0x2e9d('0x36')]=_['intersection'](_0x39f6c5[_0x2e9d('0x2b')],_0x39f6c5[_0x2e9d('0x2c')]);_0x317d3f[_0x2e9d('0x2e')]=_[_0x2e9d('0x2d')](_0x39f6c5['model'],qs[_0x2e9d('0x2f')](_0x492831[_0x2e9d('0x2c')][_0x2e9d('0x2f')]));_0x317d3f[_0x2e9d('0x2e')]=_0x317d3f['attributes'][_0x2e9d('0x30')]?_0x317d3f['attributes']:_0x39f6c5[_0x2e9d('0x2b')];_0x317d3f[_0x2e9d('0x56')]=qs[_0x2e9d('0x34')](_0x492831[_0x2e9d('0x2c')][_0x2e9d('0x34')]);_0x317d3f['where']=qs['filters'](_[_0x2e9d('0x37')](_0x492831[_0x2e9d('0x2c')],_0x39f6c5['filters']));if(_0x492831['query'][_0x2e9d('0x38')]){_0x317d3f['where']=_[_0x2e9d('0x39')](_0x317d3f['where'],{'$or':_[_0x2e9d('0x3a')](_0x317d3f['attributes'],function(_0x2aac31){var _0x4c990d={};_0x4c990d[_0x2aac31]={'$like':'%'+_0x492831[_0x2e9d('0x2c')][_0x2e9d('0x38')]+'%'};return _0x4c990d;})});}_0x317d3f=_['merge']({},_0x317d3f,_0x492831[_0x2e9d('0x44')]);return _0x430904[_0x2e9d('0x57')](_0x317d3f);}})[_0x2e9d('0x22')](function(_0x4dc159){if(_0x4dc159){_0x47cbc5=_0x4dc159[_0x2e9d('0x30')];if(!_0x492831[_0x2e9d('0x2c')][_0x2e9d('0x31')]('nolimit')){_0x317d3f[_0x2e9d('0x1d')]=qs[_0x2e9d('0x1d')](_0x492831[_0x2e9d('0x2c')]['limit']);_0x317d3f[_0x2e9d('0x33')]=qs[_0x2e9d('0x33')](_0x492831['query']['offset']);}return _0x430904[_0x2e9d('0x57')](_0x317d3f);}})[_0x2e9d('0x22')](function(_0x51711b){if(_0x51711b){return _0x51711b?{'count':_0x47cbc5,'rows':_0x51711b}:null;}})[_0x2e9d('0x22')](respondWithResult(_0x5736a9,null))[_0x2e9d('0x3f')](handleError(_0x5736a9,null));}; \ No newline at end of file +var _0xc109=['destroy','UserProfileResource','end','error','stack','name','index','CmCompany','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','count','includeAll','include','catch','show','rawAttributes','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','params','describe','addContacts','ids','getContacts','findOne','CmContact','eml-format','fast-json-patch','moment','util','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then'];(function(_0x28dc11,_0x185341){var _0x2523fb=function(_0x54628f){while(--_0x54628f){_0x28dc11['push'](_0x28dc11['shift']());}};_0x2523fb(++_0x185341);}(_0xc109,0x80));var _0x9c10=function(_0x21f88f,_0x48cfba){_0x21f88f=_0x21f88f-0x0;var _0x3b9ff5=_0xc109[_0x21f88f];return _0x3b9ff5;};'use strict';var emlformat=require(_0x9c10('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9c10('0x1'));var rp=require('request-promise');var moment=require(_0x9c10('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9c10('0x3'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9c10('0x4'));var fs=require('fs');var fs_extra=require(_0x9c10('0x5'));var _=require(_0x9c10('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9c10('0x7'));var deskjs=require(_0x9c10('0x8'));var toCsv=require('to-csv');var querystring=require(_0x9c10('0x9'));var Papa=require(_0x9c10('0xa'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9c10('0xb'));var hardwareService=require(_0x9c10('0xc'));var logger=require(_0x9c10('0xd'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9c10('0xe'));var db=require(_0x9c10('0xf'))['db'];function respondWithStatusCode(_0x54e28a,_0x56c8c4){_0x56c8c4=_0x56c8c4||0xcc;return function(_0x4634ab){if(_0x4634ab){return _0x54e28a[_0x9c10('0x10')](_0x56c8c4);}return _0x54e28a['status'](_0x56c8c4)['end']();};}function respondWithResult(_0x413e2d,_0x5132ba){_0x5132ba=_0x5132ba||0xc8;return function(_0x1a7dff){if(_0x1a7dff){return _0x413e2d[_0x9c10('0x11')](_0x5132ba)[_0x9c10('0x12')](_0x1a7dff);}};}function respondWithFilteredResult(_0x4e1ba7,_0xabc5f){return function(_0x53b30d){if(_0x53b30d){var _0x298a47=typeof _0xabc5f[_0x9c10('0x13')]===_0x9c10('0x14')&&typeof _0xabc5f[_0x9c10('0x15')]===_0x9c10('0x14');var _0x40c9af=_0x53b30d['count'];var _0xd89aac=_0x298a47?0x0:_0xabc5f[_0x9c10('0x13')];var _0x4afb6d=_0x298a47?_0x53b30d['count']:_0xabc5f['offset']+_0xabc5f['limit'];var _0xbe9bc6;if(_0x4afb6d>=_0x40c9af){_0x4afb6d=_0x40c9af;_0xbe9bc6=0xc8;}else{_0xbe9bc6=0xce;}_0x4e1ba7[_0x9c10('0x11')](_0xbe9bc6);return _0x4e1ba7[_0x9c10('0x16')](_0x9c10('0x17'),_0xd89aac+'-'+_0x4afb6d+'/'+_0x40c9af)['json'](_0x53b30d);}return null;};}function patchUpdates(_0x20a7de){return function(_0x3808cc){try{jsonpatch[_0x9c10('0x18')](_0x3808cc,_0x20a7de,!![]);}catch(_0x3c509f){return BPromise[_0x9c10('0x19')](_0x3c509f);}return _0x3808cc['save']();};}function saveUpdates(_0x5966c5,_0x4d606c){return function(_0x21ab6d){if(_0x21ab6d){return _0x21ab6d[_0x9c10('0x1a')](_0x5966c5)[_0x9c10('0x1b')](function(_0x2bb71e){return _0x2bb71e;});}return null;};}function removeEntity(_0x4eb2ce,_0x5d57bb){return function(_0x40506f){if(_0x40506f){return _0x40506f[_0x9c10('0x1c')]()['then'](function(){var _0x42b314=_0x40506f['get']({'plain':!![]});var _0xc91d88='Companies';return db[_0x9c10('0x1d')][_0x9c10('0x1c')]({'where':{'type':_0xc91d88,'resourceId':_0x42b314['id']}})[_0x9c10('0x1b')](function(){return _0x40506f;});})['then'](function(){_0x4eb2ce[_0x9c10('0x11')](0xcc)[_0x9c10('0x1e')]();});}};}function handleEntityNotFound(_0x44943f,_0x12b968){return function(_0x57e724){if(!_0x57e724){_0x44943f['sendStatus'](0x194);}return _0x57e724;};}function handleError(_0x310887,_0xadbbc0){_0xadbbc0=_0xadbbc0||0x1f4;return function(_0x114d60){logger[_0x9c10('0x1f')](_0x114d60[_0x9c10('0x20')]);if(_0x114d60[_0x9c10('0x21')]){delete _0x114d60[_0x9c10('0x21')];}_0x310887[_0x9c10('0x11')](_0xadbbc0)['send'](_0x114d60);};}exports[_0x9c10('0x22')]=function(_0xcc2246,_0x4f927e){var _0xcedb9d={},_0x4ee9f0={},_0x2c3a25={'count':0x0,'rows':[]};return db[_0x9c10('0x23')]['describe']()[_0x9c10('0x1b')](function(_0x5b4542){_0x4ee9f0[_0x9c10('0x24')]=_[_0x9c10('0x25')](_0x5b4542);_0x4ee9f0[_0x9c10('0x26')]=_['keys'](_0xcc2246['query']);_0x4ee9f0[_0x9c10('0x27')]=_[_0x9c10('0x28')](_0x4ee9f0[_0x9c10('0x24')],_0x4ee9f0[_0x9c10('0x26')]);_0xcedb9d[_0x9c10('0x29')]=_[_0x9c10('0x28')](_0x4ee9f0[_0x9c10('0x24')],qs[_0x9c10('0x2a')](_0xcc2246[_0x9c10('0x26')]['fields']));_0xcedb9d[_0x9c10('0x29')]=_0xcedb9d[_0x9c10('0x29')][_0x9c10('0x2b')]?_0xcedb9d[_0x9c10('0x29')]:_0x4ee9f0[_0x9c10('0x24')];if(!_0xcc2246[_0x9c10('0x26')][_0x9c10('0x2c')](_0x9c10('0x2d'))){_0xcedb9d[_0x9c10('0x15')]=qs[_0x9c10('0x15')](_0xcc2246[_0x9c10('0x26')][_0x9c10('0x15')]);_0xcedb9d[_0x9c10('0x13')]=qs[_0x9c10('0x13')](_0xcc2246[_0x9c10('0x26')][_0x9c10('0x13')]);}_0xcedb9d[_0x9c10('0x2e')]=qs[_0x9c10('0x2f')](_0xcc2246[_0x9c10('0x26')][_0x9c10('0x2f')]);_0xcedb9d[_0x9c10('0x30')]=qs[_0x9c10('0x27')](_[_0x9c10('0x31')](_0xcc2246['query'],_0x4ee9f0[_0x9c10('0x27')]),_0x5b4542);if(_0xcc2246['query'][_0x9c10('0x32')]){_0xcedb9d[_0x9c10('0x30')]=_[_0x9c10('0x33')](_0xcedb9d['where'],{'$or':_[_0x9c10('0x34')](_0xcedb9d['attributes'],function(_0x1f9ba3){var _0x433f93={};_0x433f93[_0x1f9ba3]={'$like':'%'+_0xcc2246[_0x9c10('0x26')][_0x9c10('0x32')]+'%'};return _0x433f93;})});}_0xcedb9d=_[_0x9c10('0x33')]({},_0xcedb9d,_0xcc2246[_0x9c10('0x35')]);var _0x512e3f={'where':_0xcedb9d[_0x9c10('0x30')]};return db['CmCompany']['count'](_0x512e3f)[_0x9c10('0x1b')](function(_0x1b4f7d){_0x2c3a25[_0x9c10('0x36')]=_0x1b4f7d;if(_0xcc2246['query'][_0x9c10('0x37')]){_0xcedb9d[_0x9c10('0x38')]=[{'all':!![]}];}return db[_0x9c10('0x23')]['findAll'](_0xcedb9d);})['then'](function(_0x2c3da7){_0x2c3a25['rows']=_0x2c3da7;return _0x2c3a25;})[_0x9c10('0x1b')](respondWithFilteredResult(_0x4f927e,_0xcedb9d))[_0x9c10('0x39')](handleError(_0x4f927e,null));})[_0x9c10('0x39')](handleError(_0x4f927e,null));};exports[_0x9c10('0x3a')]=function(_0x449ef1,_0x3aac05){var _0x22e0bf={'raw':![],'where':{'id':_0x449ef1['params']['id']}},_0x5db506={};_0x5db506[_0x9c10('0x24')]=_[_0x9c10('0x25')](db[_0x9c10('0x23')][_0x9c10('0x3b')]);_0x5db506[_0x9c10('0x26')]=_[_0x9c10('0x25')](_0x449ef1[_0x9c10('0x26')]);_0x5db506[_0x9c10('0x27')]=_[_0x9c10('0x28')](_0x5db506[_0x9c10('0x24')],_0x5db506[_0x9c10('0x26')]);_0x22e0bf[_0x9c10('0x29')]=_[_0x9c10('0x28')](_0x5db506[_0x9c10('0x24')],qs[_0x9c10('0x2a')](_0x449ef1[_0x9c10('0x26')][_0x9c10('0x2a')]));_0x22e0bf[_0x9c10('0x29')]=_0x22e0bf[_0x9c10('0x29')][_0x9c10('0x2b')]?_0x22e0bf['attributes']:_0x5db506['model'];if(_0x449ef1[_0x9c10('0x26')][_0x9c10('0x37')]){_0x22e0bf[_0x9c10('0x38')]=[{'all':!![]}];}_0x22e0bf=_[_0x9c10('0x33')]({},_0x22e0bf,_0x449ef1['options']);return db[_0x9c10('0x23')][_0x9c10('0x3c')](_0x22e0bf)['then'](handleEntityNotFound(_0x3aac05,null))['then'](respondWithResult(_0x3aac05,null))[_0x9c10('0x39')](handleError(_0x3aac05,null));};exports[_0x9c10('0x3d')]=function(_0x40505c,_0x5d5b48){return db[_0x9c10('0x23')][_0x9c10('0x3d')](_0x40505c[_0x9c10('0x3e')],{})[_0x9c10('0x1b')](function(_0x34eb98){var _0x5ba560=_0x40505c[_0x9c10('0x3f')][_0x9c10('0x40')]({'plain':!![]});if(!_0x5ba560)throw new Error(_0x9c10('0x41'));if(_0x5ba560[_0x9c10('0x42')]===_0x9c10('0x3f')){var _0x471e58=_0x34eb98[_0x9c10('0x40')]({'plain':!![]});var _0x27ae58='Companies';return db[_0x9c10('0x43')][_0x9c10('0x3c')]({'where':{'name':_0x27ae58,'userProfileId':_0x5ba560[_0x9c10('0x44')]},'raw':!![]})[_0x9c10('0x1b')](function(_0x8390fb){if(_0x8390fb&&_0x8390fb[_0x9c10('0x45')]===0x0){return db[_0x9c10('0x1d')][_0x9c10('0x3d')]({'name':_0x471e58[_0x9c10('0x21')],'resourceId':_0x471e58['id'],'type':_0x8390fb[_0x9c10('0x21')],'sectionId':_0x8390fb['id']},{})['then'](function(){return _0x34eb98;});}else{return _0x34eb98;}})[_0x9c10('0x39')](function(_0x1bc5ba){logger[_0x9c10('0x1f')](_0x9c10('0x46'),_0x1bc5ba);throw _0x1bc5ba;});}return _0x34eb98;})[_0x9c10('0x1b')](respondWithResult(_0x5d5b48,0xc9))[_0x9c10('0x39')](handleError(_0x5d5b48,null));};exports[_0x9c10('0x1a')]=function(_0xfbaff2,_0x4f597d){if(_0xfbaff2[_0x9c10('0x3e')]['id']){delete _0xfbaff2[_0x9c10('0x3e')]['id'];}return db[_0x9c10('0x23')][_0x9c10('0x3c')]({'where':{'id':_0xfbaff2[_0x9c10('0x47')]['id']}})[_0x9c10('0x1b')](handleEntityNotFound(_0x4f597d,null))['then'](saveUpdates(_0xfbaff2[_0x9c10('0x3e')],null))[_0x9c10('0x1b')](respondWithResult(_0x4f597d,null))[_0x9c10('0x39')](handleError(_0x4f597d,null));};exports['destroy']=function(_0x39c442,_0x1e0743){return db[_0x9c10('0x23')][_0x9c10('0x3c')]({'where':{'id':_0x39c442[_0x9c10('0x47')]['id']}})[_0x9c10('0x1b')](handleEntityNotFound(_0x1e0743,null))[_0x9c10('0x1b')](removeEntity(_0x1e0743,null))[_0x9c10('0x39')](handleError(_0x1e0743,null));};exports[_0x9c10('0x48')]=function(_0x524c63,_0x6c0cba){return db[_0x9c10('0x23')][_0x9c10('0x48')]()['then'](respondWithResult(_0x6c0cba,null))[_0x9c10('0x39')](handleError(_0x6c0cba,null));};exports[_0x9c10('0x49')]=function(_0x2eda64,_0x135975,_0x4a4cbc){return db['CmContact'][_0x9c10('0x3c')]({'where':{'id':_0x2eda64[_0x9c10('0x47')]['id']}})[_0x9c10('0x1b')](handleEntityNotFound(_0x135975,null))[_0x9c10('0x1b')](function(_0x53dc18){if(_0x53dc18){return _0x53dc18[_0x9c10('0x49')](_0x2eda64[_0x9c10('0x3e')][_0x9c10('0x4a')],_['omit'](_0x2eda64[_0x9c10('0x3e')],[_0x9c10('0x4a'),'id'])||{});}})[_0x9c10('0x1b')](respondWithResult(_0x135975,null))[_0x9c10('0x39')](handleError(_0x135975,null));};exports[_0x9c10('0x4b')]=function(_0x30f803,_0x20147f,_0x2f8e84){var _0xd7b311={};var _0x42fd51={};var _0x1e25c3;var _0x1f2149;return db[_0x9c10('0x23')][_0x9c10('0x4c')]({'where':{'id':_0x30f803[_0x9c10('0x47')]['id']}})[_0x9c10('0x1b')](handleEntityNotFound(_0x20147f,null))[_0x9c10('0x1b')](function(_0x256acd){if(_0x256acd){_0x1e25c3=_0x256acd;_0x42fd51[_0x9c10('0x24')]=_[_0x9c10('0x25')](db[_0x9c10('0x4d')][_0x9c10('0x3b')]);_0x42fd51[_0x9c10('0x26')]=_[_0x9c10('0x25')](_0x30f803[_0x9c10('0x26')]);_0x42fd51[_0x9c10('0x27')]=_[_0x9c10('0x28')](_0x42fd51[_0x9c10('0x24')],_0x42fd51[_0x9c10('0x26')]);_0xd7b311[_0x9c10('0x29')]=_[_0x9c10('0x28')](_0x42fd51[_0x9c10('0x24')],qs[_0x9c10('0x2a')](_0x30f803[_0x9c10('0x26')][_0x9c10('0x2a')]));_0xd7b311['attributes']=_0xd7b311[_0x9c10('0x29')][_0x9c10('0x2b')]?_0xd7b311[_0x9c10('0x29')]:_0x42fd51[_0x9c10('0x24')];_0xd7b311[_0x9c10('0x2e')]=qs[_0x9c10('0x2f')](_0x30f803[_0x9c10('0x26')][_0x9c10('0x2f')]);_0xd7b311['where']=qs[_0x9c10('0x27')](_['pick'](_0x30f803['query'],_0x42fd51[_0x9c10('0x27')]));if(_0x30f803[_0x9c10('0x26')][_0x9c10('0x32')]){_0xd7b311[_0x9c10('0x30')]=_[_0x9c10('0x33')](_0xd7b311[_0x9c10('0x30')],{'$or':_[_0x9c10('0x34')](_0xd7b311[_0x9c10('0x29')],function(_0x17048d){var _0x3fe99a={};_0x3fe99a[_0x17048d]={'$like':'%'+_0x30f803[_0x9c10('0x26')][_0x9c10('0x32')]+'%'};return _0x3fe99a;})});}_0xd7b311=_[_0x9c10('0x33')]({},_0xd7b311,_0x30f803[_0x9c10('0x35')]);return _0x1e25c3['getContacts'](_0xd7b311);}})[_0x9c10('0x1b')](function(_0x12b028){if(_0x12b028){_0x1f2149=_0x12b028['length'];if(!_0x30f803[_0x9c10('0x26')][_0x9c10('0x2c')](_0x9c10('0x2d'))){_0xd7b311['limit']=qs['limit'](_0x30f803[_0x9c10('0x26')][_0x9c10('0x15')]);_0xd7b311['offset']=qs['offset'](_0x30f803['query'][_0x9c10('0x13')]);}return _0x1e25c3['getContacts'](_0xd7b311);}})[_0x9c10('0x1b')](function(_0x515fdb){if(_0x515fdb){return _0x515fdb?{'count':_0x1f2149,'rows':_0x515fdb}:null;}})[_0x9c10('0x1b')](respondWithResult(_0x20147f,null))[_0x9c10('0x39')](handleError(_0x20147f,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 2fe5892..7db4f91 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 _0xe354=['CmCompany','cm_companies','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./cmCompany.attributes','exports'];(function(_0x4450d9,_0x4622e0){var _0x5da628=function(_0x330a17){while(--_0x330a17){_0x4450d9['push'](_0x4450d9['shift']());}};_0x5da628(++_0x4622e0);}(_0xe354,0xa7));var _0x4e35=function(_0x43fa01,_0x5d9b0e){_0x43fa01=_0x43fa01-0x0;var _0x369e08=_0xe354[_0x43fa01];return _0x369e08;};'use strict';var _=require(_0x4e35('0x0'));var util=require('util');var logger=require(_0x4e35('0x1'))(_0x4e35('0x2'));var moment=require(_0x4e35('0x3'));var BPromise=require(_0x4e35('0x4'));var rp=require(_0x4e35('0x5'));var fs=require('fs');var path=require(_0x4e35('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4e35('0x7'));module[_0x4e35('0x8')]=function(_0x2687c4,_0x8726a5){return _0x2687c4['define'](_0x4e35('0x9'),attributes,{'tableName':_0x4e35('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e56=['define','CmCompany','util','../../config/logger','api','bluebird','path','../../config/environment','./cmCompany.attributes','exports'];(function(_0x43211a,_0x3db598){var _0x482bfa=function(_0xb77f4d){while(--_0xb77f4d){_0x43211a['push'](_0x43211a['shift']());}};_0x482bfa(++_0x3db598);}(_0x3e56,0x110));var _0x63e5=function(_0x337748,_0x402b05){_0x337748=_0x337748-0x0;var _0x3bb03f=_0x3e56[_0x337748];return _0x3bb03f;};'use strict';var _=require('lodash');var util=require(_0x63e5('0x0'));var logger=require(_0x63e5('0x1'))(_0x63e5('0x2'));var moment=require('moment');var BPromise=require(_0x63e5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x63e5('0x4'));var rimraf=require('rimraf');var config=require(_0x63e5('0x5'));var attributes=require(_0x63e5('0x6'));module[_0x63e5('0x7')]=function(_0x4ce7f3,_0x4ef2a7){return _0x4ce7f3[_0x63e5('0x8')](_0x63e5('0x9'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 7cf764e..486254f 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 _0xcc04=['rpc','../../config/environment','jayson/promise','client','request','then','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x13615d,_0x434bdf){var _0x329e9b=function(_0x5040fc){while(--_0x5040fc){_0x13615d['push'](_0x13615d['shift']());}};_0x329e9b(++_0x434bdf);}(_0xcc04,0x1d8));var _0x4cc0=function(_0x5d0191,_0x81eacc){_0x5d0191=_0x5d0191-0x0;var _0x4a835=_0xcc04[_0x5d0191];return _0x4a835;};'use strict';var _=require(_0x4cc0('0x0'));var util=require(_0x4cc0('0x1'));var moment=require('moment');var BPromise=require(_0x4cc0('0x2'));var rs=require(_0x4cc0('0x3'));var fs=require('fs');var Redis=require(_0x4cc0('0x4'));var db=require(_0x4cc0('0x5'))['db'];var utils=require(_0x4cc0('0x6'));var logger=require(_0x4cc0('0x7'))(_0x4cc0('0x8'));var config=require(_0x4cc0('0x9'));var jayson=require(_0x4cc0('0xa'));var client=jayson[_0x4cc0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55dc60,_0x415f74,_0x321594){return new BPromise(function(_0x20531c,_0x353b0c){return client[_0x4cc0('0xc')](_0x55dc60,_0x321594)[_0x4cc0('0xd')](function(_0x38bd4){logger[_0x4cc0('0xe')](_0x4cc0('0xf'),_0x415f74,'request\x20sent');logger[_0x4cc0('0x10')](_0x4cc0('0x11'),_0x415f74,_0x4cc0('0x12'),JSON[_0x4cc0('0x13')](_0x38bd4));if(_0x38bd4[_0x4cc0('0x14')]){if(_0x38bd4[_0x4cc0('0x14')][_0x4cc0('0x15')]===0x1f4){logger['error'](_0x4cc0('0xf'),_0x415f74,_0x38bd4[_0x4cc0('0x14')][_0x4cc0('0x16')]);return _0x353b0c(_0x38bd4[_0x4cc0('0x14')][_0x4cc0('0x16')]);}logger[_0x4cc0('0x14')](_0x4cc0('0xf'),_0x415f74,_0x38bd4[_0x4cc0('0x14')][_0x4cc0('0x16')]);return _0x20531c(_0x38bd4['error'][_0x4cc0('0x16')]);}else{logger['info'](_0x4cc0('0xf'),_0x415f74,_0x4cc0('0x12'));_0x20531c(_0x38bd4['result'][_0x4cc0('0x16')]);}})[_0x4cc0('0x17')](function(_0x38a278){logger[_0x4cc0('0x14')](_0x4cc0('0xf'),_0x415f74,_0x38a278);_0x353b0c(_0x38a278);});});} \ No newline at end of file +var _0x4f03=['jayson/promise','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x321b98,_0x4c7b2b){var _0x22948f=function(_0x12ac50){while(--_0x12ac50){_0x321b98['push'](_0x321b98['shift']());}};_0x22948f(++_0x4c7b2b);}(_0x4f03,0x160));var _0x34f0=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x4f03[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x34f0('0x0'));var util=require(_0x34f0('0x1'));var moment=require('moment');var BPromise=require(_0x34f0('0x2'));var rs=require(_0x34f0('0x3'));var fs=require('fs');var Redis=require(_0x34f0('0x4'));var db=require(_0x34f0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x34f0('0x6'))('rpc');var config=require(_0x34f0('0x7'));var jayson=require(_0x34f0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5023f4,_0x2ce600,_0xa416d7){return new BPromise(function(_0x43c061,_0x21916e){return client[_0x34f0('0x9')](_0x5023f4,_0xa416d7)[_0x34f0('0xa')](function(_0x3115d5){logger[_0x34f0('0xb')](_0x34f0('0xc'),_0x2ce600,_0x34f0('0xd'));logger['debug'](_0x34f0('0xe'),_0x2ce600,_0x34f0('0xd'),JSON[_0x34f0('0xf')](_0x3115d5));if(_0x3115d5['error']){if(_0x3115d5['error']['code']===0x1f4){logger['error'](_0x34f0('0xc'),_0x2ce600,_0x3115d5[_0x34f0('0x10')][_0x34f0('0x11')]);return _0x21916e(_0x3115d5[_0x34f0('0x10')][_0x34f0('0x11')]);}logger[_0x34f0('0x10')](_0x34f0('0xc'),_0x2ce600,_0x3115d5[_0x34f0('0x10')][_0x34f0('0x11')]);return _0x43c061(_0x3115d5[_0x34f0('0x10')][_0x34f0('0x11')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x2ce600,_0x34f0('0xd'));_0x43c061(_0x3115d5[_0x34f0('0x12')][_0x34f0('0x11')]);}})[_0x34f0('0x13')](function(_0x4f219c){logger[_0x34f0('0x10')](_0x34f0('0xc'),_0x2ce600,_0x4f219c);_0x21916e(_0x4f219c);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 22148e6..6a98268 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 _0x5467=['/:id','show','getContacts','post','isAuthenticated','create','/:id/contacts','addContacts','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','index','get'];(function(_0xedad0f,_0xd2a73d){var _0x1d657e=function(_0x2c98ce){while(--_0x2c98ce){_0xedad0f['push'](_0xedad0f['shift']());}};_0x1d657e(++_0xd2a73d);}(_0x5467,0x1ab));var _0x7546=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x5467[_0x5b561d];return _0x431060;};'use strict';var multer=require('multer');var util=require(_0x7546('0x0'));var path=require(_0x7546('0x1'));var timeout=require(_0x7546('0x2'));var express=require('express');var router=express[_0x7546('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7546('0x4'));var interaction=require(_0x7546('0x5'));var config=require(_0x7546('0x6'));var controller=require(_0x7546('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7546('0x8')]);router[_0x7546('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x7546('0xa'),auth['isAuthenticated'](),controller[_0x7546('0xb')]);router[_0x7546('0x9')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x7546('0xc')]);router[_0x7546('0xd')]('/',auth[_0x7546('0xe')](),controller[_0x7546('0xf')]);router[_0x7546('0xd')](_0x7546('0x10'),auth[_0x7546('0xe')](),controller[_0x7546('0x11')]);router[_0x7546('0x12')](_0x7546('0xa'),auth[_0x7546('0xe')](),controller[_0x7546('0x13')]);router[_0x7546('0x14')](_0x7546('0xa'),auth['isAuthenticated'](),controller[_0x7546('0x15')]);module[_0x7546('0x16')]=router; \ No newline at end of file +var _0xa2d2=['get','isAuthenticated','index','/describe','describe','/:id','/:id/contacts','getContacts','post','create','put','update','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller'];(function(_0x56ee15,_0x1effd1){var _0x94991f=function(_0x5018fa){while(--_0x5018fa){_0x56ee15['push'](_0x56ee15['shift']());}};_0x94991f(++_0x1effd1);}(_0xa2d2,0x16e));var _0x2a2d=function(_0x3276ee,_0x348af4){_0x3276ee=_0x3276ee-0x0;var _0x4d1e8e=_0xa2d2[_0x3276ee];return _0x4d1e8e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2a2d('0x0'));var timeout=require(_0x2a2d('0x1'));var express=require(_0x2a2d('0x2'));var router=express[_0x2a2d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2a2d('0x4'));var interaction=require(_0x2a2d('0x5'));var config=require(_0x2a2d('0x6'));var controller=require(_0x2a2d('0x7'));router[_0x2a2d('0x8')]('/',auth[_0x2a2d('0x9')](),controller[_0x2a2d('0xa')]);router[_0x2a2d('0x8')](_0x2a2d('0xb'),auth['isAuthenticated'](),controller[_0x2a2d('0xc')]);router[_0x2a2d('0x8')](_0x2a2d('0xd'),auth[_0x2a2d('0x9')](),controller['show']);router[_0x2a2d('0x8')](_0x2a2d('0xe'),auth[_0x2a2d('0x9')](),controller[_0x2a2d('0xf')]);router[_0x2a2d('0x10')]('/',auth['isAuthenticated'](),controller[_0x2a2d('0x11')]);router['post'](_0x2a2d('0xe'),auth[_0x2a2d('0x9')](),controller['addContacts']);router[_0x2a2d('0x12')](_0x2a2d('0xd'),auth['isAuthenticated'](),controller[_0x2a2d('0x13')]);router[_0x2a2d('0x14')](_0x2a2d('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x2a2d('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index d08d462..c5b3877 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 _0x3850=['TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING'];(function(_0x208d75,_0x92d742){var _0x382d27=function(_0x3aaba3){while(--_0x3aaba3){_0x208d75['push'](_0x208d75['shift']());}};_0x382d27(++_0x92d742);}(_0x3850,0x1eb));var _0x0385=function(_0xd0e732,_0x549139){_0xd0e732=_0xd0e732-0x0;var _0x32d64b=_0x3850[_0xd0e732];return _0x32d64b;};'use strict';var _=require(_0x0385('0x0'));var Sequelize=require(_0x0385('0x1'));module[_0x0385('0x2')]={'firstName':{'type':Sequelize[_0x0385('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x0385('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x0385('0x3')]},'city':{'type':Sequelize[_0x0385('0x3')]},'country':{'type':Sequelize[_0x0385('0x3')]},'dateOfBirth':{'type':Sequelize[_0x0385('0x3')]},'description':{'type':Sequelize[_0x0385('0x4')]},'phone':{'type':Sequelize[_0x0385('0x3')]},'mobile':{'type':Sequelize[_0x0385('0x3')]},'fax':{'type':Sequelize[_0x0385('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x0385('0x3')]},'fb_data':{'type':Sequelize[_0x0385('0x3')]},'twitter':{'type':Sequelize[_0x0385('0x3')]},'skype':{'type':Sequelize[_0x0385('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x0385('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x0385('0x3')]},'telegram':{'type':Sequelize[_0x0385('0x3')]},'UserId':{'type':Sequelize[_0x0385('0x5')]},'priority':{'type':Sequelize[_0x0385('0x5')](0x2)[_0x0385('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x0385('0x7')],'defaultValue':Sequelize[_0x0385('0x8')]}}; \ No newline at end of file +var _0x40ad=['lodash','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x40ad,0x1e6));var _0xd40a=function(_0x2e1207,_0x2620c8){_0x2e1207=_0x2e1207-0x0;var _0x164111=_0x40ad[_0x2e1207];return _0x164111;};'use strict';var _=require(_0xd40a('0x0'));var Sequelize=require('sequelize');module[_0xd40a('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xd40a('0x2')]},'street':{'type':Sequelize[_0xd40a('0x2')]},'postalCode':{'type':Sequelize[_0xd40a('0x2')]},'city':{'type':Sequelize[_0xd40a('0x2')]},'country':{'type':Sequelize[_0xd40a('0x2')]},'dateOfBirth':{'type':Sequelize[_0xd40a('0x2')]},'description':{'type':Sequelize[_0xd40a('0x3')]},'phone':{'type':Sequelize[_0xd40a('0x2')]},'mobile':{'type':Sequelize[_0xd40a('0x2')]},'fax':{'type':Sequelize[_0xd40a('0x2')]},'email':{'type':Sequelize[_0xd40a('0x2')]},'url':{'type':Sequelize[_0xd40a('0x2')]},'facebook':{'type':Sequelize[_0xd40a('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xd40a('0x2')]},'skype':{'type':Sequelize[_0xd40a('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xd40a('0x2')]},'line':{'type':Sequelize[_0xd40a('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xd40a('0x2')]},'UserId':{'type':Sequelize[_0xd40a('0x4')]},'priority':{'type':Sequelize[_0xd40a('0x4')](0x2)[_0xd40a('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'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 e791fdc..7488d25 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 _0x6349=['JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','create','bulkCreate','each','duplicates','$or','findOrCreate','spread','show','params','$and','cf_%d','omit','pickBy','format','table','id\x20=\x20?','toParam','phone','getTags','findOne','rawAttributes','options','setTags','getHoppers','includeAll','include','ContactId','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','chmodSync','child_process','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','file','meta','import','binding','No\x20firstName\x20column\x20specified','fork','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','mail','chat','sms','openchannel','whatsapp','voice','-createdAt','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','source','destination','starttime','endtime','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','findAndCountAll','startCase','Website','Account','closed','disposition','thirdDisposition','key','Owner','browserName','customerIp','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','Interaction','fullname','all','flatten','sortBy','reverse','slice','moment','bluebird','util','path','lodash','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','status','json','offset','limit','undefined','count','set','Content-Range','update','then','end','sendStatus','error','stack','name','send','index','CmContact','describe','keys','length','startsWith','cf_','CmCustomField','trimStart','fieldType','type','model','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','tools_tags','cm_contacts','left_join','cm_user_has_contacts','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','expr','search','parseSearch','sqlOperator','conditions','Tag','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','DATE','text','start','isNil','Contact','push','ListId','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','filter','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.id','Sequelize','QueryTypes','SELECT','clone','DESC','having','t.id\x20IN\x20?','resolve','some','User','user','getLists','isEmpty','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','role','agent','sequelize','toString','keyBy','c.firstName','c.lastName','c.phone','c.mobile','c.ListId','c.createdAt','GROUP_CONCAT(DISTINCT\x20t.id)','Tags','TagIds','rows','catch','find','tags','columnName','displayName','analytics','findAll','alias','custom','values','merge','body','get','mergeWith','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','from','CmHopper','destroy','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x6349,0x193));var _0x9634=function(_0x5ea03b,_0x23e9d9){_0x5ea03b=_0x5ea03b-0x0;var _0x39c95f=_0x6349[_0x5ea03b];return _0x39c95f;};'use strict';var moment=require(_0x9634('0x0'));var BPromise=require(_0x9634('0x1'));var util=require(_0x9634('0x2'));var path=require(_0x9634('0x3'));var fs=require('fs');var _=require(_0x9634('0x4'));var squel=require('squel');var Papa=require(_0x9634('0x5'));var Redis=require(_0x9634('0x6'));var qs=require('../../components/parsers/qs');var as=require(_0x9634('0x7'));var logger=require(_0x9634('0x8'))(_0x9634('0x9'));var config=require(_0x9634('0xa'));var db=require(_0x9634('0xb'))['db'];config[_0x9634('0xc')]=_[_0x9634('0xd')](config[_0x9634('0xc')],{'host':_0x9634('0xe'),'port':0x18eb});var socket=require(_0x9634('0xf'))(new Redis(config[_0x9634('0xc')]));require(_0x9634('0x10'))['register'](socket);function respondWithResult(_0x4cb459,_0x3cace5){_0x3cace5=_0x3cace5||0xc8;return function(_0x47c619){if(_0x47c619){return _0x4cb459[_0x9634('0x11')](_0x3cace5)[_0x9634('0x12')](_0x47c619);}};}function respondWithFilteredResult(_0x482e88,_0x14fabc){return function(_0x10fc4c){if(_0x10fc4c){var _0x3c2926=typeof _0x14fabc[_0x9634('0x13')]==='undefined'&&typeof _0x14fabc[_0x9634('0x14')]===_0x9634('0x15');var _0x224031=_0x10fc4c[_0x9634('0x16')];var _0x4f7637=_0x3c2926?0x0:_0x14fabc[_0x9634('0x13')];var _0x4159aa=_0x3c2926?_0x10fc4c['count']:_0x14fabc[_0x9634('0x13')]+_0x14fabc[_0x9634('0x14')];var _0x2a61d1;if(_0x4159aa>=_0x224031){_0x4159aa=_0x224031;_0x2a61d1=0xc8;}else{_0x2a61d1=0xce;}_0x482e88['status'](_0x2a61d1);return _0x482e88[_0x9634('0x17')](_0x9634('0x18'),_0x4f7637+'-'+_0x4159aa+'/'+_0x224031)[_0x9634('0x12')](_0x10fc4c);}return null;};}function saveUpdates(_0x121a06){return function(_0x289bc3){if(_0x289bc3){return _0x289bc3[_0x9634('0x19')](_0x121a06)[_0x9634('0x1a')](function(_0x3e44ec){return _0x3e44ec;});}return null;};}function removeEntity(_0x5c0066){return function(_0x83cda3){if(_0x83cda3){return _0x83cda3['destroy']()[_0x9634('0x1a')](function(){_0x5c0066['status'](0xcc)[_0x9634('0x1b')]();});}};}function handleEntityNotFound(_0x59bc78){return function(_0x2a300c){if(!_0x2a300c){_0x59bc78[_0x9634('0x1c')](0x194);}return _0x2a300c;};}function handleError(_0x24fee6,_0x359b9a){_0x359b9a=_0x359b9a||0x1f4;return function(_0x56efd1){logger[_0x9634('0x1d')](_0x56efd1[_0x9634('0x1e')]);if(_0x56efd1[_0x9634('0x1f')]){delete _0x56efd1[_0x9634('0x1f')];}_0x24fee6['status'](_0x359b9a)[_0x9634('0x20')](_0x56efd1);};}exports[_0x9634('0x21')]=function(_0x295ac5,_0xb29798){var _0x4a32b5={},_0x1fc6f8={},_0x2f1d33={'count':0x0,'rows':[]};return db[_0x9634('0x22')][_0x9634('0x23')]()[_0x9634('0x1a')](function(_0x10ed27){var _0x2f16c7=[];for(var _0x2eee9f=0x0;_0x2eee9f0x1){_0xb440d5['or'](_0x9634('0x60'),qs['getFullTextValue'](_0x231e83),null);}else{if(qs['isNumeric'](_0x231e83)){_0xb440d5['or'](_0x9634('0x61'),_0x231e83+'%');_0xb440d5['or'](_0x9634('0x62'),_0x231e83+'%');_0xb440d5['or'](_0x9634('0x63'),_0x231e83+'%');_0xb440d5['or']('c.fax\x20LIKE\x20?',_0x231e83+'%');}else if(qs[_0x9634('0x64')](_0x231e83)){_0xb440d5['or'](_0x9634('0x65'),_0x231e83+'%');}else{_0xb440d5['or'](_0x9634('0x66'),'%'+_0x231e83+'%');_0xb440d5['or'](_0x9634('0x67'),'%'+_0x231e83+'%');_0xb440d5['or']('c.email\x20LIKE\x20?','%'+_0x231e83+'%');}}}}_0x1124d3['where'](_0xb440d5);_0x1124d3['group'](_0x9634('0x68'));var _0x1208f4={'type':db[_0x9634('0x69')][_0x9634('0x6a')][_0x9634('0x6b')],'raw':!![]};var _0xf546bf=_0x1124d3[_0x9634('0x6c')]()['field']('c.id');if(_0x4a32b5[_0x9634('0x33')]){_0x4a32b5[_0x9634('0x33')][_0x9634('0x4a')](function(_0xb79b93){_0x1124d3[_0x9634('0x33')]('c.'+_0xb79b93[0x0],_0xb79b93[0x1]===_0x9634('0x6d')?![]:!![]);});}if(!_['isEmpty'](_0xa88c6a)){_0x1124d3[_0x9634('0x6e')](_0x593d6b);_0xf546bf['where'](_0x9634('0x6f'),_0xa88c6a);}BPromise[_0x9634('0x70')]()[_0x9634('0x1a')](function(){if(!_0x2848a0)return;if(_0x295ac5['user']['role']!=='agent')return;if(!_[_0x9634('0x71')](_0x2848a0[_0x9634('0x45')],[_0x9634('0x39'),_0x9634('0x72')])){return _0x295ac5[_0x9634('0x73')][_0x9634('0x74')]({'attributes':['id'],'raw':!![]})[_0x9634('0x1a')](function(_0x5c9c71){if(_[_0x9634('0x75')](_0x5c9c71)){_0xf546bf[_0x9634('0x35')]('c.ListId\x20IS\x20NULL');_0x1124d3[_0x9634('0x35')](_0x9634('0x76'));}else{_0xf546bf[_0x9634('0x35')](_0x9634('0x77'),_[_0x9634('0x49')](_0x5c9c71,'id'));_0x1124d3[_0x9634('0x35')](_0x9634('0x77'),_[_0x9634('0x49')](_0x5c9c71,'id'));}});}})['then'](function(){if(_0x295ac5[_0x9634('0x73')][_0x9634('0x78')]===_0x9634('0x79')&&!_0x2848a0&&!_0x295ac5[_0x9634('0x2e')][_0x9634('0x58')])return[];return db[_0x9634('0x7a')][_0x9634('0x2e')](_0xf546bf[_0x9634('0x7b')](),_0x1208f4);})[_0x9634('0x1a')](function(_0x5f3eb0){_0x2f1d33[_0x9634('0x16')]=_0x5f3eb0[_0x9634('0x25')];if(_0x2f1d33[_0x9634('0x16')]===0x0)return[];return db[_0x9634('0x7a')][_0x9634('0x2e')](_0x366f43['toString'](),_0x1208f4)['then'](function(_0x6712c4){_0x56b289=_[_0x9634('0x7c')](_0x6712c4,'id');_0x1208f4=_['merge'](_0x1208f4,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x295ac5[_0x9634('0x2e')][_0x9634('0x30')]){_0x4a32b5[_0x9634('0x2f')][_0x9634('0x4a')](function(_0x14c526){_0x1124d3['field']('c.'+_0x14c526);});}else{_0x1124d3[_0x9634('0x39')](_0x9634('0x68'));_0x1124d3['field'](_0x9634('0x7d'));_0x1124d3[_0x9634('0x39')](_0x9634('0x7e'));_0x1124d3['field'](_0x9634('0x7f'));_0x1124d3[_0x9634('0x39')](_0x9634('0x80'));_0x1124d3[_0x9634('0x39')]('c.fax');_0x1124d3[_0x9634('0x39')]('c.email');_0x1124d3[_0x9634('0x39')](_0x9634('0x81'));_0x1124d3[_0x9634('0x39')](_0x9634('0x82'));_0x1124d3[_0x9634('0x39')]('c.deletedAt');_0x1124d3['field']('c.CompanyId');_0x1124d3[_0x9634('0x39')](_0x9634('0x83'),'TagIds');}if(_0x4a32b5['limit'])_0x1124d3[_0x9634('0x14')](_0x4a32b5[_0x9634('0x14')]);if(_0x4a32b5[_0x9634('0x13')])_0x1124d3[_0x9634('0x13')](_0x4a32b5[_0x9634('0x13')]);return db['sequelize'][_0x9634('0x2e')](_0x1124d3['toString'](),_0x1208f4);});})['then'](function(_0x36246e){_0x36246e[_0x9634('0x4a')](function(_0xed916e){if(_0xed916e['TagIds']){_0xed916e[_0x9634('0x84')]=[];_0xed916e[_0x9634('0x85')]['split'](',')[_0x9634('0x4a')](function(_0x417e9d){_0xed916e[_0x9634('0x84')]['push'](_0x56b289[_0x417e9d]);});}delete _0xed916e[_0x9634('0x85')];});_0x2f1d33[_0x9634('0x86')]=_0x36246e;return _0x2f1d33;})['then'](respondWithFilteredResult(_0xb29798,_0x4a32b5));})[_0x9634('0x87')](handleError(_0xb29798,null));};exports['destroy']=function(_0x3ddd50,_0x1f6056){return db['CmContact'][_0x9634('0x88')]({'where':{'id':_0x3ddd50['params']['id']}})[_0x9634('0x1a')](handleEntityNotFound(_0x1f6056,null))['then'](removeEntity(_0x1f6056,null))['catch'](handleError(_0x1f6056,null));};exports[_0x9634('0x23')]=function(_0x2ba7a0,_0x11a0b2){return db[_0x9634('0x22')][_0x9634('0x23')]()[_0x9634('0x1a')](function(_0x8b5eb4){delete _0x8b5eb4[_0x9634('0x89')];for(var _0x361722=0x0;_0x361722=_0x1e2a9a){_0x3fe14f=_0x1e2a9a;_0xcd94f6=0xc8;}else{_0xcd94f6=0xce;}_0x4915ed[_0x7ee1('0x11')](_0xcd94f6);return _0x4915ed[_0x7ee1('0x17')](_0x7ee1('0x18'),_0x1d476f+'-'+_0x3fe14f+'/'+_0x1e2a9a)[_0x7ee1('0x12')](_0x57513e);}return null;};}function saveUpdates(_0x5137f4){return function(_0x202f6c){if(_0x202f6c){return _0x202f6c['update'](_0x5137f4)[_0x7ee1('0x19')](function(_0x499241){return _0x499241;});}return null;};}function removeEntity(_0x47d688){return function(_0x4a5690){if(_0x4a5690){return _0x4a5690['destroy']()['then'](function(){_0x47d688[_0x7ee1('0x11')](0xcc)[_0x7ee1('0x1a')]();});}};}function handleEntityNotFound(_0x4cc4b2){return function(_0x5802f6){if(!_0x5802f6){_0x4cc4b2[_0x7ee1('0x1b')](0x194);}return _0x5802f6;};}function handleError(_0x51a517,_0x3c4c15){_0x3c4c15=_0x3c4c15||0x1f4;return function(_0x560204){logger[_0x7ee1('0x1c')](_0x560204[_0x7ee1('0x1d')]);if(_0x560204[_0x7ee1('0x1e')]){delete _0x560204[_0x7ee1('0x1e')];}_0x51a517[_0x7ee1('0x11')](_0x3c4c15)[_0x7ee1('0x1f')](_0x560204);};}exports['index']=function(_0x39f48e,_0x22f3f0){var _0x48cde4={},_0x6623a9={},_0x3d0943={'count':0x0,'rows':[]};return db[_0x7ee1('0x20')][_0x7ee1('0x21')]()['then'](function(_0x340d6a){var _0x28403e=[];for(var _0x30236e=0x0;_0x30236e0x1){_0x442f2d['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7ee1('0x5d')](_0x4193ec),null);}else{if(qs[_0x7ee1('0x5e')](_0x4193ec)){_0x442f2d['or'](_0x7ee1('0x5f'),_0x4193ec+'%');_0x442f2d['or']('c.phone\x20LIKE\x20?',_0x4193ec+'%');_0x442f2d['or']('c.mobile\x20LIKE\x20?',_0x4193ec+'%');_0x442f2d['or'](_0x7ee1('0x60'),_0x4193ec+'%');}else if(qs[_0x7ee1('0x61')](_0x4193ec)){_0x442f2d['or'](_0x7ee1('0x62'),_0x4193ec+'%');}else{_0x442f2d['or'](_0x7ee1('0x63'),'%'+_0x4193ec+'%');_0x442f2d['or'](_0x7ee1('0x64'),'%'+_0x4193ec+'%');_0x442f2d['or'](_0x7ee1('0x62'),'%'+_0x4193ec+'%');}}}}_0x120b46[_0x7ee1('0x41')](_0x442f2d);_0x120b46[_0x7ee1('0x65')](_0x7ee1('0x66'));var _0x44cf5b={'type':db[_0x7ee1('0x67')][_0x7ee1('0x68')]['SELECT'],'raw':!![]};var _0x9ac4a8=_0x120b46['clone']()[_0x7ee1('0x38')](_0x7ee1('0x66'));if(_0x48cde4[_0x7ee1('0x33')]){_0x48cde4[_0x7ee1('0x33')][_0x7ee1('0x5a')](function(_0x178c0f){_0x120b46['order']('c.'+_0x178c0f[0x0],_0x178c0f[0x1]===_0x7ee1('0x69')?![]:!![]);});}if(!_[_0x7ee1('0x6a')](_0x43126f)){_0x120b46[_0x7ee1('0x6b')](_0x32fe83);_0x9ac4a8[_0x7ee1('0x41')](_0x7ee1('0x6c'),_0x43126f);}BPromise[_0x7ee1('0x6d')]()['then'](function(){if(!_0x12dab8)return;if(_0x39f48e[_0x7ee1('0x6e')][_0x7ee1('0x6f')]!==_0x7ee1('0x70'))return;if(!_[_0x7ee1('0x71')](_0x12dab8[_0x7ee1('0x46')],[_0x7ee1('0x38'),_0x7ee1('0x72')])){return _0x39f48e['user']['getLists']({'attributes':['id'],'raw':!![]})[_0x7ee1('0x19')](function(_0x440904){if(_['isEmpty'](_0x440904)){_0x9ac4a8[_0x7ee1('0x41')](_0x7ee1('0x73'));_0x120b46['where'](_0x7ee1('0x73'));}else{_0x9ac4a8['where'](_0x7ee1('0x56'),_[_0x7ee1('0x4a')](_0x440904,'id'));_0x120b46['where'](_0x7ee1('0x56'),_[_0x7ee1('0x4a')](_0x440904,'id'));}});}})[_0x7ee1('0x19')](function(){if(_0x39f48e[_0x7ee1('0x6e')][_0x7ee1('0x6f')]==='agent'&&!_0x12dab8&&!_0x39f48e[_0x7ee1('0x2d')]['ListId'])return[];return db[_0x7ee1('0x74')][_0x7ee1('0x2d')](_0x9ac4a8[_0x7ee1('0x75')](),_0x44cf5b);})[_0x7ee1('0x19')](function(_0x35a95c){_0x3d0943[_0x7ee1('0x16')]=_0x35a95c[_0x7ee1('0x23')];if(_0x3d0943[_0x7ee1('0x16')]===0x0)return[];return db[_0x7ee1('0x74')][_0x7ee1('0x2d')](_0x57f885[_0x7ee1('0x75')](),_0x44cf5b)['then'](function(_0x57d9f1){_0x5287cd=_['keyBy'](_0x57d9f1,'id');_0x44cf5b=_[_0x7ee1('0x76')](_0x44cf5b,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x39f48e[_0x7ee1('0x2d')]['fields']){_0x48cde4[_0x7ee1('0x2f')][_0x7ee1('0x5a')](function(_0xce9082){_0x120b46[_0x7ee1('0x38')]('c.'+_0xce9082);});}else{_0x120b46[_0x7ee1('0x38')]('c.id');_0x120b46[_0x7ee1('0x38')](_0x7ee1('0x77'));_0x120b46['field'](_0x7ee1('0x78'));_0x120b46[_0x7ee1('0x38')]('c.phone');_0x120b46[_0x7ee1('0x38')](_0x7ee1('0x79'));_0x120b46[_0x7ee1('0x38')]('c.fax');_0x120b46[_0x7ee1('0x38')]('c.email');_0x120b46[_0x7ee1('0x38')](_0x7ee1('0x7a'));_0x120b46[_0x7ee1('0x38')](_0x7ee1('0x7b'));_0x120b46[_0x7ee1('0x38')]('c.deletedAt');_0x120b46[_0x7ee1('0x38')](_0x7ee1('0x7c'));_0x120b46[_0x7ee1('0x38')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x7ee1('0x7d'));}if(_0x48cde4['limit'])_0x120b46[_0x7ee1('0x13')](_0x48cde4[_0x7ee1('0x13')]);if(_0x48cde4[_0x7ee1('0x15')])_0x120b46[_0x7ee1('0x15')](_0x48cde4[_0x7ee1('0x15')]);return db[_0x7ee1('0x74')][_0x7ee1('0x2d')](_0x120b46['toString'](),_0x44cf5b);});})[_0x7ee1('0x19')](function(_0x2beef1){_0x2beef1[_0x7ee1('0x5a')](function(_0x32ef45){if(_0x32ef45[_0x7ee1('0x7d')]){_0x32ef45[_0x7ee1('0x7e')]=[];_0x32ef45[_0x7ee1('0x7d')]['split'](',')['forEach'](function(_0x5e7549){_0x32ef45['Tags']['push'](_0x5287cd[_0x5e7549]);});}delete _0x32ef45[_0x7ee1('0x7d')];});_0x3d0943[_0x7ee1('0x7f')]=_0x2beef1;return _0x3d0943;})[_0x7ee1('0x19')](respondWithFilteredResult(_0x22f3f0,_0x48cde4));})[_0x7ee1('0x80')](handleError(_0x22f3f0,null));};exports[_0x7ee1('0x81')]=function(_0x41f4bf,_0x2ac95b){return db['CmContact'][_0x7ee1('0x47')]({'where':{'id':_0x41f4bf[_0x7ee1('0x82')]['id']}})[_0x7ee1('0x19')](handleEntityNotFound(_0x2ac95b,null))['then'](removeEntity(_0x2ac95b,null))[_0x7ee1('0x80')](handleError(_0x2ac95b,null));};exports['describe']=function(_0x223fac,_0x283443){return db['CmContact'][_0x7ee1('0x21')]()[_0x7ee1('0x19')](function(_0x606be6){delete _0x606be6[_0x7ee1('0x83')];for(var _0x59ee35=0x0;_0x59ee35{}\s\\|]/g,'-');_0x5f0b59(null,util['format'](_0x0c6a('0x24'),path[_0x0c6a('0x25')](_0x42af68['originalname'],path[_0x0c6a('0x26')](_0x42af68[_0x0c6a('0x22')])),Date[_0x0c6a('0x27')](),path['extname'](_0x42af68[_0x0c6a('0x22')])));}})});router['post']('/csv',upload['single'](_0x0c6a('0x28')),controller[_0x0c6a('0x29')]);var upload=multer({'storage':multer[_0x0c6a('0x20')]({'destination':function(_0x398038,_0x2b0e63,_0x4b8b6c){_0x4b8b6c(null,path[_0x0c6a('0x2a')](config['root'],'server/files/tmp'));},'filename':function(_0x50a05a,_0x4dd3cc,_0x13448c){_0x4dd3cc[_0x0c6a('0x22')]=_0x4dd3cc['originalname'][_0x0c6a('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x13448c(null,util[_0x0c6a('0x2b')](_0x0c6a('0x24'),path[_0x0c6a('0x25')](_0x4dd3cc['originalname'],path[_0x0c6a('0x26')](_0x4dd3cc[_0x0c6a('0x22')])),Date[_0x0c6a('0x27')](),path[_0x0c6a('0x26')](_0x4dd3cc[_0x0c6a('0x22')])));}})});router['post'](_0x0c6a('0x2c'),upload[_0x0c6a('0x2d')](_0x0c6a('0x28')),controller['upload']);router['post'](_0x0c6a('0x2e'),auth[_0x0c6a('0xa')](),controller[_0x0c6a('0x2f')]);router['put'](_0x0c6a('0xe'),auth[_0x0c6a('0xa')](),controller['update']);router['delete']('/:id',auth[_0x0c6a('0xa')](),controller[_0x0c6a('0x30')]);module[_0x0c6a('0x31')]=router; \ No newline at end of file +var _0x55b9=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','/:id/tags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','/merge','merge','post','create','/create_many','bulkCreate','setTags','diskStorage','originalname','%s-%s%s','extname','now','/csv','single','uploadCsv','join','root','server/files/tmp','/upload','file','upload','/upload/:id','import','/:id','update','delete','exports'];(function(_0x12b83d,_0x4bcec7){var _0x1fd39d=function(_0x449185){while(--_0x449185){_0x12b83d['push'](_0x12b83d['shift']());}};_0x1fd39d(++_0x4bcec7);}(_0x55b9,0x9c));var _0x955b=function(_0x45168b,_0x13719d){_0x45168b=_0x45168b-0x0;var _0xdfe5e3=_0x55b9[_0x45168b];return _0xdfe5e3;};'use strict';var multer=require(_0x955b('0x0'));var util=require(_0x955b('0x1'));var path=require(_0x955b('0x2'));var timeout=require(_0x955b('0x3'));var express=require(_0x955b('0x4'));var router=express[_0x955b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x955b('0x6'));var interaction=require(_0x955b('0x7'));var config=require(_0x955b('0x8'));var controller=require('./cmContact.controller');router['get']('/',auth[_0x955b('0x9')](),controller[_0x955b('0xa')]);router[_0x955b('0xb')](_0x955b('0xc'),auth['isAuthenticated'](),controller[_0x955b('0xd')]);router[_0x955b('0xb')]('/:id',auth[_0x955b('0x9')](),controller[_0x955b('0xe')]);router[_0x955b('0xb')](_0x955b('0xf'),auth['isAuthenticated'](),controller['getTags']);router[_0x955b('0xb')](_0x955b('0x10'),auth[_0x955b('0x9')](),controller[_0x955b('0x11')]);router[_0x955b('0xb')](_0x955b('0x12'),auth[_0x955b('0x9')](),controller[_0x955b('0x13')]);router[_0x955b('0xb')](_0x955b('0x14'),auth[_0x955b('0x9')](),controller['getHopperFinals']);router[_0x955b('0xb')](_0x955b('0x15'),auth[_0x955b('0x9')](),controller[_0x955b('0x16')]);router[_0x955b('0xb')](_0x955b('0x17'),auth[_0x955b('0x9')](),controller[_0x955b('0x18')]);router['post'](_0x955b('0x19'),auth['isAuthenticated'](),controller[_0x955b('0x1a')]);router[_0x955b('0x1b')]('/',auth[_0x955b('0x9')](),controller[_0x955b('0x1c')]);router[_0x955b('0x1b')](_0x955b('0x1d'),auth['isAuthenticated'](),controller[_0x955b('0x1e')]);router['post'](_0x955b('0xf'),auth[_0x955b('0x9')](),controller[_0x955b('0x1f')]);var upload=multer({'storage':multer[_0x955b('0x20')]({'destination':function(_0x393fdd,_0x36eea2,_0x11f0d9){_0x11f0d9(null,path['join'](config['root'],'server/files/tmp'));},'filename':function(_0xfecb72,_0x557afb,_0x4ba37b){_0x557afb[_0x955b('0x21')]=_0x557afb['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4ba37b(null,util['format'](_0x955b('0x22'),path['basename'](_0x557afb[_0x955b('0x21')],path[_0x955b('0x23')](_0x557afb[_0x955b('0x21')])),Date[_0x955b('0x24')](),path['extname'](_0x557afb['originalname'])));}})});router[_0x955b('0x1b')](_0x955b('0x25'),upload[_0x955b('0x26')]('file'),controller[_0x955b('0x27')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x160904,_0x4c93af,_0x1a4f17){_0x1a4f17(null,path[_0x955b('0x28')](config[_0x955b('0x29')],_0x955b('0x2a')));},'filename':function(_0x244e9f,_0x38dff0,_0x1eef97){_0x38dff0['originalname']=_0x38dff0[_0x955b('0x21')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1eef97(null,util['format'](_0x955b('0x22'),path['basename'](_0x38dff0[_0x955b('0x21')],path['extname'](_0x38dff0['originalname'])),Date[_0x955b('0x24')](),path[_0x955b('0x23')](_0x38dff0[_0x955b('0x21')])));}})});router[_0x955b('0x1b')](_0x955b('0x2b'),upload[_0x955b('0x26')](_0x955b('0x2c')),controller[_0x955b('0x2d')]);router['post'](_0x955b('0x2e'),auth['isAuthenticated'](),controller[_0x955b('0x2f')]);router['put'](_0x955b('0x30'),auth[_0x955b('0x9')](),controller[_0x955b('0x31')]);router[_0x955b('0x32')](_0x955b('0x30'),auth[_0x955b('0x9')](),controller['destroy']);module[_0x955b('0x33')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 30b3459..5fa7c6a 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 _0x6214=['select','parse','values','isArray','setDataValue','BOOLEAN','ENUM','voice','sequelize','lodash','exports','getDataValue','STRING','alias','name','TEXT','type'];(function(_0x163b12,_0x1662cc){var _0x4df80b=function(_0x3fd649){while(--_0x3fd649){_0x163b12['push'](_0x163b12['shift']());}};_0x4df80b(++_0x1662cc);}(_0x6214,0x129));var _0x4621=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x6214[_0x231e16];return _0x570a7c;};'use strict';var Sequelize=require(_0x4621('0x0'));var _=require(_0x4621('0x1'));module[_0x4621('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2aa805){return this[_0x4621('0x3')]('alias');}},'alias':{'type':Sequelize[_0x4621('0x4')],'allowNull':![],'set':function(_0x54abac){this['setDataValue'](_0x4621('0x5'),_0x54abac?_0x54abac:this[_0x4621('0x3')](_0x4621('0x6')));}},'type':{'type':Sequelize[_0x4621('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x4621('0x7')]('long'),'get':function(){if(this['getDataValue'](_0x4621('0x8'))===_0x4621('0x9')){return JSON[_0x4621('0xa')](this[_0x4621('0x3')](_0x4621('0xb')));}else{return this[_0x4621('0x3')]('values');}},'set':function(_0x304123){if(Array[_0x4621('0xc')](_0x304123)){this[_0x4621('0xd')](_0x4621('0xb'),JSON['stringify'](_0x304123));}else{this[_0x4621('0xd')]('values',_0x304123);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x4621('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x4621('0xf')](_0x4621('0x10'))}}; \ No newline at end of file +var _0x6eee=['exports','getDataValue','alias','setDataValue','STRING','TEXT','long','type','select','values','isArray','BOOLEAN','ENUM','voice','lodash'];(function(_0x1db251,_0xf0443d){var _0x56685a=function(_0x6ec6b7){while(--_0x6ec6b7){_0x1db251['push'](_0x1db251['shift']());}};_0x56685a(++_0xf0443d);}(_0x6eee,0x194));var _0xe6ee=function(_0x4a51c3,_0x52ef57){_0x4a51c3=_0x4a51c3-0x0;var _0x5ea2bb=_0x6eee[_0x4a51c3];return _0x5ea2bb;};'use strict';var Sequelize=require('sequelize');var _=require(_0xe6ee('0x0'));module[_0xe6ee('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x22795f){return this[_0xe6ee('0x2')](_0xe6ee('0x3'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x43e93d){this[_0xe6ee('0x4')](_0xe6ee('0x3'),_0x43e93d?_0x43e93d:this[_0xe6ee('0x2')]('name'));}},'type':{'type':Sequelize[_0xe6ee('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xe6ee('0x6')](_0xe6ee('0x7')),'get':function(){if(this['getDataValue'](_0xe6ee('0x8'))===_0xe6ee('0x9')){return JSON['parse'](this[_0xe6ee('0x2')](_0xe6ee('0xa')));}else{return this[_0xe6ee('0x2')](_0xe6ee('0xa'));}},'set':function(_0x4e6200){if(Array[_0xe6ee('0xb')](_0x4e6200)){this[_0xe6ee('0x4')](_0xe6ee('0xa'),JSON['stringify'](_0x4e6200));}else{this[_0xe6ee('0x4')]('values',_0x4e6200);}}},'required':{'type':Sequelize[_0xe6ee('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xe6ee('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xe6ee('0xd')](_0xe6ee('0xe'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 36f1b16..1977d9f 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 _0x8d85=['TEXT','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','format','cf_%d','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','save','then','destroy','error','stack','name','send','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','keys','filters','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','intersection','find','catch','update','body','params','create','transaction','Sequelize'];(function(_0x2f7e3a,_0x489379){var _0x47d542=function(_0xaba3cf){while(--_0xaba3cf){_0x2f7e3a['push'](_0x2f7e3a['shift']());}};_0x47d542(++_0x489379);}(_0x8d85,0x171));var _0x58d8=function(_0x432643,_0x3ccc57){_0x432643=_0x432643-0x0;var _0xfdd9da=_0x8d85[_0x432643];return _0xfdd9da;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x58d8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x58d8('0x1'));var rp=require(_0x58d8('0x2'));var moment=require(_0x58d8('0x3'));var BPromise=require(_0x58d8('0x4'));var Mustache=require(_0x58d8('0x5'));var util=require(_0x58d8('0x6'));var path=require(_0x58d8('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x58d8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x58d8('0x9'));var squel=require(_0x58d8('0xa'));var crypto=require(_0x58d8('0xb'));var jsforce=require(_0x58d8('0xc'));var deskjs=require(_0x58d8('0xd'));var toCsv=require(_0x58d8('0xe'));var querystring=require(_0x58d8('0xf'));var Papa=require(_0x58d8('0x10'));var Redis=require(_0x58d8('0x11'));var authService=require(_0x58d8('0x12'));var qs=require(_0x58d8('0x13'));var as=require(_0x58d8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x58d8('0x15'))(_0x58d8('0x16'));var utils=require(_0x58d8('0x17'));var config=require(_0x58d8('0x18'));var licenseUtil=require(_0x58d8('0x19'));var db=require(_0x58d8('0x1a'))['db'];function respondWithStatusCode(_0x17fc3c,_0x401b57){_0x401b57=_0x401b57||0xcc;return function(_0x43513d){if(_0x43513d){return _0x17fc3c[_0x58d8('0x1b')](_0x401b57);}return _0x17fc3c[_0x58d8('0x1c')](_0x401b57)[_0x58d8('0x1d')]();};}function respondWithResult(_0xc42c9f,_0x383521){_0x383521=_0x383521||0xc8;return function(_0x193c56){if(_0x193c56){return _0xc42c9f[_0x58d8('0x1c')](_0x383521)[_0x58d8('0x1e')](_0x193c56);}};}function respondWithFilteredResult(_0x515740,_0x184f8e){return function(_0x158d00){if(_0x158d00){var _0x17b3f7=typeof _0x184f8e['offset']===_0x58d8('0x1f')&&typeof _0x184f8e[_0x58d8('0x20')]==='undefined';var _0x2f342b=_0x158d00['count'];var _0x414bb7=_0x17b3f7?0x0:_0x184f8e[_0x58d8('0x21')];var _0x117412=_0x17b3f7?_0x158d00['count']:_0x184f8e[_0x58d8('0x21')]+_0x184f8e[_0x58d8('0x20')];var _0xa978e7;if(_0x117412>=_0x2f342b){_0x117412=_0x2f342b;_0xa978e7=0xc8;}else{_0xa978e7=0xce;}_0x515740[_0x58d8('0x1c')](_0xa978e7);return _0x515740[_0x58d8('0x22')](_0x58d8('0x23'),_0x414bb7+'-'+_0x117412+'/'+_0x2f342b)[_0x58d8('0x1e')](_0x158d00);}return null;};}function patchUpdates(_0x20a8ce){return function(_0x122cd9){try{jsonpatch['apply'](_0x122cd9,_0x20a8ce,!![]);}catch(_0x271746){return BPromise['reject'](_0x271746);}return _0x122cd9[_0x58d8('0x24')]();};}function saveUpdates(_0x3c44d5,_0xaa4213){return function(_0x427769){if(_0x427769){return _0x427769['update'](_0x3c44d5)[_0x58d8('0x25')](function(_0x4893c7){return _0x4893c7;});}return null;};}function removeEntity(_0x559f1e,_0x375fd1){return function(_0x37a232){if(_0x37a232){return _0x37a232[_0x58d8('0x26')]()[_0x58d8('0x25')](function(){_0x559f1e[_0x58d8('0x1c')](0xcc)[_0x58d8('0x1d')]();});}};}function handleEntityNotFound(_0x30104b,_0x5220b0){return function(_0x1a7f58){if(!_0x1a7f58){_0x30104b['sendStatus'](0x194);}return _0x1a7f58;};}function handleError(_0x2e903e,_0x18e6f8){_0x18e6f8=_0x18e6f8||0x1f4;return function(_0x49827c){logger[_0x58d8('0x27')](_0x49827c[_0x58d8('0x28')]);if(_0x49827c[_0x58d8('0x29')]){delete _0x49827c[_0x58d8('0x29')];}_0x2e903e[_0x58d8('0x1c')](_0x18e6f8)[_0x58d8('0x2a')](_0x49827c);};}exports['index']=function(_0x2e8bcf,_0x1d77e7){var _0x10a8eb={},_0x554cda={},_0x70bb77={'count':0x0,'rows':[]};var _0x3dd2a0=_[_0x58d8('0x2b')](db[_0x58d8('0x2c')][_0x58d8('0x2d')],function(_0x4f8bc7){return{'name':_0x4f8bc7[_0x58d8('0x2e')],'type':_0x4f8bc7[_0x58d8('0x2f')][_0x58d8('0x30')]};});_0x554cda[_0x58d8('0x31')]=_[_0x58d8('0x32')](_[_0x58d8('0x2b')](_0x3dd2a0,_0x58d8('0x29')),[_0x58d8('0x29')]);_0x554cda['query']=_[_0x58d8('0x33')](_0x2e8bcf['query']);_0x554cda[_0x58d8('0x34')]=_['intersection'](_0x554cda['model'],_0x554cda[_0x58d8('0x35')]);_0x10a8eb[_0x58d8('0x36')]=_['intersection'](_0x554cda[_0x58d8('0x31')],qs['fields'](_0x2e8bcf[_0x58d8('0x35')][_0x58d8('0x37')]));_0x10a8eb[_0x58d8('0x36')]=_0x10a8eb[_0x58d8('0x36')][_0x58d8('0x38')]?_0x10a8eb['attributes']:_0x554cda[_0x58d8('0x31')];if(!_0x2e8bcf[_0x58d8('0x35')][_0x58d8('0x39')](_0x58d8('0x3a'))){_0x10a8eb[_0x58d8('0x20')]=qs[_0x58d8('0x20')](_0x2e8bcf[_0x58d8('0x35')][_0x58d8('0x20')]);_0x10a8eb[_0x58d8('0x21')]=qs['offset'](_0x2e8bcf[_0x58d8('0x35')]['offset']);}_0x10a8eb[_0x58d8('0x3b')]=qs[_0x58d8('0x3c')](_0x2e8bcf[_0x58d8('0x35')][_0x58d8('0x3c')]);_0x10a8eb[_0x58d8('0x3d')]=qs['filters'](_[_0x58d8('0x3e')](_0x2e8bcf[_0x58d8('0x35')],_0x554cda[_0x58d8('0x34')]),_0x3dd2a0);if(_0x2e8bcf[_0x58d8('0x35')]['filter']){_0x10a8eb[_0x58d8('0x3d')]=_[_0x58d8('0x3f')](_0x10a8eb[_0x58d8('0x3d')],{'$or':_['map'](_0x3dd2a0,function(_0x4f701b){if(_0x4f701b[_0x58d8('0x2f')]!==_0x58d8('0x40')){var _0x36380f={};_0x36380f[_0x4f701b['name']]={'$like':'%'+_0x2e8bcf[_0x58d8('0x35')][_0x58d8('0x41')]+'%'};return _0x36380f;}})});}_0x10a8eb=_[_0x58d8('0x3f')]({},_0x10a8eb,_0x2e8bcf[_0x58d8('0x42')]);var _0x51b426={'where':_0x10a8eb[_0x58d8('0x3d')]};return db[_0x58d8('0x2c')][_0x58d8('0x43')](_0x51b426)[_0x58d8('0x25')](function(_0x2f8deb){_0x70bb77[_0x58d8('0x43')]=_0x2f8deb;if(_0x2e8bcf[_0x58d8('0x35')][_0x58d8('0x44')]){_0x10a8eb[_0x58d8('0x45')]=[{'all':!![]}];}return db['CmCustomField'][_0x58d8('0x46')](_0x10a8eb);})[_0x58d8('0x25')](function(_0x1d0abf){_0x70bb77[_0x58d8('0x47')]=_0x1d0abf;return _0x70bb77;})[_0x58d8('0x25')](respondWithFilteredResult(_0x1d77e7,_0x10a8eb))['catch'](handleError(_0x1d77e7,null));};exports['show']=function(_0x1939dd,_0x21f3cb){var _0x355fa1={'raw':!![],'where':{'id':_0x1939dd['params']['id']}},_0x176b87={};_0x176b87[_0x58d8('0x31')]=_['keys'](db[_0x58d8('0x2c')][_0x58d8('0x2d')]);_0x176b87[_0x58d8('0x35')]=_[_0x58d8('0x33')](_0x1939dd['query']);_0x176b87[_0x58d8('0x34')]=_[_0x58d8('0x48')](_0x176b87[_0x58d8('0x31')],_0x176b87[_0x58d8('0x35')]);_0x355fa1['attributes']=_[_0x58d8('0x48')](_0x176b87['model'],qs['fields'](_0x1939dd['query']['fields']));_0x355fa1[_0x58d8('0x36')]=_0x355fa1[_0x58d8('0x36')][_0x58d8('0x38')]?_0x355fa1[_0x58d8('0x36')]:_0x176b87[_0x58d8('0x31')];if(_0x1939dd[_0x58d8('0x35')][_0x58d8('0x44')]){_0x355fa1[_0x58d8('0x45')]=[{'all':!![]}];}_0x355fa1=_[_0x58d8('0x3f')]({},_0x355fa1,_0x1939dd[_0x58d8('0x42')]);return db[_0x58d8('0x2c')][_0x58d8('0x49')](_0x355fa1)['then'](handleEntityNotFound(_0x21f3cb,null))[_0x58d8('0x25')](respondWithResult(_0x21f3cb,null))[_0x58d8('0x4a')](handleError(_0x21f3cb,null));};exports[_0x58d8('0x4b')]=function(_0x438c63,_0x553a3f){if(_0x438c63[_0x58d8('0x4c')]['id']){delete _0x438c63['body']['id'];}return db[_0x58d8('0x2c')][_0x58d8('0x49')]({'where':{'id':_0x438c63['params']['id']}})[_0x58d8('0x25')](handleEntityNotFound(_0x553a3f,null))[_0x58d8('0x25')](saveUpdates(_0x438c63[_0x58d8('0x4c')],null))[_0x58d8('0x25')](respondWithResult(_0x553a3f,null))[_0x58d8('0x4a')](handleError(_0x553a3f,null));};exports[_0x58d8('0x26')]=function(_0x558162,_0xf19e51){return db[_0x58d8('0x2c')][_0x58d8('0x49')]({'where':{'id':_0x558162[_0x58d8('0x4d')]['id']}})[_0x58d8('0x25')](handleEntityNotFound(_0xf19e51,null))[_0x58d8('0x25')](removeEntity(_0xf19e51,null))['catch'](handleError(_0xf19e51,null));};exports[_0x58d8('0x4e')]=function(_0x115072,_0x5e8d4e){var _0x5ccf71;return db['sequelize'][_0x58d8('0x4f')](function(_0x126b1e){return db['CmCustomField'][_0x58d8('0x4e')](_0x115072[_0x58d8('0x4c')],{'transaction':_0x126b1e})[_0x58d8('0x25')](function(_0x2d5c3c){_0x5ccf71=_0x2d5c3c;var _0x5556a9={'type':db[_0x58d8('0x50')][_0x58d8('0x51')],'transaction':_0x126b1e};switch(_0x115072[_0x58d8('0x4c')][_0x58d8('0x2f')]){case'text':_0x5556a9[_0x58d8('0x2f')]=db[_0x58d8('0x50')]['TEXT'];break;case _0x58d8('0x52'):_0x5556a9['type']=db[_0x58d8('0x50')][_0x58d8('0x53')];break;case'switch':_0x5556a9[_0x58d8('0x2f')]=db[_0x58d8('0x50')][_0x58d8('0x54')];_0x5556a9[_0x58d8('0x55')]=![];break;default:}return db['sequelize'][_0x58d8('0x56')][_0x58d8('0x57')]('cm_contacts',util[_0x58d8('0x58')](_0x58d8('0x59'),_0x5ccf71['id']),_0x5556a9);})['then'](function(){return _0x5ccf71;});})[_0x58d8('0x25')](respondWithResult(_0x5e8d4e,0xc9))[_0x58d8('0x4a')](handleError(_0x5e8d4e,null));}; \ No newline at end of file +var _0x0fab=['../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','destroy','then','sendStatus','error','name','send','index','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','find','catch','update','body','create','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','sequelize','queryInterface','cm_contacts','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils'];(function(_0x3dd859,_0x517308){var _0x3f38e3=function(_0x553cbd){while(--_0x553cbd){_0x3dd859['push'](_0x3dd859['shift']());}};_0x3f38e3(++_0x517308);}(_0x0fab,0x145));var _0xb0fa=function(_0x209880,_0x33aae7){_0x209880=_0x209880-0x0;var _0x477139=_0x0fab[_0x209880];return _0x477139;};'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(_0xb0fa('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xb0fa('0x9'));var ejs=require(_0xb0fa('0xa'));var fs=require('fs');var fs_extra=require(_0xb0fa('0xb'));var _=require(_0xb0fa('0xc'));var squel=require(_0xb0fa('0xd'));var crypto=require(_0xb0fa('0xe'));var jsforce=require(_0xb0fa('0xf'));var deskjs=require(_0xb0fa('0x10'));var toCsv=require(_0xb0fa('0x9'));var querystring=require('querystring');var Papa=require(_0xb0fa('0x11'));var Redis=require('ioredis');var authService=require(_0xb0fa('0x12'));var qs=require(_0xb0fa('0x13'));var as=require(_0xb0fa('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb0fa('0x15'))('api');var utils=require(_0xb0fa('0x16'));var config=require(_0xb0fa('0x17'));var licenseUtil=require(_0xb0fa('0x18'));var db=require(_0xb0fa('0x19'))['db'];function respondWithStatusCode(_0x3fe4be,_0x464cdf){_0x464cdf=_0x464cdf||0xcc;return function(_0x58a9de){if(_0x58a9de){return _0x3fe4be['sendStatus'](_0x464cdf);}return _0x3fe4be[_0xb0fa('0x1a')](_0x464cdf)[_0xb0fa('0x1b')]();};}function respondWithResult(_0x45cd7d,_0x330d86){_0x330d86=_0x330d86||0xc8;return function(_0x5f3f7f){if(_0x5f3f7f){return _0x45cd7d[_0xb0fa('0x1a')](_0x330d86)['json'](_0x5f3f7f);}};}function respondWithFilteredResult(_0x1d01d9,_0x3bb8b0){return function(_0x5978c1){if(_0x5978c1){var _0x5dad9b=typeof _0x3bb8b0[_0xb0fa('0x1c')]===_0xb0fa('0x1d')&&typeof _0x3bb8b0[_0xb0fa('0x1e')]===_0xb0fa('0x1d');var _0x3fbcc6=_0x5978c1[_0xb0fa('0x1f')];var _0x91be19=_0x5dad9b?0x0:_0x3bb8b0[_0xb0fa('0x1c')];var _0x240261=_0x5dad9b?_0x5978c1[_0xb0fa('0x1f')]:_0x3bb8b0[_0xb0fa('0x1c')]+_0x3bb8b0[_0xb0fa('0x1e')];var _0x4d10aa;if(_0x240261>=_0x3fbcc6){_0x240261=_0x3fbcc6;_0x4d10aa=0xc8;}else{_0x4d10aa=0xce;}_0x1d01d9[_0xb0fa('0x1a')](_0x4d10aa);return _0x1d01d9[_0xb0fa('0x20')](_0xb0fa('0x21'),_0x91be19+'-'+_0x240261+'/'+_0x3fbcc6)[_0xb0fa('0x22')](_0x5978c1);}return null;};}function patchUpdates(_0x805927){return function(_0x10ef5a){try{jsonpatch[_0xb0fa('0x23')](_0x10ef5a,_0x805927,!![]);}catch(_0x531924){return BPromise['reject'](_0x531924);}return _0x10ef5a['save']();};}function saveUpdates(_0x5f5af2,_0x41e455){return function(_0x5cdc4c){if(_0x5cdc4c){return _0x5cdc4c['update'](_0x5f5af2)['then'](function(_0x50b793){return _0x50b793;});}return null;};}function removeEntity(_0x500c9b,_0x2f7f54){return function(_0xdcef13){if(_0xdcef13){return _0xdcef13[_0xb0fa('0x24')]()[_0xb0fa('0x25')](function(){_0x500c9b[_0xb0fa('0x1a')](0xcc)[_0xb0fa('0x1b')]();});}};}function handleEntityNotFound(_0x45040d,_0x31d076){return function(_0x52ba6a){if(!_0x52ba6a){_0x45040d[_0xb0fa('0x26')](0x194);}return _0x52ba6a;};}function handleError(_0x36dc12,_0x26b1dd){_0x26b1dd=_0x26b1dd||0x1f4;return function(_0x98ae20){logger[_0xb0fa('0x27')](_0x98ae20['stack']);if(_0x98ae20['name']){delete _0x98ae20[_0xb0fa('0x28')];}_0x36dc12[_0xb0fa('0x1a')](_0x26b1dd)[_0xb0fa('0x29')](_0x98ae20);};}exports[_0xb0fa('0x2a')]=function(_0x183692,_0x49d40f){var _0x533aae={},_0x1f92f5={},_0x4bb557={'count':0x0,'rows':[]};var _0x26d911=_['map'](db[_0xb0fa('0x2b')][_0xb0fa('0x2c')],function(_0x454087){return{'name':_0x454087[_0xb0fa('0x2d')],'type':_0x454087[_0xb0fa('0x2e')]['key']};});_0x1f92f5[_0xb0fa('0x2f')]=_[_0xb0fa('0x30')](_[_0xb0fa('0x31')](_0x26d911,_0xb0fa('0x28')),[_0xb0fa('0x28')]);_0x1f92f5[_0xb0fa('0x32')]=_['keys'](_0x183692[_0xb0fa('0x32')]);_0x1f92f5[_0xb0fa('0x33')]=_[_0xb0fa('0x34')](_0x1f92f5['model'],_0x1f92f5['query']);_0x533aae[_0xb0fa('0x35')]=_['intersection'](_0x1f92f5[_0xb0fa('0x2f')],qs[_0xb0fa('0x36')](_0x183692['query']['fields']));_0x533aae[_0xb0fa('0x35')]=_0x533aae['attributes'][_0xb0fa('0x37')]?_0x533aae['attributes']:_0x1f92f5[_0xb0fa('0x2f')];if(!_0x183692[_0xb0fa('0x32')][_0xb0fa('0x38')](_0xb0fa('0x39'))){_0x533aae[_0xb0fa('0x1e')]=qs[_0xb0fa('0x1e')](_0x183692['query'][_0xb0fa('0x1e')]);_0x533aae[_0xb0fa('0x1c')]=qs[_0xb0fa('0x1c')](_0x183692[_0xb0fa('0x32')][_0xb0fa('0x1c')]);}_0x533aae[_0xb0fa('0x3a')]=qs[_0xb0fa('0x3b')](_0x183692['query']['sort']);_0x533aae['where']=qs[_0xb0fa('0x33')](_[_0xb0fa('0x3c')](_0x183692[_0xb0fa('0x32')],_0x1f92f5[_0xb0fa('0x33')]),_0x26d911);if(_0x183692[_0xb0fa('0x32')][_0xb0fa('0x3d')]){_0x533aae[_0xb0fa('0x3e')]=_[_0xb0fa('0x3f')](_0x533aae[_0xb0fa('0x3e')],{'$or':_[_0xb0fa('0x31')](_0x26d911,function(_0x170873){if(_0x170873[_0xb0fa('0x2e')]!==_0xb0fa('0x40')){var _0xfc00d4={};_0xfc00d4[_0x170873['name']]={'$like':'%'+_0x183692[_0xb0fa('0x32')][_0xb0fa('0x3d')]+'%'};return _0xfc00d4;}})});}_0x533aae=_['merge']({},_0x533aae,_0x183692['options']);var _0x298688={'where':_0x533aae[_0xb0fa('0x3e')]};return db[_0xb0fa('0x2b')]['count'](_0x298688)[_0xb0fa('0x25')](function(_0x281007){_0x4bb557[_0xb0fa('0x1f')]=_0x281007;if(_0x183692[_0xb0fa('0x32')][_0xb0fa('0x41')]){_0x533aae[_0xb0fa('0x42')]=[{'all':!![]}];}return db['CmCustomField'][_0xb0fa('0x43')](_0x533aae);})['then'](function(_0x4605a1){_0x4bb557[_0xb0fa('0x44')]=_0x4605a1;return _0x4bb557;})[_0xb0fa('0x25')](respondWithFilteredResult(_0x49d40f,_0x533aae))['catch'](handleError(_0x49d40f,null));};exports[_0xb0fa('0x45')]=function(_0x8de17f,_0x21408a){var _0x21b78e={'raw':!![],'where':{'id':_0x8de17f[_0xb0fa('0x46')]['id']}},_0x5dc2ac={};_0x5dc2ac[_0xb0fa('0x2f')]=_['keys'](db['CmCustomField']['rawAttributes']);_0x5dc2ac['query']=_[_0xb0fa('0x47')](_0x8de17f[_0xb0fa('0x32')]);_0x5dc2ac[_0xb0fa('0x33')]=_[_0xb0fa('0x34')](_0x5dc2ac[_0xb0fa('0x2f')],_0x5dc2ac['query']);_0x21b78e[_0xb0fa('0x35')]=_[_0xb0fa('0x34')](_0x5dc2ac[_0xb0fa('0x2f')],qs['fields'](_0x8de17f[_0xb0fa('0x32')][_0xb0fa('0x36')]));_0x21b78e['attributes']=_0x21b78e[_0xb0fa('0x35')][_0xb0fa('0x37')]?_0x21b78e['attributes']:_0x5dc2ac[_0xb0fa('0x2f')];if(_0x8de17f['query'][_0xb0fa('0x41')]){_0x21b78e[_0xb0fa('0x42')]=[{'all':!![]}];}_0x21b78e=_[_0xb0fa('0x3f')]({},_0x21b78e,_0x8de17f['options']);return db['CmCustomField'][_0xb0fa('0x48')](_0x21b78e)[_0xb0fa('0x25')](handleEntityNotFound(_0x21408a,null))['then'](respondWithResult(_0x21408a,null))[_0xb0fa('0x49')](handleError(_0x21408a,null));};exports[_0xb0fa('0x4a')]=function(_0x31555d,_0x59af17){if(_0x31555d['body']['id']){delete _0x31555d[_0xb0fa('0x4b')]['id'];}return db[_0xb0fa('0x2b')][_0xb0fa('0x48')]({'where':{'id':_0x31555d[_0xb0fa('0x46')]['id']}})[_0xb0fa('0x25')](handleEntityNotFound(_0x59af17,null))[_0xb0fa('0x25')](saveUpdates(_0x31555d[_0xb0fa('0x4b')],null))[_0xb0fa('0x25')](respondWithResult(_0x59af17,null))[_0xb0fa('0x49')](handleError(_0x59af17,null));};exports[_0xb0fa('0x24')]=function(_0x4a61a8,_0x4df738){return db[_0xb0fa('0x2b')]['find']({'where':{'id':_0x4a61a8[_0xb0fa('0x46')]['id']}})[_0xb0fa('0x25')](handleEntityNotFound(_0x4df738,null))[_0xb0fa('0x25')](removeEntity(_0x4df738,null))[_0xb0fa('0x49')](handleError(_0x4df738,null));};exports[_0xb0fa('0x4c')]=function(_0x16d847,_0x21c552){var _0x32ce60;return db['sequelize']['transaction'](function(_0x44ce75){return db[_0xb0fa('0x2b')][_0xb0fa('0x4c')](_0x16d847[_0xb0fa('0x4b')],{'transaction':_0x44ce75})[_0xb0fa('0x25')](function(_0x45ef01){_0x32ce60=_0x45ef01;var _0x178c7b={'type':db[_0xb0fa('0x4d')][_0xb0fa('0x4e')],'transaction':_0x44ce75};switch(_0x16d847['body']['type']){case'text':_0x178c7b[_0xb0fa('0x2e')]=db[_0xb0fa('0x4d')][_0xb0fa('0x4e')];break;case _0xb0fa('0x4f'):_0x178c7b['type']=db[_0xb0fa('0x4d')][_0xb0fa('0x50')];break;case _0xb0fa('0x51'):_0x178c7b['type']=db['Sequelize'][_0xb0fa('0x52')];_0x178c7b['defaultValue']=![];break;default:}return db[_0xb0fa('0x53')][_0xb0fa('0x54')]['addColumn'](_0xb0fa('0x55'),util[_0xb0fa('0x56')]('cf_%d',_0x32ce60['id']),_0x178c7b);})[_0xb0fa('0x25')](function(){return _0x32ce60;});})['then'](respondWithResult(_0x21c552,0xc9))[_0xb0fa('0x49')](handleError(_0x21c552,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 06201a8..d1cbdec 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 _0xcedd=['api','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','define','CmCustomField','cm_custom_fields','lodash','../../config/logger'];(function(_0x42bcbd,_0x4b88f9){var _0x483e5d=function(_0x5bdeb3){while(--_0x5bdeb3){_0x42bcbd['push'](_0x42bcbd['shift']());}};_0x483e5d(++_0x4b88f9);}(_0xcedd,0x136));var _0xdced=function(_0x110e60,_0x225a8a){_0x110e60=_0x110e60-0x0;var _0x24fe45=_0xcedd[_0x110e60];return _0x24fe45;};'use strict';var _=require(_0xdced('0x0'));var util=require('util');var logger=require(_0xdced('0x1'))(_0xdced('0x2'));var moment=require('moment');var BPromise=require(_0xdced('0x3'));var rp=require(_0xdced('0x4'));var fs=require('fs');var path=require(_0xdced('0x5'));var rimraf=require(_0xdced('0x6'));var config=require(_0xdced('0x7'));var attributes=require(_0xdced('0x8'));module['exports']=function(_0x25b270,_0x2a404b){return _0x25b270[_0xdced('0x9')](_0xdced('0xa'),attributes,{'tableName':_0xdced('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4656=['util','api','moment','bluebird','request-promise','path','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','lodash'];(function(_0x55ff21,_0x1540f0){var _0x4baf37=function(_0x51128b){while(--_0x51128b){_0x55ff21['push'](_0x55ff21['shift']());}};_0x4baf37(++_0x1540f0);}(_0x4656,0x12b));var _0x6465=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4656[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x6465('0x0'));var util=require(_0x6465('0x1'));var logger=require('../../config/logger')(_0x6465('0x2'));var moment=require(_0x6465('0x3'));var BPromise=require(_0x6465('0x4'));var rp=require(_0x6465('0x5'));var fs=require('fs');var path=require(_0x6465('0x6'));var rimraf=require('rimraf');var config=require(_0x6465('0x7'));var attributes=require(_0x6465('0x8'));module[_0x6465('0x9')]=function(_0x296701,_0x1198de){return _0x296701[_0x6465('0xa')](_0x6465('0xb'),attributes,{'tableName':'cm_custom_fields','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 dd34bb4..a4701c4 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 _0xf794=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf794,0x154));var _0x4f79=function(_0x349e5c,_0x2d4b99){_0x349e5c=_0x349e5c-0x0;var _0x260127=_0xf794[_0x349e5c];return _0x260127;};'use strict';var _=require(_0x4f79('0x0'));var util=require(_0x4f79('0x1'));var moment=require(_0x4f79('0x2'));var BPromise=require(_0x4f79('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f79('0x4'));var db=require(_0x4f79('0x5'))['db'];var utils=require(_0x4f79('0x6'));var logger=require(_0x4f79('0x7'))(_0x4f79('0x8'));var config=require(_0x4f79('0x9'));var jayson=require(_0x4f79('0xa'));var client=jayson[_0x4f79('0xb')][_0x4f79('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4fc1a2,_0x13d113,_0x1a98a4){return new BPromise(function(_0x3e4c88,_0x54aba4){return client[_0x4f79('0xd')](_0x4fc1a2,_0x1a98a4)[_0x4f79('0xe')](function(_0xc4ec5d){logger[_0x4f79('0xf')](_0x4f79('0x10'),_0x13d113,'request\x20sent');logger[_0x4f79('0x11')](_0x4f79('0x12'),_0x13d113,'request\x20sent',JSON[_0x4f79('0x13')](_0xc4ec5d));if(_0xc4ec5d[_0x4f79('0x14')]){if(_0xc4ec5d[_0x4f79('0x14')][_0x4f79('0x15')]===0x1f4){logger[_0x4f79('0x14')](_0x4f79('0x10'),_0x13d113,_0xc4ec5d[_0x4f79('0x14')][_0x4f79('0x16')]);return _0x54aba4(_0xc4ec5d[_0x4f79('0x14')][_0x4f79('0x16')]);}logger[_0x4f79('0x14')]('CmCustomField,\x20%s,\x20%s',_0x13d113,_0xc4ec5d[_0x4f79('0x14')]['message']);return _0x3e4c88(_0xc4ec5d['error']['message']);}else{logger['info'](_0x4f79('0x10'),_0x13d113,_0x4f79('0x17'));_0x3e4c88(_0xc4ec5d[_0x4f79('0x18')][_0x4f79('0x16')]);}})[_0x4f79('0x19')](function(_0x2dc120){logger[_0x4f79('0x14')](_0x4f79('0x10'),_0x13d113,_0x2dc120);_0x54aba4(_0x2dc120);});});} \ No newline at end of file +var _0xfa80=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x3f725a,_0x179f98){var _0x552e80=function(_0x1f2b46){while(--_0x1f2b46){_0x3f725a['push'](_0x3f725a['shift']());}};_0x552e80(++_0x179f98);}(_0xfa80,0xde));var _0x0fa8=function(_0x22d0bd,_0x40a1fc){_0x22d0bd=_0x22d0bd-0x0;var _0x4c1830=_0xfa80[_0x22d0bd];return _0x4c1830;};'use strict';var _=require(_0x0fa8('0x0'));var util=require(_0x0fa8('0x1'));var moment=require(_0x0fa8('0x2'));var BPromise=require(_0x0fa8('0x3'));var rs=require(_0x0fa8('0x4'));var fs=require('fs');var Redis=require(_0x0fa8('0x5'));var db=require(_0x0fa8('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0fa8('0x7'));var config=require(_0x0fa8('0x8'));var jayson=require(_0x0fa8('0x9'));var client=jayson[_0x0fa8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53f7be,_0x1fc966,_0x96c168){return new BPromise(function(_0x5dfba0,_0x24e463){return client[_0x0fa8('0xb')](_0x53f7be,_0x96c168)['then'](function(_0x34a8bd){logger[_0x0fa8('0xc')](_0x0fa8('0xd'),_0x1fc966,_0x0fa8('0xe'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x1fc966,'request\x20sent',JSON['stringify'](_0x34a8bd));if(_0x34a8bd[_0x0fa8('0xf')]){if(_0x34a8bd[_0x0fa8('0xf')][_0x0fa8('0x10')]===0x1f4){logger['error'](_0x0fa8('0xd'),_0x1fc966,_0x34a8bd[_0x0fa8('0xf')][_0x0fa8('0x11')]);return _0x24e463(_0x34a8bd[_0x0fa8('0xf')][_0x0fa8('0x11')]);}logger['error'](_0x0fa8('0xd'),_0x1fc966,_0x34a8bd[_0x0fa8('0xf')][_0x0fa8('0x11')]);return _0x5dfba0(_0x34a8bd[_0x0fa8('0xf')][_0x0fa8('0x11')]);}else{logger[_0x0fa8('0xc')](_0x0fa8('0xd'),_0x1fc966,_0x0fa8('0xe'));_0x5dfba0(_0x34a8bd[_0x0fa8('0x12')]['message']);}})[_0x0fa8('0x13')](function(_0x47a18b){logger[_0x0fa8('0xf')](_0x0fa8('0xd'),_0x1fc966,_0x47a18b);_0x24e463(_0x47a18b);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index ee9a285..19c5d5e 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 _0xaf79=['/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get'];(function(_0x3526ff,_0x5c5870){var _0x4b995f=function(_0x4dece6){while(--_0x4dece6){_0x3526ff['push'](_0x3526ff['shift']());}};_0x4b995f(++_0x5c5870);}(_0xaf79,0x82));var _0x9af7=function(_0xfae941,_0x31dc68){_0xfae941=_0xfae941-0x0;var _0xd21834=_0xaf79[_0xfae941];return _0xd21834;};'use strict';var multer=require('multer');var util=require(_0x9af7('0x0'));var path=require(_0x9af7('0x1'));var timeout=require(_0x9af7('0x2'));var express=require(_0x9af7('0x3'));var router=express[_0x9af7('0x4')]();var fs_extra=require(_0x9af7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9af7('0x6'));var config=require(_0x9af7('0x7'));var controller=require(_0x9af7('0x8'));router[_0x9af7('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9af7('0x9')](_0x9af7('0xa'),auth[_0x9af7('0xb')](),controller[_0x9af7('0xc')]);router[_0x9af7('0xd')]('/',auth[_0x9af7('0xb')](),controller[_0x9af7('0xe')]);router[_0x9af7('0xf')](_0x9af7('0xa'),auth[_0x9af7('0xb')](),controller[_0x9af7('0x10')]);router[_0x9af7('0x11')]('/:id',auth[_0x9af7('0xb')](),controller[_0x9af7('0x12')]);module[_0x9af7('0x13')]=router; \ No newline at end of file +var _0x5e0e=['../../config/environment','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5e0e,0x89));var _0xe5e0=function(_0x769935,_0x2311a5){_0x769935=_0x769935-0x0;var _0x24f62e=_0x5e0e[_0x769935];return _0x24f62e;};'use strict';var multer=require(_0xe5e0('0x0'));var util=require(_0xe5e0('0x1'));var path=require('path');var timeout=require(_0xe5e0('0x2'));var express=require(_0xe5e0('0x3'));var router=express[_0xe5e0('0x4')]();var fs_extra=require(_0xe5e0('0x5'));var auth=require(_0xe5e0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe5e0('0x7'));var controller=require('./cmCustomField.controller');router[_0xe5e0('0x8')]('/',auth[_0xe5e0('0x9')](),controller[_0xe5e0('0xa')]);router[_0xe5e0('0x8')](_0xe5e0('0xb'),auth[_0xe5e0('0x9')](),controller['show']);router[_0xe5e0('0xc')]('/',auth[_0xe5e0('0x9')](),controller['create']);router[_0xe5e0('0xd')](_0xe5e0('0xb'),auth[_0xe5e0('0x9')](),controller[_0xe5e0('0xe')]);router[_0xe5e0('0xf')](_0xe5e0('0xb'),auth[_0xe5e0('0x9')](),controller[_0xe5e0('0x10')]);module[_0xe5e0('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 2d80186..e1cfe40 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 _0x6c82=['moment','sequelize','exports','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','UNSIGNED','contactListQueue'];(function(_0xaad2cc,_0x5ee56b){var _0x281483=function(_0x25287a){while(--_0x25287a){_0xaad2cc['push'](_0xaad2cc['shift']());}};_0x281483(++_0x5ee56b);}(_0x6c82,0x16b));var _0x26c8=function(_0x4b9036,_0x47bfa6){_0x4b9036=_0x4b9036-0x0;var _0x20b645=_0x6c82[_0x4b9036];return _0x20b645;};'use strict';var moment=require(_0x26c8('0x0'));var Sequelize=require(_0x26c8('0x1'));module[_0x26c8('0x2')]={'phone':{'type':Sequelize[_0x26c8('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x26c8('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x26c8('0x5')](_0x26c8('0x6'))},'countbusyretry':{'type':Sequelize[_0x26c8('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x26c8('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x26c8('0x8')]},'priority':{'type':Sequelize[_0x26c8('0x7')](0x2)[_0x26c8('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x26c8('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x26c8('0xa')},'ListId':{'type':Sequelize[_0x26c8('0x7')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x26c8('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x26c8('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x26c8('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x26c8('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x26c8('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x26c8('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5365=['contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x452be0,_0x2b3bbe){var _0x1f7832=function(_0x2a8a67){while(--_0x2a8a67){_0x452be0['push'](_0x452be0['shift']());}};_0x1f7832(++_0x2b3bbe);}(_0x5365,0x1af));var _0x5536=function(_0x346ecf,_0x4163e6){_0x346ecf=_0x346ecf-0x0;var _0x22a6dc=_0x5365[_0x346ecf];return _0x22a6dc;};'use strict';var moment=require(_0x5536('0x0'));var Sequelize=require(_0x5536('0x1'));module[_0x5536('0x2')]={'phone':{'type':Sequelize[_0x5536('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x5536('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x5536('0x5')],'defaultValue':moment()[_0x5536('0x6')](_0x5536('0x7'))},'countbusyretry':{'type':Sequelize[_0x5536('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x5536('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5536('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5536('0x5')]},'priority':{'type':Sequelize[_0x5536('0x8')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x5536('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x5536('0x9')},'UserId':{'type':Sequelize[_0x5536('0x8')]},'VoiceQueueId':{'type':Sequelize[_0x5536('0x8')],'unique':_0x5536('0x9')},'CampaignId':{'type':Sequelize[_0x5536('0x8')]},'countnosuchnumberretry':{'type':Sequelize[_0x5536('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5536('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5536('0x8')],'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 f5b77ea..c85d44a 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 _0xe5b5=['name','send','index','map','CmHopper','rawAttributes','fieldName','type','model','query','keys','filters','concat','$and','$gt','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contained','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','rows','show','intersection','include','create','body','describe','catch','destroy','VoiceQueueId','VoiceQueue','find','CampaignId','omit','createdAt','updatedAt','state','statedesc','campaign','membername','UserId','user','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','CmContact','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','dialOrderByScheduledAt','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','Company','CmList','List','Queue','dialActive','update','getOpenContacts','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','stack'];(function(_0x3f5a61,_0x521d5f){var _0x2f2c5c=function(_0x78d0a0){while(--_0x78d0a0){_0x3f5a61['push'](_0x3f5a61['shift']());}};_0x2f2c5c(++_0x521d5f);}(_0xe5b5,0x73));var _0x5e5b=function(_0x52e363,_0x48062a){_0x52e363=_0x52e363-0x0;var _0x3fc2b5=_0xe5b5[_0x52e363];return _0x3fc2b5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5e5b('0x0'));var zipdir=require(_0x5e5b('0x1'));var jsonpatch=require(_0x5e5b('0x2'));var rp=require(_0x5e5b('0x3'));var moment=require(_0x5e5b('0x4'));var BPromise=require(_0x5e5b('0x5'));var Mustache=require(_0x5e5b('0x6'));var util=require(_0x5e5b('0x7'));var path=require(_0x5e5b('0x8'));var sox=require(_0x5e5b('0x9'));var csv=require(_0x5e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5e5b('0xb'));var _=require(_0x5e5b('0xc'));var squel=require(_0x5e5b('0xd'));var crypto=require(_0x5e5b('0xe'));var jsforce=require(_0x5e5b('0xf'));var deskjs=require(_0x5e5b('0x10'));var toCsv=require(_0x5e5b('0xa'));var querystring=require(_0x5e5b('0x11'));var Papa=require('papaparse');var Redis=require(_0x5e5b('0x12'));var authService=require(_0x5e5b('0x13'));var qs=require(_0x5e5b('0x14'));var as=require(_0x5e5b('0x15'));var hardwareService=require(_0x5e5b('0x16'));var logger=require(_0x5e5b('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x5e5b('0x18'));var licenseUtil=require(_0x5e5b('0x19'));var db=require(_0x5e5b('0x1a'))['db'];function respondWithStatusCode(_0x28668a,_0x42e548){_0x42e548=_0x42e548||0xcc;return function(_0x3e0cbe){if(_0x3e0cbe){return _0x28668a['sendStatus'](_0x42e548);}return _0x28668a[_0x5e5b('0x1b')](_0x42e548)[_0x5e5b('0x1c')]();};}function respondWithResult(_0x38dabd,_0x492ef7){_0x492ef7=_0x492ef7||0xc8;return function(_0x18bd59){if(_0x18bd59){return _0x38dabd[_0x5e5b('0x1b')](_0x492ef7)[_0x5e5b('0x1d')](_0x18bd59);}};}function respondWithFilteredResult(_0x4512c4,_0x2639d6){return function(_0x3d8b7f){if(_0x3d8b7f){var _0xa17e55=typeof _0x2639d6[_0x5e5b('0x1e')]==='undefined'&&typeof _0x2639d6[_0x5e5b('0x1f')]===_0x5e5b('0x20');var _0x3ed951=_0x3d8b7f[_0x5e5b('0x21')];var _0x498d68=_0xa17e55?0x0:_0x2639d6[_0x5e5b('0x1e')];var _0xe24365=_0xa17e55?_0x3d8b7f[_0x5e5b('0x21')]:_0x2639d6[_0x5e5b('0x1e')]+_0x2639d6['limit'];var _0x55ffae;if(_0xe24365>=_0x3ed951){_0xe24365=_0x3ed951;_0x55ffae=0xc8;}else{_0x55ffae=0xce;}_0x4512c4[_0x5e5b('0x1b')](_0x55ffae);return _0x4512c4[_0x5e5b('0x22')](_0x5e5b('0x23'),_0x498d68+'-'+_0xe24365+'/'+_0x3ed951)[_0x5e5b('0x1d')](_0x3d8b7f);}return null;};}function patchUpdates(_0x479ae5){return function(_0x2f85e5){try{jsonpatch[_0x5e5b('0x24')](_0x2f85e5,_0x479ae5,!![]);}catch(_0x4f1524){return BPromise[_0x5e5b('0x25')](_0x4f1524);}return _0x2f85e5['save']();};}function saveUpdates(_0x216e80,_0x36cce7){return function(_0x3680a3){if(_0x3680a3){return _0x3680a3['update'](_0x216e80)[_0x5e5b('0x26')](function(_0x53b56b){return _0x53b56b;});}return null;};}function removeEntity(_0x1a06e1,_0x18deec){return function(_0x49b15b){if(_0x49b15b){return _0x49b15b['destroy']()['then'](function(){_0x1a06e1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x32d94c,_0x4c00d6){return function(_0x581f1e){if(!_0x581f1e){_0x32d94c['sendStatus'](0x194);}return _0x581f1e;};}function handleError(_0x522f16,_0x2e49db){_0x2e49db=_0x2e49db||0x1f4;return function(_0x461148){logger['error'](_0x461148[_0x5e5b('0x27')]);if(_0x461148[_0x5e5b('0x28')]){delete _0x461148[_0x5e5b('0x28')];}_0x522f16['status'](_0x2e49db)[_0x5e5b('0x29')](_0x461148);};}exports[_0x5e5b('0x2a')]=function(_0x545062,_0x211778){var _0x4ca952={},_0x10428f={},_0x36c7d1={'count':0x0,'rows':[]};var _0x3ac0cf=_[_0x5e5b('0x2b')](db[_0x5e5b('0x2c')][_0x5e5b('0x2d')],function(_0x1a40ba){return{'name':_0x1a40ba[_0x5e5b('0x2e')],'type':_0x1a40ba[_0x5e5b('0x2f')]['key']};});_0x10428f[_0x5e5b('0x30')]=_[_0x5e5b('0x2b')](_0x3ac0cf,_0x5e5b('0x28'));_0x10428f[_0x5e5b('0x31')]=_[_0x5e5b('0x32')](_0x545062['query']);_0x10428f[_0x5e5b('0x33')]=_['intersection'](_0x10428f[_0x5e5b('0x30')],_0x10428f[_0x5e5b('0x31')]);_0x10428f['filters']=_[_0x5e5b('0x34')](_0x10428f[_0x5e5b('0x33')],[_0x5e5b('0x35'),'$or',_0x5e5b('0x36'),'$gte',_0x5e5b('0x37'),_0x5e5b('0x38'),_0x5e5b('0x39'),_0x5e5b('0x3a'),_0x5e5b('0x3b'),_0x5e5b('0x3c'),_0x5e5b('0x3d'),_0x5e5b('0x3e'),_0x5e5b('0x3f'),_0x5e5b('0x40'),_0x5e5b('0x41'),_0x5e5b('0x42'),_0x5e5b('0x43'),'$like','$overlap','$contains',_0x5e5b('0x44'),'$any']);_0x4ca952[_0x5e5b('0x45')]=_['intersection'](_0x10428f[_0x5e5b('0x30')],qs[_0x5e5b('0x46')](_0x545062[_0x5e5b('0x31')][_0x5e5b('0x46')]));_0x4ca952[_0x5e5b('0x45')]=_0x4ca952[_0x5e5b('0x45')][_0x5e5b('0x47')]?_0x4ca952['attributes']:_0x10428f[_0x5e5b('0x30')];if(!_0x545062['query'][_0x5e5b('0x48')](_0x5e5b('0x49'))){_0x4ca952[_0x5e5b('0x1f')]=qs[_0x5e5b('0x1f')](_0x545062['query'][_0x5e5b('0x1f')]);_0x4ca952['offset']=qs[_0x5e5b('0x1e')](_0x545062[_0x5e5b('0x31')][_0x5e5b('0x1e')]);}_0x4ca952[_0x5e5b('0x4a')]=qs[_0x5e5b('0x4b')](_0x545062['query']['sort']);_0x4ca952[_0x5e5b('0x4c')]=qs[_0x5e5b('0x33')](_[_0x5e5b('0x4d')](_0x545062[_0x5e5b('0x31')],_0x10428f[_0x5e5b('0x33')]),_0x3ac0cf);if(_0x545062[_0x5e5b('0x31')]['filter']){_0x4ca952[_0x5e5b('0x4c')]=_['merge'](_0x4ca952[_0x5e5b('0x4c')],{'$or':_[_0x5e5b('0x2b')](_0x3ac0cf,function(_0x1b1a4b){if(_0x1b1a4b[_0x5e5b('0x2f')]!==_0x5e5b('0x4e')){var _0x30db11={};_0x30db11[_0x1b1a4b['name']]={'$like':'%'+_0x545062[_0x5e5b('0x31')][_0x5e5b('0x4f')]+'%'};return _0x30db11;}})});}_0x4ca952=_[_0x5e5b('0x50')]({},_0x4ca952,_0x545062[_0x5e5b('0x51')]);var _0x57e40a={'where':_0x4ca952[_0x5e5b('0x4c')]};return db['CmHopper'][_0x5e5b('0x21')](_0x57e40a)['then'](function(_0x3bcb68){_0x36c7d1[_0x5e5b('0x21')]=_0x3bcb68;if(_0x545062[_0x5e5b('0x31')][_0x5e5b('0x52')]){_0x4ca952['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x4ca952);})[_0x5e5b('0x26')](function(_0x59e441){_0x36c7d1[_0x5e5b('0x53')]=_0x59e441;return _0x36c7d1;})[_0x5e5b('0x26')](respondWithFilteredResult(_0x211778,_0x4ca952))['catch'](handleError(_0x211778,null));};exports[_0x5e5b('0x54')]=function(_0x5d86e1,_0x554fce){var _0x18890b={'raw':!![],'where':{'id':_0x5d86e1['params']['id']}},_0x3fcce0={};_0x3fcce0['model']=_[_0x5e5b('0x32')](db[_0x5e5b('0x2c')]['rawAttributes']);_0x3fcce0[_0x5e5b('0x31')]=_[_0x5e5b('0x32')](_0x5d86e1[_0x5e5b('0x31')]);_0x3fcce0[_0x5e5b('0x33')]=_['intersection'](_0x3fcce0['model'],_0x3fcce0[_0x5e5b('0x31')]);_0x18890b[_0x5e5b('0x45')]=_[_0x5e5b('0x55')](_0x3fcce0[_0x5e5b('0x30')],qs[_0x5e5b('0x46')](_0x5d86e1[_0x5e5b('0x31')]['fields']));_0x18890b[_0x5e5b('0x45')]=_0x18890b[_0x5e5b('0x45')][_0x5e5b('0x47')]?_0x18890b[_0x5e5b('0x45')]:_0x3fcce0[_0x5e5b('0x30')];if(_0x5d86e1[_0x5e5b('0x31')][_0x5e5b('0x52')]){_0x18890b[_0x5e5b('0x56')]=[{'all':!![]}];}_0x18890b=_['merge']({},_0x18890b,_0x5d86e1['options']);return db['CmHopper']['find'](_0x18890b)[_0x5e5b('0x26')](handleEntityNotFound(_0x554fce,null))['then'](respondWithResult(_0x554fce,null))['catch'](handleError(_0x554fce,null));};exports[_0x5e5b('0x57')]=function(_0x44d81b,_0x557bd0){return db[_0x5e5b('0x2c')][_0x5e5b('0x57')](_0x44d81b[_0x5e5b('0x58')],{})[_0x5e5b('0x26')](respondWithResult(_0x557bd0,0xc9))['catch'](handleError(_0x557bd0,null));};exports['update']=function(_0x3bf770,_0x109370){if(_0x3bf770[_0x5e5b('0x58')]['id']){delete _0x3bf770[_0x5e5b('0x58')]['id'];}return db[_0x5e5b('0x2c')]['find']({'where':{'id':_0x3bf770['params']['id']}})['then'](handleEntityNotFound(_0x109370,null))['then'](saveUpdates(_0x3bf770[_0x5e5b('0x58')],null))[_0x5e5b('0x26')](respondWithResult(_0x109370,null))['catch'](handleError(_0x109370,null));};exports[_0x5e5b('0x59')]=function(_0x1ce1a6,_0x349767){return db[_0x5e5b('0x2c')][_0x5e5b('0x59')]()['then'](respondWithResult(_0x349767,null))[_0x5e5b('0x5a')](handleError(_0x349767,null));};exports[_0x5e5b('0x5b')]=function(_0x39cfff,_0x3c6abe){var _0x1680af;return db[_0x5e5b('0x2c')]['find']({'where':{'id':_0x39cfff['params']['id']}})[_0x5e5b('0x26')](handleEntityNotFound(_0x3c6abe,null))[_0x5e5b('0x26')](function(_0x486efc){if(_0x486efc){return _0x486efc[_0x5e5b('0x5b')]()[_0x5e5b('0x26')](function(_0x13c1e5){return _0x13c1e5;});}})['then'](function(_0x3a9be6){_0x1680af=_0x3a9be6;if(_0x3a9be6){if(_0x3a9be6[_0x5e5b('0x5c')]||_0x3a9be6['CampaignId']){return db[_0x3a9be6['VoiceQueueId']?_0x5e5b('0x5d'):'Campaign'][_0x5e5b('0x5e')]({'where':{'id':_0x3a9be6['VoiceQueueId']?_0x3a9be6[_0x5e5b('0x5c')]:_0x3a9be6[_0x5e5b('0x5f')]},'attributes':['id','name'],'raw':!![]});}}})[_0x5e5b('0x26')](function(_0x2d7e27){var _0x4882bc={};if(_0x2d7e27){_[_0x5e5b('0x50')](_0x4882bc,_[_0x5e5b('0x60')](_0x1680af['dataValues'],[_0x5e5b('0x61'),_0x5e5b('0x62'),'id']));_0x4882bc[_0x5e5b('0x63')]=0x15;_0x4882bc[_0x5e5b('0x64')]='deleted';_0x4882bc[_0x5e5b('0x65')]=_0x2d7e27[_0x5e5b('0x28')];_0x4882bc[_0x5e5b('0x66')]=_0x39cfff['user'][_0x5e5b('0x28')];_0x4882bc[_0x5e5b('0x67')]=_0x39cfff[_0x5e5b('0x68')]['id'];_0x4882bc[_0x5e5b('0x69')]=!![];_0x4882bc[_0x5e5b('0x6a')]=moment()[_0x5e5b('0x6b')](_0x5e5b('0x6c'));_0x4882bc[_0x5e5b('0x6d')]=_0x1680af[_0x5e5b('0x6e')];_0x4882bc['campaigntype']=_0x1680af[_0x5e5b('0x5c')]?_0x5e5b('0x6f'):_0x5e5b('0x70');return db['CmContact']['find']({'where':{'id':_0x4882bc[_0x5e5b('0x71')]},'attributes':[_0x5e5b('0x72'),_0x5e5b('0x73')]})['then'](function(_0x39270d){if(!_[_0x5e5b('0x74')](_0x3c6abe)&&!_[_0x5e5b('0x74')](_0x39270d['firstName'])){_0x4882bc['calleridname']=_0x39270d[_0x5e5b('0x72')];if(!_[_0x5e5b('0x74')](_0x39270d[_0x5e5b('0x73')])){_0x4882bc[_0x5e5b('0x75')]+='\x20'+_0x39270d[_0x5e5b('0x73')];}}})[_0x5e5b('0x76')](function(){return db[_0x5e5b('0x77')][_0x5e5b('0x57')](_0x4882bc);});}})[_0x5e5b('0x26')](function(){return _0x3c6abe[_0x5e5b('0x1b')](0xcc)[_0x5e5b('0x1c')]();})['catch'](handleError(_0x3c6abe,null));};exports[_0x5e5b('0x78')]=function(_0x171bdf,_0x2b3adf,_0x13c7f6){var _0x129141=[];return db[_0x5e5b('0x79')]['describe']()['then'](function(_0x5982ee){_0x129141=_[_0x5e5b('0x32')](_0x5982ee);return _0x171bdf['user'][_0x5e5b('0x7a')]({'where':{'type':_0x5e5b('0x7b'),'dialActive':!![],'dialMethod':_0x5e5b('0x7c')},'attributes':['id','dialOrderByScheduledAt',_0x5e5b('0x7d')],'raw':!![]});})['then'](function(_0x3a8923){if(_0x3a8923&&_0x3a8923[_0x5e5b('0x47')]){return db[_0x5e5b('0x7e')]['transaction'](function(_0x2232db){var _0x50b414={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x5e5b('0x6c'))},'VoiceQueueId':{'$in':_[_0x5e5b('0x2b')](_0x3a8923,'id')},'$or':[{'UserId':null},{'UserId':_0x171bdf[_0x5e5b('0x68')]['id']}]};var _0x13ccfd={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3a8923)[_0x5e5b('0x4f')]([_0x5e5b('0x7d'),0x0])['map']('id')[_0x5e5b('0x7f')]()},'$or':[{'UserId':null},{'UserId':_0x171bdf['user']['id']}]};var _0xbca88c={'$or':[_0x50b414,_0x13ccfd]};var _0x4d4c92=[];if(_0x171bdf['body'][_0x5e5b('0x80')]&&_0x171bdf[_0x5e5b('0x58')][_0x5e5b('0x80')]===_0x5e5b('0x81')){if(!_[_0x5e5b('0x82')](_0x171bdf[_0x5e5b('0x58')][_0x5e5b('0x83')])){_0xbca88c['id']={'$in':_0x171bdf['body'][_0x5e5b('0x83')]};}_0x4d4c92=[[_0x5e5b('0x84'),_0x5e5b('0x85')],[_0x5e5b('0x86'),_0x3a8923[0x0]['dialOrderByScheduledAt']===_0x5e5b('0x85')?'DESC':_0x5e5b('0x85')],db[_0x5e5b('0x7e')][_0x5e5b('0x87')](_0x5e5b('0x88')),['id',_0x5e5b('0x89')]];}else{if(!_[_0x5e5b('0x82')](_0x171bdf[_0x5e5b('0x58')][_0x5e5b('0x83')])){_0xbca88c['id']={'$notIn':_0x171bdf[_0x5e5b('0x58')]['hopperIds']};}_0x4d4c92=[[_0x5e5b('0x84'),_0x5e5b('0x89')],[_0x5e5b('0x86'),_0x3a8923[0x0][_0x5e5b('0x8a')]],db[_0x5e5b('0x7e')][_0x5e5b('0x87')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x5e5b('0x85')]];}return db[_0x5e5b('0x2c')][_0x5e5b('0x8b')]({'attributes':['id',_0x5e5b('0x8c'),_0x5e5b('0x8d')],'where':_0xbca88c,'order':_0x4d4c92,'transaction':_0x2232db,'lock':_0x2232db[_0x5e5b('0x8e')][_0x5e5b('0x8f')],'include':[{'model':db['CmContact'],'as':_0x5e5b('0x90'),'attributes':_0x129141,'include':[{'model':db['CmCompany'],'as':_0x5e5b('0x91'),'attributes':['id',_0x5e5b('0x28')]}]},{'model':db[_0x5e5b('0x92')],'as':_0x5e5b('0x93'),'attributes':['id',_0x5e5b('0x28')]},{'model':db[_0x5e5b('0x5d')],'as':_0x5e5b('0x94'),'attributes':['id','name',_0x5e5b('0x95')]}]})[_0x5e5b('0x26')](function(_0x243894){if(_0x243894){return _0x243894[_0x5e5b('0x96')]({'UserId':_0x171bdf[_0x5e5b('0x68')]['id']},{'transaction':_0x2232db});}});});}})[_0x5e5b('0x26')](handleEntityNotFound(_0x2b3adf,null))[_0x5e5b('0x26')](respondWithResult(_0x2b3adf,null))[_0x5e5b('0x5a')](handleError(_0x2b3adf,null));};exports[_0x5e5b('0x97')]=function(_0x12d34a,_0x324455,_0x228cea){return _0x12d34a[_0x5e5b('0x68')]['getVoiceQueues']({'where':{'type':_0x5e5b('0x7b'),'dialActive':!![],'dialMethod':_0x5e5b('0x7c')},'attributes':['id'],'raw':!![]})[_0x5e5b('0x26')](function(_0x386a9f){if(_0x386a9f&&_0x386a9f['length']){return db[_0x5e5b('0x2c')][_0x5e5b('0x21')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5e5b('0x6b')](_0x5e5b('0x6c'))},'VoiceQueueId':{'$in':_[_0x5e5b('0x2b')](_0x386a9f,'id')},'$or':[{'UserId':null},{'UserId':_0x12d34a[_0x5e5b('0x68')]['id']}]}});}return 0x0;})[_0x5e5b('0x26')](function(_0x3fd7e1){if(!_[_0x5e5b('0x74')](_0x3fd7e1)&&_['isNumber'](_0x3fd7e1)){return _0x324455[_0x5e5b('0x1b')](0xc8)[_0x5e5b('0x1d')]({'contacts':_0x3fd7e1});}else{logger[_0x5e5b('0x98')](_0x5e5b('0x99'),'getOpenContacts',0x194,_0x5e5b('0x9a'));_0x324455['sendStatus'](0x194);}})[_0x5e5b('0x5a')](handleError(_0x324455,null));}; \ No newline at end of file +var _0x2821=['util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','name','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','concat','$gte','$lte','$ne','$not','$in','$notIn','$like','$notLike','$contains','$contained','$any','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','options','CmHopper','includeAll','include','findAll','catch','show','keys','length','find','create','body','update','describe','params','VoiceQueueId','Campaign','CampaignId','omit','dataValues','createdAt','state','deleted','campaign','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','CmContact','firstName','isNil','calleridname','lastName','finally','getPreview','getVoiceQueues','preview','dialPreviewAutoRecallMe','sequelize','transaction','filter','value','direction','prev','isEmpty','hopperIds','priority','ASC','dialOrderByScheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','findOne','scheduledat','recallme','CmCompany','Company','CmList','VoiceQueue','Queue','dialActive','outbound','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x2299d7,_0x59ed4f){var _0x15e569=function(_0x120c18){while(--_0x120c18){_0x2299d7['push'](_0x2299d7['shift']());}};_0x15e569(++_0x59ed4f);}(_0x2821,0x87));var _0x1282=function(_0x2eb535,_0x3774ce){_0x2eb535=_0x2eb535-0x0;var _0x100419=_0x2821[_0x2eb535];return _0x100419;};'use strict';var emlformat=require(_0x1282('0x0'));var rimraf=require(_0x1282('0x1'));var zipdir=require(_0x1282('0x2'));var jsonpatch=require(_0x1282('0x3'));var rp=require(_0x1282('0x4'));var moment=require(_0x1282('0x5'));var BPromise=require(_0x1282('0x6'));var Mustache=require(_0x1282('0x7'));var util=require(_0x1282('0x8'));var path=require(_0x1282('0x9'));var sox=require(_0x1282('0xa'));var csv=require('to-csv');var ejs=require(_0x1282('0xb'));var fs=require('fs');var fs_extra=require(_0x1282('0xc'));var _=require(_0x1282('0xd'));var squel=require(_0x1282('0xe'));var crypto=require(_0x1282('0xf'));var jsforce=require(_0x1282('0x10'));var deskjs=require(_0x1282('0x11'));var toCsv=require(_0x1282('0x12'));var querystring=require('querystring');var Papa=require(_0x1282('0x13'));var Redis=require(_0x1282('0x14'));var authService=require(_0x1282('0x15'));var qs=require(_0x1282('0x16'));var as=require(_0x1282('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1282('0x18'))(_0x1282('0x19'));var utils=require('../../config/utils');var config=require(_0x1282('0x1a'));var licenseUtil=require(_0x1282('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e41b3,_0x4bba95){_0x4bba95=_0x4bba95||0xcc;return function(_0x4d0a3c){if(_0x4d0a3c){return _0x2e41b3[_0x1282('0x1c')](_0x4bba95);}return _0x2e41b3[_0x1282('0x1d')](_0x4bba95)[_0x1282('0x1e')]();};}function respondWithResult(_0x2288ec,_0x4dfd14){_0x4dfd14=_0x4dfd14||0xc8;return function(_0x5af979){if(_0x5af979){return _0x2288ec['status'](_0x4dfd14)[_0x1282('0x1f')](_0x5af979);}};}function respondWithFilteredResult(_0x3ee18f,_0x4272fa){return function(_0x3f7bd8){if(_0x3f7bd8){var _0x2320c5=typeof _0x4272fa[_0x1282('0x20')]===_0x1282('0x21')&&typeof _0x4272fa[_0x1282('0x22')]==='undefined';var _0x2ddeb5=_0x3f7bd8[_0x1282('0x23')];var _0x518733=_0x2320c5?0x0:_0x4272fa['offset'];var _0xebc97e=_0x2320c5?_0x3f7bd8['count']:_0x4272fa[_0x1282('0x20')]+_0x4272fa[_0x1282('0x22')];var _0x4bfb44;if(_0xebc97e>=_0x2ddeb5){_0xebc97e=_0x2ddeb5;_0x4bfb44=0xc8;}else{_0x4bfb44=0xce;}_0x3ee18f['status'](_0x4bfb44);return _0x3ee18f['set']('Content-Range',_0x518733+'-'+_0xebc97e+'/'+_0x2ddeb5)[_0x1282('0x1f')](_0x3f7bd8);}return null;};}function patchUpdates(_0x2f4e4a){return function(_0xe67079){try{jsonpatch[_0x1282('0x24')](_0xe67079,_0x2f4e4a,!![]);}catch(_0x2f30dc){return BPromise[_0x1282('0x25')](_0x2f30dc);}return _0xe67079[_0x1282('0x26')]();};}function saveUpdates(_0x42e38e,_0x153159){return function(_0x1a6240){if(_0x1a6240){return _0x1a6240['update'](_0x42e38e)[_0x1282('0x27')](function(_0x5a7250){return _0x5a7250;});}return null;};}function removeEntity(_0x13a39e,_0x25dbb5){return function(_0x158123){if(_0x158123){return _0x158123[_0x1282('0x28')]()[_0x1282('0x27')](function(){_0x13a39e['status'](0xcc)[_0x1282('0x1e')]();});}};}function handleEntityNotFound(_0x117e5c,_0x45830f){return function(_0x29d09c){if(!_0x29d09c){_0x117e5c[_0x1282('0x1c')](0x194);}return _0x29d09c;};}function handleError(_0x1ca0fa,_0x725029){_0x725029=_0x725029||0x1f4;return function(_0x28e686){logger['error'](_0x28e686['stack']);if(_0x28e686[_0x1282('0x29')]){delete _0x28e686[_0x1282('0x29')];}_0x1ca0fa[_0x1282('0x1d')](_0x725029)['send'](_0x28e686);};}exports[_0x1282('0x2a')]=function(_0x537130,_0xfdb50c){var _0x5753ba={},_0x519a7f={},_0x4b5d6c={'count':0x0,'rows':[]};var _0x5d6a7d=_['map'](db['CmHopper'][_0x1282('0x2b')],function(_0x12e7d7){return{'name':_0x12e7d7[_0x1282('0x2c')],'type':_0x12e7d7[_0x1282('0x2d')][_0x1282('0x2e')]};});_0x519a7f[_0x1282('0x2f')]=_[_0x1282('0x30')](_0x5d6a7d,_0x1282('0x29'));_0x519a7f[_0x1282('0x31')]=_['keys'](_0x537130[_0x1282('0x31')]);_0x519a7f[_0x1282('0x32')]=_[_0x1282('0x33')](_0x519a7f[_0x1282('0x2f')],_0x519a7f[_0x1282('0x31')]);_0x519a7f['filters']=_[_0x1282('0x34')](_0x519a7f[_0x1282('0x32')],['$and','$or','$gt',_0x1282('0x35'),'$lt',_0x1282('0x36'),_0x1282('0x37'),'$eq',_0x1282('0x38'),'$between','$notBetween',_0x1282('0x39'),_0x1282('0x3a'),_0x1282('0x3b'),_0x1282('0x3c'),'$iLike','$notILike',_0x1282('0x3b'),'$overlap',_0x1282('0x3d'),_0x1282('0x3e'),_0x1282('0x3f')]);_0x5753ba[_0x1282('0x40')]=_['intersection'](_0x519a7f[_0x1282('0x2f')],qs['fields'](_0x537130[_0x1282('0x31')][_0x1282('0x41')]));_0x5753ba[_0x1282('0x40')]=_0x5753ba[_0x1282('0x40')]['length']?_0x5753ba['attributes']:_0x519a7f[_0x1282('0x2f')];if(!_0x537130[_0x1282('0x31')][_0x1282('0x42')]('nolimit')){_0x5753ba[_0x1282('0x22')]=qs[_0x1282('0x22')](_0x537130[_0x1282('0x31')][_0x1282('0x22')]);_0x5753ba[_0x1282('0x20')]=qs[_0x1282('0x20')](_0x537130[_0x1282('0x31')][_0x1282('0x20')]);}_0x5753ba[_0x1282('0x43')]=qs[_0x1282('0x44')](_0x537130[_0x1282('0x31')][_0x1282('0x44')]);_0x5753ba[_0x1282('0x45')]=qs['filters'](_[_0x1282('0x46')](_0x537130[_0x1282('0x31')],_0x519a7f[_0x1282('0x32')]),_0x5d6a7d);if(_0x537130['query']['filter']){_0x5753ba[_0x1282('0x45')]=_[_0x1282('0x47')](_0x5753ba[_0x1282('0x45')],{'$or':_[_0x1282('0x30')](_0x5d6a7d,function(_0x22e98f){if(_0x22e98f['type']!=='VIRTUAL'){var _0x45be30={};_0x45be30[_0x22e98f[_0x1282('0x29')]]={'$like':'%'+_0x537130[_0x1282('0x31')]['filter']+'%'};return _0x45be30;}})});}_0x5753ba=_[_0x1282('0x47')]({},_0x5753ba,_0x537130[_0x1282('0x48')]);var _0x21a5fb={'where':_0x5753ba[_0x1282('0x45')]};return db[_0x1282('0x49')][_0x1282('0x23')](_0x21a5fb)['then'](function(_0x54a5f9){_0x4b5d6c['count']=_0x54a5f9;if(_0x537130[_0x1282('0x31')][_0x1282('0x4a')]){_0x5753ba[_0x1282('0x4b')]=[{'all':!![]}];}return db[_0x1282('0x49')][_0x1282('0x4c')](_0x5753ba);})['then'](function(_0x4e5328){_0x4b5d6c['rows']=_0x4e5328;return _0x4b5d6c;})['then'](respondWithFilteredResult(_0xfdb50c,_0x5753ba))[_0x1282('0x4d')](handleError(_0xfdb50c,null));};exports[_0x1282('0x4e')]=function(_0xfbdaef,_0x1fa45c){var _0x4e68b4={'raw':!![],'where':{'id':_0xfbdaef['params']['id']}},_0x4a0fe7={};_0x4a0fe7[_0x1282('0x2f')]=_['keys'](db['CmHopper']['rawAttributes']);_0x4a0fe7[_0x1282('0x31')]=_[_0x1282('0x4f')](_0xfbdaef['query']);_0x4a0fe7[_0x1282('0x32')]=_[_0x1282('0x33')](_0x4a0fe7[_0x1282('0x2f')],_0x4a0fe7[_0x1282('0x31')]);_0x4e68b4['attributes']=_['intersection'](_0x4a0fe7[_0x1282('0x2f')],qs[_0x1282('0x41')](_0xfbdaef[_0x1282('0x31')][_0x1282('0x41')]));_0x4e68b4[_0x1282('0x40')]=_0x4e68b4[_0x1282('0x40')][_0x1282('0x50')]?_0x4e68b4[_0x1282('0x40')]:_0x4a0fe7[_0x1282('0x2f')];if(_0xfbdaef[_0x1282('0x31')][_0x1282('0x4a')]){_0x4e68b4[_0x1282('0x4b')]=[{'all':!![]}];}_0x4e68b4=_[_0x1282('0x47')]({},_0x4e68b4,_0xfbdaef[_0x1282('0x48')]);return db['CmHopper'][_0x1282('0x51')](_0x4e68b4)['then'](handleEntityNotFound(_0x1fa45c,null))[_0x1282('0x27')](respondWithResult(_0x1fa45c,null))[_0x1282('0x4d')](handleError(_0x1fa45c,null));};exports['create']=function(_0x52049f,_0x576cfb){return db[_0x1282('0x49')][_0x1282('0x52')](_0x52049f[_0x1282('0x53')],{})[_0x1282('0x27')](respondWithResult(_0x576cfb,0xc9))[_0x1282('0x4d')](handleError(_0x576cfb,null));};exports[_0x1282('0x54')]=function(_0x44e249,_0x5f00bb){if(_0x44e249[_0x1282('0x53')]['id']){delete _0x44e249[_0x1282('0x53')]['id'];}return db[_0x1282('0x49')][_0x1282('0x51')]({'where':{'id':_0x44e249['params']['id']}})[_0x1282('0x27')](handleEntityNotFound(_0x5f00bb,null))[_0x1282('0x27')](saveUpdates(_0x44e249['body'],null))[_0x1282('0x27')](respondWithResult(_0x5f00bb,null))[_0x1282('0x4d')](handleError(_0x5f00bb,null));};exports[_0x1282('0x55')]=function(_0x53053e,_0xd76acf){return db['CmHopper'][_0x1282('0x55')]()['then'](respondWithResult(_0xd76acf,null))[_0x1282('0x4d')](handleError(_0xd76acf,null));};exports[_0x1282('0x28')]=function(_0x2bd901,_0xde14d8){var _0x24bc2e;return db[_0x1282('0x49')][_0x1282('0x51')]({'where':{'id':_0x2bd901[_0x1282('0x56')]['id']}})[_0x1282('0x27')](handleEntityNotFound(_0xde14d8,null))[_0x1282('0x27')](function(_0x4ea9ad){if(_0x4ea9ad){return _0x4ea9ad[_0x1282('0x28')]()[_0x1282('0x27')](function(_0x3c8a4b){return _0x3c8a4b;});}})[_0x1282('0x27')](function(_0x3ef2e6){_0x24bc2e=_0x3ef2e6;if(_0x3ef2e6){if(_0x3ef2e6[_0x1282('0x57')]||_0x3ef2e6['CampaignId']){return db[_0x3ef2e6[_0x1282('0x57')]?'VoiceQueue':_0x1282('0x58')][_0x1282('0x51')]({'where':{'id':_0x3ef2e6[_0x1282('0x57')]?_0x3ef2e6[_0x1282('0x57')]:_0x3ef2e6[_0x1282('0x59')]},'attributes':['id',_0x1282('0x29')],'raw':!![]});}}})['then'](function(_0x18afd6){var _0x2bd29c={};if(_0x18afd6){_['merge'](_0x2bd29c,_[_0x1282('0x5a')](_0x24bc2e[_0x1282('0x5b')],[_0x1282('0x5c'),'updatedAt','id']));_0x2bd29c[_0x1282('0x5d')]=0x15;_0x2bd29c['statedesc']=_0x1282('0x5e');_0x2bd29c[_0x1282('0x5f')]=_0x18afd6['name'];_0x2bd29c['membername']=_0x2bd901[_0x1282('0x60')][_0x1282('0x29')];_0x2bd29c[_0x1282('0x61')]=_0x2bd901[_0x1282('0x60')]['id'];_0x2bd29c[_0x1282('0x5e')]=!![];_0x2bd29c['deletedat']=moment()[_0x1282('0x62')](_0x1282('0x63'));_0x2bd29c['calleridnum']=_0x24bc2e[_0x1282('0x64')];_0x2bd29c[_0x1282('0x65')]=_0x24bc2e[_0x1282('0x57')]?_0x1282('0x66'):_0x1282('0x67');return db[_0x1282('0x68')][_0x1282('0x51')]({'where':{'id':_0x2bd29c['ContactId']},'attributes':[_0x1282('0x69'),'lastName']})[_0x1282('0x27')](function(_0x1a7545){if(!_[_0x1282('0x6a')](_0xde14d8)&&!_['isNil'](_0x1a7545[_0x1282('0x69')])){_0x2bd29c[_0x1282('0x6b')]=_0x1a7545[_0x1282('0x69')];if(!_[_0x1282('0x6a')](_0x1a7545['lastName'])){_0x2bd29c[_0x1282('0x6b')]+='\x20'+_0x1a7545[_0x1282('0x6c')];}}})[_0x1282('0x6d')](function(){return db['CmHopperFinal'][_0x1282('0x52')](_0x2bd29c);});}})[_0x1282('0x27')](function(){return _0xde14d8[_0x1282('0x1d')](0xcc)[_0x1282('0x1e')]();})['catch'](handleError(_0xde14d8,null));};exports[_0x1282('0x6e')]=function(_0xb07ea,_0x5696f3,_0x2fa341){var _0x329b44=[];return db['CmContact'][_0x1282('0x55')]()[_0x1282('0x27')](function(_0xf5c80e){_0x329b44=_[_0x1282('0x4f')](_0xf5c80e);return _0xb07ea[_0x1282('0x60')][_0x1282('0x6f')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x1282('0x70')},'attributes':['id','dialOrderByScheduledAt',_0x1282('0x71')],'raw':!![]});})[_0x1282('0x27')](function(_0x38134f){if(_0x38134f&&_0x38134f[_0x1282('0x50')]){return db[_0x1282('0x72')][_0x1282('0x73')](function(_0x2be9bd){var _0x85f049={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x1282('0x62')](_0x1282('0x63'))},'VoiceQueueId':{'$in':_[_0x1282('0x30')](_0x38134f,'id')},'$or':[{'UserId':null},{'UserId':_0xb07ea[_0x1282('0x60')]['id']}]};var _0x3e090b={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x38134f)[_0x1282('0x74')]([_0x1282('0x71'),0x0])['map']('id')[_0x1282('0x75')]()},'$or':[{'UserId':null},{'UserId':_0xb07ea['user']['id']}]};var _0x952bb5={'$or':[_0x85f049,_0x3e090b]};var _0x10becc=[];if(_0xb07ea['body'][_0x1282('0x76')]&&_0xb07ea[_0x1282('0x53')][_0x1282('0x76')]===_0x1282('0x77')){if(!_[_0x1282('0x78')](_0xb07ea['body'][_0x1282('0x79')])){_0x952bb5['id']={'$in':_0xb07ea[_0x1282('0x53')]['hopperIds']};}_0x10becc=[[_0x1282('0x7a'),_0x1282('0x7b')],['scheduledAt',_0x38134f[0x0][_0x1282('0x7c')]===_0x1282('0x7b')?_0x1282('0x7d'):_0x1282('0x7b')],db[_0x1282('0x72')][_0x1282('0x7e')](_0x1282('0x7f')),['id',_0x1282('0x7d')]];}else{if(!_['isEmpty'](_0xb07ea[_0x1282('0x53')]['hopperIds'])){_0x952bb5['id']={'$notIn':_0xb07ea[_0x1282('0x53')]['hopperIds']};}_0x10becc=[[_0x1282('0x7a'),'DESC'],[_0x1282('0x80'),_0x38134f[0x0][_0x1282('0x7c')]],db[_0x1282('0x72')][_0x1282('0x7e')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id','ASC']];}return db['CmHopper'][_0x1282('0x81')]({'attributes':['id',_0x1282('0x82'),_0x1282('0x83')],'where':_0x952bb5,'order':_0x10becc,'transaction':_0x2be9bd,'lock':_0x2be9bd['LOCK']['UPDATE'],'include':[{'model':db[_0x1282('0x68')],'as':'Contact','attributes':_0x329b44,'include':[{'model':db[_0x1282('0x84')],'as':_0x1282('0x85'),'attributes':['id','name']}]},{'model':db[_0x1282('0x86')],'as':'List','attributes':['id',_0x1282('0x29')]},{'model':db[_0x1282('0x87')],'as':_0x1282('0x88'),'attributes':['id',_0x1282('0x29'),_0x1282('0x89')]}]})[_0x1282('0x27')](function(_0xd67ef){if(_0xd67ef){return _0xd67ef['update']({'UserId':_0xb07ea[_0x1282('0x60')]['id']},{'transaction':_0x2be9bd});}});});}})[_0x1282('0x27')](handleEntityNotFound(_0x5696f3,null))[_0x1282('0x27')](respondWithResult(_0x5696f3,null))[_0x1282('0x4d')](handleError(_0x5696f3,null));};exports['getOpenContacts']=function(_0x5ac216,_0x360b90,_0x459269){return _0x5ac216[_0x1282('0x60')]['getVoiceQueues']({'where':{'type':_0x1282('0x8a'),'dialActive':!![],'dialMethod':_0x1282('0x70')},'attributes':['id'],'raw':!![]})['then'](function(_0x3bed53){if(_0x3bed53&&_0x3bed53[_0x1282('0x50')]){return db['CmHopper'][_0x1282('0x23')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x1282('0x63'))},'VoiceQueueId':{'$in':_[_0x1282('0x30')](_0x3bed53,'id')},'$or':[{'UserId':null},{'UserId':_0x5ac216[_0x1282('0x60')]['id']}]}});}return 0x0;})['then'](function(_0x3c2d41){if(!_[_0x1282('0x6a')](_0x3c2d41)&&_[_0x1282('0x8b')](_0x3c2d41)){return _0x360b90[_0x1282('0x1d')](0xc8)[_0x1282('0x1f')]({'contacts':_0x3c2d41});}else{logger[_0x1282('0x8c')](_0x1282('0x8d'),_0x1282('0x8e'),0x194,'entity\x20not\x20found');_0x360b90[_0x1282('0x1c')](0x194);}})[_0x1282('0x4d')](handleError(_0x360b90,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index ab5afb0..61ce162 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 _0x1623=['scheduledat','phone','priority','lodash','api','moment','bluebird','request-promise','path','./cmHopper.attributes','CmHopper','cm_hopper'];(function(_0x2d08f0,_0x2b4b93){var _0x10aa93=function(_0xbd054d){while(--_0xbd054d){_0x2d08f0['push'](_0x2d08f0['shift']());}};_0x10aa93(++_0x2b4b93);}(_0x1623,0xab));var _0x3162=function(_0x221b83,_0x4e2d9d){_0x221b83=_0x221b83-0x0;var _0x511e5d=_0x1623[_0x221b83];return _0x511e5d;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3162('0x1'));var moment=require(_0x3162('0x2'));var BPromise=require(_0x3162('0x3'));var rp=require(_0x3162('0x4'));var fs=require('fs');var path=require(_0x3162('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3162('0x6'));module['exports']=function(_0x1b55f2,_0x428de6){return _0x1b55f2['define'](_0x3162('0x7'),attributes,{'tableName':_0x3162('0x8'),'paranoid':![],'indexes':[{'name':_0x3162('0x9'),'fields':[_0x3162('0x9')]},{'name':_0x3162('0xa'),'fields':[_0x3162('0xa')]},{'name':_0x3162('0xb'),'fields':[_0x3162('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef3=['path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x507f9e,_0x308d20){var _0x250f7e=function(_0x144202){while(--_0x144202){_0x507f9e['push'](_0x507f9e['shift']());}};_0x250f7e(++_0x308d20);}(_0x2ef3,0xba));var _0x32ef=function(_0x2a00ea,_0x2a17db){_0x2a00ea=_0x2a00ea-0x0;var _0x422fa3=_0x2ef3[_0x2a00ea];return _0x422fa3;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]},{'name':_0x32ef('0xe'),'fields':[_0x32ef('0xe')]},{'name':_0x32ef('0xf'),'fields':[_0x32ef('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index c6367d0..00a09f3 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 _0x7f47=['GetContactDialer','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','UserId','UPDATE','GetCmHopperPreview','Contact','ResetActiveCalls','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetCmHopper','CmHopper','findAll','options','raw','attributes','limit','include','model','map','ShowCmHopper','find','where','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','CmContact','describe','sequelize','transaction','order','LOCK','keys','User','Agent','name','length','push','includes','all'];(function(_0x231a9c,_0x448a2b){var _0x49f0ed=function(_0x578f6d){while(--_0x578f6d){_0x231a9c['push'](_0x231a9c['shift']());}};_0x49f0ed(++_0x448a2b);}(_0x7f47,0xaf));var _0x77f4=function(_0x27ddf5,_0x5a3e18){_0x27ddf5=_0x27ddf5-0x0;var _0x26e74a=_0x7f47[_0x27ddf5];return _0x26e74a;};'use strict';var _=require(_0x77f4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x77f4('0x1'));var fs=require('fs');var Redis=require(_0x77f4('0x2'));var db=require(_0x77f4('0x3'))['db'];var utils=require(_0x77f4('0x4'));var logger=require(_0x77f4('0x5'))('rpc');var config=require(_0x77f4('0x6'));var jayson=require(_0x77f4('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38faeb,_0x3b2adb,_0x3ffaba){return new BPromise(function(_0x4f82ff,_0x1d1c50){return client[_0x77f4('0x8')](_0x38faeb,_0x3ffaba)[_0x77f4('0x9')](function(_0x2f1fc3){logger['info'](_0x77f4('0xa'),_0x3b2adb,_0x77f4('0xb'));logger[_0x77f4('0xc')](_0x77f4('0xd'),_0x3b2adb,_0x77f4('0xb'),JSON[_0x77f4('0xe')](_0x2f1fc3));if(_0x2f1fc3[_0x77f4('0xf')]){if(_0x2f1fc3[_0x77f4('0xf')][_0x77f4('0x10')]===0x1f4){logger[_0x77f4('0xf')]('CmHopper,\x20%s,\x20%s',_0x3b2adb,_0x2f1fc3[_0x77f4('0xf')]['message']);return _0x1d1c50(_0x2f1fc3[_0x77f4('0xf')][_0x77f4('0x11')]);}logger['error'](_0x77f4('0xa'),_0x3b2adb,_0x2f1fc3[_0x77f4('0xf')][_0x77f4('0x11')]);return _0x4f82ff(_0x2f1fc3['error']['message']);}else{logger[_0x77f4('0x12')](_0x77f4('0xa'),_0x3b2adb,_0x77f4('0xb'));_0x4f82ff(_0x2f1fc3['result'][_0x77f4('0x11')]);}})[_0x77f4('0x13')](function(_0x393573){logger[_0x77f4('0xf')]('CmHopper,\x20%s,\x20%s',_0x3b2adb,_0x393573);_0x1d1c50(_0x393573);});});}exports[_0x77f4('0x14')]=function(_0x32c0f4){var _0x1bc053=this;return new Promise(function(_0xd38d86,_0xc0a4c){return db[_0x77f4('0x15')][_0x77f4('0x16')]({'raw':_0x32c0f4[_0x77f4('0x17')]?_0x32c0f4[_0x77f4('0x17')][_0x77f4('0x18')]===undefined?!![]:![]:!![],'where':_0x32c0f4[_0x77f4('0x17')]?_0x32c0f4['options']['where']||null:null,'attributes':_0x32c0f4[_0x77f4('0x17')]?_0x32c0f4[_0x77f4('0x17')][_0x77f4('0x19')]||null:null,'limit':_0x32c0f4[_0x77f4('0x17')]?_0x32c0f4[_0x77f4('0x17')][_0x77f4('0x1a')]||null:null,'include':_0x32c0f4[_0x77f4('0x17')]?_0x32c0f4[_0x77f4('0x17')][_0x77f4('0x1b')]?_['map'](_0x32c0f4[_0x77f4('0x17')][_0x77f4('0x1b')],function(_0x5472d0){return{'model':db[_0x5472d0[_0x77f4('0x1c')]],'as':_0x5472d0['as'],'attributes':_0x5472d0[_0x77f4('0x19')],'include':_0x5472d0[_0x77f4('0x1b')]?_[_0x77f4('0x1d')](_0x5472d0['include'],function(_0x59d10a){return{'model':db[_0x59d10a['model']],'as':_0x59d10a['as'],'attributes':_0x59d10a[_0x77f4('0x19')],'include':_0x59d10a['include']?_[_0x77f4('0x1d')](_0x59d10a[_0x77f4('0x1b')],function(_0x2787b9){return{'model':db[_0x2787b9[_0x77f4('0x1c')]],'as':_0x2787b9['as'],'attributes':_0x2787b9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1734b7){logger[_0x77f4('0x12')](_0x77f4('0x14'),_0x32c0f4);logger[_0x77f4('0xc')](_0x77f4('0x14'),_0x32c0f4,JSON[_0x77f4('0xe')](_0x1734b7));_0xd38d86(_0x1734b7);})[_0x77f4('0x13')](function(_0x239c04){logger[_0x77f4('0xf')](_0x77f4('0x14'),_0x239c04[_0x77f4('0x11')],_0x32c0f4);_0xc0a4c(_0x1bc053[_0x77f4('0xf')](0x1f4,_0x239c04[_0x77f4('0x11')]));});});};exports[_0x77f4('0x1e')]=function(_0x236a67){var _0x5a05f3=this;return new Promise(function(_0x2f7bf9,_0x27d664){return db[_0x77f4('0x15')][_0x77f4('0x1f')]({'raw':_0x236a67[_0x77f4('0x17')]?_0x236a67[_0x77f4('0x17')][_0x77f4('0x18')]===undefined?!![]:![]:!![],'where':_0x236a67['options']?_0x236a67[_0x77f4('0x17')][_0x77f4('0x20')]||null:null,'attributes':_0x236a67['options']?_0x236a67[_0x77f4('0x17')][_0x77f4('0x19')]||null:null,'include':_0x236a67[_0x77f4('0x17')]?_0x236a67[_0x77f4('0x17')]['include']?_[_0x77f4('0x1d')](_0x236a67[_0x77f4('0x17')][_0x77f4('0x1b')],function(_0x2c749d){return{'model':db[_0x2c749d[_0x77f4('0x1c')]],'as':_0x2c749d['as'],'attributes':_0x2c749d['attributes'],'include':_0x2c749d[_0x77f4('0x1b')]?_[_0x77f4('0x1d')](_0x2c749d[_0x77f4('0x1b')],function(_0x2f59d2){return{'model':db[_0x2f59d2['model']],'as':_0x2f59d2['as'],'attributes':_0x2f59d2['attributes'],'include':_0x2f59d2[_0x77f4('0x1b')]?_[_0x77f4('0x1d')](_0x2f59d2[_0x77f4('0x1b')],function(_0x11599e){return{'model':db[_0x11599e[_0x77f4('0x1c')]],'as':_0x11599e['as'],'attributes':_0x11599e['attributes']};}):[]};}):[]};}):[]:[]})[_0x77f4('0x9')](function(_0x872266){logger[_0x77f4('0x12')](_0x77f4('0x1e'),_0x236a67);logger['debug'](_0x77f4('0x1e'),_0x236a67,JSON[_0x77f4('0xe')](_0x872266));_0x2f7bf9(_0x872266);})[_0x77f4('0x13')](function(_0x121026){logger['error'](_0x77f4('0x1e'),_0x121026['message'],_0x236a67);_0x27d664(_0x5a05f3[_0x77f4('0xf')](0x1f4,_0x121026['message']));});});};exports[_0x77f4('0x21')]=function(_0x4764d5){var _0x2c6f17=this;return new Promise(function(_0x2c7396,_0xa1e399){return db[_0x77f4('0x15')][_0x77f4('0x22')](_0x4764d5[_0x77f4('0x23')],{'raw':_0x4764d5[_0x77f4('0x17')]?_0x4764d5[_0x77f4('0x17')][_0x77f4('0x18')]===undefined?!![]:![]:!![]})[_0x77f4('0x9')](function(_0x47e131){logger['info']('CreateCmHopper',_0x4764d5);logger[_0x77f4('0xc')]('CreateCmHopper',_0x4764d5,JSON[_0x77f4('0xe')](_0x47e131));_0x2c7396(_0x47e131);})[_0x77f4('0x13')](function(_0x5aabc5){logger[_0x77f4('0xf')](_0x77f4('0x21'),_0x5aabc5[_0x77f4('0x11')],_0x4764d5);_0xa1e399(_0x2c6f17[_0x77f4('0xf')](0x1f4,_0x5aabc5[_0x77f4('0x11')]));});});};exports[_0x77f4('0x24')]=function(_0x8cda6f){var _0x2b04e8=this;return new Promise(function(_0x5b617c,_0x3d7d29){return db[_0x77f4('0x15')][_0x77f4('0x25')](_0x8cda6f[_0x77f4('0x23')],{'raw':_0x8cda6f[_0x77f4('0x17')]?_0x8cda6f[_0x77f4('0x17')][_0x77f4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8cda6f[_0x77f4('0x17')]?_0x8cda6f['options'][_0x77f4('0x20')]||null:null,'attributes':_0x8cda6f[_0x77f4('0x17')]?_0x8cda6f[_0x77f4('0x17')]['attributes']||null:null,'limit':_0x8cda6f[_0x77f4('0x17')]?_0x8cda6f['options'][_0x77f4('0x1a')]||null:null})[_0x77f4('0x9')](function(_0x27c32a){logger[_0x77f4('0x12')](_0x77f4('0x24'),_0x8cda6f);logger[_0x77f4('0x12')](_0x77f4('0x26'),JSON[_0x77f4('0xe')](_0x8cda6f[_0x77f4('0x17')][_0x77f4('0x20')]),_0x8cda6f[_0x77f4('0x23')][_0x77f4('0x27')]);logger[_0x77f4('0xc')]('UpdateCmHopper',_0x8cda6f,JSON[_0x77f4('0xe')](_0x27c32a));_0x5b617c(_0x27c32a);})['catch'](function(_0x2ade05){logger[_0x77f4('0xf')](_0x77f4('0x24'),_0x2ade05[_0x77f4('0x11')],_0x8cda6f);_0x3d7d29(_0x2b04e8[_0x77f4('0xf')](0x1f4,_0x2ade05['message']));});});};exports[_0x77f4('0x28')]=function(_0x2bb993){var _0x1e9259=this;return new Promise(function(_0x252bfd,_0x44ef94){return db['CmHopper'][_0x77f4('0x29')]({'where':_0x2bb993[_0x77f4('0x17')]?_0x2bb993['options']['where']||null:null})[_0x77f4('0x9')](function(_0x47c88f){logger[_0x77f4('0x12')](_0x77f4('0x28'),_0x2bb993);logger[_0x77f4('0xc')]('DestroyCmHopper',_0x2bb993,JSON[_0x77f4('0xe')](_0x47c88f));_0x252bfd(_0x47c88f);})[_0x77f4('0x13')](function(_0x56977c){logger['error'](_0x77f4('0x28'),_0x56977c[_0x77f4('0x11')],_0x2bb993);_0x44ef94(_0x1e9259[_0x77f4('0xf')](0x1f4,_0x56977c['message']));});});};exports['GetContactDialer']=function(_0x2acb83){var _0x259309=this;return new Promise(function(_0x8e9ee7,_0x54203d){return db[_0x77f4('0x2a')][_0x77f4('0x2b')]()[_0x77f4('0x9')](function(_0x288191){return db[_0x77f4('0x2c')][_0x77f4('0x2d')](function(_0x38d0b9){return db['CmHopper'][_0x77f4('0x16')]({'where':_0x2acb83[_0x77f4('0x17')]?_0x2acb83[_0x77f4('0x17')][_0x77f4('0x20')]||null:null,'attributes':_0x2acb83[_0x77f4('0x17')]?_0x2acb83[_0x77f4('0x17')][_0x77f4('0x19')]||null:null,'limit':_0x2acb83[_0x77f4('0x17')]?_0x2acb83[_0x77f4('0x17')]['limit']||null:null,'order':_0x2acb83[_0x77f4('0x17')]?_0x2acb83[_0x77f4('0x17')][_0x77f4('0x2e')]||null:null,'transaction':_0x38d0b9,'lock':_0x38d0b9[_0x77f4('0x2f')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_[_0x77f4('0x30')](_0x288191)},{'model':db[_0x77f4('0x31')],'as':_0x77f4('0x32'),'attributes':['id',_0x77f4('0x33'),'voicePause']}]})[_0x77f4('0x9')](function(_0x380e83){var _0xb78c09=[];var _0x24d4de=[];for(var _0x1fee91=0x0;_0x1fee91<_0x380e83[_0x77f4('0x34')];_0x1fee91+=0x1){var _0x1dd290=_0x380e83[_0x1fee91]['UserId'];if(_0x1dd290===null){_0xb78c09[_0x77f4('0x35')](_0x380e83[_0x1fee91][_0x77f4('0x25')](_0x2acb83[_0x77f4('0x23')],{'transaction':_0x38d0b9}));}else if(!_0x24d4de[_0x77f4('0x36')](_0x1dd290)){_0x24d4de[_0x77f4('0x35')](_0x1dd290);_0xb78c09[_0x77f4('0x35')](_0x380e83[_0x1fee91][_0x77f4('0x25')](_0x2acb83[_0x77f4('0x23')],{'transaction':_0x38d0b9}));}}return BPromise[_0x77f4('0x37')](_0xb78c09);});})[_0x77f4('0x9')](function(_0xd82fa0){logger['info'](_0x77f4('0x38'),_0x2acb83);if(_0xd82fa0[_0x77f4('0x34')]>0x0){logger['info']('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0xd82fa0[0x0]['dataValues']['id'],_0xd82fa0[0x0][_0x77f4('0x39')][_0x77f4('0x3a')],_0xd82fa0[0x0]['dataValues']['active']);}logger['debug'](_0x77f4('0x38'),_0x2acb83,JSON['stringify'](_0xd82fa0));_0x8e9ee7(_0xd82fa0);})[_0x77f4('0x13')](function(_0xcd42cc){logger[_0x77f4('0xf')](_0x77f4('0x38'),_0xcd42cc[_0x77f4('0x11')],_0x2acb83);_0x54203d(_0x259309[_0x77f4('0xf')](0x1f4,_0xcd42cc[_0x77f4('0x11')]));});});});};exports[_0x77f4('0x3b')]=function(_0x268f5b){var _0x2ff385=this;return new Promise(function(_0x3c153d,_0x355926){return db[_0x77f4('0x2c')][_0x77f4('0x2d')](function(_0x13fbdd){return db[_0x77f4('0x3c')][_0x77f4('0x22')](_0x268f5b[_0x77f4('0x23')],{'raw':_0x268f5b[_0x77f4('0x17')]?_0x268f5b[_0x77f4('0x17')]['raw']===undefined?!![]:![]:!![],'transaction':_0x13fbdd})[_0x77f4('0x9')](function(){logger['info'](_0x77f4('0x3d'),JSON[_0x77f4('0xe')](_0x268f5b[_0x77f4('0x17')]['where']),_0x268f5b[_0x77f4('0x17')][_0x77f4('0x20')][_0x77f4('0x27')]);return db[_0x77f4('0x15')][_0x77f4('0x29')]({'where':_0x268f5b[_0x77f4('0x17')]?_0x268f5b['options']['where']||null:null,'transaction':_0x13fbdd});});})['then'](function(_0x297bb5){logger[_0x77f4('0x12')](_0x77f4('0x3b'),_0x268f5b);logger[_0x77f4('0xc')]('MoveContactManagedDialer',_0x268f5b,JSON[_0x77f4('0xe')](_0x297bb5));_0x3c153d(_0x297bb5);})[_0x77f4('0x13')](function(_0x3ac749){logger[_0x77f4('0xf')](_0x77f4('0x3b'),_0x3ac749[_0x77f4('0x11')],_0x268f5b);_0x355926(_0x2ff385[_0x77f4('0xf')](0x1f4,_0x3ac749[_0x77f4('0x11')]));});});};exports['CountReScheduled']=function(_0x1b4960){var _0x3be3ca=this;return new Promise(function(_0x146be1,_0x5c3cad){return db[_0x77f4('0x15')][_0x77f4('0x16')]({'raw':_0x1b4960['options']?_0x1b4960['options'][_0x77f4('0x18')]===undefined?!![]:![]:!![],'where':_0x1b4960[_0x77f4('0x17')]?_0x1b4960[_0x77f4('0x17')][_0x77f4('0x20')]||null:null,'attributes':[[db[_0x77f4('0x2c')]['fn'](_0x77f4('0x3e'),db[_0x77f4('0x2c')]['fn']('IF',db[_0x77f4('0x2c')][_0x77f4('0x3f')](_0x77f4('0x40')+util['format'](_0x77f4('0x41'),moment()[_0x77f4('0x42')](_0x77f4('0x43')))+_0x77f4('0x44')))),_0x77f4('0x45')]]})[_0x77f4('0x9')](function(_0x2933fa){logger[_0x77f4('0x12')]('CountReScheduled',_0x1b4960);logger[_0x77f4('0xc')](_0x77f4('0x46'),_0x1b4960,JSON[_0x77f4('0xe')](_0x2933fa));_0x146be1(_0x2933fa);})[_0x77f4('0x13')](function(_0x8dc9a1){logger[_0x77f4('0xf')](_0x77f4('0x46'),_0x8dc9a1[_0x77f4('0x11')],_0x1b4960);_0x5c3cad(_0x3be3ca[_0x77f4('0xf')](0x1f4,_0x8dc9a1[_0x77f4('0x11')]));});});};exports[_0x77f4('0x47')]=function(_0x38fb75){var _0x1a104d=this;return new Promise(function(_0x10d94a,_0x334ec8){return db[_0x77f4('0x2a')][_0x77f4('0x2b')]()[_0x77f4('0x9')](function(_0x1a6e0f){return db['sequelize'][_0x77f4('0x2d')](function(_0x52bdc1){return db['CmHopper'][_0x77f4('0x16')]({'where':_0x38fb75[_0x77f4('0x17')]?_0x38fb75[_0x77f4('0x17')][_0x77f4('0x20')]||null:null,'attributes':_0x38fb75[_0x77f4('0x17')]?_0x38fb75[_0x77f4('0x17')][_0x77f4('0x19')]||null:null,'limit':0x1,'order':_0x38fb75[_0x77f4('0x17')]?_0x38fb75[_0x77f4('0x17')][_0x77f4('0x2e')]||null:null,'group':db['CmHopper'][_0x77f4('0x48')],'transaction':_0x52bdc1,'lock':_0x52bdc1[_0x77f4('0x2f')][_0x77f4('0x49')],'include':_0x38fb75[_0x77f4('0x17')]?_0x38fb75[_0x77f4('0x17')][_0x77f4('0x1b')]?_[_0x77f4('0x1d')](_0x38fb75[_0x77f4('0x17')]['include'],function(_0x5925de){return{'model':db[_0x5925de['model']],'as':_0x5925de['as'],'attributes':_0x5925de['attributes'],'include':_0x5925de[_0x77f4('0x1b')]?_[_0x77f4('0x1d')](_0x5925de[_0x77f4('0x1b')],function(_0x12bc07){return{'model':db[_0x12bc07['model']],'as':_0x12bc07['as'],'attributes':_0x12bc07[_0x77f4('0x19')],'include':_0x12bc07['include']?_['map'](_0x12bc07[_0x77f4('0x1b')],function(_0xbe7fdc){return{'model':db[_0xbe7fdc['model']],'as':_0xbe7fdc['as'],'attributes':_0xbe7fdc['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f04b8){var _0x5215a2=[];for(var _0x3b5664=0x0;_0x3b5664<_0x1f04b8['length'];_0x3b5664+=0x1){_0x5215a2[_0x77f4('0x35')](_0x1f04b8[_0x3b5664][_0x77f4('0x25')](_0x38fb75[_0x77f4('0x23')],{'transaction':_0x52bdc1}));}return BPromise[_0x77f4('0x37')](_0x5215a2);});})[_0x77f4('0x9')](function(_0x3e3bb0){logger['info'](_0x77f4('0x47'),_0x38fb75);logger[_0x77f4('0xc')](_0x77f4('0x47'),_0x38fb75,JSON[_0x77f4('0xe')](_0x3e3bb0));_0x10d94a(_0x3e3bb0);})['catch'](function(_0x50cd90){logger['error'](_0x77f4('0x47'),_0x50cd90[_0x77f4('0x11')],_0x38fb75);_0x334ec8(_0x1a104d[_0x77f4('0xf')](0x1f4,_0x50cd90[_0x77f4('0x11')]));});});});};exports[_0x77f4('0x4a')]=function(_0x3dab12){var _0x990f47=this;return new Promise(function(_0x3342a7,_0x5f3171){db[_0x77f4('0x2a')][_0x77f4('0x2b')]()[_0x77f4('0x9')](function(_0x4f704a){return db[_0x77f4('0x15')]['findAll']({'raw':_0x3dab12[_0x77f4('0x17')]?_0x3dab12['options'][_0x77f4('0x18')]===undefined?!![]:![]:!![],'where':_0x3dab12[_0x77f4('0x17')]?_0x3dab12[_0x77f4('0x17')][_0x77f4('0x20')]||null:null,'attributes':_0x3dab12['options']?_0x3dab12[_0x77f4('0x17')][_0x77f4('0x19')]||null:null,'limit':_0x3dab12['options']?_0x3dab12[_0x77f4('0x17')][_0x77f4('0x1a')]||null:null,'include':_0x3dab12[_0x77f4('0x17')]?_0x3dab12[_0x77f4('0x17')][_0x77f4('0x1b')]?_['map'](_0x3dab12['options'][_0x77f4('0x1b')],function(_0x42353d){return{'model':db[_0x42353d['model']],'as':_0x42353d['as'],'attributes':_0x42353d['as']===_0x77f4('0x4b')?_[_0x77f4('0x30')](_0x4f704a):_0x42353d['attributes'],'include':_0x42353d[_0x77f4('0x1b')]?_[_0x77f4('0x1d')](_0x42353d[_0x77f4('0x1b')],function(_0xa759c5){return{'model':db[_0xa759c5[_0x77f4('0x1c')]],'as':_0xa759c5['as'],'attributes':_0xa759c5[_0x77f4('0x19')],'include':_0xa759c5[_0x77f4('0x1b')]?_[_0x77f4('0x1d')](_0xa759c5[_0x77f4('0x1b')],function(_0x226456){return{'model':db[_0x226456[_0x77f4('0x1c')]],'as':_0x226456['as'],'attributes':_0x226456[_0x77f4('0x19')]};}):[]};}):[]};}):[]:[]})[_0x77f4('0x9')](function(_0x300b34){logger[_0x77f4('0x12')](_0x77f4('0x14'),_0x3dab12);logger[_0x77f4('0xc')](_0x77f4('0x14'),_0x3dab12,JSON[_0x77f4('0xe')](_0x300b34));_0x3342a7(_0x300b34);})[_0x77f4('0x13')](function(_0x5d1c34){logger[_0x77f4('0xf')](_0x77f4('0x14'),_0x5d1c34[_0x77f4('0x11')],_0x3dab12);_0x5f3171(_0x990f47[_0x77f4('0xf')](0x1f4,_0x5d1c34['message']));});});});};exports[_0x77f4('0x4c')]=function(_0x3bceb2){var _0x27d410=this;return new Promise(function(_0x1a9379,_0x49b30d){return db[_0x77f4('0x2c')][_0x77f4('0x2d')](function(_0x2b8c0f){return db[_0x77f4('0x15')][_0x77f4('0x25')]({'active':![]},{'where':{},'transaction':_0x2b8c0f})[_0x77f4('0x9')](function(_0x562006){logger[_0x77f4('0x12')](_0x77f4('0x4c'),_0x3bceb2);logger[_0x77f4('0xc')](_0x77f4('0x4c'),_0x3bceb2,JSON[_0x77f4('0xe')](_0x562006));_0x1a9379(_0x562006);})['catch'](function(_0x40fdd7){logger[_0x77f4('0xf')](_0x77f4('0x4c'),_0x40fdd7['message'],_0x3bceb2);_0x49b30d(_0x27d410[_0x77f4('0xf')](0x1f4,_0x40fdd7[_0x77f4('0x11')]));});});});}; \ No newline at end of file +var _0x0142=['CmHopper','findAll','options','raw','attributes','limit','include','model','map','stringify','catch','ShowCmHopper','info','CreateCmHopper','body','where','UpdateCmHopper','active','DestroyCmHopper','CmContact','describe','sequelize','transaction','LOCK','UPDATE','Contact','keys','User','name','voicePause','UserId','push','update','includes','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','GetContactDialer','MoveContactManagedDialer','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','CountReScheduled','COUNT','literal','\x22%s\x22','format','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','ResetActiveCalls','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','code','CmHopper,\x20%s,\x20%s','message','GetCmHopper'];(function(_0x3af572,_0xd8024b){var _0x9ad1c9=function(_0x1e979e){while(--_0x1e979e){_0x3af572['push'](_0x3af572['shift']());}};_0x9ad1c9(++_0xd8024b);}(_0x0142,0x1f2));var _0x2014=function(_0x48a96f,_0x530059){_0x48a96f=_0x48a96f-0x0;var _0x3ff3ef=_0x0142[_0x48a96f];return _0x3ff3ef;};'use strict';var _=require(_0x2014('0x0'));var util=require('util');var moment=require(_0x2014('0x1'));var BPromise=require(_0x2014('0x2'));var rs=require(_0x2014('0x3'));var fs=require('fs');var Redis=require(_0x2014('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2014('0x5'))(_0x2014('0x6'));var config=require('../../config/environment');var jayson=require(_0x2014('0x7'));var client=jayson[_0x2014('0x8')][_0x2014('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x432803,_0x13d922,_0x4df817){return new BPromise(function(_0x325b90,_0x29573b){return client[_0x2014('0xa')](_0x432803,_0x4df817)[_0x2014('0xb')](function(_0x302d00){logger['info']('CmHopper,\x20%s,\x20%s',_0x13d922,_0x2014('0xc'));logger[_0x2014('0xd')](_0x2014('0xe'),_0x13d922,_0x2014('0xc'),JSON['stringify'](_0x302d00));if(_0x302d00[_0x2014('0xf')]){if(_0x302d00[_0x2014('0xf')][_0x2014('0x10')]===0x1f4){logger[_0x2014('0xf')](_0x2014('0x11'),_0x13d922,_0x302d00['error'][_0x2014('0x12')]);return _0x29573b(_0x302d00[_0x2014('0xf')][_0x2014('0x12')]);}logger['error'](_0x2014('0x11'),_0x13d922,_0x302d00['error'][_0x2014('0x12')]);return _0x325b90(_0x302d00['error'][_0x2014('0x12')]);}else{logger['info'](_0x2014('0x11'),_0x13d922,'request\x20sent');_0x325b90(_0x302d00['result'][_0x2014('0x12')]);}})['catch'](function(_0x4ceaef){logger[_0x2014('0xf')](_0x2014('0x11'),_0x13d922,_0x4ceaef);_0x29573b(_0x4ceaef);});});}exports[_0x2014('0x13')]=function(_0x501d82){var _0x44d735=this;return new Promise(function(_0x47e36d,_0x1d05aa){return db[_0x2014('0x14')][_0x2014('0x15')]({'raw':_0x501d82['options']?_0x501d82[_0x2014('0x16')][_0x2014('0x17')]===undefined?!![]:![]:!![],'where':_0x501d82['options']?_0x501d82[_0x2014('0x16')]['where']||null:null,'attributes':_0x501d82[_0x2014('0x16')]?_0x501d82[_0x2014('0x16')][_0x2014('0x18')]||null:null,'limit':_0x501d82[_0x2014('0x16')]?_0x501d82[_0x2014('0x16')][_0x2014('0x19')]||null:null,'include':_0x501d82[_0x2014('0x16')]?_0x501d82['options']['include']?_['map'](_0x501d82[_0x2014('0x16')][_0x2014('0x1a')],function(_0x316e0b){return{'model':db[_0x316e0b[_0x2014('0x1b')]],'as':_0x316e0b['as'],'attributes':_0x316e0b[_0x2014('0x18')],'include':_0x316e0b[_0x2014('0x1a')]?_[_0x2014('0x1c')](_0x316e0b['include'],function(_0x419682){return{'model':db[_0x419682[_0x2014('0x1b')]],'as':_0x419682['as'],'attributes':_0x419682[_0x2014('0x18')],'include':_0x419682[_0x2014('0x1a')]?_[_0x2014('0x1c')](_0x419682[_0x2014('0x1a')],function(_0x36575a){return{'model':db[_0x36575a[_0x2014('0x1b')]],'as':_0x36575a['as'],'attributes':_0x36575a[_0x2014('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x33bfb9){logger['info']('GetCmHopper',_0x501d82);logger['debug']('GetCmHopper',_0x501d82,JSON[_0x2014('0x1d')](_0x33bfb9));_0x47e36d(_0x33bfb9);})[_0x2014('0x1e')](function(_0x5d190b){logger[_0x2014('0xf')]('GetCmHopper',_0x5d190b[_0x2014('0x12')],_0x501d82);_0x1d05aa(_0x44d735['error'](0x1f4,_0x5d190b[_0x2014('0x12')]));});});};exports[_0x2014('0x1f')]=function(_0x81d538){var _0x1f4b19=this;return new Promise(function(_0x3a8714,_0x36435a){return db['CmHopper']['find']({'raw':_0x81d538[_0x2014('0x16')]?_0x81d538['options'][_0x2014('0x17')]===undefined?!![]:![]:!![],'where':_0x81d538[_0x2014('0x16')]?_0x81d538[_0x2014('0x16')]['where']||null:null,'attributes':_0x81d538[_0x2014('0x16')]?_0x81d538[_0x2014('0x16')][_0x2014('0x18')]||null:null,'include':_0x81d538[_0x2014('0x16')]?_0x81d538[_0x2014('0x16')][_0x2014('0x1a')]?_[_0x2014('0x1c')](_0x81d538[_0x2014('0x16')][_0x2014('0x1a')],function(_0x3ed4ec){return{'model':db[_0x3ed4ec['model']],'as':_0x3ed4ec['as'],'attributes':_0x3ed4ec['attributes'],'include':_0x3ed4ec['include']?_[_0x2014('0x1c')](_0x3ed4ec['include'],function(_0x3d17bc){return{'model':db[_0x3d17bc['model']],'as':_0x3d17bc['as'],'attributes':_0x3d17bc['attributes'],'include':_0x3d17bc[_0x2014('0x1a')]?_[_0x2014('0x1c')](_0x3d17bc['include'],function(_0x47aa4e){return{'model':db[_0x47aa4e[_0x2014('0x1b')]],'as':_0x47aa4e['as'],'attributes':_0x47aa4e['attributes']};}):[]};}):[]};}):[]:[]})[_0x2014('0xb')](function(_0x13330b){logger[_0x2014('0x20')]('ShowCmHopper',_0x81d538);logger[_0x2014('0xd')](_0x2014('0x1f'),_0x81d538,JSON[_0x2014('0x1d')](_0x13330b));_0x3a8714(_0x13330b);})[_0x2014('0x1e')](function(_0x4c4ccd){logger[_0x2014('0xf')]('ShowCmHopper',_0x4c4ccd['message'],_0x81d538);_0x36435a(_0x1f4b19[_0x2014('0xf')](0x1f4,_0x4c4ccd['message']));});});};exports[_0x2014('0x21')]=function(_0x1cae32){var _0x134904=this;return new Promise(function(_0x317ba6,_0x3a64c0){return db[_0x2014('0x14')]['create'](_0x1cae32[_0x2014('0x22')],{'raw':_0x1cae32['options']?_0x1cae32[_0x2014('0x16')][_0x2014('0x17')]===undefined?!![]:![]:!![]})[_0x2014('0xb')](function(_0x23d918){logger['info']('CreateCmHopper',_0x1cae32);logger[_0x2014('0xd')]('CreateCmHopper',_0x1cae32,JSON[_0x2014('0x1d')](_0x23d918));_0x317ba6(_0x23d918);})[_0x2014('0x1e')](function(_0x1ba7fc){logger[_0x2014('0xf')](_0x2014('0x21'),_0x1ba7fc[_0x2014('0x12')],_0x1cae32);_0x3a64c0(_0x134904[_0x2014('0xf')](0x1f4,_0x1ba7fc[_0x2014('0x12')]));});});};exports['UpdateCmHopper']=function(_0x25d615){var _0x2859c1=this;return new Promise(function(_0x312cda,_0x541ca9){return db[_0x2014('0x14')]['update'](_0x25d615[_0x2014('0x22')],{'raw':_0x25d615[_0x2014('0x16')]?_0x25d615[_0x2014('0x16')][_0x2014('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25d615[_0x2014('0x16')]?_0x25d615[_0x2014('0x16')][_0x2014('0x23')]||null:null,'attributes':_0x25d615['options']?_0x25d615[_0x2014('0x16')][_0x2014('0x18')]||null:null,'limit':_0x25d615[_0x2014('0x16')]?_0x25d615['options'][_0x2014('0x19')]||null:null})[_0x2014('0xb')](function(_0x5f34d3){logger[_0x2014('0x20')](_0x2014('0x24'),_0x25d615);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x2014('0x1d')](_0x25d615[_0x2014('0x16')]['where']),_0x25d615['body'][_0x2014('0x25')]);logger['debug'](_0x2014('0x24'),_0x25d615,JSON[_0x2014('0x1d')](_0x5f34d3));_0x312cda(_0x5f34d3);})[_0x2014('0x1e')](function(_0x2b2656){logger['error'](_0x2014('0x24'),_0x2b2656['message'],_0x25d615);_0x541ca9(_0x2859c1[_0x2014('0xf')](0x1f4,_0x2b2656[_0x2014('0x12')]));});});};exports['DestroyCmHopper']=function(_0x4a2379){var _0x2deed2=this;return new Promise(function(_0x3fc803,_0x27f600){return db[_0x2014('0x14')]['destroy']({'where':_0x4a2379[_0x2014('0x16')]?_0x4a2379[_0x2014('0x16')][_0x2014('0x23')]||null:null})[_0x2014('0xb')](function(_0xcc93b7){logger['info']('DestroyCmHopper',_0x4a2379);logger[_0x2014('0xd')](_0x2014('0x26'),_0x4a2379,JSON['stringify'](_0xcc93b7));_0x3fc803(_0xcc93b7);})['catch'](function(_0xa8d9f5){logger[_0x2014('0xf')](_0x2014('0x26'),_0xa8d9f5[_0x2014('0x12')],_0x4a2379);_0x27f600(_0x2deed2[_0x2014('0xf')](0x1f4,_0xa8d9f5[_0x2014('0x12')]));});});};exports['GetContactDialer']=function(_0x5ab34d){var _0x20ad06=this;return new Promise(function(_0x5cdddb,_0x1f38de){return db[_0x2014('0x27')][_0x2014('0x28')]()['then'](function(_0x541fa8){return db[_0x2014('0x29')][_0x2014('0x2a')](function(_0x3b2535){return db[_0x2014('0x14')][_0x2014('0x15')]({'where':_0x5ab34d[_0x2014('0x16')]?_0x5ab34d[_0x2014('0x16')][_0x2014('0x23')]||null:null,'attributes':_0x5ab34d[_0x2014('0x16')]?_0x5ab34d[_0x2014('0x16')]['attributes']||null:null,'limit':_0x5ab34d['options']?_0x5ab34d[_0x2014('0x16')][_0x2014('0x19')]||null:null,'order':_0x5ab34d[_0x2014('0x16')]?_0x5ab34d[_0x2014('0x16')]['order']||null:null,'transaction':_0x3b2535,'lock':_0x3b2535[_0x2014('0x2b')][_0x2014('0x2c')],'include':[{'model':db['CmContact'],'as':_0x2014('0x2d'),'attributes':_[_0x2014('0x2e')](_0x541fa8)},{'model':db[_0x2014('0x2f')],'as':'Agent','attributes':['id',_0x2014('0x30'),_0x2014('0x31')]}]})[_0x2014('0xb')](function(_0x33dfe5){var _0x11c1df=[];var _0x1bf77c=[];for(var _0x2be4ff=0x0;_0x2be4ff<_0x33dfe5['length'];_0x2be4ff+=0x1){var _0x37200e=_0x33dfe5[_0x2be4ff][_0x2014('0x32')];if(_0x37200e===null){_0x11c1df[_0x2014('0x33')](_0x33dfe5[_0x2be4ff][_0x2014('0x34')](_0x5ab34d[_0x2014('0x22')],{'transaction':_0x3b2535}));}else if(!_0x1bf77c[_0x2014('0x35')](_0x37200e)){_0x1bf77c['push'](_0x37200e);_0x11c1df[_0x2014('0x33')](_0x33dfe5[_0x2be4ff][_0x2014('0x34')](_0x5ab34d[_0x2014('0x22')],{'transaction':_0x3b2535}));}}return BPromise[_0x2014('0x36')](_0x11c1df);});})[_0x2014('0xb')](function(_0x26b2a4){logger[_0x2014('0x20')]('GetContactDialer',_0x5ab34d);if(_0x26b2a4[_0x2014('0x37')]>0x0){logger[_0x2014('0x20')](_0x2014('0x38'),_0x26b2a4[0x0][_0x2014('0x39')]['id'],_0x26b2a4[0x0][_0x2014('0x39')][_0x2014('0x3a')],_0x26b2a4[0x0][_0x2014('0x39')][_0x2014('0x25')]);}logger[_0x2014('0xd')](_0x2014('0x3b'),_0x5ab34d,JSON[_0x2014('0x1d')](_0x26b2a4));_0x5cdddb(_0x26b2a4);})['catch'](function(_0x488644){logger[_0x2014('0xf')]('GetContactDialer',_0x488644['message'],_0x5ab34d);_0x1f38de(_0x20ad06[_0x2014('0xf')](0x1f4,_0x488644[_0x2014('0x12')]));});});});};exports[_0x2014('0x3c')]=function(_0x39d3f4){var _0x277178=this;return new Promise(function(_0x117a25,_0x4e436e){return db[_0x2014('0x29')][_0x2014('0x2a')](function(_0x282fdc){return db['CmHopperFinal'][_0x2014('0x3d')](_0x39d3f4[_0x2014('0x22')],{'raw':_0x39d3f4[_0x2014('0x16')]?_0x39d3f4[_0x2014('0x16')]['raw']===undefined?!![]:![]:!![],'transaction':_0x282fdc})['then'](function(){logger[_0x2014('0x20')](_0x2014('0x3e'),JSON['stringify'](_0x39d3f4[_0x2014('0x16')][_0x2014('0x23')]),_0x39d3f4[_0x2014('0x16')][_0x2014('0x23')]['active']);return db[_0x2014('0x14')][_0x2014('0x3f')]({'where':_0x39d3f4['options']?_0x39d3f4[_0x2014('0x16')]['where']||null:null,'transaction':_0x282fdc});});})[_0x2014('0xb')](function(_0x29fd2f){logger[_0x2014('0x20')](_0x2014('0x3c'),_0x39d3f4);logger[_0x2014('0xd')]('MoveContactManagedDialer',_0x39d3f4,JSON['stringify'](_0x29fd2f));_0x117a25(_0x29fd2f);})[_0x2014('0x1e')](function(_0x1cfafe){logger[_0x2014('0xf')](_0x2014('0x3c'),_0x1cfafe[_0x2014('0x12')],_0x39d3f4);_0x4e436e(_0x277178[_0x2014('0xf')](0x1f4,_0x1cfafe[_0x2014('0x12')]));});});};exports[_0x2014('0x40')]=function(_0x1e0ef0){var _0x4babaf=this;return new Promise(function(_0x341f20,_0x2f3e65){return db['CmHopper'][_0x2014('0x15')]({'raw':_0x1e0ef0[_0x2014('0x16')]?_0x1e0ef0[_0x2014('0x16')][_0x2014('0x17')]===undefined?!![]:![]:!![],'where':_0x1e0ef0[_0x2014('0x16')]?_0x1e0ef0['options'][_0x2014('0x23')]||null:null,'attributes':[[db[_0x2014('0x29')]['fn'](_0x2014('0x41'),db[_0x2014('0x29')]['fn']('IF',db[_0x2014('0x29')][_0x2014('0x42')]('`scheduledat`\x20>=\x20'+util['format'](_0x2014('0x43'),moment()[_0x2014('0x44')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x2014('0x45')))),_0x2014('0x46')]]})[_0x2014('0xb')](function(_0xf4e5ad){logger[_0x2014('0x20')]('CountReScheduled',_0x1e0ef0);logger['debug'](_0x2014('0x40'),_0x1e0ef0,JSON[_0x2014('0x1d')](_0xf4e5ad));_0x341f20(_0xf4e5ad);})[_0x2014('0x1e')](function(_0x166f0e){logger[_0x2014('0xf')]('CountReScheduled',_0x166f0e[_0x2014('0x12')],_0x1e0ef0);_0x2f3e65(_0x4babaf[_0x2014('0xf')](0x1f4,_0x166f0e[_0x2014('0x12')]));});});};exports[_0x2014('0x47')]=function(_0x4a5a09){var _0x40a966=this;return new Promise(function(_0x5980af,_0x4c5f49){return db[_0x2014('0x27')][_0x2014('0x28')]()[_0x2014('0xb')](function(_0x5dc8d5){return db[_0x2014('0x29')][_0x2014('0x2a')](function(_0x461216){return db[_0x2014('0x14')][_0x2014('0x15')]({'where':_0x4a5a09['options']?_0x4a5a09['options'][_0x2014('0x23')]||null:null,'attributes':_0x4a5a09[_0x2014('0x16')]?_0x4a5a09[_0x2014('0x16')]['attributes']||null:null,'limit':0x1,'order':_0x4a5a09[_0x2014('0x16')]?_0x4a5a09['options'][_0x2014('0x48')]||null:null,'group':db[_0x2014('0x14')][_0x2014('0x32')],'transaction':_0x461216,'lock':_0x461216[_0x2014('0x2b')][_0x2014('0x2c')],'include':_0x4a5a09[_0x2014('0x16')]?_0x4a5a09[_0x2014('0x16')][_0x2014('0x1a')]?_[_0x2014('0x1c')](_0x4a5a09[_0x2014('0x16')]['include'],function(_0x5f45d6){return{'model':db[_0x5f45d6[_0x2014('0x1b')]],'as':_0x5f45d6['as'],'attributes':_0x5f45d6[_0x2014('0x18')],'include':_0x5f45d6['include']?_[_0x2014('0x1c')](_0x5f45d6[_0x2014('0x1a')],function(_0x53427f){return{'model':db[_0x53427f[_0x2014('0x1b')]],'as':_0x53427f['as'],'attributes':_0x53427f['attributes'],'include':_0x53427f[_0x2014('0x1a')]?_[_0x2014('0x1c')](_0x53427f[_0x2014('0x1a')],function(_0x5d1f69){return{'model':db[_0x5d1f69['model']],'as':_0x5d1f69['as'],'attributes':_0x5d1f69[_0x2014('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2014('0xb')](function(_0x21b668){var _0x518383=[];for(var _0x1cc93f=0x0;_0x1cc93f<_0x21b668[_0x2014('0x37')];_0x1cc93f+=0x1){_0x518383[_0x2014('0x33')](_0x21b668[_0x1cc93f][_0x2014('0x34')](_0x4a5a09[_0x2014('0x22')],{'transaction':_0x461216}));}return BPromise[_0x2014('0x36')](_0x518383);});})[_0x2014('0xb')](function(_0xa9b33c){logger['info'](_0x2014('0x47'),_0x4a5a09);logger[_0x2014('0xd')](_0x2014('0x47'),_0x4a5a09,JSON['stringify'](_0xa9b33c));_0x5980af(_0xa9b33c);})['catch'](function(_0x2a893b){logger['error']('GetContactRecallMe',_0x2a893b[_0x2014('0x12')],_0x4a5a09);_0x4c5f49(_0x40a966[_0x2014('0xf')](0x1f4,_0x2a893b['message']));});});});};exports['GetCmHopperPreview']=function(_0x532bac){var _0x1f0b21=this;return new Promise(function(_0x3c91ac,_0x30d68c){db[_0x2014('0x27')][_0x2014('0x28')]()['then'](function(_0x3f6f3f){return db['CmHopper'][_0x2014('0x15')]({'raw':_0x532bac[_0x2014('0x16')]?_0x532bac[_0x2014('0x16')][_0x2014('0x17')]===undefined?!![]:![]:!![],'where':_0x532bac['options']?_0x532bac['options'][_0x2014('0x23')]||null:null,'attributes':_0x532bac[_0x2014('0x16')]?_0x532bac[_0x2014('0x16')][_0x2014('0x18')]||null:null,'limit':_0x532bac[_0x2014('0x16')]?_0x532bac[_0x2014('0x16')][_0x2014('0x19')]||null:null,'include':_0x532bac[_0x2014('0x16')]?_0x532bac[_0x2014('0x16')][_0x2014('0x1a')]?_[_0x2014('0x1c')](_0x532bac[_0x2014('0x16')][_0x2014('0x1a')],function(_0x429ef8){return{'model':db[_0x429ef8['model']],'as':_0x429ef8['as'],'attributes':_0x429ef8['as']===_0x2014('0x2d')?_[_0x2014('0x2e')](_0x3f6f3f):_0x429ef8[_0x2014('0x18')],'include':_0x429ef8[_0x2014('0x1a')]?_[_0x2014('0x1c')](_0x429ef8[_0x2014('0x1a')],function(_0x209ce1){return{'model':db[_0x209ce1[_0x2014('0x1b')]],'as':_0x209ce1['as'],'attributes':_0x209ce1['attributes'],'include':_0x209ce1[_0x2014('0x1a')]?_['map'](_0x209ce1[_0x2014('0x1a')],function(_0x124345){return{'model':db[_0x124345['model']],'as':_0x124345['as'],'attributes':_0x124345[_0x2014('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2014('0xb')](function(_0x27d2d4){logger[_0x2014('0x20')]('GetCmHopper',_0x532bac);logger['debug'](_0x2014('0x13'),_0x532bac,JSON[_0x2014('0x1d')](_0x27d2d4));_0x3c91ac(_0x27d2d4);})[_0x2014('0x1e')](function(_0x577926){logger[_0x2014('0xf')](_0x2014('0x13'),_0x577926[_0x2014('0x12')],_0x532bac);_0x30d68c(_0x1f0b21['error'](0x1f4,_0x577926[_0x2014('0x12')]));});});});};exports['ResetActiveCalls']=function(_0x5253f4){var _0x49b806=this;return new Promise(function(_0x552da6,_0x5c8d02){return db[_0x2014('0x29')]['transaction'](function(_0x3ebb8f){return db[_0x2014('0x14')][_0x2014('0x34')]({'active':![]},{'where':{},'transaction':_0x3ebb8f})['then'](function(_0x197149){logger['info']('ResetActiveCalls',_0x5253f4);logger[_0x2014('0xd')]('ResetActiveCalls',_0x5253f4,JSON[_0x2014('0x1d')](_0x197149));_0x552da6(_0x197149);})[_0x2014('0x1e')](function(_0x1d6051){logger[_0x2014('0xf')](_0x2014('0x49'),_0x1d6051[_0x2014('0x12')],_0x5253f4);_0x5c8d02(_0x49b806['error'](0x1f4,_0x1d6051[_0x2014('0x12')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index d86b040..639b316 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 _0x5b7e=['post','create','/preview','getPreview','put','/:id','update','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','index','/describe','isAuthenticated','/opencontacts','getOpenContacts','show'];(function(_0x21ae79,_0x3dc0ce){var _0x209a3a=function(_0x226911){while(--_0x226911){_0x21ae79['push'](_0x21ae79['shift']());}};_0x209a3a(++_0x3dc0ce);}(_0x5b7e,0x80));var _0xe5b7=function(_0x51b241,_0x187fab){_0x51b241=_0x51b241-0x0;var _0x16a3a7=_0x5b7e[_0x51b241];return _0x16a3a7;};'use strict';var multer=require(_0xe5b7('0x0'));var util=require(_0xe5b7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe5b7('0x2'));var router=express[_0xe5b7('0x3')]();var fs_extra=require(_0xe5b7('0x4'));var auth=require(_0xe5b7('0x5'));var interaction=require(_0xe5b7('0x6'));var config=require(_0xe5b7('0x7'));var controller=require(_0xe5b7('0x8'));router[_0xe5b7('0x9')]('/',auth['isAuthenticated'](),controller[_0xe5b7('0xa')]);router[_0xe5b7('0x9')](_0xe5b7('0xb'),auth[_0xe5b7('0xc')](),controller['describe']);router[_0xe5b7('0x9')](_0xe5b7('0xd'),auth[_0xe5b7('0xc')](),controller[_0xe5b7('0xe')]);router[_0xe5b7('0x9')]('/:id',auth[_0xe5b7('0xc')](),controller[_0xe5b7('0xf')]);router[_0xe5b7('0x10')]('/',auth['isAuthenticated'](),controller[_0xe5b7('0x11')]);router['post'](_0xe5b7('0x12'),auth[_0xe5b7('0xc')](),controller[_0xe5b7('0x13')]);router[_0xe5b7('0x14')](_0xe5b7('0x15'),auth[_0xe5b7('0xc')](),controller[_0xe5b7('0x16')]);router['delete'](_0xe5b7('0x15'),auth[_0xe5b7('0xc')](),controller['destroy']);module[_0xe5b7('0x17')]=router; \ No newline at end of file +var _0x5f27=['create','getPreview','put','/:id','update','destroy','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','post'];(function(_0x2f0f56,_0x3586ed){var _0x2e232b=function(_0x59c819){while(--_0x59c819){_0x2f0f56['push'](_0x2f0f56['shift']());}};_0x2e232b(++_0x3586ed);}(_0x5f27,0xd8));var _0x75f2=function(_0x35bce8,_0x3b94e6){_0x35bce8=_0x35bce8-0x0;var _0x50e1cc=_0x5f27[_0x35bce8];return _0x50e1cc;};'use strict';var multer=require(_0x75f2('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75f2('0x1'));var router=express[_0x75f2('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x75f2('0x3'));var interaction=require(_0x75f2('0x4'));var config=require(_0x75f2('0x5'));var controller=require(_0x75f2('0x6'));router[_0x75f2('0x7')]('/',auth[_0x75f2('0x8')](),controller[_0x75f2('0x9')]);router[_0x75f2('0x7')](_0x75f2('0xa'),auth[_0x75f2('0x8')](),controller[_0x75f2('0xb')]);router['get'](_0x75f2('0xc'),auth['isAuthenticated'](),controller[_0x75f2('0xd')]);router['get']('/:id',auth[_0x75f2('0x8')](),controller['show']);router[_0x75f2('0xe')]('/',auth[_0x75f2('0x8')](),controller[_0x75f2('0xf')]);router[_0x75f2('0xe')]('/preview',auth[_0x75f2('0x8')](),controller[_0x75f2('0x10')]);router[_0x75f2('0x11')](_0x75f2('0x12'),auth[_0x75f2('0x8')](),controller[_0x75f2('0x13')]);router['delete'](_0x75f2('0x12'),auth[_0x75f2('0x8')](),controller[_0x75f2('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index efd6d82..edca85a 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 _0xc27a=['INTEGER','contactListQueue','exports'];(function(_0x4a14dd,_0x4a87f3){var _0x3bb150=function(_0x1b6195){while(--_0x1b6195){_0x4a14dd['push'](_0x4a14dd['shift']());}};_0x3bb150(++_0x4a87f3);}(_0xc27a,0x1b2));var _0xac27=function(_0x2e3545,_0x20a6ec){_0x2e3545=_0x2e3545-0x0;var _0xcf18f=_0xc27a[_0x2e3545];return _0xcf18f;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xac27('0x0')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xac27('0x1')],'unique':_0xac27('0x2')},'ListId':{'type':Sequelize[_0xac27('0x1')],'unique':_0xac27('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xac27('0x2')}}; \ No newline at end of file +var _0x1c9a=['STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0xcedb41,_0x48b5d6){var _0x183200=function(_0x34a4ff){while(--_0x34a4ff){_0xcedb41['push'](_0xcedb41['shift']());}};_0x183200(++_0x48b5d6);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x445d43,_0x27f688){_0x445d43=_0x445d43-0x0;var _0x5778fd=_0x1c9a[_0x445d43];return _0x5778fd;};'use strict';var moment=require(_0xa1c9('0x0'));var Sequelize=require(_0xa1c9('0x1'));module['exports']={'phone':{'type':Sequelize[_0xa1c9('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xa1c9('0x3')],'unique':_0xa1c9('0x4')},'ListId':{'type':Sequelize[_0xa1c9('0x3')],'unique':_0xa1c9('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xa1c9('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 816554f..f73a6f3 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 _0x01f7=['Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','CmHopperBlack','rawAttributes','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','catch','params','find','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set'];(function(_0xd82049,_0x19aab3){var _0xe63a49=function(_0x579cb1){while(--_0x579cb1){_0xd82049['push'](_0xd82049['shift']());}};_0xe63a49(++_0x19aab3);}(_0x01f7,0x6d));var _0x701f=function(_0x34c553,_0x3e7dfc){_0x34c553=_0x34c553-0x0;var _0x1357d2=_0x01f7[_0x34c553];return _0x1357d2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x701f('0x0'));var zipdir=require(_0x701f('0x1'));var jsonpatch=require(_0x701f('0x2'));var rp=require(_0x701f('0x3'));var moment=require(_0x701f('0x4'));var BPromise=require(_0x701f('0x5'));var Mustache=require('mustache');var util=require(_0x701f('0x6'));var path=require('path');var sox=require(_0x701f('0x7'));var csv=require(_0x701f('0x8'));var ejs=require(_0x701f('0x9'));var fs=require('fs');var fs_extra=require(_0x701f('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x701f('0xb'));var deskjs=require(_0x701f('0xc'));var toCsv=require(_0x701f('0x8'));var querystring=require(_0x701f('0xd'));var Papa=require(_0x701f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x701f('0xf'));var as=require(_0x701f('0x10'));var hardwareService=require(_0x701f('0x11'));var logger=require(_0x701f('0x12'))(_0x701f('0x13'));var utils=require('../../config/utils');var config=require(_0x701f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x701f('0x15'))['db'];function respondWithStatusCode(_0x459ce0,_0xcbc378){_0xcbc378=_0xcbc378||0xcc;return function(_0x1ed382){if(_0x1ed382){return _0x459ce0[_0x701f('0x16')](_0xcbc378);}return _0x459ce0[_0x701f('0x17')](_0xcbc378)['end']();};}function respondWithResult(_0x121b4d,_0x4e290a){_0x4e290a=_0x4e290a||0xc8;return function(_0x2a2a32){if(_0x2a2a32){return _0x121b4d[_0x701f('0x17')](_0x4e290a)['json'](_0x2a2a32);}};}function respondWithFilteredResult(_0x445190,_0xed6e1a){return function(_0x4df2c7){if(_0x4df2c7){var _0x16ba65=typeof _0xed6e1a['offset']===_0x701f('0x18')&&typeof _0xed6e1a[_0x701f('0x19')]==='undefined';var _0x37b217=_0x4df2c7[_0x701f('0x1a')];var _0x5afecf=_0x16ba65?0x0:_0xed6e1a['offset'];var _0x5aa48=_0x16ba65?_0x4df2c7[_0x701f('0x1a')]:_0xed6e1a[_0x701f('0x1b')]+_0xed6e1a[_0x701f('0x19')];var _0x2a096d;if(_0x5aa48>=_0x37b217){_0x5aa48=_0x37b217;_0x2a096d=0xc8;}else{_0x2a096d=0xce;}_0x445190['status'](_0x2a096d);return _0x445190[_0x701f('0x1c')](_0x701f('0x1d'),_0x5afecf+'-'+_0x5aa48+'/'+_0x37b217)['json'](_0x4df2c7);}return null;};}function patchUpdates(_0x2d5350){return function(_0x4785ef){try{jsonpatch[_0x701f('0x1e')](_0x4785ef,_0x2d5350,!![]);}catch(_0x34d9cb){return BPromise['reject'](_0x34d9cb);}return _0x4785ef[_0x701f('0x1f')]();};}function saveUpdates(_0x16baac,_0x1e6671){return function(_0x266894){if(_0x266894){return _0x266894[_0x701f('0x20')](_0x16baac)[_0x701f('0x21')](function(_0x5179f8){return _0x5179f8;});}return null;};}function removeEntity(_0x1a86f7,_0x27ecc3){return function(_0x1ed259){if(_0x1ed259){return _0x1ed259[_0x701f('0x22')]()['then'](function(){_0x1a86f7[_0x701f('0x17')](0xcc)[_0x701f('0x23')]();});}};}function handleEntityNotFound(_0x31902c,_0x38411f){return function(_0x5f205d){if(!_0x5f205d){_0x31902c[_0x701f('0x16')](0x194);}return _0x5f205d;};}function handleError(_0x12bd51,_0x1bd077){_0x1bd077=_0x1bd077||0x1f4;return function(_0x15cf86){logger[_0x701f('0x24')](_0x15cf86[_0x701f('0x25')]);if(_0x15cf86[_0x701f('0x26')]){delete _0x15cf86[_0x701f('0x26')];}_0x12bd51[_0x701f('0x17')](_0x1bd077)[_0x701f('0x27')](_0x15cf86);};}exports[_0x701f('0x28')]=function(_0x4ee944,_0x1da821){var _0x5475d4={},_0x55fe71={},_0x1a7aaa={'count':0x0,'rows':[]};var _0x12210f=_['map'](db[_0x701f('0x29')][_0x701f('0x2a')],function(_0x37d19a){return{'name':_0x37d19a['fieldName'],'type':_0x37d19a[_0x701f('0x2b')][_0x701f('0x2c')]};});_0x55fe71['model']=_[_0x701f('0x2d')](_0x12210f,'name');_0x55fe71['query']=_[_0x701f('0x2e')](_0x4ee944[_0x701f('0x2f')]);_0x55fe71[_0x701f('0x30')]=_[_0x701f('0x31')](_0x55fe71[_0x701f('0x32')],_0x55fe71[_0x701f('0x2f')]);_0x5475d4[_0x701f('0x33')]=_[_0x701f('0x31')](_0x55fe71[_0x701f('0x32')],qs['fields'](_0x4ee944[_0x701f('0x2f')][_0x701f('0x34')]));_0x5475d4[_0x701f('0x33')]=_0x5475d4[_0x701f('0x33')][_0x701f('0x35')]?_0x5475d4[_0x701f('0x33')]:_0x55fe71[_0x701f('0x32')];if(!_0x4ee944[_0x701f('0x2f')][_0x701f('0x36')]('nolimit')){_0x5475d4['limit']=qs[_0x701f('0x19')](_0x4ee944[_0x701f('0x2f')][_0x701f('0x19')]);_0x5475d4['offset']=qs[_0x701f('0x1b')](_0x4ee944[_0x701f('0x2f')]['offset']);}_0x5475d4[_0x701f('0x37')]=qs[_0x701f('0x38')](_0x4ee944['query'][_0x701f('0x38')]);_0x5475d4[_0x701f('0x39')]=qs['filters'](_['pick'](_0x4ee944[_0x701f('0x2f')],_0x55fe71[_0x701f('0x30')]),_0x12210f);if(_0x4ee944[_0x701f('0x2f')][_0x701f('0x3a')]){_0x5475d4[_0x701f('0x39')]=_['merge'](_0x5475d4['where'],{'$or':_[_0x701f('0x2d')](_0x12210f,function(_0x4c240b){if(_0x4c240b[_0x701f('0x2b')]!==_0x701f('0x3b')){var _0x31fda4={};_0x31fda4[_0x4c240b[_0x701f('0x26')]]={'$like':'%'+_0x4ee944['query'][_0x701f('0x3a')]+'%'};return _0x31fda4;}})});}_0x5475d4=_[_0x701f('0x3c')]({},_0x5475d4,_0x4ee944[_0x701f('0x3d')]);var _0x575bb4={'where':_0x5475d4['where']};return db[_0x701f('0x29')][_0x701f('0x1a')](_0x575bb4)['then'](function(_0xd38388){_0x1a7aaa['count']=_0xd38388;if(_0x4ee944[_0x701f('0x2f')][_0x701f('0x3e')]){_0x5475d4[_0x701f('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x5475d4);})['then'](function(_0x39a87d){_0x1a7aaa['rows']=_0x39a87d;return _0x1a7aaa;})['then'](respondWithFilteredResult(_0x1da821,_0x5475d4))[_0x701f('0x40')](handleError(_0x1da821,null));};exports['show']=function(_0x55603a,_0x2fc76c){var _0x1f48cf={'raw':!![],'where':{'id':_0x55603a[_0x701f('0x41')]['id']}},_0x157bad={};_0x157bad[_0x701f('0x32')]=_[_0x701f('0x2e')](db[_0x701f('0x29')][_0x701f('0x2a')]);_0x157bad['query']=_['keys'](_0x55603a[_0x701f('0x2f')]);_0x157bad[_0x701f('0x30')]=_['intersection'](_0x157bad[_0x701f('0x32')],_0x157bad['query']);_0x1f48cf[_0x701f('0x33')]=_[_0x701f('0x31')](_0x157bad[_0x701f('0x32')],qs[_0x701f('0x34')](_0x55603a[_0x701f('0x2f')][_0x701f('0x34')]));_0x1f48cf[_0x701f('0x33')]=_0x1f48cf[_0x701f('0x33')][_0x701f('0x35')]?_0x1f48cf[_0x701f('0x33')]:_0x157bad[_0x701f('0x32')];if(_0x55603a['query'][_0x701f('0x3e')]){_0x1f48cf[_0x701f('0x3f')]=[{'all':!![]}];}_0x1f48cf=_['merge']({},_0x1f48cf,_0x55603a['options']);return db[_0x701f('0x29')][_0x701f('0x42')](_0x1f48cf)[_0x701f('0x21')](handleEntityNotFound(_0x2fc76c,null))['then'](respondWithResult(_0x2fc76c,null))['catch'](handleError(_0x2fc76c,null));};exports[_0x701f('0x20')]=function(_0x5c6228,_0x2db5b8){if(_0x5c6228[_0x701f('0x43')]['id']){delete _0x5c6228['body']['id'];}return db['CmHopperBlack']['find']({'where':{'id':_0x5c6228[_0x701f('0x41')]['id']}})[_0x701f('0x21')](handleEntityNotFound(_0x2db5b8,null))[_0x701f('0x21')](saveUpdates(_0x5c6228[_0x701f('0x43')],null))[_0x701f('0x21')](respondWithResult(_0x2db5b8,null))[_0x701f('0x40')](handleError(_0x2db5b8,null));};exports[_0x701f('0x22')]=function(_0x2d548f,_0x30c8e0){return db[_0x701f('0x29')][_0x701f('0x42')]({'where':{'id':_0x2d548f[_0x701f('0x41')]['id']}})[_0x701f('0x21')](handleEntityNotFound(_0x30c8e0,null))['then'](removeEntity(_0x30c8e0,null))[_0x701f('0x40')](handleError(_0x30c8e0,null));};exports[_0x701f('0x44')]=function(_0xbd0328,_0x55fe5b){return db[_0x701f('0x29')]['describe']()[_0x701f('0x21')](respondWithResult(_0x55fe5b,null))[_0x701f('0x40')](handleError(_0x55fe5b,null));}; \ No newline at end of file +var _0x5edd=['send','index','map','CmHopperBlack','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','options','include','findAll','catch','show','keys','find','body','params','describe','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name'];(function(_0x45016e,_0x9517fb){var _0x260948=function(_0x400896){while(--_0x400896){_0x45016e['push'](_0x45016e['shift']());}};_0x260948(++_0x9517fb);}(_0x5edd,0xf3));var _0xd5ed=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x5edd[_0x36c5b0];return _0xf19333;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd5ed('0x0'));var zipdir=require(_0xd5ed('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd5ed('0x2'));var moment=require(_0xd5ed('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd5ed('0x4'));var util=require(_0xd5ed('0x5'));var path=require('path');var sox=require(_0xd5ed('0x6'));var csv=require('to-csv');var ejs=require(_0xd5ed('0x7'));var fs=require('fs');var fs_extra=require(_0xd5ed('0x8'));var _=require(_0xd5ed('0x9'));var squel=require(_0xd5ed('0xa'));var crypto=require(_0xd5ed('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd5ed('0xc'));var Papa=require(_0xd5ed('0xd'));var Redis=require(_0xd5ed('0xe'));var authService=require(_0xd5ed('0xf'));var qs=require(_0xd5ed('0x10'));var as=require(_0xd5ed('0x11'));var hardwareService=require(_0xd5ed('0x12'));var logger=require(_0xd5ed('0x13'))(_0xd5ed('0x14'));var utils=require(_0xd5ed('0x15'));var config=require(_0xd5ed('0x16'));var licenseUtil=require(_0xd5ed('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21fbe4,_0x2c8f18){_0x2c8f18=_0x2c8f18||0xcc;return function(_0x5bb4c3){if(_0x5bb4c3){return _0x21fbe4['sendStatus'](_0x2c8f18);}return _0x21fbe4[_0xd5ed('0x18')](_0x2c8f18)[_0xd5ed('0x19')]();};}function respondWithResult(_0x1a8feb,_0x100114){_0x100114=_0x100114||0xc8;return function(_0x316cf6){if(_0x316cf6){return _0x1a8feb['status'](_0x100114)[_0xd5ed('0x1a')](_0x316cf6);}};}function respondWithFilteredResult(_0x212d7c,_0x242bba){return function(_0x3c8097){if(_0x3c8097){var _0x3b79e0=typeof _0x242bba[_0xd5ed('0x1b')]==='undefined'&&typeof _0x242bba[_0xd5ed('0x1c')]===_0xd5ed('0x1d');var _0x39fc25=_0x3c8097[_0xd5ed('0x1e')];var _0x2333c1=_0x3b79e0?0x0:_0x242bba[_0xd5ed('0x1b')];var _0x417f27=_0x3b79e0?_0x3c8097[_0xd5ed('0x1e')]:_0x242bba[_0xd5ed('0x1b')]+_0x242bba[_0xd5ed('0x1c')];var _0x221a6d;if(_0x417f27>=_0x39fc25){_0x417f27=_0x39fc25;_0x221a6d=0xc8;}else{_0x221a6d=0xce;}_0x212d7c[_0xd5ed('0x18')](_0x221a6d);return _0x212d7c[_0xd5ed('0x1f')](_0xd5ed('0x20'),_0x2333c1+'-'+_0x417f27+'/'+_0x39fc25)[_0xd5ed('0x1a')](_0x3c8097);}return null;};}function patchUpdates(_0x1df7f1){return function(_0x1a7b9e){try{jsonpatch[_0xd5ed('0x21')](_0x1a7b9e,_0x1df7f1,!![]);}catch(_0x1235de){return BPromise['reject'](_0x1235de);}return _0x1a7b9e[_0xd5ed('0x22')]();};}function saveUpdates(_0x14fc96,_0x2eb4a9){return function(_0x2499da){if(_0x2499da){return _0x2499da[_0xd5ed('0x23')](_0x14fc96)[_0xd5ed('0x24')](function(_0x1573db){return _0x1573db;});}return null;};}function removeEntity(_0x6a5825,_0x35332f){return function(_0x4207e7){if(_0x4207e7){return _0x4207e7[_0xd5ed('0x25')]()['then'](function(){_0x6a5825[_0xd5ed('0x18')](0xcc)[_0xd5ed('0x19')]();});}};}function handleEntityNotFound(_0x1dcd67,_0x33838c){return function(_0x4015a4){if(!_0x4015a4){_0x1dcd67['sendStatus'](0x194);}return _0x4015a4;};}function handleError(_0x1debe4,_0x270d1a){_0x270d1a=_0x270d1a||0x1f4;return function(_0xe6837d){logger[_0xd5ed('0x26')](_0xe6837d[_0xd5ed('0x27')]);if(_0xe6837d[_0xd5ed('0x28')]){delete _0xe6837d[_0xd5ed('0x28')];}_0x1debe4[_0xd5ed('0x18')](_0x270d1a)[_0xd5ed('0x29')](_0xe6837d);};}exports[_0xd5ed('0x2a')]=function(_0x86ff4a,_0x760643){var _0x139fb0={},_0x55882e={},_0x27cf26={'count':0x0,'rows':[]};var _0x392f5a=_[_0xd5ed('0x2b')](db[_0xd5ed('0x2c')][_0xd5ed('0x2d')],function(_0x3aa5b3){return{'name':_0x3aa5b3['fieldName'],'type':_0x3aa5b3[_0xd5ed('0x2e')][_0xd5ed('0x2f')]};});_0x55882e[_0xd5ed('0x30')]=_[_0xd5ed('0x2b')](_0x392f5a,_0xd5ed('0x28'));_0x55882e['query']=_['keys'](_0x86ff4a[_0xd5ed('0x31')]);_0x55882e[_0xd5ed('0x32')]=_[_0xd5ed('0x33')](_0x55882e[_0xd5ed('0x30')],_0x55882e[_0xd5ed('0x31')]);_0x139fb0[_0xd5ed('0x34')]=_['intersection'](_0x55882e[_0xd5ed('0x30')],qs[_0xd5ed('0x35')](_0x86ff4a[_0xd5ed('0x31')][_0xd5ed('0x35')]));_0x139fb0[_0xd5ed('0x34')]=_0x139fb0[_0xd5ed('0x34')]['length']?_0x139fb0['attributes']:_0x55882e[_0xd5ed('0x30')];if(!_0x86ff4a[_0xd5ed('0x31')][_0xd5ed('0x36')]('nolimit')){_0x139fb0['limit']=qs[_0xd5ed('0x1c')](_0x86ff4a['query'][_0xd5ed('0x1c')]);_0x139fb0[_0xd5ed('0x1b')]=qs[_0xd5ed('0x1b')](_0x86ff4a['query'][_0xd5ed('0x1b')]);}_0x139fb0[_0xd5ed('0x37')]=qs[_0xd5ed('0x38')](_0x86ff4a[_0xd5ed('0x31')][_0xd5ed('0x38')]);_0x139fb0['where']=qs['filters'](_['pick'](_0x86ff4a[_0xd5ed('0x31')],_0x55882e[_0xd5ed('0x32')]),_0x392f5a);if(_0x86ff4a[_0xd5ed('0x31')][_0xd5ed('0x39')]){_0x139fb0['where']=_['merge'](_0x139fb0[_0xd5ed('0x3a')],{'$or':_['map'](_0x392f5a,function(_0x59a60d){if(_0x59a60d[_0xd5ed('0x2e')]!==_0xd5ed('0x3b')){var _0x4a41bd={};_0x4a41bd[_0x59a60d[_0xd5ed('0x28')]]={'$like':'%'+_0x86ff4a[_0xd5ed('0x31')][_0xd5ed('0x39')]+'%'};return _0x4a41bd;}})});}_0x139fb0=_[_0xd5ed('0x3c')]({},_0x139fb0,_0x86ff4a[_0xd5ed('0x3d')]);var _0x3eafd7={'where':_0x139fb0['where']};return db[_0xd5ed('0x2c')][_0xd5ed('0x1e')](_0x3eafd7)[_0xd5ed('0x24')](function(_0x31b83d){_0x27cf26[_0xd5ed('0x1e')]=_0x31b83d;if(_0x86ff4a[_0xd5ed('0x31')]['includeAll']){_0x139fb0[_0xd5ed('0x3e')]=[{'all':!![]}];}return db[_0xd5ed('0x2c')][_0xd5ed('0x3f')](_0x139fb0);})['then'](function(_0x54269e){_0x27cf26['rows']=_0x54269e;return _0x27cf26;})[_0xd5ed('0x24')](respondWithFilteredResult(_0x760643,_0x139fb0))[_0xd5ed('0x40')](handleError(_0x760643,null));};exports[_0xd5ed('0x41')]=function(_0x4bfee8,_0x22b574){var _0x1bfee4={'raw':!![],'where':{'id':_0x4bfee8['params']['id']}},_0x2f4096={};_0x2f4096[_0xd5ed('0x30')]=_['keys'](db[_0xd5ed('0x2c')][_0xd5ed('0x2d')]);_0x2f4096[_0xd5ed('0x31')]=_[_0xd5ed('0x42')](_0x4bfee8[_0xd5ed('0x31')]);_0x2f4096[_0xd5ed('0x32')]=_[_0xd5ed('0x33')](_0x2f4096[_0xd5ed('0x30')],_0x2f4096[_0xd5ed('0x31')]);_0x1bfee4['attributes']=_[_0xd5ed('0x33')](_0x2f4096[_0xd5ed('0x30')],qs[_0xd5ed('0x35')](_0x4bfee8[_0xd5ed('0x31')]['fields']));_0x1bfee4[_0xd5ed('0x34')]=_0x1bfee4[_0xd5ed('0x34')]['length']?_0x1bfee4[_0xd5ed('0x34')]:_0x2f4096[_0xd5ed('0x30')];if(_0x4bfee8['query']['includeAll']){_0x1bfee4['include']=[{'all':!![]}];}_0x1bfee4=_[_0xd5ed('0x3c')]({},_0x1bfee4,_0x4bfee8[_0xd5ed('0x3d')]);return db[_0xd5ed('0x2c')][_0xd5ed('0x43')](_0x1bfee4)[_0xd5ed('0x24')](handleEntityNotFound(_0x22b574,null))[_0xd5ed('0x24')](respondWithResult(_0x22b574,null))[_0xd5ed('0x40')](handleError(_0x22b574,null));};exports[_0xd5ed('0x23')]=function(_0x428b60,_0x1d98fe){if(_0x428b60[_0xd5ed('0x44')]['id']){delete _0x428b60[_0xd5ed('0x44')]['id'];}return db[_0xd5ed('0x2c')][_0xd5ed('0x43')]({'where':{'id':_0x428b60[_0xd5ed('0x45')]['id']}})[_0xd5ed('0x24')](handleEntityNotFound(_0x1d98fe,null))[_0xd5ed('0x24')](saveUpdates(_0x428b60[_0xd5ed('0x44')],null))[_0xd5ed('0x24')](respondWithResult(_0x1d98fe,null))[_0xd5ed('0x40')](handleError(_0x1d98fe,null));};exports['destroy']=function(_0x3ec000,_0x435274){return db[_0xd5ed('0x2c')][_0xd5ed('0x43')]({'where':{'id':_0x3ec000[_0xd5ed('0x45')]['id']}})[_0xd5ed('0x24')](handleEntityNotFound(_0x435274,null))[_0xd5ed('0x24')](removeEntity(_0x435274,null))['catch'](handleError(_0x435274,null));};exports[_0xd5ed('0x46')]=function(_0x3a5fa4,_0x9751eb){return db[_0xd5ed('0x2c')][_0xd5ed('0x46')]()['then'](respondWithResult(_0x9751eb,null))[_0xd5ed('0x40')](handleError(_0x9751eb,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index f95fc8b..10b7950 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 _0x83dd=['lodash','util','api','bluebird','path','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black'];(function(_0x28c3a3,_0x1cc488){var _0x5772fa=function(_0xd5659d){while(--_0xd5659d){_0x28c3a3['push'](_0x28c3a3['shift']());}};_0x5772fa(++_0x1cc488);}(_0x83dd,0xfc));var _0xd83d=function(_0x2279b0,_0x463fed){_0x2279b0=_0x2279b0-0x0;var _0x2a8b35=_0x83dd[_0x2279b0];return _0x2a8b35;};'use strict';var _=require(_0xd83d('0x0'));var util=require(_0xd83d('0x1'));var logger=require('../../config/logger')(_0xd83d('0x2'));var moment=require('moment');var BPromise=require(_0xd83d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd83d('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd83d('0x5'));module['exports']=function(_0x139c9f,_0x108f42){return _0x139c9f[_0xd83d('0x6')](_0xd83d('0x7'),attributes,{'tableName':_0xd83d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6df=['../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1aab74,_0x38a57b){var _0x396af2=function(_0x1c2e0d){while(--_0x1c2e0d){_0x1aab74['push'](_0x1aab74['shift']());}};_0x396af2(++_0x38a57b);}(_0xd6df,0xad));var _0xfd6d=function(_0x40fc0e,_0x301e9b){_0x40fc0e=_0x40fc0e-0x0;var _0x253560=_0xd6df[_0x40fc0e];return _0x253560;};'use strict';var _=require(_0xfd6d('0x0'));var util=require(_0xfd6d('0x1'));var logger=require(_0xfd6d('0x2'))(_0xfd6d('0x3'));var moment=require(_0xfd6d('0x4'));var BPromise=require(_0xfd6d('0x5'));var rp=require(_0xfd6d('0x6'));var fs=require('fs');var path=require(_0xfd6d('0x7'));var rimraf=require(_0xfd6d('0x8'));var config=require(_0xfd6d('0x9'));var attributes=require(_0xfd6d('0xa'));module[_0xfd6d('0xb')]=function(_0xd40990,_0x2228f4){return _0xd40990[_0xfd6d('0xc')](_0xfd6d('0xd'),attributes,{'tableName':'cm_hopper_black','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 bdca987..ebc96b8 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 _0xd0e5=['raw','options','where','attributes','limit','include','map','model','GetCmHopperBlack','UpdateCmHopperBlack','update','catch','DestroyCmHopperBlack','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','CmHopperBlack','findAll'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd0e5,0x15a));var _0x5d0e=function(_0x2ef44b,_0x553359){_0x2ef44b=_0x2ef44b-0x0;var _0x2405b9=_0xd0e5[_0x2ef44b];return _0x2405b9;};'use strict';var _=require(_0x5d0e('0x0'));var util=require(_0x5d0e('0x1'));var moment=require(_0x5d0e('0x2'));var BPromise=require('bluebird');var rs=require(_0x5d0e('0x3'));var fs=require('fs');var Redis=require(_0x5d0e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5d0e('0x5'))(_0x5d0e('0x6'));var config=require(_0x5d0e('0x7'));var jayson=require(_0x5d0e('0x8'));var client=jayson[_0x5d0e('0x9')][_0x5d0e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10d2f5,_0x4c8286,_0x3d2afa){return new BPromise(function(_0x3544f5,_0x11d98e){return client[_0x5d0e('0xb')](_0x10d2f5,_0x3d2afa)[_0x5d0e('0xc')](function(_0x32702e){logger['info'](_0x5d0e('0xd'),_0x4c8286,'request\x20sent');logger[_0x5d0e('0xe')](_0x5d0e('0xf'),_0x4c8286,_0x5d0e('0x10'),JSON[_0x5d0e('0x11')](_0x32702e));if(_0x32702e[_0x5d0e('0x12')]){if(_0x32702e[_0x5d0e('0x12')][_0x5d0e('0x13')]===0x1f4){logger[_0x5d0e('0x12')](_0x5d0e('0xd'),_0x4c8286,_0x32702e[_0x5d0e('0x12')][_0x5d0e('0x14')]);return _0x11d98e(_0x32702e[_0x5d0e('0x12')][_0x5d0e('0x14')]);}logger[_0x5d0e('0x12')](_0x5d0e('0xd'),_0x4c8286,_0x32702e[_0x5d0e('0x12')][_0x5d0e('0x14')]);return _0x3544f5(_0x32702e[_0x5d0e('0x12')]['message']);}else{logger[_0x5d0e('0x15')](_0x5d0e('0xd'),_0x4c8286,_0x5d0e('0x10'));_0x3544f5(_0x32702e['result'][_0x5d0e('0x14')]);}})['catch'](function(_0x5d3fa0){logger[_0x5d0e('0x12')](_0x5d0e('0xd'),_0x4c8286,_0x5d3fa0);_0x11d98e(_0x5d3fa0);});});}exports['GetCmHopperBlack']=function(_0x5d8232){var _0x2d3671=this;return new Promise(function(_0x1cfdb4,_0x33c4f8){return db[_0x5d0e('0x16')][_0x5d0e('0x17')]({'raw':_0x5d8232['options']?_0x5d8232['options'][_0x5d0e('0x18')]===undefined?!![]:![]:!![],'where':_0x5d8232[_0x5d0e('0x19')]?_0x5d8232[_0x5d0e('0x19')][_0x5d0e('0x1a')]||null:null,'attributes':_0x5d8232[_0x5d0e('0x19')]?_0x5d8232[_0x5d0e('0x19')][_0x5d0e('0x1b')]||null:null,'limit':_0x5d8232['options']?_0x5d8232[_0x5d0e('0x19')][_0x5d0e('0x1c')]||null:null,'include':_0x5d8232[_0x5d0e('0x19')]?_0x5d8232['options'][_0x5d0e('0x1d')]?_[_0x5d0e('0x1e')](_0x5d8232[_0x5d0e('0x19')][_0x5d0e('0x1d')],function(_0x4a5b38){return{'model':db[_0x4a5b38[_0x5d0e('0x1f')]],'as':_0x4a5b38['as'],'attributes':_0x4a5b38[_0x5d0e('0x1b')],'include':_0x4a5b38[_0x5d0e('0x1d')]?_[_0x5d0e('0x1e')](_0x4a5b38['include'],function(_0x505be6){return{'model':db[_0x505be6[_0x5d0e('0x1f')]],'as':_0x505be6['as'],'attributes':_0x505be6[_0x5d0e('0x1b')],'include':_0x505be6[_0x5d0e('0x1d')]?_[_0x5d0e('0x1e')](_0x505be6[_0x5d0e('0x1d')],function(_0x4b26cb){return{'model':db[_0x4b26cb[_0x5d0e('0x1f')]],'as':_0x4b26cb['as'],'attributes':_0x4b26cb[_0x5d0e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5d0e('0xc')](function(_0x385957){logger[_0x5d0e('0x15')](_0x5d0e('0x20'),_0x5d8232);logger[_0x5d0e('0xe')](_0x5d0e('0x20'),_0x5d8232,JSON[_0x5d0e('0x11')](_0x385957));_0x1cfdb4(_0x385957);})['catch'](function(_0x152a7b){logger[_0x5d0e('0x12')](_0x5d0e('0x20'),_0x152a7b[_0x5d0e('0x14')],_0x5d8232);_0x33c4f8(_0x2d3671[_0x5d0e('0x12')](0x1f4,_0x152a7b[_0x5d0e('0x14')]));});});};exports[_0x5d0e('0x21')]=function(_0x20b4f5){var _0x4b7792=this;return new Promise(function(_0x30d93e,_0x15d06f){return db['CmHopperBlack'][_0x5d0e('0x22')](_0x20b4f5['body'],{'raw':_0x20b4f5[_0x5d0e('0x19')]?_0x20b4f5[_0x5d0e('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20b4f5['options']?_0x20b4f5['options'][_0x5d0e('0x1a')]||null:null,'attributes':_0x20b4f5[_0x5d0e('0x19')]?_0x20b4f5[_0x5d0e('0x19')][_0x5d0e('0x1b')]||null:null,'limit':_0x20b4f5[_0x5d0e('0x19')]?_0x20b4f5['options']['limit']||null:null})['then'](function(_0xbf26cd){logger[_0x5d0e('0x15')](_0x5d0e('0x21'),_0x20b4f5);logger[_0x5d0e('0xe')]('UpdateCmHopperBlack',_0x20b4f5,JSON['stringify'](_0xbf26cd));_0x30d93e(_0xbf26cd);})[_0x5d0e('0x23')](function(_0x29c928){logger[_0x5d0e('0x12')](_0x5d0e('0x21'),_0x29c928[_0x5d0e('0x14')],_0x20b4f5);_0x15d06f(_0x4b7792['error'](0x1f4,_0x29c928[_0x5d0e('0x14')]));});});};exports['DestroyCmHopperBlack']=function(_0x394840){var _0x16d1ba=this;return new Promise(function(_0x164b52,_0x2a3b04){return db[_0x5d0e('0x16')]['destroy']({'where':_0x394840[_0x5d0e('0x19')]?_0x394840[_0x5d0e('0x19')]['where']||null:null})['then'](function(_0x3bbb7d){logger[_0x5d0e('0x15')]('DestroyCmHopperBlack',_0x394840);logger[_0x5d0e('0xe')](_0x5d0e('0x24'),_0x394840,JSON[_0x5d0e('0x11')](_0x3bbb7d));_0x164b52(_0x3bbb7d);})[_0x5d0e('0x23')](function(_0x543742){logger[_0x5d0e('0x12')](_0x5d0e('0x24'),_0x543742[_0x5d0e('0x14')],_0x394840);_0x2a3b04(_0x16d1ba[_0x5d0e('0x12')](0x1f4,_0x543742['message']));});});}; \ No newline at end of file +var _0x172b=['model','attributes','GetCmHopperBlack','debug','UpdateCmHopperBlack','update','body','where','limit','DestroyCmHopperBlack','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CmHopperBlack','findAll','options','raw','include','map'];(function(_0x558945,_0x25d7dd){var _0x5bc05e=function(_0x4fcfdf){while(--_0x4fcfdf){_0x558945['push'](_0x558945['shift']());}};_0x5bc05e(++_0x25d7dd);}(_0x172b,0x12b));var _0xb172=function(_0x229191,_0x484baf){_0x229191=_0x229191-0x0;var _0x295609=_0x172b[_0x229191];return _0x295609;};'use strict';var _=require(_0xb172('0x0'));var util=require(_0xb172('0x1'));var moment=require('moment');var BPromise=require(_0xb172('0x2'));var rs=require(_0xb172('0x3'));var fs=require('fs');var Redis=require(_0xb172('0x4'));var db=require(_0xb172('0x5'))['db'];var utils=require(_0xb172('0x6'));var logger=require(_0xb172('0x7'))(_0xb172('0x8'));var config=require('../../config/environment');var jayson=require(_0xb172('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x12db6b,_0x2d410f,_0x201934){return new BPromise(function(_0x1df981,_0x112117){return client['request'](_0x12db6b,_0x201934)[_0xb172('0xa')](function(_0x486865){logger[_0xb172('0xb')](_0xb172('0xc'),_0x2d410f,_0xb172('0xd'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x2d410f,_0xb172('0xd'),JSON[_0xb172('0xe')](_0x486865));if(_0x486865[_0xb172('0xf')]){if(_0x486865[_0xb172('0xf')][_0xb172('0x10')]===0x1f4){logger[_0xb172('0xf')](_0xb172('0xc'),_0x2d410f,_0x486865['error'][_0xb172('0x11')]);return _0x112117(_0x486865[_0xb172('0xf')][_0xb172('0x11')]);}logger[_0xb172('0xf')](_0xb172('0xc'),_0x2d410f,_0x486865[_0xb172('0xf')][_0xb172('0x11')]);return _0x1df981(_0x486865[_0xb172('0xf')]['message']);}else{logger[_0xb172('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x2d410f,_0xb172('0xd'));_0x1df981(_0x486865[_0xb172('0x12')]['message']);}})['catch'](function(_0x5aa041){logger[_0xb172('0xf')](_0xb172('0xc'),_0x2d410f,_0x5aa041);_0x112117(_0x5aa041);});});}exports['GetCmHopperBlack']=function(_0x46bd08){var _0x1d5d63=this;return new Promise(function(_0x2bc7c7,_0x411ae7){return db[_0xb172('0x13')][_0xb172('0x14')]({'raw':_0x46bd08[_0xb172('0x15')]?_0x46bd08[_0xb172('0x15')][_0xb172('0x16')]===undefined?!![]:![]:!![],'where':_0x46bd08[_0xb172('0x15')]?_0x46bd08[_0xb172('0x15')]['where']||null:null,'attributes':_0x46bd08['options']?_0x46bd08[_0xb172('0x15')]['attributes']||null:null,'limit':_0x46bd08[_0xb172('0x15')]?_0x46bd08[_0xb172('0x15')]['limit']||null:null,'include':_0x46bd08[_0xb172('0x15')]?_0x46bd08[_0xb172('0x15')][_0xb172('0x17')]?_[_0xb172('0x18')](_0x46bd08[_0xb172('0x15')][_0xb172('0x17')],function(_0x476440){return{'model':db[_0x476440[_0xb172('0x19')]],'as':_0x476440['as'],'attributes':_0x476440['attributes'],'include':_0x476440[_0xb172('0x17')]?_[_0xb172('0x18')](_0x476440[_0xb172('0x17')],function(_0x159c54){return{'model':db[_0x159c54[_0xb172('0x19')]],'as':_0x159c54['as'],'attributes':_0x159c54[_0xb172('0x1a')],'include':_0x159c54[_0xb172('0x17')]?_[_0xb172('0x18')](_0x159c54[_0xb172('0x17')],function(_0x2c18e8){return{'model':db[_0x2c18e8[_0xb172('0x19')]],'as':_0x2c18e8['as'],'attributes':_0x2c18e8[_0xb172('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb172('0xa')](function(_0x26f791){logger[_0xb172('0xb')](_0xb172('0x1b'),_0x46bd08);logger[_0xb172('0x1c')](_0xb172('0x1b'),_0x46bd08,JSON['stringify'](_0x26f791));_0x2bc7c7(_0x26f791);})['catch'](function(_0x468180){logger[_0xb172('0xf')]('GetCmHopperBlack',_0x468180[_0xb172('0x11')],_0x46bd08);_0x411ae7(_0x1d5d63['error'](0x1f4,_0x468180[_0xb172('0x11')]));});});};exports[_0xb172('0x1d')]=function(_0x36961e){var _0x22899b=this;return new Promise(function(_0x394bca,_0x351ccc){return db[_0xb172('0x13')][_0xb172('0x1e')](_0x36961e[_0xb172('0x1f')],{'raw':_0x36961e[_0xb172('0x15')]?_0x36961e[_0xb172('0x15')][_0xb172('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36961e[_0xb172('0x15')]?_0x36961e[_0xb172('0x15')][_0xb172('0x20')]||null:null,'attributes':_0x36961e['options']?_0x36961e[_0xb172('0x15')][_0xb172('0x1a')]||null:null,'limit':_0x36961e[_0xb172('0x15')]?_0x36961e['options'][_0xb172('0x21')]||null:null})[_0xb172('0xa')](function(_0x4b3fcd){logger[_0xb172('0xb')]('UpdateCmHopperBlack',_0x36961e);logger[_0xb172('0x1c')](_0xb172('0x1d'),_0x36961e,JSON[_0xb172('0xe')](_0x4b3fcd));_0x394bca(_0x4b3fcd);})['catch'](function(_0x704089){logger[_0xb172('0xf')](_0xb172('0x1d'),_0x704089[_0xb172('0x11')],_0x36961e);_0x351ccc(_0x22899b['error'](0x1f4,_0x704089[_0xb172('0x11')]));});});};exports[_0xb172('0x22')]=function(_0x337de9){var _0xeb8c33=this;return new Promise(function(_0x5770ef,_0x191081){return db[_0xb172('0x13')]['destroy']({'where':_0x337de9['options']?_0x337de9[_0xb172('0x15')][_0xb172('0x20')]||null:null})['then'](function(_0x194932){logger[_0xb172('0xb')](_0xb172('0x22'),_0x337de9);logger['debug']('DestroyCmHopperBlack',_0x337de9,JSON['stringify'](_0x194932));_0x5770ef(_0x194932);})[_0xb172('0x23')](function(_0xf79173){logger['error'](_0xb172('0x22'),_0xf79173[_0xb172('0x11')],_0x337de9);_0x191081(_0xeb8c33['error'](0x1f4,_0xf79173[_0xb172('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 5f55892..b0d7770 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 _0x3a6d=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','describe','/:id','show','put','delete','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a6d,0x143));var _0xd3a6=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x3a6d[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var path=require('path');var timeout=require(_0xd3a6('0x2'));var express=require(_0xd3a6('0x3'));var router=express[_0xd3a6('0x4')]();var fs_extra=require(_0xd3a6('0x5'));var auth=require(_0xd3a6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd3a6('0x7'));var controller=require(_0xd3a6('0x8'));router[_0xd3a6('0x9')]('/',auth[_0xd3a6('0xa')](),controller[_0xd3a6('0xb')]);router[_0xd3a6('0x9')]('/describe',auth[_0xd3a6('0xa')](),controller[_0xd3a6('0xc')]);router[_0xd3a6('0x9')](_0xd3a6('0xd'),auth[_0xd3a6('0xa')](),controller[_0xd3a6('0xe')]);router[_0xd3a6('0xf')](_0xd3a6('0xd'),auth[_0xd3a6('0xa')](),controller['update']);router[_0xd3a6('0x10')](_0xd3a6('0xd'),auth[_0xd3a6('0xa')](),controller[_0xd3a6('0x11')]);module[_0xd3a6('0x12')]=router; \ No newline at end of file +var _0x2a07=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x42f5c7,_0xaccf0){var _0x224981=function(_0x9c5226){while(--_0x9c5226){_0x42f5c7['push'](_0x42f5c7['shift']());}};_0x224981(++_0xaccf0);}(_0x2a07,0x74));var _0x72a0=function(_0x507403,_0x3f954d){_0x507403=_0x507403-0x0;var _0x1327c=_0x2a07[_0x507403];return _0x1327c;};'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['put'](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller['update']);router[_0x72a0('0x11')](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x12')]);module[_0x72a0('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index a3c35ea..17eeb87 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 _0x2f69=['STRING','DATE','getDataValue','followuptime','diff','setDataValue','dispositionat','BOOLEAN','sequelize','moment','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2f69,0x1aa));var _0x92f6=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2f69[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x92f6('0x0'));var moment=require(_0x92f6('0x1'));module['exports']={'state':{'type':Sequelize[_0x92f6('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x92f6('0x3')]},'scheduledat':{'type':Sequelize[_0x92f6('0x4')]},'countbusyretry':{'type':Sequelize[_0x92f6('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x92f6('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x92f6('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x92f6('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x92f6('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x92f6('0x4')]},'responsetime':{'type':Sequelize[_0x92f6('0x4')]},'answertime':{'type':Sequelize[_0x92f6('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x92f6('0x4')]},'ringtime':{'type':Sequelize[_0x92f6('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x92f6('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x92f6('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x92f6('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x92f6('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x92f6('0x3')]},'reason':{'type':Sequelize[_0x92f6('0x3')]},'disposition':{'type':Sequelize[_0x92f6('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x92f6('0x3')]},'dispositionat':{'type':Sequelize[_0x92f6('0x4')],'set':function(_0x285066){var _0x383637=this[_0x92f6('0x5')]('endtime');if(_0x383637&&_0x285066){this['setDataValue'](_0x92f6('0x6'),moment(_0x285066)[_0x92f6('0x7')](moment(_0x383637),'seconds'));}return this[_0x92f6('0x8')](_0x92f6('0x9'),_0x285066);}},'amd':{'type':Sequelize[_0x92f6('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x92f6('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x92f6('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x92f6('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x92f6('0x4')]},'callback':{'type':Sequelize[_0x92f6('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x92f6('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x92f6('0x4')]},'deleted':{'type':Sequelize[_0x92f6('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x92f6('0x4')]},'recallme':{'type':Sequelize[_0x92f6('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x92f6('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x92f6('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x92f6('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x92f6('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9849=['followuptime','seconds','dispositionat','BOOLEAN','sequelize','moment','exports','DATE','INTEGER','STRING','getDataValue','endtime'];(function(_0x51b4b8,_0x5611de){var _0x10ee1c=function(_0x4acb46){while(--_0x4acb46){_0x51b4b8['push'](_0x51b4b8['shift']());}};_0x10ee1c(++_0x5611de);}(_0x9849,0x1e4));var _0x9984=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x9849[_0xd1d19a];return _0x52a79d;};'use strict';var Sequelize=require(_0x9984('0x0'));var moment=require(_0x9984('0x1'));module[_0x9984('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x9984('0x3')]},'countbusyretry':{'type':Sequelize[_0x9984('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9984('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9984('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x9984('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x9984('0x5')]},'calleridnum':{'type':Sequelize[_0x9984('0x5')]},'calleridname':{'type':Sequelize[_0x9984('0x5')]},'starttime':{'type':Sequelize[_0x9984('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x9984('0x3')]},'droptime':{'type':Sequelize[_0x9984('0x3')]},'endtime':{'type':Sequelize[_0x9984('0x3')]},'ringtime':{'type':Sequelize[_0x9984('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x9984('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x9984('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x9984('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x9984('0x5')]},'campaigntype':{'type':Sequelize[_0x9984('0x5')]},'membername':{'type':Sequelize[_0x9984('0x5')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x9984('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x9984('0x3')],'set':function(_0x57a1ae){var _0x20b0db=this[_0x9984('0x6')](_0x9984('0x7'));if(_0x20b0db&&_0x57a1ae){this['setDataValue'](_0x9984('0x8'),moment(_0x57a1ae)['diff'](moment(_0x20b0db),_0x9984('0x9')));}return this['setDataValue'](_0x9984('0xa'),_0x57a1ae);}},'amd':{'type':Sequelize[_0x9984('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x9984('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x9984('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x9984('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x9984('0x3')]},'callback':{'type':Sequelize[_0x9984('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9984('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9984('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x9984('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9984('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9984('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9984('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index d7618ea..0c6430e 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 _0x1883=['abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','scheduledAt','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','phone','NOW()','ContactId','field','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperFinal','includeAll','include','findAll','params','catch','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null'];(function(_0x59c9d6,_0x2daf28){var _0x2604b5=function(_0x2c1f24){while(--_0x2c1f24){_0x59c9d6['push'](_0x59c9d6['shift']());}};_0x2604b5(++_0x2daf28);}(_0x1883,0xab));var _0x3188=function(_0x281407,_0x44a2c5){_0x281407=_0x281407-0x0;var _0x3104e8=_0x1883[_0x281407];return _0x3104e8;};'use strict';var emlformat=require(_0x3188('0x0'));var rimraf=require(_0x3188('0x1'));var zipdir=require(_0x3188('0x2'));var jsonpatch=require(_0x3188('0x3'));var rp=require(_0x3188('0x4'));var moment=require(_0x3188('0x5'));var BPromise=require(_0x3188('0x6'));var Mustache=require(_0x3188('0x7'));var util=require(_0x3188('0x8'));var path=require(_0x3188('0x9'));var sox=require(_0x3188('0xa'));var csv=require(_0x3188('0xb'));var ejs=require(_0x3188('0xc'));var fs=require('fs');var fs_extra=require(_0x3188('0xd'));var _=require(_0x3188('0xe'));var squel=require(_0x3188('0xf'));var crypto=require(_0x3188('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3188('0x11'));var toCsv=require(_0x3188('0xb'));var querystring=require('querystring');var Papa=require(_0x3188('0x12'));var Redis=require('ioredis');var authService=require(_0x3188('0x13'));var qs=require(_0x3188('0x14'));var as=require(_0x3188('0x15'));var hardwareService=require(_0x3188('0x16'));var logger=require('../../config/logger')(_0x3188('0x17'));var utils=require(_0x3188('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3188('0x19'))['db'];function respondWithStatusCode(_0x45e94e,_0x20fef6){_0x20fef6=_0x20fef6||0xcc;return function(_0x3ae228){if(_0x3ae228){return _0x45e94e[_0x3188('0x1a')](_0x20fef6);}return _0x45e94e[_0x3188('0x1b')](_0x20fef6)['end']();};}function respondWithResult(_0x276d69,_0x5e0044){_0x5e0044=_0x5e0044||0xc8;return function(_0x4a2f36){if(_0x4a2f36){return _0x276d69[_0x3188('0x1b')](_0x5e0044)['json'](_0x4a2f36);}};}function respondWithFilteredResult(_0x54a87f,_0x32c239){return function(_0x1beead){if(_0x1beead){var _0xa2269=typeof _0x32c239[_0x3188('0x1c')]===_0x3188('0x1d')&&typeof _0x32c239[_0x3188('0x1e')]==='undefined';var _0x19cc72=_0x1beead[_0x3188('0x1f')];var _0x3f5b35=_0xa2269?0x0:_0x32c239[_0x3188('0x1c')];var _0x18a71a=_0xa2269?_0x1beead[_0x3188('0x1f')]:_0x32c239[_0x3188('0x1c')]+_0x32c239[_0x3188('0x1e')];var _0x5bcbba;if(_0x18a71a>=_0x19cc72){_0x18a71a=_0x19cc72;_0x5bcbba=0xc8;}else{_0x5bcbba=0xce;}_0x54a87f[_0x3188('0x1b')](_0x5bcbba);return _0x54a87f[_0x3188('0x20')]('Content-Range',_0x3f5b35+'-'+_0x18a71a+'/'+_0x19cc72)['json'](_0x1beead);}return null;};}function patchUpdates(_0x5d8d62){return function(_0x46a318){try{jsonpatch[_0x3188('0x21')](_0x46a318,_0x5d8d62,!![]);}catch(_0xd292b5){return BPromise['reject'](_0xd292b5);}return _0x46a318['save']();};}function saveUpdates(_0x266260,_0x461286){return function(_0x375077){if(_0x375077){return _0x375077[_0x3188('0x22')](_0x266260)[_0x3188('0x23')](function(_0x4bd5ee){return _0x4bd5ee;});}return null;};}function removeEntity(_0x30cf2c,_0x33f882){return function(_0x5a2e67){if(_0x5a2e67){return _0x5a2e67[_0x3188('0x24')]()['then'](function(){_0x30cf2c['status'](0xcc)[_0x3188('0x25')]();});}};}function handleEntityNotFound(_0x129bd7,_0x87d5a3){return function(_0x1aeaba){if(!_0x1aeaba){_0x129bd7[_0x3188('0x1a')](0x194);}return _0x1aeaba;};}function handleError(_0x2cd060,_0xe57f73){_0xe57f73=_0xe57f73||0x1f4;return function(_0x11021c){logger['error'](_0x11021c[_0x3188('0x26')]);if(_0x11021c[_0x3188('0x27')]){delete _0x11021c['name'];}_0x2cd060[_0x3188('0x1b')](_0xe57f73)[_0x3188('0x28')](_0x11021c);};}exports[_0x3188('0x29')]=function(_0x44db9a,_0x20e6aa){var _0x1f1c6f={},_0x8f810f={},_0x472926={'count':0x0,'rows':[]};var _0x57c21c=_[_0x3188('0x2a')](db['CmHopperFinal'][_0x3188('0x2b')],function(_0x5623f1){return{'name':_0x5623f1[_0x3188('0x2c')],'type':_0x5623f1[_0x3188('0x2d')][_0x3188('0x2e')]};});_0x8f810f[_0x3188('0x2f')]=_[_0x3188('0x2a')](_0x57c21c,_0x3188('0x27'));_0x8f810f[_0x3188('0x30')]=_[_0x3188('0x31')](_0x44db9a[_0x3188('0x30')]);_0x8f810f[_0x3188('0x32')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],_0x8f810f[_0x3188('0x30')]);_0x1f1c6f[_0x3188('0x34')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],qs[_0x3188('0x35')](_0x44db9a[_0x3188('0x30')]['fields']));_0x1f1c6f[_0x3188('0x34')]=_0x1f1c6f['attributes'][_0x3188('0x36')]?_0x1f1c6f[_0x3188('0x34')]:_0x8f810f['model'];if(!_0x44db9a[_0x3188('0x30')][_0x3188('0x37')](_0x3188('0x38'))){_0x1f1c6f[_0x3188('0x1e')]=qs[_0x3188('0x1e')](_0x44db9a[_0x3188('0x30')][_0x3188('0x1e')]);_0x1f1c6f['offset']=qs['offset'](_0x44db9a[_0x3188('0x30')][_0x3188('0x1c')]);}_0x1f1c6f[_0x3188('0x39')]=qs[_0x3188('0x3a')](_0x44db9a['query'][_0x3188('0x3a')]);_0x1f1c6f[_0x3188('0x3b')]=qs[_0x3188('0x32')](_[_0x3188('0x3c')](_0x44db9a['query'],_0x8f810f[_0x3188('0x32')]),_0x57c21c);if(_0x44db9a['query'][_0x3188('0x3d')]){_0x1f1c6f['where']=_[_0x3188('0x3e')](_0x1f1c6f[_0x3188('0x3b')],{'$or':_[_0x3188('0x2a')](_0x57c21c,function(_0x2990c4){if(_0x2990c4[_0x3188('0x2d')]!==_0x3188('0x3f')){var _0x4666b2={};_0x4666b2[_0x2990c4[_0x3188('0x27')]]={'$like':'%'+_0x44db9a[_0x3188('0x30')][_0x3188('0x3d')]+'%'};return _0x4666b2;}})});}_0x1f1c6f=_['merge']({},_0x1f1c6f,_0x44db9a[_0x3188('0x40')]);var _0x2bad0f={'where':_0x1f1c6f[_0x3188('0x3b')]};return db[_0x3188('0x41')][_0x3188('0x1f')](_0x2bad0f)[_0x3188('0x23')](function(_0x5a815d){_0x472926[_0x3188('0x1f')]=_0x5a815d;if(_0x44db9a['query'][_0x3188('0x42')]){_0x1f1c6f[_0x3188('0x43')]=[{'all':!![]}];}return db[_0x3188('0x41')][_0x3188('0x44')](_0x1f1c6f);})[_0x3188('0x23')](function(_0x549ab2){_0x472926['rows']=_0x549ab2;return _0x472926;})['then'](respondWithFilteredResult(_0x20e6aa,_0x1f1c6f))['catch'](handleError(_0x20e6aa,null));};exports['show']=function(_0x763943,_0x28c224){var _0x3e5f90={'raw':!![],'where':{'id':_0x763943[_0x3188('0x45')]['id']}},_0x1b40b1={};_0x1b40b1['model']=_[_0x3188('0x31')](db['CmHopperFinal'][_0x3188('0x2b')]);_0x1b40b1[_0x3188('0x30')]=_[_0x3188('0x31')](_0x763943[_0x3188('0x30')]);_0x1b40b1['filters']=_[_0x3188('0x33')](_0x1b40b1[_0x3188('0x2f')],_0x1b40b1[_0x3188('0x30')]);_0x3e5f90[_0x3188('0x34')]=_[_0x3188('0x33')](_0x1b40b1['model'],qs['fields'](_0x763943[_0x3188('0x30')][_0x3188('0x35')]));_0x3e5f90['attributes']=_0x3e5f90[_0x3188('0x34')][_0x3188('0x36')]?_0x3e5f90['attributes']:_0x1b40b1[_0x3188('0x2f')];if(_0x763943[_0x3188('0x30')][_0x3188('0x42')]){_0x3e5f90[_0x3188('0x43')]=[{'all':!![]}];}_0x3e5f90=_[_0x3188('0x3e')]({},_0x3e5f90,_0x763943['options']);return db[_0x3188('0x41')]['find'](_0x3e5f90)[_0x3188('0x23')](handleEntityNotFound(_0x28c224,null))[_0x3188('0x23')](respondWithResult(_0x28c224,null))[_0x3188('0x46')](handleError(_0x28c224,null));};exports[_0x3188('0x47')]=function(_0xe4cbb0,_0x315524){return db[_0x3188('0x41')][_0x3188('0x47')]()[_0x3188('0x23')](respondWithResult(_0x315524,null))[_0x3188('0x46')](handleError(_0x315524,null));};exports[_0x3188('0x22')]=function(_0x50c08d,_0x50fd56){if(_0x50c08d[_0x3188('0x48')]['uniqueid']){delete _0x50c08d[_0x3188('0x48')][_0x3188('0x49')];}return db['CmHopperFinal'][_0x3188('0x4a')]({'where':{'uniqueid':_0x50c08d[_0x3188('0x45')]['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x50fd56,null))[_0x3188('0x23')](saveUpdates(_0x50c08d[_0x3188('0x48')],null))[_0x3188('0x23')](respondWithResult(_0x50fd56,null))[_0x3188('0x46')](handleError(_0x50fd56,null));};exports[_0x3188('0x4b')]=function(_0x59a177,_0x3b8fe9,_0x3051ce){return db['CmHopperFinal'][_0x3188('0x44')]({'raw':![],'where':{'VoiceQueueId':_0x59a177['params']['id']},'attributes':[[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x4f')))),'noAnswerContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x50')))),_0x3188('0x51')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db['sequelize']['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')]['literal'](_0x3188('0x52')))),_0x3188('0x53')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x54')))),_0x3188('0x55')],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3188('0x56')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x57')))),'answeringMachine']]})[_0x3188('0x23')](handleEntityNotFound(_0x3b8fe9,null))[_0x3188('0x23')](respondWithResult(_0x3b8fe9,null))[_0x3188('0x46')](handleError(_0x3b8fe9,null));};exports[_0x3188('0x58')]=function(_0x3afd94,_0x447827,_0x27983c){return db['CmHopperFinal'][_0x3188('0x44')]({'raw':![],'where':{'CampaignId':_0x3afd94[_0x3188('0x45')]['id']},'attributes':[[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x59')))),'noSuchContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x4f')))),_0x3188('0x5a')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')]['literal'](_0x3188('0x50')))),'busyContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db['sequelize']['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x5b')))),_0x3188('0x5c')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db['sequelize']['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x3188('0x53')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x3188('0x55')],[db[_0x3188('0x4c')]['fn']('COUNT',db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3188('0x56')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x57')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x447827,null))['then'](respondWithResult(_0x447827,null))['catch'](handleError(_0x447827,null));};exports[_0x3188('0x5d')]=function(_0x693395,_0x3b6a13,_0x30f3b3){return db[_0x3188('0x5e')]['find']({'where':{'id':_0x693395[_0x3188('0x45')]['id']}})['then'](handleEntityNotFound(_0x3b6a13,null))[_0x3188('0x23')](function(_0x96600f){var _0x5b93cd;if(_0x96600f){_0x5b93cd=squel[_0x3188('0x5f')]()['into'](_0x3188('0x60'))[_0x3188('0x61')](['phone',_0x3188('0x62'),'ContactId',_0x3188('0x63'),_0x3188('0x64'),_0x3188('0x65'),_0x3188('0x66')],squel[_0x3188('0x67')]()['field'](_0x3188('0x68'),_0x3188('0x69'))['field'](_0x3188('0x6a'),_0x3188('0x62'))['field']('ANY_VALUE(ContactId)',_0x3188('0x6b'))[_0x3188('0x6c')](_0x3188('0x6d'),_0x3188('0x63'))[_0x3188('0x6c')](_0x3188('0x6e'),'VoiceQueueId')[_0x3188('0x6c')](_0x3188('0x6a'),_0x3188('0x65'))['field'](_0x3188('0x6a'),_0x3188('0x66'))[_0x3188('0x6f')](_0x3188('0x70'))[_0x3188('0x3b')](_0x3188('0x71'),_0x693395['params']['id']['toString']())['where'](_0x3188('0x72'),_0x693395[_0x3188('0x48')]['state'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x74'))[_0x3188('0x3b')](_0x3188('0x75'),squel[_0x3188('0x67')]()['field'](_0x3188('0x69'))[_0x3188('0x6f')](_0x3188('0x60'))[_0x3188('0x3b')](_0x3188('0x71'),_0x693395[_0x3188('0x45')]['id'][_0x3188('0x73')]()))[_0x3188('0x3b')](_0x3188('0x75'),squel[_0x3188('0x67')]()[_0x3188('0x6c')](_0x3188('0x76'))[_0x3188('0x6f')](_0x3188('0x70'))[_0x3188('0x3b')](_0x3188('0x71'),_0x693395[_0x3188('0x45')]['id'][_0x3188('0x73')]())['where'](_0x3188('0x77')))[_0x3188('0x78')](_0x3188('0x6b')))[_0x3188('0x73')]();return db[_0x3188('0x4c')]['query'](_0x5b93cd);}return[];})[_0x3188('0x23')](respondWithResult(_0x3b6a13,null))[_0x3188('0x46')](handleError(_0x3b6a13,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0xc1ee8e,_0x2ba5a5,_0x43212c){return db['Campaign'][_0x3188('0x4a')]({'where':{'id':_0xc1ee8e['params']['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x2ba5a5,null))[_0x3188('0x23')](function(_0x31029d){var _0xcf9ceb;if(_0x31029d){_0xcf9ceb=squel[_0x3188('0x5f')]()[_0x3188('0x79')]('cm_hopper')['fromQuery']([_0x3188('0x69'),_0x3188('0x62'),_0x3188('0x6b'),_0x3188('0x63'),_0x3188('0x7a'),_0x3188('0x65'),'updatedAt'],squel[_0x3188('0x67')]()[_0x3188('0x6c')](_0x3188('0x68'),_0x3188('0x69'))['field'](_0x3188('0x6a'),'scheduledAt')['field']('ANY_VALUE(ContactId)','ContactId')[_0x3188('0x6c')](_0x3188('0x6d'),'ListId')[_0x3188('0x6c')](_0x3188('0x7b'),'CampaignId')[_0x3188('0x6c')]('NOW()',_0x3188('0x65'))[_0x3188('0x6c')]('NOW()',_0x3188('0x66'))[_0x3188('0x6f')](_0x3188('0x70'))[_0x3188('0x3b')](_0x3188('0x7c'),_0xc1ee8e[_0x3188('0x45')]['id'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x72'),_0xc1ee8e[_0x3188('0x48')]['state'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x74'))['where'](_0x3188('0x75'),squel['select']()[_0x3188('0x6c')]('phone')['from']('cm_hopper')['where'](_0x3188('0x7c'),_0xc1ee8e[_0x3188('0x45')]['id'][_0x3188('0x73')]()))[_0x3188('0x3b')](_0x3188('0x75'),squel['select']()[_0x3188('0x6c')]('calleridnum')['from'](_0x3188('0x70'))[_0x3188('0x3b')]('CampaignId\x20=\x20?',_0xc1ee8e[_0x3188('0x45')]['id'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x77')))[_0x3188('0x78')](_0x3188('0x6b')))[_0x3188('0x73')]();return db['sequelize'][_0x3188('0x30')](_0xcf9ceb);}return[];})[_0x3188('0x23')](respondWithResult(_0x2ba5a5,null))[_0x3188('0x46')](handleError(_0x2ba5a5,null));};exports[_0x3188('0x7d')]=function(_0x203f04,_0x12c18c,_0x11b74c){return db[_0x3188('0x7e')][_0x3188('0x7f')]({'where':{'VoiceQueueId':_0x203f04['body'][_0x3188('0x64')],'CampaignId':_0x203f04['body'][_0x3188('0x7a')],'ContactId':_0x203f04[_0x3188('0x48')][_0x3188('0x6b')]}})[_0x3188('0x23')](handleEntityNotFound(_0x12c18c,null))[_0x3188('0x23')](function(_0x41ca86){if(_0x41ca86){return _0x41ca86;}return null;})[_0x3188('0x23')](respondWithResult(_0x12c18c,null))[_0x3188('0x46')](handleError(_0x12c18c,null));}; \ No newline at end of file +var _0x1261=['attributes','fields','length','hasOwnProperty','sort','pick','filters','where','type','VIRTUAL','filter','merge','options','findAll','rows','params','include','find','describe','catch','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','cm_hopper','fromQuery','phone','scheduledAt','createdAt','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','VoiceQueueId','from','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','into','ListId','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','checkContactHopper','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','CmHopperFinal','model','map','name','keys','query','intersection'];(function(_0x428d5f,_0x44fab1){var _0x2831c6=function(_0x1a57e4){while(--_0x1a57e4){_0x428d5f['push'](_0x428d5f['shift']());}};_0x2831c6(++_0x44fab1);}(_0x1261,0x144));var _0x1126=function(_0x3182f0,_0x22236d){_0x3182f0=_0x3182f0-0x0;var _0x5adfc1=_0x1261[_0x3182f0];return _0x5adfc1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}exports['index']=function(_0x2fb797,_0x23d2bc){var _0x4a334a={},_0x3fa694={},_0x4bf807={'count':0x0,'rows':[]};var _0xc62460=_['map'](db[_0x1126('0x29')]['rawAttributes'],function(_0x378f4d){return{'name':_0x378f4d['fieldName'],'type':_0x378f4d['type']['key']};});_0x3fa694[_0x1126('0x2a')]=_[_0x1126('0x2b')](_0xc62460,_0x1126('0x2c'));_0x3fa694['query']=_[_0x1126('0x2d')](_0x2fb797[_0x1126('0x2e')]);_0x3fa694['filters']=_[_0x1126('0x2f')](_0x3fa694[_0x1126('0x2a')],_0x3fa694[_0x1126('0x2e')]);_0x4a334a[_0x1126('0x30')]=_['intersection'](_0x3fa694['model'],qs[_0x1126('0x31')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x31')]));_0x4a334a[_0x1126('0x30')]=_0x4a334a['attributes'][_0x1126('0x32')]?_0x4a334a[_0x1126('0x30')]:_0x3fa694[_0x1126('0x2a')];if(!_0x2fb797[_0x1126('0x2e')][_0x1126('0x33')]('nolimit')){_0x4a334a[_0x1126('0x1e')]=qs[_0x1126('0x1e')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1e')]);_0x4a334a['offset']=qs['offset'](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1c')]);}_0x4a334a['order']=qs[_0x1126('0x34')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x34')]);_0x4a334a['where']=qs['filters'](_[_0x1126('0x35')](_0x2fb797[_0x1126('0x2e')],_0x3fa694[_0x1126('0x36')]),_0xc62460);if(_0x2fb797[_0x1126('0x2e')]['filter']){_0x4a334a[_0x1126('0x37')]=_['merge'](_0x4a334a[_0x1126('0x37')],{'$or':_[_0x1126('0x2b')](_0xc62460,function(_0xfa96e0){if(_0xfa96e0[_0x1126('0x38')]!==_0x1126('0x39')){var _0x5746f6={};_0x5746f6[_0xfa96e0[_0x1126('0x2c')]]={'$like':'%'+_0x2fb797[_0x1126('0x2e')][_0x1126('0x3a')]+'%'};return _0x5746f6;}})});}_0x4a334a=_[_0x1126('0x3b')]({},_0x4a334a,_0x2fb797[_0x1126('0x3c')]);var _0x3442b8={'where':_0x4a334a[_0x1126('0x37')]};return db['CmHopperFinal'][_0x1126('0x1f')](_0x3442b8)[_0x1126('0x25')](function(_0x227a6b){_0x4bf807[_0x1126('0x1f')]=_0x227a6b;if(_0x2fb797[_0x1126('0x2e')]['includeAll']){_0x4a334a['include']=[{'all':!![]}];}return db[_0x1126('0x29')][_0x1126('0x3d')](_0x4a334a);})[_0x1126('0x25')](function(_0x21c38e){_0x4bf807[_0x1126('0x3e')]=_0x21c38e;return _0x4bf807;})[_0x1126('0x25')](respondWithFilteredResult(_0x23d2bc,_0x4a334a))['catch'](handleError(_0x23d2bc,null));};exports['show']=function(_0x4cb1db,_0xb8054e){var _0x5d4194={'raw':!![],'where':{'id':_0x4cb1db[_0x1126('0x3f')]['id']}},_0xf84005={};_0xf84005[_0x1126('0x2a')]=_[_0x1126('0x2d')](db['CmHopperFinal']['rawAttributes']);_0xf84005[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x4cb1db[_0x1126('0x2e')]);_0xf84005['filters']=_[_0x1126('0x2f')](_0xf84005['model'],_0xf84005[_0x1126('0x2e')]);_0x5d4194['attributes']=_[_0x1126('0x2f')](_0xf84005[_0x1126('0x2a')],qs[_0x1126('0x31')](_0x4cb1db['query'][_0x1126('0x31')]));_0x5d4194[_0x1126('0x30')]=_0x5d4194[_0x1126('0x30')]['length']?_0x5d4194['attributes']:_0xf84005['model'];if(_0x4cb1db[_0x1126('0x2e')]['includeAll']){_0x5d4194[_0x1126('0x40')]=[{'all':!![]}];}_0x5d4194=_['merge']({},_0x5d4194,_0x4cb1db[_0x1126('0x3c')]);return db[_0x1126('0x29')][_0x1126('0x41')](_0x5d4194)[_0x1126('0x25')](handleEntityNotFound(_0xb8054e,null))[_0x1126('0x25')](respondWithResult(_0xb8054e,null))['catch'](handleError(_0xb8054e,null));};exports[_0x1126('0x42')]=function(_0x512f60,_0x5111d3){return db[_0x1126('0x29')][_0x1126('0x42')]()['then'](respondWithResult(_0x5111d3,null))[_0x1126('0x43')](handleError(_0x5111d3,null));};exports[_0x1126('0x24')]=function(_0x518e0a,_0x3e4eeb){if(_0x518e0a[_0x1126('0x44')][_0x1126('0x45')]){delete _0x518e0a['body'][_0x1126('0x45')];}return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'uniqueid':_0x518e0a[_0x1126('0x3f')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0x3e4eeb,null))[_0x1126('0x25')](saveUpdates(_0x518e0a[_0x1126('0x44')],null))[_0x1126('0x25')](respondWithResult(_0x3e4eeb,null))['catch'](handleError(_0x3e4eeb,null));};exports[_0x1126('0x46')]=function(_0x5a2287,_0x40168e,_0x2ad118){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x5a2287[_0x1126('0x3f')]['id']},'attributes':[[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x4a')))),_0x1126('0x4b')],[db['sequelize']['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x4c')))),_0x1126('0x4d')],[db[_0x1126('0x47')]['fn']('COUNT',db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')]['literal'](_0x1126('0x4e')))),_0x1126('0x4f')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db['sequelize'][_0x1126('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x1126('0x50')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x1126('0x51')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x52')))),_0x1126('0x53')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')]['literal'](_0x1126('0x54')))),_0x1126('0x55')]]})[_0x1126('0x25')](handleEntityNotFound(_0x40168e,null))[_0x1126('0x25')](respondWithResult(_0x40168e,null))[_0x1126('0x43')](handleError(_0x40168e,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0xcc1a95,_0x315386,_0x5e0ea1){return db[_0x1126('0x29')]['findAll']({'raw':![],'where':{'CampaignId':_0xcc1a95[_0x1126('0x3f')]['id']},'attributes':[[db[_0x1126('0x47')]['fn']('COUNT',db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')]('`state`\x20=\x200,\x201,\x20null'))),_0x1126('0x4b')],[db['sequelize']['fn']('COUNT',db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x56')))),_0x1126('0x57')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x4c')))),_0x1126('0x4d')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x1126('0x49')](_0x1126('0x4e')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x58')))),'dropContacts'],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x59')))),_0x1126('0x51')],[db['sequelize']['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x52')))),'reCallContacts'],[db['sequelize']['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db['sequelize'][_0x1126('0x49')](_0x1126('0x54')))),_0x1126('0x55')]]})[_0x1126('0x25')](handleEntityNotFound(_0x315386,null))[_0x1126('0x25')](respondWithResult(_0x315386,null))[_0x1126('0x43')](handleError(_0x315386,null));};exports[_0x1126('0x5a')]=function(_0x247f12,_0xd20fbe,_0x3d5e15){return db[_0x1126('0x5b')][_0x1126('0x41')]({'where':{'id':_0x247f12[_0x1126('0x3f')]['id']}})['then'](handleEntityNotFound(_0xd20fbe,null))[_0x1126('0x25')](function(_0x274343){var _0x2b61ae;if(_0x274343){_0x2b61ae=squel['insert']()['into'](_0x1126('0x5c'))[_0x1126('0x5d')]([_0x1126('0x5e'),_0x1126('0x5f'),'ContactId','ListId','VoiceQueueId',_0x1126('0x60'),_0x1126('0x61')],squel[_0x1126('0x62')]()[_0x1126('0x63')]('ANY_VALUE(calleridnum)',_0x1126('0x5e'))['field'](_0x1126('0x64'),_0x1126('0x5f'))[_0x1126('0x63')](_0x1126('0x65'),_0x1126('0x66'))[_0x1126('0x63')](_0x1126('0x67'),'ListId')[_0x1126('0x63')]('ANY_VALUE(VoiceQueueId)',_0x1126('0x68'))[_0x1126('0x63')]('NOW()',_0x1126('0x60'))[_0x1126('0x63')]('NOW()',_0x1126('0x61'))[_0x1126('0x69')]('cm_hopper_final')['where'](_0x1126('0x6a'),_0x247f12[_0x1126('0x3f')]['id'][_0x1126('0x6b')]())['where']('state\x20=\x20?',_0x247f12['body'][_0x1126('0x6c')]['toString']())['where'](_0x1126('0x6d'))['where'](_0x1126('0x6e'),squel[_0x1126('0x62')]()['field'](_0x1126('0x5e'))[_0x1126('0x69')](_0x1126('0x5c'))[_0x1126('0x37')](_0x1126('0x6a'),_0x247f12['params']['id'][_0x1126('0x6b')]()))[_0x1126('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x1126('0x62')]()[_0x1126('0x63')](_0x1126('0x6f'))[_0x1126('0x69')](_0x1126('0x70'))[_0x1126('0x37')](_0x1126('0x6a'),_0x247f12[_0x1126('0x3f')]['id'][_0x1126('0x6b')]())[_0x1126('0x37')](_0x1126('0x71')))[_0x1126('0x72')](_0x1126('0x66')))[_0x1126('0x6b')]();return db[_0x1126('0x47')][_0x1126('0x2e')](_0x2b61ae);}return[];})['then'](respondWithResult(_0xd20fbe,null))[_0x1126('0x43')](handleError(_0xd20fbe,null));};exports[_0x1126('0x73')]=function(_0x33cccf,_0x1483f4,_0x3be5bf){return db['Campaign'][_0x1126('0x41')]({'where':{'id':_0x33cccf['params']['id']}})['then'](handleEntityNotFound(_0x1483f4,null))[_0x1126('0x25')](function(_0x2b1884){var _0x55f366;if(_0x2b1884){_0x55f366=squel['insert']()[_0x1126('0x74')](_0x1126('0x5c'))[_0x1126('0x5d')]([_0x1126('0x5e'),_0x1126('0x5f'),_0x1126('0x66'),_0x1126('0x75'),_0x1126('0x76'),_0x1126('0x60'),'updatedAt'],squel[_0x1126('0x62')]()[_0x1126('0x63')](_0x1126('0x77'),_0x1126('0x5e'))[_0x1126('0x63')](_0x1126('0x64'),'scheduledAt')[_0x1126('0x63')](_0x1126('0x65'),_0x1126('0x66'))[_0x1126('0x63')](_0x1126('0x67'),_0x1126('0x75'))[_0x1126('0x63')](_0x1126('0x78'),_0x1126('0x76'))[_0x1126('0x63')]('NOW()','createdAt')[_0x1126('0x63')]('NOW()',_0x1126('0x61'))['from'](_0x1126('0x70'))['where'](_0x1126('0x79'),_0x33cccf['params']['id']['toString']())['where'](_0x1126('0x7a'),_0x33cccf[_0x1126('0x44')]['state']['toString']())[_0x1126('0x37')](_0x1126('0x6d'))[_0x1126('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x1126('0x63')]('phone')[_0x1126('0x69')](_0x1126('0x5c'))[_0x1126('0x37')](_0x1126('0x79'),_0x33cccf[_0x1126('0x3f')]['id']['toString']()))['where'](_0x1126('0x6e'),squel[_0x1126('0x62')]()[_0x1126('0x63')](_0x1126('0x6f'))[_0x1126('0x69')](_0x1126('0x70'))[_0x1126('0x37')](_0x1126('0x79'),_0x33cccf[_0x1126('0x3f')]['id'][_0x1126('0x6b')]())[_0x1126('0x37')]('state\x20=\x204'))[_0x1126('0x72')]('ContactId'))[_0x1126('0x6b')]();return db['sequelize'][_0x1126('0x2e')](_0x55f366);}return[];})[_0x1126('0x25')](respondWithResult(_0x1483f4,null))[_0x1126('0x43')](handleError(_0x1483f4,null));};exports[_0x1126('0x7b')]=function(_0x59c04b,_0x429183,_0x834360){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x59c04b[_0x1126('0x44')][_0x1126('0x68')],'CampaignId':_0x59c04b[_0x1126('0x44')]['CampaignId'],'ContactId':_0x59c04b[_0x1126('0x44')]['ContactId']}})[_0x1126('0x25')](handleEntityNotFound(_0x429183,null))[_0x1126('0x25')](function(_0x4d6bb2){if(_0x4d6bb2){return _0x4d6bb2;}return null;})[_0x1126('0x25')](respondWithResult(_0x429183,null))[_0x1126('0x43')](handleError(_0x429183,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 3bea7ad..18af121 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 _0xa8fd=['lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid'];(function(_0xacdebd,_0x29e3b4){var _0x3952f5=function(_0x1161e3){while(--_0x1161e3){_0xacdebd['push'](_0xacdebd['shift']());}};_0x3952f5(++_0x29e3b4);}(_0xa8fd,0x1ee));var _0xda8f=function(_0x2ed289,_0x3b8426){_0x2ed289=_0x2ed289-0x0;var _0x467bde=_0xa8fd[_0x2ed289];return _0x467bde;};'use strict';var _=require(_0xda8f('0x0'));var util=require('util');var logger=require(_0xda8f('0x1'))('api');var moment=require(_0xda8f('0x2'));var BPromise=require(_0xda8f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xda8f('0x4'));var rimraf=require(_0xda8f('0x5'));var config=require(_0xda8f('0x6'));var attributes=require(_0xda8f('0x7'));module[_0xda8f('0x8')]=function(_0x3cccea,_0x529350){return _0x3cccea['define'](_0xda8f('0x9'),attributes,{'tableName':_0xda8f('0xa'),'paranoid':![],'indexes':[{'name':_0xda8f('0xb'),'fields':[_0xda8f('0xb')]},{'name':_0xda8f('0xc'),'fields':[_0xda8f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2237=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util'];(function(_0x9564bf,_0x2a7500){var _0x3365cb=function(_0x275c48){while(--_0x275c48){_0x9564bf['push'](_0x9564bf['shift']());}};_0x3365cb(++_0x2a7500);}(_0x2237,0x1da));var _0x7223=function(_0x3d83de,_0x1f4421){_0x3d83de=_0x3d83de-0x0;var _0x3981ed=_0x2237[_0x3d83de];return _0x3981ed;};'use strict';var _=require(_0x7223('0x0'));var util=require(_0x7223('0x1'));var logger=require(_0x7223('0x2'))(_0x7223('0x3'));var moment=require('moment');var BPromise=require(_0x7223('0x4'));var rp=require(_0x7223('0x5'));var fs=require('fs');var path=require(_0x7223('0x6'));var rimraf=require('rimraf');var config=require(_0x7223('0x7'));var attributes=require(_0x7223('0x8'));module['exports']=function(_0xd14dca,_0x2c9f1f){return _0xd14dca[_0x7223('0x9')](_0x7223('0xa'),attributes,{'tableName':_0x7223('0xb'),'paranoid':![],'indexes':[{'name':_0x7223('0xc'),'fields':[_0x7223('0xc')]},{'name':_0x7223('0xd'),'fields':[_0x7223('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 960dc4c..7265015 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(_0xa1b41d,_0x2c1555){var _0x14c319=function(_0x2d568b){while(--_0x2d568b){_0xa1b41d['push'](_0xa1b41d['shift']());}};_0x14c319(++_0x2c1555);}(_0xb10b,0x12a));var _0xbb10=function(_0x5c4669,_0x7f9bcd){_0x5c4669=_0x5c4669-0x0;var _0xf18b6a=_0xb10b[_0x5c4669];return _0xf18b6a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x4164ae,_0x10a667){var _0x2b516c=function(_0x14d0c6){while(--_0x14d0c6){_0x4164ae['push'](_0x4164ae['shift']());}};_0x2b516c(++_0x10a667);}(_0x7a54,0x106));var _0x47a5=function(_0x45ad1b,_0x4c45cd){_0x45ad1b=_0x45ad1b-0x0;var _0x32ee5c=_0x7a54[_0x45ad1b];return _0x32ee5c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index ec19805..ce571f6 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 _0xf5bf=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','index','/describe','describe','get','isAuthenticated','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','/:id','exports','multer','util','path'];(function(_0x8d4584,_0x2c4470){var _0xf6a13f=function(_0x45c03b){while(--_0x45c03b){_0x8d4584['push'](_0x8d4584['shift']());}};_0xf6a13f(++_0x2c4470);}(_0xf5bf,0x15c));var _0xff5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf5bf[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xff5b('0x0'));var util=require(_0xff5b('0x1'));var path=require(_0xff5b('0x2'));var timeout=require(_0xff5b('0x3'));var express=require(_0xff5b('0x4'));var router=express[_0xff5b('0x5')]();var fs_extra=require(_0xff5b('0x6'));var auth=require(_0xff5b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xff5b('0x8'));var controller=require(_0xff5b('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xff5b('0xa')]);router['get'](_0xff5b('0xb'),auth['isAuthenticated'](),controller[_0xff5b('0xc')]);router[_0xff5b('0xd')]('/:id',auth[_0xff5b('0xe')](),controller[_0xff5b('0xf')]);router[_0xff5b('0xd')](_0xff5b('0x10'),auth[_0xff5b('0xe')](),controller[_0xff5b('0x11')]);router[_0xff5b('0xd')]('/campaign/countAttributes/:id',auth[_0xff5b('0xe')](),controller[_0xff5b('0x12')]);router[_0xff5b('0x13')](_0xff5b('0x14'),auth[_0xff5b('0xe')](),controller[_0xff5b('0x15')]);router[_0xff5b('0x13')](_0xff5b('0x16'),auth['isAuthenticated'](),controller[_0xff5b('0x17')]);router[_0xff5b('0x13')](_0xff5b('0x18'),auth[_0xff5b('0xe')](),controller['checkContactHopper']);router['put'](_0xff5b('0x19'),auth['isAuthenticated'](),controller['update']);module[_0xff5b('0x1a')]=router; \ No newline at end of file +var _0xd92e=['show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','get','/describe','isAuthenticated','describe','/:id'];(function(_0xc4e744,_0x305050){var _0x27f1db=function(_0x5e15f5){while(--_0x5e15f5){_0xc4e744['push'](_0xc4e744['shift']());}};_0x27f1db(++_0x305050);}(_0xd92e,0x1bc));var _0xed92=function(_0x1b1cc3,_0x31ca74){_0x1b1cc3=_0x1b1cc3-0x0;var _0x299e1c=_0xd92e[_0x1b1cc3];return _0x299e1c;};'use strict';var multer=require('multer');var util=require(_0xed92('0x0'));var path=require(_0xed92('0x1'));var timeout=require('connect-timeout');var express=require(_0xed92('0x2'));var router=express['Router']();var fs_extra=require(_0xed92('0x3'));var auth=require(_0xed92('0x4'));var interaction=require(_0xed92('0x5'));var config=require('../../config/environment');var controller=require(_0xed92('0x6'));router[_0xed92('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xed92('0x8'),auth[_0xed92('0x9')](),controller[_0xed92('0xa')]);router['get'](_0xed92('0xb'),auth[_0xed92('0x9')](),controller[_0xed92('0xc')]);router['get'](_0xed92('0xd'),auth[_0xed92('0x9')](),controller[_0xed92('0xe')]);router[_0xed92('0x7')]('/campaign/countAttributes/:id',auth[_0xed92('0x9')](),controller[_0xed92('0xf')]);router[_0xed92('0x10')](_0xed92('0x11'),auth[_0xed92('0x9')](),controller[_0xed92('0x12')]);router['post']('/voice/campaign/moveContacts/:id',auth[_0xed92('0x9')](),controller[_0xed92('0x13')]);router[_0xed92('0x10')](_0xed92('0x14'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0xed92('0x15')](_0xed92('0xb'),auth['isAuthenticated'](),controller[_0xed92('0x16')]);module[_0xed92('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 88f4440..0ec24ae 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 _0x3a8a=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a8a,0x112));var _0xa3a8=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x3a8a[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0xa3a8('0x0'));module[_0xa3a8('0x1')]={'state':{'type':Sequelize[_0xa3a8('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xa3a8('0x3')]},'scheduledat':{'type':Sequelize[_0xa3a8('0x4')]},'countbusyretry':{'type':Sequelize[_0xa3a8('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa3a8('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa3a8('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa3a8('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xa3a8('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xa3a8('0x3')]},'originatecalleridname':{'type':Sequelize[_0xa3a8('0x3')]},'calleridnum':{'type':Sequelize[_0xa3a8('0x3')]},'calleridname':{'type':Sequelize[_0xa3a8('0x3')]},'starttime':{'type':Sequelize[_0xa3a8('0x4')]},'responsetime':{'type':Sequelize[_0xa3a8('0x4')]},'answertime':{'type':Sequelize[_0xa3a8('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xa3a8('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xa3a8('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xa3a8('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xa3a8('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xa3a8('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xa3a8('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xa3a8('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa3a8('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xa3a8('0x4')]},'edited':{'type':Sequelize[_0xa3a8('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa3a8('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa3a8('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa3a8('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5308=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x13bdcf,_0x4d28d3){var _0x58a251=function(_0x19f0ac){while(--_0x19f0ac){_0x13bdcf['push'](_0x13bdcf['shift']());}};_0x58a251(++_0x4d28d3);}(_0x5308,0xeb));var _0x8530=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x5308[_0x599f41];return _0x2e4d58;};'use strict';var Sequelize=require(_0x8530('0x0'));module[_0x8530('0x1')]={'state':{'type':Sequelize[_0x8530('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x8530('0x3')]},'scheduledat':{'type':Sequelize[_0x8530('0x4')]},'countbusyretry':{'type':Sequelize[_0x8530('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8530('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8530('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8530('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x8530('0x3')]},'originatecalleridname':{'type':Sequelize[_0x8530('0x3')]},'calleridnum':{'type':Sequelize[_0x8530('0x3')]},'calleridname':{'type':Sequelize[_0x8530('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x8530('0x4')]},'answertime':{'type':Sequelize[_0x8530('0x4')]},'droptime':{'type':Sequelize[_0x8530('0x4')]},'endtime':{'type':Sequelize[_0x8530('0x4')]},'ringtime':{'type':Sequelize[_0x8530('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8530('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8530('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8530('0x3')]},'campaign':{'type':Sequelize[_0x8530('0x3')]},'campaigntype':{'type':Sequelize[_0x8530('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x8530('0x3')]},'amd':{'type':Sequelize[_0x8530('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x8530('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8530('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8530('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8530('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x8530('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8530('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8530('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8530('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8530('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 9882152..f096091 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 _0x0a6b=['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','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','destroy','then','error','stack','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','uniqueid','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x436d7b,_0xfcba14){var _0x58610e=function(_0x239e39){while(--_0x239e39){_0x436d7b['push'](_0x436d7b['shift']());}};_0x58610e(++_0xfcba14);}(_0x0a6b,0xd5));var _0xb0a6=function(_0x5ce079,_0x461973){_0x5ce079=_0x5ce079-0x0;var _0x586193=_0x0a6b[_0x5ce079];return _0x586193;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb0a6('0x0'));var zipdir=require(_0xb0a6('0x1'));var jsonpatch=require(_0xb0a6('0x2'));var rp=require(_0xb0a6('0x3'));var moment=require('moment');var BPromise=require(_0xb0a6('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb0a6('0x5'));var sox=require(_0xb0a6('0x6'));var csv=require(_0xb0a6('0x7'));var ejs=require(_0xb0a6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb0a6('0x9'));var squel=require(_0xb0a6('0xa'));var crypto=require(_0xb0a6('0xb'));var jsforce=require(_0xb0a6('0xc'));var deskjs=require(_0xb0a6('0xd'));var toCsv=require(_0xb0a6('0x7'));var querystring=require(_0xb0a6('0xe'));var Papa=require(_0xb0a6('0xf'));var Redis=require(_0xb0a6('0x10'));var authService=require(_0xb0a6('0x11'));var qs=require(_0xb0a6('0x12'));var as=require(_0xb0a6('0x13'));var hardwareService=require(_0xb0a6('0x14'));var logger=require(_0xb0a6('0x15'))('api');var utils=require(_0xb0a6('0x16'));var config=require(_0xb0a6('0x17'));var licenseUtil=require(_0xb0a6('0x18'));var db=require(_0xb0a6('0x19'))['db'];function respondWithStatusCode(_0x454c6c,_0x115611){_0x115611=_0x115611||0xcc;return function(_0x58b475){if(_0x58b475){return _0x454c6c[_0xb0a6('0x1a')](_0x115611);}return _0x454c6c['status'](_0x115611)[_0xb0a6('0x1b')]();};}function respondWithResult(_0x5605b3,_0x5d45d6){_0x5d45d6=_0x5d45d6||0xc8;return function(_0x3bbaf3){if(_0x3bbaf3){return _0x5605b3[_0xb0a6('0x1c')](_0x5d45d6)[_0xb0a6('0x1d')](_0x3bbaf3);}};}function respondWithFilteredResult(_0x391103,_0x1ad3bf){return function(_0x3b2c69){if(_0x3b2c69){var _0x532f65=typeof _0x1ad3bf['offset']===_0xb0a6('0x1e')&&typeof _0x1ad3bf[_0xb0a6('0x1f')]==='undefined';var _0x2c761a=_0x3b2c69[_0xb0a6('0x20')];var _0x4fe67a=_0x532f65?0x0:_0x1ad3bf[_0xb0a6('0x21')];var _0x4846c6=_0x532f65?_0x3b2c69[_0xb0a6('0x20')]:_0x1ad3bf[_0xb0a6('0x21')]+_0x1ad3bf['limit'];var _0x5670c6;if(_0x4846c6>=_0x2c761a){_0x4846c6=_0x2c761a;_0x5670c6=0xc8;}else{_0x5670c6=0xce;}_0x391103[_0xb0a6('0x1c')](_0x5670c6);return _0x391103[_0xb0a6('0x22')](_0xb0a6('0x23'),_0x4fe67a+'-'+_0x4846c6+'/'+_0x2c761a)[_0xb0a6('0x1d')](_0x3b2c69);}return null;};}function patchUpdates(_0x512ba3){return function(_0x10e968){try{jsonpatch['apply'](_0x10e968,_0x512ba3,!![]);}catch(_0x2694d5){return BPromise[_0xb0a6('0x24')](_0x2694d5);}return _0x10e968[_0xb0a6('0x25')]();};}function saveUpdates(_0x57355e,_0x23e2ad){return function(_0x3be9af){if(_0x3be9af){return _0x3be9af['update'](_0x57355e)['then'](function(_0x36baf3){return _0x36baf3;});}return null;};}function removeEntity(_0x285cda,_0x45fcdb){return function(_0x23e081){if(_0x23e081){return _0x23e081[_0xb0a6('0x26')]()[_0xb0a6('0x27')](function(){_0x285cda[_0xb0a6('0x1c')](0xcc)[_0xb0a6('0x1b')]();});}};}function handleEntityNotFound(_0x46b546,_0x4038c2){return function(_0x420939){if(!_0x420939){_0x46b546[_0xb0a6('0x1a')](0x194);}return _0x420939;};}function handleError(_0x17658e,_0x8273d4){_0x8273d4=_0x8273d4||0x1f4;return function(_0x16970d){logger[_0xb0a6('0x28')](_0x16970d[_0xb0a6('0x29')]);if(_0x16970d[_0xb0a6('0x2a')]){delete _0x16970d[_0xb0a6('0x2a')];}_0x17658e[_0xb0a6('0x1c')](_0x8273d4)['send'](_0x16970d);};}exports[_0xb0a6('0x2b')]=function(_0x5c050c,_0x570a9d){var _0x2575cb={},_0x480663={},_0x369877={'count':0x0,'rows':[]};var _0x4a479f=_[_0xb0a6('0x2c')](db[_0xb0a6('0x2d')][_0xb0a6('0x2e')],function(_0x25ad60){return{'name':_0x25ad60[_0xb0a6('0x2f')],'type':_0x25ad60[_0xb0a6('0x30')]['key']};});_0x480663[_0xb0a6('0x31')]=_[_0xb0a6('0x2c')](_0x4a479f,_0xb0a6('0x2a'));_0x480663[_0xb0a6('0x32')]=_[_0xb0a6('0x33')](_0x5c050c['query']);_0x480663[_0xb0a6('0x34')]=_['intersection'](_0x480663[_0xb0a6('0x31')],_0x480663[_0xb0a6('0x32')]);_0x2575cb[_0xb0a6('0x35')]=_[_0xb0a6('0x36')](_0x480663[_0xb0a6('0x31')],qs[_0xb0a6('0x37')](_0x5c050c[_0xb0a6('0x32')][_0xb0a6('0x37')]));_0x2575cb[_0xb0a6('0x35')]=_0x2575cb[_0xb0a6('0x35')][_0xb0a6('0x38')]?_0x2575cb[_0xb0a6('0x35')]:_0x480663['model'];if(!_0x5c050c[_0xb0a6('0x32')]['hasOwnProperty'](_0xb0a6('0x39'))){_0x2575cb[_0xb0a6('0x1f')]=qs[_0xb0a6('0x1f')](_0x5c050c['query']['limit']);_0x2575cb[_0xb0a6('0x21')]=qs[_0xb0a6('0x21')](_0x5c050c[_0xb0a6('0x32')][_0xb0a6('0x21')]);}_0x2575cb[_0xb0a6('0x3a')]=qs[_0xb0a6('0x3b')](_0x5c050c['query']['sort']);_0x2575cb[_0xb0a6('0x3c')]=qs[_0xb0a6('0x34')](_[_0xb0a6('0x3d')](_0x5c050c[_0xb0a6('0x32')],_0x480663['filters']),_0x4a479f);if(_0x5c050c[_0xb0a6('0x32')][_0xb0a6('0x3e')]){_0x2575cb['where']=_[_0xb0a6('0x3f')](_0x2575cb[_0xb0a6('0x3c')],{'$or':_['map'](_0x4a479f,function(_0x3d6209){if(_0x3d6209['type']!==_0xb0a6('0x40')){var _0x42d709={};_0x42d709[_0x3d6209[_0xb0a6('0x2a')]]={'$like':'%'+_0x5c050c[_0xb0a6('0x32')]['filter']+'%'};return _0x42d709;}})});}_0x2575cb=_[_0xb0a6('0x3f')]({},_0x2575cb,_0x5c050c[_0xb0a6('0x41')]);var _0x5be849={'where':_0x2575cb[_0xb0a6('0x3c')]};return db[_0xb0a6('0x2d')][_0xb0a6('0x20')](_0x5be849)[_0xb0a6('0x27')](function(_0x23b971){_0x369877['count']=_0x23b971;if(_0x5c050c[_0xb0a6('0x32')][_0xb0a6('0x42')]){_0x2575cb['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xb0a6('0x43')](_0x2575cb);})[_0xb0a6('0x27')](function(_0x7467f5){_0x369877[_0xb0a6('0x44')]=_0x7467f5;return _0x369877;})[_0xb0a6('0x27')](respondWithFilteredResult(_0x570a9d,_0x2575cb))[_0xb0a6('0x45')](handleError(_0x570a9d,null));};exports[_0xb0a6('0x46')]=function(_0x1fa8fc,_0x2749af){var _0x5db257={'raw':!![],'where':{'id':_0x1fa8fc[_0xb0a6('0x47')]['id']}},_0x370a3c={};_0x370a3c[_0xb0a6('0x31')]=_[_0xb0a6('0x33')](db[_0xb0a6('0x2d')][_0xb0a6('0x2e')]);_0x370a3c[_0xb0a6('0x32')]=_[_0xb0a6('0x33')](_0x1fa8fc[_0xb0a6('0x32')]);_0x370a3c['filters']=_[_0xb0a6('0x36')](_0x370a3c[_0xb0a6('0x31')],_0x370a3c[_0xb0a6('0x32')]);_0x5db257[_0xb0a6('0x35')]=_[_0xb0a6('0x36')](_0x370a3c[_0xb0a6('0x31')],qs[_0xb0a6('0x37')](_0x1fa8fc[_0xb0a6('0x32')]['fields']));_0x5db257[_0xb0a6('0x35')]=_0x5db257[_0xb0a6('0x35')][_0xb0a6('0x38')]?_0x5db257['attributes']:_0x370a3c[_0xb0a6('0x31')];if(_0x1fa8fc[_0xb0a6('0x32')][_0xb0a6('0x42')]){_0x5db257['include']=[{'all':!![]}];}_0x5db257=_[_0xb0a6('0x3f')]({},_0x5db257,_0x1fa8fc['options']);return db[_0xb0a6('0x2d')][_0xb0a6('0x48')](_0x5db257)[_0xb0a6('0x27')](handleEntityNotFound(_0x2749af,null))[_0xb0a6('0x27')](respondWithResult(_0x2749af,null))[_0xb0a6('0x45')](handleError(_0x2749af,null));};exports[_0xb0a6('0x49')]=function(_0x1a4a5c,_0x23575b){return db[_0xb0a6('0x2d')][_0xb0a6('0x49')](_0x1a4a5c[_0xb0a6('0x4a')],{})[_0xb0a6('0x27')](respondWithResult(_0x23575b,0xc9))['catch'](handleError(_0x23575b,null));};exports['describe']=function(_0x358fdb,_0xe1fab1){return db['CmHopperHistory']['describe']()[_0xb0a6('0x27')](respondWithResult(_0xe1fab1,null))[_0xb0a6('0x45')](handleError(_0xe1fab1,null));};exports['update']=function(_0x5fd8c6,_0x2bad87){if(_0x5fd8c6['body'][_0xb0a6('0x4b')]){delete _0x5fd8c6[_0xb0a6('0x4a')][_0xb0a6('0x4b')];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x5fd8c6[_0xb0a6('0x47')]['id']}})['then'](handleEntityNotFound(_0x2bad87,null))['then'](saveUpdates(_0x5fd8c6[_0xb0a6('0x4a')],null))[_0xb0a6('0x27')](respondWithResult(_0x2bad87,null))[_0xb0a6('0x45')](handleError(_0x2bad87,null));}; \ No newline at end of file +var _0x85e2=['name','index','CmHopperHistory','rawAttributes','fieldName','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','params','includeAll','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','stack'];(function(_0x25507b,_0x5350ed){var _0x41ead1=function(_0x41281b){while(--_0x41281b){_0x25507b['push'](_0x25507b['shift']());}};_0x41ead1(++_0x5350ed);}(_0x85e2,0xf5));var _0x285e=function(_0x10ec04,_0x45ca9d){_0x10ec04=_0x10ec04-0x0;var _0x46eca4=_0x85e2[_0x10ec04];return _0x46eca4;};'use strict';var emlformat=require(_0x285e('0x0'));var rimraf=require(_0x285e('0x1'));var zipdir=require(_0x285e('0x2'));var jsonpatch=require(_0x285e('0x3'));var rp=require(_0x285e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x285e('0x5'));var util=require(_0x285e('0x6'));var path=require(_0x285e('0x7'));var sox=require(_0x285e('0x8'));var csv=require(_0x285e('0x9'));var ejs=require(_0x285e('0xa'));var fs=require('fs');var fs_extra=require(_0x285e('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x285e('0xc'));var jsforce=require(_0x285e('0xd'));var deskjs=require(_0x285e('0xe'));var toCsv=require(_0x285e('0x9'));var querystring=require('querystring');var Papa=require(_0x285e('0xf'));var Redis=require('ioredis');var authService=require(_0x285e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x285e('0x11'));var hardwareService=require(_0x285e('0x12'));var logger=require(_0x285e('0x13'))('api');var utils=require(_0x285e('0x14'));var config=require(_0x285e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x285e('0x16'))['db'];function respondWithStatusCode(_0x11fe18,_0x5d9c8e){_0x5d9c8e=_0x5d9c8e||0xcc;return function(_0x2c94bb){if(_0x2c94bb){return _0x11fe18[_0x285e('0x17')](_0x5d9c8e);}return _0x11fe18[_0x285e('0x18')](_0x5d9c8e)[_0x285e('0x19')]();};}function respondWithResult(_0x23620b,_0x1fea0f){_0x1fea0f=_0x1fea0f||0xc8;return function(_0x2c17c1){if(_0x2c17c1){return _0x23620b['status'](_0x1fea0f)[_0x285e('0x1a')](_0x2c17c1);}};}function respondWithFilteredResult(_0x3919bc,_0x5360da){return function(_0x4f19bb){if(_0x4f19bb){var _0x250bfc=typeof _0x5360da[_0x285e('0x1b')]==='undefined'&&typeof _0x5360da[_0x285e('0x1c')]===_0x285e('0x1d');var _0x11a78e=_0x4f19bb[_0x285e('0x1e')];var _0x16b255=_0x250bfc?0x0:_0x5360da[_0x285e('0x1b')];var _0x1fd031=_0x250bfc?_0x4f19bb[_0x285e('0x1e')]:_0x5360da[_0x285e('0x1b')]+_0x5360da['limit'];var _0x1857f3;if(_0x1fd031>=_0x11a78e){_0x1fd031=_0x11a78e;_0x1857f3=0xc8;}else{_0x1857f3=0xce;}_0x3919bc[_0x285e('0x18')](_0x1857f3);return _0x3919bc[_0x285e('0x1f')](_0x285e('0x20'),_0x16b255+'-'+_0x1fd031+'/'+_0x11a78e)[_0x285e('0x1a')](_0x4f19bb);}return null;};}function patchUpdates(_0x2cccaa){return function(_0x19f6e1){try{jsonpatch[_0x285e('0x21')](_0x19f6e1,_0x2cccaa,!![]);}catch(_0x4b3aa2){return BPromise['reject'](_0x4b3aa2);}return _0x19f6e1[_0x285e('0x22')]();};}function saveUpdates(_0x40a231,_0x56ee0c){return function(_0x3f8031){if(_0x3f8031){return _0x3f8031[_0x285e('0x23')](_0x40a231)[_0x285e('0x24')](function(_0x2c2744){return _0x2c2744;});}return null;};}function removeEntity(_0x3da728,_0x3a86f3){return function(_0xa3cd77){if(_0xa3cd77){return _0xa3cd77[_0x285e('0x25')]()[_0x285e('0x24')](function(){_0x3da728[_0x285e('0x18')](0xcc)[_0x285e('0x19')]();});}};}function handleEntityNotFound(_0x44dde2,_0x29ddd3){return function(_0xc93dab){if(!_0xc93dab){_0x44dde2['sendStatus'](0x194);}return _0xc93dab;};}function handleError(_0xacfc28,_0x37c12d){_0x37c12d=_0x37c12d||0x1f4;return function(_0x5680dc){logger['error'](_0x5680dc[_0x285e('0x26')]);if(_0x5680dc['name']){delete _0x5680dc[_0x285e('0x27')];}_0xacfc28[_0x285e('0x18')](_0x37c12d)['send'](_0x5680dc);};}exports[_0x285e('0x28')]=function(_0x2aa063,_0x2e024c){var _0x11f3e8={},_0x2a7643={},_0x1c63e4={'count':0x0,'rows':[]};var _0x433548=_['map'](db[_0x285e('0x29')][_0x285e('0x2a')],function(_0x838fc2){return{'name':_0x838fc2[_0x285e('0x2b')],'type':_0x838fc2['type']['key']};});_0x2a7643[_0x285e('0x2c')]=_[_0x285e('0x2d')](_0x433548,_0x285e('0x27'));_0x2a7643[_0x285e('0x2e')]=_[_0x285e('0x2f')](_0x2aa063[_0x285e('0x2e')]);_0x2a7643[_0x285e('0x30')]=_['intersection'](_0x2a7643['model'],_0x2a7643[_0x285e('0x2e')]);_0x11f3e8[_0x285e('0x31')]=_[_0x285e('0x32')](_0x2a7643[_0x285e('0x2c')],qs[_0x285e('0x33')](_0x2aa063[_0x285e('0x2e')][_0x285e('0x33')]));_0x11f3e8[_0x285e('0x31')]=_0x11f3e8['attributes'][_0x285e('0x34')]?_0x11f3e8[_0x285e('0x31')]:_0x2a7643[_0x285e('0x2c')];if(!_0x2aa063[_0x285e('0x2e')][_0x285e('0x35')](_0x285e('0x36'))){_0x11f3e8[_0x285e('0x1c')]=qs['limit'](_0x2aa063[_0x285e('0x2e')][_0x285e('0x1c')]);_0x11f3e8['offset']=qs[_0x285e('0x1b')](_0x2aa063['query'][_0x285e('0x1b')]);}_0x11f3e8['order']=qs['sort'](_0x2aa063[_0x285e('0x2e')]['sort']);_0x11f3e8[_0x285e('0x37')]=qs[_0x285e('0x30')](_[_0x285e('0x38')](_0x2aa063[_0x285e('0x2e')],_0x2a7643['filters']),_0x433548);if(_0x2aa063[_0x285e('0x2e')][_0x285e('0x39')]){_0x11f3e8[_0x285e('0x37')]=_[_0x285e('0x3a')](_0x11f3e8[_0x285e('0x37')],{'$or':_[_0x285e('0x2d')](_0x433548,function(_0x3ce25d){if(_0x3ce25d['type']!==_0x285e('0x3b')){var _0x35d526={};_0x35d526[_0x3ce25d['name']]={'$like':'%'+_0x2aa063[_0x285e('0x2e')]['filter']+'%'};return _0x35d526;}})});}_0x11f3e8=_[_0x285e('0x3a')]({},_0x11f3e8,_0x2aa063['options']);var _0x3f9fe4={'where':_0x11f3e8[_0x285e('0x37')]};return db[_0x285e('0x29')][_0x285e('0x1e')](_0x3f9fe4)[_0x285e('0x24')](function(_0x2db1b7){_0x1c63e4[_0x285e('0x1e')]=_0x2db1b7;if(_0x2aa063['query']['includeAll']){_0x11f3e8[_0x285e('0x3c')]=[{'all':!![]}];}return db[_0x285e('0x29')][_0x285e('0x3d')](_0x11f3e8);})[_0x285e('0x24')](function(_0x5277ea){_0x1c63e4[_0x285e('0x3e')]=_0x5277ea;return _0x1c63e4;})[_0x285e('0x24')](respondWithFilteredResult(_0x2e024c,_0x11f3e8))[_0x285e('0x3f')](handleError(_0x2e024c,null));};exports['show']=function(_0x94c425,_0x488da6){var _0x50f1c1={'raw':!![],'where':{'id':_0x94c425[_0x285e('0x40')]['id']}},_0x2f8384={};_0x2f8384['model']=_['keys'](db[_0x285e('0x29')]['rawAttributes']);_0x2f8384[_0x285e('0x2e')]=_[_0x285e('0x2f')](_0x94c425[_0x285e('0x2e')]);_0x2f8384[_0x285e('0x30')]=_[_0x285e('0x32')](_0x2f8384[_0x285e('0x2c')],_0x2f8384[_0x285e('0x2e')]);_0x50f1c1[_0x285e('0x31')]=_[_0x285e('0x32')](_0x2f8384['model'],qs[_0x285e('0x33')](_0x94c425[_0x285e('0x2e')][_0x285e('0x33')]));_0x50f1c1[_0x285e('0x31')]=_0x50f1c1[_0x285e('0x31')][_0x285e('0x34')]?_0x50f1c1[_0x285e('0x31')]:_0x2f8384[_0x285e('0x2c')];if(_0x94c425[_0x285e('0x2e')][_0x285e('0x41')]){_0x50f1c1[_0x285e('0x3c')]=[{'all':!![]}];}_0x50f1c1=_[_0x285e('0x3a')]({},_0x50f1c1,_0x94c425['options']);return db[_0x285e('0x29')][_0x285e('0x42')](_0x50f1c1)[_0x285e('0x24')](handleEntityNotFound(_0x488da6,null))[_0x285e('0x24')](respondWithResult(_0x488da6,null))['catch'](handleError(_0x488da6,null));};exports[_0x285e('0x43')]=function(_0x5915f0,_0x1c24db){return db[_0x285e('0x29')][_0x285e('0x43')](_0x5915f0[_0x285e('0x44')],{})[_0x285e('0x24')](respondWithResult(_0x1c24db,0xc9))['catch'](handleError(_0x1c24db,null));};exports[_0x285e('0x45')]=function(_0x44c924,_0x10eb24){return db[_0x285e('0x29')][_0x285e('0x45')]()['then'](respondWithResult(_0x10eb24,null))[_0x285e('0x3f')](handleError(_0x10eb24,null));};exports['update']=function(_0x27369e,_0x13b2a3){if(_0x27369e[_0x285e('0x44')][_0x285e('0x46')]){delete _0x27369e[_0x285e('0x44')][_0x285e('0x46')];}return db[_0x285e('0x29')]['find']({'where':{'uniqueid':_0x27369e['params']['id']}})[_0x285e('0x24')](handleEntityNotFound(_0x13b2a3,null))[_0x285e('0x24')](saveUpdates(_0x27369e['body'],null))[_0x285e('0x24')](respondWithResult(_0x13b2a3,null))[_0x285e('0x3f')](handleError(_0x13b2a3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index ff10854..d926e18 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 _0xaa64=['lodash','util','api','bluebird','request-promise','path','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime','uniqueid'];(function(_0x39a626,_0x3acc19){var _0x50ef67=function(_0xaa386f){while(--_0xaa386f){_0x39a626['push'](_0x39a626['shift']());}};_0x50ef67(++_0x3acc19);}(_0xaa64,0xf7));var _0x4aa6=function(_0x40ebff,_0x46cad3){_0x40ebff=_0x40ebff-0x0;var _0x5273aa=_0xaa64[_0x40ebff];return _0x5273aa;};'use strict';var _=require(_0x4aa6('0x0'));var util=require(_0x4aa6('0x1'));var logger=require('../../config/logger')(_0x4aa6('0x2'));var moment=require('moment');var BPromise=require(_0x4aa6('0x3'));var rp=require(_0x4aa6('0x4'));var fs=require('fs');var path=require(_0x4aa6('0x5'));var rimraf=require('rimraf');var config=require(_0x4aa6('0x6'));var attributes=require(_0x4aa6('0x7'));module[_0x4aa6('0x8')]=function(_0x37a260,_0x426bd6){return _0x37a260[_0x4aa6('0x9')](_0x4aa6('0xa'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0x4aa6('0xb')]},{'name':_0x4aa6('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8f1a=['api','moment','bluebird','request-promise','path','./cmHopperHistory.attributes','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger'];(function(_0x3412cd,_0x922082){var _0x1aed54=function(_0x271347){while(--_0x271347){_0x3412cd['push'](_0x3412cd['shift']());}};_0x1aed54(++_0x922082);}(_0x8f1a,0xcd));var _0xa8f1=function(_0x48d127,_0x1cf8a0){_0x48d127=_0x48d127-0x0;var _0x15ab89=_0x8f1a[_0x48d127];return _0x15ab89;};'use strict';var _=require(_0xa8f1('0x0'));var util=require(_0xa8f1('0x1'));var logger=require(_0xa8f1('0x2'))(_0xa8f1('0x3'));var moment=require(_0xa8f1('0x4'));var BPromise=require(_0xa8f1('0x5'));var rp=require(_0xa8f1('0x6'));var fs=require('fs');var path=require(_0xa8f1('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa8f1('0x8'));module['exports']=function(_0x1b067d,_0x3d62e4){return _0x1b067d['define'](_0xa8f1('0x9'),attributes,{'tableName':_0xa8f1('0xa'),'paranoid':![],'indexes':[{'name':_0xa8f1('0xb'),'fields':[_0xa8f1('0xb')]},{'name':_0xa8f1('0xc'),'fields':[_0xa8f1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index c8aabe6..437af3f 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 _0x48b2=['`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','name','ivrTotalCallsDays','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','request','then','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateCmHopperHistory','CmHopperHistory','body','options','info','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime'];(function(_0x1f9ac3,_0x13f3ee){var _0x536530=function(_0x4f0ce6){while(--_0x4f0ce6){_0x1f9ac3['push'](_0x1f9ac3['shift']());}};_0x536530(++_0x13f3ee);}(_0x48b2,0x176));var _0x248b=function(_0x57d74c,_0xded521){_0x57d74c=_0x57d74c-0x0;var _0x13ca5d=_0x48b2[_0x57d74c];return _0x13ca5d;};'use strict';var _=require(_0x248b('0x0'));var util=require(_0x248b('0x1'));var moment=require(_0x248b('0x2'));var BPromise=require(_0x248b('0x3'));var rs=require(_0x248b('0x4'));var fs=require('fs');var Redis=require(_0x248b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x248b('0x6'));var logger=require('../../config/logger')(_0x248b('0x7'));var config=require(_0x248b('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x248b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5189bb,_0x14fc46,_0x109fd7){return new BPromise(function(_0xa580ff,_0x376960){return client[_0x248b('0xa')](_0x5189bb,_0x109fd7)[_0x248b('0xb')](function(_0x5be12f){logger['info'](_0x248b('0xc'),_0x14fc46,'request\x20sent');logger[_0x248b('0xd')](_0x248b('0xe'),_0x14fc46,'request\x20sent',JSON[_0x248b('0xf')](_0x5be12f));if(_0x5be12f[_0x248b('0x10')]){if(_0x5be12f['error'][_0x248b('0x11')]===0x1f4){logger[_0x248b('0x10')](_0x248b('0xc'),_0x14fc46,_0x5be12f['error']['message']);return _0x376960(_0x5be12f[_0x248b('0x10')][_0x248b('0x12')]);}logger[_0x248b('0x10')](_0x248b('0xc'),_0x14fc46,_0x5be12f[_0x248b('0x10')][_0x248b('0x12')]);return _0xa580ff(_0x5be12f[_0x248b('0x10')]['message']);}else{logger['info'](_0x248b('0xc'),_0x14fc46,_0x248b('0x13'));_0xa580ff(_0x5be12f['result'][_0x248b('0x12')]);}})[_0x248b('0x14')](function(_0x304dba){logger[_0x248b('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x14fc46,_0x304dba);_0x376960(_0x304dba);});});}exports[_0x248b('0x15')]=function(_0x146300){var _0xaa8232=this;return new Promise(function(_0x3bb21f,_0x4de01a){return db[_0x248b('0x16')]['create'](_0x146300[_0x248b('0x17')],{'raw':_0x146300[_0x248b('0x18')]?_0x146300[_0x248b('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x248b('0xb')](function(_0x40a6b7){logger[_0x248b('0x19')](_0x248b('0x15'),_0x146300);logger[_0x248b('0xd')](_0x248b('0x15'),_0x146300,JSON['stringify'](_0x40a6b7));_0x3bb21f(_0x40a6b7);})[_0x248b('0x14')](function(_0x1cb2a7){logger[_0x248b('0x10')]('CreateCmHopperHistory',_0x1cb2a7[_0x248b('0x12')],_0x146300);_0x4de01a(_0xaa8232[_0x248b('0x10')](0x1f4,_0x1cb2a7['message']));});});};exports['AvgHandleTime']=function(_0x20123f){var _0x25ad0d=this;return new Promise(function(_0x2657e3,_0x4980b4){return db[_0x248b('0x16')][_0x248b('0x1a')]({'raw':_0x20123f[_0x248b('0x18')]?_0x20123f['options']['raw']===undefined?!![]:![]:!![],'where':_0x20123f['options']?_0x20123f['options'][_0x248b('0x1b')]||null:null,'attributes':[[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db['sequelize'][_0x248b('0x1e')]('id')),_0x248b('0x1f')],[db[_0x248b('0x1c')]['fn']('COUNT',db[_0x248b('0x1c')]['fn']('IF',db['sequelize'][_0x248b('0x20')](_0x248b('0x21')))),'predictiveIntervalAnsweredCalls'],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db['sequelize']['fn']('IF',db[_0x248b('0x1c')]['literal'](_0x248b('0x22')))),_0x248b('0x23')],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db[_0x248b('0x1c')]['fn']('IF',db[_0x248b('0x1c')][_0x248b('0x20')]('`state`\x20=\x2011,\x201,\x20null'))),_0x248b('0x24')],[db[_0x248b('0x1c')]['fn'](_0x248b('0x25'),db[_0x248b('0x1c')]['fn']('IF',db[_0x248b('0x1c')][_0x248b('0x20')](_0x248b('0x26')))),_0x248b('0x27')],[db[_0x248b('0x1c')]['fn']('AVG',db[_0x248b('0x1c')]['fn']('IF',db[_0x248b('0x1c')][_0x248b('0x20')](_0x248b('0x28')))),_0x248b('0x29')]]})[_0x248b('0xb')](function(_0x127c7c){logger[_0x248b('0x19')]('AvgHandleTime',_0x20123f);logger[_0x248b('0xd')](_0x248b('0x2a'),_0x20123f,JSON[_0x248b('0xf')](_0x127c7c));_0x2657e3(_0x127c7c);})['catch'](function(_0x24e99e){logger['error'](_0x248b('0x2a'),_0x24e99e[_0x248b('0x12')],_0x20123f);_0x4980b4(_0x25ad0d[_0x248b('0x10')](0x1f4,_0x24e99e[_0x248b('0x12')]));});});};exports[_0x248b('0x2b')]=function(_0xe2e7e1){var _0x274036=this;return new Promise(function(_0x28b074,_0x536e3a){return db[_0x248b('0x16')][_0x248b('0x1a')]({'raw':_0xe2e7e1[_0x248b('0x18')]?_0xe2e7e1['options']['raw']===undefined?!![]:![]:!![],'where':_0xe2e7e1['options']?_0xe2e7e1['options']['where']||null:null,'attributes':[[_0x248b('0x2c'),'name'],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db[_0x248b('0x1c')]['fn']('IF',db[_0x248b('0x1c')][_0x248b('0x20')](_0x248b('0x2d')))),_0x248b('0x2e')],[db[_0x248b('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x248b('0x1c')][_0x248b('0x20')](_0x248b('0x2f')))),_0x248b('0x30')],[db[_0x248b('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x248b('0x1c')][_0x248b('0x20')](_0x248b('0x21')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0x248b('0x1d'),db[_0x248b('0x1c')]['fn']('IF',db['sequelize'][_0x248b('0x20')]('`state`\x20=\x205,\x201,\x20null'))),_0x248b('0x31')],[db['sequelize']['fn']('COUNT',db[_0x248b('0x1c')]['fn']('IF',db[_0x248b('0x1c')][_0x248b('0x20')]('`state`\x20=\x208,\x201,\x20null'))),_0x248b('0x32')],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db[_0x248b('0x1c')]['fn']('IF',db[_0x248b('0x1c')]['literal'](_0x248b('0x33')))),'outboundDropCallsDayTimeout'],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db[_0x248b('0x1c')]['fn']('IF',db[_0x248b('0x1c')][_0x248b('0x20')](_0x248b('0x34')))),_0x248b('0x35')],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db[_0x248b('0x1c')]['fn']('IF',db['sequelize'][_0x248b('0x20')](_0x248b('0x36')))),_0x248b('0x37')],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db[_0x248b('0x1c')]['fn']('IF',db['sequelize'][_0x248b('0x20')](_0x248b('0x38')))),_0x248b('0x39')],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db['sequelize']['fn']('IF',db[_0x248b('0x1c')]['literal'](_0x248b('0x3a')))),_0x248b('0x3b')],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db[_0x248b('0x1c')]['fn']('IF',db['sequelize'][_0x248b('0x20')]('`state`\x20=\x2018,\x201,\x20null'))),_0x248b('0x3c')],[db[_0x248b('0x1c')]['fn']('COUNT',db[_0x248b('0x1c')]['fn']('IF',db['sequelize'][_0x248b('0x20')](_0x248b('0x3d')))),_0x248b('0x3e')],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db[_0x248b('0x1c')]['fn']('IF',db[_0x248b('0x1c')]['literal'](_0x248b('0x3f')))),_0x248b('0x3c')],[db[_0x248b('0x1c')]['fn']('COUNT',db[_0x248b('0x1c')]['fn']('IF',db[_0x248b('0x1c')][_0x248b('0x20')](_0x248b('0x40')))),_0x248b('0x41')]],'group':[_0x248b('0x2c')]})[_0x248b('0xb')](function(_0x39c0b5){logger[_0x248b('0x19')](_0x248b('0x2b'),_0xe2e7e1);logger['debug'](_0x248b('0x2b'),_0xe2e7e1,JSON[_0x248b('0xf')](_0x39c0b5));_0x28b074(_0x39c0b5);})[_0x248b('0x14')](function(_0x4adba8){logger['error'](_0x248b('0x2b'),_0x4adba8[_0x248b('0x12')],_0xe2e7e1);_0x536e3a(_0x274036[_0x248b('0x10')](0x1f4,_0x4adba8[_0x248b('0x12')]));});});};exports[_0x248b('0x42')]=function(_0x297128){var _0x5cab1b=this;return new Promise(function(_0x2c00a2,_0x57a5b){return db[_0x248b('0x16')][_0x248b('0x1a')]({'raw':_0x297128['options']?_0x297128[_0x248b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x297128['options']?_0x297128[_0x248b('0x18')][_0x248b('0x1b')]||null:null,'attributes':[['campaign',_0x248b('0x43')],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db['sequelize'][_0x248b('0x1e')]('id')),_0x248b('0x44')],[db[_0x248b('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x248b('0x1c')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x248b('0x2c')]})[_0x248b('0xb')](function(_0x8a3d5a){logger[_0x248b('0x19')](_0x248b('0x42'),_0x297128);logger[_0x248b('0xd')](_0x248b('0x42'),_0x297128,JSON[_0x248b('0xf')](_0x8a3d5a));_0x2c00a2(_0x8a3d5a);})[_0x248b('0x14')](function(_0x5a19ad){logger[_0x248b('0x10')](_0x248b('0x42'),_0x5a19ad[_0x248b('0x12')],_0x297128);_0x57a5b(_0x5cab1b[_0x248b('0x10')](0x1f4,_0x5a19ad['message']));});});}; \ No newline at end of file +var _0xe0c0=['where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','name','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','options','raw','then','AvgHandleTime','CmHopperHistory','findAll'];(function(_0x3a63e8,_0x8484dd){var _0x429ef6=function(_0x4f838e){while(--_0x4f838e){_0x3a63e8['push'](_0x3a63e8['shift']());}};_0x429ef6(++_0x8484dd);}(_0xe0c0,0xa7));var _0x0e0c=function(_0xfbad03,_0x5d9b93){_0xfbad03=_0xfbad03-0x0;var _0x2ba580=_0xe0c0[_0xfbad03];return _0x2ba580;};'use strict';var _=require(_0x0e0c('0x0'));var util=require('util');var moment=require(_0x0e0c('0x1'));var BPromise=require(_0x0e0c('0x2'));var rs=require(_0x0e0c('0x3'));var fs=require('fs');var Redis=require(_0x0e0c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e0c('0x5'));var logger=require(_0x0e0c('0x6'))(_0x0e0c('0x7'));var config=require('../../config/environment');var jayson=require(_0x0e0c('0x8'));var client=jayson[_0x0e0c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14e5de,_0xd67cf8,_0xf7de29){return new BPromise(function(_0x13e45d,_0xe3ccce){return client['request'](_0x14e5de,_0xf7de29)['then'](function(_0x518486){logger[_0x0e0c('0xa')]('CmHopperHistory,\x20%s,\x20%s',_0xd67cf8,_0x0e0c('0xb'));logger[_0x0e0c('0xc')](_0x0e0c('0xd'),_0xd67cf8,_0x0e0c('0xb'),JSON[_0x0e0c('0xe')](_0x518486));if(_0x518486[_0x0e0c('0xf')]){if(_0x518486[_0x0e0c('0xf')][_0x0e0c('0x10')]===0x1f4){logger['error'](_0x0e0c('0x11'),_0xd67cf8,_0x518486['error']['message']);return _0xe3ccce(_0x518486[_0x0e0c('0xf')][_0x0e0c('0x12')]);}logger[_0x0e0c('0xf')](_0x0e0c('0x11'),_0xd67cf8,_0x518486[_0x0e0c('0xf')][_0x0e0c('0x12')]);return _0x13e45d(_0x518486['error'][_0x0e0c('0x12')]);}else{logger[_0x0e0c('0xa')](_0x0e0c('0x11'),_0xd67cf8,'request\x20sent');_0x13e45d(_0x518486[_0x0e0c('0x13')][_0x0e0c('0x12')]);}})[_0x0e0c('0x14')](function(_0x20f13d){logger[_0x0e0c('0xf')](_0x0e0c('0x11'),_0xd67cf8,_0x20f13d);_0xe3ccce(_0x20f13d);});});}exports[_0x0e0c('0x15')]=function(_0x18f3ef){var _0x112fa0=this;return new Promise(function(_0x562f2c,_0x3c6c5a){return db['CmHopperHistory']['create'](_0x18f3ef['body'],{'raw':_0x18f3ef[_0x0e0c('0x16')]?_0x18f3ef[_0x0e0c('0x16')][_0x0e0c('0x17')]===undefined?!![]:![]:!![]})[_0x0e0c('0x18')](function(_0x26ad69){logger[_0x0e0c('0xa')]('CreateCmHopperHistory',_0x18f3ef);logger[_0x0e0c('0xc')]('CreateCmHopperHistory',_0x18f3ef,JSON[_0x0e0c('0xe')](_0x26ad69));_0x562f2c(_0x26ad69);})[_0x0e0c('0x14')](function(_0x58fa02){logger[_0x0e0c('0xf')](_0x0e0c('0x15'),_0x58fa02['message'],_0x18f3ef);_0x3c6c5a(_0x112fa0[_0x0e0c('0xf')](0x1f4,_0x58fa02[_0x0e0c('0x12')]));});});};exports[_0x0e0c('0x19')]=function(_0x29ff87){var _0x3871b0=this;return new Promise(function(_0xb87f95,_0x3564cc){return db[_0x0e0c('0x1a')][_0x0e0c('0x1b')]({'raw':_0x29ff87[_0x0e0c('0x16')]?_0x29ff87['options'][_0x0e0c('0x17')]===undefined?!![]:![]:!![],'where':_0x29ff87[_0x0e0c('0x16')]?_0x29ff87['options'][_0x0e0c('0x1c')]||null:null,'attributes':[[db[_0x0e0c('0x1d')]['fn']('COUNT',db[_0x0e0c('0x1d')][_0x0e0c('0x1e')]('id')),_0x0e0c('0x1f')],[db[_0x0e0c('0x1d')]['fn'](_0x0e0c('0x20'),db[_0x0e0c('0x1d')]['fn']('IF',db[_0x0e0c('0x1d')][_0x0e0c('0x21')](_0x0e0c('0x22')))),_0x0e0c('0x23')],[db[_0x0e0c('0x1d')]['fn'](_0x0e0c('0x20'),db[_0x0e0c('0x1d')]['fn']('IF',db[_0x0e0c('0x1d')][_0x0e0c('0x21')](_0x0e0c('0x24')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x0e0c('0x1d')]['fn'](_0x0e0c('0x20'),db[_0x0e0c('0x1d')]['fn']('IF',db[_0x0e0c('0x1d')][_0x0e0c('0x21')]('`state`\x20=\x2011,\x201,\x20null'))),_0x0e0c('0x25')],[db['sequelize']['fn'](_0x0e0c('0x26'),db[_0x0e0c('0x1d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x20`holdtime`,\x20null'))),'predictiveIntervalAvgHoldtime'],[db[_0x0e0c('0x1d')]['fn'](_0x0e0c('0x26'),db[_0x0e0c('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x0e0c('0x27')))),_0x0e0c('0x28')]]})['then'](function(_0x569e69){logger[_0x0e0c('0xa')]('AvgHandleTime',_0x29ff87);logger[_0x0e0c('0xc')](_0x0e0c('0x19'),_0x29ff87,JSON[_0x0e0c('0xe')](_0x569e69));_0xb87f95(_0x569e69);})[_0x0e0c('0x14')](function(_0x2fcf33){logger[_0x0e0c('0xf')](_0x0e0c('0x19'),_0x2fcf33['message'],_0x29ff87);_0x3564cc(_0x3871b0[_0x0e0c('0xf')](0x1f4,_0x2fcf33[_0x0e0c('0x12')]));});});};exports[_0x0e0c('0x29')]=function(_0x453e8c){var _0x27ce1b=this;return new Promise(function(_0x37661f,_0x785831){return db[_0x0e0c('0x1a')]['findAll']({'raw':_0x453e8c['options']?_0x453e8c[_0x0e0c('0x16')][_0x0e0c('0x17')]===undefined?!![]:![]:!![],'where':_0x453e8c[_0x0e0c('0x16')]?_0x453e8c[_0x0e0c('0x16')]['where']||null:null,'attributes':[[_0x0e0c('0x2a'),'name'],[db['sequelize']['fn'](_0x0e0c('0x20'),db[_0x0e0c('0x1d')]['fn']('IF',db[_0x0e0c('0x1d')][_0x0e0c('0x21')](_0x0e0c('0x2b')))),_0x0e0c('0x2c')],[db[_0x0e0c('0x1d')]['fn'](_0x0e0c('0x20'),db[_0x0e0c('0x1d')]['fn']('IF',db[_0x0e0c('0x1d')]['literal'](_0x0e0c('0x2d')))),_0x0e0c('0x2e')],[db['sequelize']['fn'](_0x0e0c('0x20'),db[_0x0e0c('0x1d')]['fn']('IF',db[_0x0e0c('0x1d')][_0x0e0c('0x21')](_0x0e0c('0x22')))),_0x0e0c('0x2f')],[db['sequelize']['fn'](_0x0e0c('0x20'),db[_0x0e0c('0x1d')]['fn']('IF',db[_0x0e0c('0x1d')][_0x0e0c('0x21')](_0x0e0c('0x30')))),_0x0e0c('0x31')],[db[_0x0e0c('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0e0c('0x1d')]['literal']('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db[_0x0e0c('0x1d')]['fn'](_0x0e0c('0x20'),db[_0x0e0c('0x1d')]['fn']('IF',db[_0x0e0c('0x1d')][_0x0e0c('0x21')](_0x0e0c('0x32')))),_0x0e0c('0x33')],[db[_0x0e0c('0x1d')]['fn'](_0x0e0c('0x20'),db[_0x0e0c('0x1d')]['fn']('IF',db[_0x0e0c('0x1d')][_0x0e0c('0x21')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x0e0c('0x34')],[db[_0x0e0c('0x1d')]['fn'](_0x0e0c('0x20'),db[_0x0e0c('0x1d')]['fn']('IF',db['sequelize'][_0x0e0c('0x21')](_0x0e0c('0x35')))),_0x0e0c('0x36')],[db[_0x0e0c('0x1d')]['fn'](_0x0e0c('0x20'),db[_0x0e0c('0x1d')]['fn']('IF',db[_0x0e0c('0x1d')][_0x0e0c('0x21')](_0x0e0c('0x37')))),'outboundBlacklistCallsDay'],[db[_0x0e0c('0x1d')]['fn'](_0x0e0c('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x0e0c('0x21')](_0x0e0c('0x38')))),_0x0e0c('0x39')],[db['sequelize']['fn'](_0x0e0c('0x20'),db[_0x0e0c('0x1d')]['fn']('IF',db[_0x0e0c('0x1d')][_0x0e0c('0x21')]('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x0e0c('0x1d')]['fn'](_0x0e0c('0x20'),db[_0x0e0c('0x1d')]['fn']('IF',db[_0x0e0c('0x1d')][_0x0e0c('0x21')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0x0e0c('0x1d')]['fn']('COUNT',db[_0x0e0c('0x1d')]['fn']('IF',db[_0x0e0c('0x1d')][_0x0e0c('0x21')](_0x0e0c('0x3a')))),'outboundRejectCallsDay'],[db[_0x0e0c('0x1d')]['fn']('COUNT',db[_0x0e0c('0x1d')]['fn']('IF',db[_0x0e0c('0x1d')][_0x0e0c('0x21')](_0x0e0c('0x3b')))),_0x0e0c('0x3c')]],'group':[_0x0e0c('0x2a')]})['then'](function(_0x4faf89){logger[_0x0e0c('0xa')](_0x0e0c('0x29'),_0x453e8c);logger[_0x0e0c('0xc')](_0x0e0c('0x29'),_0x453e8c,JSON['stringify'](_0x4faf89));_0x37661f(_0x4faf89);})[_0x0e0c('0x14')](function(_0x1f9882){logger['error']('GetVoiceQueueHopperHistory',_0x1f9882[_0x0e0c('0x12')],_0x453e8c);_0x785831(_0x27ce1b[_0x0e0c('0xf')](0x1f4,_0x1f9882[_0x0e0c('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x23bcbb){var _0x8fafa3=this;return new Promise(function(_0x1ff366,_0x457e4a){return db[_0x0e0c('0x1a')][_0x0e0c('0x1b')]({'raw':_0x23bcbb[_0x0e0c('0x16')]?_0x23bcbb['options']['raw']===undefined?!![]:![]:!![],'where':_0x23bcbb[_0x0e0c('0x16')]?_0x23bcbb[_0x0e0c('0x16')]['where']||null:null,'attributes':[['campaign',_0x0e0c('0x3d')],[db[_0x0e0c('0x1d')]['fn'](_0x0e0c('0x20'),db['sequelize'][_0x0e0c('0x1e')]('id')),_0x0e0c('0x3e')],[db[_0x0e0c('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0e0c('0x1d')]['literal'](_0x0e0c('0x22')))),_0x0e0c('0x3f')]],'group':[_0x0e0c('0x2a')]})[_0x0e0c('0x18')](function(_0x5428e1){logger[_0x0e0c('0xa')](_0x0e0c('0x40'),_0x23bcbb);logger[_0x0e0c('0xc')]('GetCampaignHopperHistory',_0x23bcbb,JSON[_0x0e0c('0xe')](_0x5428e1));_0x1ff366(_0x5428e1);})[_0x0e0c('0x14')](function(_0x64cb52){logger[_0x0e0c('0xf')](_0x0e0c('0x40'),_0x64cb52[_0x0e0c('0x12')],_0x23bcbb);_0x457e4a(_0x8fafa3['error'](0x1f4,_0x64cb52[_0x0e0c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index a5a606e..c498040 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 _0x211e=['util','connect-timeout','express','Router','../../config/environment','./cmHopperHistory.controller','get','index','/describe','describe','show','post','isAuthenticated','create','put','/:id','update','exports','multer'];(function(_0x3b3750,_0x28f3b8){var _0x1b9e8b=function(_0xaf75c3){while(--_0xaf75c3){_0x3b3750['push'](_0x3b3750['shift']());}};_0x1b9e8b(++_0x28f3b8);}(_0x211e,0x97));var _0xe211=function(_0x2301e1,_0x327e22){_0x2301e1=_0x2301e1-0x0;var _0xf2b92c=_0x211e[_0x2301e1];return _0xf2b92c;};'use strict';var multer=require(_0xe211('0x0'));var util=require(_0xe211('0x1'));var path=require('path');var timeout=require(_0xe211('0x2'));var express=require(_0xe211('0x3'));var router=express[_0xe211('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe211('0x5'));var controller=require(_0xe211('0x6'));router[_0xe211('0x7')]('/',auth['isAuthenticated'](),controller[_0xe211('0x8')]);router[_0xe211('0x7')](_0xe211('0x9'),auth['isAuthenticated'](),controller[_0xe211('0xa')]);router[_0xe211('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xe211('0xb')]);router[_0xe211('0xc')]('/',auth[_0xe211('0xd')](),controller[_0xe211('0xe')]);router[_0xe211('0xf')](_0xe211('0x10'),auth[_0xe211('0xd')](),controller[_0xe211('0x11')]);module[_0xe211('0x12')]=router; \ No newline at end of file +var _0x8514=['connect-timeout','Router','fs-extra','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','exports','multer','util','path'];(function(_0x129229,_0x504e5e){var _0x487a4a=function(_0x5a25c9){while(--_0x5a25c9){_0x129229['push'](_0x129229['shift']());}};_0x487a4a(++_0x504e5e);}(_0x8514,0x10b));var _0x4851=function(_0x5af514,_0x3bd18f){_0x5af514=_0x5af514-0x0;var _0x47964c=_0x8514[_0x5af514];return _0x47964c;};'use strict';var multer=require(_0x4851('0x0'));var util=require(_0x4851('0x1'));var path=require(_0x4851('0x2'));var timeout=require(_0x4851('0x3'));var express=require('express');var router=express[_0x4851('0x4')]();var fs_extra=require(_0x4851('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4851('0x6'));router[_0x4851('0x7')]('/',auth[_0x4851('0x8')](),controller[_0x4851('0x9')]);router['get'](_0x4851('0xa'),auth['isAuthenticated'](),controller[_0x4851('0xb')]);router[_0x4851('0x7')](_0x4851('0xc'),auth['isAuthenticated'](),controller[_0x4851('0xd')]);router[_0x4851('0xe')]('/',auth[_0x4851('0x8')](),controller[_0x4851('0xf')]);router[_0x4851('0x10')](_0x4851('0xc'),auth[_0x4851('0x8')](),controller['update']);module[_0x4851('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 7f997fb..c64d756 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 _0x2070=['STRING','name'];(function(_0x450bf9,_0x1895de){var _0x268350=function(_0xebafa7){while(--_0xebafa7){_0x450bf9['push'](_0x450bf9['shift']());}};_0x268350(++_0x1895de);}(_0x2070,0x1a2));var _0x0207=function(_0x28a0cb,_0x1adce8){_0x28a0cb=_0x28a0cb-0x0;var _0x218320=_0x2070[_0x28a0cb];return _0x218320;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0207('0x0')],'unique':_0x0207('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0207('0x0')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x744c=['sequelize','exports','STRING','name'];(function(_0x10b2c4,_0x4b10ed){var _0xb10a8e=function(_0x58ff68){while(--_0x58ff68){_0x10b2c4['push'](_0x10b2c4['shift']());}};_0xb10a8e(++_0x4b10ed);}(_0x744c,0xa0));var _0xc744=function(_0x14d0d7,_0x32df52){_0x14d0d7=_0x14d0d7-0x0;var _0x36da65=_0x744c[_0x14d0d7];return _0x36da65;};'use strict';var Sequelize=require(_0xc744('0x0'));module[_0xc744('0x1')]={'name':{'type':Sequelize[_0xc744('0x2')],'unique':_0xc744('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xc744('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 1875fb2..b2b9ed7 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 _0xa80f=['error','stack','name','index','map','CmList','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','create','body','user','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','params','ListId','Disposition','getDispositions','order','removeDispositions','ids','addContacts','isArray','tags','push','each','CmContact','success','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d','raw','getContactsCsv','CmCustomField','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','findOne','sequelize','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','Lists','UserProfileResource'];(function(_0x511b76,_0x4727fa){var _0x5424ff=function(_0x24b7c0){while(--_0x24b7c0){_0x511b76['push'](_0x511b76['shift']());}};_0x5424ff(++_0x4727fa);}(_0xa80f,0x67));var _0xfa80=function(_0x160cbc,_0x3025a6){_0x160cbc=_0x160cbc-0x0;var _0x4ac8c6=_0xa80f[_0x160cbc];return _0x4ac8c6;};'use strict';var emlformat=require(_0xfa80('0x0'));var rimraf=require(_0xfa80('0x1'));var zipdir=require(_0xfa80('0x2'));var jsonpatch=require(_0xfa80('0x3'));var rp=require(_0xfa80('0x4'));var moment=require(_0xfa80('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfa80('0x6'));var util=require(_0xfa80('0x7'));var path=require(_0xfa80('0x8'));var sox=require(_0xfa80('0x9'));var csv=require('to-csv');var ejs=require(_0xfa80('0xa'));var fs=require('fs');var fs_extra=require(_0xfa80('0xb'));var _=require(_0xfa80('0xc'));var squel=require(_0xfa80('0xd'));var crypto=require(_0xfa80('0xe'));var jsforce=require(_0xfa80('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xfa80('0x10'));var querystring=require('querystring');var Papa=require(_0xfa80('0x11'));var Redis=require(_0xfa80('0x12'));var authService=require(_0xfa80('0x13'));var qs=require(_0xfa80('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa80('0x15'))(_0xfa80('0x16'));var utils=require(_0xfa80('0x17'));var config=require(_0xfa80('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xfa80('0x19'))['db'];config[_0xfa80('0x1a')]=_[_0xfa80('0x1b')](config[_0xfa80('0x1a')],{'host':_0xfa80('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfa80('0x1a')]));require(_0xfa80('0x1d'))[_0xfa80('0x1e')](socket);function respondWithStatusCode(_0x3c1fdb,_0x33ff32){_0x33ff32=_0x33ff32||0xcc;return function(_0x86eba){if(_0x86eba){return _0x3c1fdb[_0xfa80('0x1f')](_0x33ff32);}return _0x3c1fdb['status'](_0x33ff32)[_0xfa80('0x20')]();};}function respondWithResult(_0x446924,_0x52c1e3){_0x52c1e3=_0x52c1e3||0xc8;return function(_0x5553c1){if(_0x5553c1){return _0x446924[_0xfa80('0x21')](_0x52c1e3)[_0xfa80('0x22')](_0x5553c1);}};}function respondWithFilteredResult(_0x27f564,_0xb5c486){return function(_0xcd2bb7){if(_0xcd2bb7){var _0x2ac57f=typeof _0xb5c486[_0xfa80('0x23')]===_0xfa80('0x24')&&typeof _0xb5c486[_0xfa80('0x25')]===_0xfa80('0x24');var _0x528b71=_0xcd2bb7[_0xfa80('0x26')];var _0x43bec5=_0x2ac57f?0x0:_0xb5c486[_0xfa80('0x23')];var _0x5008e5=_0x2ac57f?_0xcd2bb7['count']:_0xb5c486[_0xfa80('0x23')]+_0xb5c486[_0xfa80('0x25')];var _0x3f47e8;if(_0x5008e5>=_0x528b71){_0x5008e5=_0x528b71;_0x3f47e8=0xc8;}else{_0x3f47e8=0xce;}_0x27f564[_0xfa80('0x21')](_0x3f47e8);return _0x27f564['set'](_0xfa80('0x27'),_0x43bec5+'-'+_0x5008e5+'/'+_0x528b71)[_0xfa80('0x22')](_0xcd2bb7);}return null;};}function patchUpdates(_0x4abe48){return function(_0x54ed56){try{jsonpatch[_0xfa80('0x28')](_0x54ed56,_0x4abe48,!![]);}catch(_0x2af713){return BPromise['reject'](_0x2af713);}return _0x54ed56[_0xfa80('0x29')]();};}function saveUpdates(_0x4e7d44,_0xd3ca1a){return function(_0xaf1911){if(_0xaf1911){return _0xaf1911['update'](_0x4e7d44)[_0xfa80('0x2a')](function(_0xd92e1f){return _0xd92e1f;});}return null;};}function removeEntity(_0x240857,_0x57f686){return function(_0x479cb4){if(_0x479cb4){return _0x479cb4[_0xfa80('0x2b')]()[_0xfa80('0x2a')](function(){var _0x359896=_0x479cb4['get']({'plain':!![]});var _0x18bab4=_0xfa80('0x2c');return db[_0xfa80('0x2d')][_0xfa80('0x2b')]({'where':{'type':_0x18bab4,'resourceId':_0x359896['id']}})[_0xfa80('0x2a')](function(){return _0x479cb4;});})['then'](function(){_0x240857['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x19748b,_0xf65dd3){return function(_0x2c35f6){if(!_0x2c35f6){_0x19748b['sendStatus'](0x194);}return _0x2c35f6;};}function handleError(_0x1f6c9c,_0x5ad2e7){_0x5ad2e7=_0x5ad2e7||0x1f4;return function(_0xf63e11){logger[_0xfa80('0x2e')](_0xf63e11[_0xfa80('0x2f')]);if(_0xf63e11[_0xfa80('0x30')]){delete _0xf63e11['name'];}_0x1f6c9c[_0xfa80('0x21')](_0x5ad2e7)['send'](_0xf63e11);};}exports[_0xfa80('0x31')]=function(_0x127e4e,_0x58acf7){var _0xdb1c1c={},_0x193338={},_0x110272={'count':0x0,'rows':[]};var _0x39224a=_[_0xfa80('0x32')](db[_0xfa80('0x33')][_0xfa80('0x34')],function(_0x43e524){return{'name':_0x43e524[_0xfa80('0x35')],'type':_0x43e524[_0xfa80('0x36')][_0xfa80('0x37')]};});_0x193338['model']=_[_0xfa80('0x32')](_0x39224a,_0xfa80('0x30'));_0x193338[_0xfa80('0x38')]=_[_0xfa80('0x39')](_0x127e4e[_0xfa80('0x38')]);_0x193338[_0xfa80('0x3a')]=_[_0xfa80('0x3b')](_0x193338[_0xfa80('0x3c')],_0x193338[_0xfa80('0x38')]);_0xdb1c1c[_0xfa80('0x3d')]=_[_0xfa80('0x3b')](_0x193338['model'],qs[_0xfa80('0x3e')](_0x127e4e['query'][_0xfa80('0x3e')]));_0xdb1c1c['attributes']=_0xdb1c1c['attributes'][_0xfa80('0x3f')]?_0xdb1c1c[_0xfa80('0x3d')]:_0x193338[_0xfa80('0x3c')];if(!_0x127e4e[_0xfa80('0x38')][_0xfa80('0x40')](_0xfa80('0x41'))){_0xdb1c1c[_0xfa80('0x25')]=qs[_0xfa80('0x25')](_0x127e4e[_0xfa80('0x38')][_0xfa80('0x25')]);_0xdb1c1c[_0xfa80('0x23')]=qs[_0xfa80('0x23')](_0x127e4e[_0xfa80('0x38')][_0xfa80('0x23')]);}_0xdb1c1c['order']=qs[_0xfa80('0x42')](_0x127e4e[_0xfa80('0x38')][_0xfa80('0x42')]);_0xdb1c1c[_0xfa80('0x43')]=qs[_0xfa80('0x3a')](_[_0xfa80('0x44')](_0x127e4e[_0xfa80('0x38')],_0x193338[_0xfa80('0x3a')]),_0x39224a);if(_0x127e4e[_0xfa80('0x38')][_0xfa80('0x45')]){_0xdb1c1c[_0xfa80('0x43')]=_[_0xfa80('0x46')](_0xdb1c1c[_0xfa80('0x43')],{'$or':_[_0xfa80('0x32')](_0x39224a,function(_0x9ffa47){if(_0x9ffa47['type']!==_0xfa80('0x47')){var _0x147e58={};_0x147e58[_0x9ffa47[_0xfa80('0x30')]]={'$like':'%'+_0x127e4e[_0xfa80('0x38')]['filter']+'%'};return _0x147e58;}})});}_0xdb1c1c=_[_0xfa80('0x46')]({},_0xdb1c1c,_0x127e4e['options']);var _0x4ef2fc={'where':_0xdb1c1c[_0xfa80('0x43')]};return db[_0xfa80('0x33')][_0xfa80('0x26')](_0x4ef2fc)['then'](function(_0xa9642a){_0x110272[_0xfa80('0x26')]=_0xa9642a;if(_0x127e4e[_0xfa80('0x38')][_0xfa80('0x48')]){_0xdb1c1c[_0xfa80('0x49')]=[{'all':!![]}];}return db[_0xfa80('0x33')][_0xfa80('0x4a')](_0xdb1c1c);})['then'](function(_0x1e538e){_0x110272[_0xfa80('0x4b')]=_0x1e538e;return _0x110272;})['then'](respondWithFilteredResult(_0x58acf7,_0xdb1c1c))[_0xfa80('0x4c')](handleError(_0x58acf7,null));};exports[_0xfa80('0x4d')]=function(_0x1522cf,_0x4f8eba){var _0x4e67e0={'raw':![],'where':{'id':_0x1522cf['params']['id']}},_0x58e6e8={};_0x58e6e8[_0xfa80('0x3c')]=_['keys'](db[_0xfa80('0x33')]['rawAttributes']);_0x58e6e8[_0xfa80('0x38')]=_[_0xfa80('0x39')](_0x1522cf[_0xfa80('0x38')]);_0x58e6e8[_0xfa80('0x3a')]=_['intersection'](_0x58e6e8['model'],_0x58e6e8[_0xfa80('0x38')]);_0x4e67e0['attributes']=_[_0xfa80('0x3b')](_0x58e6e8['model'],qs['fields'](_0x1522cf[_0xfa80('0x38')][_0xfa80('0x3e')]));_0x4e67e0[_0xfa80('0x3d')]=_0x4e67e0[_0xfa80('0x3d')][_0xfa80('0x3f')]?_0x4e67e0['attributes']:_0x58e6e8[_0xfa80('0x3c')];if(_0x1522cf[_0xfa80('0x38')]['includeAll']){_0x4e67e0[_0xfa80('0x49')]=[{'all':!![]}];}_0x4e67e0=_[_0xfa80('0x46')]({},_0x4e67e0,_0x1522cf[_0xfa80('0x4e')]);return db[_0xfa80('0x33')]['find'](_0x4e67e0)[_0xfa80('0x2a')](handleEntityNotFound(_0x4f8eba,null))[_0xfa80('0x2a')](respondWithResult(_0x4f8eba,null))[_0xfa80('0x4c')](handleError(_0x4f8eba,null));};exports[_0xfa80('0x4f')]=function(_0x541a6b,_0x273101){return db[_0xfa80('0x33')][_0xfa80('0x4f')](_0x541a6b[_0xfa80('0x50')],{})[_0xfa80('0x2a')](function(_0x48531b){var _0x324111=_0x541a6b[_0xfa80('0x51')][_0xfa80('0x52')]({'plain':!![]});if(!_0x324111)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x324111['role']==='user'){var _0x112731=_0x48531b['get']({'plain':!![]});var _0x48d31f=_0xfa80('0x2c');return db[_0xfa80('0x53')][_0xfa80('0x54')]({'where':{'name':_0x48d31f,'userProfileId':_0x324111[_0xfa80('0x55')]},'raw':!![]})[_0xfa80('0x2a')](function(_0x4beb38){if(_0x4beb38&&_0x4beb38[_0xfa80('0x56')]===0x0){return db[_0xfa80('0x2d')][_0xfa80('0x4f')]({'name':_0x112731[_0xfa80('0x30')],'resourceId':_0x112731['id'],'type':_0x4beb38[_0xfa80('0x30')],'sectionId':_0x4beb38['id']},{})['then'](function(){return _0x48531b;});}else{return _0x48531b;}})[_0xfa80('0x4c')](function(_0x22f4ac){logger[_0xfa80('0x2e')](_0xfa80('0x57'),_0x22f4ac);throw _0x22f4ac;});}return _0x48531b;})[_0xfa80('0x2a')](respondWithResult(_0x273101,0xc9))[_0xfa80('0x4c')](handleError(_0x273101,null));};exports[_0xfa80('0x58')]=function(_0x8c4bf1,_0x1c9a14){if(_0x8c4bf1['body']['id']){delete _0x8c4bf1['body']['id'];}return db[_0xfa80('0x33')][_0xfa80('0x54')]({'where':{'id':_0x8c4bf1['params']['id']}})[_0xfa80('0x2a')](handleEntityNotFound(_0x1c9a14,null))[_0xfa80('0x2a')](saveUpdates(_0x8c4bf1[_0xfa80('0x50')],null))[_0xfa80('0x2a')](respondWithResult(_0x1c9a14,null))[_0xfa80('0x4c')](handleError(_0x1c9a14,null));};exports[_0xfa80('0x2b')]=function(_0x2b3c2d,_0x4f4e36){return db[_0xfa80('0x33')][_0xfa80('0x54')]({'where':{'id':_0x2b3c2d['params']['id']}})[_0xfa80('0x2a')](handleEntityNotFound(_0x4f4e36,null))[_0xfa80('0x2a')](removeEntity(_0x4f4e36,null))[_0xfa80('0x4c')](handleError(_0x4f4e36,null));};exports[_0xfa80('0x59')]=function(_0x20147a,_0x2387e1){return db['CmList'][_0xfa80('0x59')]()['then'](respondWithResult(_0x2387e1,null))['catch'](handleError(_0x2387e1,null));};exports[_0xfa80('0x5a')]=function(_0x361c07,_0x1476e0,_0x1c50da){if(_0x361c07[_0xfa80('0x50')]['id']){delete _0x361c07[_0xfa80('0x50')]['id'];}return db[_0xfa80('0x33')][_0xfa80('0x54')]({'where':{'id':_0x361c07[_0xfa80('0x5b')]['id']}})[_0xfa80('0x2a')](handleEntityNotFound(_0x1476e0,null))['then'](function(_0x310610){if(_0x310610){_0x361c07['body'][_0xfa80('0x5c')]=_0x310610['id'];return db[_0xfa80('0x5d')][_0xfa80('0x4f')](_0x361c07[_0xfa80('0x50')]);}})[_0xfa80('0x2a')](respondWithResult(_0x1476e0,null))[_0xfa80('0x4c')](handleError(_0x1476e0,null));};exports[_0xfa80('0x5e')]=function(_0x3d07f6,_0x54a39c,_0x381801){var _0x58aedb={'raw':![],'where':{}};var _0x29a8f2={};var _0x1aae3b={'count':0x0,'rows':[]};return db[_0xfa80('0x33')]['findOne']({'where':{'id':_0x3d07f6['params']['id']}})[_0xfa80('0x2a')](handleEntityNotFound(_0x54a39c,null))['then'](function(_0x4a4609){if(_0x4a4609){_0x29a8f2[_0xfa80('0x3c')]=_[_0xfa80('0x39')](db['Disposition'][_0xfa80('0x34')]);_0x29a8f2['query']=_['keys'](_0x3d07f6[_0xfa80('0x38')]);_0x29a8f2['filters']=_[_0xfa80('0x3b')](_0x29a8f2['model'],_0x29a8f2['query']);_0x58aedb[_0xfa80('0x3d')]=_[_0xfa80('0x3b')](_0x29a8f2[_0xfa80('0x3c')],qs['fields'](_0x3d07f6[_0xfa80('0x38')][_0xfa80('0x3e')]));_0x58aedb[_0xfa80('0x3d')]=_0x58aedb[_0xfa80('0x3d')][_0xfa80('0x3f')]?_0x58aedb[_0xfa80('0x3d')]:_0x29a8f2['model'];if(!_0x3d07f6[_0xfa80('0x38')][_0xfa80('0x40')](_0xfa80('0x41'))){_0x58aedb[_0xfa80('0x25')]=qs['limit'](_0x3d07f6[_0xfa80('0x38')][_0xfa80('0x25')]);_0x58aedb[_0xfa80('0x23')]=qs[_0xfa80('0x23')](_0x3d07f6[_0xfa80('0x38')][_0xfa80('0x23')]);}_0x58aedb[_0xfa80('0x5f')]=qs[_0xfa80('0x42')](_0x3d07f6[_0xfa80('0x38')][_0xfa80('0x42')]);_0x58aedb[_0xfa80('0x43')]=qs[_0xfa80('0x3a')](_['pick'](_0x3d07f6[_0xfa80('0x38')],_0x29a8f2[_0xfa80('0x3a')]));_0x58aedb[_0xfa80('0x43')]['ListId']=_0x4a4609['id'];if(_0x3d07f6[_0xfa80('0x38')][_0xfa80('0x45')]){_0x58aedb['where']=_[_0xfa80('0x46')](_0x58aedb[_0xfa80('0x43')],{'$or':_['map'](_0x58aedb[_0xfa80('0x3d')],function(_0x23fd06){var _0x493bfa={};_0x493bfa[_0x23fd06]={'$like':'%'+_0x3d07f6[_0xfa80('0x38')]['filter']+'%'};return _0x493bfa;})});}_0x58aedb=_[_0xfa80('0x46')]({},_0x58aedb,_0x3d07f6[_0xfa80('0x4e')]);return db[_0xfa80('0x5d')][_0xfa80('0x26')]({'where':_0x58aedb[_0xfa80('0x43')]})[_0xfa80('0x2a')](function(_0x175794){_0x1aae3b[_0xfa80('0x26')]=_0x175794;if(_0x3d07f6['query'][_0xfa80('0x48')]){_0x58aedb[_0xfa80('0x49')]=[{'all':!![]}];}return db[_0xfa80('0x5d')][_0xfa80('0x4a')](_0x58aedb);})[_0xfa80('0x2a')](function(_0x34c6c7){_0x1aae3b[_0xfa80('0x4b')]=_0x34c6c7;return _0x1aae3b;});}})[_0xfa80('0x2a')](respondWithFilteredResult(_0x54a39c,_0x58aedb))['catch'](handleError(_0x54a39c,null));};exports[_0xfa80('0x60')]=function(_0x14dd7d,_0x2b7d56,_0x29e1f3){return db[_0xfa80('0x33')][_0xfa80('0x54')]({'where':{'id':_0x14dd7d[_0xfa80('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2b7d56,null))[_0xfa80('0x2a')](function(_0x423737){if(_0x423737){return _0x423737[_0xfa80('0x60')](_0x14dd7d[_0xfa80('0x38')][_0xfa80('0x61')]);}})[_0xfa80('0x2a')](respondWithStatusCode(_0x2b7d56,null))['catch'](handleError(_0x2b7d56,null));};exports[_0xfa80('0x62')]=function(_0x1d234e,_0x52d346,_0x217c5a){return db['CmList'][_0xfa80('0x54')]({'where':{'id':_0x1d234e[_0xfa80('0x5b')]['id']}})['then'](handleEntityNotFound(_0x52d346,null))[_0xfa80('0x2a')](function(_0x1d174e){if(_0x1d174e){var _0x1f6f58=[];var _0xe8cd5c={'success':[],'errors':[]};return db['CmContact'][_0xfa80('0x59')]()[_0xfa80('0x2a')](function(_0x25b11c){if(_0x1d234e[_0xfa80('0x50')]['tags']&&_[_0xfa80('0x63')](_0x1d234e[_0xfa80('0x50')][_0xfa80('0x64')])){if(_0x1d234e[_0xfa80('0x50')]['tags'][_0xfa80('0x3f')]){_0x1d234e[_0xfa80('0x50')][_0xfa80('0x64')]=_0x1d234e[_0xfa80('0x50')]['tags']['join'](';')+';';}else{_0x1d234e[_0xfa80('0x50')][_0xfa80('0x64')]=null;}}else{_0x1d234e[_0xfa80('0x50')][_0xfa80('0x64')]=null;}if(_0x1d234e[_0xfa80('0x50')]&&_[_0xfa80('0x63')](_0x1d234e[_0xfa80('0x50')])){for(var _0x271a17=0x0;_0x271a17<_0x1d234e[_0xfa80('0x50')][_0xfa80('0x3f')];_0x271a17+=0x1){_0x1d234e['body'][_0x271a17][_0xfa80('0x5c')]=_0x1d234e[_0xfa80('0x5b')]['id'];_0x1f6f58[_0xfa80('0x65')](_0x1d234e[_0xfa80('0x50')][_0x271a17]);}return BPromise[_0xfa80('0x66')](_0x1f6f58,function(_0x1088d0){return db[_0xfa80('0x67')][_0xfa80('0x4f')](_['omit'](_0x1088d0,[_0xfa80('0x61'),'id'])||{},{'fields':_[_0xfa80('0x39')](_0x25b11c),'raw':!![]})[_0xfa80('0x2a')](function(_0x28ea2f){_0xe8cd5c[_0xfa80('0x68')][_0xfa80('0x65')](_0x28ea2f[_0xfa80('0x69')]);})[_0xfa80('0x4c')](function(_0x1e2686){_0xe8cd5c[_0xfa80('0x6a')][_0xfa80('0x65')]({'data':_0x1088d0,'error':_0x1e2686['message']});});})[_0xfa80('0x2a')](function(_0xf32307){return _0xe8cd5c;})[_0xfa80('0x4c')](function(_0x2f3ee2){return _0x2f3ee2;});}else{_0x52d346['status'](0x190)[_0xfa80('0x22')]({'message':_0xfa80('0x6b')});}});}})[_0xfa80('0x2a')](respondWithResult(_0x52d346,null))[_0xfa80('0x4c')](handleError(_0x52d346,null));};exports[_0xfa80('0x6c')]=function(_0x20c46c,_0x506174,_0x2a1aae){var _0x4a7019;return db['CmList'][_0xfa80('0x54')]({'where':{'id':_0x20c46c[_0xfa80('0x5b')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xfa80('0x6d')}]})[_0xfa80('0x2a')](handleEntityNotFound(_0x506174,null))['then'](function(_0x58b84c){if(_0x58b84c){_0x4a7019=_0x58b84c;return db[_0xfa80('0x67')][_0xfa80('0x34')];}})[_0xfa80('0x2a')](function(_0x1c5bd5){if(_0x1c5bd5){var _0x41d812={};var _0x53e085={};_0x53e085[_0xfa80('0x3c')]=_[_0xfa80('0x6e')](_[_0xfa80('0x39')](_0x1c5bd5),_['map'](_0x4a7019[_0xfa80('0x6d')],function(_0x3b0191){return util[_0xfa80('0x6f')](_0xfa80('0x70'),_0x3b0191['id']);}));_0x53e085[_0xfa80('0x38')]=_[_0xfa80('0x39')](_0x20c46c[_0xfa80('0x38')]);_0x53e085['filters']=_[_0xfa80('0x3b')](_0x53e085[_0xfa80('0x3c')],_0x53e085[_0xfa80('0x38')]);_0x41d812[_0xfa80('0x3d')]=_[_0xfa80('0x3b')](_0x53e085[_0xfa80('0x3c')],qs[_0xfa80('0x3e')](_0x20c46c[_0xfa80('0x38')][_0xfa80('0x3e')]));_0x41d812['attributes']=_0x41d812[_0xfa80('0x3d')][_0xfa80('0x3f')]?_0x41d812[_0xfa80('0x3d')]:_0x53e085[_0xfa80('0x3c')];if(!_0x20c46c[_0xfa80('0x38')][_0xfa80('0x40')](_0xfa80('0x41'))){_0x41d812[_0xfa80('0x25')]=qs['limit'](_0x20c46c[_0xfa80('0x38')][_0xfa80('0x25')]);_0x41d812[_0xfa80('0x23')]=qs[_0xfa80('0x23')](_0x20c46c[_0xfa80('0x38')][_0xfa80('0x23')]);}_0x41d812[_0xfa80('0x5f')]=qs['sort'](_0x20c46c[_0xfa80('0x38')][_0xfa80('0x42')]);_0x41d812[_0xfa80('0x43')]=qs[_0xfa80('0x3a')](_[_0xfa80('0x44')](_0x20c46c[_0xfa80('0x38')],_0x53e085['filters']));_0x41d812[_0xfa80('0x71')]=!![];if(_0x20c46c[_0xfa80('0x38')][_0xfa80('0x45')]){_0x41d812[_0xfa80('0x43')]=_[_0xfa80('0x46')](_0x41d812['where'],{'$or':_[_0xfa80('0x32')](_0x41d812[_0xfa80('0x3d')],function(_0x457c9b){var _0x509445={};_0x509445[_0x457c9b]={'$like':'%'+_0x20c46c[_0xfa80('0x38')][_0xfa80('0x45')]+'%'};return _0x509445;})});}_0x41d812=_[_0xfa80('0x46')]({},_0x41d812,_0x20c46c[_0xfa80('0x4e')]);return _0x4a7019['getContacts'](_0x41d812);}})['then'](respondWithResult(_0x506174,null))[_0xfa80('0x4c')](handleError(_0x506174,null));};exports[_0xfa80('0x72')]=function(_0x4ba9ea,_0x355e9c,_0x2b72ba){var _0x1f1c45;return db['CmList'][_0xfa80('0x54')]({'where':{'id':_0x4ba9ea[_0xfa80('0x5b')]['id']},'include':[{'model':db[_0xfa80('0x73')],'as':_0xfa80('0x6d')}]})[_0xfa80('0x2a')](handleEntityNotFound(_0x355e9c,null))[_0xfa80('0x2a')](function(_0x2a19c0){if(_0x2a19c0){_0x1f1c45=_0x2a19c0;return db['CmContact'][_0xfa80('0x34')];}})[_0xfa80('0x2a')](function(_0x42e45b){if(_0x42e45b){var _0x303fc6={};var _0x3b3fb3={};_0x3b3fb3[_0xfa80('0x3c')]=_['concat'](_[_0xfa80('0x39')](_0x42e45b),_['map'](_0x1f1c45[_0xfa80('0x6d')],function(_0x549228){return util[_0xfa80('0x6f')](_0xfa80('0x70'),_0x549228['id']);}));_0x3b3fb3[_0xfa80('0x38')]=_['keys'](_0x4ba9ea[_0xfa80('0x38')]);_0x3b3fb3[_0xfa80('0x3a')]=_[_0xfa80('0x3b')](_0x3b3fb3['model'],_0x3b3fb3[_0xfa80('0x38')]);_0x303fc6[_0xfa80('0x3d')]=_['intersection'](_0x3b3fb3['model'],qs[_0xfa80('0x3e')](_0x4ba9ea[_0xfa80('0x38')][_0xfa80('0x3e')]));_0x303fc6[_0xfa80('0x3d')]=_0x303fc6[_0xfa80('0x3d')][_0xfa80('0x3f')]?_0x303fc6[_0xfa80('0x3d')]:_0x3b3fb3[_0xfa80('0x3c')];if(!_0x4ba9ea['query'][_0xfa80('0x40')](_0xfa80('0x41'))){_0x303fc6['limit']=qs[_0xfa80('0x25')](_0x4ba9ea[_0xfa80('0x38')][_0xfa80('0x25')]);_0x303fc6[_0xfa80('0x23')]=qs[_0xfa80('0x23')](_0x4ba9ea[_0xfa80('0x38')][_0xfa80('0x23')]);}_0x303fc6[_0xfa80('0x5f')]=qs['sort'](_0x4ba9ea[_0xfa80('0x38')][_0xfa80('0x42')]);_0x303fc6['where']=qs[_0xfa80('0x3a')](_[_0xfa80('0x44')](_0x4ba9ea[_0xfa80('0x38')],_0x3b3fb3[_0xfa80('0x3a')]));_0x303fc6['raw']=!![];if(_0x4ba9ea['query'][_0xfa80('0x45')]){_0x303fc6[_0xfa80('0x43')]=_[_0xfa80('0x46')](_0x303fc6[_0xfa80('0x43')],{'$or':_[_0xfa80('0x32')](_0x303fc6[_0xfa80('0x3d')],function(_0x4d328f){var _0x1bae47={};_0x1bae47[_0x4d328f]={'$like':'%'+_0x4ba9ea[_0xfa80('0x38')][_0xfa80('0x45')]+'%'};return _0x1bae47;})});}_0x303fc6=_[_0xfa80('0x46')]({},_0x303fc6,_0x4ba9ea['options']);return _0x1f1c45[_0xfa80('0x6c')](_0x303fc6);}})['then'](function(_0x1baa7c){if(!_[_0xfa80('0x74')](_0x1baa7c)){var _0x52e84b=toCsv(_0x1baa7c);var _0x49b379=Date[_0xfa80('0x75')]();fs['writeFileSync'](util[_0xfa80('0x6f')](_0xfa80('0x76'),_0x1f1c45['id'],_0x49b379),_0x52e84b);_0x355e9c[_0xfa80('0x77')](_0xfa80('0x78'),_0xfa80('0x79')+util[_0xfa80('0x6f')](_0xfa80('0x7a'),_0x1f1c45['id'],_0x49b379));_0x355e9c[_0xfa80('0x77')](_0xfa80('0x7b'),_0xfa80('0x7c'));return _0x355e9c[_0xfa80('0x7d')](util[_0xfa80('0x6f')](_0xfa80('0x76'),_0x1f1c45['id'],_0x49b379));}else{return _0x355e9c['sendStatus'](0xcc);}})[_0xfa80('0x4c')](handleError(_0x355e9c,null));};exports['addCustomField']=function(_0x5293bf,_0x3df4cb,_0x123471){var _0x1484b4;delete _0x5293bf['body']['id'];return db[_0xfa80('0x33')][_0xfa80('0x7e')]({'where':{'id':_0x5293bf[_0xfa80('0x5b')]['id']}})[_0xfa80('0x2a')](handleEntityNotFound(_0x3df4cb,null))[_0xfa80('0x2a')](function(_0x59f425){if(_0x59f425){return db[_0xfa80('0x7f')]['transaction'](function(_0x1a45f6){return db['CmCustomField'][_0xfa80('0x4f')](_0x5293bf['body'],{'transaction':_0x1a45f6})[_0xfa80('0x2a')](function(_0x4a25ef){_0x1484b4=_0x4a25ef;return _0x59f425['addCustomFields'](_0x4a25ef,{'transaction':_0x1a45f6});})[_0xfa80('0x2a')](function(){var _0x8ebcaf={'type':db[_0xfa80('0x80')][_0xfa80('0x81')],'transaction':_0x1a45f6};switch(_0x5293bf[_0xfa80('0x50')][_0xfa80('0x36')]){case _0xfa80('0x82'):_0x8ebcaf['type']=db['Sequelize'][_0xfa80('0x81')];break;case _0xfa80('0x83'):_0x8ebcaf[_0xfa80('0x36')]=db[_0xfa80('0x80')][_0xfa80('0x84')];break;case _0xfa80('0x85'):_0x8ebcaf[_0xfa80('0x36')]=db['Sequelize'][_0xfa80('0x86')];_0x8ebcaf['defaultValue']=![];break;default:}return db['sequelize']['queryInterface'][_0xfa80('0x87')](_0xfa80('0x88'),util[_0xfa80('0x6f')](_0xfa80('0x89'),_0x1484b4['id']),_0x8ebcaf);})[_0xfa80('0x2a')](function(){return _0x1484b4;});});}})['then'](respondWithResult(_0x3df4cb,null))[_0xfa80('0x4c')](handleError(_0x3df4cb,null));};exports[_0xfa80('0x8a')]=function(_0x191793,_0x34a4f1,_0x4264e9){var _0x50c4d7={};var _0x2754bc={};var _0x7b9c1c;var _0x266697;return db[_0xfa80('0x33')][_0xfa80('0x7e')]({'where':{'id':_0x191793[_0xfa80('0x5b')]['id']}})[_0xfa80('0x2a')](handleEntityNotFound(_0x34a4f1,null))['then'](function(_0x2b92a0){if(_0x2b92a0){_0x7b9c1c=_0x2b92a0;_0x2754bc[_0xfa80('0x3c')]=_['keys'](db['CmCustomField'][_0xfa80('0x34')]);_0x2754bc[_0xfa80('0x38')]=_[_0xfa80('0x39')](_0x191793[_0xfa80('0x38')]);_0x2754bc[_0xfa80('0x3a')]=_['intersection'](_0x2754bc[_0xfa80('0x3c')],_0x2754bc['query']);_0x50c4d7[_0xfa80('0x3d')]=_[_0xfa80('0x3b')](_0x2754bc[_0xfa80('0x3c')],qs[_0xfa80('0x3e')](_0x191793['query']['fields']));_0x50c4d7[_0xfa80('0x3d')]=_0x50c4d7[_0xfa80('0x3d')][_0xfa80('0x3f')]?_0x50c4d7[_0xfa80('0x3d')]:_0x2754bc[_0xfa80('0x3c')];_0x50c4d7['order']=qs[_0xfa80('0x42')](_0x191793[_0xfa80('0x38')][_0xfa80('0x42')]);_0x50c4d7[_0xfa80('0x43')]=qs[_0xfa80('0x3a')](_[_0xfa80('0x44')](_0x191793[_0xfa80('0x38')],_0x2754bc[_0xfa80('0x3a')]));_0x50c4d7[_0xfa80('0x43')]=_[_0xfa80('0x46')](_0x50c4d7['where'],{'$or':[{'ListId':_0x2b92a0['id']},{'ListId':null}]});if(_0x191793['query'][_0xfa80('0x45')]){_0x50c4d7[_0xfa80('0x43')]=_[_0xfa80('0x46')](_0x50c4d7[_0xfa80('0x43')],{'$or':_[_0xfa80('0x32')](_0x50c4d7[_0xfa80('0x3d')],function(_0x349d5f){var _0x429c89={};_0x429c89[_0x349d5f]={'$like':'%'+_0x191793[_0xfa80('0x38')]['filter']+'%'};return _0x429c89;})});}_0x50c4d7=_[_0xfa80('0x46')]({},_0x50c4d7,_0x191793['options']);return db[_0xfa80('0x73')][_0xfa80('0x8b')](_0x50c4d7);}})[_0xfa80('0x2a')](respondWithResult(_0x34a4f1,null))[_0xfa80('0x4c')](handleError(_0x34a4f1,null));};exports['addAgents']=function(_0x349f09,_0x4cb33d,_0x5dc67b){return db[_0xfa80('0x33')][_0xfa80('0x54')]({'where':{'id':_0x349f09[_0xfa80('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4cb33d,null))[_0xfa80('0x2a')](function(_0x1f1fbb){if(_0x1f1fbb){return _0x1f1fbb[_0xfa80('0x8c')](_0x349f09['body'][_0xfa80('0x61')],_[_0xfa80('0x8d')](_0x349f09[_0xfa80('0x50')],['ids','id'])||{})[_0xfa80('0x8e')](function(_0x3c168e){for(var _0x4f37f5=0x0;_0x4f37f5<_0x349f09[_0xfa80('0x50')][_0xfa80('0x61')][_0xfa80('0x3f')];_0x4f37f5+=0x1){socket[_0xfa80('0x8f')](_0xfa80('0x90'),{'UserId':Number(_0x349f09['body'][_0xfa80('0x61')][_0x4f37f5]),'CmListId':Number(_0x349f09[_0xfa80('0x5b')]['id'])});}return _0x3c168e;});}})['then'](respondWithResult(_0x4cb33d,null))['catch'](handleError(_0x4cb33d,null));};exports['removeAgents']=function(_0xda6b5,_0x3f60b3,_0x2306c7){return db['CmList'][_0xfa80('0x54')]({'where':{'id':_0xda6b5[_0xfa80('0x5b')]['id']}})[_0xfa80('0x2a')](handleEntityNotFound(_0x3f60b3,null))[_0xfa80('0x2a')](function(_0x260912){if(_0x260912){return _0x260912[_0xfa80('0x91')](_0xda6b5['query'][_0xfa80('0x61')])[_0xfa80('0x2a')](function(){if(_['isArray'](_0xda6b5[_0xfa80('0x38')][_0xfa80('0x61')])){for(var _0x309753=0x0;_0x309753<_0xda6b5[_0xfa80('0x38')][_0xfa80('0x61')][_0xfa80('0x3f')];_0x309753+=0x1){socket['emit'](_0xfa80('0x92'),{'UserId':Number(_0xda6b5['query']['ids'][_0x309753]),'CmListId':Number(_0xda6b5['params']['id'])});}}else{socket[_0xfa80('0x8f')](_0xfa80('0x92'),{'UserId':Number(_0xda6b5['query'][_0xfa80('0x61')]),'CmListId':Number(_0xda6b5[_0xfa80('0x5b')]['id'])});}});}})[_0xfa80('0x2a')](respondWithStatusCode(_0x3f60b3,null))['catch'](handleError(_0x3f60b3,null));};exports[_0xfa80('0x93')]=function(_0x1b9588,_0x4aefc2,_0x4ea730){var _0x11c346={};var _0x5c9a28={};var _0x506696;var _0x1241f4;return db['CmList'][_0xfa80('0x7e')]({'where':{'id':_0x1b9588[_0xfa80('0x5b')]['id']}})[_0xfa80('0x2a')](handleEntityNotFound(_0x4aefc2,null))[_0xfa80('0x2a')](function(_0x30a84d){if(_0x30a84d){_0x506696=_0x30a84d;_0x5c9a28[_0xfa80('0x3c')]=_[_0xfa80('0x39')](db[_0xfa80('0x94')][_0xfa80('0x34')]);_0x5c9a28[_0xfa80('0x38')]=_[_0xfa80('0x39')](_0x1b9588[_0xfa80('0x38')]);_0x5c9a28[_0xfa80('0x3a')]=_[_0xfa80('0x3b')](_0x5c9a28[_0xfa80('0x3c')],_0x5c9a28['query']);_0x11c346[_0xfa80('0x3d')]=_['intersection'](_0x5c9a28[_0xfa80('0x3c')],qs[_0xfa80('0x3e')](_0x1b9588['query'][_0xfa80('0x3e')]));_0x11c346[_0xfa80('0x3d')]=_0x11c346['attributes'][_0xfa80('0x3f')]?_0x11c346[_0xfa80('0x3d')]:_0x5c9a28[_0xfa80('0x3c')];_0x11c346[_0xfa80('0x5f')]=qs['sort'](_0x1b9588[_0xfa80('0x38')][_0xfa80('0x42')]);_0x11c346[_0xfa80('0x43')]=qs['filters'](_['pick'](_0x1b9588[_0xfa80('0x38')],_0x5c9a28['filters']));if(_0x1b9588['query']['filter']){_0x11c346[_0xfa80('0x43')]=_[_0xfa80('0x46')](_0x11c346[_0xfa80('0x43')],{'$or':_['map'](_0x11c346[_0xfa80('0x3d')],function(_0x4588f7){var _0x2f708b={};_0x2f708b[_0x4588f7]={'$like':'%'+_0x1b9588['query']['filter']+'%'};return _0x2f708b;})});}_0x11c346=_[_0xfa80('0x46')]({},_0x11c346,_0x1b9588[_0xfa80('0x4e')]);return _0x506696[_0xfa80('0x93')](_0x11c346);}})[_0xfa80('0x2a')](function(_0x1f4554){if(_0x1f4554){_0x1241f4=_0x1f4554[_0xfa80('0x3f')];if(!_0x1b9588[_0xfa80('0x38')][_0xfa80('0x40')](_0xfa80('0x41'))){_0x11c346[_0xfa80('0x25')]=qs['limit'](_0x1b9588[_0xfa80('0x38')][_0xfa80('0x25')]);_0x11c346[_0xfa80('0x23')]=qs[_0xfa80('0x23')](_0x1b9588[_0xfa80('0x38')][_0xfa80('0x23')]);}return _0x506696[_0xfa80('0x93')](_0x11c346);}})['then'](function(_0x226398){if(_0x226398){return _0x226398?{'count':_0x1241f4,'rows':_0x226398}:null;}})['then'](respondWithResult(_0x4aefc2,null))[_0xfa80('0x4c')](handleError(_0x4aefc2,null));}; \ No newline at end of file +var _0x32d1=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','options','CmList','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Lists','UserProfileSection','autoAssociation','find','describe','addDisposition','ListId','getDispositions','findOne','Disposition','pick','filter','removeDispositions','addContacts','CmContact','tags','join','isArray','push','each','ids','success','dataValues','errors','message','json','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','order','getContactsCsv','raw','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','addCustomField','sequelize','transaction','addCustomFields','TEXT','text','Sequelize','number','INTEGER','switch','BOOLEAN','addColumn','cm_contacts','cf_%s','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x37d8b3,_0x387801){var _0x26cbd4=function(_0x29410a){while(--_0x29410a){_0x37d8b3['push'](_0x37d8b3['shift']());}};_0x26cbd4(++_0x387801);}(_0x32d1,0x1ae));var _0x132d=function(_0x76f48c,_0x4a2265){_0x76f48c=_0x76f48c-0x0;var _0x2825db=_0x32d1[_0x76f48c];return _0x2825db;};'use strict';var emlformat=require(_0x132d('0x0'));var rimraf=require(_0x132d('0x1'));var zipdir=require(_0x132d('0x2'));var jsonpatch=require(_0x132d('0x3'));var rp=require('request-promise');var moment=require(_0x132d('0x4'));var BPromise=require(_0x132d('0x5'));var Mustache=require(_0x132d('0x6'));var util=require(_0x132d('0x7'));var path=require('path');var sox=require(_0x132d('0x8'));var csv=require(_0x132d('0x9'));var ejs=require(_0x132d('0xa'));var fs=require('fs');var fs_extra=require(_0x132d('0xb'));var _=require(_0x132d('0xc'));var squel=require(_0x132d('0xd'));var crypto=require(_0x132d('0xe'));var jsforce=require(_0x132d('0xf'));var deskjs=require(_0x132d('0x10'));var toCsv=require('to-csv');var querystring=require(_0x132d('0x11'));var Papa=require(_0x132d('0x12'));var Redis=require(_0x132d('0x13'));var authService=require(_0x132d('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x132d('0x15'));var hardwareService=require(_0x132d('0x16'));var logger=require(_0x132d('0x17'))(_0x132d('0x18'));var utils=require(_0x132d('0x19'));var config=require(_0x132d('0x1a'));var licenseUtil=require(_0x132d('0x1b'));var db=require(_0x132d('0x1c'))['db'];config[_0x132d('0x1d')]=_[_0x132d('0x1e')](config['redis'],{'host':_0x132d('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x132d('0x1d')]));require(_0x132d('0x20'))[_0x132d('0x21')](socket);function respondWithStatusCode(_0x2f87eb,_0x216fd5){_0x216fd5=_0x216fd5||0xcc;return function(_0x52016a){if(_0x52016a){return _0x2f87eb[_0x132d('0x22')](_0x216fd5);}return _0x2f87eb['status'](_0x216fd5)[_0x132d('0x23')]();};}function respondWithResult(_0x69c1d6,_0x3ea730){_0x3ea730=_0x3ea730||0xc8;return function(_0x18bfba){if(_0x18bfba){return _0x69c1d6[_0x132d('0x24')](_0x3ea730)['json'](_0x18bfba);}};}function respondWithFilteredResult(_0x28e4f9,_0x54dc09){return function(_0x371fe0){if(_0x371fe0){var _0x215181=typeof _0x54dc09[_0x132d('0x25')]===_0x132d('0x26')&&typeof _0x54dc09['limit']===_0x132d('0x26');var _0x27bff8=_0x371fe0[_0x132d('0x27')];var _0x30eccd=_0x215181?0x0:_0x54dc09['offset'];var _0x1ab9f7=_0x215181?_0x371fe0[_0x132d('0x27')]:_0x54dc09[_0x132d('0x25')]+_0x54dc09[_0x132d('0x28')];var _0x22c3cb;if(_0x1ab9f7>=_0x27bff8){_0x1ab9f7=_0x27bff8;_0x22c3cb=0xc8;}else{_0x22c3cb=0xce;}_0x28e4f9[_0x132d('0x24')](_0x22c3cb);return _0x28e4f9[_0x132d('0x29')](_0x132d('0x2a'),_0x30eccd+'-'+_0x1ab9f7+'/'+_0x27bff8)['json'](_0x371fe0);}return null;};}function patchUpdates(_0x435d1c){return function(_0xb59ff1){try{jsonpatch[_0x132d('0x2b')](_0xb59ff1,_0x435d1c,!![]);}catch(_0x55cc7f){return BPromise[_0x132d('0x2c')](_0x55cc7f);}return _0xb59ff1[_0x132d('0x2d')]();};}function saveUpdates(_0x17122f,_0x1984a1){return function(_0x56beae){if(_0x56beae){return _0x56beae[_0x132d('0x2e')](_0x17122f)[_0x132d('0x2f')](function(_0x4da25a){return _0x4da25a;});}return null;};}function removeEntity(_0x38a3b8,_0x1ac148){return function(_0x51d3b1){if(_0x51d3b1){return _0x51d3b1['destroy']()[_0x132d('0x2f')](function(){var _0x2e61dc=_0x51d3b1[_0x132d('0x30')]({'plain':!![]});var _0x3374be='Lists';return db[_0x132d('0x31')][_0x132d('0x32')]({'where':{'type':_0x3374be,'resourceId':_0x2e61dc['id']}})[_0x132d('0x2f')](function(){return _0x51d3b1;});})['then'](function(){_0x38a3b8['status'](0xcc)[_0x132d('0x23')]();});}};}function handleEntityNotFound(_0x274077,_0x30aac6){return function(_0x5800cf){if(!_0x5800cf){_0x274077[_0x132d('0x22')](0x194);}return _0x5800cf;};}function handleError(_0x50e4dc,_0x3ee37e){_0x3ee37e=_0x3ee37e||0x1f4;return function(_0x3d1545){logger[_0x132d('0x33')](_0x3d1545[_0x132d('0x34')]);if(_0x3d1545[_0x132d('0x35')]){delete _0x3d1545[_0x132d('0x35')];}_0x50e4dc[_0x132d('0x24')](_0x3ee37e)[_0x132d('0x36')](_0x3d1545);};}exports[_0x132d('0x37')]=function(_0x32b302,_0x51ca04){var _0x388dc1={},_0x11cdab={},_0x3b12d5={'count':0x0,'rows':[]};var _0x339f7f=_[_0x132d('0x38')](db['CmList']['rawAttributes'],function(_0x2c7828){return{'name':_0x2c7828[_0x132d('0x39')],'type':_0x2c7828[_0x132d('0x3a')]['key']};});_0x11cdab[_0x132d('0x3b')]=_['map'](_0x339f7f,_0x132d('0x35'));_0x11cdab[_0x132d('0x3c')]=_[_0x132d('0x3d')](_0x32b302[_0x132d('0x3c')]);_0x11cdab[_0x132d('0x3e')]=_[_0x132d('0x3f')](_0x11cdab[_0x132d('0x3b')],_0x11cdab[_0x132d('0x3c')]);_0x388dc1['attributes']=_[_0x132d('0x3f')](_0x11cdab[_0x132d('0x3b')],qs[_0x132d('0x40')](_0x32b302[_0x132d('0x3c')][_0x132d('0x40')]));_0x388dc1[_0x132d('0x41')]=_0x388dc1[_0x132d('0x41')][_0x132d('0x42')]?_0x388dc1['attributes']:_0x11cdab[_0x132d('0x3b')];if(!_0x32b302['query'][_0x132d('0x43')](_0x132d('0x44'))){_0x388dc1['limit']=qs['limit'](_0x32b302['query'][_0x132d('0x28')]);_0x388dc1['offset']=qs['offset'](_0x32b302[_0x132d('0x3c')]['offset']);}_0x388dc1['order']=qs[_0x132d('0x45')](_0x32b302[_0x132d('0x3c')][_0x132d('0x45')]);_0x388dc1['where']=qs[_0x132d('0x3e')](_['pick'](_0x32b302[_0x132d('0x3c')],_0x11cdab[_0x132d('0x3e')]),_0x339f7f);if(_0x32b302[_0x132d('0x3c')]['filter']){_0x388dc1[_0x132d('0x46')]=_[_0x132d('0x47')](_0x388dc1['where'],{'$or':_[_0x132d('0x38')](_0x339f7f,function(_0x3502ab){if(_0x3502ab[_0x132d('0x3a')]!=='VIRTUAL'){var _0x47da14={};_0x47da14[_0x3502ab[_0x132d('0x35')]]={'$like':'%'+_0x32b302[_0x132d('0x3c')]['filter']+'%'};return _0x47da14;}})});}_0x388dc1=_[_0x132d('0x47')]({},_0x388dc1,_0x32b302[_0x132d('0x48')]);var _0x53ed5c={'where':_0x388dc1[_0x132d('0x46')]};return db[_0x132d('0x49')][_0x132d('0x27')](_0x53ed5c)[_0x132d('0x2f')](function(_0x29bc3b){_0x3b12d5[_0x132d('0x27')]=_0x29bc3b;if(_0x32b302['query'][_0x132d('0x4a')]){_0x388dc1[_0x132d('0x4b')]=[{'all':!![]}];}return db['CmList'][_0x132d('0x4c')](_0x388dc1);})[_0x132d('0x2f')](function(_0x51d351){_0x3b12d5[_0x132d('0x4d')]=_0x51d351;return _0x3b12d5;})[_0x132d('0x2f')](respondWithFilteredResult(_0x51ca04,_0x388dc1))[_0x132d('0x4e')](handleError(_0x51ca04,null));};exports[_0x132d('0x4f')]=function(_0x2a0077,_0x29adb4){var _0x2d5653={'raw':![],'where':{'id':_0x2a0077[_0x132d('0x50')]['id']}},_0x47487d={};_0x47487d[_0x132d('0x3b')]=_['keys'](db['CmList'][_0x132d('0x51')]);_0x47487d[_0x132d('0x3c')]=_[_0x132d('0x3d')](_0x2a0077[_0x132d('0x3c')]);_0x47487d[_0x132d('0x3e')]=_[_0x132d('0x3f')](_0x47487d[_0x132d('0x3b')],_0x47487d['query']);_0x2d5653['attributes']=_['intersection'](_0x47487d[_0x132d('0x3b')],qs[_0x132d('0x40')](_0x2a0077[_0x132d('0x3c')]['fields']));_0x2d5653[_0x132d('0x41')]=_0x2d5653[_0x132d('0x41')][_0x132d('0x42')]?_0x2d5653[_0x132d('0x41')]:_0x47487d[_0x132d('0x3b')];if(_0x2a0077['query']['includeAll']){_0x2d5653['include']=[{'all':!![]}];}_0x2d5653=_['merge']({},_0x2d5653,_0x2a0077[_0x132d('0x48')]);return db[_0x132d('0x49')]['find'](_0x2d5653)[_0x132d('0x2f')](handleEntityNotFound(_0x29adb4,null))[_0x132d('0x2f')](respondWithResult(_0x29adb4,null))[_0x132d('0x4e')](handleError(_0x29adb4,null));};exports[_0x132d('0x52')]=function(_0x20b800,_0x499221){return db[_0x132d('0x49')][_0x132d('0x52')](_0x20b800[_0x132d('0x53')],{})[_0x132d('0x2f')](function(_0x2ad33f){var _0x20d408=_0x20b800[_0x132d('0x54')][_0x132d('0x30')]({'plain':!![]});if(!_0x20d408)throw new Error(_0x132d('0x55'));if(_0x20d408['role']===_0x132d('0x54')){var _0x35f5f3=_0x2ad33f['get']({'plain':!![]});var _0x573e49=_0x132d('0x56');return db[_0x132d('0x57')]['find']({'where':{'name':_0x573e49,'userProfileId':_0x20d408['userProfileId']},'raw':!![]})[_0x132d('0x2f')](function(_0x52afc6){if(_0x52afc6&&_0x52afc6[_0x132d('0x58')]===0x0){return db[_0x132d('0x31')][_0x132d('0x52')]({'name':_0x35f5f3[_0x132d('0x35')],'resourceId':_0x35f5f3['id'],'type':_0x52afc6[_0x132d('0x35')],'sectionId':_0x52afc6['id']},{})[_0x132d('0x2f')](function(){return _0x2ad33f;});}else{return _0x2ad33f;}})[_0x132d('0x4e')](function(_0x300ce3){logger[_0x132d('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x300ce3);throw _0x300ce3;});}return _0x2ad33f;})[_0x132d('0x2f')](respondWithResult(_0x499221,0xc9))[_0x132d('0x4e')](handleError(_0x499221,null));};exports[_0x132d('0x2e')]=function(_0x220db9,_0x2ace3a){if(_0x220db9[_0x132d('0x53')]['id']){delete _0x220db9[_0x132d('0x53')]['id'];}return db[_0x132d('0x49')][_0x132d('0x59')]({'where':{'id':_0x220db9[_0x132d('0x50')]['id']}})['then'](handleEntityNotFound(_0x2ace3a,null))[_0x132d('0x2f')](saveUpdates(_0x220db9[_0x132d('0x53')],null))['then'](respondWithResult(_0x2ace3a,null))[_0x132d('0x4e')](handleError(_0x2ace3a,null));};exports[_0x132d('0x32')]=function(_0x3ca67b,_0x467e7d){return db[_0x132d('0x49')][_0x132d('0x59')]({'where':{'id':_0x3ca67b['params']['id']}})[_0x132d('0x2f')](handleEntityNotFound(_0x467e7d,null))[_0x132d('0x2f')](removeEntity(_0x467e7d,null))['catch'](handleError(_0x467e7d,null));};exports[_0x132d('0x5a')]=function(_0x3ff0ea,_0x49f981){return db['CmList']['describe']()['then'](respondWithResult(_0x49f981,null))['catch'](handleError(_0x49f981,null));};exports[_0x132d('0x5b')]=function(_0x408eb5,_0x47b2ef,_0x163a2f){if(_0x408eb5[_0x132d('0x53')]['id']){delete _0x408eb5[_0x132d('0x53')]['id'];}return db[_0x132d('0x49')][_0x132d('0x59')]({'where':{'id':_0x408eb5[_0x132d('0x50')]['id']}})[_0x132d('0x2f')](handleEntityNotFound(_0x47b2ef,null))[_0x132d('0x2f')](function(_0x300d68){if(_0x300d68){_0x408eb5[_0x132d('0x53')][_0x132d('0x5c')]=_0x300d68['id'];return db['Disposition'][_0x132d('0x52')](_0x408eb5[_0x132d('0x53')]);}})[_0x132d('0x2f')](respondWithResult(_0x47b2ef,null))[_0x132d('0x4e')](handleError(_0x47b2ef,null));};exports[_0x132d('0x5d')]=function(_0x4e2f24,_0xd5b252,_0x7e4d37){var _0xf86d8b={'raw':![],'where':{}};var _0x5baf93={};var _0x4cf840={'count':0x0,'rows':[]};return db['CmList'][_0x132d('0x5e')]({'where':{'id':_0x4e2f24['params']['id']}})[_0x132d('0x2f')](handleEntityNotFound(_0xd5b252,null))[_0x132d('0x2f')](function(_0x14c1cc){if(_0x14c1cc){_0x5baf93['model']=_[_0x132d('0x3d')](db[_0x132d('0x5f')][_0x132d('0x51')]);_0x5baf93['query']=_[_0x132d('0x3d')](_0x4e2f24['query']);_0x5baf93['filters']=_[_0x132d('0x3f')](_0x5baf93[_0x132d('0x3b')],_0x5baf93[_0x132d('0x3c')]);_0xf86d8b[_0x132d('0x41')]=_[_0x132d('0x3f')](_0x5baf93[_0x132d('0x3b')],qs[_0x132d('0x40')](_0x4e2f24[_0x132d('0x3c')][_0x132d('0x40')]));_0xf86d8b[_0x132d('0x41')]=_0xf86d8b[_0x132d('0x41')][_0x132d('0x42')]?_0xf86d8b[_0x132d('0x41')]:_0x5baf93['model'];if(!_0x4e2f24[_0x132d('0x3c')][_0x132d('0x43')](_0x132d('0x44'))){_0xf86d8b[_0x132d('0x28')]=qs[_0x132d('0x28')](_0x4e2f24[_0x132d('0x3c')][_0x132d('0x28')]);_0xf86d8b[_0x132d('0x25')]=qs[_0x132d('0x25')](_0x4e2f24['query'][_0x132d('0x25')]);}_0xf86d8b['order']=qs['sort'](_0x4e2f24[_0x132d('0x3c')][_0x132d('0x45')]);_0xf86d8b[_0x132d('0x46')]=qs['filters'](_[_0x132d('0x60')](_0x4e2f24[_0x132d('0x3c')],_0x5baf93[_0x132d('0x3e')]));_0xf86d8b[_0x132d('0x46')][_0x132d('0x5c')]=_0x14c1cc['id'];if(_0x4e2f24[_0x132d('0x3c')]['filter']){_0xf86d8b[_0x132d('0x46')]=_[_0x132d('0x47')](_0xf86d8b['where'],{'$or':_[_0x132d('0x38')](_0xf86d8b[_0x132d('0x41')],function(_0x3a017a){var _0x5ad0f1={};_0x5ad0f1[_0x3a017a]={'$like':'%'+_0x4e2f24[_0x132d('0x3c')][_0x132d('0x61')]+'%'};return _0x5ad0f1;})});}_0xf86d8b=_[_0x132d('0x47')]({},_0xf86d8b,_0x4e2f24[_0x132d('0x48')]);return db[_0x132d('0x5f')][_0x132d('0x27')]({'where':_0xf86d8b[_0x132d('0x46')]})[_0x132d('0x2f')](function(_0x53bb8a){_0x4cf840[_0x132d('0x27')]=_0x53bb8a;if(_0x4e2f24[_0x132d('0x3c')][_0x132d('0x4a')]){_0xf86d8b[_0x132d('0x4b')]=[{'all':!![]}];}return db[_0x132d('0x5f')][_0x132d('0x4c')](_0xf86d8b);})[_0x132d('0x2f')](function(_0x856931){_0x4cf840['rows']=_0x856931;return _0x4cf840;});}})['then'](respondWithFilteredResult(_0xd5b252,_0xf86d8b))[_0x132d('0x4e')](handleError(_0xd5b252,null));};exports[_0x132d('0x62')]=function(_0x4d7a59,_0x2b0326,_0x3211ad){return db['CmList'][_0x132d('0x59')]({'where':{'id':_0x4d7a59[_0x132d('0x50')]['id']}})[_0x132d('0x2f')](handleEntityNotFound(_0x2b0326,null))['then'](function(_0x35f9ba){if(_0x35f9ba){return _0x35f9ba[_0x132d('0x62')](_0x4d7a59[_0x132d('0x3c')]['ids']);}})[_0x132d('0x2f')](respondWithStatusCode(_0x2b0326,null))[_0x132d('0x4e')](handleError(_0x2b0326,null));};exports[_0x132d('0x63')]=function(_0x517145,_0x246e12,_0x3b1036){return db[_0x132d('0x49')]['find']({'where':{'id':_0x517145[_0x132d('0x50')]['id']}})[_0x132d('0x2f')](handleEntityNotFound(_0x246e12,null))[_0x132d('0x2f')](function(_0x55231b){if(_0x55231b){var _0x22fa84=[];var _0x176ede={'success':[],'errors':[]};return db[_0x132d('0x64')][_0x132d('0x5a')]()['then'](function(_0x53a8e6){if(_0x517145['body'][_0x132d('0x65')]&&_['isArray'](_0x517145[_0x132d('0x53')]['tags'])){if(_0x517145[_0x132d('0x53')]['tags'][_0x132d('0x42')]){_0x517145[_0x132d('0x53')][_0x132d('0x65')]=_0x517145[_0x132d('0x53')][_0x132d('0x65')][_0x132d('0x66')](';')+';';}else{_0x517145['body'][_0x132d('0x65')]=null;}}else{_0x517145[_0x132d('0x53')][_0x132d('0x65')]=null;}if(_0x517145[_0x132d('0x53')]&&_[_0x132d('0x67')](_0x517145['body'])){for(var _0x50e68f=0x0;_0x50e68f<_0x517145['body'][_0x132d('0x42')];_0x50e68f+=0x1){_0x517145[_0x132d('0x53')][_0x50e68f]['ListId']=_0x517145['params']['id'];_0x22fa84[_0x132d('0x68')](_0x517145[_0x132d('0x53')][_0x50e68f]);}return BPromise[_0x132d('0x69')](_0x22fa84,function(_0x42bc52){return db[_0x132d('0x64')][_0x132d('0x52')](_['omit'](_0x42bc52,[_0x132d('0x6a'),'id'])||{},{'fields':_[_0x132d('0x3d')](_0x53a8e6),'raw':!![]})[_0x132d('0x2f')](function(_0x2daadb){_0x176ede[_0x132d('0x6b')][_0x132d('0x68')](_0x2daadb[_0x132d('0x6c')]);})[_0x132d('0x4e')](function(_0x17ad5d){_0x176ede[_0x132d('0x6d')][_0x132d('0x68')]({'data':_0x42bc52,'error':_0x17ad5d[_0x132d('0x6e')]});});})[_0x132d('0x2f')](function(_0x3a7003){return _0x176ede;})[_0x132d('0x4e')](function(_0x2a5cae){return _0x2a5cae;});}else{_0x246e12['status'](0x190)[_0x132d('0x6f')]({'message':_0x132d('0x70')});}});}})['then'](respondWithResult(_0x246e12,null))[_0x132d('0x4e')](handleError(_0x246e12,null));};exports[_0x132d('0x71')]=function(_0x43598b,_0x24cec2,_0x42297d){var _0x18af06;return db[_0x132d('0x49')][_0x132d('0x59')]({'where':{'id':_0x43598b[_0x132d('0x50')]['id']},'include':[{'model':db[_0x132d('0x72')],'as':_0x132d('0x73')}]})[_0x132d('0x2f')](handleEntityNotFound(_0x24cec2,null))[_0x132d('0x2f')](function(_0x303b57){if(_0x303b57){_0x18af06=_0x303b57;return db[_0x132d('0x64')][_0x132d('0x51')];}})[_0x132d('0x2f')](function(_0x4d646e){if(_0x4d646e){var _0x55f3ab={};var _0x37deca={};_0x37deca[_0x132d('0x3b')]=_[_0x132d('0x74')](_['keys'](_0x4d646e),_[_0x132d('0x38')](_0x18af06[_0x132d('0x73')],function(_0x1d8b58){return util[_0x132d('0x75')]('cf_%d',_0x1d8b58['id']);}));_0x37deca['query']=_[_0x132d('0x3d')](_0x43598b[_0x132d('0x3c')]);_0x37deca[_0x132d('0x3e')]=_[_0x132d('0x3f')](_0x37deca[_0x132d('0x3b')],_0x37deca[_0x132d('0x3c')]);_0x55f3ab[_0x132d('0x41')]=_[_0x132d('0x3f')](_0x37deca['model'],qs[_0x132d('0x40')](_0x43598b['query'][_0x132d('0x40')]));_0x55f3ab[_0x132d('0x41')]=_0x55f3ab[_0x132d('0x41')][_0x132d('0x42')]?_0x55f3ab[_0x132d('0x41')]:_0x37deca['model'];if(!_0x43598b[_0x132d('0x3c')][_0x132d('0x43')](_0x132d('0x44'))){_0x55f3ab[_0x132d('0x28')]=qs[_0x132d('0x28')](_0x43598b[_0x132d('0x3c')][_0x132d('0x28')]);_0x55f3ab[_0x132d('0x25')]=qs[_0x132d('0x25')](_0x43598b[_0x132d('0x3c')]['offset']);}_0x55f3ab[_0x132d('0x76')]=qs[_0x132d('0x45')](_0x43598b[_0x132d('0x3c')]['sort']);_0x55f3ab[_0x132d('0x46')]=qs['filters'](_[_0x132d('0x60')](_0x43598b[_0x132d('0x3c')],_0x37deca[_0x132d('0x3e')]));_0x55f3ab['raw']=!![];if(_0x43598b[_0x132d('0x3c')][_0x132d('0x61')]){_0x55f3ab[_0x132d('0x46')]=_[_0x132d('0x47')](_0x55f3ab[_0x132d('0x46')],{'$or':_[_0x132d('0x38')](_0x55f3ab['attributes'],function(_0x588e49){var _0x492898={};_0x492898[_0x588e49]={'$like':'%'+_0x43598b[_0x132d('0x3c')][_0x132d('0x61')]+'%'};return _0x492898;})});}_0x55f3ab=_[_0x132d('0x47')]({},_0x55f3ab,_0x43598b[_0x132d('0x48')]);return _0x18af06[_0x132d('0x71')](_0x55f3ab);}})[_0x132d('0x2f')](respondWithResult(_0x24cec2,null))[_0x132d('0x4e')](handleError(_0x24cec2,null));};exports[_0x132d('0x77')]=function(_0x58602c,_0x771ddb,_0x2b6ccd){var _0x3cdb2d;return db[_0x132d('0x49')]['find']({'where':{'id':_0x58602c[_0x132d('0x50')]['id']},'include':[{'model':db[_0x132d('0x72')],'as':'CustomFields'}]})[_0x132d('0x2f')](handleEntityNotFound(_0x771ddb,null))[_0x132d('0x2f')](function(_0x239862){if(_0x239862){_0x3cdb2d=_0x239862;return db[_0x132d('0x64')][_0x132d('0x51')];}})['then'](function(_0x16d1b6){if(_0x16d1b6){var _0x2eec02={};var _0x564ca1={};_0x564ca1[_0x132d('0x3b')]=_['concat'](_[_0x132d('0x3d')](_0x16d1b6),_[_0x132d('0x38')](_0x3cdb2d[_0x132d('0x73')],function(_0x2f5ab3){return util['format']('cf_%d',_0x2f5ab3['id']);}));_0x564ca1[_0x132d('0x3c')]=_[_0x132d('0x3d')](_0x58602c[_0x132d('0x3c')]);_0x564ca1['filters']=_[_0x132d('0x3f')](_0x564ca1[_0x132d('0x3b')],_0x564ca1[_0x132d('0x3c')]);_0x2eec02[_0x132d('0x41')]=_[_0x132d('0x3f')](_0x564ca1[_0x132d('0x3b')],qs['fields'](_0x58602c[_0x132d('0x3c')]['fields']));_0x2eec02[_0x132d('0x41')]=_0x2eec02[_0x132d('0x41')][_0x132d('0x42')]?_0x2eec02['attributes']:_0x564ca1[_0x132d('0x3b')];if(!_0x58602c[_0x132d('0x3c')]['hasOwnProperty'](_0x132d('0x44'))){_0x2eec02[_0x132d('0x28')]=qs[_0x132d('0x28')](_0x58602c['query'][_0x132d('0x28')]);_0x2eec02[_0x132d('0x25')]=qs[_0x132d('0x25')](_0x58602c[_0x132d('0x3c')][_0x132d('0x25')]);}_0x2eec02[_0x132d('0x76')]=qs['sort'](_0x58602c[_0x132d('0x3c')][_0x132d('0x45')]);_0x2eec02[_0x132d('0x46')]=qs['filters'](_[_0x132d('0x60')](_0x58602c[_0x132d('0x3c')],_0x564ca1[_0x132d('0x3e')]));_0x2eec02[_0x132d('0x78')]=!![];if(_0x58602c[_0x132d('0x3c')][_0x132d('0x61')]){_0x2eec02[_0x132d('0x46')]=_[_0x132d('0x47')](_0x2eec02['where'],{'$or':_['map'](_0x2eec02['attributes'],function(_0x521c24){var _0xd0a875={};_0xd0a875[_0x521c24]={'$like':'%'+_0x58602c['query'][_0x132d('0x61')]+'%'};return _0xd0a875;})});}_0x2eec02=_['merge']({},_0x2eec02,_0x58602c[_0x132d('0x48')]);return _0x3cdb2d['getContacts'](_0x2eec02);}})['then'](function(_0x2c9996){if(!_[_0x132d('0x79')](_0x2c9996)){var _0x333c70=toCsv(_0x2c9996);var _0x33fe98=Date[_0x132d('0x7a')]();fs['writeFileSync'](util[_0x132d('0x75')](_0x132d('0x7b'),_0x3cdb2d['id'],_0x33fe98),_0x333c70);_0x771ddb[_0x132d('0x7c')](_0x132d('0x7d'),_0x132d('0x7e')+util[_0x132d('0x75')](_0x132d('0x7f'),_0x3cdb2d['id'],_0x33fe98));_0x771ddb['setHeader']('Content-type',_0x132d('0x80'));return _0x771ddb['download'](util[_0x132d('0x75')](_0x132d('0x7b'),_0x3cdb2d['id'],_0x33fe98));}else{return _0x771ddb[_0x132d('0x22')](0xcc);}})[_0x132d('0x4e')](handleError(_0x771ddb,null));};exports[_0x132d('0x81')]=function(_0x1df981,_0x4a0062,_0xd448b9){var _0x164835;delete _0x1df981[_0x132d('0x53')]['id'];return db['CmList']['findOne']({'where':{'id':_0x1df981[_0x132d('0x50')]['id']}})[_0x132d('0x2f')](handleEntityNotFound(_0x4a0062,null))['then'](function(_0xf8e61d){if(_0xf8e61d){return db[_0x132d('0x82')][_0x132d('0x83')](function(_0x1cd6fe){return db[_0x132d('0x72')][_0x132d('0x52')](_0x1df981['body'],{'transaction':_0x1cd6fe})[_0x132d('0x2f')](function(_0x5142fc){_0x164835=_0x5142fc;return _0xf8e61d[_0x132d('0x84')](_0x5142fc,{'transaction':_0x1cd6fe});})[_0x132d('0x2f')](function(){var _0x5bdaa5={'type':db['Sequelize'][_0x132d('0x85')],'transaction':_0x1cd6fe};switch(_0x1df981[_0x132d('0x53')][_0x132d('0x3a')]){case _0x132d('0x86'):_0x5bdaa5[_0x132d('0x3a')]=db[_0x132d('0x87')][_0x132d('0x85')];break;case _0x132d('0x88'):_0x5bdaa5[_0x132d('0x3a')]=db[_0x132d('0x87')][_0x132d('0x89')];break;case _0x132d('0x8a'):_0x5bdaa5[_0x132d('0x3a')]=db[_0x132d('0x87')][_0x132d('0x8b')];_0x5bdaa5['defaultValue']=![];break;default:}return db[_0x132d('0x82')]['queryInterface'][_0x132d('0x8c')](_0x132d('0x8d'),util[_0x132d('0x75')](_0x132d('0x8e'),_0x164835['id']),_0x5bdaa5);})['then'](function(){return _0x164835;});});}})[_0x132d('0x2f')](respondWithResult(_0x4a0062,null))[_0x132d('0x4e')](handleError(_0x4a0062,null));};exports['getCustomFields']=function(_0x300156,_0x5c5db0,_0x16bc87){var _0x4515b6={};var _0x25c5b7={};var _0x48e4de;var _0x4d7feb;return db[_0x132d('0x49')][_0x132d('0x5e')]({'where':{'id':_0x300156[_0x132d('0x50')]['id']}})[_0x132d('0x2f')](handleEntityNotFound(_0x5c5db0,null))[_0x132d('0x2f')](function(_0x34e33a){if(_0x34e33a){_0x48e4de=_0x34e33a;_0x25c5b7[_0x132d('0x3b')]=_[_0x132d('0x3d')](db['CmCustomField'][_0x132d('0x51')]);_0x25c5b7[_0x132d('0x3c')]=_[_0x132d('0x3d')](_0x300156['query']);_0x25c5b7[_0x132d('0x3e')]=_[_0x132d('0x3f')](_0x25c5b7['model'],_0x25c5b7[_0x132d('0x3c')]);_0x4515b6['attributes']=_['intersection'](_0x25c5b7['model'],qs[_0x132d('0x40')](_0x300156['query']['fields']));_0x4515b6['attributes']=_0x4515b6['attributes'][_0x132d('0x42')]?_0x4515b6[_0x132d('0x41')]:_0x25c5b7['model'];_0x4515b6[_0x132d('0x76')]=qs['sort'](_0x300156['query'][_0x132d('0x45')]);_0x4515b6['where']=qs[_0x132d('0x3e')](_[_0x132d('0x60')](_0x300156[_0x132d('0x3c')],_0x25c5b7[_0x132d('0x3e')]));_0x4515b6['where']=_['merge'](_0x4515b6[_0x132d('0x46')],{'$or':[{'ListId':_0x34e33a['id']},{'ListId':null}]});if(_0x300156[_0x132d('0x3c')][_0x132d('0x61')]){_0x4515b6[_0x132d('0x46')]=_[_0x132d('0x47')](_0x4515b6[_0x132d('0x46')],{'$or':_[_0x132d('0x38')](_0x4515b6['attributes'],function(_0x57d5be){var _0x3572bc={};_0x3572bc[_0x57d5be]={'$like':'%'+_0x300156[_0x132d('0x3c')][_0x132d('0x61')]+'%'};return _0x3572bc;})});}_0x4515b6=_[_0x132d('0x47')]({},_0x4515b6,_0x300156[_0x132d('0x48')]);return db[_0x132d('0x72')][_0x132d('0x8f')](_0x4515b6);}})[_0x132d('0x2f')](respondWithResult(_0x5c5db0,null))[_0x132d('0x4e')](handleError(_0x5c5db0,null));};exports[_0x132d('0x90')]=function(_0x5c95f3,_0x498897,_0x122b2b){return db[_0x132d('0x49')][_0x132d('0x59')]({'where':{'id':_0x5c95f3[_0x132d('0x50')]['id']}})[_0x132d('0x2f')](handleEntityNotFound(_0x498897,null))[_0x132d('0x2f')](function(_0x25d473){if(_0x25d473){return _0x25d473[_0x132d('0x90')](_0x5c95f3[_0x132d('0x53')][_0x132d('0x6a')],_['omit'](_0x5c95f3['body'],[_0x132d('0x6a'),'id'])||{})[_0x132d('0x91')](function(_0x13586d){for(var _0x1b413e=0x0;_0x1b413e<_0x5c95f3['body'][_0x132d('0x6a')][_0x132d('0x42')];_0x1b413e+=0x1){socket[_0x132d('0x92')](_0x132d('0x93'),{'UserId':Number(_0x5c95f3[_0x132d('0x53')][_0x132d('0x6a')][_0x1b413e]),'CmListId':Number(_0x5c95f3[_0x132d('0x50')]['id'])});}return _0x13586d;});}})[_0x132d('0x2f')](respondWithResult(_0x498897,null))[_0x132d('0x4e')](handleError(_0x498897,null));};exports['removeAgents']=function(_0x249b71,_0x5246cf,_0x53275f){return db['CmList'][_0x132d('0x59')]({'where':{'id':_0x249b71[_0x132d('0x50')]['id']}})[_0x132d('0x2f')](handleEntityNotFound(_0x5246cf,null))[_0x132d('0x2f')](function(_0x1b7da5){if(_0x1b7da5){return _0x1b7da5[_0x132d('0x94')](_0x249b71['query'][_0x132d('0x6a')])[_0x132d('0x2f')](function(){if(_[_0x132d('0x67')](_0x249b71[_0x132d('0x3c')][_0x132d('0x6a')])){for(var _0xe2dbfd=0x0;_0xe2dbfd<_0x249b71['query'][_0x132d('0x6a')][_0x132d('0x42')];_0xe2dbfd+=0x1){socket[_0x132d('0x92')]('userCmList:remove',{'UserId':Number(_0x249b71[_0x132d('0x3c')][_0x132d('0x6a')][_0xe2dbfd]),'CmListId':Number(_0x249b71['params']['id'])});}}else{socket[_0x132d('0x92')](_0x132d('0x95'),{'UserId':Number(_0x249b71[_0x132d('0x3c')][_0x132d('0x6a')]),'CmListId':Number(_0x249b71[_0x132d('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x5246cf,null))[_0x132d('0x4e')](handleError(_0x5246cf,null));};exports[_0x132d('0x96')]=function(_0x3faa7d,_0x44fbf2,_0x52500f){var _0x136d82={};var _0x51fcc7={};var _0x3fb372;var _0x44ef7a;return db[_0x132d('0x49')]['findOne']({'where':{'id':_0x3faa7d[_0x132d('0x50')]['id']}})[_0x132d('0x2f')](handleEntityNotFound(_0x44fbf2,null))[_0x132d('0x2f')](function(_0x1e01dd){if(_0x1e01dd){_0x3fb372=_0x1e01dd;_0x51fcc7[_0x132d('0x3b')]=_[_0x132d('0x3d')](db[_0x132d('0x97')][_0x132d('0x51')]);_0x51fcc7[_0x132d('0x3c')]=_[_0x132d('0x3d')](_0x3faa7d[_0x132d('0x3c')]);_0x51fcc7[_0x132d('0x3e')]=_[_0x132d('0x3f')](_0x51fcc7['model'],_0x51fcc7[_0x132d('0x3c')]);_0x136d82['attributes']=_['intersection'](_0x51fcc7['model'],qs[_0x132d('0x40')](_0x3faa7d[_0x132d('0x3c')][_0x132d('0x40')]));_0x136d82[_0x132d('0x41')]=_0x136d82[_0x132d('0x41')][_0x132d('0x42')]?_0x136d82['attributes']:_0x51fcc7[_0x132d('0x3b')];_0x136d82['order']=qs[_0x132d('0x45')](_0x3faa7d['query'][_0x132d('0x45')]);_0x136d82['where']=qs['filters'](_[_0x132d('0x60')](_0x3faa7d[_0x132d('0x3c')],_0x51fcc7[_0x132d('0x3e')]));if(_0x3faa7d['query'][_0x132d('0x61')]){_0x136d82[_0x132d('0x46')]=_[_0x132d('0x47')](_0x136d82['where'],{'$or':_[_0x132d('0x38')](_0x136d82[_0x132d('0x41')],function(_0x3d4011){var _0x4e8a94={};_0x4e8a94[_0x3d4011]={'$like':'%'+_0x3faa7d[_0x132d('0x3c')][_0x132d('0x61')]+'%'};return _0x4e8a94;})});}_0x136d82=_['merge']({},_0x136d82,_0x3faa7d[_0x132d('0x48')]);return _0x3fb372[_0x132d('0x96')](_0x136d82);}})[_0x132d('0x2f')](function(_0x41a50d){if(_0x41a50d){_0x44ef7a=_0x41a50d[_0x132d('0x42')];if(!_0x3faa7d[_0x132d('0x3c')][_0x132d('0x43')](_0x132d('0x44'))){_0x136d82[_0x132d('0x28')]=qs[_0x132d('0x28')](_0x3faa7d[_0x132d('0x3c')][_0x132d('0x28')]);_0x136d82[_0x132d('0x25')]=qs['offset'](_0x3faa7d[_0x132d('0x3c')][_0x132d('0x25')]);}return _0x3fb372[_0x132d('0x96')](_0x136d82);}})[_0x132d('0x2f')](function(_0x65cb01){if(_0x65cb01){return _0x65cb01?{'count':_0x44ef7a,'rows':_0x65cb01}:null;}})[_0x132d('0x2f')](respondWithResult(_0x44fbf2,null))[_0x132d('0x4e')](handleError(_0x44fbf2,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 9d7e269..e473b9a 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(_0x13e4db,_0xaf4b11){_0x13e4db=_0x13e4db-0x0;var _0x549f0a=_0x3e74[_0x13e4db];return _0x549f0a;};'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(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0x55ca,0x126));var _0xa55c=function(_0x101802,_0x11f913){_0x101802=_0x101802-0x0;var _0x5d61ce=_0x55ca[_0x101802];return _0x5d61ce;};'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 7d41b91..768f2d8 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 _0x702d=['exports','define','CmList','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x322d64,_0x269abb){var _0x17865b=function(_0x4d9bb2){while(--_0x4d9bb2){_0x322d64['push'](_0x322d64['shift']());}};_0x17865b(++_0x269abb);}(_0x702d,0x147));var _0xd702=function(_0x3b35f2,_0x7c18f9){_0x3b35f2=_0x3b35f2-0x0;var _0x365968=_0x702d[_0x3b35f2];return _0x365968;};'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 +var _0xf109=['CmList','cm_lists','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define'];(function(_0x403103,_0x48bda0){var _0x43fe6e=function(_0x3146d3){while(--_0x3146d3){_0x403103['push'](_0x403103['shift']());}};_0x43fe6e(++_0x48bda0);}(_0xf109,0xce));var _0x9f10=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xf109[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var logger=require(_0x9f10('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f10('0x3'));var fs=require('fs');var path=require(_0x9f10('0x4'));var rimraf=require(_0x9f10('0x5'));var config=require(_0x9f10('0x6'));var attributes=require(_0x9f10('0x7'));module[_0x9f10('0x8')]=function(_0x408fe8,_0xd3137b){return _0x408fe8[_0x9f10('0x9')](_0x9f10('0xa'),attributes,{'tableName':_0x9f10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index bcf2ec7..c11e7df 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 _0xcbf8=['localhost','socket.io-emitter','./cmList.socket','request','then','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x49b4cb,_0x257843){var _0x338fc0=function(_0x352cff){while(--_0x352cff){_0x49b4cb['push'](_0x49b4cb['shift']());}};_0x338fc0(++_0x257843);}(_0xcbf8,0x101));var _0x8cbf=function(_0x386f47,_0x5d1396){_0x386f47=_0x386f47-0x0;var _0x47df4e=_0xcbf8[_0x386f47];return _0x47df4e;};'use strict';var _=require(_0x8cbf('0x0'));var util=require('util');var moment=require(_0x8cbf('0x1'));var BPromise=require(_0x8cbf('0x2'));var rs=require(_0x8cbf('0x3'));var fs=require('fs');var Redis=require(_0x8cbf('0x4'));var db=require(_0x8cbf('0x5'))['db'];var utils=require(_0x8cbf('0x6'));var logger=require(_0x8cbf('0x7'))(_0x8cbf('0x8'));var config=require(_0x8cbf('0x9'));var jayson=require(_0x8cbf('0xa'));var client=jayson['client'][_0x8cbf('0xb')]({'port':0x232a});config[_0x8cbf('0xc')]=_['defaults'](config[_0x8cbf('0xc')],{'host':_0x8cbf('0xd'),'port':0x18eb});var socket=require(_0x8cbf('0xe'))(new Redis(config[_0x8cbf('0xc')]));require(_0x8cbf('0xf'))['register'](socket);function respondWithRpcPromise(_0x5923d9,_0x47d744,_0x577adf){return new BPromise(function(_0x51eb0b,_0x41669e){return client[_0x8cbf('0x10')](_0x5923d9,_0x577adf)[_0x8cbf('0x11')](function(_0x1ec3fa){logger[_0x8cbf('0x12')](_0x8cbf('0x13'),_0x47d744,'request\x20sent');logger[_0x8cbf('0x14')](_0x8cbf('0x15'),_0x47d744,_0x8cbf('0x16'),JSON[_0x8cbf('0x17')](_0x1ec3fa));if(_0x1ec3fa[_0x8cbf('0x18')]){if(_0x1ec3fa[_0x8cbf('0x18')]['code']===0x1f4){logger['error'](_0x8cbf('0x13'),_0x47d744,_0x1ec3fa[_0x8cbf('0x18')][_0x8cbf('0x19')]);return _0x41669e(_0x1ec3fa[_0x8cbf('0x18')][_0x8cbf('0x19')]);}logger['error'](_0x8cbf('0x13'),_0x47d744,_0x1ec3fa[_0x8cbf('0x18')][_0x8cbf('0x19')]);return _0x51eb0b(_0x1ec3fa[_0x8cbf('0x18')][_0x8cbf('0x19')]);}else{logger[_0x8cbf('0x12')](_0x8cbf('0x13'),_0x47d744,_0x8cbf('0x16'));_0x51eb0b(_0x1ec3fa['result'][_0x8cbf('0x19')]);}})[_0x8cbf('0x1a')](function(_0x1d2fb0){logger[_0x8cbf('0x18')](_0x8cbf('0x13'),_0x47d744,_0x1d2fb0);_0x41669e(_0x1d2fb0);});});} \ No newline at end of file +var _0xc787=['request','then','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./cmList.socket','register'];(function(_0x326810,_0xea181c){var _0x57708d=function(_0x45d5c3){while(--_0x45d5c3){_0x326810['push'](_0x326810['shift']());}};_0x57708d(++_0xea181c);}(_0xc787,0xba));var _0x7c78=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xc787[_0x31e29a];return _0x32d892;};'use strict';var _=require('lodash');var util=require(_0x7c78('0x0'));var moment=require(_0x7c78('0x1'));var BPromise=require('bluebird');var rs=require(_0x7c78('0x2'));var fs=require('fs');var Redis=require(_0x7c78('0x3'));var db=require(_0x7c78('0x4'))['db'];var utils=require(_0x7c78('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7c78('0x6'));var jayson=require(_0x7c78('0x7'));var client=jayson['client'][_0x7c78('0x8')]({'port':0x232a});config['redis']=_[_0x7c78('0x9')](config[_0x7c78('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7c78('0xb'))(new Redis(config['redis']));require(_0x7c78('0xc'))[_0x7c78('0xd')](socket);function respondWithRpcPromise(_0x4dca9f,_0x2abe00,_0xd871e){return new BPromise(function(_0x4cff55,_0x16e6c1){return client[_0x7c78('0xe')](_0x4dca9f,_0xd871e)[_0x7c78('0xf')](function(_0x56e9c3){logger[_0x7c78('0x10')](_0x7c78('0x11'),_0x2abe00,_0x7c78('0x12'));logger['debug'](_0x7c78('0x13'),_0x2abe00,_0x7c78('0x12'),JSON['stringify'](_0x56e9c3));if(_0x56e9c3[_0x7c78('0x14')]){if(_0x56e9c3[_0x7c78('0x14')][_0x7c78('0x15')]===0x1f4){logger[_0x7c78('0x14')](_0x7c78('0x11'),_0x2abe00,_0x56e9c3[_0x7c78('0x14')][_0x7c78('0x16')]);return _0x16e6c1(_0x56e9c3[_0x7c78('0x14')]['message']);}logger[_0x7c78('0x14')](_0x7c78('0x11'),_0x2abe00,_0x56e9c3[_0x7c78('0x14')][_0x7c78('0x16')]);return _0x4cff55(_0x56e9c3[_0x7c78('0x14')][_0x7c78('0x16')]);}else{logger[_0x7c78('0x10')](_0x7c78('0x11'),_0x2abe00,_0x7c78('0x12'));_0x4cff55(_0x56e9c3[_0x7c78('0x17')][_0x7c78('0x16')]);}})[_0x7c78('0x18')](function(_0x2a7472){logger[_0x7c78('0x14')]('CmList,\x20%s,\x20%s',_0x2abe00,_0x2a7472);_0x16e6c1(_0x2a7472);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 8fc1e61..b1e4f8f 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 _0xcad3=['save','update','emit','removeListener','register','length','cmList:'];(function(_0x1101b1,_0x1c227b){var _0x59d4d5=function(_0x32a978){while(--_0x32a978){_0x1101b1['push'](_0x1101b1['shift']());}};_0x59d4d5(++_0x1c227b);}(_0xcad3,0xc4));var _0x3cad=function(_0x1a12c8,_0x2df4dc){_0x1a12c8=_0x1a12c8-0x0;var _0x305109=_0xcad3[_0x1a12c8];return _0x305109;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x3cad('0x0'),'remove',_0x3cad('0x1')];function createListener(_0x4156a9,_0x46e162){return function(_0x1e369a){_0x46e162[_0x3cad('0x2')](_0x4156a9,_0x1e369a);};}function removeListener(_0x48de2f,_0x28d36a){return function(){CmListEvents[_0x3cad('0x3')](_0x48de2f,_0x28d36a);};}exports[_0x3cad('0x4')]=function(_0x559fb7){for(var _0x40c922=0x0,_0x5e8f60=events[_0x3cad('0x5')];_0x40c922<_0x5e8f60;_0x40c922++){var _0x9c11ff=events[_0x40c922];var _0x8b2c0a=createListener(_0x3cad('0x6')+_0x9c11ff,_0x559fb7);CmListEvents['on'](_0x9c11ff,_0x8b2c0a);}}; \ No newline at end of file +var _0xf62a=['remove','removeListener','register','length','cmList:','save'];(function(_0x10e983,_0x2f4eda){var _0x324138=function(_0x17a377){while(--_0x17a377){_0x10e983['push'](_0x10e983['shift']());}};_0x324138(++_0x2f4eda);}(_0xf62a,0x12b));var _0xaf62=function(_0x5aa41d,_0x331f74){_0x5aa41d=_0x5aa41d-0x0;var _0x421ba2=_0xf62a[_0x5aa41d];return _0x421ba2;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xaf62('0x0'),_0xaf62('0x1'),'update'];function createListener(_0x14e83c,_0x31936e){return function(_0x180f64){_0x31936e['emit'](_0x14e83c,_0x180f64);};}function removeListener(_0x23ef87,_0x344810){return function(){CmListEvents[_0xaf62('0x2')](_0x23ef87,_0x344810);};}exports[_0xaf62('0x3')]=function(_0x2f7a83){for(var _0x438535=0x0,_0x2cee41=events[_0xaf62('0x4')];_0x438535<_0x2cee41;_0x438535++){var _0x5471e1=events[_0x438535];var _0x31d232=createListener(_0xaf62('0x5')+_0x5471e1,_0x2f7a83);CmListEvents['on'](_0x5471e1,_0x31d232);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 4d6596b..8ebc861 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 _0x69cc=['post','create','/:id/dispositions','addDisposition','addCustomField','addAgents','update','delete','destroy','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','describe','/:id','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','getAgents'];(function(_0x2ed3c7,_0x50924f){var _0x36b8bf=function(_0x5793e6){while(--_0x5793e6){_0x2ed3c7['push'](_0x2ed3c7['shift']());}};_0x36b8bf(++_0x50924f);}(_0x69cc,0xf2));var _0xc69c=function(_0x4098fe,_0x4a3513){_0x4098fe=_0x4098fe-0x0;var _0x1c4b5a=_0x69cc[_0x4098fe];return _0x1c4b5a;};'use strict';var multer=require(_0xc69c('0x0'));var util=require(_0xc69c('0x1'));var path=require('path');var timeout=require(_0xc69c('0x2'));var express=require(_0xc69c('0x3'));var router=express[_0xc69c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc69c('0x5'));var config=require(_0xc69c('0x6'));var controller=require(_0xc69c('0x7'));router[_0xc69c('0x8')]('/',auth[_0xc69c('0x9')](),controller[_0xc69c('0xa')]);router[_0xc69c('0x8')]('/describe',auth[_0xc69c('0x9')](),controller[_0xc69c('0xb')]);router[_0xc69c('0x8')](_0xc69c('0xc'),auth['isAuthenticated'](),controller[_0xc69c('0xd')]);router['get']('/:id/dispositions',auth[_0xc69c('0x9')](),controller[_0xc69c('0xe')]);router[_0xc69c('0x8')](_0xc69c('0xf'),auth[_0xc69c('0x9')](),controller[_0xc69c('0x10')]);router[_0xc69c('0x8')](_0xc69c('0x11'),auth[_0xc69c('0x9')](),controller[_0xc69c('0x12')]);router[_0xc69c('0x8')](_0xc69c('0x13'),auth['isAuthenticated'](),controller['getCustomFields']);router[_0xc69c('0x8')](_0xc69c('0x14'),auth[_0xc69c('0x9')](),controller[_0xc69c('0x15')]);router[_0xc69c('0x16')]('/',auth['isAuthenticated'](),controller[_0xc69c('0x17')]);router['post'](_0xc69c('0x18'),auth[_0xc69c('0x9')](),controller[_0xc69c('0x19')]);router['post'](_0xc69c('0xf'),auth[_0xc69c('0x9')](),controller['addContacts']);router[_0xc69c('0x16')]('/:id/fields',auth[_0xc69c('0x9')](),controller[_0xc69c('0x1a')]);router['post'](_0xc69c('0x14'),auth[_0xc69c('0x9')](),controller[_0xc69c('0x1b')]);router['put'](_0xc69c('0xc'),auth[_0xc69c('0x9')](),controller[_0xc69c('0x1c')]);router[_0xc69c('0x1d')](_0xc69c('0xc'),auth['isAuthenticated'](),controller[_0xc69c('0x1e')]);router[_0xc69c('0x1d')](_0xc69c('0x18'),auth[_0xc69c('0x9')](),controller['removeDispositions']);router[_0xc69c('0x1d')](_0xc69c('0x14'),auth['isAuthenticated'](),controller[_0xc69c('0x1f')]);module[_0xc69c('0x20')]=router; \ No newline at end of file +var _0x0d5d=['isAuthenticated','get','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','addContacts','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cmList.controller'];(function(_0x4e0274,_0x287398){var _0x30cf86=function(_0x429b2f){while(--_0x429b2f){_0x4e0274['push'](_0x4e0274['shift']());}};_0x30cf86(++_0x287398);}(_0x0d5d,0x125));var _0xd0d5=function(_0x4c231f,_0x1e0f60){_0x4c231f=_0x4c231f-0x0;var _0x2a2121=_0x0d5d[_0x4c231f];return _0x2a2121;};'use strict';var multer=require('multer');var util=require(_0xd0d5('0x0'));var path=require('path');var timeout=require(_0xd0d5('0x1'));var express=require(_0xd0d5('0x2'));var router=express[_0xd0d5('0x3')]();var fs_extra=require(_0xd0d5('0x4'));var auth=require(_0xd0d5('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd0d5('0x6'));router['get']('/',auth[_0xd0d5('0x7')](),controller['index']);router[_0xd0d5('0x8')](_0xd0d5('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xd0d5('0x8')](_0xd0d5('0xa'),auth[_0xd0d5('0x7')](),controller[_0xd0d5('0xb')]);router[_0xd0d5('0x8')](_0xd0d5('0xc'),auth[_0xd0d5('0x7')](),controller[_0xd0d5('0xd')]);router['get'](_0xd0d5('0xe'),auth[_0xd0d5('0x7')](),controller[_0xd0d5('0xf')]);router[_0xd0d5('0x8')]('/:id/contacts/csv',auth[_0xd0d5('0x7')](),controller[_0xd0d5('0x10')]);router[_0xd0d5('0x8')](_0xd0d5('0x11'),auth[_0xd0d5('0x7')](),controller[_0xd0d5('0x12')]);router['get'](_0xd0d5('0x13'),auth['isAuthenticated'](),controller[_0xd0d5('0x14')]);router[_0xd0d5('0x15')]('/',auth[_0xd0d5('0x7')](),controller['create']);router['post'](_0xd0d5('0xc'),auth[_0xd0d5('0x7')](),controller['addDisposition']);router['post'](_0xd0d5('0xe'),auth[_0xd0d5('0x7')](),controller[_0xd0d5('0x16')]);router['post'](_0xd0d5('0x11'),auth['isAuthenticated'](),controller['addCustomField']);router[_0xd0d5('0x15')](_0xd0d5('0x13'),auth[_0xd0d5('0x7')](),controller[_0xd0d5('0x17')]);router[_0xd0d5('0x18')](_0xd0d5('0xa'),auth[_0xd0d5('0x7')](),controller[_0xd0d5('0x19')]);router[_0xd0d5('0x1a')](_0xd0d5('0xa'),auth[_0xd0d5('0x7')](),controller[_0xd0d5('0x1b')]);router[_0xd0d5('0x1a')](_0xd0d5('0xc'),auth[_0xd0d5('0x7')](),controller[_0xd0d5('0x1c')]);router[_0xd0d5('0x1a')](_0xd0d5('0x13'),auth[_0xd0d5('0x7')](),controller[_0xd0d5('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 92d9ee7..2c6c8f4 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 _0x73c1=['STRING','sequelize','exports','VIRTUAL','getDataValue','field'];(function(_0x1c3275,_0x592ca9){var _0x50211f=function(_0x4c4fcc){while(--_0x4c4fcc){_0x1c3275['push'](_0x1c3275['shift']());}};_0x50211f(++_0x592ca9);}(_0x73c1,0x103));var _0x173c=function(_0x452004,_0x52e8d5){_0x452004=_0x452004-0x0;var _0x1027bb=_0x73c1[_0x452004];return _0x1027bb;};'use strict';var Sequelize=require(_0x173c('0x0'));module[_0x173c('0x1')]={'name':{'type':Sequelize[_0x173c('0x2')],'get':function(_0x38af1e){return this[_0x173c('0x3')](_0x173c('0x4'));}},'field':{'type':Sequelize[_0x173c('0x5')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x173c('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0xa1d4=['STRING','sequelize','exports','getDataValue','field'];(function(_0x161e1f,_0x1942db){var _0x3e44d9=function(_0x31ce61){while(--_0x31ce61){_0x161e1f['push'](_0x161e1f['shift']());}};_0x3e44d9(++_0x1942db);}(_0xa1d4,0x7e));var _0x4a1d=function(_0x233bd8,_0x377898){_0x233bd8=_0x233bd8-0x0;var _0x2ad24c=_0xa1d4[_0x233bd8];return _0x2ad24c;};'use strict';var Sequelize=require(_0x4a1d('0x0'));module[_0x4a1d('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2f0d9f){return this[_0x4a1d('0x2')](_0x4a1d('0x3'));}},'field':{'type':Sequelize[_0x4a1d('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x4a1d('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x4a1d('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index dfca425..fb610e4 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x2dfe9b,_0x46a8d8){var _0x53c2d=function(_0x15732e){while(--_0x15732e){_0x2dfe9b['push'](_0x2dfe9b['shift']());}};_0x53c2d(++_0x46a8d8);}(_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){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x2bf644,_0x4b9735){var _0x2ba23c=function(_0x393eba){while(--_0x393eba){_0x2bf644['push'](_0x2bf644['shift']());}};_0x2ba23c(++_0x4b9735);}(_0x7a54,0x106));var _0x47a5=function(_0x332c4c,_0x1b1333){_0x332c4c=_0x332c4c-0x0;var _0xc03ebb=_0x7a54[_0x332c4c];return _0xc03ebb;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 5122ab8..c15f94b 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 _0x13cb=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./condition.attributes','define','Condition','tools_conditions','util'];(function(_0x31c95a,_0x3e1e64){var _0x54cf4f=function(_0x352a05){while(--_0x352a05){_0x31c95a['push'](_0x31c95a['shift']());}};_0x54cf4f(++_0x3e1e64);}(_0x13cb,0x1d3));var _0xb13c=function(_0x3e0fab,_0x285e29){_0x3e0fab=_0x3e0fab-0x0;var _0x36cde8=_0x13cb[_0x3e0fab];return _0x36cde8;};'use strict';var _=require('lodash');var util=require(_0xb13c('0x0'));var logger=require(_0xb13c('0x1'))(_0xb13c('0x2'));var moment=require(_0xb13c('0x3'));var BPromise=require(_0xb13c('0x4'));var rp=require(_0xb13c('0x5'));var fs=require('fs');var path=require(_0xb13c('0x6'));var rimraf=require(_0xb13c('0x7'));var config=require('../../config/environment');var attributes=require(_0xb13c('0x8'));module['exports']=function(_0x3cdac6,_0x509174){return _0x3cdac6[_0xb13c('0x9')](_0xb13c('0xa'),attributes,{'tableName':_0xb13c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2531=['bluebird','request-promise','rimraf','exports','define','Condition','tools_conditions','util','../../config/logger','api','moment'];(function(_0x263375,_0x1f4820){var _0x25d53d=function(_0x82aa38){while(--_0x82aa38){_0x263375['push'](_0x263375['shift']());}};_0x25d53d(++_0x1f4820);}(_0x2531,0xe3));var _0x1253=function(_0x4eae43,_0x2cff7e){_0x4eae43=_0x4eae43-0x0;var _0x5a171d=_0x2531[_0x4eae43];return _0x5a171d;};'use strict';var _=require('lodash');var util=require(_0x1253('0x0'));var logger=require(_0x1253('0x1'))(_0x1253('0x2'));var moment=require(_0x1253('0x3'));var BPromise=require(_0x1253('0x4'));var rp=require(_0x1253('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1253('0x6'));var config=require('../../config/environment');var attributes=require('./condition.attributes');module[_0x1253('0x7')]=function(_0x39c8f6,_0x1efd91){return _0x39c8f6[_0x1253('0x8')](_0x1253('0x9'),attributes,{'tableName':_0x1253('0xa'),'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 45a6d19..448b51c 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 _0xf9ce=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s'];(function(_0x21002c,_0x10d361){var _0xd8d637=function(_0x3fd1ec){while(--_0x3fd1ec){_0x21002c['push'](_0x21002c['shift']());}};_0xd8d637(++_0x10d361);}(_0xf9ce,0x11a));var _0xef9c=function(_0x29aefc,_0x4dcf53){_0x29aefc=_0x29aefc-0x0;var _0x11be36=_0xf9ce[_0x29aefc];return _0x11be36;};'use strict';var _=require(_0xef9c('0x0'));var util=require('util');var moment=require(_0xef9c('0x1'));var BPromise=require(_0xef9c('0x2'));var rs=require(_0xef9c('0x3'));var fs=require('fs');var Redis=require(_0xef9c('0x4'));var db=require(_0xef9c('0x5'))['db'];var utils=require(_0xef9c('0x6'));var logger=require(_0xef9c('0x7'))(_0xef9c('0x8'));var config=require(_0xef9c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xef9c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x298014,_0x5e272b,_0x380089){return new BPromise(function(_0x470518,_0x76cd7){return client[_0xef9c('0xb')](_0x298014,_0x380089)[_0xef9c('0xc')](function(_0x5b2547){logger['info'](_0xef9c('0xd'),_0x5e272b,_0xef9c('0xe'));logger[_0xef9c('0xf')](_0xef9c('0x10'),_0x5e272b,_0xef9c('0xe'),JSON[_0xef9c('0x11')](_0x5b2547));if(_0x5b2547[_0xef9c('0x12')]){if(_0x5b2547[_0xef9c('0x12')][_0xef9c('0x13')]===0x1f4){logger['error'](_0xef9c('0xd'),_0x5e272b,_0x5b2547['error'][_0xef9c('0x14')]);return _0x76cd7(_0x5b2547[_0xef9c('0x12')][_0xef9c('0x14')]);}logger[_0xef9c('0x12')](_0xef9c('0xd'),_0x5e272b,_0x5b2547['error']['message']);return _0x470518(_0x5b2547[_0xef9c('0x12')]['message']);}else{logger['info']('Condition,\x20%s,\x20%s',_0x5e272b,_0xef9c('0xe'));_0x470518(_0x5b2547[_0xef9c('0x15')][_0xef9c('0x14')]);}})[_0xef9c('0x16')](function(_0x7ee7eb){logger['error'](_0xef9c('0xd'),_0x5e272b,_0x7ee7eb);_0x76cd7(_0x7ee7eb);});});} \ No newline at end of file +var _0xfb46=['../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xfb46,0x7e));var _0x6fb4=function(_0x43139e,_0x762629){_0x43139e=_0x43139e-0x0;var _0x2bc838=_0xfb46[_0x43139e];return _0x2bc838;};'use strict';var _=require(_0x6fb4('0x0'));var util=require(_0x6fb4('0x1'));var moment=require(_0x6fb4('0x2'));var BPromise=require(_0x6fb4('0x3'));var rs=require(_0x6fb4('0x4'));var fs=require('fs');var Redis=require(_0x6fb4('0x5'));var db=require(_0x6fb4('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6fb4('0x7'));var jayson=require(_0x6fb4('0x8'));var client=jayson[_0x6fb4('0x9')][_0x6fb4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c711f,_0xa508d4,_0x57678a){return new BPromise(function(_0x338c5c,_0xd0d233){return client[_0x6fb4('0xb')](_0x1c711f,_0x57678a)[_0x6fb4('0xc')](function(_0x1d200b){logger[_0x6fb4('0xd')](_0x6fb4('0xe'),_0xa508d4,'request\x20sent');logger[_0x6fb4('0xf')](_0x6fb4('0x10'),_0xa508d4,_0x6fb4('0x11'),JSON[_0x6fb4('0x12')](_0x1d200b));if(_0x1d200b['error']){if(_0x1d200b[_0x6fb4('0x13')][_0x6fb4('0x14')]===0x1f4){logger[_0x6fb4('0x13')](_0x6fb4('0xe'),_0xa508d4,_0x1d200b['error'][_0x6fb4('0x15')]);return _0xd0d233(_0x1d200b['error']['message']);}logger[_0x6fb4('0x13')]('Condition,\x20%s,\x20%s',_0xa508d4,_0x1d200b[_0x6fb4('0x13')]['message']);return _0x338c5c(_0x1d200b['error'][_0x6fb4('0x15')]);}else{logger[_0x6fb4('0xd')](_0x6fb4('0xe'),_0xa508d4,_0x6fb4('0x11'));_0x338c5c(_0x1d200b['result'][_0x6fb4('0x15')]);}})['catch'](function(_0x689083){logger[_0x6fb4('0x13')](_0x6fb4('0xe'),_0xa508d4,_0x689083);_0xd0d233(_0x689083);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 2abba81..d6a709f 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 _0xccad=['/:id','isAuthenticated','destroy','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','delete'];(function(_0x512f95,_0xbddd42){var _0x234f3d=function(_0x1f488e){while(--_0x1f488e){_0x512f95['push'](_0x512f95['shift']());}};_0x234f3d(++_0xbddd42);}(_0xccad,0x107));var _0xdcca=function(_0x2307fa,_0x266e5e){_0x2307fa=_0x2307fa-0x0;var _0x496486=_0xccad[_0x2307fa];return _0x496486;};'use strict';var multer=require('multer');var util=require(_0xdcca('0x0'));var path=require(_0xdcca('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdcca('0x2')]();var fs_extra=require(_0xdcca('0x3'));var auth=require(_0xdcca('0x4'));var interaction=require(_0xdcca('0x5'));var config=require(_0xdcca('0x6'));var controller=require(_0xdcca('0x7'));router[_0xdcca('0x8')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xdcca('0x9')](_0xdcca('0xa'),auth[_0xdcca('0xb')](),controller[_0xdcca('0xc')]);module['exports']=router; \ No newline at end of file +var _0x98ef=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','exports','multer','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x98ef,0x178));var _0xf98e=function(_0x32bd95,_0x63ccae){_0x32bd95=_0x32bd95-0x0;var _0x25e489=_0x98ef[_0x32bd95];return _0x25e489;};'use strict';var multer=require(_0xf98e('0x0'));var util=require(_0xf98e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf98e('0x2'));var router=express[_0xf98e('0x3')]();var fs_extra=require(_0xf98e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf98e('0x5'));var config=require(_0xf98e('0x6'));var controller=require(_0xf98e('0x7'));router[_0xf98e('0x8')](_0xf98e('0x9'),auth[_0xf98e('0xa')](),controller[_0xf98e('0xb')]);router[_0xf98e('0xc')](_0xf98e('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xf98e('0xd')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index f01a054..d286c45 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 _0xb10b=['name','sequelize','STRING'];(function(_0x10b1b3,_0x3d4d6e){var _0x4556c9=function(_0x42f676){while(--_0x42f676){_0x10b1b3['push'](_0x10b1b3['shift']());}};_0x4556c9(++_0x3d4d6e);}(_0xb10b,0x12a));var _0xbb10=function(_0x58999b,_0xea4695){_0x58999b=_0x58999b-0x0;var _0x5efc3a=_0xb10b[_0x58999b];return _0x5efc3a;};'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 +var _0x2032=['name','exports','STRING'];(function(_0x1c4c61,_0x3b8e7b){var _0x4f025e=function(_0x32d79d){while(--_0x32d79d){_0x1c4c61['push'](_0x1c4c61['shift']());}};_0x4f025e(++_0x3b8e7b);}(_0x2032,0xd9));var _0x2203=function(_0x244131,_0x26bae3){_0x244131=_0x244131-0x0;var _0x1e5a7d=_0x2032[_0x244131];return _0x1e5a7d;};'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 diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 62505fb..a1f5635 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 _0x70ab=['omit','body','updatedAt','attrs','custom','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','voice','attrOpenchannelAccounts','web-report','reportType','attrReport','attrRefresh','stringify','DashboardId','DashboardItem','findOne','getItems','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','mustache','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','CustomDashboards','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','length','includeAll','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x135b26,_0x55cf7e){var _0x2170f7=function(_0x12b4a3){while(--_0x12b4a3){_0x135b26['push'](_0x135b26['shift']());}};_0x2170f7(++_0x55cf7e);}(_0x70ab,0x11f));var _0xb70a=function(_0x7c4840,_0x43dc5c){_0x7c4840=_0x7c4840-0x0;var _0x1a19a5=_0x70ab[_0x7c4840];return _0x1a19a5;};'use strict';var emlformat=require(_0xb70a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb70a('0x1'));var jsonpatch=require(_0xb70a('0x2'));var rp=require(_0xb70a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb70a('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xb70a('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb70a('0x6'));var squel=require(_0xb70a('0x7'));var crypto=require('crypto');var jsforce=require(_0xb70a('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xb70a('0x5'));var querystring=require(_0xb70a('0x9'));var Papa=require(_0xb70a('0xa'));var Redis=require(_0xb70a('0xb'));var authService=require(_0xb70a('0xc'));var qs=require(_0xb70a('0xd'));var as=require(_0xb70a('0xe'));var hardwareService=require(_0xb70a('0xf'));var logger=require(_0xb70a('0x10'))(_0xb70a('0x11'));var utils=require(_0xb70a('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xb70a('0x13'));var db=require(_0xb70a('0x14'))['db'];config[_0xb70a('0x15')]=_[_0xb70a('0x16')](config['redis'],{'host':_0xb70a('0x17'),'port':0x18eb});var socket=require(_0xb70a('0x18'))(new Redis(config[_0xb70a('0x15')]));require('./dashboard.socket')[_0xb70a('0x19')](socket);function respondWithStatusCode(_0x36134f,_0x578b17){_0x578b17=_0x578b17||0xcc;return function(_0x3c76a7){if(_0x3c76a7){return _0x36134f[_0xb70a('0x1a')](_0x578b17);}return _0x36134f[_0xb70a('0x1b')](_0x578b17)[_0xb70a('0x1c')]();};}function respondWithResult(_0x329831,_0x537991){_0x537991=_0x537991||0xc8;return function(_0x37e781){if(_0x37e781){return _0x329831['status'](_0x537991)[_0xb70a('0x1d')](_0x37e781);}};}function respondWithFilteredResult(_0x141dfa,_0x26f698){return function(_0x29e782){if(_0x29e782){var _0x3d87ec=typeof _0x26f698[_0xb70a('0x1e')]===_0xb70a('0x1f')&&typeof _0x26f698[_0xb70a('0x20')]===_0xb70a('0x1f');var _0x2a0fe6=_0x29e782['count'];var _0x16935d=_0x3d87ec?0x0:_0x26f698[_0xb70a('0x1e')];var _0xfcb9ab=_0x3d87ec?_0x29e782[_0xb70a('0x21')]:_0x26f698[_0xb70a('0x1e')]+_0x26f698[_0xb70a('0x20')];var _0x22c07d;if(_0xfcb9ab>=_0x2a0fe6){_0xfcb9ab=_0x2a0fe6;_0x22c07d=0xc8;}else{_0x22c07d=0xce;}_0x141dfa['status'](_0x22c07d);return _0x141dfa[_0xb70a('0x22')](_0xb70a('0x23'),_0x16935d+'-'+_0xfcb9ab+'/'+_0x2a0fe6)[_0xb70a('0x1d')](_0x29e782);}return null;};}function patchUpdates(_0xb503f6){return function(_0xd30113){try{jsonpatch[_0xb70a('0x24')](_0xd30113,_0xb503f6,!![]);}catch(_0x5a2978){return BPromise[_0xb70a('0x25')](_0x5a2978);}return _0xd30113[_0xb70a('0x26')]();};}function saveUpdates(_0x442d9e,_0x5a3fa1){return function(_0x3e9e33){if(_0x3e9e33){return _0x3e9e33[_0xb70a('0x27')](_0x442d9e)[_0xb70a('0x28')](function(_0x33a83c){return _0x33a83c;});}return null;};}function removeEntity(_0x2d1abf,_0x525c4b){return function(_0x253ec7){if(_0x253ec7){return _0x253ec7[_0xb70a('0x29')]()[_0xb70a('0x28')](function(){var _0x3549c5=_0x253ec7['get']({'plain':!![]});var _0x336e88=_0xb70a('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x336e88,'resourceId':_0x3549c5['id']}})[_0xb70a('0x28')](function(){return _0x253ec7;});})['then'](function(){_0x2d1abf[_0xb70a('0x1b')](0xcc)[_0xb70a('0x1c')]();});}};}function handleEntityNotFound(_0x3a374c,_0x5e4686){return function(_0x48f495){if(!_0x48f495){_0x3a374c[_0xb70a('0x1a')](0x194);}return _0x48f495;};}function handleError(_0x5f0c12,_0x147d65){_0x147d65=_0x147d65||0x1f4;return function(_0x3b2985){logger[_0xb70a('0x2b')](_0x3b2985[_0xb70a('0x2c')]);if(_0x3b2985['name']){delete _0x3b2985[_0xb70a('0x2d')];}_0x5f0c12[_0xb70a('0x1b')](_0x147d65)[_0xb70a('0x2e')](_0x3b2985);};}exports[_0xb70a('0x2f')]=function(_0x5b4926,_0xb1b263){var _0x5bb46e={},_0x922bb={},_0x248750={'count':0x0,'rows':[]};var _0x5a2139=_[_0xb70a('0x30')](db[_0xb70a('0x31')][_0xb70a('0x32')],function(_0x5b3b1e){return{'name':_0x5b3b1e[_0xb70a('0x33')],'type':_0x5b3b1e[_0xb70a('0x34')][_0xb70a('0x35')]};});_0x922bb[_0xb70a('0x36')]=_[_0xb70a('0x30')](_0x5a2139,_0xb70a('0x2d'));_0x922bb[_0xb70a('0x37')]=_[_0xb70a('0x38')](_0x5b4926[_0xb70a('0x37')]);_0x922bb[_0xb70a('0x39')]=_[_0xb70a('0x3a')](_0x922bb[_0xb70a('0x36')],_0x922bb[_0xb70a('0x37')]);_0x5bb46e[_0xb70a('0x3b')]=_[_0xb70a('0x3a')](_0x922bb[_0xb70a('0x36')],qs[_0xb70a('0x3c')](_0x5b4926[_0xb70a('0x37')][_0xb70a('0x3c')]));_0x5bb46e['attributes']=_0x5bb46e[_0xb70a('0x3b')]['length']?_0x5bb46e[_0xb70a('0x3b')]:_0x922bb[_0xb70a('0x36')];if(!_0x5b4926[_0xb70a('0x37')][_0xb70a('0x3d')]('nolimit')){_0x5bb46e[_0xb70a('0x20')]=qs['limit'](_0x5b4926[_0xb70a('0x37')][_0xb70a('0x20')]);_0x5bb46e[_0xb70a('0x1e')]=qs['offset'](_0x5b4926[_0xb70a('0x37')]['offset']);}_0x5bb46e[_0xb70a('0x3e')]=qs[_0xb70a('0x3f')](_0x5b4926['query'][_0xb70a('0x3f')]);_0x5bb46e[_0xb70a('0x40')]=qs[_0xb70a('0x39')](_[_0xb70a('0x41')](_0x5b4926[_0xb70a('0x37')],_0x922bb[_0xb70a('0x39')]),_0x5a2139);if(_0x5b4926['query'][_0xb70a('0x42')]){_0x5bb46e['where']=_[_0xb70a('0x43')](_0x5bb46e[_0xb70a('0x40')],{'$or':_[_0xb70a('0x30')](_0x5a2139,function(_0x4fa74f){if(_0x4fa74f[_0xb70a('0x34')]!==_0xb70a('0x44')){var _0x537e90={};_0x537e90[_0x4fa74f[_0xb70a('0x2d')]]={'$like':'%'+_0x5b4926[_0xb70a('0x37')][_0xb70a('0x42')]+'%'};return _0x537e90;}})});}_0x5bb46e=_[_0xb70a('0x43')]({},_0x5bb46e,_0x5b4926[_0xb70a('0x45')]);var _0x15f992={'where':_0x5bb46e[_0xb70a('0x40')]};return db[_0xb70a('0x31')][_0xb70a('0x21')](_0x15f992)[_0xb70a('0x28')](function(_0x52109a){_0x248750[_0xb70a('0x21')]=_0x52109a;if(_0x5b4926[_0xb70a('0x37')]['includeAll']){_0x5bb46e[_0xb70a('0x46')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x5bb46e);})[_0xb70a('0x28')](function(_0x31d29a){_0x248750[_0xb70a('0x47')]=_0x31d29a;return _0x248750;})[_0xb70a('0x28')](respondWithFilteredResult(_0xb1b263,_0x5bb46e))[_0xb70a('0x48')](handleError(_0xb1b263,null));};exports[_0xb70a('0x49')]=function(_0x3c6a88,_0xf90dd3){var _0x24aaee={'raw':![],'where':{'id':_0x3c6a88[_0xb70a('0x4a')]['id']}},_0x2f2168={};_0x2f2168['model']=_[_0xb70a('0x38')](db['Dashboard'][_0xb70a('0x32')]);_0x2f2168[_0xb70a('0x37')]=_[_0xb70a('0x38')](_0x3c6a88['query']);_0x2f2168[_0xb70a('0x39')]=_[_0xb70a('0x3a')](_0x2f2168[_0xb70a('0x36')],_0x2f2168[_0xb70a('0x37')]);_0x24aaee[_0xb70a('0x3b')]=_[_0xb70a('0x3a')](_0x2f2168[_0xb70a('0x36')],qs[_0xb70a('0x3c')](_0x3c6a88[_0xb70a('0x37')][_0xb70a('0x3c')]));_0x24aaee[_0xb70a('0x3b')]=_0x24aaee[_0xb70a('0x3b')][_0xb70a('0x4b')]?_0x24aaee[_0xb70a('0x3b')]:_0x2f2168['model'];if(_0x3c6a88[_0xb70a('0x37')][_0xb70a('0x4c')]){_0x24aaee['include']=[{'all':!![]}];}_0x24aaee=_['merge']({},_0x24aaee,_0x3c6a88[_0xb70a('0x45')]);return db[_0xb70a('0x31')]['find'](_0x24aaee)[_0xb70a('0x28')](handleEntityNotFound(_0xf90dd3,null))['then'](respondWithResult(_0xf90dd3,null))[_0xb70a('0x48')](handleError(_0xf90dd3,null));};exports[_0xb70a('0x4d')]=function(_0x4876fb,_0x5a7b73){return db[_0xb70a('0x31')][_0xb70a('0x4d')](_0x4876fb['body'],{})[_0xb70a('0x28')](function(_0x5715e1){var _0x251f1b=_0x4876fb['user'][_0xb70a('0x4e')]({'plain':!![]});if(!_0x251f1b)throw new Error(_0xb70a('0x4f'));if(_0x251f1b[_0xb70a('0x50')]===_0xb70a('0x51')){var _0x2599bf=_0x5715e1['get']({'plain':!![]});var _0x5a03e6=_0xb70a('0x2a');return db[_0xb70a('0x52')][_0xb70a('0x53')]({'where':{'name':_0x5a03e6,'userProfileId':_0x251f1b[_0xb70a('0x54')]},'raw':!![]})['then'](function(_0x1fc3fb){if(_0x1fc3fb&&_0x1fc3fb[_0xb70a('0x55')]===0x0){return db[_0xb70a('0x56')][_0xb70a('0x4d')]({'name':_0x2599bf[_0xb70a('0x2d')],'resourceId':_0x2599bf['id'],'type':_0x1fc3fb['name'],'sectionId':_0x1fc3fb['id']},{})[_0xb70a('0x28')](function(){return _0x5715e1;});}else{return _0x5715e1;}})['catch'](function(_0x57453c){logger['error'](_0xb70a('0x57'),_0x57453c);throw _0x57453c;});}return _0x5715e1;})[_0xb70a('0x28')](respondWithResult(_0x5a7b73,0xc9))['catch'](handleError(_0x5a7b73,null));};exports['clone']=function(_0x3774f1,_0x54f9ce){var _0x364b72={'where':{'id':_0x3774f1[_0xb70a('0x4a')]['id']}},_0x83823c={};_0x83823c[_0xb70a('0x36')]=_['keys'](db[_0xb70a('0x31')]['rawAttributes']);_0x364b72[_0xb70a('0x3b')]=_[_0xb70a('0x3a')](_0x83823c['model'],qs[_0xb70a('0x3c')](_0x3774f1[_0xb70a('0x37')][_0xb70a('0x3c')]));_0x364b72[_0xb70a('0x3b')]=_0x364b72['attributes'][_0xb70a('0x4b')]?_0x364b72[_0xb70a('0x3b')]:_0x83823c['model'];if(_0x3774f1[_0xb70a('0x37')][_0xb70a('0x4c')]){_0x364b72[_0xb70a('0x46')]=[{'all':!![]}];}_0x364b72=_[_0xb70a('0x43')]({},_0x364b72,_0x3774f1[_0xb70a('0x45')]);return db[_0xb70a('0x31')][_0xb70a('0x53')](_0x364b72)[_0xb70a('0x28')](handleEntityNotFound(_0x54f9ce,null))[_0xb70a('0x28')](function(_0x29de77){if(_0x29de77){var _0x466a86=_0x29de77[_0xb70a('0x4e')]({'plain':!![]});_0x466a86=qs[_0xb70a('0x58')](_0x466a86,['id','createdAt','updatedAt']);_0x3774f1[_0xb70a('0x59')]=_[_0xb70a('0x58')](_0x3774f1[_0xb70a('0x59')],['id','createdAt',_0xb70a('0x5a')]);return db[_0xb70a('0x31')]['create'](_['merge'](_0x466a86,_0x3774f1[_0xb70a('0x59')]),{'include':_0x3774f1[_0xb70a('0x37')]['includeAll']?[{'all':!![]}]:undefined})[_0xb70a('0x28')](function(_0x84d2da){var _0xafbdb8=_0x3774f1[_0xb70a('0x51')][_0xb70a('0x4e')]({'plain':!![]});if(!_0xafbdb8)throw new Error(_0xb70a('0x4f'));if(_0xafbdb8['role']===_0xb70a('0x51')){var _0x1fb76a=_0x84d2da[_0xb70a('0x4e')]({'plain':!![]});var _0x3304b2=_0xb70a('0x2a');return db[_0xb70a('0x52')][_0xb70a('0x53')]({'where':{'name':_0x3304b2,'userProfileId':_0xafbdb8['userProfileId']},'raw':!![]})[_0xb70a('0x28')](function(_0x29fe73){if(_0x29fe73&&_0x29fe73['autoAssociation']===0x0){return db[_0xb70a('0x56')]['create']({'name':_0x1fb76a[_0xb70a('0x2d')],'resourceId':_0x1fb76a['id'],'type':_0x29fe73[_0xb70a('0x2d')],'sectionId':_0x29fe73['id']},{})[_0xb70a('0x28')](function(){return _0x84d2da;});}else{return _0x84d2da;}})[_0xb70a('0x48')](function(_0x23b6e2){logger[_0xb70a('0x2b')](_0xb70a('0x57'),_0x23b6e2);throw _0x23b6e2;});}return _0x84d2da;});}})[_0xb70a('0x28')](respondWithResult(_0x54f9ce,0xc9))[_0xb70a('0x48')](handleError(_0x54f9ce,null));};exports[_0xb70a('0x27')]=function(_0xeb93cc,_0x79671b){if(_0xeb93cc[_0xb70a('0x59')]['id']){delete _0xeb93cc[_0xb70a('0x59')]['id'];}return db[_0xb70a('0x31')][_0xb70a('0x53')]({'where':{'id':_0xeb93cc[_0xb70a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x79671b,null))[_0xb70a('0x28')](saveUpdates(_0xeb93cc[_0xb70a('0x59')],null))[_0xb70a('0x28')](respondWithResult(_0x79671b,null))[_0xb70a('0x48')](handleError(_0x79671b,null));};exports[_0xb70a('0x29')]=function(_0x371d8e,_0x4dffc8){return db[_0xb70a('0x31')][_0xb70a('0x53')]({'where':{'id':_0x371d8e[_0xb70a('0x4a')]['id']}})[_0xb70a('0x28')](handleEntityNotFound(_0x4dffc8,null))['then'](removeEntity(_0x4dffc8,null))[_0xb70a('0x48')](handleError(_0x4dffc8,null));};function widgetAttributes(_0x4a6039){try{switch(_0x4a6039['type']){case'iframe':return[{'name':'attrUrl','value':_0x4a6039['attrUrl']||(_0x4a6039[_0xb70a('0x5b')]&&_0x4a6039['attrs'][0x0]?_0x4a6039[_0xb70a('0x5b')][0x0]['value']:undefined)||'https://'}];case _0xb70a('0x5c'):return[{'name':_0xb70a('0x5d'),'value':_0x4a6039[_0xb70a('0x5d')]||(_0x4a6039[_0xb70a('0x5b')]&&_0x4a6039[_0xb70a('0x5b')][0x0]?_0x4a6039[_0xb70a('0x5b')][0x0][_0xb70a('0x5e')]:undefined)||''}];case'clock':return[{'name':_0xb70a('0x5f'),'value':_0x4a6039['attrHourFormat']||(_0x4a6039[_0xb70a('0x5b')]&&_0x4a6039[_0xb70a('0x5b')][0x0]?_0x4a6039['attrs'][0x0][_0xb70a('0x5e')]:undefined)||_0xb70a('0x60')},{'name':_0xb70a('0x61'),'value':_0x4a6039['attrTimezone']||(_0x4a6039[_0xb70a('0x5b')]&&_0x4a6039[_0xb70a('0x5b')][0x1]?_0x4a6039[_0xb70a('0x5b')][0x1][_0xb70a('0x5e')]:undefined)||_0xb70a('0x62')},{'name':'attrFontSize','value':_0x4a6039[_0xb70a('0x63')]||(_0x4a6039[_0xb70a('0x5b')]&&_0x4a6039[_0xb70a('0x5b')][0x2]?_0x4a6039[_0xb70a('0x5b')][0x2][_0xb70a('0x5e')]:undefined)||0xc}];case _0xb70a('0x64'):return[{'name':_0xb70a('0x65'),'value':_0x4a6039[_0xb70a('0x65')]||(_0x4a6039['attrs']&&_0x4a6039[_0xb70a('0x5b')][0x0]?_0x4a6039[_0xb70a('0x5b')][0x0][_0xb70a('0x5e')]:undefined)||_0xb70a('0x66')},{'name':'attrVoiceQueues','value':_0x4a6039[_0xb70a('0x67')]||(_0x4a6039[_0xb70a('0x5b')]&&_0x4a6039[_0xb70a('0x5b')][0x1]?_0x4a6039[_0xb70a('0x5b')][0x1]['value']:undefined)||[]},{'name':_0xb70a('0x63'),'value':_0x4a6039['attrFontSize']||(_0x4a6039[_0xb70a('0x5b')]&&_0x4a6039[_0xb70a('0x5b')][0x2]?_0x4a6039[_0xb70a('0x5b')][0x2][_0xb70a('0x5e')]:undefined)||0x14},{'name':_0xb70a('0x68'),'value':_0x4a6039[_0xb70a('0x68')]||(_0x4a6039[_0xb70a('0x5b')]&&_0x4a6039[_0xb70a('0x5b')][0x3]?_0x4a6039['attrs'][0x3]['value']:undefined)||'voice'},{'name':_0xb70a('0x69'),'value':_0x4a6039[_0xb70a('0x69')]||(_0x4a6039[_0xb70a('0x5b')]&&_0x4a6039['attrs'][0x4]?_0x4a6039[_0xb70a('0x5b')][0x4][_0xb70a('0x5e')]:undefined)||''},{'name':_0xb70a('0x6a'),'value':_0x4a6039['attrFaxAccounts']||(_0x4a6039[_0xb70a('0x5b')]&&_0x4a6039[_0xb70a('0x5b')][0x5]?_0x4a6039[_0xb70a('0x5b')][0x5][_0xb70a('0x5e')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x4a6039[_0xb70a('0x6b')]||(_0x4a6039[_0xb70a('0x5b')]&&_0x4a6039[_0xb70a('0x5b')][0x6]?_0x4a6039['attrs'][0x6][_0xb70a('0x5e')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4a6039['attrOpenchannelAccounts']||(_0x4a6039['attrs']&&_0x4a6039[_0xb70a('0x5b')][0x7]?_0x4a6039[_0xb70a('0x5b')][0x7][_0xb70a('0x5e')]:undefined)||''},{'name':_0xb70a('0x6c'),'value':_0x4a6039[_0xb70a('0x6c')]||(_0x4a6039[_0xb70a('0x5b')]&&_0x4a6039[_0xb70a('0x5b')][0x8]?_0x4a6039[_0xb70a('0x5b')][0x8][_0xb70a('0x5e')]:undefined)||''},{'name':'attrChatWebsites','value':_0x4a6039[_0xb70a('0x6d')]||(_0x4a6039[_0xb70a('0x5b')]&&_0x4a6039[_0xb70a('0x5b')][0x9]?_0x4a6039[_0xb70a('0x5b')][0x9][_0xb70a('0x5e')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':'attrSerie1','value':_0x4a6039[_0xb70a('0x6e')]||(_0x4a6039[_0xb70a('0x5b')]&&_0x4a6039[_0xb70a('0x5b')][0x0]?_0x4a6039['attrs'][0x0]['value']:undefined)||_0xb70a('0x66')},{'name':_0xb70a('0x6f'),'value':_0x4a6039[_0xb70a('0x6f')]||(_0x4a6039['attrs']&&_0x4a6039[_0xb70a('0x5b')][0x1]?_0x4a6039['attrs'][0x1][_0xb70a('0x5e')]:undefined)||null},{'name':'attrSerie3','value':_0x4a6039[_0xb70a('0x70')]||(_0x4a6039[_0xb70a('0x5b')]&&_0x4a6039[_0xb70a('0x5b')][0x2]?_0x4a6039['attrs'][0x2][_0xb70a('0x5e')]:undefined)||null},{'name':_0xb70a('0x67'),'value':_0x4a6039[_0xb70a('0x67')]||(_0x4a6039[_0xb70a('0x5b')]&&_0x4a6039[_0xb70a('0x5b')][0x3]?_0x4a6039[_0xb70a('0x5b')][0x3][_0xb70a('0x5e')]:undefined)||[]},{'name':'attrChannel','value':_0x4a6039[_0xb70a('0x68')]||(_0x4a6039[_0xb70a('0x5b')]&&_0x4a6039[_0xb70a('0x5b')][0x4]?_0x4a6039[_0xb70a('0x5b')][0x4][_0xb70a('0x5e')]:undefined)||_0xb70a('0x71')},{'name':_0xb70a('0x69'),'value':_0x4a6039[_0xb70a('0x69')]||(_0x4a6039[_0xb70a('0x5b')]&&_0x4a6039[_0xb70a('0x5b')][0x5]?_0x4a6039[_0xb70a('0x5b')][0x5][_0xb70a('0x5e')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x4a6039[_0xb70a('0x6a')]||(_0x4a6039['attrs']&&_0x4a6039[_0xb70a('0x5b')][0x6]?_0x4a6039[_0xb70a('0x5b')][0x6][_0xb70a('0x5e')]:undefined)||''},{'name':_0xb70a('0x6b'),'value':_0x4a6039[_0xb70a('0x6b')]||(_0x4a6039[_0xb70a('0x5b')]&&_0x4a6039['attrs'][0x7]?_0x4a6039[_0xb70a('0x5b')][0x7][_0xb70a('0x5e')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4a6039[_0xb70a('0x72')]||(_0x4a6039[_0xb70a('0x5b')]&&_0x4a6039[_0xb70a('0x5b')][0x8]?_0x4a6039[_0xb70a('0x5b')][0x8]['value']:undefined)||''},{'name':_0xb70a('0x6c'),'value':_0x4a6039[_0xb70a('0x6c')]||(_0x4a6039[_0xb70a('0x5b')]&&_0x4a6039['attrs'][0x9]?_0x4a6039[_0xb70a('0x5b')][0x9]['value']:undefined)||''},{'name':_0xb70a('0x6d'),'value':_0x4a6039[_0xb70a('0x6d')]||(_0x4a6039[_0xb70a('0x5b')]&&_0x4a6039['attrs'][0xa]?_0x4a6039['attrs'][0xa][_0xb70a('0x5e')]:undefined)||''}];case _0xb70a('0x73'):return[{'name':'attrReport','type':_0x4a6039[_0xb70a('0x74')]||(_0x4a6039[_0xb70a('0x5b')]&&_0x4a6039[_0xb70a('0x5b')][0x0]?_0x4a6039[_0xb70a('0x5b')][0x0]['type']:undefined)||null,'value':_0x4a6039[_0xb70a('0x75')]||(_0x4a6039[_0xb70a('0x5b')]&&_0x4a6039['attrs'][0x0]?_0x4a6039[_0xb70a('0x5b')][0x0]['value']:undefined)||null},{'name':_0xb70a('0x76'),'value':_0x4a6039[_0xb70a('0x76')]||(_0x4a6039[_0xb70a('0x5b')]&&_0x4a6039[_0xb70a('0x5b')][0x1]?_0x4a6039[_0xb70a('0x5b')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x5b5229){logger[_0xb70a('0x2b')]('widgetAttributes:\x20%s',JSON[_0xb70a('0x77')](_0x5b5229));return[];}}exports['addItem']=function(_0x137076,_0x542e69,_0x5f2c38){if(_0x137076[_0xb70a('0x59')]['id']){delete _0x137076[_0xb70a('0x59')]['id'];}return db['Dashboard'][_0xb70a('0x53')]({'where':{'id':_0x137076[_0xb70a('0x4a')]['id']}})[_0xb70a('0x28')](handleEntityNotFound(_0x542e69,null))['then'](function(_0x1b8e77){if(_0x1b8e77){_0x137076[_0xb70a('0x59')][_0xb70a('0x78')]=_0x1b8e77['id'];_0x137076['body'][_0xb70a('0x5b')]=widgetAttributes(_0x137076[_0xb70a('0x59')]);return db[_0xb70a('0x79')][_0xb70a('0x4d')](_0x137076[_0xb70a('0x59')]);}})['then'](respondWithResult(_0x542e69,null))[_0xb70a('0x48')](handleError(_0x542e69,null));};exports['getItems']=function(_0x3d2c0f,_0x2b08d5,_0x2dec27){var _0x24052d={};var _0x2631b2={};var _0x8340ab;var _0x2fb5b5;return db[_0xb70a('0x31')][_0xb70a('0x7a')]({'where':{'id':_0x3d2c0f[_0xb70a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2b08d5,null))[_0xb70a('0x28')](function(_0x299c97){if(_0x299c97){_0x8340ab=_0x299c97;_0x2631b2['model']=_['keys'](db['DashboardItem'][_0xb70a('0x32')]);_0x2631b2[_0xb70a('0x37')]=_['keys'](_0x3d2c0f[_0xb70a('0x37')]);_0x2631b2[_0xb70a('0x39')]=_[_0xb70a('0x3a')](_0x2631b2['model'],_0x2631b2['query']);_0x24052d['attributes']=_[_0xb70a('0x3a')](_0x2631b2[_0xb70a('0x36')],qs['fields'](_0x3d2c0f[_0xb70a('0x37')][_0xb70a('0x3c')]));_0x24052d[_0xb70a('0x3b')]=_0x24052d['attributes'][_0xb70a('0x4b')]?_0x24052d[_0xb70a('0x3b')]:_0x2631b2[_0xb70a('0x36')];_0x24052d['order']=qs[_0xb70a('0x3f')](_0x3d2c0f[_0xb70a('0x37')][_0xb70a('0x3f')]);_0x24052d[_0xb70a('0x40')]=qs['filters'](_[_0xb70a('0x41')](_0x3d2c0f[_0xb70a('0x37')],_0x2631b2[_0xb70a('0x39')]));if(_0x3d2c0f[_0xb70a('0x37')][_0xb70a('0x42')]){_0x24052d[_0xb70a('0x40')]=_['merge'](_0x24052d['where'],{'$or':_['map'](_0x24052d[_0xb70a('0x3b')],function(_0x23c91b){var _0xc7e1e6={};_0xc7e1e6[_0x23c91b]={'$like':'%'+_0x3d2c0f[_0xb70a('0x37')][_0xb70a('0x42')]+'%'};return _0xc7e1e6;})});}_0x24052d=_['merge']({},_0x24052d,_0x3d2c0f[_0xb70a('0x45')]);return _0x8340ab[_0xb70a('0x7b')](_0x24052d);}})[_0xb70a('0x28')](function(_0x125d87){if(_0x125d87){_0x2fb5b5=_0x125d87[_0xb70a('0x4b')];if(!_0x3d2c0f[_0xb70a('0x37')][_0xb70a('0x3d')](_0xb70a('0x7c'))){_0x24052d['limit']=qs[_0xb70a('0x20')](_0x3d2c0f['query'][_0xb70a('0x20')]);_0x24052d['offset']=qs['offset'](_0x3d2c0f[_0xb70a('0x37')][_0xb70a('0x1e')]);}return _0x8340ab['getItems'](_0x24052d);}})['then'](function(_0x43f887){if(_0x43f887){return _0x43f887?{'count':_0x2fb5b5,'rows':_0x43f887}:null;}})['then'](respondWithResult(_0x2b08d5,null))[_0xb70a('0x48')](handleError(_0x2b08d5,null));}; \ No newline at end of file +var _0xbe41=['zip-dir','fast-json-patch','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','status','end','offset','undefined','limit','count','Content-Range','apply','save','destroy','then','get','UserProfileResource','sendStatus','error','stack','name','send','index','Dashboard','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','UserProfileSection','userProfileId','update','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie2','attrSerie3','attrOpenchannelAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','DashboardItem','findOne','getItems','hasOwnProperty','nolimit','rimraf'];(function(_0x309458,_0xba6e63){var _0x3306ee=function(_0x47e10c){while(--_0x47e10c){_0x309458['push'](_0x309458['shift']());}};_0x3306ee(++_0xba6e63);}(_0xbe41,0x173));var _0x1be4=function(_0x59924d,_0x1dd2fa){_0x59924d=_0x59924d-0x0;var _0xe4e92e=_0xbe41[_0x59924d];return _0xe4e92e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1be4('0x0'));var zipdir=require(_0x1be4('0x1'));var jsonpatch=require(_0x1be4('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1be4('0x3'));var util=require('util');var path=require(_0x1be4('0x4'));var sox=require('sox');var csv=require(_0x1be4('0x5'));var ejs=require(_0x1be4('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1be4('0x7'));var squel=require('squel');var crypto=require(_0x1be4('0x8'));var jsforce=require(_0x1be4('0x9'));var deskjs=require(_0x1be4('0xa'));var toCsv=require('to-csv');var querystring=require(_0x1be4('0xb'));var Papa=require(_0x1be4('0xc'));var Redis=require(_0x1be4('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x1be4('0xe'));var as=require(_0x1be4('0xf'));var hardwareService=require(_0x1be4('0x10'));var logger=require(_0x1be4('0x11'))(_0x1be4('0x12'));var utils=require('../../config/utils');var config=require(_0x1be4('0x13'));var licenseUtil=require(_0x1be4('0x14'));var db=require('../../mysqldb')['db'];config[_0x1be4('0x15')]=_[_0x1be4('0x16')](config['redis'],{'host':_0x1be4('0x17'),'port':0x18eb});var socket=require(_0x1be4('0x18'))(new Redis(config['redis']));require('./dashboard.socket')[_0x1be4('0x19')](socket);function respondWithStatusCode(_0x270399,_0xd359b4){_0xd359b4=_0xd359b4||0xcc;return function(_0x3f12ad){if(_0x3f12ad){return _0x270399['sendStatus'](_0xd359b4);}return _0x270399[_0x1be4('0x1a')](_0xd359b4)[_0x1be4('0x1b')]();};}function respondWithResult(_0x11bffb,_0x2d41d8){_0x2d41d8=_0x2d41d8||0xc8;return function(_0x3a3a7c){if(_0x3a3a7c){return _0x11bffb[_0x1be4('0x1a')](_0x2d41d8)['json'](_0x3a3a7c);}};}function respondWithFilteredResult(_0x17d461,_0x891220){return function(_0x29c824){if(_0x29c824){var _0x1d07c2=typeof _0x891220[_0x1be4('0x1c')]===_0x1be4('0x1d')&&typeof _0x891220[_0x1be4('0x1e')]===_0x1be4('0x1d');var _0x5728b9=_0x29c824[_0x1be4('0x1f')];var _0x18f97c=_0x1d07c2?0x0:_0x891220[_0x1be4('0x1c')];var _0x15d1aa=_0x1d07c2?_0x29c824[_0x1be4('0x1f')]:_0x891220[_0x1be4('0x1c')]+_0x891220[_0x1be4('0x1e')];var _0x180f75;if(_0x15d1aa>=_0x5728b9){_0x15d1aa=_0x5728b9;_0x180f75=0xc8;}else{_0x180f75=0xce;}_0x17d461[_0x1be4('0x1a')](_0x180f75);return _0x17d461['set'](_0x1be4('0x20'),_0x18f97c+'-'+_0x15d1aa+'/'+_0x5728b9)['json'](_0x29c824);}return null;};}function patchUpdates(_0x2711a4){return function(_0x5aeead){try{jsonpatch[_0x1be4('0x21')](_0x5aeead,_0x2711a4,!![]);}catch(_0x4c4683){return BPromise['reject'](_0x4c4683);}return _0x5aeead[_0x1be4('0x22')]();};}function saveUpdates(_0xbe030,_0x510ac3){return function(_0x4e4d64){if(_0x4e4d64){return _0x4e4d64['update'](_0xbe030)['then'](function(_0x10a862){return _0x10a862;});}return null;};}function removeEntity(_0x29e24e,_0x57165a){return function(_0x5a78f3){if(_0x5a78f3){return _0x5a78f3[_0x1be4('0x23')]()[_0x1be4('0x24')](function(){var _0x51a634=_0x5a78f3[_0x1be4('0x25')]({'plain':!![]});var _0x1511ab='CustomDashboards';return db[_0x1be4('0x26')]['destroy']({'where':{'type':_0x1511ab,'resourceId':_0x51a634['id']}})[_0x1be4('0x24')](function(){return _0x5a78f3;});})[_0x1be4('0x24')](function(){_0x29e24e['status'](0xcc)[_0x1be4('0x1b')]();});}};}function handleEntityNotFound(_0x37612e,_0x48d657){return function(_0x525c80){if(!_0x525c80){_0x37612e[_0x1be4('0x27')](0x194);}return _0x525c80;};}function handleError(_0x1e5acd,_0x16fe40){_0x16fe40=_0x16fe40||0x1f4;return function(_0x3c8a96){logger[_0x1be4('0x28')](_0x3c8a96[_0x1be4('0x29')]);if(_0x3c8a96[_0x1be4('0x2a')]){delete _0x3c8a96[_0x1be4('0x2a')];}_0x1e5acd['status'](_0x16fe40)[_0x1be4('0x2b')](_0x3c8a96);};}exports[_0x1be4('0x2c')]=function(_0x445b9c,_0x18b320){var _0x130935={},_0x56b9ed={},_0x2e19e8={'count':0x0,'rows':[]};var _0x363114=_['map'](db[_0x1be4('0x2d')][_0x1be4('0x2e')],function(_0xe5e002){return{'name':_0xe5e002[_0x1be4('0x2f')],'type':_0xe5e002['type'][_0x1be4('0x30')]};});_0x56b9ed[_0x1be4('0x31')]=_[_0x1be4('0x32')](_0x363114,_0x1be4('0x2a'));_0x56b9ed[_0x1be4('0x33')]=_[_0x1be4('0x34')](_0x445b9c[_0x1be4('0x33')]);_0x56b9ed[_0x1be4('0x35')]=_['intersection'](_0x56b9ed[_0x1be4('0x31')],_0x56b9ed['query']);_0x130935['attributes']=_[_0x1be4('0x36')](_0x56b9ed[_0x1be4('0x31')],qs[_0x1be4('0x37')](_0x445b9c[_0x1be4('0x33')][_0x1be4('0x37')]));_0x130935[_0x1be4('0x38')]=_0x130935[_0x1be4('0x38')][_0x1be4('0x39')]?_0x130935[_0x1be4('0x38')]:_0x56b9ed['model'];if(!_0x445b9c[_0x1be4('0x33')]['hasOwnProperty']('nolimit')){_0x130935[_0x1be4('0x1e')]=qs[_0x1be4('0x1e')](_0x445b9c[_0x1be4('0x33')][_0x1be4('0x1e')]);_0x130935[_0x1be4('0x1c')]=qs['offset'](_0x445b9c[_0x1be4('0x33')][_0x1be4('0x1c')]);}_0x130935['order']=qs[_0x1be4('0x3a')](_0x445b9c[_0x1be4('0x33')]['sort']);_0x130935[_0x1be4('0x3b')]=qs[_0x1be4('0x35')](_[_0x1be4('0x3c')](_0x445b9c[_0x1be4('0x33')],_0x56b9ed[_0x1be4('0x35')]),_0x363114);if(_0x445b9c['query']['filter']){_0x130935[_0x1be4('0x3b')]=_[_0x1be4('0x3d')](_0x130935['where'],{'$or':_['map'](_0x363114,function(_0x1504d2){if(_0x1504d2[_0x1be4('0x3e')]!==_0x1be4('0x3f')){var _0x59a307={};_0x59a307[_0x1504d2[_0x1be4('0x2a')]]={'$like':'%'+_0x445b9c[_0x1be4('0x33')][_0x1be4('0x40')]+'%'};return _0x59a307;}})});}_0x130935=_[_0x1be4('0x3d')]({},_0x130935,_0x445b9c[_0x1be4('0x41')]);var _0x47a383={'where':_0x130935[_0x1be4('0x3b')]};return db['Dashboard']['count'](_0x47a383)['then'](function(_0x471554){_0x2e19e8[_0x1be4('0x1f')]=_0x471554;if(_0x445b9c['query']['includeAll']){_0x130935[_0x1be4('0x42')]=[{'all':!![]}];}return db['Dashboard'][_0x1be4('0x43')](_0x130935);})[_0x1be4('0x24')](function(_0x36ad32){_0x2e19e8[_0x1be4('0x44')]=_0x36ad32;return _0x2e19e8;})[_0x1be4('0x24')](respondWithFilteredResult(_0x18b320,_0x130935))[_0x1be4('0x45')](handleError(_0x18b320,null));};exports['show']=function(_0x22dbbd,_0x1b1825){var _0x52b031={'raw':![],'where':{'id':_0x22dbbd['params']['id']}},_0x4803bb={};_0x4803bb[_0x1be4('0x31')]=_[_0x1be4('0x34')](db[_0x1be4('0x2d')][_0x1be4('0x2e')]);_0x4803bb[_0x1be4('0x33')]=_[_0x1be4('0x34')](_0x22dbbd[_0x1be4('0x33')]);_0x4803bb[_0x1be4('0x35')]=_[_0x1be4('0x36')](_0x4803bb[_0x1be4('0x31')],_0x4803bb[_0x1be4('0x33')]);_0x52b031['attributes']=_[_0x1be4('0x36')](_0x4803bb[_0x1be4('0x31')],qs[_0x1be4('0x37')](_0x22dbbd['query'][_0x1be4('0x37')]));_0x52b031['attributes']=_0x52b031[_0x1be4('0x38')]['length']?_0x52b031[_0x1be4('0x38')]:_0x4803bb[_0x1be4('0x31')];if(_0x22dbbd[_0x1be4('0x33')][_0x1be4('0x46')]){_0x52b031[_0x1be4('0x42')]=[{'all':!![]}];}_0x52b031=_['merge']({},_0x52b031,_0x22dbbd[_0x1be4('0x41')]);return db[_0x1be4('0x2d')]['find'](_0x52b031)[_0x1be4('0x24')](handleEntityNotFound(_0x1b1825,null))[_0x1be4('0x24')](respondWithResult(_0x1b1825,null))[_0x1be4('0x45')](handleError(_0x1b1825,null));};exports[_0x1be4('0x47')]=function(_0xf5b691,_0x2692d8){return db[_0x1be4('0x2d')][_0x1be4('0x47')](_0xf5b691[_0x1be4('0x48')],{})[_0x1be4('0x24')](function(_0x2fbb6c){var _0x565726=_0xf5b691[_0x1be4('0x49')]['get']({'plain':!![]});if(!_0x565726)throw new Error(_0x1be4('0x4a'));if(_0x565726[_0x1be4('0x4b')]==='user'){var _0x1f3bd2=_0x2fbb6c['get']({'plain':!![]});var _0x845b75=_0x1be4('0x4c');return db['UserProfileSection'][_0x1be4('0x4d')]({'where':{'name':_0x845b75,'userProfileId':_0x565726['userProfileId']},'raw':!![]})[_0x1be4('0x24')](function(_0x2cc399){if(_0x2cc399&&_0x2cc399[_0x1be4('0x4e')]===0x0){return db[_0x1be4('0x26')][_0x1be4('0x47')]({'name':_0x1f3bd2[_0x1be4('0x2a')],'resourceId':_0x1f3bd2['id'],'type':_0x2cc399['name'],'sectionId':_0x2cc399['id']},{})['then'](function(){return _0x2fbb6c;});}else{return _0x2fbb6c;}})[_0x1be4('0x45')](function(_0x10cfb8){logger['error'](_0x1be4('0x4f'),_0x10cfb8);throw _0x10cfb8;});}return _0x2fbb6c;})[_0x1be4('0x24')](respondWithResult(_0x2692d8,0xc9))[_0x1be4('0x45')](handleError(_0x2692d8,null));};exports[_0x1be4('0x50')]=function(_0x23f01c,_0x251753){var _0x21f31a={'where':{'id':_0x23f01c[_0x1be4('0x51')]['id']}},_0x101fd1={};_0x101fd1[_0x1be4('0x31')]=_['keys'](db[_0x1be4('0x2d')][_0x1be4('0x2e')]);_0x21f31a[_0x1be4('0x38')]=_[_0x1be4('0x36')](_0x101fd1[_0x1be4('0x31')],qs[_0x1be4('0x37')](_0x23f01c[_0x1be4('0x33')][_0x1be4('0x37')]));_0x21f31a[_0x1be4('0x38')]=_0x21f31a['attributes']['length']?_0x21f31a[_0x1be4('0x38')]:_0x101fd1['model'];if(_0x23f01c[_0x1be4('0x33')][_0x1be4('0x46')]){_0x21f31a[_0x1be4('0x42')]=[{'all':!![]}];}_0x21f31a=_['merge']({},_0x21f31a,_0x23f01c[_0x1be4('0x41')]);return db[_0x1be4('0x2d')][_0x1be4('0x4d')](_0x21f31a)[_0x1be4('0x24')](handleEntityNotFound(_0x251753,null))['then'](function(_0x2e5557){if(_0x2e5557){var _0x258228=_0x2e5557[_0x1be4('0x25')]({'plain':!![]});_0x258228=qs[_0x1be4('0x52')](_0x258228,['id',_0x1be4('0x53'),_0x1be4('0x54')]);_0x23f01c[_0x1be4('0x48')]=_[_0x1be4('0x52')](_0x23f01c[_0x1be4('0x48')],['id',_0x1be4('0x53'),'updatedAt']);return db['Dashboard'][_0x1be4('0x47')](_[_0x1be4('0x3d')](_0x258228,_0x23f01c[_0x1be4('0x48')]),{'include':_0x23f01c[_0x1be4('0x33')][_0x1be4('0x46')]?[{'all':!![]}]:undefined})[_0x1be4('0x24')](function(_0x5534a){var _0x5aa589=_0x23f01c[_0x1be4('0x49')][_0x1be4('0x25')]({'plain':!![]});if(!_0x5aa589)throw new Error(_0x1be4('0x4a'));if(_0x5aa589[_0x1be4('0x4b')]==='user'){var _0xf05622=_0x5534a['get']({'plain':!![]});var _0x9d34aa=_0x1be4('0x4c');return db[_0x1be4('0x55')][_0x1be4('0x4d')]({'where':{'name':_0x9d34aa,'userProfileId':_0x5aa589[_0x1be4('0x56')]},'raw':!![]})[_0x1be4('0x24')](function(_0x5ae5c9){if(_0x5ae5c9&&_0x5ae5c9['autoAssociation']===0x0){return db[_0x1be4('0x26')][_0x1be4('0x47')]({'name':_0xf05622[_0x1be4('0x2a')],'resourceId':_0xf05622['id'],'type':_0x5ae5c9[_0x1be4('0x2a')],'sectionId':_0x5ae5c9['id']},{})['then'](function(){return _0x5534a;});}else{return _0x5534a;}})[_0x1be4('0x45')](function(_0x1dbf58){logger[_0x1be4('0x28')](_0x1be4('0x4f'),_0x1dbf58);throw _0x1dbf58;});}return _0x5534a;});}})[_0x1be4('0x24')](respondWithResult(_0x251753,0xc9))[_0x1be4('0x45')](handleError(_0x251753,null));};exports[_0x1be4('0x57')]=function(_0x4ca2c1,_0x5af58c){if(_0x4ca2c1[_0x1be4('0x48')]['id']){delete _0x4ca2c1[_0x1be4('0x48')]['id'];}return db[_0x1be4('0x2d')][_0x1be4('0x4d')]({'where':{'id':_0x4ca2c1[_0x1be4('0x51')]['id']}})[_0x1be4('0x24')](handleEntityNotFound(_0x5af58c,null))['then'](saveUpdates(_0x4ca2c1['body'],null))['then'](respondWithResult(_0x5af58c,null))['catch'](handleError(_0x5af58c,null));};exports[_0x1be4('0x23')]=function(_0x1ca3c8,_0x2c9a3b){return db[_0x1be4('0x2d')][_0x1be4('0x4d')]({'where':{'id':_0x1ca3c8[_0x1be4('0x51')]['id']}})['then'](handleEntityNotFound(_0x2c9a3b,null))['then'](removeEntity(_0x2c9a3b,null))[_0x1be4('0x45')](handleError(_0x2c9a3b,null));};function widgetAttributes(_0xe27dd3){try{switch(_0xe27dd3[_0x1be4('0x3e')]){case _0x1be4('0x58'):return[{'name':'attrUrl','value':_0xe27dd3[_0x1be4('0x59')]||(_0xe27dd3[_0x1be4('0x5a')]&&_0xe27dd3['attrs'][0x0]?_0xe27dd3[_0x1be4('0x5a')][0x0][_0x1be4('0x5b')]:undefined)||'https://'}];case'custom':return[{'name':_0x1be4('0x5c'),'value':_0xe27dd3[_0x1be4('0x5c')]||(_0xe27dd3[_0x1be4('0x5a')]&&_0xe27dd3[_0x1be4('0x5a')][0x0]?_0xe27dd3[_0x1be4('0x5a')][0x0][_0x1be4('0x5b')]:undefined)||''}];case _0x1be4('0x5d'):return[{'name':'attrHourFormat','value':_0xe27dd3[_0x1be4('0x5e')]||(_0xe27dd3['attrs']&&_0xe27dd3['attrs'][0x0]?_0xe27dd3[_0x1be4('0x5a')][0x0]['value']:undefined)||_0x1be4('0x5f')},{'name':_0x1be4('0x60'),'value':_0xe27dd3[_0x1be4('0x60')]||(_0xe27dd3['attrs']&&_0xe27dd3[_0x1be4('0x5a')][0x1]?_0xe27dd3['attrs'][0x1]['value']:undefined)||_0x1be4('0x61')},{'name':_0x1be4('0x62'),'value':_0xe27dd3[_0x1be4('0x62')]||(_0xe27dd3[_0x1be4('0x5a')]&&_0xe27dd3[_0x1be4('0x5a')][0x2]?_0xe27dd3[_0x1be4('0x5a')][0x2][_0x1be4('0x5b')]:undefined)||0xc}];case'counter':return[{'name':_0x1be4('0x63'),'value':_0xe27dd3[_0x1be4('0x63')]||(_0xe27dd3['attrs']&&_0xe27dd3[_0x1be4('0x5a')][0x0]?_0xe27dd3[_0x1be4('0x5a')][0x0][_0x1be4('0x5b')]:undefined)||_0x1be4('0x64')},{'name':_0x1be4('0x65'),'value':_0xe27dd3['attrVoiceQueues']||(_0xe27dd3['attrs']&&_0xe27dd3[_0x1be4('0x5a')][0x1]?_0xe27dd3[_0x1be4('0x5a')][0x1]['value']:undefined)||[]},{'name':_0x1be4('0x62'),'value':_0xe27dd3[_0x1be4('0x62')]||(_0xe27dd3[_0x1be4('0x5a')]&&_0xe27dd3[_0x1be4('0x5a')][0x2]?_0xe27dd3['attrs'][0x2][_0x1be4('0x5b')]:undefined)||0x14},{'name':_0x1be4('0x66'),'value':_0xe27dd3[_0x1be4('0x66')]||(_0xe27dd3[_0x1be4('0x5a')]&&_0xe27dd3[_0x1be4('0x5a')][0x3]?_0xe27dd3[_0x1be4('0x5a')][0x3][_0x1be4('0x5b')]:undefined)||_0x1be4('0x67')},{'name':_0x1be4('0x68'),'value':_0xe27dd3[_0x1be4('0x68')]||(_0xe27dd3[_0x1be4('0x5a')]&&_0xe27dd3[_0x1be4('0x5a')][0x4]?_0xe27dd3[_0x1be4('0x5a')][0x4][_0x1be4('0x5b')]:undefined)||''},{'name':_0x1be4('0x69'),'value':_0xe27dd3[_0x1be4('0x69')]||(_0xe27dd3['attrs']&&_0xe27dd3[_0x1be4('0x5a')][0x5]?_0xe27dd3[_0x1be4('0x5a')][0x5][_0x1be4('0x5b')]:undefined)||''},{'name':_0x1be4('0x6a'),'value':_0xe27dd3[_0x1be4('0x6a')]||(_0xe27dd3['attrs']&&_0xe27dd3['attrs'][0x6]?_0xe27dd3[_0x1be4('0x5a')][0x6][_0x1be4('0x5b')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0xe27dd3['attrOpenchannelAccounts']||(_0xe27dd3['attrs']&&_0xe27dd3[_0x1be4('0x5a')][0x7]?_0xe27dd3[_0x1be4('0x5a')][0x7][_0x1be4('0x5b')]:undefined)||''},{'name':_0x1be4('0x6b'),'value':_0xe27dd3['attrWhatsappAccounts']||(_0xe27dd3[_0x1be4('0x5a')]&&_0xe27dd3[_0x1be4('0x5a')][0x8]?_0xe27dd3['attrs'][0x8][_0x1be4('0x5b')]:undefined)||''},{'name':_0x1be4('0x6c'),'value':_0xe27dd3[_0x1be4('0x6c')]||(_0xe27dd3[_0x1be4('0x5a')]&&_0xe27dd3['attrs'][0x9]?_0xe27dd3[_0x1be4('0x5a')][0x9][_0x1be4('0x5b')]:undefined)||''}];case _0x1be4('0x6d'):case _0x1be4('0x6e'):return[{'name':'attrSerie1','value':_0xe27dd3['attrSerie1']||(_0xe27dd3[_0x1be4('0x5a')]&&_0xe27dd3['attrs'][0x0]?_0xe27dd3['attrs'][0x0][_0x1be4('0x5b')]:undefined)||'total'},{'name':_0x1be4('0x6f'),'value':_0xe27dd3['attrSerie2']||(_0xe27dd3[_0x1be4('0x5a')]&&_0xe27dd3[_0x1be4('0x5a')][0x1]?_0xe27dd3[_0x1be4('0x5a')][0x1][_0x1be4('0x5b')]:undefined)||null},{'name':_0x1be4('0x70'),'value':_0xe27dd3[_0x1be4('0x70')]||(_0xe27dd3['attrs']&&_0xe27dd3[_0x1be4('0x5a')][0x2]?_0xe27dd3['attrs'][0x2]['value']:undefined)||null},{'name':_0x1be4('0x65'),'value':_0xe27dd3[_0x1be4('0x65')]||(_0xe27dd3[_0x1be4('0x5a')]&&_0xe27dd3[_0x1be4('0x5a')][0x3]?_0xe27dd3[_0x1be4('0x5a')][0x3][_0x1be4('0x5b')]:undefined)||[]},{'name':_0x1be4('0x66'),'value':_0xe27dd3[_0x1be4('0x66')]||(_0xe27dd3['attrs']&&_0xe27dd3[_0x1be4('0x5a')][0x4]?_0xe27dd3[_0x1be4('0x5a')][0x4]['value']:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0xe27dd3['attrEmailAccounts']||(_0xe27dd3[_0x1be4('0x5a')]&&_0xe27dd3[_0x1be4('0x5a')][0x5]?_0xe27dd3[_0x1be4('0x5a')][0x5][_0x1be4('0x5b')]:undefined)||''},{'name':_0x1be4('0x69'),'value':_0xe27dd3[_0x1be4('0x69')]||(_0xe27dd3[_0x1be4('0x5a')]&&_0xe27dd3[_0x1be4('0x5a')][0x6]?_0xe27dd3[_0x1be4('0x5a')][0x6][_0x1be4('0x5b')]:undefined)||''},{'name':_0x1be4('0x6a'),'value':_0xe27dd3[_0x1be4('0x6a')]||(_0xe27dd3['attrs']&&_0xe27dd3[_0x1be4('0x5a')][0x7]?_0xe27dd3[_0x1be4('0x5a')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0xe27dd3[_0x1be4('0x71')]||(_0xe27dd3['attrs']&&_0xe27dd3['attrs'][0x8]?_0xe27dd3[_0x1be4('0x5a')][0x8]['value']:undefined)||''},{'name':_0x1be4('0x6b'),'value':_0xe27dd3[_0x1be4('0x6b')]||(_0xe27dd3['attrs']&&_0xe27dd3[_0x1be4('0x5a')][0x9]?_0xe27dd3['attrs'][0x9][_0x1be4('0x5b')]:undefined)||''},{'name':_0x1be4('0x6c'),'value':_0xe27dd3[_0x1be4('0x6c')]||(_0xe27dd3[_0x1be4('0x5a')]&&_0xe27dd3[_0x1be4('0x5a')][0xa]?_0xe27dd3[_0x1be4('0x5a')][0xa][_0x1be4('0x5b')]:undefined)||''}];case _0x1be4('0x72'):return[{'name':_0x1be4('0x73'),'type':_0xe27dd3[_0x1be4('0x74')]||(_0xe27dd3[_0x1be4('0x5a')]&&_0xe27dd3['attrs'][0x0]?_0xe27dd3[_0x1be4('0x5a')][0x0][_0x1be4('0x3e')]:undefined)||null,'value':_0xe27dd3[_0x1be4('0x73')]||(_0xe27dd3[_0x1be4('0x5a')]&&_0xe27dd3[_0x1be4('0x5a')][0x0]?_0xe27dd3['attrs'][0x0][_0x1be4('0x5b')]:undefined)||null},{'name':_0x1be4('0x75'),'value':_0xe27dd3[_0x1be4('0x75')]||(_0xe27dd3['attrs']&&_0xe27dd3[_0x1be4('0x5a')][0x1]?_0xe27dd3['attrs'][0x1][_0x1be4('0x5b')]:undefined)||0x0}];default:return[];}}catch(_0x4af422){logger['error'](_0x1be4('0x76'),JSON['stringify'](_0x4af422));return[];}}exports['addItem']=function(_0x33751e,_0x28cbd7,_0x48bf23){if(_0x33751e[_0x1be4('0x48')]['id']){delete _0x33751e[_0x1be4('0x48')]['id'];}return db[_0x1be4('0x2d')]['find']({'where':{'id':_0x33751e[_0x1be4('0x51')]['id']}})[_0x1be4('0x24')](handleEntityNotFound(_0x28cbd7,null))[_0x1be4('0x24')](function(_0x578e6b){if(_0x578e6b){_0x33751e[_0x1be4('0x48')]['DashboardId']=_0x578e6b['id'];_0x33751e[_0x1be4('0x48')][_0x1be4('0x5a')]=widgetAttributes(_0x33751e[_0x1be4('0x48')]);return db[_0x1be4('0x77')][_0x1be4('0x47')](_0x33751e[_0x1be4('0x48')]);}})[_0x1be4('0x24')](respondWithResult(_0x28cbd7,null))[_0x1be4('0x45')](handleError(_0x28cbd7,null));};exports['getItems']=function(_0x543fec,_0x275692,_0x12e64c){var _0x3097b1={};var _0x1417d2={};var _0x38389f;var _0x28b289;return db[_0x1be4('0x2d')][_0x1be4('0x78')]({'where':{'id':_0x543fec[_0x1be4('0x51')]['id']}})['then'](handleEntityNotFound(_0x275692,null))[_0x1be4('0x24')](function(_0x59bd4f){if(_0x59bd4f){_0x38389f=_0x59bd4f;_0x1417d2[_0x1be4('0x31')]=_['keys'](db[_0x1be4('0x77')][_0x1be4('0x2e')]);_0x1417d2[_0x1be4('0x33')]=_['keys'](_0x543fec['query']);_0x1417d2[_0x1be4('0x35')]=_[_0x1be4('0x36')](_0x1417d2[_0x1be4('0x31')],_0x1417d2[_0x1be4('0x33')]);_0x3097b1[_0x1be4('0x38')]=_[_0x1be4('0x36')](_0x1417d2[_0x1be4('0x31')],qs[_0x1be4('0x37')](_0x543fec[_0x1be4('0x33')][_0x1be4('0x37')]));_0x3097b1[_0x1be4('0x38')]=_0x3097b1['attributes']['length']?_0x3097b1['attributes']:_0x1417d2[_0x1be4('0x31')];_0x3097b1['order']=qs[_0x1be4('0x3a')](_0x543fec[_0x1be4('0x33')][_0x1be4('0x3a')]);_0x3097b1[_0x1be4('0x3b')]=qs[_0x1be4('0x35')](_[_0x1be4('0x3c')](_0x543fec[_0x1be4('0x33')],_0x1417d2[_0x1be4('0x35')]));if(_0x543fec['query'][_0x1be4('0x40')]){_0x3097b1['where']=_['merge'](_0x3097b1[_0x1be4('0x3b')],{'$or':_['map'](_0x3097b1[_0x1be4('0x38')],function(_0x205ed2){var _0xc7f0b={};_0xc7f0b[_0x205ed2]={'$like':'%'+_0x543fec[_0x1be4('0x33')][_0x1be4('0x40')]+'%'};return _0xc7f0b;})});}_0x3097b1=_[_0x1be4('0x3d')]({},_0x3097b1,_0x543fec['options']);return _0x38389f[_0x1be4('0x79')](_0x3097b1);}})[_0x1be4('0x24')](function(_0x4d2c9a){if(_0x4d2c9a){_0x28b289=_0x4d2c9a[_0x1be4('0x39')];if(!_0x543fec['query'][_0x1be4('0x7a')](_0x1be4('0x7b'))){_0x3097b1[_0x1be4('0x1e')]=qs[_0x1be4('0x1e')](_0x543fec[_0x1be4('0x33')][_0x1be4('0x1e')]);_0x3097b1[_0x1be4('0x1c')]=qs['offset'](_0x543fec[_0x1be4('0x33')][_0x1be4('0x1c')]);}return _0x38389f[_0x1be4('0x79')](_0x3097b1);}})['then'](function(_0x240e2b){if(_0x240e2b){return _0x240e2b?{'count':_0x28b289,'rows':_0x240e2b}:null;}})[_0x1be4('0x24')](respondWithResult(_0x275692,null))[_0x1be4('0x45')](handleError(_0x275692,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 471d55f..9bc3d3c 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 _0x07a2=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','save','remove'];(function(_0x2c8b51,_0x12c921){var _0x4d3cbf=function(_0x5f58f5){while(--_0x5f58f5){_0x2c8b51['push'](_0x2c8b51['shift']());}};_0x4d3cbf(++_0x12c921);}(_0x07a2,0x1ea));var _0x207a=function(_0x12e073,_0x2a6387){_0x12e073=_0x12e073-0x0;var _0x17e67b=_0x07a2[_0x12e073];return _0x17e67b;};'use strict';var EventEmitter=require(_0x207a('0x0'));var Dashboard=require(_0x207a('0x1'))['db'][_0x207a('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x207a('0x3'),'afterUpdate':'update','afterDestroy':_0x207a('0x4')};function emitEvent(_0x2ef081){return function(_0xee49ad,_0x1e6b20,_0x52adc2){DashboardEvents[_0x207a('0x5')](_0x2ef081+':'+_0xee49ad['id'],_0xee49ad);DashboardEvents[_0x207a('0x5')](_0x2ef081,_0xee49ad);_0x52adc2(null);};}for(var e in events){if(events[_0x207a('0x6')](e)){var event=events[e];Dashboard[_0x207a('0x7')](e,emitEvent(event));}}module[_0x207a('0x8')]=DashboardEvents; \ No newline at end of file +var _0x0db8=['save','update','emit','hasOwnProperty','hook','events','Dashboard','setMaxListeners'];(function(_0x48c9bd,_0x3f49af){var _0x19a825=function(_0x58642f){while(--_0x58642f){_0x48c9bd['push'](_0x48c9bd['shift']());}};_0x19a825(++_0x3f49af);}(_0x0db8,0x1cd));var _0x80db=function(_0x360fc4,_0x5a0690){_0x360fc4=_0x360fc4-0x0;var _0x1a18d7=_0x0db8[_0x360fc4];return _0x1a18d7;};'use strict';var EventEmitter=require(_0x80db('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x80db('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x80db('0x2')](0x0);var events={'afterCreate':_0x80db('0x3'),'afterUpdate':_0x80db('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4eeef2){return function(_0x13ae1d,_0x23227c,_0x5f3bcc){DashboardEvents['emit'](_0x4eeef2+':'+_0x13ae1d['id'],_0x13ae1d);DashboardEvents[_0x80db('0x5')](_0x4eeef2,_0x13ae1d);_0x5f3bcc(null);};}for(var e in events){if(events[_0x80db('0x6')](e)){var event=events[e];Dashboard[_0x80db('0x7')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 7c797dc..badf488 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 _0xc0ea=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./dashboard.attributes','exports','define','dashboards','lodash','util'];(function(_0x12eb9e,_0x163858){var _0x480c7d=function(_0x449437){while(--_0x449437){_0x12eb9e['push'](_0x12eb9e['shift']());}};_0x480c7d(++_0x163858);}(_0xc0ea,0x12a));var _0xac0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc0ea[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xac0e('0x0'));var util=require(_0xac0e('0x1'));var logger=require(_0xac0e('0x2'))(_0xac0e('0x3'));var moment=require(_0xac0e('0x4'));var BPromise=require(_0xac0e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xac0e('0x6'));var config=require(_0xac0e('0x7'));var attributes=require(_0xac0e('0x8'));module[_0xac0e('0x9')]=function(_0x1d8b8e,_0x6378da){return _0x1d8b8e[_0xac0e('0xa')]('Dashboard',attributes,{'tableName':_0xac0e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa69=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash'];(function(_0x4de586,_0x183427){var _0x46baf5=function(_0x1157f0){while(--_0x1157f0){_0x4de586['push'](_0x4de586['shift']());}};_0x46baf5(++_0x183427);}(_0xfa69,0x1ed));var _0x9fa6=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xfa69[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x9fa6('0x0'));var util=require(_0x9fa6('0x1'));var logger=require(_0x9fa6('0x2'))('api');var moment=require(_0x9fa6('0x3'));var BPromise=require(_0x9fa6('0x4'));var rp=require(_0x9fa6('0x5'));var fs=require('fs');var path=require(_0x9fa6('0x6'));var rimraf=require(_0x9fa6('0x7'));var config=require('../../config/environment');var attributes=require(_0x9fa6('0x8'));module[_0x9fa6('0x9')]=function(_0x369fde,_0x366f86){return _0x369fde[_0x9fa6('0xa')](_0x9fa6('0xb'),attributes,{'tableName':_0x9fa6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 2a417bc..51d3212 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 _0x85e7=['request\x20sent','debug','stringify','error','code','Dashboard,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info'];(function(_0x3c4d0a,_0x55ec4e){var _0x53136a=function(_0x1f2daf){while(--_0x1f2daf){_0x3c4d0a['push'](_0x3c4d0a['shift']());}};_0x53136a(++_0x55ec4e);}(_0x85e7,0x1b1));var _0x785e=function(_0xccfaec,_0x31e4ca){_0xccfaec=_0xccfaec-0x0;var _0x20c8fc=_0x85e7[_0xccfaec];return _0x20c8fc;};'use strict';var _=require(_0x785e('0x0'));var util=require(_0x785e('0x1'));var moment=require('moment');var BPromise=require(_0x785e('0x2'));var rs=require(_0x785e('0x3'));var fs=require('fs');var Redis=require(_0x785e('0x4'));var db=require(_0x785e('0x5'))['db'];var utils=require(_0x785e('0x6'));var logger=require(_0x785e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x785e('0x8')]=_[_0x785e('0x9')](config[_0x785e('0x8')],{'host':_0x785e('0xa'),'port':0x18eb});var socket=require(_0x785e('0xb'))(new Redis(config['redis']));require(_0x785e('0xc'))[_0x785e('0xd')](socket);function respondWithRpcPromise(_0x5b1f82,_0x156512,_0x3b494e){return new BPromise(function(_0x23b5a1,_0x29b446){return client[_0x785e('0xe')](_0x5b1f82,_0x3b494e)[_0x785e('0xf')](function(_0x13946f){logger[_0x785e('0x10')]('Dashboard,\x20%s,\x20%s',_0x156512,_0x785e('0x11'));logger[_0x785e('0x12')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x156512,_0x785e('0x11'),JSON[_0x785e('0x13')](_0x13946f));if(_0x13946f[_0x785e('0x14')]){if(_0x13946f[_0x785e('0x14')][_0x785e('0x15')]===0x1f4){logger[_0x785e('0x14')](_0x785e('0x16'),_0x156512,_0x13946f['error'][_0x785e('0x17')]);return _0x29b446(_0x13946f['error'][_0x785e('0x17')]);}logger['error'](_0x785e('0x16'),_0x156512,_0x13946f[_0x785e('0x14')][_0x785e('0x17')]);return _0x23b5a1(_0x13946f[_0x785e('0x14')][_0x785e('0x17')]);}else{logger['info'](_0x785e('0x16'),_0x156512,_0x785e('0x11'));_0x23b5a1(_0x13946f[_0x785e('0x18')][_0x785e('0x17')]);}})['catch'](function(_0x41d945){logger[_0x785e('0x14')]('Dashboard,\x20%s,\x20%s',_0x156512,_0x41d945);_0x29b446(_0x41d945);});});} \ No newline at end of file +var _0x2e9c=['redis','defaults','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x9cabd9,_0x3be643){var _0x3233ed=function(_0x1f1eeb){while(--_0x1f1eeb){_0x9cabd9['push'](_0x9cabd9['shift']());}};_0x3233ed(++_0x3be643);}(_0x2e9c,0x1d0));var _0xc2e9=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x2e9c[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0xc2e9('0x0'));var util=require(_0xc2e9('0x1'));var moment=require(_0xc2e9('0x2'));var BPromise=require(_0xc2e9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2e9('0x4'))['db'];var utils=require(_0xc2e9('0x5'));var logger=require(_0xc2e9('0x6'))(_0xc2e9('0x7'));var config=require(_0xc2e9('0x8'));var jayson=require(_0xc2e9('0x9'));var client=jayson[_0xc2e9('0xa')][_0xc2e9('0xb')]({'port':0x232a});config[_0xc2e9('0xc')]=_[_0xc2e9('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc2e9('0xe'))(new Redis(config[_0xc2e9('0xc')]));require(_0xc2e9('0xf'))[_0xc2e9('0x10')](socket);function respondWithRpcPromise(_0x21d44d,_0xac85ec,_0x5b43e3){return new BPromise(function(_0x91642,_0x35fc61){return client[_0xc2e9('0x11')](_0x21d44d,_0x5b43e3)[_0xc2e9('0x12')](function(_0x4d716c){logger[_0xc2e9('0x13')](_0xc2e9('0x14'),_0xac85ec,_0xc2e9('0x15'));logger[_0xc2e9('0x16')](_0xc2e9('0x17'),_0xac85ec,_0xc2e9('0x15'),JSON['stringify'](_0x4d716c));if(_0x4d716c['error']){if(_0x4d716c[_0xc2e9('0x18')][_0xc2e9('0x19')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0xac85ec,_0x4d716c[_0xc2e9('0x18')][_0xc2e9('0x1a')]);return _0x35fc61(_0x4d716c['error'][_0xc2e9('0x1a')]);}logger[_0xc2e9('0x18')](_0xc2e9('0x14'),_0xac85ec,_0x4d716c[_0xc2e9('0x18')]['message']);return _0x91642(_0x4d716c[_0xc2e9('0x18')]['message']);}else{logger['info'](_0xc2e9('0x14'),_0xac85ec,_0xc2e9('0x15'));_0x91642(_0x4d716c['result'][_0xc2e9('0x1a')]);}})[_0xc2e9('0x1b')](function(_0x395ee3){logger[_0xc2e9('0x18')](_0xc2e9('0x14'),_0xac85ec,_0x395ee3);_0x35fc61(_0x395ee3);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 94d2ba8..9b2f324 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 _0xe6e7=['remove','update','emit','removeListener','register','length','dashboard:'];(function(_0x384eb2,_0x1a9317){var _0x1a2036=function(_0xbbf628){while(--_0xbbf628){_0x384eb2['push'](_0x384eb2['shift']());}};_0x1a2036(++_0x1a9317);}(_0xe6e7,0x188));var _0x7e6e=function(_0x2133cd,_0x4f2b25){_0x2133cd=_0x2133cd-0x0;var _0x4d7833=_0xe6e7[_0x2133cd];return _0x4d7833;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0x7e6e('0x0'),_0x7e6e('0x1')];function createListener(_0x24f972,_0x421afd){return function(_0x4044b6){_0x421afd[_0x7e6e('0x2')](_0x24f972,_0x4044b6);};}function removeListener(_0x28c65a,_0x8568c1){return function(){DashboardEvents[_0x7e6e('0x3')](_0x28c65a,_0x8568c1);};}exports[_0x7e6e('0x4')]=function(_0x1750f6){for(var _0x393774=0x0,_0x5cbf6b=events[_0x7e6e('0x5')];_0x393774<_0x5cbf6b;_0x393774++){var _0x415556=events[_0x393774];var _0x158479=createListener(_0x7e6e('0x6')+_0x415556,_0x1750f6);DashboardEvents['on'](_0x415556,_0x158479);}}; \ No newline at end of file +var _0x5fa8=['update','emit','removeListener','length','dashboard:','./dashboard.events','remove'];(function(_0x193e10,_0x52efe5){var _0x1ce35a=function(_0xad3ac){while(--_0xad3ac){_0x193e10['push'](_0x193e10['shift']());}};_0x1ce35a(++_0x52efe5);}(_0x5fa8,0x9f));var _0x85fa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5fa8[_0x3dd15e];return _0x231fd0;};'use strict';var DashboardEvents=require(_0x85fa('0x0'));var events=['save',_0x85fa('0x1'),_0x85fa('0x2')];function createListener(_0x288156,_0x3eab3b){return function(_0x3295c9){_0x3eab3b[_0x85fa('0x3')](_0x288156,_0x3295c9);};}function removeListener(_0x2156e6,_0x3a366a){return function(){DashboardEvents[_0x85fa('0x4')](_0x2156e6,_0x3a366a);};}exports['register']=function(_0x44c088){for(var _0x6792a9=0x0,_0x81b329=events[_0x85fa('0x5')];_0x6792a9<_0x81b329;_0x6792a9++){var _0x393c60=events[_0x6792a9];var _0x3f4dfe=createListener(_0x85fa('0x6')+_0x393c60,_0x44c088);DashboardEvents['on'](_0x393c60,_0x3f4dfe);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index eeae719..b2387b9 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 _0x6267=['addItem','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','/:id','/:id/items','getItems','post','create','/:id/clone','clone'];(function(_0x504454,_0x59cc6f){var _0x2c4860=function(_0xfdee1a){while(--_0xfdee1a){_0x504454['push'](_0x504454['shift']());}};_0x2c4860(++_0x59cc6f);}(_0x6267,0x1e5));var _0x7626=function(_0x14f950,_0x2afa3a){_0x14f950=_0x14f950-0x0;var _0x3917ac=_0x6267[_0x14f950];return _0x3917ac;};'use strict';var multer=require(_0x7626('0x0'));var util=require(_0x7626('0x1'));var path=require(_0x7626('0x2'));var timeout=require(_0x7626('0x3'));var express=require('express');var router=express[_0x7626('0x4')]();var fs_extra=require(_0x7626('0x5'));var auth=require(_0x7626('0x6'));var interaction=require(_0x7626('0x7'));var config=require(_0x7626('0x8'));var controller=require(_0x7626('0x9'));router[_0x7626('0xa')]('/',auth[_0x7626('0xb')](),controller['index']);router[_0x7626('0xa')](_0x7626('0xc'),auth[_0x7626('0xb')](),controller['show']);router['get'](_0x7626('0xd'),auth['isAuthenticated'](),controller[_0x7626('0xe')]);router[_0x7626('0xf')]('/',auth[_0x7626('0xb')](),controller[_0x7626('0x10')]);router[_0x7626('0xf')](_0x7626('0x11'),auth[_0x7626('0xb')](),controller[_0x7626('0x12')]);router[_0x7626('0xf')](_0x7626('0xd'),auth[_0x7626('0xb')](),controller[_0x7626('0x13')]);router[_0x7626('0x14')](_0x7626('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x7626('0x15')](_0x7626('0xc'),auth[_0x7626('0xb')](),controller[_0x7626('0x16')]);module[_0x7626('0x17')]=router; \ No newline at end of file +var _0xa397=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getItems','post','create','/:id/clone','clone','/:id/items','update','delete','destroy'];(function(_0x3e5e63,_0x350e33){var _0x35db1d=function(_0x276d07){while(--_0x276d07){_0x3e5e63['push'](_0x3e5e63['shift']());}};_0x35db1d(++_0x350e33);}(_0xa397,0xdd));var _0x7a39=function(_0x1ce505,_0x46b251){_0x1ce505=_0x1ce505-0x0;var _0x583d0f=_0xa397[_0x1ce505];return _0x583d0f;};'use strict';var multer=require(_0x7a39('0x0'));var util=require('util');var path=require(_0x7a39('0x1'));var timeout=require(_0x7a39('0x2'));var express=require(_0x7a39('0x3'));var router=express[_0x7a39('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7a39('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7a39('0x6'));var controller=require('./dashboard.controller');router[_0x7a39('0x7')]('/',auth[_0x7a39('0x8')](),controller[_0x7a39('0x9')]);router[_0x7a39('0x7')](_0x7a39('0xa'),auth[_0x7a39('0x8')](),controller[_0x7a39('0xb')]);router['get']('/:id/items',auth[_0x7a39('0x8')](),controller[_0x7a39('0xc')]);router[_0x7a39('0xd')]('/',auth[_0x7a39('0x8')](),controller[_0x7a39('0xe')]);router[_0x7a39('0xd')](_0x7a39('0xf'),auth[_0x7a39('0x8')](),controller[_0x7a39('0x10')]);router[_0x7a39('0xd')](_0x7a39('0x11'),auth[_0x7a39('0x8')](),controller['addItem']);router['put'](_0x7a39('0xa'),auth['isAuthenticated'](),controller[_0x7a39('0x12')]);router[_0x7a39('0x13')](_0x7a39('0xa'),auth[_0x7a39('0x8')](),controller[_0x7a39('0x14')]);module[_0x7a39('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index ef954b9..8b1aef0 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 _0xc4aa=['getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING'];(function(_0xe69d7f,_0x204089){var _0x160a09=function(_0x16cd82){while(--_0x16cd82){_0xe69d7f['push'](_0xe69d7f['shift']());}};_0x160a09(++_0x204089);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xc4aa[_0xdea41a];return _0x15d0d8;};'use strict';var Sequelize=require(_0xac4a('0x0'));var squel=require(_0xac4a('0x1'));var _=require(_0xac4a('0x2'));module[_0xac4a('0x3')]={'title':{'type':Sequelize[_0xac4a('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xac4a('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON['parse'](this[_0xac4a('0x5')](_0xac4a('0x6')));}catch(_0x730a38){return[];}},'set':function(_0x215f39){try{this[_0xac4a('0x7')](_0xac4a('0x6'),JSON[_0xac4a('0x8')](_0x215f39));}catch(_0x10525b){this['setDataValue']('attrs',JSON[_0xac4a('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xac4a('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xac4a('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0xac4a('0x9')]},'background':{'type':Sequelize[_0xac4a('0x4')],'allowNull':![],'defaultValue':_0xac4a('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xac4a('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xac4a('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0xfdbd=['sequelize','squel','lodash','exports','STRING','TEXT','long','parse','attrs','setDataValue','INTEGER','#ffffff'];(function(_0x146a85,_0x529b52){var _0x1b59bf=function(_0x4af0fd){while(--_0x4af0fd){_0x146a85['push'](_0x146a85['shift']());}};_0x1b59bf(++_0x529b52);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x59a40c,_0x35999f){_0x59a40c=_0x59a40c-0x0;var _0x3cf340=_0xfdbd[_0x59a40c];return _0x3cf340;};'use strict';var Sequelize=require(_0xdfdb('0x0'));var squel=require(_0xdfdb('0x1'));var _=require(_0xdfdb('0x2'));module[_0xdfdb('0x3')]={'title':{'type':Sequelize[_0xdfdb('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xdfdb('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xdfdb('0x5')](_0xdfdb('0x6')),'get':function(){try{return JSON[_0xdfdb('0x7')](this['getDataValue'](_0xdfdb('0x8')));}catch(_0x4a4a3f){return[];}},'set':function(_0x453ef6){try{this[_0xdfdb('0x9')]('attrs',JSON['stringify'](_0x453ef6));}catch(_0x590b5d){this[_0xdfdb('0x9')](_0xdfdb('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xdfdb('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xdfdb('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xdfdb('0xa')]},'col':{'type':Sequelize[_0xdfdb('0xa')]},'background':{'type':Sequelize[_0xdfdb('0x4')],'allowNull':![],'defaultValue':_0xdfdb('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xdfdb('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xdfdb('0x4')]},'titleFontSize':{'type':Sequelize[_0xdfdb('0xa')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index ef25da4..9f355aa 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 _0xdb8b=['count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','merge','find','catch','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','limit','undefined'];(function(_0x2fe393,_0x1d1a24){var _0x187280=function(_0x39ac3b){while(--_0x39ac3b){_0x2fe393['push'](_0x2fe393['shift']());}};_0x187280(++_0x1d1a24);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0x3bdc21,_0x245469){_0x3bdc21=_0x3bdc21-0x0;var _0x3a87a4=_0xdb8b[_0x3bdc21];return _0x3a87a4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbdb8('0x0'));var zipdir=require(_0xbdb8('0x1'));var jsonpatch=require(_0xbdb8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbdb8('0x3'));var Mustache=require('mustache');var util=require(_0xbdb8('0x4'));var path=require(_0xbdb8('0x5'));var sox=require(_0xbdb8('0x6'));var csv=require(_0xbdb8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbdb8('0x8'));var _=require('lodash');var squel=require(_0xbdb8('0x9'));var crypto=require(_0xbdb8('0xa'));var jsforce=require(_0xbdb8('0xb'));var deskjs=require(_0xbdb8('0xc'));var toCsv=require(_0xbdb8('0x7'));var querystring=require(_0xbdb8('0xd'));var Papa=require('papaparse');var Redis=require(_0xbdb8('0xe'));var authService=require(_0xbdb8('0xf'));var qs=require(_0xbdb8('0x10'));var as=require(_0xbdb8('0x11'));var hardwareService=require(_0xbdb8('0x12'));var logger=require(_0xbdb8('0x13'))(_0xbdb8('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbdb8('0x15'));var db=require('../../mysqldb')['db'];config[_0xbdb8('0x16')]=_['defaults'](config[_0xbdb8('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xbdb8('0x17'))(new Redis(config[_0xbdb8('0x16')]));require(_0xbdb8('0x18'))[_0xbdb8('0x19')](socket);function respondWithStatusCode(_0x20984d,_0x180036){_0x180036=_0x180036||0xcc;return function(_0x12bc92){if(_0x12bc92){return _0x20984d[_0xbdb8('0x1a')](_0x180036);}return _0x20984d[_0xbdb8('0x1b')](_0x180036)[_0xbdb8('0x1c')]();};}function respondWithResult(_0x3d583b,_0x1985cb){_0x1985cb=_0x1985cb||0xc8;return function(_0x29b2f7){if(_0x29b2f7){return _0x3d583b['status'](_0x1985cb)[_0xbdb8('0x1d')](_0x29b2f7);}};}function respondWithFilteredResult(_0x3fc32f,_0x154036){return function(_0x5e5330){if(_0x5e5330){var _0x50e009=typeof _0x154036[_0xbdb8('0x1e')]==='undefined'&&typeof _0x154036[_0xbdb8('0x1f')]===_0xbdb8('0x20');var _0xb496f8=_0x5e5330[_0xbdb8('0x21')];var _0x3a177d=_0x50e009?0x0:_0x154036[_0xbdb8('0x1e')];var _0x21c9bf=_0x50e009?_0x5e5330[_0xbdb8('0x21')]:_0x154036[_0xbdb8('0x1e')]+_0x154036[_0xbdb8('0x1f')];var _0x39cfb9;if(_0x21c9bf>=_0xb496f8){_0x21c9bf=_0xb496f8;_0x39cfb9=0xc8;}else{_0x39cfb9=0xce;}_0x3fc32f[_0xbdb8('0x1b')](_0x39cfb9);return _0x3fc32f[_0xbdb8('0x22')](_0xbdb8('0x23'),_0x3a177d+'-'+_0x21c9bf+'/'+_0xb496f8)[_0xbdb8('0x1d')](_0x5e5330);}return null;};}function patchUpdates(_0x3588ee){return function(_0x14c7af){try{jsonpatch[_0xbdb8('0x24')](_0x14c7af,_0x3588ee,!![]);}catch(_0x1e9398){return BPromise[_0xbdb8('0x25')](_0x1e9398);}return _0x14c7af[_0xbdb8('0x26')]();};}function saveUpdates(_0x50c6db,_0x1b99df){return function(_0x5cd628){if(_0x5cd628){return _0x5cd628[_0xbdb8('0x27')](_0x50c6db)[_0xbdb8('0x28')](function(_0x4e9e42){return _0x4e9e42;});}return null;};}function removeEntity(_0x1da624,_0x38709a){return function(_0x554de8){if(_0x554de8){return _0x554de8[_0xbdb8('0x29')]()[_0xbdb8('0x28')](function(){_0x1da624[_0xbdb8('0x1b')](0xcc)[_0xbdb8('0x1c')]();});}};}function handleEntityNotFound(_0x3dedcb,_0x2fe157){return function(_0x325233){if(!_0x325233){_0x3dedcb['sendStatus'](0x194);}return _0x325233;};}function handleError(_0x3c3138,_0x5d0fd7){_0x5d0fd7=_0x5d0fd7||0x1f4;return function(_0x4d2103){logger[_0xbdb8('0x2a')](_0x4d2103[_0xbdb8('0x2b')]);if(_0x4d2103[_0xbdb8('0x2c')]){delete _0x4d2103[_0xbdb8('0x2c')];}_0x3c3138['status'](_0x5d0fd7)[_0xbdb8('0x2d')](_0x4d2103);};}exports[_0xbdb8('0x2e')]=function(_0x26dcbe,_0x477c83){var _0x4ec9a0={'raw':![],'where':{'id':_0x26dcbe[_0xbdb8('0x2f')]['id']}},_0x422f80={};_0x422f80[_0xbdb8('0x30')]=_[_0xbdb8('0x31')](db[_0xbdb8('0x32')][_0xbdb8('0x33')]);_0x422f80[_0xbdb8('0x34')]=_['keys'](_0x26dcbe[_0xbdb8('0x34')]);_0x422f80[_0xbdb8('0x35')]=_['intersection'](_0x422f80['model'],_0x422f80[_0xbdb8('0x34')]);_0x4ec9a0[_0xbdb8('0x36')]=_[_0xbdb8('0x37')](_0x422f80['model'],qs[_0xbdb8('0x38')](_0x26dcbe[_0xbdb8('0x34')][_0xbdb8('0x38')]));_0x4ec9a0[_0xbdb8('0x36')]=_0x4ec9a0['attributes'][_0xbdb8('0x39')]?_0x4ec9a0['attributes']:_0x422f80['model'];if(_0x26dcbe[_0xbdb8('0x34')][_0xbdb8('0x3a')]){_0x4ec9a0['include']=[{'all':!![]}];}_0x4ec9a0=_[_0xbdb8('0x3b')]({},_0x4ec9a0,_0x26dcbe['options']);return db[_0xbdb8('0x32')][_0xbdb8('0x3c')](_0x4ec9a0)['then'](handleEntityNotFound(_0x477c83,null))[_0xbdb8('0x28')](respondWithResult(_0x477c83,null))[_0xbdb8('0x3d')](handleError(_0x477c83,null));};exports[_0xbdb8('0x29')]=function(_0x457676,_0x5bb3ac){return db[_0xbdb8('0x32')][_0xbdb8('0x3c')]({'where':{'id':_0x457676[_0xbdb8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x5bb3ac,null))['then'](removeEntity(_0x5bb3ac,null))[_0xbdb8('0x3d')](handleError(_0x5bb3ac,null));};function widgetAttributes(_0x2f1c79){try{switch(_0x2f1c79['type']){case'iframe':return[{'name':'attrUrl','value':_0x2f1c79[_0xbdb8('0x3e')]||(_0x2f1c79[_0xbdb8('0x3f')]&&_0x2f1c79[_0xbdb8('0x3f')][0x0]?_0x2f1c79['attrs'][0x0][_0xbdb8('0x40')]:undefined)||_0xbdb8('0x41')}];case'custom':return[{'name':'attrPath','value':_0x2f1c79[_0xbdb8('0x42')]||(_0x2f1c79[_0xbdb8('0x3f')]&&_0x2f1c79[_0xbdb8('0x3f')][0x0]?_0x2f1c79[_0xbdb8('0x3f')][0x0]['value']:undefined)||''}];case _0xbdb8('0x43'):return[{'name':'attrHourFormat','value':_0x2f1c79[_0xbdb8('0x44')]||(_0x2f1c79['attrs']&&_0x2f1c79[_0xbdb8('0x3f')][0x0]?_0x2f1c79[_0xbdb8('0x3f')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0xbdb8('0x45'),'value':_0x2f1c79['attrTimezone']||(_0x2f1c79[_0xbdb8('0x3f')]&&_0x2f1c79[_0xbdb8('0x3f')][0x1]?_0x2f1c79['attrs'][0x1][_0xbdb8('0x40')]:undefined)||_0xbdb8('0x46')},{'name':_0xbdb8('0x47'),'value':_0x2f1c79[_0xbdb8('0x47')]||(_0x2f1c79[_0xbdb8('0x3f')]&&_0x2f1c79[_0xbdb8('0x3f')][0x2]?_0x2f1c79[_0xbdb8('0x3f')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0xbdb8('0x48'),'value':_0x2f1c79[_0xbdb8('0x48')]||(_0x2f1c79[_0xbdb8('0x3f')]&&_0x2f1c79['attrs'][0x0]?_0x2f1c79[_0xbdb8('0x3f')][0x0][_0xbdb8('0x40')]:undefined)||_0xbdb8('0x49')},{'name':_0xbdb8('0x4a'),'value':_0x2f1c79[_0xbdb8('0x4a')]||(_0x2f1c79[_0xbdb8('0x3f')]&&_0x2f1c79[_0xbdb8('0x3f')][0x1]?_0x2f1c79[_0xbdb8('0x3f')][0x1]['value']:undefined)||[]},{'name':_0xbdb8('0x47'),'value':_0x2f1c79[_0xbdb8('0x47')]||(_0x2f1c79[_0xbdb8('0x3f')]&&_0x2f1c79[_0xbdb8('0x3f')][0x2]?_0x2f1c79[_0xbdb8('0x3f')][0x2]['value']:undefined)||0x14},{'name':_0xbdb8('0x4b'),'value':_0x2f1c79[_0xbdb8('0x4b')]||(_0x2f1c79[_0xbdb8('0x3f')]&&_0x2f1c79['attrs'][0x3]?_0x2f1c79[_0xbdb8('0x3f')][0x3][_0xbdb8('0x40')]:undefined)||_0xbdb8('0x4c')},{'name':'attrEmailAccounts','value':_0x2f1c79[_0xbdb8('0x4d')]||(_0x2f1c79[_0xbdb8('0x3f')]&&_0x2f1c79[_0xbdb8('0x3f')][0x4]?_0x2f1c79[_0xbdb8('0x3f')][0x4]['value']:undefined)||''},{'name':_0xbdb8('0x4e'),'value':_0x2f1c79['attrFaxAccounts']||(_0x2f1c79[_0xbdb8('0x3f')]&&_0x2f1c79['attrs'][0x5]?_0x2f1c79[_0xbdb8('0x3f')][0x5][_0xbdb8('0x40')]:undefined)||''},{'name':_0xbdb8('0x4f'),'value':_0x2f1c79[_0xbdb8('0x4f')]||(_0x2f1c79['attrs']&&_0x2f1c79[_0xbdb8('0x3f')][0x6]?_0x2f1c79[_0xbdb8('0x3f')][0x6][_0xbdb8('0x40')]:undefined)||''},{'name':_0xbdb8('0x50'),'value':_0x2f1c79[_0xbdb8('0x50')]||(_0x2f1c79['attrs']&&_0x2f1c79[_0xbdb8('0x3f')][0x7]?_0x2f1c79[_0xbdb8('0x3f')][0x7]['value']:undefined)||''},{'name':_0xbdb8('0x51'),'value':_0x2f1c79[_0xbdb8('0x51')]||(_0x2f1c79[_0xbdb8('0x3f')]&&_0x2f1c79['attrs'][0x8]?_0x2f1c79['attrs'][0x8][_0xbdb8('0x40')]:undefined)||''},{'name':_0xbdb8('0x52'),'value':_0x2f1c79[_0xbdb8('0x52')]||(_0x2f1c79[_0xbdb8('0x3f')]&&_0x2f1c79[_0xbdb8('0x3f')][0x9]?_0x2f1c79['attrs'][0x9][_0xbdb8('0x40')]:undefined)||''}];case _0xbdb8('0x53'):case _0xbdb8('0x54'):return[{'name':_0xbdb8('0x55'),'value':_0x2f1c79[_0xbdb8('0x55')]||(_0x2f1c79[_0xbdb8('0x3f')]&&_0x2f1c79[_0xbdb8('0x3f')][0x0]?_0x2f1c79[_0xbdb8('0x3f')][0x0][_0xbdb8('0x40')]:undefined)||_0xbdb8('0x49')},{'name':_0xbdb8('0x56'),'value':_0x2f1c79[_0xbdb8('0x56')]||(_0x2f1c79['attrs']&&_0x2f1c79['attrs'][0x1]?_0x2f1c79[_0xbdb8('0x3f')][0x1][_0xbdb8('0x40')]:undefined)||null},{'name':_0xbdb8('0x57'),'value':_0x2f1c79[_0xbdb8('0x57')]||(_0x2f1c79['attrs']&&_0x2f1c79[_0xbdb8('0x3f')][0x2]?_0x2f1c79[_0xbdb8('0x3f')][0x2]['value']:undefined)||null},{'name':_0xbdb8('0x4a'),'value':_0x2f1c79[_0xbdb8('0x4a')]||(_0x2f1c79[_0xbdb8('0x3f')]&&_0x2f1c79[_0xbdb8('0x3f')][0x3]?_0x2f1c79[_0xbdb8('0x3f')][0x3][_0xbdb8('0x40')]:undefined)||[]},{'name':'attrChannel','value':_0x2f1c79[_0xbdb8('0x4b')]||(_0x2f1c79[_0xbdb8('0x3f')]&&_0x2f1c79['attrs'][0x4]?_0x2f1c79['attrs'][0x4][_0xbdb8('0x40')]:undefined)||_0xbdb8('0x4c')},{'name':_0xbdb8('0x4d'),'value':_0x2f1c79['attrEmailAccounts']||(_0x2f1c79[_0xbdb8('0x3f')]&&_0x2f1c79['attrs'][0x5]?_0x2f1c79[_0xbdb8('0x3f')][0x5]['value']:undefined)||''},{'name':_0xbdb8('0x4e'),'value':_0x2f1c79[_0xbdb8('0x4e')]||(_0x2f1c79[_0xbdb8('0x3f')]&&_0x2f1c79[_0xbdb8('0x3f')][0x6]?_0x2f1c79[_0xbdb8('0x3f')][0x6][_0xbdb8('0x40')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2f1c79[_0xbdb8('0x4f')]||(_0x2f1c79['attrs']&&_0x2f1c79['attrs'][0x7]?_0x2f1c79[_0xbdb8('0x3f')][0x7][_0xbdb8('0x40')]:undefined)||''},{'name':_0xbdb8('0x50'),'value':_0x2f1c79[_0xbdb8('0x50')]||(_0x2f1c79[_0xbdb8('0x3f')]&&_0x2f1c79[_0xbdb8('0x3f')][0x8]?_0x2f1c79[_0xbdb8('0x3f')][0x8][_0xbdb8('0x40')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2f1c79[_0xbdb8('0x51')]||(_0x2f1c79[_0xbdb8('0x3f')]&&_0x2f1c79['attrs'][0x9]?_0x2f1c79[_0xbdb8('0x3f')][0x9][_0xbdb8('0x40')]:undefined)||''},{'name':_0xbdb8('0x52'),'value':_0x2f1c79[_0xbdb8('0x52')]||(_0x2f1c79[_0xbdb8('0x3f')]&&_0x2f1c79[_0xbdb8('0x3f')][0xa]?_0x2f1c79['attrs'][0xa][_0xbdb8('0x40')]:undefined)||''}];case _0xbdb8('0x58'):return[{'name':_0xbdb8('0x59'),'type':_0x2f1c79[_0xbdb8('0x5a')]||(_0x2f1c79[_0xbdb8('0x3f')]&&_0x2f1c79[_0xbdb8('0x3f')][0x0]?_0x2f1c79['attrs'][0x0][_0xbdb8('0x5b')]:undefined)||null,'value':_0x2f1c79[_0xbdb8('0x59')]||(_0x2f1c79['attrs']&&_0x2f1c79['attrs'][0x0]?_0x2f1c79[_0xbdb8('0x3f')][0x0]['value']:undefined)||null},{'name':_0xbdb8('0x5c'),'value':_0x2f1c79['attrRefresh']||(_0x2f1c79[_0xbdb8('0x3f')]&&_0x2f1c79['attrs'][0x1]?_0x2f1c79[_0xbdb8('0x3f')][0x1][_0xbdb8('0x40')]:undefined)||0x0}];default:return[];}}catch(_0xb31eaa){logger[_0xbdb8('0x2a')](_0xbdb8('0x5d'),JSON[_0xbdb8('0x5e')](_0xb31eaa));return[];}}exports[_0xbdb8('0x5f')]=function(_0x4fffd1,_0x426f2c){if(_0x4fffd1[_0xbdb8('0x60')]){_0x4fffd1['body']['attrs']=widgetAttributes(_0x4fffd1['body']);}return db['DashboardItem'][_0xbdb8('0x5f')](_0x4fffd1[_0xbdb8('0x60')],{})[_0xbdb8('0x28')](respondWithResult(_0x426f2c,0xc9))[_0xbdb8('0x3d')](handleError(_0x426f2c,null));};exports[_0xbdb8('0x27')]=function(_0x4d499e,_0x421569){if(_0x4d499e['body']['id']){delete _0x4d499e['body']['id'];}_0x4d499e['body']['attrs']=widgetAttributes(_0x4d499e['body']);return db[_0xbdb8('0x32')]['find']({'where':{'id':_0x4d499e[_0xbdb8('0x2f')]['id']}})[_0xbdb8('0x28')](handleEntityNotFound(_0x421569,null))[_0xbdb8('0x28')](saveUpdates(_0x4d499e[_0xbdb8('0x60')],null))['then'](respondWithResult(_0x421569,null))[_0xbdb8('0x3d')](handleError(_0x421569,null));}; \ No newline at end of file +var _0x4148=['request-promise','bluebird','mustache','util','path','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./dashboardItem.socket','end','json','undefined','count','offset','limit','status','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x23e3a4,_0x3e280a){var _0x90c884=function(_0x110974){while(--_0x110974){_0x23e3a4['push'](_0x23e3a4['shift']());}};_0x90c884(++_0x3e280a);}(_0x4148,0xc6));var _0x8414=function(_0x337570,_0xdd86bc){_0x337570=_0x337570-0x0;var _0x27b1fb=_0x4148[_0x337570];return _0x27b1fb;};'use strict';var emlformat=require(_0x8414('0x0'));var rimraf=require(_0x8414('0x1'));var zipdir=require(_0x8414('0x2'));var jsonpatch=require(_0x8414('0x3'));var rp=require(_0x8414('0x4'));var moment=require('moment');var BPromise=require(_0x8414('0x5'));var Mustache=require(_0x8414('0x6'));var util=require(_0x8414('0x7'));var path=require(_0x8414('0x8'));var sox=require('sox');var csv=require(_0x8414('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8414('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8414('0xb'));var jsforce=require(_0x8414('0xc'));var deskjs=require(_0x8414('0xd'));var toCsv=require(_0x8414('0x9'));var querystring=require(_0x8414('0xe'));var Papa=require(_0x8414('0xf'));var Redis=require(_0x8414('0x10'));var authService=require(_0x8414('0x11'));var qs=require(_0x8414('0x12'));var as=require(_0x8414('0x13'));var hardwareService=require(_0x8414('0x14'));var logger=require('../../config/logger')(_0x8414('0x15'));var utils=require('../../config/utils');var config=require(_0x8414('0x16'));var licenseUtil=require(_0x8414('0x17'));var db=require(_0x8414('0x18'))['db'];config[_0x8414('0x19')]=_['defaults'](config[_0x8414('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x8414('0x1a'))(new Redis(config[_0x8414('0x19')]));require(_0x8414('0x1b'))['register'](socket);function respondWithStatusCode(_0x2875ef,_0x158d6c){_0x158d6c=_0x158d6c||0xcc;return function(_0x45f133){if(_0x45f133){return _0x2875ef['sendStatus'](_0x158d6c);}return _0x2875ef['status'](_0x158d6c)[_0x8414('0x1c')]();};}function respondWithResult(_0xd4268c,_0x1198ab){_0x1198ab=_0x1198ab||0xc8;return function(_0xa3c73b){if(_0xa3c73b){return _0xd4268c['status'](_0x1198ab)[_0x8414('0x1d')](_0xa3c73b);}};}function respondWithFilteredResult(_0x350772,_0x43e4f8){return function(_0x384cb4){if(_0x384cb4){var _0x4cee4a=typeof _0x43e4f8['offset']===_0x8414('0x1e')&&typeof _0x43e4f8['limit']===_0x8414('0x1e');var _0x42c1f7=_0x384cb4[_0x8414('0x1f')];var _0x3169b7=_0x4cee4a?0x0:_0x43e4f8['offset'];var _0xf27a9b=_0x4cee4a?_0x384cb4[_0x8414('0x1f')]:_0x43e4f8[_0x8414('0x20')]+_0x43e4f8[_0x8414('0x21')];var _0x370e44;if(_0xf27a9b>=_0x42c1f7){_0xf27a9b=_0x42c1f7;_0x370e44=0xc8;}else{_0x370e44=0xce;}_0x350772[_0x8414('0x22')](_0x370e44);return _0x350772[_0x8414('0x23')](_0x8414('0x24'),_0x3169b7+'-'+_0xf27a9b+'/'+_0x42c1f7)['json'](_0x384cb4);}return null;};}function patchUpdates(_0x4c5d01){return function(_0x4fc4d3){try{jsonpatch[_0x8414('0x25')](_0x4fc4d3,_0x4c5d01,!![]);}catch(_0x46af1d){return BPromise['reject'](_0x46af1d);}return _0x4fc4d3[_0x8414('0x26')]();};}function saveUpdates(_0x2eaed3,_0x49433d){return function(_0x16bc43){if(_0x16bc43){return _0x16bc43[_0x8414('0x27')](_0x2eaed3)['then'](function(_0x4a881d){return _0x4a881d;});}return null;};}function removeEntity(_0x198199,_0x418c96){return function(_0x2ea383){if(_0x2ea383){return _0x2ea383['destroy']()[_0x8414('0x28')](function(){_0x198199[_0x8414('0x22')](0xcc)[_0x8414('0x1c')]();});}};}function handleEntityNotFound(_0x36021a,_0x44f097){return function(_0x3510c7){if(!_0x3510c7){_0x36021a[_0x8414('0x29')](0x194);}return _0x3510c7;};}function handleError(_0x2806c4,_0x3045e5){_0x3045e5=_0x3045e5||0x1f4;return function(_0x3eb019){logger[_0x8414('0x2a')](_0x3eb019[_0x8414('0x2b')]);if(_0x3eb019[_0x8414('0x2c')]){delete _0x3eb019[_0x8414('0x2c')];}_0x2806c4[_0x8414('0x22')](_0x3045e5)[_0x8414('0x2d')](_0x3eb019);};}exports[_0x8414('0x2e')]=function(_0x38ee8d,_0x5e24e5){var _0x4d8235={'raw':![],'where':{'id':_0x38ee8d[_0x8414('0x2f')]['id']}},_0x32adc2={};_0x32adc2[_0x8414('0x30')]=_[_0x8414('0x31')](db[_0x8414('0x32')][_0x8414('0x33')]);_0x32adc2['query']=_[_0x8414('0x31')](_0x38ee8d[_0x8414('0x34')]);_0x32adc2[_0x8414('0x35')]=_['intersection'](_0x32adc2[_0x8414('0x30')],_0x32adc2[_0x8414('0x34')]);_0x4d8235['attributes']=_[_0x8414('0x36')](_0x32adc2['model'],qs['fields'](_0x38ee8d[_0x8414('0x34')][_0x8414('0x37')]));_0x4d8235[_0x8414('0x38')]=_0x4d8235[_0x8414('0x38')][_0x8414('0x39')]?_0x4d8235[_0x8414('0x38')]:_0x32adc2[_0x8414('0x30')];if(_0x38ee8d[_0x8414('0x34')][_0x8414('0x3a')]){_0x4d8235[_0x8414('0x3b')]=[{'all':!![]}];}_0x4d8235=_[_0x8414('0x3c')]({},_0x4d8235,_0x38ee8d[_0x8414('0x3d')]);return db[_0x8414('0x32')][_0x8414('0x3e')](_0x4d8235)[_0x8414('0x28')](handleEntityNotFound(_0x5e24e5,null))[_0x8414('0x28')](respondWithResult(_0x5e24e5,null))[_0x8414('0x3f')](handleError(_0x5e24e5,null));};exports['destroy']=function(_0x39ebcd,_0x16493d){return db[_0x8414('0x32')][_0x8414('0x3e')]({'where':{'id':_0x39ebcd[_0x8414('0x2f')]['id']}})[_0x8414('0x28')](handleEntityNotFound(_0x16493d,null))[_0x8414('0x28')](removeEntity(_0x16493d,null))['catch'](handleError(_0x16493d,null));};function widgetAttributes(_0x41decf){try{switch(_0x41decf[_0x8414('0x40')]){case _0x8414('0x41'):return[{'name':_0x8414('0x42'),'value':_0x41decf[_0x8414('0x42')]||(_0x41decf[_0x8414('0x43')]&&_0x41decf[_0x8414('0x43')][0x0]?_0x41decf['attrs'][0x0][_0x8414('0x44')]:undefined)||_0x8414('0x45')}];case _0x8414('0x46'):return[{'name':_0x8414('0x47'),'value':_0x41decf[_0x8414('0x47')]||(_0x41decf[_0x8414('0x43')]&&_0x41decf[_0x8414('0x43')][0x0]?_0x41decf[_0x8414('0x43')][0x0][_0x8414('0x44')]:undefined)||''}];case _0x8414('0x48'):return[{'name':_0x8414('0x49'),'value':_0x41decf[_0x8414('0x49')]||(_0x41decf[_0x8414('0x43')]&&_0x41decf[_0x8414('0x43')][0x0]?_0x41decf[_0x8414('0x43')][0x0][_0x8414('0x44')]:undefined)||_0x8414('0x4a')},{'name':_0x8414('0x4b'),'value':_0x41decf[_0x8414('0x4b')]||(_0x41decf[_0x8414('0x43')]&&_0x41decf[_0x8414('0x43')][0x1]?_0x41decf[_0x8414('0x43')][0x1]['value']:undefined)||_0x8414('0x4c')},{'name':_0x8414('0x4d'),'value':_0x41decf[_0x8414('0x4d')]||(_0x41decf[_0x8414('0x43')]&&_0x41decf[_0x8414('0x43')][0x2]?_0x41decf[_0x8414('0x43')][0x2]['value']:undefined)||0xc}];case _0x8414('0x4e'):return[{'name':_0x8414('0x4f'),'value':_0x41decf[_0x8414('0x4f')]||(_0x41decf[_0x8414('0x43')]&&_0x41decf[_0x8414('0x43')][0x0]?_0x41decf[_0x8414('0x43')][0x0][_0x8414('0x44')]:undefined)||_0x8414('0x50')},{'name':_0x8414('0x51'),'value':_0x41decf[_0x8414('0x51')]||(_0x41decf[_0x8414('0x43')]&&_0x41decf[_0x8414('0x43')][0x1]?_0x41decf['attrs'][0x1][_0x8414('0x44')]:undefined)||[]},{'name':'attrFontSize','value':_0x41decf['attrFontSize']||(_0x41decf[_0x8414('0x43')]&&_0x41decf[_0x8414('0x43')][0x2]?_0x41decf[_0x8414('0x43')][0x2][_0x8414('0x44')]:undefined)||0x14},{'name':_0x8414('0x52'),'value':_0x41decf[_0x8414('0x52')]||(_0x41decf[_0x8414('0x43')]&&_0x41decf[_0x8414('0x43')][0x3]?_0x41decf[_0x8414('0x43')][0x3][_0x8414('0x44')]:undefined)||_0x8414('0x53')},{'name':_0x8414('0x54'),'value':_0x41decf[_0x8414('0x54')]||(_0x41decf[_0x8414('0x43')]&&_0x41decf[_0x8414('0x43')][0x4]?_0x41decf[_0x8414('0x43')][0x4][_0x8414('0x44')]:undefined)||''},{'name':_0x8414('0x55'),'value':_0x41decf['attrFaxAccounts']||(_0x41decf[_0x8414('0x43')]&&_0x41decf['attrs'][0x5]?_0x41decf[_0x8414('0x43')][0x5][_0x8414('0x44')]:undefined)||''},{'name':_0x8414('0x56'),'value':_0x41decf[_0x8414('0x56')]||(_0x41decf[_0x8414('0x43')]&&_0x41decf['attrs'][0x6]?_0x41decf[_0x8414('0x43')][0x6][_0x8414('0x44')]:undefined)||''},{'name':_0x8414('0x57'),'value':_0x41decf['attrOpenchannelAccounts']||(_0x41decf[_0x8414('0x43')]&&_0x41decf[_0x8414('0x43')][0x7]?_0x41decf['attrs'][0x7][_0x8414('0x44')]:undefined)||''},{'name':_0x8414('0x58'),'value':_0x41decf[_0x8414('0x58')]||(_0x41decf[_0x8414('0x43')]&&_0x41decf[_0x8414('0x43')][0x8]?_0x41decf[_0x8414('0x43')][0x8][_0x8414('0x44')]:undefined)||''},{'name':_0x8414('0x59'),'value':_0x41decf[_0x8414('0x59')]||(_0x41decf[_0x8414('0x43')]&&_0x41decf[_0x8414('0x43')][0x9]?_0x41decf[_0x8414('0x43')][0x9][_0x8414('0x44')]:undefined)||''}];case _0x8414('0x5a'):case _0x8414('0x5b'):return[{'name':'attrSerie1','value':_0x41decf[_0x8414('0x5c')]||(_0x41decf[_0x8414('0x43')]&&_0x41decf[_0x8414('0x43')][0x0]?_0x41decf[_0x8414('0x43')][0x0][_0x8414('0x44')]:undefined)||_0x8414('0x50')},{'name':'attrSerie2','value':_0x41decf['attrSerie2']||(_0x41decf[_0x8414('0x43')]&&_0x41decf[_0x8414('0x43')][0x1]?_0x41decf[_0x8414('0x43')][0x1][_0x8414('0x44')]:undefined)||null},{'name':'attrSerie3','value':_0x41decf[_0x8414('0x5d')]||(_0x41decf[_0x8414('0x43')]&&_0x41decf[_0x8414('0x43')][0x2]?_0x41decf['attrs'][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x41decf[_0x8414('0x51')]||(_0x41decf[_0x8414('0x43')]&&_0x41decf['attrs'][0x3]?_0x41decf['attrs'][0x3][_0x8414('0x44')]:undefined)||[]},{'name':_0x8414('0x52'),'value':_0x41decf[_0x8414('0x52')]||(_0x41decf['attrs']&&_0x41decf[_0x8414('0x43')][0x4]?_0x41decf['attrs'][0x4][_0x8414('0x44')]:undefined)||_0x8414('0x53')},{'name':_0x8414('0x54'),'value':_0x41decf[_0x8414('0x54')]||(_0x41decf['attrs']&&_0x41decf[_0x8414('0x43')][0x5]?_0x41decf[_0x8414('0x43')][0x5][_0x8414('0x44')]:undefined)||''},{'name':_0x8414('0x55'),'value':_0x41decf[_0x8414('0x55')]||(_0x41decf[_0x8414('0x43')]&&_0x41decf[_0x8414('0x43')][0x6]?_0x41decf[_0x8414('0x43')][0x6]['value']:undefined)||''},{'name':_0x8414('0x56'),'value':_0x41decf[_0x8414('0x56')]||(_0x41decf[_0x8414('0x43')]&&_0x41decf[_0x8414('0x43')][0x7]?_0x41decf[_0x8414('0x43')][0x7][_0x8414('0x44')]:undefined)||''},{'name':_0x8414('0x57'),'value':_0x41decf[_0x8414('0x57')]||(_0x41decf[_0x8414('0x43')]&&_0x41decf[_0x8414('0x43')][0x8]?_0x41decf[_0x8414('0x43')][0x8]['value']:undefined)||''},{'name':_0x8414('0x58'),'value':_0x41decf[_0x8414('0x58')]||(_0x41decf[_0x8414('0x43')]&&_0x41decf[_0x8414('0x43')][0x9]?_0x41decf[_0x8414('0x43')][0x9][_0x8414('0x44')]:undefined)||''},{'name':_0x8414('0x59'),'value':_0x41decf[_0x8414('0x59')]||(_0x41decf[_0x8414('0x43')]&&_0x41decf['attrs'][0xa]?_0x41decf['attrs'][0xa][_0x8414('0x44')]:undefined)||''}];case'web-report':return[{'name':_0x8414('0x5e'),'type':_0x41decf[_0x8414('0x5f')]||(_0x41decf[_0x8414('0x43')]&&_0x41decf[_0x8414('0x43')][0x0]?_0x41decf[_0x8414('0x43')][0x0][_0x8414('0x40')]:undefined)||null,'value':_0x41decf['attrReport']||(_0x41decf[_0x8414('0x43')]&&_0x41decf[_0x8414('0x43')][0x0]?_0x41decf['attrs'][0x0][_0x8414('0x44')]:undefined)||null},{'name':'attrRefresh','value':_0x41decf[_0x8414('0x60')]||(_0x41decf['attrs']&&_0x41decf[_0x8414('0x43')][0x1]?_0x41decf[_0x8414('0x43')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x338781){logger[_0x8414('0x2a')](_0x8414('0x61'),JSON[_0x8414('0x62')](_0x338781));return[];}}exports['create']=function(_0x11655c,_0x3a346a){if(_0x11655c['body']){_0x11655c[_0x8414('0x63')][_0x8414('0x43')]=widgetAttributes(_0x11655c[_0x8414('0x63')]);}return db[_0x8414('0x32')][_0x8414('0x64')](_0x11655c[_0x8414('0x63')],{})['then'](respondWithResult(_0x3a346a,0xc9))[_0x8414('0x3f')](handleError(_0x3a346a,null));};exports[_0x8414('0x27')]=function(_0x25dbb9,_0x52c7b9){if(_0x25dbb9[_0x8414('0x63')]['id']){delete _0x25dbb9[_0x8414('0x63')]['id'];}_0x25dbb9['body'][_0x8414('0x43')]=widgetAttributes(_0x25dbb9['body']);return db[_0x8414('0x32')][_0x8414('0x3e')]({'where':{'id':_0x25dbb9[_0x8414('0x2f')]['id']}})[_0x8414('0x28')](handleEntityNotFound(_0x52c7b9,null))[_0x8414('0x28')](saveUpdates(_0x25dbb9['body'],null))[_0x8414('0x28')](respondWithResult(_0x52c7b9,null))['catch'](handleError(_0x52c7b9,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 70b39f3..0824603 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 _0x3fe9=['exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x13d4bc,_0x386e29){var _0x190088=function(_0x31eab3){while(--_0x31eab3){_0x13d4bc['push'](_0x13d4bc['shift']());}};_0x190088(++_0x386e29);}(_0x3fe9,0x133));var _0x93fe=function(_0x44bef2,_0x1af7ac){_0x44bef2=_0x44bef2-0x0;var _0x1fcb0e=_0x3fe9[_0x44bef2];return _0x1fcb0e;};'use strict';var EventEmitter=require(_0x93fe('0x0'));var DashboardItem=require(_0x93fe('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x93fe('0x2')](0x0);var events={'afterCreate':_0x93fe('0x3'),'afterUpdate':'update','afterDestroy':_0x93fe('0x4')};function emitEvent(_0x4dfc0f){return function(_0x2a62c1,_0x2362c7,_0x47b20c){DashboardItemEvents[_0x93fe('0x5')](_0x4dfc0f+':'+_0x2a62c1['id'],_0x2a62c1);DashboardItemEvents[_0x93fe('0x5')](_0x4dfc0f,_0x2a62c1);_0x47b20c(null);};}for(var e in events){if(events[_0x93fe('0x6')](e)){var event=events[e];DashboardItem[_0x93fe('0x7')](e,emitEvent(event));}}module[_0x93fe('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x8c48=['hasOwnProperty','hook','exports','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit'];(function(_0x4812e0,_0x2ccf3c){var _0x252e0f=function(_0x14cdb8){while(--_0x14cdb8){_0x4812e0['push'](_0x4812e0['shift']());}};_0x252e0f(++_0x2ccf3c);}(_0x8c48,0x7b));var _0x88c4=function(_0x3ddc3d,_0x26c427){_0x3ddc3d=_0x3ddc3d-0x0;var _0x587c48=_0x8c48[_0x3ddc3d];return _0x587c48;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x88c4('0x0'))['db'][_0x88c4('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x88c4('0x2')](0x0);var events={'afterCreate':_0x88c4('0x3'),'afterUpdate':_0x88c4('0x4'),'afterDestroy':_0x88c4('0x5')};function emitEvent(_0x12198c){return function(_0x1455c7,_0x4ede18,_0x1e66a1){DashboardItemEvents[_0x88c4('0x6')](_0x12198c+':'+_0x1455c7['id'],_0x1455c7);DashboardItemEvents[_0x88c4('0x6')](_0x12198c,_0x1455c7);_0x1e66a1(null);};}for(var e in events){if(events[_0x88c4('0x7')](e)){var event=events[e];DashboardItem[_0x88c4('0x8')](e,emitEvent(event));}}module[_0x88c4('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 592430c..1fcf369 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 _0x1cfd=['exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./dashboardItem.attributes'];(function(_0x1bb02b,_0x58453f){var _0x77b3b0=function(_0x36301c){while(--_0x36301c){_0x1bb02b['push'](_0x1bb02b['shift']());}};_0x77b3b0(++_0x58453f);}(_0x1cfd,0x1a4));var _0xd1cf=function(_0x2647c8,_0x16e60d){_0x2647c8=_0x2647c8-0x0;var _0x4777a7=_0x1cfd[_0x2647c8];return _0x4777a7;};'use strict';var _=require(_0xd1cf('0x0'));var util=require(_0xd1cf('0x1'));var logger=require(_0xd1cf('0x2'))(_0xd1cf('0x3'));var moment=require(_0xd1cf('0x4'));var BPromise=require(_0xd1cf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd1cf('0x6'));var rimraf=require(_0xd1cf('0x7'));var config=require('../../config/environment');var attributes=require(_0xd1cf('0x8'));module[_0xd1cf('0x9')]=function(_0x13a59b,_0x431cae){return _0x13a59b[_0xd1cf('0xa')](_0xd1cf('0xb'),attributes,{'tableName':_0xd1cf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x362a=['define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports'];(function(_0x384231,_0x50be41){var _0x2480bf=function(_0x1c4838){while(--_0x1c4838){_0x384231['push'](_0x384231['shift']());}};_0x2480bf(++_0x50be41);}(_0x362a,0x102));var _0xa362=function(_0x43ceb0,_0x1c6db0){_0x43ceb0=_0x43ceb0-0x0;var _0x58cb5a=_0x362a[_0x43ceb0];return _0x58cb5a;};'use strict';var _=require(_0xa362('0x0'));var util=require(_0xa362('0x1'));var logger=require(_0xa362('0x2'))(_0xa362('0x3'));var moment=require(_0xa362('0x4'));var BPromise=require(_0xa362('0x5'));var rp=require(_0xa362('0x6'));var fs=require('fs');var path=require(_0xa362('0x7'));var rimraf=require(_0xa362('0x8'));var config=require(_0xa362('0x9'));var attributes=require(_0xa362('0xa'));module[_0xa362('0xb')]=function(_0x560ea2,_0x1944a4){return _0x560ea2[_0xa362('0xc')](_0xa362('0xd'),attributes,{'tableName':_0xa362('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 8a3fde2..c9e0763 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 _0xee04=['debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','request','then','info','DashboardItem,\x20%s,\x20%s'];(function(_0x45237e,_0x39d7eb){var _0x21cce8=function(_0x3325f8){while(--_0x3325f8){_0x45237e['push'](_0x45237e['shift']());}};_0x21cce8(++_0x39d7eb);}(_0xee04,0x183));var _0x4ee0=function(_0x555c47,_0xa16b54){_0x555c47=_0x555c47-0x0;var _0x5cca31=_0xee04[_0x555c47];return _0x5cca31;};'use strict';var _=require(_0x4ee0('0x0'));var util=require(_0x4ee0('0x1'));var moment=require('moment');var BPromise=require(_0x4ee0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ee0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4ee0('0x4'));var logger=require(_0x4ee0('0x5'))(_0x4ee0('0x6'));var config=require('../../config/environment');var jayson=require(_0x4ee0('0x7'));var client=jayson[_0x4ee0('0x8')][_0x4ee0('0x9')]({'port':0x232a});config[_0x4ee0('0xa')]=_['defaults'](config[_0x4ee0('0xa')],{'host':_0x4ee0('0xb'),'port':0x18eb});var socket=require(_0x4ee0('0xc'))(new Redis(config[_0x4ee0('0xa')]));require(_0x4ee0('0xd'))['register'](socket);function respondWithRpcPromise(_0x1875cf,_0x3a1b03,_0xc53627){return new BPromise(function(_0x5dcaa6,_0x51c85d){return client[_0x4ee0('0xe')](_0x1875cf,_0xc53627)[_0x4ee0('0xf')](function(_0xc9dfcb){logger[_0x4ee0('0x10')](_0x4ee0('0x11'),_0x3a1b03,'request\x20sent');logger[_0x4ee0('0x12')](_0x4ee0('0x13'),_0x3a1b03,'request\x20sent',JSON[_0x4ee0('0x14')](_0xc9dfcb));if(_0xc9dfcb[_0x4ee0('0x15')]){if(_0xc9dfcb[_0x4ee0('0x15')][_0x4ee0('0x16')]===0x1f4){logger[_0x4ee0('0x15')](_0x4ee0('0x11'),_0x3a1b03,_0xc9dfcb[_0x4ee0('0x15')][_0x4ee0('0x17')]);return _0x51c85d(_0xc9dfcb[_0x4ee0('0x15')][_0x4ee0('0x17')]);}logger[_0x4ee0('0x15')]('DashboardItem,\x20%s,\x20%s',_0x3a1b03,_0xc9dfcb[_0x4ee0('0x15')]['message']);return _0x5dcaa6(_0xc9dfcb[_0x4ee0('0x15')]['message']);}else{logger[_0x4ee0('0x10')](_0x4ee0('0x11'),_0x3a1b03,_0x4ee0('0x18'));_0x5dcaa6(_0xc9dfcb[_0x4ee0('0x19')][_0x4ee0('0x17')]);}})[_0x4ee0('0x1a')](function(_0xa2dd6f){logger[_0x4ee0('0x15')]('DashboardItem,\x20%s,\x20%s',_0x3a1b03,_0xa2dd6f);_0x51c85d(_0xa2dd6f);});});} \ No newline at end of file +var _0x1cae=['DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','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','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1e58cf,_0x30af86){var _0x3e4bf1=function(_0x43200e){while(--_0x43200e){_0x1e58cf['push'](_0x1e58cf['shift']());}};_0x3e4bf1(++_0x30af86);}(_0x1cae,0x15c));var _0xe1ca=function(_0x3d1d2c,_0x3680bd){_0x3d1d2c=_0x3d1d2c-0x0;var _0x18a408=_0x1cae[_0x3d1d2c];return _0x18a408;};'use strict';var _=require(_0xe1ca('0x0'));var util=require(_0xe1ca('0x1'));var moment=require(_0xe1ca('0x2'));var BPromise=require(_0xe1ca('0x3'));var rs=require(_0xe1ca('0x4'));var fs=require('fs');var Redis=require(_0xe1ca('0x5'));var db=require(_0xe1ca('0x6'))['db'];var utils=require(_0xe1ca('0x7'));var logger=require(_0xe1ca('0x8'))(_0xe1ca('0x9'));var config=require('../../config/environment');var jayson=require(_0xe1ca('0xa'));var client=jayson[_0xe1ca('0xb')][_0xe1ca('0xc')]({'port':0x232a});config[_0xe1ca('0xd')]=_[_0xe1ca('0xe')](config[_0xe1ca('0xd')],{'host':_0xe1ca('0xf'),'port':0x18eb});var socket=require(_0xe1ca('0x10'))(new Redis(config[_0xe1ca('0xd')]));require('./dashboardItem.socket')[_0xe1ca('0x11')](socket);function respondWithRpcPromise(_0xc46bbd,_0x54cef6,_0x2826a2){return new BPromise(function(_0x46d917,_0x4bc05f){return client[_0xe1ca('0x12')](_0xc46bbd,_0x2826a2)[_0xe1ca('0x13')](function(_0x11614e){logger[_0xe1ca('0x14')](_0xe1ca('0x15'),_0x54cef6,_0xe1ca('0x16'));logger[_0xe1ca('0x17')](_0xe1ca('0x18'),_0x54cef6,_0xe1ca('0x16'),JSON[_0xe1ca('0x19')](_0x11614e));if(_0x11614e['error']){if(_0x11614e[_0xe1ca('0x1a')][_0xe1ca('0x1b')]===0x1f4){logger[_0xe1ca('0x1a')](_0xe1ca('0x15'),_0x54cef6,_0x11614e[_0xe1ca('0x1a')][_0xe1ca('0x1c')]);return _0x4bc05f(_0x11614e['error'][_0xe1ca('0x1c')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x54cef6,_0x11614e[_0xe1ca('0x1a')][_0xe1ca('0x1c')]);return _0x46d917(_0x11614e[_0xe1ca('0x1a')][_0xe1ca('0x1c')]);}else{logger['info'](_0xe1ca('0x15'),_0x54cef6,'request\x20sent');_0x46d917(_0x11614e[_0xe1ca('0x1d')][_0xe1ca('0x1c')]);}})[_0xe1ca('0x1e')](function(_0x18ad7d){logger[_0xe1ca('0x1a')](_0xe1ca('0x15'),_0x54cef6,_0x18ad7d);_0x4bc05f(_0x18ad7d);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 19a6062..580af2a 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 _0xa6db=['emit','removeListener','register','length','save','remove','update'];(function(_0x1e69b5,_0xe5eb39){var _0x9f8eda=function(_0x37b061){while(--_0x37b061){_0x1e69b5['push'](_0x1e69b5['shift']());}};_0x9f8eda(++_0xe5eb39);}(_0xa6db,0xf2));var _0xba6d=function(_0x28689b,_0x2cbbcf){_0x28689b=_0x28689b-0x0;var _0x104f1c=_0xa6db[_0x28689b];return _0x104f1c;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xba6d('0x0'),_0xba6d('0x1'),_0xba6d('0x2')];function createListener(_0x178ee4,_0x3fc57f){return function(_0x372656){_0x3fc57f[_0xba6d('0x3')](_0x178ee4,_0x372656);};}function removeListener(_0x322973,_0x44fc8a){return function(){DashboardItemEvents[_0xba6d('0x4')](_0x322973,_0x44fc8a);};}exports[_0xba6d('0x5')]=function(_0x3673d5){for(var _0x55b331=0x0,_0x4de743=events[_0xba6d('0x6')];_0x55b331<_0x4de743;_0x55b331++){var _0x3a935d=events[_0x55b331];var _0xd0c239=createListener('dashboardItem:'+_0x3a935d,_0x3673d5);DashboardItemEvents['on'](_0x3a935d,_0xd0c239);}}; \ No newline at end of file +var _0x41bb=['remove','update','emit','removeListener','length','dashboardItem:','./dashboardItem.events'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x41bb,0xe6));var _0xb41b=function(_0x22ec06,_0x3b0a39){_0x22ec06=_0x22ec06-0x0;var _0x17c1d6=_0x41bb[_0x22ec06];return _0x17c1d6;};'use strict';var DashboardItemEvents=require(_0xb41b('0x0'));var events=['save',_0xb41b('0x1'),_0xb41b('0x2')];function createListener(_0x1d1b9b,_0x53299f){return function(_0x51e144){_0x53299f[_0xb41b('0x3')](_0x1d1b9b,_0x51e144);};}function removeListener(_0x5a922c,_0x2a6faa){return function(){DashboardItemEvents[_0xb41b('0x4')](_0x5a922c,_0x2a6faa);};}exports['register']=function(_0x367db7){for(var _0xdeaa60=0x0,_0x1080ef=events[_0xb41b('0x5')];_0xdeaa60<_0x1080ef;_0xdeaa60++){var _0x329b7e=events[_0xdeaa60];var _0xae304=createListener(_0xb41b('0x6')+_0x329b7e,_0x367db7);DashboardItemEvents['on'](_0x329b7e,_0xae304);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index e4ffe09..eb3399d 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 _0xbd96=['show','post','create','update','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated'];(function(_0x5cf845,_0x1bc4af){var _0x577a4c=function(_0x21f688){while(--_0x21f688){_0x5cf845['push'](_0x5cf845['shift']());}};_0x577a4c(++_0x1bc4af);}(_0xbd96,0xe6));var _0x6bd9=function(_0x54d46f,_0x152d3d){_0x54d46f=_0x54d46f-0x0;var _0x38de57=_0xbd96[_0x54d46f];return _0x38de57;};'use strict';var multer=require(_0x6bd9('0x0'));var util=require(_0x6bd9('0x1'));var path=require('path');var timeout=require(_0x6bd9('0x2'));var express=require('express');var router=express[_0x6bd9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6bd9('0x4'));var interaction=require(_0x6bd9('0x5'));var config=require(_0x6bd9('0x6'));var controller=require(_0x6bd9('0x7'));router['get'](_0x6bd9('0x8'),auth[_0x6bd9('0x9')](),controller[_0x6bd9('0xa')]);router[_0x6bd9('0xb')]('/',auth['isAuthenticated'](),controller[_0x6bd9('0xc')]);router['put'](_0x6bd9('0x8'),auth[_0x6bd9('0x9')](),controller[_0x6bd9('0xd')]);router['delete'](_0x6bd9('0x8'),auth['isAuthenticated'](),controller[_0x6bd9('0xe')]);module['exports']=router; \ No newline at end of file +var _0x12aa=['get','/:id','show','create','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./dashboardItem.controller'];(function(_0x5a7a9b,_0x8b973a){var _0x236994=function(_0x21f000){while(--_0x21f000){_0x5a7a9b['push'](_0x5a7a9b['shift']());}};_0x236994(++_0x8b973a);}(_0x12aa,0x1b9));var _0xa12a=function(_0x4dc6ec,_0x3e8b0a){_0x4dc6ec=_0x4dc6ec-0x0;var _0x33c507=_0x12aa[_0x4dc6ec];return _0x33c507;};'use strict';var multer=require(_0xa12a('0x0'));var util=require(_0xa12a('0x1'));var path=require(_0xa12a('0x2'));var timeout=require(_0xa12a('0x3'));var express=require(_0xa12a('0x4'));var router=express[_0xa12a('0x5')]();var fs_extra=require(_0xa12a('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa12a('0x7'));var controller=require(_0xa12a('0x8'));router[_0xa12a('0x9')](_0xa12a('0xa'),auth['isAuthenticated'](),controller[_0xa12a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa12a('0xc')]);router['put'](_0xa12a('0xa'),auth[_0xa12a('0xd')](),controller[_0xa12a('0xe')]);router[_0xa12a('0xf')](_0xa12a('0xa'),auth[_0xa12a('0xd')](),controller[_0xa12a('0x10')]);module[_0xa12a('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index f6ff0ce..53961b3 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 _0xa4c1=['first','third','exports','STRING','ENUM'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xa4c1,0x1ab));var _0x1a4c=function(_0x4ed1d4,_0x512d9a){_0x4ed1d4=_0x4ed1d4-0x0;var _0x28e363=_0xa4c1[_0x4ed1d4];return _0x28e363;};'use strict';var Sequelize=require('sequelize');module[_0x1a4c('0x0')]={'name':{'type':Sequelize[_0x1a4c('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x1a4c('0x2')](_0x1a4c('0x3'),'second',_0x1a4c('0x4')),'allowNull':![],'defaultValue':_0x1a4c('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x43bd=['STRING','ENUM','first','second','third','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x43bd,0x6b));var _0xd43b=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x43bd[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require('sequelize');module[_0xd43b('0x0')]={'name':{'type':Sequelize[_0xd43b('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xd43b('0x2')](_0xd43b('0x3'),_0xd43b('0x4'),_0xd43b('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xd43b('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 3f61a01..5f10944 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 _0x3110=['rawAttributes','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','show','keys','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','UserProfileSection','userProfileId','autoAssociation','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','limit','undefined','count','status','Content-Range','apply','save','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','map','Disposition'];(function(_0xd951eb,_0x5545f3){var _0x3e25d0=function(_0x2a91bd){while(--_0x2a91bd){_0xd951eb['push'](_0xd951eb['shift']());}};_0x3e25d0(++_0x5545f3);}(_0x3110,0x75));var _0x0311=function(_0x1da44d,_0x579118){_0x1da44d=_0x1da44d-0x0;var _0x17591e=_0x3110[_0x1da44d];return _0x17591e;};'use strict';var emlformat=require(_0x0311('0x0'));var rimraf=require(_0x0311('0x1'));var zipdir=require(_0x0311('0x2'));var jsonpatch=require(_0x0311('0x3'));var rp=require(_0x0311('0x4'));var moment=require(_0x0311('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0311('0x6'));var util=require(_0x0311('0x7'));var path=require(_0x0311('0x8'));var sox=require('sox');var csv=require(_0x0311('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0311('0xa'));var _=require(_0x0311('0xb'));var squel=require(_0x0311('0xc'));var crypto=require(_0x0311('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0311('0xe'));var toCsv=require(_0x0311('0x9'));var querystring=require(_0x0311('0xf'));var Papa=require(_0x0311('0x10'));var Redis=require(_0x0311('0x11'));var authService=require(_0x0311('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0311('0x13'));var hardwareService=require(_0x0311('0x14'));var logger=require(_0x0311('0x15'))('api');var utils=require(_0x0311('0x16'));var config=require(_0x0311('0x17'));var licenseUtil=require(_0x0311('0x18'));var db=require(_0x0311('0x19'))['db'];function respondWithStatusCode(_0x251fd5,_0x4891a8){_0x4891a8=_0x4891a8||0xcc;return function(_0x352bab){if(_0x352bab){return _0x251fd5['sendStatus'](_0x4891a8);}return _0x251fd5['status'](_0x4891a8)[_0x0311('0x1a')]();};}function respondWithResult(_0x557219,_0x166f3a){_0x166f3a=_0x166f3a||0xc8;return function(_0x1e8283){if(_0x1e8283){return _0x557219['status'](_0x166f3a)[_0x0311('0x1b')](_0x1e8283);}};}function respondWithFilteredResult(_0x39bb29,_0x2a702b){return function(_0x5ab386){if(_0x5ab386){var _0x5303aa=typeof _0x2a702b[_0x0311('0x1c')]==='undefined'&&typeof _0x2a702b[_0x0311('0x1d')]===_0x0311('0x1e');var _0x269244=_0x5ab386[_0x0311('0x1f')];var _0x1ab0e6=_0x5303aa?0x0:_0x2a702b['offset'];var _0x12fc8c=_0x5303aa?_0x5ab386['count']:_0x2a702b['offset']+_0x2a702b[_0x0311('0x1d')];var _0x2bd412;if(_0x12fc8c>=_0x269244){_0x12fc8c=_0x269244;_0x2bd412=0xc8;}else{_0x2bd412=0xce;}_0x39bb29[_0x0311('0x20')](_0x2bd412);return _0x39bb29['set'](_0x0311('0x21'),_0x1ab0e6+'-'+_0x12fc8c+'/'+_0x269244)[_0x0311('0x1b')](_0x5ab386);}return null;};}function patchUpdates(_0x20772d){return function(_0x2cb359){try{jsonpatch[_0x0311('0x22')](_0x2cb359,_0x20772d,!![]);}catch(_0x46dd41){return BPromise['reject'](_0x46dd41);}return _0x2cb359[_0x0311('0x23')]();};}function saveUpdates(_0x59560e,_0x5d5431){return function(_0x168631){if(_0x168631){return _0x168631['update'](_0x59560e)[_0x0311('0x24')](function(_0x4fe22c){return _0x4fe22c;});}return null;};}function removeEntity(_0x4d1b5c,_0x1c73df){return function(_0x3fe82f){if(_0x3fe82f){return _0x3fe82f[_0x0311('0x25')]()[_0x0311('0x24')](function(){var _0x4255a0=_0x3fe82f[_0x0311('0x26')]({'plain':!![]});var _0x18fd6d='Dispositions';return db[_0x0311('0x27')][_0x0311('0x25')]({'where':{'type':_0x18fd6d,'resourceId':_0x4255a0['id']}})[_0x0311('0x24')](function(){return _0x3fe82f;});})[_0x0311('0x24')](function(){_0x4d1b5c[_0x0311('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5390be,_0x456863){return function(_0x33a56c){if(!_0x33a56c){_0x5390be[_0x0311('0x28')](0x194);}return _0x33a56c;};}function handleError(_0x233b2b,_0x273d45){_0x273d45=_0x273d45||0x1f4;return function(_0x44852e){logger[_0x0311('0x29')](_0x44852e[_0x0311('0x2a')]);if(_0x44852e[_0x0311('0x2b')]){delete _0x44852e[_0x0311('0x2b')];}_0x233b2b[_0x0311('0x20')](_0x273d45)[_0x0311('0x2c')](_0x44852e);};}exports['index']=function(_0x54b1bb,_0xff5dc6){var _0x5efeaa={},_0x448f2b={},_0xb5a34b={'count':0x0,'rows':[]};var _0x24608e=_[_0x0311('0x2d')](db[_0x0311('0x2e')][_0x0311('0x2f')],function(_0x2bf4ef){return{'name':_0x2bf4ef['fieldName'],'type':_0x2bf4ef[_0x0311('0x30')]['key']};});_0x448f2b[_0x0311('0x31')]=_[_0x0311('0x2d')](_0x24608e,'name');_0x448f2b[_0x0311('0x32')]=_['keys'](_0x54b1bb[_0x0311('0x32')]);_0x448f2b[_0x0311('0x33')]=_[_0x0311('0x34')](_0x448f2b['model'],_0x448f2b[_0x0311('0x32')]);_0x5efeaa[_0x0311('0x35')]=_[_0x0311('0x34')](_0x448f2b['model'],qs['fields'](_0x54b1bb[_0x0311('0x32')][_0x0311('0x36')]));_0x5efeaa[_0x0311('0x35')]=_0x5efeaa[_0x0311('0x35')]['length']?_0x5efeaa[_0x0311('0x35')]:_0x448f2b[_0x0311('0x31')];if(!_0x54b1bb[_0x0311('0x32')][_0x0311('0x37')](_0x0311('0x38'))){_0x5efeaa[_0x0311('0x1d')]=qs['limit'](_0x54b1bb[_0x0311('0x32')][_0x0311('0x1d')]);_0x5efeaa[_0x0311('0x1c')]=qs[_0x0311('0x1c')](_0x54b1bb[_0x0311('0x32')]['offset']);}_0x5efeaa[_0x0311('0x39')]=qs[_0x0311('0x3a')](_0x54b1bb[_0x0311('0x32')][_0x0311('0x3a')]);_0x5efeaa[_0x0311('0x3b')]=qs['filters'](_['pick'](_0x54b1bb[_0x0311('0x32')],_0x448f2b[_0x0311('0x33')]),_0x24608e);if(_0x54b1bb['query']['filter']){_0x5efeaa[_0x0311('0x3b')]=_[_0x0311('0x3c')](_0x5efeaa[_0x0311('0x3b')],{'$or':_['map'](_0x24608e,function(_0xb7fc0f){if(_0xb7fc0f[_0x0311('0x30')]!==_0x0311('0x3d')){var _0xacec09={};_0xacec09[_0xb7fc0f[_0x0311('0x2b')]]={'$like':'%'+_0x54b1bb[_0x0311('0x32')][_0x0311('0x3e')]+'%'};return _0xacec09;}})});}_0x5efeaa=_[_0x0311('0x3c')]({},_0x5efeaa,_0x54b1bb[_0x0311('0x3f')]);var _0x48956b={'where':_0x5efeaa['where']};return db[_0x0311('0x2e')][_0x0311('0x1f')](_0x48956b)[_0x0311('0x24')](function(_0x3d7610){_0xb5a34b[_0x0311('0x1f')]=_0x3d7610;if(_0x54b1bb[_0x0311('0x32')][_0x0311('0x40')]){_0x5efeaa[_0x0311('0x41')]=[{'all':!![]}];}return db[_0x0311('0x2e')]['findAll'](_0x5efeaa);})[_0x0311('0x24')](function(_0x25752a){_0xb5a34b['rows']=_0x25752a;return _0xb5a34b;})['then'](respondWithFilteredResult(_0xff5dc6,_0x5efeaa))['catch'](handleError(_0xff5dc6,null));};exports[_0x0311('0x42')]=function(_0x32de6d,_0x5a93be){var _0x37aabe={'raw':!![],'where':{'id':_0x32de6d['params']['id']}},_0x12067d={};_0x12067d[_0x0311('0x31')]=_['keys'](db[_0x0311('0x2e')]['rawAttributes']);_0x12067d[_0x0311('0x32')]=_[_0x0311('0x43')](_0x32de6d['query']);_0x12067d[_0x0311('0x33')]=_[_0x0311('0x34')](_0x12067d['model'],_0x12067d[_0x0311('0x32')]);_0x37aabe[_0x0311('0x35')]=_[_0x0311('0x34')](_0x12067d['model'],qs['fields'](_0x32de6d['query'][_0x0311('0x36')]));_0x37aabe['attributes']=_0x37aabe[_0x0311('0x35')][_0x0311('0x44')]?_0x37aabe['attributes']:_0x12067d[_0x0311('0x31')];if(_0x32de6d[_0x0311('0x32')][_0x0311('0x40')]){_0x37aabe['include']=[{'all':!![]}];}_0x37aabe=_[_0x0311('0x3c')]({},_0x37aabe,_0x32de6d[_0x0311('0x3f')]);return db[_0x0311('0x2e')][_0x0311('0x45')](_0x37aabe)[_0x0311('0x24')](handleEntityNotFound(_0x5a93be,null))[_0x0311('0x24')](respondWithResult(_0x5a93be,null))[_0x0311('0x46')](handleError(_0x5a93be,null));};exports[_0x0311('0x47')]=function(_0x5cffe1,_0x272df6){return db['Disposition'][_0x0311('0x47')](_0x5cffe1[_0x0311('0x48')],{})['then'](function(_0x380bcf){var _0x1d1790=_0x5cffe1[_0x0311('0x49')]['get']({'plain':!![]});if(!_0x1d1790)throw new Error(_0x0311('0x4a'));if(_0x1d1790[_0x0311('0x4b')]==='user'){var _0xe30b5=_0x380bcf[_0x0311('0x26')]({'plain':!![]});var _0x26075d=_0x0311('0x4c');return db[_0x0311('0x4d')][_0x0311('0x45')]({'where':{'name':_0x26075d,'userProfileId':_0x1d1790[_0x0311('0x4e')]},'raw':!![]})[_0x0311('0x24')](function(_0x43f005){if(_0x43f005&&_0x43f005[_0x0311('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0xe30b5[_0x0311('0x2b')],'resourceId':_0xe30b5['id'],'type':_0x43f005[_0x0311('0x2b')],'sectionId':_0x43f005['id']},{})['then'](function(){return _0x380bcf;});}else{return _0x380bcf;}})['catch'](function(_0x4c2d22){logger[_0x0311('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c2d22);throw _0x4c2d22;});}return _0x380bcf;})[_0x0311('0x24')](respondWithResult(_0x272df6,0xc9))[_0x0311('0x46')](handleError(_0x272df6,null));};exports[_0x0311('0x50')]=function(_0xd8d6be,_0x4172d5){if(_0xd8d6be[_0x0311('0x48')]['id']){delete _0xd8d6be[_0x0311('0x48')]['id'];}return db[_0x0311('0x2e')][_0x0311('0x45')]({'where':{'id':_0xd8d6be[_0x0311('0x51')]['id']}})[_0x0311('0x24')](handleEntityNotFound(_0x4172d5,null))[_0x0311('0x24')](saveUpdates(_0xd8d6be[_0x0311('0x48')],null))[_0x0311('0x24')](respondWithResult(_0x4172d5,null))[_0x0311('0x46')](handleError(_0x4172d5,null));};exports[_0x0311('0x25')]=function(_0x35dddb,_0x5c429d){return db['Disposition'][_0x0311('0x45')]({'where':{'id':_0x35dddb[_0x0311('0x51')]['id']}})['then'](handleEntityNotFound(_0x5c429d,null))['then'](removeEntity(_0x5c429d,null))[_0x0311('0x46')](handleError(_0x5c429d,null));}; \ No newline at end of file +var _0x9056=['query','keys','filters','attributes','intersection','length','nolimit','order','sort','where','filter','VIRTUAL','options','include','findAll','catch','show','params','fields','includeAll','merge','find','create','body','user','Dispositions','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','save','update','destroy','then','get','error','stack','name','send','map','Disposition','rawAttributes','fieldName','type','key','model'];(function(_0x532e15,_0x2e5019){var _0x39f47f=function(_0x35f960){while(--_0x35f960){_0x532e15['push'](_0x532e15['shift']());}};_0x39f47f(++_0x2e5019);}(_0x9056,0x167));var _0x6905=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9056[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6905('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6905('0x1'));var rp=require('request-promise');var moment=require(_0x6905('0x2'));var BPromise=require(_0x6905('0x3'));var Mustache=require('mustache');var util=require(_0x6905('0x4'));var path=require(_0x6905('0x5'));var sox=require(_0x6905('0x6'));var csv=require('to-csv');var ejs=require(_0x6905('0x7'));var fs=require('fs');var fs_extra=require(_0x6905('0x8'));var _=require(_0x6905('0x9'));var squel=require(_0x6905('0xa'));var crypto=require(_0x6905('0xb'));var jsforce=require(_0x6905('0xc'));var deskjs=require(_0x6905('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6905('0xe'));var Papa=require(_0x6905('0xf'));var Redis=require(_0x6905('0x10'));var authService=require(_0x6905('0x11'));var qs=require(_0x6905('0x12'));var as=require(_0x6905('0x13'));var hardwareService=require(_0x6905('0x14'));var logger=require(_0x6905('0x15'))(_0x6905('0x16'));var utils=require(_0x6905('0x17'));var config=require(_0x6905('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6905('0x19'))['db'];function respondWithStatusCode(_0x3706f8,_0x107cea){_0x107cea=_0x107cea||0xcc;return function(_0x4b23aa){if(_0x4b23aa){return _0x3706f8[_0x6905('0x1a')](_0x107cea);}return _0x3706f8[_0x6905('0x1b')](_0x107cea)[_0x6905('0x1c')]();};}function respondWithResult(_0x469312,_0x2e88d9){_0x2e88d9=_0x2e88d9||0xc8;return function(_0x92b2ce){if(_0x92b2ce){return _0x469312[_0x6905('0x1b')](_0x2e88d9)[_0x6905('0x1d')](_0x92b2ce);}};}function respondWithFilteredResult(_0x322010,_0x4bb8a9){return function(_0x3d8d86){if(_0x3d8d86){var _0x124261=typeof _0x4bb8a9[_0x6905('0x1e')]==='undefined'&&typeof _0x4bb8a9[_0x6905('0x1f')]===_0x6905('0x20');var _0x435c8d=_0x3d8d86[_0x6905('0x21')];var _0x2f830b=_0x124261?0x0:_0x4bb8a9['offset'];var _0x1ffdb7=_0x124261?_0x3d8d86[_0x6905('0x21')]:_0x4bb8a9[_0x6905('0x1e')]+_0x4bb8a9[_0x6905('0x1f')];var _0x2ce4e8;if(_0x1ffdb7>=_0x435c8d){_0x1ffdb7=_0x435c8d;_0x2ce4e8=0xc8;}else{_0x2ce4e8=0xce;}_0x322010['status'](_0x2ce4e8);return _0x322010['set'](_0x6905('0x22'),_0x2f830b+'-'+_0x1ffdb7+'/'+_0x435c8d)[_0x6905('0x1d')](_0x3d8d86);}return null;};}function patchUpdates(_0xe5e85d){return function(_0x4e6138){try{jsonpatch['apply'](_0x4e6138,_0xe5e85d,!![]);}catch(_0x5ceeb6){return BPromise['reject'](_0x5ceeb6);}return _0x4e6138[_0x6905('0x23')]();};}function saveUpdates(_0x450431,_0x57bc8a){return function(_0x2a362e){if(_0x2a362e){return _0x2a362e[_0x6905('0x24')](_0x450431)['then'](function(_0x36bd87){return _0x36bd87;});}return null;};}function removeEntity(_0x42c8e8,_0xaf2618){return function(_0x3ce944){if(_0x3ce944){return _0x3ce944[_0x6905('0x25')]()[_0x6905('0x26')](function(){var _0x5be78f=_0x3ce944[_0x6905('0x27')]({'plain':!![]});var _0x4b1f1e='Dispositions';return db['UserProfileResource']['destroy']({'where':{'type':_0x4b1f1e,'resourceId':_0x5be78f['id']}})[_0x6905('0x26')](function(){return _0x3ce944;});})[_0x6905('0x26')](function(){_0x42c8e8[_0x6905('0x1b')](0xcc)[_0x6905('0x1c')]();});}};}function handleEntityNotFound(_0x2ce19b,_0x239984){return function(_0x17c7ec){if(!_0x17c7ec){_0x2ce19b['sendStatus'](0x194);}return _0x17c7ec;};}function handleError(_0x2b8c8d,_0x58a70f){_0x58a70f=_0x58a70f||0x1f4;return function(_0x211d72){logger[_0x6905('0x28')](_0x211d72[_0x6905('0x29')]);if(_0x211d72[_0x6905('0x2a')]){delete _0x211d72['name'];}_0x2b8c8d[_0x6905('0x1b')](_0x58a70f)[_0x6905('0x2b')](_0x211d72);};}exports['index']=function(_0x2d45d4,_0x3f31c8){var _0x41172e={},_0x43b749={},_0xe63d71={'count':0x0,'rows':[]};var _0x296f3=_[_0x6905('0x2c')](db[_0x6905('0x2d')][_0x6905('0x2e')],function(_0x25e45e){return{'name':_0x25e45e[_0x6905('0x2f')],'type':_0x25e45e[_0x6905('0x30')][_0x6905('0x31')]};});_0x43b749[_0x6905('0x32')]=_[_0x6905('0x2c')](_0x296f3,_0x6905('0x2a'));_0x43b749[_0x6905('0x33')]=_[_0x6905('0x34')](_0x2d45d4[_0x6905('0x33')]);_0x43b749[_0x6905('0x35')]=_['intersection'](_0x43b749[_0x6905('0x32')],_0x43b749[_0x6905('0x33')]);_0x41172e[_0x6905('0x36')]=_[_0x6905('0x37')](_0x43b749[_0x6905('0x32')],qs['fields'](_0x2d45d4[_0x6905('0x33')]['fields']));_0x41172e[_0x6905('0x36')]=_0x41172e[_0x6905('0x36')][_0x6905('0x38')]?_0x41172e[_0x6905('0x36')]:_0x43b749[_0x6905('0x32')];if(!_0x2d45d4[_0x6905('0x33')]['hasOwnProperty'](_0x6905('0x39'))){_0x41172e['limit']=qs[_0x6905('0x1f')](_0x2d45d4['query'][_0x6905('0x1f')]);_0x41172e['offset']=qs[_0x6905('0x1e')](_0x2d45d4['query'][_0x6905('0x1e')]);}_0x41172e[_0x6905('0x3a')]=qs[_0x6905('0x3b')](_0x2d45d4['query'][_0x6905('0x3b')]);_0x41172e[_0x6905('0x3c')]=qs[_0x6905('0x35')](_['pick'](_0x2d45d4[_0x6905('0x33')],_0x43b749[_0x6905('0x35')]),_0x296f3);if(_0x2d45d4[_0x6905('0x33')][_0x6905('0x3d')]){_0x41172e[_0x6905('0x3c')]=_['merge'](_0x41172e[_0x6905('0x3c')],{'$or':_[_0x6905('0x2c')](_0x296f3,function(_0x186314){if(_0x186314[_0x6905('0x30')]!==_0x6905('0x3e')){var _0x1f7113={};_0x1f7113[_0x186314['name']]={'$like':'%'+_0x2d45d4[_0x6905('0x33')]['filter']+'%'};return _0x1f7113;}})});}_0x41172e=_['merge']({},_0x41172e,_0x2d45d4[_0x6905('0x3f')]);var _0x1fa5da={'where':_0x41172e['where']};return db['Disposition'][_0x6905('0x21')](_0x1fa5da)[_0x6905('0x26')](function(_0x1c425e){_0xe63d71[_0x6905('0x21')]=_0x1c425e;if(_0x2d45d4[_0x6905('0x33')]['includeAll']){_0x41172e[_0x6905('0x40')]=[{'all':!![]}];}return db[_0x6905('0x2d')][_0x6905('0x41')](_0x41172e);})[_0x6905('0x26')](function(_0x537232){_0xe63d71['rows']=_0x537232;return _0xe63d71;})[_0x6905('0x26')](respondWithFilteredResult(_0x3f31c8,_0x41172e))[_0x6905('0x42')](handleError(_0x3f31c8,null));};exports[_0x6905('0x43')]=function(_0x153e79,_0x30772d){var _0xe0e308={'raw':!![],'where':{'id':_0x153e79[_0x6905('0x44')]['id']}},_0x27c3c2={};_0x27c3c2[_0x6905('0x32')]=_[_0x6905('0x34')](db[_0x6905('0x2d')][_0x6905('0x2e')]);_0x27c3c2[_0x6905('0x33')]=_[_0x6905('0x34')](_0x153e79[_0x6905('0x33')]);_0x27c3c2['filters']=_[_0x6905('0x37')](_0x27c3c2[_0x6905('0x32')],_0x27c3c2[_0x6905('0x33')]);_0xe0e308[_0x6905('0x36')]=_[_0x6905('0x37')](_0x27c3c2[_0x6905('0x32')],qs[_0x6905('0x45')](_0x153e79[_0x6905('0x33')][_0x6905('0x45')]));_0xe0e308[_0x6905('0x36')]=_0xe0e308[_0x6905('0x36')]['length']?_0xe0e308[_0x6905('0x36')]:_0x27c3c2[_0x6905('0x32')];if(_0x153e79[_0x6905('0x33')][_0x6905('0x46')]){_0xe0e308[_0x6905('0x40')]=[{'all':!![]}];}_0xe0e308=_[_0x6905('0x47')]({},_0xe0e308,_0x153e79[_0x6905('0x3f')]);return db[_0x6905('0x2d')][_0x6905('0x48')](_0xe0e308)[_0x6905('0x26')](handleEntityNotFound(_0x30772d,null))['then'](respondWithResult(_0x30772d,null))[_0x6905('0x42')](handleError(_0x30772d,null));};exports[_0x6905('0x49')]=function(_0x3d593e,_0x2d13e9){return db[_0x6905('0x2d')][_0x6905('0x49')](_0x3d593e[_0x6905('0x4a')],{})[_0x6905('0x26')](function(_0x16bd15){var _0x5a5cec=_0x3d593e[_0x6905('0x4b')]['get']({'plain':!![]});if(!_0x5a5cec)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a5cec['role']===_0x6905('0x4b')){var _0x478767=_0x16bd15['get']({'plain':!![]});var _0x11342a=_0x6905('0x4c');return db[_0x6905('0x4d')][_0x6905('0x48')]({'where':{'name':_0x11342a,'userProfileId':_0x5a5cec[_0x6905('0x4e')]},'raw':!![]})['then'](function(_0x2bad97){if(_0x2bad97&&_0x2bad97[_0x6905('0x4f')]===0x0){return db[_0x6905('0x50')][_0x6905('0x49')]({'name':_0x478767['name'],'resourceId':_0x478767['id'],'type':_0x2bad97['name'],'sectionId':_0x2bad97['id']},{})[_0x6905('0x26')](function(){return _0x16bd15;});}else{return _0x16bd15;}})[_0x6905('0x42')](function(_0x4c7c4b){logger[_0x6905('0x28')](_0x6905('0x51'),_0x4c7c4b);throw _0x4c7c4b;});}return _0x16bd15;})[_0x6905('0x26')](respondWithResult(_0x2d13e9,0xc9))[_0x6905('0x42')](handleError(_0x2d13e9,null));};exports[_0x6905('0x24')]=function(_0x3b65b1,_0x5ccc50){if(_0x3b65b1[_0x6905('0x4a')]['id']){delete _0x3b65b1[_0x6905('0x4a')]['id'];}return db[_0x6905('0x2d')]['find']({'where':{'id':_0x3b65b1['params']['id']}})[_0x6905('0x26')](handleEntityNotFound(_0x5ccc50,null))['then'](saveUpdates(_0x3b65b1['body'],null))[_0x6905('0x26')](respondWithResult(_0x5ccc50,null))[_0x6905('0x42')](handleError(_0x5ccc50,null));};exports[_0x6905('0x25')]=function(_0xed32f5,_0x1d9e80){return db[_0x6905('0x2d')][_0x6905('0x48')]({'where':{'id':_0xed32f5['params']['id']}})[_0x6905('0x26')](handleEntityNotFound(_0x1d9e80,null))['then'](removeEntity(_0x1d9e80,null))[_0x6905('0x42')](handleError(_0x1d9e80,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index c924ae2..be7f3b8 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 _0x9cf7=['bluebird','request-promise','path','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','SmsAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','../../config/logger','api','moment'];(function(_0x5a741f,_0x5d1af6){var _0x16d088=function(_0x54209e){while(--_0x54209e){_0x5a741f['push'](_0x5a741f['shift']());}};_0x16d088(++_0x5d1af6);}(_0x9cf7,0x13e));var _0x79cf=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9cf7[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x79cf('0x0'));var util=require('util');var logger=require(_0x79cf('0x1'))(_0x79cf('0x2'));var moment=require(_0x79cf('0x3'));var BPromise=require(_0x79cf('0x4'));var rp=require(_0x79cf('0x5'));var fs=require('fs');var path=require(_0x79cf('0x6'));var rimraf=require('rimraf');var config=require(_0x79cf('0x7'));var attributes=require(_0x79cf('0x8'));module[_0x79cf('0x9')]=function(_0x31586e,_0xf990b3){return _0x31586e[_0x79cf('0xa')](_0x79cf('0xb'),attributes,{'tableName':_0x79cf('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x79cf('0xd'),'fields':[_0x79cf('0xe'),_0x79cf('0xf')]},{'unique':!![],'name':_0x79cf('0x10'),'fields':[_0x79cf('0xe'),_0x79cf('0x11')]},{'unique':!![],'name':_0x79cf('0x12'),'fields':['name','MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0x79cf('0xe'),_0x79cf('0x13')]},{'unique':!![],'name':'name_fax','fields':[_0x79cf('0xe'),'FaxAccountId']},{'unique':!![],'name':_0x79cf('0x14'),'fields':[_0x79cf('0xe'),_0x79cf('0x15')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x79cf('0xe'),_0x79cf('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa2f9=['name_chat','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','name_voice','name','ListId'];(function(_0x722024,_0xb9d642){var _0x4cb33a=function(_0x2a846a){while(--_0x2a846a){_0x722024['push'](_0x722024['shift']());}};_0x4cb33a(++_0xb9d642);}(_0xa2f9,0xd9));var _0x9a2f=function(_0x463e45,_0x1ff35f){_0x463e45=_0x463e45-0x0;var _0x172e49=_0xa2f9[_0x463e45];return _0x172e49;};'use strict';var _=require(_0x9a2f('0x0'));var util=require(_0x9a2f('0x1'));var logger=require('../../config/logger')(_0x9a2f('0x2'));var moment=require(_0x9a2f('0x3'));var BPromise=require(_0x9a2f('0x4'));var rp=require(_0x9a2f('0x5'));var fs=require('fs');var path=require(_0x9a2f('0x6'));var rimraf=require(_0x9a2f('0x7'));var config=require(_0x9a2f('0x8'));var attributes=require('./disposition.attributes');module['exports']=function(_0x541d19,_0x7e145c){return _0x541d19[_0x9a2f('0x9')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x9a2f('0xa'),'fields':[_0x9a2f('0xb'),_0x9a2f('0xc')]},{'unique':!![],'name':_0x9a2f('0xd'),'fields':[_0x9a2f('0xb'),_0x9a2f('0xe')]},{'unique':!![],'name':_0x9a2f('0xf'),'fields':['name',_0x9a2f('0x10')]},{'unique':!![],'name':'name_sms','fields':[_0x9a2f('0xb'),_0x9a2f('0x11')]},{'unique':!![],'name':_0x9a2f('0x12'),'fields':['name','FaxAccountId']},{'unique':!![],'name':_0x9a2f('0x13'),'fields':['name',_0x9a2f('0x14')]},{'unique':!![],'name':_0x9a2f('0x15'),'fields':[_0x9a2f('0xb'),_0x9a2f('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 75a2d71..7692935 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(_0x4f786c,_0x30a692){var _0x100a9e=function(_0x141870){while(--_0x141870){_0x4f786c['push'](_0x4f786c['shift']());}};_0x100a9e(++_0x30a692);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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(_0x2c0474,_0x373c5d){var _0x513fcb=function(_0x439178){while(--_0x439178){_0x2c0474['push'](_0x2c0474['shift']());}};_0x513fcb(++_0x373c5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index e09995e..b366f5d 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 _0xfe49=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','show','post','create','put','/:id','delete','destroy','exports','multer','util','express','Router'];(function(_0x530b6e,_0x2463d9){var _0x6cb809=function(_0x42c09c){while(--_0x42c09c){_0x530b6e['push'](_0x530b6e['shift']());}};_0x6cb809(++_0x2463d9);}(_0xfe49,0x12c));var _0x9fe4=function(_0x25c01f,_0xcfcb25){_0x25c01f=_0x25c01f-0x0;var _0x302799=_0xfe49[_0x25c01f];return _0x302799;};'use strict';var multer=require(_0x9fe4('0x0'));var util=require(_0x9fe4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9fe4('0x2'));var router=express[_0x9fe4('0x3')]();var fs_extra=require(_0x9fe4('0x4'));var auth=require(_0x9fe4('0x5'));var interaction=require(_0x9fe4('0x6'));var config=require(_0x9fe4('0x7'));var controller=require(_0x9fe4('0x8'));router[_0x9fe4('0x9')]('/',auth[_0x9fe4('0xa')](),controller['index']);router[_0x9fe4('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x9fe4('0xb')]);router[_0x9fe4('0xc')]('/',auth['isAuthenticated'](),controller[_0x9fe4('0xd')]);router[_0x9fe4('0xe')](_0x9fe4('0xf'),auth[_0x9fe4('0xa')](),controller['update']);router[_0x9fe4('0x10')]('/:id',auth[_0x9fe4('0xa')](),controller[_0x9fe4('0x11')]);module[_0x9fe4('0x12')]=router; \ No newline at end of file +var _0x63b4=['update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','show','create','put'];(function(_0x5e9a69,_0x40c0ec){var _0x5979c8=function(_0x293da2){while(--_0x293da2){_0x5e9a69['push'](_0x5e9a69['shift']());}};_0x5979c8(++_0x40c0ec);}(_0x63b4,0xf3));var _0x463b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x63b4[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x463b('0x0'));var util=require(_0x463b('0x1'));var path=require('path');var timeout=require(_0x463b('0x2'));var express=require(_0x463b('0x3'));var router=express['Router']();var fs_extra=require(_0x463b('0x4'));var auth=require(_0x463b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0x463b('0x6')]('/',auth['isAuthenticated'](),controller[_0x463b('0x7')]);router[_0x463b('0x6')](_0x463b('0x8'),auth[_0x463b('0x9')](),controller[_0x463b('0xa')]);router['post']('/',auth[_0x463b('0x9')](),controller[_0x463b('0xb')]);router[_0x463b('0xc')](_0x463b('0x8'),auth[_0x463b('0x9')](),controller[_0x463b('0xd')]);router['delete'](_0x463b('0x8'),auth[_0x463b('0x9')](),controller[_0x463b('0xe')]);module[_0x463b('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 6555d0b..51b1273 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 _0xc1ab=['STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','9600','12000','2400','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x18dfea,_0x43d571){var _0x5222e3=function(_0x3484ae){while(--_0x3484ae){_0x18dfea['push'](_0x18dfea['shift']());}};_0x5222e3(++_0x43d571);}(_0xc1ab,0x16b));var _0xbc1a=function(_0x1f599f,_0x4949fb){_0x1f599f=_0x1f599f-0x0;var _0x97bfce=_0xc1ab[_0x1f599f];return _0x97bfce;};'use strict';var Sequelize=require(_0xbc1a('0x0'));module['exports']={'name':{'type':Sequelize[_0xbc1a('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbc1a('0x1')]},'ecm':{'type':Sequelize[_0xbc1a('0x2')](_0xbc1a('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0xbc1a('0x4')},'localstationid':{'type':Sequelize[_0xbc1a('0x1')],'unique':_0xbc1a('0x5')},'minrate':{'type':Sequelize['ENUM']('2400',_0xbc1a('0x6'),_0xbc1a('0x7'),_0xbc1a('0x8'),_0xbc1a('0x9'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize['ENUM'](_0xbc1a('0xa'),_0xbc1a('0x6'),_0xbc1a('0x7'),_0xbc1a('0x8'),_0xbc1a('0x9'),_0xbc1a('0xb')),'defaultValue':_0xbc1a('0xb')},'modem':{'type':Sequelize[_0xbc1a('0x1')],'defaultValue':_0xbc1a('0xc')},'gateway':{'type':Sequelize[_0xbc1a('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xbc1a('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xbc1a('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xbc1a('0x2')](_0xbc1a('0xe'),_0xbc1a('0xf'),_0xbc1a('0x10'),_0xbc1a('0x11')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xbc1a('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xbc1a('0x12')],'defaultValue':function(){return _0xbc1a('0x13');}},'notificationSound':{'type':Sequelize[_0xbc1a('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbc1a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbc1a('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbc1a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbc1a('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0xbc1a('0x15')},'mandatoryDisposition':{'type':Sequelize[_0xbc1a('0x14')],'defaultValue':![],'comment':_0xbc1a('0x16'),'set':function(_0x2a8164){if(!_0x2a8164)this[_0xbc1a('0x17')](_0xbc1a('0x18'),null);this[_0xbc1a('0x17')](_0xbc1a('0x19'),_0x2a8164);}}}; \ No newline at end of file +var _0xb796=['12000','14400','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600'];(function(_0x4ec9e3,_0x15fbf4){var _0x2883ce=function(_0x3e9998){while(--_0x3e9998){_0x4ec9e3['push'](_0x4ec9e3['shift']());}};_0x2883ce(++_0x15fbf4);}(_0xb796,0x77));var _0x6b79=function(_0x23cff2,_0x1a8662){_0x23cff2=_0x23cff2-0x0;var _0x4620c7=_0xb796[_0x23cff2];return _0x4620c7;};'use strict';var Sequelize=require(_0x6b79('0x0'));module[_0x6b79('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6b79('0x2')]},'ecm':{'type':Sequelize[_0x6b79('0x3')](_0x6b79('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x6b79('0x2')],'defaultValue':_0x6b79('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x6b79('0x6')},'minrate':{'type':Sequelize[_0x6b79('0x3')](_0x6b79('0x7'),_0x6b79('0x8'),_0x6b79('0x9'),_0x6b79('0xa'),'12000','14400'),'defaultValue':_0x6b79('0x8')},'maxrate':{'type':Sequelize['ENUM'](_0x6b79('0x7'),'4800',_0x6b79('0x9'),_0x6b79('0xa'),_0x6b79('0xb'),_0x6b79('0xc')),'defaultValue':_0x6b79('0xc')},'modem':{'type':Sequelize[_0x6b79('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x6b79('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x6b79('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x6b79('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x6b79('0x3')](_0x6b79('0xe'),_0x6b79('0xf'),_0x6b79('0x10'),_0x6b79('0x11')),'defaultValue':_0x6b79('0xe')},'key':{'type':Sequelize[_0x6b79('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6b79('0x12')],'defaultValue':function(){return _0x6b79('0x13');}},'notificationSound':{'type':Sequelize[_0x6b79('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6b79('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6b79('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6b79('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6b79('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6b79('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6b79('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6b79('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x6b79('0x15')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6b79('0x16'),'set':function(_0x2cb4f5){if(!_0x2cb4f5)this[_0x6b79('0x17')](_0x6b79('0x18'),null);this[_0x6b79('0x17')](_0x6b79('0x19'),_0x2cb4f5);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 1ad416d..1b8e9f1 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 _0x096b=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','destroy','get','status','stack','name','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','options','include','rows','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','userProfileId','UserProfileResource','update','body','describe','addDisposition','Disposition','getDispositions','findOne','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','FaxInteraction','addInteraction','omit','getInteractions','CmContact','Tag','Tags','tag','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','FaxApplication','FaxAccountId','bulkCreate','priority','finally','sendStatus','send','getApplications','exten','localstationid','app','system','description','appdata','push','Answer','Set','ecm','gateway','faxdetect','minrate','modem','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','defaults','out','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','User','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto'];(function(_0xc3d6f2,_0xd5abf7){var _0x439d5c=function(_0x375a9e){while(--_0x375a9e){_0xc3d6f2['push'](_0xc3d6f2['shift']());}};_0x439d5c(++_0xd5abf7);}(_0x096b,0x176));var _0xb096=function(_0x8be112,_0x1362c2){_0x8be112=_0x8be112-0x0;var _0x5a7a53=_0x096b[_0x8be112];return _0x5a7a53;};'use strict';var emlformat=require(_0xb096('0x0'));var rimraf=require(_0xb096('0x1'));var zipdir=require(_0xb096('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb096('0x3'));var moment=require(_0xb096('0x4'));var BPromise=require(_0xb096('0x5'));var Mustache=require(_0xb096('0x6'));var util=require(_0xb096('0x7'));var path=require(_0xb096('0x8'));var sox=require(_0xb096('0x9'));var csv=require(_0xb096('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb096('0xb'));var _=require('lodash');var squel=require(_0xb096('0xc'));var crypto=require(_0xb096('0xd'));var jsforce=require(_0xb096('0xe'));var deskjs=require(_0xb096('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb096('0x10'));var Papa=require(_0xb096('0x11'));var Redis=require('ioredis');var authService=require(_0xb096('0x12'));var qs=require(_0xb096('0x13'));var as=require(_0xb096('0x14'));var hardwareService=require(_0xb096('0x15'));var logger=require(_0xb096('0x16'))('api');var utils=require(_0xb096('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb096('0x18'));var db=require('../../mysqldb')['db'];config[_0xb096('0x19')]=_['defaults'](config[_0xb096('0x19')],{'host':_0xb096('0x1a'),'port':0x18eb});var socket=require(_0xb096('0x1b'))(new Redis(config[_0xb096('0x19')]));require(_0xb096('0x1c'))[_0xb096('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb096('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xb096('0x1e')][_0xb096('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x403de6,_0x44f8a7,_0x4d476c,_0x222285){return new BPromise(function(_0xbe258a,_0x273276){var _0x3dc7c9=_0x222285||client;return _0x3dc7c9[_0xb096('0x20')](_0x403de6,_0x4d476c)[_0xb096('0x21')](function(_0x14cab5){logger[_0xb096('0x22')](_0xb096('0x23'),_0x44f8a7,_0xb096('0x24'));logger[_0xb096('0x25')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x44f8a7,_0xb096('0x24'),JSON[_0xb096('0x26')](_0x14cab5));if(_0x14cab5[_0xb096('0x27')]){if(_0x14cab5[_0xb096('0x27')][_0xb096('0x28')]===0x1f4){logger[_0xb096('0x27')]('FaxAccount,\x20%s,\x20%s',_0x44f8a7,_0x14cab5['error']['message']);return _0x273276(_0x14cab5[_0xb096('0x27')][_0xb096('0x29')]);}logger[_0xb096('0x27')](_0xb096('0x23'),_0x44f8a7,_0x14cab5['error']['message']);return _0xbe258a(_0x14cab5[_0xb096('0x27')][_0xb096('0x29')]);}else{logger[_0xb096('0x22')](_0xb096('0x23'),_0x44f8a7,_0xb096('0x24'));_0xbe258a(_0x14cab5[_0xb096('0x2a')][_0xb096('0x29')]);}})[_0xb096('0x2b')](function(_0xe6b293){logger[_0xb096('0x27')](_0xb096('0x23'),_0x44f8a7,_0xe6b293);_0x273276(_0xe6b293);});});}function respondWithStatusCode(_0x22c8d8,_0x3707c0){_0x3707c0=_0x3707c0||0xcc;return function(_0x162e5d){if(_0x162e5d){return _0x22c8d8['sendStatus'](_0x3707c0);}return _0x22c8d8['status'](_0x3707c0)[_0xb096('0x2c')]();};}function respondWithResult(_0x59aab2,_0x175bcb){_0x175bcb=_0x175bcb||0xc8;return function(_0x260659){if(_0x260659){return _0x59aab2['status'](_0x175bcb)[_0xb096('0x2d')](_0x260659);}};}function respondWithFilteredResult(_0x313efa,_0x40655f){return function(_0x305a1e){if(_0x305a1e){var _0x5351a3=typeof _0x40655f[_0xb096('0x2e')]==='undefined'&&typeof _0x40655f['limit']===_0xb096('0x2f');var _0x67e6b3=_0x305a1e[_0xb096('0x30')];var _0x5917f9=_0x5351a3?0x0:_0x40655f[_0xb096('0x2e')];var _0x5bb532=_0x5351a3?_0x305a1e[_0xb096('0x30')]:_0x40655f[_0xb096('0x2e')]+_0x40655f[_0xb096('0x31')];var _0x1e11d0;if(_0x5bb532>=_0x67e6b3){_0x5bb532=_0x67e6b3;_0x1e11d0=0xc8;}else{_0x1e11d0=0xce;}_0x313efa['status'](_0x1e11d0);return _0x313efa['set'](_0xb096('0x32'),_0x5917f9+'-'+_0x5bb532+'/'+_0x67e6b3)[_0xb096('0x2d')](_0x305a1e);}return null;};}function patchUpdates(_0x53a216){return function(_0x5ec0cf){try{jsonpatch[_0xb096('0x33')](_0x5ec0cf,_0x53a216,!![]);}catch(_0x380a27){return BPromise[_0xb096('0x34')](_0x380a27);}return _0x5ec0cf[_0xb096('0x35')]();};}function saveUpdates(_0x1ce576,_0x40c513){return function(_0x49e676){if(_0x49e676){return _0x49e676['update'](_0x1ce576)[_0xb096('0x21')](function(_0x54f588){return _0x54f588;});}return null;};}function removeEntity(_0x25f5bc,_0x586af0){return function(_0x87e557){if(_0x87e557){return _0x87e557[_0xb096('0x36')]()['then'](function(){var _0x1baa2e=_0x87e557[_0xb096('0x37')]({'plain':!![]});var _0x3027aa='FaxAccounts';return db['UserProfileResource'][_0xb096('0x36')]({'where':{'type':_0x3027aa,'resourceId':_0x1baa2e['id']}})[_0xb096('0x21')](function(){return _0x87e557;});})['then'](function(){_0x25f5bc[_0xb096('0x38')](0xcc)[_0xb096('0x2c')]();});}};}function handleEntityNotFound(_0x144b8d,_0x3aba70){return function(_0x56e774){if(!_0x56e774){_0x144b8d['sendStatus'](0x194);}return _0x56e774;};}function handleError(_0x18dd32,_0x33bf50){_0x33bf50=_0x33bf50||0x1f4;return function(_0x571e06){logger[_0xb096('0x27')](_0x571e06[_0xb096('0x39')]);if(_0x571e06['name']){delete _0x571e06[_0xb096('0x3a')];}_0x18dd32[_0xb096('0x38')](_0x33bf50)['send'](_0x571e06);};}exports['index']=function(_0x5ed0e2,_0x4b3abb){var _0x333d08={'include':[{'model':db[_0xb096('0x3b')],'as':_0xb096('0x3c')}]},_0x480cba={},_0x301505={'count':0x0,'rows':[]};var _0x17e064=_['map'](db[_0xb096('0x3d')][_0xb096('0x3e')],function(_0x314b45){return{'name':_0x314b45[_0xb096('0x3f')],'type':_0x314b45[_0xb096('0x40')][_0xb096('0x41')]};});_0x480cba[_0xb096('0x42')]=_['map'](_0x17e064,_0xb096('0x3a'));_0x480cba[_0xb096('0x43')]=_[_0xb096('0x44')](_0x5ed0e2[_0xb096('0x43')]);_0x480cba[_0xb096('0x45')]=_[_0xb096('0x46')](_0x480cba['model'],_0x480cba[_0xb096('0x43')]);_0x333d08[_0xb096('0x47')]=_[_0xb096('0x46')](_0x480cba[_0xb096('0x42')],qs[_0xb096('0x48')](_0x5ed0e2['query'][_0xb096('0x48')]));_0x333d08[_0xb096('0x47')]=_0x333d08[_0xb096('0x47')][_0xb096('0x49')]?_0x333d08[_0xb096('0x47')]:_0x480cba[_0xb096('0x42')];if(!_0x5ed0e2[_0xb096('0x43')][_0xb096('0x4a')](_0xb096('0x4b'))){_0x333d08[_0xb096('0x31')]=qs['limit'](_0x5ed0e2[_0xb096('0x43')][_0xb096('0x31')]);_0x333d08[_0xb096('0x2e')]=qs[_0xb096('0x2e')](_0x5ed0e2[_0xb096('0x43')][_0xb096('0x2e')]);}_0x333d08[_0xb096('0x4c')]=qs[_0xb096('0x4d')](_0x5ed0e2['query']['sort']);_0x333d08[_0xb096('0x4e')]=qs['filters'](_[_0xb096('0x4f')](_0x5ed0e2[_0xb096('0x43')],_0x480cba[_0xb096('0x45')]),_0x17e064);if(_0x5ed0e2[_0xb096('0x43')]['filter']){_0x333d08[_0xb096('0x4e')]=_[_0xb096('0x50')](_0x333d08[_0xb096('0x4e')],{'$or':_[_0xb096('0x51')](_0x17e064,function(_0xd65edd){if(_0xd65edd['type']!==_0xb096('0x52')){var _0x45a1c3={};_0x45a1c3[_0xd65edd[_0xb096('0x3a')]]={'$like':'%'+_0x5ed0e2[_0xb096('0x43')][_0xb096('0x53')]+'%'};return _0x45a1c3;}})});}_0x333d08=_[_0xb096('0x50')]({},_0x333d08,_0x5ed0e2[_0xb096('0x54')]);var _0x2572e9={'where':_0x333d08[_0xb096('0x4e')]};return db[_0xb096('0x3d')][_0xb096('0x30')](_0x2572e9)[_0xb096('0x21')](function(_0x28b074){_0x301505['count']=_0x28b074;if(_0x5ed0e2[_0xb096('0x43')]['includeAll']){_0x333d08[_0xb096('0x55')]=[{'all':!![]}];}return db[_0xb096('0x3d')]['findAll'](_0x333d08);})[_0xb096('0x21')](function(_0x4b66e2){_0x301505[_0xb096('0x56')]=_0x4b66e2;return _0x301505;})[_0xb096('0x21')](respondWithFilteredResult(_0x4b3abb,_0x333d08))[_0xb096('0x2b')](handleError(_0x4b3abb,null));};exports['show']=function(_0x3028ad,_0x4afb93){var _0x444dfa={'raw':![],'where':{'id':_0x3028ad[_0xb096('0x57')]['id']},'include':[{'model':db[_0xb096('0x3b')],'as':_0xb096('0x3c')}]},_0x26ec3b={};_0x26ec3b['model']=_[_0xb096('0x44')](db[_0xb096('0x3d')][_0xb096('0x3e')]);_0x26ec3b[_0xb096('0x43')]=_[_0xb096('0x44')](_0x3028ad[_0xb096('0x43')]);_0x26ec3b[_0xb096('0x45')]=_[_0xb096('0x46')](_0x26ec3b[_0xb096('0x42')],_0x26ec3b[_0xb096('0x43')]);_0x444dfa[_0xb096('0x47')]=_[_0xb096('0x46')](_0x26ec3b[_0xb096('0x42')],qs[_0xb096('0x48')](_0x3028ad['query']['fields']));_0x444dfa[_0xb096('0x47')]=_0x444dfa[_0xb096('0x47')][_0xb096('0x49')]?_0x444dfa[_0xb096('0x47')]:_0x26ec3b[_0xb096('0x42')];if(_0x3028ad[_0xb096('0x43')][_0xb096('0x58')]){_0x444dfa[_0xb096('0x55')]=[{'all':!![]}];}_0x444dfa=_[_0xb096('0x50')]({},_0x444dfa,_0x3028ad[_0xb096('0x54')]);return db['FaxAccount'][_0xb096('0x59')](_0x444dfa)['then'](handleEntityNotFound(_0x4afb93,null))[_0xb096('0x21')](respondWithResult(_0x4afb93,null))[_0xb096('0x2b')](handleError(_0x4afb93,null));};exports[_0xb096('0x5a')]=function(_0x326b4c,_0x3dce78){return db['FaxAccount']['create'](_0x326b4c['body'],{})[_0xb096('0x21')](function(_0x5d3d75){var _0x2ebd21=_0x326b4c[_0xb096('0x5b')]['get']({'plain':!![]});if(!_0x2ebd21)throw new Error(_0xb096('0x5c'));if(_0x2ebd21[_0xb096('0x5d')]===_0xb096('0x5b')){var _0x1212f8=_0x5d3d75['get']({'plain':!![]});var _0x3520ec=_0xb096('0x5e');return db[_0xb096('0x5f')][_0xb096('0x59')]({'where':{'name':_0x3520ec,'userProfileId':_0x2ebd21[_0xb096('0x60')]},'raw':!![]})['then'](function(_0x128a42){if(_0x128a42&&_0x128a42['autoAssociation']===0x0){return db[_0xb096('0x61')][_0xb096('0x5a')]({'name':_0x1212f8['name'],'resourceId':_0x1212f8['id'],'type':_0x128a42['name'],'sectionId':_0x128a42['id']},{})['then'](function(){return _0x5d3d75;});}else{return _0x5d3d75;}})[_0xb096('0x2b')](function(_0x1c4365){logger[_0xb096('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c4365);throw _0x1c4365;});}return _0x5d3d75;})[_0xb096('0x21')](respondWithResult(_0x3dce78,0xc9))[_0xb096('0x2b')](handleError(_0x3dce78,null));};exports[_0xb096('0x62')]=function(_0x44af2d,_0x34b4f5){if(_0x44af2d[_0xb096('0x63')]['id']){delete _0x44af2d['body']['id'];}return db[_0xb096('0x3d')]['find']({'where':{'id':_0x44af2d['params']['id']},'include':[{'model':db[_0xb096('0x3b')],'as':_0xb096('0x3c')}]})[_0xb096('0x21')](handleEntityNotFound(_0x34b4f5,null))[_0xb096('0x21')](saveUpdates(_0x44af2d['body'],null))['then'](respondWithResult(_0x34b4f5,null))[_0xb096('0x2b')](handleError(_0x34b4f5,null));};exports[_0xb096('0x36')]=function(_0x30568e,_0x48bbb0){return db[_0xb096('0x3d')][_0xb096('0x59')]({'where':{'id':_0x30568e[_0xb096('0x57')]['id']}})['then'](handleEntityNotFound(_0x48bbb0,null))[_0xb096('0x21')](removeEntity(_0x48bbb0,null))[_0xb096('0x2b')](handleError(_0x48bbb0,null));};exports[_0xb096('0x64')]=function(_0x1748fc,_0x5c0467){return db[_0xb096('0x3d')]['describe']()[_0xb096('0x21')](respondWithResult(_0x5c0467,null))['catch'](handleError(_0x5c0467,null));};exports[_0xb096('0x65')]=function(_0x3a0e1d,_0x57afb4,_0x3133c2){if(_0x3a0e1d[_0xb096('0x63')]['id']){delete _0x3a0e1d['body']['id'];}return db[_0xb096('0x3d')][_0xb096('0x59')]({'where':{'id':_0x3a0e1d[_0xb096('0x57')]['id']}})[_0xb096('0x21')](handleEntityNotFound(_0x57afb4,null))[_0xb096('0x21')](function(_0x5bf31a){if(_0x5bf31a){_0x3a0e1d[_0xb096('0x63')]['FaxAccountId']=_0x5bf31a['id'];return db[_0xb096('0x66')]['create'](_0x3a0e1d['body']);}})['then'](respondWithResult(_0x57afb4,null))[_0xb096('0x2b')](handleError(_0x57afb4,null));};exports[_0xb096('0x67')]=function(_0x5d3f57,_0x3ba3a3,_0x3979cb){var _0x34df06={'raw':![],'where':{}};var _0x53297c={};var _0x1b57e0={'count':0x0,'rows':[]};return db[_0xb096('0x3d')][_0xb096('0x68')]({'where':{'id':_0x5d3f57[_0xb096('0x57')]['id']}})['then'](handleEntityNotFound(_0x3ba3a3,null))[_0xb096('0x21')](function(_0x58478d){if(_0x58478d){_0x53297c['model']=_[_0xb096('0x44')](db[_0xb096('0x66')][_0xb096('0x3e')]);_0x53297c[_0xb096('0x43')]=_[_0xb096('0x44')](_0x5d3f57[_0xb096('0x43')]);_0x53297c[_0xb096('0x45')]=_[_0xb096('0x46')](_0x53297c[_0xb096('0x42')],_0x53297c[_0xb096('0x43')]);_0x34df06[_0xb096('0x47')]=_[_0xb096('0x46')](_0x53297c['model'],qs[_0xb096('0x48')](_0x5d3f57[_0xb096('0x43')]['fields']));_0x34df06[_0xb096('0x47')]=_0x34df06[_0xb096('0x47')][_0xb096('0x49')]?_0x34df06['attributes']:_0x53297c[_0xb096('0x42')];if(!_0x5d3f57['query'][_0xb096('0x4a')](_0xb096('0x4b'))){_0x34df06['limit']=qs[_0xb096('0x31')](_0x5d3f57[_0xb096('0x43')][_0xb096('0x31')]);_0x34df06['offset']=qs[_0xb096('0x2e')](_0x5d3f57[_0xb096('0x43')][_0xb096('0x2e')]);}_0x34df06[_0xb096('0x4c')]=qs['sort'](_0x5d3f57[_0xb096('0x43')]['sort']);_0x34df06[_0xb096('0x4e')]=qs[_0xb096('0x45')](_[_0xb096('0x4f')](_0x5d3f57['query'],_0x53297c[_0xb096('0x45')]));_0x34df06[_0xb096('0x4e')]['FaxAccountId']=_0x58478d['id'];if(_0x5d3f57['query'][_0xb096('0x53')]){_0x34df06[_0xb096('0x4e')]=_[_0xb096('0x50')](_0x34df06[_0xb096('0x4e')],{'$or':_['map'](_0x34df06['attributes'],function(_0x4db0d0){var _0x2e9f3f={};_0x2e9f3f[_0x4db0d0]={'$like':'%'+_0x5d3f57[_0xb096('0x43')][_0xb096('0x53')]+'%'};return _0x2e9f3f;})});}_0x34df06=_[_0xb096('0x50')]({},_0x34df06,_0x5d3f57['options']);return db['Disposition'][_0xb096('0x30')]({'where':_0x34df06[_0xb096('0x4e')]})[_0xb096('0x21')](function(_0xe49b29){_0x1b57e0[_0xb096('0x30')]=_0xe49b29;if(_0x5d3f57['query'][_0xb096('0x58')]){_0x34df06[_0xb096('0x55')]=[{'all':!![]}];}return db['Disposition'][_0xb096('0x69')](_0x34df06);})[_0xb096('0x21')](function(_0x1e0b62){_0x1b57e0['rows']=_0x1e0b62;return _0x1b57e0;});}})['then'](respondWithFilteredResult(_0x3ba3a3,_0x34df06))[_0xb096('0x2b')](handleError(_0x3ba3a3,null));};exports['removeDispositions']=function(_0xb180ff,_0x35a529,_0x3bcce9){return db[_0xb096('0x3d')][_0xb096('0x59')]({'where':{'id':_0xb180ff[_0xb096('0x57')]['id']}})[_0xb096('0x21')](handleEntityNotFound(_0x35a529,null))[_0xb096('0x21')](function(_0x4fc868){if(_0x4fc868){return _0x4fc868[_0xb096('0x6a')](_0xb180ff[_0xb096('0x43')]['ids']);}})[_0xb096('0x21')](respondWithStatusCode(_0x35a529,null))['catch'](handleError(_0x35a529,null));};exports[_0xb096('0x6b')]=function(_0x19b07a,_0x260739,_0x78a958){if(_0x19b07a[_0xb096('0x63')]['id']){delete _0x19b07a['body']['id'];}return db['FaxAccount'][_0xb096('0x59')]({'where':{'id':_0x19b07a[_0xb096('0x57')]['id']}})['then'](handleEntityNotFound(_0x260739,null))['then'](function(_0x1a3c00){if(_0x1a3c00){_0x19b07a[_0xb096('0x63')]['FaxAccountId']=_0x1a3c00['id'];return db[_0xb096('0x6c')][_0xb096('0x5a')](_0x19b07a[_0xb096('0x63')]);}})[_0xb096('0x21')](respondWithResult(_0x260739,null))['catch'](handleError(_0x260739,null));};exports[_0xb096('0x6d')]=function(_0x550a82,_0x4b7cf6,_0x58a1c4){var _0x386f71={'raw':![],'where':{}};var _0xfcf3ed={};var _0x2e7031={'count':0x0,'rows':[]};return db['FaxAccount'][_0xb096('0x68')]({'where':{'id':_0x550a82[_0xb096('0x57')]['id']}})[_0xb096('0x21')](handleEntityNotFound(_0x4b7cf6,null))[_0xb096('0x21')](function(_0x46e417){if(_0x46e417){_0xfcf3ed['model']=_[_0xb096('0x44')](db['CannedAnswer'][_0xb096('0x3e')]);_0xfcf3ed[_0xb096('0x43')]=_[_0xb096('0x44')](_0x550a82[_0xb096('0x43')]);_0xfcf3ed['filters']=_[_0xb096('0x46')](_0xfcf3ed['model'],_0xfcf3ed[_0xb096('0x43')]);_0x386f71[_0xb096('0x47')]=_[_0xb096('0x46')](_0xfcf3ed[_0xb096('0x42')],qs['fields'](_0x550a82[_0xb096('0x43')]['fields']));_0x386f71[_0xb096('0x47')]=_0x386f71[_0xb096('0x47')]['length']?_0x386f71[_0xb096('0x47')]:_0xfcf3ed[_0xb096('0x42')];if(!_0x550a82['query'][_0xb096('0x4a')](_0xb096('0x4b'))){_0x386f71[_0xb096('0x31')]=qs[_0xb096('0x31')](_0x550a82[_0xb096('0x43')][_0xb096('0x31')]);_0x386f71[_0xb096('0x2e')]=qs[_0xb096('0x2e')](_0x550a82[_0xb096('0x43')]['offset']);}_0x386f71[_0xb096('0x4c')]=qs[_0xb096('0x4d')](_0x550a82[_0xb096('0x43')][_0xb096('0x4d')]);_0x386f71['where']=qs[_0xb096('0x45')](_[_0xb096('0x4f')](_0x550a82[_0xb096('0x43')],_0xfcf3ed[_0xb096('0x45')]));_0x386f71['where']['FaxAccountId']=_0x46e417['id'];if(_0x550a82['query'][_0xb096('0x53')]){_0x386f71[_0xb096('0x4e')]=_[_0xb096('0x50')](_0x386f71[_0xb096('0x4e')],{'$or':_[_0xb096('0x51')](_0x386f71[_0xb096('0x47')],function(_0x5d063b){var _0x427566={};_0x427566[_0x5d063b]={'$like':'%'+_0x550a82[_0xb096('0x43')][_0xb096('0x53')]+'%'};return _0x427566;})});}_0x386f71=_[_0xb096('0x50')]({},_0x386f71,_0x550a82[_0xb096('0x54')]);return db[_0xb096('0x6c')][_0xb096('0x30')]({'where':_0x386f71[_0xb096('0x4e')]})[_0xb096('0x21')](function(_0x4eddf0){_0x2e7031['count']=_0x4eddf0;if(_0x550a82[_0xb096('0x43')][_0xb096('0x58')]){_0x386f71[_0xb096('0x55')]=[{'all':!![]}];}return db[_0xb096('0x6c')][_0xb096('0x69')](_0x386f71);})[_0xb096('0x21')](function(_0x277eae){_0x2e7031[_0xb096('0x56')]=_0x277eae;return _0x2e7031;});}})[_0xb096('0x21')](respondWithFilteredResult(_0x4b7cf6,_0x386f71))[_0xb096('0x2b')](handleError(_0x4b7cf6,null));};exports[_0xb096('0x6e')]=function(_0xc025c6,_0x426c90,_0x3aa5b6){return db[_0xb096('0x3d')][_0xb096('0x59')]({'where':{'id':_0xc025c6[_0xb096('0x57')]['id']}})[_0xb096('0x21')](handleEntityNotFound(_0x426c90,null))['then'](function(_0x48a0f6){if(_0x48a0f6){return _0x48a0f6[_0xb096('0x6e')](_0xc025c6['query'][_0xb096('0x6f')]);}})[_0xb096('0x21')](respondWithStatusCode(_0x426c90,null))[_0xb096('0x2b')](handleError(_0x426c90,null));};exports['addInteraction']=function(_0x35eab2,_0x322965,_0x2e6ac){return db[_0xb096('0x70')][_0xb096('0x59')]({'where':{'id':_0x35eab2[_0xb096('0x57')]['id']}})[_0xb096('0x21')](handleEntityNotFound(_0x322965,null))[_0xb096('0x21')](function(_0x46137e){if(_0x46137e){return _0x46137e[_0xb096('0x71')](_0x35eab2[_0xb096('0x63')][_0xb096('0x6f')],_[_0xb096('0x72')](_0x35eab2[_0xb096('0x63')],[_0xb096('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x322965,null))[_0xb096('0x2b')](handleError(_0x322965,null));};exports[_0xb096('0x73')]=function(_0x242fd6,_0x58c66b,_0x4cbc4f){var _0x155286={'raw':![],'where':{}};var _0x5486ad={};var _0x1f5bc5={'count':0x0,'rows':[]};return db[_0xb096('0x3d')][_0xb096('0x68')]({'where':{'id':_0x242fd6[_0xb096('0x57')]['id']}})[_0xb096('0x21')](handleEntityNotFound(_0x58c66b,null))[_0xb096('0x21')](function(_0x14cf17){if(_0x14cf17){_0x5486ad['model']=_['keys'](db[_0xb096('0x70')][_0xb096('0x3e')]);_0x5486ad[_0xb096('0x43')]=_[_0xb096('0x44')](_0x242fd6[_0xb096('0x43')]);_0x5486ad[_0xb096('0x45')]=_['intersection'](_0x5486ad[_0xb096('0x42')],_0x5486ad[_0xb096('0x43')]);_0x155286[_0xb096('0x47')]=_[_0xb096('0x46')](_0x5486ad[_0xb096('0x42')],qs[_0xb096('0x48')](_0x242fd6[_0xb096('0x43')][_0xb096('0x48')]));_0x155286[_0xb096('0x47')]=_0x155286[_0xb096('0x47')][_0xb096('0x49')]?_0x155286[_0xb096('0x47')]:_0x5486ad['model'];if(!_0x242fd6[_0xb096('0x43')][_0xb096('0x4a')](_0xb096('0x4b'))){_0x155286[_0xb096('0x31')]=qs[_0xb096('0x31')](_0x242fd6[_0xb096('0x43')][_0xb096('0x31')]);_0x155286['offset']=qs['offset'](_0x242fd6['query']['offset']);}_0x155286[_0xb096('0x4c')]=qs[_0xb096('0x4d')](_0x242fd6[_0xb096('0x43')][_0xb096('0x4d')]);_0x155286[_0xb096('0x4e')]=qs[_0xb096('0x45')](_[_0xb096('0x4f')](_0x242fd6[_0xb096('0x43')],_0x5486ad['filters']));_0x155286[_0xb096('0x4e')]['FaxAccountId']=_0x14cf17['id'];if(_0x242fd6['query']['filter']){_0x155286[_0xb096('0x4e')]=_[_0xb096('0x50')](_0x155286[_0xb096('0x4e')],{'$or':_['map'](_0x155286[_0xb096('0x47')],function(_0x15fca7){var _0x2cbf03={};_0x2cbf03[_0x15fca7]={'$like':'%'+_0x242fd6[_0xb096('0x43')][_0xb096('0x53')]+'%'};return _0x2cbf03;})});}_0x155286=_[_0xb096('0x50')]({},_0x155286,_0x242fd6[_0xb096('0x54')]);return db[_0xb096('0x70')][_0xb096('0x30')]({'where':_0x155286[_0xb096('0x4e')]})['then'](function(_0x47e116){_0x1f5bc5['count']=_0x47e116;if(_0x242fd6[_0xb096('0x43')][_0xb096('0x58')]){_0x155286[_0xb096('0x55')]=[{'model':db[_0xb096('0x74')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xb096('0x3a'),'fullname','internal'],'required':![]},{'model':db[_0xb096('0x75')],'as':_0xb096('0x76'),'attributes':['id',_0xb096('0x3a'),'color'],'where':_0x242fd6[_0xb096('0x43')][_0xb096('0x77')]?{'id':_0x242fd6[_0xb096('0x43')][_0xb096('0x77')]}:undefined,'required':_0x242fd6[_0xb096('0x43')][_0xb096('0x77')]?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x155286);})[_0xb096('0x21')](function(_0x31ddba){_0x1f5bc5[_0xb096('0x56')]=_0x31ddba;return _0x1f5bc5;});}})[_0xb096('0x21')](respondWithFilteredResult(_0x58c66b,_0x155286))['catch'](handleError(_0x58c66b,null));};exports[_0xb096('0x78')]=function(_0x5d83fe,_0x1bdc85){var _0x58fcf4=_0x5d83fe[_0xb096('0x57')]['id'];var _0x3c1b77=_0x5d83fe[_0xb096('0x63')];var _0x33b8db=0xc8;var _0x41cb83=null;return db['sequelize'][_0xb096('0x79')]({'isolationLevel':db[_0xb096('0x7a')][_0xb096('0x7b')]['ISOLATION_LEVELS'][_0xb096('0x7c')]},function(_0x233282){return db[_0xb096('0x3d')][_0xb096('0x68')]({'where':{'id':_0x58fcf4},'transaction':_0x233282})[_0xb096('0x21')](function(_0x790d9b){if(_0x790d9b){return db[_0xb096('0x7d')]['destroy']({'where':{'FaxAccountId':_0x58fcf4},'transaction':_0x233282})[_0xb096('0x21')](function(){var _0x5b927b=_[_0xb096('0x51')](_0x3c1b77,function(_0x18feba){_0x18feba[_0xb096('0x7e')]=_0x58fcf4;return _0x18feba;});return db['FaxApplication'][_0xb096('0x7f')](_0x5b927b,{'transaction':_0x233282});});}else{_0x33b8db=0x194;_0x41cb83=[];}});})['then'](function(){if(_0x33b8db!==0x194){return db[_0xb096('0x7d')]['findAndCountAll']({'where':{'FaxAccountId':_0x58fcf4},'order':_0xb096('0x80')})['then'](function(_0x587681){_0x41cb83=_0x587681;});}})[_0xb096('0x2b')](function(_0x3b03c5){_0x33b8db=0x1f4;logger[_0xb096('0x27')](_0x3b03c5[_0xb096('0x39')]);if(_0x3b03c5[_0xb096('0x3a')]){delete _0x3b03c5[_0xb096('0x3a')];}_0x41cb83=_0x3b03c5;})[_0xb096('0x81')](function(){if(_0x41cb83===null){_0x1bdc85[_0xb096('0x82')](_0x33b8db);}else{if(_0x33b8db===0x1f4){_0x1bdc85['status'](_0x33b8db)[_0xb096('0x83')](_0x41cb83);}else{_0x1bdc85[_0xb096('0x38')](_0x33b8db)[_0xb096('0x2d')](_0x41cb83);}}});};exports[_0xb096('0x84')]=function(_0x144fa0,_0x1852fb,_0x534807){var _0x3f5794={};var _0x406f9c={};var _0x3dfa86;var _0x551c3c;return db[_0xb096('0x3d')][_0xb096('0x68')]({'where':{'id':_0x144fa0[_0xb096('0x57')]['id']}})[_0xb096('0x21')](handleEntityNotFound(_0x1852fb,null))[_0xb096('0x21')](function(_0x5f4cb9){if(_0x5f4cb9){_0x3dfa86=_0x5f4cb9;_0x406f9c[_0xb096('0x42')]=_[_0xb096('0x44')](db['FaxApplication']['rawAttributes']);_0x406f9c['query']=_[_0xb096('0x44')](_0x144fa0[_0xb096('0x43')]);_0x406f9c['filters']=_[_0xb096('0x46')](_0x406f9c[_0xb096('0x42')],_0x406f9c[_0xb096('0x43')]);_0x3f5794['attributes']=_[_0xb096('0x46')](_0x406f9c[_0xb096('0x42')],qs[_0xb096('0x48')](_0x144fa0[_0xb096('0x43')][_0xb096('0x48')]));_0x3f5794['attributes']=_0x3f5794['attributes'][_0xb096('0x49')]?_0x3f5794['attributes']:_0x406f9c[_0xb096('0x42')];_0x3f5794[_0xb096('0x4c')]=qs[_0xb096('0x4d')](_0x144fa0[_0xb096('0x43')][_0xb096('0x4d')]);_0x3f5794[_0xb096('0x4e')]=qs[_0xb096('0x45')](_[_0xb096('0x4f')](_0x144fa0[_0xb096('0x43')],_0x406f9c[_0xb096('0x45')]));if(_0x144fa0[_0xb096('0x43')][_0xb096('0x53')]){_0x3f5794['where']=_[_0xb096('0x50')](_0x3f5794['where'],{'$or':_['map'](_0x3f5794[_0xb096('0x47')],function(_0x5408c8){var _0x2c0d16={};_0x2c0d16[_0x5408c8]={'$like':'%'+_0x144fa0['query'][_0xb096('0x53')]+'%'};return _0x2c0d16;})});}_0x3f5794=_['merge']({},_0x3f5794,_0x144fa0['options']);return _0x3dfa86[_0xb096('0x84')](_0x3f5794);}})[_0xb096('0x21')](function(_0x537a6d){if(_0x537a6d){_0x551c3c=_0x537a6d['length'];if(!_0x144fa0[_0xb096('0x43')][_0xb096('0x4a')](_0xb096('0x4b'))){_0x3f5794['limit']=qs['limit'](_0x144fa0[_0xb096('0x43')][_0xb096('0x31')]);_0x3f5794[_0xb096('0x2e')]=qs[_0xb096('0x2e')](_0x144fa0[_0xb096('0x43')]['offset']);}return _0x3dfa86[_0xb096('0x84')](_0x3f5794);}})[_0xb096('0x21')](function(_0x38d75){if(_0x38d75){return _0x38d75?{'count':_0x551c3c,'rows':_0x38d75}:null;}})[_0xb096('0x21')](respondWithResult(_0x1852fb,null))['catch'](handleError(_0x1852fb,null));};function Extension(_0x4bcba7,_0x8f134d,_0x4220f0,_0x16daec){this['context']='from-voip-provider';this[_0xb096('0x85')]=_0x4bcba7[_0xb096('0x86')];this[_0xb096('0x87')]=_0x16daec;this[_0xb096('0x40')]=_0xb096('0x88');this[_0xb096('0x89')]='Fax\x20Extension';this[_0xb096('0x7e')]=_0x4bcba7['id'];this[_0xb096('0x80')]=_0x8f134d;this[_0xb096('0x8a')]=_0x4220f0;}function createExtensionsReciveFax(_0x57c2dc){var _0x18cdd1=0x1;var _0x2b6a79=[];_0x2b6a79[_0xb096('0x8b')](new Extension(_0x57c2dc,_0x18cdd1,'',_0xb096('0x8c')));_0x18cdd1+=0x1;_0x2b6a79['push'](new Extension(_0x57c2dc,_0x18cdd1,'CDR(type)=inbound-fax',_0xb096('0x8d')));_0x18cdd1+=0x1;for(var _0x444422 in _0x57c2dc){if(_0x57c2dc[_0xb096('0x4a')](_0x444422)&&(_0x444422===_0xb096('0x8e')||_0x444422===_0xb096('0x86')||_0x444422===_0xb096('0x8f')||_0x444422===_0xb096('0x90')||_0x444422==='headerinfo'||_0x444422==='maxrate'||_0x444422===_0xb096('0x91')||_0x444422===_0xb096('0x92')||_0x444422==='t38timeout')){_0x2b6a79[_0xb096('0x8b')](new Extension(_0x57c2dc,_0x18cdd1,_0xb096('0x93')+_0x444422+')='+_0x57c2dc[_0x444422],_0xb096('0x8d')));_0x18cdd1+=0x1;}}_0x2b6a79[_0xb096('0x8b')](new Extension(_0x57c2dc,_0x18cdd1,'6','Wait'));_0x18cdd1+=0x1;_0x2b6a79[_0xb096('0x8b')](new Extension(_0x57c2dc,_0x18cdd1,_0xb096('0x94'),_0xb096('0x95')));_0x18cdd1=0x0;return _0x2b6a79;}exports[_0xb096('0x96')]=function(_0x4cdffa,_0x2633ff,_0x5c166e){var _0x585cc5;return db[_0xb096('0x7a')][_0xb096('0x79')](function(_0x80f4b2){return db[_0xb096('0x3d')][_0xb096('0x5a')](_0x4cdffa[_0xb096('0x63')],{'transaction':_0x80f4b2})[_0xb096('0x21')](function(_0x148dbc){_0x585cc5=_0x148dbc[_0xb096('0x37')]({'plain':!![]});return db[_0xb096('0x97')][_0xb096('0x7f')](createExtensionsReciveFax(_0x585cc5),{'transaction':_0x80f4b2});});})[_0xb096('0x21')](function(){return _0x585cc5;})[_0xb096('0x21')](respondWithResult(_0x2633ff,null))['catch'](handleError(_0x2633ff,null));};exports[_0xb096('0x98')]=function(_0x553cdc,_0x13f196,_0x4c8c34){var _0x3ddc19;return db['sequelize'][_0xb096('0x79')](function(_0x2605a6){return db[_0xb096('0x3d')][_0xb096('0x62')](_0x553cdc[_0xb096('0x63')],{'where':{'id':_0x553cdc['body']['id']},'transaction':_0x2605a6})[_0xb096('0x21')](function(_0x5d28b9){return db[_0xb096('0x97')][_0xb096('0x36')]({'where':{'FaxAccountId':_0x553cdc[_0xb096('0x63')]['id']},'transaction':_0x2605a6})[_0xb096('0x21')](function(_0x3ef089){return db[_0xb096('0x97')]['bulkCreate'](createExtensionsReciveFax(_['omit'](_0x553cdc[_0xb096('0x63')],[_0xb096('0x99'),_0xb096('0x41'),_0xb096('0x9a'),_0xb096('0x9b'),_0xb096('0x9c'),_0xb096('0x9d')])),{'transaction':_0x2605a6});});});})[_0xb096('0x21')](function(){return db[_0xb096('0x3d')][_0xb096('0x9e')](_0x553cdc['body']['id']);})['then'](respondWithResult(_0x13f196,null))['catch'](handleError(_0x13f196,null));};exports[_0xb096('0x9f')]=function(_0xb8cdf1,_0x3335e4,_0x20863d){var _0x392377={'raw':!![],'where':{}};var _0x57c77c={};var _0x355088={'count':0x0,'rows':[]};return db[_0xb096('0x3d')][_0xb096('0x68')]({'where':{'id':_0xb8cdf1[_0xb096('0x57')]['id']}})[_0xb096('0x21')](handleEntityNotFound(_0x3335e4,null))[_0xb096('0x21')](function(_0x470fa2){if(_0x470fa2){_0x57c77c[_0xb096('0x42')]=_[_0xb096('0x44')](db[_0xb096('0xa0')][_0xb096('0x3e')]);_0x57c77c[_0xb096('0x43')]=_[_0xb096('0x44')](_0xb8cdf1[_0xb096('0x43')]);_0x57c77c[_0xb096('0x45')]=_[_0xb096('0x46')](_0x57c77c[_0xb096('0x42')],_0x57c77c[_0xb096('0x43')]);_0x392377[_0xb096('0x47')]=_[_0xb096('0x46')](_0x57c77c['model'],qs[_0xb096('0x48')](_0xb8cdf1[_0xb096('0x43')][_0xb096('0x48')]));_0x392377['attributes']=_0x392377['attributes'][_0xb096('0x49')]?_0x392377[_0xb096('0x47')]:_0x57c77c[_0xb096('0x42')];if(!_0xb8cdf1['query'][_0xb096('0x4a')](_0xb096('0x4b'))){_0x392377[_0xb096('0x31')]=qs['limit'](_0xb8cdf1[_0xb096('0x43')][_0xb096('0x31')]);_0x392377['offset']=qs[_0xb096('0x2e')](_0xb8cdf1[_0xb096('0x43')][_0xb096('0x2e')]);}_0x392377[_0xb096('0x4c')]=qs[_0xb096('0x4d')](_0xb8cdf1[_0xb096('0x43')][_0xb096('0x4d')]);_0x392377[_0xb096('0x4e')]=qs[_0xb096('0x45')](_[_0xb096('0x4f')](_0xb8cdf1[_0xb096('0x43')],_0x57c77c[_0xb096('0x45')]));_0x392377[_0xb096('0x4e')][_0xb096('0x7e')]=_0x470fa2['id'];if(_0xb8cdf1[_0xb096('0x43')]['filter']){_0x392377['where']=_[_0xb096('0x50')](_0x392377['where'],{'$or':_['map'](_0x392377[_0xb096('0x47')],function(_0x2d6c06){var _0x50c8bd={};_0x50c8bd[_0x2d6c06]={'$like':'%'+_0xb8cdf1[_0xb096('0x43')]['filter']+'%'};return _0x50c8bd;})});}if(_0xb8cdf1[_0xb096('0x43')]['$gte']){var _0x5e6d76=_0xb8cdf1[_0xb096('0x43')][_0xb096('0xa1')][_0xb096('0xa2')](',');var _0x58846a={};_0x58846a[_0x5e6d76[0x0]]={'$gte':moment(_0x5e6d76[0x1])['format'](_0xb096('0xa3'))};_0x392377['where']=_[_0xb096('0x50')](_0x392377[_0xb096('0x4e')],_0x58846a);}_0x392377=_[_0xb096('0x50')]({},_0x392377,_0xb8cdf1[_0xb096('0x54')]);return db[_0xb096('0xa0')][_0xb096('0x30')]({'where':_0x392377[_0xb096('0x4e')]})[_0xb096('0x21')](function(_0x26e732){_0x355088[_0xb096('0x30')]=_0x26e732;if(_0xb8cdf1[_0xb096('0x43')]['includeAll']){_0x392377['include']=[{'all':!![]}];}return db[_0xb096('0xa0')][_0xb096('0x69')](_0x392377);})['then'](function(_0x522cbc){_0x355088['rows']=_0x522cbc;return _0x355088;});}})[_0xb096('0x21')](respondWithFilteredResult(_0x3335e4,_0x392377))['catch'](handleError(_0x3335e4,null));};exports['send']=function(_0x10bb2b,_0xb1d33a,_0x380452){var _0x1f3312,_0x147726={},_0x3dc32d;if(_0x10bb2b[_0xb096('0x63')]['to']){_0x3dc32d=_0x10bb2b[_0xb096('0x63')]['to'][0x0];}return db[_0xb096('0x3d')][_0xb096('0x59')]({'where':{'id':_0x10bb2b['params']['id']},'include':[{'model':db[_0xb096('0xa4')],'as':_0xb096('0xa5'),'include':[{'model':db[_0xb096('0x74')],'as':_0xb096('0xa6'),'where':{'fax':_0x3dc32d},'limit':0x1,'order':[[_0xb096('0x9b'),_0xb096('0xa7')]]}]}]})[_0xb096('0x21')](handleEntityNotFound(_0xb1d33a,null))[_0xb096('0x21')](function(_0x4fc06a){_0x1f3312=_0x4fc06a;if(_0x10bb2b[_0xb096('0x63')][_0xb096('0xa8')]&&_0x10bb2b[_0xb096('0x63')][_0xb096('0xa8')][_0xb096('0x49')]){for(var _0x5178ae=0x0;_0x5178ae<_0x10bb2b['body'][_0xb096('0xa8')][_0xb096('0x49')];_0x5178ae+=0x1){_0x10bb2b[_0xb096('0x63')][_0xb096('0xa8')][_0x5178ae]={'filename':_0x10bb2b['body'][_0xb096('0xa8')][_0x5178ae][_0xb096('0x3a')],'id':_0x10bb2b[_0xb096('0x63')]['attachments'][_0x5178ae]['id'],'path':path[_0xb096('0xa9')](config[_0xb096('0xaa')],'server/files/attachments',_0x10bb2b[_0xb096('0x63')][_0xb096('0xa8')][_0x5178ae]['basename'])};}}return respondWithRpcPromise(_0xb096('0xab'),_0xb096('0xab'),{'FaxAccountId':_[_0xb096('0xac')](_0x10bb2b[_0xb096('0x57')]['id'])?undefined:_0x10bb2b[_0xb096('0x57')]['id'],'path':_[_0xb096('0xac')](_0x10bb2b[_0xb096('0x63')][_0xb096('0xa8')][0x0][_0xb096('0x8')])?undefined:_0x10bb2b[_0xb096('0x63')]['attachments'][0x0][_0xb096('0x8')],'fax':_[_0xb096('0xac')](_0x10bb2b[_0xb096('0x63')]['to'][0x0])?undefined:_0x10bb2b[_0xb096('0x63')]['to'][0x0]},client9002);})[_0xb096('0x21')](function(){if(_0x1f3312){if(_[_0xb096('0xac')](_0x10bb2b[_0xb096('0x63')][_0xb096('0xad')])){_0x10bb2b[_0xb096('0x63')][_0xb096('0xad')]=util[_0xb096('0xae')](_0xb096('0xaf'),_0x1f3312[_0xb096('0x3a')],_0x1f3312[_0xb096('0xb0')]);}if(_0x1f3312[_0xb096('0xa5')]){if(_0x1f3312[_0xb096('0xa5')][_0xb096('0xa6')][_0xb096('0x49')]){return _0x1f3312['List']['Contacts'][0x0];}else{return db[_0xb096('0x74')]['create'](_[_0xb096('0xb1')](_0x10bb2b[_0xb096('0x63')],{'firstName':_0x10bb2b[_0xb096('0x63')]['to'][0x0],'phone':_0x10bb2b[_0xb096('0x63')]['to'][0x0],'fax':_0x10bb2b[_0xb096('0x63')]['to'][0x0],'ListId':_0x1f3312[_0xb096('0x9d')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xb096('0x21')](function(_0x57e9da){if(_0x57e9da){return db[_0xb096('0x70')]['find']({'where':{'ContactId':_0x57e9da['id'],'closed':![],'FaxAccountId':_0x1f3312['id']}})[_0xb096('0x21')](function(_0x35376c){if(_0x35376c){return[_0x35376c,![]];}return db[_0xb096('0x70')]['create']({'UserId':_0x10bb2b[_0xb096('0x5b')]['id'],'ContactId':_0x57e9da['id'],'FaxAccountId':_0x1f3312['id'],'fax':_0x10bb2b['body']['to'][0x0],'firstMsgDirection':_0xb096('0xb2'),'Messages':[_[_0xb096('0x50')](_0x10bb2b[_0xb096('0x63')],{'read':![],'body':_0x10bb2b[_0xb096('0x63')]['attachments'][0x0][_0xb096('0xb3')],'FaxAccountId':_0x1f3312['id'],'UserId':_0x10bb2b[_0xb096('0x5b')]['id'],'ContactId':_0x57e9da['id'],'AttachmentId':_0x10bb2b[_0xb096('0x63')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xb096('0xa0')],'as':'Messages'}]})[_0xb096('0x21')](function(_0x34046d){return[_0x34046d,!![]];});});}else{throw new Error(_0xb096('0xb4'));}})[_0xb096('0xb5')](function(_0x599989,_0x56f840){if(_0x56f840){return _0x599989;}return db[_0xb096('0xa0')]['create']({'direction':_0xb096('0xb2'),'read':![],'body':_0x10bb2b[_0xb096('0x63')][_0xb096('0xa8')][0x0][_0xb096('0xb3')],'FaxAccountId':_0x1f3312['id'],'FaxInteractionId':_0x599989['id'],'UserId':_0x10bb2b[_0xb096('0x5b')]['id'],'ContactId':_0x599989[_0xb096('0xb6')],'AttachmentId':_0x10bb2b[_0xb096('0x63')]['attachments'][0x0]['id']})[_0xb096('0x21')](function(_0x59c951){_0x599989[_0xb096('0xb7')][_0xb096('0xb8')]=[];_0x599989[_0xb096('0xb7')][_0xb096('0xb8')][_0xb096('0x8b')](_0x59c951[_0xb096('0xb7')]);return _0x599989;});})['then'](function(_0x21df69){respondWithRpcPromise(_0xb096('0xb9'),_0xb096('0xb9'),{'FaxAccountId':_['isNil'](_0x10bb2b[_0xb096('0x57')]['id'])?undefined:_0x10bb2b[_0xb096('0x57')]['id'],'path':_[_0xb096('0xac')](_0x10bb2b[_0xb096('0x63')][_0xb096('0xa8')][0x0][_0xb096('0x8')])?undefined:_0x10bb2b[_0xb096('0x63')]['attachments'][0x0][_0xb096('0x8')],'fax':_[_0xb096('0xac')](_0x10bb2b['body']['to'][0x0])?undefined:_0x10bb2b['body']['to'][0x0],'AttachmentId':_0x10bb2b[_0xb096('0x63')][_0xb096('0xa8')][0x0]['id']},client9002)[_0xb096('0x21')](function(_0x2d66e7){logger[_0xb096('0x22')](_0xb096('0xba'),_0x2d66e7);})[_0xb096('0x2b')](function(_0x136842){logger[_0xb096('0x22')](_0xb096('0xba'),_0x136842);});return _0x21df69;})['then'](respondWithResult(_0xb1d33a,null))[_0xb096('0x2b')](handleError(_0xb1d33a,null));};exports['addAgents']=function(_0x46c86d,_0x42300e,_0x584e17){return db['FaxAccount'][_0xb096('0x59')]({'where':{'id':_0x46c86d[_0xb096('0x57')]['id']}})['then'](handleEntityNotFound(_0x42300e,null))[_0xb096('0x21')](function(_0x5d97c8){if(_0x5d97c8){return _0x5d97c8[_0xb096('0xbb')](_0x46c86d[_0xb096('0x63')][_0xb096('0x6f')],_[_0xb096('0x72')](_0x46c86d[_0xb096('0x63')],[_0xb096('0x6f'),'id'])||{})[_0xb096('0xb5')](function(_0x4411bf){for(var _0x31da05=0x0;_0x31da05<_0x46c86d[_0xb096('0x63')][_0xb096('0x6f')][_0xb096('0x49')];_0x31da05+=0x1){socket[_0xb096('0xbc')]('userFaxAccount:save',{'UserId':Number(_0x46c86d[_0xb096('0x63')]['ids'][_0x31da05]),'FaxAccountId':Number(_0x46c86d[_0xb096('0x57')]['id'])});}return _0x4411bf;});}})[_0xb096('0x21')](respondWithResult(_0x42300e,null))[_0xb096('0x2b')](handleError(_0x42300e,null));};exports[_0xb096('0xbd')]=function(_0x2f6328,_0x238d67,_0x3a2bf0){return db['FaxAccount'][_0xb096('0x59')]({'where':{'id':_0x2f6328[_0xb096('0x57')]['id']}})['then'](handleEntityNotFound(_0x238d67,null))[_0xb096('0x21')](function(_0x4f5411){if(_0x4f5411){return _0x4f5411[_0xb096('0xbd')](_0x2f6328[_0xb096('0x43')][_0xb096('0x6f')])['then'](function(){if(_[_0xb096('0xbe')](_0x2f6328[_0xb096('0x43')][_0xb096('0x6f')])){for(var _0x266371=0x0;_0x266371<_0x2f6328[_0xb096('0x43')]['ids']['length'];_0x266371+=0x1){socket[_0xb096('0xbc')](_0xb096('0xbf'),{'UserId':Number(_0x2f6328[_0xb096('0x43')]['ids'][_0x266371]),'FaxAccountId':Number(_0x2f6328['params']['id'])});}}else{socket[_0xb096('0xbc')]('userFaxAccount:remove',{'UserId':Number(_0x2f6328[_0xb096('0x43')][_0xb096('0x6f')]),'FaxAccountId':Number(_0x2f6328[_0xb096('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x238d67,null))[_0xb096('0x2b')](handleError(_0x238d67,null));};exports['getAgents']=function(_0x3e0dab,_0x181477,_0x220f39){var _0x198b82={};var _0x21dce0={};var _0x2e671c;var _0x38354f;return db[_0xb096('0x3d')][_0xb096('0x68')]({'where':{'id':_0x3e0dab[_0xb096('0x57')]['id']}})[_0xb096('0x21')](handleEntityNotFound(_0x181477,null))[_0xb096('0x21')](function(_0x34df5c){if(_0x34df5c){_0x2e671c=_0x34df5c;_0x21dce0[_0xb096('0x42')]=_[_0xb096('0x44')](db[_0xb096('0xc0')][_0xb096('0x3e')]);_0x21dce0['query']=_['keys'](_0x3e0dab[_0xb096('0x43')]);_0x21dce0[_0xb096('0x45')]=_[_0xb096('0x46')](_0x21dce0[_0xb096('0x42')],_0x21dce0[_0xb096('0x43')]);_0x198b82[_0xb096('0x47')]=_['intersection'](_0x21dce0[_0xb096('0x42')],qs[_0xb096('0x48')](_0x3e0dab[_0xb096('0x43')][_0xb096('0x48')]));_0x198b82[_0xb096('0x47')]=_0x198b82['attributes'][_0xb096('0x49')]?_0x198b82[_0xb096('0x47')]:_0x21dce0[_0xb096('0x42')];_0x198b82[_0xb096('0x4c')]=qs[_0xb096('0x4d')](_0x3e0dab[_0xb096('0x43')][_0xb096('0x4d')]);_0x198b82[_0xb096('0x4e')]=qs[_0xb096('0x45')](_[_0xb096('0x4f')](_0x3e0dab['query'],_0x21dce0[_0xb096('0x45')]));if(_0x3e0dab[_0xb096('0x43')][_0xb096('0x53')]){_0x198b82[_0xb096('0x4e')]=_[_0xb096('0x50')](_0x198b82[_0xb096('0x4e')],{'$or':_['map'](_0x198b82[_0xb096('0x47')],function(_0x2b7b0a){var _0x28d921={};_0x28d921[_0x2b7b0a]={'$like':'%'+_0x3e0dab[_0xb096('0x43')][_0xb096('0x53')]+'%'};return _0x28d921;})});}_0x198b82=_[_0xb096('0x50')]({},_0x198b82,_0x3e0dab['options']);return _0x2e671c['getAgents'](_0x198b82);}})[_0xb096('0x21')](function(_0x8fd0ca){if(_0x8fd0ca){_0x38354f=_0x8fd0ca[_0xb096('0x49')];if(!_0x3e0dab[_0xb096('0x43')][_0xb096('0x4a')](_0xb096('0x4b'))){_0x198b82['limit']=qs['limit'](_0x3e0dab[_0xb096('0x43')][_0xb096('0x31')]);_0x198b82['offset']=qs[_0xb096('0x2e')](_0x3e0dab[_0xb096('0x43')]['offset']);}return _0x2e671c[_0xb096('0xc1')](_0x198b82);}})['then'](function(_0x41738a){if(_0x41738a){return _0x41738a?{'count':_0x38354f,'rows':_0x41738a}:null;}})['then'](respondWithResult(_0x181477,null))[_0xb096('0x2b')](handleError(_0x181477,null));}; \ No newline at end of file +var _0x8e89=['FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','transaction','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','Contacts','attachments','join','root','server/files/attachments','isNil','\x22%s\x22\x20<%s>','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','filename','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','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/environment','../../mysqldb','defaults','redis','localhost','./faxAccount.socket','register','jayson/promise','http','client','then','info','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','FaxAccount,\x20%s,\x20%s','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','index','Pause','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','options','FaxAccount','includeAll','rows','show','params','keys','length','find','create','user','role','FaxAccounts','userProfileId','autoAssociation','body','mandatoryDispositionPause','describe','addDisposition','FaxAccountId','Disposition','findOne','nolimit','order','include','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','User','fullname','internal','Tag','Tags','color','tag','sequelize','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','priority','finally','send','getApplications','context','from-voip-provider','localstationid','system','description','appdata','push','CDR(type)=inbound-fax','Set','faxdetect','headerinfo','minrate'];(function(_0x433f44,_0xa365ce){var _0x73664=function(_0x14501b){while(--_0x14501b){_0x433f44['push'](_0x433f44['shift']());}};_0x73664(++_0xa365ce);}(_0x8e89,0xeb));var _0x98e8=function(_0x223461,_0x2bca70){_0x223461=_0x223461-0x0;var _0x4dbe0a=_0x8e89[_0x223461];return _0x4dbe0a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x98e8('0x0'));var zipdir=require(_0x98e8('0x1'));var jsonpatch=require(_0x98e8('0x2'));var rp=require(_0x98e8('0x3'));var moment=require('moment');var BPromise=require(_0x98e8('0x4'));var Mustache=require(_0x98e8('0x5'));var util=require('util');var path=require(_0x98e8('0x6'));var sox=require(_0x98e8('0x7'));var csv=require(_0x98e8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x98e8('0x9'));var _=require(_0x98e8('0xa'));var squel=require(_0x98e8('0xb'));var crypto=require(_0x98e8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x98e8('0xd'));var toCsv=require('to-csv');var querystring=require(_0x98e8('0xe'));var Papa=require(_0x98e8('0xf'));var Redis=require(_0x98e8('0x10'));var authService=require(_0x98e8('0x11'));var qs=require(_0x98e8('0x12'));var as=require(_0x98e8('0x13'));var hardwareService=require(_0x98e8('0x14'));var logger=require(_0x98e8('0x15'))(_0x98e8('0x16'));var utils=require('../../config/utils');var config=require(_0x98e8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x98e8('0x18'))['db'];config['redis']=_[_0x98e8('0x19')](config[_0x98e8('0x1a')],{'host':_0x98e8('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x98e8('0x1a')]));require(_0x98e8('0x1c'))[_0x98e8('0x1d')](socket);var jayson=require(_0x98e8('0x1e'));var client=jayson['client'][_0x98e8('0x1f')]({'port':0x232c});var client9002=jayson[_0x98e8('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cd7ce,_0x3e2bac,_0x1b06b3,_0x30aa49){return new BPromise(function(_0x1866b9,_0x3a6492){var _0x30e661=_0x30aa49||client;return _0x30e661['request'](_0x1cd7ce,_0x1b06b3)[_0x98e8('0x21')](function(_0x7e0951){logger[_0x98e8('0x22')]('FaxAccount,\x20%s,\x20%s',_0x3e2bac,'request\x20sent');logger['debug'](_0x98e8('0x23'),_0x3e2bac,'request\x20sent',JSON['stringify'](_0x7e0951));if(_0x7e0951[_0x98e8('0x24')]){if(_0x7e0951[_0x98e8('0x24')][_0x98e8('0x25')]===0x1f4){logger[_0x98e8('0x24')]('FaxAccount,\x20%s,\x20%s',_0x3e2bac,_0x7e0951[_0x98e8('0x24')][_0x98e8('0x26')]);return _0x3a6492(_0x7e0951[_0x98e8('0x24')][_0x98e8('0x26')]);}logger[_0x98e8('0x24')](_0x98e8('0x27'),_0x3e2bac,_0x7e0951[_0x98e8('0x24')]['message']);return _0x1866b9(_0x7e0951[_0x98e8('0x24')][_0x98e8('0x26')]);}else{logger[_0x98e8('0x22')](_0x98e8('0x27'),_0x3e2bac,_0x98e8('0x28'));_0x1866b9(_0x7e0951[_0x98e8('0x29')][_0x98e8('0x26')]);}})[_0x98e8('0x2a')](function(_0x4b821e){logger[_0x98e8('0x24')](_0x98e8('0x27'),_0x3e2bac,_0x4b821e);_0x3a6492(_0x4b821e);});});}function respondWithStatusCode(_0x555fce,_0x391fa6){_0x391fa6=_0x391fa6||0xcc;return function(_0x183e42){if(_0x183e42){return _0x555fce[_0x98e8('0x2b')](_0x391fa6);}return _0x555fce[_0x98e8('0x2c')](_0x391fa6)[_0x98e8('0x2d')]();};}function respondWithResult(_0x43b80e,_0x1aa8c7){_0x1aa8c7=_0x1aa8c7||0xc8;return function(_0x5666c9){if(_0x5666c9){return _0x43b80e[_0x98e8('0x2c')](_0x1aa8c7)[_0x98e8('0x2e')](_0x5666c9);}};}function respondWithFilteredResult(_0x3bdb91,_0x5f22be){return function(_0x26a7cb){if(_0x26a7cb){var _0x223f0e=typeof _0x5f22be[_0x98e8('0x2f')]===_0x98e8('0x30')&&typeof _0x5f22be[_0x98e8('0x31')]==='undefined';var _0x32d55a=_0x26a7cb[_0x98e8('0x32')];var _0x182515=_0x223f0e?0x0:_0x5f22be[_0x98e8('0x2f')];var _0x320544=_0x223f0e?_0x26a7cb[_0x98e8('0x32')]:_0x5f22be[_0x98e8('0x2f')]+_0x5f22be[_0x98e8('0x31')];var _0x3ec33b;if(_0x320544>=_0x32d55a){_0x320544=_0x32d55a;_0x3ec33b=0xc8;}else{_0x3ec33b=0xce;}_0x3bdb91['status'](_0x3ec33b);return _0x3bdb91[_0x98e8('0x33')](_0x98e8('0x34'),_0x182515+'-'+_0x320544+'/'+_0x32d55a)[_0x98e8('0x2e')](_0x26a7cb);}return null;};}function patchUpdates(_0x4fd652){return function(_0xc39dd3){try{jsonpatch[_0x98e8('0x35')](_0xc39dd3,_0x4fd652,!![]);}catch(_0x2d1fb6){return BPromise[_0x98e8('0x36')](_0x2d1fb6);}return _0xc39dd3[_0x98e8('0x37')]();};}function saveUpdates(_0x48461a,_0x4498e8){return function(_0x2b9a5e){if(_0x2b9a5e){return _0x2b9a5e[_0x98e8('0x38')](_0x48461a)[_0x98e8('0x21')](function(_0x7c77a4){return _0x7c77a4;});}return null;};}function removeEntity(_0x386671,_0x3db661){return function(_0x174af3){if(_0x174af3){return _0x174af3[_0x98e8('0x39')]()[_0x98e8('0x21')](function(){var _0x1706f2=_0x174af3[_0x98e8('0x3a')]({'plain':!![]});var _0xc57b1b='FaxAccounts';return db[_0x98e8('0x3b')]['destroy']({'where':{'type':_0xc57b1b,'resourceId':_0x1706f2['id']}})[_0x98e8('0x21')](function(){return _0x174af3;});})[_0x98e8('0x21')](function(){_0x386671[_0x98e8('0x2c')](0xcc)[_0x98e8('0x2d')]();});}};}function handleEntityNotFound(_0x5ede0f,_0x1004b1){return function(_0x289bf6){if(!_0x289bf6){_0x5ede0f[_0x98e8('0x2b')](0x194);}return _0x289bf6;};}function handleError(_0x467b2b,_0x9c093a){_0x9c093a=_0x9c093a||0x1f4;return function(_0x46106b){logger['error'](_0x46106b[_0x98e8('0x3c')]);if(_0x46106b[_0x98e8('0x3d')]){delete _0x46106b['name'];}_0x467b2b[_0x98e8('0x2c')](_0x9c093a)['send'](_0x46106b);};}exports[_0x98e8('0x3e')]=function(_0x4fba1b,_0x270149){var _0x3aeb0e={'include':[{'model':db[_0x98e8('0x3f')],'as':'mandatoryDispositionPause'}]},_0x21cf92={},_0x3d3710={'count':0x0,'rows':[]};var _0x18e2a7=_[_0x98e8('0x40')](db['FaxAccount'][_0x98e8('0x41')],function(_0x3da434){return{'name':_0x3da434[_0x98e8('0x42')],'type':_0x3da434[_0x98e8('0x43')][_0x98e8('0x44')]};});_0x21cf92[_0x98e8('0x45')]=_[_0x98e8('0x40')](_0x18e2a7,_0x98e8('0x3d'));_0x21cf92[_0x98e8('0x46')]=_['keys'](_0x4fba1b['query']);_0x21cf92['filters']=_[_0x98e8('0x47')](_0x21cf92['model'],_0x21cf92[_0x98e8('0x46')]);_0x3aeb0e[_0x98e8('0x48')]=_[_0x98e8('0x47')](_0x21cf92[_0x98e8('0x45')],qs[_0x98e8('0x49')](_0x4fba1b[_0x98e8('0x46')][_0x98e8('0x49')]));_0x3aeb0e[_0x98e8('0x48')]=_0x3aeb0e[_0x98e8('0x48')]['length']?_0x3aeb0e[_0x98e8('0x48')]:_0x21cf92['model'];if(!_0x4fba1b[_0x98e8('0x46')][_0x98e8('0x4a')]('nolimit')){_0x3aeb0e[_0x98e8('0x31')]=qs[_0x98e8('0x31')](_0x4fba1b[_0x98e8('0x46')][_0x98e8('0x31')]);_0x3aeb0e[_0x98e8('0x2f')]=qs['offset'](_0x4fba1b[_0x98e8('0x46')]['offset']);}_0x3aeb0e['order']=qs['sort'](_0x4fba1b[_0x98e8('0x46')][_0x98e8('0x4b')]);_0x3aeb0e[_0x98e8('0x4c')]=qs[_0x98e8('0x4d')](_[_0x98e8('0x4e')](_0x4fba1b['query'],_0x21cf92[_0x98e8('0x4d')]),_0x18e2a7);if(_0x4fba1b[_0x98e8('0x46')][_0x98e8('0x4f')]){_0x3aeb0e[_0x98e8('0x4c')]=_[_0x98e8('0x50')](_0x3aeb0e[_0x98e8('0x4c')],{'$or':_['map'](_0x18e2a7,function(_0x5aa8d4){if(_0x5aa8d4['type']!=='VIRTUAL'){var _0x2e932d={};_0x2e932d[_0x5aa8d4[_0x98e8('0x3d')]]={'$like':'%'+_0x4fba1b[_0x98e8('0x46')]['filter']+'%'};return _0x2e932d;}})});}_0x3aeb0e=_[_0x98e8('0x50')]({},_0x3aeb0e,_0x4fba1b[_0x98e8('0x51')]);var _0x23fd2b={'where':_0x3aeb0e[_0x98e8('0x4c')]};return db[_0x98e8('0x52')][_0x98e8('0x32')](_0x23fd2b)['then'](function(_0x1f1c3c){_0x3d3710['count']=_0x1f1c3c;if(_0x4fba1b[_0x98e8('0x46')][_0x98e8('0x53')]){_0x3aeb0e['include']=[{'all':!![]}];}return db[_0x98e8('0x52')]['findAll'](_0x3aeb0e);})[_0x98e8('0x21')](function(_0x3cc85b){_0x3d3710[_0x98e8('0x54')]=_0x3cc85b;return _0x3d3710;})[_0x98e8('0x21')](respondWithFilteredResult(_0x270149,_0x3aeb0e))['catch'](handleError(_0x270149,null));};exports[_0x98e8('0x55')]=function(_0x370103,_0x10d59f){var _0x14f914={'raw':![],'where':{'id':_0x370103[_0x98e8('0x56')]['id']},'include':[{'model':db[_0x98e8('0x3f')],'as':'mandatoryDispositionPause'}]},_0xe75e22={};_0xe75e22['model']=_['keys'](db[_0x98e8('0x52')][_0x98e8('0x41')]);_0xe75e22[_0x98e8('0x46')]=_[_0x98e8('0x57')](_0x370103[_0x98e8('0x46')]);_0xe75e22[_0x98e8('0x4d')]=_[_0x98e8('0x47')](_0xe75e22[_0x98e8('0x45')],_0xe75e22['query']);_0x14f914[_0x98e8('0x48')]=_[_0x98e8('0x47')](_0xe75e22['model'],qs[_0x98e8('0x49')](_0x370103[_0x98e8('0x46')][_0x98e8('0x49')]));_0x14f914[_0x98e8('0x48')]=_0x14f914[_0x98e8('0x48')][_0x98e8('0x58')]?_0x14f914[_0x98e8('0x48')]:_0xe75e22[_0x98e8('0x45')];if(_0x370103[_0x98e8('0x46')]['includeAll']){_0x14f914['include']=[{'all':!![]}];}_0x14f914=_[_0x98e8('0x50')]({},_0x14f914,_0x370103['options']);return db[_0x98e8('0x52')][_0x98e8('0x59')](_0x14f914)[_0x98e8('0x21')](handleEntityNotFound(_0x10d59f,null))[_0x98e8('0x21')](respondWithResult(_0x10d59f,null))[_0x98e8('0x2a')](handleError(_0x10d59f,null));};exports['create']=function(_0x291938,_0x50d393){return db[_0x98e8('0x52')][_0x98e8('0x5a')](_0x291938['body'],{})[_0x98e8('0x21')](function(_0x280f34){var _0x2f5cf2=_0x291938[_0x98e8('0x5b')][_0x98e8('0x3a')]({'plain':!![]});if(!_0x2f5cf2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f5cf2[_0x98e8('0x5c')]===_0x98e8('0x5b')){var _0x1f7e2b=_0x280f34[_0x98e8('0x3a')]({'plain':!![]});var _0x13746d=_0x98e8('0x5d');return db['UserProfileSection'][_0x98e8('0x59')]({'where':{'name':_0x13746d,'userProfileId':_0x2f5cf2[_0x98e8('0x5e')]},'raw':!![]})[_0x98e8('0x21')](function(_0x152d67){if(_0x152d67&&_0x152d67[_0x98e8('0x5f')]===0x0){return db[_0x98e8('0x3b')]['create']({'name':_0x1f7e2b[_0x98e8('0x3d')],'resourceId':_0x1f7e2b['id'],'type':_0x152d67[_0x98e8('0x3d')],'sectionId':_0x152d67['id']},{})[_0x98e8('0x21')](function(){return _0x280f34;});}else{return _0x280f34;}})[_0x98e8('0x2a')](function(_0x15e261){logger[_0x98e8('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15e261);throw _0x15e261;});}return _0x280f34;})[_0x98e8('0x21')](respondWithResult(_0x50d393,0xc9))['catch'](handleError(_0x50d393,null));};exports['update']=function(_0x5576d1,_0x17d092){if(_0x5576d1[_0x98e8('0x60')]['id']){delete _0x5576d1[_0x98e8('0x60')]['id'];}return db[_0x98e8('0x52')][_0x98e8('0x59')]({'where':{'id':_0x5576d1[_0x98e8('0x56')]['id']},'include':[{'model':db[_0x98e8('0x3f')],'as':_0x98e8('0x61')}]})[_0x98e8('0x21')](handleEntityNotFound(_0x17d092,null))[_0x98e8('0x21')](saveUpdates(_0x5576d1[_0x98e8('0x60')],null))[_0x98e8('0x21')](respondWithResult(_0x17d092,null))['catch'](handleError(_0x17d092,null));};exports[_0x98e8('0x39')]=function(_0x1a5ffc,_0x386d0c){return db[_0x98e8('0x52')][_0x98e8('0x59')]({'where':{'id':_0x1a5ffc[_0x98e8('0x56')]['id']}})[_0x98e8('0x21')](handleEntityNotFound(_0x386d0c,null))[_0x98e8('0x21')](removeEntity(_0x386d0c,null))[_0x98e8('0x2a')](handleError(_0x386d0c,null));};exports[_0x98e8('0x62')]=function(_0x5de573,_0x5ab1d8){return db['FaxAccount'][_0x98e8('0x62')]()[_0x98e8('0x21')](respondWithResult(_0x5ab1d8,null))['catch'](handleError(_0x5ab1d8,null));};exports[_0x98e8('0x63')]=function(_0x1540d8,_0x319ffe,_0x18d1e6){if(_0x1540d8[_0x98e8('0x60')]['id']){delete _0x1540d8[_0x98e8('0x60')]['id'];}return db[_0x98e8('0x52')][_0x98e8('0x59')]({'where':{'id':_0x1540d8[_0x98e8('0x56')]['id']}})[_0x98e8('0x21')](handleEntityNotFound(_0x319ffe,null))[_0x98e8('0x21')](function(_0x12d7d9){if(_0x12d7d9){_0x1540d8[_0x98e8('0x60')][_0x98e8('0x64')]=_0x12d7d9['id'];return db[_0x98e8('0x65')][_0x98e8('0x5a')](_0x1540d8['body']);}})[_0x98e8('0x21')](respondWithResult(_0x319ffe,null))[_0x98e8('0x2a')](handleError(_0x319ffe,null));};exports['getDispositions']=function(_0x39629a,_0x4969f1,_0x584669){var _0x183478={'raw':![],'where':{}};var _0x22fd82={};var _0x2384d9={'count':0x0,'rows':[]};return db[_0x98e8('0x52')][_0x98e8('0x66')]({'where':{'id':_0x39629a['params']['id']}})[_0x98e8('0x21')](handleEntityNotFound(_0x4969f1,null))[_0x98e8('0x21')](function(_0x435a95){if(_0x435a95){_0x22fd82[_0x98e8('0x45')]=_[_0x98e8('0x57')](db['Disposition'][_0x98e8('0x41')]);_0x22fd82[_0x98e8('0x46')]=_[_0x98e8('0x57')](_0x39629a[_0x98e8('0x46')]);_0x22fd82['filters']=_['intersection'](_0x22fd82[_0x98e8('0x45')],_0x22fd82[_0x98e8('0x46')]);_0x183478[_0x98e8('0x48')]=_['intersection'](_0x22fd82[_0x98e8('0x45')],qs['fields'](_0x39629a[_0x98e8('0x46')][_0x98e8('0x49')]));_0x183478[_0x98e8('0x48')]=_0x183478[_0x98e8('0x48')][_0x98e8('0x58')]?_0x183478['attributes']:_0x22fd82[_0x98e8('0x45')];if(!_0x39629a[_0x98e8('0x46')][_0x98e8('0x4a')](_0x98e8('0x67'))){_0x183478[_0x98e8('0x31')]=qs[_0x98e8('0x31')](_0x39629a[_0x98e8('0x46')]['limit']);_0x183478['offset']=qs[_0x98e8('0x2f')](_0x39629a[_0x98e8('0x46')][_0x98e8('0x2f')]);}_0x183478[_0x98e8('0x68')]=qs[_0x98e8('0x4b')](_0x39629a['query'][_0x98e8('0x4b')]);_0x183478[_0x98e8('0x4c')]=qs[_0x98e8('0x4d')](_['pick'](_0x39629a[_0x98e8('0x46')],_0x22fd82[_0x98e8('0x4d')]));_0x183478[_0x98e8('0x4c')][_0x98e8('0x64')]=_0x435a95['id'];if(_0x39629a['query'][_0x98e8('0x4f')]){_0x183478['where']=_[_0x98e8('0x50')](_0x183478['where'],{'$or':_[_0x98e8('0x40')](_0x183478['attributes'],function(_0x2a8af){var _0x4e846c={};_0x4e846c[_0x2a8af]={'$like':'%'+_0x39629a[_0x98e8('0x46')][_0x98e8('0x4f')]+'%'};return _0x4e846c;})});}_0x183478=_[_0x98e8('0x50')]({},_0x183478,_0x39629a[_0x98e8('0x51')]);return db[_0x98e8('0x65')]['count']({'where':_0x183478[_0x98e8('0x4c')]})[_0x98e8('0x21')](function(_0x133876){_0x2384d9[_0x98e8('0x32')]=_0x133876;if(_0x39629a['query'][_0x98e8('0x53')]){_0x183478[_0x98e8('0x69')]=[{'all':!![]}];}return db[_0x98e8('0x65')][_0x98e8('0x6a')](_0x183478);})[_0x98e8('0x21')](function(_0x5a4224){_0x2384d9[_0x98e8('0x54')]=_0x5a4224;return _0x2384d9;});}})[_0x98e8('0x21')](respondWithFilteredResult(_0x4969f1,_0x183478))['catch'](handleError(_0x4969f1,null));};exports['removeDispositions']=function(_0x2217de,_0x4294a3,_0x232d70){return db['FaxAccount'][_0x98e8('0x59')]({'where':{'id':_0x2217de[_0x98e8('0x56')]['id']}})[_0x98e8('0x21')](handleEntityNotFound(_0x4294a3,null))[_0x98e8('0x21')](function(_0x2a5f98){if(_0x2a5f98){return _0x2a5f98[_0x98e8('0x6b')](_0x2217de[_0x98e8('0x46')][_0x98e8('0x6c')]);}})[_0x98e8('0x21')](respondWithStatusCode(_0x4294a3,null))['catch'](handleError(_0x4294a3,null));};exports[_0x98e8('0x6d')]=function(_0x180807,_0xe5953b,_0x494dfd){if(_0x180807[_0x98e8('0x60')]['id']){delete _0x180807[_0x98e8('0x60')]['id'];}return db[_0x98e8('0x52')][_0x98e8('0x59')]({'where':{'id':_0x180807['params']['id']}})['then'](handleEntityNotFound(_0xe5953b,null))[_0x98e8('0x21')](function(_0x54a130){if(_0x54a130){_0x180807[_0x98e8('0x60')][_0x98e8('0x64')]=_0x54a130['id'];return db[_0x98e8('0x6e')]['create'](_0x180807[_0x98e8('0x60')]);}})['then'](respondWithResult(_0xe5953b,null))[_0x98e8('0x2a')](handleError(_0xe5953b,null));};exports[_0x98e8('0x6f')]=function(_0x64a815,_0x581054,_0x1f215c){var _0x31fe79={'raw':![],'where':{}};var _0x1107dc={};var _0x3022b8={'count':0x0,'rows':[]};return db[_0x98e8('0x52')][_0x98e8('0x66')]({'where':{'id':_0x64a815['params']['id']}})['then'](handleEntityNotFound(_0x581054,null))[_0x98e8('0x21')](function(_0x2f7209){if(_0x2f7209){_0x1107dc[_0x98e8('0x45')]=_['keys'](db[_0x98e8('0x6e')][_0x98e8('0x41')]);_0x1107dc[_0x98e8('0x46')]=_[_0x98e8('0x57')](_0x64a815[_0x98e8('0x46')]);_0x1107dc[_0x98e8('0x4d')]=_['intersection'](_0x1107dc[_0x98e8('0x45')],_0x1107dc[_0x98e8('0x46')]);_0x31fe79[_0x98e8('0x48')]=_[_0x98e8('0x47')](_0x1107dc['model'],qs[_0x98e8('0x49')](_0x64a815[_0x98e8('0x46')][_0x98e8('0x49')]));_0x31fe79['attributes']=_0x31fe79['attributes'][_0x98e8('0x58')]?_0x31fe79[_0x98e8('0x48')]:_0x1107dc[_0x98e8('0x45')];if(!_0x64a815['query']['hasOwnProperty'](_0x98e8('0x67'))){_0x31fe79['limit']=qs[_0x98e8('0x31')](_0x64a815[_0x98e8('0x46')][_0x98e8('0x31')]);_0x31fe79[_0x98e8('0x2f')]=qs[_0x98e8('0x2f')](_0x64a815['query'][_0x98e8('0x2f')]);}_0x31fe79[_0x98e8('0x68')]=qs[_0x98e8('0x4b')](_0x64a815['query'][_0x98e8('0x4b')]);_0x31fe79[_0x98e8('0x4c')]=qs['filters'](_['pick'](_0x64a815[_0x98e8('0x46')],_0x1107dc[_0x98e8('0x4d')]));_0x31fe79[_0x98e8('0x4c')][_0x98e8('0x64')]=_0x2f7209['id'];if(_0x64a815[_0x98e8('0x46')][_0x98e8('0x4f')]){_0x31fe79[_0x98e8('0x4c')]=_['merge'](_0x31fe79['where'],{'$or':_['map'](_0x31fe79[_0x98e8('0x48')],function(_0x42e277){var _0x4a2702={};_0x4a2702[_0x42e277]={'$like':'%'+_0x64a815[_0x98e8('0x46')][_0x98e8('0x4f')]+'%'};return _0x4a2702;})});}_0x31fe79=_[_0x98e8('0x50')]({},_0x31fe79,_0x64a815['options']);return db[_0x98e8('0x6e')][_0x98e8('0x32')]({'where':_0x31fe79['where']})[_0x98e8('0x21')](function(_0x1892de){_0x3022b8['count']=_0x1892de;if(_0x64a815[_0x98e8('0x46')]['includeAll']){_0x31fe79['include']=[{'all':!![]}];}return db[_0x98e8('0x6e')][_0x98e8('0x6a')](_0x31fe79);})['then'](function(_0x40d83d){_0x3022b8['rows']=_0x40d83d;return _0x3022b8;});}})[_0x98e8('0x21')](respondWithFilteredResult(_0x581054,_0x31fe79))[_0x98e8('0x2a')](handleError(_0x581054,null));};exports[_0x98e8('0x70')]=function(_0x20b9d7,_0x41a941,_0x3f7c08){return db['FaxAccount'][_0x98e8('0x59')]({'where':{'id':_0x20b9d7['params']['id']}})[_0x98e8('0x21')](handleEntityNotFound(_0x41a941,null))['then'](function(_0x2c9340){if(_0x2c9340){return _0x2c9340[_0x98e8('0x70')](_0x20b9d7[_0x98e8('0x46')][_0x98e8('0x6c')]);}})[_0x98e8('0x21')](respondWithStatusCode(_0x41a941,null))['catch'](handleError(_0x41a941,null));};exports[_0x98e8('0x71')]=function(_0x51286d,_0x250f06,_0x160f58){return db[_0x98e8('0x72')]['find']({'where':{'id':_0x51286d[_0x98e8('0x56')]['id']}})[_0x98e8('0x21')](handleEntityNotFound(_0x250f06,null))[_0x98e8('0x21')](function(_0x2da1d7){if(_0x2da1d7){return _0x2da1d7[_0x98e8('0x71')](_0x51286d['body'][_0x98e8('0x6c')],_[_0x98e8('0x73')](_0x51286d['body'],['ids','id'])||{});}})[_0x98e8('0x21')](respondWithResult(_0x250f06,null))['catch'](handleError(_0x250f06,null));};exports[_0x98e8('0x74')]=function(_0x3c8e76,_0x124c34,_0x181810){var _0x22fd38={'raw':![],'where':{}};var _0x8c851={};var _0x13abf4={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x3c8e76['params']['id']}})[_0x98e8('0x21')](handleEntityNotFound(_0x124c34,null))[_0x98e8('0x21')](function(_0x4275d8){if(_0x4275d8){_0x8c851[_0x98e8('0x45')]=_[_0x98e8('0x57')](db[_0x98e8('0x72')][_0x98e8('0x41')]);_0x8c851[_0x98e8('0x46')]=_['keys'](_0x3c8e76['query']);_0x8c851[_0x98e8('0x4d')]=_['intersection'](_0x8c851[_0x98e8('0x45')],_0x8c851['query']);_0x22fd38['attributes']=_[_0x98e8('0x47')](_0x8c851[_0x98e8('0x45')],qs[_0x98e8('0x49')](_0x3c8e76[_0x98e8('0x46')][_0x98e8('0x49')]));_0x22fd38[_0x98e8('0x48')]=_0x22fd38[_0x98e8('0x48')][_0x98e8('0x58')]?_0x22fd38[_0x98e8('0x48')]:_0x8c851[_0x98e8('0x45')];if(!_0x3c8e76[_0x98e8('0x46')][_0x98e8('0x4a')](_0x98e8('0x67'))){_0x22fd38[_0x98e8('0x31')]=qs[_0x98e8('0x31')](_0x3c8e76[_0x98e8('0x46')][_0x98e8('0x31')]);_0x22fd38['offset']=qs[_0x98e8('0x2f')](_0x3c8e76[_0x98e8('0x46')][_0x98e8('0x2f')]);}_0x22fd38[_0x98e8('0x68')]=qs[_0x98e8('0x4b')](_0x3c8e76[_0x98e8('0x46')][_0x98e8('0x4b')]);_0x22fd38['where']=qs[_0x98e8('0x4d')](_[_0x98e8('0x4e')](_0x3c8e76['query'],_0x8c851[_0x98e8('0x4d')]));_0x22fd38['where'][_0x98e8('0x64')]=_0x4275d8['id'];if(_0x3c8e76[_0x98e8('0x46')]['filter']){_0x22fd38['where']=_['merge'](_0x22fd38[_0x98e8('0x4c')],{'$or':_['map'](_0x22fd38[_0x98e8('0x48')],function(_0x1a029a){var _0x48bd1e={};_0x48bd1e[_0x1a029a]={'$like':'%'+_0x3c8e76['query']['filter']+'%'};return _0x48bd1e;})});}_0x22fd38=_[_0x98e8('0x50')]({},_0x22fd38,_0x3c8e76[_0x98e8('0x51')]);return db[_0x98e8('0x72')]['count']({'where':_0x22fd38[_0x98e8('0x4c')]})[_0x98e8('0x21')](function(_0x5d24cf){_0x13abf4[_0x98e8('0x32')]=_0x5d24cf;if(_0x3c8e76[_0x98e8('0x46')][_0x98e8('0x53')]){_0x22fd38[_0x98e8('0x69')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x98e8('0x75')],'as':'Owner','attributes':['name',_0x98e8('0x76'),_0x98e8('0x77')],'required':![]},{'model':db[_0x98e8('0x78')],'as':_0x98e8('0x79'),'attributes':['id',_0x98e8('0x3d'),_0x98e8('0x7a')],'where':_0x3c8e76[_0x98e8('0x46')]['tag']?{'id':_0x3c8e76[_0x98e8('0x46')][_0x98e8('0x7b')]}:undefined,'required':_0x3c8e76[_0x98e8('0x46')][_0x98e8('0x7b')]?!![]:![]}];}return db[_0x98e8('0x72')][_0x98e8('0x6a')](_0x22fd38);})[_0x98e8('0x21')](function(_0x37158d){_0x13abf4[_0x98e8('0x54')]=_0x37158d;return _0x13abf4;});}})[_0x98e8('0x21')](respondWithFilteredResult(_0x124c34,_0x22fd38))[_0x98e8('0x2a')](handleError(_0x124c34,null));};exports['addApplications']=function(_0x4ab217,_0x29987d){var _0xcd876b=_0x4ab217[_0x98e8('0x56')]['id'];var _0x1e2331=_0x4ab217[_0x98e8('0x60')];var _0x27973f=0xc8;var _0x3cafad=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x98e8('0x7c')]['Transaction'][_0x98e8('0x7d')][_0x98e8('0x7e')]},function(_0x63fc4e){return db[_0x98e8('0x52')][_0x98e8('0x66')]({'where':{'id':_0xcd876b},'transaction':_0x63fc4e})[_0x98e8('0x21')](function(_0x5787c1){if(_0x5787c1){return db[_0x98e8('0x7f')][_0x98e8('0x39')]({'where':{'FaxAccountId':_0xcd876b},'transaction':_0x63fc4e})['then'](function(){var _0x400d6b=_[_0x98e8('0x40')](_0x1e2331,function(_0x5a9673){_0x5a9673[_0x98e8('0x64')]=_0xcd876b;return _0x5a9673;});return db[_0x98e8('0x7f')][_0x98e8('0x80')](_0x400d6b,{'transaction':_0x63fc4e});});}else{_0x27973f=0x194;_0x3cafad=[];}});})[_0x98e8('0x21')](function(){if(_0x27973f!==0x194){return db[_0x98e8('0x7f')]['findAndCountAll']({'where':{'FaxAccountId':_0xcd876b},'order':_0x98e8('0x81')})[_0x98e8('0x21')](function(_0x47e727){_0x3cafad=_0x47e727;});}})['catch'](function(_0x53347f){_0x27973f=0x1f4;logger['error'](_0x53347f[_0x98e8('0x3c')]);if(_0x53347f[_0x98e8('0x3d')]){delete _0x53347f[_0x98e8('0x3d')];}_0x3cafad=_0x53347f;})[_0x98e8('0x82')](function(){if(_0x3cafad===null){_0x29987d[_0x98e8('0x2b')](_0x27973f);}else{if(_0x27973f===0x1f4){_0x29987d['status'](_0x27973f)[_0x98e8('0x83')](_0x3cafad);}else{_0x29987d['status'](_0x27973f)['json'](_0x3cafad);}}});};exports[_0x98e8('0x84')]=function(_0x58cdd4,_0x44b45d,_0x5ef099){var _0x5a3d7={};var _0x2a10d2={};var _0x37b353;var _0x2d0e7d;return db[_0x98e8('0x52')]['findOne']({'where':{'id':_0x58cdd4['params']['id']}})[_0x98e8('0x21')](handleEntityNotFound(_0x44b45d,null))[_0x98e8('0x21')](function(_0x112d9f){if(_0x112d9f){_0x37b353=_0x112d9f;_0x2a10d2[_0x98e8('0x45')]=_[_0x98e8('0x57')](db['FaxApplication'][_0x98e8('0x41')]);_0x2a10d2[_0x98e8('0x46')]=_[_0x98e8('0x57')](_0x58cdd4['query']);_0x2a10d2['filters']=_['intersection'](_0x2a10d2[_0x98e8('0x45')],_0x2a10d2[_0x98e8('0x46')]);_0x5a3d7[_0x98e8('0x48')]=_['intersection'](_0x2a10d2[_0x98e8('0x45')],qs['fields'](_0x58cdd4['query']['fields']));_0x5a3d7[_0x98e8('0x48')]=_0x5a3d7[_0x98e8('0x48')]['length']?_0x5a3d7[_0x98e8('0x48')]:_0x2a10d2[_0x98e8('0x45')];_0x5a3d7[_0x98e8('0x68')]=qs[_0x98e8('0x4b')](_0x58cdd4['query'][_0x98e8('0x4b')]);_0x5a3d7[_0x98e8('0x4c')]=qs[_0x98e8('0x4d')](_[_0x98e8('0x4e')](_0x58cdd4['query'],_0x2a10d2['filters']));if(_0x58cdd4[_0x98e8('0x46')][_0x98e8('0x4f')]){_0x5a3d7[_0x98e8('0x4c')]=_['merge'](_0x5a3d7[_0x98e8('0x4c')],{'$or':_[_0x98e8('0x40')](_0x5a3d7[_0x98e8('0x48')],function(_0xf40930){var _0x695ff7={};_0x695ff7[_0xf40930]={'$like':'%'+_0x58cdd4[_0x98e8('0x46')][_0x98e8('0x4f')]+'%'};return _0x695ff7;})});}_0x5a3d7=_[_0x98e8('0x50')]({},_0x5a3d7,_0x58cdd4['options']);return _0x37b353[_0x98e8('0x84')](_0x5a3d7);}})[_0x98e8('0x21')](function(_0x5dfa9b){if(_0x5dfa9b){_0x2d0e7d=_0x5dfa9b[_0x98e8('0x58')];if(!_0x58cdd4[_0x98e8('0x46')][_0x98e8('0x4a')](_0x98e8('0x67'))){_0x5a3d7[_0x98e8('0x31')]=qs['limit'](_0x58cdd4[_0x98e8('0x46')]['limit']);_0x5a3d7[_0x98e8('0x2f')]=qs[_0x98e8('0x2f')](_0x58cdd4[_0x98e8('0x46')][_0x98e8('0x2f')]);}return _0x37b353[_0x98e8('0x84')](_0x5a3d7);}})[_0x98e8('0x21')](function(_0x59465b){if(_0x59465b){return _0x59465b?{'count':_0x2d0e7d,'rows':_0x59465b}:null;}})['then'](respondWithResult(_0x44b45d,null))[_0x98e8('0x2a')](handleError(_0x44b45d,null));};function Extension(_0x34c1e3,_0x22b7de,_0x417cc9,_0x4815f9){this[_0x98e8('0x85')]=_0x98e8('0x86');this['exten']=_0x34c1e3[_0x98e8('0x87')];this['app']=_0x4815f9;this[_0x98e8('0x43')]=_0x98e8('0x88');this[_0x98e8('0x89')]='Fax\x20Extension';this['FaxAccountId']=_0x34c1e3['id'];this[_0x98e8('0x81')]=_0x22b7de;this[_0x98e8('0x8a')]=_0x417cc9;}function createExtensionsReciveFax(_0xacb411){var _0x440753=0x1;var _0x59f92e=[];_0x59f92e[_0x98e8('0x8b')](new Extension(_0xacb411,_0x440753,'','Answer'));_0x440753+=0x1;_0x59f92e[_0x98e8('0x8b')](new Extension(_0xacb411,_0x440753,_0x98e8('0x8c'),_0x98e8('0x8d')));_0x440753+=0x1;for(var _0x531663 in _0xacb411){if(_0xacb411[_0x98e8('0x4a')](_0x531663)&&(_0x531663==='ecm'||_0x531663===_0x98e8('0x87')||_0x531663==='gateway'||_0x531663===_0x98e8('0x8e')||_0x531663===_0x98e8('0x8f')||_0x531663==='maxrate'||_0x531663===_0x98e8('0x90')||_0x531663==='modem'||_0x531663==='t38timeout')){_0x59f92e[_0x98e8('0x8b')](new Extension(_0xacb411,_0x440753,_0x98e8('0x91')+_0x531663+')='+_0xacb411[_0x531663],_0x98e8('0x8d')));_0x440753+=0x1;}}_0x59f92e[_0x98e8('0x8b')](new Extension(_0xacb411,_0x440753,'6',_0x98e8('0x92')));_0x440753+=0x1;_0x59f92e[_0x98e8('0x8b')](new Extension(_0xacb411,_0x440753,_0x98e8('0x93'),_0x98e8('0x94')));_0x440753=0x0;return _0x59f92e;}exports[_0x98e8('0x95')]=function(_0x4880dd,_0x30e492,_0x3ac47d){var _0x2576aa;return db[_0x98e8('0x7c')][_0x98e8('0x96')](function(_0x1c3df7){return db[_0x98e8('0x52')][_0x98e8('0x5a')](_0x4880dd[_0x98e8('0x60')],{'transaction':_0x1c3df7})['then'](function(_0x2d34cc){_0x2576aa=_0x2d34cc[_0x98e8('0x3a')]({'plain':!![]});return db[_0x98e8('0x97')][_0x98e8('0x80')](createExtensionsReciveFax(_0x2576aa),{'transaction':_0x1c3df7});});})[_0x98e8('0x21')](function(){return _0x2576aa;})[_0x98e8('0x21')](respondWithResult(_0x30e492,null))[_0x98e8('0x2a')](handleError(_0x30e492,null));};exports[_0x98e8('0x98')]=function(_0xcf1dc4,_0x28eb74,_0x1d60c3){var _0x482f5c;return db[_0x98e8('0x7c')][_0x98e8('0x96')](function(_0x1629cf){return db['FaxAccount'][_0x98e8('0x38')](_0xcf1dc4[_0x98e8('0x60')],{'where':{'id':_0xcf1dc4[_0x98e8('0x60')]['id']},'transaction':_0x1629cf})[_0x98e8('0x21')](function(_0x455319){return db[_0x98e8('0x97')][_0x98e8('0x39')]({'where':{'FaxAccountId':_0xcf1dc4[_0x98e8('0x60')]['id']},'transaction':_0x1629cf})[_0x98e8('0x21')](function(_0x4c3a54){return db[_0x98e8('0x97')]['bulkCreate'](createExtensionsReciveFax(_[_0x98e8('0x73')](_0xcf1dc4[_0x98e8('0x60')],[_0x98e8('0x99'),_0x98e8('0x44'),_0x98e8('0x9a'),_0x98e8('0x9b'),_0x98e8('0x9c'),'ListId'])),{'transaction':_0x1629cf});});});})['then'](function(){return db[_0x98e8('0x52')][_0x98e8('0x9d')](_0xcf1dc4[_0x98e8('0x60')]['id']);})['then'](respondWithResult(_0x28eb74,null))[_0x98e8('0x2a')](handleError(_0x28eb74,null));};exports[_0x98e8('0x9e')]=function(_0x3f41b7,_0x4cbb39,_0x427e9d){var _0x4f8945={'raw':!![],'where':{}};var _0x1f36de={};var _0x5c7f2f={'count':0x0,'rows':[]};return db[_0x98e8('0x52')][_0x98e8('0x66')]({'where':{'id':_0x3f41b7[_0x98e8('0x56')]['id']}})[_0x98e8('0x21')](handleEntityNotFound(_0x4cbb39,null))[_0x98e8('0x21')](function(_0x25e1ac){if(_0x25e1ac){_0x1f36de[_0x98e8('0x45')]=_[_0x98e8('0x57')](db[_0x98e8('0x9f')][_0x98e8('0x41')]);_0x1f36de['query']=_[_0x98e8('0x57')](_0x3f41b7[_0x98e8('0x46')]);_0x1f36de['filters']=_[_0x98e8('0x47')](_0x1f36de[_0x98e8('0x45')],_0x1f36de['query']);_0x4f8945[_0x98e8('0x48')]=_['intersection'](_0x1f36de[_0x98e8('0x45')],qs[_0x98e8('0x49')](_0x3f41b7[_0x98e8('0x46')][_0x98e8('0x49')]));_0x4f8945[_0x98e8('0x48')]=_0x4f8945[_0x98e8('0x48')][_0x98e8('0x58')]?_0x4f8945[_0x98e8('0x48')]:_0x1f36de[_0x98e8('0x45')];if(!_0x3f41b7[_0x98e8('0x46')][_0x98e8('0x4a')](_0x98e8('0x67'))){_0x4f8945[_0x98e8('0x31')]=qs['limit'](_0x3f41b7['query']['limit']);_0x4f8945['offset']=qs[_0x98e8('0x2f')](_0x3f41b7[_0x98e8('0x46')]['offset']);}_0x4f8945[_0x98e8('0x68')]=qs[_0x98e8('0x4b')](_0x3f41b7['query'][_0x98e8('0x4b')]);_0x4f8945[_0x98e8('0x4c')]=qs[_0x98e8('0x4d')](_['pick'](_0x3f41b7[_0x98e8('0x46')],_0x1f36de[_0x98e8('0x4d')]));_0x4f8945[_0x98e8('0x4c')][_0x98e8('0x64')]=_0x25e1ac['id'];if(_0x3f41b7[_0x98e8('0x46')][_0x98e8('0x4f')]){_0x4f8945['where']=_[_0x98e8('0x50')](_0x4f8945[_0x98e8('0x4c')],{'$or':_[_0x98e8('0x40')](_0x4f8945[_0x98e8('0x48')],function(_0x591268){var _0x3e7e1c={};_0x3e7e1c[_0x591268]={'$like':'%'+_0x3f41b7['query'][_0x98e8('0x4f')]+'%'};return _0x3e7e1c;})});}if(_0x3f41b7['query'][_0x98e8('0xa0')]){var _0x23fb1f=_0x3f41b7[_0x98e8('0x46')][_0x98e8('0xa0')]['split'](',');var _0x4ea5b0={};_0x4ea5b0[_0x23fb1f[0x0]]={'$gte':moment(_0x23fb1f[0x1])[_0x98e8('0xa1')](_0x98e8('0xa2'))};_0x4f8945[_0x98e8('0x4c')]=_[_0x98e8('0x50')](_0x4f8945['where'],_0x4ea5b0);}_0x4f8945=_['merge']({},_0x4f8945,_0x3f41b7[_0x98e8('0x51')]);return db[_0x98e8('0x9f')]['count']({'where':_0x4f8945[_0x98e8('0x4c')]})[_0x98e8('0x21')](function(_0x404c17){_0x5c7f2f[_0x98e8('0x32')]=_0x404c17;if(_0x3f41b7[_0x98e8('0x46')][_0x98e8('0x53')]){_0x4f8945[_0x98e8('0x69')]=[{'all':!![]}];}return db[_0x98e8('0x9f')]['findAll'](_0x4f8945);})[_0x98e8('0x21')](function(_0x26e789){_0x5c7f2f['rows']=_0x26e789;return _0x5c7f2f;});}})[_0x98e8('0x21')](respondWithFilteredResult(_0x4cbb39,_0x4f8945))['catch'](handleError(_0x4cbb39,null));};exports[_0x98e8('0x83')]=function(_0x5c72ca,_0x3f5b28,_0xe9e8d){var _0x19f28a,_0x1599b3={},_0x4c2bca;if(_0x5c72ca['body']['to']){_0x4c2bca=_0x5c72ca[_0x98e8('0x60')]['to'][0x0];}return db[_0x98e8('0x52')][_0x98e8('0x59')]({'where':{'id':_0x5c72ca[_0x98e8('0x56')]['id']},'include':[{'model':db[_0x98e8('0xa3')],'as':_0x98e8('0xa4'),'include':[{'model':db[_0x98e8('0xa5')],'as':_0x98e8('0xa6'),'where':{'fax':_0x4c2bca},'limit':0x1,'order':[[_0x98e8('0x9b'),'DESC']]}]}]})[_0x98e8('0x21')](handleEntityNotFound(_0x3f5b28,null))['then'](function(_0x270623){_0x19f28a=_0x270623;if(_0x5c72ca[_0x98e8('0x60')][_0x98e8('0xa7')]&&_0x5c72ca[_0x98e8('0x60')][_0x98e8('0xa7')][_0x98e8('0x58')]){for(var _0x13591=0x0;_0x13591<_0x5c72ca[_0x98e8('0x60')]['attachments'][_0x98e8('0x58')];_0x13591+=0x1){_0x5c72ca[_0x98e8('0x60')][_0x98e8('0xa7')][_0x13591]={'filename':_0x5c72ca[_0x98e8('0x60')][_0x98e8('0xa7')][_0x13591][_0x98e8('0x3d')],'id':_0x5c72ca['body']['attachments'][_0x13591]['id'],'path':path[_0x98e8('0xa8')](config[_0x98e8('0xa9')],_0x98e8('0xaa'),_0x5c72ca['body'][_0x98e8('0xa7')][_0x13591]['basename'])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0x98e8('0xab')](_0x5c72ca['params']['id'])?undefined:_0x5c72ca[_0x98e8('0x56')]['id'],'path':_['isNil'](_0x5c72ca[_0x98e8('0x60')][_0x98e8('0xa7')][0x0]['path'])?undefined:_0x5c72ca[_0x98e8('0x60')]['attachments'][0x0]['path'],'fax':_['isNil'](_0x5c72ca[_0x98e8('0x60')]['to'][0x0])?undefined:_0x5c72ca['body']['to'][0x0]},client9002);})[_0x98e8('0x21')](function(){if(_0x19f28a){if(_[_0x98e8('0xab')](_0x5c72ca[_0x98e8('0x60')]['from'])){_0x5c72ca[_0x98e8('0x60')]['from']=util['format'](_0x98e8('0xac'),_0x19f28a[_0x98e8('0x3d')],_0x19f28a['fax']);}if(_0x19f28a[_0x98e8('0xa4')]){if(_0x19f28a[_0x98e8('0xa4')][_0x98e8('0xa6')]['length']){return _0x19f28a[_0x98e8('0xa4')][_0x98e8('0xa6')][0x0];}else{return db[_0x98e8('0xa5')]['create'](_['defaults'](_0x5c72ca[_0x98e8('0x60')],{'firstName':_0x5c72ca[_0x98e8('0x60')]['to'][0x0],'phone':_0x5c72ca[_0x98e8('0x60')]['to'][0x0],'fax':_0x5c72ca[_0x98e8('0x60')]['to'][0x0],'ListId':_0x19f28a[_0x98e8('0xad')]}));}}else{throw new Error(_0x98e8('0xae'));}}else{throw new Error(_0x98e8('0xaf'));}})['then'](function(_0x1de4a6){if(_0x1de4a6){return db[_0x98e8('0x72')][_0x98e8('0x59')]({'where':{'ContactId':_0x1de4a6['id'],'closed':![],'FaxAccountId':_0x19f28a['id']}})[_0x98e8('0x21')](function(_0x5e8c8c){if(_0x5e8c8c){return[_0x5e8c8c,![]];}return db['FaxInteraction'][_0x98e8('0x5a')]({'UserId':_0x5c72ca[_0x98e8('0x5b')]['id'],'ContactId':_0x1de4a6['id'],'FaxAccountId':_0x19f28a['id'],'fax':_0x5c72ca['body']['to'][0x0],'firstMsgDirection':_0x98e8('0xb0'),'Messages':[_[_0x98e8('0x50')](_0x5c72ca[_0x98e8('0x60')],{'read':![],'body':_0x5c72ca[_0x98e8('0x60')]['attachments'][0x0]['filename'],'FaxAccountId':_0x19f28a['id'],'UserId':_0x5c72ca[_0x98e8('0x5b')]['id'],'ContactId':_0x1de4a6['id'],'AttachmentId':_0x5c72ca[_0x98e8('0x60')][_0x98e8('0xa7')][0x0]['id']})]},{'include':[{'model':db[_0x98e8('0x9f')],'as':_0x98e8('0xb1')}]})[_0x98e8('0x21')](function(_0x253fe0){return[_0x253fe0,!![]];});});}else{throw new Error(_0x98e8('0xb2'));}})[_0x98e8('0xb3')](function(_0xfce11a,_0x4759ab){if(_0x4759ab){return _0xfce11a;}return db['FaxMessage']['create']({'direction':_0x98e8('0xb0'),'read':![],'body':_0x5c72ca[_0x98e8('0x60')]['attachments'][0x0][_0x98e8('0xb4')],'FaxAccountId':_0x19f28a['id'],'FaxInteractionId':_0xfce11a['id'],'UserId':_0x5c72ca[_0x98e8('0x5b')]['id'],'ContactId':_0xfce11a['ContactId'],'AttachmentId':_0x5c72ca[_0x98e8('0x60')]['attachments'][0x0]['id']})[_0x98e8('0x21')](function(_0x369cdf){_0xfce11a[_0x98e8('0xb5')]['Messages']=[];_0xfce11a[_0x98e8('0xb5')][_0x98e8('0xb1')][_0x98e8('0x8b')](_0x369cdf[_0x98e8('0xb5')]);return _0xfce11a;});})[_0x98e8('0x21')](function(_0x5768c9){respondWithRpcPromise('SendFax',_0x98e8('0xb6'),{'FaxAccountId':_['isNil'](_0x5c72ca[_0x98e8('0x56')]['id'])?undefined:_0x5c72ca[_0x98e8('0x56')]['id'],'path':_['isNil'](_0x5c72ca[_0x98e8('0x60')][_0x98e8('0xa7')][0x0][_0x98e8('0x6')])?undefined:_0x5c72ca[_0x98e8('0x60')][_0x98e8('0xa7')][0x0][_0x98e8('0x6')],'fax':_['isNil'](_0x5c72ca['body']['to'][0x0])?undefined:_0x5c72ca[_0x98e8('0x60')]['to'][0x0],'AttachmentId':_0x5c72ca[_0x98e8('0x60')]['attachments'][0x0]['id']},client9002)[_0x98e8('0x21')](function(_0x1184ec){logger['info']('SendFaxRpc,\x20%s',_0x1184ec);})[_0x98e8('0x2a')](function(_0x2732c0){logger['info'](_0x98e8('0xb7'),_0x2732c0);});return _0x5768c9;})[_0x98e8('0x21')](respondWithResult(_0x3f5b28,null))[_0x98e8('0x2a')](handleError(_0x3f5b28,null));};exports[_0x98e8('0xb8')]=function(_0x446587,_0x5519ae,_0x216f28){return db[_0x98e8('0x52')][_0x98e8('0x59')]({'where':{'id':_0x446587[_0x98e8('0x56')]['id']}})[_0x98e8('0x21')](handleEntityNotFound(_0x5519ae,null))[_0x98e8('0x21')](function(_0x5ce47e){if(_0x5ce47e){return _0x5ce47e[_0x98e8('0xb8')](_0x446587[_0x98e8('0x60')][_0x98e8('0x6c')],_[_0x98e8('0x73')](_0x446587['body'],[_0x98e8('0x6c'),'id'])||{})[_0x98e8('0xb3')](function(_0x464569){for(var _0x549cdb=0x0;_0x549cdb<_0x446587[_0x98e8('0x60')][_0x98e8('0x6c')]['length'];_0x549cdb+=0x1){socket[_0x98e8('0xb9')]('userFaxAccount:save',{'UserId':Number(_0x446587['body'][_0x98e8('0x6c')][_0x549cdb]),'FaxAccountId':Number(_0x446587['params']['id'])});}return _0x464569;});}})[_0x98e8('0x21')](respondWithResult(_0x5519ae,null))[_0x98e8('0x2a')](handleError(_0x5519ae,null));};exports['removeAgents']=function(_0x2f87d3,_0x5462ba,_0xfd1d7){return db[_0x98e8('0x52')][_0x98e8('0x59')]({'where':{'id':_0x2f87d3[_0x98e8('0x56')]['id']}})['then'](handleEntityNotFound(_0x5462ba,null))[_0x98e8('0x21')](function(_0x24f6a2){if(_0x24f6a2){return _0x24f6a2[_0x98e8('0xba')](_0x2f87d3['query'][_0x98e8('0x6c')])[_0x98e8('0x21')](function(){if(_[_0x98e8('0xbb')](_0x2f87d3[_0x98e8('0x46')][_0x98e8('0x6c')])){for(var _0x3bcfc7=0x0;_0x3bcfc7<_0x2f87d3[_0x98e8('0x46')][_0x98e8('0x6c')][_0x98e8('0x58')];_0x3bcfc7+=0x1){socket[_0x98e8('0xb9')](_0x98e8('0xbc'),{'UserId':Number(_0x2f87d3[_0x98e8('0x46')]['ids'][_0x3bcfc7]),'FaxAccountId':Number(_0x2f87d3[_0x98e8('0x56')]['id'])});}}else{socket[_0x98e8('0xb9')](_0x98e8('0xbc'),{'UserId':Number(_0x2f87d3[_0x98e8('0x46')][_0x98e8('0x6c')]),'FaxAccountId':Number(_0x2f87d3['params']['id'])});}});}})[_0x98e8('0x21')](respondWithStatusCode(_0x5462ba,null))[_0x98e8('0x2a')](handleError(_0x5462ba,null));};exports[_0x98e8('0xbd')]=function(_0x3b1287,_0x48892d,_0x4ab9ab){var _0x3d116e={};var _0x2a75a0={};var _0x180cda;var _0x48872c;return db[_0x98e8('0x52')]['findOne']({'where':{'id':_0x3b1287[_0x98e8('0x56')]['id']}})[_0x98e8('0x21')](handleEntityNotFound(_0x48892d,null))[_0x98e8('0x21')](function(_0x279be2){if(_0x279be2){_0x180cda=_0x279be2;_0x2a75a0[_0x98e8('0x45')]=_[_0x98e8('0x57')](db['User'][_0x98e8('0x41')]);_0x2a75a0[_0x98e8('0x46')]=_['keys'](_0x3b1287[_0x98e8('0x46')]);_0x2a75a0[_0x98e8('0x4d')]=_['intersection'](_0x2a75a0[_0x98e8('0x45')],_0x2a75a0[_0x98e8('0x46')]);_0x3d116e['attributes']=_[_0x98e8('0x47')](_0x2a75a0[_0x98e8('0x45')],qs['fields'](_0x3b1287[_0x98e8('0x46')][_0x98e8('0x49')]));_0x3d116e['attributes']=_0x3d116e[_0x98e8('0x48')][_0x98e8('0x58')]?_0x3d116e[_0x98e8('0x48')]:_0x2a75a0[_0x98e8('0x45')];_0x3d116e[_0x98e8('0x68')]=qs[_0x98e8('0x4b')](_0x3b1287[_0x98e8('0x46')]['sort']);_0x3d116e[_0x98e8('0x4c')]=qs[_0x98e8('0x4d')](_['pick'](_0x3b1287[_0x98e8('0x46')],_0x2a75a0[_0x98e8('0x4d')]));if(_0x3b1287[_0x98e8('0x46')][_0x98e8('0x4f')]){_0x3d116e[_0x98e8('0x4c')]=_[_0x98e8('0x50')](_0x3d116e['where'],{'$or':_[_0x98e8('0x40')](_0x3d116e['attributes'],function(_0x66dcc9){var _0x44fac0={};_0x44fac0[_0x66dcc9]={'$like':'%'+_0x3b1287[_0x98e8('0x46')][_0x98e8('0x4f')]+'%'};return _0x44fac0;})});}_0x3d116e=_[_0x98e8('0x50')]({},_0x3d116e,_0x3b1287[_0x98e8('0x51')]);return _0x180cda['getAgents'](_0x3d116e);}})['then'](function(_0x405435){if(_0x405435){_0x48872c=_0x405435[_0x98e8('0x58')];if(!_0x3b1287[_0x98e8('0x46')]['hasOwnProperty']('nolimit')){_0x3d116e[_0x98e8('0x31')]=qs[_0x98e8('0x31')](_0x3b1287[_0x98e8('0x46')][_0x98e8('0x31')]);_0x3d116e[_0x98e8('0x2f')]=qs['offset'](_0x3b1287[_0x98e8('0x46')][_0x98e8('0x2f')]);}return _0x180cda[_0x98e8('0xbd')](_0x3d116e);}})[_0x98e8('0x21')](function(_0x5ee0f7){if(_0x5ee0f7){return _0x5ee0f7?{'count':_0x48872c,'rows':_0x5ee0f7}:null;}})[_0x98e8('0x21')](respondWithResult(_0x48892d,null))['catch'](handleError(_0x48892d,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 35b2c6f..b982f13 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 _0xc17f=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','save','update','remove'];(function(_0x54b5ee,_0x3e8637){var _0x46aefa=function(_0xb9d5fd){while(--_0xb9d5fd){_0x54b5ee['push'](_0x54b5ee['shift']());}};_0x46aefa(++_0x3e8637);}(_0xc17f,0xae));var _0xfc17=function(_0x4afa32,_0x48d611){_0x4afa32=_0x4afa32-0x0;var _0x14535f=_0xc17f[_0x4afa32];return _0x14535f;};'use strict';var EventEmitter=require(_0xfc17('0x0'));var FaxAccount=require(_0xfc17('0x1'))['db'][_0xfc17('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfc17('0x3'),'afterUpdate':_0xfc17('0x4'),'afterDestroy':_0xfc17('0x5')};function emitEvent(_0x569ffc){return function(_0x568212,_0x41ed95,_0x5e69d8){FaxAccountEvents[_0xfc17('0x6')](_0x569ffc+':'+_0x568212['id'],_0x568212);FaxAccountEvents[_0xfc17('0x6')](_0x569ffc,_0x568212);_0x5e69d8(null);};}for(var e in events){if(events[_0xfc17('0x7')](e)){var event=events[e];FaxAccount[_0xfc17('0x8')](e,emitEvent(event));}}module[_0xfc17('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0x7996=['../../mysqldb','FaxAccount','setMaxListeners','remove','emit','hook','exports','events'];(function(_0x1a8a3f,_0x2782d7){var _0x242efa=function(_0x5229e8){while(--_0x5229e8){_0x1a8a3f['push'](_0x1a8a3f['shift']());}};_0x242efa(++_0x2782d7);}(_0x7996,0xc7));var _0x6799=function(_0x9a29ea,_0x5b8b29){_0x9a29ea=_0x9a29ea-0x0;var _0x11f261=_0x7996[_0x9a29ea];return _0x11f261;};'use strict';var EventEmitter=require(_0x6799('0x0'));var FaxAccount=require(_0x6799('0x1'))['db'][_0x6799('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x6799('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x6799('0x4')};function emitEvent(_0x4aa500){return function(_0x5b4a21,_0x3729b8,_0x2d5a81){FaxAccountEvents[_0x6799('0x5')](_0x4aa500+':'+_0x5b4a21['id'],_0x5b4a21);FaxAccountEvents[_0x6799('0x5')](_0x4aa500,_0x5b4a21);_0x2d5a81(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x6799('0x6')](e,emitEvent(event));}}module[_0x6799('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 53216a2..f8f091f 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 _0x698d=['FaxAccount','fax_accounts','util','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x388937,_0x21641b){var _0x456a3e=function(_0x3996fd){while(--_0x3996fd){_0x388937['push'](_0x388937['shift']());}};_0x456a3e(++_0x21641b);}(_0x698d,0x11a));var _0xd698=function(_0x1465a3,_0xd7f1df){_0x1465a3=_0x1465a3-0x0;var _0x471503=_0x698d[_0x1465a3];return _0x471503;};'use strict';var _=require('lodash');var util=require(_0xd698('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd698('0x1'));var rp=require(_0xd698('0x2'));var fs=require('fs');var path=require(_0xd698('0x3'));var rimraf=require(_0xd698('0x4'));var config=require(_0xd698('0x5'));var attributes=require('./faxAccount.attributes');module[_0xd698('0x6')]=function(_0x3d879c,_0x18a15e){return _0x3d879c[_0xd698('0x7')](_0xd698('0x8'),attributes,{'tableName':_0xd698('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb861=['../../config/logger','api','bluebird','rimraf','./faxAccount.attributes','exports','define','fax_accounts','lodash','util'];(function(_0x3d66f0,_0x3f4e63){var _0x4164f3=function(_0x11c22e){while(--_0x11c22e){_0x3d66f0['push'](_0x3d66f0['shift']());}};_0x4164f3(++_0x3f4e63);}(_0xb861,0xda));var _0x1b86=function(_0x2da1f9,_0x5e4269){_0x2da1f9=_0x2da1f9-0x0;var _0x22ef92=_0xb861[_0x2da1f9];return _0x22ef92;};'use strict';var _=require(_0x1b86('0x0'));var util=require(_0x1b86('0x1'));var logger=require(_0x1b86('0x2'))(_0x1b86('0x3'));var moment=require('moment');var BPromise=require(_0x1b86('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b86('0x5'));var config=require('../../config/environment');var attributes=require(_0x1b86('0x6'));module[_0x1b86('0x7')]=function(_0x228960,_0x6238d6){return _0x228960[_0x1b86('0x8')]('FaxAccount',attributes,{'tableName':_0x1b86('0x9'),'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 c3ffc3c..759da93 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 _0x862a=['updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','Contacts','DESC','List','get','applications','list','asc','length','create','FaxInteraction','Contact\x20not\x20found','autoclose','push','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FaxAccount','options','where','attributes','include','map','model','debug','GetFaxAccount','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt'];(function(_0x363d9e,_0x5d7b23){var _0x2b593f=function(_0xbbf656){while(--_0xbbf656){_0x363d9e['push'](_0x363d9e['shift']());}};_0x2b593f(++_0x5d7b23);}(_0x862a,0x188));var _0xa862=function(_0x38aeea,_0x57522a){_0x38aeea=_0x38aeea-0x0;var _0x5e8d2c=_0x862a[_0x38aeea];return _0x5e8d2c;};'use strict';var _=require(_0xa862('0x0'));var util=require(_0xa862('0x1'));var moment=require(_0xa862('0x2'));var BPromise=require(_0xa862('0x3'));var rs=require(_0xa862('0x4'));var fs=require('fs');var Redis=require(_0xa862('0x5'));var db=require(_0xa862('0x6'))['db'];var utils=require(_0xa862('0x7'));var logger=require(_0xa862('0x8'))(_0xa862('0x9'));var config=require(_0xa862('0xa'));var jayson=require(_0xa862('0xb'));var client=jayson[_0xa862('0xc')][_0xa862('0xd')]({'port':0x232c});config[_0xa862('0xe')]=_[_0xa862('0xf')](config[_0xa862('0xe')],{'host':_0xa862('0x10'),'port':0x18eb});var socket=require(_0xa862('0x11'))(new Redis(config[_0xa862('0xe')]));require(_0xa862('0x12'))['register'](socket);function respondWithRpcPromise(_0x5e9a19,_0x435033,_0x28bc88){return new BPromise(function(_0x146b77,_0x58b000){return client['request'](_0x5e9a19,_0x28bc88)[_0xa862('0x13')](function(_0x2e5d95){logger[_0xa862('0x14')](_0xa862('0x15'),_0x435033,_0xa862('0x16'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x435033,_0xa862('0x16'),JSON[_0xa862('0x17')](_0x2e5d95));if(_0x2e5d95[_0xa862('0x18')]){if(_0x2e5d95[_0xa862('0x18')][_0xa862('0x19')]===0x1f4){logger[_0xa862('0x18')](_0xa862('0x15'),_0x435033,_0x2e5d95['error'][_0xa862('0x1a')]);return _0x58b000(_0x2e5d95[_0xa862('0x18')][_0xa862('0x1a')]);}logger[_0xa862('0x18')](_0xa862('0x15'),_0x435033,_0x2e5d95[_0xa862('0x18')]['message']);return _0x146b77(_0x2e5d95[_0xa862('0x18')][_0xa862('0x1a')]);}else{logger[_0xa862('0x14')](_0xa862('0x15'),_0x435033,_0xa862('0x16'));_0x146b77(_0x2e5d95[_0xa862('0x1b')]['message']);}})[_0xa862('0x1c')](function(_0x59a158){logger[_0xa862('0x18')](_0xa862('0x15'),_0x435033,_0x59a158);_0x58b000(_0x59a158);});});}exports['GetFaxAccount']=function(_0x1f9b79){var _0xdc1ab6=this;return new Promise(function(_0x3eed03,_0x5c63be){return db[_0xa862('0x1d')]['findAll']({'raw':_0x1f9b79[_0xa862('0x1e')]?_0x1f9b79[_0xa862('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1f9b79[_0xa862('0x1e')]?_0x1f9b79[_0xa862('0x1e')][_0xa862('0x1f')]||null:null,'attributes':_0x1f9b79['options']?_0x1f9b79[_0xa862('0x1e')][_0xa862('0x20')]||null:null,'limit':_0x1f9b79[_0xa862('0x1e')]?_0x1f9b79[_0xa862('0x1e')]['limit']||null:null,'include':_0x1f9b79['options']?_0x1f9b79[_0xa862('0x1e')][_0xa862('0x21')]?_[_0xa862('0x22')](_0x1f9b79[_0xa862('0x1e')][_0xa862('0x21')],function(_0x36f782){return{'model':db[_0x36f782[_0xa862('0x23')]],'as':_0x36f782['as'],'attributes':_0x36f782[_0xa862('0x20')],'include':_0x36f782['include']?_[_0xa862('0x22')](_0x36f782[_0xa862('0x21')],function(_0x3b8d43){return{'model':db[_0x3b8d43[_0xa862('0x23')]],'as':_0x3b8d43['as'],'attributes':_0x3b8d43[_0xa862('0x20')],'include':_0x3b8d43[_0xa862('0x21')]?_[_0xa862('0x22')](_0x3b8d43[_0xa862('0x21')],function(_0x106f09){return{'model':db[_0x106f09[_0xa862('0x23')]],'as':_0x106f09['as'],'attributes':_0x106f09[_0xa862('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x379e5b){logger['info']('GetFaxAccount',_0x1f9b79);logger[_0xa862('0x24')](_0xa862('0x25'),_0x1f9b79,JSON['stringify'](_0x379e5b));_0x3eed03(_0x379e5b);})[_0xa862('0x1c')](function(_0x4e7ce8){logger['error'](_0xa862('0x25'),_0x4e7ce8[_0xa862('0x1a')],_0x1f9b79);_0x5c63be(_0xdc1ab6[_0xa862('0x18')](0x1f4,_0x4e7ce8[_0xa862('0x1a')]));});});};exports[_0xa862('0x26')]=function(_0x1912dc,_0x1162cb,_0x216866){var _0x196044=this;return new Promise(function(_0x15cfc4,_0x5b8d1c){var _0x3e2f7e={'body':_0x1912dc['body'],'channel':_0xa862('0x27')};var _0x39a111=[];var _0x4aef52=[];var _0x47e820={};return db[_0xa862('0x28')][_0xa862('0x29')]()[_0xa862('0x13')](function(_0x110d7f){if(!_0x110d7f){throw new db[(_0xa862('0x2a'))][(_0xa862('0x2b'))](_0xa862('0x2c'));}_0x39a111=_[_0xa862('0x2d')](_[_0xa862('0x2e')](_0x110d7f),[_0xa862('0x2f'),_0xa862('0x30')]);_0x4aef52=_[_0xa862('0x2d')](_[_0xa862('0x2e')](_0x110d7f),[_0xa862('0x2f'),_0xa862('0x30'),_0xa862('0x31'),_0xa862('0x32')]);if(_0x1912dc[_0xa862('0x33')]['id']){delete _0x1912dc[_0xa862('0x33')]['id'];}if(_[_0xa862('0x34')](_0x1912dc[_0xa862('0x33')][_0xa862('0x35')])){throw new db[(_0xa862('0x2a'))][(_0xa862('0x2b'))](_0xa862('0x36'));}if(_['isNil'](_0x1912dc['body'][_0xa862('0x33')])||_0x1912dc[_0xa862('0x33')][_0xa862('0x33')]===''){throw new db['Sequelize'][(_0xa862('0x2b'))](_0xa862('0x37'));}if(_[_0xa862('0x34')](_0x1912dc[_0xa862('0x33')]['mapKey'])){throw new db['Sequelize'][(_0xa862('0x2b'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4aef52);}if(!_['includes'](_0x4aef52,_0x1912dc[_0xa862('0x33')][_0xa862('0x38')])){throw new db['Sequelize']['ValidationError'](_0xa862('0x39')+_0x4aef52);}_0x47e820[_0x1912dc['body'][_0xa862('0x38')]]=_0x1912dc[_0xa862('0x33')][_0xa862('0x35')];})[_0xa862('0x13')](function(){return db[_0xa862('0x1d')][_0xa862('0x3a')]({'where':{'id':_0x1912dc[_0xa862('0x3b')]['id']},'include':[{'model':db[_0xa862('0x3c')],'as':'List','include':[{'model':db['CmContact'],'as':_0xa862('0x3d'),'where':_0x47e820,'limit':0x1,'order':[['updatedAt',_0xa862('0x3e')]]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})[_0xa862('0x13')](function(_0xc7b5d9){if(_0xc7b5d9&&_0xc7b5d9[_0xa862('0x3f')]){var _0x3eed71=_0xc7b5d9[_0xa862('0x40')]({'plain':!![]});_0x3e2f7e[_0xa862('0x3b')]=_0x3eed71;_0x3e2f7e[_0xa862('0x41')]=_0x3eed71['Applications'];_0x3e2f7e[_0xa862('0x42')]=_0x3eed71[_0xa862('0x3f')];_0x3e2f7e['applications']=_['orderBy'](_0x3e2f7e[_0xa862('0x41')],['priority'],[_0xa862('0x43')]);if(_0x3e2f7e[_0xa862('0x3b')]['Applications']){delete _0x3e2f7e[_0xa862('0x3b')]['Applications'];}if(_0x3e2f7e['account'][_0xa862('0x3f')]&&_0x3e2f7e['account'][_0xa862('0x3f')][_0xa862('0x3d')][_0xa862('0x44')]){return _0x3e2f7e[_0xa862('0x3b')][_0xa862('0x3f')][_0xa862('0x3d')][0x0];}var _0x131644=_[_0xa862('0xf')](_0x1912dc[_0xa862('0x33')],{'firstName':_0x1912dc[_0xa862('0x33')][_0xa862('0x35')],'ListId':_0x3eed71['ListId']});_0x131644[_0x1912dc[_0xa862('0x33')]['mapKey']]=_0x1912dc[_0xa862('0x33')][_0xa862('0x35')];return db[_0xa862('0x28')][_0xa862('0x45')](_0x131644,{'fields':_0x39a111,'raw':!![]});}})['then'](function(_0x3b2e43){_0x3e2f7e['contact']=_0x3b2e43;if(_0x3b2e43){var _0x574c79={'ContactId':_0x3b2e43['id'],'FaxAccountId':_0x1912dc[_0xa862('0x3b')]['id'],'fax':_0x3b2e43['fax']};return db[_0xa862('0x46')][_0xa862('0x3a')]({'where':{'ContactId':_0x3b2e43['id'],'closed':![],'FaxAccountId':_0x1912dc[_0xa862('0x3b')]['id']}})[_0xa862('0x13')](function(_0x119d06){if(_0x119d06){return[_0x119d06,![]];}return db[_0xa862('0x46')][_0xa862('0x45')](_0x574c79)[_0xa862('0x13')](function(_0x123936){return[_0x123936,!![]];});});}else{throw new Error(_0xa862('0x47'));}})['spread'](function(_0x540d3c,_0xd6d527){var _0x550f4e=_0x540d3c['get']({'plain':!![]});if(_0xd6d527){if(_0x3e2f7e[_0xa862('0x3b')][_0xa862('0x48')]){_0x3e2f7e[_0xa862('0x41')][_0xa862('0x49')]({'id':0x0,'priority':_0x3e2f7e[_0xa862('0x41')][_0xa862('0x44')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xa862('0x4a')});}_0x550f4e[_0xa862('0x4b')]=!![];}else{_0x550f4e[_0xa862('0x4b')]=![];}_0x3e2f7e[_0xa862('0x4c')]=_0x550f4e;return db[_0xa862('0x4d')][_0xa862('0x45')]({'body':_0x1912dc['body']['body'],'FaxAccountId':_0x1912dc[_0xa862('0x3b')]['id'],'FaxInteractionId':_0x540d3c['id'],'direction':'in','ContactId':_0x540d3c[_0xa862('0x4e')],'AttachmentId':_0x1912dc[_0xa862('0x33')][_0xa862('0x4f')]});})[_0xa862('0x13')](function(_0x37fd22){_0x3e2f7e['message']=_0x37fd22;if(_0x3e2f7e[_0xa862('0x4c')][_0xa862('0x50')]){return db[_0xa862('0x51')][_0xa862('0x3a')]({'attributes':['id',_0xa862('0x52')],'where':{'id':_0x3e2f7e[_0xa862('0x4c')][_0xa862('0x50')]}})[_0xa862('0x13')](function(_0x9e7a51){if(_0x9e7a51){_0x3e2f7e['applications'][_0xa862('0x53')]({'id':0x0,'priority':0x0,'app':_0xa862('0x54'),'appdata':_0x9e7a51[_0xa862('0x52')]+','+(_0x3e2f7e['account'][_0xa862('0x55')]||0xa),'interval':_0xa862('0x4a')});}return respondWithRpcPromise(_0xa862('0x56'),_0xa862('0x57'),_0x3e2f7e);});}return respondWithRpcPromise(_0xa862('0x56'),_0xa862('0x57'),_0x3e2f7e);})[_0xa862('0x13')](function(_0x481022){_0x15cfc4(_0x481022);})[_0xa862('0x1c')](function(_0x11bed3){_0x5b8d1c(_0x196044[_0xa862('0x18')](0x1f4,_0x11bed3[_0xa862('0x1a')]));});});}; \ No newline at end of file +var _0x47b6=['CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','updatedAt','createdAt','ListId','isNil','from','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','FaxAccount','find','account','List','Contacts','FaxApplication','Applications','applications','list','orderBy','priority','asc','create','FaxInteraction','Contact\x20not\x20found','get','autoclose','push','length','close','created','FaxMessage','ContactId','AttachmentId','User','interaction','UserId','unshift','agent','name','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','defaults','localhost','socket.io-emitter','redis','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','GetFaxAccount','findAll','options','include','model','attributes','map','catch','body','fax'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x47b6,0xd8));var _0x647b=function(_0x585133,_0x2412a1){_0x585133=_0x585133-0x0;var _0x18254a=_0x47b6[_0x585133];return _0x18254a;};'use strict';var _=require('lodash');var util=require(_0x647b('0x0'));var moment=require(_0x647b('0x1'));var BPromise=require(_0x647b('0x2'));var rs=require(_0x647b('0x3'));var fs=require('fs');var Redis=require(_0x647b('0x4'));var db=require(_0x647b('0x5'))['db'];var utils=require(_0x647b('0x6'));var logger=require(_0x647b('0x7'))(_0x647b('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x647b('0x9')][_0x647b('0xa')]({'port':0x232c});config['redis']=_[_0x647b('0xb')](config['redis'],{'host':_0x647b('0xc'),'port':0x18eb});var socket=require(_0x647b('0xd'))(new Redis(config[_0x647b('0xe')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x4784f7,_0x5c7915,_0x20f819){return new BPromise(function(_0x1ccc2f,_0xe494ce){return client['request'](_0x4784f7,_0x20f819)[_0x647b('0xf')](function(_0x5c1f67){logger[_0x647b('0x10')](_0x647b('0x11'),_0x5c7915,_0x647b('0x12'));logger[_0x647b('0x13')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5c7915,_0x647b('0x12'),JSON['stringify'](_0x5c1f67));if(_0x5c1f67[_0x647b('0x14')]){if(_0x5c1f67[_0x647b('0x14')]['code']===0x1f4){logger[_0x647b('0x14')](_0x647b('0x11'),_0x5c7915,_0x5c1f67[_0x647b('0x14')][_0x647b('0x15')]);return _0xe494ce(_0x5c1f67[_0x647b('0x14')]['message']);}logger['error'](_0x647b('0x11'),_0x5c7915,_0x5c1f67['error']['message']);return _0x1ccc2f(_0x5c1f67[_0x647b('0x14')]['message']);}else{logger[_0x647b('0x10')](_0x647b('0x11'),_0x5c7915,'request\x20sent');_0x1ccc2f(_0x5c1f67[_0x647b('0x16')]['message']);}})['catch'](function(_0x3f8e5c){logger['error'](_0x647b('0x11'),_0x5c7915,_0x3f8e5c);_0xe494ce(_0x3f8e5c);});});}exports[_0x647b('0x17')]=function(_0x5241c3){var _0x572f77=this;return new Promise(function(_0xeb1163,_0x1ecb3f){return db['FaxAccount'][_0x647b('0x18')]({'raw':_0x5241c3[_0x647b('0x19')]?_0x5241c3[_0x647b('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5241c3[_0x647b('0x19')]?_0x5241c3['options']['where']||null:null,'attributes':_0x5241c3[_0x647b('0x19')]?_0x5241c3['options']['attributes']||null:null,'limit':_0x5241c3[_0x647b('0x19')]?_0x5241c3[_0x647b('0x19')]['limit']||null:null,'include':_0x5241c3[_0x647b('0x19')]?_0x5241c3[_0x647b('0x19')]['include']?_['map'](_0x5241c3['options'][_0x647b('0x1a')],function(_0x47db67){return{'model':db[_0x47db67[_0x647b('0x1b')]],'as':_0x47db67['as'],'attributes':_0x47db67[_0x647b('0x1c')],'include':_0x47db67[_0x647b('0x1a')]?_[_0x647b('0x1d')](_0x47db67[_0x647b('0x1a')],function(_0x2c0b35){return{'model':db[_0x2c0b35[_0x647b('0x1b')]],'as':_0x2c0b35['as'],'attributes':_0x2c0b35[_0x647b('0x1c')],'include':_0x2c0b35[_0x647b('0x1a')]?_[_0x647b('0x1d')](_0x2c0b35[_0x647b('0x1a')],function(_0x420222){return{'model':db[_0x420222[_0x647b('0x1b')]],'as':_0x420222['as'],'attributes':_0x420222[_0x647b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x647b('0xf')](function(_0x4ce5d5){logger[_0x647b('0x10')](_0x647b('0x17'),_0x5241c3);logger[_0x647b('0x13')](_0x647b('0x17'),_0x5241c3,JSON['stringify'](_0x4ce5d5));_0xeb1163(_0x4ce5d5);})[_0x647b('0x1e')](function(_0x2da1da){logger[_0x647b('0x14')](_0x647b('0x17'),_0x2da1da[_0x647b('0x15')],_0x5241c3);_0x1ecb3f(_0x572f77[_0x647b('0x14')](0x1f4,_0x2da1da[_0x647b('0x15')]));});});};exports['NotifyFaxAccount']=function(_0xca50e4,_0x11863c,_0x47d12e){var _0x487aed=this;return new Promise(function(_0x322e83,_0x2b6c52){var _0x32fdaf={'body':_0xca50e4[_0x647b('0x1f')],'channel':_0x647b('0x20')};var _0x2a3ff3=[];var _0x80ed3=[];var _0x46c833={};return db[_0x647b('0x21')]['describe']()[_0x647b('0xf')](function(_0x2fb4d8){if(!_0x2fb4d8){throw new db[(_0x647b('0x22'))][(_0x647b('0x23'))](_0x647b('0x24'));}_0x2a3ff3=_[_0x647b('0x25')](_[_0x647b('0x26')](_0x2fb4d8),['createdAt',_0x647b('0x27')]);_0x80ed3=_[_0x647b('0x25')](_[_0x647b('0x26')](_0x2fb4d8),[_0x647b('0x28'),'updatedAt','CompanyId',_0x647b('0x29')]);if(_0xca50e4['body']['id']){delete _0xca50e4[_0x647b('0x1f')]['id'];}if(_[_0x647b('0x2a')](_0xca50e4[_0x647b('0x1f')][_0x647b('0x2b')])){throw new db['Sequelize'][(_0x647b('0x23'))]('from\x20is\x20mandatory');}if(_[_0x647b('0x2a')](_0xca50e4['body'][_0x647b('0x1f')])||_0xca50e4[_0x647b('0x1f')][_0x647b('0x1f')]===''){throw new db[(_0x647b('0x22'))][(_0x647b('0x23'))](_0x647b('0x2c'));}if(_['isNil'](_0xca50e4[_0x647b('0x1f')][_0x647b('0x2d')])){throw new db[(_0x647b('0x22'))][(_0x647b('0x23'))](_0x647b('0x2e')+_0x80ed3);}if(!_[_0x647b('0x2f')](_0x80ed3,_0xca50e4[_0x647b('0x1f')]['mapKey'])){throw new db[(_0x647b('0x22'))]['ValidationError'](_0x647b('0x30')+_0x80ed3);}_0x46c833[_0xca50e4['body'][_0x647b('0x2d')]]=_0xca50e4[_0x647b('0x1f')][_0x647b('0x2b')];})[_0x647b('0xf')](function(){return db[_0x647b('0x31')][_0x647b('0x32')]({'where':{'id':_0xca50e4[_0x647b('0x33')]['id']},'include':[{'model':db['CmList'],'as':_0x647b('0x34'),'include':[{'model':db['CmContact'],'as':_0x647b('0x35'),'where':_0x46c833,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x647b('0x36')],'as':_0x647b('0x37')}]});})['then'](function(_0xb4495a){if(_0xb4495a&&_0xb4495a[_0x647b('0x34')]){var _0x5b3657=_0xb4495a['get']({'plain':!![]});_0x32fdaf[_0x647b('0x33')]=_0x5b3657;_0x32fdaf[_0x647b('0x38')]=_0x5b3657[_0x647b('0x37')];_0x32fdaf[_0x647b('0x39')]=_0x5b3657[_0x647b('0x34')];_0x32fdaf[_0x647b('0x38')]=_[_0x647b('0x3a')](_0x32fdaf[_0x647b('0x38')],[_0x647b('0x3b')],[_0x647b('0x3c')]);if(_0x32fdaf['account'][_0x647b('0x37')]){delete _0x32fdaf['account'][_0x647b('0x37')];}if(_0x32fdaf[_0x647b('0x33')][_0x647b('0x34')]&&_0x32fdaf[_0x647b('0x33')][_0x647b('0x34')][_0x647b('0x35')]['length']){return _0x32fdaf[_0x647b('0x33')][_0x647b('0x34')][_0x647b('0x35')][0x0];}var _0x4aa994=_['defaults'](_0xca50e4[_0x647b('0x1f')],{'firstName':_0xca50e4[_0x647b('0x1f')][_0x647b('0x2b')],'ListId':_0x5b3657[_0x647b('0x29')]});_0x4aa994[_0xca50e4[_0x647b('0x1f')][_0x647b('0x2d')]]=_0xca50e4[_0x647b('0x1f')]['from'];return db[_0x647b('0x21')][_0x647b('0x3d')](_0x4aa994,{'fields':_0x2a3ff3,'raw':!![]});}})[_0x647b('0xf')](function(_0x49fb13){_0x32fdaf['contact']=_0x49fb13;if(_0x49fb13){var _0x13780d={'ContactId':_0x49fb13['id'],'FaxAccountId':_0xca50e4[_0x647b('0x33')]['id'],'fax':_0x49fb13[_0x647b('0x20')]};return db['FaxInteraction'][_0x647b('0x32')]({'where':{'ContactId':_0x49fb13['id'],'closed':![],'FaxAccountId':_0xca50e4[_0x647b('0x33')]['id']}})[_0x647b('0xf')](function(_0x563882){if(_0x563882){return[_0x563882,![]];}return db[_0x647b('0x3e')][_0x647b('0x3d')](_0x13780d)[_0x647b('0xf')](function(_0x577f20){return[_0x577f20,!![]];});});}else{throw new Error(_0x647b('0x3f'));}})['spread'](function(_0x2d1dc2,_0x3202dc){var _0x255008=_0x2d1dc2[_0x647b('0x40')]({'plain':!![]});if(_0x3202dc){if(_0x32fdaf[_0x647b('0x33')][_0x647b('0x41')]){_0x32fdaf[_0x647b('0x38')][_0x647b('0x42')]({'id':0x0,'priority':_0x32fdaf[_0x647b('0x38')][_0x647b('0x43')]+0x1,'app':_0x647b('0x44'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x255008[_0x647b('0x45')]=!![];}else{_0x255008[_0x647b('0x45')]=![];}_0x32fdaf['interaction']=_0x255008;return db[_0x647b('0x46')]['create']({'body':_0xca50e4[_0x647b('0x1f')][_0x647b('0x1f')],'FaxAccountId':_0xca50e4[_0x647b('0x33')]['id'],'FaxInteractionId':_0x2d1dc2['id'],'direction':'in','ContactId':_0x2d1dc2[_0x647b('0x47')],'AttachmentId':_0xca50e4[_0x647b('0x1f')][_0x647b('0x48')]});})[_0x647b('0xf')](function(_0x5cdee2){_0x32fdaf[_0x647b('0x15')]=_0x5cdee2;if(_0x32fdaf['interaction']['UserId']){return db[_0x647b('0x49')][_0x647b('0x32')]({'attributes':['id','name'],'where':{'id':_0x32fdaf[_0x647b('0x4a')][_0x647b('0x4b')]}})[_0x647b('0xf')](function(_0x59856c){if(_0x59856c){_0x32fdaf[_0x647b('0x38')][_0x647b('0x4c')]({'id':0x0,'priority':0x0,'app':_0x647b('0x4d'),'appdata':_0x59856c[_0x647b('0x4e')]+','+(_0x32fdaf[_0x647b('0x33')][_0x647b('0x4f')]||0xa),'interval':_0x647b('0x50')});}return respondWithRpcPromise(_0x647b('0x51'),_0x647b('0x52'),_0x32fdaf);});}return respondWithRpcPromise('Start',_0x647b('0x52'),_0x32fdaf);})['then'](function(_0x2cbf6e){_0x322e83(_0x2cbf6e);})[_0x647b('0x1e')](function(_0x2bc127){_0x2b6c52(_0x487aed['error'](0x1f4,_0x2bc127[_0x647b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index b2db6fb..1c64455 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 _0x98ef=['register','length','faxAccount:','./faxAccount.events','save','remove','update','emit','removeListener'];(function(_0x1e2198,_0x2ec37f){var _0x544993=function(_0x52ee52){while(--_0x52ee52){_0x1e2198['push'](_0x1e2198['shift']());}};_0x544993(++_0x2ec37f);}(_0x98ef,0xe4));var _0xf98e=function(_0x30e64e,_0x5cc96e){_0x30e64e=_0x30e64e-0x0;var _0x56f22f=_0x98ef[_0x30e64e];return _0x56f22f;};'use strict';var FaxAccountEvents=require(_0xf98e('0x0'));var events=[_0xf98e('0x1'),_0xf98e('0x2'),_0xf98e('0x3')];function createListener(_0x15a089,_0x2c537b){return function(_0x1749be){_0x2c537b[_0xf98e('0x4')](_0x15a089,_0x1749be);};}function removeListener(_0x58fbdb,_0x1dd1f3){return function(){FaxAccountEvents[_0xf98e('0x5')](_0x58fbdb,_0x1dd1f3);};}exports[_0xf98e('0x6')]=function(_0x3931d5){for(var _0x45493b=0x0,_0x485455=events[_0xf98e('0x7')];_0x45493b<_0x485455;_0x45493b++){var _0x377efc=events[_0x45493b];var _0x200dea=createListener(_0xf98e('0x8')+_0x377efc,_0x3931d5);FaxAccountEvents['on'](_0x377efc,_0x200dea);}}; \ No newline at end of file +var _0x7c56=['remove','update','emit','removeListener','length','faxAccount:','./faxAccount.events','save'];(function(_0x19d486,_0x1fa5f1){var _0x1a51e1=function(_0x1fc9a6){while(--_0x1fc9a6){_0x19d486['push'](_0x19d486['shift']());}};_0x1a51e1(++_0x1fa5f1);}(_0x7c56,0xee));var _0x67c5=function(_0x5adffe,_0x399de5){_0x5adffe=_0x5adffe-0x0;var _0x3c1cd4=_0x7c56[_0x5adffe];return _0x3c1cd4;};'use strict';var FaxAccountEvents=require(_0x67c5('0x0'));var events=[_0x67c5('0x1'),_0x67c5('0x2'),_0x67c5('0x3')];function createListener(_0x3b5208,_0x13eb5b){return function(_0x154170){_0x13eb5b[_0x67c5('0x4')](_0x3b5208,_0x154170);};}function removeListener(_0xc40f11,_0x34941d){return function(){FaxAccountEvents[_0x67c5('0x5')](_0xc40f11,_0x34941d);};}exports['register']=function(_0x588824){for(var _0x570131=0x0,_0x290f39=events[_0x67c5('0x6')];_0x570131<_0x290f39;_0x570131++){var _0x5ec760=events[_0x570131];var _0x777bde=createListener(_0x67c5('0x7')+_0x5ec760,_0x588824);FaxAccountEvents['on'](_0x5ec760,_0x777bde);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index e7528b3..c5f1880 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(_0x1610f0,_0x204fcf){var _0x240bc1=function(_0x29f5c8){while(--_0x29f5c8){_0x1610f0['push'](_0x1610f0['shift']());}};_0x240bc1(++_0x204fcf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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(_0x2daa87,_0x1a5786){var _0x3a6b30=function(_0x1c4f2b){while(--_0x1c4f2b){_0x2daa87['push'](_0x2daa87['shift']());}};_0x3a6b30(++_0x1a5786);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 2d9baaf..fc62234 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 _0xf4ea=['exports','INTEGER','STRING','TEXT'];(function(_0x285e28,_0x4cd5fe){var _0x15ec2f=function(_0x2bbd43){while(--_0x2bbd43){_0x285e28['push'](_0x285e28['shift']());}};_0x15ec2f(++_0x4cd5fe);}(_0xf4ea,0x15c));var _0xaf4e=function(_0x37f85a,_0x240e20){_0x37f85a=_0x37f85a-0x0;var _0x190eeb=_0xf4ea[_0x37f85a];return _0x190eeb;};'use strict';var Sequelize=require('sequelize');module[_0xaf4e('0x0')]={'priority':{'type':Sequelize[_0xaf4e('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xaf4e('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xaf4e('0x3')]()},'description':{'type':Sequelize[_0xaf4e('0x2')]},'interval':{'type':Sequelize[_0xaf4e('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x6b1e=['TEXT','*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x182c8b,_0x16214b){var _0x3fe627=function(_0x1ad492){while(--_0x1ad492){_0x182c8b['push'](_0x182c8b['shift']());}};_0x3fe627(++_0x16214b);}(_0x6b1e,0x1dc));var _0xe6b1=function(_0x3555e2,_0x2313bd){_0x3555e2=_0x3555e2-0x0;var _0x4245f6=_0x6b1e[_0x3555e2];return _0x4245f6;};'use strict';var Sequelize=require(_0xe6b1('0x0'));module['exports']={'priority':{'type':Sequelize[_0xe6b1('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xe6b1('0x2')],'allowNull':![],'defaultValue':_0xe6b1('0x3')},'appdata':{'type':Sequelize[_0xe6b1('0x4')]()},'description':{'type':Sequelize[_0xe6b1('0x2')]},'interval':{'type':Sequelize[_0xe6b1('0x2')],'defaultValue':_0xe6b1('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index cf5220b..3cb05bc 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 _0x3ad0=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','FaxApplication','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','create','body','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x6ecea8,_0x3d3e70){var _0x255fcc=function(_0x5df932){while(--_0x5df932){_0x6ecea8['push'](_0x6ecea8['shift']());}};_0x255fcc(++_0x3d3e70);}(_0x3ad0,0x1b0));var _0x03ad=function(_0x1ce2e2,_0x18868a){_0x1ce2e2=_0x1ce2e2-0x0;var _0x1be1fd=_0x3ad0[_0x1ce2e2];return _0x1be1fd;};'use strict';var emlformat=require(_0x03ad('0x0'));var rimraf=require(_0x03ad('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x03ad('0x2'));var rp=require(_0x03ad('0x3'));var moment=require(_0x03ad('0x4'));var BPromise=require(_0x03ad('0x5'));var Mustache=require('mustache');var util=require(_0x03ad('0x6'));var path=require('path');var sox=require(_0x03ad('0x7'));var csv=require('to-csv');var ejs=require(_0x03ad('0x8'));var fs=require('fs');var fs_extra=require(_0x03ad('0x9'));var _=require(_0x03ad('0xa'));var squel=require('squel');var crypto=require(_0x03ad('0xb'));var jsforce=require(_0x03ad('0xc'));var deskjs=require(_0x03ad('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x03ad('0xe'));var Redis=require(_0x03ad('0xf'));var authService=require(_0x03ad('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x03ad('0x11'));var hardwareService=require(_0x03ad('0x12'));var logger=require(_0x03ad('0x13'))('api');var utils=require(_0x03ad('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x03ad('0x15'));var db=require(_0x03ad('0x16'))['db'];function respondWithStatusCode(_0x5635d3,_0x3da85f){_0x3da85f=_0x3da85f||0xcc;return function(_0x41b0d3){if(_0x41b0d3){return _0x5635d3[_0x03ad('0x17')](_0x3da85f);}return _0x5635d3[_0x03ad('0x18')](_0x3da85f)[_0x03ad('0x19')]();};}function respondWithResult(_0x2f62f9,_0x22acf5){_0x22acf5=_0x22acf5||0xc8;return function(_0x13bf87){if(_0x13bf87){return _0x2f62f9['status'](_0x22acf5)[_0x03ad('0x1a')](_0x13bf87);}};}function respondWithFilteredResult(_0x43fadc,_0x13f9f2){return function(_0x351c62){if(_0x351c62){var _0x34c7bc=typeof _0x13f9f2[_0x03ad('0x1b')]===_0x03ad('0x1c')&&typeof _0x13f9f2[_0x03ad('0x1d')]==='undefined';var _0x4e2a43=_0x351c62[_0x03ad('0x1e')];var _0x432ad0=_0x34c7bc?0x0:_0x13f9f2[_0x03ad('0x1b')];var _0x327774=_0x34c7bc?_0x351c62['count']:_0x13f9f2[_0x03ad('0x1b')]+_0x13f9f2[_0x03ad('0x1d')];var _0x8c4aee;if(_0x327774>=_0x4e2a43){_0x327774=_0x4e2a43;_0x8c4aee=0xc8;}else{_0x8c4aee=0xce;}_0x43fadc[_0x03ad('0x18')](_0x8c4aee);return _0x43fadc[_0x03ad('0x1f')]('Content-Range',_0x432ad0+'-'+_0x327774+'/'+_0x4e2a43)[_0x03ad('0x1a')](_0x351c62);}return null;};}function patchUpdates(_0xfbf4d0){return function(_0x1faaf5){try{jsonpatch[_0x03ad('0x20')](_0x1faaf5,_0xfbf4d0,!![]);}catch(_0x42e46e){return BPromise[_0x03ad('0x21')](_0x42e46e);}return _0x1faaf5[_0x03ad('0x22')]();};}function saveUpdates(_0x107741,_0x4e5b15){return function(_0x4248c9){if(_0x4248c9){return _0x4248c9[_0x03ad('0x23')](_0x107741)[_0x03ad('0x24')](function(_0x3059f0){return _0x3059f0;});}return null;};}function removeEntity(_0x594154,_0x2de35f){return function(_0x5959cc){if(_0x5959cc){return _0x5959cc[_0x03ad('0x25')]()[_0x03ad('0x24')](function(){_0x594154[_0x03ad('0x18')](0xcc)[_0x03ad('0x19')]();});}};}function handleEntityNotFound(_0xd92ace,_0x282198){return function(_0x5050af){if(!_0x5050af){_0xd92ace['sendStatus'](0x194);}return _0x5050af;};}function handleError(_0xc89580,_0x39abf9){_0x39abf9=_0x39abf9||0x1f4;return function(_0xf4b25e){logger[_0x03ad('0x26')](_0xf4b25e[_0x03ad('0x27')]);if(_0xf4b25e[_0x03ad('0x28')]){delete _0xf4b25e[_0x03ad('0x28')];}_0xc89580[_0x03ad('0x18')](_0x39abf9)[_0x03ad('0x29')](_0xf4b25e);};}exports['index']=function(_0x59c8c1,_0x428a0f){var _0x22c632={},_0x5e0b78={},_0x4c7cc3={'count':0x0,'rows':[]};var _0x20a3f6=_['map'](db[_0x03ad('0x2a')][_0x03ad('0x2b')],function(_0x1d75a0){return{'name':_0x1d75a0[_0x03ad('0x2c')],'type':_0x1d75a0[_0x03ad('0x2d')][_0x03ad('0x2e')]};});_0x5e0b78[_0x03ad('0x2f')]=_[_0x03ad('0x30')](_0x20a3f6,_0x03ad('0x28'));_0x5e0b78[_0x03ad('0x31')]=_[_0x03ad('0x32')](_0x59c8c1['query']);_0x5e0b78[_0x03ad('0x33')]=_[_0x03ad('0x34')](_0x5e0b78[_0x03ad('0x2f')],_0x5e0b78[_0x03ad('0x31')]);_0x22c632[_0x03ad('0x35')]=_[_0x03ad('0x34')](_0x5e0b78[_0x03ad('0x2f')],qs[_0x03ad('0x36')](_0x59c8c1[_0x03ad('0x31')][_0x03ad('0x36')]));_0x22c632['attributes']=_0x22c632[_0x03ad('0x35')][_0x03ad('0x37')]?_0x22c632[_0x03ad('0x35')]:_0x5e0b78[_0x03ad('0x2f')];if(!_0x59c8c1[_0x03ad('0x31')]['hasOwnProperty'](_0x03ad('0x38'))){_0x22c632['limit']=qs[_0x03ad('0x1d')](_0x59c8c1['query'][_0x03ad('0x1d')]);_0x22c632[_0x03ad('0x1b')]=qs[_0x03ad('0x1b')](_0x59c8c1[_0x03ad('0x31')][_0x03ad('0x1b')]);}_0x22c632[_0x03ad('0x39')]=qs[_0x03ad('0x3a')](_0x59c8c1[_0x03ad('0x31')]['sort']);_0x22c632['where']=qs[_0x03ad('0x33')](_[_0x03ad('0x3b')](_0x59c8c1[_0x03ad('0x31')],_0x5e0b78[_0x03ad('0x33')]),_0x20a3f6);if(_0x59c8c1[_0x03ad('0x31')][_0x03ad('0x3c')]){_0x22c632[_0x03ad('0x3d')]=_[_0x03ad('0x3e')](_0x22c632[_0x03ad('0x3d')],{'$or':_[_0x03ad('0x30')](_0x20a3f6,function(_0x4511a0){if(_0x4511a0[_0x03ad('0x2d')]!==_0x03ad('0x3f')){var _0xe59647={};_0xe59647[_0x4511a0[_0x03ad('0x28')]]={'$like':'%'+_0x59c8c1[_0x03ad('0x31')][_0x03ad('0x3c')]+'%'};return _0xe59647;}})});}_0x22c632=_[_0x03ad('0x3e')]({},_0x22c632,_0x59c8c1[_0x03ad('0x40')]);var _0x4a1b51={'where':_0x22c632[_0x03ad('0x3d')]};return db['FaxApplication'][_0x03ad('0x1e')](_0x4a1b51)[_0x03ad('0x24')](function(_0xb2ecb){_0x4c7cc3['count']=_0xb2ecb;if(_0x59c8c1[_0x03ad('0x31')][_0x03ad('0x41')]){_0x22c632['include']=[{'all':!![]}];}return db[_0x03ad('0x2a')][_0x03ad('0x42')](_0x22c632);})[_0x03ad('0x24')](function(_0x206e5f){_0x4c7cc3[_0x03ad('0x43')]=_0x206e5f;return _0x4c7cc3;})[_0x03ad('0x24')](respondWithFilteredResult(_0x428a0f,_0x22c632))[_0x03ad('0x44')](handleError(_0x428a0f,null));};exports[_0x03ad('0x45')]=function(_0x4752f2,_0xf3f520){var _0x28e63a={'raw':!![],'where':{'id':_0x4752f2['params']['id']}},_0x31dfc6={};_0x31dfc6['model']=_[_0x03ad('0x32')](db[_0x03ad('0x2a')][_0x03ad('0x2b')]);_0x31dfc6[_0x03ad('0x31')]=_[_0x03ad('0x32')](_0x4752f2['query']);_0x31dfc6[_0x03ad('0x33')]=_[_0x03ad('0x34')](_0x31dfc6['model'],_0x31dfc6[_0x03ad('0x31')]);_0x28e63a[_0x03ad('0x35')]=_[_0x03ad('0x34')](_0x31dfc6[_0x03ad('0x2f')],qs[_0x03ad('0x36')](_0x4752f2[_0x03ad('0x31')][_0x03ad('0x36')]));_0x28e63a[_0x03ad('0x35')]=_0x28e63a['attributes'][_0x03ad('0x37')]?_0x28e63a[_0x03ad('0x35')]:_0x31dfc6[_0x03ad('0x2f')];if(_0x4752f2[_0x03ad('0x31')][_0x03ad('0x41')]){_0x28e63a[_0x03ad('0x46')]=[{'all':!![]}];}_0x28e63a=_[_0x03ad('0x3e')]({},_0x28e63a,_0x4752f2[_0x03ad('0x40')]);return db[_0x03ad('0x2a')]['find'](_0x28e63a)[_0x03ad('0x24')](handleEntityNotFound(_0xf3f520,null))[_0x03ad('0x24')](respondWithResult(_0xf3f520,null))[_0x03ad('0x44')](handleError(_0xf3f520,null));};exports[_0x03ad('0x47')]=function(_0x16ec92,_0x387aaf){return db['FaxApplication']['create'](_0x16ec92['body'],{})[_0x03ad('0x24')](respondWithResult(_0x387aaf,0xc9))[_0x03ad('0x44')](handleError(_0x387aaf,null));};exports[_0x03ad('0x23')]=function(_0x382089,_0x32cf61){if(_0x382089[_0x03ad('0x48')]['id']){delete _0x382089[_0x03ad('0x48')]['id'];}return db[_0x03ad('0x2a')][_0x03ad('0x49')]({'where':{'id':_0x382089[_0x03ad('0x4a')]['id']}})[_0x03ad('0x24')](handleEntityNotFound(_0x32cf61,null))[_0x03ad('0x24')](saveUpdates(_0x382089[_0x03ad('0x48')],null))[_0x03ad('0x24')](respondWithResult(_0x32cf61,null))['catch'](handleError(_0x32cf61,null));};exports[_0x03ad('0x25')]=function(_0x4493e8,_0x216d49){return db[_0x03ad('0x2a')][_0x03ad('0x49')]({'where':{'id':_0x4493e8[_0x03ad('0x4a')]['id']}})['then'](handleEntityNotFound(_0x216d49,null))[_0x03ad('0x24')](removeEntity(_0x216d49,null))['catch'](handleError(_0x216d49,null));}; \ No newline at end of file +var _0x22ce=['rows','catch','show','params','rawAttributes','filters','length','find','create','body','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','index','map','FaxApplication','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll'];(function(_0x4c5cd4,_0x268643){var _0x210bcf=function(_0x23cf1e){while(--_0x23cf1e){_0x4c5cd4['push'](_0x4c5cd4['shift']());}};_0x210bcf(++_0x268643);}(_0x22ce,0x1d2));var _0xe22c=function(_0x3b914b,_0x194c2d){_0x3b914b=_0x3b914b-0x0;var _0x595a2f=_0x22ce[_0x3b914b];return _0x595a2f;};'use strict';var emlformat=require(_0xe22c('0x0'));var rimraf=require(_0xe22c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe22c('0x2'));var rp=require('request-promise');var moment=require(_0xe22c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe22c('0x4'));var util=require(_0xe22c('0x5'));var path=require(_0xe22c('0x6'));var sox=require(_0xe22c('0x7'));var csv=require(_0xe22c('0x8'));var ejs=require(_0xe22c('0x9'));var fs=require('fs');var fs_extra=require(_0xe22c('0xa'));var _=require('lodash');var squel=require(_0xe22c('0xb'));var crypto=require(_0xe22c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe22c('0xd'));var toCsv=require(_0xe22c('0x8'));var querystring=require(_0xe22c('0xe'));var Papa=require('papaparse');var Redis=require(_0xe22c('0xf'));var authService=require(_0xe22c('0x10'));var qs=require(_0xe22c('0x11'));var as=require(_0xe22c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe22c('0x13'))(_0xe22c('0x14'));var utils=require(_0xe22c('0x15'));var config=require(_0xe22c('0x16'));var licenseUtil=require(_0xe22c('0x17'));var db=require(_0xe22c('0x18'))['db'];function respondWithStatusCode(_0x12d747,_0x239ebb){_0x239ebb=_0x239ebb||0xcc;return function(_0x55044f){if(_0x55044f){return _0x12d747[_0xe22c('0x19')](_0x239ebb);}return _0x12d747[_0xe22c('0x1a')](_0x239ebb)[_0xe22c('0x1b')]();};}function respondWithResult(_0x5aa52e,_0x2dfbbe){_0x2dfbbe=_0x2dfbbe||0xc8;return function(_0x5efac5){if(_0x5efac5){return _0x5aa52e[_0xe22c('0x1a')](_0x2dfbbe)[_0xe22c('0x1c')](_0x5efac5);}};}function respondWithFilteredResult(_0x2de563,_0x368fb8){return function(_0x5dc46b){if(_0x5dc46b){var _0x1ed913=typeof _0x368fb8[_0xe22c('0x1d')]===_0xe22c('0x1e')&&typeof _0x368fb8[_0xe22c('0x1f')]===_0xe22c('0x1e');var _0x3a7000=_0x5dc46b[_0xe22c('0x20')];var _0x11ad25=_0x1ed913?0x0:_0x368fb8[_0xe22c('0x1d')];var _0x41d37a=_0x1ed913?_0x5dc46b[_0xe22c('0x20')]:_0x368fb8['offset']+_0x368fb8['limit'];var _0x3989bc;if(_0x41d37a>=_0x3a7000){_0x41d37a=_0x3a7000;_0x3989bc=0xc8;}else{_0x3989bc=0xce;}_0x2de563[_0xe22c('0x1a')](_0x3989bc);return _0x2de563[_0xe22c('0x21')]('Content-Range',_0x11ad25+'-'+_0x41d37a+'/'+_0x3a7000)[_0xe22c('0x1c')](_0x5dc46b);}return null;};}function patchUpdates(_0x533fc0){return function(_0x21795d){try{jsonpatch[_0xe22c('0x22')](_0x21795d,_0x533fc0,!![]);}catch(_0x41d7c7){return BPromise[_0xe22c('0x23')](_0x41d7c7);}return _0x21795d[_0xe22c('0x24')]();};}function saveUpdates(_0x37f371,_0x4a88ec){return function(_0x6ee758){if(_0x6ee758){return _0x6ee758[_0xe22c('0x25')](_0x37f371)[_0xe22c('0x26')](function(_0xebd7e){return _0xebd7e;});}return null;};}function removeEntity(_0x1ab482,_0xff3a5c){return function(_0x505e95){if(_0x505e95){return _0x505e95[_0xe22c('0x27')]()[_0xe22c('0x26')](function(){_0x1ab482['status'](0xcc)[_0xe22c('0x1b')]();});}};}function handleEntityNotFound(_0x35aa09,_0x545f61){return function(_0x154c9){if(!_0x154c9){_0x35aa09[_0xe22c('0x19')](0x194);}return _0x154c9;};}function handleError(_0x4e6cbd,_0x35a79a){_0x35a79a=_0x35a79a||0x1f4;return function(_0x259486){logger[_0xe22c('0x28')](_0x259486['stack']);if(_0x259486[_0xe22c('0x29')]){delete _0x259486['name'];}_0x4e6cbd[_0xe22c('0x1a')](_0x35a79a)[_0xe22c('0x2a')](_0x259486);};}exports[_0xe22c('0x2b')]=function(_0x26faf9,_0x3e9207){var _0x5e2bbe={},_0x224d05={},_0x24e30f={'count':0x0,'rows':[]};var _0x54bbe7=_[_0xe22c('0x2c')](db[_0xe22c('0x2d')]['rawAttributes'],function(_0x3d1f3d){return{'name':_0x3d1f3d[_0xe22c('0x2e')],'type':_0x3d1f3d['type']['key']};});_0x224d05[_0xe22c('0x2f')]=_[_0xe22c('0x2c')](_0x54bbe7,_0xe22c('0x29'));_0x224d05[_0xe22c('0x30')]=_[_0xe22c('0x31')](_0x26faf9[_0xe22c('0x30')]);_0x224d05['filters']=_[_0xe22c('0x32')](_0x224d05[_0xe22c('0x2f')],_0x224d05[_0xe22c('0x30')]);_0x5e2bbe[_0xe22c('0x33')]=_[_0xe22c('0x32')](_0x224d05['model'],qs['fields'](_0x26faf9[_0xe22c('0x30')][_0xe22c('0x34')]));_0x5e2bbe[_0xe22c('0x33')]=_0x5e2bbe[_0xe22c('0x33')]['length']?_0x5e2bbe[_0xe22c('0x33')]:_0x224d05[_0xe22c('0x2f')];if(!_0x26faf9[_0xe22c('0x30')][_0xe22c('0x35')]('nolimit')){_0x5e2bbe[_0xe22c('0x1f')]=qs[_0xe22c('0x1f')](_0x26faf9[_0xe22c('0x30')][_0xe22c('0x1f')]);_0x5e2bbe[_0xe22c('0x1d')]=qs[_0xe22c('0x1d')](_0x26faf9[_0xe22c('0x30')][_0xe22c('0x1d')]);}_0x5e2bbe[_0xe22c('0x36')]=qs[_0xe22c('0x37')](_0x26faf9['query'][_0xe22c('0x37')]);_0x5e2bbe[_0xe22c('0x38')]=qs['filters'](_[_0xe22c('0x39')](_0x26faf9[_0xe22c('0x30')],_0x224d05['filters']),_0x54bbe7);if(_0x26faf9[_0xe22c('0x30')][_0xe22c('0x3a')]){_0x5e2bbe[_0xe22c('0x38')]=_['merge'](_0x5e2bbe[_0xe22c('0x38')],{'$or':_[_0xe22c('0x2c')](_0x54bbe7,function(_0x5e6306){if(_0x5e6306[_0xe22c('0x3b')]!==_0xe22c('0x3c')){var _0x33fafe={};_0x33fafe[_0x5e6306[_0xe22c('0x29')]]={'$like':'%'+_0x26faf9[_0xe22c('0x30')]['filter']+'%'};return _0x33fafe;}})});}_0x5e2bbe=_[_0xe22c('0x3d')]({},_0x5e2bbe,_0x26faf9[_0xe22c('0x3e')]);var _0x42a9b0={'where':_0x5e2bbe[_0xe22c('0x38')]};return db[_0xe22c('0x2d')][_0xe22c('0x20')](_0x42a9b0)[_0xe22c('0x26')](function(_0x3bd3a6){_0x24e30f['count']=_0x3bd3a6;if(_0x26faf9[_0xe22c('0x30')][_0xe22c('0x3f')]){_0x5e2bbe[_0xe22c('0x40')]=[{'all':!![]}];}return db['FaxApplication'][_0xe22c('0x41')](_0x5e2bbe);})[_0xe22c('0x26')](function(_0x4c1e44){_0x24e30f[_0xe22c('0x42')]=_0x4c1e44;return _0x24e30f;})[_0xe22c('0x26')](respondWithFilteredResult(_0x3e9207,_0x5e2bbe))[_0xe22c('0x43')](handleError(_0x3e9207,null));};exports[_0xe22c('0x44')]=function(_0x1e25f5,_0x294b8a){var _0x2c9c92={'raw':!![],'where':{'id':_0x1e25f5[_0xe22c('0x45')]['id']}},_0x19c124={};_0x19c124[_0xe22c('0x2f')]=_[_0xe22c('0x31')](db[_0xe22c('0x2d')][_0xe22c('0x46')]);_0x19c124[_0xe22c('0x30')]=_[_0xe22c('0x31')](_0x1e25f5[_0xe22c('0x30')]);_0x19c124[_0xe22c('0x47')]=_[_0xe22c('0x32')](_0x19c124[_0xe22c('0x2f')],_0x19c124['query']);_0x2c9c92[_0xe22c('0x33')]=_[_0xe22c('0x32')](_0x19c124[_0xe22c('0x2f')],qs[_0xe22c('0x34')](_0x1e25f5[_0xe22c('0x30')][_0xe22c('0x34')]));_0x2c9c92['attributes']=_0x2c9c92[_0xe22c('0x33')][_0xe22c('0x48')]?_0x2c9c92['attributes']:_0x19c124[_0xe22c('0x2f')];if(_0x1e25f5[_0xe22c('0x30')]['includeAll']){_0x2c9c92[_0xe22c('0x40')]=[{'all':!![]}];}_0x2c9c92=_['merge']({},_0x2c9c92,_0x1e25f5[_0xe22c('0x3e')]);return db[_0xe22c('0x2d')][_0xe22c('0x49')](_0x2c9c92)[_0xe22c('0x26')](handleEntityNotFound(_0x294b8a,null))['then'](respondWithResult(_0x294b8a,null))[_0xe22c('0x43')](handleError(_0x294b8a,null));};exports[_0xe22c('0x4a')]=function(_0x326164,_0x38c8a8){return db[_0xe22c('0x2d')]['create'](_0x326164[_0xe22c('0x4b')],{})[_0xe22c('0x26')](respondWithResult(_0x38c8a8,0xc9))['catch'](handleError(_0x38c8a8,null));};exports['update']=function(_0x301659,_0x5e1aef){if(_0x301659['body']['id']){delete _0x301659[_0xe22c('0x4b')]['id'];}return db[_0xe22c('0x2d')][_0xe22c('0x49')]({'where':{'id':_0x301659[_0xe22c('0x45')]['id']}})[_0xe22c('0x26')](handleEntityNotFound(_0x5e1aef,null))['then'](saveUpdates(_0x301659[_0xe22c('0x4b')],null))['then'](respondWithResult(_0x5e1aef,null))[_0xe22c('0x43')](handleError(_0x5e1aef,null));};exports[_0xe22c('0x27')]=function(_0x12a817,_0x1de8d3){return db[_0xe22c('0x2d')]['find']({'where':{'id':_0x12a817[_0xe22c('0x45')]['id']}})['then'](handleEntityNotFound(_0x1de8d3,null))['then'](removeEntity(_0x1de8d3,null))[_0xe22c('0x43')](handleError(_0x1de8d3,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 0463771..6a1b60f 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 _0x783c=['rimraf','./faxApplication.attributes','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','request-promise','path'];(function(_0x52e924,_0x291abe){var _0x292ee0=function(_0x49ba42){while(--_0x49ba42){_0x52e924['push'](_0x52e924['shift']());}};_0x292ee0(++_0x291abe);}(_0x783c,0x150));var _0xc783=function(_0x323001,_0x4d5b17){_0x323001=_0x323001-0x0;var _0x1eaf97=_0x783c[_0x323001];return _0x1eaf97;};'use strict';var _=require(_0xc783('0x0'));var util=require(_0xc783('0x1'));var logger=require('../../config/logger')(_0xc783('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc783('0x3'));var fs=require('fs');var path=require(_0xc783('0x4'));var rimraf=require(_0xc783('0x5'));var config=require('../../config/environment');var attributes=require(_0xc783('0x6'));module['exports']=function(_0x52932b,_0x4a7804){return _0x52932b[_0xc783('0x7')]('FaxApplication',attributes,{'tableName':_0xc783('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc783('0x9'),'collate':_0xc783('0xa')});}; \ No newline at end of file +var _0x023a=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x29fb8f,_0xeeeb0b){var _0x25dc93=function(_0x594e49){while(--_0x594e49){_0x29fb8f['push'](_0x29fb8f['shift']());}};_0x25dc93(++_0xeeeb0b);}(_0x023a,0x168));var _0xa023=function(_0x514df3,_0x3ba1a0){_0x514df3=_0x514df3-0x0;var _0x3b980f=_0x023a[_0x514df3];return _0x3b980f;};'use strict';var _=require(_0xa023('0x0'));var util=require(_0xa023('0x1'));var logger=require(_0xa023('0x2'))('api');var moment=require(_0xa023('0x3'));var BPromise=require(_0xa023('0x4'));var rp=require(_0xa023('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa023('0x6'));var config=require(_0xa023('0x7'));var attributes=require(_0xa023('0x8'));module[_0xa023('0x9')]=function(_0x77e4d5,_0x2fe90e){return _0x77e4d5[_0xa023('0xa')](_0xa023('0xb'),attributes,{'tableName':_0xa023('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa023('0xd'),'collate':_0xa023('0xe')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 7a7c718..b945fbd 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 _0x74fe=['options','raw','where','attributes','limit','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateFaxApplication','update','body'];(function(_0x101e80,_0x289d7e){var _0x396d40=function(_0x2f4ef0){while(--_0x2f4ef0){_0x101e80['push'](_0x101e80['shift']());}};_0x396d40(++_0x289d7e);}(_0x74fe,0xca));var _0xe74f=function(_0x218104,_0x5694d1){_0x218104=_0x218104-0x0;var _0x549487=_0x74fe[_0x218104];return _0x549487;};'use strict';var _=require(_0xe74f('0x0'));var util=require(_0xe74f('0x1'));var moment=require(_0xe74f('0x2'));var BPromise=require(_0xe74f('0x3'));var rs=require(_0xe74f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe74f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe74f('0x6'))('rpc');var config=require(_0xe74f('0x7'));var jayson=require(_0xe74f('0x8'));var client=jayson['client'][_0xe74f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x109d05,_0x3844d1,_0x266c67){return new BPromise(function(_0x5b771d,_0x670a37){return client['request'](_0x109d05,_0x266c67)[_0xe74f('0xa')](function(_0xdb781f){logger[_0xe74f('0xb')](_0xe74f('0xc'),_0x3844d1,_0xe74f('0xd'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x3844d1,_0xe74f('0xd'),JSON[_0xe74f('0xe')](_0xdb781f));if(_0xdb781f[_0xe74f('0xf')]){if(_0xdb781f[_0xe74f('0xf')][_0xe74f('0x10')]===0x1f4){logger[_0xe74f('0xf')]('FaxApplication,\x20%s,\x20%s',_0x3844d1,_0xdb781f[_0xe74f('0xf')]['message']);return _0x670a37(_0xdb781f[_0xe74f('0xf')][_0xe74f('0x11')]);}logger[_0xe74f('0xf')](_0xe74f('0xc'),_0x3844d1,_0xdb781f[_0xe74f('0xf')][_0xe74f('0x11')]);return _0x5b771d(_0xdb781f['error'][_0xe74f('0x11')]);}else{logger[_0xe74f('0xb')]('FaxApplication,\x20%s,\x20%s',_0x3844d1,_0xe74f('0xd'));_0x5b771d(_0xdb781f['result'][_0xe74f('0x11')]);}})[_0xe74f('0x12')](function(_0x5f03d9){logger[_0xe74f('0xf')]('FaxApplication,\x20%s,\x20%s',_0x3844d1,_0x5f03d9);_0x670a37(_0x5f03d9);});});}exports[_0xe74f('0x13')]=function(_0x20ffa3){var _0x386d3f=this;return new Promise(function(_0x31c190,_0x458dbf){return db['FaxApplication'][_0xe74f('0x14')](_0x20ffa3[_0xe74f('0x15')],{'raw':_0x20ffa3[_0xe74f('0x16')]?_0x20ffa3['options'][_0xe74f('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20ffa3[_0xe74f('0x16')]?_0x20ffa3[_0xe74f('0x16')][_0xe74f('0x18')]||null:null,'attributes':_0x20ffa3[_0xe74f('0x16')]?_0x20ffa3['options'][_0xe74f('0x19')]||null:null,'limit':_0x20ffa3[_0xe74f('0x16')]?_0x20ffa3['options'][_0xe74f('0x1a')]||null:null})[_0xe74f('0xa')](function(_0x137a01){logger['info'](_0xe74f('0x13'),_0x20ffa3);logger[_0xe74f('0x1b')](_0xe74f('0x13'),_0x20ffa3,JSON[_0xe74f('0xe')](_0x137a01));_0x31c190(_0x137a01);})[_0xe74f('0x12')](function(_0x531656){logger[_0xe74f('0xf')](_0xe74f('0x13'),_0x531656['message'],_0x20ffa3);_0x458dbf(_0x386d3f[_0xe74f('0xf')](0x1f4,_0x531656[_0xe74f('0x11')]));});});}; \ No newline at end of file +var _0x6d05=['UpdateFaxApplication','update','body','options','raw','where','attributes','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch'];(function(_0x2f6a12,_0x4bf49e){var _0x3f5414=function(_0x1bce51){while(--_0x1bce51){_0x2f6a12['push'](_0x2f6a12['shift']());}};_0x3f5414(++_0x4bf49e);}(_0x6d05,0x115));var _0x56d0=function(_0x1ca48f,_0x1e298b){_0x1ca48f=_0x1ca48f-0x0;var _0x4a1825=_0x6d05[_0x1ca48f];return _0x4a1825;};'use strict';var _=require('lodash');var util=require(_0x56d0('0x0'));var moment=require(_0x56d0('0x1'));var BPromise=require(_0x56d0('0x2'));var rs=require(_0x56d0('0x3'));var fs=require('fs');var Redis=require(_0x56d0('0x4'));var db=require(_0x56d0('0x5'))['db'];var utils=require(_0x56d0('0x6'));var logger=require(_0x56d0('0x7'))(_0x56d0('0x8'));var config=require(_0x56d0('0x9'));var jayson=require(_0x56d0('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x258b9e,_0x1ffa38,_0x3f74e4){return new BPromise(function(_0x5e7624,_0x42c2e5){return client[_0x56d0('0xb')](_0x258b9e,_0x3f74e4)[_0x56d0('0xc')](function(_0x4f9089){logger['info'](_0x56d0('0xd'),_0x1ffa38,_0x56d0('0xe'));logger[_0x56d0('0xf')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x1ffa38,_0x56d0('0xe'),JSON[_0x56d0('0x10')](_0x4f9089));if(_0x4f9089[_0x56d0('0x11')]){if(_0x4f9089[_0x56d0('0x11')][_0x56d0('0x12')]===0x1f4){logger[_0x56d0('0x11')](_0x56d0('0xd'),_0x1ffa38,_0x4f9089[_0x56d0('0x11')][_0x56d0('0x13')]);return _0x42c2e5(_0x4f9089[_0x56d0('0x11')][_0x56d0('0x13')]);}logger['error'](_0x56d0('0xd'),_0x1ffa38,_0x4f9089[_0x56d0('0x11')][_0x56d0('0x13')]);return _0x5e7624(_0x4f9089[_0x56d0('0x11')][_0x56d0('0x13')]);}else{logger[_0x56d0('0x14')](_0x56d0('0xd'),_0x1ffa38,_0x56d0('0xe'));_0x5e7624(_0x4f9089[_0x56d0('0x15')][_0x56d0('0x13')]);}})[_0x56d0('0x16')](function(_0x3b284e){logger[_0x56d0('0x11')](_0x56d0('0xd'),_0x1ffa38,_0x3b284e);_0x42c2e5(_0x3b284e);});});}exports[_0x56d0('0x17')]=function(_0x49dab2){var _0x495391=this;return new Promise(function(_0x3128bf,_0xa52679){return db['FaxApplication'][_0x56d0('0x18')](_0x49dab2[_0x56d0('0x19')],{'raw':_0x49dab2['options']?_0x49dab2[_0x56d0('0x1a')][_0x56d0('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49dab2[_0x56d0('0x1a')]?_0x49dab2[_0x56d0('0x1a')][_0x56d0('0x1c')]||null:null,'attributes':_0x49dab2[_0x56d0('0x1a')]?_0x49dab2[_0x56d0('0x1a')][_0x56d0('0x1d')]||null:null,'limit':_0x49dab2['options']?_0x49dab2[_0x56d0('0x1a')]['limit']||null:null})['then'](function(_0x2266a8){logger['info'](_0x56d0('0x17'),_0x49dab2);logger[_0x56d0('0xf')](_0x56d0('0x17'),_0x49dab2,JSON[_0x56d0('0x10')](_0x2266a8));_0x3128bf(_0x2266a8);})['catch'](function(_0x7af811){logger[_0x56d0('0x11')](_0x56d0('0x17'),_0x7af811[_0x56d0('0x13')],_0x49dab2);_0xa52679(_0x495391[_0x56d0('0x11')](0x1f4,_0x7af811[_0x56d0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 0bd1bf3..d62bf96 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 _0xefda=['post','create','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','index','/:id','isAuthenticated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xefda,0x96));var _0xaefd=function(_0x3a0570,_0xf8115d){_0x3a0570=_0x3a0570-0x0;var _0x4db6a7=_0xefda[_0x3a0570];return _0x4db6a7;};'use strict';var multer=require(_0xaefd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaefd('0x1'));var express=require(_0xaefd('0x2'));var router=express['Router']();var fs_extra=require(_0xaefd('0x3'));var auth=require(_0xaefd('0x4'));var interaction=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var controller=require(_0xaefd('0x7'));router[_0xaefd('0x8')]('/',auth['isAuthenticated'](),controller[_0xaefd('0x9')]);router[_0xaefd('0x8')](_0xaefd('0xa'),auth[_0xaefd('0xb')](),controller['show']);router[_0xaefd('0xc')]('/',auth[_0xaefd('0xb')](),controller[_0xaefd('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xaefd('0xe')]);router[_0xaefd('0xf')](_0xaefd('0xa'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x10')]);module[_0xaefd('0x11')]=router; \ No newline at end of file +var _0xed3c=['index','show','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./faxApplication.controller','get','isAuthenticated'];(function(_0x4807a0,_0x36bbd3){var _0x4939e9=function(_0x45ce65){while(--_0x45ce65){_0x4807a0['push'](_0x4807a0['shift']());}};_0x4939e9(++_0x36bbd3);}(_0xed3c,0x1a6));var _0xced3=function(_0x1f8ee9,_0x521f85){_0x1f8ee9=_0x1f8ee9-0x0;var _0x24c8a9=_0xed3c[_0x1f8ee9];return _0x24c8a9;};'use strict';var multer=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var path=require(_0xced3('0x2'));var timeout=require(_0xced3('0x3'));var express=require('express');var router=express[_0xced3('0x4')]();var fs_extra=require(_0xced3('0x5'));var auth=require(_0xced3('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xced3('0x7'));router[_0xced3('0x8')]('/',auth[_0xced3('0x9')](),controller[_0xced3('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xced3('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xced3('0xc')](_0xced3('0xd'),auth[_0xced3('0x9')](),controller[_0xced3('0xe')]);router[_0xced3('0xf')]('/:id',auth[_0xced3('0x9')](),controller[_0xced3('0x10')]);module[_0xced3('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index e1d2171..43e5302 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 _0x3e45=['DATE','STRING','ENUM','out','exports','BOOLEAN'];(function(_0x42dcbb,_0x3bab87){var _0x597f5d=function(_0x3c93c6){while(--_0x3c93c6){_0x42dcbb['push'](_0x42dcbb['shift']());}};_0x597f5d(++_0x3bab87);}(_0x3e45,0x14e));var _0x53e4=function(_0x442f58,_0x4dd6f7){_0x442f58=_0x442f58-0x0;var _0x38c20e=_0x3e45[_0x442f58];return _0x38c20e;};'use strict';var Sequelize=require('sequelize');module[_0x53e4('0x0')]={'closed':{'type':Sequelize[_0x53e4('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x53e4('0x2')]},'disposition':{'type':Sequelize[_0x53e4('0x3')]},'secondDisposition':{'type':Sequelize[_0x53e4('0x3')]},'thirdDisposition':{'type':Sequelize[_0x53e4('0x3')]},'note':{'type':Sequelize[_0x53e4('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x53e4('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x53e4('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x53e4('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x53e4('0x4')]('in',_0x53e4('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x95d2=['BOOLEAN','DATE','STRING','ENUM','out','exports'];(function(_0x158092,_0x4954b6){var _0x1c5d96=function(_0x18e30f){while(--_0x18e30f){_0x158092['push'](_0x158092['shift']());}};_0x1c5d96(++_0x4954b6);}(_0x95d2,0xe3));var _0x295d=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x95d2[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require('sequelize');module[_0x295d('0x0')]={'closed':{'type':Sequelize[_0x295d('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x295d('0x2')]},'disposition':{'type':Sequelize[_0x295d('0x3')]},'secondDisposition':{'type':Sequelize[_0x295d('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x295d('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x295d('0x4')]('in',_0x295d('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x295d('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x295d('0x4')]('in',_0x295d('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 a50640c..27ac2db 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 _0xa76b=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','destroy','error','name','Users','map','TagIds','Tags','forEach','push','then','waiting','talking','answered','unmanaged','UserId','closed','total','index','FaxInteraction','fieldName','type','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','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)','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?','buildExpression','body','start','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','user','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','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','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','all','rows','catch','show','rawAttributes','attributes','options','create','params','describe','addMessage','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','findAll','addTags','spread','emit','faxInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','download','log','err'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xa76b,0xdf));var _0xba76=function(_0x4c2bec,_0x4fadfa){_0x4c2bec=_0x4c2bec-0x0;var _0x13a6b8=_0xa76b[_0x4c2bec];return _0x13a6b8;};'use strict';var emlformat=require(_0xba76('0x0'));var rimraf=require(_0xba76('0x1'));var zipdir=require(_0xba76('0x2'));var jsonpatch=require(_0xba76('0x3'));var rp=require(_0xba76('0x4'));var moment=require(_0xba76('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xba76('0x6'));var util=require(_0xba76('0x7'));var path=require(_0xba76('0x8'));var sox=require('sox');var csv=require(_0xba76('0x9'));var ejs=require(_0xba76('0xa'));var fs=require('fs');var fs_extra=require(_0xba76('0xb'));var _=require(_0xba76('0xc'));var squel=require(_0xba76('0xd'));var crypto=require('crypto');var jsforce=require(_0xba76('0xe'));var deskjs=require(_0xba76('0xf'));var toCsv=require(_0xba76('0x9'));var querystring=require('querystring');var Papa=require(_0xba76('0x10'));var Redis=require(_0xba76('0x11'));var authService=require(_0xba76('0x12'));var qs=require(_0xba76('0x13'));var as=require(_0xba76('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba76('0x15'))(_0xba76('0x16'));var utils=require(_0xba76('0x17'));var config=require(_0xba76('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xba76('0x19')](config[_0xba76('0x1a')],{'host':_0xba76('0x1b'),'port':0x18eb});var socket=require(_0xba76('0x1c'))(new Redis(config[_0xba76('0x1a')]));require(_0xba76('0x1d'))[_0xba76('0x1e')](socket);function respondWithStatusCode(_0x52617b,_0x558051){_0x558051=_0x558051||0xcc;return function(_0x240b38){if(_0x240b38){return _0x52617b[_0xba76('0x1f')](_0x558051);}return _0x52617b[_0xba76('0x20')](_0x558051)[_0xba76('0x21')]();};}function respondWithResult(_0x459b13,_0x5d9cd4){_0x5d9cd4=_0x5d9cd4||0xc8;return function(_0x4c23fe){if(_0x4c23fe){return _0x459b13[_0xba76('0x20')](_0x5d9cd4)[_0xba76('0x22')](_0x4c23fe);}};}function respondWithFilteredResult(_0x481a7f,_0xc57fba){return function(_0x300d73){if(_0x300d73){var _0x52ffe1=typeof _0xc57fba[_0xba76('0x23')]==='undefined'&&typeof _0xc57fba[_0xba76('0x24')]==='undefined';var _0x95888b=_0x300d73[_0xba76('0x25')];var _0x58e47a=_0x52ffe1?0x0:_0xc57fba[_0xba76('0x23')];var _0x9d01fe=_0x52ffe1?_0x300d73[_0xba76('0x25')]:_0xc57fba[_0xba76('0x23')]+_0xc57fba[_0xba76('0x24')];var _0x2cff63;if(_0x9d01fe>=_0x95888b){_0x9d01fe=_0x95888b;_0x2cff63=0xc8;}else{_0x2cff63=0xce;}_0x481a7f[_0xba76('0x20')](_0x2cff63);return _0x481a7f[_0xba76('0x26')](_0xba76('0x27'),_0x58e47a+'-'+_0x9d01fe+'/'+_0x95888b)[_0xba76('0x22')](_0x300d73);}return null;};}function patchUpdates(_0x2b0cf8){return function(_0x323d7c){try{jsonpatch[_0xba76('0x28')](_0x323d7c,_0x2b0cf8,!![]);}catch(_0x42b060){return BPromise['reject'](_0x42b060);}return _0x323d7c[_0xba76('0x29')]();};}function saveUpdates(_0x331791,_0x5a6809){return function(_0x5841e6){if(_0x5841e6){return _0x5841e6[_0xba76('0x2a')](_0x331791)['then'](function(_0x422991){return _0x422991;});}return null;};}function removeEntity(_0x4f96f0,_0x285ce7){return function(_0x5705d7){if(_0x5705d7){return _0x5705d7[_0xba76('0x2b')]()['then'](function(){_0x4f96f0[_0xba76('0x20')](0xcc)[_0xba76('0x21')]();});}};}function handleEntityNotFound(_0x1faaa2,_0x47062a){return function(_0x24a6ca){if(!_0x24a6ca){_0x1faaa2['sendStatus'](0x194);}return _0x24a6ca;};}function handleError(_0x4b0abf,_0x5383d2){_0x5383d2=_0x5383d2||0x1f4;return function(_0x4dbbe2){logger[_0xba76('0x2c')](_0x4dbbe2['stack']);if(_0x4dbbe2[_0xba76('0x2d')]){delete _0x4dbbe2[_0xba76('0x2d')];}_0x4b0abf[_0xba76('0x20')](_0x5383d2)['send'](_0x4dbbe2);};}function getInteractionUsers(_0x2c9f0f,_0x52ef57){return new BPromise(function(_0x3499af,_0x80a2d6){try{if(_0x52ef57[_0x2c9f0f['id']]){_0x2c9f0f[_0xba76('0x2e')]=_[_0xba76('0x2f')](_0x52ef57[_0x2c9f0f['id']],function(_0x5857ed){return{'id':_0x5857ed['id'],'fullname':_0x5857ed['fullname']};});}}catch(_0x2abb96){_0x80a2d6(_0x2abb96);}_0x3499af(_0x2c9f0f);});}function getInteractionTags(_0x109b03,_0x52091a){return new BPromise(function(_0x5b95e4,_0x57b859){try{if(_0x109b03[_0xba76('0x30')]){_0x109b03[_0xba76('0x31')]=[];_0x109b03[_0xba76('0x30')]['split'](',')[_0xba76('0x32')](function(_0x57a48e){_0x109b03[_0xba76('0x31')][_0xba76('0x33')](_0x52091a[_0x57a48e]);});}delete _0x109b03[_0xba76('0x30')];}catch(_0xd957cc){_0x57b859(_0xd957cc);}_0x5b95e4(_0x109b03);});}function updateFaxInteraction(_0x71f940,_0x538097,_0x48faf1){return new BPromise(function(_0x295dd3,_0x171bfa){return getInteractionUsers(_0x71f940,_0x48faf1)[_0xba76('0x34')](function(_0x526639){return getInteractionTags(_0x526639,_0x538097);})['then'](function(_0x2f85ce){return getStateInteraction(_0x2f85ce);})[_0xba76('0x34')](function(_0x7d19e6){_0x295dd3(_0x7d19e6);})['catch'](function(_0x4253d7){_0x171bfa(_0x4253d7);});});}function getStateInteraction(_0x381059){return new BPromise(function(_0x4305ae){_0x381059[_0xba76('0x35')]=0x0;_0x381059[_0xba76('0x36')]=0x0;_0x381059[_0xba76('0x37')]=0x0;_0x381059[_0xba76('0x38')]=0x0;_0x381059['total']=0x0;if(!_0x381059['closed']&&!_0x381059[_0xba76('0x39')]){_0x381059[_0xba76('0x35')]+=0x1;}if(!_0x381059['closed']&&_0x381059['UserId']){_0x381059[_0xba76('0x36')]+=0x1;if(_0x381059['waiting']){_0x381059[_0xba76('0x35')]-=0x1;}}if(_0x381059['closed']&&_0x381059[_0xba76('0x39')]){_0x381059['answered']+=0x1;if(_0x381059[_0xba76('0x36')]){_0x381059['talking']-=0x1;}}if(_0x381059[_0xba76('0x3a')]&&!_0x381059[_0xba76('0x39')]){_0x381059[_0xba76('0x38')]+=0x1;if(_0x381059[_0xba76('0x35')]){_0x381059[_0xba76('0x35')]-=0x1;}}_0x381059[_0xba76('0x3b')]+=0x1;_0x4305ae(_0x381059);});}exports[_0xba76('0x3c')]=function(_0x350796,_0xdf2f05){var _0x191730={},_0x2c03ec={},_0x416672={'count':0x0,'rows':[]};var _0x3b305e=_['map'](db[_0xba76('0x3d')]['rawAttributes'],function(_0x547763){return{'name':_0x547763[_0xba76('0x3e')],'type':_0x547763[_0xba76('0x3f')][_0xba76('0x40')]};});_0x2c03ec[_0xba76('0x41')]=_[_0xba76('0x2f')](_0x3b305e,_0xba76('0x2d'));_0x2c03ec[_0xba76('0x42')]=_[_0xba76('0x43')](_0x350796[_0xba76('0x42')]);_0x2c03ec[_0xba76('0x44')]=_[_0xba76('0x45')](_0x2c03ec['model'],_0x2c03ec[_0xba76('0x42')]);_0x191730['attributes']=_[_0xba76('0x45')](_0x2c03ec[_0xba76('0x41')],qs[_0xba76('0x46')](_0x350796[_0xba76('0x42')][_0xba76('0x46')]));_0x191730['attributes']=_0x191730['attributes'][_0xba76('0x47')]?_0x191730['attributes']:_0x2c03ec['model'];if(!_0x350796[_0xba76('0x42')][_0xba76('0x48')](_0xba76('0x49'))){_0x191730[_0xba76('0x24')]=qs['limit'](_0x350796['query'][_0xba76('0x24')]);_0x191730[_0xba76('0x23')]=qs[_0xba76('0x23')](_0x350796[_0xba76('0x42')]['offset']);}_0x191730[_0xba76('0x4a')]=qs[_0xba76('0x4b')](_0x350796[_0xba76('0x42')][_0xba76('0x4b')]);_0x191730[_0xba76('0x4c')]=qs[_0xba76('0x44')](_[_0xba76('0x4d')](_0x350796[_0xba76('0x42')],_0x2c03ec[_0xba76('0x44')]),_0x3b305e);var _0x2410c9=[];var _0x4857d3=squel['select']()['field']('id')[_0xba76('0x4e')]('name')[_0xba76('0x4e')](_0xba76('0x4f'))[_0xba76('0x50')](_0xba76('0x51'));var _0x5a3681=squel[_0xba76('0x52')]()[_0xba76('0x4e')](_0xba76('0x53'))[_0xba76('0x4e')](_0xba76('0x54'))[_0xba76('0x4e')](_0xba76('0x55'))[_0xba76('0x50')](_0xba76('0x56'),'ui')[_0xba76('0x57')]('users','u',_0xba76('0x58'));var _0x38bd80=squel[_0xba76('0x52')]()[_0xba76('0x50')](_0xba76('0x59'),'i')[_0xba76('0x57')](_0xba76('0x5a'),'c',_0xba76('0x5b'))[_0xba76('0x57')]('users','o',_0xba76('0x5c'))['left_join'](_0xba76('0x5d'),'a','a.id\x20=\x20i.FaxAccountId')[_0xba76('0x57')]('fax_messages','me','me.FaxInteractionId\x20=\x20i.id')[_0xba76('0x57')](_0xba76('0x5e'),'it',_0xba76('0x5f'))['left_join'](_0xba76('0x51'),'t','t.id\x20=\x20it.TagId');var _0x18bd53=squel['expr']();var _0x4bad05=[];var _0x1f66b7=squel[_0xba76('0x60')]();var _0x6bb5a8;if(_0x350796[_0xba76('0x42')][_0xba76('0x61')]){_0x6bb5a8=as[_0xba76('0x62')](_0x350796[_0xba76('0x42')][_0xba76('0x61')]);var _0xadbc5b=_0x6bb5a8[_0xba76('0x63')];for(var _0x57ad0c=0x0;_0x57ad0c<_0x6bb5a8[_0xba76('0x64')][_0xba76('0x47')];_0x57ad0c++){var _0x464046=_0x6bb5a8['conditions'][_0x57ad0c];var _0x224986='i';var _0x21c2af=_[_0xba76('0x65')](_0x3b305e,[_0xba76('0x2d'),_0x464046[_0xba76('0x4e')]]);if(!_0x21c2af){switch(_0x464046[_0xba76('0x4e')]){case _0xba76('0x66'):if(_0x464046[_0xba76('0x67')]==0x1){_0x38bd80[_0xba76('0x68')]('`'+_0x464046['field']+_0xba76('0x69'));}else{_0x38bd80[_0xba76('0x68')]('`'+_0x464046[_0xba76('0x4e')]+'`\x20>\x200');}break;case _0xba76('0x6a'):if(_0x464046[_0xba76('0x6b')]===_0xba76('0x6c')){if(_0x464046[_0xba76('0x67')][_0xba76('0x6d')]('\x20')['length']>0x1){_0x18bd53[_0xadbc5b](_0xba76('0x6e'),qs['getFullTextValue'](_0x464046[_0xba76('0x67')]),null);}else{var _0x47e3d9='%'+_0x464046[_0xba76('0x67')]+'%';_0x18bd53[_0xadbc5b](_0xba76('0x6f'),_0x47e3d9,_0x47e3d9,_0x47e3d9);}}else{_0x21c2af=_[_0xba76('0x65')](_0x3b305e,[_0xba76('0x2d'),_0xba76('0x70')]);_0x464046[_0xba76('0x4e')]=_0xba76('0x70');_0x2e8900=as['buildExpression'](_0x224986,_0x21c2af[_0xba76('0x3f')],_0x464046);_0x18bd53[_0xadbc5b](_0x2e8900[_0xba76('0x71')],_0x2e8900['value']['start'],_0x2e8900[_0xba76('0x67')][_0xba76('0x21')]);}break;case _0xba76('0x72'):var _0x52eee3=_0x464046[_0xba76('0x67')][_0xba76('0x6d')](',')['map'](function(_0x52ef5b){return Number(_0x52ef5b);});_0x52eee3[_0xba76('0x32')](function(_0x5346fd){_0x1f66b7['or'](_0xba76('0x73'),'%,'+_0x5346fd+',%');});_0x4bad05=_[_0xba76('0x74')](_0x4bad05,_0x52eee3);break;case _0xba76('0x75'):if(_0x464046[_0xba76('0x6b')]===_0xba76('0x6c')){_0x18bd53[_0xadbc5b](_0xba76('0x76'),'%'+_0x464046[_0xba76('0x67')]+'%',null);}else{_0x21c2af=_[_0xba76('0x65')](_0x3b305e,[_0xba76('0x2d'),_0xba76('0x39')]);_0x464046[_0xba76('0x4e')]=_0xba76('0x39');_0x2e8900=as[_0xba76('0x77')](_0x224986,_0x21c2af['type'],_0x464046);_0x18bd53[_0xadbc5b](_0x2e8900[_0xba76('0x71')],_0x2e8900[_0xba76('0x67')]['start'],_0x2e8900[_0xba76('0x67')][_0xba76('0x21')]);}break;case _0xba76('0x78'):_0x2e8900=as['buildExpression']('me',null,_0x464046);_0x18bd53[_0xadbc5b](_0x2e8900[_0xba76('0x71')],_0x2e8900[_0xba76('0x67')]['start'],_0x2e8900[_0xba76('0x67')][_0xba76('0x21')]);break;}}else{var _0x2e8900=as[_0xba76('0x77')](_0x224986,_0x21c2af['type'],_0x464046);_0x18bd53[_0xadbc5b](_0x2e8900[_0xba76('0x71')],_0x2e8900['value'][_0xba76('0x79')],_0x2e8900[_0xba76('0x67')][_0xba76('0x21')]);}}}else{var _0x6b45fd=_(_0x350796[_0xba76('0x42')])[_0xba76('0x43')]()['map'](function(_0x5bf7d8){return _['some'](_0x3b305e,[_0xba76('0x2d'),_0x5bf7d8])?_0x5bf7d8:undefined;})['compact']()[_0xba76('0x67')]();if(!_[_0xba76('0x7a')](_0x6b45fd)){_0x6b45fd['forEach'](function(_0x58fee8){if(_0x58fee8===_0xba76('0x7b')){_0x38bd80[_0xba76('0x4c')](_0xba76('0x7c'),[][_0xba76('0x7d')](_0x350796[_0xba76('0x42')][_0x58fee8]));}else if(_0x58fee8===_0xba76('0x7e')){var _0x1a2692=JSON['parse'](_0x350796['query'][_0x58fee8])[_0xba76('0x7f')];var _0x55f3ff=JSON[_0xba76('0x80')](_0x350796['query'][_0x58fee8])[_0xba76('0x81')];_0x38bd80[_0xba76('0x4c')](_0xba76('0x82'),_0x1a2692,_0x55f3ff);}else{if(_0x350796['query'][_0x58fee8]==='null'){_0x38bd80['where']('i.'+_0x58fee8+_0xba76('0x83'));}else{_0x38bd80[_0xba76('0x4c')]('i.'+_0x58fee8+_0xba76('0x84'),_0x350796[_0xba76('0x42')][_0x58fee8]);}}});}if(_0x350796[_0xba76('0x42')][_0xba76('0x85')]){if(_0x350796[_0xba76('0x42')][_0xba76('0x85')]==0x1){_0x38bd80[_0xba76('0x68')](_0xba76('0x86'));}else{_0x38bd80[_0xba76('0x68')](_0xba76('0x87'));}}if(_0x350796[_0xba76('0x42')][_0xba76('0x88')]){_0x4bad05=_['isArray'](_0x350796['query']['tag'])?_0x350796[_0xba76('0x42')][_0xba76('0x88')]:new Array(_0x350796[_0xba76('0x42')][_0xba76('0x88')]);_0x4bad05['forEach'](function(_0x326f9f){_0x1f66b7['or'](_0xba76('0x73'),'%,'+_0x326f9f+',%');});}if(_0x350796['query'][_0xba76('0x89')]){var _0x3b9295=_0x350796[_0xba76('0x42')][_0xba76('0x89')][_0xba76('0x8a')]('\x5c','\x5c\x5c')[_0xba76('0x8a')](/'/g,'\x27\x27');if(qs[_0xba76('0x8b')](_0x3b9295)){_0x18bd53['or'](_0xba76('0x8c'),_0x3b9295+'%')['or'](_0xba76('0x8d'),_0x3b9295+'%');}_0x18bd53['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3b9295+'%');}}_0x38bd80['where'](_0x18bd53);_0x38bd80[_0xba76('0x8e')]('i.id');var _0x3f380f={'type':db['Sequelize'][_0xba76('0x8f')]['SELECT'],'raw':!![]};var _0x43a33d=_0x38bd80[_0xba76('0x90')]();_0x43a33d[_0xba76('0x4e')]('i.id');_0x43a33d[_0xba76('0x4e')](_0xba76('0x91'),_0xba76('0x66'));if(_0x191730[_0xba76('0x4a')]){_0x191730['order'][_0xba76('0x32')](function(_0x55ba85){var _0x3d0572=_0x55ba85[0x0]===_0xba76('0x92')?_0x55ba85[0x0]:'i.'+_0x55ba85[0x0];_0x38bd80['order'](_0x3d0572,_0x55ba85[0x1]===_0xba76('0x93')?![]:!![]);});}if(!_['isEmpty'](_0x4bad05)){_0x38bd80['having'](_0x1f66b7);_0x43a33d[_0xba76('0x4c')](_0xba76('0x94'),_0x4bad05);}BPromise[_0xba76('0x95')]()[_0xba76('0x34')](function(){if(!_0x6bb5a8){if(_0x350796[_0xba76('0x42')]['FaxAccountId'])return;_0x43a33d[_0xba76('0x4c')](_0xba76('0x96'));_0x38bd80[_0xba76('0x4c')](_0xba76('0x96'));return;}if(_0x350796['user'][_0xba76('0x97')]!=='agent')return;return _0x350796[_0xba76('0x98')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xba76('0x34')](function(_0x192053){if(_[_0xba76('0x7a')](_0x192053)){_0x43a33d[_0xba76('0x4c')]('i.FaxAccountId\x20IS\x20NULL');_0x38bd80[_0xba76('0x4c')](_0xba76('0x99'));}else{_0x43a33d['where']('i.FaxAccountId\x20IN\x20?',_[_0xba76('0x2f')](_0x192053,'id'));_0x38bd80[_0xba76('0x4c')]('i.FaxAccountId\x20IN\x20?',_[_0xba76('0x2f')](_0x192053,'id'));}});})[_0xba76('0x34')](function(){if(_0x350796[_0xba76('0x98')][_0xba76('0x97')]==='agent'&&!_0x6bb5a8&&!_0x350796[_0xba76('0x42')][_0xba76('0x7b')])return[];return db[_0xba76('0x9a')][_0xba76('0x42')](_0x43a33d[_0xba76('0x9b')](),_0x3f380f);})[_0xba76('0x34')](function(_0xb081fb){_0x416672[_0xba76('0x25')]=_0xb081fb[_0xba76('0x47')];if(_0x416672[_0xba76('0x25')]===0x0)return[];return db[_0xba76('0x9a')][_0xba76('0x42')](_0x4857d3[_0xba76('0x9b')](),_0x3f380f)[_0xba76('0x34')](function(_0x3e2479){_0x2410c9=_[_0xba76('0x9c')](_0x3e2479,'id');_0x3f380f=_[_0xba76('0x9d')](_0x3f380f,{'model':db[_0xba76('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x350796['query'][_0xba76('0x46')]){_0x191730['attributes']['forEach'](function(_0xd2a382){_0x38bd80['field']('i.'+_0xd2a382);});}else{_0x38bd80[_0xba76('0x4e')](_0xba76('0x91'),_0xba76('0x66'));_0x38bd80['field'](_0xba76('0x9e'),'Account.key');_0x38bd80['field'](_0xba76('0x9f'),_0xba76('0xa0'));_0x38bd80[_0xba76('0x4e')](_0xba76('0xa1'),_0xba76('0x92'));_0x38bd80[_0xba76('0x4e')](_0xba76('0xa2'));_0x38bd80['field'](_0xba76('0xa3'),_0xba76('0xa4'));_0x38bd80[_0xba76('0x4e')](_0xba76('0xa5'),_0xba76('0xa6'));_0x38bd80['field'](_0xba76('0xa7'),_0xba76('0xa8'));_0x38bd80[_0xba76('0x4e')](_0xba76('0xa9'),_0xba76('0xaa'));_0x38bd80[_0xba76('0x4e')](_0xba76('0xab'),_0xba76('0xac'));_0x38bd80[_0xba76('0x4e')](_0xba76('0xad'),_0xba76('0xae'));_0x38bd80[_0xba76('0x4e')]('o.fullname',_0xba76('0xaf'));_0x38bd80[_0xba76('0x4e')]('o.internal',_0xba76('0xb0'));_0x38bd80['field'](_0xba76('0xb1'),_0xba76('0x30'));}if(_0x191730[_0xba76('0x24')])_0x38bd80[_0xba76('0x24')](_0x191730[_0xba76('0x24')]);if(_0x191730['offset'])_0x38bd80[_0xba76('0x23')](_0x191730['offset']);return db['sequelize'][_0xba76('0x42')](_0x38bd80['toString'](),_0x3f380f);})[_0xba76('0x34')](function(_0x29e9ef){if(_0x29e9ef['length']>0x0)_0x5a3681[_0xba76('0x4c')]('ui.FaxInteractionId\x20IN\x20?',_[_0xba76('0x2f')](_0x29e9ef,'id'));return db['sequelize'][_0xba76('0x42')](_0x5a3681[_0xba76('0x9b')](),_0x3f380f)['then'](function(_0x4a30f4){var _0x6d54f2=_[_0xba76('0xb2')](_0x4a30f4,_0xba76('0xb3'));var _0x107916=[];_0x29e9ef[_0xba76('0x32')](function(_0x4238b7){_0x107916['push'](updateFaxInteraction(_0x4238b7,_0x2410c9,_0x6d54f2));});return BPromise[_0xba76('0xb4')](_0x107916);});});})['then'](function(_0x112c9c){_0x416672[_0xba76('0xb5')]=_0x112c9c;return _0x416672;})[_0xba76('0x34')](respondWithFilteredResult(_0xdf2f05,_0x191730))[_0xba76('0xb6')](handleError(_0xdf2f05,null));};exports[_0xba76('0xb7')]=function(_0x89bd3b,_0x572071){var _0x5de846={'raw':![],'where':{'id':_0x89bd3b['params']['id']}},_0x457a8a={};_0x457a8a[_0xba76('0x41')]=_[_0xba76('0x43')](db[_0xba76('0x3d')][_0xba76('0xb8')]);_0x457a8a[_0xba76('0x42')]=_['keys'](_0x89bd3b['query']);_0x457a8a[_0xba76('0x44')]=_['intersection'](_0x457a8a[_0xba76('0x41')],_0x457a8a['query']);_0x5de846['attributes']=_[_0xba76('0x45')](_0x457a8a[_0xba76('0x41')],qs[_0xba76('0x46')](_0x89bd3b['query'][_0xba76('0x46')]));_0x5de846[_0xba76('0xb9')]=_0x5de846[_0xba76('0xb9')][_0xba76('0x47')]?_0x5de846['attributes']:_0x457a8a[_0xba76('0x41')];if(_0x89bd3b[_0xba76('0x42')]['includeAll']){_0x5de846['include']=[{'all':!![]}];}_0x5de846=_[_0xba76('0x9d')]({},_0x5de846,_0x89bd3b[_0xba76('0xba')]);return db[_0xba76('0x3d')][_0xba76('0x65')](_0x5de846)[_0xba76('0x34')](handleEntityNotFound(_0x572071,null))[_0xba76('0x34')](respondWithResult(_0x572071,null))[_0xba76('0xb6')](handleError(_0x572071,null));};exports[_0xba76('0xbb')]=function(_0x37b78e,_0x5ac4d3){return db[_0xba76('0x3d')][_0xba76('0xbb')](_0x37b78e['body'],{})['then'](respondWithResult(_0x5ac4d3,0xc9))['catch'](handleError(_0x5ac4d3,null));};exports['update']=function(_0x28411f,_0x801a84){if(_0x28411f[_0xba76('0x78')]['id']){delete _0x28411f['body']['id'];}return db['FaxInteraction'][_0xba76('0x65')]({'where':{'id':_0x28411f['params']['id']}})[_0xba76('0x34')](handleEntityNotFound(_0x801a84,null))[_0xba76('0x34')](saveUpdates(_0x28411f['body'],null))[_0xba76('0x34')](respondWithResult(_0x801a84,null))[_0xba76('0xb6')](handleError(_0x801a84,null));};exports[_0xba76('0x2b')]=function(_0x55ef97,_0x108933){return db[_0xba76('0x3d')]['find']({'where':{'id':_0x55ef97[_0xba76('0xbc')]['id']}})[_0xba76('0x34')](handleEntityNotFound(_0x108933,null))['then'](removeEntity(_0x108933,null))[_0xba76('0xb6')](handleError(_0x108933,null));};exports['describe']=function(_0x14bf6e,_0x4bafae){return db[_0xba76('0x3d')][_0xba76('0xbd')]()[_0xba76('0x34')](respondWithResult(_0x4bafae,null))[_0xba76('0xb6')](handleError(_0x4bafae,null));};exports[_0xba76('0xbe')]=function(_0x96739a,_0x4f33ff,_0x36277c){return db['FaxMessage'][_0xba76('0x65')]({'where':{'id':_0x96739a[_0xba76('0xbc')]['id']}})[_0xba76('0x34')](handleEntityNotFound(_0x4f33ff,null))[_0xba76('0x34')](function(_0xf7314f){if(_0xf7314f){return _0xf7314f[_0xba76('0xbe')](_0x96739a[_0xba76('0x78')][_0xba76('0xbf')],_['omit'](_0x96739a[_0xba76('0x78')],[_0xba76('0xbf'),'id'])||{});}})[_0xba76('0x34')](respondWithResult(_0x4f33ff,null))[_0xba76('0xb6')](handleError(_0x4f33ff,null));};exports[_0xba76('0xc0')]=function(_0x22bde3,_0x5a3cfb,_0x234b79){var _0x45b5ec={'raw':![],'where':{}};var _0x210131={};var _0x2a3767={'count':0x0,'rows':[]};return db[_0xba76('0x3d')][_0xba76('0xc1')]({'where':{'id':_0x22bde3[_0xba76('0xbc')]['id']}})[_0xba76('0x34')](handleEntityNotFound(_0x5a3cfb,null))[_0xba76('0x34')](function(_0x27aaea){if(_0x27aaea){_0x210131['model']=_[_0xba76('0x43')](db['FaxMessage']['rawAttributes']);_0x210131[_0xba76('0x42')]=_[_0xba76('0x43')](_0x22bde3[_0xba76('0x42')]);_0x210131['filters']=_[_0xba76('0x45')](_0x210131[_0xba76('0x41')],_0x210131[_0xba76('0x42')]);_0x45b5ec['attributes']=_['intersection'](_0x210131[_0xba76('0x41')],qs[_0xba76('0x46')](_0x22bde3[_0xba76('0x42')][_0xba76('0x46')]));_0x45b5ec['attributes']=_0x45b5ec[_0xba76('0xb9')][_0xba76('0x47')]?_0x45b5ec[_0xba76('0xb9')]:_0x210131['model'];if(!_0x22bde3[_0xba76('0x42')][_0xba76('0x48')](_0xba76('0x49'))){_0x45b5ec[_0xba76('0x24')]=qs[_0xba76('0x24')](_0x22bde3[_0xba76('0x42')][_0xba76('0x24')]);_0x45b5ec[_0xba76('0x23')]=qs[_0xba76('0x23')](_0x22bde3[_0xba76('0x42')]['offset']);}_0x45b5ec[_0xba76('0x4a')]=qs[_0xba76('0x4b')](_0x22bde3[_0xba76('0x42')][_0xba76('0x4b')]);_0x45b5ec[_0xba76('0x4c')]=qs[_0xba76('0x44')](_[_0xba76('0x4d')](_0x22bde3[_0xba76('0x42')],_0x210131['filters']));_0x45b5ec['where'][_0xba76('0xb3')]=_0x27aaea['id'];if(_0x22bde3[_0xba76('0x42')][_0xba76('0x89')]){_0x45b5ec['where']=_['merge'](_0x45b5ec[_0xba76('0x4c')],{'$or':_[_0xba76('0x2f')](_0x45b5ec['attributes'],function(_0x55ea35){var _0x1f76cd={};_0x1f76cd[_0x55ea35]={'$like':'%'+_0x22bde3[_0xba76('0x42')][_0xba76('0x89')]+'%'};return _0x1f76cd;})});}if(_0x22bde3[_0xba76('0x42')][_0xba76('0x7f')]){var _0x1ee90b=_0x22bde3['query'][_0xba76('0x7f')][_0xba76('0x6d')](',');var _0x2df264={};_0x2df264[_0x1ee90b[0x0]]={'$gte':moment(_0x1ee90b[0x1])['format'](_0xba76('0xc2'))};_0x45b5ec[_0xba76('0x4c')]=_['merge'](_0x45b5ec[_0xba76('0x4c')],_0x2df264);}_0x45b5ec=_[_0xba76('0x9d')]({},_0x45b5ec,_0x22bde3[_0xba76('0xba')]);return db[_0xba76('0xc3')][_0xba76('0x25')]({'where':_0x45b5ec[_0xba76('0x4c')]})[_0xba76('0x34')](function(_0x40d430){_0x2a3767[_0xba76('0x25')]=_0x40d430;if(_0x22bde3['query']['includeAll']){_0x45b5ec['include']=[{'all':!![]}];}return db['FaxMessage'][_0xba76('0xc4')](_0x45b5ec);})[_0xba76('0x34')](function(_0x52657e){_0x2a3767[_0xba76('0xb5')]=_0x52657e;return _0x2a3767;});}})[_0xba76('0x34')](respondWithFilteredResult(_0x5a3cfb,_0x45b5ec))['catch'](handleError(_0x5a3cfb,null));};exports[_0xba76('0xc5')]=function(_0x27d8dd,_0x3cae56,_0x282734){return db[_0xba76('0x3d')][_0xba76('0x65')]({'where':{'id':_0x27d8dd[_0xba76('0xbc')]['id']}})[_0xba76('0x34')](handleEntityNotFound(_0x3cae56,null))[_0xba76('0x34')](function(_0x814968){if(_0x814968){return _0x814968['setTags'](_0x27d8dd[_0xba76('0x78')][_0xba76('0xbf')],_['omit'](_0x27d8dd[_0xba76('0x78')],[_0xba76('0xbf'),'id'])||{})[_0xba76('0xc6')](function(){return db[_0xba76('0x72')][_0xba76('0xc4')]({'attributes':['id','name',_0xba76('0x4f')],'where':{'id':_0x27d8dd['body'][_0xba76('0xbf')]}});})[_0xba76('0x34')](function(_0x557ce6){socket[_0xba76('0xc7')](_0xba76('0xc8'),{'id':Number(_0x27d8dd[_0xba76('0xbc')]['id']),'tags':_0x557ce6||[]});return{'id':Number(_0x27d8dd[_0xba76('0xbc')]['id']),'tags':_0x557ce6||[]};});}})[_0xba76('0x34')](respondWithResult(_0x3cae56,null))[_0xba76('0xb6')](handleError(_0x3cae56,null));};exports[_0xba76('0xc9')]=function(_0x3ae91f,_0x4f3ddf,_0x3374c8){return db[_0xba76('0x3d')]['find']({'where':{'id':_0x3ae91f[_0xba76('0xbc')]['id']}})['then'](handleEntityNotFound(_0x4f3ddf,null))[_0xba76('0x34')](function(_0x4de145){if(_0x4de145){return _0x4de145['removeTags'](_0x3ae91f[_0xba76('0x42')][_0xba76('0xbf')]);}})[_0xba76('0x34')](respondWithStatusCode(_0x4f3ddf,null))['catch'](handleError(_0x4f3ddf,null));};exports['download']=function(_0x5e3204,_0x30bb3d){var _0x3dcb62=moment()[_0xba76('0xca')]()[_0xba76('0x9b')]();var _0x160fe3=path[_0xba76('0xcb')](config[_0xba76('0xcc')],_0xba76('0xcd'),_0xba76('0xce'),_0xba76('0xcf'));var _0x250353=path['join'](config[_0xba76('0xcc')],_0xba76('0xcd'),_0xba76('0xce'),_0xba76('0xd0'));var _0x4eebe3=path[_0xba76('0xcb')](_0x160fe3,_0x3dcb62);var _0x4e9312=util[_0xba76('0xd1')](_0xba76('0xd2'),_0x5e3204['params']['id'],_0x3dcb62);var _0x3ca7f8=path[_0xba76('0xcb')](_0x160fe3,_0x4e9312);var _0x2d2222=[];_0x2d2222[_0xba76('0x33')]({'model':db['Attachment'],'as':_0xba76('0xd3'),'raw':!![]});var _0x4c814=[{'model':db[_0xba76('0xc3')],'as':_0xba76('0xd4'),'attributes':['id',_0xba76('0x78'),_0xba76('0x7e')],'include':_0x2d2222}];return db[_0xba76('0x3d')]['find']({'where':{'id':_0x5e3204[_0xba76('0xbc')]['id']},'include':_0x4c814})[_0xba76('0x34')](handleEntityNotFound(_0x30bb3d,null))['then'](function(_0x54fd2e){if(_0x54fd2e&&_0x54fd2e[_0xba76('0xd4')]){var _0x5a05f9=_0x54fd2e[_0xba76('0xd5')]({'plain':!![]});fs[_0xba76('0xd6')](_0x4eebe3);for(var _0x2eed71=0x0;_0x2eed71<_0x5a05f9['Messages']['length'];_0x2eed71++){var _0x1256f0=_0x5a05f9['Messages'][_0x2eed71][_0xba76('0xd3')];if(_0x1256f0){var _0x161c79=path[_0xba76('0xcb')](_0x250353,_0x1256f0[_0xba76('0xd7')]);if(fs[_0xba76('0xd8')](_0x161c79)){fs[_0xba76('0xd9')](_0x161c79)[_0xba76('0xda')](fs[_0xba76('0xdb')](path[_0xba76('0xcb')](_0x4eebe3,_0x1256f0[_0xba76('0xd7')])));}}}return BPromise['resolve']()[_0xba76('0x34')](function(){return new BPromise(function(_0x32bae4,_0xd60e23){zipdir(_0x4eebe3,{'saveTo':_0x3ca7f8},function(_0x5931f4,_0x440a60){if(_0x5931f4)return _0xd60e23(_0x5931f4);return _0x32bae4(_0x440a60);});})[_0xba76('0x34')](function(){return new BPromise(function(_0xb3a471,_0x50245c){rimraf(_0x4eebe3,function(_0xb7c585){if(_0xb7c585)_0x50245c(_0xb7c585);return _0xb3a471();});});})['then'](function(){return _0x30bb3d[_0xba76('0xdc')](_0x3ca7f8,_0x4e9312,function(_0x16929d){if(_0x16929d){console[_0xba76('0xdd')](_0xba76('0xde'),_0x16929d);}else{fs['unlinkSync'](_0x3ca7f8);}});});});}else{return _0x30bb3d[_0xba76('0x1f')](0xc8);}})['catch'](handleError(_0x30bb3d,null));}; \ No newline at end of file +var _0x1942=['c.phone','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','includeAll','include','options','catch','create','params','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','spread','Tag','emit','faxInteractionTags:save','removeTags','download','root','files','tmp','server','join','Attachment','Messages','basename','createReadStream','pipe','createWriteStream','log','err','unlinkSync','eml-format','rimraf','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/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','destroy','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','talking','unmanaged','total','waiting','closed','UserId','answered','index','FaxInteraction','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','field','color','from','tools_tags','select','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','buildExpression','text','some','isEmpty','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.fax\x20LIKE\x20?','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','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','FaxAccountId','sequelize','toString','keyBy','merge','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','Contact.email'];(function(_0x432169,_0x7ffbe9){var _0x28e745=function(_0x810c68){while(--_0x810c68){_0x432169['push'](_0x432169['shift']());}};_0x28e745(++_0x7ffbe9);}(_0x1942,0x115));var _0x2194=function(_0x5e709d,_0x521e95){_0x5e709d=_0x5e709d-0x0;var _0x5630b4=_0x1942[_0x5e709d];return _0x5630b4;};'use strict';var emlformat=require(_0x2194('0x0'));var rimraf=require(_0x2194('0x1'));var zipdir=require(_0x2194('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2194('0x3'));var moment=require(_0x2194('0x4'));var BPromise=require(_0x2194('0x5'));var Mustache=require(_0x2194('0x6'));var util=require('util');var path=require(_0x2194('0x7'));var sox=require(_0x2194('0x8'));var csv=require(_0x2194('0x9'));var ejs=require(_0x2194('0xa'));var fs=require('fs');var fs_extra=require(_0x2194('0xb'));var _=require(_0x2194('0xc'));var squel=require(_0x2194('0xd'));var crypto=require(_0x2194('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2194('0xf'));var toCsv=require(_0x2194('0x9'));var querystring=require(_0x2194('0x10'));var Papa=require(_0x2194('0x11'));var Redis=require(_0x2194('0x12'));var authService=require(_0x2194('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2194('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2194('0x15'))(_0x2194('0x16'));var utils=require(_0x2194('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2194('0x18'))['db'];config[_0x2194('0x19')]=_[_0x2194('0x1a')](config['redis'],{'host':_0x2194('0x1b'),'port':0x18eb});var socket=require(_0x2194('0x1c'))(new Redis(config[_0x2194('0x19')]));require('./faxInteraction.socket')[_0x2194('0x1d')](socket);function respondWithStatusCode(_0x10a41c,_0x27ae89){_0x27ae89=_0x27ae89||0xcc;return function(_0x337a89){if(_0x337a89){return _0x10a41c[_0x2194('0x1e')](_0x27ae89);}return _0x10a41c[_0x2194('0x1f')](_0x27ae89)[_0x2194('0x20')]();};}function respondWithResult(_0x3eacd8,_0x5a23ab){_0x5a23ab=_0x5a23ab||0xc8;return function(_0x22acad){if(_0x22acad){return _0x3eacd8[_0x2194('0x1f')](_0x5a23ab)['json'](_0x22acad);}};}function respondWithFilteredResult(_0x382e80,_0x38ec25){return function(_0x5117ce){if(_0x5117ce){var _0x49848c=typeof _0x38ec25[_0x2194('0x21')]===_0x2194('0x22')&&typeof _0x38ec25[_0x2194('0x23')]==='undefined';var _0x2d70f6=_0x5117ce[_0x2194('0x24')];var _0x47a4b0=_0x49848c?0x0:_0x38ec25['offset'];var _0x4795f3=_0x49848c?_0x5117ce[_0x2194('0x24')]:_0x38ec25[_0x2194('0x21')]+_0x38ec25[_0x2194('0x23')];var _0x34fd1d;if(_0x4795f3>=_0x2d70f6){_0x4795f3=_0x2d70f6;_0x34fd1d=0xc8;}else{_0x34fd1d=0xce;}_0x382e80['status'](_0x34fd1d);return _0x382e80[_0x2194('0x25')](_0x2194('0x26'),_0x47a4b0+'-'+_0x4795f3+'/'+_0x2d70f6)[_0x2194('0x27')](_0x5117ce);}return null;};}function patchUpdates(_0x1b81da){return function(_0x47d3ed){try{jsonpatch[_0x2194('0x28')](_0x47d3ed,_0x1b81da,!![]);}catch(_0x5c6889){return BPromise['reject'](_0x5c6889);}return _0x47d3ed['save']();};}function saveUpdates(_0x5f1875,_0x8fdd5f){return function(_0x47963d){if(_0x47963d){return _0x47963d[_0x2194('0x29')](_0x5f1875)[_0x2194('0x2a')](function(_0x34ec95){return _0x34ec95;});}return null;};}function removeEntity(_0x53686b,_0xeec416){return function(_0x57c99f){if(_0x57c99f){return _0x57c99f[_0x2194('0x2b')]()[_0x2194('0x2a')](function(){_0x53686b[_0x2194('0x1f')](0xcc)[_0x2194('0x20')]();});}};}function handleEntityNotFound(_0x949fe0,_0x20fe56){return function(_0x2f6de2){if(!_0x2f6de2){_0x949fe0['sendStatus'](0x194);}return _0x2f6de2;};}function handleError(_0x34dbac,_0x48f396){_0x48f396=_0x48f396||0x1f4;return function(_0x4493f8){logger['error'](_0x4493f8[_0x2194('0x2c')]);if(_0x4493f8['name']){delete _0x4493f8[_0x2194('0x2d')];}_0x34dbac[_0x2194('0x1f')](_0x48f396)[_0x2194('0x2e')](_0x4493f8);};}function getInteractionUsers(_0x5d9093,_0xce61dc){return new BPromise(function(_0x25ce8c,_0x1c9680){try{if(_0xce61dc[_0x5d9093['id']]){_0x5d9093[_0x2194('0x2f')]=_[_0x2194('0x30')](_0xce61dc[_0x5d9093['id']],function(_0x2696bf){return{'id':_0x2696bf['id'],'fullname':_0x2696bf[_0x2194('0x31')]};});}}catch(_0x52fb6a){_0x1c9680(_0x52fb6a);}_0x25ce8c(_0x5d9093);});}function getInteractionTags(_0x408f1c,_0x27a698){return new BPromise(function(_0x230c27,_0x23e559){try{if(_0x408f1c[_0x2194('0x32')]){_0x408f1c[_0x2194('0x33')]=[];_0x408f1c['TagIds'][_0x2194('0x34')](',')['forEach'](function(_0x18f108){_0x408f1c[_0x2194('0x33')][_0x2194('0x35')](_0x27a698[_0x18f108]);});}delete _0x408f1c[_0x2194('0x32')];}catch(_0x213d50){_0x23e559(_0x213d50);}_0x230c27(_0x408f1c);});}function updateFaxInteraction(_0x5d3073,_0x142203,_0x58f404){return new BPromise(function(_0x403e9c,_0x30e954){return getInteractionUsers(_0x5d3073,_0x58f404)['then'](function(_0x45c0a5){return getInteractionTags(_0x45c0a5,_0x142203);})['then'](function(_0x5b5843){return getStateInteraction(_0x5b5843);})[_0x2194('0x2a')](function(_0x29613a){_0x403e9c(_0x29613a);})['catch'](function(_0x473af7){_0x30e954(_0x473af7);});});}function getStateInteraction(_0x5917b5){return new BPromise(function(_0x2f87fb){_0x5917b5['waiting']=0x0;_0x5917b5[_0x2194('0x36')]=0x0;_0x5917b5['answered']=0x0;_0x5917b5[_0x2194('0x37')]=0x0;_0x5917b5[_0x2194('0x38')]=0x0;if(!_0x5917b5['closed']&&!_0x5917b5['UserId']){_0x5917b5[_0x2194('0x39')]+=0x1;}if(!_0x5917b5[_0x2194('0x3a')]&&_0x5917b5[_0x2194('0x3b')]){_0x5917b5['talking']+=0x1;if(_0x5917b5[_0x2194('0x39')]){_0x5917b5[_0x2194('0x39')]-=0x1;}}if(_0x5917b5['closed']&&_0x5917b5[_0x2194('0x3b')]){_0x5917b5[_0x2194('0x3c')]+=0x1;if(_0x5917b5[_0x2194('0x36')]){_0x5917b5[_0x2194('0x36')]-=0x1;}}if(_0x5917b5[_0x2194('0x3a')]&&!_0x5917b5[_0x2194('0x3b')]){_0x5917b5[_0x2194('0x37')]+=0x1;if(_0x5917b5['waiting']){_0x5917b5[_0x2194('0x39')]-=0x1;}}_0x5917b5[_0x2194('0x38')]+=0x1;_0x2f87fb(_0x5917b5);});}exports[_0x2194('0x3d')]=function(_0x2f26b7,_0x4be366){var _0x561223={},_0xe766b8={},_0x1a08fd={'count':0x0,'rows':[]};var _0x11036d=_[_0x2194('0x30')](db[_0x2194('0x3e')][_0x2194('0x3f')],function(_0x318dc0){return{'name':_0x318dc0[_0x2194('0x40')],'type':_0x318dc0[_0x2194('0x41')][_0x2194('0x42')]};});_0xe766b8['model']=_['map'](_0x11036d,_0x2194('0x2d'));_0xe766b8[_0x2194('0x43')]=_[_0x2194('0x44')](_0x2f26b7['query']);_0xe766b8[_0x2194('0x45')]=_[_0x2194('0x46')](_0xe766b8[_0x2194('0x47')],_0xe766b8[_0x2194('0x43')]);_0x561223['attributes']=_[_0x2194('0x46')](_0xe766b8[_0x2194('0x47')],qs[_0x2194('0x48')](_0x2f26b7[_0x2194('0x43')][_0x2194('0x48')]));_0x561223['attributes']=_0x561223[_0x2194('0x49')]['length']?_0x561223[_0x2194('0x49')]:_0xe766b8[_0x2194('0x47')];if(!_0x2f26b7[_0x2194('0x43')][_0x2194('0x4a')](_0x2194('0x4b'))){_0x561223[_0x2194('0x23')]=qs[_0x2194('0x23')](_0x2f26b7['query'][_0x2194('0x23')]);_0x561223['offset']=qs[_0x2194('0x21')](_0x2f26b7[_0x2194('0x43')]['offset']);}_0x561223[_0x2194('0x4c')]=qs[_0x2194('0x4d')](_0x2f26b7[_0x2194('0x43')][_0x2194('0x4d')]);_0x561223['where']=qs[_0x2194('0x45')](_['pick'](_0x2f26b7['query'],_0xe766b8[_0x2194('0x45')]),_0x11036d);var _0x1c4bd9=[];var _0x353dfd=squel['select']()[_0x2194('0x4e')]('id')[_0x2194('0x4e')](_0x2194('0x2d'))[_0x2194('0x4e')](_0x2194('0x4f'))[_0x2194('0x50')](_0x2194('0x51'));var _0x403335=squel[_0x2194('0x52')]()[_0x2194('0x4e')](_0x2194('0x53'))[_0x2194('0x4e')](_0x2194('0x54'))[_0x2194('0x4e')](_0x2194('0x55'))[_0x2194('0x50')](_0x2194('0x56'),'ui')[_0x2194('0x57')](_0x2194('0x58'),'u',_0x2194('0x59'));var _0x4fbc59=squel['select']()[_0x2194('0x50')](_0x2194('0x5a'),'i')[_0x2194('0x57')]('cm_contacts','c',_0x2194('0x5b'))[_0x2194('0x57')](_0x2194('0x58'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x2194('0x5c'),'a',_0x2194('0x5d'))[_0x2194('0x57')](_0x2194('0x5e'),'me','me.FaxInteractionId\x20=\x20i.id')[_0x2194('0x57')](_0x2194('0x5f'),'it',_0x2194('0x60'))[_0x2194('0x57')](_0x2194('0x51'),'t',_0x2194('0x61'));var _0xc02f47=squel[_0x2194('0x62')]();var _0x24a9c0=[];var _0x3d0e24=squel['expr']();var _0x110e5e;if(_0x2f26b7[_0x2194('0x43')][_0x2194('0x63')]){_0x110e5e=as[_0x2194('0x64')](_0x2f26b7[_0x2194('0x43')][_0x2194('0x63')]);var _0x4da2f6=_0x110e5e[_0x2194('0x65')];for(var _0x3b6b09=0x0;_0x3b6b09<_0x110e5e[_0x2194('0x66')][_0x2194('0x67')];_0x3b6b09++){var _0x49a49d=_0x110e5e[_0x2194('0x66')][_0x3b6b09];var _0x32fdbd='i';var _0x234e26=_[_0x2194('0x68')](_0x11036d,[_0x2194('0x2d'),_0x49a49d[_0x2194('0x4e')]]);if(!_0x234e26){switch(_0x49a49d[_0x2194('0x4e')]){case _0x2194('0x69'):if(_0x49a49d[_0x2194('0x6a')]==0x1){_0x4fbc59[_0x2194('0x6b')]('`'+_0x49a49d[_0x2194('0x4e')]+'`\x20=\x200');}else{_0x4fbc59[_0x2194('0x6b')]('`'+_0x49a49d[_0x2194('0x4e')]+_0x2194('0x6c'));}break;case _0x2194('0x6d'):if(_0x49a49d[_0x2194('0x6e')]===_0x2194('0x6f')){if(_0x49a49d[_0x2194('0x6a')]['split']('\x20')[_0x2194('0x67')]>0x1){_0xc02f47[_0x4da2f6](_0x2194('0x70'),qs[_0x2194('0x71')](_0x49a49d['value']),null);}else{var _0x46d69e='%'+_0x49a49d[_0x2194('0x6a')]+'%';_0xc02f47[_0x4da2f6](_0x2194('0x72'),_0x46d69e,_0x46d69e,_0x46d69e);}}else{_0x234e26=_[_0x2194('0x68')](_0x11036d,[_0x2194('0x2d'),_0x2194('0x73')]);_0x49a49d[_0x2194('0x4e')]='ContactId';_0x2f236d=as['buildExpression'](_0x32fdbd,_0x234e26[_0x2194('0x41')],_0x49a49d);_0xc02f47[_0x4da2f6](_0x2f236d['text'],_0x2f236d[_0x2194('0x6a')][_0x2194('0x74')],_0x2f236d[_0x2194('0x6a')][_0x2194('0x20')]);}break;case'Tag':var _0x1283ea=_0x49a49d[_0x2194('0x6a')]['split'](',')[_0x2194('0x30')](function(_0x4ebd06){return Number(_0x4ebd06);});_0x1283ea[_0x2194('0x75')](function(_0x2d4fda){_0x3d0e24['or'](_0x2194('0x76'),'%,'+_0x2d4fda+',%');});_0x24a9c0=_['union'](_0x24a9c0,_0x1283ea);break;case'User':if(_0x49a49d[_0x2194('0x6e')]===_0x2194('0x6f')){_0xc02f47[_0x4da2f6](_0x2194('0x77'),'%'+_0x49a49d['value']+'%',null);}else{_0x234e26=_[_0x2194('0x68')](_0x11036d,[_0x2194('0x2d'),_0x2194('0x3b')]);_0x49a49d[_0x2194('0x4e')]=_0x2194('0x3b');_0x2f236d=as['buildExpression'](_0x32fdbd,_0x234e26[_0x2194('0x41')],_0x49a49d);_0xc02f47[_0x4da2f6](_0x2f236d['text'],_0x2f236d[_0x2194('0x6a')][_0x2194('0x74')],_0x2f236d['value'][_0x2194('0x20')]);}break;case _0x2194('0x78'):_0x2f236d=as[_0x2194('0x79')]('me',null,_0x49a49d);_0xc02f47[_0x4da2f6](_0x2f236d[_0x2194('0x7a')],_0x2f236d[_0x2194('0x6a')][_0x2194('0x74')],_0x2f236d[_0x2194('0x6a')][_0x2194('0x20')]);break;}}else{var _0x2f236d=as[_0x2194('0x79')](_0x32fdbd,_0x234e26[_0x2194('0x41')],_0x49a49d);_0xc02f47[_0x4da2f6](_0x2f236d[_0x2194('0x7a')],_0x2f236d[_0x2194('0x6a')][_0x2194('0x74')],_0x2f236d[_0x2194('0x6a')][_0x2194('0x20')]);}}}else{var _0x1f3ca7=_(_0x2f26b7[_0x2194('0x43')])[_0x2194('0x44')]()['map'](function(_0x1779d0){return _[_0x2194('0x7b')](_0x11036d,[_0x2194('0x2d'),_0x1779d0])?_0x1779d0:undefined;})['compact']()[_0x2194('0x6a')]();if(!_[_0x2194('0x7c')](_0x1f3ca7)){_0x1f3ca7[_0x2194('0x75')](function(_0x4443c5){if(_0x4443c5==='FaxAccountId'){_0x4fbc59['where'](_0x2194('0x7d'),[][_0x2194('0x7e')](_0x2f26b7['query'][_0x4443c5]));}else if(_0x4443c5===_0x2194('0x7f')){var _0x270218=JSON[_0x2194('0x80')](_0x2f26b7[_0x2194('0x43')][_0x4443c5])[_0x2194('0x81')];var _0x25971d=JSON[_0x2194('0x80')](_0x2f26b7[_0x2194('0x43')][_0x4443c5])[_0x2194('0x82')];_0x4fbc59[_0x2194('0x83')](_0x2194('0x84'),_0x270218,_0x25971d);}else{if(_0x2f26b7['query'][_0x4443c5]===_0x2194('0x85')){_0x4fbc59[_0x2194('0x83')]('i.'+_0x4443c5+_0x2194('0x86'));}else{_0x4fbc59[_0x2194('0x83')]('i.'+_0x4443c5+'\x20=\x20?',_0x2f26b7[_0x2194('0x43')][_0x4443c5]);}}});}if(_0x2f26b7['query'][_0x2194('0x87')]){if(_0x2f26b7['query'][_0x2194('0x87')]==0x1){_0x4fbc59['having'](_0x2194('0x88'));}else{_0x4fbc59[_0x2194('0x6b')](_0x2194('0x89'));}}if(_0x2f26b7[_0x2194('0x43')]['tag']){_0x24a9c0=_['isArray'](_0x2f26b7[_0x2194('0x43')][_0x2194('0x8a')])?_0x2f26b7[_0x2194('0x43')][_0x2194('0x8a')]:new Array(_0x2f26b7[_0x2194('0x43')]['tag']);_0x24a9c0[_0x2194('0x75')](function(_0x420b69){_0x3d0e24['or'](_0x2194('0x76'),'%,'+_0x420b69+',%');});}if(_0x2f26b7['query'][_0x2194('0x8b')]){var _0x2186de=_0x2f26b7[_0x2194('0x43')][_0x2194('0x8b')][_0x2194('0x8c')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x2194('0x8d')](_0x2186de)){_0xc02f47['or']('i.id\x20LIKE\x20?',_0x2186de+'%')['or'](_0x2194('0x8e'),_0x2186de+'%');}_0xc02f47['or'](_0x2194('0x8f'),_0x2186de+'%');}}_0x4fbc59['where'](_0xc02f47);_0x4fbc59[_0x2194('0x90')](_0x2194('0x91'));var _0x1c3086={'type':db[_0x2194('0x92')][_0x2194('0x93')][_0x2194('0x94')],'raw':!![]};var _0x5a8ce9=_0x4fbc59[_0x2194('0x95')]();_0x5a8ce9[_0x2194('0x4e')](_0x2194('0x91'));_0x5a8ce9[_0x2194('0x4e')](_0x2194('0x96'),_0x2194('0x69'));if(_0x561223[_0x2194('0x4c')]){_0x561223['order'][_0x2194('0x75')](function(_0xad4dbf){var _0x5d3145=_0xad4dbf[0x0]===_0x2194('0x97')?_0xad4dbf[0x0]:'i.'+_0xad4dbf[0x0];_0x4fbc59[_0x2194('0x4c')](_0x5d3145,_0xad4dbf[0x1]===_0x2194('0x98')?![]:!![]);});}if(!_['isEmpty'](_0x24a9c0)){_0x4fbc59[_0x2194('0x6b')](_0x3d0e24);_0x5a8ce9[_0x2194('0x83')](_0x2194('0x99'),_0x24a9c0);}BPromise[_0x2194('0x9a')]()[_0x2194('0x2a')](function(){if(!_0x110e5e){if(_0x2f26b7[_0x2194('0x43')]['FaxAccountId'])return;_0x5a8ce9[_0x2194('0x83')](_0x2194('0x9b'));_0x4fbc59[_0x2194('0x83')](_0x2194('0x9b'));return;}if(_0x2f26b7[_0x2194('0x9c')]['role']!==_0x2194('0x9d'))return;return _0x2f26b7[_0x2194('0x9c')][_0x2194('0x9e')]({'attributes':['id'],'raw':!![]})[_0x2194('0x2a')](function(_0x1393b7){if(_[_0x2194('0x7c')](_0x1393b7)){_0x5a8ce9[_0x2194('0x83')](_0x2194('0x9f'));_0x4fbc59['where'](_0x2194('0x9f'));}else{_0x5a8ce9[_0x2194('0x83')]('i.FaxAccountId\x20IN\x20?',_[_0x2194('0x30')](_0x1393b7,'id'));_0x4fbc59[_0x2194('0x83')](_0x2194('0x7d'),_[_0x2194('0x30')](_0x1393b7,'id'));}});})[_0x2194('0x2a')](function(){if(_0x2f26b7[_0x2194('0x9c')]['role']==='agent'&&!_0x110e5e&&!_0x2f26b7[_0x2194('0x43')][_0x2194('0xa0')])return[];return db[_0x2194('0xa1')][_0x2194('0x43')](_0x5a8ce9['toString'](),_0x1c3086);})[_0x2194('0x2a')](function(_0x18cdea){_0x1a08fd['count']=_0x18cdea[_0x2194('0x67')];if(_0x1a08fd['count']===0x0)return[];return db[_0x2194('0xa1')][_0x2194('0x43')](_0x353dfd[_0x2194('0xa2')](),_0x1c3086)['then'](function(_0x2eb993){_0x1c4bd9=_[_0x2194('0xa3')](_0x2eb993,'id');_0x1c3086=_[_0x2194('0xa4')](_0x1c3086,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2f26b7[_0x2194('0x43')][_0x2194('0x48')]){_0x561223[_0x2194('0x49')][_0x2194('0x75')](function(_0x394a61){_0x4fbc59[_0x2194('0x4e')]('i.'+_0x394a61);});}else{_0x4fbc59[_0x2194('0x4e')](_0x2194('0x96'),_0x2194('0x69'));_0x4fbc59[_0x2194('0x4e')](_0x2194('0xa5'),'Account.key');_0x4fbc59[_0x2194('0x4e')](_0x2194('0xa6'),_0x2194('0xa7'));_0x4fbc59['field'](_0x2194('0xa8'),_0x2194('0x97'));_0x4fbc59[_0x2194('0x4e')](_0x2194('0xa9'));_0x4fbc59[_0x2194('0x4e')](_0x2194('0xaa'),_0x2194('0xab'));_0x4fbc59[_0x2194('0x4e')](_0x2194('0xac'),'Contact.lastName');_0x4fbc59[_0x2194('0x4e')](_0x2194('0xad'),_0x2194('0xae'));_0x4fbc59['field'](_0x2194('0xaf'),_0x2194('0xb0'));_0x4fbc59[_0x2194('0x4e')]('c.mobile','Contact.mobile');_0x4fbc59[_0x2194('0x4e')](_0x2194('0xb1'),_0x2194('0xb2'));_0x4fbc59[_0x2194('0x4e')](_0x2194('0xb3'),_0x2194('0xb4'));_0x4fbc59[_0x2194('0x4e')](_0x2194('0xb5'),'Owner.internal');_0x4fbc59['field'](_0x2194('0xb6'),_0x2194('0x32'));}if(_0x561223[_0x2194('0x23')])_0x4fbc59[_0x2194('0x23')](_0x561223[_0x2194('0x23')]);if(_0x561223[_0x2194('0x21')])_0x4fbc59[_0x2194('0x21')](_0x561223[_0x2194('0x21')]);return db[_0x2194('0xa1')]['query'](_0x4fbc59[_0x2194('0xa2')](),_0x1c3086);})[_0x2194('0x2a')](function(_0x1455bf){if(_0x1455bf[_0x2194('0x67')]>0x0)_0x403335[_0x2194('0x83')](_0x2194('0xb7'),_[_0x2194('0x30')](_0x1455bf,'id'));return db['sequelize'][_0x2194('0x43')](_0x403335[_0x2194('0xa2')](),_0x1c3086)['then'](function(_0x84f094){var _0x537715=_[_0x2194('0xb8')](_0x84f094,_0x2194('0xb9'));var _0x5e811a=[];_0x1455bf['forEach'](function(_0x9d67b2){_0x5e811a['push'](updateFaxInteraction(_0x9d67b2,_0x1c4bd9,_0x537715));});return BPromise[_0x2194('0xba')](_0x5e811a);});});})['then'](function(_0x367e26){_0x1a08fd[_0x2194('0xbb')]=_0x367e26;return _0x1a08fd;})['then'](respondWithFilteredResult(_0x4be366,_0x561223))['catch'](handleError(_0x4be366,null));};exports[_0x2194('0xbc')]=function(_0x5b7912,_0x3986ef){var _0xa2eb14={'raw':![],'where':{'id':_0x5b7912['params']['id']}},_0x20fcc3={};_0x20fcc3['model']=_[_0x2194('0x44')](db[_0x2194('0x3e')][_0x2194('0x3f')]);_0x20fcc3[_0x2194('0x43')]=_['keys'](_0x5b7912['query']);_0x20fcc3['filters']=_[_0x2194('0x46')](_0x20fcc3[_0x2194('0x47')],_0x20fcc3[_0x2194('0x43')]);_0xa2eb14[_0x2194('0x49')]=_[_0x2194('0x46')](_0x20fcc3[_0x2194('0x47')],qs[_0x2194('0x48')](_0x5b7912[_0x2194('0x43')][_0x2194('0x48')]));_0xa2eb14['attributes']=_0xa2eb14['attributes'][_0x2194('0x67')]?_0xa2eb14['attributes']:_0x20fcc3[_0x2194('0x47')];if(_0x5b7912['query'][_0x2194('0xbd')]){_0xa2eb14[_0x2194('0xbe')]=[{'all':!![]}];}_0xa2eb14=_[_0x2194('0xa4')]({},_0xa2eb14,_0x5b7912[_0x2194('0xbf')]);return db['FaxInteraction'][_0x2194('0x68')](_0xa2eb14)[_0x2194('0x2a')](handleEntityNotFound(_0x3986ef,null))['then'](respondWithResult(_0x3986ef,null))[_0x2194('0xc0')](handleError(_0x3986ef,null));};exports[_0x2194('0xc1')]=function(_0x10612e,_0x5167ce){return db[_0x2194('0x3e')][_0x2194('0xc1')](_0x10612e['body'],{})[_0x2194('0x2a')](respondWithResult(_0x5167ce,0xc9))[_0x2194('0xc0')](handleError(_0x5167ce,null));};exports[_0x2194('0x29')]=function(_0x49d24e,_0x3b15b1){if(_0x49d24e[_0x2194('0x78')]['id']){delete _0x49d24e[_0x2194('0x78')]['id'];}return db['FaxInteraction'][_0x2194('0x68')]({'where':{'id':_0x49d24e[_0x2194('0xc2')]['id']}})['then'](handleEntityNotFound(_0x3b15b1,null))[_0x2194('0x2a')](saveUpdates(_0x49d24e['body'],null))[_0x2194('0x2a')](respondWithResult(_0x3b15b1,null))[_0x2194('0xc0')](handleError(_0x3b15b1,null));};exports[_0x2194('0x2b')]=function(_0x4aa0b1,_0x1718f7){return db['FaxInteraction'][_0x2194('0x68')]({'where':{'id':_0x4aa0b1[_0x2194('0xc2')]['id']}})['then'](handleEntityNotFound(_0x1718f7,null))[_0x2194('0x2a')](removeEntity(_0x1718f7,null))[_0x2194('0xc0')](handleError(_0x1718f7,null));};exports['describe']=function(_0x163bb0,_0x4b5bc4){return db[_0x2194('0x3e')][_0x2194('0xc3')]()[_0x2194('0x2a')](respondWithResult(_0x4b5bc4,null))[_0x2194('0xc0')](handleError(_0x4b5bc4,null));};exports[_0x2194('0xc4')]=function(_0x451035,_0x2065f3,_0x4c63af){return db[_0x2194('0xc5')][_0x2194('0x68')]({'where':{'id':_0x451035[_0x2194('0xc2')]['id']}})[_0x2194('0x2a')](handleEntityNotFound(_0x2065f3,null))[_0x2194('0x2a')](function(_0x4bd7c7){if(_0x4bd7c7){return _0x4bd7c7['addMessage'](_0x451035[_0x2194('0x78')][_0x2194('0xc6')],_[_0x2194('0xc7')](_0x451035[_0x2194('0x78')],[_0x2194('0xc6'),'id'])||{});}})[_0x2194('0x2a')](respondWithResult(_0x2065f3,null))[_0x2194('0xc0')](handleError(_0x2065f3,null));};exports[_0x2194('0xc8')]=function(_0x56535a,_0x1b6448,_0x309984){var _0x355ae1={'raw':![],'where':{}};var _0x38bf6c={};var _0x438cab={'count':0x0,'rows':[]};return db[_0x2194('0x3e')][_0x2194('0xc9')]({'where':{'id':_0x56535a['params']['id']}})[_0x2194('0x2a')](handleEntityNotFound(_0x1b6448,null))[_0x2194('0x2a')](function(_0x45c45b){if(_0x45c45b){_0x38bf6c[_0x2194('0x47')]=_[_0x2194('0x44')](db[_0x2194('0xc5')]['rawAttributes']);_0x38bf6c[_0x2194('0x43')]=_[_0x2194('0x44')](_0x56535a[_0x2194('0x43')]);_0x38bf6c[_0x2194('0x45')]=_[_0x2194('0x46')](_0x38bf6c[_0x2194('0x47')],_0x38bf6c[_0x2194('0x43')]);_0x355ae1[_0x2194('0x49')]=_[_0x2194('0x46')](_0x38bf6c[_0x2194('0x47')],qs['fields'](_0x56535a[_0x2194('0x43')][_0x2194('0x48')]));_0x355ae1['attributes']=_0x355ae1[_0x2194('0x49')][_0x2194('0x67')]?_0x355ae1[_0x2194('0x49')]:_0x38bf6c['model'];if(!_0x56535a[_0x2194('0x43')][_0x2194('0x4a')](_0x2194('0x4b'))){_0x355ae1[_0x2194('0x23')]=qs['limit'](_0x56535a[_0x2194('0x43')]['limit']);_0x355ae1[_0x2194('0x21')]=qs['offset'](_0x56535a[_0x2194('0x43')][_0x2194('0x21')]);}_0x355ae1['order']=qs['sort'](_0x56535a[_0x2194('0x43')][_0x2194('0x4d')]);_0x355ae1[_0x2194('0x83')]=qs[_0x2194('0x45')](_['pick'](_0x56535a[_0x2194('0x43')],_0x38bf6c['filters']));_0x355ae1[_0x2194('0x83')][_0x2194('0xb9')]=_0x45c45b['id'];if(_0x56535a[_0x2194('0x43')]['filter']){_0x355ae1[_0x2194('0x83')]=_[_0x2194('0xa4')](_0x355ae1[_0x2194('0x83')],{'$or':_[_0x2194('0x30')](_0x355ae1['attributes'],function(_0x3c44aa){var _0xf2d593={};_0xf2d593[_0x3c44aa]={'$like':'%'+_0x56535a[_0x2194('0x43')][_0x2194('0x8b')]+'%'};return _0xf2d593;})});}if(_0x56535a[_0x2194('0x43')][_0x2194('0x81')]){var _0x5995e4=_0x56535a[_0x2194('0x43')][_0x2194('0x81')][_0x2194('0x34')](',');var _0x456cfa={};_0x456cfa[_0x5995e4[0x0]]={'$gte':moment(_0x5995e4[0x1])[_0x2194('0xca')](_0x2194('0xcb'))};_0x355ae1[_0x2194('0x83')]=_[_0x2194('0xa4')](_0x355ae1[_0x2194('0x83')],_0x456cfa);}_0x355ae1=_[_0x2194('0xa4')]({},_0x355ae1,_0x56535a[_0x2194('0xbf')]);return db[_0x2194('0xc5')][_0x2194('0x24')]({'where':_0x355ae1[_0x2194('0x83')]})['then'](function(_0x3aaf07){_0x438cab[_0x2194('0x24')]=_0x3aaf07;if(_0x56535a[_0x2194('0x43')]['includeAll']){_0x355ae1[_0x2194('0xbe')]=[{'all':!![]}];}return db['FaxMessage'][_0x2194('0xcc')](_0x355ae1);})[_0x2194('0x2a')](function(_0x77b285){_0x438cab[_0x2194('0xbb')]=_0x77b285;return _0x438cab;});}})[_0x2194('0x2a')](respondWithFilteredResult(_0x1b6448,_0x355ae1))[_0x2194('0xc0')](handleError(_0x1b6448,null));};exports['addTags']=function(_0x35747e,_0x188f8c,_0x4b525a){return db[_0x2194('0x3e')][_0x2194('0x68')]({'where':{'id':_0x35747e[_0x2194('0xc2')]['id']}})[_0x2194('0x2a')](handleEntityNotFound(_0x188f8c,null))[_0x2194('0x2a')](function(_0x114794){if(_0x114794){return _0x114794[_0x2194('0xcd')](_0x35747e[_0x2194('0x78')][_0x2194('0xc6')],_[_0x2194('0xc7')](_0x35747e[_0x2194('0x78')],['ids','id'])||{})[_0x2194('0xce')](function(){return db[_0x2194('0xcf')][_0x2194('0xcc')]({'attributes':['id','name',_0x2194('0x4f')],'where':{'id':_0x35747e['body']['ids']}});})[_0x2194('0x2a')](function(_0x5eb6ed){socket[_0x2194('0xd0')](_0x2194('0xd1'),{'id':Number(_0x35747e[_0x2194('0xc2')]['id']),'tags':_0x5eb6ed||[]});return{'id':Number(_0x35747e[_0x2194('0xc2')]['id']),'tags':_0x5eb6ed||[]};});}})[_0x2194('0x2a')](respondWithResult(_0x188f8c,null))['catch'](handleError(_0x188f8c,null));};exports[_0x2194('0xd2')]=function(_0x105aaf,_0x4a0023,_0x35c7b0){return db[_0x2194('0x3e')][_0x2194('0x68')]({'where':{'id':_0x105aaf[_0x2194('0xc2')]['id']}})['then'](handleEntityNotFound(_0x4a0023,null))[_0x2194('0x2a')](function(_0x2b3735){if(_0x2b3735){return _0x2b3735[_0x2194('0xd2')](_0x105aaf['query'][_0x2194('0xc6')]);}})[_0x2194('0x2a')](respondWithStatusCode(_0x4a0023,null))[_0x2194('0xc0')](handleError(_0x4a0023,null));};exports[_0x2194('0xd3')]=function(_0x271e25,_0x38dad9){var _0x59554d=moment()['unix']()[_0x2194('0xa2')]();var _0x47ca23=path['join'](config[_0x2194('0xd4')],'server',_0x2194('0xd5'),_0x2194('0xd6'));var _0x108615=path['join'](config[_0x2194('0xd4')],_0x2194('0xd7'),_0x2194('0xd5'),'attachments');var _0x281987=path['join'](_0x47ca23,_0x59554d);var _0x5a0fda=util[_0x2194('0xca')]('transcript-%d-%s.zip',_0x271e25[_0x2194('0xc2')]['id'],_0x59554d);var _0xe1928d=path[_0x2194('0xd8')](_0x47ca23,_0x5a0fda);var _0x6471f=[];_0x6471f['push']({'model':db[_0x2194('0xd9')],'as':_0x2194('0xd9'),'raw':!![]});var _0x190164=[{'model':db['FaxMessage'],'as':_0x2194('0xda'),'attributes':['id',_0x2194('0x78'),_0x2194('0x7f')],'include':_0x6471f}];return db['FaxInteraction'][_0x2194('0x68')]({'where':{'id':_0x271e25['params']['id']},'include':_0x190164})[_0x2194('0x2a')](handleEntityNotFound(_0x38dad9,null))[_0x2194('0x2a')](function(_0x521b9c){if(_0x521b9c&&_0x521b9c[_0x2194('0xda')]){var _0x46e4a8=_0x521b9c['get']({'plain':!![]});fs['mkdirSync'](_0x281987);for(var _0x47e1af=0x0;_0x47e1af<_0x46e4a8['Messages']['length'];_0x47e1af++){var _0x59b72a=_0x46e4a8[_0x2194('0xda')][_0x47e1af][_0x2194('0xd9')];if(_0x59b72a){var _0x37ca0d=path[_0x2194('0xd8')](_0x108615,_0x59b72a[_0x2194('0xdb')]);if(fs['existsSync'](_0x37ca0d)){fs[_0x2194('0xdc')](_0x37ca0d)[_0x2194('0xdd')](fs[_0x2194('0xde')](path['join'](_0x281987,_0x59b72a[_0x2194('0xdb')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x1550ac,_0x266368){zipdir(_0x281987,{'saveTo':_0xe1928d},function(_0xb8e2ba,_0x5130c1){if(_0xb8e2ba)return _0x266368(_0xb8e2ba);return _0x1550ac(_0x5130c1);});})['then'](function(){return new BPromise(function(_0x15522b,_0x4e0ae9){rimraf(_0x281987,function(_0x1c3457){if(_0x1c3457)_0x4e0ae9(_0x1c3457);return _0x15522b();});});})[_0x2194('0x2a')](function(){return _0x38dad9[_0x2194('0xd3')](_0xe1928d,_0x5a0fda,function(_0x514f4a){if(_0x514f4a){console[_0x2194('0xdf')](_0x2194('0xe0'),_0x514f4a);}else{fs[_0x2194('0xe1')](_0xe1928d);}});});});}else{return _0x38dad9[_0x2194('0x1e')](0xc8);}})[_0x2194('0xc0')](handleError(_0x38dad9,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 619f14d..4d67b2f 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 _0xf95c=['remove','getUsers','then','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','update'];(function(_0x13c7ac,_0x1b4e50){var _0x5d469c=function(_0x10abb3){while(--_0x10abb3){_0x13c7ac['push'](_0x13c7ac['shift']());}};_0x5d469c(++_0x1b4e50);}(_0xf95c,0xc7));var _0xcf95=function(_0x4d2092,_0x2942ec){_0x4d2092=_0x4d2092-0x0;var _0x2f76a9=_0xf95c[_0x4d2092];return _0x2f76a9;};'use strict';var EventEmitter=require(_0xcf95('0x0'));var FaxInteraction=require(_0xcf95('0x1'))['db'][_0xcf95('0x2')];var FaxMessage=require(_0xcf95('0x1'))['db'][_0xcf95('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xcf95('0x4'),'afterDestroy':_0xcf95('0x5')};function emitEvent(_0x55521b){return function(_0x57d31a,_0xf028f,_0x236878){_0x57d31a[_0xcf95('0x6')]({'attributes':['id'],'raw':!![]})[_0xcf95('0x7')](function(_0x2754b8){_0x57d31a['setDataValue'](_0xcf95('0x8'),_0x2754b8[_0xcf95('0x9')](function(_0x1bdb18){return{'id':_0x1bdb18['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x57d31a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcf95('0x7')](function(_0x302aa3){_0x57d31a['setDataValue'](_0xcf95('0xa'),_0x302aa3[_0xcf95('0xb')]);FaxInteractionEvents['emit'](_0x55521b+':'+_0x57d31a['id'],_0x57d31a);FaxInteractionEvents[_0xcf95('0xc')](_0x55521b,_0x57d31a);_0x236878(null);})[_0xcf95('0xd')](_0x236878(null));};}for(var e in events){if(events[_0xcf95('0xe')](e)){var event=events[e];FaxInteraction[_0xcf95('0xf')](e,emitEvent(event));}}module[_0xcf95('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x855b=['update','remove','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save'];(function(_0x3fb574,_0x4b1109){var _0x3d2d53=function(_0x51fe66){while(--_0x51fe66){_0x3fb574['push'](_0x3fb574['shift']());}};_0x3d2d53(++_0x4b1109);}(_0x855b,0x13b));var _0xb855=function(_0x582733,_0x11101d){_0x582733=_0x582733-0x0;var _0x422841=_0x855b[_0x582733];return _0x422841;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xb855('0x0'))['db'][_0xb855('0x1')];var FaxMessage=require(_0xb855('0x0'))['db'][_0xb855('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb855('0x3')](0x0);var events={'afterCreate':_0xb855('0x4'),'afterUpdate':_0xb855('0x5'),'afterDestroy':_0xb855('0x6')};function emitEvent(_0x17973a){return function(_0x55006a,_0x4e11b8,_0x59fe2c){_0x55006a['getUsers']({'attributes':['id'],'raw':!![]})[_0xb855('0x7')](function(_0x4cd6eb){_0x55006a[_0xb855('0x8')]('Users',_0x4cd6eb[_0xb855('0x9')](function(_0x135d7f){return{'id':_0x135d7f['id']};}));return FaxMessage[_0xb855('0xa')]({'where':{'FaxInteractionId':_0x55006a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb855('0x7')](function(_0x4cae5e){_0x55006a[_0xb855('0x8')](_0xb855('0xb'),_0x4cae5e[_0xb855('0xc')]);FaxInteractionEvents['emit'](_0x17973a+':'+_0x55006a['id'],_0x55006a);FaxInteractionEvents[_0xb855('0xd')](_0x17973a,_0x55006a);_0x59fe2c(null);})[_0xb855('0xe')](_0x59fe2c(null));};}for(var e in events){if(events[_0xb855('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 8268930..147dbe0 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 _0x2072=['path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x45fe7d,_0x590812){var _0x4553f3=function(_0x26010c){while(--_0x26010c){_0x45fe7d['push'](_0x45fe7d['shift']());}};_0x4553f3(++_0x590812);}(_0x2072,0x1d9));var _0x2207=function(_0x563da4,_0x51766c){_0x563da4=_0x563da4-0x0;var _0x11ddbe=_0x2072[_0x563da4];return _0x11ddbe;};'use strict';var _=require(_0x2207('0x0'));var util=require(_0x2207('0x1'));var logger=require(_0x2207('0x2'))(_0x2207('0x3'));var moment=require(_0x2207('0x4'));var BPromise=require(_0x2207('0x5'));var rp=require(_0x2207('0x6'));var fs=require('fs');var path=require(_0x2207('0x7'));var rimraf=require(_0x2207('0x8'));var config=require(_0x2207('0x9'));var attributes=require(_0x2207('0xa'));module[_0x2207('0xb')]=function(_0x23e704,_0x2727ee){return _0x23e704[_0x2207('0xc')](_0x2207('0xd'),attributes,{'tableName':_0x2207('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x16a0ef,_0x22c2cd,_0x3618b8){if(_0x16a0ef[_0x2207('0xf')](_0x2207('0x10'))){_0x16a0ef[_0x2207('0x11')]=moment()[_0x2207('0x12')](_0x2207('0x13'));}_0x3618b8(null,_0x16a0ef);}}});}; \ No newline at end of file +var _0x3862=['fax_interactions','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction'];(function(_0x1e4063,_0x1dee7f){var _0x5e9ddb=function(_0x35569e){while(--_0x35569e){_0x1e4063['push'](_0x1e4063['shift']());}};_0x5e9ddb(++_0x1dee7f);}(_0x3862,0x112));var _0x2386=function(_0x4a9a17,_0x273a09){_0x4a9a17=_0x4a9a17-0x0;var _0x30e831=_0x3862[_0x4a9a17];return _0x30e831;};'use strict';var _=require(_0x2386('0x0'));var util=require(_0x2386('0x1'));var logger=require(_0x2386('0x2'))(_0x2386('0x3'));var moment=require(_0x2386('0x4'));var BPromise=require(_0x2386('0x5'));var rp=require(_0x2386('0x6'));var fs=require('fs');var path=require(_0x2386('0x7'));var rimraf=require(_0x2386('0x8'));var config=require(_0x2386('0x9'));var attributes=require(_0x2386('0xa'));module[_0x2386('0xb')]=function(_0x46fbeb,_0x993366){return _0x46fbeb[_0x2386('0xc')](_0x2386('0xd'),attributes,{'tableName':_0x2386('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5f5c52,_0x3d315f,_0x168b9e){if(_0x5f5c52['changed']('closed')){_0x5f5c52[_0x2386('0xf')]=moment()[_0x2386('0x10')](_0x2386('0x11'));}_0x168b9e(null,_0x5f5c52);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index d8f8b30..e222220 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 _0x4b9d=['where','addTags','omit','ids','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','redis','defaults','localhost','./faxInteraction.socket','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','attributes','debug','catch','find'];(function(_0x58c8ee,_0x14b2c6){var _0x4de01b=function(_0xcfd578){while(--_0xcfd578){_0x58c8ee['push'](_0x58c8ee['shift']());}};_0x4de01b(++_0x14b2c6);}(_0x4b9d,0x9e));var _0xd4b9=function(_0x30faee,_0x1c3794){_0x30faee=_0x30faee-0x0;var _0x3a90ab=_0x4b9d[_0x30faee];return _0x3a90ab;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd4b9('0x0'));var BPromise=require(_0xd4b9('0x1'));var rs=require(_0xd4b9('0x2'));var fs=require('fs');var Redis=require(_0xd4b9('0x3'));var db=require(_0xd4b9('0x4'))['db'];var utils=require(_0xd4b9('0x5'));var logger=require('../../config/logger')(_0xd4b9('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd4b9('0x7')]({'port':0x232a});config[_0xd4b9('0x8')]=_[_0xd4b9('0x9')](config[_0xd4b9('0x8')],{'host':_0xd4b9('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd4b9('0x8')]));require(_0xd4b9('0xb'))['register'](socket);function respondWithRpcPromise(_0x452062,_0x355d4c,_0x366fab){return new BPromise(function(_0x2e0005,_0x2635ec){return client[_0xd4b9('0xc')](_0x452062,_0x366fab)[_0xd4b9('0xd')](function(_0x2288da){logger[_0xd4b9('0xe')](_0xd4b9('0xf'),_0x355d4c,_0xd4b9('0x10'));logger['debug'](_0xd4b9('0x11'),_0x355d4c,_0xd4b9('0x10'),JSON[_0xd4b9('0x12')](_0x2288da));if(_0x2288da[_0xd4b9('0x13')]){if(_0x2288da[_0xd4b9('0x13')][_0xd4b9('0x14')]===0x1f4){logger['error'](_0xd4b9('0xf'),_0x355d4c,_0x2288da['error'][_0xd4b9('0x15')]);return _0x2635ec(_0x2288da[_0xd4b9('0x13')]['message']);}logger['error'](_0xd4b9('0xf'),_0x355d4c,_0x2288da[_0xd4b9('0x13')][_0xd4b9('0x15')]);return _0x2e0005(_0x2288da[_0xd4b9('0x13')][_0xd4b9('0x15')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x355d4c,_0xd4b9('0x10'));_0x2e0005(_0x2288da['result'][_0xd4b9('0x15')]);}})['catch'](function(_0x44644a){logger[_0xd4b9('0x13')](_0xd4b9('0xf'),_0x355d4c,_0x44644a);_0x2635ec(_0x44644a);});});}exports[_0xd4b9('0x16')]=function(_0x200dda){var _0xb67604=this;return new Promise(function(_0x122abc,_0x4645d5){return db[_0xd4b9('0x17')][_0xd4b9('0x18')](_0x200dda[_0xd4b9('0x19')],{'raw':_0x200dda[_0xd4b9('0x1a')]?_0x200dda['options'][_0xd4b9('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x200dda['options']?_0x200dda[_0xd4b9('0x1a')]['where']||null:null,'attributes':_0x200dda[_0xd4b9('0x1a')]?_0x200dda[_0xd4b9('0x1a')][_0xd4b9('0x1c')]||null:null,'limit':_0x200dda['options']?_0x200dda[_0xd4b9('0x1a')]['limit']||null:null})['then'](function(_0x3c7b63){logger[_0xd4b9('0xe')](_0xd4b9('0x16'),_0x200dda);logger[_0xd4b9('0x1d')](_0xd4b9('0x16'),_0x200dda,JSON[_0xd4b9('0x12')](_0x3c7b63));_0x122abc(_0x3c7b63);})[_0xd4b9('0x1e')](function(_0x389147){logger[_0xd4b9('0x13')](_0xd4b9('0x16'),_0x389147[_0xd4b9('0x15')],_0x200dda);_0x4645d5(_0xb67604[_0xd4b9('0x13')](0x1f4,_0x389147['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x4297b1){return new Promise(function(_0x1383cd,_0x58d2ea){return db[_0xd4b9('0x17')][_0xd4b9('0x1f')]({'where':_0x4297b1['options']?_0x4297b1['options'][_0xd4b9('0x20')]||null:null})['then'](function(_0x535008){if(_0x535008){return _0x535008[_0xd4b9('0x21')](_0x4297b1[_0xd4b9('0x19')]['ids'],_[_0xd4b9('0x22')](_0x4297b1[_0xd4b9('0x19')],[_0xd4b9('0x23'),'id'])||{});}})[_0xd4b9('0x24')](function(_0x1e74bd){logger[_0xd4b9('0xe')]('AddTags',_0x4297b1);logger[_0xd4b9('0x1d')](_0xd4b9('0x25'),_0x4297b1,JSON[_0xd4b9('0x12')](_0x1e74bd));_0x1383cd(_0x1e74bd);})[_0xd4b9('0x1e')](function(_0x1a5afa){logger[_0xd4b9('0x13')](_0xd4b9('0x25'),_0x1a5afa[_0xd4b9('0x15')],_0x4297b1);_0x58d2ea(_this['error'](0x1f4,_0x1a5afa[_0xd4b9('0x15')]));});});}; \ No newline at end of file +var _0x881f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','info','FaxInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','then','find','addTags','ids','spread','AddTags','lodash','util','moment','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x881f,0x14c));var _0xf881=function(_0x13fb15,_0x2ec1ee){_0x13fb15=_0x13fb15-0x0;var _0xc8b40e=_0x881f[_0x13fb15];return _0xc8b40e;};'use strict';var _=require(_0xf881('0x0'));var util=require(_0xf881('0x1'));var moment=require(_0xf881('0x2'));var BPromise=require('bluebird');var rs=require(_0xf881('0x3'));var fs=require('fs');var Redis=require(_0xf881('0x4'));var db=require(_0xf881('0x5'))['db'];var utils=require(_0xf881('0x6'));var logger=require(_0xf881('0x7'))(_0xf881('0x8'));var config=require(_0xf881('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf881('0xa')][_0xf881('0xb')]({'port':0x232a});config[_0xf881('0xc')]=_[_0xf881('0xd')](config[_0xf881('0xc')],{'host':_0xf881('0xe'),'port':0x18eb});var socket=require(_0xf881('0xf'))(new Redis(config[_0xf881('0xc')]));require(_0xf881('0x10'))[_0xf881('0x11')](socket);function respondWithRpcPromise(_0x4bce0f,_0x1b347e,_0x5dbc56){return new BPromise(function(_0x5ca384,_0x2ff97f){return client['request'](_0x4bce0f,_0x5dbc56)['then'](function(_0x3a6843){logger[_0xf881('0x12')](_0xf881('0x13'),_0x1b347e,'request\x20sent');logger[_0xf881('0x14')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x1b347e,_0xf881('0x15'),JSON[_0xf881('0x16')](_0x3a6843));if(_0x3a6843['error']){if(_0x3a6843['error'][_0xf881('0x17')]===0x1f4){logger[_0xf881('0x18')](_0xf881('0x13'),_0x1b347e,_0x3a6843[_0xf881('0x18')]['message']);return _0x2ff97f(_0x3a6843[_0xf881('0x18')][_0xf881('0x19')]);}logger[_0xf881('0x18')](_0xf881('0x13'),_0x1b347e,_0x3a6843['error'][_0xf881('0x19')]);return _0x5ca384(_0x3a6843[_0xf881('0x18')][_0xf881('0x19')]);}else{logger[_0xf881('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x1b347e,_0xf881('0x15'));_0x5ca384(_0x3a6843['result'][_0xf881('0x19')]);}})[_0xf881('0x1a')](function(_0x44f120){logger['error'](_0xf881('0x13'),_0x1b347e,_0x44f120);_0x2ff97f(_0x44f120);});});}exports[_0xf881('0x1b')]=function(_0x587083){var _0x32da73=this;return new Promise(function(_0x4cdd90,_0x123a40){return db[_0xf881('0x1c')][_0xf881('0x1d')](_0x587083[_0xf881('0x1e')],{'raw':_0x587083['options']?_0x587083[_0xf881('0x1f')][_0xf881('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x587083[_0xf881('0x1f')]?_0x587083[_0xf881('0x1f')][_0xf881('0x21')]||null:null,'attributes':_0x587083[_0xf881('0x1f')]?_0x587083[_0xf881('0x1f')][_0xf881('0x22')]||null:null,'limit':_0x587083['options']?_0x587083[_0xf881('0x1f')][_0xf881('0x23')]||null:null})[_0xf881('0x24')](function(_0x12e8a2){logger[_0xf881('0x12')]('UpdateFaxInteraction',_0x587083);logger[_0xf881('0x14')](_0xf881('0x1b'),_0x587083,JSON[_0xf881('0x16')](_0x12e8a2));_0x4cdd90(_0x12e8a2);})[_0xf881('0x1a')](function(_0x2a6aec){logger[_0xf881('0x18')]('UpdateFaxInteraction',_0x2a6aec[_0xf881('0x19')],_0x587083);_0x123a40(_0x32da73[_0xf881('0x18')](0x1f4,_0x2a6aec[_0xf881('0x19')]));});});};exports['AddTagsToFaxInteraction']=function(_0x5c946b){return new Promise(function(_0x3cd1ed,_0x42711f){return db['FaxInteraction'][_0xf881('0x25')]({'where':_0x5c946b[_0xf881('0x1f')]?_0x5c946b[_0xf881('0x1f')]['where']||null:null})['then'](function(_0xc8cb20){if(_0xc8cb20){return _0xc8cb20[_0xf881('0x26')](_0x5c946b['body'][_0xf881('0x27')],_['omit'](_0x5c946b[_0xf881('0x1e')],[_0xf881('0x27'),'id'])||{});}})[_0xf881('0x28')](function(_0x2b3f0a){logger[_0xf881('0x12')](_0xf881('0x29'),_0x5c946b);logger[_0xf881('0x14')](_0xf881('0x29'),_0x5c946b,JSON[_0xf881('0x16')](_0x2b3f0a));_0x3cd1ed(_0x2b3f0a);})[_0xf881('0x1a')](function(_0x252283){logger[_0xf881('0x18')](_0xf881('0x29'),_0x252283[_0xf881('0x19')],_0x5c946b);_0x42711f(_this[_0xf881('0x18')](0x1f4,_0x252283[_0xf881('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index d243511..c66727c 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 _0x0102=['emit','removeListener','register','length','faxInteraction:','save','update'];(function(_0x364896,_0x14919e){var _0x4559c7=function(_0xbbd4f1){while(--_0xbbd4f1){_0x364896['push'](_0x364896['shift']());}};_0x4559c7(++_0x14919e);}(_0x0102,0x1da));var _0x2010=function(_0x37a824,_0x4e1047){_0x37a824=_0x37a824-0x0;var _0x112818=_0x0102[_0x37a824];return _0x112818;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x2010('0x0'),'remove',_0x2010('0x1')];function createListener(_0x18aad0,_0x80ab90){return function(_0x1d4530){_0x80ab90[_0x2010('0x2')](_0x18aad0,_0x1d4530);};}function removeListener(_0x33c1eb,_0x43d4b7){return function(){FaxInteractionEvents[_0x2010('0x3')](_0x33c1eb,_0x43d4b7);};}exports[_0x2010('0x4')]=function(_0x55cafc){for(var _0x3cd147=0x0,_0x366e8b=events[_0x2010('0x5')];_0x3cd147<_0x366e8b;_0x3cd147++){var _0x15e884=events[_0x3cd147];var _0x1e7d54=createListener(_0x2010('0x6')+_0x15e884,_0x55cafc);FaxInteractionEvents['on'](_0x15e884,_0x1e7d54);}}; \ No newline at end of file +var _0x7932=['register','length','faxInteraction:','./faxInteraction.events','save','remove','update','emit'];(function(_0x5a99db,_0x1cece5){var _0x3aad62=function(_0x334cb7){while(--_0x334cb7){_0x5a99db['push'](_0x5a99db['shift']());}};_0x3aad62(++_0x1cece5);}(_0x7932,0x73));var _0x2793=function(_0x2c9515,_0x526ad0){_0x2c9515=_0x2c9515-0x0;var _0x43612f=_0x7932[_0x2c9515];return _0x43612f;};'use strict';var FaxInteractionEvents=require(_0x2793('0x0'));var events=[_0x2793('0x1'),_0x2793('0x2'),_0x2793('0x3')];function createListener(_0x13f3f6,_0x4a1442){return function(_0x12ca1f){_0x4a1442[_0x2793('0x4')](_0x13f3f6,_0x12ca1f);};}function removeListener(_0x525a55,_0x52bb0a){return function(){FaxInteractionEvents['removeListener'](_0x525a55,_0x52bb0a);};}exports[_0x2793('0x5')]=function(_0x5557a7){for(var _0x501d14=0x0,_0x313224=events[_0x2793('0x6')];_0x501d14<_0x313224;_0x501d14++){var _0x2a9de6=events[_0x501d14];var _0x1c06fa=createListener(_0x2793('0x7')+_0x2a9de6,_0x5557a7);FaxInteractionEvents['on'](_0x2a9de6,_0x1c06fa);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index ac657f8..1171453 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 _0xfa39=['show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','addTags','fax','update','delete','destroy','removeTags','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x340e3d,_0x5b030d){var _0x425967=function(_0xc4a8b4){while(--_0xc4a8b4){_0x340e3d['push'](_0x340e3d['shift']());}};_0x425967(++_0x5b030d);}(_0xfa39,0x197));var _0x9fa3=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xfa39[_0x2642cb];return _0xe6e41;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9fa3('0x0'));var timeout=require('connect-timeout');var express=require(_0x9fa3('0x1'));var router=express[_0x9fa3('0x2')]();var fs_extra=require(_0x9fa3('0x3'));var auth=require(_0x9fa3('0x4'));var interaction=require(_0x9fa3('0x5'));var config=require(_0x9fa3('0x6'));var controller=require(_0x9fa3('0x7'));router[_0x9fa3('0x8')]('/',auth[_0x9fa3('0x9')](),controller[_0x9fa3('0xa')]);router[_0x9fa3('0x8')](_0x9fa3('0xb'),auth[_0x9fa3('0x9')](),controller['describe']);router[_0x9fa3('0x8')](_0x9fa3('0xc'),auth['isAuthenticated'](),controller[_0x9fa3('0xd')]);router[_0x9fa3('0x8')](_0x9fa3('0xe'),auth['isAuthenticated'](),controller[_0x9fa3('0xf')]);router[_0x9fa3('0x8')](_0x9fa3('0x10'),auth[_0x9fa3('0x9')](),controller[_0x9fa3('0x11')]);router[_0x9fa3('0x12')]('/',auth[_0x9fa3('0x9')](),controller[_0x9fa3('0x13')]);router[_0x9fa3('0x12')]('/:id/messages',auth[_0x9fa3('0x9')](),controller[_0x9fa3('0x14')]);router[_0x9fa3('0x12')](_0x9fa3('0x15'),auth[_0x9fa3('0x9')](),interaction[_0x9fa3('0x16')]('fax','faxinteraction:addtags'),controller[_0x9fa3('0x17')]);router['put']('/:id',auth[_0x9fa3('0x9')](),interaction[_0x9fa3('0x16')](_0x9fa3('0x18'),'faxinteraction:update'),controller[_0x9fa3('0x19')]);router[_0x9fa3('0x1a')](_0x9fa3('0xc'),auth[_0x9fa3('0x9')](),interaction[_0x9fa3('0x16')](_0x9fa3('0x18'),'faxinteraction:destroy'),controller[_0x9fa3('0x1b')]);router[_0x9fa3('0x1a')](_0x9fa3('0x15'),auth[_0x9fa3('0x9')](),controller[_0x9fa3('0x1c')]);module[_0x9fa3('0x1d')]=router; \ No newline at end of file +var _0x9ad7=['../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','isAuthenticated','describe','/:id','show','getMessages','/:id/download','download','create','post','/:id/messages','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','fax','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0xc366c5,_0x33814d){var _0x4aac37=function(_0x3d16d0){while(--_0x3d16d0){_0xc366c5['push'](_0xc366c5['shift']());}};_0x4aac37(++_0x33814d);}(_0x9ad7,0x78));var _0x79ad=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x9ad7[_0x710815];return _0x5b3b89;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x79ad('0x0'));var timeout=require(_0x79ad('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x79ad('0x2'));var auth=require(_0x79ad('0x3'));var interaction=require(_0x79ad('0x4'));var config=require(_0x79ad('0x5'));var controller=require(_0x79ad('0x6'));router[_0x79ad('0x7')]('/',auth['isAuthenticated'](),controller[_0x79ad('0x8')]);router[_0x79ad('0x7')]('/describe',auth[_0x79ad('0x9')](),controller[_0x79ad('0xa')]);router[_0x79ad('0x7')](_0x79ad('0xb'),auth[_0x79ad('0x9')](),controller[_0x79ad('0xc')]);router[_0x79ad('0x7')]('/:id/messages',auth[_0x79ad('0x9')](),controller[_0x79ad('0xd')]);router[_0x79ad('0x7')](_0x79ad('0xe'),auth[_0x79ad('0x9')](),controller[_0x79ad('0xf')]);router['post']('/',auth[_0x79ad('0x9')](),controller[_0x79ad('0x10')]);router[_0x79ad('0x11')](_0x79ad('0x12'),auth['isAuthenticated'](),controller[_0x79ad('0x13')]);router[_0x79ad('0x11')](_0x79ad('0x14'),auth[_0x79ad('0x9')](),interaction[_0x79ad('0x15')]('fax',_0x79ad('0x16')),controller[_0x79ad('0x17')]);router['put'](_0x79ad('0xb'),auth[_0x79ad('0x9')](),interaction['tracked'](_0x79ad('0x18'),_0x79ad('0x19')),controller[_0x79ad('0x1a')]);router[_0x79ad('0x1b')](_0x79ad('0xb'),auth[_0x79ad('0x9')](),interaction[_0x79ad('0x15')](_0x79ad('0x18'),_0x79ad('0x1c')),controller[_0x79ad('0x1d')]);router[_0x79ad('0x1b')]('/:id/tags',auth[_0x79ad('0x9')](),controller[_0x79ad('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index c15799a..91a5647 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 _0x89e8=['medium','BOOLEAN','ENUM','out','sequelize','exports','TEXT'];(function(_0x2bef3a,_0x1c0027){var _0x8fc616=function(_0x24f290){while(--_0x24f290){_0x2bef3a['push'](_0x2bef3a['shift']());}};_0x8fc616(++_0x1c0027);}(_0x89e8,0x74));var _0x889e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x89e8[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x889e('0x0'));module[_0x889e('0x1')]={'body':{'type':Sequelize[_0x889e('0x2')](_0x889e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x889e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x889e('0x5')]('in',_0x889e('0x6')),'defaultValue':_0x889e('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x7119=['exports','medium','ENUM','out','TEXT'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x7119,0x1c7));var _0x9711=function(_0x4afac5,_0x1ab4ed){_0x4afac5=_0x4afac5-0x0;var _0x2404b3=_0x7119[_0x4afac5];return _0x2404b3;};'use strict';var Sequelize=require('sequelize');module[_0x9711('0x0')]={'body':{'type':Sequelize['TEXT'](_0x9711('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9711('0x2')]('in',_0x9711('0x3')),'defaultValue':_0x9711('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x9711('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 b604156..d256cc8 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 _0xc6a4=['request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','undefined','count','offset','limit','set','Content-Range','json','reject','save','update','destroy','stack','name','send','index','map','FaxMessage','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','type','merge','options','include','findAll','rows','catch','show','keys','rawAttributes','body','find','params','describe','fax-interactions','accept','fax','read','readAt','format','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','internal','manual','SIP/%s','channel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','motionChannel','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','server','files','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','client','request','then','info','FaxMessage,\x20%s,\x20%s'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xc6a4,0x69));var _0x4c6a=function(_0x521b6d,_0x3575b2){_0x521b6d=_0x521b6d-0x0;var _0x1e7c50=_0xc6a4[_0x521b6d];return _0x1e7c50;};'use strict';var emlformat=require(_0x4c6a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4c6a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c6a('0x2'));var moment=require(_0x4c6a('0x3'));var BPromise=require(_0x4c6a('0x4'));var Mustache=require(_0x4c6a('0x5'));var util=require(_0x4c6a('0x6'));var path=require('path');var sox=require(_0x4c6a('0x7'));var csv=require(_0x4c6a('0x8'));var ejs=require(_0x4c6a('0x9'));var fs=require('fs');var fs_extra=require(_0x4c6a('0xa'));var _=require(_0x4c6a('0xb'));var squel=require(_0x4c6a('0xc'));var crypto=require(_0x4c6a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4c6a('0xe'));var toCsv=require(_0x4c6a('0x8'));var querystring=require(_0x4c6a('0xf'));var Papa=require(_0x4c6a('0x10'));var Redis=require(_0x4c6a('0x11'));var authService=require(_0x4c6a('0x12'));var qs=require(_0x4c6a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4c6a('0x14'));var logger=require(_0x4c6a('0x15'))(_0x4c6a('0x16'));var utils=require(_0x4c6a('0x17'));var config=require(_0x4c6a('0x18'));var licenseUtil=require(_0x4c6a('0x19'));var db=require(_0x4c6a('0x1a'))['db'];config[_0x4c6a('0x1b')]=_[_0x4c6a('0x1c')](config[_0x4c6a('0x1b')],{'host':_0x4c6a('0x1d'),'port':0x18eb});var socket=require(_0x4c6a('0x1e'))(new Redis(config['redis']));require('./faxMessage.socket')[_0x4c6a('0x1f')](socket);var jayson=require(_0x4c6a('0x20'));var client=jayson['client'][_0x4c6a('0x21')]({'port':0x232c});var client9002=jayson[_0x4c6a('0x22')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f3e82,_0xef7be5,_0x2af004,_0x478e04){return new BPromise(function(_0x26fc98,_0x1c5e1e){var _0x1d1411=_0x478e04||client;return _0x1d1411[_0x4c6a('0x23')](_0x5f3e82,_0x2af004)[_0x4c6a('0x24')](function(_0x43fd6f){logger[_0x4c6a('0x25')](_0x4c6a('0x26'),_0xef7be5,_0x4c6a('0x27'));logger[_0x4c6a('0x28')](_0x4c6a('0x29'),_0xef7be5,'request\x20sent',JSON[_0x4c6a('0x2a')](_0x43fd6f));if(_0x43fd6f['error']){if(_0x43fd6f[_0x4c6a('0x2b')][_0x4c6a('0x2c')]===0x1f4){logger[_0x4c6a('0x2b')](_0x4c6a('0x26'),_0xef7be5,_0x43fd6f['error']['message']);return _0x1c5e1e(_0x43fd6f[_0x4c6a('0x2b')]['message']);}logger[_0x4c6a('0x2b')](_0x4c6a('0x26'),_0xef7be5,_0x43fd6f[_0x4c6a('0x2b')][_0x4c6a('0x2d')]);return _0x26fc98(_0x43fd6f[_0x4c6a('0x2b')]['message']);}else{logger[_0x4c6a('0x25')](_0x4c6a('0x26'),_0xef7be5,_0x4c6a('0x27'));_0x26fc98(_0x43fd6f[_0x4c6a('0x2e')][_0x4c6a('0x2d')]);}})['catch'](function(_0x2def62){logger[_0x4c6a('0x2b')](_0x4c6a('0x26'),_0xef7be5,_0x2def62);_0x1c5e1e(_0x2def62);});});}function respondWithStatusCode(_0x4a5265,_0x3ec280){_0x3ec280=_0x3ec280||0xcc;return function(_0x4b1d63){if(_0x4b1d63){return _0x4a5265[_0x4c6a('0x2f')](_0x3ec280);}return _0x4a5265['status'](_0x3ec280)[_0x4c6a('0x30')]();};}function respondWithResult(_0x2f48da,_0x4c249e){_0x4c249e=_0x4c249e||0xc8;return function(_0x1377f7){if(_0x1377f7){return _0x2f48da[_0x4c6a('0x31')](_0x4c249e)['json'](_0x1377f7);}};}function respondWithFilteredResult(_0x24ed30,_0x145d66){return function(_0x187d32){if(_0x187d32){var _0x6ec7b6=typeof _0x145d66['offset']===_0x4c6a('0x32')&&typeof _0x145d66['limit']===_0x4c6a('0x32');var _0x19bdd3=_0x187d32[_0x4c6a('0x33')];var _0x5ac744=_0x6ec7b6?0x0:_0x145d66['offset'];var _0x550194=_0x6ec7b6?_0x187d32[_0x4c6a('0x33')]:_0x145d66[_0x4c6a('0x34')]+_0x145d66[_0x4c6a('0x35')];var _0x20736b;if(_0x550194>=_0x19bdd3){_0x550194=_0x19bdd3;_0x20736b=0xc8;}else{_0x20736b=0xce;}_0x24ed30[_0x4c6a('0x31')](_0x20736b);return _0x24ed30[_0x4c6a('0x36')](_0x4c6a('0x37'),_0x5ac744+'-'+_0x550194+'/'+_0x19bdd3)[_0x4c6a('0x38')](_0x187d32);}return null;};}function patchUpdates(_0x31840f){return function(_0x51f2fd){try{jsonpatch['apply'](_0x51f2fd,_0x31840f,!![]);}catch(_0x3ca57d){return BPromise[_0x4c6a('0x39')](_0x3ca57d);}return _0x51f2fd[_0x4c6a('0x3a')]();};}function saveUpdates(_0xe67599,_0xb6789b){return function(_0x5772b4){if(_0x5772b4){return _0x5772b4[_0x4c6a('0x3b')](_0xe67599)[_0x4c6a('0x24')](function(_0x41485f){return _0x41485f;});}return null;};}function removeEntity(_0x112048,_0x594a6a){return function(_0x12bb52){if(_0x12bb52){return _0x12bb52[_0x4c6a('0x3c')]()[_0x4c6a('0x24')](function(){_0x112048[_0x4c6a('0x31')](0xcc)[_0x4c6a('0x30')]();});}};}function handleEntityNotFound(_0x47a89f,_0x3f2fb7){return function(_0x2cccb2){if(!_0x2cccb2){_0x47a89f[_0x4c6a('0x2f')](0x194);}return _0x2cccb2;};}function handleError(_0x4e2600,_0x21bb78){_0x21bb78=_0x21bb78||0x1f4;return function(_0xb6bc0e){logger[_0x4c6a('0x2b')](_0xb6bc0e[_0x4c6a('0x3d')]);if(_0xb6bc0e[_0x4c6a('0x3e')]){delete _0xb6bc0e[_0x4c6a('0x3e')];}_0x4e2600[_0x4c6a('0x31')](_0x21bb78)[_0x4c6a('0x3f')](_0xb6bc0e);};}exports[_0x4c6a('0x40')]=function(_0x5293de,_0x2808d8){var _0x48cab1={},_0x262b11={},_0x491c3e={'count':0x0,'rows':[]};var _0x52106e=_[_0x4c6a('0x41')](db[_0x4c6a('0x42')]['rawAttributes'],function(_0x38445a){return{'name':_0x38445a[_0x4c6a('0x43')],'type':_0x38445a['type'][_0x4c6a('0x44')]};});_0x262b11[_0x4c6a('0x45')]=_[_0x4c6a('0x41')](_0x52106e,_0x4c6a('0x3e'));_0x262b11['query']=_['keys'](_0x5293de[_0x4c6a('0x46')]);_0x262b11['filters']=_[_0x4c6a('0x47')](_0x262b11[_0x4c6a('0x45')],_0x262b11['query']);_0x48cab1[_0x4c6a('0x48')]=_['intersection'](_0x262b11[_0x4c6a('0x45')],qs['fields'](_0x5293de[_0x4c6a('0x46')][_0x4c6a('0x49')]));_0x48cab1['attributes']=_0x48cab1[_0x4c6a('0x48')][_0x4c6a('0x4a')]?_0x48cab1[_0x4c6a('0x48')]:_0x262b11[_0x4c6a('0x45')];if(!_0x5293de[_0x4c6a('0x46')][_0x4c6a('0x4b')](_0x4c6a('0x4c'))){_0x48cab1['limit']=qs[_0x4c6a('0x35')](_0x5293de[_0x4c6a('0x46')][_0x4c6a('0x35')]);_0x48cab1[_0x4c6a('0x34')]=qs[_0x4c6a('0x34')](_0x5293de[_0x4c6a('0x46')][_0x4c6a('0x34')]);}_0x48cab1['order']=qs[_0x4c6a('0x4d')](_0x5293de['query'][_0x4c6a('0x4d')]);_0x48cab1[_0x4c6a('0x4e')]=qs[_0x4c6a('0x4f')](_['pick'](_0x5293de[_0x4c6a('0x46')],_0x262b11[_0x4c6a('0x4f')]),_0x52106e);if(_0x5293de[_0x4c6a('0x46')][_0x4c6a('0x50')]){_0x48cab1[_0x4c6a('0x4e')]=_['merge'](_0x48cab1['where'],{'$or':_[_0x4c6a('0x41')](_0x52106e,function(_0x180701){if(_0x180701[_0x4c6a('0x51')]!=='VIRTUAL'){var _0x518c9f={};_0x518c9f[_0x180701[_0x4c6a('0x3e')]]={'$like':'%'+_0x5293de['query'][_0x4c6a('0x50')]+'%'};return _0x518c9f;}})});}_0x48cab1=_[_0x4c6a('0x52')]({},_0x48cab1,_0x5293de[_0x4c6a('0x53')]);var _0x4e6344={'where':_0x48cab1[_0x4c6a('0x4e')]};return db['FaxMessage'][_0x4c6a('0x33')](_0x4e6344)['then'](function(_0x544a70){_0x491c3e[_0x4c6a('0x33')]=_0x544a70;if(_0x5293de[_0x4c6a('0x46')]['includeAll']){_0x48cab1[_0x4c6a('0x54')]=[{'all':!![]}];}return db[_0x4c6a('0x42')][_0x4c6a('0x55')](_0x48cab1);})[_0x4c6a('0x24')](function(_0x2755d6){_0x491c3e[_0x4c6a('0x56')]=_0x2755d6;return _0x491c3e;})[_0x4c6a('0x24')](respondWithFilteredResult(_0x2808d8,_0x48cab1))[_0x4c6a('0x57')](handleError(_0x2808d8,null));};exports[_0x4c6a('0x58')]=function(_0x16dc9d,_0xfcb223){var _0x3be18d={'raw':!![],'where':{'id':_0x16dc9d['params']['id']}},_0x4d4b76={};_0x4d4b76[_0x4c6a('0x45')]=_[_0x4c6a('0x59')](db[_0x4c6a('0x42')][_0x4c6a('0x5a')]);_0x4d4b76[_0x4c6a('0x46')]=_[_0x4c6a('0x59')](_0x16dc9d[_0x4c6a('0x46')]);_0x4d4b76[_0x4c6a('0x4f')]=_['intersection'](_0x4d4b76['model'],_0x4d4b76[_0x4c6a('0x46')]);_0x3be18d['attributes']=_[_0x4c6a('0x47')](_0x4d4b76[_0x4c6a('0x45')],qs['fields'](_0x16dc9d[_0x4c6a('0x46')][_0x4c6a('0x49')]));_0x3be18d[_0x4c6a('0x48')]=_0x3be18d[_0x4c6a('0x48')][_0x4c6a('0x4a')]?_0x3be18d[_0x4c6a('0x48')]:_0x4d4b76[_0x4c6a('0x45')];if(_0x16dc9d['query']['includeAll']){_0x3be18d[_0x4c6a('0x54')]=[{'all':!![]}];}_0x3be18d=_[_0x4c6a('0x52')]({},_0x3be18d,_0x16dc9d[_0x4c6a('0x53')]);return db[_0x4c6a('0x42')]['find'](_0x3be18d)[_0x4c6a('0x24')](handleEntityNotFound(_0xfcb223,null))[_0x4c6a('0x24')](respondWithResult(_0xfcb223,null))[_0x4c6a('0x57')](handleError(_0xfcb223,null));};exports[_0x4c6a('0x3b')]=function(_0x3adbbd,_0x176928){if(_0x3adbbd[_0x4c6a('0x5b')]['id']){delete _0x3adbbd[_0x4c6a('0x5b')]['id'];}return db[_0x4c6a('0x42')][_0x4c6a('0x5c')]({'where':{'id':_0x3adbbd[_0x4c6a('0x5d')]['id']}})[_0x4c6a('0x24')](handleEntityNotFound(_0x176928,null))['then'](saveUpdates(_0x3adbbd['body'],null))[_0x4c6a('0x24')](respondWithResult(_0x176928,null))[_0x4c6a('0x57')](handleError(_0x176928,null));};exports[_0x4c6a('0x3c')]=function(_0x439c23,_0x401eb1){return db[_0x4c6a('0x42')][_0x4c6a('0x5c')]({'where':{'id':_0x439c23[_0x4c6a('0x5d')]['id']}})[_0x4c6a('0x24')](handleEntityNotFound(_0x401eb1,null))[_0x4c6a('0x24')](removeEntity(_0x401eb1,null))['catch'](handleError(_0x401eb1,null));};exports[_0x4c6a('0x5e')]=function(_0x4b0e60,_0x2d376f){return db[_0x4c6a('0x42')]['describe']()[_0x4c6a('0x24')](respondWithResult(_0x2d376f,null))[_0x4c6a('0x57')](handleError(_0x2d376f,null));};var interaction_log=require(_0x4c6a('0x15'))(_0x4c6a('0x5f'));exports[_0x4c6a('0x60')]=function(_0x3c3891,_0x4b0a41,_0x190fb4){var _0x518c6b={'agent':{},'channel':_0x4c6a('0x61')};if(_0x3c3891[_0x4c6a('0x5b')]['id']){delete _0x3c3891[_0x4c6a('0x5b')]['id'];}_0x3c3891[_0x4c6a('0x5b')][_0x4c6a('0x62')]=!![];_0x3c3891[_0x4c6a('0x5b')][_0x4c6a('0x63')]=moment()[_0x4c6a('0x64')]('YYYY-MM-DD\x20HH:mm:ss');_0x3c3891['body'][_0x4c6a('0x65')]=_0x3c3891[_0x4c6a('0x5b')][_0x4c6a('0x65')]||_0x3c3891[_0x4c6a('0x66')]['id'];_0x518c6b[_0x4c6a('0x67')]['id']=_0x3c3891[_0x4c6a('0x5b')]['UserId'];return db['FaxMessage'][_0x4c6a('0x5c')]({'where':{'id':_0x3c3891[_0x4c6a('0x5d')]['id'],'UserId':null}})[_0x4c6a('0x24')](handleEntityNotFound(_0x4b0a41,null))[_0x4c6a('0x24')](saveUpdates(_0x3c3891[_0x4c6a('0x5b')],null))[_0x4c6a('0x24')](function(_0x3e6f82){if(_0x3e6f82){_0x518c6b[_0x4c6a('0x2d')]=_0x3e6f82[_0x4c6a('0x68')]({'plain':!![]});return db[_0x4c6a('0x69')]['find']({'where':{'id':_0x3e6f82[_0x4c6a('0x6a')]}});}return null;})[_0x4c6a('0x24')](handleEntityNotFound(_0x4b0a41,null))[_0x4c6a('0x24')](function(_0x2e9100){if(_0x2e9100){return _0x2e9100[_0x4c6a('0x3b')]({'UserId':_0x3c3891[_0x4c6a('0x5b')]['UserId'],'read1stAt':_[_0x4c6a('0x6b')](_0x2e9100[_0x4c6a('0x6c')])?moment()[_0x4c6a('0x64')](_0x4c6a('0x6d')):undefined});}return null;})[_0x4c6a('0x24')](function(_0x1443ed){if(_0x1443ed){_0x518c6b['interaction']=_0x1443ed[_0x4c6a('0x68')]({'plain':!![]});interaction_log[_0x4c6a('0x25')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3c3891[_0x4c6a('0x66')]['id'],_0x3c3891['user'][_0x4c6a('0x3e')],_0x3c3891[_0x4c6a('0x66')][_0x4c6a('0x6e')],_0x518c6b[_0x4c6a('0x6f')]['id'],_0x3c3891[_0x4c6a('0x5b')]?JSON[_0x4c6a('0x2a')](_0x3c3891['body']):_0x4c6a('0x70'));return respondWithRpcPromise('AcceptMessage',_0x4c6a('0x71'),_0x518c6b);}return null;})['then'](function(_0x475a69){var _0x3f03c8=_0x4c6a('0x72')+_0x475a69['message'][_0x4c6a('0x73')];return db[_0x4c6a('0x74')][_0x4c6a('0x46')](_0x3f03c8,{'type':db[_0x4c6a('0x75')][_0x4c6a('0x76')][_0x4c6a('0x77')],'raw':!![]})[_0x4c6a('0x24')](function(_0x42d34e){return _0x42d34e;});})[_0x4c6a('0x24')](function(_0x20c79f){if(_0x20c79f){_0x518c6b['message'][_0x4c6a('0x78')]=_0x20c79f[0x0];if(!_0x3c3891[_0x4c6a('0x5b')]['UserId'])return;return db['User']['find']({'where':{'id':_0x3c3891[_0x4c6a('0x5b')]['UserId'],'role':_0x4c6a('0x67')},'attributes':['id',_0x4c6a('0x3e'),_0x4c6a('0x79'),'email',_0x4c6a('0x7a')],'raw':!![]});}return null;})['then'](function(_0x313546){if(!_0x313546)return null;_0x518c6b[_0x4c6a('0x2d')]['agent']=_0x313546;return _0x518c6b;})['then'](function(_0x3d737b){if(_0x3d737b){if(_0x3c3891[_0x4c6a('0x5b')][_0x4c6a('0x7b')]){_0x518c6b[_0x4c6a('0x2d')]['interface']=util['format'](_0x4c6a('0x7c'),_0x3c3891['user'][_0x4c6a('0x3e')]);_0x518c6b['message'][_0x4c6a('0x7d')]=_0x518c6b[_0x4c6a('0x7d')];_0x518c6b[_0x4c6a('0x2d')]['motionChannel']=_0x518c6b[_0x4c6a('0x7d')];_0x518c6b['message'][_0x4c6a('0x7e')]=_0x4c6a('0x60');return respondWithRpcPromise(_0x4c6a('0x7f'),'EventManager',{'event':_0x4c6a('0x80'),'message':_0x518c6b[_0x4c6a('0x2d')]},client9002)['then'](function(){return _0x518c6b;});}return _0x518c6b;}return null;})[_0x4c6a('0x24')](respondWithResult(_0x4b0a41,null))[_0x4c6a('0x57')](handleError(_0x4b0a41,null));};var interaction_log=require(_0x4c6a('0x15'))('fax-interactions');exports[_0x4c6a('0x39')]=function(_0x1cd615,_0x331f73,_0x332750){var _0x37ed0a={'agent':{},'channel':_0x4c6a('0x61')};if(_0x1cd615[_0x4c6a('0x5b')]['id']){delete _0x1cd615[_0x4c6a('0x5b')]['id'];}_0x1cd615[_0x4c6a('0x5b')][_0x4c6a('0x65')]=_0x1cd615['body'][_0x4c6a('0x65')]||_0x1cd615[_0x4c6a('0x66')]['id'];_0x37ed0a[_0x4c6a('0x67')]['id']=_0x1cd615[_0x4c6a('0x5b')][_0x4c6a('0x65')];return db[_0x4c6a('0x42')]['find']({'where':{'id':_0x1cd615['params']['id'],'UserId':null}})[_0x4c6a('0x24')](handleEntityNotFound(_0x331f73,null))[_0x4c6a('0x24')](function(_0x14c202){if(_0x14c202){_0x37ed0a['message']=_0x14c202[_0x4c6a('0x68')]({'plain':!![]});return db[_0x4c6a('0x69')]['find']({'where':{'id':_0x14c202[_0x4c6a('0x6a')]}});}return null;})[_0x4c6a('0x24')](handleEntityNotFound(_0x331f73,null))[_0x4c6a('0x24')](function(_0x32b3e6){if(_0x32b3e6){_0x37ed0a['interaction']=_0x32b3e6[_0x4c6a('0x68')]({'plain':!![]});interaction_log[_0x4c6a('0x25')](_0x4c6a('0x81'),_0x1cd615['user']['id'],_0x1cd615['user'][_0x4c6a('0x3e')],_0x1cd615[_0x4c6a('0x66')][_0x4c6a('0x6e')],_0x37ed0a[_0x4c6a('0x6f')]['id'],_0x1cd615[_0x4c6a('0x5b')]?JSON[_0x4c6a('0x2a')](_0x1cd615[_0x4c6a('0x5b')]):'null');return respondWithRpcPromise(_0x4c6a('0x82'),'rejectMessage',_0x37ed0a);}return null;})[_0x4c6a('0x24')](function(_0x4a6e17){var _0x15c033=_0x4c6a('0x72')+_0x4a6e17[_0x4c6a('0x2d')][_0x4c6a('0x73')];return db['sequelize'][_0x4c6a('0x46')](_0x15c033,{'type':db['Sequelize'][_0x4c6a('0x76')][_0x4c6a('0x77')],'raw':!![]})[_0x4c6a('0x24')](function(_0x444193){return _0x444193;});})['then'](function(_0x278189){if(_0x278189){_0x37ed0a['message']['contact']=_0x278189[0x0];if(!_0x1cd615['body'][_0x4c6a('0x65')])return;return db['User'][_0x4c6a('0x5c')]({'where':{'id':_0x1cd615[_0x4c6a('0x5b')][_0x4c6a('0x65')],'role':_0x4c6a('0x67')},'attributes':['id','name','fullname','email',_0x4c6a('0x7a')],'raw':!![]});}return null;})[_0x4c6a('0x24')](function(_0x4e2d78){if(!_0x4e2d78)return null;_0x37ed0a['message'][_0x4c6a('0x67')]=_0x4e2d78;return _0x37ed0a;})[_0x4c6a('0x24')](function(_0x179e50){if(_0x179e50){_0x179e50[_0x4c6a('0x2d')]['interface']=util[_0x4c6a('0x64')](_0x4c6a('0x7c'),_0x1cd615[_0x4c6a('0x66')][_0x4c6a('0x3e')]);_0x179e50[_0x4c6a('0x2d')][_0x4c6a('0x7d')]=_0x37ed0a['channel'];_0x179e50['message'][_0x4c6a('0x83')]=_0x37ed0a[_0x4c6a('0x7d')];_0x179e50[_0x4c6a('0x2d')][_0x4c6a('0x7e')]='reject';respondWithRpcPromise(_0x4c6a('0x7f'),_0x4c6a('0x7f'),{'event':'rejectmessage','message':_0x179e50[_0x4c6a('0x2d')]},client9002);return _0x37ed0a;}return null;})[_0x4c6a('0x24')](respondWithResult(_0x331f73,null))[_0x4c6a('0x57')](handleError(_0x331f73,null));};exports[_0x4c6a('0x84')]=function(_0x151119,_0x377c86){var _0x203ea0;return db[_0x4c6a('0x42')]['create'](_0x151119[_0x4c6a('0x5b')],{})[_0x4c6a('0x24')](function(_0x344c97){_0x203ea0=_0x344c97;return db[_0x4c6a('0x85')][_0x4c6a('0x86')]({'where':{'id':_0x203ea0['ContactId']}});})[_0x4c6a('0x24')](function(_0x2349ac){if(_[_0x4c6a('0x6b')](_0x2349ac)){return;}else{_0x203ea0[_0x4c6a('0x61')]=_0x2349ac[_0x4c6a('0x61')];return db[_0x4c6a('0x87')]['findOne']({'where':{'id':_0x203ea0[_0x4c6a('0x88')]}});}})[_0x4c6a('0x24')](function(_0x307545){return respondWithRpcPromise(_0x4c6a('0x89'),_0x4c6a('0x89'),{'FaxAccountId':_[_0x4c6a('0x6b')](_0x151119[_0x4c6a('0x5b')])?undefined:_0x151119[_0x4c6a('0x5b')][_0x4c6a('0x8a')],'path':_['isNil'](_0x307545)?undefined:util['format'](_0x4c6a('0x8b'),_0x307545[_0x4c6a('0x8c')]),'fax':_[_0x4c6a('0x6b')](_0x203ea0[_0x4c6a('0x61')])?undefined:_0x203ea0[_0x4c6a('0x61')],'AttachmentId':_0x203ea0['AttachmentId']},client9002);})['then'](respondWithResult(_0x377c86,0xc9))[_0x4c6a('0x57')](handleError(_0x377c86,null));};exports[_0x4c6a('0x8d')]=function(_0x1a1272,_0xcb7088){var _0x1f189a=path['join'](config['root'],_0x4c6a('0x8e'),_0x4c6a('0x8f'),'attachments');return db[_0x4c6a('0x42')]['find']({'where':{'id':_0x1a1272[_0x4c6a('0x5d')]['id']},'include':[{'model':db[_0x4c6a('0x87')],'as':_0x4c6a('0x87')}]})[_0x4c6a('0x24')](handleEntityNotFound(_0xcb7088,null))['then'](function(_0x183301){if(_0x183301){return _0xcb7088['download'](path['join'](_0x1f189a,_0x183301[_0x4c6a('0x87')][_0x4c6a('0x8c')]));}})[_0x4c6a('0x57')](handleError(_0xcb7088,null));}; \ No newline at end of file +var _0x561a=['merge','VIRTUAL','options','includeAll','findAll','show','include','body','find','params','describe','fax-interactions','fax','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','isNil','read1stAt','interaction','get','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','fullname','email','interface','format','SIP/%s','channel','motionChannel','event','accept','EventManager','FaxInteraction','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','sequelize','QueryTypes','rejectmessage','create','CmContact','findOne','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','root','server','files','attachments','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','request','then','info','FaxMessage,\x20%s,\x20%s','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','FaxMessage','rawAttributes','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter'];(function(_0x1f858e,_0x4cd233){var _0x510531=function(_0x11c8f8){while(--_0x11c8f8){_0x1f858e['push'](_0x1f858e['shift']());}};_0x510531(++_0x4cd233);}(_0x561a,0x157));var _0xa561=function(_0x5a184b,_0x457876){_0x5a184b=_0x5a184b-0x0;var _0x713964=_0x561a[_0x5a184b];return _0x713964;};'use strict';var emlformat=require(_0xa561('0x0'));var rimraf=require(_0xa561('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa561('0x2'));var rp=require(_0xa561('0x3'));var moment=require(_0xa561('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa561('0x5'));var util=require(_0xa561('0x6'));var path=require(_0xa561('0x7'));var sox=require(_0xa561('0x8'));var csv=require(_0xa561('0x9'));var ejs=require(_0xa561('0xa'));var fs=require('fs');var fs_extra=require(_0xa561('0xb'));var _=require(_0xa561('0xc'));var squel=require('squel');var crypto=require(_0xa561('0xd'));var jsforce=require(_0xa561('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa561('0x9'));var querystring=require('querystring');var Papa=require(_0xa561('0xf'));var Redis=require(_0xa561('0x10'));var authService=require(_0xa561('0x11'));var qs=require(_0xa561('0x12'));var as=require(_0xa561('0x13'));var hardwareService=require(_0xa561('0x14'));var logger=require(_0xa561('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xa561('0x16'));var licenseUtil=require(_0xa561('0x17'));var db=require('../../mysqldb')['db'];config[_0xa561('0x18')]=_[_0xa561('0x19')](config[_0xa561('0x18')],{'host':_0xa561('0x1a'),'port':0x18eb});var socket=require(_0xa561('0x1b'))(new Redis(config[_0xa561('0x18')]));require(_0xa561('0x1c'))[_0xa561('0x1d')](socket);var jayson=require(_0xa561('0x1e'));var client=jayson[_0xa561('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xa561('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17eb82,_0x15fc70,_0x289d55,_0x2bcfd9){return new BPromise(function(_0x156ddd,_0x1592cf){var _0x2b569b=_0x2bcfd9||client;return _0x2b569b[_0xa561('0x20')](_0x17eb82,_0x289d55)[_0xa561('0x21')](function(_0x6112a9){logger[_0xa561('0x22')](_0xa561('0x23'),_0x15fc70,'request\x20sent');logger['debug'](_0xa561('0x24'),_0x15fc70,_0xa561('0x25'),JSON[_0xa561('0x26')](_0x6112a9));if(_0x6112a9[_0xa561('0x27')]){if(_0x6112a9[_0xa561('0x27')]['code']===0x1f4){logger[_0xa561('0x27')]('FaxMessage,\x20%s,\x20%s',_0x15fc70,_0x6112a9[_0xa561('0x27')][_0xa561('0x28')]);return _0x1592cf(_0x6112a9[_0xa561('0x27')][_0xa561('0x28')]);}logger[_0xa561('0x27')](_0xa561('0x23'),_0x15fc70,_0x6112a9[_0xa561('0x27')][_0xa561('0x28')]);return _0x156ddd(_0x6112a9[_0xa561('0x27')][_0xa561('0x28')]);}else{logger[_0xa561('0x22')]('FaxMessage,\x20%s,\x20%s',_0x15fc70,_0xa561('0x25'));_0x156ddd(_0x6112a9[_0xa561('0x29')][_0xa561('0x28')]);}})[_0xa561('0x2a')](function(_0xac2d8e){logger['error']('FaxMessage,\x20%s,\x20%s',_0x15fc70,_0xac2d8e);_0x1592cf(_0xac2d8e);});});}function respondWithStatusCode(_0x57fc55,_0x241295){_0x241295=_0x241295||0xcc;return function(_0x5e4c4c){if(_0x5e4c4c){return _0x57fc55[_0xa561('0x2b')](_0x241295);}return _0x57fc55[_0xa561('0x2c')](_0x241295)[_0xa561('0x2d')]();};}function respondWithResult(_0x13fb78,_0x1f9cdc){_0x1f9cdc=_0x1f9cdc||0xc8;return function(_0x3fb81f){if(_0x3fb81f){return _0x13fb78[_0xa561('0x2c')](_0x1f9cdc)[_0xa561('0x2e')](_0x3fb81f);}};}function respondWithFilteredResult(_0x41e045,_0xfdffd6){return function(_0x315185){if(_0x315185){var _0x3dfbc1=typeof _0xfdffd6['offset']===_0xa561('0x2f')&&typeof _0xfdffd6['limit']===_0xa561('0x2f');var _0x5bdbdc=_0x315185[_0xa561('0x30')];var _0x17223f=_0x3dfbc1?0x0:_0xfdffd6[_0xa561('0x31')];var _0xb71585=_0x3dfbc1?_0x315185[_0xa561('0x30')]:_0xfdffd6[_0xa561('0x31')]+_0xfdffd6[_0xa561('0x32')];var _0x4f91e;if(_0xb71585>=_0x5bdbdc){_0xb71585=_0x5bdbdc;_0x4f91e=0xc8;}else{_0x4f91e=0xce;}_0x41e045[_0xa561('0x2c')](_0x4f91e);return _0x41e045['set'](_0xa561('0x33'),_0x17223f+'-'+_0xb71585+'/'+_0x5bdbdc)[_0xa561('0x2e')](_0x315185);}return null;};}function patchUpdates(_0x4b356f){return function(_0x2ef45b){try{jsonpatch[_0xa561('0x34')](_0x2ef45b,_0x4b356f,!![]);}catch(_0x20b994){return BPromise[_0xa561('0x35')](_0x20b994);}return _0x2ef45b[_0xa561('0x36')]();};}function saveUpdates(_0x535794,_0x185ee2){return function(_0x506bf0){if(_0x506bf0){return _0x506bf0[_0xa561('0x37')](_0x535794)[_0xa561('0x21')](function(_0x353d78){return _0x353d78;});}return null;};}function removeEntity(_0x47a248,_0xe4db4c){return function(_0x402916){if(_0x402916){return _0x402916[_0xa561('0x38')]()[_0xa561('0x21')](function(){_0x47a248[_0xa561('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5018f8,_0x2b0c2d){return function(_0x23039b){if(!_0x23039b){_0x5018f8['sendStatus'](0x194);}return _0x23039b;};}function handleError(_0x4bb17a,_0x2428ff){_0x2428ff=_0x2428ff||0x1f4;return function(_0x3c4641){logger[_0xa561('0x27')](_0x3c4641[_0xa561('0x39')]);if(_0x3c4641[_0xa561('0x3a')]){delete _0x3c4641[_0xa561('0x3a')];}_0x4bb17a[_0xa561('0x2c')](_0x2428ff)[_0xa561('0x3b')](_0x3c4641);};}exports[_0xa561('0x3c')]=function(_0x3e98cd,_0x2f03f5){var _0x324ad0={},_0x406400={},_0x569d16={'count':0x0,'rows':[]};var _0x1f11c3=_['map'](db[_0xa561('0x3d')][_0xa561('0x3e')],function(_0x307f4c){return{'name':_0x307f4c['fieldName'],'type':_0x307f4c['type']['key']};});_0x406400[_0xa561('0x3f')]=_[_0xa561('0x40')](_0x1f11c3,_0xa561('0x3a'));_0x406400[_0xa561('0x41')]=_[_0xa561('0x42')](_0x3e98cd[_0xa561('0x41')]);_0x406400['filters']=_[_0xa561('0x43')](_0x406400['model'],_0x406400[_0xa561('0x41')]);_0x324ad0[_0xa561('0x44')]=_[_0xa561('0x43')](_0x406400[_0xa561('0x3f')],qs[_0xa561('0x45')](_0x3e98cd[_0xa561('0x41')][_0xa561('0x45')]));_0x324ad0[_0xa561('0x44')]=_0x324ad0[_0xa561('0x44')][_0xa561('0x46')]?_0x324ad0[_0xa561('0x44')]:_0x406400[_0xa561('0x3f')];if(!_0x3e98cd[_0xa561('0x41')][_0xa561('0x47')]('nolimit')){_0x324ad0[_0xa561('0x32')]=qs[_0xa561('0x32')](_0x3e98cd[_0xa561('0x41')][_0xa561('0x32')]);_0x324ad0['offset']=qs['offset'](_0x3e98cd[_0xa561('0x41')][_0xa561('0x31')]);}_0x324ad0[_0xa561('0x48')]=qs[_0xa561('0x49')](_0x3e98cd['query'][_0xa561('0x49')]);_0x324ad0[_0xa561('0x4a')]=qs[_0xa561('0x4b')](_['pick'](_0x3e98cd[_0xa561('0x41')],_0x406400['filters']),_0x1f11c3);if(_0x3e98cd[_0xa561('0x41')][_0xa561('0x4c')]){_0x324ad0[_0xa561('0x4a')]=_[_0xa561('0x4d')](_0x324ad0[_0xa561('0x4a')],{'$or':_[_0xa561('0x40')](_0x1f11c3,function(_0x887cbb){if(_0x887cbb['type']!==_0xa561('0x4e')){var _0x248f67={};_0x248f67[_0x887cbb[_0xa561('0x3a')]]={'$like':'%'+_0x3e98cd[_0xa561('0x41')][_0xa561('0x4c')]+'%'};return _0x248f67;}})});}_0x324ad0=_[_0xa561('0x4d')]({},_0x324ad0,_0x3e98cd[_0xa561('0x4f')]);var _0x596362={'where':_0x324ad0['where']};return db[_0xa561('0x3d')][_0xa561('0x30')](_0x596362)[_0xa561('0x21')](function(_0x212b82){_0x569d16[_0xa561('0x30')]=_0x212b82;if(_0x3e98cd[_0xa561('0x41')][_0xa561('0x50')]){_0x324ad0['include']=[{'all':!![]}];}return db[_0xa561('0x3d')][_0xa561('0x51')](_0x324ad0);})[_0xa561('0x21')](function(_0x110a2f){_0x569d16['rows']=_0x110a2f;return _0x569d16;})['then'](respondWithFilteredResult(_0x2f03f5,_0x324ad0))[_0xa561('0x2a')](handleError(_0x2f03f5,null));};exports[_0xa561('0x52')]=function(_0x442ecf,_0x274e17){var _0x38323c={'raw':!![],'where':{'id':_0x442ecf['params']['id']}},_0x47c853={};_0x47c853[_0xa561('0x3f')]=_[_0xa561('0x42')](db[_0xa561('0x3d')][_0xa561('0x3e')]);_0x47c853[_0xa561('0x41')]=_['keys'](_0x442ecf[_0xa561('0x41')]);_0x47c853[_0xa561('0x4b')]=_[_0xa561('0x43')](_0x47c853[_0xa561('0x3f')],_0x47c853[_0xa561('0x41')]);_0x38323c[_0xa561('0x44')]=_[_0xa561('0x43')](_0x47c853[_0xa561('0x3f')],qs['fields'](_0x442ecf[_0xa561('0x41')][_0xa561('0x45')]));_0x38323c[_0xa561('0x44')]=_0x38323c[_0xa561('0x44')][_0xa561('0x46')]?_0x38323c[_0xa561('0x44')]:_0x47c853['model'];if(_0x442ecf[_0xa561('0x41')]['includeAll']){_0x38323c[_0xa561('0x53')]=[{'all':!![]}];}_0x38323c=_[_0xa561('0x4d')]({},_0x38323c,_0x442ecf[_0xa561('0x4f')]);return db[_0xa561('0x3d')]['find'](_0x38323c)[_0xa561('0x21')](handleEntityNotFound(_0x274e17,null))[_0xa561('0x21')](respondWithResult(_0x274e17,null))['catch'](handleError(_0x274e17,null));};exports['update']=function(_0x563439,_0x547cd3){if(_0x563439[_0xa561('0x54')]['id']){delete _0x563439[_0xa561('0x54')]['id'];}return db[_0xa561('0x3d')][_0xa561('0x55')]({'where':{'id':_0x563439[_0xa561('0x56')]['id']}})[_0xa561('0x21')](handleEntityNotFound(_0x547cd3,null))[_0xa561('0x21')](saveUpdates(_0x563439[_0xa561('0x54')],null))[_0xa561('0x21')](respondWithResult(_0x547cd3,null))[_0xa561('0x2a')](handleError(_0x547cd3,null));};exports[_0xa561('0x38')]=function(_0x278a4c,_0x2a4a16){return db[_0xa561('0x3d')][_0xa561('0x55')]({'where':{'id':_0x278a4c[_0xa561('0x56')]['id']}})[_0xa561('0x21')](handleEntityNotFound(_0x2a4a16,null))[_0xa561('0x21')](removeEntity(_0x2a4a16,null))[_0xa561('0x2a')](handleError(_0x2a4a16,null));};exports[_0xa561('0x57')]=function(_0x285f93,_0x3ec0b7){return db[_0xa561('0x3d')][_0xa561('0x57')]()[_0xa561('0x21')](respondWithResult(_0x3ec0b7,null))['catch'](handleError(_0x3ec0b7,null));};var interaction_log=require('../../config/logger')(_0xa561('0x58'));exports['accept']=function(_0x3a846c,_0x37a269,_0x4ae3a7){var _0x49d241={'agent':{},'channel':_0xa561('0x59')};if(_0x3a846c[_0xa561('0x54')]['id']){delete _0x3a846c['body']['id'];}_0x3a846c[_0xa561('0x54')][_0xa561('0x5a')]=!![];_0x3a846c[_0xa561('0x54')]['readAt']=moment()['format'](_0xa561('0x5b'));_0x3a846c[_0xa561('0x54')][_0xa561('0x5c')]=_0x3a846c[_0xa561('0x54')][_0xa561('0x5c')]||_0x3a846c[_0xa561('0x5d')]['id'];_0x49d241[_0xa561('0x5e')]['id']=_0x3a846c[_0xa561('0x54')][_0xa561('0x5c')];return db[_0xa561('0x3d')][_0xa561('0x55')]({'where':{'id':_0x3a846c[_0xa561('0x56')]['id'],'UserId':null}})[_0xa561('0x21')](handleEntityNotFound(_0x37a269,null))[_0xa561('0x21')](saveUpdates(_0x3a846c[_0xa561('0x54')],null))[_0xa561('0x21')](function(_0x2c4f56){if(_0x2c4f56){_0x49d241[_0xa561('0x28')]=_0x2c4f56['get']({'plain':!![]});return db['FaxInteraction'][_0xa561('0x55')]({'where':{'id':_0x2c4f56['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x37a269,null))[_0xa561('0x21')](function(_0x33e84d){if(_0x33e84d){return _0x33e84d[_0xa561('0x37')]({'UserId':_0x3a846c[_0xa561('0x54')]['UserId'],'read1stAt':_[_0xa561('0x5f')](_0x33e84d[_0xa561('0x60')])?moment()['format'](_0xa561('0x5b')):undefined});}return null;})[_0xa561('0x21')](function(_0x50a1b3){if(_0x50a1b3){_0x49d241[_0xa561('0x61')]=_0x50a1b3[_0xa561('0x62')]({'plain':!![]});interaction_log[_0xa561('0x22')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3a846c[_0xa561('0x5d')]['id'],_0x3a846c[_0xa561('0x5d')][_0xa561('0x3a')],_0x3a846c[_0xa561('0x5d')][_0xa561('0x63')],_0x49d241[_0xa561('0x61')]['id'],_0x3a846c[_0xa561('0x54')]?JSON['stringify'](_0x3a846c['body']):_0xa561('0x64'));return respondWithRpcPromise(_0xa561('0x65'),_0xa561('0x66'),_0x49d241);}return null;})['then'](function(_0x57ff12){var _0xfebe6=_0xa561('0x67')+_0x57ff12[_0xa561('0x28')][_0xa561('0x68')];return db['sequelize'][_0xa561('0x41')](_0xfebe6,{'type':db[_0xa561('0x69')]['QueryTypes'][_0xa561('0x6a')],'raw':!![]})[_0xa561('0x21')](function(_0x315010){return _0x315010;});})[_0xa561('0x21')](function(_0x39eddd){if(_0x39eddd){_0x49d241[_0xa561('0x28')][_0xa561('0x6b')]=_0x39eddd[0x0];if(!_0x3a846c[_0xa561('0x54')][_0xa561('0x5c')])return;return db[_0xa561('0x6c')][_0xa561('0x55')]({'where':{'id':_0x3a846c[_0xa561('0x54')]['UserId'],'role':_0xa561('0x5e')},'attributes':['id',_0xa561('0x3a'),_0xa561('0x6d'),_0xa561('0x6e'),'internal'],'raw':!![]});}return null;})['then'](function(_0x17d701){if(!_0x17d701)return null;_0x49d241[_0xa561('0x28')]['agent']=_0x17d701;return _0x49d241;})['then'](function(_0x497071){if(_0x497071){if(_0x3a846c['body']['manual']){_0x49d241[_0xa561('0x28')][_0xa561('0x6f')]=util[_0xa561('0x70')](_0xa561('0x71'),_0x3a846c[_0xa561('0x5d')][_0xa561('0x3a')]);_0x49d241[_0xa561('0x28')][_0xa561('0x72')]=_0x49d241[_0xa561('0x72')];_0x49d241[_0xa561('0x28')][_0xa561('0x73')]=_0x49d241[_0xa561('0x72')];_0x49d241['message'][_0xa561('0x74')]=_0xa561('0x75');return respondWithRpcPromise(_0xa561('0x76'),_0xa561('0x76'),{'event':'acceptmessage','message':_0x49d241[_0xa561('0x28')]},client9002)[_0xa561('0x21')](function(){return _0x49d241;});}return _0x49d241;}return null;})[_0xa561('0x21')](respondWithResult(_0x37a269,null))[_0xa561('0x2a')](handleError(_0x37a269,null));};var interaction_log=require(_0xa561('0x15'))(_0xa561('0x58'));exports[_0xa561('0x35')]=function(_0x4f5bae,_0x5e06f8,_0x2f1340){var _0x92d85d={'agent':{},'channel':_0xa561('0x59')};if(_0x4f5bae[_0xa561('0x54')]['id']){delete _0x4f5bae[_0xa561('0x54')]['id'];}_0x4f5bae['body'][_0xa561('0x5c')]=_0x4f5bae[_0xa561('0x54')][_0xa561('0x5c')]||_0x4f5bae[_0xa561('0x5d')]['id'];_0x92d85d[_0xa561('0x5e')]['id']=_0x4f5bae[_0xa561('0x54')][_0xa561('0x5c')];return db['FaxMessage'][_0xa561('0x55')]({'where':{'id':_0x4f5bae[_0xa561('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5e06f8,null))[_0xa561('0x21')](function(_0x673847){if(_0x673847){_0x92d85d[_0xa561('0x28')]=_0x673847['get']({'plain':!![]});return db[_0xa561('0x77')]['find']({'where':{'id':_0x673847[_0xa561('0x78')]}});}return null;})['then'](handleEntityNotFound(_0x5e06f8,null))[_0xa561('0x21')](function(_0x165d21){if(_0x165d21){_0x92d85d[_0xa561('0x61')]=_0x165d21[_0xa561('0x62')]({'plain':!![]});interaction_log['info'](_0xa561('0x79'),_0x4f5bae[_0xa561('0x5d')]['id'],_0x4f5bae['user']['name'],_0x4f5bae['user']['role'],_0x92d85d[_0xa561('0x61')]['id'],_0x4f5bae['body']?JSON[_0xa561('0x26')](_0x4f5bae[_0xa561('0x54')]):_0xa561('0x64'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x92d85d);}return null;})[_0xa561('0x21')](function(_0xc7a648){var _0x3840cd=_0xa561('0x67')+_0xc7a648[_0xa561('0x28')][_0xa561('0x68')];return db[_0xa561('0x7a')][_0xa561('0x41')](_0x3840cd,{'type':db['Sequelize'][_0xa561('0x7b')][_0xa561('0x6a')],'raw':!![]})[_0xa561('0x21')](function(_0x2978df){return _0x2978df;});})[_0xa561('0x21')](function(_0x251230){if(_0x251230){_0x92d85d['message'][_0xa561('0x6b')]=_0x251230[0x0];if(!_0x4f5bae[_0xa561('0x54')][_0xa561('0x5c')])return;return db[_0xa561('0x6c')][_0xa561('0x55')]({'where':{'id':_0x4f5bae[_0xa561('0x54')][_0xa561('0x5c')],'role':_0xa561('0x5e')},'attributes':['id','name',_0xa561('0x6d'),_0xa561('0x6e'),'internal'],'raw':!![]});}return null;})['then'](function(_0x5995ac){if(!_0x5995ac)return null;_0x92d85d[_0xa561('0x28')]['agent']=_0x5995ac;return _0x92d85d;})[_0xa561('0x21')](function(_0x4e41e3){if(_0x4e41e3){_0x4e41e3[_0xa561('0x28')]['interface']=util['format'](_0xa561('0x71'),_0x4f5bae[_0xa561('0x5d')][_0xa561('0x3a')]);_0x4e41e3['message'][_0xa561('0x72')]=_0x92d85d[_0xa561('0x72')];_0x4e41e3['message'][_0xa561('0x73')]=_0x92d85d[_0xa561('0x72')];_0x4e41e3[_0xa561('0x28')][_0xa561('0x74')]='reject';respondWithRpcPromise('EventManager',_0xa561('0x76'),{'event':_0xa561('0x7c'),'message':_0x4e41e3['message']},client9002);return _0x92d85d;}return null;})[_0xa561('0x21')](respondWithResult(_0x5e06f8,null))[_0xa561('0x2a')](handleError(_0x5e06f8,null));};exports[_0xa561('0x7d')]=function(_0x149415,_0x1c5011){var _0x3a15ec;return db['FaxMessage']['create'](_0x149415[_0xa561('0x54')],{})[_0xa561('0x21')](function(_0x32f3ff){_0x3a15ec=_0x32f3ff;return db[_0xa561('0x7e')][_0xa561('0x7f')]({'where':{'id':_0x3a15ec[_0xa561('0x68')]}});})[_0xa561('0x21')](function(_0x2cbecd){if(_[_0xa561('0x5f')](_0x2cbecd)){return;}else{_0x3a15ec['fax']=_0x2cbecd[_0xa561('0x59')];return db[_0xa561('0x80')]['findOne']({'where':{'id':_0x3a15ec['AttachmentId']}});}})[_0xa561('0x21')](function(_0x5a0758){return respondWithRpcPromise('SendFax',_0xa561('0x81'),{'FaxAccountId':_[_0xa561('0x5f')](_0x149415[_0xa561('0x54')])?undefined:_0x149415[_0xa561('0x54')][_0xa561('0x82')],'path':_[_0xa561('0x5f')](_0x5a0758)?undefined:util[_0xa561('0x70')](_0xa561('0x83'),_0x5a0758[_0xa561('0x84')]),'fax':_['isNil'](_0x3a15ec['fax'])?undefined:_0x3a15ec['fax'],'AttachmentId':_0x3a15ec[_0xa561('0x85')]},client9002);})[_0xa561('0x21')](respondWithResult(_0x1c5011,0xc9))[_0xa561('0x2a')](handleError(_0x1c5011,null));};exports[_0xa561('0x86')]=function(_0x103217,_0xe54d98){var _0x4cf389=path[_0xa561('0x87')](config[_0xa561('0x88')],_0xa561('0x89'),_0xa561('0x8a'),_0xa561('0x8b'));return db[_0xa561('0x3d')][_0xa561('0x55')]({'where':{'id':_0x103217[_0xa561('0x56')]['id']},'include':[{'model':db['Attachment'],'as':_0xa561('0x80')}]})[_0xa561('0x21')](handleEntityNotFound(_0xe54d98,null))['then'](function(_0x9f2234){if(_0x9f2234){return _0xe54d98[_0xa561('0x86')](path['join'](_0x4cf389,_0x9f2234['Attachment'][_0xa561('0x84')]));}})[_0xa561('0x2a')](handleError(_0xe54d98,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 1fb9105..2a067f9 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 _0xd959=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','FaxMessage','save','update'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xd959,0x94));var _0x9d95=function(_0xff4d6,_0x245bf5){_0xff4d6=_0xff4d6-0x0;var _0x81c4a=_0xd959[_0xff4d6];return _0x81c4a;};'use strict';var EventEmitter=require(_0x9d95('0x0'));var FaxMessage=require(_0x9d95('0x1'))['db'][_0x9d95('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9d95('0x3'),'afterUpdate':_0x9d95('0x4'),'afterDestroy':_0x9d95('0x5')};function emitEvent(_0x261f81){return function(_0x2d997b,_0x5567d7,_0x277e44){FaxMessageEvents[_0x9d95('0x6')](_0x261f81+':'+_0x2d997b['id'],_0x2d997b);FaxMessageEvents[_0x9d95('0x6')](_0x261f81,_0x2d997b);_0x277e44(null);};}for(var e in events){if(events[_0x9d95('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x9d95('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x4819=['save','update','remove','emit','exports','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0xdad237,_0x361a1d){var _0x15c575=function(_0x8db2f6){while(--_0x8db2f6){_0xdad237['push'](_0xdad237['shift']());}};_0x15c575(++_0x361a1d);}(_0x4819,0xcd));var _0x9481=function(_0x347884,_0xd8ef37){_0x347884=_0x347884-0x0;var _0x2cd3fa=_0x4819[_0x347884];return _0x2cd3fa;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x9481('0x0'))['db'][_0x9481('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x9481('0x2')](0x0);var events={'afterCreate':_0x9481('0x3'),'afterUpdate':_0x9481('0x4'),'afterDestroy':_0x9481('0x5')};function emitEvent(_0x40a703){return function(_0x14dc10,_0xc39edf,_0x16c617){FaxMessageEvents['emit'](_0x40a703+':'+_0x14dc10['id'],_0x14dc10);FaxMessageEvents[_0x9481('0x6')](_0x40a703,_0x14dc10);_0x16c617(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x9481('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 36984b5..b834852 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 _0x1124=['path','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fti_fax_messages','models','get','toLowerCase','direction','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise'];(function(_0x45c198,_0xf37f1e){var _0x42fc8d=function(_0x177cec){while(--_0x177cec){_0x45c198['push'](_0x45c198['shift']());}};_0x42fc8d(++_0xf37f1e);}(_0x1124,0x87));var _0x4112=function(_0x55dfc7,_0x55a826){_0x55dfc7=_0x55dfc7-0x0;var _0x3c52b1=_0x1124[_0x55dfc7];return _0x3c52b1;};'use strict';var _=require(_0x4112('0x0'));var util=require(_0x4112('0x1'));var logger=require(_0x4112('0x2'))(_0x4112('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4112('0x4'));var fs=require('fs');var path=require(_0x4112('0x5'));var rimraf=require(_0x4112('0x6'));var config=require(_0x4112('0x7'));var attributes=require(_0x4112('0x8'));module[_0x4112('0x9')]=function(_0x496e7f,_0x5817be){return _0x496e7f['define'](_0x4112('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x4112('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x25b54b,_0x138a48,_0x7821ad){var _0x1c4dfa=_0x496e7f[_0x4112('0xc')];var _0x1dd761=_0x25b54b[_0x4112('0xd')]({'plain':!![]});if(_0x1dd761['direction'][_0x4112('0xe')]()==='in'||_0x1dd761[_0x4112('0xf')][_0x4112('0xe')]()===_0x4112('0x10')&&!_0x1dd761[_0x4112('0x11')]&&!_[_0x4112('0x12')](_0x1dd761[_0x4112('0x13')])){_0x1c4dfa[_0x4112('0x14')][_0x4112('0x15')]({'where':{'id':_0x1dd761[_0x4112('0x16')]}})[_0x4112('0x17')](function(_0x40fb2d){if(_0x40fb2d){_0x40fb2d[_0x4112('0x18')]({'lastMsgAt':_0x1dd761['createdAt'],'lastMsgDirection':_0x1dd761[_0x4112('0xf')]['toLowerCase']()});}})[_0x4112('0x19')](function(_0x541736){console['error'](_0x541736);});}_0x7821ad();}},'charset':_0x4112('0x1a'),'collate':_0x4112('0x1b')});}; \ No newline at end of file +var _0xd9fd=['get','direction','toLowerCase','out','secret','isNil','FaxInteraction','findOne','then','createdAt','catch','error','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fti_fax_messages','FULLTEXT','models'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xd9fd,0x12a));var _0xdd9f=function(_0x54fcd4,_0x552e7b){_0x54fcd4=_0x54fcd4-0x0;var _0x24089d=_0xd9fd[_0x54fcd4];return _0x24089d;};'use strict';var _=require('lodash');var util=require(_0xdd9f('0x0'));var logger=require(_0xdd9f('0x1'))(_0xdd9f('0x2'));var moment=require('moment');var BPromise=require(_0xdd9f('0x3'));var rp=require(_0xdd9f('0x4'));var fs=require('fs');var path=require(_0xdd9f('0x5'));var rimraf=require(_0xdd9f('0x6'));var config=require('../../config/environment');var attributes=require(_0xdd9f('0x7'));module[_0xdd9f('0x8')]=function(_0x6f62dd,_0x3afc4c){return _0x6f62dd[_0xdd9f('0x9')](_0xdd9f('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xdd9f('0xb'),'fields':['body'],'type':_0xdd9f('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x94ea77,_0x349b7e,_0x64f0a){var _0x309b57=_0x6f62dd[_0xdd9f('0xd')];var _0x391da3=_0x94ea77[_0xdd9f('0xe')]({'plain':!![]});if(_0x391da3[_0xdd9f('0xf')][_0xdd9f('0x10')]()==='in'||_0x391da3[_0xdd9f('0xf')]['toLowerCase']()===_0xdd9f('0x11')&&!_0x391da3[_0xdd9f('0x12')]&&!_[_0xdd9f('0x13')](_0x391da3['UserId'])){_0x309b57[_0xdd9f('0x14')][_0xdd9f('0x15')]({'where':{'id':_0x391da3['FaxInteractionId']}})[_0xdd9f('0x16')](function(_0x6b416f){if(_0x6b416f){_0x6b416f['update']({'lastMsgAt':_0x391da3[_0xdd9f('0x17')],'lastMsgDirection':_0x391da3[_0xdd9f('0xf')]['toLowerCase']()});}})[_0xdd9f('0x18')](function(_0x178e5d){console[_0xdd9f('0x19')](_0x178e5d);});}_0x64f0a();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 2dd66b2..f8547e8 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(_0x295811,_0x2825f4){var _0x147146=function(_0x939636){while(--_0x939636){_0x295811['push'](_0x295811['shift']());}};_0x147146(++_0x2825f4);}(_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 _0x55e0=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./faxMessage.socket','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','then','UpdateFaxMessage','update','where','attributes','limit','lodash','util'];(function(_0x3f02be,_0x9913a7){var _0x32f3e8=function(_0x2618e6){while(--_0x2618e6){_0x3f02be['push'](_0x3f02be['shift']());}};_0x32f3e8(++_0x9913a7);}(_0x55e0,0xdc));var _0x055e=function(_0x43d9f8,_0x4f4e66){_0x43d9f8=_0x43d9f8-0x0;var _0x10d74f=_0x55e0[_0x43d9f8];return _0x10d74f;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x055e('0xa')]=_['defaults'](config[_0x055e('0xa')],{'host':_0x055e('0xb'),'port':0x18eb});var socket=require(_0x055e('0xc'))(new Redis(config[_0x055e('0xa')]));require(_0x055e('0xd'))['register'](socket);function respondWithRpcPromise(_0x40779c,_0xd67814,_0xb816c){return new BPromise(function(_0xa0d384,_0x238068){return client['request'](_0x40779c,_0xb816c)['then'](function(_0x187cce){logger['info'](_0x055e('0xe'),_0xd67814,_0x055e('0xf'));logger[_0x055e('0x10')](_0x055e('0x11'),_0xd67814,_0x055e('0xf'),JSON[_0x055e('0x12')](_0x187cce));if(_0x187cce[_0x055e('0x13')]){if(_0x187cce['error'][_0x055e('0x14')]===0x1f4){logger[_0x055e('0x13')](_0x055e('0xe'),_0xd67814,_0x187cce[_0x055e('0x13')][_0x055e('0x15')]);return _0x238068(_0x187cce['error'][_0x055e('0x15')]);}logger[_0x055e('0x13')](_0x055e('0xe'),_0xd67814,_0x187cce['error'][_0x055e('0x15')]);return _0xa0d384(_0x187cce[_0x055e('0x13')][_0x055e('0x15')]);}else{logger[_0x055e('0x16')](_0x055e('0xe'),_0xd67814,'request\x20sent');_0xa0d384(_0x187cce[_0x055e('0x17')][_0x055e('0x15')]);}})[_0x055e('0x18')](function(_0x2ed6fb){logger['error'](_0x055e('0xe'),_0xd67814,_0x2ed6fb);_0x238068(_0x2ed6fb);});});}exports[_0x055e('0x19')]=function(_0x58e44a){var _0xe2b7b5=this;return new Promise(function(_0x4412f9,_0x10258f){return db[_0x055e('0x1a')][_0x055e('0x1b')](_0x58e44a[_0x055e('0x1c')],{'raw':_0x58e44a['options']?_0x58e44a[_0x055e('0x1d')][_0x055e('0x1e')]===undefined?!![]:![]:!![]})[_0x055e('0x1f')](function(_0x5930ff){logger[_0x055e('0x16')](_0x055e('0x19'),_0x58e44a);logger[_0x055e('0x10')](_0x055e('0x19'),_0x58e44a,JSON['stringify'](_0x5930ff));_0x4412f9(_0x5930ff);})[_0x055e('0x18')](function(_0x56c372){logger[_0x055e('0x13')](_0x055e('0x19'),_0x56c372[_0x055e('0x15')],_0x58e44a);_0x10258f(_0xe2b7b5[_0x055e('0x13')](0x1f4,_0x56c372[_0x055e('0x15')]));});});};exports[_0x055e('0x20')]=function(_0x58caf9){var _0x2fb49b=this;return new Promise(function(_0x1f90a9,_0x2a82f8){return db['FaxMessage'][_0x055e('0x21')](_0x58caf9[_0x055e('0x1c')],{'raw':_0x58caf9[_0x055e('0x1d')]?_0x58caf9[_0x055e('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58caf9[_0x055e('0x1d')]?_0x58caf9['options'][_0x055e('0x22')]||null:null,'attributes':_0x58caf9[_0x055e('0x1d')]?_0x58caf9[_0x055e('0x1d')][_0x055e('0x23')]||null:null,'limit':_0x58caf9[_0x055e('0x1d')]?_0x58caf9['options'][_0x055e('0x24')]||null:null})[_0x055e('0x1f')](function(_0x293062){logger[_0x055e('0x16')](_0x055e('0x20'),_0x58caf9);logger[_0x055e('0x10')](_0x055e('0x20'),_0x58caf9,JSON[_0x055e('0x12')](_0x293062));_0x1f90a9(_0x293062);})['catch'](function(_0x26d1c2){logger[_0x055e('0x13')]('UpdateFaxMessage',_0x26d1c2[_0x055e('0x15')],_0x58caf9);_0x2a82f8(_0x2fb49b[_0x055e('0x13')](0x1f4,_0x26d1c2[_0x055e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 655c7e1..5b587e2 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 _0xdef5=['faxMessage:','save','remove','update'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xdef5,0x7d));var _0x5def=function(_0x31f972,_0x164199){_0x31f972=_0x31f972-0x0;var _0x144c68=_0xdef5[_0x31f972];return _0x144c68;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x5def('0x0'),_0x5def('0x1'),_0x5def('0x2')];function createListener(_0x726667,_0x50ad2f){return function(_0x32245f){_0x50ad2f['emit'](_0x726667,_0x32245f);};}function removeListener(_0xdac701,_0x30ab5c){return function(){FaxMessageEvents['removeListener'](_0xdac701,_0x30ab5c);};}exports['register']=function(_0x25b8b1){for(var _0x3a9c57=0x0,_0x5aa4f5=events['length'];_0x3a9c57<_0x5aa4f5;_0x3a9c57++){var _0x16d696=events[_0x3a9c57];var _0x200967=createListener(_0x5def('0x3')+_0x16d696,_0x25b8b1);FaxMessageEvents['on'](_0x16d696,_0x200967);}}; \ No newline at end of file +var _0x28e5=['faxMessage:','./faxMessage.events','save','remove','update','emit','register','length'];(function(_0x973128,_0x5ef1d7){var _0x1fc546=function(_0x287426){while(--_0x287426){_0x973128['push'](_0x973128['shift']());}};_0x1fc546(++_0x5ef1d7);}(_0x28e5,0x1e9));var _0x528e=function(_0x558fea,_0x4feb68){_0x558fea=_0x558fea-0x0;var _0x4ffff9=_0x28e5[_0x558fea];return _0x4ffff9;};'use strict';var FaxMessageEvents=require(_0x528e('0x0'));var events=[_0x528e('0x1'),_0x528e('0x2'),_0x528e('0x3')];function createListener(_0x595486,_0x3f5260){return function(_0x5c1f35){_0x3f5260[_0x528e('0x4')](_0x595486,_0x5c1f35);};}function removeListener(_0x4b2feb,_0x17a9b8){return function(){FaxMessageEvents['removeListener'](_0x4b2feb,_0x17a9b8);};}exports[_0x528e('0x5')]=function(_0x2c2d9b){for(var _0x30bdbc=0x0,_0x3894db=events[_0x528e('0x6')];_0x30bdbc<_0x3894db;_0x30bdbc++){var _0xe6c1c8=events[_0x30bdbc];var _0x231ebb=createListener(_0x528e('0x7')+_0xe6c1c8,_0x2c2d9b);FaxMessageEvents['on'](_0xe6c1c8,_0x231ebb);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index f9b6e7a..ef41805 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 _0x39cb=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','/describe','isAuthenticated','/:id','show','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','express'];(function(_0x409deb,_0x2b731){var _0x15a4f7=function(_0x556510){while(--_0x556510){_0x409deb['push'](_0x409deb['shift']());}};_0x15a4f7(++_0x2b731);}(_0x39cb,0x1bd));var _0xb39c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x39cb[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require(_0xb39c('0x0'));var path=require(_0xb39c('0x1'));var timeout=require('connect-timeout');var express=require(_0xb39c('0x2'));var router=express[_0xb39c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb39c('0x4'));var interaction=require(_0xb39c('0x5'));var config=require(_0xb39c('0x6'));var controller=require(_0xb39c('0x7'));router[_0xb39c('0x8')]('/',auth['isAuthenticated'](),controller[_0xb39c('0x9')]);router[_0xb39c('0x8')](_0xb39c('0xa'),auth[_0xb39c('0xb')](),controller['describe']);router['get'](_0xb39c('0xc'),auth[_0xb39c('0xb')](),controller[_0xb39c('0xd')]);router[_0xb39c('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xb39c('0xe')]('/',auth[_0xb39c('0xb')](),interaction[_0xb39c('0xf')](_0xb39c('0x10'),_0xb39c('0x11')),controller[_0xb39c('0x12')]);router[_0xb39c('0x13')](_0xb39c('0xc'),auth['isAuthenticated'](),controller[_0xb39c('0x14')]);router[_0xb39c('0x13')](_0xb39c('0x15'),auth['isAuthenticated'](),controller[_0xb39c('0x16')]);router[_0xb39c('0x13')](_0xb39c('0x17'),auth[_0xb39c('0xb')](),controller[_0xb39c('0x18')]);router[_0xb39c('0x19')](_0xb39c('0xc'),auth['isAuthenticated'](),controller[_0xb39c('0x1a')]);module[_0xb39c('0x1b')]=router; \ No newline at end of file +var _0xee5b=['update','/:id/accept','accept','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','/:id'];(function(_0x3069f9,_0x25c8ad){var _0x324e73=function(_0x598a83){while(--_0x598a83){_0x3069f9['push'](_0x3069f9['shift']());}};_0x324e73(++_0x25c8ad);}(_0xee5b,0x1f4));var _0xbee5=function(_0x4bcaf0,_0x1c60bb){_0x4bcaf0=_0x4bcaf0-0x0;var _0x3e5549=_0xee5b[_0x4bcaf0];return _0x3e5549;};'use strict';var multer=require(_0xbee5('0x0'));var util=require('util');var path=require(_0xbee5('0x1'));var timeout=require(_0xbee5('0x2'));var express=require('express');var router=express[_0xbee5('0x3')]();var fs_extra=require(_0xbee5('0x4'));var auth=require(_0xbee5('0x5'));var interaction=require(_0xbee5('0x6'));var config=require('../../config/environment');var controller=require('./faxMessage.controller');router[_0xbee5('0x7')]('/',auth[_0xbee5('0x8')](),controller[_0xbee5('0x9')]);router[_0xbee5('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xbee5('0x8')](),controller[_0xbee5('0xa')]);router[_0xbee5('0x7')](_0xbee5('0xb'),auth['isAuthenticated'](),controller[_0xbee5('0xc')]);router[_0xbee5('0xd')]('/',auth[_0xbee5('0x8')](),interaction[_0xbee5('0xe')](_0xbee5('0xf'),_0xbee5('0x10')),controller[_0xbee5('0x11')]);router[_0xbee5('0x12')](_0xbee5('0x13'),auth['isAuthenticated'](),controller[_0xbee5('0x14')]);router['put'](_0xbee5('0x15'),auth[_0xbee5('0x8')](),controller[_0xbee5('0x16')]);router['put']('/:id/reject',auth[_0xbee5('0x8')](),controller['reject']);router[_0xbee5('0x17')]('/:id',auth[_0xbee5('0x8')](),controller[_0xbee5('0x18')]);module[_0xbee5('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 1af5dc2..6b3ada6 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 _0x9f8d=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x3e7e96,_0x5683ca){var _0x13f6f0=function(_0x320767){while(--_0x320767){_0x3e7e96['push'](_0x3e7e96['shift']());}};_0x13f6f0(++_0x5683ca);}(_0x9f8d,0xb0));var _0xd9f8=function(_0x22824b,_0x5b9c2c){_0x22824b=_0x22824b-0x0;var _0x14af01=_0x9f8d[_0x22824b];return _0x14af01;};'use strict';var Sequelize=require(_0xd9f8('0x0'));module[_0xd9f8('0x1')]={'name':{'type':Sequelize[_0xd9f8('0x2')],'unique':_0xd9f8('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd9f8('0x2')]},'timeout':{'type':Sequelize[_0xd9f8('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd9f8('0x5')](_0xd9f8('0x6'),_0xd9f8('0x7'),_0xd9f8('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xd9f8('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe3cc=['ENUM','rrmemory','beepall','sequelize','exports','STRING','name','INTEGER'];(function(_0x3616bb,_0x86fe00){var _0x1c0994=function(_0x46a1d4){while(--_0x46a1d4){_0x3616bb['push'](_0x3616bb['shift']());}};_0x1c0994(++_0x86fe00);}(_0xe3cc,0x8b));var _0xce3c=function(_0x52011f,_0x37e4aa){_0x52011f=_0x52011f-0x0;var _0x115683=_0xe3cc[_0x52011f];return _0x115683;};'use strict';var Sequelize=require(_0xce3c('0x0'));module[_0xce3c('0x1')]={'name':{'type':Sequelize[_0xce3c('0x2')],'unique':_0xce3c('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xce3c('0x2')]},'timeout':{'type':Sequelize[_0xce3c('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xce3c('0x5')](_0xce3c('0x6'),_0xce3c('0x7'),'roundrobin'),'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 e8c1ce7..a54ee1a 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 _0x4f05=['zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./faxQueue.socket','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','save','then','get','FaxQueues','UserProfileResource','destroy','error','stack','name','send','index','map','FaxQueue','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','options','where','includeAll','include','rows','catch','show','params','length','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','findAll','User','UserId','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','findOrCreate','forEach','userFaxQueue:save','removeTeams','select','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','includes','all','union','value','transaction','isEmpty','emit','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf'];(function(_0x43b22f,_0x2cdb71){var _0x14b24e=function(_0x468925){while(--_0x468925){_0x43b22f['push'](_0x43b22f['shift']());}};_0x14b24e(++_0x2cdb71);}(_0x4f05,0x114));var _0x54f0=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x4f05[_0x59c301];return _0x3866b9;};'use strict';var emlformat=require(_0x54f0('0x0'));var rimraf=require(_0x54f0('0x1'));var zipdir=require(_0x54f0('0x2'));var jsonpatch=require(_0x54f0('0x3'));var rp=require('request-promise');var moment=require(_0x54f0('0x4'));var BPromise=require(_0x54f0('0x5'));var Mustache=require('mustache');var util=require(_0x54f0('0x6'));var path=require(_0x54f0('0x7'));var sox=require(_0x54f0('0x8'));var csv=require(_0x54f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x54f0('0xa'));var squel=require(_0x54f0('0xb'));var crypto=require(_0x54f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x54f0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x54f0('0xe'));var Papa=require(_0x54f0('0xf'));var Redis=require('ioredis');var authService=require(_0x54f0('0x10'));var qs=require(_0x54f0('0x11'));var as=require(_0x54f0('0x12'));var hardwareService=require(_0x54f0('0x13'));var logger=require(_0x54f0('0x14'))(_0x54f0('0x15'));var utils=require(_0x54f0('0x16'));var config=require(_0x54f0('0x17'));var licenseUtil=require(_0x54f0('0x18'));var db=require(_0x54f0('0x19'))['db'];config['redis']=_[_0x54f0('0x1a')](config[_0x54f0('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x54f0('0x1c'))(new Redis(config[_0x54f0('0x1b')]));require(_0x54f0('0x1d'))['register'](socket);function respondWithStatusCode(_0xec4873,_0xcb633){_0xcb633=_0xcb633||0xcc;return function(_0x30a452){if(_0x30a452){return _0xec4873[_0x54f0('0x1e')](_0xcb633);}return _0xec4873['status'](_0xcb633)[_0x54f0('0x1f')]();};}function respondWithResult(_0x219efc,_0x220011){_0x220011=_0x220011||0xc8;return function(_0x2ed014){if(_0x2ed014){return _0x219efc[_0x54f0('0x20')](_0x220011)[_0x54f0('0x21')](_0x2ed014);}};}function respondWithFilteredResult(_0x324ea1,_0x479688){return function(_0x1650aa){if(_0x1650aa){var _0x39aac3=typeof _0x479688[_0x54f0('0x22')]===_0x54f0('0x23')&&typeof _0x479688['limit']===_0x54f0('0x23');var _0x31cda2=_0x1650aa[_0x54f0('0x24')];var _0x416322=_0x39aac3?0x0:_0x479688['offset'];var _0x370def=_0x39aac3?_0x1650aa[_0x54f0('0x24')]:_0x479688[_0x54f0('0x22')]+_0x479688[_0x54f0('0x25')];var _0x442059;if(_0x370def>=_0x31cda2){_0x370def=_0x31cda2;_0x442059=0xc8;}else{_0x442059=0xce;}_0x324ea1[_0x54f0('0x20')](_0x442059);return _0x324ea1['set'](_0x54f0('0x26'),_0x416322+'-'+_0x370def+'/'+_0x31cda2)['json'](_0x1650aa);}return null;};}function patchUpdates(_0x276c8b){return function(_0x3667a4){try{jsonpatch['apply'](_0x3667a4,_0x276c8b,!![]);}catch(_0x18a8b7){return BPromise['reject'](_0x18a8b7);}return _0x3667a4[_0x54f0('0x27')]();};}function saveUpdates(_0x4ca46d,_0xce0f6f){return function(_0x4ed46b){if(_0x4ed46b){return _0x4ed46b['update'](_0x4ca46d)[_0x54f0('0x28')](function(_0x491804){return _0x491804;});}return null;};}function removeEntity(_0x4c088b,_0x21280f){return function(_0x2cd9f6){if(_0x2cd9f6){return _0x2cd9f6['destroy']()[_0x54f0('0x28')](function(){var _0x26b758=_0x2cd9f6[_0x54f0('0x29')]({'plain':!![]});var _0x39eb78=_0x54f0('0x2a');return db[_0x54f0('0x2b')][_0x54f0('0x2c')]({'where':{'type':_0x39eb78,'resourceId':_0x26b758['id']}})[_0x54f0('0x28')](function(){return _0x2cd9f6;});})['then'](function(){_0x4c088b[_0x54f0('0x20')](0xcc)[_0x54f0('0x1f')]();});}};}function handleEntityNotFound(_0xbf7e71,_0x2af509){return function(_0x106850){if(!_0x106850){_0xbf7e71['sendStatus'](0x194);}return _0x106850;};}function handleError(_0x42dae9,_0x3c5cf7){_0x3c5cf7=_0x3c5cf7||0x1f4;return function(_0x369f5){logger[_0x54f0('0x2d')](_0x369f5[_0x54f0('0x2e')]);if(_0x369f5[_0x54f0('0x2f')]){delete _0x369f5[_0x54f0('0x2f')];}_0x42dae9['status'](_0x3c5cf7)[_0x54f0('0x30')](_0x369f5);};}exports[_0x54f0('0x31')]=function(_0x27637e,_0x3438c1){var _0x7ff0b2={},_0x359274={},_0x3e3cde={'count':0x0,'rows':[]};var _0xc8da26=_[_0x54f0('0x32')](db[_0x54f0('0x33')][_0x54f0('0x34')],function(_0x3de23b){return{'name':_0x3de23b['fieldName'],'type':_0x3de23b[_0x54f0('0x35')][_0x54f0('0x36')]};});_0x359274[_0x54f0('0x37')]=_['map'](_0xc8da26,_0x54f0('0x2f'));_0x359274[_0x54f0('0x38')]=_[_0x54f0('0x39')](_0x27637e['query']);_0x359274[_0x54f0('0x3a')]=_[_0x54f0('0x3b')](_0x359274[_0x54f0('0x37')],_0x359274[_0x54f0('0x38')]);_0x7ff0b2[_0x54f0('0x3c')]=_['intersection'](_0x359274[_0x54f0('0x37')],qs[_0x54f0('0x3d')](_0x27637e[_0x54f0('0x38')][_0x54f0('0x3d')]));_0x7ff0b2[_0x54f0('0x3c')]=_0x7ff0b2[_0x54f0('0x3c')]['length']?_0x7ff0b2[_0x54f0('0x3c')]:_0x359274['model'];if(!_0x27637e[_0x54f0('0x38')][_0x54f0('0x3e')](_0x54f0('0x3f'))){_0x7ff0b2[_0x54f0('0x25')]=qs[_0x54f0('0x25')](_0x27637e[_0x54f0('0x38')][_0x54f0('0x25')]);_0x7ff0b2[_0x54f0('0x22')]=qs[_0x54f0('0x22')](_0x27637e[_0x54f0('0x38')]['offset']);}_0x7ff0b2[_0x54f0('0x40')]=qs[_0x54f0('0x41')](_0x27637e['query'][_0x54f0('0x41')]);_0x7ff0b2['where']=qs[_0x54f0('0x3a')](_[_0x54f0('0x42')](_0x27637e[_0x54f0('0x38')],_0x359274[_0x54f0('0x3a')]),_0xc8da26);if(_0x27637e[_0x54f0('0x38')][_0x54f0('0x43')]){_0x7ff0b2['where']=_[_0x54f0('0x44')](_0x7ff0b2['where'],{'$or':_['map'](_0xc8da26,function(_0x47730f){if(_0x47730f['type']!=='VIRTUAL'){var _0x1816d8={};_0x1816d8[_0x47730f[_0x54f0('0x2f')]]={'$like':'%'+_0x27637e[_0x54f0('0x38')][_0x54f0('0x43')]+'%'};return _0x1816d8;}})});}_0x7ff0b2=_[_0x54f0('0x44')]({},_0x7ff0b2,_0x27637e[_0x54f0('0x45')]);var _0x4b8c41={'where':_0x7ff0b2[_0x54f0('0x46')]};return db[_0x54f0('0x33')][_0x54f0('0x24')](_0x4b8c41)[_0x54f0('0x28')](function(_0xb281cf){_0x3e3cde[_0x54f0('0x24')]=_0xb281cf;if(_0x27637e[_0x54f0('0x38')][_0x54f0('0x47')]){_0x7ff0b2[_0x54f0('0x48')]=[{'all':!![]}];}return db[_0x54f0('0x33')]['findAll'](_0x7ff0b2);})[_0x54f0('0x28')](function(_0x309e32){_0x3e3cde[_0x54f0('0x49')]=_0x309e32;return _0x3e3cde;})['then'](respondWithFilteredResult(_0x3438c1,_0x7ff0b2))[_0x54f0('0x4a')](handleError(_0x3438c1,null));};exports[_0x54f0('0x4b')]=function(_0x5827b4,_0x1e0e21){var _0xdce49f={'raw':!![],'where':{'id':_0x5827b4[_0x54f0('0x4c')]['id']}},_0x3e2343={};_0x3e2343[_0x54f0('0x37')]=_[_0x54f0('0x39')](db[_0x54f0('0x33')][_0x54f0('0x34')]);_0x3e2343[_0x54f0('0x38')]=_[_0x54f0('0x39')](_0x5827b4['query']);_0x3e2343['filters']=_[_0x54f0('0x3b')](_0x3e2343[_0x54f0('0x37')],_0x3e2343[_0x54f0('0x38')]);_0xdce49f[_0x54f0('0x3c')]=_['intersection'](_0x3e2343[_0x54f0('0x37')],qs['fields'](_0x5827b4['query'][_0x54f0('0x3d')]));_0xdce49f[_0x54f0('0x3c')]=_0xdce49f['attributes'][_0x54f0('0x4d')]?_0xdce49f['attributes']:_0x3e2343['model'];if(_0x5827b4[_0x54f0('0x38')][_0x54f0('0x47')]){_0xdce49f[_0x54f0('0x48')]=[{'all':!![]}];}_0xdce49f=_[_0x54f0('0x44')]({},_0xdce49f,_0x5827b4[_0x54f0('0x45')]);return db[_0x54f0('0x33')][_0x54f0('0x4e')](_0xdce49f)[_0x54f0('0x28')](handleEntityNotFound(_0x1e0e21,null))[_0x54f0('0x28')](respondWithResult(_0x1e0e21,null))[_0x54f0('0x4a')](handleError(_0x1e0e21,null));};exports[_0x54f0('0x4f')]=function(_0x53cd25,_0x42bf37){return db[_0x54f0('0x33')][_0x54f0('0x4f')](_0x53cd25[_0x54f0('0x50')],{})[_0x54f0('0x28')](function(_0x23cbe4){var _0xd80fc1=_0x53cd25[_0x54f0('0x51')]['get']({'plain':!![]});if(!_0xd80fc1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd80fc1[_0x54f0('0x52')]==='user'){var _0x5c22bc=_0x23cbe4[_0x54f0('0x29')]({'plain':!![]});var _0xec6dac='FaxQueues';return db[_0x54f0('0x53')][_0x54f0('0x4e')]({'where':{'name':_0xec6dac,'userProfileId':_0xd80fc1[_0x54f0('0x54')]},'raw':!![]})[_0x54f0('0x28')](function(_0x544602){if(_0x544602&&_0x544602['autoAssociation']===0x0){return db[_0x54f0('0x2b')][_0x54f0('0x4f')]({'name':_0x5c22bc[_0x54f0('0x2f')],'resourceId':_0x5c22bc['id'],'type':_0x544602[_0x54f0('0x2f')],'sectionId':_0x544602['id']},{})[_0x54f0('0x28')](function(){return _0x23cbe4;});}else{return _0x23cbe4;}})[_0x54f0('0x4a')](function(_0x1a5817){logger[_0x54f0('0x2d')](_0x54f0('0x55'),_0x1a5817);throw _0x1a5817;});}return _0x23cbe4;})[_0x54f0('0x28')](respondWithResult(_0x42bf37,0xc9))['catch'](handleError(_0x42bf37,null));};exports['update']=function(_0xd03a3,_0x11cff9){if(_0xd03a3[_0x54f0('0x50')]['id']){delete _0xd03a3[_0x54f0('0x50')]['id'];}return db[_0x54f0('0x33')][_0x54f0('0x4e')]({'where':{'id':_0xd03a3[_0x54f0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x11cff9,null))['then'](saveUpdates(_0xd03a3[_0x54f0('0x50')],null))[_0x54f0('0x28')](respondWithResult(_0x11cff9,null))[_0x54f0('0x4a')](handleError(_0x11cff9,null));};exports['destroy']=function(_0x2ca310,_0x57511d){return db[_0x54f0('0x33')][_0x54f0('0x4e')]({'where':{'id':_0x2ca310[_0x54f0('0x4c')]['id']}})[_0x54f0('0x28')](handleEntityNotFound(_0x57511d,null))[_0x54f0('0x28')](removeEntity(_0x57511d,null))[_0x54f0('0x4a')](handleError(_0x57511d,null));};exports[_0x54f0('0x56')]=function(_0x307da8,_0x587b63){return db[_0x54f0('0x33')][_0x54f0('0x56')]()[_0x54f0('0x28')](respondWithResult(_0x587b63,null))[_0x54f0('0x4a')](handleError(_0x587b63,null));};exports[_0x54f0('0x57')]=function(_0x3c1b9,_0x3ca61b,_0x34f4b2){var _0x52a3c3={'raw':!![],'where':{}},_0x150932={},_0x811ca0;return db[_0x54f0('0x33')][_0x54f0('0x58')]({'where':{'id':_0x3c1b9['params']['id']}})['then'](handleEntityNotFound(_0x3ca61b,null))[_0x54f0('0x28')](function(_0x271c4f){if(_0x271c4f){_0x811ca0=_0x271c4f[_0x54f0('0x29')]({'plain':!![]});_0x150932[_0x54f0('0x37')]=_[_0x54f0('0x39')](db[_0x54f0('0x59')][_0x54f0('0x34')]);_0x150932['query']=_[_0x54f0('0x39')](_0x3c1b9[_0x54f0('0x38')]);_0x150932[_0x54f0('0x3a')]=_[_0x54f0('0x3b')](_0x150932['model'],_0x150932[_0x54f0('0x38')]);_0x52a3c3[_0x54f0('0x3c')]=_[_0x54f0('0x3b')](_0x150932[_0x54f0('0x37')],qs[_0x54f0('0x3d')](_0x3c1b9[_0x54f0('0x38')][_0x54f0('0x3d')]));_0x52a3c3[_0x54f0('0x3c')]=_0x52a3c3[_0x54f0('0x3c')][_0x54f0('0x4d')]?_0x52a3c3['attributes']:_0x150932[_0x54f0('0x37')];if(!_0x3c1b9[_0x54f0('0x38')][_0x54f0('0x3e')](_0x54f0('0x3f'))){_0x52a3c3['limit']=qs[_0x54f0('0x25')](_0x3c1b9[_0x54f0('0x38')][_0x54f0('0x25')]);_0x52a3c3['offset']=qs[_0x54f0('0x22')](_0x3c1b9[_0x54f0('0x38')]['offset']);}_0x52a3c3[_0x54f0('0x40')]=qs[_0x54f0('0x41')](_0x3c1b9['query'][_0x54f0('0x41')]);_0x52a3c3['where']=qs[_0x54f0('0x3a')](_[_0x54f0('0x42')](_0x3c1b9[_0x54f0('0x38')],_0x150932[_0x54f0('0x3a')]));_0x52a3c3[_0x54f0('0x46')][_0x54f0('0x5a')]=_0x271c4f['id'];if(_0x3c1b9[_0x54f0('0x38')][_0x54f0('0x43')]){_0x52a3c3[_0x54f0('0x46')]=_[_0x54f0('0x44')](_0x52a3c3[_0x54f0('0x46')],{'$or':_['map'](_0x52a3c3[_0x54f0('0x3c')],function(_0x933e90){var _0x25bed4={};_0x25bed4[_0x933e90]={'$like':'%'+_0x3c1b9[_0x54f0('0x38')]['filter']+'%'};return _0x25bed4;})});}_0x52a3c3=_[_0x54f0('0x44')]({},_0x52a3c3,_0x3c1b9[_0x54f0('0x45')]);return db[_0x54f0('0x59')][_0x54f0('0x5b')](_0x52a3c3);}})[_0x54f0('0x28')](function(_0x4bfd9b){if(_0x4bfd9b){return db[_0x54f0('0x5c')]['findAndCountAll']({'where':{'id':_[_0x54f0('0x32')](_0x4bfd9b,_0x54f0('0x5d')),'role':'agent'},'attributes':['id',_0x54f0('0x2f'),_0x54f0('0x5e'),_0x54f0('0x5f'),_0x54f0('0x60')]});}})[_0x54f0('0x28')](function(_0x72f5ff){if(_0x72f5ff){return{'count':_0x72f5ff[_0x54f0('0x24')],'rows':_[_0x54f0('0x32')](_0x72f5ff[_0x54f0('0x49')],function(_0x2f87f0){return{'membername':_0x2f87f0[_0x54f0('0x2f')],'UserId':_0x2f87f0['id'],'queue_name':_0x811ca0['name'],'FaxQueueId':_0x811ca0['id'],'interface':util[_0x54f0('0x61')](_0x54f0('0x62'),_0x54f0('0x63'),_0x2f87f0[_0x54f0('0x2f')]),'penalty':0x0,'paused':_0x2f87f0[_0x54f0('0x5e')],'createdAt':_0x2f87f0[_0x54f0('0x60')],'updatedAt':_0x2f87f0['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x54f0('0x28')](respondWithFilteredResult(_0x3ca61b,_0x52a3c3))[_0x54f0('0x4a')](handleError(_0x3ca61b,null));};exports[_0x54f0('0x64')]=function(_0x4c6df,_0x176932,_0x1c1278){var _0x330266={};var _0x12a0d6={};var _0x154645;var _0x5cc982;return db[_0x54f0('0x33')]['findOne']({'where':{'id':_0x4c6df[_0x54f0('0x4c')]['id']}})[_0x54f0('0x28')](handleEntityNotFound(_0x176932,null))['then'](function(_0x2ce6c7){if(_0x2ce6c7){_0x154645=_0x2ce6c7;_0x12a0d6['model']=_[_0x54f0('0x39')](db[_0x54f0('0x65')]['rawAttributes']);_0x12a0d6['query']=_['keys'](_0x4c6df[_0x54f0('0x38')]);_0x12a0d6[_0x54f0('0x3a')]=_[_0x54f0('0x3b')](_0x12a0d6['model'],_0x12a0d6[_0x54f0('0x38')]);_0x330266[_0x54f0('0x3c')]=_[_0x54f0('0x3b')](_0x12a0d6[_0x54f0('0x37')],qs[_0x54f0('0x3d')](_0x4c6df[_0x54f0('0x38')][_0x54f0('0x3d')]));_0x330266[_0x54f0('0x3c')]=_0x330266[_0x54f0('0x3c')][_0x54f0('0x4d')]?_0x330266[_0x54f0('0x3c')]:_0x12a0d6[_0x54f0('0x37')];_0x330266[_0x54f0('0x40')]=qs[_0x54f0('0x41')](_0x4c6df['query']['sort']);_0x330266[_0x54f0('0x46')]=qs[_0x54f0('0x3a')](_[_0x54f0('0x42')](_0x4c6df[_0x54f0('0x38')],_0x12a0d6[_0x54f0('0x3a')]));if(_0x4c6df[_0x54f0('0x38')][_0x54f0('0x43')]){_0x330266[_0x54f0('0x46')]=_[_0x54f0('0x44')](_0x330266[_0x54f0('0x46')],{'$or':_[_0x54f0('0x32')](_0x330266['attributes'],function(_0x51e1a3){var _0x190ffc={};_0x190ffc[_0x51e1a3]={'$like':'%'+_0x4c6df[_0x54f0('0x38')][_0x54f0('0x43')]+'%'};return _0x190ffc;})});}_0x330266=_[_0x54f0('0x44')]({},_0x330266,_0x4c6df['options']);return _0x154645[_0x54f0('0x64')](_0x330266);}})[_0x54f0('0x28')](function(_0x394b6d){if(_0x394b6d){_0x5cc982=_0x394b6d['length'];if(!_0x4c6df[_0x54f0('0x38')][_0x54f0('0x3e')](_0x54f0('0x3f'))){_0x330266[_0x54f0('0x25')]=qs[_0x54f0('0x25')](_0x4c6df[_0x54f0('0x38')]['limit']);_0x330266[_0x54f0('0x22')]=qs[_0x54f0('0x22')](_0x4c6df['query']['offset']);}return _0x154645[_0x54f0('0x64')](_0x330266);}})[_0x54f0('0x28')](function(_0x532d75){if(_0x532d75){return _0x532d75?{'count':_0x5cc982,'rows':_0x532d75}:null;}})[_0x54f0('0x28')](respondWithResult(_0x176932,null))[_0x54f0('0x4a')](handleError(_0x176932,null));};exports[_0x54f0('0x66')]=function(_0x43e86e,_0x1aa979,_0x4c2e16){var _0x419d7d=_0x43e86e[_0x54f0('0x50')][_0x54f0('0x67')];return db['Team'][_0x54f0('0x5b')]({'where':{'id':_0x419d7d},'attributes':['id'],'include':[{'model':db[_0x54f0('0x5c')],'as':_0x54f0('0x68'),'attributes':['id',_0x54f0('0x2f'),'online',_0x54f0('0x69'),_0x54f0('0x6a')],'raw':!![]}]})['then'](function(_0x494ad7){if(_0x494ad7){var _0x5c497a=_[_0x54f0('0x6b')](_0x494ad7,function(_0x191991){var _0x2b3544=_0x191991[_0x54f0('0x29')]({'plain':!![]});return _0x2b3544[_0x54f0('0x68')];});return db[_0x54f0('0x33')][_0x54f0('0x4e')]({'where':{'id':_0x43e86e[_0x54f0('0x4c')]['id']}})[_0x54f0('0x28')](function(_0x4ba4bb){return db[_0x54f0('0x6c')]['transaction'](function(_0x3d3e8e){return _0x4ba4bb[_0x54f0('0x66')](_0x419d7d,{'transaction':_0x3d3e8e})[_0x54f0('0x28')](function(){return BPromise['each'](_0x5c497a,function(_0x2a6179){return db[_0x54f0('0x59')][_0x54f0('0x6d')]({'where':{'UserId':_0x2a6179['id'],'FaxQueueId':_0x43e86e['params']['id']},'transaction':_0x3d3e8e});});})[_0x54f0('0x28')](function(){_0x5c497a[_0x54f0('0x6e')](function(_0x27272e){socket['emit'](_0x54f0('0x6f'),{'UserId':_0x27272e['id'],'FaxQueueId':_0x4ba4bb['id']});});});});});}})[_0x54f0('0x28')](respondWithStatusCode(_0x1aa979,null))['catch'](handleError(_0x1aa979,null));};exports[_0x54f0('0x70')]=function(_0x369314,_0x3bcc45,_0x211e1a){return db[_0x54f0('0x65')][_0x54f0('0x5b')]({'where':{'id':_0x369314[_0x54f0('0x38')][_0x54f0('0x67')]},'attributes':['id'],'include':[{'model':db[_0x54f0('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x54f0('0x28')](handleEntityNotFound(_0x3bcc45,null))['then'](function(_0x367fc3){var _0x16b51f=_['map'](_0x367fc3,'id');var _0x355a26=[];var _0x548686=[];var _0x2fd30c=squel[_0x54f0('0x71')]();_0x2fd30c['field']('tq.TeamId')['from'](_0x54f0('0x72'),'tq')[_0x54f0('0x73')](_0x54f0('0x74'),'ut',_0x54f0('0x75'))[_0x54f0('0x46')](_0x54f0('0x76'),_0x369314[_0x54f0('0x4c')]['id']);for(var _0x42015=0x0;_0x42015<_0x367fc3['length'];_0x42015+=0x1){let _0x4eec96=_0x367fc3[_0x42015];for(var _0x541f8a=0x0;_0x541f8a<_0x4eec96[_0x54f0('0x68')]['length'];_0x541f8a+=0x1){let _0x6c8e75=_0x4eec96[_0x54f0('0x68')][_0x541f8a];var _0x5c73f1=_0x2fd30c[_0x54f0('0x77')]();_0x5c73f1[_0x54f0('0x46')](_0x54f0('0x78'),_0x6c8e75['id']);_0x548686[_0x54f0('0x79')](db[_0x54f0('0x6c')][_0x54f0('0x38')](_0x5c73f1['toString'](),{'type':db['sequelize']['QueryTypes'][_0x54f0('0x7a')]})[_0x54f0('0x28')](function(_0x2c3438){if(_0x2c3438[_0x54f0('0x4d')]===0x1){return _0x6c8e75['id'];}else{var _0x49adca=_[_0x54f0('0x7b')](_[_0x54f0('0x32')](_0x2c3438,_0x54f0('0x7c')),function(_0xe128e2){return _[_0x54f0('0x7d')](_0x16b51f,_0xe128e2);});if(_0x49adca){return _0x6c8e75['id'];}}}));}}return BPromise[_0x54f0('0x7e')](_0x548686)[_0x54f0('0x28')](function(_0x369f98){_0x355a26=_(_0x355a26)[_0x54f0('0x7f')](_0x369f98)['compact']()[_0x54f0('0x80')]();return db[_0x54f0('0x33')][_0x54f0('0x4e')]({'where':{'id':_0x369314[_0x54f0('0x4c')]['id']}})[_0x54f0('0x28')](function(_0xba9d07){return db[_0x54f0('0x6c')][_0x54f0('0x81')](function(_0x1899b6){return _0xba9d07[_0x54f0('0x70')](_0x369314['query'][_0x54f0('0x67')],{'transaction':_0x1899b6})['then'](function(){if(!_[_0x54f0('0x82')](_0x355a26)){return _0xba9d07['removeAgents'](_0x355a26,{'transaction':_0x1899b6});}})[_0x54f0('0x28')](function(){_0x355a26[_0x54f0('0x6e')](function(_0x14fd5f){socket[_0x54f0('0x83')](_0x54f0('0x84'),{'UserId':_0x14fd5f,'FaxQueueId':_0xba9d07['id']});});});});});});})[_0x54f0('0x28')](respondWithStatusCode(_0x3bcc45,null))[_0x54f0('0x4a')](handleError(_0x3bcc45,null));};exports[_0x54f0('0x85')]=function(_0x5ee0c7,_0x567a37,_0x309ba9){return db[_0x54f0('0x33')][_0x54f0('0x4e')]({'where':{'id':_0x5ee0c7[_0x54f0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x567a37,null))['then'](function(_0x593849){if(_0x593849){return _0x593849[_0x54f0('0x85')](_0x5ee0c7[_0x54f0('0x50')]['ids'],_[_0x54f0('0x86')](_0x5ee0c7[_0x54f0('0x50')],['ids','id'])||{})[_0x54f0('0x87')](function(_0x7a89f5){for(var _0x463a93=0x0;_0x463a93<_0x5ee0c7[_0x54f0('0x50')]['ids'][_0x54f0('0x4d')];_0x463a93+=0x1){socket[_0x54f0('0x83')]('userFaxQueue:save',{'UserId':Number(_0x5ee0c7[_0x54f0('0x50')][_0x54f0('0x67')][_0x463a93]),'FaxQueueId':Number(_0x5ee0c7[_0x54f0('0x4c')]['id'])});}return _0x7a89f5;});}})[_0x54f0('0x28')](respondWithResult(_0x567a37,null))[_0x54f0('0x4a')](handleError(_0x567a37,null));};exports[_0x54f0('0x88')]=function(_0x2709ed,_0x4b1bdd,_0x5f30b5){return db[_0x54f0('0x33')][_0x54f0('0x4e')]({'where':{'id':_0x2709ed[_0x54f0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4b1bdd,null))[_0x54f0('0x28')](function(_0x588ea5){if(_0x588ea5){return _0x588ea5['removeAgents'](_0x2709ed['query'][_0x54f0('0x67')])[_0x54f0('0x28')](function(){if(_[_0x54f0('0x89')](_0x2709ed[_0x54f0('0x38')]['ids'])){for(var _0x46cf55=0x0;_0x46cf55<_0x2709ed[_0x54f0('0x38')]['ids'][_0x54f0('0x4d')];_0x46cf55+=0x1){socket[_0x54f0('0x83')](_0x54f0('0x84'),{'UserId':Number(_0x2709ed['query'][_0x54f0('0x67')][_0x46cf55]),'FaxQueueId':Number(_0x2709ed[_0x54f0('0x4c')]['id'])});}}else{socket[_0x54f0('0x83')](_0x54f0('0x84'),{'UserId':Number(_0x2709ed[_0x54f0('0x38')][_0x54f0('0x67')]),'FaxQueueId':Number(_0x2709ed['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4b1bdd,null))[_0x54f0('0x4a')](handleError(_0x4b1bdd,null));};exports[_0x54f0('0x8a')]=function(_0x1b5025,_0x3593e1,_0x5c2b4a){var _0x129618={};var _0x58f8a7={};var _0x5d9a18;var _0x22d0d7;return db[_0x54f0('0x33')][_0x54f0('0x58')]({'where':{'id':_0x1b5025[_0x54f0('0x4c')]['id']}})[_0x54f0('0x28')](handleEntityNotFound(_0x3593e1,null))[_0x54f0('0x28')](function(_0x288bac){if(_0x288bac){_0x5d9a18=_0x288bac;_0x58f8a7[_0x54f0('0x37')]=_['keys'](db[_0x54f0('0x5c')][_0x54f0('0x34')]);_0x58f8a7[_0x54f0('0x38')]=_[_0x54f0('0x39')](_0x1b5025[_0x54f0('0x38')]);_0x58f8a7[_0x54f0('0x3a')]=_[_0x54f0('0x3b')](_0x58f8a7['model'],_0x58f8a7[_0x54f0('0x38')]);_0x129618[_0x54f0('0x3c')]=_[_0x54f0('0x3b')](_0x58f8a7[_0x54f0('0x37')],qs['fields'](_0x1b5025['query']['fields']));_0x129618[_0x54f0('0x3c')]=_0x129618[_0x54f0('0x3c')][_0x54f0('0x4d')]?_0x129618[_0x54f0('0x3c')]:_0x58f8a7[_0x54f0('0x37')];_0x129618[_0x54f0('0x40')]=qs[_0x54f0('0x41')](_0x1b5025['query'][_0x54f0('0x41')]);_0x129618['where']=qs['filters'](_['pick'](_0x1b5025['query'],_0x58f8a7[_0x54f0('0x3a')]));if(_0x1b5025['query']['filter']){_0x129618[_0x54f0('0x46')]=_['merge'](_0x129618[_0x54f0('0x46')],{'$or':_[_0x54f0('0x32')](_0x129618[_0x54f0('0x3c')],function(_0x5b3bd2){var _0x42f052={};_0x42f052[_0x5b3bd2]={'$like':'%'+_0x1b5025['query']['filter']+'%'};return _0x42f052;})});}_0x129618=_[_0x54f0('0x44')]({},_0x129618,_0x1b5025[_0x54f0('0x45')]);return _0x5d9a18[_0x54f0('0x8a')](_0x129618);}})[_0x54f0('0x28')](function(_0x21ab2c){if(_0x21ab2c){_0x22d0d7=_0x21ab2c['length'];if(!_0x1b5025['query'][_0x54f0('0x3e')](_0x54f0('0x3f'))){_0x129618['limit']=qs[_0x54f0('0x25')](_0x1b5025[_0x54f0('0x38')][_0x54f0('0x25')]);_0x129618[_0x54f0('0x22')]=qs['offset'](_0x1b5025[_0x54f0('0x38')][_0x54f0('0x22')]);}return _0x5d9a18[_0x54f0('0x8a')](_0x129618);}})['then'](function(_0x3309d6){if(_0x3309d6){return _0x3309d6?{'count':_0x22d0d7,'rows':_0x3309d6}:null;}})[_0x54f0('0x28')](respondWithResult(_0x3593e1,null))[_0x54f0('0x4a')](handleError(_0x3593e1,null));}; \ No newline at end of file +var _0x435f=['tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','emit','userFaxQueue:remove','addAgents','omit','spread','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./faxQueue.socket','register','status','end','json','offset','limit','count','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','FaxQueue','findAll','rows','catch','show','params','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','userProfileId','autoAssociation','update','body','describe','getMembers','findOne','order','FaxQueueId','UserFaxQueue','User','findAndCountAll','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','userFaxQueue:save','removeTeams','Team','ids','select','field'];(function(_0x8fa4bc,_0x5cd2af){var _0x35b6a7=function(_0x357c25){while(--_0x357c25){_0x8fa4bc['push'](_0x8fa4bc['shift']());}};_0x35b6a7(++_0x5cd2af);}(_0x435f,0xa8));var _0xf435=function(_0x4ab325,_0x2f03e6){_0x4ab325=_0x4ab325-0x0;var _0x206cda=_0x435f[_0x4ab325];return _0x206cda;};'use strict';var emlformat=require(_0xf435('0x0'));var rimraf=require(_0xf435('0x1'));var zipdir=require(_0xf435('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf435('0x3'));var moment=require('moment');var BPromise=require(_0xf435('0x4'));var Mustache=require(_0xf435('0x5'));var util=require(_0xf435('0x6'));var path=require(_0xf435('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf435('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf435('0x9'));var squel=require(_0xf435('0xa'));var crypto=require('crypto');var jsforce=require(_0xf435('0xb'));var deskjs=require(_0xf435('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf435('0xd'));var Papa=require('papaparse');var Redis=require(_0xf435('0xe'));var authService=require(_0xf435('0xf'));var qs=require(_0xf435('0x10'));var as=require(_0xf435('0x11'));var hardwareService=require(_0xf435('0x12'));var logger=require('../../config/logger')(_0xf435('0x13'));var utils=require(_0xf435('0x14'));var config=require(_0xf435('0x15'));var licenseUtil=require(_0xf435('0x16'));var db=require('../../mysqldb')['db'];config[_0xf435('0x17')]=_['defaults'](config[_0xf435('0x17')],{'host':_0xf435('0x18'),'port':0x18eb});var socket=require(_0xf435('0x19'))(new Redis(config[_0xf435('0x17')]));require(_0xf435('0x1a'))[_0xf435('0x1b')](socket);function respondWithStatusCode(_0x1edc2a,_0x21af24){_0x21af24=_0x21af24||0xcc;return function(_0x28f1fe){if(_0x28f1fe){return _0x1edc2a['sendStatus'](_0x21af24);}return _0x1edc2a[_0xf435('0x1c')](_0x21af24)[_0xf435('0x1d')]();};}function respondWithResult(_0xef2cb8,_0x34eae1){_0x34eae1=_0x34eae1||0xc8;return function(_0x7eac77){if(_0x7eac77){return _0xef2cb8[_0xf435('0x1c')](_0x34eae1)[_0xf435('0x1e')](_0x7eac77);}};}function respondWithFilteredResult(_0x2896db,_0x53be96){return function(_0x329c0b){if(_0x329c0b){var _0x826e6=typeof _0x53be96[_0xf435('0x1f')]==='undefined'&&typeof _0x53be96[_0xf435('0x20')]==='undefined';var _0x596edb=_0x329c0b[_0xf435('0x21')];var _0x4b5fab=_0x826e6?0x0:_0x53be96[_0xf435('0x1f')];var _0x5b3801=_0x826e6?_0x329c0b['count']:_0x53be96['offset']+_0x53be96[_0xf435('0x20')];var _0x39af23;if(_0x5b3801>=_0x596edb){_0x5b3801=_0x596edb;_0x39af23=0xc8;}else{_0x39af23=0xce;}_0x2896db[_0xf435('0x1c')](_0x39af23);return _0x2896db['set'](_0xf435('0x22'),_0x4b5fab+'-'+_0x5b3801+'/'+_0x596edb)[_0xf435('0x1e')](_0x329c0b);}return null;};}function patchUpdates(_0x518a28){return function(_0x6d540b){try{jsonpatch[_0xf435('0x23')](_0x6d540b,_0x518a28,!![]);}catch(_0x1028b7){return BPromise[_0xf435('0x24')](_0x1028b7);}return _0x6d540b[_0xf435('0x25')]();};}function saveUpdates(_0x380d45,_0x4961d0){return function(_0x187d7f){if(_0x187d7f){return _0x187d7f['update'](_0x380d45)[_0xf435('0x26')](function(_0x3546d3){return _0x3546d3;});}return null;};}function removeEntity(_0x2b73c9,_0x584464){return function(_0x35eab4){if(_0x35eab4){return _0x35eab4[_0xf435('0x27')]()[_0xf435('0x26')](function(){var _0x3e1c7b=_0x35eab4[_0xf435('0x28')]({'plain':!![]});var _0xe7a1e9='FaxQueues';return db[_0xf435('0x29')]['destroy']({'where':{'type':_0xe7a1e9,'resourceId':_0x3e1c7b['id']}})[_0xf435('0x26')](function(){return _0x35eab4;});})[_0xf435('0x26')](function(){_0x2b73c9[_0xf435('0x1c')](0xcc)[_0xf435('0x1d')]();});}};}function handleEntityNotFound(_0x2bec7b,_0x355dc2){return function(_0x2967f3){if(!_0x2967f3){_0x2bec7b[_0xf435('0x2a')](0x194);}return _0x2967f3;};}function handleError(_0x49e90a,_0x43bc38){_0x43bc38=_0x43bc38||0x1f4;return function(_0x30733e){logger[_0xf435('0x2b')](_0x30733e[_0xf435('0x2c')]);if(_0x30733e[_0xf435('0x2d')]){delete _0x30733e['name'];}_0x49e90a[_0xf435('0x1c')](_0x43bc38)[_0xf435('0x2e')](_0x30733e);};}exports['index']=function(_0x1b8adf,_0xc29d0a){var _0x34b2c4={},_0x34b75c={},_0x453066={'count':0x0,'rows':[]};var _0x50899f=_[_0xf435('0x2f')](db['FaxQueue'][_0xf435('0x30')],function(_0x2e85ef){return{'name':_0x2e85ef[_0xf435('0x31')],'type':_0x2e85ef[_0xf435('0x32')][_0xf435('0x33')]};});_0x34b75c[_0xf435('0x34')]=_['map'](_0x50899f,_0xf435('0x2d'));_0x34b75c[_0xf435('0x35')]=_[_0xf435('0x36')](_0x1b8adf[_0xf435('0x35')]);_0x34b75c[_0xf435('0x37')]=_[_0xf435('0x38')](_0x34b75c[_0xf435('0x34')],_0x34b75c[_0xf435('0x35')]);_0x34b2c4[_0xf435('0x39')]=_[_0xf435('0x38')](_0x34b75c[_0xf435('0x34')],qs[_0xf435('0x3a')](_0x1b8adf['query'][_0xf435('0x3a')]));_0x34b2c4[_0xf435('0x39')]=_0x34b2c4[_0xf435('0x39')][_0xf435('0x3b')]?_0x34b2c4[_0xf435('0x39')]:_0x34b75c['model'];if(!_0x1b8adf[_0xf435('0x35')][_0xf435('0x3c')](_0xf435('0x3d'))){_0x34b2c4[_0xf435('0x20')]=qs[_0xf435('0x20')](_0x1b8adf[_0xf435('0x35')][_0xf435('0x20')]);_0x34b2c4[_0xf435('0x1f')]=qs[_0xf435('0x1f')](_0x1b8adf[_0xf435('0x35')][_0xf435('0x1f')]);}_0x34b2c4['order']=qs[_0xf435('0x3e')](_0x1b8adf[_0xf435('0x35')][_0xf435('0x3e')]);_0x34b2c4[_0xf435('0x3f')]=qs[_0xf435('0x37')](_[_0xf435('0x40')](_0x1b8adf[_0xf435('0x35')],_0x34b75c[_0xf435('0x37')]),_0x50899f);if(_0x1b8adf['query']['filter']){_0x34b2c4[_0xf435('0x3f')]=_[_0xf435('0x41')](_0x34b2c4[_0xf435('0x3f')],{'$or':_[_0xf435('0x2f')](_0x50899f,function(_0x553511){if(_0x553511['type']!==_0xf435('0x42')){var _0x3ce0bd={};_0x3ce0bd[_0x553511[_0xf435('0x2d')]]={'$like':'%'+_0x1b8adf[_0xf435('0x35')][_0xf435('0x43')]+'%'};return _0x3ce0bd;}})});}_0x34b2c4=_[_0xf435('0x41')]({},_0x34b2c4,_0x1b8adf['options']);var _0x4224b9={'where':_0x34b2c4[_0xf435('0x3f')]};return db['FaxQueue'][_0xf435('0x21')](_0x4224b9)[_0xf435('0x26')](function(_0xafdc35){_0x453066['count']=_0xafdc35;if(_0x1b8adf[_0xf435('0x35')][_0xf435('0x44')]){_0x34b2c4['include']=[{'all':!![]}];}return db[_0xf435('0x45')][_0xf435('0x46')](_0x34b2c4);})['then'](function(_0x55b0dc){_0x453066[_0xf435('0x47')]=_0x55b0dc;return _0x453066;})[_0xf435('0x26')](respondWithFilteredResult(_0xc29d0a,_0x34b2c4))[_0xf435('0x48')](handleError(_0xc29d0a,null));};exports[_0xf435('0x49')]=function(_0xaec400,_0x26ca61){var _0x4f5ec4={'raw':!![],'where':{'id':_0xaec400[_0xf435('0x4a')]['id']}},_0x20d81f={};_0x20d81f[_0xf435('0x34')]=_[_0xf435('0x36')](db[_0xf435('0x45')][_0xf435('0x30')]);_0x20d81f[_0xf435('0x35')]=_[_0xf435('0x36')](_0xaec400[_0xf435('0x35')]);_0x20d81f['filters']=_['intersection'](_0x20d81f[_0xf435('0x34')],_0x20d81f[_0xf435('0x35')]);_0x4f5ec4[_0xf435('0x39')]=_[_0xf435('0x38')](_0x20d81f[_0xf435('0x34')],qs[_0xf435('0x3a')](_0xaec400[_0xf435('0x35')]['fields']));_0x4f5ec4['attributes']=_0x4f5ec4[_0xf435('0x39')][_0xf435('0x3b')]?_0x4f5ec4['attributes']:_0x20d81f[_0xf435('0x34')];if(_0xaec400[_0xf435('0x35')][_0xf435('0x44')]){_0x4f5ec4[_0xf435('0x4b')]=[{'all':!![]}];}_0x4f5ec4=_[_0xf435('0x41')]({},_0x4f5ec4,_0xaec400[_0xf435('0x4c')]);return db[_0xf435('0x45')][_0xf435('0x4d')](_0x4f5ec4)[_0xf435('0x26')](handleEntityNotFound(_0x26ca61,null))['then'](respondWithResult(_0x26ca61,null))[_0xf435('0x48')](handleError(_0x26ca61,null));};exports[_0xf435('0x4e')]=function(_0x17196d,_0xeb3f01){return db[_0xf435('0x45')][_0xf435('0x4e')](_0x17196d['body'],{})[_0xf435('0x26')](function(_0x257bc3){var _0x2410d4=_0x17196d[_0xf435('0x4f')][_0xf435('0x28')]({'plain':!![]});if(!_0x2410d4)throw new Error(_0xf435('0x50'));if(_0x2410d4[_0xf435('0x51')]==='user'){var _0x239016=_0x257bc3[_0xf435('0x28')]({'plain':!![]});var _0x2a16f1=_0xf435('0x52');return db[_0xf435('0x53')][_0xf435('0x4d')]({'where':{'name':_0x2a16f1,'userProfileId':_0x2410d4[_0xf435('0x54')]},'raw':!![]})[_0xf435('0x26')](function(_0x331e85){if(_0x331e85&&_0x331e85[_0xf435('0x55')]===0x0){return db[_0xf435('0x29')][_0xf435('0x4e')]({'name':_0x239016[_0xf435('0x2d')],'resourceId':_0x239016['id'],'type':_0x331e85[_0xf435('0x2d')],'sectionId':_0x331e85['id']},{})['then'](function(){return _0x257bc3;});}else{return _0x257bc3;}})[_0xf435('0x48')](function(_0x11f656){logger[_0xf435('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11f656);throw _0x11f656;});}return _0x257bc3;})[_0xf435('0x26')](respondWithResult(_0xeb3f01,0xc9))['catch'](handleError(_0xeb3f01,null));};exports[_0xf435('0x56')]=function(_0x3aeb45,_0xba89f){if(_0x3aeb45[_0xf435('0x57')]['id']){delete _0x3aeb45[_0xf435('0x57')]['id'];}return db[_0xf435('0x45')][_0xf435('0x4d')]({'where':{'id':_0x3aeb45[_0xf435('0x4a')]['id']}})[_0xf435('0x26')](handleEntityNotFound(_0xba89f,null))[_0xf435('0x26')](saveUpdates(_0x3aeb45['body'],null))[_0xf435('0x26')](respondWithResult(_0xba89f,null))['catch'](handleError(_0xba89f,null));};exports[_0xf435('0x27')]=function(_0x4b2544,_0x3aba57){return db[_0xf435('0x45')][_0xf435('0x4d')]({'where':{'id':_0x4b2544[_0xf435('0x4a')]['id']}})[_0xf435('0x26')](handleEntityNotFound(_0x3aba57,null))[_0xf435('0x26')](removeEntity(_0x3aba57,null))['catch'](handleError(_0x3aba57,null));};exports[_0xf435('0x58')]=function(_0xe8be50,_0x509000){return db[_0xf435('0x45')][_0xf435('0x58')]()['then'](respondWithResult(_0x509000,null))[_0xf435('0x48')](handleError(_0x509000,null));};exports[_0xf435('0x59')]=function(_0x75e15a,_0x3c8f0f,_0x2f46a9){var _0x513388={'raw':!![],'where':{}},_0x5df1f1={},_0x2e0583;return db[_0xf435('0x45')][_0xf435('0x5a')]({'where':{'id':_0x75e15a[_0xf435('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3c8f0f,null))[_0xf435('0x26')](function(_0x480151){if(_0x480151){_0x2e0583=_0x480151['get']({'plain':!![]});_0x5df1f1['model']=_['keys'](db['UserFaxQueue'][_0xf435('0x30')]);_0x5df1f1[_0xf435('0x35')]=_[_0xf435('0x36')](_0x75e15a[_0xf435('0x35')]);_0x5df1f1['filters']=_[_0xf435('0x38')](_0x5df1f1[_0xf435('0x34')],_0x5df1f1[_0xf435('0x35')]);_0x513388['attributes']=_[_0xf435('0x38')](_0x5df1f1[_0xf435('0x34')],qs[_0xf435('0x3a')](_0x75e15a['query'][_0xf435('0x3a')]));_0x513388[_0xf435('0x39')]=_0x513388[_0xf435('0x39')]['length']?_0x513388[_0xf435('0x39')]:_0x5df1f1['model'];if(!_0x75e15a[_0xf435('0x35')][_0xf435('0x3c')](_0xf435('0x3d'))){_0x513388[_0xf435('0x20')]=qs['limit'](_0x75e15a[_0xf435('0x35')][_0xf435('0x20')]);_0x513388[_0xf435('0x1f')]=qs[_0xf435('0x1f')](_0x75e15a[_0xf435('0x35')]['offset']);}_0x513388[_0xf435('0x5b')]=qs['sort'](_0x75e15a[_0xf435('0x35')][_0xf435('0x3e')]);_0x513388[_0xf435('0x3f')]=qs[_0xf435('0x37')](_[_0xf435('0x40')](_0x75e15a[_0xf435('0x35')],_0x5df1f1[_0xf435('0x37')]));_0x513388[_0xf435('0x3f')][_0xf435('0x5c')]=_0x480151['id'];if(_0x75e15a[_0xf435('0x35')][_0xf435('0x43')]){_0x513388[_0xf435('0x3f')]=_[_0xf435('0x41')](_0x513388[_0xf435('0x3f')],{'$or':_[_0xf435('0x2f')](_0x513388[_0xf435('0x39')],function(_0x3a60ce){var _0x1597fc={};_0x1597fc[_0x3a60ce]={'$like':'%'+_0x75e15a[_0xf435('0x35')][_0xf435('0x43')]+'%'};return _0x1597fc;})});}_0x513388=_[_0xf435('0x41')]({},_0x513388,_0x75e15a[_0xf435('0x4c')]);return db[_0xf435('0x5d')][_0xf435('0x46')](_0x513388);}})['then'](function(_0x2143e7){if(_0x2143e7){return db[_0xf435('0x5e')][_0xf435('0x5f')]({'where':{'id':_['map'](_0x2143e7,'UserId'),'role':_0xf435('0x60')},'attributes':['id',_0xf435('0x2d'),_0xf435('0x61'),_0xf435('0x62'),_0xf435('0x63')]});}})['then'](function(_0x1b88ca){if(_0x1b88ca){return{'count':_0x1b88ca[_0xf435('0x21')],'rows':_[_0xf435('0x2f')](_0x1b88ca[_0xf435('0x47')],function(_0x86b17f){return{'membername':_0x86b17f[_0xf435('0x2d')],'UserId':_0x86b17f['id'],'queue_name':_0x2e0583[_0xf435('0x2d')],'FaxQueueId':_0x2e0583['id'],'interface':util[_0xf435('0x64')](_0xf435('0x65'),_0xf435('0x66'),_0x86b17f['name']),'penalty':0x0,'paused':_0x86b17f[_0xf435('0x61')],'createdAt':_0x86b17f[_0xf435('0x63')],'updatedAt':_0x86b17f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xf435('0x26')](respondWithFilteredResult(_0x3c8f0f,_0x513388))['catch'](handleError(_0x3c8f0f,null));};exports['getTeams']=function(_0x598bdb,_0x1e2360,_0x476837){var _0xa1b68d={};var _0x111ace={};var _0xff2232;var _0x410399;return db[_0xf435('0x45')][_0xf435('0x5a')]({'where':{'id':_0x598bdb[_0xf435('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1e2360,null))[_0xf435('0x26')](function(_0x5c6414){if(_0x5c6414){_0xff2232=_0x5c6414;_0x111ace[_0xf435('0x34')]=_[_0xf435('0x36')](db['Team'][_0xf435('0x30')]);_0x111ace['query']=_[_0xf435('0x36')](_0x598bdb['query']);_0x111ace[_0xf435('0x37')]=_[_0xf435('0x38')](_0x111ace[_0xf435('0x34')],_0x111ace[_0xf435('0x35')]);_0xa1b68d[_0xf435('0x39')]=_['intersection'](_0x111ace[_0xf435('0x34')],qs[_0xf435('0x3a')](_0x598bdb[_0xf435('0x35')][_0xf435('0x3a')]));_0xa1b68d[_0xf435('0x39')]=_0xa1b68d['attributes'][_0xf435('0x3b')]?_0xa1b68d[_0xf435('0x39')]:_0x111ace['model'];_0xa1b68d[_0xf435('0x5b')]=qs[_0xf435('0x3e')](_0x598bdb[_0xf435('0x35')][_0xf435('0x3e')]);_0xa1b68d[_0xf435('0x3f')]=qs[_0xf435('0x37')](_[_0xf435('0x40')](_0x598bdb['query'],_0x111ace['filters']));if(_0x598bdb[_0xf435('0x35')][_0xf435('0x43')]){_0xa1b68d[_0xf435('0x3f')]=_[_0xf435('0x41')](_0xa1b68d[_0xf435('0x3f')],{'$or':_[_0xf435('0x2f')](_0xa1b68d[_0xf435('0x39')],function(_0xe816ea){var _0x17a722={};_0x17a722[_0xe816ea]={'$like':'%'+_0x598bdb[_0xf435('0x35')][_0xf435('0x43')]+'%'};return _0x17a722;})});}_0xa1b68d=_['merge']({},_0xa1b68d,_0x598bdb[_0xf435('0x4c')]);return _0xff2232['getTeams'](_0xa1b68d);}})['then'](function(_0x157e1d){if(_0x157e1d){_0x410399=_0x157e1d[_0xf435('0x3b')];if(!_0x598bdb[_0xf435('0x35')]['hasOwnProperty'](_0xf435('0x3d'))){_0xa1b68d[_0xf435('0x20')]=qs[_0xf435('0x20')](_0x598bdb[_0xf435('0x35')][_0xf435('0x20')]);_0xa1b68d[_0xf435('0x1f')]=qs[_0xf435('0x1f')](_0x598bdb[_0xf435('0x35')]['offset']);}return _0xff2232[_0xf435('0x67')](_0xa1b68d);}})[_0xf435('0x26')](function(_0x58da37){if(_0x58da37){return _0x58da37?{'count':_0x410399,'rows':_0x58da37}:null;}})[_0xf435('0x26')](respondWithResult(_0x1e2360,null))['catch'](handleError(_0x1e2360,null));};exports['addTeams']=function(_0x5d87f7,_0x38e7de,_0x1463b4){var _0x7bb73f=_0x5d87f7[_0xf435('0x57')]['ids'];return db['Team'][_0xf435('0x46')]({'where':{'id':_0x7bb73f},'attributes':['id'],'include':[{'model':db[_0xf435('0x5e')],'as':_0xf435('0x68'),'attributes':['id',_0xf435('0x2d'),_0xf435('0x69'),_0xf435('0x6a'),_0xf435('0x6b')],'raw':!![]}]})[_0xf435('0x26')](function(_0x529f41){if(_0x529f41){var _0x694fd=_[_0xf435('0x6c')](_0x529f41,function(_0x292884){var _0x152a25=_0x292884['get']({'plain':!![]});return _0x152a25[_0xf435('0x68')];});return db[_0xf435('0x45')]['find']({'where':{'id':_0x5d87f7['params']['id']}})['then'](function(_0x1840f5){return db[_0xf435('0x6d')][_0xf435('0x6e')](function(_0x22b815){return _0x1840f5[_0xf435('0x6f')](_0x7bb73f,{'transaction':_0x22b815})[_0xf435('0x26')](function(){return BPromise[_0xf435('0x70')](_0x694fd,function(_0x3a6249){return db['UserFaxQueue'][_0xf435('0x71')]({'where':{'UserId':_0x3a6249['id'],'FaxQueueId':_0x5d87f7[_0xf435('0x4a')]['id']},'transaction':_0x22b815});});})[_0xf435('0x26')](function(){_0x694fd['forEach'](function(_0x512d56){socket['emit'](_0xf435('0x72'),{'UserId':_0x512d56['id'],'FaxQueueId':_0x1840f5['id']});});});});});}})[_0xf435('0x26')](respondWithStatusCode(_0x38e7de,null))[_0xf435('0x48')](handleError(_0x38e7de,null));};exports[_0xf435('0x73')]=function(_0x27e45a,_0x3dd7f2,_0x4e56e4){return db[_0xf435('0x74')][_0xf435('0x46')]({'where':{'id':_0x27e45a[_0xf435('0x35')][_0xf435('0x75')]},'attributes':['id'],'include':[{'model':db[_0xf435('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf435('0x26')](handleEntityNotFound(_0x3dd7f2,null))['then'](function(_0x2d6be6){var _0x132e35=_[_0xf435('0x2f')](_0x2d6be6,'id');var _0x1d5cf0=[];var _0x50c4af=[];var _0x1966f9=squel[_0xf435('0x76')]();_0x1966f9[_0xf435('0x77')](_0xf435('0x78'))[_0xf435('0x79')](_0xf435('0x7a'),'tq')['join'](_0xf435('0x7b'),'ut',_0xf435('0x7c'))[_0xf435('0x3f')](_0xf435('0x7d'),_0x27e45a[_0xf435('0x4a')]['id']);for(var _0x30ef0f=0x0;_0x30ef0f<_0x2d6be6[_0xf435('0x3b')];_0x30ef0f+=0x1){let _0x39a102=_0x2d6be6[_0x30ef0f];for(var _0x516f02=0x0;_0x516f02<_0x39a102['Agents'][_0xf435('0x3b')];_0x516f02+=0x1){let _0x237fda=_0x39a102[_0xf435('0x68')][_0x516f02];var _0xa53acf=_0x1966f9[_0xf435('0x7e')]();_0xa53acf[_0xf435('0x3f')](_0xf435('0x7f'),_0x237fda['id']);_0x50c4af[_0xf435('0x80')](db[_0xf435('0x6d')][_0xf435('0x35')](_0xa53acf['toString'](),{'type':db[_0xf435('0x6d')][_0xf435('0x81')][_0xf435('0x82')]})['then'](function(_0x4c6a51){if(_0x4c6a51['length']===0x1){return _0x237fda['id'];}else{var _0x4a5db5=_[_0xf435('0x83')](_[_0xf435('0x2f')](_0x4c6a51,'TeamId'),function(_0xa34368){return _[_0xf435('0x84')](_0x132e35,_0xa34368);});if(_0x4a5db5){return _0x237fda['id'];}}}));}}return BPromise[_0xf435('0x85')](_0x50c4af)[_0xf435('0x26')](function(_0x5a9209){_0x1d5cf0=_(_0x1d5cf0)[_0xf435('0x86')](_0x5a9209)[_0xf435('0x87')]()[_0xf435('0x88')]();return db[_0xf435('0x45')]['find']({'where':{'id':_0x27e45a[_0xf435('0x4a')]['id']}})[_0xf435('0x26')](function(_0x9a888){return db[_0xf435('0x6d')][_0xf435('0x6e')](function(_0x35a80b){return _0x9a888[_0xf435('0x73')](_0x27e45a[_0xf435('0x35')][_0xf435('0x75')],{'transaction':_0x35a80b})[_0xf435('0x26')](function(){if(!_[_0xf435('0x89')](_0x1d5cf0)){return _0x9a888[_0xf435('0x8a')](_0x1d5cf0,{'transaction':_0x35a80b});}})[_0xf435('0x26')](function(){_0x1d5cf0['forEach'](function(_0x395fa8){socket[_0xf435('0x8b')](_0xf435('0x8c'),{'UserId':_0x395fa8,'FaxQueueId':_0x9a888['id']});});});});});});})[_0xf435('0x26')](respondWithStatusCode(_0x3dd7f2,null))[_0xf435('0x48')](handleError(_0x3dd7f2,null));};exports[_0xf435('0x8d')]=function(_0x3ead81,_0x2d08fb,_0x29bf12){return db[_0xf435('0x45')][_0xf435('0x4d')]({'where':{'id':_0x3ead81[_0xf435('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2d08fb,null))['then'](function(_0x85efcd){if(_0x85efcd){return _0x85efcd[_0xf435('0x8d')](_0x3ead81['body'][_0xf435('0x75')],_[_0xf435('0x8e')](_0x3ead81[_0xf435('0x57')],[_0xf435('0x75'),'id'])||{})[_0xf435('0x8f')](function(_0x27a699){for(var _0x23f7bb=0x0;_0x23f7bb<_0x3ead81['body'][_0xf435('0x75')][_0xf435('0x3b')];_0x23f7bb+=0x1){socket['emit'](_0xf435('0x72'),{'UserId':Number(_0x3ead81[_0xf435('0x57')][_0xf435('0x75')][_0x23f7bb]),'FaxQueueId':Number(_0x3ead81[_0xf435('0x4a')]['id'])});}return _0x27a699;});}})[_0xf435('0x26')](respondWithResult(_0x2d08fb,null))[_0xf435('0x48')](handleError(_0x2d08fb,null));};exports['removeAgents']=function(_0x55fdf4,_0xfc4a5,_0x465fa7){return db[_0xf435('0x45')][_0xf435('0x4d')]({'where':{'id':_0x55fdf4[_0xf435('0x4a')]['id']}})[_0xf435('0x26')](handleEntityNotFound(_0xfc4a5,null))[_0xf435('0x26')](function(_0x13acdd){if(_0x13acdd){return _0x13acdd['removeAgents'](_0x55fdf4[_0xf435('0x35')][_0xf435('0x75')])['then'](function(){if(_['isArray'](_0x55fdf4['query'][_0xf435('0x75')])){for(var _0x36820f=0x0;_0x36820f<_0x55fdf4[_0xf435('0x35')][_0xf435('0x75')][_0xf435('0x3b')];_0x36820f+=0x1){socket[_0xf435('0x8b')]('userFaxQueue:remove',{'UserId':Number(_0x55fdf4[_0xf435('0x35')][_0xf435('0x75')][_0x36820f]),'FaxQueueId':Number(_0x55fdf4[_0xf435('0x4a')]['id'])});}}else{socket[_0xf435('0x8b')](_0xf435('0x8c'),{'UserId':Number(_0x55fdf4[_0xf435('0x35')]['ids']),'FaxQueueId':Number(_0x55fdf4[_0xf435('0x4a')]['id'])});}});}})[_0xf435('0x26')](respondWithStatusCode(_0xfc4a5,null))[_0xf435('0x48')](handleError(_0xfc4a5,null));};exports['getAgents']=function(_0x2cec41,_0x23cc64,_0x29df52){var _0x1eacea={};var _0x2ee084={};var _0xe5afe0;var _0x172972;return db[_0xf435('0x45')]['findOne']({'where':{'id':_0x2cec41[_0xf435('0x4a')]['id']}})[_0xf435('0x26')](handleEntityNotFound(_0x23cc64,null))[_0xf435('0x26')](function(_0x28352b){if(_0x28352b){_0xe5afe0=_0x28352b;_0x2ee084[_0xf435('0x34')]=_[_0xf435('0x36')](db[_0xf435('0x5e')]['rawAttributes']);_0x2ee084[_0xf435('0x35')]=_[_0xf435('0x36')](_0x2cec41[_0xf435('0x35')]);_0x2ee084[_0xf435('0x37')]=_[_0xf435('0x38')](_0x2ee084[_0xf435('0x34')],_0x2ee084['query']);_0x1eacea[_0xf435('0x39')]=_['intersection'](_0x2ee084[_0xf435('0x34')],qs['fields'](_0x2cec41[_0xf435('0x35')][_0xf435('0x3a')]));_0x1eacea['attributes']=_0x1eacea['attributes']['length']?_0x1eacea[_0xf435('0x39')]:_0x2ee084['model'];_0x1eacea['order']=qs[_0xf435('0x3e')](_0x2cec41[_0xf435('0x35')][_0xf435('0x3e')]);_0x1eacea[_0xf435('0x3f')]=qs['filters'](_[_0xf435('0x40')](_0x2cec41[_0xf435('0x35')],_0x2ee084[_0xf435('0x37')]));if(_0x2cec41['query'][_0xf435('0x43')]){_0x1eacea[_0xf435('0x3f')]=_[_0xf435('0x41')](_0x1eacea[_0xf435('0x3f')],{'$or':_[_0xf435('0x2f')](_0x1eacea['attributes'],function(_0x57cbf8){var _0x648ed={};_0x648ed[_0x57cbf8]={'$like':'%'+_0x2cec41[_0xf435('0x35')][_0xf435('0x43')]+'%'};return _0x648ed;})});}_0x1eacea=_[_0xf435('0x41')]({},_0x1eacea,_0x2cec41[_0xf435('0x4c')]);return _0xe5afe0['getAgents'](_0x1eacea);}})['then'](function(_0x55fd27){if(_0x55fd27){_0x172972=_0x55fd27[_0xf435('0x3b')];if(!_0x2cec41[_0xf435('0x35')][_0xf435('0x3c')](_0xf435('0x3d'))){_0x1eacea['limit']=qs[_0xf435('0x20')](_0x2cec41[_0xf435('0x35')][_0xf435('0x20')]);_0x1eacea[_0xf435('0x1f')]=qs['offset'](_0x2cec41['query'][_0xf435('0x1f')]);}return _0xe5afe0['getAgents'](_0x1eacea);}})[_0xf435('0x26')](function(_0x514368){if(_0x514368){return _0x514368?{'count':_0x172972,'rows':_0x514368}:null;}})['then'](respondWithResult(_0x23cc64,null))[_0xf435('0x48')](handleError(_0x23cc64,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 963758b..42b1abb 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 _0xfe10=['../../mysqldb','setMaxListeners','emit','hasOwnProperty','hook','exports','events'];(function(_0x5bd49f,_0x56c495){var _0x2c524f=function(_0x405fd4){while(--_0x405fd4){_0x5bd49f['push'](_0x5bd49f['shift']());}};_0x2c524f(++_0x56c495);}(_0xfe10,0xca));var _0x0fe1=function(_0x1b3763,_0x5c9ba9){_0x1b3763=_0x1b3763-0x0;var _0x2ac31f=_0xfe10[_0x1b3763];return _0x2ac31f;};'use strict';var EventEmitter=require(_0x0fe1('0x0'));var FaxQueue=require(_0x0fe1('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x0fe1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3f8961){return function(_0x818673,_0x3cd2f9,_0x25e8f9){FaxQueueEvents[_0x0fe1('0x3')](_0x3f8961+':'+_0x818673['id'],_0x818673);FaxQueueEvents[_0x0fe1('0x3')](_0x3f8961,_0x818673);_0x25e8f9(null);};}for(var e in events){if(events[_0x0fe1('0x4')](e)){var event=events[e];FaxQueue[_0x0fe1('0x5')](e,emitEvent(event));}}module[_0x0fe1('0x6')]=FaxQueueEvents; \ No newline at end of file +var _0x19eb=['update','remove','emit','hasOwnProperty','hook','events','FaxQueue','setMaxListeners','save'];(function(_0x4529e0,_0x23a383){var _0x31bbc6=function(_0xaf6790){while(--_0xaf6790){_0x4529e0['push'](_0x4529e0['shift']());}};_0x31bbc6(++_0x23a383);}(_0x19eb,0xdd));var _0xb19e=function(_0xcfc44,_0x179bc1){_0xcfc44=_0xcfc44-0x0;var _0x307a25=_0x19eb[_0xcfc44];return _0x307a25;};'use strict';var EventEmitter=require(_0xb19e('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0xb19e('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xb19e('0x2')](0x0);var events={'afterCreate':_0xb19e('0x3'),'afterUpdate':_0xb19e('0x4'),'afterDestroy':_0xb19e('0x5')};function emitEvent(_0x490e0e){return function(_0x1bbeab,_0x339350,_0x2d66bb){FaxQueueEvents[_0xb19e('0x6')](_0x490e0e+':'+_0x1bbeab['id'],_0x1bbeab);FaxQueueEvents[_0xb19e('0x6')](_0x490e0e,_0x1bbeab);_0x2d66bb(null);};}for(var e in events){if(events[_0xb19e('0x7')](e)){var event=events[e];FaxQueue[_0xb19e('0x8')](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 747b24f..4734995 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 _0x1a7b=['define','FaxQueue','lodash','util','../../config/logger','api','moment','rimraf','./faxQueue.attributes'];(function(_0x19925b,_0x2454d7){var _0x3b2c8e=function(_0x4fee09){while(--_0x4fee09){_0x19925b['push'](_0x19925b['shift']());}};_0x3b2c8e(++_0x2454d7);}(_0x1a7b,0x1c4));var _0xb1a7=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0x1a7b[_0x3de7e0];return _0x11d0b3;};'use strict';var _=require(_0xb1a7('0x0'));var util=require(_0xb1a7('0x1'));var logger=require(_0xb1a7('0x2'))(_0xb1a7('0x3'));var moment=require(_0xb1a7('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb1a7('0x5'));var config=require('../../config/environment');var attributes=require(_0xb1a7('0x6'));module['exports']=function(_0x3f8e66,_0x9dd4a3){return _0x3f8e66[_0xb1a7('0x7')](_0xb1a7('0x8'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd37c=['../../config/environment','./faxQueue.attributes','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xd37c,0x17f));var _0xcd37=function(_0x229d2a,_0x1880ba){_0x229d2a=_0x229d2a-0x0;var _0x19783f=_0xd37c[_0x229d2a];return _0x19783f;};'use strict';var _=require(_0xcd37('0x0'));var util=require(_0xcd37('0x1'));var logger=require(_0xcd37('0x2'))(_0xcd37('0x3'));var moment=require(_0xcd37('0x4'));var BPromise=require(_0xcd37('0x5'));var rp=require(_0xcd37('0x6'));var fs=require('fs');var path=require(_0xcd37('0x7'));var rimraf=require(_0xcd37('0x8'));var config=require(_0xcd37('0x9'));var attributes=require(_0xcd37('0xa'));module['exports']=function(_0x592868,_0x83e484){return _0x592868[_0xcd37('0xb')](_0xcd37('0xc'),attributes,{'tableName':_0xcd37('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index ef441ff..17eea97 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 _0x3970=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','attributes','limit','include','map','model','find','where','ShowFaxQueue','lodash','bluebird','randomstring','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3970,0x1dd));var _0x0397=function(_0x5f1617,_0x46277b){_0x5f1617=_0x5f1617-0x0;var _0x3af5da=_0x3970[_0x5f1617];return _0x3af5da;};'use strict';var _=require(_0x0397('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0397('0x1'));var rs=require(_0x0397('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0397('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0397('0x4'))('rpc');var config=require(_0x0397('0x5'));var jayson=require(_0x0397('0x6'));var client=jayson[_0x0397('0x7')][_0x0397('0x8')]({'port':0x232a});config[_0x0397('0x9')]=_[_0x0397('0xa')](config['redis'],{'host':_0x0397('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0397('0x9')]));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x5e066a,_0x153c27,_0x2d5568){return new BPromise(function(_0x104773,_0x57c55d){return client['request'](_0x5e066a,_0x2d5568)[_0x0397('0xc')](function(_0x287686){logger['info'](_0x0397('0xd'),_0x153c27,_0x0397('0xe'));logger[_0x0397('0xf')](_0x0397('0x10'),_0x153c27,_0x0397('0xe'),JSON[_0x0397('0x11')](_0x287686));if(_0x287686[_0x0397('0x12')]){if(_0x287686[_0x0397('0x12')][_0x0397('0x13')]===0x1f4){logger[_0x0397('0x12')](_0x0397('0xd'),_0x153c27,_0x287686['error'][_0x0397('0x14')]);return _0x57c55d(_0x287686[_0x0397('0x12')]['message']);}logger['error'](_0x0397('0xd'),_0x153c27,_0x287686['error'][_0x0397('0x14')]);return _0x104773(_0x287686[_0x0397('0x12')][_0x0397('0x14')]);}else{logger[_0x0397('0x15')](_0x0397('0xd'),_0x153c27,_0x0397('0xe'));_0x104773(_0x287686[_0x0397('0x16')]['message']);}})[_0x0397('0x17')](function(_0x511499){logger[_0x0397('0x12')](_0x0397('0xd'),_0x153c27,_0x511499);_0x57c55d(_0x511499);});});}exports[_0x0397('0x18')]=function(_0x128cd5){var _0x3efeaf=this;return new Promise(function(_0x4c6a03,_0x53821b){return db[_0x0397('0x19')][_0x0397('0x1a')]({'raw':_0x128cd5[_0x0397('0x1b')]?_0x128cd5['options'][_0x0397('0x1c')]===undefined?!![]:![]:!![],'where':_0x128cd5[_0x0397('0x1b')]?_0x128cd5['options']['where']||null:null,'attributes':_0x128cd5[_0x0397('0x1b')]?_0x128cd5[_0x0397('0x1b')][_0x0397('0x1d')]||null:null,'limit':_0x128cd5[_0x0397('0x1b')]?_0x128cd5[_0x0397('0x1b')][_0x0397('0x1e')]||null:null,'include':_0x128cd5[_0x0397('0x1b')]?_0x128cd5[_0x0397('0x1b')][_0x0397('0x1f')]?_[_0x0397('0x20')](_0x128cd5[_0x0397('0x1b')][_0x0397('0x1f')],function(_0x12746b){return{'model':db[_0x12746b['model']],'as':_0x12746b['as'],'attributes':_0x12746b[_0x0397('0x1d')],'include':_0x12746b[_0x0397('0x1f')]?_['map'](_0x12746b[_0x0397('0x1f')],function(_0x10fad5){return{'model':db[_0x10fad5['model']],'as':_0x10fad5['as'],'attributes':_0x10fad5[_0x0397('0x1d')],'include':_0x10fad5['include']?_[_0x0397('0x20')](_0x10fad5[_0x0397('0x1f')],function(_0x1d9d07){return{'model':db[_0x1d9d07[_0x0397('0x21')]],'as':_0x1d9d07['as'],'attributes':_0x1d9d07[_0x0397('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0397('0xc')](function(_0x4308ed){logger[_0x0397('0x15')](_0x0397('0x18'),_0x128cd5);logger[_0x0397('0xf')](_0x0397('0x18'),_0x128cd5,JSON[_0x0397('0x11')](_0x4308ed));_0x4c6a03(_0x4308ed);})[_0x0397('0x17')](function(_0x3654ca){logger['error'](_0x0397('0x18'),_0x3654ca[_0x0397('0x14')],_0x128cd5);_0x53821b(_0x3efeaf['error'](0x1f4,_0x3654ca[_0x0397('0x14')]));});});};exports['ShowFaxQueue']=function(_0x8afad0){var _0x13bb03=this;return new Promise(function(_0x4b8050,_0x50a0f2){return db[_0x0397('0x19')][_0x0397('0x22')]({'raw':_0x8afad0[_0x0397('0x1b')]?_0x8afad0[_0x0397('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x8afad0[_0x0397('0x1b')]?_0x8afad0[_0x0397('0x1b')][_0x0397('0x23')]||null:null,'attributes':_0x8afad0[_0x0397('0x1b')]?_0x8afad0[_0x0397('0x1b')][_0x0397('0x1d')]||null:null,'include':_0x8afad0[_0x0397('0x1b')]?_0x8afad0[_0x0397('0x1b')]['include']?_['map'](_0x8afad0['options'][_0x0397('0x1f')],function(_0x4e300c){return{'model':db[_0x4e300c['model']],'as':_0x4e300c['as'],'attributes':_0x4e300c[_0x0397('0x1d')],'include':_0x4e300c[_0x0397('0x1f')]?_[_0x0397('0x20')](_0x4e300c[_0x0397('0x1f')],function(_0x2367f7){return{'model':db[_0x2367f7[_0x0397('0x21')]],'as':_0x2367f7['as'],'attributes':_0x2367f7[_0x0397('0x1d')],'include':_0x2367f7[_0x0397('0x1f')]?_[_0x0397('0x20')](_0x2367f7[_0x0397('0x1f')],function(_0x2a9853){return{'model':db[_0x2a9853[_0x0397('0x21')]],'as':_0x2a9853['as'],'attributes':_0x2a9853[_0x0397('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0397('0xc')](function(_0x39ea1a){logger[_0x0397('0x15')]('ShowFaxQueue',_0x8afad0);logger[_0x0397('0xf')](_0x0397('0x24'),_0x8afad0,JSON[_0x0397('0x11')](_0x39ea1a));_0x4b8050(_0x39ea1a);})[_0x0397('0x17')](function(_0x4ea403){logger[_0x0397('0x12')](_0x0397('0x24'),_0x4ea403[_0x0397('0x14')],_0x8afad0);_0x50a0f2(_0x13bb03[_0x0397('0x12')](0x1f4,_0x4ea403['message']));});});}; \ No newline at end of file +var _0x16f4=['raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxQueue,\x20%s,\x20%s','catch','GetFaxQueue','FaxQueue','findAll','options','where','attributes','limit','include','map','model','ShowFaxQueue','find'];(function(_0x2bdf04,_0x5e608e){var _0x33ce04=function(_0x357c41){while(--_0x357c41){_0x2bdf04['push'](_0x2bdf04['shift']());}};_0x33ce04(++_0x5e608e);}(_0x16f4,0x1e1));var _0x416f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x16f4[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x416f('0x0'));var util=require(_0x416f('0x1'));var moment=require(_0x416f('0x2'));var BPromise=require(_0x416f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x416f('0x4'));var db=require(_0x416f('0x5'))['db'];var utils=require(_0x416f('0x6'));var logger=require('../../config/logger')(_0x416f('0x7'));var config=require(_0x416f('0x8'));var jayson=require(_0x416f('0x9'));var client=jayson[_0x416f('0xa')]['http']({'port':0x232a});config[_0x416f('0xb')]=_[_0x416f('0xc')](config[_0x416f('0xb')],{'host':_0x416f('0xd'),'port':0x18eb});var socket=require(_0x416f('0xe'))(new Redis(config[_0x416f('0xb')]));require(_0x416f('0xf'))['register'](socket);function respondWithRpcPromise(_0xda4425,_0x109277,_0x1f456d){return new BPromise(function(_0x200d10,_0x2e6a65){return client['request'](_0xda4425,_0x1f456d)[_0x416f('0x10')](function(_0x5ae682){logger[_0x416f('0x11')]('FaxQueue,\x20%s,\x20%s',_0x109277,_0x416f('0x12'));logger[_0x416f('0x13')](_0x416f('0x14'),_0x109277,_0x416f('0x12'),JSON[_0x416f('0x15')](_0x5ae682));if(_0x5ae682[_0x416f('0x16')]){if(_0x5ae682[_0x416f('0x16')][_0x416f('0x17')]===0x1f4){logger[_0x416f('0x16')]('FaxQueue,\x20%s,\x20%s',_0x109277,_0x5ae682[_0x416f('0x16')][_0x416f('0x18')]);return _0x2e6a65(_0x5ae682[_0x416f('0x16')][_0x416f('0x18')]);}logger[_0x416f('0x16')](_0x416f('0x19'),_0x109277,_0x5ae682['error']['message']);return _0x200d10(_0x5ae682[_0x416f('0x16')][_0x416f('0x18')]);}else{logger['info'](_0x416f('0x19'),_0x109277,_0x416f('0x12'));_0x200d10(_0x5ae682['result'][_0x416f('0x18')]);}})[_0x416f('0x1a')](function(_0x547edb){logger['error'](_0x416f('0x19'),_0x109277,_0x547edb);_0x2e6a65(_0x547edb);});});}exports[_0x416f('0x1b')]=function(_0x4aec39){var _0x2a6b0d=this;return new Promise(function(_0x1ac1b1,_0x41403e){return db[_0x416f('0x1c')][_0x416f('0x1d')]({'raw':_0x4aec39['options']?_0x4aec39[_0x416f('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x4aec39[_0x416f('0x1e')]?_0x4aec39[_0x416f('0x1e')][_0x416f('0x1f')]||null:null,'attributes':_0x4aec39[_0x416f('0x1e')]?_0x4aec39[_0x416f('0x1e')][_0x416f('0x20')]||null:null,'limit':_0x4aec39[_0x416f('0x1e')]?_0x4aec39[_0x416f('0x1e')][_0x416f('0x21')]||null:null,'include':_0x4aec39[_0x416f('0x1e')]?_0x4aec39['options'][_0x416f('0x22')]?_[_0x416f('0x23')](_0x4aec39[_0x416f('0x1e')][_0x416f('0x22')],function(_0xafde97){return{'model':db[_0xafde97['model']],'as':_0xafde97['as'],'attributes':_0xafde97[_0x416f('0x20')],'include':_0xafde97[_0x416f('0x22')]?_[_0x416f('0x23')](_0xafde97[_0x416f('0x22')],function(_0x553298){return{'model':db[_0x553298[_0x416f('0x24')]],'as':_0x553298['as'],'attributes':_0x553298[_0x416f('0x20')],'include':_0x553298[_0x416f('0x22')]?_['map'](_0x553298[_0x416f('0x22')],function(_0x43d3ab){return{'model':db[_0x43d3ab[_0x416f('0x24')]],'as':_0x43d3ab['as'],'attributes':_0x43d3ab[_0x416f('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4dfa7a){logger['info'](_0x416f('0x1b'),_0x4aec39);logger[_0x416f('0x13')](_0x416f('0x1b'),_0x4aec39,JSON[_0x416f('0x15')](_0x4dfa7a));_0x1ac1b1(_0x4dfa7a);})[_0x416f('0x1a')](function(_0x151138){logger[_0x416f('0x16')](_0x416f('0x1b'),_0x151138['message'],_0x4aec39);_0x41403e(_0x2a6b0d[_0x416f('0x16')](0x1f4,_0x151138[_0x416f('0x18')]));});});};exports[_0x416f('0x25')]=function(_0x1bee13){var _0x120a2c=this;return new Promise(function(_0x2c0d18,_0x512e86){return db[_0x416f('0x1c')][_0x416f('0x26')]({'raw':_0x1bee13[_0x416f('0x1e')]?_0x1bee13[_0x416f('0x1e')][_0x416f('0x27')]===undefined?!![]:![]:!![],'where':_0x1bee13[_0x416f('0x1e')]?_0x1bee13[_0x416f('0x1e')][_0x416f('0x1f')]||null:null,'attributes':_0x1bee13[_0x416f('0x1e')]?_0x1bee13[_0x416f('0x1e')][_0x416f('0x20')]||null:null,'include':_0x1bee13['options']?_0x1bee13[_0x416f('0x1e')]['include']?_[_0x416f('0x23')](_0x1bee13[_0x416f('0x1e')][_0x416f('0x22')],function(_0x244228){return{'model':db[_0x244228[_0x416f('0x24')]],'as':_0x244228['as'],'attributes':_0x244228[_0x416f('0x20')],'include':_0x244228[_0x416f('0x22')]?_[_0x416f('0x23')](_0x244228[_0x416f('0x22')],function(_0x4dcde9){return{'model':db[_0x4dcde9[_0x416f('0x24')]],'as':_0x4dcde9['as'],'attributes':_0x4dcde9[_0x416f('0x20')],'include':_0x4dcde9['include']?_[_0x416f('0x23')](_0x4dcde9['include'],function(_0x843c42){return{'model':db[_0x843c42[_0x416f('0x24')]],'as':_0x843c42['as'],'attributes':_0x843c42['attributes']};}):[]};}):[]};}):[]:[]})[_0x416f('0x10')](function(_0x1f01e0){logger[_0x416f('0x11')](_0x416f('0x25'),_0x1bee13);logger['debug'](_0x416f('0x25'),_0x1bee13,JSON[_0x416f('0x15')](_0x1f01e0));_0x2c0d18(_0x1f01e0);})[_0x416f('0x1a')](function(_0x36be2d){logger[_0x416f('0x16')]('ShowFaxQueue',_0x36be2d[_0x416f('0x18')],_0x1bee13);_0x512e86(_0x120a2c[_0x416f('0x16')](0x1f4,_0x36be2d['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index ab4c0f0..fb3fdc0 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 _0xfd04=['emit','removeListener','faxQueue:','save','remove','update'];(function(_0xee4489,_0x4296e2){var _0xe2c70c=function(_0x274412){while(--_0x274412){_0xee4489['push'](_0xee4489['shift']());}};_0xe2c70c(++_0x4296e2);}(_0xfd04,0xe1));var _0x4fd0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfd04[_0x321bb2];return _0x9c12ed;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x4fd0('0x0'),_0x4fd0('0x1'),_0x4fd0('0x2')];function createListener(_0x631205,_0x7ee53a){return function(_0x3fed28){_0x7ee53a[_0x4fd0('0x3')](_0x631205,_0x3fed28);};}function removeListener(_0x2532fa,_0x4c8bdf){return function(){FaxQueueEvents[_0x4fd0('0x4')](_0x2532fa,_0x4c8bdf);};}exports['register']=function(_0x4261a4){for(var _0x27d210=0x0,_0x3b2155=events['length'];_0x27d210<_0x3b2155;_0x27d210++){var _0x16dc8e=events[_0x27d210];var _0x40b742=createListener(_0x4fd0('0x5')+_0x16dc8e,_0x4261a4);FaxQueueEvents['on'](_0x16dc8e,_0x40b742);}}; \ No newline at end of file +var _0x1d50=['./faxQueue.events','save','emit','removeListener','register','length','faxQueue:'];(function(_0x4cf4d7,_0x1d15b9){var _0x4b40b3=function(_0x42a1bd){while(--_0x42a1bd){_0x4cf4d7['push'](_0x4cf4d7['shift']());}};_0x4b40b3(++_0x1d15b9);}(_0x1d50,0x1c7));var _0x01d5=function(_0x10d592,_0x1bc85a){_0x10d592=_0x10d592-0x0;var _0x1eb97c=_0x1d50[_0x10d592];return _0x1eb97c;};'use strict';var FaxQueueEvents=require(_0x01d5('0x0'));var events=[_0x01d5('0x1'),'remove','update'];function createListener(_0x4e107e,_0x506804){return function(_0xd5edc5){_0x506804[_0x01d5('0x2')](_0x4e107e,_0xd5edc5);};}function removeListener(_0x259b11,_0x5be960){return function(){FaxQueueEvents[_0x01d5('0x3')](_0x259b11,_0x5be960);};}exports[_0x01d5('0x4')]=function(_0x3d76e5){for(var _0x468113=0x0,_0x265815=events[_0x01d5('0x5')];_0x468113<_0x265815;_0x468113++){var _0x5bd859=events[_0x468113];var _0x34e873=createListener(_0x01d5('0x6')+_0x5bd859,_0x3d76e5);FaxQueueEvents['on'](_0x5bd859,_0x34e873);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 24afe73..6951149 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 _0xbff5=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/users','getAgents','create','/:id/teams','addAgents','update','destroy','removeTeams'];(function(_0x30bb33,_0x2fb111){var _0x38ae3e=function(_0x1d2387){while(--_0x1d2387){_0x30bb33['push'](_0x30bb33['shift']());}};_0x38ae3e(++_0x2fb111);}(_0xbff5,0x1bc));var _0x5bff=function(_0x4af0a9,_0x42f9f5){_0x4af0a9=_0x4af0a9-0x0;var _0x250ec1=_0xbff5[_0x4af0a9];return _0x250ec1;};'use strict';var multer=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var path=require(_0x5bff('0x2'));var timeout=require(_0x5bff('0x3'));var express=require(_0x5bff('0x4'));var router=express[_0x5bff('0x5')]();var fs_extra=require(_0x5bff('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5bff('0x7'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0x5bff('0x8')]('/',auth[_0x5bff('0x9')](),controller[_0x5bff('0xa')]);router[_0x5bff('0x8')](_0x5bff('0xb'),auth[_0x5bff('0x9')](),controller[_0x5bff('0xc')]);router[_0x5bff('0x8')](_0x5bff('0xd'),auth['isAuthenticated'](),controller[_0x5bff('0xe')]);router['get'](_0x5bff('0xf'),auth[_0x5bff('0x9')](),controller['getMembers']);router[_0x5bff('0x8')]('/:id/teams',auth[_0x5bff('0x9')](),controller['getTeams']);router[_0x5bff('0x8')](_0x5bff('0x10'),auth['isAuthenticated'](),controller[_0x5bff('0x11')]);router['post']('/',auth[_0x5bff('0x9')](),controller[_0x5bff('0x12')]);router['post'](_0x5bff('0x13'),auth[_0x5bff('0x9')](),controller['addTeams']);router['post'](_0x5bff('0x10'),auth[_0x5bff('0x9')](),controller[_0x5bff('0x14')]);router['put'](_0x5bff('0xd'),auth[_0x5bff('0x9')](),controller[_0x5bff('0x15')]);router['delete'](_0x5bff('0xd'),auth[_0x5bff('0x9')](),controller[_0x5bff('0x16')]);router['delete'](_0x5bff('0x13'),auth[_0x5bff('0x9')](),controller[_0x5bff('0x17')]);router[_0x5bff('0x18')]('/:id/users',auth[_0x5bff('0x9')](),controller['removeAgents']);module[_0x5bff('0x19')]=router; \ No newline at end of file +var _0x5f6f=['get','isAuthenticated','index','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller'];(function(_0x2ae210,_0x25c79e){var _0x20f69e=function(_0x46361a){while(--_0x46361a){_0x2ae210['push'](_0x2ae210['shift']());}};_0x20f69e(++_0x25c79e);}(_0x5f6f,0x1ef));var _0xf5f6=function(_0x21774b,_0x4a6d2b){_0x21774b=_0x21774b-0x0;var _0x4675b2=_0x5f6f[_0x21774b];return _0x4675b2;};'use strict';var multer=require(_0xf5f6('0x0'));var util=require(_0xf5f6('0x1'));var path=require(_0xf5f6('0x2'));var timeout=require(_0xf5f6('0x3'));var express=require(_0xf5f6('0x4'));var router=express['Router']();var fs_extra=require(_0xf5f6('0x5'));var auth=require(_0xf5f6('0x6'));var interaction=require(_0xf5f6('0x7'));var config=require('../../config/environment');var controller=require(_0xf5f6('0x8'));router[_0xf5f6('0x9')]('/',auth[_0xf5f6('0xa')](),controller[_0xf5f6('0xb')]);router['get']('/describe',auth[_0xf5f6('0xa')](),controller[_0xf5f6('0xc')]);router[_0xf5f6('0x9')](_0xf5f6('0xd'),auth[_0xf5f6('0xa')](),controller[_0xf5f6('0xe')]);router['get']('/:id/members',auth[_0xf5f6('0xa')](),controller[_0xf5f6('0xf')]);router['get'](_0xf5f6('0x10'),auth[_0xf5f6('0xa')](),controller[_0xf5f6('0x11')]);router[_0xf5f6('0x9')](_0xf5f6('0x12'),auth['isAuthenticated'](),controller[_0xf5f6('0x13')]);router['post']('/',auth[_0xf5f6('0xa')](),controller[_0xf5f6('0x14')]);router[_0xf5f6('0x15')](_0xf5f6('0x10'),auth['isAuthenticated'](),controller[_0xf5f6('0x16')]);router[_0xf5f6('0x15')](_0xf5f6('0x12'),auth[_0xf5f6('0xa')](),controller['addAgents']);router[_0xf5f6('0x17')](_0xf5f6('0xd'),auth[_0xf5f6('0xa')](),controller[_0xf5f6('0x18')]);router['delete']('/:id',auth[_0xf5f6('0xa')](),controller['destroy']);router[_0xf5f6('0x19')]('/:id/teams',auth[_0xf5f6('0xa')](),controller[_0xf5f6('0x1a')]);router[_0xf5f6('0x19')](_0xf5f6('0x12'),auth[_0xf5f6('0xa')](),controller[_0xf5f6('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index adb4c97..838fec7 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 _0x102c=['sequelize','exports','STRING','DATE','moment'];(function(_0x248703,_0xa58c07){var _0x12daa9=function(_0x53250b){while(--_0x53250b){_0x248703['push'](_0x248703['shift']());}};_0x12daa9(++_0xa58c07);}(_0x102c,0xf9));var _0xc102=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x102c[_0x2b7764];return _0x848dcb;};'use strict';var moment=require(_0xc102('0x0'));var Sequelize=require(_0xc102('0x1'));module[_0xc102('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xc102('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xc102('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xc102('0x4')]},'reason':{'type':Sequelize[_0xc102('0x3')]}}; \ No newline at end of file +var _0x9a15=['DATE','moment','sequelize','exports','STRING'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x9a15,0x12d));var _0x59a1=function(_0x3340d4,_0x418571){_0x3340d4=_0x3340d4-0x0;var _0x30d830=_0x9a15[_0x3340d4];return _0x30d830;};'use strict';var moment=require(_0x59a1('0x0'));var Sequelize=require(_0x59a1('0x1'));module[_0x59a1('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x59a1('0x3')]},'joinAt':{'type':Sequelize[_0x59a1('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x59a1('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 40c89ee..0ae7314 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 _0x167e=['catch','show','params','keys','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','stack','name','index','FaxQueueReport','rawAttributes','type','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','then'];(function(_0x22a032,_0x55ec98){var _0x4347ff=function(_0x7e25ec){while(--_0x7e25ec){_0x22a032['push'](_0x22a032['shift']());}};_0x4347ff(++_0x55ec98);}(_0x167e,0xa3));var _0xe167=function(_0xa3a593,_0x3e9af8){_0xa3a593=_0xa3a593-0x0;var _0xeb400d=_0x167e[_0xa3a593];return _0xeb400d;};'use strict';var emlformat=require(_0xe167('0x0'));var rimraf=require(_0xe167('0x1'));var zipdir=require(_0xe167('0x2'));var jsonpatch=require(_0xe167('0x3'));var rp=require(_0xe167('0x4'));var moment=require(_0xe167('0x5'));var BPromise=require(_0xe167('0x6'));var Mustache=require(_0xe167('0x7'));var util=require('util');var path=require(_0xe167('0x8'));var sox=require('sox');var csv=require(_0xe167('0x9'));var ejs=require(_0xe167('0xa'));var fs=require('fs');var fs_extra=require(_0xe167('0xb'));var _=require(_0xe167('0xc'));var squel=require(_0xe167('0xd'));var crypto=require('crypto');var jsforce=require(_0xe167('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe167('0x9'));var querystring=require(_0xe167('0xf'));var Papa=require(_0xe167('0x10'));var Redis=require(_0xe167('0x11'));var authService=require(_0xe167('0x12'));var qs=require(_0xe167('0x13'));var as=require(_0xe167('0x14'));var hardwareService=require(_0xe167('0x15'));var logger=require('../../config/logger')(_0xe167('0x16'));var utils=require(_0xe167('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe167('0x18'));var db=require(_0xe167('0x19'))['db'];function respondWithStatusCode(_0x24de78,_0x2c8eed){_0x2c8eed=_0x2c8eed||0xcc;return function(_0x296649){if(_0x296649){return _0x24de78[_0xe167('0x1a')](_0x2c8eed);}return _0x24de78[_0xe167('0x1b')](_0x2c8eed)[_0xe167('0x1c')]();};}function respondWithResult(_0xac90a0,_0x5bdbef){_0x5bdbef=_0x5bdbef||0xc8;return function(_0x3e18b2){if(_0x3e18b2){return _0xac90a0[_0xe167('0x1b')](_0x5bdbef)[_0xe167('0x1d')](_0x3e18b2);}};}function respondWithFilteredResult(_0x639907,_0x4b2bfa){return function(_0x10f6c5){if(_0x10f6c5){var _0x2326f8=typeof _0x4b2bfa[_0xe167('0x1e')]===_0xe167('0x1f')&&typeof _0x4b2bfa[_0xe167('0x20')]==='undefined';var _0x30baf6=_0x10f6c5[_0xe167('0x21')];var _0x369d39=_0x2326f8?0x0:_0x4b2bfa[_0xe167('0x1e')];var _0x469f2a=_0x2326f8?_0x10f6c5[_0xe167('0x21')]:_0x4b2bfa['offset']+_0x4b2bfa[_0xe167('0x20')];var _0x13f97b;if(_0x469f2a>=_0x30baf6){_0x469f2a=_0x30baf6;_0x13f97b=0xc8;}else{_0x13f97b=0xce;}_0x639907[_0xe167('0x1b')](_0x13f97b);return _0x639907[_0xe167('0x22')](_0xe167('0x23'),_0x369d39+'-'+_0x469f2a+'/'+_0x30baf6)['json'](_0x10f6c5);}return null;};}function patchUpdates(_0x46fcc9){return function(_0x3e683f){try{jsonpatch[_0xe167('0x24')](_0x3e683f,_0x46fcc9,!![]);}catch(_0x1eae24){return BPromise[_0xe167('0x25')](_0x1eae24);}return _0x3e683f['save']();};}function saveUpdates(_0x9abc70,_0x1c5cb5){return function(_0x42c076){if(_0x42c076){return _0x42c076['update'](_0x9abc70)['then'](function(_0x54d751){return _0x54d751;});}return null;};}function removeEntity(_0x4e3a16,_0x44b611){return function(_0x1ae758){if(_0x1ae758){return _0x1ae758[_0xe167('0x26')]()['then'](function(){_0x4e3a16[_0xe167('0x1b')](0xcc)[_0xe167('0x1c')]();});}};}function handleEntityNotFound(_0x28a706,_0x17c596){return function(_0x501460){if(!_0x501460){_0x28a706[_0xe167('0x1a')](0x194);}return _0x501460;};}function handleError(_0x5b3f9f,_0x885b7a){_0x885b7a=_0x885b7a||0x1f4;return function(_0x4d32b8){logger['error'](_0x4d32b8[_0xe167('0x27')]);if(_0x4d32b8[_0xe167('0x28')]){delete _0x4d32b8[_0xe167('0x28')];}_0x5b3f9f[_0xe167('0x1b')](_0x885b7a)['send'](_0x4d32b8);};}exports[_0xe167('0x29')]=function(_0x47a1ea,_0x4ab18e){var _0xd87421={},_0x3ce8c3={},_0x7aadcf={'count':0x0,'rows':[]};var _0x51f963=_['map'](db[_0xe167('0x2a')][_0xe167('0x2b')],function(_0x4dd74b){return{'name':_0x4dd74b['fieldName'],'type':_0x4dd74b[_0xe167('0x2c')][_0xe167('0x2d')]};});_0x3ce8c3[_0xe167('0x2e')]=_[_0xe167('0x2f')](_0x51f963,_0xe167('0x28'));_0x3ce8c3[_0xe167('0x30')]=_['keys'](_0x47a1ea[_0xe167('0x30')]);_0x3ce8c3['filters']=_['intersection'](_0x3ce8c3[_0xe167('0x2e')],_0x3ce8c3['query']);_0xd87421[_0xe167('0x31')]=_[_0xe167('0x32')](_0x3ce8c3[_0xe167('0x2e')],qs[_0xe167('0x33')](_0x47a1ea[_0xe167('0x30')]['fields']));_0xd87421[_0xe167('0x31')]=_0xd87421[_0xe167('0x31')][_0xe167('0x34')]?_0xd87421[_0xe167('0x31')]:_0x3ce8c3[_0xe167('0x2e')];if(!_0x47a1ea[_0xe167('0x30')][_0xe167('0x35')](_0xe167('0x36'))){_0xd87421['limit']=qs['limit'](_0x47a1ea[_0xe167('0x30')][_0xe167('0x20')]);_0xd87421['offset']=qs['offset'](_0x47a1ea[_0xe167('0x30')]['offset']);}_0xd87421[_0xe167('0x37')]=qs['sort'](_0x47a1ea[_0xe167('0x30')][_0xe167('0x38')]);_0xd87421[_0xe167('0x39')]=qs['filters'](_['pick'](_0x47a1ea[_0xe167('0x30')],_0x3ce8c3[_0xe167('0x3a')]),_0x51f963);if(_0x47a1ea[_0xe167('0x30')][_0xe167('0x3b')]){_0xd87421[_0xe167('0x39')]=_[_0xe167('0x3c')](_0xd87421['where'],{'$or':_[_0xe167('0x2f')](_0x51f963,function(_0x1323dc){if(_0x1323dc['type']!==_0xe167('0x3d')){var _0x46d96a={};_0x46d96a[_0x1323dc[_0xe167('0x28')]]={'$like':'%'+_0x47a1ea[_0xe167('0x30')][_0xe167('0x3b')]+'%'};return _0x46d96a;}})});}_0xd87421=_['merge']({},_0xd87421,_0x47a1ea[_0xe167('0x3e')]);var _0x42e312={'where':_0xd87421[_0xe167('0x39')]};return db[_0xe167('0x2a')]['count'](_0x42e312)['then'](function(_0x28a50c){_0x7aadcf['count']=_0x28a50c;if(_0x47a1ea[_0xe167('0x30')][_0xe167('0x3f')]){_0xd87421[_0xe167('0x40')]=[{'all':!![]}];}return db[_0xe167('0x2a')][_0xe167('0x41')](_0xd87421);})['then'](function(_0x4ecd27){_0x7aadcf[_0xe167('0x42')]=_0x4ecd27;return _0x7aadcf;})[_0xe167('0x43')](respondWithFilteredResult(_0x4ab18e,_0xd87421))[_0xe167('0x44')](handleError(_0x4ab18e,null));};exports[_0xe167('0x45')]=function(_0x50e633,_0x21aae2){var _0x12b288={'raw':!![],'where':{'id':_0x50e633[_0xe167('0x46')]['id']}},_0x2ca081={};_0x2ca081['model']=_[_0xe167('0x47')](db[_0xe167('0x2a')]['rawAttributes']);_0x2ca081[_0xe167('0x30')]=_[_0xe167('0x47')](_0x50e633[_0xe167('0x30')]);_0x2ca081[_0xe167('0x3a')]=_['intersection'](_0x2ca081[_0xe167('0x2e')],_0x2ca081[_0xe167('0x30')]);_0x12b288[_0xe167('0x31')]=_[_0xe167('0x32')](_0x2ca081[_0xe167('0x2e')],qs['fields'](_0x50e633[_0xe167('0x30')][_0xe167('0x33')]));_0x12b288[_0xe167('0x31')]=_0x12b288[_0xe167('0x31')]['length']?_0x12b288[_0xe167('0x31')]:_0x2ca081[_0xe167('0x2e')];if(_0x50e633[_0xe167('0x30')][_0xe167('0x3f')]){_0x12b288['include']=[{'all':!![]}];}_0x12b288=_['merge']({},_0x12b288,_0x50e633[_0xe167('0x3e')]);return db['FaxQueueReport'][_0xe167('0x48')](_0x12b288)[_0xe167('0x43')](handleEntityNotFound(_0x21aae2,null))[_0xe167('0x43')](respondWithResult(_0x21aae2,null))[_0xe167('0x44')](handleError(_0x21aae2,null));};exports[_0xe167('0x49')]=function(_0x1b7372,_0x39be77){return db[_0xe167('0x2a')]['create'](_0x1b7372[_0xe167('0x4a')],{})[_0xe167('0x43')](respondWithResult(_0x39be77,0xc9))['catch'](handleError(_0x39be77,null));};exports[_0xe167('0x4b')]=function(_0x5225d6,_0x32dc9a){if(_0x5225d6['body']['id']){delete _0x5225d6[_0xe167('0x4a')]['id'];}return db['FaxQueueReport'][_0xe167('0x48')]({'where':{'id':_0x5225d6[_0xe167('0x46')]['id']}})[_0xe167('0x43')](handleEntityNotFound(_0x32dc9a,null))['then'](saveUpdates(_0x5225d6[_0xe167('0x4a')],null))[_0xe167('0x43')](respondWithResult(_0x32dc9a,null))[_0xe167('0x44')](handleError(_0x32dc9a,null));};exports['destroy']=function(_0x3768a6,_0x299ac8){return db[_0xe167('0x2a')][_0xe167('0x48')]({'where':{'id':_0x3768a6[_0xe167('0x46')]['id']}})['then'](handleEntityNotFound(_0x299ac8,null))[_0xe167('0x43')](removeEntity(_0x299ac8,null))[_0xe167('0x44')](handleError(_0x299ac8,null));};exports['describe']=function(_0x13fcbb,_0x2f8fce){return db['FaxQueueReport'][_0xe167('0x4c')]()[_0xe167('0x43')](respondWithResult(_0x2f8fce,null))[_0xe167('0x44')](handleError(_0x2f8fce,null));}; \ No newline at end of file +var _0x12c9=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','FaxQueueReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','save','then','destroy','error','stack','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection'];(function(_0x1314d4,_0xb0b16d){var _0x584ba5=function(_0x394269){while(--_0x394269){_0x1314d4['push'](_0x1314d4['shift']());}};_0x584ba5(++_0xb0b16d);}(_0x12c9,0x1c9));var _0x912c=function(_0x2f6807,_0x1aa02b){_0x2f6807=_0x2f6807-0x0;var _0x28c7b8=_0x12c9[_0x2f6807];return _0x28c7b8;};'use strict';var emlformat=require(_0x912c('0x0'));var rimraf=require(_0x912c('0x1'));var zipdir=require(_0x912c('0x2'));var jsonpatch=require(_0x912c('0x3'));var rp=require(_0x912c('0x4'));var moment=require('moment');var BPromise=require(_0x912c('0x5'));var Mustache=require(_0x912c('0x6'));var util=require(_0x912c('0x7'));var path=require(_0x912c('0x8'));var sox=require(_0x912c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x912c('0xa'));var _=require(_0x912c('0xb'));var squel=require(_0x912c('0xc'));var crypto=require(_0x912c('0xd'));var jsforce=require(_0x912c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x912c('0xf'));var querystring=require('querystring');var Papa=require(_0x912c('0x10'));var Redis=require('ioredis');var authService=require(_0x912c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x912c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x912c('0x13'))(_0x912c('0x14'));var utils=require('../../config/utils');var config=require(_0x912c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x912c('0x16'))['db'];function respondWithStatusCode(_0x401501,_0x16481f){_0x16481f=_0x16481f||0xcc;return function(_0x25abd8){if(_0x25abd8){return _0x401501[_0x912c('0x17')](_0x16481f);}return _0x401501['status'](_0x16481f)[_0x912c('0x18')]();};}function respondWithResult(_0x5cc804,_0x28cdb4){_0x28cdb4=_0x28cdb4||0xc8;return function(_0x3682cf){if(_0x3682cf){return _0x5cc804['status'](_0x28cdb4)[_0x912c('0x19')](_0x3682cf);}};}function respondWithFilteredResult(_0xc48e52,_0x2ddbf6){return function(_0x2a67db){if(_0x2a67db){var _0xf102be=typeof _0x2ddbf6[_0x912c('0x1a')]===_0x912c('0x1b')&&typeof _0x2ddbf6[_0x912c('0x1c')]===_0x912c('0x1b');var _0x26cb90=_0x2a67db['count'];var _0x280e59=_0xf102be?0x0:_0x2ddbf6[_0x912c('0x1a')];var _0x2a7693=_0xf102be?_0x2a67db[_0x912c('0x1d')]:_0x2ddbf6[_0x912c('0x1a')]+_0x2ddbf6[_0x912c('0x1c')];var _0x2a22d3;if(_0x2a7693>=_0x26cb90){_0x2a7693=_0x26cb90;_0x2a22d3=0xc8;}else{_0x2a22d3=0xce;}_0xc48e52[_0x912c('0x1e')](_0x2a22d3);return _0xc48e52[_0x912c('0x1f')]('Content-Range',_0x280e59+'-'+_0x2a7693+'/'+_0x26cb90)['json'](_0x2a67db);}return null;};}function patchUpdates(_0x3eb81d){return function(_0xbb397d){try{jsonpatch['apply'](_0xbb397d,_0x3eb81d,!![]);}catch(_0x49cb1e){return BPromise['reject'](_0x49cb1e);}return _0xbb397d[_0x912c('0x20')]();};}function saveUpdates(_0x900651,_0x5adca9){return function(_0x5afd32){if(_0x5afd32){return _0x5afd32['update'](_0x900651)[_0x912c('0x21')](function(_0xefe762){return _0xefe762;});}return null;};}function removeEntity(_0x4293f2,_0x1ec8a8){return function(_0x2c964a){if(_0x2c964a){return _0x2c964a[_0x912c('0x22')]()[_0x912c('0x21')](function(){_0x4293f2['status'](0xcc)[_0x912c('0x18')]();});}};}function handleEntityNotFound(_0x5c539d,_0xde247c){return function(_0x44284d){if(!_0x44284d){_0x5c539d[_0x912c('0x17')](0x194);}return _0x44284d;};}function handleError(_0x121865,_0x32b8c5){_0x32b8c5=_0x32b8c5||0x1f4;return function(_0x3a9fc0){logger[_0x912c('0x23')](_0x3a9fc0[_0x912c('0x24')]);if(_0x3a9fc0['name']){delete _0x3a9fc0['name'];}_0x121865[_0x912c('0x1e')](_0x32b8c5)['send'](_0x3a9fc0);};}exports[_0x912c('0x25')]=function(_0x24c2f2,_0x58ed35){var _0xefc100={},_0x46e8aa={},_0x2dbf14={'count':0x0,'rows':[]};var _0x188790=_['map'](db['FaxQueueReport'][_0x912c('0x26')],function(_0x4e1c38){return{'name':_0x4e1c38[_0x912c('0x27')],'type':_0x4e1c38[_0x912c('0x28')][_0x912c('0x29')]};});_0x46e8aa[_0x912c('0x2a')]=_[_0x912c('0x2b')](_0x188790,'name');_0x46e8aa[_0x912c('0x2c')]=_[_0x912c('0x2d')](_0x24c2f2[_0x912c('0x2c')]);_0x46e8aa['filters']=_[_0x912c('0x2e')](_0x46e8aa['model'],_0x46e8aa['query']);_0xefc100['attributes']=_[_0x912c('0x2e')](_0x46e8aa['model'],qs[_0x912c('0x2f')](_0x24c2f2[_0x912c('0x2c')]['fields']));_0xefc100[_0x912c('0x30')]=_0xefc100['attributes'][_0x912c('0x31')]?_0xefc100[_0x912c('0x30')]:_0x46e8aa[_0x912c('0x2a')];if(!_0x24c2f2[_0x912c('0x2c')][_0x912c('0x32')](_0x912c('0x33'))){_0xefc100['limit']=qs[_0x912c('0x1c')](_0x24c2f2[_0x912c('0x2c')][_0x912c('0x1c')]);_0xefc100['offset']=qs['offset'](_0x24c2f2[_0x912c('0x2c')][_0x912c('0x1a')]);}_0xefc100[_0x912c('0x34')]=qs[_0x912c('0x35')](_0x24c2f2[_0x912c('0x2c')][_0x912c('0x35')]);_0xefc100[_0x912c('0x36')]=qs['filters'](_['pick'](_0x24c2f2['query'],_0x46e8aa[_0x912c('0x37')]),_0x188790);if(_0x24c2f2[_0x912c('0x2c')][_0x912c('0x38')]){_0xefc100[_0x912c('0x36')]=_[_0x912c('0x39')](_0xefc100[_0x912c('0x36')],{'$or':_[_0x912c('0x2b')](_0x188790,function(_0x5c2554){if(_0x5c2554[_0x912c('0x28')]!==_0x912c('0x3a')){var _0x42c851={};_0x42c851[_0x5c2554['name']]={'$like':'%'+_0x24c2f2['query'][_0x912c('0x38')]+'%'};return _0x42c851;}})});}_0xefc100=_[_0x912c('0x39')]({},_0xefc100,_0x24c2f2[_0x912c('0x3b')]);var _0x3cf875={'where':_0xefc100[_0x912c('0x36')]};return db[_0x912c('0x3c')][_0x912c('0x1d')](_0x3cf875)['then'](function(_0x4e488c){_0x2dbf14['count']=_0x4e488c;if(_0x24c2f2[_0x912c('0x2c')][_0x912c('0x3d')]){_0xefc100[_0x912c('0x3e')]=[{'all':!![]}];}return db[_0x912c('0x3c')][_0x912c('0x3f')](_0xefc100);})[_0x912c('0x21')](function(_0xd1f9f9){_0x2dbf14[_0x912c('0x40')]=_0xd1f9f9;return _0x2dbf14;})[_0x912c('0x21')](respondWithFilteredResult(_0x58ed35,_0xefc100))[_0x912c('0x41')](handleError(_0x58ed35,null));};exports[_0x912c('0x42')]=function(_0x21b192,_0x1b83c4){var _0x2d3ae5={'raw':!![],'where':{'id':_0x21b192[_0x912c('0x43')]['id']}},_0x47babc={};_0x47babc[_0x912c('0x2a')]=_[_0x912c('0x2d')](db[_0x912c('0x3c')][_0x912c('0x26')]);_0x47babc[_0x912c('0x2c')]=_[_0x912c('0x2d')](_0x21b192['query']);_0x47babc['filters']=_[_0x912c('0x2e')](_0x47babc['model'],_0x47babc[_0x912c('0x2c')]);_0x2d3ae5[_0x912c('0x30')]=_[_0x912c('0x2e')](_0x47babc[_0x912c('0x2a')],qs[_0x912c('0x2f')](_0x21b192[_0x912c('0x2c')][_0x912c('0x2f')]));_0x2d3ae5[_0x912c('0x30')]=_0x2d3ae5['attributes']['length']?_0x2d3ae5[_0x912c('0x30')]:_0x47babc[_0x912c('0x2a')];if(_0x21b192[_0x912c('0x2c')][_0x912c('0x3d')]){_0x2d3ae5[_0x912c('0x3e')]=[{'all':!![]}];}_0x2d3ae5=_[_0x912c('0x39')]({},_0x2d3ae5,_0x21b192[_0x912c('0x3b')]);return db['FaxQueueReport'][_0x912c('0x44')](_0x2d3ae5)[_0x912c('0x21')](handleEntityNotFound(_0x1b83c4,null))[_0x912c('0x21')](respondWithResult(_0x1b83c4,null))['catch'](handleError(_0x1b83c4,null));};exports['create']=function(_0x255909,_0x13c317){return db[_0x912c('0x3c')][_0x912c('0x45')](_0x255909[_0x912c('0x46')],{})[_0x912c('0x21')](respondWithResult(_0x13c317,0xc9))[_0x912c('0x41')](handleError(_0x13c317,null));};exports['update']=function(_0x3e7a8a,_0x121c09){if(_0x3e7a8a[_0x912c('0x46')]['id']){delete _0x3e7a8a[_0x912c('0x46')]['id'];}return db['FaxQueueReport'][_0x912c('0x44')]({'where':{'id':_0x3e7a8a['params']['id']}})[_0x912c('0x21')](handleEntityNotFound(_0x121c09,null))['then'](saveUpdates(_0x3e7a8a['body'],null))[_0x912c('0x21')](respondWithResult(_0x121c09,null))[_0x912c('0x41')](handleError(_0x121c09,null));};exports['destroy']=function(_0x2b90a1,_0xdf8253){return db['FaxQueueReport']['find']({'where':{'id':_0x2b90a1[_0x912c('0x43')]['id']}})[_0x912c('0x21')](handleEntityNotFound(_0xdf8253,null))[_0x912c('0x21')](removeEntity(_0xdf8253,null))['catch'](handleError(_0xdf8253,null));};exports[_0x912c('0x47')]=function(_0x2b14af,_0x461f51){return db[_0x912c('0x3c')][_0x912c('0x47')]()['then'](respondWithResult(_0x461f51,null))[_0x912c('0x41')](handleError(_0x461f51,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 16f56a4..5a2d9df 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 _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','util'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x814b,0x1a2));var _0xb814=function(_0x20c205,_0x39bc5e){_0x20c205=_0x20c205-0x0;var _0x3d6cf2=_0x814b[_0x20c205];return _0x3d6cf2;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x56b4b8,_0xa98f11){var _0x347055=function(_0x39171f){while(--_0x39171f){_0x56b4b8['push'](_0x56b4b8['shift']());}};_0x347055(++_0xa98f11);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xc4aa[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 96c2bc7..b58b94b 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 _0xfbf3=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','CreateFaxQueueReport','FaxQueueReport','create','options','raw','catch','update','limit','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xfbf3,0x1a5));var _0x3fbf=function(_0x3d8fcf,_0x3b3531){_0x3d8fcf=_0x3d8fcf-0x0;var _0x16a449=_0xfbf3[_0x3d8fcf];return _0x16a449;};'use strict';var _=require(_0x3fbf('0x0'));var util=require(_0x3fbf('0x1'));var moment=require(_0x3fbf('0x2'));var BPromise=require(_0x3fbf('0x3'));var rs=require(_0x3fbf('0x4'));var fs=require('fs');var Redis=require(_0x3fbf('0x5'));var db=require(_0x3fbf('0x6'))['db'];var utils=require(_0x3fbf('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x3fbf('0x8'));var jayson=require(_0x3fbf('0x9'));var client=jayson[_0x3fbf('0xa')][_0x3fbf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3855ff,_0x6aea59,_0x1d651b){return new BPromise(function(_0x39eb3c,_0x398bb1){return client[_0x3fbf('0xc')](_0x3855ff,_0x1d651b)[_0x3fbf('0xd')](function(_0x5798c7){logger[_0x3fbf('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x6aea59,_0x3fbf('0xf'));logger[_0x3fbf('0x10')](_0x3fbf('0x11'),_0x6aea59,_0x3fbf('0xf'),JSON[_0x3fbf('0x12')](_0x5798c7));if(_0x5798c7[_0x3fbf('0x13')]){if(_0x5798c7[_0x3fbf('0x13')][_0x3fbf('0x14')]===0x1f4){logger[_0x3fbf('0x13')](_0x3fbf('0x15'),_0x6aea59,_0x5798c7[_0x3fbf('0x13')][_0x3fbf('0x16')]);return _0x398bb1(_0x5798c7[_0x3fbf('0x13')][_0x3fbf('0x16')]);}logger[_0x3fbf('0x13')](_0x3fbf('0x15'),_0x6aea59,_0x5798c7['error'][_0x3fbf('0x16')]);return _0x39eb3c(_0x5798c7[_0x3fbf('0x13')][_0x3fbf('0x16')]);}else{logger[_0x3fbf('0xe')](_0x3fbf('0x15'),_0x6aea59,'request\x20sent');_0x39eb3c(_0x5798c7[_0x3fbf('0x17')][_0x3fbf('0x16')]);}})['catch'](function(_0x15463b){logger['error'](_0x3fbf('0x15'),_0x6aea59,_0x15463b);_0x398bb1(_0x15463b);});});}exports[_0x3fbf('0x18')]=function(_0x2d476f){var _0xd4a4b6=this;return new Promise(function(_0xca5bc3,_0xfe9a78){return db[_0x3fbf('0x19')][_0x3fbf('0x1a')](_0x2d476f['body'],{'raw':_0x2d476f[_0x3fbf('0x1b')]?_0x2d476f[_0x3fbf('0x1b')][_0x3fbf('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x2b2bc6){logger['info']('CreateFaxQueueReport',_0x2d476f);logger[_0x3fbf('0x10')]('CreateFaxQueueReport',_0x2d476f,JSON[_0x3fbf('0x12')](_0x2b2bc6));_0xca5bc3(_0x2b2bc6);})[_0x3fbf('0x1d')](function(_0x2564e3){logger[_0x3fbf('0x13')](_0x3fbf('0x18'),_0x2564e3[_0x3fbf('0x16')],_0x2d476f);_0xfe9a78(_0xd4a4b6['error'](0x1f4,_0x2564e3[_0x3fbf('0x16')]));});});};exports['UpdateFaxQueueReport']=function(_0x21fea9){var _0xc7d0d0=this;return new Promise(function(_0x5a7b62,_0x34cd87){return db[_0x3fbf('0x19')][_0x3fbf('0x1e')](_0x21fea9['body'],{'raw':_0x21fea9[_0x3fbf('0x1b')]?_0x21fea9['options'][_0x3fbf('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21fea9[_0x3fbf('0x1b')]?_0x21fea9[_0x3fbf('0x1b')]['where']||null:null,'attributes':_0x21fea9[_0x3fbf('0x1b')]?_0x21fea9[_0x3fbf('0x1b')]['attributes']||null:null,'limit':_0x21fea9['options']?_0x21fea9['options'][_0x3fbf('0x1f')]||null:null})['then'](function(_0x482714){logger[_0x3fbf('0xe')]('UpdateFaxQueueReport',_0x21fea9);logger[_0x3fbf('0x10')](_0x3fbf('0x20'),_0x21fea9,JSON[_0x3fbf('0x12')](_0x482714));_0x5a7b62(_0x482714);})[_0x3fbf('0x1d')](function(_0xc5590f){logger[_0x3fbf('0x13')]('UpdateFaxQueueReport',_0xc5590f[_0x3fbf('0x16')],_0x21fea9);_0x34cd87(_0xc7d0d0[_0x3fbf('0x13')](0x1f4,_0xc5590f['message']));});});}; \ No newline at end of file +var _0xc631=['raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','UpdateFaxQueueReport'];(function(_0x7e11bf,_0x18a928){var _0x4fcf70=function(_0x51d0ea){while(--_0x51d0ea){_0x7e11bf['push'](_0x7e11bf['shift']());}};_0x4fcf70(++_0x18a928);}(_0xc631,0x66));var _0x1c63=function(_0x567542,_0x1e58fe){_0x567542=_0x567542-0x0;var _0x37f49e=_0xc631[_0x567542];return _0x37f49e;};'use strict';var _=require(_0x1c63('0x0'));var util=require(_0x1c63('0x1'));var moment=require(_0x1c63('0x2'));var BPromise=require(_0x1c63('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c63('0x4'));var db=require(_0x1c63('0x5'))['db'];var utils=require(_0x1c63('0x6'));var logger=require('../../config/logger')(_0x1c63('0x7'));var config=require(_0x1c63('0x8'));var jayson=require(_0x1c63('0x9'));var client=jayson[_0x1c63('0xa')][_0x1c63('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2144a6,_0x258ac5,_0x4f29b3){return new BPromise(function(_0x2d795a,_0x11429e){return client[_0x1c63('0xc')](_0x2144a6,_0x4f29b3)[_0x1c63('0xd')](function(_0x3e1298){logger[_0x1c63('0xe')](_0x1c63('0xf'),_0x258ac5,'request\x20sent');logger[_0x1c63('0x10')](_0x1c63('0x11'),_0x258ac5,_0x1c63('0x12'),JSON[_0x1c63('0x13')](_0x3e1298));if(_0x3e1298['error']){if(_0x3e1298['error'][_0x1c63('0x14')]===0x1f4){logger[_0x1c63('0x15')](_0x1c63('0xf'),_0x258ac5,_0x3e1298[_0x1c63('0x15')][_0x1c63('0x16')]);return _0x11429e(_0x3e1298[_0x1c63('0x15')]['message']);}logger[_0x1c63('0x15')](_0x1c63('0xf'),_0x258ac5,_0x3e1298[_0x1c63('0x15')]['message']);return _0x2d795a(_0x3e1298[_0x1c63('0x15')][_0x1c63('0x16')]);}else{logger[_0x1c63('0xe')](_0x1c63('0xf'),_0x258ac5,_0x1c63('0x12'));_0x2d795a(_0x3e1298['result']['message']);}})[_0x1c63('0x17')](function(_0x50c559){logger[_0x1c63('0x15')](_0x1c63('0xf'),_0x258ac5,_0x50c559);_0x11429e(_0x50c559);});});}exports[_0x1c63('0x18')]=function(_0x10ca8d){var _0x1bfd11=this;return new Promise(function(_0x5b0583,_0x562a70){return db[_0x1c63('0x19')][_0x1c63('0x1a')](_0x10ca8d[_0x1c63('0x1b')],{'raw':_0x10ca8d[_0x1c63('0x1c')]?_0x10ca8d['options']['raw']===undefined?!![]:![]:!![]})[_0x1c63('0xd')](function(_0x2680dc){logger[_0x1c63('0xe')](_0x1c63('0x18'),_0x10ca8d);logger[_0x1c63('0x10')](_0x1c63('0x18'),_0x10ca8d,JSON[_0x1c63('0x13')](_0x2680dc));_0x5b0583(_0x2680dc);})[_0x1c63('0x17')](function(_0x422511){logger[_0x1c63('0x15')]('CreateFaxQueueReport',_0x422511[_0x1c63('0x16')],_0x10ca8d);_0x562a70(_0x1bfd11[_0x1c63('0x15')](0x1f4,_0x422511[_0x1c63('0x16')]));});});};exports[_0x1c63('0x1d')]=function(_0x4caa84){var _0x2dae32=this;return new Promise(function(_0xcc888c,_0x2e747e){return db[_0x1c63('0x19')]['update'](_0x4caa84['body'],{'raw':_0x4caa84['options']?_0x4caa84[_0x1c63('0x1c')][_0x1c63('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4caa84[_0x1c63('0x1c')]?_0x4caa84['options'][_0x1c63('0x1f')]||null:null,'attributes':_0x4caa84['options']?_0x4caa84[_0x1c63('0x1c')]['attributes']||null:null,'limit':_0x4caa84['options']?_0x4caa84['options'][_0x1c63('0x20')]||null:null})[_0x1c63('0xd')](function(_0x3a9169){logger[_0x1c63('0xe')]('UpdateFaxQueueReport',_0x4caa84);logger[_0x1c63('0x10')](_0x1c63('0x1d'),_0x4caa84,JSON[_0x1c63('0x13')](_0x3a9169));_0xcc888c(_0x3a9169);})[_0x1c63('0x17')](function(_0x487532){logger[_0x1c63('0x15')](_0x1c63('0x1d'),_0x487532['message'],_0x4caa84);_0x2e747e(_0x2dae32[_0x1c63('0x15')](0x1f4,_0x487532[_0x1c63('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 3faf0ba..1876302 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 _0x2b7f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','index','describe','show','post','create','/:id','isAuthenticated','delete','destroy','util','connect-timeout'];(function(_0x3a2575,_0x456f90){var _0x4c822e=function(_0x3d77f6){while(--_0x3d77f6){_0x3a2575['push'](_0x3a2575['shift']());}};_0x4c822e(++_0x456f90);}(_0x2b7f,0x18d));var _0xf2b7=function(_0x37ff03,_0x11b1b4){_0x37ff03=_0x37ff03-0x0;var _0x35b42d=_0x2b7f[_0x37ff03];return _0x35b42d;};'use strict';var multer=require('multer');var util=require(_0xf2b7('0x0'));var path=require('path');var timeout=require(_0xf2b7('0x1'));var express=require(_0xf2b7('0x2'));var router=express[_0xf2b7('0x3')]();var fs_extra=require(_0xf2b7('0x4'));var auth=require(_0xf2b7('0x5'));var interaction=require(_0xf2b7('0x6'));var config=require(_0xf2b7('0x7'));var controller=require(_0xf2b7('0x8'));router[_0xf2b7('0x9')]('/',auth['isAuthenticated'](),controller[_0xf2b7('0xa')]);router[_0xf2b7('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xf2b7('0xb')]);router[_0xf2b7('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xf2b7('0xc')]);router[_0xf2b7('0xd')]('/',auth['isAuthenticated'](),controller[_0xf2b7('0xe')]);router['put'](_0xf2b7('0xf'),auth[_0xf2b7('0x10')](),controller['update']);router[_0xf2b7('0x11')](_0xf2b7('0xf'),auth[_0xf2b7('0x10')](),controller[_0xf2b7('0x12')]);module['exports']=router; \ No newline at end of file +var _0x2177=['isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x508685,_0x9f94af){var _0x976a76=function(_0x1bcb05){while(--_0x1bcb05){_0x508685['push'](_0x508685['shift']());}};_0x976a76(++_0x9f94af);}(_0x2177,0x138));var _0x7217=function(_0x502953,_0x28de83){_0x502953=_0x502953-0x0;var _0x2fa32d=_0x2177[_0x502953];return _0x2fa32d;};'use strict';var multer=require(_0x7217('0x0'));var util=require(_0x7217('0x1'));var path=require('path');var timeout=require(_0x7217('0x2'));var express=require('express');var router=express[_0x7217('0x3')]();var fs_extra=require(_0x7217('0x4'));var auth=require(_0x7217('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7217('0x6'));var controller=require('./faxQueueReport.controller');router[_0x7217('0x7')]('/',auth[_0x7217('0x8')](),controller[_0x7217('0x9')]);router['get']('/describe',auth[_0x7217('0x8')](),controller[_0x7217('0xa')]);router['get'](_0x7217('0xb'),auth[_0x7217('0x8')](),controller[_0x7217('0xc')]);router[_0x7217('0xd')]('/',auth[_0x7217('0x8')](),controller[_0x7217('0xe')]);router[_0x7217('0xf')](_0x7217('0xb'),auth[_0x7217('0x8')](),controller[_0x7217('0x10')]);router[_0x7217('0x11')](_0x7217('0xb'),auth[_0x7217('0x8')](),controller[_0x7217('0x12')]);module[_0x7217('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index c51d23a..580d77d 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x5cedbc,_0x48fc4d){var _0x5d73a0=function(_0x2aa9b7){while(--_0x2aa9b7){_0x5cedbc['push'](_0x5cedbc['shift']());}};_0x5d73a0(++_0x48fc4d);}(_0x54ef,0x112));var _0xf54e=function(_0x4a1fc1,_0x4c2b51){_0x4a1fc1=_0x4a1fc1-0x0;var _0x500c60=_0x54ef[_0x4a1fc1];return _0x500c60;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x3adf4e,_0x26d25f){var _0x4dc28b=function(_0x38d031){while(--_0x38d031){_0x3adf4e['push'](_0x3adf4e['shift']());}};_0x4dc28b(++_0x26d25f);}(_0x54ef,0x112));var _0xf54e=function(_0x553386,_0x1546e3){_0x553386=_0x553386-0x0;var _0x50d086=_0x54ef[_0x553386];return _0x50d086;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 8872ae4..d45bd88 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 _0x4de4=['fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','catch','show','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','undefined','set','apply','save','update','then','destroy','sendStatus','stack','name','send','map','FaxTransferReport'];(function(_0x57f397,_0x1e4bf3){var _0x34e2d0=function(_0x30947e){while(--_0x30947e){_0x57f397['push'](_0x57f397['shift']());}};_0x34e2d0(++_0x1e4bf3);}(_0x4de4,0xfd));var _0x44de=function(_0x502546,_0x154148){_0x502546=_0x502546-0x0;var _0x32b7f4=_0x4de4[_0x502546];return _0x32b7f4;};'use strict';var emlformat=require(_0x44de('0x0'));var rimraf=require(_0x44de('0x1'));var zipdir=require(_0x44de('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x44de('0x3'));var moment=require(_0x44de('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x44de('0x5'));var util=require(_0x44de('0x6'));var path=require(_0x44de('0x7'));var sox=require(_0x44de('0x8'));var csv=require(_0x44de('0x9'));var ejs=require(_0x44de('0xa'));var fs=require('fs');var fs_extra=require(_0x44de('0xb'));var _=require(_0x44de('0xc'));var squel=require('squel');var crypto=require(_0x44de('0xd'));var jsforce=require(_0x44de('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x44de('0x9'));var querystring=require(_0x44de('0xf'));var Papa=require('papaparse');var Redis=require(_0x44de('0x10'));var authService=require(_0x44de('0x11'));var qs=require(_0x44de('0x12'));var as=require(_0x44de('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x44de('0x14'))(_0x44de('0x15'));var utils=require(_0x44de('0x16'));var config=require(_0x44de('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x44de('0x18'))['db'];function respondWithStatusCode(_0xa55239,_0x286ac0){_0x286ac0=_0x286ac0||0xcc;return function(_0x120864){if(_0x120864){return _0xa55239['sendStatus'](_0x286ac0);}return _0xa55239['status'](_0x286ac0)[_0x44de('0x19')]();};}function respondWithResult(_0x1a080b,_0x30f845){_0x30f845=_0x30f845||0xc8;return function(_0x43aef2){if(_0x43aef2){return _0x1a080b[_0x44de('0x1a')](_0x30f845)[_0x44de('0x1b')](_0x43aef2);}};}function respondWithFilteredResult(_0x57d483,_0x2f1f1e){return function(_0x53bbfc){if(_0x53bbfc){var _0x44a390=typeof _0x2f1f1e[_0x44de('0x1c')]==='undefined'&&typeof _0x2f1f1e[_0x44de('0x1d')]===_0x44de('0x1e');var _0x2265bc=_0x53bbfc['count'];var _0x558284=_0x44a390?0x0:_0x2f1f1e[_0x44de('0x1c')];var _0xfd503c=_0x44a390?_0x53bbfc['count']:_0x2f1f1e[_0x44de('0x1c')]+_0x2f1f1e[_0x44de('0x1d')];var _0x118d59;if(_0xfd503c>=_0x2265bc){_0xfd503c=_0x2265bc;_0x118d59=0xc8;}else{_0x118d59=0xce;}_0x57d483[_0x44de('0x1a')](_0x118d59);return _0x57d483[_0x44de('0x1f')]('Content-Range',_0x558284+'-'+_0xfd503c+'/'+_0x2265bc)[_0x44de('0x1b')](_0x53bbfc);}return null;};}function patchUpdates(_0x149cb2){return function(_0x5011f9){try{jsonpatch[_0x44de('0x20')](_0x5011f9,_0x149cb2,!![]);}catch(_0x226e4c){return BPromise['reject'](_0x226e4c);}return _0x5011f9[_0x44de('0x21')]();};}function saveUpdates(_0x1b3b26,_0x598cc9){return function(_0x261cd5){if(_0x261cd5){return _0x261cd5[_0x44de('0x22')](_0x1b3b26)[_0x44de('0x23')](function(_0x2520d4){return _0x2520d4;});}return null;};}function removeEntity(_0x17772c,_0x465e24){return function(_0x2c6fa0){if(_0x2c6fa0){return _0x2c6fa0[_0x44de('0x24')]()['then'](function(){_0x17772c[_0x44de('0x1a')](0xcc)[_0x44de('0x19')]();});}};}function handleEntityNotFound(_0xbd843a,_0x407ee3){return function(_0x22b056){if(!_0x22b056){_0xbd843a[_0x44de('0x25')](0x194);}return _0x22b056;};}function handleError(_0x478479,_0x1dce09){_0x1dce09=_0x1dce09||0x1f4;return function(_0x58194d){logger['error'](_0x58194d[_0x44de('0x26')]);if(_0x58194d[_0x44de('0x27')]){delete _0x58194d[_0x44de('0x27')];}_0x478479[_0x44de('0x1a')](_0x1dce09)[_0x44de('0x28')](_0x58194d);};}exports['index']=function(_0xf75a9f,_0x120552){var _0x42556c={},_0x51a4c1={},_0x160da8={'count':0x0,'rows':[]};var _0x5838f2=_[_0x44de('0x29')](db[_0x44de('0x2a')]['rawAttributes'],function(_0x32f1e2){return{'name':_0x32f1e2[_0x44de('0x2b')],'type':_0x32f1e2[_0x44de('0x2c')][_0x44de('0x2d')]};});_0x51a4c1[_0x44de('0x2e')]=_[_0x44de('0x29')](_0x5838f2,_0x44de('0x27'));_0x51a4c1[_0x44de('0x2f')]=_[_0x44de('0x30')](_0xf75a9f[_0x44de('0x2f')]);_0x51a4c1[_0x44de('0x31')]=_[_0x44de('0x32')](_0x51a4c1[_0x44de('0x2e')],_0x51a4c1[_0x44de('0x2f')]);_0x42556c['attributes']=_[_0x44de('0x32')](_0x51a4c1[_0x44de('0x2e')],qs['fields'](_0xf75a9f['query'][_0x44de('0x33')]));_0x42556c['attributes']=_0x42556c[_0x44de('0x34')][_0x44de('0x35')]?_0x42556c[_0x44de('0x34')]:_0x51a4c1['model'];if(!_0xf75a9f[_0x44de('0x2f')][_0x44de('0x36')]('nolimit')){_0x42556c[_0x44de('0x1d')]=qs[_0x44de('0x1d')](_0xf75a9f[_0x44de('0x2f')]['limit']);_0x42556c['offset']=qs[_0x44de('0x1c')](_0xf75a9f[_0x44de('0x2f')][_0x44de('0x1c')]);}_0x42556c[_0x44de('0x37')]=qs[_0x44de('0x38')](_0xf75a9f[_0x44de('0x2f')][_0x44de('0x38')]);_0x42556c[_0x44de('0x39')]=qs[_0x44de('0x31')](_[_0x44de('0x3a')](_0xf75a9f['query'],_0x51a4c1['filters']),_0x5838f2);if(_0xf75a9f[_0x44de('0x2f')][_0x44de('0x3b')]){_0x42556c[_0x44de('0x39')]=_[_0x44de('0x3c')](_0x42556c[_0x44de('0x39')],{'$or':_[_0x44de('0x29')](_0x5838f2,function(_0x51ae08){if(_0x51ae08[_0x44de('0x2c')]!==_0x44de('0x3d')){var _0x585b83={};_0x585b83[_0x51ae08[_0x44de('0x27')]]={'$like':'%'+_0xf75a9f[_0x44de('0x2f')]['filter']+'%'};return _0x585b83;}})});}_0x42556c=_[_0x44de('0x3c')]({},_0x42556c,_0xf75a9f['options']);var _0x2a2b39={'where':_0x42556c['where']};return db['FaxTransferReport'][_0x44de('0x3e')](_0x2a2b39)[_0x44de('0x23')](function(_0xc86a7c){_0x160da8[_0x44de('0x3e')]=_0xc86a7c;if(_0xf75a9f['query'][_0x44de('0x3f')]){_0x42556c[_0x44de('0x40')]=[{'all':!![]}];}return db[_0x44de('0x2a')][_0x44de('0x41')](_0x42556c);})[_0x44de('0x23')](function(_0x12d0b8){_0x160da8['rows']=_0x12d0b8;return _0x160da8;})[_0x44de('0x23')](respondWithFilteredResult(_0x120552,_0x42556c))[_0x44de('0x42')](handleError(_0x120552,null));};exports[_0x44de('0x43')]=function(_0x594c8f,_0x151fa2){var _0xc6cf12={'raw':!![],'where':{'id':_0x594c8f['params']['id']}},_0x12d221={};_0x12d221[_0x44de('0x2e')]=_['keys'](db['FaxTransferReport']['rawAttributes']);_0x12d221[_0x44de('0x2f')]=_['keys'](_0x594c8f[_0x44de('0x2f')]);_0x12d221[_0x44de('0x31')]=_[_0x44de('0x32')](_0x12d221['model'],_0x12d221[_0x44de('0x2f')]);_0xc6cf12['attributes']=_[_0x44de('0x32')](_0x12d221[_0x44de('0x2e')],qs[_0x44de('0x33')](_0x594c8f[_0x44de('0x2f')][_0x44de('0x33')]));_0xc6cf12[_0x44de('0x34')]=_0xc6cf12['attributes'][_0x44de('0x35')]?_0xc6cf12[_0x44de('0x34')]:_0x12d221[_0x44de('0x2e')];if(_0x594c8f[_0x44de('0x2f')][_0x44de('0x3f')]){_0xc6cf12['include']=[{'all':!![]}];}_0xc6cf12=_[_0x44de('0x3c')]({},_0xc6cf12,_0x594c8f[_0x44de('0x44')]);return db['FaxTransferReport'][_0x44de('0x45')](_0xc6cf12)[_0x44de('0x23')](handleEntityNotFound(_0x151fa2,null))[_0x44de('0x23')](respondWithResult(_0x151fa2,null))[_0x44de('0x42')](handleError(_0x151fa2,null));};exports[_0x44de('0x46')]=function(_0x5e3708,_0x382ef3){return db[_0x44de('0x2a')][_0x44de('0x46')](_0x5e3708['body'],{})[_0x44de('0x23')](respondWithResult(_0x382ef3,0xc9))[_0x44de('0x42')](handleError(_0x382ef3,null));};exports[_0x44de('0x22')]=function(_0x1109fe,_0x37b246){if(_0x1109fe['body']['id']){delete _0x1109fe['body']['id'];}return db[_0x44de('0x2a')][_0x44de('0x45')]({'where':{'id':_0x1109fe['params']['id']}})['then'](handleEntityNotFound(_0x37b246,null))[_0x44de('0x23')](saveUpdates(_0x1109fe[_0x44de('0x47')],null))['then'](respondWithResult(_0x37b246,null))[_0x44de('0x42')](handleError(_0x37b246,null));};exports[_0x44de('0x24')]=function(_0x579609,_0x1d70ff){return db[_0x44de('0x2a')][_0x44de('0x45')]({'where':{'id':_0x579609[_0x44de('0x48')]['id']}})[_0x44de('0x23')](handleEntityNotFound(_0x1d70ff,null))[_0x44de('0x23')](removeEntity(_0x1d70ff,null))[_0x44de('0x42')](handleError(_0x1d70ff,null));};exports[_0x44de('0x49')]=function(_0x2bd41f,_0x12ff32){return db[_0x44de('0x2a')]['describe']()[_0x44de('0x23')](respondWithResult(_0x12ff32,null))[_0x44de('0x42')](handleError(_0x12ff32,null));}; \ No newline at end of file +var _0x048d=['query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','rows','catch','show','includeAll','find','create','body','params','describe','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','sendStatus','error','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model'];(function(_0x3c5063,_0x3af1fb){var _0x1ddde3=function(_0x1678c4){while(--_0x1678c4){_0x3c5063['push'](_0x3c5063['shift']());}};_0x1ddde3(++_0x3af1fb);}(_0x048d,0xaa));var _0xd048=function(_0x466a11,_0x3edc77){_0x466a11=_0x466a11-0x0;var _0x1d7350=_0x048d[_0x466a11];return _0x1d7350;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd048('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd048('0x1'));var moment=require(_0xd048('0x2'));var BPromise=require(_0xd048('0x3'));var Mustache=require(_0xd048('0x4'));var util=require(_0xd048('0x5'));var path=require(_0xd048('0x6'));var sox=require('sox');var csv=require(_0xd048('0x7'));var ejs=require(_0xd048('0x8'));var fs=require('fs');var fs_extra=require(_0xd048('0x9'));var _=require('lodash');var squel=require(_0xd048('0xa'));var crypto=require(_0xd048('0xb'));var jsforce=require(_0xd048('0xc'));var deskjs=require(_0xd048('0xd'));var toCsv=require(_0xd048('0x7'));var querystring=require('querystring');var Papa=require(_0xd048('0xe'));var Redis=require(_0xd048('0xf'));var authService=require(_0xd048('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd048('0x11'));var hardwareService=require(_0xd048('0x12'));var logger=require('../../config/logger')(_0xd048('0x13'));var utils=require(_0xd048('0x14'));var config=require(_0xd048('0x15'));var licenseUtil=require(_0xd048('0x16'));var db=require(_0xd048('0x17'))['db'];function respondWithStatusCode(_0x1a3ab9,_0x1dc7b7){_0x1dc7b7=_0x1dc7b7||0xcc;return function(_0x1cc847){if(_0x1cc847){return _0x1a3ab9['sendStatus'](_0x1dc7b7);}return _0x1a3ab9[_0xd048('0x18')](_0x1dc7b7)[_0xd048('0x19')]();};}function respondWithResult(_0xd44483,_0xfe3c91){_0xfe3c91=_0xfe3c91||0xc8;return function(_0x241bfd){if(_0x241bfd){return _0xd44483['status'](_0xfe3c91)[_0xd048('0x1a')](_0x241bfd);}};}function respondWithFilteredResult(_0x5d9ff4,_0x7e200f){return function(_0x435a94){if(_0x435a94){var _0x2bfc7d=typeof _0x7e200f[_0xd048('0x1b')]===_0xd048('0x1c')&&typeof _0x7e200f[_0xd048('0x1d')]===_0xd048('0x1c');var _0x57907f=_0x435a94['count'];var _0x4b2cf1=_0x2bfc7d?0x0:_0x7e200f[_0xd048('0x1b')];var _0x5f0a44=_0x2bfc7d?_0x435a94[_0xd048('0x1e')]:_0x7e200f[_0xd048('0x1b')]+_0x7e200f[_0xd048('0x1d')];var _0x261099;if(_0x5f0a44>=_0x57907f){_0x5f0a44=_0x57907f;_0x261099=0xc8;}else{_0x261099=0xce;}_0x5d9ff4[_0xd048('0x18')](_0x261099);return _0x5d9ff4[_0xd048('0x1f')](_0xd048('0x20'),_0x4b2cf1+'-'+_0x5f0a44+'/'+_0x57907f)['json'](_0x435a94);}return null;};}function patchUpdates(_0xd4c9d2){return function(_0x14bd31){try{jsonpatch[_0xd048('0x21')](_0x14bd31,_0xd4c9d2,!![]);}catch(_0x56a10a){return BPromise[_0xd048('0x22')](_0x56a10a);}return _0x14bd31['save']();};}function saveUpdates(_0x26eb7a,_0x1fa723){return function(_0x3a2e7c){if(_0x3a2e7c){return _0x3a2e7c['update'](_0x26eb7a)[_0xd048('0x23')](function(_0x321b7a){return _0x321b7a;});}return null;};}function removeEntity(_0x2ca046,_0x593913){return function(_0x147ddd){if(_0x147ddd){return _0x147ddd[_0xd048('0x24')]()[_0xd048('0x23')](function(){_0x2ca046[_0xd048('0x18')](0xcc)[_0xd048('0x19')]();});}};}function handleEntityNotFound(_0x10fe55,_0x77fd51){return function(_0x5ab438){if(!_0x5ab438){_0x10fe55[_0xd048('0x25')](0x194);}return _0x5ab438;};}function handleError(_0x268b9e,_0x43e7e4){_0x43e7e4=_0x43e7e4||0x1f4;return function(_0xbf9127){logger[_0xd048('0x26')](_0xbf9127['stack']);if(_0xbf9127[_0xd048('0x27')]){delete _0xbf9127['name'];}_0x268b9e['status'](_0x43e7e4)[_0xd048('0x28')](_0xbf9127);};}exports[_0xd048('0x29')]=function(_0x434420,_0x1efdcc){var _0x6beab5={},_0x32fc7d={},_0xdd04f7={'count':0x0,'rows':[]};var _0x624672=_[_0xd048('0x2a')](db[_0xd048('0x2b')][_0xd048('0x2c')],function(_0x5e765e){return{'name':_0x5e765e[_0xd048('0x2d')],'type':_0x5e765e[_0xd048('0x2e')][_0xd048('0x2f')]};});_0x32fc7d[_0xd048('0x30')]=_[_0xd048('0x2a')](_0x624672,_0xd048('0x27'));_0x32fc7d[_0xd048('0x31')]=_[_0xd048('0x32')](_0x434420[_0xd048('0x31')]);_0x32fc7d[_0xd048('0x33')]=_[_0xd048('0x34')](_0x32fc7d[_0xd048('0x30')],_0x32fc7d[_0xd048('0x31')]);_0x6beab5[_0xd048('0x35')]=_[_0xd048('0x34')](_0x32fc7d[_0xd048('0x30')],qs[_0xd048('0x36')](_0x434420[_0xd048('0x31')][_0xd048('0x36')]));_0x6beab5[_0xd048('0x35')]=_0x6beab5['attributes']['length']?_0x6beab5['attributes']:_0x32fc7d[_0xd048('0x30')];if(!_0x434420['query'][_0xd048('0x37')](_0xd048('0x38'))){_0x6beab5[_0xd048('0x1d')]=qs[_0xd048('0x1d')](_0x434420[_0xd048('0x31')][_0xd048('0x1d')]);_0x6beab5[_0xd048('0x1b')]=qs[_0xd048('0x1b')](_0x434420[_0xd048('0x31')][_0xd048('0x1b')]);}_0x6beab5[_0xd048('0x39')]=qs[_0xd048('0x3a')](_0x434420[_0xd048('0x31')]['sort']);_0x6beab5[_0xd048('0x3b')]=qs[_0xd048('0x33')](_[_0xd048('0x3c')](_0x434420[_0xd048('0x31')],_0x32fc7d['filters']),_0x624672);if(_0x434420[_0xd048('0x31')][_0xd048('0x3d')]){_0x6beab5['where']=_[_0xd048('0x3e')](_0x6beab5[_0xd048('0x3b')],{'$or':_[_0xd048('0x2a')](_0x624672,function(_0x525182){if(_0x525182[_0xd048('0x2e')]!=='VIRTUAL'){var _0x56cadb={};_0x56cadb[_0x525182['name']]={'$like':'%'+_0x434420[_0xd048('0x31')][_0xd048('0x3d')]+'%'};return _0x56cadb;}})});}_0x6beab5=_[_0xd048('0x3e')]({},_0x6beab5,_0x434420['options']);var _0x21155a={'where':_0x6beab5[_0xd048('0x3b')]};return db[_0xd048('0x2b')][_0xd048('0x1e')](_0x21155a)[_0xd048('0x23')](function(_0x5a3519){_0xdd04f7['count']=_0x5a3519;if(_0x434420[_0xd048('0x31')]['includeAll']){_0x6beab5[_0xd048('0x3f')]=[{'all':!![]}];}return db[_0xd048('0x2b')]['findAll'](_0x6beab5);})[_0xd048('0x23')](function(_0xe00f21){_0xdd04f7[_0xd048('0x40')]=_0xe00f21;return _0xdd04f7;})[_0xd048('0x23')](respondWithFilteredResult(_0x1efdcc,_0x6beab5))[_0xd048('0x41')](handleError(_0x1efdcc,null));};exports[_0xd048('0x42')]=function(_0x404b67,_0x1243fa){var _0x28c402={'raw':!![],'where':{'id':_0x404b67['params']['id']}},_0x5e4758={};_0x5e4758[_0xd048('0x30')]=_[_0xd048('0x32')](db[_0xd048('0x2b')][_0xd048('0x2c')]);_0x5e4758['query']=_['keys'](_0x404b67['query']);_0x5e4758['filters']=_[_0xd048('0x34')](_0x5e4758[_0xd048('0x30')],_0x5e4758[_0xd048('0x31')]);_0x28c402[_0xd048('0x35')]=_[_0xd048('0x34')](_0x5e4758[_0xd048('0x30')],qs[_0xd048('0x36')](_0x404b67[_0xd048('0x31')]['fields']));_0x28c402[_0xd048('0x35')]=_0x28c402['attributes']['length']?_0x28c402[_0xd048('0x35')]:_0x5e4758[_0xd048('0x30')];if(_0x404b67['query'][_0xd048('0x43')]){_0x28c402[_0xd048('0x3f')]=[{'all':!![]}];}_0x28c402=_['merge']({},_0x28c402,_0x404b67['options']);return db[_0xd048('0x2b')][_0xd048('0x44')](_0x28c402)['then'](handleEntityNotFound(_0x1243fa,null))[_0xd048('0x23')](respondWithResult(_0x1243fa,null))[_0xd048('0x41')](handleError(_0x1243fa,null));};exports[_0xd048('0x45')]=function(_0x39bbf1,_0x4c68c0){return db['FaxTransferReport'][_0xd048('0x45')](_0x39bbf1[_0xd048('0x46')],{})[_0xd048('0x23')](respondWithResult(_0x4c68c0,0xc9))[_0xd048('0x41')](handleError(_0x4c68c0,null));};exports['update']=function(_0x119413,_0x183cda){if(_0x119413[_0xd048('0x46')]['id']){delete _0x119413['body']['id'];}return db[_0xd048('0x2b')][_0xd048('0x44')]({'where':{'id':_0x119413['params']['id']}})[_0xd048('0x23')](handleEntityNotFound(_0x183cda,null))[_0xd048('0x23')](saveUpdates(_0x119413[_0xd048('0x46')],null))[_0xd048('0x23')](respondWithResult(_0x183cda,null))['catch'](handleError(_0x183cda,null));};exports[_0xd048('0x24')]=function(_0x5579d7,_0x2c778e){return db[_0xd048('0x2b')][_0xd048('0x44')]({'where':{'id':_0x5579d7[_0xd048('0x47')]['id']}})['then'](handleEntityNotFound(_0x2c778e,null))[_0xd048('0x23')](removeEntity(_0x2c778e,null))['catch'](handleError(_0x2c778e,null));};exports['describe']=function(_0x4e69ec,_0x41ab26){return db[_0xd048('0x2b')][_0xd048('0x48')]()[_0xd048('0x23')](respondWithResult(_0x41ab26,null))['catch'](handleError(_0x41ab26,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 02a48e6..d513847 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 _0xf4bb=['../../config/environment','exports','define','report_fax_transfer','uniqueid','lodash','util','api','bluebird','path','rimraf'];(function(_0x263a2f,_0x1e81e3){var _0x8020e8=function(_0x39f91a){while(--_0x39f91a){_0x263a2f['push'](_0x263a2f['shift']());}};_0x8020e8(++_0x1e81e3);}(_0xf4bb,0x118));var _0xbf4b=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xf4bb[_0x373dee];return _0x46798f;};'use strict';var _=require(_0xbf4b('0x0'));var util=require(_0xbf4b('0x1'));var logger=require('../../config/logger')(_0xbf4b('0x2'));var moment=require('moment');var BPromise=require(_0xbf4b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf4b('0x4'));var rimraf=require(_0xbf4b('0x5'));var config=require(_0xbf4b('0x6'));var attributes=require('./faxTransferReport.attributes');module[_0xbf4b('0x7')]=function(_0x5927c0,_0x495075){return _0x5927c0[_0xbf4b('0x8')]('FaxTransferReport',attributes,{'tableName':_0xbf4b('0x9'),'paranoid':![],'indexes':[{'name':_0xbf4b('0xa'),'fields':[_0xbf4b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1541=['../../config/environment','./faxTransferReport.attributes','exports','define','report_fax_transfer','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x53dc8a,_0x35549d){var _0x145ca7=function(_0x1f6733){while(--_0x1f6733){_0x53dc8a['push'](_0x53dc8a['shift']());}};_0x145ca7(++_0x35549d);}(_0x1541,0x158));var _0x1154=function(_0x3e531a,_0x28a82a){_0x3e531a=_0x3e531a-0x0;var _0x3c2574=_0x1541[_0x3e531a];return _0x3c2574;};'use strict';var _=require('lodash');var util=require(_0x1154('0x0'));var logger=require(_0x1154('0x1'))('api');var moment=require(_0x1154('0x2'));var BPromise=require(_0x1154('0x3'));var rp=require(_0x1154('0x4'));var fs=require('fs');var path=require(_0x1154('0x5'));var rimraf=require(_0x1154('0x6'));var config=require(_0x1154('0x7'));var attributes=require(_0x1154('0x8'));module[_0x1154('0x9')]=function(_0xd0d446,_0x4ec72b){return _0xd0d446[_0x1154('0xa')]('FaxTransferReport',attributes,{'tableName':_0x1154('0xb'),'paranoid':![],'indexes':[{'name':_0x1154('0xc'),'fields':[_0x1154('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 00836cf..858c57c 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 _0xecff=['info','result','catch','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0xecff,0x157));var _0xfecf=function(_0x3c9190,_0x3f9c5d){_0x3c9190=_0x3c9190-0x0;var _0x59fbf2=_0xecff[_0x3c9190];return _0x59fbf2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xfecf('0x0'));var rs=require(_0xfecf('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfecf('0x2'))['db'];var utils=require(_0xfecf('0x3'));var logger=require(_0xfecf('0x4'))(_0xfecf('0x5'));var config=require('../../config/environment');var jayson=require(_0xfecf('0x6'));var client=jayson[_0xfecf('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5baad9,_0x18ff0f,_0x5c4d65){return new BPromise(function(_0x533eb9,_0x3d7d7c){return client[_0xfecf('0x8')](_0x5baad9,_0x5c4d65)['then'](function(_0x468859){logger['info'](_0xfecf('0x9'),_0x18ff0f,_0xfecf('0xa'));logger[_0xfecf('0xb')](_0xfecf('0xc'),_0x18ff0f,_0xfecf('0xa'),JSON[_0xfecf('0xd')](_0x468859));if(_0x468859[_0xfecf('0xe')]){if(_0x468859[_0xfecf('0xe')][_0xfecf('0xf')]===0x1f4){logger[_0xfecf('0xe')](_0xfecf('0x9'),_0x18ff0f,_0x468859['error']['message']);return _0x3d7d7c(_0x468859[_0xfecf('0xe')][_0xfecf('0x10')]);}logger[_0xfecf('0xe')](_0xfecf('0x9'),_0x18ff0f,_0x468859[_0xfecf('0xe')][_0xfecf('0x10')]);return _0x533eb9(_0x468859[_0xfecf('0xe')]['message']);}else{logger[_0xfecf('0x11')](_0xfecf('0x9'),_0x18ff0f,_0xfecf('0xa'));_0x533eb9(_0x468859[_0xfecf('0x12')][_0xfecf('0x10')]);}})[_0xfecf('0x13')](function(_0xaea4ec){logger['error'](_0xfecf('0x9'),_0x18ff0f,_0xaea4ec);_0x3d7d7c(_0xaea4ec);});});} \ No newline at end of file +var _0xeef8=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x2ac5f8,_0x4c3a9f){var _0x3b8229=function(_0x46a3c0){while(--_0x46a3c0){_0x2ac5f8['push'](_0x2ac5f8['shift']());}};_0x3b8229(++_0x4c3a9f);}(_0xeef8,0xef));var _0x8eef=function(_0x39f2a0,_0x1b4218){_0x39f2a0=_0x39f2a0-0x0;var _0xc3b321=_0xeef8[_0x39f2a0];return _0xc3b321;};'use strict';var _=require(_0x8eef('0x0'));var util=require(_0x8eef('0x1'));var moment=require(_0x8eef('0x2'));var BPromise=require(_0x8eef('0x3'));var rs=require(_0x8eef('0x4'));var fs=require('fs');var Redis=require(_0x8eef('0x5'));var db=require(_0x8eef('0x6'))['db'];var utils=require(_0x8eef('0x7'));var logger=require(_0x8eef('0x8'))(_0x8eef('0x9'));var config=require('../../config/environment');var jayson=require(_0x8eef('0xa'));var client=jayson['client'][_0x8eef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bacbd,_0xcab5ed,_0x34e0f4){return new BPromise(function(_0x2de118,_0x312e86){return client[_0x8eef('0xc')](_0x3bacbd,_0x34e0f4)[_0x8eef('0xd')](function(_0x157374){logger[_0x8eef('0xe')](_0x8eef('0xf'),_0xcab5ed,_0x8eef('0x10'));logger[_0x8eef('0x11')](_0x8eef('0x12'),_0xcab5ed,_0x8eef('0x10'),JSON[_0x8eef('0x13')](_0x157374));if(_0x157374[_0x8eef('0x14')]){if(_0x157374[_0x8eef('0x14')]['code']===0x1f4){logger[_0x8eef('0x14')](_0x8eef('0xf'),_0xcab5ed,_0x157374[_0x8eef('0x14')]['message']);return _0x312e86(_0x157374[_0x8eef('0x14')][_0x8eef('0x15')]);}logger[_0x8eef('0x14')](_0x8eef('0xf'),_0xcab5ed,_0x157374[_0x8eef('0x14')][_0x8eef('0x15')]);return _0x2de118(_0x157374[_0x8eef('0x14')][_0x8eef('0x15')]);}else{logger[_0x8eef('0xe')](_0x8eef('0xf'),_0xcab5ed,_0x8eef('0x10'));_0x2de118(_0x157374[_0x8eef('0x16')][_0x8eef('0x15')]);}})[_0x8eef('0x17')](function(_0x1502a0){logger[_0x8eef('0x14')](_0x8eef('0xf'),_0xcab5ed,_0x1502a0);_0x312e86(_0x1502a0);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index af34cf2..d4be0b8 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 _0xd67c=['destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','./faxTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete'];(function(_0xe206ed,_0x179821){var _0x4423ab=function(_0x2668d2){while(--_0x2668d2){_0xe206ed['push'](_0xe206ed['shift']());}};_0x4423ab(++_0x179821);}(_0xd67c,0xdd));var _0xcd67=function(_0x260b6f,_0x1edc36){_0x260b6f=_0x260b6f-0x0;var _0x3f672e=_0xd67c[_0x260b6f];return _0x3f672e;};'use strict';var multer=require(_0xcd67('0x0'));var util=require(_0xcd67('0x1'));var path=require(_0xcd67('0x2'));var timeout=require('connect-timeout');var express=require(_0xcd67('0x3'));var router=express[_0xcd67('0x4')]();var fs_extra=require(_0xcd67('0x5'));var auth=require(_0xcd67('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcd67('0x7'));router[_0xcd67('0x8')]('/',auth['isAuthenticated'](),controller[_0xcd67('0x9')]);router[_0xcd67('0x8')](_0xcd67('0xa'),auth[_0xcd67('0xb')](),controller[_0xcd67('0xc')]);router[_0xcd67('0x8')](_0xcd67('0xd'),auth[_0xcd67('0xb')](),controller[_0xcd67('0xe')]);router[_0xcd67('0xf')]('/',auth[_0xcd67('0xb')](),controller[_0xcd67('0x10')]);router['put']('/:id',auth[_0xcd67('0xb')](),controller[_0xcd67('0x11')]);router[_0xcd67('0x12')](_0xcd67('0xd'),auth[_0xcd67('0xb')](),controller[_0xcd67('0x13')]);module['exports']=router; \ No newline at end of file +var _0x4277=['/describe','describe','show','put','/:id','delete','destroy','exports','multer','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated'];(function(_0x5ab3f8,_0x2de197){var _0x143bd4=function(_0x1c6da5){while(--_0x1c6da5){_0x5ab3f8['push'](_0x5ab3f8['shift']());}};_0x143bd4(++_0x2de197);}(_0x4277,0x1b8));var _0x7427=function(_0x440560,_0xedab4e){_0x440560=_0x440560-0x0;var _0x4b773c=_0x4277[_0x440560];return _0x4b773c;};'use strict';var multer=require(_0x7427('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7427('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x7427('0x2'));var interaction=require(_0x7427('0x3'));var config=require(_0x7427('0x4'));var controller=require(_0x7427('0x5'));router[_0x7427('0x6')]('/',auth[_0x7427('0x7')](),controller['index']);router[_0x7427('0x6')](_0x7427('0x8'),auth[_0x7427('0x7')](),controller[_0x7427('0x9')]);router['get']('/:id',auth[_0x7427('0x7')](),controller[_0x7427('0xa')]);router['post']('/',auth[_0x7427('0x7')](),controller['create']);router[_0x7427('0xb')](_0x7427('0xc'),auth[_0x7427('0x7')](),controller['update']);router[_0x7427('0xd')](_0x7427('0xc'),auth['isAuthenticated'](),controller[_0x7427('0xe')]);module[_0x7427('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 032041e..32a7db4 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 _0x909f=['util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','destroy','exports','multer'];(function(_0x5789f0,_0x43c1c4){var _0x7e94f2=function(_0x1e305f){while(--_0x1e305f){_0x5789f0['push'](_0x5789f0['shift']());}};_0x7e94f2(++_0x43c1c4);}(_0x909f,0x167));var _0xf909=function(_0x3c64b3,_0x3fb085){_0x3c64b3=_0x3c64b3-0x0;var _0x15d310=_0x909f[_0x3c64b3];return _0x15d310;};'use strict';var multer=require(_0xf909('0x0'));var util=require(_0xf909('0x1'));var path=require(_0xf909('0x2'));var timeout=require('connect-timeout');var express=require(_0xf909('0x3'));var router=express[_0xf909('0x4')]();var fs_extra=require(_0xf909('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf909('0x6'));var config=require(_0xf909('0x7'));var controller=require(_0xf909('0x8'));router[_0xf909('0x9')]('/',auth[_0xf909('0xa')](),controller[_0xf909('0xb')]);router[_0xf909('0x9')](_0xf909('0xc'),auth[_0xf909('0xa')](),controller[_0xf909('0xd')]);router['get'](_0xf909('0xe'),auth[_0xf909('0xa')](),controller[_0xf909('0xf')]);router[_0xf909('0x9')](_0xf909('0x10'),auth[_0xf909('0xa')](),controller[_0xf909('0x11')]);router[_0xf909('0x12')]('/',auth['isAuthenticated'](),controller[_0xf909('0x13')]);router[_0xf909('0x12')]('/:id/configurations',auth[_0xf909('0xa')](),controller[_0xf909('0x14')]);router[_0xf909('0x15')](_0xf909('0xc'),auth[_0xf909('0xa')](),controller['update']);router['delete'](_0xf909('0xc'),auth['isAuthenticated'](),controller[_0xf909('0x16')]);module[_0xf909('0x17')]=router; \ No newline at end of file +var _0x39f9=['create','post','addConfiguration','put','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x4edd07,_0x14ad39){var _0x10bb16=function(_0x2b8d78){while(--_0x2b8d78){_0x4edd07['push'](_0x4edd07['shift']());}};_0x10bb16(++_0x14ad39);}(_0x39f9,0x1d3));var _0x939f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x39f9[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x939f('0x0'));var util=require(_0x939f('0x1'));var path=require(_0x939f('0x2'));var timeout=require(_0x939f('0x3'));var express=require(_0x939f('0x4'));var router=express[_0x939f('0x5')]();var fs_extra=require(_0x939f('0x6'));var auth=require(_0x939f('0x7'));var interaction=require(_0x939f('0x8'));var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router[_0x939f('0x9')]('/',auth[_0x939f('0xa')](),controller[_0x939f('0xb')]);router['get'](_0x939f('0xc'),auth[_0x939f('0xa')](),controller['show']);router[_0x939f('0x9')](_0x939f('0xd'),auth[_0x939f('0xa')](),controller[_0x939f('0xe')]);router[_0x939f('0x9')](_0x939f('0xf'),auth[_0x939f('0xa')](),controller[_0x939f('0x10')]);router['post']('/',auth[_0x939f('0xa')](),controller[_0x939f('0x11')]);router[_0x939f('0x12')]('/:id/configurations',auth[_0x939f('0xa')](),controller[_0x939f('0x13')]);router[_0x939f('0x14')](_0x939f('0xc'),auth[_0x939f('0xa')](),controller['update']);router['delete'](_0x939f('0xc'),auth[_0x939f('0xa')](),controller[_0x939f('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index e6e1ce2..93d7c02 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 _0x01dd=['sequelize','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x01dd,0x1bc));var _0xd01d=function(_0x4521e3,_0x10a8a4){_0x4521e3=_0x4521e3-0x0;var _0x46a272=_0x01dd[_0x4521e3];return _0x46a272;};'use strict';var Sequelize=require(_0xd01d('0x0'));module['exports']={'name':{'type':Sequelize[_0xd01d('0x1')]},'description':{'type':Sequelize[_0xd01d('0x1')]},'username':{'type':Sequelize[_0xd01d('0x1')]},'remoteUri':{'type':Sequelize[_0xd01d('0x1')]},'authType':{'type':Sequelize[_0xd01d('0x2')](_0xd01d('0x3')),'defaultValue':_0xd01d('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xd01d('0x1')]},'tokenSecret':{'type':Sequelize[_0xd01d('0x1')]},'serverUrl':{'type':Sequelize[_0xd01d('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xd01d('0x2')](_0xd01d('0x4'),_0xd01d('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x9246=['STRING','basic','ENUM','newTab','integrationTab','sequelize'];(function(_0x5acb88,_0x2c97fa){var _0x4ae5b5=function(_0x511430){while(--_0x511430){_0x5acb88['push'](_0x5acb88['shift']());}};_0x4ae5b5(++_0x2c97fa);}(_0x9246,0x125));var _0x6924=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x9246[_0x58e469];return _0x4c01c5;};'use strict';var Sequelize=require(_0x6924('0x0'));module['exports']={'name':{'type':Sequelize[_0x6924('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6924('0x1')]},'remoteUri':{'type':Sequelize[_0x6924('0x1')]},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':_0x6924('0x2')},'password':{'type':Sequelize[_0x6924('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x6924('0x1')]},'tokenSecret':{'type':Sequelize[_0x6924('0x1')]},'serverUrl':{'type':Sequelize[_0x6924('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x6924('0x3')]('integrationTab',_0x6924('0x4')),'defaultValue':_0x6924('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 822bb48..bf43068 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 _0x4db0=['getConfigurations','findOne','nolimit','addConfiguration','AccountId','Subjects','channel','type','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','DeskAccount','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','rows','show','params','include','catch','create','body'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x4db0,0x1ec));var _0x04db=function(_0x575b72,_0x1a7eb1){_0x575b72=_0x575b72-0x0;var _0x561c57=_0x4db0[_0x575b72];return _0x561c57;};'use strict';var emlformat=require(_0x04db('0x0'));var rimraf=require(_0x04db('0x1'));var zipdir=require(_0x04db('0x2'));var jsonpatch=require(_0x04db('0x3'));var rp=require(_0x04db('0x4'));var moment=require(_0x04db('0x5'));var BPromise=require(_0x04db('0x6'));var Mustache=require(_0x04db('0x7'));var util=require(_0x04db('0x8'));var path=require(_0x04db('0x9'));var sox=require(_0x04db('0xa'));var csv=require(_0x04db('0xb'));var ejs=require(_0x04db('0xc'));var fs=require('fs');var fs_extra=require(_0x04db('0xd'));var _=require(_0x04db('0xe'));var squel=require(_0x04db('0xf'));var crypto=require(_0x04db('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x04db('0x11'));var toCsv=require('to-csv');var querystring=require(_0x04db('0x12'));var Papa=require(_0x04db('0x13'));var Redis=require(_0x04db('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x04db('0x15'));var as=require(_0x04db('0x16'));var hardwareService=require(_0x04db('0x17'));var logger=require(_0x04db('0x18'))(_0x04db('0x19'));var utils=require(_0x04db('0x1a'));var config=require(_0x04db('0x1b'));var licenseUtil=require(_0x04db('0x1c'));var db=require(_0x04db('0x1d'))['db'];var integrations=require(_0x04db('0x1e'));function respondWithStatusCode(_0x94ce0e,_0x3a0fe6){_0x3a0fe6=_0x3a0fe6||0xcc;return function(_0x2a823b){if(_0x2a823b){return _0x94ce0e[_0x04db('0x1f')](_0x3a0fe6);}return _0x94ce0e[_0x04db('0x20')](_0x3a0fe6)['end']();};}function respondWithResult(_0x27a0a6,_0x1b2278){_0x1b2278=_0x1b2278||0xc8;return function(_0x1eaeb0){if(_0x1eaeb0){return _0x27a0a6[_0x04db('0x20')](_0x1b2278)[_0x04db('0x21')](_0x1eaeb0);}};}function respondWithFilteredResult(_0x549b07,_0xbdc7d1){return function(_0x5d1f0c){if(_0x5d1f0c){var _0x46e80d=typeof _0xbdc7d1[_0x04db('0x22')]===_0x04db('0x23')&&typeof _0xbdc7d1[_0x04db('0x24')]==='undefined';var _0x2905fc=_0x5d1f0c['count'];var _0x2aba2e=_0x46e80d?0x0:_0xbdc7d1[_0x04db('0x22')];var _0x3a4c04=_0x46e80d?_0x5d1f0c['count']:_0xbdc7d1['offset']+_0xbdc7d1[_0x04db('0x24')];var _0xcea962;if(_0x3a4c04>=_0x2905fc){_0x3a4c04=_0x2905fc;_0xcea962=0xc8;}else{_0xcea962=0xce;}_0x549b07[_0x04db('0x20')](_0xcea962);return _0x549b07['set'](_0x04db('0x25'),_0x2aba2e+'-'+_0x3a4c04+'/'+_0x2905fc)[_0x04db('0x21')](_0x5d1f0c);}return null;};}function patchUpdates(_0x30d0c0){return function(_0x424294){try{jsonpatch[_0x04db('0x26')](_0x424294,_0x30d0c0,!![]);}catch(_0x3b48d0){return BPromise[_0x04db('0x27')](_0x3b48d0);}return _0x424294[_0x04db('0x28')]();};}function saveUpdates(_0x229f4b,_0x1215e2){return function(_0x1e507a){if(_0x1e507a){return _0x1e507a[_0x04db('0x29')](_0x229f4b)[_0x04db('0x2a')](function(_0x414bfd){return _0x414bfd;});}return null;};}function removeEntity(_0x3c216f,_0x2b1182){return function(_0x420262){if(_0x420262){return _0x420262[_0x04db('0x2b')]()[_0x04db('0x2a')](function(){_0x3c216f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e87d8,_0x27abec){return function(_0x47c032){if(!_0x47c032){_0x2e87d8[_0x04db('0x1f')](0x194);}return _0x47c032;};}function handleError(_0x3b2f28,_0x18b06b){_0x18b06b=_0x18b06b||0x1f4;return function(_0x55e1d9){logger[_0x04db('0x2c')](_0x55e1d9['stack']);if(_0x55e1d9[_0x04db('0x2d')]){delete _0x55e1d9[_0x04db('0x2d')];}_0x3b2f28[_0x04db('0x20')](_0x18b06b)[_0x04db('0x2e')](_0x55e1d9);};}exports[_0x04db('0x2f')]=function(_0x4a73a6,_0x4f4d2c){var _0x14b01c={},_0xbbb861={},_0x43776f={'count':0x0,'rows':[]};var _0xe34e9d=_[_0x04db('0x30')](db[_0x04db('0x31')][_0x04db('0x32')],function(_0x34648e){return{'name':_0x34648e[_0x04db('0x33')],'type':_0x34648e['type'][_0x04db('0x34')]};});_0xbbb861[_0x04db('0x35')]=_[_0x04db('0x30')](_0xe34e9d,_0x04db('0x2d'));_0xbbb861['query']=_[_0x04db('0x36')](_0x4a73a6[_0x04db('0x37')]);_0xbbb861[_0x04db('0x38')]=_['intersection'](_0xbbb861[_0x04db('0x35')],_0xbbb861['query']);_0x14b01c['attributes']=_[_0x04db('0x39')](_0xbbb861[_0x04db('0x35')],qs[_0x04db('0x3a')](_0x4a73a6[_0x04db('0x37')][_0x04db('0x3a')]));_0x14b01c['attributes']=_0x14b01c['attributes'][_0x04db('0x3b')]?_0x14b01c[_0x04db('0x3c')]:_0xbbb861[_0x04db('0x35')];if(!_0x4a73a6[_0x04db('0x37')][_0x04db('0x3d')]('nolimit')){_0x14b01c[_0x04db('0x24')]=qs[_0x04db('0x24')](_0x4a73a6['query'][_0x04db('0x24')]);_0x14b01c['offset']=qs[_0x04db('0x22')](_0x4a73a6[_0x04db('0x37')][_0x04db('0x22')]);}_0x14b01c[_0x04db('0x3e')]=qs[_0x04db('0x3f')](_0x4a73a6['query'][_0x04db('0x3f')]);_0x14b01c[_0x04db('0x40')]=qs[_0x04db('0x38')](_[_0x04db('0x41')](_0x4a73a6[_0x04db('0x37')],_0xbbb861[_0x04db('0x38')]),_0xe34e9d);if(_0x4a73a6[_0x04db('0x37')][_0x04db('0x42')]){_0x14b01c[_0x04db('0x40')]=_['merge'](_0x14b01c[_0x04db('0x40')],{'$or':_[_0x04db('0x30')](_0xe34e9d,function(_0x39d75f){if(_0x39d75f['type']!=='VIRTUAL'){var _0x6d766={};_0x6d766[_0x39d75f[_0x04db('0x2d')]]={'$like':'%'+_0x4a73a6[_0x04db('0x37')][_0x04db('0x42')]+'%'};return _0x6d766;}})});}_0x14b01c=_[_0x04db('0x43')]({},_0x14b01c,_0x4a73a6[_0x04db('0x44')]);var _0x598e00={'where':_0x14b01c['where']};return db[_0x04db('0x31')]['count'](_0x598e00)['then'](function(_0x294643){_0x43776f[_0x04db('0x45')]=_0x294643;if(_0x4a73a6[_0x04db('0x37')][_0x04db('0x46')]){_0x14b01c['include']=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x14b01c);})[_0x04db('0x2a')](function(_0x5c3143){_0x43776f[_0x04db('0x47')]=_0x5c3143;return _0x43776f;})[_0x04db('0x2a')](respondWithFilteredResult(_0x4f4d2c,_0x14b01c))['catch'](handleError(_0x4f4d2c,null));};exports[_0x04db('0x48')]=function(_0x240a4d,_0x3f65bd){var _0x359275={'raw':![],'where':{'id':_0x240a4d[_0x04db('0x49')]['id']}},_0x3689a8={};_0x3689a8[_0x04db('0x35')]=_[_0x04db('0x36')](db[_0x04db('0x31')][_0x04db('0x32')]);_0x3689a8[_0x04db('0x37')]=_['keys'](_0x240a4d[_0x04db('0x37')]);_0x3689a8[_0x04db('0x38')]=_['intersection'](_0x3689a8[_0x04db('0x35')],_0x3689a8['query']);_0x359275[_0x04db('0x3c')]=_[_0x04db('0x39')](_0x3689a8[_0x04db('0x35')],qs['fields'](_0x240a4d[_0x04db('0x37')][_0x04db('0x3a')]));_0x359275[_0x04db('0x3c')]=_0x359275[_0x04db('0x3c')][_0x04db('0x3b')]?_0x359275[_0x04db('0x3c')]:_0x3689a8['model'];if(_0x240a4d[_0x04db('0x37')][_0x04db('0x46')]){_0x359275[_0x04db('0x4a')]=[{'all':!![]}];}_0x359275=_[_0x04db('0x43')]({},_0x359275,_0x240a4d['options']);return db[_0x04db('0x31')]['find'](_0x359275)['then'](handleEntityNotFound(_0x3f65bd,null))['then'](respondWithResult(_0x3f65bd,null))[_0x04db('0x4b')](handleError(_0x3f65bd,null));};exports[_0x04db('0x4c')]=function(_0x3e2bf6,_0x54ba6e){return db[_0x04db('0x31')][_0x04db('0x4c')](_0x3e2bf6[_0x04db('0x4d')],{})[_0x04db('0x2a')](respondWithResult(_0x54ba6e,0xc9))[_0x04db('0x4b')](handleError(_0x54ba6e,null));};exports['update']=function(_0x4ed5a3,_0x5615c1){if(_0x4ed5a3[_0x04db('0x4d')]['id']){delete _0x4ed5a3['body']['id'];}return db[_0x04db('0x31')]['find']({'where':{'id':_0x4ed5a3[_0x04db('0x49')]['id']}})[_0x04db('0x2a')](handleEntityNotFound(_0x5615c1,null))[_0x04db('0x2a')](saveUpdates(_0x4ed5a3[_0x04db('0x4d')],null))[_0x04db('0x2a')](respondWithResult(_0x5615c1,null))['catch'](handleError(_0x5615c1,null));};exports[_0x04db('0x2b')]=function(_0x5d2300,_0x39eb2c){return db[_0x04db('0x31')]['find']({'where':{'id':_0x5d2300[_0x04db('0x49')]['id']}})[_0x04db('0x2a')](handleEntityNotFound(_0x39eb2c,null))[_0x04db('0x2a')](removeEntity(_0x39eb2c,null))[_0x04db('0x4b')](handleError(_0x39eb2c,null));};exports[_0x04db('0x4e')]=function(_0x22b9d8,_0x10031e,_0x9e8459){var _0x1722dc={};var _0x1112a2={};var _0x6936a0;var _0x1fd669;return db[_0x04db('0x31')][_0x04db('0x4f')]({'where':{'id':_0x22b9d8['params']['id']}})['then'](handleEntityNotFound(_0x10031e,null))[_0x04db('0x2a')](function(_0x196b87){if(_0x196b87){_0x6936a0=_0x196b87;_0x1112a2['model']=_[_0x04db('0x36')](db['DeskConfiguration'][_0x04db('0x32')]);_0x1112a2[_0x04db('0x37')]=_[_0x04db('0x36')](_0x22b9d8[_0x04db('0x37')]);_0x1112a2[_0x04db('0x38')]=_[_0x04db('0x39')](_0x1112a2[_0x04db('0x35')],_0x1112a2[_0x04db('0x37')]);_0x1722dc['attributes']=_['intersection'](_0x1112a2[_0x04db('0x35')],qs[_0x04db('0x3a')](_0x22b9d8[_0x04db('0x37')]['fields']));_0x1722dc['attributes']=_0x1722dc[_0x04db('0x3c')][_0x04db('0x3b')]?_0x1722dc[_0x04db('0x3c')]:_0x1112a2[_0x04db('0x35')];_0x1722dc[_0x04db('0x3e')]=qs[_0x04db('0x3f')](_0x22b9d8[_0x04db('0x37')][_0x04db('0x3f')]);_0x1722dc[_0x04db('0x40')]=qs['filters'](_[_0x04db('0x41')](_0x22b9d8[_0x04db('0x37')],_0x1112a2[_0x04db('0x38')]));if(_0x22b9d8['query'][_0x04db('0x42')]){_0x1722dc[_0x04db('0x40')]=_[_0x04db('0x43')](_0x1722dc[_0x04db('0x40')],{'$or':_[_0x04db('0x30')](_0x1722dc['attributes'],function(_0x16d198){var _0x36a9bb={};_0x36a9bb[_0x16d198]={'$like':'%'+_0x22b9d8[_0x04db('0x37')][_0x04db('0x42')]+'%'};return _0x36a9bb;})});}_0x1722dc=_[_0x04db('0x43')]({},_0x1722dc,_0x22b9d8[_0x04db('0x44')]);return _0x6936a0['getConfigurations'](_0x1722dc);}})[_0x04db('0x2a')](function(_0x147cb0){if(_0x147cb0){_0x1fd669=_0x147cb0[_0x04db('0x3b')];if(!_0x22b9d8[_0x04db('0x37')][_0x04db('0x3d')](_0x04db('0x50'))){_0x1722dc[_0x04db('0x24')]=qs[_0x04db('0x24')](_0x22b9d8['query'][_0x04db('0x24')]);_0x1722dc[_0x04db('0x22')]=qs[_0x04db('0x22')](_0x22b9d8['query'][_0x04db('0x22')]);}return _0x6936a0[_0x04db('0x4e')](_0x1722dc);}})['then'](function(_0x5c177c){if(_0x5c177c){return _0x5c177c?{'count':_0x1fd669,'rows':_0x5c177c}:null;}})[_0x04db('0x2a')](respondWithResult(_0x10031e,null))[_0x04db('0x4b')](handleError(_0x10031e,null));};exports[_0x04db('0x51')]=function(_0x109bea,_0x1c63e7,_0x766571){if(_0x109bea['body']['id']){delete _0x109bea['body']['id'];}return db[_0x04db('0x31')][_0x04db('0x4f')]({'where':{'id':_0x109bea[_0x04db('0x49')]['id']}})[_0x04db('0x2a')](handleEntityNotFound(_0x1c63e7,null))[_0x04db('0x2a')](function(_0x298960){if(_0x298960){_0x109bea[_0x04db('0x4d')][_0x04db('0x52')]=_0x298960['id'];_0x109bea[_0x04db('0x4d')][_0x04db('0x53')]=integrations['getSubjects'](_0x109bea[_0x04db('0x4d')][_0x04db('0x54')],_0x109bea[_0x04db('0x4d')][_0x04db('0x55')]);_0x109bea[_0x04db('0x4d')]['Descriptions']=integrations['getDescriptions'](_0x109bea[_0x04db('0x4d')][_0x04db('0x54')],_0x109bea[_0x04db('0x4d')][_0x04db('0x55')]);return db['DeskConfiguration']['create'](_0x109bea[_0x04db('0x4d')],{'include':[{'model':db['DeskField'],'as':_0x04db('0x53')},{'model':db['DeskField'],'as':_0x04db('0x56')}]});}return null;})[_0x04db('0x2a')](respondWithResult(_0x1c63e7,null))[_0x04db('0x4b')](handleError(_0x1c63e7,null));};exports[_0x04db('0x57')]=function(_0x5b1c04,_0x261d3e,_0x551d96){var _0x3cf692=[{'name':_0x04db('0x58'),'label':_0x04db('0x58'),'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 _0x4e7206='';return db[_0x04db('0x31')][_0x04db('0x4f')]({'where':{'id':_0x5b1c04[_0x04db('0x49')]['id']},'attributes':['id',_0x04db('0x59'),_0x04db('0x5a'),_0x04db('0x5b'),_0x04db('0x5c'),_0x04db('0x5d'),_0x04db('0x5e'),_0x04db('0x5f'),'tokenSecret']})[_0x04db('0x2a')](handleEntityNotFound(_0x261d3e,null))[_0x04db('0x2a')](function(_0x36a1c7){if(_0x36a1c7){_0x4e7206=_0x36a1c7[_0x04db('0x59')];var _0x413d87=_0x4e7206['slice'](-0x1);if(_0x413d87==='/'){_0x4e7206=_0x4e7206[_0x04db('0x60')](0x0,_0x4e7206[_0x04db('0x61')](_0x413d87));}var _0x101e73={'method':_0x04db('0x62'),'uri':util[_0x04db('0x63')](_0x04db('0x64'),_0x4e7206),'headers':{'Content-Type':_0x04db('0x65'),'Accept':'application/json'},'json':!![]};if(_0x36a1c7[_0x04db('0x5a')]===_0x04db('0x66')){_0x101e73[_0x04db('0x67')][_0x04db('0x68')]=util[_0x04db('0x63')](_0x04db('0x69'),new Buffer(util[_0x04db('0x63')](_0x04db('0x6a'),_0x36a1c7[_0x04db('0x5b')],_0x36a1c7[_0x04db('0x5c')]))['toString']('base64'));}return rp(_0x101e73)[_0x04db('0x2a')](function(_0x330793){return _0x3cf692['concat'](_[_0x04db('0x30')](_0x330793['_embedded']['entries'],function(_0x2391b7){return{'id':_0x2391b7['name'],'name':_0x2391b7[_0x04db('0x2d')],'type':_0x2391b7[_0x04db('0x55')],'active':_0x2391b7[_0x04db('0x6b')],'label':_0x2391b7[_0x04db('0x6c')],'custom':!![]};}));});}})[_0x04db('0x2a')](function(_0x4c8cc9){return{'count':_0x4c8cc9['length'],'rows':_0x4c8cc9};})[_0x04db('0x2a')](respondWithResult(_0x261d3e,null))[_0x04db('0x4b')](function(_0x470857){var _0x387f00=_0x5b1c04[_0x04db('0x37')][_0x04db('0x6d')]?0x1f4:_0x470857[_0x04db('0x6e')]||0x1f4;logger[_0x04db('0x2c')](_0x04db('0x6f'),_0x04db('0x57'),_0x387f00,JSON[_0x04db('0x70')](_0x470857));delete _0x470857[_0x04db('0x2d')];if(_0x387f00===0x191){_0x387f00=0x190;}_0x261d3e[_0x04db('0x20')](_0x387f00)['send'](_0x5b1c04[_0x04db('0x37')][_0x04db('0x6d')]?{'message':_0x04db('0x71'),'statusCode':_0x470857[_0x04db('0x6e')]}:_0x470857);});}; \ No newline at end of file +var _0x7f72=['getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','tokenSecret','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','apply','save','then','destroy','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','update'];(function(_0x5d0014,_0xdd9ece){var _0x5b64ac=function(_0x3fbb2c){while(--_0x3fbb2c){_0x5d0014['push'](_0x5d0014['shift']());}};_0x5b64ac(++_0xdd9ece);}(_0x7f72,0x99));var _0x27f7=function(_0x49258d,_0x5bcf0e){_0x49258d=_0x49258d-0x0;var _0x2a9044=_0x7f72[_0x49258d];return _0x2a9044;};'use strict';var emlformat=require(_0x27f7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x27f7('0x1'));var jsonpatch=require(_0x27f7('0x2'));var rp=require(_0x27f7('0x3'));var moment=require('moment');var BPromise=require(_0x27f7('0x4'));var Mustache=require('mustache');var util=require(_0x27f7('0x5'));var path=require(_0x27f7('0x6'));var sox=require(_0x27f7('0x7'));var csv=require(_0x27f7('0x8'));var ejs=require(_0x27f7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x27f7('0xa'));var jsforce=require(_0x27f7('0xb'));var deskjs=require(_0x27f7('0xc'));var toCsv=require(_0x27f7('0x8'));var querystring=require(_0x27f7('0xd'));var Papa=require(_0x27f7('0xe'));var Redis=require('ioredis');var authService=require(_0x27f7('0xf'));var qs=require(_0x27f7('0x10'));var as=require(_0x27f7('0x11'));var hardwareService=require(_0x27f7('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x27f7('0x13'));var config=require(_0x27f7('0x14'));var licenseUtil=require(_0x27f7('0x15'));var db=require(_0x27f7('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1c1d26,_0x4b5e28){_0x4b5e28=_0x4b5e28||0xcc;return function(_0x5e294d){if(_0x5e294d){return _0x1c1d26[_0x27f7('0x17')](_0x4b5e28);}return _0x1c1d26[_0x27f7('0x18')](_0x4b5e28)[_0x27f7('0x19')]();};}function respondWithResult(_0x1947c2,_0x343372){_0x343372=_0x343372||0xc8;return function(_0x475289){if(_0x475289){return _0x1947c2['status'](_0x343372)[_0x27f7('0x1a')](_0x475289);}};}function respondWithFilteredResult(_0x22a103,_0x22c638){return function(_0x2633ce){if(_0x2633ce){var _0x2c825b=typeof _0x22c638['offset']===_0x27f7('0x1b')&&typeof _0x22c638['limit']==='undefined';var _0x36ebef=_0x2633ce[_0x27f7('0x1c')];var _0x23e599=_0x2c825b?0x0:_0x22c638[_0x27f7('0x1d')];var _0x1c54b5=_0x2c825b?_0x2633ce['count']:_0x22c638[_0x27f7('0x1d')]+_0x22c638[_0x27f7('0x1e')];var _0x4143ef;if(_0x1c54b5>=_0x36ebef){_0x1c54b5=_0x36ebef;_0x4143ef=0xc8;}else{_0x4143ef=0xce;}_0x22a103[_0x27f7('0x18')](_0x4143ef);return _0x22a103['set']('Content-Range',_0x23e599+'-'+_0x1c54b5+'/'+_0x36ebef)[_0x27f7('0x1a')](_0x2633ce);}return null;};}function patchUpdates(_0x1b3b4b){return function(_0xe94042){try{jsonpatch[_0x27f7('0x1f')](_0xe94042,_0x1b3b4b,!![]);}catch(_0x3df83b){return BPromise['reject'](_0x3df83b);}return _0xe94042[_0x27f7('0x20')]();};}function saveUpdates(_0x1a0d9a,_0x327e8b){return function(_0x5023ee){if(_0x5023ee){return _0x5023ee['update'](_0x1a0d9a)[_0x27f7('0x21')](function(_0x50ffcc){return _0x50ffcc;});}return null;};}function removeEntity(_0x35fdb9,_0x47e52f){return function(_0x2368ee){if(_0x2368ee){return _0x2368ee[_0x27f7('0x22')]()[_0x27f7('0x21')](function(){_0x35fdb9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1429b5,_0x5c2243){return function(_0x48d9c5){if(!_0x48d9c5){_0x1429b5[_0x27f7('0x17')](0x194);}return _0x48d9c5;};}function handleError(_0x2cea29,_0x133734){_0x133734=_0x133734||0x1f4;return function(_0x47c694){logger['error'](_0x47c694[_0x27f7('0x23')]);if(_0x47c694['name']){delete _0x47c694[_0x27f7('0x24')];}_0x2cea29[_0x27f7('0x18')](_0x133734)[_0x27f7('0x25')](_0x47c694);};}exports[_0x27f7('0x26')]=function(_0x57627b,_0x322c9c){var _0x10d73a={},_0x29e7f7={},_0x226161={'count':0x0,'rows':[]};var _0x55f950=_[_0x27f7('0x27')](db[_0x27f7('0x28')][_0x27f7('0x29')],function(_0x59ac3d){return{'name':_0x59ac3d[_0x27f7('0x2a')],'type':_0x59ac3d['type'][_0x27f7('0x2b')]};});_0x29e7f7[_0x27f7('0x2c')]=_[_0x27f7('0x27')](_0x55f950,_0x27f7('0x24'));_0x29e7f7[_0x27f7('0x2d')]=_[_0x27f7('0x2e')](_0x57627b[_0x27f7('0x2d')]);_0x29e7f7['filters']=_[_0x27f7('0x2f')](_0x29e7f7['model'],_0x29e7f7[_0x27f7('0x2d')]);_0x10d73a[_0x27f7('0x30')]=_['intersection'](_0x29e7f7[_0x27f7('0x2c')],qs[_0x27f7('0x31')](_0x57627b[_0x27f7('0x2d')][_0x27f7('0x31')]));_0x10d73a['attributes']=_0x10d73a[_0x27f7('0x30')][_0x27f7('0x32')]?_0x10d73a[_0x27f7('0x30')]:_0x29e7f7[_0x27f7('0x2c')];if(!_0x57627b[_0x27f7('0x2d')][_0x27f7('0x33')](_0x27f7('0x34'))){_0x10d73a[_0x27f7('0x1e')]=qs['limit'](_0x57627b['query']['limit']);_0x10d73a['offset']=qs[_0x27f7('0x1d')](_0x57627b['query'][_0x27f7('0x1d')]);}_0x10d73a[_0x27f7('0x35')]=qs['sort'](_0x57627b[_0x27f7('0x2d')][_0x27f7('0x36')]);_0x10d73a['where']=qs[_0x27f7('0x37')](_[_0x27f7('0x38')](_0x57627b[_0x27f7('0x2d')],_0x29e7f7[_0x27f7('0x37')]),_0x55f950);if(_0x57627b[_0x27f7('0x2d')][_0x27f7('0x39')]){_0x10d73a[_0x27f7('0x3a')]=_['merge'](_0x10d73a[_0x27f7('0x3a')],{'$or':_[_0x27f7('0x27')](_0x55f950,function(_0x1bfb74){if(_0x1bfb74[_0x27f7('0x3b')]!==_0x27f7('0x3c')){var _0x2a8f3d={};_0x2a8f3d[_0x1bfb74[_0x27f7('0x24')]]={'$like':'%'+_0x57627b['query'][_0x27f7('0x39')]+'%'};return _0x2a8f3d;}})});}_0x10d73a=_[_0x27f7('0x3d')]({},_0x10d73a,_0x57627b[_0x27f7('0x3e')]);var _0x387863={'where':_0x10d73a['where']};return db[_0x27f7('0x28')]['count'](_0x387863)[_0x27f7('0x21')](function(_0x55c185){_0x226161[_0x27f7('0x1c')]=_0x55c185;if(_0x57627b[_0x27f7('0x2d')][_0x27f7('0x3f')]){_0x10d73a[_0x27f7('0x40')]=[{'all':!![]}];}return db[_0x27f7('0x28')][_0x27f7('0x41')](_0x10d73a);})['then'](function(_0x133481){_0x226161['rows']=_0x133481;return _0x226161;})[_0x27f7('0x21')](respondWithFilteredResult(_0x322c9c,_0x10d73a))[_0x27f7('0x42')](handleError(_0x322c9c,null));};exports[_0x27f7('0x43')]=function(_0x4977c9,_0x1a22cc){var _0x12e6c5={'raw':![],'where':{'id':_0x4977c9[_0x27f7('0x44')]['id']}},_0x7983d2={};_0x7983d2[_0x27f7('0x2c')]=_[_0x27f7('0x2e')](db['DeskAccount'][_0x27f7('0x29')]);_0x7983d2[_0x27f7('0x2d')]=_['keys'](_0x4977c9['query']);_0x7983d2['filters']=_[_0x27f7('0x2f')](_0x7983d2[_0x27f7('0x2c')],_0x7983d2[_0x27f7('0x2d')]);_0x12e6c5['attributes']=_[_0x27f7('0x2f')](_0x7983d2[_0x27f7('0x2c')],qs[_0x27f7('0x31')](_0x4977c9[_0x27f7('0x2d')][_0x27f7('0x31')]));_0x12e6c5['attributes']=_0x12e6c5[_0x27f7('0x30')]['length']?_0x12e6c5[_0x27f7('0x30')]:_0x7983d2[_0x27f7('0x2c')];if(_0x4977c9['query'][_0x27f7('0x3f')]){_0x12e6c5[_0x27f7('0x40')]=[{'all':!![]}];}_0x12e6c5=_[_0x27f7('0x3d')]({},_0x12e6c5,_0x4977c9['options']);return db[_0x27f7('0x28')][_0x27f7('0x45')](_0x12e6c5)[_0x27f7('0x21')](handleEntityNotFound(_0x1a22cc,null))[_0x27f7('0x21')](respondWithResult(_0x1a22cc,null))['catch'](handleError(_0x1a22cc,null));};exports[_0x27f7('0x46')]=function(_0x31d6da,_0x49df5c){return db[_0x27f7('0x28')][_0x27f7('0x46')](_0x31d6da[_0x27f7('0x47')],{})[_0x27f7('0x21')](respondWithResult(_0x49df5c,0xc9))[_0x27f7('0x42')](handleError(_0x49df5c,null));};exports[_0x27f7('0x48')]=function(_0x57cbea,_0x5b3f83){if(_0x57cbea[_0x27f7('0x47')]['id']){delete _0x57cbea['body']['id'];}return db[_0x27f7('0x28')][_0x27f7('0x45')]({'where':{'id':_0x57cbea[_0x27f7('0x44')]['id']}})['then'](handleEntityNotFound(_0x5b3f83,null))[_0x27f7('0x21')](saveUpdates(_0x57cbea['body'],null))[_0x27f7('0x21')](respondWithResult(_0x5b3f83,null))[_0x27f7('0x42')](handleError(_0x5b3f83,null));};exports[_0x27f7('0x22')]=function(_0x9eab34,_0x2d5d12){return db[_0x27f7('0x28')][_0x27f7('0x45')]({'where':{'id':_0x9eab34['params']['id']}})[_0x27f7('0x21')](handleEntityNotFound(_0x2d5d12,null))[_0x27f7('0x21')](removeEntity(_0x2d5d12,null))[_0x27f7('0x42')](handleError(_0x2d5d12,null));};exports[_0x27f7('0x49')]=function(_0xefa8b6,_0x3d98a1,_0xb00856){var _0x179175={};var _0x54d2a3={};var _0x315dc4;var _0x364545;return db[_0x27f7('0x28')][_0x27f7('0x4a')]({'where':{'id':_0xefa8b6[_0x27f7('0x44')]['id']}})[_0x27f7('0x21')](handleEntityNotFound(_0x3d98a1,null))[_0x27f7('0x21')](function(_0x1e25bd){if(_0x1e25bd){_0x315dc4=_0x1e25bd;_0x54d2a3[_0x27f7('0x2c')]=_['keys'](db[_0x27f7('0x4b')][_0x27f7('0x29')]);_0x54d2a3[_0x27f7('0x2d')]=_['keys'](_0xefa8b6[_0x27f7('0x2d')]);_0x54d2a3[_0x27f7('0x37')]=_[_0x27f7('0x2f')](_0x54d2a3[_0x27f7('0x2c')],_0x54d2a3[_0x27f7('0x2d')]);_0x179175[_0x27f7('0x30')]=_[_0x27f7('0x2f')](_0x54d2a3[_0x27f7('0x2c')],qs[_0x27f7('0x31')](_0xefa8b6[_0x27f7('0x2d')][_0x27f7('0x31')]));_0x179175[_0x27f7('0x30')]=_0x179175[_0x27f7('0x30')][_0x27f7('0x32')]?_0x179175[_0x27f7('0x30')]:_0x54d2a3[_0x27f7('0x2c')];_0x179175['order']=qs['sort'](_0xefa8b6[_0x27f7('0x2d')][_0x27f7('0x36')]);_0x179175[_0x27f7('0x3a')]=qs[_0x27f7('0x37')](_['pick'](_0xefa8b6['query'],_0x54d2a3['filters']));if(_0xefa8b6[_0x27f7('0x2d')][_0x27f7('0x39')]){_0x179175['where']=_[_0x27f7('0x3d')](_0x179175[_0x27f7('0x3a')],{'$or':_[_0x27f7('0x27')](_0x179175[_0x27f7('0x30')],function(_0x147c87){var _0x45e3dd={};_0x45e3dd[_0x147c87]={'$like':'%'+_0xefa8b6[_0x27f7('0x2d')][_0x27f7('0x39')]+'%'};return _0x45e3dd;})});}_0x179175=_[_0x27f7('0x3d')]({},_0x179175,_0xefa8b6[_0x27f7('0x3e')]);return _0x315dc4[_0x27f7('0x49')](_0x179175);}})[_0x27f7('0x21')](function(_0x2c800e){if(_0x2c800e){_0x364545=_0x2c800e[_0x27f7('0x32')];if(!_0xefa8b6[_0x27f7('0x2d')][_0x27f7('0x33')](_0x27f7('0x34'))){_0x179175[_0x27f7('0x1e')]=qs['limit'](_0xefa8b6[_0x27f7('0x2d')][_0x27f7('0x1e')]);_0x179175[_0x27f7('0x1d')]=qs[_0x27f7('0x1d')](_0xefa8b6[_0x27f7('0x2d')][_0x27f7('0x1d')]);}return _0x315dc4[_0x27f7('0x49')](_0x179175);}})[_0x27f7('0x21')](function(_0x57b4a7){if(_0x57b4a7){return _0x57b4a7?{'count':_0x364545,'rows':_0x57b4a7}:null;}})[_0x27f7('0x21')](respondWithResult(_0x3d98a1,null))[_0x27f7('0x42')](handleError(_0x3d98a1,null));};exports[_0x27f7('0x4c')]=function(_0x1f1835,_0x2426bf,_0x7c1b85){if(_0x1f1835[_0x27f7('0x47')]['id']){delete _0x1f1835['body']['id'];}return db[_0x27f7('0x28')][_0x27f7('0x4a')]({'where':{'id':_0x1f1835[_0x27f7('0x44')]['id']}})['then'](handleEntityNotFound(_0x2426bf,null))[_0x27f7('0x21')](function(_0x216dfb){if(_0x216dfb){_0x1f1835[_0x27f7('0x47')][_0x27f7('0x4d')]=_0x216dfb['id'];_0x1f1835['body'][_0x27f7('0x4e')]=integrations['getSubjects'](_0x1f1835[_0x27f7('0x47')][_0x27f7('0x4f')],_0x1f1835[_0x27f7('0x47')][_0x27f7('0x3b')]);_0x1f1835[_0x27f7('0x47')][_0x27f7('0x50')]=integrations[_0x27f7('0x51')](_0x1f1835[_0x27f7('0x47')]['channel'],_0x1f1835[_0x27f7('0x47')][_0x27f7('0x3b')]);return db[_0x27f7('0x4b')][_0x27f7('0x46')](_0x1f1835[_0x27f7('0x47')],{'include':[{'model':db[_0x27f7('0x52')],'as':'Subjects'},{'model':db[_0x27f7('0x52')],'as':_0x27f7('0x50')}]});}return null;})[_0x27f7('0x21')](respondWithResult(_0x2426bf,null))[_0x27f7('0x42')](handleError(_0x2426bf,null));};exports[_0x27f7('0x53')]=function(_0x1a35b2,_0x179fe5,_0x508d88){var _0x35334c=[{'name':_0x27f7('0x54'),'label':_0x27f7('0x54'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x459098='';return db[_0x27f7('0x28')][_0x27f7('0x4a')]({'where':{'id':_0x1a35b2[_0x27f7('0x44')]['id']},'attributes':['id',_0x27f7('0x55'),_0x27f7('0x56'),_0x27f7('0x57'),_0x27f7('0x58'),_0x27f7('0x59'),_0x27f7('0x5a'),'token',_0x27f7('0x5b')]})[_0x27f7('0x21')](handleEntityNotFound(_0x179fe5,null))['then'](function(_0x287f8c){if(_0x287f8c){_0x459098=_0x287f8c[_0x27f7('0x55')];var _0x8addfe=_0x459098[_0x27f7('0x5c')](-0x1);if(_0x8addfe==='/'){_0x459098=_0x459098['substring'](0x0,_0x459098[_0x27f7('0x5d')](_0x8addfe));}var _0x2d6899={'method':_0x27f7('0x5e'),'uri':util[_0x27f7('0x5f')](_0x27f7('0x60'),_0x459098),'headers':{'Content-Type':'application/json','Accept':_0x27f7('0x61')},'json':!![]};if(_0x287f8c[_0x27f7('0x56')]===_0x27f7('0x62')){_0x2d6899['headers'][_0x27f7('0x63')]=util[_0x27f7('0x5f')](_0x27f7('0x64'),new Buffer(util['format'](_0x27f7('0x65'),_0x287f8c['username'],_0x287f8c[_0x27f7('0x58')]))[_0x27f7('0x66')](_0x27f7('0x67')));}return rp(_0x2d6899)['then'](function(_0x483edc){return _0x35334c[_0x27f7('0x68')](_[_0x27f7('0x27')](_0x483edc[_0x27f7('0x69')][_0x27f7('0x6a')],function(_0x4cf445){return{'id':_0x4cf445[_0x27f7('0x24')],'name':_0x4cf445[_0x27f7('0x24')],'type':_0x4cf445['type'],'active':_0x4cf445[_0x27f7('0x6b')],'label':_0x4cf445[_0x27f7('0x6c')],'custom':!![]};}));});}})[_0x27f7('0x21')](function(_0x30071e){return{'count':_0x30071e[_0x27f7('0x32')],'rows':_0x30071e};})[_0x27f7('0x21')](respondWithResult(_0x179fe5,null))[_0x27f7('0x42')](function(_0x9dbb9a){var _0x43ab57=_0x1a35b2[_0x27f7('0x2d')]['test']?0x1f4:_0x9dbb9a['statusCode']||0x1f4;logger['error'](_0x27f7('0x6d'),_0x27f7('0x53'),_0x43ab57,JSON[_0x27f7('0x6e')](_0x9dbb9a));delete _0x9dbb9a[_0x27f7('0x24')];if(_0x43ab57===0x191){_0x43ab57=0x190;}_0x179fe5['status'](_0x43ab57)['send'](_0x1a35b2[_0x27f7('0x2d')][_0x27f7('0x6f')]?{'message':_0x27f7('0x70'),'statusCode':_0x9dbb9a['statusCode']}:_0x9dbb9a);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index b9f0550..637edbd 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 _0x53ab=['define','DeskAccount','util','api','moment','bluebird','request-promise','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x26e397,_0x5e7c0c){var _0x17b3ce=function(_0x110c23){while(--_0x110c23){_0x26e397['push'](_0x26e397['shift']());}};_0x17b3ce(++_0x5e7c0c);}(_0x53ab,0xff));var _0xb53a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53ab[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xb53a('0x0'));var logger=require('../../config/logger')(_0xb53a('0x1'));var moment=require(_0xb53a('0x2'));var BPromise=require(_0xb53a('0x3'));var rp=require(_0xb53a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb53a('0x5'));var config=require('../../config/environment');var attributes=require(_0xb53a('0x6'));var integrations=require(_0xb53a('0x7'));module[_0xb53a('0x8')]=function(_0x13b3c7,_0x5ec3bb){return _0x13b3c7[_0xb53a('0x9')](_0xb53a('0xa'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc11=['int_desk_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x52dd40,_0xdb9ffa){var _0x47f841=function(_0x1b485d){while(--_0x1b485d){_0x52dd40['push'](_0x52dd40['shift']());}};_0x47f841(++_0xdb9ffa);}(_0xfc11,0x1ae));var _0x1fc1=function(_0x3c7c22,_0x27291d){_0x3c7c22=_0x3c7c22-0x0;var _0x273f01=_0xfc11[_0x3c7c22];return _0x273f01;};'use strict';var _=require(_0x1fc1('0x0'));var util=require(_0x1fc1('0x1'));var logger=require(_0x1fc1('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1fc1('0x3'));var rp=require(_0x1fc1('0x4'));var fs=require('fs');var path=require(_0x1fc1('0x5'));var rimraf=require(_0x1fc1('0x6'));var config=require(_0x1fc1('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x1fc1('0x8')]=function(_0x1b6aba,_0x3a569d){return _0x1b6aba[_0x1fc1('0x9')]('DeskAccount',attributes,{'tableName':_0x1fc1('0xa'),'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 24a6eeb..f396bf4 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 _0x5d53=['limit','include','map','model','GetDeskAccount','ShowDeskAccount','DeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','options','raw','where','attributes'];(function(_0x3603ee,_0x580007){var _0x260286=function(_0x5af22f){while(--_0x5af22f){_0x3603ee['push'](_0x3603ee['shift']());}};_0x260286(++_0x580007);}(_0x5d53,0x15c));var _0x35d5=function(_0x136619,_0x31c9b2){_0x136619=_0x136619-0x0;var _0x38c4a5=_0x5d53[_0x136619];return _0x38c4a5;};'use strict';var _=require(_0x35d5('0x0'));var util=require(_0x35d5('0x1'));var moment=require(_0x35d5('0x2'));var BPromise=require(_0x35d5('0x3'));var rs=require(_0x35d5('0x4'));var fs=require('fs');var Redis=require(_0x35d5('0x5'));var db=require(_0x35d5('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x35d5('0x7'));var config=require(_0x35d5('0x8'));var jayson=require(_0x35d5('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x41bbda,_0x2c6d37,_0x2da7cb){return new BPromise(function(_0x28f786,_0x4d33e9){return client[_0x35d5('0xa')](_0x41bbda,_0x2da7cb)[_0x35d5('0xb')](function(_0x302077){logger[_0x35d5('0xc')](_0x35d5('0xd'),_0x2c6d37,_0x35d5('0xe'));logger[_0x35d5('0xf')](_0x35d5('0x10'),_0x2c6d37,_0x35d5('0xe'),JSON[_0x35d5('0x11')](_0x302077));if(_0x302077['error']){if(_0x302077[_0x35d5('0x12')]['code']===0x1f4){logger[_0x35d5('0x12')](_0x35d5('0xd'),_0x2c6d37,_0x302077[_0x35d5('0x12')][_0x35d5('0x13')]);return _0x4d33e9(_0x302077['error'][_0x35d5('0x13')]);}logger[_0x35d5('0x12')]('DeskAccount,\x20%s,\x20%s',_0x2c6d37,_0x302077[_0x35d5('0x12')][_0x35d5('0x13')]);return _0x28f786(_0x302077[_0x35d5('0x12')]['message']);}else{logger[_0x35d5('0xc')](_0x35d5('0xd'),_0x2c6d37,_0x35d5('0xe'));_0x28f786(_0x302077[_0x35d5('0x14')][_0x35d5('0x13')]);}})[_0x35d5('0x15')](function(_0x39011f){logger[_0x35d5('0x12')](_0x35d5('0xd'),_0x2c6d37,_0x39011f);_0x4d33e9(_0x39011f);});});}exports['GetDeskAccount']=function(_0x5b1050){var _0x381657=this;return new Promise(function(_0xceb048,_0x4c70fd){return db['DeskAccount']['findAll']({'raw':_0x5b1050['options']?_0x5b1050[_0x35d5('0x16')][_0x35d5('0x17')]===undefined?!![]:![]:!![],'where':_0x5b1050[_0x35d5('0x16')]?_0x5b1050[_0x35d5('0x16')][_0x35d5('0x18')]||null:null,'attributes':_0x5b1050[_0x35d5('0x16')]?_0x5b1050['options'][_0x35d5('0x19')]||null:null,'limit':_0x5b1050[_0x35d5('0x16')]?_0x5b1050[_0x35d5('0x16')][_0x35d5('0x1a')]||null:null,'include':_0x5b1050['options']?_0x5b1050[_0x35d5('0x16')][_0x35d5('0x1b')]?_[_0x35d5('0x1c')](_0x5b1050[_0x35d5('0x16')][_0x35d5('0x1b')],function(_0x47aa49){return{'model':db[_0x47aa49[_0x35d5('0x1d')]],'as':_0x47aa49['as'],'attributes':_0x47aa49[_0x35d5('0x19')],'include':_0x47aa49[_0x35d5('0x1b')]?_[_0x35d5('0x1c')](_0x47aa49[_0x35d5('0x1b')],function(_0x5c6f8c){return{'model':db[_0x5c6f8c[_0x35d5('0x1d')]],'as':_0x5c6f8c['as'],'attributes':_0x5c6f8c['attributes'],'include':_0x5c6f8c[_0x35d5('0x1b')]?_[_0x35d5('0x1c')](_0x5c6f8c[_0x35d5('0x1b')],function(_0xb531f4){return{'model':db[_0xb531f4[_0x35d5('0x1d')]],'as':_0xb531f4['as'],'attributes':_0xb531f4[_0x35d5('0x19')]};}):[]};}):[]};}):[]:[]})[_0x35d5('0xb')](function(_0x1a8a74){logger['info'](_0x35d5('0x1e'),_0x5b1050);logger[_0x35d5('0xf')](_0x35d5('0x1e'),_0x5b1050,JSON[_0x35d5('0x11')](_0x1a8a74));_0xceb048(_0x1a8a74);})[_0x35d5('0x15')](function(_0x1046c2){logger[_0x35d5('0x12')](_0x35d5('0x1e'),_0x1046c2[_0x35d5('0x13')],_0x5b1050);_0x4c70fd(_0x381657[_0x35d5('0x12')](0x1f4,_0x1046c2['message']));});});};exports[_0x35d5('0x1f')]=function(_0x1277db){var _0x844ae2=this;return new Promise(function(_0x165dec,_0x2fcb0c){return db[_0x35d5('0x20')][_0x35d5('0x21')]({'raw':_0x1277db[_0x35d5('0x16')]?_0x1277db[_0x35d5('0x16')][_0x35d5('0x17')]===undefined?!![]:![]:!![],'where':_0x1277db['options']?_0x1277db[_0x35d5('0x16')][_0x35d5('0x18')]||null:null,'attributes':_0x1277db[_0x35d5('0x16')]?_0x1277db[_0x35d5('0x16')]['attributes']||null:null,'include':_0x1277db[_0x35d5('0x16')]?_0x1277db[_0x35d5('0x16')][_0x35d5('0x1b')]?_[_0x35d5('0x1c')](_0x1277db[_0x35d5('0x16')]['include'],function(_0x36eb33){return{'model':db[_0x36eb33[_0x35d5('0x1d')]],'as':_0x36eb33['as'],'attributes':_0x36eb33[_0x35d5('0x19')],'include':_0x36eb33[_0x35d5('0x1b')]?_[_0x35d5('0x1c')](_0x36eb33[_0x35d5('0x1b')],function(_0x16b4ad){return{'model':db[_0x16b4ad[_0x35d5('0x1d')]],'as':_0x16b4ad['as'],'attributes':_0x16b4ad[_0x35d5('0x19')],'include':_0x16b4ad[_0x35d5('0x1b')]?_[_0x35d5('0x1c')](_0x16b4ad[_0x35d5('0x1b')],function(_0x3370b6){return{'model':db[_0x3370b6[_0x35d5('0x1d')]],'as':_0x3370b6['as'],'attributes':_0x3370b6[_0x35d5('0x19')]};}):[]};}):[]};}):[]:[]})[_0x35d5('0xb')](function(_0x43805f){logger[_0x35d5('0xc')](_0x35d5('0x1f'),_0x1277db);logger[_0x35d5('0xf')](_0x35d5('0x1f'),_0x1277db,JSON[_0x35d5('0x11')](_0x43805f));_0x165dec(_0x43805f);})[_0x35d5('0x15')](function(_0x519b4b){logger[_0x35d5('0x12')](_0x35d5('0x1f'),_0x519b4b['message'],_0x1277db);_0x2fcb0c(_0x844ae2[_0x35d5('0x12')](0x1f4,_0x519b4b[_0x35d5('0x13')]));});});}; \ No newline at end of file +var _0x5163=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','GetDeskAccount','DeskAccount','options','where','attributes','include','map','model','debug','stringify','find','raw','ShowDeskAccount','lodash','util'];(function(_0x1c74d1,_0x5f24de){var _0x3b5d6c=function(_0x44e565){while(--_0x44e565){_0x1c74d1['push'](_0x1c74d1['shift']());}};_0x3b5d6c(++_0x5f24de);}(_0x5163,0xc4));var _0x3516=function(_0x3742ae,_0xc35c6d){_0x3742ae=_0x3742ae-0x0;var _0x512593=_0x5163[_0x3742ae];return _0x512593;};'use strict';var _=require(_0x3516('0x0'));var util=require(_0x3516('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3516('0x2'));var fs=require('fs');var Redis=require(_0x3516('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3516('0x4'));var logger=require(_0x3516('0x5'))(_0x3516('0x6'));var config=require('../../config/environment');var jayson=require(_0x3516('0x7'));var client=jayson['client'][_0x3516('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16aba7,_0x368c85,_0x3d184f){return new BPromise(function(_0xa3c6dc,_0xed1343){return client[_0x3516('0x9')](_0x16aba7,_0x3d184f)[_0x3516('0xa')](function(_0x5db499){logger[_0x3516('0xb')]('DeskAccount,\x20%s,\x20%s',_0x368c85,_0x3516('0xc'));logger['debug'](_0x3516('0xd'),_0x368c85,_0x3516('0xc'),JSON['stringify'](_0x5db499));if(_0x5db499[_0x3516('0xe')]){if(_0x5db499[_0x3516('0xe')][_0x3516('0xf')]===0x1f4){logger[_0x3516('0xe')](_0x3516('0x10'),_0x368c85,_0x5db499[_0x3516('0xe')]['message']);return _0xed1343(_0x5db499['error'][_0x3516('0x11')]);}logger['error'](_0x3516('0x10'),_0x368c85,_0x5db499[_0x3516('0xe')][_0x3516('0x11')]);return _0xa3c6dc(_0x5db499[_0x3516('0xe')]['message']);}else{logger[_0x3516('0xb')]('DeskAccount,\x20%s,\x20%s',_0x368c85,_0x3516('0xc'));_0xa3c6dc(_0x5db499[_0x3516('0x12')][_0x3516('0x11')]);}})[_0x3516('0x13')](function(_0x4eeee5){logger[_0x3516('0xe')]('DeskAccount,\x20%s,\x20%s',_0x368c85,_0x4eeee5);_0xed1343(_0x4eeee5);});});}exports[_0x3516('0x14')]=function(_0x1c3bb0){var _0x27af8a=this;return new Promise(function(_0x1f3f86,_0x1fce51){return db[_0x3516('0x15')]['findAll']({'raw':_0x1c3bb0[_0x3516('0x16')]?_0x1c3bb0['options']['raw']===undefined?!![]:![]:!![],'where':_0x1c3bb0[_0x3516('0x16')]?_0x1c3bb0[_0x3516('0x16')][_0x3516('0x17')]||null:null,'attributes':_0x1c3bb0[_0x3516('0x16')]?_0x1c3bb0[_0x3516('0x16')][_0x3516('0x18')]||null:null,'limit':_0x1c3bb0[_0x3516('0x16')]?_0x1c3bb0[_0x3516('0x16')]['limit']||null:null,'include':_0x1c3bb0[_0x3516('0x16')]?_0x1c3bb0['options'][_0x3516('0x19')]?_[_0x3516('0x1a')](_0x1c3bb0[_0x3516('0x16')][_0x3516('0x19')],function(_0x3dc1cb){return{'model':db[_0x3dc1cb[_0x3516('0x1b')]],'as':_0x3dc1cb['as'],'attributes':_0x3dc1cb[_0x3516('0x18')],'include':_0x3dc1cb[_0x3516('0x19')]?_[_0x3516('0x1a')](_0x3dc1cb[_0x3516('0x19')],function(_0x101fdb){return{'model':db[_0x101fdb['model']],'as':_0x101fdb['as'],'attributes':_0x101fdb[_0x3516('0x18')],'include':_0x101fdb['include']?_['map'](_0x101fdb['include'],function(_0x3b524c){return{'model':db[_0x3b524c[_0x3516('0x1b')]],'as':_0x3b524c['as'],'attributes':_0x3b524c[_0x3516('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3516('0xa')](function(_0x5cea27){logger['info'](_0x3516('0x14'),_0x1c3bb0);logger[_0x3516('0x1c')](_0x3516('0x14'),_0x1c3bb0,JSON[_0x3516('0x1d')](_0x5cea27));_0x1f3f86(_0x5cea27);})['catch'](function(_0x521d14){logger[_0x3516('0xe')](_0x3516('0x14'),_0x521d14[_0x3516('0x11')],_0x1c3bb0);_0x1fce51(_0x27af8a[_0x3516('0xe')](0x1f4,_0x521d14[_0x3516('0x11')]));});});};exports['ShowDeskAccount']=function(_0x5134d7){var _0x28f236=this;return new Promise(function(_0x31c7a8,_0x293c88){return db[_0x3516('0x15')][_0x3516('0x1e')]({'raw':_0x5134d7[_0x3516('0x16')]?_0x5134d7['options'][_0x3516('0x1f')]===undefined?!![]:![]:!![],'where':_0x5134d7[_0x3516('0x16')]?_0x5134d7[_0x3516('0x16')][_0x3516('0x17')]||null:null,'attributes':_0x5134d7[_0x3516('0x16')]?_0x5134d7[_0x3516('0x16')][_0x3516('0x18')]||null:null,'include':_0x5134d7[_0x3516('0x16')]?_0x5134d7['options'][_0x3516('0x19')]?_[_0x3516('0x1a')](_0x5134d7[_0x3516('0x16')][_0x3516('0x19')],function(_0x2d4fc){return{'model':db[_0x2d4fc['model']],'as':_0x2d4fc['as'],'attributes':_0x2d4fc['attributes'],'include':_0x2d4fc[_0x3516('0x19')]?_[_0x3516('0x1a')](_0x2d4fc[_0x3516('0x19')],function(_0x258e03){return{'model':db[_0x258e03[_0x3516('0x1b')]],'as':_0x258e03['as'],'attributes':_0x258e03['attributes'],'include':_0x258e03['include']?_[_0x3516('0x1a')](_0x258e03[_0x3516('0x19')],function(_0x2b40ca){return{'model':db[_0x2b40ca[_0x3516('0x1b')]],'as':_0x2b40ca['as'],'attributes':_0x2b40ca[_0x3516('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3516('0xa')](function(_0xee3e6c){logger['info'](_0x3516('0x20'),_0x5134d7);logger[_0x3516('0x1c')]('ShowDeskAccount',_0x5134d7,JSON[_0x3516('0x1d')](_0xee3e6c));_0x31c7a8(_0xee3e6c);})[_0x3516('0x13')](function(_0x129609){logger[_0x3516('0xe')]('ShowDeskAccount',_0x129609['message'],_0x5134d7);_0x293c88(_0x28f236[_0x3516('0xe')](0x1f4,_0x129609['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 02c7133..bcb659f 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x5a1831,_0x35d41e){var _0x3f5808=function(_0xc159b4){while(--_0xc159b4){_0x5a1831['push'](_0x5a1831['shift']());}};_0x3f5808(++_0x35d41e);}(_0xedd9,0xfc));var _0x9edd=function(_0xeab168,_0x30d561){_0xeab168=_0xeab168-0x0;var _0xbbf818=_0xedd9[_0xeab168];return _0xbbf818;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file +var _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x39989f,_0x36f153){var _0xc65057=function(_0x30f3f8){while(--_0x30f3f8){_0x39989f['push'](_0x39989f['shift']());}};_0xc65057(++_0x36f153);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'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');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index d30f415..c2172da 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 _0x4039=['STRING','sequelize'];(function(_0x26697f,_0x39d31f){var _0x5abb55=function(_0x53f516){while(--_0x53f516){_0x26697f['push'](_0x26697f['shift']());}};_0x5abb55(++_0x39d31f);}(_0x4039,0xa5));var _0x9403=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x4039[_0x186376];return _0x2dbdd9;};'use strict';var Sequelize=require(_0x9403('0x0'));module['exports']={'name':{'type':Sequelize[_0x9403('0x1')]},'description':{'type':Sequelize[_0x9403('0x1')]}}; \ No newline at end of file +var _0x799c=['exports','STRING'];(function(_0x1ad7df,_0x1a0074){var _0x57c985=function(_0x28b203){while(--_0x28b203){_0x1ad7df['push'](_0x1ad7df['shift']());}};_0x57c985(++_0x1a0074);}(_0x799c,0x1b0));var _0xc799=function(_0xb42dec,_0xa80a65){_0xb42dec=_0xb42dec-0x0;var _0x3d8f7e=_0x799c[_0xb42dec];return _0x3d8f7e;};'use strict';var Sequelize=require('sequelize');module[_0xc799('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc799('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index c919c21..44c1bcf 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 _0x9fd6=['model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','create','body','params','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','save','update','then','destroy','end','error','stack','name','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','keys','query','filters','intersection'];(function(_0x26489f,_0x4beef4){var _0x18192e=function(_0x405c10){while(--_0x405c10){_0x26489f['push'](_0x26489f['shift']());}};_0x18192e(++_0x4beef4);}(_0x9fd6,0x117));var _0x69fd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9fd6[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x69fd('0x0'));var rimraf=require(_0x69fd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x69fd('0x2'));var rp=require(_0x69fd('0x3'));var moment=require(_0x69fd('0x4'));var BPromise=require(_0x69fd('0x5'));var Mustache=require(_0x69fd('0x6'));var util=require(_0x69fd('0x7'));var path=require(_0x69fd('0x8'));var sox=require(_0x69fd('0x9'));var csv=require(_0x69fd('0xa'));var ejs=require(_0x69fd('0xb'));var fs=require('fs');var fs_extra=require(_0x69fd('0xc'));var _=require(_0x69fd('0xd'));var squel=require(_0x69fd('0xe'));var crypto=require(_0x69fd('0xf'));var jsforce=require(_0x69fd('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x69fd('0xa'));var querystring=require(_0x69fd('0x11'));var Papa=require('papaparse');var Redis=require(_0x69fd('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x69fd('0x13'));var as=require(_0x69fd('0x14'));var hardwareService=require(_0x69fd('0x15'));var logger=require(_0x69fd('0x16'))(_0x69fd('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x69fd('0x18'));var db=require(_0x69fd('0x19'))['db'];function respondWithStatusCode(_0x2810c7,_0x508248){_0x508248=_0x508248||0xcc;return function(_0x3bbf2b){if(_0x3bbf2b){return _0x2810c7[_0x69fd('0x1a')](_0x508248);}return _0x2810c7[_0x69fd('0x1b')](_0x508248)['end']();};}function respondWithResult(_0x19f40a,_0x31251b){_0x31251b=_0x31251b||0xc8;return function(_0x18e923){if(_0x18e923){return _0x19f40a[_0x69fd('0x1b')](_0x31251b)[_0x69fd('0x1c')](_0x18e923);}};}function respondWithFilteredResult(_0x5c991b,_0x5c2624){return function(_0x12ec3d){if(_0x12ec3d){var _0x11068b=typeof _0x5c2624[_0x69fd('0x1d')]===_0x69fd('0x1e')&&typeof _0x5c2624['limit']==='undefined';var _0x5fc753=_0x12ec3d['count'];var _0x2b5cab=_0x11068b?0x0:_0x5c2624['offset'];var _0x2ce708=_0x11068b?_0x12ec3d[_0x69fd('0x1f')]:_0x5c2624[_0x69fd('0x1d')]+_0x5c2624[_0x69fd('0x20')];var _0x310d68;if(_0x2ce708>=_0x5fc753){_0x2ce708=_0x5fc753;_0x310d68=0xc8;}else{_0x310d68=0xce;}_0x5c991b[_0x69fd('0x1b')](_0x310d68);return _0x5c991b['set'](_0x69fd('0x21'),_0x2b5cab+'-'+_0x2ce708+'/'+_0x5fc753)[_0x69fd('0x1c')](_0x12ec3d);}return null;};}function patchUpdates(_0x42c614){return function(_0x578106){try{jsonpatch['apply'](_0x578106,_0x42c614,!![]);}catch(_0x12e7f6){return BPromise['reject'](_0x12e7f6);}return _0x578106[_0x69fd('0x22')]();};}function saveUpdates(_0x20a2c8,_0x37d7ab){return function(_0x639731){if(_0x639731){return _0x639731[_0x69fd('0x23')](_0x20a2c8)[_0x69fd('0x24')](function(_0x157ea8){return _0x157ea8;});}return null;};}function removeEntity(_0x28df2c,_0x375f74){return function(_0x41937e){if(_0x41937e){return _0x41937e[_0x69fd('0x25')]()[_0x69fd('0x24')](function(){_0x28df2c[_0x69fd('0x1b')](0xcc)[_0x69fd('0x26')]();});}};}function handleEntityNotFound(_0x1fb02b,_0x10f61b){return function(_0x291122){if(!_0x291122){_0x1fb02b[_0x69fd('0x1a')](0x194);}return _0x291122;};}function handleError(_0x281ea8,_0xa754b0){_0xa754b0=_0xa754b0||0x1f4;return function(_0x4aa9a0){logger[_0x69fd('0x27')](_0x4aa9a0[_0x69fd('0x28')]);if(_0x4aa9a0[_0x69fd('0x29')]){delete _0x4aa9a0[_0x69fd('0x29')];}_0x281ea8[_0x69fd('0x1b')](_0xa754b0)['send'](_0x4aa9a0);};}exports[_0x69fd('0x2a')]=function(_0x374498,_0x32b2ca){var _0x445eda={},_0x48d305={},_0x1a9f25={'count':0x0,'rows':[]};var _0x52111f=_[_0x69fd('0x2b')](db[_0x69fd('0x2c')][_0x69fd('0x2d')],function(_0x3c128e){return{'name':_0x3c128e[_0x69fd('0x2e')],'type':_0x3c128e[_0x69fd('0x2f')][_0x69fd('0x30')]};});_0x48d305['model']=_[_0x69fd('0x2b')](_0x52111f,_0x69fd('0x29'));_0x48d305['query']=_[_0x69fd('0x31')](_0x374498[_0x69fd('0x32')]);_0x48d305[_0x69fd('0x33')]=_[_0x69fd('0x34')](_0x48d305[_0x69fd('0x35')],_0x48d305[_0x69fd('0x32')]);_0x445eda['attributes']=_[_0x69fd('0x34')](_0x48d305[_0x69fd('0x35')],qs[_0x69fd('0x36')](_0x374498[_0x69fd('0x32')]['fields']));_0x445eda[_0x69fd('0x37')]=_0x445eda['attributes'][_0x69fd('0x38')]?_0x445eda[_0x69fd('0x37')]:_0x48d305[_0x69fd('0x35')];if(!_0x374498[_0x69fd('0x32')][_0x69fd('0x39')](_0x69fd('0x3a'))){_0x445eda['limit']=qs['limit'](_0x374498[_0x69fd('0x32')][_0x69fd('0x20')]);_0x445eda[_0x69fd('0x1d')]=qs['offset'](_0x374498[_0x69fd('0x32')][_0x69fd('0x1d')]);}_0x445eda[_0x69fd('0x3b')]=qs['sort'](_0x374498['query'][_0x69fd('0x3c')]);_0x445eda[_0x69fd('0x3d')]=qs[_0x69fd('0x33')](_[_0x69fd('0x3e')](_0x374498['query'],_0x48d305['filters']),_0x52111f);if(_0x374498['query'][_0x69fd('0x3f')]){_0x445eda[_0x69fd('0x3d')]=_['merge'](_0x445eda[_0x69fd('0x3d')],{'$or':_[_0x69fd('0x2b')](_0x52111f,function(_0x3e45ab){if(_0x3e45ab[_0x69fd('0x2f')]!==_0x69fd('0x40')){var _0x4f6edf={};_0x4f6edf[_0x3e45ab[_0x69fd('0x29')]]={'$like':'%'+_0x374498[_0x69fd('0x32')][_0x69fd('0x3f')]+'%'};return _0x4f6edf;}})});}_0x445eda=_[_0x69fd('0x41')]({},_0x445eda,_0x374498[_0x69fd('0x42')]);var _0x298361={'where':_0x445eda[_0x69fd('0x3d')]};return db['DeskConfiguration'][_0x69fd('0x1f')](_0x298361)[_0x69fd('0x24')](function(_0x141708){_0x1a9f25['count']=_0x141708;if(_0x374498[_0x69fd('0x32')][_0x69fd('0x43')]){_0x445eda[_0x69fd('0x44')]=[{'all':!![]}];}return db[_0x69fd('0x2c')][_0x69fd('0x45')](_0x445eda);})[_0x69fd('0x24')](function(_0x3f0e7a){_0x1a9f25[_0x69fd('0x46')]=_0x3f0e7a;return _0x1a9f25;})[_0x69fd('0x24')](respondWithFilteredResult(_0x32b2ca,_0x445eda))[_0x69fd('0x47')](handleError(_0x32b2ca,null));};exports['show']=function(_0x4affd5,_0x3712a9){var _0x5dd082={'raw':![],'where':{'id':_0x4affd5['params']['id']}},_0x165f5f={};_0x165f5f[_0x69fd('0x35')]=_[_0x69fd('0x31')](db[_0x69fd('0x2c')]['rawAttributes']);_0x165f5f['query']=_['keys'](_0x4affd5[_0x69fd('0x32')]);_0x165f5f[_0x69fd('0x33')]=_['intersection'](_0x165f5f[_0x69fd('0x35')],_0x165f5f['query']);_0x5dd082[_0x69fd('0x37')]=_[_0x69fd('0x34')](_0x165f5f[_0x69fd('0x35')],qs[_0x69fd('0x36')](_0x4affd5[_0x69fd('0x32')]['fields']));_0x5dd082[_0x69fd('0x37')]=_0x5dd082['attributes'][_0x69fd('0x38')]?_0x5dd082['attributes']:_0x165f5f[_0x69fd('0x35')];if(_0x4affd5[_0x69fd('0x32')][_0x69fd('0x43')]){_0x5dd082[_0x69fd('0x44')]=[{'all':!![]}];}_0x5dd082=_[_0x69fd('0x41')]({},_0x5dd082,_0x4affd5[_0x69fd('0x42')]);return db['DeskConfiguration']['find'](_0x5dd082)[_0x69fd('0x24')](handleEntityNotFound(_0x3712a9,null))[_0x69fd('0x24')](respondWithResult(_0x3712a9,null))[_0x69fd('0x47')](handleError(_0x3712a9,null));};exports[_0x69fd('0x48')]=function(_0x379b6a,_0x176223){return db[_0x69fd('0x2c')]['create'](_0x379b6a[_0x69fd('0x49')],{})[_0x69fd('0x24')](respondWithResult(_0x176223,0xc9))[_0x69fd('0x47')](handleError(_0x176223,null));};exports['update']=function(_0x29afc0,_0x5b9110){if(_0x29afc0[_0x69fd('0x49')]['id']){delete _0x29afc0[_0x69fd('0x49')]['id'];}return db[_0x69fd('0x2c')]['find']({'where':{'id':_0x29afc0[_0x69fd('0x4a')]['id']}})[_0x69fd('0x24')](handleEntityNotFound(_0x5b9110,null))[_0x69fd('0x24')](saveUpdates(_0x29afc0[_0x69fd('0x49')],null))[_0x69fd('0x24')](respondWithResult(_0x5b9110,null))[_0x69fd('0x47')](handleError(_0x5b9110,null));};exports['destroy']=function(_0x20f369,_0x5b6606){return db[_0x69fd('0x2c')]['find']({'where':{'id':_0x20f369['params']['id']}})[_0x69fd('0x24')](handleEntityNotFound(_0x5b6606,null))[_0x69fd('0x24')](removeEntity(_0x5b6606,null))[_0x69fd('0x47')](handleError(_0x5b6606,null));};exports[_0x69fd('0x4b')]=function(_0x32db54,_0xeb6740,_0x4654d8){var _0x595dc2={};var _0x46f5e4={};var _0x4526b2;var _0x2178fc;return db[_0x69fd('0x2c')][_0x69fd('0x4c')]({'where':{'id':_0x32db54['params']['id']}})[_0x69fd('0x24')](handleEntityNotFound(_0xeb6740,null))['then'](function(_0x507a83){if(_0x507a83){_0x4526b2=_0x507a83;_0x46f5e4[_0x69fd('0x35')]=_[_0x69fd('0x31')](db[_0x69fd('0x4d')][_0x69fd('0x2d')]);_0x46f5e4[_0x69fd('0x32')]=_['keys'](_0x32db54['query']);_0x46f5e4['filters']=_[_0x69fd('0x34')](_0x46f5e4[_0x69fd('0x35')],_0x46f5e4['query']);_0x595dc2['attributes']=_[_0x69fd('0x34')](_0x46f5e4[_0x69fd('0x35')],qs['fields'](_0x32db54['query'][_0x69fd('0x36')]));_0x595dc2[_0x69fd('0x37')]=_0x595dc2[_0x69fd('0x37')][_0x69fd('0x38')]?_0x595dc2[_0x69fd('0x37')]:_0x46f5e4['model'];_0x595dc2[_0x69fd('0x3b')]=qs['sort'](_0x32db54['query'][_0x69fd('0x3c')]);_0x595dc2['where']=qs[_0x69fd('0x33')](_[_0x69fd('0x3e')](_0x32db54[_0x69fd('0x32')],_0x46f5e4[_0x69fd('0x33')]));if(_0x32db54[_0x69fd('0x32')]['filter']){_0x595dc2[_0x69fd('0x3d')]=_[_0x69fd('0x41')](_0x595dc2[_0x69fd('0x3d')],{'$or':_[_0x69fd('0x2b')](_0x595dc2[_0x69fd('0x37')],function(_0x54187a){var _0x107f94={};_0x107f94[_0x54187a]={'$like':'%'+_0x32db54[_0x69fd('0x32')][_0x69fd('0x3f')]+'%'};return _0x107f94;})});}_0x595dc2=_[_0x69fd('0x41')]({},_0x595dc2,_0x32db54[_0x69fd('0x42')]);return _0x4526b2['getFields'](_0x595dc2);}})[_0x69fd('0x24')](function(_0x5c62a8){if(_0x5c62a8){_0x2178fc=_0x5c62a8[_0x69fd('0x38')];if(!_0x32db54[_0x69fd('0x32')]['hasOwnProperty'](_0x69fd('0x3a'))){_0x595dc2[_0x69fd('0x20')]=qs['limit'](_0x32db54[_0x69fd('0x32')][_0x69fd('0x20')]);_0x595dc2[_0x69fd('0x1d')]=qs['offset'](_0x32db54['query'][_0x69fd('0x1d')]);}return _0x4526b2[_0x69fd('0x4b')](_0x595dc2);}})[_0x69fd('0x24')](function(_0x5084a0){if(_0x5084a0){return _0x5084a0?{'count':_0x2178fc,'rows':_0x5084a0}:null;}})[_0x69fd('0x24')](respondWithResult(_0xeb6740,null))['catch'](handleError(_0xeb6740,null));};exports[_0x69fd('0x4e')]=function(_0x45b5e7,_0x1f0419,_0x2639ce){var _0x346337={};var _0x4c5e67={};var _0x46eb6d;var _0x500e62;return db[_0x69fd('0x2c')][_0x69fd('0x4c')]({'where':{'id':_0x45b5e7['params']['id']}})[_0x69fd('0x24')](handleEntityNotFound(_0x1f0419,null))[_0x69fd('0x24')](function(_0x303129){if(_0x303129){_0x46eb6d=_0x303129;_0x4c5e67[_0x69fd('0x35')]=_[_0x69fd('0x31')](db['DeskField'][_0x69fd('0x2d')]);_0x4c5e67[_0x69fd('0x32')]=_[_0x69fd('0x31')](_0x45b5e7[_0x69fd('0x32')]);_0x4c5e67[_0x69fd('0x33')]=_[_0x69fd('0x34')](_0x4c5e67[_0x69fd('0x35')],_0x4c5e67[_0x69fd('0x32')]);_0x346337[_0x69fd('0x37')]=_['intersection'](_0x4c5e67[_0x69fd('0x35')],qs['fields'](_0x45b5e7['query'][_0x69fd('0x36')]));_0x346337['attributes']=_0x346337[_0x69fd('0x37')][_0x69fd('0x38')]?_0x346337[_0x69fd('0x37')]:_0x4c5e67[_0x69fd('0x35')];_0x346337[_0x69fd('0x3b')]=qs[_0x69fd('0x3c')](_0x45b5e7[_0x69fd('0x32')]['sort']);_0x346337[_0x69fd('0x3d')]=qs[_0x69fd('0x33')](_['pick'](_0x45b5e7[_0x69fd('0x32')],_0x4c5e67[_0x69fd('0x33')]));if(_0x45b5e7[_0x69fd('0x32')][_0x69fd('0x3f')]){_0x346337[_0x69fd('0x3d')]=_[_0x69fd('0x41')](_0x346337[_0x69fd('0x3d')],{'$or':_[_0x69fd('0x2b')](_0x346337[_0x69fd('0x37')],function(_0x3a2832){var _0x2f706b={};_0x2f706b[_0x3a2832]={'$like':'%'+_0x45b5e7[_0x69fd('0x32')][_0x69fd('0x3f')]+'%'};return _0x2f706b;})});}_0x346337=_[_0x69fd('0x41')]({},_0x346337,_0x45b5e7[_0x69fd('0x42')]);return _0x46eb6d[_0x69fd('0x4e')](_0x346337);}})[_0x69fd('0x24')](function(_0x14d938){if(_0x14d938){_0x500e62=_0x14d938[_0x69fd('0x38')];if(!_0x45b5e7[_0x69fd('0x32')][_0x69fd('0x39')](_0x69fd('0x3a'))){_0x346337[_0x69fd('0x20')]=qs[_0x69fd('0x20')](_0x45b5e7[_0x69fd('0x32')]['limit']);_0x346337[_0x69fd('0x1d')]=qs[_0x69fd('0x1d')](_0x45b5e7[_0x69fd('0x32')][_0x69fd('0x1d')]);}return _0x46eb6d['getSubjects'](_0x346337);}})[_0x69fd('0x24')](function(_0x2511f4){if(_0x2511f4){return _0x2511f4?{'count':_0x500e62,'rows':_0x2511f4}:null;}})[_0x69fd('0x24')](respondWithResult(_0x1f0419,null))['catch'](handleError(_0x1f0419,null));};exports[_0x69fd('0x4f')]=function(_0x58a28d,_0x40912f,_0x2ebdd8){var _0x12a813={};var _0x43012b={};var _0xf4f77e;var _0x5c2d77;return db[_0x69fd('0x2c')]['findOne']({'where':{'id':_0x58a28d['params']['id']}})[_0x69fd('0x24')](handleEntityNotFound(_0x40912f,null))[_0x69fd('0x24')](function(_0x480a4e){if(_0x480a4e){_0xf4f77e=_0x480a4e;_0x43012b[_0x69fd('0x35')]=_['keys'](db['DeskField']['rawAttributes']);_0x43012b[_0x69fd('0x32')]=_[_0x69fd('0x31')](_0x58a28d[_0x69fd('0x32')]);_0x43012b[_0x69fd('0x33')]=_[_0x69fd('0x34')](_0x43012b[_0x69fd('0x35')],_0x43012b[_0x69fd('0x32')]);_0x12a813[_0x69fd('0x37')]=_[_0x69fd('0x34')](_0x43012b[_0x69fd('0x35')],qs[_0x69fd('0x36')](_0x58a28d[_0x69fd('0x32')][_0x69fd('0x36')]));_0x12a813[_0x69fd('0x37')]=_0x12a813[_0x69fd('0x37')][_0x69fd('0x38')]?_0x12a813[_0x69fd('0x37')]:_0x43012b[_0x69fd('0x35')];_0x12a813[_0x69fd('0x3b')]=qs[_0x69fd('0x3c')](_0x58a28d[_0x69fd('0x32')][_0x69fd('0x3c')]);_0x12a813[_0x69fd('0x3d')]=qs[_0x69fd('0x33')](_[_0x69fd('0x3e')](_0x58a28d[_0x69fd('0x32')],_0x43012b[_0x69fd('0x33')]));if(_0x58a28d[_0x69fd('0x32')][_0x69fd('0x3f')]){_0x12a813[_0x69fd('0x3d')]=_[_0x69fd('0x41')](_0x12a813[_0x69fd('0x3d')],{'$or':_[_0x69fd('0x2b')](_0x12a813[_0x69fd('0x37')],function(_0x349c5b){var _0x4baca3={};_0x4baca3[_0x349c5b]={'$like':'%'+_0x58a28d[_0x69fd('0x32')][_0x69fd('0x3f')]+'%'};return _0x4baca3;})});}_0x12a813=_['merge']({},_0x12a813,_0x58a28d[_0x69fd('0x42')]);return _0xf4f77e[_0x69fd('0x4f')](_0x12a813);}})['then'](function(_0x1aacf9){if(_0x1aacf9){_0x5c2d77=_0x1aacf9[_0x69fd('0x38')];if(!_0x58a28d[_0x69fd('0x32')][_0x69fd('0x39')](_0x69fd('0x3a'))){_0x12a813['limit']=qs[_0x69fd('0x20')](_0x58a28d['query'][_0x69fd('0x20')]);_0x12a813[_0x69fd('0x1d')]=qs['offset'](_0x58a28d['query'][_0x69fd('0x1d')]);}return _0xf4f77e[_0x69fd('0x4f')](_0x12a813);}})[_0x69fd('0x24')](function(_0xb01bdf){if(_0xb01bdf){return _0xb01bdf?{'count':_0x5c2d77,'rows':_0xb01bdf}:null;}})['then'](respondWithResult(_0x40912f,null))['catch'](handleError(_0x40912f,null));};exports[_0x69fd('0x50')]=function(_0x5ea50d,_0xee68db,_0x26f033){var _0x5e2bb8={};var _0x23cb94={};var _0x1f02ae;var _0x21be62;return db[_0x69fd('0x2c')][_0x69fd('0x4c')]({'where':{'id':_0x5ea50d[_0x69fd('0x4a')]['id']}})[_0x69fd('0x24')](handleEntityNotFound(_0xee68db,null))[_0x69fd('0x24')](function(_0x250fcd){if(_0x250fcd){_0x1f02ae=_0x250fcd;_0x23cb94[_0x69fd('0x35')]=_[_0x69fd('0x31')](db[_0x69fd('0x51')][_0x69fd('0x2d')]);_0x23cb94[_0x69fd('0x32')]=_[_0x69fd('0x31')](_0x5ea50d[_0x69fd('0x32')]);_0x23cb94['filters']=_[_0x69fd('0x34')](_0x23cb94[_0x69fd('0x35')],_0x23cb94[_0x69fd('0x32')]);_0x5e2bb8[_0x69fd('0x37')]=_[_0x69fd('0x34')](_0x23cb94[_0x69fd('0x35')],qs[_0x69fd('0x36')](_0x5ea50d[_0x69fd('0x32')][_0x69fd('0x36')]));_0x5e2bb8[_0x69fd('0x37')]=_0x5e2bb8[_0x69fd('0x37')][_0x69fd('0x38')]?_0x5e2bb8[_0x69fd('0x37')]:_0x23cb94[_0x69fd('0x35')];_0x5e2bb8[_0x69fd('0x3b')]=qs[_0x69fd('0x3c')](_0x5ea50d[_0x69fd('0x32')][_0x69fd('0x3c')]);_0x5e2bb8[_0x69fd('0x3d')]=qs['filters'](_[_0x69fd('0x3e')](_0x5ea50d['query'],_0x23cb94[_0x69fd('0x33')]));if(_0x5ea50d[_0x69fd('0x32')]['filter']){_0x5e2bb8[_0x69fd('0x3d')]=_['merge'](_0x5e2bb8[_0x69fd('0x3d')],{'$or':_['map'](_0x5e2bb8[_0x69fd('0x37')],function(_0x3bf803){var _0x257c59={};_0x257c59[_0x3bf803]={'$like':'%'+_0x5ea50d['query']['filter']+'%'};return _0x257c59;})});}_0x5e2bb8=_[_0x69fd('0x41')]({},_0x5e2bb8,_0x5ea50d[_0x69fd('0x42')]);return _0x1f02ae[_0x69fd('0x50')](_0x5e2bb8);}})[_0x69fd('0x24')](function(_0x3fb6ef){if(_0x3fb6ef){_0x21be62=_0x3fb6ef[_0x69fd('0x38')];if(!_0x5ea50d['query'][_0x69fd('0x39')](_0x69fd('0x3a'))){_0x5e2bb8[_0x69fd('0x20')]=qs[_0x69fd('0x20')](_0x5ea50d['query'][_0x69fd('0x20')]);_0x5e2bb8[_0x69fd('0x1d')]=qs[_0x69fd('0x1d')](_0x5ea50d[_0x69fd('0x32')][_0x69fd('0x1d')]);}return _0x1f02ae[_0x69fd('0x50')](_0x5e2bb8);}})[_0x69fd('0x24')](function(_0x1c72d3){if(_0x1c72d3){return _0x1c72d3?{'count':_0x21be62,'rows':_0x1c72d3}:null;}})[_0x69fd('0x24')](respondWithResult(_0xee68db,null))[_0x69fd('0x47')](handleError(_0xee68db,null));};exports[_0x69fd('0x52')]=function(_0xd7df2,_0x2bd436,_0x2103a9){if(_0xd7df2[_0x69fd('0x49')]['id']){delete _0xd7df2[_0x69fd('0x49')]['id'];}return db[_0x69fd('0x2c')][_0x69fd('0x4c')]({'where':{'id':_0xd7df2[_0x69fd('0x4a')]['id']}})[_0x69fd('0x24')](handleEntityNotFound(_0x2bd436,null))['then'](function(_0x29ee5d){if(_0x29ee5d){return _0x29ee5d['setTags'](_0xd7df2[_0x69fd('0x49')]['ids']||[]);}return null;})[_0x69fd('0x24')](respondWithResult(_0x2bd436,null))[_0x69fd('0x47')](handleError(_0x2bd436,null));}; \ No newline at end of file +var _0xcec5=['where','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','getFields','DeskField','length','nolimit','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','set','Content-Range','json','save','update','then','status','error','name','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','merge','options'];(function(_0x25c7fb,_0x2e4e86){var _0x214b77=function(_0x36b7c0){while(--_0x36b7c0){_0x25c7fb['push'](_0x25c7fb['shift']());}};_0x214b77(++_0x2e4e86);}(_0xcec5,0x1b0));var _0x5cec=function(_0x2cc0f5,_0x197b8d){_0x2cc0f5=_0x2cc0f5-0x0;var _0x2f9ee7=_0xcec5[_0x2cc0f5];return _0x2f9ee7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5cec('0x0'));var zipdir=require(_0x5cec('0x1'));var jsonpatch=require(_0x5cec('0x2'));var rp=require(_0x5cec('0x3'));var moment=require(_0x5cec('0x4'));var BPromise=require(_0x5cec('0x5'));var Mustache=require(_0x5cec('0x6'));var util=require('util');var path=require(_0x5cec('0x7'));var sox=require(_0x5cec('0x8'));var csv=require(_0x5cec('0x9'));var ejs=require(_0x5cec('0xa'));var fs=require('fs');var fs_extra=require(_0x5cec('0xb'));var _=require(_0x5cec('0xc'));var squel=require(_0x5cec('0xd'));var crypto=require(_0x5cec('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5cec('0xf'));var toCsv=require(_0x5cec('0x9'));var querystring=require(_0x5cec('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5cec('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5cec('0x12'));var hardwareService=require(_0x5cec('0x13'));var logger=require(_0x5cec('0x14'))(_0x5cec('0x15'));var utils=require(_0x5cec('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5cec('0x17'));var db=require(_0x5cec('0x18'))['db'];function respondWithStatusCode(_0x3cb687,_0x3f495e){_0x3f495e=_0x3f495e||0xcc;return function(_0x27eeae){if(_0x27eeae){return _0x3cb687[_0x5cec('0x19')](_0x3f495e);}return _0x3cb687['status'](_0x3f495e)[_0x5cec('0x1a')]();};}function respondWithResult(_0xcd6c9f,_0x61de8c){_0x61de8c=_0x61de8c||0xc8;return function(_0x4110e2){if(_0x4110e2){return _0xcd6c9f['status'](_0x61de8c)['json'](_0x4110e2);}};}function respondWithFilteredResult(_0x2b3210,_0x12eb16){return function(_0x5e8229){if(_0x5e8229){var _0x25c7f5=typeof _0x12eb16[_0x5cec('0x1b')]===_0x5cec('0x1c')&&typeof _0x12eb16[_0x5cec('0x1d')]==='undefined';var _0x51e8ad=_0x5e8229['count'];var _0x25c73d=_0x25c7f5?0x0:_0x12eb16['offset'];var _0xa2ec73=_0x25c7f5?_0x5e8229[_0x5cec('0x1e')]:_0x12eb16['offset']+_0x12eb16[_0x5cec('0x1d')];var _0x1b3cef;if(_0xa2ec73>=_0x51e8ad){_0xa2ec73=_0x51e8ad;_0x1b3cef=0xc8;}else{_0x1b3cef=0xce;}_0x2b3210['status'](_0x1b3cef);return _0x2b3210[_0x5cec('0x1f')](_0x5cec('0x20'),_0x25c73d+'-'+_0xa2ec73+'/'+_0x51e8ad)[_0x5cec('0x21')](_0x5e8229);}return null;};}function patchUpdates(_0x42eb8d){return function(_0x1c4ac8){try{jsonpatch['apply'](_0x1c4ac8,_0x42eb8d,!![]);}catch(_0x27f02c){return BPromise['reject'](_0x27f02c);}return _0x1c4ac8[_0x5cec('0x22')]();};}function saveUpdates(_0x4426ce,_0x26ffe3){return function(_0x4d011a){if(_0x4d011a){return _0x4d011a[_0x5cec('0x23')](_0x4426ce)['then'](function(_0xdb46dd){return _0xdb46dd;});}return null;};}function removeEntity(_0x37f03e,_0x1a0760){return function(_0x3836e8){if(_0x3836e8){return _0x3836e8['destroy']()[_0x5cec('0x24')](function(){_0x37f03e[_0x5cec('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55ef86,_0x4a6490){return function(_0x1ec09c){if(!_0x1ec09c){_0x55ef86[_0x5cec('0x19')](0x194);}return _0x1ec09c;};}function handleError(_0x576d56,_0x562284){_0x562284=_0x562284||0x1f4;return function(_0x5b8a24){logger[_0x5cec('0x26')](_0x5b8a24['stack']);if(_0x5b8a24[_0x5cec('0x27')]){delete _0x5b8a24[_0x5cec('0x27')];}_0x576d56[_0x5cec('0x25')](_0x562284)['send'](_0x5b8a24);};}exports['index']=function(_0x2b24d7,_0xe8598a){var _0x5ea3dc={},_0x3f03cc={},_0x511936={'count':0x0,'rows':[]};var _0x34e79e=_[_0x5cec('0x28')](db[_0x5cec('0x29')][_0x5cec('0x2a')],function(_0x3fe81c){return{'name':_0x3fe81c[_0x5cec('0x2b')],'type':_0x3fe81c[_0x5cec('0x2c')][_0x5cec('0x2d')]};});_0x3f03cc[_0x5cec('0x2e')]=_[_0x5cec('0x28')](_0x34e79e,'name');_0x3f03cc[_0x5cec('0x2f')]=_[_0x5cec('0x30')](_0x2b24d7['query']);_0x3f03cc[_0x5cec('0x31')]=_[_0x5cec('0x32')](_0x3f03cc[_0x5cec('0x2e')],_0x3f03cc[_0x5cec('0x2f')]);_0x5ea3dc[_0x5cec('0x33')]=_['intersection'](_0x3f03cc['model'],qs[_0x5cec('0x34')](_0x2b24d7[_0x5cec('0x2f')][_0x5cec('0x34')]));_0x5ea3dc[_0x5cec('0x33')]=_0x5ea3dc[_0x5cec('0x33')]['length']?_0x5ea3dc[_0x5cec('0x33')]:_0x3f03cc[_0x5cec('0x2e')];if(!_0x2b24d7[_0x5cec('0x2f')][_0x5cec('0x35')]('nolimit')){_0x5ea3dc[_0x5cec('0x1d')]=qs['limit'](_0x2b24d7[_0x5cec('0x2f')][_0x5cec('0x1d')]);_0x5ea3dc[_0x5cec('0x1b')]=qs[_0x5cec('0x1b')](_0x2b24d7[_0x5cec('0x2f')][_0x5cec('0x1b')]);}_0x5ea3dc[_0x5cec('0x36')]=qs[_0x5cec('0x37')](_0x2b24d7[_0x5cec('0x2f')][_0x5cec('0x37')]);_0x5ea3dc['where']=qs[_0x5cec('0x31')](_[_0x5cec('0x38')](_0x2b24d7['query'],_0x3f03cc[_0x5cec('0x31')]),_0x34e79e);if(_0x2b24d7[_0x5cec('0x2f')][_0x5cec('0x39')]){_0x5ea3dc['where']=_[_0x5cec('0x3a')](_0x5ea3dc['where'],{'$or':_[_0x5cec('0x28')](_0x34e79e,function(_0x5c0f4c){if(_0x5c0f4c[_0x5cec('0x2c')]!=='VIRTUAL'){var _0xc05781={};_0xc05781[_0x5c0f4c[_0x5cec('0x27')]]={'$like':'%'+_0x2b24d7[_0x5cec('0x2f')]['filter']+'%'};return _0xc05781;}})});}_0x5ea3dc=_['merge']({},_0x5ea3dc,_0x2b24d7[_0x5cec('0x3b')]);var _0x277fed={'where':_0x5ea3dc[_0x5cec('0x3c')]};return db[_0x5cec('0x29')]['count'](_0x277fed)[_0x5cec('0x24')](function(_0x2d691d){_0x511936[_0x5cec('0x1e')]=_0x2d691d;if(_0x2b24d7['query'][_0x5cec('0x3d')]){_0x5ea3dc[_0x5cec('0x3e')]=[{'all':!![]}];}return db[_0x5cec('0x29')][_0x5cec('0x3f')](_0x5ea3dc);})[_0x5cec('0x24')](function(_0x52c502){_0x511936[_0x5cec('0x40')]=_0x52c502;return _0x511936;})['then'](respondWithFilteredResult(_0xe8598a,_0x5ea3dc))[_0x5cec('0x41')](handleError(_0xe8598a,null));};exports['show']=function(_0x4d4638,_0x3dc3c4){var _0x25f0bf={'raw':![],'where':{'id':_0x4d4638[_0x5cec('0x42')]['id']}},_0x555656={};_0x555656[_0x5cec('0x2e')]=_[_0x5cec('0x30')](db[_0x5cec('0x29')][_0x5cec('0x2a')]);_0x555656[_0x5cec('0x2f')]=_[_0x5cec('0x30')](_0x4d4638[_0x5cec('0x2f')]);_0x555656[_0x5cec('0x31')]=_['intersection'](_0x555656[_0x5cec('0x2e')],_0x555656[_0x5cec('0x2f')]);_0x25f0bf[_0x5cec('0x33')]=_[_0x5cec('0x32')](_0x555656[_0x5cec('0x2e')],qs[_0x5cec('0x34')](_0x4d4638[_0x5cec('0x2f')][_0x5cec('0x34')]));_0x25f0bf[_0x5cec('0x33')]=_0x25f0bf[_0x5cec('0x33')]['length']?_0x25f0bf[_0x5cec('0x33')]:_0x555656[_0x5cec('0x2e')];if(_0x4d4638[_0x5cec('0x2f')][_0x5cec('0x3d')]){_0x25f0bf[_0x5cec('0x3e')]=[{'all':!![]}];}_0x25f0bf=_['merge']({},_0x25f0bf,_0x4d4638['options']);return db[_0x5cec('0x29')][_0x5cec('0x43')](_0x25f0bf)['then'](handleEntityNotFound(_0x3dc3c4,null))[_0x5cec('0x24')](respondWithResult(_0x3dc3c4,null))[_0x5cec('0x41')](handleError(_0x3dc3c4,null));};exports[_0x5cec('0x44')]=function(_0x214987,_0x3ad3d9){return db[_0x5cec('0x29')][_0x5cec('0x44')](_0x214987[_0x5cec('0x45')],{})[_0x5cec('0x24')](respondWithResult(_0x3ad3d9,0xc9))[_0x5cec('0x41')](handleError(_0x3ad3d9,null));};exports['update']=function(_0x4f70b6,_0x4e6b73){if(_0x4f70b6[_0x5cec('0x45')]['id']){delete _0x4f70b6[_0x5cec('0x45')]['id'];}return db[_0x5cec('0x29')][_0x5cec('0x43')]({'where':{'id':_0x4f70b6['params']['id']}})[_0x5cec('0x24')](handleEntityNotFound(_0x4e6b73,null))[_0x5cec('0x24')](saveUpdates(_0x4f70b6[_0x5cec('0x45')],null))[_0x5cec('0x24')](respondWithResult(_0x4e6b73,null))[_0x5cec('0x41')](handleError(_0x4e6b73,null));};exports[_0x5cec('0x46')]=function(_0x37059c,_0x2119ee){return db['DeskConfiguration'][_0x5cec('0x43')]({'where':{'id':_0x37059c[_0x5cec('0x42')]['id']}})[_0x5cec('0x24')](handleEntityNotFound(_0x2119ee,null))['then'](removeEntity(_0x2119ee,null))['catch'](handleError(_0x2119ee,null));};exports[_0x5cec('0x47')]=function(_0x3f2b27,_0x3d9fb1,_0x1858ea){var _0x31797e={};var _0x5507e0={};var _0x162976;var _0x47ca9b;return db[_0x5cec('0x29')]['findOne']({'where':{'id':_0x3f2b27[_0x5cec('0x42')]['id']}})[_0x5cec('0x24')](handleEntityNotFound(_0x3d9fb1,null))[_0x5cec('0x24')](function(_0x30219a){if(_0x30219a){_0x162976=_0x30219a;_0x5507e0['model']=_['keys'](db[_0x5cec('0x48')][_0x5cec('0x2a')]);_0x5507e0[_0x5cec('0x2f')]=_[_0x5cec('0x30')](_0x3f2b27[_0x5cec('0x2f')]);_0x5507e0[_0x5cec('0x31')]=_[_0x5cec('0x32')](_0x5507e0[_0x5cec('0x2e')],_0x5507e0[_0x5cec('0x2f')]);_0x31797e[_0x5cec('0x33')]=_[_0x5cec('0x32')](_0x5507e0[_0x5cec('0x2e')],qs[_0x5cec('0x34')](_0x3f2b27['query'][_0x5cec('0x34')]));_0x31797e[_0x5cec('0x33')]=_0x31797e['attributes'][_0x5cec('0x49')]?_0x31797e[_0x5cec('0x33')]:_0x5507e0[_0x5cec('0x2e')];_0x31797e[_0x5cec('0x36')]=qs[_0x5cec('0x37')](_0x3f2b27['query']['sort']);_0x31797e[_0x5cec('0x3c')]=qs[_0x5cec('0x31')](_[_0x5cec('0x38')](_0x3f2b27[_0x5cec('0x2f')],_0x5507e0[_0x5cec('0x31')]));if(_0x3f2b27[_0x5cec('0x2f')][_0x5cec('0x39')]){_0x31797e[_0x5cec('0x3c')]=_['merge'](_0x31797e[_0x5cec('0x3c')],{'$or':_[_0x5cec('0x28')](_0x31797e['attributes'],function(_0x101068){var _0x1ad5b2={};_0x1ad5b2[_0x101068]={'$like':'%'+_0x3f2b27[_0x5cec('0x2f')][_0x5cec('0x39')]+'%'};return _0x1ad5b2;})});}_0x31797e=_[_0x5cec('0x3a')]({},_0x31797e,_0x3f2b27[_0x5cec('0x3b')]);return _0x162976[_0x5cec('0x47')](_0x31797e);}})['then'](function(_0x30b203){if(_0x30b203){_0x47ca9b=_0x30b203[_0x5cec('0x49')];if(!_0x3f2b27['query'][_0x5cec('0x35')](_0x5cec('0x4a'))){_0x31797e['limit']=qs['limit'](_0x3f2b27[_0x5cec('0x2f')][_0x5cec('0x1d')]);_0x31797e[_0x5cec('0x1b')]=qs['offset'](_0x3f2b27[_0x5cec('0x2f')]['offset']);}return _0x162976[_0x5cec('0x47')](_0x31797e);}})['then'](function(_0x285a79){if(_0x285a79){return _0x285a79?{'count':_0x47ca9b,'rows':_0x285a79}:null;}})['then'](respondWithResult(_0x3d9fb1,null))[_0x5cec('0x41')](handleError(_0x3d9fb1,null));};exports[_0x5cec('0x4b')]=function(_0x5dced4,_0x113acf,_0x7da3c6){var _0x4bc204={};var _0x5e0d67={};var _0x4c2850;var _0xd76e2;return db[_0x5cec('0x29')][_0x5cec('0x4c')]({'where':{'id':_0x5dced4['params']['id']}})[_0x5cec('0x24')](handleEntityNotFound(_0x113acf,null))[_0x5cec('0x24')](function(_0x306677){if(_0x306677){_0x4c2850=_0x306677;_0x5e0d67[_0x5cec('0x2e')]=_[_0x5cec('0x30')](db[_0x5cec('0x48')][_0x5cec('0x2a')]);_0x5e0d67[_0x5cec('0x2f')]=_[_0x5cec('0x30')](_0x5dced4[_0x5cec('0x2f')]);_0x5e0d67[_0x5cec('0x31')]=_[_0x5cec('0x32')](_0x5e0d67[_0x5cec('0x2e')],_0x5e0d67[_0x5cec('0x2f')]);_0x4bc204[_0x5cec('0x33')]=_[_0x5cec('0x32')](_0x5e0d67['model'],qs['fields'](_0x5dced4[_0x5cec('0x2f')][_0x5cec('0x34')]));_0x4bc204[_0x5cec('0x33')]=_0x4bc204[_0x5cec('0x33')][_0x5cec('0x49')]?_0x4bc204[_0x5cec('0x33')]:_0x5e0d67[_0x5cec('0x2e')];_0x4bc204['order']=qs[_0x5cec('0x37')](_0x5dced4[_0x5cec('0x2f')][_0x5cec('0x37')]);_0x4bc204[_0x5cec('0x3c')]=qs[_0x5cec('0x31')](_[_0x5cec('0x38')](_0x5dced4['query'],_0x5e0d67['filters']));if(_0x5dced4[_0x5cec('0x2f')][_0x5cec('0x39')]){_0x4bc204[_0x5cec('0x3c')]=_['merge'](_0x4bc204[_0x5cec('0x3c')],{'$or':_[_0x5cec('0x28')](_0x4bc204[_0x5cec('0x33')],function(_0x272c55){var _0x2808a0={};_0x2808a0[_0x272c55]={'$like':'%'+_0x5dced4[_0x5cec('0x2f')]['filter']+'%'};return _0x2808a0;})});}_0x4bc204=_[_0x5cec('0x3a')]({},_0x4bc204,_0x5dced4[_0x5cec('0x3b')]);return _0x4c2850[_0x5cec('0x4b')](_0x4bc204);}})[_0x5cec('0x24')](function(_0x52e683){if(_0x52e683){_0xd76e2=_0x52e683[_0x5cec('0x49')];if(!_0x5dced4[_0x5cec('0x2f')][_0x5cec('0x35')]('nolimit')){_0x4bc204['limit']=qs[_0x5cec('0x1d')](_0x5dced4['query']['limit']);_0x4bc204[_0x5cec('0x1b')]=qs[_0x5cec('0x1b')](_0x5dced4['query'][_0x5cec('0x1b')]);}return _0x4c2850[_0x5cec('0x4b')](_0x4bc204);}})[_0x5cec('0x24')](function(_0x5cdda3){if(_0x5cdda3){return _0x5cdda3?{'count':_0xd76e2,'rows':_0x5cdda3}:null;}})[_0x5cec('0x24')](respondWithResult(_0x113acf,null))['catch'](handleError(_0x113acf,null));};exports[_0x5cec('0x4d')]=function(_0xda0fdb,_0x42c223,_0x474d8c){var _0x5ba986={};var _0x17a371={};var _0xecfc8f;var _0x548a6e;return db[_0x5cec('0x29')][_0x5cec('0x4c')]({'where':{'id':_0xda0fdb[_0x5cec('0x42')]['id']}})['then'](handleEntityNotFound(_0x42c223,null))['then'](function(_0x59c5f2){if(_0x59c5f2){_0xecfc8f=_0x59c5f2;_0x17a371[_0x5cec('0x2e')]=_[_0x5cec('0x30')](db['DeskField'][_0x5cec('0x2a')]);_0x17a371[_0x5cec('0x2f')]=_[_0x5cec('0x30')](_0xda0fdb[_0x5cec('0x2f')]);_0x17a371[_0x5cec('0x31')]=_[_0x5cec('0x32')](_0x17a371[_0x5cec('0x2e')],_0x17a371[_0x5cec('0x2f')]);_0x5ba986['attributes']=_[_0x5cec('0x32')](_0x17a371[_0x5cec('0x2e')],qs[_0x5cec('0x34')](_0xda0fdb[_0x5cec('0x2f')][_0x5cec('0x34')]));_0x5ba986['attributes']=_0x5ba986[_0x5cec('0x33')]['length']?_0x5ba986[_0x5cec('0x33')]:_0x17a371[_0x5cec('0x2e')];_0x5ba986[_0x5cec('0x36')]=qs[_0x5cec('0x37')](_0xda0fdb[_0x5cec('0x2f')][_0x5cec('0x37')]);_0x5ba986[_0x5cec('0x3c')]=qs[_0x5cec('0x31')](_[_0x5cec('0x38')](_0xda0fdb[_0x5cec('0x2f')],_0x17a371[_0x5cec('0x31')]));if(_0xda0fdb[_0x5cec('0x2f')][_0x5cec('0x39')]){_0x5ba986[_0x5cec('0x3c')]=_['merge'](_0x5ba986[_0x5cec('0x3c')],{'$or':_['map'](_0x5ba986['attributes'],function(_0xa9fa94){var _0x169e4c={};_0x169e4c[_0xa9fa94]={'$like':'%'+_0xda0fdb[_0x5cec('0x2f')][_0x5cec('0x39')]+'%'};return _0x169e4c;})});}_0x5ba986=_[_0x5cec('0x3a')]({},_0x5ba986,_0xda0fdb[_0x5cec('0x3b')]);return _0xecfc8f[_0x5cec('0x4d')](_0x5ba986);}})['then'](function(_0x4d793a){if(_0x4d793a){_0x548a6e=_0x4d793a[_0x5cec('0x49')];if(!_0xda0fdb['query'][_0x5cec('0x35')](_0x5cec('0x4a'))){_0x5ba986['limit']=qs['limit'](_0xda0fdb[_0x5cec('0x2f')][_0x5cec('0x1d')]);_0x5ba986[_0x5cec('0x1b')]=qs['offset'](_0xda0fdb['query'][_0x5cec('0x1b')]);}return _0xecfc8f[_0x5cec('0x4d')](_0x5ba986);}})[_0x5cec('0x24')](function(_0x139993){if(_0x139993){return _0x139993?{'count':_0x548a6e,'rows':_0x139993}:null;}})[_0x5cec('0x24')](respondWithResult(_0x42c223,null))[_0x5cec('0x41')](handleError(_0x42c223,null));};exports[_0x5cec('0x4e')]=function(_0x2e326a,_0x1c73bf,_0x43302e){var _0x322b85={};var _0x5e9929={};var _0x31b8ce;var _0x3bcbb5;return db['DeskConfiguration'][_0x5cec('0x4c')]({'where':{'id':_0x2e326a[_0x5cec('0x42')]['id']}})[_0x5cec('0x24')](handleEntityNotFound(_0x1c73bf,null))['then'](function(_0x5e2471){if(_0x5e2471){_0x31b8ce=_0x5e2471;_0x5e9929['model']=_['keys'](db[_0x5cec('0x4f')]['rawAttributes']);_0x5e9929[_0x5cec('0x2f')]=_[_0x5cec('0x30')](_0x2e326a[_0x5cec('0x2f')]);_0x5e9929['filters']=_[_0x5cec('0x32')](_0x5e9929[_0x5cec('0x2e')],_0x5e9929[_0x5cec('0x2f')]);_0x322b85[_0x5cec('0x33')]=_['intersection'](_0x5e9929[_0x5cec('0x2e')],qs[_0x5cec('0x34')](_0x2e326a[_0x5cec('0x2f')][_0x5cec('0x34')]));_0x322b85[_0x5cec('0x33')]=_0x322b85['attributes']['length']?_0x322b85[_0x5cec('0x33')]:_0x5e9929[_0x5cec('0x2e')];_0x322b85['order']=qs[_0x5cec('0x37')](_0x2e326a[_0x5cec('0x2f')][_0x5cec('0x37')]);_0x322b85[_0x5cec('0x3c')]=qs[_0x5cec('0x31')](_[_0x5cec('0x38')](_0x2e326a[_0x5cec('0x2f')],_0x5e9929[_0x5cec('0x31')]));if(_0x2e326a[_0x5cec('0x2f')][_0x5cec('0x39')]){_0x322b85[_0x5cec('0x3c')]=_[_0x5cec('0x3a')](_0x322b85[_0x5cec('0x3c')],{'$or':_[_0x5cec('0x28')](_0x322b85['attributes'],function(_0x88ac52){var _0x1eaa6c={};_0x1eaa6c[_0x88ac52]={'$like':'%'+_0x2e326a[_0x5cec('0x2f')][_0x5cec('0x39')]+'%'};return _0x1eaa6c;})});}_0x322b85=_[_0x5cec('0x3a')]({},_0x322b85,_0x2e326a[_0x5cec('0x3b')]);return _0x31b8ce['getTags'](_0x322b85);}})[_0x5cec('0x24')](function(_0x53e2cc){if(_0x53e2cc){_0x3bcbb5=_0x53e2cc['length'];if(!_0x2e326a['query'][_0x5cec('0x35')](_0x5cec('0x4a'))){_0x322b85[_0x5cec('0x1d')]=qs['limit'](_0x2e326a[_0x5cec('0x2f')][_0x5cec('0x1d')]);_0x322b85['offset']=qs[_0x5cec('0x1b')](_0x2e326a[_0x5cec('0x2f')]['offset']);}return _0x31b8ce['getTags'](_0x322b85);}})[_0x5cec('0x24')](function(_0x1b945d){if(_0x1b945d){return _0x1b945d?{'count':_0x3bcbb5,'rows':_0x1b945d}:null;}})[_0x5cec('0x24')](respondWithResult(_0x1c73bf,null))['catch'](handleError(_0x1c73bf,null));};exports[_0x5cec('0x50')]=function(_0x51bab4,_0x40fbdd,_0x2e51ae){if(_0x51bab4[_0x5cec('0x45')]['id']){delete _0x51bab4[_0x5cec('0x45')]['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x51bab4[_0x5cec('0x42')]['id']}})[_0x5cec('0x24')](handleEntityNotFound(_0x40fbdd,null))['then'](function(_0xe27cf1){if(_0xe27cf1){return _0xe27cf1[_0x5cec('0x50')](_0x51bab4[_0x5cec('0x45')][_0x5cec('0x51')]||[]);}return null;})[_0x5cec('0x24')](respondWithResult(_0x40fbdd,null))[_0x5cec('0x41')](handleError(_0x40fbdd,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 4155c03..625428d 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 _0x868d=['../../config/logger','api','bluebird','rimraf','../../config/environment','exports','define','DeskConfiguration','lodash'];(function(_0x32f26d,_0x2c0b5d){var _0x5d9ddc=function(_0x1f0e26){while(--_0x1f0e26){_0x32f26d['push'](_0x32f26d['shift']());}};_0x5d9ddc(++_0x2c0b5d);}(_0x868d,0x143));var _0xd868=function(_0x3699c7,_0x100180){_0x3699c7=_0x3699c7-0x0;var _0x34767c=_0x868d[_0x3699c7];return _0x34767c;};'use strict';var _=require(_0xd868('0x0'));var util=require('util');var logger=require(_0xd868('0x1'))(_0xd868('0x2'));var moment=require('moment');var BPromise=require(_0xd868('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd868('0x4'));var config=require(_0xd868('0x5'));var attributes=require('./intDeskConfiguration.attributes');module[_0xd868('0x6')]=function(_0x36e13e,_0x444c4e){return _0x36e13e[_0xd868('0x7')](_0xd868('0x8'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x752b=['api','moment','bluebird','path','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash'];(function(_0x246eeb,_0x149e6a){var _0x644aa=function(_0x57cd0a){while(--_0x57cd0a){_0x246eeb['push'](_0x246eeb['shift']());}};_0x644aa(++_0x149e6a);}(_0x752b,0x1e9));var _0xb752=function(_0x498e4e,_0x23f629){_0x498e4e=_0x498e4e-0x0;var _0x3502e9=_0x752b[_0x498e4e];return _0x3502e9;};'use strict';var _=require(_0xb752('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb752('0x1'));var moment=require(_0xb752('0x2'));var BPromise=require(_0xb752('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb752('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb752('0x5'));module[_0xb752('0x6')]=function(_0x2eb25c,_0x2fca68){return _0x2eb25c[_0xb752('0x7')](_0xb752('0x8'),attributes,{'tableName':_0xb752('0x9'),'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 c0e8fb7..b22cee5 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 _0x39d0=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x39d0,0x144));var _0x039d=function(_0x57a254,_0x4a6859){_0x57a254=_0x57a254-0x0;var _0x1f9beb=_0x39d0[_0x57a254];return _0x1f9beb;};'use strict';var _=require(_0x039d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x039d('0x1'));var rs=require(_0x039d('0x2'));var fs=require('fs');var Redis=require(_0x039d('0x3'));var db=require(_0x039d('0x4'))['db'];var utils=require(_0x039d('0x5'));var logger=require('../../config/logger')(_0x039d('0x6'));var config=require(_0x039d('0x7'));var jayson=require(_0x039d('0x8'));var client=jayson[_0x039d('0x9')][_0x039d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7dcc60,_0x2f8c4b,_0x4705e8){return new BPromise(function(_0x425f6e,_0x210090){return client[_0x039d('0xb')](_0x7dcc60,_0x4705e8)['then'](function(_0x591f97){logger[_0x039d('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x2f8c4b,_0x039d('0xd'));logger[_0x039d('0xe')](_0x039d('0xf'),_0x2f8c4b,_0x039d('0xd'),JSON['stringify'](_0x591f97));if(_0x591f97[_0x039d('0x10')]){if(_0x591f97[_0x039d('0x10')][_0x039d('0x11')]===0x1f4){logger['error'](_0x039d('0x12'),_0x2f8c4b,_0x591f97[_0x039d('0x10')][_0x039d('0x13')]);return _0x210090(_0x591f97[_0x039d('0x10')][_0x039d('0x13')]);}logger[_0x039d('0x10')](_0x039d('0x12'),_0x2f8c4b,_0x591f97['error']['message']);return _0x425f6e(_0x591f97[_0x039d('0x10')][_0x039d('0x13')]);}else{logger[_0x039d('0xc')](_0x039d('0x12'),_0x2f8c4b,_0x039d('0xd'));_0x425f6e(_0x591f97[_0x039d('0x14')]['message']);}})[_0x039d('0x15')](function(_0x226853){logger[_0x039d('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x2f8c4b,_0x226853);_0x210090(_0x226853);});});} \ No newline at end of file +var _0x6582=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6582,0x108));var _0x2658=function(_0x3407be,_0x3ad78b){_0x3407be=_0x3407be-0x0;var _0x1743e2=_0x6582[_0x3407be];return _0x1743e2;};'use strict';var _=require(_0x2658('0x0'));var util=require(_0x2658('0x1'));var moment=require(_0x2658('0x2'));var BPromise=require(_0x2658('0x3'));var rs=require(_0x2658('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2658('0x5'))['db'];var utils=require(_0x2658('0x6'));var logger=require(_0x2658('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2658('0x8')][_0x2658('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2cb94f,_0x3f53e7,_0x443df){return new BPromise(function(_0x412a9f,_0x52ef38){return client[_0x2658('0xa')](_0x2cb94f,_0x443df)[_0x2658('0xb')](function(_0x426744){logger[_0x2658('0xc')](_0x2658('0xd'),_0x3f53e7,_0x2658('0xe'));logger[_0x2658('0xf')](_0x2658('0x10'),_0x3f53e7,_0x2658('0xe'),JSON['stringify'](_0x426744));if(_0x426744[_0x2658('0x11')]){if(_0x426744['error'][_0x2658('0x12')]===0x1f4){logger[_0x2658('0x11')](_0x2658('0xd'),_0x3f53e7,_0x426744[_0x2658('0x11')][_0x2658('0x13')]);return _0x52ef38(_0x426744[_0x2658('0x11')][_0x2658('0x13')]);}logger['error'](_0x2658('0xd'),_0x3f53e7,_0x426744[_0x2658('0x11')][_0x2658('0x13')]);return _0x412a9f(_0x426744[_0x2658('0x11')][_0x2658('0x13')]);}else{logger['info'](_0x2658('0xd'),_0x3f53e7,_0x2658('0xe'));_0x412a9f(_0x426744[_0x2658('0x14')]['message']);}})[_0x2658('0x15')](function(_0x44c6d2){logger[_0x2658('0x11')](_0x2658('0xd'),_0x3f53e7,_0x44c6d2);_0x52ef38(_0x44c6d2);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 783352d..1c26b98 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 _0x9540=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create','delete','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x2b323e,_0x251bbb){var _0x47c8b5=function(_0x517ef6){while(--_0x517ef6){_0x2b323e['push'](_0x2b323e['shift']());}};_0x47c8b5(++_0x251bbb);}(_0x9540,0xdb));var _0x0954=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9540[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0954('0x0'));var util=require(_0x0954('0x1'));var path=require(_0x0954('0x2'));var timeout=require(_0x0954('0x3'));var express=require('express');var router=express[_0x0954('0x4')]();var fs_extra=require(_0x0954('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0954('0x6'));var config=require(_0x0954('0x7'));var controller=require('./intDeskField.controller');router[_0x0954('0x8')]('/',auth[_0x0954('0x9')](),controller['index']);router[_0x0954('0x8')](_0x0954('0xa'),auth[_0x0954('0x9')](),controller[_0x0954('0xb')]);router['post']('/',auth[_0x0954('0x9')](),controller[_0x0954('0xc')]);router['put'](_0x0954('0xa'),auth[_0x0954('0x9')](),controller['update']);router[_0x0954('0xd')](_0x0954('0xa'),auth[_0x0954('0x9')](),controller['destroy']);module[_0x0954('0xe')]=router; \ No newline at end of file +var _0x5862=['isAuthenticated','update','delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','post','create','put'];(function(_0x308c00,_0x3cbd67){var _0x2b21b2=function(_0x4ce3fc){while(--_0x4ce3fc){_0x308c00['push'](_0x308c00['shift']());}};_0x2b21b2(++_0x3cbd67);}(_0x5862,0x137));var _0x2586=function(_0x3d0678,_0x10e9ae){_0x3d0678=_0x3d0678-0x0;var _0x7f9a43=_0x5862[_0x3d0678];return _0x7f9a43;};'use strict';var multer=require(_0x2586('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2586('0x1'));var express=require(_0x2586('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2586('0x3'));var interaction=require(_0x2586('0x4'));var config=require(_0x2586('0x5'));var controller=require('./intDeskField.controller');router[_0x2586('0x6')]('/',auth['isAuthenticated'](),controller[_0x2586('0x7')]);router['get'](_0x2586('0x8'),auth['isAuthenticated'](),controller[_0x2586('0x9')]);router[_0x2586('0xa')]('/',auth['isAuthenticated'](),controller[_0x2586('0xb')]);router[_0x2586('0xc')](_0x2586('0x8'),auth[_0x2586('0xd')](),controller[_0x2586('0xe')]);router[_0x2586('0xf')](_0x2586('0x8'),auth[_0x2586('0xd')](),controller[_0x2586('0x10')]);module[_0x2586('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index cd3d1fc..92feca2 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 _0xace1=['ENUM','variable','BOOLEAN','sequelize','exports','string','keyValue','picklist','STRING'];(function(_0x4c8a47,_0x5a1059){var _0x3851c7=function(_0x40a3af){while(--_0x40a3af){_0x4c8a47['push'](_0x4c8a47['shift']());}};_0x3851c7(++_0x5a1059);}(_0xace1,0x1ce));var _0x1ace=function(_0x2c9857,_0x2e58bc){_0x2c9857=_0x2c9857-0x0;var _0x2c8917=_0xace1[_0x2c9857];return _0x2c8917;};'use strict';var Sequelize=require(_0x1ace('0x0'));module[_0x1ace('0x1')]={'type':{'type':Sequelize['ENUM'](_0x1ace('0x2'),'variable','customVariable',_0x1ace('0x3'),_0x1ace('0x4')),'defaultValue':_0x1ace('0x2')},'content':{'type':Sequelize[_0x1ace('0x5')]},'key':{'type':Sequelize[_0x1ace('0x5')]},'keyType':{'type':Sequelize[_0x1ace('0x6')](_0x1ace('0x2'),_0x1ace('0x7'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1ace('0x5')]},'nameField':{'type':Sequelize[_0x1ace('0x5')]},'customField':{'type':Sequelize[_0x1ace('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1ace('0x5')]}}; \ No newline at end of file +var _0xf292=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x470e67,_0x4a596d){var _0x28bbde=function(_0x1bbf56){while(--_0x1bbf56){_0x470e67['push'](_0x470e67['shift']());}};_0x28bbde(++_0x4a596d);}(_0xf292,0xcf));var _0x2f29=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xf292[_0x22b68a];return _0x1ac67a;};'use strict';var Sequelize=require(_0x2f29('0x0'));module[_0x2f29('0x1')]={'type':{'type':Sequelize[_0x2f29('0x2')](_0x2f29('0x3'),_0x2f29('0x4'),_0x2f29('0x5'),_0x2f29('0x6'),_0x2f29('0x7')),'defaultValue':_0x2f29('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2f29('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x2f29('0x3'),_0x2f29('0x4'),_0x2f29('0x5'))},'keyContent':{'type':Sequelize[_0x2f29('0x8')]},'idField':{'type':Sequelize[_0x2f29('0x8')]},'nameField':{'type':Sequelize[_0x2f29('0x8')]},'customField':{'type':Sequelize[_0x2f29('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2f29('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 2222dde..0f68261 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 _0xbd0a=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','status','error','stack','name','send','index','map','DeskField','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','find','create','body','eml-format','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils'];(function(_0x41b7c6,_0x37b7c2){var _0x3a0e6e=function(_0x52147f){while(--_0x52147f){_0x41b7c6['push'](_0x41b7c6['shift']());}};_0x3a0e6e(++_0x37b7c2);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x19af09,_0x142c04){_0x19af09=_0x19af09-0x0;var _0x3bd40f=_0xbd0a[_0x19af09];return _0x3bd40f;};'use strict';var emlformat=require(_0xabd0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xabd0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xabd0('0x2'));var Mustache=require(_0xabd0('0x3'));var util=require(_0xabd0('0x4'));var path=require(_0xabd0('0x5'));var sox=require(_0xabd0('0x6'));var csv=require(_0xabd0('0x7'));var ejs=require(_0xabd0('0x8'));var fs=require('fs');var fs_extra=require(_0xabd0('0x9'));var _=require(_0xabd0('0xa'));var squel=require('squel');var crypto=require(_0xabd0('0xb'));var jsforce=require(_0xabd0('0xc'));var deskjs=require(_0xabd0('0xd'));var toCsv=require('to-csv');var querystring=require(_0xabd0('0xe'));var Papa=require('papaparse');var Redis=require(_0xabd0('0xf'));var authService=require(_0xabd0('0x10'));var qs=require(_0xabd0('0x11'));var as=require(_0xabd0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xabd0('0x13'))('api');var utils=require(_0xabd0('0x14'));var config=require(_0xabd0('0x15'));var licenseUtil=require(_0xabd0('0x16'));var db=require(_0xabd0('0x17'))['db'];function respondWithStatusCode(_0x3bf33,_0xd66d68){_0xd66d68=_0xd66d68||0xcc;return function(_0x5b0f34){if(_0x5b0f34){return _0x3bf33[_0xabd0('0x18')](_0xd66d68);}return _0x3bf33['status'](_0xd66d68)[_0xabd0('0x19')]();};}function respondWithResult(_0x145f76,_0x5ceb94){_0x5ceb94=_0x5ceb94||0xc8;return function(_0x56ba31){if(_0x56ba31){return _0x145f76['status'](_0x5ceb94)['json'](_0x56ba31);}};}function respondWithFilteredResult(_0x679d0b,_0x26d8fd){return function(_0x97f4ec){if(_0x97f4ec){var _0xdb7a40=typeof _0x26d8fd[_0xabd0('0x1a')]===_0xabd0('0x1b')&&typeof _0x26d8fd[_0xabd0('0x1c')]===_0xabd0('0x1b');var _0x2d17b1=_0x97f4ec['count'];var _0x3a0ace=_0xdb7a40?0x0:_0x26d8fd['offset'];var _0x579dcd=_0xdb7a40?_0x97f4ec[_0xabd0('0x1d')]:_0x26d8fd[_0xabd0('0x1a')]+_0x26d8fd[_0xabd0('0x1c')];var _0x23f955;if(_0x579dcd>=_0x2d17b1){_0x579dcd=_0x2d17b1;_0x23f955=0xc8;}else{_0x23f955=0xce;}_0x679d0b['status'](_0x23f955);return _0x679d0b[_0xabd0('0x1e')](_0xabd0('0x1f'),_0x3a0ace+'-'+_0x579dcd+'/'+_0x2d17b1)['json'](_0x97f4ec);}return null;};}function patchUpdates(_0x56c2f5){return function(_0x1c955e){try{jsonpatch[_0xabd0('0x20')](_0x1c955e,_0x56c2f5,!![]);}catch(_0x4d9416){return BPromise[_0xabd0('0x21')](_0x4d9416);}return _0x1c955e[_0xabd0('0x22')]();};}function saveUpdates(_0xa1ebf,_0x1e077e){return function(_0x4c9f3a){if(_0x4c9f3a){return _0x4c9f3a[_0xabd0('0x23')](_0xa1ebf)[_0xabd0('0x24')](function(_0x3376bc){return _0x3376bc;});}return null;};}function removeEntity(_0x462420,_0x264167){return function(_0xf6dbad){if(_0xf6dbad){return _0xf6dbad[_0xabd0('0x25')]()[_0xabd0('0x24')](function(){_0x462420[_0xabd0('0x26')](0xcc)[_0xabd0('0x19')]();});}};}function handleEntityNotFound(_0x52c8be,_0x369dd0){return function(_0x2699c4){if(!_0x2699c4){_0x52c8be[_0xabd0('0x18')](0x194);}return _0x2699c4;};}function handleError(_0x3e0dd2,_0x31b869){_0x31b869=_0x31b869||0x1f4;return function(_0x399996){logger[_0xabd0('0x27')](_0x399996[_0xabd0('0x28')]);if(_0x399996[_0xabd0('0x29')]){delete _0x399996[_0xabd0('0x29')];}_0x3e0dd2[_0xabd0('0x26')](_0x31b869)[_0xabd0('0x2a')](_0x399996);};}exports[_0xabd0('0x2b')]=function(_0x3246de,_0x1fe955){var _0x15096f={},_0x5427a0={},_0x1c0d90={'count':0x0,'rows':[]};var _0x2d4c55=_[_0xabd0('0x2c')](db[_0xabd0('0x2d')]['rawAttributes'],function(_0x1ef94b){return{'name':_0x1ef94b[_0xabd0('0x2e')],'type':_0x1ef94b[_0xabd0('0x2f')]['key']};});_0x5427a0[_0xabd0('0x30')]=_[_0xabd0('0x2c')](_0x2d4c55,'name');_0x5427a0[_0xabd0('0x31')]=_['keys'](_0x3246de[_0xabd0('0x31')]);_0x5427a0[_0xabd0('0x32')]=_[_0xabd0('0x33')](_0x5427a0[_0xabd0('0x30')],_0x5427a0[_0xabd0('0x31')]);_0x15096f[_0xabd0('0x34')]=_['intersection'](_0x5427a0[_0xabd0('0x30')],qs[_0xabd0('0x35')](_0x3246de[_0xabd0('0x31')][_0xabd0('0x35')]));_0x15096f[_0xabd0('0x34')]=_0x15096f[_0xabd0('0x34')][_0xabd0('0x36')]?_0x15096f[_0xabd0('0x34')]:_0x5427a0[_0xabd0('0x30')];if(!_0x3246de[_0xabd0('0x31')][_0xabd0('0x37')](_0xabd0('0x38'))){_0x15096f[_0xabd0('0x1c')]=qs[_0xabd0('0x1c')](_0x3246de[_0xabd0('0x31')]['limit']);_0x15096f['offset']=qs['offset'](_0x3246de[_0xabd0('0x31')][_0xabd0('0x1a')]);}_0x15096f[_0xabd0('0x39')]=qs[_0xabd0('0x3a')](_0x3246de[_0xabd0('0x31')]['sort']);_0x15096f['where']=qs['filters'](_[_0xabd0('0x3b')](_0x3246de['query'],_0x5427a0[_0xabd0('0x32')]),_0x2d4c55);if(_0x3246de[_0xabd0('0x31')][_0xabd0('0x3c')]){_0x15096f[_0xabd0('0x3d')]=_[_0xabd0('0x3e')](_0x15096f[_0xabd0('0x3d')],{'$or':_[_0xabd0('0x2c')](_0x2d4c55,function(_0x42e86e){if(_0x42e86e['type']!==_0xabd0('0x3f')){var _0x592de0={};_0x592de0[_0x42e86e['name']]={'$like':'%'+_0x3246de[_0xabd0('0x31')][_0xabd0('0x3c')]+'%'};return _0x592de0;}})});}_0x15096f=_[_0xabd0('0x3e')]({},_0x15096f,_0x3246de[_0xabd0('0x40')]);var _0x1b8687={'where':_0x15096f['where']};return db[_0xabd0('0x2d')][_0xabd0('0x1d')](_0x1b8687)[_0xabd0('0x24')](function(_0x2e0bdf){_0x1c0d90['count']=_0x2e0bdf;if(_0x3246de[_0xabd0('0x31')][_0xabd0('0x41')]){_0x15096f[_0xabd0('0x42')]=[{'all':!![]}];}return db[_0xabd0('0x2d')][_0xabd0('0x43')](_0x15096f);})[_0xabd0('0x24')](function(_0x2aa5a9){_0x1c0d90[_0xabd0('0x44')]=_0x2aa5a9;return _0x1c0d90;})[_0xabd0('0x24')](respondWithFilteredResult(_0x1fe955,_0x15096f))[_0xabd0('0x45')](handleError(_0x1fe955,null));};exports[_0xabd0('0x46')]=function(_0x975bbe,_0x237a33){var _0x514ea3={'raw':!![],'where':{'id':_0x975bbe[_0xabd0('0x47')]['id']}},_0x2ba135={};_0x2ba135[_0xabd0('0x30')]=_['keys'](db['DeskField'][_0xabd0('0x48')]);_0x2ba135[_0xabd0('0x31')]=_[_0xabd0('0x49')](_0x975bbe[_0xabd0('0x31')]);_0x2ba135[_0xabd0('0x32')]=_['intersection'](_0x2ba135['model'],_0x2ba135[_0xabd0('0x31')]);_0x514ea3[_0xabd0('0x34')]=_[_0xabd0('0x33')](_0x2ba135[_0xabd0('0x30')],qs[_0xabd0('0x35')](_0x975bbe['query'][_0xabd0('0x35')]));_0x514ea3[_0xabd0('0x34')]=_0x514ea3[_0xabd0('0x34')]['length']?_0x514ea3[_0xabd0('0x34')]:_0x2ba135[_0xabd0('0x30')];if(_0x975bbe[_0xabd0('0x31')][_0xabd0('0x41')]){_0x514ea3['include']=[{'all':!![]}];}_0x514ea3=_[_0xabd0('0x3e')]({},_0x514ea3,_0x975bbe[_0xabd0('0x40')]);return db[_0xabd0('0x2d')][_0xabd0('0x4a')](_0x514ea3)['then'](handleEntityNotFound(_0x237a33,null))[_0xabd0('0x24')](respondWithResult(_0x237a33,null))[_0xabd0('0x45')](handleError(_0x237a33,null));};exports[_0xabd0('0x4b')]=function(_0xc80459,_0x2a1069){return db[_0xabd0('0x2d')]['create'](_0xc80459['body'],{})[_0xabd0('0x24')](respondWithResult(_0x2a1069,0xc9))['catch'](handleError(_0x2a1069,null));};exports['update']=function(_0x2293bd,_0x1610d9){if(_0x2293bd[_0xabd0('0x4c')]['id']){delete _0x2293bd[_0xabd0('0x4c')]['id'];}return db['DeskField'][_0xabd0('0x4a')]({'where':{'id':_0x2293bd[_0xabd0('0x47')]['id']}})[_0xabd0('0x24')](handleEntityNotFound(_0x1610d9,null))[_0xabd0('0x24')](saveUpdates(_0x2293bd['body'],null))['then'](respondWithResult(_0x1610d9,null))[_0xabd0('0x45')](handleError(_0x1610d9,null));};exports[_0xabd0('0x25')]=function(_0x16dd64,_0x32a5c9){return db[_0xabd0('0x2d')][_0xabd0('0x4a')]({'where':{'id':_0x16dd64[_0xabd0('0x47')]['id']}})[_0xabd0('0x24')](handleEntityNotFound(_0x32a5c9,null))[_0xabd0('0x24')](removeEntity(_0x32a5c9,null))['catch'](handleError(_0x32a5c9,null));}; \ No newline at end of file +var _0x5a5a=['hasOwnProperty','nolimit','order','pick','filter','merge','type','options','where','DeskField','includeAll','include','rows','show','keys','catch','create','body','update','find','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','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','end','json','offset','limit','undefined','count','Content-Range','apply','then','destroy','error','stack','send','index','map','rawAttributes','model','name','query','filters','attributes','intersection','fields','length'];(function(_0x39912a,_0xc27474){var _0x4c6ed1=function(_0x55832b){while(--_0x55832b){_0x39912a['push'](_0x39912a['shift']());}};_0x4c6ed1(++_0xc27474);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x207696,_0x1cf674){_0x207696=_0x207696-0x0;var _0x4060f3=_0x5a5a[_0x207696];return _0x4060f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa5a5('0x0'));var zipdir=require(_0xa5a5('0x1'));var jsonpatch=require(_0xa5a5('0x2'));var rp=require(_0xa5a5('0x3'));var moment=require(_0xa5a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa5a5('0x5'));var util=require(_0xa5a5('0x6'));var path=require(_0xa5a5('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa5a5('0x8'));var fs=require('fs');var fs_extra=require(_0xa5a5('0x9'));var _=require('lodash');var squel=require(_0xa5a5('0xa'));var crypto=require(_0xa5a5('0xb'));var jsforce=require(_0xa5a5('0xc'));var deskjs=require(_0xa5a5('0xd'));var toCsv=require(_0xa5a5('0xe'));var querystring=require('querystring');var Papa=require(_0xa5a5('0xf'));var Redis=require(_0xa5a5('0x10'));var authService=require(_0xa5a5('0x11'));var qs=require(_0xa5a5('0x12'));var as=require(_0xa5a5('0x13'));var hardwareService=require(_0xa5a5('0x14'));var logger=require(_0xa5a5('0x15'))(_0xa5a5('0x16'));var utils=require(_0xa5a5('0x17'));var config=require(_0xa5a5('0x18'));var licenseUtil=require(_0xa5a5('0x19'));var db=require(_0xa5a5('0x1a'))['db'];function respondWithStatusCode(_0x567d9b,_0x245a65){_0x245a65=_0x245a65||0xcc;return function(_0x420b1d){if(_0x420b1d){return _0x567d9b[_0xa5a5('0x1b')](_0x245a65);}return _0x567d9b[_0xa5a5('0x1c')](_0x245a65)[_0xa5a5('0x1d')]();};}function respondWithResult(_0xa81eeb,_0x5d71e4){_0x5d71e4=_0x5d71e4||0xc8;return function(_0x3382c6){if(_0x3382c6){return _0xa81eeb[_0xa5a5('0x1c')](_0x5d71e4)[_0xa5a5('0x1e')](_0x3382c6);}};}function respondWithFilteredResult(_0x15370d,_0x2daae6){return function(_0x38305a){if(_0x38305a){var _0x1464d9=typeof _0x2daae6[_0xa5a5('0x1f')]==='undefined'&&typeof _0x2daae6[_0xa5a5('0x20')]===_0xa5a5('0x21');var _0x4571f5=_0x38305a[_0xa5a5('0x22')];var _0x3c4cae=_0x1464d9?0x0:_0x2daae6[_0xa5a5('0x1f')];var _0x28c89f=_0x1464d9?_0x38305a['count']:_0x2daae6[_0xa5a5('0x1f')]+_0x2daae6[_0xa5a5('0x20')];var _0x21488a;if(_0x28c89f>=_0x4571f5){_0x28c89f=_0x4571f5;_0x21488a=0xc8;}else{_0x21488a=0xce;}_0x15370d[_0xa5a5('0x1c')](_0x21488a);return _0x15370d['set'](_0xa5a5('0x23'),_0x3c4cae+'-'+_0x28c89f+'/'+_0x4571f5)['json'](_0x38305a);}return null;};}function patchUpdates(_0x2554c0){return function(_0x22774d){try{jsonpatch[_0xa5a5('0x24')](_0x22774d,_0x2554c0,!![]);}catch(_0x379f0d){return BPromise['reject'](_0x379f0d);}return _0x22774d['save']();};}function saveUpdates(_0x2001ed,_0x1a258f){return function(_0x417df3){if(_0x417df3){return _0x417df3['update'](_0x2001ed)[_0xa5a5('0x25')](function(_0x4b4613){return _0x4b4613;});}return null;};}function removeEntity(_0x337e52,_0x4996b3){return function(_0x4c0ff2){if(_0x4c0ff2){return _0x4c0ff2[_0xa5a5('0x26')]()[_0xa5a5('0x25')](function(){_0x337e52[_0xa5a5('0x1c')](0xcc)[_0xa5a5('0x1d')]();});}};}function handleEntityNotFound(_0x55ed28,_0x3583b1){return function(_0x54dfdc){if(!_0x54dfdc){_0x55ed28[_0xa5a5('0x1b')](0x194);}return _0x54dfdc;};}function handleError(_0xd37524,_0x516ccf){_0x516ccf=_0x516ccf||0x1f4;return function(_0x5ccc1e){logger[_0xa5a5('0x27')](_0x5ccc1e[_0xa5a5('0x28')]);if(_0x5ccc1e['name']){delete _0x5ccc1e['name'];}_0xd37524[_0xa5a5('0x1c')](_0x516ccf)[_0xa5a5('0x29')](_0x5ccc1e);};}exports[_0xa5a5('0x2a')]=function(_0x4d1201,_0x16fdd4){var _0x3bdd0a={},_0x58dc9e={},_0x122e3f={'count':0x0,'rows':[]};var _0x4d1eef=_[_0xa5a5('0x2b')](db['DeskField'][_0xa5a5('0x2c')],function(_0x190a33){return{'name':_0x190a33['fieldName'],'type':_0x190a33['type']['key']};});_0x58dc9e[_0xa5a5('0x2d')]=_['map'](_0x4d1eef,_0xa5a5('0x2e'));_0x58dc9e[_0xa5a5('0x2f')]=_['keys'](_0x4d1201[_0xa5a5('0x2f')]);_0x58dc9e[_0xa5a5('0x30')]=_['intersection'](_0x58dc9e[_0xa5a5('0x2d')],_0x58dc9e[_0xa5a5('0x2f')]);_0x3bdd0a[_0xa5a5('0x31')]=_[_0xa5a5('0x32')](_0x58dc9e[_0xa5a5('0x2d')],qs[_0xa5a5('0x33')](_0x4d1201[_0xa5a5('0x2f')]['fields']));_0x3bdd0a[_0xa5a5('0x31')]=_0x3bdd0a[_0xa5a5('0x31')][_0xa5a5('0x34')]?_0x3bdd0a[_0xa5a5('0x31')]:_0x58dc9e[_0xa5a5('0x2d')];if(!_0x4d1201[_0xa5a5('0x2f')][_0xa5a5('0x35')](_0xa5a5('0x36'))){_0x3bdd0a[_0xa5a5('0x20')]=qs[_0xa5a5('0x20')](_0x4d1201[_0xa5a5('0x2f')][_0xa5a5('0x20')]);_0x3bdd0a[_0xa5a5('0x1f')]=qs[_0xa5a5('0x1f')](_0x4d1201[_0xa5a5('0x2f')][_0xa5a5('0x1f')]);}_0x3bdd0a[_0xa5a5('0x37')]=qs['sort'](_0x4d1201[_0xa5a5('0x2f')]['sort']);_0x3bdd0a['where']=qs['filters'](_[_0xa5a5('0x38')](_0x4d1201['query'],_0x58dc9e[_0xa5a5('0x30')]),_0x4d1eef);if(_0x4d1201[_0xa5a5('0x2f')][_0xa5a5('0x39')]){_0x3bdd0a['where']=_[_0xa5a5('0x3a')](_0x3bdd0a['where'],{'$or':_['map'](_0x4d1eef,function(_0x43c2ff){if(_0x43c2ff[_0xa5a5('0x3b')]!=='VIRTUAL'){var _0x421255={};_0x421255[_0x43c2ff['name']]={'$like':'%'+_0x4d1201['query'][_0xa5a5('0x39')]+'%'};return _0x421255;}})});}_0x3bdd0a=_['merge']({},_0x3bdd0a,_0x4d1201[_0xa5a5('0x3c')]);var _0x53fe36={'where':_0x3bdd0a[_0xa5a5('0x3d')]};return db[_0xa5a5('0x3e')][_0xa5a5('0x22')](_0x53fe36)[_0xa5a5('0x25')](function(_0x71fb38){_0x122e3f[_0xa5a5('0x22')]=_0x71fb38;if(_0x4d1201[_0xa5a5('0x2f')][_0xa5a5('0x3f')]){_0x3bdd0a[_0xa5a5('0x40')]=[{'all':!![]}];}return db[_0xa5a5('0x3e')]['findAll'](_0x3bdd0a);})[_0xa5a5('0x25')](function(_0x491532){_0x122e3f[_0xa5a5('0x41')]=_0x491532;return _0x122e3f;})[_0xa5a5('0x25')](respondWithFilteredResult(_0x16fdd4,_0x3bdd0a))['catch'](handleError(_0x16fdd4,null));};exports[_0xa5a5('0x42')]=function(_0x2717b3,_0x2373f4){var _0x3a2e7e={'raw':!![],'where':{'id':_0x2717b3['params']['id']}},_0x4780b9={};_0x4780b9[_0xa5a5('0x2d')]=_[_0xa5a5('0x43')](db['DeskField'][_0xa5a5('0x2c')]);_0x4780b9[_0xa5a5('0x2f')]=_[_0xa5a5('0x43')](_0x2717b3[_0xa5a5('0x2f')]);_0x4780b9[_0xa5a5('0x30')]=_[_0xa5a5('0x32')](_0x4780b9[_0xa5a5('0x2d')],_0x4780b9['query']);_0x3a2e7e[_0xa5a5('0x31')]=_['intersection'](_0x4780b9[_0xa5a5('0x2d')],qs['fields'](_0x2717b3['query'][_0xa5a5('0x33')]));_0x3a2e7e[_0xa5a5('0x31')]=_0x3a2e7e[_0xa5a5('0x31')]['length']?_0x3a2e7e[_0xa5a5('0x31')]:_0x4780b9['model'];if(_0x2717b3['query'][_0xa5a5('0x3f')]){_0x3a2e7e[_0xa5a5('0x40')]=[{'all':!![]}];}_0x3a2e7e=_[_0xa5a5('0x3a')]({},_0x3a2e7e,_0x2717b3['options']);return db[_0xa5a5('0x3e')]['find'](_0x3a2e7e)['then'](handleEntityNotFound(_0x2373f4,null))[_0xa5a5('0x25')](respondWithResult(_0x2373f4,null))[_0xa5a5('0x44')](handleError(_0x2373f4,null));};exports[_0xa5a5('0x45')]=function(_0x25091f,_0x268cfb){return db[_0xa5a5('0x3e')][_0xa5a5('0x45')](_0x25091f[_0xa5a5('0x46')],{})['then'](respondWithResult(_0x268cfb,0xc9))[_0xa5a5('0x44')](handleError(_0x268cfb,null));};exports[_0xa5a5('0x47')]=function(_0x2db032,_0x232bc5){if(_0x2db032[_0xa5a5('0x46')]['id']){delete _0x2db032[_0xa5a5('0x46')]['id'];}return db['DeskField'][_0xa5a5('0x48')]({'where':{'id':_0x2db032[_0xa5a5('0x49')]['id']}})['then'](handleEntityNotFound(_0x232bc5,null))[_0xa5a5('0x25')](saveUpdates(_0x2db032[_0xa5a5('0x46')],null))[_0xa5a5('0x25')](respondWithResult(_0x232bc5,null))['catch'](handleError(_0x232bc5,null));};exports[_0xa5a5('0x26')]=function(_0x337949,_0x6ad8c9){return db[_0xa5a5('0x3e')]['find']({'where':{'id':_0x337949['params']['id']}})[_0xa5a5('0x25')](handleEntityNotFound(_0x6ad8c9,null))[_0xa5a5('0x25')](removeEntity(_0x6ad8c9,null))[_0xa5a5('0x44')](handleError(_0x6ad8c9,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 0a8c67b..3a61b6f 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 _0xbfe7=['moment','bluebird','rimraf','../../config/environment','./intDeskField.attributes','exports','DeskField','int_desk_fields','FieldId','lodash','../../config/logger','api'];(function(_0x2f3427,_0x5f1913){var _0x2afe23=function(_0xdf515c){while(--_0xdf515c){_0x2f3427['push'](_0x2f3427['shift']());}};_0x2afe23(++_0x5f1913);}(_0xbfe7,0x81));var _0x7bfe=function(_0x3f897e,_0x19089d){_0x3f897e=_0x3f897e-0x0;var _0x225de0=_0xbfe7[_0x3f897e];return _0x225de0;};'use strict';var _=require(_0x7bfe('0x0'));var util=require('util');var logger=require(_0x7bfe('0x1'))(_0x7bfe('0x2'));var moment=require(_0x7bfe('0x3'));var BPromise=require(_0x7bfe('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7bfe('0x5'));var config=require(_0x7bfe('0x6'));var attributes=require(_0x7bfe('0x7'));module[_0x7bfe('0x8')]=function(_0x103478,_0x19a762){return _0x103478['define'](_0x7bfe('0x9'),attributes,{'tableName':_0x7bfe('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField',_0x7bfe('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x28e7=['lodash','path','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField'];(function(_0x1ed941,_0x5dc32f){var _0x5c3ed3=function(_0x1e9f31){while(--_0x1e9f31){_0x1ed941['push'](_0x1ed941['shift']());}};_0x5c3ed3(++_0x5dc32f);}(_0x28e7,0x19a));var _0x728e=function(_0x28a5a8,_0x356925){_0x28a5a8=_0x28a5a8-0x0;var _0x447df3=_0x28e7[_0x28a5a8];return _0x447df3;};'use strict';var _=require(_0x728e('0x0'));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(_0x728e('0x1'));var rimraf=require('rimraf');var config=require(_0x728e('0x2'));var attributes=require(_0x728e('0x3'));module[_0x728e('0x4')]=function(_0x730517,_0x48c47b){return _0x730517[_0x728e('0x5')](_0x728e('0x6'),attributes,{'tableName':_0x728e('0x7'),'paranoid':![],'indexes':[{'name':_0x728e('0x8'),'fields':[_0x728e('0x9'),'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 f5f37da..3609c0c 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 _0xbaa2=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','bluebird','ioredis'];(function(_0x3256af,_0x36612d){var _0x2201fa=function(_0x401de4){while(--_0x401de4){_0x3256af['push'](_0x3256af['shift']());}};_0x2201fa(++_0x36612d);}(_0xbaa2,0x163));var _0x2baa=function(_0x49a630,_0x491d98){_0x49a630=_0x49a630-0x0;var _0x50cb82=_0xbaa2[_0x49a630];return _0x50cb82;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2baa('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2baa('0x1'));var db=require(_0x2baa('0x2'))['db'];var utils=require(_0x2baa('0x3'));var logger=require(_0x2baa('0x4'))('rpc');var config=require(_0x2baa('0x5'));var jayson=require(_0x2baa('0x6'));var client=jayson[_0x2baa('0x7')][_0x2baa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20f609,_0x407f57,_0x45303c){return new BPromise(function(_0x1aa5ec,_0x3fcba9){return client[_0x2baa('0x9')](_0x20f609,_0x45303c)[_0x2baa('0xa')](function(_0x568d76){logger[_0x2baa('0xb')](_0x2baa('0xc'),_0x407f57,_0x2baa('0xd'));logger[_0x2baa('0xe')](_0x2baa('0xf'),_0x407f57,_0x2baa('0xd'),JSON[_0x2baa('0x10')](_0x568d76));if(_0x568d76[_0x2baa('0x11')]){if(_0x568d76[_0x2baa('0x11')][_0x2baa('0x12')]===0x1f4){logger[_0x2baa('0x11')]('DeskField,\x20%s,\x20%s',_0x407f57,_0x568d76[_0x2baa('0x11')][_0x2baa('0x13')]);return _0x3fcba9(_0x568d76[_0x2baa('0x11')][_0x2baa('0x13')]);}logger[_0x2baa('0x11')]('DeskField,\x20%s,\x20%s',_0x407f57,_0x568d76[_0x2baa('0x11')][_0x2baa('0x13')]);return _0x1aa5ec(_0x568d76[_0x2baa('0x11')][_0x2baa('0x13')]);}else{logger[_0x2baa('0xb')](_0x2baa('0xc'),_0x407f57,_0x2baa('0xd'));_0x1aa5ec(_0x568d76['result']['message']);}})[_0x2baa('0x14')](function(_0x24d277){logger[_0x2baa('0x11')](_0x2baa('0xc'),_0x407f57,_0x24d277);_0x3fcba9(_0x24d277);});});} \ No newline at end of file +var _0x9bd3=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x2dabad,_0x2e4c8e){var _0x31a0b6=function(_0x172a03){while(--_0x172a03){_0x2dabad['push'](_0x2dabad['shift']());}};_0x31a0b6(++_0x2e4c8e);}(_0x9bd3,0x13b));var _0x39bd=function(_0x5d818e,_0x5ea0fa){_0x5d818e=_0x5d818e-0x0;var _0x4fcc4f=_0x9bd3[_0x5d818e];return _0x4fcc4f;};'use strict';var _=require(_0x39bd('0x0'));var util=require(_0x39bd('0x1'));var moment=require(_0x39bd('0x2'));var BPromise=require('bluebird');var rs=require(_0x39bd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x39bd('0x4'))['db'];var utils=require(_0x39bd('0x5'));var logger=require(_0x39bd('0x6'))(_0x39bd('0x7'));var config=require('../../config/environment');var jayson=require(_0x39bd('0x8'));var client=jayson[_0x39bd('0x9')][_0x39bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fdaa8,_0x310377,_0x580542){return new BPromise(function(_0xd4875,_0x239aac){return client['request'](_0x4fdaa8,_0x580542)['then'](function(_0x239b7b){logger[_0x39bd('0xb')](_0x39bd('0xc'),_0x310377,_0x39bd('0xd'));logger[_0x39bd('0xe')](_0x39bd('0xf'),_0x310377,_0x39bd('0xd'),JSON[_0x39bd('0x10')](_0x239b7b));if(_0x239b7b['error']){if(_0x239b7b[_0x39bd('0x11')][_0x39bd('0x12')]===0x1f4){logger[_0x39bd('0x11')](_0x39bd('0xc'),_0x310377,_0x239b7b[_0x39bd('0x11')][_0x39bd('0x13')]);return _0x239aac(_0x239b7b[_0x39bd('0x11')][_0x39bd('0x13')]);}logger[_0x39bd('0x11')]('DeskField,\x20%s,\x20%s',_0x310377,_0x239b7b[_0x39bd('0x11')][_0x39bd('0x13')]);return _0xd4875(_0x239b7b[_0x39bd('0x11')][_0x39bd('0x13')]);}else{logger[_0x39bd('0xb')](_0x39bd('0xc'),_0x310377,_0x39bd('0xd'));_0xd4875(_0x239b7b['result']['message']);}})['catch'](function(_0xc28f8b){logger['error'](_0x39bd('0xc'),_0x310377,_0xc28f8b);_0x239aac(_0xc28f8b);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index dd86eb2..86bfd3f 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 _0x9ba2=['index','isAuthenticated','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get'];(function(_0x1cbcc9,_0x6744b2){var _0x1aa56a=function(_0x28619f){while(--_0x28619f){_0x1cbcc9['push'](_0x1cbcc9['shift']());}};_0x1aa56a(++_0x6744b2);}(_0x9ba2,0x6a));var _0x29ba=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9ba2[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x29ba('0x0'));var util=require('util');var path=require(_0x29ba('0x1'));var timeout=require('connect-timeout');var express=require(_0x29ba('0x2'));var router=express[_0x29ba('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x29ba('0x4'));var interaction=require(_0x29ba('0x5'));var config=require(_0x29ba('0x6'));var controller=require(_0x29ba('0x7'));router[_0x29ba('0x8')]('/',auth['isAuthenticated'](),controller[_0x29ba('0x9')]);router[_0x29ba('0x8')]('/:id',auth[_0x29ba('0xa')](),controller[_0x29ba('0xb')]);router['get'](_0x29ba('0xc'),auth[_0x29ba('0xa')](),controller['getConfigurations']);router[_0x29ba('0x8')](_0x29ba('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x29ba('0xe')]('/',auth['isAuthenticated'](),controller[_0x29ba('0xf')]);router[_0x29ba('0xe')](_0x29ba('0xc'),auth[_0x29ba('0xa')](),controller[_0x29ba('0x10')]);router[_0x29ba('0x11')](_0x29ba('0x12'),auth[_0x29ba('0xa')](),controller[_0x29ba('0x13')]);router[_0x29ba('0x14')](_0x29ba('0x12'),auth[_0x29ba('0xa')](),controller[_0x29ba('0x15')]);module[_0x29ba('0x16')]=router; \ No newline at end of file +var _0x5bd0=['util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','exports'];(function(_0x48b2f8,_0x5443d9){var _0x44e432=function(_0x5cb2d5){while(--_0x5cb2d5){_0x48b2f8['push'](_0x48b2f8['shift']());}};_0x44e432(++_0x5443d9);}(_0x5bd0,0x143));var _0x05bd=function(_0x34df4a,_0x209d10){_0x34df4a=_0x34df4a-0x0;var _0x145c69=_0x5bd0[_0x34df4a];return _0x145c69;};'use strict';var multer=require('multer');var util=require(_0x05bd('0x0'));var path=require('path');var timeout=require(_0x05bd('0x1'));var express=require(_0x05bd('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x05bd('0x3'));var interaction=require(_0x05bd('0x4'));var config=require(_0x05bd('0x5'));var controller=require('./intDynamics365Account.controller');router[_0x05bd('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x05bd('0x6')](_0x05bd('0x7'),auth[_0x05bd('0x8')](),controller[_0x05bd('0x9')]);router['get'](_0x05bd('0xa'),auth['isAuthenticated'](),controller[_0x05bd('0xb')]);router[_0x05bd('0x6')](_0x05bd('0xc'),auth[_0x05bd('0x8')](),controller[_0x05bd('0xd')]);router[_0x05bd('0xe')]('/',auth[_0x05bd('0x8')](),controller[_0x05bd('0xf')]);router[_0x05bd('0xe')](_0x05bd('0xa'),auth[_0x05bd('0x8')](),controller[_0x05bd('0x10')]);router[_0x05bd('0x11')](_0x05bd('0x7'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x05bd('0x7'),auth[_0x05bd('0x8')](),controller['destroy']);module[_0x05bd('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 ca84e31..1971fe2 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 _0xcf89=['sequelize','STRING'];(function(_0x242dce,_0x29f4d7){var _0x371c05=function(_0x5bf571){while(--_0x5bf571){_0x242dce['push'](_0x242dce['shift']());}};_0x371c05(++_0x29f4d7);}(_0xcf89,0x116));var _0x9cf8=function(_0x27113f,_0x38e988){_0x27113f=_0x27113f-0x0;var _0x361ec9=_0xcf89[_0x27113f];return _0x361ec9;};'use strict';var Sequelize=require(_0x9cf8('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9cf8('0x1')]},'password':{'type':Sequelize[_0x9cf8('0x1')]},'remoteUri':{'type':Sequelize[_0x9cf8('0x1')]},'tenantId':{'type':Sequelize[_0x9cf8('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x9cf8('0x1')]},'serverUrl':{'type':Sequelize[_0x9cf8('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf1b6=['STRING','exports'];(function(_0x2a1f85,_0x159955){var _0x3a2657=function(_0x3069d5){while(--_0x3069d5){_0x2a1f85['push'](_0x2a1f85['shift']());}};_0x3a2657(++_0x159955);}(_0xf1b6,0xd3));var _0x6f1b=function(_0x47b39d,_0x5cdd80){_0x47b39d=_0x47b39d-0x0;var _0x18af43=_0xf1b6[_0x47b39d];return _0x18af43;};'use strict';var Sequelize=require('sequelize');module[_0x6f1b('0x0')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6f1b('0x1')]},'password':{'type':Sequelize[_0x6f1b('0x1')]},'remoteUri':{'type':Sequelize[_0x6f1b('0x1')]},'tenantId':{'type':Sequelize[_0x6f1b('0x1')]},'clientId':{'type':Sequelize[_0x6f1b('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x6f1b('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6f1b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 02790e3..f678f6b 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 _0x95d9=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','Dynamics365Configuration','filter','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','ticketType','incident','PhoneCall','title','description','customerid','ownerid','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','actualserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyyominame','createdbyname','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responseby','slaname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','concat','username','password','tenantId','clientSecret','remoteUri','slice','substring','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','clientId','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','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','stack','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','end','error','name','send','map','Dynamics365Account','rawAttributes','type','model'];(function(_0x3cc10b,_0x5069fc){var _0xf8daa0=function(_0x16d1da){while(--_0x16d1da){_0x3cc10b['push'](_0x3cc10b['shift']());}};_0xf8daa0(++_0x5069fc);}(_0x95d9,0x97));var _0x995d=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x95d9[_0x55abd9];return _0x3e5669;};'use strict';var emlformat=require(_0x995d('0x0'));var rimraf=require(_0x995d('0x1'));var zipdir=require(_0x995d('0x2'));var jsonpatch=require(_0x995d('0x3'));var rp=require('request-promise');var moment=require(_0x995d('0x4'));var BPromise=require(_0x995d('0x5'));var Mustache=require(_0x995d('0x6'));var util=require('util');var path=require(_0x995d('0x7'));var sox=require(_0x995d('0x8'));var csv=require(_0x995d('0x9'));var ejs=require(_0x995d('0xa'));var fs=require('fs');var fs_extra=require(_0x995d('0xb'));var _=require('lodash');var squel=require(_0x995d('0xc'));var crypto=require(_0x995d('0xd'));var jsforce=require(_0x995d('0xe'));var deskjs=require(_0x995d('0xf'));var toCsv=require(_0x995d('0x9'));var querystring=require(_0x995d('0x10'));var Papa=require('papaparse');var Redis=require(_0x995d('0x11'));var authService=require(_0x995d('0x12'));var qs=require(_0x995d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x995d('0x14'));var config=require(_0x995d('0x15'));var licenseUtil=require(_0x995d('0x16'));var db=require(_0x995d('0x17'))['db'];var integrations=require(_0x995d('0x18'));function respondWithStatusCode(_0x5134f6,_0x2f9e79){_0x2f9e79=_0x2f9e79||0xcc;return function(_0x299acf){if(_0x299acf){return _0x5134f6[_0x995d('0x19')](_0x2f9e79);}return _0x5134f6[_0x995d('0x1a')](_0x2f9e79)['end']();};}function respondWithResult(_0x38b03c,_0x4f12ba){_0x4f12ba=_0x4f12ba||0xc8;return function(_0xc1e7ad){if(_0xc1e7ad){return _0x38b03c['status'](_0x4f12ba)['json'](_0xc1e7ad);}};}function respondWithFilteredResult(_0x7f4e07,_0x53d041){return function(_0x44230d){if(_0x44230d){var _0x29d8df=typeof _0x53d041[_0x995d('0x1b')]===_0x995d('0x1c')&&typeof _0x53d041[_0x995d('0x1d')]===_0x995d('0x1c');var _0x29a643=_0x44230d[_0x995d('0x1e')];var _0x33e2d5=_0x29d8df?0x0:_0x53d041[_0x995d('0x1b')];var _0x3438c6=_0x29d8df?_0x44230d[_0x995d('0x1e')]:_0x53d041[_0x995d('0x1b')]+_0x53d041[_0x995d('0x1d')];var _0x45aee8;if(_0x3438c6>=_0x29a643){_0x3438c6=_0x29a643;_0x45aee8=0xc8;}else{_0x45aee8=0xce;}_0x7f4e07[_0x995d('0x1a')](_0x45aee8);return _0x7f4e07[_0x995d('0x1f')]('Content-Range',_0x33e2d5+'-'+_0x3438c6+'/'+_0x29a643)[_0x995d('0x20')](_0x44230d);}return null;};}function patchUpdates(_0x14c706){return function(_0x50fd0e){try{jsonpatch[_0x995d('0x21')](_0x50fd0e,_0x14c706,!![]);}catch(_0xec9401){return BPromise[_0x995d('0x22')](_0xec9401);}return _0x50fd0e['save']();};}function saveUpdates(_0x30a59c,_0x511cb3){return function(_0x3eab71){if(_0x3eab71){return _0x3eab71[_0x995d('0x23')](_0x30a59c)[_0x995d('0x24')](function(_0x3754a2){return _0x3754a2;});}return null;};}function removeEntity(_0x380359,_0x539208){return function(_0x29f9bc){if(_0x29f9bc){return _0x29f9bc[_0x995d('0x25')]()['then'](function(){_0x380359['status'](0xcc)[_0x995d('0x26')]();});}};}function handleEntityNotFound(_0x488503,_0x5aa2ba){return function(_0x599f35){if(!_0x599f35){_0x488503[_0x995d('0x19')](0x194);}return _0x599f35;};}function handleError(_0x260ffa,_0x27e402){_0x27e402=_0x27e402||0x1f4;return function(_0x4539bd){logger[_0x995d('0x27')](_0x4539bd['stack']);if(_0x4539bd[_0x995d('0x28')]){delete _0x4539bd[_0x995d('0x28')];}_0x260ffa[_0x995d('0x1a')](_0x27e402)[_0x995d('0x29')](_0x4539bd);};}exports['index']=function(_0x28be92,_0x373e79){var _0x5c2e1c={},_0x448e97={},_0x2ea011={'count':0x0,'rows':[]};var _0x5d4e47=_[_0x995d('0x2a')](db[_0x995d('0x2b')][_0x995d('0x2c')],function(_0x4ccc6d){return{'name':_0x4ccc6d['fieldName'],'type':_0x4ccc6d[_0x995d('0x2d')]['key']};});_0x448e97[_0x995d('0x2e')]=_[_0x995d('0x2a')](_0x5d4e47,_0x995d('0x28'));_0x448e97[_0x995d('0x2f')]=_[_0x995d('0x30')](_0x28be92['query']);_0x448e97[_0x995d('0x31')]=_[_0x995d('0x32')](_0x448e97[_0x995d('0x2e')],_0x448e97['query']);_0x5c2e1c[_0x995d('0x33')]=_['intersection'](_0x448e97[_0x995d('0x2e')],qs[_0x995d('0x34')](_0x28be92[_0x995d('0x2f')][_0x995d('0x34')]));_0x5c2e1c[_0x995d('0x33')]=_0x5c2e1c[_0x995d('0x33')][_0x995d('0x35')]?_0x5c2e1c[_0x995d('0x33')]:_0x448e97[_0x995d('0x2e')];if(!_0x28be92[_0x995d('0x2f')][_0x995d('0x36')](_0x995d('0x37'))){_0x5c2e1c[_0x995d('0x1d')]=qs[_0x995d('0x1d')](_0x28be92[_0x995d('0x2f')][_0x995d('0x1d')]);_0x5c2e1c[_0x995d('0x1b')]=qs[_0x995d('0x1b')](_0x28be92['query'][_0x995d('0x1b')]);}_0x5c2e1c[_0x995d('0x38')]=qs[_0x995d('0x39')](_0x28be92['query']['sort']);_0x5c2e1c['where']=qs['filters'](_[_0x995d('0x3a')](_0x28be92[_0x995d('0x2f')],_0x448e97[_0x995d('0x31')]),_0x5d4e47);if(_0x28be92[_0x995d('0x2f')]['filter']){_0x5c2e1c[_0x995d('0x3b')]=_[_0x995d('0x3c')](_0x5c2e1c['where'],{'$or':_[_0x995d('0x2a')](_0x5d4e47,function(_0x2e4e96){if(_0x2e4e96[_0x995d('0x2d')]!==_0x995d('0x3d')){var _0x1fbbbc={};_0x1fbbbc[_0x2e4e96['name']]={'$like':'%'+_0x28be92[_0x995d('0x2f')]['filter']+'%'};return _0x1fbbbc;}})});}_0x5c2e1c=_[_0x995d('0x3c')]({},_0x5c2e1c,_0x28be92[_0x995d('0x3e')]);var _0x2de5ea={'where':_0x5c2e1c[_0x995d('0x3b')]};return db[_0x995d('0x2b')][_0x995d('0x1e')](_0x2de5ea)[_0x995d('0x24')](function(_0x40e9e4){_0x2ea011['count']=_0x40e9e4;if(_0x28be92[_0x995d('0x2f')][_0x995d('0x3f')]){_0x5c2e1c[_0x995d('0x40')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x995d('0x41')](_0x5c2e1c);})[_0x995d('0x24')](function(_0x3ea2e3){_0x2ea011[_0x995d('0x42')]=_0x3ea2e3;return _0x2ea011;})[_0x995d('0x24')](respondWithFilteredResult(_0x373e79,_0x5c2e1c))[_0x995d('0x43')](handleError(_0x373e79,null));};exports[_0x995d('0x44')]=function(_0x304213,_0x50ab57){var _0x4bc508={'raw':![],'where':{'id':_0x304213[_0x995d('0x45')]['id']}},_0x2e1f34={};_0x2e1f34['model']=_['keys'](db[_0x995d('0x2b')][_0x995d('0x2c')]);_0x2e1f34[_0x995d('0x2f')]=_['keys'](_0x304213[_0x995d('0x2f')]);_0x2e1f34[_0x995d('0x31')]=_[_0x995d('0x32')](_0x2e1f34[_0x995d('0x2e')],_0x2e1f34[_0x995d('0x2f')]);_0x4bc508['attributes']=_['intersection'](_0x2e1f34[_0x995d('0x2e')],qs[_0x995d('0x34')](_0x304213[_0x995d('0x2f')][_0x995d('0x34')]));_0x4bc508[_0x995d('0x33')]=_0x4bc508['attributes'][_0x995d('0x35')]?_0x4bc508['attributes']:_0x2e1f34['model'];if(_0x304213[_0x995d('0x2f')][_0x995d('0x3f')]){_0x4bc508[_0x995d('0x40')]=[{'all':!![]}];}_0x4bc508=_[_0x995d('0x3c')]({},_0x4bc508,_0x304213[_0x995d('0x3e')]);return db[_0x995d('0x2b')][_0x995d('0x46')](_0x4bc508)['then'](handleEntityNotFound(_0x50ab57,null))[_0x995d('0x24')](respondWithResult(_0x50ab57,null))[_0x995d('0x43')](handleError(_0x50ab57,null));};exports[_0x995d('0x47')]=function(_0xd81efe,_0x3ccde0){return db[_0x995d('0x2b')][_0x995d('0x47')](_0xd81efe[_0x995d('0x48')],{})[_0x995d('0x24')](respondWithResult(_0x3ccde0,0xc9))['catch'](handleError(_0x3ccde0,null));};exports[_0x995d('0x23')]=function(_0x5d9591,_0x3ddb15){if(_0x5d9591[_0x995d('0x48')]['id']){delete _0x5d9591['body']['id'];}return db[_0x995d('0x2b')][_0x995d('0x46')]({'where':{'id':_0x5d9591['params']['id']}})[_0x995d('0x24')](handleEntityNotFound(_0x3ddb15,null))[_0x995d('0x24')](saveUpdates(_0x5d9591[_0x995d('0x48')],null))[_0x995d('0x24')](respondWithResult(_0x3ddb15,null))['catch'](handleError(_0x3ddb15,null));};exports[_0x995d('0x25')]=function(_0x5517ba,_0x288d71){return db[_0x995d('0x2b')][_0x995d('0x46')]({'where':{'id':_0x5517ba[_0x995d('0x45')]['id']}})[_0x995d('0x24')](handleEntityNotFound(_0x288d71,null))['then'](removeEntity(_0x288d71,null))[_0x995d('0x43')](handleError(_0x288d71,null));};exports[_0x995d('0x49')]=function(_0xe7bd43,_0x27b933,_0x1118fe){var _0x4ee14d={};var _0x8bbcf6={};var _0x3451a8;var _0xffcc60;return db['Dynamics365Account']['findOne']({'where':{'id':_0xe7bd43[_0x995d('0x45')]['id']}})[_0x995d('0x24')](handleEntityNotFound(_0x27b933,null))[_0x995d('0x24')](function(_0x54f452){if(_0x54f452){_0x3451a8=_0x54f452;_0x8bbcf6['model']=_['keys'](db[_0x995d('0x4a')][_0x995d('0x2c')]);_0x8bbcf6['query']=_[_0x995d('0x30')](_0xe7bd43[_0x995d('0x2f')]);_0x8bbcf6[_0x995d('0x31')]=_['intersection'](_0x8bbcf6[_0x995d('0x2e')],_0x8bbcf6[_0x995d('0x2f')]);_0x4ee14d[_0x995d('0x33')]=_[_0x995d('0x32')](_0x8bbcf6[_0x995d('0x2e')],qs[_0x995d('0x34')](_0xe7bd43[_0x995d('0x2f')][_0x995d('0x34')]));_0x4ee14d['attributes']=_0x4ee14d[_0x995d('0x33')][_0x995d('0x35')]?_0x4ee14d[_0x995d('0x33')]:_0x8bbcf6['model'];_0x4ee14d[_0x995d('0x38')]=qs['sort'](_0xe7bd43[_0x995d('0x2f')]['sort']);_0x4ee14d[_0x995d('0x3b')]=qs[_0x995d('0x31')](_[_0x995d('0x3a')](_0xe7bd43[_0x995d('0x2f')],_0x8bbcf6[_0x995d('0x31')]));if(_0xe7bd43['query'][_0x995d('0x4b')]){_0x4ee14d[_0x995d('0x3b')]=_['merge'](_0x4ee14d['where'],{'$or':_['map'](_0x4ee14d[_0x995d('0x33')],function(_0x204472){var _0x1b9762={};_0x1b9762[_0x204472]={'$like':'%'+_0xe7bd43[_0x995d('0x2f')]['filter']+'%'};return _0x1b9762;})});}_0x4ee14d=_['merge']({},_0x4ee14d,_0xe7bd43[_0x995d('0x3e')]);return _0x3451a8[_0x995d('0x49')](_0x4ee14d);}})['then'](function(_0x555e1c){if(_0x555e1c){_0xffcc60=_0x555e1c[_0x995d('0x35')];if(!_0xe7bd43[_0x995d('0x2f')][_0x995d('0x36')]('nolimit')){_0x4ee14d[_0x995d('0x1d')]=qs[_0x995d('0x1d')](_0xe7bd43[_0x995d('0x2f')]['limit']);_0x4ee14d[_0x995d('0x1b')]=qs[_0x995d('0x1b')](_0xe7bd43['query'][_0x995d('0x1b')]);}return _0x3451a8[_0x995d('0x49')](_0x4ee14d);}})[_0x995d('0x24')](function(_0x23ac77){if(_0x23ac77){return _0x23ac77?{'count':_0xffcc60,'rows':_0x23ac77}:null;}})['then'](respondWithResult(_0x27b933,null))[_0x995d('0x43')](handleError(_0x27b933,null));};exports['addConfiguration']=function(_0x168531,_0x135216,_0x547332){if(_0x168531[_0x995d('0x48')]['id']){delete _0x168531[_0x995d('0x48')]['id'];}return db[_0x995d('0x2b')][_0x995d('0x4c')]({'where':{'id':_0x168531[_0x995d('0x45')]['id']}})['then'](handleEntityNotFound(_0x135216,null))[_0x995d('0x24')](function(_0x20aee4){if(_0x20aee4){_0x168531[_0x995d('0x48')][_0x995d('0x4d')]=_0x20aee4['id'];_0x168531[_0x995d('0x48')][_0x995d('0x4e')]=integrations[_0x995d('0x4f')](_0x168531['body'][_0x995d('0x50')],_0x168531['body']['type']);_0x168531[_0x995d('0x48')][_0x995d('0x51')]=integrations['getDescriptions'](_0x168531[_0x995d('0x48')][_0x995d('0x50')],_0x168531['body'][_0x995d('0x2d')]);return db[_0x995d('0x4a')][_0x995d('0x47')](_0x168531[_0x995d('0x48')],{'include':[{'model':db[_0x995d('0x52')],'as':'Subjects'},{'model':db[_0x995d('0x52')],'as':_0x995d('0x51')}]});}return null;})['then'](respondWithResult(_0x135216,null))[_0x995d('0x43')](handleError(_0x135216,null));};exports['getFields']=function(_0x459b06,_0xe59868,_0x5dc7cf){var _0x26ad32=_0x459b06[_0x995d('0x2f')][_0x995d('0x53')];var _0x512cf5=_0x26ad32===_0x995d('0x54')?'Incident':_0x995d('0x55');var _0x2d5ff6='';var _0xb5f648='';var _0x57fe48='';var _0x3cd660='';var _0x3d6e4d='';var _0x1ec69e='';var _0x3d6427='';var _0x3712fe='';var _0x20e14a=[_0x995d('0x56'),_0x995d('0x57'),_0x995d('0x58'),_0x995d('0x59'),'caseorigincode',_0x995d('0x5a'),_0x995d('0x5b'),_0x995d('0x5c'),'directioncode',_0x995d('0x5d')];var _0x4b081a=[_0x995d('0x5e'),'accountidyominame',_0x995d('0x5f'),'billedserviceunits',_0x995d('0x60'),_0x995d('0x61'),'contractdetailidname',_0x995d('0x62'),'createdbyexternalpartyname',_0x995d('0x63'),_0x995d('0x64'),'createdbyyominame','createdon',_0x995d('0x65'),_0x995d('0x66'),_0x995d('0x67'),'customeridtype','customeridyominame',_0x995d('0x68'),_0x995d('0x69'),_0x995d('0x6a'),_0x995d('0x6b'),_0x995d('0x6c'),'exchangerate',_0x995d('0x6d'),_0x995d('0x6e'),_0x995d('0x6f'),_0x995d('0x70'),'kbarticleidname','lastonholdtime',_0x995d('0x71'),_0x995d('0x72'),_0x995d('0x73'),_0x995d('0x74'),_0x995d('0x75'),_0x995d('0x76'),_0x995d('0x77'),_0x995d('0x78'),'msdyn_incidenttypename',_0x995d('0x79'),_0x995d('0x7a'),_0x995d('0x7b'),_0x995d('0x7c'),_0x995d('0x7d'),_0x995d('0x7e'),_0x995d('0x7f'),'parentcaseidname',_0x995d('0x80'),_0x995d('0x81'),_0x995d('0x82'),_0x995d('0x83'),_0x995d('0x84'),'resolveby',_0x995d('0x85'),_0x995d('0x86'),'responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname',_0x995d('0x87'),'socialprofileidname',_0x995d('0x88'),'statuscode',_0x995d('0x89'),_0x995d('0x8a'),_0x995d('0x8b'),_0x995d('0x8c'),_0x995d('0x8d'),'utcconversiontimezonecode','versionnumber'];var _0x4dae2e=_0x20e14a[_0x995d('0x8e')](_0x4b081a);return db['Dynamics365Account'][_0x995d('0x4c')]({'where':{'id':_0x459b06[_0x995d('0x45')]['id']},'attributes':['id',_0x995d('0x8f'),_0x995d('0x90'),'remoteUri',_0x995d('0x91'),'clientId',_0x995d('0x92')]})[_0x995d('0x24')](handleEntityNotFound(_0xe59868,null))[_0x995d('0x24')](function(_0x23d328){if(_0x23d328){_0x3712fe=_0x23d328[_0x995d('0x93')];var _0x56ef5e=_0x3712fe[_0x995d('0x94')](-0x1);if(_0x56ef5e==='/'){_0x3712fe=_0x3712fe[_0x995d('0x95')](0x0,_0x3712fe['lastIndexOf'](_0x56ef5e));}_0x3d6427=util[_0x995d('0x96')](_0x995d('0x97'),_0x3712fe);var _0x3b072b={'method':_0x995d('0x98'),'uri':_0x995d('0x99')+_0x23d328[_0x995d('0x91')]+'/oauth2/token','form':{'client_id':_0x23d328[_0x995d('0x9a')],'resource':_0x3712fe,'username':_0x23d328[_0x995d('0x8f')],'password':_0x23d328[_0x995d('0x90')],'grant_type':_0x995d('0x90'),'client_secret':_0x23d328['clientSecret']},'json':!![]};return rp(_0x3b072b);}})[_0x995d('0x24')](function(_0x168098){_0x1ec69e=_0x168098[_0x995d('0x9b')];var _0x4805cb={'method':'GET','uri':encodeURI(_0x3d6427+_0x995d('0x9c')+_0x512cf5+'\x27'),'headers':{'Authorization':_0x995d('0x9d')+_0x1ec69e,'If-None-Match':null,'OData-Version':_0x995d('0x9e')},'json':!![]};return rp(_0x4805cb);})[_0x995d('0x24')](function(_0x8927e1){var _0x169d25=_0x8927e1[_0x995d('0x9f')][0x0];var _0x547b1b=_0x169d25[_0x995d('0xa0')];var _0xdf6cfe={'method':_0x995d('0xa1'),'uri':_0x3d6427+_0x995d('0xa2')+_0x547b1b+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x995d('0x9d')+_0x1ec69e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xdf6cfe);})[_0x995d('0x24')](function(_0x5141ba){_0x2d5ff6=_0x5141ba;_0xb5f648=_0x2d5ff6[_0x995d('0xa3')];_0xb5f648=_[_0x995d('0xa4')](_0xb5f648,function(_0x7325be){return!_0x4dae2e['includes'](_0x7325be[_0x995d('0xa5')]);});var _0x3d1264=[];var _0x100373=[];_0xb5f648[_0x995d('0xa6')](function(_0x738c42){if(_0x738c42[_0x995d('0xa7')]){var _0x1a16e9=_0x738c42[_0x995d('0xa7')]['substring'](_0x738c42[_0x995d('0xa7')][_0x995d('0xa8')]('.')+0x1);if(_0x1a16e9===_0x995d('0xa9')){_0x3d1264[_0x995d('0xaa')](getSelectList(_0x3d6427,_0x26ad32,_0x100373,_0x2d5ff6[_0x995d('0xa0')],_0x738c42[_0x995d('0xa0')],_0x1ec69e));}}});return Promise[_0x995d('0xab')](_0x3d1264);})[_0x995d('0x24')](function(_0x3a5571){_0x57fe48=_0x3a5571[0x0];var _0x5cd848=[];var _0x2c9165=[];_0xb5f648[_0x995d('0xa6')](function(_0x79ff16){if(!_[_0x995d('0xac')](_0x79ff16[_0x995d('0xa7')])){var _0x12f9cf=_0x79ff16[_0x995d('0xa7')][_0x995d('0x95')](_0x79ff16[_0x995d('0xa7')][_0x995d('0xa8')]('.')+0x1);if(_0x12f9cf===_0x995d('0xad')){_0x5cd848[_0x995d('0xaa')](getBooleanList(_0x3d6427,_0x26ad32,_0x2c9165,_0x2d5ff6[_0x995d('0xa0')],_0x79ff16[_0x995d('0xa0')],_0x1ec69e));}}});return Promise[_0x995d('0xab')](_0x5cd848);})[_0x995d('0x24')](function(_0x49c7e6){_0x3cd660=_0x49c7e6[0x0];var _0x2addeb=[];var _0x270296=[];_0xb5f648[_0x995d('0xa6')](function(_0x4adbae){if(_0x4adbae[_0x995d('0xa7')]){var _0x352c5a=_0x4adbae['@odata.type'][_0x995d('0x95')](_0x4adbae[_0x995d('0xa7')][_0x995d('0xa8')]('.')+0x1);if(_0x352c5a===_0x995d('0xae')||_0x352c5a===_0x995d('0xaf')||_0x352c5a===_0x995d('0xb0')||_0x352c5a==='IntegerAttributeMetadata'||_0x352c5a==='MemoAttributeMetadata'||_0x352c5a===_0x995d('0xb1')||_0x352c5a===_0x995d('0xb2')||_0x352c5a===_0x995d('0xb3')||_0x352c5a===_0x995d('0xb4')||_0x352c5a===_0x995d('0xb5')){_0x2addeb[_0x995d('0xaa')](getInputList(_0x3d6427,_0x26ad32,_0x352c5a,_0x270296,_0x2d5ff6[_0x995d('0xa0')],_0x4adbae['MetadataId'],_0x1ec69e));}}});return Promise['all'](_0x2addeb);})[_0x995d('0x24')](function(_0x7fd7bc){_0x3d6e4d=_0x7fd7bc[0x0];var _0x29ca4d=_0x57fe48[_0x995d('0x8e')](_0x3cd660)[_0x995d('0x8e')](_0x3d6e4d);var _0x377d8b={'count':_0x29ca4d[_0x995d('0x35')],'rows':_0x29ca4d};return _0x377d8b;})[_0x995d('0x24')](respondWithResult(_0xe59868,null))['catch'](function(_0x231d5c){var _0x307fe7=_0x459b06[_0x995d('0x2f')][_0x995d('0xb6')]?0x1f4:_0x231d5c['statusCode']||0x1f4;logger[_0x995d('0x27')](_0x231d5c[_0x995d('0xb7')]);delete _0x231d5c['name'];if(_0x307fe7===0x191){_0x307fe7=0x190;}_0xe59868[_0x995d('0x1a')](_0x307fe7)['send'](_0x459b06['query'][_0x995d('0xb6')]?{'message':'Wrong\x20credentials','statusCode':_0x231d5c[_0x995d('0xb8')]}:_0x231d5c);});};function getSelectList(_0x22bbdb,_0x52d9a0,_0xf6b2b0,_0x192d9a,_0x1c5661,_0x131c5e){var _0x12dd6e={'method':_0x995d('0xa1'),'uri':_0x22bbdb+'EntityDefinitions('+_0x192d9a+_0x995d('0xb9')+_0x1c5661+_0x995d('0xba')+_0x995d('0xbb'),'headers':{'Authorization':_0x995d('0x9d')+_0x131c5e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x12dd6e)[_0x995d('0x24')](function(_0x1a2a6a){var _0x2cc28f=[];var _0x4b2d88=_0x1a2a6a[_0x995d('0xbc')][_0x995d('0xbd')];_0x4b2d88[_0x995d('0xa6')](function(_0x28ed30){_0x2cc28f['push']({'name':_0x28ed30[_0x995d('0xbe')][_0x995d('0xbf')][_0x995d('0xbe')],'value':String(_0x28ed30['Value'])});});var _0x10a57f={'id':_0x52d9a0+'_'+_0x1a2a6a[_0x995d('0xa5')],'name':_0x1a2a6a[_0x995d('0xc0')][_0x995d('0xbf')][_0x995d('0xbe')],'custom':![],'options':_0x2cc28f};_0xf6b2b0[_0x995d('0xaa')](_0x10a57f);return _0xf6b2b0;});}function getBooleanList(_0x5c36d4,_0x4795fd,_0x36b799,_0x3d82a8,_0xe6ba5,_0x18c6c0){var _0x1668c0={'method':'GET','uri':_0x5c36d4+_0x995d('0xa2')+_0x3d82a8+_0x995d('0xb9')+_0xe6ba5+_0x995d('0xc1'),'headers':{'Authorization':'Bearer\x20'+_0x18c6c0,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1668c0)[_0x995d('0x24')](function(_0x157a77){var _0x44e6f3=[];_0x44e6f3[_0x995d('0xaa')]({'name':_0x157a77[_0x995d('0xbc')][_0x995d('0xc2')][_0x995d('0xbe')]['UserLocalizedLabel'][_0x995d('0xbe')],'value':'true'},{'name':_0x157a77[_0x995d('0xbc')][_0x995d('0xc3')][_0x995d('0xbe')][_0x995d('0xbf')]['Label'],'value':'false'});var _0x2893b2={'id':_0x4795fd+'_'+_0x157a77['LogicalName'],'name':_0x157a77[_0x995d('0xc0')][_0x995d('0xbf')][_0x995d('0xbe')],'custom':![],'options':_0x44e6f3};_0x36b799[_0x995d('0xaa')](_0x2893b2);return _0x36b799;});}function getInputList(_0x2b8e12,_0x1077a5,_0x18be5c,_0x38fc5f,_0xe2a0aa,_0x5a635c,_0x466b0e){var _0x3e0637={'method':_0x995d('0xa1'),'uri':_0x2b8e12+_0x995d('0xa2')+_0xe2a0aa+')/Attributes('+_0x5a635c+_0x995d('0xc4')+_0x18be5c+_0x995d('0xc5'),'headers':{'Authorization':'Bearer\x20'+_0x466b0e,'If-None-Match':null,'OData-Version':_0x995d('0x9e')},'json':!![]};return rp(_0x3e0637)[_0x995d('0x24')](function(_0x408efe){var _0x43a889={'id':_0x1077a5+'_'+_0x408efe[_0x995d('0xa5')],'name':_0x408efe['DisplayName'][_0x995d('0xbf')]?_0x408efe[_0x995d('0xc0')]['UserLocalizedLabel']['Label']:_0x408efe[_0x995d('0xa5')],'custom':![],'options':[]};_0x38fc5f['push'](_0x43a889);return _0x38fc5f;});} \ No newline at end of file +var _0x6fad=['index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Account','count','include','findAll','rows','catch','show','params','keys','create','body','find','getConfigurations','Dynamics365Configuration','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyyominame','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','findOne','username','password','remoteUri','clientId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','tenantId','/oauth2/token','access_token','GET','MetadataId','Bearer\x20','4.0','Attributes','remove','includes','LogicalName','@odata.type','PicklistAttributeMetadata','forEach','isNil','BooleanAttributeMetadata','push','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','test','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','UserLocalizedLabel','Label','DisplayName','TrueOption','false','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send'];(function(_0x2b7bb8,_0x129267){var _0x1a008a=function(_0x3f9066){while(--_0x3f9066){_0x2b7bb8['push'](_0x2b7bb8['shift']());}};_0x1a008a(++_0x129267);}(_0x6fad,0x174));var _0xd6fa=function(_0x404eff,_0x4ef653){_0x404eff=_0x404eff-0x0;var _0x46cc25=_0x6fad[_0x404eff];return _0x46cc25;};'use strict';var emlformat=require(_0xd6fa('0x0'));var rimraf=require(_0xd6fa('0x1'));var zipdir=require(_0xd6fa('0x2'));var jsonpatch=require(_0xd6fa('0x3'));var rp=require('request-promise');var moment=require(_0xd6fa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd6fa('0x5'));var util=require(_0xd6fa('0x6'));var path=require(_0xd6fa('0x7'));var sox=require(_0xd6fa('0x8'));var csv=require('to-csv');var ejs=require(_0xd6fa('0x9'));var fs=require('fs');var fs_extra=require(_0xd6fa('0xa'));var _=require(_0xd6fa('0xb'));var squel=require(_0xd6fa('0xc'));var crypto=require('crypto');var jsforce=require(_0xd6fa('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd6fa('0xe'));var querystring=require(_0xd6fa('0xf'));var Papa=require(_0xd6fa('0x10'));var Redis=require(_0xd6fa('0x11'));var authService=require(_0xd6fa('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6fa('0x13'));var logger=require(_0xd6fa('0x14'))(_0xd6fa('0x15'));var utils=require(_0xd6fa('0x16'));var config=require(_0xd6fa('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xd6fa('0x18'));function respondWithStatusCode(_0x54a0b4,_0x5e0600){_0x5e0600=_0x5e0600||0xcc;return function(_0x33ee61){if(_0x33ee61){return _0x54a0b4[_0xd6fa('0x19')](_0x5e0600);}return _0x54a0b4[_0xd6fa('0x1a')](_0x5e0600)[_0xd6fa('0x1b')]();};}function respondWithResult(_0x3cd6fa,_0x919d49){_0x919d49=_0x919d49||0xc8;return function(_0x15616f){if(_0x15616f){return _0x3cd6fa[_0xd6fa('0x1a')](_0x919d49)[_0xd6fa('0x1c')](_0x15616f);}};}function respondWithFilteredResult(_0x5b853a,_0x3ad938){return function(_0x4082c5){if(_0x4082c5){var _0x3651ed=typeof _0x3ad938[_0xd6fa('0x1d')]==='undefined'&&typeof _0x3ad938['limit']==='undefined';var _0x5c2a73=_0x4082c5['count'];var _0xe458aa=_0x3651ed?0x0:_0x3ad938['offset'];var _0x41d26f=_0x3651ed?_0x4082c5['count']:_0x3ad938[_0xd6fa('0x1d')]+_0x3ad938[_0xd6fa('0x1e')];var _0x2ee97a;if(_0x41d26f>=_0x5c2a73){_0x41d26f=_0x5c2a73;_0x2ee97a=0xc8;}else{_0x2ee97a=0xce;}_0x5b853a[_0xd6fa('0x1a')](_0x2ee97a);return _0x5b853a[_0xd6fa('0x1f')](_0xd6fa('0x20'),_0xe458aa+'-'+_0x41d26f+'/'+_0x5c2a73)[_0xd6fa('0x1c')](_0x4082c5);}return null;};}function patchUpdates(_0x42f984){return function(_0x102aa1){try{jsonpatch[_0xd6fa('0x21')](_0x102aa1,_0x42f984,!![]);}catch(_0x20159f){return BPromise[_0xd6fa('0x22')](_0x20159f);}return _0x102aa1[_0xd6fa('0x23')]();};}function saveUpdates(_0x26c329,_0x2f1f4e){return function(_0xd1637f){if(_0xd1637f){return _0xd1637f[_0xd6fa('0x24')](_0x26c329)[_0xd6fa('0x25')](function(_0x3fbab3){return _0x3fbab3;});}return null;};}function removeEntity(_0x5f2088,_0x5dd144){return function(_0x3d3d7b){if(_0x3d3d7b){return _0x3d3d7b[_0xd6fa('0x26')]()[_0xd6fa('0x25')](function(){_0x5f2088[_0xd6fa('0x1a')](0xcc)[_0xd6fa('0x1b')]();});}};}function handleEntityNotFound(_0xa3264f,_0x5f25ca){return function(_0x28173e){if(!_0x28173e){_0xa3264f[_0xd6fa('0x19')](0x194);}return _0x28173e;};}function handleError(_0x4c7444,_0x1ac83f){_0x1ac83f=_0x1ac83f||0x1f4;return function(_0xdac7e1){logger[_0xd6fa('0x27')](_0xdac7e1['stack']);if(_0xdac7e1[_0xd6fa('0x28')]){delete _0xdac7e1[_0xd6fa('0x28')];}_0x4c7444[_0xd6fa('0x1a')](_0x1ac83f)[_0xd6fa('0x29')](_0xdac7e1);};}exports[_0xd6fa('0x2a')]=function(_0x198ad6,_0x42f145){var _0x4b2329={},_0x2a59c0={},_0x4c1104={'count':0x0,'rows':[]};var _0x2eaaef=_[_0xd6fa('0x2b')](db['Dynamics365Account'][_0xd6fa('0x2c')],function(_0x2caae7){return{'name':_0x2caae7[_0xd6fa('0x2d')],'type':_0x2caae7[_0xd6fa('0x2e')][_0xd6fa('0x2f')]};});_0x2a59c0[_0xd6fa('0x30')]=_[_0xd6fa('0x2b')](_0x2eaaef,_0xd6fa('0x28'));_0x2a59c0[_0xd6fa('0x31')]=_['keys'](_0x198ad6[_0xd6fa('0x31')]);_0x2a59c0[_0xd6fa('0x32')]=_['intersection'](_0x2a59c0[_0xd6fa('0x30')],_0x2a59c0[_0xd6fa('0x31')]);_0x4b2329[_0xd6fa('0x33')]=_[_0xd6fa('0x34')](_0x2a59c0[_0xd6fa('0x30')],qs[_0xd6fa('0x35')](_0x198ad6[_0xd6fa('0x31')][_0xd6fa('0x35')]));_0x4b2329[_0xd6fa('0x33')]=_0x4b2329[_0xd6fa('0x33')][_0xd6fa('0x36')]?_0x4b2329['attributes']:_0x2a59c0[_0xd6fa('0x30')];if(!_0x198ad6['query'][_0xd6fa('0x37')]('nolimit')){_0x4b2329[_0xd6fa('0x1e')]=qs[_0xd6fa('0x1e')](_0x198ad6['query'][_0xd6fa('0x1e')]);_0x4b2329['offset']=qs[_0xd6fa('0x1d')](_0x198ad6[_0xd6fa('0x31')][_0xd6fa('0x1d')]);}_0x4b2329['order']=qs['sort'](_0x198ad6[_0xd6fa('0x31')][_0xd6fa('0x38')]);_0x4b2329[_0xd6fa('0x39')]=qs['filters'](_[_0xd6fa('0x3a')](_0x198ad6[_0xd6fa('0x31')],_0x2a59c0[_0xd6fa('0x32')]),_0x2eaaef);if(_0x198ad6[_0xd6fa('0x31')][_0xd6fa('0x3b')]){_0x4b2329[_0xd6fa('0x39')]=_[_0xd6fa('0x3c')](_0x4b2329['where'],{'$or':_[_0xd6fa('0x2b')](_0x2eaaef,function(_0x102aaa){if(_0x102aaa[_0xd6fa('0x2e')]!==_0xd6fa('0x3d')){var _0x3c4dd3={};_0x3c4dd3[_0x102aaa[_0xd6fa('0x28')]]={'$like':'%'+_0x198ad6[_0xd6fa('0x31')][_0xd6fa('0x3b')]+'%'};return _0x3c4dd3;}})});}_0x4b2329=_['merge']({},_0x4b2329,_0x198ad6[_0xd6fa('0x3e')]);var _0x1239dc={'where':_0x4b2329[_0xd6fa('0x39')]};return db[_0xd6fa('0x3f')][_0xd6fa('0x40')](_0x1239dc)[_0xd6fa('0x25')](function(_0x295d9a){_0x4c1104[_0xd6fa('0x40')]=_0x295d9a;if(_0x198ad6[_0xd6fa('0x31')]['includeAll']){_0x4b2329[_0xd6fa('0x41')]=[{'all':!![]}];}return db[_0xd6fa('0x3f')][_0xd6fa('0x42')](_0x4b2329);})[_0xd6fa('0x25')](function(_0x4d7e02){_0x4c1104[_0xd6fa('0x43')]=_0x4d7e02;return _0x4c1104;})[_0xd6fa('0x25')](respondWithFilteredResult(_0x42f145,_0x4b2329))[_0xd6fa('0x44')](handleError(_0x42f145,null));};exports[_0xd6fa('0x45')]=function(_0x32ac34,_0x1ebdc1){var _0x9dff9c={'raw':![],'where':{'id':_0x32ac34[_0xd6fa('0x46')]['id']}},_0x3af46b={};_0x3af46b[_0xd6fa('0x30')]=_[_0xd6fa('0x47')](db[_0xd6fa('0x3f')][_0xd6fa('0x2c')]);_0x3af46b[_0xd6fa('0x31')]=_[_0xd6fa('0x47')](_0x32ac34['query']);_0x3af46b[_0xd6fa('0x32')]=_[_0xd6fa('0x34')](_0x3af46b['model'],_0x3af46b[_0xd6fa('0x31')]);_0x9dff9c[_0xd6fa('0x33')]=_[_0xd6fa('0x34')](_0x3af46b[_0xd6fa('0x30')],qs[_0xd6fa('0x35')](_0x32ac34['query'][_0xd6fa('0x35')]));_0x9dff9c[_0xd6fa('0x33')]=_0x9dff9c[_0xd6fa('0x33')]['length']?_0x9dff9c[_0xd6fa('0x33')]:_0x3af46b[_0xd6fa('0x30')];if(_0x32ac34[_0xd6fa('0x31')]['includeAll']){_0x9dff9c['include']=[{'all':!![]}];}_0x9dff9c=_[_0xd6fa('0x3c')]({},_0x9dff9c,_0x32ac34[_0xd6fa('0x3e')]);return db[_0xd6fa('0x3f')]['find'](_0x9dff9c)['then'](handleEntityNotFound(_0x1ebdc1,null))[_0xd6fa('0x25')](respondWithResult(_0x1ebdc1,null))[_0xd6fa('0x44')](handleError(_0x1ebdc1,null));};exports[_0xd6fa('0x48')]=function(_0x8cd0dc,_0x2b9777){return db[_0xd6fa('0x3f')][_0xd6fa('0x48')](_0x8cd0dc[_0xd6fa('0x49')],{})[_0xd6fa('0x25')](respondWithResult(_0x2b9777,0xc9))[_0xd6fa('0x44')](handleError(_0x2b9777,null));};exports[_0xd6fa('0x24')]=function(_0x35ea22,_0x3536b9){if(_0x35ea22[_0xd6fa('0x49')]['id']){delete _0x35ea22[_0xd6fa('0x49')]['id'];}return db[_0xd6fa('0x3f')]['find']({'where':{'id':_0x35ea22[_0xd6fa('0x46')]['id']}})['then'](handleEntityNotFound(_0x3536b9,null))[_0xd6fa('0x25')](saveUpdates(_0x35ea22[_0xd6fa('0x49')],null))['then'](respondWithResult(_0x3536b9,null))['catch'](handleError(_0x3536b9,null));};exports[_0xd6fa('0x26')]=function(_0x29aa26,_0x554ff8){return db[_0xd6fa('0x3f')][_0xd6fa('0x4a')]({'where':{'id':_0x29aa26[_0xd6fa('0x46')]['id']}})[_0xd6fa('0x25')](handleEntityNotFound(_0x554ff8,null))[_0xd6fa('0x25')](removeEntity(_0x554ff8,null))[_0xd6fa('0x44')](handleError(_0x554ff8,null));};exports[_0xd6fa('0x4b')]=function(_0x480ca6,_0xcf7583,_0x2f55ff){var _0x493b37={};var _0x304438={};var _0x475c3b;var _0x5cc957;return db[_0xd6fa('0x3f')]['findOne']({'where':{'id':_0x480ca6['params']['id']}})[_0xd6fa('0x25')](handleEntityNotFound(_0xcf7583,null))[_0xd6fa('0x25')](function(_0x182f62){if(_0x182f62){_0x475c3b=_0x182f62;_0x304438['model']=_[_0xd6fa('0x47')](db[_0xd6fa('0x4c')]['rawAttributes']);_0x304438['query']=_[_0xd6fa('0x47')](_0x480ca6['query']);_0x304438[_0xd6fa('0x32')]=_[_0xd6fa('0x34')](_0x304438[_0xd6fa('0x30')],_0x304438['query']);_0x493b37['attributes']=_['intersection'](_0x304438[_0xd6fa('0x30')],qs[_0xd6fa('0x35')](_0x480ca6[_0xd6fa('0x31')]['fields']));_0x493b37['attributes']=_0x493b37[_0xd6fa('0x33')][_0xd6fa('0x36')]?_0x493b37[_0xd6fa('0x33')]:_0x304438['model'];_0x493b37['order']=qs[_0xd6fa('0x38')](_0x480ca6[_0xd6fa('0x31')][_0xd6fa('0x38')]);_0x493b37[_0xd6fa('0x39')]=qs[_0xd6fa('0x32')](_[_0xd6fa('0x3a')](_0x480ca6['query'],_0x304438['filters']));if(_0x480ca6[_0xd6fa('0x31')][_0xd6fa('0x3b')]){_0x493b37[_0xd6fa('0x39')]=_['merge'](_0x493b37[_0xd6fa('0x39')],{'$or':_['map'](_0x493b37[_0xd6fa('0x33')],function(_0x5a2882){var _0x313016={};_0x313016[_0x5a2882]={'$like':'%'+_0x480ca6['query']['filter']+'%'};return _0x313016;})});}_0x493b37=_[_0xd6fa('0x3c')]({},_0x493b37,_0x480ca6[_0xd6fa('0x3e')]);return _0x475c3b[_0xd6fa('0x4b')](_0x493b37);}})[_0xd6fa('0x25')](function(_0x58482a){if(_0x58482a){_0x5cc957=_0x58482a['length'];if(!_0x480ca6[_0xd6fa('0x31')]['hasOwnProperty'](_0xd6fa('0x4d'))){_0x493b37[_0xd6fa('0x1e')]=qs[_0xd6fa('0x1e')](_0x480ca6[_0xd6fa('0x31')][_0xd6fa('0x1e')]);_0x493b37[_0xd6fa('0x1d')]=qs[_0xd6fa('0x1d')](_0x480ca6[_0xd6fa('0x31')][_0xd6fa('0x1d')]);}return _0x475c3b['getConfigurations'](_0x493b37);}})[_0xd6fa('0x25')](function(_0x13e3b6){if(_0x13e3b6){return _0x13e3b6?{'count':_0x5cc957,'rows':_0x13e3b6}:null;}})[_0xd6fa('0x25')](respondWithResult(_0xcf7583,null))[_0xd6fa('0x44')](handleError(_0xcf7583,null));};exports[_0xd6fa('0x4e')]=function(_0x39b8c4,_0x3fa686,_0x53e634){if(_0x39b8c4[_0xd6fa('0x49')]['id']){delete _0x39b8c4[_0xd6fa('0x49')]['id'];}return db[_0xd6fa('0x3f')]['findOne']({'where':{'id':_0x39b8c4['params']['id']}})[_0xd6fa('0x25')](handleEntityNotFound(_0x3fa686,null))[_0xd6fa('0x25')](function(_0x5d910e){if(_0x5d910e){_0x39b8c4['body'][_0xd6fa('0x4f')]=_0x5d910e['id'];_0x39b8c4[_0xd6fa('0x49')][_0xd6fa('0x50')]=integrations['getSubjects'](_0x39b8c4['body'][_0xd6fa('0x51')],_0x39b8c4['body'][_0xd6fa('0x2e')]);_0x39b8c4[_0xd6fa('0x49')][_0xd6fa('0x52')]=integrations[_0xd6fa('0x53')](_0x39b8c4['body'][_0xd6fa('0x51')],_0x39b8c4[_0xd6fa('0x49')][_0xd6fa('0x2e')]);return db[_0xd6fa('0x4c')][_0xd6fa('0x48')](_0x39b8c4[_0xd6fa('0x49')],{'include':[{'model':db[_0xd6fa('0x54')],'as':'Subjects'},{'model':db[_0xd6fa('0x54')],'as':_0xd6fa('0x52')}]});}return null;})[_0xd6fa('0x25')](respondWithResult(_0x3fa686,null))[_0xd6fa('0x44')](handleError(_0x3fa686,null));};exports[_0xd6fa('0x55')]=function(_0x2bbd22,_0x5b6c72,_0x78e5e9){var _0x351147=_0x2bbd22[_0xd6fa('0x31')]['ticketType'];var _0x2c677a=_0x351147===_0xd6fa('0x56')?_0xd6fa('0x57'):_0xd6fa('0x58');var _0x3b8cf2='';var _0xd8f65f='';var _0x16f284='';var _0x376aad='';var _0x42332d='';var _0x533989='';var _0x4c7691='';var _0xcd46bd='';var _0x21228c=[_0xd6fa('0x59'),_0xd6fa('0x5a'),_0xd6fa('0x5b'),_0xd6fa('0x5c'),_0xd6fa('0x5d'),_0xd6fa('0x5e'),'phonenumber',_0xd6fa('0x5f'),_0xd6fa('0x60'),_0xd6fa('0x61')];var _0x2de312=['accountidname',_0xd6fa('0x62'),_0xd6fa('0x63'),_0xd6fa('0x64'),_0xd6fa('0x65'),_0xd6fa('0x66'),_0xd6fa('0x67'),_0xd6fa('0x68'),'createdbyexternalpartyname',_0xd6fa('0x69'),_0xd6fa('0x6a'),_0xd6fa('0x6b'),_0xd6fa('0x6c'),_0xd6fa('0x6d'),_0xd6fa('0x6e'),_0xd6fa('0x6f'),'customeridtype',_0xd6fa('0x70'),_0xd6fa('0x71'),_0xd6fa('0x72'),_0xd6fa('0x73'),_0xd6fa('0x74'),_0xd6fa('0x75'),_0xd6fa('0x76'),_0xd6fa('0x77'),_0xd6fa('0x78'),_0xd6fa('0x79'),_0xd6fa('0x7a'),'kbarticleidname',_0xd6fa('0x7b'),_0xd6fa('0x7c'),_0xd6fa('0x7d'),_0xd6fa('0x7e'),_0xd6fa('0x7f'),_0xd6fa('0x80'),'modifiedon','modifiedonbehalfbyname',_0xd6fa('0x81'),'msdyn_incidenttypename','msdyn_iotalertname',_0xd6fa('0x82'),'onholdtime',_0xd6fa('0x83'),_0xd6fa('0x84'),_0xd6fa('0x85'),_0xd6fa('0x86'),'parentcaseidname','primarycontactidname','primarycontactidyominame',_0xd6fa('0x87'),_0xd6fa('0x88'),_0xd6fa('0x89'),_0xd6fa('0x8a'),_0xd6fa('0x8b'),_0xd6fa('0x8c'),_0xd6fa('0x8d'),'responsiblecontactidyominame',_0xd6fa('0x8e'),_0xd6fa('0x8f'),_0xd6fa('0x90'),_0xd6fa('0x91'),'statecode',_0xd6fa('0x92'),_0xd6fa('0x93'),_0xd6fa('0x94'),_0xd6fa('0x95'),_0xd6fa('0x96'),_0xd6fa('0x97'),_0xd6fa('0x98'),_0xd6fa('0x99')];var _0x3eb4bc=_0x21228c[_0xd6fa('0x9a')](_0x2de312);return db['Dynamics365Account'][_0xd6fa('0x9b')]({'where':{'id':_0x2bbd22[_0xd6fa('0x46')]['id']},'attributes':['id',_0xd6fa('0x9c'),_0xd6fa('0x9d'),_0xd6fa('0x9e'),'tenantId',_0xd6fa('0x9f'),_0xd6fa('0xa0')]})[_0xd6fa('0x25')](handleEntityNotFound(_0x5b6c72,null))['then'](function(_0x46f1aa){if(_0x46f1aa){_0xcd46bd=_0x46f1aa[_0xd6fa('0x9e')];var _0x11203b=_0xcd46bd[_0xd6fa('0xa1')](-0x1);if(_0x11203b==='/'){_0xcd46bd=_0xcd46bd[_0xd6fa('0xa2')](0x0,_0xcd46bd[_0xd6fa('0xa3')](_0x11203b));}_0x4c7691=util[_0xd6fa('0xa4')](_0xd6fa('0xa5'),_0xcd46bd);var _0x5798dd={'method':_0xd6fa('0xa6'),'uri':'https://login.microsoftonline.com/'+_0x46f1aa[_0xd6fa('0xa7')]+_0xd6fa('0xa8'),'form':{'client_id':_0x46f1aa['clientId'],'resource':_0xcd46bd,'username':_0x46f1aa[_0xd6fa('0x9c')],'password':_0x46f1aa[_0xd6fa('0x9d')],'grant_type':_0xd6fa('0x9d'),'client_secret':_0x46f1aa[_0xd6fa('0xa0')]},'json':!![]};return rp(_0x5798dd);}})['then'](function(_0x452a76){_0x533989=_0x452a76[_0xd6fa('0xa9')];var _0x1481f7={'method':_0xd6fa('0xaa'),'uri':encodeURI(_0x4c7691+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x2c677a+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x533989,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1481f7);})[_0xd6fa('0x25')](function(_0x56e1a8){var _0x257f48=_0x56e1a8['value'][0x0];var _0x1f2e2a=_0x257f48[_0xd6fa('0xab')];var _0x4de4b1={'method':_0xd6fa('0xaa'),'uri':_0x4c7691+'EntityDefinitions('+_0x1f2e2a+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xd6fa('0xac')+_0x533989,'If-None-Match':null,'OData-Version':_0xd6fa('0xad')},'json':!![]};return rp(_0x4de4b1);})[_0xd6fa('0x25')](function(_0x726995){_0x3b8cf2=_0x726995;_0xd8f65f=_0x3b8cf2[_0xd6fa('0xae')];_0xd8f65f=_[_0xd6fa('0xaf')](_0xd8f65f,function(_0x5052dd){return!_0x3eb4bc[_0xd6fa('0xb0')](_0x5052dd[_0xd6fa('0xb1')]);});var _0x3de984=[];var _0x36dca7=[];_0xd8f65f['forEach'](function(_0x532ed2){if(_0x532ed2[_0xd6fa('0xb2')]){var _0x5c1513=_0x532ed2[_0xd6fa('0xb2')]['substring'](_0x532ed2[_0xd6fa('0xb2')][_0xd6fa('0xa3')]('.')+0x1);if(_0x5c1513===_0xd6fa('0xb3')){_0x3de984['push'](getSelectList(_0x4c7691,_0x351147,_0x36dca7,_0x3b8cf2[_0xd6fa('0xab')],_0x532ed2[_0xd6fa('0xab')],_0x533989));}}});return Promise['all'](_0x3de984);})[_0xd6fa('0x25')](function(_0x27d38d){_0x16f284=_0x27d38d[0x0];var _0x18cbd1=[];var _0xa85029=[];_0xd8f65f[_0xd6fa('0xb4')](function(_0x2e6b50){if(!_[_0xd6fa('0xb5')](_0x2e6b50[_0xd6fa('0xb2')])){var _0x5ed17d=_0x2e6b50[_0xd6fa('0xb2')][_0xd6fa('0xa2')](_0x2e6b50[_0xd6fa('0xb2')][_0xd6fa('0xa3')]('.')+0x1);if(_0x5ed17d===_0xd6fa('0xb6')){_0x18cbd1[_0xd6fa('0xb7')](getBooleanList(_0x4c7691,_0x351147,_0xa85029,_0x3b8cf2[_0xd6fa('0xab')],_0x2e6b50['MetadataId'],_0x533989));}}});return Promise[_0xd6fa('0xb8')](_0x18cbd1);})['then'](function(_0x26c038){_0x376aad=_0x26c038[0x0];var _0xf2e56b=[];var _0x320c7d=[];_0xd8f65f[_0xd6fa('0xb4')](function(_0x452309){if(_0x452309[_0xd6fa('0xb2')]){var _0x14121c=_0x452309[_0xd6fa('0xb2')][_0xd6fa('0xa2')](_0x452309[_0xd6fa('0xb2')][_0xd6fa('0xa3')]('.')+0x1);if(_0x14121c===_0xd6fa('0xb9')||_0x14121c===_0xd6fa('0xba')||_0x14121c===_0xd6fa('0xbb')||_0x14121c===_0xd6fa('0xbc')||_0x14121c==='MemoAttributeMetadata'||_0x14121c===_0xd6fa('0xbd')||_0x14121c===_0xd6fa('0xbe')||_0x14121c==='EntityNameAttributeMetadata'||_0x14121c===_0xd6fa('0xbf')||_0x14121c===_0xd6fa('0xc0')){_0xf2e56b[_0xd6fa('0xb7')](getInputList(_0x4c7691,_0x351147,_0x14121c,_0x320c7d,_0x3b8cf2[_0xd6fa('0xab')],_0x452309[_0xd6fa('0xab')],_0x533989));}}});return Promise[_0xd6fa('0xb8')](_0xf2e56b);})[_0xd6fa('0x25')](function(_0x51f615){_0x42332d=_0x51f615[0x0];var _0x2c5adb=_0x16f284['concat'](_0x376aad)[_0xd6fa('0x9a')](_0x42332d);var _0x128183={'count':_0x2c5adb[_0xd6fa('0x36')],'rows':_0x2c5adb};return _0x128183;})[_0xd6fa('0x25')](respondWithResult(_0x5b6c72,null))[_0xd6fa('0x44')](function(_0x5ee924){var _0x12bfc9=_0x2bbd22[_0xd6fa('0x31')]['test']?0x1f4:_0x5ee924[_0xd6fa('0xc1')]||0x1f4;logger[_0xd6fa('0x27')](_0x5ee924['stack']);delete _0x5ee924[_0xd6fa('0x28')];if(_0x12bfc9===0x191){_0x12bfc9=0x190;}_0x5b6c72[_0xd6fa('0x1a')](_0x12bfc9)[_0xd6fa('0x29')](_0x2bbd22[_0xd6fa('0x31')][_0xd6fa('0xc2')]?{'message':_0xd6fa('0xc3'),'statusCode':_0x5ee924['statusCode']}:_0x5ee924);});};function getSelectList(_0x5352d3,_0x43c5dc,_0x3624fb,_0x1217a9,_0x10991b,_0xbe782e){var _0x2a1dd9={'method':_0xd6fa('0xaa'),'uri':_0x5352d3+_0xd6fa('0xc4')+_0x1217a9+_0xd6fa('0xc5')+_0x10991b+_0xd6fa('0xc6')+_0xd6fa('0xc7'),'headers':{'Authorization':_0xd6fa('0xac')+_0xbe782e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2a1dd9)['then'](function(_0x22f991){var _0x293ca6=[];var _0x39ae3f=_0x22f991[_0xd6fa('0xc8')]['Options'];_0x39ae3f[_0xd6fa('0xb4')](function(_0x579221){_0x293ca6['push']({'name':_0x579221['Label'][_0xd6fa('0xc9')][_0xd6fa('0xca')],'value':String(_0x579221['Value'])});});var _0x401a16={'id':_0x43c5dc+'_'+_0x22f991[_0xd6fa('0xb1')],'name':_0x22f991[_0xd6fa('0xcb')][_0xd6fa('0xc9')]['Label'],'custom':![],'options':_0x293ca6};_0x3624fb['push'](_0x401a16);return _0x3624fb;});}function getBooleanList(_0x534955,_0x2d0e43,_0x2489df,_0x181418,_0x260909,_0xa9238d){var _0x2d95b0={'method':_0xd6fa('0xaa'),'uri':_0x534955+_0xd6fa('0xc4')+_0x181418+_0xd6fa('0xc5')+_0x260909+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xd6fa('0xac')+_0xa9238d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2d95b0)[_0xd6fa('0x25')](function(_0x3b2bae){var _0x340fab=[];_0x340fab[_0xd6fa('0xb7')]({'name':_0x3b2bae[_0xd6fa('0xc8')][_0xd6fa('0xcc')][_0xd6fa('0xca')][_0xd6fa('0xc9')]['Label'],'value':'true'},{'name':_0x3b2bae[_0xd6fa('0xc8')]['FalseOption'][_0xd6fa('0xca')][_0xd6fa('0xc9')][_0xd6fa('0xca')],'value':_0xd6fa('0xcd')});var _0x10f290={'id':_0x2d0e43+'_'+_0x3b2bae[_0xd6fa('0xb1')],'name':_0x3b2bae[_0xd6fa('0xcb')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x340fab};_0x2489df[_0xd6fa('0xb7')](_0x10f290);return _0x2489df;});}function getInputList(_0x2ed230,_0x52e342,_0x12f7e5,_0x312530,_0x47239d,_0x3f4aef,_0x529339){var _0x4f135e={'method':'GET','uri':_0x2ed230+'EntityDefinitions('+_0x47239d+_0xd6fa('0xc5')+_0x3f4aef+')/Microsoft.Dynamics.CRM.'+_0x12f7e5+_0xd6fa('0xce'),'headers':{'Authorization':'Bearer\x20'+_0x529339,'If-None-Match':null,'OData-Version':_0xd6fa('0xad')},'json':!![]};return rp(_0x4f135e)[_0xd6fa('0x25')](function(_0xe2ff73){var _0x317a13={'id':_0x52e342+'_'+_0xe2ff73['LogicalName'],'name':_0xe2ff73[_0xd6fa('0xcb')][_0xd6fa('0xc9')]?_0xe2ff73['DisplayName']['UserLocalizedLabel']['Label']:_0xe2ff73['LogicalName'],'custom':![],'options':[]};_0x312530['push'](_0x317a13);return _0x312530;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 54e2dd7..d79699a 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x5e709a,_0x1d7975){var _0x57401a=function(_0x27eab5){while(--_0x27eab5){_0x5e709a['push'](_0x5e709a['shift']());}};_0x57401a(++_0x1d7975);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x9c4663,_0x31e198){var _0x54bf62=function(_0x2fbd62){while(--_0x2fbd62){_0x9c4663['push'](_0x9c4663['shift']());}};_0x54bf62(++_0x31e198);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 690f2b1..e5e3a2a 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 _0xd2fe=['options','where','include','map','model','attributes','then','stringify','ShowDynamics365Account','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll'];(function(_0x331096,_0x72b668){var _0x436c5c=function(_0x404dde){while(--_0x404dde){_0x331096['push'](_0x331096['shift']());}};_0x436c5c(++_0x72b668);}(_0xd2fe,0xc3));var _0xed2f=function(_0xaf2425,_0xbb7aa3){_0xaf2425=_0xaf2425-0x0;var _0x1a2890=_0xd2fe[_0xaf2425];return _0x1a2890;};'use strict';var _=require(_0xed2f('0x0'));var util=require(_0xed2f('0x1'));var moment=require(_0xed2f('0x2'));var BPromise=require('bluebird');var rs=require(_0xed2f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xed2f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xed2f('0x5'))(_0xed2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xed2f('0x7'));var client=jayson[_0xed2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x585f87,_0xff894f,_0x44c892){return new BPromise(function(_0x2474f0,_0x264719){return client['request'](_0x585f87,_0x44c892)['then'](function(_0x1d7b08){logger[_0xed2f('0x9')](_0xed2f('0xa'),_0xff894f,_0xed2f('0xb'));logger[_0xed2f('0xc')](_0xed2f('0xd'),_0xff894f,_0xed2f('0xb'),JSON['stringify'](_0x1d7b08));if(_0x1d7b08[_0xed2f('0xe')]){if(_0x1d7b08[_0xed2f('0xe')][_0xed2f('0xf')]===0x1f4){logger[_0xed2f('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0xff894f,_0x1d7b08[_0xed2f('0xe')][_0xed2f('0x10')]);return _0x264719(_0x1d7b08[_0xed2f('0xe')]['message']);}logger[_0xed2f('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0xff894f,_0x1d7b08[_0xed2f('0xe')][_0xed2f('0x10')]);return _0x2474f0(_0x1d7b08[_0xed2f('0xe')][_0xed2f('0x10')]);}else{logger[_0xed2f('0x9')](_0xed2f('0xa'),_0xff894f,_0xed2f('0xb'));_0x2474f0(_0x1d7b08[_0xed2f('0x11')]['message']);}})[_0xed2f('0x12')](function(_0x34dc27){logger[_0xed2f('0xe')](_0xed2f('0xa'),_0xff894f,_0x34dc27);_0x264719(_0x34dc27);});});}exports[_0xed2f('0x13')]=function(_0x1224eb){var _0x423afb=this;return new Promise(function(_0x42ab6a,_0x17de81){return db[_0xed2f('0x14')][_0xed2f('0x15')]({'raw':_0x1224eb[_0xed2f('0x16')]?_0x1224eb[_0xed2f('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1224eb[_0xed2f('0x16')]?_0x1224eb[_0xed2f('0x16')][_0xed2f('0x17')]||null:null,'attributes':_0x1224eb[_0xed2f('0x16')]?_0x1224eb[_0xed2f('0x16')]['attributes']||null:null,'limit':_0x1224eb['options']?_0x1224eb[_0xed2f('0x16')]['limit']||null:null,'include':_0x1224eb['options']?_0x1224eb[_0xed2f('0x16')][_0xed2f('0x18')]?_[_0xed2f('0x19')](_0x1224eb['options'][_0xed2f('0x18')],function(_0x4d706e){return{'model':db[_0x4d706e[_0xed2f('0x1a')]],'as':_0x4d706e['as'],'attributes':_0x4d706e[_0xed2f('0x1b')],'include':_0x4d706e[_0xed2f('0x18')]?_[_0xed2f('0x19')](_0x4d706e[_0xed2f('0x18')],function(_0x116b2d){return{'model':db[_0x116b2d[_0xed2f('0x1a')]],'as':_0x116b2d['as'],'attributes':_0x116b2d[_0xed2f('0x1b')],'include':_0x116b2d['include']?_[_0xed2f('0x19')](_0x116b2d['include'],function(_0xefb524){return{'model':db[_0xefb524['model']],'as':_0xefb524['as'],'attributes':_0xefb524['attributes']};}):[]};}):[]};}):[]:[]})[_0xed2f('0x1c')](function(_0x435648){logger['info'](_0xed2f('0x13'),_0x1224eb);logger[_0xed2f('0xc')](_0xed2f('0x13'),_0x1224eb,JSON[_0xed2f('0x1d')](_0x435648));_0x42ab6a(_0x435648);})[_0xed2f('0x12')](function(_0x201dcf){logger[_0xed2f('0xe')](_0xed2f('0x13'),_0x201dcf[_0xed2f('0x10')],_0x1224eb);_0x17de81(_0x423afb[_0xed2f('0xe')](0x1f4,_0x201dcf['message']));});});};exports[_0xed2f('0x1e')]=function(_0x2a102a){var _0x5611f9=this;return new Promise(function(_0x17ac67,_0x445fa0){return db[_0xed2f('0x14')]['find']({'raw':_0x2a102a['options']?_0x2a102a[_0xed2f('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2a102a[_0xed2f('0x16')]?_0x2a102a['options']['where']||null:null,'attributes':_0x2a102a[_0xed2f('0x16')]?_0x2a102a['options']['attributes']||null:null,'include':_0x2a102a[_0xed2f('0x16')]?_0x2a102a['options'][_0xed2f('0x18')]?_[_0xed2f('0x19')](_0x2a102a[_0xed2f('0x16')][_0xed2f('0x18')],function(_0x47a3ad){return{'model':db[_0x47a3ad[_0xed2f('0x1a')]],'as':_0x47a3ad['as'],'attributes':_0x47a3ad[_0xed2f('0x1b')],'include':_0x47a3ad[_0xed2f('0x18')]?_[_0xed2f('0x19')](_0x47a3ad[_0xed2f('0x18')],function(_0x4e866e){return{'model':db[_0x4e866e[_0xed2f('0x1a')]],'as':_0x4e866e['as'],'attributes':_0x4e866e[_0xed2f('0x1b')],'include':_0x4e866e[_0xed2f('0x18')]?_[_0xed2f('0x19')](_0x4e866e['include'],function(_0x137e9a){return{'model':db[_0x137e9a[_0xed2f('0x1a')]],'as':_0x137e9a['as'],'attributes':_0x137e9a[_0xed2f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xed2f('0x1c')](function(_0x5f24be){logger[_0xed2f('0x9')]('ShowDynamics365Account',_0x2a102a);logger['debug']('ShowDynamics365Account',_0x2a102a,JSON[_0xed2f('0x1d')](_0x5f24be));_0x17ac67(_0x5f24be);})[_0xed2f('0x12')](function(_0x2f9a81){logger[_0xed2f('0xe')]('ShowDynamics365Account',_0x2f9a81[_0xed2f('0x10')],_0x2a102a);_0x445fa0(_0x5611f9['error'](0x1f4,_0x2f9a81[_0xed2f('0x10')]));});});}; \ No newline at end of file +var _0xee83=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Account,\x20%s,\x20%s','message','catch','GetDynamics365Account','options','raw','where','attributes','limit','include','model','ShowDynamics365Account','Dynamics365Account','find','map','lodash','util','moment','bluebird','randomstring'];(function(_0x53d85e,_0x131afb){var _0x4da640=function(_0x3a7895){while(--_0x3a7895){_0x53d85e['push'](_0x53d85e['shift']());}};_0x4da640(++_0x131afb);}(_0xee83,0x13f));var _0x3ee8=function(_0x384ad5,_0x3173be){_0x384ad5=_0x384ad5-0x0;var _0x2423d8=_0xee83[_0x384ad5];return _0x2423d8;};'use strict';var _=require(_0x3ee8('0x0'));var util=require(_0x3ee8('0x1'));var moment=require(_0x3ee8('0x2'));var BPromise=require(_0x3ee8('0x3'));var rs=require(_0x3ee8('0x4'));var fs=require('fs');var Redis=require(_0x3ee8('0x5'));var db=require(_0x3ee8('0x6'))['db'];var utils=require(_0x3ee8('0x7'));var logger=require(_0x3ee8('0x8'))('rpc');var config=require(_0x3ee8('0x9'));var jayson=require(_0x3ee8('0xa'));var client=jayson[_0x3ee8('0xb')][_0x3ee8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x572c88,_0x5c3d0f,_0x2b4b9a){return new BPromise(function(_0x49f3de,_0x30e343){return client[_0x3ee8('0xd')](_0x572c88,_0x2b4b9a)[_0x3ee8('0xe')](function(_0x40850a){logger[_0x3ee8('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x5c3d0f,_0x3ee8('0x10'));logger[_0x3ee8('0x11')](_0x3ee8('0x12'),_0x5c3d0f,_0x3ee8('0x10'),JSON[_0x3ee8('0x13')](_0x40850a));if(_0x40850a[_0x3ee8('0x14')]){if(_0x40850a[_0x3ee8('0x14')]['code']===0x1f4){logger[_0x3ee8('0x14')](_0x3ee8('0x15'),_0x5c3d0f,_0x40850a[_0x3ee8('0x14')]['message']);return _0x30e343(_0x40850a[_0x3ee8('0x14')][_0x3ee8('0x16')]);}logger[_0x3ee8('0x14')](_0x3ee8('0x15'),_0x5c3d0f,_0x40850a[_0x3ee8('0x14')][_0x3ee8('0x16')]);return _0x49f3de(_0x40850a[_0x3ee8('0x14')][_0x3ee8('0x16')]);}else{logger[_0x3ee8('0xf')](_0x3ee8('0x15'),_0x5c3d0f,_0x3ee8('0x10'));_0x49f3de(_0x40850a['result']['message']);}})[_0x3ee8('0x17')](function(_0x20ce69){logger[_0x3ee8('0x14')](_0x3ee8('0x15'),_0x5c3d0f,_0x20ce69);_0x30e343(_0x20ce69);});});}exports[_0x3ee8('0x18')]=function(_0x40d918){var _0x19f0b3=this;return new Promise(function(_0x5de032,_0x2a647a){return db['Dynamics365Account']['findAll']({'raw':_0x40d918[_0x3ee8('0x19')]?_0x40d918['options'][_0x3ee8('0x1a')]===undefined?!![]:![]:!![],'where':_0x40d918[_0x3ee8('0x19')]?_0x40d918[_0x3ee8('0x19')][_0x3ee8('0x1b')]||null:null,'attributes':_0x40d918[_0x3ee8('0x19')]?_0x40d918[_0x3ee8('0x19')][_0x3ee8('0x1c')]||null:null,'limit':_0x40d918[_0x3ee8('0x19')]?_0x40d918['options'][_0x3ee8('0x1d')]||null:null,'include':_0x40d918[_0x3ee8('0x19')]?_0x40d918[_0x3ee8('0x19')][_0x3ee8('0x1e')]?_['map'](_0x40d918[_0x3ee8('0x19')][_0x3ee8('0x1e')],function(_0x39ba19){return{'model':db[_0x39ba19[_0x3ee8('0x1f')]],'as':_0x39ba19['as'],'attributes':_0x39ba19[_0x3ee8('0x1c')],'include':_0x39ba19[_0x3ee8('0x1e')]?_['map'](_0x39ba19[_0x3ee8('0x1e')],function(_0xd78b49){return{'model':db[_0xd78b49['model']],'as':_0xd78b49['as'],'attributes':_0xd78b49[_0x3ee8('0x1c')],'include':_0xd78b49[_0x3ee8('0x1e')]?_['map'](_0xd78b49[_0x3ee8('0x1e')],function(_0x5912da){return{'model':db[_0x5912da[_0x3ee8('0x1f')]],'as':_0x5912da['as'],'attributes':_0x5912da['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x55cd44){logger[_0x3ee8('0xf')](_0x3ee8('0x18'),_0x40d918);logger[_0x3ee8('0x11')]('GetDynamics365Account',_0x40d918,JSON[_0x3ee8('0x13')](_0x55cd44));_0x5de032(_0x55cd44);})[_0x3ee8('0x17')](function(_0x569d6c){logger['error'](_0x3ee8('0x18'),_0x569d6c['message'],_0x40d918);_0x2a647a(_0x19f0b3[_0x3ee8('0x14')](0x1f4,_0x569d6c[_0x3ee8('0x16')]));});});};exports[_0x3ee8('0x20')]=function(_0xc6b5da){var _0x547669=this;return new Promise(function(_0xf4c5a,_0xc033ff){return db[_0x3ee8('0x21')][_0x3ee8('0x22')]({'raw':_0xc6b5da['options']?_0xc6b5da[_0x3ee8('0x19')][_0x3ee8('0x1a')]===undefined?!![]:![]:!![],'where':_0xc6b5da[_0x3ee8('0x19')]?_0xc6b5da[_0x3ee8('0x19')]['where']||null:null,'attributes':_0xc6b5da[_0x3ee8('0x19')]?_0xc6b5da['options'][_0x3ee8('0x1c')]||null:null,'include':_0xc6b5da[_0x3ee8('0x19')]?_0xc6b5da['options'][_0x3ee8('0x1e')]?_[_0x3ee8('0x23')](_0xc6b5da[_0x3ee8('0x19')][_0x3ee8('0x1e')],function(_0x5bec4e){return{'model':db[_0x5bec4e[_0x3ee8('0x1f')]],'as':_0x5bec4e['as'],'attributes':_0x5bec4e[_0x3ee8('0x1c')],'include':_0x5bec4e[_0x3ee8('0x1e')]?_[_0x3ee8('0x23')](_0x5bec4e['include'],function(_0x37202d){return{'model':db[_0x37202d[_0x3ee8('0x1f')]],'as':_0x37202d['as'],'attributes':_0x37202d[_0x3ee8('0x1c')],'include':_0x37202d[_0x3ee8('0x1e')]?_['map'](_0x37202d[_0x3ee8('0x1e')],function(_0x5ef285){return{'model':db[_0x5ef285[_0x3ee8('0x1f')]],'as':_0x5ef285['as'],'attributes':_0x5ef285['attributes']};}):[]};}):[]};}):[]:[]})[_0x3ee8('0xe')](function(_0x3ab90b){logger[_0x3ee8('0xf')]('ShowDynamics365Account',_0xc6b5da);logger[_0x3ee8('0x11')](_0x3ee8('0x20'),_0xc6b5da,JSON['stringify'](_0x3ab90b));_0xf4c5a(_0x3ab90b);})[_0x3ee8('0x17')](function(_0x3898a8){logger[_0x3ee8('0x14')](_0x3ee8('0x20'),_0x3898a8[_0x3ee8('0x16')],_0xc6b5da);_0xc033ff(_0x547669[_0x3ee8('0x14')](0x1f4,_0x3898a8[_0x3ee8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index bb3a18a..7690a78 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 _0xe1e8=['/:id','update','delete','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','getFields','/:id/descriptions','getDescriptions','post','create','put'];(function(_0x34bb82,_0x1dda2f){var _0x548b1b=function(_0x4b30df){while(--_0x4b30df){_0x34bb82['push'](_0x34bb82['shift']());}};_0x548b1b(++_0x1dda2f);}(_0xe1e8,0x1cb));var _0x8e1e=function(_0x91c27e,_0x4438a0){_0x91c27e=_0x91c27e-0x0;var _0x336c12=_0xe1e8[_0x91c27e];return _0x336c12;};'use strict';var multer=require(_0x8e1e('0x0'));var util=require('util');var path=require(_0x8e1e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8e1e('0x2')]();var fs_extra=require(_0x8e1e('0x3'));var auth=require(_0x8e1e('0x4'));var interaction=require(_0x8e1e('0x5'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0x8e1e('0x6')]('/',auth[_0x8e1e('0x7')](),controller[_0x8e1e('0x8')]);router[_0x8e1e('0x6')]('/:id',auth[_0x8e1e('0x7')](),controller[_0x8e1e('0x9')]);router[_0x8e1e('0x6')]('/:id/fields',auth['isAuthenticated'](),controller[_0x8e1e('0xa')]);router[_0x8e1e('0x6')]('/:id/subjects',auth[_0x8e1e('0x7')](),controller['getSubjects']);router[_0x8e1e('0x6')](_0x8e1e('0xb'),auth[_0x8e1e('0x7')](),controller[_0x8e1e('0xc')]);router[_0x8e1e('0xd')]('/',auth['isAuthenticated'](),controller[_0x8e1e('0xe')]);router[_0x8e1e('0xf')](_0x8e1e('0x10'),auth['isAuthenticated'](),controller[_0x8e1e('0x11')]);router[_0x8e1e('0x12')](_0x8e1e('0x10'),auth[_0x8e1e('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8316=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','/:id/fields'];(function(_0x34bb12,_0x4e9455){var _0x39be5b=function(_0x25970c){while(--_0x25970c){_0x34bb12['push'](_0x34bb12['shift']());}};_0x39be5b(++_0x4e9455);}(_0x8316,0x137));var _0x6831=function(_0x26d1c4,_0x23ed43){_0x26d1c4=_0x26d1c4-0x0;var _0x40668a=_0x8316[_0x26d1c4];return _0x40668a;};'use strict';var multer=require('multer');var util=require(_0x6831('0x0'));var path=require(_0x6831('0x1'));var timeout=require(_0x6831('0x2'));var express=require(_0x6831('0x3'));var router=express[_0x6831('0x4')]();var fs_extra=require(_0x6831('0x5'));var auth=require(_0x6831('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6831('0x7'));var controller=require(_0x6831('0x8'));router[_0x6831('0x9')]('/',auth[_0x6831('0xa')](),controller['index']);router[_0x6831('0x9')](_0x6831('0xb'),auth[_0x6831('0xa')](),controller[_0x6831('0xc')]);router['get'](_0x6831('0xd'),auth[_0x6831('0xa')](),controller[_0x6831('0xe')]);router[_0x6831('0x9')](_0x6831('0xf'),auth['isAuthenticated'](),controller[_0x6831('0x10')]);router[_0x6831('0x9')](_0x6831('0x11'),auth[_0x6831('0xa')](),controller[_0x6831('0x12')]);router[_0x6831('0x13')]('/',auth['isAuthenticated'](),controller[_0x6831('0x14')]);router['put'](_0x6831('0xb'),auth[_0x6831('0xa')](),controller[_0x6831('0x15')]);router[_0x6831('0x16')]('/:id',auth[_0x6831('0xa')](),controller[_0x6831('0x17')]);module[_0x6831('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 6613153..9d4ecb0 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 _0xe8f6=['contact','nothing','sequelize','STRING','phonecall','ENUM'];(function(_0x2ad810,_0x1ae361){var _0x1f6431=function(_0x2e43dd){while(--_0x2e43dd){_0x2ad810['push'](_0x2ad810['shift']());}};_0x1f6431(++_0x1ae361);}(_0xe8f6,0x170));var _0x6e8f=function(_0x48f49d,_0x4c3999){_0x48f49d=_0x48f49d-0x0;var _0x487ef8=_0xe8f6[_0x48f49d];return _0x487ef8;};'use strict';var Sequelize=require(_0x6e8f('0x0'));module['exports']={'name':{'type':Sequelize[_0x6e8f('0x1')]},'description':{'type':Sequelize[_0x6e8f('0x1')]},'ticketType':{'type':Sequelize['ENUM']('incident',_0x6e8f('0x2')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x6e8f('0x3')](_0x6e8f('0x4'),_0x6e8f('0x5')),'defaultValue':_0x6e8f('0x4'),'allowNull':![]}}; \ No newline at end of file +var _0xa5fe=['contact','nothing','sequelize','exports','STRING','ENUM','phonecall'];(function(_0x290904,_0xbe0132){var _0x507945=function(_0x652d9c){while(--_0x652d9c){_0x290904['push'](_0x290904['shift']());}};_0x507945(++_0xbe0132);}(_0xa5fe,0x191));var _0xea5f=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0xa5fe[_0x20a558];return _0x53d3f7;};'use strict';var Sequelize=require(_0xea5f('0x0'));module[_0xea5f('0x1')]={'name':{'type':Sequelize[_0xea5f('0x2')]},'description':{'type':Sequelize[_0xea5f('0x2')]},'ticketType':{'type':Sequelize[_0xea5f('0x3')]('incident',_0xea5f('0x4')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize['ENUM'](_0xea5f('0x5'),_0xea5f('0x6')),'defaultValue':_0xea5f('0x5'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 2dc523c..46c184d 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 _0x3fef=['includeAll','catch','create','body','update','find','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','undefined','count','offset','set','reject','save','then','stack','name','send','index','map','fieldName','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','rows','params','keys','Dynamics365Configuration','rawAttributes','fields'];(function(_0x22ad22,_0xeaecab){var _0x4d4be9=function(_0xbac7e1){while(--_0xbac7e1){_0x22ad22['push'](_0x22ad22['shift']());}};_0x4d4be9(++_0xeaecab);}(_0x3fef,0xa7));var _0xf3fe=function(_0x26c728,_0x4066db){_0x26c728=_0x26c728-0x0;var _0x5b7b9d=_0x3fef[_0x26c728];return _0x5b7b9d;};'use strict';var emlformat=require(_0xf3fe('0x0'));var rimraf=require(_0xf3fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf3fe('0x2'));var moment=require(_0xf3fe('0x3'));var BPromise=require(_0xf3fe('0x4'));var Mustache=require(_0xf3fe('0x5'));var util=require(_0xf3fe('0x6'));var path=require(_0xf3fe('0x7'));var sox=require(_0xf3fe('0x8'));var csv=require(_0xf3fe('0x9'));var ejs=require(_0xf3fe('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf3fe('0xb'));var squel=require(_0xf3fe('0xc'));var crypto=require(_0xf3fe('0xd'));var jsforce=require(_0xf3fe('0xe'));var deskjs=require(_0xf3fe('0xf'));var toCsv=require(_0xf3fe('0x9'));var querystring=require('querystring');var Papa=require(_0xf3fe('0x10'));var Redis=require(_0xf3fe('0x11'));var authService=require(_0xf3fe('0x12'));var qs=require(_0xf3fe('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf3fe('0x14'));var logger=require(_0xf3fe('0x15'))(_0xf3fe('0x16'));var utils=require(_0xf3fe('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41038a,_0x2a7bd3){_0x2a7bd3=_0x2a7bd3||0xcc;return function(_0x2954e2){if(_0x2954e2){return _0x41038a[_0xf3fe('0x18')](_0x2a7bd3);}return _0x41038a['status'](_0x2a7bd3)[_0xf3fe('0x19')]();};}function respondWithResult(_0x20a95e,_0x6a043a){_0x6a043a=_0x6a043a||0xc8;return function(_0x3917a3){if(_0x3917a3){return _0x20a95e[_0xf3fe('0x1a')](_0x6a043a)[_0xf3fe('0x1b')](_0x3917a3);}};}function respondWithFilteredResult(_0x57e00c,_0x4d18ad){return function(_0x45cb38){if(_0x45cb38){var _0x46c8d6=typeof _0x4d18ad['offset']===_0xf3fe('0x1c')&&typeof _0x4d18ad['limit']===_0xf3fe('0x1c');var _0x2ed79a=_0x45cb38[_0xf3fe('0x1d')];var _0x51b4f9=_0x46c8d6?0x0:_0x4d18ad[_0xf3fe('0x1e')];var _0x534c58=_0x46c8d6?_0x45cb38['count']:_0x4d18ad[_0xf3fe('0x1e')]+_0x4d18ad['limit'];var _0x5867fc;if(_0x534c58>=_0x2ed79a){_0x534c58=_0x2ed79a;_0x5867fc=0xc8;}else{_0x5867fc=0xce;}_0x57e00c[_0xf3fe('0x1a')](_0x5867fc);return _0x57e00c[_0xf3fe('0x1f')]('Content-Range',_0x51b4f9+'-'+_0x534c58+'/'+_0x2ed79a)['json'](_0x45cb38);}return null;};}function patchUpdates(_0x115499){return function(_0x25f717){try{jsonpatch['apply'](_0x25f717,_0x115499,!![]);}catch(_0x41b7ad){return BPromise[_0xf3fe('0x20')](_0x41b7ad);}return _0x25f717[_0xf3fe('0x21')]();};}function saveUpdates(_0x12c3b0,_0x103b43){return function(_0x2dfa38){if(_0x2dfa38){return _0x2dfa38['update'](_0x12c3b0)['then'](function(_0x414575){return _0x414575;});}return null;};}function removeEntity(_0x27eee0,_0x3cbee9){return function(_0x46f7ff){if(_0x46f7ff){return _0x46f7ff['destroy']()[_0xf3fe('0x22')](function(){_0x27eee0[_0xf3fe('0x1a')](0xcc)[_0xf3fe('0x19')]();});}};}function handleEntityNotFound(_0x324de6,_0xf2dc81){return function(_0x2b4bee){if(!_0x2b4bee){_0x324de6[_0xf3fe('0x18')](0x194);}return _0x2b4bee;};}function handleError(_0x4071c3,_0x57c015){_0x57c015=_0x57c015||0x1f4;return function(_0x253f2e){logger['error'](_0x253f2e[_0xf3fe('0x23')]);if(_0x253f2e[_0xf3fe('0x24')]){delete _0x253f2e['name'];}_0x4071c3[_0xf3fe('0x1a')](_0x57c015)[_0xf3fe('0x25')](_0x253f2e);};}exports[_0xf3fe('0x26')]=function(_0x52c10c,_0x555931){var _0x9da13e={},_0x4bdc6a={},_0x24e709={'count':0x0,'rows':[]};var _0x113ec2=_[_0xf3fe('0x27')](db['Dynamics365Configuration']['rawAttributes'],function(_0x23003c){return{'name':_0x23003c[_0xf3fe('0x28')],'type':_0x23003c['type'][_0xf3fe('0x29')]};});_0x4bdc6a[_0xf3fe('0x2a')]=_[_0xf3fe('0x27')](_0x113ec2,_0xf3fe('0x24'));_0x4bdc6a[_0xf3fe('0x2b')]=_['keys'](_0x52c10c['query']);_0x4bdc6a['filters']=_[_0xf3fe('0x2c')](_0x4bdc6a[_0xf3fe('0x2a')],_0x4bdc6a[_0xf3fe('0x2b')]);_0x9da13e['attributes']=_['intersection'](_0x4bdc6a[_0xf3fe('0x2a')],qs['fields'](_0x52c10c['query']['fields']));_0x9da13e[_0xf3fe('0x2d')]=_0x9da13e[_0xf3fe('0x2d')][_0xf3fe('0x2e')]?_0x9da13e[_0xf3fe('0x2d')]:_0x4bdc6a[_0xf3fe('0x2a')];if(!_0x52c10c[_0xf3fe('0x2b')][_0xf3fe('0x2f')](_0xf3fe('0x30'))){_0x9da13e[_0xf3fe('0x31')]=qs[_0xf3fe('0x31')](_0x52c10c[_0xf3fe('0x2b')]['limit']);_0x9da13e[_0xf3fe('0x1e')]=qs[_0xf3fe('0x1e')](_0x52c10c[_0xf3fe('0x2b')][_0xf3fe('0x1e')]);}_0x9da13e[_0xf3fe('0x32')]=qs[_0xf3fe('0x33')](_0x52c10c['query'][_0xf3fe('0x33')]);_0x9da13e[_0xf3fe('0x34')]=qs[_0xf3fe('0x35')](_[_0xf3fe('0x36')](_0x52c10c[_0xf3fe('0x2b')],_0x4bdc6a[_0xf3fe('0x35')]),_0x113ec2);if(_0x52c10c['query'][_0xf3fe('0x37')]){_0x9da13e[_0xf3fe('0x34')]=_[_0xf3fe('0x38')](_0x9da13e[_0xf3fe('0x34')],{'$or':_[_0xf3fe('0x27')](_0x113ec2,function(_0x569c6f){if(_0x569c6f[_0xf3fe('0x39')]!==_0xf3fe('0x3a')){var _0xfa2841={};_0xfa2841[_0x569c6f[_0xf3fe('0x24')]]={'$like':'%'+_0x52c10c[_0xf3fe('0x2b')][_0xf3fe('0x37')]+'%'};return _0xfa2841;}})});}_0x9da13e=_[_0xf3fe('0x38')]({},_0x9da13e,_0x52c10c[_0xf3fe('0x3b')]);var _0x527719={'where':_0x9da13e[_0xf3fe('0x34')]};return db['Dynamics365Configuration'][_0xf3fe('0x1d')](_0x527719)['then'](function(_0x4df148){_0x24e709[_0xf3fe('0x1d')]=_0x4df148;if(_0x52c10c[_0xf3fe('0x2b')]['includeAll']){_0x9da13e[_0xf3fe('0x3c')]=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x9da13e);})[_0xf3fe('0x22')](function(_0x57a4d2){_0x24e709[_0xf3fe('0x3d')]=_0x57a4d2;return _0x24e709;})[_0xf3fe('0x22')](respondWithFilteredResult(_0x555931,_0x9da13e))['catch'](handleError(_0x555931,null));};exports['show']=function(_0xfdc5fb,_0xf540e2){var _0x112342={'raw':![],'where':{'id':_0xfdc5fb[_0xf3fe('0x3e')]['id']}},_0x50f775={};_0x50f775['model']=_[_0xf3fe('0x3f')](db[_0xf3fe('0x40')][_0xf3fe('0x41')]);_0x50f775[_0xf3fe('0x2b')]=_[_0xf3fe('0x3f')](_0xfdc5fb[_0xf3fe('0x2b')]);_0x50f775[_0xf3fe('0x35')]=_[_0xf3fe('0x2c')](_0x50f775[_0xf3fe('0x2a')],_0x50f775['query']);_0x112342[_0xf3fe('0x2d')]=_[_0xf3fe('0x2c')](_0x50f775[_0xf3fe('0x2a')],qs[_0xf3fe('0x42')](_0xfdc5fb[_0xf3fe('0x2b')]['fields']));_0x112342[_0xf3fe('0x2d')]=_0x112342['attributes'][_0xf3fe('0x2e')]?_0x112342['attributes']:_0x50f775[_0xf3fe('0x2a')];if(_0xfdc5fb[_0xf3fe('0x2b')][_0xf3fe('0x43')]){_0x112342[_0xf3fe('0x3c')]=[{'all':!![]}];}_0x112342=_[_0xf3fe('0x38')]({},_0x112342,_0xfdc5fb[_0xf3fe('0x3b')]);return db['Dynamics365Configuration']['find'](_0x112342)['then'](handleEntityNotFound(_0xf540e2,null))['then'](respondWithResult(_0xf540e2,null))[_0xf3fe('0x44')](handleError(_0xf540e2,null));};exports[_0xf3fe('0x45')]=function(_0x4a676d,_0xbe5a1d){return db['Dynamics365Configuration'][_0xf3fe('0x45')](_0x4a676d[_0xf3fe('0x46')],{})[_0xf3fe('0x22')](respondWithResult(_0xbe5a1d,0xc9))['catch'](handleError(_0xbe5a1d,null));};exports[_0xf3fe('0x47')]=function(_0x2d6c7b,_0x758266){if(_0x2d6c7b[_0xf3fe('0x46')]['id']){delete _0x2d6c7b[_0xf3fe('0x46')]['id'];}return db[_0xf3fe('0x40')][_0xf3fe('0x48')]({'where':{'id':_0x2d6c7b[_0xf3fe('0x3e')]['id']}})[_0xf3fe('0x22')](handleEntityNotFound(_0x758266,null))[_0xf3fe('0x22')](saveUpdates(_0x2d6c7b[_0xf3fe('0x46')],null))['then'](respondWithResult(_0x758266,null))['catch'](handleError(_0x758266,null));};exports['destroy']=function(_0x19d5ee,_0x2f207c){return db[_0xf3fe('0x40')]['find']({'where':{'id':_0x19d5ee[_0xf3fe('0x3e')]['id']}})[_0xf3fe('0x22')](handleEntityNotFound(_0x2f207c,null))['then'](removeEntity(_0x2f207c,null))[_0xf3fe('0x44')](handleError(_0x2f207c,null));};exports[_0xf3fe('0x49')]=function(_0x32ac08,_0x5b1248,_0x3f95a3){var _0x55ee8d={};var _0x58a850={};var _0x40d20f;var _0x495eeb;return db[_0xf3fe('0x40')][_0xf3fe('0x4a')]({'where':{'id':_0x32ac08[_0xf3fe('0x3e')]['id']}})[_0xf3fe('0x22')](handleEntityNotFound(_0x5b1248,null))['then'](function(_0x43be80){if(_0x43be80){_0x40d20f=_0x43be80;_0x58a850[_0xf3fe('0x2a')]=_['keys'](db[_0xf3fe('0x4b')][_0xf3fe('0x41')]);_0x58a850[_0xf3fe('0x2b')]=_['keys'](_0x32ac08[_0xf3fe('0x2b')]);_0x58a850[_0xf3fe('0x35')]=_[_0xf3fe('0x2c')](_0x58a850[_0xf3fe('0x2a')],_0x58a850['query']);_0x55ee8d[_0xf3fe('0x2d')]=_[_0xf3fe('0x2c')](_0x58a850['model'],qs[_0xf3fe('0x42')](_0x32ac08[_0xf3fe('0x2b')][_0xf3fe('0x42')]));_0x55ee8d[_0xf3fe('0x2d')]=_0x55ee8d['attributes']['length']?_0x55ee8d[_0xf3fe('0x2d')]:_0x58a850[_0xf3fe('0x2a')];_0x55ee8d[_0xf3fe('0x32')]=qs['sort'](_0x32ac08[_0xf3fe('0x2b')][_0xf3fe('0x33')]);_0x55ee8d['where']=qs[_0xf3fe('0x35')](_[_0xf3fe('0x36')](_0x32ac08['query'],_0x58a850[_0xf3fe('0x35')]));if(_0x32ac08[_0xf3fe('0x2b')]['filter']){_0x55ee8d['where']=_[_0xf3fe('0x38')](_0x55ee8d[_0xf3fe('0x34')],{'$or':_[_0xf3fe('0x27')](_0x55ee8d[_0xf3fe('0x2d')],function(_0x168645){var _0x57773b={};_0x57773b[_0x168645]={'$like':'%'+_0x32ac08[_0xf3fe('0x2b')][_0xf3fe('0x37')]+'%'};return _0x57773b;})});}_0x55ee8d=_[_0xf3fe('0x38')]({},_0x55ee8d,_0x32ac08[_0xf3fe('0x3b')]);return _0x40d20f[_0xf3fe('0x49')](_0x55ee8d);}})[_0xf3fe('0x22')](function(_0x16604d){if(_0x16604d){_0x495eeb=_0x16604d[_0xf3fe('0x2e')];if(!_0x32ac08[_0xf3fe('0x2b')][_0xf3fe('0x2f')](_0xf3fe('0x30'))){_0x55ee8d['limit']=qs[_0xf3fe('0x31')](_0x32ac08[_0xf3fe('0x2b')][_0xf3fe('0x31')]);_0x55ee8d['offset']=qs[_0xf3fe('0x1e')](_0x32ac08['query']['offset']);}return _0x40d20f['getFields'](_0x55ee8d);}})[_0xf3fe('0x22')](function(_0x46d58d){if(_0x46d58d){return _0x46d58d?{'count':_0x495eeb,'rows':_0x46d58d}:null;}})[_0xf3fe('0x22')](respondWithResult(_0x5b1248,null))[_0xf3fe('0x44')](handleError(_0x5b1248,null));};exports['getSubjects']=function(_0x53f90c,_0x331825,_0x17d7f5){var _0x5a9de6={};var _0x57820f={};var _0x3831ea;var _0x5491f6;return db['Dynamics365Configuration'][_0xf3fe('0x4a')]({'where':{'id':_0x53f90c[_0xf3fe('0x3e')]['id']}})[_0xf3fe('0x22')](handleEntityNotFound(_0x331825,null))[_0xf3fe('0x22')](function(_0x5724ce){if(_0x5724ce){_0x3831ea=_0x5724ce;_0x57820f['model']=_[_0xf3fe('0x3f')](db[_0xf3fe('0x4b')][_0xf3fe('0x41')]);_0x57820f[_0xf3fe('0x2b')]=_[_0xf3fe('0x3f')](_0x53f90c[_0xf3fe('0x2b')]);_0x57820f[_0xf3fe('0x35')]=_['intersection'](_0x57820f['model'],_0x57820f['query']);_0x5a9de6[_0xf3fe('0x2d')]=_[_0xf3fe('0x2c')](_0x57820f[_0xf3fe('0x2a')],qs['fields'](_0x53f90c['query']['fields']));_0x5a9de6['attributes']=_0x5a9de6[_0xf3fe('0x2d')][_0xf3fe('0x2e')]?_0x5a9de6[_0xf3fe('0x2d')]:_0x57820f[_0xf3fe('0x2a')];_0x5a9de6['order']=qs[_0xf3fe('0x33')](_0x53f90c[_0xf3fe('0x2b')][_0xf3fe('0x33')]);_0x5a9de6[_0xf3fe('0x34')]=qs[_0xf3fe('0x35')](_['pick'](_0x53f90c['query'],_0x57820f[_0xf3fe('0x35')]));if(_0x53f90c[_0xf3fe('0x2b')][_0xf3fe('0x37')]){_0x5a9de6['where']=_['merge'](_0x5a9de6['where'],{'$or':_[_0xf3fe('0x27')](_0x5a9de6[_0xf3fe('0x2d')],function(_0x33c5d3){var _0x42219b={};_0x42219b[_0x33c5d3]={'$like':'%'+_0x53f90c['query'][_0xf3fe('0x37')]+'%'};return _0x42219b;})});}_0x5a9de6=_[_0xf3fe('0x38')]({},_0x5a9de6,_0x53f90c[_0xf3fe('0x3b')]);return _0x3831ea[_0xf3fe('0x4c')](_0x5a9de6);}})[_0xf3fe('0x22')](function(_0x8da854){if(_0x8da854){_0x5491f6=_0x8da854[_0xf3fe('0x2e')];if(!_0x53f90c[_0xf3fe('0x2b')][_0xf3fe('0x2f')](_0xf3fe('0x30'))){_0x5a9de6[_0xf3fe('0x31')]=qs['limit'](_0x53f90c[_0xf3fe('0x2b')]['limit']);_0x5a9de6[_0xf3fe('0x1e')]=qs['offset'](_0x53f90c[_0xf3fe('0x2b')][_0xf3fe('0x1e')]);}return _0x3831ea[_0xf3fe('0x4c')](_0x5a9de6);}})[_0xf3fe('0x22')](function(_0x350416){if(_0x350416){return _0x350416?{'count':_0x5491f6,'rows':_0x350416}:null;}})[_0xf3fe('0x22')](respondWithResult(_0x331825,null))['catch'](handleError(_0x331825,null));};exports['getDescriptions']=function(_0x48b8ed,_0x319934,_0x211866){var _0xb76f8f={};var _0x39e6d2={};var _0xd44865;var _0x5a0a39;return db[_0xf3fe('0x40')][_0xf3fe('0x4a')]({'where':{'id':_0x48b8ed['params']['id']}})[_0xf3fe('0x22')](handleEntityNotFound(_0x319934,null))['then'](function(_0x50166){if(_0x50166){_0xd44865=_0x50166;_0x39e6d2['model']=_[_0xf3fe('0x3f')](db['Dynamics365Field'][_0xf3fe('0x41')]);_0x39e6d2[_0xf3fe('0x2b')]=_['keys'](_0x48b8ed[_0xf3fe('0x2b')]);_0x39e6d2[_0xf3fe('0x35')]=_['intersection'](_0x39e6d2[_0xf3fe('0x2a')],_0x39e6d2[_0xf3fe('0x2b')]);_0xb76f8f['attributes']=_[_0xf3fe('0x2c')](_0x39e6d2[_0xf3fe('0x2a')],qs[_0xf3fe('0x42')](_0x48b8ed[_0xf3fe('0x2b')]['fields']));_0xb76f8f[_0xf3fe('0x2d')]=_0xb76f8f['attributes'][_0xf3fe('0x2e')]?_0xb76f8f[_0xf3fe('0x2d')]:_0x39e6d2[_0xf3fe('0x2a')];_0xb76f8f[_0xf3fe('0x32')]=qs['sort'](_0x48b8ed[_0xf3fe('0x2b')][_0xf3fe('0x33')]);_0xb76f8f[_0xf3fe('0x34')]=qs['filters'](_[_0xf3fe('0x36')](_0x48b8ed['query'],_0x39e6d2[_0xf3fe('0x35')]));if(_0x48b8ed[_0xf3fe('0x2b')]['filter']){_0xb76f8f[_0xf3fe('0x34')]=_['merge'](_0xb76f8f[_0xf3fe('0x34')],{'$or':_[_0xf3fe('0x27')](_0xb76f8f[_0xf3fe('0x2d')],function(_0x3fd5dc){var _0x52555a={};_0x52555a[_0x3fd5dc]={'$like':'%'+_0x48b8ed[_0xf3fe('0x2b')][_0xf3fe('0x37')]+'%'};return _0x52555a;})});}_0xb76f8f=_[_0xf3fe('0x38')]({},_0xb76f8f,_0x48b8ed['options']);return _0xd44865[_0xf3fe('0x4d')](_0xb76f8f);}})[_0xf3fe('0x22')](function(_0x587e27){if(_0x587e27){_0x5a0a39=_0x587e27[_0xf3fe('0x2e')];if(!_0x48b8ed[_0xf3fe('0x2b')]['hasOwnProperty'](_0xf3fe('0x30'))){_0xb76f8f[_0xf3fe('0x31')]=qs[_0xf3fe('0x31')](_0x48b8ed[_0xf3fe('0x2b')][_0xf3fe('0x31')]);_0xb76f8f['offset']=qs[_0xf3fe('0x1e')](_0x48b8ed[_0xf3fe('0x2b')][_0xf3fe('0x1e')]);}return _0xd44865['getDescriptions'](_0xb76f8f);}})[_0xf3fe('0x22')](function(_0xf9befa){if(_0xf9befa){return _0xf9befa?{'count':_0x5a0a39,'rows':_0xf9befa}:null;}})[_0xf3fe('0x22')](respondWithResult(_0x319934,null))[_0xf3fe('0x44')](handleError(_0x319934,null));}; \ No newline at end of file +var _0x8c8e=['undefined','count','limit','Content-Range','apply','reject','save','then','destroy','error','name','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','update','body','find','getFields','sort','getSubjects','Dynamics365Field','getDescriptions','findOne','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x5c6403,_0xb08818){var _0x523367=function(_0x4aa786){while(--_0x4aa786){_0x5c6403['push'](_0x5c6403['shift']());}};_0x523367(++_0xb08818);}(_0x8c8e,0xd6));var _0xe8c8=function(_0x2fd0f0,_0x4b634e){_0x2fd0f0=_0x2fd0f0-0x0;var _0x57f71a=_0x8c8e[_0x2fd0f0];return _0x57f71a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe8c8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe8c8('0x1'));var BPromise=require(_0xe8c8('0x2'));var Mustache=require('mustache');var util=require(_0xe8c8('0x3'));var path=require(_0xe8c8('0x4'));var sox=require(_0xe8c8('0x5'));var csv=require(_0xe8c8('0x6'));var ejs=require(_0xe8c8('0x7'));var fs=require('fs');var fs_extra=require(_0xe8c8('0x8'));var _=require(_0xe8c8('0x9'));var squel=require(_0xe8c8('0xa'));var crypto=require(_0xe8c8('0xb'));var jsforce=require(_0xe8c8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe8c8('0x6'));var querystring=require('querystring');var Papa=require(_0xe8c8('0xd'));var Redis=require(_0xe8c8('0xe'));var authService=require(_0xe8c8('0xf'));var qs=require(_0xe8c8('0x10'));var as=require(_0xe8c8('0x11'));var hardwareService=require(_0xe8c8('0x12'));var logger=require(_0xe8c8('0x13'))(_0xe8c8('0x14'));var utils=require('../../config/utils');var config=require(_0xe8c8('0x15'));var licenseUtil=require(_0xe8c8('0x16'));var db=require(_0xe8c8('0x17'))['db'];function respondWithStatusCode(_0x1f7def,_0x3df628){_0x3df628=_0x3df628||0xcc;return function(_0x2431cd){if(_0x2431cd){return _0x1f7def[_0xe8c8('0x18')](_0x3df628);}return _0x1f7def[_0xe8c8('0x19')](_0x3df628)[_0xe8c8('0x1a')]();};}function respondWithResult(_0x781d5f,_0x3f4b13){_0x3f4b13=_0x3f4b13||0xc8;return function(_0x1fda3b){if(_0x1fda3b){return _0x781d5f[_0xe8c8('0x19')](_0x3f4b13)[_0xe8c8('0x1b')](_0x1fda3b);}};}function respondWithFilteredResult(_0x3754a7,_0x12b157){return function(_0x1cccb6){if(_0x1cccb6){var _0x32ba06=typeof _0x12b157[_0xe8c8('0x1c')]===_0xe8c8('0x1d')&&typeof _0x12b157['limit']==='undefined';var _0x515a5b=_0x1cccb6[_0xe8c8('0x1e')];var _0x3cbf9f=_0x32ba06?0x0:_0x12b157['offset'];var _0x43fa21=_0x32ba06?_0x1cccb6[_0xe8c8('0x1e')]:_0x12b157[_0xe8c8('0x1c')]+_0x12b157[_0xe8c8('0x1f')];var _0x1eccaf;if(_0x43fa21>=_0x515a5b){_0x43fa21=_0x515a5b;_0x1eccaf=0xc8;}else{_0x1eccaf=0xce;}_0x3754a7[_0xe8c8('0x19')](_0x1eccaf);return _0x3754a7['set'](_0xe8c8('0x20'),_0x3cbf9f+'-'+_0x43fa21+'/'+_0x515a5b)[_0xe8c8('0x1b')](_0x1cccb6);}return null;};}function patchUpdates(_0xb3f573){return function(_0x5a186b){try{jsonpatch[_0xe8c8('0x21')](_0x5a186b,_0xb3f573,!![]);}catch(_0x260498){return BPromise[_0xe8c8('0x22')](_0x260498);}return _0x5a186b[_0xe8c8('0x23')]();};}function saveUpdates(_0x2dd09a,_0xa373a6){return function(_0x1fec4f){if(_0x1fec4f){return _0x1fec4f['update'](_0x2dd09a)[_0xe8c8('0x24')](function(_0x4701f5){return _0x4701f5;});}return null;};}function removeEntity(_0x415916,_0x62e9bc){return function(_0x3b9516){if(_0x3b9516){return _0x3b9516[_0xe8c8('0x25')]()['then'](function(){_0x415916[_0xe8c8('0x19')](0xcc)[_0xe8c8('0x1a')]();});}};}function handleEntityNotFound(_0x589a48,_0x202e48){return function(_0x3619a0){if(!_0x3619a0){_0x589a48[_0xe8c8('0x18')](0x194);}return _0x3619a0;};}function handleError(_0x53d627,_0x3bb037){_0x3bb037=_0x3bb037||0x1f4;return function(_0x4d86d1){logger[_0xe8c8('0x26')](_0x4d86d1['stack']);if(_0x4d86d1[_0xe8c8('0x27')]){delete _0x4d86d1[_0xe8c8('0x27')];}_0x53d627[_0xe8c8('0x19')](_0x3bb037)['send'](_0x4d86d1);};}exports[_0xe8c8('0x28')]=function(_0x490c9a,_0x4a03b7){var _0x35481d={},_0x4a33d4={},_0x42bf29={'count':0x0,'rows':[]};var _0x39d23d=_[_0xe8c8('0x29')](db[_0xe8c8('0x2a')][_0xe8c8('0x2b')],function(_0x36db22){return{'name':_0x36db22[_0xe8c8('0x2c')],'type':_0x36db22[_0xe8c8('0x2d')][_0xe8c8('0x2e')]};});_0x4a33d4[_0xe8c8('0x2f')]=_[_0xe8c8('0x29')](_0x39d23d,_0xe8c8('0x27'));_0x4a33d4[_0xe8c8('0x30')]=_[_0xe8c8('0x31')](_0x490c9a[_0xe8c8('0x30')]);_0x4a33d4[_0xe8c8('0x32')]=_['intersection'](_0x4a33d4['model'],_0x4a33d4[_0xe8c8('0x30')]);_0x35481d['attributes']=_[_0xe8c8('0x33')](_0x4a33d4[_0xe8c8('0x2f')],qs[_0xe8c8('0x34')](_0x490c9a['query'][_0xe8c8('0x34')]));_0x35481d[_0xe8c8('0x35')]=_0x35481d[_0xe8c8('0x35')]['length']?_0x35481d['attributes']:_0x4a33d4[_0xe8c8('0x2f')];if(!_0x490c9a[_0xe8c8('0x30')][_0xe8c8('0x36')](_0xe8c8('0x37'))){_0x35481d[_0xe8c8('0x1f')]=qs[_0xe8c8('0x1f')](_0x490c9a[_0xe8c8('0x30')][_0xe8c8('0x1f')]);_0x35481d['offset']=qs[_0xe8c8('0x1c')](_0x490c9a[_0xe8c8('0x30')][_0xe8c8('0x1c')]);}_0x35481d[_0xe8c8('0x38')]=qs['sort'](_0x490c9a['query']['sort']);_0x35481d[_0xe8c8('0x39')]=qs[_0xe8c8('0x32')](_[_0xe8c8('0x3a')](_0x490c9a[_0xe8c8('0x30')],_0x4a33d4[_0xe8c8('0x32')]),_0x39d23d);if(_0x490c9a[_0xe8c8('0x30')][_0xe8c8('0x3b')]){_0x35481d[_0xe8c8('0x39')]=_['merge'](_0x35481d[_0xe8c8('0x39')],{'$or':_[_0xe8c8('0x29')](_0x39d23d,function(_0x2c5133){if(_0x2c5133[_0xe8c8('0x2d')]!==_0xe8c8('0x3c')){var _0x7fd487={};_0x7fd487[_0x2c5133['name']]={'$like':'%'+_0x490c9a[_0xe8c8('0x30')][_0xe8c8('0x3b')]+'%'};return _0x7fd487;}})});}_0x35481d=_[_0xe8c8('0x3d')]({},_0x35481d,_0x490c9a[_0xe8c8('0x3e')]);var _0x4ea82c={'where':_0x35481d[_0xe8c8('0x39')]};return db[_0xe8c8('0x2a')][_0xe8c8('0x1e')](_0x4ea82c)[_0xe8c8('0x24')](function(_0x4ea8b4){_0x42bf29[_0xe8c8('0x1e')]=_0x4ea8b4;if(_0x490c9a[_0xe8c8('0x30')][_0xe8c8('0x3f')]){_0x35481d[_0xe8c8('0x40')]=[{'all':!![]}];}return db[_0xe8c8('0x2a')][_0xe8c8('0x41')](_0x35481d);})[_0xe8c8('0x24')](function(_0x2c221c){_0x42bf29[_0xe8c8('0x42')]=_0x2c221c;return _0x42bf29;})[_0xe8c8('0x24')](respondWithFilteredResult(_0x4a03b7,_0x35481d))[_0xe8c8('0x43')](handleError(_0x4a03b7,null));};exports[_0xe8c8('0x44')]=function(_0x7802b3,_0xc5c7ff){var _0x1299e5={'raw':![],'where':{'id':_0x7802b3[_0xe8c8('0x45')]['id']}},_0x3065fc={};_0x3065fc[_0xe8c8('0x2f')]=_[_0xe8c8('0x31')](db['Dynamics365Configuration']['rawAttributes']);_0x3065fc[_0xe8c8('0x30')]=_[_0xe8c8('0x31')](_0x7802b3[_0xe8c8('0x30')]);_0x3065fc[_0xe8c8('0x32')]=_['intersection'](_0x3065fc[_0xe8c8('0x2f')],_0x3065fc[_0xe8c8('0x30')]);_0x1299e5[_0xe8c8('0x35')]=_[_0xe8c8('0x33')](_0x3065fc[_0xe8c8('0x2f')],qs['fields'](_0x7802b3[_0xe8c8('0x30')][_0xe8c8('0x34')]));_0x1299e5[_0xe8c8('0x35')]=_0x1299e5[_0xe8c8('0x35')][_0xe8c8('0x46')]?_0x1299e5[_0xe8c8('0x35')]:_0x3065fc[_0xe8c8('0x2f')];if(_0x7802b3[_0xe8c8('0x30')][_0xe8c8('0x3f')]){_0x1299e5[_0xe8c8('0x40')]=[{'all':!![]}];}_0x1299e5=_[_0xe8c8('0x3d')]({},_0x1299e5,_0x7802b3[_0xe8c8('0x3e')]);return db[_0xe8c8('0x2a')]['find'](_0x1299e5)[_0xe8c8('0x24')](handleEntityNotFound(_0xc5c7ff,null))[_0xe8c8('0x24')](respondWithResult(_0xc5c7ff,null))[_0xe8c8('0x43')](handleError(_0xc5c7ff,null));};exports[_0xe8c8('0x47')]=function(_0x179c51,_0x3709a4){return db[_0xe8c8('0x2a')][_0xe8c8('0x47')](_0x179c51['body'],{})[_0xe8c8('0x24')](respondWithResult(_0x3709a4,0xc9))['catch'](handleError(_0x3709a4,null));};exports[_0xe8c8('0x48')]=function(_0x30c7c3,_0x2bfb92){if(_0x30c7c3[_0xe8c8('0x49')]['id']){delete _0x30c7c3['body']['id'];}return db[_0xe8c8('0x2a')][_0xe8c8('0x4a')]({'where':{'id':_0x30c7c3[_0xe8c8('0x45')]['id']}})['then'](handleEntityNotFound(_0x2bfb92,null))[_0xe8c8('0x24')](saveUpdates(_0x30c7c3['body'],null))[_0xe8c8('0x24')](respondWithResult(_0x2bfb92,null))['catch'](handleError(_0x2bfb92,null));};exports[_0xe8c8('0x25')]=function(_0x33075f,_0x2278d5){return db[_0xe8c8('0x2a')][_0xe8c8('0x4a')]({'where':{'id':_0x33075f[_0xe8c8('0x45')]['id']}})['then'](handleEntityNotFound(_0x2278d5,null))[_0xe8c8('0x24')](removeEntity(_0x2278d5,null))['catch'](handleError(_0x2278d5,null));};exports[_0xe8c8('0x4b')]=function(_0x589054,_0x27d059,_0x5c45d5){var _0x5c5f66={};var _0x136508={};var _0x12c831;var _0x2daffd;return db[_0xe8c8('0x2a')]['findOne']({'where':{'id':_0x589054['params']['id']}})[_0xe8c8('0x24')](handleEntityNotFound(_0x27d059,null))[_0xe8c8('0x24')](function(_0x5eb24b){if(_0x5eb24b){_0x12c831=_0x5eb24b;_0x136508['model']=_[_0xe8c8('0x31')](db['Dynamics365Field']['rawAttributes']);_0x136508[_0xe8c8('0x30')]=_[_0xe8c8('0x31')](_0x589054[_0xe8c8('0x30')]);_0x136508['filters']=_[_0xe8c8('0x33')](_0x136508['model'],_0x136508[_0xe8c8('0x30')]);_0x5c5f66[_0xe8c8('0x35')]=_['intersection'](_0x136508[_0xe8c8('0x2f')],qs[_0xe8c8('0x34')](_0x589054['query'][_0xe8c8('0x34')]));_0x5c5f66[_0xe8c8('0x35')]=_0x5c5f66['attributes'][_0xe8c8('0x46')]?_0x5c5f66['attributes']:_0x136508[_0xe8c8('0x2f')];_0x5c5f66[_0xe8c8('0x38')]=qs[_0xe8c8('0x4c')](_0x589054['query'][_0xe8c8('0x4c')]);_0x5c5f66[_0xe8c8('0x39')]=qs[_0xe8c8('0x32')](_['pick'](_0x589054[_0xe8c8('0x30')],_0x136508['filters']));if(_0x589054[_0xe8c8('0x30')][_0xe8c8('0x3b')]){_0x5c5f66[_0xe8c8('0x39')]=_[_0xe8c8('0x3d')](_0x5c5f66[_0xe8c8('0x39')],{'$or':_[_0xe8c8('0x29')](_0x5c5f66['attributes'],function(_0x3bf4ad){var _0x331153={};_0x331153[_0x3bf4ad]={'$like':'%'+_0x589054[_0xe8c8('0x30')][_0xe8c8('0x3b')]+'%'};return _0x331153;})});}_0x5c5f66=_[_0xe8c8('0x3d')]({},_0x5c5f66,_0x589054['options']);return _0x12c831['getFields'](_0x5c5f66);}})[_0xe8c8('0x24')](function(_0x7058d2){if(_0x7058d2){_0x2daffd=_0x7058d2[_0xe8c8('0x46')];if(!_0x589054[_0xe8c8('0x30')][_0xe8c8('0x36')](_0xe8c8('0x37'))){_0x5c5f66[_0xe8c8('0x1f')]=qs[_0xe8c8('0x1f')](_0x589054['query'][_0xe8c8('0x1f')]);_0x5c5f66[_0xe8c8('0x1c')]=qs[_0xe8c8('0x1c')](_0x589054[_0xe8c8('0x30')][_0xe8c8('0x1c')]);}return _0x12c831['getFields'](_0x5c5f66);}})[_0xe8c8('0x24')](function(_0x1a1691){if(_0x1a1691){return _0x1a1691?{'count':_0x2daffd,'rows':_0x1a1691}:null;}})[_0xe8c8('0x24')](respondWithResult(_0x27d059,null))[_0xe8c8('0x43')](handleError(_0x27d059,null));};exports[_0xe8c8('0x4d')]=function(_0x21e23a,_0x1d0425,_0x3537ed){var _0x58503a={};var _0x5b9a5c={};var _0x34d1ef;var _0x429993;return db[_0xe8c8('0x2a')]['findOne']({'where':{'id':_0x21e23a[_0xe8c8('0x45')]['id']}})[_0xe8c8('0x24')](handleEntityNotFound(_0x1d0425,null))[_0xe8c8('0x24')](function(_0x591cd5){if(_0x591cd5){_0x34d1ef=_0x591cd5;_0x5b9a5c[_0xe8c8('0x2f')]=_[_0xe8c8('0x31')](db[_0xe8c8('0x4e')][_0xe8c8('0x2b')]);_0x5b9a5c[_0xe8c8('0x30')]=_['keys'](_0x21e23a['query']);_0x5b9a5c[_0xe8c8('0x32')]=_[_0xe8c8('0x33')](_0x5b9a5c['model'],_0x5b9a5c['query']);_0x58503a[_0xe8c8('0x35')]=_[_0xe8c8('0x33')](_0x5b9a5c[_0xe8c8('0x2f')],qs['fields'](_0x21e23a[_0xe8c8('0x30')][_0xe8c8('0x34')]));_0x58503a[_0xe8c8('0x35')]=_0x58503a[_0xe8c8('0x35')][_0xe8c8('0x46')]?_0x58503a['attributes']:_0x5b9a5c['model'];_0x58503a[_0xe8c8('0x38')]=qs[_0xe8c8('0x4c')](_0x21e23a[_0xe8c8('0x30')][_0xe8c8('0x4c')]);_0x58503a[_0xe8c8('0x39')]=qs[_0xe8c8('0x32')](_[_0xe8c8('0x3a')](_0x21e23a[_0xe8c8('0x30')],_0x5b9a5c[_0xe8c8('0x32')]));if(_0x21e23a[_0xe8c8('0x30')][_0xe8c8('0x3b')]){_0x58503a[_0xe8c8('0x39')]=_[_0xe8c8('0x3d')](_0x58503a[_0xe8c8('0x39')],{'$or':_['map'](_0x58503a['attributes'],function(_0x418047){var _0x5436dc={};_0x5436dc[_0x418047]={'$like':'%'+_0x21e23a[_0xe8c8('0x30')][_0xe8c8('0x3b')]+'%'};return _0x5436dc;})});}_0x58503a=_['merge']({},_0x58503a,_0x21e23a[_0xe8c8('0x3e')]);return _0x34d1ef[_0xe8c8('0x4d')](_0x58503a);}})['then'](function(_0x1ec4c9){if(_0x1ec4c9){_0x429993=_0x1ec4c9[_0xe8c8('0x46')];if(!_0x21e23a[_0xe8c8('0x30')][_0xe8c8('0x36')](_0xe8c8('0x37'))){_0x58503a[_0xe8c8('0x1f')]=qs['limit'](_0x21e23a[_0xe8c8('0x30')]['limit']);_0x58503a[_0xe8c8('0x1c')]=qs[_0xe8c8('0x1c')](_0x21e23a['query']['offset']);}return _0x34d1ef[_0xe8c8('0x4d')](_0x58503a);}})[_0xe8c8('0x24')](function(_0x1c0777){if(_0x1c0777){return _0x1c0777?{'count':_0x429993,'rows':_0x1c0777}:null;}})['then'](respondWithResult(_0x1d0425,null))[_0xe8c8('0x43')](handleError(_0x1d0425,null));};exports[_0xe8c8('0x4f')]=function(_0x3fff05,_0x3e3fe2,_0x1b3a84){var _0x4808d5={};var _0x2f91a1={};var _0x11aeec;var _0x214a31;return db[_0xe8c8('0x2a')][_0xe8c8('0x50')]({'where':{'id':_0x3fff05[_0xe8c8('0x45')]['id']}})[_0xe8c8('0x24')](handleEntityNotFound(_0x3e3fe2,null))[_0xe8c8('0x24')](function(_0x3e4b78){if(_0x3e4b78){_0x11aeec=_0x3e4b78;_0x2f91a1[_0xe8c8('0x2f')]=_[_0xe8c8('0x31')](db['Dynamics365Field'][_0xe8c8('0x2b')]);_0x2f91a1[_0xe8c8('0x30')]=_[_0xe8c8('0x31')](_0x3fff05[_0xe8c8('0x30')]);_0x2f91a1[_0xe8c8('0x32')]=_[_0xe8c8('0x33')](_0x2f91a1[_0xe8c8('0x2f')],_0x2f91a1[_0xe8c8('0x30')]);_0x4808d5['attributes']=_[_0xe8c8('0x33')](_0x2f91a1[_0xe8c8('0x2f')],qs[_0xe8c8('0x34')](_0x3fff05[_0xe8c8('0x30')]['fields']));_0x4808d5[_0xe8c8('0x35')]=_0x4808d5[_0xe8c8('0x35')][_0xe8c8('0x46')]?_0x4808d5[_0xe8c8('0x35')]:_0x2f91a1['model'];_0x4808d5[_0xe8c8('0x38')]=qs[_0xe8c8('0x4c')](_0x3fff05[_0xe8c8('0x30')][_0xe8c8('0x4c')]);_0x4808d5['where']=qs[_0xe8c8('0x32')](_['pick'](_0x3fff05[_0xe8c8('0x30')],_0x2f91a1[_0xe8c8('0x32')]));if(_0x3fff05[_0xe8c8('0x30')]['filter']){_0x4808d5['where']=_[_0xe8c8('0x3d')](_0x4808d5[_0xe8c8('0x39')],{'$or':_[_0xe8c8('0x29')](_0x4808d5[_0xe8c8('0x35')],function(_0xe1fe49){var _0x90b5ff={};_0x90b5ff[_0xe1fe49]={'$like':'%'+_0x3fff05[_0xe8c8('0x30')]['filter']+'%'};return _0x90b5ff;})});}_0x4808d5=_[_0xe8c8('0x3d')]({},_0x4808d5,_0x3fff05[_0xe8c8('0x3e')]);return _0x11aeec[_0xe8c8('0x4f')](_0x4808d5);}})['then'](function(_0x8ccfb2){if(_0x8ccfb2){_0x214a31=_0x8ccfb2[_0xe8c8('0x46')];if(!_0x3fff05[_0xe8c8('0x30')][_0xe8c8('0x36')](_0xe8c8('0x37'))){_0x4808d5[_0xe8c8('0x1f')]=qs[_0xe8c8('0x1f')](_0x3fff05[_0xe8c8('0x30')][_0xe8c8('0x1f')]);_0x4808d5['offset']=qs['offset'](_0x3fff05[_0xe8c8('0x30')][_0xe8c8('0x1c')]);}return _0x11aeec[_0xe8c8('0x4f')](_0x4808d5);}})[_0xe8c8('0x24')](function(_0x32e536){if(_0x32e536){return _0x32e536?{'count':_0x214a31,'rows':_0x32e536}:null;}})['then'](respondWithResult(_0x3e3fe2,null))['catch'](handleError(_0x3e3fe2,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 5d5918d..977ba0d 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 _0x84ab=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','lodash','util','../../config/logger','api','moment'];(function(_0x5be272,_0x3b0e84){var _0x7bd1b7=function(_0x271ee7){while(--_0x271ee7){_0x5be272['push'](_0x5be272['shift']());}};_0x7bd1b7(++_0x3b0e84);}(_0x84ab,0x12f));var _0xb84a=function(_0x2d3ab3,_0x47d90b){_0x2d3ab3=_0x2d3ab3-0x0;var _0x321f9e=_0x84ab[_0x2d3ab3];return _0x321f9e;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var logger=require(_0xb84a('0x2'))(_0xb84a('0x3'));var moment=require(_0xb84a('0x4'));var BPromise=require('bluebird');var rp=require(_0xb84a('0x5'));var fs=require('fs');var path=require(_0xb84a('0x6'));var rimraf=require('rimraf');var config=require(_0xb84a('0x7'));var attributes=require(_0xb84a('0x8'));module[_0xb84a('0x9')]=function(_0x5b9def,_0x521a64){return _0x5b9def['define'](_0xb84a('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14d=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','int_dynamics365_configurations','lodash'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xe14d,0x1ee));var _0xde14=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xe14d[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var logger=require(_0xde14('0x2'))(_0xde14('0x3'));var moment=require('moment');var BPromise=require(_0xde14('0x4'));var rp=require(_0xde14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var attributes=require(_0xde14('0x8'));module[_0xde14('0x9')]=function(_0x461af3,_0xba1514){return _0x461af3['define']('Dynamics365Configuration',attributes,{'tableName':_0xde14('0xa'),'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 3196076..a1a4f90 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 _0xf9cf=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Configuration,\x20%s,\x20%s'];(function(_0x19beab,_0x2c9e3e){var _0x14d7fe=function(_0x96cb5){while(--_0x96cb5){_0x19beab['push'](_0x19beab['shift']());}};_0x14d7fe(++_0x2c9e3e);}(_0xf9cf,0xb0));var _0xff9c=function(_0x247402,_0x301715){_0x247402=_0x247402-0x0;var _0x5b91a9=_0xf9cf[_0x247402];return _0x5b91a9;};'use strict';var _=require(_0xff9c('0x0'));var util=require(_0xff9c('0x1'));var moment=require(_0xff9c('0x2'));var BPromise=require('bluebird');var rs=require(_0xff9c('0x3'));var fs=require('fs');var Redis=require(_0xff9c('0x4'));var db=require(_0xff9c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xff9c('0x6'))(_0xff9c('0x7'));var config=require(_0xff9c('0x8'));var jayson=require(_0xff9c('0x9'));var client=jayson[_0xff9c('0xa')][_0xff9c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25b33f,_0xe99d5b,_0x3a1bae){return new BPromise(function(_0x5709d5,_0x458a27){return client['request'](_0x25b33f,_0x3a1bae)[_0xff9c('0xc')](function(_0xbdc798){logger[_0xff9c('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0xe99d5b,_0xff9c('0xe'));logger[_0xff9c('0xf')](_0xff9c('0x10'),_0xe99d5b,_0xff9c('0xe'),JSON[_0xff9c('0x11')](_0xbdc798));if(_0xbdc798[_0xff9c('0x12')]){if(_0xbdc798[_0xff9c('0x12')][_0xff9c('0x13')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0xe99d5b,_0xbdc798[_0xff9c('0x12')][_0xff9c('0x14')]);return _0x458a27(_0xbdc798[_0xff9c('0x12')][_0xff9c('0x14')]);}logger['error'](_0xff9c('0x15'),_0xe99d5b,_0xbdc798[_0xff9c('0x12')]['message']);return _0x5709d5(_0xbdc798[_0xff9c('0x12')]['message']);}else{logger[_0xff9c('0xd')](_0xff9c('0x15'),_0xe99d5b,_0xff9c('0xe'));_0x5709d5(_0xbdc798['result'][_0xff9c('0x14')]);}})['catch'](function(_0x1e68e3){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0xe99d5b,_0x1e68e3);_0x458a27(_0x1e68e3);});});} \ No newline at end of file +var _0x4cca=['Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2191bf,_0x3a25a7){var _0x271f6d=function(_0x5a57ee){while(--_0x5a57ee){_0x2191bf['push'](_0x2191bf['shift']());}};_0x271f6d(++_0x3a25a7);}(_0x4cca,0xc3));var _0xa4cc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4cca[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa4cc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa4cc('0x1'));var fs=require('fs');var Redis=require(_0xa4cc('0x2'));var db=require(_0xa4cc('0x3'))['db'];var utils=require(_0xa4cc('0x4'));var logger=require(_0xa4cc('0x5'))(_0xa4cc('0x6'));var config=require(_0xa4cc('0x7'));var jayson=require(_0xa4cc('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2fc2a9,_0x1b5b8c,_0x5a4d97){return new BPromise(function(_0x1bf1f9,_0x32a0cc){return client[_0xa4cc('0x9')](_0x2fc2a9,_0x5a4d97)['then'](function(_0x2fdd86){logger[_0xa4cc('0xa')](_0xa4cc('0xb'),_0x1b5b8c,_0xa4cc('0xc'));logger[_0xa4cc('0xd')](_0xa4cc('0xe'),_0x1b5b8c,_0xa4cc('0xc'),JSON[_0xa4cc('0xf')](_0x2fdd86));if(_0x2fdd86[_0xa4cc('0x10')]){if(_0x2fdd86[_0xa4cc('0x10')]['code']===0x1f4){logger[_0xa4cc('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1b5b8c,_0x2fdd86['error'][_0xa4cc('0x11')]);return _0x32a0cc(_0x2fdd86[_0xa4cc('0x10')][_0xa4cc('0x11')]);}logger[_0xa4cc('0x10')](_0xa4cc('0xb'),_0x1b5b8c,_0x2fdd86[_0xa4cc('0x10')][_0xa4cc('0x11')]);return _0x1bf1f9(_0x2fdd86['error'][_0xa4cc('0x11')]);}else{logger[_0xa4cc('0xa')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1b5b8c,_0xa4cc('0xc'));_0x1bf1f9(_0x2fdd86['result'][_0xa4cc('0x11')]);}})[_0xa4cc('0x12')](function(_0x15d39a){logger[_0xa4cc('0x10')](_0xa4cc('0xb'),_0x1b5b8c,_0x15d39a);_0x32a0cc(_0x15d39a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 2f8f705..75123bc 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 _0xee97=['util','path','connect-timeout','express','fs-extra','../../config/environment','index','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x4ae8f3,_0x3a27cf){var _0x1bcedd=function(_0x5d782f){while(--_0x5d782f){_0x4ae8f3['push'](_0x4ae8f3['shift']());}};_0x1bcedd(++_0x3a27cf);}(_0xee97,0x155));var _0x7ee9=function(_0x752b8a,_0x45bf5a){_0x752b8a=_0x752b8a-0x0;var _0x192617=_0xee97[_0x752b8a];return _0x192617;};'use strict';var multer=require(_0x7ee9('0x0'));var util=require(_0x7ee9('0x1'));var path=require(_0x7ee9('0x2'));var timeout=require(_0x7ee9('0x3'));var express=require(_0x7ee9('0x4'));var router=express['Router']();var fs_extra=require(_0x7ee9('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7ee9('0x6'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x7ee9('0x7')]);router[_0x7ee9('0x8')]('/:id',auth[_0x7ee9('0x9')](),controller[_0x7ee9('0xa')]);router[_0x7ee9('0xb')]('/',auth[_0x7ee9('0x9')](),controller[_0x7ee9('0xc')]);router[_0x7ee9('0xd')](_0x7ee9('0xe'),auth['isAuthenticated'](),controller[_0x7ee9('0xf')]);router[_0x7ee9('0x10')]('/:id',auth[_0x7ee9('0x9')](),controller[_0x7ee9('0x11')]);module[_0x7ee9('0x12')]=router; \ No newline at end of file +var _0x2267=['post','create','update','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show'];(function(_0x25d8ad,_0x26083d){var _0x4b2bf8=function(_0x14c85d){while(--_0x14c85d){_0x25d8ad['push'](_0x25d8ad['shift']());}};_0x4b2bf8(++_0x26083d);}(_0x2267,0x121));var _0x7226=function(_0x3f19b9,_0x5051e3){_0x3f19b9=_0x3f19b9-0x0;var _0x2556b2=_0x2267[_0x3f19b9];return _0x2556b2;};'use strict';var multer=require('multer');var util=require(_0x7226('0x0'));var path=require(_0x7226('0x1'));var timeout=require(_0x7226('0x2'));var express=require(_0x7226('0x3'));var router=express[_0x7226('0x4')]();var fs_extra=require(_0x7226('0x5'));var auth=require(_0x7226('0x6'));var interaction=require(_0x7226('0x7'));var config=require(_0x7226('0x8'));var controller=require(_0x7226('0x9'));router[_0x7226('0xa')]('/',auth[_0x7226('0xb')](),controller[_0x7226('0xc')]);router[_0x7226('0xa')](_0x7226('0xd'),auth[_0x7226('0xb')](),controller[_0x7226('0xe')]);router[_0x7226('0xf')]('/',auth[_0x7226('0xb')](),controller[_0x7226('0x10')]);router['put']('/:id',auth[_0x7226('0xb')](),controller[_0x7226('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7226('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index a79bd49..da82956 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 _0x9730=['string','variable','picklist','STRING','customVariable','BOOLEAN'];(function(_0x51faba,_0x1e69bf){var _0x323839=function(_0x20ee4c){while(--_0x20ee4c){_0x51faba['push'](_0x51faba['shift']());}};_0x323839(++_0x1e69bf);}(_0x9730,0x1d4));var _0x0973=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9730[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x0973('0x0'),_0x0973('0x1'),'customVariable','keyValue',_0x0973('0x2')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0973('0x3')]},'key':{'type':Sequelize[_0x0973('0x3')]},'keyType':{'type':Sequelize['ENUM'](_0x0973('0x0'),'variable',_0x0973('0x4'))},'keyContent':{'type':Sequelize[_0x0973('0x3')]},'idField':{'type':Sequelize[_0x0973('0x3')]},'nameField':{'type':Sequelize[_0x0973('0x3')]},'customField':{'type':Sequelize[_0x0973('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0973('0x3')]}}; \ No newline at end of file +var _0x95b0=['customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x2d30b3,_0x2a8cd1){var _0x41f6bc=function(_0xcb88ec){while(--_0xcb88ec){_0x2d30b3['push'](_0x2d30b3['shift']());}};_0x41f6bc(++_0x2a8cd1);}(_0x95b0,0x16e));var _0x095b=function(_0x251cab,_0x2a74af){_0x251cab=_0x251cab-0x0;var _0x406563=_0x95b0[_0x251cab];return _0x406563;};'use strict';var Sequelize=require(_0x095b('0x0'));module[_0x095b('0x1')]={'type':{'type':Sequelize[_0x095b('0x2')](_0x095b('0x3'),'variable',_0x095b('0x4'),_0x095b('0x5'),_0x095b('0x6')),'defaultValue':_0x095b('0x3')},'content':{'type':Sequelize[_0x095b('0x7')]},'key':{'type':Sequelize[_0x095b('0x7')]},'keyType':{'type':Sequelize[_0x095b('0x2')](_0x095b('0x3'),_0x095b('0x8'),_0x095b('0x4'))},'keyContent':{'type':Sequelize[_0x095b('0x7')]},'idField':{'type':Sequelize[_0x095b('0x7')]},'nameField':{'type':Sequelize[_0x095b('0x7')]},'customField':{'type':Sequelize[_0x095b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x095b('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 4e3ad45..5146e0e 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 _0x8ee3=['rows','catch','keys','length','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','Dynamics365Field','rawAttributes','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll'];(function(_0x54d87e,_0x556222){var _0x54fb9a=function(_0x4eca28){while(--_0x4eca28){_0x54d87e['push'](_0x54d87e['shift']());}};_0x54fb9a(++_0x556222);}(_0x8ee3,0xf5));var _0x38ee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8ee3[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x38ee('0x0'));var zipdir=require(_0x38ee('0x1'));var jsonpatch=require(_0x38ee('0x2'));var rp=require(_0x38ee('0x3'));var moment=require(_0x38ee('0x4'));var BPromise=require(_0x38ee('0x5'));var Mustache=require(_0x38ee('0x6'));var util=require(_0x38ee('0x7'));var path=require(_0x38ee('0x8'));var sox=require(_0x38ee('0x9'));var csv=require(_0x38ee('0xa'));var ejs=require(_0x38ee('0xb'));var fs=require('fs');var fs_extra=require(_0x38ee('0xc'));var _=require(_0x38ee('0xd'));var squel=require(_0x38ee('0xe'));var crypto=require('crypto');var jsforce=require(_0x38ee('0xf'));var deskjs=require(_0x38ee('0x10'));var toCsv=require('to-csv');var querystring=require(_0x38ee('0x11'));var Papa=require(_0x38ee('0x12'));var Redis=require(_0x38ee('0x13'));var authService=require(_0x38ee('0x14'));var qs=require(_0x38ee('0x15'));var as=require(_0x38ee('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x38ee('0x17'))(_0x38ee('0x18'));var utils=require(_0x38ee('0x19'));var config=require(_0x38ee('0x1a'));var licenseUtil=require(_0x38ee('0x1b'));var db=require(_0x38ee('0x1c'))['db'];function respondWithStatusCode(_0x3cc0f1,_0x238289){_0x238289=_0x238289||0xcc;return function(_0x36ea70){if(_0x36ea70){return _0x3cc0f1[_0x38ee('0x1d')](_0x238289);}return _0x3cc0f1[_0x38ee('0x1e')](_0x238289)[_0x38ee('0x1f')]();};}function respondWithResult(_0x1e13d5,_0x318500){_0x318500=_0x318500||0xc8;return function(_0x438b92){if(_0x438b92){return _0x1e13d5[_0x38ee('0x1e')](_0x318500)[_0x38ee('0x20')](_0x438b92);}};}function respondWithFilteredResult(_0x53ab68,_0x231eff){return function(_0x54dbfc){if(_0x54dbfc){var _0x141f02=typeof _0x231eff[_0x38ee('0x21')]===_0x38ee('0x22')&&typeof _0x231eff[_0x38ee('0x23')]===_0x38ee('0x22');var _0x306329=_0x54dbfc[_0x38ee('0x24')];var _0x2a2230=_0x141f02?0x0:_0x231eff['offset'];var _0x9e51c8=_0x141f02?_0x54dbfc[_0x38ee('0x24')]:_0x231eff[_0x38ee('0x21')]+_0x231eff[_0x38ee('0x23')];var _0x2b9ccb;if(_0x9e51c8>=_0x306329){_0x9e51c8=_0x306329;_0x2b9ccb=0xc8;}else{_0x2b9ccb=0xce;}_0x53ab68[_0x38ee('0x1e')](_0x2b9ccb);return _0x53ab68[_0x38ee('0x25')](_0x38ee('0x26'),_0x2a2230+'-'+_0x9e51c8+'/'+_0x306329)[_0x38ee('0x20')](_0x54dbfc);}return null;};}function patchUpdates(_0x4141ab){return function(_0x380bc2){try{jsonpatch[_0x38ee('0x27')](_0x380bc2,_0x4141ab,!![]);}catch(_0x2432e1){return BPromise[_0x38ee('0x28')](_0x2432e1);}return _0x380bc2[_0x38ee('0x29')]();};}function saveUpdates(_0x28b99f,_0x1d2244){return function(_0x523e35){if(_0x523e35){return _0x523e35[_0x38ee('0x2a')](_0x28b99f)[_0x38ee('0x2b')](function(_0x22005a){return _0x22005a;});}return null;};}function removeEntity(_0xce3ac8,_0x4b5961){return function(_0x5458c9){if(_0x5458c9){return _0x5458c9[_0x38ee('0x2c')]()[_0x38ee('0x2b')](function(){_0xce3ac8[_0x38ee('0x1e')](0xcc)[_0x38ee('0x1f')]();});}};}function handleEntityNotFound(_0x5cfcd6,_0x3ca6aa){return function(_0x17908e){if(!_0x17908e){_0x5cfcd6['sendStatus'](0x194);}return _0x17908e;};}function handleError(_0xde6b6d,_0x5b59b2){_0x5b59b2=_0x5b59b2||0x1f4;return function(_0x431abc){logger[_0x38ee('0x2d')](_0x431abc[_0x38ee('0x2e')]);if(_0x431abc['name']){delete _0x431abc[_0x38ee('0x2f')];}_0xde6b6d[_0x38ee('0x1e')](_0x5b59b2)['send'](_0x431abc);};}exports[_0x38ee('0x30')]=function(_0x413796,_0x3083de){var _0x2905d5={},_0x267000={},_0x325e18={'count':0x0,'rows':[]};var _0x294c03=_[_0x38ee('0x31')](db[_0x38ee('0x32')][_0x38ee('0x33')],function(_0x3b270a){return{'name':_0x3b270a['fieldName'],'type':_0x3b270a['type'][_0x38ee('0x34')]};});_0x267000[_0x38ee('0x35')]=_[_0x38ee('0x31')](_0x294c03,'name');_0x267000['query']=_['keys'](_0x413796[_0x38ee('0x36')]);_0x267000[_0x38ee('0x37')]=_[_0x38ee('0x38')](_0x267000['model'],_0x267000['query']);_0x2905d5[_0x38ee('0x39')]=_[_0x38ee('0x38')](_0x267000[_0x38ee('0x35')],qs[_0x38ee('0x3a')](_0x413796[_0x38ee('0x36')][_0x38ee('0x3a')]));_0x2905d5[_0x38ee('0x39')]=_0x2905d5['attributes']['length']?_0x2905d5[_0x38ee('0x39')]:_0x267000['model'];if(!_0x413796['query'][_0x38ee('0x3b')](_0x38ee('0x3c'))){_0x2905d5[_0x38ee('0x23')]=qs[_0x38ee('0x23')](_0x413796[_0x38ee('0x36')][_0x38ee('0x23')]);_0x2905d5['offset']=qs[_0x38ee('0x21')](_0x413796[_0x38ee('0x36')][_0x38ee('0x21')]);}_0x2905d5[_0x38ee('0x3d')]=qs['sort'](_0x413796[_0x38ee('0x36')]['sort']);_0x2905d5[_0x38ee('0x3e')]=qs['filters'](_[_0x38ee('0x3f')](_0x413796['query'],_0x267000[_0x38ee('0x37')]),_0x294c03);if(_0x413796[_0x38ee('0x36')][_0x38ee('0x40')]){_0x2905d5[_0x38ee('0x3e')]=_[_0x38ee('0x41')](_0x2905d5['where'],{'$or':_['map'](_0x294c03,function(_0x4a8b88){if(_0x4a8b88[_0x38ee('0x42')]!==_0x38ee('0x43')){var _0x2e8da3={};_0x2e8da3[_0x4a8b88[_0x38ee('0x2f')]]={'$like':'%'+_0x413796[_0x38ee('0x36')]['filter']+'%'};return _0x2e8da3;}})});}_0x2905d5=_[_0x38ee('0x41')]({},_0x2905d5,_0x413796[_0x38ee('0x44')]);var _0x3d238b={'where':_0x2905d5[_0x38ee('0x3e')]};return db[_0x38ee('0x32')][_0x38ee('0x24')](_0x3d238b)[_0x38ee('0x2b')](function(_0x39faf0){_0x325e18[_0x38ee('0x24')]=_0x39faf0;if(_0x413796[_0x38ee('0x36')][_0x38ee('0x45')]){_0x2905d5['include']=[{'all':!![]}];}return db[_0x38ee('0x32')][_0x38ee('0x46')](_0x2905d5);})[_0x38ee('0x2b')](function(_0x50d3d3){_0x325e18[_0x38ee('0x47')]=_0x50d3d3;return _0x325e18;})[_0x38ee('0x2b')](respondWithFilteredResult(_0x3083de,_0x2905d5))[_0x38ee('0x48')](handleError(_0x3083de,null));};exports['show']=function(_0x17c3f5,_0x51113b){var _0x3f3d71={'raw':!![],'where':{'id':_0x17c3f5['params']['id']}},_0x5d038e={};_0x5d038e['model']=_[_0x38ee('0x49')](db[_0x38ee('0x32')][_0x38ee('0x33')]);_0x5d038e[_0x38ee('0x36')]=_[_0x38ee('0x49')](_0x17c3f5['query']);_0x5d038e['filters']=_[_0x38ee('0x38')](_0x5d038e[_0x38ee('0x35')],_0x5d038e[_0x38ee('0x36')]);_0x3f3d71[_0x38ee('0x39')]=_[_0x38ee('0x38')](_0x5d038e[_0x38ee('0x35')],qs[_0x38ee('0x3a')](_0x17c3f5[_0x38ee('0x36')][_0x38ee('0x3a')]));_0x3f3d71[_0x38ee('0x39')]=_0x3f3d71[_0x38ee('0x39')][_0x38ee('0x4a')]?_0x3f3d71[_0x38ee('0x39')]:_0x5d038e[_0x38ee('0x35')];if(_0x17c3f5[_0x38ee('0x36')]['includeAll']){_0x3f3d71['include']=[{'all':!![]}];}_0x3f3d71=_[_0x38ee('0x41')]({},_0x3f3d71,_0x17c3f5[_0x38ee('0x44')]);return db[_0x38ee('0x32')][_0x38ee('0x4b')](_0x3f3d71)[_0x38ee('0x2b')](handleEntityNotFound(_0x51113b,null))[_0x38ee('0x2b')](respondWithResult(_0x51113b,null))[_0x38ee('0x48')](handleError(_0x51113b,null));};exports[_0x38ee('0x4c')]=function(_0x4d9207,_0x1a922d){return db[_0x38ee('0x32')][_0x38ee('0x4c')](_0x4d9207['body'],{})[_0x38ee('0x2b')](respondWithResult(_0x1a922d,0xc9))['catch'](handleError(_0x1a922d,null));};exports[_0x38ee('0x2a')]=function(_0x25860e,_0x2c3b88){if(_0x25860e[_0x38ee('0x4d')]['id']){delete _0x25860e[_0x38ee('0x4d')]['id'];}return db[_0x38ee('0x32')][_0x38ee('0x4b')]({'where':{'id':_0x25860e[_0x38ee('0x4e')]['id']}})[_0x38ee('0x2b')](handleEntityNotFound(_0x2c3b88,null))[_0x38ee('0x2b')](saveUpdates(_0x25860e[_0x38ee('0x4d')],null))[_0x38ee('0x2b')](respondWithResult(_0x2c3b88,null))[_0x38ee('0x48')](handleError(_0x2c3b88,null));};exports[_0x38ee('0x2c')]=function(_0x32cfaf,_0x37f975){return db[_0x38ee('0x32')][_0x38ee('0x4b')]({'where':{'id':_0x32cfaf[_0x38ee('0x4e')]['id']}})[_0x38ee('0x2b')](handleEntityNotFound(_0x37f975,null))[_0x38ee('0x2b')](removeEntity(_0x37f975,null))[_0x38ee('0x48')](handleError(_0x37f975,null));}; \ No newline at end of file +var _0xa864=['intersection','fields','attributes','length','hasOwnProperty','nolimit','filter','where','merge','options','Dynamics365Field','includeAll','findAll','rows','show','params','include','find','create','body','catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','then','stack','name','map','rawAttributes','fieldName','key','model','query','keys','filters'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa864,0x119));var _0x4a86=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0xa864[_0x2f5a22];return _0x326b70;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4a86('0x0'));var jsonpatch=require(_0x4a86('0x1'));var rp=require(_0x4a86('0x2'));var moment=require(_0x4a86('0x3'));var BPromise=require(_0x4a86('0x4'));var Mustache=require('mustache');var util=require(_0x4a86('0x5'));var path=require(_0x4a86('0x6'));var sox=require(_0x4a86('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a86('0x8'));var _=require(_0x4a86('0x9'));var squel=require('squel');var crypto=require(_0x4a86('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4a86('0xb'));var toCsv=require(_0x4a86('0xc'));var querystring=require('querystring');var Papa=require(_0x4a86('0xd'));var Redis=require(_0x4a86('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4a86('0xf'));var as=require(_0x4a86('0x10'));var hardwareService=require(_0x4a86('0x11'));var logger=require('../../config/logger')(_0x4a86('0x12'));var utils=require('../../config/utils');var config=require(_0x4a86('0x13'));var licenseUtil=require(_0x4a86('0x14'));var db=require(_0x4a86('0x15'))['db'];function respondWithStatusCode(_0x31ded5,_0x55eed6){_0x55eed6=_0x55eed6||0xcc;return function(_0x5ae062){if(_0x5ae062){return _0x31ded5['sendStatus'](_0x55eed6);}return _0x31ded5[_0x4a86('0x16')](_0x55eed6)[_0x4a86('0x17')]();};}function respondWithResult(_0x1a9db4,_0x30f133){_0x30f133=_0x30f133||0xc8;return function(_0x57c565){if(_0x57c565){return _0x1a9db4[_0x4a86('0x16')](_0x30f133)['json'](_0x57c565);}};}function respondWithFilteredResult(_0x187b66,_0x5f1b15){return function(_0x4e6c52){if(_0x4e6c52){var _0xcdc1ae=typeof _0x5f1b15[_0x4a86('0x18')]===_0x4a86('0x19')&&typeof _0x5f1b15[_0x4a86('0x1a')]===_0x4a86('0x19');var _0x26cf75=_0x4e6c52[_0x4a86('0x1b')];var _0x3bcf14=_0xcdc1ae?0x0:_0x5f1b15[_0x4a86('0x18')];var _0x3bfb43=_0xcdc1ae?_0x4e6c52[_0x4a86('0x1b')]:_0x5f1b15['offset']+_0x5f1b15[_0x4a86('0x1a')];var _0x2d4796;if(_0x3bfb43>=_0x26cf75){_0x3bfb43=_0x26cf75;_0x2d4796=0xc8;}else{_0x2d4796=0xce;}_0x187b66[_0x4a86('0x16')](_0x2d4796);return _0x187b66[_0x4a86('0x1c')](_0x4a86('0x1d'),_0x3bcf14+'-'+_0x3bfb43+'/'+_0x26cf75)[_0x4a86('0x1e')](_0x4e6c52);}return null;};}function patchUpdates(_0x2d6b70){return function(_0x5c49c6){try{jsonpatch['apply'](_0x5c49c6,_0x2d6b70,!![]);}catch(_0x44105e){return BPromise['reject'](_0x44105e);}return _0x5c49c6[_0x4a86('0x1f')]();};}function saveUpdates(_0x109f0f,_0x3ea65a){return function(_0x96a74){if(_0x96a74){return _0x96a74[_0x4a86('0x20')](_0x109f0f)['then'](function(_0x542323){return _0x542323;});}return null;};}function removeEntity(_0x25efea,_0x2179ce){return function(_0x3925ad){if(_0x3925ad){return _0x3925ad['destroy']()[_0x4a86('0x21')](function(){_0x25efea['status'](0xcc)[_0x4a86('0x17')]();});}};}function handleEntityNotFound(_0xd15f7a,_0x223d1e){return function(_0x200a23){if(!_0x200a23){_0xd15f7a['sendStatus'](0x194);}return _0x200a23;};}function handleError(_0x3fd559,_0x48c404){_0x48c404=_0x48c404||0x1f4;return function(_0x325efc){logger['error'](_0x325efc[_0x4a86('0x22')]);if(_0x325efc[_0x4a86('0x23')]){delete _0x325efc['name'];}_0x3fd559[_0x4a86('0x16')](_0x48c404)['send'](_0x325efc);};}exports['index']=function(_0x6ea25c,_0x28440e){var _0x5b2244={},_0x13f5d5={},_0x556cef={'count':0x0,'rows':[]};var _0x1b14a2=_[_0x4a86('0x24')](db['Dynamics365Field'][_0x4a86('0x25')],function(_0x32824e){return{'name':_0x32824e[_0x4a86('0x26')],'type':_0x32824e['type'][_0x4a86('0x27')]};});_0x13f5d5[_0x4a86('0x28')]=_[_0x4a86('0x24')](_0x1b14a2,'name');_0x13f5d5[_0x4a86('0x29')]=_[_0x4a86('0x2a')](_0x6ea25c['query']);_0x13f5d5[_0x4a86('0x2b')]=_['intersection'](_0x13f5d5[_0x4a86('0x28')],_0x13f5d5[_0x4a86('0x29')]);_0x5b2244['attributes']=_[_0x4a86('0x2c')](_0x13f5d5[_0x4a86('0x28')],qs[_0x4a86('0x2d')](_0x6ea25c[_0x4a86('0x29')]['fields']));_0x5b2244[_0x4a86('0x2e')]=_0x5b2244[_0x4a86('0x2e')][_0x4a86('0x2f')]?_0x5b2244[_0x4a86('0x2e')]:_0x13f5d5[_0x4a86('0x28')];if(!_0x6ea25c[_0x4a86('0x29')][_0x4a86('0x30')](_0x4a86('0x31'))){_0x5b2244[_0x4a86('0x1a')]=qs['limit'](_0x6ea25c[_0x4a86('0x29')]['limit']);_0x5b2244['offset']=qs['offset'](_0x6ea25c[_0x4a86('0x29')][_0x4a86('0x18')]);}_0x5b2244['order']=qs['sort'](_0x6ea25c[_0x4a86('0x29')]['sort']);_0x5b2244['where']=qs[_0x4a86('0x2b')](_['pick'](_0x6ea25c[_0x4a86('0x29')],_0x13f5d5[_0x4a86('0x2b')]),_0x1b14a2);if(_0x6ea25c['query'][_0x4a86('0x32')]){_0x5b2244[_0x4a86('0x33')]=_[_0x4a86('0x34')](_0x5b2244[_0x4a86('0x33')],{'$or':_['map'](_0x1b14a2,function(_0x496b76){if(_0x496b76['type']!=='VIRTUAL'){var _0x4ac3b9={};_0x4ac3b9[_0x496b76['name']]={'$like':'%'+_0x6ea25c[_0x4a86('0x29')][_0x4a86('0x32')]+'%'};return _0x4ac3b9;}})});}_0x5b2244=_[_0x4a86('0x34')]({},_0x5b2244,_0x6ea25c[_0x4a86('0x35')]);var _0x169f5e={'where':_0x5b2244[_0x4a86('0x33')]};return db[_0x4a86('0x36')][_0x4a86('0x1b')](_0x169f5e)[_0x4a86('0x21')](function(_0x85f0fd){_0x556cef[_0x4a86('0x1b')]=_0x85f0fd;if(_0x6ea25c['query'][_0x4a86('0x37')]){_0x5b2244['include']=[{'all':!![]}];}return db[_0x4a86('0x36')][_0x4a86('0x38')](_0x5b2244);})[_0x4a86('0x21')](function(_0x305c81){_0x556cef[_0x4a86('0x39')]=_0x305c81;return _0x556cef;})['then'](respondWithFilteredResult(_0x28440e,_0x5b2244))['catch'](handleError(_0x28440e,null));};exports[_0x4a86('0x3a')]=function(_0x5aa809,_0x450350){var _0x559f0d={'raw':!![],'where':{'id':_0x5aa809[_0x4a86('0x3b')]['id']}},_0x3e1a72={};_0x3e1a72[_0x4a86('0x28')]=_[_0x4a86('0x2a')](db[_0x4a86('0x36')]['rawAttributes']);_0x3e1a72['query']=_['keys'](_0x5aa809[_0x4a86('0x29')]);_0x3e1a72[_0x4a86('0x2b')]=_[_0x4a86('0x2c')](_0x3e1a72['model'],_0x3e1a72['query']);_0x559f0d[_0x4a86('0x2e')]=_[_0x4a86('0x2c')](_0x3e1a72['model'],qs['fields'](_0x5aa809[_0x4a86('0x29')]['fields']));_0x559f0d['attributes']=_0x559f0d[_0x4a86('0x2e')]['length']?_0x559f0d[_0x4a86('0x2e')]:_0x3e1a72['model'];if(_0x5aa809[_0x4a86('0x29')][_0x4a86('0x37')]){_0x559f0d[_0x4a86('0x3c')]=[{'all':!![]}];}_0x559f0d=_[_0x4a86('0x34')]({},_0x559f0d,_0x5aa809[_0x4a86('0x35')]);return db[_0x4a86('0x36')][_0x4a86('0x3d')](_0x559f0d)['then'](handleEntityNotFound(_0x450350,null))[_0x4a86('0x21')](respondWithResult(_0x450350,null))['catch'](handleError(_0x450350,null));};exports['create']=function(_0x2dc160,_0xe97f56){return db[_0x4a86('0x36')][_0x4a86('0x3e')](_0x2dc160[_0x4a86('0x3f')],{})[_0x4a86('0x21')](respondWithResult(_0xe97f56,0xc9))[_0x4a86('0x40')](handleError(_0xe97f56,null));};exports[_0x4a86('0x20')]=function(_0x541d6c,_0x2e05a0){if(_0x541d6c[_0x4a86('0x3f')]['id']){delete _0x541d6c[_0x4a86('0x3f')]['id'];}return db[_0x4a86('0x36')]['find']({'where':{'id':_0x541d6c[_0x4a86('0x3b')]['id']}})[_0x4a86('0x21')](handleEntityNotFound(_0x2e05a0,null))[_0x4a86('0x21')](saveUpdates(_0x541d6c['body'],null))[_0x4a86('0x21')](respondWithResult(_0x2e05a0,null))[_0x4a86('0x40')](handleError(_0x2e05a0,null));};exports['destroy']=function(_0x591161,_0x1a981f){return db[_0x4a86('0x36')][_0x4a86('0x3d')]({'where':{'id':_0x591161[_0x4a86('0x3b')]['id']}})[_0x4a86('0x21')](handleEntityNotFound(_0x1a981f,null))[_0x4a86('0x21')](removeEntity(_0x1a981f,null))[_0x4a86('0x40')](handleError(_0x1a981f,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 7e6f10e..85536ca 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 _0x64c6=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','FieldId'];(function(_0x46bd7d,_0x509de0){var _0xaa76b3=function(_0x9fe0cf){while(--_0x9fe0cf){_0x46bd7d['push'](_0x46bd7d['shift']());}};_0xaa76b3(++_0x509de0);}(_0x64c6,0x159));var _0x664c=function(_0x29dda1,_0x508e13){_0x29dda1=_0x29dda1-0x0;var _0x21b0ef=_0x64c6[_0x29dda1];return _0x21b0ef;};'use strict';var _=require(_0x664c('0x0'));var util=require(_0x664c('0x1'));var logger=require(_0x664c('0x2'))(_0x664c('0x3'));var moment=require('moment');var BPromise=require(_0x664c('0x4'));var rp=require(_0x664c('0x5'));var fs=require('fs');var path=require(_0x664c('0x6'));var rimraf=require(_0x664c('0x7'));var config=require(_0x664c('0x8'));var attributes=require(_0x664c('0x9'));module[_0x664c('0xa')]=function(_0x1db6c4,_0x73a1a0){return _0x1db6c4[_0x664c('0xb')](_0x664c('0xc'),attributes,{'tableName':_0x664c('0xd'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0x664c('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb8da=['dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intDynamics365Field.attributes','define','int_dynamics365_fields'];(function(_0x442469,_0x1c6f4d){var _0x3e263b=function(_0x1e60eb){while(--_0x1e60eb){_0x442469['push'](_0x442469['shift']());}};_0x3e263b(++_0x1c6f4d);}(_0xb8da,0x137));var _0xab8d=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xb8da[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xab8d('0x0'));var util=require(_0xab8d('0x1'));var logger=require(_0xab8d('0x2'))(_0xab8d('0x3'));var moment=require(_0xab8d('0x4'));var BPromise=require('bluebird');var rp=require(_0xab8d('0x5'));var fs=require('fs');var path=require(_0xab8d('0x6'));var rimraf=require('rimraf');var config=require(_0xab8d('0x7'));var attributes=require(_0xab8d('0x8'));module['exports']=function(_0x1a3eb9,_0x1742ac){return _0x1a3eb9[_0xab8d('0x9')]('Dynamics365Field',attributes,{'tableName':_0xab8d('0xa'),'paranoid':![],'indexes':[{'name':_0xab8d('0xb'),'fields':[_0xab8d('0xc'),_0xab8d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index b965b9b..c7c076c 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 _0x879c=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x1eadff,_0x3a57be){var _0x21cad7=function(_0x21139d){while(--_0x21139d){_0x1eadff['push'](_0x1eadff['shift']());}};_0x21cad7(++_0x3a57be);}(_0x879c,0x11f));var _0xc879=function(_0x55d91,_0x351fae){_0x55d91=_0x55d91-0x0;var _0x46d0b3=_0x879c[_0x55d91];return _0x46d0b3;};'use strict';var _=require(_0xc879('0x0'));var util=require(_0xc879('0x1'));var moment=require(_0xc879('0x2'));var BPromise=require(_0xc879('0x3'));var rs=require(_0xc879('0x4'));var fs=require('fs');var Redis=require(_0xc879('0x5'));var db=require(_0xc879('0x6'))['db'];var utils=require(_0xc879('0x7'));var logger=require(_0xc879('0x8'))(_0xc879('0x9'));var config=require(_0xc879('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc879('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4981fb,_0x4250fb,_0x1de243){return new BPromise(function(_0x488f56,_0x4c442a){return client[_0xc879('0xc')](_0x4981fb,_0x1de243)[_0xc879('0xd')](function(_0x2508e4){logger[_0xc879('0xe')](_0xc879('0xf'),_0x4250fb,_0xc879('0x10'));logger[_0xc879('0x11')](_0xc879('0x12'),_0x4250fb,'request\x20sent',JSON[_0xc879('0x13')](_0x2508e4));if(_0x2508e4[_0xc879('0x14')]){if(_0x2508e4['error'][_0xc879('0x15')]===0x1f4){logger[_0xc879('0x14')](_0xc879('0xf'),_0x4250fb,_0x2508e4[_0xc879('0x14')][_0xc879('0x16')]);return _0x4c442a(_0x2508e4[_0xc879('0x14')][_0xc879('0x16')]);}logger[_0xc879('0x14')](_0xc879('0xf'),_0x4250fb,_0x2508e4[_0xc879('0x14')][_0xc879('0x16')]);return _0x488f56(_0x2508e4[_0xc879('0x14')][_0xc879('0x16')]);}else{logger[_0xc879('0xe')](_0xc879('0xf'),_0x4250fb,_0xc879('0x10'));_0x488f56(_0x2508e4['result'][_0xc879('0x16')]);}})[_0xc879('0x17')](function(_0x157b7c){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x4250fb,_0x157b7c);_0x4c442a(_0x157b7c);});});} \ No newline at end of file +var _0xa728=['info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0xa728,0x9b));var _0x8a72=function(_0x419aa1,_0x4e8d37){_0x419aa1=_0x419aa1-0x0;var _0x8bbbd=_0xa728[_0x419aa1];return _0x8bbbd;};'use strict';var _=require(_0x8a72('0x0'));var util=require(_0x8a72('0x1'));var moment=require(_0x8a72('0x2'));var BPromise=require(_0x8a72('0x3'));var rs=require(_0x8a72('0x4'));var fs=require('fs');var Redis=require(_0x8a72('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a72('0x6'));var logger=require('../../config/logger')(_0x8a72('0x7'));var config=require(_0x8a72('0x8'));var jayson=require(_0x8a72('0x9'));var client=jayson[_0x8a72('0xa')][_0x8a72('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x143dc2,_0x17ab78,_0x349537){return new BPromise(function(_0x5562ac,_0x545346){return client[_0x8a72('0xc')](_0x143dc2,_0x349537)['then'](function(_0x5bcf9a){logger[_0x8a72('0xd')](_0x8a72('0xe'),_0x17ab78,_0x8a72('0xf'));logger['debug'](_0x8a72('0x10'),_0x17ab78,_0x8a72('0xf'),JSON['stringify'](_0x5bcf9a));if(_0x5bcf9a[_0x8a72('0x11')]){if(_0x5bcf9a[_0x8a72('0x11')][_0x8a72('0x12')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x17ab78,_0x5bcf9a[_0x8a72('0x11')]['message']);return _0x545346(_0x5bcf9a['error']['message']);}logger[_0x8a72('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x17ab78,_0x5bcf9a[_0x8a72('0x11')]['message']);return _0x5562ac(_0x5bcf9a[_0x8a72('0x11')][_0x8a72('0x13')]);}else{logger[_0x8a72('0xd')](_0x8a72('0xe'),_0x17ab78,_0x8a72('0xf'));_0x5562ac(_0x5bcf9a[_0x8a72('0x14')]['message']);}})['catch'](function(_0x2e3cc6){logger[_0x8a72('0x11')](_0x8a72('0xe'),_0x17ab78,_0x2e3cc6);_0x545346(_0x2e3cc6);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 3b1d11f..209c8ec 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 _0x18af=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer'];(function(_0x25cba7,_0x36255c){var _0x2f1e13=function(_0x397112){while(--_0x397112){_0x25cba7['push'](_0x25cba7['shift']());}};_0x2f1e13(++_0x36255c);}(_0x18af,0x197));var _0xf18a=function(_0x5da9c8,_0x35d7b2){_0x5da9c8=_0x5da9c8-0x0;var _0x2b4b2b=_0x18af[_0x5da9c8];return _0x2b4b2b;};'use strict';var multer=require(_0xf18a('0x0'));var util=require(_0xf18a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf18a('0x2'));var router=express[_0xf18a('0x3')]();var fs_extra=require(_0xf18a('0x4'));var auth=require(_0xf18a('0x5'));var interaction=require(_0xf18a('0x6'));var config=require(_0xf18a('0x7'));var controller=require(_0xf18a('0x8'));router[_0xf18a('0x9')]('/',auth[_0xf18a('0xa')](),controller[_0xf18a('0xb')]);router[_0xf18a('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xf18a('0xc')]);router[_0xf18a('0x9')](_0xf18a('0xd'),auth['isAuthenticated'](),controller[_0xf18a('0xe')]);router[_0xf18a('0x9')]('/:id/fields',auth[_0xf18a('0xa')](),controller['getFields']);router[_0xf18a('0xf')]('/',auth[_0xf18a('0xa')](),controller[_0xf18a('0x10')]);router[_0xf18a('0xf')](_0xf18a('0xd'),auth[_0xf18a('0xa')](),controller[_0xf18a('0x11')]);router[_0xf18a('0x12')](_0xf18a('0x13'),auth[_0xf18a('0xa')](),controller[_0xf18a('0x14')]);router[_0xf18a('0x15')](_0xf18a('0x13'),auth[_0xf18a('0xa')](),controller[_0xf18a('0x16')]);module[_0xf18a('0x17')]=router; \ No newline at end of file +var _0x8aa4=['./intFreshdeskAccount.controller','get','isAuthenticated','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','/:id','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0x374c9e,_0x16a413){var _0x4454f9=function(_0x7cb1e7){while(--_0x7cb1e7){_0x374c9e['push'](_0x374c9e['shift']());}};_0x4454f9(++_0x16a413);}(_0x8aa4,0x1b2));var _0x48aa=function(_0xe83ac5,_0x279b67){_0xe83ac5=_0xe83ac5-0x0;var _0x3df16e=_0x8aa4[_0xe83ac5];return _0x3df16e;};'use strict';var multer=require('multer');var util=require(_0x48aa('0x0'));var path=require(_0x48aa('0x1'));var timeout=require(_0x48aa('0x2'));var express=require(_0x48aa('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x48aa('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x48aa('0x5'));var controller=require(_0x48aa('0x6'));router[_0x48aa('0x7')]('/',auth[_0x48aa('0x8')](),controller['index']);router['get']('/:id',auth[_0x48aa('0x8')](),controller[_0x48aa('0x9')]);router['get'](_0x48aa('0xa'),auth[_0x48aa('0x8')](),controller['getConfigurations']);router[_0x48aa('0x7')](_0x48aa('0xb'),auth[_0x48aa('0x8')](),controller['getFields']);router[_0x48aa('0xc')]('/',auth[_0x48aa('0x8')](),controller[_0x48aa('0xd')]);router[_0x48aa('0xc')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x48aa('0xe')]);router[_0x48aa('0xf')](_0x48aa('0x10'),auth[_0x48aa('0x8')](),controller[_0x48aa('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x48aa('0x12')]);module[_0x48aa('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 78a974d..2e1f483 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 _0x14a0=['username','exports','STRING'];(function(_0x59d17d,_0x2deaca){var _0x301d3f=function(_0xde30c8){while(--_0xde30c8){_0x59d17d['push'](_0x59d17d['shift']());}};_0x301d3f(++_0x2deaca);}(_0x14a0,0x8e));var _0x014a=function(_0x5d8e2a,_0x3404d9){_0x5d8e2a=_0x5d8e2a-0x0;var _0x43f46a=_0x14a0[_0x5d8e2a];return _0x43f46a;};'use strict';var Sequelize=require('sequelize');module[_0x014a('0x0')]={'name':{'type':Sequelize[_0x014a('0x1')]},'description':{'type':Sequelize[_0x014a('0x1')]},'username':{'type':Sequelize[_0x014a('0x1')],'unique':_0x014a('0x2')},'apiKey':{'type':Sequelize[_0x014a('0x1')]},'remoteUri':{'type':Sequelize[_0x014a('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xbbbc=['remoteUri','sequelize','exports','STRING','username'];(function(_0x550d88,_0x2ce059){var _0xfdf5b=function(_0x21913){while(--_0x21913){_0x550d88['push'](_0x550d88['shift']());}};_0xfdf5b(++_0x2ce059);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x5826b9,_0x33996e){_0x5826b9=_0x5826b9-0x0;var _0x2e4805=_0xbbbc[_0x5826b9];return _0x2e4805;};'use strict';var Sequelize=require(_0xcbbb('0x0'));module[_0xcbbb('0x1')]={'name':{'type':Sequelize[_0xcbbb('0x2')]},'description':{'type':Sequelize[_0xcbbb('0x2')]},'username':{'type':Sequelize[_0xcbbb('0x2')],'unique':_0xcbbb('0x3')},'apiKey':{'type':Sequelize[_0xcbbb('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xcbbb('0x4')},'serverUrl':{'type':Sequelize[_0xcbbb('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 0ac00f5..7b0e523 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 _0xac7f=['getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','%s:X','toString','requester','subject','agent','priority','source','ticket_type','group','company','default','custom_text','custom_dropdown','label','choices','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','end','error','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','includeAll','find','create','body','params','getConfigurations','findOne','FreshdeskConfiguration','order','length','hasOwnProperty','addConfiguration','AccountId','Subjects','Descriptions'];(function(_0x492177,_0x248ad7){var _0x5c6b42=function(_0x4dcaf0){while(--_0x4dcaf0){_0x492177['push'](_0x492177['shift']());}};_0x5c6b42(++_0x248ad7);}(_0xac7f,0x1e2));var _0xfac7=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xac7f[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0xfac7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfac7('0x1'));var jsonpatch=require(_0xfac7('0x2'));var rp=require(_0xfac7('0x3'));var moment=require('moment');var BPromise=require(_0xfac7('0x4'));var Mustache=require(_0xfac7('0x5'));var util=require(_0xfac7('0x6'));var path=require(_0xfac7('0x7'));var sox=require(_0xfac7('0x8'));var csv=require(_0xfac7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfac7('0xa'));var _=require('lodash');var squel=require(_0xfac7('0xb'));var crypto=require(_0xfac7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfac7('0xd'));var toCsv=require(_0xfac7('0x9'));var querystring=require(_0xfac7('0xe'));var Papa=require('papaparse');var Redis=require(_0xfac7('0xf'));var authService=require(_0xfac7('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfac7('0x11'));var logger=require(_0xfac7('0x12'))(_0xfac7('0x13'));var utils=require(_0xfac7('0x14'));var config=require(_0xfac7('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xfac7('0x16'))['db'];var integrations=require(_0xfac7('0x17'));function respondWithStatusCode(_0x4111dd,_0x15da5d){_0x15da5d=_0x15da5d||0xcc;return function(_0x397b84){if(_0x397b84){return _0x4111dd[_0xfac7('0x18')](_0x15da5d);}return _0x4111dd['status'](_0x15da5d)['end']();};}function respondWithResult(_0x11a5fd,_0x5a3a06){_0x5a3a06=_0x5a3a06||0xc8;return function(_0x32d8c6){if(_0x32d8c6){return _0x11a5fd[_0xfac7('0x19')](_0x5a3a06)['json'](_0x32d8c6);}};}function respondWithFilteredResult(_0x1ff0f4,_0xc7a913){return function(_0x4b7479){if(_0x4b7479){var _0x4066db=typeof _0xc7a913[_0xfac7('0x1a')]===_0xfac7('0x1b')&&typeof _0xc7a913[_0xfac7('0x1c')]==='undefined';var _0x1e2323=_0x4b7479[_0xfac7('0x1d')];var _0x7fcbc2=_0x4066db?0x0:_0xc7a913[_0xfac7('0x1a')];var _0x40f807=_0x4066db?_0x4b7479[_0xfac7('0x1d')]:_0xc7a913[_0xfac7('0x1a')]+_0xc7a913[_0xfac7('0x1c')];var _0x3b2a4b;if(_0x40f807>=_0x1e2323){_0x40f807=_0x1e2323;_0x3b2a4b=0xc8;}else{_0x3b2a4b=0xce;}_0x1ff0f4['status'](_0x3b2a4b);return _0x1ff0f4['set'](_0xfac7('0x1e'),_0x7fcbc2+'-'+_0x40f807+'/'+_0x1e2323)[_0xfac7('0x1f')](_0x4b7479);}return null;};}function patchUpdates(_0x48d266){return function(_0x1325fc){try{jsonpatch[_0xfac7('0x20')](_0x1325fc,_0x48d266,!![]);}catch(_0x142116){return BPromise[_0xfac7('0x21')](_0x142116);}return _0x1325fc[_0xfac7('0x22')]();};}function saveUpdates(_0x147c3c,_0x2e8f11){return function(_0xe26ff5){if(_0xe26ff5){return _0xe26ff5[_0xfac7('0x23')](_0x147c3c)[_0xfac7('0x24')](function(_0x57958f){return _0x57958f;});}return null;};}function removeEntity(_0x83785e,_0x20c33c){return function(_0x2140db){if(_0x2140db){return _0x2140db[_0xfac7('0x25')]()[_0xfac7('0x24')](function(){_0x83785e['status'](0xcc)[_0xfac7('0x26')]();});}};}function handleEntityNotFound(_0xdf60cc,_0x2aa0a0){return function(_0x1661e9){if(!_0x1661e9){_0xdf60cc[_0xfac7('0x18')](0x194);}return _0x1661e9;};}function handleError(_0x195c13,_0x4ab1ed){_0x4ab1ed=_0x4ab1ed||0x1f4;return function(_0x3d1a84){logger[_0xfac7('0x27')](_0x3d1a84['stack']);if(_0x3d1a84[_0xfac7('0x28')]){delete _0x3d1a84[_0xfac7('0x28')];}_0x195c13[_0xfac7('0x19')](_0x4ab1ed)[_0xfac7('0x29')](_0x3d1a84);};}exports[_0xfac7('0x2a')]=function(_0x27c494,_0x4af388){var _0x3f9c66={},_0x49b341={},_0x1e190b={'count':0x0,'rows':[]};var _0x478f14=_[_0xfac7('0x2b')](db[_0xfac7('0x2c')][_0xfac7('0x2d')],function(_0x47d5ab){return{'name':_0x47d5ab[_0xfac7('0x2e')],'type':_0x47d5ab[_0xfac7('0x2f')][_0xfac7('0x30')]};});_0x49b341[_0xfac7('0x31')]=_[_0xfac7('0x2b')](_0x478f14,_0xfac7('0x28'));_0x49b341[_0xfac7('0x32')]=_[_0xfac7('0x33')](_0x27c494[_0xfac7('0x32')]);_0x49b341['filters']=_[_0xfac7('0x34')](_0x49b341[_0xfac7('0x31')],_0x49b341['query']);_0x3f9c66[_0xfac7('0x35')]=_[_0xfac7('0x34')](_0x49b341[_0xfac7('0x31')],qs[_0xfac7('0x36')](_0x27c494[_0xfac7('0x32')][_0xfac7('0x36')]));_0x3f9c66[_0xfac7('0x35')]=_0x3f9c66['attributes']['length']?_0x3f9c66[_0xfac7('0x35')]:_0x49b341['model'];if(!_0x27c494['query']['hasOwnProperty'](_0xfac7('0x37'))){_0x3f9c66[_0xfac7('0x1c')]=qs[_0xfac7('0x1c')](_0x27c494[_0xfac7('0x32')][_0xfac7('0x1c')]);_0x3f9c66['offset']=qs[_0xfac7('0x1a')](_0x27c494[_0xfac7('0x32')][_0xfac7('0x1a')]);}_0x3f9c66['order']=qs[_0xfac7('0x38')](_0x27c494['query'][_0xfac7('0x38')]);_0x3f9c66[_0xfac7('0x39')]=qs[_0xfac7('0x3a')](_[_0xfac7('0x3b')](_0x27c494[_0xfac7('0x32')],_0x49b341[_0xfac7('0x3a')]),_0x478f14);if(_0x27c494[_0xfac7('0x32')][_0xfac7('0x3c')]){_0x3f9c66[_0xfac7('0x39')]=_[_0xfac7('0x3d')](_0x3f9c66[_0xfac7('0x39')],{'$or':_[_0xfac7('0x2b')](_0x478f14,function(_0x1923cd){if(_0x1923cd[_0xfac7('0x2f')]!==_0xfac7('0x3e')){var _0x410f53={};_0x410f53[_0x1923cd['name']]={'$like':'%'+_0x27c494['query'][_0xfac7('0x3c')]+'%'};return _0x410f53;}})});}_0x3f9c66=_['merge']({},_0x3f9c66,_0x27c494[_0xfac7('0x3f')]);var _0x37f718={'where':_0x3f9c66['where']};return db[_0xfac7('0x2c')][_0xfac7('0x1d')](_0x37f718)[_0xfac7('0x24')](function(_0x3db48b){_0x1e190b[_0xfac7('0x1d')]=_0x3db48b;if(_0x27c494['query']['includeAll']){_0x3f9c66[_0xfac7('0x40')]=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x3f9c66);})[_0xfac7('0x24')](function(_0x1fc3ce){_0x1e190b[_0xfac7('0x41')]=_0x1fc3ce;return _0x1e190b;})[_0xfac7('0x24')](respondWithFilteredResult(_0x4af388,_0x3f9c66))[_0xfac7('0x42')](handleError(_0x4af388,null));};exports[_0xfac7('0x43')]=function(_0x420279,_0x357e86){var _0xee71b4={'raw':![],'where':{'id':_0x420279['params']['id']}},_0x5bf66b={};_0x5bf66b['model']=_['keys'](db['FreshdeskAccount']['rawAttributes']);_0x5bf66b[_0xfac7('0x32')]=_['keys'](_0x420279[_0xfac7('0x32')]);_0x5bf66b[_0xfac7('0x3a')]=_['intersection'](_0x5bf66b[_0xfac7('0x31')],_0x5bf66b[_0xfac7('0x32')]);_0xee71b4[_0xfac7('0x35')]=_[_0xfac7('0x34')](_0x5bf66b[_0xfac7('0x31')],qs['fields'](_0x420279[_0xfac7('0x32')][_0xfac7('0x36')]));_0xee71b4[_0xfac7('0x35')]=_0xee71b4[_0xfac7('0x35')]['length']?_0xee71b4[_0xfac7('0x35')]:_0x5bf66b['model'];if(_0x420279[_0xfac7('0x32')][_0xfac7('0x44')]){_0xee71b4[_0xfac7('0x40')]=[{'all':!![]}];}_0xee71b4=_[_0xfac7('0x3d')]({},_0xee71b4,_0x420279[_0xfac7('0x3f')]);return db[_0xfac7('0x2c')][_0xfac7('0x45')](_0xee71b4)[_0xfac7('0x24')](handleEntityNotFound(_0x357e86,null))[_0xfac7('0x24')](respondWithResult(_0x357e86,null))[_0xfac7('0x42')](handleError(_0x357e86,null));};exports[_0xfac7('0x46')]=function(_0x2d0056,_0x7aaa95){return db[_0xfac7('0x2c')][_0xfac7('0x46')](_0x2d0056[_0xfac7('0x47')],{})[_0xfac7('0x24')](respondWithResult(_0x7aaa95,0xc9))[_0xfac7('0x42')](handleError(_0x7aaa95,null));};exports[_0xfac7('0x23')]=function(_0x309a68,_0x5f3827){if(_0x309a68[_0xfac7('0x47')]['id']){delete _0x309a68['body']['id'];}return db[_0xfac7('0x2c')][_0xfac7('0x45')]({'where':{'id':_0x309a68[_0xfac7('0x48')]['id']}})[_0xfac7('0x24')](handleEntityNotFound(_0x5f3827,null))['then'](saveUpdates(_0x309a68[_0xfac7('0x47')],null))[_0xfac7('0x24')](respondWithResult(_0x5f3827,null))[_0xfac7('0x42')](handleError(_0x5f3827,null));};exports[_0xfac7('0x25')]=function(_0x129cd0,_0x569fef){return db[_0xfac7('0x2c')][_0xfac7('0x45')]({'where':{'id':_0x129cd0['params']['id']}})[_0xfac7('0x24')](handleEntityNotFound(_0x569fef,null))[_0xfac7('0x24')](removeEntity(_0x569fef,null))[_0xfac7('0x42')](handleError(_0x569fef,null));};exports[_0xfac7('0x49')]=function(_0x123934,_0x3b0f64,_0x2355f4){var _0x4fb9d2={};var _0x5f0693={};var _0x47bf52;var _0x2530d5;return db[_0xfac7('0x2c')][_0xfac7('0x4a')]({'where':{'id':_0x123934[_0xfac7('0x48')]['id']}})['then'](handleEntityNotFound(_0x3b0f64,null))[_0xfac7('0x24')](function(_0x1c686c){if(_0x1c686c){_0x47bf52=_0x1c686c;_0x5f0693['model']=_[_0xfac7('0x33')](db[_0xfac7('0x4b')][_0xfac7('0x2d')]);_0x5f0693['query']=_[_0xfac7('0x33')](_0x123934[_0xfac7('0x32')]);_0x5f0693['filters']=_[_0xfac7('0x34')](_0x5f0693['model'],_0x5f0693[_0xfac7('0x32')]);_0x4fb9d2[_0xfac7('0x35')]=_[_0xfac7('0x34')](_0x5f0693[_0xfac7('0x31')],qs[_0xfac7('0x36')](_0x123934[_0xfac7('0x32')][_0xfac7('0x36')]));_0x4fb9d2[_0xfac7('0x35')]=_0x4fb9d2[_0xfac7('0x35')]['length']?_0x4fb9d2[_0xfac7('0x35')]:_0x5f0693['model'];_0x4fb9d2[_0xfac7('0x4c')]=qs[_0xfac7('0x38')](_0x123934['query'][_0xfac7('0x38')]);_0x4fb9d2[_0xfac7('0x39')]=qs['filters'](_[_0xfac7('0x3b')](_0x123934['query'],_0x5f0693[_0xfac7('0x3a')]));if(_0x123934[_0xfac7('0x32')][_0xfac7('0x3c')]){_0x4fb9d2[_0xfac7('0x39')]=_['merge'](_0x4fb9d2[_0xfac7('0x39')],{'$or':_[_0xfac7('0x2b')](_0x4fb9d2[_0xfac7('0x35')],function(_0x2f4377){var _0x4c8c08={};_0x4c8c08[_0x2f4377]={'$like':'%'+_0x123934[_0xfac7('0x32')][_0xfac7('0x3c')]+'%'};return _0x4c8c08;})});}_0x4fb9d2=_[_0xfac7('0x3d')]({},_0x4fb9d2,_0x123934['options']);return _0x47bf52[_0xfac7('0x49')](_0x4fb9d2);}})[_0xfac7('0x24')](function(_0x8341be){if(_0x8341be){_0x2530d5=_0x8341be[_0xfac7('0x4d')];if(!_0x123934[_0xfac7('0x32')][_0xfac7('0x4e')](_0xfac7('0x37'))){_0x4fb9d2[_0xfac7('0x1c')]=qs[_0xfac7('0x1c')](_0x123934['query'][_0xfac7('0x1c')]);_0x4fb9d2[_0xfac7('0x1a')]=qs[_0xfac7('0x1a')](_0x123934['query'][_0xfac7('0x1a')]);}return _0x47bf52['getConfigurations'](_0x4fb9d2);}})[_0xfac7('0x24')](function(_0x55dc6c){if(_0x55dc6c){return _0x55dc6c?{'count':_0x2530d5,'rows':_0x55dc6c}:null;}})[_0xfac7('0x24')](respondWithResult(_0x3b0f64,null))[_0xfac7('0x42')](handleError(_0x3b0f64,null));};exports[_0xfac7('0x4f')]=function(_0x149f58,_0x1ade93,_0x1114fe){if(_0x149f58[_0xfac7('0x47')]['id']){delete _0x149f58[_0xfac7('0x47')]['id'];}return db[_0xfac7('0x2c')][_0xfac7('0x4a')]({'where':{'id':_0x149f58[_0xfac7('0x48')]['id']}})['then'](handleEntityNotFound(_0x1ade93,null))[_0xfac7('0x24')](function(_0x5cc158){if(_0x5cc158){_0x149f58[_0xfac7('0x47')][_0xfac7('0x50')]=_0x5cc158['id'];_0x149f58[_0xfac7('0x47')][_0xfac7('0x51')]=integrations['getSubjects'](_0x149f58['body']['channel'],_0x149f58[_0xfac7('0x47')][_0xfac7('0x2f')]);_0x149f58['body'][_0xfac7('0x52')]=integrations[_0xfac7('0x53')](_0x149f58[_0xfac7('0x47')]['channel'],_0x149f58[_0xfac7('0x47')][_0xfac7('0x2f')]);return db[_0xfac7('0x4b')][_0xfac7('0x46')](_0x149f58[_0xfac7('0x47')],{'include':[{'model':db[_0xfac7('0x54')],'as':_0xfac7('0x51')},{'model':db[_0xfac7('0x54')],'as':_0xfac7('0x52')}]});}return null;})[_0xfac7('0x24')](respondWithResult(_0x1ade93,null))['catch'](handleError(_0x1ade93,null));};exports[_0xfac7('0x55')]=function(_0x36f267,_0x3b4943,_0x2d91cd){var _0x5b09e6='';return db[_0xfac7('0x2c')][_0xfac7('0x4a')]({'where':{'id':_0x36f267[_0xfac7('0x48')]['id']},'attributes':['id',_0xfac7('0x56'),_0xfac7('0x57')]})[_0xfac7('0x24')](handleEntityNotFound(_0x3b4943,null))[_0xfac7('0x24')](function(_0x1ddfed){if(_0x1ddfed){_0x5b09e6=_0x1ddfed[_0xfac7('0x56')];var _0x1c27fc=_0x5b09e6[_0xfac7('0x58')](-0x1);if(_0x1c27fc==='/'){_0x5b09e6=_0x5b09e6[_0xfac7('0x59')](0x0,_0x5b09e6[_0xfac7('0x5a')](_0x1c27fc));}return rp({'method':'GET','uri':util[_0xfac7('0x5b')](_0xfac7('0x5c'),_0x5b09e6,_0xfac7('0x5d')),'headers':{'Authorization':util[_0xfac7('0x5b')]('Basic\x20%s',new Buffer(util[_0xfac7('0x5b')](_0xfac7('0x5e'),_0x1ddfed['apiKey']))[_0xfac7('0x5f')]('base64'))},'json':!![]});}})[_0xfac7('0x24')](function(_0x33edcd){if(_0x33edcd){var _0x186392=[_0xfac7('0x60'),_0xfac7('0x61'),_0xfac7('0x62'),'description',_0xfac7('0x19'),_0xfac7('0x63'),'group',_0xfac7('0x64'),_0xfac7('0x65'),_0xfac7('0x66'),_0xfac7('0x67')];_['remove'](_0x33edcd,function(_0x5569ce){return _0x186392['includes'](_0x5569ce[_0xfac7('0x28')])||!_0x5569ce[_0xfac7('0x68')]&&_0x5569ce['type']!==_0xfac7('0x69')&&_0x5569ce[_0xfac7('0x2f')]!==_0xfac7('0x6a');});return{'count':_0x33edcd['length'],'rows':_[_0xfac7('0x2b')](_0x33edcd,function(_0x2693e4){return{'id':_0x2693e4[_0xfac7('0x28')],'name':_0x2693e4[_0xfac7('0x6b')],'custom':!_0x2693e4['default'],'options':_0x2693e4[_0xfac7('0x6c')]?_[_0xfac7('0x2b')](_0x2693e4['choices'],function(_0x48d845){return{'name':_['capitalize'](_0x48d845),'value':_0x48d845};}):[]};})};}})[_0xfac7('0x24')](respondWithResult(_0x3b4943,null))[_0xfac7('0x42')](function(_0x513c49){var _0x50d703=_0x36f267['query']['test']?0x1f4:_0x513c49[_0xfac7('0x6d')]||0x1f4;logger[_0xfac7('0x27')](_0xfac7('0x6e'),_0xfac7('0x55'),_0x50d703,JSON[_0xfac7('0x6f')](_0x513c49));delete _0x513c49[_0xfac7('0x28')];if(_0x50d703===0x191){_0x50d703=0x190;}_0x3b4943['status'](_0x50d703)[_0xfac7('0x29')](_0x36f267[_0xfac7('0x32')]['test']?{'message':_0xfac7('0x70'),'statusCode':_0x513c49['statusCode']}:_0x513c49);});}; \ No newline at end of file +var _0xa45c=['ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','FreshdeskAccount','rawAttributes','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','type','options','includeAll','include','findAll','rows','catch','params','keys','merge','find','create','body','getConfigurations','findOne','order','filter','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshdeskConfiguration','FreshdeskField','apiKey','slice','substring','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','subject','agent','description','priority','source','ticket_type','group','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','request-promise','bluebird','util','to-csv'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xa45c,0x6d));var _0xca45=function(_0x598959,_0x50b8ff){_0x598959=_0x598959-0x0;var _0x56bb53=_0xa45c[_0x598959];return _0x56bb53;};'use strict';var emlformat=require(_0xca45('0x0'));var rimraf=require(_0xca45('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xca45('0x2'));var moment=require('moment');var BPromise=require(_0xca45('0x3'));var Mustache=require('mustache');var util=require(_0xca45('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xca45('0x5'));var ejs=require(_0xca45('0x6'));var fs=require('fs');var fs_extra=require(_0xca45('0x7'));var _=require(_0xca45('0x8'));var squel=require('squel');var crypto=require(_0xca45('0x9'));var jsforce=require(_0xca45('0xa'));var deskjs=require(_0xca45('0xb'));var toCsv=require(_0xca45('0x5'));var querystring=require(_0xca45('0xc'));var Papa=require('papaparse');var Redis=require(_0xca45('0xd'));var authService=require(_0xca45('0xe'));var qs=require(_0xca45('0xf'));var as=require(_0xca45('0x10'));var hardwareService=require(_0xca45('0x11'));var logger=require(_0xca45('0x12'))(_0xca45('0x13'));var utils=require('../../config/utils');var config=require(_0xca45('0x14'));var licenseUtil=require(_0xca45('0x15'));var db=require(_0xca45('0x16'))['db'];var integrations=require(_0xca45('0x17'));function respondWithStatusCode(_0x580c43,_0x3044b1){_0x3044b1=_0x3044b1||0xcc;return function(_0x711b03){if(_0x711b03){return _0x580c43[_0xca45('0x18')](_0x3044b1);}return _0x580c43['status'](_0x3044b1)[_0xca45('0x19')]();};}function respondWithResult(_0x569ba6,_0x22ce19){_0x22ce19=_0x22ce19||0xc8;return function(_0x311bf5){if(_0x311bf5){return _0x569ba6[_0xca45('0x1a')](_0x22ce19)[_0xca45('0x1b')](_0x311bf5);}};}function respondWithFilteredResult(_0x35b130,_0x323b19){return function(_0x18dd61){if(_0x18dd61){var _0x570784=typeof _0x323b19[_0xca45('0x1c')]==='undefined'&&typeof _0x323b19['limit']===_0xca45('0x1d');var _0x8d4b83=_0x18dd61['count'];var _0x2e18aa=_0x570784?0x0:_0x323b19[_0xca45('0x1c')];var _0x5820c8=_0x570784?_0x18dd61[_0xca45('0x1e')]:_0x323b19[_0xca45('0x1c')]+_0x323b19[_0xca45('0x1f')];var _0x11cbf0;if(_0x5820c8>=_0x8d4b83){_0x5820c8=_0x8d4b83;_0x11cbf0=0xc8;}else{_0x11cbf0=0xce;}_0x35b130['status'](_0x11cbf0);return _0x35b130[_0xca45('0x20')](_0xca45('0x21'),_0x2e18aa+'-'+_0x5820c8+'/'+_0x8d4b83)[_0xca45('0x1b')](_0x18dd61);}return null;};}function patchUpdates(_0xdea7de){return function(_0x548d0c){try{jsonpatch[_0xca45('0x22')](_0x548d0c,_0xdea7de,!![]);}catch(_0xb0fa27){return BPromise[_0xca45('0x23')](_0xb0fa27);}return _0x548d0c[_0xca45('0x24')]();};}function saveUpdates(_0x2068df,_0x3e8068){return function(_0x14816d){if(_0x14816d){return _0x14816d[_0xca45('0x25')](_0x2068df)[_0xca45('0x26')](function(_0x4998b5){return _0x4998b5;});}return null;};}function removeEntity(_0x3d9007,_0x1acb89){return function(_0x2cac3d){if(_0x2cac3d){return _0x2cac3d[_0xca45('0x27')]()[_0xca45('0x26')](function(){_0x3d9007['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d4869,_0x28d9f1){return function(_0x57f45b){if(!_0x57f45b){_0x4d4869['sendStatus'](0x194);}return _0x57f45b;};}function handleError(_0x3547cd,_0x3e3b03){_0x3e3b03=_0x3e3b03||0x1f4;return function(_0x8f5502){logger[_0xca45('0x28')](_0x8f5502[_0xca45('0x29')]);if(_0x8f5502['name']){delete _0x8f5502[_0xca45('0x2a')];}_0x3547cd[_0xca45('0x1a')](_0x3e3b03)[_0xca45('0x2b')](_0x8f5502);};}exports['index']=function(_0x4da9b6,_0x592ad2){var _0x430591={},_0x2e51b1={},_0x5cb991={'count':0x0,'rows':[]};var _0xa1870d=_[_0xca45('0x2c')](db[_0xca45('0x2d')][_0xca45('0x2e')],function(_0x52419e){return{'name':_0x52419e['fieldName'],'type':_0x52419e['type'][_0xca45('0x2f')]};});_0x2e51b1['model']=_['map'](_0xa1870d,'name');_0x2e51b1[_0xca45('0x30')]=_['keys'](_0x4da9b6['query']);_0x2e51b1[_0xca45('0x31')]=_[_0xca45('0x32')](_0x2e51b1[_0xca45('0x33')],_0x2e51b1['query']);_0x430591[_0xca45('0x34')]=_[_0xca45('0x32')](_0x2e51b1['model'],qs[_0xca45('0x35')](_0x4da9b6[_0xca45('0x30')][_0xca45('0x35')]));_0x430591[_0xca45('0x34')]=_0x430591[_0xca45('0x34')][_0xca45('0x36')]?_0x430591[_0xca45('0x34')]:_0x2e51b1[_0xca45('0x33')];if(!_0x4da9b6[_0xca45('0x30')][_0xca45('0x37')](_0xca45('0x38'))){_0x430591[_0xca45('0x1f')]=qs[_0xca45('0x1f')](_0x4da9b6['query']['limit']);_0x430591['offset']=qs[_0xca45('0x1c')](_0x4da9b6[_0xca45('0x30')]['offset']);}_0x430591['order']=qs[_0xca45('0x39')](_0x4da9b6['query'][_0xca45('0x39')]);_0x430591['where']=qs[_0xca45('0x31')](_[_0xca45('0x3a')](_0x4da9b6[_0xca45('0x30')],_0x2e51b1[_0xca45('0x31')]),_0xa1870d);if(_0x4da9b6[_0xca45('0x30')]['filter']){_0x430591[_0xca45('0x3b')]=_['merge'](_0x430591[_0xca45('0x3b')],{'$or':_[_0xca45('0x2c')](_0xa1870d,function(_0x23bc79){if(_0x23bc79[_0xca45('0x3c')]!=='VIRTUAL'){var _0x2be301={};_0x2be301[_0x23bc79[_0xca45('0x2a')]]={'$like':'%'+_0x4da9b6[_0xca45('0x30')]['filter']+'%'};return _0x2be301;}})});}_0x430591=_['merge']({},_0x430591,_0x4da9b6[_0xca45('0x3d')]);var _0x1b8400={'where':_0x430591[_0xca45('0x3b')]};return db[_0xca45('0x2d')][_0xca45('0x1e')](_0x1b8400)[_0xca45('0x26')](function(_0x3f1727){_0x5cb991[_0xca45('0x1e')]=_0x3f1727;if(_0x4da9b6[_0xca45('0x30')][_0xca45('0x3e')]){_0x430591[_0xca45('0x3f')]=[{'all':!![]}];}return db[_0xca45('0x2d')][_0xca45('0x40')](_0x430591);})[_0xca45('0x26')](function(_0x43303b){_0x5cb991[_0xca45('0x41')]=_0x43303b;return _0x5cb991;})[_0xca45('0x26')](respondWithFilteredResult(_0x592ad2,_0x430591))[_0xca45('0x42')](handleError(_0x592ad2,null));};exports['show']=function(_0x266a05,_0x3273e8){var _0x2ae7a2={'raw':![],'where':{'id':_0x266a05[_0xca45('0x43')]['id']}},_0x558bda={};_0x558bda[_0xca45('0x33')]=_[_0xca45('0x44')](db[_0xca45('0x2d')]['rawAttributes']);_0x558bda[_0xca45('0x30')]=_[_0xca45('0x44')](_0x266a05[_0xca45('0x30')]);_0x558bda[_0xca45('0x31')]=_[_0xca45('0x32')](_0x558bda[_0xca45('0x33')],_0x558bda[_0xca45('0x30')]);_0x2ae7a2[_0xca45('0x34')]=_[_0xca45('0x32')](_0x558bda[_0xca45('0x33')],qs[_0xca45('0x35')](_0x266a05[_0xca45('0x30')][_0xca45('0x35')]));_0x2ae7a2[_0xca45('0x34')]=_0x2ae7a2[_0xca45('0x34')][_0xca45('0x36')]?_0x2ae7a2[_0xca45('0x34')]:_0x558bda[_0xca45('0x33')];if(_0x266a05[_0xca45('0x30')]['includeAll']){_0x2ae7a2[_0xca45('0x3f')]=[{'all':!![]}];}_0x2ae7a2=_[_0xca45('0x45')]({},_0x2ae7a2,_0x266a05[_0xca45('0x3d')]);return db[_0xca45('0x2d')][_0xca45('0x46')](_0x2ae7a2)[_0xca45('0x26')](handleEntityNotFound(_0x3273e8,null))[_0xca45('0x26')](respondWithResult(_0x3273e8,null))[_0xca45('0x42')](handleError(_0x3273e8,null));};exports[_0xca45('0x47')]=function(_0x427bf5,_0x1b309c){return db[_0xca45('0x2d')][_0xca45('0x47')](_0x427bf5[_0xca45('0x48')],{})['then'](respondWithResult(_0x1b309c,0xc9))[_0xca45('0x42')](handleError(_0x1b309c,null));};exports[_0xca45('0x25')]=function(_0x2c6ed1,_0x1c2943){if(_0x2c6ed1[_0xca45('0x48')]['id']){delete _0x2c6ed1[_0xca45('0x48')]['id'];}return db[_0xca45('0x2d')][_0xca45('0x46')]({'where':{'id':_0x2c6ed1[_0xca45('0x43')]['id']}})[_0xca45('0x26')](handleEntityNotFound(_0x1c2943,null))[_0xca45('0x26')](saveUpdates(_0x2c6ed1['body'],null))['then'](respondWithResult(_0x1c2943,null))[_0xca45('0x42')](handleError(_0x1c2943,null));};exports[_0xca45('0x27')]=function(_0x56c0c0,_0x2cae35){return db[_0xca45('0x2d')][_0xca45('0x46')]({'where':{'id':_0x56c0c0[_0xca45('0x43')]['id']}})[_0xca45('0x26')](handleEntityNotFound(_0x2cae35,null))[_0xca45('0x26')](removeEntity(_0x2cae35,null))[_0xca45('0x42')](handleError(_0x2cae35,null));};exports[_0xca45('0x49')]=function(_0xa94c62,_0xcc6ac4,_0xcf2738){var _0x1e6300={};var _0x2f4ad2={};var _0x5b0a83;var _0x45de07;return db[_0xca45('0x2d')][_0xca45('0x4a')]({'where':{'id':_0xa94c62[_0xca45('0x43')]['id']}})[_0xca45('0x26')](handleEntityNotFound(_0xcc6ac4,null))[_0xca45('0x26')](function(_0x1b39b0){if(_0x1b39b0){_0x5b0a83=_0x1b39b0;_0x2f4ad2[_0xca45('0x33')]=_[_0xca45('0x44')](db['FreshdeskConfiguration']['rawAttributes']);_0x2f4ad2['query']=_['keys'](_0xa94c62[_0xca45('0x30')]);_0x2f4ad2[_0xca45('0x31')]=_[_0xca45('0x32')](_0x2f4ad2[_0xca45('0x33')],_0x2f4ad2['query']);_0x1e6300[_0xca45('0x34')]=_[_0xca45('0x32')](_0x2f4ad2['model'],qs[_0xca45('0x35')](_0xa94c62[_0xca45('0x30')]['fields']));_0x1e6300[_0xca45('0x34')]=_0x1e6300['attributes'][_0xca45('0x36')]?_0x1e6300['attributes']:_0x2f4ad2[_0xca45('0x33')];_0x1e6300[_0xca45('0x4b')]=qs['sort'](_0xa94c62['query'][_0xca45('0x39')]);_0x1e6300[_0xca45('0x3b')]=qs['filters'](_[_0xca45('0x3a')](_0xa94c62[_0xca45('0x30')],_0x2f4ad2[_0xca45('0x31')]));if(_0xa94c62['query'][_0xca45('0x4c')]){_0x1e6300[_0xca45('0x3b')]=_[_0xca45('0x45')](_0x1e6300[_0xca45('0x3b')],{'$or':_[_0xca45('0x2c')](_0x1e6300[_0xca45('0x34')],function(_0x2738ce){var _0x24498f={};_0x24498f[_0x2738ce]={'$like':'%'+_0xa94c62[_0xca45('0x30')]['filter']+'%'};return _0x24498f;})});}_0x1e6300=_[_0xca45('0x45')]({},_0x1e6300,_0xa94c62[_0xca45('0x3d')]);return _0x5b0a83[_0xca45('0x49')](_0x1e6300);}})[_0xca45('0x26')](function(_0x3c38f7){if(_0x3c38f7){_0x45de07=_0x3c38f7['length'];if(!_0xa94c62[_0xca45('0x30')]['hasOwnProperty']('nolimit')){_0x1e6300[_0xca45('0x1f')]=qs['limit'](_0xa94c62[_0xca45('0x30')][_0xca45('0x1f')]);_0x1e6300[_0xca45('0x1c')]=qs[_0xca45('0x1c')](_0xa94c62[_0xca45('0x30')]['offset']);}return _0x5b0a83[_0xca45('0x49')](_0x1e6300);}})[_0xca45('0x26')](function(_0x28d85a){if(_0x28d85a){return _0x28d85a?{'count':_0x45de07,'rows':_0x28d85a}:null;}})[_0xca45('0x26')](respondWithResult(_0xcc6ac4,null))[_0xca45('0x42')](handleError(_0xcc6ac4,null));};exports[_0xca45('0x4d')]=function(_0x22b1e8,_0x18e261,_0x1995de){if(_0x22b1e8['body']['id']){delete _0x22b1e8[_0xca45('0x48')]['id'];}return db[_0xca45('0x2d')][_0xca45('0x4a')]({'where':{'id':_0x22b1e8[_0xca45('0x43')]['id']}})[_0xca45('0x26')](handleEntityNotFound(_0x18e261,null))[_0xca45('0x26')](function(_0x37559c){if(_0x37559c){_0x22b1e8['body'][_0xca45('0x4e')]=_0x37559c['id'];_0x22b1e8[_0xca45('0x48')][_0xca45('0x4f')]=integrations['getSubjects'](_0x22b1e8[_0xca45('0x48')][_0xca45('0x50')],_0x22b1e8['body'][_0xca45('0x3c')]);_0x22b1e8[_0xca45('0x48')][_0xca45('0x51')]=integrations[_0xca45('0x52')](_0x22b1e8[_0xca45('0x48')][_0xca45('0x50')],_0x22b1e8[_0xca45('0x48')]['type']);return db[_0xca45('0x53')]['create'](_0x22b1e8['body'],{'include':[{'model':db[_0xca45('0x54')],'as':'Subjects'},{'model':db[_0xca45('0x54')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x18e261,null))[_0xca45('0x42')](handleError(_0x18e261,null));};exports['getFields']=function(_0x36c617,_0x10c0e0,_0x11ebe7){var _0x4f210='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x36c617['params']['id']},'attributes':['id','remoteUri',_0xca45('0x55')]})['then'](handleEntityNotFound(_0x10c0e0,null))[_0xca45('0x26')](function(_0x9490be){if(_0x9490be){_0x4f210=_0x9490be['remoteUri'];var _0x2f3237=_0x4f210[_0xca45('0x56')](-0x1);if(_0x2f3237==='/'){_0x4f210=_0x4f210[_0xca45('0x57')](0x0,_0x4f210['lastIndexOf'](_0x2f3237));}return rp({'method':_0xca45('0x58'),'uri':util[_0xca45('0x59')](_0xca45('0x5a'),_0x4f210,_0xca45('0x5b')),'headers':{'Authorization':util['format'](_0xca45('0x5c'),new Buffer(util['format'](_0xca45('0x5d'),_0x9490be[_0xca45('0x55')]))[_0xca45('0x5e')](_0xca45('0x5f')))},'json':!![]});}})[_0xca45('0x26')](function(_0x3ae1f4){if(_0x3ae1f4){var _0xf467f2=['requester',_0xca45('0x60'),_0xca45('0x61'),_0xca45('0x62'),'status',_0xca45('0x63'),'group',_0xca45('0x64'),_0xca45('0x65'),_0xca45('0x66'),'company'];_[_0xca45('0x67')](_0x3ae1f4,function(_0x38a333){return _0xf467f2[_0xca45('0x68')](_0x38a333[_0xca45('0x2a')])||!_0x38a333[_0xca45('0x69')]&&_0x38a333['type']!==_0xca45('0x6a')&&_0x38a333[_0xca45('0x3c')]!==_0xca45('0x6b');});return{'count':_0x3ae1f4[_0xca45('0x36')],'rows':_[_0xca45('0x2c')](_0x3ae1f4,function(_0x15817c){return{'id':_0x15817c[_0xca45('0x2a')],'name':_0x15817c[_0xca45('0x6c')],'custom':!_0x15817c['default'],'options':_0x15817c[_0xca45('0x6d')]?_[_0xca45('0x2c')](_0x15817c[_0xca45('0x6d')],function(_0x1b947b){return{'name':_[_0xca45('0x6e')](_0x1b947b),'value':_0x1b947b};}):[]};})};}})[_0xca45('0x26')](respondWithResult(_0x10c0e0,null))['catch'](function(_0x4cbd02){var _0xbd8854=_0x36c617[_0xca45('0x30')][_0xca45('0x6f')]?0x1f4:_0x4cbd02['statusCode']||0x1f4;logger[_0xca45('0x28')](_0xca45('0x70'),_0xca45('0x71'),_0xbd8854,JSON['stringify'](_0x4cbd02));delete _0x4cbd02[_0xca45('0x2a')];if(_0xbd8854===0x191){_0xbd8854=0x190;}_0x10c0e0['status'](_0xbd8854)[_0xca45('0x2b')](_0x36c617[_0xca45('0x30')]['test']?{'message':_0xca45('0x72'),'statusCode':_0x4cbd02['statusCode']}:_0x4cbd02);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 2b7c990..cc4bf7f 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 _0x06d6=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intFreshdeskAccount.attributes','define','FreshdeskAccount','int_freshdesk_accounts','lodash'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x06d6,0x11f));var _0x606d=function(_0xccdc92,_0x5abaef){_0xccdc92=_0xccdc92-0x0;var _0x10015d=_0x06d6[_0xccdc92];return _0x10015d;};'use strict';var _=require(_0x606d('0x0'));var util=require(_0x606d('0x1'));var logger=require(_0x606d('0x2'))(_0x606d('0x3'));var moment=require(_0x606d('0x4'));var BPromise=require(_0x606d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x606d('0x6'));var config=require(_0x606d('0x7'));var attributes=require(_0x606d('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x4a5c70,_0x499803){return _0x4a5c70[_0x606d('0x9')](_0x606d('0xa'),attributes,{'tableName':_0x606d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5e2=['define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','api','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x43652f,_0x5e5d2b){var _0x3afef2=function(_0x21cae1){while(--_0x21cae1){_0x43652f['push'](_0x43652f['shift']());}};_0x3afef2(++_0x5e5d2b);}(_0xb5e2,0xab));var _0x2b5e=function(_0x27781c,_0x44e4bf){_0x27781c=_0x27781c-0x0;var _0x21a1b1=_0xb5e2[_0x27781c];return _0x21a1b1;};'use strict';var _=require(_0x2b5e('0x0'));var util=require(_0x2b5e('0x1'));var logger=require('../../config/logger')(_0x2b5e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b5e('0x3'));var rimraf=require(_0x2b5e('0x4'));var config=require(_0x2b5e('0x5'));var attributes=require(_0x2b5e('0x6'));var integrations=require(_0x2b5e('0x7'));module[_0x2b5e('0x8')]=function(_0x2f430f,_0x482f74){return _0x2f430f[_0x2b5e('0x9')](_0x2b5e('0xa'),attributes,{'tableName':_0x2b5e('0xb'),'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 2fd41b6..6e57452 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 _0x9d7c=['error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','findAll','options','raw','where','attributes','map','include','model','GetFreshdeskAccount','ShowFreshdeskAccount','FreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9d7c,0x1e6));var _0xc9d7=function(_0x15a833,_0x5092d6){_0x15a833=_0x15a833-0x0;var _0x371593=_0x9d7c[_0x15a833];return _0x371593;};'use strict';var _=require(_0xc9d7('0x0'));var util=require(_0xc9d7('0x1'));var moment=require(_0xc9d7('0x2'));var BPromise=require(_0xc9d7('0x3'));var rs=require(_0xc9d7('0x4'));var fs=require('fs');var Redis=require(_0xc9d7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9d7('0x6'));var logger=require(_0xc9d7('0x7'))(_0xc9d7('0x8'));var config=require(_0xc9d7('0x9'));var jayson=require(_0xc9d7('0xa'));var client=jayson[_0xc9d7('0xb')][_0xc9d7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4d8bf6,_0x4baec5,_0x5c34ca){return new BPromise(function(_0x285e81,_0x387250){return client['request'](_0x4d8bf6,_0x5c34ca)[_0xc9d7('0xd')](function(_0x4d1a56){logger[_0xc9d7('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x4baec5,_0xc9d7('0xf'));logger[_0xc9d7('0x10')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x4baec5,_0xc9d7('0xf'),JSON[_0xc9d7('0x11')](_0x4d1a56));if(_0x4d1a56[_0xc9d7('0x12')]){if(_0x4d1a56[_0xc9d7('0x12')][_0xc9d7('0x13')]===0x1f4){logger[_0xc9d7('0x12')](_0xc9d7('0x14'),_0x4baec5,_0x4d1a56['error'][_0xc9d7('0x15')]);return _0x387250(_0x4d1a56[_0xc9d7('0x12')][_0xc9d7('0x15')]);}logger[_0xc9d7('0x12')](_0xc9d7('0x14'),_0x4baec5,_0x4d1a56['error'][_0xc9d7('0x15')]);return _0x285e81(_0x4d1a56['error'][_0xc9d7('0x15')]);}else{logger[_0xc9d7('0xe')](_0xc9d7('0x14'),_0x4baec5,_0xc9d7('0xf'));_0x285e81(_0x4d1a56[_0xc9d7('0x16')][_0xc9d7('0x15')]);}})[_0xc9d7('0x17')](function(_0x4e03ab){logger[_0xc9d7('0x12')](_0xc9d7('0x14'),_0x4baec5,_0x4e03ab);_0x387250(_0x4e03ab);});});}exports['GetFreshdeskAccount']=function(_0x215cda){var _0x26b6ea=this;return new Promise(function(_0xf2c2ab,_0xb5567f){return db['FreshdeskAccount'][_0xc9d7('0x18')]({'raw':_0x215cda['options']?_0x215cda[_0xc9d7('0x19')][_0xc9d7('0x1a')]===undefined?!![]:![]:!![],'where':_0x215cda[_0xc9d7('0x19')]?_0x215cda['options'][_0xc9d7('0x1b')]||null:null,'attributes':_0x215cda[_0xc9d7('0x19')]?_0x215cda[_0xc9d7('0x19')][_0xc9d7('0x1c')]||null:null,'limit':_0x215cda[_0xc9d7('0x19')]?_0x215cda['options']['limit']||null:null,'include':_0x215cda[_0xc9d7('0x19')]?_0x215cda[_0xc9d7('0x19')]['include']?_[_0xc9d7('0x1d')](_0x215cda['options']['include'],function(_0x4a6f17){return{'model':db[_0x4a6f17['model']],'as':_0x4a6f17['as'],'attributes':_0x4a6f17[_0xc9d7('0x1c')],'include':_0x4a6f17[_0xc9d7('0x1e')]?_[_0xc9d7('0x1d')](_0x4a6f17[_0xc9d7('0x1e')],function(_0x4eab05){return{'model':db[_0x4eab05[_0xc9d7('0x1f')]],'as':_0x4eab05['as'],'attributes':_0x4eab05[_0xc9d7('0x1c')],'include':_0x4eab05['include']?_[_0xc9d7('0x1d')](_0x4eab05[_0xc9d7('0x1e')],function(_0x44022f){return{'model':db[_0x44022f[_0xc9d7('0x1f')]],'as':_0x44022f['as'],'attributes':_0x44022f[_0xc9d7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc9d7('0xd')](function(_0x466193){logger[_0xc9d7('0xe')]('GetFreshdeskAccount',_0x215cda);logger[_0xc9d7('0x10')](_0xc9d7('0x20'),_0x215cda,JSON[_0xc9d7('0x11')](_0x466193));_0xf2c2ab(_0x466193);})[_0xc9d7('0x17')](function(_0x4db123){logger['error']('GetFreshdeskAccount',_0x4db123[_0xc9d7('0x15')],_0x215cda);_0xb5567f(_0x26b6ea[_0xc9d7('0x12')](0x1f4,_0x4db123['message']));});});};exports[_0xc9d7('0x21')]=function(_0xa2ecae){var _0x10d14b=this;return new Promise(function(_0x211629,_0x5140b7){return db[_0xc9d7('0x22')][_0xc9d7('0x23')]({'raw':_0xa2ecae[_0xc9d7('0x19')]?_0xa2ecae[_0xc9d7('0x19')][_0xc9d7('0x1a')]===undefined?!![]:![]:!![],'where':_0xa2ecae[_0xc9d7('0x19')]?_0xa2ecae[_0xc9d7('0x19')]['where']||null:null,'attributes':_0xa2ecae[_0xc9d7('0x19')]?_0xa2ecae['options'][_0xc9d7('0x1c')]||null:null,'include':_0xa2ecae[_0xc9d7('0x19')]?_0xa2ecae[_0xc9d7('0x19')]['include']?_['map'](_0xa2ecae[_0xc9d7('0x19')][_0xc9d7('0x1e')],function(_0xfea15d){return{'model':db[_0xfea15d[_0xc9d7('0x1f')]],'as':_0xfea15d['as'],'attributes':_0xfea15d[_0xc9d7('0x1c')],'include':_0xfea15d[_0xc9d7('0x1e')]?_[_0xc9d7('0x1d')](_0xfea15d[_0xc9d7('0x1e')],function(_0x501549){return{'model':db[_0x501549[_0xc9d7('0x1f')]],'as':_0x501549['as'],'attributes':_0x501549['attributes'],'include':_0x501549[_0xc9d7('0x1e')]?_[_0xc9d7('0x1d')](_0x501549['include'],function(_0x347e43){return{'model':db[_0x347e43[_0xc9d7('0x1f')]],'as':_0x347e43['as'],'attributes':_0x347e43[_0xc9d7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc9d7('0xd')](function(_0x4ad773){logger['info'](_0xc9d7('0x21'),_0xa2ecae);logger[_0xc9d7('0x10')]('ShowFreshdeskAccount',_0xa2ecae,JSON['stringify'](_0x4ad773));_0x211629(_0x4ad773);})[_0xc9d7('0x17')](function(_0x4b11e8){logger[_0xc9d7('0x12')](_0xc9d7('0x21'),_0x4b11e8[_0xc9d7('0x15')],_0xa2ecae);_0x5140b7(_0x10d14b[_0xc9d7('0x12')](0x1f4,_0x4b11e8['message']));});});}; \ No newline at end of file +var _0x0b57=['find','raw','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','limit','include','map','model','attributes','debug','ShowFreshdeskAccount'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x0b57,0x8a));var _0x70b5=function(_0x1ee5ef,_0x38d42b){_0x1ee5ef=_0x1ee5ef-0x0;var _0x448ab8=_0x0b57[_0x1ee5ef];return _0x448ab8;};'use strict';var _=require(_0x70b5('0x0'));var util=require(_0x70b5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x70b5('0x2'));var fs=require('fs');var Redis=require(_0x70b5('0x3'));var db=require(_0x70b5('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x70b5('0x5'));var config=require(_0x70b5('0x6'));var jayson=require(_0x70b5('0x7'));var client=jayson[_0x70b5('0x8')][_0x70b5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x459a4b,_0x56f0f5,_0x74bcdb){return new BPromise(function(_0x5b4fc0,_0x5be7e6){return client['request'](_0x459a4b,_0x74bcdb)[_0x70b5('0xa')](function(_0x5dc4fb){logger[_0x70b5('0xb')](_0x70b5('0xc'),_0x56f0f5,'request\x20sent');logger['debug'](_0x70b5('0xd'),_0x56f0f5,'request\x20sent',JSON[_0x70b5('0xe')](_0x5dc4fb));if(_0x5dc4fb['error']){if(_0x5dc4fb[_0x70b5('0xf')][_0x70b5('0x10')]===0x1f4){logger[_0x70b5('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x56f0f5,_0x5dc4fb[_0x70b5('0xf')]['message']);return _0x5be7e6(_0x5dc4fb[_0x70b5('0xf')]['message']);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x56f0f5,_0x5dc4fb[_0x70b5('0xf')]['message']);return _0x5b4fc0(_0x5dc4fb[_0x70b5('0xf')][_0x70b5('0x11')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x56f0f5,'request\x20sent');_0x5b4fc0(_0x5dc4fb[_0x70b5('0x12')]['message']);}})[_0x70b5('0x13')](function(_0x5c8ab1){logger[_0x70b5('0xf')](_0x70b5('0xc'),_0x56f0f5,_0x5c8ab1);_0x5be7e6(_0x5c8ab1);});});}exports[_0x70b5('0x14')]=function(_0x3b8e66){var _0x40e2a6=this;return new Promise(function(_0x19f0c2,_0x447fca){return db[_0x70b5('0x15')][_0x70b5('0x16')]({'raw':_0x3b8e66[_0x70b5('0x17')]?_0x3b8e66[_0x70b5('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3b8e66[_0x70b5('0x17')]?_0x3b8e66['options'][_0x70b5('0x18')]||null:null,'attributes':_0x3b8e66[_0x70b5('0x17')]?_0x3b8e66[_0x70b5('0x17')]['attributes']||null:null,'limit':_0x3b8e66[_0x70b5('0x17')]?_0x3b8e66[_0x70b5('0x17')][_0x70b5('0x19')]||null:null,'include':_0x3b8e66[_0x70b5('0x17')]?_0x3b8e66['options'][_0x70b5('0x1a')]?_[_0x70b5('0x1b')](_0x3b8e66['options'][_0x70b5('0x1a')],function(_0x1f8dcf){return{'model':db[_0x1f8dcf[_0x70b5('0x1c')]],'as':_0x1f8dcf['as'],'attributes':_0x1f8dcf[_0x70b5('0x1d')],'include':_0x1f8dcf['include']?_[_0x70b5('0x1b')](_0x1f8dcf['include'],function(_0x505d4b){return{'model':db[_0x505d4b[_0x70b5('0x1c')]],'as':_0x505d4b['as'],'attributes':_0x505d4b['attributes'],'include':_0x505d4b[_0x70b5('0x1a')]?_[_0x70b5('0x1b')](_0x505d4b[_0x70b5('0x1a')],function(_0x4275da){return{'model':db[_0x4275da[_0x70b5('0x1c')]],'as':_0x4275da['as'],'attributes':_0x4275da['attributes']};}):[]};}):[]};}):[]:[]})[_0x70b5('0xa')](function(_0x142025){logger[_0x70b5('0xb')](_0x70b5('0x14'),_0x3b8e66);logger[_0x70b5('0x1e')](_0x70b5('0x14'),_0x3b8e66,JSON['stringify'](_0x142025));_0x19f0c2(_0x142025);})['catch'](function(_0x1c3c1c){logger[_0x70b5('0xf')](_0x70b5('0x14'),_0x1c3c1c[_0x70b5('0x11')],_0x3b8e66);_0x447fca(_0x40e2a6['error'](0x1f4,_0x1c3c1c['message']));});});};exports[_0x70b5('0x1f')]=function(_0x5156c6){var _0x38be9a=this;return new Promise(function(_0x1b8b10,_0x2d1011){return db[_0x70b5('0x15')][_0x70b5('0x20')]({'raw':_0x5156c6['options']?_0x5156c6[_0x70b5('0x17')][_0x70b5('0x21')]===undefined?!![]:![]:!![],'where':_0x5156c6[_0x70b5('0x17')]?_0x5156c6[_0x70b5('0x17')][_0x70b5('0x18')]||null:null,'attributes':_0x5156c6[_0x70b5('0x17')]?_0x5156c6[_0x70b5('0x17')][_0x70b5('0x1d')]||null:null,'include':_0x5156c6['options']?_0x5156c6[_0x70b5('0x17')][_0x70b5('0x1a')]?_[_0x70b5('0x1b')](_0x5156c6[_0x70b5('0x17')][_0x70b5('0x1a')],function(_0x15e188){return{'model':db[_0x15e188['model']],'as':_0x15e188['as'],'attributes':_0x15e188[_0x70b5('0x1d')],'include':_0x15e188[_0x70b5('0x1a')]?_[_0x70b5('0x1b')](_0x15e188[_0x70b5('0x1a')],function(_0x5a1616){return{'model':db[_0x5a1616[_0x70b5('0x1c')]],'as':_0x5a1616['as'],'attributes':_0x5a1616[_0x70b5('0x1d')],'include':_0x5a1616['include']?_[_0x70b5('0x1b')](_0x5a1616[_0x70b5('0x1a')],function(_0x5bc063){return{'model':db[_0x5bc063[_0x70b5('0x1c')]],'as':_0x5bc063['as'],'attributes':_0x5bc063[_0x70b5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x70b5('0xa')](function(_0xe96ded){logger[_0x70b5('0xb')](_0x70b5('0x1f'),_0x5156c6);logger[_0x70b5('0x1e')](_0x70b5('0x1f'),_0x5156c6,JSON[_0x70b5('0xe')](_0xe96ded));_0x1b8b10(_0xe96ded);})[_0x70b5('0x13')](function(_0x598222){logger[_0x70b5('0xf')]('ShowFreshdeskAccount',_0x598222[_0x70b5('0x11')],_0x5156c6);_0x2d1011(_0x38be9a[_0x70b5('0xf')](0x1f4,_0x598222['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 6dc1824..19695e4 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 _0x4647=['isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getTags','create','post','/:id/tags','setTags','put','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x65c9d8,_0x5952fc){var _0x52de83=function(_0x2365da){while(--_0x2365da){_0x65c9d8['push'](_0x65c9d8['shift']());}};_0x52de83(++_0x5952fc);}(_0x4647,0x122));var _0x7464=function(_0x2d1564,_0x3edec9){_0x2d1564=_0x2d1564-0x0;var _0x1e95ec=_0x4647[_0x2d1564];return _0x1e95ec;};'use strict';var multer=require(_0x7464('0x0'));var util=require(_0x7464('0x1'));var path=require(_0x7464('0x2'));var timeout=require(_0x7464('0x3'));var express=require(_0x7464('0x4'));var router=express[_0x7464('0x5')]();var fs_extra=require(_0x7464('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7464('0x7'));var config=require(_0x7464('0x8'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x7464('0x9')]('/',auth[_0x7464('0xa')](),controller[_0x7464('0xb')]);router[_0x7464('0x9')](_0x7464('0xc'),auth['isAuthenticated'](),controller[_0x7464('0xd')]);router[_0x7464('0x9')](_0x7464('0xe'),auth[_0x7464('0xa')](),controller[_0x7464('0xf')]);router[_0x7464('0x9')]('/:id/subjects',auth[_0x7464('0xa')](),controller[_0x7464('0x10')]);router[_0x7464('0x9')](_0x7464('0x11'),auth[_0x7464('0xa')](),controller['getDescriptions']);router[_0x7464('0x9')]('/:id/tags',auth[_0x7464('0xa')](),controller[_0x7464('0x12')]);router['post']('/',auth[_0x7464('0xa')](),controller[_0x7464('0x13')]);router[_0x7464('0x14')](_0x7464('0x15'),auth['isAuthenticated'](),controller[_0x7464('0x16')]);router[_0x7464('0x17')](_0x7464('0xc'),auth[_0x7464('0xa')](),controller['update']);router['delete'](_0x7464('0xc'),auth[_0x7464('0xa')](),controller[_0x7464('0x18')]);module['exports']=router; \ No newline at end of file +var _0xb158=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id/fields','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','destroy','exports'];(function(_0x39e046,_0x300df1){var _0x1ecbbc=function(_0x30ff60){while(--_0x30ff60){_0x39e046['push'](_0x39e046['shift']());}};_0x1ecbbc(++_0x300df1);}(_0xb158,0x1b8));var _0x8b15=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xb158[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require('multer');var util=require(_0x8b15('0x0'));var path=require(_0x8b15('0x1'));var timeout=require(_0x8b15('0x2'));var express=require(_0x8b15('0x3'));var router=express[_0x8b15('0x4')]();var fs_extra=require(_0x8b15('0x5'));var auth=require(_0x8b15('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8b15('0x7'));router[_0x8b15('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8b15('0x8')]('/:id',auth[_0x8b15('0x9')](),controller['show']);router[_0x8b15('0x8')](_0x8b15('0xa'),auth['isAuthenticated'](),controller[_0x8b15('0xb')]);router['get']('/:id/subjects',auth[_0x8b15('0x9')](),controller['getSubjects']);router[_0x8b15('0x8')](_0x8b15('0xc'),auth[_0x8b15('0x9')](),controller[_0x8b15('0xd')]);router[_0x8b15('0x8')](_0x8b15('0xe'),auth['isAuthenticated'](),controller[_0x8b15('0xf')]);router[_0x8b15('0x10')]('/',auth[_0x8b15('0x9')](),controller['create']);router[_0x8b15('0x10')](_0x8b15('0xe'),auth[_0x8b15('0x9')](),controller[_0x8b15('0x11')]);router[_0x8b15('0x12')](_0x8b15('0x13'),auth[_0x8b15('0x9')](),controller['update']);router['delete'](_0x8b15('0x13'),auth[_0x8b15('0x9')](),controller[_0x8b15('0x14')]);module[_0x8b15('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index fc341d4..a24a62e 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 _0x3bac=['sequelize','exports','STRING'];(function(_0x54bac5,_0x8d3a16){var _0xc15971=function(_0x254653){while(--_0x254653){_0x54bac5['push'](_0x54bac5['shift']());}};_0xc15971(++_0x8d3a16);}(_0x3bac,0x102));var _0xc3ba=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x3bac[_0x3b5250];return _0xc844a1;};'use strict';var Sequelize=require(_0xc3ba('0x0'));module[_0xc3ba('0x1')]={'name':{'type':Sequelize[_0xc3ba('0x2')]},'description':{'type':Sequelize[_0xc3ba('0x2')]}}; \ No newline at end of file +var _0x40ea=['STRING','exports'];(function(_0x29b5a7,_0x3a0ba2){var _0x5c72e8=function(_0xfad76c){while(--_0xfad76c){_0x29b5a7['push'](_0x29b5a7['shift']());}};_0x5c72e8(++_0x3a0ba2);}(_0x40ea,0x1f3));var _0xa40e=function(_0x49c718,_0x10098a){_0x49c718=_0x49c718-0x0;var _0x517906=_0x40ea[_0x49c718];return _0x517906;};'use strict';var Sequelize=require('sequelize');module[_0xa40e('0x0')]={'name':{'type':Sequelize[_0xa40e('0x1')]},'description':{'type':Sequelize[_0xa40e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 7da0af8..34173ac 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 _0x661a=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','count','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','getFields','findOne','FreshdeskField','hasOwnProperty','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format'];(function(_0x2c286c,_0x420ad6){var _0x41c850=function(_0x3f8670){while(--_0x3f8670){_0x2c286c['push'](_0x2c286c['shift']());}};_0x41c850(++_0x420ad6);}(_0x661a,0x107));var _0xa661=function(_0x49052b,_0x3ba709){_0x49052b=_0x49052b-0x0;var _0x48c045=_0x661a[_0x49052b];return _0x48c045;};'use strict';var emlformat=require(_0xa661('0x0'));var rimraf=require(_0xa661('0x1'));var zipdir=require(_0xa661('0x2'));var jsonpatch=require(_0xa661('0x3'));var rp=require('request-promise');var moment=require(_0xa661('0x4'));var BPromise=require(_0xa661('0x5'));var Mustache=require(_0xa661('0x6'));var util=require('util');var path=require(_0xa661('0x7'));var sox=require(_0xa661('0x8'));var csv=require(_0xa661('0x9'));var ejs=require(_0xa661('0xa'));var fs=require('fs');var fs_extra=require(_0xa661('0xb'));var _=require('lodash');var squel=require(_0xa661('0xc'));var crypto=require(_0xa661('0xd'));var jsforce=require(_0xa661('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa661('0x9'));var querystring=require(_0xa661('0xf'));var Papa=require(_0xa661('0x10'));var Redis=require(_0xa661('0x11'));var authService=require(_0xa661('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa661('0x13'));var hardwareService=require(_0xa661('0x14'));var logger=require(_0xa661('0x15'))(_0xa661('0x16'));var utils=require(_0xa661('0x17'));var config=require(_0xa661('0x18'));var licenseUtil=require(_0xa661('0x19'));var db=require(_0xa661('0x1a'))['db'];function respondWithStatusCode(_0x449372,_0x47b1fd){_0x47b1fd=_0x47b1fd||0xcc;return function(_0x43f973){if(_0x43f973){return _0x449372[_0xa661('0x1b')](_0x47b1fd);}return _0x449372[_0xa661('0x1c')](_0x47b1fd)[_0xa661('0x1d')]();};}function respondWithResult(_0x4bfd6e,_0xdaaeed){_0xdaaeed=_0xdaaeed||0xc8;return function(_0x2d410c){if(_0x2d410c){return _0x4bfd6e[_0xa661('0x1c')](_0xdaaeed)['json'](_0x2d410c);}};}function respondWithFilteredResult(_0x2c446f,_0x14baad){return function(_0x157f54){if(_0x157f54){var _0x5139f8=typeof _0x14baad[_0xa661('0x1e')]==='undefined'&&typeof _0x14baad['limit']==='undefined';var _0xcd28e8=_0x157f54[_0xa661('0x1f')];var _0x47e20b=_0x5139f8?0x0:_0x14baad[_0xa661('0x1e')];var _0x7504ac=_0x5139f8?_0x157f54['count']:_0x14baad['offset']+_0x14baad[_0xa661('0x20')];var _0x1c1471;if(_0x7504ac>=_0xcd28e8){_0x7504ac=_0xcd28e8;_0x1c1471=0xc8;}else{_0x1c1471=0xce;}_0x2c446f[_0xa661('0x1c')](_0x1c1471);return _0x2c446f[_0xa661('0x21')]('Content-Range',_0x47e20b+'-'+_0x7504ac+'/'+_0xcd28e8)[_0xa661('0x22')](_0x157f54);}return null;};}function patchUpdates(_0x214024){return function(_0x57262d){try{jsonpatch[_0xa661('0x23')](_0x57262d,_0x214024,!![]);}catch(_0x10f784){return BPromise[_0xa661('0x24')](_0x10f784);}return _0x57262d[_0xa661('0x25')]();};}function saveUpdates(_0x31c70b,_0x37d479){return function(_0xcabb87){if(_0xcabb87){return _0xcabb87['update'](_0x31c70b)[_0xa661('0x26')](function(_0x370753){return _0x370753;});}return null;};}function removeEntity(_0x5544af,_0x507337){return function(_0x26b532){if(_0x26b532){return _0x26b532[_0xa661('0x27')]()[_0xa661('0x26')](function(){_0x5544af['status'](0xcc)[_0xa661('0x1d')]();});}};}function handleEntityNotFound(_0x5d4dca,_0x41b61a){return function(_0x226023){if(!_0x226023){_0x5d4dca[_0xa661('0x1b')](0x194);}return _0x226023;};}function handleError(_0x326f4f,_0x20a554){_0x20a554=_0x20a554||0x1f4;return function(_0x26fbaf){logger[_0xa661('0x28')](_0x26fbaf[_0xa661('0x29')]);if(_0x26fbaf[_0xa661('0x2a')]){delete _0x26fbaf[_0xa661('0x2a')];}_0x326f4f['status'](_0x20a554)['send'](_0x26fbaf);};}exports[_0xa661('0x2b')]=function(_0xff2926,_0x16532b){var _0xee6c92={},_0x49108e={},_0x4e3e3d={'count':0x0,'rows':[]};var _0x5246ef=_[_0xa661('0x2c')](db[_0xa661('0x2d')][_0xa661('0x2e')],function(_0x431724){return{'name':_0x431724[_0xa661('0x2f')],'type':_0x431724[_0xa661('0x30')][_0xa661('0x31')]};});_0x49108e['model']=_[_0xa661('0x2c')](_0x5246ef,_0xa661('0x2a'));_0x49108e[_0xa661('0x32')]=_[_0xa661('0x33')](_0xff2926[_0xa661('0x32')]);_0x49108e[_0xa661('0x34')]=_[_0xa661('0x35')](_0x49108e[_0xa661('0x36')],_0x49108e[_0xa661('0x32')]);_0xee6c92[_0xa661('0x37')]=_['intersection'](_0x49108e[_0xa661('0x36')],qs[_0xa661('0x38')](_0xff2926[_0xa661('0x32')][_0xa661('0x38')]));_0xee6c92[_0xa661('0x37')]=_0xee6c92['attributes'][_0xa661('0x39')]?_0xee6c92[_0xa661('0x37')]:_0x49108e[_0xa661('0x36')];if(!_0xff2926['query']['hasOwnProperty'](_0xa661('0x3a'))){_0xee6c92[_0xa661('0x20')]=qs['limit'](_0xff2926['query'][_0xa661('0x20')]);_0xee6c92[_0xa661('0x1e')]=qs['offset'](_0xff2926[_0xa661('0x32')][_0xa661('0x1e')]);}_0xee6c92[_0xa661('0x3b')]=qs[_0xa661('0x3c')](_0xff2926[_0xa661('0x32')][_0xa661('0x3c')]);_0xee6c92[_0xa661('0x3d')]=qs[_0xa661('0x34')](_[_0xa661('0x3e')](_0xff2926[_0xa661('0x32')],_0x49108e[_0xa661('0x34')]),_0x5246ef);if(_0xff2926[_0xa661('0x32')][_0xa661('0x3f')]){_0xee6c92['where']=_[_0xa661('0x40')](_0xee6c92[_0xa661('0x3d')],{'$or':_['map'](_0x5246ef,function(_0x4f20b0){if(_0x4f20b0[_0xa661('0x30')]!==_0xa661('0x41')){var _0xe3dcd9={};_0xe3dcd9[_0x4f20b0[_0xa661('0x2a')]]={'$like':'%'+_0xff2926[_0xa661('0x32')][_0xa661('0x3f')]+'%'};return _0xe3dcd9;}})});}_0xee6c92=_[_0xa661('0x40')]({},_0xee6c92,_0xff2926[_0xa661('0x42')]);var _0x2893c3={'where':_0xee6c92[_0xa661('0x3d')]};return db[_0xa661('0x2d')][_0xa661('0x1f')](_0x2893c3)['then'](function(_0x59f6bb){_0x4e3e3d[_0xa661('0x1f')]=_0x59f6bb;if(_0xff2926['query'][_0xa661('0x43')]){_0xee6c92['include']=[{'all':!![]}];}return db[_0xa661('0x2d')][_0xa661('0x44')](_0xee6c92);})[_0xa661('0x26')](function(_0x31dee4){_0x4e3e3d[_0xa661('0x45')]=_0x31dee4;return _0x4e3e3d;})[_0xa661('0x26')](respondWithFilteredResult(_0x16532b,_0xee6c92))[_0xa661('0x46')](handleError(_0x16532b,null));};exports[_0xa661('0x47')]=function(_0x515508,_0x7c5913){var _0x2027e3={'raw':![],'where':{'id':_0x515508[_0xa661('0x48')]['id']}},_0x3a05a7={};_0x3a05a7[_0xa661('0x36')]=_[_0xa661('0x33')](db['FreshdeskConfiguration'][_0xa661('0x2e')]);_0x3a05a7[_0xa661('0x32')]=_[_0xa661('0x33')](_0x515508[_0xa661('0x32')]);_0x3a05a7['filters']=_[_0xa661('0x35')](_0x3a05a7[_0xa661('0x36')],_0x3a05a7[_0xa661('0x32')]);_0x2027e3[_0xa661('0x37')]=_[_0xa661('0x35')](_0x3a05a7[_0xa661('0x36')],qs[_0xa661('0x38')](_0x515508['query']['fields']));_0x2027e3[_0xa661('0x37')]=_0x2027e3['attributes'][_0xa661('0x39')]?_0x2027e3[_0xa661('0x37')]:_0x3a05a7['model'];if(_0x515508['query'][_0xa661('0x43')]){_0x2027e3[_0xa661('0x49')]=[{'all':!![]}];}_0x2027e3=_['merge']({},_0x2027e3,_0x515508[_0xa661('0x42')]);return db['FreshdeskConfiguration'][_0xa661('0x4a')](_0x2027e3)['then'](handleEntityNotFound(_0x7c5913,null))[_0xa661('0x26')](respondWithResult(_0x7c5913,null))[_0xa661('0x46')](handleError(_0x7c5913,null));};exports[_0xa661('0x4b')]=function(_0x400740,_0x453ace){return db[_0xa661('0x2d')][_0xa661('0x4b')](_0x400740[_0xa661('0x4c')],{})['then'](respondWithResult(_0x453ace,0xc9))[_0xa661('0x46')](handleError(_0x453ace,null));};exports[_0xa661('0x4d')]=function(_0x2a86ac,_0x560f25){if(_0x2a86ac[_0xa661('0x4c')]['id']){delete _0x2a86ac['body']['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x2a86ac[_0xa661('0x48')]['id']}})[_0xa661('0x26')](handleEntityNotFound(_0x560f25,null))[_0xa661('0x26')](saveUpdates(_0x2a86ac[_0xa661('0x4c')],null))[_0xa661('0x26')](respondWithResult(_0x560f25,null))[_0xa661('0x46')](handleError(_0x560f25,null));};exports[_0xa661('0x27')]=function(_0x54c774,_0x25ad60){return db[_0xa661('0x2d')][_0xa661('0x4a')]({'where':{'id':_0x54c774[_0xa661('0x48')]['id']}})[_0xa661('0x26')](handleEntityNotFound(_0x25ad60,null))[_0xa661('0x26')](removeEntity(_0x25ad60,null))[_0xa661('0x46')](handleError(_0x25ad60,null));};exports[_0xa661('0x4e')]=function(_0x21621b,_0x463c1f,_0x5cf4aa){var _0x26c52b={};var _0x504e03={};var _0x2f9902;var _0x1f6e25;return db[_0xa661('0x2d')][_0xa661('0x4f')]({'where':{'id':_0x21621b[_0xa661('0x48')]['id']}})[_0xa661('0x26')](handleEntityNotFound(_0x463c1f,null))[_0xa661('0x26')](function(_0x2ad201){if(_0x2ad201){_0x2f9902=_0x2ad201;_0x504e03[_0xa661('0x36')]=_['keys'](db[_0xa661('0x50')]['rawAttributes']);_0x504e03[_0xa661('0x32')]=_[_0xa661('0x33')](_0x21621b[_0xa661('0x32')]);_0x504e03['filters']=_['intersection'](_0x504e03[_0xa661('0x36')],_0x504e03[_0xa661('0x32')]);_0x26c52b['attributes']=_['intersection'](_0x504e03['model'],qs['fields'](_0x21621b[_0xa661('0x32')]['fields']));_0x26c52b['attributes']=_0x26c52b[_0xa661('0x37')]['length']?_0x26c52b[_0xa661('0x37')]:_0x504e03[_0xa661('0x36')];_0x26c52b['order']=qs[_0xa661('0x3c')](_0x21621b['query']['sort']);_0x26c52b[_0xa661('0x3d')]=qs[_0xa661('0x34')](_['pick'](_0x21621b[_0xa661('0x32')],_0x504e03[_0xa661('0x34')]));if(_0x21621b[_0xa661('0x32')]['filter']){_0x26c52b[_0xa661('0x3d')]=_[_0xa661('0x40')](_0x26c52b[_0xa661('0x3d')],{'$or':_[_0xa661('0x2c')](_0x26c52b[_0xa661('0x37')],function(_0x27b06b){var _0x3ec18d={};_0x3ec18d[_0x27b06b]={'$like':'%'+_0x21621b[_0xa661('0x32')][_0xa661('0x3f')]+'%'};return _0x3ec18d;})});}_0x26c52b=_[_0xa661('0x40')]({},_0x26c52b,_0x21621b[_0xa661('0x42')]);return _0x2f9902[_0xa661('0x4e')](_0x26c52b);}})[_0xa661('0x26')](function(_0x2cc473){if(_0x2cc473){_0x1f6e25=_0x2cc473[_0xa661('0x39')];if(!_0x21621b['query'][_0xa661('0x51')](_0xa661('0x3a'))){_0x26c52b[_0xa661('0x20')]=qs[_0xa661('0x20')](_0x21621b[_0xa661('0x32')][_0xa661('0x20')]);_0x26c52b['offset']=qs[_0xa661('0x1e')](_0x21621b['query']['offset']);}return _0x2f9902['getFields'](_0x26c52b);}})[_0xa661('0x26')](function(_0x55aea5){if(_0x55aea5){return _0x55aea5?{'count':_0x1f6e25,'rows':_0x55aea5}:null;}})[_0xa661('0x26')](respondWithResult(_0x463c1f,null))['catch'](handleError(_0x463c1f,null));};exports[_0xa661('0x52')]=function(_0x2a4b6b,_0x1f2f55,_0x8b5949){var _0x52fe90={};var _0x8284d1={};var _0x4eaf26;var _0x2d30f3;return db[_0xa661('0x2d')][_0xa661('0x4f')]({'where':{'id':_0x2a4b6b[_0xa661('0x48')]['id']}})[_0xa661('0x26')](handleEntityNotFound(_0x1f2f55,null))[_0xa661('0x26')](function(_0x4dc406){if(_0x4dc406){_0x4eaf26=_0x4dc406;_0x8284d1[_0xa661('0x36')]=_[_0xa661('0x33')](db['FreshdeskField'][_0xa661('0x2e')]);_0x8284d1[_0xa661('0x32')]=_[_0xa661('0x33')](_0x2a4b6b[_0xa661('0x32')]);_0x8284d1['filters']=_[_0xa661('0x35')](_0x8284d1[_0xa661('0x36')],_0x8284d1[_0xa661('0x32')]);_0x52fe90[_0xa661('0x37')]=_[_0xa661('0x35')](_0x8284d1['model'],qs[_0xa661('0x38')](_0x2a4b6b[_0xa661('0x32')]['fields']));_0x52fe90[_0xa661('0x37')]=_0x52fe90['attributes'][_0xa661('0x39')]?_0x52fe90[_0xa661('0x37')]:_0x8284d1[_0xa661('0x36')];_0x52fe90[_0xa661('0x3b')]=qs[_0xa661('0x3c')](_0x2a4b6b[_0xa661('0x32')][_0xa661('0x3c')]);_0x52fe90[_0xa661('0x3d')]=qs['filters'](_[_0xa661('0x3e')](_0x2a4b6b['query'],_0x8284d1[_0xa661('0x34')]));if(_0x2a4b6b[_0xa661('0x32')][_0xa661('0x3f')]){_0x52fe90[_0xa661('0x3d')]=_['merge'](_0x52fe90[_0xa661('0x3d')],{'$or':_[_0xa661('0x2c')](_0x52fe90[_0xa661('0x37')],function(_0x4924c8){var _0x41c424={};_0x41c424[_0x4924c8]={'$like':'%'+_0x2a4b6b[_0xa661('0x32')]['filter']+'%'};return _0x41c424;})});}_0x52fe90=_[_0xa661('0x40')]({},_0x52fe90,_0x2a4b6b[_0xa661('0x42')]);return _0x4eaf26[_0xa661('0x52')](_0x52fe90);}})[_0xa661('0x26')](function(_0x3ae669){if(_0x3ae669){_0x2d30f3=_0x3ae669[_0xa661('0x39')];if(!_0x2a4b6b[_0xa661('0x32')]['hasOwnProperty'](_0xa661('0x3a'))){_0x52fe90['limit']=qs[_0xa661('0x20')](_0x2a4b6b[_0xa661('0x32')][_0xa661('0x20')]);_0x52fe90['offset']=qs[_0xa661('0x1e')](_0x2a4b6b[_0xa661('0x32')][_0xa661('0x1e')]);}return _0x4eaf26[_0xa661('0x52')](_0x52fe90);}})[_0xa661('0x26')](function(_0x45b633){if(_0x45b633){return _0x45b633?{'count':_0x2d30f3,'rows':_0x45b633}:null;}})['then'](respondWithResult(_0x1f2f55,null))[_0xa661('0x46')](handleError(_0x1f2f55,null));};exports[_0xa661('0x53')]=function(_0x3f1ebb,_0x51916a,_0x5bb236){var _0x5ce0ce={};var _0x4d549b={};var _0x1ed3c7;var _0x10697d;return db[_0xa661('0x2d')][_0xa661('0x4f')]({'where':{'id':_0x3f1ebb[_0xa661('0x48')]['id']}})['then'](handleEntityNotFound(_0x51916a,null))['then'](function(_0x1faa1d){if(_0x1faa1d){_0x1ed3c7=_0x1faa1d;_0x4d549b['model']=_['keys'](db['FreshdeskField'][_0xa661('0x2e')]);_0x4d549b[_0xa661('0x32')]=_['keys'](_0x3f1ebb[_0xa661('0x32')]);_0x4d549b[_0xa661('0x34')]=_[_0xa661('0x35')](_0x4d549b[_0xa661('0x36')],_0x4d549b[_0xa661('0x32')]);_0x5ce0ce['attributes']=_['intersection'](_0x4d549b['model'],qs[_0xa661('0x38')](_0x3f1ebb[_0xa661('0x32')][_0xa661('0x38')]));_0x5ce0ce[_0xa661('0x37')]=_0x5ce0ce[_0xa661('0x37')]['length']?_0x5ce0ce[_0xa661('0x37')]:_0x4d549b[_0xa661('0x36')];_0x5ce0ce[_0xa661('0x3b')]=qs[_0xa661('0x3c')](_0x3f1ebb[_0xa661('0x32')][_0xa661('0x3c')]);_0x5ce0ce['where']=qs['filters'](_['pick'](_0x3f1ebb[_0xa661('0x32')],_0x4d549b[_0xa661('0x34')]));if(_0x3f1ebb[_0xa661('0x32')]['filter']){_0x5ce0ce['where']=_[_0xa661('0x40')](_0x5ce0ce[_0xa661('0x3d')],{'$or':_[_0xa661('0x2c')](_0x5ce0ce[_0xa661('0x37')],function(_0x2780b8){var _0x12b933={};_0x12b933[_0x2780b8]={'$like':'%'+_0x3f1ebb['query']['filter']+'%'};return _0x12b933;})});}_0x5ce0ce=_[_0xa661('0x40')]({},_0x5ce0ce,_0x3f1ebb[_0xa661('0x42')]);return _0x1ed3c7[_0xa661('0x53')](_0x5ce0ce);}})[_0xa661('0x26')](function(_0x3bcce0){if(_0x3bcce0){_0x10697d=_0x3bcce0['length'];if(!_0x3f1ebb['query'][_0xa661('0x51')]('nolimit')){_0x5ce0ce['limit']=qs[_0xa661('0x20')](_0x3f1ebb[_0xa661('0x32')][_0xa661('0x20')]);_0x5ce0ce[_0xa661('0x1e')]=qs['offset'](_0x3f1ebb[_0xa661('0x32')]['offset']);}return _0x1ed3c7['getDescriptions'](_0x5ce0ce);}})['then'](function(_0x4a24e8){if(_0x4a24e8){return _0x4a24e8?{'count':_0x10697d,'rows':_0x4a24e8}:null;}})[_0xa661('0x26')](respondWithResult(_0x51916a,null))[_0xa661('0x46')](handleError(_0x51916a,null));};exports['getTags']=function(_0x7b5070,_0x19d3cc,_0x46f63a){var _0x399948={};var _0x10f18d={};var _0x3c6cd4;var _0x2e1363;return db['FreshdeskConfiguration'][_0xa661('0x4f')]({'where':{'id':_0x7b5070[_0xa661('0x48')]['id']}})[_0xa661('0x26')](handleEntityNotFound(_0x19d3cc,null))['then'](function(_0x34e834){if(_0x34e834){_0x3c6cd4=_0x34e834;_0x10f18d[_0xa661('0x36')]=_[_0xa661('0x33')](db[_0xa661('0x54')]['rawAttributes']);_0x10f18d[_0xa661('0x32')]=_[_0xa661('0x33')](_0x7b5070[_0xa661('0x32')]);_0x10f18d[_0xa661('0x34')]=_[_0xa661('0x35')](_0x10f18d[_0xa661('0x36')],_0x10f18d[_0xa661('0x32')]);_0x399948[_0xa661('0x37')]=_[_0xa661('0x35')](_0x10f18d[_0xa661('0x36')],qs[_0xa661('0x38')](_0x7b5070['query'][_0xa661('0x38')]));_0x399948[_0xa661('0x37')]=_0x399948[_0xa661('0x37')]['length']?_0x399948['attributes']:_0x10f18d[_0xa661('0x36')];_0x399948[_0xa661('0x3b')]=qs[_0xa661('0x3c')](_0x7b5070[_0xa661('0x32')][_0xa661('0x3c')]);_0x399948['where']=qs[_0xa661('0x34')](_[_0xa661('0x3e')](_0x7b5070[_0xa661('0x32')],_0x10f18d[_0xa661('0x34')]));if(_0x7b5070[_0xa661('0x32')][_0xa661('0x3f')]){_0x399948['where']=_[_0xa661('0x40')](_0x399948[_0xa661('0x3d')],{'$or':_[_0xa661('0x2c')](_0x399948[_0xa661('0x37')],function(_0x378261){var _0x1ca539={};_0x1ca539[_0x378261]={'$like':'%'+_0x7b5070[_0xa661('0x32')][_0xa661('0x3f')]+'%'};return _0x1ca539;})});}_0x399948=_[_0xa661('0x40')]({},_0x399948,_0x7b5070['options']);return _0x3c6cd4[_0xa661('0x55')](_0x399948);}})['then'](function(_0x25ccd4){if(_0x25ccd4){_0x2e1363=_0x25ccd4[_0xa661('0x39')];if(!_0x7b5070[_0xa661('0x32')][_0xa661('0x51')](_0xa661('0x3a'))){_0x399948[_0xa661('0x20')]=qs['limit'](_0x7b5070['query']['limit']);_0x399948[_0xa661('0x1e')]=qs[_0xa661('0x1e')](_0x7b5070[_0xa661('0x32')][_0xa661('0x1e')]);}return _0x3c6cd4[_0xa661('0x55')](_0x399948);}})['then'](function(_0x2ad263){if(_0x2ad263){return _0x2ad263?{'count':_0x2e1363,'rows':_0x2ad263}:null;}})['then'](respondWithResult(_0x19d3cc,null))[_0xa661('0x46')](handleError(_0x19d3cc,null));};exports[_0xa661('0x56')]=function(_0x99fee5,_0x4f289e,_0x220573){if(_0x99fee5['body']['id']){delete _0x99fee5[_0xa661('0x4c')]['id'];}return db['FreshdeskConfiguration'][_0xa661('0x4f')]({'where':{'id':_0x99fee5[_0xa661('0x48')]['id']}})['then'](handleEntityNotFound(_0x4f289e,null))[_0xa661('0x26')](function(_0x38d20e){if(_0x38d20e){return _0x38d20e[_0xa661('0x56')](_0x99fee5[_0xa661('0x4c')][_0xa661('0x57')]||[]);}return null;})[_0xa661('0x26')](respondWithResult(_0x4f289e,null))[_0xa661('0x46')](handleError(_0x4f289e,null));}; \ No newline at end of file +var _0xb07a=['jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','then','sendStatus','stack','name','send','FreshdeskConfiguration','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','includeAll','include','rows','catch','show','params','length','find','create','body','destroy','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x1446cc,_0x4fcb85){var _0x60b2b=function(_0x4c0a8b){while(--_0x4c0a8b){_0x1446cc['push'](_0x1446cc['shift']());}};_0x60b2b(++_0x4fcb85);}(_0xb07a,0x135));var _0xab07=function(_0x99ba67,_0x10eae9){_0x99ba67=_0x99ba67-0x0;var _0x5c4f7d=_0xb07a[_0x99ba67];return _0x5c4f7d;};'use strict';var emlformat=require(_0xab07('0x0'));var rimraf=require(_0xab07('0x1'));var zipdir=require(_0xab07('0x2'));var jsonpatch=require(_0xab07('0x3'));var rp=require(_0xab07('0x4'));var moment=require(_0xab07('0x5'));var BPromise=require(_0xab07('0x6'));var Mustache=require(_0xab07('0x7'));var util=require(_0xab07('0x8'));var path=require(_0xab07('0x9'));var sox=require('sox');var csv=require(_0xab07('0xa'));var ejs=require(_0xab07('0xb'));var fs=require('fs');var fs_extra=require(_0xab07('0xc'));var _=require(_0xab07('0xd'));var squel=require('squel');var crypto=require(_0xab07('0xe'));var jsforce=require(_0xab07('0xf'));var deskjs=require(_0xab07('0x10'));var toCsv=require(_0xab07('0xa'));var querystring=require(_0xab07('0x11'));var Papa=require('papaparse');var Redis=require(_0xab07('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xab07('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab07('0x14'));var logger=require(_0xab07('0x15'))('api');var utils=require(_0xab07('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xab07('0x17'));var db=require(_0xab07('0x18'))['db'];function respondWithStatusCode(_0xeefcc2,_0x204fc6){_0x204fc6=_0x204fc6||0xcc;return function(_0x122929){if(_0x122929){return _0xeefcc2['sendStatus'](_0x204fc6);}return _0xeefcc2[_0xab07('0x19')](_0x204fc6)[_0xab07('0x1a')]();};}function respondWithResult(_0x471440,_0x37c187){_0x37c187=_0x37c187||0xc8;return function(_0x5028a6){if(_0x5028a6){return _0x471440[_0xab07('0x19')](_0x37c187)[_0xab07('0x1b')](_0x5028a6);}};}function respondWithFilteredResult(_0x178392,_0x33276a){return function(_0x499b9e){if(_0x499b9e){var _0x1856a4=typeof _0x33276a[_0xab07('0x1c')]===_0xab07('0x1d')&&typeof _0x33276a['limit']===_0xab07('0x1d');var _0x38529f=_0x499b9e[_0xab07('0x1e')];var _0x25be07=_0x1856a4?0x0:_0x33276a[_0xab07('0x1c')];var _0x50ac5f=_0x1856a4?_0x499b9e[_0xab07('0x1e')]:_0x33276a[_0xab07('0x1c')]+_0x33276a[_0xab07('0x1f')];var _0x3443e1;if(_0x50ac5f>=_0x38529f){_0x50ac5f=_0x38529f;_0x3443e1=0xc8;}else{_0x3443e1=0xce;}_0x178392['status'](_0x3443e1);return _0x178392['set'](_0xab07('0x20'),_0x25be07+'-'+_0x50ac5f+'/'+_0x38529f)['json'](_0x499b9e);}return null;};}function patchUpdates(_0x6ef132){return function(_0x2265f5){try{jsonpatch['apply'](_0x2265f5,_0x6ef132,!![]);}catch(_0x4a8f0c){return BPromise[_0xab07('0x21')](_0x4a8f0c);}return _0x2265f5[_0xab07('0x22')]();};}function saveUpdates(_0x96b573,_0x604078){return function(_0x19cfd9){if(_0x19cfd9){return _0x19cfd9['update'](_0x96b573)[_0xab07('0x23')](function(_0x5184d1){return _0x5184d1;});}return null;};}function removeEntity(_0x1d2ddf,_0x34a7f1){return function(_0x4ecdeb){if(_0x4ecdeb){return _0x4ecdeb['destroy']()[_0xab07('0x23')](function(){_0x1d2ddf[_0xab07('0x19')](0xcc)[_0xab07('0x1a')]();});}};}function handleEntityNotFound(_0x4dcf02,_0x2feee3){return function(_0x5ef346){if(!_0x5ef346){_0x4dcf02[_0xab07('0x24')](0x194);}return _0x5ef346;};}function handleError(_0x3c4de3,_0x4bc1cc){_0x4bc1cc=_0x4bc1cc||0x1f4;return function(_0x1b74a8){logger['error'](_0x1b74a8[_0xab07('0x25')]);if(_0x1b74a8[_0xab07('0x26')]){delete _0x1b74a8['name'];}_0x3c4de3[_0xab07('0x19')](_0x4bc1cc)[_0xab07('0x27')](_0x1b74a8);};}exports['index']=function(_0x416570,_0x4c3080){var _0x5c4031={},_0xc835f2={},_0x466a66={'count':0x0,'rows':[]};var _0xb85b71=_['map'](db[_0xab07('0x28')][_0xab07('0x29')],function(_0x13bfbd){return{'name':_0x13bfbd[_0xab07('0x2a')],'type':_0x13bfbd[_0xab07('0x2b')][_0xab07('0x2c')]};});_0xc835f2['model']=_[_0xab07('0x2d')](_0xb85b71,_0xab07('0x26'));_0xc835f2[_0xab07('0x2e')]=_[_0xab07('0x2f')](_0x416570[_0xab07('0x2e')]);_0xc835f2[_0xab07('0x30')]=_[_0xab07('0x31')](_0xc835f2[_0xab07('0x32')],_0xc835f2[_0xab07('0x2e')]);_0x5c4031[_0xab07('0x33')]=_[_0xab07('0x31')](_0xc835f2[_0xab07('0x32')],qs[_0xab07('0x34')](_0x416570['query']['fields']));_0x5c4031[_0xab07('0x33')]=_0x5c4031[_0xab07('0x33')]['length']?_0x5c4031[_0xab07('0x33')]:_0xc835f2[_0xab07('0x32')];if(!_0x416570[_0xab07('0x2e')][_0xab07('0x35')](_0xab07('0x36'))){_0x5c4031[_0xab07('0x1f')]=qs[_0xab07('0x1f')](_0x416570['query'][_0xab07('0x1f')]);_0x5c4031[_0xab07('0x1c')]=qs[_0xab07('0x1c')](_0x416570[_0xab07('0x2e')][_0xab07('0x1c')]);}_0x5c4031[_0xab07('0x37')]=qs['sort'](_0x416570[_0xab07('0x2e')][_0xab07('0x38')]);_0x5c4031['where']=qs[_0xab07('0x30')](_[_0xab07('0x39')](_0x416570[_0xab07('0x2e')],_0xc835f2[_0xab07('0x30')]),_0xb85b71);if(_0x416570['query']['filter']){_0x5c4031[_0xab07('0x3a')]=_[_0xab07('0x3b')](_0x5c4031[_0xab07('0x3a')],{'$or':_[_0xab07('0x2d')](_0xb85b71,function(_0x30eb35){if(_0x30eb35[_0xab07('0x2b')]!=='VIRTUAL'){var _0x3837a3={};_0x3837a3[_0x30eb35[_0xab07('0x26')]]={'$like':'%'+_0x416570[_0xab07('0x2e')][_0xab07('0x3c')]+'%'};return _0x3837a3;}})});}_0x5c4031=_['merge']({},_0x5c4031,_0x416570[_0xab07('0x3d')]);var _0x48f27e={'where':_0x5c4031[_0xab07('0x3a')]};return db[_0xab07('0x28')][_0xab07('0x1e')](_0x48f27e)['then'](function(_0x1d9141){_0x466a66[_0xab07('0x1e')]=_0x1d9141;if(_0x416570['query'][_0xab07('0x3e')]){_0x5c4031[_0xab07('0x3f')]=[{'all':!![]}];}return db[_0xab07('0x28')]['findAll'](_0x5c4031);})[_0xab07('0x23')](function(_0x3b1d24){_0x466a66[_0xab07('0x40')]=_0x3b1d24;return _0x466a66;})[_0xab07('0x23')](respondWithFilteredResult(_0x4c3080,_0x5c4031))[_0xab07('0x41')](handleError(_0x4c3080,null));};exports[_0xab07('0x42')]=function(_0x36c59f,_0x4d6993){var _0xb2297f={'raw':![],'where':{'id':_0x36c59f[_0xab07('0x43')]['id']}},_0x25d55b={};_0x25d55b[_0xab07('0x32')]=_['keys'](db[_0xab07('0x28')][_0xab07('0x29')]);_0x25d55b[_0xab07('0x2e')]=_['keys'](_0x36c59f['query']);_0x25d55b[_0xab07('0x30')]=_[_0xab07('0x31')](_0x25d55b['model'],_0x25d55b[_0xab07('0x2e')]);_0xb2297f[_0xab07('0x33')]=_[_0xab07('0x31')](_0x25d55b[_0xab07('0x32')],qs[_0xab07('0x34')](_0x36c59f[_0xab07('0x2e')][_0xab07('0x34')]));_0xb2297f[_0xab07('0x33')]=_0xb2297f[_0xab07('0x33')][_0xab07('0x44')]?_0xb2297f[_0xab07('0x33')]:_0x25d55b[_0xab07('0x32')];if(_0x36c59f['query'][_0xab07('0x3e')]){_0xb2297f['include']=[{'all':!![]}];}_0xb2297f=_[_0xab07('0x3b')]({},_0xb2297f,_0x36c59f[_0xab07('0x3d')]);return db[_0xab07('0x28')][_0xab07('0x45')](_0xb2297f)[_0xab07('0x23')](handleEntityNotFound(_0x4d6993,null))[_0xab07('0x23')](respondWithResult(_0x4d6993,null))[_0xab07('0x41')](handleError(_0x4d6993,null));};exports['create']=function(_0x342281,_0x1f0413){return db[_0xab07('0x28')][_0xab07('0x46')](_0x342281['body'],{})[_0xab07('0x23')](respondWithResult(_0x1f0413,0xc9))[_0xab07('0x41')](handleError(_0x1f0413,null));};exports['update']=function(_0x2efe97,_0x4d4c0c){if(_0x2efe97[_0xab07('0x47')]['id']){delete _0x2efe97[_0xab07('0x47')]['id'];}return db[_0xab07('0x28')][_0xab07('0x45')]({'where':{'id':_0x2efe97['params']['id']}})[_0xab07('0x23')](handleEntityNotFound(_0x4d4c0c,null))[_0xab07('0x23')](saveUpdates(_0x2efe97[_0xab07('0x47')],null))['then'](respondWithResult(_0x4d4c0c,null))[_0xab07('0x41')](handleError(_0x4d4c0c,null));};exports[_0xab07('0x48')]=function(_0x317a40,_0x4fc3d6){return db[_0xab07('0x28')][_0xab07('0x45')]({'where':{'id':_0x317a40[_0xab07('0x43')]['id']}})[_0xab07('0x23')](handleEntityNotFound(_0x4fc3d6,null))[_0xab07('0x23')](removeEntity(_0x4fc3d6,null))['catch'](handleError(_0x4fc3d6,null));};exports[_0xab07('0x49')]=function(_0x30a800,_0x1f91d5,_0x4eee2c){var _0x404e06={};var _0x13f58f={};var _0x8efcc9;var _0x48ac11;return db[_0xab07('0x28')][_0xab07('0x4a')]({'where':{'id':_0x30a800['params']['id']}})[_0xab07('0x23')](handleEntityNotFound(_0x1f91d5,null))[_0xab07('0x23')](function(_0x220efe){if(_0x220efe){_0x8efcc9=_0x220efe;_0x13f58f[_0xab07('0x32')]=_[_0xab07('0x2f')](db[_0xab07('0x4b')][_0xab07('0x29')]);_0x13f58f[_0xab07('0x2e')]=_[_0xab07('0x2f')](_0x30a800[_0xab07('0x2e')]);_0x13f58f['filters']=_[_0xab07('0x31')](_0x13f58f[_0xab07('0x32')],_0x13f58f[_0xab07('0x2e')]);_0x404e06[_0xab07('0x33')]=_[_0xab07('0x31')](_0x13f58f[_0xab07('0x32')],qs['fields'](_0x30a800[_0xab07('0x2e')][_0xab07('0x34')]));_0x404e06[_0xab07('0x33')]=_0x404e06['attributes'][_0xab07('0x44')]?_0x404e06['attributes']:_0x13f58f[_0xab07('0x32')];_0x404e06[_0xab07('0x37')]=qs[_0xab07('0x38')](_0x30a800['query'][_0xab07('0x38')]);_0x404e06['where']=qs[_0xab07('0x30')](_[_0xab07('0x39')](_0x30a800['query'],_0x13f58f[_0xab07('0x30')]));if(_0x30a800[_0xab07('0x2e')][_0xab07('0x3c')]){_0x404e06['where']=_[_0xab07('0x3b')](_0x404e06[_0xab07('0x3a')],{'$or':_[_0xab07('0x2d')](_0x404e06[_0xab07('0x33')],function(_0xe74fa5){var _0x5d4f33={};_0x5d4f33[_0xe74fa5]={'$like':'%'+_0x30a800[_0xab07('0x2e')][_0xab07('0x3c')]+'%'};return _0x5d4f33;})});}_0x404e06=_['merge']({},_0x404e06,_0x30a800[_0xab07('0x3d')]);return _0x8efcc9['getFields'](_0x404e06);}})[_0xab07('0x23')](function(_0xc45df4){if(_0xc45df4){_0x48ac11=_0xc45df4[_0xab07('0x44')];if(!_0x30a800[_0xab07('0x2e')][_0xab07('0x35')](_0xab07('0x36'))){_0x404e06[_0xab07('0x1f')]=qs[_0xab07('0x1f')](_0x30a800[_0xab07('0x2e')][_0xab07('0x1f')]);_0x404e06[_0xab07('0x1c')]=qs['offset'](_0x30a800[_0xab07('0x2e')][_0xab07('0x1c')]);}return _0x8efcc9['getFields'](_0x404e06);}})[_0xab07('0x23')](function(_0xbcbaec){if(_0xbcbaec){return _0xbcbaec?{'count':_0x48ac11,'rows':_0xbcbaec}:null;}})['then'](respondWithResult(_0x1f91d5,null))[_0xab07('0x41')](handleError(_0x1f91d5,null));};exports[_0xab07('0x4c')]=function(_0x37e346,_0x21f2a1,_0x1ae1d1){var _0x272c6b={};var _0x8969e5={};var _0x16936c;var _0x8d62b5;return db[_0xab07('0x28')][_0xab07('0x4a')]({'where':{'id':_0x37e346['params']['id']}})[_0xab07('0x23')](handleEntityNotFound(_0x21f2a1,null))['then'](function(_0x246265){if(_0x246265){_0x16936c=_0x246265;_0x8969e5['model']=_[_0xab07('0x2f')](db[_0xab07('0x4b')][_0xab07('0x29')]);_0x8969e5[_0xab07('0x2e')]=_[_0xab07('0x2f')](_0x37e346[_0xab07('0x2e')]);_0x8969e5[_0xab07('0x30')]=_[_0xab07('0x31')](_0x8969e5[_0xab07('0x32')],_0x8969e5[_0xab07('0x2e')]);_0x272c6b[_0xab07('0x33')]=_['intersection'](_0x8969e5[_0xab07('0x32')],qs[_0xab07('0x34')](_0x37e346[_0xab07('0x2e')][_0xab07('0x34')]));_0x272c6b['attributes']=_0x272c6b['attributes'][_0xab07('0x44')]?_0x272c6b[_0xab07('0x33')]:_0x8969e5[_0xab07('0x32')];_0x272c6b[_0xab07('0x37')]=qs[_0xab07('0x38')](_0x37e346[_0xab07('0x2e')][_0xab07('0x38')]);_0x272c6b['where']=qs[_0xab07('0x30')](_[_0xab07('0x39')](_0x37e346[_0xab07('0x2e')],_0x8969e5[_0xab07('0x30')]));if(_0x37e346[_0xab07('0x2e')][_0xab07('0x3c')]){_0x272c6b[_0xab07('0x3a')]=_[_0xab07('0x3b')](_0x272c6b[_0xab07('0x3a')],{'$or':_[_0xab07('0x2d')](_0x272c6b[_0xab07('0x33')],function(_0x34a67d){var _0x2eeb90={};_0x2eeb90[_0x34a67d]={'$like':'%'+_0x37e346[_0xab07('0x2e')][_0xab07('0x3c')]+'%'};return _0x2eeb90;})});}_0x272c6b=_[_0xab07('0x3b')]({},_0x272c6b,_0x37e346[_0xab07('0x3d')]);return _0x16936c['getSubjects'](_0x272c6b);}})[_0xab07('0x23')](function(_0xe5790a){if(_0xe5790a){_0x8d62b5=_0xe5790a['length'];if(!_0x37e346[_0xab07('0x2e')][_0xab07('0x35')](_0xab07('0x36'))){_0x272c6b[_0xab07('0x1f')]=qs[_0xab07('0x1f')](_0x37e346[_0xab07('0x2e')][_0xab07('0x1f')]);_0x272c6b['offset']=qs[_0xab07('0x1c')](_0x37e346['query'][_0xab07('0x1c')]);}return _0x16936c[_0xab07('0x4c')](_0x272c6b);}})[_0xab07('0x23')](function(_0x266cb7){if(_0x266cb7){return _0x266cb7?{'count':_0x8d62b5,'rows':_0x266cb7}:null;}})['then'](respondWithResult(_0x21f2a1,null))['catch'](handleError(_0x21f2a1,null));};exports['getDescriptions']=function(_0x295837,_0x30e852,_0x5c45ee){var _0x24e5e4={};var _0xba5db2={};var _0x4d3700;var _0x501637;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x295837[_0xab07('0x43')]['id']}})[_0xab07('0x23')](handleEntityNotFound(_0x30e852,null))['then'](function(_0x1b99a2){if(_0x1b99a2){_0x4d3700=_0x1b99a2;_0xba5db2[_0xab07('0x32')]=_[_0xab07('0x2f')](db[_0xab07('0x4b')][_0xab07('0x29')]);_0xba5db2[_0xab07('0x2e')]=_[_0xab07('0x2f')](_0x295837[_0xab07('0x2e')]);_0xba5db2['filters']=_[_0xab07('0x31')](_0xba5db2[_0xab07('0x32')],_0xba5db2[_0xab07('0x2e')]);_0x24e5e4[_0xab07('0x33')]=_['intersection'](_0xba5db2['model'],qs['fields'](_0x295837[_0xab07('0x2e')][_0xab07('0x34')]));_0x24e5e4[_0xab07('0x33')]=_0x24e5e4[_0xab07('0x33')]['length']?_0x24e5e4[_0xab07('0x33')]:_0xba5db2['model'];_0x24e5e4[_0xab07('0x37')]=qs[_0xab07('0x38')](_0x295837[_0xab07('0x2e')]['sort']);_0x24e5e4[_0xab07('0x3a')]=qs['filters'](_[_0xab07('0x39')](_0x295837[_0xab07('0x2e')],_0xba5db2[_0xab07('0x30')]));if(_0x295837['query'][_0xab07('0x3c')]){_0x24e5e4['where']=_[_0xab07('0x3b')](_0x24e5e4[_0xab07('0x3a')],{'$or':_[_0xab07('0x2d')](_0x24e5e4[_0xab07('0x33')],function(_0x50e86e){var _0x20aa7a={};_0x20aa7a[_0x50e86e]={'$like':'%'+_0x295837[_0xab07('0x2e')][_0xab07('0x3c')]+'%'};return _0x20aa7a;})});}_0x24e5e4=_[_0xab07('0x3b')]({},_0x24e5e4,_0x295837[_0xab07('0x3d')]);return _0x4d3700[_0xab07('0x4d')](_0x24e5e4);}})['then'](function(_0x44c0e1){if(_0x44c0e1){_0x501637=_0x44c0e1[_0xab07('0x44')];if(!_0x295837['query']['hasOwnProperty'](_0xab07('0x36'))){_0x24e5e4[_0xab07('0x1f')]=qs[_0xab07('0x1f')](_0x295837[_0xab07('0x2e')][_0xab07('0x1f')]);_0x24e5e4[_0xab07('0x1c')]=qs[_0xab07('0x1c')](_0x295837['query'][_0xab07('0x1c')]);}return _0x4d3700[_0xab07('0x4d')](_0x24e5e4);}})['then'](function(_0x5db58a){if(_0x5db58a){return _0x5db58a?{'count':_0x501637,'rows':_0x5db58a}:null;}})[_0xab07('0x23')](respondWithResult(_0x30e852,null))[_0xab07('0x41')](handleError(_0x30e852,null));};exports[_0xab07('0x4e')]=function(_0x20c7fc,_0x2b3c1e,_0x19160c){var _0x298de9={};var _0x5b2c3c={};var _0x4bfc56;var _0x594b99;return db[_0xab07('0x28')][_0xab07('0x4a')]({'where':{'id':_0x20c7fc['params']['id']}})[_0xab07('0x23')](handleEntityNotFound(_0x2b3c1e,null))[_0xab07('0x23')](function(_0x59422b){if(_0x59422b){_0x4bfc56=_0x59422b;_0x5b2c3c[_0xab07('0x32')]=_['keys'](db['Tag'][_0xab07('0x29')]);_0x5b2c3c[_0xab07('0x2e')]=_['keys'](_0x20c7fc['query']);_0x5b2c3c[_0xab07('0x30')]=_[_0xab07('0x31')](_0x5b2c3c[_0xab07('0x32')],_0x5b2c3c['query']);_0x298de9['attributes']=_['intersection'](_0x5b2c3c['model'],qs[_0xab07('0x34')](_0x20c7fc[_0xab07('0x2e')][_0xab07('0x34')]));_0x298de9['attributes']=_0x298de9[_0xab07('0x33')][_0xab07('0x44')]?_0x298de9[_0xab07('0x33')]:_0x5b2c3c[_0xab07('0x32')];_0x298de9[_0xab07('0x37')]=qs[_0xab07('0x38')](_0x20c7fc[_0xab07('0x2e')][_0xab07('0x38')]);_0x298de9[_0xab07('0x3a')]=qs['filters'](_['pick'](_0x20c7fc[_0xab07('0x2e')],_0x5b2c3c['filters']));if(_0x20c7fc['query'][_0xab07('0x3c')]){_0x298de9[_0xab07('0x3a')]=_[_0xab07('0x3b')](_0x298de9[_0xab07('0x3a')],{'$or':_[_0xab07('0x2d')](_0x298de9[_0xab07('0x33')],function(_0x599e0e){var _0x192b7a={};_0x192b7a[_0x599e0e]={'$like':'%'+_0x20c7fc['query'][_0xab07('0x3c')]+'%'};return _0x192b7a;})});}_0x298de9=_['merge']({},_0x298de9,_0x20c7fc[_0xab07('0x3d')]);return _0x4bfc56[_0xab07('0x4e')](_0x298de9);}})['then'](function(_0x216bac){if(_0x216bac){_0x594b99=_0x216bac['length'];if(!_0x20c7fc['query'][_0xab07('0x35')](_0xab07('0x36'))){_0x298de9[_0xab07('0x1f')]=qs[_0xab07('0x1f')](_0x20c7fc['query'][_0xab07('0x1f')]);_0x298de9['offset']=qs['offset'](_0x20c7fc[_0xab07('0x2e')][_0xab07('0x1c')]);}return _0x4bfc56[_0xab07('0x4e')](_0x298de9);}})[_0xab07('0x23')](function(_0x14c0b9){if(_0x14c0b9){return _0x14c0b9?{'count':_0x594b99,'rows':_0x14c0b9}:null;}})[_0xab07('0x23')](respondWithResult(_0x2b3c1e,null))[_0xab07('0x41')](handleError(_0x2b3c1e,null));};exports[_0xab07('0x4f')]=function(_0x2e2582,_0x38a398,_0x4bb3df){if(_0x2e2582['body']['id']){delete _0x2e2582[_0xab07('0x47')]['id'];}return db[_0xab07('0x28')]['findOne']({'where':{'id':_0x2e2582[_0xab07('0x43')]['id']}})['then'](handleEntityNotFound(_0x38a398,null))['then'](function(_0x129424){if(_0x129424){return _0x129424[_0xab07('0x4f')](_0x2e2582[_0xab07('0x47')][_0xab07('0x50')]||[]);}return null;})['then'](respondWithResult(_0x38a398,null))['catch'](handleError(_0x38a398,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 5341f19..8149321 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 _0x2b9e=['path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x568a61,_0x2124f8){var _0x334c3b=function(_0x1afc39){while(--_0x1afc39){_0x568a61['push'](_0x568a61['shift']());}};_0x334c3b(++_0x2124f8);}(_0x2b9e,0x182));var _0xe2b9=function(_0x1e98f0,_0x62d7fc){_0x1e98f0=_0x1e98f0-0x0;var _0x2f8d17=_0x2b9e[_0x1e98f0];return _0x2f8d17;};'use strict';var _=require(_0xe2b9('0x0'));var util=require(_0xe2b9('0x1'));var logger=require(_0xe2b9('0x2'))(_0xe2b9('0x3'));var moment=require(_0xe2b9('0x4'));var BPromise=require('bluebird');var rp=require(_0xe2b9('0x5'));var fs=require('fs');var path=require(_0xe2b9('0x6'));var rimraf=require(_0xe2b9('0x7'));var config=require(_0xe2b9('0x8'));var attributes=require(_0xe2b9('0x9'));module[_0xe2b9('0xa')]=function(_0x283954,_0x45bfbd){return _0x283954[_0xe2b9('0xb')](_0xe2b9('0xc'),attributes,{'tableName':_0xe2b9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66b5=['FreshdeskConfiguration','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define'];(function(_0x4a902c,_0x92f67d){var _0x4fbb44=function(_0x94934c){while(--_0x94934c){_0x4a902c['push'](_0x4a902c['shift']());}};_0x4fbb44(++_0x92f67d);}(_0x66b5,0x69));var _0x566b=function(_0x1c1804,_0x576a8b){_0x1c1804=_0x1c1804-0x0;var _0x1c4723=_0x66b5[_0x1c1804];return _0x1c4723;};'use strict';var _=require(_0x566b('0x0'));var util=require(_0x566b('0x1'));var logger=require(_0x566b('0x2'))(_0x566b('0x3'));var moment=require(_0x566b('0x4'));var BPromise=require(_0x566b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x566b('0x6'));var rimraf=require(_0x566b('0x7'));var config=require(_0x566b('0x8'));var attributes=require(_0x566b('0x9'));module[_0x566b('0xa')]=function(_0x52c032,_0x11eed4){return _0x52c032[_0x566b('0xb')](_0x566b('0xc'),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 7c17ae8..f6e1495 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 _0xece6=['ioredis','../../mysqldb','../../config/logger','jayson/promise','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x4d560a,_0x48d9dd){var _0x368b51=function(_0x4124a8){while(--_0x4124a8){_0x4d560a['push'](_0x4d560a['shift']());}};_0x368b51(++_0x48d9dd);}(_0xece6,0xec));var _0x6ece=function(_0x37042e,_0x6117b8){_0x37042e=_0x37042e-0x0;var _0x24eb7c=_0xece6[_0x37042e];return _0x24eb7c;};'use strict';var _=require(_0x6ece('0x0'));var util=require(_0x6ece('0x1'));var moment=require('moment');var BPromise=require(_0x6ece('0x2'));var rs=require(_0x6ece('0x3'));var fs=require('fs');var Redis=require(_0x6ece('0x4'));var db=require(_0x6ece('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6ece('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6ece('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5d6956,_0x3c853d,_0x3a1aab){return new BPromise(function(_0x33ba65,_0x3460de){return client[_0x6ece('0x8')](_0x5d6956,_0x3a1aab)[_0x6ece('0x9')](function(_0x443eb2){logger[_0x6ece('0xa')](_0x6ece('0xb'),_0x3c853d,_0x6ece('0xc'));logger['debug'](_0x6ece('0xd'),_0x3c853d,_0x6ece('0xc'),JSON[_0x6ece('0xe')](_0x443eb2));if(_0x443eb2[_0x6ece('0xf')]){if(_0x443eb2[_0x6ece('0xf')][_0x6ece('0x10')]===0x1f4){logger[_0x6ece('0xf')](_0x6ece('0xb'),_0x3c853d,_0x443eb2[_0x6ece('0xf')][_0x6ece('0x11')]);return _0x3460de(_0x443eb2[_0x6ece('0xf')][_0x6ece('0x11')]);}logger[_0x6ece('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3c853d,_0x443eb2['error']['message']);return _0x33ba65(_0x443eb2[_0x6ece('0xf')][_0x6ece('0x11')]);}else{logger[_0x6ece('0xa')](_0x6ece('0xb'),_0x3c853d,_0x6ece('0xc'));_0x33ba65(_0x443eb2[_0x6ece('0x12')][_0x6ece('0x11')]);}})[_0x6ece('0x13')](function(_0xc9f09){logger[_0x6ece('0xf')](_0x6ece('0xb'),_0x3c853d,_0xc9f09);_0x3460de(_0xc9f09);});});} \ No newline at end of file +var _0x0635=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x4cf33b,_0x277b1f){var _0x3105c4=function(_0xcd5a4c){while(--_0xcd5a4c){_0x4cf33b['push'](_0x4cf33b['shift']());}};_0x3105c4(++_0x277b1f);}(_0x0635,0x9f));var _0x5063=function(_0x3384ac,_0x1690dd){_0x3384ac=_0x3384ac-0x0;var _0x7e5cf8=_0x0635[_0x3384ac];return _0x7e5cf8;};'use strict';var _=require(_0x5063('0x0'));var util=require(_0x5063('0x1'));var moment=require(_0x5063('0x2'));var BPromise=require(_0x5063('0x3'));var rs=require(_0x5063('0x4'));var fs=require('fs');var Redis=require(_0x5063('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5063('0x6'));var logger=require(_0x5063('0x7'))('rpc');var config=require(_0x5063('0x8'));var jayson=require(_0x5063('0x9'));var client=jayson[_0x5063('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6deab2,_0x39076f,_0x4cfd3e){return new BPromise(function(_0xf2c49d,_0x43652d){return client[_0x5063('0xb')](_0x6deab2,_0x4cfd3e)[_0x5063('0xc')](function(_0x142156){logger[_0x5063('0xd')](_0x5063('0xe'),_0x39076f,_0x5063('0xf'));logger['debug'](_0x5063('0x10'),_0x39076f,'request\x20sent',JSON[_0x5063('0x11')](_0x142156));if(_0x142156[_0x5063('0x12')]){if(_0x142156[_0x5063('0x12')][_0x5063('0x13')]===0x1f4){logger[_0x5063('0x12')](_0x5063('0xe'),_0x39076f,_0x142156[_0x5063('0x12')][_0x5063('0x14')]);return _0x43652d(_0x142156['error'][_0x5063('0x14')]);}logger[_0x5063('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x39076f,_0x142156[_0x5063('0x12')][_0x5063('0x14')]);return _0xf2c49d(_0x142156[_0x5063('0x12')][_0x5063('0x14')]);}else{logger['info'](_0x5063('0xe'),_0x39076f,'request\x20sent');_0xf2c49d(_0x142156[_0x5063('0x15')][_0x5063('0x14')]);}})[_0x5063('0x16')](function(_0x540e69){logger[_0x5063('0x12')](_0x5063('0xe'),_0x39076f,_0x540e69);_0x43652d(_0x540e69);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 301584d..3d99382 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 _0xdb08=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','update','delete','multer','path'];(function(_0x3de7e0,_0x28cbff){var _0x11d0b3=function(_0xd95412){while(--_0xd95412){_0x3de7e0['push'](_0x3de7e0['shift']());}};_0x11d0b3(++_0x28cbff);}(_0xdb08,0x67));var _0x8db0=function(_0x2e44ce,_0x202dcc){_0x2e44ce=_0x2e44ce-0x0;var _0x279271=_0xdb08[_0x2e44ce];return _0x279271;};'use strict';var multer=require(_0x8db0('0x0'));var util=require('util');var path=require(_0x8db0('0x1'));var timeout=require('connect-timeout');var express=require(_0x8db0('0x2'));var router=express[_0x8db0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8db0('0x4'));var interaction=require(_0x8db0('0x5'));var config=require(_0x8db0('0x6'));var controller=require('./intFreshdeskField.controller');router[_0x8db0('0x7')]('/',auth[_0x8db0('0x8')](),controller[_0x8db0('0x9')]);router[_0x8db0('0x7')](_0x8db0('0xa'),auth['isAuthenticated'](),controller[_0x8db0('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8db0('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x8db0('0xd')]);router[_0x8db0('0xe')](_0x8db0('0xa'),auth[_0x8db0('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa667=['fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0xa3a1d7,_0x3eedc6){var _0x27986c=function(_0x5572cd){while(--_0x5572cd){_0xa3a1d7['push'](_0xa3a1d7['shift']());}};_0x27986c(++_0x3eedc6);}(_0xa667,0xf2));var _0x7a66=function(_0x48d623,_0x224b50){_0x48d623=_0x48d623-0x0;var _0x497f08=_0xa667[_0x48d623];return _0x497f08;};'use strict';var multer=require(_0x7a66('0x0'));var util=require('util');var path=require(_0x7a66('0x1'));var timeout=require(_0x7a66('0x2'));var express=require(_0x7a66('0x3'));var router=express[_0x7a66('0x4')]();var fs_extra=require(_0x7a66('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7a66('0x6'));var controller=require('./intFreshdeskField.controller');router[_0x7a66('0x7')]('/',auth[_0x7a66('0x8')](),controller[_0x7a66('0x9')]);router[_0x7a66('0x7')](_0x7a66('0xa'),auth['isAuthenticated'](),controller[_0x7a66('0xb')]);router[_0x7a66('0xc')]('/',auth[_0x7a66('0x8')](),controller[_0x7a66('0xd')]);router[_0x7a66('0xe')]('/:id',auth[_0x7a66('0x8')](),controller[_0x7a66('0xf')]);router[_0x7a66('0x10')]('/:id',auth[_0x7a66('0x8')](),controller[_0x7a66('0x11')]);module[_0x7a66('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index a9715ac..84c820b 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 _0xf4b7=['picklist','STRING','ENUM','variable','BOOLEAN','sequelize','exports','string','customVariable','keyValue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf4b7,0x91));var _0x7f4b=function(_0x237a98,_0x5d0a0c){_0x237a98=_0x237a98-0x0;var _0x5bbb94=_0xf4b7[_0x237a98];return _0x5bbb94;};'use strict';var Sequelize=require(_0x7f4b('0x0'));module[_0x7f4b('0x1')]={'type':{'type':Sequelize['ENUM'](_0x7f4b('0x2'),'variable',_0x7f4b('0x3'),_0x7f4b('0x4'),_0x7f4b('0x5')),'defaultValue':_0x7f4b('0x2')},'content':{'type':Sequelize[_0x7f4b('0x6')]},'key':{'type':Sequelize[_0x7f4b('0x6')]},'keyType':{'type':Sequelize[_0x7f4b('0x7')]('string',_0x7f4b('0x8'),_0x7f4b('0x3'))},'keyContent':{'type':Sequelize[_0x7f4b('0x6')]},'idField':{'type':Sequelize[_0x7f4b('0x6')]},'nameField':{'type':Sequelize[_0x7f4b('0x6')]},'customField':{'type':Sequelize[_0x7f4b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7f4b('0x6')]}}; \ No newline at end of file +var _0x9a13=['BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x4ab99,_0x219ed2){var _0x29e39c=function(_0x2dd986){while(--_0x2dd986){_0x4ab99['push'](_0x4ab99['shift']());}};_0x29e39c(++_0x219ed2);}(_0x9a13,0xeb));var _0x39a1=function(_0x2b8fc4,_0x503415){_0x2b8fc4=_0x2b8fc4-0x0;var _0x4bc58e=_0x9a13[_0x2b8fc4];return _0x4bc58e;};'use strict';var Sequelize=require('sequelize');module[_0x39a1('0x0')]={'type':{'type':Sequelize[_0x39a1('0x1')](_0x39a1('0x2'),_0x39a1('0x3'),_0x39a1('0x4'),_0x39a1('0x5'),_0x39a1('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x39a1('0x7')]},'key':{'type':Sequelize[_0x39a1('0x7')]},'keyType':{'type':Sequelize[_0x39a1('0x1')](_0x39a1('0x2'),_0x39a1('0x3'),_0x39a1('0x4'))},'keyContent':{'type':Sequelize[_0x39a1('0x7')]},'idField':{'type':Sequelize[_0x39a1('0x7')]},'nameField':{'type':Sequelize[_0x39a1('0x7')]},'customField':{'type':Sequelize[_0x39a1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x39a1('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 5550331..a3bddc8 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 _0xd691=['include','find','update','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','params','keys'];(function(_0x4b7c35,_0xac1fcd){var _0xf07be5=function(_0x138907){while(--_0x138907){_0x4b7c35['push'](_0x4b7c35['shift']());}};_0xf07be5(++_0xac1fcd);}(_0xd691,0xe6));var _0x1d69=function(_0x16ecad,_0x205047){_0x16ecad=_0x16ecad-0x0;var _0x313ff7=_0xd691[_0x16ecad];return _0x313ff7;};'use strict';var emlformat=require(_0x1d69('0x0'));var rimraf=require(_0x1d69('0x1'));var zipdir=require(_0x1d69('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1d69('0x3'));var moment=require(_0x1d69('0x4'));var BPromise=require(_0x1d69('0x5'));var Mustache=require(_0x1d69('0x6'));var util=require(_0x1d69('0x7'));var path=require(_0x1d69('0x8'));var sox=require(_0x1d69('0x9'));var csv=require(_0x1d69('0xa'));var ejs=require(_0x1d69('0xb'));var fs=require('fs');var fs_extra=require(_0x1d69('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1d69('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1d69('0xe'));var toCsv=require(_0x1d69('0xa'));var querystring=require(_0x1d69('0xf'));var Papa=require(_0x1d69('0x10'));var Redis=require('ioredis');var authService=require(_0x1d69('0x11'));var qs=require(_0x1d69('0x12'));var as=require(_0x1d69('0x13'));var hardwareService=require(_0x1d69('0x14'));var logger=require(_0x1d69('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x1d69('0x16'));var licenseUtil=require(_0x1d69('0x17'));var db=require(_0x1d69('0x18'))['db'];function respondWithStatusCode(_0x36ca70,_0x3f703a){_0x3f703a=_0x3f703a||0xcc;return function(_0x78b25d){if(_0x78b25d){return _0x36ca70[_0x1d69('0x19')](_0x3f703a);}return _0x36ca70[_0x1d69('0x1a')](_0x3f703a)[_0x1d69('0x1b')]();};}function respondWithResult(_0x7121cb,_0x292721){_0x292721=_0x292721||0xc8;return function(_0x1f4271){if(_0x1f4271){return _0x7121cb[_0x1d69('0x1a')](_0x292721)['json'](_0x1f4271);}};}function respondWithFilteredResult(_0x52f53d,_0x12e7cd){return function(_0x3fb5d2){if(_0x3fb5d2){var _0x29dd32=typeof _0x12e7cd[_0x1d69('0x1c')]===_0x1d69('0x1d')&&typeof _0x12e7cd[_0x1d69('0x1e')]==='undefined';var _0xb7f031=_0x3fb5d2[_0x1d69('0x1f')];var _0x34f6d4=_0x29dd32?0x0:_0x12e7cd['offset'];var _0x4cebea=_0x29dd32?_0x3fb5d2[_0x1d69('0x1f')]:_0x12e7cd[_0x1d69('0x1c')]+_0x12e7cd[_0x1d69('0x1e')];var _0x57bb5d;if(_0x4cebea>=_0xb7f031){_0x4cebea=_0xb7f031;_0x57bb5d=0xc8;}else{_0x57bb5d=0xce;}_0x52f53d[_0x1d69('0x1a')](_0x57bb5d);return _0x52f53d[_0x1d69('0x20')](_0x1d69('0x21'),_0x34f6d4+'-'+_0x4cebea+'/'+_0xb7f031)[_0x1d69('0x22')](_0x3fb5d2);}return null;};}function patchUpdates(_0x3ef4dc){return function(_0x24feaa){try{jsonpatch[_0x1d69('0x23')](_0x24feaa,_0x3ef4dc,!![]);}catch(_0x62968f){return BPromise['reject'](_0x62968f);}return _0x24feaa[_0x1d69('0x24')]();};}function saveUpdates(_0x122238,_0x1786e1){return function(_0x228d18){if(_0x228d18){return _0x228d18['update'](_0x122238)[_0x1d69('0x25')](function(_0x411ca0){return _0x411ca0;});}return null;};}function removeEntity(_0x2b9a7a,_0x54783d){return function(_0x5352d3){if(_0x5352d3){return _0x5352d3['destroy']()[_0x1d69('0x25')](function(){_0x2b9a7a[_0x1d69('0x1a')](0xcc)[_0x1d69('0x1b')]();});}};}function handleEntityNotFound(_0x1c91bf,_0x4f4449){return function(_0x3af518){if(!_0x3af518){_0x1c91bf[_0x1d69('0x19')](0x194);}return _0x3af518;};}function handleError(_0x51e91b,_0x377913){_0x377913=_0x377913||0x1f4;return function(_0x2dc73f){logger[_0x1d69('0x26')](_0x2dc73f[_0x1d69('0x27')]);if(_0x2dc73f[_0x1d69('0x28')]){delete _0x2dc73f[_0x1d69('0x28')];}_0x51e91b['status'](_0x377913)[_0x1d69('0x29')](_0x2dc73f);};}exports[_0x1d69('0x2a')]=function(_0x3c6b2b,_0x1d521b){var _0x3c0962={},_0x1e5818={},_0x2fd8d3={'count':0x0,'rows':[]};var _0x215052=_[_0x1d69('0x2b')](db[_0x1d69('0x2c')][_0x1d69('0x2d')],function(_0x5e8e8e){return{'name':_0x5e8e8e[_0x1d69('0x2e')],'type':_0x5e8e8e['type'][_0x1d69('0x2f')]};});_0x1e5818[_0x1d69('0x30')]=_[_0x1d69('0x2b')](_0x215052,_0x1d69('0x28'));_0x1e5818['query']=_['keys'](_0x3c6b2b[_0x1d69('0x31')]);_0x1e5818['filters']=_[_0x1d69('0x32')](_0x1e5818[_0x1d69('0x30')],_0x1e5818[_0x1d69('0x31')]);_0x3c0962[_0x1d69('0x33')]=_[_0x1d69('0x32')](_0x1e5818[_0x1d69('0x30')],qs[_0x1d69('0x34')](_0x3c6b2b[_0x1d69('0x31')][_0x1d69('0x34')]));_0x3c0962[_0x1d69('0x33')]=_0x3c0962[_0x1d69('0x33')][_0x1d69('0x35')]?_0x3c0962[_0x1d69('0x33')]:_0x1e5818[_0x1d69('0x30')];if(!_0x3c6b2b['query'][_0x1d69('0x36')](_0x1d69('0x37'))){_0x3c0962[_0x1d69('0x1e')]=qs[_0x1d69('0x1e')](_0x3c6b2b[_0x1d69('0x31')]['limit']);_0x3c0962[_0x1d69('0x1c')]=qs[_0x1d69('0x1c')](_0x3c6b2b[_0x1d69('0x31')][_0x1d69('0x1c')]);}_0x3c0962['order']=qs[_0x1d69('0x38')](_0x3c6b2b[_0x1d69('0x31')][_0x1d69('0x38')]);_0x3c0962[_0x1d69('0x39')]=qs[_0x1d69('0x3a')](_['pick'](_0x3c6b2b['query'],_0x1e5818['filters']),_0x215052);if(_0x3c6b2b[_0x1d69('0x31')][_0x1d69('0x3b')]){_0x3c0962['where']=_[_0x1d69('0x3c')](_0x3c0962[_0x1d69('0x39')],{'$or':_[_0x1d69('0x2b')](_0x215052,function(_0x497e02){if(_0x497e02[_0x1d69('0x3d')]!==_0x1d69('0x3e')){var _0x1a8ba4={};_0x1a8ba4[_0x497e02[_0x1d69('0x28')]]={'$like':'%'+_0x3c6b2b['query'][_0x1d69('0x3b')]+'%'};return _0x1a8ba4;}})});}_0x3c0962=_[_0x1d69('0x3c')]({},_0x3c0962,_0x3c6b2b[_0x1d69('0x3f')]);var _0x3c09bb={'where':_0x3c0962['where']};return db[_0x1d69('0x2c')][_0x1d69('0x1f')](_0x3c09bb)[_0x1d69('0x25')](function(_0x38306a){_0x2fd8d3[_0x1d69('0x1f')]=_0x38306a;if(_0x3c6b2b[_0x1d69('0x31')][_0x1d69('0x40')]){_0x3c0962['include']=[{'all':!![]}];}return db[_0x1d69('0x2c')][_0x1d69('0x41')](_0x3c0962);})['then'](function(_0x3d68c3){_0x2fd8d3['rows']=_0x3d68c3;return _0x2fd8d3;})[_0x1d69('0x25')](respondWithFilteredResult(_0x1d521b,_0x3c0962))[_0x1d69('0x42')](handleError(_0x1d521b,null));};exports[_0x1d69('0x43')]=function(_0xc052d6,_0x5b0a74){var _0x1d6fee={'raw':!![],'where':{'id':_0xc052d6[_0x1d69('0x44')]['id']}},_0x21dfc2={};_0x21dfc2['model']=_[_0x1d69('0x45')](db['FreshdeskField']['rawAttributes']);_0x21dfc2[_0x1d69('0x31')]=_[_0x1d69('0x45')](_0xc052d6['query']);_0x21dfc2[_0x1d69('0x3a')]=_['intersection'](_0x21dfc2[_0x1d69('0x30')],_0x21dfc2[_0x1d69('0x31')]);_0x1d6fee['attributes']=_[_0x1d69('0x32')](_0x21dfc2[_0x1d69('0x30')],qs[_0x1d69('0x34')](_0xc052d6['query'][_0x1d69('0x34')]));_0x1d6fee[_0x1d69('0x33')]=_0x1d6fee[_0x1d69('0x33')][_0x1d69('0x35')]?_0x1d6fee[_0x1d69('0x33')]:_0x21dfc2[_0x1d69('0x30')];if(_0xc052d6[_0x1d69('0x31')][_0x1d69('0x40')]){_0x1d6fee[_0x1d69('0x46')]=[{'all':!![]}];}_0x1d6fee=_[_0x1d69('0x3c')]({},_0x1d6fee,_0xc052d6[_0x1d69('0x3f')]);return db[_0x1d69('0x2c')][_0x1d69('0x47')](_0x1d6fee)[_0x1d69('0x25')](handleEntityNotFound(_0x5b0a74,null))[_0x1d69('0x25')](respondWithResult(_0x5b0a74,null))[_0x1d69('0x42')](handleError(_0x5b0a74,null));};exports['create']=function(_0x438b3a,_0x11cf7c){return db[_0x1d69('0x2c')]['create'](_0x438b3a['body'],{})[_0x1d69('0x25')](respondWithResult(_0x11cf7c,0xc9))['catch'](handleError(_0x11cf7c,null));};exports[_0x1d69('0x48')]=function(_0x370645,_0x131304){if(_0x370645['body']['id']){delete _0x370645['body']['id'];}return db[_0x1d69('0x2c')]['find']({'where':{'id':_0x370645[_0x1d69('0x44')]['id']}})['then'](handleEntityNotFound(_0x131304,null))['then'](saveUpdates(_0x370645[_0x1d69('0x49')],null))[_0x1d69('0x25')](respondWithResult(_0x131304,null))[_0x1d69('0x42')](handleError(_0x131304,null));};exports[_0x1d69('0x4a')]=function(_0x442041,_0x4e6453){return db[_0x1d69('0x2c')][_0x1d69('0x47')]({'where':{'id':_0x442041['params']['id']}})[_0x1d69('0x25')](handleEntityNotFound(_0x4e6453,null))[_0x1d69('0x25')](removeEntity(_0x4e6453,null))[_0x1d69('0x42')](handleError(_0x4e6453,null));}; \ No newline at end of file +var _0xee5b=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','keys','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash'];(function(_0x33f1f1,_0x3f2a10){var _0x3052d4=function(_0x2d62ad){while(--_0x2d62ad){_0x33f1f1['push'](_0x33f1f1['shift']());}};_0x3052d4(++_0x3f2a10);}(_0xee5b,0x1f4));var _0xbee5=function(_0x2c1293,_0x54ab26){_0x2c1293=_0x2c1293-0x0;var _0x2755bb=_0xee5b[_0x2c1293];return _0x2755bb;};'use strict';var emlformat=require(_0xbee5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbee5('0x1'));var jsonpatch=require(_0xbee5('0x2'));var rp=require('request-promise');var moment=require(_0xbee5('0x3'));var BPromise=require(_0xbee5('0x4'));var Mustache=require(_0xbee5('0x5'));var util=require(_0xbee5('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xbee5('0x7'));var ejs=require(_0xbee5('0x8'));var fs=require('fs');var fs_extra=require(_0xbee5('0x9'));var _=require(_0xbee5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbee5('0xb'));var Papa=require(_0xbee5('0xc'));var Redis=require(_0xbee5('0xd'));var authService=require(_0xbee5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbee5('0xf'));var hardwareService=require(_0xbee5('0x10'));var logger=require(_0xbee5('0x11'))(_0xbee5('0x12'));var utils=require(_0xbee5('0x13'));var config=require(_0xbee5('0x14'));var licenseUtil=require(_0xbee5('0x15'));var db=require(_0xbee5('0x16'))['db'];function respondWithStatusCode(_0xcef158,_0x48f771){_0x48f771=_0x48f771||0xcc;return function(_0x14e032){if(_0x14e032){return _0xcef158['sendStatus'](_0x48f771);}return _0xcef158[_0xbee5('0x17')](_0x48f771)[_0xbee5('0x18')]();};}function respondWithResult(_0x8a268f,_0x593ecb){_0x593ecb=_0x593ecb||0xc8;return function(_0x5092f2){if(_0x5092f2){return _0x8a268f[_0xbee5('0x17')](_0x593ecb)['json'](_0x5092f2);}};}function respondWithFilteredResult(_0x40afcb,_0x5426c9){return function(_0x1a24bd){if(_0x1a24bd){var _0x141878=typeof _0x5426c9[_0xbee5('0x19')]==='undefined'&&typeof _0x5426c9[_0xbee5('0x1a')]===_0xbee5('0x1b');var _0x5a0ae5=_0x1a24bd[_0xbee5('0x1c')];var _0x538460=_0x141878?0x0:_0x5426c9[_0xbee5('0x19')];var _0x3c3f4e=_0x141878?_0x1a24bd[_0xbee5('0x1c')]:_0x5426c9[_0xbee5('0x19')]+_0x5426c9[_0xbee5('0x1a')];var _0xa50ec9;if(_0x3c3f4e>=_0x5a0ae5){_0x3c3f4e=_0x5a0ae5;_0xa50ec9=0xc8;}else{_0xa50ec9=0xce;}_0x40afcb[_0xbee5('0x17')](_0xa50ec9);return _0x40afcb[_0xbee5('0x1d')](_0xbee5('0x1e'),_0x538460+'-'+_0x3c3f4e+'/'+_0x5a0ae5)[_0xbee5('0x1f')](_0x1a24bd);}return null;};}function patchUpdates(_0x35d7d3){return function(_0x40a06){try{jsonpatch[_0xbee5('0x20')](_0x40a06,_0x35d7d3,!![]);}catch(_0x47af8e){return BPromise['reject'](_0x47af8e);}return _0x40a06[_0xbee5('0x21')]();};}function saveUpdates(_0x48bfb5,_0x205491){return function(_0x117cb3){if(_0x117cb3){return _0x117cb3[_0xbee5('0x22')](_0x48bfb5)[_0xbee5('0x23')](function(_0x3f23c5){return _0x3f23c5;});}return null;};}function removeEntity(_0xb665df,_0x359ccf){return function(_0x3cfa8d){if(_0x3cfa8d){return _0x3cfa8d[_0xbee5('0x24')]()['then'](function(){_0xb665df['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x519473,_0x50d774){return function(_0x1af3de){if(!_0x1af3de){_0x519473[_0xbee5('0x25')](0x194);}return _0x1af3de;};}function handleError(_0x3b84c8,_0x28c74d){_0x28c74d=_0x28c74d||0x1f4;return function(_0x169042){logger[_0xbee5('0x26')](_0x169042[_0xbee5('0x27')]);if(_0x169042['name']){delete _0x169042[_0xbee5('0x28')];}_0x3b84c8[_0xbee5('0x17')](_0x28c74d)[_0xbee5('0x29')](_0x169042);};}exports[_0xbee5('0x2a')]=function(_0x1a8bcc,_0x5f0419){var _0x21b993={},_0x15ffb1={},_0xb7a077={'count':0x0,'rows':[]};var _0x136a00=_[_0xbee5('0x2b')](db[_0xbee5('0x2c')][_0xbee5('0x2d')],function(_0x36e8bb){return{'name':_0x36e8bb[_0xbee5('0x2e')],'type':_0x36e8bb['type'][_0xbee5('0x2f')]};});_0x15ffb1['model']=_[_0xbee5('0x2b')](_0x136a00,'name');_0x15ffb1[_0xbee5('0x30')]=_['keys'](_0x1a8bcc[_0xbee5('0x30')]);_0x15ffb1['filters']=_[_0xbee5('0x31')](_0x15ffb1[_0xbee5('0x32')],_0x15ffb1[_0xbee5('0x30')]);_0x21b993[_0xbee5('0x33')]=_['intersection'](_0x15ffb1[_0xbee5('0x32')],qs[_0xbee5('0x34')](_0x1a8bcc[_0xbee5('0x30')][_0xbee5('0x34')]));_0x21b993['attributes']=_0x21b993[_0xbee5('0x33')][_0xbee5('0x35')]?_0x21b993[_0xbee5('0x33')]:_0x15ffb1[_0xbee5('0x32')];if(!_0x1a8bcc['query'][_0xbee5('0x36')](_0xbee5('0x37'))){_0x21b993[_0xbee5('0x1a')]=qs[_0xbee5('0x1a')](_0x1a8bcc['query'][_0xbee5('0x1a')]);_0x21b993['offset']=qs[_0xbee5('0x19')](_0x1a8bcc['query']['offset']);}_0x21b993['order']=qs[_0xbee5('0x38')](_0x1a8bcc[_0xbee5('0x30')][_0xbee5('0x38')]);_0x21b993[_0xbee5('0x39')]=qs[_0xbee5('0x3a')](_[_0xbee5('0x3b')](_0x1a8bcc[_0xbee5('0x30')],_0x15ffb1[_0xbee5('0x3a')]),_0x136a00);if(_0x1a8bcc['query'][_0xbee5('0x3c')]){_0x21b993['where']=_[_0xbee5('0x3d')](_0x21b993[_0xbee5('0x39')],{'$or':_[_0xbee5('0x2b')](_0x136a00,function(_0x49d700){if(_0x49d700['type']!==_0xbee5('0x3e')){var _0x4eb1f8={};_0x4eb1f8[_0x49d700['name']]={'$like':'%'+_0x1a8bcc[_0xbee5('0x30')][_0xbee5('0x3c')]+'%'};return _0x4eb1f8;}})});}_0x21b993=_[_0xbee5('0x3d')]({},_0x21b993,_0x1a8bcc[_0xbee5('0x3f')]);var _0x5a2b14={'where':_0x21b993[_0xbee5('0x39')]};return db[_0xbee5('0x2c')][_0xbee5('0x1c')](_0x5a2b14)[_0xbee5('0x23')](function(_0xdcd148){_0xb7a077[_0xbee5('0x1c')]=_0xdcd148;if(_0x1a8bcc[_0xbee5('0x30')][_0xbee5('0x40')]){_0x21b993[_0xbee5('0x41')]=[{'all':!![]}];}return db[_0xbee5('0x2c')]['findAll'](_0x21b993);})[_0xbee5('0x23')](function(_0x371015){_0xb7a077['rows']=_0x371015;return _0xb7a077;})[_0xbee5('0x23')](respondWithFilteredResult(_0x5f0419,_0x21b993))[_0xbee5('0x42')](handleError(_0x5f0419,null));};exports[_0xbee5('0x43')]=function(_0x56e3d0,_0x4dad75){var _0x4cfe54={'raw':!![],'where':{'id':_0x56e3d0[_0xbee5('0x44')]['id']}},_0x4b4641={};_0x4b4641[_0xbee5('0x32')]=_[_0xbee5('0x45')](db[_0xbee5('0x2c')][_0xbee5('0x2d')]);_0x4b4641[_0xbee5('0x30')]=_[_0xbee5('0x45')](_0x56e3d0[_0xbee5('0x30')]);_0x4b4641[_0xbee5('0x3a')]=_['intersection'](_0x4b4641['model'],_0x4b4641[_0xbee5('0x30')]);_0x4cfe54['attributes']=_[_0xbee5('0x31')](_0x4b4641[_0xbee5('0x32')],qs['fields'](_0x56e3d0[_0xbee5('0x30')][_0xbee5('0x34')]));_0x4cfe54['attributes']=_0x4cfe54['attributes'][_0xbee5('0x35')]?_0x4cfe54[_0xbee5('0x33')]:_0x4b4641['model'];if(_0x56e3d0[_0xbee5('0x30')][_0xbee5('0x40')]){_0x4cfe54['include']=[{'all':!![]}];}_0x4cfe54=_[_0xbee5('0x3d')]({},_0x4cfe54,_0x56e3d0[_0xbee5('0x3f')]);return db[_0xbee5('0x2c')][_0xbee5('0x46')](_0x4cfe54)[_0xbee5('0x23')](handleEntityNotFound(_0x4dad75,null))[_0xbee5('0x23')](respondWithResult(_0x4dad75,null))[_0xbee5('0x42')](handleError(_0x4dad75,null));};exports['create']=function(_0xd9173,_0x34f01d){return db[_0xbee5('0x2c')][_0xbee5('0x47')](_0xd9173['body'],{})[_0xbee5('0x23')](respondWithResult(_0x34f01d,0xc9))[_0xbee5('0x42')](handleError(_0x34f01d,null));};exports[_0xbee5('0x22')]=function(_0x4aa21a,_0x44d4b1){if(_0x4aa21a[_0xbee5('0x48')]['id']){delete _0x4aa21a['body']['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x4aa21a[_0xbee5('0x44')]['id']}})['then'](handleEntityNotFound(_0x44d4b1,null))[_0xbee5('0x23')](saveUpdates(_0x4aa21a[_0xbee5('0x48')],null))[_0xbee5('0x23')](respondWithResult(_0x44d4b1,null))[_0xbee5('0x42')](handleError(_0x44d4b1,null));};exports[_0xbee5('0x24')]=function(_0x296fc8,_0x55e654){return db[_0xbee5('0x2c')][_0xbee5('0x46')]({'where':{'id':_0x296fc8[_0xbee5('0x44')]['id']}})[_0xbee5('0x23')](handleEntityNotFound(_0x55e654,null))['then'](removeEntity(_0x55e654,null))[_0xbee5('0x42')](handleError(_0x55e654,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 93acbae..00af38a 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 _0x052a=['int_freshdesk_fields','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskField.attributes','exports','define'];(function(_0x242c29,_0x59918e){var _0x5a3eb4=function(_0x5369c1){while(--_0x5369c1){_0x242c29['push'](_0x242c29['shift']());}};_0x5a3eb4(++_0x59918e);}(_0x052a,0x16f));var _0xa052=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x052a[_0x92c450];return _0x2a9599;};'use strict';var _=require('lodash');var util=require(_0xa052('0x0'));var logger=require(_0xa052('0x1'))(_0xa052('0x2'));var moment=require(_0xa052('0x3'));var BPromise=require(_0xa052('0x4'));var rp=require(_0xa052('0x5'));var fs=require('fs');var path=require(_0xa052('0x6'));var rimraf=require(_0xa052('0x7'));var config=require('../../config/environment');var attributes=require(_0xa052('0x8'));module[_0xa052('0x9')]=function(_0x2cddac,_0x36190b){return _0x2cddac[_0xa052('0xa')]('FreshdeskField',attributes,{'tableName':_0xa052('0xb'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0xa052('0xc'),_0xa052('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1cf6=['../../config/logger','moment','bluebird','request-promise','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','freshdesk_unique_index','lodash','util'];(function(_0x5c6f53,_0x5f08f6){var _0x4b9fff=function(_0x34595f){while(--_0x34595f){_0x5c6f53['push'](_0x5c6f53['shift']());}};_0x4b9fff(++_0x5f08f6);}(_0x1cf6,0x1ba));var _0x61cf=function(_0x4fe222,_0x36f33e){_0x4fe222=_0x4fe222-0x0;var _0x38eead=_0x1cf6[_0x4fe222];return _0x38eead;};'use strict';var _=require(_0x61cf('0x0'));var util=require(_0x61cf('0x1'));var logger=require(_0x61cf('0x2'))('api');var moment=require(_0x61cf('0x3'));var BPromise=require(_0x61cf('0x4'));var rp=require(_0x61cf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x61cf('0x6'));var attributes=require(_0x61cf('0x7'));module[_0x61cf('0x8')]=function(_0x4c03d6,_0x19deca){return _0x4c03d6[_0x61cf('0x9')](_0x61cf('0xa'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x61cf('0xb'),'fields':['idField','FieldId'],'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 c17341e..2c4503f 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 _0x67c5=['debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskField,\x20%s,\x20%s','message','info','util','randomstring','ioredis','rpc','../../config/environment','http','request','then','request\x20sent'];(function(_0x4a4cfb,_0x26b944){var _0x511ebd=function(_0x7dd800){while(--_0x7dd800){_0x4a4cfb['push'](_0x4a4cfb['shift']());}};_0x511ebd(++_0x26b944);}(_0x67c5,0x16d));var _0x567c=function(_0x431baa,_0x3e48a9){_0x431baa=_0x431baa-0x0;var _0x521616=_0x67c5[_0x431baa];return _0x521616;};'use strict';var _=require('lodash');var util=require(_0x567c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x567c('0x1'));var fs=require('fs');var Redis=require(_0x567c('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x567c('0x3'));var config=require(_0x567c('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x567c('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x2ebed4,_0xbdea79,_0x4ea830){return new BPromise(function(_0x5ddf35,_0x91e82){return client[_0x567c('0x6')](_0x2ebed4,_0x4ea830)[_0x567c('0x7')](function(_0x4dade6){logger['info']('FreshdeskField,\x20%s,\x20%s',_0xbdea79,_0x567c('0x8'));logger[_0x567c('0x9')](_0x567c('0xa'),_0xbdea79,_0x567c('0x8'),JSON[_0x567c('0xb')](_0x4dade6));if(_0x4dade6[_0x567c('0xc')]){if(_0x4dade6[_0x567c('0xc')][_0x567c('0xd')]===0x1f4){logger['error'](_0x567c('0xe'),_0xbdea79,_0x4dade6[_0x567c('0xc')][_0x567c('0xf')]);return _0x91e82(_0x4dade6[_0x567c('0xc')][_0x567c('0xf')]);}logger[_0x567c('0xc')](_0x567c('0xe'),_0xbdea79,_0x4dade6[_0x567c('0xc')][_0x567c('0xf')]);return _0x5ddf35(_0x4dade6[_0x567c('0xc')][_0x567c('0xf')]);}else{logger[_0x567c('0x10')](_0x567c('0xe'),_0xbdea79,_0x567c('0x8'));_0x5ddf35(_0x4dade6['result'][_0x567c('0xf')]);}})['catch'](function(_0x389071){logger['error'](_0x567c('0xe'),_0xbdea79,_0x389071);_0x91e82(_0x389071);});});} \ No newline at end of file +var _0xb545=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FreshdeskField,\x20%s,\x20%s','lodash','util','moment'];(function(_0xb16827,_0x336318){var _0x19a18d=function(_0x3ee987){while(--_0x3ee987){_0xb16827['push'](_0xb16827['shift']());}};_0x19a18d(++_0x336318);}(_0xb545,0x195));var _0x5b54=function(_0x355741,_0x24a3c8){_0x355741=_0x355741-0x0;var _0x30bdee=_0xb545[_0x355741];return _0x30bdee;};'use strict';var _=require(_0x5b54('0x0'));var util=require(_0x5b54('0x1'));var moment=require(_0x5b54('0x2'));var BPromise=require(_0x5b54('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b54('0x4'));var db=require(_0x5b54('0x5'))['db'];var utils=require(_0x5b54('0x6'));var logger=require('../../config/logger')(_0x5b54('0x7'));var config=require(_0x5b54('0x8'));var jayson=require(_0x5b54('0x9'));var client=jayson[_0x5b54('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe61e71,_0x35ddb8,_0x5be850){return new BPromise(function(_0xe279b1,_0x324321){return client[_0x5b54('0xb')](_0xe61e71,_0x5be850)[_0x5b54('0xc')](function(_0x2d7c1f){logger[_0x5b54('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x35ddb8,'request\x20sent');logger[_0x5b54('0xe')](_0x5b54('0xf'),_0x35ddb8,_0x5b54('0x10'),JSON[_0x5b54('0x11')](_0x2d7c1f));if(_0x2d7c1f[_0x5b54('0x12')]){if(_0x2d7c1f[_0x5b54('0x12')][_0x5b54('0x13')]===0x1f4){logger[_0x5b54('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x35ddb8,_0x2d7c1f[_0x5b54('0x12')][_0x5b54('0x14')]);return _0x324321(_0x2d7c1f[_0x5b54('0x12')]['message']);}logger[_0x5b54('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x35ddb8,_0x2d7c1f[_0x5b54('0x12')][_0x5b54('0x14')]);return _0xe279b1(_0x2d7c1f[_0x5b54('0x12')][_0x5b54('0x14')]);}else{logger['info']('FreshdeskField,\x20%s,\x20%s',_0x35ddb8,_0x5b54('0x10'));_0xe279b1(_0x2d7c1f[_0x5b54('0x15')][_0x5b54('0x14')]);}})[_0x5b54('0x16')](function(_0x2a97bf){logger[_0x5b54('0x12')](_0x5b54('0x17'),_0x35ddb8,_0x2a97bf);_0x324321(_0x2a97bf);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 31abdd6..e7e42c5 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 _0x0fd9=['../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x320cb3,_0x49c0cf){var _0x899c86=function(_0x9fc8f){while(--_0x9fc8f){_0x320cb3['push'](_0x320cb3['shift']());}};_0x899c86(++_0x49c0cf);}(_0x0fd9,0xa3));var _0x90fd=function(_0x5a4400,_0xfae3b6){_0x5a4400=_0x5a4400-0x0;var _0xf9b532=_0x0fd9[_0x5a4400];return _0xf9b532;};'use strict';var multer=require('multer');var util=require(_0x90fd('0x0'));var path=require(_0x90fd('0x1'));var timeout=require(_0x90fd('0x2'));var express=require(_0x90fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x90fd('0x4'));var interaction=require(_0x90fd('0x5'));var config=require(_0x90fd('0x6'));var controller=require(_0x90fd('0x7'));router[_0x90fd('0x8')]('/',auth[_0x90fd('0x9')](),controller['index']);router['get'](_0x90fd('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x90fd('0x8')](_0x90fd('0xb'),auth['isAuthenticated'](),controller[_0x90fd('0xc')]);router[_0x90fd('0x8')](_0x90fd('0xd'),auth[_0x90fd('0x9')](),controller[_0x90fd('0xe')]);router[_0x90fd('0xf')]('/',auth[_0x90fd('0x9')](),controller[_0x90fd('0x10')]);router[_0x90fd('0xf')]('/:id/configurations',auth[_0x90fd('0x9')](),controller[_0x90fd('0x11')]);router['put'](_0x90fd('0xa'),auth[_0x90fd('0x9')](),controller[_0x90fd('0x12')]);router['delete'](_0x90fd('0xa'),auth['isAuthenticated'](),controller[_0x90fd('0x13')]);module[_0x90fd('0x14')]=router; \ No newline at end of file +var _0x7334=['put','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x337748,_0x402b05){var _0x3bb03f=function(_0x2fcdf4){while(--_0x2fcdf4){_0x337748['push'](_0x337748['shift']());}};_0x3bb03f(++_0x402b05);}(_0x7334,0x184));var _0x4733=function(_0x4cc8ea,_0x2dba5){_0x4cc8ea=_0x4cc8ea-0x0;var _0x1dca6d=_0x7334[_0x4cc8ea];return _0x1dca6d;};'use strict';var multer=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var path=require(_0x4733('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4733('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4733('0x4'));var interaction=require(_0x4733('0x5'));var config=require(_0x4733('0x6'));var controller=require(_0x4733('0x7'));router[_0x4733('0x8')]('/',auth[_0x4733('0x9')](),controller[_0x4733('0xa')]);router[_0x4733('0x8')](_0x4733('0xb'),auth[_0x4733('0x9')](),controller[_0x4733('0xc')]);router[_0x4733('0x8')](_0x4733('0xd'),auth[_0x4733('0x9')](),controller[_0x4733('0xe')]);router[_0x4733('0x8')](_0x4733('0xf'),auth['isAuthenticated'](),controller[_0x4733('0x10')]);router[_0x4733('0x11')]('/',auth['isAuthenticated'](),controller[_0x4733('0x12')]);router['post'](_0x4733('0xd'),auth[_0x4733('0x9')](),controller[_0x4733('0x13')]);router[_0x4733('0x14')](_0x4733('0xb'),auth[_0x4733('0x9')](),controller[_0x4733('0x15')]);router['delete'](_0x4733('0xb'),auth['isAuthenticated'](),controller[_0x4733('0x16')]);module[_0x4733('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 3c736dd..a495bf7 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 _0x4213=['exports','STRING','username','remoteUri','sequelize'];(function(_0x15d103,_0x3fb612){var _0x52773b=function(_0x9dbde7){while(--_0x9dbde7){_0x15d103['push'](_0x15d103['shift']());}};_0x52773b(++_0x3fb612);}(_0x4213,0x77));var _0x3421=function(_0x3cd77b,_0x570710){_0x3cd77b=_0x3cd77b-0x0;var _0x1ca2b3=_0x4213[_0x3cd77b];return _0x1ca2b3;};'use strict';var Sequelize=require(_0x3421('0x0'));module[_0x3421('0x1')]={'name':{'type':Sequelize[_0x3421('0x2')]},'description':{'type':Sequelize[_0x3421('0x2')]},'username':{'type':Sequelize[_0x3421('0x2')],'unique':_0x3421('0x3')},'apiKey':{'type':Sequelize[_0x3421('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x3421('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x8f4c=['sequelize','exports','STRING','username','remoteUri'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x8f4c,0x113));var _0xc8f4=function(_0x151ec9,_0x3d974f){_0x151ec9=_0x151ec9-0x0;var _0x1af291=_0x8f4c[_0x151ec9];return _0x1af291;};'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 diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 5c878cd..cc05d0a 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 _0xfeb9=['offset','undefined','count','limit','Content-Range','apply','reject','save','destroy','then','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','FreshsalesAccount','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','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','../../components/integrations/configuration','sendStatus','status','end'];(function(_0xd84294,_0xf08a4c){var _0x4efc14=function(_0xd07ad9){while(--_0xd07ad9){_0xd84294['push'](_0xd84294['shift']());}};_0x4efc14(++_0xf08a4c);}(_0xfeb9,0x122));var _0x9feb=function(_0x11e3f4,_0x1c0e89){_0x11e3f4=_0x11e3f4-0x0;var _0x48b126=_0xfeb9[_0x11e3f4];return _0x48b126;};'use strict';var emlformat=require(_0x9feb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9feb('0x1'));var jsonpatch=require(_0x9feb('0x2'));var rp=require(_0x9feb('0x3'));var moment=require(_0x9feb('0x4'));var BPromise=require(_0x9feb('0x5'));var Mustache=require('mustache');var util=require(_0x9feb('0x6'));var path=require(_0x9feb('0x7'));var sox=require(_0x9feb('0x8'));var csv=require(_0x9feb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9feb('0xa'));var squel=require(_0x9feb('0xb'));var crypto=require(_0x9feb('0xc'));var jsforce=require(_0x9feb('0xd'));var deskjs=require(_0x9feb('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9feb('0xf'));var Redis=require(_0x9feb('0x10'));var authService=require(_0x9feb('0x11'));var qs=require(_0x9feb('0x12'));var as=require(_0x9feb('0x13'));var hardwareService=require(_0x9feb('0x14'));var logger=require(_0x9feb('0x15'))(_0x9feb('0x16'));var utils=require(_0x9feb('0x17'));var config=require(_0x9feb('0x18'));var licenseUtil=require(_0x9feb('0x19'));var db=require(_0x9feb('0x1a'))['db'];var integrations=require(_0x9feb('0x1b'));function respondWithStatusCode(_0x35d004,_0xc5f5a8){_0xc5f5a8=_0xc5f5a8||0xcc;return function(_0x3abc22){if(_0x3abc22){return _0x35d004[_0x9feb('0x1c')](_0xc5f5a8);}return _0x35d004[_0x9feb('0x1d')](_0xc5f5a8)[_0x9feb('0x1e')]();};}function respondWithResult(_0x407bb5,_0x27aa61){_0x27aa61=_0x27aa61||0xc8;return function(_0x5c8e1a){if(_0x5c8e1a){return _0x407bb5[_0x9feb('0x1d')](_0x27aa61)['json'](_0x5c8e1a);}};}function respondWithFilteredResult(_0x21a08e,_0xdb1bee){return function(_0x176e34){if(_0x176e34){var _0x33b2ff=typeof _0xdb1bee[_0x9feb('0x1f')]==='undefined'&&typeof _0xdb1bee['limit']===_0x9feb('0x20');var _0x3846e0=_0x176e34[_0x9feb('0x21')];var _0x3fc439=_0x33b2ff?0x0:_0xdb1bee[_0x9feb('0x1f')];var _0x5653dc=_0x33b2ff?_0x176e34[_0x9feb('0x21')]:_0xdb1bee[_0x9feb('0x1f')]+_0xdb1bee[_0x9feb('0x22')];var _0xf18e66;if(_0x5653dc>=_0x3846e0){_0x5653dc=_0x3846e0;_0xf18e66=0xc8;}else{_0xf18e66=0xce;}_0x21a08e['status'](_0xf18e66);return _0x21a08e['set'](_0x9feb('0x23'),_0x3fc439+'-'+_0x5653dc+'/'+_0x3846e0)['json'](_0x176e34);}return null;};}function patchUpdates(_0x1c55cf){return function(_0x381999){try{jsonpatch[_0x9feb('0x24')](_0x381999,_0x1c55cf,!![]);}catch(_0x4a64f9){return BPromise[_0x9feb('0x25')](_0x4a64f9);}return _0x381999[_0x9feb('0x26')]();};}function saveUpdates(_0x5e4bc0,_0x401a03){return function(_0x5aa11e){if(_0x5aa11e){return _0x5aa11e['update'](_0x5e4bc0)['then'](function(_0x2868e8){return _0x2868e8;});}return null;};}function removeEntity(_0xe2daa8,_0x280675){return function(_0x1066db){if(_0x1066db){return _0x1066db[_0x9feb('0x27')]()[_0x9feb('0x28')](function(){_0xe2daa8[_0x9feb('0x1d')](0xcc)[_0x9feb('0x1e')]();});}};}function handleEntityNotFound(_0x161bb9,_0x593a3d){return function(_0x5020ab){if(!_0x5020ab){_0x161bb9[_0x9feb('0x1c')](0x194);}return _0x5020ab;};}function handleError(_0x2a3cac,_0x3338b6){_0x3338b6=_0x3338b6||0x1f4;return function(_0x2421cd){logger['error'](_0x2421cd[_0x9feb('0x29')]);if(_0x2421cd[_0x9feb('0x2a')]){delete _0x2421cd[_0x9feb('0x2a')];}_0x2a3cac[_0x9feb('0x1d')](_0x3338b6)[_0x9feb('0x2b')](_0x2421cd);};}exports['index']=function(_0x4c35cc,_0xcf04eb){var _0x29271b={},_0x16d108={},_0x98a7f4={'count':0x0,'rows':[]};var _0xec0615=_[_0x9feb('0x2c')](db['FreshsalesAccount'][_0x9feb('0x2d')],function(_0x1c7bcf){return{'name':_0x1c7bcf['fieldName'],'type':_0x1c7bcf[_0x9feb('0x2e')][_0x9feb('0x2f')]};});_0x16d108[_0x9feb('0x30')]=_['map'](_0xec0615,_0x9feb('0x2a'));_0x16d108[_0x9feb('0x31')]=_[_0x9feb('0x32')](_0x4c35cc['query']);_0x16d108[_0x9feb('0x33')]=_['intersection'](_0x16d108['model'],_0x16d108[_0x9feb('0x31')]);_0x29271b[_0x9feb('0x34')]=_[_0x9feb('0x35')](_0x16d108[_0x9feb('0x30')],qs[_0x9feb('0x36')](_0x4c35cc[_0x9feb('0x31')][_0x9feb('0x36')]));_0x29271b[_0x9feb('0x34')]=_0x29271b['attributes'][_0x9feb('0x37')]?_0x29271b[_0x9feb('0x34')]:_0x16d108[_0x9feb('0x30')];if(!_0x4c35cc['query'][_0x9feb('0x38')]('nolimit')){_0x29271b[_0x9feb('0x22')]=qs[_0x9feb('0x22')](_0x4c35cc[_0x9feb('0x31')][_0x9feb('0x22')]);_0x29271b[_0x9feb('0x1f')]=qs[_0x9feb('0x1f')](_0x4c35cc[_0x9feb('0x31')][_0x9feb('0x1f')]);}_0x29271b['order']=qs[_0x9feb('0x39')](_0x4c35cc[_0x9feb('0x31')][_0x9feb('0x39')]);_0x29271b[_0x9feb('0x3a')]=qs[_0x9feb('0x33')](_[_0x9feb('0x3b')](_0x4c35cc[_0x9feb('0x31')],_0x16d108[_0x9feb('0x33')]),_0xec0615);if(_0x4c35cc[_0x9feb('0x31')][_0x9feb('0x3c')]){_0x29271b[_0x9feb('0x3a')]=_[_0x9feb('0x3d')](_0x29271b[_0x9feb('0x3a')],{'$or':_['map'](_0xec0615,function(_0x210391){if(_0x210391[_0x9feb('0x2e')]!==_0x9feb('0x3e')){var _0x493387={};_0x493387[_0x210391['name']]={'$like':'%'+_0x4c35cc[_0x9feb('0x31')][_0x9feb('0x3c')]+'%'};return _0x493387;}})});}_0x29271b=_[_0x9feb('0x3d')]({},_0x29271b,_0x4c35cc[_0x9feb('0x3f')]);var _0x33e3f7={'where':_0x29271b['where']};return db['FreshsalesAccount']['count'](_0x33e3f7)[_0x9feb('0x28')](function(_0x1d5cbf){_0x98a7f4[_0x9feb('0x21')]=_0x1d5cbf;if(_0x4c35cc[_0x9feb('0x31')][_0x9feb('0x40')]){_0x29271b[_0x9feb('0x41')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x9feb('0x42')](_0x29271b);})[_0x9feb('0x28')](function(_0x2a072b){_0x98a7f4[_0x9feb('0x43')]=_0x2a072b;return _0x98a7f4;})[_0x9feb('0x28')](respondWithFilteredResult(_0xcf04eb,_0x29271b))[_0x9feb('0x44')](handleError(_0xcf04eb,null));};exports[_0x9feb('0x45')]=function(_0x458fe9,_0x2aeb4c){var _0x1fa46d={'raw':![],'where':{'id':_0x458fe9[_0x9feb('0x46')]['id']}},_0x36a968={};_0x36a968['model']=_[_0x9feb('0x32')](db[_0x9feb('0x47')][_0x9feb('0x2d')]);_0x36a968[_0x9feb('0x31')]=_['keys'](_0x458fe9[_0x9feb('0x31')]);_0x36a968['filters']=_['intersection'](_0x36a968[_0x9feb('0x30')],_0x36a968[_0x9feb('0x31')]);_0x1fa46d[_0x9feb('0x34')]=_['intersection'](_0x36a968[_0x9feb('0x30')],qs[_0x9feb('0x36')](_0x458fe9['query']['fields']));_0x1fa46d[_0x9feb('0x34')]=_0x1fa46d['attributes']['length']?_0x1fa46d[_0x9feb('0x34')]:_0x36a968[_0x9feb('0x30')];if(_0x458fe9[_0x9feb('0x31')]['includeAll']){_0x1fa46d[_0x9feb('0x41')]=[{'all':!![]}];}_0x1fa46d=_['merge']({},_0x1fa46d,_0x458fe9[_0x9feb('0x3f')]);return db['FreshsalesAccount'][_0x9feb('0x48')](_0x1fa46d)['then'](handleEntityNotFound(_0x2aeb4c,null))[_0x9feb('0x28')](respondWithResult(_0x2aeb4c,null))['catch'](handleError(_0x2aeb4c,null));};exports[_0x9feb('0x49')]=function(_0x5ea40d,_0x3d448e){return db[_0x9feb('0x47')][_0x9feb('0x49')](_0x5ea40d[_0x9feb('0x4a')],{})['then'](respondWithResult(_0x3d448e,0xc9))[_0x9feb('0x44')](handleError(_0x3d448e,null));};exports['update']=function(_0x59e706,_0x589e52){if(_0x59e706[_0x9feb('0x4a')]['id']){delete _0x59e706[_0x9feb('0x4a')]['id'];}return db[_0x9feb('0x47')]['find']({'where':{'id':_0x59e706[_0x9feb('0x46')]['id']}})['then'](handleEntityNotFound(_0x589e52,null))[_0x9feb('0x28')](saveUpdates(_0x59e706['body'],null))[_0x9feb('0x28')](respondWithResult(_0x589e52,null))[_0x9feb('0x44')](handleError(_0x589e52,null));};exports['destroy']=function(_0x37e21a,_0xbdce4){return db[_0x9feb('0x47')][_0x9feb('0x48')]({'where':{'id':_0x37e21a[_0x9feb('0x46')]['id']}})['then'](handleEntityNotFound(_0xbdce4,null))[_0x9feb('0x28')](removeEntity(_0xbdce4,null))[_0x9feb('0x44')](handleError(_0xbdce4,null));};exports[_0x9feb('0x4b')]=function(_0x5e1f7e,_0xef01a5,_0x33478d){var _0x3efdec={};var _0x5674c3={};var _0x1c3747;var _0x5189bf;return db[_0x9feb('0x47')][_0x9feb('0x4c')]({'where':{'id':_0x5e1f7e[_0x9feb('0x46')]['id']}})[_0x9feb('0x28')](handleEntityNotFound(_0xef01a5,null))['then'](function(_0x24ea53){if(_0x24ea53){_0x1c3747=_0x24ea53;_0x5674c3[_0x9feb('0x30')]=_['keys'](db[_0x9feb('0x4d')]['rawAttributes']);_0x5674c3[_0x9feb('0x31')]=_[_0x9feb('0x32')](_0x5e1f7e[_0x9feb('0x31')]);_0x5674c3[_0x9feb('0x33')]=_[_0x9feb('0x35')](_0x5674c3['model'],_0x5674c3[_0x9feb('0x31')]);_0x3efdec[_0x9feb('0x34')]=_[_0x9feb('0x35')](_0x5674c3[_0x9feb('0x30')],qs[_0x9feb('0x36')](_0x5e1f7e[_0x9feb('0x31')][_0x9feb('0x36')]));_0x3efdec[_0x9feb('0x34')]=_0x3efdec['attributes'][_0x9feb('0x37')]?_0x3efdec['attributes']:_0x5674c3['model'];_0x3efdec['order']=qs['sort'](_0x5e1f7e[_0x9feb('0x31')][_0x9feb('0x39')]);_0x3efdec[_0x9feb('0x3a')]=qs[_0x9feb('0x33')](_['pick'](_0x5e1f7e[_0x9feb('0x31')],_0x5674c3['filters']));if(_0x5e1f7e[_0x9feb('0x31')][_0x9feb('0x3c')]){_0x3efdec[_0x9feb('0x3a')]=_[_0x9feb('0x3d')](_0x3efdec['where'],{'$or':_[_0x9feb('0x2c')](_0x3efdec[_0x9feb('0x34')],function(_0x2227e7){var _0x3b5c63={};_0x3b5c63[_0x2227e7]={'$like':'%'+_0x5e1f7e['query'][_0x9feb('0x3c')]+'%'};return _0x3b5c63;})});}_0x3efdec=_['merge']({},_0x3efdec,_0x5e1f7e['options']);return _0x1c3747[_0x9feb('0x4b')](_0x3efdec);}})['then'](function(_0x490c54){if(_0x490c54){_0x5189bf=_0x490c54[_0x9feb('0x37')];if(!_0x5e1f7e[_0x9feb('0x31')][_0x9feb('0x38')](_0x9feb('0x4e'))){_0x3efdec[_0x9feb('0x22')]=qs['limit'](_0x5e1f7e[_0x9feb('0x31')][_0x9feb('0x22')]);_0x3efdec['offset']=qs['offset'](_0x5e1f7e[_0x9feb('0x31')][_0x9feb('0x1f')]);}return _0x1c3747[_0x9feb('0x4b')](_0x3efdec);}})[_0x9feb('0x28')](function(_0x2b7476){if(_0x2b7476){return _0x2b7476?{'count':_0x5189bf,'rows':_0x2b7476}:null;}})[_0x9feb('0x28')](respondWithResult(_0xef01a5,null))[_0x9feb('0x44')](handleError(_0xef01a5,null));};exports[_0x9feb('0x4f')]=function(_0x17e056,_0x393723,_0x1c6879){if(_0x17e056['body']['id']){delete _0x17e056['body']['id'];}return db[_0x9feb('0x47')][_0x9feb('0x4c')]({'where':{'id':_0x17e056['params']['id']}})[_0x9feb('0x28')](handleEntityNotFound(_0x393723,null))[_0x9feb('0x28')](function(_0x4fe95d){if(_0x4fe95d){_0x17e056[_0x9feb('0x4a')][_0x9feb('0x50')]=_0x4fe95d['id'];_0x17e056[_0x9feb('0x4a')][_0x9feb('0x51')]=integrations[_0x9feb('0x52')](_0x17e056[_0x9feb('0x4a')][_0x9feb('0x53')],_0x17e056['body'][_0x9feb('0x2e')]);_0x17e056['body'][_0x9feb('0x54')]=integrations['getDescriptions'](_0x17e056[_0x9feb('0x4a')][_0x9feb('0x53')],_0x17e056[_0x9feb('0x4a')][_0x9feb('0x2e')]);return db[_0x9feb('0x4d')][_0x9feb('0x49')](_0x17e056[_0x9feb('0x4a')],{'include':[{'model':db[_0x9feb('0x55')],'as':'Subjects'},{'model':db['FreshsalesField'],'as':_0x9feb('0x54')}]});}return null;})['then'](respondWithResult(_0x393723,null))[_0x9feb('0x44')](handleError(_0x393723,null));};exports[_0x9feb('0x56')]=function(_0x2141c8,_0x17dcd2,_0x54f89d){var _0xe18062='';var _0x405fac='';return db[_0x9feb('0x47')][_0x9feb('0x4c')]({'where':{'id':_0x2141c8[_0x9feb('0x46')]['id']},'attributes':['id',_0x9feb('0x57'),_0x9feb('0x58'),_0x9feb('0x59')]})[_0x9feb('0x28')](handleEntityNotFound(_0x17dcd2,null))[_0x9feb('0x28')](function(_0x485f96){if(_0x485f96){_0x405fac=_0x485f96[_0x9feb('0x57')];_0xe18062=_0x485f96[_0x9feb('0x58')];var _0x1f7ac8=_0x485f96['remoteUri'][_0x9feb('0x5a')](-0x1);if(_0x1f7ac8==='/'){_0xe18062=_0xe18062[_0x9feb('0x5b')](0x0,_0xe18062[_0x9feb('0x5c')](_0x1f7ac8));}return rp({'method':_0x9feb('0x5d'),'uri':util[_0x9feb('0x5e')](_0x9feb('0x5f'),_0xe18062,_0x9feb('0x60')),'headers':{'Authorization':_0x9feb('0x61')+_0x485f96[_0x9feb('0x59')]},'json':!![]});}})['then'](function(_0x102451){if(_0x102451){var _0x2bdf0a=_0x102451[_0x9feb('0x62')];var _0x546e9c=![];var _0x1fc8d5=null;for(_0x1fc8d5=0x0;_0x1fc8d5<_0x2bdf0a['length'];_0x1fc8d5++){if(_0x2bdf0a[_0x1fc8d5][_0x9feb('0x63')]===_0x405fac){_0x546e9c=!![];}}if(_0x546e9c){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x9feb('0x64')});}}})['then'](respondWithResult(_0x17dcd2,null))[_0x9feb('0x44')](function(_0x28a842){var _0x182cfc=_0x2141c8['query'][_0x9feb('0x65')]?0x1f4:_0x28a842[_0x9feb('0x66')]||0x1f4;logger[_0x9feb('0x67')](_0x9feb('0x68'),_0x9feb('0x56'),_0x182cfc,JSON[_0x9feb('0x69')](_0x28a842));delete _0x28a842[_0x9feb('0x2a')];if(_0x182cfc===0x191){_0x182cfc=0x190;}_0x17dcd2[_0x9feb('0x1d')](_0x182cfc)['send'](_0x2141c8['query'][_0x9feb('0x65')]?{'message':_0x9feb('0x6a'),'statusCode':_0x28a842[_0x9feb('0x66')]}:_0x28a842);});}; \ No newline at end of file +var _0x0e90=['count','set','apply','reject','save','update','then','destroy','error','name','send','map','FreshsalesAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','findOne','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','apiKey','slice','GET','%s%s','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x14b3e5,_0x5a2144){var _0x4279c3=function(_0x263b6d){while(--_0x263b6d){_0x14b3e5['push'](_0x14b3e5['shift']());}};_0x4279c3(++_0x5a2144);}(_0x0e90,0xad));var _0x00e9=function(_0x3575f7,_0x588e81){_0x3575f7=_0x3575f7-0x0;var _0x17ea08=_0x0e90[_0x3575f7];return _0x17ea08;};'use strict';var emlformat=require(_0x00e9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x00e9('0x1'));var jsonpatch=require(_0x00e9('0x2'));var rp=require(_0x00e9('0x3'));var moment=require('moment');var BPromise=require(_0x00e9('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x00e9('0x5'));var sox=require(_0x00e9('0x6'));var csv=require('to-csv');var ejs=require(_0x00e9('0x7'));var fs=require('fs');var fs_extra=require(_0x00e9('0x8'));var _=require(_0x00e9('0x9'));var squel=require(_0x00e9('0xa'));var crypto=require(_0x00e9('0xb'));var jsforce=require(_0x00e9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x00e9('0xd'));var querystring=require(_0x00e9('0xe'));var Papa=require(_0x00e9('0xf'));var Redis=require(_0x00e9('0x10'));var authService=require(_0x00e9('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x00e9('0x12'));var logger=require(_0x00e9('0x13'))('api');var utils=require(_0x00e9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x00e9('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x44eb7e,_0x3276d6){_0x3276d6=_0x3276d6||0xcc;return function(_0x5ca1cf){if(_0x5ca1cf){return _0x44eb7e[_0x00e9('0x16')](_0x3276d6);}return _0x44eb7e[_0x00e9('0x17')](_0x3276d6)[_0x00e9('0x18')]();};}function respondWithResult(_0xc2cf08,_0x44b81f){_0x44b81f=_0x44b81f||0xc8;return function(_0x2a2aa1){if(_0x2a2aa1){return _0xc2cf08[_0x00e9('0x17')](_0x44b81f)[_0x00e9('0x19')](_0x2a2aa1);}};}function respondWithFilteredResult(_0x3edcbb,_0x909f08){return function(_0x3c62de){if(_0x3c62de){var _0x8263cf=typeof _0x909f08[_0x00e9('0x1a')]===_0x00e9('0x1b')&&typeof _0x909f08[_0x00e9('0x1c')]==='undefined';var _0x38d0b2=_0x3c62de[_0x00e9('0x1d')];var _0x4b80c6=_0x8263cf?0x0:_0x909f08['offset'];var _0x2e792d=_0x8263cf?_0x3c62de[_0x00e9('0x1d')]:_0x909f08['offset']+_0x909f08[_0x00e9('0x1c')];var _0x26409c;if(_0x2e792d>=_0x38d0b2){_0x2e792d=_0x38d0b2;_0x26409c=0xc8;}else{_0x26409c=0xce;}_0x3edcbb[_0x00e9('0x17')](_0x26409c);return _0x3edcbb[_0x00e9('0x1e')]('Content-Range',_0x4b80c6+'-'+_0x2e792d+'/'+_0x38d0b2)[_0x00e9('0x19')](_0x3c62de);}return null;};}function patchUpdates(_0x295d13){return function(_0x14bcf2){try{jsonpatch[_0x00e9('0x1f')](_0x14bcf2,_0x295d13,!![]);}catch(_0x4d2b7c){return BPromise[_0x00e9('0x20')](_0x4d2b7c);}return _0x14bcf2[_0x00e9('0x21')]();};}function saveUpdates(_0x25f013,_0x422da6){return function(_0x5b8f68){if(_0x5b8f68){return _0x5b8f68[_0x00e9('0x22')](_0x25f013)[_0x00e9('0x23')](function(_0x507cb7){return _0x507cb7;});}return null;};}function removeEntity(_0x508d45,_0x8de762){return function(_0x1c0156){if(_0x1c0156){return _0x1c0156[_0x00e9('0x24')]()['then'](function(){_0x508d45[_0x00e9('0x17')](0xcc)[_0x00e9('0x18')]();});}};}function handleEntityNotFound(_0x1ef51c,_0x112519){return function(_0x4e5695){if(!_0x4e5695){_0x1ef51c['sendStatus'](0x194);}return _0x4e5695;};}function handleError(_0x3007d5,_0x47040f){_0x47040f=_0x47040f||0x1f4;return function(_0xa84552){logger[_0x00e9('0x25')](_0xa84552['stack']);if(_0xa84552[_0x00e9('0x26')]){delete _0xa84552[_0x00e9('0x26')];}_0x3007d5['status'](_0x47040f)[_0x00e9('0x27')](_0xa84552);};}exports['index']=function(_0x4414ee,_0x24b4a5){var _0x863036={},_0x2aa836={},_0x23ead2={'count':0x0,'rows':[]};var _0x5d29de=_[_0x00e9('0x28')](db[_0x00e9('0x29')][_0x00e9('0x2a')],function(_0x38fa1c){return{'name':_0x38fa1c[_0x00e9('0x2b')],'type':_0x38fa1c[_0x00e9('0x2c')][_0x00e9('0x2d')]};});_0x2aa836['model']=_[_0x00e9('0x28')](_0x5d29de,'name');_0x2aa836[_0x00e9('0x2e')]=_[_0x00e9('0x2f')](_0x4414ee[_0x00e9('0x2e')]);_0x2aa836[_0x00e9('0x30')]=_[_0x00e9('0x31')](_0x2aa836[_0x00e9('0x32')],_0x2aa836[_0x00e9('0x2e')]);_0x863036['attributes']=_[_0x00e9('0x31')](_0x2aa836['model'],qs[_0x00e9('0x33')](_0x4414ee[_0x00e9('0x2e')][_0x00e9('0x33')]));_0x863036[_0x00e9('0x34')]=_0x863036[_0x00e9('0x34')][_0x00e9('0x35')]?_0x863036[_0x00e9('0x34')]:_0x2aa836[_0x00e9('0x32')];if(!_0x4414ee[_0x00e9('0x2e')][_0x00e9('0x36')]('nolimit')){_0x863036[_0x00e9('0x1c')]=qs[_0x00e9('0x1c')](_0x4414ee[_0x00e9('0x2e')][_0x00e9('0x1c')]);_0x863036[_0x00e9('0x1a')]=qs['offset'](_0x4414ee[_0x00e9('0x2e')]['offset']);}_0x863036[_0x00e9('0x37')]=qs[_0x00e9('0x38')](_0x4414ee[_0x00e9('0x2e')][_0x00e9('0x38')]);_0x863036['where']=qs[_0x00e9('0x30')](_[_0x00e9('0x39')](_0x4414ee[_0x00e9('0x2e')],_0x2aa836[_0x00e9('0x30')]),_0x5d29de);if(_0x4414ee['query'][_0x00e9('0x3a')]){_0x863036[_0x00e9('0x3b')]=_[_0x00e9('0x3c')](_0x863036['where'],{'$or':_[_0x00e9('0x28')](_0x5d29de,function(_0x49f25e){if(_0x49f25e[_0x00e9('0x2c')]!==_0x00e9('0x3d')){var _0x9d224a={};_0x9d224a[_0x49f25e['name']]={'$like':'%'+_0x4414ee[_0x00e9('0x2e')][_0x00e9('0x3a')]+'%'};return _0x9d224a;}})});}_0x863036=_[_0x00e9('0x3c')]({},_0x863036,_0x4414ee[_0x00e9('0x3e')]);var _0x3e1c92={'where':_0x863036['where']};return db[_0x00e9('0x29')][_0x00e9('0x1d')](_0x3e1c92)[_0x00e9('0x23')](function(_0x49a070){_0x23ead2[_0x00e9('0x1d')]=_0x49a070;if(_0x4414ee[_0x00e9('0x2e')][_0x00e9('0x3f')]){_0x863036[_0x00e9('0x40')]=[{'all':!![]}];}return db[_0x00e9('0x29')][_0x00e9('0x41')](_0x863036);})[_0x00e9('0x23')](function(_0x68037b){_0x23ead2[_0x00e9('0x42')]=_0x68037b;return _0x23ead2;})[_0x00e9('0x23')](respondWithFilteredResult(_0x24b4a5,_0x863036))[_0x00e9('0x43')](handleError(_0x24b4a5,null));};exports[_0x00e9('0x44')]=function(_0x1157e8,_0x102a6b){var _0x29cc1f={'raw':![],'where':{'id':_0x1157e8['params']['id']}},_0x4be56f={};_0x4be56f[_0x00e9('0x32')]=_[_0x00e9('0x2f')](db[_0x00e9('0x29')][_0x00e9('0x2a')]);_0x4be56f[_0x00e9('0x2e')]=_[_0x00e9('0x2f')](_0x1157e8[_0x00e9('0x2e')]);_0x4be56f['filters']=_[_0x00e9('0x31')](_0x4be56f['model'],_0x4be56f[_0x00e9('0x2e')]);_0x29cc1f[_0x00e9('0x34')]=_[_0x00e9('0x31')](_0x4be56f[_0x00e9('0x32')],qs[_0x00e9('0x33')](_0x1157e8[_0x00e9('0x2e')][_0x00e9('0x33')]));_0x29cc1f[_0x00e9('0x34')]=_0x29cc1f[_0x00e9('0x34')][_0x00e9('0x35')]?_0x29cc1f['attributes']:_0x4be56f[_0x00e9('0x32')];if(_0x1157e8[_0x00e9('0x2e')][_0x00e9('0x3f')]){_0x29cc1f[_0x00e9('0x40')]=[{'all':!![]}];}_0x29cc1f=_[_0x00e9('0x3c')]({},_0x29cc1f,_0x1157e8[_0x00e9('0x3e')]);return db[_0x00e9('0x29')][_0x00e9('0x45')](_0x29cc1f)[_0x00e9('0x23')](handleEntityNotFound(_0x102a6b,null))[_0x00e9('0x23')](respondWithResult(_0x102a6b,null))[_0x00e9('0x43')](handleError(_0x102a6b,null));};exports[_0x00e9('0x46')]=function(_0x449938,_0x38ee0b){return db[_0x00e9('0x29')]['create'](_0x449938[_0x00e9('0x47')],{})['then'](respondWithResult(_0x38ee0b,0xc9))[_0x00e9('0x43')](handleError(_0x38ee0b,null));};exports[_0x00e9('0x22')]=function(_0x1eba68,_0x3b3ebd){if(_0x1eba68[_0x00e9('0x47')]['id']){delete _0x1eba68[_0x00e9('0x47')]['id'];}return db[_0x00e9('0x29')]['find']({'where':{'id':_0x1eba68[_0x00e9('0x48')]['id']}})[_0x00e9('0x23')](handleEntityNotFound(_0x3b3ebd,null))[_0x00e9('0x23')](saveUpdates(_0x1eba68['body'],null))[_0x00e9('0x23')](respondWithResult(_0x3b3ebd,null))[_0x00e9('0x43')](handleError(_0x3b3ebd,null));};exports[_0x00e9('0x24')]=function(_0x32d043,_0x34756a){return db[_0x00e9('0x29')]['find']({'where':{'id':_0x32d043['params']['id']}})['then'](handleEntityNotFound(_0x34756a,null))['then'](removeEntity(_0x34756a,null))[_0x00e9('0x43')](handleError(_0x34756a,null));};exports['getConfigurations']=function(_0x21f86f,_0x1e676a,_0x26d691){var _0x4d8ba7={};var _0x7879fb={};var _0x26783e;var _0x102f11;return db[_0x00e9('0x29')][_0x00e9('0x49')]({'where':{'id':_0x21f86f[_0x00e9('0x48')]['id']}})['then'](handleEntityNotFound(_0x1e676a,null))[_0x00e9('0x23')](function(_0x552270){if(_0x552270){_0x26783e=_0x552270;_0x7879fb[_0x00e9('0x32')]=_['keys'](db['FreshsalesConfiguration'][_0x00e9('0x2a')]);_0x7879fb[_0x00e9('0x2e')]=_['keys'](_0x21f86f[_0x00e9('0x2e')]);_0x7879fb[_0x00e9('0x30')]=_[_0x00e9('0x31')](_0x7879fb[_0x00e9('0x32')],_0x7879fb[_0x00e9('0x2e')]);_0x4d8ba7['attributes']=_[_0x00e9('0x31')](_0x7879fb[_0x00e9('0x32')],qs[_0x00e9('0x33')](_0x21f86f['query'][_0x00e9('0x33')]));_0x4d8ba7['attributes']=_0x4d8ba7[_0x00e9('0x34')]['length']?_0x4d8ba7['attributes']:_0x7879fb[_0x00e9('0x32')];_0x4d8ba7[_0x00e9('0x37')]=qs[_0x00e9('0x38')](_0x21f86f[_0x00e9('0x2e')][_0x00e9('0x38')]);_0x4d8ba7[_0x00e9('0x3b')]=qs[_0x00e9('0x30')](_[_0x00e9('0x39')](_0x21f86f[_0x00e9('0x2e')],_0x7879fb[_0x00e9('0x30')]));if(_0x21f86f[_0x00e9('0x2e')][_0x00e9('0x3a')]){_0x4d8ba7[_0x00e9('0x3b')]=_[_0x00e9('0x3c')](_0x4d8ba7['where'],{'$or':_[_0x00e9('0x28')](_0x4d8ba7[_0x00e9('0x34')],function(_0x23022a){var _0x4d6b06={};_0x4d6b06[_0x23022a]={'$like':'%'+_0x21f86f[_0x00e9('0x2e')][_0x00e9('0x3a')]+'%'};return _0x4d6b06;})});}_0x4d8ba7=_[_0x00e9('0x3c')]({},_0x4d8ba7,_0x21f86f[_0x00e9('0x3e')]);return _0x26783e[_0x00e9('0x4a')](_0x4d8ba7);}})['then'](function(_0x114c16){if(_0x114c16){_0x102f11=_0x114c16[_0x00e9('0x35')];if(!_0x21f86f['query'][_0x00e9('0x36')](_0x00e9('0x4b'))){_0x4d8ba7[_0x00e9('0x1c')]=qs[_0x00e9('0x1c')](_0x21f86f[_0x00e9('0x2e')][_0x00e9('0x1c')]);_0x4d8ba7[_0x00e9('0x1a')]=qs['offset'](_0x21f86f[_0x00e9('0x2e')]['offset']);}return _0x26783e[_0x00e9('0x4a')](_0x4d8ba7);}})[_0x00e9('0x23')](function(_0x128689){if(_0x128689){return _0x128689?{'count':_0x102f11,'rows':_0x128689}:null;}})['then'](respondWithResult(_0x1e676a,null))[_0x00e9('0x43')](handleError(_0x1e676a,null));};exports[_0x00e9('0x4c')]=function(_0x35f099,_0x354949,_0x54734e){if(_0x35f099[_0x00e9('0x47')]['id']){delete _0x35f099[_0x00e9('0x47')]['id'];}return db[_0x00e9('0x29')][_0x00e9('0x49')]({'where':{'id':_0x35f099['params']['id']}})[_0x00e9('0x23')](handleEntityNotFound(_0x354949,null))[_0x00e9('0x23')](function(_0x41becd){if(_0x41becd){_0x35f099[_0x00e9('0x47')][_0x00e9('0x4d')]=_0x41becd['id'];_0x35f099['body'][_0x00e9('0x4e')]=integrations[_0x00e9('0x4f')](_0x35f099['body'][_0x00e9('0x50')],_0x35f099['body'][_0x00e9('0x2c')]);_0x35f099[_0x00e9('0x47')][_0x00e9('0x51')]=integrations[_0x00e9('0x52')](_0x35f099[_0x00e9('0x47')][_0x00e9('0x50')],_0x35f099[_0x00e9('0x47')][_0x00e9('0x2c')]);return db[_0x00e9('0x53')][_0x00e9('0x46')](_0x35f099[_0x00e9('0x47')],{'include':[{'model':db['FreshsalesField'],'as':_0x00e9('0x4e')},{'model':db[_0x00e9('0x54')],'as':'Descriptions'}]});}return null;})[_0x00e9('0x23')](respondWithResult(_0x354949,null))[_0x00e9('0x43')](handleError(_0x354949,null));};exports[_0x00e9('0x55')]=function(_0x4ab324,_0x4127d4,_0x15f556){var _0xdd129b='';var _0x243368='';return db[_0x00e9('0x29')][_0x00e9('0x49')]({'where':{'id':_0x4ab324[_0x00e9('0x48')]['id']},'attributes':['id',_0x00e9('0x56'),_0x00e9('0x57'),_0x00e9('0x58')]})[_0x00e9('0x23')](handleEntityNotFound(_0x4127d4,null))[_0x00e9('0x23')](function(_0x4f2ca0){if(_0x4f2ca0){_0x243368=_0x4f2ca0[_0x00e9('0x56')];_0xdd129b=_0x4f2ca0[_0x00e9('0x57')];var _0x40208a=_0x4f2ca0[_0x00e9('0x57')][_0x00e9('0x59')](-0x1);if(_0x40208a==='/'){_0xdd129b=_0xdd129b['substring'](0x0,_0xdd129b['lastIndexOf'](_0x40208a));}return rp({'method':_0x00e9('0x5a'),'uri':util['format'](_0x00e9('0x5b'),_0xdd129b,_0x00e9('0x5c')),'headers':{'Authorization':'Token\x20token='+_0x4f2ca0['apiKey']},'json':!![]});}})[_0x00e9('0x23')](function(_0x549122){if(_0x549122){var _0x45601e=_0x549122[_0x00e9('0x5d')];var _0x510203=![];var _0x128b98=null;for(_0x128b98=0x0;_0x128b98<_0x45601e[_0x00e9('0x35')];_0x128b98++){if(_0x45601e[_0x128b98][_0x00e9('0x5e')]===_0x243368){_0x510203=!![];}}if(_0x510203){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x00e9('0x5f')});}}})[_0x00e9('0x23')](respondWithResult(_0x4127d4,null))[_0x00e9('0x43')](function(_0x5dac38){var _0x80cb86=_0x4ab324[_0x00e9('0x2e')][_0x00e9('0x60')]?0x1f4:_0x5dac38[_0x00e9('0x61')]||0x1f4;logger[_0x00e9('0x25')](_0x00e9('0x62'),_0x00e9('0x55'),_0x80cb86,JSON[_0x00e9('0x63')](_0x5dac38));delete _0x5dac38[_0x00e9('0x26')];if(_0x80cb86===0x191){_0x80cb86=0x190;}_0x4127d4[_0x00e9('0x17')](_0x80cb86)[_0x00e9('0x27')](_0x4ab324[_0x00e9('0x2e')][_0x00e9('0x60')]?{'message':_0x00e9('0x64'),'statusCode':_0x5dac38[_0x00e9('0x61')]}:_0x5dac38);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 4899bda..21468c0 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 _0x0a6b=['request-promise','path','rimraf','./intFreshsalesAccount.attributes','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','moment'];(function(_0x4570f9,_0x4bc670){var _0x5099a4=function(_0x591ddd){while(--_0x591ddd){_0x4570f9['push'](_0x4570f9['shift']());}};_0x5099a4(++_0x4bc670);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x469d7b,_0x8bd123){_0x469d7b=_0x469d7b-0x0;var _0x4eb5d0=_0x0a6b[_0x469d7b];return _0x4eb5d0;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb0a6('0x1'));var BPromise=require('bluebird');var rp=require(_0xb0a6('0x2'));var fs=require('fs');var path=require(_0xb0a6('0x3'));var rimraf=require(_0xb0a6('0x4'));var config=require('../../config/environment');var attributes=require(_0xb0a6('0x5'));var integrations=require('../../components/integrations/configuration');module[_0xb0a6('0x6')]=function(_0x415e9e,_0x5e2d2d){return _0x415e9e[_0xb0a6('0x7')](_0xb0a6('0x8'),attributes,{'tableName':_0xb0a6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2272=['request-promise','path','rimraf','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x32a6ea,_0x44e86e){var _0x898353=function(_0x4b3e6c){while(--_0x4b3e6c){_0x32a6ea['push'](_0x32a6ea['shift']());}};_0x898353(++_0x44e86e);}(_0x2272,0xd8));var _0x2227=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2272[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x2227('0x0'));var util=require(_0x2227('0x1'));var logger=require(_0x2227('0x2'))(_0x2227('0x3'));var moment=require(_0x2227('0x4'));var BPromise=require('bluebird');var rp=require(_0x2227('0x5'));var fs=require('fs');var path=require(_0x2227('0x6'));var rimraf=require(_0x2227('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x2227('0x8'));module[_0x2227('0x9')]=function(_0xb33647,_0x2591db){return _0xb33647[_0x2227('0xa')](_0x2227('0xb'),attributes,{'tableName':_0x2227('0xc'),'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 e4e06a4..4699c2e 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 _0xe3da=['then','GetFreshsalesAccount','catch','ShowFreshsalesAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','FreshsalesAccount','findAll','options','raw','attributes','limit','include','map','model'];(function(_0x582db2,_0x1d48aa){var _0x1781c3=function(_0x5a929f){while(--_0x5a929f){_0x582db2['push'](_0x582db2['shift']());}};_0x1781c3(++_0x1d48aa);}(_0xe3da,0x1cd));var _0xae3d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe3da[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var moment=require(_0xae3d('0x2'));var BPromise=require(_0xae3d('0x3'));var rs=require(_0xae3d('0x4'));var fs=require('fs');var Redis=require(_0xae3d('0x5'));var db=require(_0xae3d('0x6'))['db'];var utils=require(_0xae3d('0x7'));var logger=require(_0xae3d('0x8'))(_0xae3d('0x9'));var config=require(_0xae3d('0xa'));var jayson=require(_0xae3d('0xb'));var client=jayson[_0xae3d('0xc')][_0xae3d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x476579,_0x33c089,_0x583b98){return new BPromise(function(_0x2a5c45,_0x3d6650){return client['request'](_0x476579,_0x583b98)['then'](function(_0x459592){logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));logger[_0xae3d('0x11')](_0xae3d('0x12'),_0x33c089,'request\x20sent',JSON[_0xae3d('0x13')](_0x459592));if(_0x459592['error']){if(_0x459592[_0xae3d('0x14')][_0xae3d('0x15')]===0x1f4){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592['error'][_0xae3d('0x16')]);return _0x3d6650(_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);}logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);return _0x2a5c45(_0x459592['error'][_0xae3d('0x16')]);}else{logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));_0x2a5c45(_0x459592[_0xae3d('0x17')][_0xae3d('0x16')]);}})['catch'](function(_0xe925fd){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0xe925fd);_0x3d6650(_0xe925fd);});});}exports['GetFreshsalesAccount']=function(_0x3f8cf9){var _0x4cbe4e=this;return new Promise(function(_0x558e42,_0x4d931d){return db[_0xae3d('0x18')][_0xae3d('0x19')]({'raw':_0x3f8cf9[_0xae3d('0x1a')]?_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1b')]===undefined?!![]:![]:!![],'where':_0x3f8cf9['options']?_0x3f8cf9[_0xae3d('0x1a')]['where']||null:null,'attributes':_0x3f8cf9[_0xae3d('0x1a')]?_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1c')]||null:null,'limit':_0x3f8cf9[_0xae3d('0x1a')]?_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1d')]||null:null,'include':_0x3f8cf9[_0xae3d('0x1a')]?_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1e')]?_[_0xae3d('0x1f')](_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1e')],function(_0x37f5ff){return{'model':db[_0x37f5ff[_0xae3d('0x20')]],'as':_0x37f5ff['as'],'attributes':_0x37f5ff[_0xae3d('0x1c')],'include':_0x37f5ff[_0xae3d('0x1e')]?_[_0xae3d('0x1f')](_0x37f5ff[_0xae3d('0x1e')],function(_0x2131e9){return{'model':db[_0x2131e9[_0xae3d('0x20')]],'as':_0x2131e9['as'],'attributes':_0x2131e9['attributes'],'include':_0x2131e9[_0xae3d('0x1e')]?_[_0xae3d('0x1f')](_0x2131e9[_0xae3d('0x1e')],function(_0x52df0f){return{'model':db[_0x52df0f[_0xae3d('0x20')]],'as':_0x52df0f['as'],'attributes':_0x52df0f[_0xae3d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xae3d('0x21')](function(_0x54c1e1){logger['info'](_0xae3d('0x22'),_0x3f8cf9);logger[_0xae3d('0x11')](_0xae3d('0x22'),_0x3f8cf9,JSON[_0xae3d('0x13')](_0x54c1e1));_0x558e42(_0x54c1e1);})[_0xae3d('0x23')](function(_0x561371){logger[_0xae3d('0x14')](_0xae3d('0x22'),_0x561371['message'],_0x3f8cf9);_0x4d931d(_0x4cbe4e[_0xae3d('0x14')](0x1f4,_0x561371[_0xae3d('0x16')]));});});};exports[_0xae3d('0x24')]=function(_0x46f484){var _0x432c04=this;return new Promise(function(_0x6ef13c,_0x5356d4){return db['FreshsalesAccount']['find']({'raw':_0x46f484[_0xae3d('0x1a')]?_0x46f484[_0xae3d('0x1a')][_0xae3d('0x1b')]===undefined?!![]:![]:!![],'where':_0x46f484[_0xae3d('0x1a')]?_0x46f484['options'][_0xae3d('0x25')]||null:null,'attributes':_0x46f484[_0xae3d('0x1a')]?_0x46f484[_0xae3d('0x1a')][_0xae3d('0x1c')]||null:null,'include':_0x46f484[_0xae3d('0x1a')]?_0x46f484[_0xae3d('0x1a')][_0xae3d('0x1e')]?_['map'](_0x46f484[_0xae3d('0x1a')]['include'],function(_0x55aae4){return{'model':db[_0x55aae4[_0xae3d('0x20')]],'as':_0x55aae4['as'],'attributes':_0x55aae4['attributes'],'include':_0x55aae4[_0xae3d('0x1e')]?_['map'](_0x55aae4['include'],function(_0x1a28b5){return{'model':db[_0x1a28b5[_0xae3d('0x20')]],'as':_0x1a28b5['as'],'attributes':_0x1a28b5[_0xae3d('0x1c')],'include':_0x1a28b5['include']?_[_0xae3d('0x1f')](_0x1a28b5['include'],function(_0xce647f){return{'model':db[_0xce647f[_0xae3d('0x20')]],'as':_0xce647f['as'],'attributes':_0xce647f[_0xae3d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xae3d('0x21')](function(_0x18c469){logger[_0xae3d('0xe')](_0xae3d('0x24'),_0x46f484);logger[_0xae3d('0x11')](_0xae3d('0x24'),_0x46f484,JSON[_0xae3d('0x13')](_0x18c469));_0x6ef13c(_0x18c469);})[_0xae3d('0x23')](function(_0x5543ee){logger['error'](_0xae3d('0x24'),_0x5543ee['message'],_0x46f484);_0x5356d4(_0x432c04[_0xae3d('0x14')](0x1f4,_0x5543ee[_0xae3d('0x16')]));});});}; \ No newline at end of file +var _0xbff5=['attributes','limit','include','map','model','GetFreshsalesAccount','FreshsalesAccount','find','raw','ShowFreshsalesAccount','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','findAll','options','where'];(function(_0x3b0696,_0x3447f5){var _0x2a21cc=function(_0x2ac471){while(--_0x2ac471){_0x3b0696['push'](_0x3b0696['shift']());}};_0x2a21cc(++_0x3447f5);}(_0xbff5,0x1bc));var _0x5bff=function(_0x539794,_0x49fb5c){_0x539794=_0x539794-0x0;var _0x110063=_0xbff5[_0x539794];return _0x110063;};'use strict';var _=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var moment=require(_0x5bff('0x2'));var BPromise=require(_0x5bff('0x3'));var rs=require(_0x5bff('0x4'));var fs=require('fs');var Redis=require(_0x5bff('0x5'));var db=require(_0x5bff('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bff('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5bff('0x8'));var client=jayson[_0x5bff('0x9')][_0x5bff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa54c57,_0x43605a,_0xd4b9dc){return new BPromise(function(_0x1acb49,_0x139c99){return client[_0x5bff('0xb')](_0xa54c57,_0xd4b9dc)['then'](function(_0x20e26f){logger['info'](_0x5bff('0xc'),_0x43605a,_0x5bff('0xd'));logger['debug'](_0x5bff('0xe'),_0x43605a,'request\x20sent',JSON[_0x5bff('0xf')](_0x20e26f));if(_0x20e26f['error']){if(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x11')]===0x1f4){logger['error'](_0x5bff('0xc'),_0x43605a,_0x20e26f['error'][_0x5bff('0x12')]);return _0x139c99(_0x20e26f[_0x5bff('0x10')]['message']);}logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x20e26f['error']['message']);return _0x1acb49(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x12')]);}else{logger[_0x5bff('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x43605a,_0x5bff('0xd'));_0x1acb49(_0x20e26f[_0x5bff('0x14')][_0x5bff('0x12')]);}})['catch'](function(_0x3ffbbc){logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x3ffbbc);_0x139c99(_0x3ffbbc);});});}exports['GetFreshsalesAccount']=function(_0xc9fbc3){var _0x279c22=this;return new Promise(function(_0x36653b,_0x32cf60){return db['FreshsalesAccount'][_0x5bff('0x15')]({'raw':_0xc9fbc3['options']?_0xc9fbc3[_0x5bff('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x17')]||null:null,'attributes':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x18')]||null:null,'limit':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x19')]||null:null,'include':_0xc9fbc3['options']?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x1a')]?_[_0x5bff('0x1b')](_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x1a')],function(_0x31d26b){return{'model':db[_0x31d26b[_0x5bff('0x1c')]],'as':_0x31d26b['as'],'attributes':_0x31d26b[_0x5bff('0x18')],'include':_0x31d26b['include']?_['map'](_0x31d26b[_0x5bff('0x1a')],function(_0x53bd97){return{'model':db[_0x53bd97[_0x5bff('0x1c')]],'as':_0x53bd97['as'],'attributes':_0x53bd97[_0x5bff('0x18')],'include':_0x53bd97[_0x5bff('0x1a')]?_[_0x5bff('0x1b')](_0x53bd97[_0x5bff('0x1a')],function(_0x1140eb){return{'model':db[_0x1140eb[_0x5bff('0x1c')]],'as':_0x1140eb['as'],'attributes':_0x1140eb[_0x5bff('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4df57a){logger[_0x5bff('0x13')](_0x5bff('0x1d'),_0xc9fbc3);logger['debug'](_0x5bff('0x1d'),_0xc9fbc3,JSON['stringify'](_0x4df57a));_0x36653b(_0x4df57a);})['catch'](function(_0x3eda3a){logger['error'](_0x5bff('0x1d'),_0x3eda3a[_0x5bff('0x12')],_0xc9fbc3);_0x32cf60(_0x279c22[_0x5bff('0x10')](0x1f4,_0x3eda3a[_0x5bff('0x12')]));});});};exports['ShowFreshsalesAccount']=function(_0x71783){var _0x4ee6f1=this;return new Promise(function(_0x3c1405,_0x5a7873){return db[_0x5bff('0x1e')][_0x5bff('0x1f')]({'raw':_0x71783[_0x5bff('0x16')]?_0x71783[_0x5bff('0x16')][_0x5bff('0x20')]===undefined?!![]:![]:!![],'where':_0x71783[_0x5bff('0x16')]?_0x71783['options'][_0x5bff('0x17')]||null:null,'attributes':_0x71783[_0x5bff('0x16')]?_0x71783[_0x5bff('0x16')][_0x5bff('0x18')]||null:null,'include':_0x71783[_0x5bff('0x16')]?_0x71783[_0x5bff('0x16')][_0x5bff('0x1a')]?_[_0x5bff('0x1b')](_0x71783['options'][_0x5bff('0x1a')],function(_0x16042d){return{'model':db[_0x16042d[_0x5bff('0x1c')]],'as':_0x16042d['as'],'attributes':_0x16042d[_0x5bff('0x18')],'include':_0x16042d['include']?_[_0x5bff('0x1b')](_0x16042d[_0x5bff('0x1a')],function(_0x5a24be){return{'model':db[_0x5a24be[_0x5bff('0x1c')]],'as':_0x5a24be['as'],'attributes':_0x5a24be[_0x5bff('0x18')],'include':_0x5a24be[_0x5bff('0x1a')]?_[_0x5bff('0x1b')](_0x5a24be['include'],function(_0x38245d){return{'model':db[_0x38245d[_0x5bff('0x1c')]],'as':_0x38245d['as'],'attributes':_0x38245d[_0x5bff('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1065d1){logger['info'](_0x5bff('0x21'),_0x71783);logger[_0x5bff('0x22')](_0x5bff('0x21'),_0x71783,JSON['stringify'](_0x1065d1));_0x3c1405(_0x1065d1);})[_0x5bff('0x23')](function(_0x1ec079){logger[_0x5bff('0x10')]('ShowFreshsalesAccount',_0x1ec079[_0x5bff('0x12')],_0x71783);_0x5a7873(_0x4ee6f1[_0x5bff('0x10')](0x1f4,_0x1ec079['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 9725a35..2e595d5 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 _0xd630=['get','/:id','show','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated'];(function(_0x1f466e,_0x54c7fa){var _0x2b6648=function(_0xd6a44c){while(--_0xd6a44c){_0x1f466e['push'](_0x1f466e['shift']());}};_0x2b6648(++_0x54c7fa);}(_0xd630,0xc9));var _0x0d63=function(_0x1fab25,_0x21d71b){_0x1fab25=_0x1fab25-0x0;var _0x46b546=_0xd630[_0x1fab25];return _0x46b546;};'use strict';var multer=require(_0x0d63('0x0'));var util=require(_0x0d63('0x1'));var path=require(_0x0d63('0x2'));var timeout=require('connect-timeout');var express=require(_0x0d63('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0d63('0x4'));var interaction=require(_0x0d63('0x5'));var config=require(_0x0d63('0x6'));var controller=require(_0x0d63('0x7'));router['get']('/',auth[_0x0d63('0x8')](),controller['index']);router[_0x0d63('0x9')](_0x0d63('0xa'),auth[_0x0d63('0x8')](),controller[_0x0d63('0xb')]);router[_0x0d63('0x9')]('/:id/subjects',auth[_0x0d63('0x8')](),controller[_0x0d63('0xc')]);router[_0x0d63('0x9')](_0x0d63('0xd'),auth[_0x0d63('0x8')](),controller[_0x0d63('0xe')]);router[_0x0d63('0x9')](_0x0d63('0xf'),auth['isAuthenticated'](),controller[_0x0d63('0x10')]);router['post']('/',auth[_0x0d63('0x8')](),controller['create']);router['put'](_0x0d63('0xa'),auth[_0x0d63('0x8')](),controller[_0x0d63('0x11')]);router[_0x0d63('0x12')]('/:id',auth[_0x0d63('0x8')](),controller[_0x0d63('0x13')]);module[_0x0d63('0x14')]=router; \ No newline at end of file +var _0x6edb=['exports','multer','connect-timeout','Router','fs-extra','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','/:id','isAuthenticated','/:id/descriptions','/:id/fields','getFields','create','update','delete','destroy'];(function(_0x61711c,_0x5b2962){var _0x4cf0e9=function(_0x179352){while(--_0x179352){_0x61711c['push'](_0x61711c['shift']());}};_0x4cf0e9(++_0x5b2962);}(_0x6edb,0x1ee));var _0xb6ed=function(_0x139b63,_0x389ca8){_0x139b63=_0x139b63-0x0;var _0x2493f2=_0x6edb[_0x139b63];return _0x2493f2;};'use strict';var multer=require(_0xb6ed('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb6ed('0x1'));var express=require('express');var router=express[_0xb6ed('0x2')]();var fs_extra=require(_0xb6ed('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb6ed('0x4'));var config=require('../../config/environment');var controller=require(_0xb6ed('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb6ed('0x6')](_0xb6ed('0x7'),auth[_0xb6ed('0x8')](),controller['show']);router['get']('/:id/subjects',auth[_0xb6ed('0x8')](),controller['getSubjects']);router['get'](_0xb6ed('0x9'),auth[_0xb6ed('0x8')](),controller['getDescriptions']);router[_0xb6ed('0x6')](_0xb6ed('0xa'),auth[_0xb6ed('0x8')](),controller[_0xb6ed('0xb')]);router['post']('/',auth[_0xb6ed('0x8')](),controller[_0xb6ed('0xc')]);router['put'](_0xb6ed('0x7'),auth[_0xb6ed('0x8')](),controller[_0xb6ed('0xd')]);router[_0xb6ed('0xe')](_0xb6ed('0x7'),auth[_0xb6ed('0x8')](),controller[_0xb6ed('0xf')]);module[_0xb6ed('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 4fef18f..1664d8a 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 _0x3f00=['exports','STRING','sequelize'];(function(_0x3ec50d,_0x2b425f){var _0x2961b8=function(_0x50727f){while(--_0x50727f){_0x3ec50d['push'](_0x3ec50d['shift']());}};_0x2961b8(++_0x2b425f);}(_0x3f00,0x185));var _0x03f0=function(_0x341c3c,_0x3452fc){_0x341c3c=_0x341c3c-0x0;var _0x44f9a6=_0x3f00[_0x341c3c];return _0x44f9a6;};'use strict';var Sequelize=require(_0x03f0('0x0'));module[_0x03f0('0x1')]={'name':{'type':Sequelize[_0x03f0('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1eb9=['STRING','sequelize','exports'];(function(_0x2b336b,_0xec2668){var _0xa2d049=function(_0x4a3b51){while(--_0x4a3b51){_0x2b336b['push'](_0x2b336b['shift']());}};_0xa2d049(++_0xec2668);}(_0x1eb9,0x130));var _0x91eb=function(_0x15d178,_0x533561){_0x15d178=_0x15d178-0x0;var _0xc73785=_0x1eb9[_0x15d178];return _0xc73785;};'use strict';var Sequelize=require(_0x91eb('0x0'));module[_0x91eb('0x1')]={'name':{'type':Sequelize[_0x91eb('0x2')]},'description':{'type':Sequelize[_0x91eb('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index f82e817..915dc02 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 _0x60ea=['querystring','../../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','offset','undefined','limit','count','set','Content-Range','json','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','includeAll','find','catch','create','body','getSubjects','findOne','FreshsalesField','order','getDescriptions','getFields','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x45e568,_0x4a63d6){var _0x363b5f=function(_0x575001){while(--_0x575001){_0x45e568['push'](_0x45e568['shift']());}};_0x363b5f(++_0x4a63d6);}(_0x60ea,0x193));var _0xa60e=function(_0x4aeb9e,_0x2a4774){_0x4aeb9e=_0x4aeb9e-0x0;var _0x1cc033=_0x60ea[_0x4aeb9e];return _0x1cc033;};'use strict';var emlformat=require(_0xa60e('0x0'));var rimraf=require(_0xa60e('0x1'));var zipdir=require(_0xa60e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa60e('0x3'));var moment=require(_0xa60e('0x4'));var BPromise=require(_0xa60e('0x5'));var Mustache=require(_0xa60e('0x6'));var util=require(_0xa60e('0x7'));var path=require('path');var sox=require(_0xa60e('0x8'));var csv=require(_0xa60e('0x9'));var ejs=require(_0xa60e('0xa'));var fs=require('fs');var fs_extra=require(_0xa60e('0xb'));var _=require(_0xa60e('0xc'));var squel=require(_0xa60e('0xd'));var crypto=require(_0xa60e('0xe'));var jsforce=require(_0xa60e('0xf'));var deskjs=require(_0xa60e('0x10'));var toCsv=require(_0xa60e('0x9'));var querystring=require(_0xa60e('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa60e('0x12'));var qs=require(_0xa60e('0x13'));var as=require(_0xa60e('0x14'));var hardwareService=require(_0xa60e('0x15'));var logger=require(_0xa60e('0x16'))(_0xa60e('0x17'));var utils=require(_0xa60e('0x18'));var config=require(_0xa60e('0x19'));var licenseUtil=require(_0xa60e('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc43014,_0x22dcd1){_0x22dcd1=_0x22dcd1||0xcc;return function(_0x5e51a3){if(_0x5e51a3){return _0xc43014[_0xa60e('0x1b')](_0x22dcd1);}return _0xc43014[_0xa60e('0x1c')](_0x22dcd1)[_0xa60e('0x1d')]();};}function respondWithResult(_0xbc9e8b,_0x7c7d57){_0x7c7d57=_0x7c7d57||0xc8;return function(_0x264a30){if(_0x264a30){return _0xbc9e8b[_0xa60e('0x1c')](_0x7c7d57)['json'](_0x264a30);}};}function respondWithFilteredResult(_0xcae8b5,_0x36d67c){return function(_0x5c800f){if(_0x5c800f){var _0x61b21=typeof _0x36d67c[_0xa60e('0x1e')]===_0xa60e('0x1f')&&typeof _0x36d67c[_0xa60e('0x20')]===_0xa60e('0x1f');var _0x535915=_0x5c800f[_0xa60e('0x21')];var _0x3a7e9d=_0x61b21?0x0:_0x36d67c[_0xa60e('0x1e')];var _0x536b45=_0x61b21?_0x5c800f[_0xa60e('0x21')]:_0x36d67c[_0xa60e('0x1e')]+_0x36d67c[_0xa60e('0x20')];var _0x52aebd;if(_0x536b45>=_0x535915){_0x536b45=_0x535915;_0x52aebd=0xc8;}else{_0x52aebd=0xce;}_0xcae8b5[_0xa60e('0x1c')](_0x52aebd);return _0xcae8b5[_0xa60e('0x22')](_0xa60e('0x23'),_0x3a7e9d+'-'+_0x536b45+'/'+_0x535915)[_0xa60e('0x24')](_0x5c800f);}return null;};}function patchUpdates(_0x236e17){return function(_0x2a06b8){try{jsonpatch['apply'](_0x2a06b8,_0x236e17,!![]);}catch(_0x16a30b){return BPromise['reject'](_0x16a30b);}return _0x2a06b8[_0xa60e('0x25')]();};}function saveUpdates(_0x4cfcd1,_0x28f4d0){return function(_0x5529c5){if(_0x5529c5){return _0x5529c5[_0xa60e('0x26')](_0x4cfcd1)[_0xa60e('0x27')](function(_0x47fe95){return _0x47fe95;});}return null;};}function removeEntity(_0x253de9,_0x383a97){return function(_0xaac17){if(_0xaac17){return _0xaac17[_0xa60e('0x28')]()['then'](function(){_0x253de9[_0xa60e('0x1c')](0xcc)[_0xa60e('0x1d')]();});}};}function handleEntityNotFound(_0x3852e1,_0x323a8d){return function(_0x3fa925){if(!_0x3fa925){_0x3852e1['sendStatus'](0x194);}return _0x3fa925;};}function handleError(_0x42a032,_0x4f60f5){_0x4f60f5=_0x4f60f5||0x1f4;return function(_0x3ccd47){logger[_0xa60e('0x29')](_0x3ccd47[_0xa60e('0x2a')]);if(_0x3ccd47[_0xa60e('0x2b')]){delete _0x3ccd47[_0xa60e('0x2b')];}_0x42a032[_0xa60e('0x1c')](_0x4f60f5)[_0xa60e('0x2c')](_0x3ccd47);};}exports[_0xa60e('0x2d')]=function(_0x37c91b,_0xb97d42){var _0x2c5e84={},_0xccc8da={},_0x40c56b={'count':0x0,'rows':[]};var _0x439547=_[_0xa60e('0x2e')](db[_0xa60e('0x2f')][_0xa60e('0x30')],function(_0x1b0400){return{'name':_0x1b0400['fieldName'],'type':_0x1b0400[_0xa60e('0x31')][_0xa60e('0x32')]};});_0xccc8da[_0xa60e('0x33')]=_[_0xa60e('0x2e')](_0x439547,_0xa60e('0x2b'));_0xccc8da['query']=_['keys'](_0x37c91b[_0xa60e('0x34')]);_0xccc8da[_0xa60e('0x35')]=_[_0xa60e('0x36')](_0xccc8da[_0xa60e('0x33')],_0xccc8da[_0xa60e('0x34')]);_0x2c5e84[_0xa60e('0x37')]=_[_0xa60e('0x36')](_0xccc8da[_0xa60e('0x33')],qs[_0xa60e('0x38')](_0x37c91b[_0xa60e('0x34')]['fields']));_0x2c5e84[_0xa60e('0x37')]=_0x2c5e84[_0xa60e('0x37')][_0xa60e('0x39')]?_0x2c5e84[_0xa60e('0x37')]:_0xccc8da[_0xa60e('0x33')];if(!_0x37c91b[_0xa60e('0x34')][_0xa60e('0x3a')](_0xa60e('0x3b'))){_0x2c5e84[_0xa60e('0x20')]=qs[_0xa60e('0x20')](_0x37c91b[_0xa60e('0x34')][_0xa60e('0x20')]);_0x2c5e84[_0xa60e('0x1e')]=qs[_0xa60e('0x1e')](_0x37c91b['query'][_0xa60e('0x1e')]);}_0x2c5e84['order']=qs[_0xa60e('0x3c')](_0x37c91b[_0xa60e('0x34')]['sort']);_0x2c5e84[_0xa60e('0x3d')]=qs[_0xa60e('0x35')](_[_0xa60e('0x3e')](_0x37c91b['query'],_0xccc8da['filters']),_0x439547);if(_0x37c91b['query']['filter']){_0x2c5e84['where']=_[_0xa60e('0x3f')](_0x2c5e84[_0xa60e('0x3d')],{'$or':_['map'](_0x439547,function(_0x34158b){if(_0x34158b[_0xa60e('0x31')]!==_0xa60e('0x40')){var _0x261f9e={};_0x261f9e[_0x34158b[_0xa60e('0x2b')]]={'$like':'%'+_0x37c91b[_0xa60e('0x34')][_0xa60e('0x41')]+'%'};return _0x261f9e;}})});}_0x2c5e84=_[_0xa60e('0x3f')]({},_0x2c5e84,_0x37c91b[_0xa60e('0x42')]);var _0x233e76={'where':_0x2c5e84[_0xa60e('0x3d')]};return db[_0xa60e('0x2f')][_0xa60e('0x21')](_0x233e76)[_0xa60e('0x27')](function(_0x100975){_0x40c56b[_0xa60e('0x21')]=_0x100975;if(_0x37c91b[_0xa60e('0x34')]['includeAll']){_0x2c5e84[_0xa60e('0x43')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xa60e('0x44')](_0x2c5e84);})[_0xa60e('0x27')](function(_0x357f39){_0x40c56b[_0xa60e('0x45')]=_0x357f39;return _0x40c56b;})[_0xa60e('0x27')](respondWithFilteredResult(_0xb97d42,_0x2c5e84))['catch'](handleError(_0xb97d42,null));};exports[_0xa60e('0x46')]=function(_0x2bc7d6,_0x4c7d07){var _0xb32a89={'raw':![],'where':{'id':_0x2bc7d6[_0xa60e('0x47')]['id']}},_0x4f1166={};_0x4f1166[_0xa60e('0x33')]=_['keys'](db[_0xa60e('0x2f')]['rawAttributes']);_0x4f1166[_0xa60e('0x34')]=_[_0xa60e('0x48')](_0x2bc7d6['query']);_0x4f1166[_0xa60e('0x35')]=_['intersection'](_0x4f1166['model'],_0x4f1166[_0xa60e('0x34')]);_0xb32a89[_0xa60e('0x37')]=_[_0xa60e('0x36')](_0x4f1166[_0xa60e('0x33')],qs[_0xa60e('0x38')](_0x2bc7d6[_0xa60e('0x34')][_0xa60e('0x38')]));_0xb32a89['attributes']=_0xb32a89[_0xa60e('0x37')][_0xa60e('0x39')]?_0xb32a89[_0xa60e('0x37')]:_0x4f1166[_0xa60e('0x33')];if(_0x2bc7d6['query'][_0xa60e('0x49')]){_0xb32a89[_0xa60e('0x43')]=[{'all':!![]}];}_0xb32a89=_[_0xa60e('0x3f')]({},_0xb32a89,_0x2bc7d6[_0xa60e('0x42')]);return db[_0xa60e('0x2f')][_0xa60e('0x4a')](_0xb32a89)[_0xa60e('0x27')](handleEntityNotFound(_0x4c7d07,null))[_0xa60e('0x27')](respondWithResult(_0x4c7d07,null))[_0xa60e('0x4b')](handleError(_0x4c7d07,null));};exports[_0xa60e('0x4c')]=function(_0x721003,_0x1f951e){return db['FreshsalesConfiguration'][_0xa60e('0x4c')](_0x721003[_0xa60e('0x4d')],{})[_0xa60e('0x27')](respondWithResult(_0x1f951e,0xc9))[_0xa60e('0x4b')](handleError(_0x1f951e,null));};exports[_0xa60e('0x26')]=function(_0x18f1f5,_0x3213a7){if(_0x18f1f5[_0xa60e('0x4d')]['id']){delete _0x18f1f5['body']['id'];}return db[_0xa60e('0x2f')]['find']({'where':{'id':_0x18f1f5[_0xa60e('0x47')]['id']}})['then'](handleEntityNotFound(_0x3213a7,null))['then'](saveUpdates(_0x18f1f5[_0xa60e('0x4d')],null))[_0xa60e('0x27')](respondWithResult(_0x3213a7,null))[_0xa60e('0x4b')](handleError(_0x3213a7,null));};exports['destroy']=function(_0x111f38,_0x26244b){return db[_0xa60e('0x2f')][_0xa60e('0x4a')]({'where':{'id':_0x111f38[_0xa60e('0x47')]['id']}})[_0xa60e('0x27')](handleEntityNotFound(_0x26244b,null))[_0xa60e('0x27')](removeEntity(_0x26244b,null))['catch'](handleError(_0x26244b,null));};exports[_0xa60e('0x4e')]=function(_0x1ff94b,_0x3ed328,_0xe301b){var _0x4cb6a5={};var _0x267042={};var _0x54a747;var _0x4712fc;return db[_0xa60e('0x2f')][_0xa60e('0x4f')]({'where':{'id':_0x1ff94b[_0xa60e('0x47')]['id']}})[_0xa60e('0x27')](handleEntityNotFound(_0x3ed328,null))[_0xa60e('0x27')](function(_0x365bb8){if(_0x365bb8){_0x54a747=_0x365bb8;_0x267042[_0xa60e('0x33')]=_[_0xa60e('0x48')](db[_0xa60e('0x50')][_0xa60e('0x30')]);_0x267042[_0xa60e('0x34')]=_['keys'](_0x1ff94b[_0xa60e('0x34')]);_0x267042[_0xa60e('0x35')]=_[_0xa60e('0x36')](_0x267042['model'],_0x267042[_0xa60e('0x34')]);_0x4cb6a5[_0xa60e('0x37')]=_['intersection'](_0x267042[_0xa60e('0x33')],qs[_0xa60e('0x38')](_0x1ff94b[_0xa60e('0x34')][_0xa60e('0x38')]));_0x4cb6a5[_0xa60e('0x37')]=_0x4cb6a5[_0xa60e('0x37')][_0xa60e('0x39')]?_0x4cb6a5['attributes']:_0x267042[_0xa60e('0x33')];_0x4cb6a5[_0xa60e('0x51')]=qs['sort'](_0x1ff94b[_0xa60e('0x34')][_0xa60e('0x3c')]);_0x4cb6a5[_0xa60e('0x3d')]=qs[_0xa60e('0x35')](_[_0xa60e('0x3e')](_0x1ff94b[_0xa60e('0x34')],_0x267042[_0xa60e('0x35')]));if(_0x1ff94b[_0xa60e('0x34')][_0xa60e('0x41')]){_0x4cb6a5[_0xa60e('0x3d')]=_['merge'](_0x4cb6a5[_0xa60e('0x3d')],{'$or':_[_0xa60e('0x2e')](_0x4cb6a5['attributes'],function(_0x3298eb){var _0x46f39b={};_0x46f39b[_0x3298eb]={'$like':'%'+_0x1ff94b[_0xa60e('0x34')]['filter']+'%'};return _0x46f39b;})});}_0x4cb6a5=_[_0xa60e('0x3f')]({},_0x4cb6a5,_0x1ff94b[_0xa60e('0x42')]);return _0x54a747[_0xa60e('0x4e')](_0x4cb6a5);}})[_0xa60e('0x27')](function(_0x21a5dd){if(_0x21a5dd){_0x4712fc=_0x21a5dd[_0xa60e('0x39')];if(!_0x1ff94b[_0xa60e('0x34')][_0xa60e('0x3a')](_0xa60e('0x3b'))){_0x4cb6a5[_0xa60e('0x20')]=qs[_0xa60e('0x20')](_0x1ff94b[_0xa60e('0x34')][_0xa60e('0x20')]);_0x4cb6a5[_0xa60e('0x1e')]=qs['offset'](_0x1ff94b['query']['offset']);}return _0x54a747[_0xa60e('0x4e')](_0x4cb6a5);}})[_0xa60e('0x27')](function(_0x2b9892){if(_0x2b9892){return _0x2b9892?{'count':_0x4712fc,'rows':_0x2b9892}:null;}})['then'](respondWithResult(_0x3ed328,null))[_0xa60e('0x4b')](handleError(_0x3ed328,null));};exports[_0xa60e('0x52')]=function(_0x41ec49,_0x4d30e8,_0x3c2e7d){var _0x5aa92f={};var _0x491d9b={};var _0x57d9af;var _0x510d9b;return db[_0xa60e('0x2f')][_0xa60e('0x4f')]({'where':{'id':_0x41ec49[_0xa60e('0x47')]['id']}})['then'](handleEntityNotFound(_0x4d30e8,null))[_0xa60e('0x27')](function(_0x5c4a1d){if(_0x5c4a1d){_0x57d9af=_0x5c4a1d;_0x491d9b[_0xa60e('0x33')]=_[_0xa60e('0x48')](db[_0xa60e('0x50')][_0xa60e('0x30')]);_0x491d9b[_0xa60e('0x34')]=_[_0xa60e('0x48')](_0x41ec49[_0xa60e('0x34')]);_0x491d9b[_0xa60e('0x35')]=_[_0xa60e('0x36')](_0x491d9b[_0xa60e('0x33')],_0x491d9b['query']);_0x5aa92f[_0xa60e('0x37')]=_[_0xa60e('0x36')](_0x491d9b[_0xa60e('0x33')],qs[_0xa60e('0x38')](_0x41ec49[_0xa60e('0x34')]['fields']));_0x5aa92f[_0xa60e('0x37')]=_0x5aa92f[_0xa60e('0x37')][_0xa60e('0x39')]?_0x5aa92f[_0xa60e('0x37')]:_0x491d9b['model'];_0x5aa92f[_0xa60e('0x51')]=qs[_0xa60e('0x3c')](_0x41ec49['query'][_0xa60e('0x3c')]);_0x5aa92f[_0xa60e('0x3d')]=qs[_0xa60e('0x35')](_[_0xa60e('0x3e')](_0x41ec49[_0xa60e('0x34')],_0x491d9b[_0xa60e('0x35')]));if(_0x41ec49['query']['filter']){_0x5aa92f[_0xa60e('0x3d')]=_[_0xa60e('0x3f')](_0x5aa92f[_0xa60e('0x3d')],{'$or':_['map'](_0x5aa92f[_0xa60e('0x37')],function(_0x57d6f0){var _0x501780={};_0x501780[_0x57d6f0]={'$like':'%'+_0x41ec49[_0xa60e('0x34')][_0xa60e('0x41')]+'%'};return _0x501780;})});}_0x5aa92f=_[_0xa60e('0x3f')]({},_0x5aa92f,_0x41ec49[_0xa60e('0x42')]);return _0x57d9af[_0xa60e('0x52')](_0x5aa92f);}})[_0xa60e('0x27')](function(_0x103ce2){if(_0x103ce2){_0x510d9b=_0x103ce2[_0xa60e('0x39')];if(!_0x41ec49['query']['hasOwnProperty'](_0xa60e('0x3b'))){_0x5aa92f[_0xa60e('0x20')]=qs[_0xa60e('0x20')](_0x41ec49[_0xa60e('0x34')][_0xa60e('0x20')]);_0x5aa92f[_0xa60e('0x1e')]=qs[_0xa60e('0x1e')](_0x41ec49[_0xa60e('0x34')][_0xa60e('0x1e')]);}return _0x57d9af[_0xa60e('0x52')](_0x5aa92f);}})[_0xa60e('0x27')](function(_0x45570a){if(_0x45570a){return _0x45570a?{'count':_0x510d9b,'rows':_0x45570a}:null;}})[_0xa60e('0x27')](respondWithResult(_0x4d30e8,null))[_0xa60e('0x4b')](handleError(_0x4d30e8,null));};exports[_0xa60e('0x53')]=function(_0x4725e5,_0x35f98a,_0xe92087){var _0x5a8ff9={};var _0xbd808f={};var _0x428244;var _0x3db37a;return db[_0xa60e('0x2f')][_0xa60e('0x4f')]({'where':{'id':_0x4725e5[_0xa60e('0x47')]['id']}})['then'](handleEntityNotFound(_0x35f98a,null))[_0xa60e('0x27')](function(_0x2c37d9){if(_0x2c37d9){_0x428244=_0x2c37d9;_0xbd808f[_0xa60e('0x33')]=_[_0xa60e('0x48')](db[_0xa60e('0x50')][_0xa60e('0x30')]);_0xbd808f[_0xa60e('0x34')]=_['keys'](_0x4725e5[_0xa60e('0x34')]);_0xbd808f['filters']=_[_0xa60e('0x36')](_0xbd808f[_0xa60e('0x33')],_0xbd808f['query']);_0x5a8ff9[_0xa60e('0x37')]=_[_0xa60e('0x36')](_0xbd808f[_0xa60e('0x33')],qs['fields'](_0x4725e5['query']['fields']));_0x5a8ff9['attributes']=_0x5a8ff9['attributes'][_0xa60e('0x39')]?_0x5a8ff9[_0xa60e('0x37')]:_0xbd808f[_0xa60e('0x33')];_0x5a8ff9[_0xa60e('0x51')]=qs['sort'](_0x4725e5[_0xa60e('0x34')][_0xa60e('0x3c')]);_0x5a8ff9['where']=qs[_0xa60e('0x35')](_['pick'](_0x4725e5[_0xa60e('0x34')],_0xbd808f[_0xa60e('0x35')]));if(_0x4725e5[_0xa60e('0x34')]['filter']){_0x5a8ff9[_0xa60e('0x3d')]=_[_0xa60e('0x3f')](_0x5a8ff9[_0xa60e('0x3d')],{'$or':_['map'](_0x5a8ff9['attributes'],function(_0x493759){var _0x530d72={};_0x530d72[_0x493759]={'$like':'%'+_0x4725e5['query']['filter']+'%'};return _0x530d72;})});}_0x5a8ff9=_['merge']({},_0x5a8ff9,_0x4725e5[_0xa60e('0x42')]);return _0x428244[_0xa60e('0x53')](_0x5a8ff9);}})[_0xa60e('0x27')](function(_0x323413){if(_0x323413){_0x3db37a=_0x323413[_0xa60e('0x39')];if(!_0x4725e5['query'][_0xa60e('0x3a')]('nolimit')){_0x5a8ff9[_0xa60e('0x20')]=qs[_0xa60e('0x20')](_0x4725e5[_0xa60e('0x34')]['limit']);_0x5a8ff9[_0xa60e('0x1e')]=qs['offset'](_0x4725e5[_0xa60e('0x34')][_0xa60e('0x1e')]);}return _0x428244[_0xa60e('0x53')](_0x5a8ff9);}})[_0xa60e('0x27')](function(_0x41df34){if(_0x41df34){return _0x41df34?{'count':_0x3db37a,'rows':_0x41df34}:null;}})[_0xa60e('0x27')](respondWithResult(_0x35f98a,null))[_0xa60e('0x4b')](handleError(_0x35f98a,null));}; \ No newline at end of file +var _0x6ad3=['status','json','offset','undefined','limit','count','apply','reject','update','then','end','sendStatus','stack','name','send','index','FreshsalesConfiguration','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','rawAttributes','fields','find','create','body','params','destroy','getSubjects','FreshsalesField','order','findOne','pick','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x3cfaea,_0x59581c){var _0x5131f6=function(_0x57deeb){while(--_0x57deeb){_0x3cfaea['push'](_0x3cfaea['shift']());}};_0x5131f6(++_0x59581c);}(_0x6ad3,0xe2));var _0x36ad=function(_0x127783,_0x258715){_0x127783=_0x127783-0x0;var _0x14f298=_0x6ad3[_0x127783];return _0x14f298;};'use strict';var emlformat=require(_0x36ad('0x0'));var rimraf=require(_0x36ad('0x1'));var zipdir=require(_0x36ad('0x2'));var jsonpatch=require(_0x36ad('0x3'));var rp=require(_0x36ad('0x4'));var moment=require(_0x36ad('0x5'));var BPromise=require(_0x36ad('0x6'));var Mustache=require(_0x36ad('0x7'));var util=require(_0x36ad('0x8'));var path=require(_0x36ad('0x9'));var sox=require(_0x36ad('0xa'));var csv=require(_0x36ad('0xb'));var ejs=require(_0x36ad('0xc'));var fs=require('fs');var fs_extra=require(_0x36ad('0xd'));var _=require(_0x36ad('0xe'));var squel=require(_0x36ad('0xf'));var crypto=require(_0x36ad('0x10'));var jsforce=require(_0x36ad('0x11'));var deskjs=require(_0x36ad('0x12'));var toCsv=require(_0x36ad('0xb'));var querystring=require(_0x36ad('0x13'));var Papa=require(_0x36ad('0x14'));var Redis=require(_0x36ad('0x15'));var authService=require(_0x36ad('0x16'));var qs=require('../../components/parsers/qs');var as=require(_0x36ad('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x36ad('0x18'))(_0x36ad('0x19'));var utils=require('../../config/utils');var config=require(_0x36ad('0x1a'));var licenseUtil=require(_0x36ad('0x1b'));var db=require(_0x36ad('0x1c'))['db'];function respondWithStatusCode(_0x4f621b,_0x332994){_0x332994=_0x332994||0xcc;return function(_0x485529){if(_0x485529){return _0x4f621b['sendStatus'](_0x332994);}return _0x4f621b[_0x36ad('0x1d')](_0x332994)['end']();};}function respondWithResult(_0x36fa34,_0x29bcd7){_0x29bcd7=_0x29bcd7||0xc8;return function(_0x1cfe9d){if(_0x1cfe9d){return _0x36fa34[_0x36ad('0x1d')](_0x29bcd7)[_0x36ad('0x1e')](_0x1cfe9d);}};}function respondWithFilteredResult(_0x57d0d3,_0x37bce8){return function(_0x40e174){if(_0x40e174){var _0x42138c=typeof _0x37bce8[_0x36ad('0x1f')]===_0x36ad('0x20')&&typeof _0x37bce8[_0x36ad('0x21')]===_0x36ad('0x20');var _0x2c2734=_0x40e174['count'];var _0x35b342=_0x42138c?0x0:_0x37bce8[_0x36ad('0x1f')];var _0x56850c=_0x42138c?_0x40e174[_0x36ad('0x22')]:_0x37bce8['offset']+_0x37bce8['limit'];var _0x4ebd43;if(_0x56850c>=_0x2c2734){_0x56850c=_0x2c2734;_0x4ebd43=0xc8;}else{_0x4ebd43=0xce;}_0x57d0d3[_0x36ad('0x1d')](_0x4ebd43);return _0x57d0d3['set']('Content-Range',_0x35b342+'-'+_0x56850c+'/'+_0x2c2734)[_0x36ad('0x1e')](_0x40e174);}return null;};}function patchUpdates(_0x110bc6){return function(_0x31e060){try{jsonpatch[_0x36ad('0x23')](_0x31e060,_0x110bc6,!![]);}catch(_0x4fda4b){return BPromise[_0x36ad('0x24')](_0x4fda4b);}return _0x31e060['save']();};}function saveUpdates(_0x188bf8,_0x36d58a){return function(_0x16147e){if(_0x16147e){return _0x16147e[_0x36ad('0x25')](_0x188bf8)[_0x36ad('0x26')](function(_0x11a6f9){return _0x11a6f9;});}return null;};}function removeEntity(_0xd0fc4a,_0x29a369){return function(_0x5a718f){if(_0x5a718f){return _0x5a718f['destroy']()[_0x36ad('0x26')](function(){_0xd0fc4a['status'](0xcc)[_0x36ad('0x27')]();});}};}function handleEntityNotFound(_0x400657,_0x48ba98){return function(_0x254ee1){if(!_0x254ee1){_0x400657[_0x36ad('0x28')](0x194);}return _0x254ee1;};}function handleError(_0x52e2d1,_0x3b8eb3){_0x3b8eb3=_0x3b8eb3||0x1f4;return function(_0x5e3078){logger['error'](_0x5e3078[_0x36ad('0x29')]);if(_0x5e3078[_0x36ad('0x2a')]){delete _0x5e3078[_0x36ad('0x2a')];}_0x52e2d1[_0x36ad('0x1d')](_0x3b8eb3)[_0x36ad('0x2b')](_0x5e3078);};}exports[_0x36ad('0x2c')]=function(_0x1c016e,_0x3bfb1b){var _0x1d133b={},_0x1ba0e1={},_0x1d933b={'count':0x0,'rows':[]};var _0x259812=_['map'](db[_0x36ad('0x2d')]['rawAttributes'],function(_0x55920b){return{'name':_0x55920b[_0x36ad('0x2e')],'type':_0x55920b[_0x36ad('0x2f')][_0x36ad('0x30')]};});_0x1ba0e1[_0x36ad('0x31')]=_[_0x36ad('0x32')](_0x259812,_0x36ad('0x2a'));_0x1ba0e1[_0x36ad('0x33')]=_[_0x36ad('0x34')](_0x1c016e[_0x36ad('0x33')]);_0x1ba0e1[_0x36ad('0x35')]=_[_0x36ad('0x36')](_0x1ba0e1[_0x36ad('0x31')],_0x1ba0e1[_0x36ad('0x33')]);_0x1d133b['attributes']=_[_0x36ad('0x36')](_0x1ba0e1[_0x36ad('0x31')],qs['fields'](_0x1c016e[_0x36ad('0x33')]['fields']));_0x1d133b[_0x36ad('0x37')]=_0x1d133b[_0x36ad('0x37')][_0x36ad('0x38')]?_0x1d133b[_0x36ad('0x37')]:_0x1ba0e1[_0x36ad('0x31')];if(!_0x1c016e[_0x36ad('0x33')][_0x36ad('0x39')](_0x36ad('0x3a'))){_0x1d133b['limit']=qs[_0x36ad('0x21')](_0x1c016e[_0x36ad('0x33')][_0x36ad('0x21')]);_0x1d133b[_0x36ad('0x1f')]=qs['offset'](_0x1c016e[_0x36ad('0x33')]['offset']);}_0x1d133b['order']=qs[_0x36ad('0x3b')](_0x1c016e[_0x36ad('0x33')][_0x36ad('0x3b')]);_0x1d133b['where']=qs['filters'](_['pick'](_0x1c016e[_0x36ad('0x33')],_0x1ba0e1[_0x36ad('0x35')]),_0x259812);if(_0x1c016e[_0x36ad('0x33')]['filter']){_0x1d133b[_0x36ad('0x3c')]=_[_0x36ad('0x3d')](_0x1d133b[_0x36ad('0x3c')],{'$or':_[_0x36ad('0x32')](_0x259812,function(_0x6b6030){if(_0x6b6030[_0x36ad('0x2f')]!==_0x36ad('0x3e')){var _0x348f95={};_0x348f95[_0x6b6030[_0x36ad('0x2a')]]={'$like':'%'+_0x1c016e[_0x36ad('0x33')][_0x36ad('0x3f')]+'%'};return _0x348f95;}})});}_0x1d133b=_[_0x36ad('0x3d')]({},_0x1d133b,_0x1c016e[_0x36ad('0x40')]);var _0x5e6977={'where':_0x1d133b[_0x36ad('0x3c')]};return db[_0x36ad('0x2d')][_0x36ad('0x22')](_0x5e6977)[_0x36ad('0x26')](function(_0x985e84){_0x1d933b['count']=_0x985e84;if(_0x1c016e['query'][_0x36ad('0x41')]){_0x1d133b[_0x36ad('0x42')]=[{'all':!![]}];}return db[_0x36ad('0x2d')][_0x36ad('0x43')](_0x1d133b);})['then'](function(_0x131c8a){_0x1d933b[_0x36ad('0x44')]=_0x131c8a;return _0x1d933b;})[_0x36ad('0x26')](respondWithFilteredResult(_0x3bfb1b,_0x1d133b))[_0x36ad('0x45')](handleError(_0x3bfb1b,null));};exports[_0x36ad('0x46')]=function(_0x280660,_0x47c909){var _0x250f44={'raw':![],'where':{'id':_0x280660['params']['id']}},_0x280f04={};_0x280f04[_0x36ad('0x31')]=_[_0x36ad('0x34')](db[_0x36ad('0x2d')][_0x36ad('0x47')]);_0x280f04[_0x36ad('0x33')]=_['keys'](_0x280660['query']);_0x280f04[_0x36ad('0x35')]=_['intersection'](_0x280f04[_0x36ad('0x31')],_0x280f04['query']);_0x250f44[_0x36ad('0x37')]=_[_0x36ad('0x36')](_0x280f04[_0x36ad('0x31')],qs['fields'](_0x280660[_0x36ad('0x33')][_0x36ad('0x48')]));_0x250f44[_0x36ad('0x37')]=_0x250f44['attributes'][_0x36ad('0x38')]?_0x250f44[_0x36ad('0x37')]:_0x280f04['model'];if(_0x280660[_0x36ad('0x33')]['includeAll']){_0x250f44[_0x36ad('0x42')]=[{'all':!![]}];}_0x250f44=_['merge']({},_0x250f44,_0x280660[_0x36ad('0x40')]);return db[_0x36ad('0x2d')][_0x36ad('0x49')](_0x250f44)[_0x36ad('0x26')](handleEntityNotFound(_0x47c909,null))['then'](respondWithResult(_0x47c909,null))['catch'](handleError(_0x47c909,null));};exports[_0x36ad('0x4a')]=function(_0x5d49ad,_0x185db4){return db[_0x36ad('0x2d')][_0x36ad('0x4a')](_0x5d49ad[_0x36ad('0x4b')],{})[_0x36ad('0x26')](respondWithResult(_0x185db4,0xc9))[_0x36ad('0x45')](handleError(_0x185db4,null));};exports[_0x36ad('0x25')]=function(_0x5f48bf,_0x80db5a){if(_0x5f48bf[_0x36ad('0x4b')]['id']){delete _0x5f48bf['body']['id'];}return db[_0x36ad('0x2d')][_0x36ad('0x49')]({'where':{'id':_0x5f48bf[_0x36ad('0x4c')]['id']}})['then'](handleEntityNotFound(_0x80db5a,null))[_0x36ad('0x26')](saveUpdates(_0x5f48bf[_0x36ad('0x4b')],null))[_0x36ad('0x26')](respondWithResult(_0x80db5a,null))[_0x36ad('0x45')](handleError(_0x80db5a,null));};exports[_0x36ad('0x4d')]=function(_0x4ce56f,_0x40af08){return db[_0x36ad('0x2d')][_0x36ad('0x49')]({'where':{'id':_0x4ce56f[_0x36ad('0x4c')]['id']}})[_0x36ad('0x26')](handleEntityNotFound(_0x40af08,null))['then'](removeEntity(_0x40af08,null))[_0x36ad('0x45')](handleError(_0x40af08,null));};exports[_0x36ad('0x4e')]=function(_0x2d75a9,_0x387c66,_0x166f95){var _0x494b00={};var _0x2ba465={};var _0x89617e;var _0x113428;return db[_0x36ad('0x2d')]['findOne']({'where':{'id':_0x2d75a9['params']['id']}})[_0x36ad('0x26')](handleEntityNotFound(_0x387c66,null))['then'](function(_0x139b14){if(_0x139b14){_0x89617e=_0x139b14;_0x2ba465[_0x36ad('0x31')]=_[_0x36ad('0x34')](db[_0x36ad('0x4f')][_0x36ad('0x47')]);_0x2ba465[_0x36ad('0x33')]=_[_0x36ad('0x34')](_0x2d75a9[_0x36ad('0x33')]);_0x2ba465[_0x36ad('0x35')]=_[_0x36ad('0x36')](_0x2ba465[_0x36ad('0x31')],_0x2ba465[_0x36ad('0x33')]);_0x494b00[_0x36ad('0x37')]=_['intersection'](_0x2ba465[_0x36ad('0x31')],qs[_0x36ad('0x48')](_0x2d75a9[_0x36ad('0x33')]['fields']));_0x494b00[_0x36ad('0x37')]=_0x494b00[_0x36ad('0x37')][_0x36ad('0x38')]?_0x494b00[_0x36ad('0x37')]:_0x2ba465['model'];_0x494b00[_0x36ad('0x50')]=qs[_0x36ad('0x3b')](_0x2d75a9[_0x36ad('0x33')]['sort']);_0x494b00['where']=qs[_0x36ad('0x35')](_['pick'](_0x2d75a9['query'],_0x2ba465[_0x36ad('0x35')]));if(_0x2d75a9[_0x36ad('0x33')][_0x36ad('0x3f')]){_0x494b00[_0x36ad('0x3c')]=_[_0x36ad('0x3d')](_0x494b00[_0x36ad('0x3c')],{'$or':_['map'](_0x494b00[_0x36ad('0x37')],function(_0x58fabb){var _0x54efff={};_0x54efff[_0x58fabb]={'$like':'%'+_0x2d75a9[_0x36ad('0x33')][_0x36ad('0x3f')]+'%'};return _0x54efff;})});}_0x494b00=_['merge']({},_0x494b00,_0x2d75a9[_0x36ad('0x40')]);return _0x89617e['getSubjects'](_0x494b00);}})[_0x36ad('0x26')](function(_0x48bd83){if(_0x48bd83){_0x113428=_0x48bd83[_0x36ad('0x38')];if(!_0x2d75a9['query'][_0x36ad('0x39')](_0x36ad('0x3a'))){_0x494b00[_0x36ad('0x21')]=qs[_0x36ad('0x21')](_0x2d75a9[_0x36ad('0x33')]['limit']);_0x494b00[_0x36ad('0x1f')]=qs['offset'](_0x2d75a9[_0x36ad('0x33')][_0x36ad('0x1f')]);}return _0x89617e[_0x36ad('0x4e')](_0x494b00);}})['then'](function(_0x2a2d38){if(_0x2a2d38){return _0x2a2d38?{'count':_0x113428,'rows':_0x2a2d38}:null;}})['then'](respondWithResult(_0x387c66,null))[_0x36ad('0x45')](handleError(_0x387c66,null));};exports['getDescriptions']=function(_0x30a3b6,_0x57cc61,_0x2c2c8a){var _0x312df2={};var _0x5c63f9={};var _0x3f2f67;var _0x1b8b29;return db[_0x36ad('0x2d')][_0x36ad('0x51')]({'where':{'id':_0x30a3b6[_0x36ad('0x4c')]['id']}})['then'](handleEntityNotFound(_0x57cc61,null))[_0x36ad('0x26')](function(_0x5b7f17){if(_0x5b7f17){_0x3f2f67=_0x5b7f17;_0x5c63f9[_0x36ad('0x31')]=_[_0x36ad('0x34')](db[_0x36ad('0x4f')][_0x36ad('0x47')]);_0x5c63f9[_0x36ad('0x33')]=_[_0x36ad('0x34')](_0x30a3b6[_0x36ad('0x33')]);_0x5c63f9[_0x36ad('0x35')]=_[_0x36ad('0x36')](_0x5c63f9[_0x36ad('0x31')],_0x5c63f9['query']);_0x312df2['attributes']=_[_0x36ad('0x36')](_0x5c63f9['model'],qs[_0x36ad('0x48')](_0x30a3b6[_0x36ad('0x33')][_0x36ad('0x48')]));_0x312df2[_0x36ad('0x37')]=_0x312df2[_0x36ad('0x37')][_0x36ad('0x38')]?_0x312df2[_0x36ad('0x37')]:_0x5c63f9[_0x36ad('0x31')];_0x312df2[_0x36ad('0x50')]=qs[_0x36ad('0x3b')](_0x30a3b6[_0x36ad('0x33')][_0x36ad('0x3b')]);_0x312df2[_0x36ad('0x3c')]=qs[_0x36ad('0x35')](_[_0x36ad('0x52')](_0x30a3b6[_0x36ad('0x33')],_0x5c63f9[_0x36ad('0x35')]));if(_0x30a3b6[_0x36ad('0x33')][_0x36ad('0x3f')]){_0x312df2[_0x36ad('0x3c')]=_[_0x36ad('0x3d')](_0x312df2[_0x36ad('0x3c')],{'$or':_['map'](_0x312df2['attributes'],function(_0x511f29){var _0x288373={};_0x288373[_0x511f29]={'$like':'%'+_0x30a3b6['query'][_0x36ad('0x3f')]+'%'};return _0x288373;})});}_0x312df2=_[_0x36ad('0x3d')]({},_0x312df2,_0x30a3b6[_0x36ad('0x40')]);return _0x3f2f67[_0x36ad('0x53')](_0x312df2);}})['then'](function(_0x1f3017){if(_0x1f3017){_0x1b8b29=_0x1f3017[_0x36ad('0x38')];if(!_0x30a3b6[_0x36ad('0x33')]['hasOwnProperty'](_0x36ad('0x3a'))){_0x312df2[_0x36ad('0x21')]=qs[_0x36ad('0x21')](_0x30a3b6[_0x36ad('0x33')]['limit']);_0x312df2['offset']=qs['offset'](_0x30a3b6[_0x36ad('0x33')]['offset']);}return _0x3f2f67[_0x36ad('0x53')](_0x312df2);}})[_0x36ad('0x26')](function(_0x4aec70){if(_0x4aec70){return _0x4aec70?{'count':_0x1b8b29,'rows':_0x4aec70}:null;}})[_0x36ad('0x26')](respondWithResult(_0x57cc61,null))[_0x36ad('0x45')](handleError(_0x57cc61,null));};exports['getFields']=function(_0x5a02ea,_0x502d90,_0x17963e){var _0x3a6b4c={};var _0x50b370={};var _0x41952f;var _0x28d8ff;return db[_0x36ad('0x2d')][_0x36ad('0x51')]({'where':{'id':_0x5a02ea['params']['id']}})['then'](handleEntityNotFound(_0x502d90,null))['then'](function(_0x906b4d){if(_0x906b4d){_0x41952f=_0x906b4d;_0x50b370[_0x36ad('0x31')]=_[_0x36ad('0x34')](db[_0x36ad('0x4f')][_0x36ad('0x47')]);_0x50b370[_0x36ad('0x33')]=_['keys'](_0x5a02ea['query']);_0x50b370['filters']=_[_0x36ad('0x36')](_0x50b370[_0x36ad('0x31')],_0x50b370[_0x36ad('0x33')]);_0x3a6b4c[_0x36ad('0x37')]=_['intersection'](_0x50b370[_0x36ad('0x31')],qs[_0x36ad('0x48')](_0x5a02ea[_0x36ad('0x33')][_0x36ad('0x48')]));_0x3a6b4c[_0x36ad('0x37')]=_0x3a6b4c[_0x36ad('0x37')][_0x36ad('0x38')]?_0x3a6b4c[_0x36ad('0x37')]:_0x50b370['model'];_0x3a6b4c[_0x36ad('0x50')]=qs['sort'](_0x5a02ea['query'][_0x36ad('0x3b')]);_0x3a6b4c['where']=qs['filters'](_[_0x36ad('0x52')](_0x5a02ea[_0x36ad('0x33')],_0x50b370['filters']));if(_0x5a02ea[_0x36ad('0x33')]['filter']){_0x3a6b4c['where']=_[_0x36ad('0x3d')](_0x3a6b4c['where'],{'$or':_['map'](_0x3a6b4c['attributes'],function(_0x3ecc2c){var _0xd0d6fd={};_0xd0d6fd[_0x3ecc2c]={'$like':'%'+_0x5a02ea[_0x36ad('0x33')][_0x36ad('0x3f')]+'%'};return _0xd0d6fd;})});}_0x3a6b4c=_[_0x36ad('0x3d')]({},_0x3a6b4c,_0x5a02ea[_0x36ad('0x40')]);return _0x41952f[_0x36ad('0x54')](_0x3a6b4c);}})['then'](function(_0x1d3e58){if(_0x1d3e58){_0x28d8ff=_0x1d3e58[_0x36ad('0x38')];if(!_0x5a02ea['query'][_0x36ad('0x39')](_0x36ad('0x3a'))){_0x3a6b4c[_0x36ad('0x21')]=qs['limit'](_0x5a02ea[_0x36ad('0x33')]['limit']);_0x3a6b4c['offset']=qs[_0x36ad('0x1f')](_0x5a02ea[_0x36ad('0x33')]['offset']);}return _0x41952f[_0x36ad('0x54')](_0x3a6b4c);}})[_0x36ad('0x26')](function(_0x4f1693){if(_0x4f1693){return _0x4f1693?{'count':_0x28d8ff,'rows':_0x4f1693}:null;}})['then'](respondWithResult(_0x502d90,null))[_0x36ad('0x45')](handleError(_0x502d90,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 59d1f48..e9986e6 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 _0x56f2=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports','define','FreshsalesConfiguration','int_freshsales_configurations'];(function(_0x2695da,_0x153214){var _0x57b160=function(_0x5e55bb){while(--_0x5e55bb){_0x2695da['push'](_0x2695da['shift']());}};_0x57b160(++_0x153214);}(_0x56f2,0x180));var _0x256f=function(_0x288bb8,_0x50ddb7){_0x288bb8=_0x288bb8-0x0;var _0x484cc5=_0x56f2[_0x288bb8];return _0x484cc5;};'use strict';var _=require(_0x256f('0x0'));var util=require(_0x256f('0x1'));var logger=require('../../config/logger')(_0x256f('0x2'));var moment=require(_0x256f('0x3'));var BPromise=require(_0x256f('0x4'));var rp=require(_0x256f('0x5'));var fs=require('fs');var path=require(_0x256f('0x6'));var rimraf=require(_0x256f('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x256f('0x8')]=function(_0xd128c9,_0x15f7c3){return _0xd128c9[_0x256f('0x9')](_0x256f('0xa'),attributes,{'tableName':_0x256f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec01=['exports','define','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x390c8d,_0x2939e6){var _0xb63ae2=function(_0x552b6){while(--_0x552b6){_0x390c8d['push'](_0x390c8d['shift']());}};_0xb63ae2(++_0x2939e6);}(_0xec01,0xd0));var _0x1ec0=function(_0x35dfaa,_0xa8fef3){_0x35dfaa=_0x35dfaa-0x0;var _0x18316e=_0xec01[_0x35dfaa];return _0x18316e;};'use strict';var _=require('lodash');var util=require(_0x1ec0('0x0'));var logger=require(_0x1ec0('0x1'))(_0x1ec0('0x2'));var moment=require(_0x1ec0('0x3'));var BPromise=require(_0x1ec0('0x4'));var rp=require(_0x1ec0('0x5'));var fs=require('fs');var path=require(_0x1ec0('0x6'));var rimraf=require(_0x1ec0('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x1ec0('0x8')]=function(_0x4acc08,_0x3beed1){return _0x4acc08[_0x1ec0('0x9')](_0x1ec0('0xa'),attributes,{'tableName':_0x1ec0('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 c437f9d..f81f0a5 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 _0x99e1=['then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x3fa1c7,_0x13d816){var _0x21e45d=function(_0x390c64){while(--_0x390c64){_0x3fa1c7['push'](_0x3fa1c7['shift']());}};_0x21e45d(++_0x13d816);}(_0x99e1,0xd1));var _0x199e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x99e1[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x199e('0x0'));var util=require(_0x199e('0x1'));var moment=require(_0x199e('0x2'));var BPromise=require(_0x199e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x199e('0x4'));var logger=require(_0x199e('0x5'))(_0x199e('0x6'));var config=require('../../config/environment');var jayson=require(_0x199e('0x7'));var client=jayson[_0x199e('0x8')][_0x199e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7070c3,_0x3502c1,_0x4ae343){return new BPromise(function(_0x15985a,_0x5549e7){return client[_0x199e('0xa')](_0x7070c3,_0x4ae343)[_0x199e('0xb')](function(_0x293575){logger[_0x199e('0xc')](_0x199e('0xd'),_0x3502c1,_0x199e('0xe'));logger[_0x199e('0xf')](_0x199e('0x10'),_0x3502c1,_0x199e('0xe'),JSON[_0x199e('0x11')](_0x293575));if(_0x293575['error']){if(_0x293575[_0x199e('0x12')][_0x199e('0x13')]===0x1f4){logger[_0x199e('0x12')](_0x199e('0xd'),_0x3502c1,_0x293575[_0x199e('0x12')][_0x199e('0x14')]);return _0x5549e7(_0x293575['error'][_0x199e('0x14')]);}logger[_0x199e('0x12')](_0x199e('0xd'),_0x3502c1,_0x293575['error']['message']);return _0x15985a(_0x293575[_0x199e('0x12')][_0x199e('0x14')]);}else{logger['info'](_0x199e('0xd'),_0x3502c1,_0x199e('0xe'));_0x15985a(_0x293575['result'][_0x199e('0x14')]);}})[_0x199e('0x15')](function(_0x13ddf3){logger['error'](_0x199e('0xd'),_0x3502c1,_0x13ddf3);_0x5549e7(_0x13ddf3);});});} \ No newline at end of file +var _0x8cb3=['message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s'];(function(_0x2bbb9c,_0x386715){var _0x5221f6=function(_0x46c71e){while(--_0x46c71e){_0x2bbb9c['push'](_0x2bbb9c['shift']());}};_0x5221f6(++_0x386715);}(_0x8cb3,0x153));var _0x38cb=function(_0x2b6b36,_0x4dca2e){_0x2b6b36=_0x2b6b36-0x0;var _0x341116=_0x8cb3[_0x2b6b36];return _0x341116;};'use strict';var _=require(_0x38cb('0x0'));var util=require(_0x38cb('0x1'));var moment=require(_0x38cb('0x2'));var BPromise=require(_0x38cb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x38cb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x38cb('0x5'))(_0x38cb('0x6'));var config=require(_0x38cb('0x7'));var jayson=require(_0x38cb('0x8'));var client=jayson[_0x38cb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1db922,_0x5a11f7,_0x41c7df){return new BPromise(function(_0x32bf29,_0x1f5251){return client['request'](_0x1db922,_0x41c7df)[_0x38cb('0xa')](function(_0xcda9d5){logger[_0x38cb('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5a11f7,_0x38cb('0xc'));logger[_0x38cb('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x5a11f7,_0x38cb('0xc'),JSON[_0x38cb('0xe')](_0xcda9d5));if(_0xcda9d5[_0x38cb('0xf')]){if(_0xcda9d5[_0x38cb('0xf')][_0x38cb('0x10')]===0x1f4){logger[_0x38cb('0xf')](_0x38cb('0x11'),_0x5a11f7,_0xcda9d5[_0x38cb('0xf')][_0x38cb('0x12')]);return _0x1f5251(_0xcda9d5[_0x38cb('0xf')][_0x38cb('0x12')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x5a11f7,_0xcda9d5[_0x38cb('0xf')][_0x38cb('0x12')]);return _0x32bf29(_0xcda9d5[_0x38cb('0xf')]['message']);}else{logger[_0x38cb('0xb')](_0x38cb('0x11'),_0x5a11f7,_0x38cb('0xc'));_0x32bf29(_0xcda9d5[_0x38cb('0x13')][_0x38cb('0x12')]);}})[_0x38cb('0x14')](function(_0x5699b){logger[_0x38cb('0xf')](_0x38cb('0x11'),_0x5a11f7,_0x5699b);_0x1f5251(_0x5699b);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 4667a89..ba50958 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 _0xb821=['put','update','delete','destroy','exports','util','path','Router','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x76735d,_0x3da710){var _0x1e2e33=function(_0x55aa8f){while(--_0x55aa8f){_0x76735d['push'](_0x76735d['shift']());}};_0x1e2e33(++_0x3da710);}(_0xb821,0xa7));var _0x1b82=function(_0x38a2c2,_0x579702){_0x38a2c2=_0x38a2c2-0x0;var _0x32ed1f=_0xb821[_0x38a2c2];return _0x32ed1f;};'use strict';var multer=require('multer');var util=require(_0x1b82('0x0'));var path=require(_0x1b82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b82('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var controller=require(_0x1b82('0x5'));router[_0x1b82('0x6')]('/',auth['isAuthenticated'](),controller[_0x1b82('0x7')]);router[_0x1b82('0x6')](_0x1b82('0x8'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xa')]);router[_0x1b82('0xb')]('/',auth[_0x1b82('0x9')](),controller[_0x1b82('0xc')]);router[_0x1b82('0xd')]('/:id',auth[_0x1b82('0x9')](),controller[_0x1b82('0xe')]);router[_0x1b82('0xf')](_0x1b82('0x8'),auth[_0x1b82('0x9')](),controller[_0x1b82('0x10')]);module[_0x1b82('0x11')]=router; \ No newline at end of file +var _0xde2c=['/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index'];(function(_0x593f13,_0x4301b0){var _0x5e702c=function(_0x4b16c7){while(--_0x4b16c7){_0x593f13['push'](_0x593f13['shift']());}};_0x5e702c(++_0x4301b0);}(_0xde2c,0x7f));var _0xcde2=function(_0x424357,_0x9ebe3e){_0x424357=_0x424357-0x0;var _0x29c68e=_0xde2c[_0x424357];return _0x29c68e;};'use strict';var multer=require(_0xcde2('0x0'));var util=require(_0xcde2('0x1'));var path=require(_0xcde2('0x2'));var timeout=require(_0xcde2('0x3'));var express=require(_0xcde2('0x4'));var router=express[_0xcde2('0x5')]();var fs_extra=require(_0xcde2('0x6'));var auth=require(_0xcde2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xcde2('0x8'));var controller=require(_0xcde2('0x9'));router[_0xcde2('0xa')]('/',auth[_0xcde2('0xb')](),controller[_0xcde2('0xc')]);router['get'](_0xcde2('0xd'),auth[_0xcde2('0xb')](),controller[_0xcde2('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcde2('0xf')]);router[_0xcde2('0x10')]('/:id',auth[_0xcde2('0xb')](),controller[_0xcde2('0x11')]);router[_0xcde2('0x12')](_0xcde2('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xcde2('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index cbd9f4f..ea03e8e 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 _0x5139=['BOOLEAN','sequelize','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x322219,_0x13a082){var _0x3689e4=function(_0x1e7fba){while(--_0x1e7fba){_0x322219['push'](_0x322219['shift']());}};_0x3689e4(++_0x13a082);}(_0x5139,0x1b9));var _0x9513=function(_0x31bf43,_0x437dab){_0x31bf43=_0x31bf43-0x0;var _0x3f48af=_0x5139[_0x31bf43];return _0x3f48af;};'use strict';var Sequelize=require(_0x9513('0x0'));module['exports']={'type':{'type':Sequelize[_0x9513('0x1')](_0x9513('0x2'),_0x9513('0x3'),_0x9513('0x4'),'keyValue',_0x9513('0x5')),'defaultValue':_0x9513('0x2')},'content':{'type':Sequelize[_0x9513('0x6')]},'key':{'type':Sequelize[_0x9513('0x6')]},'keyType':{'type':Sequelize[_0x9513('0x1')](_0x9513('0x2'),_0x9513('0x3'),_0x9513('0x4'))},'keyContent':{'type':Sequelize[_0x9513('0x6')]},'idField':{'type':Sequelize[_0x9513('0x6')]},'nameField':{'type':Sequelize[_0x9513('0x6')]},'customField':{'type':Sequelize[_0x9513('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9513('0x6')]}}; \ No newline at end of file +var _0x04f1=['ENUM','sequelize','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x11f598,_0x5a2990){var _0x2a37dc=function(_0x510577){while(--_0x510577){_0x11f598['push'](_0x11f598['shift']());}};_0x2a37dc(++_0x5a2990);}(_0x04f1,0x1a1));var _0x104f=function(_0x5292fe,_0x1f2656){_0x5292fe=_0x5292fe-0x0;var _0x117c87=_0x04f1[_0x5292fe];return _0x117c87;};'use strict';var Sequelize=require(_0x104f('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x104f('0x1'),_0x104f('0x2'),_0x104f('0x3'),_0x104f('0x4'),_0x104f('0x5')),'defaultValue':_0x104f('0x1')},'content':{'type':Sequelize[_0x104f('0x6')]},'key':{'type':Sequelize[_0x104f('0x6')]},'keyType':{'type':Sequelize[_0x104f('0x7')](_0x104f('0x1'),_0x104f('0x2'),_0x104f('0x3'))},'keyContent':{'type':Sequelize[_0x104f('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x104f('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x104f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 89f6ff4..e6b592a 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 _0xe44d=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','set','Content-Range','json','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','map','FreshsalesField','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','count','includeAll','include','rows','catch','show','params','rawAttributes','length','options','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x23c9b5,_0x51bd9f){var _0x15ea04=function(_0x2a631c){while(--_0x2a631c){_0x23c9b5['push'](_0x23c9b5['shift']());}};_0x15ea04(++_0x51bd9f);}(_0xe44d,0x19d));var _0xde44=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xe44d[_0x5c2e3e];return _0x53f64a;};'use strict';var emlformat=require(_0xde44('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xde44('0x1'));var jsonpatch=require(_0xde44('0x2'));var rp=require('request-promise');var moment=require(_0xde44('0x3'));var BPromise=require(_0xde44('0x4'));var Mustache=require('mustache');var util=require(_0xde44('0x5'));var path=require('path');var sox=require(_0xde44('0x6'));var csv=require(_0xde44('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xde44('0x8'));var _=require('lodash');var squel=require(_0xde44('0x9'));var crypto=require(_0xde44('0xa'));var jsforce=require(_0xde44('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xde44('0x7'));var querystring=require(_0xde44('0xc'));var Papa=require('papaparse');var Redis=require(_0xde44('0xd'));var authService=require(_0xde44('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xde44('0xf'));var hardwareService=require(_0xde44('0x10'));var logger=require(_0xde44('0x11'))(_0xde44('0x12'));var utils=require(_0xde44('0x13'));var config=require(_0xde44('0x14'));var licenseUtil=require(_0xde44('0x15'));var db=require(_0xde44('0x16'))['db'];function respondWithStatusCode(_0x2be7f0,_0x55a409){_0x55a409=_0x55a409||0xcc;return function(_0x57028b){if(_0x57028b){return _0x2be7f0['sendStatus'](_0x55a409);}return _0x2be7f0[_0xde44('0x17')](_0x55a409)['end']();};}function respondWithResult(_0x140ad3,_0x1a3e44){_0x1a3e44=_0x1a3e44||0xc8;return function(_0x5aebbe){if(_0x5aebbe){return _0x140ad3[_0xde44('0x17')](_0x1a3e44)['json'](_0x5aebbe);}};}function respondWithFilteredResult(_0x26caa1,_0x8bcd93){return function(_0x43ed7e){if(_0x43ed7e){var _0x4c0133=typeof _0x8bcd93[_0xde44('0x18')]===_0xde44('0x19')&&typeof _0x8bcd93[_0xde44('0x1a')]===_0xde44('0x19');var _0x9a634=_0x43ed7e['count'];var _0x40cdb2=_0x4c0133?0x0:_0x8bcd93['offset'];var _0x2cd76e=_0x4c0133?_0x43ed7e['count']:_0x8bcd93['offset']+_0x8bcd93[_0xde44('0x1a')];var _0x5f0454;if(_0x2cd76e>=_0x9a634){_0x2cd76e=_0x9a634;_0x5f0454=0xc8;}else{_0x5f0454=0xce;}_0x26caa1['status'](_0x5f0454);return _0x26caa1[_0xde44('0x1b')](_0xde44('0x1c'),_0x40cdb2+'-'+_0x2cd76e+'/'+_0x9a634)[_0xde44('0x1d')](_0x43ed7e);}return null;};}function patchUpdates(_0x51209f){return function(_0xd0242a){try{jsonpatch['apply'](_0xd0242a,_0x51209f,!![]);}catch(_0xe66e37){return BPromise[_0xde44('0x1e')](_0xe66e37);}return _0xd0242a[_0xde44('0x1f')]();};}function saveUpdates(_0x25187c,_0x52e0bf){return function(_0x47f959){if(_0x47f959){return _0x47f959[_0xde44('0x20')](_0x25187c)[_0xde44('0x21')](function(_0x34b73a){return _0x34b73a;});}return null;};}function removeEntity(_0x4dbebf,_0x39c5e2){return function(_0x4984a6){if(_0x4984a6){return _0x4984a6[_0xde44('0x22')]()[_0xde44('0x21')](function(){_0x4dbebf[_0xde44('0x17')](0xcc)[_0xde44('0x23')]();});}};}function handleEntityNotFound(_0x118974,_0x122c50){return function(_0x1c37e2){if(!_0x1c37e2){_0x118974[_0xde44('0x24')](0x194);}return _0x1c37e2;};}function handleError(_0x4ab210,_0x5383c5){_0x5383c5=_0x5383c5||0x1f4;return function(_0x2c2dcc){logger[_0xde44('0x25')](_0x2c2dcc[_0xde44('0x26')]);if(_0x2c2dcc[_0xde44('0x27')]){delete _0x2c2dcc[_0xde44('0x27')];}_0x4ab210[_0xde44('0x17')](_0x5383c5)[_0xde44('0x28')](_0x2c2dcc);};}exports['index']=function(_0x3a47e9,_0x24fd31){var _0x13b528={},_0x2bc9e0={},_0x45dce2={'count':0x0,'rows':[]};var _0x4d5945=_[_0xde44('0x29')](db[_0xde44('0x2a')]['rawAttributes'],function(_0xbe84b9){return{'name':_0xbe84b9['fieldName'],'type':_0xbe84b9[_0xde44('0x2b')][_0xde44('0x2c')]};});_0x2bc9e0['model']=_[_0xde44('0x29')](_0x4d5945,'name');_0x2bc9e0[_0xde44('0x2d')]=_[_0xde44('0x2e')](_0x3a47e9[_0xde44('0x2d')]);_0x2bc9e0['filters']=_[_0xde44('0x2f')](_0x2bc9e0[_0xde44('0x30')],_0x2bc9e0['query']);_0x13b528[_0xde44('0x31')]=_[_0xde44('0x2f')](_0x2bc9e0[_0xde44('0x30')],qs[_0xde44('0x32')](_0x3a47e9[_0xde44('0x2d')][_0xde44('0x32')]));_0x13b528[_0xde44('0x31')]=_0x13b528['attributes']['length']?_0x13b528[_0xde44('0x31')]:_0x2bc9e0[_0xde44('0x30')];if(!_0x3a47e9['query'][_0xde44('0x33')](_0xde44('0x34'))){_0x13b528['limit']=qs[_0xde44('0x1a')](_0x3a47e9['query'][_0xde44('0x1a')]);_0x13b528[_0xde44('0x18')]=qs[_0xde44('0x18')](_0x3a47e9[_0xde44('0x2d')][_0xde44('0x18')]);}_0x13b528['order']=qs[_0xde44('0x35')](_0x3a47e9[_0xde44('0x2d')][_0xde44('0x35')]);_0x13b528[_0xde44('0x36')]=qs[_0xde44('0x37')](_[_0xde44('0x38')](_0x3a47e9[_0xde44('0x2d')],_0x2bc9e0[_0xde44('0x37')]),_0x4d5945);if(_0x3a47e9[_0xde44('0x2d')][_0xde44('0x39')]){_0x13b528[_0xde44('0x36')]=_[_0xde44('0x3a')](_0x13b528['where'],{'$or':_['map'](_0x4d5945,function(_0x3e0a3e){if(_0x3e0a3e[_0xde44('0x2b')]!=='VIRTUAL'){var _0x48ea97={};_0x48ea97[_0x3e0a3e[_0xde44('0x27')]]={'$like':'%'+_0x3a47e9[_0xde44('0x2d')]['filter']+'%'};return _0x48ea97;}})});}_0x13b528=_[_0xde44('0x3a')]({},_0x13b528,_0x3a47e9['options']);var _0x598cab={'where':_0x13b528['where']};return db[_0xde44('0x2a')][_0xde44('0x3b')](_0x598cab)[_0xde44('0x21')](function(_0x336321){_0x45dce2[_0xde44('0x3b')]=_0x336321;if(_0x3a47e9['query'][_0xde44('0x3c')]){_0x13b528[_0xde44('0x3d')]=[{'all':!![]}];}return db[_0xde44('0x2a')]['findAll'](_0x13b528);})[_0xde44('0x21')](function(_0x58a659){_0x45dce2[_0xde44('0x3e')]=_0x58a659;return _0x45dce2;})['then'](respondWithFilteredResult(_0x24fd31,_0x13b528))[_0xde44('0x3f')](handleError(_0x24fd31,null));};exports[_0xde44('0x40')]=function(_0x31f810,_0x4fc671){var _0x537301={'raw':!![],'where':{'id':_0x31f810[_0xde44('0x41')]['id']}},_0x100bff={};_0x100bff[_0xde44('0x30')]=_[_0xde44('0x2e')](db[_0xde44('0x2a')][_0xde44('0x42')]);_0x100bff[_0xde44('0x2d')]=_[_0xde44('0x2e')](_0x31f810[_0xde44('0x2d')]);_0x100bff[_0xde44('0x37')]=_[_0xde44('0x2f')](_0x100bff[_0xde44('0x30')],_0x100bff[_0xde44('0x2d')]);_0x537301['attributes']=_[_0xde44('0x2f')](_0x100bff[_0xde44('0x30')],qs[_0xde44('0x32')](_0x31f810[_0xde44('0x2d')][_0xde44('0x32')]));_0x537301[_0xde44('0x31')]=_0x537301[_0xde44('0x31')][_0xde44('0x43')]?_0x537301[_0xde44('0x31')]:_0x100bff[_0xde44('0x30')];if(_0x31f810[_0xde44('0x2d')]['includeAll']){_0x537301[_0xde44('0x3d')]=[{'all':!![]}];}_0x537301=_[_0xde44('0x3a')]({},_0x537301,_0x31f810[_0xde44('0x44')]);return db[_0xde44('0x2a')][_0xde44('0x45')](_0x537301)[_0xde44('0x21')](handleEntityNotFound(_0x4fc671,null))[_0xde44('0x21')](respondWithResult(_0x4fc671,null))['catch'](handleError(_0x4fc671,null));};exports[_0xde44('0x46')]=function(_0x1707e4,_0x292439){return db[_0xde44('0x2a')][_0xde44('0x46')](_0x1707e4[_0xde44('0x47')],{})[_0xde44('0x21')](respondWithResult(_0x292439,0xc9))['catch'](handleError(_0x292439,null));};exports[_0xde44('0x20')]=function(_0x5c4584,_0x437c68){if(_0x5c4584[_0xde44('0x47')]['id']){delete _0x5c4584['body']['id'];}return db['FreshsalesField'][_0xde44('0x45')]({'where':{'id':_0x5c4584[_0xde44('0x41')]['id']}})[_0xde44('0x21')](handleEntityNotFound(_0x437c68,null))['then'](saveUpdates(_0x5c4584['body'],null))[_0xde44('0x21')](respondWithResult(_0x437c68,null))[_0xde44('0x3f')](handleError(_0x437c68,null));};exports['destroy']=function(_0x781f12,_0x2eb5fc){return db[_0xde44('0x2a')][_0xde44('0x45')]({'where':{'id':_0x781f12[_0xde44('0x41')]['id']}})[_0xde44('0x21')](handleEntityNotFound(_0x2eb5fc,null))['then'](removeEntity(_0x2eb5fc,null))['catch'](handleError(_0x2eb5fc,null));}; \ No newline at end of file +var _0x81f0=['filters','intersection','model','fields','query','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','name','options','includeAll','include','rows','catch','show','length','find','create','body','update','params','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','send','map','FreshsalesField','rawAttributes','fieldName','key','keys'];(function(_0x56faca,_0x31c651){var _0x1fc6da=function(_0x1a9241){while(--_0x1a9241){_0x56faca['push'](_0x56faca['shift']());}};_0x1fc6da(++_0x31c651);}(_0x81f0,0xb9));var _0x081f=function(_0x44331b,_0x33b4dd){_0x44331b=_0x44331b-0x0;var _0x3e685a=_0x81f0[_0x44331b];return _0x3e685a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x081f('0x0'));var zipdir=require(_0x081f('0x1'));var jsonpatch=require(_0x081f('0x2'));var rp=require(_0x081f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x081f('0x4'));var util=require(_0x081f('0x5'));var path=require(_0x081f('0x6'));var sox=require(_0x081f('0x7'));var csv=require(_0x081f('0x8'));var ejs=require(_0x081f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x081f('0xa'));var squel=require(_0x081f('0xb'));var crypto=require(_0x081f('0xc'));var jsforce=require(_0x081f('0xd'));var deskjs=require(_0x081f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x081f('0xf'));var Papa=require(_0x081f('0x10'));var Redis=require(_0x081f('0x11'));var authService=require(_0x081f('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x081f('0x13'));var logger=require(_0x081f('0x14'))(_0x081f('0x15'));var utils=require(_0x081f('0x16'));var config=require(_0x081f('0x17'));var licenseUtil=require(_0x081f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f648c,_0x1d4db5){_0x1d4db5=_0x1d4db5||0xcc;return function(_0x2ea0e6){if(_0x2ea0e6){return _0x3f648c[_0x081f('0x19')](_0x1d4db5);}return _0x3f648c[_0x081f('0x1a')](_0x1d4db5)[_0x081f('0x1b')]();};}function respondWithResult(_0x50f882,_0x5d7e56){_0x5d7e56=_0x5d7e56||0xc8;return function(_0x2aea03){if(_0x2aea03){return _0x50f882[_0x081f('0x1a')](_0x5d7e56)[_0x081f('0x1c')](_0x2aea03);}};}function respondWithFilteredResult(_0x370410,_0x5c1445){return function(_0x27713b){if(_0x27713b){var _0x16a504=typeof _0x5c1445[_0x081f('0x1d')]===_0x081f('0x1e')&&typeof _0x5c1445[_0x081f('0x1f')]==='undefined';var _0x4bc2ce=_0x27713b[_0x081f('0x20')];var _0x1f1859=_0x16a504?0x0:_0x5c1445[_0x081f('0x1d')];var _0x975cb8=_0x16a504?_0x27713b[_0x081f('0x20')]:_0x5c1445[_0x081f('0x1d')]+_0x5c1445[_0x081f('0x1f')];var _0x41b7f8;if(_0x975cb8>=_0x4bc2ce){_0x975cb8=_0x4bc2ce;_0x41b7f8=0xc8;}else{_0x41b7f8=0xce;}_0x370410[_0x081f('0x1a')](_0x41b7f8);return _0x370410[_0x081f('0x21')](_0x081f('0x22'),_0x1f1859+'-'+_0x975cb8+'/'+_0x4bc2ce)[_0x081f('0x1c')](_0x27713b);}return null;};}function patchUpdates(_0x13ff61){return function(_0x197e50){try{jsonpatch[_0x081f('0x23')](_0x197e50,_0x13ff61,!![]);}catch(_0x3f7945){return BPromise[_0x081f('0x24')](_0x3f7945);}return _0x197e50[_0x081f('0x25')]();};}function saveUpdates(_0x3127da,_0x3316d9){return function(_0x24799b){if(_0x24799b){return _0x24799b['update'](_0x3127da)[_0x081f('0x26')](function(_0x428b3f){return _0x428b3f;});}return null;};}function removeEntity(_0x1e4db1,_0x4f2c5c){return function(_0x5a3d4f){if(_0x5a3d4f){return _0x5a3d4f[_0x081f('0x27')]()['then'](function(){_0x1e4db1[_0x081f('0x1a')](0xcc)[_0x081f('0x1b')]();});}};}function handleEntityNotFound(_0x9dfd33,_0x1b630a){return function(_0x3d17d3){if(!_0x3d17d3){_0x9dfd33['sendStatus'](0x194);}return _0x3d17d3;};}function handleError(_0x9cedc5,_0x17f962){_0x17f962=_0x17f962||0x1f4;return function(_0xc93456){logger[_0x081f('0x28')](_0xc93456[_0x081f('0x29')]);if(_0xc93456['name']){delete _0xc93456['name'];}_0x9cedc5[_0x081f('0x1a')](_0x17f962)[_0x081f('0x2a')](_0xc93456);};}exports['index']=function(_0x3148bb,_0x1c4307){var _0x4d78b0={},_0x5cd784={},_0x18be7d={'count':0x0,'rows':[]};var _0x69c7ac=_[_0x081f('0x2b')](db[_0x081f('0x2c')][_0x081f('0x2d')],function(_0x39211b){return{'name':_0x39211b[_0x081f('0x2e')],'type':_0x39211b['type'][_0x081f('0x2f')]};});_0x5cd784['model']=_[_0x081f('0x2b')](_0x69c7ac,'name');_0x5cd784['query']=_[_0x081f('0x30')](_0x3148bb['query']);_0x5cd784[_0x081f('0x31')]=_[_0x081f('0x32')](_0x5cd784[_0x081f('0x33')],_0x5cd784['query']);_0x4d78b0['attributes']=_[_0x081f('0x32')](_0x5cd784[_0x081f('0x33')],qs[_0x081f('0x34')](_0x3148bb[_0x081f('0x35')][_0x081f('0x34')]));_0x4d78b0[_0x081f('0x36')]=_0x4d78b0[_0x081f('0x36')]['length']?_0x4d78b0[_0x081f('0x36')]:_0x5cd784['model'];if(!_0x3148bb['query'][_0x081f('0x37')](_0x081f('0x38'))){_0x4d78b0['limit']=qs['limit'](_0x3148bb[_0x081f('0x35')]['limit']);_0x4d78b0[_0x081f('0x1d')]=qs[_0x081f('0x1d')](_0x3148bb['query']['offset']);}_0x4d78b0[_0x081f('0x39')]=qs['sort'](_0x3148bb['query'][_0x081f('0x3a')]);_0x4d78b0['where']=qs[_0x081f('0x31')](_[_0x081f('0x3b')](_0x3148bb[_0x081f('0x35')],_0x5cd784[_0x081f('0x31')]),_0x69c7ac);if(_0x3148bb[_0x081f('0x35')][_0x081f('0x3c')]){_0x4d78b0['where']=_[_0x081f('0x3d')](_0x4d78b0[_0x081f('0x3e')],{'$or':_['map'](_0x69c7ac,function(_0xd470d6){if(_0xd470d6[_0x081f('0x3f')]!==_0x081f('0x40')){var _0x240388={};_0x240388[_0xd470d6[_0x081f('0x41')]]={'$like':'%'+_0x3148bb['query']['filter']+'%'};return _0x240388;}})});}_0x4d78b0=_[_0x081f('0x3d')]({},_0x4d78b0,_0x3148bb[_0x081f('0x42')]);var _0x3a8902={'where':_0x4d78b0['where']};return db[_0x081f('0x2c')][_0x081f('0x20')](_0x3a8902)['then'](function(_0x213421){_0x18be7d[_0x081f('0x20')]=_0x213421;if(_0x3148bb[_0x081f('0x35')][_0x081f('0x43')]){_0x4d78b0[_0x081f('0x44')]=[{'all':!![]}];}return db[_0x081f('0x2c')]['findAll'](_0x4d78b0);})[_0x081f('0x26')](function(_0x520029){_0x18be7d[_0x081f('0x45')]=_0x520029;return _0x18be7d;})[_0x081f('0x26')](respondWithFilteredResult(_0x1c4307,_0x4d78b0))[_0x081f('0x46')](handleError(_0x1c4307,null));};exports[_0x081f('0x47')]=function(_0x52e6c1,_0x4deb21){var _0x517072={'raw':!![],'where':{'id':_0x52e6c1['params']['id']}},_0x13e932={};_0x13e932[_0x081f('0x33')]=_[_0x081f('0x30')](db[_0x081f('0x2c')][_0x081f('0x2d')]);_0x13e932['query']=_[_0x081f('0x30')](_0x52e6c1[_0x081f('0x35')]);_0x13e932[_0x081f('0x31')]=_[_0x081f('0x32')](_0x13e932[_0x081f('0x33')],_0x13e932[_0x081f('0x35')]);_0x517072[_0x081f('0x36')]=_[_0x081f('0x32')](_0x13e932[_0x081f('0x33')],qs[_0x081f('0x34')](_0x52e6c1[_0x081f('0x35')][_0x081f('0x34')]));_0x517072[_0x081f('0x36')]=_0x517072['attributes'][_0x081f('0x48')]?_0x517072[_0x081f('0x36')]:_0x13e932['model'];if(_0x52e6c1[_0x081f('0x35')][_0x081f('0x43')]){_0x517072[_0x081f('0x44')]=[{'all':!![]}];}_0x517072=_[_0x081f('0x3d')]({},_0x517072,_0x52e6c1[_0x081f('0x42')]);return db[_0x081f('0x2c')][_0x081f('0x49')](_0x517072)[_0x081f('0x26')](handleEntityNotFound(_0x4deb21,null))['then'](respondWithResult(_0x4deb21,null))[_0x081f('0x46')](handleError(_0x4deb21,null));};exports[_0x081f('0x4a')]=function(_0x5eebe9,_0x1f22da){return db[_0x081f('0x2c')][_0x081f('0x4a')](_0x5eebe9[_0x081f('0x4b')],{})[_0x081f('0x26')](respondWithResult(_0x1f22da,0xc9))[_0x081f('0x46')](handleError(_0x1f22da,null));};exports[_0x081f('0x4c')]=function(_0x3975b8,_0x275b9d){if(_0x3975b8[_0x081f('0x4b')]['id']){delete _0x3975b8[_0x081f('0x4b')]['id'];}return db[_0x081f('0x2c')][_0x081f('0x49')]({'where':{'id':_0x3975b8[_0x081f('0x4d')]['id']}})[_0x081f('0x26')](handleEntityNotFound(_0x275b9d,null))[_0x081f('0x26')](saveUpdates(_0x3975b8['body'],null))[_0x081f('0x26')](respondWithResult(_0x275b9d,null))[_0x081f('0x46')](handleError(_0x275b9d,null));};exports[_0x081f('0x27')]=function(_0x329124,_0x2a04ba){return db[_0x081f('0x2c')][_0x081f('0x49')]({'where':{'id':_0x329124[_0x081f('0x4d')]['id']}})[_0x081f('0x26')](handleEntityNotFound(_0x2a04ba,null))['then'](removeEntity(_0x2a04ba,null))[_0x081f('0x46')](handleError(_0x2a04ba,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 339e811..22855f8 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 _0x430c=['api','moment','bluebird','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash'];(function(_0x2711f8,_0x3231d4){var _0x3b38eb=function(_0x70d05e){while(--_0x70d05e){_0x2711f8['push'](_0x2711f8['shift']());}};_0x3b38eb(++_0x3231d4);}(_0x430c,0x1a1));var _0xc430=function(_0x3dee92,_0x55e1eb){_0x3dee92=_0x3dee92-0x0;var _0x44d36e=_0x430c[_0x3dee92];return _0x44d36e;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc430('0x1'));var moment=require(_0xc430('0x2'));var BPromise=require(_0xc430('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc430('0x4'));module[_0xc430('0x5')]=function(_0x50b256,_0x42aa9c){return _0x50b256['define'](_0xc430('0x6'),attributes,{'tableName':_0xc430('0x7'),'paranoid':![],'indexes':[{'name':_0xc430('0x8'),'fields':[_0xc430('0x9'),_0xc430('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5eb8=['rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x230b9f,_0x41643e){var _0x53aef1=function(_0x52c019){while(--_0x52c019){_0x230b9f['push'](_0x230b9f['shift']());}};_0x53aef1(++_0x41643e);}(_0x5eb8,0xb0));var _0x85eb=function(_0x33155c,_0x3fdde1){_0x33155c=_0x33155c-0x0;var _0x5becf7=_0x5eb8[_0x33155c];return _0x5becf7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x85eb('0x0'))(_0x85eb('0x1'));var moment=require(_0x85eb('0x2'));var BPromise=require(_0x85eb('0x3'));var rp=require(_0x85eb('0x4'));var fs=require('fs');var path=require(_0x85eb('0x5'));var rimraf=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var attributes=require(_0x85eb('0x8'));module[_0x85eb('0x9')]=function(_0x2bf83c,_0x1ba1d8){return _0x2bf83c['define'](_0x85eb('0xa'),attributes,{'tableName':_0x85eb('0xb'),'paranoid':![],'indexes':[{'name':_0x85eb('0xc'),'fields':['idField',_0x85eb('0xd')],'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 29e2e7f..f05ecfc 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x35a779,_0x27f8fb){var _0xca723b=function(_0x298df7){while(--_0x298df7){_0x35a779['push'](_0x35a779['shift']());}};_0xca723b(++_0x27f8fb);}(_0x2ef3,0xba));var _0x32ef=function(_0x59b2ac,_0x289dc7){_0x59b2ac=_0x59b2ac-0x0;var _0x341a3f=_0x2ef3[_0x59b2ac];return _0x341a3f;};'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')]('FreshsalesField,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x46ed=['FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x46ed,0x168));var _0xd46e=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x46ed[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var moment=require('moment');var BPromise=require(_0xd46e('0x2'));var rs=require(_0xd46e('0x3'));var fs=require('fs');var Redis=require(_0xd46e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd46e('0x5'));var logger=require(_0xd46e('0x6'))('rpc');var config=require(_0xd46e('0x7'));var jayson=require(_0xd46e('0x8'));var client=jayson[_0xd46e('0x9')][_0xd46e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45e680,_0x855f24,_0x437ea0){return new BPromise(function(_0x144687,_0x31259b){return client[_0xd46e('0xb')](_0x45e680,_0x437ea0)[_0xd46e('0xc')](function(_0x59c88d){logger[_0xd46e('0xd')](_0xd46e('0xe'),_0x855f24,'request\x20sent');logger[_0xd46e('0xf')](_0xd46e('0x10'),_0x855f24,_0xd46e('0x11'),JSON[_0xd46e('0x12')](_0x59c88d));if(_0x59c88d[_0xd46e('0x13')]){if(_0x59c88d[_0xd46e('0x13')]['code']===0x1f4){logger[_0xd46e('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x855f24,_0x59c88d['error'][_0xd46e('0x14')]);return _0x31259b(_0x59c88d[_0xd46e('0x13')]['message']);}logger['error'](_0xd46e('0xe'),_0x855f24,_0x59c88d[_0xd46e('0x13')][_0xd46e('0x14')]);return _0x144687(_0x59c88d[_0xd46e('0x13')]['message']);}else{logger[_0xd46e('0xd')](_0xd46e('0xe'),_0x855f24,_0xd46e('0x11'));_0x144687(_0x59c88d[_0xd46e('0x15')][_0xd46e('0x14')]);}})['catch'](function(_0x1d50a5){logger[_0xd46e('0x13')](_0xd46e('0xe'),_0x855f24,_0x1d50a5);_0x31259b(_0x1d50a5);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index ed822e9..d8f351c 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(_0x2bf264,_0x2f0f66){var _0x31261c=function(_0x2fdcd9){while(--_0x2fdcd9){_0x2bf264['push'](_0x2bf264['shift']());}};_0x31261c(++_0x2f0f66);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x48bc96,_0x222830){var _0x2ed963=function(_0x421a7b){while(--_0x421a7b){_0x48bc96['push'](_0x48bc96['shift']());}};_0x2ed963(++_0x222830);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index a8a6c06..3879809 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 _0xce2e=['STRING','username','newTab','integrationTab','sequelize','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xce2e,0x1d8));var _0xece2=function(_0x1bee96,_0x528c4f){_0x1bee96=_0x1bee96-0x0;var _0xa1c3c=_0xce2e[_0x1bee96];return _0xa1c3c;};'use strict';var Sequelize=require(_0xece2('0x0'));module[_0xece2('0x1')]={'name':{'type':Sequelize[_0xece2('0x2')]},'description':{'type':Sequelize[_0xece2('0x2')]},'username':{'type':Sequelize[_0xece2('0x2')],'unique':_0xece2('0x3')},'remoteUri':{'type':Sequelize[_0xece2('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xece2('0x2')]},'clientSecret':{'type':Sequelize[_0xece2('0x2')]},'securityToken':{'type':Sequelize[_0xece2('0x2')]},'serverUrl':{'type':Sequelize[_0xece2('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0xece2('0x4')),'defaultValue':_0xece2('0x5')}}; \ No newline at end of file +var _0x53eb=['integrationTab','newTab','sequelize','exports','STRING'];(function(_0x11732d,_0x4c580c){var _0x4e3e46=function(_0x571fe1){while(--_0x571fe1){_0x11732d['push'](_0x11732d['shift']());}};_0x4e3e46(++_0x4c580c);}(_0x53eb,0x115));var _0xb53e=function(_0x338000,_0x35cf5b){_0x338000=_0x338000-0x0;var _0xa089dd=_0x53eb[_0x338000];return _0xa089dd;};'use strict';var Sequelize=require(_0xb53e('0x0'));module[_0xb53e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb53e('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0xb53e('0x2')]},'password':{'type':Sequelize[_0xb53e('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xb53e('0x2')]},'securityToken':{'type':Sequelize[_0xb53e('0x2')]},'serverUrl':{'type':Sequelize[_0xb53e('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xb53e('0x3'),_0xb53e('0x4')),'defaultValue':_0xb53e('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index a417ae4..349fa0f 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 _0x0028=['set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SalesforceAccount','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','getConfigurations','findOne','keys','SalesforceConfiguration','pick','hasOwnProperty','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','getFields','Task','remoteUri','clientId','password','securityToken','slice','substring','lastIndexOf','clientSecret','login','username','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','int','boolean','email','phone','remove','includes','label','custom','value','true','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count'];(function(_0x3b445a,_0x31a21d){var _0x4f9602=function(_0x441605){while(--_0x441605){_0x3b445a['push'](_0x3b445a['shift']());}};_0x4f9602(++_0x31a21d);}(_0x0028,0xd6));var _0x8002=function(_0x2afb44,_0x249a57){_0x2afb44=_0x2afb44-0x0;var _0x15ccc2=_0x0028[_0x2afb44];return _0x15ccc2;};'use strict';var emlformat=require(_0x8002('0x0'));var rimraf=require(_0x8002('0x1'));var zipdir=require(_0x8002('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8002('0x3'));var moment=require('moment');var BPromise=require(_0x8002('0x4'));var Mustache=require(_0x8002('0x5'));var util=require('util');var path=require(_0x8002('0x6'));var sox=require('sox');var csv=require(_0x8002('0x7'));var ejs=require(_0x8002('0x8'));var fs=require('fs');var fs_extra=require(_0x8002('0x9'));var _=require(_0x8002('0xa'));var squel=require(_0x8002('0xb'));var crypto=require(_0x8002('0xc'));var jsforce=require(_0x8002('0xd'));var deskjs=require(_0x8002('0xe'));var toCsv=require(_0x8002('0x7'));var querystring=require('querystring');var Papa=require(_0x8002('0xf'));var Redis=require(_0x8002('0x10'));var authService=require(_0x8002('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8002('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8002('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8002('0x14'));var db=require(_0x8002('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xee38a7,_0x27f9d2){_0x27f9d2=_0x27f9d2||0xcc;return function(_0x6a8e26){if(_0x6a8e26){return _0xee38a7[_0x8002('0x16')](_0x27f9d2);}return _0xee38a7[_0x8002('0x17')](_0x27f9d2)[_0x8002('0x18')]();};}function respondWithResult(_0x581a61,_0x3798d1){_0x3798d1=_0x3798d1||0xc8;return function(_0x1ab6c6){if(_0x1ab6c6){return _0x581a61[_0x8002('0x17')](_0x3798d1)[_0x8002('0x19')](_0x1ab6c6);}};}function respondWithFilteredResult(_0xaaad5c,_0x57a51f){return function(_0x2fcd49){if(_0x2fcd49){var _0x38f43b=typeof _0x57a51f[_0x8002('0x1a')]==='undefined'&&typeof _0x57a51f[_0x8002('0x1b')]===_0x8002('0x1c');var _0x299988=_0x2fcd49[_0x8002('0x1d')];var _0x57854b=_0x38f43b?0x0:_0x57a51f[_0x8002('0x1a')];var _0x323e74=_0x38f43b?_0x2fcd49[_0x8002('0x1d')]:_0x57a51f['offset']+_0x57a51f['limit'];var _0x6b78e1;if(_0x323e74>=_0x299988){_0x323e74=_0x299988;_0x6b78e1=0xc8;}else{_0x6b78e1=0xce;}_0xaaad5c[_0x8002('0x17')](_0x6b78e1);return _0xaaad5c[_0x8002('0x1e')](_0x8002('0x1f'),_0x57854b+'-'+_0x323e74+'/'+_0x299988)[_0x8002('0x19')](_0x2fcd49);}return null;};}function patchUpdates(_0x357557){return function(_0x3cf8bd){try{jsonpatch[_0x8002('0x20')](_0x3cf8bd,_0x357557,!![]);}catch(_0x1c5a49){return BPromise[_0x8002('0x21')](_0x1c5a49);}return _0x3cf8bd[_0x8002('0x22')]();};}function saveUpdates(_0x5a971e,_0x5cf901){return function(_0x2bac54){if(_0x2bac54){return _0x2bac54[_0x8002('0x23')](_0x5a971e)[_0x8002('0x24')](function(_0x5203b6){return _0x5203b6;});}return null;};}function removeEntity(_0x4d7d17,_0x47486b){return function(_0x52faf4){if(_0x52faf4){return _0x52faf4[_0x8002('0x25')]()[_0x8002('0x24')](function(){_0x4d7d17['status'](0xcc)[_0x8002('0x18')]();});}};}function handleEntityNotFound(_0x14f32c,_0x1a2915){return function(_0x17d34a){if(!_0x17d34a){_0x14f32c['sendStatus'](0x194);}return _0x17d34a;};}function handleError(_0x3d05f8,_0x546f1f){_0x546f1f=_0x546f1f||0x1f4;return function(_0x5abf84){logger[_0x8002('0x26')](_0x5abf84[_0x8002('0x27')]);if(_0x5abf84[_0x8002('0x28')]){delete _0x5abf84[_0x8002('0x28')];}_0x3d05f8['status'](_0x546f1f)['send'](_0x5abf84);};}exports[_0x8002('0x29')]=function(_0x3df313,_0x4504c5){var _0x3d50d3={},_0x5d012f={},_0x2e99ab={'count':0x0,'rows':[]};var _0x16168c=_[_0x8002('0x2a')](db[_0x8002('0x2b')][_0x8002('0x2c')],function(_0xddd5bc){return{'name':_0xddd5bc[_0x8002('0x2d')],'type':_0xddd5bc[_0x8002('0x2e')]['key']};});_0x5d012f[_0x8002('0x2f')]=_[_0x8002('0x2a')](_0x16168c,_0x8002('0x28'));_0x5d012f[_0x8002('0x30')]=_['keys'](_0x3df313[_0x8002('0x30')]);_0x5d012f[_0x8002('0x31')]=_[_0x8002('0x32')](_0x5d012f[_0x8002('0x2f')],_0x5d012f[_0x8002('0x30')]);_0x3d50d3[_0x8002('0x33')]=_['intersection'](_0x5d012f[_0x8002('0x2f')],qs[_0x8002('0x34')](_0x3df313[_0x8002('0x30')][_0x8002('0x34')]));_0x3d50d3[_0x8002('0x33')]=_0x3d50d3['attributes'][_0x8002('0x35')]?_0x3d50d3[_0x8002('0x33')]:_0x5d012f[_0x8002('0x2f')];if(!_0x3df313[_0x8002('0x30')]['hasOwnProperty'](_0x8002('0x36'))){_0x3d50d3[_0x8002('0x1b')]=qs[_0x8002('0x1b')](_0x3df313[_0x8002('0x30')]['limit']);_0x3d50d3[_0x8002('0x1a')]=qs[_0x8002('0x1a')](_0x3df313[_0x8002('0x30')]['offset']);}_0x3d50d3[_0x8002('0x37')]=qs[_0x8002('0x38')](_0x3df313[_0x8002('0x30')][_0x8002('0x38')]);_0x3d50d3[_0x8002('0x39')]=qs[_0x8002('0x31')](_['pick'](_0x3df313[_0x8002('0x30')],_0x5d012f[_0x8002('0x31')]),_0x16168c);if(_0x3df313[_0x8002('0x30')]['filter']){_0x3d50d3['where']=_[_0x8002('0x3a')](_0x3d50d3['where'],{'$or':_[_0x8002('0x2a')](_0x16168c,function(_0xf5913b){if(_0xf5913b[_0x8002('0x2e')]!==_0x8002('0x3b')){var _0x28cf74={};_0x28cf74[_0xf5913b[_0x8002('0x28')]]={'$like':'%'+_0x3df313[_0x8002('0x30')][_0x8002('0x3c')]+'%'};return _0x28cf74;}})});}_0x3d50d3=_['merge']({},_0x3d50d3,_0x3df313[_0x8002('0x3d')]);var _0x22bc2e={'where':_0x3d50d3[_0x8002('0x39')]};return db[_0x8002('0x2b')]['count'](_0x22bc2e)[_0x8002('0x24')](function(_0x30132e){_0x2e99ab['count']=_0x30132e;if(_0x3df313[_0x8002('0x30')][_0x8002('0x3e')]){_0x3d50d3[_0x8002('0x3f')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x8002('0x40')](_0x3d50d3);})[_0x8002('0x24')](function(_0x46d49a){_0x2e99ab[_0x8002('0x41')]=_0x46d49a;return _0x2e99ab;})[_0x8002('0x24')](respondWithFilteredResult(_0x4504c5,_0x3d50d3))[_0x8002('0x42')](handleError(_0x4504c5,null));};exports['show']=function(_0x2145b5,_0x4b3b3e){var _0x300b09={'raw':![],'where':{'id':_0x2145b5[_0x8002('0x43')]['id']}},_0x1e9118={};_0x1e9118[_0x8002('0x2f')]=_['keys'](db[_0x8002('0x2b')][_0x8002('0x2c')]);_0x1e9118[_0x8002('0x30')]=_['keys'](_0x2145b5[_0x8002('0x30')]);_0x1e9118['filters']=_['intersection'](_0x1e9118[_0x8002('0x2f')],_0x1e9118['query']);_0x300b09[_0x8002('0x33')]=_[_0x8002('0x32')](_0x1e9118[_0x8002('0x2f')],qs[_0x8002('0x34')](_0x2145b5['query'][_0x8002('0x34')]));_0x300b09[_0x8002('0x33')]=_0x300b09[_0x8002('0x33')][_0x8002('0x35')]?_0x300b09[_0x8002('0x33')]:_0x1e9118[_0x8002('0x2f')];if(_0x2145b5[_0x8002('0x30')][_0x8002('0x3e')]){_0x300b09['include']=[{'all':!![]}];}_0x300b09=_[_0x8002('0x3a')]({},_0x300b09,_0x2145b5[_0x8002('0x3d')]);return db[_0x8002('0x2b')][_0x8002('0x44')](_0x300b09)['then'](handleEntityNotFound(_0x4b3b3e,null))[_0x8002('0x24')](respondWithResult(_0x4b3b3e,null))[_0x8002('0x42')](handleError(_0x4b3b3e,null));};exports['create']=function(_0x2379e1,_0x3b6633){return db[_0x8002('0x2b')][_0x8002('0x45')](_0x2379e1[_0x8002('0x46')],{})[_0x8002('0x24')](respondWithResult(_0x3b6633,0xc9))[_0x8002('0x42')](handleError(_0x3b6633,null));};exports[_0x8002('0x23')]=function(_0x5eade8,_0xf67cf8){if(_0x5eade8[_0x8002('0x46')]['id']){delete _0x5eade8['body']['id'];}return db[_0x8002('0x2b')][_0x8002('0x44')]({'where':{'id':_0x5eade8[_0x8002('0x43')]['id']}})[_0x8002('0x24')](handleEntityNotFound(_0xf67cf8,null))[_0x8002('0x24')](saveUpdates(_0x5eade8[_0x8002('0x46')],null))[_0x8002('0x24')](respondWithResult(_0xf67cf8,null))[_0x8002('0x42')](handleError(_0xf67cf8,null));};exports['destroy']=function(_0x3c9859,_0x4c94c4){return db[_0x8002('0x2b')][_0x8002('0x44')]({'where':{'id':_0x3c9859[_0x8002('0x43')]['id']}})[_0x8002('0x24')](handleEntityNotFound(_0x4c94c4,null))['then'](removeEntity(_0x4c94c4,null))['catch'](handleError(_0x4c94c4,null));};exports[_0x8002('0x47')]=function(_0x5074db,_0x1a05e9,_0x4889e8){var _0xb65a9b={};var _0x5d464a={};var _0x42f131;var _0x3d1cad;return db['SalesforceAccount'][_0x8002('0x48')]({'where':{'id':_0x5074db[_0x8002('0x43')]['id']}})[_0x8002('0x24')](handleEntityNotFound(_0x1a05e9,null))[_0x8002('0x24')](function(_0x34c6af){if(_0x34c6af){_0x42f131=_0x34c6af;_0x5d464a[_0x8002('0x2f')]=_[_0x8002('0x49')](db[_0x8002('0x4a')][_0x8002('0x2c')]);_0x5d464a[_0x8002('0x30')]=_[_0x8002('0x49')](_0x5074db[_0x8002('0x30')]);_0x5d464a[_0x8002('0x31')]=_[_0x8002('0x32')](_0x5d464a[_0x8002('0x2f')],_0x5d464a[_0x8002('0x30')]);_0xb65a9b[_0x8002('0x33')]=_['intersection'](_0x5d464a['model'],qs[_0x8002('0x34')](_0x5074db[_0x8002('0x30')]['fields']));_0xb65a9b[_0x8002('0x33')]=_0xb65a9b[_0x8002('0x33')][_0x8002('0x35')]?_0xb65a9b[_0x8002('0x33')]:_0x5d464a[_0x8002('0x2f')];_0xb65a9b[_0x8002('0x37')]=qs[_0x8002('0x38')](_0x5074db[_0x8002('0x30')][_0x8002('0x38')]);_0xb65a9b[_0x8002('0x39')]=qs[_0x8002('0x31')](_[_0x8002('0x4b')](_0x5074db[_0x8002('0x30')],_0x5d464a[_0x8002('0x31')]));if(_0x5074db[_0x8002('0x30')][_0x8002('0x3c')]){_0xb65a9b['where']=_[_0x8002('0x3a')](_0xb65a9b[_0x8002('0x39')],{'$or':_[_0x8002('0x2a')](_0xb65a9b['attributes'],function(_0x4b6053){var _0xabcd13={};_0xabcd13[_0x4b6053]={'$like':'%'+_0x5074db[_0x8002('0x30')][_0x8002('0x3c')]+'%'};return _0xabcd13;})});}_0xb65a9b=_['merge']({},_0xb65a9b,_0x5074db[_0x8002('0x3d')]);return _0x42f131[_0x8002('0x47')](_0xb65a9b);}})[_0x8002('0x24')](function(_0x4d6e72){if(_0x4d6e72){_0x3d1cad=_0x4d6e72[_0x8002('0x35')];if(!_0x5074db[_0x8002('0x30')][_0x8002('0x4c')]('nolimit')){_0xb65a9b[_0x8002('0x1b')]=qs[_0x8002('0x1b')](_0x5074db[_0x8002('0x30')][_0x8002('0x1b')]);_0xb65a9b['offset']=qs[_0x8002('0x1a')](_0x5074db['query'][_0x8002('0x1a')]);}return _0x42f131[_0x8002('0x47')](_0xb65a9b);}})['then'](function(_0x41464f){if(_0x41464f){return _0x41464f?{'count':_0x3d1cad,'rows':_0x41464f}:null;}})['then'](respondWithResult(_0x1a05e9,null))[_0x8002('0x42')](handleError(_0x1a05e9,null));};exports[_0x8002('0x4d')]=function(_0x10af86,_0x1e6448,_0x5a3177){if(_0x10af86[_0x8002('0x46')]['id']){delete _0x10af86[_0x8002('0x46')]['id'];}return db[_0x8002('0x2b')][_0x8002('0x48')]({'where':{'id':_0x10af86[_0x8002('0x43')]['id']}})[_0x8002('0x24')](handleEntityNotFound(_0x1e6448,null))[_0x8002('0x24')](function(_0x2f2d4c){if(_0x2f2d4c){_0x10af86['body']['AccountId']=_0x2f2d4c['id'];_0x10af86[_0x8002('0x46')][_0x8002('0x4e')]=integrations[_0x8002('0x4f')](_0x10af86[_0x8002('0x46')]['channel'],_0x10af86['body'][_0x8002('0x2e')]);_0x10af86[_0x8002('0x46')][_0x8002('0x50')]=integrations[_0x8002('0x51')](_0x10af86['body'][_0x8002('0x52')],_0x10af86[_0x8002('0x46')]['type']);return db[_0x8002('0x4a')][_0x8002('0x45')](_0x10af86[_0x8002('0x46')],{'include':[{'model':db['SalesforceField'],'as':_0x8002('0x4e')},{'model':db[_0x8002('0x53')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1e6448,null))[_0x8002('0x42')](handleError(_0x1e6448,null));};exports[_0x8002('0x54')]=function(_0x2370f5,_0xc03c3,_0x5d6b4e){var _0x3e4e91;var _0x5d679f='';var _0x2c0631=_0x8002('0x55');return db[_0x8002('0x2b')][_0x8002('0x48')]({'where':{'id':_0x2370f5['params']['id']},'attributes':['id',_0x8002('0x56'),_0x8002('0x57'),'clientSecret','username',_0x8002('0x58'),_0x8002('0x59')]})[_0x8002('0x24')](handleEntityNotFound(_0xc03c3,null))[_0x8002('0x24')](function(_0x2add0c){if(_0x2add0c){_0x5d679f=_0x2add0c[_0x8002('0x56')];var _0x338225=_0x5d679f[_0x8002('0x5a')](-0x1);if(_0x338225==='/'){_0x5d679f=_0x5d679f[_0x8002('0x5b')](0x0,_0x5d679f[_0x8002('0x5c')](_0x338225));}_0x3e4e91=new jsforce['Connection']({'oauth2':{'loginUrl':_0x5d679f,'clientId':_0x2add0c[_0x8002('0x57')],'clientSecret':_0x2add0c[_0x8002('0x5d')]}});return _0x3e4e91[_0x8002('0x5e')](_0x2add0c[_0x8002('0x5f')],_0x2add0c[_0x8002('0x58')]['concat'](_0x2add0c[_0x8002('0x59')]));}})[_0x8002('0x24')](function(_0x3fbe7a){if(_0x3fbe7a){if(!_[_0x8002('0x60')](_0x2370f5[_0x8002('0x30')][_0x8002('0x61')])){_0x2c0631=_0x2370f5[_0x8002('0x30')][_0x8002('0x61')];}return _0x3e4e91[_0x8002('0x62')](_0x2c0631)[_0x8002('0x63')]();}})[_0x8002('0x24')](function(_0x4676f0){var _0x2109a8=[_0x8002('0x64'),_0x8002('0x65'),_0x8002('0x66'),_0x8002('0x67'),_0x8002('0x68'),'Description'];var _0x37fb79=[_0x8002('0x69'),_0x8002('0x6a'),'picklist',_0x8002('0x6b'),_0x8002('0x6c'),'textarea',_0x8002('0x6d')];if(_0x4676f0){_[_0x8002('0x6e')](_0x4676f0[_0x8002('0x34')],function(_0x4ea079){return _0x2109a8[_0x8002('0x6f')](_0x4ea079[_0x8002('0x28')])||!_0x37fb79[_0x8002('0x6f')](_0x4ea079[_0x8002('0x2e')]);});return{'count':_0x4676f0[_0x8002('0x34')][_0x8002('0x35')],'rows':_['map'](_0x4676f0[_0x8002('0x34')],function(_0x41579b){return{'id':_0x41579b[_0x8002('0x28')],'name':_0x41579b[_0x8002('0x70')],'custom':_0x41579b[_0x8002('0x71')],'options':_0x41579b['picklistValues']['length']>0x0?_[_0x8002('0x2a')](_0x41579b['picklistValues'],function(_0x8b084c){return{'name':_0x8b084c[_0x8002('0x70')],'value':_0x8b084c[_0x8002('0x72')]};}):_0x41579b[_0x8002('0x2e')]=='boolean'?[{'name':'True','value':_0x8002('0x73')},{'name':_0x8002('0x74'),'value':'false'}]:[]};})};}})[_0x8002('0x24')](respondWithResult(_0xc03c3,null))[_0x8002('0x42')](function(_0x81df48){var _0x4164bc=_0x2370f5[_0x8002('0x30')][_0x8002('0x75')]?0x1f4:_0x81df48[_0x8002('0x76')]||0x1f4;logger[_0x8002('0x26')](_0x8002('0x77'),_0x8002('0x54'),_0x4164bc,JSON[_0x8002('0x78')](_0x81df48));delete _0x81df48['name'];if(_0x4164bc===0x191){_0x4164bc=0x190;}_0xc03c3[_0x8002('0x17')](_0x4164bc)[_0x8002('0x79')](_0x2370f5[_0x8002('0x30')][_0x8002('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x81df48[_0x8002('0x76')]}:_0x81df48);});}; \ No newline at end of file +var _0xe6c3=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','nolimit','limit','order','sort','pick','filter','where','merge','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','findOne','SalesforceConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Task','remoteUri','clientId','clientSecret','password','securityToken','slice','substring','Connection','username','isNil','ticketType','sobject','OwnerId','IsReminderSet','IsRecurrence','Description','string','int','boolean','phone','remove','label','picklistValues','true','False','false','test','statusCode','getFields','stringify','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring'];(function(_0x49c957,_0x9fe6ef){var _0x3870f7=function(_0x391c6d){while(--_0x391c6d){_0x49c957['push'](_0x49c957['shift']());}};_0x3870f7(++_0x9fe6ef);}(_0xe6c3,0xdb));var _0x3e6c=function(_0x4b0bb7,_0x4909a0){_0x4b0bb7=_0x4b0bb7-0x0;var _0x20fc38=_0xe6c3[_0x4b0bb7];return _0x20fc38;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e6c('0x0'));var zipdir=require(_0x3e6c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3e6c('0x2'));var moment=require(_0x3e6c('0x3'));var BPromise=require(_0x3e6c('0x4'));var Mustache=require(_0x3e6c('0x5'));var util=require(_0x3e6c('0x6'));var path=require(_0x3e6c('0x7'));var sox=require(_0x3e6c('0x8'));var csv=require(_0x3e6c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e6c('0xa'));var _=require(_0x3e6c('0xb'));var squel=require(_0x3e6c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3e6c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3e6c('0xe'));var Papa=require(_0x3e6c('0xf'));var Redis=require(_0x3e6c('0x10'));var authService=require(_0x3e6c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3e6c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3e6c('0x13'));var utils=require(_0x3e6c('0x14'));var config=require(_0x3e6c('0x15'));var licenseUtil=require(_0x3e6c('0x16'));var db=require(_0x3e6c('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x442836,_0x2c289d){_0x2c289d=_0x2c289d||0xcc;return function(_0x11d8d1){if(_0x11d8d1){return _0x442836[_0x3e6c('0x18')](_0x2c289d);}return _0x442836[_0x3e6c('0x19')](_0x2c289d)['end']();};}function respondWithResult(_0xf4191a,_0x1225f9){_0x1225f9=_0x1225f9||0xc8;return function(_0x13a155){if(_0x13a155){return _0xf4191a['status'](_0x1225f9)[_0x3e6c('0x1a')](_0x13a155);}};}function respondWithFilteredResult(_0x54f7ad,_0x3bafad){return function(_0x3caa5b){if(_0x3caa5b){var _0x2541e2=typeof _0x3bafad[_0x3e6c('0x1b')]==='undefined'&&typeof _0x3bafad['limit']==='undefined';var _0x58a641=_0x3caa5b[_0x3e6c('0x1c')];var _0x13e7ea=_0x2541e2?0x0:_0x3bafad['offset'];var _0x5d4725=_0x2541e2?_0x3caa5b['count']:_0x3bafad[_0x3e6c('0x1b')]+_0x3bafad['limit'];var _0x478665;if(_0x5d4725>=_0x58a641){_0x5d4725=_0x58a641;_0x478665=0xc8;}else{_0x478665=0xce;}_0x54f7ad['status'](_0x478665);return _0x54f7ad[_0x3e6c('0x1d')](_0x3e6c('0x1e'),_0x13e7ea+'-'+_0x5d4725+'/'+_0x58a641)['json'](_0x3caa5b);}return null;};}function patchUpdates(_0x20df5a){return function(_0x5ac129){try{jsonpatch[_0x3e6c('0x1f')](_0x5ac129,_0x20df5a,!![]);}catch(_0x4639f1){return BPromise[_0x3e6c('0x20')](_0x4639f1);}return _0x5ac129[_0x3e6c('0x21')]();};}function saveUpdates(_0x1d5734,_0x566ea7){return function(_0x57586a){if(_0x57586a){return _0x57586a[_0x3e6c('0x22')](_0x1d5734)[_0x3e6c('0x23')](function(_0x240069){return _0x240069;});}return null;};}function removeEntity(_0x48adac,_0x54066e){return function(_0x23f3aa){if(_0x23f3aa){return _0x23f3aa[_0x3e6c('0x24')]()[_0x3e6c('0x23')](function(){_0x48adac[_0x3e6c('0x19')](0xcc)[_0x3e6c('0x25')]();});}};}function handleEntityNotFound(_0x1dc988,_0x1cdab6){return function(_0x442807){if(!_0x442807){_0x1dc988['sendStatus'](0x194);}return _0x442807;};}function handleError(_0x23d5b7,_0x2d879f){_0x2d879f=_0x2d879f||0x1f4;return function(_0x188309){logger[_0x3e6c('0x26')](_0x188309[_0x3e6c('0x27')]);if(_0x188309[_0x3e6c('0x28')]){delete _0x188309[_0x3e6c('0x28')];}_0x23d5b7[_0x3e6c('0x19')](_0x2d879f)[_0x3e6c('0x29')](_0x188309);};}exports[_0x3e6c('0x2a')]=function(_0x26d487,_0x64e071){var _0x67aad3={},_0x59bb1a={},_0x50130f={'count':0x0,'rows':[]};var _0x50d2f6=_[_0x3e6c('0x2b')](db[_0x3e6c('0x2c')][_0x3e6c('0x2d')],function(_0xb935a5){return{'name':_0xb935a5[_0x3e6c('0x2e')],'type':_0xb935a5[_0x3e6c('0x2f')][_0x3e6c('0x30')]};});_0x59bb1a[_0x3e6c('0x31')]=_['map'](_0x50d2f6,'name');_0x59bb1a['query']=_[_0x3e6c('0x32')](_0x26d487[_0x3e6c('0x33')]);_0x59bb1a[_0x3e6c('0x34')]=_[_0x3e6c('0x35')](_0x59bb1a[_0x3e6c('0x31')],_0x59bb1a[_0x3e6c('0x33')]);_0x67aad3['attributes']=_['intersection'](_0x59bb1a[_0x3e6c('0x31')],qs[_0x3e6c('0x36')](_0x26d487[_0x3e6c('0x33')][_0x3e6c('0x36')]));_0x67aad3[_0x3e6c('0x37')]=_0x67aad3[_0x3e6c('0x37')]['length']?_0x67aad3[_0x3e6c('0x37')]:_0x59bb1a[_0x3e6c('0x31')];if(!_0x26d487[_0x3e6c('0x33')]['hasOwnProperty'](_0x3e6c('0x38'))){_0x67aad3[_0x3e6c('0x39')]=qs[_0x3e6c('0x39')](_0x26d487[_0x3e6c('0x33')][_0x3e6c('0x39')]);_0x67aad3['offset']=qs[_0x3e6c('0x1b')](_0x26d487[_0x3e6c('0x33')][_0x3e6c('0x1b')]);}_0x67aad3[_0x3e6c('0x3a')]=qs[_0x3e6c('0x3b')](_0x26d487[_0x3e6c('0x33')][_0x3e6c('0x3b')]);_0x67aad3['where']=qs[_0x3e6c('0x34')](_[_0x3e6c('0x3c')](_0x26d487[_0x3e6c('0x33')],_0x59bb1a[_0x3e6c('0x34')]),_0x50d2f6);if(_0x26d487[_0x3e6c('0x33')][_0x3e6c('0x3d')]){_0x67aad3['where']=_['merge'](_0x67aad3[_0x3e6c('0x3e')],{'$or':_[_0x3e6c('0x2b')](_0x50d2f6,function(_0x770768){if(_0x770768[_0x3e6c('0x2f')]!=='VIRTUAL'){var _0x4c5964={};_0x4c5964[_0x770768[_0x3e6c('0x28')]]={'$like':'%'+_0x26d487[_0x3e6c('0x33')][_0x3e6c('0x3d')]+'%'};return _0x4c5964;}})});}_0x67aad3=_[_0x3e6c('0x3f')]({},_0x67aad3,_0x26d487['options']);var _0x2f7a19={'where':_0x67aad3[_0x3e6c('0x3e')]};return db['SalesforceAccount'][_0x3e6c('0x1c')](_0x2f7a19)[_0x3e6c('0x23')](function(_0x4cb534){_0x50130f['count']=_0x4cb534;if(_0x26d487['query']['includeAll']){_0x67aad3[_0x3e6c('0x40')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x3e6c('0x41')](_0x67aad3);})[_0x3e6c('0x23')](function(_0x559218){_0x50130f[_0x3e6c('0x42')]=_0x559218;return _0x50130f;})[_0x3e6c('0x23')](respondWithFilteredResult(_0x64e071,_0x67aad3))[_0x3e6c('0x43')](handleError(_0x64e071,null));};exports[_0x3e6c('0x44')]=function(_0x195be2,_0x1d5aa0){var _0x434c68={'raw':![],'where':{'id':_0x195be2[_0x3e6c('0x45')]['id']}},_0x354235={};_0x354235[_0x3e6c('0x31')]=_[_0x3e6c('0x32')](db[_0x3e6c('0x2c')][_0x3e6c('0x2d')]);_0x354235[_0x3e6c('0x33')]=_[_0x3e6c('0x32')](_0x195be2[_0x3e6c('0x33')]);_0x354235['filters']=_['intersection'](_0x354235[_0x3e6c('0x31')],_0x354235['query']);_0x434c68[_0x3e6c('0x37')]=_[_0x3e6c('0x35')](_0x354235[_0x3e6c('0x31')],qs[_0x3e6c('0x36')](_0x195be2[_0x3e6c('0x33')]['fields']));_0x434c68[_0x3e6c('0x37')]=_0x434c68[_0x3e6c('0x37')][_0x3e6c('0x46')]?_0x434c68['attributes']:_0x354235[_0x3e6c('0x31')];if(_0x195be2['query'][_0x3e6c('0x47')]){_0x434c68['include']=[{'all':!![]}];}_0x434c68=_[_0x3e6c('0x3f')]({},_0x434c68,_0x195be2['options']);return db[_0x3e6c('0x2c')][_0x3e6c('0x48')](_0x434c68)[_0x3e6c('0x23')](handleEntityNotFound(_0x1d5aa0,null))[_0x3e6c('0x23')](respondWithResult(_0x1d5aa0,null))[_0x3e6c('0x43')](handleError(_0x1d5aa0,null));};exports[_0x3e6c('0x49')]=function(_0x13dfaf,_0x3746b1){return db[_0x3e6c('0x2c')][_0x3e6c('0x49')](_0x13dfaf[_0x3e6c('0x4a')],{})[_0x3e6c('0x23')](respondWithResult(_0x3746b1,0xc9))['catch'](handleError(_0x3746b1,null));};exports['update']=function(_0x1f03ab,_0x587f6f){if(_0x1f03ab[_0x3e6c('0x4a')]['id']){delete _0x1f03ab['body']['id'];}return db[_0x3e6c('0x2c')][_0x3e6c('0x48')]({'where':{'id':_0x1f03ab[_0x3e6c('0x45')]['id']}})[_0x3e6c('0x23')](handleEntityNotFound(_0x587f6f,null))[_0x3e6c('0x23')](saveUpdates(_0x1f03ab[_0x3e6c('0x4a')],null))[_0x3e6c('0x23')](respondWithResult(_0x587f6f,null))[_0x3e6c('0x43')](handleError(_0x587f6f,null));};exports[_0x3e6c('0x24')]=function(_0x4f9a60,_0x3872da){return db[_0x3e6c('0x2c')][_0x3e6c('0x48')]({'where':{'id':_0x4f9a60[_0x3e6c('0x45')]['id']}})[_0x3e6c('0x23')](handleEntityNotFound(_0x3872da,null))[_0x3e6c('0x23')](removeEntity(_0x3872da,null))[_0x3e6c('0x43')](handleError(_0x3872da,null));};exports['getConfigurations']=function(_0x591557,_0x13c2cb,_0x39e9ae){var _0x5795b0={};var _0xc2c98e={};var _0x12a2ef;var _0x4d1c34;return db['SalesforceAccount'][_0x3e6c('0x4b')]({'where':{'id':_0x591557['params']['id']}})[_0x3e6c('0x23')](handleEntityNotFound(_0x13c2cb,null))[_0x3e6c('0x23')](function(_0x5c9768){if(_0x5c9768){_0x12a2ef=_0x5c9768;_0xc2c98e[_0x3e6c('0x31')]=_[_0x3e6c('0x32')](db[_0x3e6c('0x4c')][_0x3e6c('0x2d')]);_0xc2c98e[_0x3e6c('0x33')]=_['keys'](_0x591557['query']);_0xc2c98e[_0x3e6c('0x34')]=_[_0x3e6c('0x35')](_0xc2c98e[_0x3e6c('0x31')],_0xc2c98e[_0x3e6c('0x33')]);_0x5795b0[_0x3e6c('0x37')]=_['intersection'](_0xc2c98e[_0x3e6c('0x31')],qs[_0x3e6c('0x36')](_0x591557['query']['fields']));_0x5795b0[_0x3e6c('0x37')]=_0x5795b0['attributes'][_0x3e6c('0x46')]?_0x5795b0[_0x3e6c('0x37')]:_0xc2c98e[_0x3e6c('0x31')];_0x5795b0[_0x3e6c('0x3a')]=qs[_0x3e6c('0x3b')](_0x591557[_0x3e6c('0x33')][_0x3e6c('0x3b')]);_0x5795b0[_0x3e6c('0x3e')]=qs[_0x3e6c('0x34')](_[_0x3e6c('0x3c')](_0x591557[_0x3e6c('0x33')],_0xc2c98e[_0x3e6c('0x34')]));if(_0x591557[_0x3e6c('0x33')][_0x3e6c('0x3d')]){_0x5795b0[_0x3e6c('0x3e')]=_[_0x3e6c('0x3f')](_0x5795b0['where'],{'$or':_[_0x3e6c('0x2b')](_0x5795b0[_0x3e6c('0x37')],function(_0x2b36d5){var _0x77d95={};_0x77d95[_0x2b36d5]={'$like':'%'+_0x591557[_0x3e6c('0x33')][_0x3e6c('0x3d')]+'%'};return _0x77d95;})});}_0x5795b0=_['merge']({},_0x5795b0,_0x591557['options']);return _0x12a2ef['getConfigurations'](_0x5795b0);}})[_0x3e6c('0x23')](function(_0x3aa1f1){if(_0x3aa1f1){_0x4d1c34=_0x3aa1f1[_0x3e6c('0x46')];if(!_0x591557[_0x3e6c('0x33')][_0x3e6c('0x4d')]('nolimit')){_0x5795b0[_0x3e6c('0x39')]=qs[_0x3e6c('0x39')](_0x591557['query'][_0x3e6c('0x39')]);_0x5795b0[_0x3e6c('0x1b')]=qs['offset'](_0x591557[_0x3e6c('0x33')][_0x3e6c('0x1b')]);}return _0x12a2ef['getConfigurations'](_0x5795b0);}})['then'](function(_0x3cb837){if(_0x3cb837){return _0x3cb837?{'count':_0x4d1c34,'rows':_0x3cb837}:null;}})[_0x3e6c('0x23')](respondWithResult(_0x13c2cb,null))[_0x3e6c('0x43')](handleError(_0x13c2cb,null));};exports[_0x3e6c('0x4e')]=function(_0x27520c,_0x382715,_0x4cb8eb){if(_0x27520c[_0x3e6c('0x4a')]['id']){delete _0x27520c['body']['id'];}return db['SalesforceAccount'][_0x3e6c('0x4b')]({'where':{'id':_0x27520c['params']['id']}})[_0x3e6c('0x23')](handleEntityNotFound(_0x382715,null))[_0x3e6c('0x23')](function(_0x51be0b){if(_0x51be0b){_0x27520c[_0x3e6c('0x4a')][_0x3e6c('0x4f')]=_0x51be0b['id'];_0x27520c[_0x3e6c('0x4a')][_0x3e6c('0x50')]=integrations[_0x3e6c('0x51')](_0x27520c[_0x3e6c('0x4a')][_0x3e6c('0x52')],_0x27520c[_0x3e6c('0x4a')][_0x3e6c('0x2f')]);_0x27520c['body'][_0x3e6c('0x53')]=integrations[_0x3e6c('0x54')](_0x27520c[_0x3e6c('0x4a')]['channel'],_0x27520c[_0x3e6c('0x4a')][_0x3e6c('0x2f')]);return db[_0x3e6c('0x4c')][_0x3e6c('0x49')](_0x27520c['body'],{'include':[{'model':db[_0x3e6c('0x55')],'as':_0x3e6c('0x50')},{'model':db[_0x3e6c('0x55')],'as':_0x3e6c('0x53')}]});}return null;})[_0x3e6c('0x23')](respondWithResult(_0x382715,null))['catch'](handleError(_0x382715,null));};exports['getFields']=function(_0x285a54,_0xe8e86a,_0x2cc126){var _0x32cecc;var _0x5900ae='';var _0x1b3b0d=_0x3e6c('0x56');return db[_0x3e6c('0x2c')][_0x3e6c('0x4b')]({'where':{'id':_0x285a54['params']['id']},'attributes':['id',_0x3e6c('0x57'),_0x3e6c('0x58'),_0x3e6c('0x59'),'username',_0x3e6c('0x5a'),_0x3e6c('0x5b')]})[_0x3e6c('0x23')](handleEntityNotFound(_0xe8e86a,null))[_0x3e6c('0x23')](function(_0x55bb36){if(_0x55bb36){_0x5900ae=_0x55bb36[_0x3e6c('0x57')];var _0x45094b=_0x5900ae[_0x3e6c('0x5c')](-0x1);if(_0x45094b==='/'){_0x5900ae=_0x5900ae[_0x3e6c('0x5d')](0x0,_0x5900ae['lastIndexOf'](_0x45094b));}_0x32cecc=new jsforce[(_0x3e6c('0x5e'))]({'oauth2':{'loginUrl':_0x5900ae,'clientId':_0x55bb36[_0x3e6c('0x58')],'clientSecret':_0x55bb36[_0x3e6c('0x59')]}});return _0x32cecc['login'](_0x55bb36[_0x3e6c('0x5f')],_0x55bb36['password']['concat'](_0x55bb36[_0x3e6c('0x5b')]));}})[_0x3e6c('0x23')](function(_0x474491){if(_0x474491){if(!_[_0x3e6c('0x60')](_0x285a54[_0x3e6c('0x33')][_0x3e6c('0x61')])){_0x1b3b0d=_0x285a54[_0x3e6c('0x33')][_0x3e6c('0x61')];}return _0x32cecc[_0x3e6c('0x62')](_0x1b3b0d)['describe']();}})[_0x3e6c('0x23')](function(_0x45d7e6){var _0x27b28e=[_0x3e6c('0x63'),'ActivityDate',_0x3e6c('0x64'),_0x3e6c('0x65'),'Subject',_0x3e6c('0x66')];var _0x251cc2=[_0x3e6c('0x67'),_0x3e6c('0x68'),'picklist',_0x3e6c('0x69'),'email','textarea',_0x3e6c('0x6a')];if(_0x45d7e6){_[_0x3e6c('0x6b')](_0x45d7e6['fields'],function(_0x38479e){return _0x27b28e['includes'](_0x38479e[_0x3e6c('0x28')])||!_0x251cc2['includes'](_0x38479e[_0x3e6c('0x2f')]);});return{'count':_0x45d7e6[_0x3e6c('0x36')][_0x3e6c('0x46')],'rows':_['map'](_0x45d7e6['fields'],function(_0x525f90){return{'id':_0x525f90[_0x3e6c('0x28')],'name':_0x525f90[_0x3e6c('0x6c')],'custom':_0x525f90['custom'],'options':_0x525f90[_0x3e6c('0x6d')][_0x3e6c('0x46')]>0x0?_['map'](_0x525f90[_0x3e6c('0x6d')],function(_0x21afbe){return{'name':_0x21afbe[_0x3e6c('0x6c')],'value':_0x21afbe['value']};}):_0x525f90[_0x3e6c('0x2f')]=='boolean'?[{'name':'True','value':_0x3e6c('0x6e')},{'name':_0x3e6c('0x6f'),'value':_0x3e6c('0x70')}]:[]};})};}})['then'](respondWithResult(_0xe8e86a,null))[_0x3e6c('0x43')](function(_0x763af){var _0x65f6c4=_0x285a54['query'][_0x3e6c('0x71')]?0x1f4:_0x763af[_0x3e6c('0x72')]||0x1f4;logger[_0x3e6c('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x3e6c('0x73'),_0x65f6c4,JSON[_0x3e6c('0x74')](_0x763af));delete _0x763af[_0x3e6c('0x28')];if(_0x65f6c4===0x191){_0x65f6c4=0x190;}_0xe8e86a['status'](_0x65f6c4)[_0x3e6c('0x29')](_0x285a54[_0x3e6c('0x33')][_0x3e6c('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x763af['statusCode']}:_0x763af);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 6836a30..a642460 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 _0x0834=['SalesforceAccount','int_salesforce_accounts','../../config/logger','api','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','define'];(function(_0x296635,_0x344cef){var _0x3e84d7=function(_0x125e9e){while(--_0x125e9e){_0x296635['push'](_0x296635['shift']());}};_0x3e84d7(++_0x344cef);}(_0x0834,0x18e));var _0x4083=function(_0x4fa37e,_0x55003c){_0x4fa37e=_0x4fa37e-0x0;var _0x231225=_0x0834[_0x4fa37e];return _0x231225;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4083('0x0'))(_0x4083('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4083('0x2'));var rimraf=require(_0x4083('0x3'));var config=require('../../config/environment');var attributes=require(_0x4083('0x4'));var integrations=require(_0x4083('0x5'));module['exports']=function(_0x3bf635,_0x5c5a54){return _0x3bf635[_0x4083('0x6')](_0x4083('0x7'),attributes,{'tableName':_0x4083('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb37d=['exports','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','bluebird','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration'];(function(_0x16337a,_0x4789a1){var _0x422365=function(_0x34f039){while(--_0x34f039){_0x16337a['push'](_0x16337a['shift']());}};_0x422365(++_0x4789a1);}(_0xb37d,0xbe));var _0xdb37=function(_0x2dcdc1,_0x80fa86){_0x2dcdc1=_0x2dcdc1-0x0;var _0x312e06=_0xb37d[_0x2dcdc1];return _0x312e06;};'use strict';var _=require(_0xdb37('0x0'));var util=require(_0xdb37('0x1'));var logger=require(_0xdb37('0x2'))(_0xdb37('0x3'));var moment=require('moment');var BPromise=require(_0xdb37('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdb37('0x5'));var config=require('../../config/environment');var attributes=require(_0xdb37('0x6'));var integrations=require(_0xdb37('0x7'));module[_0xdb37('0x8')]=function(_0x539a5c,_0x96ed40){return _0x539a5c['define'](_0xdb37('0x9'),attributes,{'tableName':_0xdb37('0xa'),'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 5ad0fb3..8d9b727 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 _0x6d13=['map','model','find','ShowSalesforceAccount','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','raw','options','where','attributes','limit','include'];(function(_0x3efe87,_0x35ad48){var _0x56a4cc=function(_0x47869e){while(--_0x47869e){_0x3efe87['push'](_0x3efe87['shift']());}};_0x56a4cc(++_0x35ad48);}(_0x6d13,0xd0));var _0x36d1=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0x6d13[_0x56f7e2];return _0x36240b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x36d1('0x0'));var BPromise=require(_0x36d1('0x1'));var rs=require(_0x36d1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x36d1('0x3'));var logger=require('../../config/logger')(_0x36d1('0x4'));var config=require(_0x36d1('0x5'));var jayson=require(_0x36d1('0x6'));var client=jayson['client'][_0x36d1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2492b3,_0x1d89df,_0x4e5c7e){return new BPromise(function(_0x378d96,_0x41b870){return client[_0x36d1('0x8')](_0x2492b3,_0x4e5c7e)[_0x36d1('0x9')](function(_0x2cc455){logger[_0x36d1('0xa')](_0x36d1('0xb'),_0x1d89df,'request\x20sent');logger[_0x36d1('0xc')](_0x36d1('0xd'),_0x1d89df,_0x36d1('0xe'),JSON[_0x36d1('0xf')](_0x2cc455));if(_0x2cc455['error']){if(_0x2cc455['error'][_0x36d1('0x10')]===0x1f4){logger[_0x36d1('0x11')](_0x36d1('0xb'),_0x1d89df,_0x2cc455[_0x36d1('0x11')][_0x36d1('0x12')]);return _0x41b870(_0x2cc455[_0x36d1('0x11')][_0x36d1('0x12')]);}logger[_0x36d1('0x11')](_0x36d1('0xb'),_0x1d89df,_0x2cc455[_0x36d1('0x11')]['message']);return _0x378d96(_0x2cc455[_0x36d1('0x11')][_0x36d1('0x12')]);}else{logger[_0x36d1('0xa')](_0x36d1('0xb'),_0x1d89df,'request\x20sent');_0x378d96(_0x2cc455[_0x36d1('0x13')]['message']);}})[_0x36d1('0x14')](function(_0x504ea5){logger[_0x36d1('0x11')](_0x36d1('0xb'),_0x1d89df,_0x504ea5);_0x41b870(_0x504ea5);});});}exports[_0x36d1('0x15')]=function(_0x4d355a){var _0x450a4e=this;return new Promise(function(_0x3031d8,_0x571e80){return db[_0x36d1('0x16')][_0x36d1('0x17')]({'raw':_0x4d355a['options']?_0x4d355a['options'][_0x36d1('0x18')]===undefined?!![]:![]:!![],'where':_0x4d355a[_0x36d1('0x19')]?_0x4d355a[_0x36d1('0x19')][_0x36d1('0x1a')]||null:null,'attributes':_0x4d355a['options']?_0x4d355a[_0x36d1('0x19')][_0x36d1('0x1b')]||null:null,'limit':_0x4d355a[_0x36d1('0x19')]?_0x4d355a[_0x36d1('0x19')][_0x36d1('0x1c')]||null:null,'include':_0x4d355a['options']?_0x4d355a[_0x36d1('0x19')][_0x36d1('0x1d')]?_[_0x36d1('0x1e')](_0x4d355a[_0x36d1('0x19')][_0x36d1('0x1d')],function(_0x1b0e1e){return{'model':db[_0x1b0e1e[_0x36d1('0x1f')]],'as':_0x1b0e1e['as'],'attributes':_0x1b0e1e['attributes'],'include':_0x1b0e1e[_0x36d1('0x1d')]?_[_0x36d1('0x1e')](_0x1b0e1e[_0x36d1('0x1d')],function(_0x14544e){return{'model':db[_0x14544e[_0x36d1('0x1f')]],'as':_0x14544e['as'],'attributes':_0x14544e[_0x36d1('0x1b')],'include':_0x14544e['include']?_[_0x36d1('0x1e')](_0x14544e[_0x36d1('0x1d')],function(_0x9f48d4){return{'model':db[_0x9f48d4[_0x36d1('0x1f')]],'as':_0x9f48d4['as'],'attributes':_0x9f48d4[_0x36d1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x36d1('0x9')](function(_0x4a2f97){logger[_0x36d1('0xa')](_0x36d1('0x15'),_0x4d355a);logger[_0x36d1('0xc')](_0x36d1('0x15'),_0x4d355a,JSON[_0x36d1('0xf')](_0x4a2f97));_0x3031d8(_0x4a2f97);})['catch'](function(_0x142ef3){logger['error'](_0x36d1('0x15'),_0x142ef3[_0x36d1('0x12')],_0x4d355a);_0x571e80(_0x450a4e[_0x36d1('0x11')](0x1f4,_0x142ef3[_0x36d1('0x12')]));});});};exports['ShowSalesforceAccount']=function(_0xd48f8f){var _0x91e185=this;return new Promise(function(_0x2a0276,_0x248cc1){return db[_0x36d1('0x16')][_0x36d1('0x20')]({'raw':_0xd48f8f[_0x36d1('0x19')]?_0xd48f8f[_0x36d1('0x19')][_0x36d1('0x18')]===undefined?!![]:![]:!![],'where':_0xd48f8f[_0x36d1('0x19')]?_0xd48f8f[_0x36d1('0x19')][_0x36d1('0x1a')]||null:null,'attributes':_0xd48f8f[_0x36d1('0x19')]?_0xd48f8f['options'][_0x36d1('0x1b')]||null:null,'include':_0xd48f8f[_0x36d1('0x19')]?_0xd48f8f[_0x36d1('0x19')][_0x36d1('0x1d')]?_['map'](_0xd48f8f[_0x36d1('0x19')][_0x36d1('0x1d')],function(_0x4542da){return{'model':db[_0x4542da[_0x36d1('0x1f')]],'as':_0x4542da['as'],'attributes':_0x4542da[_0x36d1('0x1b')],'include':_0x4542da['include']?_[_0x36d1('0x1e')](_0x4542da[_0x36d1('0x1d')],function(_0x5b137b){return{'model':db[_0x5b137b[_0x36d1('0x1f')]],'as':_0x5b137b['as'],'attributes':_0x5b137b['attributes'],'include':_0x5b137b[_0x36d1('0x1d')]?_[_0x36d1('0x1e')](_0x5b137b[_0x36d1('0x1d')],function(_0x36490d){return{'model':db[_0x36490d[_0x36d1('0x1f')]],'as':_0x36490d['as'],'attributes':_0x36490d[_0x36d1('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f5f3b){logger['info'](_0x36d1('0x21'),_0xd48f8f);logger[_0x36d1('0xc')](_0x36d1('0x21'),_0xd48f8f,JSON[_0x36d1('0xf')](_0x3f5f3b));_0x2a0276(_0x3f5f3b);})[_0x36d1('0x14')](function(_0x511700){logger[_0x36d1('0x11')](_0x36d1('0x21'),_0x511700[_0x36d1('0x12')],_0xd48f8f);_0x248cc1(_0x91e185[_0x36d1('0x11')](0x1f4,_0x511700[_0x36d1('0x12')]));});});}; \ No newline at end of file +var _0x275c=['model','map','then','ShowSalesforceAccount','find','where','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','attributes','limit','include'];(function(_0x384b3a,_0x290ab4){var _0x5b9193=function(_0x30ec41){while(--_0x30ec41){_0x384b3a['push'](_0x384b3a['shift']());}};_0x5b9193(++_0x290ab4);}(_0x275c,0x70));var _0xc275=function(_0x45cf6c,_0x53c38b){_0x45cf6c=_0x45cf6c-0x0;var _0x11cff1=_0x275c[_0x45cf6c];return _0x11cff1;};'use strict';var _=require(_0xc275('0x0'));var util=require(_0xc275('0x1'));var moment=require(_0xc275('0x2'));var BPromise=require(_0xc275('0x3'));var rs=require(_0xc275('0x4'));var fs=require('fs');var Redis=require(_0xc275('0x5'));var db=require(_0xc275('0x6'))['db'];var utils=require(_0xc275('0x7'));var logger=require(_0xc275('0x8'))('rpc');var config=require(_0xc275('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc275('0xa')][_0xc275('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4cc29b,_0x25a21e,_0x91ff9d){return new BPromise(function(_0x16a30f,_0x558eb5){return client['request'](_0x4cc29b,_0x91ff9d)['then'](function(_0x604bea){logger[_0xc275('0xc')](_0xc275('0xd'),_0x25a21e,_0xc275('0xe'));logger[_0xc275('0xf')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x25a21e,_0xc275('0xe'),JSON[_0xc275('0x10')](_0x604bea));if(_0x604bea['error']){if(_0x604bea[_0xc275('0x11')][_0xc275('0x12')]===0x1f4){logger[_0xc275('0x11')](_0xc275('0xd'),_0x25a21e,_0x604bea['error'][_0xc275('0x13')]);return _0x558eb5(_0x604bea['error']['message']);}logger[_0xc275('0x11')](_0xc275('0xd'),_0x25a21e,_0x604bea[_0xc275('0x11')][_0xc275('0x13')]);return _0x16a30f(_0x604bea[_0xc275('0x11')][_0xc275('0x13')]);}else{logger['info'](_0xc275('0xd'),_0x25a21e,'request\x20sent');_0x16a30f(_0x604bea['result'][_0xc275('0x13')]);}})['catch'](function(_0x1e856a){logger[_0xc275('0x11')](_0xc275('0xd'),_0x25a21e,_0x1e856a);_0x558eb5(_0x1e856a);});});}exports[_0xc275('0x14')]=function(_0x58275c){var _0x49726f=this;return new Promise(function(_0x2cf9ac,_0x487e96){return db[_0xc275('0x15')][_0xc275('0x16')]({'raw':_0x58275c[_0xc275('0x17')]?_0x58275c[_0xc275('0x17')][_0xc275('0x18')]===undefined?!![]:![]:!![],'where':_0x58275c[_0xc275('0x17')]?_0x58275c['options']['where']||null:null,'attributes':_0x58275c['options']?_0x58275c[_0xc275('0x17')][_0xc275('0x19')]||null:null,'limit':_0x58275c[_0xc275('0x17')]?_0x58275c['options'][_0xc275('0x1a')]||null:null,'include':_0x58275c[_0xc275('0x17')]?_0x58275c[_0xc275('0x17')]['include']?_['map'](_0x58275c[_0xc275('0x17')][_0xc275('0x1b')],function(_0x25b835){return{'model':db[_0x25b835['model']],'as':_0x25b835['as'],'attributes':_0x25b835[_0xc275('0x19')],'include':_0x25b835['include']?_['map'](_0x25b835[_0xc275('0x1b')],function(_0x54e64a){return{'model':db[_0x54e64a[_0xc275('0x1c')]],'as':_0x54e64a['as'],'attributes':_0x54e64a[_0xc275('0x19')],'include':_0x54e64a[_0xc275('0x1b')]?_[_0xc275('0x1d')](_0x54e64a[_0xc275('0x1b')],function(_0x1fb3f0){return{'model':db[_0x1fb3f0[_0xc275('0x1c')]],'as':_0x1fb3f0['as'],'attributes':_0x1fb3f0[_0xc275('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc275('0x1e')](function(_0x5f2b74){logger['info'](_0xc275('0x14'),_0x58275c);logger[_0xc275('0xf')](_0xc275('0x14'),_0x58275c,JSON['stringify'](_0x5f2b74));_0x2cf9ac(_0x5f2b74);})['catch'](function(_0x46a594){logger[_0xc275('0x11')](_0xc275('0x14'),_0x46a594[_0xc275('0x13')],_0x58275c);_0x487e96(_0x49726f[_0xc275('0x11')](0x1f4,_0x46a594[_0xc275('0x13')]));});});};exports[_0xc275('0x1f')]=function(_0x239240){var _0x337bb2=this;return new Promise(function(_0x3db2b3,_0x2784d4){return db[_0xc275('0x15')][_0xc275('0x20')]({'raw':_0x239240[_0xc275('0x17')]?_0x239240[_0xc275('0x17')][_0xc275('0x18')]===undefined?!![]:![]:!![],'where':_0x239240[_0xc275('0x17')]?_0x239240[_0xc275('0x17')][_0xc275('0x21')]||null:null,'attributes':_0x239240[_0xc275('0x17')]?_0x239240[_0xc275('0x17')][_0xc275('0x19')]||null:null,'include':_0x239240[_0xc275('0x17')]?_0x239240[_0xc275('0x17')]['include']?_[_0xc275('0x1d')](_0x239240[_0xc275('0x17')][_0xc275('0x1b')],function(_0x2f87c6){return{'model':db[_0x2f87c6[_0xc275('0x1c')]],'as':_0x2f87c6['as'],'attributes':_0x2f87c6['attributes'],'include':_0x2f87c6['include']?_[_0xc275('0x1d')](_0x2f87c6[_0xc275('0x1b')],function(_0x83be94){return{'model':db[_0x83be94[_0xc275('0x1c')]],'as':_0x83be94['as'],'attributes':_0x83be94[_0xc275('0x19')],'include':_0x83be94['include']?_[_0xc275('0x1d')](_0x83be94['include'],function(_0x1dd28b){return{'model':db[_0x1dd28b['model']],'as':_0x1dd28b['as'],'attributes':_0x1dd28b['attributes']};}):[]};}):[]};}):[]:[]})[_0xc275('0x1e')](function(_0x41270d){logger[_0xc275('0xc')](_0xc275('0x1f'),_0x239240);logger[_0xc275('0xf')](_0xc275('0x1f'),_0x239240,JSON[_0xc275('0x10')](_0x41270d));_0x3db2b3(_0x41270d);})[_0xc275('0x22')](function(_0x56233d){logger[_0xc275('0x11')](_0xc275('0x1f'),_0x56233d[_0xc275('0x13')],_0x239240);_0x2784d4(_0x337bb2[_0xc275('0x11')](0x1f4,_0x56233d[_0xc275('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index a3ab47f..65e033c 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xdb28,0x106));var _0x8db2=function(_0x2005a2,_0x3d9eb0){_0x2005a2=_0x2005a2-0x0;var _0xe83eeb=_0xdb28[_0x2005a2];return _0xe83eeb;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _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(_0xe8129c,_0x2fb03c){var _0x709fc5=function(_0xb8e0c6){while(--_0xb8e0c6){_0xe8129c['push'](_0xe8129c['shift']());}};_0x709fc5(++_0x2fb03c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5a19fc,_0x58f9f4){_0x5a19fc=_0x5a19fc-0x0;var _0x34b413=_0x0b0e[_0x5a19fc];return _0x34b413;};'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 diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index f4c087e..05c3a60 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 _0xfd83=['contact','account_contact_lead','account','nothing','sequelize','STRING','ENUM','Task','Case','contact_lead'];(function(_0x5a44d4,_0x576386){var _0x1f9465=function(_0x30dfa7){while(--_0x30dfa7){_0x5a44d4['push'](_0x5a44d4['shift']());}};_0x1f9465(++_0x576386);}(_0xfd83,0xe0));var _0x3fd8=function(_0x75c3eb,_0x271b5a){_0x75c3eb=_0x75c3eb-0x0;var _0x6e6585=_0xfd83[_0x75c3eb];return _0x6e6585;};'use strict';var Sequelize=require(_0x3fd8('0x0'));module['exports']={'name':{'type':Sequelize[_0x3fd8('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x3fd8('0x2')](_0x3fd8('0x3'),_0x3fd8('0x4')),'defaultValue':_0x3fd8('0x3')},'moduleSearch':{'type':Sequelize[_0x3fd8('0x2')](_0x3fd8('0x5'),_0x3fd8('0x6'),'lead',_0x3fd8('0x7'),_0x3fd8('0x8')),'defaultValue':_0x3fd8('0x5')},'moduleCreate':{'type':Sequelize[_0x3fd8('0x2')](_0x3fd8('0x9'),'contact','lead',_0x3fd8('0x8')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x3fd8('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x3fd8('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x3fd8('0x1')]}}; \ No newline at end of file +var _0x9e59=['account','nothing','exports','STRING','ENUM','Task','Case','contact_lead','contact','lead','account_contact_lead'];(function(_0x2f95e8,_0x20b171){var _0x237b19=function(_0x82eb43){while(--_0x82eb43){_0x2f95e8['push'](_0x2f95e8['shift']());}};_0x237b19(++_0x20b171);}(_0x9e59,0x1c5));var _0x99e5=function(_0xe62071,_0x2c7be6){_0xe62071=_0xe62071-0x0;var _0x9db9ef=_0x9e59[_0xe62071];return _0x9db9ef;};'use strict';var Sequelize=require('sequelize');module[_0x99e5('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x99e5('0x1')]},'ticketType':{'type':Sequelize[_0x99e5('0x2')](_0x99e5('0x3'),_0x99e5('0x4')),'defaultValue':_0x99e5('0x3')},'moduleSearch':{'type':Sequelize[_0x99e5('0x2')](_0x99e5('0x5'),_0x99e5('0x6'),_0x99e5('0x7'),_0x99e5('0x8'),_0x99e5('0x9')),'defaultValue':_0x99e5('0x5')},'moduleCreate':{'type':Sequelize[_0x99e5('0x2')](_0x99e5('0xa'),_0x99e5('0x6'),_0x99e5('0x7'),'account'),'defaultValue':_0x99e5('0x7')},'leadId':{'type':Sequelize[_0x99e5('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x99e5('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x99e5('0x1')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 25c265b..39eae99 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 _0xdbbc=['attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','include','rows','show','params','keys','includeAll','options','find','catch','create','body','destroy','findOne','SalesforceField','pick','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','filters'];(function(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0xdbbc,0x19d));var _0xcdbb=function(_0x52b844,_0x434e67){_0x52b844=_0x52b844-0x0;var _0x14432f=_0xdbbc[_0x52b844];return _0x14432f;};'use strict';var emlformat=require(_0xcdbb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcdbb('0x1'));var rp=require(_0xcdbb('0x2'));var moment=require(_0xcdbb('0x3'));var BPromise=require(_0xcdbb('0x4'));var Mustache=require(_0xcdbb('0x5'));var util=require(_0xcdbb('0x6'));var path=require(_0xcdbb('0x7'));var sox=require(_0xcdbb('0x8'));var csv=require(_0xcdbb('0x9'));var ejs=require(_0xcdbb('0xa'));var fs=require('fs');var fs_extra=require(_0xcdbb('0xb'));var _=require(_0xcdbb('0xc'));var squel=require('squel');var crypto=require(_0xcdbb('0xd'));var jsforce=require(_0xcdbb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcdbb('0x9'));var querystring=require(_0xcdbb('0xf'));var Papa=require(_0xcdbb('0x10'));var Redis=require(_0xcdbb('0x11'));var authService=require(_0xcdbb('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcdbb('0x13'));var utils=require(_0xcdbb('0x14'));var config=require(_0xcdbb('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xcdbb('0x16'))['db'];function respondWithStatusCode(_0x52da75,_0x10ef68){_0x10ef68=_0x10ef68||0xcc;return function(_0x46670e){if(_0x46670e){return _0x52da75[_0xcdbb('0x17')](_0x10ef68);}return _0x52da75[_0xcdbb('0x18')](_0x10ef68)[_0xcdbb('0x19')]();};}function respondWithResult(_0x37fd72,_0x2d2acf){_0x2d2acf=_0x2d2acf||0xc8;return function(_0x4db6ce){if(_0x4db6ce){return _0x37fd72['status'](_0x2d2acf)[_0xcdbb('0x1a')](_0x4db6ce);}};}function respondWithFilteredResult(_0x209a18,_0x3135e1){return function(_0x330a25){if(_0x330a25){var _0x20639d=typeof _0x3135e1[_0xcdbb('0x1b')]==='undefined'&&typeof _0x3135e1[_0xcdbb('0x1c')]===_0xcdbb('0x1d');var _0x5ef0be=_0x330a25[_0xcdbb('0x1e')];var _0x576487=_0x20639d?0x0:_0x3135e1['offset'];var _0x4d5080=_0x20639d?_0x330a25[_0xcdbb('0x1e')]:_0x3135e1['offset']+_0x3135e1[_0xcdbb('0x1c')];var _0x5e7704;if(_0x4d5080>=_0x5ef0be){_0x4d5080=_0x5ef0be;_0x5e7704=0xc8;}else{_0x5e7704=0xce;}_0x209a18['status'](_0x5e7704);return _0x209a18[_0xcdbb('0x1f')](_0xcdbb('0x20'),_0x576487+'-'+_0x4d5080+'/'+_0x5ef0be)[_0xcdbb('0x1a')](_0x330a25);}return null;};}function patchUpdates(_0x405f41){return function(_0x3f325d){try{jsonpatch[_0xcdbb('0x21')](_0x3f325d,_0x405f41,!![]);}catch(_0x1991f9){return BPromise[_0xcdbb('0x22')](_0x1991f9);}return _0x3f325d['save']();};}function saveUpdates(_0x2181b4,_0xacbbee){return function(_0x3952d0){if(_0x3952d0){return _0x3952d0[_0xcdbb('0x23')](_0x2181b4)[_0xcdbb('0x24')](function(_0x33f8f6){return _0x33f8f6;});}return null;};}function removeEntity(_0x3c3213,_0x4912e1){return function(_0x261722){if(_0x261722){return _0x261722['destroy']()[_0xcdbb('0x24')](function(){_0x3c3213['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc3b018,_0x32164f){return function(_0x1b9543){if(!_0x1b9543){_0xc3b018['sendStatus'](0x194);}return _0x1b9543;};}function handleError(_0x2c0b2c,_0x28468f){_0x28468f=_0x28468f||0x1f4;return function(_0x40e4b6){logger['error'](_0x40e4b6['stack']);if(_0x40e4b6[_0xcdbb('0x25')]){delete _0x40e4b6[_0xcdbb('0x25')];}_0x2c0b2c[_0xcdbb('0x18')](_0x28468f)[_0xcdbb('0x26')](_0x40e4b6);};}exports[_0xcdbb('0x27')]=function(_0x1d4835,_0x3fd1c1){var _0x20bd13={},_0x5bed91={},_0x3c4008={'count':0x0,'rows':[]};var _0x2db8ba=_[_0xcdbb('0x28')](db[_0xcdbb('0x29')][_0xcdbb('0x2a')],function(_0x1edba7){return{'name':_0x1edba7[_0xcdbb('0x2b')],'type':_0x1edba7[_0xcdbb('0x2c')][_0xcdbb('0x2d')]};});_0x5bed91[_0xcdbb('0x2e')]=_[_0xcdbb('0x28')](_0x2db8ba,_0xcdbb('0x25'));_0x5bed91[_0xcdbb('0x2f')]=_['keys'](_0x1d4835[_0xcdbb('0x2f')]);_0x5bed91[_0xcdbb('0x30')]=_['intersection'](_0x5bed91[_0xcdbb('0x2e')],_0x5bed91['query']);_0x20bd13[_0xcdbb('0x31')]=_[_0xcdbb('0x32')](_0x5bed91[_0xcdbb('0x2e')],qs[_0xcdbb('0x33')](_0x1d4835[_0xcdbb('0x2f')]['fields']));_0x20bd13['attributes']=_0x20bd13[_0xcdbb('0x31')][_0xcdbb('0x34')]?_0x20bd13['attributes']:_0x5bed91['model'];if(!_0x1d4835[_0xcdbb('0x2f')][_0xcdbb('0x35')](_0xcdbb('0x36'))){_0x20bd13[_0xcdbb('0x1c')]=qs['limit'](_0x1d4835[_0xcdbb('0x2f')][_0xcdbb('0x1c')]);_0x20bd13[_0xcdbb('0x1b')]=qs[_0xcdbb('0x1b')](_0x1d4835[_0xcdbb('0x2f')][_0xcdbb('0x1b')]);}_0x20bd13[_0xcdbb('0x37')]=qs[_0xcdbb('0x38')](_0x1d4835[_0xcdbb('0x2f')][_0xcdbb('0x38')]);_0x20bd13[_0xcdbb('0x39')]=qs[_0xcdbb('0x30')](_['pick'](_0x1d4835[_0xcdbb('0x2f')],_0x5bed91[_0xcdbb('0x30')]),_0x2db8ba);if(_0x1d4835[_0xcdbb('0x2f')][_0xcdbb('0x3a')]){_0x20bd13[_0xcdbb('0x39')]=_[_0xcdbb('0x3b')](_0x20bd13[_0xcdbb('0x39')],{'$or':_[_0xcdbb('0x28')](_0x2db8ba,function(_0x196650){if(_0x196650['type']!=='VIRTUAL'){var _0xb4ef6f={};_0xb4ef6f[_0x196650['name']]={'$like':'%'+_0x1d4835[_0xcdbb('0x2f')][_0xcdbb('0x3a')]+'%'};return _0xb4ef6f;}})});}_0x20bd13=_['merge']({},_0x20bd13,_0x1d4835['options']);var _0x121c39={'where':_0x20bd13[_0xcdbb('0x39')]};return db[_0xcdbb('0x29')][_0xcdbb('0x1e')](_0x121c39)[_0xcdbb('0x24')](function(_0x20da16){_0x3c4008[_0xcdbb('0x1e')]=_0x20da16;if(_0x1d4835[_0xcdbb('0x2f')]['includeAll']){_0x20bd13[_0xcdbb('0x3c')]=[{'all':!![]}];}return db[_0xcdbb('0x29')]['findAll'](_0x20bd13);})[_0xcdbb('0x24')](function(_0x4693dc){_0x3c4008[_0xcdbb('0x3d')]=_0x4693dc;return _0x3c4008;})[_0xcdbb('0x24')](respondWithFilteredResult(_0x3fd1c1,_0x20bd13))['catch'](handleError(_0x3fd1c1,null));};exports[_0xcdbb('0x3e')]=function(_0x139751,_0x2ff497){var _0x3c8c79={'raw':![],'where':{'id':_0x139751[_0xcdbb('0x3f')]['id']}},_0x4e9400={};_0x4e9400[_0xcdbb('0x2e')]=_[_0xcdbb('0x40')](db[_0xcdbb('0x29')][_0xcdbb('0x2a')]);_0x4e9400[_0xcdbb('0x2f')]=_['keys'](_0x139751['query']);_0x4e9400[_0xcdbb('0x30')]=_[_0xcdbb('0x32')](_0x4e9400[_0xcdbb('0x2e')],_0x4e9400['query']);_0x3c8c79[_0xcdbb('0x31')]=_[_0xcdbb('0x32')](_0x4e9400[_0xcdbb('0x2e')],qs[_0xcdbb('0x33')](_0x139751[_0xcdbb('0x2f')][_0xcdbb('0x33')]));_0x3c8c79[_0xcdbb('0x31')]=_0x3c8c79[_0xcdbb('0x31')][_0xcdbb('0x34')]?_0x3c8c79[_0xcdbb('0x31')]:_0x4e9400[_0xcdbb('0x2e')];if(_0x139751[_0xcdbb('0x2f')][_0xcdbb('0x41')]){_0x3c8c79[_0xcdbb('0x3c')]=[{'all':!![]}];}_0x3c8c79=_[_0xcdbb('0x3b')]({},_0x3c8c79,_0x139751[_0xcdbb('0x42')]);return db[_0xcdbb('0x29')][_0xcdbb('0x43')](_0x3c8c79)[_0xcdbb('0x24')](handleEntityNotFound(_0x2ff497,null))[_0xcdbb('0x24')](respondWithResult(_0x2ff497,null))[_0xcdbb('0x44')](handleError(_0x2ff497,null));};exports['create']=function(_0x5d35f4,_0x504009){return db[_0xcdbb('0x29')][_0xcdbb('0x45')](_0x5d35f4['body'],{})[_0xcdbb('0x24')](respondWithResult(_0x504009,0xc9))[_0xcdbb('0x44')](handleError(_0x504009,null));};exports[_0xcdbb('0x23')]=function(_0x3def8f,_0x1e0c27){if(_0x3def8f[_0xcdbb('0x46')]['id']){delete _0x3def8f[_0xcdbb('0x46')]['id'];}return db[_0xcdbb('0x29')][_0xcdbb('0x43')]({'where':{'id':_0x3def8f['params']['id']}})['then'](handleEntityNotFound(_0x1e0c27,null))['then'](saveUpdates(_0x3def8f['body'],null))['then'](respondWithResult(_0x1e0c27,null))[_0xcdbb('0x44')](handleError(_0x1e0c27,null));};exports[_0xcdbb('0x47')]=function(_0x5131bc,_0x1e4945){return db['SalesforceConfiguration']['find']({'where':{'id':_0x5131bc[_0xcdbb('0x3f')]['id']}})[_0xcdbb('0x24')](handleEntityNotFound(_0x1e4945,null))[_0xcdbb('0x24')](removeEntity(_0x1e4945,null))['catch'](handleError(_0x1e4945,null));};exports['getFields']=function(_0x1b5941,_0x4b3c9d,_0x15564f){var _0x148e3b={};var _0x13f8e5={};var _0x3d1c65;var _0x17eb96;return db[_0xcdbb('0x29')][_0xcdbb('0x48')]({'where':{'id':_0x1b5941[_0xcdbb('0x3f')]['id']}})[_0xcdbb('0x24')](handleEntityNotFound(_0x4b3c9d,null))[_0xcdbb('0x24')](function(_0x4ec097){if(_0x4ec097){_0x3d1c65=_0x4ec097;_0x13f8e5['model']=_[_0xcdbb('0x40')](db[_0xcdbb('0x49')]['rawAttributes']);_0x13f8e5['query']=_[_0xcdbb('0x40')](_0x1b5941[_0xcdbb('0x2f')]);_0x13f8e5[_0xcdbb('0x30')]=_['intersection'](_0x13f8e5[_0xcdbb('0x2e')],_0x13f8e5[_0xcdbb('0x2f')]);_0x148e3b[_0xcdbb('0x31')]=_[_0xcdbb('0x32')](_0x13f8e5['model'],qs['fields'](_0x1b5941[_0xcdbb('0x2f')][_0xcdbb('0x33')]));_0x148e3b['attributes']=_0x148e3b['attributes'][_0xcdbb('0x34')]?_0x148e3b[_0xcdbb('0x31')]:_0x13f8e5[_0xcdbb('0x2e')];_0x148e3b[_0xcdbb('0x37')]=qs['sort'](_0x1b5941['query']['sort']);_0x148e3b[_0xcdbb('0x39')]=qs[_0xcdbb('0x30')](_[_0xcdbb('0x4a')](_0x1b5941['query'],_0x13f8e5[_0xcdbb('0x30')]));if(_0x1b5941['query'][_0xcdbb('0x3a')]){_0x148e3b[_0xcdbb('0x39')]=_[_0xcdbb('0x3b')](_0x148e3b[_0xcdbb('0x39')],{'$or':_[_0xcdbb('0x28')](_0x148e3b[_0xcdbb('0x31')],function(_0x5bedae){var _0x11d1f4={};_0x11d1f4[_0x5bedae]={'$like':'%'+_0x1b5941[_0xcdbb('0x2f')][_0xcdbb('0x3a')]+'%'};return _0x11d1f4;})});}_0x148e3b=_[_0xcdbb('0x3b')]({},_0x148e3b,_0x1b5941['options']);return _0x3d1c65['getFields'](_0x148e3b);}})[_0xcdbb('0x24')](function(_0x5c42f8){if(_0x5c42f8){_0x17eb96=_0x5c42f8[_0xcdbb('0x34')];if(!_0x1b5941['query']['hasOwnProperty']('nolimit')){_0x148e3b['limit']=qs['limit'](_0x1b5941['query'][_0xcdbb('0x1c')]);_0x148e3b[_0xcdbb('0x1b')]=qs[_0xcdbb('0x1b')](_0x1b5941[_0xcdbb('0x2f')][_0xcdbb('0x1b')]);}return _0x3d1c65['getFields'](_0x148e3b);}})['then'](function(_0x2d064c){if(_0x2d064c){return _0x2d064c?{'count':_0x17eb96,'rows':_0x2d064c}:null;}})['then'](respondWithResult(_0x4b3c9d,null))[_0xcdbb('0x44')](handleError(_0x4b3c9d,null));};exports[_0xcdbb('0x4b')]=function(_0x3e1268,_0x517057,_0x2942e0){var _0x3ec243={};var _0xf70256={};var _0x367611;var _0x97923b;return db[_0xcdbb('0x29')][_0xcdbb('0x48')]({'where':{'id':_0x3e1268[_0xcdbb('0x3f')]['id']}})[_0xcdbb('0x24')](handleEntityNotFound(_0x517057,null))['then'](function(_0xfdabdc){if(_0xfdabdc){_0x367611=_0xfdabdc;_0xf70256['model']=_[_0xcdbb('0x40')](db['SalesforceField'][_0xcdbb('0x2a')]);_0xf70256[_0xcdbb('0x2f')]=_[_0xcdbb('0x40')](_0x3e1268[_0xcdbb('0x2f')]);_0xf70256[_0xcdbb('0x30')]=_[_0xcdbb('0x32')](_0xf70256[_0xcdbb('0x2e')],_0xf70256[_0xcdbb('0x2f')]);_0x3ec243[_0xcdbb('0x31')]=_[_0xcdbb('0x32')](_0xf70256[_0xcdbb('0x2e')],qs['fields'](_0x3e1268[_0xcdbb('0x2f')][_0xcdbb('0x33')]));_0x3ec243[_0xcdbb('0x31')]=_0x3ec243['attributes']['length']?_0x3ec243[_0xcdbb('0x31')]:_0xf70256[_0xcdbb('0x2e')];_0x3ec243[_0xcdbb('0x37')]=qs[_0xcdbb('0x38')](_0x3e1268[_0xcdbb('0x2f')][_0xcdbb('0x38')]);_0x3ec243[_0xcdbb('0x39')]=qs['filters'](_['pick'](_0x3e1268[_0xcdbb('0x2f')],_0xf70256['filters']));if(_0x3e1268[_0xcdbb('0x2f')][_0xcdbb('0x3a')]){_0x3ec243[_0xcdbb('0x39')]=_[_0xcdbb('0x3b')](_0x3ec243[_0xcdbb('0x39')],{'$or':_['map'](_0x3ec243['attributes'],function(_0x3584d1){var _0x2b54b4={};_0x2b54b4[_0x3584d1]={'$like':'%'+_0x3e1268[_0xcdbb('0x2f')]['filter']+'%'};return _0x2b54b4;})});}_0x3ec243=_[_0xcdbb('0x3b')]({},_0x3ec243,_0x3e1268[_0xcdbb('0x42')]);return _0x367611[_0xcdbb('0x4b')](_0x3ec243);}})[_0xcdbb('0x24')](function(_0x436ffa){if(_0x436ffa){_0x97923b=_0x436ffa['length'];if(!_0x3e1268[_0xcdbb('0x2f')][_0xcdbb('0x35')](_0xcdbb('0x36'))){_0x3ec243[_0xcdbb('0x1c')]=qs['limit'](_0x3e1268[_0xcdbb('0x2f')]['limit']);_0x3ec243[_0xcdbb('0x1b')]=qs[_0xcdbb('0x1b')](_0x3e1268[_0xcdbb('0x2f')][_0xcdbb('0x1b')]);}return _0x367611[_0xcdbb('0x4b')](_0x3ec243);}})[_0xcdbb('0x24')](function(_0x4c3a0a){if(_0x4c3a0a){return _0x4c3a0a?{'count':_0x97923b,'rows':_0x4c3a0a}:null;}})[_0xcdbb('0x24')](respondWithResult(_0x517057,null))[_0xcdbb('0x44')](handleError(_0x517057,null));};exports[_0xcdbb('0x4c')]=function(_0x5de332,_0x4b4b15,_0x591567){var _0x4115cc={};var _0x3401ea={};var _0x2388e5;var _0x3b7e44;return db[_0xcdbb('0x29')][_0xcdbb('0x48')]({'where':{'id':_0x5de332['params']['id']}})[_0xcdbb('0x24')](handleEntityNotFound(_0x4b4b15,null))[_0xcdbb('0x24')](function(_0xd6351b){if(_0xd6351b){_0x2388e5=_0xd6351b;_0x3401ea['model']=_[_0xcdbb('0x40')](db[_0xcdbb('0x49')][_0xcdbb('0x2a')]);_0x3401ea[_0xcdbb('0x2f')]=_[_0xcdbb('0x40')](_0x5de332[_0xcdbb('0x2f')]);_0x3401ea[_0xcdbb('0x30')]=_[_0xcdbb('0x32')](_0x3401ea[_0xcdbb('0x2e')],_0x3401ea[_0xcdbb('0x2f')]);_0x4115cc[_0xcdbb('0x31')]=_[_0xcdbb('0x32')](_0x3401ea[_0xcdbb('0x2e')],qs[_0xcdbb('0x33')](_0x5de332[_0xcdbb('0x2f')][_0xcdbb('0x33')]));_0x4115cc[_0xcdbb('0x31')]=_0x4115cc[_0xcdbb('0x31')][_0xcdbb('0x34')]?_0x4115cc[_0xcdbb('0x31')]:_0x3401ea[_0xcdbb('0x2e')];_0x4115cc[_0xcdbb('0x37')]=qs[_0xcdbb('0x38')](_0x5de332[_0xcdbb('0x2f')]['sort']);_0x4115cc[_0xcdbb('0x39')]=qs[_0xcdbb('0x30')](_[_0xcdbb('0x4a')](_0x5de332[_0xcdbb('0x2f')],_0x3401ea[_0xcdbb('0x30')]));if(_0x5de332['query'][_0xcdbb('0x3a')]){_0x4115cc[_0xcdbb('0x39')]=_[_0xcdbb('0x3b')](_0x4115cc[_0xcdbb('0x39')],{'$or':_[_0xcdbb('0x28')](_0x4115cc[_0xcdbb('0x31')],function(_0xc49477){var _0x3f4198={};_0x3f4198[_0xc49477]={'$like':'%'+_0x5de332[_0xcdbb('0x2f')][_0xcdbb('0x3a')]+'%'};return _0x3f4198;})});}_0x4115cc=_['merge']({},_0x4115cc,_0x5de332['options']);return _0x2388e5[_0xcdbb('0x4c')](_0x4115cc);}})[_0xcdbb('0x24')](function(_0xc4b3ed){if(_0xc4b3ed){_0x3b7e44=_0xc4b3ed['length'];if(!_0x5de332[_0xcdbb('0x2f')]['hasOwnProperty']('nolimit')){_0x4115cc['limit']=qs[_0xcdbb('0x1c')](_0x5de332['query'][_0xcdbb('0x1c')]);_0x4115cc[_0xcdbb('0x1b')]=qs['offset'](_0x5de332[_0xcdbb('0x2f')][_0xcdbb('0x1b')]);}return _0x2388e5[_0xcdbb('0x4c')](_0x4115cc);}})[_0xcdbb('0x24')](function(_0x41686d){if(_0x41686d){return _0x41686d?{'count':_0x3b7e44,'rows':_0x41686d}:null;}})[_0xcdbb('0x24')](respondWithResult(_0x4b4b15,null))[_0xcdbb('0x44')](handleError(_0x4b4b15,null));}; \ No newline at end of file +var _0x6a96=['destroy','error','stack','name','send','map','rawAttributes','type','model','keys','query','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','options','SalesforceConfiguration','includeAll','include','rows','show','params','find','catch','create','body','getFields','findOne','SalesforceField','hasOwnProperty','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then'];(function(_0x1b0a89,_0x5f4f8f){var _0x3800f0=function(_0x2765fb){while(--_0x2765fb){_0x1b0a89['push'](_0x1b0a89['shift']());}};_0x3800f0(++_0x5f4f8f);}(_0x6a96,0x77));var _0x66a9=function(_0x5a488c,_0x4cc470){_0x5a488c=_0x5a488c-0x0;var _0x53a7d6=_0x6a96[_0x5a488c];return _0x53a7d6;};'use strict';var emlformat=require(_0x66a9('0x0'));var rimraf=require(_0x66a9('0x1'));var zipdir=require(_0x66a9('0x2'));var jsonpatch=require(_0x66a9('0x3'));var rp=require(_0x66a9('0x4'));var moment=require(_0x66a9('0x5'));var BPromise=require(_0x66a9('0x6'));var Mustache=require(_0x66a9('0x7'));var util=require(_0x66a9('0x8'));var path=require(_0x66a9('0x9'));var sox=require('sox');var csv=require(_0x66a9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x66a9('0xb'));var _=require(_0x66a9('0xc'));var squel=require('squel');var crypto=require(_0x66a9('0xd'));var jsforce=require(_0x66a9('0xe'));var deskjs=require(_0x66a9('0xf'));var toCsv=require(_0x66a9('0xa'));var querystring=require('querystring');var Papa=require(_0x66a9('0x10'));var Redis=require(_0x66a9('0x11'));var authService=require(_0x66a9('0x12'));var qs=require(_0x66a9('0x13'));var as=require(_0x66a9('0x14'));var hardwareService=require(_0x66a9('0x15'));var logger=require('../../config/logger')(_0x66a9('0x16'));var utils=require(_0x66a9('0x17'));var config=require(_0x66a9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x66a9('0x19'))['db'];function respondWithStatusCode(_0xbbb45a,_0x44fbd9){_0x44fbd9=_0x44fbd9||0xcc;return function(_0x4a59b){if(_0x4a59b){return _0xbbb45a[_0x66a9('0x1a')](_0x44fbd9);}return _0xbbb45a['status'](_0x44fbd9)[_0x66a9('0x1b')]();};}function respondWithResult(_0x248887,_0x3fbafc){_0x3fbafc=_0x3fbafc||0xc8;return function(_0x3613d7){if(_0x3613d7){return _0x248887[_0x66a9('0x1c')](_0x3fbafc)[_0x66a9('0x1d')](_0x3613d7);}};}function respondWithFilteredResult(_0x378f71,_0xa8c2d3){return function(_0x5e71de){if(_0x5e71de){var _0x1245f6=typeof _0xa8c2d3[_0x66a9('0x1e')]==='undefined'&&typeof _0xa8c2d3[_0x66a9('0x1f')]===_0x66a9('0x20');var _0xe22b3e=_0x5e71de[_0x66a9('0x21')];var _0x400e8a=_0x1245f6?0x0:_0xa8c2d3[_0x66a9('0x1e')];var _0x107d58=_0x1245f6?_0x5e71de[_0x66a9('0x21')]:_0xa8c2d3[_0x66a9('0x1e')]+_0xa8c2d3[_0x66a9('0x1f')];var _0x450ee7;if(_0x107d58>=_0xe22b3e){_0x107d58=_0xe22b3e;_0x450ee7=0xc8;}else{_0x450ee7=0xce;}_0x378f71[_0x66a9('0x1c')](_0x450ee7);return _0x378f71['set'](_0x66a9('0x22'),_0x400e8a+'-'+_0x107d58+'/'+_0xe22b3e)[_0x66a9('0x1d')](_0x5e71de);}return null;};}function patchUpdates(_0x1ed300){return function(_0x66be74){try{jsonpatch[_0x66a9('0x23')](_0x66be74,_0x1ed300,!![]);}catch(_0x56d88f){return BPromise[_0x66a9('0x24')](_0x56d88f);}return _0x66be74[_0x66a9('0x25')]();};}function saveUpdates(_0x3d78ac,_0x2a89c3){return function(_0x243f55){if(_0x243f55){return _0x243f55['update'](_0x3d78ac)[_0x66a9('0x26')](function(_0x1d254c){return _0x1d254c;});}return null;};}function removeEntity(_0x42f312,_0x33ffb1){return function(_0x39a5cb){if(_0x39a5cb){return _0x39a5cb[_0x66a9('0x27')]()[_0x66a9('0x26')](function(){_0x42f312['status'](0xcc)[_0x66a9('0x1b')]();});}};}function handleEntityNotFound(_0x1fd929,_0x181e28){return function(_0x230771){if(!_0x230771){_0x1fd929[_0x66a9('0x1a')](0x194);}return _0x230771;};}function handleError(_0x243d19,_0x4ca3cd){_0x4ca3cd=_0x4ca3cd||0x1f4;return function(_0x115ba9){logger[_0x66a9('0x28')](_0x115ba9[_0x66a9('0x29')]);if(_0x115ba9[_0x66a9('0x2a')]){delete _0x115ba9[_0x66a9('0x2a')];}_0x243d19[_0x66a9('0x1c')](_0x4ca3cd)[_0x66a9('0x2b')](_0x115ba9);};}exports['index']=function(_0x1f6dd6,_0x153271){var _0x45125e={},_0x245387={},_0x438c6d={'count':0x0,'rows':[]};var _0x16ccba=_[_0x66a9('0x2c')](db['SalesforceConfiguration'][_0x66a9('0x2d')],function(_0x301334){return{'name':_0x301334['fieldName'],'type':_0x301334[_0x66a9('0x2e')]['key']};});_0x245387[_0x66a9('0x2f')]=_[_0x66a9('0x2c')](_0x16ccba,_0x66a9('0x2a'));_0x245387['query']=_[_0x66a9('0x30')](_0x1f6dd6[_0x66a9('0x31')]);_0x245387[_0x66a9('0x32')]=_['intersection'](_0x245387[_0x66a9('0x2f')],_0x245387[_0x66a9('0x31')]);_0x45125e['attributes']=_[_0x66a9('0x33')](_0x245387[_0x66a9('0x2f')],qs[_0x66a9('0x34')](_0x1f6dd6['query']['fields']));_0x45125e[_0x66a9('0x35')]=_0x45125e[_0x66a9('0x35')][_0x66a9('0x36')]?_0x45125e[_0x66a9('0x35')]:_0x245387[_0x66a9('0x2f')];if(!_0x1f6dd6[_0x66a9('0x31')]['hasOwnProperty']('nolimit')){_0x45125e[_0x66a9('0x1f')]=qs['limit'](_0x1f6dd6[_0x66a9('0x31')][_0x66a9('0x1f')]);_0x45125e[_0x66a9('0x1e')]=qs[_0x66a9('0x1e')](_0x1f6dd6['query'][_0x66a9('0x1e')]);}_0x45125e[_0x66a9('0x37')]=qs[_0x66a9('0x38')](_0x1f6dd6[_0x66a9('0x31')][_0x66a9('0x38')]);_0x45125e[_0x66a9('0x39')]=qs[_0x66a9('0x32')](_[_0x66a9('0x3a')](_0x1f6dd6[_0x66a9('0x31')],_0x245387[_0x66a9('0x32')]),_0x16ccba);if(_0x1f6dd6['query'][_0x66a9('0x3b')]){_0x45125e[_0x66a9('0x39')]=_[_0x66a9('0x3c')](_0x45125e[_0x66a9('0x39')],{'$or':_[_0x66a9('0x2c')](_0x16ccba,function(_0x2ecc41){if(_0x2ecc41['type']!=='VIRTUAL'){var _0x200672={};_0x200672[_0x2ecc41[_0x66a9('0x2a')]]={'$like':'%'+_0x1f6dd6[_0x66a9('0x31')][_0x66a9('0x3b')]+'%'};return _0x200672;}})});}_0x45125e=_[_0x66a9('0x3c')]({},_0x45125e,_0x1f6dd6[_0x66a9('0x3d')]);var _0x1a0620={'where':_0x45125e[_0x66a9('0x39')]};return db[_0x66a9('0x3e')]['count'](_0x1a0620)['then'](function(_0x34f220){_0x438c6d[_0x66a9('0x21')]=_0x34f220;if(_0x1f6dd6['query'][_0x66a9('0x3f')]){_0x45125e[_0x66a9('0x40')]=[{'all':!![]}];}return db[_0x66a9('0x3e')]['findAll'](_0x45125e);})[_0x66a9('0x26')](function(_0x2b532d){_0x438c6d[_0x66a9('0x41')]=_0x2b532d;return _0x438c6d;})[_0x66a9('0x26')](respondWithFilteredResult(_0x153271,_0x45125e))['catch'](handleError(_0x153271,null));};exports[_0x66a9('0x42')]=function(_0x1d7c41,_0x5edb8d){var _0x51e603={'raw':![],'where':{'id':_0x1d7c41[_0x66a9('0x43')]['id']}},_0x11983e={};_0x11983e[_0x66a9('0x2f')]=_['keys'](db[_0x66a9('0x3e')]['rawAttributes']);_0x11983e['query']=_[_0x66a9('0x30')](_0x1d7c41['query']);_0x11983e['filters']=_[_0x66a9('0x33')](_0x11983e[_0x66a9('0x2f')],_0x11983e[_0x66a9('0x31')]);_0x51e603['attributes']=_['intersection'](_0x11983e[_0x66a9('0x2f')],qs['fields'](_0x1d7c41[_0x66a9('0x31')][_0x66a9('0x34')]));_0x51e603[_0x66a9('0x35')]=_0x51e603['attributes'][_0x66a9('0x36')]?_0x51e603['attributes']:_0x11983e[_0x66a9('0x2f')];if(_0x1d7c41[_0x66a9('0x31')]['includeAll']){_0x51e603['include']=[{'all':!![]}];}_0x51e603=_[_0x66a9('0x3c')]({},_0x51e603,_0x1d7c41[_0x66a9('0x3d')]);return db['SalesforceConfiguration'][_0x66a9('0x44')](_0x51e603)['then'](handleEntityNotFound(_0x5edb8d,null))[_0x66a9('0x26')](respondWithResult(_0x5edb8d,null))[_0x66a9('0x45')](handleError(_0x5edb8d,null));};exports[_0x66a9('0x46')]=function(_0x4bb221,_0x43748f){return db[_0x66a9('0x3e')][_0x66a9('0x46')](_0x4bb221[_0x66a9('0x47')],{})[_0x66a9('0x26')](respondWithResult(_0x43748f,0xc9))[_0x66a9('0x45')](handleError(_0x43748f,null));};exports['update']=function(_0x4b345a,_0x48e32f){if(_0x4b345a[_0x66a9('0x47')]['id']){delete _0x4b345a[_0x66a9('0x47')]['id'];}return db[_0x66a9('0x3e')][_0x66a9('0x44')]({'where':{'id':_0x4b345a[_0x66a9('0x43')]['id']}})[_0x66a9('0x26')](handleEntityNotFound(_0x48e32f,null))['then'](saveUpdates(_0x4b345a[_0x66a9('0x47')],null))[_0x66a9('0x26')](respondWithResult(_0x48e32f,null))[_0x66a9('0x45')](handleError(_0x48e32f,null));};exports[_0x66a9('0x27')]=function(_0xefeecb,_0x412789){return db[_0x66a9('0x3e')]['find']({'where':{'id':_0xefeecb[_0x66a9('0x43')]['id']}})['then'](handleEntityNotFound(_0x412789,null))[_0x66a9('0x26')](removeEntity(_0x412789,null))['catch'](handleError(_0x412789,null));};exports[_0x66a9('0x48')]=function(_0x441d5f,_0x46af87,_0x303116){var _0x45cb73={};var _0x143a99={};var _0x29201d;var _0x1163cc;return db[_0x66a9('0x3e')][_0x66a9('0x49')]({'where':{'id':_0x441d5f[_0x66a9('0x43')]['id']}})['then'](handleEntityNotFound(_0x46af87,null))[_0x66a9('0x26')](function(_0x3ecc34){if(_0x3ecc34){_0x29201d=_0x3ecc34;_0x143a99[_0x66a9('0x2f')]=_[_0x66a9('0x30')](db[_0x66a9('0x4a')][_0x66a9('0x2d')]);_0x143a99[_0x66a9('0x31')]=_[_0x66a9('0x30')](_0x441d5f[_0x66a9('0x31')]);_0x143a99['filters']=_['intersection'](_0x143a99[_0x66a9('0x2f')],_0x143a99[_0x66a9('0x31')]);_0x45cb73[_0x66a9('0x35')]=_[_0x66a9('0x33')](_0x143a99['model'],qs[_0x66a9('0x34')](_0x441d5f[_0x66a9('0x31')][_0x66a9('0x34')]));_0x45cb73[_0x66a9('0x35')]=_0x45cb73[_0x66a9('0x35')][_0x66a9('0x36')]?_0x45cb73[_0x66a9('0x35')]:_0x143a99[_0x66a9('0x2f')];_0x45cb73[_0x66a9('0x37')]=qs[_0x66a9('0x38')](_0x441d5f[_0x66a9('0x31')][_0x66a9('0x38')]);_0x45cb73[_0x66a9('0x39')]=qs[_0x66a9('0x32')](_[_0x66a9('0x3a')](_0x441d5f['query'],_0x143a99[_0x66a9('0x32')]));if(_0x441d5f[_0x66a9('0x31')][_0x66a9('0x3b')]){_0x45cb73[_0x66a9('0x39')]=_[_0x66a9('0x3c')](_0x45cb73[_0x66a9('0x39')],{'$or':_['map'](_0x45cb73[_0x66a9('0x35')],function(_0x576f0f){var _0x1805f1={};_0x1805f1[_0x576f0f]={'$like':'%'+_0x441d5f[_0x66a9('0x31')][_0x66a9('0x3b')]+'%'};return _0x1805f1;})});}_0x45cb73=_[_0x66a9('0x3c')]({},_0x45cb73,_0x441d5f[_0x66a9('0x3d')]);return _0x29201d['getFields'](_0x45cb73);}})[_0x66a9('0x26')](function(_0x56516c){if(_0x56516c){_0x1163cc=_0x56516c[_0x66a9('0x36')];if(!_0x441d5f[_0x66a9('0x31')][_0x66a9('0x4b')]('nolimit')){_0x45cb73[_0x66a9('0x1f')]=qs[_0x66a9('0x1f')](_0x441d5f[_0x66a9('0x31')][_0x66a9('0x1f')]);_0x45cb73[_0x66a9('0x1e')]=qs[_0x66a9('0x1e')](_0x441d5f[_0x66a9('0x31')][_0x66a9('0x1e')]);}return _0x29201d[_0x66a9('0x48')](_0x45cb73);}})['then'](function(_0x397403){if(_0x397403){return _0x397403?{'count':_0x1163cc,'rows':_0x397403}:null;}})['then'](respondWithResult(_0x46af87,null))[_0x66a9('0x45')](handleError(_0x46af87,null));};exports[_0x66a9('0x4c')]=function(_0x5cdca2,_0x5639d1,_0x1e9963){var _0x3938b0={};var _0x478ead={};var _0x2e0f28;var _0x18344a;return db[_0x66a9('0x3e')]['findOne']({'where':{'id':_0x5cdca2[_0x66a9('0x43')]['id']}})[_0x66a9('0x26')](handleEntityNotFound(_0x5639d1,null))[_0x66a9('0x26')](function(_0xaf0a8f){if(_0xaf0a8f){_0x2e0f28=_0xaf0a8f;_0x478ead[_0x66a9('0x2f')]=_['keys'](db['SalesforceField'][_0x66a9('0x2d')]);_0x478ead[_0x66a9('0x31')]=_[_0x66a9('0x30')](_0x5cdca2[_0x66a9('0x31')]);_0x478ead[_0x66a9('0x32')]=_['intersection'](_0x478ead['model'],_0x478ead[_0x66a9('0x31')]);_0x3938b0[_0x66a9('0x35')]=_[_0x66a9('0x33')](_0x478ead['model'],qs['fields'](_0x5cdca2[_0x66a9('0x31')][_0x66a9('0x34')]));_0x3938b0['attributes']=_0x3938b0[_0x66a9('0x35')][_0x66a9('0x36')]?_0x3938b0[_0x66a9('0x35')]:_0x478ead[_0x66a9('0x2f')];_0x3938b0['order']=qs[_0x66a9('0x38')](_0x5cdca2[_0x66a9('0x31')]['sort']);_0x3938b0[_0x66a9('0x39')]=qs[_0x66a9('0x32')](_[_0x66a9('0x3a')](_0x5cdca2[_0x66a9('0x31')],_0x478ead[_0x66a9('0x32')]));if(_0x5cdca2[_0x66a9('0x31')]['filter']){_0x3938b0[_0x66a9('0x39')]=_['merge'](_0x3938b0[_0x66a9('0x39')],{'$or':_[_0x66a9('0x2c')](_0x3938b0[_0x66a9('0x35')],function(_0x364f4c){var _0x276586={};_0x276586[_0x364f4c]={'$like':'%'+_0x5cdca2[_0x66a9('0x31')]['filter']+'%'};return _0x276586;})});}_0x3938b0=_[_0x66a9('0x3c')]({},_0x3938b0,_0x5cdca2['options']);return _0x2e0f28[_0x66a9('0x4c')](_0x3938b0);}})['then'](function(_0x4b1f0b){if(_0x4b1f0b){_0x18344a=_0x4b1f0b[_0x66a9('0x36')];if(!_0x5cdca2[_0x66a9('0x31')][_0x66a9('0x4b')](_0x66a9('0x4d'))){_0x3938b0[_0x66a9('0x1f')]=qs[_0x66a9('0x1f')](_0x5cdca2[_0x66a9('0x31')][_0x66a9('0x1f')]);_0x3938b0[_0x66a9('0x1e')]=qs[_0x66a9('0x1e')](_0x5cdca2[_0x66a9('0x31')][_0x66a9('0x1e')]);}return _0x2e0f28[_0x66a9('0x4c')](_0x3938b0);}})[_0x66a9('0x26')](function(_0x1b29ef){if(_0x1b29ef){return _0x1b29ef?{'count':_0x18344a,'rows':_0x1b29ef}:null;}})[_0x66a9('0x26')](respondWithResult(_0x5639d1,null))[_0x66a9('0x45')](handleError(_0x5639d1,null));};exports['getDescriptions']=function(_0x43c09a,_0x480c7e,_0x15a884){var _0x518e2c={};var _0x317d96={};var _0x32c93e;var _0x2c0829;return db[_0x66a9('0x3e')][_0x66a9('0x49')]({'where':{'id':_0x43c09a[_0x66a9('0x43')]['id']}})[_0x66a9('0x26')](handleEntityNotFound(_0x480c7e,null))['then'](function(_0x382cbc){if(_0x382cbc){_0x32c93e=_0x382cbc;_0x317d96[_0x66a9('0x2f')]=_['keys'](db[_0x66a9('0x4a')][_0x66a9('0x2d')]);_0x317d96[_0x66a9('0x31')]=_[_0x66a9('0x30')](_0x43c09a[_0x66a9('0x31')]);_0x317d96[_0x66a9('0x32')]=_[_0x66a9('0x33')](_0x317d96[_0x66a9('0x2f')],_0x317d96[_0x66a9('0x31')]);_0x518e2c[_0x66a9('0x35')]=_[_0x66a9('0x33')](_0x317d96[_0x66a9('0x2f')],qs[_0x66a9('0x34')](_0x43c09a['query'][_0x66a9('0x34')]));_0x518e2c[_0x66a9('0x35')]=_0x518e2c[_0x66a9('0x35')][_0x66a9('0x36')]?_0x518e2c[_0x66a9('0x35')]:_0x317d96['model'];_0x518e2c[_0x66a9('0x37')]=qs[_0x66a9('0x38')](_0x43c09a[_0x66a9('0x31')]['sort']);_0x518e2c[_0x66a9('0x39')]=qs[_0x66a9('0x32')](_[_0x66a9('0x3a')](_0x43c09a[_0x66a9('0x31')],_0x317d96['filters']));if(_0x43c09a[_0x66a9('0x31')]['filter']){_0x518e2c[_0x66a9('0x39')]=_[_0x66a9('0x3c')](_0x518e2c['where'],{'$or':_['map'](_0x518e2c[_0x66a9('0x35')],function(_0x117482){var _0x387c9e={};_0x387c9e[_0x117482]={'$like':'%'+_0x43c09a[_0x66a9('0x31')]['filter']+'%'};return _0x387c9e;})});}_0x518e2c=_[_0x66a9('0x3c')]({},_0x518e2c,_0x43c09a[_0x66a9('0x3d')]);return _0x32c93e[_0x66a9('0x4e')](_0x518e2c);}})[_0x66a9('0x26')](function(_0x232092){if(_0x232092){_0x2c0829=_0x232092[_0x66a9('0x36')];if(!_0x43c09a[_0x66a9('0x31')][_0x66a9('0x4b')]('nolimit')){_0x518e2c[_0x66a9('0x1f')]=qs['limit'](_0x43c09a[_0x66a9('0x31')][_0x66a9('0x1f')]);_0x518e2c['offset']=qs[_0x66a9('0x1e')](_0x43c09a[_0x66a9('0x31')]['offset']);}return _0x32c93e[_0x66a9('0x4e')](_0x518e2c);}})['then'](function(_0x401241){if(_0x401241){return _0x401241?{'count':_0x2c0829,'rows':_0x401241}:null;}})[_0x66a9('0x26')](respondWithResult(_0x480c7e,null))['catch'](handleError(_0x480c7e,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 4aaf5c9..a3fd350 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 _0xdccf=['../../config/environment','exports','define','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x5797fa,_0x1d0049){var _0x542236=function(_0xb69dde){while(--_0xb69dde){_0x5797fa['push'](_0x5797fa['shift']());}};_0x542236(++_0x1d0049);}(_0xdccf,0xf6));var _0xfdcc=function(_0x2d6f8c,_0x4de464){_0x2d6f8c=_0x2d6f8c-0x0;var _0x4c4415=_0xdccf[_0x2d6f8c];return _0x4c4415;};'use strict';var _=require(_0xfdcc('0x0'));var util=require(_0xfdcc('0x1'));var logger=require(_0xfdcc('0x2'))(_0xfdcc('0x3'));var moment=require(_0xfdcc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfdcc('0x5'));var rimraf=require(_0xfdcc('0x6'));var config=require(_0xfdcc('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xfdcc('0x8')]=function(_0x1543eb,_0x2059f4){return _0x1543eb[_0xfdcc('0x9')]('SalesforceConfiguration',attributes,{'tableName':_0xfdcc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d79=['int_salesforce_configurations','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration'];(function(_0x3dd822,_0x3b9fed){var _0x4f58d0=function(_0x41be33){while(--_0x41be33){_0x3dd822['push'](_0x3dd822['shift']());}};_0x4f58d0(++_0x3b9fed);}(_0x9d79,0x115));var _0x99d7=function(_0x16d0aa,_0x224dab){_0x16d0aa=_0x16d0aa-0x0;var _0x3238da=_0x9d79[_0x16d0aa];return _0x3238da;};'use strict';var _=require(_0x99d7('0x0'));var util=require(_0x99d7('0x1'));var logger=require('../../config/logger')(_0x99d7('0x2'));var moment=require(_0x99d7('0x3'));var BPromise=require(_0x99d7('0x4'));var rp=require(_0x99d7('0x5'));var fs=require('fs');var path=require(_0x99d7('0x6'));var rimraf=require('rimraf');var config=require(_0x99d7('0x7'));var attributes=require(_0x99d7('0x8'));module[_0x99d7('0x9')]=function(_0x1d5463,_0x58af49){return _0x1d5463['define'](_0x99d7('0xa'),attributes,{'tableName':_0x99d7('0xb'),'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 68e29c6..f77555e 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 _0x5be0=['moment','bluebird','randomstring','../../mysqldb','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util'];(function(_0x1acf4d,_0x271e6b){var _0x2880a0=function(_0x448f12){while(--_0x448f12){_0x1acf4d['push'](_0x1acf4d['shift']());}};_0x2880a0(++_0x271e6b);}(_0x5be0,0x17a));var _0x05be=function(_0x5ec09b,_0x12d654){_0x5ec09b=_0x5ec09b-0x0;var _0x5a8482=_0x5be0[_0x5ec09b];return _0x5a8482;};'use strict';var _=require(_0x05be('0x0'));var util=require(_0x05be('0x1'));var moment=require(_0x05be('0x2'));var BPromise=require(_0x05be('0x3'));var rs=require(_0x05be('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05be('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x05be('0x6')][_0x05be('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2dfbbe,_0x22026d,_0x5cb1c9){return new BPromise(function(_0x72a0f3,_0x1825ad){return client[_0x05be('0x8')](_0x2dfbbe,_0x5cb1c9)[_0x05be('0x9')](function(_0x36e036){logger[_0x05be('0xa')](_0x05be('0xb'),_0x22026d,'request\x20sent');logger[_0x05be('0xc')](_0x05be('0xd'),_0x22026d,_0x05be('0xe'),JSON['stringify'](_0x36e036));if(_0x36e036[_0x05be('0xf')]){if(_0x36e036['error'][_0x05be('0x10')]===0x1f4){logger['error'](_0x05be('0xb'),_0x22026d,_0x36e036[_0x05be('0xf')][_0x05be('0x11')]);return _0x1825ad(_0x36e036[_0x05be('0xf')]['message']);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x22026d,_0x36e036[_0x05be('0xf')][_0x05be('0x11')]);return _0x72a0f3(_0x36e036[_0x05be('0xf')][_0x05be('0x11')]);}else{logger['info'](_0x05be('0xb'),_0x22026d,'request\x20sent');_0x72a0f3(_0x36e036[_0x05be('0x12')][_0x05be('0x11')]);}})[_0x05be('0x13')](function(_0x10059f){logger[_0x05be('0xf')](_0x05be('0xb'),_0x22026d,_0x10059f);_0x1825ad(_0x10059f);});});} \ No newline at end of file +var _0xf96f=['message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error'];(function(_0x43b21d,_0x5d5677){var _0x1de400=function(_0x405b75){while(--_0x405b75){_0x43b21d['push'](_0x43b21d['shift']());}};_0x1de400(++_0x5d5677);}(_0xf96f,0x14e));var _0xff96=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xf96f[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xff96('0x0'));var util=require(_0xff96('0x1'));var moment=require(_0xff96('0x2'));var BPromise=require('bluebird');var rs=require(_0xff96('0x3'));var fs=require('fs');var Redis=require(_0xff96('0x4'));var db=require(_0xff96('0x5'))['db'];var utils=require(_0xff96('0x6'));var logger=require('../../config/logger')(_0xff96('0x7'));var config=require(_0xff96('0x8'));var jayson=require(_0xff96('0x9'));var client=jayson[_0xff96('0xa')][_0xff96('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18dc39,_0x2b8b90,_0x1a0b44){return new BPromise(function(_0xb0c656,_0x14730b){return client['request'](_0x18dc39,_0x1a0b44)[_0xff96('0xc')](function(_0x5b1c90){logger[_0xff96('0xd')](_0xff96('0xe'),_0x2b8b90,'request\x20sent');logger[_0xff96('0xf')](_0xff96('0x10'),_0x2b8b90,'request\x20sent',JSON['stringify'](_0x5b1c90));if(_0x5b1c90[_0xff96('0x11')]){if(_0x5b1c90[_0xff96('0x11')]['code']===0x1f4){logger[_0xff96('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2b8b90,_0x5b1c90['error'][_0xff96('0x12')]);return _0x14730b(_0x5b1c90[_0xff96('0x11')][_0xff96('0x12')]);}logger['error'](_0xff96('0xe'),_0x2b8b90,_0x5b1c90[_0xff96('0x11')]['message']);return _0xb0c656(_0x5b1c90[_0xff96('0x11')]['message']);}else{logger[_0xff96('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2b8b90,_0xff96('0x13'));_0xb0c656(_0x5b1c90[_0xff96('0x14')][_0xff96('0x12')]);}})[_0xff96('0x15')](function(_0xd1d33e){logger[_0xff96('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2b8b90,_0xd1d33e);_0x14730b(_0xd1d33e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 80c989e..7deeb94 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 _0xe8cd=['delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','show','post','isAuthenticated','put','update'];(function(_0x180952,_0x56589d){var _0x273f47=function(_0x428b8e){while(--_0x428b8e){_0x180952['push'](_0x180952['shift']());}};_0x273f47(++_0x56589d);}(_0xe8cd,0x1de));var _0xde8c=function(_0x4207f4,_0x1f778b){_0x4207f4=_0x4207f4-0x0;var _0x29a621=_0xe8cd[_0x4207f4];return _0x29a621;};'use strict';var multer=require(_0xde8c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xde8c('0x1'));var express=require(_0xde8c('0x2'));var router=express[_0xde8c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xde8c('0x4'));var interaction=require(_0xde8c('0x5'));var config=require(_0xde8c('0x6'));var controller=require(_0xde8c('0x7'));router[_0xde8c('0x8')]('/',auth['isAuthenticated'](),controller[_0xde8c('0x9')]);router[_0xde8c('0x8')](_0xde8c('0xa'),auth['isAuthenticated'](),controller[_0xde8c('0xb')]);router[_0xde8c('0xc')]('/',auth[_0xde8c('0xd')](),controller['create']);router[_0xde8c('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xde8c('0xf')]);router[_0xde8c('0x10')](_0xde8c('0xa'),auth[_0xde8c('0xd')](),controller[_0xde8c('0x11')]);module[_0xde8c('0x12')]=router; \ No newline at end of file +var _0x61b1=['delete','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update'];(function(_0x113bc1,_0x200ad4){var _0x39abbe=function(_0x5053d6){while(--_0x5053d6){_0x113bc1['push'](_0x113bc1['shift']());}};_0x39abbe(++_0x200ad4);}(_0x61b1,0x1de));var _0x161b=function(_0x4ec243,_0x2c8649){_0x4ec243=_0x4ec243-0x0;var _0x12cf05=_0x61b1[_0x4ec243];return _0x12cf05;};'use strict';var multer=require(_0x161b('0x0'));var util=require('util');var path=require(_0x161b('0x1'));var timeout=require(_0x161b('0x2'));var express=require(_0x161b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x161b('0x4'));var config=require(_0x161b('0x5'));var controller=require(_0x161b('0x6'));router[_0x161b('0x7')]('/',auth['isAuthenticated'](),controller[_0x161b('0x8')]);router[_0x161b('0x7')](_0x161b('0x9'),auth[_0x161b('0xa')](),controller[_0x161b('0xb')]);router[_0x161b('0xc')]('/',auth[_0x161b('0xa')](),controller[_0x161b('0xd')]);router[_0x161b('0xe')](_0x161b('0x9'),auth[_0x161b('0xa')](),controller[_0x161b('0xf')]);router[_0x161b('0x10')](_0x161b('0x9'),auth[_0x161b('0xa')](),controller[_0x161b('0x11')]);module[_0x161b('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index b3c45a9..249522f 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 _0x09d4=['picklist','STRING','sequelize','ENUM','string','variable','customVariable','keyValue'];(function(_0x5b0af5,_0x3ecab3){var _0x3f74d4=function(_0x3e5a90){while(--_0x3e5a90){_0x5b0af5['push'](_0x5b0af5['shift']());}};_0x3f74d4(++_0x3ecab3);}(_0x09d4,0x82));var _0x409d=function(_0x86708a,_0x5b55e0){_0x86708a=_0x86708a-0x0;var _0x24753f=_0x09d4[_0x86708a];return _0x24753f;};'use strict';var Sequelize=require(_0x409d('0x0'));module['exports']={'type':{'type':Sequelize[_0x409d('0x1')](_0x409d('0x2'),_0x409d('0x3'),_0x409d('0x4'),_0x409d('0x5'),_0x409d('0x6')),'defaultValue':_0x409d('0x2')},'content':{'type':Sequelize[_0x409d('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x409d('0x1')](_0x409d('0x2'),_0x409d('0x3'),_0x409d('0x4'))},'keyContent':{'type':Sequelize[_0x409d('0x7')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x409d('0x7')]}}; \ No newline at end of file +var _0x92d6=['variable','sequelize','ENUM','string','customVariable','keyValue','picklist','STRING'];(function(_0x2f274c,_0x5a85b6){var _0x544936=function(_0x1193a4){while(--_0x1193a4){_0x2f274c['push'](_0x2f274c['shift']());}};_0x544936(++_0x5a85b6);}(_0x92d6,0x71));var _0x692d=function(_0x44806c,_0xbe7fda){_0x44806c=_0x44806c-0x0;var _0x52a403=_0x92d6[_0x44806c];return _0x52a403;};'use strict';var Sequelize=require(_0x692d('0x0'));module['exports']={'type':{'type':Sequelize[_0x692d('0x1')](_0x692d('0x2'),'variable',_0x692d('0x3'),_0x692d('0x4'),_0x692d('0x5')),'defaultValue':_0x692d('0x2')},'content':{'type':Sequelize[_0x692d('0x6')]},'key':{'type':Sequelize[_0x692d('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x692d('0x2'),_0x692d('0x7'),_0x692d('0x3'))},'keyContent':{'type':Sequelize[_0x692d('0x6')]},'idField':{'type':Sequelize[_0x692d('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index a8fc831..00d1ca2 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 _0xacef=['rows','show','params','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll'];(function(_0x44500f,_0x5b370b){var _0x390fa4=function(_0x4726eb){while(--_0x4726eb){_0x44500f['push'](_0x44500f['shift']());}};_0x390fa4(++_0x5b370b);}(_0xacef,0xe9));var _0xface=function(_0x53df13,_0x3a7a7f){_0x53df13=_0x53df13-0x0;var _0x8278c6=_0xacef[_0x53df13];return _0x8278c6;};'use strict';var emlformat=require(_0xface('0x0'));var rimraf=require(_0xface('0x1'));var zipdir=require(_0xface('0x2'));var jsonpatch=require(_0xface('0x3'));var rp=require(_0xface('0x4'));var moment=require('moment');var BPromise=require(_0xface('0x5'));var Mustache=require(_0xface('0x6'));var util=require(_0xface('0x7'));var path=require(_0xface('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xface('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xface('0xa'));var squel=require(_0xface('0xb'));var crypto=require('crypto');var jsforce=require(_0xface('0xc'));var deskjs=require(_0xface('0xd'));var toCsv=require(_0xface('0xe'));var querystring=require('querystring');var Papa=require(_0xface('0xf'));var Redis=require(_0xface('0x10'));var authService=require(_0xface('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xface('0x12'));var logger=require(_0xface('0x13'))('api');var utils=require(_0xface('0x14'));var config=require(_0xface('0x15'));var licenseUtil=require(_0xface('0x16'));var db=require(_0xface('0x17'))['db'];function respondWithStatusCode(_0x5be90b,_0x5601d6){_0x5601d6=_0x5601d6||0xcc;return function(_0x2d2403){if(_0x2d2403){return _0x5be90b['sendStatus'](_0x5601d6);}return _0x5be90b[_0xface('0x18')](_0x5601d6)[_0xface('0x19')]();};}function respondWithResult(_0x38c2ee,_0x54af9b){_0x54af9b=_0x54af9b||0xc8;return function(_0x15aa67){if(_0x15aa67){return _0x38c2ee['status'](_0x54af9b)[_0xface('0x1a')](_0x15aa67);}};}function respondWithFilteredResult(_0x5e0d1e,_0x43091d){return function(_0x4adf45){if(_0x4adf45){var _0x1c3508=typeof _0x43091d[_0xface('0x1b')]===_0xface('0x1c')&&typeof _0x43091d[_0xface('0x1d')]==='undefined';var _0x4bbf83=_0x4adf45[_0xface('0x1e')];var _0x332c1e=_0x1c3508?0x0:_0x43091d[_0xface('0x1b')];var _0x4672a3=_0x1c3508?_0x4adf45[_0xface('0x1e')]:_0x43091d[_0xface('0x1b')]+_0x43091d['limit'];var _0x267354;if(_0x4672a3>=_0x4bbf83){_0x4672a3=_0x4bbf83;_0x267354=0xc8;}else{_0x267354=0xce;}_0x5e0d1e['status'](_0x267354);return _0x5e0d1e[_0xface('0x1f')](_0xface('0x20'),_0x332c1e+'-'+_0x4672a3+'/'+_0x4bbf83)[_0xface('0x1a')](_0x4adf45);}return null;};}function patchUpdates(_0x1224e1){return function(_0x168ac1){try{jsonpatch[_0xface('0x21')](_0x168ac1,_0x1224e1,!![]);}catch(_0x340b1e){return BPromise[_0xface('0x22')](_0x340b1e);}return _0x168ac1[_0xface('0x23')]();};}function saveUpdates(_0x1292e7,_0x208d1e){return function(_0x4c43ae){if(_0x4c43ae){return _0x4c43ae[_0xface('0x24')](_0x1292e7)[_0xface('0x25')](function(_0x1f544f){return _0x1f544f;});}return null;};}function removeEntity(_0x5dc282,_0x1abc5e){return function(_0x4a3db1){if(_0x4a3db1){return _0x4a3db1['destroy']()[_0xface('0x25')](function(){_0x5dc282['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fa711,_0x5a5c81){return function(_0x46f97c){if(!_0x46f97c){_0x1fa711[_0xface('0x26')](0x194);}return _0x46f97c;};}function handleError(_0x480053,_0xf7ee9b){_0xf7ee9b=_0xf7ee9b||0x1f4;return function(_0x34a57b){logger['error'](_0x34a57b[_0xface('0x27')]);if(_0x34a57b[_0xface('0x28')]){delete _0x34a57b[_0xface('0x28')];}_0x480053[_0xface('0x18')](_0xf7ee9b)[_0xface('0x29')](_0x34a57b);};}exports[_0xface('0x2a')]=function(_0x3a96c6,_0x390966){var _0x1349d5={},_0xa62cdc={},_0x31ff69={'count':0x0,'rows':[]};var _0x4d2cd5=_[_0xface('0x2b')](db[_0xface('0x2c')][_0xface('0x2d')],function(_0xd136db){return{'name':_0xd136db[_0xface('0x2e')],'type':_0xd136db[_0xface('0x2f')][_0xface('0x30')]};});_0xa62cdc[_0xface('0x31')]=_[_0xface('0x2b')](_0x4d2cd5,_0xface('0x28'));_0xa62cdc[_0xface('0x32')]=_[_0xface('0x33')](_0x3a96c6[_0xface('0x32')]);_0xa62cdc[_0xface('0x34')]=_[_0xface('0x35')](_0xa62cdc[_0xface('0x31')],_0xa62cdc[_0xface('0x32')]);_0x1349d5[_0xface('0x36')]=_[_0xface('0x35')](_0xa62cdc[_0xface('0x31')],qs[_0xface('0x37')](_0x3a96c6[_0xface('0x32')]['fields']));_0x1349d5[_0xface('0x36')]=_0x1349d5[_0xface('0x36')]['length']?_0x1349d5[_0xface('0x36')]:_0xa62cdc['model'];if(!_0x3a96c6[_0xface('0x32')][_0xface('0x38')](_0xface('0x39'))){_0x1349d5['limit']=qs[_0xface('0x1d')](_0x3a96c6[_0xface('0x32')][_0xface('0x1d')]);_0x1349d5[_0xface('0x1b')]=qs['offset'](_0x3a96c6[_0xface('0x32')][_0xface('0x1b')]);}_0x1349d5[_0xface('0x3a')]=qs[_0xface('0x3b')](_0x3a96c6[_0xface('0x32')]['sort']);_0x1349d5[_0xface('0x3c')]=qs['filters'](_[_0xface('0x3d')](_0x3a96c6[_0xface('0x32')],_0xa62cdc['filters']),_0x4d2cd5);if(_0x3a96c6['query']['filter']){_0x1349d5['where']=_[_0xface('0x3e')](_0x1349d5[_0xface('0x3c')],{'$or':_[_0xface('0x2b')](_0x4d2cd5,function(_0x3ee0c1){if(_0x3ee0c1['type']!==_0xface('0x3f')){var _0xe3ae94={};_0xe3ae94[_0x3ee0c1[_0xface('0x28')]]={'$like':'%'+_0x3a96c6[_0xface('0x32')]['filter']+'%'};return _0xe3ae94;}})});}_0x1349d5=_['merge']({},_0x1349d5,_0x3a96c6['options']);var _0x33a2bf={'where':_0x1349d5[_0xface('0x3c')]};return db['SalesforceField'][_0xface('0x1e')](_0x33a2bf)[_0xface('0x25')](function(_0x2f2255){_0x31ff69[_0xface('0x1e')]=_0x2f2255;if(_0x3a96c6[_0xface('0x32')][_0xface('0x40')]){_0x1349d5[_0xface('0x41')]=[{'all':!![]}];}return db[_0xface('0x2c')][_0xface('0x42')](_0x1349d5);})['then'](function(_0x5ed979){_0x31ff69[_0xface('0x43')]=_0x5ed979;return _0x31ff69;})[_0xface('0x25')](respondWithFilteredResult(_0x390966,_0x1349d5))['catch'](handleError(_0x390966,null));};exports[_0xface('0x44')]=function(_0x393f3c,_0x12808f){var _0x4848ca={'raw':!![],'where':{'id':_0x393f3c[_0xface('0x45')]['id']}},_0x51e678={};_0x51e678[_0xface('0x31')]=_[_0xface('0x33')](db[_0xface('0x2c')]['rawAttributes']);_0x51e678[_0xface('0x32')]=_[_0xface('0x33')](_0x393f3c['query']);_0x51e678['filters']=_['intersection'](_0x51e678[_0xface('0x31')],_0x51e678[_0xface('0x32')]);_0x4848ca[_0xface('0x36')]=_[_0xface('0x35')](_0x51e678[_0xface('0x31')],qs[_0xface('0x37')](_0x393f3c[_0xface('0x32')][_0xface('0x37')]));_0x4848ca[_0xface('0x36')]=_0x4848ca[_0xface('0x36')]['length']?_0x4848ca['attributes']:_0x51e678[_0xface('0x31')];if(_0x393f3c['query'][_0xface('0x40')]){_0x4848ca[_0xface('0x41')]=[{'all':!![]}];}_0x4848ca=_[_0xface('0x3e')]({},_0x4848ca,_0x393f3c['options']);return db[_0xface('0x2c')][_0xface('0x46')](_0x4848ca)[_0xface('0x25')](handleEntityNotFound(_0x12808f,null))[_0xface('0x25')](respondWithResult(_0x12808f,null))[_0xface('0x47')](handleError(_0x12808f,null));};exports[_0xface('0x48')]=function(_0x107ce6,_0x486637){return db[_0xface('0x2c')][_0xface('0x48')](_0x107ce6['body'],{})[_0xface('0x25')](respondWithResult(_0x486637,0xc9))[_0xface('0x47')](handleError(_0x486637,null));};exports[_0xface('0x24')]=function(_0x53299d,_0x213d35){if(_0x53299d[_0xface('0x49')]['id']){delete _0x53299d[_0xface('0x49')]['id'];}return db[_0xface('0x2c')][_0xface('0x46')]({'where':{'id':_0x53299d['params']['id']}})[_0xface('0x25')](handleEntityNotFound(_0x213d35,null))[_0xface('0x25')](saveUpdates(_0x53299d['body'],null))[_0xface('0x25')](respondWithResult(_0x213d35,null))['catch'](handleError(_0x213d35,null));};exports[_0xface('0x4a')]=function(_0x4a75c9,_0x165a74){return db[_0xface('0x2c')]['find']({'where':{'id':_0x4a75c9[_0xface('0x45')]['id']}})[_0xface('0x25')](handleEntityNotFound(_0x165a74,null))[_0xface('0x25')](removeEntity(_0x165a74,null))[_0xface('0x47')](handleError(_0x165a74,null));}; \ No newline at end of file +var _0x9158=['SalesforceField','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','intersection','fields','attributes','length','nolimit','order','sort','pick','filters','filter','merge','options','where','includeAll','rows','catch','show','params'];(function(_0x1be42a,_0x531555){var _0xae4a2d=function(_0x579636){while(--_0x579636){_0x1be42a['push'](_0x1be42a['shift']());}};_0xae4a2d(++_0x531555);}(_0x9158,0x129));var _0x8915=function(_0x1e6451,_0x27889c){_0x1e6451=_0x1e6451-0x0;var _0x3c816a=_0x9158[_0x1e6451];return _0x3c816a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8915('0x0'));var zipdir=require(_0x8915('0x1'));var jsonpatch=require(_0x8915('0x2'));var rp=require(_0x8915('0x3'));var moment=require(_0x8915('0x4'));var BPromise=require(_0x8915('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8915('0x6'));var sox=require('sox');var csv=require(_0x8915('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8915('0x8'));var _=require(_0x8915('0x9'));var squel=require('squel');var crypto=require(_0x8915('0xa'));var jsforce=require(_0x8915('0xb'));var deskjs=require(_0x8915('0xc'));var toCsv=require(_0x8915('0x7'));var querystring=require(_0x8915('0xd'));var Papa=require(_0x8915('0xe'));var Redis=require(_0x8915('0xf'));var authService=require(_0x8915('0x10'));var qs=require(_0x8915('0x11'));var as=require(_0x8915('0x12'));var hardwareService=require(_0x8915('0x13'));var logger=require('../../config/logger')(_0x8915('0x14'));var utils=require(_0x8915('0x15'));var config=require(_0x8915('0x16'));var licenseUtil=require(_0x8915('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e5144,_0x10b862){_0x10b862=_0x10b862||0xcc;return function(_0x12e896){if(_0x12e896){return _0x1e5144['sendStatus'](_0x10b862);}return _0x1e5144[_0x8915('0x18')](_0x10b862)[_0x8915('0x19')]();};}function respondWithResult(_0x44a544,_0x81e490){_0x81e490=_0x81e490||0xc8;return function(_0x5462f9){if(_0x5462f9){return _0x44a544[_0x8915('0x18')](_0x81e490)[_0x8915('0x1a')](_0x5462f9);}};}function respondWithFilteredResult(_0x39e101,_0x3a202c){return function(_0x2eb37d){if(_0x2eb37d){var _0x16e8da=typeof _0x3a202c[_0x8915('0x1b')]===_0x8915('0x1c')&&typeof _0x3a202c[_0x8915('0x1d')]===_0x8915('0x1c');var _0x16eaee=_0x2eb37d[_0x8915('0x1e')];var _0x53a160=_0x16e8da?0x0:_0x3a202c[_0x8915('0x1b')];var _0x126a8f=_0x16e8da?_0x2eb37d[_0x8915('0x1e')]:_0x3a202c[_0x8915('0x1b')]+_0x3a202c[_0x8915('0x1d')];var _0x243c86;if(_0x126a8f>=_0x16eaee){_0x126a8f=_0x16eaee;_0x243c86=0xc8;}else{_0x243c86=0xce;}_0x39e101[_0x8915('0x18')](_0x243c86);return _0x39e101['set'](_0x8915('0x1f'),_0x53a160+'-'+_0x126a8f+'/'+_0x16eaee)[_0x8915('0x1a')](_0x2eb37d);}return null;};}function patchUpdates(_0x41402c){return function(_0x27bb96){try{jsonpatch[_0x8915('0x20')](_0x27bb96,_0x41402c,!![]);}catch(_0x18a54a){return BPromise[_0x8915('0x21')](_0x18a54a);}return _0x27bb96[_0x8915('0x22')]();};}function saveUpdates(_0x53c19f,_0x3a4594){return function(_0x56106b){if(_0x56106b){return _0x56106b[_0x8915('0x23')](_0x53c19f)[_0x8915('0x24')](function(_0x4e5ac5){return _0x4e5ac5;});}return null;};}function removeEntity(_0x77ccff,_0x1eb710){return function(_0x5aa538){if(_0x5aa538){return _0x5aa538[_0x8915('0x25')]()[_0x8915('0x24')](function(){_0x77ccff[_0x8915('0x18')](0xcc)[_0x8915('0x19')]();});}};}function handleEntityNotFound(_0x43c2c6,_0x52292c){return function(_0x406124){if(!_0x406124){_0x43c2c6[_0x8915('0x26')](0x194);}return _0x406124;};}function handleError(_0x880abe,_0x2acc58){_0x2acc58=_0x2acc58||0x1f4;return function(_0x38e811){logger['error'](_0x38e811[_0x8915('0x27')]);if(_0x38e811[_0x8915('0x28')]){delete _0x38e811[_0x8915('0x28')];}_0x880abe[_0x8915('0x18')](_0x2acc58)[_0x8915('0x29')](_0x38e811);};}exports[_0x8915('0x2a')]=function(_0x5bbf70,_0xa90be8){var _0x5ed8a6={},_0x3d44eb={},_0x5a5eff={'count':0x0,'rows':[]};var _0x56a395=_['map'](db['SalesforceField'][_0x8915('0x2b')],function(_0x1c19b6){return{'name':_0x1c19b6['fieldName'],'type':_0x1c19b6[_0x8915('0x2c')][_0x8915('0x2d')]};});_0x3d44eb[_0x8915('0x2e')]=_[_0x8915('0x2f')](_0x56a395,_0x8915('0x28'));_0x3d44eb[_0x8915('0x30')]=_[_0x8915('0x31')](_0x5bbf70[_0x8915('0x30')]);_0x3d44eb['filters']=_[_0x8915('0x32')](_0x3d44eb[_0x8915('0x2e')],_0x3d44eb[_0x8915('0x30')]);_0x5ed8a6['attributes']=_[_0x8915('0x32')](_0x3d44eb['model'],qs['fields'](_0x5bbf70[_0x8915('0x30')][_0x8915('0x33')]));_0x5ed8a6['attributes']=_0x5ed8a6[_0x8915('0x34')][_0x8915('0x35')]?_0x5ed8a6[_0x8915('0x34')]:_0x3d44eb[_0x8915('0x2e')];if(!_0x5bbf70[_0x8915('0x30')]['hasOwnProperty'](_0x8915('0x36'))){_0x5ed8a6[_0x8915('0x1d')]=qs['limit'](_0x5bbf70['query'][_0x8915('0x1d')]);_0x5ed8a6['offset']=qs[_0x8915('0x1b')](_0x5bbf70[_0x8915('0x30')][_0x8915('0x1b')]);}_0x5ed8a6[_0x8915('0x37')]=qs['sort'](_0x5bbf70[_0x8915('0x30')][_0x8915('0x38')]);_0x5ed8a6['where']=qs['filters'](_[_0x8915('0x39')](_0x5bbf70[_0x8915('0x30')],_0x3d44eb[_0x8915('0x3a')]),_0x56a395);if(_0x5bbf70[_0x8915('0x30')][_0x8915('0x3b')]){_0x5ed8a6['where']=_[_0x8915('0x3c')](_0x5ed8a6['where'],{'$or':_[_0x8915('0x2f')](_0x56a395,function(_0x273063){if(_0x273063[_0x8915('0x2c')]!=='VIRTUAL'){var _0x2ba93f={};_0x2ba93f[_0x273063[_0x8915('0x28')]]={'$like':'%'+_0x5bbf70['query'][_0x8915('0x3b')]+'%'};return _0x2ba93f;}})});}_0x5ed8a6=_[_0x8915('0x3c')]({},_0x5ed8a6,_0x5bbf70[_0x8915('0x3d')]);var _0x41a7bf={'where':_0x5ed8a6[_0x8915('0x3e')]};return db['SalesforceField'][_0x8915('0x1e')](_0x41a7bf)['then'](function(_0x25de4b){_0x5a5eff[_0x8915('0x1e')]=_0x25de4b;if(_0x5bbf70[_0x8915('0x30')][_0x8915('0x3f')]){_0x5ed8a6['include']=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x5ed8a6);})[_0x8915('0x24')](function(_0x52e59d){_0x5a5eff[_0x8915('0x40')]=_0x52e59d;return _0x5a5eff;})[_0x8915('0x24')](respondWithFilteredResult(_0xa90be8,_0x5ed8a6))[_0x8915('0x41')](handleError(_0xa90be8,null));};exports[_0x8915('0x42')]=function(_0x3f4c11,_0x4f04f9){var _0x27e882={'raw':!![],'where':{'id':_0x3f4c11[_0x8915('0x43')]['id']}},_0x59726c={};_0x59726c['model']=_['keys'](db[_0x8915('0x44')][_0x8915('0x2b')]);_0x59726c[_0x8915('0x30')]=_['keys'](_0x3f4c11[_0x8915('0x30')]);_0x59726c[_0x8915('0x3a')]=_[_0x8915('0x32')](_0x59726c[_0x8915('0x2e')],_0x59726c[_0x8915('0x30')]);_0x27e882['attributes']=_[_0x8915('0x32')](_0x59726c[_0x8915('0x2e')],qs[_0x8915('0x33')](_0x3f4c11[_0x8915('0x30')][_0x8915('0x33')]));_0x27e882['attributes']=_0x27e882[_0x8915('0x34')][_0x8915('0x35')]?_0x27e882['attributes']:_0x59726c[_0x8915('0x2e')];if(_0x3f4c11['query'][_0x8915('0x3f')]){_0x27e882[_0x8915('0x45')]=[{'all':!![]}];}_0x27e882=_[_0x8915('0x3c')]({},_0x27e882,_0x3f4c11[_0x8915('0x3d')]);return db[_0x8915('0x44')][_0x8915('0x46')](_0x27e882)[_0x8915('0x24')](handleEntityNotFound(_0x4f04f9,null))[_0x8915('0x24')](respondWithResult(_0x4f04f9,null))[_0x8915('0x41')](handleError(_0x4f04f9,null));};exports['create']=function(_0x23e7de,_0x15ac9e){return db[_0x8915('0x44')][_0x8915('0x47')](_0x23e7de[_0x8915('0x48')],{})[_0x8915('0x24')](respondWithResult(_0x15ac9e,0xc9))[_0x8915('0x41')](handleError(_0x15ac9e,null));};exports['update']=function(_0x5048a4,_0x1db5ee){if(_0x5048a4[_0x8915('0x48')]['id']){delete _0x5048a4['body']['id'];}return db[_0x8915('0x44')]['find']({'where':{'id':_0x5048a4[_0x8915('0x43')]['id']}})['then'](handleEntityNotFound(_0x1db5ee,null))[_0x8915('0x24')](saveUpdates(_0x5048a4['body'],null))[_0x8915('0x24')](respondWithResult(_0x1db5ee,null))[_0x8915('0x41')](handleError(_0x1db5ee,null));};exports[_0x8915('0x25')]=function(_0x5e5830,_0x4c3f02){return db[_0x8915('0x44')]['find']({'where':{'id':_0x5e5830[_0x8915('0x43')]['id']}})[_0x8915('0x24')](handleEntityNotFound(_0x4c3f02,null))['then'](removeEntity(_0x4c3f02,null))[_0x8915('0x41')](handleError(_0x4c3f02,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index f3dc914..b5fad32 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 _0xfee6=['../../config/environment','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','api','moment','request-promise','rimraf'];(function(_0x1025c5,_0x17020a){var _0x5dbabd=function(_0x45510a){while(--_0x45510a){_0x1025c5['push'](_0x1025c5['shift']());}};_0x5dbabd(++_0x17020a);}(_0xfee6,0x97));var _0x6fee=function(_0x59b576,_0x3cda9d){_0x59b576=_0x59b576-0x0;var _0x2c65b2=_0xfee6[_0x59b576];return _0x2c65b2;};'use strict';var _=require(_0x6fee('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6fee('0x1'));var moment=require(_0x6fee('0x2'));var BPromise=require('bluebird');var rp=require(_0x6fee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6fee('0x4'));var config=require(_0x6fee('0x5'));var attributes=require('./intSalesforceField.attributes');module[_0x6fee('0x6')]=function(_0x5b0699,_0x338fd2){return _0x5b0699[_0x6fee('0x7')](_0x6fee('0x8'),attributes,{'tableName':_0x6fee('0x9'),'paranoid':![],'indexes':[{'name':_0x6fee('0xa'),'fields':[_0x6fee('0xb'),_0x6fee('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa8eb=['idField','FieldId','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index'];(function(_0x104377,_0x54b94c){var _0x1fac22=function(_0xfd1f7f){while(--_0xfd1f7f){_0x104377['push'](_0x104377['shift']());}};_0x1fac22(++_0x54b94c);}(_0xa8eb,0xc5));var _0xba8e=function(_0xeb38df,_0x32894b){_0xeb38df=_0xeb38df-0x0;var _0x57a27c=_0xa8eb[_0xeb38df];return _0x57a27c;};'use strict';var _=require(_0xba8e('0x0'));var util=require('util');var logger=require(_0xba8e('0x1'))(_0xba8e('0x2'));var moment=require(_0xba8e('0x3'));var BPromise=require(_0xba8e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xba8e('0x5'));var rimraf=require(_0xba8e('0x6'));var config=require('../../config/environment');var attributes=require(_0xba8e('0x7'));module[_0xba8e('0x8')]=function(_0x21cc3f,_0x57403b){return _0x21cc3f[_0xba8e('0x9')](_0xba8e('0xa'),attributes,{'tableName':_0xba8e('0xb'),'paranoid':![],'indexes':[{'name':_0xba8e('0xc'),'fields':[_0xba8e('0xd'),_0xba8e('0xe')],'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 c843ce4..9e5deac 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 _0x607f=['SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5517c0,_0x358609){var _0x33803b=function(_0x513c18){while(--_0x513c18){_0x5517c0['push'](_0x5517c0['shift']());}};_0x33803b(++_0x358609);}(_0x607f,0x162));var _0xf607=function(_0x4f18da,_0x34dd74){_0x4f18da=_0x4f18da-0x0;var _0x36d46b=_0x607f[_0x4f18da];return _0x36d46b;};'use strict';var _=require(_0xf607('0x0'));var util=require(_0xf607('0x1'));var moment=require(_0xf607('0x2'));var BPromise=require(_0xf607('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf607('0x4'));var db=require(_0xf607('0x5'))['db'];var utils=require(_0xf607('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf607('0x7'));var jayson=require(_0xf607('0x8'));var client=jayson[_0xf607('0x9')][_0xf607('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ca672,_0x5a0c14,_0x398c9e){return new BPromise(function(_0x445ddb,_0x210827){return client[_0xf607('0xb')](_0x5ca672,_0x398c9e)[_0xf607('0xc')](function(_0x563f81){logger[_0xf607('0xd')](_0xf607('0xe'),_0x5a0c14,_0xf607('0xf'));logger[_0xf607('0x10')](_0xf607('0x11'),_0x5a0c14,'request\x20sent',JSON[_0xf607('0x12')](_0x563f81));if(_0x563f81['error']){if(_0x563f81[_0xf607('0x13')][_0xf607('0x14')]===0x1f4){logger['error']('SalesforceField,\x20%s,\x20%s',_0x5a0c14,_0x563f81[_0xf607('0x13')][_0xf607('0x15')]);return _0x210827(_0x563f81[_0xf607('0x13')][_0xf607('0x15')]);}logger['error'](_0xf607('0xe'),_0x5a0c14,_0x563f81['error']['message']);return _0x445ddb(_0x563f81['error']['message']);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x5a0c14,_0xf607('0xf'));_0x445ddb(_0x563f81['result'][_0xf607('0x15')]);}})[_0xf607('0x16')](function(_0xb015ce){logger[_0xf607('0x13')]('SalesforceField,\x20%s,\x20%s',_0x5a0c14,_0xb015ce);_0x210827(_0xb015ce);});});} \ No newline at end of file +var _0x1089=['SalesforceField,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x5a99db,_0x1cece5){var _0x3aad62=function(_0x334cb7){while(--_0x334cb7){_0x5a99db['push'](_0x5a99db['shift']());}};_0x3aad62(++_0x1cece5);}(_0x1089,0xac));var _0x9108=function(_0x12e844,_0x4212f9){_0x12e844=_0x12e844-0x0;var _0x1171fc=_0x1089[_0x12e844];return _0x1171fc;};'use strict';var _=require('lodash');var util=require(_0x9108('0x0'));var moment=require('moment');var BPromise=require(_0x9108('0x1'));var rs=require(_0x9108('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9108('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9108('0x4'))(_0x9108('0x5'));var config=require(_0x9108('0x6'));var jayson=require(_0x9108('0x7'));var client=jayson[_0x9108('0x8')][_0x9108('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d8eeb,_0x7f461c,_0x278bc4){return new BPromise(function(_0x2d6abc,_0xe1d3f2){return client[_0x9108('0xa')](_0x2d8eeb,_0x278bc4)['then'](function(_0x12c110){logger[_0x9108('0xb')]('SalesforceField,\x20%s,\x20%s',_0x7f461c,_0x9108('0xc'));logger[_0x9108('0xd')](_0x9108('0xe'),_0x7f461c,_0x9108('0xc'),JSON['stringify'](_0x12c110));if(_0x12c110[_0x9108('0xf')]){if(_0x12c110[_0x9108('0xf')][_0x9108('0x10')]===0x1f4){logger[_0x9108('0xf')](_0x9108('0x11'),_0x7f461c,_0x12c110[_0x9108('0xf')][_0x9108('0x12')]);return _0xe1d3f2(_0x12c110['error'][_0x9108('0x12')]);}logger[_0x9108('0xf')]('SalesforceField,\x20%s,\x20%s',_0x7f461c,_0x12c110[_0x9108('0xf')]['message']);return _0x2d6abc(_0x12c110[_0x9108('0xf')][_0x9108('0x12')]);}else{logger[_0x9108('0xb')](_0x9108('0x11'),_0x7f461c,_0x9108('0xc'));_0x2d6abc(_0x12c110[_0x9108('0x13')][_0x9108('0x12')]);}})[_0x9108('0x14')](function(_0x54aecf){logger[_0x9108('0xf')](_0x9108('0x11'),_0x7f461c,_0x54aecf);_0xe1d3f2(_0x54aecf);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index dd25263..b8fd347 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 _0x1809=['get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','put','delete','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller'];(function(_0x385f81,_0x394333){var _0x390b9e=function(_0x5541b7){while(--_0x5541b7){_0x385f81['push'](_0x385f81['shift']());}};_0x390b9e(++_0x394333);}(_0x1809,0x8b));var _0x9180=function(_0x10c283,_0x43b60){_0x10c283=_0x10c283-0x0;var _0x317101=_0x1809[_0x10c283];return _0x317101;};'use strict';var multer=require('multer');var util=require(_0x9180('0x0'));var path=require(_0x9180('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9180('0x2')]();var fs_extra=require(_0x9180('0x3'));var auth=require(_0x9180('0x4'));var interaction=require(_0x9180('0x5'));var config=require(_0x9180('0x6'));var controller=require(_0x9180('0x7'));router[_0x9180('0x8')]('/',auth[_0x9180('0x9')](),controller[_0x9180('0xa')]);router[_0x9180('0x8')](_0x9180('0xb'),auth[_0x9180('0x9')](),controller[_0x9180('0xc')]);router[_0x9180('0x8')](_0x9180('0xd'),auth[_0x9180('0x9')](),controller['getConfigurations']);router['get'](_0x9180('0xe'),auth[_0x9180('0x9')](),controller[_0x9180('0xf')]);router['post']('/',auth[_0x9180('0x9')](),controller[_0x9180('0x10')]);router[_0x9180('0x11')](_0x9180('0xd'),auth[_0x9180('0x9')](),controller[_0x9180('0x12')]);router[_0x9180('0x13')]('/:id',auth[_0x9180('0x9')](),controller['update']);router[_0x9180('0x14')](_0x9180('0xb'),auth[_0x9180('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb59c=['update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put'];(function(_0x38b744,_0x218c46){var _0x3028d4=function(_0x51a542){while(--_0x51a542){_0x38b744['push'](_0x38b744['shift']());}};_0x3028d4(++_0x218c46);}(_0xb59c,0x10b));var _0xcb59=function(_0x3975db,_0x12ca8c){_0x3975db=_0x3975db-0x0;var _0x1b5f5a=_0xb59c[_0x3975db];return _0x1b5f5a;};'use strict';var multer=require(_0xcb59('0x0'));var util=require(_0xcb59('0x1'));var path=require(_0xcb59('0x2'));var timeout=require('connect-timeout');var express=require(_0xcb59('0x3'));var router=express[_0xcb59('0x4')]();var fs_extra=require(_0xcb59('0x5'));var auth=require(_0xcb59('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcb59('0x7'));var controller=require(_0xcb59('0x8'));router[_0xcb59('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xcb59('0xa'),auth[_0xcb59('0xb')](),controller[_0xcb59('0xc')]);router[_0xcb59('0x9')](_0xcb59('0xd'),auth[_0xcb59('0xb')](),controller[_0xcb59('0xe')]);router[_0xcb59('0x9')]('/:id/fields',auth[_0xcb59('0xb')](),controller[_0xcb59('0xf')]);router[_0xcb59('0x10')]('/',auth[_0xcb59('0xb')](),controller['create']);router[_0xcb59('0x10')]('/:id/configurations',auth[_0xcb59('0xb')](),controller[_0xcb59('0x11')]);router[_0xcb59('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xcb59('0x13')]);router[_0xcb59('0x14')](_0xcb59('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xcb59('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 03664c0..b4b65a7 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 _0xc25c=['exports','STRING','username','remoteUri','sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc25c,0x81));var _0xcc25=function(_0x13be60,_0x39892d){_0x13be60=_0x13be60-0x0;var _0x2411f9=_0xc25c[_0x13be60];return _0x2411f9;};'use strict';var Sequelize=require(_0xcc25('0x0'));module[_0xcc25('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcc25('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xcc25('0x3')},'password':{'type':Sequelize[_0xcc25('0x2')]},'email':{'type':Sequelize[_0xcc25('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xcc25('0x4')},'serverUrl':{'type':Sequelize[_0xcc25('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xec5f=['STRING','username','remoteUri','exports'];(function(_0x15fec9,_0x130d86){var _0x3b2076=function(_0x2cf48c){while(--_0x2cf48c){_0x15fec9['push'](_0x15fec9['shift']());}};_0x3b2076(++_0x130d86);}(_0xec5f,0xa3));var _0xfec5=function(_0x1cce09,_0xf0a922){_0x1cce09=_0x1cce09-0x0;var _0x9c7b83=_0xec5f[_0x1cce09];return _0x9c7b83;};'use strict';var Sequelize=require('sequelize');module[_0xfec5('0x0')]={'name':{'type':Sequelize[_0xfec5('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfec5('0x1')],'unique':_0xfec5('0x2')},'password':{'type':Sequelize[_0xfec5('0x1')]},'email':{'type':Sequelize[_0xfec5('0x1')]},'remoteUri':{'type':Sequelize[_0xfec5('0x1')],'unique':_0xfec5('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 95e7876..c8f07a3 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 _0xac34=['calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','priority','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','approval_set','subcategory','work_notes','short_description','correlation_display','work_start','additional_assignee_list','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','incident_state','urgency','company','reassignment_count','activity_due','severity','comments','sla_due','approval','comments_and_work_notes','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','email','serverUrl','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','GET','result','log','incident\x20table\x20objects','assign','includes','forEach','internalType','label','all','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','test','statusCode','boolean','true','False','false','sys_choice?sysparm_query=name=incident^element=','value','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','../../components/integrations/configuration','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','keys','query','filters','intersection','attributes','fields','nolimit','sort','pick','filter','where','type','merge','includeAll','include','ServicenowAccount','findAll','rows','catch','show','params','model','length','options','find','create','body','getConfigurations','findOne','ServicenowConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','close_code','notify','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','user_input','sys_created_on','state','sys_created_by','order'];(function(_0x4832ef,_0x204a5b){var _0x1a9522=function(_0x52c8dd){while(--_0x52c8dd){_0x4832ef['push'](_0x4832ef['shift']());}};_0x1a9522(++_0x204a5b);}(_0xac34,0x1bf));var _0x4ac3=function(_0x3811b4,_0xd87ac4){_0x3811b4=_0x3811b4-0x0;var _0x1a86a2=_0xac34[_0x3811b4];return _0x1a86a2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ac3('0x0'));var zipdir=require(_0x4ac3('0x1'));var jsonpatch=require(_0x4ac3('0x2'));var rp=require(_0x4ac3('0x3'));var moment=require(_0x4ac3('0x4'));var BPromise=require(_0x4ac3('0x5'));var Mustache=require(_0x4ac3('0x6'));var util=require(_0x4ac3('0x7'));var path=require(_0x4ac3('0x8'));var sox=require(_0x4ac3('0x9'));var csv=require(_0x4ac3('0xa'));var ejs=require(_0x4ac3('0xb'));var fs=require('fs');var fs_extra=require(_0x4ac3('0xc'));var _=require('lodash');var squel=require(_0x4ac3('0xd'));var crypto=require(_0x4ac3('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4ac3('0xf'));var toCsv=require(_0x4ac3('0xa'));var querystring=require('querystring');var Papa=require(_0x4ac3('0x10'));var Redis=require(_0x4ac3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4ac3('0x12'));var as=require(_0x4ac3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4ac3('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4ac3('0x15'))['db'];var integrations=require(_0x4ac3('0x16'));function respondWithStatusCode(_0x6872e2,_0x3ebdd1){_0x3ebdd1=_0x3ebdd1||0xcc;return function(_0x418a94){if(_0x418a94){return _0x6872e2['sendStatus'](_0x3ebdd1);}return _0x6872e2['status'](_0x3ebdd1)[_0x4ac3('0x17')]();};}function respondWithResult(_0x20b0e1,_0x5092f4){_0x5092f4=_0x5092f4||0xc8;return function(_0x2b71db){if(_0x2b71db){return _0x20b0e1[_0x4ac3('0x18')](_0x5092f4)[_0x4ac3('0x19')](_0x2b71db);}};}function respondWithFilteredResult(_0x4c047a,_0x414f14){return function(_0x18537b){if(_0x18537b){var _0x4e1d2f=typeof _0x414f14['offset']===_0x4ac3('0x1a')&&typeof _0x414f14[_0x4ac3('0x1b')]===_0x4ac3('0x1a');var _0x4c2072=_0x18537b[_0x4ac3('0x1c')];var _0x328e34=_0x4e1d2f?0x0:_0x414f14[_0x4ac3('0x1d')];var _0x11fa89=_0x4e1d2f?_0x18537b[_0x4ac3('0x1c')]:_0x414f14[_0x4ac3('0x1d')]+_0x414f14[_0x4ac3('0x1b')];var _0x2c495d;if(_0x11fa89>=_0x4c2072){_0x11fa89=_0x4c2072;_0x2c495d=0xc8;}else{_0x2c495d=0xce;}_0x4c047a['status'](_0x2c495d);return _0x4c047a[_0x4ac3('0x1e')](_0x4ac3('0x1f'),_0x328e34+'-'+_0x11fa89+'/'+_0x4c2072)[_0x4ac3('0x19')](_0x18537b);}return null;};}function patchUpdates(_0x5d1b74){return function(_0x2a607f){try{jsonpatch[_0x4ac3('0x20')](_0x2a607f,_0x5d1b74,!![]);}catch(_0x3faecb){return BPromise[_0x4ac3('0x21')](_0x3faecb);}return _0x2a607f['save']();};}function saveUpdates(_0x47b7b3,_0x11f90a){return function(_0x4ded21){if(_0x4ded21){return _0x4ded21[_0x4ac3('0x22')](_0x47b7b3)[_0x4ac3('0x23')](function(_0x1f569e){return _0x1f569e;});}return null;};}function removeEntity(_0x1cc341,_0x3d2d88){return function(_0x2aaad9){if(_0x2aaad9){return _0x2aaad9[_0x4ac3('0x24')]()[_0x4ac3('0x23')](function(){_0x1cc341['status'](0xcc)[_0x4ac3('0x17')]();});}};}function handleEntityNotFound(_0x3730a3,_0x358ec0){return function(_0xe848b5){if(!_0xe848b5){_0x3730a3[_0x4ac3('0x25')](0x194);}return _0xe848b5;};}function handleError(_0x4f6ba7,_0x5d064d){_0x5d064d=_0x5d064d||0x1f4;return function(_0x460b40){logger[_0x4ac3('0x26')](_0x460b40[_0x4ac3('0x27')]);if(_0x460b40[_0x4ac3('0x28')]){delete _0x460b40['name'];}_0x4f6ba7[_0x4ac3('0x18')](_0x5d064d)[_0x4ac3('0x29')](_0x460b40);};}exports[_0x4ac3('0x2a')]=function(_0x386c3d,_0x231119){var _0x2c90a3={},_0x3d7f4a={},_0x2d285e={'count':0x0,'rows':[]};var _0x3ba884=_[_0x4ac3('0x2b')](db['ServicenowAccount'][_0x4ac3('0x2c')],function(_0x1bca80){return{'name':_0x1bca80['fieldName'],'type':_0x1bca80['type']['key']};});_0x3d7f4a['model']=_['map'](_0x3ba884,'name');_0x3d7f4a['query']=_[_0x4ac3('0x2d')](_0x386c3d[_0x4ac3('0x2e')]);_0x3d7f4a[_0x4ac3('0x2f')]=_[_0x4ac3('0x30')](_0x3d7f4a['model'],_0x3d7f4a[_0x4ac3('0x2e')]);_0x2c90a3[_0x4ac3('0x31')]=_[_0x4ac3('0x30')](_0x3d7f4a['model'],qs[_0x4ac3('0x32')](_0x386c3d[_0x4ac3('0x2e')][_0x4ac3('0x32')]));_0x2c90a3[_0x4ac3('0x31')]=_0x2c90a3['attributes']['length']?_0x2c90a3[_0x4ac3('0x31')]:_0x3d7f4a['model'];if(!_0x386c3d['query']['hasOwnProperty'](_0x4ac3('0x33'))){_0x2c90a3[_0x4ac3('0x1b')]=qs[_0x4ac3('0x1b')](_0x386c3d[_0x4ac3('0x2e')][_0x4ac3('0x1b')]);_0x2c90a3[_0x4ac3('0x1d')]=qs[_0x4ac3('0x1d')](_0x386c3d[_0x4ac3('0x2e')][_0x4ac3('0x1d')]);}_0x2c90a3['order']=qs[_0x4ac3('0x34')](_0x386c3d['query']['sort']);_0x2c90a3['where']=qs[_0x4ac3('0x2f')](_[_0x4ac3('0x35')](_0x386c3d[_0x4ac3('0x2e')],_0x3d7f4a['filters']),_0x3ba884);if(_0x386c3d[_0x4ac3('0x2e')][_0x4ac3('0x36')]){_0x2c90a3[_0x4ac3('0x37')]=_['merge'](_0x2c90a3[_0x4ac3('0x37')],{'$or':_['map'](_0x3ba884,function(_0xa8ad39){if(_0xa8ad39[_0x4ac3('0x38')]!=='VIRTUAL'){var _0x487586={};_0x487586[_0xa8ad39['name']]={'$like':'%'+_0x386c3d[_0x4ac3('0x2e')]['filter']+'%'};return _0x487586;}})});}_0x2c90a3=_[_0x4ac3('0x39')]({},_0x2c90a3,_0x386c3d['options']);var _0xf962e5={'where':_0x2c90a3[_0x4ac3('0x37')]};return db['ServicenowAccount'][_0x4ac3('0x1c')](_0xf962e5)['then'](function(_0x25f26d){_0x2d285e[_0x4ac3('0x1c')]=_0x25f26d;if(_0x386c3d[_0x4ac3('0x2e')][_0x4ac3('0x3a')]){_0x2c90a3[_0x4ac3('0x3b')]=[{'all':!![]}];}return db[_0x4ac3('0x3c')][_0x4ac3('0x3d')](_0x2c90a3);})[_0x4ac3('0x23')](function(_0x265f78){_0x2d285e[_0x4ac3('0x3e')]=_0x265f78;return _0x2d285e;})[_0x4ac3('0x23')](respondWithFilteredResult(_0x231119,_0x2c90a3))[_0x4ac3('0x3f')](handleError(_0x231119,null));};exports[_0x4ac3('0x40')]=function(_0x4e1369,_0x16e7da){var _0x38379d={'raw':![],'where':{'id':_0x4e1369[_0x4ac3('0x41')]['id']}},_0x4c72ee={};_0x4c72ee[_0x4ac3('0x42')]=_[_0x4ac3('0x2d')](db[_0x4ac3('0x3c')][_0x4ac3('0x2c')]);_0x4c72ee[_0x4ac3('0x2e')]=_[_0x4ac3('0x2d')](_0x4e1369['query']);_0x4c72ee[_0x4ac3('0x2f')]=_['intersection'](_0x4c72ee['model'],_0x4c72ee[_0x4ac3('0x2e')]);_0x38379d[_0x4ac3('0x31')]=_[_0x4ac3('0x30')](_0x4c72ee[_0x4ac3('0x42')],qs[_0x4ac3('0x32')](_0x4e1369[_0x4ac3('0x2e')][_0x4ac3('0x32')]));_0x38379d['attributes']=_0x38379d[_0x4ac3('0x31')][_0x4ac3('0x43')]?_0x38379d[_0x4ac3('0x31')]:_0x4c72ee['model'];if(_0x4e1369['query'][_0x4ac3('0x3a')]){_0x38379d[_0x4ac3('0x3b')]=[{'all':!![]}];}_0x38379d=_[_0x4ac3('0x39')]({},_0x38379d,_0x4e1369[_0x4ac3('0x44')]);return db[_0x4ac3('0x3c')][_0x4ac3('0x45')](_0x38379d)[_0x4ac3('0x23')](handleEntityNotFound(_0x16e7da,null))['then'](respondWithResult(_0x16e7da,null))[_0x4ac3('0x3f')](handleError(_0x16e7da,null));};exports[_0x4ac3('0x46')]=function(_0x1a4820,_0x4f3bd9){return db[_0x4ac3('0x3c')]['create'](_0x1a4820['body'],{})[_0x4ac3('0x23')](respondWithResult(_0x4f3bd9,0xc9))[_0x4ac3('0x3f')](handleError(_0x4f3bd9,null));};exports[_0x4ac3('0x22')]=function(_0x13952b,_0x8c0901){if(_0x13952b[_0x4ac3('0x47')]['id']){delete _0x13952b[_0x4ac3('0x47')]['id'];}return db[_0x4ac3('0x3c')]['find']({'where':{'id':_0x13952b['params']['id']}})[_0x4ac3('0x23')](handleEntityNotFound(_0x8c0901,null))['then'](saveUpdates(_0x13952b[_0x4ac3('0x47')],null))[_0x4ac3('0x23')](respondWithResult(_0x8c0901,null))[_0x4ac3('0x3f')](handleError(_0x8c0901,null));};exports[_0x4ac3('0x24')]=function(_0x55b8ff,_0x46c7bf){return db['ServicenowAccount']['find']({'where':{'id':_0x55b8ff[_0x4ac3('0x41')]['id']}})['then'](handleEntityNotFound(_0x46c7bf,null))[_0x4ac3('0x23')](removeEntity(_0x46c7bf,null))['catch'](handleError(_0x46c7bf,null));};exports[_0x4ac3('0x48')]=function(_0x366db7,_0x22c497,_0x5c249d){var _0xdcc0d4={};var _0x1a1987={};var _0x29f8bd;var _0x4082b0;return db[_0x4ac3('0x3c')][_0x4ac3('0x49')]({'where':{'id':_0x366db7[_0x4ac3('0x41')]['id']}})['then'](handleEntityNotFound(_0x22c497,null))[_0x4ac3('0x23')](function(_0x343d67){if(_0x343d67){_0x29f8bd=_0x343d67;_0x1a1987[_0x4ac3('0x42')]=_[_0x4ac3('0x2d')](db[_0x4ac3('0x4a')][_0x4ac3('0x2c')]);_0x1a1987['query']=_[_0x4ac3('0x2d')](_0x366db7[_0x4ac3('0x2e')]);_0x1a1987['filters']=_[_0x4ac3('0x30')](_0x1a1987['model'],_0x1a1987['query']);_0xdcc0d4[_0x4ac3('0x31')]=_[_0x4ac3('0x30')](_0x1a1987[_0x4ac3('0x42')],qs['fields'](_0x366db7[_0x4ac3('0x2e')][_0x4ac3('0x32')]));_0xdcc0d4[_0x4ac3('0x31')]=_0xdcc0d4[_0x4ac3('0x31')][_0x4ac3('0x43')]?_0xdcc0d4[_0x4ac3('0x31')]:_0x1a1987['model'];_0xdcc0d4['order']=qs[_0x4ac3('0x34')](_0x366db7[_0x4ac3('0x2e')][_0x4ac3('0x34')]);_0xdcc0d4[_0x4ac3('0x37')]=qs[_0x4ac3('0x2f')](_[_0x4ac3('0x35')](_0x366db7[_0x4ac3('0x2e')],_0x1a1987[_0x4ac3('0x2f')]));if(_0x366db7[_0x4ac3('0x2e')][_0x4ac3('0x36')]){_0xdcc0d4[_0x4ac3('0x37')]=_[_0x4ac3('0x39')](_0xdcc0d4[_0x4ac3('0x37')],{'$or':_['map'](_0xdcc0d4[_0x4ac3('0x31')],function(_0x4d83ca){var _0x4890db={};_0x4890db[_0x4d83ca]={'$like':'%'+_0x366db7[_0x4ac3('0x2e')][_0x4ac3('0x36')]+'%'};return _0x4890db;})});}_0xdcc0d4=_[_0x4ac3('0x39')]({},_0xdcc0d4,_0x366db7['options']);return _0x29f8bd['getConfigurations'](_0xdcc0d4);}})[_0x4ac3('0x23')](function(_0x51576c){if(_0x51576c){_0x4082b0=_0x51576c[_0x4ac3('0x43')];if(!_0x366db7[_0x4ac3('0x2e')][_0x4ac3('0x4b')](_0x4ac3('0x33'))){_0xdcc0d4[_0x4ac3('0x1b')]=qs[_0x4ac3('0x1b')](_0x366db7[_0x4ac3('0x2e')][_0x4ac3('0x1b')]);_0xdcc0d4[_0x4ac3('0x1d')]=qs[_0x4ac3('0x1d')](_0x366db7[_0x4ac3('0x2e')][_0x4ac3('0x1d')]);}return _0x29f8bd[_0x4ac3('0x48')](_0xdcc0d4);}})[_0x4ac3('0x23')](function(_0x4d8b27){if(_0x4d8b27){return _0x4d8b27?{'count':_0x4082b0,'rows':_0x4d8b27}:null;}})[_0x4ac3('0x23')](respondWithResult(_0x22c497,null))[_0x4ac3('0x3f')](handleError(_0x22c497,null));};exports[_0x4ac3('0x4c')]=function(_0x3a21f3,_0xf6b5ea,_0x19daf0){if(_0x3a21f3['body']['id']){delete _0x3a21f3[_0x4ac3('0x47')]['id'];}return db[_0x4ac3('0x3c')]['findOne']({'where':{'id':_0x3a21f3[_0x4ac3('0x41')]['id']}})['then'](handleEntityNotFound(_0xf6b5ea,null))['then'](function(_0x1b29aa){if(_0x1b29aa){_0x3a21f3[_0x4ac3('0x47')][_0x4ac3('0x4d')]=_0x1b29aa['id'];_0x3a21f3[_0x4ac3('0x47')][_0x4ac3('0x4e')]=integrations[_0x4ac3('0x4f')](_0x3a21f3[_0x4ac3('0x47')][_0x4ac3('0x50')],_0x3a21f3[_0x4ac3('0x47')][_0x4ac3('0x38')]);_0x3a21f3[_0x4ac3('0x47')][_0x4ac3('0x51')]=integrations[_0x4ac3('0x52')](_0x3a21f3[_0x4ac3('0x47')]['channel'],_0x3a21f3[_0x4ac3('0x47')][_0x4ac3('0x38')]);return db[_0x4ac3('0x4a')][_0x4ac3('0x46')](_0x3a21f3[_0x4ac3('0x47')],{'include':[{'model':db[_0x4ac3('0x53')],'as':_0x4ac3('0x4e')},{'model':db[_0x4ac3('0x53')],'as':_0x4ac3('0x51')}]});}return null;})[_0x4ac3('0x23')](respondWithResult(_0xf6b5ea,null))[_0x4ac3('0x3f')](handleError(_0xf6b5ea,null));};exports[_0x4ac3('0x54')]=function(_0x25a27c,_0x5f212d,_0x358537){var _0xabae0d=[_0x4ac3('0x55'),_0x4ac3('0x56'),_0x4ac3('0x57'),'subcategory',_0x4ac3('0x58'),_0x4ac3('0x59'),'incident_state','severity',_0x4ac3('0x5a')];var _0x4d5f92=[_0x4ac3('0x5b'),_0x4ac3('0x55'),_0x4ac3('0x5c'),_0x4ac3('0x5d'),_0x4ac3('0x5e'),_0x4ac3('0x5f'),_0x4ac3('0x60'),_0x4ac3('0x56'),_0x4ac3('0x61'),_0x4ac3('0x62'),_0x4ac3('0x63'),'sys_updated_by','opened_by',_0x4ac3('0x64'),_0x4ac3('0x65'),'sys_domain',_0x4ac3('0x66'),_0x4ac3('0x67'),_0x4ac3('0x57'),_0x4ac3('0x68'),_0x4ac3('0x69'),_0x4ac3('0x6a'),_0x4ac3('0x6b'),_0x4ac3('0x6c'),_0x4ac3('0x6d'),_0x4ac3('0x6e'),'work_notes_list','business_service',_0x4ac3('0x6f'),_0x4ac3('0x70'),_0x4ac3('0x71'),_0x4ac3('0x72'),'expected_start',_0x4ac3('0x73'),_0x4ac3('0x74'),_0x4ac3('0x75'),_0x4ac3('0x76'),_0x4ac3('0x77'),'resolved_at','caller_id',_0x4ac3('0x78'),_0x4ac3('0x79'),_0x4ac3('0x7a'),_0x4ac3('0x7b'),_0x4ac3('0x58'),_0x4ac3('0x7c'),'delivery_task',_0x4ac3('0x7d'),'assignment_group','business_stc',_0x4ac3('0x7e'),'description',_0x4ac3('0x7f'),_0x4ac3('0x59'),_0x4ac3('0x80'),_0x4ac3('0x81'),_0x4ac3('0x82'),_0x4ac3('0x83'),_0x4ac3('0x84'),_0x4ac3('0x85'),'contact_type',_0x4ac3('0x86'),_0x4ac3('0x87'),_0x4ac3('0x88'),'problem_id',_0x4ac3('0x89'),_0x4ac3('0x8a'),_0x4ac3('0x8b'),'assigned_to',_0x4ac3('0x8c'),_0x4ac3('0x8d'),_0x4ac3('0x8e'),_0x4ac3('0x8f'),_0x4ac3('0x90'),'due_date','sys_mod_count',_0x4ac3('0x91'),_0x4ac3('0x92'),_0x4ac3('0x93'),_0x4ac3('0x94'),_0x4ac3('0x95'),_0x4ac3('0x96'),_0x4ac3('0x5a')];var _0x161bb6='';var _0x51ac52='';var _0x16b297=[];var _0x2f31b4='';var _0x31da29='';var _0x1ac9b8=[];var _0x53f821='';var _0x2ceb16='';var _0x2143e2={};var _0x35e012='';return db[_0x4ac3('0x3c')][_0x4ac3('0x49')]({'where':{'id':_0x25a27c[_0x4ac3('0x41')]['id']},'attributes':['id',_0x4ac3('0x97'),'password',_0x4ac3('0x98'),'remoteUri',_0x4ac3('0x99')]})[_0x4ac3('0x23')](handleEntityNotFound(_0x5f212d,null))[_0x4ac3('0x23')](function(_0x4c3736){if(_0x4c3736){_0x35e012=_0x4c3736[_0x4ac3('0x9a')];var _0x317ece=_0x35e012[_0x4ac3('0x9b')](-0x1);if(_0x317ece==='/'){_0x35e012=_0x35e012[_0x4ac3('0x9c')](0x0,_0x35e012[_0x4ac3('0x9d')](_0x317ece));}_0x2ceb16=util[_0x4ac3('0x9e')](_0x4ac3('0x9f'),_0x35e012);_0x53f821=util['format'](_0x4ac3('0xa0'),_0x35e012);_0x2143e2={'user':_0x4c3736[_0x4ac3('0x97')],'pass':_0x4c3736[_0x4ac3('0xa1')]};var _0x3b4881={'method':_0x4ac3('0xa2'),'uri':_0x2ceb16+'incident?sysparm_display_value=all','auth':_0x2143e2,'json':!![]};return rp(_0x3b4881);}})[_0x4ac3('0x23')](function(_0x547052){if(_0x547052['result']['length']>0x0){_0x161bb6=_0x547052[_0x4ac3('0xa3')];}console[_0x4ac3('0xa4')](_0x4ac3('0xa5'),_0x161bb6);_0x1ac9b8=[];_0x51ac52=Object[_0x4ac3('0xa6')]([],_0x161bb6);_['remove'](_0x51ac52,function(_0x2e4fa9){return!_0xabae0d[_0x4ac3('0xa7')](_0x2e4fa9[_0x4ac3('0x28')]);});_0x51ac52[_0x4ac3('0xa8')](function(_0x13cc09){var _0x3b5380=createFieldObject(_0x53f821,_0x2143e2,_0x13cc09[_0x4ac3('0xa9')],_0x13cc09[_0x4ac3('0x28')],_0x13cc09[_0x4ac3('0xaa')],![]);_0x1ac9b8['push'](_0x3b5380);});return Promise[_0x4ac3('0xab')](_0x1ac9b8);})[_0x4ac3('0x23')](function(_0x519528){_0x16b297=_0x519528;_0x2f31b4=Object[_0x4ac3('0xa6')]([],_0x161bb6);console['log'](_0x4ac3('0xac'),_0x161bb6);_[_0x4ac3('0xad')](_0x2f31b4,function(_0x55dacf){return _0x4d5f92[_0x4ac3('0xa7')](_0x55dacf['name']);});console[_0x4ac3('0xa4')](_0x4ac3('0xae'),_0x2f31b4);_0x1ac9b8=[];_0x2f31b4['forEach'](function(_0x44df5e){var _0x54a781=createFieldObject(_0x53f821,_0x2143e2,_0x44df5e['internalType'],_0x44df5e[_0x4ac3('0x28')],_0x44df5e[_0x4ac3('0xaa')],!![]);_0x1ac9b8[_0x4ac3('0xaf')](_0x54a781);});return Promise[_0x4ac3('0xab')](_0x1ac9b8);})['then'](function(_0x2f06ca){_0x31da29=_0x2f06ca;var _0x38885b=_0x16b297['concat'](_0x31da29);return{'count':_0x38885b[_0x4ac3('0x43')],'rows':_0x38885b};})[_0x4ac3('0x23')](respondWithResult(_0x5f212d,null))['catch'](function(_0x5299d1){console[_0x4ac3('0xa4')]('ServiceNow\x20error:\x20'+_0x5299d1);var _0x543ee6=_0x25a27c[_0x4ac3('0x2e')][_0x4ac3('0xb0')]?0x1f4:_0x5299d1[_0x4ac3('0xb1')]||0x1f4;logger[_0x4ac3('0x26')](_0x5299d1[_0x4ac3('0x27')]);delete _0x5299d1[_0x4ac3('0x28')];if(_0x543ee6===0x191){_0x543ee6=0x190;}_0x5f212d['status'](_0x543ee6)['send'](_0x25a27c['query'][_0x4ac3('0xb0')]?{'message':'Wrong\x20credentials','statusCode':_0x5299d1[_0x4ac3('0xb1')]}:_0x5299d1);});};function createFieldObject(_0x45f294,_0x265011,_0x11385e,_0x3e472c,_0x168d9f,_0x3e7961){return new Promise(function(_0x146cd0,_0x764203){var _0x5b3733={'id':_0x3e472c,'name':_0x168d9f,'custom':_0x3e7961};if(_0x11385e===_0x4ac3('0xb2')){_0x5b3733[_0x4ac3('0x44')]=[{'name':'True','value':_0x4ac3('0xb3')},{'name':_0x4ac3('0xb4'),'value':_0x4ac3('0xb5')}];_0x146cd0(_0x5b3733);}else{var _0x252603={'method':_0x4ac3('0xa2'),'uri':_0x45f294+_0x4ac3('0xb6')+_0x3e472c,'auth':_0x265011,'json':!![]};return rp(_0x252603)[_0x4ac3('0x23')](function(_0x1eb4b2){var _0xed8c97=[];if(_0x1eb4b2[_0x4ac3('0xa3')][_0x4ac3('0x43')]>0x0){_0x1eb4b2['result'][_0x4ac3('0xa8')](function(_0x17a511){if(_0x17a511['inactive']===_0x4ac3('0xb5')){var _0x369a5d={'name':_0x17a511[_0x4ac3('0xaa')],'value':_0x17a511[_0x4ac3('0xb7')]};_0xed8c97['push'](_0x369a5d);}});}_0x5b3733[_0x4ac3('0x44')]=_0xed8c97;if(_0x5b3733[_0x4ac3('0x44')][_0x4ac3('0x43')]>0x0){_0x146cd0(_0x5b3733);}else{if(_0x3e7961==![]){_0x146cd0();}else{_0x146cd0(_0x5b3733);}}});}});} \ No newline at end of file +var _0x36bf=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','ServicenowAccount','includeAll','findAll','rows','show','keys','length','include','options','find','catch','create','body','destroy','params','getConfigurations','ServicenowConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ServicenowField','getFields','made_sla','hold_reason','subcategory','close_code','severity','category','caused_by','sys_updated_on','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','state','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','work_end','resolved_at','caller_id','approval_set','work_notes','short_description','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','sys_class_name','close_notes','closed_by','sys_id','contact_type','reopened_by','incident_state','urgency','problem_id','reassignment_count','activity_due','comments','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','serverUrl','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/table/','GET','result','log','remove','includes','forEach','internalType','label','TCL:\x20_object','push','all','concat','ServiceNow\x20error:\x20','test','statusCode','error','Wrong\x20credentials','False','false','inactive','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse'];(function(_0x558bc4,_0x253412){var _0x576f82=function(_0x6b38c8){while(--_0x6b38c8){_0x558bc4['push'](_0x558bc4['shift']());}};_0x576f82(++_0x253412);}(_0x36bf,0xa7));var _0xf36b=function(_0x369f37,_0x103ea7){_0x369f37=_0x369f37-0x0;var _0x5617cc=_0x36bf[_0x369f37];return _0x5617cc;};'use strict';var emlformat=require(_0xf36b('0x0'));var rimraf=require(_0xf36b('0x1'));var zipdir=require(_0xf36b('0x2'));var jsonpatch=require(_0xf36b('0x3'));var rp=require(_0xf36b('0x4'));var moment=require(_0xf36b('0x5'));var BPromise=require(_0xf36b('0x6'));var Mustache=require(_0xf36b('0x7'));var util=require(_0xf36b('0x8'));var path=require(_0xf36b('0x9'));var sox=require(_0xf36b('0xa'));var csv=require('to-csv');var ejs=require(_0xf36b('0xb'));var fs=require('fs');var fs_extra=require(_0xf36b('0xc'));var _=require(_0xf36b('0xd'));var squel=require('squel');var crypto=require(_0xf36b('0xe'));var jsforce=require(_0xf36b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf36b('0x10'));var querystring=require(_0xf36b('0x11'));var Papa=require(_0xf36b('0x12'));var Redis=require(_0xf36b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xf36b('0x14'));var as=require(_0xf36b('0x15'));var hardwareService=require(_0xf36b('0x16'));var logger=require(_0xf36b('0x17'))(_0xf36b('0x18'));var utils=require(_0xf36b('0x19'));var config=require(_0xf36b('0x1a'));var licenseUtil=require(_0xf36b('0x1b'));var db=require(_0xf36b('0x1c'))['db'];var integrations=require(_0xf36b('0x1d'));function respondWithStatusCode(_0x1e5b12,_0x2d7083){_0x2d7083=_0x2d7083||0xcc;return function(_0x28065c){if(_0x28065c){return _0x1e5b12[_0xf36b('0x1e')](_0x2d7083);}return _0x1e5b12[_0xf36b('0x1f')](_0x2d7083)[_0xf36b('0x20')]();};}function respondWithResult(_0x3b113b,_0x2aba12){_0x2aba12=_0x2aba12||0xc8;return function(_0x13f2d5){if(_0x13f2d5){return _0x3b113b['status'](_0x2aba12)['json'](_0x13f2d5);}};}function respondWithFilteredResult(_0x3028c2,_0x390a53){return function(_0x21d0f7){if(_0x21d0f7){var _0x5b8faa=typeof _0x390a53[_0xf36b('0x21')]===_0xf36b('0x22')&&typeof _0x390a53[_0xf36b('0x23')]===_0xf36b('0x22');var _0x33524c=_0x21d0f7['count'];var _0x3b38f9=_0x5b8faa?0x0:_0x390a53[_0xf36b('0x21')];var _0x2cd17b=_0x5b8faa?_0x21d0f7[_0xf36b('0x24')]:_0x390a53['offset']+_0x390a53[_0xf36b('0x23')];var _0x2d71e3;if(_0x2cd17b>=_0x33524c){_0x2cd17b=_0x33524c;_0x2d71e3=0xc8;}else{_0x2d71e3=0xce;}_0x3028c2[_0xf36b('0x1f')](_0x2d71e3);return _0x3028c2[_0xf36b('0x25')](_0xf36b('0x26'),_0x3b38f9+'-'+_0x2cd17b+'/'+_0x33524c)[_0xf36b('0x27')](_0x21d0f7);}return null;};}function patchUpdates(_0x1d6e4a){return function(_0x1eb610){try{jsonpatch[_0xf36b('0x28')](_0x1eb610,_0x1d6e4a,!![]);}catch(_0x56aeed){return BPromise[_0xf36b('0x29')](_0x56aeed);}return _0x1eb610[_0xf36b('0x2a')]();};}function saveUpdates(_0x365de6,_0x14f96c){return function(_0x3db8e5){if(_0x3db8e5){return _0x3db8e5[_0xf36b('0x2b')](_0x365de6)[_0xf36b('0x2c')](function(_0x1d1cae){return _0x1d1cae;});}return null;};}function removeEntity(_0x3f4f31,_0x32bd3b){return function(_0x3fc7d0){if(_0x3fc7d0){return _0x3fc7d0['destroy']()[_0xf36b('0x2c')](function(){_0x3f4f31[_0xf36b('0x1f')](0xcc)[_0xf36b('0x20')]();});}};}function handleEntityNotFound(_0x4cdedd,_0x232c6d){return function(_0x3764cd){if(!_0x3764cd){_0x4cdedd['sendStatus'](0x194);}return _0x3764cd;};}function handleError(_0x20685e,_0x1ff4a6){_0x1ff4a6=_0x1ff4a6||0x1f4;return function(_0x8927bb){logger['error'](_0x8927bb[_0xf36b('0x2d')]);if(_0x8927bb[_0xf36b('0x2e')]){delete _0x8927bb['name'];}_0x20685e[_0xf36b('0x1f')](_0x1ff4a6)[_0xf36b('0x2f')](_0x8927bb);};}exports[_0xf36b('0x30')]=function(_0x1808e4,_0x2fe143){var _0xe45b47={},_0x2cd88a={},_0x2e7340={'count':0x0,'rows':[]};var _0x391523=_[_0xf36b('0x31')](db['ServicenowAccount'][_0xf36b('0x32')],function(_0x3ad1ac){return{'name':_0x3ad1ac[_0xf36b('0x33')],'type':_0x3ad1ac[_0xf36b('0x34')][_0xf36b('0x35')]};});_0x2cd88a[_0xf36b('0x36')]=_['map'](_0x391523,'name');_0x2cd88a[_0xf36b('0x37')]=_['keys'](_0x1808e4[_0xf36b('0x37')]);_0x2cd88a[_0xf36b('0x38')]=_[_0xf36b('0x39')](_0x2cd88a[_0xf36b('0x36')],_0x2cd88a['query']);_0xe45b47[_0xf36b('0x3a')]=_['intersection'](_0x2cd88a[_0xf36b('0x36')],qs[_0xf36b('0x3b')](_0x1808e4[_0xf36b('0x37')][_0xf36b('0x3b')]));_0xe45b47['attributes']=_0xe45b47['attributes']['length']?_0xe45b47[_0xf36b('0x3a')]:_0x2cd88a[_0xf36b('0x36')];if(!_0x1808e4[_0xf36b('0x37')][_0xf36b('0x3c')](_0xf36b('0x3d'))){_0xe45b47[_0xf36b('0x23')]=qs[_0xf36b('0x23')](_0x1808e4['query'][_0xf36b('0x23')]);_0xe45b47[_0xf36b('0x21')]=qs[_0xf36b('0x21')](_0x1808e4['query'][_0xf36b('0x21')]);}_0xe45b47[_0xf36b('0x3e')]=qs[_0xf36b('0x3f')](_0x1808e4[_0xf36b('0x37')]['sort']);_0xe45b47[_0xf36b('0x40')]=qs['filters'](_[_0xf36b('0x41')](_0x1808e4[_0xf36b('0x37')],_0x2cd88a['filters']),_0x391523);if(_0x1808e4[_0xf36b('0x37')]['filter']){_0xe45b47[_0xf36b('0x40')]=_[_0xf36b('0x42')](_0xe45b47['where'],{'$or':_[_0xf36b('0x31')](_0x391523,function(_0x3cddcf){if(_0x3cddcf['type']!==_0xf36b('0x43')){var _0x3634a8={};_0x3634a8[_0x3cddcf[_0xf36b('0x2e')]]={'$like':'%'+_0x1808e4['query'][_0xf36b('0x44')]+'%'};return _0x3634a8;}})});}_0xe45b47=_[_0xf36b('0x42')]({},_0xe45b47,_0x1808e4['options']);var _0x49a4f7={'where':_0xe45b47['where']};return db[_0xf36b('0x45')]['count'](_0x49a4f7)['then'](function(_0xa515ff){_0x2e7340['count']=_0xa515ff;if(_0x1808e4['query'][_0xf36b('0x46')]){_0xe45b47['include']=[{'all':!![]}];}return db[_0xf36b('0x45')][_0xf36b('0x47')](_0xe45b47);})['then'](function(_0x1de91f){_0x2e7340[_0xf36b('0x48')]=_0x1de91f;return _0x2e7340;})['then'](respondWithFilteredResult(_0x2fe143,_0xe45b47))['catch'](handleError(_0x2fe143,null));};exports[_0xf36b('0x49')]=function(_0x3c4c50,_0x27555b){var _0x2b91f5={'raw':![],'where':{'id':_0x3c4c50['params']['id']}},_0x1393d9={};_0x1393d9[_0xf36b('0x36')]=_[_0xf36b('0x4a')](db[_0xf36b('0x45')][_0xf36b('0x32')]);_0x1393d9[_0xf36b('0x37')]=_[_0xf36b('0x4a')](_0x3c4c50['query']);_0x1393d9['filters']=_[_0xf36b('0x39')](_0x1393d9[_0xf36b('0x36')],_0x1393d9[_0xf36b('0x37')]);_0x2b91f5['attributes']=_[_0xf36b('0x39')](_0x1393d9['model'],qs['fields'](_0x3c4c50['query']['fields']));_0x2b91f5['attributes']=_0x2b91f5['attributes'][_0xf36b('0x4b')]?_0x2b91f5['attributes']:_0x1393d9['model'];if(_0x3c4c50[_0xf36b('0x37')]['includeAll']){_0x2b91f5[_0xf36b('0x4c')]=[{'all':!![]}];}_0x2b91f5=_[_0xf36b('0x42')]({},_0x2b91f5,_0x3c4c50[_0xf36b('0x4d')]);return db[_0xf36b('0x45')][_0xf36b('0x4e')](_0x2b91f5)[_0xf36b('0x2c')](handleEntityNotFound(_0x27555b,null))[_0xf36b('0x2c')](respondWithResult(_0x27555b,null))[_0xf36b('0x4f')](handleError(_0x27555b,null));};exports[_0xf36b('0x50')]=function(_0x26c33b,_0xf6d2c7){return db[_0xf36b('0x45')]['create'](_0x26c33b[_0xf36b('0x51')],{})[_0xf36b('0x2c')](respondWithResult(_0xf6d2c7,0xc9))['catch'](handleError(_0xf6d2c7,null));};exports[_0xf36b('0x2b')]=function(_0xd47b9b,_0x304a88){if(_0xd47b9b['body']['id']){delete _0xd47b9b[_0xf36b('0x51')]['id'];}return db[_0xf36b('0x45')][_0xf36b('0x4e')]({'where':{'id':_0xd47b9b['params']['id']}})[_0xf36b('0x2c')](handleEntityNotFound(_0x304a88,null))['then'](saveUpdates(_0xd47b9b[_0xf36b('0x51')],null))[_0xf36b('0x2c')](respondWithResult(_0x304a88,null))[_0xf36b('0x4f')](handleError(_0x304a88,null));};exports[_0xf36b('0x52')]=function(_0x2214db,_0x213603){return db[_0xf36b('0x45')][_0xf36b('0x4e')]({'where':{'id':_0x2214db[_0xf36b('0x53')]['id']}})[_0xf36b('0x2c')](handleEntityNotFound(_0x213603,null))[_0xf36b('0x2c')](removeEntity(_0x213603,null))[_0xf36b('0x4f')](handleError(_0x213603,null));};exports[_0xf36b('0x54')]=function(_0x2df1ed,_0x5291ca,_0x1bb697){var _0x400a08={};var _0x4e2af6={};var _0x40b540;var _0x3eb635;return db[_0xf36b('0x45')]['findOne']({'where':{'id':_0x2df1ed[_0xf36b('0x53')]['id']}})[_0xf36b('0x2c')](handleEntityNotFound(_0x5291ca,null))[_0xf36b('0x2c')](function(_0x239688){if(_0x239688){_0x40b540=_0x239688;_0x4e2af6[_0xf36b('0x36')]=_[_0xf36b('0x4a')](db[_0xf36b('0x55')][_0xf36b('0x32')]);_0x4e2af6[_0xf36b('0x37')]=_[_0xf36b('0x4a')](_0x2df1ed[_0xf36b('0x37')]);_0x4e2af6[_0xf36b('0x38')]=_[_0xf36b('0x39')](_0x4e2af6[_0xf36b('0x36')],_0x4e2af6[_0xf36b('0x37')]);_0x400a08[_0xf36b('0x3a')]=_[_0xf36b('0x39')](_0x4e2af6[_0xf36b('0x36')],qs['fields'](_0x2df1ed['query']['fields']));_0x400a08[_0xf36b('0x3a')]=_0x400a08['attributes'][_0xf36b('0x4b')]?_0x400a08[_0xf36b('0x3a')]:_0x4e2af6[_0xf36b('0x36')];_0x400a08['order']=qs[_0xf36b('0x3f')](_0x2df1ed[_0xf36b('0x37')][_0xf36b('0x3f')]);_0x400a08[_0xf36b('0x40')]=qs[_0xf36b('0x38')](_[_0xf36b('0x41')](_0x2df1ed[_0xf36b('0x37')],_0x4e2af6[_0xf36b('0x38')]));if(_0x2df1ed['query'][_0xf36b('0x44')]){_0x400a08[_0xf36b('0x40')]=_['merge'](_0x400a08[_0xf36b('0x40')],{'$or':_[_0xf36b('0x31')](_0x400a08['attributes'],function(_0x4baeb1){var _0x26a547={};_0x26a547[_0x4baeb1]={'$like':'%'+_0x2df1ed[_0xf36b('0x37')][_0xf36b('0x44')]+'%'};return _0x26a547;})});}_0x400a08=_[_0xf36b('0x42')]({},_0x400a08,_0x2df1ed[_0xf36b('0x4d')]);return _0x40b540['getConfigurations'](_0x400a08);}})[_0xf36b('0x2c')](function(_0x4861da){if(_0x4861da){_0x3eb635=_0x4861da[_0xf36b('0x4b')];if(!_0x2df1ed[_0xf36b('0x37')][_0xf36b('0x3c')](_0xf36b('0x3d'))){_0x400a08[_0xf36b('0x23')]=qs[_0xf36b('0x23')](_0x2df1ed['query']['limit']);_0x400a08['offset']=qs[_0xf36b('0x21')](_0x2df1ed[_0xf36b('0x37')]['offset']);}return _0x40b540[_0xf36b('0x54')](_0x400a08);}})[_0xf36b('0x2c')](function(_0x240443){if(_0x240443){return _0x240443?{'count':_0x3eb635,'rows':_0x240443}:null;}})[_0xf36b('0x2c')](respondWithResult(_0x5291ca,null))[_0xf36b('0x4f')](handleError(_0x5291ca,null));};exports[_0xf36b('0x56')]=function(_0x2a908d,_0x2eeb47,_0x70a3cf){if(_0x2a908d[_0xf36b('0x51')]['id']){delete _0x2a908d['body']['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x2a908d[_0xf36b('0x53')]['id']}})[_0xf36b('0x2c')](handleEntityNotFound(_0x2eeb47,null))[_0xf36b('0x2c')](function(_0x14b1ec){if(_0x14b1ec){_0x2a908d[_0xf36b('0x51')][_0xf36b('0x57')]=_0x14b1ec['id'];_0x2a908d[_0xf36b('0x51')][_0xf36b('0x58')]=integrations[_0xf36b('0x59')](_0x2a908d['body'][_0xf36b('0x5a')],_0x2a908d[_0xf36b('0x51')][_0xf36b('0x34')]);_0x2a908d[_0xf36b('0x51')][_0xf36b('0x5b')]=integrations['getDescriptions'](_0x2a908d[_0xf36b('0x51')][_0xf36b('0x5a')],_0x2a908d[_0xf36b('0x51')][_0xf36b('0x34')]);return db[_0xf36b('0x55')][_0xf36b('0x50')](_0x2a908d[_0xf36b('0x51')],{'include':[{'model':db[_0xf36b('0x5c')],'as':_0xf36b('0x58')},{'model':db[_0xf36b('0x5c')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2eeb47,null))[_0xf36b('0x4f')](handleError(_0x2eeb47,null));};exports[_0xf36b('0x5d')]=function(_0x4fa006,_0x18809c,_0x2866b5){var _0x574240=[_0xf36b('0x5e'),_0xf36b('0x5f'),'knowledge',_0xf36b('0x60'),_0xf36b('0x61'),'notify','incident_state',_0xf36b('0x62'),_0xf36b('0x63')];var _0x107529=['parent','made_sla',_0xf36b('0x64'),'watch_list','upon_reject',_0xf36b('0x65'),'child_incidents',_0xf36b('0x5f'),_0xf36b('0x66'),_0xf36b('0x67'),_0xf36b('0x68'),'sys_updated_by',_0xf36b('0x69'),_0xf36b('0x6a'),_0xf36b('0x6b'),'sys_domain',_0xf36b('0x6c'),_0xf36b('0x6d'),_0xf36b('0x6e'),'order',_0xf36b('0x6f'),_0xf36b('0x70'),_0xf36b('0x71'),_0xf36b('0x72'),_0xf36b('0x73'),'active','work_notes_list',_0xf36b('0x74'),_0xf36b('0x75'),_0xf36b('0x76'),_0xf36b('0x77'),_0xf36b('0x78'),'expected_start',_0xf36b('0x79'),_0xf36b('0x7a'),_0xf36b('0x7b'),_0xf36b('0x7c'),'reopened_time',_0xf36b('0x7d'),_0xf36b('0x7e'),_0xf36b('0x7f'),_0xf36b('0x60'),_0xf36b('0x80'),_0xf36b('0x81'),_0xf36b('0x61'),'correlation_display',_0xf36b('0x82'),_0xf36b('0x83'),_0xf36b('0x84'),_0xf36b('0x85'),_0xf36b('0x86'),'description','calendar_duration','notify',_0xf36b('0x87'),_0xf36b('0x88'),_0xf36b('0x89'),'follow_up','parent_incident',_0xf36b('0x8a'),_0xf36b('0x8b'),_0xf36b('0x8c'),_0xf36b('0x8d'),_0xf36b('0x8e'),_0xf36b('0x8f'),'company',_0xf36b('0x90'),_0xf36b('0x91'),'assigned_to',_0xf36b('0x62'),_0xf36b('0x92'),'sla_due',_0xf36b('0x93'),_0xf36b('0x94'),_0xf36b('0x95'),'sys_mod_count',_0xf36b('0x96'),_0xf36b('0x97'),_0xf36b('0x98'),_0xf36b('0x99'),_0xf36b('0x9a'),_0xf36b('0x9b'),'category'];var _0x1968d8='';var _0x3dbd65='';var _0x254d05=[];var _0x9480c6='';var _0x2d5f17='';var _0x2494c=[];var _0x17e6dd='';var _0x4bef75='';var _0x4e63ed={};var _0x5ceb94='';return db[_0xf36b('0x45')]['findOne']({'where':{'id':_0x4fa006[_0xf36b('0x53')]['id']},'attributes':['id',_0xf36b('0x9c'),_0xf36b('0x9d'),_0xf36b('0x9e'),'remoteUri',_0xf36b('0x9f')]})[_0xf36b('0x2c')](handleEntityNotFound(_0x18809c,null))[_0xf36b('0x2c')](function(_0xd0d6d5){if(_0xd0d6d5){_0x5ceb94=_0xd0d6d5[_0xf36b('0xa0')];var _0x405c3f=_0x5ceb94[_0xf36b('0xa1')](-0x1);if(_0x405c3f==='/'){_0x5ceb94=_0x5ceb94[_0xf36b('0xa2')](0x0,_0x5ceb94[_0xf36b('0xa3')](_0x405c3f));}_0x4bef75=util[_0xf36b('0xa4')]('%s/api/now/doc/table/schema/',_0x5ceb94);_0x17e6dd=util[_0xf36b('0xa4')](_0xf36b('0xa5'),_0x5ceb94);_0x4e63ed={'user':_0xd0d6d5[_0xf36b('0x9c')],'pass':_0xd0d6d5[_0xf36b('0x9d')]};var _0x1b611d={'method':_0xf36b('0xa6'),'uri':_0x4bef75+'incident?sysparm_display_value=all','auth':_0x4e63ed,'json':!![]};return rp(_0x1b611d);}})['then'](function(_0x20befb){if(_0x20befb[_0xf36b('0xa7')][_0xf36b('0x4b')]>0x0){_0x1968d8=_0x20befb[_0xf36b('0xa7')];}console[_0xf36b('0xa8')]('incident\x20table\x20objects',_0x1968d8);_0x2494c=[];_0x3dbd65=Object['assign']([],_0x1968d8);_[_0xf36b('0xa9')](_0x3dbd65,function(_0x1ebb8a){return!_0x574240[_0xf36b('0xaa')](_0x1ebb8a['name']);});_0x3dbd65[_0xf36b('0xab')](function(_0xd90584){var _0x424ad9=createFieldObject(_0x17e6dd,_0x4e63ed,_0xd90584[_0xf36b('0xac')],_0xd90584['name'],_0xd90584[_0xf36b('0xad')],![]);_0x2494c['push'](_0x424ad9);});return Promise['all'](_0x2494c);})[_0xf36b('0x2c')](function(_0x224471){_0x254d05=_0x224471;_0x9480c6=Object['assign']([],_0x1968d8);console[_0xf36b('0xa8')](_0xf36b('0xae'),_0x1968d8);_[_0xf36b('0xa9')](_0x9480c6,function(_0x69ce6d){return _0x107529[_0xf36b('0xaa')](_0x69ce6d[_0xf36b('0x2e')]);});console[_0xf36b('0xa8')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x9480c6);_0x2494c=[];_0x9480c6['forEach'](function(_0x29e2d4){var _0x5432a1=createFieldObject(_0x17e6dd,_0x4e63ed,_0x29e2d4[_0xf36b('0xac')],_0x29e2d4['name'],_0x29e2d4['label'],!![]);_0x2494c[_0xf36b('0xaf')](_0x5432a1);});return Promise[_0xf36b('0xb0')](_0x2494c);})[_0xf36b('0x2c')](function(_0x2241b9){_0x2d5f17=_0x2241b9;var _0x598232=_0x254d05[_0xf36b('0xb1')](_0x2d5f17);return{'count':_0x598232[_0xf36b('0x4b')],'rows':_0x598232};})[_0xf36b('0x2c')](respondWithResult(_0x18809c,null))[_0xf36b('0x4f')](function(_0x481755){console[_0xf36b('0xa8')](_0xf36b('0xb2')+_0x481755);var _0xba025d=_0x4fa006[_0xf36b('0x37')][_0xf36b('0xb3')]?0x1f4:_0x481755[_0xf36b('0xb4')]||0x1f4;logger[_0xf36b('0xb5')](_0x481755['stack']);delete _0x481755['name'];if(_0xba025d===0x191){_0xba025d=0x190;}_0x18809c[_0xf36b('0x1f')](_0xba025d)[_0xf36b('0x2f')](_0x4fa006['query']['test']?{'message':_0xf36b('0xb6'),'statusCode':_0x481755['statusCode']}:_0x481755);});};function createFieldObject(_0x4257ef,_0x26f3af,_0x21ee6e,_0x23358,_0x50f95c,_0x226e57){return new Promise(function(_0x3e2015,_0x12e69d){var _0x267ff1={'id':_0x23358,'name':_0x50f95c,'custom':_0x226e57};if(_0x21ee6e==='boolean'){_0x267ff1[_0xf36b('0x4d')]=[{'name':'True','value':'true'},{'name':_0xf36b('0xb7'),'value':_0xf36b('0xb8')}];_0x3e2015(_0x267ff1);}else{var _0x20f375={'method':'GET','uri':_0x4257ef+'sys_choice?sysparm_query=name=incident^element='+_0x23358,'auth':_0x26f3af,'json':!![]};return rp(_0x20f375)['then'](function(_0x2d4752){var _0x3a6232=[];if(_0x2d4752['result'][_0xf36b('0x4b')]>0x0){_0x2d4752['result'][_0xf36b('0xab')](function(_0x1d72cc){if(_0x1d72cc[_0xf36b('0xb9')]===_0xf36b('0xb8')){var _0x3ec607={'name':_0x1d72cc[_0xf36b('0xad')],'value':_0x1d72cc['value']};_0x3a6232[_0xf36b('0xaf')](_0x3ec607);}});}_0x267ff1['options']=_0x3a6232;if(_0x267ff1[_0xf36b('0x4d')][_0xf36b('0x4b')]>0x0){_0x3e2015(_0x267ff1);}else{if(_0x226e57==![]){_0x3e2015();}else{_0x3e2015(_0x267ff1);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 41ea887..d6e85f9 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 _0x7da7=['../../config/environment','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7da7,0x10d));var _0x77da=function(_0x4cc03b,_0x299f1c){_0x4cc03b=_0x4cc03b-0x0;var _0xf0358c=_0x7da7[_0x4cc03b];return _0xf0358c;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var logger=require(_0x77da('0x2'))('api');var moment=require('moment');var BPromise=require(_0x77da('0x3'));var rp=require(_0x77da('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x77da('0x7'));module[_0x77da('0x8')]=function(_0x47da81,_0x30afe0){return _0x47da81['define'](_0x77da('0x9'),attributes,{'tableName':_0x77da('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae24=['../../config/logger','moment','bluebird','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','lodash'];(function(_0x3f156a,_0x4b9a0c){var _0x14f6f8=function(_0x2d43ec){while(--_0x2d43ec){_0x3f156a['push'](_0x3f156a['shift']());}};_0x14f6f8(++_0x4b9a0c);}(_0xae24,0x182));var _0x4ae2=function(_0x133ed8,_0x44a687){_0x133ed8=_0x133ed8-0x0;var _0x49d737=_0xae24[_0x133ed8];return _0x49d737;};'use strict';var _=require(_0x4ae2('0x0'));var util=require('util');var logger=require(_0x4ae2('0x1'))('api');var moment=require(_0x4ae2('0x2'));var BPromise=require(_0x4ae2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ae2('0x4'));var config=require('../../config/environment');var attributes=require(_0x4ae2('0x5'));var integrations=require(_0x4ae2('0x6'));module[_0x4ae2('0x7')]=function(_0x3e6055,_0x428054){return _0x3e6055[_0x4ae2('0x8')]('ServicenowAccount',attributes,{'tableName':'int_servicenow_accounts','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 1d93d82..d22da9c 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 _0xad66=['findAll','options','attributes','include','map','model','GetServicenowAccount','catch','ShowServicenowAccount','raw','where','then','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','result','ServicenowAccount'];(function(_0x2c0be1,_0x1e88f2){var _0x3d4bd2=function(_0x2b5497){while(--_0x2b5497){_0x2c0be1['push'](_0x2c0be1['shift']());}};_0x3d4bd2(++_0x1e88f2);}(_0xad66,0x8c));var _0x6ad6=function(_0x5296f7,_0x4ce9a2){_0x5296f7=_0x5296f7-0x0;var _0x38b27f=_0xad66[_0x5296f7];return _0x38b27f;};'use strict';var _=require(_0x6ad6('0x0'));var util=require(_0x6ad6('0x1'));var moment=require(_0x6ad6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ad6('0x3'));var db=require(_0x6ad6('0x4'))['db'];var utils=require(_0x6ad6('0x5'));var logger=require(_0x6ad6('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6ad6('0x7'));var client=jayson[_0x6ad6('0x8')][_0x6ad6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51942e,_0x2c1eae,_0x57fa75){return new BPromise(function(_0xe45687,_0x484237){return client['request'](_0x51942e,_0x57fa75)['then'](function(_0x4a22ce){logger[_0x6ad6('0xa')]('ServicenowAccount,\x20%s,\x20%s',_0x2c1eae,_0x6ad6('0xb'));logger[_0x6ad6('0xc')](_0x6ad6('0xd'),_0x2c1eae,_0x6ad6('0xb'),JSON[_0x6ad6('0xe')](_0x4a22ce));if(_0x4a22ce[_0x6ad6('0xf')]){if(_0x4a22ce[_0x6ad6('0xf')]['code']===0x1f4){logger[_0x6ad6('0xf')](_0x6ad6('0x10'),_0x2c1eae,_0x4a22ce['error'][_0x6ad6('0x11')]);return _0x484237(_0x4a22ce[_0x6ad6('0xf')][_0x6ad6('0x11')]);}logger[_0x6ad6('0xf')](_0x6ad6('0x10'),_0x2c1eae,_0x4a22ce[_0x6ad6('0xf')]['message']);return _0xe45687(_0x4a22ce[_0x6ad6('0xf')][_0x6ad6('0x11')]);}else{logger[_0x6ad6('0xa')](_0x6ad6('0x10'),_0x2c1eae,_0x6ad6('0xb'));_0xe45687(_0x4a22ce[_0x6ad6('0x12')][_0x6ad6('0x11')]);}})['catch'](function(_0x5b542a){logger[_0x6ad6('0xf')](_0x6ad6('0x10'),_0x2c1eae,_0x5b542a);_0x484237(_0x5b542a);});});}exports['GetServicenowAccount']=function(_0x1b9cef){var _0x27d817=this;return new Promise(function(_0x16b632,_0x33dab9){return db[_0x6ad6('0x13')][_0x6ad6('0x14')]({'raw':_0x1b9cef[_0x6ad6('0x15')]?_0x1b9cef[_0x6ad6('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1b9cef[_0x6ad6('0x15')]?_0x1b9cef[_0x6ad6('0x15')]['where']||null:null,'attributes':_0x1b9cef[_0x6ad6('0x15')]?_0x1b9cef['options'][_0x6ad6('0x16')]||null:null,'limit':_0x1b9cef[_0x6ad6('0x15')]?_0x1b9cef['options']['limit']||null:null,'include':_0x1b9cef[_0x6ad6('0x15')]?_0x1b9cef['options'][_0x6ad6('0x17')]?_[_0x6ad6('0x18')](_0x1b9cef['options'][_0x6ad6('0x17')],function(_0x5dfe49){return{'model':db[_0x5dfe49[_0x6ad6('0x19')]],'as':_0x5dfe49['as'],'attributes':_0x5dfe49[_0x6ad6('0x16')],'include':_0x5dfe49[_0x6ad6('0x17')]?_[_0x6ad6('0x18')](_0x5dfe49[_0x6ad6('0x17')],function(_0x2c1704){return{'model':db[_0x2c1704[_0x6ad6('0x19')]],'as':_0x2c1704['as'],'attributes':_0x2c1704['attributes'],'include':_0x2c1704[_0x6ad6('0x17')]?_[_0x6ad6('0x18')](_0x2c1704['include'],function(_0x13a83e){return{'model':db[_0x13a83e[_0x6ad6('0x19')]],'as':_0x13a83e['as'],'attributes':_0x13a83e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x422187){logger[_0x6ad6('0xa')](_0x6ad6('0x1a'),_0x1b9cef);logger[_0x6ad6('0xc')]('GetServicenowAccount',_0x1b9cef,JSON['stringify'](_0x422187));_0x16b632(_0x422187);})[_0x6ad6('0x1b')](function(_0x185e35){logger[_0x6ad6('0xf')]('GetServicenowAccount',_0x185e35[_0x6ad6('0x11')],_0x1b9cef);_0x33dab9(_0x27d817['error'](0x1f4,_0x185e35[_0x6ad6('0x11')]));});});};exports[_0x6ad6('0x1c')]=function(_0x413dc9){var _0x107915=this;return new Promise(function(_0x2f5a09,_0x19663b){return db[_0x6ad6('0x13')]['find']({'raw':_0x413dc9['options']?_0x413dc9[_0x6ad6('0x15')][_0x6ad6('0x1d')]===undefined?!![]:![]:!![],'where':_0x413dc9[_0x6ad6('0x15')]?_0x413dc9['options'][_0x6ad6('0x1e')]||null:null,'attributes':_0x413dc9[_0x6ad6('0x15')]?_0x413dc9[_0x6ad6('0x15')]['attributes']||null:null,'include':_0x413dc9[_0x6ad6('0x15')]?_0x413dc9['options'][_0x6ad6('0x17')]?_[_0x6ad6('0x18')](_0x413dc9[_0x6ad6('0x15')][_0x6ad6('0x17')],function(_0x407a02){return{'model':db[_0x407a02[_0x6ad6('0x19')]],'as':_0x407a02['as'],'attributes':_0x407a02[_0x6ad6('0x16')],'include':_0x407a02[_0x6ad6('0x17')]?_[_0x6ad6('0x18')](_0x407a02[_0x6ad6('0x17')],function(_0x525faa){return{'model':db[_0x525faa[_0x6ad6('0x19')]],'as':_0x525faa['as'],'attributes':_0x525faa['attributes'],'include':_0x525faa[_0x6ad6('0x17')]?_[_0x6ad6('0x18')](_0x525faa[_0x6ad6('0x17')],function(_0x870676){return{'model':db[_0x870676['model']],'as':_0x870676['as'],'attributes':_0x870676['attributes']};}):[]};}):[]};}):[]:[]})[_0x6ad6('0x1f')](function(_0x27723b){logger[_0x6ad6('0xa')](_0x6ad6('0x1c'),_0x413dc9);logger[_0x6ad6('0xc')]('ShowServicenowAccount',_0x413dc9,JSON[_0x6ad6('0xe')](_0x27723b));_0x2f5a09(_0x27723b);})[_0x6ad6('0x1b')](function(_0x599636){logger[_0x6ad6('0xf')]('ShowServicenowAccount',_0x599636[_0x6ad6('0x11')],_0x413dc9);_0x19663b(_0x107915['error'](0x1f4,_0x599636[_0x6ad6('0x11')]));});});}; \ No newline at end of file +var _0x7d54=['util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','include','map','model','ShowServicenowAccount','find','lodash'];(function(_0x165e78,_0x101622){var _0x543aa7=function(_0x4e9511){while(--_0x4e9511){_0x165e78['push'](_0x165e78['shift']());}};_0x543aa7(++_0x101622);}(_0x7d54,0x1bf));var _0x47d5=function(_0x11ae05,_0xb34f47){_0x11ae05=_0x11ae05-0x0;var _0x239c2f=_0x7d54[_0x11ae05];return _0x239c2f;};'use strict';var _=require(_0x47d5('0x0'));var util=require(_0x47d5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47d5('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x47d5('0x3'));var logger=require(_0x47d5('0x4'))(_0x47d5('0x5'));var config=require(_0x47d5('0x6'));var jayson=require(_0x47d5('0x7'));var client=jayson['client'][_0x47d5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24732b,_0x36b33c,_0x5a671b){return new BPromise(function(_0x16f138,_0x1e657d){return client['request'](_0x24732b,_0x5a671b)[_0x47d5('0x9')](function(_0x57693a){logger[_0x47d5('0xa')](_0x47d5('0xb'),_0x36b33c,_0x47d5('0xc'));logger[_0x47d5('0xd')](_0x47d5('0xe'),_0x36b33c,_0x47d5('0xc'),JSON[_0x47d5('0xf')](_0x57693a));if(_0x57693a['error']){if(_0x57693a[_0x47d5('0x10')][_0x47d5('0x11')]===0x1f4){logger[_0x47d5('0x10')](_0x47d5('0xb'),_0x36b33c,_0x57693a['error']['message']);return _0x1e657d(_0x57693a['error']['message']);}logger[_0x47d5('0x10')](_0x47d5('0xb'),_0x36b33c,_0x57693a[_0x47d5('0x10')][_0x47d5('0x12')]);return _0x16f138(_0x57693a[_0x47d5('0x10')][_0x47d5('0x12')]);}else{logger['info'](_0x47d5('0xb'),_0x36b33c,_0x47d5('0xc'));_0x16f138(_0x57693a[_0x47d5('0x13')]['message']);}})[_0x47d5('0x14')](function(_0x33ab59){logger[_0x47d5('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x36b33c,_0x33ab59);_0x1e657d(_0x33ab59);});});}exports[_0x47d5('0x15')]=function(_0x3f7b44){var _0x5783bb=this;return new Promise(function(_0x313442,_0x4cc068){return db[_0x47d5('0x16')]['findAll']({'raw':_0x3f7b44[_0x47d5('0x17')]?_0x3f7b44[_0x47d5('0x17')][_0x47d5('0x18')]===undefined?!![]:![]:!![],'where':_0x3f7b44[_0x47d5('0x17')]?_0x3f7b44[_0x47d5('0x17')][_0x47d5('0x19')]||null:null,'attributes':_0x3f7b44[_0x47d5('0x17')]?_0x3f7b44['options'][_0x47d5('0x1a')]||null:null,'limit':_0x3f7b44[_0x47d5('0x17')]?_0x3f7b44[_0x47d5('0x17')]['limit']||null:null,'include':_0x3f7b44['options']?_0x3f7b44[_0x47d5('0x17')][_0x47d5('0x1b')]?_[_0x47d5('0x1c')](_0x3f7b44[_0x47d5('0x17')][_0x47d5('0x1b')],function(_0x496b05){return{'model':db[_0x496b05[_0x47d5('0x1d')]],'as':_0x496b05['as'],'attributes':_0x496b05[_0x47d5('0x1a')],'include':_0x496b05[_0x47d5('0x1b')]?_['map'](_0x496b05[_0x47d5('0x1b')],function(_0x5d896d){return{'model':db[_0x5d896d[_0x47d5('0x1d')]],'as':_0x5d896d['as'],'attributes':_0x5d896d[_0x47d5('0x1a')],'include':_0x5d896d[_0x47d5('0x1b')]?_[_0x47d5('0x1c')](_0x5d896d['include'],function(_0x273020){return{'model':db[_0x273020['model']],'as':_0x273020['as'],'attributes':_0x273020[_0x47d5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e3170){logger[_0x47d5('0xa')](_0x47d5('0x15'),_0x3f7b44);logger['debug']('GetServicenowAccount',_0x3f7b44,JSON[_0x47d5('0xf')](_0x4e3170));_0x313442(_0x4e3170);})[_0x47d5('0x14')](function(_0x47ad1d){logger['error'](_0x47d5('0x15'),_0x47ad1d[_0x47d5('0x12')],_0x3f7b44);_0x4cc068(_0x5783bb[_0x47d5('0x10')](0x1f4,_0x47ad1d['message']));});});};exports[_0x47d5('0x1e')]=function(_0x13c6b6){var _0x2c925a=this;return new Promise(function(_0x4fc295,_0x2b7d16){return db[_0x47d5('0x16')][_0x47d5('0x1f')]({'raw':_0x13c6b6[_0x47d5('0x17')]?_0x13c6b6[_0x47d5('0x17')][_0x47d5('0x18')]===undefined?!![]:![]:!![],'where':_0x13c6b6[_0x47d5('0x17')]?_0x13c6b6['options']['where']||null:null,'attributes':_0x13c6b6[_0x47d5('0x17')]?_0x13c6b6[_0x47d5('0x17')][_0x47d5('0x1a')]||null:null,'include':_0x13c6b6['options']?_0x13c6b6[_0x47d5('0x17')][_0x47d5('0x1b')]?_[_0x47d5('0x1c')](_0x13c6b6[_0x47d5('0x17')]['include'],function(_0x1fd208){return{'model':db[_0x1fd208[_0x47d5('0x1d')]],'as':_0x1fd208['as'],'attributes':_0x1fd208[_0x47d5('0x1a')],'include':_0x1fd208[_0x47d5('0x1b')]?_[_0x47d5('0x1c')](_0x1fd208[_0x47d5('0x1b')],function(_0x28aa44){return{'model':db[_0x28aa44['model']],'as':_0x28aa44['as'],'attributes':_0x28aa44['attributes'],'include':_0x28aa44[_0x47d5('0x1b')]?_[_0x47d5('0x1c')](_0x28aa44[_0x47d5('0x1b')],function(_0x53e22e){return{'model':db[_0x53e22e[_0x47d5('0x1d')]],'as':_0x53e22e['as'],'attributes':_0x53e22e[_0x47d5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47d5('0x9')](function(_0x79756d){logger[_0x47d5('0xa')](_0x47d5('0x1e'),_0x13c6b6);logger[_0x47d5('0xd')](_0x47d5('0x1e'),_0x13c6b6,JSON[_0x47d5('0xf')](_0x79756d));_0x4fc295(_0x79756d);})[_0x47d5('0x14')](function(_0x129707){logger['error']('ShowServicenowAccount',_0x129707[_0x47d5('0x12')],_0x13c6b6);_0x2b7d16(_0x2c925a['error'](0x1f4,_0x129707[_0x47d5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 4cca088..3d2269b 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 _0xd0cb=['delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update'];(function(_0x52bf63,_0x46988a){var _0x95fb12=function(_0x2a5a04){while(--_0x2a5a04){_0x52bf63['push'](_0x52bf63['shift']());}};_0x95fb12(++_0x46988a);}(_0xd0cb,0x172));var _0xbd0c=function(_0x7ca4f8,_0x40c975){_0x7ca4f8=_0x7ca4f8-0x0;var _0x15ee1f=_0xd0cb[_0x7ca4f8];return _0x15ee1f;};'use strict';var multer=require(_0xbd0c('0x0'));var util=require(_0xbd0c('0x1'));var path=require(_0xbd0c('0x2'));var timeout=require(_0xbd0c('0x3'));var express=require('express');var router=express[_0xbd0c('0x4')]();var fs_extra=require(_0xbd0c('0x5'));var auth=require(_0xbd0c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbd0c('0x7'));var controller=require(_0xbd0c('0x8'));router[_0xbd0c('0x9')]('/',auth[_0xbd0c('0xa')](),controller['index']);router[_0xbd0c('0x9')](_0xbd0c('0xb'),auth[_0xbd0c('0xa')](),controller[_0xbd0c('0xc')]);router[_0xbd0c('0x9')](_0xbd0c('0xd'),auth[_0xbd0c('0xa')](),controller['getFields']);router['get'](_0xbd0c('0xe'),auth[_0xbd0c('0xa')](),controller[_0xbd0c('0xf')]);router[_0xbd0c('0x9')](_0xbd0c('0x10'),auth['isAuthenticated'](),controller[_0xbd0c('0x11')]);router[_0xbd0c('0x12')]('/',auth['isAuthenticated'](),controller[_0xbd0c('0x13')]);router['put']('/:id',auth[_0xbd0c('0xa')](),controller[_0xbd0c('0x14')]);router[_0xbd0c('0x15')](_0xbd0c('0xb'),auth['isAuthenticated'](),controller[_0xbd0c('0x16')]);module['exports']=router; \ No newline at end of file +var _0x13f7=['/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated'];(function(_0x12bf2e,_0xf63543){var _0x59f034=function(_0x1b1411){while(--_0x1b1411){_0x12bf2e['push'](_0x12bf2e['shift']());}};_0x59f034(++_0xf63543);}(_0x13f7,0x1ed));var _0x713f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x13f7[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x713f('0x0'));var path=require(_0x713f('0x1'));var timeout=require(_0x713f('0x2'));var express=require(_0x713f('0x3'));var router=express[_0x713f('0x4')]();var fs_extra=require(_0x713f('0x5'));var auth=require(_0x713f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x713f('0x7'));var controller=require(_0x713f('0x8'));router[_0x713f('0x9')]('/',auth[_0x713f('0xa')](),controller['index']);router[_0x713f('0x9')](_0x713f('0xb'),auth[_0x713f('0xa')](),controller['show']);router['get'](_0x713f('0xc'),auth[_0x713f('0xa')](),controller[_0x713f('0xd')]);router['get'](_0x713f('0xe'),auth[_0x713f('0xa')](),controller[_0x713f('0xf')]);router[_0x713f('0x9')](_0x713f('0x10'),auth[_0x713f('0xa')](),controller[_0x713f('0x11')]);router[_0x713f('0x12')]('/',auth[_0x713f('0xa')](),controller[_0x713f('0x13')]);router['put'](_0x713f('0xb'),auth['isAuthenticated'](),controller[_0x713f('0x14')]);router[_0x713f('0x15')](_0x713f('0xb'),auth[_0x713f('0xa')](),controller[_0x713f('0x16')]);module[_0x713f('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 4061e23..a49fd34 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 _0xd7e8=['STRING','sequelize','exports'];(function(_0x6e1d8b,_0x770d04){var _0x2a9945=function(_0x3f3f88){while(--_0x3f3f88){_0x6e1d8b['push'](_0x6e1d8b['shift']());}};_0x2a9945(++_0x770d04);}(_0xd7e8,0x133));var _0x8d7e=function(_0x404eac,_0x3d9587){_0x404eac=_0x404eac-0x0;var _0x4ca3d9=_0xd7e8[_0x404eac];return _0x4ca3d9;};'use strict';var Sequelize=require(_0x8d7e('0x0'));module[_0x8d7e('0x1')]={'name':{'type':Sequelize[_0x8d7e('0x2')]},'description':{'type':Sequelize[_0x8d7e('0x2')]}}; \ No newline at end of file +var _0x9bf4=['STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9bf4,0x69));var _0x49bf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9bf4[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x49bf('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x49bf('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 50c4792..a54a223 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 _0x36d5=['sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','apply','update','then','destroy','sendStatus','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','findOne','getFields','getSubjects','ServicenowField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x2a73f9,_0x33a927){var _0x22b2fc=function(_0x3cf7a1){while(--_0x3cf7a1){_0x2a73f9['push'](_0x2a73f9['shift']());}};_0x22b2fc(++_0x33a927);}(_0x36d5,0xde));var _0x536d=function(_0x5f3309,_0x37871b){_0x5f3309=_0x5f3309-0x0;var _0xea65ec=_0x36d5[_0x5f3309];return _0xea65ec;};'use strict';var emlformat=require(_0x536d('0x0'));var rimraf=require(_0x536d('0x1'));var zipdir=require(_0x536d('0x2'));var jsonpatch=require(_0x536d('0x3'));var rp=require('request-promise');var moment=require(_0x536d('0x4'));var BPromise=require(_0x536d('0x5'));var Mustache=require(_0x536d('0x6'));var util=require(_0x536d('0x7'));var path=require(_0x536d('0x8'));var sox=require(_0x536d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x536d('0xa'));var _=require(_0x536d('0xb'));var squel=require(_0x536d('0xc'));var crypto=require(_0x536d('0xd'));var jsforce=require(_0x536d('0xe'));var deskjs=require(_0x536d('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x536d('0x10'));var Redis=require(_0x536d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x536d('0x12'));var as=require(_0x536d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x536d('0x14'));var utils=require('../../config/utils');var config=require(_0x536d('0x15'));var licenseUtil=require(_0x536d('0x16'));var db=require(_0x536d('0x17'))['db'];function respondWithStatusCode(_0x4b9322,_0x239d80){_0x239d80=_0x239d80||0xcc;return function(_0x1676e5){if(_0x1676e5){return _0x4b9322['sendStatus'](_0x239d80);}return _0x4b9322[_0x536d('0x18')](_0x239d80)[_0x536d('0x19')]();};}function respondWithResult(_0xc08e96,_0x58a66f){_0x58a66f=_0x58a66f||0xc8;return function(_0x29c583){if(_0x29c583){return _0xc08e96['status'](_0x58a66f)[_0x536d('0x1a')](_0x29c583);}};}function respondWithFilteredResult(_0x442cea,_0x4b173e){return function(_0x57cd59){if(_0x57cd59){var _0x11d84f=typeof _0x4b173e['offset']===_0x536d('0x1b')&&typeof _0x4b173e[_0x536d('0x1c')]===_0x536d('0x1b');var _0x1fd3af=_0x57cd59[_0x536d('0x1d')];var _0x507913=_0x11d84f?0x0:_0x4b173e[_0x536d('0x1e')];var _0x1ae3cd=_0x11d84f?_0x57cd59[_0x536d('0x1d')]:_0x4b173e[_0x536d('0x1e')]+_0x4b173e[_0x536d('0x1c')];var _0x2fbfb5;if(_0x1ae3cd>=_0x1fd3af){_0x1ae3cd=_0x1fd3af;_0x2fbfb5=0xc8;}else{_0x2fbfb5=0xce;}_0x442cea[_0x536d('0x18')](_0x2fbfb5);return _0x442cea['set']('Content-Range',_0x507913+'-'+_0x1ae3cd+'/'+_0x1fd3af)[_0x536d('0x1a')](_0x57cd59);}return null;};}function patchUpdates(_0x3ac5f9){return function(_0x4a3300){try{jsonpatch[_0x536d('0x1f')](_0x4a3300,_0x3ac5f9,!![]);}catch(_0x572649){return BPromise['reject'](_0x572649);}return _0x4a3300['save']();};}function saveUpdates(_0x1faa70,_0x46bdd4){return function(_0x14549e){if(_0x14549e){return _0x14549e[_0x536d('0x20')](_0x1faa70)[_0x536d('0x21')](function(_0x58aa39){return _0x58aa39;});}return null;};}function removeEntity(_0x142803,_0x36d110){return function(_0x5bc125){if(_0x5bc125){return _0x5bc125[_0x536d('0x22')]()['then'](function(){_0x142803[_0x536d('0x18')](0xcc)[_0x536d('0x19')]();});}};}function handleEntityNotFound(_0x9fd77f,_0x2d2b1c){return function(_0x2ff110){if(!_0x2ff110){_0x9fd77f[_0x536d('0x23')](0x194);}return _0x2ff110;};}function handleError(_0x514636,_0x134678){_0x134678=_0x134678||0x1f4;return function(_0x2b6ec1){logger['error'](_0x2b6ec1['stack']);if(_0x2b6ec1[_0x536d('0x24')]){delete _0x2b6ec1[_0x536d('0x24')];}_0x514636[_0x536d('0x18')](_0x134678)[_0x536d('0x25')](_0x2b6ec1);};}exports[_0x536d('0x26')]=function(_0x2123d2,_0x380c6e){var _0x42b2c3={},_0x156756={},_0x4b4c15={'count':0x0,'rows':[]};var _0x1f3620=_[_0x536d('0x27')](db[_0x536d('0x28')][_0x536d('0x29')],function(_0x3115b1){return{'name':_0x3115b1[_0x536d('0x2a')],'type':_0x3115b1['type'][_0x536d('0x2b')]};});_0x156756['model']=_[_0x536d('0x27')](_0x1f3620,_0x536d('0x24'));_0x156756[_0x536d('0x2c')]=_[_0x536d('0x2d')](_0x2123d2['query']);_0x156756[_0x536d('0x2e')]=_[_0x536d('0x2f')](_0x156756[_0x536d('0x30')],_0x156756[_0x536d('0x2c')]);_0x42b2c3['attributes']=_[_0x536d('0x2f')](_0x156756[_0x536d('0x30')],qs[_0x536d('0x31')](_0x2123d2[_0x536d('0x2c')][_0x536d('0x31')]));_0x42b2c3[_0x536d('0x32')]=_0x42b2c3[_0x536d('0x32')][_0x536d('0x33')]?_0x42b2c3[_0x536d('0x32')]:_0x156756[_0x536d('0x30')];if(!_0x2123d2[_0x536d('0x2c')][_0x536d('0x34')](_0x536d('0x35'))){_0x42b2c3[_0x536d('0x1c')]=qs[_0x536d('0x1c')](_0x2123d2[_0x536d('0x2c')][_0x536d('0x1c')]);_0x42b2c3[_0x536d('0x1e')]=qs['offset'](_0x2123d2[_0x536d('0x2c')]['offset']);}_0x42b2c3[_0x536d('0x36')]=qs[_0x536d('0x37')](_0x2123d2[_0x536d('0x2c')]['sort']);_0x42b2c3[_0x536d('0x38')]=qs[_0x536d('0x2e')](_[_0x536d('0x39')](_0x2123d2[_0x536d('0x2c')],_0x156756['filters']),_0x1f3620);if(_0x2123d2[_0x536d('0x2c')][_0x536d('0x3a')]){_0x42b2c3['where']=_[_0x536d('0x3b')](_0x42b2c3[_0x536d('0x38')],{'$or':_['map'](_0x1f3620,function(_0x171442){if(_0x171442['type']!==_0x536d('0x3c')){var _0x4b73da={};_0x4b73da[_0x171442[_0x536d('0x24')]]={'$like':'%'+_0x2123d2[_0x536d('0x2c')][_0x536d('0x3a')]+'%'};return _0x4b73da;}})});}_0x42b2c3=_[_0x536d('0x3b')]({},_0x42b2c3,_0x2123d2[_0x536d('0x3d')]);var _0x3951c8={'where':_0x42b2c3['where']};return db[_0x536d('0x28')][_0x536d('0x1d')](_0x3951c8)['then'](function(_0x52ae41){_0x4b4c15[_0x536d('0x1d')]=_0x52ae41;if(_0x2123d2[_0x536d('0x2c')][_0x536d('0x3e')]){_0x42b2c3[_0x536d('0x3f')]=[{'all':!![]}];}return db[_0x536d('0x28')][_0x536d('0x40')](_0x42b2c3);})[_0x536d('0x21')](function(_0x163cf3){_0x4b4c15[_0x536d('0x41')]=_0x163cf3;return _0x4b4c15;})[_0x536d('0x21')](respondWithFilteredResult(_0x380c6e,_0x42b2c3))['catch'](handleError(_0x380c6e,null));};exports[_0x536d('0x42')]=function(_0x47837b,_0x2c1fb4){var _0x491347={'raw':![],'where':{'id':_0x47837b[_0x536d('0x43')]['id']}},_0x30d039={};_0x30d039['model']=_[_0x536d('0x2d')](db[_0x536d('0x28')][_0x536d('0x29')]);_0x30d039[_0x536d('0x2c')]=_[_0x536d('0x2d')](_0x47837b[_0x536d('0x2c')]);_0x30d039[_0x536d('0x2e')]=_[_0x536d('0x2f')](_0x30d039['model'],_0x30d039['query']);_0x491347[_0x536d('0x32')]=_[_0x536d('0x2f')](_0x30d039[_0x536d('0x30')],qs['fields'](_0x47837b['query'][_0x536d('0x31')]));_0x491347['attributes']=_0x491347[_0x536d('0x32')][_0x536d('0x33')]?_0x491347[_0x536d('0x32')]:_0x30d039[_0x536d('0x30')];if(_0x47837b[_0x536d('0x2c')][_0x536d('0x3e')]){_0x491347[_0x536d('0x3f')]=[{'all':!![]}];}_0x491347=_[_0x536d('0x3b')]({},_0x491347,_0x47837b['options']);return db['ServicenowConfiguration'][_0x536d('0x44')](_0x491347)[_0x536d('0x21')](handleEntityNotFound(_0x2c1fb4,null))['then'](respondWithResult(_0x2c1fb4,null))[_0x536d('0x45')](handleError(_0x2c1fb4,null));};exports[_0x536d('0x46')]=function(_0x2540e2,_0x1ed8f1){return db[_0x536d('0x28')][_0x536d('0x46')](_0x2540e2[_0x536d('0x47')],{})[_0x536d('0x21')](respondWithResult(_0x1ed8f1,0xc9))[_0x536d('0x45')](handleError(_0x1ed8f1,null));};exports[_0x536d('0x20')]=function(_0x416c36,_0x48874e){if(_0x416c36[_0x536d('0x47')]['id']){delete _0x416c36[_0x536d('0x47')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x416c36[_0x536d('0x43')]['id']}})[_0x536d('0x21')](handleEntityNotFound(_0x48874e,null))[_0x536d('0x21')](saveUpdates(_0x416c36[_0x536d('0x47')],null))[_0x536d('0x21')](respondWithResult(_0x48874e,null))[_0x536d('0x45')](handleError(_0x48874e,null));};exports[_0x536d('0x22')]=function(_0x3e4167,_0x312774){return db[_0x536d('0x28')][_0x536d('0x44')]({'where':{'id':_0x3e4167[_0x536d('0x43')]['id']}})[_0x536d('0x21')](handleEntityNotFound(_0x312774,null))[_0x536d('0x21')](removeEntity(_0x312774,null))[_0x536d('0x45')](handleError(_0x312774,null));};exports['getFields']=function(_0x1a8a7a,_0x2090df,_0x47bc36){var _0x3fc77d={};var _0x3a5620={};var _0x80b56e;var _0x2758d7;return db[_0x536d('0x28')][_0x536d('0x48')]({'where':{'id':_0x1a8a7a['params']['id']}})[_0x536d('0x21')](handleEntityNotFound(_0x2090df,null))[_0x536d('0x21')](function(_0xc61eb9){if(_0xc61eb9){_0x80b56e=_0xc61eb9;_0x3a5620[_0x536d('0x30')]=_[_0x536d('0x2d')](db['ServicenowField']['rawAttributes']);_0x3a5620[_0x536d('0x2c')]=_[_0x536d('0x2d')](_0x1a8a7a[_0x536d('0x2c')]);_0x3a5620[_0x536d('0x2e')]=_[_0x536d('0x2f')](_0x3a5620['model'],_0x3a5620[_0x536d('0x2c')]);_0x3fc77d[_0x536d('0x32')]=_[_0x536d('0x2f')](_0x3a5620[_0x536d('0x30')],qs[_0x536d('0x31')](_0x1a8a7a[_0x536d('0x2c')]['fields']));_0x3fc77d[_0x536d('0x32')]=_0x3fc77d[_0x536d('0x32')][_0x536d('0x33')]?_0x3fc77d['attributes']:_0x3a5620[_0x536d('0x30')];_0x3fc77d[_0x536d('0x36')]=qs[_0x536d('0x37')](_0x1a8a7a[_0x536d('0x2c')][_0x536d('0x37')]);_0x3fc77d[_0x536d('0x38')]=qs[_0x536d('0x2e')](_[_0x536d('0x39')](_0x1a8a7a['query'],_0x3a5620[_0x536d('0x2e')]));if(_0x1a8a7a[_0x536d('0x2c')][_0x536d('0x3a')]){_0x3fc77d[_0x536d('0x38')]=_[_0x536d('0x3b')](_0x3fc77d[_0x536d('0x38')],{'$or':_[_0x536d('0x27')](_0x3fc77d[_0x536d('0x32')],function(_0x202688){var _0x2b618b={};_0x2b618b[_0x202688]={'$like':'%'+_0x1a8a7a[_0x536d('0x2c')][_0x536d('0x3a')]+'%'};return _0x2b618b;})});}_0x3fc77d=_['merge']({},_0x3fc77d,_0x1a8a7a[_0x536d('0x3d')]);return _0x80b56e[_0x536d('0x49')](_0x3fc77d);}})[_0x536d('0x21')](function(_0x298e30){if(_0x298e30){_0x2758d7=_0x298e30[_0x536d('0x33')];if(!_0x1a8a7a[_0x536d('0x2c')][_0x536d('0x34')](_0x536d('0x35'))){_0x3fc77d[_0x536d('0x1c')]=qs[_0x536d('0x1c')](_0x1a8a7a[_0x536d('0x2c')][_0x536d('0x1c')]);_0x3fc77d[_0x536d('0x1e')]=qs[_0x536d('0x1e')](_0x1a8a7a['query'][_0x536d('0x1e')]);}return _0x80b56e['getFields'](_0x3fc77d);}})['then'](function(_0x362767){if(_0x362767){return _0x362767?{'count':_0x2758d7,'rows':_0x362767}:null;}})[_0x536d('0x21')](respondWithResult(_0x2090df,null))['catch'](handleError(_0x2090df,null));};exports[_0x536d('0x4a')]=function(_0x5211a8,_0x137e89,_0x51c80f){var _0x5c33bf={};var _0x41a98b={};var _0x388bdb;var _0x4c5f48;return db['ServicenowConfiguration'][_0x536d('0x48')]({'where':{'id':_0x5211a8[_0x536d('0x43')]['id']}})['then'](handleEntityNotFound(_0x137e89,null))[_0x536d('0x21')](function(_0x324790){if(_0x324790){_0x388bdb=_0x324790;_0x41a98b[_0x536d('0x30')]=_[_0x536d('0x2d')](db[_0x536d('0x4b')][_0x536d('0x29')]);_0x41a98b[_0x536d('0x2c')]=_[_0x536d('0x2d')](_0x5211a8[_0x536d('0x2c')]);_0x41a98b[_0x536d('0x2e')]=_[_0x536d('0x2f')](_0x41a98b[_0x536d('0x30')],_0x41a98b[_0x536d('0x2c')]);_0x5c33bf['attributes']=_[_0x536d('0x2f')](_0x41a98b[_0x536d('0x30')],qs[_0x536d('0x31')](_0x5211a8[_0x536d('0x2c')][_0x536d('0x31')]));_0x5c33bf[_0x536d('0x32')]=_0x5c33bf[_0x536d('0x32')][_0x536d('0x33')]?_0x5c33bf['attributes']:_0x41a98b[_0x536d('0x30')];_0x5c33bf['order']=qs[_0x536d('0x37')](_0x5211a8[_0x536d('0x2c')][_0x536d('0x37')]);_0x5c33bf[_0x536d('0x38')]=qs['filters'](_[_0x536d('0x39')](_0x5211a8[_0x536d('0x2c')],_0x41a98b[_0x536d('0x2e')]));if(_0x5211a8[_0x536d('0x2c')][_0x536d('0x3a')]){_0x5c33bf[_0x536d('0x38')]=_['merge'](_0x5c33bf[_0x536d('0x38')],{'$or':_[_0x536d('0x27')](_0x5c33bf[_0x536d('0x32')],function(_0x3f9061){var _0x26e4ff={};_0x26e4ff[_0x3f9061]={'$like':'%'+_0x5211a8[_0x536d('0x2c')][_0x536d('0x3a')]+'%'};return _0x26e4ff;})});}_0x5c33bf=_[_0x536d('0x3b')]({},_0x5c33bf,_0x5211a8[_0x536d('0x3d')]);return _0x388bdb['getSubjects'](_0x5c33bf);}})['then'](function(_0x1b8abb){if(_0x1b8abb){_0x4c5f48=_0x1b8abb['length'];if(!_0x5211a8[_0x536d('0x2c')]['hasOwnProperty'](_0x536d('0x35'))){_0x5c33bf[_0x536d('0x1c')]=qs[_0x536d('0x1c')](_0x5211a8['query'][_0x536d('0x1c')]);_0x5c33bf[_0x536d('0x1e')]=qs[_0x536d('0x1e')](_0x5211a8[_0x536d('0x2c')]['offset']);}return _0x388bdb['getSubjects'](_0x5c33bf);}})[_0x536d('0x21')](function(_0x6915f9){if(_0x6915f9){return _0x6915f9?{'count':_0x4c5f48,'rows':_0x6915f9}:null;}})[_0x536d('0x21')](respondWithResult(_0x137e89,null))['catch'](handleError(_0x137e89,null));};exports[_0x536d('0x4c')]=function(_0x55c0f2,_0x4037af,_0x3301cc){var _0x3bac39={};var _0x2ecb50={};var _0x3d8914;var _0x223b72;return db[_0x536d('0x28')]['findOne']({'where':{'id':_0x55c0f2['params']['id']}})[_0x536d('0x21')](handleEntityNotFound(_0x4037af,null))[_0x536d('0x21')](function(_0x11156d){if(_0x11156d){_0x3d8914=_0x11156d;_0x2ecb50[_0x536d('0x30')]=_[_0x536d('0x2d')](db['ServicenowField'][_0x536d('0x29')]);_0x2ecb50[_0x536d('0x2c')]=_[_0x536d('0x2d')](_0x55c0f2[_0x536d('0x2c')]);_0x2ecb50[_0x536d('0x2e')]=_[_0x536d('0x2f')](_0x2ecb50[_0x536d('0x30')],_0x2ecb50[_0x536d('0x2c')]);_0x3bac39[_0x536d('0x32')]=_[_0x536d('0x2f')](_0x2ecb50['model'],qs['fields'](_0x55c0f2['query'][_0x536d('0x31')]));_0x3bac39[_0x536d('0x32')]=_0x3bac39['attributes'][_0x536d('0x33')]?_0x3bac39[_0x536d('0x32')]:_0x2ecb50[_0x536d('0x30')];_0x3bac39[_0x536d('0x36')]=qs[_0x536d('0x37')](_0x55c0f2[_0x536d('0x2c')]['sort']);_0x3bac39[_0x536d('0x38')]=qs[_0x536d('0x2e')](_['pick'](_0x55c0f2[_0x536d('0x2c')],_0x2ecb50[_0x536d('0x2e')]));if(_0x55c0f2[_0x536d('0x2c')][_0x536d('0x3a')]){_0x3bac39['where']=_['merge'](_0x3bac39[_0x536d('0x38')],{'$or':_[_0x536d('0x27')](_0x3bac39['attributes'],function(_0xd93f04){var _0x59dbb0={};_0x59dbb0[_0xd93f04]={'$like':'%'+_0x55c0f2[_0x536d('0x2c')][_0x536d('0x3a')]+'%'};return _0x59dbb0;})});}_0x3bac39=_['merge']({},_0x3bac39,_0x55c0f2[_0x536d('0x3d')]);return _0x3d8914[_0x536d('0x4c')](_0x3bac39);}})['then'](function(_0x1d0cf5){if(_0x1d0cf5){_0x223b72=_0x1d0cf5[_0x536d('0x33')];if(!_0x55c0f2[_0x536d('0x2c')][_0x536d('0x34')](_0x536d('0x35'))){_0x3bac39['limit']=qs[_0x536d('0x1c')](_0x55c0f2[_0x536d('0x2c')]['limit']);_0x3bac39['offset']=qs[_0x536d('0x1e')](_0x55c0f2[_0x536d('0x2c')][_0x536d('0x1e')]);}return _0x3d8914[_0x536d('0x4c')](_0x3bac39);}})['then'](function(_0x3b5ef3){if(_0x3b5ef3){return _0x3b5ef3?{'count':_0x223b72,'rows':_0x3b5ef3}:null;}})['then'](respondWithResult(_0x4037af,null))[_0x536d('0x45')](handleError(_0x4037af,null));}; \ No newline at end of file +var _0x2f70=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','undefined','count','offset','Content-Range','apply','save','update','then','error','name','send','index','ServicenowConfiguration','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','limit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','destroy','getFields','findOne','nolimit','getSubjects','ServicenowField','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x4fad1,_0x3aebb4){var _0x24f9e1=function(_0x58c0c8){while(--_0x58c0c8){_0x4fad1['push'](_0x4fad1['shift']());}};_0x24f9e1(++_0x3aebb4);}(_0x2f70,0x1cc));var _0x02f7=function(_0x5e5f90,_0x3c09ac){_0x5e5f90=_0x5e5f90-0x0;var _0x98f1ad=_0x2f70[_0x5e5f90];return _0x98f1ad;};'use strict';var emlformat=require(_0x02f7('0x0'));var rimraf=require(_0x02f7('0x1'));var zipdir=require(_0x02f7('0x2'));var jsonpatch=require(_0x02f7('0x3'));var rp=require(_0x02f7('0x4'));var moment=require(_0x02f7('0x5'));var BPromise=require(_0x02f7('0x6'));var Mustache=require(_0x02f7('0x7'));var util=require(_0x02f7('0x8'));var path=require(_0x02f7('0x9'));var sox=require(_0x02f7('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x02f7('0xb'));var squel=require('squel');var crypto=require(_0x02f7('0xc'));var jsforce=require(_0x02f7('0xd'));var deskjs=require(_0x02f7('0xe'));var toCsv=require(_0x02f7('0xf'));var querystring=require(_0x02f7('0x10'));var Papa=require(_0x02f7('0x11'));var Redis=require(_0x02f7('0x12'));var authService=require(_0x02f7('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x02f7('0x14'));var hardwareService=require(_0x02f7('0x15'));var logger=require(_0x02f7('0x16'))(_0x02f7('0x17'));var utils=require(_0x02f7('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7cd98b,_0x455202){_0x455202=_0x455202||0xcc;return function(_0x39ff08){if(_0x39ff08){return _0x7cd98b[_0x02f7('0x19')](_0x455202);}return _0x7cd98b['status'](_0x455202)[_0x02f7('0x1a')]();};}function respondWithResult(_0x3e64f1,_0x36aa8a){_0x36aa8a=_0x36aa8a||0xc8;return function(_0x4c9d3a){if(_0x4c9d3a){return _0x3e64f1[_0x02f7('0x1b')](_0x36aa8a)[_0x02f7('0x1c')](_0x4c9d3a);}};}function respondWithFilteredResult(_0x3015e6,_0x528093){return function(_0x5394cc){if(_0x5394cc){var _0x1e6cd2=typeof _0x528093['offset']===_0x02f7('0x1d')&&typeof _0x528093['limit']==='undefined';var _0x36bf4a=_0x5394cc[_0x02f7('0x1e')];var _0x1579bd=_0x1e6cd2?0x0:_0x528093[_0x02f7('0x1f')];var _0x4fccce=_0x1e6cd2?_0x5394cc[_0x02f7('0x1e')]:_0x528093['offset']+_0x528093['limit'];var _0x56467e;if(_0x4fccce>=_0x36bf4a){_0x4fccce=_0x36bf4a;_0x56467e=0xc8;}else{_0x56467e=0xce;}_0x3015e6['status'](_0x56467e);return _0x3015e6['set'](_0x02f7('0x20'),_0x1579bd+'-'+_0x4fccce+'/'+_0x36bf4a)['json'](_0x5394cc);}return null;};}function patchUpdates(_0x407ad5){return function(_0x8c600b){try{jsonpatch[_0x02f7('0x21')](_0x8c600b,_0x407ad5,!![]);}catch(_0x526f15){return BPromise['reject'](_0x526f15);}return _0x8c600b[_0x02f7('0x22')]();};}function saveUpdates(_0x1567aa,_0x297b96){return function(_0x19e816){if(_0x19e816){return _0x19e816[_0x02f7('0x23')](_0x1567aa)[_0x02f7('0x24')](function(_0x40b22c){return _0x40b22c;});}return null;};}function removeEntity(_0x4a4dff,_0x4bb181){return function(_0x42f197){if(_0x42f197){return _0x42f197['destroy']()[_0x02f7('0x24')](function(){_0x4a4dff[_0x02f7('0x1b')](0xcc)[_0x02f7('0x1a')]();});}};}function handleEntityNotFound(_0xd5b79,_0x379a45){return function(_0x1fbe3d){if(!_0x1fbe3d){_0xd5b79[_0x02f7('0x19')](0x194);}return _0x1fbe3d;};}function handleError(_0x333b76,_0x3287b5){_0x3287b5=_0x3287b5||0x1f4;return function(_0x3dfb00){logger[_0x02f7('0x25')](_0x3dfb00['stack']);if(_0x3dfb00[_0x02f7('0x26')]){delete _0x3dfb00[_0x02f7('0x26')];}_0x333b76[_0x02f7('0x1b')](_0x3287b5)[_0x02f7('0x27')](_0x3dfb00);};}exports[_0x02f7('0x28')]=function(_0x2fab3e,_0x1c575b){var _0x31d37d={},_0x32832e={},_0x12a48e={'count':0x0,'rows':[]};var _0x152c26=_['map'](db[_0x02f7('0x29')][_0x02f7('0x2a')],function(_0x328a93){return{'name':_0x328a93['fieldName'],'type':_0x328a93[_0x02f7('0x2b')][_0x02f7('0x2c')]};});_0x32832e['model']=_['map'](_0x152c26,_0x02f7('0x26'));_0x32832e[_0x02f7('0x2d')]=_[_0x02f7('0x2e')](_0x2fab3e[_0x02f7('0x2d')]);_0x32832e[_0x02f7('0x2f')]=_[_0x02f7('0x30')](_0x32832e[_0x02f7('0x31')],_0x32832e[_0x02f7('0x2d')]);_0x31d37d['attributes']=_[_0x02f7('0x30')](_0x32832e[_0x02f7('0x31')],qs[_0x02f7('0x32')](_0x2fab3e[_0x02f7('0x2d')][_0x02f7('0x32')]));_0x31d37d[_0x02f7('0x33')]=_0x31d37d[_0x02f7('0x33')][_0x02f7('0x34')]?_0x31d37d[_0x02f7('0x33')]:_0x32832e[_0x02f7('0x31')];if(!_0x2fab3e[_0x02f7('0x2d')]['hasOwnProperty']('nolimit')){_0x31d37d[_0x02f7('0x35')]=qs[_0x02f7('0x35')](_0x2fab3e[_0x02f7('0x2d')][_0x02f7('0x35')]);_0x31d37d['offset']=qs[_0x02f7('0x1f')](_0x2fab3e[_0x02f7('0x2d')]['offset']);}_0x31d37d[_0x02f7('0x36')]=qs[_0x02f7('0x37')](_0x2fab3e[_0x02f7('0x2d')][_0x02f7('0x37')]);_0x31d37d['where']=qs[_0x02f7('0x2f')](_[_0x02f7('0x38')](_0x2fab3e[_0x02f7('0x2d')],_0x32832e['filters']),_0x152c26);if(_0x2fab3e[_0x02f7('0x2d')][_0x02f7('0x39')]){_0x31d37d[_0x02f7('0x3a')]=_[_0x02f7('0x3b')](_0x31d37d['where'],{'$or':_[_0x02f7('0x3c')](_0x152c26,function(_0x33e8e9){if(_0x33e8e9['type']!==_0x02f7('0x3d')){var _0x3a7384={};_0x3a7384[_0x33e8e9[_0x02f7('0x26')]]={'$like':'%'+_0x2fab3e[_0x02f7('0x2d')]['filter']+'%'};return _0x3a7384;}})});}_0x31d37d=_[_0x02f7('0x3b')]({},_0x31d37d,_0x2fab3e[_0x02f7('0x3e')]);var _0x1a6c14={'where':_0x31d37d[_0x02f7('0x3a')]};return db[_0x02f7('0x29')]['count'](_0x1a6c14)[_0x02f7('0x24')](function(_0x1d572e){_0x12a48e['count']=_0x1d572e;if(_0x2fab3e[_0x02f7('0x2d')][_0x02f7('0x3f')]){_0x31d37d[_0x02f7('0x40')]=[{'all':!![]}];}return db[_0x02f7('0x29')][_0x02f7('0x41')](_0x31d37d);})[_0x02f7('0x24')](function(_0x302082){_0x12a48e['rows']=_0x302082;return _0x12a48e;})[_0x02f7('0x24')](respondWithFilteredResult(_0x1c575b,_0x31d37d))[_0x02f7('0x42')](handleError(_0x1c575b,null));};exports[_0x02f7('0x43')]=function(_0x5bc9a8,_0x18c9a8){var _0x122333={'raw':![],'where':{'id':_0x5bc9a8[_0x02f7('0x44')]['id']}},_0x500a9a={};_0x500a9a['model']=_[_0x02f7('0x2e')](db[_0x02f7('0x29')][_0x02f7('0x2a')]);_0x500a9a[_0x02f7('0x2d')]=_['keys'](_0x5bc9a8[_0x02f7('0x2d')]);_0x500a9a[_0x02f7('0x2f')]=_['intersection'](_0x500a9a[_0x02f7('0x31')],_0x500a9a[_0x02f7('0x2d')]);_0x122333['attributes']=_[_0x02f7('0x30')](_0x500a9a['model'],qs[_0x02f7('0x32')](_0x5bc9a8[_0x02f7('0x2d')][_0x02f7('0x32')]));_0x122333[_0x02f7('0x33')]=_0x122333['attributes'][_0x02f7('0x34')]?_0x122333['attributes']:_0x500a9a['model'];if(_0x5bc9a8['query'][_0x02f7('0x3f')]){_0x122333[_0x02f7('0x40')]=[{'all':!![]}];}_0x122333=_['merge']({},_0x122333,_0x5bc9a8[_0x02f7('0x3e')]);return db[_0x02f7('0x29')][_0x02f7('0x45')](_0x122333)[_0x02f7('0x24')](handleEntityNotFound(_0x18c9a8,null))[_0x02f7('0x24')](respondWithResult(_0x18c9a8,null))['catch'](handleError(_0x18c9a8,null));};exports['create']=function(_0x5081cb,_0x2bd4c8){return db[_0x02f7('0x29')][_0x02f7('0x46')](_0x5081cb['body'],{})[_0x02f7('0x24')](respondWithResult(_0x2bd4c8,0xc9))['catch'](handleError(_0x2bd4c8,null));};exports[_0x02f7('0x23')]=function(_0x4bd501,_0x2c494a){if(_0x4bd501[_0x02f7('0x47')]['id']){delete _0x4bd501[_0x02f7('0x47')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x4bd501['params']['id']}})[_0x02f7('0x24')](handleEntityNotFound(_0x2c494a,null))[_0x02f7('0x24')](saveUpdates(_0x4bd501[_0x02f7('0x47')],null))[_0x02f7('0x24')](respondWithResult(_0x2c494a,null))[_0x02f7('0x42')](handleError(_0x2c494a,null));};exports[_0x02f7('0x48')]=function(_0x16b4a7,_0x5a1d38){return db[_0x02f7('0x29')][_0x02f7('0x45')]({'where':{'id':_0x16b4a7[_0x02f7('0x44')]['id']}})[_0x02f7('0x24')](handleEntityNotFound(_0x5a1d38,null))[_0x02f7('0x24')](removeEntity(_0x5a1d38,null))['catch'](handleError(_0x5a1d38,null));};exports[_0x02f7('0x49')]=function(_0x5ee24e,_0x50d6af,_0x7d0597){var _0x2a1860={};var _0x25177d={};var _0x3f9747;var _0x312a7d;return db[_0x02f7('0x29')][_0x02f7('0x4a')]({'where':{'id':_0x5ee24e[_0x02f7('0x44')]['id']}})[_0x02f7('0x24')](handleEntityNotFound(_0x50d6af,null))[_0x02f7('0x24')](function(_0x2be0d4){if(_0x2be0d4){_0x3f9747=_0x2be0d4;_0x25177d[_0x02f7('0x31')]=_[_0x02f7('0x2e')](db['ServicenowField']['rawAttributes']);_0x25177d[_0x02f7('0x2d')]=_['keys'](_0x5ee24e[_0x02f7('0x2d')]);_0x25177d[_0x02f7('0x2f')]=_['intersection'](_0x25177d[_0x02f7('0x31')],_0x25177d[_0x02f7('0x2d')]);_0x2a1860[_0x02f7('0x33')]=_[_0x02f7('0x30')](_0x25177d[_0x02f7('0x31')],qs['fields'](_0x5ee24e['query']['fields']));_0x2a1860[_0x02f7('0x33')]=_0x2a1860['attributes'][_0x02f7('0x34')]?_0x2a1860['attributes']:_0x25177d[_0x02f7('0x31')];_0x2a1860[_0x02f7('0x36')]=qs[_0x02f7('0x37')](_0x5ee24e[_0x02f7('0x2d')]['sort']);_0x2a1860[_0x02f7('0x3a')]=qs[_0x02f7('0x2f')](_[_0x02f7('0x38')](_0x5ee24e[_0x02f7('0x2d')],_0x25177d[_0x02f7('0x2f')]));if(_0x5ee24e[_0x02f7('0x2d')][_0x02f7('0x39')]){_0x2a1860['where']=_[_0x02f7('0x3b')](_0x2a1860['where'],{'$or':_[_0x02f7('0x3c')](_0x2a1860[_0x02f7('0x33')],function(_0xb2bb72){var _0xccb6c3={};_0xccb6c3[_0xb2bb72]={'$like':'%'+_0x5ee24e[_0x02f7('0x2d')]['filter']+'%'};return _0xccb6c3;})});}_0x2a1860=_[_0x02f7('0x3b')]({},_0x2a1860,_0x5ee24e[_0x02f7('0x3e')]);return _0x3f9747[_0x02f7('0x49')](_0x2a1860);}})[_0x02f7('0x24')](function(_0x2a76fe){if(_0x2a76fe){_0x312a7d=_0x2a76fe[_0x02f7('0x34')];if(!_0x5ee24e['query']['hasOwnProperty'](_0x02f7('0x4b'))){_0x2a1860[_0x02f7('0x35')]=qs[_0x02f7('0x35')](_0x5ee24e['query']['limit']);_0x2a1860[_0x02f7('0x1f')]=qs[_0x02f7('0x1f')](_0x5ee24e[_0x02f7('0x2d')][_0x02f7('0x1f')]);}return _0x3f9747[_0x02f7('0x49')](_0x2a1860);}})[_0x02f7('0x24')](function(_0x288a08){if(_0x288a08){return _0x288a08?{'count':_0x312a7d,'rows':_0x288a08}:null;}})[_0x02f7('0x24')](respondWithResult(_0x50d6af,null))[_0x02f7('0x42')](handleError(_0x50d6af,null));};exports[_0x02f7('0x4c')]=function(_0x1cdad9,_0x1dd9b3,_0x570c93){var _0x35f4e2={};var _0x290134={};var _0x53a9d1;var _0x2a6235;return db[_0x02f7('0x29')][_0x02f7('0x4a')]({'where':{'id':_0x1cdad9[_0x02f7('0x44')]['id']}})[_0x02f7('0x24')](handleEntityNotFound(_0x1dd9b3,null))[_0x02f7('0x24')](function(_0xf11308){if(_0xf11308){_0x53a9d1=_0xf11308;_0x290134[_0x02f7('0x31')]=_[_0x02f7('0x2e')](db[_0x02f7('0x4d')][_0x02f7('0x2a')]);_0x290134[_0x02f7('0x2d')]=_['keys'](_0x1cdad9['query']);_0x290134[_0x02f7('0x2f')]=_[_0x02f7('0x30')](_0x290134[_0x02f7('0x31')],_0x290134['query']);_0x35f4e2[_0x02f7('0x33')]=_[_0x02f7('0x30')](_0x290134[_0x02f7('0x31')],qs['fields'](_0x1cdad9[_0x02f7('0x2d')][_0x02f7('0x32')]));_0x35f4e2[_0x02f7('0x33')]=_0x35f4e2[_0x02f7('0x33')][_0x02f7('0x34')]?_0x35f4e2['attributes']:_0x290134[_0x02f7('0x31')];_0x35f4e2['order']=qs[_0x02f7('0x37')](_0x1cdad9['query'][_0x02f7('0x37')]);_0x35f4e2['where']=qs['filters'](_[_0x02f7('0x38')](_0x1cdad9[_0x02f7('0x2d')],_0x290134['filters']));if(_0x1cdad9[_0x02f7('0x2d')]['filter']){_0x35f4e2[_0x02f7('0x3a')]=_[_0x02f7('0x3b')](_0x35f4e2[_0x02f7('0x3a')],{'$or':_[_0x02f7('0x3c')](_0x35f4e2[_0x02f7('0x33')],function(_0x4c792d){var _0x1e4f66={};_0x1e4f66[_0x4c792d]={'$like':'%'+_0x1cdad9[_0x02f7('0x2d')][_0x02f7('0x39')]+'%'};return _0x1e4f66;})});}_0x35f4e2=_[_0x02f7('0x3b')]({},_0x35f4e2,_0x1cdad9['options']);return _0x53a9d1[_0x02f7('0x4c')](_0x35f4e2);}})[_0x02f7('0x24')](function(_0x1ef52f){if(_0x1ef52f){_0x2a6235=_0x1ef52f[_0x02f7('0x34')];if(!_0x1cdad9[_0x02f7('0x2d')][_0x02f7('0x4e')](_0x02f7('0x4b'))){_0x35f4e2['limit']=qs['limit'](_0x1cdad9['query']['limit']);_0x35f4e2[_0x02f7('0x1f')]=qs['offset'](_0x1cdad9[_0x02f7('0x2d')][_0x02f7('0x1f')]);}return _0x53a9d1[_0x02f7('0x4c')](_0x35f4e2);}})[_0x02f7('0x24')](function(_0x4b10dd){if(_0x4b10dd){return _0x4b10dd?{'count':_0x2a6235,'rows':_0x4b10dd}:null;}})[_0x02f7('0x24')](respondWithResult(_0x1dd9b3,null))[_0x02f7('0x42')](handleError(_0x1dd9b3,null));};exports[_0x02f7('0x4f')]=function(_0xecef75,_0x2f9c61,_0x7b7686){var _0xd36fcf={};var _0x3da020={};var _0x10c36f;var _0x291fd9;return db[_0x02f7('0x29')][_0x02f7('0x4a')]({'where':{'id':_0xecef75[_0x02f7('0x44')]['id']}})['then'](handleEntityNotFound(_0x2f9c61,null))[_0x02f7('0x24')](function(_0x35bd68){if(_0x35bd68){_0x10c36f=_0x35bd68;_0x3da020[_0x02f7('0x31')]=_[_0x02f7('0x2e')](db[_0x02f7('0x4d')][_0x02f7('0x2a')]);_0x3da020['query']=_[_0x02f7('0x2e')](_0xecef75['query']);_0x3da020[_0x02f7('0x2f')]=_[_0x02f7('0x30')](_0x3da020[_0x02f7('0x31')],_0x3da020[_0x02f7('0x2d')]);_0xd36fcf[_0x02f7('0x33')]=_[_0x02f7('0x30')](_0x3da020[_0x02f7('0x31')],qs[_0x02f7('0x32')](_0xecef75[_0x02f7('0x2d')][_0x02f7('0x32')]));_0xd36fcf['attributes']=_0xd36fcf[_0x02f7('0x33')][_0x02f7('0x34')]?_0xd36fcf[_0x02f7('0x33')]:_0x3da020[_0x02f7('0x31')];_0xd36fcf[_0x02f7('0x36')]=qs[_0x02f7('0x37')](_0xecef75[_0x02f7('0x2d')][_0x02f7('0x37')]);_0xd36fcf[_0x02f7('0x3a')]=qs['filters'](_['pick'](_0xecef75['query'],_0x3da020[_0x02f7('0x2f')]));if(_0xecef75[_0x02f7('0x2d')][_0x02f7('0x39')]){_0xd36fcf[_0x02f7('0x3a')]=_['merge'](_0xd36fcf[_0x02f7('0x3a')],{'$or':_['map'](_0xd36fcf[_0x02f7('0x33')],function(_0x22dfc8){var _0x142d8e={};_0x142d8e[_0x22dfc8]={'$like':'%'+_0xecef75[_0x02f7('0x2d')][_0x02f7('0x39')]+'%'};return _0x142d8e;})});}_0xd36fcf=_[_0x02f7('0x3b')]({},_0xd36fcf,_0xecef75['options']);return _0x10c36f[_0x02f7('0x4f')](_0xd36fcf);}})[_0x02f7('0x24')](function(_0x9ab828){if(_0x9ab828){_0x291fd9=_0x9ab828[_0x02f7('0x34')];if(!_0xecef75[_0x02f7('0x2d')]['hasOwnProperty'](_0x02f7('0x4b'))){_0xd36fcf[_0x02f7('0x35')]=qs[_0x02f7('0x35')](_0xecef75[_0x02f7('0x2d')]['limit']);_0xd36fcf[_0x02f7('0x1f')]=qs[_0x02f7('0x1f')](_0xecef75[_0x02f7('0x2d')]['offset']);}return _0x10c36f[_0x02f7('0x4f')](_0xd36fcf);}})[_0x02f7('0x24')](function(_0x424dcf){if(_0x424dcf){return _0x424dcf?{'count':_0x291fd9,'rows':_0x424dcf}:null;}})[_0x02f7('0x24')](respondWithResult(_0x2f9c61,null))[_0x02f7('0x42')](handleError(_0x2f9c61,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 7181a44..796f018 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 _0x7e22=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','int_servicenow_configurations','lodash'];(function(_0x73b80e,_0x4daa4a){var _0x4c31cd=function(_0x3663a0){while(--_0x3663a0){_0x73b80e['push'](_0x73b80e['shift']());}};_0x4c31cd(++_0x4daa4a);}(_0x7e22,0x1d8));var _0x27e2=function(_0x366ca9,_0x5a1d1d){_0x366ca9=_0x366ca9-0x0;var _0x4b362e=_0x7e22[_0x366ca9];return _0x4b362e;};'use strict';var _=require(_0x27e2('0x0'));var util=require('util');var logger=require(_0x27e2('0x1'))(_0x27e2('0x2'));var moment=require(_0x27e2('0x3'));var BPromise=require(_0x27e2('0x4'));var rp=require(_0x27e2('0x5'));var fs=require('fs');var path=require(_0x27e2('0x6'));var rimraf=require('rimraf');var config=require(_0x27e2('0x7'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x27e2('0x8')]=function(_0x350996,_0x3eb3cd){return _0x350996[_0x27e2('0x9')]('ServicenowConfiguration',attributes,{'tableName':_0x27e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75e3=['request-promise','./intServicenowConfiguration.attributes','ServicenowConfiguration','int_servicenow_configurations','util','../../config/logger','moment','bluebird'];(function(_0xa0081f,_0x2f91fe){var _0x2ff8a9=function(_0x55efb6){while(--_0x55efb6){_0xa0081f['push'](_0xa0081f['shift']());}};_0x2ff8a9(++_0x2f91fe);}(_0x75e3,0x104));var _0x375e=function(_0x4fa068,_0x5277e0){_0x4fa068=_0x4fa068-0x0;var _0x3f74a9=_0x75e3[_0x4fa068];return _0x3f74a9;};'use strict';var _=require('lodash');var util=require(_0x375e('0x0'));var logger=require(_0x375e('0x1'))('api');var moment=require(_0x375e('0x2'));var BPromise=require(_0x375e('0x3'));var rp=require(_0x375e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x375e('0x5'));module['exports']=function(_0x17e32c,_0x52f876){return _0x17e32c['define'](_0x375e('0x6'),attributes,{'tableName':_0x375e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 734ac23..a8adef0 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 _0x7801=['ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xdc7170,_0x571276){var _0x9e8216=function(_0x4ebfbc){while(--_0x4ebfbc){_0xdc7170['push'](_0xdc7170['shift']());}};_0x9e8216(++_0x571276);}(_0x7801,0x11a));var _0x1780=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x7801[_0x199572];return _0x13cfa3;};'use strict';var _=require('lodash');var util=require(_0x1780('0x0'));var moment=require(_0x1780('0x1'));var BPromise=require(_0x1780('0x2'));var rs=require(_0x1780('0x3'));var fs=require('fs');var Redis=require(_0x1780('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1780('0x5'));var logger=require(_0x1780('0x6'))(_0x1780('0x7'));var config=require(_0x1780('0x8'));var jayson=require(_0x1780('0x9'));var client=jayson[_0x1780('0xa')][_0x1780('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ac93f,_0x56b7f6,_0x24e100){return new BPromise(function(_0x61ce8c,_0x5bdafa){return client['request'](_0x4ac93f,_0x24e100)[_0x1780('0xc')](function(_0x15db19){logger[_0x1780('0xd')](_0x1780('0xe'),_0x56b7f6,_0x1780('0xf'));logger[_0x1780('0x10')](_0x1780('0x11'),_0x56b7f6,_0x1780('0xf'),JSON[_0x1780('0x12')](_0x15db19));if(_0x15db19[_0x1780('0x13')]){if(_0x15db19[_0x1780('0x13')][_0x1780('0x14')]===0x1f4){logger[_0x1780('0x13')](_0x1780('0xe'),_0x56b7f6,_0x15db19['error']['message']);return _0x5bdafa(_0x15db19['error'][_0x1780('0x15')]);}logger[_0x1780('0x13')](_0x1780('0xe'),_0x56b7f6,_0x15db19[_0x1780('0x13')]['message']);return _0x61ce8c(_0x15db19[_0x1780('0x13')]['message']);}else{logger[_0x1780('0xd')](_0x1780('0xe'),_0x56b7f6,_0x1780('0xf'));_0x61ce8c(_0x15db19[_0x1780('0x16')][_0x1780('0x15')]);}})['catch'](function(_0x55ab86){logger[_0x1780('0x13')](_0x1780('0xe'),_0x56b7f6,_0x55ab86);_0x5bdafa(_0x55ab86);});});} \ No newline at end of file +var _0xf7f5=['rpc','../../config/environment','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x205499,_0x43b01e){var _0x1e52ae=function(_0x57dda5){while(--_0x57dda5){_0x205499['push'](_0x205499['shift']());}};_0x1e52ae(++_0x43b01e);}(_0xf7f5,0xf2));var _0x5f7f=function(_0x264e76,_0x27f66e){_0x264e76=_0x264e76-0x0;var _0x237d02=_0xf7f5[_0x264e76];return _0x237d02;};'use strict';var _=require(_0x5f7f('0x0'));var util=require(_0x5f7f('0x1'));var moment=require(_0x5f7f('0x2'));var BPromise=require(_0x5f7f('0x3'));var rs=require(_0x5f7f('0x4'));var fs=require('fs');var Redis=require(_0x5f7f('0x5'));var db=require(_0x5f7f('0x6'))['db'];var utils=require(_0x5f7f('0x7'));var logger=require('../../config/logger')(_0x5f7f('0x8'));var config=require(_0x5f7f('0x9'));var jayson=require(_0x5f7f('0xa'));var client=jayson['client'][_0x5f7f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38d459,_0xf6d891,_0x5d43a4){return new BPromise(function(_0x209de8,_0x1c0926){return client[_0x5f7f('0xc')](_0x38d459,_0x5d43a4)[_0x5f7f('0xd')](function(_0xbda0bd){logger[_0x5f7f('0xe')](_0x5f7f('0xf'),_0xf6d891,_0x5f7f('0x10'));logger[_0x5f7f('0x11')](_0x5f7f('0x12'),_0xf6d891,_0x5f7f('0x10'),JSON[_0x5f7f('0x13')](_0xbda0bd));if(_0xbda0bd['error']){if(_0xbda0bd[_0x5f7f('0x14')][_0x5f7f('0x15')]===0x1f4){logger[_0x5f7f('0x14')](_0x5f7f('0xf'),_0xf6d891,_0xbda0bd[_0x5f7f('0x14')][_0x5f7f('0x16')]);return _0x1c0926(_0xbda0bd[_0x5f7f('0x14')]['message']);}logger[_0x5f7f('0x14')](_0x5f7f('0xf'),_0xf6d891,_0xbda0bd[_0x5f7f('0x14')][_0x5f7f('0x16')]);return _0x209de8(_0xbda0bd['error'][_0x5f7f('0x16')]);}else{logger[_0x5f7f('0xe')](_0x5f7f('0xf'),_0xf6d891,_0x5f7f('0x10'));_0x209de8(_0xbda0bd[_0x5f7f('0x17')][_0x5f7f('0x16')]);}})[_0x5f7f('0x18')](function(_0x1ec7e4){logger['error'](_0x5f7f('0xf'),_0xf6d891,_0x1ec7e4);_0x1c0926(_0x1ec7e4);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 18bd9aa..698cd90 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 _0x401d=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x401d,0xde));var _0xd401=function(_0x3ad574,_0x2e621a){_0x3ad574=_0x3ad574-0x0;var _0x358b13=_0x401d[_0x3ad574];return _0x358b13;};'use strict';var multer=require(_0xd401('0x0'));var util=require(_0xd401('0x1'));var path=require(_0xd401('0x2'));var timeout=require(_0xd401('0x3'));var express=require('express');var router=express[_0xd401('0x4')]();var fs_extra=require(_0xd401('0x5'));var auth=require(_0xd401('0x6'));var interaction=require(_0xd401('0x7'));var config=require(_0xd401('0x8'));var controller=require('./intServicenowField.controller');router['get']('/',auth[_0xd401('0x9')](),controller[_0xd401('0xa')]);router[_0xd401('0xb')](_0xd401('0xc'),auth['isAuthenticated'](),controller[_0xd401('0xd')]);router[_0xd401('0xe')]('/',auth[_0xd401('0x9')](),controller['create']);router[_0xd401('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd401('0x10')](_0xd401('0xc'),auth[_0xd401('0x9')](),controller[_0xd401('0x11')]);module[_0xd401('0x12')]=router; \ No newline at end of file +var _0x2f3f=['get','index','isAuthenticated','show','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x2f3f,0x136));var _0xf2f3=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x2f3f[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xf2f3('0x0'));var util=require(_0xf2f3('0x1'));var path=require(_0xf2f3('0x2'));var timeout=require(_0xf2f3('0x3'));var express=require(_0xf2f3('0x4'));var router=express[_0xf2f3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf2f3('0x6'));var interaction=require(_0xf2f3('0x7'));var config=require(_0xf2f3('0x8'));var controller=require(_0xf2f3('0x9'));router[_0xf2f3('0xa')]('/',auth['isAuthenticated'](),controller[_0xf2f3('0xb')]);router['get']('/:id',auth[_0xf2f3('0xc')](),controller[_0xf2f3('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf2f3('0xe')]);router[_0xf2f3('0xf')](_0xf2f3('0x10'),auth['isAuthenticated'](),controller[_0xf2f3('0x11')]);router['delete']('/:id',auth[_0xf2f3('0xc')](),controller[_0xf2f3('0x12')]);module[_0xf2f3('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index cf842d8..5e13042 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 _0x5d56=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','string','STRING'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x5d56,0x1a8));var _0x65d5=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5d56[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x65d5('0x0'));module[_0x65d5('0x1')]={'type':{'type':Sequelize[_0x65d5('0x2')]('string',_0x65d5('0x3'),_0x65d5('0x4'),_0x65d5('0x5'),'picklist'),'defaultValue':_0x65d5('0x6')},'content':{'type':Sequelize[_0x65d5('0x7')]},'key':{'type':Sequelize[_0x65d5('0x7')]},'keyType':{'type':Sequelize[_0x65d5('0x2')](_0x65d5('0x6'),_0x65d5('0x3'),_0x65d5('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x65d5('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x65d5('0x7')]}}; \ No newline at end of file +var _0x179d=['STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x559434,_0x2f9870){var _0x252834=function(_0x548490){while(--_0x548490){_0x559434['push'](_0x559434['shift']());}};_0x252834(++_0x2f9870);}(_0x179d,0x12f));var _0xd179=function(_0xef437c,_0x3bef43){_0xef437c=_0xef437c-0x0;var _0x250486=_0x179d[_0xef437c];return _0x250486;};'use strict';var Sequelize=require('sequelize');module[_0xd179('0x0')]={'type':{'type':Sequelize[_0xd179('0x1')](_0xd179('0x2'),_0xd179('0x3'),_0xd179('0x4'),'keyValue','picklist'),'defaultValue':_0xd179('0x2')},'content':{'type':Sequelize[_0xd179('0x5')]},'key':{'type':Sequelize[_0xd179('0x5')]},'keyType':{'type':Sequelize[_0xd179('0x1')](_0xd179('0x2'),'variable',_0xd179('0x4'))},'keyContent':{'type':Sequelize[_0xd179('0x5')]},'idField':{'type':Sequelize[_0xd179('0x5')]},'nameField':{'type':Sequelize[_0xd179('0x5')]},'customField':{'type':Sequelize[_0xd179('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd179('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index e92c221..fe139de 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 _0x9d80=['error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','ServicenowField','findAll','then','rows','catch','show','params','find','create','body','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','end'];(function(_0x22a91c,_0x5ce13f){var _0x733c2f=function(_0x1ef119){while(--_0x1ef119){_0x22a91c['push'](_0x22a91c['shift']());}};_0x733c2f(++_0x5ce13f);}(_0x9d80,0x141));var _0x09d8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9d80[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x09d8('0x0'));var zipdir=require(_0x09d8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x09d8('0x2'));var Mustache=require(_0x09d8('0x3'));var util=require(_0x09d8('0x4'));var path=require(_0x09d8('0x5'));var sox=require(_0x09d8('0x6'));var csv=require(_0x09d8('0x7'));var ejs=require(_0x09d8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x09d8('0x9'));var squel=require(_0x09d8('0xa'));var crypto=require(_0x09d8('0xb'));var jsforce=require(_0x09d8('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x09d8('0xd'));var authService=require(_0x09d8('0xe'));var qs=require(_0x09d8('0xf'));var as=require(_0x09d8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x09d8('0x11'));var utils=require(_0x09d8('0x12'));var config=require(_0x09d8('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5aca19,_0x2b5485){_0x2b5485=_0x2b5485||0xcc;return function(_0x2c9e41){if(_0x2c9e41){return _0x5aca19[_0x09d8('0x14')](_0x2b5485);}return _0x5aca19['status'](_0x2b5485)['end']();};}function respondWithResult(_0x198a85,_0x2103f5){_0x2103f5=_0x2103f5||0xc8;return function(_0x4294a4){if(_0x4294a4){return _0x198a85[_0x09d8('0x15')](_0x2103f5)[_0x09d8('0x16')](_0x4294a4);}};}function respondWithFilteredResult(_0x37ce7d,_0x11293e){return function(_0x42bbec){if(_0x42bbec){var _0x2d4463=typeof _0x11293e[_0x09d8('0x17')]===_0x09d8('0x18')&&typeof _0x11293e['limit']===_0x09d8('0x18');var _0x11497e=_0x42bbec['count'];var _0x12e0aa=_0x2d4463?0x0:_0x11293e[_0x09d8('0x17')];var _0x13e300=_0x2d4463?_0x42bbec[_0x09d8('0x19')]:_0x11293e[_0x09d8('0x17')]+_0x11293e[_0x09d8('0x1a')];var _0x39d634;if(_0x13e300>=_0x11497e){_0x13e300=_0x11497e;_0x39d634=0xc8;}else{_0x39d634=0xce;}_0x37ce7d['status'](_0x39d634);return _0x37ce7d[_0x09d8('0x1b')]('Content-Range',_0x12e0aa+'-'+_0x13e300+'/'+_0x11497e)[_0x09d8('0x16')](_0x42bbec);}return null;};}function patchUpdates(_0x47c3eb){return function(_0xe98521){try{jsonpatch[_0x09d8('0x1c')](_0xe98521,_0x47c3eb,!![]);}catch(_0x379345){return BPromise[_0x09d8('0x1d')](_0x379345);}return _0xe98521[_0x09d8('0x1e')]();};}function saveUpdates(_0x4c5442,_0x1f1f9d){return function(_0x4db5e9){if(_0x4db5e9){return _0x4db5e9[_0x09d8('0x1f')](_0x4c5442)['then'](function(_0x1aa2d7){return _0x1aa2d7;});}return null;};}function removeEntity(_0x48c5cd,_0x38186c){return function(_0x1758d6){if(_0x1758d6){return _0x1758d6[_0x09d8('0x20')]()['then'](function(){_0x48c5cd[_0x09d8('0x15')](0xcc)[_0x09d8('0x21')]();});}};}function handleEntityNotFound(_0x4b9cfa,_0x5d2afe){return function(_0x539fde){if(!_0x539fde){_0x4b9cfa['sendStatus'](0x194);}return _0x539fde;};}function handleError(_0x1f6daa,_0x3265fa){_0x3265fa=_0x3265fa||0x1f4;return function(_0x125542){logger[_0x09d8('0x22')](_0x125542['stack']);if(_0x125542[_0x09d8('0x23')]){delete _0x125542[_0x09d8('0x23')];}_0x1f6daa['status'](_0x3265fa)[_0x09d8('0x24')](_0x125542);};}exports[_0x09d8('0x25')]=function(_0x29c667,_0x461be0){var _0x3cebe2={},_0x29aef4={},_0x403bbd={'count':0x0,'rows':[]};var _0x59bcc0=_[_0x09d8('0x26')](db['ServicenowField'][_0x09d8('0x27')],function(_0xdab5c4){return{'name':_0xdab5c4[_0x09d8('0x28')],'type':_0xdab5c4[_0x09d8('0x29')][_0x09d8('0x2a')]};});_0x29aef4['model']=_[_0x09d8('0x26')](_0x59bcc0,_0x09d8('0x23'));_0x29aef4[_0x09d8('0x2b')]=_[_0x09d8('0x2c')](_0x29c667[_0x09d8('0x2b')]);_0x29aef4[_0x09d8('0x2d')]=_[_0x09d8('0x2e')](_0x29aef4[_0x09d8('0x2f')],_0x29aef4[_0x09d8('0x2b')]);_0x3cebe2[_0x09d8('0x30')]=_[_0x09d8('0x2e')](_0x29aef4['model'],qs['fields'](_0x29c667[_0x09d8('0x2b')][_0x09d8('0x31')]));_0x3cebe2[_0x09d8('0x30')]=_0x3cebe2['attributes'][_0x09d8('0x32')]?_0x3cebe2[_0x09d8('0x30')]:_0x29aef4['model'];if(!_0x29c667[_0x09d8('0x2b')][_0x09d8('0x33')](_0x09d8('0x34'))){_0x3cebe2[_0x09d8('0x1a')]=qs[_0x09d8('0x1a')](_0x29c667[_0x09d8('0x2b')][_0x09d8('0x1a')]);_0x3cebe2[_0x09d8('0x17')]=qs[_0x09d8('0x17')](_0x29c667['query'][_0x09d8('0x17')]);}_0x3cebe2[_0x09d8('0x35')]=qs[_0x09d8('0x36')](_0x29c667[_0x09d8('0x2b')]['sort']);_0x3cebe2[_0x09d8('0x37')]=qs[_0x09d8('0x2d')](_['pick'](_0x29c667[_0x09d8('0x2b')],_0x29aef4['filters']),_0x59bcc0);if(_0x29c667['query'][_0x09d8('0x38')]){_0x3cebe2[_0x09d8('0x37')]=_[_0x09d8('0x39')](_0x3cebe2['where'],{'$or':_[_0x09d8('0x26')](_0x59bcc0,function(_0x30e7eb){if(_0x30e7eb[_0x09d8('0x29')]!==_0x09d8('0x3a')){var _0x1671f3={};_0x1671f3[_0x30e7eb[_0x09d8('0x23')]]={'$like':'%'+_0x29c667[_0x09d8('0x2b')][_0x09d8('0x38')]+'%'};return _0x1671f3;}})});}_0x3cebe2=_[_0x09d8('0x39')]({},_0x3cebe2,_0x29c667[_0x09d8('0x3b')]);var _0x426497={'where':_0x3cebe2[_0x09d8('0x37')]};return db['ServicenowField'][_0x09d8('0x19')](_0x426497)['then'](function(_0x38354f){_0x403bbd[_0x09d8('0x19')]=_0x38354f;if(_0x29c667[_0x09d8('0x2b')]['includeAll']){_0x3cebe2[_0x09d8('0x3c')]=[{'all':!![]}];}return db[_0x09d8('0x3d')][_0x09d8('0x3e')](_0x3cebe2);})[_0x09d8('0x3f')](function(_0x5dd988){_0x403bbd[_0x09d8('0x40')]=_0x5dd988;return _0x403bbd;})[_0x09d8('0x3f')](respondWithFilteredResult(_0x461be0,_0x3cebe2))[_0x09d8('0x41')](handleError(_0x461be0,null));};exports[_0x09d8('0x42')]=function(_0x2211a6,_0x477156){var _0xe68324={'raw':!![],'where':{'id':_0x2211a6[_0x09d8('0x43')]['id']}},_0x159a5e={};_0x159a5e[_0x09d8('0x2f')]=_[_0x09d8('0x2c')](db[_0x09d8('0x3d')][_0x09d8('0x27')]);_0x159a5e[_0x09d8('0x2b')]=_['keys'](_0x2211a6[_0x09d8('0x2b')]);_0x159a5e[_0x09d8('0x2d')]=_[_0x09d8('0x2e')](_0x159a5e[_0x09d8('0x2f')],_0x159a5e[_0x09d8('0x2b')]);_0xe68324[_0x09d8('0x30')]=_['intersection'](_0x159a5e[_0x09d8('0x2f')],qs['fields'](_0x2211a6[_0x09d8('0x2b')][_0x09d8('0x31')]));_0xe68324[_0x09d8('0x30')]=_0xe68324[_0x09d8('0x30')][_0x09d8('0x32')]?_0xe68324[_0x09d8('0x30')]:_0x159a5e[_0x09d8('0x2f')];if(_0x2211a6[_0x09d8('0x2b')]['includeAll']){_0xe68324[_0x09d8('0x3c')]=[{'all':!![]}];}_0xe68324=_[_0x09d8('0x39')]({},_0xe68324,_0x2211a6[_0x09d8('0x3b')]);return db[_0x09d8('0x3d')][_0x09d8('0x44')](_0xe68324)[_0x09d8('0x3f')](handleEntityNotFound(_0x477156,null))[_0x09d8('0x3f')](respondWithResult(_0x477156,null))[_0x09d8('0x41')](handleError(_0x477156,null));};exports[_0x09d8('0x45')]=function(_0x297e4a,_0x3a087a){return db[_0x09d8('0x3d')][_0x09d8('0x45')](_0x297e4a[_0x09d8('0x46')],{})[_0x09d8('0x3f')](respondWithResult(_0x3a087a,0xc9))[_0x09d8('0x41')](handleError(_0x3a087a,null));};exports[_0x09d8('0x1f')]=function(_0x2a1ded,_0xca3c44){if(_0x2a1ded[_0x09d8('0x46')]['id']){delete _0x2a1ded[_0x09d8('0x46')]['id'];}return db[_0x09d8('0x3d')][_0x09d8('0x44')]({'where':{'id':_0x2a1ded[_0x09d8('0x43')]['id']}})['then'](handleEntityNotFound(_0xca3c44,null))[_0x09d8('0x3f')](saveUpdates(_0x2a1ded['body'],null))[_0x09d8('0x3f')](respondWithResult(_0xca3c44,null))[_0x09d8('0x41')](handleError(_0xca3c44,null));};exports[_0x09d8('0x20')]=function(_0x57115d,_0x44fdd7){return db[_0x09d8('0x3d')][_0x09d8('0x44')]({'where':{'id':_0x57115d[_0x09d8('0x43')]['id']}})[_0x09d8('0x3f')](handleEntityNotFound(_0x44fdd7,null))[_0x09d8('0x3f')](removeEntity(_0x44fdd7,null))[_0x09d8('0x41')](handleError(_0x44fdd7,null));}; \ No newline at end of file +var _0x46ac=['../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','destroy','then','sendStatus','error','stack','send','map','ServicenowField','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','catch','show','length','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x47b72c,_0x40c5de){var _0x20bd22=function(_0x234289){while(--_0x234289){_0x47b72c['push'](_0x47b72c['shift']());}};_0x20bd22(++_0x40c5de);}(_0x46ac,0x7d));var _0xc46a=function(_0x539eb7,_0x265582){_0x539eb7=_0x539eb7-0x0;var _0x678d0e=_0x46ac[_0x539eb7];return _0x678d0e;};'use strict';var emlformat=require(_0xc46a('0x0'));var rimraf=require(_0xc46a('0x1'));var zipdir=require(_0xc46a('0x2'));var jsonpatch=require(_0xc46a('0x3'));var rp=require(_0xc46a('0x4'));var moment=require(_0xc46a('0x5'));var BPromise=require(_0xc46a('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc46a('0x7'));var csv=require(_0xc46a('0x8'));var ejs=require(_0xc46a('0x9'));var fs=require('fs');var fs_extra=require(_0xc46a('0xa'));var _=require(_0xc46a('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc46a('0xc'));var deskjs=require(_0xc46a('0xd'));var toCsv=require(_0xc46a('0x8'));var querystring=require(_0xc46a('0xe'));var Papa=require(_0xc46a('0xf'));var Redis=require(_0xc46a('0x10'));var authService=require(_0xc46a('0x11'));var qs=require(_0xc46a('0x12'));var as=require(_0xc46a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc46a('0x14'))(_0xc46a('0x15'));var utils=require(_0xc46a('0x16'));var config=require(_0xc46a('0x17'));var licenseUtil=require(_0xc46a('0x18'));var db=require(_0xc46a('0x19'))['db'];function respondWithStatusCode(_0x531798,_0x24c0fe){_0x24c0fe=_0x24c0fe||0xcc;return function(_0x19f811){if(_0x19f811){return _0x531798['sendStatus'](_0x24c0fe);}return _0x531798[_0xc46a('0x1a')](_0x24c0fe)[_0xc46a('0x1b')]();};}function respondWithResult(_0x3f9c31,_0x179c80){_0x179c80=_0x179c80||0xc8;return function(_0x3f00c6){if(_0x3f00c6){return _0x3f9c31[_0xc46a('0x1a')](_0x179c80)['json'](_0x3f00c6);}};}function respondWithFilteredResult(_0x5ee67f,_0x428cea){return function(_0x1b5987){if(_0x1b5987){var _0x3908ec=typeof _0x428cea['offset']===_0xc46a('0x1c')&&typeof _0x428cea[_0xc46a('0x1d')]===_0xc46a('0x1c');var _0x27ad82=_0x1b5987[_0xc46a('0x1e')];var _0x3bf652=_0x3908ec?0x0:_0x428cea[_0xc46a('0x1f')];var _0x1b64de=_0x3908ec?_0x1b5987[_0xc46a('0x1e')]:_0x428cea[_0xc46a('0x1f')]+_0x428cea[_0xc46a('0x1d')];var _0x5d1ed8;if(_0x1b64de>=_0x27ad82){_0x1b64de=_0x27ad82;_0x5d1ed8=0xc8;}else{_0x5d1ed8=0xce;}_0x5ee67f[_0xc46a('0x1a')](_0x5d1ed8);return _0x5ee67f[_0xc46a('0x20')](_0xc46a('0x21'),_0x3bf652+'-'+_0x1b64de+'/'+_0x27ad82)[_0xc46a('0x22')](_0x1b5987);}return null;};}function patchUpdates(_0xb93a3b){return function(_0x46290d){try{jsonpatch[_0xc46a('0x23')](_0x46290d,_0xb93a3b,!![]);}catch(_0x466989){return BPromise[_0xc46a('0x24')](_0x466989);}return _0x46290d['save']();};}function saveUpdates(_0x2f1ae4,_0x3571f9){return function(_0x27db5e){if(_0x27db5e){return _0x27db5e[_0xc46a('0x25')](_0x2f1ae4)['then'](function(_0x1e55f3){return _0x1e55f3;});}return null;};}function removeEntity(_0x452667,_0x346c44){return function(_0x1598f5){if(_0x1598f5){return _0x1598f5[_0xc46a('0x26')]()[_0xc46a('0x27')](function(){_0x452667[_0xc46a('0x1a')](0xcc)[_0xc46a('0x1b')]();});}};}function handleEntityNotFound(_0x5b0775,_0x3a96a6){return function(_0x300ff){if(!_0x300ff){_0x5b0775[_0xc46a('0x28')](0x194);}return _0x300ff;};}function handleError(_0x1b5a52,_0x1cee99){_0x1cee99=_0x1cee99||0x1f4;return function(_0x2ffe6c){logger[_0xc46a('0x29')](_0x2ffe6c[_0xc46a('0x2a')]);if(_0x2ffe6c['name']){delete _0x2ffe6c['name'];}_0x1b5a52[_0xc46a('0x1a')](_0x1cee99)[_0xc46a('0x2b')](_0x2ffe6c);};}exports['index']=function(_0x52f599,_0x3f3172){var _0x22763b={},_0x3dbb90={},_0x4ce02a={'count':0x0,'rows':[]};var _0x57505a=_[_0xc46a('0x2c')](db[_0xc46a('0x2d')][_0xc46a('0x2e')],function(_0x434e66){return{'name':_0x434e66[_0xc46a('0x2f')],'type':_0x434e66[_0xc46a('0x30')][_0xc46a('0x31')]};});_0x3dbb90[_0xc46a('0x32')]=_[_0xc46a('0x2c')](_0x57505a,_0xc46a('0x33'));_0x3dbb90[_0xc46a('0x34')]=_[_0xc46a('0x35')](_0x52f599['query']);_0x3dbb90[_0xc46a('0x36')]=_[_0xc46a('0x37')](_0x3dbb90['model'],_0x3dbb90[_0xc46a('0x34')]);_0x22763b[_0xc46a('0x38')]=_[_0xc46a('0x37')](_0x3dbb90[_0xc46a('0x32')],qs[_0xc46a('0x39')](_0x52f599['query'][_0xc46a('0x39')]));_0x22763b[_0xc46a('0x38')]=_0x22763b[_0xc46a('0x38')]['length']?_0x22763b[_0xc46a('0x38')]:_0x3dbb90[_0xc46a('0x32')];if(!_0x52f599[_0xc46a('0x34')]['hasOwnProperty'](_0xc46a('0x3a'))){_0x22763b[_0xc46a('0x1d')]=qs[_0xc46a('0x1d')](_0x52f599['query'][_0xc46a('0x1d')]);_0x22763b['offset']=qs[_0xc46a('0x1f')](_0x52f599['query'][_0xc46a('0x1f')]);}_0x22763b[_0xc46a('0x3b')]=qs[_0xc46a('0x3c')](_0x52f599[_0xc46a('0x34')]['sort']);_0x22763b[_0xc46a('0x3d')]=qs['filters'](_['pick'](_0x52f599[_0xc46a('0x34')],_0x3dbb90['filters']),_0x57505a);if(_0x52f599[_0xc46a('0x34')][_0xc46a('0x3e')]){_0x22763b[_0xc46a('0x3d')]=_[_0xc46a('0x3f')](_0x22763b['where'],{'$or':_['map'](_0x57505a,function(_0x1f0032){if(_0x1f0032[_0xc46a('0x30')]!=='VIRTUAL'){var _0x5c3648={};_0x5c3648[_0x1f0032[_0xc46a('0x33')]]={'$like':'%'+_0x52f599['query'][_0xc46a('0x3e')]+'%'};return _0x5c3648;}})});}_0x22763b=_[_0xc46a('0x3f')]({},_0x22763b,_0x52f599[_0xc46a('0x40')]);var _0x3c7cf1={'where':_0x22763b['where']};return db[_0xc46a('0x2d')][_0xc46a('0x1e')](_0x3c7cf1)[_0xc46a('0x27')](function(_0xf4a5ff){_0x4ce02a[_0xc46a('0x1e')]=_0xf4a5ff;if(_0x52f599['query']['includeAll']){_0x22763b[_0xc46a('0x41')]=[{'all':!![]}];}return db[_0xc46a('0x2d')][_0xc46a('0x42')](_0x22763b);})['then'](function(_0x5d338d){_0x4ce02a[_0xc46a('0x43')]=_0x5d338d;return _0x4ce02a;})[_0xc46a('0x27')](respondWithFilteredResult(_0x3f3172,_0x22763b))[_0xc46a('0x44')](handleError(_0x3f3172,null));};exports[_0xc46a('0x45')]=function(_0x13a1d7,_0x4a0b2c){var _0x266fa8={'raw':!![],'where':{'id':_0x13a1d7['params']['id']}},_0x4fdef6={};_0x4fdef6[_0xc46a('0x32')]=_[_0xc46a('0x35')](db[_0xc46a('0x2d')][_0xc46a('0x2e')]);_0x4fdef6[_0xc46a('0x34')]=_['keys'](_0x13a1d7['query']);_0x4fdef6['filters']=_['intersection'](_0x4fdef6[_0xc46a('0x32')],_0x4fdef6['query']);_0x266fa8['attributes']=_[_0xc46a('0x37')](_0x4fdef6[_0xc46a('0x32')],qs[_0xc46a('0x39')](_0x13a1d7[_0xc46a('0x34')][_0xc46a('0x39')]));_0x266fa8[_0xc46a('0x38')]=_0x266fa8[_0xc46a('0x38')][_0xc46a('0x46')]?_0x266fa8['attributes']:_0x4fdef6['model'];if(_0x13a1d7['query']['includeAll']){_0x266fa8[_0xc46a('0x41')]=[{'all':!![]}];}_0x266fa8=_[_0xc46a('0x3f')]({},_0x266fa8,_0x13a1d7['options']);return db[_0xc46a('0x2d')][_0xc46a('0x47')](_0x266fa8)[_0xc46a('0x27')](handleEntityNotFound(_0x4a0b2c,null))[_0xc46a('0x27')](respondWithResult(_0x4a0b2c,null))[_0xc46a('0x44')](handleError(_0x4a0b2c,null));};exports['create']=function(_0x3555a3,_0x3219e2){return db[_0xc46a('0x2d')][_0xc46a('0x48')](_0x3555a3[_0xc46a('0x49')],{})[_0xc46a('0x27')](respondWithResult(_0x3219e2,0xc9))[_0xc46a('0x44')](handleError(_0x3219e2,null));};exports[_0xc46a('0x25')]=function(_0x516acb,_0x5d423e){if(_0x516acb[_0xc46a('0x49')]['id']){delete _0x516acb[_0xc46a('0x49')]['id'];}return db[_0xc46a('0x2d')][_0xc46a('0x47')]({'where':{'id':_0x516acb[_0xc46a('0x4a')]['id']}})[_0xc46a('0x27')](handleEntityNotFound(_0x5d423e,null))[_0xc46a('0x27')](saveUpdates(_0x516acb[_0xc46a('0x49')],null))[_0xc46a('0x27')](respondWithResult(_0x5d423e,null))[_0xc46a('0x44')](handleError(_0x5d423e,null));};exports['destroy']=function(_0x515e06,_0x5af3f1){return db[_0xc46a('0x2d')][_0xc46a('0x47')]({'where':{'id':_0x515e06[_0xc46a('0x4a')]['id']}})[_0xc46a('0x27')](handleEntityNotFound(_0x5af3f1,null))[_0xc46a('0x27')](removeEntity(_0x5af3f1,null))['catch'](handleError(_0x5af3f1,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 62ca2f8..2b14b1e 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 _0xc55c=['api','moment','bluebird','request-promise','path','rimraf','./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc55c,0x1cf));var _0xcc55=function(_0x47a12b,_0x5b7daf){_0x47a12b=_0x47a12b-0x0;var _0x32ef7c=_0xc55c[_0x47a12b];return _0x32ef7c;};'use strict';var _=require(_0xcc55('0x0'));var util=require(_0xcc55('0x1'));var logger=require('../../config/logger')(_0xcc55('0x2'));var moment=require(_0xcc55('0x3'));var BPromise=require(_0xcc55('0x4'));var rp=require(_0xcc55('0x5'));var fs=require('fs');var path=require(_0xcc55('0x6'));var rimraf=require(_0xcc55('0x7'));var config=require('../../config/environment');var attributes=require(_0xcc55('0x8'));module[_0xcc55('0x9')]=function(_0x5ea205,_0x25d610){return _0x5ea205['define'](_0xcc55('0xa'),attributes,{'tableName':_0xcc55('0xb'),'paranoid':![],'indexes':[{'name':_0xcc55('0xc'),'fields':[_0xcc55('0xd'),_0xcc55('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeffe=['./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','idField','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xeffe,0x1b2));var _0xeeff=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xeffe[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0xeeff('0x0'));var util=require('util');var logger=require(_0xeeff('0x1'))(_0xeeff('0x2'));var moment=require(_0xeeff('0x3'));var BPromise=require(_0xeeff('0x4'));var rp=require(_0xeeff('0x5'));var fs=require('fs');var path=require(_0xeeff('0x6'));var rimraf=require('rimraf');var config=require(_0xeeff('0x7'));var attributes=require(_0xeeff('0x8'));module[_0xeeff('0x9')]=function(_0x242814,_0x44ea80){return _0x242814['define'](_0xeeff('0xa'),attributes,{'tableName':_0xeeff('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xeeff('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 14c9e81..6f38a4e 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 _0x70e0=['code','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1d5b22,_0x5f52ab){var _0x3ea80a=function(_0x55f716){while(--_0x55f716){_0x1d5b22['push'](_0x1d5b22['shift']());}};_0x3ea80a(++_0x5f52ab);}(_0x70e0,0x17b));var _0x070e=function(_0xbec587,_0x61ad0d){_0xbec587=_0xbec587-0x0;var _0x2b76cb=_0x70e0[_0xbec587];return _0x2b76cb;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0x0713=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5c65e5,_0x4c7595){var _0x5967f3=function(_0x376ea0){while(--_0x376ea0){_0x5c65e5['push'](_0x5c65e5['shift']());}};_0x5967f3(++_0x4c7595);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index a3d2e8a..a6bf9ae 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(_0x2ef63a,_0x1c7b82){var _0x8f6451=function(_0x4b85a0){while(--_0x4b85a0){_0x2ef63a['push'](_0x2ef63a['shift']());}};_0x8f6451(++_0x1c7b82);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x3b2fa0,_0xb9c8ef){var _0x7b98ae=function(_0x3ab144){while(--_0x3ab144){_0x3b2fa0['push'](_0x3b2fa0['shift']());}};_0x7b98ae(++_0xb9c8ef);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 34b6f36..9727b32 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(_0x2a6bfa,_0x5aa5ea){var _0x598109=function(_0x246756){while(--_0x246756){_0x2a6bfa['push'](_0x2a6bfa['shift']());}};_0x598109(++_0x5aa5ea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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(_0x40beee,_0x3ba425){var _0x499714=function(_0x43d2be){while(--_0x43d2be){_0x40beee['push'](_0x40beee['shift']());}};_0x499714(++_0x3ba425);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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 b72eb2d..ac8b21c 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 _0x1f1a=['count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','findOne','SugarcrmConfiguration','order','getConfigurations','addConfiguration','Subjects','getSubjects','channel','type','getDescriptions','SugarcrmField','Descriptions','assigned_user_id','created_by','description','date_start','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','/service/v4_1/rest.php','get_module_fields','stringify','values','module_fields','remove','includes','label','endsWith','value','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','statusCode','eml-format','request-promise','moment','bluebird','mustache','util','path','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/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit'];(function(_0x15be93,_0x20f756){var _0x57f982=function(_0x32c907){while(--_0x32c907){_0x15be93['push'](_0x15be93['shift']());}};_0x57f982(++_0x20f756);}(_0x1f1a,0xd5));var _0xa1f1=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x1f1a[_0x3ce3c];return _0x55a2c9;};'use strict';var emlformat=require(_0xa1f1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa1f1('0x1'));var moment=require(_0xa1f1('0x2'));var BPromise=require(_0xa1f1('0x3'));var Mustache=require(_0xa1f1('0x4'));var util=require(_0xa1f1('0x5'));var path=require(_0xa1f1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa1f1('0x7'));var _=require(_0xa1f1('0x8'));var squel=require(_0xa1f1('0x9'));var crypto=require(_0xa1f1('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa1f1('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa1f1('0xc'));var Papa=require(_0xa1f1('0xd'));var Redis=require(_0xa1f1('0xe'));var authService=require(_0xa1f1('0xf'));var qs=require(_0xa1f1('0x10'));var as=require(_0xa1f1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa1f1('0x12'))(_0xa1f1('0x13'));var utils=require(_0xa1f1('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa1f1('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa1f1('0x16'));function respondWithStatusCode(_0xcefd68,_0x81b07b){_0x81b07b=_0x81b07b||0xcc;return function(_0x4fceff){if(_0x4fceff){return _0xcefd68[_0xa1f1('0x17')](_0x81b07b);}return _0xcefd68['status'](_0x81b07b)[_0xa1f1('0x18')]();};}function respondWithResult(_0xfbfac8,_0x1c0c1d){_0x1c0c1d=_0x1c0c1d||0xc8;return function(_0x2973a2){if(_0x2973a2){return _0xfbfac8[_0xa1f1('0x19')](_0x1c0c1d)[_0xa1f1('0x1a')](_0x2973a2);}};}function respondWithFilteredResult(_0x501e8b,_0x40f52a){return function(_0x4427a4){if(_0x4427a4){var _0x144823=typeof _0x40f52a[_0xa1f1('0x1b')]==='undefined'&&typeof _0x40f52a[_0xa1f1('0x1c')]==='undefined';var _0x875a79=_0x4427a4['count'];var _0x41ef31=_0x144823?0x0:_0x40f52a[_0xa1f1('0x1b')];var _0x4387d3=_0x144823?_0x4427a4[_0xa1f1('0x1d')]:_0x40f52a[_0xa1f1('0x1b')]+_0x40f52a[_0xa1f1('0x1c')];var _0x54ceb8;if(_0x4387d3>=_0x875a79){_0x4387d3=_0x875a79;_0x54ceb8=0xc8;}else{_0x54ceb8=0xce;}_0x501e8b[_0xa1f1('0x19')](_0x54ceb8);return _0x501e8b[_0xa1f1('0x1e')](_0xa1f1('0x1f'),_0x41ef31+'-'+_0x4387d3+'/'+_0x875a79)[_0xa1f1('0x1a')](_0x4427a4);}return null;};}function patchUpdates(_0x1253f1){return function(_0x346175){try{jsonpatch[_0xa1f1('0x20')](_0x346175,_0x1253f1,!![]);}catch(_0x24b2a1){return BPromise[_0xa1f1('0x21')](_0x24b2a1);}return _0x346175[_0xa1f1('0x22')]();};}function saveUpdates(_0x23d239,_0x1356cd){return function(_0x23773c){if(_0x23773c){return _0x23773c['update'](_0x23d239)[_0xa1f1('0x23')](function(_0x2089d5){return _0x2089d5;});}return null;};}function removeEntity(_0x344184,_0x2219a4){return function(_0x2d38ac){if(_0x2d38ac){return _0x2d38ac[_0xa1f1('0x24')]()[_0xa1f1('0x23')](function(){_0x344184['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x270c50,_0x2aab02){return function(_0xd99480){if(!_0xd99480){_0x270c50[_0xa1f1('0x17')](0x194);}return _0xd99480;};}function handleError(_0x125960,_0x48a2cd){_0x48a2cd=_0x48a2cd||0x1f4;return function(_0x21ee82){logger[_0xa1f1('0x25')](_0x21ee82[_0xa1f1('0x26')]);if(_0x21ee82[_0xa1f1('0x27')]){delete _0x21ee82['name'];}_0x125960['status'](_0x48a2cd)[_0xa1f1('0x28')](_0x21ee82);};}exports[_0xa1f1('0x29')]=function(_0x186bcc,_0x5f239e){var _0x3aab11={},_0x3a9974={},_0x5ce13b={'count':0x0,'rows':[]};var _0x3566a2=_[_0xa1f1('0x2a')](db[_0xa1f1('0x2b')][_0xa1f1('0x2c')],function(_0x12d5a2){return{'name':_0x12d5a2[_0xa1f1('0x2d')],'type':_0x12d5a2['type'][_0xa1f1('0x2e')]};});_0x3a9974[_0xa1f1('0x2f')]=_['map'](_0x3566a2,_0xa1f1('0x27'));_0x3a9974[_0xa1f1('0x30')]=_[_0xa1f1('0x31')](_0x186bcc[_0xa1f1('0x30')]);_0x3a9974['filters']=_['intersection'](_0x3a9974[_0xa1f1('0x2f')],_0x3a9974['query']);_0x3aab11[_0xa1f1('0x32')]=_[_0xa1f1('0x33')](_0x3a9974[_0xa1f1('0x2f')],qs[_0xa1f1('0x34')](_0x186bcc[_0xa1f1('0x30')][_0xa1f1('0x34')]));_0x3aab11[_0xa1f1('0x32')]=_0x3aab11['attributes'][_0xa1f1('0x35')]?_0x3aab11[_0xa1f1('0x32')]:_0x3a9974[_0xa1f1('0x2f')];if(!_0x186bcc[_0xa1f1('0x30')][_0xa1f1('0x36')](_0xa1f1('0x37'))){_0x3aab11['limit']=qs[_0xa1f1('0x1c')](_0x186bcc[_0xa1f1('0x30')][_0xa1f1('0x1c')]);_0x3aab11[_0xa1f1('0x1b')]=qs[_0xa1f1('0x1b')](_0x186bcc['query'][_0xa1f1('0x1b')]);}_0x3aab11['order']=qs[_0xa1f1('0x38')](_0x186bcc[_0xa1f1('0x30')][_0xa1f1('0x38')]);_0x3aab11[_0xa1f1('0x39')]=qs[_0xa1f1('0x3a')](_[_0xa1f1('0x3b')](_0x186bcc[_0xa1f1('0x30')],_0x3a9974[_0xa1f1('0x3a')]),_0x3566a2);if(_0x186bcc[_0xa1f1('0x30')][_0xa1f1('0x3c')]){_0x3aab11[_0xa1f1('0x39')]=_[_0xa1f1('0x3d')](_0x3aab11[_0xa1f1('0x39')],{'$or':_[_0xa1f1('0x2a')](_0x3566a2,function(_0xaca1b1){if(_0xaca1b1['type']!==_0xa1f1('0x3e')){var _0x110d83={};_0x110d83[_0xaca1b1[_0xa1f1('0x27')]]={'$like':'%'+_0x186bcc[_0xa1f1('0x30')][_0xa1f1('0x3c')]+'%'};return _0x110d83;}})});}_0x3aab11=_['merge']({},_0x3aab11,_0x186bcc['options']);var _0x494a64={'where':_0x3aab11[_0xa1f1('0x39')]};return db['SugarcrmAccount'][_0xa1f1('0x1d')](_0x494a64)[_0xa1f1('0x23')](function(_0x108960){_0x5ce13b[_0xa1f1('0x1d')]=_0x108960;if(_0x186bcc[_0xa1f1('0x30')][_0xa1f1('0x3f')]){_0x3aab11[_0xa1f1('0x40')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xa1f1('0x41')](_0x3aab11);})[_0xa1f1('0x23')](function(_0x278036){_0x5ce13b[_0xa1f1('0x42')]=_0x278036;return _0x5ce13b;})[_0xa1f1('0x23')](respondWithFilteredResult(_0x5f239e,_0x3aab11))[_0xa1f1('0x43')](handleError(_0x5f239e,null));};exports[_0xa1f1('0x44')]=function(_0x36400b,_0x48eacb){var _0x24e09c={'raw':![],'where':{'id':_0x36400b[_0xa1f1('0x45')]['id']}},_0x5da0b3={};_0x5da0b3[_0xa1f1('0x2f')]=_[_0xa1f1('0x31')](db['SugarcrmAccount']['rawAttributes']);_0x5da0b3[_0xa1f1('0x30')]=_[_0xa1f1('0x31')](_0x36400b[_0xa1f1('0x30')]);_0x5da0b3[_0xa1f1('0x3a')]=_[_0xa1f1('0x33')](_0x5da0b3[_0xa1f1('0x2f')],_0x5da0b3['query']);_0x24e09c['attributes']=_['intersection'](_0x5da0b3[_0xa1f1('0x2f')],qs['fields'](_0x36400b[_0xa1f1('0x30')][_0xa1f1('0x34')]));_0x24e09c[_0xa1f1('0x32')]=_0x24e09c[_0xa1f1('0x32')][_0xa1f1('0x35')]?_0x24e09c[_0xa1f1('0x32')]:_0x5da0b3[_0xa1f1('0x2f')];if(_0x36400b[_0xa1f1('0x30')][_0xa1f1('0x3f')]){_0x24e09c[_0xa1f1('0x40')]=[{'all':!![]}];}_0x24e09c=_[_0xa1f1('0x3d')]({},_0x24e09c,_0x36400b[_0xa1f1('0x46')]);return db[_0xa1f1('0x2b')][_0xa1f1('0x47')](_0x24e09c)['then'](handleEntityNotFound(_0x48eacb,null))[_0xa1f1('0x23')](respondWithResult(_0x48eacb,null))[_0xa1f1('0x43')](handleError(_0x48eacb,null));};exports[_0xa1f1('0x48')]=function(_0x20c4ca,_0x33d91c){return db[_0xa1f1('0x2b')]['create'](_0x20c4ca[_0xa1f1('0x49')],{})[_0xa1f1('0x23')](respondWithResult(_0x33d91c,0xc9))[_0xa1f1('0x43')](handleError(_0x33d91c,null));};exports[_0xa1f1('0x4a')]=function(_0x3cbfb9,_0x5cc544){if(_0x3cbfb9[_0xa1f1('0x49')]['id']){delete _0x3cbfb9['body']['id'];}return db[_0xa1f1('0x2b')][_0xa1f1('0x47')]({'where':{'id':_0x3cbfb9['params']['id']}})[_0xa1f1('0x23')](handleEntityNotFound(_0x5cc544,null))['then'](saveUpdates(_0x3cbfb9[_0xa1f1('0x49')],null))[_0xa1f1('0x23')](respondWithResult(_0x5cc544,null))['catch'](handleError(_0x5cc544,null));};exports[_0xa1f1('0x24')]=function(_0x17047d,_0x41dfd2){return db[_0xa1f1('0x2b')]['find']({'where':{'id':_0x17047d['params']['id']}})[_0xa1f1('0x23')](handleEntityNotFound(_0x41dfd2,null))[_0xa1f1('0x23')](removeEntity(_0x41dfd2,null))['catch'](handleError(_0x41dfd2,null));};exports['getConfigurations']=function(_0x51d977,_0x1a1dac,_0x44aefa){var _0x50e24e={};var _0x15b7ab={};var _0x44d558;var _0x40eb4c;return db[_0xa1f1('0x2b')][_0xa1f1('0x4b')]({'where':{'id':_0x51d977[_0xa1f1('0x45')]['id']}})[_0xa1f1('0x23')](handleEntityNotFound(_0x1a1dac,null))[_0xa1f1('0x23')](function(_0x21800d){if(_0x21800d){_0x44d558=_0x21800d;_0x15b7ab['model']=_['keys'](db[_0xa1f1('0x4c')][_0xa1f1('0x2c')]);_0x15b7ab[_0xa1f1('0x30')]=_[_0xa1f1('0x31')](_0x51d977[_0xa1f1('0x30')]);_0x15b7ab[_0xa1f1('0x3a')]=_[_0xa1f1('0x33')](_0x15b7ab[_0xa1f1('0x2f')],_0x15b7ab[_0xa1f1('0x30')]);_0x50e24e[_0xa1f1('0x32')]=_['intersection'](_0x15b7ab[_0xa1f1('0x2f')],qs['fields'](_0x51d977[_0xa1f1('0x30')][_0xa1f1('0x34')]));_0x50e24e[_0xa1f1('0x32')]=_0x50e24e[_0xa1f1('0x32')][_0xa1f1('0x35')]?_0x50e24e[_0xa1f1('0x32')]:_0x15b7ab[_0xa1f1('0x2f')];_0x50e24e[_0xa1f1('0x4d')]=qs[_0xa1f1('0x38')](_0x51d977[_0xa1f1('0x30')]['sort']);_0x50e24e[_0xa1f1('0x39')]=qs['filters'](_[_0xa1f1('0x3b')](_0x51d977[_0xa1f1('0x30')],_0x15b7ab['filters']));if(_0x51d977['query'][_0xa1f1('0x3c')]){_0x50e24e[_0xa1f1('0x39')]=_[_0xa1f1('0x3d')](_0x50e24e[_0xa1f1('0x39')],{'$or':_[_0xa1f1('0x2a')](_0x50e24e[_0xa1f1('0x32')],function(_0x20dbab){var _0x5442ae={};_0x5442ae[_0x20dbab]={'$like':'%'+_0x51d977[_0xa1f1('0x30')]['filter']+'%'};return _0x5442ae;})});}_0x50e24e=_[_0xa1f1('0x3d')]({},_0x50e24e,_0x51d977[_0xa1f1('0x46')]);return _0x44d558[_0xa1f1('0x4e')](_0x50e24e);}})[_0xa1f1('0x23')](function(_0x4e1060){if(_0x4e1060){_0x40eb4c=_0x4e1060[_0xa1f1('0x35')];if(!_0x51d977['query'][_0xa1f1('0x36')]('nolimit')){_0x50e24e[_0xa1f1('0x1c')]=qs['limit'](_0x51d977[_0xa1f1('0x30')][_0xa1f1('0x1c')]);_0x50e24e[_0xa1f1('0x1b')]=qs[_0xa1f1('0x1b')](_0x51d977[_0xa1f1('0x30')][_0xa1f1('0x1b')]);}return _0x44d558[_0xa1f1('0x4e')](_0x50e24e);}})['then'](function(_0x28269e){if(_0x28269e){return _0x28269e?{'count':_0x40eb4c,'rows':_0x28269e}:null;}})[_0xa1f1('0x23')](respondWithResult(_0x1a1dac,null))['catch'](handleError(_0x1a1dac,null));};exports[_0xa1f1('0x4f')]=function(_0x498525,_0x31c9ed,_0x20b75d){if(_0x498525[_0xa1f1('0x49')]['id']){delete _0x498525[_0xa1f1('0x49')]['id'];}return db['SugarcrmAccount'][_0xa1f1('0x4b')]({'where':{'id':_0x498525[_0xa1f1('0x45')]['id']}})[_0xa1f1('0x23')](handleEntityNotFound(_0x31c9ed,null))[_0xa1f1('0x23')](function(_0x326285){if(_0x326285){_0x498525[_0xa1f1('0x49')]['AccountId']=_0x326285['id'];_0x498525[_0xa1f1('0x49')][_0xa1f1('0x50')]=integrations[_0xa1f1('0x51')](_0x498525[_0xa1f1('0x49')][_0xa1f1('0x52')],_0x498525[_0xa1f1('0x49')][_0xa1f1('0x53')]);_0x498525[_0xa1f1('0x49')]['Descriptions']=integrations[_0xa1f1('0x54')](_0x498525[_0xa1f1('0x49')][_0xa1f1('0x52')],_0x498525[_0xa1f1('0x49')][_0xa1f1('0x53')]);return db[_0xa1f1('0x4c')][_0xa1f1('0x48')](_0x498525[_0xa1f1('0x49')],{'include':[{'model':db[_0xa1f1('0x55')],'as':_0xa1f1('0x50')},{'model':db[_0xa1f1('0x55')],'as':_0xa1f1('0x56')}]});}return null;})[_0xa1f1('0x23')](respondWithResult(_0x31c9ed,null))['catch'](handleError(_0x31c9ed,null));};exports['getFields']=function(_0x4ef7d3,_0x4a6695,_0x11ff5a){var _0x527870='';var _0x29dee7=['id','name',_0xa1f1('0x57'),_0xa1f1('0x58'),_0xa1f1('0x59'),_0xa1f1('0x5a'),'duration_hours','duration_minutes','parent_id','parent_type',_0xa1f1('0x5b'),_0xa1f1('0x5c')];return db[_0xa1f1('0x2b')][_0xa1f1('0x4b')]({'where':{'id':_0x4ef7d3[_0xa1f1('0x45')]['id']},'attributes':['id',_0xa1f1('0x5d'),_0xa1f1('0x5e'),_0xa1f1('0x5f')]})[_0xa1f1('0x23')](handleEntityNotFound(_0x4a6695,null))['then'](function(_0x165ffd){if(_0x165ffd){_0x527870=_0x165ffd[_0xa1f1('0x5f')];var _0x239d27=_0x527870[_0xa1f1('0x60')](-0x1);if(_0x239d27==='/'){_0x527870=_0x527870[_0xa1f1('0x61')](0x0,_0x527870[_0xa1f1('0x62')](_0x239d27));}return rp({'method':_0xa1f1('0x63'),'uri':util['format']('%s%s',_0x527870,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xa1f1('0x64'),'input_type':'JSON','response_type':_0xa1f1('0x65'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x165ffd['username'],'password':_0x165ffd[_0xa1f1('0x5e')],'encryption':_0xa1f1('0x66')},'application':_0xa1f1('0x67')})}});}})[_0xa1f1('0x23')](function(_0x5a98c5){if(_0x5a98c5&&_0x5a98c5[_0xa1f1('0x27')]!==_0xa1f1('0x68')&&_0x5a98c5[_0xa1f1('0x27')]!==_0xa1f1('0x69')){return rp({'method':'POST','uri':util['format'](_0xa1f1('0x6a'),_0x527870,_0xa1f1('0x6b')),'json':!![],'form':{'method':_0xa1f1('0x6c'),'input_type':'JSON','response_type':_0xa1f1('0x65'),'rest_data':JSON[_0xa1f1('0x6d')]({'session':_0x5a98c5['id'],'module_name':'Calls'})}})[_0xa1f1('0x23')](function(_0x526e89){if(_0x526e89){var _0x2bd191=_[_0xa1f1('0x6e')](_0x526e89[_0xa1f1('0x6f')]);_[_0xa1f1('0x70')](_0x2bd191,function(_0x56774e){return _0x29dee7[_0xa1f1('0x71')](_0x56774e['name']);});return{'count':_0x2bd191[_0xa1f1('0x35')],'rows':_[_0xa1f1('0x2a')](_0x2bd191,function(_0x3d7308){return{'id':_0x3d7308['name'],'name':_0x3d7308[_0xa1f1('0x72')],'custom':_[_0xa1f1('0x73')](_0x3d7308[_0xa1f1('0x27')],'_c')?!![]:![],'options':_0x3d7308[_0xa1f1('0x46')]?_[_0xa1f1('0x2a')](_['values'](_0x3d7308['options']),function(_0x107d65){return{'name':_0x107d65[_0xa1f1('0x74')],'value':_0x107d65[_0xa1f1('0x27')]};}):[]};})};}})[_0xa1f1('0x23')](respondWithResult(_0x4a6695,null))[_0xa1f1('0x43')](function(_0xb1dd09){var _0x41b1af=_0x4ef7d3[_0xa1f1('0x30')]['test']?0x1f4:_0xb1dd09['statusCode']||0x1f4;logger[_0xa1f1('0x25')](_0xa1f1('0x75'),_0xa1f1('0x76'),_0x41b1af,JSON['stringify'](_0xb1dd09));delete _0xb1dd09[_0xa1f1('0x27')];if(_0x41b1af===0x191){_0x41b1af=0x190;}_0x4a6695[_0xa1f1('0x19')](_0x41b1af)[_0xa1f1('0x28')](_0x4ef7d3[_0xa1f1('0x30')]['test']?{'message':_0xa1f1('0x77'),'statusCode':_0xb1dd09[_0xa1f1('0x78')]}:_0xb1dd09);});}else{var _0xe57589=0x1f4;_0x4a6695[_0xa1f1('0x19')](_0xe57589)[_0xa1f1('0x28')]({'message':_0xa1f1('0x77'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x67e0=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','then','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','options','includeAll','include','rows','show','params','create','body','find','catch','findOne','SugarcrmConfiguration','order','pick','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','%s%s','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','format','Calls','values','module_fields','remove','label','endsWith','value','test','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x67e0,0xdc));var _0x067e=function(_0x3ad9b3,_0x5c76e9){_0x3ad9b3=_0x3ad9b3-0x0;var _0x4ef8d1=_0x67e0[_0x3ad9b3];return _0x4ef8d1;};'use strict';var emlformat=require(_0x067e('0x0'));var rimraf=require(_0x067e('0x1'));var zipdir=require(_0x067e('0x2'));var jsonpatch=require(_0x067e('0x3'));var rp=require('request-promise');var moment=require(_0x067e('0x4'));var BPromise=require(_0x067e('0x5'));var Mustache=require(_0x067e('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x067e('0x7'));var squel=require(_0x067e('0x8'));var crypto=require(_0x067e('0x9'));var jsforce=require(_0x067e('0xa'));var deskjs=require(_0x067e('0xb'));var toCsv=require(_0x067e('0xc'));var querystring=require(_0x067e('0xd'));var Papa=require(_0x067e('0xe'));var Redis=require(_0x067e('0xf'));var authService=require(_0x067e('0x10'));var qs=require(_0x067e('0x11'));var as=require(_0x067e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x067e('0x13'))(_0x067e('0x14'));var utils=require(_0x067e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x067e('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x067e('0x17'));function respondWithStatusCode(_0x5164dd,_0x1df7e4){_0x1df7e4=_0x1df7e4||0xcc;return function(_0x4eeca9){if(_0x4eeca9){return _0x5164dd[_0x067e('0x18')](_0x1df7e4);}return _0x5164dd[_0x067e('0x19')](_0x1df7e4)[_0x067e('0x1a')]();};}function respondWithResult(_0x157457,_0x55025a){_0x55025a=_0x55025a||0xc8;return function(_0x429c1f){if(_0x429c1f){return _0x157457[_0x067e('0x19')](_0x55025a)['json'](_0x429c1f);}};}function respondWithFilteredResult(_0xb713b1,_0x3d79a6){return function(_0x3cc8f4){if(_0x3cc8f4){var _0x9c4692=typeof _0x3d79a6[_0x067e('0x1b')]===_0x067e('0x1c')&&typeof _0x3d79a6[_0x067e('0x1d')]===_0x067e('0x1c');var _0x5b5281=_0x3cc8f4[_0x067e('0x1e')];var _0x5d23b6=_0x9c4692?0x0:_0x3d79a6['offset'];var _0x533942=_0x9c4692?_0x3cc8f4[_0x067e('0x1e')]:_0x3d79a6['offset']+_0x3d79a6[_0x067e('0x1d')];var _0x4267dc;if(_0x533942>=_0x5b5281){_0x533942=_0x5b5281;_0x4267dc=0xc8;}else{_0x4267dc=0xce;}_0xb713b1['status'](_0x4267dc);return _0xb713b1['set'](_0x067e('0x1f'),_0x5d23b6+'-'+_0x533942+'/'+_0x5b5281)[_0x067e('0x20')](_0x3cc8f4);}return null;};}function patchUpdates(_0x48cfaa){return function(_0x37086d){try{jsonpatch['apply'](_0x37086d,_0x48cfaa,!![]);}catch(_0x297f81){return BPromise[_0x067e('0x21')](_0x297f81);}return _0x37086d[_0x067e('0x22')]();};}function saveUpdates(_0x5e0a9a,_0x1d241f){return function(_0x143c41){if(_0x143c41){return _0x143c41['update'](_0x5e0a9a)[_0x067e('0x23')](function(_0x2b6baf){return _0x2b6baf;});}return null;};}function removeEntity(_0x3d9af6,_0x3ddc67){return function(_0x2c03c1){if(_0x2c03c1){return _0x2c03c1['destroy']()[_0x067e('0x23')](function(){_0x3d9af6[_0x067e('0x19')](0xcc)[_0x067e('0x1a')]();});}};}function handleEntityNotFound(_0x13f159,_0x1ec950){return function(_0x306dd3){if(!_0x306dd3){_0x13f159['sendStatus'](0x194);}return _0x306dd3;};}function handleError(_0x487ac9,_0x316e98){_0x316e98=_0x316e98||0x1f4;return function(_0x2a1f52){logger[_0x067e('0x24')](_0x2a1f52[_0x067e('0x25')]);if(_0x2a1f52[_0x067e('0x26')]){delete _0x2a1f52['name'];}_0x487ac9[_0x067e('0x19')](_0x316e98)[_0x067e('0x27')](_0x2a1f52);};}exports[_0x067e('0x28')]=function(_0x41395b,_0x2496bb){var _0x440bab={},_0x3badd4={},_0x5e8e52={'count':0x0,'rows':[]};var _0x9f52c4=_[_0x067e('0x29')](db[_0x067e('0x2a')][_0x067e('0x2b')],function(_0x5780bf){return{'name':_0x5780bf[_0x067e('0x2c')],'type':_0x5780bf[_0x067e('0x2d')]['key']};});_0x3badd4['model']=_[_0x067e('0x29')](_0x9f52c4,'name');_0x3badd4['query']=_[_0x067e('0x2e')](_0x41395b[_0x067e('0x2f')]);_0x3badd4['filters']=_[_0x067e('0x30')](_0x3badd4[_0x067e('0x31')],_0x3badd4[_0x067e('0x2f')]);_0x440bab[_0x067e('0x32')]=_['intersection'](_0x3badd4[_0x067e('0x31')],qs[_0x067e('0x33')](_0x41395b[_0x067e('0x2f')][_0x067e('0x33')]));_0x440bab[_0x067e('0x32')]=_0x440bab[_0x067e('0x32')][_0x067e('0x34')]?_0x440bab[_0x067e('0x32')]:_0x3badd4['model'];if(!_0x41395b['query'][_0x067e('0x35')](_0x067e('0x36'))){_0x440bab[_0x067e('0x1d')]=qs[_0x067e('0x1d')](_0x41395b[_0x067e('0x2f')]['limit']);_0x440bab[_0x067e('0x1b')]=qs['offset'](_0x41395b[_0x067e('0x2f')]['offset']);}_0x440bab['order']=qs['sort'](_0x41395b['query'][_0x067e('0x37')]);_0x440bab[_0x067e('0x38')]=qs['filters'](_['pick'](_0x41395b[_0x067e('0x2f')],_0x3badd4[_0x067e('0x39')]),_0x9f52c4);if(_0x41395b[_0x067e('0x2f')][_0x067e('0x3a')]){_0x440bab[_0x067e('0x38')]=_[_0x067e('0x3b')](_0x440bab[_0x067e('0x38')],{'$or':_[_0x067e('0x29')](_0x9f52c4,function(_0x421863){if(_0x421863['type']!=='VIRTUAL'){var _0x224da7={};_0x224da7[_0x421863[_0x067e('0x26')]]={'$like':'%'+_0x41395b[_0x067e('0x2f')][_0x067e('0x3a')]+'%'};return _0x224da7;}})});}_0x440bab=_[_0x067e('0x3b')]({},_0x440bab,_0x41395b[_0x067e('0x3c')]);var _0x4dcabb={'where':_0x440bab['where']};return db[_0x067e('0x2a')][_0x067e('0x1e')](_0x4dcabb)[_0x067e('0x23')](function(_0x342986){_0x5e8e52[_0x067e('0x1e')]=_0x342986;if(_0x41395b[_0x067e('0x2f')][_0x067e('0x3d')]){_0x440bab[_0x067e('0x3e')]=[{'all':!![]}];}return db[_0x067e('0x2a')]['findAll'](_0x440bab);})[_0x067e('0x23')](function(_0x56fa5d){_0x5e8e52[_0x067e('0x3f')]=_0x56fa5d;return _0x5e8e52;})[_0x067e('0x23')](respondWithFilteredResult(_0x2496bb,_0x440bab))['catch'](handleError(_0x2496bb,null));};exports[_0x067e('0x40')]=function(_0x5b1bfc,_0x439bc5){var _0x1c2cb9={'raw':![],'where':{'id':_0x5b1bfc[_0x067e('0x41')]['id']}},_0x393297={};_0x393297['model']=_[_0x067e('0x2e')](db[_0x067e('0x2a')][_0x067e('0x2b')]);_0x393297['query']=_[_0x067e('0x2e')](_0x5b1bfc['query']);_0x393297[_0x067e('0x39')]=_['intersection'](_0x393297[_0x067e('0x31')],_0x393297['query']);_0x1c2cb9['attributes']=_[_0x067e('0x30')](_0x393297[_0x067e('0x31')],qs['fields'](_0x5b1bfc[_0x067e('0x2f')][_0x067e('0x33')]));_0x1c2cb9[_0x067e('0x32')]=_0x1c2cb9['attributes']['length']?_0x1c2cb9['attributes']:_0x393297['model'];if(_0x5b1bfc['query'][_0x067e('0x3d')]){_0x1c2cb9[_0x067e('0x3e')]=[{'all':!![]}];}_0x1c2cb9=_[_0x067e('0x3b')]({},_0x1c2cb9,_0x5b1bfc['options']);return db['SugarcrmAccount']['find'](_0x1c2cb9)[_0x067e('0x23')](handleEntityNotFound(_0x439bc5,null))[_0x067e('0x23')](respondWithResult(_0x439bc5,null))['catch'](handleError(_0x439bc5,null));};exports[_0x067e('0x42')]=function(_0x154c6a,_0x3c9efb){return db[_0x067e('0x2a')][_0x067e('0x42')](_0x154c6a[_0x067e('0x43')],{})[_0x067e('0x23')](respondWithResult(_0x3c9efb,0xc9))['catch'](handleError(_0x3c9efb,null));};exports['update']=function(_0x1d4eb7,_0x26bddd){if(_0x1d4eb7[_0x067e('0x43')]['id']){delete _0x1d4eb7['body']['id'];}return db[_0x067e('0x2a')]['find']({'where':{'id':_0x1d4eb7[_0x067e('0x41')]['id']}})['then'](handleEntityNotFound(_0x26bddd,null))['then'](saveUpdates(_0x1d4eb7['body'],null))['then'](respondWithResult(_0x26bddd,null))['catch'](handleError(_0x26bddd,null));};exports['destroy']=function(_0x58916c,_0xccc37a){return db[_0x067e('0x2a')][_0x067e('0x44')]({'where':{'id':_0x58916c[_0x067e('0x41')]['id']}})[_0x067e('0x23')](handleEntityNotFound(_0xccc37a,null))[_0x067e('0x23')](removeEntity(_0xccc37a,null))[_0x067e('0x45')](handleError(_0xccc37a,null));};exports['getConfigurations']=function(_0x575fad,_0x2534d8,_0x4d7a43){var _0xb4d2ae={};var _0x19bb6d={};var _0xb320d2;var _0x3ea165;return db[_0x067e('0x2a')][_0x067e('0x46')]({'where':{'id':_0x575fad[_0x067e('0x41')]['id']}})[_0x067e('0x23')](handleEntityNotFound(_0x2534d8,null))[_0x067e('0x23')](function(_0x53ac5d){if(_0x53ac5d){_0xb320d2=_0x53ac5d;_0x19bb6d[_0x067e('0x31')]=_[_0x067e('0x2e')](db[_0x067e('0x47')][_0x067e('0x2b')]);_0x19bb6d[_0x067e('0x2f')]=_['keys'](_0x575fad['query']);_0x19bb6d['filters']=_[_0x067e('0x30')](_0x19bb6d[_0x067e('0x31')],_0x19bb6d[_0x067e('0x2f')]);_0xb4d2ae[_0x067e('0x32')]=_[_0x067e('0x30')](_0x19bb6d[_0x067e('0x31')],qs['fields'](_0x575fad['query'][_0x067e('0x33')]));_0xb4d2ae[_0x067e('0x32')]=_0xb4d2ae[_0x067e('0x32')][_0x067e('0x34')]?_0xb4d2ae['attributes']:_0x19bb6d[_0x067e('0x31')];_0xb4d2ae[_0x067e('0x48')]=qs['sort'](_0x575fad['query'][_0x067e('0x37')]);_0xb4d2ae[_0x067e('0x38')]=qs[_0x067e('0x39')](_[_0x067e('0x49')](_0x575fad['query'],_0x19bb6d['filters']));if(_0x575fad[_0x067e('0x2f')][_0x067e('0x3a')]){_0xb4d2ae['where']=_[_0x067e('0x3b')](_0xb4d2ae['where'],{'$or':_[_0x067e('0x29')](_0xb4d2ae[_0x067e('0x32')],function(_0x530780){var _0x65d7c={};_0x65d7c[_0x530780]={'$like':'%'+_0x575fad[_0x067e('0x2f')][_0x067e('0x3a')]+'%'};return _0x65d7c;})});}_0xb4d2ae=_[_0x067e('0x3b')]({},_0xb4d2ae,_0x575fad['options']);return _0xb320d2[_0x067e('0x4a')](_0xb4d2ae);}})[_0x067e('0x23')](function(_0x27730a){if(_0x27730a){_0x3ea165=_0x27730a[_0x067e('0x34')];if(!_0x575fad['query'][_0x067e('0x35')](_0x067e('0x36'))){_0xb4d2ae['limit']=qs[_0x067e('0x1d')](_0x575fad[_0x067e('0x2f')]['limit']);_0xb4d2ae[_0x067e('0x1b')]=qs['offset'](_0x575fad[_0x067e('0x2f')][_0x067e('0x1b')]);}return _0xb320d2[_0x067e('0x4a')](_0xb4d2ae);}})[_0x067e('0x23')](function(_0x30f02f){if(_0x30f02f){return _0x30f02f?{'count':_0x3ea165,'rows':_0x30f02f}:null;}})[_0x067e('0x23')](respondWithResult(_0x2534d8,null))[_0x067e('0x45')](handleError(_0x2534d8,null));};exports[_0x067e('0x4b')]=function(_0x436008,_0x25ce2e,_0xc51690){if(_0x436008['body']['id']){delete _0x436008[_0x067e('0x43')]['id'];}return db['SugarcrmAccount'][_0x067e('0x46')]({'where':{'id':_0x436008[_0x067e('0x41')]['id']}})[_0x067e('0x23')](handleEntityNotFound(_0x25ce2e,null))['then'](function(_0xa7f37f){if(_0xa7f37f){_0x436008[_0x067e('0x43')][_0x067e('0x4c')]=_0xa7f37f['id'];_0x436008[_0x067e('0x43')][_0x067e('0x4d')]=integrations[_0x067e('0x4e')](_0x436008['body'][_0x067e('0x4f')],_0x436008[_0x067e('0x43')][_0x067e('0x2d')]);_0x436008[_0x067e('0x43')][_0x067e('0x50')]=integrations[_0x067e('0x51')](_0x436008[_0x067e('0x43')][_0x067e('0x4f')],_0x436008[_0x067e('0x43')]['type']);return db[_0x067e('0x47')]['create'](_0x436008[_0x067e('0x43')],{'include':[{'model':db[_0x067e('0x52')],'as':_0x067e('0x4d')},{'model':db[_0x067e('0x52')],'as':_0x067e('0x50')}]});}return null;})['then'](respondWithResult(_0x25ce2e,null))[_0x067e('0x45')](handleError(_0x25ce2e,null));};exports['getFields']=function(_0x3f7d6e,_0x2af501,_0x359434){var _0x3d5dc1='';var _0x2c4d13=['id',_0x067e('0x26'),_0x067e('0x53'),_0x067e('0x54'),_0x067e('0x55'),_0x067e('0x56'),_0x067e('0x57'),_0x067e('0x58'),_0x067e('0x59'),'parent_type',_0x067e('0x5a'),_0x067e('0x5b')];return db[_0x067e('0x2a')][_0x067e('0x46')]({'where':{'id':_0x3f7d6e[_0x067e('0x41')]['id']},'attributes':['id',_0x067e('0x5c'),_0x067e('0x5d'),'remoteUri']})[_0x067e('0x23')](handleEntityNotFound(_0x2af501,null))[_0x067e('0x23')](function(_0x16869d){if(_0x16869d){_0x3d5dc1=_0x16869d[_0x067e('0x5e')];var _0x1c5ad4=_0x3d5dc1[_0x067e('0x5f')](-0x1);if(_0x1c5ad4==='/'){_0x3d5dc1=_0x3d5dc1[_0x067e('0x60')](0x0,_0x3d5dc1[_0x067e('0x61')](_0x1c5ad4));}return rp({'method':_0x067e('0x62'),'uri':util['format'](_0x067e('0x63'),_0x3d5dc1,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x067e('0x64'),'input_type':_0x067e('0x65'),'response_type':_0x067e('0x65'),'rest_data':JSON[_0x067e('0x66')]({'user_auth':{'user_name':_0x16869d[_0x067e('0x5c')],'password':_0x16869d[_0x067e('0x5d')],'encryption':_0x067e('0x67')},'application':_0x067e('0x68')})}});}})['then'](function(_0x2f457d){if(_0x2f457d&&_0x2f457d[_0x067e('0x26')]!=='Invalid\x20Login'&&_0x2f457d[_0x067e('0x26')]!=='Password\x20Expired'){return rp({'method':_0x067e('0x62'),'uri':util[_0x067e('0x69')](_0x067e('0x63'),_0x3d5dc1,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0x067e('0x65'),'rest_data':JSON[_0x067e('0x66')]({'session':_0x2f457d['id'],'module_name':_0x067e('0x6a')})}})[_0x067e('0x23')](function(_0xbd2723){if(_0xbd2723){var _0xe2eade=_[_0x067e('0x6b')](_0xbd2723[_0x067e('0x6c')]);_[_0x067e('0x6d')](_0xe2eade,function(_0x53aad4){return _0x2c4d13['includes'](_0x53aad4[_0x067e('0x26')]);});return{'count':_0xe2eade[_0x067e('0x34')],'rows':_[_0x067e('0x29')](_0xe2eade,function(_0x378c77){return{'id':_0x378c77[_0x067e('0x26')],'name':_0x378c77[_0x067e('0x6e')],'custom':_[_0x067e('0x6f')](_0x378c77['name'],'_c')?!![]:![],'options':_0x378c77[_0x067e('0x3c')]?_['map'](_[_0x067e('0x6b')](_0x378c77[_0x067e('0x3c')]),function(_0x4535c3){return{'name':_0x4535c3[_0x067e('0x70')],'value':_0x4535c3[_0x067e('0x26')]};}):[]};})};}})['then'](respondWithResult(_0x2af501,null))[_0x067e('0x45')](function(_0x800ae6){var _0x9ba44e=_0x3f7d6e[_0x067e('0x2f')][_0x067e('0x71')]?0x1f4:_0x800ae6['statusCode']||0x1f4;logger[_0x067e('0x24')](_0x067e('0x72'),_0x067e('0x73'),_0x9ba44e,JSON['stringify'](_0x800ae6));delete _0x800ae6[_0x067e('0x26')];if(_0x9ba44e===0x191){_0x9ba44e=0x190;}_0x2af501[_0x067e('0x19')](_0x9ba44e)[_0x067e('0x27')](_0x3f7d6e['query']['test']?{'message':_0x067e('0x74'),'statusCode':_0x800ae6[_0x067e('0x75')]}:_0x800ae6);});}else{var _0x341f7d=0x1f4;_0x2af501[_0x067e('0x19')](_0x341f7d)['send']({'message':_0x067e('0x74'),'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 51ea3a4..18291e2 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 _0x6802=['moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger'];(function(_0x1a3e23,_0xce45e){var _0x5ee0d8=function(_0x4b932f){while(--_0x4b932f){_0x1a3e23['push'](_0x1a3e23['shift']());}};_0x5ee0d8(++_0xce45e);}(_0x6802,0x123));var _0x2680=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6802[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2680('0x0'));var util=require(_0x2680('0x1'));var logger=require(_0x2680('0x2'))('api');var moment=require(_0x2680('0x3'));var BPromise=require(_0x2680('0x4'));var rp=require(_0x2680('0x5'));var fs=require('fs');var path=require(_0x2680('0x6'));var rimraf=require('rimraf');var config=require(_0x2680('0x7'));var attributes=require(_0x2680('0x8'));var integrations=require(_0x2680('0x9'));module[_0x2680('0xa')]=function(_0x50b6c5,_0x17c55){return _0x50b6c5[_0x2680('0xb')](_0x2680('0xc'),attributes,{'tableName':_0x2680('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91a4=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util'];(function(_0x3dd1e8,_0x5f4727){var _0x4c4a5b=function(_0x4dcad1){while(--_0x4dcad1){_0x3dd1e8['push'](_0x3dd1e8['shift']());}};_0x4c4a5b(++_0x5f4727);}(_0x91a4,0x11c));var _0x491a=function(_0x4cc5e6,_0x338ed3){_0x4cc5e6=_0x4cc5e6-0x0;var _0x40e00b=_0x91a4[_0x4cc5e6];return _0x40e00b;};'use strict';var _=require(_0x491a('0x0'));var util=require(_0x491a('0x1'));var logger=require(_0x491a('0x2'))(_0x491a('0x3'));var moment=require(_0x491a('0x4'));var BPromise=require(_0x491a('0x5'));var rp=require(_0x491a('0x6'));var fs=require('fs');var path=require(_0x491a('0x7'));var rimraf=require(_0x491a('0x8'));var config=require(_0x491a('0x9'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x491a('0xa')]=function(_0x335cf4,_0x1f5c98){return _0x335cf4['define'](_0x491a('0xb'),attributes,{'tableName':_0x491a('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 8ab975a..6b72862 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 _0xe84b=['SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','findAll','options','raw','include','map','attributes','GetSugarcrmAccount','catch','ShowSugarcrmAccount','SugarcrmAccount','find','where','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug'];(function(_0x1dbaf7,_0x3d05b3){var _0x593f05=function(_0x381936){while(--_0x381936){_0x1dbaf7['push'](_0x1dbaf7['shift']());}};_0x593f05(++_0x3d05b3);}(_0xe84b,0x158));var _0xbe84=function(_0x4e0a44,_0xbadb96){_0x4e0a44=_0x4e0a44-0x0;var _0x45ed17=_0xe84b[_0x4e0a44];return _0x45ed17;};'use strict';var _=require(_0xbe84('0x0'));var util=require(_0xbe84('0x1'));var moment=require(_0xbe84('0x2'));var BPromise=require(_0xbe84('0x3'));var rs=require(_0xbe84('0x4'));var fs=require('fs');var Redis=require(_0xbe84('0x5'));var db=require(_0xbe84('0x6'))['db'];var utils=require(_0xbe84('0x7'));var logger=require(_0xbe84('0x8'))('rpc');var config=require(_0xbe84('0x9'));var jayson=require(_0xbe84('0xa'));var client=jayson[_0xbe84('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52aebf,_0x460c6c,_0x20b648){return new BPromise(function(_0xde5e97,_0x5d79b9){return client['request'](_0x52aebf,_0x20b648)[_0xbe84('0xc')](function(_0x201bd0){logger[_0xbe84('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x460c6c,_0xbe84('0xe'));logger[_0xbe84('0xf')](_0xbe84('0x10'),_0x460c6c,_0xbe84('0xe'),JSON[_0xbe84('0x11')](_0x201bd0));if(_0x201bd0[_0xbe84('0x12')]){if(_0x201bd0[_0xbe84('0x12')][_0xbe84('0x13')]===0x1f4){logger['error'](_0xbe84('0x14'),_0x460c6c,_0x201bd0[_0xbe84('0x12')][_0xbe84('0x15')]);return _0x5d79b9(_0x201bd0[_0xbe84('0x12')][_0xbe84('0x15')]);}logger['error'](_0xbe84('0x14'),_0x460c6c,_0x201bd0[_0xbe84('0x12')][_0xbe84('0x15')]);return _0xde5e97(_0x201bd0[_0xbe84('0x12')][_0xbe84('0x15')]);}else{logger[_0xbe84('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x460c6c,'request\x20sent');_0xde5e97(_0x201bd0[_0xbe84('0x16')][_0xbe84('0x15')]);}})['catch'](function(_0x7fbccb){logger[_0xbe84('0x12')](_0xbe84('0x14'),_0x460c6c,_0x7fbccb);_0x5d79b9(_0x7fbccb);});});}exports['GetSugarcrmAccount']=function(_0x13ed01){var _0x3055d2=this;return new Promise(function(_0x1f7494,_0x359e19){return db['SugarcrmAccount'][_0xbe84('0x17')]({'raw':_0x13ed01['options']?_0x13ed01[_0xbe84('0x18')][_0xbe84('0x19')]===undefined?!![]:![]:!![],'where':_0x13ed01[_0xbe84('0x18')]?_0x13ed01[_0xbe84('0x18')]['where']||null:null,'attributes':_0x13ed01[_0xbe84('0x18')]?_0x13ed01[_0xbe84('0x18')]['attributes']||null:null,'limit':_0x13ed01[_0xbe84('0x18')]?_0x13ed01[_0xbe84('0x18')]['limit']||null:null,'include':_0x13ed01[_0xbe84('0x18')]?_0x13ed01[_0xbe84('0x18')][_0xbe84('0x1a')]?_[_0xbe84('0x1b')](_0x13ed01[_0xbe84('0x18')][_0xbe84('0x1a')],function(_0x368f75){return{'model':db[_0x368f75['model']],'as':_0x368f75['as'],'attributes':_0x368f75[_0xbe84('0x1c')],'include':_0x368f75[_0xbe84('0x1a')]?_['map'](_0x368f75[_0xbe84('0x1a')],function(_0xb5b895){return{'model':db[_0xb5b895['model']],'as':_0xb5b895['as'],'attributes':_0xb5b895['attributes'],'include':_0xb5b895['include']?_['map'](_0xb5b895[_0xbe84('0x1a')],function(_0x1d32ad){return{'model':db[_0x1d32ad['model']],'as':_0x1d32ad['as'],'attributes':_0x1d32ad[_0xbe84('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbe84('0xc')](function(_0x517cc6){logger[_0xbe84('0xd')]('GetSugarcrmAccount',_0x13ed01);logger['debug'](_0xbe84('0x1d'),_0x13ed01,JSON[_0xbe84('0x11')](_0x517cc6));_0x1f7494(_0x517cc6);})[_0xbe84('0x1e')](function(_0x1aeacc){logger[_0xbe84('0x12')](_0xbe84('0x1d'),_0x1aeacc[_0xbe84('0x15')],_0x13ed01);_0x359e19(_0x3055d2['error'](0x1f4,_0x1aeacc[_0xbe84('0x15')]));});});};exports[_0xbe84('0x1f')]=function(_0xfcb027){var _0x14d04d=this;return new Promise(function(_0x52f3b5,_0x56cddb){return db[_0xbe84('0x20')][_0xbe84('0x21')]({'raw':_0xfcb027[_0xbe84('0x18')]?_0xfcb027[_0xbe84('0x18')][_0xbe84('0x19')]===undefined?!![]:![]:!![],'where':_0xfcb027['options']?_0xfcb027['options'][_0xbe84('0x22')]||null:null,'attributes':_0xfcb027['options']?_0xfcb027['options'][_0xbe84('0x1c')]||null:null,'include':_0xfcb027[_0xbe84('0x18')]?_0xfcb027[_0xbe84('0x18')][_0xbe84('0x1a')]?_[_0xbe84('0x1b')](_0xfcb027[_0xbe84('0x18')]['include'],function(_0xe9a9bd){return{'model':db[_0xe9a9bd[_0xbe84('0x23')]],'as':_0xe9a9bd['as'],'attributes':_0xe9a9bd[_0xbe84('0x1c')],'include':_0xe9a9bd[_0xbe84('0x1a')]?_[_0xbe84('0x1b')](_0xe9a9bd[_0xbe84('0x1a')],function(_0x314074){return{'model':db[_0x314074[_0xbe84('0x23')]],'as':_0x314074['as'],'attributes':_0x314074[_0xbe84('0x1c')],'include':_0x314074[_0xbe84('0x1a')]?_['map'](_0x314074[_0xbe84('0x1a')],function(_0x17ba4e){return{'model':db[_0x17ba4e['model']],'as':_0x17ba4e['as'],'attributes':_0x17ba4e[_0xbe84('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbe84('0xc')](function(_0x5b1fac){logger[_0xbe84('0xd')](_0xbe84('0x1f'),_0xfcb027);logger[_0xbe84('0xf')](_0xbe84('0x1f'),_0xfcb027,JSON[_0xbe84('0x11')](_0x5b1fac));_0x52f3b5(_0x5b1fac);})[_0xbe84('0x1e')](function(_0x3ac793){logger[_0xbe84('0x12')](_0xbe84('0x1f'),_0x3ac793[_0xbe84('0x15')],_0xfcb027);_0x56cddb(_0x14d04d[_0xbe84('0x12')](0x1f4,_0x3ac793['message']));});});}; \ No newline at end of file +var _0xe533=['limit','include','map','model','attributes','ShowSugarcrmAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where'];(function(_0x54907f,_0x131444){var _0x473df9=function(_0x3d098d){while(--_0x3d098d){_0x54907f['push'](_0x54907f['shift']());}};_0x473df9(++_0x131444);}(_0xe533,0x179));var _0x3e53=function(_0x4bc8e6,_0x18c83a){_0x4bc8e6=_0x4bc8e6-0x0;var _0x578a0c=_0xe533[_0x4bc8e6];return _0x578a0c;};'use strict';var _=require('lodash');var util=require(_0x3e53('0x0'));var moment=require(_0x3e53('0x1'));var BPromise=require(_0x3e53('0x2'));var rs=require(_0x3e53('0x3'));var fs=require('fs');var Redis=require(_0x3e53('0x4'));var db=require(_0x3e53('0x5'))['db'];var utils=require(_0x3e53('0x6'));var logger=require(_0x3e53('0x7'))(_0x3e53('0x8'));var config=require(_0x3e53('0x9'));var jayson=require(_0x3e53('0xa'));var client=jayson[_0x3e53('0xb')][_0x3e53('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x44c17b,_0x1d484e,_0x486081){return new BPromise(function(_0x36e5b2,_0x1ea7ef){return client[_0x3e53('0xd')](_0x44c17b,_0x486081)[_0x3e53('0xe')](function(_0x93dd37){logger[_0x3e53('0xf')](_0x3e53('0x10'),_0x1d484e,'request\x20sent');logger[_0x3e53('0x11')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x1d484e,_0x3e53('0x12'),JSON[_0x3e53('0x13')](_0x93dd37));if(_0x93dd37[_0x3e53('0x14')]){if(_0x93dd37[_0x3e53('0x14')]['code']===0x1f4){logger['error'](_0x3e53('0x10'),_0x1d484e,_0x93dd37['error'][_0x3e53('0x15')]);return _0x1ea7ef(_0x93dd37[_0x3e53('0x14')][_0x3e53('0x15')]);}logger[_0x3e53('0x14')](_0x3e53('0x10'),_0x1d484e,_0x93dd37[_0x3e53('0x14')][_0x3e53('0x15')]);return _0x36e5b2(_0x93dd37[_0x3e53('0x14')][_0x3e53('0x15')]);}else{logger[_0x3e53('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x1d484e,_0x3e53('0x12'));_0x36e5b2(_0x93dd37[_0x3e53('0x16')][_0x3e53('0x15')]);}})[_0x3e53('0x17')](function(_0x5b8f5f){logger[_0x3e53('0x14')](_0x3e53('0x10'),_0x1d484e,_0x5b8f5f);_0x1ea7ef(_0x5b8f5f);});});}exports[_0x3e53('0x18')]=function(_0x47587c){var _0x30e86a=this;return new Promise(function(_0x24621f,_0x2700da){return db[_0x3e53('0x19')][_0x3e53('0x1a')]({'raw':_0x47587c['options']?_0x47587c[_0x3e53('0x1b')][_0x3e53('0x1c')]===undefined?!![]:![]:!![],'where':_0x47587c[_0x3e53('0x1b')]?_0x47587c['options'][_0x3e53('0x1d')]||null:null,'attributes':_0x47587c['options']?_0x47587c[_0x3e53('0x1b')]['attributes']||null:null,'limit':_0x47587c[_0x3e53('0x1b')]?_0x47587c['options'][_0x3e53('0x1e')]||null:null,'include':_0x47587c[_0x3e53('0x1b')]?_0x47587c[_0x3e53('0x1b')][_0x3e53('0x1f')]?_[_0x3e53('0x20')](_0x47587c[_0x3e53('0x1b')]['include'],function(_0x55c828){return{'model':db[_0x55c828[_0x3e53('0x21')]],'as':_0x55c828['as'],'attributes':_0x55c828[_0x3e53('0x22')],'include':_0x55c828[_0x3e53('0x1f')]?_[_0x3e53('0x20')](_0x55c828[_0x3e53('0x1f')],function(_0x18774e){return{'model':db[_0x18774e[_0x3e53('0x21')]],'as':_0x18774e['as'],'attributes':_0x18774e[_0x3e53('0x22')],'include':_0x18774e[_0x3e53('0x1f')]?_[_0x3e53('0x20')](_0x18774e[_0x3e53('0x1f')],function(_0x5b7335){return{'model':db[_0x5b7335[_0x3e53('0x21')]],'as':_0x5b7335['as'],'attributes':_0x5b7335['attributes']};}):[]};}):[]};}):[]:[]})[_0x3e53('0xe')](function(_0x2ac5a2){logger['info'](_0x3e53('0x18'),_0x47587c);logger['debug'](_0x3e53('0x18'),_0x47587c,JSON[_0x3e53('0x13')](_0x2ac5a2));_0x24621f(_0x2ac5a2);})['catch'](function(_0xdba9b0){logger[_0x3e53('0x14')]('GetSugarcrmAccount',_0xdba9b0[_0x3e53('0x15')],_0x47587c);_0x2700da(_0x30e86a[_0x3e53('0x14')](0x1f4,_0xdba9b0['message']));});});};exports[_0x3e53('0x23')]=function(_0x427f46){var _0x54d1b8=this;return new Promise(function(_0x2e712c,_0x57750e){return db[_0x3e53('0x19')][_0x3e53('0x24')]({'raw':_0x427f46[_0x3e53('0x1b')]?_0x427f46[_0x3e53('0x1b')][_0x3e53('0x1c')]===undefined?!![]:![]:!![],'where':_0x427f46[_0x3e53('0x1b')]?_0x427f46['options'][_0x3e53('0x1d')]||null:null,'attributes':_0x427f46['options']?_0x427f46[_0x3e53('0x1b')]['attributes']||null:null,'include':_0x427f46[_0x3e53('0x1b')]?_0x427f46['options'][_0x3e53('0x1f')]?_[_0x3e53('0x20')](_0x427f46[_0x3e53('0x1b')][_0x3e53('0x1f')],function(_0x4cdc6a){return{'model':db[_0x4cdc6a[_0x3e53('0x21')]],'as':_0x4cdc6a['as'],'attributes':_0x4cdc6a['attributes'],'include':_0x4cdc6a[_0x3e53('0x1f')]?_[_0x3e53('0x20')](_0x4cdc6a[_0x3e53('0x1f')],function(_0x40496b){return{'model':db[_0x40496b[_0x3e53('0x21')]],'as':_0x40496b['as'],'attributes':_0x40496b[_0x3e53('0x22')],'include':_0x40496b[_0x3e53('0x1f')]?_[_0x3e53('0x20')](_0x40496b[_0x3e53('0x1f')],function(_0x364903){return{'model':db[_0x364903[_0x3e53('0x21')]],'as':_0x364903['as'],'attributes':_0x364903['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x358457){logger[_0x3e53('0xf')]('ShowSugarcrmAccount',_0x427f46);logger[_0x3e53('0x11')]('ShowSugarcrmAccount',_0x427f46,JSON[_0x3e53('0x13')](_0x358457));_0x2e712c(_0x358457);})[_0x3e53('0x17')](function(_0x469be3){logger[_0x3e53('0x14')]('ShowSugarcrmAccount',_0x469be3[_0x3e53('0x15')],_0x427f46);_0x57750e(_0x54d1b8[_0x3e53('0x14')](0x1f4,_0x469be3['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index eaa33df..aa43da6 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 _0x9e32=['./intSugarcrmConfiguration.controller','index','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../config/environment'];(function(_0x21e200,_0x47ffcb){var _0x500aea=function(_0x6ce97d){while(--_0x6ce97d){_0x21e200['push'](_0x21e200['shift']());}};_0x500aea(++_0x47ffcb);}(_0x9e32,0x72));var _0x29e3=function(_0x3eb998,_0x4f5cee){_0x3eb998=_0x3eb998-0x0;var _0x272be1=_0x9e32[_0x3eb998];return _0x272be1;};'use strict';var multer=require(_0x29e3('0x0'));var util=require('util');var path=require(_0x29e3('0x1'));var timeout=require(_0x29e3('0x2'));var express=require(_0x29e3('0x3'));var router=express['Router']();var fs_extra=require(_0x29e3('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x29e3('0x5'));var controller=require(_0x29e3('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x29e3('0x7')]);router[_0x29e3('0x8')](_0x29e3('0x9'),auth[_0x29e3('0xa')](),controller[_0x29e3('0xb')]);router[_0x29e3('0x8')](_0x29e3('0xc'),auth[_0x29e3('0xa')](),controller[_0x29e3('0xd')]);router[_0x29e3('0x8')](_0x29e3('0xe'),auth[_0x29e3('0xa')](),controller[_0x29e3('0xf')]);router[_0x29e3('0x8')](_0x29e3('0x10'),auth[_0x29e3('0xa')](),controller[_0x29e3('0x11')]);router[_0x29e3('0x12')]('/',auth[_0x29e3('0xa')](),controller[_0x29e3('0x13')]);router[_0x29e3('0x14')](_0x29e3('0x9'),auth[_0x29e3('0xa')](),controller[_0x29e3('0x15')]);router[_0x29e3('0x16')](_0x29e3('0x9'),auth[_0x29e3('0xa')](),controller[_0x29e3('0x17')]);module['exports']=router; \ No newline at end of file +var _0xf8b3=['get','isAuthenticated','/:id/fields','/:id/descriptions','post','put','delete','/:id','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller'];(function(_0x96ccf2,_0x3cfc61){var _0x3087af=function(_0x29cce4){while(--_0x29cce4){_0x96ccf2['push'](_0x96ccf2['shift']());}};_0x3087af(++_0x3cfc61);}(_0xf8b3,0x172));var _0x3f8b=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xf8b3[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x3f8b('0x0'));var util=require('util');var path=require(_0x3f8b('0x1'));var timeout=require(_0x3f8b('0x2'));var express=require(_0x3f8b('0x3'));var router=express[_0x3f8b('0x4')]();var fs_extra=require(_0x3f8b('0x5'));var auth=require(_0x3f8b('0x6'));var interaction=require(_0x3f8b('0x7'));var config=require(_0x3f8b('0x8'));var controller=require(_0x3f8b('0x9'));router[_0x3f8b('0xa')]('/',auth[_0x3f8b('0xb')](),controller['index']);router[_0x3f8b('0xa')]('/:id',auth[_0x3f8b('0xb')](),controller['show']);router['get'](_0x3f8b('0xc'),auth['isAuthenticated'](),controller['getFields']);router['get']('/:id/subjects',auth[_0x3f8b('0xb')](),controller['getSubjects']);router[_0x3f8b('0xa')](_0x3f8b('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x3f8b('0xe')]('/',auth[_0x3f8b('0xb')](),controller['create']);router[_0x3f8b('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x3f8b('0x10')](_0x3f8b('0x11'),auth[_0x3f8b('0xb')](),controller[_0x3f8b('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index d6ec316..31a4540 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 _0x0864=['sequelize','exports','STRING'];(function(_0x579c69,_0x3a034d){var _0xd8656b=function(_0x3d900d){while(--_0x3d900d){_0x579c69['push'](_0x579c69['shift']());}};_0xd8656b(++_0x3a034d);}(_0x0864,0x12f));var _0x4086=function(_0x36e05a,_0x4bd0a8){_0x36e05a=_0x36e05a-0x0;var _0x331f9e=_0x0864[_0x36e05a];return _0x331f9e;};'use strict';var Sequelize=require(_0x4086('0x0'));module[_0x4086('0x1')]={'name':{'type':Sequelize[_0x4086('0x2')]},'description':{'type':Sequelize[_0x4086('0x2')]}}; \ No newline at end of file +var _0x5006=['exports','STRING','sequelize'];(function(_0x1de01d,_0xeb122c){var _0x2865ef=function(_0x2e1e6b){while(--_0x2e1e6b){_0x1de01d['push'](_0x1de01d['shift']());}};_0x2865ef(++_0xeb122c);}(_0x5006,0x131));var _0x6500=function(_0xd75354,_0x465098){_0xd75354=_0xd75354-0x0;var _0x2e7791=_0x5006[_0xd75354];return _0x2e7791;};'use strict';var Sequelize=require(_0x6500('0x0'));module[_0x6500('0x1')]={'name':{'type':Sequelize[_0x6500('0x2')]},'description':{'type':Sequelize[_0x6500('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index dee32ab..dbf4c2b 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 _0xe299=['path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','SugarcrmConfiguration','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','body','update','destroy','params','SugarcrmField','getFields','findOne','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','mustache'];(function(_0x3e5595,_0xbe4275){var _0x3fd3a6=function(_0x43874c){while(--_0x43874c){_0x3e5595['push'](_0x3e5595['shift']());}};_0x3fd3a6(++_0xbe4275);}(_0xe299,0x137));var _0x9e29=function(_0x4ebdb8,_0x36e284){_0x4ebdb8=_0x4ebdb8-0x0;var _0x40312c=_0xe299[_0x4ebdb8];return _0x40312c;};'use strict';var emlformat=require(_0x9e29('0x0'));var rimraf=require(_0x9e29('0x1'));var zipdir=require(_0x9e29('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9e29('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9e29('0x4'));var util=require('util');var path=require(_0x9e29('0x5'));var sox=require(_0x9e29('0x6'));var csv=require(_0x9e29('0x7'));var ejs=require(_0x9e29('0x8'));var fs=require('fs');var fs_extra=require(_0x9e29('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9e29('0xa'));var deskjs=require(_0x9e29('0xb'));var toCsv=require(_0x9e29('0x7'));var querystring=require(_0x9e29('0xc'));var Papa=require(_0x9e29('0xd'));var Redis=require(_0x9e29('0xe'));var authService=require(_0x9e29('0xf'));var qs=require(_0x9e29('0x10'));var as=require(_0x9e29('0x11'));var hardwareService=require(_0x9e29('0x12'));var logger=require(_0x9e29('0x13'))(_0x9e29('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9e29('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d159b,_0x4f4842){_0x4f4842=_0x4f4842||0xcc;return function(_0x220d24){if(_0x220d24){return _0x2d159b[_0x9e29('0x16')](_0x4f4842);}return _0x2d159b[_0x9e29('0x17')](_0x4f4842)[_0x9e29('0x18')]();};}function respondWithResult(_0x6ed8ae,_0x35a00b){_0x35a00b=_0x35a00b||0xc8;return function(_0x3e7b10){if(_0x3e7b10){return _0x6ed8ae['status'](_0x35a00b)[_0x9e29('0x19')](_0x3e7b10);}};}function respondWithFilteredResult(_0x2b0c86,_0x346f0d){return function(_0x1e340d){if(_0x1e340d){var _0x50dbb2=typeof _0x346f0d[_0x9e29('0x1a')]===_0x9e29('0x1b')&&typeof _0x346f0d[_0x9e29('0x1c')]==='undefined';var _0x5ab70a=_0x1e340d[_0x9e29('0x1d')];var _0x3fcd98=_0x50dbb2?0x0:_0x346f0d[_0x9e29('0x1a')];var _0x4a8a1c=_0x50dbb2?_0x1e340d['count']:_0x346f0d[_0x9e29('0x1a')]+_0x346f0d[_0x9e29('0x1c')];var _0x280153;if(_0x4a8a1c>=_0x5ab70a){_0x4a8a1c=_0x5ab70a;_0x280153=0xc8;}else{_0x280153=0xce;}_0x2b0c86[_0x9e29('0x17')](_0x280153);return _0x2b0c86['set'](_0x9e29('0x1e'),_0x3fcd98+'-'+_0x4a8a1c+'/'+_0x5ab70a)[_0x9e29('0x19')](_0x1e340d);}return null;};}function patchUpdates(_0x542d8f){return function(_0xaa31f9){try{jsonpatch[_0x9e29('0x1f')](_0xaa31f9,_0x542d8f,!![]);}catch(_0x15c385){return BPromise[_0x9e29('0x20')](_0x15c385);}return _0xaa31f9[_0x9e29('0x21')]();};}function saveUpdates(_0x3dd7ae,_0x59ba77){return function(_0x51308a){if(_0x51308a){return _0x51308a['update'](_0x3dd7ae)[_0x9e29('0x22')](function(_0x569d59){return _0x569d59;});}return null;};}function removeEntity(_0x1edfad,_0x34dc82){return function(_0x56cd43){if(_0x56cd43){return _0x56cd43['destroy']()[_0x9e29('0x22')](function(){_0x1edfad['status'](0xcc)[_0x9e29('0x18')]();});}};}function handleEntityNotFound(_0x2f9467,_0x3e000d){return function(_0xc14228){if(!_0xc14228){_0x2f9467[_0x9e29('0x16')](0x194);}return _0xc14228;};}function handleError(_0x50f54c,_0x4378e0){_0x4378e0=_0x4378e0||0x1f4;return function(_0x3a2c35){logger[_0x9e29('0x23')](_0x3a2c35[_0x9e29('0x24')]);if(_0x3a2c35['name']){delete _0x3a2c35[_0x9e29('0x25')];}_0x50f54c[_0x9e29('0x17')](_0x4378e0)[_0x9e29('0x26')](_0x3a2c35);};}exports[_0x9e29('0x27')]=function(_0x1df66f,_0x654c9c){var _0x40e494={},_0x687128={},_0x613b37={'count':0x0,'rows':[]};var _0x1d322e=_[_0x9e29('0x28')](db[_0x9e29('0x29')]['rawAttributes'],function(_0x2292d0){return{'name':_0x2292d0[_0x9e29('0x2a')],'type':_0x2292d0[_0x9e29('0x2b')]['key']};});_0x687128[_0x9e29('0x2c')]=_['map'](_0x1d322e,_0x9e29('0x25'));_0x687128[_0x9e29('0x2d')]=_[_0x9e29('0x2e')](_0x1df66f[_0x9e29('0x2d')]);_0x687128['filters']=_[_0x9e29('0x2f')](_0x687128[_0x9e29('0x2c')],_0x687128[_0x9e29('0x2d')]);_0x40e494['attributes']=_[_0x9e29('0x2f')](_0x687128['model'],qs[_0x9e29('0x30')](_0x1df66f[_0x9e29('0x2d')][_0x9e29('0x30')]));_0x40e494[_0x9e29('0x31')]=_0x40e494[_0x9e29('0x31')][_0x9e29('0x32')]?_0x40e494[_0x9e29('0x31')]:_0x687128[_0x9e29('0x2c')];if(!_0x1df66f[_0x9e29('0x2d')][_0x9e29('0x33')](_0x9e29('0x34'))){_0x40e494[_0x9e29('0x1c')]=qs['limit'](_0x1df66f[_0x9e29('0x2d')][_0x9e29('0x1c')]);_0x40e494['offset']=qs[_0x9e29('0x1a')](_0x1df66f[_0x9e29('0x2d')][_0x9e29('0x1a')]);}_0x40e494['order']=qs[_0x9e29('0x35')](_0x1df66f[_0x9e29('0x2d')][_0x9e29('0x35')]);_0x40e494[_0x9e29('0x36')]=qs['filters'](_[_0x9e29('0x37')](_0x1df66f[_0x9e29('0x2d')],_0x687128[_0x9e29('0x38')]),_0x1d322e);if(_0x1df66f[_0x9e29('0x2d')][_0x9e29('0x39')]){_0x40e494[_0x9e29('0x36')]=_[_0x9e29('0x3a')](_0x40e494['where'],{'$or':_[_0x9e29('0x28')](_0x1d322e,function(_0x1a8506){if(_0x1a8506[_0x9e29('0x2b')]!=='VIRTUAL'){var _0x4c8c44={};_0x4c8c44[_0x1a8506['name']]={'$like':'%'+_0x1df66f[_0x9e29('0x2d')][_0x9e29('0x39')]+'%'};return _0x4c8c44;}})});}_0x40e494=_[_0x9e29('0x3a')]({},_0x40e494,_0x1df66f[_0x9e29('0x3b')]);var _0x36453a={'where':_0x40e494[_0x9e29('0x36')]};return db['SugarcrmConfiguration']['count'](_0x36453a)[_0x9e29('0x22')](function(_0x1272c1){_0x613b37['count']=_0x1272c1;if(_0x1df66f[_0x9e29('0x2d')][_0x9e29('0x3c')]){_0x40e494[_0x9e29('0x3d')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x9e29('0x3e')](_0x40e494);})[_0x9e29('0x22')](function(_0x4ff7c0){_0x613b37[_0x9e29('0x3f')]=_0x4ff7c0;return _0x613b37;})[_0x9e29('0x22')](respondWithFilteredResult(_0x654c9c,_0x40e494))['catch'](handleError(_0x654c9c,null));};exports[_0x9e29('0x40')]=function(_0x210bc7,_0x2da4ba){var _0x1fa479={'raw':![],'where':{'id':_0x210bc7['params']['id']}},_0x457049={};_0x457049[_0x9e29('0x2c')]=_[_0x9e29('0x2e')](db[_0x9e29('0x29')][_0x9e29('0x41')]);_0x457049['query']=_[_0x9e29('0x2e')](_0x210bc7['query']);_0x457049[_0x9e29('0x38')]=_[_0x9e29('0x2f')](_0x457049[_0x9e29('0x2c')],_0x457049[_0x9e29('0x2d')]);_0x1fa479[_0x9e29('0x31')]=_[_0x9e29('0x2f')](_0x457049[_0x9e29('0x2c')],qs[_0x9e29('0x30')](_0x210bc7[_0x9e29('0x2d')][_0x9e29('0x30')]));_0x1fa479[_0x9e29('0x31')]=_0x1fa479[_0x9e29('0x31')]['length']?_0x1fa479[_0x9e29('0x31')]:_0x457049[_0x9e29('0x2c')];if(_0x210bc7[_0x9e29('0x2d')]['includeAll']){_0x1fa479['include']=[{'all':!![]}];}_0x1fa479=_[_0x9e29('0x3a')]({},_0x1fa479,_0x210bc7[_0x9e29('0x3b')]);return db[_0x9e29('0x29')][_0x9e29('0x42')](_0x1fa479)['then'](handleEntityNotFound(_0x2da4ba,null))[_0x9e29('0x22')](respondWithResult(_0x2da4ba,null))[_0x9e29('0x43')](handleError(_0x2da4ba,null));};exports['create']=function(_0x305c7d,_0xb54660){return db[_0x9e29('0x29')][_0x9e29('0x44')](_0x305c7d[_0x9e29('0x45')],{})[_0x9e29('0x22')](respondWithResult(_0xb54660,0xc9))[_0x9e29('0x43')](handleError(_0xb54660,null));};exports[_0x9e29('0x46')]=function(_0x233cb0,_0x3d2ddc){if(_0x233cb0[_0x9e29('0x45')]['id']){delete _0x233cb0[_0x9e29('0x45')]['id'];}return db[_0x9e29('0x29')][_0x9e29('0x42')]({'where':{'id':_0x233cb0['params']['id']}})[_0x9e29('0x22')](handleEntityNotFound(_0x3d2ddc,null))[_0x9e29('0x22')](saveUpdates(_0x233cb0[_0x9e29('0x45')],null))[_0x9e29('0x22')](respondWithResult(_0x3d2ddc,null))['catch'](handleError(_0x3d2ddc,null));};exports[_0x9e29('0x47')]=function(_0x581df9,_0x36eb38){return db[_0x9e29('0x29')][_0x9e29('0x42')]({'where':{'id':_0x581df9[_0x9e29('0x48')]['id']}})['then'](handleEntityNotFound(_0x36eb38,null))['then'](removeEntity(_0x36eb38,null))[_0x9e29('0x43')](handleError(_0x36eb38,null));};exports['getFields']=function(_0x8b81c9,_0x290bad,_0x3e346d){var _0x5cd65a={};var _0x1c51d1={};var _0x2e1bf6;var _0x87eca3;return db[_0x9e29('0x29')]['findOne']({'where':{'id':_0x8b81c9['params']['id']}})[_0x9e29('0x22')](handleEntityNotFound(_0x290bad,null))[_0x9e29('0x22')](function(_0x13c8ff){if(_0x13c8ff){_0x2e1bf6=_0x13c8ff;_0x1c51d1[_0x9e29('0x2c')]=_['keys'](db[_0x9e29('0x49')]['rawAttributes']);_0x1c51d1[_0x9e29('0x2d')]=_['keys'](_0x8b81c9[_0x9e29('0x2d')]);_0x1c51d1[_0x9e29('0x38')]=_[_0x9e29('0x2f')](_0x1c51d1[_0x9e29('0x2c')],_0x1c51d1['query']);_0x5cd65a[_0x9e29('0x31')]=_['intersection'](_0x1c51d1[_0x9e29('0x2c')],qs[_0x9e29('0x30')](_0x8b81c9[_0x9e29('0x2d')][_0x9e29('0x30')]));_0x5cd65a[_0x9e29('0x31')]=_0x5cd65a[_0x9e29('0x31')][_0x9e29('0x32')]?_0x5cd65a[_0x9e29('0x31')]:_0x1c51d1[_0x9e29('0x2c')];_0x5cd65a['order']=qs['sort'](_0x8b81c9['query']['sort']);_0x5cd65a['where']=qs[_0x9e29('0x38')](_[_0x9e29('0x37')](_0x8b81c9[_0x9e29('0x2d')],_0x1c51d1[_0x9e29('0x38')]));if(_0x8b81c9['query'][_0x9e29('0x39')]){_0x5cd65a[_0x9e29('0x36')]=_[_0x9e29('0x3a')](_0x5cd65a[_0x9e29('0x36')],{'$or':_[_0x9e29('0x28')](_0x5cd65a[_0x9e29('0x31')],function(_0x16fa85){var _0x6dbcce={};_0x6dbcce[_0x16fa85]={'$like':'%'+_0x8b81c9[_0x9e29('0x2d')][_0x9e29('0x39')]+'%'};return _0x6dbcce;})});}_0x5cd65a=_['merge']({},_0x5cd65a,_0x8b81c9[_0x9e29('0x3b')]);return _0x2e1bf6['getFields'](_0x5cd65a);}})[_0x9e29('0x22')](function(_0x96f547){if(_0x96f547){_0x87eca3=_0x96f547['length'];if(!_0x8b81c9[_0x9e29('0x2d')][_0x9e29('0x33')](_0x9e29('0x34'))){_0x5cd65a[_0x9e29('0x1c')]=qs['limit'](_0x8b81c9[_0x9e29('0x2d')][_0x9e29('0x1c')]);_0x5cd65a['offset']=qs[_0x9e29('0x1a')](_0x8b81c9[_0x9e29('0x2d')][_0x9e29('0x1a')]);}return _0x2e1bf6[_0x9e29('0x4a')](_0x5cd65a);}})[_0x9e29('0x22')](function(_0x3135c7){if(_0x3135c7){return _0x3135c7?{'count':_0x87eca3,'rows':_0x3135c7}:null;}})['then'](respondWithResult(_0x290bad,null))[_0x9e29('0x43')](handleError(_0x290bad,null));};exports['getSubjects']=function(_0x59c5fb,_0x11e3af,_0x34525b){var _0x2a32bd={};var _0x3bc754={};var _0x420ff2;var _0x382de9;return db[_0x9e29('0x29')][_0x9e29('0x4b')]({'where':{'id':_0x59c5fb[_0x9e29('0x48')]['id']}})[_0x9e29('0x22')](handleEntityNotFound(_0x11e3af,null))[_0x9e29('0x22')](function(_0x57e52e){if(_0x57e52e){_0x420ff2=_0x57e52e;_0x3bc754[_0x9e29('0x2c')]=_[_0x9e29('0x2e')](db['SugarcrmField']['rawAttributes']);_0x3bc754[_0x9e29('0x2d')]=_['keys'](_0x59c5fb[_0x9e29('0x2d')]);_0x3bc754[_0x9e29('0x38')]=_[_0x9e29('0x2f')](_0x3bc754[_0x9e29('0x2c')],_0x3bc754[_0x9e29('0x2d')]);_0x2a32bd[_0x9e29('0x31')]=_[_0x9e29('0x2f')](_0x3bc754[_0x9e29('0x2c')],qs['fields'](_0x59c5fb[_0x9e29('0x2d')][_0x9e29('0x30')]));_0x2a32bd[_0x9e29('0x31')]=_0x2a32bd[_0x9e29('0x31')]['length']?_0x2a32bd[_0x9e29('0x31')]:_0x3bc754[_0x9e29('0x2c')];_0x2a32bd[_0x9e29('0x4c')]=qs[_0x9e29('0x35')](_0x59c5fb[_0x9e29('0x2d')][_0x9e29('0x35')]);_0x2a32bd['where']=qs['filters'](_['pick'](_0x59c5fb['query'],_0x3bc754['filters']));if(_0x59c5fb['query']['filter']){_0x2a32bd[_0x9e29('0x36')]=_[_0x9e29('0x3a')](_0x2a32bd[_0x9e29('0x36')],{'$or':_[_0x9e29('0x28')](_0x2a32bd[_0x9e29('0x31')],function(_0x54d01a){var _0x274b3c={};_0x274b3c[_0x54d01a]={'$like':'%'+_0x59c5fb['query'][_0x9e29('0x39')]+'%'};return _0x274b3c;})});}_0x2a32bd=_[_0x9e29('0x3a')]({},_0x2a32bd,_0x59c5fb[_0x9e29('0x3b')]);return _0x420ff2[_0x9e29('0x4d')](_0x2a32bd);}})[_0x9e29('0x22')](function(_0x3131cd){if(_0x3131cd){_0x382de9=_0x3131cd[_0x9e29('0x32')];if(!_0x59c5fb['query'][_0x9e29('0x33')](_0x9e29('0x34'))){_0x2a32bd[_0x9e29('0x1c')]=qs['limit'](_0x59c5fb['query'][_0x9e29('0x1c')]);_0x2a32bd[_0x9e29('0x1a')]=qs['offset'](_0x59c5fb[_0x9e29('0x2d')][_0x9e29('0x1a')]);}return _0x420ff2['getSubjects'](_0x2a32bd);}})['then'](function(_0x518f0c){if(_0x518f0c){return _0x518f0c?{'count':_0x382de9,'rows':_0x518f0c}:null;}})[_0x9e29('0x22')](respondWithResult(_0x11e3af,null))[_0x9e29('0x43')](handleError(_0x11e3af,null));};exports[_0x9e29('0x4e')]=function(_0x928124,_0x2f9a28,_0x2f18cb){var _0x227d86={};var _0x2cdbda={};var _0x52863b;var _0x2d41b;return db[_0x9e29('0x29')][_0x9e29('0x4b')]({'where':{'id':_0x928124[_0x9e29('0x48')]['id']}})[_0x9e29('0x22')](handleEntityNotFound(_0x2f9a28,null))[_0x9e29('0x22')](function(_0x9d812b){if(_0x9d812b){_0x52863b=_0x9d812b;_0x2cdbda['model']=_[_0x9e29('0x2e')](db[_0x9e29('0x49')]['rawAttributes']);_0x2cdbda[_0x9e29('0x2d')]=_[_0x9e29('0x2e')](_0x928124['query']);_0x2cdbda[_0x9e29('0x38')]=_[_0x9e29('0x2f')](_0x2cdbda[_0x9e29('0x2c')],_0x2cdbda['query']);_0x227d86[_0x9e29('0x31')]=_[_0x9e29('0x2f')](_0x2cdbda['model'],qs[_0x9e29('0x30')](_0x928124[_0x9e29('0x2d')][_0x9e29('0x30')]));_0x227d86[_0x9e29('0x31')]=_0x227d86['attributes'][_0x9e29('0x32')]?_0x227d86[_0x9e29('0x31')]:_0x2cdbda['model'];_0x227d86[_0x9e29('0x4c')]=qs['sort'](_0x928124[_0x9e29('0x2d')][_0x9e29('0x35')]);_0x227d86[_0x9e29('0x36')]=qs[_0x9e29('0x38')](_[_0x9e29('0x37')](_0x928124[_0x9e29('0x2d')],_0x2cdbda[_0x9e29('0x38')]));if(_0x928124[_0x9e29('0x2d')][_0x9e29('0x39')]){_0x227d86[_0x9e29('0x36')]=_['merge'](_0x227d86[_0x9e29('0x36')],{'$or':_['map'](_0x227d86[_0x9e29('0x31')],function(_0xd4f5c){var _0x2b1d50={};_0x2b1d50[_0xd4f5c]={'$like':'%'+_0x928124[_0x9e29('0x2d')][_0x9e29('0x39')]+'%'};return _0x2b1d50;})});}_0x227d86=_['merge']({},_0x227d86,_0x928124[_0x9e29('0x3b')]);return _0x52863b['getDescriptions'](_0x227d86);}})[_0x9e29('0x22')](function(_0x5baa33){if(_0x5baa33){_0x2d41b=_0x5baa33[_0x9e29('0x32')];if(!_0x928124['query'][_0x9e29('0x33')]('nolimit')){_0x227d86[_0x9e29('0x1c')]=qs['limit'](_0x928124[_0x9e29('0x2d')][_0x9e29('0x1c')]);_0x227d86['offset']=qs[_0x9e29('0x1a')](_0x928124[_0x9e29('0x2d')][_0x9e29('0x1a')]);}return _0x52863b[_0x9e29('0x4e')](_0x227d86);}})[_0x9e29('0x22')](function(_0x381ab4){if(_0x381ab4){return _0x381ab4?{'count':_0x2d41b,'rows':_0x381ab4}:null;}})['then'](respondWithResult(_0x2f9a28,null))[_0x9e29('0x43')](handleError(_0x2f9a28,null));}; \ No newline at end of file +var _0x4753=['sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','error','stack','name','index','map','SugarcrmConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','options','then','includeAll','include','findAll','find','create','body','update','params','catch','getFields','findOne','SugarcrmField','filter','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4753,0xf1));var _0x3475=function(_0x2752fa,_0x2915bb){_0x2752fa=_0x2752fa-0x0;var _0x44391d=_0x4753[_0x2752fa];return _0x44391d;};'use strict';var emlformat=require(_0x3475('0x0'));var rimraf=require(_0x3475('0x1'));var zipdir=require(_0x3475('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3475('0x3'));var BPromise=require(_0x3475('0x4'));var Mustache=require(_0x3475('0x5'));var util=require(_0x3475('0x6'));var path=require(_0x3475('0x7'));var sox=require(_0x3475('0x8'));var csv=require(_0x3475('0x9'));var ejs=require(_0x3475('0xa'));var fs=require('fs');var fs_extra=require(_0x3475('0xb'));var _=require(_0x3475('0xc'));var squel=require('squel');var crypto=require(_0x3475('0xd'));var jsforce=require(_0x3475('0xe'));var deskjs=require(_0x3475('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3475('0x10'));var Papa=require(_0x3475('0x11'));var Redis=require(_0x3475('0x12'));var authService=require(_0x3475('0x13'));var qs=require(_0x3475('0x14'));var as=require(_0x3475('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3475('0x16'))(_0x3475('0x17'));var utils=require('../../config/utils');var config=require(_0x3475('0x18'));var licenseUtil=require(_0x3475('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56b490,_0x5f23c6){_0x5f23c6=_0x5f23c6||0xcc;return function(_0x56ca0b){if(_0x56ca0b){return _0x56b490[_0x3475('0x1a')](_0x5f23c6);}return _0x56b490[_0x3475('0x1b')](_0x5f23c6)[_0x3475('0x1c')]();};}function respondWithResult(_0x532519,_0x3a4a8f){_0x3a4a8f=_0x3a4a8f||0xc8;return function(_0x18115e){if(_0x18115e){return _0x532519[_0x3475('0x1b')](_0x3a4a8f)[_0x3475('0x1d')](_0x18115e);}};}function respondWithFilteredResult(_0x559b6a,_0x48ec3b){return function(_0x277e14){if(_0x277e14){var _0x4243ab=typeof _0x48ec3b[_0x3475('0x1e')]===_0x3475('0x1f')&&typeof _0x48ec3b[_0x3475('0x20')]==='undefined';var _0x4c1bcd=_0x277e14['count'];var _0x4e974b=_0x4243ab?0x0:_0x48ec3b['offset'];var _0x957f2a=_0x4243ab?_0x277e14[_0x3475('0x21')]:_0x48ec3b['offset']+_0x48ec3b[_0x3475('0x20')];var _0x2114e;if(_0x957f2a>=_0x4c1bcd){_0x957f2a=_0x4c1bcd;_0x2114e=0xc8;}else{_0x2114e=0xce;}_0x559b6a[_0x3475('0x1b')](_0x2114e);return _0x559b6a[_0x3475('0x22')](_0x3475('0x23'),_0x4e974b+'-'+_0x957f2a+'/'+_0x4c1bcd)['json'](_0x277e14);}return null;};}function patchUpdates(_0x564a33){return function(_0x3003f6){try{jsonpatch[_0x3475('0x24')](_0x3003f6,_0x564a33,!![]);}catch(_0x1b48c2){return BPromise[_0x3475('0x25')](_0x1b48c2);}return _0x3003f6[_0x3475('0x26')]();};}function saveUpdates(_0x37498f,_0xbf3614){return function(_0x2fda9c){if(_0x2fda9c){return _0x2fda9c['update'](_0x37498f)['then'](function(_0x193c79){return _0x193c79;});}return null;};}function removeEntity(_0x3f96c0,_0x5275e6){return function(_0x146d93){if(_0x146d93){return _0x146d93[_0x3475('0x27')]()['then'](function(){_0x3f96c0[_0x3475('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf12a61,_0x43f98c){return function(_0x481f0b){if(!_0x481f0b){_0xf12a61['sendStatus'](0x194);}return _0x481f0b;};}function handleError(_0x43ed57,_0x463919){_0x463919=_0x463919||0x1f4;return function(_0x44146e){logger[_0x3475('0x28')](_0x44146e[_0x3475('0x29')]);if(_0x44146e[_0x3475('0x2a')]){delete _0x44146e[_0x3475('0x2a')];}_0x43ed57[_0x3475('0x1b')](_0x463919)['send'](_0x44146e);};}exports[_0x3475('0x2b')]=function(_0x52b696,_0x18dfbf){var _0xf4b95f={},_0xcbae4a={},_0x15bfc7={'count':0x0,'rows':[]};var _0x5c4a03=_[_0x3475('0x2c')](db[_0x3475('0x2d')][_0x3475('0x2e')],function(_0x353c64){return{'name':_0x353c64[_0x3475('0x2f')],'type':_0x353c64['type'][_0x3475('0x30')]};});_0xcbae4a[_0x3475('0x31')]=_[_0x3475('0x2c')](_0x5c4a03,_0x3475('0x2a'));_0xcbae4a[_0x3475('0x32')]=_[_0x3475('0x33')](_0x52b696['query']);_0xcbae4a[_0x3475('0x34')]=_[_0x3475('0x35')](_0xcbae4a[_0x3475('0x31')],_0xcbae4a[_0x3475('0x32')]);_0xf4b95f[_0x3475('0x36')]=_[_0x3475('0x35')](_0xcbae4a['model'],qs[_0x3475('0x37')](_0x52b696[_0x3475('0x32')][_0x3475('0x37')]));_0xf4b95f[_0x3475('0x36')]=_0xf4b95f[_0x3475('0x36')][_0x3475('0x38')]?_0xf4b95f['attributes']:_0xcbae4a[_0x3475('0x31')];if(!_0x52b696[_0x3475('0x32')][_0x3475('0x39')]('nolimit')){_0xf4b95f[_0x3475('0x20')]=qs[_0x3475('0x20')](_0x52b696[_0x3475('0x32')]['limit']);_0xf4b95f[_0x3475('0x1e')]=qs['offset'](_0x52b696[_0x3475('0x32')][_0x3475('0x1e')]);}_0xf4b95f[_0x3475('0x3a')]=qs[_0x3475('0x3b')](_0x52b696['query'][_0x3475('0x3b')]);_0xf4b95f[_0x3475('0x3c')]=qs[_0x3475('0x34')](_[_0x3475('0x3d')](_0x52b696[_0x3475('0x32')],_0xcbae4a[_0x3475('0x34')]),_0x5c4a03);if(_0x52b696[_0x3475('0x32')]['filter']){_0xf4b95f['where']=_[_0x3475('0x3e')](_0xf4b95f['where'],{'$or':_[_0x3475('0x2c')](_0x5c4a03,function(_0x2b6904){if(_0x2b6904[_0x3475('0x3f')]!==_0x3475('0x40')){var _0x3e3966={};_0x3e3966[_0x2b6904[_0x3475('0x2a')]]={'$like':'%'+_0x52b696[_0x3475('0x32')]['filter']+'%'};return _0x3e3966;}})});}_0xf4b95f=_[_0x3475('0x3e')]({},_0xf4b95f,_0x52b696[_0x3475('0x41')]);var _0x497d2b={'where':_0xf4b95f[_0x3475('0x3c')]};return db[_0x3475('0x2d')]['count'](_0x497d2b)[_0x3475('0x42')](function(_0x491bcd){_0x15bfc7['count']=_0x491bcd;if(_0x52b696[_0x3475('0x32')][_0x3475('0x43')]){_0xf4b95f[_0x3475('0x44')]=[{'all':!![]}];}return db[_0x3475('0x2d')][_0x3475('0x45')](_0xf4b95f);})['then'](function(_0x9526cd){_0x15bfc7['rows']=_0x9526cd;return _0x15bfc7;})[_0x3475('0x42')](respondWithFilteredResult(_0x18dfbf,_0xf4b95f))['catch'](handleError(_0x18dfbf,null));};exports['show']=function(_0x2545af,_0x1ca1e5){var _0x618974={'raw':![],'where':{'id':_0x2545af['params']['id']}},_0x85bcc6={};_0x85bcc6[_0x3475('0x31')]=_['keys'](db[_0x3475('0x2d')][_0x3475('0x2e')]);_0x85bcc6[_0x3475('0x32')]=_['keys'](_0x2545af[_0x3475('0x32')]);_0x85bcc6['filters']=_[_0x3475('0x35')](_0x85bcc6[_0x3475('0x31')],_0x85bcc6['query']);_0x618974[_0x3475('0x36')]=_[_0x3475('0x35')](_0x85bcc6[_0x3475('0x31')],qs[_0x3475('0x37')](_0x2545af['query'][_0x3475('0x37')]));_0x618974[_0x3475('0x36')]=_0x618974['attributes']['length']?_0x618974[_0x3475('0x36')]:_0x85bcc6['model'];if(_0x2545af[_0x3475('0x32')][_0x3475('0x43')]){_0x618974[_0x3475('0x44')]=[{'all':!![]}];}_0x618974=_[_0x3475('0x3e')]({},_0x618974,_0x2545af['options']);return db[_0x3475('0x2d')][_0x3475('0x46')](_0x618974)[_0x3475('0x42')](handleEntityNotFound(_0x1ca1e5,null))['then'](respondWithResult(_0x1ca1e5,null))['catch'](handleError(_0x1ca1e5,null));};exports[_0x3475('0x47')]=function(_0x268a58,_0x501ab2){return db[_0x3475('0x2d')][_0x3475('0x47')](_0x268a58[_0x3475('0x48')],{})['then'](respondWithResult(_0x501ab2,0xc9))['catch'](handleError(_0x501ab2,null));};exports[_0x3475('0x49')]=function(_0xde13e5,_0x1e3f88){if(_0xde13e5[_0x3475('0x48')]['id']){delete _0xde13e5['body']['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0xde13e5[_0x3475('0x4a')]['id']}})[_0x3475('0x42')](handleEntityNotFound(_0x1e3f88,null))['then'](saveUpdates(_0xde13e5['body'],null))[_0x3475('0x42')](respondWithResult(_0x1e3f88,null))[_0x3475('0x4b')](handleError(_0x1e3f88,null));};exports[_0x3475('0x27')]=function(_0xe6cd8f,_0x1e8d91){return db[_0x3475('0x2d')][_0x3475('0x46')]({'where':{'id':_0xe6cd8f['params']['id']}})[_0x3475('0x42')](handleEntityNotFound(_0x1e8d91,null))['then'](removeEntity(_0x1e8d91,null))['catch'](handleError(_0x1e8d91,null));};exports[_0x3475('0x4c')]=function(_0x20a143,_0xe3d2bb,_0x2ab5ee){var _0x17fda8={};var _0x56c177={};var _0x4dff1b;var _0x51ebba;return db['SugarcrmConfiguration'][_0x3475('0x4d')]({'where':{'id':_0x20a143[_0x3475('0x4a')]['id']}})[_0x3475('0x42')](handleEntityNotFound(_0xe3d2bb,null))[_0x3475('0x42')](function(_0xc4e02a){if(_0xc4e02a){_0x4dff1b=_0xc4e02a;_0x56c177['model']=_[_0x3475('0x33')](db[_0x3475('0x4e')]['rawAttributes']);_0x56c177[_0x3475('0x32')]=_['keys'](_0x20a143[_0x3475('0x32')]);_0x56c177[_0x3475('0x34')]=_['intersection'](_0x56c177[_0x3475('0x31')],_0x56c177[_0x3475('0x32')]);_0x17fda8[_0x3475('0x36')]=_[_0x3475('0x35')](_0x56c177[_0x3475('0x31')],qs[_0x3475('0x37')](_0x20a143['query'][_0x3475('0x37')]));_0x17fda8[_0x3475('0x36')]=_0x17fda8[_0x3475('0x36')]['length']?_0x17fda8[_0x3475('0x36')]:_0x56c177[_0x3475('0x31')];_0x17fda8[_0x3475('0x3a')]=qs[_0x3475('0x3b')](_0x20a143[_0x3475('0x32')]['sort']);_0x17fda8[_0x3475('0x3c')]=qs[_0x3475('0x34')](_['pick'](_0x20a143['query'],_0x56c177[_0x3475('0x34')]));if(_0x20a143[_0x3475('0x32')]['filter']){_0x17fda8[_0x3475('0x3c')]=_[_0x3475('0x3e')](_0x17fda8['where'],{'$or':_[_0x3475('0x2c')](_0x17fda8[_0x3475('0x36')],function(_0x57cec9){var _0x3caa2c={};_0x3caa2c[_0x57cec9]={'$like':'%'+_0x20a143[_0x3475('0x32')][_0x3475('0x4f')]+'%'};return _0x3caa2c;})});}_0x17fda8=_[_0x3475('0x3e')]({},_0x17fda8,_0x20a143[_0x3475('0x41')]);return _0x4dff1b[_0x3475('0x4c')](_0x17fda8);}})[_0x3475('0x42')](function(_0x2a1594){if(_0x2a1594){_0x51ebba=_0x2a1594[_0x3475('0x38')];if(!_0x20a143[_0x3475('0x32')][_0x3475('0x39')]('nolimit')){_0x17fda8[_0x3475('0x20')]=qs[_0x3475('0x20')](_0x20a143['query']['limit']);_0x17fda8[_0x3475('0x1e')]=qs[_0x3475('0x1e')](_0x20a143[_0x3475('0x32')]['offset']);}return _0x4dff1b['getFields'](_0x17fda8);}})[_0x3475('0x42')](function(_0x18a0bf){if(_0x18a0bf){return _0x18a0bf?{'count':_0x51ebba,'rows':_0x18a0bf}:null;}})['then'](respondWithResult(_0xe3d2bb,null))[_0x3475('0x4b')](handleError(_0xe3d2bb,null));};exports[_0x3475('0x50')]=function(_0x2adccc,_0x445aab,_0x4743f0){var _0x2f9a33={};var _0x26fe9e={};var _0x49448a;var _0x12f24f;return db[_0x3475('0x2d')]['findOne']({'where':{'id':_0x2adccc['params']['id']}})[_0x3475('0x42')](handleEntityNotFound(_0x445aab,null))[_0x3475('0x42')](function(_0x392306){if(_0x392306){_0x49448a=_0x392306;_0x26fe9e['model']=_[_0x3475('0x33')](db['SugarcrmField'][_0x3475('0x2e')]);_0x26fe9e[_0x3475('0x32')]=_['keys'](_0x2adccc[_0x3475('0x32')]);_0x26fe9e[_0x3475('0x34')]=_[_0x3475('0x35')](_0x26fe9e['model'],_0x26fe9e[_0x3475('0x32')]);_0x2f9a33['attributes']=_[_0x3475('0x35')](_0x26fe9e[_0x3475('0x31')],qs['fields'](_0x2adccc[_0x3475('0x32')][_0x3475('0x37')]));_0x2f9a33['attributes']=_0x2f9a33['attributes'][_0x3475('0x38')]?_0x2f9a33[_0x3475('0x36')]:_0x26fe9e[_0x3475('0x31')];_0x2f9a33[_0x3475('0x3a')]=qs[_0x3475('0x3b')](_0x2adccc[_0x3475('0x32')]['sort']);_0x2f9a33['where']=qs[_0x3475('0x34')](_['pick'](_0x2adccc[_0x3475('0x32')],_0x26fe9e['filters']));if(_0x2adccc[_0x3475('0x32')]['filter']){_0x2f9a33[_0x3475('0x3c')]=_['merge'](_0x2f9a33[_0x3475('0x3c')],{'$or':_[_0x3475('0x2c')](_0x2f9a33[_0x3475('0x36')],function(_0x4b573a){var _0xe1202b={};_0xe1202b[_0x4b573a]={'$like':'%'+_0x2adccc[_0x3475('0x32')]['filter']+'%'};return _0xe1202b;})});}_0x2f9a33=_['merge']({},_0x2f9a33,_0x2adccc['options']);return _0x49448a[_0x3475('0x50')](_0x2f9a33);}})[_0x3475('0x42')](function(_0x22b15f){if(_0x22b15f){_0x12f24f=_0x22b15f[_0x3475('0x38')];if(!_0x2adccc[_0x3475('0x32')][_0x3475('0x39')](_0x3475('0x51'))){_0x2f9a33[_0x3475('0x20')]=qs['limit'](_0x2adccc[_0x3475('0x32')][_0x3475('0x20')]);_0x2f9a33[_0x3475('0x1e')]=qs[_0x3475('0x1e')](_0x2adccc[_0x3475('0x32')][_0x3475('0x1e')]);}return _0x49448a[_0x3475('0x50')](_0x2f9a33);}})[_0x3475('0x42')](function(_0x3978ba){if(_0x3978ba){return _0x3978ba?{'count':_0x12f24f,'rows':_0x3978ba}:null;}})['then'](respondWithResult(_0x445aab,null))[_0x3475('0x4b')](handleError(_0x445aab,null));};exports['getDescriptions']=function(_0x4c55fa,_0x411451,_0x52026c){var _0x522861={};var _0x3736c2={};var _0x3e1451;var _0x20e794;return db[_0x3475('0x2d')][_0x3475('0x4d')]({'where':{'id':_0x4c55fa[_0x3475('0x4a')]['id']}})[_0x3475('0x42')](handleEntityNotFound(_0x411451,null))[_0x3475('0x42')](function(_0x81ba36){if(_0x81ba36){_0x3e1451=_0x81ba36;_0x3736c2['model']=_[_0x3475('0x33')](db[_0x3475('0x4e')][_0x3475('0x2e')]);_0x3736c2[_0x3475('0x32')]=_[_0x3475('0x33')](_0x4c55fa[_0x3475('0x32')]);_0x3736c2[_0x3475('0x34')]=_[_0x3475('0x35')](_0x3736c2['model'],_0x3736c2[_0x3475('0x32')]);_0x522861[_0x3475('0x36')]=_[_0x3475('0x35')](_0x3736c2[_0x3475('0x31')],qs[_0x3475('0x37')](_0x4c55fa[_0x3475('0x32')]['fields']));_0x522861['attributes']=_0x522861[_0x3475('0x36')]['length']?_0x522861[_0x3475('0x36')]:_0x3736c2[_0x3475('0x31')];_0x522861['order']=qs['sort'](_0x4c55fa[_0x3475('0x32')]['sort']);_0x522861['where']=qs[_0x3475('0x34')](_[_0x3475('0x3d')](_0x4c55fa[_0x3475('0x32')],_0x3736c2[_0x3475('0x34')]));if(_0x4c55fa[_0x3475('0x32')][_0x3475('0x4f')]){_0x522861[_0x3475('0x3c')]=_[_0x3475('0x3e')](_0x522861[_0x3475('0x3c')],{'$or':_[_0x3475('0x2c')](_0x522861['attributes'],function(_0x4c9231){var _0x416e63={};_0x416e63[_0x4c9231]={'$like':'%'+_0x4c55fa['query'][_0x3475('0x4f')]+'%'};return _0x416e63;})});}_0x522861=_['merge']({},_0x522861,_0x4c55fa['options']);return _0x3e1451[_0x3475('0x52')](_0x522861);}})[_0x3475('0x42')](function(_0x46003b){if(_0x46003b){_0x20e794=_0x46003b[_0x3475('0x38')];if(!_0x4c55fa[_0x3475('0x32')][_0x3475('0x39')](_0x3475('0x51'))){_0x522861[_0x3475('0x20')]=qs[_0x3475('0x20')](_0x4c55fa[_0x3475('0x32')][_0x3475('0x20')]);_0x522861['offset']=qs[_0x3475('0x1e')](_0x4c55fa[_0x3475('0x32')][_0x3475('0x1e')]);}return _0x3e1451[_0x3475('0x52')](_0x522861);}})['then'](function(_0x4b9e99){if(_0x4b9e99){return _0x4b9e99?{'count':_0x20e794,'rows':_0x4b9e99}:null;}})['then'](respondWithResult(_0x411451,null))[_0x3475('0x4b')](handleError(_0x411451,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 6060406..f0c7456 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 _0xffa3=['lodash','util','../../config/logger','bluebird','path','../../config/environment','define','SugarcrmConfiguration','int_sugarcrm_configurations'];(function(_0x12ebd9,_0x339523){var _0x50eeff=function(_0x1a2be2){while(--_0x1a2be2){_0x12ebd9['push'](_0x12ebd9['shift']());}};_0x50eeff(++_0x339523);}(_0xffa3,0x129));var _0x3ffa=function(_0x36a6cd,_0x225b81){_0x36a6cd=_0x36a6cd-0x0;var _0x5d8e90=_0xffa3[_0x36a6cd];return _0x5d8e90;};'use strict';var _=require(_0x3ffa('0x0'));var util=require(_0x3ffa('0x1'));var logger=require(_0x3ffa('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3ffa('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ffa('0x4'));var rimraf=require('rimraf');var config=require(_0x3ffa('0x5'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0x810d1e,_0xa39b21){return _0x810d1e[_0x3ffa('0x6')](_0x3ffa('0x7'),attributes,{'tableName':_0x3ffa('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9812=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash'];(function(_0x4af765,_0x34e7f5){var _0xe1d7d6=function(_0x33e1f1){while(--_0x33e1f1){_0x4af765['push'](_0x4af765['shift']());}};_0xe1d7d6(++_0x34e7f5);}(_0x9812,0x175));var _0x2981=function(_0x551115,_0x4c461c){_0x551115=_0x551115-0x0;var _0x3defc4=_0x9812[_0x551115];return _0x3defc4;};'use strict';var _=require(_0x2981('0x0'));var util=require('util');var logger=require(_0x2981('0x1'))(_0x2981('0x2'));var moment=require(_0x2981('0x3'));var BPromise=require('bluebird');var rp=require(_0x2981('0x4'));var fs=require('fs');var path=require(_0x2981('0x5'));var rimraf=require(_0x2981('0x6'));var config=require(_0x2981('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0x443f4a,_0x57e5db){return _0x443f4a[_0x2981('0x8')](_0x2981('0x9'),attributes,{'tableName':_0x2981('0xa'),'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 5286b35..1f5ba04 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 _0xa604=['error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','code'];(function(_0x4ada5d,_0x5d6a6a){var _0x18e71f=function(_0x56f2d6){while(--_0x56f2d6){_0x4ada5d['push'](_0x4ada5d['shift']());}};_0x18e71f(++_0x5d6a6a);}(_0xa604,0x76));var _0x4a60=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa604[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4a60('0x0'));var util=require(_0x4a60('0x1'));var moment=require(_0x4a60('0x2'));var BPromise=require(_0x4a60('0x3'));var rs=require(_0x4a60('0x4'));var fs=require('fs');var Redis=require(_0x4a60('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4a60('0x6'));var logger=require(_0x4a60('0x7'))(_0x4a60('0x8'));var config=require('../../config/environment');var jayson=require(_0x4a60('0x9'));var client=jayson[_0x4a60('0xa')][_0x4a60('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ea89f,_0x4f327c,_0x256bc0){return new BPromise(function(_0x2af2f7,_0x88171b){return client[_0x4a60('0xc')](_0x4ea89f,_0x256bc0)[_0x4a60('0xd')](function(_0x43cf1d){logger[_0x4a60('0xe')](_0x4a60('0xf'),_0x4f327c,'request\x20sent');logger[_0x4a60('0x10')](_0x4a60('0x11'),_0x4f327c,_0x4a60('0x12'),JSON['stringify'](_0x43cf1d));if(_0x43cf1d['error']){if(_0x43cf1d['error'][_0x4a60('0x13')]===0x1f4){logger[_0x4a60('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4f327c,_0x43cf1d[_0x4a60('0x14')][_0x4a60('0x15')]);return _0x88171b(_0x43cf1d[_0x4a60('0x14')][_0x4a60('0x15')]);}logger['error'](_0x4a60('0xf'),_0x4f327c,_0x43cf1d[_0x4a60('0x14')][_0x4a60('0x15')]);return _0x2af2f7(_0x43cf1d[_0x4a60('0x14')]['message']);}else{logger['info'](_0x4a60('0xf'),_0x4f327c,_0x4a60('0x12'));_0x2af2f7(_0x43cf1d[_0x4a60('0x16')]['message']);}})['catch'](function(_0x2d2ae5){logger[_0x4a60('0x14')](_0x4a60('0xf'),_0x4f327c,_0x2d2ae5);_0x88171b(_0x2d2ae5);});});} \ No newline at end of file +var _0xe4dd=['lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch'];(function(_0x40570e,_0x53df30){var _0x16336a=function(_0x227e0b){while(--_0x227e0b){_0x40570e['push'](_0x40570e['shift']());}};_0x16336a(++_0x53df30);}(_0xe4dd,0x1cc));var _0xde4d=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0xe4dd[_0x1e2321];return _0x1d346d;};'use strict';var _=require(_0xde4d('0x0'));var util=require(_0xde4d('0x1'));var moment=require('moment');var BPromise=require(_0xde4d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xde4d('0x3'))['db'];var utils=require(_0xde4d('0x4'));var logger=require(_0xde4d('0x5'))(_0xde4d('0x6'));var config=require(_0xde4d('0x7'));var jayson=require(_0xde4d('0x8'));var client=jayson['client'][_0xde4d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x110167,_0x55580d,_0x5dca7e){return new BPromise(function(_0x1e14f1,_0x84f22d){return client['request'](_0x110167,_0x5dca7e)[_0xde4d('0xa')](function(_0x120b35){logger[_0xde4d('0xb')](_0xde4d('0xc'),_0x55580d,_0xde4d('0xd'));logger[_0xde4d('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x55580d,'request\x20sent',JSON[_0xde4d('0xf')](_0x120b35));if(_0x120b35[_0xde4d('0x10')]){if(_0x120b35[_0xde4d('0x10')][_0xde4d('0x11')]===0x1f4){logger['error'](_0xde4d('0xc'),_0x55580d,_0x120b35['error'][_0xde4d('0x12')]);return _0x84f22d(_0x120b35[_0xde4d('0x10')][_0xde4d('0x12')]);}logger[_0xde4d('0x10')](_0xde4d('0xc'),_0x55580d,_0x120b35[_0xde4d('0x10')]['message']);return _0x1e14f1(_0x120b35[_0xde4d('0x10')]['message']);}else{logger[_0xde4d('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x55580d,_0xde4d('0xd'));_0x1e14f1(_0x120b35['result'][_0xde4d('0x12')]);}})[_0xde4d('0x13')](function(_0x458917){logger[_0xde4d('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x55580d,_0x458917);_0x84f22d(_0x458917);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 674343b..cc5df5c 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 _0x17a9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','show','create','/:id','update','destroy','exports','multer'];(function(_0x21ef63,_0x298197){var _0x1314e0=function(_0x364916){while(--_0x364916){_0x21ef63['push'](_0x21ef63['shift']());}};_0x1314e0(++_0x298197);}(_0x17a9,0x10f));var _0x917a=function(_0x1825f4,_0x319bb3){_0x1825f4=_0x1825f4-0x0;var _0x1e3ab4=_0x17a9[_0x1825f4];return _0x1e3ab4;};'use strict';var multer=require(_0x917a('0x0'));var util=require(_0x917a('0x1'));var path=require(_0x917a('0x2'));var timeout=require(_0x917a('0x3'));var express=require(_0x917a('0x4'));var router=express[_0x917a('0x5')]();var fs_extra=require(_0x917a('0x6'));var auth=require(_0x917a('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router[_0x917a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x917a('0x8')]('/:id',auth[_0x917a('0x9')](),controller[_0x917a('0xa')]);router['post']('/',auth[_0x917a('0x9')](),controller[_0x917a('0xb')]);router['put'](_0x917a('0xc'),auth[_0x917a('0x9')](),controller[_0x917a('0xd')]);router['delete'](_0x917a('0xc'),auth[_0x917a('0x9')](),controller[_0x917a('0xe')]);module[_0x917a('0xf')]=router; \ No newline at end of file +var _0x117f=['../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','get','show','post','create','put','/:id','update','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x117f,0x1da));var _0xf117=function(_0x1ff3bb,_0x15b9b4){_0x1ff3bb=_0x1ff3bb-0x0;var _0x289cdc=_0x117f[_0x1ff3bb];return _0x289cdc;};'use strict';var multer=require(_0xf117('0x0'));var util=require(_0xf117('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf117('0x2'));var router=express[_0xf117('0x3')]();var fs_extra=require(_0xf117('0x4'));var auth=require(_0xf117('0x5'));var interaction=require(_0xf117('0x6'));var config=require(_0xf117('0x7'));var controller=require(_0xf117('0x8'));router['get']('/',auth[_0xf117('0x9')](),controller[_0xf117('0xa')]);router[_0xf117('0xb')]('/:id',auth[_0xf117('0x9')](),controller[_0xf117('0xc')]);router[_0xf117('0xd')]('/',auth[_0xf117('0x9')](),controller[_0xf117('0xe')]);router[_0xf117('0xf')](_0xf117('0x10'),auth[_0xf117('0x9')](),controller[_0xf117('0x11')]);router[_0xf117('0x12')](_0xf117('0x10'),auth[_0xf117('0x9')](),controller[_0xf117('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 9f30f01..fe3adde 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 _0x8043=['STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x8043,0x159));var _0x3804=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x8043[_0x565ed7];return _0x183ad7;};'use strict';var Sequelize=require(_0x3804('0x0'));module[_0x3804('0x1')]={'type':{'type':Sequelize[_0x3804('0x2')](_0x3804('0x3'),_0x3804('0x4'),_0x3804('0x5'),_0x3804('0x6'),'picklist'),'defaultValue':_0x3804('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3804('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x3804('0x3'),'variable',_0x3804('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3804('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3804('0x7')]}}; \ No newline at end of file +var _0x0871=['exports','ENUM','variable','picklist','string','customVariable','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0871,0x117));var _0x1087=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x0871[_0x13b02f];return _0x12e9a6;};'use strict';var Sequelize=require(_0x1087('0x0'));module[_0x1087('0x1')]={'type':{'type':Sequelize[_0x1087('0x2')]('string',_0x1087('0x3'),'customVariable','keyValue',_0x1087('0x4')),'defaultValue':_0x1087('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x1087('0x5'),_0x1087('0x3'),_0x1087('0x6'))},'keyContent':{'type':Sequelize[_0x1087('0x7')]},'idField':{'type':Sequelize[_0x1087('0x7')]},'nameField':{'type':Sequelize[_0x1087('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1087('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index b9954bf..e41027b 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 _0xce20=['create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','SugarcrmField','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','keys','length','find'];(function(_0x82cc5f,_0x1b739e){var _0x2e2b5c=function(_0x2b16c4){while(--_0x2b16c4){_0x82cc5f['push'](_0x82cc5f['shift']());}};_0x2e2b5c(++_0x1b739e);}(_0xce20,0x9b));var _0x0ce2=function(_0x1d3562,_0x5d9e99){_0x1d3562=_0x1d3562-0x0;var _0x2ff0ed=_0xce20[_0x1d3562];return _0x2ff0ed;};'use strict';var emlformat=require(_0x0ce2('0x0'));var rimraf=require(_0x0ce2('0x1'));var zipdir=require(_0x0ce2('0x2'));var jsonpatch=require(_0x0ce2('0x3'));var rp=require(_0x0ce2('0x4'));var moment=require(_0x0ce2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0ce2('0x6'));var util=require(_0x0ce2('0x7'));var path=require(_0x0ce2('0x8'));var sox=require(_0x0ce2('0x9'));var csv=require('to-csv');var ejs=require(_0x0ce2('0xa'));var fs=require('fs');var fs_extra=require(_0x0ce2('0xb'));var _=require('lodash');var squel=require(_0x0ce2('0xc'));var crypto=require(_0x0ce2('0xd'));var jsforce=require(_0x0ce2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0ce2('0xf'));var querystring=require(_0x0ce2('0x10'));var Papa=require(_0x0ce2('0x11'));var Redis=require(_0x0ce2('0x12'));var authService=require(_0x0ce2('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0ce2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ce2('0x15'))('api');var utils=require(_0x0ce2('0x16'));var config=require(_0x0ce2('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0ce2('0x18'))['db'];function respondWithStatusCode(_0x4dc505,_0x1b7d59){_0x1b7d59=_0x1b7d59||0xcc;return function(_0xc61ba1){if(_0xc61ba1){return _0x4dc505['sendStatus'](_0x1b7d59);}return _0x4dc505[_0x0ce2('0x19')](_0x1b7d59)[_0x0ce2('0x1a')]();};}function respondWithResult(_0xdde7d9,_0x45298b){_0x45298b=_0x45298b||0xc8;return function(_0x1a7308){if(_0x1a7308){return _0xdde7d9['status'](_0x45298b)[_0x0ce2('0x1b')](_0x1a7308);}};}function respondWithFilteredResult(_0x2a82c8,_0x2777ea){return function(_0x1018a1){if(_0x1018a1){var _0x343562=typeof _0x2777ea[_0x0ce2('0x1c')]===_0x0ce2('0x1d')&&typeof _0x2777ea[_0x0ce2('0x1e')]==='undefined';var _0x5a74f9=_0x1018a1['count'];var _0x53a50b=_0x343562?0x0:_0x2777ea[_0x0ce2('0x1c')];var _0xff2b98=_0x343562?_0x1018a1[_0x0ce2('0x1f')]:_0x2777ea[_0x0ce2('0x1c')]+_0x2777ea[_0x0ce2('0x1e')];var _0x112263;if(_0xff2b98>=_0x5a74f9){_0xff2b98=_0x5a74f9;_0x112263=0xc8;}else{_0x112263=0xce;}_0x2a82c8[_0x0ce2('0x19')](_0x112263);return _0x2a82c8[_0x0ce2('0x20')]('Content-Range',_0x53a50b+'-'+_0xff2b98+'/'+_0x5a74f9)[_0x0ce2('0x1b')](_0x1018a1);}return null;};}function patchUpdates(_0x100a0e){return function(_0x41dc0f){try{jsonpatch[_0x0ce2('0x21')](_0x41dc0f,_0x100a0e,!![]);}catch(_0x3c56cd){return BPromise[_0x0ce2('0x22')](_0x3c56cd);}return _0x41dc0f[_0x0ce2('0x23')]();};}function saveUpdates(_0x144316,_0x4dbd9d){return function(_0x1a8a98){if(_0x1a8a98){return _0x1a8a98[_0x0ce2('0x24')](_0x144316)['then'](function(_0x3b32f8){return _0x3b32f8;});}return null;};}function removeEntity(_0x534915,_0x5d2c67){return function(_0x3a0c51){if(_0x3a0c51){return _0x3a0c51[_0x0ce2('0x25')]()[_0x0ce2('0x26')](function(){_0x534915[_0x0ce2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21b322,_0x3ab166){return function(_0x1a09f2){if(!_0x1a09f2){_0x21b322[_0x0ce2('0x27')](0x194);}return _0x1a09f2;};}function handleError(_0x3a0594,_0x3debd8){_0x3debd8=_0x3debd8||0x1f4;return function(_0x571946){logger[_0x0ce2('0x28')](_0x571946[_0x0ce2('0x29')]);if(_0x571946['name']){delete _0x571946[_0x0ce2('0x2a')];}_0x3a0594[_0x0ce2('0x19')](_0x3debd8)[_0x0ce2('0x2b')](_0x571946);};}exports[_0x0ce2('0x2c')]=function(_0x5cd6c2,_0x122c9d){var _0x1a8ad5={},_0x2b574b={},_0x5cdc6e={'count':0x0,'rows':[]};var _0x17c30f=_[_0x0ce2('0x2d')](db[_0x0ce2('0x2e')][_0x0ce2('0x2f')],function(_0x8674bc){return{'name':_0x8674bc['fieldName'],'type':_0x8674bc[_0x0ce2('0x30')][_0x0ce2('0x31')]};});_0x2b574b['model']=_['map'](_0x17c30f,_0x0ce2('0x2a'));_0x2b574b[_0x0ce2('0x32')]=_['keys'](_0x5cd6c2[_0x0ce2('0x32')]);_0x2b574b[_0x0ce2('0x33')]=_[_0x0ce2('0x34')](_0x2b574b[_0x0ce2('0x35')],_0x2b574b[_0x0ce2('0x32')]);_0x1a8ad5[_0x0ce2('0x36')]=_['intersection'](_0x2b574b[_0x0ce2('0x35')],qs['fields'](_0x5cd6c2[_0x0ce2('0x32')][_0x0ce2('0x37')]));_0x1a8ad5[_0x0ce2('0x36')]=_0x1a8ad5[_0x0ce2('0x36')]['length']?_0x1a8ad5[_0x0ce2('0x36')]:_0x2b574b[_0x0ce2('0x35')];if(!_0x5cd6c2['query'][_0x0ce2('0x38')](_0x0ce2('0x39'))){_0x1a8ad5['limit']=qs[_0x0ce2('0x1e')](_0x5cd6c2[_0x0ce2('0x32')]['limit']);_0x1a8ad5[_0x0ce2('0x1c')]=qs[_0x0ce2('0x1c')](_0x5cd6c2['query'][_0x0ce2('0x1c')]);}_0x1a8ad5[_0x0ce2('0x3a')]=qs[_0x0ce2('0x3b')](_0x5cd6c2[_0x0ce2('0x32')][_0x0ce2('0x3b')]);_0x1a8ad5[_0x0ce2('0x3c')]=qs[_0x0ce2('0x33')](_[_0x0ce2('0x3d')](_0x5cd6c2['query'],_0x2b574b[_0x0ce2('0x33')]),_0x17c30f);if(_0x5cd6c2['query'][_0x0ce2('0x3e')]){_0x1a8ad5['where']=_[_0x0ce2('0x3f')](_0x1a8ad5[_0x0ce2('0x3c')],{'$or':_[_0x0ce2('0x2d')](_0x17c30f,function(_0x39a4b2){if(_0x39a4b2[_0x0ce2('0x30')]!==_0x0ce2('0x40')){var _0x4e91c9={};_0x4e91c9[_0x39a4b2[_0x0ce2('0x2a')]]={'$like':'%'+_0x5cd6c2[_0x0ce2('0x32')][_0x0ce2('0x3e')]+'%'};return _0x4e91c9;}})});}_0x1a8ad5=_['merge']({},_0x1a8ad5,_0x5cd6c2[_0x0ce2('0x41')]);var _0x72e33f={'where':_0x1a8ad5[_0x0ce2('0x3c')]};return db[_0x0ce2('0x2e')]['count'](_0x72e33f)['then'](function(_0x1322df){_0x5cdc6e[_0x0ce2('0x1f')]=_0x1322df;if(_0x5cd6c2[_0x0ce2('0x32')][_0x0ce2('0x42')]){_0x1a8ad5['include']=[{'all':!![]}];}return db[_0x0ce2('0x2e')][_0x0ce2('0x43')](_0x1a8ad5);})[_0x0ce2('0x26')](function(_0x5f505e){_0x5cdc6e[_0x0ce2('0x44')]=_0x5f505e;return _0x5cdc6e;})[_0x0ce2('0x26')](respondWithFilteredResult(_0x122c9d,_0x1a8ad5))[_0x0ce2('0x45')](handleError(_0x122c9d,null));};exports['show']=function(_0x393779,_0x2ad683){var _0x21f5bb={'raw':!![],'where':{'id':_0x393779['params']['id']}},_0x2f2e45={};_0x2f2e45[_0x0ce2('0x35')]=_[_0x0ce2('0x46')](db[_0x0ce2('0x2e')]['rawAttributes']);_0x2f2e45[_0x0ce2('0x32')]=_['keys'](_0x393779[_0x0ce2('0x32')]);_0x2f2e45[_0x0ce2('0x33')]=_[_0x0ce2('0x34')](_0x2f2e45[_0x0ce2('0x35')],_0x2f2e45[_0x0ce2('0x32')]);_0x21f5bb[_0x0ce2('0x36')]=_[_0x0ce2('0x34')](_0x2f2e45[_0x0ce2('0x35')],qs[_0x0ce2('0x37')](_0x393779[_0x0ce2('0x32')]['fields']));_0x21f5bb[_0x0ce2('0x36')]=_0x21f5bb[_0x0ce2('0x36')][_0x0ce2('0x47')]?_0x21f5bb[_0x0ce2('0x36')]:_0x2f2e45[_0x0ce2('0x35')];if(_0x393779[_0x0ce2('0x32')][_0x0ce2('0x42')]){_0x21f5bb['include']=[{'all':!![]}];}_0x21f5bb=_[_0x0ce2('0x3f')]({},_0x21f5bb,_0x393779[_0x0ce2('0x41')]);return db[_0x0ce2('0x2e')][_0x0ce2('0x48')](_0x21f5bb)[_0x0ce2('0x26')](handleEntityNotFound(_0x2ad683,null))[_0x0ce2('0x26')](respondWithResult(_0x2ad683,null))[_0x0ce2('0x45')](handleError(_0x2ad683,null));};exports[_0x0ce2('0x49')]=function(_0x4d7c02,_0x4258cb){return db['SugarcrmField'][_0x0ce2('0x49')](_0x4d7c02[_0x0ce2('0x4a')],{})[_0x0ce2('0x26')](respondWithResult(_0x4258cb,0xc9))[_0x0ce2('0x45')](handleError(_0x4258cb,null));};exports[_0x0ce2('0x24')]=function(_0x2ccf98,_0x3a35e5){if(_0x2ccf98['body']['id']){delete _0x2ccf98[_0x0ce2('0x4a')]['id'];}return db[_0x0ce2('0x2e')][_0x0ce2('0x48')]({'where':{'id':_0x2ccf98[_0x0ce2('0x4b')]['id']}})[_0x0ce2('0x26')](handleEntityNotFound(_0x3a35e5,null))[_0x0ce2('0x26')](saveUpdates(_0x2ccf98[_0x0ce2('0x4a')],null))[_0x0ce2('0x26')](respondWithResult(_0x3a35e5,null))[_0x0ce2('0x45')](handleError(_0x3a35e5,null));};exports[_0x0ce2('0x25')]=function(_0x5508aa,_0x416332){return db[_0x0ce2('0x2e')]['find']({'where':{'id':_0x5508aa['params']['id']}})[_0x0ce2('0x26')](handleEntityNotFound(_0x416332,null))[_0x0ce2('0x26')](removeEntity(_0x416332,null))[_0x0ce2('0x45')](handleError(_0x416332,null));}; \ No newline at end of file +var _0x706c=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','name','index','SugarcrmField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','length','options','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs'];(function(_0x51674a,_0x77ccff){var _0x13fca6=function(_0x3d6c27){while(--_0x3d6c27){_0x51674a['push'](_0x51674a['shift']());}};_0x13fca6(++_0x77ccff);}(_0x706c,0x81));var _0xc706=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x706c[_0x9cd4c3];return _0x4c9025;};'use strict';var emlformat=require(_0xc706('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc706('0x1'));var jsonpatch=require(_0xc706('0x2'));var rp=require(_0xc706('0x3'));var moment=require(_0xc706('0x4'));var BPromise=require(_0xc706('0x5'));var Mustache=require(_0xc706('0x6'));var util=require(_0xc706('0x7'));var path=require(_0xc706('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc706('0x9'));var fs=require('fs');var fs_extra=require(_0xc706('0xa'));var _=require('lodash');var squel=require(_0xc706('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc706('0xc'));var toCsv=require(_0xc706('0xd'));var querystring=require(_0xc706('0xe'));var Papa=require('papaparse');var Redis=require(_0xc706('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc706('0x10'));var as=require(_0xc706('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc706('0x12'))(_0xc706('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc706('0x14'));var db=require(_0xc706('0x15'))['db'];function respondWithStatusCode(_0x449c8e,_0x3519a2){_0x3519a2=_0x3519a2||0xcc;return function(_0x56b0bd){if(_0x56b0bd){return _0x449c8e[_0xc706('0x16')](_0x3519a2);}return _0x449c8e[_0xc706('0x17')](_0x3519a2)[_0xc706('0x18')]();};}function respondWithResult(_0x55531b,_0x1f2113){_0x1f2113=_0x1f2113||0xc8;return function(_0x219bda){if(_0x219bda){return _0x55531b[_0xc706('0x17')](_0x1f2113)[_0xc706('0x19')](_0x219bda);}};}function respondWithFilteredResult(_0x2fb5a4,_0x525b55){return function(_0x3486d4){if(_0x3486d4){var _0x34c8b8=typeof _0x525b55[_0xc706('0x1a')]==='undefined'&&typeof _0x525b55[_0xc706('0x1b')]===_0xc706('0x1c');var _0x1b4670=_0x3486d4['count'];var _0x48367f=_0x34c8b8?0x0:_0x525b55[_0xc706('0x1a')];var _0x58eb51=_0x34c8b8?_0x3486d4[_0xc706('0x1d')]:_0x525b55[_0xc706('0x1a')]+_0x525b55[_0xc706('0x1b')];var _0x3486d7;if(_0x58eb51>=_0x1b4670){_0x58eb51=_0x1b4670;_0x3486d7=0xc8;}else{_0x3486d7=0xce;}_0x2fb5a4[_0xc706('0x17')](_0x3486d7);return _0x2fb5a4[_0xc706('0x1e')](_0xc706('0x1f'),_0x48367f+'-'+_0x58eb51+'/'+_0x1b4670)[_0xc706('0x19')](_0x3486d4);}return null;};}function patchUpdates(_0x972d34){return function(_0x551599){try{jsonpatch[_0xc706('0x20')](_0x551599,_0x972d34,!![]);}catch(_0x1850a1){return BPromise[_0xc706('0x21')](_0x1850a1);}return _0x551599[_0xc706('0x22')]();};}function saveUpdates(_0x45767c,_0x4aa2fa){return function(_0x10fc51){if(_0x10fc51){return _0x10fc51[_0xc706('0x23')](_0x45767c)['then'](function(_0x3a292b){return _0x3a292b;});}return null;};}function removeEntity(_0x21aa9e,_0x4d35c6){return function(_0xd23376){if(_0xd23376){return _0xd23376['destroy']()[_0xc706('0x24')](function(){_0x21aa9e['status'](0xcc)[_0xc706('0x18')]();});}};}function handleEntityNotFound(_0x46cfdf,_0x52b2b5){return function(_0x2541dd){if(!_0x2541dd){_0x46cfdf['sendStatus'](0x194);}return _0x2541dd;};}function handleError(_0x22cabf,_0x3884bb){_0x3884bb=_0x3884bb||0x1f4;return function(_0x4ea87b){logger[_0xc706('0x25')](_0x4ea87b['stack']);if(_0x4ea87b[_0xc706('0x26')]){delete _0x4ea87b['name'];}_0x22cabf[_0xc706('0x17')](_0x3884bb)['send'](_0x4ea87b);};}exports[_0xc706('0x27')]=function(_0x12e9f6,_0x5981e6){var _0x22e8bf={},_0x6a648e={},_0x27f947={'count':0x0,'rows':[]};var _0x44e93c=_['map'](db[_0xc706('0x28')][_0xc706('0x29')],function(_0x31b74a){return{'name':_0x31b74a[_0xc706('0x2a')],'type':_0x31b74a[_0xc706('0x2b')][_0xc706('0x2c')]};});_0x6a648e[_0xc706('0x2d')]=_[_0xc706('0x2e')](_0x44e93c,_0xc706('0x26'));_0x6a648e[_0xc706('0x2f')]=_[_0xc706('0x30')](_0x12e9f6['query']);_0x6a648e[_0xc706('0x31')]=_[_0xc706('0x32')](_0x6a648e['model'],_0x6a648e[_0xc706('0x2f')]);_0x22e8bf[_0xc706('0x33')]=_[_0xc706('0x32')](_0x6a648e['model'],qs['fields'](_0x12e9f6[_0xc706('0x2f')][_0xc706('0x34')]));_0x22e8bf[_0xc706('0x33')]=_0x22e8bf[_0xc706('0x33')]['length']?_0x22e8bf[_0xc706('0x33')]:_0x6a648e[_0xc706('0x2d')];if(!_0x12e9f6[_0xc706('0x2f')]['hasOwnProperty'](_0xc706('0x35'))){_0x22e8bf[_0xc706('0x1b')]=qs[_0xc706('0x1b')](_0x12e9f6[_0xc706('0x2f')][_0xc706('0x1b')]);_0x22e8bf[_0xc706('0x1a')]=qs[_0xc706('0x1a')](_0x12e9f6['query'][_0xc706('0x1a')]);}_0x22e8bf[_0xc706('0x36')]=qs[_0xc706('0x37')](_0x12e9f6[_0xc706('0x2f')][_0xc706('0x37')]);_0x22e8bf['where']=qs[_0xc706('0x31')](_[_0xc706('0x38')](_0x12e9f6['query'],_0x6a648e['filters']),_0x44e93c);if(_0x12e9f6['query']['filter']){_0x22e8bf[_0xc706('0x39')]=_[_0xc706('0x3a')](_0x22e8bf[_0xc706('0x39')],{'$or':_['map'](_0x44e93c,function(_0x56964e){if(_0x56964e['type']!==_0xc706('0x3b')){var _0x11adde={};_0x11adde[_0x56964e[_0xc706('0x26')]]={'$like':'%'+_0x12e9f6[_0xc706('0x2f')][_0xc706('0x3c')]+'%'};return _0x11adde;}})});}_0x22e8bf=_[_0xc706('0x3a')]({},_0x22e8bf,_0x12e9f6['options']);var _0x44290f={'where':_0x22e8bf[_0xc706('0x39')]};return db[_0xc706('0x28')]['count'](_0x44290f)[_0xc706('0x24')](function(_0x294d60){_0x27f947[_0xc706('0x1d')]=_0x294d60;if(_0x12e9f6[_0xc706('0x2f')][_0xc706('0x3d')]){_0x22e8bf[_0xc706('0x3e')]=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x22e8bf);})[_0xc706('0x24')](function(_0x2cbabe){_0x27f947[_0xc706('0x3f')]=_0x2cbabe;return _0x27f947;})['then'](respondWithFilteredResult(_0x5981e6,_0x22e8bf))[_0xc706('0x40')](handleError(_0x5981e6,null));};exports[_0xc706('0x41')]=function(_0x27014a,_0x1635a3){var _0x4fc92e={'raw':!![],'where':{'id':_0x27014a[_0xc706('0x42')]['id']}},_0x3e37f6={};_0x3e37f6[_0xc706('0x2d')]=_[_0xc706('0x30')](db[_0xc706('0x28')][_0xc706('0x29')]);_0x3e37f6[_0xc706('0x2f')]=_[_0xc706('0x30')](_0x27014a[_0xc706('0x2f')]);_0x3e37f6[_0xc706('0x31')]=_[_0xc706('0x32')](_0x3e37f6['model'],_0x3e37f6[_0xc706('0x2f')]);_0x4fc92e[_0xc706('0x33')]=_[_0xc706('0x32')](_0x3e37f6[_0xc706('0x2d')],qs[_0xc706('0x34')](_0x27014a[_0xc706('0x2f')][_0xc706('0x34')]));_0x4fc92e[_0xc706('0x33')]=_0x4fc92e['attributes'][_0xc706('0x43')]?_0x4fc92e[_0xc706('0x33')]:_0x3e37f6[_0xc706('0x2d')];if(_0x27014a[_0xc706('0x2f')][_0xc706('0x3d')]){_0x4fc92e[_0xc706('0x3e')]=[{'all':!![]}];}_0x4fc92e=_['merge']({},_0x4fc92e,_0x27014a[_0xc706('0x44')]);return db[_0xc706('0x28')][_0xc706('0x45')](_0x4fc92e)[_0xc706('0x24')](handleEntityNotFound(_0x1635a3,null))[_0xc706('0x24')](respondWithResult(_0x1635a3,null))['catch'](handleError(_0x1635a3,null));};exports[_0xc706('0x46')]=function(_0x1a4069,_0x570388){return db[_0xc706('0x28')][_0xc706('0x46')](_0x1a4069['body'],{})[_0xc706('0x24')](respondWithResult(_0x570388,0xc9))[_0xc706('0x40')](handleError(_0x570388,null));};exports[_0xc706('0x23')]=function(_0x443d11,_0x56b1a1){if(_0x443d11[_0xc706('0x47')]['id']){delete _0x443d11[_0xc706('0x47')]['id'];}return db['SugarcrmField'][_0xc706('0x45')]({'where':{'id':_0x443d11[_0xc706('0x42')]['id']}})[_0xc706('0x24')](handleEntityNotFound(_0x56b1a1,null))[_0xc706('0x24')](saveUpdates(_0x443d11[_0xc706('0x47')],null))[_0xc706('0x24')](respondWithResult(_0x56b1a1,null))[_0xc706('0x40')](handleError(_0x56b1a1,null));};exports[_0xc706('0x48')]=function(_0x29b7b7,_0x419635){return db[_0xc706('0x28')][_0xc706('0x45')]({'where':{'id':_0x29b7b7[_0xc706('0x42')]['id']}})[_0xc706('0x24')](handleEntityNotFound(_0x419635,null))[_0xc706('0x24')](removeEntity(_0x419635,null))[_0xc706('0x40')](handleError(_0x419635,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index c94339f..46bbe56 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 _0x65e0=['idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields'];(function(_0x1a6bde,_0x3e8809){var _0x490911=function(_0x1da913){while(--_0x1da913){_0x1a6bde['push'](_0x1a6bde['shift']());}};_0x490911(++_0x3e8809);}(_0x65e0,0x1ef));var _0x065e=function(_0x335f5c,_0xce622c){_0x335f5c=_0x335f5c-0x0;var _0x27458c=_0x65e0[_0x335f5c];return _0x27458c;};'use strict';var _=require(_0x065e('0x0'));var util=require(_0x065e('0x1'));var logger=require(_0x065e('0x2'))('api');var moment=require(_0x065e('0x3'));var BPromise=require(_0x065e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x065e('0x5'));var rimraf=require(_0x065e('0x6'));var config=require(_0x065e('0x7'));var attributes=require(_0x065e('0x8'));module[_0x065e('0x9')]=function(_0x216d82,_0x582002){return _0x216d82[_0x065e('0xa')]('SugarcrmField',attributes,{'tableName':_0x065e('0xb'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x065e('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa1e0=['SugarcrmField','idField','FieldId','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa1e0,0x1a7));var _0x0a1e=function(_0x263d0e,_0x588353){_0x263d0e=_0x263d0e-0x0;var _0x76cb3d=_0xa1e0[_0x263d0e];return _0x76cb3d;};'use strict';var _=require(_0x0a1e('0x0'));var util=require(_0x0a1e('0x1'));var logger=require(_0x0a1e('0x2'))(_0x0a1e('0x3'));var moment=require('moment');var BPromise=require(_0x0a1e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a1e('0x5'));var rimraf=require(_0x0a1e('0x6'));var config=require(_0x0a1e('0x7'));var attributes=require(_0x0a1e('0x8'));module[_0x0a1e('0x9')]=function(_0x5cd4eb,_0x3e6c3e){return _0x5cd4eb[_0x0a1e('0xa')](_0x0a1e('0xb'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x0a1e('0xc'),_0x0a1e('0xd')],'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 44412c0..5ec37f3 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 _0x126e=['request','then','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x2ef2b2,_0x2d2865){var _0x58e5e7=function(_0x46f4fd){while(--_0x46f4fd){_0x2ef2b2['push'](_0x2ef2b2['shift']());}};_0x58e5e7(++_0x2d2865);}(_0x126e,0x1da));var _0xe126=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x126e[_0x5bd426];return _0x23a7eb;};'use strict';var _=require('lodash');var util=require(_0xe126('0x0'));var moment=require('moment');var BPromise=require(_0xe126('0x1'));var rs=require(_0xe126('0x2'));var fs=require('fs');var Redis=require(_0xe126('0x3'));var db=require(_0xe126('0x4'))['db'];var utils=require(_0xe126('0x5'));var logger=require('../../config/logger')(_0xe126('0x6'));var config=require(_0xe126('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe126('0x8')][_0xe126('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x92f776,_0x2abebf,_0x1f5e2d){return new BPromise(function(_0x39209f,_0x53a8){return client[_0xe126('0xa')](_0x92f776,_0x1f5e2d)[_0xe126('0xb')](function(_0x2b2d74){logger[_0xe126('0xc')](_0xe126('0xd'),_0x2abebf,'request\x20sent');logger[_0xe126('0xe')](_0xe126('0xf'),_0x2abebf,_0xe126('0x10'),JSON[_0xe126('0x11')](_0x2b2d74));if(_0x2b2d74[_0xe126('0x12')]){if(_0x2b2d74[_0xe126('0x12')][_0xe126('0x13')]===0x1f4){logger[_0xe126('0x12')](_0xe126('0xd'),_0x2abebf,_0x2b2d74[_0xe126('0x12')][_0xe126('0x14')]);return _0x53a8(_0x2b2d74['error']['message']);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x2abebf,_0x2b2d74[_0xe126('0x12')][_0xe126('0x14')]);return _0x39209f(_0x2b2d74[_0xe126('0x12')]['message']);}else{logger['info'](_0xe126('0xd'),_0x2abebf,_0xe126('0x10'));_0x39209f(_0x2b2d74['result'][_0xe126('0x14')]);}})[_0xe126('0x15')](function(_0x1ea112){logger['error'](_0xe126('0xd'),_0x2abebf,_0x1ea112);_0x53a8(_0x1ea112);});});} \ No newline at end of file +var _0xbfde=['jayson/promise','http','then','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','lodash','util','moment','randomstring','ioredis','rpc'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xbfde,0x19a));var _0xebfd=function(_0x31cfa8,_0x2c19dd){_0x31cfa8=_0x31cfa8-0x0;var _0x2ea04e=_0xbfde[_0x31cfa8];return _0x2ea04e;};'use strict';var _=require(_0xebfd('0x0'));var util=require(_0xebfd('0x1'));var moment=require(_0xebfd('0x2'));var BPromise=require('bluebird');var rs=require(_0xebfd('0x3'));var fs=require('fs');var Redis=require(_0xebfd('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xebfd('0x5'));var config=require('../../config/environment');var jayson=require(_0xebfd('0x6'));var client=jayson['client'][_0xebfd('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3e90ae,_0xb5b142,_0x25adbd){return new BPromise(function(_0x595592,_0x4a0e1f){return client['request'](_0x3e90ae,_0x25adbd)[_0xebfd('0x8')](function(_0x2ace33){logger['info'](_0xebfd('0x9'),_0xb5b142,'request\x20sent');logger[_0xebfd('0xa')](_0xebfd('0xb'),_0xb5b142,_0xebfd('0xc'),JSON['stringify'](_0x2ace33));if(_0x2ace33[_0xebfd('0xd')]){if(_0x2ace33[_0xebfd('0xd')]['code']===0x1f4){logger[_0xebfd('0xd')](_0xebfd('0x9'),_0xb5b142,_0x2ace33[_0xebfd('0xd')][_0xebfd('0xe')]);return _0x4a0e1f(_0x2ace33[_0xebfd('0xd')][_0xebfd('0xe')]);}logger[_0xebfd('0xd')](_0xebfd('0x9'),_0xb5b142,_0x2ace33['error'][_0xebfd('0xe')]);return _0x595592(_0x2ace33[_0xebfd('0xd')]['message']);}else{logger['info'](_0xebfd('0x9'),_0xb5b142,_0xebfd('0xc'));_0x595592(_0x2ace33['result'][_0xebfd('0xe')]);}})[_0xebfd('0xf')](function(_0x5aa7b3){logger['error'](_0xebfd('0x9'),_0xb5b142,_0x5aa7b3);_0x4a0e1f(_0x5aa7b3);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 049e65e..436fb66 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 _0xf12f=['create','addConfiguration','update','delete','util','path','connect-timeout','fs-extra','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x237029,_0x2cf8d3){var _0x11a600=function(_0x4e5edb){while(--_0x4e5edb){_0x237029['push'](_0x237029['shift']());}};_0x11a600(++_0x2cf8d3);}(_0xf12f,0x9c));var _0xff12=function(_0xeb1a5,_0x54e31d){_0xeb1a5=_0xeb1a5-0x0;var _0x5e580a=_0xf12f[_0xeb1a5];return _0x5e580a;};'use strict';var multer=require('multer');var util=require(_0xff12('0x0'));var path=require(_0xff12('0x1'));var timeout=require(_0xff12('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xff12('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xff12('0x4'));var controller=require(_0xff12('0x5'));router[_0xff12('0x6')]('/',auth[_0xff12('0x7')](),controller[_0xff12('0x8')]);router[_0xff12('0x6')](_0xff12('0x9'),auth[_0xff12('0x7')](),controller['show']);router['get'](_0xff12('0xa'),auth['isAuthenticated'](),controller[_0xff12('0xb')]);router[_0xff12('0x6')](_0xff12('0xc'),auth['isAuthenticated'](),controller[_0xff12('0xd')]);router[_0xff12('0xe')]('/',auth[_0xff12('0x7')](),controller[_0xff12('0xf')]);router['post'](_0xff12('0xa'),auth[_0xff12('0x7')](),controller[_0xff12('0x10')]);router['put'](_0xff12('0x9'),auth['isAuthenticated'](),controller[_0xff12('0x11')]);router[_0xff12('0x12')](_0xff12('0x9'),auth[_0xff12('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xab29=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put'];(function(_0x499076,_0x1a4df0){var _0x337a7a=function(_0x5e0063){while(--_0x5e0063){_0x499076['push'](_0x499076['shift']());}};_0x337a7a(++_0x1a4df0);}(_0xab29,0x145));var _0x9ab2=function(_0x4e5702,_0x296c94){_0x4e5702=_0x4e5702-0x0;var _0x205b55=_0xab29[_0x4e5702];return _0x205b55;};'use strict';var multer=require(_0x9ab2('0x0'));var util=require(_0x9ab2('0x1'));var path=require(_0x9ab2('0x2'));var timeout=require(_0x9ab2('0x3'));var express=require('express');var router=express[_0x9ab2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9ab2('0x5'));var interaction=require(_0x9ab2('0x6'));var config=require(_0x9ab2('0x7'));var controller=require(_0x9ab2('0x8'));router[_0x9ab2('0x9')]('/',auth['isAuthenticated'](),controller[_0x9ab2('0xa')]);router[_0x9ab2('0x9')](_0x9ab2('0xb'),auth[_0x9ab2('0xc')](),controller[_0x9ab2('0xd')]);router['get'](_0x9ab2('0xe'),auth[_0x9ab2('0xc')](),controller[_0x9ab2('0xf')]);router[_0x9ab2('0x9')](_0x9ab2('0x10'),auth[_0x9ab2('0xc')](),controller[_0x9ab2('0x11')]);router[_0x9ab2('0x12')]('/',auth[_0x9ab2('0xc')](),controller['create']);router[_0x9ab2('0x12')](_0x9ab2('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x9ab2('0x13')](_0x9ab2('0xb'),auth[_0x9ab2('0xc')](),controller['update']);router[_0x9ab2('0x14')](_0x9ab2('0xb'),auth['isAuthenticated'](),controller[_0x9ab2('0x15')]);module[_0x9ab2('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 05ff00d..dd585db 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 _0xc0c1=['sequelize','STRING','HelpDesk'];(function(_0x4d049c,_0x495924){var _0x1ff450=function(_0x9b090){while(--_0x9b090){_0x4d049c['push'](_0x4d049c['shift']());}};_0x1ff450(++_0x495924);}(_0xc0c1,0x13e));var _0x1c0c=function(_0x58e48e,_0x16e57f){_0x58e48e=_0x58e48e-0x0;var _0x491ca8=_0xc0c1[_0x58e48e];return _0x491ca8;};'use strict';var Sequelize=require(_0x1c0c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x1c0c('0x1')],'allowNull':![],'defaultValue':_0x1c0c('0x2')},'remoteUri':{'type':Sequelize[_0x1c0c('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x1c0c('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xface=['exports','STRING','sequelize'];(function(_0x267c78,_0x4f7f4e){var _0xbe2116=function(_0x54738f){while(--_0x54738f){_0x267c78['push'](_0x267c78['shift']());}};_0xbe2116(++_0x4f7f4e);}(_0xface,0x1c1));var _0xefac=function(_0x21ee6c,_0x91cf8e){_0x21ee6c=_0x21ee6c-0x0;var _0x5114a8=_0xface[_0x21ee6c];return _0x5114a8;};'use strict';var Sequelize=require(_0xefac('0x0'));module[_0xefac('0x1')]={'name':{'type':Sequelize[_0xefac('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xefac('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xefac('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xefac('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xefac('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 85be495..bdcd8d9 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 _0x7e69=['filters','intersection','attributes','fields','hasOwnProperty','limit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','include','create','body','update','params','destroy','find','getConfigurations','findOne','VtigerConfiguration','rawAttributes','length','order','nolimit','AccountId','Subjects','getSubjects','channel','getDescriptions','VtigerField','getFields','username','remoteUri','accessKey','slice','lastIndexOf','format','GET','getchallenge','success','POST','login','result','describe','sessionName','autogenerated','reference','remove','includes','editable','false','startsWith','cf_','picklist','picklistValues','label','value','log','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','end','count','offset','set','Content-Range','json','apply','reject','then','status','sendStatus','name','send','index','map','VtigerAccount','fieldName','type','model','query','keys'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0x7e69,0x1a3));var _0x97e6=function(_0xc45596,_0x5c410e){_0xc45596=_0xc45596-0x0;var _0x425ffe=_0x7e69[_0xc45596];return _0x425ffe;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x97e6('0x0'));var jsonpatch=require(_0x97e6('0x1'));var rp=require(_0x97e6('0x2'));var moment=require(_0x97e6('0x3'));var BPromise=require(_0x97e6('0x4'));var Mustache=require(_0x97e6('0x5'));var util=require(_0x97e6('0x6'));var path=require(_0x97e6('0x7'));var sox=require('sox');var csv=require(_0x97e6('0x8'));var ejs=require(_0x97e6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97e6('0xa'));var squel=require(_0x97e6('0xb'));var crypto=require(_0x97e6('0xc'));var jsforce=require(_0x97e6('0xd'));var deskjs=require(_0x97e6('0xe'));var toCsv=require(_0x97e6('0x8'));var querystring=require('querystring');var Papa=require(_0x97e6('0xf'));var Redis=require('ioredis');var authService=require(_0x97e6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x97e6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x97e6('0x12'))(_0x97e6('0x13'));var utils=require(_0x97e6('0x14'));var config=require(_0x97e6('0x15'));var licenseUtil=require(_0x97e6('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x97e6('0x17'));function respondWithStatusCode(_0x708288,_0x44515e){_0x44515e=_0x44515e||0xcc;return function(_0x8b20ef){if(_0x8b20ef){return _0x708288['sendStatus'](_0x44515e);}return _0x708288['status'](_0x44515e)[_0x97e6('0x18')]();};}function respondWithResult(_0x41b5d9,_0x54a252){_0x54a252=_0x54a252||0xc8;return function(_0x3ff399){if(_0x3ff399){return _0x41b5d9['status'](_0x54a252)['json'](_0x3ff399);}};}function respondWithFilteredResult(_0x22cd73,_0x3f8056){return function(_0x257e0f){if(_0x257e0f){var _0x11354a=typeof _0x3f8056['offset']==='undefined'&&typeof _0x3f8056['limit']==='undefined';var _0x43e647=_0x257e0f[_0x97e6('0x19')];var _0x3c6d5d=_0x11354a?0x0:_0x3f8056[_0x97e6('0x1a')];var _0x51e4e6=_0x11354a?_0x257e0f['count']:_0x3f8056['offset']+_0x3f8056['limit'];var _0x39e323;if(_0x51e4e6>=_0x43e647){_0x51e4e6=_0x43e647;_0x39e323=0xc8;}else{_0x39e323=0xce;}_0x22cd73['status'](_0x39e323);return _0x22cd73[_0x97e6('0x1b')](_0x97e6('0x1c'),_0x3c6d5d+'-'+_0x51e4e6+'/'+_0x43e647)[_0x97e6('0x1d')](_0x257e0f);}return null;};}function patchUpdates(_0x5693fd){return function(_0x1bc106){try{jsonpatch[_0x97e6('0x1e')](_0x1bc106,_0x5693fd,!![]);}catch(_0x2ddcc7){return BPromise[_0x97e6('0x1f')](_0x2ddcc7);}return _0x1bc106['save']();};}function saveUpdates(_0x46ca9f,_0x2c02e0){return function(_0x2685ee){if(_0x2685ee){return _0x2685ee['update'](_0x46ca9f)[_0x97e6('0x20')](function(_0x5709be){return _0x5709be;});}return null;};}function removeEntity(_0x315af7,_0xfd74ea){return function(_0xab0f3a){if(_0xab0f3a){return _0xab0f3a['destroy']()[_0x97e6('0x20')](function(){_0x315af7[_0x97e6('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0xefc888,_0x1770d4){return function(_0x4417ad){if(!_0x4417ad){_0xefc888[_0x97e6('0x22')](0x194);}return _0x4417ad;};}function handleError(_0x320a75,_0x1d44f5){_0x1d44f5=_0x1d44f5||0x1f4;return function(_0x2bb0b4){logger['error'](_0x2bb0b4['stack']);if(_0x2bb0b4[_0x97e6('0x23')]){delete _0x2bb0b4['name'];}_0x320a75[_0x97e6('0x21')](_0x1d44f5)[_0x97e6('0x24')](_0x2bb0b4);};}exports[_0x97e6('0x25')]=function(_0x5f4cc5,_0xef882f){var _0x7adf76={},_0x26607d={},_0x35c6e2={'count':0x0,'rows':[]};var _0x25bbff=_[_0x97e6('0x26')](db[_0x97e6('0x27')]['rawAttributes'],function(_0x40cde6){return{'name':_0x40cde6[_0x97e6('0x28')],'type':_0x40cde6[_0x97e6('0x29')]['key']};});_0x26607d[_0x97e6('0x2a')]=_[_0x97e6('0x26')](_0x25bbff,_0x97e6('0x23'));_0x26607d[_0x97e6('0x2b')]=_[_0x97e6('0x2c')](_0x5f4cc5[_0x97e6('0x2b')]);_0x26607d[_0x97e6('0x2d')]=_[_0x97e6('0x2e')](_0x26607d['model'],_0x26607d[_0x97e6('0x2b')]);_0x7adf76[_0x97e6('0x2f')]=_[_0x97e6('0x2e')](_0x26607d[_0x97e6('0x2a')],qs[_0x97e6('0x30')](_0x5f4cc5[_0x97e6('0x2b')][_0x97e6('0x30')]));_0x7adf76[_0x97e6('0x2f')]=_0x7adf76[_0x97e6('0x2f')]['length']?_0x7adf76[_0x97e6('0x2f')]:_0x26607d['model'];if(!_0x5f4cc5['query'][_0x97e6('0x31')]('nolimit')){_0x7adf76[_0x97e6('0x32')]=qs[_0x97e6('0x32')](_0x5f4cc5[_0x97e6('0x2b')][_0x97e6('0x32')]);_0x7adf76[_0x97e6('0x1a')]=qs[_0x97e6('0x1a')](_0x5f4cc5[_0x97e6('0x2b')]['offset']);}_0x7adf76['order']=qs[_0x97e6('0x33')](_0x5f4cc5['query'][_0x97e6('0x33')]);_0x7adf76['where']=qs[_0x97e6('0x2d')](_[_0x97e6('0x34')](_0x5f4cc5[_0x97e6('0x2b')],_0x26607d['filters']),_0x25bbff);if(_0x5f4cc5['query'][_0x97e6('0x35')]){_0x7adf76['where']=_[_0x97e6('0x36')](_0x7adf76[_0x97e6('0x37')],{'$or':_[_0x97e6('0x26')](_0x25bbff,function(_0x2b2da5){if(_0x2b2da5[_0x97e6('0x29')]!==_0x97e6('0x38')){var _0x14ad9c={};_0x14ad9c[_0x2b2da5['name']]={'$like':'%'+_0x5f4cc5[_0x97e6('0x2b')][_0x97e6('0x35')]+'%'};return _0x14ad9c;}})});}_0x7adf76=_[_0x97e6('0x36')]({},_0x7adf76,_0x5f4cc5[_0x97e6('0x39')]);var _0x35fcdc={'where':_0x7adf76[_0x97e6('0x37')]};return db[_0x97e6('0x27')][_0x97e6('0x19')](_0x35fcdc)[_0x97e6('0x20')](function(_0x36f0bd){_0x35c6e2['count']=_0x36f0bd;if(_0x5f4cc5['query'][_0x97e6('0x3a')]){_0x7adf76['include']=[{'all':!![]}];}return db[_0x97e6('0x27')][_0x97e6('0x3b')](_0x7adf76);})[_0x97e6('0x20')](function(_0x4e1e04){_0x35c6e2[_0x97e6('0x3c')]=_0x4e1e04;return _0x35c6e2;})[_0x97e6('0x20')](respondWithFilteredResult(_0xef882f,_0x7adf76))[_0x97e6('0x3d')](handleError(_0xef882f,null));};exports['show']=function(_0x5e5889,_0x268d26){var _0x44e6db={'raw':![],'where':{'id':_0x5e5889['params']['id']}},_0x3115bb={};_0x3115bb['model']=_[_0x97e6('0x2c')](db[_0x97e6('0x27')]['rawAttributes']);_0x3115bb[_0x97e6('0x2b')]=_[_0x97e6('0x2c')](_0x5e5889[_0x97e6('0x2b')]);_0x3115bb[_0x97e6('0x2d')]=_['intersection'](_0x3115bb[_0x97e6('0x2a')],_0x3115bb['query']);_0x44e6db[_0x97e6('0x2f')]=_['intersection'](_0x3115bb[_0x97e6('0x2a')],qs['fields'](_0x5e5889[_0x97e6('0x2b')][_0x97e6('0x30')]));_0x44e6db[_0x97e6('0x2f')]=_0x44e6db['attributes']['length']?_0x44e6db[_0x97e6('0x2f')]:_0x3115bb['model'];if(_0x5e5889['query']['includeAll']){_0x44e6db[_0x97e6('0x3e')]=[{'all':!![]}];}_0x44e6db=_[_0x97e6('0x36')]({},_0x44e6db,_0x5e5889[_0x97e6('0x39')]);return db[_0x97e6('0x27')]['find'](_0x44e6db)[_0x97e6('0x20')](handleEntityNotFound(_0x268d26,null))[_0x97e6('0x20')](respondWithResult(_0x268d26,null))[_0x97e6('0x3d')](handleError(_0x268d26,null));};exports[_0x97e6('0x3f')]=function(_0x42d352,_0x5522ac){return db[_0x97e6('0x27')]['create'](_0x42d352[_0x97e6('0x40')],{})[_0x97e6('0x20')](respondWithResult(_0x5522ac,0xc9))[_0x97e6('0x3d')](handleError(_0x5522ac,null));};exports[_0x97e6('0x41')]=function(_0x47d89c,_0x66b956){if(_0x47d89c[_0x97e6('0x40')]['id']){delete _0x47d89c['body']['id'];}return db[_0x97e6('0x27')]['find']({'where':{'id':_0x47d89c[_0x97e6('0x42')]['id']}})[_0x97e6('0x20')](handleEntityNotFound(_0x66b956,null))[_0x97e6('0x20')](saveUpdates(_0x47d89c[_0x97e6('0x40')],null))[_0x97e6('0x20')](respondWithResult(_0x66b956,null))['catch'](handleError(_0x66b956,null));};exports[_0x97e6('0x43')]=function(_0x4d9474,_0x2d03c1){return db[_0x97e6('0x27')][_0x97e6('0x44')]({'where':{'id':_0x4d9474[_0x97e6('0x42')]['id']}})[_0x97e6('0x20')](handleEntityNotFound(_0x2d03c1,null))['then'](removeEntity(_0x2d03c1,null))[_0x97e6('0x3d')](handleError(_0x2d03c1,null));};exports[_0x97e6('0x45')]=function(_0x4cb038,_0x5c9083,_0x126bd0){var _0x443ae5={};var _0x51a452={};var _0x2be77d;var _0x3e2c4e;return db[_0x97e6('0x27')][_0x97e6('0x46')]({'where':{'id':_0x4cb038[_0x97e6('0x42')]['id']}})[_0x97e6('0x20')](handleEntityNotFound(_0x5c9083,null))[_0x97e6('0x20')](function(_0x4254a0){if(_0x4254a0){_0x2be77d=_0x4254a0;_0x51a452[_0x97e6('0x2a')]=_[_0x97e6('0x2c')](db[_0x97e6('0x47')][_0x97e6('0x48')]);_0x51a452[_0x97e6('0x2b')]=_[_0x97e6('0x2c')](_0x4cb038[_0x97e6('0x2b')]);_0x51a452[_0x97e6('0x2d')]=_['intersection'](_0x51a452[_0x97e6('0x2a')],_0x51a452[_0x97e6('0x2b')]);_0x443ae5[_0x97e6('0x2f')]=_[_0x97e6('0x2e')](_0x51a452['model'],qs[_0x97e6('0x30')](_0x4cb038[_0x97e6('0x2b')][_0x97e6('0x30')]));_0x443ae5[_0x97e6('0x2f')]=_0x443ae5['attributes'][_0x97e6('0x49')]?_0x443ae5[_0x97e6('0x2f')]:_0x51a452[_0x97e6('0x2a')];_0x443ae5[_0x97e6('0x4a')]=qs['sort'](_0x4cb038['query']['sort']);_0x443ae5[_0x97e6('0x37')]=qs[_0x97e6('0x2d')](_[_0x97e6('0x34')](_0x4cb038[_0x97e6('0x2b')],_0x51a452[_0x97e6('0x2d')]));if(_0x4cb038[_0x97e6('0x2b')]['filter']){_0x443ae5['where']=_['merge'](_0x443ae5['where'],{'$or':_[_0x97e6('0x26')](_0x443ae5[_0x97e6('0x2f')],function(_0x53d196){var _0x21a817={};_0x21a817[_0x53d196]={'$like':'%'+_0x4cb038[_0x97e6('0x2b')][_0x97e6('0x35')]+'%'};return _0x21a817;})});}_0x443ae5=_['merge']({},_0x443ae5,_0x4cb038[_0x97e6('0x39')]);return _0x2be77d[_0x97e6('0x45')](_0x443ae5);}})[_0x97e6('0x20')](function(_0x1da763){if(_0x1da763){_0x3e2c4e=_0x1da763[_0x97e6('0x49')];if(!_0x4cb038[_0x97e6('0x2b')][_0x97e6('0x31')](_0x97e6('0x4b'))){_0x443ae5[_0x97e6('0x32')]=qs[_0x97e6('0x32')](_0x4cb038['query'][_0x97e6('0x32')]);_0x443ae5[_0x97e6('0x1a')]=qs[_0x97e6('0x1a')](_0x4cb038['query'][_0x97e6('0x1a')]);}return _0x2be77d[_0x97e6('0x45')](_0x443ae5);}})[_0x97e6('0x20')](function(_0x77859){if(_0x77859){return _0x77859?{'count':_0x3e2c4e,'rows':_0x77859}:null;}})[_0x97e6('0x20')](respondWithResult(_0x5c9083,null))[_0x97e6('0x3d')](handleError(_0x5c9083,null));};exports['addConfiguration']=function(_0x5b8c93,_0x31dcfb,_0xe46e44){if(_0x5b8c93['body']['id']){delete _0x5b8c93['body']['id'];}return db[_0x97e6('0x27')][_0x97e6('0x46')]({'where':{'id':_0x5b8c93[_0x97e6('0x42')]['id']}})['then'](handleEntityNotFound(_0x31dcfb,null))[_0x97e6('0x20')](function(_0x34db2a){if(_0x34db2a){_0x5b8c93[_0x97e6('0x40')][_0x97e6('0x4c')]=_0x34db2a['id'];_0x5b8c93[_0x97e6('0x40')][_0x97e6('0x4d')]=integrations[_0x97e6('0x4e')](_0x5b8c93[_0x97e6('0x40')][_0x97e6('0x4f')],_0x5b8c93['body'][_0x97e6('0x29')]);_0x5b8c93['body']['Descriptions']=integrations[_0x97e6('0x50')](_0x5b8c93[_0x97e6('0x40')]['channel'],_0x5b8c93[_0x97e6('0x40')][_0x97e6('0x29')]);return db[_0x97e6('0x47')]['create'](_0x5b8c93['body'],{'include':[{'model':db[_0x97e6('0x51')],'as':_0x97e6('0x4d')},{'model':db[_0x97e6('0x51')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x31dcfb,null))['catch'](handleError(_0x31dcfb,null));};var md5=require('md5');exports[_0x97e6('0x52')]=function(_0x188cae,_0x644e7b,_0x235d8a){var _0xaab66b=null;var _0x3a5d69=null;var _0x23973f=null;var _0x1bde21=null;var _0x2f07a9='';return db['VtigerAccount'][_0x97e6('0x46')]({'where':{'id':_0x188cae[_0x97e6('0x42')]['id']},'attributes':['id',_0x97e6('0x23'),_0x97e6('0x53'),'description','moduleName',_0x97e6('0x54'),'serverUrl','accessKey']})[_0x97e6('0x20')](handleEntityNotFound(_0x644e7b,null))[_0x97e6('0x20')](function(_0x1c29a7){if(_0x1c29a7){_0xaab66b=_0x1c29a7[_0x97e6('0x53')];_0x3a5d69=_0x1c29a7[_0x97e6('0x55')];_0x23973f=_0x1c29a7['moduleName'];_0x2f07a9=_0x1c29a7[_0x97e6('0x54')];var _0x5db45c=_0x2f07a9[_0x97e6('0x56')](-0x1);if(_0x5db45c==='/'){_0x2f07a9=_0x2f07a9['substring'](0x0,_0x2f07a9[_0x97e6('0x57')](_0x5db45c));}_0x1bde21=util[_0x97e6('0x58')]('%s/webservice.php',_0x2f07a9);var _0x2ebab3={'method':_0x97e6('0x59'),'uri':_0x1bde21,'qs':{'operation':_0x97e6('0x5a'),'username':_0x1c29a7[_0x97e6('0x53')]},'json':!![]};return rp(_0x2ebab3);}})['then'](function(_0x471f99){if(_0x471f99[_0x97e6('0x5b')]){var _0x70e549={'method':_0x97e6('0x5c'),'uri':_0x1bde21,'form':{'operation':_0x97e6('0x5d'),'username':_0xaab66b,'accessKey':md5(_0x471f99[_0x97e6('0x5e')]['token']+_0x3a5d69)},'json':!![]};return rp(_0x70e549);}})['then'](function(_0x98da0d){if(_0x98da0d[_0x97e6('0x5b')]){var _0x28e557={'method':_0x97e6('0x59'),'uri':_0x1bde21,'qs':{'operation':_0x97e6('0x5f'),'username':_0xaab66b,'sessionName':_0x98da0d[_0x97e6('0x5e')][_0x97e6('0x60')],'elementType':_0x23973f},'json':!![]};return rp(_0x28e557);}})[_0x97e6('0x20')](function(_0x48b884){if(_0x48b884['success']){var _0xd97815=[_0x97e6('0x61'),_0x97e6('0x62'),'owner'];_[_0x97e6('0x63')](_0x48b884['result']['fields'],function(_0x453ed5){return _0xd97815[_0x97e6('0x64')](_0x453ed5[_0x97e6('0x29')][_0x97e6('0x23')]);});_['remove'](_0x48b884[_0x97e6('0x5e')][_0x97e6('0x30')],function(_0x5d5785){return _0x5d5785[_0x97e6('0x65')]===_0x97e6('0x66');});return{'count':_0x48b884[_0x97e6('0x5e')][_0x97e6('0x30')][_0x97e6('0x49')],'rows':_['map'](_0x48b884[_0x97e6('0x5e')][_0x97e6('0x30')],function(_0x1541fb){return{'id':_0x1541fb['name'],'name':_0x1541fb['label'],'custom':_[_0x97e6('0x67')](_0x1541fb[_0x97e6('0x23')],_0x97e6('0x68'))?!![]:![],'options':_0x1541fb[_0x97e6('0x29')]['name']===_0x97e6('0x69')&&_0x1541fb[_0x97e6('0x29')][_0x97e6('0x6a')]['length']>0x0?_[_0x97e6('0x26')](_0x1541fb['type']['picklistValues'],function(_0xaa1e07){return{'name':_0xaa1e07[_0x97e6('0x6b')],'value':_0xaa1e07[_0x97e6('0x6c')]};}):[]};})};}})[_0x97e6('0x20')](respondWithResult(_0x644e7b,null))[_0x97e6('0x3d')](function(_0x5dad34){console[_0x97e6('0x6d')]('vTiger\x20error:\x20'+_0x5dad34);var _0x38a4bc=_0x188cae[_0x97e6('0x2b')][_0x97e6('0x6e')]?0x1f4:_0x5dad34['statusCode']||0x1f4;logger[_0x97e6('0x6f')](_0x97e6('0x70'),'getFields',_0x38a4bc,JSON[_0x97e6('0x71')](_0x5dad34));delete _0x5dad34[_0x97e6('0x23')];if(_0x38a4bc===0x191){_0x38a4bc=0x190;}_0x644e7b['status'](_0x38a4bc)[_0x97e6('0x24')](_0x188cae['query']['test']?{'message':_0x97e6('0x72'),'statusCode':_0x5dad34[_0x97e6('0x73')]}:_0x5dad34);});}; \ No newline at end of file +var _0x9267=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','offset','set','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','sort','where','filter','merge','options','count','includeAll','include','catch','params','create','body','find','VtigerConfiguration','pick','getConfigurations','hasOwnProperty','nolimit','findOne','AccountId','Subjects','Descriptions','getDescriptions','channel','VtigerField','md5','description','serverUrl','username','moduleName','lastIndexOf','getchallenge','POST','login','token','GET','describe','result','sessionName','success','autogenerated','remove','includes','false','label','startsWith','cf_','picklist','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','fs-extra','lodash'];(function(_0x354478,_0x5a97ac){var _0x4a987d=function(_0xc74cc3){while(--_0xc74cc3){_0x354478['push'](_0x354478['shift']());}};_0x4a987d(++_0x5a97ac);}(_0x9267,0x147));var _0x7926=function(_0x39c8cc,_0x44a9c5){_0x39c8cc=_0x39c8cc-0x0;var _0x544d22=_0x9267[_0x39c8cc];return _0x544d22;};'use strict';var emlformat=require(_0x7926('0x0'));var rimraf=require(_0x7926('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7926('0x2'));var rp=require(_0x7926('0x3'));var moment=require(_0x7926('0x4'));var BPromise=require(_0x7926('0x5'));var Mustache=require('mustache');var util=require(_0x7926('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7926('0x7'));var _=require(_0x7926('0x8'));var squel=require(_0x7926('0x9'));var crypto=require(_0x7926('0xa'));var jsforce=require(_0x7926('0xb'));var deskjs=require(_0x7926('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7926('0xd'));var Redis=require(_0x7926('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7926('0xf'));var as=require(_0x7926('0x10'));var hardwareService=require(_0x7926('0x11'));var logger=require(_0x7926('0x12'))(_0x7926('0x13'));var utils=require(_0x7926('0x14'));var config=require(_0x7926('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7926('0x16'))['db'];var integrations=require(_0x7926('0x17'));function respondWithStatusCode(_0xa4b970,_0xd85e2b){_0xd85e2b=_0xd85e2b||0xcc;return function(_0x504b07){if(_0x504b07){return _0xa4b970['sendStatus'](_0xd85e2b);}return _0xa4b970[_0x7926('0x18')](_0xd85e2b)['end']();};}function respondWithResult(_0x206f9e,_0x452cfc){_0x452cfc=_0x452cfc||0xc8;return function(_0x109713){if(_0x109713){return _0x206f9e[_0x7926('0x18')](_0x452cfc)[_0x7926('0x19')](_0x109713);}};}function respondWithFilteredResult(_0x367621,_0x43b4b6){return function(_0x28ffd8){if(_0x28ffd8){var _0xe57d4b=typeof _0x43b4b6['offset']===_0x7926('0x1a')&&typeof _0x43b4b6[_0x7926('0x1b')]===_0x7926('0x1a');var _0x372b15=_0x28ffd8['count'];var _0x3b3ccc=_0xe57d4b?0x0:_0x43b4b6[_0x7926('0x1c')];var _0x1ea3be=_0xe57d4b?_0x28ffd8['count']:_0x43b4b6[_0x7926('0x1c')]+_0x43b4b6[_0x7926('0x1b')];var _0x325586;if(_0x1ea3be>=_0x372b15){_0x1ea3be=_0x372b15;_0x325586=0xc8;}else{_0x325586=0xce;}_0x367621[_0x7926('0x18')](_0x325586);return _0x367621[_0x7926('0x1d')](_0x7926('0x1e'),_0x3b3ccc+'-'+_0x1ea3be+'/'+_0x372b15)[_0x7926('0x19')](_0x28ffd8);}return null;};}function patchUpdates(_0x5f4f7d){return function(_0x167548){try{jsonpatch['apply'](_0x167548,_0x5f4f7d,!![]);}catch(_0xf5f188){return BPromise[_0x7926('0x1f')](_0xf5f188);}return _0x167548[_0x7926('0x20')]();};}function saveUpdates(_0x1873bb,_0x35800d){return function(_0x40e98c){if(_0x40e98c){return _0x40e98c[_0x7926('0x21')](_0x1873bb)['then'](function(_0x2624bc){return _0x2624bc;});}return null;};}function removeEntity(_0x59ae43,_0x1917eb){return function(_0x1df9de){if(_0x1df9de){return _0x1df9de[_0x7926('0x22')]()[_0x7926('0x23')](function(){_0x59ae43[_0x7926('0x18')](0xcc)[_0x7926('0x24')]();});}};}function handleEntityNotFound(_0x1e340d,_0x32fc63){return function(_0x1352e8){if(!_0x1352e8){_0x1e340d['sendStatus'](0x194);}return _0x1352e8;};}function handleError(_0x19698f,_0x275457){_0x275457=_0x275457||0x1f4;return function(_0x1f5273){logger[_0x7926('0x25')](_0x1f5273[_0x7926('0x26')]);if(_0x1f5273[_0x7926('0x27')]){delete _0x1f5273['name'];}_0x19698f[_0x7926('0x18')](_0x275457)[_0x7926('0x28')](_0x1f5273);};}exports[_0x7926('0x29')]=function(_0x4289f8,_0x416388){var _0x4f278c={},_0x198707={},_0x30ace4={'count':0x0,'rows':[]};var _0x182d97=_[_0x7926('0x2a')](db[_0x7926('0x2b')][_0x7926('0x2c')],function(_0x3f4757){return{'name':_0x3f4757[_0x7926('0x2d')],'type':_0x3f4757[_0x7926('0x2e')][_0x7926('0x2f')]};});_0x198707['model']=_['map'](_0x182d97,'name');_0x198707[_0x7926('0x30')]=_[_0x7926('0x31')](_0x4289f8[_0x7926('0x30')]);_0x198707[_0x7926('0x32')]=_['intersection'](_0x198707[_0x7926('0x33')],_0x198707[_0x7926('0x30')]);_0x4f278c['attributes']=_[_0x7926('0x34')](_0x198707[_0x7926('0x33')],qs[_0x7926('0x35')](_0x4289f8[_0x7926('0x30')][_0x7926('0x35')]));_0x4f278c[_0x7926('0x36')]=_0x4f278c[_0x7926('0x36')][_0x7926('0x37')]?_0x4f278c[_0x7926('0x36')]:_0x198707['model'];if(!_0x4289f8[_0x7926('0x30')]['hasOwnProperty']('nolimit')){_0x4f278c['limit']=qs[_0x7926('0x1b')](_0x4289f8[_0x7926('0x30')][_0x7926('0x1b')]);_0x4f278c[_0x7926('0x1c')]=qs[_0x7926('0x1c')](_0x4289f8['query'][_0x7926('0x1c')]);}_0x4f278c['order']=qs[_0x7926('0x38')](_0x4289f8['query'][_0x7926('0x38')]);_0x4f278c[_0x7926('0x39')]=qs['filters'](_['pick'](_0x4289f8[_0x7926('0x30')],_0x198707[_0x7926('0x32')]),_0x182d97);if(_0x4289f8[_0x7926('0x30')][_0x7926('0x3a')]){_0x4f278c[_0x7926('0x39')]=_[_0x7926('0x3b')](_0x4f278c[_0x7926('0x39')],{'$or':_[_0x7926('0x2a')](_0x182d97,function(_0x57f78a){if(_0x57f78a['type']!=='VIRTUAL'){var _0x41d33d={};_0x41d33d[_0x57f78a[_0x7926('0x27')]]={'$like':'%'+_0x4289f8[_0x7926('0x30')]['filter']+'%'};return _0x41d33d;}})});}_0x4f278c=_['merge']({},_0x4f278c,_0x4289f8[_0x7926('0x3c')]);var _0x3c4591={'where':_0x4f278c[_0x7926('0x39')]};return db[_0x7926('0x2b')][_0x7926('0x3d')](_0x3c4591)[_0x7926('0x23')](function(_0x1edefd){_0x30ace4[_0x7926('0x3d')]=_0x1edefd;if(_0x4289f8[_0x7926('0x30')][_0x7926('0x3e')]){_0x4f278c[_0x7926('0x3f')]=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x4f278c);})[_0x7926('0x23')](function(_0x3d812b){_0x30ace4['rows']=_0x3d812b;return _0x30ace4;})[_0x7926('0x23')](respondWithFilteredResult(_0x416388,_0x4f278c))[_0x7926('0x40')](handleError(_0x416388,null));};exports['show']=function(_0x4799d3,_0x460e89){var _0x3ceba9={'raw':![],'where':{'id':_0x4799d3[_0x7926('0x41')]['id']}},_0x1f2d25={};_0x1f2d25['model']=_['keys'](db['VtigerAccount'][_0x7926('0x2c')]);_0x1f2d25['query']=_['keys'](_0x4799d3['query']);_0x1f2d25['filters']=_[_0x7926('0x34')](_0x1f2d25[_0x7926('0x33')],_0x1f2d25[_0x7926('0x30')]);_0x3ceba9[_0x7926('0x36')]=_['intersection'](_0x1f2d25[_0x7926('0x33')],qs['fields'](_0x4799d3['query'][_0x7926('0x35')]));_0x3ceba9[_0x7926('0x36')]=_0x3ceba9[_0x7926('0x36')][_0x7926('0x37')]?_0x3ceba9['attributes']:_0x1f2d25['model'];if(_0x4799d3[_0x7926('0x30')][_0x7926('0x3e')]){_0x3ceba9['include']=[{'all':!![]}];}_0x3ceba9=_[_0x7926('0x3b')]({},_0x3ceba9,_0x4799d3[_0x7926('0x3c')]);return db[_0x7926('0x2b')]['find'](_0x3ceba9)['then'](handleEntityNotFound(_0x460e89,null))[_0x7926('0x23')](respondWithResult(_0x460e89,null))[_0x7926('0x40')](handleError(_0x460e89,null));};exports[_0x7926('0x42')]=function(_0x121a4c,_0x53e501){return db[_0x7926('0x2b')][_0x7926('0x42')](_0x121a4c['body'],{})['then'](respondWithResult(_0x53e501,0xc9))[_0x7926('0x40')](handleError(_0x53e501,null));};exports['update']=function(_0x2d8094,_0xabafb0){if(_0x2d8094[_0x7926('0x43')]['id']){delete _0x2d8094[_0x7926('0x43')]['id'];}return db[_0x7926('0x2b')][_0x7926('0x44')]({'where':{'id':_0x2d8094[_0x7926('0x41')]['id']}})['then'](handleEntityNotFound(_0xabafb0,null))[_0x7926('0x23')](saveUpdates(_0x2d8094['body'],null))[_0x7926('0x23')](respondWithResult(_0xabafb0,null))[_0x7926('0x40')](handleError(_0xabafb0,null));};exports['destroy']=function(_0x56b88c,_0x438e06){return db[_0x7926('0x2b')]['find']({'where':{'id':_0x56b88c[_0x7926('0x41')]['id']}})[_0x7926('0x23')](handleEntityNotFound(_0x438e06,null))[_0x7926('0x23')](removeEntity(_0x438e06,null))['catch'](handleError(_0x438e06,null));};exports['getConfigurations']=function(_0x15c72c,_0x367bc5,_0x4f4cb6){var _0x2e24d8={};var _0x5bdc28={};var _0x263fcf;var _0x131f78;return db[_0x7926('0x2b')]['findOne']({'where':{'id':_0x15c72c[_0x7926('0x41')]['id']}})[_0x7926('0x23')](handleEntityNotFound(_0x367bc5,null))[_0x7926('0x23')](function(_0x4d57bc){if(_0x4d57bc){_0x263fcf=_0x4d57bc;_0x5bdc28[_0x7926('0x33')]=_['keys'](db[_0x7926('0x45')][_0x7926('0x2c')]);_0x5bdc28['query']=_[_0x7926('0x31')](_0x15c72c[_0x7926('0x30')]);_0x5bdc28[_0x7926('0x32')]=_[_0x7926('0x34')](_0x5bdc28[_0x7926('0x33')],_0x5bdc28['query']);_0x2e24d8[_0x7926('0x36')]=_[_0x7926('0x34')](_0x5bdc28[_0x7926('0x33')],qs[_0x7926('0x35')](_0x15c72c['query'][_0x7926('0x35')]));_0x2e24d8[_0x7926('0x36')]=_0x2e24d8[_0x7926('0x36')][_0x7926('0x37')]?_0x2e24d8['attributes']:_0x5bdc28[_0x7926('0x33')];_0x2e24d8['order']=qs[_0x7926('0x38')](_0x15c72c['query'][_0x7926('0x38')]);_0x2e24d8['where']=qs[_0x7926('0x32')](_[_0x7926('0x46')](_0x15c72c[_0x7926('0x30')],_0x5bdc28['filters']));if(_0x15c72c[_0x7926('0x30')][_0x7926('0x3a')]){_0x2e24d8[_0x7926('0x39')]=_[_0x7926('0x3b')](_0x2e24d8[_0x7926('0x39')],{'$or':_[_0x7926('0x2a')](_0x2e24d8[_0x7926('0x36')],function(_0x48b500){var _0x33f790={};_0x33f790[_0x48b500]={'$like':'%'+_0x15c72c[_0x7926('0x30')][_0x7926('0x3a')]+'%'};return _0x33f790;})});}_0x2e24d8=_[_0x7926('0x3b')]({},_0x2e24d8,_0x15c72c[_0x7926('0x3c')]);return _0x263fcf[_0x7926('0x47')](_0x2e24d8);}})[_0x7926('0x23')](function(_0x443f01){if(_0x443f01){_0x131f78=_0x443f01[_0x7926('0x37')];if(!_0x15c72c[_0x7926('0x30')][_0x7926('0x48')](_0x7926('0x49'))){_0x2e24d8[_0x7926('0x1b')]=qs[_0x7926('0x1b')](_0x15c72c[_0x7926('0x30')][_0x7926('0x1b')]);_0x2e24d8[_0x7926('0x1c')]=qs['offset'](_0x15c72c['query'][_0x7926('0x1c')]);}return _0x263fcf['getConfigurations'](_0x2e24d8);}})[_0x7926('0x23')](function(_0x1aa28c){if(_0x1aa28c){return _0x1aa28c?{'count':_0x131f78,'rows':_0x1aa28c}:null;}})[_0x7926('0x23')](respondWithResult(_0x367bc5,null))[_0x7926('0x40')](handleError(_0x367bc5,null));};exports['addConfiguration']=function(_0x4837a2,_0x560c72,_0x3a159c){if(_0x4837a2[_0x7926('0x43')]['id']){delete _0x4837a2[_0x7926('0x43')]['id'];}return db['VtigerAccount'][_0x7926('0x4a')]({'where':{'id':_0x4837a2[_0x7926('0x41')]['id']}})[_0x7926('0x23')](handleEntityNotFound(_0x560c72,null))[_0x7926('0x23')](function(_0x3a925c){if(_0x3a925c){_0x4837a2[_0x7926('0x43')][_0x7926('0x4b')]=_0x3a925c['id'];_0x4837a2[_0x7926('0x43')][_0x7926('0x4c')]=integrations['getSubjects'](_0x4837a2[_0x7926('0x43')]['channel'],_0x4837a2[_0x7926('0x43')][_0x7926('0x2e')]);_0x4837a2[_0x7926('0x43')][_0x7926('0x4d')]=integrations[_0x7926('0x4e')](_0x4837a2[_0x7926('0x43')][_0x7926('0x4f')],_0x4837a2[_0x7926('0x43')]['type']);return db[_0x7926('0x45')][_0x7926('0x42')](_0x4837a2[_0x7926('0x43')],{'include':[{'model':db[_0x7926('0x50')],'as':'Subjects'},{'model':db[_0x7926('0x50')],'as':_0x7926('0x4d')}]});}return null;})[_0x7926('0x23')](respondWithResult(_0x560c72,null))[_0x7926('0x40')](handleError(_0x560c72,null));};var md5=require(_0x7926('0x51'));exports['getFields']=function(_0x59cca8,_0x72eb4b,_0x1a3a64){var _0x29eb22=null;var _0x379c17=null;var _0x4b1668=null;var _0x5463a6=null;var _0x3c812d='';return db[_0x7926('0x2b')][_0x7926('0x4a')]({'where':{'id':_0x59cca8[_0x7926('0x41')]['id']},'attributes':['id',_0x7926('0x27'),'username',_0x7926('0x52'),'moduleName','remoteUri',_0x7926('0x53'),'accessKey']})[_0x7926('0x23')](handleEntityNotFound(_0x72eb4b,null))[_0x7926('0x23')](function(_0x2b834d){if(_0x2b834d){_0x29eb22=_0x2b834d[_0x7926('0x54')];_0x379c17=_0x2b834d['accessKey'];_0x4b1668=_0x2b834d[_0x7926('0x55')];_0x3c812d=_0x2b834d['remoteUri'];var _0x2bed42=_0x3c812d['slice'](-0x1);if(_0x2bed42==='/'){_0x3c812d=_0x3c812d['substring'](0x0,_0x3c812d[_0x7926('0x56')](_0x2bed42));}_0x5463a6=util['format']('%s/webservice.php',_0x3c812d);var _0x59c921={'method':'GET','uri':_0x5463a6,'qs':{'operation':_0x7926('0x57'),'username':_0x2b834d[_0x7926('0x54')]},'json':!![]};return rp(_0x59c921);}})[_0x7926('0x23')](function(_0x19c968){if(_0x19c968['success']){var _0x3cad2c={'method':_0x7926('0x58'),'uri':_0x5463a6,'form':{'operation':_0x7926('0x59'),'username':_0x29eb22,'accessKey':md5(_0x19c968['result'][_0x7926('0x5a')]+_0x379c17)},'json':!![]};return rp(_0x3cad2c);}})[_0x7926('0x23')](function(_0x2406d4){if(_0x2406d4['success']){var _0x260866={'method':_0x7926('0x5b'),'uri':_0x5463a6,'qs':{'operation':_0x7926('0x5c'),'username':_0x29eb22,'sessionName':_0x2406d4[_0x7926('0x5d')][_0x7926('0x5e')],'elementType':_0x4b1668},'json':!![]};return rp(_0x260866);}})['then'](function(_0x3d7f90){if(_0x3d7f90[_0x7926('0x5f')]){var _0x41d998=[_0x7926('0x60'),'reference','owner'];_[_0x7926('0x61')](_0x3d7f90[_0x7926('0x5d')]['fields'],function(_0x11286d){return _0x41d998[_0x7926('0x62')](_0x11286d[_0x7926('0x2e')]['name']);});_[_0x7926('0x61')](_0x3d7f90[_0x7926('0x5d')][_0x7926('0x35')],function(_0x5609f4){return _0x5609f4['editable']===_0x7926('0x63');});return{'count':_0x3d7f90[_0x7926('0x5d')]['fields'][_0x7926('0x37')],'rows':_[_0x7926('0x2a')](_0x3d7f90['result'][_0x7926('0x35')],function(_0x49319e){return{'id':_0x49319e[_0x7926('0x27')],'name':_0x49319e[_0x7926('0x64')],'custom':_[_0x7926('0x65')](_0x49319e[_0x7926('0x27')],_0x7926('0x66'))?!![]:![],'options':_0x49319e[_0x7926('0x2e')][_0x7926('0x27')]===_0x7926('0x67')&&_0x49319e[_0x7926('0x2e')]['picklistValues'][_0x7926('0x37')]>0x0?_[_0x7926('0x2a')](_0x49319e[_0x7926('0x2e')]['picklistValues'],function(_0x3570a6){return{'name':_0x3570a6[_0x7926('0x64')],'value':_0x3570a6[_0x7926('0x68')]};}):[]};})};}})['then'](respondWithResult(_0x72eb4b,null))[_0x7926('0x40')](function(_0x578931){console[_0x7926('0x69')](_0x7926('0x6a')+_0x578931);var _0x25a804=_0x59cca8[_0x7926('0x30')][_0x7926('0x6b')]?0x1f4:_0x578931[_0x7926('0x6c')]||0x1f4;logger[_0x7926('0x25')](_0x7926('0x6d'),_0x7926('0x6e'),_0x25a804,JSON['stringify'](_0x578931));delete _0x578931[_0x7926('0x27')];if(_0x25a804===0x191){_0x25a804=0x190;}_0x72eb4b['status'](_0x25a804)['send'](_0x59cca8[_0x7926('0x30')][_0x7926('0x6b')]?{'message':_0x7926('0x6f'),'statusCode':_0x578931[_0x7926('0x6c')]}:_0x578931);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index ff44e98..101d345 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 _0x7a48=['define','VtigerAccount','int_vtiger_accounts','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x3302fd,_0x1806ce){var _0x3ff47c=function(_0x2b66e8){while(--_0x2b66e8){_0x3302fd['push'](_0x3302fd['shift']());}};_0x3ff47c(++_0x1806ce);}(_0x7a48,0x116));var _0x87a4=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x7a48[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x87a4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x87a4('0x1'));var moment=require(_0x87a4('0x2'));var BPromise=require(_0x87a4('0x3'));var rp=require(_0x87a4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x87a4('0x5'));var config=require(_0x87a4('0x6'));var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x87a4('0x7')]=function(_0x548389,_0x187227){return _0x548389[_0x87a4('0x8')](_0x87a4('0x9'),attributes,{'tableName':_0x87a4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11e3=['VtigerAccount','int_vtiger_accounts','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x548bf3,_0x4fd148){var _0x424c95=function(_0xad955d){while(--_0xad955d){_0x548bf3['push'](_0x548bf3['shift']());}};_0x424c95(++_0x4fd148);}(_0x11e3,0x113));var _0x311e=function(_0xb1182d,_0x4a281d){_0xb1182d=_0xb1182d-0x0;var _0x51cf23=_0x11e3[_0xb1182d];return _0x51cf23;};'use strict';var _=require('lodash');var util=require(_0x311e('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x311e('0x1'));var BPromise=require(_0x311e('0x2'));var rp=require(_0x311e('0x3'));var fs=require('fs');var path=require(_0x311e('0x4'));var rimraf=require(_0x311e('0x5'));var config=require(_0x311e('0x6'));var attributes=require(_0x311e('0x7'));var integrations=require(_0x311e('0x8'));module[_0x311e('0x9')]=function(_0x3dc5e7,_0xc319f6){return _0x3dc5e7[_0x311e('0xa')](_0x311e('0xb'),attributes,{'tableName':_0x311e('0xc'),'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 f1d86e0..dc42c64 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 _0x351d=['findAll','options','attributes','include','map','model','then','catch','ShowVtigerAccount','find','raw','where','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','GetVtigerAccount','VtigerAccount'];(function(_0x4b4b54,_0x3db473){var _0x3fe50b=function(_0x1d8fe1){while(--_0x1d8fe1){_0x4b4b54['push'](_0x4b4b54['shift']());}};_0x3fe50b(++_0x3db473);}(_0x351d,0x90));var _0xd351=function(_0x5062ba,_0x4261d3){_0x5062ba=_0x5062ba-0x0;var _0x10e626=_0x351d[_0x5062ba];return _0x10e626;};'use strict';var _=require(_0xd351('0x0'));var util=require('util');var moment=require(_0xd351('0x1'));var BPromise=require(_0xd351('0x2'));var rs=require(_0xd351('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd351('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd351('0x5'))(_0xd351('0x6'));var config=require('../../config/environment');var jayson=require(_0xd351('0x7'));var client=jayson[_0xd351('0x8')][_0xd351('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5318b2,_0x16b3f7,_0x235aa0){return new BPromise(function(_0x4e1b06,_0x2e9a2a){return client[_0xd351('0xa')](_0x5318b2,_0x235aa0)['then'](function(_0x586c60){logger[_0xd351('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x16b3f7,_0xd351('0xc'));logger[_0xd351('0xd')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x16b3f7,_0xd351('0xc'),JSON[_0xd351('0xe')](_0x586c60));if(_0x586c60['error']){if(_0x586c60[_0xd351('0xf')]['code']===0x1f4){logger['error'](_0xd351('0x10'),_0x16b3f7,_0x586c60[_0xd351('0xf')][_0xd351('0x11')]);return _0x2e9a2a(_0x586c60[_0xd351('0xf')]['message']);}logger[_0xd351('0xf')](_0xd351('0x10'),_0x16b3f7,_0x586c60['error'][_0xd351('0x11')]);return _0x4e1b06(_0x586c60[_0xd351('0xf')][_0xd351('0x11')]);}else{logger[_0xd351('0xb')](_0xd351('0x10'),_0x16b3f7,'request\x20sent');_0x4e1b06(_0x586c60[_0xd351('0x12')]['message']);}})['catch'](function(_0x2c6708){logger['error'](_0xd351('0x10'),_0x16b3f7,_0x2c6708);_0x2e9a2a(_0x2c6708);});});}exports[_0xd351('0x13')]=function(_0x4e0164){var _0x4c6693=this;return new Promise(function(_0x1e1a3c,_0x2bfc53){return db[_0xd351('0x14')][_0xd351('0x15')]({'raw':_0x4e0164['options']?_0x4e0164[_0xd351('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4e0164['options']?_0x4e0164[_0xd351('0x16')]['where']||null:null,'attributes':_0x4e0164[_0xd351('0x16')]?_0x4e0164[_0xd351('0x16')][_0xd351('0x17')]||null:null,'limit':_0x4e0164[_0xd351('0x16')]?_0x4e0164[_0xd351('0x16')]['limit']||null:null,'include':_0x4e0164[_0xd351('0x16')]?_0x4e0164[_0xd351('0x16')][_0xd351('0x18')]?_['map'](_0x4e0164[_0xd351('0x16')][_0xd351('0x18')],function(_0x365bbc){return{'model':db[_0x365bbc['model']],'as':_0x365bbc['as'],'attributes':_0x365bbc[_0xd351('0x17')],'include':_0x365bbc[_0xd351('0x18')]?_[_0xd351('0x19')](_0x365bbc[_0xd351('0x18')],function(_0x489c9a){return{'model':db[_0x489c9a[_0xd351('0x1a')]],'as':_0x489c9a['as'],'attributes':_0x489c9a['attributes'],'include':_0x489c9a[_0xd351('0x18')]?_[_0xd351('0x19')](_0x489c9a['include'],function(_0x2648d0){return{'model':db[_0x2648d0['model']],'as':_0x2648d0['as'],'attributes':_0x2648d0['attributes']};}):[]};}):[]};}):[]:[]})[_0xd351('0x1b')](function(_0x560be9){logger['info'](_0xd351('0x13'),_0x4e0164);logger['debug'](_0xd351('0x13'),_0x4e0164,JSON[_0xd351('0xe')](_0x560be9));_0x1e1a3c(_0x560be9);})[_0xd351('0x1c')](function(_0x4d3f48){logger[_0xd351('0xf')]('GetVtigerAccount',_0x4d3f48[_0xd351('0x11')],_0x4e0164);_0x2bfc53(_0x4c6693['error'](0x1f4,_0x4d3f48['message']));});});};exports[_0xd351('0x1d')]=function(_0x38c82f){var _0x3f9ef3=this;return new Promise(function(_0x33b43d,_0x48aa96){return db[_0xd351('0x14')][_0xd351('0x1e')]({'raw':_0x38c82f[_0xd351('0x16')]?_0x38c82f[_0xd351('0x16')][_0xd351('0x1f')]===undefined?!![]:![]:!![],'where':_0x38c82f[_0xd351('0x16')]?_0x38c82f[_0xd351('0x16')][_0xd351('0x20')]||null:null,'attributes':_0x38c82f[_0xd351('0x16')]?_0x38c82f['options'][_0xd351('0x17')]||null:null,'include':_0x38c82f[_0xd351('0x16')]?_0x38c82f[_0xd351('0x16')][_0xd351('0x18')]?_['map'](_0x38c82f[_0xd351('0x16')][_0xd351('0x18')],function(_0x3d5b7f){return{'model':db[_0x3d5b7f[_0xd351('0x1a')]],'as':_0x3d5b7f['as'],'attributes':_0x3d5b7f[_0xd351('0x17')],'include':_0x3d5b7f[_0xd351('0x18')]?_[_0xd351('0x19')](_0x3d5b7f[_0xd351('0x18')],function(_0x238663){return{'model':db[_0x238663['model']],'as':_0x238663['as'],'attributes':_0x238663['attributes'],'include':_0x238663[_0xd351('0x18')]?_[_0xd351('0x19')](_0x238663[_0xd351('0x18')],function(_0x2907b7){return{'model':db[_0x2907b7[_0xd351('0x1a')]],'as':_0x2907b7['as'],'attributes':_0x2907b7[_0xd351('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47e2fa){logger[_0xd351('0xb')]('ShowVtigerAccount',_0x38c82f);logger[_0xd351('0xd')](_0xd351('0x1d'),_0x38c82f,JSON[_0xd351('0xe')](_0x47e2fa));_0x33b43d(_0x47e2fa);})[_0xd351('0x1c')](function(_0x33307){logger[_0xd351('0xf')](_0xd351('0x1d'),_0x33307[_0xd351('0x11')],_0x38c82f);_0x48aa96(_0x3f9ef3[_0xd351('0xf')](0x1f4,_0x33307[_0xd351('0x11')]));});});}; \ No newline at end of file +var _0x91a7=['VtigerAccount,\x20%s,\x20%s','catch','GetVtigerAccount','options','raw','where','attributes','limit','include','map','model','ShowVtigerAccount','VtigerAccount','find','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','message'];(function(_0x1e2772,_0x5713f1){var _0x356a55=function(_0x3a37b0){while(--_0x3a37b0){_0x1e2772['push'](_0x1e2772['shift']());}};_0x356a55(++_0x5713f1);}(_0x91a7,0xe7));var _0x791a=function(_0x5b3c13,_0x49c8f9){_0x5b3c13=_0x5b3c13-0x0;var _0x5a263b=_0x91a7[_0x5b3c13];return _0x5a263b;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var moment=require(_0x791a('0x1'));var BPromise=require(_0x791a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x791a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x791a('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x791a('0x5'));var jayson=require(_0x791a('0x6'));var client=jayson['client'][_0x791a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5db6db,_0x33baac,_0x159e24){return new BPromise(function(_0x5aa10a,_0x1a32b4){return client[_0x791a('0x8')](_0x5db6db,_0x159e24)[_0x791a('0x9')](function(_0x80ff65){logger[_0x791a('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));logger[_0x791a('0xc')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'),JSON[_0x791a('0xd')](_0x80ff65));if(_0x80ff65[_0x791a('0xe')]){if(_0x80ff65[_0x791a('0xe')][_0x791a('0xf')]===0x1f4){logger[_0x791a('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x1a32b4(_0x80ff65[_0x791a('0xe')]['message']);}logger[_0x791a('0xe')](_0x791a('0x11'),_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x5aa10a(_0x80ff65[_0x791a('0xe')][_0x791a('0x10')]);}else{logger[_0x791a('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));_0x5aa10a(_0x80ff65['result'][_0x791a('0x10')]);}})[_0x791a('0x12')](function(_0x49ae3e){logger[_0x791a('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x33baac,_0x49ae3e);_0x1a32b4(_0x49ae3e);});});}exports[_0x791a('0x13')]=function(_0x52941d){var _0x4a84ee=this;return new Promise(function(_0x588d00,_0x40f0d3){return db['VtigerAccount']['findAll']({'raw':_0x52941d[_0x791a('0x14')]?_0x52941d[_0x791a('0x14')][_0x791a('0x15')]===undefined?!![]:![]:!![],'where':_0x52941d[_0x791a('0x14')]?_0x52941d['options'][_0x791a('0x16')]||null:null,'attributes':_0x52941d[_0x791a('0x14')]?_0x52941d[_0x791a('0x14')][_0x791a('0x17')]||null:null,'limit':_0x52941d['options']?_0x52941d[_0x791a('0x14')][_0x791a('0x18')]||null:null,'include':_0x52941d[_0x791a('0x14')]?_0x52941d[_0x791a('0x14')][_0x791a('0x19')]?_[_0x791a('0x1a')](_0x52941d[_0x791a('0x14')][_0x791a('0x19')],function(_0x323c6a){return{'model':db[_0x323c6a[_0x791a('0x1b')]],'as':_0x323c6a['as'],'attributes':_0x323c6a[_0x791a('0x17')],'include':_0x323c6a['include']?_[_0x791a('0x1a')](_0x323c6a[_0x791a('0x19')],function(_0x380329){return{'model':db[_0x380329[_0x791a('0x1b')]],'as':_0x380329['as'],'attributes':_0x380329['attributes'],'include':_0x380329[_0x791a('0x19')]?_[_0x791a('0x1a')](_0x380329['include'],function(_0xdfa84f){return{'model':db[_0xdfa84f[_0x791a('0x1b')]],'as':_0xdfa84f['as'],'attributes':_0xdfa84f[_0x791a('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29194d){logger[_0x791a('0xa')](_0x791a('0x13'),_0x52941d);logger[_0x791a('0xc')](_0x791a('0x13'),_0x52941d,JSON[_0x791a('0xd')](_0x29194d));_0x588d00(_0x29194d);})[_0x791a('0x12')](function(_0x889534){logger['error'](_0x791a('0x13'),_0x889534[_0x791a('0x10')],_0x52941d);_0x40f0d3(_0x4a84ee[_0x791a('0xe')](0x1f4,_0x889534['message']));});});};exports[_0x791a('0x1c')]=function(_0x5df656){var _0xc59f5e=this;return new Promise(function(_0x2e4ec8,_0xcde862){return db[_0x791a('0x1d')][_0x791a('0x1e')]({'raw':_0x5df656[_0x791a('0x14')]?_0x5df656[_0x791a('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x5df656[_0x791a('0x14')]?_0x5df656[_0x791a('0x14')][_0x791a('0x16')]||null:null,'attributes':_0x5df656[_0x791a('0x14')]?_0x5df656[_0x791a('0x14')]['attributes']||null:null,'include':_0x5df656[_0x791a('0x14')]?_0x5df656[_0x791a('0x14')][_0x791a('0x19')]?_[_0x791a('0x1a')](_0x5df656[_0x791a('0x14')]['include'],function(_0x305836){return{'model':db[_0x305836[_0x791a('0x1b')]],'as':_0x305836['as'],'attributes':_0x305836[_0x791a('0x17')],'include':_0x305836[_0x791a('0x19')]?_[_0x791a('0x1a')](_0x305836['include'],function(_0xd5609){return{'model':db[_0xd5609['model']],'as':_0xd5609['as'],'attributes':_0xd5609[_0x791a('0x17')],'include':_0xd5609['include']?_['map'](_0xd5609[_0x791a('0x19')],function(_0x404530){return{'model':db[_0x404530[_0x791a('0x1b')]],'as':_0x404530['as'],'attributes':_0x404530[_0x791a('0x17')]};}):[]};}):[]};}):[]:[]})[_0x791a('0x9')](function(_0x3f46be){logger[_0x791a('0xa')]('ShowVtigerAccount',_0x5df656);logger[_0x791a('0xc')]('ShowVtigerAccount',_0x5df656,JSON[_0x791a('0xd')](_0x3f46be));_0x2e4ec8(_0x3f46be);})['catch'](function(_0x25e8cc){logger[_0x791a('0xe')]('ShowVtigerAccount',_0x25e8cc[_0x791a('0x10')],_0x5df656);_0xcde862(_0xc59f5e[_0x791a('0xe')](0x1f4,_0x25e8cc['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 1331746..25c9b5a 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 _0x13c0=['/:id/fields','getDescriptions','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x143d8e,_0x228710){var _0x57b6d7=function(_0x338db6){while(--_0x338db6){_0x143d8e['push'](_0x143d8e['shift']());}};_0x57b6d7(++_0x228710);}(_0x13c0,0x16d));var _0x013c=function(_0x5c08cb,_0x456960){_0x5c08cb=_0x5c08cb-0x0;var _0x147907=_0x13c0[_0x5c08cb];return _0x147907;};'use strict';var multer=require(_0x013c('0x0'));var util=require('util');var path=require(_0x013c('0x1'));var timeout=require(_0x013c('0x2'));var express=require(_0x013c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x013c('0x4'));var interaction=require(_0x013c('0x5'));var config=require(_0x013c('0x6'));var controller=require(_0x013c('0x7'));router[_0x013c('0x8')]('/',auth[_0x013c('0x9')](),controller[_0x013c('0xa')]);router[_0x013c('0x8')](_0x013c('0xb'),auth[_0x013c('0x9')](),controller[_0x013c('0xc')]);router[_0x013c('0x8')](_0x013c('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x013c('0x8')]('/:id/subjects',auth[_0x013c('0x9')](),controller['getSubjects']);router[_0x013c('0x8')]('/:id/descriptions',auth[_0x013c('0x9')](),controller[_0x013c('0xe')]);router[_0x013c('0xf')]('/',auth[_0x013c('0x9')](),controller[_0x013c('0x10')]);router[_0x013c('0x11')](_0x013c('0xb'),auth[_0x013c('0x9')](),controller[_0x013c('0x12')]);router['delete'](_0x013c('0xb'),auth[_0x013c('0x9')](),controller[_0x013c('0x13')]);module[_0x013c('0x14')]=router; \ No newline at end of file +var _0xcb7f=['/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','get'];(function(_0x5a7d41,_0x4447e2){var _0x98d8fa=function(_0x2ce1cf){while(--_0x2ce1cf){_0x5a7d41['push'](_0x5a7d41['shift']());}};_0x98d8fa(++_0x4447e2);}(_0xcb7f,0x187));var _0xfcb7=function(_0x4f7cbe,_0x1611f5){_0x4f7cbe=_0x4f7cbe-0x0;var _0x48a6c9=_0xcb7f[_0x4f7cbe];return _0x48a6c9;};'use strict';var multer=require(_0xfcb7('0x0'));var util=require(_0xfcb7('0x1'));var path=require(_0xfcb7('0x2'));var timeout=require(_0xfcb7('0x3'));var express=require(_0xfcb7('0x4'));var router=express[_0xfcb7('0x5')]();var fs_extra=require(_0xfcb7('0x6'));var auth=require(_0xfcb7('0x7'));var interaction=require(_0xfcb7('0x8'));var config=require(_0xfcb7('0x9'));var controller=require(_0xfcb7('0xa'));router['get']('/',auth[_0xfcb7('0xb')](),controller[_0xfcb7('0xc')]);router[_0xfcb7('0xd')](_0xfcb7('0xe'),auth[_0xfcb7('0xb')](),controller['show']);router[_0xfcb7('0xd')](_0xfcb7('0xf'),auth[_0xfcb7('0xb')](),controller[_0xfcb7('0x10')]);router[_0xfcb7('0xd')](_0xfcb7('0x11'),auth[_0xfcb7('0xb')](),controller[_0xfcb7('0x12')]);router['get'](_0xfcb7('0x13'),auth[_0xfcb7('0xb')](),controller['getDescriptions']);router[_0xfcb7('0x14')]('/',auth['isAuthenticated'](),controller[_0xfcb7('0x15')]);router[_0xfcb7('0x16')](_0xfcb7('0xe'),auth[_0xfcb7('0xb')](),controller[_0xfcb7('0x17')]);router[_0xfcb7('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xfcb7('0x19')]);module[_0xfcb7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index c805c8a..2fd7c00 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 _0x965c=['exports','STRING','sequelize'];(function(_0x577882,_0x4973dc){var _0x2e69fc=function(_0x4db600){while(--_0x4db600){_0x577882['push'](_0x577882['shift']());}};_0x2e69fc(++_0x4973dc);}(_0x965c,0xda));var _0xc965=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x965c[_0x3e44fa];return _0x2a0aba;};'use strict';var Sequelize=require(_0xc965('0x0'));module[_0xc965('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc965('0x2')]}}; \ No newline at end of file +var _0x3ce3=['sequelize','exports','STRING'];(function(_0x54737a,_0x39ff99){var _0x1b038d=function(_0x2b8015){while(--_0x2b8015){_0x54737a['push'](_0x54737a['shift']());}};_0x1b038d(++_0x39ff99);}(_0x3ce3,0x84));var _0x33ce=function(_0x189930,_0x42bdc0){_0x189930=_0x189930-0x0;var _0x52bb7b=_0x3ce3[_0x189930];return _0x52bb7b;};'use strict';var Sequelize=require(_0x33ce('0x0'));module[_0x33ce('0x1')]={'name':{'type':Sequelize[_0x33ce('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index dbf1401..1800843 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 _0x61a1=['api','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','save','then','destroy','name','send','map','VtigerConfiguration','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','find','create','body','getFields','findOne','order','catch','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x61a1,0x127));var _0x161a=function(_0x2b0bc2,_0x4331f5){_0x2b0bc2=_0x2b0bc2-0x0;var _0x56e5b9=_0x61a1[_0x2b0bc2];return _0x56e5b9;};'use strict';var emlformat=require(_0x161a('0x0'));var rimraf=require(_0x161a('0x1'));var zipdir=require(_0x161a('0x2'));var jsonpatch=require(_0x161a('0x3'));var rp=require(_0x161a('0x4'));var moment=require('moment');var BPromise=require(_0x161a('0x5'));var Mustache=require(_0x161a('0x6'));var util=require('util');var path=require(_0x161a('0x7'));var sox=require(_0x161a('0x8'));var csv=require(_0x161a('0x9'));var ejs=require(_0x161a('0xa'));var fs=require('fs');var fs_extra=require(_0x161a('0xb'));var _=require(_0x161a('0xc'));var squel=require(_0x161a('0xd'));var crypto=require(_0x161a('0xe'));var jsforce=require(_0x161a('0xf'));var deskjs=require(_0x161a('0x10'));var toCsv=require(_0x161a('0x9'));var querystring=require(_0x161a('0x11'));var Papa=require(_0x161a('0x12'));var Redis=require(_0x161a('0x13'));var authService=require(_0x161a('0x14'));var qs=require(_0x161a('0x15'));var as=require(_0x161a('0x16'));var hardwareService=require(_0x161a('0x17'));var logger=require(_0x161a('0x18'))(_0x161a('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x561e37,_0x2f61f0){_0x2f61f0=_0x2f61f0||0xcc;return function(_0xe588d6){if(_0xe588d6){return _0x561e37[_0x161a('0x1a')](_0x2f61f0);}return _0x561e37[_0x161a('0x1b')](_0x2f61f0)[_0x161a('0x1c')]();};}function respondWithResult(_0x2f6a2c,_0x891d45){_0x891d45=_0x891d45||0xc8;return function(_0x4a16a8){if(_0x4a16a8){return _0x2f6a2c['status'](_0x891d45)['json'](_0x4a16a8);}};}function respondWithFilteredResult(_0x2b2a3e,_0x42eebf){return function(_0x4cbdb3){if(_0x4cbdb3){var _0x359ccd=typeof _0x42eebf[_0x161a('0x1d')]==='undefined'&&typeof _0x42eebf[_0x161a('0x1e')]===_0x161a('0x1f');var _0x1dd836=_0x4cbdb3[_0x161a('0x20')];var _0x28c9bf=_0x359ccd?0x0:_0x42eebf[_0x161a('0x1d')];var _0x25a286=_0x359ccd?_0x4cbdb3[_0x161a('0x20')]:_0x42eebf[_0x161a('0x1d')]+_0x42eebf[_0x161a('0x1e')];var _0x4118fe;if(_0x25a286>=_0x1dd836){_0x25a286=_0x1dd836;_0x4118fe=0xc8;}else{_0x4118fe=0xce;}_0x2b2a3e[_0x161a('0x1b')](_0x4118fe);return _0x2b2a3e[_0x161a('0x21')]('Content-Range',_0x28c9bf+'-'+_0x25a286+'/'+_0x1dd836)[_0x161a('0x22')](_0x4cbdb3);}return null;};}function patchUpdates(_0x172488){return function(_0x8243dd){try{jsonpatch[_0x161a('0x23')](_0x8243dd,_0x172488,!![]);}catch(_0x1d14b0){return BPromise[_0x161a('0x24')](_0x1d14b0);}return _0x8243dd[_0x161a('0x25')]();};}function saveUpdates(_0x79e925,_0xffe8e1){return function(_0xa11a84){if(_0xa11a84){return _0xa11a84['update'](_0x79e925)[_0x161a('0x26')](function(_0x4bd93e){return _0x4bd93e;});}return null;};}function removeEntity(_0x40aedb,_0x2e7a46){return function(_0x4da7fa){if(_0x4da7fa){return _0x4da7fa[_0x161a('0x27')]()[_0x161a('0x26')](function(){_0x40aedb[_0x161a('0x1b')](0xcc)[_0x161a('0x1c')]();});}};}function handleEntityNotFound(_0x1541c6,_0x475c90){return function(_0x3e0d94){if(!_0x3e0d94){_0x1541c6[_0x161a('0x1a')](0x194);}return _0x3e0d94;};}function handleError(_0x5b54b3,_0x1c1964){_0x1c1964=_0x1c1964||0x1f4;return function(_0x1b10b0){logger['error'](_0x1b10b0['stack']);if(_0x1b10b0[_0x161a('0x28')]){delete _0x1b10b0[_0x161a('0x28')];}_0x5b54b3['status'](_0x1c1964)[_0x161a('0x29')](_0x1b10b0);};}exports['index']=function(_0x5def9c,_0x17cca5){var _0xdc57e={},_0x2c5039={},_0x6f840b={'count':0x0,'rows':[]};var _0x1b66dc=_[_0x161a('0x2a')](db[_0x161a('0x2b')]['rawAttributes'],function(_0x354db5){return{'name':_0x354db5[_0x161a('0x2c')],'type':_0x354db5[_0x161a('0x2d')][_0x161a('0x2e')]};});_0x2c5039['model']=_['map'](_0x1b66dc,_0x161a('0x28'));_0x2c5039[_0x161a('0x2f')]=_[_0x161a('0x30')](_0x5def9c[_0x161a('0x2f')]);_0x2c5039[_0x161a('0x31')]=_[_0x161a('0x32')](_0x2c5039[_0x161a('0x33')],_0x2c5039[_0x161a('0x2f')]);_0xdc57e['attributes']=_[_0x161a('0x32')](_0x2c5039[_0x161a('0x33')],qs[_0x161a('0x34')](_0x5def9c[_0x161a('0x2f')]['fields']));_0xdc57e[_0x161a('0x35')]=_0xdc57e[_0x161a('0x35')][_0x161a('0x36')]?_0xdc57e[_0x161a('0x35')]:_0x2c5039[_0x161a('0x33')];if(!_0x5def9c[_0x161a('0x2f')][_0x161a('0x37')](_0x161a('0x38'))){_0xdc57e['limit']=qs[_0x161a('0x1e')](_0x5def9c[_0x161a('0x2f')][_0x161a('0x1e')]);_0xdc57e[_0x161a('0x1d')]=qs['offset'](_0x5def9c[_0x161a('0x2f')][_0x161a('0x1d')]);}_0xdc57e['order']=qs[_0x161a('0x39')](_0x5def9c[_0x161a('0x2f')]['sort']);_0xdc57e[_0x161a('0x3a')]=qs[_0x161a('0x31')](_[_0x161a('0x3b')](_0x5def9c[_0x161a('0x2f')],_0x2c5039[_0x161a('0x31')]),_0x1b66dc);if(_0x5def9c[_0x161a('0x2f')][_0x161a('0x3c')]){_0xdc57e[_0x161a('0x3a')]=_[_0x161a('0x3d')](_0xdc57e[_0x161a('0x3a')],{'$or':_[_0x161a('0x2a')](_0x1b66dc,function(_0x13d61f){if(_0x13d61f[_0x161a('0x2d')]!==_0x161a('0x3e')){var _0x36deef={};_0x36deef[_0x13d61f[_0x161a('0x28')]]={'$like':'%'+_0x5def9c[_0x161a('0x2f')][_0x161a('0x3c')]+'%'};return _0x36deef;}})});}_0xdc57e=_[_0x161a('0x3d')]({},_0xdc57e,_0x5def9c[_0x161a('0x3f')]);var _0x4708fb={'where':_0xdc57e['where']};return db[_0x161a('0x2b')][_0x161a('0x20')](_0x4708fb)[_0x161a('0x26')](function(_0x2eaea6){_0x6f840b['count']=_0x2eaea6;if(_0x5def9c[_0x161a('0x2f')][_0x161a('0x40')]){_0xdc57e[_0x161a('0x41')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0xdc57e);})['then'](function(_0x1e6bc0){_0x6f840b[_0x161a('0x42')]=_0x1e6bc0;return _0x6f840b;})[_0x161a('0x26')](respondWithFilteredResult(_0x17cca5,_0xdc57e))['catch'](handleError(_0x17cca5,null));};exports[_0x161a('0x43')]=function(_0x4dd881,_0x5b72aa){var _0x4f7d49={'raw':![],'where':{'id':_0x4dd881[_0x161a('0x44')]['id']}},_0x45d930={};_0x45d930['model']=_[_0x161a('0x30')](db[_0x161a('0x2b')][_0x161a('0x45')]);_0x45d930[_0x161a('0x2f')]=_['keys'](_0x4dd881[_0x161a('0x2f')]);_0x45d930[_0x161a('0x31')]=_[_0x161a('0x32')](_0x45d930['model'],_0x45d930[_0x161a('0x2f')]);_0x4f7d49['attributes']=_[_0x161a('0x32')](_0x45d930[_0x161a('0x33')],qs[_0x161a('0x34')](_0x4dd881[_0x161a('0x2f')][_0x161a('0x34')]));_0x4f7d49[_0x161a('0x35')]=_0x4f7d49[_0x161a('0x35')][_0x161a('0x36')]?_0x4f7d49['attributes']:_0x45d930[_0x161a('0x33')];if(_0x4dd881[_0x161a('0x2f')][_0x161a('0x40')]){_0x4f7d49[_0x161a('0x41')]=[{'all':!![]}];}_0x4f7d49=_['merge']({},_0x4f7d49,_0x4dd881[_0x161a('0x3f')]);return db[_0x161a('0x2b')][_0x161a('0x46')](_0x4f7d49)[_0x161a('0x26')](handleEntityNotFound(_0x5b72aa,null))[_0x161a('0x26')](respondWithResult(_0x5b72aa,null))['catch'](handleError(_0x5b72aa,null));};exports[_0x161a('0x47')]=function(_0x51444d,_0xcc75e4){return db[_0x161a('0x2b')][_0x161a('0x47')](_0x51444d[_0x161a('0x48')],{})[_0x161a('0x26')](respondWithResult(_0xcc75e4,0xc9))['catch'](handleError(_0xcc75e4,null));};exports['update']=function(_0x1b744a,_0x24f920){if(_0x1b744a['body']['id']){delete _0x1b744a[_0x161a('0x48')]['id'];}return db[_0x161a('0x2b')]['find']({'where':{'id':_0x1b744a[_0x161a('0x44')]['id']}})[_0x161a('0x26')](handleEntityNotFound(_0x24f920,null))[_0x161a('0x26')](saveUpdates(_0x1b744a[_0x161a('0x48')],null))[_0x161a('0x26')](respondWithResult(_0x24f920,null))['catch'](handleError(_0x24f920,null));};exports['destroy']=function(_0xd13bfc,_0x4b5e03){return db[_0x161a('0x2b')]['find']({'where':{'id':_0xd13bfc[_0x161a('0x44')]['id']}})[_0x161a('0x26')](handleEntityNotFound(_0x4b5e03,null))[_0x161a('0x26')](removeEntity(_0x4b5e03,null))['catch'](handleError(_0x4b5e03,null));};exports[_0x161a('0x49')]=function(_0x2d8c2d,_0x53dc06,_0x389504){var _0x1b624c={};var _0x33bd4b={};var _0x7d6414;var _0xaf6c7a;return db[_0x161a('0x2b')][_0x161a('0x4a')]({'where':{'id':_0x2d8c2d['params']['id']}})[_0x161a('0x26')](handleEntityNotFound(_0x53dc06,null))[_0x161a('0x26')](function(_0xbfba53){if(_0xbfba53){_0x7d6414=_0xbfba53;_0x33bd4b['model']=_[_0x161a('0x30')](db['VtigerField'][_0x161a('0x45')]);_0x33bd4b[_0x161a('0x2f')]=_['keys'](_0x2d8c2d['query']);_0x33bd4b['filters']=_[_0x161a('0x32')](_0x33bd4b[_0x161a('0x33')],_0x33bd4b[_0x161a('0x2f')]);_0x1b624c[_0x161a('0x35')]=_['intersection'](_0x33bd4b[_0x161a('0x33')],qs['fields'](_0x2d8c2d['query'][_0x161a('0x34')]));_0x1b624c[_0x161a('0x35')]=_0x1b624c[_0x161a('0x35')][_0x161a('0x36')]?_0x1b624c[_0x161a('0x35')]:_0x33bd4b[_0x161a('0x33')];_0x1b624c[_0x161a('0x4b')]=qs[_0x161a('0x39')](_0x2d8c2d['query'][_0x161a('0x39')]);_0x1b624c['where']=qs[_0x161a('0x31')](_[_0x161a('0x3b')](_0x2d8c2d[_0x161a('0x2f')],_0x33bd4b[_0x161a('0x31')]));if(_0x2d8c2d['query'][_0x161a('0x3c')]){_0x1b624c['where']=_[_0x161a('0x3d')](_0x1b624c[_0x161a('0x3a')],{'$or':_['map'](_0x1b624c[_0x161a('0x35')],function(_0x3dc073){var _0x4f21bf={};_0x4f21bf[_0x3dc073]={'$like':'%'+_0x2d8c2d[_0x161a('0x2f')]['filter']+'%'};return _0x4f21bf;})});}_0x1b624c=_[_0x161a('0x3d')]({},_0x1b624c,_0x2d8c2d[_0x161a('0x3f')]);return _0x7d6414['getFields'](_0x1b624c);}})[_0x161a('0x26')](function(_0x1ec865){if(_0x1ec865){_0xaf6c7a=_0x1ec865[_0x161a('0x36')];if(!_0x2d8c2d[_0x161a('0x2f')]['hasOwnProperty'](_0x161a('0x38'))){_0x1b624c[_0x161a('0x1e')]=qs[_0x161a('0x1e')](_0x2d8c2d[_0x161a('0x2f')][_0x161a('0x1e')]);_0x1b624c[_0x161a('0x1d')]=qs[_0x161a('0x1d')](_0x2d8c2d[_0x161a('0x2f')]['offset']);}return _0x7d6414['getFields'](_0x1b624c);}})[_0x161a('0x26')](function(_0x273a47){if(_0x273a47){return _0x273a47?{'count':_0xaf6c7a,'rows':_0x273a47}:null;}})['then'](respondWithResult(_0x53dc06,null))[_0x161a('0x4c')](handleError(_0x53dc06,null));};exports['getSubjects']=function(_0x500d6d,_0xbea1c3,_0x42734a){var _0x2f8207={};var _0x2e2b19={};var _0x5bfa30;var _0x1e4978;return db[_0x161a('0x2b')][_0x161a('0x4a')]({'where':{'id':_0x500d6d['params']['id']}})['then'](handleEntityNotFound(_0xbea1c3,null))[_0x161a('0x26')](function(_0x405d5a){if(_0x405d5a){_0x5bfa30=_0x405d5a;_0x2e2b19['model']=_['keys'](db[_0x161a('0x4d')]['rawAttributes']);_0x2e2b19['query']=_[_0x161a('0x30')](_0x500d6d[_0x161a('0x2f')]);_0x2e2b19[_0x161a('0x31')]=_[_0x161a('0x32')](_0x2e2b19[_0x161a('0x33')],_0x2e2b19[_0x161a('0x2f')]);_0x2f8207['attributes']=_[_0x161a('0x32')](_0x2e2b19[_0x161a('0x33')],qs[_0x161a('0x34')](_0x500d6d[_0x161a('0x2f')][_0x161a('0x34')]));_0x2f8207[_0x161a('0x35')]=_0x2f8207['attributes'][_0x161a('0x36')]?_0x2f8207['attributes']:_0x2e2b19['model'];_0x2f8207[_0x161a('0x4b')]=qs[_0x161a('0x39')](_0x500d6d[_0x161a('0x2f')][_0x161a('0x39')]);_0x2f8207[_0x161a('0x3a')]=qs['filters'](_[_0x161a('0x3b')](_0x500d6d[_0x161a('0x2f')],_0x2e2b19[_0x161a('0x31')]));if(_0x500d6d[_0x161a('0x2f')][_0x161a('0x3c')]){_0x2f8207[_0x161a('0x3a')]=_[_0x161a('0x3d')](_0x2f8207[_0x161a('0x3a')],{'$or':_[_0x161a('0x2a')](_0x2f8207[_0x161a('0x35')],function(_0x5bface){var _0x220700={};_0x220700[_0x5bface]={'$like':'%'+_0x500d6d[_0x161a('0x2f')]['filter']+'%'};return _0x220700;})});}_0x2f8207=_[_0x161a('0x3d')]({},_0x2f8207,_0x500d6d['options']);return _0x5bfa30[_0x161a('0x4e')](_0x2f8207);}})[_0x161a('0x26')](function(_0x1e5848){if(_0x1e5848){_0x1e4978=_0x1e5848[_0x161a('0x36')];if(!_0x500d6d[_0x161a('0x2f')][_0x161a('0x37')](_0x161a('0x38'))){_0x2f8207[_0x161a('0x1e')]=qs[_0x161a('0x1e')](_0x500d6d['query'][_0x161a('0x1e')]);_0x2f8207[_0x161a('0x1d')]=qs[_0x161a('0x1d')](_0x500d6d[_0x161a('0x2f')][_0x161a('0x1d')]);}return _0x5bfa30[_0x161a('0x4e')](_0x2f8207);}})[_0x161a('0x26')](function(_0x25e2b3){if(_0x25e2b3){return _0x25e2b3?{'count':_0x1e4978,'rows':_0x25e2b3}:null;}})['then'](respondWithResult(_0xbea1c3,null))['catch'](handleError(_0xbea1c3,null));};exports[_0x161a('0x4f')]=function(_0x2ea557,_0x235398,_0x2fd7f0){var _0x501812={};var _0x4ff136={};var _0x319166;var _0x3dc676;return db[_0x161a('0x2b')][_0x161a('0x4a')]({'where':{'id':_0x2ea557[_0x161a('0x44')]['id']}})[_0x161a('0x26')](handleEntityNotFound(_0x235398,null))[_0x161a('0x26')](function(_0x3664a1){if(_0x3664a1){_0x319166=_0x3664a1;_0x4ff136[_0x161a('0x33')]=_[_0x161a('0x30')](db['VtigerField'][_0x161a('0x45')]);_0x4ff136[_0x161a('0x2f')]=_['keys'](_0x2ea557[_0x161a('0x2f')]);_0x4ff136['filters']=_['intersection'](_0x4ff136[_0x161a('0x33')],_0x4ff136[_0x161a('0x2f')]);_0x501812[_0x161a('0x35')]=_[_0x161a('0x32')](_0x4ff136[_0x161a('0x33')],qs[_0x161a('0x34')](_0x2ea557['query']['fields']));_0x501812['attributes']=_0x501812[_0x161a('0x35')]['length']?_0x501812[_0x161a('0x35')]:_0x4ff136['model'];_0x501812['order']=qs[_0x161a('0x39')](_0x2ea557[_0x161a('0x2f')][_0x161a('0x39')]);_0x501812[_0x161a('0x3a')]=qs[_0x161a('0x31')](_[_0x161a('0x3b')](_0x2ea557[_0x161a('0x2f')],_0x4ff136[_0x161a('0x31')]));if(_0x2ea557['query']['filter']){_0x501812[_0x161a('0x3a')]=_[_0x161a('0x3d')](_0x501812[_0x161a('0x3a')],{'$or':_[_0x161a('0x2a')](_0x501812[_0x161a('0x35')],function(_0x47e452){var _0x55ee47={};_0x55ee47[_0x47e452]={'$like':'%'+_0x2ea557[_0x161a('0x2f')][_0x161a('0x3c')]+'%'};return _0x55ee47;})});}_0x501812=_['merge']({},_0x501812,_0x2ea557['options']);return _0x319166[_0x161a('0x4f')](_0x501812);}})['then'](function(_0x457c9b){if(_0x457c9b){_0x3dc676=_0x457c9b[_0x161a('0x36')];if(!_0x2ea557[_0x161a('0x2f')][_0x161a('0x37')](_0x161a('0x38'))){_0x501812[_0x161a('0x1e')]=qs[_0x161a('0x1e')](_0x2ea557[_0x161a('0x2f')]['limit']);_0x501812[_0x161a('0x1d')]=qs['offset'](_0x2ea557[_0x161a('0x2f')][_0x161a('0x1d')]);}return _0x319166[_0x161a('0x4f')](_0x501812);}})[_0x161a('0x26')](function(_0x374599){if(_0x374599){return _0x374599?{'count':_0x3dc676,'rows':_0x374599}:null;}})[_0x161a('0x26')](respondWithResult(_0x235398,null))[_0x161a('0x4c')](handleError(_0x235398,null));}; \ No newline at end of file +var _0xde2d=['offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','sendStatus','stack','name','send','index','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','map','options','VtigerConfiguration','includeAll','include','findAll','show','params','rawAttributes','fields','length','find','create','body','catch','getFields','findOne','VtigerField','pick','getSubjects','order','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json'];(function(_0x3ca7eb,_0x597664){var _0x4cf60b=function(_0x4af5d8){while(--_0x4af5d8){_0x3ca7eb['push'](_0x3ca7eb['shift']());}};_0x4cf60b(++_0x597664);}(_0xde2d,0x1ee));var _0xdde2=function(_0x2b3b3a,_0x3226e0){_0x2b3b3a=_0x2b3b3a-0x0;var _0x4b1b2c=_0xde2d[_0x2b3b3a];return _0x4b1b2c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdde2('0x0'));var zipdir=require(_0xdde2('0x1'));var jsonpatch=require(_0xdde2('0x2'));var rp=require('request-promise');var moment=require(_0xdde2('0x3'));var BPromise=require(_0xdde2('0x4'));var Mustache=require('mustache');var util=require(_0xdde2('0x5'));var path=require(_0xdde2('0x6'));var sox=require(_0xdde2('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdde2('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdde2('0x9'));var deskjs=require(_0xdde2('0xa'));var toCsv=require(_0xdde2('0xb'));var querystring=require(_0xdde2('0xc'));var Papa=require('papaparse');var Redis=require(_0xdde2('0xd'));var authService=require(_0xdde2('0xe'));var qs=require(_0xdde2('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdde2('0x10'))(_0xdde2('0x11'));var utils=require(_0xdde2('0x12'));var config=require(_0xdde2('0x13'));var licenseUtil=require(_0xdde2('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33b467,_0x2bc128){_0x2bc128=_0x2bc128||0xcc;return function(_0x24d473){if(_0x24d473){return _0x33b467['sendStatus'](_0x2bc128);}return _0x33b467[_0xdde2('0x15')](_0x2bc128)[_0xdde2('0x16')]();};}function respondWithResult(_0x48eb36,_0x5748c8){_0x5748c8=_0x5748c8||0xc8;return function(_0x2eeb18){if(_0x2eeb18){return _0x48eb36[_0xdde2('0x15')](_0x5748c8)[_0xdde2('0x17')](_0x2eeb18);}};}function respondWithFilteredResult(_0x3d77ca,_0x22690c){return function(_0x2577aa){if(_0x2577aa){var _0x56dd3b=typeof _0x22690c[_0xdde2('0x18')]==='undefined'&&typeof _0x22690c[_0xdde2('0x19')]===_0xdde2('0x1a');var _0x5071cd=_0x2577aa[_0xdde2('0x1b')];var _0x3a31b6=_0x56dd3b?0x0:_0x22690c[_0xdde2('0x18')];var _0x556b6c=_0x56dd3b?_0x2577aa[_0xdde2('0x1b')]:_0x22690c[_0xdde2('0x18')]+_0x22690c['limit'];var _0x5e1574;if(_0x556b6c>=_0x5071cd){_0x556b6c=_0x5071cd;_0x5e1574=0xc8;}else{_0x5e1574=0xce;}_0x3d77ca['status'](_0x5e1574);return _0x3d77ca[_0xdde2('0x1c')](_0xdde2('0x1d'),_0x3a31b6+'-'+_0x556b6c+'/'+_0x5071cd)['json'](_0x2577aa);}return null;};}function patchUpdates(_0x348fe7){return function(_0x20a7a9){try{jsonpatch[_0xdde2('0x1e')](_0x20a7a9,_0x348fe7,!![]);}catch(_0x3c0fa7){return BPromise[_0xdde2('0x1f')](_0x3c0fa7);}return _0x20a7a9['save']();};}function saveUpdates(_0x41bc92,_0x430ac4){return function(_0x2a5bcd){if(_0x2a5bcd){return _0x2a5bcd[_0xdde2('0x20')](_0x41bc92)[_0xdde2('0x21')](function(_0x1a14e0){return _0x1a14e0;});}return null;};}function removeEntity(_0x5753f0,_0x43b331){return function(_0xc3ac95){if(_0xc3ac95){return _0xc3ac95['destroy']()[_0xdde2('0x21')](function(){_0x5753f0[_0xdde2('0x15')](0xcc)[_0xdde2('0x16')]();});}};}function handleEntityNotFound(_0x58a69f,_0x3cf19b){return function(_0x3cd88){if(!_0x3cd88){_0x58a69f[_0xdde2('0x22')](0x194);}return _0x3cd88;};}function handleError(_0x36b0d2,_0x3c635d){_0x3c635d=_0x3c635d||0x1f4;return function(_0x303fbd){logger['error'](_0x303fbd[_0xdde2('0x23')]);if(_0x303fbd[_0xdde2('0x24')]){delete _0x303fbd[_0xdde2('0x24')];}_0x36b0d2[_0xdde2('0x15')](_0x3c635d)[_0xdde2('0x25')](_0x303fbd);};}exports[_0xdde2('0x26')]=function(_0x5c8c95,_0x38dd63){var _0x55a96e={},_0x5c4e83={},_0xbc0e1c={'count':0x0,'rows':[]};var _0x907e9f=_['map'](db['VtigerConfiguration']['rawAttributes'],function(_0x13cb8d){return{'name':_0x13cb8d['fieldName'],'type':_0x13cb8d[_0xdde2('0x27')]['key']};});_0x5c4e83[_0xdde2('0x28')]=_['map'](_0x907e9f,'name');_0x5c4e83[_0xdde2('0x29')]=_[_0xdde2('0x2a')](_0x5c8c95['query']);_0x5c4e83[_0xdde2('0x2b')]=_[_0xdde2('0x2c')](_0x5c4e83['model'],_0x5c4e83[_0xdde2('0x29')]);_0x55a96e[_0xdde2('0x2d')]=_['intersection'](_0x5c4e83['model'],qs['fields'](_0x5c8c95[_0xdde2('0x29')]['fields']));_0x55a96e[_0xdde2('0x2d')]=_0x55a96e['attributes']['length']?_0x55a96e['attributes']:_0x5c4e83[_0xdde2('0x28')];if(!_0x5c8c95['query'][_0xdde2('0x2e')](_0xdde2('0x2f'))){_0x55a96e[_0xdde2('0x19')]=qs[_0xdde2('0x19')](_0x5c8c95[_0xdde2('0x29')][_0xdde2('0x19')]);_0x55a96e[_0xdde2('0x18')]=qs[_0xdde2('0x18')](_0x5c8c95[_0xdde2('0x29')][_0xdde2('0x18')]);}_0x55a96e['order']=qs['sort'](_0x5c8c95[_0xdde2('0x29')][_0xdde2('0x30')]);_0x55a96e[_0xdde2('0x31')]=qs[_0xdde2('0x2b')](_['pick'](_0x5c8c95[_0xdde2('0x29')],_0x5c4e83[_0xdde2('0x2b')]),_0x907e9f);if(_0x5c8c95[_0xdde2('0x29')][_0xdde2('0x32')]){_0x55a96e[_0xdde2('0x31')]=_[_0xdde2('0x33')](_0x55a96e['where'],{'$or':_[_0xdde2('0x34')](_0x907e9f,function(_0x2f8ab0){if(_0x2f8ab0['type']!=='VIRTUAL'){var _0x3ac8bd={};_0x3ac8bd[_0x2f8ab0[_0xdde2('0x24')]]={'$like':'%'+_0x5c8c95[_0xdde2('0x29')]['filter']+'%'};return _0x3ac8bd;}})});}_0x55a96e=_['merge']({},_0x55a96e,_0x5c8c95[_0xdde2('0x35')]);var _0x302125={'where':_0x55a96e[_0xdde2('0x31')]};return db[_0xdde2('0x36')][_0xdde2('0x1b')](_0x302125)[_0xdde2('0x21')](function(_0x7d1bc9){_0xbc0e1c[_0xdde2('0x1b')]=_0x7d1bc9;if(_0x5c8c95[_0xdde2('0x29')][_0xdde2('0x37')]){_0x55a96e[_0xdde2('0x38')]=[{'all':!![]}];}return db[_0xdde2('0x36')][_0xdde2('0x39')](_0x55a96e);})[_0xdde2('0x21')](function(_0x37304e){_0xbc0e1c['rows']=_0x37304e;return _0xbc0e1c;})[_0xdde2('0x21')](respondWithFilteredResult(_0x38dd63,_0x55a96e))['catch'](handleError(_0x38dd63,null));};exports[_0xdde2('0x3a')]=function(_0x1ad8bd,_0x521aff){var _0x830f47={'raw':![],'where':{'id':_0x1ad8bd[_0xdde2('0x3b')]['id']}},_0x4600f8={};_0x4600f8[_0xdde2('0x28')]=_[_0xdde2('0x2a')](db[_0xdde2('0x36')][_0xdde2('0x3c')]);_0x4600f8['query']=_[_0xdde2('0x2a')](_0x1ad8bd[_0xdde2('0x29')]);_0x4600f8[_0xdde2('0x2b')]=_[_0xdde2('0x2c')](_0x4600f8[_0xdde2('0x28')],_0x4600f8[_0xdde2('0x29')]);_0x830f47[_0xdde2('0x2d')]=_[_0xdde2('0x2c')](_0x4600f8[_0xdde2('0x28')],qs[_0xdde2('0x3d')](_0x1ad8bd[_0xdde2('0x29')][_0xdde2('0x3d')]));_0x830f47['attributes']=_0x830f47[_0xdde2('0x2d')][_0xdde2('0x3e')]?_0x830f47[_0xdde2('0x2d')]:_0x4600f8[_0xdde2('0x28')];if(_0x1ad8bd[_0xdde2('0x29')][_0xdde2('0x37')]){_0x830f47['include']=[{'all':!![]}];}_0x830f47=_[_0xdde2('0x33')]({},_0x830f47,_0x1ad8bd['options']);return db[_0xdde2('0x36')][_0xdde2('0x3f')](_0x830f47)[_0xdde2('0x21')](handleEntityNotFound(_0x521aff,null))[_0xdde2('0x21')](respondWithResult(_0x521aff,null))['catch'](handleError(_0x521aff,null));};exports[_0xdde2('0x40')]=function(_0x2d4057,_0x1fe35d){return db[_0xdde2('0x36')][_0xdde2('0x40')](_0x2d4057[_0xdde2('0x41')],{})[_0xdde2('0x21')](respondWithResult(_0x1fe35d,0xc9))[_0xdde2('0x42')](handleError(_0x1fe35d,null));};exports[_0xdde2('0x20')]=function(_0x2ccdd0,_0x1fe2f7){if(_0x2ccdd0[_0xdde2('0x41')]['id']){delete _0x2ccdd0[_0xdde2('0x41')]['id'];}return db['VtigerConfiguration'][_0xdde2('0x3f')]({'where':{'id':_0x2ccdd0[_0xdde2('0x3b')]['id']}})['then'](handleEntityNotFound(_0x1fe2f7,null))['then'](saveUpdates(_0x2ccdd0['body'],null))[_0xdde2('0x21')](respondWithResult(_0x1fe2f7,null))[_0xdde2('0x42')](handleError(_0x1fe2f7,null));};exports['destroy']=function(_0x3f45e6,_0x11b26f){return db['VtigerConfiguration'][_0xdde2('0x3f')]({'where':{'id':_0x3f45e6[_0xdde2('0x3b')]['id']}})[_0xdde2('0x21')](handleEntityNotFound(_0x11b26f,null))[_0xdde2('0x21')](removeEntity(_0x11b26f,null))[_0xdde2('0x42')](handleError(_0x11b26f,null));};exports[_0xdde2('0x43')]=function(_0x288a92,_0x52511d,_0x2b1491){var _0x1df3b3={};var _0x58d68c={};var _0x22014d;var _0x46e9b0;return db[_0xdde2('0x36')][_0xdde2('0x44')]({'where':{'id':_0x288a92[_0xdde2('0x3b')]['id']}})['then'](handleEntityNotFound(_0x52511d,null))[_0xdde2('0x21')](function(_0x2babc3){if(_0x2babc3){_0x22014d=_0x2babc3;_0x58d68c[_0xdde2('0x28')]=_[_0xdde2('0x2a')](db[_0xdde2('0x45')][_0xdde2('0x3c')]);_0x58d68c[_0xdde2('0x29')]=_[_0xdde2('0x2a')](_0x288a92[_0xdde2('0x29')]);_0x58d68c[_0xdde2('0x2b')]=_[_0xdde2('0x2c')](_0x58d68c[_0xdde2('0x28')],_0x58d68c[_0xdde2('0x29')]);_0x1df3b3[_0xdde2('0x2d')]=_[_0xdde2('0x2c')](_0x58d68c[_0xdde2('0x28')],qs['fields'](_0x288a92[_0xdde2('0x29')][_0xdde2('0x3d')]));_0x1df3b3[_0xdde2('0x2d')]=_0x1df3b3[_0xdde2('0x2d')]['length']?_0x1df3b3[_0xdde2('0x2d')]:_0x58d68c[_0xdde2('0x28')];_0x1df3b3['order']=qs[_0xdde2('0x30')](_0x288a92[_0xdde2('0x29')]['sort']);_0x1df3b3[_0xdde2('0x31')]=qs['filters'](_[_0xdde2('0x46')](_0x288a92['query'],_0x58d68c['filters']));if(_0x288a92[_0xdde2('0x29')][_0xdde2('0x32')]){_0x1df3b3['where']=_[_0xdde2('0x33')](_0x1df3b3[_0xdde2('0x31')],{'$or':_['map'](_0x1df3b3[_0xdde2('0x2d')],function(_0x46495f){var _0x368c3d={};_0x368c3d[_0x46495f]={'$like':'%'+_0x288a92[_0xdde2('0x29')][_0xdde2('0x32')]+'%'};return _0x368c3d;})});}_0x1df3b3=_[_0xdde2('0x33')]({},_0x1df3b3,_0x288a92['options']);return _0x22014d[_0xdde2('0x43')](_0x1df3b3);}})[_0xdde2('0x21')](function(_0xb597aa){if(_0xb597aa){_0x46e9b0=_0xb597aa['length'];if(!_0x288a92['query'][_0xdde2('0x2e')](_0xdde2('0x2f'))){_0x1df3b3[_0xdde2('0x19')]=qs[_0xdde2('0x19')](_0x288a92[_0xdde2('0x29')][_0xdde2('0x19')]);_0x1df3b3[_0xdde2('0x18')]=qs[_0xdde2('0x18')](_0x288a92[_0xdde2('0x29')][_0xdde2('0x18')]);}return _0x22014d['getFields'](_0x1df3b3);}})[_0xdde2('0x21')](function(_0x5d9f6a){if(_0x5d9f6a){return _0x5d9f6a?{'count':_0x46e9b0,'rows':_0x5d9f6a}:null;}})[_0xdde2('0x21')](respondWithResult(_0x52511d,null))['catch'](handleError(_0x52511d,null));};exports[_0xdde2('0x47')]=function(_0x32228b,_0x4f0cbd,_0x4c6a20){var _0x502acb={};var _0x2b6153={};var _0x353b37;var _0x16712a;return db[_0xdde2('0x36')]['findOne']({'where':{'id':_0x32228b[_0xdde2('0x3b')]['id']}})[_0xdde2('0x21')](handleEntityNotFound(_0x4f0cbd,null))[_0xdde2('0x21')](function(_0x2d7185){if(_0x2d7185){_0x353b37=_0x2d7185;_0x2b6153['model']=_['keys'](db[_0xdde2('0x45')][_0xdde2('0x3c')]);_0x2b6153[_0xdde2('0x29')]=_[_0xdde2('0x2a')](_0x32228b['query']);_0x2b6153['filters']=_['intersection'](_0x2b6153[_0xdde2('0x28')],_0x2b6153['query']);_0x502acb[_0xdde2('0x2d')]=_[_0xdde2('0x2c')](_0x2b6153['model'],qs['fields'](_0x32228b[_0xdde2('0x29')][_0xdde2('0x3d')]));_0x502acb[_0xdde2('0x2d')]=_0x502acb[_0xdde2('0x2d')][_0xdde2('0x3e')]?_0x502acb['attributes']:_0x2b6153[_0xdde2('0x28')];_0x502acb[_0xdde2('0x48')]=qs[_0xdde2('0x30')](_0x32228b[_0xdde2('0x29')][_0xdde2('0x30')]);_0x502acb[_0xdde2('0x31')]=qs[_0xdde2('0x2b')](_['pick'](_0x32228b[_0xdde2('0x29')],_0x2b6153['filters']));if(_0x32228b[_0xdde2('0x29')]['filter']){_0x502acb['where']=_[_0xdde2('0x33')](_0x502acb[_0xdde2('0x31')],{'$or':_['map'](_0x502acb[_0xdde2('0x2d')],function(_0xcc959f){var _0x14095a={};_0x14095a[_0xcc959f]={'$like':'%'+_0x32228b['query'][_0xdde2('0x32')]+'%'};return _0x14095a;})});}_0x502acb=_[_0xdde2('0x33')]({},_0x502acb,_0x32228b[_0xdde2('0x35')]);return _0x353b37['getSubjects'](_0x502acb);}})['then'](function(_0x26baa0){if(_0x26baa0){_0x16712a=_0x26baa0['length'];if(!_0x32228b['query'][_0xdde2('0x2e')](_0xdde2('0x2f'))){_0x502acb[_0xdde2('0x19')]=qs[_0xdde2('0x19')](_0x32228b[_0xdde2('0x29')]['limit']);_0x502acb[_0xdde2('0x18')]=qs[_0xdde2('0x18')](_0x32228b['query']['offset']);}return _0x353b37[_0xdde2('0x47')](_0x502acb);}})[_0xdde2('0x21')](function(_0x3b15e1){if(_0x3b15e1){return _0x3b15e1?{'count':_0x16712a,'rows':_0x3b15e1}:null;}})[_0xdde2('0x21')](respondWithResult(_0x4f0cbd,null))['catch'](handleError(_0x4f0cbd,null));};exports[_0xdde2('0x49')]=function(_0x4f6279,_0x2cddcf,_0x597b38){var _0x1a07db={};var _0x101dc7={};var _0x4b030b;var _0x1f83f1;return db[_0xdde2('0x36')][_0xdde2('0x44')]({'where':{'id':_0x4f6279[_0xdde2('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2cddcf,null))['then'](function(_0xbf7598){if(_0xbf7598){_0x4b030b=_0xbf7598;_0x101dc7[_0xdde2('0x28')]=_['keys'](db['VtigerField']['rawAttributes']);_0x101dc7['query']=_['keys'](_0x4f6279[_0xdde2('0x29')]);_0x101dc7['filters']=_[_0xdde2('0x2c')](_0x101dc7['model'],_0x101dc7[_0xdde2('0x29')]);_0x1a07db['attributes']=_[_0xdde2('0x2c')](_0x101dc7['model'],qs['fields'](_0x4f6279[_0xdde2('0x29')][_0xdde2('0x3d')]));_0x1a07db['attributes']=_0x1a07db[_0xdde2('0x2d')][_0xdde2('0x3e')]?_0x1a07db[_0xdde2('0x2d')]:_0x101dc7[_0xdde2('0x28')];_0x1a07db[_0xdde2('0x48')]=qs[_0xdde2('0x30')](_0x4f6279[_0xdde2('0x29')][_0xdde2('0x30')]);_0x1a07db[_0xdde2('0x31')]=qs[_0xdde2('0x2b')](_[_0xdde2('0x46')](_0x4f6279[_0xdde2('0x29')],_0x101dc7[_0xdde2('0x2b')]));if(_0x4f6279[_0xdde2('0x29')]['filter']){_0x1a07db[_0xdde2('0x31')]=_[_0xdde2('0x33')](_0x1a07db[_0xdde2('0x31')],{'$or':_[_0xdde2('0x34')](_0x1a07db['attributes'],function(_0x18f640){var _0x38c05c={};_0x38c05c[_0x18f640]={'$like':'%'+_0x4f6279[_0xdde2('0x29')][_0xdde2('0x32')]+'%'};return _0x38c05c;})});}_0x1a07db=_['merge']({},_0x1a07db,_0x4f6279[_0xdde2('0x35')]);return _0x4b030b[_0xdde2('0x49')](_0x1a07db);}})[_0xdde2('0x21')](function(_0x10379a){if(_0x10379a){_0x1f83f1=_0x10379a[_0xdde2('0x3e')];if(!_0x4f6279[_0xdde2('0x29')][_0xdde2('0x2e')](_0xdde2('0x2f'))){_0x1a07db['limit']=qs['limit'](_0x4f6279[_0xdde2('0x29')][_0xdde2('0x19')]);_0x1a07db['offset']=qs[_0xdde2('0x18')](_0x4f6279[_0xdde2('0x29')][_0xdde2('0x18')]);}return _0x4b030b['getDescriptions'](_0x1a07db);}})[_0xdde2('0x21')](function(_0x40db55){if(_0x40db55){return _0x40db55?{'count':_0x1f83f1,'rows':_0x40db55}:null;}})[_0xdde2('0x21')](respondWithResult(_0x2cddcf,null))['catch'](handleError(_0x2cddcf,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index b1f7852..a88a8e5 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 _0xa45c=['rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','lodash','util','api','moment','bluebird','path'];(function(_0x4baeb7,_0xd45e37){var _0x185aaa=function(_0x132e9c){while(--_0x132e9c){_0x4baeb7['push'](_0x4baeb7['shift']());}};_0x185aaa(++_0xd45e37);}(_0xa45c,0xd6));var _0xca45=function(_0x142907,_0x3a89e9){_0x142907=_0x142907-0x0;var _0x55cad4=_0xa45c[_0x142907];return _0x55cad4;};'use strict';var _=require(_0xca45('0x0'));var util=require(_0xca45('0x1'));var logger=require('../../config/logger')(_0xca45('0x2'));var moment=require(_0xca45('0x3'));var BPromise=require(_0xca45('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xca45('0x5'));var rimraf=require(_0xca45('0x6'));var config=require(_0xca45('0x7'));var attributes=require(_0xca45('0x8'));module[_0xca45('0x9')]=function(_0x2bcb66,_0x5f063b){return _0x2bcb66['define'](_0xca45('0xa'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc27f=['rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x5a8a81,_0x1b9594){var _0xecd72=function(_0x275b0a){while(--_0x275b0a){_0x5a8a81['push'](_0x5a8a81['shift']());}};_0xecd72(++_0x1b9594);}(_0xc27f,0x11f));var _0xfc27=function(_0x4fc28f,_0xa9ea17){_0x4fc28f=_0x4fc28f-0x0;var _0x481e82=_0xc27f[_0x4fc28f];return _0x481e82;};'use strict';var _=require(_0xfc27('0x0'));var util=require(_0xfc27('0x1'));var logger=require(_0xfc27('0x2'))('api');var moment=require(_0xfc27('0x3'));var BPromise=require(_0xfc27('0x4'));var rp=require(_0xfc27('0x5'));var fs=require('fs');var path=require(_0xfc27('0x6'));var rimraf=require(_0xfc27('0x7'));var config=require(_0xfc27('0x8'));var attributes=require(_0xfc27('0x9'));module[_0xfc27('0xa')]=function(_0x514f7e,_0x36677a){return _0x514f7e[_0xfc27('0xb')](_0xfc27('0xc'),attributes,{'tableName':_0xfc27('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 3088f1e..c60dff5 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 _0xf800=['message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s'];(function(_0x3fb8fd,_0xd21fd4){var _0x5919a3=function(_0x2ca393){while(--_0x2ca393){_0x3fb8fd['push'](_0x3fb8fd['shift']());}};_0x5919a3(++_0xd21fd4);}(_0xf800,0x106));var _0x0f80=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf800[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0f80('0x0'));var util=require(_0x0f80('0x1'));var moment=require(_0x0f80('0x2'));var BPromise=require('bluebird');var rs=require(_0x0f80('0x3'));var fs=require('fs');var Redis=require(_0x0f80('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0f80('0x5'));var logger=require(_0x0f80('0x6'))('rpc');var config=require(_0x0f80('0x7'));var jayson=require(_0x0f80('0x8'));var client=jayson[_0x0f80('0x9')][_0x0f80('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x313f6c,_0x34675f,_0x73a952){return new BPromise(function(_0x237aa7,_0x2b1b64){return client[_0x0f80('0xb')](_0x313f6c,_0x73a952)['then'](function(_0x1ac3b9){logger[_0x0f80('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x34675f,_0x0f80('0xd'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x34675f,_0x0f80('0xd'),JSON[_0x0f80('0xe')](_0x1ac3b9));if(_0x1ac3b9[_0x0f80('0xf')]){if(_0x1ac3b9[_0x0f80('0xf')][_0x0f80('0x10')]===0x1f4){logger[_0x0f80('0xf')](_0x0f80('0x11'),_0x34675f,_0x1ac3b9[_0x0f80('0xf')][_0x0f80('0x12')]);return _0x2b1b64(_0x1ac3b9[_0x0f80('0xf')]['message']);}logger[_0x0f80('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x34675f,_0x1ac3b9[_0x0f80('0xf')][_0x0f80('0x12')]);return _0x237aa7(_0x1ac3b9[_0x0f80('0xf')]['message']);}else{logger[_0x0f80('0xc')](_0x0f80('0x11'),_0x34675f,'request\x20sent');_0x237aa7(_0x1ac3b9['result'][_0x0f80('0x12')]);}})[_0x0f80('0x13')](function(_0x44f828){logger[_0x0f80('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x34675f,_0x44f828);_0x2b1b64(_0x44f828);});});} \ No newline at end of file +var _0x38ac=['then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request'];(function(_0x5ae740,_0x2f25d4){var _0x16b9c6=function(_0x5dad7e){while(--_0x5dad7e){_0x5ae740['push'](_0x5ae740['shift']());}};_0x16b9c6(++_0x2f25d4);}(_0x38ac,0xd1));var _0xc38a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x38ac[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xc38a('0x0'));var util=require(_0xc38a('0x1'));var moment=require('moment');var BPromise=require(_0xc38a('0x2'));var rs=require(_0xc38a('0x3'));var fs=require('fs');var Redis=require(_0xc38a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc38a('0x5'));var logger=require(_0xc38a('0x6'))('rpc');var config=require(_0xc38a('0x7'));var jayson=require(_0xc38a('0x8'));var client=jayson['client'][_0xc38a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c467a,_0x4fe345,_0x5a8b28){return new BPromise(function(_0x2e72b5,_0x43ae21){return client[_0xc38a('0xa')](_0x3c467a,_0x5a8b28)[_0xc38a('0xb')](function(_0x4b77b2){logger[_0xc38a('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x4fe345,_0xc38a('0xd'));logger[_0xc38a('0xe')](_0xc38a('0xf'),_0x4fe345,_0xc38a('0xd'),JSON['stringify'](_0x4b77b2));if(_0x4b77b2[_0xc38a('0x10')]){if(_0x4b77b2[_0xc38a('0x10')][_0xc38a('0x11')]===0x1f4){logger[_0xc38a('0x10')](_0xc38a('0x12'),_0x4fe345,_0x4b77b2[_0xc38a('0x10')][_0xc38a('0x13')]);return _0x43ae21(_0x4b77b2[_0xc38a('0x10')]['message']);}logger[_0xc38a('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x4fe345,_0x4b77b2['error'][_0xc38a('0x13')]);return _0x2e72b5(_0x4b77b2[_0xc38a('0x10')][_0xc38a('0x13')]);}else{logger[_0xc38a('0xc')](_0xc38a('0x12'),_0x4fe345,_0xc38a('0xd'));_0x2e72b5(_0x4b77b2[_0xc38a('0x14')][_0xc38a('0x13')]);}})[_0xc38a('0x15')](function(_0xacb8a5){logger[_0xc38a('0x10')](_0xc38a('0x12'),_0x4fe345,_0xacb8a5);_0x43ae21(_0xacb8a5);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 363328c..c39b39e 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 _0x0555=['isAuthenticated','index','get','show','post','put','/:id','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller'];(function(_0x43afe5,_0x3d8925){var _0x37da4d=function(_0x187907){while(--_0x187907){_0x43afe5['push'](_0x43afe5['shift']());}};_0x37da4d(++_0x3d8925);}(_0x0555,0x1dd));var _0x5055=function(_0x4e4068,_0x122c31){_0x4e4068=_0x4e4068-0x0;var _0x2846a4=_0x0555[_0x4e4068];return _0x2846a4;};'use strict';var multer=require(_0x5055('0x0'));var util=require(_0x5055('0x1'));var path=require(_0x5055('0x2'));var timeout=require(_0x5055('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5055('0x4'));var auth=require(_0x5055('0x5'));var interaction=require(_0x5055('0x6'));var config=require(_0x5055('0x7'));var controller=require(_0x5055('0x8'));router['get']('/',auth[_0x5055('0x9')](),controller[_0x5055('0xa')]);router[_0x5055('0xb')]('/:id',auth[_0x5055('0x9')](),controller[_0x5055('0xc')]);router[_0x5055('0xd')]('/',auth[_0x5055('0x9')](),controller['create']);router[_0x5055('0xe')]('/:id',auth[_0x5055('0x9')](),controller['update']);router['delete'](_0x5055('0xf'),auth[_0x5055('0x9')](),controller[_0x5055('0x10')]);module[_0x5055('0x11')]=router; \ No newline at end of file +var _0x73fa=['get','isAuthenticated','index','show','/:id','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intVtigerField.controller'];(function(_0x722d30,_0x1633a3){var _0x22b826=function(_0x2fc0e0){while(--_0x2fc0e0){_0x722d30['push'](_0x722d30['shift']());}};_0x22b826(++_0x1633a3);}(_0x73fa,0x1ba));var _0xa73f=function(_0x3dc7d4,_0x4dc740){_0x3dc7d4=_0x3dc7d4-0x0;var _0x445bbb=_0x73fa[_0x3dc7d4];return _0x445bbb;};'use strict';var multer=require('multer');var util=require(_0xa73f('0x0'));var path=require(_0xa73f('0x1'));var timeout=require(_0xa73f('0x2'));var express=require(_0xa73f('0x3'));var router=express[_0xa73f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa73f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa73f('0x6'));var controller=require(_0xa73f('0x7'));router[_0xa73f('0x8')]('/',auth[_0xa73f('0x9')](),controller[_0xa73f('0xa')]);router[_0xa73f('0x8')]('/:id',auth[_0xa73f('0x9')](),controller[_0xa73f('0xb')]);router['post']('/',auth[_0xa73f('0x9')](),controller['create']);router['put'](_0xa73f('0xc'),auth[_0xa73f('0x9')](),controller[_0xa73f('0xd')]);router[_0xa73f('0xe')](_0xa73f('0xc'),auth[_0xa73f('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 3508f83..b5623eb 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 _0xd593=['picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x4e8e52,_0x1c0307){var _0x45ff54=function(_0x313662){while(--_0x313662){_0x4e8e52['push'](_0x4e8e52['shift']());}};_0x45ff54(++_0x1c0307);}(_0xd593,0x161));var _0x3d59=function(_0x3029f8,_0x24a853){_0x3029f8=_0x3029f8-0x0;var _0x32f0da=_0xd593[_0x3029f8];return _0x32f0da;};'use strict';var Sequelize=require(_0x3d59('0x0'));module[_0x3d59('0x1')]={'type':{'type':Sequelize[_0x3d59('0x2')](_0x3d59('0x3'),_0x3d59('0x4'),_0x3d59('0x5'),_0x3d59('0x6'),_0x3d59('0x7')),'defaultValue':_0x3d59('0x3')},'content':{'type':Sequelize[_0x3d59('0x8')]},'key':{'type':Sequelize[_0x3d59('0x8')]},'keyType':{'type':Sequelize[_0x3d59('0x2')]('string',_0x3d59('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3d59('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3d59('0x8')]}}; \ No newline at end of file +var _0x5bcb=['string','customVariable','picklist','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x5bcb,0xd7));var _0xb5bc=function(_0x1477db,_0x246281){_0x1477db=_0x1477db-0x0;var _0x2b3bd1=_0x5bcb[_0x1477db];return _0x2b3bd1;};'use strict';var Sequelize=require(_0xb5bc('0x0'));module['exports']={'type':{'type':Sequelize[_0xb5bc('0x1')](_0xb5bc('0x2'),'variable',_0xb5bc('0x3'),'keyValue',_0xb5bc('0x4')),'defaultValue':_0xb5bc('0x2')},'content':{'type':Sequelize[_0xb5bc('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb5bc('0x1')](_0xb5bc('0x2'),'variable',_0xb5bc('0x3'))},'keyContent':{'type':Sequelize[_0xb5bc('0x5')]},'idField':{'type':Sequelize[_0xb5bc('0x5')]},'nameField':{'type':Sequelize[_0xb5bc('0x5')]},'customField':{'type':Sequelize[_0xb5bc('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb5bc('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 9ab3fa4..d559aa8 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 _0x485f=['destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','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','Content-Range','apply','reject','save','update','then','end','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','type','VIRTUAL','merge','includeAll','findAll','rows','params','keys','length','include','VtigerField','find','catch','create','body'];(function(_0x516720,_0x6d0633){var _0x205537=function(_0x2f5d68){while(--_0x2f5d68){_0x516720['push'](_0x516720['shift']());}};_0x205537(++_0x6d0633);}(_0x485f,0x131));var _0xf485=function(_0x10f021,_0x51e5b6){_0x10f021=_0x10f021-0x0;var _0x56a4c8=_0x485f[_0x10f021];return _0x56a4c8;};'use strict';var emlformat=require(_0xf485('0x0'));var rimraf=require(_0xf485('0x1'));var zipdir=require(_0xf485('0x2'));var jsonpatch=require(_0xf485('0x3'));var rp=require(_0xf485('0x4'));var moment=require(_0xf485('0x5'));var BPromise=require(_0xf485('0x6'));var Mustache=require(_0xf485('0x7'));var util=require('util');var path=require(_0xf485('0x8'));var sox=require(_0xf485('0x9'));var csv=require(_0xf485('0xa'));var ejs=require(_0xf485('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf485('0xc'));var squel=require(_0xf485('0xd'));var crypto=require(_0xf485('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf485('0xa'));var querystring=require(_0xf485('0xf'));var Papa=require(_0xf485('0x10'));var Redis=require(_0xf485('0x11'));var authService=require(_0xf485('0x12'));var qs=require(_0xf485('0x13'));var as=require(_0xf485('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf485('0x15'))(_0xf485('0x16'));var utils=require(_0xf485('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf485('0x18'));var db=require(_0xf485('0x19'))['db'];function respondWithStatusCode(_0x2db8d8,_0x431b15){_0x431b15=_0x431b15||0xcc;return function(_0x1ccc67){if(_0x1ccc67){return _0x2db8d8[_0xf485('0x1a')](_0x431b15);}return _0x2db8d8[_0xf485('0x1b')](_0x431b15)['end']();};}function respondWithResult(_0x4adf2f,_0x17ad01){_0x17ad01=_0x17ad01||0xc8;return function(_0x3966dc){if(_0x3966dc){return _0x4adf2f[_0xf485('0x1b')](_0x17ad01)[_0xf485('0x1c')](_0x3966dc);}};}function respondWithFilteredResult(_0x327540,_0x8b2d0d){return function(_0x4cdc3a){if(_0x4cdc3a){var _0x4dd1ca=typeof _0x8b2d0d[_0xf485('0x1d')]===_0xf485('0x1e')&&typeof _0x8b2d0d[_0xf485('0x1f')]===_0xf485('0x1e');var _0xa2e2b1=_0x4cdc3a['count'];var _0x435c4e=_0x4dd1ca?0x0:_0x8b2d0d[_0xf485('0x1d')];var _0x3ecdad=_0x4dd1ca?_0x4cdc3a[_0xf485('0x20')]:_0x8b2d0d[_0xf485('0x1d')]+_0x8b2d0d['limit'];var _0x3a13c3;if(_0x3ecdad>=_0xa2e2b1){_0x3ecdad=_0xa2e2b1;_0x3a13c3=0xc8;}else{_0x3a13c3=0xce;}_0x327540[_0xf485('0x1b')](_0x3a13c3);return _0x327540['set'](_0xf485('0x21'),_0x435c4e+'-'+_0x3ecdad+'/'+_0xa2e2b1)[_0xf485('0x1c')](_0x4cdc3a);}return null;};}function patchUpdates(_0x56cad9){return function(_0x3bb5e1){try{jsonpatch[_0xf485('0x22')](_0x3bb5e1,_0x56cad9,!![]);}catch(_0x10022a){return BPromise[_0xf485('0x23')](_0x10022a);}return _0x3bb5e1[_0xf485('0x24')]();};}function saveUpdates(_0x1fa4eb,_0x11b2bc){return function(_0x40dfd8){if(_0x40dfd8){return _0x40dfd8[_0xf485('0x25')](_0x1fa4eb)['then'](function(_0x2c34b1){return _0x2c34b1;});}return null;};}function removeEntity(_0x23e413,_0x535874){return function(_0x3305df){if(_0x3305df){return _0x3305df['destroy']()[_0xf485('0x26')](function(){_0x23e413['status'](0xcc)[_0xf485('0x27')]();});}};}function handleEntityNotFound(_0x3352e8,_0x2f8c51){return function(_0x5d7992){if(!_0x5d7992){_0x3352e8[_0xf485('0x1a')](0x194);}return _0x5d7992;};}function handleError(_0x1cf3b4,_0x204bf3){_0x204bf3=_0x204bf3||0x1f4;return function(_0x1f507b){logger['error'](_0x1f507b[_0xf485('0x28')]);if(_0x1f507b['name']){delete _0x1f507b[_0xf485('0x29')];}_0x1cf3b4[_0xf485('0x1b')](_0x204bf3)[_0xf485('0x2a')](_0x1f507b);};}exports[_0xf485('0x2b')]=function(_0x1ac909,_0x4d5fe2){var _0x34482c={},_0x336c91={},_0x228a7a={'count':0x0,'rows':[]};var _0x35125a=_[_0xf485('0x2c')](db['VtigerField'][_0xf485('0x2d')],function(_0x43d0a2){return{'name':_0x43d0a2[_0xf485('0x2e')],'type':_0x43d0a2['type'][_0xf485('0x2f')]};});_0x336c91[_0xf485('0x30')]=_[_0xf485('0x2c')](_0x35125a,_0xf485('0x29'));_0x336c91['query']=_['keys'](_0x1ac909[_0xf485('0x31')]);_0x336c91['filters']=_[_0xf485('0x32')](_0x336c91[_0xf485('0x30')],_0x336c91[_0xf485('0x31')]);_0x34482c[_0xf485('0x33')]=_['intersection'](_0x336c91[_0xf485('0x30')],qs[_0xf485('0x34')](_0x1ac909[_0xf485('0x31')][_0xf485('0x34')]));_0x34482c[_0xf485('0x33')]=_0x34482c['attributes']['length']?_0x34482c['attributes']:_0x336c91[_0xf485('0x30')];if(!_0x1ac909['query'][_0xf485('0x35')](_0xf485('0x36'))){_0x34482c[_0xf485('0x1f')]=qs[_0xf485('0x1f')](_0x1ac909['query'][_0xf485('0x1f')]);_0x34482c[_0xf485('0x1d')]=qs[_0xf485('0x1d')](_0x1ac909[_0xf485('0x31')][_0xf485('0x1d')]);}_0x34482c[_0xf485('0x37')]=qs[_0xf485('0x38')](_0x1ac909['query']['sort']);_0x34482c[_0xf485('0x39')]=qs[_0xf485('0x3a')](_['pick'](_0x1ac909['query'],_0x336c91[_0xf485('0x3a')]),_0x35125a);if(_0x1ac909[_0xf485('0x31')][_0xf485('0x3b')]){_0x34482c[_0xf485('0x39')]=_['merge'](_0x34482c[_0xf485('0x39')],{'$or':_['map'](_0x35125a,function(_0x2260ba){if(_0x2260ba[_0xf485('0x3c')]!==_0xf485('0x3d')){var _0x38b340={};_0x38b340[_0x2260ba[_0xf485('0x29')]]={'$like':'%'+_0x1ac909['query'][_0xf485('0x3b')]+'%'};return _0x38b340;}})});}_0x34482c=_[_0xf485('0x3e')]({},_0x34482c,_0x1ac909['options']);var _0x2157a9={'where':_0x34482c[_0xf485('0x39')]};return db['VtigerField'][_0xf485('0x20')](_0x2157a9)[_0xf485('0x26')](function(_0x50ce1e){_0x228a7a[_0xf485('0x20')]=_0x50ce1e;if(_0x1ac909['query'][_0xf485('0x3f')]){_0x34482c['include']=[{'all':!![]}];}return db['VtigerField'][_0xf485('0x40')](_0x34482c);})[_0xf485('0x26')](function(_0x5bb767){_0x228a7a[_0xf485('0x41')]=_0x5bb767;return _0x228a7a;})[_0xf485('0x26')](respondWithFilteredResult(_0x4d5fe2,_0x34482c))['catch'](handleError(_0x4d5fe2,null));};exports['show']=function(_0x43c535,_0x11f4a8){var _0x5a6b77={'raw':!![],'where':{'id':_0x43c535[_0xf485('0x42')]['id']}},_0x460eaf={};_0x460eaf[_0xf485('0x30')]=_[_0xf485('0x43')](db['VtigerField'][_0xf485('0x2d')]);_0x460eaf[_0xf485('0x31')]=_[_0xf485('0x43')](_0x43c535[_0xf485('0x31')]);_0x460eaf[_0xf485('0x3a')]=_['intersection'](_0x460eaf[_0xf485('0x30')],_0x460eaf['query']);_0x5a6b77['attributes']=_[_0xf485('0x32')](_0x460eaf['model'],qs[_0xf485('0x34')](_0x43c535[_0xf485('0x31')][_0xf485('0x34')]));_0x5a6b77[_0xf485('0x33')]=_0x5a6b77[_0xf485('0x33')][_0xf485('0x44')]?_0x5a6b77[_0xf485('0x33')]:_0x460eaf[_0xf485('0x30')];if(_0x43c535[_0xf485('0x31')][_0xf485('0x3f')]){_0x5a6b77[_0xf485('0x45')]=[{'all':!![]}];}_0x5a6b77=_[_0xf485('0x3e')]({},_0x5a6b77,_0x43c535['options']);return db[_0xf485('0x46')][_0xf485('0x47')](_0x5a6b77)[_0xf485('0x26')](handleEntityNotFound(_0x11f4a8,null))[_0xf485('0x26')](respondWithResult(_0x11f4a8,null))[_0xf485('0x48')](handleError(_0x11f4a8,null));};exports[_0xf485('0x49')]=function(_0xd21fd6,_0x535246){return db[_0xf485('0x46')][_0xf485('0x49')](_0xd21fd6[_0xf485('0x4a')],{})[_0xf485('0x26')](respondWithResult(_0x535246,0xc9))['catch'](handleError(_0x535246,null));};exports[_0xf485('0x25')]=function(_0x4acf86,_0x3ab34f){if(_0x4acf86[_0xf485('0x4a')]['id']){delete _0x4acf86['body']['id'];}return db['VtigerField'][_0xf485('0x47')]({'where':{'id':_0x4acf86[_0xf485('0x42')]['id']}})[_0xf485('0x26')](handleEntityNotFound(_0x3ab34f,null))['then'](saveUpdates(_0x4acf86[_0xf485('0x4a')],null))[_0xf485('0x26')](respondWithResult(_0x3ab34f,null))['catch'](handleError(_0x3ab34f,null));};exports[_0xf485('0x4b')]=function(_0x202466,_0x5a0238){return db[_0xf485('0x46')][_0xf485('0x47')]({'where':{'id':_0x202466[_0xf485('0x42')]['id']}})[_0xf485('0x26')](handleEntityNotFound(_0x5a0238,null))['then'](removeEntity(_0x5a0238,null))[_0xf485('0x48')](handleError(_0x5a0238,null));}; \ No newline at end of file +var _0x604f=['crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','VIRTUAL','options','includeAll','findAll','rows','show','include','find','catch','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x604f,0x8a));var _0xf604=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x604f[_0x2aa0e7];return _0x1472c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf604('0x0'));var zipdir=require(_0xf604('0x1'));var jsonpatch=require(_0xf604('0x2'));var rp=require(_0xf604('0x3'));var moment=require(_0xf604('0x4'));var BPromise=require(_0xf604('0x5'));var Mustache=require(_0xf604('0x6'));var util=require('util');var path=require(_0xf604('0x7'));var sox=require(_0xf604('0x8'));var csv=require(_0xf604('0x9'));var ejs=require(_0xf604('0xa'));var fs=require('fs');var fs_extra=require(_0xf604('0xb'));var _=require(_0xf604('0xc'));var squel=require(_0xf604('0xd'));var crypto=require(_0xf604('0xe'));var jsforce=require(_0xf604('0xf'));var deskjs=require(_0xf604('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf604('0x11'));var Papa=require('papaparse');var Redis=require(_0xf604('0x12'));var authService=require(_0xf604('0x13'));var qs=require(_0xf604('0x14'));var as=require(_0xf604('0x15'));var hardwareService=require(_0xf604('0x16'));var logger=require('../../config/logger')(_0xf604('0x17'));var utils=require(_0xf604('0x18'));var config=require(_0xf604('0x19'));var licenseUtil=require(_0xf604('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x125242,_0x2ec3be){_0x2ec3be=_0x2ec3be||0xcc;return function(_0xb19fe9){if(_0xb19fe9){return _0x125242['sendStatus'](_0x2ec3be);}return _0x125242[_0xf604('0x1b')](_0x2ec3be)[_0xf604('0x1c')]();};}function respondWithResult(_0x282793,_0x2bd2e2){_0x2bd2e2=_0x2bd2e2||0xc8;return function(_0x33b0d9){if(_0x33b0d9){return _0x282793[_0xf604('0x1b')](_0x2bd2e2)['json'](_0x33b0d9);}};}function respondWithFilteredResult(_0xabbd90,_0x2670fb){return function(_0x254fc4){if(_0x254fc4){var _0xa6936e=typeof _0x2670fb['offset']===_0xf604('0x1d')&&typeof _0x2670fb[_0xf604('0x1e')]===_0xf604('0x1d');var _0x522a7f=_0x254fc4[_0xf604('0x1f')];var _0x1d0c4f=_0xa6936e?0x0:_0x2670fb[_0xf604('0x20')];var _0x201a83=_0xa6936e?_0x254fc4[_0xf604('0x1f')]:_0x2670fb[_0xf604('0x20')]+_0x2670fb[_0xf604('0x1e')];var _0x2ce583;if(_0x201a83>=_0x522a7f){_0x201a83=_0x522a7f;_0x2ce583=0xc8;}else{_0x2ce583=0xce;}_0xabbd90[_0xf604('0x1b')](_0x2ce583);return _0xabbd90[_0xf604('0x21')](_0xf604('0x22'),_0x1d0c4f+'-'+_0x201a83+'/'+_0x522a7f)[_0xf604('0x23')](_0x254fc4);}return null;};}function patchUpdates(_0x2ead29){return function(_0x2a40f9){try{jsonpatch['apply'](_0x2a40f9,_0x2ead29,!![]);}catch(_0x4f2317){return BPromise[_0xf604('0x24')](_0x4f2317);}return _0x2a40f9[_0xf604('0x25')]();};}function saveUpdates(_0x1bfb44,_0x5c638c){return function(_0x14102d){if(_0x14102d){return _0x14102d[_0xf604('0x26')](_0x1bfb44)[_0xf604('0x27')](function(_0x286f1e){return _0x286f1e;});}return null;};}function removeEntity(_0x4eda39,_0x488c7f){return function(_0x40b7e5){if(_0x40b7e5){return _0x40b7e5[_0xf604('0x28')]()[_0xf604('0x27')](function(){_0x4eda39[_0xf604('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30c3e0,_0x5125b9){return function(_0x31f84d){if(!_0x31f84d){_0x30c3e0[_0xf604('0x29')](0x194);}return _0x31f84d;};}function handleError(_0x71b344,_0x443607){_0x443607=_0x443607||0x1f4;return function(_0x2bf024){logger[_0xf604('0x2a')](_0x2bf024[_0xf604('0x2b')]);if(_0x2bf024['name']){delete _0x2bf024[_0xf604('0x2c')];}_0x71b344[_0xf604('0x1b')](_0x443607)[_0xf604('0x2d')](_0x2bf024);};}exports[_0xf604('0x2e')]=function(_0x3e7be4,_0x423abc){var _0x988567={},_0x5106ee={},_0x3e3a8a={'count':0x0,'rows':[]};var _0x348b3d=_[_0xf604('0x2f')](db[_0xf604('0x30')][_0xf604('0x31')],function(_0x3cdb56){return{'name':_0x3cdb56[_0xf604('0x32')],'type':_0x3cdb56[_0xf604('0x33')]['key']};});_0x5106ee[_0xf604('0x34')]=_['map'](_0x348b3d,_0xf604('0x2c'));_0x5106ee['query']=_[_0xf604('0x35')](_0x3e7be4[_0xf604('0x36')]);_0x5106ee[_0xf604('0x37')]=_[_0xf604('0x38')](_0x5106ee['model'],_0x5106ee[_0xf604('0x36')]);_0x988567[_0xf604('0x39')]=_['intersection'](_0x5106ee['model'],qs[_0xf604('0x3a')](_0x3e7be4[_0xf604('0x36')][_0xf604('0x3a')]));_0x988567[_0xf604('0x39')]=_0x988567[_0xf604('0x39')]['length']?_0x988567['attributes']:_0x5106ee[_0xf604('0x34')];if(!_0x3e7be4['query'][_0xf604('0x3b')]('nolimit')){_0x988567['limit']=qs['limit'](_0x3e7be4[_0xf604('0x36')]['limit']);_0x988567[_0xf604('0x20')]=qs[_0xf604('0x20')](_0x3e7be4[_0xf604('0x36')][_0xf604('0x20')]);}_0x988567[_0xf604('0x3c')]=qs[_0xf604('0x3d')](_0x3e7be4['query']['sort']);_0x988567[_0xf604('0x3e')]=qs['filters'](_['pick'](_0x3e7be4[_0xf604('0x36')],_0x5106ee[_0xf604('0x37')]),_0x348b3d);if(_0x3e7be4[_0xf604('0x36')][_0xf604('0x3f')]){_0x988567[_0xf604('0x3e')]=_['merge'](_0x988567[_0xf604('0x3e')],{'$or':_[_0xf604('0x2f')](_0x348b3d,function(_0x30cf72){if(_0x30cf72[_0xf604('0x33')]!==_0xf604('0x40')){var _0x47b54b={};_0x47b54b[_0x30cf72[_0xf604('0x2c')]]={'$like':'%'+_0x3e7be4[_0xf604('0x36')]['filter']+'%'};return _0x47b54b;}})});}_0x988567=_['merge']({},_0x988567,_0x3e7be4[_0xf604('0x41')]);var _0x2802f6={'where':_0x988567['where']};return db[_0xf604('0x30')][_0xf604('0x1f')](_0x2802f6)['then'](function(_0x5acebb){_0x3e3a8a[_0xf604('0x1f')]=_0x5acebb;if(_0x3e7be4[_0xf604('0x36')][_0xf604('0x42')]){_0x988567['include']=[{'all':!![]}];}return db[_0xf604('0x30')][_0xf604('0x43')](_0x988567);})[_0xf604('0x27')](function(_0x16fc6c){_0x3e3a8a[_0xf604('0x44')]=_0x16fc6c;return _0x3e3a8a;})[_0xf604('0x27')](respondWithFilteredResult(_0x423abc,_0x988567))['catch'](handleError(_0x423abc,null));};exports[_0xf604('0x45')]=function(_0x48df4a,_0x188f3e){var _0x3188f9={'raw':!![],'where':{'id':_0x48df4a['params']['id']}},_0x3d1d6c={};_0x3d1d6c['model']=_['keys'](db['VtigerField'][_0xf604('0x31')]);_0x3d1d6c[_0xf604('0x36')]=_[_0xf604('0x35')](_0x48df4a[_0xf604('0x36')]);_0x3d1d6c['filters']=_['intersection'](_0x3d1d6c[_0xf604('0x34')],_0x3d1d6c[_0xf604('0x36')]);_0x3188f9['attributes']=_[_0xf604('0x38')](_0x3d1d6c[_0xf604('0x34')],qs[_0xf604('0x3a')](_0x48df4a[_0xf604('0x36')][_0xf604('0x3a')]));_0x3188f9[_0xf604('0x39')]=_0x3188f9[_0xf604('0x39')]['length']?_0x3188f9[_0xf604('0x39')]:_0x3d1d6c[_0xf604('0x34')];if(_0x48df4a[_0xf604('0x36')][_0xf604('0x42')]){_0x3188f9[_0xf604('0x46')]=[{'all':!![]}];}_0x3188f9=_['merge']({},_0x3188f9,_0x48df4a['options']);return db[_0xf604('0x30')][_0xf604('0x47')](_0x3188f9)['then'](handleEntityNotFound(_0x188f3e,null))[_0xf604('0x27')](respondWithResult(_0x188f3e,null))[_0xf604('0x48')](handleError(_0x188f3e,null));};exports[_0xf604('0x49')]=function(_0x5cf458,_0x393550){return db[_0xf604('0x30')][_0xf604('0x49')](_0x5cf458[_0xf604('0x4a')],{})[_0xf604('0x27')](respondWithResult(_0x393550,0xc9))[_0xf604('0x48')](handleError(_0x393550,null));};exports[_0xf604('0x26')]=function(_0x4a3def,_0x2c5937){if(_0x4a3def[_0xf604('0x4a')]['id']){delete _0x4a3def[_0xf604('0x4a')]['id'];}return db[_0xf604('0x30')]['find']({'where':{'id':_0x4a3def[_0xf604('0x4b')]['id']}})[_0xf604('0x27')](handleEntityNotFound(_0x2c5937,null))[_0xf604('0x27')](saveUpdates(_0x4a3def['body'],null))[_0xf604('0x27')](respondWithResult(_0x2c5937,null))[_0xf604('0x48')](handleError(_0x2c5937,null));};exports[_0xf604('0x28')]=function(_0x2ad52e,_0x14f14f){return db[_0xf604('0x30')][_0xf604('0x47')]({'where':{'id':_0x2ad52e[_0xf604('0x4b')]['id']}})[_0xf604('0x27')](handleEntityNotFound(_0x14f14f,null))['then'](removeEntity(_0x14f14f,null))[_0xf604('0x48')](handleError(_0x14f14f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index ed38abc..fe2fbda 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 _0x9017=['idField','FieldId','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField','vtiger_unique_index'];(function(_0x4c7b1a,_0x40f5e9){var _0x40da32=function(_0x41e7c5){while(--_0x41e7c5){_0x4c7b1a['push'](_0x4c7b1a['shift']());}};_0x40da32(++_0x40f5e9);}(_0x9017,0x77));var _0x7901=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9017[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7901('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7901('0x1'));var moment=require(_0x7901('0x2'));var BPromise=require(_0x7901('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7901('0x4'));var rimraf=require(_0x7901('0x5'));var config=require(_0x7901('0x6'));var attributes=require(_0x7901('0x7'));module[_0x7901('0x8')]=function(_0x52b88d,_0x418ad3){return _0x52b88d['define'](_0x7901('0x9'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7901('0xa'),'fields':[_0x7901('0xb'),_0x7901('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb1c6=['FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index'];(function(_0x61f606,_0x1326ea){var _0x365cab=function(_0xf04d63){while(--_0xf04d63){_0x61f606['push'](_0x61f606['shift']());}};_0x365cab(++_0x1326ea);}(_0xb1c6,0x9b));var _0x6b1c=function(_0x2f6af4,_0x2875fc){_0x2f6af4=_0x2f6af4-0x0;var _0xa5f3be=_0xb1c6[_0x2f6af4];return _0xa5f3be;};'use strict';var _=require(_0x6b1c('0x0'));var util=require('util');var logger=require(_0x6b1c('0x1'))(_0x6b1c('0x2'));var moment=require('moment');var BPromise=require(_0x6b1c('0x3'));var rp=require(_0x6b1c('0x4'));var fs=require('fs');var path=require(_0x6b1c('0x5'));var rimraf=require('rimraf');var config=require(_0x6b1c('0x6'));var attributes=require(_0x6b1c('0x7'));module[_0x6b1c('0x8')]=function(_0x55b60b,_0x585ff5){return _0x55b60b[_0x6b1c('0x9')](_0x6b1c('0xa'),attributes,{'tableName':_0x6b1c('0xb'),'paranoid':![],'indexes':[{'name':_0x6b1c('0xc'),'fields':['idField',_0x6b1c('0xd')],'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 3892c98..c8d2585 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 _0x89be=['../../config/environment','jayson/promise','client','http','info','request\x20sent','error','code','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x400e2d,_0x330808){var _0x44d167=function(_0x5a6b27){while(--_0x5a6b27){_0x400e2d['push'](_0x400e2d['shift']());}};_0x44d167(++_0x330808);}(_0x89be,0x19b));var _0xe89b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x89be[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe89b('0x0'));var util=require(_0xe89b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe89b('0x2'));var fs=require('fs');var Redis=require(_0xe89b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe89b('0x4'));var logger=require(_0xe89b('0x5'))(_0xe89b('0x6'));var config=require(_0xe89b('0x7'));var jayson=require(_0xe89b('0x8'));var client=jayson[_0xe89b('0x9')][_0xe89b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf62c97,_0x1824cb,_0x3f626e){return new BPromise(function(_0x18435b,_0x3a6947){return client['request'](_0xf62c97,_0x3f626e)['then'](function(_0x2f4bf1){logger[_0xe89b('0xb')]('VtigerField,\x20%s,\x20%s',_0x1824cb,_0xe89b('0xc'));logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x1824cb,_0xe89b('0xc'),JSON['stringify'](_0x2f4bf1));if(_0x2f4bf1[_0xe89b('0xd')]){if(_0x2f4bf1['error'][_0xe89b('0xe')]===0x1f4){logger[_0xe89b('0xd')](_0xe89b('0xf'),_0x1824cb,_0x2f4bf1[_0xe89b('0xd')][_0xe89b('0x10')]);return _0x3a6947(_0x2f4bf1[_0xe89b('0xd')][_0xe89b('0x10')]);}logger[_0xe89b('0xd')](_0xe89b('0xf'),_0x1824cb,_0x2f4bf1[_0xe89b('0xd')][_0xe89b('0x10')]);return _0x18435b(_0x2f4bf1['error'][_0xe89b('0x10')]);}else{logger[_0xe89b('0xb')](_0xe89b('0xf'),_0x1824cb,'request\x20sent');_0x18435b(_0x2f4bf1[_0xe89b('0x11')][_0xe89b('0x10')]);}})[_0xe89b('0x12')](function(_0x4d214d){logger[_0xe89b('0xd')]('VtigerField,\x20%s,\x20%s',_0x1824cb,_0x4d214d);_0x3a6947(_0x4d214d);});});} \ No newline at end of file +var _0x5f3a=['code','message','VtigerField,\x20%s,\x20%s','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1abbd1,_0x26581f){var _0x41a7f2=function(_0x3e8820){while(--_0x3e8820){_0x1abbd1['push'](_0x1abbd1['shift']());}};_0x41a7f2(++_0x26581f);}(_0x5f3a,0x16d));var _0xa5f3=function(_0x4082d7,_0x963f0c){_0x4082d7=_0x4082d7-0x0;var _0x5a96d7=_0x5f3a[_0x4082d7];return _0x5a96d7;};'use strict';var _=require(_0xa5f3('0x0'));var util=require(_0xa5f3('0x1'));var moment=require(_0xa5f3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa5f3('0x3'));var db=require(_0xa5f3('0x4'))['db'];var utils=require(_0xa5f3('0x5'));var logger=require(_0xa5f3('0x6'))(_0xa5f3('0x7'));var config=require(_0xa5f3('0x8'));var jayson=require(_0xa5f3('0x9'));var client=jayson['client'][_0xa5f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc25bf1,_0x2a1b08,_0x1b73bc){return new BPromise(function(_0x4ea4b6,_0x4a6896){return client[_0xa5f3('0xb')](_0xc25bf1,_0x1b73bc)[_0xa5f3('0xc')](function(_0x3261c7){logger[_0xa5f3('0xd')]('VtigerField,\x20%s,\x20%s',_0x2a1b08,'request\x20sent');logger[_0xa5f3('0xe')](_0xa5f3('0xf'),_0x2a1b08,_0xa5f3('0x10'),JSON[_0xa5f3('0x11')](_0x3261c7));if(_0x3261c7[_0xa5f3('0x12')]){if(_0x3261c7[_0xa5f3('0x12')][_0xa5f3('0x13')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x2a1b08,_0x3261c7['error'][_0xa5f3('0x14')]);return _0x4a6896(_0x3261c7[_0xa5f3('0x12')][_0xa5f3('0x14')]);}logger[_0xa5f3('0x12')]('VtigerField,\x20%s,\x20%s',_0x2a1b08,_0x3261c7[_0xa5f3('0x12')][_0xa5f3('0x14')]);return _0x4ea4b6(_0x3261c7[_0xa5f3('0x12')][_0xa5f3('0x14')]);}else{logger[_0xa5f3('0xd')](_0xa5f3('0x15'),_0x2a1b08,'request\x20sent');_0x4ea4b6(_0x3261c7[_0xa5f3('0x16')]['message']);}})[_0xa5f3('0x17')](function(_0x5e4271){logger[_0xa5f3('0x12')](_0xa5f3('0x15'),_0x2a1b08,_0x5e4271);_0x4a6896(_0x5e4271);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 6bc151e..1ce52ef 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 _0x6d58=['./intZendeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','put','update','delete','destroy','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x40b72c,_0x179f5a){var _0x5c6e55=function(_0x764367){while(--_0x764367){_0x40b72c['push'](_0x40b72c['shift']());}};_0x5c6e55(++_0x179f5a);}(_0x6d58,0x7e));var _0x86d5=function(_0x4c57e1,_0xff3e73){_0x4c57e1=_0x4c57e1-0x0;var _0x473f20=_0x6d58[_0x4c57e1];return _0x473f20;};'use strict';var multer=require('multer');var util=require(_0x86d5('0x0'));var path=require(_0x86d5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x86d5('0x2')]();var fs_extra=require(_0x86d5('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x86d5('0x4'));var config=require(_0x86d5('0x5'));var controller=require(_0x86d5('0x6'));router['get']('/',auth[_0x86d5('0x7')](),controller[_0x86d5('0x8')]);router[_0x86d5('0x9')](_0x86d5('0xa'),auth[_0x86d5('0x7')](),controller[_0x86d5('0xb')]);router[_0x86d5('0x9')](_0x86d5('0xc'),auth['isAuthenticated'](),controller[_0x86d5('0xd')]);router[_0x86d5('0x9')]('/:id/fields',auth[_0x86d5('0x7')](),controller[_0x86d5('0xe')]);router['post']('/',auth[_0x86d5('0x7')](),controller[_0x86d5('0xf')]);router[_0x86d5('0x10')](_0x86d5('0xc'),auth['isAuthenticated'](),controller[_0x86d5('0x11')]);router[_0x86d5('0x12')](_0x86d5('0xa'),auth[_0x86d5('0x7')](),controller[_0x86d5('0x13')]);router[_0x86d5('0x14')](_0x86d5('0xa'),auth[_0x86d5('0x7')](),controller[_0x86d5('0x15')]);module['exports']=router; \ No newline at end of file +var _0x6385=['delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated','get','show','/:id/configurations','/:id/fields','getFields','post','create','put'];(function(_0x4a60d5,_0x3c81eb){var _0x34c466=function(_0x8dca28){while(--_0x8dca28){_0x4a60d5['push'](_0x4a60d5['shift']());}};_0x34c466(++_0x3c81eb);}(_0x6385,0xf9));var _0x5638=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0x6385[_0x1afabf];return _0x497ff1;};'use strict';var multer=require(_0x5638('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5638('0x1'));var express=require(_0x5638('0x2'));var router=express[_0x5638('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5638('0x4'));var interaction=require(_0x5638('0x5'));var config=require(_0x5638('0x6'));var controller=require(_0x5638('0x7'));router['get']('/',auth[_0x5638('0x8')](),controller['index']);router[_0x5638('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x5638('0xa')]);router[_0x5638('0x9')](_0x5638('0xb'),auth[_0x5638('0x8')](),controller['getConfigurations']);router['get'](_0x5638('0xc'),auth[_0x5638('0x8')](),controller[_0x5638('0xd')]);router[_0x5638('0xe')]('/',auth['isAuthenticated'](),controller[_0x5638('0xf')]);router['post'](_0x5638('0xb'),auth[_0x5638('0x8')](),controller['addConfiguration']);router[_0x5638('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x5638('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x5638('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 42424dd..90dbaca 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 _0xb4b6=['username','remoteUri','password','ENUM','integrationTab','newTab','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb4b6,0x7e));var _0x6b4b=function(_0x43fe69,_0x26857a){_0x43fe69=_0x43fe69-0x0;var _0x3ec208=_0xb4b6[_0x43fe69];return _0x3ec208;};'use strict';var Sequelize=require('sequelize');module[_0x6b4b('0x0')]={'name':{'type':Sequelize[_0x6b4b('0x1')]},'description':{'type':Sequelize[_0x6b4b('0x1')]},'username':{'type':Sequelize[_0x6b4b('0x1')],'unique':_0x6b4b('0x2')},'password':{'type':Sequelize[_0x6b4b('0x1')]},'token':{'type':Sequelize[_0x6b4b('0x1')]},'remoteUri':{'type':Sequelize[_0x6b4b('0x1')],'unique':_0x6b4b('0x3')},'authType':{'type':Sequelize['ENUM'](_0x6b4b('0x4'),'token'),'defaultValue':_0x6b4b('0x4')},'serverUrl':{'type':Sequelize[_0x6b4b('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x6b4b('0x5')](_0x6b4b('0x6'),_0x6b4b('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xc1fc=['password','integrationTab','newTab','exports','STRING','username','remoteUri','ENUM'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xc1fc,0x93));var _0xcc1f=function(_0x113d48,_0x46236b){_0x113d48=_0x113d48-0x0;var _0x22030f=_0xc1fc[_0x113d48];return _0x22030f;};'use strict';var Sequelize=require('sequelize');module[_0xcc1f('0x0')]={'name':{'type':Sequelize[_0xcc1f('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xcc1f('0x1')],'unique':_0xcc1f('0x2')},'password':{'type':Sequelize[_0xcc1f('0x1')]},'token':{'type':Sequelize[_0xcc1f('0x1')]},'remoteUri':{'type':Sequelize[_0xcc1f('0x1')],'unique':_0xcc1f('0x3')},'authType':{'type':Sequelize[_0xcc1f('0x4')](_0xcc1f('0x5'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xcc1f('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xcc1f('0x4')](_0xcc1f('0x6'),_0xcc1f('0x7')),'defaultValue':_0xcc1f('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 48f82e5..7b4ef3e 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 _0xc900=['query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','rawAttributes','intersection','includeAll','find','create','body','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','password','token','authType','remoteUri','substring','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','username','toString','base64','ValidationError','Unknown\x20authentication\x20type','subject','group','remove','includes','title','position','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','ZendeskAccount','fieldName','type','model'];(function(_0x5657bd,_0x10b346){var _0x263cf4=function(_0x1f3c21){while(--_0x1f3c21){_0x5657bd['push'](_0x5657bd['shift']());}};_0x263cf4(++_0x10b346);}(_0xc900,0xb3));var _0x0c90=function(_0x386969,_0x5b0f83){_0x386969=_0x386969-0x0;var _0x4cb3e5=_0xc900[_0x386969];return _0x4cb3e5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0c90('0x0'));var jsonpatch=require(_0x0c90('0x1'));var rp=require(_0x0c90('0x2'));var moment=require('moment');var BPromise=require(_0x0c90('0x3'));var Mustache=require(_0x0c90('0x4'));var util=require('util');var path=require(_0x0c90('0x5'));var sox=require(_0x0c90('0x6'));var csv=require(_0x0c90('0x7'));var ejs=require(_0x0c90('0x8'));var fs=require('fs');var fs_extra=require(_0x0c90('0x9'));var _=require(_0x0c90('0xa'));var squel=require('squel');var crypto=require(_0x0c90('0xb'));var jsforce=require(_0x0c90('0xc'));var deskjs=require(_0x0c90('0xd'));var toCsv=require(_0x0c90('0x7'));var querystring=require(_0x0c90('0xe'));var Papa=require(_0x0c90('0xf'));var Redis=require(_0x0c90('0x10'));var authService=require(_0x0c90('0x11'));var qs=require(_0x0c90('0x12'));var as=require(_0x0c90('0x13'));var hardwareService=require(_0x0c90('0x14'));var logger=require(_0x0c90('0x15'))(_0x0c90('0x16'));var utils=require('../../config/utils');var config=require(_0x0c90('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c90('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x459cdb,_0x26fc46){_0x26fc46=_0x26fc46||0xcc;return function(_0x4535a2){if(_0x4535a2){return _0x459cdb[_0x0c90('0x19')](_0x26fc46);}return _0x459cdb[_0x0c90('0x1a')](_0x26fc46)['end']();};}function respondWithResult(_0x467b32,_0x4451e0){_0x4451e0=_0x4451e0||0xc8;return function(_0x4f35f4){if(_0x4f35f4){return _0x467b32[_0x0c90('0x1a')](_0x4451e0)[_0x0c90('0x1b')](_0x4f35f4);}};}function respondWithFilteredResult(_0x3bd5e8,_0x5bef7d){return function(_0x5daeb7){if(_0x5daeb7){var _0x412635=typeof _0x5bef7d[_0x0c90('0x1c')]===_0x0c90('0x1d')&&typeof _0x5bef7d[_0x0c90('0x1e')]===_0x0c90('0x1d');var _0x2cab22=_0x5daeb7[_0x0c90('0x1f')];var _0x57b9a6=_0x412635?0x0:_0x5bef7d[_0x0c90('0x1c')];var _0x38becc=_0x412635?_0x5daeb7[_0x0c90('0x1f')]:_0x5bef7d[_0x0c90('0x1c')]+_0x5bef7d['limit'];var _0x10a775;if(_0x38becc>=_0x2cab22){_0x38becc=_0x2cab22;_0x10a775=0xc8;}else{_0x10a775=0xce;}_0x3bd5e8[_0x0c90('0x1a')](_0x10a775);return _0x3bd5e8[_0x0c90('0x20')](_0x0c90('0x21'),_0x57b9a6+'-'+_0x38becc+'/'+_0x2cab22)[_0x0c90('0x1b')](_0x5daeb7);}return null;};}function patchUpdates(_0xc08f54){return function(_0x4cc940){try{jsonpatch[_0x0c90('0x22')](_0x4cc940,_0xc08f54,!![]);}catch(_0x4d629f){return BPromise[_0x0c90('0x23')](_0x4d629f);}return _0x4cc940[_0x0c90('0x24')]();};}function saveUpdates(_0x47b13c,_0x2a053a){return function(_0x43ddc3){if(_0x43ddc3){return _0x43ddc3[_0x0c90('0x25')](_0x47b13c)[_0x0c90('0x26')](function(_0x212164){return _0x212164;});}return null;};}function removeEntity(_0x3b287c,_0x4dfbc3){return function(_0x26f0a3){if(_0x26f0a3){return _0x26f0a3[_0x0c90('0x27')]()['then'](function(){_0x3b287c['status'](0xcc)[_0x0c90('0x28')]();});}};}function handleEntityNotFound(_0x3ea861,_0x35c243){return function(_0x109a5f){if(!_0x109a5f){_0x3ea861['sendStatus'](0x194);}return _0x109a5f;};}function handleError(_0x2dfa14,_0x438652){_0x438652=_0x438652||0x1f4;return function(_0xeb7f58){logger[_0x0c90('0x29')](_0xeb7f58[_0x0c90('0x2a')]);if(_0xeb7f58[_0x0c90('0x2b')]){delete _0xeb7f58['name'];}_0x2dfa14[_0x0c90('0x1a')](_0x438652)[_0x0c90('0x2c')](_0xeb7f58);};}exports[_0x0c90('0x2d')]=function(_0x13b377,_0x52d28d){var _0x4c8603={},_0x1f27f1={},_0x25da6e={'count':0x0,'rows':[]};var _0x3bff04=_[_0x0c90('0x2e')](db[_0x0c90('0x2f')]['rawAttributes'],function(_0x120136){return{'name':_0x120136[_0x0c90('0x30')],'type':_0x120136[_0x0c90('0x31')]['key']};});_0x1f27f1[_0x0c90('0x32')]=_['map'](_0x3bff04,'name');_0x1f27f1[_0x0c90('0x33')]=_[_0x0c90('0x34')](_0x13b377[_0x0c90('0x33')]);_0x1f27f1[_0x0c90('0x35')]=_['intersection'](_0x1f27f1[_0x0c90('0x32')],_0x1f27f1['query']);_0x4c8603[_0x0c90('0x36')]=_['intersection'](_0x1f27f1[_0x0c90('0x32')],qs[_0x0c90('0x37')](_0x13b377['query'][_0x0c90('0x37')]));_0x4c8603[_0x0c90('0x36')]=_0x4c8603[_0x0c90('0x36')][_0x0c90('0x38')]?_0x4c8603[_0x0c90('0x36')]:_0x1f27f1[_0x0c90('0x32')];if(!_0x13b377[_0x0c90('0x33')][_0x0c90('0x39')]('nolimit')){_0x4c8603[_0x0c90('0x1e')]=qs[_0x0c90('0x1e')](_0x13b377[_0x0c90('0x33')][_0x0c90('0x1e')]);_0x4c8603['offset']=qs[_0x0c90('0x1c')](_0x13b377[_0x0c90('0x33')][_0x0c90('0x1c')]);}_0x4c8603[_0x0c90('0x3a')]=qs[_0x0c90('0x3b')](_0x13b377[_0x0c90('0x33')][_0x0c90('0x3b')]);_0x4c8603[_0x0c90('0x3c')]=qs['filters'](_[_0x0c90('0x3d')](_0x13b377[_0x0c90('0x33')],_0x1f27f1['filters']),_0x3bff04);if(_0x13b377[_0x0c90('0x33')][_0x0c90('0x3e')]){_0x4c8603[_0x0c90('0x3c')]=_[_0x0c90('0x3f')](_0x4c8603[_0x0c90('0x3c')],{'$or':_['map'](_0x3bff04,function(_0x2f1d95){if(_0x2f1d95[_0x0c90('0x31')]!==_0x0c90('0x40')){var _0x2bca69={};_0x2bca69[_0x2f1d95[_0x0c90('0x2b')]]={'$like':'%'+_0x13b377[_0x0c90('0x33')][_0x0c90('0x3e')]+'%'};return _0x2bca69;}})});}_0x4c8603=_[_0x0c90('0x3f')]({},_0x4c8603,_0x13b377[_0x0c90('0x41')]);var _0x4f0227={'where':_0x4c8603[_0x0c90('0x3c')]};return db['ZendeskAccount'][_0x0c90('0x1f')](_0x4f0227)['then'](function(_0xb126ef){_0x25da6e[_0x0c90('0x1f')]=_0xb126ef;if(_0x13b377['query']['includeAll']){_0x4c8603[_0x0c90('0x42')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x0c90('0x43')](_0x4c8603);})[_0x0c90('0x26')](function(_0x373f9f){_0x25da6e['rows']=_0x373f9f;return _0x25da6e;})[_0x0c90('0x26')](respondWithFilteredResult(_0x52d28d,_0x4c8603))[_0x0c90('0x44')](handleError(_0x52d28d,null));};exports[_0x0c90('0x45')]=function(_0x3e5137,_0x2139c3){var _0x1184c4={'raw':![],'where':{'id':_0x3e5137[_0x0c90('0x46')]['id']}},_0x565b10={};_0x565b10[_0x0c90('0x32')]=_[_0x0c90('0x34')](db[_0x0c90('0x2f')][_0x0c90('0x47')]);_0x565b10[_0x0c90('0x33')]=_[_0x0c90('0x34')](_0x3e5137['query']);_0x565b10[_0x0c90('0x35')]=_['intersection'](_0x565b10[_0x0c90('0x32')],_0x565b10[_0x0c90('0x33')]);_0x1184c4[_0x0c90('0x36')]=_[_0x0c90('0x48')](_0x565b10[_0x0c90('0x32')],qs[_0x0c90('0x37')](_0x3e5137[_0x0c90('0x33')][_0x0c90('0x37')]));_0x1184c4[_0x0c90('0x36')]=_0x1184c4[_0x0c90('0x36')][_0x0c90('0x38')]?_0x1184c4[_0x0c90('0x36')]:_0x565b10[_0x0c90('0x32')];if(_0x3e5137[_0x0c90('0x33')][_0x0c90('0x49')]){_0x1184c4['include']=[{'all':!![]}];}_0x1184c4=_[_0x0c90('0x3f')]({},_0x1184c4,_0x3e5137[_0x0c90('0x41')]);return db[_0x0c90('0x2f')][_0x0c90('0x4a')](_0x1184c4)[_0x0c90('0x26')](handleEntityNotFound(_0x2139c3,null))[_0x0c90('0x26')](respondWithResult(_0x2139c3,null))[_0x0c90('0x44')](handleError(_0x2139c3,null));};exports[_0x0c90('0x4b')]=function(_0x3bb138,_0x3af64f){return db[_0x0c90('0x2f')][_0x0c90('0x4b')](_0x3bb138[_0x0c90('0x4c')],{})[_0x0c90('0x26')](respondWithResult(_0x3af64f,0xc9))['catch'](handleError(_0x3af64f,null));};exports[_0x0c90('0x25')]=function(_0x38f492,_0x553fea){if(_0x38f492['body']['id']){delete _0x38f492['body']['id'];}return db[_0x0c90('0x2f')][_0x0c90('0x4a')]({'where':{'id':_0x38f492[_0x0c90('0x46')]['id']}})[_0x0c90('0x26')](handleEntityNotFound(_0x553fea,null))[_0x0c90('0x26')](saveUpdates(_0x38f492['body'],null))[_0x0c90('0x26')](respondWithResult(_0x553fea,null))[_0x0c90('0x44')](handleError(_0x553fea,null));};exports[_0x0c90('0x27')]=function(_0x549c78,_0x119776){return db[_0x0c90('0x2f')][_0x0c90('0x4a')]({'where':{'id':_0x549c78[_0x0c90('0x46')]['id']}})[_0x0c90('0x26')](handleEntityNotFound(_0x119776,null))[_0x0c90('0x26')](removeEntity(_0x119776,null))[_0x0c90('0x44')](handleError(_0x119776,null));};exports[_0x0c90('0x4d')]=function(_0x1daeed,_0xeeee3b,_0x5e288e){var _0xac80b2={};var _0x4ba9e7={};var _0xda4331;var _0x67539d;return db[_0x0c90('0x2f')][_0x0c90('0x4e')]({'where':{'id':_0x1daeed[_0x0c90('0x46')]['id']}})[_0x0c90('0x26')](handleEntityNotFound(_0xeeee3b,null))['then'](function(_0x4930fc){if(_0x4930fc){_0xda4331=_0x4930fc;_0x4ba9e7['model']=_['keys'](db[_0x0c90('0x4f')][_0x0c90('0x47')]);_0x4ba9e7[_0x0c90('0x33')]=_['keys'](_0x1daeed[_0x0c90('0x33')]);_0x4ba9e7[_0x0c90('0x35')]=_['intersection'](_0x4ba9e7[_0x0c90('0x32')],_0x4ba9e7['query']);_0xac80b2[_0x0c90('0x36')]=_[_0x0c90('0x48')](_0x4ba9e7[_0x0c90('0x32')],qs[_0x0c90('0x37')](_0x1daeed['query'][_0x0c90('0x37')]));_0xac80b2['attributes']=_0xac80b2[_0x0c90('0x36')][_0x0c90('0x38')]?_0xac80b2['attributes']:_0x4ba9e7['model'];_0xac80b2['order']=qs[_0x0c90('0x3b')](_0x1daeed[_0x0c90('0x33')][_0x0c90('0x3b')]);_0xac80b2[_0x0c90('0x3c')]=qs[_0x0c90('0x35')](_['pick'](_0x1daeed[_0x0c90('0x33')],_0x4ba9e7[_0x0c90('0x35')]));if(_0x1daeed['query'][_0x0c90('0x3e')]){_0xac80b2['where']=_[_0x0c90('0x3f')](_0xac80b2[_0x0c90('0x3c')],{'$or':_['map'](_0xac80b2[_0x0c90('0x36')],function(_0x5baf85){var _0x4de11a={};_0x4de11a[_0x5baf85]={'$like':'%'+_0x1daeed['query'][_0x0c90('0x3e')]+'%'};return _0x4de11a;})});}_0xac80b2=_[_0x0c90('0x3f')]({},_0xac80b2,_0x1daeed[_0x0c90('0x41')]);return _0xda4331[_0x0c90('0x4d')](_0xac80b2);}})['then'](function(_0x5b385b){if(_0x5b385b){_0x67539d=_0x5b385b[_0x0c90('0x38')];if(!_0x1daeed[_0x0c90('0x33')][_0x0c90('0x39')]('nolimit')){_0xac80b2[_0x0c90('0x1e')]=qs[_0x0c90('0x1e')](_0x1daeed[_0x0c90('0x33')]['limit']);_0xac80b2[_0x0c90('0x1c')]=qs[_0x0c90('0x1c')](_0x1daeed[_0x0c90('0x33')]['offset']);}return _0xda4331[_0x0c90('0x4d')](_0xac80b2);}})[_0x0c90('0x26')](function(_0x1a198b){if(_0x1a198b){return _0x1a198b?{'count':_0x67539d,'rows':_0x1a198b}:null;}})[_0x0c90('0x26')](respondWithResult(_0xeeee3b,null))[_0x0c90('0x44')](handleError(_0xeeee3b,null));};exports[_0x0c90('0x50')]=function(_0x19f4ac,_0x143e0d,_0x181fe3){if(_0x19f4ac['body']['id']){delete _0x19f4ac['body']['id'];}return db[_0x0c90('0x2f')][_0x0c90('0x4e')]({'where':{'id':_0x19f4ac[_0x0c90('0x46')]['id']}})[_0x0c90('0x26')](handleEntityNotFound(_0x143e0d,null))[_0x0c90('0x26')](function(_0x2dad30){if(_0x2dad30){_0x19f4ac[_0x0c90('0x4c')][_0x0c90('0x51')]=_0x2dad30['id'];_0x19f4ac[_0x0c90('0x4c')][_0x0c90('0x52')]=integrations[_0x0c90('0x53')](_0x19f4ac[_0x0c90('0x4c')][_0x0c90('0x54')],_0x19f4ac[_0x0c90('0x4c')][_0x0c90('0x31')]);_0x19f4ac['body'][_0x0c90('0x55')]=integrations[_0x0c90('0x56')](_0x19f4ac[_0x0c90('0x4c')]['channel'],_0x19f4ac['body'][_0x0c90('0x31')]);return db['ZendeskConfiguration'][_0x0c90('0x4b')](_0x19f4ac[_0x0c90('0x4c')],{'include':[{'model':db['ZendeskField'],'as':_0x0c90('0x52')},{'model':db[_0x0c90('0x57')],'as':_0x0c90('0x55')}]});}return null;})[_0x0c90('0x26')](respondWithResult(_0x143e0d,null))['catch'](handleError(_0x143e0d,null));};exports['getFields']=function(_0x5f32d6,_0x16b38a,_0x2d3287){var _0x3bc90d='';return db[_0x0c90('0x2f')]['findOne']({'where':{'id':_0x5f32d6[_0x0c90('0x46')]['id']},'attributes':['id','username',_0x0c90('0x58'),_0x0c90('0x59'),_0x0c90('0x5a'),'remoteUri']})[_0x0c90('0x26')](handleEntityNotFound(_0x16b38a,null))[_0x0c90('0x26')](function(_0x2da9f9){if(_0x2da9f9){_0x3bc90d=_0x2da9f9[_0x0c90('0x5b')];var _0x57c3b3=_0x3bc90d['slice'](-0x1);if(_0x57c3b3==='/'){_0x3bc90d=_0x3bc90d[_0x0c90('0x5c')](0x0,_0x3bc90d['lastIndexOf'](_0x57c3b3));}var _0x3254c0={'method':_0x0c90('0x5d'),'uri':util[_0x0c90('0x5e')](_0x0c90('0x5f'),_0x3bc90d,_0x0c90('0x60')),'json':!![]};switch(_0x2da9f9[_0x0c90('0x5a')]){case _0x0c90('0x58'):_0x3254c0[_0x0c90('0x61')]={'Authorization':util[_0x0c90('0x5e')](_0x0c90('0x62'),new Buffer(util['format'](_0x0c90('0x63'),_0x2da9f9[_0x0c90('0x64')],_0x2da9f9[_0x0c90('0x58')]))[_0x0c90('0x65')](_0x0c90('0x66')))};break;case _0x0c90('0x59'):_0x3254c0[_0x0c90('0x61')]={'Authorization':util[_0x0c90('0x5e')](_0x0c90('0x62'),new Buffer(util[_0x0c90('0x5e')]('%s/token:%s',_0x2da9f9[_0x0c90('0x64')],_0x2da9f9[_0x0c90('0x59')]))[_0x0c90('0x65')](_0x0c90('0x66')))};break;default:throw new db['Sequelize'][(_0x0c90('0x67'))](_0x0c90('0x68'));}return rp(_0x3254c0);}})[_0x0c90('0x26')](function(_0x48a32f){if(_0x48a32f){var _0x40866c=[_0x0c90('0x69'),'description',_0x0c90('0x6a'),'assignee'];_[_0x0c90('0x6b')](_0x48a32f['ticket_fields'],function(_0x5633a4){return _0x40866c[_0x0c90('0x6c')](_0x5633a4[_0x0c90('0x31')]);});return{'count':_0x48a32f['ticket_fields']['length'],'rows':_[_0x0c90('0x2e')](_0x48a32f[_0x0c90('0x60')],function(_0x5d80b9){return{'id':_0x5d80b9['id'],'name':_0x5d80b9['position']>0x7?_0x5d80b9[_0x0c90('0x6d')]:_0x5d80b9['type'],'custom':_0x5d80b9[_0x0c90('0x6e')]>0x7?!![]:![],'options':_0x5d80b9[_0x0c90('0x6f')]?_0x5d80b9[_0x0c90('0x6f')]:_0x5d80b9[_0x0c90('0x70')]?_0x5d80b9[_0x0c90('0x70')]:[]};})};}})['then'](respondWithResult(_0x16b38a,null))[_0x0c90('0x44')](function(_0x142268){var _0x3aed3c=_0x5f32d6['query']['test']?0x1f4:_0x142268[_0x0c90('0x71')]||0x1f4;logger[_0x0c90('0x29')](_0x0c90('0x72'),'getFields',_0x3aed3c,JSON['stringify'](_0x142268));delete _0x142268['name'];if(_0x3aed3c===0x191){_0x3aed3c=0x190;}_0x16b38a[_0x0c90('0x1a')](_0x3aed3c)['send'](_0x5f32d6['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x142268[_0x0c90('0x71')]}:_0x142268);});}; \ No newline at end of file +var _0xee5b=['model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','getConfigurations','findOne','ZendeskConfiguration','getSubjects','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','ticket_fields','%s:%s','toString','base64','headers','Basic\x20%s','%s/token:%s','Unknown\x20authentication\x20type','subject','description','group','includes','position','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','error','name','send','index','map','ZendeskAccount','rawAttributes','type'];(function(_0x263a09,_0x1054e3){var _0x38dd46=function(_0x4acf2){while(--_0x4acf2){_0x263a09['push'](_0x263a09['shift']());}};_0x38dd46(++_0x1054e3);}(_0xee5b,0x1f4));var _0xbee5=function(_0x3b6600,_0x50a69d){_0x3b6600=_0x3b6600-0x0;var _0x548d0c=_0xee5b[_0x3b6600];return _0x548d0c;};'use strict';var emlformat=require(_0xbee5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbee5('0x1'));var jsonpatch=require(_0xbee5('0x2'));var rp=require('request-promise');var moment=require(_0xbee5('0x3'));var BPromise=require(_0xbee5('0x4'));var Mustache=require(_0xbee5('0x5'));var util=require(_0xbee5('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xbee5('0x7'));var ejs=require(_0xbee5('0x8'));var fs=require('fs');var fs_extra=require(_0xbee5('0x9'));var _=require(_0xbee5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbee5('0xb'));var Papa=require(_0xbee5('0xc'));var Redis=require(_0xbee5('0xd'));var authService=require(_0xbee5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbee5('0xf'));var hardwareService=require(_0xbee5('0x10'));var logger=require(_0xbee5('0x11'))(_0xbee5('0x12'));var utils=require(_0xbee5('0x13'));var config=require(_0xbee5('0x14'));var licenseUtil=require(_0xbee5('0x15'));var db=require(_0xbee5('0x16'))['db'];var integrations=require(_0xbee5('0x17'));function respondWithStatusCode(_0x48f771,_0x14e032){_0x14e032=_0x14e032||0xcc;return function(_0x532a78){if(_0x532a78){return _0x48f771[_0xbee5('0x18')](_0x14e032);}return _0x48f771[_0xbee5('0x19')](_0x14e032)[_0xbee5('0x1a')]();};}function respondWithResult(_0x593ecb,_0x5092f2){_0x5092f2=_0x5092f2||0xc8;return function(_0x3c6e56){if(_0x3c6e56){return _0x593ecb['status'](_0x5092f2)[_0xbee5('0x1b')](_0x3c6e56);}};}function respondWithFilteredResult(_0x5426c9,_0x1a24bd){return function(_0x141878){if(_0x141878){var _0xf676b1=typeof _0x1a24bd['offset']===_0xbee5('0x1c')&&typeof _0x1a24bd[_0xbee5('0x1d')]==='undefined';var _0x254dd3=_0x141878[_0xbee5('0x1e')];var _0x11b4a3=_0xf676b1?0x0:_0x1a24bd[_0xbee5('0x1f')];var _0x35eb5c=_0xf676b1?_0x141878[_0xbee5('0x1e')]:_0x1a24bd[_0xbee5('0x1f')]+_0x1a24bd[_0xbee5('0x1d')];var _0x20cf52;if(_0x35eb5c>=_0x254dd3){_0x35eb5c=_0x254dd3;_0x20cf52=0xc8;}else{_0x20cf52=0xce;}_0x5426c9[_0xbee5('0x19')](_0x20cf52);return _0x5426c9[_0xbee5('0x20')](_0xbee5('0x21'),_0x11b4a3+'-'+_0x35eb5c+'/'+_0x254dd3)[_0xbee5('0x1b')](_0x141878);}return null;};}function patchUpdates(_0x40a06){return function(_0x450824){try{jsonpatch['apply'](_0x450824,_0x40a06,!![]);}catch(_0x550325){return BPromise[_0xbee5('0x22')](_0x550325);}return _0x450824['save']();};}function saveUpdates(_0x205491,_0x117cb3){return function(_0x3cee7f){if(_0x3cee7f){return _0x3cee7f[_0xbee5('0x23')](_0x205491)[_0xbee5('0x24')](function(_0xb665df){return _0xb665df;});}return null;};}function removeEntity(_0x359ccf,_0x3cfa8d){return function(_0xc79035){if(_0xc79035){return _0xc79035['destroy']()['then'](function(){_0x359ccf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50d774,_0x1af3de){return function(_0x18d7f4){if(!_0x18d7f4){_0x50d774[_0xbee5('0x18')](0x194);}return _0x18d7f4;};}function handleError(_0x28c74d,_0x169042){_0x169042=_0x169042||0x1f4;return function(_0x20e7e8){logger[_0xbee5('0x25')](_0x20e7e8['stack']);if(_0x20e7e8[_0xbee5('0x26')]){delete _0x20e7e8[_0xbee5('0x26')];}_0x28c74d[_0xbee5('0x19')](_0x169042)[_0xbee5('0x27')](_0x20e7e8);};}exports[_0xbee5('0x28')]=function(_0x5f0419,_0x21b993){var _0x15ffb1={},_0xb7a077={},_0x136a00={'count':0x0,'rows':[]};var _0xa57f85=_[_0xbee5('0x29')](db[_0xbee5('0x2a')][_0xbee5('0x2b')],function(_0x2ccb91){return{'name':_0x2ccb91['fieldName'],'type':_0x2ccb91[_0xbee5('0x2c')]['key']};});_0xb7a077[_0xbee5('0x2d')]=_['map'](_0xa57f85,_0xbee5('0x26'));_0xb7a077['query']=_[_0xbee5('0x2e')](_0x5f0419['query']);_0xb7a077[_0xbee5('0x2f')]=_[_0xbee5('0x30')](_0xb7a077[_0xbee5('0x2d')],_0xb7a077[_0xbee5('0x31')]);_0x15ffb1['attributes']=_[_0xbee5('0x30')](_0xb7a077[_0xbee5('0x2d')],qs[_0xbee5('0x32')](_0x5f0419[_0xbee5('0x31')]['fields']));_0x15ffb1[_0xbee5('0x33')]=_0x15ffb1[_0xbee5('0x33')][_0xbee5('0x34')]?_0x15ffb1[_0xbee5('0x33')]:_0xb7a077['model'];if(!_0x5f0419[_0xbee5('0x31')][_0xbee5('0x35')](_0xbee5('0x36'))){_0x15ffb1[_0xbee5('0x1d')]=qs['limit'](_0x5f0419[_0xbee5('0x31')]['limit']);_0x15ffb1[_0xbee5('0x1f')]=qs['offset'](_0x5f0419['query']['offset']);}_0x15ffb1[_0xbee5('0x37')]=qs[_0xbee5('0x38')](_0x5f0419[_0xbee5('0x31')][_0xbee5('0x38')]);_0x15ffb1[_0xbee5('0x39')]=qs[_0xbee5('0x2f')](_[_0xbee5('0x3a')](_0x5f0419[_0xbee5('0x31')],_0xb7a077['filters']),_0xa57f85);if(_0x5f0419[_0xbee5('0x31')]['filter']){_0x15ffb1[_0xbee5('0x39')]=_[_0xbee5('0x3b')](_0x15ffb1[_0xbee5('0x39')],{'$or':_[_0xbee5('0x29')](_0xa57f85,function(_0x4a89ac){if(_0x4a89ac[_0xbee5('0x2c')]!=='VIRTUAL'){var _0x565e9f={};_0x565e9f[_0x4a89ac[_0xbee5('0x26')]]={'$like':'%'+_0x5f0419[_0xbee5('0x31')][_0xbee5('0x3c')]+'%'};return _0x565e9f;}})});}_0x15ffb1=_[_0xbee5('0x3b')]({},_0x15ffb1,_0x5f0419['options']);var _0xf3dd5={'where':_0x15ffb1[_0xbee5('0x39')]};return db[_0xbee5('0x2a')][_0xbee5('0x1e')](_0xf3dd5)[_0xbee5('0x24')](function(_0x25cf17){_0x136a00[_0xbee5('0x1e')]=_0x25cf17;if(_0x5f0419[_0xbee5('0x31')][_0xbee5('0x3d')]){_0x15ffb1[_0xbee5('0x3e')]=[{'all':!![]}];}return db['ZendeskAccount'][_0xbee5('0x3f')](_0x15ffb1);})[_0xbee5('0x24')](function(_0x5637e0){_0x136a00[_0xbee5('0x40')]=_0x5637e0;return _0x136a00;})[_0xbee5('0x24')](respondWithFilteredResult(_0x21b993,_0x15ffb1))[_0xbee5('0x41')](handleError(_0x21b993,null));};exports[_0xbee5('0x42')]=function(_0x4dad75,_0x4cfe54){var _0x4b4641={'raw':![],'where':{'id':_0x4dad75[_0xbee5('0x43')]['id']}},_0x138a40={};_0x138a40[_0xbee5('0x2d')]=_[_0xbee5('0x2e')](db[_0xbee5('0x2a')][_0xbee5('0x2b')]);_0x138a40[_0xbee5('0x31')]=_[_0xbee5('0x2e')](_0x4dad75[_0xbee5('0x31')]);_0x138a40['filters']=_['intersection'](_0x138a40[_0xbee5('0x2d')],_0x138a40['query']);_0x4b4641[_0xbee5('0x33')]=_[_0xbee5('0x30')](_0x138a40['model'],qs[_0xbee5('0x32')](_0x4dad75[_0xbee5('0x31')]['fields']));_0x4b4641['attributes']=_0x4b4641[_0xbee5('0x33')][_0xbee5('0x34')]?_0x4b4641['attributes']:_0x138a40[_0xbee5('0x2d')];if(_0x4dad75[_0xbee5('0x31')]['includeAll']){_0x4b4641[_0xbee5('0x3e')]=[{'all':!![]}];}_0x4b4641=_[_0xbee5('0x3b')]({},_0x4b4641,_0x4dad75[_0xbee5('0x44')]);return db[_0xbee5('0x2a')][_0xbee5('0x45')](_0x4b4641)[_0xbee5('0x24')](handleEntityNotFound(_0x4cfe54,null))[_0xbee5('0x24')](respondWithResult(_0x4cfe54,null))['catch'](handleError(_0x4cfe54,null));};exports[_0xbee5('0x46')]=function(_0x34f01d,_0x27ea7b){return db[_0xbee5('0x2a')]['create'](_0x34f01d[_0xbee5('0x47')],{})[_0xbee5('0x24')](respondWithResult(_0x27ea7b,0xc9))[_0xbee5('0x41')](handleError(_0x27ea7b,null));};exports['update']=function(_0x44d4b1,_0xf637bf){if(_0x44d4b1['body']['id']){delete _0x44d4b1['body']['id'];}return db['ZendeskAccount'][_0xbee5('0x45')]({'where':{'id':_0x44d4b1['params']['id']}})[_0xbee5('0x24')](handleEntityNotFound(_0xf637bf,null))[_0xbee5('0x24')](saveUpdates(_0x44d4b1[_0xbee5('0x47')],null))[_0xbee5('0x24')](respondWithResult(_0xf637bf,null))[_0xbee5('0x41')](handleError(_0xf637bf,null));};exports[_0xbee5('0x48')]=function(_0x55e654,_0x24274d){return db[_0xbee5('0x2a')][_0xbee5('0x45')]({'where':{'id':_0x55e654[_0xbee5('0x43')]['id']}})['then'](handleEntityNotFound(_0x24274d,null))[_0xbee5('0x24')](removeEntity(_0x24274d,null))['catch'](handleError(_0x24274d,null));};exports[_0xbee5('0x49')]=function(_0x45d114,_0xf48059,_0x22c51){var _0x2484c7={};var _0x1b02eb={};var _0xe8902;var _0x35f1d1;return db[_0xbee5('0x2a')][_0xbee5('0x4a')]({'where':{'id':_0x45d114[_0xbee5('0x43')]['id']}})[_0xbee5('0x24')](handleEntityNotFound(_0xf48059,null))[_0xbee5('0x24')](function(_0x359738){if(_0x359738){_0xe8902=_0x359738;_0x1b02eb[_0xbee5('0x2d')]=_['keys'](db[_0xbee5('0x4b')][_0xbee5('0x2b')]);_0x1b02eb[_0xbee5('0x31')]=_['keys'](_0x45d114[_0xbee5('0x31')]);_0x1b02eb[_0xbee5('0x2f')]=_[_0xbee5('0x30')](_0x1b02eb['model'],_0x1b02eb[_0xbee5('0x31')]);_0x2484c7['attributes']=_[_0xbee5('0x30')](_0x1b02eb['model'],qs[_0xbee5('0x32')](_0x45d114[_0xbee5('0x31')][_0xbee5('0x32')]));_0x2484c7['attributes']=_0x2484c7['attributes']['length']?_0x2484c7[_0xbee5('0x33')]:_0x1b02eb[_0xbee5('0x2d')];_0x2484c7[_0xbee5('0x37')]=qs['sort'](_0x45d114[_0xbee5('0x31')]['sort']);_0x2484c7[_0xbee5('0x39')]=qs[_0xbee5('0x2f')](_[_0xbee5('0x3a')](_0x45d114['query'],_0x1b02eb[_0xbee5('0x2f')]));if(_0x45d114[_0xbee5('0x31')][_0xbee5('0x3c')]){_0x2484c7[_0xbee5('0x39')]=_[_0xbee5('0x3b')](_0x2484c7[_0xbee5('0x39')],{'$or':_[_0xbee5('0x29')](_0x2484c7[_0xbee5('0x33')],function(_0x22fc1a){var _0x111027={};_0x111027[_0x22fc1a]={'$like':'%'+_0x45d114[_0xbee5('0x31')][_0xbee5('0x3c')]+'%'};return _0x111027;})});}_0x2484c7=_[_0xbee5('0x3b')]({},_0x2484c7,_0x45d114[_0xbee5('0x44')]);return _0xe8902[_0xbee5('0x49')](_0x2484c7);}})[_0xbee5('0x24')](function(_0x32a8d2){if(_0x32a8d2){_0x35f1d1=_0x32a8d2['length'];if(!_0x45d114[_0xbee5('0x31')]['hasOwnProperty']('nolimit')){_0x2484c7[_0xbee5('0x1d')]=qs[_0xbee5('0x1d')](_0x45d114['query']['limit']);_0x2484c7[_0xbee5('0x1f')]=qs['offset'](_0x45d114[_0xbee5('0x31')][_0xbee5('0x1f')]);}return _0xe8902['getConfigurations'](_0x2484c7);}})[_0xbee5('0x24')](function(_0x1a98c9){if(_0x1a98c9){return _0x1a98c9?{'count':_0x35f1d1,'rows':_0x1a98c9}:null;}})[_0xbee5('0x24')](respondWithResult(_0xf48059,null))[_0xbee5('0x41')](handleError(_0xf48059,null));};exports['addConfiguration']=function(_0x205784,_0x4ad4b5,_0x3294f1){if(_0x205784[_0xbee5('0x47')]['id']){delete _0x205784['body']['id'];}return db[_0xbee5('0x2a')][_0xbee5('0x4a')]({'where':{'id':_0x205784['params']['id']}})[_0xbee5('0x24')](handleEntityNotFound(_0x4ad4b5,null))[_0xbee5('0x24')](function(_0x4f431e){if(_0x4f431e){_0x205784[_0xbee5('0x47')]['AccountId']=_0x4f431e['id'];_0x205784[_0xbee5('0x47')]['Subjects']=integrations[_0xbee5('0x4c')](_0x205784['body']['channel'],_0x205784[_0xbee5('0x47')][_0xbee5('0x2c')]);_0x205784[_0xbee5('0x47')][_0xbee5('0x4d')]=integrations[_0xbee5('0x4e')](_0x205784[_0xbee5('0x47')]['channel'],_0x205784[_0xbee5('0x47')][_0xbee5('0x2c')]);return db[_0xbee5('0x4b')][_0xbee5('0x46')](_0x205784[_0xbee5('0x47')],{'include':[{'model':db[_0xbee5('0x4f')],'as':_0xbee5('0x50')},{'model':db[_0xbee5('0x4f')],'as':_0xbee5('0x4d')}]});}return null;})['then'](respondWithResult(_0x4ad4b5,null))[_0xbee5('0x41')](handleError(_0x4ad4b5,null));};exports[_0xbee5('0x51')]=function(_0x43452f,_0x274a2c,_0x59fe10){var _0x13e84a='';return db[_0xbee5('0x2a')][_0xbee5('0x4a')]({'where':{'id':_0x43452f[_0xbee5('0x43')]['id']},'attributes':['id',_0xbee5('0x52'),_0xbee5('0x53'),_0xbee5('0x54'),_0xbee5('0x55'),_0xbee5('0x56')]})[_0xbee5('0x24')](handleEntityNotFound(_0x274a2c,null))[_0xbee5('0x24')](function(_0x24cd85){if(_0x24cd85){_0x13e84a=_0x24cd85['remoteUri'];var _0x20a9d2=_0x13e84a[_0xbee5('0x57')](-0x1);if(_0x20a9d2==='/'){_0x13e84a=_0x13e84a['substring'](0x0,_0x13e84a[_0xbee5('0x58')](_0x20a9d2));}var _0x56ceeb={'method':_0xbee5('0x59'),'uri':util[_0xbee5('0x5a')]('%s/%s',_0x13e84a,_0xbee5('0x5b')),'json':!![]};switch(_0x24cd85['authType']){case'password':_0x56ceeb['headers']={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0xbee5('0x5c'),_0x24cd85[_0xbee5('0x52')],_0x24cd85[_0xbee5('0x53')]))[_0xbee5('0x5d')](_0xbee5('0x5e')))};break;case _0xbee5('0x54'):_0x56ceeb[_0xbee5('0x5f')]={'Authorization':util[_0xbee5('0x5a')](_0xbee5('0x60'),new Buffer(util[_0xbee5('0x5a')](_0xbee5('0x61'),_0x24cd85[_0xbee5('0x52')],_0x24cd85['token']))[_0xbee5('0x5d')](_0xbee5('0x5e')))};break;default:throw new db['Sequelize']['ValidationError'](_0xbee5('0x62'));}return rp(_0x56ceeb);}})[_0xbee5('0x24')](function(_0x39cc65){if(_0x39cc65){var _0x5e5cba=[_0xbee5('0x63'),_0xbee5('0x64'),_0xbee5('0x65'),'assignee'];_['remove'](_0x39cc65['ticket_fields'],function(_0x3b0d82){return _0x5e5cba[_0xbee5('0x66')](_0x3b0d82[_0xbee5('0x2c')]);});return{'count':_0x39cc65[_0xbee5('0x5b')][_0xbee5('0x34')],'rows':_[_0xbee5('0x29')](_0x39cc65[_0xbee5('0x5b')],function(_0x435b75){return{'id':_0x435b75['id'],'name':_0x435b75['position']>0x7?_0x435b75['title']:_0x435b75[_0xbee5('0x2c')],'custom':_0x435b75[_0xbee5('0x67')]>0x7?!![]:![],'options':_0x435b75['system_field_options']?_0x435b75['system_field_options']:_0x435b75[_0xbee5('0x68')]?_0x435b75['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x274a2c,null))[_0xbee5('0x41')](function(_0x525472){var _0x2b4ac9=_0x43452f[_0xbee5('0x31')]['test']?0x1f4:_0x525472[_0xbee5('0x69')]||0x1f4;logger[_0xbee5('0x25')](_0xbee5('0x6a'),_0xbee5('0x51'),_0x2b4ac9,JSON[_0xbee5('0x6b')](_0x525472));delete _0x525472['name'];if(_0x2b4ac9===0x191){_0x2b4ac9=0x190;}_0x274a2c['status'](_0x2b4ac9)[_0xbee5('0x27')](_0x43452f['query'][_0xbee5('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x525472[_0xbee5('0x69')]}:_0x525472);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 4b9414f..751a922 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 _0xbdb5=['rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3fa7d3,_0x37f83c){var _0x4c51bd=function(_0x59e85b){while(--_0x59e85b){_0x3fa7d3['push'](_0x3fa7d3['shift']());}};_0x4c51bd(++_0x37f83c);}(_0xbdb5,0x1ac));var _0x5bdb=function(_0x328a45,_0x28798d){_0x328a45=_0x328a45-0x0;var _0xaf6ae8=_0xbdb5[_0x328a45];return _0xaf6ae8;};'use strict';var _=require(_0x5bdb('0x0'));var util=require(_0x5bdb('0x1'));var logger=require(_0x5bdb('0x2'))(_0x5bdb('0x3'));var moment=require(_0x5bdb('0x4'));var BPromise=require(_0x5bdb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5bdb('0x6'));var config=require(_0x5bdb('0x7'));var attributes=require(_0x5bdb('0x8'));var integrations=require(_0x5bdb('0x9'));module[_0x5bdb('0xa')]=function(_0x17be20,_0x107738){return _0x17be20[_0x5bdb('0xb')](_0x5bdb('0xc'),attributes,{'tableName':_0x5bdb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe67=['ZendeskAccount','int_zendesk_accounts','../../config/logger','api','moment','bluebird','path','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x415b2c,_0x1382b2){var _0x52e4a8=function(_0x137ecd){while(--_0x137ecd){_0x415b2c['push'](_0x415b2c['shift']());}};_0x52e4a8(++_0x1382b2);}(_0xbe67,0xfc));var _0x7be6=function(_0x512ce0,_0xf5e83f){_0x512ce0=_0x512ce0-0x0;var _0x7118b0=_0xbe67[_0x512ce0];return _0x7118b0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7be6('0x0'))(_0x7be6('0x1'));var moment=require(_0x7be6('0x2'));var BPromise=require(_0x7be6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7be6('0x4'));var rimraf=require('rimraf');var config=require(_0x7be6('0x5'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x7be6('0x6'));module[_0x7be6('0x7')]=function(_0x12bb2e,_0x222f6e){return _0x12bb2e['define'](_0x7be6('0x8'),attributes,{'tableName':_0x7be6('0x9'),'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 c047ff6..def6877 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 _0x48b2=['info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','stringify','find','ShowZendeskAccount','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x48b2,0x10e));var _0x248b=function(_0x3dd1f8,_0x49c70f){_0x3dd1f8=_0x3dd1f8-0x0;var _0x381723=_0x48b2[_0x3dd1f8];return _0x381723;};'use strict';var _=require(_0x248b('0x0'));var util=require(_0x248b('0x1'));var moment=require('moment');var BPromise=require(_0x248b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x248b('0x3'))['db'];var utils=require(_0x248b('0x4'));var logger=require('../../config/logger')(_0x248b('0x5'));var config=require('../../config/environment');var jayson=require(_0x248b('0x6'));var client=jayson[_0x248b('0x7')][_0x248b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e5b70,_0x377e22,_0x21cd2e){return new BPromise(function(_0x417417,_0x521ab5){return client[_0x248b('0x9')](_0x4e5b70,_0x21cd2e)['then'](function(_0x47ed50){logger[_0x248b('0xa')](_0x248b('0xb'),_0x377e22,_0x248b('0xc'));logger[_0x248b('0xd')](_0x248b('0xe'),_0x377e22,_0x248b('0xc'),JSON['stringify'](_0x47ed50));if(_0x47ed50['error']){if(_0x47ed50[_0x248b('0xf')][_0x248b('0x10')]===0x1f4){logger[_0x248b('0xf')](_0x248b('0xb'),_0x377e22,_0x47ed50[_0x248b('0xf')][_0x248b('0x11')]);return _0x521ab5(_0x47ed50[_0x248b('0xf')]['message']);}logger[_0x248b('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x377e22,_0x47ed50[_0x248b('0xf')][_0x248b('0x11')]);return _0x417417(_0x47ed50[_0x248b('0xf')][_0x248b('0x11')]);}else{logger[_0x248b('0xa')]('ZendeskAccount,\x20%s,\x20%s',_0x377e22,'request\x20sent');_0x417417(_0x47ed50[_0x248b('0x12')][_0x248b('0x11')]);}})[_0x248b('0x13')](function(_0x598fdb){logger[_0x248b('0xf')](_0x248b('0xb'),_0x377e22,_0x598fdb);_0x521ab5(_0x598fdb);});});}exports[_0x248b('0x14')]=function(_0x38257c){var _0x4b9a76=this;return new Promise(function(_0x274125,_0x55b355){return db[_0x248b('0x15')][_0x248b('0x16')]({'raw':_0x38257c['options']?_0x38257c[_0x248b('0x17')][_0x248b('0x18')]===undefined?!![]:![]:!![],'where':_0x38257c[_0x248b('0x17')]?_0x38257c[_0x248b('0x17')][_0x248b('0x19')]||null:null,'attributes':_0x38257c['options']?_0x38257c[_0x248b('0x17')][_0x248b('0x1a')]||null:null,'limit':_0x38257c[_0x248b('0x17')]?_0x38257c[_0x248b('0x17')][_0x248b('0x1b')]||null:null,'include':_0x38257c[_0x248b('0x17')]?_0x38257c[_0x248b('0x17')][_0x248b('0x1c')]?_[_0x248b('0x1d')](_0x38257c['options'][_0x248b('0x1c')],function(_0x4b3069){return{'model':db[_0x4b3069[_0x248b('0x1e')]],'as':_0x4b3069['as'],'attributes':_0x4b3069[_0x248b('0x1a')],'include':_0x4b3069[_0x248b('0x1c')]?_[_0x248b('0x1d')](_0x4b3069[_0x248b('0x1c')],function(_0x3f156d){return{'model':db[_0x3f156d[_0x248b('0x1e')]],'as':_0x3f156d['as'],'attributes':_0x3f156d[_0x248b('0x1a')],'include':_0x3f156d[_0x248b('0x1c')]?_[_0x248b('0x1d')](_0x3f156d['include'],function(_0x551966){return{'model':db[_0x551966[_0x248b('0x1e')]],'as':_0x551966['as'],'attributes':_0x551966[_0x248b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x248b('0x1f')](function(_0xc327c9){logger[_0x248b('0xa')](_0x248b('0x14'),_0x38257c);logger[_0x248b('0xd')](_0x248b('0x14'),_0x38257c,JSON[_0x248b('0x20')](_0xc327c9));_0x274125(_0xc327c9);})[_0x248b('0x13')](function(_0x4c2ca2){logger[_0x248b('0xf')](_0x248b('0x14'),_0x4c2ca2[_0x248b('0x11')],_0x38257c);_0x55b355(_0x4b9a76[_0x248b('0xf')](0x1f4,_0x4c2ca2[_0x248b('0x11')]));});});};exports['ShowZendeskAccount']=function(_0xe36ec3){var _0xf572f2=this;return new Promise(function(_0x22a6a6,_0x320117){return db[_0x248b('0x15')][_0x248b('0x21')]({'raw':_0xe36ec3[_0x248b('0x17')]?_0xe36ec3[_0x248b('0x17')][_0x248b('0x18')]===undefined?!![]:![]:!![],'where':_0xe36ec3[_0x248b('0x17')]?_0xe36ec3[_0x248b('0x17')][_0x248b('0x19')]||null:null,'attributes':_0xe36ec3['options']?_0xe36ec3[_0x248b('0x17')][_0x248b('0x1a')]||null:null,'include':_0xe36ec3[_0x248b('0x17')]?_0xe36ec3['options'][_0x248b('0x1c')]?_['map'](_0xe36ec3[_0x248b('0x17')][_0x248b('0x1c')],function(_0x81bac9){return{'model':db[_0x81bac9[_0x248b('0x1e')]],'as':_0x81bac9['as'],'attributes':_0x81bac9['attributes'],'include':_0x81bac9[_0x248b('0x1c')]?_['map'](_0x81bac9['include'],function(_0x51ba33){return{'model':db[_0x51ba33[_0x248b('0x1e')]],'as':_0x51ba33['as'],'attributes':_0x51ba33[_0x248b('0x1a')],'include':_0x51ba33['include']?_[_0x248b('0x1d')](_0x51ba33[_0x248b('0x1c')],function(_0x4099d6){return{'model':db[_0x4099d6['model']],'as':_0x4099d6['as'],'attributes':_0x4099d6['attributes']};}):[]};}):[]};}):[]:[]})[_0x248b('0x1f')](function(_0x2a0b64){logger[_0x248b('0xa')]('ShowZendeskAccount',_0xe36ec3);logger['debug'](_0x248b('0x22'),_0xe36ec3,JSON['stringify'](_0x2a0b64));_0x22a6a6(_0x2a0b64);})[_0x248b('0x13')](function(_0x1c96c1){logger[_0x248b('0xf')]('ShowZendeskAccount',_0x1c96c1[_0x248b('0x11')],_0xe36ec3);_0x320117(_0xf572f2[_0x248b('0xf')](0x1f4,_0x1c96c1['message']));});});}; \ No newline at end of file +var _0x9a4e=['info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','limit','include','map','model','attributes','stringify','ShowZendeskAccount','find','where','lodash','util','moment','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x1d5a43,_0x170322){var _0xe78367=function(_0x26b93e){while(--_0x26b93e){_0x1d5a43['push'](_0x1d5a43['shift']());}};_0xe78367(++_0x170322);}(_0x9a4e,0x158));var _0xe9a4=function(_0x1f77fd,_0x1d94cc){_0x1f77fd=_0x1f77fd-0x0;var _0x112135=_0x9a4e[_0x1f77fd];return _0x112135;};'use strict';var _=require(_0xe9a4('0x0'));var util=require(_0xe9a4('0x1'));var moment=require(_0xe9a4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe9a4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe9a4('0x4'))(_0xe9a4('0x5'));var config=require('../../config/environment');var jayson=require(_0xe9a4('0x6'));var client=jayson[_0xe9a4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40abdf,_0x443239,_0x4463c7){return new BPromise(function(_0x49c439,_0x37c48b){return client['request'](_0x40abdf,_0x4463c7)['then'](function(_0x3658b1){logger[_0xe9a4('0x8')](_0xe9a4('0x9'),_0x443239,'request\x20sent');logger[_0xe9a4('0xa')](_0xe9a4('0xb'),_0x443239,'request\x20sent',JSON['stringify'](_0x3658b1));if(_0x3658b1[_0xe9a4('0xc')]){if(_0x3658b1[_0xe9a4('0xc')][_0xe9a4('0xd')]===0x1f4){logger[_0xe9a4('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0x443239,_0x3658b1[_0xe9a4('0xc')][_0xe9a4('0xe')]);return _0x37c48b(_0x3658b1[_0xe9a4('0xc')][_0xe9a4('0xe')]);}logger[_0xe9a4('0xc')](_0xe9a4('0x9'),_0x443239,_0x3658b1[_0xe9a4('0xc')][_0xe9a4('0xe')]);return _0x49c439(_0x3658b1[_0xe9a4('0xc')][_0xe9a4('0xe')]);}else{logger[_0xe9a4('0x8')](_0xe9a4('0x9'),_0x443239,_0xe9a4('0xf'));_0x49c439(_0x3658b1[_0xe9a4('0x10')][_0xe9a4('0xe')]);}})[_0xe9a4('0x11')](function(_0x55b696){logger['error'](_0xe9a4('0x9'),_0x443239,_0x55b696);_0x37c48b(_0x55b696);});});}exports[_0xe9a4('0x12')]=function(_0x15401a){var _0x44cb8b=this;return new Promise(function(_0xe5127,_0x3ec59f){return db[_0xe9a4('0x13')][_0xe9a4('0x14')]({'raw':_0x15401a[_0xe9a4('0x15')]?_0x15401a[_0xe9a4('0x15')][_0xe9a4('0x16')]===undefined?!![]:![]:!![],'where':_0x15401a['options']?_0x15401a[_0xe9a4('0x15')]['where']||null:null,'attributes':_0x15401a[_0xe9a4('0x15')]?_0x15401a['options']['attributes']||null:null,'limit':_0x15401a[_0xe9a4('0x15')]?_0x15401a['options'][_0xe9a4('0x17')]||null:null,'include':_0x15401a[_0xe9a4('0x15')]?_0x15401a[_0xe9a4('0x15')][_0xe9a4('0x18')]?_[_0xe9a4('0x19')](_0x15401a[_0xe9a4('0x15')]['include'],function(_0x173300){return{'model':db[_0x173300[_0xe9a4('0x1a')]],'as':_0x173300['as'],'attributes':_0x173300[_0xe9a4('0x1b')],'include':_0x173300[_0xe9a4('0x18')]?_[_0xe9a4('0x19')](_0x173300['include'],function(_0x211fc0){return{'model':db[_0x211fc0['model']],'as':_0x211fc0['as'],'attributes':_0x211fc0[_0xe9a4('0x1b')],'include':_0x211fc0[_0xe9a4('0x18')]?_[_0xe9a4('0x19')](_0x211fc0[_0xe9a4('0x18')],function(_0x33b77f){return{'model':db[_0x33b77f['model']],'as':_0x33b77f['as'],'attributes':_0x33b77f[_0xe9a4('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3119b8){logger[_0xe9a4('0x8')](_0xe9a4('0x12'),_0x15401a);logger[_0xe9a4('0xa')](_0xe9a4('0x12'),_0x15401a,JSON[_0xe9a4('0x1c')](_0x3119b8));_0xe5127(_0x3119b8);})[_0xe9a4('0x11')](function(_0x303a1c){logger[_0xe9a4('0xc')]('GetZendeskAccount',_0x303a1c[_0xe9a4('0xe')],_0x15401a);_0x3ec59f(_0x44cb8b[_0xe9a4('0xc')](0x1f4,_0x303a1c[_0xe9a4('0xe')]));});});};exports[_0xe9a4('0x1d')]=function(_0xe92f79){var _0x37cbda=this;return new Promise(function(_0x5b83a3,_0x182ed8){return db[_0xe9a4('0x13')][_0xe9a4('0x1e')]({'raw':_0xe92f79[_0xe9a4('0x15')]?_0xe92f79[_0xe9a4('0x15')][_0xe9a4('0x16')]===undefined?!![]:![]:!![],'where':_0xe92f79[_0xe9a4('0x15')]?_0xe92f79[_0xe9a4('0x15')][_0xe9a4('0x1f')]||null:null,'attributes':_0xe92f79[_0xe9a4('0x15')]?_0xe92f79['options'][_0xe9a4('0x1b')]||null:null,'include':_0xe92f79[_0xe9a4('0x15')]?_0xe92f79[_0xe9a4('0x15')][_0xe9a4('0x18')]?_[_0xe9a4('0x19')](_0xe92f79[_0xe9a4('0x15')][_0xe9a4('0x18')],function(_0x365ddd){return{'model':db[_0x365ddd[_0xe9a4('0x1a')]],'as':_0x365ddd['as'],'attributes':_0x365ddd['attributes'],'include':_0x365ddd[_0xe9a4('0x18')]?_[_0xe9a4('0x19')](_0x365ddd['include'],function(_0xd9994){return{'model':db[_0xd9994[_0xe9a4('0x1a')]],'as':_0xd9994['as'],'attributes':_0xd9994[_0xe9a4('0x1b')],'include':_0xd9994[_0xe9a4('0x18')]?_[_0xe9a4('0x19')](_0xd9994['include'],function(_0x4bf6b1){return{'model':db[_0x4bf6b1[_0xe9a4('0x1a')]],'as':_0x4bf6b1['as'],'attributes':_0x4bf6b1[_0xe9a4('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37d52e){logger[_0xe9a4('0x8')]('ShowZendeskAccount',_0xe92f79);logger['debug'](_0xe9a4('0x1d'),_0xe92f79,JSON[_0xe9a4('0x1c')](_0x37d52e));_0x5b83a3(_0x37d52e);})[_0xe9a4('0x11')](function(_0x2970c4){logger[_0xe9a4('0xc')]('ShowZendeskAccount',_0x2970c4[_0xe9a4('0xe')],_0xe92f79);_0x182ed8(_0x37cbda[_0xe9a4('0xc')](0x1f4,_0x2970c4[_0xe9a4('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index eb9f83e..8af4381 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 _0xa571=['util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','put','update','exports','multer'];(function(_0x23f37b,_0x50c1ea){var _0xce8411=function(_0x539ec2){while(--_0x539ec2){_0x23f37b['push'](_0x23f37b['shift']());}};_0xce8411(++_0x50c1ea);}(_0xa571,0x107));var _0x1a57=function(_0x3e68a8,_0x3cb2b0){_0x3e68a8=_0x3e68a8-0x0;var _0x57c0a6=_0xa571[_0x3e68a8];return _0x57c0a6;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./intZendeskConfiguration.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0x7')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['getFields']);router[_0x1a57('0x7')](_0x1a57('0xc'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0x7')](_0x1a57('0xe'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);router['get']('/:id/tags',auth[_0x1a57('0x8')](),controller[_0x1a57('0x10')]);router[_0x1a57('0x11')]('/',auth['isAuthenticated'](),controller[_0x1a57('0x12')]);router[_0x1a57('0x11')]('/:id/tags',auth[_0x1a57('0x8')](),controller['setTags']);router[_0x1a57('0x13')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0x14')]);router['delete'](_0x1a57('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x1a57('0x15')]=router; \ No newline at end of file +var _0x4024=['util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id/fields','getDescriptions','/:id/tags','getTags','create','post','setTags','put','/:id','update','delete','destroy','exports','multer'];(function(_0x5c4e16,_0x113035){var _0x36044a=function(_0xde2f25){while(--_0xde2f25){_0x5c4e16['push'](_0x5c4e16['shift']());}};_0x36044a(++_0x113035);}(_0x4024,0x89));var _0x4402=function(_0x394697,_0x275816){_0x394697=_0x394697-0x0;var _0x4343f8=_0x4024[_0x394697];return _0x4343f8;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var fs_extra=require(_0x4402('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require('./intZendeskConfiguration.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/:id',auth[_0x4402('0x7')](),controller['show']);router['get'](_0x4402('0xa'),auth['isAuthenticated'](),controller['getFields']);router[_0x4402('0x9')]('/:id/subjects',auth[_0x4402('0x7')](),controller['getSubjects']);router[_0x4402('0x9')]('/:id/descriptions',auth[_0x4402('0x7')](),controller[_0x4402('0xb')]);router['get'](_0x4402('0xc'),auth[_0x4402('0x7')](),controller[_0x4402('0xd')]);router['post']('/',auth[_0x4402('0x7')](),controller[_0x4402('0xe')]);router[_0x4402('0xf')](_0x4402('0xc'),auth[_0x4402('0x7')](),controller[_0x4402('0x10')]);router[_0x4402('0x11')](_0x4402('0x12'),auth[_0x4402('0x7')](),controller[_0x4402('0x13')]);router[_0x4402('0x14')](_0x4402('0x12'),auth[_0x4402('0x7')](),controller[_0x4402('0x15')]);module[_0x4402('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 5758aa5..4103391 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 _0xa16f=['STRING','sequelize','exports'];(function(_0x715d76,_0x402d60){var _0x48fe88=function(_0x4dd0ea){while(--_0x4dd0ea){_0x715d76['push'](_0x715d76['shift']());}};_0x48fe88(++_0x402d60);}(_0xa16f,0x18a));var _0xfa16=function(_0x7d1005,_0x1d01ad){_0x7d1005=_0x7d1005-0x0;var _0x191ca4=_0xa16f[_0x7d1005];return _0x191ca4;};'use strict';var Sequelize=require(_0xfa16('0x0'));module[_0xfa16('0x1')]={'name':{'type':Sequelize[_0xfa16('0x2')]},'description':{'type':Sequelize[_0xfa16('0x2')]}}; \ No newline at end of file +var _0xd67f=['exports','STRING'];(function(_0x4aa5b4,_0x55767a){var _0x356143=function(_0x474e5a){while(--_0x474e5a){_0x4aa5b4['push'](_0x4aa5b4['shift']());}};_0x356143(++_0x55767a);}(_0xd67f,0x1ce));var _0xfd67=function(_0x9f4e54,_0x5af35b){_0x9f4e54=_0x9f4e54-0x0;var _0x1c1330=_0xd67f[_0x9f4e54];return _0x1c1330;};'use strict';var Sequelize=require('sequelize');module[_0xfd67('0x0')]={'name':{'type':Sequelize[_0xfd67('0x1')]},'description':{'type':Sequelize[_0xfd67('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 22dd496..95621ac 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 _0x6b84=['hasOwnProperty','nolimit','order','sort','where','filter','merge','options','ZendeskConfiguration','includeAll','findAll','rows','catch','show','params','find','create','body','destroy','getFields','findOne','pick','getSubjects','ZendeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','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','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length'];(function(_0x5b013d,_0xc7691c){var _0x2b6eef=function(_0x3143ca){while(--_0x3143ca){_0x5b013d['push'](_0x5b013d['shift']());}};_0x2b6eef(++_0xc7691c);}(_0x6b84,0xcf));var _0x46b8=function(_0x374de6,_0x3b8c2b){_0x374de6=_0x374de6-0x0;var _0x223daa=_0x6b84[_0x374de6];return _0x223daa;};'use strict';var emlformat=require(_0x46b8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x46b8('0x1'));var jsonpatch=require(_0x46b8('0x2'));var rp=require(_0x46b8('0x3'));var moment=require(_0x46b8('0x4'));var BPromise=require(_0x46b8('0x5'));var Mustache=require(_0x46b8('0x6'));var util=require(_0x46b8('0x7'));var path=require(_0x46b8('0x8'));var sox=require(_0x46b8('0x9'));var csv=require('to-csv');var ejs=require(_0x46b8('0xa'));var fs=require('fs');var fs_extra=require(_0x46b8('0xb'));var _=require(_0x46b8('0xc'));var squel=require(_0x46b8('0xd'));var crypto=require(_0x46b8('0xe'));var jsforce=require(_0x46b8('0xf'));var deskjs=require(_0x46b8('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x46b8('0x11'));var Redis=require(_0x46b8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x46b8('0x13'));var as=require(_0x46b8('0x14'));var hardwareService=require(_0x46b8('0x15'));var logger=require(_0x46b8('0x16'))(_0x46b8('0x17'));var utils=require(_0x46b8('0x18'));var config=require(_0x46b8('0x19'));var licenseUtil=require(_0x46b8('0x1a'));var db=require(_0x46b8('0x1b'))['db'];function respondWithStatusCode(_0x3184b5,_0x5b1a6f){_0x5b1a6f=_0x5b1a6f||0xcc;return function(_0x3a0f2c){if(_0x3a0f2c){return _0x3184b5[_0x46b8('0x1c')](_0x5b1a6f);}return _0x3184b5[_0x46b8('0x1d')](_0x5b1a6f)['end']();};}function respondWithResult(_0x593a57,_0x1daad6){_0x1daad6=_0x1daad6||0xc8;return function(_0x423de8){if(_0x423de8){return _0x593a57[_0x46b8('0x1d')](_0x1daad6)[_0x46b8('0x1e')](_0x423de8);}};}function respondWithFilteredResult(_0x143484,_0xa12fc1){return function(_0x491883){if(_0x491883){var _0x45cdca=typeof _0xa12fc1[_0x46b8('0x1f')]===_0x46b8('0x20')&&typeof _0xa12fc1[_0x46b8('0x21')]==='undefined';var _0x3e7ca0=_0x491883['count'];var _0x3b8e46=_0x45cdca?0x0:_0xa12fc1[_0x46b8('0x1f')];var _0x35377f=_0x45cdca?_0x491883[_0x46b8('0x22')]:_0xa12fc1[_0x46b8('0x1f')]+_0xa12fc1['limit'];var _0x111bf6;if(_0x35377f>=_0x3e7ca0){_0x35377f=_0x3e7ca0;_0x111bf6=0xc8;}else{_0x111bf6=0xce;}_0x143484[_0x46b8('0x1d')](_0x111bf6);return _0x143484[_0x46b8('0x23')](_0x46b8('0x24'),_0x3b8e46+'-'+_0x35377f+'/'+_0x3e7ca0)[_0x46b8('0x1e')](_0x491883);}return null;};}function patchUpdates(_0x448a51){return function(_0x514a08){try{jsonpatch[_0x46b8('0x25')](_0x514a08,_0x448a51,!![]);}catch(_0xffa3cf){return BPromise[_0x46b8('0x26')](_0xffa3cf);}return _0x514a08['save']();};}function saveUpdates(_0x2f9f78,_0x46e97e){return function(_0x4e374e){if(_0x4e374e){return _0x4e374e[_0x46b8('0x27')](_0x2f9f78)[_0x46b8('0x28')](function(_0x4caeea){return _0x4caeea;});}return null;};}function removeEntity(_0x3f30f4,_0x3ce847){return function(_0x52dad9){if(_0x52dad9){return _0x52dad9['destroy']()[_0x46b8('0x28')](function(){_0x3f30f4[_0x46b8('0x1d')](0xcc)[_0x46b8('0x29')]();});}};}function handleEntityNotFound(_0x2f40ac,_0xa128cd){return function(_0x12655f){if(!_0x12655f){_0x2f40ac[_0x46b8('0x1c')](0x194);}return _0x12655f;};}function handleError(_0xd1c98c,_0x39faeb){_0x39faeb=_0x39faeb||0x1f4;return function(_0x1fb336){logger[_0x46b8('0x2a')](_0x1fb336[_0x46b8('0x2b')]);if(_0x1fb336['name']){delete _0x1fb336[_0x46b8('0x2c')];}_0xd1c98c[_0x46b8('0x1d')](_0x39faeb)[_0x46b8('0x2d')](_0x1fb336);};}exports[_0x46b8('0x2e')]=function(_0x482918,_0x441bb4){var _0x531530={},_0x5cfceb={},_0x121fd6={'count':0x0,'rows':[]};var _0x1b3bab=_['map'](db['ZendeskConfiguration'][_0x46b8('0x2f')],function(_0x168ade){return{'name':_0x168ade[_0x46b8('0x30')],'type':_0x168ade[_0x46b8('0x31')][_0x46b8('0x32')]};});_0x5cfceb[_0x46b8('0x33')]=_[_0x46b8('0x34')](_0x1b3bab,_0x46b8('0x2c'));_0x5cfceb[_0x46b8('0x35')]=_[_0x46b8('0x36')](_0x482918[_0x46b8('0x35')]);_0x5cfceb[_0x46b8('0x37')]=_['intersection'](_0x5cfceb[_0x46b8('0x33')],_0x5cfceb['query']);_0x531530[_0x46b8('0x38')]=_[_0x46b8('0x39')](_0x5cfceb[_0x46b8('0x33')],qs[_0x46b8('0x3a')](_0x482918[_0x46b8('0x35')][_0x46b8('0x3a')]));_0x531530[_0x46b8('0x38')]=_0x531530['attributes'][_0x46b8('0x3b')]?_0x531530[_0x46b8('0x38')]:_0x5cfceb[_0x46b8('0x33')];if(!_0x482918[_0x46b8('0x35')][_0x46b8('0x3c')](_0x46b8('0x3d'))){_0x531530[_0x46b8('0x21')]=qs[_0x46b8('0x21')](_0x482918['query'][_0x46b8('0x21')]);_0x531530[_0x46b8('0x1f')]=qs[_0x46b8('0x1f')](_0x482918[_0x46b8('0x35')][_0x46b8('0x1f')]);}_0x531530[_0x46b8('0x3e')]=qs[_0x46b8('0x3f')](_0x482918[_0x46b8('0x35')][_0x46b8('0x3f')]);_0x531530[_0x46b8('0x40')]=qs[_0x46b8('0x37')](_['pick'](_0x482918[_0x46b8('0x35')],_0x5cfceb[_0x46b8('0x37')]),_0x1b3bab);if(_0x482918[_0x46b8('0x35')][_0x46b8('0x41')]){_0x531530['where']=_[_0x46b8('0x42')](_0x531530[_0x46b8('0x40')],{'$or':_[_0x46b8('0x34')](_0x1b3bab,function(_0x12b128){if(_0x12b128[_0x46b8('0x31')]!=='VIRTUAL'){var _0x4bd46b={};_0x4bd46b[_0x12b128[_0x46b8('0x2c')]]={'$like':'%'+_0x482918[_0x46b8('0x35')][_0x46b8('0x41')]+'%'};return _0x4bd46b;}})});}_0x531530=_[_0x46b8('0x42')]({},_0x531530,_0x482918[_0x46b8('0x43')]);var _0x4913cf={'where':_0x531530[_0x46b8('0x40')]};return db[_0x46b8('0x44')][_0x46b8('0x22')](_0x4913cf)[_0x46b8('0x28')](function(_0x5ed896){_0x121fd6[_0x46b8('0x22')]=_0x5ed896;if(_0x482918['query'][_0x46b8('0x45')]){_0x531530['include']=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x46b8('0x46')](_0x531530);})['then'](function(_0x4ceaf6){_0x121fd6[_0x46b8('0x47')]=_0x4ceaf6;return _0x121fd6;})['then'](respondWithFilteredResult(_0x441bb4,_0x531530))[_0x46b8('0x48')](handleError(_0x441bb4,null));};exports[_0x46b8('0x49')]=function(_0x1a4629,_0x79e5ae){var _0x4f1e91={'raw':![],'where':{'id':_0x1a4629[_0x46b8('0x4a')]['id']}},_0x3446a1={};_0x3446a1[_0x46b8('0x33')]=_[_0x46b8('0x36')](db[_0x46b8('0x44')][_0x46b8('0x2f')]);_0x3446a1['query']=_[_0x46b8('0x36')](_0x1a4629[_0x46b8('0x35')]);_0x3446a1['filters']=_[_0x46b8('0x39')](_0x3446a1[_0x46b8('0x33')],_0x3446a1[_0x46b8('0x35')]);_0x4f1e91[_0x46b8('0x38')]=_[_0x46b8('0x39')](_0x3446a1[_0x46b8('0x33')],qs['fields'](_0x1a4629[_0x46b8('0x35')]['fields']));_0x4f1e91['attributes']=_0x4f1e91['attributes'][_0x46b8('0x3b')]?_0x4f1e91[_0x46b8('0x38')]:_0x3446a1[_0x46b8('0x33')];if(_0x1a4629[_0x46b8('0x35')][_0x46b8('0x45')]){_0x4f1e91['include']=[{'all':!![]}];}_0x4f1e91=_['merge']({},_0x4f1e91,_0x1a4629[_0x46b8('0x43')]);return db[_0x46b8('0x44')][_0x46b8('0x4b')](_0x4f1e91)['then'](handleEntityNotFound(_0x79e5ae,null))[_0x46b8('0x28')](respondWithResult(_0x79e5ae,null))[_0x46b8('0x48')](handleError(_0x79e5ae,null));};exports[_0x46b8('0x4c')]=function(_0x294b5e,_0x3015b8){return db[_0x46b8('0x44')][_0x46b8('0x4c')](_0x294b5e[_0x46b8('0x4d')],{})[_0x46b8('0x28')](respondWithResult(_0x3015b8,0xc9))[_0x46b8('0x48')](handleError(_0x3015b8,null));};exports[_0x46b8('0x27')]=function(_0x277131,_0x59657b){if(_0x277131['body']['id']){delete _0x277131[_0x46b8('0x4d')]['id'];}return db[_0x46b8('0x44')][_0x46b8('0x4b')]({'where':{'id':_0x277131[_0x46b8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x59657b,null))['then'](saveUpdates(_0x277131['body'],null))[_0x46b8('0x28')](respondWithResult(_0x59657b,null))[_0x46b8('0x48')](handleError(_0x59657b,null));};exports[_0x46b8('0x4e')]=function(_0x5744f6,_0xdfb89c){return db[_0x46b8('0x44')][_0x46b8('0x4b')]({'where':{'id':_0x5744f6[_0x46b8('0x4a')]['id']}})[_0x46b8('0x28')](handleEntityNotFound(_0xdfb89c,null))['then'](removeEntity(_0xdfb89c,null))['catch'](handleError(_0xdfb89c,null));};exports[_0x46b8('0x4f')]=function(_0x3b1aad,_0x20dcc1,_0xf0925){var _0x2c1b33={};var _0x5d5661={};var _0x8ce4de;var _0x5bce50;return db[_0x46b8('0x44')][_0x46b8('0x50')]({'where':{'id':_0x3b1aad[_0x46b8('0x4a')]['id']}})[_0x46b8('0x28')](handleEntityNotFound(_0x20dcc1,null))[_0x46b8('0x28')](function(_0x57fd16){if(_0x57fd16){_0x8ce4de=_0x57fd16;_0x5d5661[_0x46b8('0x33')]=_['keys'](db['ZendeskField']['rawAttributes']);_0x5d5661[_0x46b8('0x35')]=_[_0x46b8('0x36')](_0x3b1aad[_0x46b8('0x35')]);_0x5d5661[_0x46b8('0x37')]=_['intersection'](_0x5d5661[_0x46b8('0x33')],_0x5d5661['query']);_0x2c1b33[_0x46b8('0x38')]=_[_0x46b8('0x39')](_0x5d5661[_0x46b8('0x33')],qs[_0x46b8('0x3a')](_0x3b1aad[_0x46b8('0x35')][_0x46b8('0x3a')]));_0x2c1b33[_0x46b8('0x38')]=_0x2c1b33[_0x46b8('0x38')][_0x46b8('0x3b')]?_0x2c1b33['attributes']:_0x5d5661[_0x46b8('0x33')];_0x2c1b33[_0x46b8('0x3e')]=qs[_0x46b8('0x3f')](_0x3b1aad[_0x46b8('0x35')][_0x46b8('0x3f')]);_0x2c1b33[_0x46b8('0x40')]=qs[_0x46b8('0x37')](_[_0x46b8('0x51')](_0x3b1aad[_0x46b8('0x35')],_0x5d5661['filters']));if(_0x3b1aad[_0x46b8('0x35')][_0x46b8('0x41')]){_0x2c1b33['where']=_[_0x46b8('0x42')](_0x2c1b33[_0x46b8('0x40')],{'$or':_[_0x46b8('0x34')](_0x2c1b33['attributes'],function(_0x1dd503){var _0x49adc4={};_0x49adc4[_0x1dd503]={'$like':'%'+_0x3b1aad['query'][_0x46b8('0x41')]+'%'};return _0x49adc4;})});}_0x2c1b33=_[_0x46b8('0x42')]({},_0x2c1b33,_0x3b1aad[_0x46b8('0x43')]);return _0x8ce4de[_0x46b8('0x4f')](_0x2c1b33);}})[_0x46b8('0x28')](function(_0x5f5b24){if(_0x5f5b24){_0x5bce50=_0x5f5b24[_0x46b8('0x3b')];if(!_0x3b1aad[_0x46b8('0x35')][_0x46b8('0x3c')](_0x46b8('0x3d'))){_0x2c1b33[_0x46b8('0x21')]=qs[_0x46b8('0x21')](_0x3b1aad[_0x46b8('0x35')][_0x46b8('0x21')]);_0x2c1b33[_0x46b8('0x1f')]=qs['offset'](_0x3b1aad[_0x46b8('0x35')][_0x46b8('0x1f')]);}return _0x8ce4de['getFields'](_0x2c1b33);}})[_0x46b8('0x28')](function(_0x115cff){if(_0x115cff){return _0x115cff?{'count':_0x5bce50,'rows':_0x115cff}:null;}})[_0x46b8('0x28')](respondWithResult(_0x20dcc1,null))['catch'](handleError(_0x20dcc1,null));};exports[_0x46b8('0x52')]=function(_0x4375e7,_0x200f61,_0x322c01){var _0x42f390={};var _0x51e573={};var _0x3b1a4b;var _0x47424c;return db[_0x46b8('0x44')][_0x46b8('0x50')]({'where':{'id':_0x4375e7[_0x46b8('0x4a')]['id']}})[_0x46b8('0x28')](handleEntityNotFound(_0x200f61,null))['then'](function(_0x3c54fd){if(_0x3c54fd){_0x3b1a4b=_0x3c54fd;_0x51e573[_0x46b8('0x33')]=_['keys'](db[_0x46b8('0x53')][_0x46b8('0x2f')]);_0x51e573['query']=_[_0x46b8('0x36')](_0x4375e7['query']);_0x51e573[_0x46b8('0x37')]=_[_0x46b8('0x39')](_0x51e573[_0x46b8('0x33')],_0x51e573[_0x46b8('0x35')]);_0x42f390['attributes']=_[_0x46b8('0x39')](_0x51e573[_0x46b8('0x33')],qs[_0x46b8('0x3a')](_0x4375e7[_0x46b8('0x35')]['fields']));_0x42f390['attributes']=_0x42f390[_0x46b8('0x38')][_0x46b8('0x3b')]?_0x42f390[_0x46b8('0x38')]:_0x51e573[_0x46b8('0x33')];_0x42f390[_0x46b8('0x3e')]=qs[_0x46b8('0x3f')](_0x4375e7[_0x46b8('0x35')][_0x46b8('0x3f')]);_0x42f390['where']=qs['filters'](_[_0x46b8('0x51')](_0x4375e7[_0x46b8('0x35')],_0x51e573['filters']));if(_0x4375e7[_0x46b8('0x35')][_0x46b8('0x41')]){_0x42f390[_0x46b8('0x40')]=_['merge'](_0x42f390['where'],{'$or':_[_0x46b8('0x34')](_0x42f390[_0x46b8('0x38')],function(_0x1d1dec){var _0x4d89c5={};_0x4d89c5[_0x1d1dec]={'$like':'%'+_0x4375e7['query'][_0x46b8('0x41')]+'%'};return _0x4d89c5;})});}_0x42f390=_[_0x46b8('0x42')]({},_0x42f390,_0x4375e7[_0x46b8('0x43')]);return _0x3b1a4b[_0x46b8('0x52')](_0x42f390);}})['then'](function(_0xe9b4db){if(_0xe9b4db){_0x47424c=_0xe9b4db['length'];if(!_0x4375e7[_0x46b8('0x35')][_0x46b8('0x3c')]('nolimit')){_0x42f390[_0x46b8('0x21')]=qs[_0x46b8('0x21')](_0x4375e7[_0x46b8('0x35')][_0x46b8('0x21')]);_0x42f390[_0x46b8('0x1f')]=qs['offset'](_0x4375e7[_0x46b8('0x35')][_0x46b8('0x1f')]);}return _0x3b1a4b[_0x46b8('0x52')](_0x42f390);}})[_0x46b8('0x28')](function(_0x50918e){if(_0x50918e){return _0x50918e?{'count':_0x47424c,'rows':_0x50918e}:null;}})[_0x46b8('0x28')](respondWithResult(_0x200f61,null))[_0x46b8('0x48')](handleError(_0x200f61,null));};exports[_0x46b8('0x54')]=function(_0x273533,_0x3d760a,_0x396256){var _0x26253d={};var _0xb2da9e={};var _0x231b7f;var _0x1099bf;return db[_0x46b8('0x44')]['findOne']({'where':{'id':_0x273533[_0x46b8('0x4a')]['id']}})[_0x46b8('0x28')](handleEntityNotFound(_0x3d760a,null))[_0x46b8('0x28')](function(_0x250bd7){if(_0x250bd7){_0x231b7f=_0x250bd7;_0xb2da9e[_0x46b8('0x33')]=_[_0x46b8('0x36')](db[_0x46b8('0x53')]['rawAttributes']);_0xb2da9e[_0x46b8('0x35')]=_[_0x46b8('0x36')](_0x273533[_0x46b8('0x35')]);_0xb2da9e[_0x46b8('0x37')]=_[_0x46b8('0x39')](_0xb2da9e[_0x46b8('0x33')],_0xb2da9e[_0x46b8('0x35')]);_0x26253d[_0x46b8('0x38')]=_[_0x46b8('0x39')](_0xb2da9e[_0x46b8('0x33')],qs[_0x46b8('0x3a')](_0x273533[_0x46b8('0x35')][_0x46b8('0x3a')]));_0x26253d[_0x46b8('0x38')]=_0x26253d[_0x46b8('0x38')][_0x46b8('0x3b')]?_0x26253d[_0x46b8('0x38')]:_0xb2da9e[_0x46b8('0x33')];_0x26253d[_0x46b8('0x3e')]=qs['sort'](_0x273533[_0x46b8('0x35')][_0x46b8('0x3f')]);_0x26253d['where']=qs['filters'](_[_0x46b8('0x51')](_0x273533[_0x46b8('0x35')],_0xb2da9e[_0x46b8('0x37')]));if(_0x273533[_0x46b8('0x35')][_0x46b8('0x41')]){_0x26253d[_0x46b8('0x40')]=_[_0x46b8('0x42')](_0x26253d[_0x46b8('0x40')],{'$or':_[_0x46b8('0x34')](_0x26253d[_0x46b8('0x38')],function(_0x578890){var _0x3c5588={};_0x3c5588[_0x578890]={'$like':'%'+_0x273533[_0x46b8('0x35')][_0x46b8('0x41')]+'%'};return _0x3c5588;})});}_0x26253d=_[_0x46b8('0x42')]({},_0x26253d,_0x273533[_0x46b8('0x43')]);return _0x231b7f['getDescriptions'](_0x26253d);}})['then'](function(_0x11a7d8){if(_0x11a7d8){_0x1099bf=_0x11a7d8[_0x46b8('0x3b')];if(!_0x273533[_0x46b8('0x35')]['hasOwnProperty'](_0x46b8('0x3d'))){_0x26253d[_0x46b8('0x21')]=qs[_0x46b8('0x21')](_0x273533[_0x46b8('0x35')][_0x46b8('0x21')]);_0x26253d['offset']=qs[_0x46b8('0x1f')](_0x273533['query'][_0x46b8('0x1f')]);}return _0x231b7f[_0x46b8('0x54')](_0x26253d);}})[_0x46b8('0x28')](function(_0x2c599d){if(_0x2c599d){return _0x2c599d?{'count':_0x1099bf,'rows':_0x2c599d}:null;}})[_0x46b8('0x28')](respondWithResult(_0x3d760a,null))[_0x46b8('0x48')](handleError(_0x3d760a,null));};exports[_0x46b8('0x55')]=function(_0x5d635c,_0x1758e3,_0x1b14fc){var _0x1b87cf={};var _0x5c4ffa={};var _0x319f9a;var _0x5decf2;return db[_0x46b8('0x44')]['findOne']({'where':{'id':_0x5d635c[_0x46b8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1758e3,null))[_0x46b8('0x28')](function(_0x5c4270){if(_0x5c4270){_0x319f9a=_0x5c4270;_0x5c4ffa[_0x46b8('0x33')]=_['keys'](db[_0x46b8('0x56')][_0x46b8('0x2f')]);_0x5c4ffa['query']=_[_0x46b8('0x36')](_0x5d635c[_0x46b8('0x35')]);_0x5c4ffa[_0x46b8('0x37')]=_[_0x46b8('0x39')](_0x5c4ffa[_0x46b8('0x33')],_0x5c4ffa[_0x46b8('0x35')]);_0x1b87cf[_0x46b8('0x38')]=_['intersection'](_0x5c4ffa['model'],qs[_0x46b8('0x3a')](_0x5d635c[_0x46b8('0x35')][_0x46b8('0x3a')]));_0x1b87cf[_0x46b8('0x38')]=_0x1b87cf['attributes']['length']?_0x1b87cf[_0x46b8('0x38')]:_0x5c4ffa[_0x46b8('0x33')];_0x1b87cf[_0x46b8('0x3e')]=qs[_0x46b8('0x3f')](_0x5d635c[_0x46b8('0x35')][_0x46b8('0x3f')]);_0x1b87cf[_0x46b8('0x40')]=qs[_0x46b8('0x37')](_[_0x46b8('0x51')](_0x5d635c[_0x46b8('0x35')],_0x5c4ffa[_0x46b8('0x37')]));if(_0x5d635c[_0x46b8('0x35')][_0x46b8('0x41')]){_0x1b87cf[_0x46b8('0x40')]=_['merge'](_0x1b87cf[_0x46b8('0x40')],{'$or':_['map'](_0x1b87cf[_0x46b8('0x38')],function(_0xf4f35a){var _0x2ba3c9={};_0x2ba3c9[_0xf4f35a]={'$like':'%'+_0x5d635c[_0x46b8('0x35')][_0x46b8('0x41')]+'%'};return _0x2ba3c9;})});}_0x1b87cf=_[_0x46b8('0x42')]({},_0x1b87cf,_0x5d635c[_0x46b8('0x43')]);return _0x319f9a[_0x46b8('0x55')](_0x1b87cf);}})[_0x46b8('0x28')](function(_0x223215){if(_0x223215){_0x5decf2=_0x223215['length'];if(!_0x5d635c[_0x46b8('0x35')]['hasOwnProperty'](_0x46b8('0x3d'))){_0x1b87cf[_0x46b8('0x21')]=qs[_0x46b8('0x21')](_0x5d635c['query'][_0x46b8('0x21')]);_0x1b87cf[_0x46b8('0x1f')]=qs[_0x46b8('0x1f')](_0x5d635c[_0x46b8('0x35')][_0x46b8('0x1f')]);}return _0x319f9a[_0x46b8('0x55')](_0x1b87cf);}})[_0x46b8('0x28')](function(_0x4fa846){if(_0x4fa846){return _0x4fa846?{'count':_0x5decf2,'rows':_0x4fa846}:null;}})[_0x46b8('0x28')](respondWithResult(_0x1758e3,null))[_0x46b8('0x48')](handleError(_0x1758e3,null));};exports[_0x46b8('0x57')]=function(_0xbd347f,_0x37aea9,_0x4c2b42){if(_0xbd347f['body']['id']){delete _0xbd347f[_0x46b8('0x4d')]['id'];}return db[_0x46b8('0x44')][_0x46b8('0x50')]({'where':{'id':_0xbd347f[_0x46b8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x37aea9,null))[_0x46b8('0x28')](function(_0x5c6fc2){if(_0x5c6fc2){return _0x5c6fc2['setTags'](_0xbd347f[_0x46b8('0x4d')][_0x46b8('0x58')]||[]);}return null;})[_0x46b8('0x28')](respondWithResult(_0x37aea9,null))[_0x46b8('0x48')](handleError(_0x37aea9,null));}; \ No newline at end of file +var _0x9af9=['sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','end','error','stack','name','send','index','map','ZendeskConfiguration','fieldName','type','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','options','includeAll','rows','show','rawAttributes','include','find','catch','create','body','params','getFields','findOne','ZendeskField','pick','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x1460f6,_0x59051a){var _0x46ce94=function(_0x1c3ddf){while(--_0x1c3ddf){_0x1460f6['push'](_0x1460f6['shift']());}};_0x46ce94(++_0x59051a);}(_0x9af9,0x1df));var _0x99af=function(_0x4aa711,_0x5bea89){_0x4aa711=_0x4aa711-0x0;var _0x3fe5b8=_0x9af9[_0x4aa711];return _0x3fe5b8;};'use strict';var emlformat=require(_0x99af('0x0'));var rimraf=require(_0x99af('0x1'));var zipdir=require(_0x99af('0x2'));var jsonpatch=require(_0x99af('0x3'));var rp=require(_0x99af('0x4'));var moment=require(_0x99af('0x5'));var BPromise=require(_0x99af('0x6'));var Mustache=require(_0x99af('0x7'));var util=require(_0x99af('0x8'));var path=require(_0x99af('0x9'));var sox=require('sox');var csv=require(_0x99af('0xa'));var ejs=require(_0x99af('0xb'));var fs=require('fs');var fs_extra=require(_0x99af('0xc'));var _=require(_0x99af('0xd'));var squel=require(_0x99af('0xe'));var crypto=require(_0x99af('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99af('0x10'));var authService=require(_0x99af('0x11'));var qs=require(_0x99af('0x12'));var as=require(_0x99af('0x13'));var hardwareService=require(_0x99af('0x14'));var logger=require(_0x99af('0x15'))('api');var utils=require(_0x99af('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x99af('0x17'));var db=require(_0x99af('0x18'))['db'];function respondWithStatusCode(_0x53d4ac,_0xd59740){_0xd59740=_0xd59740||0xcc;return function(_0x12ddd3){if(_0x12ddd3){return _0x53d4ac[_0x99af('0x19')](_0xd59740);}return _0x53d4ac[_0x99af('0x1a')](_0xd59740)['end']();};}function respondWithResult(_0x527383,_0x37bdec){_0x37bdec=_0x37bdec||0xc8;return function(_0x1f86b9){if(_0x1f86b9){return _0x527383[_0x99af('0x1a')](_0x37bdec)[_0x99af('0x1b')](_0x1f86b9);}};}function respondWithFilteredResult(_0x46a1c2,_0x467c7d){return function(_0x51a1d1){if(_0x51a1d1){var _0x3a8db9=typeof _0x467c7d[_0x99af('0x1c')]===_0x99af('0x1d')&&typeof _0x467c7d[_0x99af('0x1e')]===_0x99af('0x1d');var _0x57bc43=_0x51a1d1['count'];var _0x2bf88b=_0x3a8db9?0x0:_0x467c7d[_0x99af('0x1c')];var _0x50e5b3=_0x3a8db9?_0x51a1d1[_0x99af('0x1f')]:_0x467c7d['offset']+_0x467c7d[_0x99af('0x1e')];var _0x54d93f;if(_0x50e5b3>=_0x57bc43){_0x50e5b3=_0x57bc43;_0x54d93f=0xc8;}else{_0x54d93f=0xce;}_0x46a1c2[_0x99af('0x1a')](_0x54d93f);return _0x46a1c2[_0x99af('0x20')](_0x99af('0x21'),_0x2bf88b+'-'+_0x50e5b3+'/'+_0x57bc43)[_0x99af('0x1b')](_0x51a1d1);}return null;};}function patchUpdates(_0x3937d6){return function(_0x119c6b){try{jsonpatch['apply'](_0x119c6b,_0x3937d6,!![]);}catch(_0x48e044){return BPromise[_0x99af('0x22')](_0x48e044);}return _0x119c6b[_0x99af('0x23')]();};}function saveUpdates(_0x29feab,_0x188456){return function(_0x4da5b8){if(_0x4da5b8){return _0x4da5b8[_0x99af('0x24')](_0x29feab)['then'](function(_0x3f54ad){return _0x3f54ad;});}return null;};}function removeEntity(_0xf59e7a,_0x207fc4){return function(_0x533bd8){if(_0x533bd8){return _0x533bd8['destroy']()[_0x99af('0x25')](function(){_0xf59e7a[_0x99af('0x1a')](0xcc)[_0x99af('0x26')]();});}};}function handleEntityNotFound(_0x317b9b,_0x5cb954){return function(_0x4f9b03){if(!_0x4f9b03){_0x317b9b['sendStatus'](0x194);}return _0x4f9b03;};}function handleError(_0x2d55a5,_0xa22ea8){_0xa22ea8=_0xa22ea8||0x1f4;return function(_0x4cc419){logger[_0x99af('0x27')](_0x4cc419[_0x99af('0x28')]);if(_0x4cc419['name']){delete _0x4cc419[_0x99af('0x29')];}_0x2d55a5[_0x99af('0x1a')](_0xa22ea8)[_0x99af('0x2a')](_0x4cc419);};}exports[_0x99af('0x2b')]=function(_0x5a9f3b,_0x4cf699){var _0x4953ff={},_0x4c7e9a={},_0x3b0509={'count':0x0,'rows':[]};var _0xf81a3f=_[_0x99af('0x2c')](db[_0x99af('0x2d')]['rawAttributes'],function(_0x369f44){return{'name':_0x369f44[_0x99af('0x2e')],'type':_0x369f44[_0x99af('0x2f')]['key']};});_0x4c7e9a['model']=_['map'](_0xf81a3f,_0x99af('0x29'));_0x4c7e9a[_0x99af('0x30')]=_[_0x99af('0x31')](_0x5a9f3b[_0x99af('0x30')]);_0x4c7e9a['filters']=_[_0x99af('0x32')](_0x4c7e9a[_0x99af('0x33')],_0x4c7e9a['query']);_0x4953ff[_0x99af('0x34')]=_[_0x99af('0x32')](_0x4c7e9a[_0x99af('0x33')],qs[_0x99af('0x35')](_0x5a9f3b['query']['fields']));_0x4953ff[_0x99af('0x34')]=_0x4953ff[_0x99af('0x34')][_0x99af('0x36')]?_0x4953ff[_0x99af('0x34')]:_0x4c7e9a['model'];if(!_0x5a9f3b[_0x99af('0x30')]['hasOwnProperty'](_0x99af('0x37'))){_0x4953ff[_0x99af('0x1e')]=qs['limit'](_0x5a9f3b[_0x99af('0x30')]['limit']);_0x4953ff['offset']=qs[_0x99af('0x1c')](_0x5a9f3b[_0x99af('0x30')][_0x99af('0x1c')]);}_0x4953ff[_0x99af('0x38')]=qs[_0x99af('0x39')](_0x5a9f3b[_0x99af('0x30')][_0x99af('0x39')]);_0x4953ff[_0x99af('0x3a')]=qs[_0x99af('0x3b')](_['pick'](_0x5a9f3b[_0x99af('0x30')],_0x4c7e9a['filters']),_0xf81a3f);if(_0x5a9f3b[_0x99af('0x30')][_0x99af('0x3c')]){_0x4953ff[_0x99af('0x3a')]=_[_0x99af('0x3d')](_0x4953ff['where'],{'$or':_[_0x99af('0x2c')](_0xf81a3f,function(_0x3cee12){if(_0x3cee12[_0x99af('0x2f')]!=='VIRTUAL'){var _0x15ab1a={};_0x15ab1a[_0x3cee12[_0x99af('0x29')]]={'$like':'%'+_0x5a9f3b[_0x99af('0x30')][_0x99af('0x3c')]+'%'};return _0x15ab1a;}})});}_0x4953ff=_[_0x99af('0x3d')]({},_0x4953ff,_0x5a9f3b[_0x99af('0x3e')]);var _0xa0e5b3={'where':_0x4953ff['where']};return db[_0x99af('0x2d')][_0x99af('0x1f')](_0xa0e5b3)[_0x99af('0x25')](function(_0x5aafc1){_0x3b0509['count']=_0x5aafc1;if(_0x5a9f3b[_0x99af('0x30')][_0x99af('0x3f')]){_0x4953ff['include']=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x4953ff);})['then'](function(_0x379ea1){_0x3b0509[_0x99af('0x40')]=_0x379ea1;return _0x3b0509;})[_0x99af('0x25')](respondWithFilteredResult(_0x4cf699,_0x4953ff))['catch'](handleError(_0x4cf699,null));};exports[_0x99af('0x41')]=function(_0x14d6d0,_0x339b24){var _0x490cef={'raw':![],'where':{'id':_0x14d6d0['params']['id']}},_0x5578c4={};_0x5578c4[_0x99af('0x33')]=_[_0x99af('0x31')](db['ZendeskConfiguration'][_0x99af('0x42')]);_0x5578c4[_0x99af('0x30')]=_[_0x99af('0x31')](_0x14d6d0[_0x99af('0x30')]);_0x5578c4['filters']=_['intersection'](_0x5578c4['model'],_0x5578c4[_0x99af('0x30')]);_0x490cef['attributes']=_[_0x99af('0x32')](_0x5578c4[_0x99af('0x33')],qs[_0x99af('0x35')](_0x14d6d0[_0x99af('0x30')][_0x99af('0x35')]));_0x490cef[_0x99af('0x34')]=_0x490cef[_0x99af('0x34')][_0x99af('0x36')]?_0x490cef['attributes']:_0x5578c4['model'];if(_0x14d6d0['query'][_0x99af('0x3f')]){_0x490cef[_0x99af('0x43')]=[{'all':!![]}];}_0x490cef=_[_0x99af('0x3d')]({},_0x490cef,_0x14d6d0[_0x99af('0x3e')]);return db[_0x99af('0x2d')][_0x99af('0x44')](_0x490cef)[_0x99af('0x25')](handleEntityNotFound(_0x339b24,null))['then'](respondWithResult(_0x339b24,null))[_0x99af('0x45')](handleError(_0x339b24,null));};exports['create']=function(_0xc13e51,_0x4e2342){return db['ZendeskConfiguration'][_0x99af('0x46')](_0xc13e51[_0x99af('0x47')],{})[_0x99af('0x25')](respondWithResult(_0x4e2342,0xc9))['catch'](handleError(_0x4e2342,null));};exports[_0x99af('0x24')]=function(_0xcc6c8f,_0x410483){if(_0xcc6c8f[_0x99af('0x47')]['id']){delete _0xcc6c8f[_0x99af('0x47')]['id'];}return db[_0x99af('0x2d')]['find']({'where':{'id':_0xcc6c8f['params']['id']}})[_0x99af('0x25')](handleEntityNotFound(_0x410483,null))[_0x99af('0x25')](saveUpdates(_0xcc6c8f[_0x99af('0x47')],null))[_0x99af('0x25')](respondWithResult(_0x410483,null))['catch'](handleError(_0x410483,null));};exports['destroy']=function(_0xad77e7,_0x49cf9c){return db[_0x99af('0x2d')][_0x99af('0x44')]({'where':{'id':_0xad77e7[_0x99af('0x48')]['id']}})[_0x99af('0x25')](handleEntityNotFound(_0x49cf9c,null))[_0x99af('0x25')](removeEntity(_0x49cf9c,null))[_0x99af('0x45')](handleError(_0x49cf9c,null));};exports[_0x99af('0x49')]=function(_0x2ff21a,_0x3cbc84,_0x556a08){var _0x33f336={};var _0x5ca4f3={};var _0x1a91de;var _0x3b5efa;return db[_0x99af('0x2d')][_0x99af('0x4a')]({'where':{'id':_0x2ff21a[_0x99af('0x48')]['id']}})['then'](handleEntityNotFound(_0x3cbc84,null))[_0x99af('0x25')](function(_0x38a68c){if(_0x38a68c){_0x1a91de=_0x38a68c;_0x5ca4f3[_0x99af('0x33')]=_['keys'](db[_0x99af('0x4b')][_0x99af('0x42')]);_0x5ca4f3[_0x99af('0x30')]=_[_0x99af('0x31')](_0x2ff21a[_0x99af('0x30')]);_0x5ca4f3[_0x99af('0x3b')]=_['intersection'](_0x5ca4f3[_0x99af('0x33')],_0x5ca4f3[_0x99af('0x30')]);_0x33f336[_0x99af('0x34')]=_[_0x99af('0x32')](_0x5ca4f3[_0x99af('0x33')],qs['fields'](_0x2ff21a[_0x99af('0x30')]['fields']));_0x33f336[_0x99af('0x34')]=_0x33f336['attributes'][_0x99af('0x36')]?_0x33f336['attributes']:_0x5ca4f3['model'];_0x33f336[_0x99af('0x38')]=qs[_0x99af('0x39')](_0x2ff21a[_0x99af('0x30')][_0x99af('0x39')]);_0x33f336[_0x99af('0x3a')]=qs[_0x99af('0x3b')](_[_0x99af('0x4c')](_0x2ff21a[_0x99af('0x30')],_0x5ca4f3[_0x99af('0x3b')]));if(_0x2ff21a[_0x99af('0x30')][_0x99af('0x3c')]){_0x33f336[_0x99af('0x3a')]=_[_0x99af('0x3d')](_0x33f336[_0x99af('0x3a')],{'$or':_[_0x99af('0x2c')](_0x33f336['attributes'],function(_0x49d086){var _0x451032={};_0x451032[_0x49d086]={'$like':'%'+_0x2ff21a[_0x99af('0x30')]['filter']+'%'};return _0x451032;})});}_0x33f336=_[_0x99af('0x3d')]({},_0x33f336,_0x2ff21a[_0x99af('0x3e')]);return _0x1a91de['getFields'](_0x33f336);}})[_0x99af('0x25')](function(_0x3196db){if(_0x3196db){_0x3b5efa=_0x3196db[_0x99af('0x36')];if(!_0x2ff21a['query'][_0x99af('0x4d')]('nolimit')){_0x33f336[_0x99af('0x1e')]=qs[_0x99af('0x1e')](_0x2ff21a[_0x99af('0x30')][_0x99af('0x1e')]);_0x33f336['offset']=qs[_0x99af('0x1c')](_0x2ff21a[_0x99af('0x30')][_0x99af('0x1c')]);}return _0x1a91de[_0x99af('0x49')](_0x33f336);}})['then'](function(_0xfa553b){if(_0xfa553b){return _0xfa553b?{'count':_0x3b5efa,'rows':_0xfa553b}:null;}})[_0x99af('0x25')](respondWithResult(_0x3cbc84,null))['catch'](handleError(_0x3cbc84,null));};exports[_0x99af('0x4e')]=function(_0x30cbde,_0x5991bc,_0x2f2611){var _0x5e9506={};var _0x4c3a1a={};var _0x1a5932;var _0xff7512;return db[_0x99af('0x2d')][_0x99af('0x4a')]({'where':{'id':_0x30cbde['params']['id']}})['then'](handleEntityNotFound(_0x5991bc,null))[_0x99af('0x25')](function(_0x504bdb){if(_0x504bdb){_0x1a5932=_0x504bdb;_0x4c3a1a[_0x99af('0x33')]=_[_0x99af('0x31')](db[_0x99af('0x4b')][_0x99af('0x42')]);_0x4c3a1a[_0x99af('0x30')]=_['keys'](_0x30cbde[_0x99af('0x30')]);_0x4c3a1a[_0x99af('0x3b')]=_[_0x99af('0x32')](_0x4c3a1a[_0x99af('0x33')],_0x4c3a1a[_0x99af('0x30')]);_0x5e9506[_0x99af('0x34')]=_[_0x99af('0x32')](_0x4c3a1a[_0x99af('0x33')],qs[_0x99af('0x35')](_0x30cbde[_0x99af('0x30')][_0x99af('0x35')]));_0x5e9506['attributes']=_0x5e9506[_0x99af('0x34')][_0x99af('0x36')]?_0x5e9506[_0x99af('0x34')]:_0x4c3a1a[_0x99af('0x33')];_0x5e9506[_0x99af('0x38')]=qs[_0x99af('0x39')](_0x30cbde[_0x99af('0x30')][_0x99af('0x39')]);_0x5e9506[_0x99af('0x3a')]=qs[_0x99af('0x3b')](_[_0x99af('0x4c')](_0x30cbde['query'],_0x4c3a1a['filters']));if(_0x30cbde[_0x99af('0x30')][_0x99af('0x3c')]){_0x5e9506['where']=_[_0x99af('0x3d')](_0x5e9506['where'],{'$or':_[_0x99af('0x2c')](_0x5e9506[_0x99af('0x34')],function(_0xd79042){var _0x17b4dd={};_0x17b4dd[_0xd79042]={'$like':'%'+_0x30cbde[_0x99af('0x30')][_0x99af('0x3c')]+'%'};return _0x17b4dd;})});}_0x5e9506=_[_0x99af('0x3d')]({},_0x5e9506,_0x30cbde[_0x99af('0x3e')]);return _0x1a5932[_0x99af('0x4e')](_0x5e9506);}})[_0x99af('0x25')](function(_0x343bdd){if(_0x343bdd){_0xff7512=_0x343bdd[_0x99af('0x36')];if(!_0x30cbde['query'][_0x99af('0x4d')]('nolimit')){_0x5e9506[_0x99af('0x1e')]=qs[_0x99af('0x1e')](_0x30cbde[_0x99af('0x30')]['limit']);_0x5e9506['offset']=qs['offset'](_0x30cbde[_0x99af('0x30')][_0x99af('0x1c')]);}return _0x1a5932[_0x99af('0x4e')](_0x5e9506);}})[_0x99af('0x25')](function(_0x9f5d74){if(_0x9f5d74){return _0x9f5d74?{'count':_0xff7512,'rows':_0x9f5d74}:null;}})[_0x99af('0x25')](respondWithResult(_0x5991bc,null))[_0x99af('0x45')](handleError(_0x5991bc,null));};exports[_0x99af('0x4f')]=function(_0x246509,_0x1513aa,_0x2123f9){var _0x5820a9={};var _0x3a3302={};var _0x2b3385;var _0xb71f48;return db[_0x99af('0x2d')][_0x99af('0x4a')]({'where':{'id':_0x246509[_0x99af('0x48')]['id']}})['then'](handleEntityNotFound(_0x1513aa,null))[_0x99af('0x25')](function(_0x4ba61e){if(_0x4ba61e){_0x2b3385=_0x4ba61e;_0x3a3302[_0x99af('0x33')]=_[_0x99af('0x31')](db['ZendeskField'][_0x99af('0x42')]);_0x3a3302['query']=_[_0x99af('0x31')](_0x246509[_0x99af('0x30')]);_0x3a3302[_0x99af('0x3b')]=_[_0x99af('0x32')](_0x3a3302[_0x99af('0x33')],_0x3a3302['query']);_0x5820a9[_0x99af('0x34')]=_['intersection'](_0x3a3302['model'],qs[_0x99af('0x35')](_0x246509[_0x99af('0x30')][_0x99af('0x35')]));_0x5820a9['attributes']=_0x5820a9[_0x99af('0x34')][_0x99af('0x36')]?_0x5820a9[_0x99af('0x34')]:_0x3a3302['model'];_0x5820a9[_0x99af('0x38')]=qs[_0x99af('0x39')](_0x246509[_0x99af('0x30')][_0x99af('0x39')]);_0x5820a9[_0x99af('0x3a')]=qs[_0x99af('0x3b')](_['pick'](_0x246509['query'],_0x3a3302[_0x99af('0x3b')]));if(_0x246509[_0x99af('0x30')][_0x99af('0x3c')]){_0x5820a9[_0x99af('0x3a')]=_[_0x99af('0x3d')](_0x5820a9[_0x99af('0x3a')],{'$or':_[_0x99af('0x2c')](_0x5820a9[_0x99af('0x34')],function(_0x4cd015){var _0x3ae68e={};_0x3ae68e[_0x4cd015]={'$like':'%'+_0x246509[_0x99af('0x30')]['filter']+'%'};return _0x3ae68e;})});}_0x5820a9=_[_0x99af('0x3d')]({},_0x5820a9,_0x246509[_0x99af('0x3e')]);return _0x2b3385[_0x99af('0x4f')](_0x5820a9);}})[_0x99af('0x25')](function(_0x2bddad){if(_0x2bddad){_0xb71f48=_0x2bddad['length'];if(!_0x246509[_0x99af('0x30')][_0x99af('0x4d')](_0x99af('0x37'))){_0x5820a9[_0x99af('0x1e')]=qs['limit'](_0x246509[_0x99af('0x30')][_0x99af('0x1e')]);_0x5820a9[_0x99af('0x1c')]=qs['offset'](_0x246509[_0x99af('0x30')][_0x99af('0x1c')]);}return _0x2b3385[_0x99af('0x4f')](_0x5820a9);}})[_0x99af('0x25')](function(_0x23bb14){if(_0x23bb14){return _0x23bb14?{'count':_0xb71f48,'rows':_0x23bb14}:null;}})[_0x99af('0x25')](respondWithResult(_0x1513aa,null))[_0x99af('0x45')](handleError(_0x1513aa,null));};exports[_0x99af('0x50')]=function(_0x1b10cc,_0x40a8f3,_0x2a53de){var _0x549d5f={};var _0x2d53b6={};var _0x496629;var _0xafd90b;return db[_0x99af('0x2d')][_0x99af('0x4a')]({'where':{'id':_0x1b10cc['params']['id']}})[_0x99af('0x25')](handleEntityNotFound(_0x40a8f3,null))[_0x99af('0x25')](function(_0x167d34){if(_0x167d34){_0x496629=_0x167d34;_0x2d53b6['model']=_[_0x99af('0x31')](db[_0x99af('0x51')][_0x99af('0x42')]);_0x2d53b6[_0x99af('0x30')]=_['keys'](_0x1b10cc['query']);_0x2d53b6['filters']=_[_0x99af('0x32')](_0x2d53b6['model'],_0x2d53b6[_0x99af('0x30')]);_0x549d5f[_0x99af('0x34')]=_[_0x99af('0x32')](_0x2d53b6[_0x99af('0x33')],qs[_0x99af('0x35')](_0x1b10cc[_0x99af('0x30')]['fields']));_0x549d5f[_0x99af('0x34')]=_0x549d5f[_0x99af('0x34')]['length']?_0x549d5f[_0x99af('0x34')]:_0x2d53b6[_0x99af('0x33')];_0x549d5f[_0x99af('0x38')]=qs['sort'](_0x1b10cc[_0x99af('0x30')]['sort']);_0x549d5f[_0x99af('0x3a')]=qs[_0x99af('0x3b')](_[_0x99af('0x4c')](_0x1b10cc[_0x99af('0x30')],_0x2d53b6[_0x99af('0x3b')]));if(_0x1b10cc[_0x99af('0x30')][_0x99af('0x3c')]){_0x549d5f[_0x99af('0x3a')]=_[_0x99af('0x3d')](_0x549d5f['where'],{'$or':_[_0x99af('0x2c')](_0x549d5f[_0x99af('0x34')],function(_0x30c3db){var _0x25dbc7={};_0x25dbc7[_0x30c3db]={'$like':'%'+_0x1b10cc['query']['filter']+'%'};return _0x25dbc7;})});}_0x549d5f=_[_0x99af('0x3d')]({},_0x549d5f,_0x1b10cc[_0x99af('0x3e')]);return _0x496629[_0x99af('0x50')](_0x549d5f);}})[_0x99af('0x25')](function(_0x1e2995){if(_0x1e2995){_0xafd90b=_0x1e2995[_0x99af('0x36')];if(!_0x1b10cc[_0x99af('0x30')][_0x99af('0x4d')](_0x99af('0x37'))){_0x549d5f[_0x99af('0x1e')]=qs[_0x99af('0x1e')](_0x1b10cc[_0x99af('0x30')]['limit']);_0x549d5f[_0x99af('0x1c')]=qs[_0x99af('0x1c')](_0x1b10cc[_0x99af('0x30')][_0x99af('0x1c')]);}return _0x496629[_0x99af('0x50')](_0x549d5f);}})['then'](function(_0x31f11e){if(_0x31f11e){return _0x31f11e?{'count':_0xafd90b,'rows':_0x31f11e}:null;}})[_0x99af('0x25')](respondWithResult(_0x40a8f3,null))['catch'](handleError(_0x40a8f3,null));};exports[_0x99af('0x52')]=function(_0x51b1e6,_0x419ca8,_0x5c0197){if(_0x51b1e6['body']['id']){delete _0x51b1e6[_0x99af('0x47')]['id'];}return db['ZendeskConfiguration'][_0x99af('0x4a')]({'where':{'id':_0x51b1e6['params']['id']}})['then'](handleEntityNotFound(_0x419ca8,null))[_0x99af('0x25')](function(_0x4ed8db){if(_0x4ed8db){return _0x4ed8db[_0x99af('0x52')](_0x51b1e6[_0x99af('0x47')][_0x99af('0x53')]||[]);}return null;})[_0x99af('0x25')](respondWithResult(_0x419ca8,null))['catch'](handleError(_0x419ca8,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 521f9af..b39da46 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 _0x7334=['exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7334,0x184));var _0x4733=function(_0x83d6a8,_0x11bd19){_0x83d6a8=_0x83d6a8-0x0;var _0x19c81b=_0x7334[_0x83d6a8];return _0x19c81b;};'use strict';var _=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var logger=require(_0x4733('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4733('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4733('0x4'));var rimraf=require(_0x4733('0x5'));var config=require(_0x4733('0x6'));var attributes=require(_0x4733('0x7'));module[_0x4733('0x8')]=function(_0x449ead,_0x16d7cc){return _0x449ead[_0x4733('0x9')](_0x4733('0xa'),attributes,{'tableName':_0x4733('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c9a=['moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations','lodash','../../config/logger'];(function(_0x115e1d,_0x4f10b4){var _0x4bf999=function(_0xb78634){while(--_0xb78634){_0x115e1d['push'](_0x115e1d['shift']());}};_0x4bf999(++_0x4f10b4);}(_0x1c9a,0x98));var _0xa1c9=function(_0x38abc5,_0x244e9d){_0x38abc5=_0x38abc5-0x0;var _0x2ca7fe=_0x1c9a[_0x38abc5];return _0x2ca7fe;};'use strict';var _=require(_0xa1c9('0x0'));var util=require('util');var logger=require(_0xa1c9('0x1'))('api');var moment=require(_0xa1c9('0x2'));var BPromise=require(_0xa1c9('0x3'));var rp=require(_0xa1c9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa1c9('0x5'));var config=require(_0xa1c9('0x6'));var attributes=require(_0xa1c9('0x7'));module[_0xa1c9('0x8')]=function(_0x572229,_0x144e91){return _0x572229['define'](_0xa1c9('0x9'),attributes,{'tableName':_0xa1c9('0xa'),'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 6936c89..a9e7321 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 _0xa486=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','moment'];(function(_0x52f892,_0x26b6b3){var _0x33b5d3=function(_0x11df15){while(--_0x11df15){_0x52f892['push'](_0x52f892['shift']());}};_0x33b5d3(++_0x26b6b3);}(_0xa486,0x1c7));var _0x6a48=function(_0xf84734,_0x37d7ce){_0xf84734=_0xf84734-0x0;var _0x26988f=_0xa486[_0xf84734];return _0x26988f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6a48('0x0'));var BPromise=require(_0x6a48('0x1'));var rs=require(_0x6a48('0x2'));var fs=require('fs');var Redis=require(_0x6a48('0x3'));var db=require(_0x6a48('0x4'))['db'];var utils=require(_0x6a48('0x5'));var logger=require(_0x6a48('0x6'))(_0x6a48('0x7'));var config=require('../../config/environment');var jayson=require(_0x6a48('0x8'));var client=jayson[_0x6a48('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29482d,_0x5cee64,_0x53f0d1){return new BPromise(function(_0x616d34,_0x3208ca){return client['request'](_0x29482d,_0x53f0d1)[_0x6a48('0xa')](function(_0x12decb){logger[_0x6a48('0xb')](_0x6a48('0xc'),_0x5cee64,_0x6a48('0xd'));logger['debug'](_0x6a48('0xe'),_0x5cee64,_0x6a48('0xd'),JSON[_0x6a48('0xf')](_0x12decb));if(_0x12decb[_0x6a48('0x10')]){if(_0x12decb['error']['code']===0x1f4){logger[_0x6a48('0x10')](_0x6a48('0xc'),_0x5cee64,_0x12decb[_0x6a48('0x10')][_0x6a48('0x11')]);return _0x3208ca(_0x12decb[_0x6a48('0x10')]['message']);}logger[_0x6a48('0x10')](_0x6a48('0xc'),_0x5cee64,_0x12decb['error'][_0x6a48('0x11')]);return _0x616d34(_0x12decb['error']['message']);}else{logger['info'](_0x6a48('0xc'),_0x5cee64,_0x6a48('0xd'));_0x616d34(_0x12decb[_0x6a48('0x12')][_0x6a48('0x11')]);}})['catch'](function(_0x196df3){logger[_0x6a48('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5cee64,_0x196df3);_0x3208ca(_0x196df3);});});} \ No newline at end of file +var _0xadc3=['result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x279fc8,_0x1ba427){var _0x4521a5=function(_0xbd2f4c){while(--_0xbd2f4c){_0x279fc8['push'](_0x279fc8['shift']());}};_0x4521a5(++_0x1ba427);}(_0xadc3,0x1e6));var _0x3adc=function(_0x28933f,_0x435b53){_0x28933f=_0x28933f-0x0;var _0x573210=_0xadc3[_0x28933f];return _0x573210;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3adc('0x0'));var BPromise=require(_0x3adc('0x1'));var rs=require(_0x3adc('0x2'));var fs=require('fs');var Redis=require(_0x3adc('0x3'));var db=require(_0x3adc('0x4'))['db'];var utils=require(_0x3adc('0x5'));var logger=require(_0x3adc('0x6'))('rpc');var config=require(_0x3adc('0x7'));var jayson=require(_0x3adc('0x8'));var client=jayson[_0x3adc('0x9')][_0x3adc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47d215,_0x15b79c,_0x557dd8){return new BPromise(function(_0x12783b,_0x480cd0){return client[_0x3adc('0xb')](_0x47d215,_0x557dd8)[_0x3adc('0xc')](function(_0x4ea4ed){logger[_0x3adc('0xd')](_0x3adc('0xe'),_0x15b79c,'request\x20sent');logger[_0x3adc('0xf')](_0x3adc('0x10'),_0x15b79c,_0x3adc('0x11'),JSON['stringify'](_0x4ea4ed));if(_0x4ea4ed[_0x3adc('0x12')]){if(_0x4ea4ed[_0x3adc('0x12')]['code']===0x1f4){logger[_0x3adc('0x12')](_0x3adc('0xe'),_0x15b79c,_0x4ea4ed[_0x3adc('0x12')][_0x3adc('0x13')]);return _0x480cd0(_0x4ea4ed[_0x3adc('0x12')]['message']);}logger['error'](_0x3adc('0xe'),_0x15b79c,_0x4ea4ed[_0x3adc('0x12')][_0x3adc('0x13')]);return _0x12783b(_0x4ea4ed[_0x3adc('0x12')][_0x3adc('0x13')]);}else{logger[_0x3adc('0xd')](_0x3adc('0xe'),_0x15b79c,'request\x20sent');_0x12783b(_0x4ea4ed[_0x3adc('0x14')][_0x3adc('0x13')]);}})[_0x3adc('0x15')](function(_0x3de1a4){logger[_0x3adc('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x15b79c,_0x3de1a4);_0x480cd0(_0x3de1a4);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 014e9af..53a47fd 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 _0xa42a=['/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','isAuthenticated','index','get'];(function(_0x450ed6,_0xf10544){var _0xf32329=function(_0x11b5ff){while(--_0x11b5ff){_0x450ed6['push'](_0x450ed6['shift']());}};_0xf32329(++_0xf10544);}(_0xa42a,0x1d4));var _0xaa42=function(_0x635dac,_0x3b7bf7){_0x635dac=_0x635dac-0x0;var _0x577c4a=_0xa42a[_0x635dac];return _0x577c4a;};'use strict';var multer=require('multer');var util=require(_0xaa42('0x0'));var path=require(_0xaa42('0x1'));var timeout=require(_0xaa42('0x2'));var express=require(_0xaa42('0x3'));var router=express[_0xaa42('0x4')]();var fs_extra=require(_0xaa42('0x5'));var auth=require(_0xaa42('0x6'));var interaction=require(_0xaa42('0x7'));var config=require('../../config/environment');var controller=require(_0xaa42('0x8'));router['get']('/',auth[_0xaa42('0x9')](),controller[_0xaa42('0xa')]);router[_0xaa42('0xb')](_0xaa42('0xc'),auth[_0xaa42('0x9')](),controller[_0xaa42('0xd')]);router[_0xaa42('0xe')]('/',auth[_0xaa42('0x9')](),controller[_0xaa42('0xf')]);router['put'](_0xaa42('0xc'),auth[_0xaa42('0x9')](),controller[_0xaa42('0x10')]);router[_0xaa42('0x11')](_0xaa42('0xc'),auth[_0xaa42('0x9')](),controller[_0xaa42('0x12')]);module[_0xaa42('0x13')]=router; \ No newline at end of file +var _0xc4cc=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','exports','multer','util','path','Router'];(function(_0x5ac0f0,_0xee4d98){var _0x4aceec=function(_0x3a9044){while(--_0x3a9044){_0x5ac0f0['push'](_0x5ac0f0['shift']());}};_0x4aceec(++_0xee4d98);}(_0xc4cc,0x152));var _0xcc4c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc4cc[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xcc4c('0x0'));var util=require(_0xcc4c('0x1'));var path=require(_0xcc4c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcc4c('0x3')]();var fs_extra=require(_0xcc4c('0x4'));var auth=require(_0xcc4c('0x5'));var interaction=require(_0xcc4c('0x6'));var config=require(_0xcc4c('0x7'));var controller=require(_0xcc4c('0x8'));router[_0xcc4c('0x9')]('/',auth[_0xcc4c('0xa')](),controller[_0xcc4c('0xb')]);router[_0xcc4c('0x9')](_0xcc4c('0xc'),auth[_0xcc4c('0xa')](),controller[_0xcc4c('0xd')]);router[_0xcc4c('0xe')]('/',auth[_0xcc4c('0xa')](),controller[_0xcc4c('0xf')]);router['put'](_0xcc4c('0xc'),auth['isAuthenticated'](),controller[_0xcc4c('0x10')]);router[_0xcc4c('0x11')](_0xcc4c('0xc'),auth[_0xcc4c('0xa')](),controller['destroy']);module[_0xcc4c('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 08c672b..d6f031e 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 _0x8df7=['BOOLEAN','sequelize','ENUM','variable','customVariable','keyValue','picklist','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8df7,0x79));var _0x78df=function(_0x5bbac5,_0x1774a9){_0x5bbac5=_0x5bbac5-0x0;var _0x31c865=_0x8df7[_0x5bbac5];return _0x31c865;};'use strict';var Sequelize=require(_0x78df('0x0'));module['exports']={'type':{'type':Sequelize[_0x78df('0x1')]('string',_0x78df('0x2'),_0x78df('0x3'),_0x78df('0x4'),_0x78df('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x78df('0x6')]},'keyType':{'type':Sequelize[_0x78df('0x1')]('string',_0x78df('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x78df('0x6')]},'idField':{'type':Sequelize[_0x78df('0x6')]},'nameField':{'type':Sequelize[_0x78df('0x6')]},'customField':{'type':Sequelize[_0x78df('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x78df('0x6')]}}; \ No newline at end of file +var _0x037f=['BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x2f998a,_0xa4a4e0){var _0x12464b=function(_0x3c0907){while(--_0x3c0907){_0x2f998a['push'](_0x2f998a['shift']());}};_0x12464b(++_0xa4a4e0);}(_0x037f,0x1c3));var _0xf037=function(_0x4a04de,_0x2e342c){_0x4a04de=_0x4a04de-0x0;var _0xbbe018=_0x037f[_0x4a04de];return _0xbbe018;};'use strict';var Sequelize=require(_0xf037('0x0'));module['exports']={'type':{'type':Sequelize[_0xf037('0x1')](_0xf037('0x2'),_0xf037('0x3'),_0xf037('0x4'),_0xf037('0x5'),_0xf037('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf037('0x7')]},'keyType':{'type':Sequelize[_0xf037('0x1')]('string',_0xf037('0x3'),_0xf037('0x4'))},'keyContent':{'type':Sequelize[_0xf037('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf037('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf037('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index be010d8..32134a1 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 _0xc805=['where','merge','type','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','destroy','then','stack','name','send','index','map','ZendeskField','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0xc805,0x171));var _0x5c80=function(_0x290201,_0x279632){_0x290201=_0x290201-0x0;var _0x3d5c08=_0xc805[_0x290201];return _0x3d5c08;};'use strict';var emlformat=require(_0x5c80('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5c80('0x1'));var jsonpatch=require(_0x5c80('0x2'));var rp=require(_0x5c80('0x3'));var moment=require(_0x5c80('0x4'));var BPromise=require(_0x5c80('0x5'));var Mustache=require('mustache');var util=require(_0x5c80('0x6'));var path=require(_0x5c80('0x7'));var sox=require('sox');var csv=require(_0x5c80('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5c80('0x9'));var _=require(_0x5c80('0xa'));var squel=require(_0x5c80('0xb'));var crypto=require('crypto');var jsforce=require(_0x5c80('0xc'));var deskjs=require(_0x5c80('0xd'));var toCsv=require(_0x5c80('0x8'));var querystring=require(_0x5c80('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5c80('0xf'));var qs=require(_0x5c80('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c80('0x11'));var logger=require(_0x5c80('0x12'))(_0x5c80('0x13'));var utils=require(_0x5c80('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5c80('0x15'));var db=require(_0x5c80('0x16'))['db'];function respondWithStatusCode(_0x4d0598,_0x264cd9){_0x264cd9=_0x264cd9||0xcc;return function(_0x242888){if(_0x242888){return _0x4d0598[_0x5c80('0x17')](_0x264cd9);}return _0x4d0598[_0x5c80('0x18')](_0x264cd9)[_0x5c80('0x19')]();};}function respondWithResult(_0x332669,_0x331954){_0x331954=_0x331954||0xc8;return function(_0x5281aa){if(_0x5281aa){return _0x332669['status'](_0x331954)[_0x5c80('0x1a')](_0x5281aa);}};}function respondWithFilteredResult(_0x441acc,_0x3e9a79){return function(_0x31e242){if(_0x31e242){var _0x86f337=typeof _0x3e9a79['offset']===_0x5c80('0x1b')&&typeof _0x3e9a79[_0x5c80('0x1c')]===_0x5c80('0x1b');var _0x3dd4e5=_0x31e242[_0x5c80('0x1d')];var _0x849856=_0x86f337?0x0:_0x3e9a79[_0x5c80('0x1e')];var _0x406d5e=_0x86f337?_0x31e242[_0x5c80('0x1d')]:_0x3e9a79[_0x5c80('0x1e')]+_0x3e9a79[_0x5c80('0x1c')];var _0x18a225;if(_0x406d5e>=_0x3dd4e5){_0x406d5e=_0x3dd4e5;_0x18a225=0xc8;}else{_0x18a225=0xce;}_0x441acc[_0x5c80('0x18')](_0x18a225);return _0x441acc['set'](_0x5c80('0x1f'),_0x849856+'-'+_0x406d5e+'/'+_0x3dd4e5)[_0x5c80('0x1a')](_0x31e242);}return null;};}function patchUpdates(_0x3a7da5){return function(_0x1684bd){try{jsonpatch[_0x5c80('0x20')](_0x1684bd,_0x3a7da5,!![]);}catch(_0x2f6a85){return BPromise['reject'](_0x2f6a85);}return _0x1684bd[_0x5c80('0x21')]();};}function saveUpdates(_0x4f1dba,_0x2d3b9a){return function(_0x3b1585){if(_0x3b1585){return _0x3b1585[_0x5c80('0x22')](_0x4f1dba)['then'](function(_0x585bf9){return _0x585bf9;});}return null;};}function removeEntity(_0x197c4f,_0x2b5530){return function(_0x4474a7){if(_0x4474a7){return _0x4474a7[_0x5c80('0x23')]()[_0x5c80('0x24')](function(){_0x197c4f[_0x5c80('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ae145,_0x2355c6){return function(_0x3b5c7a){if(!_0x3b5c7a){_0x5ae145[_0x5c80('0x17')](0x194);}return _0x3b5c7a;};}function handleError(_0x460e3a,_0x14505c){_0x14505c=_0x14505c||0x1f4;return function(_0x5aa162){logger['error'](_0x5aa162[_0x5c80('0x25')]);if(_0x5aa162[_0x5c80('0x26')]){delete _0x5aa162['name'];}_0x460e3a[_0x5c80('0x18')](_0x14505c)[_0x5c80('0x27')](_0x5aa162);};}exports[_0x5c80('0x28')]=function(_0x1bf8a6,_0x1a64d0){var _0x44be73={},_0x2196e5={},_0x30247c={'count':0x0,'rows':[]};var _0xef4f94=_[_0x5c80('0x29')](db[_0x5c80('0x2a')][_0x5c80('0x2b')],function(_0x2bcccc){return{'name':_0x2bcccc['fieldName'],'type':_0x2bcccc['type'][_0x5c80('0x2c')]};});_0x2196e5[_0x5c80('0x2d')]=_['map'](_0xef4f94,_0x5c80('0x26'));_0x2196e5[_0x5c80('0x2e')]=_[_0x5c80('0x2f')](_0x1bf8a6[_0x5c80('0x2e')]);_0x2196e5['filters']=_['intersection'](_0x2196e5[_0x5c80('0x2d')],_0x2196e5[_0x5c80('0x2e')]);_0x44be73['attributes']=_[_0x5c80('0x30')](_0x2196e5[_0x5c80('0x2d')],qs[_0x5c80('0x31')](_0x1bf8a6[_0x5c80('0x2e')][_0x5c80('0x31')]));_0x44be73[_0x5c80('0x32')]=_0x44be73['attributes'][_0x5c80('0x33')]?_0x44be73[_0x5c80('0x32')]:_0x2196e5['model'];if(!_0x1bf8a6[_0x5c80('0x2e')][_0x5c80('0x34')](_0x5c80('0x35'))){_0x44be73[_0x5c80('0x1c')]=qs[_0x5c80('0x1c')](_0x1bf8a6[_0x5c80('0x2e')][_0x5c80('0x1c')]);_0x44be73['offset']=qs['offset'](_0x1bf8a6[_0x5c80('0x2e')]['offset']);}_0x44be73[_0x5c80('0x36')]=qs[_0x5c80('0x37')](_0x1bf8a6[_0x5c80('0x2e')][_0x5c80('0x37')]);_0x44be73['where']=qs[_0x5c80('0x38')](_['pick'](_0x1bf8a6[_0x5c80('0x2e')],_0x2196e5[_0x5c80('0x38')]),_0xef4f94);if(_0x1bf8a6[_0x5c80('0x2e')]['filter']){_0x44be73[_0x5c80('0x39')]=_[_0x5c80('0x3a')](_0x44be73[_0x5c80('0x39')],{'$or':_[_0x5c80('0x29')](_0xef4f94,function(_0x3ff17f){if(_0x3ff17f[_0x5c80('0x3b')]!=='VIRTUAL'){var _0x52dce5={};_0x52dce5[_0x3ff17f[_0x5c80('0x26')]]={'$like':'%'+_0x1bf8a6[_0x5c80('0x2e')]['filter']+'%'};return _0x52dce5;}})});}_0x44be73=_[_0x5c80('0x3a')]({},_0x44be73,_0x1bf8a6['options']);var _0x464567={'where':_0x44be73[_0x5c80('0x39')]};return db[_0x5c80('0x2a')]['count'](_0x464567)['then'](function(_0x3ad68d){_0x30247c['count']=_0x3ad68d;if(_0x1bf8a6[_0x5c80('0x2e')][_0x5c80('0x3c')]){_0x44be73[_0x5c80('0x3d')]=[{'all':!![]}];}return db[_0x5c80('0x2a')][_0x5c80('0x3e')](_0x44be73);})['then'](function(_0x2cde81){_0x30247c[_0x5c80('0x3f')]=_0x2cde81;return _0x30247c;})['then'](respondWithFilteredResult(_0x1a64d0,_0x44be73))[_0x5c80('0x40')](handleError(_0x1a64d0,null));};exports[_0x5c80('0x41')]=function(_0x5738e3,_0x53041b){var _0x3d921e={'raw':!![],'where':{'id':_0x5738e3[_0x5c80('0x42')]['id']}},_0x309b59={};_0x309b59[_0x5c80('0x2d')]=_[_0x5c80('0x2f')](db['ZendeskField'][_0x5c80('0x2b')]);_0x309b59[_0x5c80('0x2e')]=_['keys'](_0x5738e3['query']);_0x309b59[_0x5c80('0x38')]=_[_0x5c80('0x30')](_0x309b59['model'],_0x309b59['query']);_0x3d921e[_0x5c80('0x32')]=_[_0x5c80('0x30')](_0x309b59[_0x5c80('0x2d')],qs['fields'](_0x5738e3[_0x5c80('0x2e')][_0x5c80('0x31')]));_0x3d921e[_0x5c80('0x32')]=_0x3d921e[_0x5c80('0x32')][_0x5c80('0x33')]?_0x3d921e['attributes']:_0x309b59[_0x5c80('0x2d')];if(_0x5738e3['query'][_0x5c80('0x3c')]){_0x3d921e[_0x5c80('0x3d')]=[{'all':!![]}];}_0x3d921e=_['merge']({},_0x3d921e,_0x5738e3[_0x5c80('0x43')]);return db[_0x5c80('0x2a')]['find'](_0x3d921e)[_0x5c80('0x24')](handleEntityNotFound(_0x53041b,null))[_0x5c80('0x24')](respondWithResult(_0x53041b,null))[_0x5c80('0x40')](handleError(_0x53041b,null));};exports[_0x5c80('0x44')]=function(_0x3ad38a,_0x4fe493){return db[_0x5c80('0x2a')][_0x5c80('0x44')](_0x3ad38a['body'],{})['then'](respondWithResult(_0x4fe493,0xc9))[_0x5c80('0x40')](handleError(_0x4fe493,null));};exports[_0x5c80('0x22')]=function(_0x37953a,_0x4a28ec){if(_0x37953a[_0x5c80('0x45')]['id']){delete _0x37953a[_0x5c80('0x45')]['id'];}return db['ZendeskField'][_0x5c80('0x46')]({'where':{'id':_0x37953a[_0x5c80('0x42')]['id']}})[_0x5c80('0x24')](handleEntityNotFound(_0x4a28ec,null))['then'](saveUpdates(_0x37953a[_0x5c80('0x45')],null))[_0x5c80('0x24')](respondWithResult(_0x4a28ec,null))['catch'](handleError(_0x4a28ec,null));};exports['destroy']=function(_0x44b458,_0x45f753){return db['ZendeskField'][_0x5c80('0x46')]({'where':{'id':_0x44b458['params']['id']}})[_0x5c80('0x24')](handleEntityNotFound(_0x45f753,null))[_0x5c80('0x24')](removeEntity(_0x45f753,null))[_0x5c80('0x40')](handleError(_0x45f753,null));}; \ No newline at end of file +var _0xb767=['findAll','catch','show','params','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','undefined','count','offset','limit','status','set','reject','update','destroy','then','error','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','length','attributes','hasOwnProperty','order','pick','filter','where','merge','options','includeAll','include'];(function(_0x4da622,_0x17d1f2){var _0x202dcd=function(_0x27222d){while(--_0x27222d){_0x4da622['push'](_0x4da622['shift']());}};_0x202dcd(++_0x17d1f2);}(_0xb767,0x160));var _0x7b76=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb767[_0xfae23b];return _0x200640;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b76('0x0'));var zipdir=require(_0x7b76('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b76('0x2'));var moment=require(_0x7b76('0x3'));var BPromise=require(_0x7b76('0x4'));var Mustache=require('mustache');var util=require(_0x7b76('0x5'));var path=require('path');var sox=require(_0x7b76('0x6'));var csv=require(_0x7b76('0x7'));var ejs=require(_0x7b76('0x8'));var fs=require('fs');var fs_extra=require(_0x7b76('0x9'));var _=require(_0x7b76('0xa'));var squel=require('squel');var crypto=require(_0x7b76('0xb'));var jsforce=require(_0x7b76('0xc'));var deskjs=require(_0x7b76('0xd'));var toCsv=require(_0x7b76('0x7'));var querystring=require(_0x7b76('0xe'));var Papa=require(_0x7b76('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7b76('0x10'));var as=require(_0x7b76('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b76('0x12'))('api');var utils=require(_0x7b76('0x13'));var config=require(_0x7b76('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x7b76('0x15'))['db'];function respondWithStatusCode(_0x1301bd,_0x5f0fc6){_0x5f0fc6=_0x5f0fc6||0xcc;return function(_0x2e8534){if(_0x2e8534){return _0x1301bd[_0x7b76('0x16')](_0x5f0fc6);}return _0x1301bd['status'](_0x5f0fc6)[_0x7b76('0x17')]();};}function respondWithResult(_0x4c919f,_0x4bf9ae){_0x4bf9ae=_0x4bf9ae||0xc8;return function(_0x58f88b){if(_0x58f88b){return _0x4c919f['status'](_0x4bf9ae)[_0x7b76('0x18')](_0x58f88b);}};}function respondWithFilteredResult(_0x20a140,_0xd932df){return function(_0x26ab05){if(_0x26ab05){var _0x453a63=typeof _0xd932df['offset']===_0x7b76('0x19')&&typeof _0xd932df['limit']===_0x7b76('0x19');var _0xc80c82=_0x26ab05[_0x7b76('0x1a')];var _0x495c74=_0x453a63?0x0:_0xd932df[_0x7b76('0x1b')];var _0x534984=_0x453a63?_0x26ab05[_0x7b76('0x1a')]:_0xd932df[_0x7b76('0x1b')]+_0xd932df[_0x7b76('0x1c')];var _0x2c931a;if(_0x534984>=_0xc80c82){_0x534984=_0xc80c82;_0x2c931a=0xc8;}else{_0x2c931a=0xce;}_0x20a140[_0x7b76('0x1d')](_0x2c931a);return _0x20a140[_0x7b76('0x1e')]('Content-Range',_0x495c74+'-'+_0x534984+'/'+_0xc80c82)['json'](_0x26ab05);}return null;};}function patchUpdates(_0x21b8cc){return function(_0x1ac11d){try{jsonpatch['apply'](_0x1ac11d,_0x21b8cc,!![]);}catch(_0x15246b){return BPromise[_0x7b76('0x1f')](_0x15246b);}return _0x1ac11d['save']();};}function saveUpdates(_0x31cfeb,_0x585532){return function(_0x5984d8){if(_0x5984d8){return _0x5984d8[_0x7b76('0x20')](_0x31cfeb)['then'](function(_0x3f0990){return _0x3f0990;});}return null;};}function removeEntity(_0x197041,_0x5bbc6b){return function(_0x299979){if(_0x299979){return _0x299979[_0x7b76('0x21')]()[_0x7b76('0x22')](function(){_0x197041[_0x7b76('0x1d')](0xcc)[_0x7b76('0x17')]();});}};}function handleEntityNotFound(_0x2dfc3a,_0x434971){return function(_0x520fb4){if(!_0x520fb4){_0x2dfc3a[_0x7b76('0x16')](0x194);}return _0x520fb4;};}function handleError(_0x171295,_0x41232d){_0x41232d=_0x41232d||0x1f4;return function(_0x105a8d){logger[_0x7b76('0x23')](_0x105a8d['stack']);if(_0x105a8d[_0x7b76('0x24')]){delete _0x105a8d['name'];}_0x171295[_0x7b76('0x1d')](_0x41232d)[_0x7b76('0x25')](_0x105a8d);};}exports[_0x7b76('0x26')]=function(_0x1a759f,_0x3c504e){var _0x3ea424={},_0x58c47f={},_0x3e3185={'count':0x0,'rows':[]};var _0x125f08=_[_0x7b76('0x27')](db[_0x7b76('0x28')][_0x7b76('0x29')],function(_0x1bbfc1){return{'name':_0x1bbfc1[_0x7b76('0x2a')],'type':_0x1bbfc1[_0x7b76('0x2b')][_0x7b76('0x2c')]};});_0x58c47f['model']=_[_0x7b76('0x27')](_0x125f08,_0x7b76('0x24'));_0x58c47f[_0x7b76('0x2d')]=_[_0x7b76('0x2e')](_0x1a759f[_0x7b76('0x2d')]);_0x58c47f[_0x7b76('0x2f')]=_[_0x7b76('0x30')](_0x58c47f[_0x7b76('0x31')],_0x58c47f['query']);_0x3ea424['attributes']=_[_0x7b76('0x30')](_0x58c47f['model'],qs[_0x7b76('0x32')](_0x1a759f[_0x7b76('0x2d')][_0x7b76('0x32')]));_0x3ea424['attributes']=_0x3ea424['attributes'][_0x7b76('0x33')]?_0x3ea424[_0x7b76('0x34')]:_0x58c47f[_0x7b76('0x31')];if(!_0x1a759f[_0x7b76('0x2d')][_0x7b76('0x35')]('nolimit')){_0x3ea424['limit']=qs['limit'](_0x1a759f[_0x7b76('0x2d')][_0x7b76('0x1c')]);_0x3ea424[_0x7b76('0x1b')]=qs[_0x7b76('0x1b')](_0x1a759f[_0x7b76('0x2d')][_0x7b76('0x1b')]);}_0x3ea424[_0x7b76('0x36')]=qs['sort'](_0x1a759f[_0x7b76('0x2d')]['sort']);_0x3ea424['where']=qs[_0x7b76('0x2f')](_[_0x7b76('0x37')](_0x1a759f['query'],_0x58c47f[_0x7b76('0x2f')]),_0x125f08);if(_0x1a759f[_0x7b76('0x2d')][_0x7b76('0x38')]){_0x3ea424[_0x7b76('0x39')]=_[_0x7b76('0x3a')](_0x3ea424['where'],{'$or':_[_0x7b76('0x27')](_0x125f08,function(_0x4b8457){if(_0x4b8457[_0x7b76('0x2b')]!=='VIRTUAL'){var _0x451d5b={};_0x451d5b[_0x4b8457[_0x7b76('0x24')]]={'$like':'%'+_0x1a759f['query'][_0x7b76('0x38')]+'%'};return _0x451d5b;}})});}_0x3ea424=_[_0x7b76('0x3a')]({},_0x3ea424,_0x1a759f[_0x7b76('0x3b')]);var _0x52ae1a={'where':_0x3ea424['where']};return db[_0x7b76('0x28')][_0x7b76('0x1a')](_0x52ae1a)[_0x7b76('0x22')](function(_0x5b532c){_0x3e3185['count']=_0x5b532c;if(_0x1a759f[_0x7b76('0x2d')][_0x7b76('0x3c')]){_0x3ea424[_0x7b76('0x3d')]=[{'all':!![]}];}return db[_0x7b76('0x28')][_0x7b76('0x3e')](_0x3ea424);})[_0x7b76('0x22')](function(_0x194aee){_0x3e3185['rows']=_0x194aee;return _0x3e3185;})[_0x7b76('0x22')](respondWithFilteredResult(_0x3c504e,_0x3ea424))[_0x7b76('0x3f')](handleError(_0x3c504e,null));};exports[_0x7b76('0x40')]=function(_0x5be2e0,_0x3a0855){var _0x3ec573={'raw':!![],'where':{'id':_0x5be2e0[_0x7b76('0x41')]['id']}},_0x3496c1={};_0x3496c1['model']=_['keys'](db[_0x7b76('0x28')][_0x7b76('0x29')]);_0x3496c1['query']=_[_0x7b76('0x2e')](_0x5be2e0[_0x7b76('0x2d')]);_0x3496c1[_0x7b76('0x2f')]=_[_0x7b76('0x30')](_0x3496c1[_0x7b76('0x31')],_0x3496c1[_0x7b76('0x2d')]);_0x3ec573[_0x7b76('0x34')]=_[_0x7b76('0x30')](_0x3496c1['model'],qs[_0x7b76('0x32')](_0x5be2e0[_0x7b76('0x2d')][_0x7b76('0x32')]));_0x3ec573[_0x7b76('0x34')]=_0x3ec573[_0x7b76('0x34')][_0x7b76('0x33')]?_0x3ec573[_0x7b76('0x34')]:_0x3496c1['model'];if(_0x5be2e0['query']['includeAll']){_0x3ec573[_0x7b76('0x3d')]=[{'all':!![]}];}_0x3ec573=_[_0x7b76('0x3a')]({},_0x3ec573,_0x5be2e0[_0x7b76('0x3b')]);return db[_0x7b76('0x28')][_0x7b76('0x42')](_0x3ec573)[_0x7b76('0x22')](handleEntityNotFound(_0x3a0855,null))['then'](respondWithResult(_0x3a0855,null))['catch'](handleError(_0x3a0855,null));};exports[_0x7b76('0x43')]=function(_0x2866f4,_0x57a82c){return db[_0x7b76('0x28')][_0x7b76('0x43')](_0x2866f4['body'],{})[_0x7b76('0x22')](respondWithResult(_0x57a82c,0xc9))[_0x7b76('0x3f')](handleError(_0x57a82c,null));};exports['update']=function(_0x41341d,_0x36a023){if(_0x41341d[_0x7b76('0x44')]['id']){delete _0x41341d[_0x7b76('0x44')]['id'];}return db[_0x7b76('0x28')][_0x7b76('0x42')]({'where':{'id':_0x41341d['params']['id']}})['then'](handleEntityNotFound(_0x36a023,null))[_0x7b76('0x22')](saveUpdates(_0x41341d[_0x7b76('0x44')],null))['then'](respondWithResult(_0x36a023,null))[_0x7b76('0x3f')](handleError(_0x36a023,null));};exports[_0x7b76('0x21')]=function(_0x26db01,_0x267452){return db[_0x7b76('0x28')][_0x7b76('0x42')]({'where':{'id':_0x26db01['params']['id']}})[_0x7b76('0x22')](handleEntityNotFound(_0x267452,null))['then'](removeEntity(_0x267452,null))[_0x7b76('0x3f')](handleError(_0x267452,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 26ad705..67a861c 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 _0xa8a0=['bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','api','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa8a0,0xb7));var _0x0a8a=function(_0x2540af,_0x1dd27d){_0x2540af=_0x2540af-0x0;var _0x2399c0=_0xa8a0[_0x2540af];return _0x2399c0;};'use strict';var _=require(_0x0a8a('0x0'));var util=require(_0x0a8a('0x1'));var logger=require('../../config/logger')(_0x0a8a('0x2'));var moment=require(_0x0a8a('0x3'));var BPromise=require(_0x0a8a('0x4'));var rp=require(_0x0a8a('0x5'));var fs=require('fs');var path=require(_0x0a8a('0x6'));var rimraf=require(_0x0a8a('0x7'));var config=require(_0x0a8a('0x8'));var attributes=require(_0x0a8a('0x9'));module[_0x0a8a('0xa')]=function(_0x4f0086,_0x29b6d2){return _0x4f0086[_0x0a8a('0xb')](_0x0a8a('0xc'),attributes,{'tableName':_0x0a8a('0xd'),'paranoid':![],'indexes':[{'name':_0x0a8a('0xe'),'fields':[_0x0a8a('0xf'),_0x0a8a('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb3=['int_zendesk_fields','lodash','util','moment','path','rimraf','../../config/environment','./intZendeskField.attributes','define','ZendeskField'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0x1cb3,0x6f));var _0x31cb=function(_0x1f7b07,_0x1635b5){_0x1f7b07=_0x1f7b07-0x0;var _0x13f3e3=_0x1cb3[_0x1f7b07];return _0x13f3e3;};'use strict';var _=require(_0x31cb('0x0'));var util=require(_0x31cb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x31cb('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x31cb('0x3'));var rimraf=require(_0x31cb('0x4'));var config=require(_0x31cb('0x5'));var attributes=require(_0x31cb('0x6'));module['exports']=function(_0x226136,_0x32f641){return _0x226136[_0x31cb('0x7')](_0x31cb('0x8'),attributes,{'tableName':_0x31cb('0x9'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index f97197a..4f1367d 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 _0x57cb=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','lodash','bluebird','randomstring'];(function(_0x27f11f,_0x2256c8){var _0x3baf31=function(_0x7226e){while(--_0x7226e){_0x27f11f['push'](_0x27f11f['shift']());}};_0x3baf31(++_0x2256c8);}(_0x57cb,0x97));var _0xb57c=function(_0x47007d,_0x250503){_0x47007d=_0x47007d-0x0;var _0x3cd192=_0x57cb[_0x47007d];return _0x3cd192;};'use strict';var _=require(_0xb57c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb57c('0x1'));var rs=require(_0xb57c('0x2'));var fs=require('fs');var Redis=require(_0xb57c('0x3'));var db=require(_0xb57c('0x4'))['db'];var utils=require(_0xb57c('0x5'));var logger=require(_0xb57c('0x6'))(_0xb57c('0x7'));var config=require('../../config/environment');var jayson=require(_0xb57c('0x8'));var client=jayson[_0xb57c('0x9')][_0xb57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x163237,_0x213952,_0x42ffa4){return new BPromise(function(_0x3dce9c,_0x498f36){return client[_0xb57c('0xb')](_0x163237,_0x42ffa4)['then'](function(_0xc9e113){logger[_0xb57c('0xc')](_0xb57c('0xd'),_0x213952,'request\x20sent');logger[_0xb57c('0xe')](_0xb57c('0xf'),_0x213952,_0xb57c('0x10'),JSON[_0xb57c('0x11')](_0xc9e113));if(_0xc9e113['error']){if(_0xc9e113['error'][_0xb57c('0x12')]===0x1f4){logger[_0xb57c('0x13')](_0xb57c('0xd'),_0x213952,_0xc9e113[_0xb57c('0x13')]['message']);return _0x498f36(_0xc9e113['error'][_0xb57c('0x14')]);}logger[_0xb57c('0x13')](_0xb57c('0xd'),_0x213952,_0xc9e113[_0xb57c('0x13')][_0xb57c('0x14')]);return _0x3dce9c(_0xc9e113['error'][_0xb57c('0x14')]);}else{logger[_0xb57c('0xc')](_0xb57c('0xd'),_0x213952,'request\x20sent');_0x3dce9c(_0xc9e113[_0xb57c('0x15')]['message']);}})['catch'](function(_0x382bcc){logger[_0xb57c('0x13')](_0xb57c('0xd'),_0x213952,_0x382bcc);_0x498f36(_0x382bcc);});});} \ No newline at end of file +var _0xd870=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','ZendeskField,\x20%s,\x20%s','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x509a87,_0x302ed9){var _0x54b378=function(_0x443aa8){while(--_0x443aa8){_0x509a87['push'](_0x509a87['shift']());}};_0x54b378(++_0x302ed9);}(_0xd870,0x18d));var _0x0d87=function(_0x3e2a18,_0x573b6a){_0x3e2a18=_0x3e2a18-0x0;var _0x1a7005=_0xd870[_0x3e2a18];return _0x1a7005;};'use strict';var _=require(_0x0d87('0x0'));var util=require(_0x0d87('0x1'));var moment=require(_0x0d87('0x2'));var BPromise=require(_0x0d87('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d87('0x4'));var db=require(_0x0d87('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d87('0x6'))(_0x0d87('0x7'));var config=require(_0x0d87('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0d87('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16acf3,_0x26f3b4,_0x443c86){return new BPromise(function(_0x40fa3d,_0x1554f1){return client[_0x0d87('0xa')](_0x16acf3,_0x443c86)['then'](function(_0x118af1){logger[_0x0d87('0xb')](_0x0d87('0xc'),_0x26f3b4,'request\x20sent');logger['debug'](_0x0d87('0xd'),_0x26f3b4,_0x0d87('0xe'),JSON[_0x0d87('0xf')](_0x118af1));if(_0x118af1[_0x0d87('0x10')]){if(_0x118af1[_0x0d87('0x10')][_0x0d87('0x11')]===0x1f4){logger[_0x0d87('0x10')](_0x0d87('0xc'),_0x26f3b4,_0x118af1[_0x0d87('0x10')][_0x0d87('0x12')]);return _0x1554f1(_0x118af1['error']['message']);}logger[_0x0d87('0x10')](_0x0d87('0xc'),_0x26f3b4,_0x118af1[_0x0d87('0x10')][_0x0d87('0x12')]);return _0x40fa3d(_0x118af1[_0x0d87('0x10')]['message']);}else{logger[_0x0d87('0xb')](_0x0d87('0xc'),_0x26f3b4,_0x0d87('0xe'));_0x40fa3d(_0x118af1[_0x0d87('0x13')][_0x0d87('0x12')]);}})[_0x0d87('0x14')](function(_0x4209cf){logger[_0x0d87('0x10')]('ZendeskField,\x20%s,\x20%s',_0x26f3b4,_0x4209cf);_0x1554f1(_0x4209cf);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 3126a08..0ceec7b 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 _0x8b37=['./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x5c0c04,_0x20213a){var _0x7729f=function(_0x33c636){while(--_0x33c636){_0x5c0c04['push'](_0x5c0c04['shift']());}};_0x7729f(++_0x20213a);}(_0x8b37,0x13b));var _0x78b3=function(_0xd002a1,_0x2bfa06){_0xd002a1=_0xd002a1-0x0;var _0x56490c=_0x8b37[_0xd002a1];return _0x56490c;};'use strict';var multer=require(_0x78b3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x78b3('0x1'));var express=require(_0x78b3('0x2'));var router=express[_0x78b3('0x3')]();var fs_extra=require(_0x78b3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x78b3('0x5'));var config=require(_0x78b3('0x6'));var controller=require(_0x78b3('0x7'));router[_0x78b3('0x8')]('/',auth[_0x78b3('0x9')](),controller[_0x78b3('0xa')]);router['get'](_0x78b3('0xb'),auth[_0x78b3('0x9')](),controller[_0x78b3('0xc')]);router[_0x78b3('0x8')](_0x78b3('0xd'),auth[_0x78b3('0x9')](),controller[_0x78b3('0xe')]);router[_0x78b3('0x8')](_0x78b3('0xf'),auth[_0x78b3('0x9')](),controller[_0x78b3('0x10')]);router[_0x78b3('0x11')]('/',auth[_0x78b3('0x9')](),controller[_0x78b3('0x12')]);router['post'](_0x78b3('0xd'),auth[_0x78b3('0x9')](),controller['addConfiguration']);router[_0x78b3('0x13')](_0x78b3('0xb'),auth[_0x78b3('0x9')](),controller[_0x78b3('0x14')]);router['delete']('/:id',auth[_0x78b3('0x9')](),controller[_0x78b3('0x15')]);module[_0x78b3('0x16')]=router; \ No newline at end of file +var _0x6fce=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put'];(function(_0x3fb4fe,_0x383128){var _0x26388f=function(_0x3829a7){while(--_0x3829a7){_0x3fb4fe['push'](_0x3fb4fe['shift']());}};_0x26388f(++_0x383128);}(_0x6fce,0x13c));var _0xe6fc=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x6fce[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0xe6fc('0x0'));var util=require(_0xe6fc('0x1'));var path=require(_0xe6fc('0x2'));var timeout=require(_0xe6fc('0x3'));var express=require(_0xe6fc('0x4'));var router=express[_0xe6fc('0x5')]();var fs_extra=require(_0xe6fc('0x6'));var auth=require(_0xe6fc('0x7'));var interaction=require(_0xe6fc('0x8'));var config=require(_0xe6fc('0x9'));var controller=require(_0xe6fc('0xa'));router[_0xe6fc('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe6fc('0xb')](_0xe6fc('0xc'),auth[_0xe6fc('0xd')](),controller[_0xe6fc('0xe')]);router['get'](_0xe6fc('0xf'),auth['isAuthenticated'](),controller[_0xe6fc('0x10')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xe6fc('0x11')]);router[_0xe6fc('0x12')]('/',auth['isAuthenticated'](),controller[_0xe6fc('0x13')]);router[_0xe6fc('0x12')](_0xe6fc('0xf'),auth['isAuthenticated'](),controller[_0xe6fc('0x14')]);router[_0xe6fc('0x15')](_0xe6fc('0xc'),auth[_0xe6fc('0xd')](),controller[_0xe6fc('0x16')]);router[_0xe6fc('0x17')](_0xe6fc('0xc'),auth[_0xe6fc('0xd')](),controller[_0xe6fc('0x18')]);module[_0xe6fc('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index aaf2302..e1ac870 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 _0x702d=['sequelize','exports','STRING'];(function(_0x3950a2,_0x4458fb){var _0x4fbdea=function(_0x31d06d){while(--_0x31d06d){_0x3950a2['push'](_0x3950a2['shift']());}};_0x4fbdea(++_0x4458fb);}(_0x702d,0x147));var _0xd702=function(_0x507b01,_0x4696e9){_0x507b01=_0x507b01-0x0;var _0x5da02a=_0x702d[_0x507b01];return _0x5da02a;};'use strict';var Sequelize=require(_0xd702('0x0'));module[_0xd702('0x1')]={'name':{'type':Sequelize[_0xd702('0x2')]},'description':{'type':Sequelize[_0xd702('0x2')]},'host':{'type':Sequelize[_0xd702('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xd702('0x2')]},'clientSecret':{'type':Sequelize[_0xd702('0x2')]},'serverUrl':{'type':Sequelize[_0xd702('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xd702('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5c12=['exports','STRING'];(function(_0x1b5e18,_0x51c3a0){var _0x84c6fd=function(_0x3cab83){while(--_0x3cab83){_0x1b5e18['push'](_0x1b5e18['shift']());}};_0x84c6fd(++_0x51c3a0);}(_0x5c12,0x188));var _0x25c1=function(_0x10b317,_0x2adf32){_0x10b317=_0x10b317-0x0;var _0x1e3054=_0x5c12[_0x10b317];return _0x1e3054;};'use strict';var Sequelize=require('sequelize');module[_0x25c1('0x0')]={'name':{'type':Sequelize[_0x25c1('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x25c1('0x1')]},'zone':{'type':Sequelize[_0x25c1('0x1')]},'clientId':{'type':Sequelize[_0x25c1('0x1')]},'clientSecret':{'type':Sequelize[_0x25c1('0x1')]},'serverUrl':{'type':Sequelize[_0x25c1('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x25c1('0x1')]},'refreshToken':{'type':Sequelize[_0x25c1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index c63ddef..9d35019 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 _0x781b=['save','update','then','error','stack','name','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','VIRTUAL','filter','ZohoAccount','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','getConfigurations','findOne','ZohoConfiguration','where','AccountId','Subjects','Descriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','clientId','clientSecret','refresh_token','access_token','getFields','serverUrl','code','host','zoho.eu','slice','substring','lastIndexOf','refreshToken','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','api_name','system_mandatory','push','custom_field','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject'];(function(_0x19648c,_0x1ad579){var _0x376981=function(_0x300bf0){while(--_0x300bf0){_0x19648c['push'](_0x19648c['shift']());}};_0x376981(++_0x1ad579);}(_0x781b,0x1c9));var _0xb781=function(_0x21d3d5,_0x38163c){_0x21d3d5=_0x21d3d5-0x0;var _0xf0057b=_0x781b[_0x21d3d5];return _0xf0057b;};'use strict';var emlformat=require(_0xb781('0x0'));var rimraf=require(_0xb781('0x1'));var zipdir=require(_0xb781('0x2'));var jsonpatch=require(_0xb781('0x3'));var rp=require(_0xb781('0x4'));var moment=require(_0xb781('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb781('0x6'));var util=require(_0xb781('0x7'));var path=require(_0xb781('0x8'));var sox=require(_0xb781('0x9'));var csv=require(_0xb781('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb781('0xb'));var squel=require(_0xb781('0xc'));var crypto=require('crypto');var jsforce=require(_0xb781('0xd'));var deskjs=require(_0xb781('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb781('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb781('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb781('0x11'));var logger=require(_0xb781('0x12'))('api');var utils=require(_0xb781('0x13'));var config=require(_0xb781('0x14'));var licenseUtil=require(_0xb781('0x15'));var db=require(_0xb781('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2e24c8,_0x31a102){_0x31a102=_0x31a102||0xcc;return function(_0x46b13d){if(_0x46b13d){return _0x2e24c8[_0xb781('0x17')](_0x31a102);}return _0x2e24c8[_0xb781('0x18')](_0x31a102)[_0xb781('0x19')]();};}function respondWithResult(_0x2a27ee,_0x1737a9){_0x1737a9=_0x1737a9||0xc8;return function(_0x5d8d5a){if(_0x5d8d5a){return _0x2a27ee[_0xb781('0x18')](_0x1737a9)[_0xb781('0x1a')](_0x5d8d5a);}};}function respondWithFilteredResult(_0xb18c79,_0x268098){return function(_0xc628ce){if(_0xc628ce){var _0x3c2361=typeof _0x268098['offset']===_0xb781('0x1b')&&typeof _0x268098[_0xb781('0x1c')]===_0xb781('0x1b');var _0x3b7e82=_0xc628ce[_0xb781('0x1d')];var _0x320314=_0x3c2361?0x0:_0x268098[_0xb781('0x1e')];var _0x3b6409=_0x3c2361?_0xc628ce[_0xb781('0x1d')]:_0x268098[_0xb781('0x1e')]+_0x268098[_0xb781('0x1c')];var _0x3c2435;if(_0x3b6409>=_0x3b7e82){_0x3b6409=_0x3b7e82;_0x3c2435=0xc8;}else{_0x3c2435=0xce;}_0xb18c79[_0xb781('0x18')](_0x3c2435);return _0xb18c79[_0xb781('0x1f')](_0xb781('0x20'),_0x320314+'-'+_0x3b6409+'/'+_0x3b7e82)['json'](_0xc628ce);}return null;};}function patchUpdates(_0x4cac67){return function(_0xb9e707){try{jsonpatch[_0xb781('0x21')](_0xb9e707,_0x4cac67,!![]);}catch(_0x489332){return BPromise[_0xb781('0x22')](_0x489332);}return _0xb9e707[_0xb781('0x23')]();};}function saveUpdates(_0x1fef21,_0x1f0ad5){return function(_0x3135ce){if(_0x3135ce){return _0x3135ce[_0xb781('0x24')](_0x1fef21)[_0xb781('0x25')](function(_0x982566){return _0x982566;});}return null;};}function removeEntity(_0x205e76,_0x48dce6){return function(_0x1ae027){if(_0x1ae027){return _0x1ae027['destroy']()[_0xb781('0x25')](function(){_0x205e76[_0xb781('0x18')](0xcc)[_0xb781('0x19')]();});}};}function handleEntityNotFound(_0x3fa4c9,_0x33fb9c){return function(_0x41d6a7){if(!_0x41d6a7){_0x3fa4c9[_0xb781('0x17')](0x194);}return _0x41d6a7;};}function handleError(_0xab275d,_0x4b39ea){_0x4b39ea=_0x4b39ea||0x1f4;return function(_0x5c947f){logger[_0xb781('0x26')](_0x5c947f[_0xb781('0x27')]);if(_0x5c947f['name']){delete _0x5c947f[_0xb781('0x28')];}_0xab275d[_0xb781('0x18')](_0x4b39ea)['send'](_0x5c947f);};}exports[_0xb781('0x29')]=function(_0x439f3f,_0x1519e4){var _0x5af101={},_0x233a4f={},_0x3a0a73={'count':0x0,'rows':[]};var _0x4370df=_[_0xb781('0x2a')](db['ZohoAccount'][_0xb781('0x2b')],function(_0x1c02ce){return{'name':_0x1c02ce['fieldName'],'type':_0x1c02ce[_0xb781('0x2c')]['key']};});_0x233a4f[_0xb781('0x2d')]=_['map'](_0x4370df,'name');_0x233a4f[_0xb781('0x2e')]=_[_0xb781('0x2f')](_0x439f3f[_0xb781('0x2e')]);_0x233a4f[_0xb781('0x30')]=_[_0xb781('0x31')](_0x233a4f[_0xb781('0x2d')],_0x233a4f['query']);_0x5af101[_0xb781('0x32')]=_['intersection'](_0x233a4f['model'],qs[_0xb781('0x33')](_0x439f3f[_0xb781('0x2e')]['fields']));_0x5af101['attributes']=_0x5af101['attributes'][_0xb781('0x34')]?_0x5af101['attributes']:_0x233a4f['model'];if(!_0x439f3f[_0xb781('0x2e')][_0xb781('0x35')](_0xb781('0x36'))){_0x5af101[_0xb781('0x1c')]=qs[_0xb781('0x1c')](_0x439f3f[_0xb781('0x2e')][_0xb781('0x1c')]);_0x5af101[_0xb781('0x1e')]=qs[_0xb781('0x1e')](_0x439f3f[_0xb781('0x2e')][_0xb781('0x1e')]);}_0x5af101[_0xb781('0x37')]=qs['sort'](_0x439f3f[_0xb781('0x2e')][_0xb781('0x38')]);_0x5af101['where']=qs[_0xb781('0x30')](_[_0xb781('0x39')](_0x439f3f['query'],_0x233a4f['filters']),_0x4370df);if(_0x439f3f[_0xb781('0x2e')]['filter']){_0x5af101['where']=_[_0xb781('0x3a')](_0x5af101['where'],{'$or':_[_0xb781('0x2a')](_0x4370df,function(_0x45561d){if(_0x45561d[_0xb781('0x2c')]!==_0xb781('0x3b')){var _0x1a6fba={};_0x1a6fba[_0x45561d[_0xb781('0x28')]]={'$like':'%'+_0x439f3f[_0xb781('0x2e')][_0xb781('0x3c')]+'%'};return _0x1a6fba;}})});}_0x5af101=_[_0xb781('0x3a')]({},_0x5af101,_0x439f3f['options']);var _0x50f38e={'where':_0x5af101['where']};return db[_0xb781('0x3d')][_0xb781('0x1d')](_0x50f38e)[_0xb781('0x25')](function(_0x265f02){_0x3a0a73['count']=_0x265f02;if(_0x439f3f[_0xb781('0x2e')][_0xb781('0x3e')]){_0x5af101[_0xb781('0x3f')]=[{'all':!![]}];}return db[_0xb781('0x3d')][_0xb781('0x40')](_0x5af101);})[_0xb781('0x25')](function(_0x35fdd2){_0x3a0a73[_0xb781('0x41')]=_0x35fdd2;return _0x3a0a73;})[_0xb781('0x25')](respondWithFilteredResult(_0x1519e4,_0x5af101))[_0xb781('0x42')](handleError(_0x1519e4,null));};exports[_0xb781('0x43')]=function(_0x4c7e6b,_0x5c537e){var _0x4e293e={'raw':![],'where':{'id':_0x4c7e6b[_0xb781('0x44')]['id']}},_0x3ea16c={};_0x3ea16c[_0xb781('0x2d')]=_[_0xb781('0x2f')](db[_0xb781('0x3d')][_0xb781('0x2b')]);_0x3ea16c[_0xb781('0x2e')]=_['keys'](_0x4c7e6b[_0xb781('0x2e')]);_0x3ea16c['filters']=_[_0xb781('0x31')](_0x3ea16c[_0xb781('0x2d')],_0x3ea16c[_0xb781('0x2e')]);_0x4e293e[_0xb781('0x32')]=_[_0xb781('0x31')](_0x3ea16c[_0xb781('0x2d')],qs[_0xb781('0x33')](_0x4c7e6b[_0xb781('0x2e')][_0xb781('0x33')]));_0x4e293e['attributes']=_0x4e293e[_0xb781('0x32')]['length']?_0x4e293e[_0xb781('0x32')]:_0x3ea16c['model'];if(_0x4c7e6b['query']['includeAll']){_0x4e293e['include']=[{'all':!![]}];}_0x4e293e=_[_0xb781('0x3a')]({},_0x4e293e,_0x4c7e6b[_0xb781('0x45')]);return db[_0xb781('0x3d')][_0xb781('0x46')](_0x4e293e)[_0xb781('0x25')](handleEntityNotFound(_0x5c537e,null))[_0xb781('0x25')](respondWithResult(_0x5c537e,null))['catch'](handleError(_0x5c537e,null));};exports[_0xb781('0x47')]=function(_0x5032e0,_0x3a811d){return db['ZohoAccount'][_0xb781('0x47')](_0x5032e0['body'],{})[_0xb781('0x25')](respondWithResult(_0x3a811d,0xc9))['catch'](handleError(_0x3a811d,null));};exports[_0xb781('0x24')]=function(_0x3227d4,_0x4af05b){if(_0x3227d4[_0xb781('0x48')]['id']){delete _0x3227d4[_0xb781('0x48')]['id'];}return db[_0xb781('0x3d')][_0xb781('0x46')]({'where':{'id':_0x3227d4[_0xb781('0x44')]['id']}})[_0xb781('0x25')](handleEntityNotFound(_0x4af05b,null))[_0xb781('0x25')](saveUpdates(_0x3227d4[_0xb781('0x48')],null))[_0xb781('0x25')](respondWithResult(_0x4af05b,null))['catch'](handleError(_0x4af05b,null));};exports[_0xb781('0x49')]=function(_0x1c4901,_0x37ab12){return db['ZohoAccount'][_0xb781('0x46')]({'where':{'id':_0x1c4901[_0xb781('0x44')]['id']}})[_0xb781('0x25')](handleEntityNotFound(_0x37ab12,null))[_0xb781('0x25')](removeEntity(_0x37ab12,null))[_0xb781('0x42')](handleError(_0x37ab12,null));};exports[_0xb781('0x4a')]=function(_0xc7d12a,_0x24f802,_0xfb6e7a){var _0x1b8c23={};var _0x2c0d10={};var _0x5356a0;var _0x111b22;return db[_0xb781('0x3d')][_0xb781('0x4b')]({'where':{'id':_0xc7d12a['params']['id']}})[_0xb781('0x25')](handleEntityNotFound(_0x24f802,null))[_0xb781('0x25')](function(_0x2e5d31){if(_0x2e5d31){_0x5356a0=_0x2e5d31;_0x2c0d10[_0xb781('0x2d')]=_[_0xb781('0x2f')](db[_0xb781('0x4c')][_0xb781('0x2b')]);_0x2c0d10[_0xb781('0x2e')]=_[_0xb781('0x2f')](_0xc7d12a['query']);_0x2c0d10[_0xb781('0x30')]=_[_0xb781('0x31')](_0x2c0d10[_0xb781('0x2d')],_0x2c0d10['query']);_0x1b8c23[_0xb781('0x32')]=_[_0xb781('0x31')](_0x2c0d10['model'],qs[_0xb781('0x33')](_0xc7d12a[_0xb781('0x2e')][_0xb781('0x33')]));_0x1b8c23[_0xb781('0x32')]=_0x1b8c23['attributes']['length']?_0x1b8c23[_0xb781('0x32')]:_0x2c0d10[_0xb781('0x2d')];_0x1b8c23[_0xb781('0x37')]=qs[_0xb781('0x38')](_0xc7d12a[_0xb781('0x2e')][_0xb781('0x38')]);_0x1b8c23['where']=qs[_0xb781('0x30')](_[_0xb781('0x39')](_0xc7d12a[_0xb781('0x2e')],_0x2c0d10['filters']));if(_0xc7d12a[_0xb781('0x2e')][_0xb781('0x3c')]){_0x1b8c23[_0xb781('0x4d')]=_['merge'](_0x1b8c23[_0xb781('0x4d')],{'$or':_[_0xb781('0x2a')](_0x1b8c23[_0xb781('0x32')],function(_0x43e168){var _0x352e5f={};_0x352e5f[_0x43e168]={'$like':'%'+_0xc7d12a[_0xb781('0x2e')][_0xb781('0x3c')]+'%'};return _0x352e5f;})});}_0x1b8c23=_['merge']({},_0x1b8c23,_0xc7d12a['options']);return _0x5356a0[_0xb781('0x4a')](_0x1b8c23);}})[_0xb781('0x25')](function(_0xc0ddfa){if(_0xc0ddfa){_0x111b22=_0xc0ddfa[_0xb781('0x34')];if(!_0xc7d12a['query']['hasOwnProperty'](_0xb781('0x36'))){_0x1b8c23[_0xb781('0x1c')]=qs['limit'](_0xc7d12a[_0xb781('0x2e')]['limit']);_0x1b8c23[_0xb781('0x1e')]=qs[_0xb781('0x1e')](_0xc7d12a[_0xb781('0x2e')][_0xb781('0x1e')]);}return _0x5356a0[_0xb781('0x4a')](_0x1b8c23);}})[_0xb781('0x25')](function(_0x1f70c0){if(_0x1f70c0){return _0x1f70c0?{'count':_0x111b22,'rows':_0x1f70c0}:null;}})[_0xb781('0x25')](respondWithResult(_0x24f802,null))[_0xb781('0x42')](handleError(_0x24f802,null));};exports['addConfiguration']=function(_0x43c7e2,_0x77bc7a,_0x256aa4){if(_0x43c7e2[_0xb781('0x48')]['id']){delete _0x43c7e2[_0xb781('0x48')]['id'];}return db[_0xb781('0x3d')][_0xb781('0x4b')]({'where':{'id':_0x43c7e2['params']['id']}})[_0xb781('0x25')](handleEntityNotFound(_0x77bc7a,null))[_0xb781('0x25')](function(_0x5b9f87){if(_0x5b9f87){_0x43c7e2[_0xb781('0x48')][_0xb781('0x4e')]=_0x5b9f87['id'];_0x43c7e2[_0xb781('0x48')][_0xb781('0x4f')]=integrations['getSubjects'](_0x43c7e2['body']['channel'],_0x43c7e2['body'][_0xb781('0x2c')]);_0x43c7e2[_0xb781('0x48')][_0xb781('0x50')]=integrations['getDescriptions'](_0x43c7e2['body'][_0xb781('0x51')],_0x43c7e2[_0xb781('0x48')][_0xb781('0x2c')]);return db[_0xb781('0x4c')][_0xb781('0x47')](_0x43c7e2[_0xb781('0x48')],{'include':[{'model':db[_0xb781('0x52')],'as':'Subjects'},{'model':db[_0xb781('0x52')],'as':_0xb781('0x50')}]});}return null;})[_0xb781('0x25')](respondWithResult(_0x77bc7a,null))[_0xb781('0x42')](handleError(_0x77bc7a,null));};function getAccessToken(_0x3ae726){return new Promise(function(_0x28382b,_0x51fdac){var _0x33cc53;switch(_0x3ae726[_0xb781('0x53')]){case'US':_0x33cc53=_0xb781('0x54');break;case'AU':_0x33cc53=_0xb781('0x55');break;case'EU':_0x33cc53=_0xb781('0x56');break;case'IN':_0x33cc53=_0xb781('0x57');break;case'CN':_0x33cc53='https://accounts.zoho.com.cn';break;default:_0x33cc53=_0xb781('0x56');break;}var _0x565b9e={'method':_0xb781('0x58'),'uri':_0x33cc53+'/oauth/v2/token','qs':{'refresh_token':_0x3ae726['refreshToken'],'client_id':_0x3ae726[_0xb781('0x59')],'client_secret':_0x3ae726[_0xb781('0x5a')],'grant_type':_0xb781('0x5b')},'json':!![]};return rp(_0x565b9e)['then'](function(_0x14acd9){if(_0x14acd9[_0xb781('0x5c')]){_0x28382b(_0x14acd9['access_token']);}else{_0x51fdac('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xb781('0x42')](function(_0x56ebc8){_0x51fdac(_0x56ebc8);});});}exports[_0xb781('0x5d')]=function(_0x544c57,_0x5bf413,_0x4badb2){var _0xe6b940,_0x3cd908,_0x18f82b,_0x1f8e16,_0x1cea6f;return db[_0xb781('0x3d')][_0xb781('0x4b')]({'where':{'id':_0x544c57['params']['id']},'attributes':['id','host',_0xb781('0x53'),'clientId',_0xb781('0x5a'),_0xb781('0x5e'),_0xb781('0x5f'),'refreshToken']})['then'](handleEntityNotFound(_0x5bf413,null))[_0xb781('0x25')](function(_0x2b5df8){_0x1cea6f=_0x2b5df8;_0xe6b940=_0x1cea6f[_0xb781('0x60')];_0x3cd908=_0xe6b940===_0xb781('0x61')?'eu':'com';_0x18f82b=_0x1cea6f[_0xb781('0x5e')];var _0x36d195=_0x18f82b[_0xb781('0x62')](-0x1);if(_0x36d195==='/'||_0x36d195==='\x5c'||_0x36d195===':'){_0x18f82b=_0x18f82b[_0xb781('0x63')](0x0,_0x18f82b[_0xb781('0x64')](_0x36d195));}if(!_0x1cea6f[_0xb781('0x65')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x1cea6f);})[_0xb781('0x25')](function(_0x7c1e9f){if(_0x7c1e9f){return rp({'method':'GET','uri':util[_0xb781('0x66')](_0xb781('0x67'),_0x3cd908),'qs':{'module':'Calls'},'headers':{'Authorization':_0xb781('0x68')+_0x7c1e9f},'json':!![]});}})['then'](function(_0x56c381){if(_0x56c381){if(_0x56c381[_0xb781('0x69')]&&_0x56c381[_0xb781('0x69')][_0xb781('0x26')]){throw new Error(_0x56c381[_0xb781('0x69')]['error'][_0xb781('0x6a')]);}var _0x5e7337=[];var _0x5f41cb=[];var _0x5df1ed=['Owner','Subject',_0xb781('0x6b'),'WhoId',_0xb781('0x6c'),_0xb781('0x6d'),_0xb781('0x6e'),_0xb781('0x6f')];_0x5f41cb=_[_0xb781('0x70')](_0x56c381[_0xb781('0x33')],function(_0xf909e6){return _0x5df1ed['includes'](_0xf909e6[_0xb781('0x71')]);});for(var _0x4d1ebf=0x0;_0x4d1ebf<_0x5f41cb[_0xb781('0x34')];_0x4d1ebf++){if(_0x5f41cb[_0x4d1ebf][_0xb781('0x72')]===![]){_0x5e7337[_0xb781('0x73')]({'id':_0x5f41cb[_0x4d1ebf]['id'],'name':_0x5f41cb[_0x4d1ebf]['display_label'],'custom':_0x5f41cb[_0x4d1ebf][_0xb781('0x74')],'options':_0x5f41cb[_0x4d1ebf][_0xb781('0x75')]==='picklist'&&_0x5f41cb[_0x4d1ebf]['pick_list_values'][_0xb781('0x34')]>-0x1?_['map'](_0x5f41cb[_0x4d1ebf][_0xb781('0x76')],function(_0x3c1186){return{'name':_0x3c1186,'value':_0x3c1186};}):[]});}}return{'count':_0x5e7337[_0xb781('0x34')],'rows':_0x5e7337};}else{return{'count':0x0,'rows':[]};}})[_0xb781('0x25')](respondWithResult(_0x5bf413,null))[_0xb781('0x42')](function(_0x2de03f){var _0x498815=_0x544c57[_0xb781('0x2e')][_0xb781('0x77')]?0x1f4:_0x2de03f[_0xb781('0x78')]||0x1f4;logger[_0xb781('0x26')](_0xb781('0x79'),_0xb781('0x5d'),_0x498815,JSON['stringify'](_0x2de03f));delete _0x2de03f[_0xb781('0x28')];if(_0x498815===0x191){_0x498815=0x190;}_0x5bf413['status'](_0x498815)['send'](_0x544c57[_0xb781('0x2e')][_0xb781('0x77')]?{'message':_0xb781('0x7a'),'statusCode':_0x2de03f['statusCode']}:_0x2de03f);});}; \ No newline at end of file +var _0xf430=['send','map','ZohoAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','includeAll','find','catch','create','body','params','getConfigurations','nolimit','findOne','AccountId','Subjects','getSubjects','Descriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','zoho.eu','com','serverUrl','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','picklist','test','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','zip-dir','fast-json-patch','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name'];(function(_0x2b5f33,_0x3ff07b){var _0x2a2925=function(_0x26463d){while(--_0x26463d){_0x2b5f33['push'](_0x2b5f33['shift']());}};_0x2a2925(++_0x3ff07b);}(_0xf430,0xd5));var _0x0f43=function(_0x26721d,_0x448ba5){_0x26721d=_0x26721d-0x0;var _0x1035c5=_0xf430[_0x26721d];return _0x1035c5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0f43('0x0'));var jsonpatch=require(_0x0f43('0x1'));var rp=require('request-promise');var moment=require(_0x0f43('0x2'));var BPromise=require(_0x0f43('0x3'));var Mustache=require(_0x0f43('0x4'));var util=require(_0x0f43('0x5'));var path=require('path');var sox=require(_0x0f43('0x6'));var csv=require(_0x0f43('0x7'));var ejs=require(_0x0f43('0x8'));var fs=require('fs');var fs_extra=require(_0x0f43('0x9'));var _=require(_0x0f43('0xa'));var squel=require(_0x0f43('0xb'));var crypto=require(_0x0f43('0xc'));var jsforce=require(_0x0f43('0xd'));var deskjs=require(_0x0f43('0xe'));var toCsv=require(_0x0f43('0x7'));var querystring=require(_0x0f43('0xf'));var Papa=require(_0x0f43('0x10'));var Redis=require(_0x0f43('0x11'));var authService=require(_0x0f43('0x12'));var qs=require(_0x0f43('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f43('0x14'));var logger=require(_0x0f43('0x15'))(_0x0f43('0x16'));var utils=require(_0x0f43('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0f43('0x18'));var db=require(_0x0f43('0x19'))['db'];var integrations=require(_0x0f43('0x1a'));function respondWithStatusCode(_0x558ade,_0x30862a){_0x30862a=_0x30862a||0xcc;return function(_0x3eb561){if(_0x3eb561){return _0x558ade[_0x0f43('0x1b')](_0x30862a);}return _0x558ade['status'](_0x30862a)[_0x0f43('0x1c')]();};}function respondWithResult(_0x27a615,_0x618d3){_0x618d3=_0x618d3||0xc8;return function(_0x5f4532){if(_0x5f4532){return _0x27a615[_0x0f43('0x1d')](_0x618d3)[_0x0f43('0x1e')](_0x5f4532);}};}function respondWithFilteredResult(_0x3bdc8e,_0x41f7d2){return function(_0x3e574b){if(_0x3e574b){var _0x61096b=typeof _0x41f7d2['offset']===_0x0f43('0x1f')&&typeof _0x41f7d2[_0x0f43('0x20')]===_0x0f43('0x1f');var _0x14ffc5=_0x3e574b[_0x0f43('0x21')];var _0x5bc2ab=_0x61096b?0x0:_0x41f7d2[_0x0f43('0x22')];var _0x22967a=_0x61096b?_0x3e574b[_0x0f43('0x21')]:_0x41f7d2[_0x0f43('0x22')]+_0x41f7d2['limit'];var _0x374620;if(_0x22967a>=_0x14ffc5){_0x22967a=_0x14ffc5;_0x374620=0xc8;}else{_0x374620=0xce;}_0x3bdc8e[_0x0f43('0x1d')](_0x374620);return _0x3bdc8e[_0x0f43('0x23')]('Content-Range',_0x5bc2ab+'-'+_0x22967a+'/'+_0x14ffc5)['json'](_0x3e574b);}return null;};}function patchUpdates(_0x4f2ede){return function(_0x36f32f){try{jsonpatch[_0x0f43('0x24')](_0x36f32f,_0x4f2ede,!![]);}catch(_0x51e6f1){return BPromise[_0x0f43('0x25')](_0x51e6f1);}return _0x36f32f[_0x0f43('0x26')]();};}function saveUpdates(_0x33f61c,_0x4693af){return function(_0x322afb){if(_0x322afb){return _0x322afb[_0x0f43('0x27')](_0x33f61c)[_0x0f43('0x28')](function(_0x5c5077){return _0x5c5077;});}return null;};}function removeEntity(_0x42d34f,_0x1114e5){return function(_0x298a6f){if(_0x298a6f){return _0x298a6f[_0x0f43('0x29')]()['then'](function(){_0x42d34f[_0x0f43('0x1d')](0xcc)[_0x0f43('0x1c')]();});}};}function handleEntityNotFound(_0x5c5b9a,_0x5bb457){return function(_0x40c2a1){if(!_0x40c2a1){_0x5c5b9a[_0x0f43('0x1b')](0x194);}return _0x40c2a1;};}function handleError(_0x5de905,_0x248704){_0x248704=_0x248704||0x1f4;return function(_0x377878){logger[_0x0f43('0x2a')](_0x377878[_0x0f43('0x2b')]);if(_0x377878[_0x0f43('0x2c')]){delete _0x377878[_0x0f43('0x2c')];}_0x5de905[_0x0f43('0x1d')](_0x248704)[_0x0f43('0x2d')](_0x377878);};}exports['index']=function(_0x1987f2,_0x4f60ef){var _0x5969d3={},_0x17fa83={},_0x369eda={'count':0x0,'rows':[]};var _0x5dff04=_[_0x0f43('0x2e')](db[_0x0f43('0x2f')][_0x0f43('0x30')],function(_0x4288d9){return{'name':_0x4288d9[_0x0f43('0x31')],'type':_0x4288d9[_0x0f43('0x32')][_0x0f43('0x33')]};});_0x17fa83[_0x0f43('0x34')]=_[_0x0f43('0x2e')](_0x5dff04,_0x0f43('0x2c'));_0x17fa83['query']=_[_0x0f43('0x35')](_0x1987f2[_0x0f43('0x36')]);_0x17fa83[_0x0f43('0x37')]=_['intersection'](_0x17fa83[_0x0f43('0x34')],_0x17fa83[_0x0f43('0x36')]);_0x5969d3[_0x0f43('0x38')]=_[_0x0f43('0x39')](_0x17fa83[_0x0f43('0x34')],qs['fields'](_0x1987f2[_0x0f43('0x36')][_0x0f43('0x3a')]));_0x5969d3[_0x0f43('0x38')]=_0x5969d3[_0x0f43('0x38')][_0x0f43('0x3b')]?_0x5969d3['attributes']:_0x17fa83[_0x0f43('0x34')];if(!_0x1987f2[_0x0f43('0x36')][_0x0f43('0x3c')]('nolimit')){_0x5969d3[_0x0f43('0x20')]=qs[_0x0f43('0x20')](_0x1987f2['query'][_0x0f43('0x20')]);_0x5969d3[_0x0f43('0x22')]=qs[_0x0f43('0x22')](_0x1987f2['query'][_0x0f43('0x22')]);}_0x5969d3[_0x0f43('0x3d')]=qs[_0x0f43('0x3e')](_0x1987f2[_0x0f43('0x36')][_0x0f43('0x3e')]);_0x5969d3[_0x0f43('0x3f')]=qs[_0x0f43('0x37')](_[_0x0f43('0x40')](_0x1987f2[_0x0f43('0x36')],_0x17fa83[_0x0f43('0x37')]),_0x5dff04);if(_0x1987f2['query'][_0x0f43('0x41')]){_0x5969d3['where']=_[_0x0f43('0x42')](_0x5969d3[_0x0f43('0x3f')],{'$or':_[_0x0f43('0x2e')](_0x5dff04,function(_0x22ab79){if(_0x22ab79[_0x0f43('0x32')]!==_0x0f43('0x43')){var _0x33c3b8={};_0x33c3b8[_0x22ab79[_0x0f43('0x2c')]]={'$like':'%'+_0x1987f2[_0x0f43('0x36')][_0x0f43('0x41')]+'%'};return _0x33c3b8;}})});}_0x5969d3=_[_0x0f43('0x42')]({},_0x5969d3,_0x1987f2[_0x0f43('0x44')]);var _0x5cc3a5={'where':_0x5969d3[_0x0f43('0x3f')]};return db['ZohoAccount'][_0x0f43('0x21')](_0x5cc3a5)[_0x0f43('0x28')](function(_0x46299c){_0x369eda['count']=_0x46299c;if(_0x1987f2[_0x0f43('0x36')]['includeAll']){_0x5969d3[_0x0f43('0x45')]=[{'all':!![]}];}return db['ZohoAccount'][_0x0f43('0x46')](_0x5969d3);})[_0x0f43('0x28')](function(_0x3faae2){_0x369eda[_0x0f43('0x47')]=_0x3faae2;return _0x369eda;})[_0x0f43('0x28')](respondWithFilteredResult(_0x4f60ef,_0x5969d3))['catch'](handleError(_0x4f60ef,null));};exports['show']=function(_0x17f726,_0x5bc9d0){var _0x497b22={'raw':![],'where':{'id':_0x17f726['params']['id']}},_0x17c7ba={};_0x17c7ba['model']=_[_0x0f43('0x35')](db['ZohoAccount'][_0x0f43('0x30')]);_0x17c7ba['query']=_[_0x0f43('0x35')](_0x17f726[_0x0f43('0x36')]);_0x17c7ba[_0x0f43('0x37')]=_[_0x0f43('0x39')](_0x17c7ba[_0x0f43('0x34')],_0x17c7ba[_0x0f43('0x36')]);_0x497b22[_0x0f43('0x38')]=_[_0x0f43('0x39')](_0x17c7ba[_0x0f43('0x34')],qs['fields'](_0x17f726[_0x0f43('0x36')][_0x0f43('0x3a')]));_0x497b22[_0x0f43('0x38')]=_0x497b22[_0x0f43('0x38')][_0x0f43('0x3b')]?_0x497b22[_0x0f43('0x38')]:_0x17c7ba['model'];if(_0x17f726[_0x0f43('0x36')][_0x0f43('0x48')]){_0x497b22['include']=[{'all':!![]}];}_0x497b22=_[_0x0f43('0x42')]({},_0x497b22,_0x17f726['options']);return db[_0x0f43('0x2f')][_0x0f43('0x49')](_0x497b22)['then'](handleEntityNotFound(_0x5bc9d0,null))[_0x0f43('0x28')](respondWithResult(_0x5bc9d0,null))[_0x0f43('0x4a')](handleError(_0x5bc9d0,null));};exports[_0x0f43('0x4b')]=function(_0x101e13,_0x387e99){return db[_0x0f43('0x2f')]['create'](_0x101e13[_0x0f43('0x4c')],{})[_0x0f43('0x28')](respondWithResult(_0x387e99,0xc9))[_0x0f43('0x4a')](handleError(_0x387e99,null));};exports[_0x0f43('0x27')]=function(_0x2fa86c,_0xd64670){if(_0x2fa86c[_0x0f43('0x4c')]['id']){delete _0x2fa86c[_0x0f43('0x4c')]['id'];}return db[_0x0f43('0x2f')][_0x0f43('0x49')]({'where':{'id':_0x2fa86c[_0x0f43('0x4d')]['id']}})['then'](handleEntityNotFound(_0xd64670,null))[_0x0f43('0x28')](saveUpdates(_0x2fa86c[_0x0f43('0x4c')],null))[_0x0f43('0x28')](respondWithResult(_0xd64670,null))['catch'](handleError(_0xd64670,null));};exports['destroy']=function(_0x143682,_0x1a2f0c){return db['ZohoAccount'][_0x0f43('0x49')]({'where':{'id':_0x143682[_0x0f43('0x4d')]['id']}})[_0x0f43('0x28')](handleEntityNotFound(_0x1a2f0c,null))[_0x0f43('0x28')](removeEntity(_0x1a2f0c,null))[_0x0f43('0x4a')](handleError(_0x1a2f0c,null));};exports[_0x0f43('0x4e')]=function(_0x32ca3e,_0xb38b74,_0x934726){var _0x5d288a={};var _0x383758={};var _0x94d89b;var _0x3325f8;return db[_0x0f43('0x2f')]['findOne']({'where':{'id':_0x32ca3e['params']['id']}})[_0x0f43('0x28')](handleEntityNotFound(_0xb38b74,null))[_0x0f43('0x28')](function(_0x3696ca){if(_0x3696ca){_0x94d89b=_0x3696ca;_0x383758[_0x0f43('0x34')]=_[_0x0f43('0x35')](db['ZohoConfiguration'][_0x0f43('0x30')]);_0x383758[_0x0f43('0x36')]=_[_0x0f43('0x35')](_0x32ca3e['query']);_0x383758['filters']=_[_0x0f43('0x39')](_0x383758[_0x0f43('0x34')],_0x383758[_0x0f43('0x36')]);_0x5d288a[_0x0f43('0x38')]=_['intersection'](_0x383758[_0x0f43('0x34')],qs[_0x0f43('0x3a')](_0x32ca3e[_0x0f43('0x36')][_0x0f43('0x3a')]));_0x5d288a['attributes']=_0x5d288a['attributes']['length']?_0x5d288a[_0x0f43('0x38')]:_0x383758[_0x0f43('0x34')];_0x5d288a[_0x0f43('0x3d')]=qs[_0x0f43('0x3e')](_0x32ca3e['query'][_0x0f43('0x3e')]);_0x5d288a[_0x0f43('0x3f')]=qs[_0x0f43('0x37')](_[_0x0f43('0x40')](_0x32ca3e[_0x0f43('0x36')],_0x383758[_0x0f43('0x37')]));if(_0x32ca3e[_0x0f43('0x36')][_0x0f43('0x41')]){_0x5d288a[_0x0f43('0x3f')]=_['merge'](_0x5d288a[_0x0f43('0x3f')],{'$or':_['map'](_0x5d288a['attributes'],function(_0x195b43){var _0x364d4c={};_0x364d4c[_0x195b43]={'$like':'%'+_0x32ca3e[_0x0f43('0x36')][_0x0f43('0x41')]+'%'};return _0x364d4c;})});}_0x5d288a=_['merge']({},_0x5d288a,_0x32ca3e['options']);return _0x94d89b[_0x0f43('0x4e')](_0x5d288a);}})[_0x0f43('0x28')](function(_0x18ec96){if(_0x18ec96){_0x3325f8=_0x18ec96[_0x0f43('0x3b')];if(!_0x32ca3e['query']['hasOwnProperty'](_0x0f43('0x4f'))){_0x5d288a[_0x0f43('0x20')]=qs[_0x0f43('0x20')](_0x32ca3e[_0x0f43('0x36')][_0x0f43('0x20')]);_0x5d288a[_0x0f43('0x22')]=qs[_0x0f43('0x22')](_0x32ca3e[_0x0f43('0x36')][_0x0f43('0x22')]);}return _0x94d89b[_0x0f43('0x4e')](_0x5d288a);}})['then'](function(_0x147c6a){if(_0x147c6a){return _0x147c6a?{'count':_0x3325f8,'rows':_0x147c6a}:null;}})[_0x0f43('0x28')](respondWithResult(_0xb38b74,null))[_0x0f43('0x4a')](handleError(_0xb38b74,null));};exports['addConfiguration']=function(_0x5a96a7,_0x8db567,_0x4f601a){if(_0x5a96a7['body']['id']){delete _0x5a96a7[_0x0f43('0x4c')]['id'];}return db[_0x0f43('0x2f')][_0x0f43('0x50')]({'where':{'id':_0x5a96a7[_0x0f43('0x4d')]['id']}})[_0x0f43('0x28')](handleEntityNotFound(_0x8db567,null))['then'](function(_0x52a50f){if(_0x52a50f){_0x5a96a7['body'][_0x0f43('0x51')]=_0x52a50f['id'];_0x5a96a7[_0x0f43('0x4c')][_0x0f43('0x52')]=integrations[_0x0f43('0x53')](_0x5a96a7[_0x0f43('0x4c')]['channel'],_0x5a96a7[_0x0f43('0x4c')]['type']);_0x5a96a7[_0x0f43('0x4c')][_0x0f43('0x54')]=integrations['getDescriptions'](_0x5a96a7['body']['channel'],_0x5a96a7[_0x0f43('0x4c')][_0x0f43('0x32')]);return db['ZohoConfiguration'][_0x0f43('0x4b')](_0x5a96a7[_0x0f43('0x4c')],{'include':[{'model':db['ZohoField'],'as':_0x0f43('0x52')},{'model':db[_0x0f43('0x55')],'as':'Descriptions'}]});}return null;})[_0x0f43('0x28')](respondWithResult(_0x8db567,null))[_0x0f43('0x4a')](handleError(_0x8db567,null));};function getAccessToken(_0x4ee66f){return new Promise(function(_0x406e9c,_0x320e0f){var _0x20524c;switch(_0x4ee66f['zone']){case'US':_0x20524c=_0x0f43('0x56');break;case'AU':_0x20524c='https://accounts.zoho.com.au';break;case'EU':_0x20524c=_0x0f43('0x57');break;case'IN':_0x20524c=_0x0f43('0x58');break;case'CN':_0x20524c='https://accounts.zoho.com.cn';break;default:_0x20524c=_0x0f43('0x57');break;}var _0x2aff69={'method':_0x0f43('0x59'),'uri':_0x20524c+_0x0f43('0x5a'),'qs':{'refresh_token':_0x4ee66f[_0x0f43('0x5b')],'client_id':_0x4ee66f[_0x0f43('0x5c')],'client_secret':_0x4ee66f[_0x0f43('0x5d')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x2aff69)['then'](function(_0x1d4051){if(_0x1d4051[_0x0f43('0x5e')]){_0x406e9c(_0x1d4051[_0x0f43('0x5e')]);}else{_0x320e0f(_0x0f43('0x5f'));}})[_0x0f43('0x4a')](function(_0x4b2db0){_0x320e0f(_0x4b2db0);});});}exports[_0x0f43('0x60')]=function(_0x5b2629,_0x1c8c3c,_0x1c56a1){var _0x458abd,_0x36cf88,_0x63dcb5,_0x3d0255,_0x1369b2;return db[_0x0f43('0x2f')][_0x0f43('0x50')]({'where':{'id':_0x5b2629[_0x0f43('0x4d')]['id']},'attributes':['id',_0x0f43('0x61'),_0x0f43('0x62'),'clientId',_0x0f43('0x5d'),'serverUrl','code',_0x0f43('0x5b')]})[_0x0f43('0x28')](handleEntityNotFound(_0x1c8c3c,null))[_0x0f43('0x28')](function(_0x23327c){_0x1369b2=_0x23327c;_0x458abd=_0x1369b2[_0x0f43('0x61')];_0x36cf88=_0x458abd===_0x0f43('0x63')?'eu':_0x0f43('0x64');_0x63dcb5=_0x1369b2[_0x0f43('0x65')];var _0x11dc12=_0x63dcb5['slice'](-0x1);if(_0x11dc12==='/'||_0x11dc12==='\x5c'||_0x11dc12===':'){_0x63dcb5=_0x63dcb5['substring'](0x0,_0x63dcb5[_0x0f43('0x66')](_0x11dc12));}if(!_0x1369b2['refreshToken']){throw new Error(_0x0f43('0x67'));}return getAccessToken(_0x1369b2);})[_0x0f43('0x28')](function(_0x4108f7){if(_0x4108f7){return rp({'method':_0x0f43('0x68'),'uri':util[_0x0f43('0x69')](_0x0f43('0x6a'),_0x36cf88),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4108f7},'json':!![]});}})['then'](function(_0x101429){if(_0x101429){if(_0x101429['response']&&_0x101429[_0x0f43('0x6b')][_0x0f43('0x2a')]){throw new Error(_0x101429[_0x0f43('0x6b')][_0x0f43('0x2a')][_0x0f43('0x6c')]);}var _0x195e2d=[];var _0x4f56b2=[];var _0x3fd144=[_0x0f43('0x6d'),_0x0f43('0x6e'),_0x0f43('0x6f'),_0x0f43('0x70'),_0x0f43('0x71'),_0x0f43('0x72'),_0x0f43('0x73'),_0x0f43('0x74')];_0x4f56b2=_[_0x0f43('0x75')](_0x101429['fields'],function(_0x3e4702){return _0x3fd144[_0x0f43('0x76')](_0x3e4702[_0x0f43('0x77')]);});for(var _0x54428b=0x0;_0x54428b<_0x4f56b2[_0x0f43('0x3b')];_0x54428b++){if(_0x4f56b2[_0x54428b][_0x0f43('0x78')]===![]){_0x195e2d[_0x0f43('0x79')]({'id':_0x4f56b2[_0x54428b]['id'],'name':_0x4f56b2[_0x54428b][_0x0f43('0x7a')],'custom':_0x4f56b2[_0x54428b][_0x0f43('0x7b')],'options':_0x4f56b2[_0x54428b]['data_type']===_0x0f43('0x7c')&&_0x4f56b2[_0x54428b]['pick_list_values'][_0x0f43('0x3b')]>-0x1?_[_0x0f43('0x2e')](_0x4f56b2[_0x54428b]['pick_list_values'],function(_0x57b761){return{'name':_0x57b761,'value':_0x57b761};}):[]});}}return{'count':_0x195e2d[_0x0f43('0x3b')],'rows':_0x195e2d};}else{return{'count':0x0,'rows':[]};}})[_0x0f43('0x28')](respondWithResult(_0x1c8c3c,null))[_0x0f43('0x4a')](function(_0x4955e0){var _0x4ea99b=_0x5b2629[_0x0f43('0x36')][_0x0f43('0x7d')]?0x1f4:_0x4955e0['statusCode']||0x1f4;logger['error'](_0x0f43('0x7e'),_0x0f43('0x60'),_0x4ea99b,JSON[_0x0f43('0x7f')](_0x4955e0));delete _0x4955e0[_0x0f43('0x2c')];if(_0x4ea99b===0x191){_0x4ea99b=0x190;}_0x1c8c3c[_0x0f43('0x1d')](_0x4ea99b)[_0x0f43('0x2d')](_0x5b2629[_0x0f43('0x36')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x4955e0[_0x0f43('0x80')]}:_0x4955e0);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 7cb171b..edc714b 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 _0x3fd7=['../../config/logger','moment','bluebird','request-promise','../../config/environment','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','code','host','slice','substring','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','POST','authorization_code','clientSecret','application/x-www-form-urlencoded','then','parse','refresh_token','info','format','name','error','inspect','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','https://accounts.zoho.eu','/oauth/v2/token','lodash','util'];(function(_0x24aef4,_0x53b08c){var _0x28395e=function(_0x5e38ad){while(--_0x5e38ad){_0x24aef4['push'](_0x24aef4['shift']());}};_0x28395e(++_0x53b08c);}(_0x3fd7,0x15d));var _0x73fd=function(_0x4ee143,_0x4be2ee){_0x4ee143=_0x4ee143-0x0;var _0x54e83b=_0x3fd7[_0x4ee143];return _0x54e83b;};'use strict';var _=require(_0x73fd('0x0'));var util=require(_0x73fd('0x1'));var logger=require(_0x73fd('0x2'))('api');var moment=require(_0x73fd('0x3'));var BPromise=require(_0x73fd('0x4'));var rp=require(_0x73fd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x73fd('0x6'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x73fd('0x7'));module[_0x73fd('0x8')]=function(_0x2d503c,_0x4bfa94){return _0x2d503c[_0x73fd('0x9')](_0x73fd('0xa'),attributes,{'tableName':_0x73fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x329822,_0x31db98,_0x159b15){if(_0x329822[_0x73fd('0xc')]('zone')||_0x329822[_0x73fd('0xc')](_0x73fd('0xd'))||_0x329822[_0x73fd('0xc')](_0x73fd('0xe'))||_0x329822['changed']('clientSecret')||_0x329822['changed'](_0x73fd('0xf'))||_0x329822[_0x73fd('0xc')](_0x73fd('0x10'))){var _0x3da468,_0x3859ec;_0x3da468=_0x329822[_0x73fd('0xd')];var _0x4d056e=_0x3da468[_0x73fd('0x11')](-0x1);if(_0x4d056e==='/'||_0x4d056e==='\x5c'||_0x4d056e===':'){_0x3da468=_0x3da468[_0x73fd('0x12')](0x0,_0x3da468[_0x73fd('0x13')](_0x4d056e));}switch(_0x329822[_0x73fd('0x14')]){case'US':_0x3859ec=_0x73fd('0x15');break;case'AU':_0x3859ec=_0x73fd('0x16');break;case'IN':_0x3859ec='https://accounts.zoho.in';break;case'CN':_0x3859ec=_0x73fd('0x17');break;default:_0x3859ec='https://accounts.zoho.eu';break;}var _0xabd55a={'method':_0x73fd('0x18'),'uri':_0x3859ec+'/oauth/v2/token','form':{'grant_type':_0x73fd('0x19'),'client_id':_0x329822[_0x73fd('0xe')],'client_secret':_0x329822[_0x73fd('0x1a')],'redirect_uri':_0x329822[_0x73fd('0xd')],'code':_0x329822['code']},'headers':{'Content-Type':_0x73fd('0x1b')}};return rp(_0xabd55a)[_0x73fd('0x1c')](function(_0x5760fa){var _0x1aee07=JSON[_0x73fd('0x1d')](_0x5760fa);if(_0x1aee07[_0x73fd('0x1e')]){_0x329822['refreshToken']=_0x1aee07[_0x73fd('0x1e')];logger[_0x73fd('0x1f')](util[_0x73fd('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x329822[_0x73fd('0x21')],_0x329822['id']));}else{logger[_0x73fd('0x22')](util[_0x73fd('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x329822[_0x73fd('0x21')],_0x329822['id']),util[_0x73fd('0x23')](_0x1aee07,{'showHidden':![],'depth':null}));}return _0x159b15(null,_0x31db98);})['catch'](function(_0x5a8933){logger[_0x73fd('0x22')](util[_0x73fd('0x20')](_0x73fd('0x24'),_0x329822[_0x73fd('0x21')],_0x329822['id']),util[_0x73fd('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x159b15(_0x5a8933);});}else{return _0x159b15(null,_0x31db98);}},'beforeUpdate':function(_0x276685,_0x381a5b,_0x12567a){if(_0x276685[_0x73fd('0xc')](_0x73fd('0x14'))||_0x276685[_0x73fd('0xc')](_0x73fd('0xd'))||_0x276685[_0x73fd('0xc')](_0x73fd('0xe'))||_0x276685[_0x73fd('0xc')]('clientSecret')||_0x276685[_0x73fd('0xc')](_0x73fd('0xf'))||_0x276685['changed'](_0x73fd('0x10'))){var _0x46b287,_0x557aeb;_0x46b287=_0x276685[_0x73fd('0xd')];var _0x36ef56=_0x46b287[_0x73fd('0x11')](-0x1);if(_0x36ef56==='/'||_0x36ef56==='\x5c'||_0x36ef56===':'){_0x46b287=_0x46b287[_0x73fd('0x12')](0x0,_0x46b287['lastIndexOf'](_0x36ef56));}switch(_0x276685[_0x73fd('0x14')]){case'US':_0x557aeb=_0x73fd('0x15');break;case'AU':_0x557aeb=_0x73fd('0x16');break;case'IN':_0x557aeb='https://accounts.zoho.in';break;case'CN':_0x557aeb=_0x73fd('0x17');break;default:_0x557aeb=_0x73fd('0x25');break;}var _0x2c61db={'method':_0x73fd('0x18'),'uri':_0x557aeb+_0x73fd('0x26'),'form':{'grant_type':_0x73fd('0x19'),'client_id':_0x276685[_0x73fd('0xe')],'client_secret':_0x276685[_0x73fd('0x1a')],'redirect_uri':_0x276685[_0x73fd('0xd')],'code':_0x276685['code']},'headers':{'Content-Type':_0x73fd('0x1b')}};return rp(_0x2c61db)['then'](function(_0x27eafd){var _0x27e6eb=JSON[_0x73fd('0x1d')](_0x27eafd);if(_0x27e6eb[_0x73fd('0x1e')]){_0x276685['refreshToken']=_0x27e6eb[_0x73fd('0x1e')];logger[_0x73fd('0x1f')](util[_0x73fd('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x276685[_0x73fd('0x21')],_0x276685['id']));}else{logger['error'](util['format'](_0x73fd('0x24'),_0x276685['name'],_0x276685['id']),util[_0x73fd('0x23')](_0x27e6eb,{'showHidden':![],'depth':null}));}return _0x12567a(null,_0x381a5b);})['catch'](function(_0x1e19db){logger[_0x73fd('0x22')](util[_0x73fd('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x276685[_0x73fd('0x21')],_0x276685['id']),util[_0x73fd('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x12567a(_0x1e19db);});}else{return _0x12567a(null,_0x381a5b);}}}});}; \ No newline at end of file +var _0x9fad=['../../components/integrations/configuration','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','clientSecret','code','host','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientId','application/x-www-form-urlencoded','then','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','slice','parse','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes'];(function(_0xa73cb,_0x39b431){var _0x49a66d=function(_0x765ce9){while(--_0x765ce9){_0xa73cb['push'](_0xa73cb['shift']());}};_0x49a66d(++_0x39b431);}(_0x9fad,0xa6));var _0xd9fa=function(_0x1d2d2c,_0x33987e){_0x1d2d2c=_0x1d2d2c-0x0;var _0x5b3346=_0x9fad[_0x1d2d2c];return _0x5b3346;};'use strict';var _=require(_0xd9fa('0x0'));var util=require(_0xd9fa('0x1'));var logger=require(_0xd9fa('0x2'))(_0xd9fa('0x3'));var moment=require(_0xd9fa('0x4'));var BPromise=require(_0xd9fa('0x5'));var rp=require(_0xd9fa('0x6'));var fs=require('fs');var path=require(_0xd9fa('0x7'));var rimraf=require('rimraf');var config=require(_0xd9fa('0x8'));var attributes=require(_0xd9fa('0x9'));var integrations=require(_0xd9fa('0xa'));module['exports']=function(_0x17ba09,_0xcc88c9){return _0x17ba09['define'](_0xd9fa('0xb'),attributes,{'tableName':_0xd9fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1c8843,_0x17bcd6,_0x47870a){if(_0x1c8843['changed'](_0xd9fa('0xd'))||_0x1c8843[_0xd9fa('0xe')](_0xd9fa('0xf'))||_0x1c8843[_0xd9fa('0xe')]('clientId')||_0x1c8843['changed'](_0xd9fa('0x10'))||_0x1c8843[_0xd9fa('0xe')](_0xd9fa('0x11'))||_0x1c8843[_0xd9fa('0xe')](_0xd9fa('0x12'))){var _0x36b99c,_0x38fc9d;_0x36b99c=_0x1c8843[_0xd9fa('0xf')];var _0x2e8343=_0x36b99c['slice'](-0x1);if(_0x2e8343==='/'||_0x2e8343==='\x5c'||_0x2e8343===':'){_0x36b99c=_0x36b99c[_0xd9fa('0x13')](0x0,_0x36b99c[_0xd9fa('0x14')](_0x2e8343));}switch(_0x1c8843[_0xd9fa('0xd')]){case'US':_0x38fc9d=_0xd9fa('0x15');break;case'AU':_0x38fc9d=_0xd9fa('0x16');break;case'IN':_0x38fc9d=_0xd9fa('0x17');break;case'CN':_0x38fc9d=_0xd9fa('0x18');break;default:_0x38fc9d=_0xd9fa('0x19');break;}var _0x417d94={'method':_0xd9fa('0x1a'),'uri':_0x38fc9d+_0xd9fa('0x1b'),'form':{'grant_type':_0xd9fa('0x1c'),'client_id':_0x1c8843[_0xd9fa('0x1d')],'client_secret':_0x1c8843['clientSecret'],'redirect_uri':_0x1c8843['serverUrl'],'code':_0x1c8843[_0xd9fa('0x11')]},'headers':{'Content-Type':_0xd9fa('0x1e')}};return rp(_0x417d94)[_0xd9fa('0x1f')](function(_0x509d1a){var _0x4e61d5=JSON['parse'](_0x509d1a);if(_0x4e61d5[_0xd9fa('0x20')]){_0x1c8843[_0xd9fa('0x21')]=_0x4e61d5[_0xd9fa('0x20')];logger[_0xd9fa('0x22')](util[_0xd9fa('0x23')](_0xd9fa('0x24'),_0x1c8843[_0xd9fa('0x25')],_0x1c8843['id']));}else{logger[_0xd9fa('0x26')](util['format'](_0xd9fa('0x27'),_0x1c8843[_0xd9fa('0x25')],_0x1c8843['id']),util[_0xd9fa('0x28')](_0x4e61d5,{'showHidden':![],'depth':null}));}return _0x47870a(null,_0x17bcd6);})[_0xd9fa('0x29')](function(_0x1d8d93){logger[_0xd9fa('0x26')](util[_0xd9fa('0x23')](_0xd9fa('0x27'),_0x1c8843['name'],_0x1c8843['id']),util[_0xd9fa('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x47870a(_0x1d8d93);});}else{return _0x47870a(null,_0x17bcd6);}},'beforeUpdate':function(_0x468f99,_0x17f930,_0x1e242b){if(_0x468f99[_0xd9fa('0xe')](_0xd9fa('0xd'))||_0x468f99[_0xd9fa('0xe')](_0xd9fa('0xf'))||_0x468f99['changed'](_0xd9fa('0x1d'))||_0x468f99['changed'](_0xd9fa('0x10'))||_0x468f99[_0xd9fa('0xe')]('code')||_0x468f99[_0xd9fa('0xe')](_0xd9fa('0x12'))){var _0x4b18d6,_0x1bb9c1;_0x4b18d6=_0x468f99[_0xd9fa('0xf')];var _0x458f=_0x4b18d6[_0xd9fa('0x2a')](-0x1);if(_0x458f==='/'||_0x458f==='\x5c'||_0x458f===':'){_0x4b18d6=_0x4b18d6[_0xd9fa('0x13')](0x0,_0x4b18d6[_0xd9fa('0x14')](_0x458f));}switch(_0x468f99[_0xd9fa('0xd')]){case'US':_0x1bb9c1=_0xd9fa('0x15');break;case'AU':_0x1bb9c1=_0xd9fa('0x16');break;case'IN':_0x1bb9c1=_0xd9fa('0x17');break;case'CN':_0x1bb9c1='https://accounts.zoho.com.cn';break;default:_0x1bb9c1=_0xd9fa('0x19');break;}var _0x1ea2d5={'method':_0xd9fa('0x1a'),'uri':_0x1bb9c1+'/oauth/v2/token','form':{'grant_type':_0xd9fa('0x1c'),'client_id':_0x468f99['clientId'],'client_secret':_0x468f99[_0xd9fa('0x10')],'redirect_uri':_0x468f99[_0xd9fa('0xf')],'code':_0x468f99[_0xd9fa('0x11')]},'headers':{'Content-Type':_0xd9fa('0x1e')}};return rp(_0x1ea2d5)['then'](function(_0x50b97f){var _0x36f000=JSON[_0xd9fa('0x2b')](_0x50b97f);if(_0x36f000[_0xd9fa('0x20')]){_0x468f99[_0xd9fa('0x21')]=_0x36f000[_0xd9fa('0x20')];logger[_0xd9fa('0x22')](util[_0xd9fa('0x23')](_0xd9fa('0x24'),_0x468f99[_0xd9fa('0x25')],_0x468f99['id']));}else{logger[_0xd9fa('0x26')](util[_0xd9fa('0x23')](_0xd9fa('0x27'),_0x468f99['name'],_0x468f99['id']),util[_0xd9fa('0x28')](_0x36f000,{'showHidden':![],'depth':null}));}return _0x1e242b(null,_0x17f930);})[_0xd9fa('0x29')](function(_0x982a19){logger[_0xd9fa('0x26')](util[_0xd9fa('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x468f99['name'],_0x468f99['id']),util[_0xd9fa('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x1e242b(_0x982a19);});}else{return _0x1e242b(null,_0x17f930);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 0d98e36..31ab665 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 _0x8814=['ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ZohoAccount','findAll','options','attributes','limit','include','model','map','GetZohoAccount','catch','ShowZohoAccount','find','raw','where','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','debug'];(function(_0x9bacc2,_0x3444fc){var _0x147fc8=function(_0x5441c3){while(--_0x5441c3){_0x9bacc2['push'](_0x9bacc2['shift']());}};_0x147fc8(++_0x3444fc);}(_0x8814,0x1b8));var _0x4881=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x8814[_0x31ced5];return _0x10d9e5;};'use strict';var _=require(_0x4881('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4881('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4881('0x2'));var db=require(_0x4881('0x3'))['db'];var utils=require(_0x4881('0x4'));var logger=require(_0x4881('0x5'))('rpc');var config=require(_0x4881('0x6'));var jayson=require(_0x4881('0x7'));var client=jayson[_0x4881('0x8')][_0x4881('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4bcf00,_0x1151b4,_0x505b8a){return new BPromise(function(_0x23a0d4,_0x471090){return client[_0x4881('0xa')](_0x4bcf00,_0x505b8a)[_0x4881('0xb')](function(_0x5baef8){logger[_0x4881('0xc')](_0x4881('0xd'),_0x1151b4,'request\x20sent');logger[_0x4881('0xe')](_0x4881('0xf'),_0x1151b4,_0x4881('0x10'),JSON[_0x4881('0x11')](_0x5baef8));if(_0x5baef8[_0x4881('0x12')]){if(_0x5baef8[_0x4881('0x12')]['code']===0x1f4){logger[_0x4881('0x12')](_0x4881('0xd'),_0x1151b4,_0x5baef8[_0x4881('0x12')][_0x4881('0x13')]);return _0x471090(_0x5baef8['error'][_0x4881('0x13')]);}logger[_0x4881('0x12')](_0x4881('0xd'),_0x1151b4,_0x5baef8[_0x4881('0x12')][_0x4881('0x13')]);return _0x23a0d4(_0x5baef8[_0x4881('0x12')]['message']);}else{logger['info']('ZohoAccount,\x20%s,\x20%s',_0x1151b4,'request\x20sent');_0x23a0d4(_0x5baef8[_0x4881('0x14')][_0x4881('0x13')]);}})['catch'](function(_0x384f9b){logger[_0x4881('0x12')](_0x4881('0xd'),_0x1151b4,_0x384f9b);_0x471090(_0x384f9b);});});}exports['GetZohoAccount']=function(_0x4f7f4e){var _0x5b520d=this;return new Promise(function(_0x333305,_0x49b158){return db[_0x4881('0x15')][_0x4881('0x16')]({'raw':_0x4f7f4e['options']?_0x4f7f4e['options']['raw']===undefined?!![]:![]:!![],'where':_0x4f7f4e['options']?_0x4f7f4e[_0x4881('0x17')]['where']||null:null,'attributes':_0x4f7f4e['options']?_0x4f7f4e[_0x4881('0x17')][_0x4881('0x18')]||null:null,'limit':_0x4f7f4e[_0x4881('0x17')]?_0x4f7f4e[_0x4881('0x17')][_0x4881('0x19')]||null:null,'include':_0x4f7f4e[_0x4881('0x17')]?_0x4f7f4e['options']['include']?_['map'](_0x4f7f4e[_0x4881('0x17')][_0x4881('0x1a')],function(_0xb965c9){return{'model':db[_0xb965c9[_0x4881('0x1b')]],'as':_0xb965c9['as'],'attributes':_0xb965c9[_0x4881('0x18')],'include':_0xb965c9[_0x4881('0x1a')]?_['map'](_0xb965c9[_0x4881('0x1a')],function(_0x383c70){return{'model':db[_0x383c70['model']],'as':_0x383c70['as'],'attributes':_0x383c70[_0x4881('0x18')],'include':_0x383c70[_0x4881('0x1a')]?_[_0x4881('0x1c')](_0x383c70[_0x4881('0x1a')],function(_0x1d3a30){return{'model':db[_0x1d3a30['model']],'as':_0x1d3a30['as'],'attributes':_0x1d3a30[_0x4881('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4881('0xb')](function(_0x41b83f){logger['info'](_0x4881('0x1d'),_0x4f7f4e);logger[_0x4881('0xe')]('GetZohoAccount',_0x4f7f4e,JSON[_0x4881('0x11')](_0x41b83f));_0x333305(_0x41b83f);})[_0x4881('0x1e')](function(_0x3096d1){logger[_0x4881('0x12')](_0x4881('0x1d'),_0x3096d1['message'],_0x4f7f4e);_0x49b158(_0x5b520d[_0x4881('0x12')](0x1f4,_0x3096d1[_0x4881('0x13')]));});});};exports[_0x4881('0x1f')]=function(_0x42fc74){var _0x1bfd97=this;return new Promise(function(_0x144c63,_0xa21343){return db[_0x4881('0x15')][_0x4881('0x20')]({'raw':_0x42fc74['options']?_0x42fc74['options'][_0x4881('0x21')]===undefined?!![]:![]:!![],'where':_0x42fc74[_0x4881('0x17')]?_0x42fc74['options'][_0x4881('0x22')]||null:null,'attributes':_0x42fc74[_0x4881('0x17')]?_0x42fc74['options'][_0x4881('0x18')]||null:null,'include':_0x42fc74[_0x4881('0x17')]?_0x42fc74[_0x4881('0x17')]['include']?_['map'](_0x42fc74[_0x4881('0x17')][_0x4881('0x1a')],function(_0x124599){return{'model':db[_0x124599['model']],'as':_0x124599['as'],'attributes':_0x124599[_0x4881('0x18')],'include':_0x124599[_0x4881('0x1a')]?_[_0x4881('0x1c')](_0x124599['include'],function(_0x40055d){return{'model':db[_0x40055d[_0x4881('0x1b')]],'as':_0x40055d['as'],'attributes':_0x40055d[_0x4881('0x18')],'include':_0x40055d[_0x4881('0x1a')]?_[_0x4881('0x1c')](_0x40055d['include'],function(_0x145ed4){return{'model':db[_0x145ed4[_0x4881('0x1b')]],'as':_0x145ed4['as'],'attributes':_0x145ed4['attributes']};}):[]};}):[]};}):[]:[]})[_0x4881('0xb')](function(_0x3327a8){logger[_0x4881('0xc')](_0x4881('0x1f'),_0x42fc74);logger[_0x4881('0xe')]('ShowZohoAccount',_0x42fc74,JSON[_0x4881('0x11')](_0x3327a8));_0x144c63(_0x3327a8);})[_0x4881('0x1e')](function(_0x5b3600){logger[_0x4881('0x12')](_0x4881('0x1f'),_0x5b3600[_0x4881('0x13')],_0x42fc74);_0xa21343(_0x1bfd97['error'](0x1f4,_0x5b3600[_0x4881('0x13')]));});});}; \ No newline at end of file +var _0xcaaf=['map','model','debug','GetZohoAccount','ShowZohoAccount','then','lodash','moment','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','ZohoAccount,\x20%s,\x20%s','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ZohoAccount','findAll','options','raw','where','attributes','limit','include'];(function(_0x3f62d8,_0x4ebd4a){var _0x4a649d=function(_0x2b69dc){while(--_0x2b69dc){_0x3f62d8['push'](_0x3f62d8['shift']());}};_0x4a649d(++_0x4ebd4a);}(_0xcaaf,0x66));var _0xfcaa=function(_0x1ab398,_0x2681f3){_0x1ab398=_0x1ab398-0x0;var _0x4cec5b=_0xcaaf[_0x1ab398];return _0x4cec5b;};'use strict';var _=require(_0xfcaa('0x0'));var util=require('util');var moment=require(_0xfcaa('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfcaa('0x2'));var db=require(_0xfcaa('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xfcaa('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfcaa('0x5'));var client=jayson[_0xfcaa('0x6')][_0xfcaa('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x28a6b6,_0x26678d,_0x287c48){return new BPromise(function(_0x15ef84,_0x4ee7d3){return client[_0xfcaa('0x8')](_0x28a6b6,_0x287c48)['then'](function(_0x30a4a0){logger['info'](_0xfcaa('0x9'),_0x26678d,'request\x20sent');logger['debug'](_0xfcaa('0xa'),_0x26678d,'request\x20sent',JSON[_0xfcaa('0xb')](_0x30a4a0));if(_0x30a4a0[_0xfcaa('0xc')]){if(_0x30a4a0[_0xfcaa('0xc')][_0xfcaa('0xd')]===0x1f4){logger[_0xfcaa('0xc')](_0xfcaa('0x9'),_0x26678d,_0x30a4a0[_0xfcaa('0xc')][_0xfcaa('0xe')]);return _0x4ee7d3(_0x30a4a0['error'][_0xfcaa('0xe')]);}logger[_0xfcaa('0xc')](_0xfcaa('0x9'),_0x26678d,_0x30a4a0[_0xfcaa('0xc')]['message']);return _0x15ef84(_0x30a4a0[_0xfcaa('0xc')][_0xfcaa('0xe')]);}else{logger[_0xfcaa('0xf')](_0xfcaa('0x9'),_0x26678d,'request\x20sent');_0x15ef84(_0x30a4a0[_0xfcaa('0x10')][_0xfcaa('0xe')]);}})[_0xfcaa('0x11')](function(_0x580335){logger[_0xfcaa('0xc')](_0xfcaa('0x9'),_0x26678d,_0x580335);_0x4ee7d3(_0x580335);});});}exports['GetZohoAccount']=function(_0x4202dc){var _0x5c0277=this;return new Promise(function(_0x587419,_0x941e50){return db[_0xfcaa('0x12')][_0xfcaa('0x13')]({'raw':_0x4202dc[_0xfcaa('0x14')]?_0x4202dc[_0xfcaa('0x14')][_0xfcaa('0x15')]===undefined?!![]:![]:!![],'where':_0x4202dc[_0xfcaa('0x14')]?_0x4202dc[_0xfcaa('0x14')][_0xfcaa('0x16')]||null:null,'attributes':_0x4202dc[_0xfcaa('0x14')]?_0x4202dc['options'][_0xfcaa('0x17')]||null:null,'limit':_0x4202dc[_0xfcaa('0x14')]?_0x4202dc[_0xfcaa('0x14')][_0xfcaa('0x18')]||null:null,'include':_0x4202dc[_0xfcaa('0x14')]?_0x4202dc[_0xfcaa('0x14')][_0xfcaa('0x19')]?_[_0xfcaa('0x1a')](_0x4202dc[_0xfcaa('0x14')]['include'],function(_0x415bce){return{'model':db[_0x415bce[_0xfcaa('0x1b')]],'as':_0x415bce['as'],'attributes':_0x415bce[_0xfcaa('0x17')],'include':_0x415bce['include']?_[_0xfcaa('0x1a')](_0x415bce['include'],function(_0x4642bb){return{'model':db[_0x4642bb[_0xfcaa('0x1b')]],'as':_0x4642bb['as'],'attributes':_0x4642bb[_0xfcaa('0x17')],'include':_0x4642bb[_0xfcaa('0x19')]?_[_0xfcaa('0x1a')](_0x4642bb[_0xfcaa('0x19')],function(_0xf471ce){return{'model':db[_0xf471ce[_0xfcaa('0x1b')]],'as':_0xf471ce['as'],'attributes':_0xf471ce[_0xfcaa('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x55f9c9){logger['info']('GetZohoAccount',_0x4202dc);logger[_0xfcaa('0x1c')](_0xfcaa('0x1d'),_0x4202dc,JSON['stringify'](_0x55f9c9));_0x587419(_0x55f9c9);})[_0xfcaa('0x11')](function(_0x4605b5){logger['error'](_0xfcaa('0x1d'),_0x4605b5['message'],_0x4202dc);_0x941e50(_0x5c0277['error'](0x1f4,_0x4605b5[_0xfcaa('0xe')]));});});};exports[_0xfcaa('0x1e')]=function(_0x37bc0f){var _0x1c538f=this;return new Promise(function(_0x4c8029,_0x17bf82){return db[_0xfcaa('0x12')]['find']({'raw':_0x37bc0f[_0xfcaa('0x14')]?_0x37bc0f[_0xfcaa('0x14')][_0xfcaa('0x15')]===undefined?!![]:![]:!![],'where':_0x37bc0f[_0xfcaa('0x14')]?_0x37bc0f[_0xfcaa('0x14')][_0xfcaa('0x16')]||null:null,'attributes':_0x37bc0f['options']?_0x37bc0f[_0xfcaa('0x14')][_0xfcaa('0x17')]||null:null,'include':_0x37bc0f[_0xfcaa('0x14')]?_0x37bc0f[_0xfcaa('0x14')]['include']?_[_0xfcaa('0x1a')](_0x37bc0f['options'][_0xfcaa('0x19')],function(_0x565c85){return{'model':db[_0x565c85[_0xfcaa('0x1b')]],'as':_0x565c85['as'],'attributes':_0x565c85[_0xfcaa('0x17')],'include':_0x565c85[_0xfcaa('0x19')]?_[_0xfcaa('0x1a')](_0x565c85[_0xfcaa('0x19')],function(_0x17afb0){return{'model':db[_0x17afb0['model']],'as':_0x17afb0['as'],'attributes':_0x17afb0[_0xfcaa('0x17')],'include':_0x17afb0[_0xfcaa('0x19')]?_[_0xfcaa('0x1a')](_0x17afb0[_0xfcaa('0x19')],function(_0x40014a){return{'model':db[_0x40014a[_0xfcaa('0x1b')]],'as':_0x40014a['as'],'attributes':_0x40014a[_0xfcaa('0x17')]};}):[]};}):[]};}):[]:[]})[_0xfcaa('0x1f')](function(_0xa35d43){logger[_0xfcaa('0xf')](_0xfcaa('0x1e'),_0x37bc0f);logger[_0xfcaa('0x1c')](_0xfcaa('0x1e'),_0x37bc0f,JSON[_0xfcaa('0xb')](_0xa35d43));_0x4c8029(_0xa35d43);})['catch'](function(_0x515255){logger[_0xfcaa('0xc')]('ShowZohoAccount',_0x515255[_0xfcaa('0xe')],_0x37bc0f);_0x17bf82(_0x1c538f['error'](0x1f4,_0x515255[_0xfcaa('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 2c9f6eb..60c1eb2 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 _0x07eb=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','update','delete'];(function(_0x3453c7,_0x507858){var _0x4917fc=function(_0x2fc836){while(--_0x2fc836){_0x3453c7['push'](_0x3453c7['shift']());}};_0x4917fc(++_0x507858);}(_0x07eb,0x1b6));var _0xb07e=function(_0x4409e7,_0x307f17){_0x4409e7=_0x4409e7-0x0;var _0x24c751=_0x07eb[_0x4409e7];return _0x24c751;};'use strict';var multer=require(_0xb07e('0x0'));var util=require(_0xb07e('0x1'));var path=require(_0xb07e('0x2'));var timeout=require(_0xb07e('0x3'));var express=require(_0xb07e('0x4'));var router=express['Router']();var fs_extra=require(_0xb07e('0x5'));var auth=require(_0xb07e('0x6'));var interaction=require(_0xb07e('0x7'));var config=require(_0xb07e('0x8'));var controller=require(_0xb07e('0x9'));router[_0xb07e('0xa')]('/',auth[_0xb07e('0xb')](),controller[_0xb07e('0xc')]);router['get'](_0xb07e('0xd'),auth[_0xb07e('0xb')](),controller[_0xb07e('0xe')]);router[_0xb07e('0xa')](_0xb07e('0xf'),auth[_0xb07e('0xb')](),controller[_0xb07e('0x10')]);router[_0xb07e('0xa')](_0xb07e('0x11'),auth[_0xb07e('0xb')](),controller[_0xb07e('0x12')]);router['get']('/:id/descriptions',auth[_0xb07e('0xb')](),controller[_0xb07e('0x13')]);router['post']('/',auth[_0xb07e('0xb')](),controller['create']);router['put'](_0xb07e('0xd'),auth[_0xb07e('0xb')](),controller[_0xb07e('0x14')]);router[_0xb07e('0x15')](_0xb07e('0xd'),auth[_0xb07e('0xb')](),controller['destroy']);module[_0xb07e('0x16')]=router; \ No newline at end of file +var _0x1217=['connect-timeout','express','Router','../../components/auth/service','./intZohoConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','post','create','delete','exports','multer','util'];(function(_0x143505,_0x394dd3){var _0x472425=function(_0x16d7a5){while(--_0x16d7a5){_0x143505['push'](_0x143505['shift']());}};_0x472425(++_0x394dd3);}(_0x1217,0x1e4));var _0x7121=function(_0x144d83,_0x575eb9){_0x144d83=_0x144d83-0x0;var _0x23c76c=_0x1217[_0x144d83];return _0x23c76c;};'use strict';var multer=require(_0x7121('0x0'));var util=require(_0x7121('0x1'));var path=require('path');var timeout=require(_0x7121('0x2'));var express=require(_0x7121('0x3'));var router=express[_0x7121('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7121('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7121('0x6'));router[_0x7121('0x7')]('/',auth[_0x7121('0x8')](),controller['index']);router[_0x7121('0x7')](_0x7121('0x9'),auth['isAuthenticated'](),controller[_0x7121('0xa')]);router[_0x7121('0x7')](_0x7121('0xb'),auth[_0x7121('0x8')](),controller['getFields']);router[_0x7121('0x7')](_0x7121('0xc'),auth[_0x7121('0x8')](),controller['getSubjects']);router[_0x7121('0x7')](_0x7121('0xd'),auth[_0x7121('0x8')](),controller['getDescriptions']);router[_0x7121('0xe')]('/',auth[_0x7121('0x8')](),controller[_0x7121('0xf')]);router['put'](_0x7121('0x9'),auth[_0x7121('0x8')](),controller['update']);router[_0x7121('0x10')](_0x7121('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x7121('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 33dcdb9..c3fe51f 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 _0x31e7=['sequelize','STRING','ENUM','lead','contact','contact_lead'];(function(_0x35902a,_0x5336d1){var _0x56e78e=function(_0x1f37ba){while(--_0x1f37ba){_0x35902a['push'](_0x35902a['shift']());}};_0x56e78e(++_0x5336d1);}(_0x31e7,0x108));var _0x731e=function(_0x23b3da,_0x564c46){_0x23b3da=_0x23b3da-0x0;var _0x435f30=_0x31e7[_0x23b3da];return _0x435f30;};'use strict';var Sequelize=require(_0x731e('0x0'));module['exports']={'name':{'type':Sequelize[_0x731e('0x1')]},'moduleCreate':{'type':Sequelize[_0x731e('0x2')](_0x731e('0x3'),_0x731e('0x4'),'nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x731e('0x2')]('contact_lead',_0x731e('0x4'),_0x731e('0x3')),'defaultValue':_0x731e('0x5')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4720=['nothing','contact_lead','STRING','ENUM','lead','contact'];(function(_0x261a3f,_0x3abfcc){var _0x35d081=function(_0x5d81ea){while(--_0x5d81ea){_0x261a3f['push'](_0x261a3f['shift']());}};_0x35d081(++_0x3abfcc);}(_0x4720,0x164));var _0x0472=function(_0x47adb8,_0x591ccc){_0x47adb8=_0x47adb8-0x0;var _0x4689a8=_0x4720[_0x47adb8];return _0x4689a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0472('0x0')]},'moduleCreate':{'type':Sequelize[_0x0472('0x1')](_0x0472('0x2'),_0x0472('0x3'),_0x0472('0x4')),'defaultValue':_0x0472('0x2')},'moduleSearch':{'type':Sequelize[_0x0472('0x1')](_0x0472('0x5'),_0x0472('0x3'),_0x0472('0x2')),'defaultValue':_0x0472('0x5')},'description':{'type':Sequelize[_0x0472('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 6de6d68..74fa245 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 _0x2272=['getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','sendStatus','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','where','merge','includeAll','then','rows','catch','params','include','options','find','create','body','destroy','findOne','ZohoField','filter','getFields','getSubjects','nolimit'];(function(_0x7b284,_0x44232d){var _0x1d0a29=function(_0x9af68e){while(--_0x9af68e){_0x7b284['push'](_0x7b284['shift']());}};_0x1d0a29(++_0x44232d);}(_0x2272,0x9f));var _0x2227=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2272[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x2227('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2227('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2227('0x2'));var moment=require(_0x2227('0x3'));var BPromise=require(_0x2227('0x4'));var Mustache=require(_0x2227('0x5'));var util=require(_0x2227('0x6'));var path=require('path');var sox=require(_0x2227('0x7'));var csv=require(_0x2227('0x8'));var ejs=require(_0x2227('0x9'));var fs=require('fs');var fs_extra=require(_0x2227('0xa'));var _=require(_0x2227('0xb'));var squel=require(_0x2227('0xc'));var crypto=require(_0x2227('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2227('0xe'));var toCsv=require(_0x2227('0x8'));var querystring=require(_0x2227('0xf'));var Papa=require(_0x2227('0x10'));var Redis=require('ioredis');var authService=require(_0x2227('0x11'));var qs=require(_0x2227('0x12'));var as=require(_0x2227('0x13'));var hardwareService=require(_0x2227('0x14'));var logger=require('../../config/logger')(_0x2227('0x15'));var utils=require(_0x2227('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2227('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bdb5d,_0x1901ac){_0x1901ac=_0x1901ac||0xcc;return function(_0x2079e8){if(_0x2079e8){return _0x1bdb5d['sendStatus'](_0x1901ac);}return _0x1bdb5d['status'](_0x1901ac)['end']();};}function respondWithResult(_0x1abf3b,_0x355d8e){_0x355d8e=_0x355d8e||0xc8;return function(_0x281b86){if(_0x281b86){return _0x1abf3b[_0x2227('0x18')](_0x355d8e)[_0x2227('0x19')](_0x281b86);}};}function respondWithFilteredResult(_0x34283e,_0x11314){return function(_0xf5522d){if(_0xf5522d){var _0x4bb3e8=typeof _0x11314[_0x2227('0x1a')]===_0x2227('0x1b')&&typeof _0x11314[_0x2227('0x1c')]===_0x2227('0x1b');var _0x3187a1=_0xf5522d[_0x2227('0x1d')];var _0x4b1243=_0x4bb3e8?0x0:_0x11314[_0x2227('0x1a')];var _0xf2be88=_0x4bb3e8?_0xf5522d[_0x2227('0x1d')]:_0x11314[_0x2227('0x1a')]+_0x11314[_0x2227('0x1c')];var _0x7b4839;if(_0xf2be88>=_0x3187a1){_0xf2be88=_0x3187a1;_0x7b4839=0xc8;}else{_0x7b4839=0xce;}_0x34283e[_0x2227('0x18')](_0x7b4839);return _0x34283e[_0x2227('0x1e')](_0x2227('0x1f'),_0x4b1243+'-'+_0xf2be88+'/'+_0x3187a1)['json'](_0xf5522d);}return null;};}function patchUpdates(_0x1ed492){return function(_0x12099d){try{jsonpatch[_0x2227('0x20')](_0x12099d,_0x1ed492,!![]);}catch(_0x4000df){return BPromise[_0x2227('0x21')](_0x4000df);}return _0x12099d[_0x2227('0x22')]();};}function saveUpdates(_0x1ba5f2,_0x9d8dd5){return function(_0x125826){if(_0x125826){return _0x125826[_0x2227('0x23')](_0x1ba5f2)['then'](function(_0x258a63){return _0x258a63;});}return null;};}function removeEntity(_0x4784b1,_0x16baec){return function(_0xb845f5){if(_0xb845f5){return _0xb845f5['destroy']()['then'](function(){_0x4784b1[_0x2227('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40823b,_0x1bdade){return function(_0x1ab8d3){if(!_0x1ab8d3){_0x40823b[_0x2227('0x24')](0x194);}return _0x1ab8d3;};}function handleError(_0x4ffdb4,_0x5e508f){_0x5e508f=_0x5e508f||0x1f4;return function(_0x35fa62){logger[_0x2227('0x25')](_0x35fa62[_0x2227('0x26')]);if(_0x35fa62['name']){delete _0x35fa62[_0x2227('0x27')];}_0x4ffdb4[_0x2227('0x18')](_0x5e508f)[_0x2227('0x28')](_0x35fa62);};}exports[_0x2227('0x29')]=function(_0x5e0b88,_0x48c9a0){var _0x1e0dfc={},_0x5939b4={},_0xd93323={'count':0x0,'rows':[]};var _0x55fddb=_[_0x2227('0x2a')](db[_0x2227('0x2b')][_0x2227('0x2c')],function(_0x35fda1){return{'name':_0x35fda1['fieldName'],'type':_0x35fda1[_0x2227('0x2d')][_0x2227('0x2e')]};});_0x5939b4['model']=_[_0x2227('0x2a')](_0x55fddb,_0x2227('0x27'));_0x5939b4['query']=_[_0x2227('0x2f')](_0x5e0b88[_0x2227('0x30')]);_0x5939b4[_0x2227('0x31')]=_[_0x2227('0x32')](_0x5939b4[_0x2227('0x33')],_0x5939b4[_0x2227('0x30')]);_0x1e0dfc['attributes']=_['intersection'](_0x5939b4[_0x2227('0x33')],qs[_0x2227('0x34')](_0x5e0b88[_0x2227('0x30')]['fields']));_0x1e0dfc['attributes']=_0x1e0dfc[_0x2227('0x35')][_0x2227('0x36')]?_0x1e0dfc[_0x2227('0x35')]:_0x5939b4[_0x2227('0x33')];if(!_0x5e0b88['query'][_0x2227('0x37')]('nolimit')){_0x1e0dfc[_0x2227('0x1c')]=qs[_0x2227('0x1c')](_0x5e0b88[_0x2227('0x30')]['limit']);_0x1e0dfc[_0x2227('0x1a')]=qs[_0x2227('0x1a')](_0x5e0b88[_0x2227('0x30')]['offset']);}_0x1e0dfc[_0x2227('0x38')]=qs[_0x2227('0x39')](_0x5e0b88['query']['sort']);_0x1e0dfc['where']=qs['filters'](_[_0x2227('0x3a')](_0x5e0b88[_0x2227('0x30')],_0x5939b4[_0x2227('0x31')]),_0x55fddb);if(_0x5e0b88['query']['filter']){_0x1e0dfc[_0x2227('0x3b')]=_[_0x2227('0x3c')](_0x1e0dfc[_0x2227('0x3b')],{'$or':_[_0x2227('0x2a')](_0x55fddb,function(_0x3c3e26){if(_0x3c3e26[_0x2227('0x2d')]!=='VIRTUAL'){var _0x22bd77={};_0x22bd77[_0x3c3e26[_0x2227('0x27')]]={'$like':'%'+_0x5e0b88['query']['filter']+'%'};return _0x22bd77;}})});}_0x1e0dfc=_[_0x2227('0x3c')]({},_0x1e0dfc,_0x5e0b88['options']);var _0x487ca8={'where':_0x1e0dfc['where']};return db[_0x2227('0x2b')]['count'](_0x487ca8)['then'](function(_0x111d7a){_0xd93323[_0x2227('0x1d')]=_0x111d7a;if(_0x5e0b88[_0x2227('0x30')][_0x2227('0x3d')]){_0x1e0dfc['include']=[{'all':!![]}];}return db[_0x2227('0x2b')]['findAll'](_0x1e0dfc);})[_0x2227('0x3e')](function(_0x159fec){_0xd93323[_0x2227('0x3f')]=_0x159fec;return _0xd93323;})[_0x2227('0x3e')](respondWithFilteredResult(_0x48c9a0,_0x1e0dfc))[_0x2227('0x40')](handleError(_0x48c9a0,null));};exports['show']=function(_0x500823,_0x312099){var _0x41b97c={'raw':![],'where':{'id':_0x500823[_0x2227('0x41')]['id']}},_0x255aa6={};_0x255aa6[_0x2227('0x33')]=_[_0x2227('0x2f')](db['ZohoConfiguration'][_0x2227('0x2c')]);_0x255aa6[_0x2227('0x30')]=_[_0x2227('0x2f')](_0x500823[_0x2227('0x30')]);_0x255aa6[_0x2227('0x31')]=_[_0x2227('0x32')](_0x255aa6[_0x2227('0x33')],_0x255aa6['query']);_0x41b97c[_0x2227('0x35')]=_['intersection'](_0x255aa6[_0x2227('0x33')],qs[_0x2227('0x34')](_0x500823['query'][_0x2227('0x34')]));_0x41b97c[_0x2227('0x35')]=_0x41b97c[_0x2227('0x35')][_0x2227('0x36')]?_0x41b97c['attributes']:_0x255aa6[_0x2227('0x33')];if(_0x500823[_0x2227('0x30')][_0x2227('0x3d')]){_0x41b97c[_0x2227('0x42')]=[{'all':!![]}];}_0x41b97c=_[_0x2227('0x3c')]({},_0x41b97c,_0x500823[_0x2227('0x43')]);return db[_0x2227('0x2b')][_0x2227('0x44')](_0x41b97c)[_0x2227('0x3e')](handleEntityNotFound(_0x312099,null))[_0x2227('0x3e')](respondWithResult(_0x312099,null))[_0x2227('0x40')](handleError(_0x312099,null));};exports[_0x2227('0x45')]=function(_0x22829c,_0x36e87c){return db[_0x2227('0x2b')][_0x2227('0x45')](_0x22829c[_0x2227('0x46')],{})[_0x2227('0x3e')](respondWithResult(_0x36e87c,0xc9))['catch'](handleError(_0x36e87c,null));};exports[_0x2227('0x23')]=function(_0x253ac1,_0x3a654a){if(_0x253ac1['body']['id']){delete _0x253ac1[_0x2227('0x46')]['id'];}return db[_0x2227('0x2b')]['find']({'where':{'id':_0x253ac1[_0x2227('0x41')]['id']}})[_0x2227('0x3e')](handleEntityNotFound(_0x3a654a,null))[_0x2227('0x3e')](saveUpdates(_0x253ac1['body'],null))['then'](respondWithResult(_0x3a654a,null))['catch'](handleError(_0x3a654a,null));};exports[_0x2227('0x47')]=function(_0x3bef34,_0x2fa16c){return db[_0x2227('0x2b')]['find']({'where':{'id':_0x3bef34['params']['id']}})[_0x2227('0x3e')](handleEntityNotFound(_0x2fa16c,null))['then'](removeEntity(_0x2fa16c,null))[_0x2227('0x40')](handleError(_0x2fa16c,null));};exports['getFields']=function(_0x45ee6b,_0x11ac53,_0x22a4b5){var _0x26ec27={};var _0x50dd0a={};var _0x2cfa55;var _0x29840b;return db['ZohoConfiguration'][_0x2227('0x48')]({'where':{'id':_0x45ee6b[_0x2227('0x41')]['id']}})[_0x2227('0x3e')](handleEntityNotFound(_0x11ac53,null))[_0x2227('0x3e')](function(_0x388630){if(_0x388630){_0x2cfa55=_0x388630;_0x50dd0a[_0x2227('0x33')]=_['keys'](db[_0x2227('0x49')][_0x2227('0x2c')]);_0x50dd0a[_0x2227('0x30')]=_['keys'](_0x45ee6b[_0x2227('0x30')]);_0x50dd0a[_0x2227('0x31')]=_[_0x2227('0x32')](_0x50dd0a[_0x2227('0x33')],_0x50dd0a[_0x2227('0x30')]);_0x26ec27['attributes']=_[_0x2227('0x32')](_0x50dd0a[_0x2227('0x33')],qs[_0x2227('0x34')](_0x45ee6b['query'][_0x2227('0x34')]));_0x26ec27[_0x2227('0x35')]=_0x26ec27[_0x2227('0x35')][_0x2227('0x36')]?_0x26ec27[_0x2227('0x35')]:_0x50dd0a[_0x2227('0x33')];_0x26ec27[_0x2227('0x38')]=qs['sort'](_0x45ee6b['query']['sort']);_0x26ec27[_0x2227('0x3b')]=qs[_0x2227('0x31')](_[_0x2227('0x3a')](_0x45ee6b[_0x2227('0x30')],_0x50dd0a[_0x2227('0x31')]));if(_0x45ee6b[_0x2227('0x30')][_0x2227('0x4a')]){_0x26ec27[_0x2227('0x3b')]=_[_0x2227('0x3c')](_0x26ec27['where'],{'$or':_[_0x2227('0x2a')](_0x26ec27[_0x2227('0x35')],function(_0x1a6ba7){var _0x54fcdf={};_0x54fcdf[_0x1a6ba7]={'$like':'%'+_0x45ee6b[_0x2227('0x30')][_0x2227('0x4a')]+'%'};return _0x54fcdf;})});}_0x26ec27=_['merge']({},_0x26ec27,_0x45ee6b[_0x2227('0x43')]);return _0x2cfa55[_0x2227('0x4b')](_0x26ec27);}})['then'](function(_0x1848dd){if(_0x1848dd){_0x29840b=_0x1848dd[_0x2227('0x36')];if(!_0x45ee6b[_0x2227('0x30')]['hasOwnProperty']('nolimit')){_0x26ec27[_0x2227('0x1c')]=qs[_0x2227('0x1c')](_0x45ee6b[_0x2227('0x30')][_0x2227('0x1c')]);_0x26ec27[_0x2227('0x1a')]=qs[_0x2227('0x1a')](_0x45ee6b['query'][_0x2227('0x1a')]);}return _0x2cfa55[_0x2227('0x4b')](_0x26ec27);}})[_0x2227('0x3e')](function(_0x53d0ef){if(_0x53d0ef){return _0x53d0ef?{'count':_0x29840b,'rows':_0x53d0ef}:null;}})[_0x2227('0x3e')](respondWithResult(_0x11ac53,null))[_0x2227('0x40')](handleError(_0x11ac53,null));};exports[_0x2227('0x4c')]=function(_0x2791b6,_0x3c1dd5,_0x444961){var _0xce91fc={};var _0x4f4e79={};var _0x88e671;var _0x36dae8;return db['ZohoConfiguration'][_0x2227('0x48')]({'where':{'id':_0x2791b6[_0x2227('0x41')]['id']}})[_0x2227('0x3e')](handleEntityNotFound(_0x3c1dd5,null))[_0x2227('0x3e')](function(_0xa0e42c){if(_0xa0e42c){_0x88e671=_0xa0e42c;_0x4f4e79[_0x2227('0x33')]=_[_0x2227('0x2f')](db['ZohoField'][_0x2227('0x2c')]);_0x4f4e79[_0x2227('0x30')]=_[_0x2227('0x2f')](_0x2791b6[_0x2227('0x30')]);_0x4f4e79[_0x2227('0x31')]=_[_0x2227('0x32')](_0x4f4e79[_0x2227('0x33')],_0x4f4e79[_0x2227('0x30')]);_0xce91fc['attributes']=_[_0x2227('0x32')](_0x4f4e79['model'],qs[_0x2227('0x34')](_0x2791b6['query']['fields']));_0xce91fc[_0x2227('0x35')]=_0xce91fc['attributes'][_0x2227('0x36')]?_0xce91fc[_0x2227('0x35')]:_0x4f4e79['model'];_0xce91fc[_0x2227('0x38')]=qs[_0x2227('0x39')](_0x2791b6[_0x2227('0x30')][_0x2227('0x39')]);_0xce91fc[_0x2227('0x3b')]=qs[_0x2227('0x31')](_[_0x2227('0x3a')](_0x2791b6['query'],_0x4f4e79[_0x2227('0x31')]));if(_0x2791b6['query'][_0x2227('0x4a')]){_0xce91fc[_0x2227('0x3b')]=_[_0x2227('0x3c')](_0xce91fc[_0x2227('0x3b')],{'$or':_[_0x2227('0x2a')](_0xce91fc['attributes'],function(_0x40454f){var _0x50b260={};_0x50b260[_0x40454f]={'$like':'%'+_0x2791b6[_0x2227('0x30')][_0x2227('0x4a')]+'%'};return _0x50b260;})});}_0xce91fc=_[_0x2227('0x3c')]({},_0xce91fc,_0x2791b6['options']);return _0x88e671[_0x2227('0x4c')](_0xce91fc);}})[_0x2227('0x3e')](function(_0x4fe478){if(_0x4fe478){_0x36dae8=_0x4fe478['length'];if(!_0x2791b6[_0x2227('0x30')][_0x2227('0x37')](_0x2227('0x4d'))){_0xce91fc['limit']=qs[_0x2227('0x1c')](_0x2791b6['query']['limit']);_0xce91fc['offset']=qs[_0x2227('0x1a')](_0x2791b6['query'][_0x2227('0x1a')]);}return _0x88e671[_0x2227('0x4c')](_0xce91fc);}})[_0x2227('0x3e')](function(_0x46ea97){if(_0x46ea97){return _0x46ea97?{'count':_0x36dae8,'rows':_0x46ea97}:null;}})[_0x2227('0x3e')](respondWithResult(_0x3c1dd5,null))[_0x2227('0x40')](handleError(_0x3c1dd5,null));};exports[_0x2227('0x4e')]=function(_0x23ac2a,_0x49c433,_0x25ab16){var _0x40ac98={};var _0xfd6889={};var _0x5b899e;var _0x10a450;return db[_0x2227('0x2b')][_0x2227('0x48')]({'where':{'id':_0x23ac2a[_0x2227('0x41')]['id']}})[_0x2227('0x3e')](handleEntityNotFound(_0x49c433,null))[_0x2227('0x3e')](function(_0x50eb06){if(_0x50eb06){_0x5b899e=_0x50eb06;_0xfd6889[_0x2227('0x33')]=_['keys'](db[_0x2227('0x49')]['rawAttributes']);_0xfd6889[_0x2227('0x30')]=_[_0x2227('0x2f')](_0x23ac2a['query']);_0xfd6889['filters']=_['intersection'](_0xfd6889[_0x2227('0x33')],_0xfd6889[_0x2227('0x30')]);_0x40ac98['attributes']=_[_0x2227('0x32')](_0xfd6889[_0x2227('0x33')],qs[_0x2227('0x34')](_0x23ac2a[_0x2227('0x30')][_0x2227('0x34')]));_0x40ac98[_0x2227('0x35')]=_0x40ac98['attributes'][_0x2227('0x36')]?_0x40ac98[_0x2227('0x35')]:_0xfd6889[_0x2227('0x33')];_0x40ac98[_0x2227('0x38')]=qs[_0x2227('0x39')](_0x23ac2a[_0x2227('0x30')][_0x2227('0x39')]);_0x40ac98[_0x2227('0x3b')]=qs[_0x2227('0x31')](_[_0x2227('0x3a')](_0x23ac2a[_0x2227('0x30')],_0xfd6889[_0x2227('0x31')]));if(_0x23ac2a['query'][_0x2227('0x4a')]){_0x40ac98[_0x2227('0x3b')]=_[_0x2227('0x3c')](_0x40ac98[_0x2227('0x3b')],{'$or':_[_0x2227('0x2a')](_0x40ac98[_0x2227('0x35')],function(_0x515698){var _0x251a35={};_0x251a35[_0x515698]={'$like':'%'+_0x23ac2a[_0x2227('0x30')]['filter']+'%'};return _0x251a35;})});}_0x40ac98=_[_0x2227('0x3c')]({},_0x40ac98,_0x23ac2a[_0x2227('0x43')]);return _0x5b899e[_0x2227('0x4e')](_0x40ac98);}})[_0x2227('0x3e')](function(_0x529c01){if(_0x529c01){_0x10a450=_0x529c01[_0x2227('0x36')];if(!_0x23ac2a[_0x2227('0x30')][_0x2227('0x37')](_0x2227('0x4d'))){_0x40ac98['limit']=qs[_0x2227('0x1c')](_0x23ac2a[_0x2227('0x30')][_0x2227('0x1c')]);_0x40ac98[_0x2227('0x1a')]=qs[_0x2227('0x1a')](_0x23ac2a[_0x2227('0x30')][_0x2227('0x1a')]);}return _0x5b899e[_0x2227('0x4e')](_0x40ac98);}})[_0x2227('0x3e')](function(_0x9c7efc){if(_0x9c7efc){return _0x9c7efc?{'count':_0x10a450,'rows':_0x9c7efc}:null;}})['then'](respondWithResult(_0x49c433,null))[_0x2227('0x40')](handleError(_0x49c433,null));}; \ No newline at end of file +var _0xdeab=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','offset','limit','set','Content-Range','json','reject','save','then','name','send','ZohoConfiguration','rawAttributes','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','catch','show','params','find','create','body','update','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x53ca5d,_0x11e148){var _0x17b26d=function(_0x177f7d){while(--_0x177f7d){_0x53ca5d['push'](_0x53ca5d['shift']());}};_0x17b26d(++_0x11e148);}(_0xdeab,0x121));var _0xbdea=function(_0x45936f,_0x36b776){_0x45936f=_0x45936f-0x0;var _0x2d569e=_0xdeab[_0x45936f];return _0x2d569e;};'use strict';var emlformat=require(_0xbdea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbdea('0x1'));var jsonpatch=require(_0xbdea('0x2'));var rp=require(_0xbdea('0x3'));var moment=require(_0xbdea('0x4'));var BPromise=require(_0xbdea('0x5'));var Mustache=require(_0xbdea('0x6'));var util=require(_0xbdea('0x7'));var path=require(_0xbdea('0x8'));var sox=require(_0xbdea('0x9'));var csv=require(_0xbdea('0xa'));var ejs=require(_0xbdea('0xb'));var fs=require('fs');var fs_extra=require(_0xbdea('0xc'));var _=require('lodash');var squel=require(_0xbdea('0xd'));var crypto=require(_0xbdea('0xe'));var jsforce=require(_0xbdea('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbdea('0xa'));var querystring=require(_0xbdea('0x10'));var Papa=require('papaparse');var Redis=require(_0xbdea('0x11'));var authService=require(_0xbdea('0x12'));var qs=require(_0xbdea('0x13'));var as=require(_0xbdea('0x14'));var hardwareService=require(_0xbdea('0x15'));var logger=require(_0xbdea('0x16'))(_0xbdea('0x17'));var utils=require('../../config/utils');var config=require(_0xbdea('0x18'));var licenseUtil=require(_0xbdea('0x19'));var db=require(_0xbdea('0x1a'))['db'];function respondWithStatusCode(_0x1b6d00,_0x407ac6){_0x407ac6=_0x407ac6||0xcc;return function(_0x5737ea){if(_0x5737ea){return _0x1b6d00[_0xbdea('0x1b')](_0x407ac6);}return _0x1b6d00[_0xbdea('0x1c')](_0x407ac6)[_0xbdea('0x1d')]();};}function respondWithResult(_0x19cee6,_0x2758d6){_0x2758d6=_0x2758d6||0xc8;return function(_0x641003){if(_0x641003){return _0x19cee6[_0xbdea('0x1c')](_0x2758d6)['json'](_0x641003);}};}function respondWithFilteredResult(_0x34c6f1,_0x2d51b6){return function(_0x431685){if(_0x431685){var _0x1e44cf=typeof _0x2d51b6['offset']===_0xbdea('0x1e')&&typeof _0x2d51b6['limit']===_0xbdea('0x1e');var _0x1e7911=_0x431685['count'];var _0x487bc3=_0x1e44cf?0x0:_0x2d51b6[_0xbdea('0x1f')];var _0x349ccd=_0x1e44cf?_0x431685['count']:_0x2d51b6[_0xbdea('0x1f')]+_0x2d51b6[_0xbdea('0x20')];var _0x3c455f;if(_0x349ccd>=_0x1e7911){_0x349ccd=_0x1e7911;_0x3c455f=0xc8;}else{_0x3c455f=0xce;}_0x34c6f1[_0xbdea('0x1c')](_0x3c455f);return _0x34c6f1[_0xbdea('0x21')](_0xbdea('0x22'),_0x487bc3+'-'+_0x349ccd+'/'+_0x1e7911)[_0xbdea('0x23')](_0x431685);}return null;};}function patchUpdates(_0x3a47fd){return function(_0x1a236e){try{jsonpatch['apply'](_0x1a236e,_0x3a47fd,!![]);}catch(_0x116240){return BPromise[_0xbdea('0x24')](_0x116240);}return _0x1a236e[_0xbdea('0x25')]();};}function saveUpdates(_0x4eb921,_0x463236){return function(_0x14780b){if(_0x14780b){return _0x14780b['update'](_0x4eb921)[_0xbdea('0x26')](function(_0x498649){return _0x498649;});}return null;};}function removeEntity(_0x3bdea6,_0x497c67){return function(_0x3947c2){if(_0x3947c2){return _0x3947c2['destroy']()[_0xbdea('0x26')](function(){_0x3bdea6[_0xbdea('0x1c')](0xcc)[_0xbdea('0x1d')]();});}};}function handleEntityNotFound(_0x25fabf,_0x5555a1){return function(_0x5c735e){if(!_0x5c735e){_0x25fabf[_0xbdea('0x1b')](0x194);}return _0x5c735e;};}function handleError(_0x29b200,_0x49750b){_0x49750b=_0x49750b||0x1f4;return function(_0x11c6c2){logger['error'](_0x11c6c2['stack']);if(_0x11c6c2[_0xbdea('0x27')]){delete _0x11c6c2[_0xbdea('0x27')];}_0x29b200[_0xbdea('0x1c')](_0x49750b)[_0xbdea('0x28')](_0x11c6c2);};}exports['index']=function(_0x28ff93,_0x56f1dc){var _0xb0e740={},_0x5a8dd4={},_0x291d42={'count':0x0,'rows':[]};var _0x172d07=_['map'](db[_0xbdea('0x29')][_0xbdea('0x2a')],function(_0x31192f){return{'name':_0x31192f['fieldName'],'type':_0x31192f[_0xbdea('0x2b')][_0xbdea('0x2c')]};});_0x5a8dd4[_0xbdea('0x2d')]=_[_0xbdea('0x2e')](_0x172d07,_0xbdea('0x27'));_0x5a8dd4['query']=_[_0xbdea('0x2f')](_0x28ff93[_0xbdea('0x30')]);_0x5a8dd4[_0xbdea('0x31')]=_['intersection'](_0x5a8dd4[_0xbdea('0x2d')],_0x5a8dd4[_0xbdea('0x30')]);_0xb0e740[_0xbdea('0x32')]=_[_0xbdea('0x33')](_0x5a8dd4[_0xbdea('0x2d')],qs[_0xbdea('0x34')](_0x28ff93['query']['fields']));_0xb0e740[_0xbdea('0x32')]=_0xb0e740['attributes'][_0xbdea('0x35')]?_0xb0e740[_0xbdea('0x32')]:_0x5a8dd4[_0xbdea('0x2d')];if(!_0x28ff93['query'][_0xbdea('0x36')](_0xbdea('0x37'))){_0xb0e740[_0xbdea('0x20')]=qs[_0xbdea('0x20')](_0x28ff93[_0xbdea('0x30')]['limit']);_0xb0e740['offset']=qs['offset'](_0x28ff93[_0xbdea('0x30')][_0xbdea('0x1f')]);}_0xb0e740[_0xbdea('0x38')]=qs[_0xbdea('0x39')](_0x28ff93[_0xbdea('0x30')]['sort']);_0xb0e740[_0xbdea('0x3a')]=qs['filters'](_[_0xbdea('0x3b')](_0x28ff93['query'],_0x5a8dd4['filters']),_0x172d07);if(_0x28ff93[_0xbdea('0x30')][_0xbdea('0x3c')]){_0xb0e740[_0xbdea('0x3a')]=_[_0xbdea('0x3d')](_0xb0e740[_0xbdea('0x3a')],{'$or':_[_0xbdea('0x2e')](_0x172d07,function(_0x477337){if(_0x477337['type']!=='VIRTUAL'){var _0x2b8f48={};_0x2b8f48[_0x477337[_0xbdea('0x27')]]={'$like':'%'+_0x28ff93[_0xbdea('0x30')][_0xbdea('0x3c')]+'%'};return _0x2b8f48;}})});}_0xb0e740=_['merge']({},_0xb0e740,_0x28ff93[_0xbdea('0x3e')]);var _0x5b39c3={'where':_0xb0e740['where']};return db['ZohoConfiguration'][_0xbdea('0x3f')](_0x5b39c3)[_0xbdea('0x26')](function(_0x14c498){_0x291d42['count']=_0x14c498;if(_0x28ff93['query'][_0xbdea('0x40')]){_0xb0e740[_0xbdea('0x41')]=[{'all':!![]}];}return db[_0xbdea('0x29')]['findAll'](_0xb0e740);})['then'](function(_0x5ad2a5){_0x291d42['rows']=_0x5ad2a5;return _0x291d42;})[_0xbdea('0x26')](respondWithFilteredResult(_0x56f1dc,_0xb0e740))[_0xbdea('0x42')](handleError(_0x56f1dc,null));};exports[_0xbdea('0x43')]=function(_0x1d99e2,_0x1d40db){var _0x401c48={'raw':![],'where':{'id':_0x1d99e2[_0xbdea('0x44')]['id']}},_0x1879bb={};_0x1879bb[_0xbdea('0x2d')]=_['keys'](db['ZohoConfiguration'][_0xbdea('0x2a')]);_0x1879bb['query']=_['keys'](_0x1d99e2[_0xbdea('0x30')]);_0x1879bb[_0xbdea('0x31')]=_[_0xbdea('0x33')](_0x1879bb[_0xbdea('0x2d')],_0x1879bb['query']);_0x401c48[_0xbdea('0x32')]=_['intersection'](_0x1879bb[_0xbdea('0x2d')],qs[_0xbdea('0x34')](_0x1d99e2[_0xbdea('0x30')]['fields']));_0x401c48[_0xbdea('0x32')]=_0x401c48[_0xbdea('0x32')]['length']?_0x401c48[_0xbdea('0x32')]:_0x1879bb[_0xbdea('0x2d')];if(_0x1d99e2['query'][_0xbdea('0x40')]){_0x401c48[_0xbdea('0x41')]=[{'all':!![]}];}_0x401c48=_[_0xbdea('0x3d')]({},_0x401c48,_0x1d99e2[_0xbdea('0x3e')]);return db[_0xbdea('0x29')][_0xbdea('0x45')](_0x401c48)[_0xbdea('0x26')](handleEntityNotFound(_0x1d40db,null))['then'](respondWithResult(_0x1d40db,null))[_0xbdea('0x42')](handleError(_0x1d40db,null));};exports[_0xbdea('0x46')]=function(_0x3d1674,_0x4ab6a6){return db['ZohoConfiguration']['create'](_0x3d1674[_0xbdea('0x47')],{})[_0xbdea('0x26')](respondWithResult(_0x4ab6a6,0xc9))[_0xbdea('0x42')](handleError(_0x4ab6a6,null));};exports[_0xbdea('0x48')]=function(_0x4f59fa,_0x23bc51){if(_0x4f59fa['body']['id']){delete _0x4f59fa[_0xbdea('0x47')]['id'];}return db[_0xbdea('0x29')][_0xbdea('0x45')]({'where':{'id':_0x4f59fa[_0xbdea('0x44')]['id']}})[_0xbdea('0x26')](handleEntityNotFound(_0x23bc51,null))[_0xbdea('0x26')](saveUpdates(_0x4f59fa[_0xbdea('0x47')],null))[_0xbdea('0x26')](respondWithResult(_0x23bc51,null))['catch'](handleError(_0x23bc51,null));};exports['destroy']=function(_0x3474bc,_0x34f1e7){return db['ZohoConfiguration'][_0xbdea('0x45')]({'where':{'id':_0x3474bc[_0xbdea('0x44')]['id']}})[_0xbdea('0x26')](handleEntityNotFound(_0x34f1e7,null))['then'](removeEntity(_0x34f1e7,null))[_0xbdea('0x42')](handleError(_0x34f1e7,null));};exports[_0xbdea('0x49')]=function(_0x15e84d,_0x404fa6,_0x375572){var _0x25d0e={};var _0x2c686a={};var _0x1fcaab;var _0x4f8f8c;return db[_0xbdea('0x29')][_0xbdea('0x4a')]({'where':{'id':_0x15e84d[_0xbdea('0x44')]['id']}})['then'](handleEntityNotFound(_0x404fa6,null))[_0xbdea('0x26')](function(_0xacebfc){if(_0xacebfc){_0x1fcaab=_0xacebfc;_0x2c686a[_0xbdea('0x2d')]=_[_0xbdea('0x2f')](db[_0xbdea('0x4b')][_0xbdea('0x2a')]);_0x2c686a['query']=_[_0xbdea('0x2f')](_0x15e84d['query']);_0x2c686a[_0xbdea('0x31')]=_[_0xbdea('0x33')](_0x2c686a[_0xbdea('0x2d')],_0x2c686a['query']);_0x25d0e[_0xbdea('0x32')]=_[_0xbdea('0x33')](_0x2c686a[_0xbdea('0x2d')],qs[_0xbdea('0x34')](_0x15e84d['query'][_0xbdea('0x34')]));_0x25d0e[_0xbdea('0x32')]=_0x25d0e[_0xbdea('0x32')]['length']?_0x25d0e[_0xbdea('0x32')]:_0x2c686a[_0xbdea('0x2d')];_0x25d0e[_0xbdea('0x38')]=qs[_0xbdea('0x39')](_0x15e84d[_0xbdea('0x30')][_0xbdea('0x39')]);_0x25d0e[_0xbdea('0x3a')]=qs['filters'](_[_0xbdea('0x3b')](_0x15e84d[_0xbdea('0x30')],_0x2c686a[_0xbdea('0x31')]));if(_0x15e84d['query'][_0xbdea('0x3c')]){_0x25d0e[_0xbdea('0x3a')]=_[_0xbdea('0x3d')](_0x25d0e[_0xbdea('0x3a')],{'$or':_[_0xbdea('0x2e')](_0x25d0e[_0xbdea('0x32')],function(_0x35c209){var _0x371ee4={};_0x371ee4[_0x35c209]={'$like':'%'+_0x15e84d[_0xbdea('0x30')][_0xbdea('0x3c')]+'%'};return _0x371ee4;})});}_0x25d0e=_[_0xbdea('0x3d')]({},_0x25d0e,_0x15e84d[_0xbdea('0x3e')]);return _0x1fcaab[_0xbdea('0x49')](_0x25d0e);}})[_0xbdea('0x26')](function(_0x483643){if(_0x483643){_0x4f8f8c=_0x483643['length'];if(!_0x15e84d[_0xbdea('0x30')][_0xbdea('0x36')](_0xbdea('0x37'))){_0x25d0e[_0xbdea('0x20')]=qs[_0xbdea('0x20')](_0x15e84d[_0xbdea('0x30')][_0xbdea('0x20')]);_0x25d0e[_0xbdea('0x1f')]=qs['offset'](_0x15e84d[_0xbdea('0x30')]['offset']);}return _0x1fcaab[_0xbdea('0x49')](_0x25d0e);}})[_0xbdea('0x26')](function(_0x535cb1){if(_0x535cb1){return _0x535cb1?{'count':_0x4f8f8c,'rows':_0x535cb1}:null;}})[_0xbdea('0x26')](respondWithResult(_0x404fa6,null))[_0xbdea('0x42')](handleError(_0x404fa6,null));};exports[_0xbdea('0x4c')]=function(_0x338101,_0x268d47,_0x1cfaee){var _0x116853={};var _0x5b8a74={};var _0x3b7e6c;var _0x3232f7;return db[_0xbdea('0x29')]['findOne']({'where':{'id':_0x338101[_0xbdea('0x44')]['id']}})[_0xbdea('0x26')](handleEntityNotFound(_0x268d47,null))[_0xbdea('0x26')](function(_0x40c5e9){if(_0x40c5e9){_0x3b7e6c=_0x40c5e9;_0x5b8a74['model']=_['keys'](db[_0xbdea('0x4b')][_0xbdea('0x2a')]);_0x5b8a74[_0xbdea('0x30')]=_[_0xbdea('0x2f')](_0x338101[_0xbdea('0x30')]);_0x5b8a74['filters']=_['intersection'](_0x5b8a74[_0xbdea('0x2d')],_0x5b8a74['query']);_0x116853[_0xbdea('0x32')]=_[_0xbdea('0x33')](_0x5b8a74[_0xbdea('0x2d')],qs[_0xbdea('0x34')](_0x338101['query'][_0xbdea('0x34')]));_0x116853[_0xbdea('0x32')]=_0x116853[_0xbdea('0x32')][_0xbdea('0x35')]?_0x116853[_0xbdea('0x32')]:_0x5b8a74[_0xbdea('0x2d')];_0x116853['order']=qs[_0xbdea('0x39')](_0x338101[_0xbdea('0x30')][_0xbdea('0x39')]);_0x116853[_0xbdea('0x3a')]=qs['filters'](_[_0xbdea('0x3b')](_0x338101['query'],_0x5b8a74[_0xbdea('0x31')]));if(_0x338101[_0xbdea('0x30')][_0xbdea('0x3c')]){_0x116853[_0xbdea('0x3a')]=_[_0xbdea('0x3d')](_0x116853[_0xbdea('0x3a')],{'$or':_['map'](_0x116853[_0xbdea('0x32')],function(_0x4fa3e3){var _0x4fc4ac={};_0x4fc4ac[_0x4fa3e3]={'$like':'%'+_0x338101[_0xbdea('0x30')]['filter']+'%'};return _0x4fc4ac;})});}_0x116853=_[_0xbdea('0x3d')]({},_0x116853,_0x338101[_0xbdea('0x3e')]);return _0x3b7e6c[_0xbdea('0x4c')](_0x116853);}})['then'](function(_0x241edd){if(_0x241edd){_0x3232f7=_0x241edd[_0xbdea('0x35')];if(!_0x338101[_0xbdea('0x30')][_0xbdea('0x36')](_0xbdea('0x37'))){_0x116853[_0xbdea('0x20')]=qs[_0xbdea('0x20')](_0x338101[_0xbdea('0x30')][_0xbdea('0x20')]);_0x116853[_0xbdea('0x1f')]=qs['offset'](_0x338101[_0xbdea('0x30')][_0xbdea('0x1f')]);}return _0x3b7e6c[_0xbdea('0x4c')](_0x116853);}})['then'](function(_0x1b5296){if(_0x1b5296){return _0x1b5296?{'count':_0x3232f7,'rows':_0x1b5296}:null;}})[_0xbdea('0x26')](respondWithResult(_0x268d47,null))[_0xbdea('0x42')](handleError(_0x268d47,null));};exports['getDescriptions']=function(_0x55d9b7,_0x5c5978,_0x4a2a86){var _0x55bccc={};var _0x32ed0c={};var _0x1a218f;var _0x577b35;return db[_0xbdea('0x29')][_0xbdea('0x4a')]({'where':{'id':_0x55d9b7[_0xbdea('0x44')]['id']}})[_0xbdea('0x26')](handleEntityNotFound(_0x5c5978,null))[_0xbdea('0x26')](function(_0x4ef26b){if(_0x4ef26b){_0x1a218f=_0x4ef26b;_0x32ed0c['model']=_[_0xbdea('0x2f')](db[_0xbdea('0x4b')][_0xbdea('0x2a')]);_0x32ed0c[_0xbdea('0x30')]=_[_0xbdea('0x2f')](_0x55d9b7['query']);_0x32ed0c['filters']=_[_0xbdea('0x33')](_0x32ed0c[_0xbdea('0x2d')],_0x32ed0c[_0xbdea('0x30')]);_0x55bccc['attributes']=_[_0xbdea('0x33')](_0x32ed0c[_0xbdea('0x2d')],qs[_0xbdea('0x34')](_0x55d9b7[_0xbdea('0x30')][_0xbdea('0x34')]));_0x55bccc[_0xbdea('0x32')]=_0x55bccc[_0xbdea('0x32')][_0xbdea('0x35')]?_0x55bccc['attributes']:_0x32ed0c[_0xbdea('0x2d')];_0x55bccc[_0xbdea('0x38')]=qs['sort'](_0x55d9b7['query'][_0xbdea('0x39')]);_0x55bccc['where']=qs['filters'](_[_0xbdea('0x3b')](_0x55d9b7['query'],_0x32ed0c[_0xbdea('0x31')]));if(_0x55d9b7[_0xbdea('0x30')][_0xbdea('0x3c')]){_0x55bccc['where']=_[_0xbdea('0x3d')](_0x55bccc[_0xbdea('0x3a')],{'$or':_['map'](_0x55bccc[_0xbdea('0x32')],function(_0x68f160){var _0x44211c={};_0x44211c[_0x68f160]={'$like':'%'+_0x55d9b7[_0xbdea('0x30')][_0xbdea('0x3c')]+'%'};return _0x44211c;})});}_0x55bccc=_['merge']({},_0x55bccc,_0x55d9b7[_0xbdea('0x3e')]);return _0x1a218f[_0xbdea('0x4d')](_0x55bccc);}})['then'](function(_0x4e6dd1){if(_0x4e6dd1){_0x577b35=_0x4e6dd1['length'];if(!_0x55d9b7[_0xbdea('0x30')][_0xbdea('0x36')](_0xbdea('0x37'))){_0x55bccc['limit']=qs[_0xbdea('0x20')](_0x55d9b7['query'][_0xbdea('0x20')]);_0x55bccc[_0xbdea('0x1f')]=qs[_0xbdea('0x1f')](_0x55d9b7[_0xbdea('0x30')][_0xbdea('0x1f')]);}return _0x1a218f[_0xbdea('0x4d')](_0x55bccc);}})[_0xbdea('0x26')](function(_0x29b102){if(_0x29b102){return _0x29b102?{'count':_0x577b35,'rows':_0x29b102}:null;}})[_0xbdea('0x26')](respondWithResult(_0x5c5978,null))['catch'](handleError(_0x5c5978,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 6a215ce..34b04be 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 _0x906c=['./intZohoConfiguration.attributes','exports','int_zoho_configurations','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment'];(function(_0x4a399d,_0x5a0e16){var _0x34bf6c=function(_0x5da4a2){while(--_0x5da4a2){_0x4a399d['push'](_0x4a399d['shift']());}};_0x34bf6c(++_0x5a0e16);}(_0x906c,0xb7));var _0xc906=function(_0x86853e,_0x50f3f8){_0x86853e=_0x86853e-0x0;var _0x1089b7=_0x906c[_0x86853e];return _0x1089b7;};'use strict';var _=require(_0xc906('0x0'));var util=require(_0xc906('0x1'));var logger=require(_0xc906('0x2'))(_0xc906('0x3'));var moment=require('moment');var BPromise=require(_0xc906('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc906('0x5'));var config=require(_0xc906('0x6'));var attributes=require(_0xc906('0x7'));module[_0xc906('0x8')]=function(_0x36cd68,_0x1ed911){return _0x36cd68['define']('ZohoConfiguration',attributes,{'tableName':_0xc906('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6be6=['../../config/environment','exports','define','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x580971,_0x10984d){var _0x16d873=function(_0x594084){while(--_0x594084){_0x580971['push'](_0x580971['shift']());}};_0x16d873(++_0x10984d);}(_0x6be6,0xf4));var _0x66be=function(_0x5a18f8,_0x2ea883){_0x5a18f8=_0x5a18f8-0x0;var _0x37f7a5=_0x6be6[_0x5a18f8];return _0x37f7a5;};'use strict';var _=require(_0x66be('0x0'));var util=require(_0x66be('0x1'));var logger=require(_0x66be('0x2'))(_0x66be('0x3'));var moment=require(_0x66be('0x4'));var BPromise=require(_0x66be('0x5'));var rp=require(_0x66be('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x66be('0x7'));var config=require(_0x66be('0x8'));var attributes=require('./intZohoConfiguration.attributes');module[_0x66be('0x9')]=function(_0x136652,_0x428b1a){return _0x136652[_0x66be('0xa')]('ZohoConfiguration',attributes,{'tableName':_0x66be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index cbfd35f..53bacb4 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 _0xf4fe=['rpc','../../config/environment','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1749df,_0x374c1c){var _0x5978b5=function(_0x203998){while(--_0x203998){_0x1749df['push'](_0x1749df['shift']());}};_0x5978b5(++_0x374c1c);}(_0xf4fe,0x1ba));var _0xef4f=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xf4fe[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0xef4f('0x0'));var util=require(_0xef4f('0x1'));var moment=require(_0xef4f('0x2'));var BPromise=require(_0xef4f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xef4f('0x4'));var db=require(_0xef4f('0x5'))['db'];var utils=require(_0xef4f('0x6'));var logger=require(_0xef4f('0x7'))(_0xef4f('0x8'));var config=require(_0xef4f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xef4f('0xa')][_0xef4f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55afc4,_0x5bf844,_0x171cec){return new BPromise(function(_0x3e4d65,_0xe43656){return client[_0xef4f('0xc')](_0x55afc4,_0x171cec)[_0xef4f('0xd')](function(_0x5cb45d){logger[_0xef4f('0xe')](_0xef4f('0xf'),_0x5bf844,_0xef4f('0x10'));logger[_0xef4f('0x11')](_0xef4f('0x12'),_0x5bf844,_0xef4f('0x10'),JSON[_0xef4f('0x13')](_0x5cb45d));if(_0x5cb45d[_0xef4f('0x14')]){if(_0x5cb45d['error'][_0xef4f('0x15')]===0x1f4){logger['error'](_0xef4f('0xf'),_0x5bf844,_0x5cb45d['error'][_0xef4f('0x16')]);return _0xe43656(_0x5cb45d['error'][_0xef4f('0x16')]);}logger[_0xef4f('0x14')](_0xef4f('0xf'),_0x5bf844,_0x5cb45d[_0xef4f('0x14')][_0xef4f('0x16')]);return _0x3e4d65(_0x5cb45d[_0xef4f('0x14')][_0xef4f('0x16')]);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x5bf844,_0xef4f('0x10'));_0x3e4d65(_0x5cb45d[_0xef4f('0x17')][_0xef4f('0x16')]);}})[_0xef4f('0x18')](function(_0x82c66f){logger[_0xef4f('0x14')]('ZohoConfiguration,\x20%s,\x20%s',_0x5bf844,_0x82c66f);_0xe43656(_0x82c66f);});});} \ No newline at end of file +var _0x7227=['client','http','request','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0xf6e60d,_0x4b63e7){var _0x122f6c=function(_0x3c56a3){while(--_0x3c56a3){_0xf6e60d['push'](_0xf6e60d['shift']());}};_0x122f6c(++_0x4b63e7);}(_0x7227,0x12b));var _0x7722=function(_0xa58a3e,_0x115109){_0xa58a3e=_0xa58a3e-0x0;var _0x4f6cd2=_0x7227[_0xa58a3e];return _0x4f6cd2;};'use strict';var _=require(_0x7722('0x0'));var util=require(_0x7722('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7722('0x2'));var fs=require('fs');var Redis=require(_0x7722('0x3'));var db=require(_0x7722('0x4'))['db'];var utils=require(_0x7722('0x5'));var logger=require(_0x7722('0x6'))(_0x7722('0x7'));var config=require('../../config/environment');var jayson=require(_0x7722('0x8'));var client=jayson[_0x7722('0x9')][_0x7722('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55eeb8,_0x1674bd,_0x14feef){return new BPromise(function(_0x53572f,_0x52afc3){return client[_0x7722('0xb')](_0x55eeb8,_0x14feef)['then'](function(_0x3f102d){logger[_0x7722('0xc')](_0x7722('0xd'),_0x1674bd,'request\x20sent');logger[_0x7722('0xe')](_0x7722('0xf'),_0x1674bd,_0x7722('0x10'),JSON[_0x7722('0x11')](_0x3f102d));if(_0x3f102d[_0x7722('0x12')]){if(_0x3f102d['error']['code']===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x1674bd,_0x3f102d[_0x7722('0x12')]['message']);return _0x52afc3(_0x3f102d[_0x7722('0x12')][_0x7722('0x13')]);}logger['error'](_0x7722('0xd'),_0x1674bd,_0x3f102d[_0x7722('0x12')][_0x7722('0x13')]);return _0x53572f(_0x3f102d['error']['message']);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x1674bd,_0x7722('0x10'));_0x53572f(_0x3f102d[_0x7722('0x14')][_0x7722('0x13')]);}})[_0x7722('0x15')](function(_0x117fed){logger[_0x7722('0x12')](_0x7722('0xd'),_0x1674bd,_0x117fed);_0x52afc3(_0x117fed);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 3e58b8f..c4b81c2 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 _0x7866=['delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','index','get','/:id','isAuthenticated','post','put'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7866,0xce));var _0x6786=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x7866[_0x2be8c2];return _0x97f531;};'use strict';var multer=require(_0x6786('0x0'));var util=require(_0x6786('0x1'));var path=require(_0x6786('0x2'));var timeout=require(_0x6786('0x3'));var express=require('express');var router=express[_0x6786('0x4')]();var fs_extra=require(_0x6786('0x5'));var auth=require(_0x6786('0x6'));var interaction=require(_0x6786('0x7'));var config=require('../../config/environment');var controller=require(_0x6786('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6786('0x9')]);router[_0x6786('0xa')](_0x6786('0xb'),auth[_0x6786('0xc')](),controller['show']);router[_0x6786('0xd')]('/',auth[_0x6786('0xc')](),controller['create']);router[_0x6786('0xe')](_0x6786('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x6786('0xf')](_0x6786('0xb'),auth[_0x6786('0xc')](),controller['destroy']);module[_0x6786('0x10')]=router; \ No newline at end of file +var _0xb5aa=['destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xb5aa,0x156));var _0xab5a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xb5aa[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xab5a('0x0'));var util=require(_0xab5a('0x1'));var path=require(_0xab5a('0x2'));var timeout=require(_0xab5a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xab5a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xab5a('0x5'));var config=require(_0xab5a('0x6'));var controller=require(_0xab5a('0x7'));router[_0xab5a('0x8')]('/',auth[_0xab5a('0x9')](),controller[_0xab5a('0xa')]);router[_0xab5a('0x8')](_0xab5a('0xb'),auth[_0xab5a('0x9')](),controller[_0xab5a('0xc')]);router[_0xab5a('0xd')]('/',auth[_0xab5a('0x9')](),controller[_0xab5a('0xe')]);router[_0xab5a('0xf')](_0xab5a('0xb'),auth[_0xab5a('0x9')](),controller[_0xab5a('0x10')]);router[_0xab5a('0x11')](_0xab5a('0xb'),auth[_0xab5a('0x9')](),controller[_0xab5a('0x12')]);module[_0xab5a('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 6a7c09e..61f3f50 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 _0x3b85=['keyValue','picklist','STRING','ENUM','variable','customVariable','BOOLEAN','exports','string'];(function(_0x1a79c6,_0x5bad0b){var _0x301647=function(_0x9d3817){while(--_0x9d3817){_0x1a79c6['push'](_0x1a79c6['shift']());}};_0x301647(++_0x5bad0b);}(_0x3b85,0x11e));var _0x53b8=function(_0x462a55,_0x2a8e34){_0x462a55=_0x462a55-0x0;var _0x11141f=_0x3b85[_0x462a55];return _0x11141f;};'use strict';var Sequelize=require('sequelize');module[_0x53b8('0x0')]={'type':{'type':Sequelize['ENUM'](_0x53b8('0x1'),'variable','customVariable',_0x53b8('0x2'),_0x53b8('0x3')),'defaultValue':_0x53b8('0x1')},'content':{'type':Sequelize[_0x53b8('0x4')]},'key':{'type':Sequelize[_0x53b8('0x4')]},'keyType':{'type':Sequelize[_0x53b8('0x5')](_0x53b8('0x1'),_0x53b8('0x6'),_0x53b8('0x7'))},'keyContent':{'type':Sequelize[_0x53b8('0x4')]},'idField':{'type':Sequelize[_0x53b8('0x4')]},'nameField':{'type':Sequelize[_0x53b8('0x4')]},'customField':{'type':Sequelize[_0x53b8('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x53b8('0x4')]}}; \ No newline at end of file +var _0x38ff=['sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable'];(function(_0x2655b2,_0xa9156b){var _0x93ce77=function(_0x55194d){while(--_0x55194d){_0x2655b2['push'](_0x2655b2['shift']());}};_0x93ce77(++_0xa9156b);}(_0x38ff,0xe1));var _0xf38f=function(_0x274797,_0x56be87){_0x274797=_0x274797-0x0;var _0x5671b3=_0x38ff[_0x274797];return _0x5671b3;};'use strict';var Sequelize=require(_0xf38f('0x0'));module[_0xf38f('0x1')]={'type':{'type':Sequelize[_0xf38f('0x2')](_0xf38f('0x3'),'variable',_0xf38f('0x4'),_0xf38f('0x5'),_0xf38f('0x6')),'defaultValue':_0xf38f('0x3')},'content':{'type':Sequelize[_0xf38f('0x7')]},'key':{'type':Sequelize[_0xf38f('0x7')]},'keyType':{'type':Sequelize[_0xf38f('0x2')]('string',_0xf38f('0x8'),_0xf38f('0x4'))},'keyContent':{'type':Sequelize[_0xf38f('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf38f('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf38f('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index d19a6e1..3700426 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 _0x37ed=['includeAll','include','findAll','rows','catch','show','params','length','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','name','send','index','map','ZohoField','rawAttributes','type','key','model','keys','filters','intersection','attributes','query','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x28a2cc,_0x4084ae){var _0x120262=function(_0x2360e8){while(--_0x2360e8){_0x28a2cc['push'](_0x28a2cc['shift']());}};_0x120262(++_0x4084ae);}(_0x37ed,0x173));var _0xd37e=function(_0xcd0918,_0x56bdf9){_0xcd0918=_0xcd0918-0x0;var _0x250704=_0x37ed[_0xcd0918];return _0x250704;};'use strict';var emlformat=require(_0xd37e('0x0'));var rimraf=require(_0xd37e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd37e('0x2'));var rp=require(_0xd37e('0x3'));var moment=require('moment');var BPromise=require(_0xd37e('0x4'));var Mustache=require('mustache');var util=require(_0xd37e('0x5'));var path=require(_0xd37e('0x6'));var sox=require('sox');var csv=require(_0xd37e('0x7'));var ejs=require(_0xd37e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd37e('0x9'));var crypto=require(_0xd37e('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd37e('0x7'));var querystring=require(_0xd37e('0xb'));var Papa=require(_0xd37e('0xc'));var Redis=require(_0xd37e('0xd'));var authService=require(_0xd37e('0xe'));var qs=require(_0xd37e('0xf'));var as=require(_0xd37e('0x10'));var hardwareService=require(_0xd37e('0x11'));var logger=require(_0xd37e('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xd37e('0x13'));var licenseUtil=require(_0xd37e('0x14'));var db=require(_0xd37e('0x15'))['db'];function respondWithStatusCode(_0x4157c1,_0x2fe926){_0x2fe926=_0x2fe926||0xcc;return function(_0x49d9d9){if(_0x49d9d9){return _0x4157c1[_0xd37e('0x16')](_0x2fe926);}return _0x4157c1[_0xd37e('0x17')](_0x2fe926)[_0xd37e('0x18')]();};}function respondWithResult(_0x5c3fcc,_0x208e68){_0x208e68=_0x208e68||0xc8;return function(_0x14e237){if(_0x14e237){return _0x5c3fcc['status'](_0x208e68)[_0xd37e('0x19')](_0x14e237);}};}function respondWithFilteredResult(_0x35bca0,_0x16c119){return function(_0x36ed2b){if(_0x36ed2b){var _0x24bf1f=typeof _0x16c119[_0xd37e('0x1a')]===_0xd37e('0x1b')&&typeof _0x16c119[_0xd37e('0x1c')]===_0xd37e('0x1b');var _0x5b51f2=_0x36ed2b[_0xd37e('0x1d')];var _0x491b35=_0x24bf1f?0x0:_0x16c119[_0xd37e('0x1a')];var _0x1c045e=_0x24bf1f?_0x36ed2b['count']:_0x16c119[_0xd37e('0x1a')]+_0x16c119[_0xd37e('0x1c')];var _0x47ba06;if(_0x1c045e>=_0x5b51f2){_0x1c045e=_0x5b51f2;_0x47ba06=0xc8;}else{_0x47ba06=0xce;}_0x35bca0[_0xd37e('0x17')](_0x47ba06);return _0x35bca0[_0xd37e('0x1e')]('Content-Range',_0x491b35+'-'+_0x1c045e+'/'+_0x5b51f2)[_0xd37e('0x19')](_0x36ed2b);}return null;};}function patchUpdates(_0x2fb4ac){return function(_0x6abefa){try{jsonpatch[_0xd37e('0x1f')](_0x6abefa,_0x2fb4ac,!![]);}catch(_0x74c67c){return BPromise[_0xd37e('0x20')](_0x74c67c);}return _0x6abefa['save']();};}function saveUpdates(_0x5d8f95,_0x346592){return function(_0x3119fb){if(_0x3119fb){return _0x3119fb[_0xd37e('0x21')](_0x5d8f95)[_0xd37e('0x22')](function(_0x7eed9a){return _0x7eed9a;});}return null;};}function removeEntity(_0x8c2520,_0x4e67f5){return function(_0x4edddc){if(_0x4edddc){return _0x4edddc[_0xd37e('0x23')]()[_0xd37e('0x22')](function(){_0x8c2520[_0xd37e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa5c535,_0x2c2dc9){return function(_0x9ec563){if(!_0x9ec563){_0xa5c535['sendStatus'](0x194);}return _0x9ec563;};}function handleError(_0x2bce0a,_0x444011){_0x444011=_0x444011||0x1f4;return function(_0x536bed){logger[_0xd37e('0x24')](_0x536bed['stack']);if(_0x536bed['name']){delete _0x536bed[_0xd37e('0x25')];}_0x2bce0a[_0xd37e('0x17')](_0x444011)[_0xd37e('0x26')](_0x536bed);};}exports[_0xd37e('0x27')]=function(_0x17e8e4,_0x582562){var _0x22c865={},_0xe1d02a={},_0x458480={'count':0x0,'rows':[]};var _0x4a9649=_[_0xd37e('0x28')](db[_0xd37e('0x29')][_0xd37e('0x2a')],function(_0x446909){return{'name':_0x446909['fieldName'],'type':_0x446909[_0xd37e('0x2b')][_0xd37e('0x2c')]};});_0xe1d02a[_0xd37e('0x2d')]=_[_0xd37e('0x28')](_0x4a9649,_0xd37e('0x25'));_0xe1d02a['query']=_[_0xd37e('0x2e')](_0x17e8e4['query']);_0xe1d02a[_0xd37e('0x2f')]=_[_0xd37e('0x30')](_0xe1d02a[_0xd37e('0x2d')],_0xe1d02a['query']);_0x22c865[_0xd37e('0x31')]=_['intersection'](_0xe1d02a['model'],qs['fields'](_0x17e8e4[_0xd37e('0x32')][_0xd37e('0x33')]));_0x22c865['attributes']=_0x22c865[_0xd37e('0x31')]['length']?_0x22c865[_0xd37e('0x31')]:_0xe1d02a[_0xd37e('0x2d')];if(!_0x17e8e4[_0xd37e('0x32')][_0xd37e('0x34')]('nolimit')){_0x22c865['limit']=qs[_0xd37e('0x1c')](_0x17e8e4[_0xd37e('0x32')][_0xd37e('0x1c')]);_0x22c865[_0xd37e('0x1a')]=qs[_0xd37e('0x1a')](_0x17e8e4[_0xd37e('0x32')][_0xd37e('0x1a')]);}_0x22c865[_0xd37e('0x35')]=qs[_0xd37e('0x36')](_0x17e8e4[_0xd37e('0x32')][_0xd37e('0x36')]);_0x22c865[_0xd37e('0x37')]=qs[_0xd37e('0x2f')](_[_0xd37e('0x38')](_0x17e8e4[_0xd37e('0x32')],_0xe1d02a[_0xd37e('0x2f')]),_0x4a9649);if(_0x17e8e4[_0xd37e('0x32')][_0xd37e('0x39')]){_0x22c865[_0xd37e('0x37')]=_[_0xd37e('0x3a')](_0x22c865[_0xd37e('0x37')],{'$or':_[_0xd37e('0x28')](_0x4a9649,function(_0x432393){if(_0x432393[_0xd37e('0x2b')]!==_0xd37e('0x3b')){var _0x559882={};_0x559882[_0x432393[_0xd37e('0x25')]]={'$like':'%'+_0x17e8e4[_0xd37e('0x32')][_0xd37e('0x39')]+'%'};return _0x559882;}})});}_0x22c865=_[_0xd37e('0x3a')]({},_0x22c865,_0x17e8e4[_0xd37e('0x3c')]);var _0x2ee033={'where':_0x22c865[_0xd37e('0x37')]};return db['ZohoField']['count'](_0x2ee033)[_0xd37e('0x22')](function(_0x10b9ac){_0x458480['count']=_0x10b9ac;if(_0x17e8e4[_0xd37e('0x32')][_0xd37e('0x3d')]){_0x22c865[_0xd37e('0x3e')]=[{'all':!![]}];}return db[_0xd37e('0x29')][_0xd37e('0x3f')](_0x22c865);})[_0xd37e('0x22')](function(_0x935ab7){_0x458480[_0xd37e('0x40')]=_0x935ab7;return _0x458480;})['then'](respondWithFilteredResult(_0x582562,_0x22c865))[_0xd37e('0x41')](handleError(_0x582562,null));};exports[_0xd37e('0x42')]=function(_0x1d3076,_0x2a58be){var _0x3e0489={'raw':!![],'where':{'id':_0x1d3076[_0xd37e('0x43')]['id']}},_0x303eb5={};_0x303eb5[_0xd37e('0x2d')]=_[_0xd37e('0x2e')](db[_0xd37e('0x29')][_0xd37e('0x2a')]);_0x303eb5[_0xd37e('0x32')]=_[_0xd37e('0x2e')](_0x1d3076[_0xd37e('0x32')]);_0x303eb5['filters']=_['intersection'](_0x303eb5[_0xd37e('0x2d')],_0x303eb5[_0xd37e('0x32')]);_0x3e0489[_0xd37e('0x31')]=_['intersection'](_0x303eb5[_0xd37e('0x2d')],qs[_0xd37e('0x33')](_0x1d3076[_0xd37e('0x32')][_0xd37e('0x33')]));_0x3e0489['attributes']=_0x3e0489[_0xd37e('0x31')][_0xd37e('0x44')]?_0x3e0489['attributes']:_0x303eb5[_0xd37e('0x2d')];if(_0x1d3076['query'][_0xd37e('0x3d')]){_0x3e0489[_0xd37e('0x3e')]=[{'all':!![]}];}_0x3e0489=_['merge']({},_0x3e0489,_0x1d3076[_0xd37e('0x3c')]);return db[_0xd37e('0x29')][_0xd37e('0x45')](_0x3e0489)['then'](handleEntityNotFound(_0x2a58be,null))[_0xd37e('0x22')](respondWithResult(_0x2a58be,null))[_0xd37e('0x41')](handleError(_0x2a58be,null));};exports[_0xd37e('0x46')]=function(_0x3a7852,_0x2896cf){return db[_0xd37e('0x29')][_0xd37e('0x46')](_0x3a7852[_0xd37e('0x47')],{})[_0xd37e('0x22')](respondWithResult(_0x2896cf,0xc9))['catch'](handleError(_0x2896cf,null));};exports['update']=function(_0x18b55f,_0x1a806b){if(_0x18b55f[_0xd37e('0x47')]['id']){delete _0x18b55f[_0xd37e('0x47')]['id'];}return db[_0xd37e('0x29')][_0xd37e('0x45')]({'where':{'id':_0x18b55f[_0xd37e('0x43')]['id']}})[_0xd37e('0x22')](handleEntityNotFound(_0x1a806b,null))[_0xd37e('0x22')](saveUpdates(_0x18b55f[_0xd37e('0x47')],null))[_0xd37e('0x22')](respondWithResult(_0x1a806b,null))[_0xd37e('0x41')](handleError(_0x1a806b,null));};exports[_0xd37e('0x23')]=function(_0x54a719,_0x1d1905){return db[_0xd37e('0x29')]['find']({'where':{'id':_0x54a719[_0xd37e('0x43')]['id']}})['then'](handleEntityNotFound(_0x1d1905,null))[_0xd37e('0x22')](removeEntity(_0x1d1905,null))[_0xd37e('0x41')](handleError(_0x1d1905,null));}; \ No newline at end of file +var _0x0607=['save','then','destroy','error','stack','name','send','index','map','ZohoField','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','eml-format','rimraf','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject'];(function(_0x14cb52,_0x205216){var _0xa872ad=function(_0x384a51){while(--_0x384a51){_0x14cb52['push'](_0x14cb52['shift']());}};_0xa872ad(++_0x205216);}(_0x0607,0x147));var _0x7060=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x0607[_0x1d1779];return _0x2377e9;};'use strict';var emlformat=require(_0x7060('0x0'));var rimraf=require(_0x7060('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7060('0x2'));var BPromise=require(_0x7060('0x3'));var Mustache=require(_0x7060('0x4'));var util=require(_0x7060('0x5'));var path=require('path');var sox=require(_0x7060('0x6'));var csv=require(_0x7060('0x7'));var ejs=require(_0x7060('0x8'));var fs=require('fs');var fs_extra=require(_0x7060('0x9'));var _=require(_0x7060('0xa'));var squel=require(_0x7060('0xb'));var crypto=require(_0x7060('0xc'));var jsforce=require(_0x7060('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7060('0xe'));var Papa=require(_0x7060('0xf'));var Redis=require('ioredis');var authService=require(_0x7060('0x10'));var qs=require(_0x7060('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7060('0x12'));var logger=require(_0x7060('0x13'))(_0x7060('0x14'));var utils=require(_0x7060('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7060('0x16'))['db'];function respondWithStatusCode(_0x4048f4,_0x1461ee){_0x1461ee=_0x1461ee||0xcc;return function(_0x5133df){if(_0x5133df){return _0x4048f4[_0x7060('0x17')](_0x1461ee);}return _0x4048f4[_0x7060('0x18')](_0x1461ee)['end']();};}function respondWithResult(_0x43b1b3,_0x406954){_0x406954=_0x406954||0xc8;return function(_0x5e9601){if(_0x5e9601){return _0x43b1b3['status'](_0x406954)[_0x7060('0x19')](_0x5e9601);}};}function respondWithFilteredResult(_0x18f653,_0x619e88){return function(_0x4d76fb){if(_0x4d76fb){var _0x276a81=typeof _0x619e88[_0x7060('0x1a')]===_0x7060('0x1b')&&typeof _0x619e88[_0x7060('0x1c')]===_0x7060('0x1b');var _0x208c99=_0x4d76fb[_0x7060('0x1d')];var _0x1d0bc8=_0x276a81?0x0:_0x619e88['offset'];var _0x4ecd4b=_0x276a81?_0x4d76fb['count']:_0x619e88[_0x7060('0x1a')]+_0x619e88[_0x7060('0x1c')];var _0x1c09dd;if(_0x4ecd4b>=_0x208c99){_0x4ecd4b=_0x208c99;_0x1c09dd=0xc8;}else{_0x1c09dd=0xce;}_0x18f653[_0x7060('0x18')](_0x1c09dd);return _0x18f653[_0x7060('0x1e')](_0x7060('0x1f'),_0x1d0bc8+'-'+_0x4ecd4b+'/'+_0x208c99)[_0x7060('0x19')](_0x4d76fb);}return null;};}function patchUpdates(_0x2da967){return function(_0x239ab7){try{jsonpatch['apply'](_0x239ab7,_0x2da967,!![]);}catch(_0x2e9599){return BPromise[_0x7060('0x20')](_0x2e9599);}return _0x239ab7[_0x7060('0x21')]();};}function saveUpdates(_0x8742a4,_0x139a12){return function(_0x1b83ca){if(_0x1b83ca){return _0x1b83ca['update'](_0x8742a4)[_0x7060('0x22')](function(_0x2245f4){return _0x2245f4;});}return null;};}function removeEntity(_0x4a6cf1,_0x52afae){return function(_0x1637c5){if(_0x1637c5){return _0x1637c5[_0x7060('0x23')]()[_0x7060('0x22')](function(){_0x4a6cf1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x49ec16,_0x3a7ef4){return function(_0x583b50){if(!_0x583b50){_0x49ec16[_0x7060('0x17')](0x194);}return _0x583b50;};}function handleError(_0x7b9213,_0x5d112e){_0x5d112e=_0x5d112e||0x1f4;return function(_0x4f58fe){logger[_0x7060('0x24')](_0x4f58fe[_0x7060('0x25')]);if(_0x4f58fe[_0x7060('0x26')]){delete _0x4f58fe[_0x7060('0x26')];}_0x7b9213[_0x7060('0x18')](_0x5d112e)[_0x7060('0x27')](_0x4f58fe);};}exports[_0x7060('0x28')]=function(_0xa228af,_0x39b798){var _0x2c196e={},_0x3f962f={},_0x28f142={'count':0x0,'rows':[]};var _0x219046=_[_0x7060('0x29')](db[_0x7060('0x2a')]['rawAttributes'],function(_0x2a43f5){return{'name':_0x2a43f5[_0x7060('0x2b')],'type':_0x2a43f5[_0x7060('0x2c')]['key']};});_0x3f962f[_0x7060('0x2d')]=_['map'](_0x219046,'name');_0x3f962f[_0x7060('0x2e')]=_[_0x7060('0x2f')](_0xa228af['query']);_0x3f962f['filters']=_[_0x7060('0x30')](_0x3f962f[_0x7060('0x2d')],_0x3f962f[_0x7060('0x2e')]);_0x2c196e['attributes']=_['intersection'](_0x3f962f[_0x7060('0x2d')],qs[_0x7060('0x31')](_0xa228af['query']['fields']));_0x2c196e['attributes']=_0x2c196e[_0x7060('0x32')][_0x7060('0x33')]?_0x2c196e[_0x7060('0x32')]:_0x3f962f[_0x7060('0x2d')];if(!_0xa228af[_0x7060('0x2e')][_0x7060('0x34')]('nolimit')){_0x2c196e['limit']=qs[_0x7060('0x1c')](_0xa228af['query'][_0x7060('0x1c')]);_0x2c196e['offset']=qs[_0x7060('0x1a')](_0xa228af[_0x7060('0x2e')][_0x7060('0x1a')]);}_0x2c196e[_0x7060('0x35')]=qs['sort'](_0xa228af[_0x7060('0x2e')][_0x7060('0x36')]);_0x2c196e[_0x7060('0x37')]=qs[_0x7060('0x38')](_[_0x7060('0x39')](_0xa228af['query'],_0x3f962f[_0x7060('0x38')]),_0x219046);if(_0xa228af[_0x7060('0x2e')][_0x7060('0x3a')]){_0x2c196e[_0x7060('0x37')]=_[_0x7060('0x3b')](_0x2c196e['where'],{'$or':_[_0x7060('0x29')](_0x219046,function(_0x51d3ae){if(_0x51d3ae[_0x7060('0x2c')]!=='VIRTUAL'){var _0x448b02={};_0x448b02[_0x51d3ae['name']]={'$like':'%'+_0xa228af['query'][_0x7060('0x3a')]+'%'};return _0x448b02;}})});}_0x2c196e=_[_0x7060('0x3b')]({},_0x2c196e,_0xa228af[_0x7060('0x3c')]);var _0x3f7a34={'where':_0x2c196e[_0x7060('0x37')]};return db[_0x7060('0x2a')][_0x7060('0x1d')](_0x3f7a34)[_0x7060('0x22')](function(_0x55e93e){_0x28f142[_0x7060('0x1d')]=_0x55e93e;if(_0xa228af[_0x7060('0x2e')][_0x7060('0x3d')]){_0x2c196e[_0x7060('0x3e')]=[{'all':!![]}];}return db[_0x7060('0x2a')][_0x7060('0x3f')](_0x2c196e);})[_0x7060('0x22')](function(_0x408206){_0x28f142[_0x7060('0x40')]=_0x408206;return _0x28f142;})[_0x7060('0x22')](respondWithFilteredResult(_0x39b798,_0x2c196e))[_0x7060('0x41')](handleError(_0x39b798,null));};exports[_0x7060('0x42')]=function(_0x5b8dcd,_0x2b21bc){var _0x307c1d={'raw':!![],'where':{'id':_0x5b8dcd[_0x7060('0x43')]['id']}},_0x4f20eb={};_0x4f20eb[_0x7060('0x2d')]=_[_0x7060('0x2f')](db[_0x7060('0x2a')]['rawAttributes']);_0x4f20eb[_0x7060('0x2e')]=_[_0x7060('0x2f')](_0x5b8dcd[_0x7060('0x2e')]);_0x4f20eb[_0x7060('0x38')]=_['intersection'](_0x4f20eb[_0x7060('0x2d')],_0x4f20eb['query']);_0x307c1d[_0x7060('0x32')]=_[_0x7060('0x30')](_0x4f20eb['model'],qs[_0x7060('0x31')](_0x5b8dcd[_0x7060('0x2e')][_0x7060('0x31')]));_0x307c1d[_0x7060('0x32')]=_0x307c1d['attributes']['length']?_0x307c1d[_0x7060('0x32')]:_0x4f20eb[_0x7060('0x2d')];if(_0x5b8dcd[_0x7060('0x2e')][_0x7060('0x3d')]){_0x307c1d['include']=[{'all':!![]}];}_0x307c1d=_[_0x7060('0x3b')]({},_0x307c1d,_0x5b8dcd['options']);return db[_0x7060('0x2a')][_0x7060('0x44')](_0x307c1d)[_0x7060('0x22')](handleEntityNotFound(_0x2b21bc,null))[_0x7060('0x22')](respondWithResult(_0x2b21bc,null))[_0x7060('0x41')](handleError(_0x2b21bc,null));};exports[_0x7060('0x45')]=function(_0x36792d,_0x39fd74){return db[_0x7060('0x2a')][_0x7060('0x45')](_0x36792d[_0x7060('0x46')],{})['then'](respondWithResult(_0x39fd74,0xc9))[_0x7060('0x41')](handleError(_0x39fd74,null));};exports[_0x7060('0x47')]=function(_0x38ca0a,_0x5b644c){if(_0x38ca0a[_0x7060('0x46')]['id']){delete _0x38ca0a[_0x7060('0x46')]['id'];}return db[_0x7060('0x2a')]['find']({'where':{'id':_0x38ca0a[_0x7060('0x43')]['id']}})[_0x7060('0x22')](handleEntityNotFound(_0x5b644c,null))[_0x7060('0x22')](saveUpdates(_0x38ca0a[_0x7060('0x46')],null))[_0x7060('0x22')](respondWithResult(_0x5b644c,null))[_0x7060('0x41')](handleError(_0x5b644c,null));};exports[_0x7060('0x23')]=function(_0x3ff6d3,_0x204b47){return db[_0x7060('0x2a')][_0x7060('0x44')]({'where':{'id':_0x3ff6d3[_0x7060('0x43')]['id']}})[_0x7060('0x22')](handleEntityNotFound(_0x204b47,null))[_0x7060('0x22')](removeEntity(_0x204b47,null))[_0x7060('0x41')](handleError(_0x204b47,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index efd120e..8d14877 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 _0x5c3c=['path','rimraf','../../config/environment','./intZohoField.attributes','exports','zoho_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4b8ed2,_0x569d2e){var _0x111c66=function(_0x231f22){while(--_0x231f22){_0x4b8ed2['push'](_0x4b8ed2['shift']());}};_0x111c66(++_0x569d2e);}(_0x5c3c,0x132));var _0xc5c3=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x5c3c[_0x1c8c28];return _0x1f59b4;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var logger=require(_0xc5c3('0x2'))(_0xc5c3('0x3'));var moment=require('moment');var BPromise=require(_0xc5c3('0x4'));var rp=require(_0xc5c3('0x5'));var fs=require('fs');var path=require(_0xc5c3('0x6'));var rimraf=require(_0xc5c3('0x7'));var config=require(_0xc5c3('0x8'));var attributes=require(_0xc5c3('0x9'));module[_0xc5c3('0xa')]=function(_0x23a6b5,_0x28bdd9){return _0x23a6b5['define']('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xc5c3('0xb'),'fields':[_0xc5c3('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xacf4=['bluebird','request-promise','path','rimraf','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','../../config/logger','api','moment'];(function(_0xd3c934,_0x5b55b9){var _0x32e8aa=function(_0x40eb54){while(--_0x40eb54){_0xd3c934['push'](_0xd3c934['shift']());}};_0x32e8aa(++_0x5b55b9);}(_0xacf4,0xe7));var _0x4acf=function(_0x36f997,_0x203dac){_0x36f997=_0x36f997-0x0;var _0x52899b=_0xacf4[_0x36f997];return _0x52899b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4acf('0x0'))(_0x4acf('0x1'));var moment=require(_0x4acf('0x2'));var BPromise=require(_0x4acf('0x3'));var rp=require(_0x4acf('0x4'));var fs=require('fs');var path=require(_0x4acf('0x5'));var rimraf=require(_0x4acf('0x6'));var config=require('../../config/environment');var attributes=require(_0x4acf('0x7'));module[_0x4acf('0x8')]=function(_0x4e0c43,_0x24bf24){return _0x4e0c43[_0x4acf('0x9')](_0x4acf('0xa'),attributes,{'tableName':_0x4acf('0xb'),'paranoid':![],'indexes':[{'name':_0x4acf('0xc'),'fields':['idField','FieldId'],'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 305d5ec..0a9f41e 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 _0x1dcc=['catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x341315,_0x2e8092){var _0x40b1da=function(_0x5a1732){while(--_0x5a1732){_0x341315['push'](_0x341315['shift']());}};_0x40b1da(++_0x2e8092);}(_0x1dcc,0x65));var _0xc1dc=function(_0x38eef4,_0x3c2e9d){_0x38eef4=_0x38eef4-0x0;var _0x33c6bd=_0x1dcc[_0x38eef4];return _0x33c6bd;};'use strict';var _=require('lodash');var util=require(_0xc1dc('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc1dc('0x1'));var fs=require('fs');var Redis=require(_0xc1dc('0x2'));var db=require(_0xc1dc('0x3'))['db'];var utils=require(_0xc1dc('0x4'));var logger=require(_0xc1dc('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc1dc('0x6'));var client=jayson[_0xc1dc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x377bf0,_0x1f4851,_0x18c572){return new BPromise(function(_0xf1f344,_0xbdd383){return client[_0xc1dc('0x8')](_0x377bf0,_0x18c572)[_0xc1dc('0x9')](function(_0x4f7ca1){logger[_0xc1dc('0xa')](_0xc1dc('0xb'),_0x1f4851,_0xc1dc('0xc'));logger[_0xc1dc('0xd')](_0xc1dc('0xe'),_0x1f4851,_0xc1dc('0xc'),JSON[_0xc1dc('0xf')](_0x4f7ca1));if(_0x4f7ca1[_0xc1dc('0x10')]){if(_0x4f7ca1['error'][_0xc1dc('0x11')]===0x1f4){logger[_0xc1dc('0x10')]('ZohoField,\x20%s,\x20%s',_0x1f4851,_0x4f7ca1['error'][_0xc1dc('0x12')]);return _0xbdd383(_0x4f7ca1[_0xc1dc('0x10')][_0xc1dc('0x12')]);}logger[_0xc1dc('0x10')](_0xc1dc('0xb'),_0x1f4851,_0x4f7ca1['error'][_0xc1dc('0x12')]);return _0xf1f344(_0x4f7ca1['error']['message']);}else{logger[_0xc1dc('0xa')]('ZohoField,\x20%s,\x20%s',_0x1f4851,_0xc1dc('0xc'));_0xf1f344(_0x4f7ca1['result'][_0xc1dc('0x12')]);}})[_0xc1dc('0x13')](function(_0x4c8843){logger[_0xc1dc('0x10')](_0xc1dc('0xb'),_0x1f4851,_0x4c8843);_0xbdd383(_0x4c8843);});});} \ No newline at end of file +var _0x6b53=['result','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0xadbd16,_0x4c6fae){var _0x209d15=function(_0x5c6c3d){while(--_0x5c6c3d){_0xadbd16['push'](_0xadbd16['shift']());}};_0x209d15(++_0x4c6fae);}(_0x6b53,0xd2));var _0x36b5=function(_0x2a8fef,_0x3653d2){_0x2a8fef=_0x2a8fef-0x0;var _0x20eedc=_0x6b53[_0x2a8fef];return _0x20eedc;};'use strict';var _=require('lodash');var util=require(_0x36b5('0x0'));var moment=require('moment');var BPromise=require(_0x36b5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x36b5('0x2'));var db=require(_0x36b5('0x3'))['db'];var utils=require(_0x36b5('0x4'));var logger=require(_0x36b5('0x5'))(_0x36b5('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x36b5('0x7')][_0x36b5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a0870,_0x2dd00d,_0x3cf335){return new BPromise(function(_0x5418ee,_0x2d40cc){return client[_0x36b5('0x9')](_0x3a0870,_0x3cf335)['then'](function(_0x46b068){logger[_0x36b5('0xa')](_0x36b5('0xb'),_0x2dd00d,_0x36b5('0xc'));logger[_0x36b5('0xd')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x2dd00d,_0x36b5('0xc'),JSON[_0x36b5('0xe')](_0x46b068));if(_0x46b068[_0x36b5('0xf')]){if(_0x46b068[_0x36b5('0xf')][_0x36b5('0x10')]===0x1f4){logger['error'](_0x36b5('0xb'),_0x2dd00d,_0x46b068[_0x36b5('0xf')][_0x36b5('0x11')]);return _0x2d40cc(_0x46b068['error'][_0x36b5('0x11')]);}logger['error']('ZohoField,\x20%s,\x20%s',_0x2dd00d,_0x46b068['error'][_0x36b5('0x11')]);return _0x5418ee(_0x46b068[_0x36b5('0xf')][_0x36b5('0x11')]);}else{logger[_0x36b5('0xa')]('ZohoField,\x20%s,\x20%s',_0x2dd00d,_0x36b5('0xc'));_0x5418ee(_0x46b068[_0x36b5('0x12')][_0x36b5('0x11')]);}})['catch'](function(_0x7ae607){logger['error'](_0x36b5('0xb'),_0x2dd00d,_0x7ae607);_0x2d40cc(_0x7ae607);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 9c08260..b9e1514 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x26f3fa,_0x32b176){var _0x275a2d=function(_0x987ac2){while(--_0x987ac2){_0x26f3fa['push'](_0x26f3fa['shift']());}};_0x275a2d(++_0x32b176);}(_0xe706,0xa3));var _0x6e70=function(_0x450d4e,_0xcacc3){_0x450d4e=_0x450d4e-0x0;var _0x300304=_0xe706[_0x450d4e];return _0x300304;};'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(_0x2ff8ee,_0x4e896d){var _0x295405=function(_0x360740){while(--_0x360740){_0x2ff8ee['push'](_0x2ff8ee['shift']());}};_0x295405(++_0x4e896d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xcb91[_0x125ff8];return _0x2d9ef;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 85242c8..a2d0c01 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 _0xe5c7=['sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state'];(function(_0x457fce,_0x21e124){var _0x7179a7=function(_0x452bce){while(--_0x452bce){_0x457fce['push'](_0x457fce['shift']());}};_0x7179a7(++_0x21e124);}(_0xe5c7,0x1d8));var _0x7e5c=function(_0x544639,_0x2b3e6a){_0x544639=_0x544639-0x0;var _0xfd54d5=_0xe5c7[_0x544639];return _0xfd54d5;};'use strict';var Sequelize=require(_0x7e5c('0x0'));module[_0x7e5c('0x1')]={'name':{'type':Sequelize[_0x7e5c('0x2')],'allowNull':![],'unique':_0x7e5c('0x3')},'version':{'type':Sequelize[_0x7e5c('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x7e5c('0x2')],'defaultValue':_0x7e5c('0x4')},'filename':{'type':Sequelize[_0x7e5c('0x2')]},'path':{'type':Sequelize[_0x7e5c('0x2')]},'type':{'type':Sequelize[_0x7e5c('0x2')]},'size':{'type':Sequelize[_0x7e5c('0x5')]},'active':{'type':Sequelize[_0x7e5c('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x7e5c('0x2')]},'logo':{'type':Sequelize[_0x7e5c('0x2')]},'state':{'type':Sequelize[_0x7e5c('0x2')],'unique':_0x7e5c('0x7')},'description':{'type':Sequelize[_0x7e5c('0x2')]},'title':{'type':Sequelize[_0x7e5c('0x2')]},'remoteUri':{'type':Sequelize[_0x7e5c('0x2')]},'link':{'type':Sequelize[_0x7e5c('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xc9c3=['unique_name_and_version','app.js','INTEGER','BOOLEAN','exports','STRING'];(function(_0x2af095,_0x3ff148){var _0x395240=function(_0x2b1f18){while(--_0x2b1f18){_0x2af095['push'](_0x2af095['shift']());}};_0x395240(++_0x3ff148);}(_0xc9c3,0xd0));var _0x3c9c=function(_0x22ee5f,_0x161fec){_0x22ee5f=_0x22ee5f-0x0;var _0xbedf7d=_0xc9c3[_0x22ee5f];return _0xbedf7d;};'use strict';var Sequelize=require('sequelize');module[_0x3c9c('0x0')]={'name':{'type':Sequelize[_0x3c9c('0x1')],'allowNull':![],'unique':_0x3c9c('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x3c9c('0x1')],'defaultValue':_0x3c9c('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x3c9c('0x1')]},'type':{'type':Sequelize[_0x3c9c('0x1')]},'size':{'type':Sequelize[_0x3c9c('0x4')]},'active':{'type':Sequelize[_0x3c9c('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x3c9c('0x1')]},'logo':{'type':Sequelize[_0x3c9c('0x1')]},'state':{'type':Sequelize[_0x3c9c('0x1')],'unique':'state'},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x3c9c('0x1')]},'remoteUri':{'type':Sequelize[_0x3c9c('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 4e0f34d..3d32f87 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 _0x4991=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','filter','options','Integration','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','map','rawAttributes','fieldName','key','model','query','filters'];(function(_0x2234bd,_0x259d9d){var _0x2aa4bd=function(_0x418403){while(--_0x418403){_0x2234bd['push'](_0x2234bd['shift']());}};_0x2aa4bd(++_0x259d9d);}(_0x4991,0xf7));var _0x1499=function(_0x376993,_0x35c3bf){_0x376993=_0x376993-0x0;var _0x3e4a31=_0x4991[_0x376993];return _0x3e4a31;};'use strict';var emlformat=require(_0x1499('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1499('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1499('0x2'));var moment=require(_0x1499('0x3'));var BPromise=require(_0x1499('0x4'));var Mustache=require(_0x1499('0x5'));var util=require(_0x1499('0x6'));var path=require(_0x1499('0x7'));var sox=require(_0x1499('0x8'));var csv=require(_0x1499('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1499('0xa'));var _=require(_0x1499('0xb'));var squel=require(_0x1499('0xc'));var crypto=require(_0x1499('0xd'));var jsforce=require(_0x1499('0xe'));var deskjs=require(_0x1499('0xf'));var toCsv=require(_0x1499('0x9'));var querystring=require(_0x1499('0x10'));var Papa=require('papaparse');var Redis=require(_0x1499('0x11'));var authService=require(_0x1499('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1499('0x13'));var hardwareService=require(_0x1499('0x14'));var logger=require('../../config/logger')(_0x1499('0x15'));var utils=require(_0x1499('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3039ce,_0x274bc1){_0x274bc1=_0x274bc1||0xcc;return function(_0x34a928){if(_0x34a928){return _0x3039ce[_0x1499('0x17')](_0x274bc1);}return _0x3039ce[_0x1499('0x18')](_0x274bc1)['end']();};}function respondWithResult(_0x5f34f2,_0x308177){_0x308177=_0x308177||0xc8;return function(_0x4e5195){if(_0x4e5195){return _0x5f34f2[_0x1499('0x18')](_0x308177)[_0x1499('0x19')](_0x4e5195);}};}function respondWithFilteredResult(_0x308318,_0x3ab605){return function(_0x48f654){if(_0x48f654){var _0x1ed43b=typeof _0x3ab605[_0x1499('0x1a')]==='undefined'&&typeof _0x3ab605[_0x1499('0x1b')]===_0x1499('0x1c');var _0x46b364=_0x48f654[_0x1499('0x1d')];var _0x1e45a9=_0x1ed43b?0x0:_0x3ab605[_0x1499('0x1a')];var _0x5b9859=_0x1ed43b?_0x48f654['count']:_0x3ab605['offset']+_0x3ab605[_0x1499('0x1b')];var _0xad534b;if(_0x5b9859>=_0x46b364){_0x5b9859=_0x46b364;_0xad534b=0xc8;}else{_0xad534b=0xce;}_0x308318['status'](_0xad534b);return _0x308318[_0x1499('0x1e')](_0x1499('0x1f'),_0x1e45a9+'-'+_0x5b9859+'/'+_0x46b364)[_0x1499('0x19')](_0x48f654);}return null;};}function patchUpdates(_0x18e4a6){return function(_0x21e887){try{jsonpatch[_0x1499('0x20')](_0x21e887,_0x18e4a6,!![]);}catch(_0x2b0458){return BPromise[_0x1499('0x21')](_0x2b0458);}return _0x21e887[_0x1499('0x22')]();};}function saveUpdates(_0x15bcd4,_0x2bb71f){return function(_0x836081){if(_0x836081){return _0x836081[_0x1499('0x23')](_0x15bcd4)[_0x1499('0x24')](function(_0x4ec57a){return _0x4ec57a;});}return null;};}function removeEntity(_0x1e2c51,_0x2c7f57){return function(_0x5615b4){if(_0x5615b4){return _0x5615b4[_0x1499('0x25')]()[_0x1499('0x24')](function(){_0x1e2c51[_0x1499('0x18')](0xcc)[_0x1499('0x26')]();});}};}function handleEntityNotFound(_0x3968e0,_0x16d036){return function(_0x54f3c2){if(!_0x54f3c2){_0x3968e0['sendStatus'](0x194);}return _0x54f3c2;};}function handleError(_0x12739b,_0x3c9aca){_0x3c9aca=_0x3c9aca||0x1f4;return function(_0x3b9259){logger[_0x1499('0x27')](_0x3b9259[_0x1499('0x28')]);if(_0x3b9259['name']){delete _0x3b9259[_0x1499('0x29')];}_0x12739b['status'](_0x3c9aca)['send'](_0x3b9259);};}exports['index']=function(_0x21d204,_0x103efa){var _0x40932a={},_0x1b460b={},_0x3dad86={'count':0x0,'rows':[]};var _0x388513=_[_0x1499('0x2a')](db['Integration'][_0x1499('0x2b')],function(_0x1a2c99){return{'name':_0x1a2c99[_0x1499('0x2c')],'type':_0x1a2c99['type'][_0x1499('0x2d')]};});_0x1b460b[_0x1499('0x2e')]=_['map'](_0x388513,_0x1499('0x29'));_0x1b460b[_0x1499('0x2f')]=_['keys'](_0x21d204[_0x1499('0x2f')]);_0x1b460b[_0x1499('0x30')]=_[_0x1499('0x31')](_0x1b460b[_0x1499('0x2e')],_0x1b460b[_0x1499('0x2f')]);_0x40932a[_0x1499('0x32')]=_[_0x1499('0x31')](_0x1b460b[_0x1499('0x2e')],qs[_0x1499('0x33')](_0x21d204[_0x1499('0x2f')][_0x1499('0x33')]));_0x40932a[_0x1499('0x32')]=_0x40932a[_0x1499('0x32')][_0x1499('0x34')]?_0x40932a[_0x1499('0x32')]:_0x1b460b[_0x1499('0x2e')];if(!_0x21d204[_0x1499('0x2f')][_0x1499('0x35')](_0x1499('0x36'))){_0x40932a[_0x1499('0x1b')]=qs['limit'](_0x21d204[_0x1499('0x2f')][_0x1499('0x1b')]);_0x40932a[_0x1499('0x1a')]=qs[_0x1499('0x1a')](_0x21d204[_0x1499('0x2f')][_0x1499('0x1a')]);}_0x40932a[_0x1499('0x37')]=qs[_0x1499('0x38')](_0x21d204[_0x1499('0x2f')][_0x1499('0x38')]);_0x40932a[_0x1499('0x39')]=qs['filters'](_['pick'](_0x21d204[_0x1499('0x2f')],_0x1b460b['filters']),_0x388513);if(_0x21d204[_0x1499('0x2f')]['filter']){_0x40932a[_0x1499('0x39')]=_[_0x1499('0x3a')](_0x40932a[_0x1499('0x39')],{'$or':_[_0x1499('0x2a')](_0x388513,function(_0x531933){if(_0x531933[_0x1499('0x3b')]!=='VIRTUAL'){var _0x2f9c59={};_0x2f9c59[_0x531933[_0x1499('0x29')]]={'$like':'%'+_0x21d204[_0x1499('0x2f')][_0x1499('0x3c')]+'%'};return _0x2f9c59;}})});}_0x40932a=_['merge']({},_0x40932a,_0x21d204[_0x1499('0x3d')]);var _0x815a99={'where':_0x40932a[_0x1499('0x39')]};return db[_0x1499('0x3e')]['count'](_0x815a99)[_0x1499('0x24')](function(_0x4cc411){_0x3dad86[_0x1499('0x1d')]=_0x4cc411;if(_0x21d204[_0x1499('0x2f')][_0x1499('0x3f')]){_0x40932a[_0x1499('0x40')]=[{'all':!![]}];}return db[_0x1499('0x3e')][_0x1499('0x41')](_0x40932a);})[_0x1499('0x24')](function(_0xcb85eb){_0x3dad86[_0x1499('0x42')]=_0xcb85eb;return _0x3dad86;})[_0x1499('0x24')](respondWithFilteredResult(_0x103efa,_0x40932a))['catch'](handleError(_0x103efa,null));};exports[_0x1499('0x43')]=function(_0x5dd36c,_0x2cfdaf){var _0x1af1a1={'raw':![],'where':{'id':_0x5dd36c[_0x1499('0x44')]['id']}},_0x5646cf={};_0x5646cf[_0x1499('0x2e')]=_[_0x1499('0x45')](db[_0x1499('0x3e')][_0x1499('0x2b')]);_0x5646cf['query']=_['keys'](_0x5dd36c[_0x1499('0x2f')]);_0x5646cf[_0x1499('0x30')]=_['intersection'](_0x5646cf[_0x1499('0x2e')],_0x5646cf[_0x1499('0x2f')]);_0x1af1a1['attributes']=_['intersection'](_0x5646cf[_0x1499('0x2e')],qs[_0x1499('0x33')](_0x5dd36c[_0x1499('0x2f')]['fields']));_0x1af1a1[_0x1499('0x32')]=_0x1af1a1[_0x1499('0x32')][_0x1499('0x34')]?_0x1af1a1[_0x1499('0x32')]:_0x5646cf['model'];if(_0x5dd36c[_0x1499('0x2f')][_0x1499('0x3f')]){_0x1af1a1[_0x1499('0x40')]=[{'all':!![]}];}_0x1af1a1=_[_0x1499('0x3a')]({},_0x1af1a1,_0x5dd36c['options']);return db[_0x1499('0x3e')][_0x1499('0x46')](_0x1af1a1)[_0x1499('0x24')](handleEntityNotFound(_0x2cfdaf,null))['then'](respondWithResult(_0x2cfdaf,null))['catch'](handleError(_0x2cfdaf,null));};exports[_0x1499('0x47')]=function(_0x491777,_0x7fa101){return db[_0x1499('0x3e')][_0x1499('0x47')](_0x491777[_0x1499('0x48')],{})[_0x1499('0x24')](respondWithResult(_0x7fa101,0xc9))[_0x1499('0x49')](handleError(_0x7fa101,null));};exports[_0x1499('0x23')]=function(_0x591aa8,_0x420d16){if(_0x591aa8['body']['id']){delete _0x591aa8[_0x1499('0x48')]['id'];}return db[_0x1499('0x3e')]['find']({'where':{'id':_0x591aa8[_0x1499('0x44')]['id']}})[_0x1499('0x24')](handleEntityNotFound(_0x420d16,null))[_0x1499('0x24')](saveUpdates(_0x591aa8['body'],null))[_0x1499('0x24')](respondWithResult(_0x420d16,null))[_0x1499('0x49')](handleError(_0x420d16,null));};exports[_0x1499('0x25')]=function(_0x29ac0f,_0x305599){return db[_0x1499('0x3e')][_0x1499('0x46')]({'where':{'id':_0x29ac0f[_0x1499('0x44')]['id']}})[_0x1499('0x24')](handleEntityNotFound(_0x305599,null))[_0x1499('0x24')](removeEntity(_0x305599,null))['catch'](handleError(_0x305599,null));}; \ No newline at end of file +var _0xf61e=['intersection','fields','attributes','length','hasOwnProperty','order','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','create','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','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','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','then','status','error','stack','name','send','index','map','Integration','rawAttributes','key','model','query','keys','filters'];(function(_0x5d6e30,_0xc21d51){var _0x3d3f3b=function(_0x33597b){while(--_0x33597b){_0x5d6e30['push'](_0x5d6e30['shift']());}};_0x3d3f3b(++_0xc21d51);}(_0xf61e,0x191));var _0xef61=function(_0x85f946,_0x465223){_0x85f946=_0x85f946-0x0;var _0x47f1d2=_0xf61e[_0x85f946];return _0x47f1d2;};'use strict';var emlformat=require(_0xef61('0x0'));var rimraf=require(_0xef61('0x1'));var zipdir=require(_0xef61('0x2'));var jsonpatch=require(_0xef61('0x3'));var rp=require(_0xef61('0x4'));var moment=require(_0xef61('0x5'));var BPromise=require(_0xef61('0x6'));var Mustache=require(_0xef61('0x7'));var util=require(_0xef61('0x8'));var path=require(_0xef61('0x9'));var sox=require(_0xef61('0xa'));var csv=require(_0xef61('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef61('0xc'));var _=require(_0xef61('0xd'));var squel=require('squel');var crypto=require(_0xef61('0xe'));var jsforce=require(_0xef61('0xf'));var deskjs=require(_0xef61('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef61('0x11'));var Redis=require(_0xef61('0x12'));var authService=require(_0xef61('0x13'));var qs=require(_0xef61('0x14'));var as=require(_0xef61('0x15'));var hardwareService=require(_0xef61('0x16'));var logger=require(_0xef61('0x17'))(_0xef61('0x18'));var utils=require(_0xef61('0x19'));var config=require(_0xef61('0x1a'));var licenseUtil=require(_0xef61('0x1b'));var db=require(_0xef61('0x1c'))['db'];function respondWithStatusCode(_0x114e1f,_0x318f1c){_0x318f1c=_0x318f1c||0xcc;return function(_0x5de159){if(_0x5de159){return _0x114e1f[_0xef61('0x1d')](_0x318f1c);}return _0x114e1f['status'](_0x318f1c)[_0xef61('0x1e')]();};}function respondWithResult(_0x1db2a9,_0x370ee0){_0x370ee0=_0x370ee0||0xc8;return function(_0x76ef9b){if(_0x76ef9b){return _0x1db2a9['status'](_0x370ee0)[_0xef61('0x1f')](_0x76ef9b);}};}function respondWithFilteredResult(_0x435beb,_0x1224c2){return function(_0x78ff22){if(_0x78ff22){var _0x588a61=typeof _0x1224c2[_0xef61('0x20')]===_0xef61('0x21')&&typeof _0x1224c2['limit']===_0xef61('0x21');var _0x408541=_0x78ff22[_0xef61('0x22')];var _0x22dc1b=_0x588a61?0x0:_0x1224c2[_0xef61('0x20')];var _0x28315a=_0x588a61?_0x78ff22[_0xef61('0x22')]:_0x1224c2['offset']+_0x1224c2[_0xef61('0x23')];var _0x2c8dad;if(_0x28315a>=_0x408541){_0x28315a=_0x408541;_0x2c8dad=0xc8;}else{_0x2c8dad=0xce;}_0x435beb['status'](_0x2c8dad);return _0x435beb[_0xef61('0x24')](_0xef61('0x25'),_0x22dc1b+'-'+_0x28315a+'/'+_0x408541)[_0xef61('0x1f')](_0x78ff22);}return null;};}function patchUpdates(_0x26cf42){return function(_0xb0d7a4){try{jsonpatch[_0xef61('0x26')](_0xb0d7a4,_0x26cf42,!![]);}catch(_0x92ea33){return BPromise['reject'](_0x92ea33);}return _0xb0d7a4['save']();};}function saveUpdates(_0x3d31c1,_0x58bd7d){return function(_0x389d6d){if(_0x389d6d){return _0x389d6d['update'](_0x3d31c1)['then'](function(_0x2f0569){return _0x2f0569;});}return null;};}function removeEntity(_0x5ce99d,_0x53181b){return function(_0xfbee94){if(_0xfbee94){return _0xfbee94[_0xef61('0x27')]()[_0xef61('0x28')](function(){_0x5ce99d[_0xef61('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16b144,_0x4e738f){return function(_0x2a6832){if(!_0x2a6832){_0x16b144[_0xef61('0x1d')](0x194);}return _0x2a6832;};}function handleError(_0x2419a9,_0xf4c7c9){_0xf4c7c9=_0xf4c7c9||0x1f4;return function(_0x2155f1){logger[_0xef61('0x2a')](_0x2155f1[_0xef61('0x2b')]);if(_0x2155f1[_0xef61('0x2c')]){delete _0x2155f1[_0xef61('0x2c')];}_0x2419a9[_0xef61('0x29')](_0xf4c7c9)[_0xef61('0x2d')](_0x2155f1);};}exports[_0xef61('0x2e')]=function(_0xeb9a62,_0x63edd4){var _0x1f3572={},_0x85978={},_0x39c15e={'count':0x0,'rows':[]};var _0x393ea9=_[_0xef61('0x2f')](db[_0xef61('0x30')][_0xef61('0x31')],function(_0x53fa3b){return{'name':_0x53fa3b['fieldName'],'type':_0x53fa3b['type'][_0xef61('0x32')]};});_0x85978[_0xef61('0x33')]=_[_0xef61('0x2f')](_0x393ea9,'name');_0x85978[_0xef61('0x34')]=_[_0xef61('0x35')](_0xeb9a62['query']);_0x85978[_0xef61('0x36')]=_['intersection'](_0x85978['model'],_0x85978[_0xef61('0x34')]);_0x1f3572['attributes']=_[_0xef61('0x37')](_0x85978['model'],qs[_0xef61('0x38')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x38')]));_0x1f3572[_0xef61('0x39')]=_0x1f3572[_0xef61('0x39')][_0xef61('0x3a')]?_0x1f3572[_0xef61('0x39')]:_0x85978[_0xef61('0x33')];if(!_0xeb9a62[_0xef61('0x34')][_0xef61('0x3b')]('nolimit')){_0x1f3572[_0xef61('0x23')]=qs[_0xef61('0x23')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x23')]);_0x1f3572[_0xef61('0x20')]=qs['offset'](_0xeb9a62[_0xef61('0x34')][_0xef61('0x20')]);}_0x1f3572[_0xef61('0x3c')]=qs['sort'](_0xeb9a62['query']['sort']);_0x1f3572[_0xef61('0x3d')]=qs['filters'](_['pick'](_0xeb9a62['query'],_0x85978[_0xef61('0x36')]),_0x393ea9);if(_0xeb9a62[_0xef61('0x34')][_0xef61('0x3e')]){_0x1f3572['where']=_['merge'](_0x1f3572['where'],{'$or':_[_0xef61('0x2f')](_0x393ea9,function(_0x32ad44){if(_0x32ad44['type']!==_0xef61('0x3f')){var _0x12f442={};_0x12f442[_0x32ad44[_0xef61('0x2c')]]={'$like':'%'+_0xeb9a62[_0xef61('0x34')]['filter']+'%'};return _0x12f442;}})});}_0x1f3572=_[_0xef61('0x40')]({},_0x1f3572,_0xeb9a62[_0xef61('0x41')]);var _0x3103d4={'where':_0x1f3572[_0xef61('0x3d')]};return db['Integration']['count'](_0x3103d4)[_0xef61('0x28')](function(_0x462972){_0x39c15e[_0xef61('0x22')]=_0x462972;if(_0xeb9a62['query'][_0xef61('0x42')]){_0x1f3572[_0xef61('0x43')]=[{'all':!![]}];}return db[_0xef61('0x30')][_0xef61('0x44')](_0x1f3572);})['then'](function(_0x545597){_0x39c15e['rows']=_0x545597;return _0x39c15e;})[_0xef61('0x28')](respondWithFilteredResult(_0x63edd4,_0x1f3572))[_0xef61('0x45')](handleError(_0x63edd4,null));};exports[_0xef61('0x46')]=function(_0xe40d,_0x3f81a1){var _0x272143={'raw':![],'where':{'id':_0xe40d['params']['id']}},_0xc9b467={};_0xc9b467[_0xef61('0x33')]=_[_0xef61('0x35')](db[_0xef61('0x30')][_0xef61('0x31')]);_0xc9b467['query']=_[_0xef61('0x35')](_0xe40d[_0xef61('0x34')]);_0xc9b467[_0xef61('0x36')]=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],_0xc9b467[_0xef61('0x34')]);_0x272143['attributes']=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],qs[_0xef61('0x38')](_0xe40d['query'][_0xef61('0x38')]));_0x272143[_0xef61('0x39')]=_0x272143[_0xef61('0x39')][_0xef61('0x3a')]?_0x272143[_0xef61('0x39')]:_0xc9b467[_0xef61('0x33')];if(_0xe40d['query'][_0xef61('0x42')]){_0x272143[_0xef61('0x43')]=[{'all':!![]}];}_0x272143=_['merge']({},_0x272143,_0xe40d[_0xef61('0x41')]);return db[_0xef61('0x30')][_0xef61('0x47')](_0x272143)[_0xef61('0x28')](handleEntityNotFound(_0x3f81a1,null))['then'](respondWithResult(_0x3f81a1,null))[_0xef61('0x45')](handleError(_0x3f81a1,null));};exports[_0xef61('0x48')]=function(_0x5e614b,_0x47b09d){return db[_0xef61('0x30')][_0xef61('0x48')](_0x5e614b['body'],{})[_0xef61('0x28')](respondWithResult(_0x47b09d,0xc9))[_0xef61('0x45')](handleError(_0x47b09d,null));};exports[_0xef61('0x49')]=function(_0x2904e0,_0x13bb20){if(_0x2904e0[_0xef61('0x4a')]['id']){delete _0x2904e0[_0xef61('0x4a')]['id'];}return db['Integration'][_0xef61('0x47')]({'where':{'id':_0x2904e0['params']['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x13bb20,null))[_0xef61('0x28')](saveUpdates(_0x2904e0[_0xef61('0x4a')],null))[_0xef61('0x28')](respondWithResult(_0x13bb20,null))[_0xef61('0x45')](handleError(_0x13bb20,null));};exports[_0xef61('0x27')]=function(_0x3e23eb,_0x1565c7){return db[_0xef61('0x30')]['find']({'where':{'id':_0x3e23eb[_0xef61('0x4b')]['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x1565c7,null))['then'](removeEntity(_0x1565c7,null))['catch'](handleError(_0x1565c7,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 74d5fce..ddc634d 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 _0x9a73=['../../config/environment','exports','define','Integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x13f45c,_0x3fe675){var _0x52cd21=function(_0x488826){while(--_0x488826){_0x13f45c['push'](_0x13f45c['shift']());}};_0x52cd21(++_0x3fe675);}(_0x9a73,0x184));var _0x39a7=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x9a73[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x39a7('0x0'));var util=require(_0x39a7('0x1'));var logger=require(_0x39a7('0x2'))(_0x39a7('0x3'));var moment=require(_0x39a7('0x4'));var BPromise=require(_0x39a7('0x5'));var rp=require(_0x39a7('0x6'));var fs=require('fs');var path=require(_0x39a7('0x7'));var rimraf=require('rimraf');var config=require(_0x39a7('0x8'));var attributes=require('./integration.attributes');module[_0x39a7('0x9')]=function(_0x100725,_0x4552d1){return _0x100725[_0x39a7('0xa')](_0x39a7('0xb'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d1b=['moment','bluebird','request-promise','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash','util'];(function(_0x149882,_0x39b6be){var _0x43c6ee=function(_0x42d925){while(--_0x42d925){_0x149882['push'](_0x149882['shift']());}};_0x43c6ee(++_0x39b6be);}(_0x7d1b,0x1de));var _0xb7d1=function(_0x3bb2b2,_0x1dc903){_0x3bb2b2=_0x3bb2b2-0x0;var _0x5cda85=_0x7d1b[_0x3bb2b2];return _0x5cda85;};'use strict';var _=require(_0xb7d1('0x0'));var util=require(_0xb7d1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb7d1('0x2'));var BPromise=require(_0xb7d1('0x3'));var rp=require(_0xb7d1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb7d1('0x5'));var config=require(_0xb7d1('0x6'));var attributes=require(_0xb7d1('0x7'));module[_0xb7d1('0x8')]=function(_0x45934a,_0x159412){return _0x45934a[_0xb7d1('0x9')](_0xb7d1('0xa'),attributes,{'tableName':_0xb7d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 71191dc..6fd5410 100644 --- a/server/api/integration/integration.rpc.js +++ b/server/api/integration/integration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x3cd1e0,_0x55c9b){var _0x3f5154=function(_0x287827){while(--_0x287827){_0x3cd1e0['push'](_0x3cd1e0['shift']());}};_0x3f5154(++_0x55c9b);}(_0xdb28,0x106));var _0x8db2=function(_0x551211,_0x535b72){_0x551211=_0x551211-0x0;var _0x179bbf=_0xdb28[_0x551211];return _0x179bbf;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('Integration,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0x2542=['info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x250e1c,_0x545fce){var _0xf8dcb5=function(_0x45a74d){while(--_0x45a74d){_0x250e1c['push'](_0x250e1c['shift']());}};_0xf8dcb5(++_0x545fce);}(_0x2542,0x169));var _0x2254=function(_0x2d778d,_0x453b15){_0x2d778d=_0x2d778d-0x0;var _0x41d05b=_0x2542[_0x2d778d];return _0x41d05b;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index de952da..c467d9a 100644 --- a/server/api/integrationReport/index.js +++ b/server/api/integrationReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5f2f,0x73));var _0xf5f2=function(_0x46f551,_0x3399d3){_0x46f551=_0x46f551-0x0;var _0x535ac0=_0x5f2f[_0x46f551];return _0x535ac0;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')]('/',auth[_0xf5f2('0xa')](),controller['create']);router[_0xf5f2('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file +var _0x2542=['put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x3c3586,_0x5544c2){var _0x3399e1=function(_0x236132){while(--_0x236132){_0x3c3586['push'](_0x3c3586['shift']());}};_0x3399e1(++_0x5544c2);}(_0x2542,0x169));var _0x2254=function(_0x49d5a6,_0x3a1f12){_0x49d5a6=_0x49d5a6-0x0;var _0x56d4fa=_0x2542[_0x49d5a6];return _0x56d4fa;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2254('0x5'));var interaction=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var controller=require(_0x2254('0x8'));router[_0x2254('0x9')]('/',auth['isAuthenticated'](),controller[_0x2254('0xa')]);router[_0x2254('0x9')](_0x2254('0xb'),auth[_0x2254('0xc')](),controller[_0x2254('0xd')]);router[_0x2254('0x9')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0xf')]);router[_0x2254('0x10')]('/',auth[_0x2254('0xc')](),controller['create']);router[_0x2254('0x11')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0x12')]);router['delete']('/:id',auth[_0x2254('0xc')](),controller[_0x2254('0x13')]);module[_0x2254('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 9b3e300..ac34b3f 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 _0x9cca=['BOOLEAN','TEXT','SENT','FAILED','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x267c81,_0x12045b){var _0x20a516=function(_0x3185c8){while(--_0x3185c8){_0x267c81['push'](_0x267c81['shift']());}};_0x20a516(++_0x12045b);}(_0x9cca,0x11b));var _0xa9cc=function(_0x5bce80,_0x481cd9){_0x5bce80=_0x5bce80-0x0;var _0x230a2c=_0x9cca[_0x5bce80];return _0x230a2c;};'use strict';var Sequelize=require(_0xa9cc('0x0'));module[_0xa9cc('0x1')]={'integration':{'type':Sequelize[_0xa9cc('0x2')]},'eventChannel':{'type':Sequelize[_0xa9cc('0x2')]},'exitStatus':{'type':Sequelize[_0xa9cc('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xa9cc('0x3')]},'contacts':{'type':Sequelize[_0xa9cc('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa9cc('0x2')]},'calleridname':{'type':Sequelize[_0xa9cc('0x2')]},'queue':{'type':Sequelize[_0xa9cc('0x2')]},'interface':{'type':Sequelize[_0xa9cc('0x2')]},'membername':{'type':Sequelize[_0xa9cc('0x2')]},'agentcalledAt':{'type':Sequelize[_0xa9cc('0x4')]},'agentconnectAt':{'type':Sequelize[_0xa9cc('0x4')]},'holdtime':{'type':Sequelize[_0xa9cc('0x3')]},'agentcomplete':{'type':Sequelize[_0xa9cc('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xa9cc('0x4')]},'talktime':{'type':Sequelize[_0xa9cc('0x3')]},'agentacw':{'type':Sequelize[_0xa9cc('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xa9cc('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xa9cc('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xa9cc('0x4')]},'agentdump':{'type':Sequelize[_0xa9cc('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xa9cc('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa9cc('0x2')]},'channelstate':{'type':Sequelize[_0xa9cc('0x3')]},'channelstatedesc':{'type':Sequelize[_0xa9cc('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xa9cc('0x2')]},'language':{'type':Sequelize[_0xa9cc('0x2')]},'accountcode':{'type':Sequelize[_0xa9cc('0x2')]},'context':{'type':Sequelize[_0xa9cc('0x2')]},'exten':{'type':Sequelize[_0xa9cc('0x2')]},'priority':{'type':Sequelize[_0xa9cc('0x2')]},'destchannel':{'type':Sequelize[_0xa9cc('0x2')]},'destchannelstate':{'type':Sequelize[_0xa9cc('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xa9cc('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xa9cc('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xa9cc('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xa9cc('0x2')]},'destlanguage':{'type':Sequelize[_0xa9cc('0x2')]},'destaccountcode':{'type':Sequelize[_0xa9cc('0x2')]},'destcontext':{'type':Sequelize[_0xa9cc('0x2')]},'destexten':{'type':Sequelize[_0xa9cc('0x2')]},'destpriority':{'type':Sequelize[_0xa9cc('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xa9cc('0x2')]},'inReplyTo':{'type':Sequelize[_0xa9cc('0x2')]},'subject':{'type':Sequelize[_0xa9cc('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xa9cc('0x6')]},'html':{'type':Sequelize[_0xa9cc('0x6')]},'text':{'type':Sequelize[_0xa9cc('0x6')]},'status':{'type':Sequelize['ENUM'](_0xa9cc('0x7'),'SENDING','RECEIVED',_0xa9cc('0x8'))},'url':{'type':Sequelize[_0xa9cc('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xa9cc('0x2')]},'projectId':{'type':Sequelize[_0xa9cc('0x3')]}}; \ No newline at end of file +var _0xc2ae=['FAILED','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','SENT','SENDING','RECEIVED'];(function(_0x2e6e12,_0x238fc4){var _0x4bebf6=function(_0x55643c){while(--_0x55643c){_0x2e6e12['push'](_0x2e6e12['shift']());}};_0x4bebf6(++_0x238fc4);}(_0xc2ae,0x105));var _0xec2a=function(_0x101075,_0x3ea088){_0x101075=_0x101075-0x0;var _0x29448f=_0xc2ae[_0x101075];return _0x29448f;};'use strict';var Sequelize=require('sequelize');module[_0xec2a('0x0')]={'integration':{'type':Sequelize[_0xec2a('0x1')]},'eventChannel':{'type':Sequelize[_0xec2a('0x1')]},'exitStatus':{'type':Sequelize[_0xec2a('0x1')]},'ticketId':{'type':Sequelize[_0xec2a('0x1')]},'integrationId':{'type':Sequelize[_0xec2a('0x2')]},'contacts':{'type':Sequelize[_0xec2a('0x1')]},'uniqueid':{'type':Sequelize[_0xec2a('0x1')]},'calleridnum':{'type':Sequelize[_0xec2a('0x1')]},'calleridname':{'type':Sequelize[_0xec2a('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xec2a('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xec2a('0x3')]},'agentconnectAt':{'type':Sequelize[_0xec2a('0x3')]},'holdtime':{'type':Sequelize[_0xec2a('0x2')]},'agentcomplete':{'type':Sequelize[_0xec2a('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xec2a('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xec2a('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xec2a('0x2')]},'reason':{'type':Sequelize[_0xec2a('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xec2a('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xec2a('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xec2a('0x3')]},'lastevent':{'type':Sequelize[_0xec2a('0x1')]},'channel':{'type':Sequelize[_0xec2a('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xec2a('0x1')]},'connectedlinenum':{'type':Sequelize[_0xec2a('0x1')]},'connectedlinename':{'type':Sequelize[_0xec2a('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xec2a('0x1')]},'context':{'type':Sequelize[_0xec2a('0x1')]},'exten':{'type':Sequelize[_0xec2a('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xec2a('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xec2a('0x1')]},'destcalleridnum':{'type':Sequelize[_0xec2a('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xec2a('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xec2a('0x1')]},'destaccountcode':{'type':Sequelize[_0xec2a('0x1')]},'destcontext':{'type':Sequelize[_0xec2a('0x1')]},'destexten':{'type':Sequelize[_0xec2a('0x1')]},'destpriority':{'type':Sequelize[_0xec2a('0x1')]},'destuniqueid':{'type':Sequelize[_0xec2a('0x1')]},'messageId':{'type':Sequelize[_0xec2a('0x1')]},'inReplyTo':{'type':Sequelize[_0xec2a('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xec2a('0x1')]},'to':{'type':Sequelize[_0xec2a('0x1')]},'cc':{'type':Sequelize[_0xec2a('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xec2a('0x5')]},'text':{'type':Sequelize[_0xec2a('0x5')]},'status':{'type':Sequelize['ENUM'](_0xec2a('0x6'),_0xec2a('0x7'),_0xec2a('0x8'),_0xec2a('0x9'))},'url':{'type':Sequelize[_0xec2a('0x1')]},'app':{'type':Sequelize[_0xec2a('0x1')]},'appdata':{'type':Sequelize[_0xec2a('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 8665d2e..1729c96 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 _0xefae=['bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','keys','options','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','moment'];(function(_0x1b08d4,_0x8a710c){var _0x9aef3e=function(_0x4da607){while(--_0x4da607){_0x1b08d4['push'](_0x1b08d4['shift']());}};_0x9aef3e(++_0x8a710c);}(_0xefae,0xe3));var _0xeefa=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xefae[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xeefa('0x0'));var rimraf=require(_0xeefa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeefa('0x2'));var rp=require('request-promise');var moment=require(_0xeefa('0x3'));var BPromise=require(_0xeefa('0x4'));var Mustache=require(_0xeefa('0x5'));var util=require('util');var path=require(_0xeefa('0x6'));var sox=require('sox');var csv=require(_0xeefa('0x7'));var ejs=require(_0xeefa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeefa('0x9'));var squel=require(_0xeefa('0xa'));var crypto=require('crypto');var jsforce=require(_0xeefa('0xb'));var deskjs=require(_0xeefa('0xc'));var toCsv=require(_0xeefa('0x7'));var querystring=require(_0xeefa('0xd'));var Papa=require(_0xeefa('0xe'));var Redis=require(_0xeefa('0xf'));var authService=require(_0xeefa('0x10'));var qs=require(_0xeefa('0x11'));var as=require(_0xeefa('0x12'));var hardwareService=require(_0xeefa('0x13'));var logger=require(_0xeefa('0x14'))(_0xeefa('0x15'));var utils=require(_0xeefa('0x16'));var config=require(_0xeefa('0x17'));var licenseUtil=require(_0xeefa('0x18'));var db=require(_0xeefa('0x19'))['db'];function respondWithStatusCode(_0x29ad6b,_0x5032f9){_0x5032f9=_0x5032f9||0xcc;return function(_0x56dc33){if(_0x56dc33){return _0x29ad6b[_0xeefa('0x1a')](_0x5032f9);}return _0x29ad6b['status'](_0x5032f9)[_0xeefa('0x1b')]();};}function respondWithResult(_0x376bdb,_0x163a88){_0x163a88=_0x163a88||0xc8;return function(_0x28c890){if(_0x28c890){return _0x376bdb[_0xeefa('0x1c')](_0x163a88)[_0xeefa('0x1d')](_0x28c890);}};}function respondWithFilteredResult(_0x14826b,_0x400b33){return function(_0x26e71a){if(_0x26e71a){var _0x1830b4=typeof _0x400b33[_0xeefa('0x1e')]===_0xeefa('0x1f')&&typeof _0x400b33[_0xeefa('0x20')]===_0xeefa('0x1f');var _0x130dd1=_0x26e71a[_0xeefa('0x21')];var _0x5b6900=_0x1830b4?0x0:_0x400b33['offset'];var _0x1df6b1=_0x1830b4?_0x26e71a[_0xeefa('0x21')]:_0x400b33['offset']+_0x400b33[_0xeefa('0x20')];var _0x2cd95b;if(_0x1df6b1>=_0x130dd1){_0x1df6b1=_0x130dd1;_0x2cd95b=0xc8;}else{_0x2cd95b=0xce;}_0x14826b[_0xeefa('0x1c')](_0x2cd95b);return _0x14826b[_0xeefa('0x22')](_0xeefa('0x23'),_0x5b6900+'-'+_0x1df6b1+'/'+_0x130dd1)[_0xeefa('0x1d')](_0x26e71a);}return null;};}function patchUpdates(_0x543ef2){return function(_0x1b4ab0){try{jsonpatch[_0xeefa('0x24')](_0x1b4ab0,_0x543ef2,!![]);}catch(_0x5168a6){return BPromise[_0xeefa('0x25')](_0x5168a6);}return _0x1b4ab0['save']();};}function saveUpdates(_0x46dfec,_0x1db547){return function(_0x5aa8f3){if(_0x5aa8f3){return _0x5aa8f3[_0xeefa('0x26')](_0x46dfec)[_0xeefa('0x27')](function(_0x2e157d){return _0x2e157d;});}return null;};}function removeEntity(_0x52bc1a,_0x1a54ed){return function(_0x4a3520){if(_0x4a3520){return _0x4a3520[_0xeefa('0x28')]()[_0xeefa('0x27')](function(){_0x52bc1a[_0xeefa('0x1c')](0xcc)[_0xeefa('0x1b')]();});}};}function handleEntityNotFound(_0x170b9f,_0x3409e3){return function(_0x81cd1){if(!_0x81cd1){_0x170b9f['sendStatus'](0x194);}return _0x81cd1;};}function handleError(_0x5c25b4,_0x35fae1){_0x35fae1=_0x35fae1||0x1f4;return function(_0x3d24fb){logger[_0xeefa('0x29')](_0x3d24fb[_0xeefa('0x2a')]);if(_0x3d24fb[_0xeefa('0x2b')]){delete _0x3d24fb[_0xeefa('0x2b')];}_0x5c25b4[_0xeefa('0x1c')](_0x35fae1)[_0xeefa('0x2c')](_0x3d24fb);};}exports[_0xeefa('0x2d')]=function(_0x41f74a,_0x20a622){var _0x26ac0c={},_0x5be9a1={},_0x2c527b={'count':0x0,'rows':[]};var _0x11b0fa=_[_0xeefa('0x2e')](db[_0xeefa('0x2f')][_0xeefa('0x30')],function(_0x362bae){return{'name':_0x362bae[_0xeefa('0x31')],'type':_0x362bae[_0xeefa('0x32')]['key']};});_0x5be9a1[_0xeefa('0x33')]=_['map'](_0x11b0fa,'name');_0x5be9a1[_0xeefa('0x34')]=_['keys'](_0x41f74a['query']);_0x5be9a1[_0xeefa('0x35')]=_[_0xeefa('0x36')](_0x5be9a1[_0xeefa('0x33')],_0x5be9a1[_0xeefa('0x34')]);_0x26ac0c[_0xeefa('0x37')]=_[_0xeefa('0x36')](_0x5be9a1[_0xeefa('0x33')],qs[_0xeefa('0x38')](_0x41f74a[_0xeefa('0x34')][_0xeefa('0x38')]));_0x26ac0c[_0xeefa('0x37')]=_0x26ac0c[_0xeefa('0x37')][_0xeefa('0x39')]?_0x26ac0c[_0xeefa('0x37')]:_0x5be9a1[_0xeefa('0x33')];if(!_0x41f74a[_0xeefa('0x34')][_0xeefa('0x3a')](_0xeefa('0x3b'))){_0x26ac0c[_0xeefa('0x20')]=qs['limit'](_0x41f74a[_0xeefa('0x34')][_0xeefa('0x20')]);_0x26ac0c['offset']=qs[_0xeefa('0x1e')](_0x41f74a[_0xeefa('0x34')][_0xeefa('0x1e')]);}_0x26ac0c[_0xeefa('0x3c')]=qs[_0xeefa('0x3d')](_0x41f74a[_0xeefa('0x34')][_0xeefa('0x3d')]);_0x26ac0c[_0xeefa('0x3e')]=qs[_0xeefa('0x35')](_[_0xeefa('0x3f')](_0x41f74a[_0xeefa('0x34')],_0x5be9a1[_0xeefa('0x35')]),_0x11b0fa);if(_0x41f74a[_0xeefa('0x34')][_0xeefa('0x40')]){_0x26ac0c[_0xeefa('0x3e')]=_[_0xeefa('0x41')](_0x26ac0c[_0xeefa('0x3e')],{'$or':_[_0xeefa('0x2e')](_0x11b0fa,function(_0x170bd4){if(_0x170bd4['type']!==_0xeefa('0x42')){var _0x346f04={};_0x346f04[_0x170bd4['name']]={'$like':'%'+_0x41f74a['query'][_0xeefa('0x40')]+'%'};return _0x346f04;}})});}_0x26ac0c=_['merge']({},_0x26ac0c,_0x41f74a['options']);var _0x4fd9ae={'where':_0x26ac0c[_0xeefa('0x3e')]};return db[_0xeefa('0x2f')][_0xeefa('0x21')](_0x4fd9ae)[_0xeefa('0x27')](function(_0x2e86ac){_0x2c527b['count']=_0x2e86ac;if(_0x41f74a['query']['includeAll']){_0x26ac0c[_0xeefa('0x43')]=[{'all':!![]}];}return db['IntegrationReport'][_0xeefa('0x44')](_0x26ac0c);})['then'](function(_0x15cd9a){_0x2c527b['rows']=_0x15cd9a;return _0x2c527b;})[_0xeefa('0x27')](respondWithFilteredResult(_0x20a622,_0x26ac0c))[_0xeefa('0x45')](handleError(_0x20a622,null));};exports['show']=function(_0x4c96ed,_0x5b77b1){var _0x5800da={'raw':![],'where':{'id':_0x4c96ed['params']['id']}},_0x39bf55={};_0x39bf55[_0xeefa('0x33')]=_[_0xeefa('0x46')](db[_0xeefa('0x2f')][_0xeefa('0x30')]);_0x39bf55[_0xeefa('0x34')]=_[_0xeefa('0x46')](_0x4c96ed[_0xeefa('0x34')]);_0x39bf55[_0xeefa('0x35')]=_[_0xeefa('0x36')](_0x39bf55['model'],_0x39bf55[_0xeefa('0x34')]);_0x5800da[_0xeefa('0x37')]=_[_0xeefa('0x36')](_0x39bf55[_0xeefa('0x33')],qs[_0xeefa('0x38')](_0x4c96ed[_0xeefa('0x34')][_0xeefa('0x38')]));_0x5800da[_0xeefa('0x37')]=_0x5800da['attributes']['length']?_0x5800da[_0xeefa('0x37')]:_0x39bf55['model'];if(_0x4c96ed[_0xeefa('0x34')]['includeAll']){_0x5800da['include']=[{'all':!![]}];}_0x5800da=_['merge']({},_0x5800da,_0x4c96ed[_0xeefa('0x47')]);return db[_0xeefa('0x2f')][_0xeefa('0x48')](_0x5800da)[_0xeefa('0x27')](handleEntityNotFound(_0x5b77b1,null))[_0xeefa('0x27')](respondWithResult(_0x5b77b1,null))['catch'](handleError(_0x5b77b1,null));};exports[_0xeefa('0x49')]=function(_0x2720ee,_0x493b61){return db[_0xeefa('0x2f')]['create'](_0x2720ee[_0xeefa('0x4a')],{})['then'](respondWithResult(_0x493b61,0xc9))['catch'](handleError(_0x493b61,null));};exports[_0xeefa('0x26')]=function(_0x1e92ee,_0x31a0b6){if(_0x1e92ee[_0xeefa('0x4a')]['id']){delete _0x1e92ee['body']['id'];}return db[_0xeefa('0x2f')][_0xeefa('0x48')]({'where':{'id':_0x1e92ee[_0xeefa('0x4b')]['id']}})[_0xeefa('0x27')](handleEntityNotFound(_0x31a0b6,null))[_0xeefa('0x27')](saveUpdates(_0x1e92ee[_0xeefa('0x4a')],null))[_0xeefa('0x27')](respondWithResult(_0x31a0b6,null))[_0xeefa('0x45')](handleError(_0x31a0b6,null));};exports[_0xeefa('0x28')]=function(_0x235eb2,_0xb20c55){return db[_0xeefa('0x2f')][_0xeefa('0x48')]({'where':{'id':_0x235eb2[_0xeefa('0x4b')]['id']}})[_0xeefa('0x27')](handleEntityNotFound(_0xb20c55,null))[_0xeefa('0x27')](removeEntity(_0xb20c55,null))[_0xeefa('0x45')](handleError(_0xb20c55,null));};exports[_0xeefa('0x4c')]=function(_0x5ae2b7,_0x15413d){return db[_0xeefa('0x2f')]['describe']()[_0xeefa('0x27')](respondWithResult(_0x15413d,null))[_0xeefa('0x45')](handleError(_0x15413d,null));}; \ No newline at end of file +var _0x2b81=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','undefined','count','offset','status','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x2379a7,_0x44f9ec){var _0x13a40d=function(_0x45f733){while(--_0x45f733){_0x2379a7['push'](_0x2379a7['shift']());}};_0x13a40d(++_0x44f9ec);}(_0x2b81,0x1da));var _0x12b8=function(_0x5c57ee,_0x5d955a){_0x5c57ee=_0x5c57ee-0x0;var _0x54acd6=_0x2b81[_0x5c57ee];return _0x54acd6;};'use strict';var emlformat=require(_0x12b8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x12b8('0x1'));var jsonpatch=require(_0x12b8('0x2'));var rp=require(_0x12b8('0x3'));var moment=require(_0x12b8('0x4'));var BPromise=require(_0x12b8('0x5'));var Mustache=require('mustache');var util=require(_0x12b8('0x6'));var path=require(_0x12b8('0x7'));var sox=require(_0x12b8('0x8'));var csv=require(_0x12b8('0x9'));var ejs=require(_0x12b8('0xa'));var fs=require('fs');var fs_extra=require(_0x12b8('0xb'));var _=require(_0x12b8('0xc'));var squel=require(_0x12b8('0xd'));var crypto=require(_0x12b8('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x12b8('0x9'));var querystring=require(_0x12b8('0xf'));var Papa=require('papaparse');var Redis=require(_0x12b8('0x10'));var authService=require(_0x12b8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x12b8('0x12'));var hardwareService=require(_0x12b8('0x13'));var logger=require(_0x12b8('0x14'))(_0x12b8('0x15'));var utils=require(_0x12b8('0x16'));var config=require(_0x12b8('0x17'));var licenseUtil=require(_0x12b8('0x18'));var db=require(_0x12b8('0x19'))['db'];function respondWithStatusCode(_0x60b818,_0x28a9f0){_0x28a9f0=_0x28a9f0||0xcc;return function(_0x38f82a){if(_0x38f82a){return _0x60b818[_0x12b8('0x1a')](_0x28a9f0);}return _0x60b818['status'](_0x28a9f0)[_0x12b8('0x1b')]();};}function respondWithResult(_0x363097,_0x2b106b){_0x2b106b=_0x2b106b||0xc8;return function(_0x3776e0){if(_0x3776e0){return _0x363097['status'](_0x2b106b)[_0x12b8('0x1c')](_0x3776e0);}};}function respondWithFilteredResult(_0x5a19cf,_0x25cbd1){return function(_0x2b00c1){if(_0x2b00c1){var _0x177ab0=typeof _0x25cbd1['offset']==='undefined'&&typeof _0x25cbd1[_0x12b8('0x1d')]===_0x12b8('0x1e');var _0xe14269=_0x2b00c1[_0x12b8('0x1f')];var _0xd08c0e=_0x177ab0?0x0:_0x25cbd1[_0x12b8('0x20')];var _0x4ee628=_0x177ab0?_0x2b00c1['count']:_0x25cbd1[_0x12b8('0x20')]+_0x25cbd1[_0x12b8('0x1d')];var _0x29449c;if(_0x4ee628>=_0xe14269){_0x4ee628=_0xe14269;_0x29449c=0xc8;}else{_0x29449c=0xce;}_0x5a19cf[_0x12b8('0x21')](_0x29449c);return _0x5a19cf[_0x12b8('0x22')](_0x12b8('0x23'),_0xd08c0e+'-'+_0x4ee628+'/'+_0xe14269)['json'](_0x2b00c1);}return null;};}function patchUpdates(_0x27e111){return function(_0x562309){try{jsonpatch[_0x12b8('0x24')](_0x562309,_0x27e111,!![]);}catch(_0x135690){return BPromise[_0x12b8('0x25')](_0x135690);}return _0x562309['save']();};}function saveUpdates(_0x55af68,_0x3a9b0e){return function(_0x1728cc){if(_0x1728cc){return _0x1728cc[_0x12b8('0x26')](_0x55af68)[_0x12b8('0x27')](function(_0x53d87d){return _0x53d87d;});}return null;};}function removeEntity(_0x378172,_0x5d1205){return function(_0x395017){if(_0x395017){return _0x395017[_0x12b8('0x28')]()['then'](function(){_0x378172['status'](0xcc)[_0x12b8('0x1b')]();});}};}function handleEntityNotFound(_0x351d4c,_0x223bcc){return function(_0xa399d5){if(!_0xa399d5){_0x351d4c[_0x12b8('0x1a')](0x194);}return _0xa399d5;};}function handleError(_0x35d11e,_0x557c5f){_0x557c5f=_0x557c5f||0x1f4;return function(_0x58defc){logger[_0x12b8('0x29')](_0x58defc[_0x12b8('0x2a')]);if(_0x58defc[_0x12b8('0x2b')]){delete _0x58defc[_0x12b8('0x2b')];}_0x35d11e[_0x12b8('0x21')](_0x557c5f)[_0x12b8('0x2c')](_0x58defc);};}exports['index']=function(_0xc81209,_0x394d69){var _0x3fe91f={},_0x18767e={},_0x22b18e={'count':0x0,'rows':[]};var _0x6d646b=_[_0x12b8('0x2d')](db[_0x12b8('0x2e')][_0x12b8('0x2f')],function(_0x249039){return{'name':_0x249039[_0x12b8('0x30')],'type':_0x249039[_0x12b8('0x31')][_0x12b8('0x32')]};});_0x18767e[_0x12b8('0x33')]=_['map'](_0x6d646b,_0x12b8('0x2b'));_0x18767e[_0x12b8('0x34')]=_['keys'](_0xc81209[_0x12b8('0x34')]);_0x18767e[_0x12b8('0x35')]=_[_0x12b8('0x36')](_0x18767e[_0x12b8('0x33')],_0x18767e[_0x12b8('0x34')]);_0x3fe91f[_0x12b8('0x37')]=_['intersection'](_0x18767e[_0x12b8('0x33')],qs['fields'](_0xc81209['query']['fields']));_0x3fe91f[_0x12b8('0x37')]=_0x3fe91f[_0x12b8('0x37')][_0x12b8('0x38')]?_0x3fe91f[_0x12b8('0x37')]:_0x18767e['model'];if(!_0xc81209[_0x12b8('0x34')][_0x12b8('0x39')](_0x12b8('0x3a'))){_0x3fe91f[_0x12b8('0x1d')]=qs[_0x12b8('0x1d')](_0xc81209[_0x12b8('0x34')]['limit']);_0x3fe91f[_0x12b8('0x20')]=qs['offset'](_0xc81209[_0x12b8('0x34')]['offset']);}_0x3fe91f[_0x12b8('0x3b')]=qs[_0x12b8('0x3c')](_0xc81209['query'][_0x12b8('0x3c')]);_0x3fe91f[_0x12b8('0x3d')]=qs[_0x12b8('0x35')](_[_0x12b8('0x3e')](_0xc81209[_0x12b8('0x34')],_0x18767e[_0x12b8('0x35')]),_0x6d646b);if(_0xc81209[_0x12b8('0x34')][_0x12b8('0x3f')]){_0x3fe91f[_0x12b8('0x3d')]=_[_0x12b8('0x40')](_0x3fe91f['where'],{'$or':_[_0x12b8('0x2d')](_0x6d646b,function(_0x402f1a){if(_0x402f1a[_0x12b8('0x31')]!==_0x12b8('0x41')){var _0x1803b0={};_0x1803b0[_0x402f1a[_0x12b8('0x2b')]]={'$like':'%'+_0xc81209[_0x12b8('0x34')]['filter']+'%'};return _0x1803b0;}})});}_0x3fe91f=_[_0x12b8('0x40')]({},_0x3fe91f,_0xc81209[_0x12b8('0x42')]);var _0x1eff7c={'where':_0x3fe91f[_0x12b8('0x3d')]};return db[_0x12b8('0x2e')][_0x12b8('0x1f')](_0x1eff7c)[_0x12b8('0x27')](function(_0x4ba054){_0x22b18e['count']=_0x4ba054;if(_0xc81209['query'][_0x12b8('0x43')]){_0x3fe91f[_0x12b8('0x44')]=[{'all':!![]}];}return db['IntegrationReport'][_0x12b8('0x45')](_0x3fe91f);})[_0x12b8('0x27')](function(_0xb9eaac){_0x22b18e[_0x12b8('0x46')]=_0xb9eaac;return _0x22b18e;})[_0x12b8('0x27')](respondWithFilteredResult(_0x394d69,_0x3fe91f))[_0x12b8('0x47')](handleError(_0x394d69,null));};exports[_0x12b8('0x48')]=function(_0x14c58c,_0x3ffe20){var _0x25cf0d={'raw':![],'where':{'id':_0x14c58c[_0x12b8('0x49')]['id']}},_0x32dbc3={};_0x32dbc3[_0x12b8('0x33')]=_[_0x12b8('0x4a')](db[_0x12b8('0x2e')][_0x12b8('0x2f')]);_0x32dbc3[_0x12b8('0x34')]=_['keys'](_0x14c58c[_0x12b8('0x34')]);_0x32dbc3[_0x12b8('0x35')]=_[_0x12b8('0x36')](_0x32dbc3['model'],_0x32dbc3['query']);_0x25cf0d[_0x12b8('0x37')]=_['intersection'](_0x32dbc3[_0x12b8('0x33')],qs[_0x12b8('0x4b')](_0x14c58c[_0x12b8('0x34')][_0x12b8('0x4b')]));_0x25cf0d[_0x12b8('0x37')]=_0x25cf0d['attributes'][_0x12b8('0x38')]?_0x25cf0d[_0x12b8('0x37')]:_0x32dbc3[_0x12b8('0x33')];if(_0x14c58c[_0x12b8('0x34')][_0x12b8('0x43')]){_0x25cf0d[_0x12b8('0x44')]=[{'all':!![]}];}_0x25cf0d=_[_0x12b8('0x40')]({},_0x25cf0d,_0x14c58c[_0x12b8('0x42')]);return db[_0x12b8('0x2e')][_0x12b8('0x4c')](_0x25cf0d)[_0x12b8('0x27')](handleEntityNotFound(_0x3ffe20,null))[_0x12b8('0x27')](respondWithResult(_0x3ffe20,null))[_0x12b8('0x47')](handleError(_0x3ffe20,null));};exports['create']=function(_0x16636d,_0x4d0ebc){return db[_0x12b8('0x2e')][_0x12b8('0x4d')](_0x16636d[_0x12b8('0x4e')],{})['then'](respondWithResult(_0x4d0ebc,0xc9))['catch'](handleError(_0x4d0ebc,null));};exports['update']=function(_0x5f472d,_0x1c8253){if(_0x5f472d['body']['id']){delete _0x5f472d[_0x12b8('0x4e')]['id'];}return db[_0x12b8('0x2e')]['find']({'where':{'id':_0x5f472d[_0x12b8('0x49')]['id']}})[_0x12b8('0x27')](handleEntityNotFound(_0x1c8253,null))['then'](saveUpdates(_0x5f472d[_0x12b8('0x4e')],null))[_0x12b8('0x27')](respondWithResult(_0x1c8253,null))['catch'](handleError(_0x1c8253,null));};exports[_0x12b8('0x28')]=function(_0x491964,_0xc3b2dd){return db[_0x12b8('0x2e')][_0x12b8('0x4c')]({'where':{'id':_0x491964[_0x12b8('0x49')]['id']}})[_0x12b8('0x27')](handleEntityNotFound(_0xc3b2dd,null))[_0x12b8('0x27')](removeEntity(_0xc3b2dd,null))[_0x12b8('0x47')](handleError(_0xc3b2dd,null));};exports[_0x12b8('0x4f')]=function(_0x16a3b9,_0x49aca0){return db['IntegrationReport'][_0x12b8('0x4f')]()['then'](respondWithResult(_0x49aca0,null))[_0x12b8('0x47')](handleError(_0x49aca0,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 659e7d5..07c0c8c 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 _0x0f7e=['IntegrationReport','../../config/logger','moment','bluebird','request-promise','path','exports','define'];(function(_0x1a80f6,_0x4693dd){var _0xea21d2=function(_0x31e502){while(--_0x31e502){_0x1a80f6['push'](_0x1a80f6['shift']());}};_0xea21d2(++_0x4693dd);}(_0x0f7e,0x1b9));var _0xe0f7=function(_0x5e6bb4,_0x12dddd){_0x5e6bb4=_0x5e6bb4-0x0;var _0x47b68c=_0x0f7e[_0x5e6bb4];return _0x47b68c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe0f7('0x0'))('api');var moment=require(_0xe0f7('0x1'));var BPromise=require(_0xe0f7('0x2'));var rp=require(_0xe0f7('0x3'));var fs=require('fs');var path=require(_0xe0f7('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0xe0f7('0x5')]=function(_0x10441e,_0x40f8f5){return _0x10441e[_0xe0f7('0x6')](_0xe0f7('0x7'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe92e=['bluebird','request-promise','path','exports','IntegrationReport','report_integration','lodash','api'];(function(_0x134827,_0x21f6ed){var _0x366671=function(_0x4dc8d4){while(--_0x4dc8d4){_0x134827['push'](_0x134827['shift']());}};_0x366671(++_0x21f6ed);}(_0xe92e,0x10e));var _0xee92=function(_0x3d64ca,_0x5b8354){_0x3d64ca=_0x3d64ca-0x0;var _0x5cd3ee=_0xe92e[_0x3d64ca];return _0x5cd3ee;};'use strict';var _=require(_0xee92('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee92('0x1'));var moment=require('moment');var BPromise=require(_0xee92('0x2'));var rp=require(_0xee92('0x3'));var fs=require('fs');var path=require(_0xee92('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0xee92('0x5')]=function(_0x16f747,_0x4047b3){return _0x16f747['define'](_0xee92('0x6'),attributes,{'tableName':_0xee92('0x7'),'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 d2287f1..10a5303 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x2646f6,_0x287adf){var _0x577237=function(_0x4d2d6f){while(--_0x4d2d6f){_0x2646f6['push'](_0x2646f6['shift']());}};_0x577237(++_0x287adf);}(_0x2ef3,0xba));var _0x32ef=function(_0x20e130,_0x27c131){_0x20e130=_0x20e130-0x0;var _0x5f40eb=_0x2ef3[_0x20e130];return _0x5f40eb;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +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(_0x32ce61,_0x2ba733){var _0x28eded=function(_0x34db11){while(--_0x34db11){_0x32ce61['push'](_0x32ce61['shift']());}};_0x28eded(++_0x2ba733);}(_0xadb5,0xad));var _0x5adb=function(_0x4c92d9,_0x3b5645){_0x4c92d9=_0x4c92d9-0x0;var _0xddae6e=_0xadb5[_0x4c92d9];return _0xddae6e;};'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 diff --git a/server/api/interval/index.js b/server/api/interval/index.js index cbfc5ba..1b92d57 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 _0x993f=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','create','addIntervals','update','delete','destroy','exports','multer','util'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x993f,0x129));var _0xf993=function(_0x49df0b,_0x24416c){_0x49df0b=_0x49df0b-0x0;var _0x598f68=_0x993f[_0x49df0b];return _0x598f68;};'use strict';var multer=require(_0xf993('0x0'));var util=require(_0xf993('0x1'));var path=require(_0xf993('0x2'));var timeout=require(_0xf993('0x3'));var express=require('express');var router=express[_0xf993('0x4')]();var fs_extra=require(_0xf993('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf993('0x6'));var config=require(_0xf993('0x7'));var controller=require(_0xf993('0x8'));router[_0xf993('0x9')]('/',auth[_0xf993('0xa')](),controller[_0xf993('0xb')]);router[_0xf993('0x9')](_0xf993('0xc'),auth[_0xf993('0xa')](),controller[_0xf993('0xd')]);router[_0xf993('0x9')](_0xf993('0xe'),auth['isAuthenticated'](),controller[_0xf993('0xf')]);router[_0xf993('0x10')]('/',auth['isAuthenticated'](),controller[_0xf993('0x11')]);router[_0xf993('0x10')](_0xf993('0xe'),auth[_0xf993('0xa')](),controller['addInterval']);router[_0xf993('0x10')]('/:id/sub_intervals/create_many',auth[_0xf993('0xa')](),controller[_0xf993('0x12')]);router['put'](_0xf993('0xc'),auth['isAuthenticated'](),controller[_0xf993('0x13')]);router[_0xf993('0x14')](_0xf993('0xc'),auth['isAuthenticated'](),controller[_0xf993('0x15')]);module[_0xf993('0x16')]=router; \ No newline at end of file +var _0x799b=['/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','put','update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./interval.controller','isAuthenticated','get','/:id','show','getIntervals','create','post'];(function(_0x598f1a,_0x1e7009){var _0x5301da=function(_0x1116cd){while(--_0x1116cd){_0x598f1a['push'](_0x598f1a['shift']());}};_0x5301da(++_0x1e7009);}(_0x799b,0x8c));var _0xb799=function(_0x1f4656,_0x201b59){_0x1f4656=_0x1f4656-0x0;var _0x35e26e=_0x799b[_0x1f4656];return _0x35e26e;};'use strict';var multer=require(_0xb799('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb799('0x1'));var express=require('express');var router=express[_0xb799('0x2')]();var fs_extra=require(_0xb799('0x3'));var auth=require(_0xb799('0x4'));var interaction=require(_0xb799('0x5'));var config=require('../../config/environment');var controller=require(_0xb799('0x6'));router['get']('/',auth[_0xb799('0x7')](),controller['index']);router[_0xb799('0x8')](_0xb799('0x9'),auth[_0xb799('0x7')](),controller[_0xb799('0xa')]);router[_0xb799('0x8')]('/:id/sub_intervals',auth[_0xb799('0x7')](),controller[_0xb799('0xb')]);router['post']('/',auth[_0xb799('0x7')](),controller[_0xb799('0xc')]);router[_0xb799('0xd')](_0xb799('0xe'),auth[_0xb799('0x7')](),controller[_0xb799('0xf')]);router[_0xb799('0xd')](_0xb799('0x10'),auth[_0xb799('0x7')](),controller['addIntervals']);router[_0xb799('0x11')](_0xb799('0x9'),auth[_0xb799('0x7')](),controller[_0xb799('0x12')]);router[_0xb799('0x13')](_0xb799('0x9'),auth[_0xb799('0x7')](),controller[_0xb799('0x14')]);module[_0xb799('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 18ac75b..1ef8291 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 _0x6adb=['STRING','sequelize','exports'];(function(_0x238996,_0x5cafbf){var _0xf7d985=function(_0x972bbd){while(--_0x972bbd){_0x238996['push'](_0x238996['shift']());}};_0xf7d985(++_0x5cafbf);}(_0x6adb,0x6d));var _0xb6ad=function(_0xbc1f5f,_0xbde0a6){_0xbc1f5f=_0xbc1f5f-0x0;var _0x1bc6f7=_0x6adb[_0xbc1f5f];return _0x1bc6f7;};'use strict';var Sequelize=require(_0xb6ad('0x0'));module[_0xb6ad('0x1')]={'name':{'type':Sequelize[_0xb6ad('0x2')]},'description':{'type':Sequelize[_0xb6ad('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x5b6f=['exports','STRING','sequelize'];(function(_0x4717b8,_0x331c49){var _0x42a536=function(_0x580b33){while(--_0x580b33){_0x4717b8['push'](_0x4717b8['shift']());}};_0x42a536(++_0x331c49);}(_0x5b6f,0x1c7));var _0xf5b6=function(_0x4e1211,_0x1c0e26){_0x4e1211=_0x4e1211-0x0;var _0x4ae887=_0x5b6f[_0x4e1211];return _0x4ae887;};'use strict';var Sequelize=require(_0xf5b6('0x0'));module[_0xf5b6('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf5b6('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 5fc4782..909de15 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 _0x4c43=['Intervals','UserProfileResource','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','Interval','count','includeAll','include','findAll','rows','catch','show','params','create','user','role','UserProfileSection','find','userProfileId','error','update','body','addInterval','getIntervals','findOne','pick','addIntervals','sequelize','transaction','IntervalId','bulkCreate','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','get'];(function(_0x5e1b7e,_0x88666d){var _0x172db4=function(_0x58012b){while(--_0x58012b){_0x5e1b7e['push'](_0x5e1b7e['shift']());}};_0x172db4(++_0x88666d);}(_0x4c43,0x1af));var _0x34c4=function(_0x4c9c28,_0x2a759d){_0x4c9c28=_0x4c9c28-0x0;var _0x49f821=_0x4c43[_0x4c9c28];return _0x49f821;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x34c4('0x0'));var zipdir=require(_0x34c4('0x1'));var jsonpatch=require(_0x34c4('0x2'));var rp=require(_0x34c4('0x3'));var moment=require(_0x34c4('0x4'));var BPromise=require(_0x34c4('0x5'));var Mustache=require(_0x34c4('0x6'));var util=require(_0x34c4('0x7'));var path=require(_0x34c4('0x8'));var sox=require(_0x34c4('0x9'));var csv=require(_0x34c4('0xa'));var ejs=require(_0x34c4('0xb'));var fs=require('fs');var fs_extra=require(_0x34c4('0xc'));var _=require(_0x34c4('0xd'));var squel=require('squel');var crypto=require(_0x34c4('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x34c4('0xa'));var querystring=require('querystring');var Papa=require(_0x34c4('0xf'));var Redis=require(_0x34c4('0x10'));var authService=require(_0x34c4('0x11'));var qs=require(_0x34c4('0x12'));var as=require(_0x34c4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x34c4('0x14'));var config=require(_0x34c4('0x15'));var licenseUtil=require(_0x34c4('0x16'));var db=require(_0x34c4('0x17'))['db'];var extensions=require(_0x34c4('0x18'));function respondWithStatusCode(_0x1e6009,_0x224c1b){_0x224c1b=_0x224c1b||0xcc;return function(_0x27ddff){if(_0x27ddff){return _0x1e6009[_0x34c4('0x19')](_0x224c1b);}return _0x1e6009['status'](_0x224c1b)[_0x34c4('0x1a')]();};}function respondWithResult(_0x458dcb,_0x771532){_0x771532=_0x771532||0xc8;return function(_0x29ac10){if(_0x29ac10){return _0x458dcb[_0x34c4('0x1b')](_0x771532)[_0x34c4('0x1c')](_0x29ac10);}};}function respondWithFilteredResult(_0x1807d5,_0x420007){return function(_0x2f2423){if(_0x2f2423){var _0x2b74f3=typeof _0x420007[_0x34c4('0x1d')]===_0x34c4('0x1e')&&typeof _0x420007[_0x34c4('0x1f')]===_0x34c4('0x1e');var _0x325132=_0x2f2423['count'];var _0x97b984=_0x2b74f3?0x0:_0x420007[_0x34c4('0x1d')];var _0x4a2a1b=_0x2b74f3?_0x2f2423['count']:_0x420007[_0x34c4('0x1d')]+_0x420007[_0x34c4('0x1f')];var _0x546004;if(_0x4a2a1b>=_0x325132){_0x4a2a1b=_0x325132;_0x546004=0xc8;}else{_0x546004=0xce;}_0x1807d5[_0x34c4('0x1b')](_0x546004);return _0x1807d5[_0x34c4('0x20')](_0x34c4('0x21'),_0x97b984+'-'+_0x4a2a1b+'/'+_0x325132)[_0x34c4('0x1c')](_0x2f2423);}return null;};}function patchUpdates(_0x54822d){return function(_0x5ca44c){try{jsonpatch[_0x34c4('0x22')](_0x5ca44c,_0x54822d,!![]);}catch(_0x4278a4){return BPromise[_0x34c4('0x23')](_0x4278a4);}return _0x5ca44c[_0x34c4('0x24')]();};}function saveUpdates(_0x3b3a6f,_0x523f06){return function(_0x4fe6ca){if(_0x4fe6ca){return _0x4fe6ca['update'](_0x3b3a6f)[_0x34c4('0x25')](function(_0x496add){return _0x496add;});}return null;};}function removeEntity(_0x3a1a7c,_0x5bbfa0){return function(_0x37bfa7){if(_0x37bfa7){return _0x37bfa7['destroy']()[_0x34c4('0x25')](function(){var _0x152627=_0x37bfa7[_0x34c4('0x26')]({'plain':!![]});var _0x3d4c16=_0x34c4('0x27');return db[_0x34c4('0x28')][_0x34c4('0x29')]({'where':{'type':_0x3d4c16,'resourceId':_0x152627['id']}})[_0x34c4('0x25')](function(){return _0x37bfa7;});})['then'](function(){_0x3a1a7c[_0x34c4('0x1b')](0xcc)[_0x34c4('0x1a')]();});}};}function handleEntityNotFound(_0x10ef33,_0x2c7f3f){return function(_0x546ec7){if(!_0x546ec7){_0x10ef33[_0x34c4('0x19')](0x194);}return _0x546ec7;};}function handleError(_0x2204e1,_0x169443){_0x169443=_0x169443||0x1f4;return function(_0xaa9a22){logger['error'](_0xaa9a22[_0x34c4('0x2a')]);if(_0xaa9a22[_0x34c4('0x2b')]){delete _0xaa9a22[_0x34c4('0x2b')];}_0x2204e1[_0x34c4('0x1b')](_0x169443)[_0x34c4('0x2c')](_0xaa9a22);};}exports[_0x34c4('0x2d')]=function(_0x126f30,_0xe1100e){var _0x529e81={},_0x207bea={},_0x12b63e={'count':0x0,'rows':[]};var _0x584461=_[_0x34c4('0x2e')](db['Interval'][_0x34c4('0x2f')],function(_0x5027c3){return{'name':_0x5027c3['fieldName'],'type':_0x5027c3[_0x34c4('0x30')][_0x34c4('0x31')]};});_0x207bea[_0x34c4('0x32')]=_[_0x34c4('0x2e')](_0x584461,_0x34c4('0x2b'));_0x207bea[_0x34c4('0x33')]=_[_0x34c4('0x34')](_0x126f30['query']);_0x207bea[_0x34c4('0x35')]=_[_0x34c4('0x36')](_0x207bea[_0x34c4('0x32')],_0x207bea[_0x34c4('0x33')]);_0x529e81['attributes']=_[_0x34c4('0x36')](_0x207bea[_0x34c4('0x32')],qs['fields'](_0x126f30[_0x34c4('0x33')][_0x34c4('0x37')]));_0x529e81[_0x34c4('0x38')]=_0x529e81[_0x34c4('0x38')][_0x34c4('0x39')]?_0x529e81['attributes']:_0x207bea[_0x34c4('0x32')];if(!_0x126f30['query'][_0x34c4('0x3a')](_0x34c4('0x3b'))){_0x529e81[_0x34c4('0x1f')]=qs[_0x34c4('0x1f')](_0x126f30[_0x34c4('0x33')][_0x34c4('0x1f')]);_0x529e81['offset']=qs['offset'](_0x126f30['query'][_0x34c4('0x1d')]);}_0x529e81[_0x34c4('0x3c')]=qs[_0x34c4('0x3d')](_0x126f30[_0x34c4('0x33')]['sort']);_0x529e81['where']=qs[_0x34c4('0x35')](_['pick'](_0x126f30['query'],_0x207bea[_0x34c4('0x35')]),_0x584461);if(_0x126f30[_0x34c4('0x33')][_0x34c4('0x3e')]){_0x529e81[_0x34c4('0x3f')]=_[_0x34c4('0x40')](_0x529e81['where'],{'$or':_[_0x34c4('0x2e')](_0x584461,function(_0x46b03f){if(_0x46b03f[_0x34c4('0x30')]!==_0x34c4('0x41')){var _0x5b8aca={};_0x5b8aca[_0x46b03f['name']]={'$like':'%'+_0x126f30['query'][_0x34c4('0x3e')]+'%'};return _0x5b8aca;}})});}_0x529e81=_[_0x34c4('0x40')]({},_0x529e81,_0x126f30[_0x34c4('0x42')]);var _0x3aa917={'where':_0x529e81[_0x34c4('0x3f')]};return db[_0x34c4('0x43')][_0x34c4('0x44')](_0x3aa917)[_0x34c4('0x25')](function(_0x38dd58){_0x12b63e['count']=_0x38dd58;if(_0x126f30[_0x34c4('0x33')][_0x34c4('0x45')]){_0x529e81[_0x34c4('0x46')]=[{'all':!![]}];}return db[_0x34c4('0x43')][_0x34c4('0x47')](_0x529e81);})[_0x34c4('0x25')](function(_0x1d6d27){_0x12b63e[_0x34c4('0x48')]=_0x1d6d27;return _0x12b63e;})[_0x34c4('0x25')](respondWithFilteredResult(_0xe1100e,_0x529e81))[_0x34c4('0x49')](handleError(_0xe1100e,null));};exports[_0x34c4('0x4a')]=function(_0x538d3f,_0x3d4e1e){var _0x574af8={'raw':!![],'where':{'id':_0x538d3f[_0x34c4('0x4b')]['id']}},_0x2c90f5={};_0x2c90f5[_0x34c4('0x32')]=_['keys'](db[_0x34c4('0x43')]['rawAttributes']);_0x2c90f5[_0x34c4('0x33')]=_[_0x34c4('0x34')](_0x538d3f[_0x34c4('0x33')]);_0x2c90f5['filters']=_['intersection'](_0x2c90f5[_0x34c4('0x32')],_0x2c90f5[_0x34c4('0x33')]);_0x574af8[_0x34c4('0x38')]=_[_0x34c4('0x36')](_0x2c90f5[_0x34c4('0x32')],qs[_0x34c4('0x37')](_0x538d3f[_0x34c4('0x33')][_0x34c4('0x37')]));_0x574af8[_0x34c4('0x38')]=_0x574af8[_0x34c4('0x38')][_0x34c4('0x39')]?_0x574af8[_0x34c4('0x38')]:_0x2c90f5[_0x34c4('0x32')];if(_0x538d3f[_0x34c4('0x33')][_0x34c4('0x45')]){_0x574af8['include']=[{'all':!![]}];}_0x574af8=_['merge']({},_0x574af8,_0x538d3f[_0x34c4('0x42')]);return db['Interval']['find'](_0x574af8)[_0x34c4('0x25')](handleEntityNotFound(_0x3d4e1e,null))[_0x34c4('0x25')](respondWithResult(_0x3d4e1e,null))[_0x34c4('0x49')](handleError(_0x3d4e1e,null));};exports['create']=function(_0x1777ca,_0x17abe9){return db[_0x34c4('0x43')][_0x34c4('0x4c')](_0x1777ca['body'],{})[_0x34c4('0x25')](function(_0x3226dc){var _0x5401a2=_0x1777ca[_0x34c4('0x4d')]['get']({'plain':!![]});if(!_0x5401a2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5401a2[_0x34c4('0x4e')]===_0x34c4('0x4d')){var _0x25f553=_0x3226dc[_0x34c4('0x26')]({'plain':!![]});var _0x4de11e=_0x34c4('0x27');return db[_0x34c4('0x4f')][_0x34c4('0x50')]({'where':{'name':_0x4de11e,'userProfileId':_0x5401a2[_0x34c4('0x51')]},'raw':!![]})[_0x34c4('0x25')](function(_0x64ab08){if(_0x64ab08&&_0x64ab08['autoAssociation']===0x0){return db[_0x34c4('0x28')][_0x34c4('0x4c')]({'name':_0x25f553[_0x34c4('0x2b')],'resourceId':_0x25f553['id'],'type':_0x64ab08[_0x34c4('0x2b')],'sectionId':_0x64ab08['id']},{})[_0x34c4('0x25')](function(){return _0x3226dc;});}else{return _0x3226dc;}})['catch'](function(_0x3084b6){logger[_0x34c4('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3084b6);throw _0x3084b6;});}return _0x3226dc;})[_0x34c4('0x25')](respondWithResult(_0x17abe9,0xc9))[_0x34c4('0x49')](handleError(_0x17abe9,null));};exports[_0x34c4('0x53')]=function(_0x340c45,_0x25833a){if(_0x340c45[_0x34c4('0x54')]['id']){delete _0x340c45['body']['id'];}return db[_0x34c4('0x43')]['find']({'where':{'id':_0x340c45[_0x34c4('0x4b')]['id']}})[_0x34c4('0x25')](handleEntityNotFound(_0x25833a,null))['then'](saveUpdates(_0x340c45[_0x34c4('0x54')],null))['then'](respondWithResult(_0x25833a,null))[_0x34c4('0x49')](handleError(_0x25833a,null));};exports['destroy']=function(_0x368e40,_0x20624f){return db[_0x34c4('0x43')][_0x34c4('0x50')]({'where':{'id':_0x368e40[_0x34c4('0x4b')]['id']}})[_0x34c4('0x25')](handleEntityNotFound(_0x20624f,null))[_0x34c4('0x25')](removeEntity(_0x20624f,null))[_0x34c4('0x49')](handleError(_0x20624f,null));};exports[_0x34c4('0x55')]=function(_0x2985f5,_0x564fc9,_0x4a3d81){if(_0x2985f5[_0x34c4('0x54')]['id']){delete _0x2985f5[_0x34c4('0x54')]['id'];}return db[_0x34c4('0x43')][_0x34c4('0x50')]({'where':{'id':_0x2985f5[_0x34c4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x564fc9,null))['then'](function(_0x5df9fa){if(_0x5df9fa){_0x2985f5[_0x34c4('0x54')]['IntervalId']=_0x5df9fa['id'];return db['Interval']['create'](_0x2985f5[_0x34c4('0x54')]);}})[_0x34c4('0x25')](respondWithResult(_0x564fc9,null))[_0x34c4('0x49')](handleError(_0x564fc9,null));};exports[_0x34c4('0x56')]=function(_0x57ac19,_0x4efcb3,_0x156dd3){var _0x2be1e7={};var _0x24f388={};var _0x460e81;var _0x362605;return db[_0x34c4('0x43')][_0x34c4('0x57')]({'where':{'id':_0x57ac19[_0x34c4('0x4b')]['id']}})[_0x34c4('0x25')](handleEntityNotFound(_0x4efcb3,null))[_0x34c4('0x25')](function(_0x56b9f9){if(_0x56b9f9){_0x460e81=_0x56b9f9;_0x24f388[_0x34c4('0x32')]=_[_0x34c4('0x34')](db[_0x34c4('0x43')][_0x34c4('0x2f')]);_0x24f388[_0x34c4('0x33')]=_['keys'](_0x57ac19['query']);_0x24f388[_0x34c4('0x35')]=_['intersection'](_0x24f388[_0x34c4('0x32')],_0x24f388[_0x34c4('0x33')]);_0x2be1e7[_0x34c4('0x38')]=_[_0x34c4('0x36')](_0x24f388[_0x34c4('0x32')],qs[_0x34c4('0x37')](_0x57ac19['query'][_0x34c4('0x37')]));_0x2be1e7[_0x34c4('0x38')]=_0x2be1e7[_0x34c4('0x38')][_0x34c4('0x39')]?_0x2be1e7['attributes']:_0x24f388[_0x34c4('0x32')];_0x2be1e7[_0x34c4('0x3c')]=qs[_0x34c4('0x3d')](_0x57ac19[_0x34c4('0x33')][_0x34c4('0x3d')]);_0x2be1e7[_0x34c4('0x3f')]=qs[_0x34c4('0x35')](_[_0x34c4('0x58')](_0x57ac19[_0x34c4('0x33')],_0x24f388[_0x34c4('0x35')]));if(_0x57ac19[_0x34c4('0x33')]['filter']){_0x2be1e7[_0x34c4('0x3f')]=_[_0x34c4('0x40')](_0x2be1e7[_0x34c4('0x3f')],{'$or':_[_0x34c4('0x2e')](_0x2be1e7[_0x34c4('0x38')],function(_0x74f09f){var _0x35b394={};_0x35b394[_0x74f09f]={'$like':'%'+_0x57ac19['query']['filter']+'%'};return _0x35b394;})});}_0x2be1e7=_[_0x34c4('0x40')]({},_0x2be1e7,_0x57ac19[_0x34c4('0x42')]);return _0x460e81[_0x34c4('0x56')](_0x2be1e7);}})[_0x34c4('0x25')](function(_0x221bf9){if(_0x221bf9){_0x362605=_0x221bf9[_0x34c4('0x39')];if(!_0x57ac19['query'][_0x34c4('0x3a')](_0x34c4('0x3b'))){_0x2be1e7[_0x34c4('0x1f')]=qs[_0x34c4('0x1f')](_0x57ac19['query']['limit']);_0x2be1e7[_0x34c4('0x1d')]=qs[_0x34c4('0x1d')](_0x57ac19[_0x34c4('0x33')][_0x34c4('0x1d')]);}return _0x460e81['getIntervals'](_0x2be1e7);}})[_0x34c4('0x25')](function(_0x3192bc){if(_0x3192bc){return _0x3192bc?{'count':_0x362605,'rows':_0x3192bc}:null;}})[_0x34c4('0x25')](respondWithResult(_0x4efcb3,null))[_0x34c4('0x49')](handleError(_0x4efcb3,null));};exports[_0x34c4('0x59')]=function(_0x2b8104,_0x5d66d1,_0x3c8baf){return db[_0x34c4('0x43')][_0x34c4('0x57')]({'where':{'id':_0x2b8104[_0x34c4('0x4b')]['id']}})[_0x34c4('0x25')](handleEntityNotFound(_0x5d66d1,null))[_0x34c4('0x25')](function(_0x28ac04){if(_0x28ac04){return db[_0x34c4('0x5a')][_0x34c4('0x5b')](function(_0x41fd59){return db[_0x34c4('0x43')]['destroy']({'where':{'IntervalId':_0x2b8104[_0x34c4('0x4b')]['id']},'transaction':_0x41fd59})[_0x34c4('0x25')](function(_0x2f5c8b){var _0x2afceb=_['map'](_0x2b8104['body'],function(_0x423304){delete _0x423304['id'];_0x423304[_0x34c4('0x5c')]=_0x2b8104[_0x34c4('0x4b')]['id'];return _0x423304;});return db[_0x34c4('0x43')][_0x34c4('0x5d')](_0x2afceb,{'transaction':_0x41fd59});});})[_0x34c4('0x25')](function(){return db[_0x34c4('0x43')][_0x34c4('0x47')]({'where':{'IntervalId':_0x2b8104[_0x34c4('0x4b')]['id']}});});}})[_0x34c4('0x25')](respondWithResult(_0x5d66d1,null))['catch'](handleError(_0x5d66d1,null));}; \ No newline at end of file +var _0x7c8d=['params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','findOne','getIntervals','hasOwnProperty','nolimit','addIntervals','sequelize','transaction','findAll','eml-format','zip-dir','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','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','end','stack','name','send','index','map','Interval','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','type','options','includeAll','include','rows','catch','show'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7c8d,0x1ea));var _0xd7c8=function(_0x5f0937,_0x1bb8d7){_0x5f0937=_0x5f0937-0x0;var _0x82117e=_0x7c8d[_0x5f0937];return _0x82117e;};'use strict';var emlformat=require(_0xd7c8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd7c8('0x1'));var jsonpatch=require(_0xd7c8('0x2'));var rp=require(_0xd7c8('0x3'));var moment=require(_0xd7c8('0x4'));var BPromise=require(_0xd7c8('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd7c8('0x6'));var sox=require(_0xd7c8('0x7'));var csv=require(_0xd7c8('0x8'));var ejs=require(_0xd7c8('0x9'));var fs=require('fs');var fs_extra=require(_0xd7c8('0xa'));var _=require(_0xd7c8('0xb'));var squel=require('squel');var crypto=require(_0xd7c8('0xc'));var jsforce=require(_0xd7c8('0xd'));var deskjs=require(_0xd7c8('0xe'));var toCsv=require(_0xd7c8('0x8'));var querystring=require(_0xd7c8('0xf'));var Papa=require(_0xd7c8('0x10'));var Redis=require(_0xd7c8('0x11'));var authService=require(_0xd7c8('0x12'));var qs=require(_0xd7c8('0x13'));var as=require(_0xd7c8('0x14'));var hardwareService=require(_0xd7c8('0x15'));var logger=require(_0xd7c8('0x16'))('api');var utils=require(_0xd7c8('0x17'));var config=require(_0xd7c8('0x18'));var licenseUtil=require(_0xd7c8('0x19'));var db=require(_0xd7c8('0x1a'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x5f458e,_0x543f42){_0x543f42=_0x543f42||0xcc;return function(_0x2e890f){if(_0x2e890f){return _0x5f458e[_0xd7c8('0x1b')](_0x543f42);}return _0x5f458e[_0xd7c8('0x1c')](_0x543f42)['end']();};}function respondWithResult(_0x2c9957,_0x1bb745){_0x1bb745=_0x1bb745||0xc8;return function(_0x18199c){if(_0x18199c){return _0x2c9957['status'](_0x1bb745)[_0xd7c8('0x1d')](_0x18199c);}};}function respondWithFilteredResult(_0x126e34,_0x2e4ca6){return function(_0x5c80f5){if(_0x5c80f5){var _0x3e5f4c=typeof _0x2e4ca6[_0xd7c8('0x1e')]==='undefined'&&typeof _0x2e4ca6['limit']==='undefined';var _0x34136f=_0x5c80f5['count'];var _0x4c1403=_0x3e5f4c?0x0:_0x2e4ca6[_0xd7c8('0x1e')];var _0x13f851=_0x3e5f4c?_0x5c80f5[_0xd7c8('0x1f')]:_0x2e4ca6[_0xd7c8('0x1e')]+_0x2e4ca6[_0xd7c8('0x20')];var _0x1d775b;if(_0x13f851>=_0x34136f){_0x13f851=_0x34136f;_0x1d775b=0xc8;}else{_0x1d775b=0xce;}_0x126e34[_0xd7c8('0x1c')](_0x1d775b);return _0x126e34['set'](_0xd7c8('0x21'),_0x4c1403+'-'+_0x13f851+'/'+_0x34136f)[_0xd7c8('0x1d')](_0x5c80f5);}return null;};}function patchUpdates(_0x51866c){return function(_0x2a48a9){try{jsonpatch[_0xd7c8('0x22')](_0x2a48a9,_0x51866c,!![]);}catch(_0x2383e0){return BPromise[_0xd7c8('0x23')](_0x2383e0);}return _0x2a48a9[_0xd7c8('0x24')]();};}function saveUpdates(_0x43856a,_0x2b7964){return function(_0x2f37a3){if(_0x2f37a3){return _0x2f37a3[_0xd7c8('0x25')](_0x43856a)[_0xd7c8('0x26')](function(_0x105981){return _0x105981;});}return null;};}function removeEntity(_0x44a883,_0xd55595){return function(_0x3d3142){if(_0x3d3142){return _0x3d3142[_0xd7c8('0x27')]()['then'](function(){var _0x157193=_0x3d3142[_0xd7c8('0x28')]({'plain':!![]});var _0x44959a=_0xd7c8('0x29');return db[_0xd7c8('0x2a')][_0xd7c8('0x27')]({'where':{'type':_0x44959a,'resourceId':_0x157193['id']}})[_0xd7c8('0x26')](function(){return _0x3d3142;});})['then'](function(){_0x44a883[_0xd7c8('0x1c')](0xcc)[_0xd7c8('0x2b')]();});}};}function handleEntityNotFound(_0x196e7e,_0x1a3141){return function(_0x3808b2){if(!_0x3808b2){_0x196e7e[_0xd7c8('0x1b')](0x194);}return _0x3808b2;};}function handleError(_0x4cb6ae,_0xcc5419){_0xcc5419=_0xcc5419||0x1f4;return function(_0x3ef2f3){logger['error'](_0x3ef2f3[_0xd7c8('0x2c')]);if(_0x3ef2f3[_0xd7c8('0x2d')]){delete _0x3ef2f3['name'];}_0x4cb6ae[_0xd7c8('0x1c')](_0xcc5419)[_0xd7c8('0x2e')](_0x3ef2f3);};}exports[_0xd7c8('0x2f')]=function(_0xca3251,_0x5cbd75){var _0x137208={},_0x2df61e={},_0x3788cc={'count':0x0,'rows':[]};var _0x281f5f=_[_0xd7c8('0x30')](db[_0xd7c8('0x31')][_0xd7c8('0x32')],function(_0x4085cc){return{'name':_0x4085cc[_0xd7c8('0x33')],'type':_0x4085cc['type'][_0xd7c8('0x34')]};});_0x2df61e[_0xd7c8('0x35')]=_[_0xd7c8('0x30')](_0x281f5f,_0xd7c8('0x2d'));_0x2df61e[_0xd7c8('0x36')]=_[_0xd7c8('0x37')](_0xca3251['query']);_0x2df61e[_0xd7c8('0x38')]=_[_0xd7c8('0x39')](_0x2df61e[_0xd7c8('0x35')],_0x2df61e['query']);_0x137208['attributes']=_[_0xd7c8('0x39')](_0x2df61e[_0xd7c8('0x35')],qs[_0xd7c8('0x3a')](_0xca3251[_0xd7c8('0x36')]['fields']));_0x137208[_0xd7c8('0x3b')]=_0x137208['attributes'][_0xd7c8('0x3c')]?_0x137208[_0xd7c8('0x3b')]:_0x2df61e[_0xd7c8('0x35')];if(!_0xca3251[_0xd7c8('0x36')]['hasOwnProperty']('nolimit')){_0x137208[_0xd7c8('0x20')]=qs[_0xd7c8('0x20')](_0xca3251[_0xd7c8('0x36')][_0xd7c8('0x20')]);_0x137208['offset']=qs['offset'](_0xca3251[_0xd7c8('0x36')][_0xd7c8('0x1e')]);}_0x137208[_0xd7c8('0x3d')]=qs[_0xd7c8('0x3e')](_0xca3251[_0xd7c8('0x36')][_0xd7c8('0x3e')]);_0x137208[_0xd7c8('0x3f')]=qs[_0xd7c8('0x38')](_[_0xd7c8('0x40')](_0xca3251[_0xd7c8('0x36')],_0x2df61e[_0xd7c8('0x38')]),_0x281f5f);if(_0xca3251['query'][_0xd7c8('0x41')]){_0x137208[_0xd7c8('0x3f')]=_[_0xd7c8('0x42')](_0x137208[_0xd7c8('0x3f')],{'$or':_[_0xd7c8('0x30')](_0x281f5f,function(_0x319d31){if(_0x319d31[_0xd7c8('0x43')]!=='VIRTUAL'){var _0x1671a8={};_0x1671a8[_0x319d31['name']]={'$like':'%'+_0xca3251['query'][_0xd7c8('0x41')]+'%'};return _0x1671a8;}})});}_0x137208=_[_0xd7c8('0x42')]({},_0x137208,_0xca3251[_0xd7c8('0x44')]);var _0x10eaae={'where':_0x137208[_0xd7c8('0x3f')]};return db[_0xd7c8('0x31')][_0xd7c8('0x1f')](_0x10eaae)[_0xd7c8('0x26')](function(_0x4754a0){_0x3788cc[_0xd7c8('0x1f')]=_0x4754a0;if(_0xca3251[_0xd7c8('0x36')][_0xd7c8('0x45')]){_0x137208[_0xd7c8('0x46')]=[{'all':!![]}];}return db['Interval']['findAll'](_0x137208);})[_0xd7c8('0x26')](function(_0xfa8a9){_0x3788cc[_0xd7c8('0x47')]=_0xfa8a9;return _0x3788cc;})[_0xd7c8('0x26')](respondWithFilteredResult(_0x5cbd75,_0x137208))[_0xd7c8('0x48')](handleError(_0x5cbd75,null));};exports[_0xd7c8('0x49')]=function(_0x86ea6,_0x9fcb8d){var _0x5512c2={'raw':!![],'where':{'id':_0x86ea6[_0xd7c8('0x4a')]['id']}},_0x5bc986={};_0x5bc986['model']=_[_0xd7c8('0x37')](db[_0xd7c8('0x31')][_0xd7c8('0x32')]);_0x5bc986[_0xd7c8('0x36')]=_[_0xd7c8('0x37')](_0x86ea6[_0xd7c8('0x36')]);_0x5bc986[_0xd7c8('0x38')]=_[_0xd7c8('0x39')](_0x5bc986[_0xd7c8('0x35')],_0x5bc986[_0xd7c8('0x36')]);_0x5512c2['attributes']=_[_0xd7c8('0x39')](_0x5bc986[_0xd7c8('0x35')],qs['fields'](_0x86ea6[_0xd7c8('0x36')][_0xd7c8('0x3a')]));_0x5512c2[_0xd7c8('0x3b')]=_0x5512c2[_0xd7c8('0x3b')][_0xd7c8('0x3c')]?_0x5512c2[_0xd7c8('0x3b')]:_0x5bc986[_0xd7c8('0x35')];if(_0x86ea6['query']['includeAll']){_0x5512c2[_0xd7c8('0x46')]=[{'all':!![]}];}_0x5512c2=_[_0xd7c8('0x42')]({},_0x5512c2,_0x86ea6[_0xd7c8('0x44')]);return db[_0xd7c8('0x31')][_0xd7c8('0x4b')](_0x5512c2)[_0xd7c8('0x26')](handleEntityNotFound(_0x9fcb8d,null))[_0xd7c8('0x26')](respondWithResult(_0x9fcb8d,null))['catch'](handleError(_0x9fcb8d,null));};exports[_0xd7c8('0x4c')]=function(_0x56bed0,_0x37088e){return db['Interval']['create'](_0x56bed0[_0xd7c8('0x4d')],{})[_0xd7c8('0x26')](function(_0x1bc414){var _0x481030=_0x56bed0[_0xd7c8('0x4e')][_0xd7c8('0x28')]({'plain':!![]});if(!_0x481030)throw new Error(_0xd7c8('0x4f'));if(_0x481030[_0xd7c8('0x50')]===_0xd7c8('0x4e')){var _0x2de3da=_0x1bc414[_0xd7c8('0x28')]({'plain':!![]});var _0x255dc4=_0xd7c8('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x255dc4,'userProfileId':_0x481030[_0xd7c8('0x51')]},'raw':!![]})['then'](function(_0x385e3c){if(_0x385e3c&&_0x385e3c[_0xd7c8('0x52')]===0x0){return db[_0xd7c8('0x2a')]['create']({'name':_0x2de3da[_0xd7c8('0x2d')],'resourceId':_0x2de3da['id'],'type':_0x385e3c[_0xd7c8('0x2d')],'sectionId':_0x385e3c['id']},{})['then'](function(){return _0x1bc414;});}else{return _0x1bc414;}})[_0xd7c8('0x48')](function(_0x4ba347){logger['error'](_0xd7c8('0x53'),_0x4ba347);throw _0x4ba347;});}return _0x1bc414;})[_0xd7c8('0x26')](respondWithResult(_0x37088e,0xc9))[_0xd7c8('0x48')](handleError(_0x37088e,null));};exports['update']=function(_0x433cac,_0x3ec459){if(_0x433cac[_0xd7c8('0x4d')]['id']){delete _0x433cac[_0xd7c8('0x4d')]['id'];}return db[_0xd7c8('0x31')][_0xd7c8('0x4b')]({'where':{'id':_0x433cac[_0xd7c8('0x4a')]['id']}})[_0xd7c8('0x26')](handleEntityNotFound(_0x3ec459,null))[_0xd7c8('0x26')](saveUpdates(_0x433cac[_0xd7c8('0x4d')],null))[_0xd7c8('0x26')](respondWithResult(_0x3ec459,null))[_0xd7c8('0x48')](handleError(_0x3ec459,null));};exports[_0xd7c8('0x27')]=function(_0x5dc40f,_0x3e75a1){return db[_0xd7c8('0x31')][_0xd7c8('0x4b')]({'where':{'id':_0x5dc40f[_0xd7c8('0x4a')]['id']}})[_0xd7c8('0x26')](handleEntityNotFound(_0x3e75a1,null))['then'](removeEntity(_0x3e75a1,null))[_0xd7c8('0x48')](handleError(_0x3e75a1,null));};exports[_0xd7c8('0x54')]=function(_0x3f7a08,_0x2fa37e,_0x15ccc7){if(_0x3f7a08[_0xd7c8('0x4d')]['id']){delete _0x3f7a08[_0xd7c8('0x4d')]['id'];}return db[_0xd7c8('0x31')][_0xd7c8('0x4b')]({'where':{'id':_0x3f7a08[_0xd7c8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2fa37e,null))['then'](function(_0x5da672){if(_0x5da672){_0x3f7a08[_0xd7c8('0x4d')][_0xd7c8('0x55')]=_0x5da672['id'];return db[_0xd7c8('0x31')][_0xd7c8('0x4c')](_0x3f7a08[_0xd7c8('0x4d')]);}})[_0xd7c8('0x26')](respondWithResult(_0x2fa37e,null))[_0xd7c8('0x48')](handleError(_0x2fa37e,null));};exports['getIntervals']=function(_0x2a2777,_0x5f1284,_0x4516c1){var _0x2adb68={};var _0x2de51c={};var _0xc952b8;var _0x81cfaf;return db[_0xd7c8('0x31')][_0xd7c8('0x56')]({'where':{'id':_0x2a2777[_0xd7c8('0x4a')]['id']}})[_0xd7c8('0x26')](handleEntityNotFound(_0x5f1284,null))[_0xd7c8('0x26')](function(_0x289e75){if(_0x289e75){_0xc952b8=_0x289e75;_0x2de51c[_0xd7c8('0x35')]=_[_0xd7c8('0x37')](db[_0xd7c8('0x31')]['rawAttributes']);_0x2de51c[_0xd7c8('0x36')]=_[_0xd7c8('0x37')](_0x2a2777[_0xd7c8('0x36')]);_0x2de51c['filters']=_[_0xd7c8('0x39')](_0x2de51c[_0xd7c8('0x35')],_0x2de51c['query']);_0x2adb68[_0xd7c8('0x3b')]=_['intersection'](_0x2de51c[_0xd7c8('0x35')],qs[_0xd7c8('0x3a')](_0x2a2777[_0xd7c8('0x36')][_0xd7c8('0x3a')]));_0x2adb68[_0xd7c8('0x3b')]=_0x2adb68['attributes'][_0xd7c8('0x3c')]?_0x2adb68['attributes']:_0x2de51c[_0xd7c8('0x35')];_0x2adb68[_0xd7c8('0x3d')]=qs[_0xd7c8('0x3e')](_0x2a2777[_0xd7c8('0x36')][_0xd7c8('0x3e')]);_0x2adb68[_0xd7c8('0x3f')]=qs[_0xd7c8('0x38')](_[_0xd7c8('0x40')](_0x2a2777[_0xd7c8('0x36')],_0x2de51c[_0xd7c8('0x38')]));if(_0x2a2777['query'][_0xd7c8('0x41')]){_0x2adb68[_0xd7c8('0x3f')]=_['merge'](_0x2adb68[_0xd7c8('0x3f')],{'$or':_['map'](_0x2adb68[_0xd7c8('0x3b')],function(_0x1e170a){var _0x4b0af7={};_0x4b0af7[_0x1e170a]={'$like':'%'+_0x2a2777['query']['filter']+'%'};return _0x4b0af7;})});}_0x2adb68=_['merge']({},_0x2adb68,_0x2a2777[_0xd7c8('0x44')]);return _0xc952b8[_0xd7c8('0x57')](_0x2adb68);}})[_0xd7c8('0x26')](function(_0x40fb94){if(_0x40fb94){_0x81cfaf=_0x40fb94[_0xd7c8('0x3c')];if(!_0x2a2777[_0xd7c8('0x36')][_0xd7c8('0x58')](_0xd7c8('0x59'))){_0x2adb68[_0xd7c8('0x20')]=qs['limit'](_0x2a2777[_0xd7c8('0x36')][_0xd7c8('0x20')]);_0x2adb68['offset']=qs[_0xd7c8('0x1e')](_0x2a2777[_0xd7c8('0x36')]['offset']);}return _0xc952b8['getIntervals'](_0x2adb68);}})[_0xd7c8('0x26')](function(_0x12720f){if(_0x12720f){return _0x12720f?{'count':_0x81cfaf,'rows':_0x12720f}:null;}})[_0xd7c8('0x26')](respondWithResult(_0x5f1284,null))['catch'](handleError(_0x5f1284,null));};exports[_0xd7c8('0x5a')]=function(_0x47a0c5,_0x5b4d33,_0x3b7b12){return db['Interval'][_0xd7c8('0x56')]({'where':{'id':_0x47a0c5[_0xd7c8('0x4a')]['id']}})[_0xd7c8('0x26')](handleEntityNotFound(_0x5b4d33,null))['then'](function(_0x4da946){if(_0x4da946){return db[_0xd7c8('0x5b')][_0xd7c8('0x5c')](function(_0x4ca822){return db['Interval'][_0xd7c8('0x27')]({'where':{'IntervalId':_0x47a0c5[_0xd7c8('0x4a')]['id']},'transaction':_0x4ca822})[_0xd7c8('0x26')](function(_0x4956de){var _0x4fdf13=_[_0xd7c8('0x30')](_0x47a0c5[_0xd7c8('0x4d')],function(_0x5caa66){delete _0x5caa66['id'];_0x5caa66[_0xd7c8('0x55')]=_0x47a0c5[_0xd7c8('0x4a')]['id'];return _0x5caa66;});return db[_0xd7c8('0x31')]['bulkCreate'](_0x4fdf13,{'transaction':_0x4ca822});});})[_0xd7c8('0x26')](function(){return db[_0xd7c8('0x31')][_0xd7c8('0x5d')]({'where':{'IntervalId':_0x47a0c5[_0xd7c8('0x4a')]['id']}});});}})['then'](respondWithResult(_0x5b4d33,null))[_0xd7c8('0x48')](handleError(_0x5b4d33,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index b31f291..8562ee5 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 _0x80e6=['../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','util','../../config/logger','moment','bluebird','path','../../config/environment','./interval.attributes'];(function(_0x2c9b79,_0x7cf58b){var _0x265032=function(_0x188a92){while(--_0x188a92){_0x2c9b79['push'](_0x2c9b79['shift']());}};_0x265032(++_0x7cf58b);}(_0x80e6,0x1e7));var _0x680e=function(_0x58da15,_0x2334f1){_0x58da15=_0x58da15-0x0;var _0x5bfeb0=_0x80e6[_0x58da15];return _0x5bfeb0;};'use strict';var _=require('lodash');var util=require(_0x680e('0x0'));var logger=require(_0x680e('0x1'))('api');var moment=require(_0x680e('0x2'));var BPromise=require(_0x680e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x680e('0x4'));var rimraf=require('rimraf');var config=require(_0x680e('0x5'));var attributes=require(_0x680e('0x6'));var extensions=require(_0x680e('0x7'));module[_0x680e('0x8')]=function(_0xec34f5,_0x29ce29){return _0xec34f5[_0x680e('0x9')](_0x680e('0xa'),attributes,{'tableName':_0x680e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c0ae6,_0x1a691c){extensions[_0x680e('0xc')](_0xec34f5,_0x2c0ae6);},'afterBulkCreate':function(_0x18f7e3,_0x35306b,_0x49eda4){_0x49eda4();extensions['rewrite'](_0xec34f5,_0x18f7e3[0x0]);},'afterUpdate':function(_0x4d80a1,_0x46128d){extensions[_0x680e('0xc')](_0xec34f5,_0x4d80a1);},'afterDestroy':function(_0xd93d05,_0x4030ce){extensions['rewrite'](_0xec34f5,_0xd93d05);}}});}; \ No newline at end of file +var _0xf9dd=['api','moment','request-promise','path','../../components/extensions/rewrite','exports','Interval','rewrite','../../config/logger'];(function(_0x278324,_0x4f2187){var _0x524a08=function(_0x460929){while(--_0x460929){_0x278324['push'](_0x278324['shift']());}};_0x524a08(++_0x4f2187);}(_0xf9dd,0x1af));var _0xdf9d=function(_0x26d2a9,_0x4e4d9d){_0x26d2a9=_0x26d2a9-0x0;var _0x512b66=_0xf9dd[_0x26d2a9];return _0x512b66;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdf9d('0x0'))(_0xdf9d('0x1'));var moment=require(_0xdf9d('0x2'));var BPromise=require('bluebird');var rp=require(_0xdf9d('0x3'));var fs=require('fs');var path=require(_0xdf9d('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./interval.attributes');var extensions=require(_0xdf9d('0x5'));module[_0xdf9d('0x6')]=function(_0x4a8f21,_0x5e4049){return _0x4a8f21['define'](_0xdf9d('0x7'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x264af4,_0x473e1d){extensions[_0xdf9d('0x8')](_0x4a8f21,_0x264af4);},'afterBulkCreate':function(_0x285c25,_0x21cc51,_0x176320){_0x176320();extensions[_0xdf9d('0x8')](_0x4a8f21,_0x285c25[0x0]);},'afterUpdate':function(_0x26301b,_0x1f68d5){extensions[_0xdf9d('0x8')](_0x4a8f21,_0x26301b);},'afterDestroy':function(_0x3ffd77,_0x5ddeb8){extensions['rewrite'](_0x4a8f21,_0x3ffd77);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index c64ef18..8053fc5 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(_0x21af3a,_0x386e1d){var _0x268a49=function(_0x41a650){while(--_0x41a650){_0x21af3a['push'](_0x21af3a['shift']());}};_0x268a49(++_0x386e1d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 b78ced0..af3ef2d 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 _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2650e9,_0xb91cc){_0x2650e9=_0x2650e9-0x0;var _0x3511c8=_0x0b0e[_0x2650e9];return _0x3511c8;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file +var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0xbcba57,_0x468cc5){var _0x1e9c90=function(_0x24dc0a){while(--_0x24dc0a){_0xbcba57['push'](_0xbcba57['shift']());}};_0x1e9c90(++_0x468cc5);}(_0xadb5,0xad));var _0x5adb=function(_0x1b0439,_0x1c9be0){_0x1b0439=_0x1b0439-0x0;var _0x1eb2e5=_0xadb5[_0x1b0439];return _0x1eb2e5;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index fd42c72..13725f9 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 _0xddce=['setEncoding','end','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','connection','remoteAddress','socket','bluebird','https','api','3eAmWpBVP0','key','summary','Report','stringify','issuetype','Bug','customfield_11500','fields','oldToken','newToken','customfield_11503','name','customfield_11504','customfield_10102','track.xcallymotion.com','application/json','Basic\x20','toString','base64'];(function(_0x1cd29f,_0x5b5dd6){var _0x68127d=function(_0xe24178){while(--_0xe24178){_0x1cd29f['push'](_0x1cd29f['shift']());}};_0x68127d(++_0x5b5dd6);}(_0xddce,0xf3));var _0xeddc=function(_0x1cf427,_0x257b88){_0x1cf427=_0x1cf427-0x0;var _0x5b6a71=_0xddce[_0x1cf427];return _0x5b6a71;};'use strict';var BPromise=require(_0xeddc('0x0'));var https=require(_0xeddc('0x1'));var logger=require('../../config/logger')(_0xeddc('0x2'));var USERNAME='support';var PASSWORD=_0xeddc('0x3');function openIssue(_0x243ee3,_0x251d07){var _0x448328={'fields':{'project':{'key':_0x243ee3[_0xeddc('0x4')]||'MOTGUI'},'summary':(_0x243ee3[_0xeddc('0x5')]||_0xeddc('0x6'))+'\x20from\x20'+_0x243ee3['ip'],'description':_0x243ee3['description']||JSON[_0xeddc('0x7')](_0x243ee3),'issuetype':{'name':_0x243ee3[_0xeddc('0x8')]||_0xeddc('0x9')}}};_0x448328['fields'][_0xeddc('0xa')]=_0x243ee3['email'];_0x448328[_0xeddc('0xb')]['customfield_11501']=_0x243ee3[_0xeddc('0xc')];_0x448328['fields']['customfield_11502']=_0x243ee3[_0xeddc('0xd')];_0x448328[_0xeddc('0xb')][_0xeddc('0xe')]=_0x243ee3[_0xeddc('0xf')];_0x448328[_0xeddc('0xb')][_0xeddc('0x10')]=_0x243ee3['reason'];_0x448328[_0xeddc('0xb')][_0xeddc('0x11')]=_0x243ee3['ip'];var _0x63445e={'host':_0xeddc('0x12'),'port':0x1bb,'path':'/rest/api/2/issue','method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0xeddc('0x13'),'Authorization':_0xeddc('0x14')+new Buffer(USERNAME+':'+PASSWORD)[_0xeddc('0x15')](_0xeddc('0x16'))}};var _0x1fb052=JSON[_0xeddc('0x7')](_0x448328);var _0x544108=https['request'](_0x63445e,function(_0x3f84e7){_0x3f84e7[_0xeddc('0x17')]('utf8');var _0xcc37dd='';_0x3f84e7['on']('data',function(_0x48084a){_0xcc37dd+=_0x48084a;});_0x3f84e7['on'](_0xeddc('0x18'),function(){if(_0x251d07){return _0x251d07[_0xeddc('0x19')](_0x3f84e7[_0xeddc('0x1a')])[_0xeddc('0x1b')](JSON[_0xeddc('0x1c')](_0xcc37dd));}});});_0x544108['on']('error',function(_0x37de5e){if(_0x251d07){return _0x251d07['status'](0x1f4)['json']({'errors':[{'message':_0xeddc('0x1d'),'type':_0xeddc('0x1e')}]});}});_0x544108[_0xeddc('0x1f')](_0x1fb052);_0x544108[_0xeddc('0x18')]();}exports[_0xeddc('0x20')]=openIssue;exports[_0xeddc('0x21')]=function(_0x14686e,_0x49e694){_0x14686e[_0xeddc('0x22')]['ip']=_0x14686e['headers']['x-forwarded-for']||_0x14686e[_0xeddc('0x23')][_0xeddc('0x24')]||_0x14686e[_0xeddc('0x25')][_0xeddc('0x24')]||_0x14686e[_0xeddc('0x23')][_0xeddc('0x25')]['remoteAddress'];return openIssue(_0x14686e['body'],_0x49e694);}; \ No newline at end of file +var _0x6b28=['Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','json','parse','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','bluebird','https','support','3eAmWpBVP0','summary','Report','\x20from\x20','description','stringify','issuetype','fields','customfield_11500','email','oldToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0x6b28,0x71));var _0x86b2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b28[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x86b2('0x0'));var https=require(_0x86b2('0x1'));var logger=require('../../config/logger')('api');var USERNAME=_0x86b2('0x2');var PASSWORD=_0x86b2('0x3');function openIssue(_0x56cffa,_0x2e531a){var _0xc94e85={'fields':{'project':{'key':_0x56cffa['key']||'MOTGUI'},'summary':(_0x56cffa[_0x86b2('0x4')]||_0x86b2('0x5'))+_0x86b2('0x6')+_0x56cffa['ip'],'description':_0x56cffa[_0x86b2('0x7')]||JSON[_0x86b2('0x8')](_0x56cffa),'issuetype':{'name':_0x56cffa[_0x86b2('0x9')]||'Bug'}}};_0xc94e85[_0x86b2('0xa')][_0x86b2('0xb')]=_0x56cffa[_0x86b2('0xc')];_0xc94e85[_0x86b2('0xa')]['customfield_11501']=_0x56cffa[_0x86b2('0xd')];_0xc94e85[_0x86b2('0xa')]['customfield_11502']=_0x56cffa['newToken'];_0xc94e85[_0x86b2('0xa')][_0x86b2('0xe')]=_0x56cffa[_0x86b2('0xf')];_0xc94e85[_0x86b2('0xa')][_0x86b2('0x10')]=_0x56cffa[_0x86b2('0x11')];_0xc94e85[_0x86b2('0xa')][_0x86b2('0x12')]=_0x56cffa['ip'];var _0x37e231={'host':_0x86b2('0x13'),'port':0x1bb,'path':_0x86b2('0x14'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x86b2('0x15'),'Authorization':_0x86b2('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0x86b2('0x17')](_0x86b2('0x18'))}};var _0xcc764e=JSON[_0x86b2('0x8')](_0xc94e85);var _0x35cbb1=https[_0x86b2('0x19')](_0x37e231,function(_0x454f62){_0x454f62[_0x86b2('0x1a')](_0x86b2('0x1b'));var _0x1b51f2='';_0x454f62['on'](_0x86b2('0x1c'),function(_0x1cdddc){_0x1b51f2+=_0x1cdddc;});_0x454f62['on'](_0x86b2('0x1d'),function(){if(_0x2e531a){return _0x2e531a[_0x86b2('0x1e')](_0x454f62[_0x86b2('0x1f')])[_0x86b2('0x20')](JSON[_0x86b2('0x21')](_0x1b51f2));}});});_0x35cbb1['on']('error',function(_0x5ae81e){if(_0x2e531a){return _0x2e531a[_0x86b2('0x1e')](0x1f4)[_0x86b2('0x20')]({'errors':[{'message':_0x86b2('0x22'),'type':_0x86b2('0x23')}]});}});_0x35cbb1[_0x86b2('0x24')](_0xcc764e);_0x35cbb1[_0x86b2('0x1d')]();}exports[_0x86b2('0x25')]=openIssue;exports[_0x86b2('0x26')]=function(_0x40b814,_0x3a70d6){_0x40b814[_0x86b2('0x27')]['ip']=_0x40b814[_0x86b2('0x28')][_0x86b2('0x29')]||_0x40b814[_0x86b2('0x2a')][_0x86b2('0x2b')]||_0x40b814[_0x86b2('0x2c')][_0x86b2('0x2b')]||_0x40b814[_0x86b2('0x2a')][_0x86b2('0x2c')]['remoteAddress'];return openIssue(_0x40b814[_0x86b2('0x27')],_0x3a70d6);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index a822482..cf08e7a 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 _0xcb91=['get','index','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller'];(function(_0x581d11,_0x483221){var _0x282199=function(_0x1bcb67){while(--_0x1bcb67){_0x581d11['push'](_0x581d11['shift']());}};_0x282199(++_0x483221);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x29e35f,_0x4859ef){_0x29e35f=_0x29e35f-0x0;var _0x266b74=_0xcb91[_0x29e35f];return _0x266b74;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0xe')](_0x1cb9('0xb'),auth['isAuthenticated'](),controller[_0x1cb9('0xf')]);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);module['exports']=router; \ No newline at end of file +var _0xfd28=['show','put','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x1655bb,_0x5a82ae){var _0x5e2020=function(_0x1ccfb4){while(--_0x1ccfb4){_0x1655bb['push'](_0x1655bb['shift']());}};_0x5e2020(++_0x5a82ae);}(_0xfd28,0x148));var _0x8fd2=function(_0x1d80be,_0x3a60ff){_0x1d80be=_0x1d80be-0x0;var _0xf9a4f3=_0xfd28[_0x1d80be];return _0xf9a4f3;};'use strict';var multer=require('multer');var util=require(_0x8fd2('0x0'));var path=require(_0x8fd2('0x1'));var timeout=require('connect-timeout');var express=require(_0x8fd2('0x2'));var router=express['Router']();var fs_extra=require(_0x8fd2('0x3'));var auth=require(_0x8fd2('0x4'));var interaction=require(_0x8fd2('0x5'));var config=require('../../config/environment');var controller=require(_0x8fd2('0x6'));router[_0x8fd2('0x7')]('/',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0x9')]);router[_0x8fd2('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x8fd2('0xa')]);router[_0x8fd2('0x7')](_0x8fd2('0xb'),auth['isAuthenticated'](),controller[_0x8fd2('0xc')]);router['post']('/',auth[_0x8fd2('0x8')](),controller['create']);router[_0x8fd2('0xd')]('/:id',auth[_0x8fd2('0x8')](),controller['update']);router[_0x8fd2('0xe')]('/:id',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0xf')]);module[_0x8fd2('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 1f79f9e..94a0967 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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7a54,0x106));var _0x47a5=function(_0x3c209e,_0x44ec1d){_0x3c209e=_0x3c209e-0x0;var _0x3cddb2=_0x7a54[_0x3c209e];return _0x3cddb2;};'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(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x7a54,0x106));var _0x47a5=function(_0x375857,_0x14b064){_0x375857=_0x375857-0x0;var _0x5cdad7=_0x7a54[_0x375857];return _0x5cdad7;};'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 43870ea..19d9754 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 _0x5d58=['undefined','limit','count','set','apply','then','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','JscriptyAnswerReport','include','findAll','rows','show','params','rawAttributes','keys','length','includeAll','merge','create','update','find','catch','destroy','describe','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x335271,_0x5025f2){var _0xa9fff8=function(_0x28d0bd){while(--_0x28d0bd){_0x335271['push'](_0x335271['shift']());}};_0xa9fff8(++_0x5025f2);}(_0x5d58,0x187));var _0x85d5=function(_0x370718,_0x2efd20){_0x370718=_0x370718-0x0;var _0x27d7b1=_0x5d58[_0x370718];return _0x27d7b1;};'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(_0x85d5('0x0'));var BPromise=require(_0x85d5('0x1'));var Mustache=require('mustache');var util=require(_0x85d5('0x2'));var path=require(_0x85d5('0x3'));var sox=require('sox');var csv=require(_0x85d5('0x4'));var ejs=require(_0x85d5('0x5'));var fs=require('fs');var fs_extra=require(_0x85d5('0x6'));var _=require(_0x85d5('0x7'));var squel=require('squel');var crypto=require(_0x85d5('0x8'));var jsforce=require(_0x85d5('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x85d5('0x4'));var querystring=require('querystring');var Papa=require(_0x85d5('0xa'));var Redis=require(_0x85d5('0xb'));var authService=require(_0x85d5('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x85d5('0xd'))(_0x85d5('0xe'));var utils=require(_0x85d5('0xf'));var config=require(_0x85d5('0x10'));var licenseUtil=require(_0x85d5('0x11'));var db=require(_0x85d5('0x12'))['db'];function respondWithStatusCode(_0x31409d,_0x5897af){_0x5897af=_0x5897af||0xcc;return function(_0x4bbf2a){if(_0x4bbf2a){return _0x31409d['sendStatus'](_0x5897af);}return _0x31409d[_0x85d5('0x13')](_0x5897af)[_0x85d5('0x14')]();};}function respondWithResult(_0x339d4f,_0x1704f0){_0x1704f0=_0x1704f0||0xc8;return function(_0x18a20c){if(_0x18a20c){return _0x339d4f[_0x85d5('0x13')](_0x1704f0)[_0x85d5('0x15')](_0x18a20c);}};}function respondWithFilteredResult(_0x586382,_0x18e977){return function(_0x2d7c95){if(_0x2d7c95){var _0x1621ed=typeof _0x18e977[_0x85d5('0x16')]===_0x85d5('0x17')&&typeof _0x18e977[_0x85d5('0x18')]===_0x85d5('0x17');var _0x12bef9=_0x2d7c95[_0x85d5('0x19')];var _0x17acb0=_0x1621ed?0x0:_0x18e977[_0x85d5('0x16')];var _0x432bd6=_0x1621ed?_0x2d7c95[_0x85d5('0x19')]:_0x18e977[_0x85d5('0x16')]+_0x18e977[_0x85d5('0x18')];var _0x26981b;if(_0x432bd6>=_0x12bef9){_0x432bd6=_0x12bef9;_0x26981b=0xc8;}else{_0x26981b=0xce;}_0x586382[_0x85d5('0x13')](_0x26981b);return _0x586382[_0x85d5('0x1a')]('Content-Range',_0x17acb0+'-'+_0x432bd6+'/'+_0x12bef9)[_0x85d5('0x15')](_0x2d7c95);}return null;};}function patchUpdates(_0x133fa9){return function(_0x5f5755){try{jsonpatch[_0x85d5('0x1b')](_0x5f5755,_0x133fa9,!![]);}catch(_0x1264ca){return BPromise['reject'](_0x1264ca);}return _0x5f5755['save']();};}function saveUpdates(_0x347337,_0x5a1b9a){return function(_0x2f2bae){if(_0x2f2bae){return _0x2f2bae['update'](_0x347337)[_0x85d5('0x1c')](function(_0x1f8d27){return _0x1f8d27;});}return null;};}function removeEntity(_0x560b3a,_0x4e11c4){return function(_0x4da71b){if(_0x4da71b){return _0x4da71b['destroy']()[_0x85d5('0x1c')](function(){_0x560b3a[_0x85d5('0x13')](0xcc)[_0x85d5('0x14')]();});}};}function handleEntityNotFound(_0x466bbd,_0x12fea3){return function(_0xef2405){if(!_0xef2405){_0x466bbd['sendStatus'](0x194);}return _0xef2405;};}function handleError(_0x7e9a11,_0x4f8c66){_0x4f8c66=_0x4f8c66||0x1f4;return function(_0x1b3fae){logger[_0x85d5('0x1d')](_0x1b3fae[_0x85d5('0x1e')]);if(_0x1b3fae['name']){delete _0x1b3fae[_0x85d5('0x1f')];}_0x7e9a11[_0x85d5('0x13')](_0x4f8c66)[_0x85d5('0x20')](_0x1b3fae);};}exports[_0x85d5('0x21')]=function(_0x4605c5,_0x56031f){var _0x1cbef1={},_0x476c8b={},_0x330f8a={'count':0x0,'rows':[]};var _0x22a961=_[_0x85d5('0x22')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x2ce7a9){return{'name':_0x2ce7a9[_0x85d5('0x23')],'type':_0x2ce7a9[_0x85d5('0x24')][_0x85d5('0x25')]};});_0x476c8b[_0x85d5('0x26')]=_['map'](_0x22a961,_0x85d5('0x1f'));_0x476c8b[_0x85d5('0x27')]=_['keys'](_0x4605c5['query']);_0x476c8b[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x476c8b['model'],_0x476c8b[_0x85d5('0x27')]);_0x1cbef1['attributes']=_[_0x85d5('0x29')](_0x476c8b[_0x85d5('0x26')],qs['fields'](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x1cbef1[_0x85d5('0x2b')]=_0x1cbef1[_0x85d5('0x2b')]['length']?_0x1cbef1['attributes']:_0x476c8b[_0x85d5('0x26')];if(!_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2c')](_0x85d5('0x2d'))){_0x1cbef1[_0x85d5('0x18')]=qs[_0x85d5('0x18')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x18')]);_0x1cbef1[_0x85d5('0x16')]=qs['offset'](_0x4605c5['query'][_0x85d5('0x16')]);}_0x1cbef1[_0x85d5('0x2e')]=qs[_0x85d5('0x2f')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2f')]);_0x1cbef1[_0x85d5('0x30')]=qs[_0x85d5('0x28')](_[_0x85d5('0x31')](_0x4605c5['query'],_0x476c8b[_0x85d5('0x28')]),_0x22a961);if(_0x4605c5[_0x85d5('0x27')][_0x85d5('0x32')]){_0x1cbef1[_0x85d5('0x30')]=_['merge'](_0x1cbef1[_0x85d5('0x30')],{'$or':_[_0x85d5('0x22')](_0x22a961,function(_0x3282d3){if(_0x3282d3[_0x85d5('0x24')]!=='VIRTUAL'){var _0x34caed={};_0x34caed[_0x3282d3['name']]={'$like':'%'+_0x4605c5['query'][_0x85d5('0x32')]+'%'};return _0x34caed;}})});}_0x1cbef1=_['merge']({},_0x1cbef1,_0x4605c5[_0x85d5('0x33')]);var _0x5ddba7={'where':_0x1cbef1['where']};return db[_0x85d5('0x34')][_0x85d5('0x19')](_0x5ddba7)[_0x85d5('0x1c')](function(_0x1beffc){_0x330f8a[_0x85d5('0x19')]=_0x1beffc;if(_0x4605c5['query']['includeAll']){_0x1cbef1[_0x85d5('0x35')]=[{'all':!![]}];}return db[_0x85d5('0x34')][_0x85d5('0x36')](_0x1cbef1);})[_0x85d5('0x1c')](function(_0xdd8b3e){_0x330f8a[_0x85d5('0x37')]=_0xdd8b3e;return _0x330f8a;})['then'](respondWithFilteredResult(_0x56031f,_0x1cbef1))['catch'](handleError(_0x56031f,null));};exports[_0x85d5('0x38')]=function(_0x52c99b,_0xfbf466){var _0x18e94d={'raw':!![],'where':{'id':_0x52c99b[_0x85d5('0x39')]['id']}},_0x7dd430={};_0x7dd430[_0x85d5('0x26')]=_['keys'](db['JscriptyAnswerReport'][_0x85d5('0x3a')]);_0x7dd430[_0x85d5('0x27')]=_[_0x85d5('0x3b')](_0x52c99b[_0x85d5('0x27')]);_0x7dd430[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],_0x7dd430[_0x85d5('0x27')]);_0x18e94d[_0x85d5('0x2b')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],qs[_0x85d5('0x2a')](_0x52c99b[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x18e94d[_0x85d5('0x2b')]=_0x18e94d[_0x85d5('0x2b')][_0x85d5('0x3c')]?_0x18e94d['attributes']:_0x7dd430['model'];if(_0x52c99b[_0x85d5('0x27')][_0x85d5('0x3d')]){_0x18e94d[_0x85d5('0x35')]=[{'all':!![]}];}_0x18e94d=_[_0x85d5('0x3e')]({},_0x18e94d,_0x52c99b[_0x85d5('0x33')]);return db[_0x85d5('0x34')]['find'](_0x18e94d)[_0x85d5('0x1c')](handleEntityNotFound(_0xfbf466,null))['then'](respondWithResult(_0xfbf466,null))['catch'](handleError(_0xfbf466,null));};exports[_0x85d5('0x3f')]=function(_0x13ab32,_0x12a03){return db[_0x85d5('0x34')][_0x85d5('0x3f')](_0x13ab32['body'],{})[_0x85d5('0x1c')](respondWithResult(_0x12a03,0xc9))['catch'](handleError(_0x12a03,null));};exports[_0x85d5('0x40')]=function(_0xd8db57,_0x219154){if(_0xd8db57['body']['id']){delete _0xd8db57['body']['id'];}return db['JscriptyAnswerReport'][_0x85d5('0x41')]({'where':{'id':_0xd8db57[_0x85d5('0x39')]['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x219154,null))['then'](saveUpdates(_0xd8db57['body'],null))[_0x85d5('0x1c')](respondWithResult(_0x219154,null))[_0x85d5('0x42')](handleError(_0x219154,null));};exports[_0x85d5('0x43')]=function(_0x288b56,_0x4b2dce){return db[_0x85d5('0x34')][_0x85d5('0x41')]({'where':{'id':_0x288b56[_0x85d5('0x39')]['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x4b2dce,null))[_0x85d5('0x1c')](removeEntity(_0x4b2dce,null))[_0x85d5('0x42')](handleError(_0x4b2dce,null));};exports[_0x85d5('0x44')]=function(_0x34b784,_0x185a70){return db[_0x85d5('0x34')][_0x85d5('0x44')]()[_0x85d5('0x1c')](respondWithResult(_0x185a70,null))[_0x85d5('0x42')](handleError(_0x185a70,null));}; \ No newline at end of file +var _0x2f74=['sendStatus','status','json','offset','undefined','limit','count','set','save','update','then','destroy','end','error','stack','name','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','JscriptyAnswerReport','includeAll','include','show','params','keys','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x22d584,_0x5605d4){var _0x2ea23e=function(_0x323bfc){while(--_0x323bfc){_0x22d584['push'](_0x22d584['shift']());}};_0x2ea23e(++_0x5605d4);}(_0x2f74,0x7b));var _0x42f7=function(_0x47066d,_0x2ea60d){_0x47066d=_0x47066d-0x0;var _0x34baa9=_0x2f74[_0x47066d];return _0x34baa9;};'use strict';var emlformat=require(_0x42f7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x42f7('0x1'));var jsonpatch=require(_0x42f7('0x2'));var rp=require(_0x42f7('0x3'));var moment=require(_0x42f7('0x4'));var BPromise=require(_0x42f7('0x5'));var Mustache=require(_0x42f7('0x6'));var util=require(_0x42f7('0x7'));var path=require(_0x42f7('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x42f7('0x9'));var _=require(_0x42f7('0xa'));var squel=require(_0x42f7('0xb'));var crypto=require(_0x42f7('0xc'));var jsforce=require(_0x42f7('0xd'));var deskjs=require(_0x42f7('0xe'));var toCsv=require(_0x42f7('0xf'));var querystring=require(_0x42f7('0x10'));var Papa=require('papaparse');var Redis=require(_0x42f7('0x11'));var authService=require(_0x42f7('0x12'));var qs=require(_0x42f7('0x13'));var as=require(_0x42f7('0x14'));var hardwareService=require(_0x42f7('0x15'));var logger=require(_0x42f7('0x16'))('api');var utils=require(_0x42f7('0x17'));var config=require(_0x42f7('0x18'));var licenseUtil=require(_0x42f7('0x19'));var db=require(_0x42f7('0x1a'))['db'];function respondWithStatusCode(_0x159c7a,_0x406f85){_0x406f85=_0x406f85||0xcc;return function(_0x34bafc){if(_0x34bafc){return _0x159c7a[_0x42f7('0x1b')](_0x406f85);}return _0x159c7a['status'](_0x406f85)['end']();};}function respondWithResult(_0x32ab1e,_0xc274ff){_0xc274ff=_0xc274ff||0xc8;return function(_0x15d327){if(_0x15d327){return _0x32ab1e[_0x42f7('0x1c')](_0xc274ff)[_0x42f7('0x1d')](_0x15d327);}};}function respondWithFilteredResult(_0x512143,_0x344b85){return function(_0x4d7944){if(_0x4d7944){var _0x3e7fd8=typeof _0x344b85[_0x42f7('0x1e')]===_0x42f7('0x1f')&&typeof _0x344b85[_0x42f7('0x20')]===_0x42f7('0x1f');var _0xa1bb54=_0x4d7944[_0x42f7('0x21')];var _0x47aa1d=_0x3e7fd8?0x0:_0x344b85[_0x42f7('0x1e')];var _0x29f472=_0x3e7fd8?_0x4d7944[_0x42f7('0x21')]:_0x344b85[_0x42f7('0x1e')]+_0x344b85[_0x42f7('0x20')];var _0x9270e3;if(_0x29f472>=_0xa1bb54){_0x29f472=_0xa1bb54;_0x9270e3=0xc8;}else{_0x9270e3=0xce;}_0x512143['status'](_0x9270e3);return _0x512143[_0x42f7('0x22')]('Content-Range',_0x47aa1d+'-'+_0x29f472+'/'+_0xa1bb54)[_0x42f7('0x1d')](_0x4d7944);}return null;};}function patchUpdates(_0x5d9fcf){return function(_0xc3e671){try{jsonpatch['apply'](_0xc3e671,_0x5d9fcf,!![]);}catch(_0x4d5f51){return BPromise['reject'](_0x4d5f51);}return _0xc3e671[_0x42f7('0x23')]();};}function saveUpdates(_0x313e72,_0x3a04db){return function(_0x2a755a){if(_0x2a755a){return _0x2a755a[_0x42f7('0x24')](_0x313e72)[_0x42f7('0x25')](function(_0x3b12a7){return _0x3b12a7;});}return null;};}function removeEntity(_0xf43a13,_0x1d45a0){return function(_0x372709){if(_0x372709){return _0x372709[_0x42f7('0x26')]()[_0x42f7('0x25')](function(){_0xf43a13[_0x42f7('0x1c')](0xcc)[_0x42f7('0x27')]();});}};}function handleEntityNotFound(_0x553531,_0x56627d){return function(_0x10e6f7){if(!_0x10e6f7){_0x553531[_0x42f7('0x1b')](0x194);}return _0x10e6f7;};}function handleError(_0x445e03,_0x3bb6bc){_0x3bb6bc=_0x3bb6bc||0x1f4;return function(_0x1e31de){logger[_0x42f7('0x28')](_0x1e31de[_0x42f7('0x29')]);if(_0x1e31de[_0x42f7('0x2a')]){delete _0x1e31de[_0x42f7('0x2a')];}_0x445e03[_0x42f7('0x1c')](_0x3bb6bc)['send'](_0x1e31de);};}exports['index']=function(_0x4022dd,_0x1b0977){var _0x1c4dc9={},_0x4d7137={},_0x324318={'count':0x0,'rows':[]};var _0x2eed6c=_['map'](db['JscriptyAnswerReport'][_0x42f7('0x2b')],function(_0xb1209c){return{'name':_0xb1209c[_0x42f7('0x2c')],'type':_0xb1209c[_0x42f7('0x2d')][_0x42f7('0x2e')]};});_0x4d7137[_0x42f7('0x2f')]=_[_0x42f7('0x30')](_0x2eed6c,_0x42f7('0x2a'));_0x4d7137[_0x42f7('0x31')]=_['keys'](_0x4022dd[_0x42f7('0x31')]);_0x4d7137[_0x42f7('0x32')]=_[_0x42f7('0x33')](_0x4d7137[_0x42f7('0x2f')],_0x4d7137[_0x42f7('0x31')]);_0x1c4dc9['attributes']=_[_0x42f7('0x33')](_0x4d7137[_0x42f7('0x2f')],qs[_0x42f7('0x34')](_0x4022dd[_0x42f7('0x31')]['fields']));_0x1c4dc9[_0x42f7('0x35')]=_0x1c4dc9['attributes'][_0x42f7('0x36')]?_0x1c4dc9[_0x42f7('0x35')]:_0x4d7137[_0x42f7('0x2f')];if(!_0x4022dd[_0x42f7('0x31')][_0x42f7('0x37')](_0x42f7('0x38'))){_0x1c4dc9[_0x42f7('0x20')]=qs['limit'](_0x4022dd['query'][_0x42f7('0x20')]);_0x1c4dc9[_0x42f7('0x1e')]=qs['offset'](_0x4022dd[_0x42f7('0x31')]['offset']);}_0x1c4dc9[_0x42f7('0x39')]=qs[_0x42f7('0x3a')](_0x4022dd['query']['sort']);_0x1c4dc9['where']=qs[_0x42f7('0x32')](_['pick'](_0x4022dd[_0x42f7('0x31')],_0x4d7137[_0x42f7('0x32')]),_0x2eed6c);if(_0x4022dd[_0x42f7('0x31')][_0x42f7('0x3b')]){_0x1c4dc9[_0x42f7('0x3c')]=_['merge'](_0x1c4dc9[_0x42f7('0x3c')],{'$or':_[_0x42f7('0x30')](_0x2eed6c,function(_0x58e70f){if(_0x58e70f['type']!==_0x42f7('0x3d')){var _0x164553={};_0x164553[_0x58e70f[_0x42f7('0x2a')]]={'$like':'%'+_0x4022dd[_0x42f7('0x31')][_0x42f7('0x3b')]+'%'};return _0x164553;}})});}_0x1c4dc9=_[_0x42f7('0x3e')]({},_0x1c4dc9,_0x4022dd['options']);var _0x3037f8={'where':_0x1c4dc9['where']};return db[_0x42f7('0x3f')][_0x42f7('0x21')](_0x3037f8)[_0x42f7('0x25')](function(_0x4f2b79){_0x324318[_0x42f7('0x21')]=_0x4f2b79;if(_0x4022dd['query'][_0x42f7('0x40')]){_0x1c4dc9[_0x42f7('0x41')]=[{'all':!![]}];}return db[_0x42f7('0x3f')]['findAll'](_0x1c4dc9);})[_0x42f7('0x25')](function(_0x443b6f){_0x324318['rows']=_0x443b6f;return _0x324318;})[_0x42f7('0x25')](respondWithFilteredResult(_0x1b0977,_0x1c4dc9))['catch'](handleError(_0x1b0977,null));};exports[_0x42f7('0x42')]=function(_0x50f33e,_0x2e2518){var _0x434108={'raw':!![],'where':{'id':_0x50f33e[_0x42f7('0x43')]['id']}},_0x5a2af9={};_0x5a2af9[_0x42f7('0x2f')]=_['keys'](db[_0x42f7('0x3f')][_0x42f7('0x2b')]);_0x5a2af9[_0x42f7('0x31')]=_[_0x42f7('0x44')](_0x50f33e[_0x42f7('0x31')]);_0x5a2af9['filters']=_[_0x42f7('0x33')](_0x5a2af9['model'],_0x5a2af9[_0x42f7('0x31')]);_0x434108[_0x42f7('0x35')]=_[_0x42f7('0x33')](_0x5a2af9[_0x42f7('0x2f')],qs['fields'](_0x50f33e[_0x42f7('0x31')][_0x42f7('0x34')]));_0x434108[_0x42f7('0x35')]=_0x434108[_0x42f7('0x35')][_0x42f7('0x36')]?_0x434108[_0x42f7('0x35')]:_0x5a2af9['model'];if(_0x50f33e['query'][_0x42f7('0x40')]){_0x434108[_0x42f7('0x41')]=[{'all':!![]}];}_0x434108=_['merge']({},_0x434108,_0x50f33e[_0x42f7('0x45')]);return db[_0x42f7('0x3f')][_0x42f7('0x46')](_0x434108)[_0x42f7('0x25')](handleEntityNotFound(_0x2e2518,null))[_0x42f7('0x25')](respondWithResult(_0x2e2518,null))[_0x42f7('0x47')](handleError(_0x2e2518,null));};exports[_0x42f7('0x48')]=function(_0x2a14f4,_0x422f0a){return db['JscriptyAnswerReport'][_0x42f7('0x48')](_0x2a14f4[_0x42f7('0x49')],{})[_0x42f7('0x25')](respondWithResult(_0x422f0a,0xc9))[_0x42f7('0x47')](handleError(_0x422f0a,null));};exports[_0x42f7('0x24')]=function(_0x211cba,_0x599365){if(_0x211cba[_0x42f7('0x49')]['id']){delete _0x211cba['body']['id'];}return db[_0x42f7('0x3f')][_0x42f7('0x46')]({'where':{'id':_0x211cba[_0x42f7('0x43')]['id']}})[_0x42f7('0x25')](handleEntityNotFound(_0x599365,null))[_0x42f7('0x25')](saveUpdates(_0x211cba[_0x42f7('0x49')],null))['then'](respondWithResult(_0x599365,null))[_0x42f7('0x47')](handleError(_0x599365,null));};exports[_0x42f7('0x26')]=function(_0x4e61a9,_0x46fa8c){return db['JscriptyAnswerReport'][_0x42f7('0x46')]({'where':{'id':_0x4e61a9[_0x42f7('0x43')]['id']}})[_0x42f7('0x25')](handleEntityNotFound(_0x46fa8c,null))['then'](removeEntity(_0x46fa8c,null))[_0x42f7('0x47')](handleError(_0x46fa8c,null));};exports[_0x42f7('0x4a')]=function(_0x513c8c,_0x3b8275){return db[_0x42f7('0x3f')][_0x42f7('0x4a')]()[_0x42f7('0x25')](respondWithResult(_0x3b8275,null))[_0x42f7('0x47')](handleError(_0x3b8275,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index c59f521..0051890 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 _0xeea2=['lodash','api','moment','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers'];(function(_0x59ac4f,_0xa1c039){var _0x7fb93d=function(_0x555821){while(--_0x555821){_0x59ac4f['push'](_0x59ac4f['shift']());}};_0x7fb93d(++_0xa1c039);}(_0xeea2,0xbb));var _0x2eea=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xeea2[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x2eea('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2eea('0x1'));var moment=require(_0x2eea('0x2'));var BPromise=require('bluebird');var rp=require(_0x2eea('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2eea('0x4'));var config=require(_0x2eea('0x5'));var attributes=require(_0x2eea('0x6'));module[_0x2eea('0x7')]=function(_0x285796,_0x4d5778){return _0x285796[_0x2eea('0x8')](_0x2eea('0x9'),attributes,{'tableName':_0x2eea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c84=['../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','util','api','moment','request-promise','path','rimraf'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x2c84,0x132));var _0x42c8=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x2c84[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x42c8('0x0'));var logger=require('../../config/logger')(_0x42c8('0x1'));var moment=require(_0x42c8('0x2'));var BPromise=require('bluebird');var rp=require(_0x42c8('0x3'));var fs=require('fs');var path=require(_0x42c8('0x4'));var rimraf=require(_0x42c8('0x5'));var config=require(_0x42c8('0x6'));var attributes=require(_0x42c8('0x7'));module[_0x42c8('0x8')]=function(_0x508b99,_0x1b2c17){return _0x508b99[_0x42c8('0x9')](_0x42c8('0xa'),attributes,{'tableName':_0x42c8('0xb'),'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 5aa52d2..3ec61db 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 _0x8ec8=['util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','info','result','catch'];(function(_0x576810,_0x3f2f1c){var _0x4fed79=function(_0x3f536a){while(--_0x3f536a){_0x576810['push'](_0x576810['shift']());}};_0x4fed79(++_0x3f2f1c);}(_0x8ec8,0x1a4));var _0x88ec=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x8ec8[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require(_0x88ec('0x0'));var moment=require(_0x88ec('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x88ec('0x2'));var db=require(_0x88ec('0x3'))['db'];var utils=require(_0x88ec('0x4'));var logger=require(_0x88ec('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x88ec('0x6'));var client=jayson[_0x88ec('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e7dda,_0xe363d6,_0x10df6f){return new BPromise(function(_0x57d096,_0x4efdc8){return client[_0x88ec('0x8')](_0x3e7dda,_0x10df6f)[_0x88ec('0x9')](function(_0x2e2359){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0xe363d6,_0x88ec('0xa'));logger['debug'](_0x88ec('0xb'),_0xe363d6,_0x88ec('0xa'),JSON[_0x88ec('0xc')](_0x2e2359));if(_0x2e2359[_0x88ec('0xd')]){if(_0x2e2359[_0x88ec('0xd')][_0x88ec('0xe')]===0x1f4){logger[_0x88ec('0xd')](_0x88ec('0xf'),_0xe363d6,_0x2e2359[_0x88ec('0xd')]['message']);return _0x4efdc8(_0x2e2359[_0x88ec('0xd')][_0x88ec('0x10')]);}logger[_0x88ec('0xd')](_0x88ec('0xf'),_0xe363d6,_0x2e2359[_0x88ec('0xd')][_0x88ec('0x10')]);return _0x57d096(_0x2e2359[_0x88ec('0xd')][_0x88ec('0x10')]);}else{logger[_0x88ec('0x11')](_0x88ec('0xf'),_0xe363d6,_0x88ec('0xa'));_0x57d096(_0x2e2359[_0x88ec('0x12')][_0x88ec('0x10')]);}})[_0x88ec('0x13')](function(_0x31968d){logger['error'](_0x88ec('0xf'),_0xe363d6,_0x31968d);_0x4efdc8(_0x31968d);});});} \ No newline at end of file +var _0x89f2=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x59555d,_0x2c8783){var _0x11c166=function(_0x282507){while(--_0x282507){_0x59555d['push'](_0x59555d['shift']());}};_0x11c166(++_0x2c8783);}(_0x89f2,0x11c));var _0x289f=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x89f2[_0x5c9307];return _0x373e29;};'use strict';var _=require(_0x289f('0x0'));var util=require(_0x289f('0x1'));var moment=require(_0x289f('0x2'));var BPromise=require(_0x289f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x289f('0x4'));var db=require(_0x289f('0x5'))['db'];var utils=require(_0x289f('0x6'));var logger=require(_0x289f('0x7'))(_0x289f('0x8'));var config=require(_0x289f('0x9'));var jayson=require(_0x289f('0xa'));var client=jayson['client'][_0x289f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4919be,_0x1b7fb8,_0x592554){return new BPromise(function(_0x11bc5f,_0x2a4c1a){return client[_0x289f('0xc')](_0x4919be,_0x592554)[_0x289f('0xd')](function(_0x4b64f2){logger[_0x289f('0xe')](_0x289f('0xf'),_0x1b7fb8,_0x289f('0x10'));logger[_0x289f('0x11')](_0x289f('0x12'),_0x1b7fb8,_0x289f('0x10'),JSON[_0x289f('0x13')](_0x4b64f2));if(_0x4b64f2['error']){if(_0x4b64f2[_0x289f('0x14')][_0x289f('0x15')]===0x1f4){logger['error'](_0x289f('0xf'),_0x1b7fb8,_0x4b64f2[_0x289f('0x14')][_0x289f('0x16')]);return _0x2a4c1a(_0x4b64f2[_0x289f('0x14')]['message']);}logger[_0x289f('0x14')](_0x289f('0xf'),_0x1b7fb8,_0x4b64f2[_0x289f('0x14')][_0x289f('0x16')]);return _0x11bc5f(_0x4b64f2[_0x289f('0x14')][_0x289f('0x16')]);}else{logger[_0x289f('0xe')](_0x289f('0xf'),_0x1b7fb8,_0x289f('0x10'));_0x11bc5f(_0x4b64f2[_0x289f('0x17')]['message']);}})['catch'](function(_0x1c8b9b){logger[_0x289f('0x14')](_0x289f('0xf'),_0x1b7fb8,_0x1c8b9b);_0x2a4c1a(_0x1c8b9b);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 0af2a3a..a648607 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 _0x7baf=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','isAuthenticated','/:id/sessions','/:id/answers','30s','getSummary','post','create','/:id/clone','clone','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x7baf,0x119));var _0xf7ba=function(_0x7d6d36,_0x20808a){_0x7d6d36=_0x7d6d36-0x0;var _0x42ae89=_0x7baf[_0x7d6d36];return _0x42ae89;};'use strict';var multer=require(_0xf7ba('0x0'));var util=require(_0xf7ba('0x1'));var path=require(_0xf7ba('0x2'));var timeout=require(_0xf7ba('0x3'));var express=require(_0xf7ba('0x4'));var router=express['Router']();var fs_extra=require(_0xf7ba('0x5'));var auth=require(_0xf7ba('0x6'));var interaction=require(_0xf7ba('0x7'));var config=require(_0xf7ba('0x8'));var controller=require(_0xf7ba('0x9'));router[_0xf7ba('0xa')]('/',auth['isAuthenticated'](),controller[_0xf7ba('0xb')]);router['get']('/:id',auth[_0xf7ba('0xc')](),controller['show']);router[_0xf7ba('0xa')](_0xf7ba('0xd'),auth[_0xf7ba('0xc')](),controller['getSessions']);router[_0xf7ba('0xa')](_0xf7ba('0xe'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xf7ba('0xa')]('/:id/summary',auth['isAuthenticated'](),timeout(_0xf7ba('0xf')),controller[_0xf7ba('0x10')]);router[_0xf7ba('0x11')]('/',auth[_0xf7ba('0xc')](),controller[_0xf7ba('0x12')]);router[_0xf7ba('0x11')](_0xf7ba('0x13'),auth[_0xf7ba('0xc')](),controller[_0xf7ba('0x14')]);router[_0xf7ba('0x15')](_0xf7ba('0x16'),auth[_0xf7ba('0xc')](),controller['update']);router[_0xf7ba('0x17')](_0xf7ba('0x16'),auth[_0xf7ba('0xc')](),controller[_0xf7ba('0x18')]);module[_0xf7ba('0x19')]=router; \ No newline at end of file +var _0xfff9=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','show','/:id/sessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','create','post','/:id/clone','clone','put','/:id'];(function(_0x2e2179,_0x14ddf0){var _0xf2f2e2=function(_0x4ffcc1){while(--_0x4ffcc1){_0x2e2179['push'](_0x2e2179['shift']());}};_0xf2f2e2(++_0x14ddf0);}(_0xfff9,0x1c4));var _0x9fff=function(_0x8a0d94,_0x16fcee){_0x8a0d94=_0x8a0d94-0x0;var _0x48f382=_0xfff9[_0x8a0d94];return _0x48f382;};'use strict';var multer=require(_0x9fff('0x0'));var util=require(_0x9fff('0x1'));var path=require(_0x9fff('0x2'));var timeout=require(_0x9fff('0x3'));var express=require('express');var router=express[_0x9fff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9fff('0x5'));var interaction=require(_0x9fff('0x6'));var config=require(_0x9fff('0x7'));var controller=require(_0x9fff('0x8'));router[_0x9fff('0x9')]('/',auth[_0x9fff('0xa')](),controller['index']);router[_0x9fff('0x9')]('/:id',auth[_0x9fff('0xa')](),controller[_0x9fff('0xb')]);router[_0x9fff('0x9')](_0x9fff('0xc'),auth[_0x9fff('0xa')](),controller['getSessions']);router[_0x9fff('0x9')](_0x9fff('0xd'),auth[_0x9fff('0xa')](),controller[_0x9fff('0xe')]);router[_0x9fff('0x9')](_0x9fff('0xf'),auth[_0x9fff('0xa')](),timeout(_0x9fff('0x10')),controller[_0x9fff('0x11')]);router['post']('/',auth[_0x9fff('0xa')](),controller[_0x9fff('0x12')]);router[_0x9fff('0x13')](_0x9fff('0x14'),auth['isAuthenticated'](),controller[_0x9fff('0x15')]);router[_0x9fff('0x16')](_0x9fff('0x17'),auth[_0x9fff('0xa')](),controller[_0x9fff('0x18')]);router[_0x9fff('0x19')]('/:id',auth[_0x9fff('0xa')](),controller[_0x9fff('0x1a')]);module[_0x9fff('0x1b')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 9ee25cd..ad0030f 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 _0x33fd=['setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','util','name','long','formData','stringify','isString'];(function(_0x3354f6,_0x9a08a3){var _0x2e8139=function(_0x33a14c){while(--_0x33a14c){_0x3354f6['push'](_0x3354f6['shift']());}};_0x2e8139(++_0x9a08a3);}(_0x33fd,0x16d));var _0xd33f=function(_0x5cd558,_0x390122){_0x5cd558=_0x5cd558-0x0;var _0x277b25=_0x33fd[_0x5cd558];return _0x277b25;};'use strict';var Sequelize=require(_0xd33f('0x0'));var _=require('lodash');var util=require(_0xd33f('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xd33f('0x2')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0xd33f('0x3')),'set':function(_0x3cde1c){if(_['isObjectLike'](_0x3cde1c)){this['setDataValue'](_0xd33f('0x4'),JSON[_0xd33f('0x5')](_0x3cde1c));}else if(_[_0xd33f('0x6')](_0x3cde1c)){this[_0xd33f('0x7')](_0xd33f('0x4'),_0x3cde1c);}else{this[_0xd33f('0x7')](_0xd33f('0x4'),util[_0xd33f('0x8')](_0xd33f('0x9'),this[_0xd33f('0xa')](_0xd33f('0x2'))||'',this[_0xd33f('0xa')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xd33f('0xb')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xd33f('0xb')],'defaultValue':![]}}; \ No newline at end of file +var _0x4582=['description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x1b10cf,_0x3f2ef2){var _0xcf90de=function(_0x599104){while(--_0x599104){_0x1b10cf['push'](_0x1b10cf['shift']());}};_0xcf90de(++_0x3f2ef2);}(_0x4582,0xbd));var _0x2458=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4582[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2458('0x0'));var _=require(_0x2458('0x1'));var util=require(_0x2458('0x2'));module[_0x2458('0x3')]={'name':{'type':Sequelize[_0x2458('0x4')],'unique':_0x2458('0x5')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x2458('0x6')](_0x2458('0x7')),'set':function(_0x19d40d){if(_['isObjectLike'](_0x19d40d)){this[_0x2458('0x8')](_0x2458('0x9'),JSON[_0x2458('0xa')](_0x19d40d));}else if(_[_0x2458('0xb')](_0x19d40d)){this[_0x2458('0x8')](_0x2458('0x9'),_0x19d40d);}else{this['setDataValue'](_0x2458('0x9'),util[_0x2458('0xc')](_0x2458('0xd'),this[_0x2458('0xe')]('name')||'',this[_0x2458('0xe')](_0x2458('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x2458('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x2458('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 7f389bb..71ae0f4 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 _0xfb5d=['length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','JscriptyProject','includeAll','findAll','rows','catch','show','params','intersection','include','find','create','user','Projects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','destroy','getSessions','findOne','JscriptySessionReport','JscriptyAnswerReport','ProjectId','fromCharCode','indexOf','toString','replace','startTime','starttime','parse','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','writeFileSync','Content-disposition','attachment;\x20filename=','format','setHeader','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','zip-dir','fast-json-patch','moment','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','then','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields'];(function(_0x2a4095,_0x13f4f0){var _0x52eeab=function(_0x3950dd){while(--_0x3950dd){_0x2a4095['push'](_0x2a4095['shift']());}};_0x52eeab(++_0x13f4f0);}(_0xfb5d,0x11a));var _0xdfb5=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xfb5d[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0xdfb5('0x0'));var rimraf=require(_0xdfb5('0x1'));var zipdir=require(_0xdfb5('0x2'));var jsonpatch=require(_0xdfb5('0x3'));var rp=require('request-promise');var moment=require(_0xdfb5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xdfb5('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdfb5('0x6'));var squel=require(_0xdfb5('0x7'));var crypto=require(_0xdfb5('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xdfb5('0x9'));var toCsv=require(_0xdfb5('0x5'));var querystring=require(_0xdfb5('0xa'));var Papa=require(_0xdfb5('0xb'));var Redis=require(_0xdfb5('0xc'));var authService=require(_0xdfb5('0xd'));var qs=require(_0xdfb5('0xe'));var as=require(_0xdfb5('0xf'));var hardwareService=require(_0xdfb5('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xdfb5('0x11'));var config=require(_0xdfb5('0x12'));var licenseUtil=require(_0xdfb5('0x13'));var db=require(_0xdfb5('0x14'))['db'];function respondWithStatusCode(_0x33cbc1,_0x57d233){_0x57d233=_0x57d233||0xcc;return function(_0x2b3683){if(_0x2b3683){return _0x33cbc1[_0xdfb5('0x15')](_0x57d233);}return _0x33cbc1['status'](_0x57d233)[_0xdfb5('0x16')]();};}function respondWithResult(_0x23ff84,_0x44c4a3){_0x44c4a3=_0x44c4a3||0xc8;return function(_0x11adb7){if(_0x11adb7){return _0x23ff84[_0xdfb5('0x17')](_0x44c4a3)['json'](_0x11adb7);}};}function respondWithFilteredResult(_0x56d8aa,_0x15fd53){return function(_0x4e863d){if(_0x4e863d){var _0xbd0bd6=typeof _0x15fd53[_0xdfb5('0x18')]===_0xdfb5('0x19')&&typeof _0x15fd53[_0xdfb5('0x1a')]===_0xdfb5('0x19');var _0x35b052=_0x4e863d[_0xdfb5('0x1b')];var _0x54fa59=_0xbd0bd6?0x0:_0x15fd53[_0xdfb5('0x18')];var _0x29576a=_0xbd0bd6?_0x4e863d[_0xdfb5('0x1b')]:_0x15fd53[_0xdfb5('0x18')]+_0x15fd53[_0xdfb5('0x1a')];var _0x57e2b1;if(_0x29576a>=_0x35b052){_0x29576a=_0x35b052;_0x57e2b1=0xc8;}else{_0x57e2b1=0xce;}_0x56d8aa[_0xdfb5('0x17')](_0x57e2b1);return _0x56d8aa[_0xdfb5('0x1c')]('Content-Range',_0x54fa59+'-'+_0x29576a+'/'+_0x35b052)[_0xdfb5('0x1d')](_0x4e863d);}return null;};}function patchUpdates(_0x531ab8){return function(_0x3a0908){try{jsonpatch[_0xdfb5('0x1e')](_0x3a0908,_0x531ab8,!![]);}catch(_0x1e282a){return BPromise[_0xdfb5('0x1f')](_0x1e282a);}return _0x3a0908['save']();};}function saveUpdates(_0xf58ac,_0x2fbf03){return function(_0xe08d19){if(_0xe08d19){return _0xe08d19['update'](_0xf58ac)[_0xdfb5('0x20')](function(_0x21ec5d){return _0x21ec5d;});}return null;};}function removeEntity(_0x401b08,_0x495c34){return function(_0x51784c){if(_0x51784c){return _0x51784c['destroy']()[_0xdfb5('0x20')](function(){var _0x386aaa=_0x51784c[_0xdfb5('0x21')]({'plain':!![]});var _0x34764b='Projects';return db[_0xdfb5('0x22')]['destroy']({'where':{'type':_0x34764b,'resourceId':_0x386aaa['id']}})[_0xdfb5('0x20')](function(){return _0x51784c;});})[_0xdfb5('0x20')](function(){_0x401b08[_0xdfb5('0x17')](0xcc)[_0xdfb5('0x16')]();});}};}function handleEntityNotFound(_0x6ff5a7,_0x305d3a){return function(_0x4c5d82){if(!_0x4c5d82){_0x6ff5a7[_0xdfb5('0x15')](0x194);}return _0x4c5d82;};}function handleError(_0x5bcbef,_0x45c7e8){_0x45c7e8=_0x45c7e8||0x1f4;return function(_0x2ecd76){logger[_0xdfb5('0x23')](_0x2ecd76[_0xdfb5('0x24')]);if(_0x2ecd76[_0xdfb5('0x25')]){delete _0x2ecd76[_0xdfb5('0x25')];}_0x5bcbef[_0xdfb5('0x17')](_0x45c7e8)[_0xdfb5('0x26')](_0x2ecd76);};}exports[_0xdfb5('0x27')]=function(_0x52e8a6,_0x2d289f){var _0xa61e4d={},_0x213bdb={},_0x1b7931={'count':0x0,'rows':[]};var _0x39a0e7=_[_0xdfb5('0x28')](db['JscriptyProject'][_0xdfb5('0x29')],function(_0x49f49f){return{'name':_0x49f49f[_0xdfb5('0x2a')],'type':_0x49f49f[_0xdfb5('0x2b')][_0xdfb5('0x2c')]};});_0x213bdb[_0xdfb5('0x2d')]=_[_0xdfb5('0x28')](_0x39a0e7,_0xdfb5('0x25'));_0x213bdb[_0xdfb5('0x2e')]=_[_0xdfb5('0x2f')](_0x52e8a6[_0xdfb5('0x2e')]);_0x213bdb[_0xdfb5('0x30')]=_['intersection'](_0x213bdb[_0xdfb5('0x2d')],_0x213bdb[_0xdfb5('0x2e')]);_0xa61e4d[_0xdfb5('0x31')]=_['intersection'](_0x213bdb[_0xdfb5('0x2d')],qs[_0xdfb5('0x32')](_0x52e8a6[_0xdfb5('0x2e')][_0xdfb5('0x32')]));_0xa61e4d[_0xdfb5('0x31')]=_0xa61e4d[_0xdfb5('0x31')][_0xdfb5('0x33')]?_0xa61e4d[_0xdfb5('0x31')]:_0x213bdb[_0xdfb5('0x2d')];if(!_0x52e8a6[_0xdfb5('0x2e')][_0xdfb5('0x34')](_0xdfb5('0x35'))){_0xa61e4d['limit']=qs[_0xdfb5('0x1a')](_0x52e8a6['query'][_0xdfb5('0x1a')]);_0xa61e4d['offset']=qs[_0xdfb5('0x18')](_0x52e8a6[_0xdfb5('0x2e')][_0xdfb5('0x18')]);}_0xa61e4d[_0xdfb5('0x36')]=qs[_0xdfb5('0x37')](_0x52e8a6[_0xdfb5('0x2e')][_0xdfb5('0x37')]);_0xa61e4d['where']=qs[_0xdfb5('0x30')](_[_0xdfb5('0x38')](_0x52e8a6[_0xdfb5('0x2e')],_0x213bdb[_0xdfb5('0x30')]),_0x39a0e7);if(_0x52e8a6[_0xdfb5('0x2e')][_0xdfb5('0x39')]){_0xa61e4d[_0xdfb5('0x3a')]=_['merge'](_0xa61e4d[_0xdfb5('0x3a')],{'$or':_[_0xdfb5('0x28')](_0x39a0e7,function(_0x5eb1ee){if(_0x5eb1ee[_0xdfb5('0x2b')]!=='VIRTUAL'){var _0x378f01={};_0x378f01[_0x5eb1ee['name']]={'$like':'%'+_0x52e8a6[_0xdfb5('0x2e')][_0xdfb5('0x39')]+'%'};return _0x378f01;}})});}_0xa61e4d=_[_0xdfb5('0x3b')]({},_0xa61e4d,_0x52e8a6[_0xdfb5('0x3c')]);var _0x1fa5f6={'where':_0xa61e4d[_0xdfb5('0x3a')]};return db[_0xdfb5('0x3d')][_0xdfb5('0x1b')](_0x1fa5f6)['then'](function(_0x85521b){_0x1b7931[_0xdfb5('0x1b')]=_0x85521b;if(_0x52e8a6['query'][_0xdfb5('0x3e')]){_0xa61e4d['include']=[{'all':!![]}];}return db['JscriptyProject'][_0xdfb5('0x3f')](_0xa61e4d);})[_0xdfb5('0x20')](function(_0x2b3b97){_0x1b7931[_0xdfb5('0x40')]=_0x2b3b97;return _0x1b7931;})['then'](respondWithFilteredResult(_0x2d289f,_0xa61e4d))[_0xdfb5('0x41')](handleError(_0x2d289f,null));};exports[_0xdfb5('0x42')]=function(_0x15563b,_0x215517){var _0x2c192d={'raw':![],'where':{'id':_0x15563b[_0xdfb5('0x43')]['id']}},_0x3ba40b={};_0x3ba40b[_0xdfb5('0x2d')]=_['keys'](db[_0xdfb5('0x3d')][_0xdfb5('0x29')]);_0x3ba40b[_0xdfb5('0x2e')]=_[_0xdfb5('0x2f')](_0x15563b[_0xdfb5('0x2e')]);_0x3ba40b[_0xdfb5('0x30')]=_[_0xdfb5('0x44')](_0x3ba40b[_0xdfb5('0x2d')],_0x3ba40b[_0xdfb5('0x2e')]);_0x2c192d['attributes']=_[_0xdfb5('0x44')](_0x3ba40b[_0xdfb5('0x2d')],qs[_0xdfb5('0x32')](_0x15563b[_0xdfb5('0x2e')]['fields']));_0x2c192d['attributes']=_0x2c192d[_0xdfb5('0x31')][_0xdfb5('0x33')]?_0x2c192d['attributes']:_0x3ba40b[_0xdfb5('0x2d')];if(_0x15563b['query']['includeAll']){_0x2c192d[_0xdfb5('0x45')]=[{'all':!![]}];}_0x2c192d=_[_0xdfb5('0x3b')]({},_0x2c192d,_0x15563b[_0xdfb5('0x3c')]);return db['JscriptyProject'][_0xdfb5('0x46')](_0x2c192d)[_0xdfb5('0x20')](handleEntityNotFound(_0x215517,null))[_0xdfb5('0x20')](respondWithResult(_0x215517,null))[_0xdfb5('0x41')](handleError(_0x215517,null));};exports[_0xdfb5('0x47')]=function(_0x27b12a,_0x1fdbcf){return db[_0xdfb5('0x3d')]['create'](_0x27b12a['body'],{})[_0xdfb5('0x20')](function(_0x5136d2){var _0x43a608=_0x27b12a[_0xdfb5('0x48')][_0xdfb5('0x21')]({'plain':!![]});if(!_0x43a608)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43a608['role']===_0xdfb5('0x48')){var _0x21f0fa=_0x5136d2[_0xdfb5('0x21')]({'plain':!![]});var _0x365335=_0xdfb5('0x49');return db[_0xdfb5('0x4a')]['find']({'where':{'name':_0x365335,'userProfileId':_0x43a608[_0xdfb5('0x4b')]},'raw':!![]})['then'](function(_0x23d804){if(_0x23d804&&_0x23d804[_0xdfb5('0x4c')]===0x0){return db['UserProfileResource'][_0xdfb5('0x47')]({'name':_0x21f0fa[_0xdfb5('0x25')],'resourceId':_0x21f0fa['id'],'type':_0x23d804['name'],'sectionId':_0x23d804['id']},{})['then'](function(){return _0x5136d2;});}else{return _0x5136d2;}})['catch'](function(_0x1a04ce){logger[_0xdfb5('0x23')](_0xdfb5('0x4d'),_0x1a04ce);throw _0x1a04ce;});}return _0x5136d2;})[_0xdfb5('0x20')](respondWithResult(_0x1fdbcf,0xc9))[_0xdfb5('0x41')](handleError(_0x1fdbcf,null));};exports['clone']=function(_0x63b35c,_0x51febf){var _0x1b61dc={'where':{'id':_0x63b35c['params']['id']}},_0x17171c={};_0x17171c[_0xdfb5('0x2d')]=_['keys'](db[_0xdfb5('0x3d')]['rawAttributes']);_0x1b61dc[_0xdfb5('0x31')]=_[_0xdfb5('0x44')](_0x17171c[_0xdfb5('0x2d')],qs[_0xdfb5('0x32')](_0x63b35c[_0xdfb5('0x2e')][_0xdfb5('0x32')]));_0x1b61dc[_0xdfb5('0x31')]=_0x1b61dc[_0xdfb5('0x31')][_0xdfb5('0x33')]?_0x1b61dc[_0xdfb5('0x31')]:_0x17171c['model'];if(_0x63b35c[_0xdfb5('0x2e')][_0xdfb5('0x3e')]){_0x1b61dc[_0xdfb5('0x45')]=[{'all':!![]}];}_0x1b61dc=_['merge']({},_0x1b61dc,_0x63b35c[_0xdfb5('0x3c')]);return db[_0xdfb5('0x3d')]['find'](_0x1b61dc)[_0xdfb5('0x20')](handleEntityNotFound(_0x51febf,null))[_0xdfb5('0x20')](function(_0x5a97dd){if(_0x5a97dd){var _0x3f75b0=_0x5a97dd[_0xdfb5('0x21')]({'plain':!![]});_0x3f75b0=qs['omit'](_0x3f75b0,['id',_0xdfb5('0x4e'),'updatedAt']);_0x63b35c[_0xdfb5('0x4f')]=_['omit'](_0x63b35c['body'],['id','createdAt','updatedAt']);return db[_0xdfb5('0x3d')][_0xdfb5('0x47')](_[_0xdfb5('0x3b')](_0x3f75b0,_0x63b35c[_0xdfb5('0x4f')]),{'include':_0x63b35c[_0xdfb5('0x2e')][_0xdfb5('0x3e')]?[{'all':!![]}]:undefined})[_0xdfb5('0x20')](function(_0x397b8e){var _0x177af7=_0x63b35c[_0xdfb5('0x48')][_0xdfb5('0x21')]({'plain':!![]});if(!_0x177af7)throw new Error(_0xdfb5('0x50'));if(_0x177af7[_0xdfb5('0x51')]===_0xdfb5('0x48')){var _0x590706=_0x397b8e['get']({'plain':!![]});var _0x4caee5='Projects';return db[_0xdfb5('0x4a')][_0xdfb5('0x46')]({'where':{'name':_0x4caee5,'userProfileId':_0x177af7[_0xdfb5('0x4b')]},'raw':!![]})[_0xdfb5('0x20')](function(_0x284ee3){if(_0x284ee3&&_0x284ee3[_0xdfb5('0x4c')]===0x0){return db[_0xdfb5('0x22')]['create']({'name':_0x590706['name'],'resourceId':_0x590706['id'],'type':_0x284ee3[_0xdfb5('0x25')],'sectionId':_0x284ee3['id']},{})[_0xdfb5('0x20')](function(){return _0x397b8e;});}else{return _0x397b8e;}})[_0xdfb5('0x41')](function(_0x7af5de){logger['error'](_0xdfb5('0x4d'),_0x7af5de);throw _0x7af5de;});}return _0x397b8e;});}})[_0xdfb5('0x20')](respondWithResult(_0x51febf,0xc9))[_0xdfb5('0x41')](handleError(_0x51febf,null));};exports['update']=function(_0x5622ff,_0x14b116){if(_0x5622ff[_0xdfb5('0x4f')]['id']){delete _0x5622ff[_0xdfb5('0x4f')]['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x5622ff[_0xdfb5('0x43')]['id']}})[_0xdfb5('0x20')](handleEntityNotFound(_0x14b116,null))[_0xdfb5('0x20')](saveUpdates(_0x5622ff['body'],null))['then'](respondWithResult(_0x14b116,null))[_0xdfb5('0x41')](handleError(_0x14b116,null));};exports[_0xdfb5('0x52')]=function(_0x36a544,_0x591a87){return db['JscriptyProject'][_0xdfb5('0x46')]({'where':{'id':_0x36a544[_0xdfb5('0x43')]['id']}})[_0xdfb5('0x20')](handleEntityNotFound(_0x591a87,null))['then'](removeEntity(_0x591a87,null))[_0xdfb5('0x41')](handleError(_0x591a87,null));};exports[_0xdfb5('0x53')]=function(_0x61ea55,_0x41a08f,_0x11c057){var _0x153852={'raw':!![],'where':{}};var _0x2f1337={};var _0x3ad536={'count':0x0,'rows':[]};return db[_0xdfb5('0x3d')][_0xdfb5('0x54')]({'where':{'id':_0x61ea55[_0xdfb5('0x43')]['id']}})[_0xdfb5('0x20')](handleEntityNotFound(_0x41a08f,null))[_0xdfb5('0x20')](function(_0x26c7b9){if(_0x26c7b9){_0x2f1337[_0xdfb5('0x2d')]=_['keys'](db[_0xdfb5('0x55')][_0xdfb5('0x29')]);_0x2f1337[_0xdfb5('0x2e')]=_[_0xdfb5('0x2f')](_0x61ea55[_0xdfb5('0x2e')]);_0x2f1337['filters']=_[_0xdfb5('0x44')](_0x2f1337[_0xdfb5('0x2d')],_0x2f1337['query']);_0x153852[_0xdfb5('0x31')]=_[_0xdfb5('0x44')](_0x2f1337[_0xdfb5('0x2d')],qs[_0xdfb5('0x32')](_0x61ea55[_0xdfb5('0x2e')]['fields']));_0x153852[_0xdfb5('0x31')]=_0x153852[_0xdfb5('0x31')][_0xdfb5('0x33')]?_0x153852['attributes']:_0x2f1337[_0xdfb5('0x2d')];if(!_0x61ea55['query'][_0xdfb5('0x34')](_0xdfb5('0x35'))){_0x153852[_0xdfb5('0x1a')]=qs[_0xdfb5('0x1a')](_0x61ea55[_0xdfb5('0x2e')]['limit']);_0x153852['offset']=qs[_0xdfb5('0x18')](_0x61ea55[_0xdfb5('0x2e')][_0xdfb5('0x18')]);}_0x153852[_0xdfb5('0x36')]=qs[_0xdfb5('0x37')](_0x61ea55[_0xdfb5('0x2e')]['sort']);_0x153852[_0xdfb5('0x3a')]=qs[_0xdfb5('0x30')](_[_0xdfb5('0x38')](_0x61ea55['query'],_0x2f1337[_0xdfb5('0x30')]));_0x153852[_0xdfb5('0x3a')]['ProjectId']=_0x26c7b9['id'];if(_0x61ea55[_0xdfb5('0x2e')]['filter']){_0x153852['where']=_[_0xdfb5('0x3b')](_0x153852[_0xdfb5('0x3a')],{'$or':_[_0xdfb5('0x28')](_0x153852['attributes'],function(_0x2c145b){var _0x67b37b={};_0x67b37b[_0x2c145b]={'$like':'%'+_0x61ea55[_0xdfb5('0x2e')][_0xdfb5('0x39')]+'%'};return _0x67b37b;})});}_0x153852=_['merge']({},_0x153852,_0x61ea55[_0xdfb5('0x3c')]);return db[_0xdfb5('0x55')][_0xdfb5('0x1b')]({'where':_0x153852['where']})[_0xdfb5('0x20')](function(_0x464d8e){_0x3ad536[_0xdfb5('0x1b')]=_0x464d8e;if(_0x61ea55[_0xdfb5('0x2e')][_0xdfb5('0x3e')]){_0x153852[_0xdfb5('0x45')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x153852);})[_0xdfb5('0x20')](function(_0x460f34){_0x3ad536[_0xdfb5('0x40')]=_0x460f34;return _0x3ad536;});}})[_0xdfb5('0x20')](respondWithFilteredResult(_0x41a08f,_0x153852))[_0xdfb5('0x41')](handleError(_0x41a08f,null));};exports['getAnswers']=function(_0x34a976,_0x5bc6dc,_0x4c6420){var _0x2e5f1b={'raw':!![],'where':{}};var _0x577121={};var _0x21a9a7={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xdfb5('0x54')]({'where':{'id':_0x34a976[_0xdfb5('0x43')]['id']}})[_0xdfb5('0x20')](handleEntityNotFound(_0x5bc6dc,null))[_0xdfb5('0x20')](function(_0x337915){if(_0x337915){_0x577121['model']=_[_0xdfb5('0x2f')](db[_0xdfb5('0x56')][_0xdfb5('0x29')]);_0x577121['query']=_[_0xdfb5('0x2f')](_0x34a976[_0xdfb5('0x2e')]);_0x577121[_0xdfb5('0x30')]=_['intersection'](_0x577121['model'],_0x577121[_0xdfb5('0x2e')]);_0x2e5f1b[_0xdfb5('0x31')]=_[_0xdfb5('0x44')](_0x577121[_0xdfb5('0x2d')],qs[_0xdfb5('0x32')](_0x34a976[_0xdfb5('0x2e')][_0xdfb5('0x32')]));_0x2e5f1b[_0xdfb5('0x31')]=_0x2e5f1b[_0xdfb5('0x31')][_0xdfb5('0x33')]?_0x2e5f1b[_0xdfb5('0x31')]:_0x577121[_0xdfb5('0x2d')];if(!_0x34a976[_0xdfb5('0x2e')]['hasOwnProperty'](_0xdfb5('0x35'))){_0x2e5f1b[_0xdfb5('0x1a')]=qs[_0xdfb5('0x1a')](_0x34a976[_0xdfb5('0x2e')][_0xdfb5('0x1a')]);_0x2e5f1b[_0xdfb5('0x18')]=qs['offset'](_0x34a976[_0xdfb5('0x2e')][_0xdfb5('0x18')]);}_0x2e5f1b[_0xdfb5('0x36')]=qs[_0xdfb5('0x37')](_0x34a976[_0xdfb5('0x2e')][_0xdfb5('0x37')]);_0x2e5f1b[_0xdfb5('0x3a')]=qs[_0xdfb5('0x30')](_[_0xdfb5('0x38')](_0x34a976['query'],_0x577121[_0xdfb5('0x30')]));_0x2e5f1b[_0xdfb5('0x3a')][_0xdfb5('0x57')]=_0x337915['id'];if(_0x34a976[_0xdfb5('0x2e')][_0xdfb5('0x39')]){_0x2e5f1b[_0xdfb5('0x3a')]=_['merge'](_0x2e5f1b[_0xdfb5('0x3a')],{'$or':_[_0xdfb5('0x28')](_0x2e5f1b['attributes'],function(_0x19e4f1){var _0x9ddc0f={};_0x9ddc0f[_0x19e4f1]={'$like':'%'+_0x34a976[_0xdfb5('0x2e')][_0xdfb5('0x39')]+'%'};return _0x9ddc0f;})});}_0x2e5f1b=_[_0xdfb5('0x3b')]({},_0x2e5f1b,_0x34a976[_0xdfb5('0x3c')]);return db['JscriptyAnswerReport']['count']({'where':_0x2e5f1b[_0xdfb5('0x3a')]})[_0xdfb5('0x20')](function(_0x503b2b){_0x21a9a7[_0xdfb5('0x1b')]=_0x503b2b;if(_0x34a976['query'][_0xdfb5('0x3e')]){_0x2e5f1b[_0xdfb5('0x45')]=[{'all':!![]}];}return db[_0xdfb5('0x56')]['findAll'](_0x2e5f1b);})[_0xdfb5('0x20')](function(_0x211e9c){_0x21a9a7['rows']=_0x211e9c;return _0x21a9a7;});}})[_0xdfb5('0x20')](respondWithFilteredResult(_0x5bc6dc,_0x2e5f1b))[_0xdfb5('0x41')](handleError(_0x5bc6dc,null));};function char(_0x3e7b8b){return'number'===typeof _0x3e7b8b?String[_0xdfb5('0x58')][_0xdfb5('0x1e')](null,arguments):_0x3e7b8b;}function needsEncapsulation(_0x4797ba){return!!_0x4797ba&&(_0x4797ba['toString']()[_0xdfb5('0x59')](char(0xd))>=0x0||_0x4797ba[_0xdfb5('0x5a')]()[_0xdfb5('0x59')](char(0xa))>=0x0||_0x4797ba['toString']()[_0xdfb5('0x59')](char(0x2c))>=0x0||_0x4797ba[_0xdfb5('0x5a')]()[_0xdfb5('0x59')](char(0x22))>=0x0);}function encapsulate(_0x40e16b){var _0x2fc33a=char(0x22),_0x795174='\x5c'+char(0x22),_0x169ca3=_0x40e16b[_0xdfb5('0x5a')]()[_0xdfb5('0x5b')](new RegExp(_0x2fc33a,'g'),_0x795174);return _0x2fc33a+_0x169ca3+_0x2fc33a;}exports['getSummary']=function(_0x47acd4,_0x148d4c,_0x134120){var _0x45d9d8,_0x2d5566;var _0x3a07e6={'where':{'ProjectId':_0x47acd4[_0xdfb5('0x43')]['id']}};if(_0x47acd4['query'][_0xdfb5('0x5c')]){_0x3a07e6[_0xdfb5('0x3a')][_0xdfb5('0x5d')]=JSON[_0xdfb5('0x5e')](_0x47acd4[_0xdfb5('0x2e')][_0xdfb5('0x5c')]);}return db[_0xdfb5('0x55')]['findAll'](_0x3a07e6)['then'](handleEntityNotFound(_0x148d4c,null))[_0xdfb5('0x20')](function(_0x1c0386){if(_0x1c0386){_0x45d9d8=_0x1c0386;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_['map'](_0x45d9d8,'id')},'ProjectId':_0x47acd4[_0xdfb5('0x43')]['id']},'order':'-createdAt'});}})[_0xdfb5('0x20')](handleEntityNotFound(_0x148d4c,null))['then'](function(_0x2062da){if(_0x2062da){_0x2d5566=_0x2062da;var _0x1459b1={};for(var _0x2ccc7f=0x0,_0x93a545=_0x2d5566[_0xdfb5('0x33')];_0x2ccc7f<_0x93a545;_0x2ccc7f++){if(!_0x1459b1[_0xdfb5('0x34')](_0x2d5566[_0x2ccc7f][_0xdfb5('0x5f')])){_0x1459b1[_0x2d5566[_0x2ccc7f][_0xdfb5('0x5f')]]=needsEncapsulation(_0x2d5566[_0x2ccc7f][_0xdfb5('0x60')])?encapsulate(_0x2d5566[_0x2ccc7f][_0xdfb5('0x60')]):_0x2d5566[_0x2ccc7f][_0xdfb5('0x60')];}}var _0x2365fd=[],_0x163508={};for(var _0x2cacce=0x0,_0x1ae077=_0x45d9d8[_0xdfb5('0x33')];_0x2cacce<_0x1ae077;_0x2cacce++){_0x163508={'ProjectId':_0x47acd4['params']['id'],'SessionId':_0x45d9d8[_0x2cacce]['id'],'StartTime':moment(_0x45d9d8[_0x2cacce][_0xdfb5('0x5d')])['format'](_0xdfb5('0x61'))};for(var _0xf084e0=0x0,_0x26b805=_0x2d5566[_0xdfb5('0x33')];_0xf084e0<_0x26b805;_0xf084e0++){if(_0x2d5566[_0xf084e0][_0xdfb5('0x62')]==_0x45d9d8[_0x2cacce]['id']&&_0x1459b1[_0xdfb5('0x34')](_0x2d5566[_0xf084e0][_0xdfb5('0x5f')])){_0x163508[_0x1459b1[_0x2d5566[_0xf084e0][_0xdfb5('0x5f')]]]=_0x2d5566[_0xf084e0][_0xdfb5('0x63')];}}for(var _0x1d625c in _0x1459b1){if(!_0x163508[_0xdfb5('0x34')](_0x1459b1[_0x1d625c])){_0x163508[_0x1459b1[_0x1d625c]]=null;}}_0x2365fd[_0xdfb5('0x64')](_0x163508);}return _0x2365fd;}})[_0xdfb5('0x20')](function(_0x2eee0e){if(!_['isEmpty'](_0x2eee0e)){var _0x1dadcf=toCsv(_0x2eee0e);var _0x2fae83=Date[_0xdfb5('0x65')]();fs[_0xdfb5('0x66')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x47acd4[_0xdfb5('0x43')]['id'],_0x2fae83),_0x1dadcf);_0x148d4c['setHeader'](_0xdfb5('0x67'),_0xdfb5('0x68')+util[_0xdfb5('0x69')]('Jscripty_Project_%d_Summary_%s.csv',_0x47acd4[_0xdfb5('0x43')]['id'],_0x2fae83));_0x148d4c[_0xdfb5('0x6a')](_0xdfb5('0x6b'),_0xdfb5('0x6c'));return _0x148d4c[_0xdfb5('0x6d')](util['format'](_0xdfb5('0x6e'),_0x47acd4[_0xdfb5('0x43')]['id'],_0x2fae83));}else{return _0x148d4c[_0xdfb5('0x15')](0xcc);}})[_0xdfb5('0x41')](handleError(_0x148d4c,null));}; \ No newline at end of file +var _0x23b3=['replace','getSummary','startTime','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','then','destroy','get','sendStatus','error','name','send','index','map','JscriptyProject','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Projects','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','update','getSessions','JscriptySessionReport','ProjectId','getAnswers','findOne','JscriptyAnswerReport','number','fromCharCode','toString','indexOf'];(function(_0x1e6659,_0x1f860c){var _0x4d16e4=function(_0x21c05a){while(--_0x21c05a){_0x1e6659['push'](_0x1e6659['shift']());}};_0x4d16e4(++_0x1f860c);}(_0x23b3,0x101));var _0x323b=function(_0x22205c,_0x473493){_0x22205c=_0x22205c-0x0;var _0x3f5efe=_0x23b3[_0x22205c];return _0x3f5efe;};'use strict';var emlformat=require(_0x323b('0x0'));var rimraf=require(_0x323b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x323b('0x2'));var rp=require(_0x323b('0x3'));var moment=require(_0x323b('0x4'));var BPromise=require(_0x323b('0x5'));var Mustache=require(_0x323b('0x6'));var util=require(_0x323b('0x7'));var path=require(_0x323b('0x8'));var sox=require(_0x323b('0x9'));var csv=require(_0x323b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x323b('0xb'));var _=require('lodash');var squel=require(_0x323b('0xc'));var crypto=require(_0x323b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x323b('0xe'));var toCsv=require(_0x323b('0xa'));var querystring=require(_0x323b('0xf'));var Papa=require('papaparse');var Redis=require(_0x323b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x323b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x323b('0x12'))('api');var utils=require(_0x323b('0x13'));var config=require(_0x323b('0x14'));var licenseUtil=require(_0x323b('0x15'));var db=require(_0x323b('0x16'))['db'];function respondWithStatusCode(_0x511ff4,_0x38d6a4){_0x38d6a4=_0x38d6a4||0xcc;return function(_0x4ef19d){if(_0x4ef19d){return _0x511ff4['sendStatus'](_0x38d6a4);}return _0x511ff4['status'](_0x38d6a4)[_0x323b('0x17')]();};}function respondWithResult(_0x2dc65c,_0x7a9866){_0x7a9866=_0x7a9866||0xc8;return function(_0x4f6e5d){if(_0x4f6e5d){return _0x2dc65c[_0x323b('0x18')](_0x7a9866)[_0x323b('0x19')](_0x4f6e5d);}};}function respondWithFilteredResult(_0x85507a,_0x3efe80){return function(_0xbb1eab){if(_0xbb1eab){var _0x13142c=typeof _0x3efe80['offset']===_0x323b('0x1a')&&typeof _0x3efe80[_0x323b('0x1b')]===_0x323b('0x1a');var _0x484a81=_0xbb1eab[_0x323b('0x1c')];var _0x4de4d2=_0x13142c?0x0:_0x3efe80[_0x323b('0x1d')];var _0x3af07d=_0x13142c?_0xbb1eab[_0x323b('0x1c')]:_0x3efe80[_0x323b('0x1d')]+_0x3efe80[_0x323b('0x1b')];var _0x259fbc;if(_0x3af07d>=_0x484a81){_0x3af07d=_0x484a81;_0x259fbc=0xc8;}else{_0x259fbc=0xce;}_0x85507a['status'](_0x259fbc);return _0x85507a['set'](_0x323b('0x1e'),_0x4de4d2+'-'+_0x3af07d+'/'+_0x484a81)[_0x323b('0x19')](_0xbb1eab);}return null;};}function patchUpdates(_0x201a06){return function(_0xc15897){try{jsonpatch[_0x323b('0x1f')](_0xc15897,_0x201a06,!![]);}catch(_0x10c2b5){return BPromise[_0x323b('0x20')](_0x10c2b5);}return _0xc15897['save']();};}function saveUpdates(_0x21a003,_0x2ed59f){return function(_0x3c3fc2){if(_0x3c3fc2){return _0x3c3fc2['update'](_0x21a003)[_0x323b('0x21')](function(_0x539116){return _0x539116;});}return null;};}function removeEntity(_0x543643,_0x52de08){return function(_0x3c51fa){if(_0x3c51fa){return _0x3c51fa[_0x323b('0x22')]()[_0x323b('0x21')](function(){var _0x3411d2=_0x3c51fa[_0x323b('0x23')]({'plain':!![]});var _0x52f947='Projects';return db['UserProfileResource'][_0x323b('0x22')]({'where':{'type':_0x52f947,'resourceId':_0x3411d2['id']}})[_0x323b('0x21')](function(){return _0x3c51fa;});})[_0x323b('0x21')](function(){_0x543643[_0x323b('0x18')](0xcc)[_0x323b('0x17')]();});}};}function handleEntityNotFound(_0x13d2fe,_0x2ce998){return function(_0x318721){if(!_0x318721){_0x13d2fe[_0x323b('0x24')](0x194);}return _0x318721;};}function handleError(_0x1f0dcc,_0x22b4ab){_0x22b4ab=_0x22b4ab||0x1f4;return function(_0x499a3c){logger[_0x323b('0x25')](_0x499a3c['stack']);if(_0x499a3c[_0x323b('0x26')]){delete _0x499a3c['name'];}_0x1f0dcc[_0x323b('0x18')](_0x22b4ab)[_0x323b('0x27')](_0x499a3c);};}exports[_0x323b('0x28')]=function(_0x4fa23d,_0x4f55b3){var _0x4aba3f={},_0x241c7c={},_0x29e5b9={'count':0x0,'rows':[]};var _0x227848=_[_0x323b('0x29')](db[_0x323b('0x2a')]['rawAttributes'],function(_0xfa9136){return{'name':_0xfa9136[_0x323b('0x2b')],'type':_0xfa9136['type'][_0x323b('0x2c')]};});_0x241c7c[_0x323b('0x2d')]=_[_0x323b('0x29')](_0x227848,_0x323b('0x26'));_0x241c7c[_0x323b('0x2e')]=_[_0x323b('0x2f')](_0x4fa23d[_0x323b('0x2e')]);_0x241c7c[_0x323b('0x30')]=_['intersection'](_0x241c7c[_0x323b('0x2d')],_0x241c7c[_0x323b('0x2e')]);_0x4aba3f['attributes']=_[_0x323b('0x31')](_0x241c7c[_0x323b('0x2d')],qs[_0x323b('0x32')](_0x4fa23d[_0x323b('0x2e')][_0x323b('0x32')]));_0x4aba3f['attributes']=_0x4aba3f[_0x323b('0x33')][_0x323b('0x34')]?_0x4aba3f[_0x323b('0x33')]:_0x241c7c[_0x323b('0x2d')];if(!_0x4fa23d[_0x323b('0x2e')][_0x323b('0x35')](_0x323b('0x36'))){_0x4aba3f['limit']=qs[_0x323b('0x1b')](_0x4fa23d['query'][_0x323b('0x1b')]);_0x4aba3f[_0x323b('0x1d')]=qs['offset'](_0x4fa23d['query'][_0x323b('0x1d')]);}_0x4aba3f[_0x323b('0x37')]=qs[_0x323b('0x38')](_0x4fa23d[_0x323b('0x2e')][_0x323b('0x38')]);_0x4aba3f['where']=qs[_0x323b('0x30')](_[_0x323b('0x39')](_0x4fa23d[_0x323b('0x2e')],_0x241c7c['filters']),_0x227848);if(_0x4fa23d[_0x323b('0x2e')][_0x323b('0x3a')]){_0x4aba3f[_0x323b('0x3b')]=_[_0x323b('0x3c')](_0x4aba3f[_0x323b('0x3b')],{'$or':_['map'](_0x227848,function(_0x44c479){if(_0x44c479[_0x323b('0x3d')]!==_0x323b('0x3e')){var _0x556b01={};_0x556b01[_0x44c479[_0x323b('0x26')]]={'$like':'%'+_0x4fa23d[_0x323b('0x2e')][_0x323b('0x3a')]+'%'};return _0x556b01;}})});}_0x4aba3f=_[_0x323b('0x3c')]({},_0x4aba3f,_0x4fa23d[_0x323b('0x3f')]);var _0x2ecd95={'where':_0x4aba3f[_0x323b('0x3b')]};return db[_0x323b('0x2a')]['count'](_0x2ecd95)[_0x323b('0x21')](function(_0x26ff6a){_0x29e5b9[_0x323b('0x1c')]=_0x26ff6a;if(_0x4fa23d[_0x323b('0x2e')]['includeAll']){_0x4aba3f[_0x323b('0x40')]=[{'all':!![]}];}return db[_0x323b('0x2a')][_0x323b('0x41')](_0x4aba3f);})[_0x323b('0x21')](function(_0x4456c8){_0x29e5b9[_0x323b('0x42')]=_0x4456c8;return _0x29e5b9;})[_0x323b('0x21')](respondWithFilteredResult(_0x4f55b3,_0x4aba3f))[_0x323b('0x43')](handleError(_0x4f55b3,null));};exports[_0x323b('0x44')]=function(_0x4b0ae2,_0x43431d){var _0x4e429c={'raw':![],'where':{'id':_0x4b0ae2[_0x323b('0x45')]['id']}},_0x3e52f4={};_0x3e52f4[_0x323b('0x2d')]=_[_0x323b('0x2f')](db[_0x323b('0x2a')][_0x323b('0x46')]);_0x3e52f4[_0x323b('0x2e')]=_[_0x323b('0x2f')](_0x4b0ae2[_0x323b('0x2e')]);_0x3e52f4[_0x323b('0x30')]=_['intersection'](_0x3e52f4[_0x323b('0x2d')],_0x3e52f4[_0x323b('0x2e')]);_0x4e429c[_0x323b('0x33')]=_['intersection'](_0x3e52f4['model'],qs[_0x323b('0x32')](_0x4b0ae2[_0x323b('0x2e')][_0x323b('0x32')]));_0x4e429c[_0x323b('0x33')]=_0x4e429c[_0x323b('0x33')][_0x323b('0x34')]?_0x4e429c[_0x323b('0x33')]:_0x3e52f4[_0x323b('0x2d')];if(_0x4b0ae2[_0x323b('0x2e')][_0x323b('0x47')]){_0x4e429c[_0x323b('0x40')]=[{'all':!![]}];}_0x4e429c=_[_0x323b('0x3c')]({},_0x4e429c,_0x4b0ae2[_0x323b('0x3f')]);return db[_0x323b('0x2a')][_0x323b('0x48')](_0x4e429c)[_0x323b('0x21')](handleEntityNotFound(_0x43431d,null))['then'](respondWithResult(_0x43431d,null))['catch'](handleError(_0x43431d,null));};exports[_0x323b('0x49')]=function(_0x577713,_0x42b6ff){return db[_0x323b('0x2a')][_0x323b('0x49')](_0x577713[_0x323b('0x4a')],{})[_0x323b('0x21')](function(_0x565c7e){var _0x33101e=_0x577713[_0x323b('0x4b')][_0x323b('0x23')]({'plain':!![]});if(!_0x33101e)throw new Error(_0x323b('0x4c'));if(_0x33101e['role']===_0x323b('0x4b')){var _0x1b70b4=_0x565c7e[_0x323b('0x23')]({'plain':!![]});var _0xd3dae3=_0x323b('0x4d');return db[_0x323b('0x4e')]['find']({'where':{'name':_0xd3dae3,'userProfileId':_0x33101e['userProfileId']},'raw':!![]})[_0x323b('0x21')](function(_0x2e0d61){if(_0x2e0d61&&_0x2e0d61[_0x323b('0x4f')]===0x0){return db[_0x323b('0x50')][_0x323b('0x49')]({'name':_0x1b70b4['name'],'resourceId':_0x1b70b4['id'],'type':_0x2e0d61[_0x323b('0x26')],'sectionId':_0x2e0d61['id']},{})[_0x323b('0x21')](function(){return _0x565c7e;});}else{return _0x565c7e;}})['catch'](function(_0x369113){logger['error'](_0x323b('0x51'),_0x369113);throw _0x369113;});}return _0x565c7e;})[_0x323b('0x21')](respondWithResult(_0x42b6ff,0xc9))['catch'](handleError(_0x42b6ff,null));};exports[_0x323b('0x52')]=function(_0x317f70,_0x3967e9){var _0x8ca848={'where':{'id':_0x317f70[_0x323b('0x45')]['id']}},_0x27cf10={};_0x27cf10[_0x323b('0x2d')]=_['keys'](db[_0x323b('0x2a')][_0x323b('0x46')]);_0x8ca848[_0x323b('0x33')]=_[_0x323b('0x31')](_0x27cf10['model'],qs[_0x323b('0x32')](_0x317f70[_0x323b('0x2e')][_0x323b('0x32')]));_0x8ca848[_0x323b('0x33')]=_0x8ca848[_0x323b('0x33')]['length']?_0x8ca848[_0x323b('0x33')]:_0x27cf10[_0x323b('0x2d')];if(_0x317f70['query'][_0x323b('0x47')]){_0x8ca848['include']=[{'all':!![]}];}_0x8ca848=_[_0x323b('0x3c')]({},_0x8ca848,_0x317f70[_0x323b('0x3f')]);return db[_0x323b('0x2a')][_0x323b('0x48')](_0x8ca848)['then'](handleEntityNotFound(_0x3967e9,null))[_0x323b('0x21')](function(_0x5b65cf){if(_0x5b65cf){var _0x26a7d5=_0x5b65cf[_0x323b('0x23')]({'plain':!![]});_0x26a7d5=qs[_0x323b('0x53')](_0x26a7d5,['id',_0x323b('0x54'),_0x323b('0x55')]);_0x317f70['body']=_['omit'](_0x317f70[_0x323b('0x4a')],['id','createdAt',_0x323b('0x55')]);return db[_0x323b('0x2a')]['create'](_['merge'](_0x26a7d5,_0x317f70['body']),{'include':_0x317f70[_0x323b('0x2e')]['includeAll']?[{'all':!![]}]:undefined})[_0x323b('0x21')](function(_0x5e0fe2){var _0x52a2f4=_0x317f70[_0x323b('0x4b')]['get']({'plain':!![]});if(!_0x52a2f4)throw new Error(_0x323b('0x4c'));if(_0x52a2f4['role']==='user'){var _0x2742b6=_0x5e0fe2[_0x323b('0x23')]({'plain':!![]});var _0x53b78a=_0x323b('0x4d');return db[_0x323b('0x4e')][_0x323b('0x48')]({'where':{'name':_0x53b78a,'userProfileId':_0x52a2f4['userProfileId']},'raw':!![]})['then'](function(_0x12fe48){if(_0x12fe48&&_0x12fe48[_0x323b('0x4f')]===0x0){return db[_0x323b('0x50')][_0x323b('0x49')]({'name':_0x2742b6[_0x323b('0x26')],'resourceId':_0x2742b6['id'],'type':_0x12fe48['name'],'sectionId':_0x12fe48['id']},{})[_0x323b('0x21')](function(){return _0x5e0fe2;});}else{return _0x5e0fe2;}})[_0x323b('0x43')](function(_0x4900b4){logger[_0x323b('0x25')](_0x323b('0x51'),_0x4900b4);throw _0x4900b4;});}return _0x5e0fe2;});}})['then'](respondWithResult(_0x3967e9,0xc9))[_0x323b('0x43')](handleError(_0x3967e9,null));};exports[_0x323b('0x56')]=function(_0x5998f4,_0x336d4b){if(_0x5998f4[_0x323b('0x4a')]['id']){delete _0x5998f4[_0x323b('0x4a')]['id'];}return db[_0x323b('0x2a')]['find']({'where':{'id':_0x5998f4[_0x323b('0x45')]['id']}})[_0x323b('0x21')](handleEntityNotFound(_0x336d4b,null))['then'](saveUpdates(_0x5998f4[_0x323b('0x4a')],null))[_0x323b('0x21')](respondWithResult(_0x336d4b,null))[_0x323b('0x43')](handleError(_0x336d4b,null));};exports[_0x323b('0x22')]=function(_0x3f71bf,_0x5332f8){return db[_0x323b('0x2a')][_0x323b('0x48')]({'where':{'id':_0x3f71bf[_0x323b('0x45')]['id']}})[_0x323b('0x21')](handleEntityNotFound(_0x5332f8,null))[_0x323b('0x21')](removeEntity(_0x5332f8,null))[_0x323b('0x43')](handleError(_0x5332f8,null));};exports[_0x323b('0x57')]=function(_0x282f38,_0x4c24b2,_0x5cc2a3){var _0x5619a3={'raw':!![],'where':{}};var _0x4c773a={};var _0x50eaa9={'count':0x0,'rows':[]};return db[_0x323b('0x2a')]['findOne']({'where':{'id':_0x282f38[_0x323b('0x45')]['id']}})[_0x323b('0x21')](handleEntityNotFound(_0x4c24b2,null))[_0x323b('0x21')](function(_0x5b765a){if(_0x5b765a){_0x4c773a[_0x323b('0x2d')]=_[_0x323b('0x2f')](db[_0x323b('0x58')]['rawAttributes']);_0x4c773a[_0x323b('0x2e')]=_[_0x323b('0x2f')](_0x282f38['query']);_0x4c773a[_0x323b('0x30')]=_['intersection'](_0x4c773a[_0x323b('0x2d')],_0x4c773a[_0x323b('0x2e')]);_0x5619a3[_0x323b('0x33')]=_[_0x323b('0x31')](_0x4c773a[_0x323b('0x2d')],qs[_0x323b('0x32')](_0x282f38[_0x323b('0x2e')][_0x323b('0x32')]));_0x5619a3[_0x323b('0x33')]=_0x5619a3[_0x323b('0x33')][_0x323b('0x34')]?_0x5619a3[_0x323b('0x33')]:_0x4c773a[_0x323b('0x2d')];if(!_0x282f38['query']['hasOwnProperty'](_0x323b('0x36'))){_0x5619a3['limit']=qs[_0x323b('0x1b')](_0x282f38['query']['limit']);_0x5619a3[_0x323b('0x1d')]=qs[_0x323b('0x1d')](_0x282f38['query']['offset']);}_0x5619a3[_0x323b('0x37')]=qs[_0x323b('0x38')](_0x282f38[_0x323b('0x2e')][_0x323b('0x38')]);_0x5619a3[_0x323b('0x3b')]=qs[_0x323b('0x30')](_[_0x323b('0x39')](_0x282f38[_0x323b('0x2e')],_0x4c773a[_0x323b('0x30')]));_0x5619a3[_0x323b('0x3b')][_0x323b('0x59')]=_0x5b765a['id'];if(_0x282f38[_0x323b('0x2e')][_0x323b('0x3a')]){_0x5619a3['where']=_[_0x323b('0x3c')](_0x5619a3[_0x323b('0x3b')],{'$or':_['map'](_0x5619a3[_0x323b('0x33')],function(_0x3956e1){var _0x369745={};_0x369745[_0x3956e1]={'$like':'%'+_0x282f38['query']['filter']+'%'};return _0x369745;})});}_0x5619a3=_['merge']({},_0x5619a3,_0x282f38[_0x323b('0x3f')]);return db[_0x323b('0x58')][_0x323b('0x1c')]({'where':_0x5619a3['where']})[_0x323b('0x21')](function(_0x2700b6){_0x50eaa9[_0x323b('0x1c')]=_0x2700b6;if(_0x282f38[_0x323b('0x2e')][_0x323b('0x47')]){_0x5619a3['include']=[{'all':!![]}];}return db[_0x323b('0x58')]['findAll'](_0x5619a3);})[_0x323b('0x21')](function(_0x45ef54){_0x50eaa9['rows']=_0x45ef54;return _0x50eaa9;});}})[_0x323b('0x21')](respondWithFilteredResult(_0x4c24b2,_0x5619a3))[_0x323b('0x43')](handleError(_0x4c24b2,null));};exports[_0x323b('0x5a')]=function(_0x32e636,_0x4476eb,_0x81494f){var _0x167de0={'raw':!![],'where':{}};var _0xf200b6={};var _0xcc0a22={'count':0x0,'rows':[]};return db[_0x323b('0x2a')][_0x323b('0x5b')]({'where':{'id':_0x32e636[_0x323b('0x45')]['id']}})['then'](handleEntityNotFound(_0x4476eb,null))[_0x323b('0x21')](function(_0x58607f){if(_0x58607f){_0xf200b6['model']=_[_0x323b('0x2f')](db['JscriptyAnswerReport'][_0x323b('0x46')]);_0xf200b6['query']=_[_0x323b('0x2f')](_0x32e636[_0x323b('0x2e')]);_0xf200b6[_0x323b('0x30')]=_['intersection'](_0xf200b6[_0x323b('0x2d')],_0xf200b6[_0x323b('0x2e')]);_0x167de0[_0x323b('0x33')]=_[_0x323b('0x31')](_0xf200b6[_0x323b('0x2d')],qs[_0x323b('0x32')](_0x32e636['query']['fields']));_0x167de0[_0x323b('0x33')]=_0x167de0[_0x323b('0x33')]['length']?_0x167de0[_0x323b('0x33')]:_0xf200b6[_0x323b('0x2d')];if(!_0x32e636[_0x323b('0x2e')][_0x323b('0x35')]('nolimit')){_0x167de0['limit']=qs[_0x323b('0x1b')](_0x32e636[_0x323b('0x2e')][_0x323b('0x1b')]);_0x167de0['offset']=qs[_0x323b('0x1d')](_0x32e636[_0x323b('0x2e')]['offset']);}_0x167de0['order']=qs['sort'](_0x32e636[_0x323b('0x2e')][_0x323b('0x38')]);_0x167de0[_0x323b('0x3b')]=qs[_0x323b('0x30')](_[_0x323b('0x39')](_0x32e636[_0x323b('0x2e')],_0xf200b6[_0x323b('0x30')]));_0x167de0[_0x323b('0x3b')][_0x323b('0x59')]=_0x58607f['id'];if(_0x32e636[_0x323b('0x2e')][_0x323b('0x3a')]){_0x167de0[_0x323b('0x3b')]=_['merge'](_0x167de0['where'],{'$or':_['map'](_0x167de0[_0x323b('0x33')],function(_0x3ed98e){var _0x155981={};_0x155981[_0x3ed98e]={'$like':'%'+_0x32e636['query'][_0x323b('0x3a')]+'%'};return _0x155981;})});}_0x167de0=_[_0x323b('0x3c')]({},_0x167de0,_0x32e636[_0x323b('0x3f')]);return db[_0x323b('0x5c')][_0x323b('0x1c')]({'where':_0x167de0[_0x323b('0x3b')]})[_0x323b('0x21')](function(_0x20b11a){_0xcc0a22[_0x323b('0x1c')]=_0x20b11a;if(_0x32e636[_0x323b('0x2e')][_0x323b('0x47')]){_0x167de0['include']=[{'all':!![]}];}return db[_0x323b('0x5c')][_0x323b('0x41')](_0x167de0);})[_0x323b('0x21')](function(_0x59b5e4){_0xcc0a22[_0x323b('0x42')]=_0x59b5e4;return _0xcc0a22;});}})[_0x323b('0x21')](respondWithFilteredResult(_0x4476eb,_0x167de0))[_0x323b('0x43')](handleError(_0x4476eb,null));};function char(_0x1cda0d){return _0x323b('0x5d')===typeof _0x1cda0d?String[_0x323b('0x5e')]['apply'](null,arguments):_0x1cda0d;}function needsEncapsulation(_0x5d04e9){return!!_0x5d04e9&&(_0x5d04e9[_0x323b('0x5f')]()[_0x323b('0x60')](char(0xd))>=0x0||_0x5d04e9[_0x323b('0x5f')]()[_0x323b('0x60')](char(0xa))>=0x0||_0x5d04e9[_0x323b('0x5f')]()['indexOf'](char(0x2c))>=0x0||_0x5d04e9['toString']()[_0x323b('0x60')](char(0x22))>=0x0);}function encapsulate(_0x1f9f7f){var _0x5bb3de=char(0x22),_0x21be34='\x5c'+char(0x22),_0x35a9df=_0x1f9f7f['toString']()[_0x323b('0x61')](new RegExp(_0x5bb3de,'g'),_0x21be34);return _0x5bb3de+_0x35a9df+_0x5bb3de;}exports[_0x323b('0x62')]=function(_0x10ec5a,_0xbe1f4,_0x4ed784){var _0x129c1f,_0x3f37aa;var _0x490452={'where':{'ProjectId':_0x10ec5a[_0x323b('0x45')]['id']}};if(_0x10ec5a[_0x323b('0x2e')][_0x323b('0x63')]){_0x490452['where']['starttime']=JSON['parse'](_0x10ec5a['query'][_0x323b('0x63')]);}return db['JscriptySessionReport'][_0x323b('0x41')](_0x490452)[_0x323b('0x21')](handleEntityNotFound(_0xbe1f4,null))['then'](function(_0x3fe61d){if(_0x3fe61d){_0x129c1f=_0x3fe61d;return db['JscriptyQuestionReport'][_0x323b('0x41')]({'where':{'SessionId':{'$in':_['map'](_0x129c1f,'id')},'ProjectId':_0x10ec5a[_0x323b('0x45')]['id']},'order':_0x323b('0x64')});}})[_0x323b('0x21')](handleEntityNotFound(_0xbe1f4,null))[_0x323b('0x21')](function(_0x4c9a27){if(_0x4c9a27){_0x3f37aa=_0x4c9a27;var _0x2655ce={};for(var _0x3e983d=0x0,_0x52d75e=_0x3f37aa[_0x323b('0x34')];_0x3e983d<_0x52d75e;_0x3e983d++){if(!_0x2655ce[_0x323b('0x35')](_0x3f37aa[_0x3e983d][_0x323b('0x65')])){_0x2655ce[_0x3f37aa[_0x3e983d][_0x323b('0x65')]]=needsEncapsulation(_0x3f37aa[_0x3e983d][_0x323b('0x66')])?encapsulate(_0x3f37aa[_0x3e983d][_0x323b('0x66')]):_0x3f37aa[_0x3e983d][_0x323b('0x66')];}}var _0x1247ff=[],_0x32f4d3={};for(var _0x690814=0x0,_0x2457c8=_0x129c1f['length'];_0x690814<_0x2457c8;_0x690814++){_0x32f4d3={'ProjectId':_0x10ec5a[_0x323b('0x45')]['id'],'SessionId':_0x129c1f[_0x690814]['id'],'StartTime':moment(_0x129c1f[_0x690814][_0x323b('0x67')])[_0x323b('0x68')](_0x323b('0x69'))};for(var _0xcbe4af=0x0,_0x5bb3c3=_0x3f37aa[_0x323b('0x34')];_0xcbe4af<_0x5bb3c3;_0xcbe4af++){if(_0x3f37aa[_0xcbe4af]['SessionId']==_0x129c1f[_0x690814]['id']&&_0x2655ce[_0x323b('0x35')](_0x3f37aa[_0xcbe4af]['questionId'])){_0x32f4d3[_0x2655ce[_0x3f37aa[_0xcbe4af][_0x323b('0x65')]]]=_0x3f37aa[_0xcbe4af][_0x323b('0x6a')];}}for(var _0x134b34 in _0x2655ce){if(!_0x32f4d3[_0x323b('0x35')](_0x2655ce[_0x134b34])){_0x32f4d3[_0x2655ce[_0x134b34]]=null;}}_0x1247ff[_0x323b('0x6b')](_0x32f4d3);}return _0x1247ff;}})[_0x323b('0x21')](function(_0x2a65dd){if(!_[_0x323b('0x6c')](_0x2a65dd)){var _0x5a3f76=toCsv(_0x2a65dd);var _0x52b8e9=Date[_0x323b('0x6d')]();fs[_0x323b('0x6e')](util[_0x323b('0x68')](_0x323b('0x6f'),_0x10ec5a[_0x323b('0x45')]['id'],_0x52b8e9),_0x5a3f76);_0xbe1f4[_0x323b('0x70')](_0x323b('0x71'),'attachment;\x20filename='+util[_0x323b('0x68')](_0x323b('0x72'),_0x10ec5a[_0x323b('0x45')]['id'],_0x52b8e9));_0xbe1f4['setHeader'](_0x323b('0x73'),_0x323b('0x74'));return _0xbe1f4[_0x323b('0x75')](util['format'](_0x323b('0x6f'),_0x10ec5a['params']['id'],_0x52b8e9));}else{return _0xbe1f4[_0x323b('0x24')](0xcc);}})[_0x323b('0x43')](handleError(_0xbe1f4,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index b4815f4..e9f3290 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 _0x746f=['../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x593528,_0x391f29){var _0x46bc99=function(_0x3a3e61){while(--_0x3a3e61){_0x593528['push'](_0x593528['shift']());}};_0x46bc99(++_0x391f29);}(_0x746f,0x9c));var _0xf746=function(_0x46447b,_0x12547d){_0x46447b=_0x46447b-0x0;var _0x1ff99d=_0x746f[_0x46447b];return _0x1ff99d;};'use strict';var _=require(_0xf746('0x0'));var util=require(_0xf746('0x1'));var logger=require(_0xf746('0x2'))(_0xf746('0x3'));var moment=require(_0xf746('0x4'));var BPromise=require(_0xf746('0x5'));var rp=require(_0xf746('0x6'));var fs=require('fs');var path=require(_0xf746('0x7'));var rimraf=require(_0xf746('0x8'));var config=require(_0xf746('0x9'));var attributes=require(_0xf746('0xa'));module[_0xf746('0xb')]=function(_0x19d855,_0x2f0f3c){return _0x19d855[_0xf746('0xc')](_0xf746('0xd'),attributes,{'tableName':_0xf746('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc01b=['exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xc01b,0x74));var _0xbc01=function(_0x413ce5,_0x4a6302){_0x413ce5=_0x413ce5-0x0;var _0x35d9af=_0xc01b[_0x413ce5];return _0x35d9af;};'use strict';var _=require(_0xbc01('0x0'));var util=require(_0xbc01('0x1'));var logger=require(_0xbc01('0x2'))(_0xbc01('0x3'));var moment=require(_0xbc01('0x4'));var BPromise=require(_0xbc01('0x5'));var rp=require(_0xbc01('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbc01('0x7'));var config=require(_0xbc01('0x8'));var attributes=require(_0xbc01('0x9'));module[_0xbc01('0xa')]=function(_0x279549,_0xdfa6b6){return _0x279549[_0xbc01('0xb')](_0xbc01('0xc'),attributes,{'tableName':_0xbc01('0xd'),'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 24471a6..aada479 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 _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3b4c39,_0x264c16){var _0x1d3fe1=function(_0x3a9664){while(--_0x3a9664){_0x3b4c39['push'](_0x3b4c39['shift']());}};_0x1d3fe1(++_0x264c16);}(_0xaa88,0x137));var _0x8aa8=function(_0x31a37b,_0x826249){_0x31a37b=_0x31a37b-0x0;var _0x49ae16=_0xaa88[_0x31a37b];return _0x49ae16;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file +var _0x9bde=['code','message','JscriptyProject,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x4061d8,_0x10b88d){var _0x114d92=function(_0x191a92){while(--_0x191a92){_0x4061d8['push'](_0x4061d8['shift']());}};_0x114d92(++_0x10b88d);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2e6fc6,_0x4a29dc){_0x2e6fc6=_0x2e6fc6-0x0;var _0x4f4b3a=_0x9bde[_0x2e6fc6];return _0x4f4b3a;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index f112b0e..2e26ba0 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 _0x37a8=['/:id','update','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','index','describe','show','post','create'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x37a8,0x1be));var _0x837a=function(_0x4287fe,_0x14ad49){_0x4287fe=_0x4287fe-0x0;var _0x329a39=_0x37a8[_0x4287fe];return _0x329a39;};'use strict';var multer=require(_0x837a('0x0'));var util=require(_0x837a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x837a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x837a('0x3'));var interaction=require(_0x837a('0x4'));var config=require('../../config/environment');var controller=require(_0x837a('0x5'));router[_0x837a('0x6')]('/',auth[_0x837a('0x7')](),controller[_0x837a('0x8')]);router['get']('/describe',auth[_0x837a('0x7')](),controller[_0x837a('0x9')]);router[_0x837a('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x837a('0xa')]);router[_0x837a('0xb')]('/',auth[_0x837a('0x7')](),controller[_0x837a('0xc')]);router['put'](_0x837a('0xd'),auth[_0x837a('0x7')](),controller[_0x837a('0xe')]);router['delete']('/:id',auth[_0x837a('0x7')](),controller[_0x837a('0xf')]);module[_0x837a('0x10')]=router; \ No newline at end of file +var _0x5c98=['describe','/:id','show','post','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','isAuthenticated','get','/describe'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x5c98,0x107));var _0x85c9=function(_0x1d1568,_0x40bbb0){_0x1d1568=_0x1d1568-0x0;var _0x2b829c=_0x5c98[_0x1d1568];return _0x2b829c;};'use strict';var multer=require(_0x85c9('0x0'));var util=require('util');var path=require(_0x85c9('0x1'));var timeout=require(_0x85c9('0x2'));var express=require('express');var router=express[_0x85c9('0x3')]();var fs_extra=require(_0x85c9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x85c9('0x5'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth[_0x85c9('0x6')](),controller['index']);router[_0x85c9('0x7')](_0x85c9('0x8'),auth[_0x85c9('0x6')](),controller[_0x85c9('0x9')]);router[_0x85c9('0x7')](_0x85c9('0xa'),auth[_0x85c9('0x6')](),controller[_0x85c9('0xb')]);router[_0x85c9('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x85c9('0x6')](),controller[_0x85c9('0xd')]);router[_0x85c9('0xe')](_0x85c9('0xa'),auth[_0x85c9('0x6')](),controller[_0x85c9('0xf')]);module[_0x85c9('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 99edf15..a5b8586 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(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x7a54,0x106));var _0x47a5=function(_0x21f5b4,_0x5d3ac6){_0x21f5b4=_0x21f5b4-0x0;var _0x5095a6=_0x7a54[_0x21f5b4];return _0x5095a6;};'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(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x7a54,0x106));var _0x47a5=function(_0x1a155d,_0xecaead){_0x1a155d=_0x1a155d-0x0;var _0x2ee2ca=_0x7a54[_0x1a155d];return _0x2ee2ca;};'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 b536bed..7821277 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 _0x72e7=['request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','rimraf','zip-dir'];(function(_0x3b8dd8,_0x4c66e9){var _0x3c5243=function(_0x51cb7a){while(--_0x51cb7a){_0x3b8dd8['push'](_0x3b8dd8['shift']());}};_0x3c5243(++_0x4c66e9);}(_0x72e7,0xd9));var _0x772e=function(_0x1b86c0,_0x5dcd0b){_0x1b86c0=_0x1b86c0-0x0;var _0x4feb5e=_0x72e7[_0x1b86c0];return _0x4feb5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x772e('0x0'));var zipdir=require(_0x772e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x772e('0x2'));var moment=require(_0x772e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x772e('0x4'));var util=require(_0x772e('0x5'));var path=require(_0x772e('0x6'));var sox=require('sox');var csv=require(_0x772e('0x7'));var ejs=require(_0x772e('0x8'));var fs=require('fs');var fs_extra=require(_0x772e('0x9'));var _=require(_0x772e('0xa'));var squel=require(_0x772e('0xb'));var crypto=require(_0x772e('0xc'));var jsforce=require(_0x772e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x772e('0x7'));var querystring=require('querystring');var Papa=require(_0x772e('0xe'));var Redis=require(_0x772e('0xf'));var authService=require(_0x772e('0x10'));var qs=require(_0x772e('0x11'));var as=require(_0x772e('0x12'));var hardwareService=require(_0x772e('0x13'));var logger=require(_0x772e('0x14'))('api');var utils=require(_0x772e('0x15'));var config=require(_0x772e('0x16'));var licenseUtil=require(_0x772e('0x17'));var db=require(_0x772e('0x18'))['db'];function respondWithStatusCode(_0x562a4c,_0x1d368c){_0x1d368c=_0x1d368c||0xcc;return function(_0x16c3fa){if(_0x16c3fa){return _0x562a4c['sendStatus'](_0x1d368c);}return _0x562a4c[_0x772e('0x19')](_0x1d368c)[_0x772e('0x1a')]();};}function respondWithResult(_0x4b7466,_0x2f4482){_0x2f4482=_0x2f4482||0xc8;return function(_0x487db9){if(_0x487db9){return _0x4b7466['status'](_0x2f4482)[_0x772e('0x1b')](_0x487db9);}};}function respondWithFilteredResult(_0x513cc5,_0x4195f4){return function(_0x5eec41){if(_0x5eec41){var _0x2a9a2c=typeof _0x4195f4['offset']===_0x772e('0x1c')&&typeof _0x4195f4[_0x772e('0x1d')]===_0x772e('0x1c');var _0x374e9c=_0x5eec41[_0x772e('0x1e')];var _0x3d60db=_0x2a9a2c?0x0:_0x4195f4['offset'];var _0x25e41c=_0x2a9a2c?_0x5eec41['count']:_0x4195f4[_0x772e('0x1f')]+_0x4195f4[_0x772e('0x1d')];var _0x5e8752;if(_0x25e41c>=_0x374e9c){_0x25e41c=_0x374e9c;_0x5e8752=0xc8;}else{_0x5e8752=0xce;}_0x513cc5['status'](_0x5e8752);return _0x513cc5[_0x772e('0x20')](_0x772e('0x21'),_0x3d60db+'-'+_0x25e41c+'/'+_0x374e9c)[_0x772e('0x1b')](_0x5eec41);}return null;};}function patchUpdates(_0x2ae9c3){return function(_0xbe1a22){try{jsonpatch[_0x772e('0x22')](_0xbe1a22,_0x2ae9c3,!![]);}catch(_0x5f341f){return BPromise['reject'](_0x5f341f);}return _0xbe1a22[_0x772e('0x23')]();};}function saveUpdates(_0x4eef3d,_0x2cd816){return function(_0x549916){if(_0x549916){return _0x549916[_0x772e('0x24')](_0x4eef3d)[_0x772e('0x25')](function(_0x2507c6){return _0x2507c6;});}return null;};}function removeEntity(_0x3dff03,_0x4e65a6){return function(_0x2d5809){if(_0x2d5809){return _0x2d5809[_0x772e('0x26')]()[_0x772e('0x25')](function(){_0x3dff03[_0x772e('0x19')](0xcc)[_0x772e('0x1a')]();});}};}function handleEntityNotFound(_0x1a1243,_0x7c034d){return function(_0x376080){if(!_0x376080){_0x1a1243[_0x772e('0x27')](0x194);}return _0x376080;};}function handleError(_0x36b45b,_0xfd42d){_0xfd42d=_0xfd42d||0x1f4;return function(_0x4c680d){logger['error'](_0x4c680d['stack']);if(_0x4c680d[_0x772e('0x28')]){delete _0x4c680d[_0x772e('0x28')];}_0x36b45b['status'](_0xfd42d)[_0x772e('0x29')](_0x4c680d);};}exports['index']=function(_0x50dc7e,_0x3ad079){var _0x28c43c={},_0x28dc5b={},_0x793ce6={'count':0x0,'rows':[]};var _0xdab43c=_[_0x772e('0x2a')](db[_0x772e('0x2b')][_0x772e('0x2c')],function(_0x206298){return{'name':_0x206298[_0x772e('0x2d')],'type':_0x206298[_0x772e('0x2e')]['key']};});_0x28dc5b[_0x772e('0x2f')]=_[_0x772e('0x2a')](_0xdab43c,_0x772e('0x28'));_0x28dc5b[_0x772e('0x30')]=_[_0x772e('0x31')](_0x50dc7e[_0x772e('0x30')]);_0x28dc5b[_0x772e('0x32')]=_['intersection'](_0x28dc5b['model'],_0x28dc5b['query']);_0x28c43c['attributes']=_[_0x772e('0x33')](_0x28dc5b[_0x772e('0x2f')],qs[_0x772e('0x34')](_0x50dc7e[_0x772e('0x30')][_0x772e('0x34')]));_0x28c43c['attributes']=_0x28c43c[_0x772e('0x35')][_0x772e('0x36')]?_0x28c43c['attributes']:_0x28dc5b[_0x772e('0x2f')];if(!_0x50dc7e[_0x772e('0x30')]['hasOwnProperty']('nolimit')){_0x28c43c[_0x772e('0x1d')]=qs[_0x772e('0x1d')](_0x50dc7e[_0x772e('0x30')][_0x772e('0x1d')]);_0x28c43c[_0x772e('0x1f')]=qs[_0x772e('0x1f')](_0x50dc7e[_0x772e('0x30')][_0x772e('0x1f')]);}_0x28c43c[_0x772e('0x37')]=qs[_0x772e('0x38')](_0x50dc7e[_0x772e('0x30')][_0x772e('0x38')]);_0x28c43c[_0x772e('0x39')]=qs[_0x772e('0x32')](_[_0x772e('0x3a')](_0x50dc7e[_0x772e('0x30')],_0x28dc5b['filters']),_0xdab43c);if(_0x50dc7e[_0x772e('0x30')][_0x772e('0x3b')]){_0x28c43c['where']=_['merge'](_0x28c43c['where'],{'$or':_[_0x772e('0x2a')](_0xdab43c,function(_0x151631){if(_0x151631[_0x772e('0x2e')]!=='VIRTUAL'){var _0x2149dd={};_0x2149dd[_0x151631['name']]={'$like':'%'+_0x50dc7e[_0x772e('0x30')]['filter']+'%'};return _0x2149dd;}})});}_0x28c43c=_[_0x772e('0x3c')]({},_0x28c43c,_0x50dc7e[_0x772e('0x3d')]);var _0x4e1d08={'where':_0x28c43c['where']};return db['JscriptyQuestionReport']['count'](_0x4e1d08)[_0x772e('0x25')](function(_0x23473d){_0x793ce6[_0x772e('0x1e')]=_0x23473d;if(_0x50dc7e['query'][_0x772e('0x3e')]){_0x28c43c[_0x772e('0x3f')]=[{'all':!![]}];}return db[_0x772e('0x2b')][_0x772e('0x40')](_0x28c43c);})[_0x772e('0x25')](function(_0x44f1cf){_0x793ce6[_0x772e('0x41')]=_0x44f1cf;return _0x793ce6;})[_0x772e('0x25')](respondWithFilteredResult(_0x3ad079,_0x28c43c))['catch'](handleError(_0x3ad079,null));};exports[_0x772e('0x42')]=function(_0x30615e,_0x3d4b5d){var _0x34202d={'raw':!![],'where':{'id':_0x30615e[_0x772e('0x43')]['id']}},_0xecae6a={};_0xecae6a[_0x772e('0x2f')]=_[_0x772e('0x31')](db[_0x772e('0x2b')][_0x772e('0x2c')]);_0xecae6a['query']=_['keys'](_0x30615e['query']);_0xecae6a[_0x772e('0x32')]=_[_0x772e('0x33')](_0xecae6a['model'],_0xecae6a['query']);_0x34202d[_0x772e('0x35')]=_['intersection'](_0xecae6a[_0x772e('0x2f')],qs['fields'](_0x30615e[_0x772e('0x30')]['fields']));_0x34202d['attributes']=_0x34202d[_0x772e('0x35')][_0x772e('0x36')]?_0x34202d[_0x772e('0x35')]:_0xecae6a[_0x772e('0x2f')];if(_0x30615e[_0x772e('0x30')]['includeAll']){_0x34202d[_0x772e('0x3f')]=[{'all':!![]}];}_0x34202d=_[_0x772e('0x3c')]({},_0x34202d,_0x30615e['options']);return db[_0x772e('0x2b')][_0x772e('0x44')](_0x34202d)[_0x772e('0x25')](handleEntityNotFound(_0x3d4b5d,null))['then'](respondWithResult(_0x3d4b5d,null))[_0x772e('0x45')](handleError(_0x3d4b5d,null));};exports[_0x772e('0x46')]=function(_0x576346,_0x5566d4){return db[_0x772e('0x2b')][_0x772e('0x46')](_0x576346[_0x772e('0x47')],{})[_0x772e('0x25')](respondWithResult(_0x5566d4,0xc9))['catch'](handleError(_0x5566d4,null));};exports[_0x772e('0x24')]=function(_0x596304,_0x58e17e){if(_0x596304[_0x772e('0x47')]['id']){delete _0x596304['body']['id'];}return db['JscriptyQuestionReport'][_0x772e('0x44')]({'where':{'id':_0x596304[_0x772e('0x43')]['id']}})[_0x772e('0x25')](handleEntityNotFound(_0x58e17e,null))['then'](saveUpdates(_0x596304[_0x772e('0x47')],null))['then'](respondWithResult(_0x58e17e,null))[_0x772e('0x45')](handleError(_0x58e17e,null));};exports['destroy']=function(_0x2bb916,_0x10c845){return db['JscriptyQuestionReport'][_0x772e('0x44')]({'where':{'id':_0x2bb916['params']['id']}})[_0x772e('0x25')](handleEntityNotFound(_0x10c845,null))['then'](removeEntity(_0x10c845,null))[_0x772e('0x45')](handleError(_0x10c845,null));};exports[_0x772e('0x48')]=function(_0x44603e,_0x309b8c){return db['JscriptyQuestionReport'][_0x772e('0x48')]()[_0x772e('0x25')](respondWithResult(_0x309b8c,null))[_0x772e('0x45')](handleError(_0x309b8c,null));}; \ No newline at end of file +var _0xb71e=['nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','keys','options','find','catch','create','body','params','describe','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','stack','name','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty'];(function(_0x43d645,_0x478d0c){var _0x50e22b=function(_0x443495){while(--_0x443495){_0x43d645['push'](_0x43d645['shift']());}};_0x50e22b(++_0x478d0c);}(_0xb71e,0xac));var _0xeb71=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xb71e[_0x1b6186];return _0x186121;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb71('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb71('0x1'));var rp=require(_0xeb71('0x2'));var moment=require('moment');var BPromise=require(_0xeb71('0x3'));var Mustache=require('mustache');var util=require(_0xeb71('0x4'));var path=require(_0xeb71('0x5'));var sox=require(_0xeb71('0x6'));var csv=require(_0xeb71('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeb71('0x8'));var _=require(_0xeb71('0x9'));var squel=require(_0xeb71('0xa'));var crypto=require(_0xeb71('0xb'));var jsforce=require(_0xeb71('0xc'));var deskjs=require(_0xeb71('0xd'));var toCsv=require(_0xeb71('0x7'));var querystring=require(_0xeb71('0xe'));var Papa=require(_0xeb71('0xf'));var Redis=require(_0xeb71('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xeb71('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb71('0x12'));var logger=require(_0xeb71('0x13'))(_0xeb71('0x14'));var utils=require(_0xeb71('0x15'));var config=require(_0xeb71('0x16'));var licenseUtil=require(_0xeb71('0x17'));var db=require(_0xeb71('0x18'))['db'];function respondWithStatusCode(_0x4bc6fa,_0x22b40d){_0x22b40d=_0x22b40d||0xcc;return function(_0x12ce03){if(_0x12ce03){return _0x4bc6fa[_0xeb71('0x19')](_0x22b40d);}return _0x4bc6fa['status'](_0x22b40d)['end']();};}function respondWithResult(_0x54fb01,_0x5ac562){_0x5ac562=_0x5ac562||0xc8;return function(_0x276ba9){if(_0x276ba9){return _0x54fb01[_0xeb71('0x1a')](_0x5ac562)[_0xeb71('0x1b')](_0x276ba9);}};}function respondWithFilteredResult(_0x4ea382,_0x5b5c24){return function(_0x1d8f0d){if(_0x1d8f0d){var _0x4d09a4=typeof _0x5b5c24['offset']===_0xeb71('0x1c')&&typeof _0x5b5c24[_0xeb71('0x1d')]===_0xeb71('0x1c');var _0x16a53f=_0x1d8f0d[_0xeb71('0x1e')];var _0x5d53d9=_0x4d09a4?0x0:_0x5b5c24[_0xeb71('0x1f')];var _0x4c81d4=_0x4d09a4?_0x1d8f0d[_0xeb71('0x1e')]:_0x5b5c24[_0xeb71('0x1f')]+_0x5b5c24[_0xeb71('0x1d')];var _0x329f49;if(_0x4c81d4>=_0x16a53f){_0x4c81d4=_0x16a53f;_0x329f49=0xc8;}else{_0x329f49=0xce;}_0x4ea382['status'](_0x329f49);return _0x4ea382[_0xeb71('0x20')](_0xeb71('0x21'),_0x5d53d9+'-'+_0x4c81d4+'/'+_0x16a53f)[_0xeb71('0x1b')](_0x1d8f0d);}return null;};}function patchUpdates(_0x3aa4c0){return function(_0x319bc9){try{jsonpatch[_0xeb71('0x22')](_0x319bc9,_0x3aa4c0,!![]);}catch(_0x240071){return BPromise[_0xeb71('0x23')](_0x240071);}return _0x319bc9['save']();};}function saveUpdates(_0x4eaef9,_0x483640){return function(_0x300162){if(_0x300162){return _0x300162[_0xeb71('0x24')](_0x4eaef9)[_0xeb71('0x25')](function(_0x3465aa){return _0x3465aa;});}return null;};}function removeEntity(_0x4fbfc0,_0x214854){return function(_0xb69df9){if(_0xb69df9){return _0xb69df9[_0xeb71('0x26')]()['then'](function(){_0x4fbfc0[_0xeb71('0x1a')](0xcc)[_0xeb71('0x27')]();});}};}function handleEntityNotFound(_0x3a72ac,_0x113c97){return function(_0x2cdcec){if(!_0x2cdcec){_0x3a72ac[_0xeb71('0x19')](0x194);}return _0x2cdcec;};}function handleError(_0x2c1f67,_0x2bacf3){_0x2bacf3=_0x2bacf3||0x1f4;return function(_0x4a743b){logger['error'](_0x4a743b[_0xeb71('0x28')]);if(_0x4a743b[_0xeb71('0x29')]){delete _0x4a743b[_0xeb71('0x29')];}_0x2c1f67[_0xeb71('0x1a')](_0x2bacf3)['send'](_0x4a743b);};}exports['index']=function(_0x4300d7,_0xda506a){var _0xa7dccb={},_0x540ca1={},_0x2df528={'count':0x0,'rows':[]};var _0xfd040f=_[_0xeb71('0x2a')](db[_0xeb71('0x2b')][_0xeb71('0x2c')],function(_0x3fc92c){return{'name':_0x3fc92c[_0xeb71('0x2d')],'type':_0x3fc92c[_0xeb71('0x2e')][_0xeb71('0x2f')]};});_0x540ca1['model']=_['map'](_0xfd040f,'name');_0x540ca1[_0xeb71('0x30')]=_['keys'](_0x4300d7[_0xeb71('0x30')]);_0x540ca1[_0xeb71('0x31')]=_[_0xeb71('0x32')](_0x540ca1[_0xeb71('0x33')],_0x540ca1[_0xeb71('0x30')]);_0xa7dccb['attributes']=_['intersection'](_0x540ca1[_0xeb71('0x33')],qs[_0xeb71('0x34')](_0x4300d7['query']['fields']));_0xa7dccb[_0xeb71('0x35')]=_0xa7dccb[_0xeb71('0x35')][_0xeb71('0x36')]?_0xa7dccb[_0xeb71('0x35')]:_0x540ca1['model'];if(!_0x4300d7['query'][_0xeb71('0x37')](_0xeb71('0x38'))){_0xa7dccb[_0xeb71('0x1d')]=qs[_0xeb71('0x1d')](_0x4300d7['query']['limit']);_0xa7dccb[_0xeb71('0x1f')]=qs[_0xeb71('0x1f')](_0x4300d7['query'][_0xeb71('0x1f')]);}_0xa7dccb[_0xeb71('0x39')]=qs['sort'](_0x4300d7[_0xeb71('0x30')]['sort']);_0xa7dccb[_0xeb71('0x3a')]=qs[_0xeb71('0x31')](_[_0xeb71('0x3b')](_0x4300d7[_0xeb71('0x30')],_0x540ca1[_0xeb71('0x31')]),_0xfd040f);if(_0x4300d7[_0xeb71('0x30')][_0xeb71('0x3c')]){_0xa7dccb[_0xeb71('0x3a')]=_[_0xeb71('0x3d')](_0xa7dccb[_0xeb71('0x3a')],{'$or':_[_0xeb71('0x2a')](_0xfd040f,function(_0x5b427c){if(_0x5b427c[_0xeb71('0x2e')]!==_0xeb71('0x3e')){var _0x311942={};_0x311942[_0x5b427c[_0xeb71('0x29')]]={'$like':'%'+_0x4300d7[_0xeb71('0x30')][_0xeb71('0x3c')]+'%'};return _0x311942;}})});}_0xa7dccb=_[_0xeb71('0x3d')]({},_0xa7dccb,_0x4300d7['options']);var _0x4a262c={'where':_0xa7dccb[_0xeb71('0x3a')]};return db['JscriptyQuestionReport'][_0xeb71('0x1e')](_0x4a262c)[_0xeb71('0x25')](function(_0x2f874a){_0x2df528[_0xeb71('0x1e')]=_0x2f874a;if(_0x4300d7['query'][_0xeb71('0x3f')]){_0xa7dccb[_0xeb71('0x40')]=[{'all':!![]}];}return db[_0xeb71('0x2b')][_0xeb71('0x41')](_0xa7dccb);})[_0xeb71('0x25')](function(_0x22e944){_0x2df528[_0xeb71('0x42')]=_0x22e944;return _0x2df528;})[_0xeb71('0x25')](respondWithFilteredResult(_0xda506a,_0xa7dccb))['catch'](handleError(_0xda506a,null));};exports[_0xeb71('0x43')]=function(_0x5b759f,_0x3cd40a){var _0xf7453f={'raw':!![],'where':{'id':_0x5b759f['params']['id']}},_0xc0aded={};_0xc0aded[_0xeb71('0x33')]=_[_0xeb71('0x44')](db[_0xeb71('0x2b')]['rawAttributes']);_0xc0aded[_0xeb71('0x30')]=_['keys'](_0x5b759f[_0xeb71('0x30')]);_0xc0aded[_0xeb71('0x31')]=_[_0xeb71('0x32')](_0xc0aded[_0xeb71('0x33')],_0xc0aded[_0xeb71('0x30')]);_0xf7453f['attributes']=_[_0xeb71('0x32')](_0xc0aded['model'],qs[_0xeb71('0x34')](_0x5b759f[_0xeb71('0x30')]['fields']));_0xf7453f[_0xeb71('0x35')]=_0xf7453f[_0xeb71('0x35')][_0xeb71('0x36')]?_0xf7453f[_0xeb71('0x35')]:_0xc0aded[_0xeb71('0x33')];if(_0x5b759f[_0xeb71('0x30')][_0xeb71('0x3f')]){_0xf7453f[_0xeb71('0x40')]=[{'all':!![]}];}_0xf7453f=_[_0xeb71('0x3d')]({},_0xf7453f,_0x5b759f[_0xeb71('0x45')]);return db[_0xeb71('0x2b')][_0xeb71('0x46')](_0xf7453f)[_0xeb71('0x25')](handleEntityNotFound(_0x3cd40a,null))['then'](respondWithResult(_0x3cd40a,null))[_0xeb71('0x47')](handleError(_0x3cd40a,null));};exports[_0xeb71('0x48')]=function(_0x3b7c4d,_0x2fcfe6){return db['JscriptyQuestionReport'][_0xeb71('0x48')](_0x3b7c4d[_0xeb71('0x49')],{})[_0xeb71('0x25')](respondWithResult(_0x2fcfe6,0xc9))['catch'](handleError(_0x2fcfe6,null));};exports[_0xeb71('0x24')]=function(_0x2844cd,_0x38f92f){if(_0x2844cd[_0xeb71('0x49')]['id']){delete _0x2844cd[_0xeb71('0x49')]['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x2844cd[_0xeb71('0x4a')]['id']}})[_0xeb71('0x25')](handleEntityNotFound(_0x38f92f,null))[_0xeb71('0x25')](saveUpdates(_0x2844cd['body'],null))[_0xeb71('0x25')](respondWithResult(_0x38f92f,null))['catch'](handleError(_0x38f92f,null));};exports[_0xeb71('0x26')]=function(_0x97c3ed,_0x2c8c0a){return db[_0xeb71('0x2b')][_0xeb71('0x46')]({'where':{'id':_0x97c3ed[_0xeb71('0x4a')]['id']}})[_0xeb71('0x25')](handleEntityNotFound(_0x2c8c0a,null))[_0xeb71('0x25')](removeEntity(_0x2c8c0a,null))[_0xeb71('0x47')](handleError(_0x2c8c0a,null));};exports[_0xeb71('0x4b')]=function(_0x33ebd1,_0xc8c247){return db[_0xeb71('0x2b')][_0xeb71('0x4b')]()[_0xeb71('0x25')](respondWithResult(_0xc8c247,null))[_0xeb71('0x47')](handleError(_0xc8c247,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 05e97f9..fc06a20 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 _0x38a3=['api','bluebird','request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x38a3,0x101));var _0x338a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x38a3[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x338a('0x0'));var util=require(_0x338a('0x1'));var logger=require(_0x338a('0x2'))(_0x338a('0x3'));var moment=require('moment');var BPromise=require(_0x338a('0x4'));var rp=require(_0x338a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x338a('0x6'));var config=require(_0x338a('0x7'));var attributes=require(_0x338a('0x8'));module[_0x338a('0x9')]=function(_0x126ef8,_0x31446f){return _0x126ef8[_0x338a('0xa')](_0x338a('0xb'),attributes,{'tableName':_0x338a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d99=['define','JscriptyQuestionReport','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports'];(function(_0x3ebd38,_0x459828){var _0x59d797=function(_0x227586){while(--_0x227586){_0x3ebd38['push'](_0x3ebd38['shift']());}};_0x59d797(++_0x459828);}(_0x0d99,0x17b));var _0x90d9=function(_0x11b454,_0x2039ef){_0x11b454=_0x11b454-0x0;var _0x495bc3=_0x0d99[_0x11b454];return _0x495bc3;};'use strict';var _=require(_0x90d9('0x0'));var util=require('util');var logger=require(_0x90d9('0x1'))(_0x90d9('0x2'));var moment=require(_0x90d9('0x3'));var BPromise=require(_0x90d9('0x4'));var rp=require(_0x90d9('0x5'));var fs=require('fs');var path=require(_0x90d9('0x6'));var rimraf=require(_0x90d9('0x7'));var config=require(_0x90d9('0x8'));var attributes=require(_0x90d9('0x9'));module[_0x90d9('0xa')]=function(_0x1beda2,_0x2db37a){return _0x1beda2[_0x90d9('0xb')](_0x90d9('0xc'),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 7c5b14e..069f7c6 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 _0x0559=['rpc','../../config/environment','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','lodash','util','moment','ioredis','../../config/utils'];(function(_0x34c673,_0x379ba0){var _0xe5f8e6=function(_0x3084ed){while(--_0x3084ed){_0x34c673['push'](_0x34c673['shift']());}};_0xe5f8e6(++_0x379ba0);}(_0x0559,0x1b0));var _0x9055=function(_0xc7f23c,_0x2be758){_0xc7f23c=_0xc7f23c-0x0;var _0x4b4def=_0x0559[_0xc7f23c];return _0x4b4def;};'use strict';var _=require(_0x9055('0x0'));var util=require(_0x9055('0x1'));var moment=require(_0x9055('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9055('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9055('0x4'));var logger=require('../../config/logger')(_0x9055('0x5'));var config=require(_0x9055('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9055('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2a07e0,_0x1154f3,_0x209b1e){return new BPromise(function(_0x22e9cf,_0x2587cb){return client[_0x9055('0x8')](_0x2a07e0,_0x209b1e)[_0x9055('0x9')](function(_0x3ab4a3){logger[_0x9055('0xa')](_0x9055('0xb'),_0x1154f3,'request\x20sent');logger[_0x9055('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x1154f3,'request\x20sent',JSON[_0x9055('0xd')](_0x3ab4a3));if(_0x3ab4a3[_0x9055('0xe')]){if(_0x3ab4a3[_0x9055('0xe')][_0x9055('0xf')]===0x1f4){logger[_0x9055('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1154f3,_0x3ab4a3[_0x9055('0xe')][_0x9055('0x10')]);return _0x2587cb(_0x3ab4a3[_0x9055('0xe')][_0x9055('0x10')]);}logger[_0x9055('0xe')](_0x9055('0xb'),_0x1154f3,_0x3ab4a3['error']['message']);return _0x22e9cf(_0x3ab4a3[_0x9055('0xe')][_0x9055('0x10')]);}else{logger[_0x9055('0xa')](_0x9055('0xb'),_0x1154f3,_0x9055('0x11'));_0x22e9cf(_0x3ab4a3[_0x9055('0x12')][_0x9055('0x10')]);}})['catch'](function(_0x187a0b){logger['error'](_0x9055('0xb'),_0x1154f3,_0x187a0b);_0x2587cb(_0x187a0b);});});} \ No newline at end of file +var _0x7cad=['http','request','info','request\x20sent','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xee7ead,_0x5ccfb9){var _0x4d9c47=function(_0x1252eb){while(--_0x1252eb){_0xee7ead['push'](_0xee7ead['shift']());}};_0x4d9c47(++_0x5ccfb9);}(_0x7cad,0x78));var _0xd7ca=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x7cad[_0x11c573];return _0x6b72de;};'use strict';var _=require('lodash');var util=require(_0xd7ca('0x0'));var moment=require(_0xd7ca('0x1'));var BPromise=require(_0xd7ca('0x2'));var rs=require(_0xd7ca('0x3'));var fs=require('fs');var Redis=require(_0xd7ca('0x4'));var db=require(_0xd7ca('0x5'))['db'];var utils=require(_0xd7ca('0x6'));var logger=require(_0xd7ca('0x7'))(_0xd7ca('0x8'));var config=require(_0xd7ca('0x9'));var jayson=require(_0xd7ca('0xa'));var client=jayson[_0xd7ca('0xb')][_0xd7ca('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x338eeb,_0x3a5d60,_0x4b83f7){return new BPromise(function(_0x58d34c,_0x37430a){return client[_0xd7ca('0xd')](_0x338eeb,_0x4b83f7)['then'](function(_0xe90b3f){logger[_0xd7ca('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3a5d60,_0xd7ca('0xf'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x3a5d60,_0xd7ca('0xf'),JSON[_0xd7ca('0x10')](_0xe90b3f));if(_0xe90b3f[_0xd7ca('0x11')]){if(_0xe90b3f[_0xd7ca('0x11')][_0xd7ca('0x12')]===0x1f4){logger[_0xd7ca('0x11')](_0xd7ca('0x13'),_0x3a5d60,_0xe90b3f[_0xd7ca('0x11')]['message']);return _0x37430a(_0xe90b3f[_0xd7ca('0x11')][_0xd7ca('0x14')]);}logger['error'](_0xd7ca('0x13'),_0x3a5d60,_0xe90b3f[_0xd7ca('0x11')][_0xd7ca('0x14')]);return _0x58d34c(_0xe90b3f[_0xd7ca('0x11')]['message']);}else{logger[_0xd7ca('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3a5d60,'request\x20sent');_0x58d34c(_0xe90b3f['result']['message']);}})[_0xd7ca('0x15')](function(_0x2c01f3){logger[_0xd7ca('0x11')](_0xd7ca('0x13'),_0x3a5d60,_0x2c01f3);_0x37430a(_0x2c01f3);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index a5b7a1d..602ee42 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 _0x6144=['get','index','/describe','isAuthenticated','describe','/:id','getQuestions','post','create','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xbf8498,_0x7069b4){var _0x570f72=function(_0x395a7c){while(--_0x395a7c){_0xbf8498['push'](_0xbf8498['shift']());}};_0x570f72(++_0x7069b4);}(_0x6144,0x147));var _0x4614=function(_0x287687,_0x2d6a3f){_0x287687=_0x287687-0x0;var _0x548408=_0x6144[_0x287687];return _0x548408;};'use strict';var multer=require(_0x4614('0x0'));var util=require(_0x4614('0x1'));var path=require(_0x4614('0x2'));var timeout=require('connect-timeout');var express=require(_0x4614('0x3'));var router=express[_0x4614('0x4')]();var fs_extra=require(_0x4614('0x5'));var auth=require(_0x4614('0x6'));var interaction=require(_0x4614('0x7'));var config=require(_0x4614('0x8'));var controller=require('./jscriptySessionReport.controller');router[_0x4614('0x9')]('/',auth['isAuthenticated'](),controller[_0x4614('0xa')]);router[_0x4614('0x9')](_0x4614('0xb'),auth[_0x4614('0xc')](),controller[_0x4614('0xd')]);router[_0x4614('0x9')](_0x4614('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x4614('0x9')]('/:id/questions',auth[_0x4614('0xc')](),controller[_0x4614('0xf')]);router[_0x4614('0x10')]('/',auth['isAuthenticated'](),controller[_0x4614('0x11')]);router['put'](_0x4614('0xe'),auth['isAuthenticated'](),controller[_0x4614('0x12')]);router['delete'](_0x4614('0xe'),auth['isAuthenticated'](),controller[_0x4614('0x13')]);module[_0x4614('0x14')]=router; \ No newline at end of file +var _0x3dc7=['isAuthenticated','index','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get'];(function(_0x251d9c,_0x580977){var _0x16ae64=function(_0x4d3b53){while(--_0x4d3b53){_0x251d9c['push'](_0x251d9c['shift']());}};_0x16ae64(++_0x580977);}(_0x3dc7,0x15d));var _0x73dc=function(_0xb09845,_0x4a3539){_0xb09845=_0xb09845-0x0;var _0x37fcb9=_0x3dc7[_0xb09845];return _0x37fcb9;};'use strict';var multer=require(_0x73dc('0x0'));var util=require(_0x73dc('0x1'));var path=require(_0x73dc('0x2'));var timeout=require('connect-timeout');var express=require(_0x73dc('0x3'));var router=express[_0x73dc('0x4')]();var fs_extra=require(_0x73dc('0x5'));var auth=require(_0x73dc('0x6'));var interaction=require(_0x73dc('0x7'));var config=require(_0x73dc('0x8'));var controller=require(_0x73dc('0x9'));router[_0x73dc('0xa')]('/',auth[_0x73dc('0xb')](),controller[_0x73dc('0xc')]);router[_0x73dc('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x73dc('0xa')](_0x73dc('0xd'),auth[_0x73dc('0xb')](),controller[_0x73dc('0xe')]);router['get'](_0x73dc('0xf'),auth[_0x73dc('0xb')](),controller[_0x73dc('0x10')]);router[_0x73dc('0x11')]('/',auth[_0x73dc('0xb')](),controller[_0x73dc('0x12')]);router[_0x73dc('0x13')]('/:id',auth[_0x73dc('0xb')](),controller[_0x73dc('0x14')]);router[_0x73dc('0x15')]('/:id',auth[_0x73dc('0xb')](),controller[_0x73dc('0x16')]);module[_0x73dc('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index d035c4a..83a0544 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 _0xa3c4=['setDataValue','starttime','endtime','format','STRING','BOOLEAN','moment','sequelize','DATE'];(function(_0x189305,_0x46c43f){var _0xea3406=function(_0x2aa435){while(--_0x2aa435){_0x189305['push'](_0x189305['shift']());}};_0xea3406(++_0x46c43f);}(_0xa3c4,0xba));var _0x4a3c=function(_0x5f54bf,_0x5147e9){_0x5f54bf=_0x5f54bf-0x0;var _0x1c9914=_0xa3c4[_0x5f54bf];return _0x1c9914;};'use strict';var moment=require(_0x4a3c('0x0'));var Sequelize=require(_0x4a3c('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x4a3c('0x2')],'set':function(_0x254501){this[_0x4a3c('0x3')](_0x4a3c('0x4'),_0x254501);this[_0x4a3c('0x3')](_0x4a3c('0x5'),moment()[_0x4a3c('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x4a3c('0x7')]},'queue':{'type':Sequelize[_0x4a3c('0x7')]},'uniqueid':{'type':Sequelize[_0x4a3c('0x7')]},'calleridname':{'type':Sequelize[_0x4a3c('0x7')]},'calleridnum':{'type':Sequelize[_0x4a3c('0x7')]},'completed':{'type':Sequelize[_0x4a3c('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x72bc=['YYYY-MM-DD\x20HH:mm:ss','STRING','sequelize','exports','DATE','setDataValue','starttime','endtime','format'];(function(_0x50dd78,_0x9020cb){var _0xc0132d=function(_0x2faebe){while(--_0x2faebe){_0x50dd78['push'](_0x50dd78['shift']());}};_0xc0132d(++_0x9020cb);}(_0x72bc,0x1d6));var _0xc72b=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x72bc[_0x47b58b];return _0x46bebe;};'use strict';var moment=require('moment');var Sequelize=require(_0xc72b('0x0'));module[_0xc72b('0x1')]={'starttime':{'type':Sequelize[_0xc72b('0x2')],'set':function(_0x537bfb){this[_0xc72b('0x3')](_0xc72b('0x4'),_0x537bfb);this[_0xc72b('0x3')](_0xc72b('0x5'),moment()[_0xc72b('0x6')](_0xc72b('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xc72b('0x8')]},'projectname':{'type':Sequelize[_0xc72b('0x8')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc72b('0x8')]},'calleridname':{'type':Sequelize[_0xc72b('0x8')]},'calleridnum':{'type':Sequelize[_0xc72b('0x8')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index e28df68..6f09b0d 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 _0x7248=['hasOwnProperty','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','JscriptySessionReport','catch','params','length','options','find','create','body','destroy','describe','getQuestions','findOne','nolimit','order','SessionId','JscriptyQuestionReport','findAll','rows','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x5e8eb7,_0x11ff9b){var _0x2efdd0=function(_0x2c4ff3){while(--_0x2c4ff3){_0x5e8eb7['push'](_0x5e8eb7['shift']());}};_0x2efdd0(++_0x11ff9b);}(_0x7248,0x1bf));var _0x8724=function(_0x32cf96,_0x7502d5){_0x32cf96=_0x32cf96-0x0;var _0x125cc1=_0x7248[_0x32cf96];return _0x125cc1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8724('0x0'));var zipdir=require(_0x8724('0x1'));var jsonpatch=require(_0x8724('0x2'));var rp=require(_0x8724('0x3'));var moment=require(_0x8724('0x4'));var BPromise=require(_0x8724('0x5'));var Mustache=require(_0x8724('0x6'));var util=require(_0x8724('0x7'));var path=require(_0x8724('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8724('0x9'));var fs=require('fs');var fs_extra=require(_0x8724('0xa'));var _=require('lodash');var squel=require(_0x8724('0xb'));var crypto=require(_0x8724('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8724('0xd'));var toCsv=require(_0x8724('0xe'));var querystring=require(_0x8724('0xf'));var Papa=require(_0x8724('0x10'));var Redis=require('ioredis');var authService=require(_0x8724('0x11'));var qs=require(_0x8724('0x12'));var as=require(_0x8724('0x13'));var hardwareService=require(_0x8724('0x14'));var logger=require(_0x8724('0x15'))(_0x8724('0x16'));var utils=require(_0x8724('0x17'));var config=require(_0x8724('0x18'));var licenseUtil=require(_0x8724('0x19'));var db=require(_0x8724('0x1a'))['db'];function respondWithStatusCode(_0x3407fa,_0x429bb3){_0x429bb3=_0x429bb3||0xcc;return function(_0x12f8de){if(_0x12f8de){return _0x3407fa[_0x8724('0x1b')](_0x429bb3);}return _0x3407fa['status'](_0x429bb3)[_0x8724('0x1c')]();};}function respondWithResult(_0x5469e6,_0x4938cd){_0x4938cd=_0x4938cd||0xc8;return function(_0x3dc2a4){if(_0x3dc2a4){return _0x5469e6['status'](_0x4938cd)[_0x8724('0x1d')](_0x3dc2a4);}};}function respondWithFilteredResult(_0xd814da,_0x4d6b03){return function(_0x4a5d63){if(_0x4a5d63){var _0x17087a=typeof _0x4d6b03[_0x8724('0x1e')]===_0x8724('0x1f')&&typeof _0x4d6b03[_0x8724('0x20')]===_0x8724('0x1f');var _0x131044=_0x4a5d63[_0x8724('0x21')];var _0x14a28b=_0x17087a?0x0:_0x4d6b03[_0x8724('0x1e')];var _0x4038ea=_0x17087a?_0x4a5d63['count']:_0x4d6b03[_0x8724('0x1e')]+_0x4d6b03[_0x8724('0x20')];var _0x4f94bd;if(_0x4038ea>=_0x131044){_0x4038ea=_0x131044;_0x4f94bd=0xc8;}else{_0x4f94bd=0xce;}_0xd814da[_0x8724('0x22')](_0x4f94bd);return _0xd814da[_0x8724('0x23')](_0x8724('0x24'),_0x14a28b+'-'+_0x4038ea+'/'+_0x131044)[_0x8724('0x1d')](_0x4a5d63);}return null;};}function patchUpdates(_0xf144e2){return function(_0x50057d){try{jsonpatch[_0x8724('0x25')](_0x50057d,_0xf144e2,!![]);}catch(_0x39422b){return BPromise[_0x8724('0x26')](_0x39422b);}return _0x50057d[_0x8724('0x27')]();};}function saveUpdates(_0x1d41b8,_0x57cc1b){return function(_0xb573b2){if(_0xb573b2){return _0xb573b2[_0x8724('0x28')](_0x1d41b8)[_0x8724('0x29')](function(_0x9b9e9d){return _0x9b9e9d;});}return null;};}function removeEntity(_0x11f0c6,_0x2081a9){return function(_0x2dc77c){if(_0x2dc77c){return _0x2dc77c['destroy']()[_0x8724('0x29')](function(){_0x11f0c6['status'](0xcc)[_0x8724('0x1c')]();});}};}function handleEntityNotFound(_0x42cabc,_0x135838){return function(_0x486979){if(!_0x486979){_0x42cabc[_0x8724('0x1b')](0x194);}return _0x486979;};}function handleError(_0xb217a2,_0x1a9126){_0x1a9126=_0x1a9126||0x1f4;return function(_0x112210){logger[_0x8724('0x2a')](_0x112210[_0x8724('0x2b')]);if(_0x112210[_0x8724('0x2c')]){delete _0x112210[_0x8724('0x2c')];}_0xb217a2[_0x8724('0x22')](_0x1a9126)[_0x8724('0x2d')](_0x112210);};}exports['index']=function(_0x47ce81,_0x459abb){var _0xa4b350={},_0xbcf01c={},_0x3d6b36={'count':0x0,'rows':[]};var _0x21d4c0=_[_0x8724('0x2e')](db['JscriptySessionReport'][_0x8724('0x2f')],function(_0x3c85ca){return{'name':_0x3c85ca[_0x8724('0x30')],'type':_0x3c85ca['type'][_0x8724('0x31')]};});_0xbcf01c[_0x8724('0x32')]=_[_0x8724('0x2e')](_0x21d4c0,_0x8724('0x2c'));_0xbcf01c[_0x8724('0x33')]=_[_0x8724('0x34')](_0x47ce81['query']);_0xbcf01c[_0x8724('0x35')]=_[_0x8724('0x36')](_0xbcf01c[_0x8724('0x32')],_0xbcf01c[_0x8724('0x33')]);_0xa4b350[_0x8724('0x37')]=_[_0x8724('0x36')](_0xbcf01c[_0x8724('0x32')],qs[_0x8724('0x38')](_0x47ce81[_0x8724('0x33')][_0x8724('0x38')]));_0xa4b350[_0x8724('0x37')]=_0xa4b350[_0x8724('0x37')]['length']?_0xa4b350[_0x8724('0x37')]:_0xbcf01c[_0x8724('0x32')];if(!_0x47ce81[_0x8724('0x33')][_0x8724('0x39')]('nolimit')){_0xa4b350['limit']=qs[_0x8724('0x20')](_0x47ce81['query']['limit']);_0xa4b350[_0x8724('0x1e')]=qs[_0x8724('0x1e')](_0x47ce81[_0x8724('0x33')][_0x8724('0x1e')]);}_0xa4b350['order']=qs['sort'](_0x47ce81[_0x8724('0x33')][_0x8724('0x3a')]);_0xa4b350['where']=qs[_0x8724('0x35')](_[_0x8724('0x3b')](_0x47ce81[_0x8724('0x33')],_0xbcf01c[_0x8724('0x35')]),_0x21d4c0);if(_0x47ce81[_0x8724('0x33')]['filter']){_0xa4b350[_0x8724('0x3c')]=_[_0x8724('0x3d')](_0xa4b350[_0x8724('0x3c')],{'$or':_[_0x8724('0x2e')](_0x21d4c0,function(_0x5b071d){if(_0x5b071d['type']!==_0x8724('0x3e')){var _0x3ef8a8={};_0x3ef8a8[_0x5b071d[_0x8724('0x2c')]]={'$like':'%'+_0x47ce81[_0x8724('0x33')][_0x8724('0x3f')]+'%'};return _0x3ef8a8;}})});}_0xa4b350=_[_0x8724('0x3d')]({},_0xa4b350,_0x47ce81['options']);var _0x288f86={'where':_0xa4b350[_0x8724('0x3c')]};return db['JscriptySessionReport'][_0x8724('0x21')](_0x288f86)[_0x8724('0x29')](function(_0x48c1a5){_0x3d6b36[_0x8724('0x21')]=_0x48c1a5;if(_0x47ce81['query'][_0x8724('0x40')]){_0xa4b350[_0x8724('0x41')]=[{'all':!![]}];}return db[_0x8724('0x42')]['findAll'](_0xa4b350);})['then'](function(_0x312269){_0x3d6b36['rows']=_0x312269;return _0x3d6b36;})[_0x8724('0x29')](respondWithFilteredResult(_0x459abb,_0xa4b350))[_0x8724('0x43')](handleError(_0x459abb,null));};exports['show']=function(_0x70eb06,_0x1008b6){var _0x2208bc={'raw':!![],'where':{'id':_0x70eb06[_0x8724('0x44')]['id']}},_0x3ff5fd={};_0x3ff5fd[_0x8724('0x32')]=_[_0x8724('0x34')](db[_0x8724('0x42')]['rawAttributes']);_0x3ff5fd[_0x8724('0x33')]=_[_0x8724('0x34')](_0x70eb06[_0x8724('0x33')]);_0x3ff5fd[_0x8724('0x35')]=_[_0x8724('0x36')](_0x3ff5fd[_0x8724('0x32')],_0x3ff5fd[_0x8724('0x33')]);_0x2208bc[_0x8724('0x37')]=_['intersection'](_0x3ff5fd[_0x8724('0x32')],qs[_0x8724('0x38')](_0x70eb06['query'][_0x8724('0x38')]));_0x2208bc[_0x8724('0x37')]=_0x2208bc[_0x8724('0x37')][_0x8724('0x45')]?_0x2208bc[_0x8724('0x37')]:_0x3ff5fd[_0x8724('0x32')];if(_0x70eb06['query']['includeAll']){_0x2208bc['include']=[{'all':!![]}];}_0x2208bc=_[_0x8724('0x3d')]({},_0x2208bc,_0x70eb06[_0x8724('0x46')]);return db[_0x8724('0x42')][_0x8724('0x47')](_0x2208bc)[_0x8724('0x29')](handleEntityNotFound(_0x1008b6,null))[_0x8724('0x29')](respondWithResult(_0x1008b6,null))['catch'](handleError(_0x1008b6,null));};exports[_0x8724('0x48')]=function(_0x16e326,_0x33be03){return db['JscriptySessionReport'][_0x8724('0x48')](_0x16e326[_0x8724('0x49')],{})['then'](respondWithResult(_0x33be03,0xc9))[_0x8724('0x43')](handleError(_0x33be03,null));};exports[_0x8724('0x28')]=function(_0x36c2da,_0x46934a){if(_0x36c2da[_0x8724('0x49')]['id']){delete _0x36c2da[_0x8724('0x49')]['id'];}return db[_0x8724('0x42')]['find']({'where':{'id':_0x36c2da['params']['id']}})[_0x8724('0x29')](handleEntityNotFound(_0x46934a,null))[_0x8724('0x29')](saveUpdates(_0x36c2da[_0x8724('0x49')],null))['then'](respondWithResult(_0x46934a,null))[_0x8724('0x43')](handleError(_0x46934a,null));};exports[_0x8724('0x4a')]=function(_0x5e8a46,_0x1af643){return db[_0x8724('0x42')][_0x8724('0x47')]({'where':{'id':_0x5e8a46[_0x8724('0x44')]['id']}})[_0x8724('0x29')](handleEntityNotFound(_0x1af643,null))[_0x8724('0x29')](removeEntity(_0x1af643,null))['catch'](handleError(_0x1af643,null));};exports[_0x8724('0x4b')]=function(_0x2071db,_0x4da03e){return db[_0x8724('0x42')][_0x8724('0x4b')]()[_0x8724('0x29')](respondWithResult(_0x4da03e,null))['catch'](handleError(_0x4da03e,null));};exports[_0x8724('0x4c')]=function(_0x4a62e7,_0x44d78e,_0x1dee41){var _0x2a6397={'raw':!![],'where':{}};var _0x1ab4eb={};var _0x1504a9={'count':0x0,'rows':[]};return db[_0x8724('0x42')][_0x8724('0x4d')]({'where':{'id':_0x4a62e7[_0x8724('0x44')]['id']}})[_0x8724('0x29')](handleEntityNotFound(_0x44d78e,null))[_0x8724('0x29')](function(_0x5902d6){if(_0x5902d6){_0x1ab4eb['model']=_[_0x8724('0x34')](db['JscriptyQuestionReport'][_0x8724('0x2f')]);_0x1ab4eb[_0x8724('0x33')]=_['keys'](_0x4a62e7[_0x8724('0x33')]);_0x1ab4eb['filters']=_[_0x8724('0x36')](_0x1ab4eb[_0x8724('0x32')],_0x1ab4eb[_0x8724('0x33')]);_0x2a6397[_0x8724('0x37')]=_['intersection'](_0x1ab4eb[_0x8724('0x32')],qs[_0x8724('0x38')](_0x4a62e7['query'][_0x8724('0x38')]));_0x2a6397[_0x8724('0x37')]=_0x2a6397[_0x8724('0x37')][_0x8724('0x45')]?_0x2a6397[_0x8724('0x37')]:_0x1ab4eb['model'];if(!_0x4a62e7[_0x8724('0x33')]['hasOwnProperty'](_0x8724('0x4e'))){_0x2a6397['limit']=qs[_0x8724('0x20')](_0x4a62e7[_0x8724('0x33')][_0x8724('0x20')]);_0x2a6397[_0x8724('0x1e')]=qs['offset'](_0x4a62e7[_0x8724('0x33')][_0x8724('0x1e')]);}_0x2a6397[_0x8724('0x4f')]=qs['sort'](_0x4a62e7[_0x8724('0x33')][_0x8724('0x3a')]);_0x2a6397['where']=qs['filters'](_[_0x8724('0x3b')](_0x4a62e7[_0x8724('0x33')],_0x1ab4eb[_0x8724('0x35')]));_0x2a6397[_0x8724('0x3c')][_0x8724('0x50')]=_0x5902d6['id'];if(_0x4a62e7[_0x8724('0x33')][_0x8724('0x3f')]){_0x2a6397['where']=_[_0x8724('0x3d')](_0x2a6397[_0x8724('0x3c')],{'$or':_[_0x8724('0x2e')](_0x2a6397[_0x8724('0x37')],function(_0x39a30d){var _0x16c05e={};_0x16c05e[_0x39a30d]={'$like':'%'+_0x4a62e7[_0x8724('0x33')][_0x8724('0x3f')]+'%'};return _0x16c05e;})});}_0x2a6397=_[_0x8724('0x3d')]({},_0x2a6397,_0x4a62e7[_0x8724('0x46')]);return db['JscriptyQuestionReport']['count']({'where':_0x2a6397[_0x8724('0x3c')]})[_0x8724('0x29')](function(_0x5830b2){_0x1504a9[_0x8724('0x21')]=_0x5830b2;if(_0x4a62e7['query'][_0x8724('0x40')]){_0x2a6397[_0x8724('0x41')]=[{'all':!![]}];}return db[_0x8724('0x51')][_0x8724('0x52')](_0x2a6397);})[_0x8724('0x29')](function(_0x9bd4cc){_0x1504a9[_0x8724('0x53')]=_0x9bd4cc;return _0x1504a9;});}})[_0x8724('0x29')](respondWithFilteredResult(_0x44d78e,_0x2a6397))[_0x8724('0x43')](handleError(_0x44d78e,null));}; \ No newline at end of file +var _0xed43=['rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','intersection','find','create','body','catch','update','describe','getQuestions','findOne','params','JscriptyQuestionReport','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','count','json','apply','reject','save','then','destroy','end','error','name','send','map','JscriptySessionReport'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xed43,0x1a6));var _0x3ed4=function(_0x46c1d5,_0x5ca335){_0x46c1d5=_0x46c1d5-0x0;var _0x40fe7b=_0xed43[_0x46c1d5];return _0x40fe7b;};'use strict';var emlformat=require(_0x3ed4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3ed4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3ed4('0x2'));var moment=require(_0x3ed4('0x3'));var BPromise=require(_0x3ed4('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3ed4('0x5'));var sox=require(_0x3ed4('0x6'));var csv=require(_0x3ed4('0x7'));var ejs=require(_0x3ed4('0x8'));var fs=require('fs');var fs_extra=require(_0x3ed4('0x9'));var _=require(_0x3ed4('0xa'));var squel=require(_0x3ed4('0xb'));var crypto=require(_0x3ed4('0xc'));var jsforce=require(_0x3ed4('0xd'));var deskjs=require(_0x3ed4('0xe'));var toCsv=require(_0x3ed4('0x7'));var querystring=require('querystring');var Papa=require(_0x3ed4('0xf'));var Redis=require(_0x3ed4('0x10'));var authService=require(_0x3ed4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3ed4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ed4('0x13'))(_0x3ed4('0x14'));var utils=require('../../config/utils');var config=require(_0x3ed4('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3ed4('0x16'))['db'];function respondWithStatusCode(_0x4aedb0,_0x546703){_0x546703=_0x546703||0xcc;return function(_0x4fee70){if(_0x4fee70){return _0x4aedb0[_0x3ed4('0x17')](_0x546703);}return _0x4aedb0['status'](_0x546703)['end']();};}function respondWithResult(_0x3a2769,_0x3054ff){_0x3054ff=_0x3054ff||0xc8;return function(_0xcd5026){if(_0xcd5026){return _0x3a2769[_0x3ed4('0x18')](_0x3054ff)['json'](_0xcd5026);}};}function respondWithFilteredResult(_0x412433,_0x19bb7d){return function(_0x708387){if(_0x708387){var _0x553316=typeof _0x19bb7d['offset']===_0x3ed4('0x19')&&typeof _0x19bb7d[_0x3ed4('0x1a')]===_0x3ed4('0x19');var _0x194868=_0x708387[_0x3ed4('0x1b')];var _0x4be686=_0x553316?0x0:_0x19bb7d['offset'];var _0x16bc94=_0x553316?_0x708387['count']:_0x19bb7d['offset']+_0x19bb7d[_0x3ed4('0x1a')];var _0x236490;if(_0x16bc94>=_0x194868){_0x16bc94=_0x194868;_0x236490=0xc8;}else{_0x236490=0xce;}_0x412433['status'](_0x236490);return _0x412433['set']('Content-Range',_0x4be686+'-'+_0x16bc94+'/'+_0x194868)[_0x3ed4('0x1c')](_0x708387);}return null;};}function patchUpdates(_0x4a3168){return function(_0x45e563){try{jsonpatch[_0x3ed4('0x1d')](_0x45e563,_0x4a3168,!![]);}catch(_0x2f4319){return BPromise[_0x3ed4('0x1e')](_0x2f4319);}return _0x45e563[_0x3ed4('0x1f')]();};}function saveUpdates(_0x594dc5,_0x1e4775){return function(_0x3beab9){if(_0x3beab9){return _0x3beab9['update'](_0x594dc5)[_0x3ed4('0x20')](function(_0x57f693){return _0x57f693;});}return null;};}function removeEntity(_0x538bb5,_0x34207c){return function(_0x29bed9){if(_0x29bed9){return _0x29bed9[_0x3ed4('0x21')]()[_0x3ed4('0x20')](function(){_0x538bb5[_0x3ed4('0x18')](0xcc)[_0x3ed4('0x22')]();});}};}function handleEntityNotFound(_0x298aac,_0x42d880){return function(_0x5d014e){if(!_0x5d014e){_0x298aac[_0x3ed4('0x17')](0x194);}return _0x5d014e;};}function handleError(_0x1ec69d,_0x1edfe7){_0x1edfe7=_0x1edfe7||0x1f4;return function(_0x46ec11){logger[_0x3ed4('0x23')](_0x46ec11['stack']);if(_0x46ec11[_0x3ed4('0x24')]){delete _0x46ec11[_0x3ed4('0x24')];}_0x1ec69d[_0x3ed4('0x18')](_0x1edfe7)[_0x3ed4('0x25')](_0x46ec11);};}exports['index']=function(_0x21ce6e,_0x2d522b){var _0xbd77c8={},_0x5346fe={},_0x1c932d={'count':0x0,'rows':[]};var _0x2a3613=_[_0x3ed4('0x26')](db[_0x3ed4('0x27')][_0x3ed4('0x28')],function(_0x4d936d){return{'name':_0x4d936d[_0x3ed4('0x29')],'type':_0x4d936d[_0x3ed4('0x2a')]['key']};});_0x5346fe[_0x3ed4('0x2b')]=_['map'](_0x2a3613,'name');_0x5346fe[_0x3ed4('0x2c')]=_[_0x3ed4('0x2d')](_0x21ce6e['query']);_0x5346fe[_0x3ed4('0x2e')]=_['intersection'](_0x5346fe[_0x3ed4('0x2b')],_0x5346fe['query']);_0xbd77c8[_0x3ed4('0x2f')]=_['intersection'](_0x5346fe[_0x3ed4('0x2b')],qs[_0x3ed4('0x30')](_0x21ce6e[_0x3ed4('0x2c')]['fields']));_0xbd77c8[_0x3ed4('0x2f')]=_0xbd77c8[_0x3ed4('0x2f')][_0x3ed4('0x31')]?_0xbd77c8['attributes']:_0x5346fe[_0x3ed4('0x2b')];if(!_0x21ce6e[_0x3ed4('0x2c')][_0x3ed4('0x32')](_0x3ed4('0x33'))){_0xbd77c8[_0x3ed4('0x1a')]=qs[_0x3ed4('0x1a')](_0x21ce6e['query']['limit']);_0xbd77c8[_0x3ed4('0x34')]=qs[_0x3ed4('0x34')](_0x21ce6e['query']['offset']);}_0xbd77c8[_0x3ed4('0x35')]=qs[_0x3ed4('0x36')](_0x21ce6e[_0x3ed4('0x2c')]['sort']);_0xbd77c8['where']=qs[_0x3ed4('0x2e')](_[_0x3ed4('0x37')](_0x21ce6e['query'],_0x5346fe[_0x3ed4('0x2e')]),_0x2a3613);if(_0x21ce6e[_0x3ed4('0x2c')][_0x3ed4('0x38')]){_0xbd77c8[_0x3ed4('0x39')]=_[_0x3ed4('0x3a')](_0xbd77c8['where'],{'$or':_[_0x3ed4('0x26')](_0x2a3613,function(_0xe28746){if(_0xe28746[_0x3ed4('0x2a')]!==_0x3ed4('0x3b')){var _0x123956={};_0x123956[_0xe28746[_0x3ed4('0x24')]]={'$like':'%'+_0x21ce6e[_0x3ed4('0x2c')][_0x3ed4('0x38')]+'%'};return _0x123956;}})});}_0xbd77c8=_[_0x3ed4('0x3a')]({},_0xbd77c8,_0x21ce6e[_0x3ed4('0x3c')]);var _0xb3c21b={'where':_0xbd77c8[_0x3ed4('0x39')]};return db['JscriptySessionReport'][_0x3ed4('0x1b')](_0xb3c21b)[_0x3ed4('0x20')](function(_0x13d2f9){_0x1c932d[_0x3ed4('0x1b')]=_0x13d2f9;if(_0x21ce6e[_0x3ed4('0x2c')][_0x3ed4('0x3d')]){_0xbd77c8[_0x3ed4('0x3e')]=[{'all':!![]}];}return db[_0x3ed4('0x27')][_0x3ed4('0x3f')](_0xbd77c8);})[_0x3ed4('0x20')](function(_0x2d6eba){_0x1c932d[_0x3ed4('0x40')]=_0x2d6eba;return _0x1c932d;})[_0x3ed4('0x20')](respondWithFilteredResult(_0x2d522b,_0xbd77c8))['catch'](handleError(_0x2d522b,null));};exports[_0x3ed4('0x41')]=function(_0x3e4b48,_0x4699ab){var _0x1ed215={'raw':!![],'where':{'id':_0x3e4b48['params']['id']}},_0x1467cd={};_0x1467cd[_0x3ed4('0x2b')]=_[_0x3ed4('0x2d')](db['JscriptySessionReport'][_0x3ed4('0x28')]);_0x1467cd[_0x3ed4('0x2c')]=_[_0x3ed4('0x2d')](_0x3e4b48[_0x3ed4('0x2c')]);_0x1467cd['filters']=_[_0x3ed4('0x42')](_0x1467cd['model'],_0x1467cd[_0x3ed4('0x2c')]);_0x1ed215[_0x3ed4('0x2f')]=_[_0x3ed4('0x42')](_0x1467cd[_0x3ed4('0x2b')],qs[_0x3ed4('0x30')](_0x3e4b48[_0x3ed4('0x2c')][_0x3ed4('0x30')]));_0x1ed215[_0x3ed4('0x2f')]=_0x1ed215['attributes'][_0x3ed4('0x31')]?_0x1ed215[_0x3ed4('0x2f')]:_0x1467cd[_0x3ed4('0x2b')];if(_0x3e4b48[_0x3ed4('0x2c')][_0x3ed4('0x3d')]){_0x1ed215['include']=[{'all':!![]}];}_0x1ed215=_[_0x3ed4('0x3a')]({},_0x1ed215,_0x3e4b48[_0x3ed4('0x3c')]);return db['JscriptySessionReport'][_0x3ed4('0x43')](_0x1ed215)[_0x3ed4('0x20')](handleEntityNotFound(_0x4699ab,null))[_0x3ed4('0x20')](respondWithResult(_0x4699ab,null))['catch'](handleError(_0x4699ab,null));};exports[_0x3ed4('0x44')]=function(_0x2baf10,_0x264000){return db['JscriptySessionReport'][_0x3ed4('0x44')](_0x2baf10[_0x3ed4('0x45')],{})['then'](respondWithResult(_0x264000,0xc9))[_0x3ed4('0x46')](handleError(_0x264000,null));};exports[_0x3ed4('0x47')]=function(_0x5ac6c2,_0x2f9194){if(_0x5ac6c2['body']['id']){delete _0x5ac6c2[_0x3ed4('0x45')]['id'];}return db[_0x3ed4('0x27')][_0x3ed4('0x43')]({'where':{'id':_0x5ac6c2['params']['id']}})[_0x3ed4('0x20')](handleEntityNotFound(_0x2f9194,null))[_0x3ed4('0x20')](saveUpdates(_0x5ac6c2[_0x3ed4('0x45')],null))[_0x3ed4('0x20')](respondWithResult(_0x2f9194,null))[_0x3ed4('0x46')](handleError(_0x2f9194,null));};exports[_0x3ed4('0x21')]=function(_0x1bf0b9,_0x3b3419){return db[_0x3ed4('0x27')]['find']({'where':{'id':_0x1bf0b9['params']['id']}})['then'](handleEntityNotFound(_0x3b3419,null))[_0x3ed4('0x20')](removeEntity(_0x3b3419,null))[_0x3ed4('0x46')](handleError(_0x3b3419,null));};exports[_0x3ed4('0x48')]=function(_0x2c8825,_0xf878db){return db[_0x3ed4('0x27')][_0x3ed4('0x48')]()[_0x3ed4('0x20')](respondWithResult(_0xf878db,null))['catch'](handleError(_0xf878db,null));};exports[_0x3ed4('0x49')]=function(_0x49035d,_0x2ada46,_0x59d324){var _0x5ea720={'raw':!![],'where':{}};var _0x522c02={};var _0xa89590={'count':0x0,'rows':[]};return db[_0x3ed4('0x27')][_0x3ed4('0x4a')]({'where':{'id':_0x49035d[_0x3ed4('0x4b')]['id']}})[_0x3ed4('0x20')](handleEntityNotFound(_0x2ada46,null))[_0x3ed4('0x20')](function(_0x44d4e5){if(_0x44d4e5){_0x522c02[_0x3ed4('0x2b')]=_['keys'](db[_0x3ed4('0x4c')]['rawAttributes']);_0x522c02[_0x3ed4('0x2c')]=_[_0x3ed4('0x2d')](_0x49035d[_0x3ed4('0x2c')]);_0x522c02[_0x3ed4('0x2e')]=_['intersection'](_0x522c02[_0x3ed4('0x2b')],_0x522c02[_0x3ed4('0x2c')]);_0x5ea720[_0x3ed4('0x2f')]=_['intersection'](_0x522c02[_0x3ed4('0x2b')],qs[_0x3ed4('0x30')](_0x49035d[_0x3ed4('0x2c')][_0x3ed4('0x30')]));_0x5ea720[_0x3ed4('0x2f')]=_0x5ea720['attributes'][_0x3ed4('0x31')]?_0x5ea720['attributes']:_0x522c02[_0x3ed4('0x2b')];if(!_0x49035d[_0x3ed4('0x2c')]['hasOwnProperty'](_0x3ed4('0x33'))){_0x5ea720[_0x3ed4('0x1a')]=qs[_0x3ed4('0x1a')](_0x49035d['query']['limit']);_0x5ea720[_0x3ed4('0x34')]=qs[_0x3ed4('0x34')](_0x49035d[_0x3ed4('0x2c')][_0x3ed4('0x34')]);}_0x5ea720[_0x3ed4('0x35')]=qs[_0x3ed4('0x36')](_0x49035d[_0x3ed4('0x2c')]['sort']);_0x5ea720[_0x3ed4('0x39')]=qs[_0x3ed4('0x2e')](_[_0x3ed4('0x37')](_0x49035d['query'],_0x522c02[_0x3ed4('0x2e')]));_0x5ea720[_0x3ed4('0x39')]['SessionId']=_0x44d4e5['id'];if(_0x49035d[_0x3ed4('0x2c')][_0x3ed4('0x38')]){_0x5ea720[_0x3ed4('0x39')]=_[_0x3ed4('0x3a')](_0x5ea720[_0x3ed4('0x39')],{'$or':_[_0x3ed4('0x26')](_0x5ea720[_0x3ed4('0x2f')],function(_0x348049){var _0x44ee6e={};_0x44ee6e[_0x348049]={'$like':'%'+_0x49035d['query'][_0x3ed4('0x38')]+'%'};return _0x44ee6e;})});}_0x5ea720=_[_0x3ed4('0x3a')]({},_0x5ea720,_0x49035d[_0x3ed4('0x3c')]);return db['JscriptyQuestionReport']['count']({'where':_0x5ea720['where']})['then'](function(_0x59ae4b){_0xa89590[_0x3ed4('0x1b')]=_0x59ae4b;if(_0x49035d[_0x3ed4('0x2c')][_0x3ed4('0x3d')]){_0x5ea720[_0x3ed4('0x3e')]=[{'all':!![]}];}return db[_0x3ed4('0x4c')][_0x3ed4('0x3f')](_0x5ea720);})['then'](function(_0x4b2c33){_0xa89590[_0x3ed4('0x40')]=_0x4b2c33;return _0xa89590;});}})[_0x3ed4('0x20')](respondWithFilteredResult(_0x2ada46,_0x5ea720))[_0x3ed4('0x46')](handleError(_0x2ada46,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 7808d58..dea01a6 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 _0xf006=['bluebird','path','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions','../../config/logger','api'];(function(_0x16d6ec,_0x2a31b7){var _0xd0bda8=function(_0x5a2931){while(--_0x5a2931){_0x16d6ec['push'](_0x16d6ec['shift']());}};_0xd0bda8(++_0x2a31b7);}(_0xf006,0x146));var _0x6f00=function(_0x5e4288,_0x34133d){_0x5e4288=_0x5e4288-0x0;var _0x3fbd06=_0xf006[_0x5e4288];return _0x3fbd06;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6f00('0x0'))(_0x6f00('0x1'));var moment=require('moment');var BPromise=require(_0x6f00('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f00('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6f00('0x4'));module[_0x6f00('0x5')]=function(_0x141e71,_0x52c9a2){return _0x141e71[_0x6f00('0x6')]('JscriptySessionReport',attributes,{'tableName':_0x6f00('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x323f=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions'];(function(_0x2812e0,_0x484057){var _0x5f43ef=function(_0x15f0c5){while(--_0x15f0c5){_0x2812e0['push'](_0x2812e0['shift']());}};_0x5f43ef(++_0x484057);}(_0x323f,0x1ee));var _0xf323=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x323f[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var logger=require('../../config/logger')(_0xf323('0x1'));var moment=require(_0xf323('0x2'));var BPromise=require(_0xf323('0x3'));var rp=require(_0xf323('0x4'));var fs=require('fs');var path=require(_0xf323('0x5'));var rimraf=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var attributes=require(_0xf323('0x8'));module[_0xf323('0x9')]=function(_0x371707,_0x5d7d60){return _0x371707[_0xf323('0xa')](_0xf323('0xb'),attributes,{'tableName':_0xf323('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index edfaa70..7fb36cd 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 _0x90b1=['message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2f6e51,_0x57a4f7){var _0x2001d1=function(_0x50a669){while(--_0x50a669){_0x2f6e51['push'](_0x2f6e51['shift']());}};_0x2001d1(++_0x57a4f7);}(_0x90b1,0x1bb));var _0x190b=function(_0x18bb67,_0x5eff3d){_0x18bb67=_0x18bb67-0x0;var _0x149f9a=_0x90b1[_0x18bb67];return _0x149f9a;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var moment=require(_0x190b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x190b('0x3'));var db=require(_0x190b('0x4'))['db'];var utils=require(_0x190b('0x5'));var logger=require(_0x190b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x190b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x34a689,_0x3b57f7,_0x626aa1){return new BPromise(function(_0x311161,_0x802924){return client[_0x190b('0x8')](_0x34a689,_0x626aa1)['then'](function(_0x14b93d){logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));logger[_0x190b('0xc')](_0x190b('0xd'),_0x3b57f7,_0x190b('0xb'),JSON[_0x190b('0xe')](_0x14b93d));if(_0x14b93d['error']){if(_0x14b93d[_0x190b('0xf')][_0x190b('0x10')]===0x1f4){logger['error'](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x802924(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}logger[_0x190b('0xf')](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x311161(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}else{logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));_0x311161(_0x14b93d[_0x190b('0x12')][_0x190b('0x11')]);}})[_0x190b('0x13')](function(_0x5c63d9){logger[_0x190b('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x3b57f7,_0x5c63d9);_0x802924(_0x5c63d9);});});} \ No newline at end of file +var _0x3a6d=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x3a6d,0x143));var _0xd3a6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3a6d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var moment=require('moment');var BPromise=require(_0xd3a6('0x2'));var rs=require(_0xd3a6('0x3'));var fs=require('fs');var Redis=require(_0xd3a6('0x4'));var db=require(_0xd3a6('0x5'))['db'];var utils=require(_0xd3a6('0x6'));var logger=require('../../config/logger')(_0xd3a6('0x7'));var config=require(_0xd3a6('0x8'));var jayson=require(_0xd3a6('0x9'));var client=jayson[_0xd3a6('0xa')][_0xd3a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x282cb1,_0x58d83a,_0x121bd2){return new BPromise(function(_0x134dd3,_0x16858){return client[_0xd3a6('0xc')](_0x282cb1,_0x121bd2)[_0xd3a6('0xd')](function(_0xa67661){logger[_0xd3a6('0xe')](_0xd3a6('0xf'),_0x58d83a,_0xd3a6('0x10'));logger['debug'](_0xd3a6('0x11'),_0x58d83a,_0xd3a6('0x10'),JSON[_0xd3a6('0x12')](_0xa67661));if(_0xa67661[_0xd3a6('0x13')]){if(_0xa67661[_0xd3a6('0x13')]['code']===0x1f4){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x58d83a,_0xa67661[_0xd3a6('0x13')][_0xd3a6('0x14')]);return _0x16858(_0xa67661[_0xd3a6('0x13')][_0xd3a6('0x14')]);}logger[_0xd3a6('0x13')](_0xd3a6('0xf'),_0x58d83a,_0xa67661[_0xd3a6('0x13')]['message']);return _0x134dd3(_0xa67661[_0xd3a6('0x13')][_0xd3a6('0x14')]);}else{logger[_0xd3a6('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0x58d83a,_0xd3a6('0x10'));_0x134dd3(_0xa67661[_0xd3a6('0x15')][_0xd3a6('0x14')]);}})['catch'](function(_0x3498d5){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x58d83a,_0x3498d5);_0x16858(_0x3498d5);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 89963f1..cc81136 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 _0x1738=['fs-extra','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update','exports','multer','util','express','Router'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x1738,0x1bc));var _0x8173=function(_0x3f446f,_0x914cd6){_0x3f446f=_0x3f446f-0x0;var _0x523c66=_0x1738[_0x3f446f];return _0x523c66;};'use strict';var multer=require(_0x8173('0x0'));var util=require(_0x8173('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8173('0x2'));var router=express[_0x8173('0x3')]();var fs_extra=require(_0x8173('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8173('0x5'));var controller=require(_0x8173('0x6'));router[_0x8173('0x7')]('/',controller[_0x8173('0x8')]);router[_0x8173('0x9')](_0x8173('0xa'),auth[_0x8173('0xb')](),controller[_0x8173('0xc')]);module[_0x8173('0xd')]=router; \ No newline at end of file +var _0x1b07=['/:id','isAuthenticated','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','put'];(function(_0x3f4770,_0xa5714e){var _0x373b9a=function(_0x362363){while(--_0x362363){_0x3f4770['push'](_0x3f4770['shift']());}};_0x373b9a(++_0xa5714e);}(_0x1b07,0x1ca));var _0x71b0=function(_0x500785,_0x15e5ff){_0x500785=_0x500785-0x0;var _0x1f8bcc=_0x1b07[_0x500785];return _0x1f8bcc;};'use strict';var multer=require(_0x71b0('0x0'));var util=require(_0x71b0('0x1'));var path=require(_0x71b0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x71b0('0x3')]();var fs_extra=require(_0x71b0('0x4'));var auth=require(_0x71b0('0x5'));var interaction=require(_0x71b0('0x6'));var config=require(_0x71b0('0x7'));var controller=require('./license.controller');router[_0x71b0('0x8')]('/',controller['index']);router[_0x71b0('0x9')](_0x71b0('0xa'),auth[_0x71b0('0xb')](),controller['update']);module[_0x71b0('0xc')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 221cf8f..8d40335 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 _0x31ee=['exports','TEXT','STRING','INTEGER'];(function(_0x22789a,_0x4a1c8c){var _0xede88=function(_0x49243f){while(--_0x49243f){_0x22789a['push'](_0x22789a['shift']());}};_0xede88(++_0x4a1c8c);}(_0x31ee,0x1e4));var _0xe31e=function(_0x34a9dc,_0x1ee6ae){_0x34a9dc=_0x34a9dc-0x0;var _0x4c4c90=_0x31ee[_0x34a9dc];return _0x4c4c90;};'use strict';var Sequelize=require('sequelize');module[_0xe31e('0x0')]={'license':{'type':Sequelize[_0xe31e('0x1')]},'data1':{'type':Sequelize[_0xe31e('0x2')]},'data2':{'type':Sequelize[_0xe31e('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xe31e('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf9a7=['INTEGER','TEXT','STRING'];(function(_0x51dbe3,_0x4f8263){var _0x2aec5f=function(_0x3a9f96){while(--_0x3a9f96){_0x51dbe3['push'](_0x51dbe3['shift']());}};_0x2aec5f(++_0x4f8263);}(_0xf9a7,0x19f));var _0x7f9a=function(_0x30cfb8,_0x5a2bc1){_0x30cfb8=_0x30cfb8-0x0;var _0x127326=_0xf9a7[_0x30cfb8];return _0x127326;};'use strict';var Sequelize=require('sequelize');module['exports']={'license':{'type':Sequelize[_0x7f9a('0x0')]},'data1':{'type':Sequelize[_0x7f9a('0x1')]},'data2':{'type':Sequelize[_0x7f9a('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x7f9a('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 4cff79e..8fdeddd 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 _0xf494=['fields','length','merge','options','getLicense','body','License','find','params','get','key','demo','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','../../config/license/util','index','model','rawAttributes','query','keys','filters','intersection','attributes'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xf494,0x1c6));var _0x4f49=function(_0x3ea60f,_0x5d3d0e){_0x3ea60f=_0x3ea60f-0x0;var _0x3c31dc=_0xf494[_0x3ea60f];return _0x3c31dc;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xa'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];function respondWithStatusCode(_0x12527d,_0x4bf89f){_0x4bf89f=_0x4bf89f||0xcc;return function(_0x1e1c37){if(_0x1e1c37){return _0x12527d[_0x4f49('0x19')](_0x4bf89f);}return _0x12527d[_0x4f49('0x1a')](_0x4bf89f)[_0x4f49('0x1b')]();};}function respondWithResult(_0x1a0f1e,_0x2f0131){_0x2f0131=_0x2f0131||0xc8;return function(_0xfdb477){if(_0xfdb477){return _0x1a0f1e['status'](_0x2f0131)[_0x4f49('0x1c')](_0xfdb477);}};}function respondWithFilteredResult(_0x1f2d0d,_0x415e83){return function(_0x5878f4){if(_0x5878f4){var _0x5bdfaf=typeof _0x415e83[_0x4f49('0x1d')]===_0x4f49('0x1e')&&typeof _0x415e83[_0x4f49('0x1f')]==='undefined';var _0x1dccfd=_0x5878f4[_0x4f49('0x20')];var _0x4e85df=_0x5bdfaf?0x0:_0x415e83['offset'];var _0x5bb23b=_0x5bdfaf?_0x5878f4['count']:_0x415e83['offset']+_0x415e83[_0x4f49('0x1f')];var _0x1834f4;if(_0x5bb23b>=_0x1dccfd){_0x5bb23b=_0x1dccfd;_0x1834f4=0xc8;}else{_0x1834f4=0xce;}_0x1f2d0d[_0x4f49('0x1a')](_0x1834f4);return _0x1f2d0d[_0x4f49('0x21')]('Content-Range',_0x4e85df+'-'+_0x5bb23b+'/'+_0x1dccfd)[_0x4f49('0x1c')](_0x5878f4);}return null;};}function patchUpdates(_0x2aed27){return function(_0x197a49){try{jsonpatch[_0x4f49('0x22')](_0x197a49,_0x2aed27,!![]);}catch(_0xea82f8){return BPromise['reject'](_0xea82f8);}return _0x197a49[_0x4f49('0x23')]();};}function saveUpdates(_0x357446,_0x3ae590){return function(_0x53b57d){if(_0x53b57d){return _0x53b57d[_0x4f49('0x24')](_0x357446)[_0x4f49('0x25')](function(_0x32ca7b){return _0x32ca7b;});}return null;};}function removeEntity(_0x43c458,_0x9d30aa){return function(_0x36187b){if(_0x36187b){return _0x36187b['destroy']()['then'](function(){_0x43c458[_0x4f49('0x1a')](0xcc)[_0x4f49('0x1b')]();});}};}function handleEntityNotFound(_0x4fedbb,_0x408552){return function(_0x2c1519){if(!_0x2c1519){_0x4fedbb[_0x4f49('0x19')](0x194);}return _0x2c1519;};}function handleError(_0x525950,_0xc54070){_0xc54070=_0xc54070||0x1f4;return function(_0x2eed1c){logger[_0x4f49('0x26')](_0x2eed1c[_0x4f49('0x27')]);if(_0x2eed1c[_0x4f49('0x28')]){delete _0x2eed1c[_0x4f49('0x28')];}_0x525950['status'](_0xc54070)['send'](_0x2eed1c);};}var utilLicense=require(_0x4f49('0x29'));exports[_0x4f49('0x2a')]=function(_0x605c91,_0x560050){var _0x3cbfbd={'raw':!![],'where':{'id':0x1}},_0x206203={};_0x206203[_0x4f49('0x2b')]=_['keys'](db['License'][_0x4f49('0x2c')]);_0x206203[_0x4f49('0x2d')]=_[_0x4f49('0x2e')](_0x605c91['query']);_0x206203[_0x4f49('0x2f')]=_[_0x4f49('0x30')](_0x206203[_0x4f49('0x2b')],_0x206203[_0x4f49('0x2d')]);_0x3cbfbd[_0x4f49('0x31')]=_[_0x4f49('0x30')](_0x206203[_0x4f49('0x2b')],qs[_0x4f49('0x32')](_0x605c91[_0x4f49('0x2d')][_0x4f49('0x32')]));_0x3cbfbd[_0x4f49('0x31')]=_0x3cbfbd[_0x4f49('0x31')][_0x4f49('0x33')]?_0x3cbfbd[_0x4f49('0x31')]:_0x206203[_0x4f49('0x2b')];_0x3cbfbd=_[_0x4f49('0x34')]({},_0x3cbfbd,_0x605c91[_0x4f49('0x35')]);return utilLicense[_0x4f49('0x36')](_0x3cbfbd)[_0x4f49('0x25')](respondWithResult(_0x560050,null))['catch'](handleError(_0x560050,null));};exports[_0x4f49('0x24')]=function(_0x46b7ba,_0x24f568){if(_0x46b7ba[_0x4f49('0x37')]['id']){delete _0x46b7ba[_0x4f49('0x37')]['id'];}return db[_0x4f49('0x38')][_0x4f49('0x39')]({'where':{'id':_0x46b7ba[_0x4f49('0x3a')]['id']}})[_0x4f49('0x25')](handleEntityNotFound(_0x24f568,null))[_0x4f49('0x25')](function(_0x44e6a0){var _0x343365=_0x44e6a0[_0x4f49('0x3b')]({'plain':!![]});return utilLicense['checkLicense'](_0x343365,_0x46b7ba[_0x4f49('0x37')][_0x4f49('0x3c')]);})[_0x4f49('0x25')](function(_0x26014f){if(!_0x26014f[_0x4f49('0x3d')]){return saveUpdates(_0x46b7ba[_0x4f49('0x37')],null);}return _0x26014f;})[_0x4f49('0x25')](respondWithResult(_0x24f568,null))[_0x4f49('0x3e')](handleError(_0x24f568,null));}; \ No newline at end of file +var _0x53ec=['Content-Range','apply','reject','save','then','sendStatus','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','update','body','find','params','get','key','demo','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','status','end','json','offset','undefined','limit','count','set'];(function(_0x53f979,_0x2a0748){var _0x325167=function(_0x15b10f){while(--_0x15b10f){_0x53f979['push'](_0x53f979['shift']());}};_0x325167(++_0x2a0748);}(_0x53ec,0x192));var _0xc53e=function(_0x52ea48,_0x14f622){_0x52ea48=_0x52ea48-0x0;var _0x1f8e44=_0x53ec[_0x52ea48];return _0x1f8e44;};'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'];function respondWithStatusCode(_0x863fa,_0x4203aa){_0x4203aa=_0x4203aa||0xcc;return function(_0x56f0e5){if(_0x56f0e5){return _0x863fa['sendStatus'](_0x4203aa);}return _0x863fa[_0xc53e('0x18')](_0x4203aa)[_0xc53e('0x19')]();};}function respondWithResult(_0x7cd798,_0x3d2e17){_0x3d2e17=_0x3d2e17||0xc8;return function(_0x358ef3){if(_0x358ef3){return _0x7cd798[_0xc53e('0x18')](_0x3d2e17)[_0xc53e('0x1a')](_0x358ef3);}};}function respondWithFilteredResult(_0x19c0d1,_0x455e4d){return function(_0x2ad6eb){if(_0x2ad6eb){var _0x5b0a88=typeof _0x455e4d[_0xc53e('0x1b')]===_0xc53e('0x1c')&&typeof _0x455e4d[_0xc53e('0x1d')]===_0xc53e('0x1c');var _0x15333b=_0x2ad6eb[_0xc53e('0x1e')];var _0x164016=_0x5b0a88?0x0:_0x455e4d[_0xc53e('0x1b')];var _0x3b550e=_0x5b0a88?_0x2ad6eb['count']:_0x455e4d['offset']+_0x455e4d[_0xc53e('0x1d')];var _0x2a5bac;if(_0x3b550e>=_0x15333b){_0x3b550e=_0x15333b;_0x2a5bac=0xc8;}else{_0x2a5bac=0xce;}_0x19c0d1[_0xc53e('0x18')](_0x2a5bac);return _0x19c0d1[_0xc53e('0x1f')](_0xc53e('0x20'),_0x164016+'-'+_0x3b550e+'/'+_0x15333b)[_0xc53e('0x1a')](_0x2ad6eb);}return null;};}function patchUpdates(_0x15a015){return function(_0x25702b){try{jsonpatch[_0xc53e('0x21')](_0x25702b,_0x15a015,!![]);}catch(_0x401af6){return BPromise[_0xc53e('0x22')](_0x401af6);}return _0x25702b[_0xc53e('0x23')]();};}function saveUpdates(_0x426467,_0x4fb695){return function(_0x47cfdd){if(_0x47cfdd){return _0x47cfdd['update'](_0x426467)[_0xc53e('0x24')](function(_0x384218){return _0x384218;});}return null;};}function removeEntity(_0x7591c1,_0x4015c8){return function(_0x180811){if(_0x180811){return _0x180811['destroy']()['then'](function(){_0x7591c1[_0xc53e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ae55e,_0x3a5ce8){return function(_0x443179){if(!_0x443179){_0x1ae55e[_0xc53e('0x25')](0x194);}return _0x443179;};}function handleError(_0x63c5dc,_0x4df8cf){_0x4df8cf=_0x4df8cf||0x1f4;return function(_0x398e7a){logger['error'](_0x398e7a['stack']);if(_0x398e7a['name']){delete _0x398e7a[_0xc53e('0x26')];}_0x63c5dc['status'](_0x4df8cf)[_0xc53e('0x27')](_0x398e7a);};}var utilLicense=require('../../config/license/util');exports[_0xc53e('0x28')]=function(_0x5112d2,_0x5ce216){var _0x8f0ee6={'raw':!![],'where':{'id':0x1}},_0x6a62b0={};_0x6a62b0[_0xc53e('0x29')]=_[_0xc53e('0x2a')](db[_0xc53e('0x2b')][_0xc53e('0x2c')]);_0x6a62b0[_0xc53e('0x2d')]=_[_0xc53e('0x2a')](_0x5112d2['query']);_0x6a62b0[_0xc53e('0x2e')]=_[_0xc53e('0x2f')](_0x6a62b0[_0xc53e('0x29')],_0x6a62b0['query']);_0x8f0ee6[_0xc53e('0x30')]=_['intersection'](_0x6a62b0[_0xc53e('0x29')],qs[_0xc53e('0x31')](_0x5112d2['query']['fields']));_0x8f0ee6[_0xc53e('0x30')]=_0x8f0ee6[_0xc53e('0x30')][_0xc53e('0x32')]?_0x8f0ee6[_0xc53e('0x30')]:_0x6a62b0[_0xc53e('0x29')];_0x8f0ee6=_[_0xc53e('0x33')]({},_0x8f0ee6,_0x5112d2[_0xc53e('0x34')]);return utilLicense[_0xc53e('0x35')](_0x8f0ee6)['then'](respondWithResult(_0x5ce216,null))[_0xc53e('0x36')](handleError(_0x5ce216,null));};exports[_0xc53e('0x37')]=function(_0x19020b,_0x17ad32){if(_0x19020b[_0xc53e('0x38')]['id']){delete _0x19020b[_0xc53e('0x38')]['id'];}return db[_0xc53e('0x2b')][_0xc53e('0x39')]({'where':{'id':_0x19020b[_0xc53e('0x3a')]['id']}})['then'](handleEntityNotFound(_0x17ad32,null))[_0xc53e('0x24')](function(_0x48d7d0){var _0x1059f3=_0x48d7d0[_0xc53e('0x3b')]({'plain':!![]});return utilLicense['checkLicense'](_0x1059f3,_0x19020b[_0xc53e('0x38')][_0xc53e('0x3c')]);})[_0xc53e('0x24')](function(_0x5ed90b){if(!_0x5ed90b[_0xc53e('0x3d')]){return saveUpdates(_0x19020b[_0xc53e('0x38')],null);}return _0x5ed90b;})[_0xc53e('0x24')](respondWithResult(_0x17ad32,null))[_0xc53e('0x36')](handleError(_0x17ad32,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index d994323..3d1aee0 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 _0xf821=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./license.attributes','exports','define','License','license','lodash'];(function(_0x26f189,_0x1bebf5){var _0x4aa106=function(_0x5833a1){while(--_0x5833a1){_0x26f189['push'](_0x26f189['shift']());}};_0x4aa106(++_0x1bebf5);}(_0xf821,0x6f));var _0x1f82=function(_0x428302,_0x2f3bc6){_0x428302=_0x428302-0x0;var _0x30f45b=_0xf821[_0x428302];return _0x30f45b;};'use strict';var _=require(_0x1f82('0x0'));var util=require(_0x1f82('0x1'));var logger=require(_0x1f82('0x2'))(_0x1f82('0x3'));var moment=require(_0x1f82('0x4'));var BPromise=require(_0x1f82('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f82('0x6'));var rimraf=require(_0x1f82('0x7'));var config=require(_0x1f82('0x8'));var attributes=require(_0x1f82('0x9'));module[_0x1f82('0xa')]=function(_0x459e88,_0x45ae7e){return _0x459e88[_0x1f82('0xb')](_0x1f82('0xc'),attributes,{'tableName':_0x1f82('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6f3=['define','License','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./license.attributes','exports'];(function(_0x488f7f,_0x282ca3){var _0xe33283=function(_0x2d4e32){while(--_0x2d4e32){_0x488f7f['push'](_0x488f7f['shift']());}};_0xe33283(++_0x282ca3);}(_0xa6f3,0xda));var _0x3a6f=function(_0x48999d,_0x1e02cb){_0x48999d=_0x48999d-0x0;var _0x1ad0d1=_0xa6f3[_0x48999d];return _0x1ad0d1;};'use strict';var _=require(_0x3a6f('0x0'));var util=require(_0x3a6f('0x1'));var logger=require('../../config/logger')(_0x3a6f('0x2'));var moment=require(_0x3a6f('0x3'));var BPromise=require(_0x3a6f('0x4'));var rp=require(_0x3a6f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3a6f('0x6'));var config=require(_0x3a6f('0x7'));var attributes=require(_0x3a6f('0x8'));module[_0x3a6f('0x9')]=function(_0xe77a0f,_0xba9c44){return _0xe77a0f[_0x3a6f('0xa')](_0x3a6f('0xb'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index edfec92..b2bb056 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 _0x3b34=['stringify','error','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s'];(function(_0x50a463,_0x517a1a){var _0x2971df=function(_0x1f9cf1){while(--_0x1f9cf1){_0x50a463['push'](_0x50a463['shift']());}};_0x2971df(++_0x517a1a);}(_0x3b34,0x9e));var _0x43b3=function(_0x1da8fa,_0x180f1a){_0x1da8fa=_0x1da8fa-0x0;var _0x2b514a=_0x3b34[_0x1da8fa];return _0x2b514a;};'use strict';var _=require('lodash');var util=require(_0x43b3('0x0'));var moment=require(_0x43b3('0x1'));var BPromise=require(_0x43b3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43b3('0x3'));var db=require(_0x43b3('0x4'))['db'];var utils=require(_0x43b3('0x5'));var logger=require(_0x43b3('0x6'))(_0x43b3('0x7'));var config=require(_0x43b3('0x8'));var jayson=require(_0x43b3('0x9'));var client=jayson[_0x43b3('0xa')][_0x43b3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e5fbd,_0x3cde49,_0x489703){return new BPromise(function(_0x39d4ba,_0x485a15){return client['request'](_0x1e5fbd,_0x489703)[_0x43b3('0xc')](function(_0x3a5564){logger[_0x43b3('0xd')](_0x43b3('0xe'),_0x3cde49,_0x43b3('0xf'));logger[_0x43b3('0x10')](_0x43b3('0x11'),_0x3cde49,_0x43b3('0xf'),JSON[_0x43b3('0x12')](_0x3a5564));if(_0x3a5564[_0x43b3('0x13')]){if(_0x3a5564[_0x43b3('0x13')]['code']===0x1f4){logger[_0x43b3('0x13')](_0x43b3('0xe'),_0x3cde49,_0x3a5564[_0x43b3('0x13')]['message']);return _0x485a15(_0x3a5564[_0x43b3('0x13')][_0x43b3('0x14')]);}logger['error'](_0x43b3('0xe'),_0x3cde49,_0x3a5564[_0x43b3('0x13')][_0x43b3('0x14')]);return _0x39d4ba(_0x3a5564[_0x43b3('0x13')][_0x43b3('0x14')]);}else{logger[_0x43b3('0xd')](_0x43b3('0xe'),_0x3cde49,'request\x20sent');_0x39d4ba(_0x3a5564['result'][_0x43b3('0x14')]);}})[_0x43b3('0x15')](function(_0x4fe708){logger[_0x43b3('0x13')](_0x43b3('0xe'),_0x3cde49,_0x4fe708);_0x485a15(_0x4fe708);});});} \ No newline at end of file +var _0x8e6b=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x50bb39,_0x53e3c0){var _0x34191b=function(_0x158bc9){while(--_0x158bc9){_0x50bb39['push'](_0x50bb39['shift']());}};_0x34191b(++_0x53e3c0);}(_0x8e6b,0x15f));var _0xb8e6=function(_0x5153fe,_0x1c42cc){_0x5153fe=_0x5153fe-0x0;var _0x569e28=_0x8e6b[_0x5153fe];return _0x569e28;};'use strict';var _=require(_0xb8e6('0x0'));var util=require(_0xb8e6('0x1'));var moment=require(_0xb8e6('0x2'));var BPromise=require('bluebird');var rs=require(_0xb8e6('0x3'));var fs=require('fs');var Redis=require(_0xb8e6('0x4'));var db=require(_0xb8e6('0x5'))['db'];var utils=require(_0xb8e6('0x6'));var logger=require('../../config/logger')(_0xb8e6('0x7'));var config=require('../../config/environment');var jayson=require(_0xb8e6('0x8'));var client=jayson['client'][_0xb8e6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x665ab1,_0x43ebb1,_0x9e2263){return new BPromise(function(_0x288efc,_0x436387){return client[_0xb8e6('0xa')](_0x665ab1,_0x9e2263)[_0xb8e6('0xb')](function(_0x524c1a){logger[_0xb8e6('0xc')](_0xb8e6('0xd'),_0x43ebb1,_0xb8e6('0xe'));logger[_0xb8e6('0xf')](_0xb8e6('0x10'),_0x43ebb1,_0xb8e6('0xe'),JSON['stringify'](_0x524c1a));if(_0x524c1a[_0xb8e6('0x11')]){if(_0x524c1a[_0xb8e6('0x11')][_0xb8e6('0x12')]===0x1f4){logger[_0xb8e6('0x11')]('License,\x20%s,\x20%s',_0x43ebb1,_0x524c1a['error']['message']);return _0x436387(_0x524c1a[_0xb8e6('0x11')][_0xb8e6('0x13')]);}logger[_0xb8e6('0x11')](_0xb8e6('0xd'),_0x43ebb1,_0x524c1a[_0xb8e6('0x11')]['message']);return _0x288efc(_0x524c1a['error']['message']);}else{logger[_0xb8e6('0xc')](_0xb8e6('0xd'),_0x43ebb1,_0xb8e6('0xe'));_0x288efc(_0x524c1a[_0xb8e6('0x14')][_0xb8e6('0x13')]);}})[_0xb8e6('0x15')](function(_0x1c0c6f){logger[_0xb8e6('0x11')](_0xb8e6('0xd'),_0x43ebb1,_0x1c0c6f);_0x436387(_0x1c0c6f);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 9892f6f..bf2a1dd 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 _0x2b25=['getMessages','/:id/verify','verifySmtp','getAgents','post','addDisposition','addAnswer','create','/:id/in_servers','addImap','/:id/interactions','addApplications','/:id/send','send','/:id/users','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/out_servers','getSmtp','/:id/messages'];(function(_0x42f1e6,_0x372465){var _0xea2816=function(_0x20050e){while(--_0x20050e){_0x42f1e6['push'](_0x42f1e6['shift']());}};_0xea2816(++_0x372465);}(_0x2b25,0xcc));var _0x52b2=function(_0x1dad92,_0x2f948c){_0x1dad92=_0x1dad92-0x0;var _0x90a9f6=_0x2b25[_0x1dad92];return _0x90a9f6;};'use strict';var multer=require(_0x52b2('0x0'));var util=require(_0x52b2('0x1'));var path=require(_0x52b2('0x2'));var timeout=require(_0x52b2('0x3'));var express=require('express');var router=express[_0x52b2('0x4')]();var fs_extra=require(_0x52b2('0x5'));var auth=require(_0x52b2('0x6'));var interaction=require(_0x52b2('0x7'));var config=require(_0x52b2('0x8'));var controller=require(_0x52b2('0x9'));router[_0x52b2('0xa')]('/',auth[_0x52b2('0xb')](),controller[_0x52b2('0xc')]);router[_0x52b2('0xa')](_0x52b2('0xd'),auth[_0x52b2('0xb')](),controller['describe']);router[_0x52b2('0xa')](_0x52b2('0xe'),auth[_0x52b2('0xb')](),controller['show']);router[_0x52b2('0xa')](_0x52b2('0xf'),auth[_0x52b2('0xb')](),controller[_0x52b2('0x10')]);router[_0x52b2('0xa')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x52b2('0x11')]);router['get']('/:id/in_servers',auth[_0x52b2('0xb')](),controller['getImap']);router['get'](_0x52b2('0x12'),auth[_0x52b2('0xb')](),controller[_0x52b2('0x13')]);router['get']('/:id/interactions',auth[_0x52b2('0xb')](),controller['getInteractions']);router['get']('/:id/applications',auth[_0x52b2('0xb')](),controller['getApplications']);router[_0x52b2('0xa')](_0x52b2('0x14'),auth['isAuthenticated'](),controller[_0x52b2('0x15')]);router[_0x52b2('0xa')](_0x52b2('0x16'),auth[_0x52b2('0xb')](),controller[_0x52b2('0x17')]);router[_0x52b2('0xa')]('/:id/users',auth[_0x52b2('0xb')](),controller[_0x52b2('0x18')]);router[_0x52b2('0x19')](_0x52b2('0xf'),auth[_0x52b2('0xb')](),controller[_0x52b2('0x1a')]);router['post']('/:id/canned_answers',auth[_0x52b2('0xb')](),controller[_0x52b2('0x1b')]);router[_0x52b2('0x19')]('/',auth[_0x52b2('0xb')](),controller[_0x52b2('0x1c')]);router[_0x52b2('0x19')](_0x52b2('0x1d'),auth['isAuthenticated'](),controller[_0x52b2('0x1e')]);router[_0x52b2('0x19')](_0x52b2('0x12'),auth[_0x52b2('0xb')](),controller['addSmtp']);router[_0x52b2('0x19')](_0x52b2('0x1f'),auth[_0x52b2('0xb')](),controller['addInteraction']);router[_0x52b2('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x52b2('0x20')]);router[_0x52b2('0x19')](_0x52b2('0x21'),auth[_0x52b2('0xb')](),controller[_0x52b2('0x22')]);router[_0x52b2('0x19')](_0x52b2('0x23'),auth[_0x52b2('0xb')](),controller[_0x52b2('0x24')]);router[_0x52b2('0x25')](_0x52b2('0xe'),auth[_0x52b2('0xb')](),controller[_0x52b2('0x26')]);router[_0x52b2('0x27')](_0x52b2('0xf'),auth['isAuthenticated'](),controller[_0x52b2('0x28')]);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x52b2('0x29')]);router[_0x52b2('0x27')](_0x52b2('0x1d'),auth['isAuthenticated'](),controller[_0x52b2('0x2a')]);router[_0x52b2('0x27')](_0x52b2('0x12'),auth['isAuthenticated'](),controller['removeSmtp']);router[_0x52b2('0x27')](_0x52b2('0xe'),auth[_0x52b2('0xb')](),controller['destroy']);router[_0x52b2('0x27')]('/:id/users',auth[_0x52b2('0xb')](),controller[_0x52b2('0x2b')]);module[_0x52b2('0x2c')]=router; \ No newline at end of file +var _0x767e=['verifySmtp','/:id/users','getAgents','post','/:id/dispositions','create','addImap','/:id/interactions','addInteraction','/:id/applications','addApplications','/:id/send','send','addAgents','update','removeDispositions','delete','removeAnswers','/:id/in_servers','removeImap','removeSmtp','destroy','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getInteractions','getMessages','/:id/verify'];(function(_0x1e05a3,_0x31a4bb){var _0x4cb85e=function(_0x195ccd){while(--_0x195ccd){_0x1e05a3['push'](_0x1e05a3['shift']());}};_0x4cb85e(++_0x31a4bb);}(_0x767e,0xd3));var _0xe767=function(_0x275f5f,_0x311a9b){_0x275f5f=_0x275f5f-0x0;var _0x4ef2cb=_0x767e[_0x275f5f];return _0x4ef2cb;};'use strict';var multer=require(_0xe767('0x0'));var util=require(_0xe767('0x1'));var path=require('path');var timeout=require(_0xe767('0x2'));var express=require(_0xe767('0x3'));var router=express[_0xe767('0x4')]();var fs_extra=require(_0xe767('0x5'));var auth=require(_0xe767('0x6'));var interaction=require(_0xe767('0x7'));var config=require(_0xe767('0x8'));var controller=require('./mailAccount.controller');router[_0xe767('0x9')]('/',auth[_0xe767('0xa')](),controller[_0xe767('0xb')]);router[_0xe767('0x9')](_0xe767('0xc'),auth[_0xe767('0xa')](),controller[_0xe767('0xd')]);router[_0xe767('0x9')](_0xe767('0xe'),auth[_0xe767('0xa')](),controller[_0xe767('0xf')]);router['get']('/:id/dispositions',auth[_0xe767('0xa')](),controller[_0xe767('0x10')]);router[_0xe767('0x9')](_0xe767('0x11'),auth[_0xe767('0xa')](),controller[_0xe767('0x12')]);router[_0xe767('0x9')]('/:id/in_servers',auth[_0xe767('0xa')](),controller[_0xe767('0x13')]);router[_0xe767('0x9')](_0xe767('0x14'),auth[_0xe767('0xa')](),controller['getSmtp']);router[_0xe767('0x9')]('/:id/interactions',auth[_0xe767('0xa')](),controller[_0xe767('0x15')]);router[_0xe767('0x9')]('/:id/applications',auth[_0xe767('0xa')](),controller['getApplications']);router['get']('/:id/messages',auth[_0xe767('0xa')](),controller[_0xe767('0x16')]);router[_0xe767('0x9')](_0xe767('0x17'),auth[_0xe767('0xa')](),controller[_0xe767('0x18')]);router[_0xe767('0x9')](_0xe767('0x19'),auth[_0xe767('0xa')](),controller[_0xe767('0x1a')]);router[_0xe767('0x1b')](_0xe767('0x1c'),auth[_0xe767('0xa')](),controller['addDisposition']);router[_0xe767('0x1b')](_0xe767('0x11'),auth[_0xe767('0xa')](),controller['addAnswer']);router['post']('/',auth[_0xe767('0xa')](),controller[_0xe767('0x1d')]);router[_0xe767('0x1b')]('/:id/in_servers',auth[_0xe767('0xa')](),controller[_0xe767('0x1e')]);router[_0xe767('0x1b')](_0xe767('0x14'),auth[_0xe767('0xa')](),controller['addSmtp']);router[_0xe767('0x1b')](_0xe767('0x1f'),auth['isAuthenticated'](),controller[_0xe767('0x20')]);router[_0xe767('0x1b')](_0xe767('0x21'),auth[_0xe767('0xa')](),controller[_0xe767('0x22')]);router[_0xe767('0x1b')](_0xe767('0x23'),auth['isAuthenticated'](),controller[_0xe767('0x24')]);router[_0xe767('0x1b')](_0xe767('0x19'),auth[_0xe767('0xa')](),controller[_0xe767('0x25')]);router['put'](_0xe767('0xe'),auth[_0xe767('0xa')](),controller[_0xe767('0x26')]);router['delete'](_0xe767('0x1c'),auth[_0xe767('0xa')](),controller[_0xe767('0x27')]);router[_0xe767('0x28')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xe767('0x29')]);router[_0xe767('0x28')](_0xe767('0x2a'),auth[_0xe767('0xa')](),controller[_0xe767('0x2b')]);router[_0xe767('0x28')](_0xe767('0x14'),auth['isAuthenticated'](),controller[_0xe767('0x2c')]);router[_0xe767('0x28')](_0xe767('0xe'),auth[_0xe767('0xa')](),controller[_0xe767('0x2d')]);router[_0xe767('0x28')](_0xe767('0x19'),auth['isAuthenticated'](),controller[_0xe767('0x2e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index d490de2..7bf0a0e 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 _0xa62c=['outlook365','provider','getDataValue','sequelize','exports','BOOLEAN','TEXT','STRING','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xa62c,0x1e6));var _0xca62=function(_0xe39824,_0xbdf61f){_0xe39824=_0xe39824-0x0;var _0x4bc31e=_0xa62c[_0xe39824];return _0x4bc31e;};'use strict';var Sequelize=require(_0xca62('0x0'));module[_0xca62('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xca62('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0xca62('0x3')]},'markAsUnread':{'type':Sequelize[_0xca62('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xca62('0x4')],'allowNull':![],'defaultValue':_0xca62('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xca62('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xca62('0x3')],'defaultValue':function(){return _0xca62('0x7');}},'notificationSound':{'type':Sequelize[_0xca62('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xca62('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xca62('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xca62('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xca62('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xca62('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xca62('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xca62('0x2')],'defaultValue':![],'comment':_0xca62('0xa'),'set':function(_0x3122f2){if(!_0x3122f2)this[_0xca62('0xb')](_0xca62('0xc'),null);this[_0xca62('0xb')](_0xca62('0xd'),_0x3122f2);}},'provider':{'type':Sequelize[_0xca62('0xe')](_0xca62('0xf'),_0xca62('0x10'),_0xca62('0x11'),_0xca62('0x12')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0xca62('0x13')))return'custom';return this[_0xca62('0x14')]('provider');}}}; \ No newline at end of file +var _0x8d5f=['getDataValue','provider','custom','sequelize','BOOLEAN','STRING','TEXT','UNSIGNED','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','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','hotmail','yahoo'];(function(_0x3bb99a,_0x52ae7b){var _0x787927=function(_0x4e96fe){while(--_0x4e96fe){_0x3bb99a['push'](_0x3bb99a['shift']());}};_0x787927(++_0x52ae7b);}(_0x8d5f,0x1ac));var _0xf8d5=function(_0x5933fb,_0x9115ad){_0x5933fb=_0x5933fb-0x0;var _0x44d988=_0x8d5f[_0x5933fb];return _0x44d988;};'use strict';var Sequelize=require(_0xf8d5('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xf8d5('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0xf8d5('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xf8d5('0x1')],'defaultValue':!![]},'key':{'type':Sequelize[_0xf8d5('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xf8d5('0x3')]},'markAsUnread':{'type':Sequelize[_0xf8d5('0x1')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xf8d5('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xf8d5('0x5');}},'notificationSound':{'type':Sequelize[_0xf8d5('0x1')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf8d5('0x1')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf8d5('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf8d5('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf8d5('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf8d5('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf8d5('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xf8d5('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xf8d5('0x1')],'defaultValue':![],'comment':_0xf8d5('0x8'),'set':function(_0x51941a){if(!_0x51941a)this['setDataValue'](_0xf8d5('0x9'),null);this[_0xf8d5('0xa')](_0xf8d5('0xb'),_0x51941a);}},'provider':{'type':Sequelize['ENUM']('gmail',_0xf8d5('0xc'),_0xf8d5('0xd'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0xf8d5('0xe')](_0xf8d5('0xf')))return _0xf8d5('0x10');return this['getDataValue'](_0xf8d5('0xf'));},'set':function(_0x413940){if(_0x413940===_0xf8d5('0x10'))_0x413940=null;return this[_0xf8d5('0xa')]('provider',_0x413940);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 75bc891..95ce277 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 _0x9957=['MailServerOut','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','pick','where','VIRTUAL','filter','merge','includeAll','findAll','catch','show','params','Smtp','include','options','find','update','Pause','body','describe','addDisposition','create','getDispositions','findOne','Disposition','sort','MailAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','order','rows','removeAnswers','custom','provider','email','isNil','active','user','username','pass','modernAuthentication','CloudProviderId','service','host','port','authentication','password','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','Contact','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','stack','send','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','updatedAt','DESC','from','%s\x20<%s>','attachments','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','Contacts','ListId','messageId','subject','attach','out','Interaction','verifySmtp','CloudProvider','OAuth2','data5','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','moment','bluebird','util','path','juice','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','jayson/promise','client','http','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','status','end','offset','undefined','limit','count','set','Content-Range','json','destroy','MailAccounts','UserProfileResource','sendStatus','name','MailServerIn','Imap'];(function(_0x5c27c2,_0x5b5348){var _0x3131fe=function(_0x1e43c8){while(--_0x1e43c8){_0x5c27c2['push'](_0x5c27c2['shift']());}};_0x3131fe(++_0x5b5348);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var moment=require(_0x7995('0x0'));var BPromise=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var path=require(_0x7995('0x3'));var _=require('lodash');var juice=require(_0x7995('0x4'));var Redis=require(_0x7995('0x5'));var qs=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('api');var config=require(_0x7995('0x8'));var db=require(_0x7995('0x9'))['db'];config[_0x7995('0xa')]=_[_0x7995('0xb')](config[_0x7995('0xa')],{'host':_0x7995('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xa')]));require(_0x7995('0xd'))['register'](socket);var jayson=require(_0x7995('0xe'));var client=jayson[_0x7995('0xf')][_0x7995('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a,_0x341672){return new BPromise(function(_0x524f7b,_0x245143){var _0x41c652=_0x341672||client;return _0x41c652['request'](_0x35b5fe,_0x1e400a)[_0x7995('0x11')](function(_0x2cb37a){logger[_0x7995('0x12')](_0x7995('0x13'),_0x3c1d19,_0x7995('0x14'));logger[_0x7995('0x15')](_0x7995('0x16'),_0x3c1d19,'request\x20sent',JSON['stringify'](_0x2cb37a));if(_0x2cb37a[_0x7995('0x17')]){if(_0x2cb37a[_0x7995('0x17')][_0x7995('0x18')]===0x1f4){logger[_0x7995('0x17')](_0x7995('0x13'),_0x3c1d19,_0x2cb37a[_0x7995('0x17')][_0x7995('0x19')]);return _0x245143(_0x2cb37a[_0x7995('0x17')]['message']);}logger[_0x7995('0x17')]('MailAccount,\x20%s,\x20%s',_0x3c1d19,_0x2cb37a[_0x7995('0x17')][_0x7995('0x19')]);return _0x524f7b(_0x2cb37a[_0x7995('0x17')][_0x7995('0x19')]);}else{logger[_0x7995('0x12')](_0x7995('0x13'),_0x3c1d19,'request\x20sent');_0x524f7b(_0x2cb37a['result'][_0x7995('0x19')]);}})['catch'](function(_0x555f74){logger[_0x7995('0x17')](_0x7995('0x13'),_0x3c1d19,_0x555f74);_0x245143(_0x555f74);});});}function respondWithStatusCode(_0x4cbe10,_0x3a9b54){_0x3a9b54=_0x3a9b54||0xcc;return function(_0x51f276){if(_0x51f276){return _0x4cbe10['sendStatus'](_0x3a9b54);}return _0x4cbe10[_0x7995('0x1a')](_0x3a9b54)[_0x7995('0x1b')]();};}function respondWithResult(_0x350fd9,_0x1a8568){_0x1a8568=_0x1a8568||0xc8;return function(_0x460924){if(_0x460924){return _0x350fd9[_0x7995('0x1a')](_0x1a8568)['json'](_0x460924);}};}function respondWithFilteredResult(_0x32a09a,_0x46ee4b){return function(_0x204507){if(_0x204507){var _0x285437=typeof _0x46ee4b[_0x7995('0x1c')]===_0x7995('0x1d')&&typeof _0x46ee4b[_0x7995('0x1e')]===_0x7995('0x1d');var _0x59405a=_0x204507[_0x7995('0x1f')];var _0x34e70c=_0x285437?0x0:_0x46ee4b[_0x7995('0x1c')];var _0x268ce7=_0x285437?_0x204507[_0x7995('0x1f')]:_0x46ee4b[_0x7995('0x1c')]+_0x46ee4b['limit'];var _0x47625f;if(_0x268ce7>=_0x59405a){_0x268ce7=_0x59405a;_0x47625f=0xc8;}else{_0x47625f=0xce;}_0x32a09a['status'](_0x47625f);return _0x32a09a[_0x7995('0x20')](_0x7995('0x21'),_0x34e70c+'-'+_0x268ce7+'/'+_0x59405a)[_0x7995('0x22')](_0x204507);}return null;};}function saveUpdates(_0x132a42){return function(_0x11c1eb){if(_0x11c1eb){return _0x11c1eb['update'](_0x132a42)[_0x7995('0x11')](function(_0x514445){return _0x514445;});}return null;};}function removeEntity(_0x456a28){return function(_0x3250e0){if(_0x3250e0){return _0x3250e0[_0x7995('0x23')]()['then'](function(){var _0x530611=_0x3250e0['get']({'plain':!![]});var _0x3573be=_0x7995('0x24');return db[_0x7995('0x25')][_0x7995('0x23')]({'where':{'type':_0x3573be,'resourceId':_0x530611['id']}})[_0x7995('0x11')](function(){return _0x3250e0;});})[_0x7995('0x11')](function(){_0x456a28['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xfa8f15){return function(_0x5524af){if(!_0x5524af){_0xfa8f15[_0x7995('0x26')](0x194);}return _0x5524af;};}function handleError(_0x3eb566,_0x29fac5){_0x29fac5=_0x29fac5||0x1f4;return function(_0x1e9fa4){logger[_0x7995('0x17')](_0x1e9fa4['stack']);if(_0x1e9fa4[_0x7995('0x27')]){delete _0x1e9fa4[_0x7995('0x27')];}_0x3eb566['status'](_0x29fac5)['send'](_0x1e9fa4);};}exports['index']=function(_0x45bc5e,_0x3acfc3){var _0x4a176f={'include':[{'model':db[_0x7995('0x28')],'as':_0x7995('0x29')},{'model':db[_0x7995('0x2a')],'as':'Smtp'},{'model':db['Pause'],'as':_0x7995('0x2b')}]},_0x3e7020={},_0x51b95d={'count':0x0,'rows':[]};var _0x5e67fe=_['map'](db[_0x7995('0x2c')][_0x7995('0x2d')],function(_0x5212ff){return{'name':_0x5212ff[_0x7995('0x2e')],'type':_0x5212ff[_0x7995('0x2f')][_0x7995('0x30')]};});_0x3e7020[_0x7995('0x31')]=_[_0x7995('0x32')](_0x5e67fe,'name');_0x3e7020[_0x7995('0x33')]=_[_0x7995('0x34')](_0x45bc5e[_0x7995('0x33')]);_0x3e7020[_0x7995('0x35')]=_['intersection'](_0x3e7020[_0x7995('0x31')],_0x3e7020[_0x7995('0x33')]);_0x4a176f[_0x7995('0x36')]=_[_0x7995('0x37')](_0x3e7020[_0x7995('0x31')],qs[_0x7995('0x38')](_0x45bc5e['query'][_0x7995('0x38')]));_0x4a176f[_0x7995('0x36')]=_0x4a176f[_0x7995('0x36')][_0x7995('0x39')]?_0x4a176f[_0x7995('0x36')]:_0x3e7020[_0x7995('0x31')];if(!_0x45bc5e[_0x7995('0x33')][_0x7995('0x3a')](_0x7995('0x3b'))){_0x4a176f[_0x7995('0x1e')]=qs[_0x7995('0x1e')](_0x45bc5e[_0x7995('0x33')][_0x7995('0x1e')]);_0x4a176f['offset']=qs['offset'](_0x45bc5e[_0x7995('0x33')][_0x7995('0x1c')]);}_0x4a176f['order']=qs['sort'](_0x45bc5e[_0x7995('0x33')]['sort']);_0x4a176f['where']=qs[_0x7995('0x35')](_[_0x7995('0x3c')](_0x45bc5e[_0x7995('0x33')],_0x3e7020['filters']),_0x5e67fe);if(_0x45bc5e[_0x7995('0x33')]['filter']){_0x4a176f[_0x7995('0x3d')]=_['merge'](_0x4a176f['where'],{'$or':_[_0x7995('0x32')](_0x5e67fe,function(_0x403f54){if(_0x403f54[_0x7995('0x2f')]!==_0x7995('0x3e')){var _0x599ecb={};_0x599ecb[_0x403f54[_0x7995('0x27')]]={'$like':'%'+_0x45bc5e[_0x7995('0x33')][_0x7995('0x3f')]+'%'};return _0x599ecb;}})});}_0x4a176f=_[_0x7995('0x40')]({},_0x4a176f,_0x45bc5e['options']);var _0x5f28e7={'where':_0x4a176f[_0x7995('0x3d')]};return db['MailAccount'][_0x7995('0x1f')](_0x5f28e7)['then'](function(_0x2f435e){_0x51b95d['count']=_0x2f435e;if(_0x45bc5e[_0x7995('0x33')][_0x7995('0x41')]){_0x4a176f['include']=[{'all':!![]}];}return db[_0x7995('0x2c')][_0x7995('0x42')](_0x4a176f);})[_0x7995('0x11')](function(_0xb70a51){_0x51b95d['rows']=_0xb70a51;return _0x51b95d;})[_0x7995('0x11')](respondWithFilteredResult(_0x3acfc3,_0x4a176f))[_0x7995('0x43')](handleError(_0x3acfc3,null));};exports[_0x7995('0x44')]=function(_0x491184,_0xe228a5){var _0x44f516={'raw':![],'where':{'id':_0x491184[_0x7995('0x45')]['id']},'include':[{'model':db[_0x7995('0x28')],'as':'Imap'},{'model':db[_0x7995('0x2a')],'as':_0x7995('0x46')},{'model':db['Pause'],'as':_0x7995('0x2b')}]},_0x511567={};_0x511567['model']=_[_0x7995('0x34')](db[_0x7995('0x2c')][_0x7995('0x2d')]);_0x511567[_0x7995('0x33')]=_[_0x7995('0x34')](_0x491184[_0x7995('0x33')]);_0x511567[_0x7995('0x35')]=_['intersection'](_0x511567[_0x7995('0x31')],_0x511567[_0x7995('0x33')]);_0x44f516[_0x7995('0x36')]=_['intersection'](_0x511567[_0x7995('0x31')],qs[_0x7995('0x38')](_0x491184[_0x7995('0x33')]['fields']));_0x44f516['attributes']=_0x44f516['attributes'][_0x7995('0x39')]?_0x44f516[_0x7995('0x36')]:_0x511567['model'];if(_0x491184[_0x7995('0x33')][_0x7995('0x41')]){_0x44f516[_0x7995('0x47')]=[{'all':!![]}];}_0x44f516=_[_0x7995('0x40')]({},_0x44f516,_0x491184[_0x7995('0x48')]);return db['MailAccount'][_0x7995('0x49')](_0x44f516)['then'](handleEntityNotFound(_0xe228a5,null))[_0x7995('0x11')](respondWithResult(_0xe228a5,null))[_0x7995('0x43')](handleError(_0xe228a5,null));};exports[_0x7995('0x4a')]=function(_0x50c7b5,_0x5e1f34){if(_0x50c7b5['body']['id']){delete _0x50c7b5['body']['id'];}return db[_0x7995('0x2c')][_0x7995('0x49')]({'where':{'id':_0x50c7b5[_0x7995('0x45')]['id']},'include':[{'model':db[_0x7995('0x28')],'as':_0x7995('0x29')},{'model':db[_0x7995('0x2a')],'as':_0x7995('0x46')},{'model':db[_0x7995('0x4b')],'as':_0x7995('0x2b')}]})[_0x7995('0x11')](handleEntityNotFound(_0x5e1f34,null))[_0x7995('0x11')](saveUpdates(_0x50c7b5[_0x7995('0x4c')],null))[_0x7995('0x11')](function(_0x35bea3){if(_0x35bea3&&_0x50c7b5[_0x7995('0x4c')][_0x7995('0x29')]){return db[_0x7995('0x28')][_0x7995('0x4a')](_0x50c7b5[_0x7995('0x4c')]['Imap'],{'where':{'MailAccountId':_0x35bea3['id']}})[_0x7995('0x11')](function(){return _0x35bea3;});}return _0x35bea3;})[_0x7995('0x11')](function(_0x3b8a54){if(_0x3b8a54&&_0x50c7b5[_0x7995('0x4c')]['Smtp']){return db['MailServerOut'][_0x7995('0x4a')](_0x50c7b5[_0x7995('0x4c')][_0x7995('0x46')],{'where':{'MailAccountId':_0x3b8a54['id']}})[_0x7995('0x11')](function(){return _0x3b8a54;});}return _0x3b8a54;})['then'](respondWithResult(_0x5e1f34,null))[_0x7995('0x43')](handleError(_0x5e1f34,null));};exports[_0x7995('0x4d')]=function(_0xef5044,_0x33c49c){return db['MailAccount']['describe']()[_0x7995('0x11')](respondWithResult(_0x33c49c,null))[_0x7995('0x43')](handleError(_0x33c49c,null));};exports[_0x7995('0x4e')]=function(_0x1d69ce,_0x37072){if(_0x1d69ce[_0x7995('0x4c')]['id']){delete _0x1d69ce[_0x7995('0x4c')]['id'];}return db[_0x7995('0x2c')][_0x7995('0x49')]({'where':{'id':_0x1d69ce['params']['id']}})[_0x7995('0x11')](handleEntityNotFound(_0x37072,null))[_0x7995('0x11')](function(_0xdf9e38){if(_0xdf9e38){_0x1d69ce[_0x7995('0x4c')]['MailAccountId']=_0xdf9e38['id'];return db['Disposition'][_0x7995('0x4f')](_0x1d69ce[_0x7995('0x4c')]);}})['then'](respondWithResult(_0x37072,null))[_0x7995('0x43')](handleError(_0x37072,null));};exports[_0x7995('0x50')]=function(_0x2e3421,_0x57727e){var _0x32cb04={'raw':![],'where':{}};var _0x4ed662={};var _0x457d09={'count':0x0,'rows':[]};return db['MailAccount'][_0x7995('0x51')]({'where':{'id':_0x2e3421[_0x7995('0x45')]['id']}})[_0x7995('0x11')](handleEntityNotFound(_0x57727e,null))[_0x7995('0x11')](function(_0x4388c1){if(_0x4388c1){_0x4ed662[_0x7995('0x31')]=_[_0x7995('0x34')](db[_0x7995('0x52')][_0x7995('0x2d')]);_0x4ed662[_0x7995('0x33')]=_[_0x7995('0x34')](_0x2e3421[_0x7995('0x33')]);_0x4ed662['filters']=_[_0x7995('0x37')](_0x4ed662[_0x7995('0x31')],_0x4ed662[_0x7995('0x33')]);_0x32cb04[_0x7995('0x36')]=_[_0x7995('0x37')](_0x4ed662['model'],qs['fields'](_0x2e3421[_0x7995('0x33')][_0x7995('0x38')]));_0x32cb04[_0x7995('0x36')]=_0x32cb04[_0x7995('0x36')]['length']?_0x32cb04[_0x7995('0x36')]:_0x4ed662['model'];if(!_0x2e3421['query'][_0x7995('0x3a')](_0x7995('0x3b'))){_0x32cb04[_0x7995('0x1e')]=qs[_0x7995('0x1e')](_0x2e3421[_0x7995('0x33')][_0x7995('0x1e')]);_0x32cb04[_0x7995('0x1c')]=qs[_0x7995('0x1c')](_0x2e3421[_0x7995('0x33')][_0x7995('0x1c')]);}_0x32cb04['order']=qs[_0x7995('0x53')](_0x2e3421[_0x7995('0x33')][_0x7995('0x53')]);_0x32cb04['where']=qs[_0x7995('0x35')](_[_0x7995('0x3c')](_0x2e3421[_0x7995('0x33')],_0x4ed662[_0x7995('0x35')]));_0x32cb04[_0x7995('0x3d')][_0x7995('0x54')]=_0x4388c1['id'];if(_0x2e3421[_0x7995('0x33')][_0x7995('0x3f')]){_0x32cb04[_0x7995('0x3d')]=_[_0x7995('0x40')](_0x32cb04[_0x7995('0x3d')],{'$or':_['map'](_0x32cb04['attributes'],function(_0xd07c1c){var _0xfe1105={};_0xfe1105[_0xd07c1c]={'$like':'%'+_0x2e3421[_0x7995('0x33')][_0x7995('0x3f')]+'%'};return _0xfe1105;})});}_0x32cb04=_['merge']({},_0x32cb04,_0x2e3421[_0x7995('0x48')]);return db[_0x7995('0x52')]['count']({'where':_0x32cb04['where']})[_0x7995('0x11')](function(_0x305b5a){_0x457d09['count']=_0x305b5a;if(_0x2e3421[_0x7995('0x33')]['includeAll']){_0x32cb04[_0x7995('0x47')]=[{'all':!![]}];}return db[_0x7995('0x52')]['findAll'](_0x32cb04);})['then'](function(_0x1f01c0){_0x457d09['rows']=_0x1f01c0;return _0x457d09;});}})[_0x7995('0x11')](respondWithFilteredResult(_0x57727e,_0x32cb04))[_0x7995('0x43')](handleError(_0x57727e,null));};exports[_0x7995('0x55')]=function(_0x45bd8a,_0x1a1873){return db[_0x7995('0x2c')][_0x7995('0x49')]({'where':{'id':_0x45bd8a[_0x7995('0x45')]['id']}})[_0x7995('0x11')](handleEntityNotFound(_0x1a1873,null))[_0x7995('0x11')](function(_0x1ab590){if(_0x1ab590){return _0x1ab590[_0x7995('0x55')](_0x45bd8a[_0x7995('0x33')][_0x7995('0x56')]);}})[_0x7995('0x11')](respondWithStatusCode(_0x1a1873,null))[_0x7995('0x43')](handleError(_0x1a1873,null));};exports[_0x7995('0x57')]=function(_0x251490,_0x2ff7ba){if(_0x251490[_0x7995('0x4c')]['id']){delete _0x251490[_0x7995('0x4c')]['id'];}return db[_0x7995('0x2c')][_0x7995('0x49')]({'where':{'id':_0x251490[_0x7995('0x45')]['id']}})[_0x7995('0x11')](handleEntityNotFound(_0x2ff7ba,null))[_0x7995('0x11')](function(_0x2f7f51){if(_0x2f7f51){_0x251490[_0x7995('0x4c')]['MailAccountId']=_0x2f7f51['id'];return db[_0x7995('0x58')][_0x7995('0x4f')](_0x251490['body']);}})['then'](respondWithResult(_0x2ff7ba,null))[_0x7995('0x43')](handleError(_0x2ff7ba,null));};exports[_0x7995('0x59')]=function(_0x2d45d5,_0x38acda){var _0xe1ce4={'raw':![],'where':{}};var _0x2491fe={};var _0x5507a0={'count':0x0,'rows':[]};return db[_0x7995('0x2c')][_0x7995('0x51')]({'where':{'id':_0x2d45d5[_0x7995('0x45')]['id']}})[_0x7995('0x11')](handleEntityNotFound(_0x38acda,null))[_0x7995('0x11')](function(_0x3f0bff){if(_0x3f0bff){_0x2491fe[_0x7995('0x31')]=_[_0x7995('0x34')](db['CannedAnswer'][_0x7995('0x2d')]);_0x2491fe[_0x7995('0x33')]=_['keys'](_0x2d45d5['query']);_0x2491fe[_0x7995('0x35')]=_[_0x7995('0x37')](_0x2491fe[_0x7995('0x31')],_0x2491fe[_0x7995('0x33')]);_0xe1ce4[_0x7995('0x36')]=_['intersection'](_0x2491fe[_0x7995('0x31')],qs[_0x7995('0x38')](_0x2d45d5['query'][_0x7995('0x38')]));_0xe1ce4[_0x7995('0x36')]=_0xe1ce4['attributes'][_0x7995('0x39')]?_0xe1ce4['attributes']:_0x2491fe[_0x7995('0x31')];if(!_0x2d45d5[_0x7995('0x33')][_0x7995('0x3a')](_0x7995('0x3b'))){_0xe1ce4[_0x7995('0x1e')]=qs['limit'](_0x2d45d5[_0x7995('0x33')][_0x7995('0x1e')]);_0xe1ce4[_0x7995('0x1c')]=qs['offset'](_0x2d45d5[_0x7995('0x33')][_0x7995('0x1c')]);}_0xe1ce4[_0x7995('0x5a')]=qs[_0x7995('0x53')](_0x2d45d5['query'][_0x7995('0x53')]);_0xe1ce4[_0x7995('0x3d')]=qs[_0x7995('0x35')](_['pick'](_0x2d45d5['query'],_0x2491fe[_0x7995('0x35')]));_0xe1ce4[_0x7995('0x3d')]['MailAccountId']=_0x3f0bff['id'];if(_0x2d45d5['query'][_0x7995('0x3f')]){_0xe1ce4[_0x7995('0x3d')]=_[_0x7995('0x40')](_0xe1ce4[_0x7995('0x3d')],{'$or':_[_0x7995('0x32')](_0xe1ce4['attributes'],function(_0x56003d){var _0x393cb7={};_0x393cb7[_0x56003d]={'$like':'%'+_0x2d45d5['query']['filter']+'%'};return _0x393cb7;})});}_0xe1ce4=_[_0x7995('0x40')]({},_0xe1ce4,_0x2d45d5[_0x7995('0x48')]);return db[_0x7995('0x58')]['count']({'where':_0xe1ce4[_0x7995('0x3d')]})[_0x7995('0x11')](function(_0x2b0b79){_0x5507a0[_0x7995('0x1f')]=_0x2b0b79;if(_0x2d45d5[_0x7995('0x33')]['includeAll']){_0xe1ce4[_0x7995('0x47')]=[{'all':!![]}];}return db[_0x7995('0x58')][_0x7995('0x42')](_0xe1ce4);})[_0x7995('0x11')](function(_0x50bf9a){_0x5507a0[_0x7995('0x5b')]=_0x50bf9a;return _0x5507a0;});}})[_0x7995('0x11')](respondWithFilteredResult(_0x38acda,_0xe1ce4))['catch'](handleError(_0x38acda,null));};exports[_0x7995('0x5c')]=function(_0x20683e,_0x5b1528){return db[_0x7995('0x2c')]['find']({'where':{'id':_0x20683e[_0x7995('0x45')]['id']}})['then'](handleEntityNotFound(_0x5b1528,null))[_0x7995('0x11')](function(_0x4d12fd){if(_0x4d12fd){return _0x4d12fd[_0x7995('0x5c')](_0x20683e[_0x7995('0x33')]['ids']);}})[_0x7995('0x11')](respondWithStatusCode(_0x5b1528,null))['catch'](handleError(_0x5b1528,null));};exports['create']=function(_0x7b9e26,_0x14812d){var _0x784492={'name':_0x7b9e26[_0x7995('0x4c')]['name'],'key':_0x7b9e26[_0x7995('0x4c')][_0x7995('0x30')],'provider':_0x7b9e26['body']['provider']===_0x7995('0x5d')?null:_0x7b9e26['body'][_0x7995('0x5e')],'email':_0x7b9e26[_0x7995('0x4c')][_0x7995('0x5f')],'ListId':_0x7b9e26['body']['ListId'],'active':!_[_0x7995('0x60')](_0x7b9e26['body'][_0x7995('0x61')])?_0x7b9e26[_0x7995('0x4c')][_0x7995('0x61')]:!![],'description':_0x7b9e26[_0x7995('0x4c')]['description']||null,'Imap':{},'Smtp':{}};if(_0x784492['provider']){_0x784492['Imap'][_0x7995('0x62')]=_0x784492[_0x7995('0x46')][_0x7995('0x62')]=_0x7b9e26[_0x7995('0x4c')][_0x7995('0x63')];_0x784492[_0x7995('0x29')]['password']=_0x784492['Smtp'][_0x7995('0x64')]=_0x7b9e26['body']['password'];if(_0x7b9e26[_0x7995('0x4c')]['modernAuthentication']){_0x784492['Imap'][_0x7995('0x65')]=_0x784492[_0x7995('0x46')][_0x7995('0x65')]=!![];_0x784492['Imap'][_0x7995('0x66')]=_0x784492[_0x7995('0x46')][_0x7995('0x66')]=_0x7b9e26[_0x7995('0x4c')][_0x7995('0x66')];_0x784492[_0x7995('0x29')][_0x7995('0x62')]=_0x784492[_0x7995('0x46')][_0x7995('0x62')]=_0x7b9e26['body'][_0x7995('0x63')];}_0x784492[_0x7995('0x29')][_0x7995('0x67')]=_0x784492[_0x7995('0x46')][_0x7995('0x67')]=null;_0x784492['Imap'][_0x7995('0x68')]=_0x784492[_0x7995('0x46')][_0x7995('0x68')]=null;_0x784492['Imap']['port']=_0x784492['Smtp'][_0x7995('0x69')]=null;}else{if(_0x7b9e26[_0x7995('0x4c')][_0x7995('0x6a')]){_0x784492[_0x7995('0x29')][_0x7995('0x62')]=_0x784492[_0x7995('0x46')]['user']=_0x7b9e26[_0x7995('0x4c')]['username'];_0x784492[_0x7995('0x29')][_0x7995('0x6b')]=_0x784492[_0x7995('0x46')][_0x7995('0x64')]=_0x7b9e26[_0x7995('0x4c')][_0x7995('0x6b')];}else{_0x784492[_0x7995('0x29')][_0x7995('0x6a')]=_0x784492[_0x7995('0x46')][_0x7995('0x6a')]=![];}_0x784492[_0x7995('0x29')]['host']=_0x7b9e26[_0x7995('0x4c')]['Imap'][_0x7995('0x68')];_0x784492[_0x7995('0x29')]['port']=_0x7b9e26['body'][_0x7995('0x29')][_0x7995('0x69')];_0x784492[_0x7995('0x46')][_0x7995('0x68')]=_0x7b9e26[_0x7995('0x4c')][_0x7995('0x46')][_0x7995('0x68')];_0x784492[_0x7995('0x46')][_0x7995('0x69')]=_0x7b9e26[_0x7995('0x4c')][_0x7995('0x46')][_0x7995('0x69')];}return db['MailAccount']['create'](_0x784492,{'include':[{'model':db[_0x7995('0x2a')],'as':_0x7995('0x46')},{'model':db[_0x7995('0x28')],'as':_0x7995('0x29')}]})[_0x7995('0x11')](function(_0x5d0ee6){var _0xe8c08e=_0x7b9e26[_0x7995('0x62')]['get']({'plain':!![]});if(!_0xe8c08e)throw new Error(_0x7995('0x6c'));if(_0xe8c08e['role']===_0x7995('0x62')){var _0x30cda5=_0x5d0ee6[_0x7995('0x6d')]({'plain':!![]});return db['UserProfileSection'][_0x7995('0x49')]({'where':{'name':_0x7995('0x24'),'userProfileId':_0xe8c08e[_0x7995('0x6e')]},'raw':!![]})[_0x7995('0x11')](function(_0x11f9fb){if(_0x11f9fb&&_0x11f9fb[_0x7995('0x6f')]===0x0){return db[_0x7995('0x25')]['create']({'name':_0x30cda5['name'],'resourceId':_0x30cda5['id'],'type':_0x11f9fb['name'],'sectionId':_0x11f9fb['id']},{})[_0x7995('0x11')](function(){return _0x5d0ee6;});}else{return _0x5d0ee6;}})[_0x7995('0x43')](function(_0x5a78e9){logger['error'](_0x7995('0x70'),_0x5a78e9);throw _0x5a78e9;});}return _0x5d0ee6;})[_0x7995('0x11')](respondWithResult(_0x14812d,0xc9))['catch'](handleError(_0x14812d,null));};exports['getImap']=function(_0x538bd3,_0x5b591b){return db[_0x7995('0x2c')][_0x7995('0x51')]({'where':{'id':_0x538bd3[_0x7995('0x45')]['id']}})[_0x7995('0x11')](handleEntityNotFound(_0x5b591b,null))['then'](function(_0x20b512){if(_0x20b512){return _0x20b512[_0x7995('0x71')]();}return null;})['then'](respondWithResult(_0x5b591b,null))[_0x7995('0x43')](handleError(_0x5b591b,null));};exports[_0x7995('0x72')]=function(_0x1f9652,_0x580917){if(_0x1f9652[_0x7995('0x4c')]['id']){delete _0x1f9652[_0x7995('0x4c')]['id'];}return db['MailAccount'][_0x7995('0x49')]({'where':{'id':_0x1f9652[_0x7995('0x45')]['id']}})[_0x7995('0x11')](handleEntityNotFound(_0x580917,null))[_0x7995('0x11')](function(_0x1d907c){if(_0x1d907c){_0x1f9652[_0x7995('0x4c')][_0x7995('0x54')]=_0x1d907c['id'];return db[_0x7995('0x28')][_0x7995('0x4f')](_0x1f9652[_0x7995('0x4c')]);}})[_0x7995('0x11')](respondWithResult(_0x580917,null))[_0x7995('0x43')](handleError(_0x580917,null));};exports[_0x7995('0x73')]=function(_0x4963ad,_0x154eff){return db[_0x7995('0x2c')][_0x7995('0x51')]({'where':{'id':_0x4963ad[_0x7995('0x45')]['id']}})['then'](handleEntityNotFound(_0x154eff,null))[_0x7995('0x11')](function(_0x2e6f4e){if(_0x2e6f4e){return _0x2e6f4e[_0x7995('0x74')](null);}return null;})['then'](respondWithStatusCode(_0x154eff,null))[_0x7995('0x43')](handleError(_0x154eff,null));};exports[_0x7995('0x75')]=function(_0x72848b,_0x413c96){return db[_0x7995('0x2c')][_0x7995('0x51')]({'where':{'id':_0x72848b[_0x7995('0x45')]['id']}})['then'](handleEntityNotFound(_0x413c96,null))[_0x7995('0x11')](function(_0x4efc7f){if(_0x4efc7f){return _0x4efc7f[_0x7995('0x75')]();}return null;})[_0x7995('0x11')](respondWithResult(_0x413c96,null))[_0x7995('0x43')](handleError(_0x413c96,null));};exports['addSmtp']=function(_0xd012b9,_0x5a1892){if(_0xd012b9['body']['id']){delete _0xd012b9['body']['id'];}return db['MailAccount'][_0x7995('0x49')]({'where':{'id':_0xd012b9[_0x7995('0x45')]['id']}})['then'](handleEntityNotFound(_0x5a1892,null))[_0x7995('0x11')](function(_0x3edba1){if(_0x3edba1){_0xd012b9['body'][_0x7995('0x54')]=_0x3edba1['id'];return db[_0x7995('0x2a')][_0x7995('0x4f')](_0xd012b9[_0x7995('0x4c')]);}})[_0x7995('0x11')](respondWithResult(_0x5a1892,null))['catch'](handleError(_0x5a1892,null));};exports[_0x7995('0x76')]=function(_0x1df81d,_0x12127d){return db[_0x7995('0x2c')]['findOne']({'where':{'id':_0x1df81d[_0x7995('0x45')]['id']}})[_0x7995('0x11')](handleEntityNotFound(_0x12127d,null))[_0x7995('0x11')](function(_0x3ca281){if(_0x3ca281){return _0x3ca281[_0x7995('0x77')](null);}return null;})[_0x7995('0x11')](respondWithStatusCode(_0x12127d,null))[_0x7995('0x43')](handleError(_0x12127d,null));};exports[_0x7995('0x78')]=function(_0x1c3074,_0x1fda95){return db['MailInteraction'][_0x7995('0x49')]({'where':{'id':_0x1c3074['params']['id']}})[_0x7995('0x11')](handleEntityNotFound(_0x1fda95,null))[_0x7995('0x11')](function(_0x2a9264){if(_0x2a9264){return _0x2a9264['addInteraction'](_0x1c3074['body'][_0x7995('0x56')],_[_0x7995('0x79')](_0x1c3074['body'],[_0x7995('0x56'),'id'])||{});}})['then'](respondWithResult(_0x1fda95,null))[_0x7995('0x43')](handleError(_0x1fda95,null));};exports[_0x7995('0x7a')]=function(_0x27b1c2,_0x4e5667){var _0x5897df={'raw':![],'where':{}};var _0x4c090a={};var _0x3f57dd={'count':0x0,'rows':[]};return db[_0x7995('0x2c')][_0x7995('0x51')]({'where':{'id':_0x27b1c2[_0x7995('0x45')]['id']}})['then'](handleEntityNotFound(_0x4e5667,null))[_0x7995('0x11')](function(_0x382951){if(_0x382951){_0x4c090a[_0x7995('0x31')]=_[_0x7995('0x34')](db[_0x7995('0x7b')]['rawAttributes']);_0x4c090a['query']=_['keys'](_0x27b1c2[_0x7995('0x33')]);_0x4c090a[_0x7995('0x35')]=_['intersection'](_0x4c090a[_0x7995('0x31')],_0x4c090a['query']);_0x5897df[_0x7995('0x36')]=_[_0x7995('0x37')](_0x4c090a[_0x7995('0x31')],qs[_0x7995('0x38')](_0x27b1c2['query'][_0x7995('0x38')]));_0x5897df[_0x7995('0x36')]=_0x5897df[_0x7995('0x36')][_0x7995('0x39')]?_0x5897df[_0x7995('0x36')]:_0x4c090a[_0x7995('0x31')];if(!_0x27b1c2[_0x7995('0x33')][_0x7995('0x3a')](_0x7995('0x3b'))){_0x5897df[_0x7995('0x1e')]=qs[_0x7995('0x1e')](_0x27b1c2[_0x7995('0x33')][_0x7995('0x1e')]);_0x5897df[_0x7995('0x1c')]=qs['offset'](_0x27b1c2[_0x7995('0x33')]['offset']);}_0x5897df[_0x7995('0x5a')]=qs[_0x7995('0x53')](_0x27b1c2['query'][_0x7995('0x53')]);_0x5897df['where']=qs[_0x7995('0x35')](_[_0x7995('0x3c')](_0x27b1c2['query'],_0x4c090a['filters']));_0x5897df['where'][_0x7995('0x54')]=_0x382951['id'];if(_0x27b1c2[_0x7995('0x33')][_0x7995('0x3f')]){_0x5897df[_0x7995('0x3d')]=_['merge'](_0x5897df[_0x7995('0x3d')],{'$or':_[_0x7995('0x32')](_0x5897df[_0x7995('0x36')],function(_0x2de960){var _0x29c109={};_0x29c109[_0x2de960]={'$like':'%'+_0x27b1c2[_0x7995('0x33')][_0x7995('0x3f')]+'%'};return _0x29c109;})});}_0x5897df=_[_0x7995('0x40')]({},_0x5897df,_0x27b1c2['options']);return db[_0x7995('0x7b')][_0x7995('0x1f')]({'where':_0x5897df[_0x7995('0x3d')]})[_0x7995('0x11')](function(_0x51ee98){_0x3f57dd[_0x7995('0x1f')]=_0x51ee98;if(_0x27b1c2[_0x7995('0x33')][_0x7995('0x41')]){_0x5897df[_0x7995('0x47')]=[{'model':db[_0x7995('0x7c')],'as':_0x7995('0x7d'),'required':![]},{'model':db['User'],'as':_0x7995('0x7e'),'attributes':[_0x7995('0x27'),_0x7995('0x7f'),_0x7995('0x80')],'required':![]},{'model':db[_0x7995('0x81')],'as':_0x7995('0x82'),'attributes':['id',_0x7995('0x27'),_0x7995('0x83')],'where':_0x27b1c2[_0x7995('0x33')][_0x7995('0x84')]?{'id':_0x27b1c2[_0x7995('0x33')][_0x7995('0x84')]}:undefined,'required':_0x27b1c2[_0x7995('0x33')][_0x7995('0x84')]?!![]:![]}];}return db[_0x7995('0x7b')][_0x7995('0x42')](_0x5897df);})[_0x7995('0x11')](function(_0x1f254d){_0x3f57dd[_0x7995('0x5b')]=_0x1f254d;return _0x3f57dd;});}})[_0x7995('0x11')](respondWithFilteredResult(_0x4e5667,_0x5897df))[_0x7995('0x43')](handleError(_0x4e5667,null));};exports['addApplications']=function addApplications(_0x4cf7f1,_0x1a980b){var _0x1ce297=_0x4cf7f1['params']['id'];var _0x119977=_0x4cf7f1['body'];var _0x2ce103=0xc8;var _0x4b360b=null;return db[_0x7995('0x85')][_0x7995('0x86')]({'isolationLevel':db[_0x7995('0x85')][_0x7995('0x87')][_0x7995('0x88')][_0x7995('0x89')]},function(_0xd82313){return db[_0x7995('0x2c')][_0x7995('0x51')]({'where':{'id':_0x1ce297},'transaction':_0xd82313})[_0x7995('0x11')](function(_0x49e85c){if(_0x49e85c){return db[_0x7995('0x8a')][_0x7995('0x23')]({'where':{'MailAccountId':_0x1ce297},'transaction':_0xd82313})[_0x7995('0x11')](function(){var _0x3c83dd=_['map'](_0x119977,function(_0x408c22){_0x408c22[_0x7995('0x54')]=_0x1ce297;return _0x408c22;});return db[_0x7995('0x8a')][_0x7995('0x8b')](_0x3c83dd,{'transaction':_0xd82313});});}else{_0x2ce103=0x194;_0x4b360b=[];}});})['then'](function(){if(_0x2ce103!==0x194){return db[_0x7995('0x8a')][_0x7995('0x8c')]({'where':{'MailAccountId':_0x1ce297},'order':_0x7995('0x8d')})[_0x7995('0x11')](function(_0x21617b){_0x4b360b=_0x21617b;});}})[_0x7995('0x43')](function(_0x43a607){_0x2ce103=0x1f4;logger[_0x7995('0x17')](_0x43a607[_0x7995('0x8e')]);if(_0x43a607['name']){delete _0x43a607[_0x7995('0x27')];}_0x4b360b=_0x43a607;})['finally'](function(){if(_0x4b360b===null){_0x1a980b[_0x7995('0x26')](_0x2ce103);}else{if(_0x2ce103===0x1f4){_0x1a980b[_0x7995('0x1a')](_0x2ce103)[_0x7995('0x8f')](_0x4b360b);}else{_0x1a980b[_0x7995('0x1a')](_0x2ce103)['json'](_0x4b360b);}}});};exports[_0x7995('0x90')]=function(_0x3d2563,_0x152c79){var _0x129198={};var _0x2c715={};var _0x1b808f;var _0x3661ab;return db[_0x7995('0x2c')][_0x7995('0x51')]({'where':{'id':_0x3d2563[_0x7995('0x45')]['id']}})[_0x7995('0x11')](handleEntityNotFound(_0x152c79,null))[_0x7995('0x11')](function(_0x7d14e2){if(_0x7d14e2){_0x1b808f=_0x7d14e2;_0x2c715[_0x7995('0x31')]=_['keys'](db['MailApplication'][_0x7995('0x2d')]);_0x2c715[_0x7995('0x33')]=_[_0x7995('0x34')](_0x3d2563['query']);_0x2c715[_0x7995('0x35')]=_[_0x7995('0x37')](_0x2c715[_0x7995('0x31')],_0x2c715['query']);_0x129198[_0x7995('0x36')]=_[_0x7995('0x37')](_0x2c715[_0x7995('0x31')],qs[_0x7995('0x38')](_0x3d2563[_0x7995('0x33')][_0x7995('0x38')]));_0x129198[_0x7995('0x36')]=_0x129198[_0x7995('0x36')][_0x7995('0x39')]?_0x129198[_0x7995('0x36')]:_0x2c715[_0x7995('0x31')];_0x129198['order']=qs['sort'](_0x3d2563[_0x7995('0x33')]['sort']);_0x129198[_0x7995('0x3d')]=qs[_0x7995('0x35')](_[_0x7995('0x3c')](_0x3d2563[_0x7995('0x33')],_0x2c715[_0x7995('0x35')]));if(_0x3d2563['query']['filter']){_0x129198[_0x7995('0x3d')]=_[_0x7995('0x40')](_0x129198[_0x7995('0x3d')],{'$or':_[_0x7995('0x32')](_0x129198[_0x7995('0x36')],function(_0x440b1b){var _0x278cb3={};_0x278cb3[_0x440b1b]={'$like':'%'+_0x3d2563[_0x7995('0x33')][_0x7995('0x3f')]+'%'};return _0x278cb3;})});}_0x129198=_[_0x7995('0x40')]({},_0x129198,_0x3d2563['options']);return _0x1b808f[_0x7995('0x90')](_0x129198);}})[_0x7995('0x11')](function(_0x38e67a){if(_0x38e67a){_0x3661ab=_0x38e67a[_0x7995('0x39')];if(!_0x3d2563['query']['hasOwnProperty']('nolimit')){_0x129198['limit']=qs['limit'](_0x3d2563[_0x7995('0x33')]['limit']);_0x129198['offset']=qs[_0x7995('0x1c')](_0x3d2563[_0x7995('0x33')][_0x7995('0x1c')]);}return _0x1b808f['getApplications'](_0x129198);}})[_0x7995('0x11')](function(_0x4f008a){if(_0x4f008a){return _0x4f008a?{'count':_0x3661ab,'rows':_0x4f008a}:null;}})[_0x7995('0x11')](respondWithResult(_0x152c79,null))[_0x7995('0x43')](handleError(_0x152c79,null));};exports[_0x7995('0x91')]=function(_0x5c50b7,_0x453957){var _0x14be06={'raw':!![],'where':{}};var _0x1b5b5b={};var _0x4abb5f={'count':0x0,'rows':[]};return db[_0x7995('0x2c')][_0x7995('0x51')]({'where':{'id':_0x5c50b7[_0x7995('0x45')]['id']}})[_0x7995('0x11')](handleEntityNotFound(_0x453957,null))[_0x7995('0x11')](function(_0x574e2a){if(_0x574e2a){_0x1b5b5b[_0x7995('0x31')]=_[_0x7995('0x34')](db[_0x7995('0x92')]['rawAttributes']);_0x1b5b5b[_0x7995('0x33')]=_[_0x7995('0x34')](_0x5c50b7[_0x7995('0x33')]);_0x1b5b5b[_0x7995('0x35')]=_[_0x7995('0x37')](_0x1b5b5b['model'],_0x1b5b5b[_0x7995('0x33')]);_0x14be06[_0x7995('0x36')]=_[_0x7995('0x37')](_0x1b5b5b[_0x7995('0x31')],qs[_0x7995('0x38')](_0x5c50b7[_0x7995('0x33')][_0x7995('0x38')]));_0x14be06['attributes']=_0x14be06['attributes'][_0x7995('0x39')]?_0x14be06[_0x7995('0x36')]:_0x1b5b5b['model'];if(!_0x5c50b7['query'][_0x7995('0x3a')](_0x7995('0x3b'))){_0x14be06[_0x7995('0x1e')]=qs[_0x7995('0x1e')](_0x5c50b7[_0x7995('0x33')][_0x7995('0x1e')]);_0x14be06[_0x7995('0x1c')]=qs['offset'](_0x5c50b7[_0x7995('0x33')][_0x7995('0x1c')]);}_0x14be06[_0x7995('0x5a')]=qs[_0x7995('0x53')](_0x5c50b7[_0x7995('0x33')][_0x7995('0x53')]);_0x14be06['where']=qs[_0x7995('0x35')](_[_0x7995('0x3c')](_0x5c50b7[_0x7995('0x33')],_0x1b5b5b[_0x7995('0x35')]));_0x14be06[_0x7995('0x3d')][_0x7995('0x54')]=_0x574e2a['id'];if(_0x5c50b7[_0x7995('0x33')]['filter']){_0x14be06[_0x7995('0x3d')]=_[_0x7995('0x40')](_0x14be06[_0x7995('0x3d')],{'$or':_[_0x7995('0x32')](_0x14be06['attributes'],function(_0x1632a2){var _0x5c9894={};_0x5c9894[_0x1632a2]={'$like':'%'+_0x5c50b7[_0x7995('0x33')][_0x7995('0x3f')]+'%'};return _0x5c9894;})});}if(_0x5c50b7['query']['$gte']){var _0x478c12=_0x5c50b7[_0x7995('0x33')][_0x7995('0x93')][_0x7995('0x94')](',');var _0x18a3dc={};_0x18a3dc[_0x478c12[0x0]]={'$gte':moment(_0x478c12[0x1])[_0x7995('0x95')](_0x7995('0x96'))};_0x14be06[_0x7995('0x3d')]=_[_0x7995('0x40')](_0x14be06[_0x7995('0x3d')],_0x18a3dc);}_0x14be06=_[_0x7995('0x40')]({},_0x14be06,_0x5c50b7[_0x7995('0x48')]);return db[_0x7995('0x92')]['count']({'where':_0x14be06['where']})[_0x7995('0x11')](function(_0x4c66ad){_0x4abb5f['count']=_0x4c66ad;if(_0x5c50b7[_0x7995('0x33')][_0x7995('0x41')]){_0x14be06[_0x7995('0x47')]=[{'all':!![]}];}return db[_0x7995('0x92')][_0x7995('0x42')](_0x14be06);})[_0x7995('0x11')](function(_0xcb43bf){if(_0x5c50b7[_0x7995('0x33')][_0x7995('0x97')]===_0x7995('0x98')){for(var _0x53480e=0x0;_0x53480e<_0xcb43bf[_0x7995('0x39')];_0x53480e++){_0xcb43bf[_0x53480e]['body']=juice(_0xcb43bf[_0x53480e][_0x7995('0x4c')]);}}_0x4abb5f[_0x7995('0x5b')]=_0xcb43bf;return _0x4abb5f;});}})[_0x7995('0x11')](respondWithFilteredResult(_0x453957,_0x14be06))[_0x7995('0x43')](handleError(_0x453957,null));};exports[_0x7995('0x8f')]=function(_0x17570a,_0x360022){var _0x551480,_0x88334d={},_0x234832;if(_0x17570a[_0x7995('0x4c')]['to']){_0x234832=_0x17570a[_0x7995('0x4c')]['to'][_0x7995('0x94')](',')[0x0];}return db['MailAccount'][_0x7995('0x49')]({'where':{'id':_0x17570a['params']['id']},'include':[{'model':db[_0x7995('0x99')],'as':_0x7995('0x9a'),'include':[{'model':db[_0x7995('0x7c')],'as':'Contacts','where':{'email':_0x234832},'limit':0x1,'order':[[_0x7995('0x9b'),_0x7995('0x9c')]]}]},{'model':db[_0x7995('0x2a')],'as':_0x7995('0x46'),'raw':!![]}]})[_0x7995('0x11')](handleEntityNotFound(_0x360022,null))[_0x7995('0x11')](function(_0x89bb57){if(_0x89bb57){_0x551480=_0x89bb57;if(_0x89bb57['Smtp']){if(_['isNil'](_0x17570a[_0x7995('0x4c')][_0x7995('0x9d')])){_0x17570a[_0x7995('0x4c')][_0x7995('0x9d')]=util[_0x7995('0x95')](_0x7995('0x9e'),_0x89bb57['name'],_0x89bb57[_0x7995('0x5f')]||_0x89bb57[_0x7995('0x46')][_0x7995('0x62')]);}if(_0x17570a[_0x7995('0x4c')]['attachments']&&_0x17570a['body'][_0x7995('0x9f')][_0x7995('0x39')]){for(var _0x5855ae=0x0;_0x5855ae<_0x17570a[_0x7995('0x4c')][_0x7995('0x9f')]['length'];_0x5855ae+=0x1){_0x17570a[_0x7995('0x4c')][_0x7995('0x9f')][_0x5855ae]={'filename':_0x17570a[_0x7995('0x4c')][_0x7995('0x9f')][_0x5855ae][_0x7995('0x27')],'path':path['join'](config['root'],_0x7995('0xa0'),_0x17570a[_0x7995('0x4c')][_0x7995('0x9f')][_0x5855ae][_0x7995('0xa1')])};}}var _0x37fd9b={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x89bb57[_0x7995('0x46')][_0x7995('0x67')])){if(_0x89bb57[_0x7995('0x46')][_0x7995('0x6a')]){_0x37fd9b[_0x7995('0xa2')]={'user':_0x89bb57['Smtp']['user'],'pass':_0x89bb57['Smtp']['pass']};}_0x37fd9b[_0x7995('0x68')]=_0x89bb57[_0x7995('0x46')]['host'];_0x37fd9b[_0x7995('0x69')]=_0x89bb57[_0x7995('0x46')]['port'];_0x37fd9b['secure']=_0x89bb57[_0x7995('0x46')][_0x7995('0xa3')];}else{_0x37fd9b[_0x7995('0x67')]=_0x89bb57[_0x7995('0x46')][_0x7995('0x67')];_0x37fd9b[_0x7995('0xa2')]={'user':_0x89bb57[_0x7995('0x46')]['user'],'pass':_0x89bb57['Smtp'][_0x7995('0x64')]};}return respondWithRpcPromise(_0x7995('0xa4'),_0x7995('0xa5'),{'account':_0x37fd9b,'message':_0x17570a['body']});}else{throw new Error(_0x7995('0xa6'));}}})[_0x7995('0x11')](function(_0x24eaf9){if(_0x24eaf9){_0x88334d=_0x24eaf9;if(_0x551480[_0x7995('0x9a')]){if(_0x551480[_0x7995('0x9a')][_0x7995('0xa7')][_0x7995('0x39')]){return _0x551480[_0x7995('0x9a')][_0x7995('0xa7')][0x0];}else{return db['CmContact']['create'](_[_0x7995('0xb')](_0x17570a['body'],{'firstName':_0x17570a[_0x7995('0x4c')]['to'],'email':_0x17570a['body']['to'],'phone':_0x17570a[_0x7995('0x4c')]['to'],'ListId':_0x551480[_0x7995('0xa8')]}));}}else{throw new Error(_0x7995('0xa6'));}}})['then'](function(_0x4c810d){if(_0x4c810d){var _0x1401b4={'UserId':_0x17570a[_0x7995('0x62')]['id'],'ContactId':_0x4c810d['id'],'MailAccountId':_0x551480['id'],'inReplyTo':_0x88334d[_0x7995('0xa9')],'to':_0x17570a[_0x7995('0x4c')][_0x7995('0x9d')],'cc':_0x17570a[_0x7995('0x4c')]['cc'],'subject':_0x17570a[_0x7995('0x4c')][_0x7995('0xaa')],'attach':_0x17570a[_0x7995('0x4c')][_0x7995('0xab')],'firstMsgDirection':_0x7995('0xac'),'lastMsgAt':moment()['format'](_0x7995('0x96')),'lastMsgDirection':_0x7995('0xac'),'Messages':[_[_0x7995('0x40')](_0x17570a[_0x7995('0x4c')],{'messageId':_0x88334d[_0x7995('0xa9')],'sentAt':moment()['format'](_0x7995('0x96')),'read':!![],'MailAccountId':_0x551480['id'],'UserId':_0x17570a[_0x7995('0x62')]['id'],'ContactId':_0x4c810d['id']})]};if(_0x17570a[_0x7995('0x4c')][_0x7995('0xad')]){_0x1401b4=_[_0x7995('0x40')](_0x1401b4,_0x17570a[_0x7995('0x4c')][_0x7995('0xad')]);}return db[_0x7995('0x7b')][_0x7995('0x4f')](_0x1401b4,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});}})[_0x7995('0x11')](respondWithResult(_0x360022,null))[_0x7995('0x43')](handleError(_0x360022,null));};exports[_0x7995('0xae')]=function(_0x3234d8,_0x17fd98){return db['MailAccount'][_0x7995('0x49')]({'where':{'id':_0x3234d8[_0x7995('0x45')]['id']},'include':[{'model':db[_0x7995('0x2a')],'as':_0x7995('0x46'),'raw':!![],'include':[{'model':db[_0x7995('0xaf')],'as':_0x7995('0xaf'),'raw':!![]}]}]})[_0x7995('0x11')](handleEntityNotFound(_0x17fd98,null))[_0x7995('0x11')](function(_0x3fcfe2){if(!_0x3fcfe2['Smtp'])return;var _0x4f7c20={'id':_0x3fcfe2['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3fcfe2[_0x7995('0x5e')]!==_0x7995('0x5d')){_0x4f7c20[_0x7995('0x67')]=_0x3fcfe2[_0x7995('0x5e')];}else{_0x4f7c20[_0x7995('0x68')]=_0x3fcfe2[_0x7995('0x46')][_0x7995('0x68')];_0x4f7c20[_0x7995('0x69')]=_0x3fcfe2['Smtp']['port'];_0x4f7c20[_0x7995('0xa3')]=_0x3fcfe2[_0x7995('0x46')][_0x7995('0xa3')];}if(_0x3fcfe2[_0x7995('0x46')]['authentication']){if(_0x3fcfe2['Smtp'][_0x7995('0x65')]){_0x4f7c20[_0x7995('0xa2')]={'type':_0x7995('0xb0'),'user':_0x3fcfe2[_0x7995('0x46')][_0x7995('0x62')],'accessToken':_0x3fcfe2[_0x7995('0x46')][_0x7995('0xaf')][_0x7995('0xb1')]};}else{_0x4f7c20[_0x7995('0xa2')]={'user':_0x3fcfe2[_0x7995('0x46')][_0x7995('0x62')],'pass':_0x3fcfe2[_0x7995('0x46')]['pass']};}}return respondWithRpcPromise('VerifySmtp',_0x7995('0xae'),{'account':_0x4f7c20});})[_0x7995('0x11')](respondWithResult(_0x17fd98,null))[_0x7995('0x43')](handleError(_0x17fd98,null));};exports[_0x7995('0x23')]=function(_0x5e9a87,_0x2fb855){return db['MailAccount'][_0x7995('0x49')]({'where':{'id':_0x5e9a87[_0x7995('0x45')]['id']}})[_0x7995('0x11')](handleEntityNotFound(_0x2fb855,null))[_0x7995('0x11')](function(_0xfa2a13){if(_0xfa2a13&&_0xfa2a13[_0x7995('0x67')]){throw new db['Sequelize'][(_0x7995('0xb2'))](_0x7995('0xb3'));}return _0xfa2a13;})[_0x7995('0x11')](removeEntity(_0x2fb855,null))[_0x7995('0x43')](handleError(_0x2fb855,null));};exports['addAgents']=function(_0x4ee1fa,_0x43b9d6){return db[_0x7995('0x2c')][_0x7995('0x49')]({'where':{'id':_0x4ee1fa[_0x7995('0x45')]['id']}})['then'](handleEntityNotFound(_0x43b9d6,null))[_0x7995('0x11')](function(_0x4e72){if(_0x4e72){return _0x4e72[_0x7995('0xb4')](_0x4ee1fa['body'][_0x7995('0x56')],_[_0x7995('0x79')](_0x4ee1fa[_0x7995('0x4c')],['ids','id'])||{})[_0x7995('0xb5')](function(_0xb259cc){for(var _0x269493=0x0;_0x269493<_0x4ee1fa[_0x7995('0x4c')][_0x7995('0x56')][_0x7995('0x39')];_0x269493+=0x1){socket[_0x7995('0xb6')](_0x7995('0xb7'),{'UserId':Number(_0x4ee1fa[_0x7995('0x4c')]['ids'][_0x269493]),'MailAccountId':Number(_0x4ee1fa[_0x7995('0x45')]['id'])});}return _0xb259cc;});}})[_0x7995('0x11')](respondWithResult(_0x43b9d6,null))[_0x7995('0x43')](handleError(_0x43b9d6,null));};exports[_0x7995('0xb8')]=function(_0x5eb18f,_0x3136b9){return db[_0x7995('0x2c')][_0x7995('0x49')]({'where':{'id':_0x5eb18f[_0x7995('0x45')]['id']}})['then'](handleEntityNotFound(_0x3136b9,null))[_0x7995('0x11')](function(_0x39b8d8){if(_0x39b8d8){return _0x39b8d8[_0x7995('0xb8')](_0x5eb18f[_0x7995('0x33')][_0x7995('0x56')])[_0x7995('0x11')](function(){if(_[_0x7995('0xb9')](_0x5eb18f['query'][_0x7995('0x56')])){for(var _0x3b0327=0x0;_0x3b0327<_0x5eb18f[_0x7995('0x33')][_0x7995('0x56')][_0x7995('0x39')];_0x3b0327+=0x1){socket['emit'](_0x7995('0xba'),{'UserId':Number(_0x5eb18f['query'][_0x7995('0x56')][_0x3b0327]),'MailAccountId':Number(_0x5eb18f[_0x7995('0x45')]['id'])});}}else{socket[_0x7995('0xb6')]('userMailAccount:remove',{'UserId':Number(_0x5eb18f['query']['ids']),'MailAccountId':Number(_0x5eb18f[_0x7995('0x45')]['id'])});}});}})[_0x7995('0x11')](respondWithStatusCode(_0x3136b9,null))[_0x7995('0x43')](handleError(_0x3136b9,null));};exports[_0x7995('0xbb')]=function(_0x17fab0,_0x4da0e8){var _0x4d0db1={};var _0x32898a={};var _0x37860d;var _0x37539a;return db[_0x7995('0x2c')]['findOne']({'where':{'id':_0x17fab0[_0x7995('0x45')]['id']}})[_0x7995('0x11')](handleEntityNotFound(_0x4da0e8,null))['then'](function(_0x2d5810){if(_0x2d5810){_0x37860d=_0x2d5810;_0x32898a['model']=_[_0x7995('0x34')](db[_0x7995('0xbc')][_0x7995('0x2d')]);_0x32898a['query']=_['keys'](_0x17fab0[_0x7995('0x33')]);_0x32898a[_0x7995('0x35')]=_[_0x7995('0x37')](_0x32898a[_0x7995('0x31')],_0x32898a[_0x7995('0x33')]);_0x4d0db1[_0x7995('0x36')]=_[_0x7995('0x37')](_0x32898a[_0x7995('0x31')],qs[_0x7995('0x38')](_0x17fab0[_0x7995('0x33')][_0x7995('0x38')]));_0x4d0db1['attributes']=_0x4d0db1['attributes'][_0x7995('0x39')]?_0x4d0db1[_0x7995('0x36')]:_0x32898a[_0x7995('0x31')];_0x4d0db1[_0x7995('0x5a')]=qs['sort'](_0x17fab0['query'][_0x7995('0x53')]);_0x4d0db1[_0x7995('0x3d')]=qs['filters'](_['pick'](_0x17fab0[_0x7995('0x33')],_0x32898a[_0x7995('0x35')]));if(_0x17fab0[_0x7995('0x33')][_0x7995('0x3f')]){_0x4d0db1[_0x7995('0x3d')]=_['merge'](_0x4d0db1[_0x7995('0x3d')],{'$or':_[_0x7995('0x32')](_0x4d0db1['attributes'],function(_0xf9859c){var _0x1856d9={};_0x1856d9[_0xf9859c]={'$like':'%'+_0x17fab0[_0x7995('0x33')]['filter']+'%'};return _0x1856d9;})});}_0x4d0db1=_[_0x7995('0x40')]({},_0x4d0db1,_0x17fab0[_0x7995('0x48')]);return _0x37860d[_0x7995('0xbb')](_0x4d0db1);}})[_0x7995('0x11')](function(_0x113e03){if(_0x113e03){_0x37539a=_0x113e03['length'];if(!_0x17fab0['query'][_0x7995('0x3a')]('nolimit')){_0x4d0db1[_0x7995('0x1e')]=qs['limit'](_0x17fab0[_0x7995('0x33')][_0x7995('0x1e')]);_0x4d0db1[_0x7995('0x1c')]=qs['offset'](_0x17fab0['query']['offset']);}return _0x37860d[_0x7995('0xbb')](_0x4d0db1);}})[_0x7995('0x11')](function(_0x270ef3){if(_0x270ef3){return _0x270ef3?{'count':_0x37539a,'rows':_0x270ef3}:null;}})['then'](respondWithResult(_0x4da0e8,null))[_0x7995('0x43')](handleError(_0x4da0e8,null));}; \ No newline at end of file +var _0x7a54=['host','port','authentication','pass','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','addSmtp','removeSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','READ_COMMITTED','MailApplication','bulkCreate','getApplications','$gte','MailMessage','inlineCss','true','split','CmList','CmContact','Contacts','updatedAt','DESC','from','format','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','secure','service','auth','SendMail','List\x20not\x20found','List','messageId','subject','attach','out','Interaction','verifySmtp','CloudProvider','OAuth2','VerifySmtp','Sequelize','ValidationError','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','./mailAccount.socket','http','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','update','destroy','MailAccounts','UserProfileResource','sendStatus','stack','name','send','index','MailServerIn','Imap','Smtp','MailAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','VIRTUAL','merge','where','includeAll','include','findAll','rows','show','Pause','rawAttributes','options','find','body','params','MailServerOut','describe','addDisposition','MailAccountId','getDispositions','findOne','length','hasOwnProperty','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','create','getAnswers','removeAnswers','provider','custom','ListId','isNil','description','user','username','password','modernAuthentication','CloudProviderId'];(function(_0x1354cd,_0x477cd5){var _0x1ee166=function(_0x31eca4){while(--_0x31eca4){_0x1354cd['push'](_0x1354cd['shift']());}};_0x1ee166(++_0x477cd5);}(_0x7a54,0x106));var _0x47a5=function(_0xcb003b,_0x24fbab){_0xcb003b=_0xcb003b-0x0;var _0x3582ab=_0x7a54[_0xcb003b];return _0x3582ab;};'use strict';var moment=require(_0x47a5('0x0'));var BPromise=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var path=require('path');var _=require(_0x47a5('0x3'));var juice=require(_0x47a5('0x4'));var Redis=require('ioredis');var qs=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var db=require(_0x47a5('0x9'))['db'];config['redis']=_[_0x47a5('0xa')](config['redis'],{'host':_0x47a5('0xb'),'port':0x18eb});var socket=require(_0x47a5('0xc'))(new Redis(config['redis']));require(_0x47a5('0xd'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x47a5('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x2baee7,_0x5e31dd,_0x2eb0dd,_0x49e844){return new BPromise(function(_0x5de6d7,_0x1f47f4){var _0x69e4d4=_0x49e844||client;return _0x69e4d4[_0x47a5('0xf')](_0x2baee7,_0x2eb0dd)[_0x47a5('0x10')](function(_0xd612dd){logger[_0x47a5('0x11')](_0x47a5('0x12'),_0x5e31dd,'request\x20sent');logger[_0x47a5('0x13')](_0x47a5('0x14'),_0x5e31dd,_0x47a5('0x15'),JSON[_0x47a5('0x16')](_0xd612dd));if(_0xd612dd[_0x47a5('0x17')]){if(_0xd612dd[_0x47a5('0x17')][_0x47a5('0x18')]===0x1f4){logger[_0x47a5('0x17')]('MailAccount,\x20%s,\x20%s',_0x5e31dd,_0xd612dd[_0x47a5('0x17')][_0x47a5('0x19')]);return _0x1f47f4(_0xd612dd[_0x47a5('0x17')][_0x47a5('0x19')]);}logger[_0x47a5('0x17')]('MailAccount,\x20%s,\x20%s',_0x5e31dd,_0xd612dd['error'][_0x47a5('0x19')]);return _0x5de6d7(_0xd612dd['error']['message']);}else{logger[_0x47a5('0x11')](_0x47a5('0x12'),_0x5e31dd,_0x47a5('0x15'));_0x5de6d7(_0xd612dd[_0x47a5('0x1a')][_0x47a5('0x19')]);}})[_0x47a5('0x1b')](function(_0x2763d6){logger[_0x47a5('0x17')](_0x47a5('0x12'),_0x5e31dd,_0x2763d6);_0x1f47f4(_0x2763d6);});});}function respondWithStatusCode(_0x4a9fcb,_0x1570bc){_0x1570bc=_0x1570bc||0xcc;return function(_0xf160ba){if(_0xf160ba){return _0x4a9fcb['sendStatus'](_0x1570bc);}return _0x4a9fcb[_0x47a5('0x1c')](_0x1570bc)[_0x47a5('0x1d')]();};}function respondWithResult(_0x36874d,_0x4c5910){_0x4c5910=_0x4c5910||0xc8;return function(_0xb8ae6c){if(_0xb8ae6c){return _0x36874d[_0x47a5('0x1c')](_0x4c5910)[_0x47a5('0x1e')](_0xb8ae6c);}};}function respondWithFilteredResult(_0x7a9f9e,_0x5ef1b1){return function(_0xe2dea9){if(_0xe2dea9){var _0x385687=typeof _0x5ef1b1['offset']===_0x47a5('0x1f')&&typeof _0x5ef1b1[_0x47a5('0x20')]===_0x47a5('0x1f');var _0x129ce5=_0xe2dea9[_0x47a5('0x21')];var _0x50bf17=_0x385687?0x0:_0x5ef1b1['offset'];var _0x136745=_0x385687?_0xe2dea9['count']:_0x5ef1b1[_0x47a5('0x22')]+_0x5ef1b1['limit'];var _0x23cb77;if(_0x136745>=_0x129ce5){_0x136745=_0x129ce5;_0x23cb77=0xc8;}else{_0x23cb77=0xce;}_0x7a9f9e[_0x47a5('0x1c')](_0x23cb77);return _0x7a9f9e[_0x47a5('0x23')](_0x47a5('0x24'),_0x50bf17+'-'+_0x136745+'/'+_0x129ce5)[_0x47a5('0x1e')](_0xe2dea9);}return null;};}function saveUpdates(_0x3ba0b7){return function(_0x24b162){if(_0x24b162){return _0x24b162[_0x47a5('0x25')](_0x3ba0b7)[_0x47a5('0x10')](function(_0x361bfa){return _0x361bfa;});}return null;};}function removeEntity(_0x1127f8){return function(_0x11a4fa){if(_0x11a4fa){return _0x11a4fa[_0x47a5('0x26')]()['then'](function(){var _0x243210=_0x11a4fa['get']({'plain':!![]});var _0x2ef875=_0x47a5('0x27');return db[_0x47a5('0x28')]['destroy']({'where':{'type':_0x2ef875,'resourceId':_0x243210['id']}})[_0x47a5('0x10')](function(){return _0x11a4fa;});})[_0x47a5('0x10')](function(){_0x1127f8[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1d')]();});}};}function handleEntityNotFound(_0x51cc81){return function(_0x50d875){if(!_0x50d875){_0x51cc81[_0x47a5('0x29')](0x194);}return _0x50d875;};}function handleError(_0xfb5ddb,_0x5bd7eb){_0x5bd7eb=_0x5bd7eb||0x1f4;return function(_0x4e1006){logger[_0x47a5('0x17')](_0x4e1006[_0x47a5('0x2a')]);if(_0x4e1006['name']){delete _0x4e1006[_0x47a5('0x2b')];}_0xfb5ddb['status'](_0x5bd7eb)[_0x47a5('0x2c')](_0x4e1006);};}exports[_0x47a5('0x2d')]=function(_0x5c5162,_0x4843c0){var _0x274e34={'include':[{'model':db[_0x47a5('0x2e')],'as':_0x47a5('0x2f')},{'model':db['MailServerOut'],'as':_0x47a5('0x30')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x5910bb={},_0x403028={'count':0x0,'rows':[]};var _0x65542e=_['map'](db[_0x47a5('0x31')]['rawAttributes'],function(_0x21ad34){return{'name':_0x21ad34[_0x47a5('0x32')],'type':_0x21ad34[_0x47a5('0x33')][_0x47a5('0x34')]};});_0x5910bb[_0x47a5('0x35')]=_[_0x47a5('0x36')](_0x65542e,_0x47a5('0x2b'));_0x5910bb[_0x47a5('0x37')]=_[_0x47a5('0x38')](_0x5c5162['query']);_0x5910bb[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x5910bb['model'],_0x5910bb[_0x47a5('0x37')]);_0x274e34[_0x47a5('0x3b')]=_[_0x47a5('0x3a')](_0x5910bb['model'],qs[_0x47a5('0x3c')](_0x5c5162[_0x47a5('0x37')]['fields']));_0x274e34[_0x47a5('0x3b')]=_0x274e34[_0x47a5('0x3b')]['length']?_0x274e34['attributes']:_0x5910bb['model'];if(!_0x5c5162[_0x47a5('0x37')]['hasOwnProperty'](_0x47a5('0x3d'))){_0x274e34[_0x47a5('0x20')]=qs[_0x47a5('0x20')](_0x5c5162[_0x47a5('0x37')][_0x47a5('0x20')]);_0x274e34[_0x47a5('0x22')]=qs[_0x47a5('0x22')](_0x5c5162[_0x47a5('0x37')][_0x47a5('0x22')]);}_0x274e34[_0x47a5('0x3e')]=qs[_0x47a5('0x3f')](_0x5c5162[_0x47a5('0x37')][_0x47a5('0x3f')]);_0x274e34['where']=qs[_0x47a5('0x39')](_[_0x47a5('0x40')](_0x5c5162[_0x47a5('0x37')],_0x5910bb[_0x47a5('0x39')]),_0x65542e);if(_0x5c5162['query'][_0x47a5('0x41')]){_0x274e34['where']=_['merge'](_0x274e34['where'],{'$or':_['map'](_0x65542e,function(_0x27dd5d){if(_0x27dd5d['type']!==_0x47a5('0x42')){var _0x3a740b={};_0x3a740b[_0x27dd5d[_0x47a5('0x2b')]]={'$like':'%'+_0x5c5162['query'][_0x47a5('0x41')]+'%'};return _0x3a740b;}})});}_0x274e34=_[_0x47a5('0x43')]({},_0x274e34,_0x5c5162['options']);var _0x483650={'where':_0x274e34[_0x47a5('0x44')]};return db['MailAccount'][_0x47a5('0x21')](_0x483650)[_0x47a5('0x10')](function(_0x188614){_0x403028[_0x47a5('0x21')]=_0x188614;if(_0x5c5162[_0x47a5('0x37')][_0x47a5('0x45')]){_0x274e34[_0x47a5('0x46')]=[{'all':!![]}];}return db[_0x47a5('0x31')][_0x47a5('0x47')](_0x274e34);})[_0x47a5('0x10')](function(_0x24ecb1){_0x403028[_0x47a5('0x48')]=_0x24ecb1;return _0x403028;})[_0x47a5('0x10')](respondWithFilteredResult(_0x4843c0,_0x274e34))[_0x47a5('0x1b')](handleError(_0x4843c0,null));};exports[_0x47a5('0x49')]=function(_0x3a2b38,_0x512e65){var _0x2d38de={'raw':![],'where':{'id':_0x3a2b38['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x47a5('0x2f')},{'model':db['MailServerOut'],'as':_0x47a5('0x30')},{'model':db[_0x47a5('0x4a')],'as':'mandatoryDispositionPause'}]},_0x23bb04={};_0x23bb04['model']=_[_0x47a5('0x38')](db['MailAccount'][_0x47a5('0x4b')]);_0x23bb04[_0x47a5('0x37')]=_[_0x47a5('0x38')](_0x3a2b38[_0x47a5('0x37')]);_0x23bb04[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x23bb04[_0x47a5('0x35')],_0x23bb04['query']);_0x2d38de['attributes']=_[_0x47a5('0x3a')](_0x23bb04[_0x47a5('0x35')],qs[_0x47a5('0x3c')](_0x3a2b38[_0x47a5('0x37')][_0x47a5('0x3c')]));_0x2d38de[_0x47a5('0x3b')]=_0x2d38de[_0x47a5('0x3b')]['length']?_0x2d38de[_0x47a5('0x3b')]:_0x23bb04[_0x47a5('0x35')];if(_0x3a2b38[_0x47a5('0x37')]['includeAll']){_0x2d38de[_0x47a5('0x46')]=[{'all':!![]}];}_0x2d38de=_['merge']({},_0x2d38de,_0x3a2b38[_0x47a5('0x4c')]);return db[_0x47a5('0x31')][_0x47a5('0x4d')](_0x2d38de)[_0x47a5('0x10')](handleEntityNotFound(_0x512e65,null))['then'](respondWithResult(_0x512e65,null))[_0x47a5('0x1b')](handleError(_0x512e65,null));};exports[_0x47a5('0x25')]=function(_0x2f66e9,_0x3a2de4){if(_0x2f66e9[_0x47a5('0x4e')]['id']){delete _0x2f66e9[_0x47a5('0x4e')]['id'];}return db[_0x47a5('0x31')]['find']({'where':{'id':_0x2f66e9[_0x47a5('0x4f')]['id']},'include':[{'model':db[_0x47a5('0x2e')],'as':_0x47a5('0x2f')},{'model':db[_0x47a5('0x50')],'as':_0x47a5('0x30')},{'model':db[_0x47a5('0x4a')],'as':'mandatoryDispositionPause'}]})[_0x47a5('0x10')](handleEntityNotFound(_0x3a2de4,null))[_0x47a5('0x10')](saveUpdates(_0x2f66e9[_0x47a5('0x4e')],null))['then'](function(_0x4c5ed){if(_0x4c5ed&&_0x2f66e9[_0x47a5('0x4e')][_0x47a5('0x2f')]){return db['MailServerIn']['update'](_0x2f66e9[_0x47a5('0x4e')][_0x47a5('0x2f')],{'where':{'MailAccountId':_0x4c5ed['id']}})['then'](function(){return _0x4c5ed;});}return _0x4c5ed;})['then'](function(_0x6d6b2b){if(_0x6d6b2b&&_0x2f66e9['body'][_0x47a5('0x30')]){return db['MailServerOut']['update'](_0x2f66e9[_0x47a5('0x4e')][_0x47a5('0x30')],{'where':{'MailAccountId':_0x6d6b2b['id']}})['then'](function(){return _0x6d6b2b;});}return _0x6d6b2b;})[_0x47a5('0x10')](respondWithResult(_0x3a2de4,null))[_0x47a5('0x1b')](handleError(_0x3a2de4,null));};exports['describe']=function(_0x5b6127,_0x16b4fd){return db[_0x47a5('0x31')][_0x47a5('0x51')]()[_0x47a5('0x10')](respondWithResult(_0x16b4fd,null))['catch'](handleError(_0x16b4fd,null));};exports[_0x47a5('0x52')]=function(_0x2b4255,_0x1af800){if(_0x2b4255['body']['id']){delete _0x2b4255[_0x47a5('0x4e')]['id'];}return db['MailAccount'][_0x47a5('0x4d')]({'where':{'id':_0x2b4255[_0x47a5('0x4f')]['id']}})[_0x47a5('0x10')](handleEntityNotFound(_0x1af800,null))[_0x47a5('0x10')](function(_0x3603b7){if(_0x3603b7){_0x2b4255['body'][_0x47a5('0x53')]=_0x3603b7['id'];return db['Disposition']['create'](_0x2b4255['body']);}})['then'](respondWithResult(_0x1af800,null))[_0x47a5('0x1b')](handleError(_0x1af800,null));};exports[_0x47a5('0x54')]=function(_0x1e2bb4,_0x52e3ee){var _0x4d3db1={'raw':![],'where':{}};var _0x139229={};var _0x23020b={'count':0x0,'rows':[]};return db[_0x47a5('0x31')][_0x47a5('0x55')]({'where':{'id':_0x1e2bb4[_0x47a5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x52e3ee,null))[_0x47a5('0x10')](function(_0x519e9e){if(_0x519e9e){_0x139229[_0x47a5('0x35')]=_[_0x47a5('0x38')](db['Disposition'][_0x47a5('0x4b')]);_0x139229[_0x47a5('0x37')]=_[_0x47a5('0x38')](_0x1e2bb4[_0x47a5('0x37')]);_0x139229[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x139229[_0x47a5('0x35')],_0x139229[_0x47a5('0x37')]);_0x4d3db1['attributes']=_[_0x47a5('0x3a')](_0x139229[_0x47a5('0x35')],qs[_0x47a5('0x3c')](_0x1e2bb4[_0x47a5('0x37')][_0x47a5('0x3c')]));_0x4d3db1['attributes']=_0x4d3db1[_0x47a5('0x3b')][_0x47a5('0x56')]?_0x4d3db1[_0x47a5('0x3b')]:_0x139229[_0x47a5('0x35')];if(!_0x1e2bb4[_0x47a5('0x37')][_0x47a5('0x57')](_0x47a5('0x3d'))){_0x4d3db1[_0x47a5('0x20')]=qs[_0x47a5('0x20')](_0x1e2bb4[_0x47a5('0x37')][_0x47a5('0x20')]);_0x4d3db1[_0x47a5('0x22')]=qs[_0x47a5('0x22')](_0x1e2bb4[_0x47a5('0x37')][_0x47a5('0x22')]);}_0x4d3db1['order']=qs[_0x47a5('0x3f')](_0x1e2bb4[_0x47a5('0x37')][_0x47a5('0x3f')]);_0x4d3db1['where']=qs[_0x47a5('0x39')](_[_0x47a5('0x40')](_0x1e2bb4[_0x47a5('0x37')],_0x139229[_0x47a5('0x39')]));_0x4d3db1['where'][_0x47a5('0x53')]=_0x519e9e['id'];if(_0x1e2bb4['query'][_0x47a5('0x41')]){_0x4d3db1['where']=_[_0x47a5('0x43')](_0x4d3db1['where'],{'$or':_[_0x47a5('0x36')](_0x4d3db1[_0x47a5('0x3b')],function(_0x2578d6){var _0x58473b={};_0x58473b[_0x2578d6]={'$like':'%'+_0x1e2bb4['query']['filter']+'%'};return _0x58473b;})});}_0x4d3db1=_[_0x47a5('0x43')]({},_0x4d3db1,_0x1e2bb4[_0x47a5('0x4c')]);return db[_0x47a5('0x58')][_0x47a5('0x21')]({'where':_0x4d3db1['where']})[_0x47a5('0x10')](function(_0xc12a6a){_0x23020b[_0x47a5('0x21')]=_0xc12a6a;if(_0x1e2bb4[_0x47a5('0x37')][_0x47a5('0x45')]){_0x4d3db1[_0x47a5('0x46')]=[{'all':!![]}];}return db[_0x47a5('0x58')][_0x47a5('0x47')](_0x4d3db1);})[_0x47a5('0x10')](function(_0xc69a68){_0x23020b[_0x47a5('0x48')]=_0xc69a68;return _0x23020b;});}})[_0x47a5('0x10')](respondWithFilteredResult(_0x52e3ee,_0x4d3db1))['catch'](handleError(_0x52e3ee,null));};exports[_0x47a5('0x59')]=function(_0x4833be,_0x2ad00a){return db[_0x47a5('0x31')][_0x47a5('0x4d')]({'where':{'id':_0x4833be[_0x47a5('0x4f')]['id']}})[_0x47a5('0x10')](handleEntityNotFound(_0x2ad00a,null))[_0x47a5('0x10')](function(_0x12025a){if(_0x12025a){return _0x12025a[_0x47a5('0x59')](_0x4833be[_0x47a5('0x37')][_0x47a5('0x5a')]);}})[_0x47a5('0x10')](respondWithStatusCode(_0x2ad00a,null))[_0x47a5('0x1b')](handleError(_0x2ad00a,null));};exports[_0x47a5('0x5b')]=function(_0x2d434c,_0x441d64){if(_0x2d434c['body']['id']){delete _0x2d434c['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x2d434c[_0x47a5('0x4f')]['id']}})[_0x47a5('0x10')](handleEntityNotFound(_0x441d64,null))['then'](function(_0x732e00){if(_0x732e00){_0x2d434c[_0x47a5('0x4e')][_0x47a5('0x53')]=_0x732e00['id'];return db[_0x47a5('0x5c')][_0x47a5('0x5d')](_0x2d434c[_0x47a5('0x4e')]);}})[_0x47a5('0x10')](respondWithResult(_0x441d64,null))[_0x47a5('0x1b')](handleError(_0x441d64,null));};exports[_0x47a5('0x5e')]=function(_0x1ffe3c,_0x24a6c1){var _0x5e5f16={'raw':![],'where':{}};var _0x18fa31={};var _0x1fbd42={'count':0x0,'rows':[]};return db[_0x47a5('0x31')]['findOne']({'where':{'id':_0x1ffe3c[_0x47a5('0x4f')]['id']}})[_0x47a5('0x10')](handleEntityNotFound(_0x24a6c1,null))[_0x47a5('0x10')](function(_0x5d41d8){if(_0x5d41d8){_0x18fa31[_0x47a5('0x35')]=_['keys'](db['CannedAnswer'][_0x47a5('0x4b')]);_0x18fa31[_0x47a5('0x37')]=_[_0x47a5('0x38')](_0x1ffe3c[_0x47a5('0x37')]);_0x18fa31[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x18fa31['model'],_0x18fa31['query']);_0x5e5f16[_0x47a5('0x3b')]=_['intersection'](_0x18fa31[_0x47a5('0x35')],qs[_0x47a5('0x3c')](_0x1ffe3c[_0x47a5('0x37')][_0x47a5('0x3c')]));_0x5e5f16['attributes']=_0x5e5f16[_0x47a5('0x3b')]['length']?_0x5e5f16['attributes']:_0x18fa31[_0x47a5('0x35')];if(!_0x1ffe3c[_0x47a5('0x37')]['hasOwnProperty'](_0x47a5('0x3d'))){_0x5e5f16[_0x47a5('0x20')]=qs[_0x47a5('0x20')](_0x1ffe3c['query'][_0x47a5('0x20')]);_0x5e5f16['offset']=qs[_0x47a5('0x22')](_0x1ffe3c[_0x47a5('0x37')][_0x47a5('0x22')]);}_0x5e5f16['order']=qs[_0x47a5('0x3f')](_0x1ffe3c[_0x47a5('0x37')][_0x47a5('0x3f')]);_0x5e5f16['where']=qs[_0x47a5('0x39')](_['pick'](_0x1ffe3c[_0x47a5('0x37')],_0x18fa31['filters']));_0x5e5f16[_0x47a5('0x44')][_0x47a5('0x53')]=_0x5d41d8['id'];if(_0x1ffe3c[_0x47a5('0x37')][_0x47a5('0x41')]){_0x5e5f16['where']=_[_0x47a5('0x43')](_0x5e5f16[_0x47a5('0x44')],{'$or':_[_0x47a5('0x36')](_0x5e5f16[_0x47a5('0x3b')],function(_0x22d84a){var _0x57ac25={};_0x57ac25[_0x22d84a]={'$like':'%'+_0x1ffe3c['query'][_0x47a5('0x41')]+'%'};return _0x57ac25;})});}_0x5e5f16=_['merge']({},_0x5e5f16,_0x1ffe3c[_0x47a5('0x4c')]);return db[_0x47a5('0x5c')][_0x47a5('0x21')]({'where':_0x5e5f16['where']})[_0x47a5('0x10')](function(_0x18f833){_0x1fbd42['count']=_0x18f833;if(_0x1ffe3c[_0x47a5('0x37')][_0x47a5('0x45')]){_0x5e5f16[_0x47a5('0x46')]=[{'all':!![]}];}return db[_0x47a5('0x5c')]['findAll'](_0x5e5f16);})['then'](function(_0x132742){_0x1fbd42[_0x47a5('0x48')]=_0x132742;return _0x1fbd42;});}})['then'](respondWithFilteredResult(_0x24a6c1,_0x5e5f16))[_0x47a5('0x1b')](handleError(_0x24a6c1,null));};exports[_0x47a5('0x5f')]=function(_0x5a0901,_0x309a92){return db[_0x47a5('0x31')][_0x47a5('0x4d')]({'where':{'id':_0x5a0901['params']['id']}})[_0x47a5('0x10')](handleEntityNotFound(_0x309a92,null))['then'](function(_0x663778){if(_0x663778){return _0x663778['removeAnswers'](_0x5a0901[_0x47a5('0x37')][_0x47a5('0x5a')]);}})['then'](respondWithStatusCode(_0x309a92,null))[_0x47a5('0x1b')](handleError(_0x309a92,null));};exports['create']=function(_0x1eabef,_0x36f619){var _0x37e045={'name':_0x1eabef[_0x47a5('0x4e')]['name'],'key':_0x1eabef[_0x47a5('0x4e')]['key'],'provider':_0x1eabef['body'][_0x47a5('0x60')]===_0x47a5('0x61')?null:_0x1eabef[_0x47a5('0x4e')][_0x47a5('0x60')],'email':_0x1eabef[_0x47a5('0x4e')]['email'],'ListId':_0x1eabef[_0x47a5('0x4e')][_0x47a5('0x62')],'active':!_[_0x47a5('0x63')](_0x1eabef[_0x47a5('0x4e')]['active'])?_0x1eabef[_0x47a5('0x4e')]['active']:!![],'description':_0x1eabef[_0x47a5('0x4e')][_0x47a5('0x64')]||null,'Imap':{},'Smtp':{}};if(_0x37e045[_0x47a5('0x60')]){_0x37e045[_0x47a5('0x2f')][_0x47a5('0x65')]=_0x37e045[_0x47a5('0x30')][_0x47a5('0x65')]=_0x1eabef[_0x47a5('0x4e')][_0x47a5('0x66')];_0x37e045['Imap'][_0x47a5('0x67')]=_0x37e045[_0x47a5('0x30')]['pass']=_0x1eabef[_0x47a5('0x4e')][_0x47a5('0x67')];if(_0x1eabef[_0x47a5('0x4e')]['modernAuthentication']){_0x37e045['Imap'][_0x47a5('0x68')]=_0x37e045[_0x47a5('0x30')]['modernAuthentication']=!![];_0x37e045['Imap'][_0x47a5('0x69')]=_0x37e045[_0x47a5('0x30')]['CloudProviderId']=_0x1eabef[_0x47a5('0x4e')][_0x47a5('0x69')];_0x37e045['Imap'][_0x47a5('0x65')]=_0x37e045[_0x47a5('0x30')][_0x47a5('0x65')]=_0x1eabef[_0x47a5('0x4e')][_0x47a5('0x66')];}_0x37e045[_0x47a5('0x2f')]['service']=_0x37e045['Smtp']['service']=null;_0x37e045[_0x47a5('0x2f')][_0x47a5('0x6a')]=_0x37e045['Smtp'][_0x47a5('0x6a')]=null;_0x37e045[_0x47a5('0x2f')][_0x47a5('0x6b')]=_0x37e045[_0x47a5('0x30')][_0x47a5('0x6b')]=null;}else{if(_0x1eabef['body'][_0x47a5('0x6c')]){_0x37e045['Imap']['user']=_0x37e045['Smtp'][_0x47a5('0x65')]=_0x1eabef['body'][_0x47a5('0x66')];_0x37e045[_0x47a5('0x2f')][_0x47a5('0x67')]=_0x37e045['Smtp'][_0x47a5('0x6d')]=_0x1eabef[_0x47a5('0x4e')][_0x47a5('0x67')];}else{_0x37e045[_0x47a5('0x2f')][_0x47a5('0x6c')]=_0x37e045['Smtp'][_0x47a5('0x6c')]=![];}_0x37e045[_0x47a5('0x2f')]['host']=_0x1eabef[_0x47a5('0x4e')][_0x47a5('0x2f')][_0x47a5('0x6a')];_0x37e045[_0x47a5('0x2f')][_0x47a5('0x6b')]=_0x1eabef[_0x47a5('0x4e')]['Imap'][_0x47a5('0x6b')];_0x37e045[_0x47a5('0x30')]['host']=_0x1eabef[_0x47a5('0x4e')][_0x47a5('0x30')][_0x47a5('0x6a')];_0x37e045[_0x47a5('0x30')]['port']=_0x1eabef['body']['Smtp']['port'];}return db[_0x47a5('0x31')][_0x47a5('0x5d')](_0x37e045,{'include':[{'model':db[_0x47a5('0x50')],'as':_0x47a5('0x30')},{'model':db[_0x47a5('0x2e')],'as':_0x47a5('0x2f')}]})[_0x47a5('0x10')](function(_0x372917){var _0x4bd164=_0x1eabef[_0x47a5('0x65')][_0x47a5('0x6e')]({'plain':!![]});if(!_0x4bd164)throw new Error(_0x47a5('0x6f'));if(_0x4bd164[_0x47a5('0x70')]==='user'){var _0x5ef411=_0x372917[_0x47a5('0x6e')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x47a5('0x27'),'userProfileId':_0x4bd164[_0x47a5('0x71')]},'raw':!![]})['then'](function(_0x148742){if(_0x148742&&_0x148742[_0x47a5('0x72')]===0x0){return db[_0x47a5('0x28')]['create']({'name':_0x5ef411[_0x47a5('0x2b')],'resourceId':_0x5ef411['id'],'type':_0x148742[_0x47a5('0x2b')],'sectionId':_0x148742['id']},{})['then'](function(){return _0x372917;});}else{return _0x372917;}})[_0x47a5('0x1b')](function(_0x280b7b){logger[_0x47a5('0x17')](_0x47a5('0x73'),_0x280b7b);throw _0x280b7b;});}return _0x372917;})[_0x47a5('0x10')](respondWithResult(_0x36f619,0xc9))[_0x47a5('0x1b')](handleError(_0x36f619,null));};exports['getImap']=function(_0x3fee67,_0x54a55e){return db[_0x47a5('0x31')][_0x47a5('0x55')]({'where':{'id':_0x3fee67[_0x47a5('0x4f')]['id']}})[_0x47a5('0x10')](handleEntityNotFound(_0x54a55e,null))['then'](function(_0x3d93ad){if(_0x3d93ad){return _0x3d93ad[_0x47a5('0x74')]();}return null;})[_0x47a5('0x10')](respondWithResult(_0x54a55e,null))[_0x47a5('0x1b')](handleError(_0x54a55e,null));};exports[_0x47a5('0x75')]=function(_0x30df79,_0x31b8b1){if(_0x30df79[_0x47a5('0x4e')]['id']){delete _0x30df79[_0x47a5('0x4e')]['id'];}return db[_0x47a5('0x31')][_0x47a5('0x4d')]({'where':{'id':_0x30df79[_0x47a5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x31b8b1,null))[_0x47a5('0x10')](function(_0x3ec683){if(_0x3ec683){_0x30df79['body'][_0x47a5('0x53')]=_0x3ec683['id'];return db[_0x47a5('0x2e')][_0x47a5('0x5d')](_0x30df79[_0x47a5('0x4e')]);}})[_0x47a5('0x10')](respondWithResult(_0x31b8b1,null))['catch'](handleError(_0x31b8b1,null));};exports[_0x47a5('0x76')]=function(_0x3e7bcf,_0x285e7b){return db[_0x47a5('0x31')][_0x47a5('0x55')]({'where':{'id':_0x3e7bcf[_0x47a5('0x4f')]['id']}})[_0x47a5('0x10')](handleEntityNotFound(_0x285e7b,null))['then'](function(_0x596562){if(_0x596562){return _0x596562[_0x47a5('0x77')](null);}return null;})['then'](respondWithStatusCode(_0x285e7b,null))[_0x47a5('0x1b')](handleError(_0x285e7b,null));};exports['getSmtp']=function(_0x12572f,_0x8b4354){return db[_0x47a5('0x31')][_0x47a5('0x55')]({'where':{'id':_0x12572f['params']['id']}})[_0x47a5('0x10')](handleEntityNotFound(_0x8b4354,null))[_0x47a5('0x10')](function(_0xaca12c){if(_0xaca12c){return _0xaca12c['getSmtp']();}return null;})['then'](respondWithResult(_0x8b4354,null))[_0x47a5('0x1b')](handleError(_0x8b4354,null));};exports[_0x47a5('0x78')]=function(_0x987752,_0xfccf9c){if(_0x987752[_0x47a5('0x4e')]['id']){delete _0x987752[_0x47a5('0x4e')]['id'];}return db[_0x47a5('0x31')][_0x47a5('0x4d')]({'where':{'id':_0x987752['params']['id']}})[_0x47a5('0x10')](handleEntityNotFound(_0xfccf9c,null))['then'](function(_0x346322){if(_0x346322){_0x987752[_0x47a5('0x4e')]['MailAccountId']=_0x346322['id'];return db['MailServerOut'][_0x47a5('0x5d')](_0x987752[_0x47a5('0x4e')]);}})['then'](respondWithResult(_0xfccf9c,null))[_0x47a5('0x1b')](handleError(_0xfccf9c,null));};exports[_0x47a5('0x79')]=function(_0x29e3ee,_0x44567e){return db['MailAccount'][_0x47a5('0x55')]({'where':{'id':_0x29e3ee['params']['id']}})['then'](handleEntityNotFound(_0x44567e,null))['then'](function(_0x1e0171){if(_0x1e0171){return _0x1e0171['setSmtp'](null);}return null;})[_0x47a5('0x10')](respondWithStatusCode(_0x44567e,null))[_0x47a5('0x1b')](handleError(_0x44567e,null));};exports[_0x47a5('0x7a')]=function(_0x2005d5,_0x267d40){return db[_0x47a5('0x7b')][_0x47a5('0x4d')]({'where':{'id':_0x2005d5[_0x47a5('0x4f')]['id']}})[_0x47a5('0x10')](handleEntityNotFound(_0x267d40,null))[_0x47a5('0x10')](function(_0x42b7ef){if(_0x42b7ef){return _0x42b7ef[_0x47a5('0x7a')](_0x2005d5[_0x47a5('0x4e')][_0x47a5('0x5a')],_[_0x47a5('0x7c')](_0x2005d5['body'],[_0x47a5('0x5a'),'id'])||{});}})[_0x47a5('0x10')](respondWithResult(_0x267d40,null))[_0x47a5('0x1b')](handleError(_0x267d40,null));};exports[_0x47a5('0x7d')]=function(_0x515580,_0x367662){var _0x49998b={'raw':![],'where':{}};var _0x4476b5={};var _0x513543={'count':0x0,'rows':[]};return db[_0x47a5('0x31')][_0x47a5('0x55')]({'where':{'id':_0x515580[_0x47a5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x367662,null))[_0x47a5('0x10')](function(_0x217e04){if(_0x217e04){_0x4476b5[_0x47a5('0x35')]=_['keys'](db['MailInteraction'][_0x47a5('0x4b')]);_0x4476b5[_0x47a5('0x37')]=_[_0x47a5('0x38')](_0x515580[_0x47a5('0x37')]);_0x4476b5[_0x47a5('0x39')]=_['intersection'](_0x4476b5[_0x47a5('0x35')],_0x4476b5['query']);_0x49998b[_0x47a5('0x3b')]=_[_0x47a5('0x3a')](_0x4476b5[_0x47a5('0x35')],qs[_0x47a5('0x3c')](_0x515580['query']['fields']));_0x49998b[_0x47a5('0x3b')]=_0x49998b[_0x47a5('0x3b')][_0x47a5('0x56')]?_0x49998b[_0x47a5('0x3b')]:_0x4476b5[_0x47a5('0x35')];if(!_0x515580[_0x47a5('0x37')][_0x47a5('0x57')](_0x47a5('0x3d'))){_0x49998b[_0x47a5('0x20')]=qs['limit'](_0x515580['query'][_0x47a5('0x20')]);_0x49998b['offset']=qs[_0x47a5('0x22')](_0x515580[_0x47a5('0x37')][_0x47a5('0x22')]);}_0x49998b['order']=qs[_0x47a5('0x3f')](_0x515580[_0x47a5('0x37')]['sort']);_0x49998b[_0x47a5('0x44')]=qs['filters'](_[_0x47a5('0x40')](_0x515580[_0x47a5('0x37')],_0x4476b5[_0x47a5('0x39')]));_0x49998b['where']['MailAccountId']=_0x217e04['id'];if(_0x515580['query']['filter']){_0x49998b['where']=_[_0x47a5('0x43')](_0x49998b['where'],{'$or':_[_0x47a5('0x36')](_0x49998b[_0x47a5('0x3b')],function(_0x530e98){var _0x49da2a={};_0x49da2a[_0x530e98]={'$like':'%'+_0x515580['query'][_0x47a5('0x41')]+'%'};return _0x49da2a;})});}_0x49998b=_['merge']({},_0x49998b,_0x515580['options']);return db['MailInteraction'][_0x47a5('0x21')]({'where':_0x49998b[_0x47a5('0x44')]})[_0x47a5('0x10')](function(_0xdb9128){_0x513543['count']=_0xdb9128;if(_0x515580[_0x47a5('0x37')]['includeAll']){_0x49998b[_0x47a5('0x46')]=[{'model':db['CmContact'],'as':_0x47a5('0x7e'),'required':![]},{'model':db[_0x47a5('0x7f')],'as':_0x47a5('0x80'),'attributes':['name',_0x47a5('0x81'),_0x47a5('0x82')],'required':![]},{'model':db[_0x47a5('0x83')],'as':_0x47a5('0x84'),'attributes':['id','name',_0x47a5('0x85')],'where':_0x515580[_0x47a5('0x37')][_0x47a5('0x86')]?{'id':_0x515580[_0x47a5('0x37')][_0x47a5('0x86')]}:undefined,'required':_0x515580[_0x47a5('0x37')]['tag']?!![]:![]}];}return db[_0x47a5('0x7b')][_0x47a5('0x47')](_0x49998b);})[_0x47a5('0x10')](function(_0xac8d4f){_0x513543[_0x47a5('0x48')]=_0xac8d4f;return _0x513543;});}})[_0x47a5('0x10')](respondWithFilteredResult(_0x367662,_0x49998b))[_0x47a5('0x1b')](handleError(_0x367662,null));};exports[_0x47a5('0x87')]=function addApplications(_0x408887,_0x34fde3){var _0x406875=_0x408887[_0x47a5('0x4f')]['id'];var _0x40dab1=_0x408887[_0x47a5('0x4e')];var _0x29b926=0xc8;var _0x3b4b08=null;return db[_0x47a5('0x88')]['transaction']({'isolationLevel':db[_0x47a5('0x88')]['Transaction']['ISOLATION_LEVELS'][_0x47a5('0x89')]},function(_0x154365){return db[_0x47a5('0x31')]['findOne']({'where':{'id':_0x406875},'transaction':_0x154365})[_0x47a5('0x10')](function(_0xd8381b){if(_0xd8381b){return db[_0x47a5('0x8a')][_0x47a5('0x26')]({'where':{'MailAccountId':_0x406875},'transaction':_0x154365})[_0x47a5('0x10')](function(){var _0x28ba38=_[_0x47a5('0x36')](_0x40dab1,function(_0x46cb3a){_0x46cb3a[_0x47a5('0x53')]=_0x406875;return _0x46cb3a;});return db[_0x47a5('0x8a')][_0x47a5('0x8b')](_0x28ba38,{'transaction':_0x154365});});}else{_0x29b926=0x194;_0x3b4b08=[];}});})[_0x47a5('0x10')](function(){if(_0x29b926!==0x194){return db[_0x47a5('0x8a')]['findAndCountAll']({'where':{'MailAccountId':_0x406875},'order':'priority'})[_0x47a5('0x10')](function(_0x5e7d56){_0x3b4b08=_0x5e7d56;});}})[_0x47a5('0x1b')](function(_0x36227f){_0x29b926=0x1f4;logger[_0x47a5('0x17')](_0x36227f[_0x47a5('0x2a')]);if(_0x36227f[_0x47a5('0x2b')]){delete _0x36227f[_0x47a5('0x2b')];}_0x3b4b08=_0x36227f;})['finally'](function(){if(_0x3b4b08===null){_0x34fde3[_0x47a5('0x29')](_0x29b926);}else{if(_0x29b926===0x1f4){_0x34fde3[_0x47a5('0x1c')](_0x29b926)[_0x47a5('0x2c')](_0x3b4b08);}else{_0x34fde3['status'](_0x29b926)[_0x47a5('0x1e')](_0x3b4b08);}}});};exports[_0x47a5('0x8c')]=function(_0x3ecc41,_0x3e4148){var _0x4c46ea={};var _0x23e649={};var _0x35e20f;var _0x46615a;return db[_0x47a5('0x31')][_0x47a5('0x55')]({'where':{'id':_0x3ecc41[_0x47a5('0x4f')]['id']}})[_0x47a5('0x10')](handleEntityNotFound(_0x3e4148,null))[_0x47a5('0x10')](function(_0x2ac386){if(_0x2ac386){_0x35e20f=_0x2ac386;_0x23e649[_0x47a5('0x35')]=_[_0x47a5('0x38')](db[_0x47a5('0x8a')][_0x47a5('0x4b')]);_0x23e649[_0x47a5('0x37')]=_[_0x47a5('0x38')](_0x3ecc41[_0x47a5('0x37')]);_0x23e649[_0x47a5('0x39')]=_['intersection'](_0x23e649[_0x47a5('0x35')],_0x23e649['query']);_0x4c46ea[_0x47a5('0x3b')]=_[_0x47a5('0x3a')](_0x23e649[_0x47a5('0x35')],qs[_0x47a5('0x3c')](_0x3ecc41[_0x47a5('0x37')][_0x47a5('0x3c')]));_0x4c46ea[_0x47a5('0x3b')]=_0x4c46ea[_0x47a5('0x3b')]['length']?_0x4c46ea[_0x47a5('0x3b')]:_0x23e649[_0x47a5('0x35')];_0x4c46ea[_0x47a5('0x3e')]=qs['sort'](_0x3ecc41[_0x47a5('0x37')][_0x47a5('0x3f')]);_0x4c46ea[_0x47a5('0x44')]=qs[_0x47a5('0x39')](_['pick'](_0x3ecc41[_0x47a5('0x37')],_0x23e649[_0x47a5('0x39')]));if(_0x3ecc41[_0x47a5('0x37')][_0x47a5('0x41')]){_0x4c46ea['where']=_[_0x47a5('0x43')](_0x4c46ea['where'],{'$or':_['map'](_0x4c46ea[_0x47a5('0x3b')],function(_0x1efae8){var _0x407fd2={};_0x407fd2[_0x1efae8]={'$like':'%'+_0x3ecc41[_0x47a5('0x37')]['filter']+'%'};return _0x407fd2;})});}_0x4c46ea=_[_0x47a5('0x43')]({},_0x4c46ea,_0x3ecc41[_0x47a5('0x4c')]);return _0x35e20f[_0x47a5('0x8c')](_0x4c46ea);}})[_0x47a5('0x10')](function(_0xf470f5){if(_0xf470f5){_0x46615a=_0xf470f5[_0x47a5('0x56')];if(!_0x3ecc41['query'][_0x47a5('0x57')](_0x47a5('0x3d'))){_0x4c46ea[_0x47a5('0x20')]=qs[_0x47a5('0x20')](_0x3ecc41[_0x47a5('0x37')]['limit']);_0x4c46ea[_0x47a5('0x22')]=qs['offset'](_0x3ecc41[_0x47a5('0x37')]['offset']);}return _0x35e20f[_0x47a5('0x8c')](_0x4c46ea);}})['then'](function(_0x56a3c4){if(_0x56a3c4){return _0x56a3c4?{'count':_0x46615a,'rows':_0x56a3c4}:null;}})[_0x47a5('0x10')](respondWithResult(_0x3e4148,null))[_0x47a5('0x1b')](handleError(_0x3e4148,null));};exports['getMessages']=function(_0xa07bc6,_0x2d7e13){var _0x530542={'raw':!![],'where':{}};var _0x3a09e6={};var _0x112e1e={'count':0x0,'rows':[]};return db[_0x47a5('0x31')]['findOne']({'where':{'id':_0xa07bc6[_0x47a5('0x4f')]['id']}})[_0x47a5('0x10')](handleEntityNotFound(_0x2d7e13,null))[_0x47a5('0x10')](function(_0x30b0f9){if(_0x30b0f9){_0x3a09e6[_0x47a5('0x35')]=_['keys'](db['MailMessage'][_0x47a5('0x4b')]);_0x3a09e6['query']=_[_0x47a5('0x38')](_0xa07bc6[_0x47a5('0x37')]);_0x3a09e6['filters']=_['intersection'](_0x3a09e6[_0x47a5('0x35')],_0x3a09e6['query']);_0x530542[_0x47a5('0x3b')]=_[_0x47a5('0x3a')](_0x3a09e6[_0x47a5('0x35')],qs[_0x47a5('0x3c')](_0xa07bc6[_0x47a5('0x37')][_0x47a5('0x3c')]));_0x530542[_0x47a5('0x3b')]=_0x530542['attributes'][_0x47a5('0x56')]?_0x530542['attributes']:_0x3a09e6[_0x47a5('0x35')];if(!_0xa07bc6[_0x47a5('0x37')][_0x47a5('0x57')](_0x47a5('0x3d'))){_0x530542[_0x47a5('0x20')]=qs[_0x47a5('0x20')](_0xa07bc6[_0x47a5('0x37')][_0x47a5('0x20')]);_0x530542[_0x47a5('0x22')]=qs[_0x47a5('0x22')](_0xa07bc6[_0x47a5('0x37')][_0x47a5('0x22')]);}_0x530542['order']=qs[_0x47a5('0x3f')](_0xa07bc6[_0x47a5('0x37')][_0x47a5('0x3f')]);_0x530542['where']=qs[_0x47a5('0x39')](_[_0x47a5('0x40')](_0xa07bc6[_0x47a5('0x37')],_0x3a09e6[_0x47a5('0x39')]));_0x530542[_0x47a5('0x44')][_0x47a5('0x53')]=_0x30b0f9['id'];if(_0xa07bc6['query'][_0x47a5('0x41')]){_0x530542[_0x47a5('0x44')]=_[_0x47a5('0x43')](_0x530542[_0x47a5('0x44')],{'$or':_[_0x47a5('0x36')](_0x530542[_0x47a5('0x3b')],function(_0x42a384){var _0x188bdf={};_0x188bdf[_0x42a384]={'$like':'%'+_0xa07bc6[_0x47a5('0x37')][_0x47a5('0x41')]+'%'};return _0x188bdf;})});}if(_0xa07bc6['query']['$gte']){var _0x2d4fd0=_0xa07bc6[_0x47a5('0x37')][_0x47a5('0x8d')]['split'](',');var _0xebaa86={};_0xebaa86[_0x2d4fd0[0x0]]={'$gte':moment(_0x2d4fd0[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x530542[_0x47a5('0x44')]=_[_0x47a5('0x43')](_0x530542[_0x47a5('0x44')],_0xebaa86);}_0x530542=_[_0x47a5('0x43')]({},_0x530542,_0xa07bc6['options']);return db[_0x47a5('0x8e')][_0x47a5('0x21')]({'where':_0x530542['where']})['then'](function(_0x50a2e4){_0x112e1e[_0x47a5('0x21')]=_0x50a2e4;if(_0xa07bc6[_0x47a5('0x37')][_0x47a5('0x45')]){_0x530542[_0x47a5('0x46')]=[{'all':!![]}];}return db[_0x47a5('0x8e')]['findAll'](_0x530542);})['then'](function(_0x362e82){if(_0xa07bc6[_0x47a5('0x37')][_0x47a5('0x8f')]===_0x47a5('0x90')){for(var _0x4d26f4=0x0;_0x4d26f4<_0x362e82[_0x47a5('0x56')];_0x4d26f4++){_0x362e82[_0x4d26f4][_0x47a5('0x4e')]=juice(_0x362e82[_0x4d26f4][_0x47a5('0x4e')]);}}_0x112e1e[_0x47a5('0x48')]=_0x362e82;return _0x112e1e;});}})['then'](respondWithFilteredResult(_0x2d7e13,_0x530542))['catch'](handleError(_0x2d7e13,null));};exports['send']=function(_0x74893a,_0x15ddfc){var _0x156ceb,_0x3c6142={},_0x242006;if(_0x74893a[_0x47a5('0x4e')]['to']){_0x242006=_0x74893a[_0x47a5('0x4e')]['to'][_0x47a5('0x91')](',')[0x0];}return db[_0x47a5('0x31')]['find']({'where':{'id':_0x74893a[_0x47a5('0x4f')]['id']},'include':[{'model':db[_0x47a5('0x92')],'as':'List','include':[{'model':db[_0x47a5('0x93')],'as':_0x47a5('0x94'),'where':{'email':_0x242006},'limit':0x1,'order':[[_0x47a5('0x95'),_0x47a5('0x96')]]}]},{'model':db['MailServerOut'],'as':_0x47a5('0x30'),'raw':!![]}]})[_0x47a5('0x10')](handleEntityNotFound(_0x15ddfc,null))[_0x47a5('0x10')](function(_0x51e2c0){if(_0x51e2c0){_0x156ceb=_0x51e2c0;if(_0x51e2c0['Smtp']){if(_[_0x47a5('0x63')](_0x74893a['body'][_0x47a5('0x97')])){_0x74893a['body'][_0x47a5('0x97')]=util[_0x47a5('0x98')](_0x47a5('0x99'),_0x51e2c0[_0x47a5('0x2b')],_0x51e2c0[_0x47a5('0x9a')]||_0x51e2c0['Smtp']['user']);}if(_0x74893a[_0x47a5('0x4e')][_0x47a5('0x9b')]&&_0x74893a[_0x47a5('0x4e')][_0x47a5('0x9b')]['length']){for(var _0x51f746=0x0;_0x51f746<_0x74893a[_0x47a5('0x4e')]['attachments'][_0x47a5('0x56')];_0x51f746+=0x1){_0x74893a['body'][_0x47a5('0x9b')][_0x51f746]={'filename':_0x74893a['body'][_0x47a5('0x9b')][_0x51f746][_0x47a5('0x2b')],'path':path[_0x47a5('0x9c')](config[_0x47a5('0x9d')],_0x47a5('0x9e'),_0x74893a[_0x47a5('0x4e')][_0x47a5('0x9b')][_0x51f746][_0x47a5('0x9f')])};}}var _0x51fc56={'tls':{'rejectUnauthorized':![]}};if(_[_0x47a5('0x63')](_0x51e2c0[_0x47a5('0x30')]['service'])){if(_0x51e2c0[_0x47a5('0x30')][_0x47a5('0x6c')]){_0x51fc56['auth']={'user':_0x51e2c0['Smtp'][_0x47a5('0x65')],'pass':_0x51e2c0['Smtp'][_0x47a5('0x6d')]};}_0x51fc56[_0x47a5('0x6a')]=_0x51e2c0[_0x47a5('0x30')]['host'];_0x51fc56[_0x47a5('0x6b')]=_0x51e2c0[_0x47a5('0x30')][_0x47a5('0x6b')];_0x51fc56[_0x47a5('0xa0')]=_0x51e2c0[_0x47a5('0x30')][_0x47a5('0xa0')];}else{_0x51fc56[_0x47a5('0xa1')]=_0x51e2c0['Smtp'][_0x47a5('0xa1')];_0x51fc56[_0x47a5('0xa2')]={'user':_0x51e2c0[_0x47a5('0x30')][_0x47a5('0x65')],'pass':_0x51e2c0[_0x47a5('0x30')][_0x47a5('0x6d')]};}return respondWithRpcPromise(_0x47a5('0xa3'),'sendMail',{'account':_0x51fc56,'message':_0x74893a['body']});}else{throw new Error(_0x47a5('0xa4'));}}})[_0x47a5('0x10')](function(_0x2d0c51){if(_0x2d0c51){_0x3c6142=_0x2d0c51;if(_0x156ceb['List']){if(_0x156ceb['List'][_0x47a5('0x94')][_0x47a5('0x56')]){return _0x156ceb[_0x47a5('0xa5')][_0x47a5('0x94')][0x0];}else{return db[_0x47a5('0x93')][_0x47a5('0x5d')](_[_0x47a5('0xa')](_0x74893a['body'],{'firstName':_0x74893a[_0x47a5('0x4e')]['to'],'email':_0x74893a[_0x47a5('0x4e')]['to'],'phone':_0x74893a[_0x47a5('0x4e')]['to'],'ListId':_0x156ceb['ListId']}));}}else{throw new Error(_0x47a5('0xa4'));}}})[_0x47a5('0x10')](function(_0x144bc9){if(_0x144bc9){var _0x278b42={'UserId':_0x74893a[_0x47a5('0x65')]['id'],'ContactId':_0x144bc9['id'],'MailAccountId':_0x156ceb['id'],'inReplyTo':_0x3c6142[_0x47a5('0xa6')],'to':_0x74893a[_0x47a5('0x4e')][_0x47a5('0x97')],'cc':_0x74893a[_0x47a5('0x4e')]['cc'],'subject':_0x74893a[_0x47a5('0x4e')][_0x47a5('0xa7')],'attach':_0x74893a[_0x47a5('0x4e')][_0x47a5('0xa8')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x47a5('0x98')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x47a5('0xa9'),'Messages':[_['merge'](_0x74893a[_0x47a5('0x4e')],{'messageId':_0x3c6142[_0x47a5('0xa6')],'sentAt':moment()[_0x47a5('0x98')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x156ceb['id'],'UserId':_0x74893a[_0x47a5('0x65')]['id'],'ContactId':_0x144bc9['id']})]};if(_0x74893a['body'][_0x47a5('0xaa')]){_0x278b42=_[_0x47a5('0x43')](_0x278b42,_0x74893a[_0x47a5('0x4e')][_0x47a5('0xaa')]);}return db['MailInteraction'][_0x47a5('0x5d')](_0x278b42,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});}})[_0x47a5('0x10')](respondWithResult(_0x15ddfc,null))[_0x47a5('0x1b')](handleError(_0x15ddfc,null));};exports[_0x47a5('0xab')]=function(_0x17b95a,_0x184a18){return db[_0x47a5('0x31')][_0x47a5('0x4d')]({'where':{'id':_0x17b95a[_0x47a5('0x4f')]['id']},'include':[{'model':db[_0x47a5('0x50')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x47a5('0xac'),'raw':!![]}]}]})[_0x47a5('0x10')](handleEntityNotFound(_0x184a18,null))[_0x47a5('0x10')](function(_0x349166){if(!_0x349166[_0x47a5('0x30')])return;var _0x4da0df={'id':_0x349166['id'],'tls':{'rejectUnauthorized':![]}};if(_0x349166[_0x47a5('0x60')]!==_0x47a5('0x61')){_0x4da0df[_0x47a5('0xa1')]=_0x349166['provider'];}else{_0x4da0df['host']=_0x349166[_0x47a5('0x30')][_0x47a5('0x6a')];_0x4da0df['port']=_0x349166[_0x47a5('0x30')][_0x47a5('0x6b')];_0x4da0df[_0x47a5('0xa0')]=_0x349166['Smtp'][_0x47a5('0xa0')];}if(_0x349166[_0x47a5('0x30')][_0x47a5('0x6c')]){if(_0x349166[_0x47a5('0x30')][_0x47a5('0x68')]){_0x4da0df['auth']={'type':_0x47a5('0xad'),'user':_0x349166[_0x47a5('0x30')][_0x47a5('0x65')],'accessToken':_0x349166[_0x47a5('0x30')]['CloudProvider']['data5']};}else{_0x4da0df[_0x47a5('0xa2')]={'user':_0x349166['Smtp'][_0x47a5('0x65')],'pass':_0x349166[_0x47a5('0x30')][_0x47a5('0x6d')]};}}return respondWithRpcPromise(_0x47a5('0xae'),_0x47a5('0xab'),{'account':_0x4da0df});})[_0x47a5('0x10')](respondWithResult(_0x184a18,null))['catch'](handleError(_0x184a18,null));};exports[_0x47a5('0x26')]=function(_0x4035c6,_0x32143a){return db['MailAccount']['find']({'where':{'id':_0x4035c6[_0x47a5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x32143a,null))[_0x47a5('0x10')](function(_0x3f5c5a){if(_0x3f5c5a&&_0x3f5c5a[_0x47a5('0xa1')]){throw new db[(_0x47a5('0xaf'))][(_0x47a5('0xb0'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x3f5c5a;})['then'](removeEntity(_0x32143a,null))[_0x47a5('0x1b')](handleError(_0x32143a,null));};exports[_0x47a5('0xb1')]=function(_0x4022f7,_0x9fdee1){return db[_0x47a5('0x31')]['find']({'where':{'id':_0x4022f7[_0x47a5('0x4f')]['id']}})[_0x47a5('0x10')](handleEntityNotFound(_0x9fdee1,null))[_0x47a5('0x10')](function(_0x374cfc){if(_0x374cfc){return _0x374cfc[_0x47a5('0xb1')](_0x4022f7['body'][_0x47a5('0x5a')],_[_0x47a5('0x7c')](_0x4022f7[_0x47a5('0x4e')],[_0x47a5('0x5a'),'id'])||{})[_0x47a5('0xb2')](function(_0x3eec46){for(var _0x3e994b=0x0;_0x3e994b<_0x4022f7[_0x47a5('0x4e')][_0x47a5('0x5a')][_0x47a5('0x56')];_0x3e994b+=0x1){socket[_0x47a5('0xb3')]('userMailAccount:save',{'UserId':Number(_0x4022f7[_0x47a5('0x4e')][_0x47a5('0x5a')][_0x3e994b]),'MailAccountId':Number(_0x4022f7[_0x47a5('0x4f')]['id'])});}return _0x3eec46;});}})[_0x47a5('0x10')](respondWithResult(_0x9fdee1,null))['catch'](handleError(_0x9fdee1,null));};exports['removeAgents']=function(_0x543895,_0x269086){return db['MailAccount'][_0x47a5('0x4d')]({'where':{'id':_0x543895[_0x47a5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x269086,null))[_0x47a5('0x10')](function(_0x1d8538){if(_0x1d8538){return _0x1d8538[_0x47a5('0xb4')](_0x543895['query'][_0x47a5('0x5a')])['then'](function(){if(_[_0x47a5('0xb5')](_0x543895[_0x47a5('0x37')][_0x47a5('0x5a')])){for(var _0x3c4c48=0x0;_0x3c4c48<_0x543895[_0x47a5('0x37')][_0x47a5('0x5a')]['length'];_0x3c4c48+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x543895[_0x47a5('0x37')][_0x47a5('0x5a')][_0x3c4c48]),'MailAccountId':Number(_0x543895[_0x47a5('0x4f')]['id'])});}}else{socket[_0x47a5('0xb3')](_0x47a5('0xb6'),{'UserId':Number(_0x543895[_0x47a5('0x37')][_0x47a5('0x5a')]),'MailAccountId':Number(_0x543895[_0x47a5('0x4f')]['id'])});}});}})[_0x47a5('0x10')](respondWithStatusCode(_0x269086,null))[_0x47a5('0x1b')](handleError(_0x269086,null));};exports[_0x47a5('0xb7')]=function(_0x3917e0,_0x1c7695){var _0x22469b={};var _0x4363cf={};var _0x2efb19;var _0x4fa42e;return db[_0x47a5('0x31')][_0x47a5('0x55')]({'where':{'id':_0x3917e0[_0x47a5('0x4f')]['id']}})[_0x47a5('0x10')](handleEntityNotFound(_0x1c7695,null))[_0x47a5('0x10')](function(_0x46c862){if(_0x46c862){_0x2efb19=_0x46c862;_0x4363cf[_0x47a5('0x35')]=_[_0x47a5('0x38')](db['User'][_0x47a5('0x4b')]);_0x4363cf['query']=_[_0x47a5('0x38')](_0x3917e0[_0x47a5('0x37')]);_0x4363cf['filters']=_[_0x47a5('0x3a')](_0x4363cf['model'],_0x4363cf[_0x47a5('0x37')]);_0x22469b[_0x47a5('0x3b')]=_[_0x47a5('0x3a')](_0x4363cf[_0x47a5('0x35')],qs[_0x47a5('0x3c')](_0x3917e0['query'][_0x47a5('0x3c')]));_0x22469b[_0x47a5('0x3b')]=_0x22469b[_0x47a5('0x3b')]['length']?_0x22469b['attributes']:_0x4363cf[_0x47a5('0x35')];_0x22469b[_0x47a5('0x3e')]=qs[_0x47a5('0x3f')](_0x3917e0['query'][_0x47a5('0x3f')]);_0x22469b[_0x47a5('0x44')]=qs[_0x47a5('0x39')](_['pick'](_0x3917e0[_0x47a5('0x37')],_0x4363cf[_0x47a5('0x39')]));if(_0x3917e0[_0x47a5('0x37')][_0x47a5('0x41')]){_0x22469b['where']=_[_0x47a5('0x43')](_0x22469b['where'],{'$or':_[_0x47a5('0x36')](_0x22469b[_0x47a5('0x3b')],function(_0xdc5eac){var _0x32575c={};_0x32575c[_0xdc5eac]={'$like':'%'+_0x3917e0['query'][_0x47a5('0x41')]+'%'};return _0x32575c;})});}_0x22469b=_[_0x47a5('0x43')]({},_0x22469b,_0x3917e0[_0x47a5('0x4c')]);return _0x2efb19[_0x47a5('0xb7')](_0x22469b);}})[_0x47a5('0x10')](function(_0x4c2b0c){if(_0x4c2b0c){_0x4fa42e=_0x4c2b0c[_0x47a5('0x56')];if(!_0x3917e0[_0x47a5('0x37')][_0x47a5('0x57')](_0x47a5('0x3d'))){_0x22469b[_0x47a5('0x20')]=qs[_0x47a5('0x20')](_0x3917e0['query'][_0x47a5('0x20')]);_0x22469b[_0x47a5('0x22')]=qs['offset'](_0x3917e0['query'][_0x47a5('0x22')]);}return _0x2efb19[_0x47a5('0xb7')](_0x22469b);}})[_0x47a5('0x10')](function(_0x3964f8){if(_0x3964f8){return _0x3964f8?{'count':_0x4fa42e,'rows':_0x3964f8}:null;}})[_0x47a5('0x10')](respondWithResult(_0x1c7695,null))[_0x47a5('0x1b')](handleError(_0x1c7695,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 8875e92..0e1f5ed 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 _0x0967=['update','remove','emit','hasOwnProperty','hook','exports','events','MailAccount','setMaxListeners','save'];(function(_0x34e725,_0x5633f8){var _0x57acc4=function(_0x1715c5){while(--_0x1715c5){_0x34e725['push'](_0x34e725['shift']());}};_0x57acc4(++_0x5633f8);}(_0x0967,0x100));var _0x7096=function(_0xaad2d8,_0x105da8){_0xaad2d8=_0xaad2d8-0x0;var _0x24ef99=_0x0967[_0xaad2d8];return _0x24ef99;};'use strict';var EventEmitter=require(_0x7096('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x7096('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7096('0x2')](0x0);var events={'afterCreate':_0x7096('0x3'),'afterUpdate':_0x7096('0x4'),'afterDestroy':_0x7096('0x5')};function emitEvent(_0xe41170){return function(_0x4106a2,_0x2a50e2,_0x4eba77){MailAccountEvents[_0x7096('0x6')](_0xe41170+':'+_0x4106a2['id'],_0x4106a2);MailAccountEvents[_0x7096('0x6')](_0xe41170,_0x4106a2);_0x4eba77(null);};}for(var e in events){if(events[_0x7096('0x7')](e)){var event=events[e];MailAccount[_0x7096('0x8')](e,emitEvent(event));}}module[_0x7096('0x9')]=MailAccountEvents; \ No newline at end of file +var _0xf715=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x29e871,_0x330b98){var _0x3380e3=function(_0x26eeae){while(--_0x26eeae){_0x29e871['push'](_0x29e871['shift']());}};_0x3380e3(++_0x330b98);}(_0xf715,0x90));var _0x5f71=function(_0x556b2d,_0x53e713){_0x556b2d=_0x556b2d-0x0;var _0x8aa570=_0xf715[_0x556b2d];return _0x8aa570;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x5f71('0x0'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x5f71('0x1')](0x0);var events={'afterCreate':_0x5f71('0x2'),'afterUpdate':_0x5f71('0x3'),'afterDestroy':_0x5f71('0x4')};function emitEvent(_0x1c8cd2){return function(_0x2fce69,_0x56d0eb,_0x46e3b9){MailAccountEvents[_0x5f71('0x5')](_0x1c8cd2+':'+_0x2fce69['id'],_0x2fce69);MailAccountEvents[_0x5f71('0x5')](_0x1c8cd2,_0x2fce69);_0x46e3b9(null);};}for(var e in events){if(events[_0x5f71('0x6')](e)){var event=events[e];MailAccount[_0x5f71('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 3617352..4f150af 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 _0xad89=['rimraf','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','util','moment'];(function(_0x5247a6,_0xd616e){var _0x3ac4e3=function(_0x5b7204){while(--_0x5b7204){_0x5247a6['push'](_0x5247a6['shift']());}};_0x3ac4e3(++_0xd616e);}(_0xad89,0x15d));var _0x9ad8=function(_0x5c9865,_0x1a299a){_0x5c9865=_0x5c9865-0x0;var _0x54c22b=_0xad89[_0x5c9865];return _0x54c22b;};'use strict';var _=require('lodash');var util=require(_0x9ad8('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x9ad8('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9ad8('0x2'));var config=require(_0x9ad8('0x3'));var attributes=require(_0x9ad8('0x4'));module[_0x9ad8('0x5')]=function(_0x5ca09f,_0x52f5fd){return _0x5ca09f[_0x9ad8('0x6')](_0x9ad8('0x7'),attributes,{'tableName':_0x9ad8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32ce=['./mailAccount.attributes','exports','MailAccount','mail_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x6ca7f4,_0x51a5df){var _0x494fa6=function(_0x359532){while(--_0x359532){_0x6ca7f4['push'](_0x6ca7f4['shift']());}};_0x494fa6(++_0x51a5df);}(_0x32ce,0x7c));var _0xe32c=function(_0x2db0b8,_0x578b9a){_0x2db0b8=_0x2db0b8-0x0;var _0x4363db=_0x32ce[_0x2db0b8];return _0x4363db;};'use strict';var _=require(_0xe32c('0x0'));var util=require(_0xe32c('0x1'));var logger=require(_0xe32c('0x2'))(_0xe32c('0x3'));var moment=require(_0xe32c('0x4'));var BPromise=require('bluebird');var rp=require(_0xe32c('0x5'));var fs=require('fs');var path=require(_0xe32c('0x6'));var rimraf=require(_0xe32c('0x7'));var config=require('../../config/environment');var attributes=require(_0xe32c('0x8'));module[_0xe32c('0x9')]=function(_0x39dfe4,_0x6eef13){return _0x39dfe4['define'](_0xe32c('0xa'),attributes,{'tableName':_0xe32c('0xb'),'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 f8f4617..8de3bd4 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 _0x73fe=['name','UserId','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','GetMailAccount','findAll','raw','options','where','attributes','limit','include','model','map','catch','ShowMailAccount','MailAccount','find','stringify','NotifyMailAccount','body','mail','difference','keys','createdAt','CompanyId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','MailApplication','Applications','MailServerOut','Smtp','account','omit','applications','list','orderBy','priority','asc','autoclose','push','close','length','ListId','CmContact','create','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','update','interaction','created','attachments','originTo','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','User'];(function(_0x4d8790,_0x521730){var _0x5e99c4=function(_0x3c34af){while(--_0x3c34af){_0x4d8790['push'](_0x4d8790['shift']());}};_0x5e99c4(++_0x521730);}(_0x73fe,0x1a2));var _0xe73f=function(_0x356c00,_0x47cf03){_0x356c00=_0x356c00-0x0;var _0x359721=_0x73fe[_0x356c00];return _0x359721;};'use strict';var _=require(_0xe73f('0x0'));var util=require(_0xe73f('0x1'));var moment=require(_0xe73f('0x2'));var BPromise=require(_0xe73f('0x3'));var rs=require(_0xe73f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe73f('0x5'));var config=require(_0xe73f('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe73f('0x7')]({'port':0x232c});config[_0xe73f('0x8')]=_[_0xe73f('0x9')](config['redis'],{'host':_0xe73f('0xa'),'port':0x18eb});var socket=require(_0xe73f('0xb'))(new Redis(config['redis']));require(_0xe73f('0xc'))['register'](socket);function respondWithRpcPromise(_0x142a5c,_0x4b437e,_0x2142be){return new BPromise(function(_0x5b6b5a,_0xa03042){return client[_0xe73f('0xd')](_0x142a5c,_0x2142be)[_0xe73f('0xe')](function(_0x498e39){logger[_0xe73f('0xf')](_0xe73f('0x10'),_0x4b437e,_0xe73f('0x11'));logger[_0xe73f('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x4b437e,'request\x20sent',JSON['stringify'](_0x498e39));if(_0x498e39[_0xe73f('0x13')]){if(_0x498e39[_0xe73f('0x13')][_0xe73f('0x14')]===0x1f4){logger[_0xe73f('0x13')](_0xe73f('0x10'),_0x4b437e,_0x498e39[_0xe73f('0x13')][_0xe73f('0x15')]);return _0xa03042(_0x498e39['error']['message']);}logger[_0xe73f('0x13')](_0xe73f('0x10'),_0x4b437e,_0x498e39[_0xe73f('0x13')]['message']);return _0x5b6b5a(_0x498e39[_0xe73f('0x13')][_0xe73f('0x15')]);}else{logger['info'](_0xe73f('0x10'),_0x4b437e,_0xe73f('0x11'));_0x5b6b5a(_0x498e39['result'][_0xe73f('0x15')]);}})['catch'](function(_0x206ec0){logger['error'](_0xe73f('0x10'),_0x4b437e,_0x206ec0);_0xa03042(_0x206ec0);});});}exports[_0xe73f('0x16')]=function(_0x5d515d){var _0xa085b4=this;return new Promise(function(_0x106a2b,_0x5610ef){return db['MailAccount'][_0xe73f('0x17')]({'raw':_0x5d515d['options']?_0x5d515d['options'][_0xe73f('0x18')]===undefined?!![]:![]:!![],'where':_0x5d515d[_0xe73f('0x19')]?_0x5d515d[_0xe73f('0x19')][_0xe73f('0x1a')]||null:null,'attributes':_0x5d515d[_0xe73f('0x19')]?_0x5d515d[_0xe73f('0x19')][_0xe73f('0x1b')]||null:null,'limit':_0x5d515d[_0xe73f('0x19')]?_0x5d515d[_0xe73f('0x19')][_0xe73f('0x1c')]||null:null,'include':_0x5d515d[_0xe73f('0x19')]?_0x5d515d[_0xe73f('0x19')][_0xe73f('0x1d')]?_['map'](_0x5d515d[_0xe73f('0x19')]['include'],function(_0x256973){return{'model':db[_0x256973[_0xe73f('0x1e')]],'as':_0x256973['as'],'attributes':_0x256973['attributes'],'include':_0x256973[_0xe73f('0x1d')]?_[_0xe73f('0x1f')](_0x256973[_0xe73f('0x1d')],function(_0x43633a){return{'model':db[_0x43633a[_0xe73f('0x1e')]],'as':_0x43633a['as'],'attributes':_0x43633a[_0xe73f('0x1b')],'include':_0x43633a[_0xe73f('0x1d')]?_[_0xe73f('0x1f')](_0x43633a[_0xe73f('0x1d')],function(_0x12dccc){return{'model':db[_0x12dccc['model']],'as':_0x12dccc['as'],'attributes':_0x12dccc[_0xe73f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x479440){logger[_0xe73f('0xf')](_0xe73f('0x16'),_0x5d515d);logger[_0xe73f('0x12')](_0xe73f('0x16'),_0x5d515d,JSON['stringify'](_0x479440));_0x106a2b(_0x479440);})[_0xe73f('0x20')](function(_0x36bb6c){logger[_0xe73f('0x13')](_0xe73f('0x16'),_0x36bb6c[_0xe73f('0x15')],_0x5d515d);_0x5610ef(_0xa085b4[_0xe73f('0x13')](0x1f4,_0x36bb6c[_0xe73f('0x15')]));});});};exports[_0xe73f('0x21')]=function(_0x513574){var _0x192db8=this;return new Promise(function(_0x22d967,_0x273c0d){return db[_0xe73f('0x22')][_0xe73f('0x23')]({'raw':_0x513574[_0xe73f('0x19')]?_0x513574[_0xe73f('0x19')][_0xe73f('0x18')]===undefined?!![]:![]:!![],'where':_0x513574[_0xe73f('0x19')]?_0x513574['options'][_0xe73f('0x1a')]||null:null,'attributes':_0x513574[_0xe73f('0x19')]?_0x513574['options'][_0xe73f('0x1b')]||null:null,'include':_0x513574[_0xe73f('0x19')]?_0x513574[_0xe73f('0x19')][_0xe73f('0x1d')]?_[_0xe73f('0x1f')](_0x513574[_0xe73f('0x19')]['include'],function(_0x406c62){return{'model':db[_0x406c62[_0xe73f('0x1e')]],'as':_0x406c62['as'],'attributes':_0x406c62['attributes'],'include':_0x406c62['include']?_[_0xe73f('0x1f')](_0x406c62[_0xe73f('0x1d')],function(_0x2ca805){return{'model':db[_0x2ca805[_0xe73f('0x1e')]],'as':_0x2ca805['as'],'attributes':_0x2ca805[_0xe73f('0x1b')],'include':_0x2ca805[_0xe73f('0x1d')]?_[_0xe73f('0x1f')](_0x2ca805[_0xe73f('0x1d')],function(_0x6faa14){return{'model':db[_0x6faa14[_0xe73f('0x1e')]],'as':_0x6faa14['as'],'attributes':_0x6faa14[_0xe73f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe73f('0xe')](function(_0x436aaa){logger[_0xe73f('0xf')]('ShowMailAccount',_0x513574);logger[_0xe73f('0x12')]('ShowMailAccount',_0x513574,JSON[_0xe73f('0x24')](_0x436aaa));_0x22d967(_0x436aaa);})[_0xe73f('0x20')](function(_0x10c982){logger[_0xe73f('0x13')](_0xe73f('0x21'),_0x10c982[_0xe73f('0x15')],_0x513574);_0x273c0d(_0x192db8[_0xe73f('0x13')](0x1f4,_0x10c982[_0xe73f('0x15')]));});});};exports[_0xe73f('0x25')]=function(_0x325518){var _0x2a48af=this;return new Promise(function(_0x2cd9a3,_0x37c638){var _0x1df376={'body':_0x325518[_0xe73f('0x26')],'channel':_0xe73f('0x27')};var _0x46025d=_[_0xe73f('0x28')](_[_0xe73f('0x29')](db['CmContact']['rawAttributes']),[_0xe73f('0x2a'),'updatedAt',_0xe73f('0x2b'),'ListId']);var _0xb836e8=![];if(_0x325518[_0xe73f('0x26')]['id']){delete _0x325518[_0xe73f('0x26')]['id'];}if(_[_0xe73f('0x2c')](_0x325518[_0xe73f('0x26')]['from'])){return _0x37c638(_0x2a48af[_0xe73f('0x13')](0x1f4,_0xe73f('0x2d')));}if(_['isNil'](_0x325518[_0xe73f('0x26')]['body'])||_0x325518[_0xe73f('0x26')][_0xe73f('0x26')]===''){return _0x37c638(_0x2a48af['error'](0x1f4,_0xe73f('0x2e')));}if(_[_0xe73f('0x2c')](_0x325518['body']['mapKey'])){return _0x37c638(_0x2a48af[_0xe73f('0x13')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x46025d));}if(!_[_0xe73f('0x2f')](_0x46025d,_0x325518[_0xe73f('0x26')][_0xe73f('0x30')])){return _0x37c638(_0x2a48af[_0xe73f('0x13')](0x1f4,_0xe73f('0x31')+_0x46025d));}var _0x2ef3aa={};_0x2ef3aa[_0x325518[_0xe73f('0x26')]['mapKey']]=_0x325518[_0xe73f('0x26')][_0xe73f('0x32')];return db[_0xe73f('0x22')][_0xe73f('0x23')]({'where':{'id':_0x325518['account']['id']},'include':[{'model':db[_0xe73f('0x33')],'as':_0xe73f('0x34'),'include':[{'model':db['CmContact'],'as':_0xe73f('0x35'),'where':_0x2ef3aa,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xe73f('0x36')],'as':_0xe73f('0x37')},{'model':db[_0xe73f('0x38')],'as':_0xe73f('0x39')}]})[_0xe73f('0xe')](function(_0x20d594){if(_0x20d594&&_0x20d594[_0xe73f('0x34')]){var _0x472f0b=_0x20d594['get']({'plain':!![]});_0x1df376[_0xe73f('0x3a')]=_[_0xe73f('0x3b')](_0x472f0b,['Applications',_0xe73f('0x34')]);_0x1df376[_0xe73f('0x3c')]=_0x472f0b[_0xe73f('0x37')];_0x1df376[_0xe73f('0x3d')]=_0x472f0b[_0xe73f('0x34')];_0x1df376[_0xe73f('0x3c')]=_[_0xe73f('0x3e')](_0x1df376[_0xe73f('0x3c')],[_0xe73f('0x3f')],[_0xe73f('0x40')]);if(_0x1df376[_0xe73f('0x3a')]&&_0x1df376[_0xe73f('0x3a')][_0xe73f('0x41')]){_0x1df376[_0xe73f('0x3c')][_0xe73f('0x42')]({'id':0x0,'priority':_0x1df376[_0xe73f('0x3c')]['length']+0x1,'app':_0xe73f('0x43'),'appdata':'autoclose','interval':'*,*,*,*'});}if(_0x1df376['account'][_0xe73f('0x37')]){delete _0x1df376['account'][_0xe73f('0x37')];}if(_0x1df376[_0xe73f('0x3a')][_0xe73f('0x34')]){delete _0x1df376[_0xe73f('0x3a')][_0xe73f('0x34')];}if(_0x472f0b[_0xe73f('0x34')][_0xe73f('0x35')][_0xe73f('0x44')]){return _0x472f0b[_0xe73f('0x34')][_0xe73f('0x35')][0x0];}var _0x84c7a8=_[_0xe73f('0x9')](_0x325518[_0xe73f('0x26')],{'firstName':_0x325518[_0xe73f('0x26')][_0xe73f('0x32')],'ListId':_0x472f0b[_0xe73f('0x45')]});_0x84c7a8[_0x325518['body'][_0xe73f('0x30')]]=_0x325518[_0xe73f('0x26')][_0xe73f('0x32')];return db[_0xe73f('0x46')][_0xe73f('0x47')](_0x84c7a8);}else{throw new Error('List\x20not\x20found');}})['then'](function(_0x5000ce){_0x1df376[_0xe73f('0x48')]=_0x5000ce;if(_0x5000ce){if(!_0x325518[_0xe73f('0x26')][_0xe73f('0x15')][_0xe73f('0x49')]){_0x325518['body'][_0xe73f('0x15')]['messageId']=rs[_0xe73f('0x4a')]()+'\x20'+_0x325518[_0xe73f('0x26')][_0xe73f('0x15')][_0xe73f('0x32')];}var _0x13e601={'ContactId':_0x5000ce['id'],'MailAccountId':_0x325518[_0xe73f('0x3a')]['id'],'inReplyTo':_0x325518[_0xe73f('0x26')]['message'][_0xe73f('0x49')],'to':_0x325518[_0xe73f('0x26')][_0xe73f('0x15')][_0xe73f('0x32')],'cc':_0x325518[_0xe73f('0x26')]['message']['cc'],'subject':_0x325518[_0xe73f('0x26')]['message'][_0xe73f('0x4b')],'attach':_0x325518['body'][_0xe73f('0x15')][_0xe73f('0x4c')],'lastMsgAt':moment()[_0xe73f('0x4d')](_0xe73f('0x4e')),'lastMsgDirection':'in'};return db['MailInteraction'][_0xe73f('0x23')]({'where':{'closed':![],'MailAccountId':_0x325518[_0xe73f('0x3a')]['id']},'include':[{'model':db[_0xe73f('0x4f')],'as':_0xe73f('0x50'),'attributes':['messageId'],'where':{'messageId':_0x325518['body'][_0xe73f('0x15')][_0xe73f('0x51')]}}]})['then'](function(_0x1fd32b){if(_0x1fd32b){return[_0x1fd32b,![]];}return db[_0xe73f('0x52')]['create'](_0x13e601)[_0xe73f('0xe')](function(_0x1fb379){return[_0x1fb379,!![]];});});}else{throw new Error(_0xe73f('0x53'));}})[_0xe73f('0x54')](function(_0x145b28,_0x492a23){if(_0x145b28){_0xb836e8=_0x492a23;if(!_0x492a23){return _0x145b28[_0xe73f('0x55')]({'inReplyTo':_0x325518['body']['message'][_0xe73f('0x49')],'to':_0x325518[_0xe73f('0x26')][_0xe73f('0x15')][_0xe73f('0x32')],'cc':_0x325518[_0xe73f('0x26')][_0xe73f('0x15')]['cc'],'subject':_0x325518[_0xe73f('0x26')][_0xe73f('0x15')][_0xe73f('0x4b')],'attach':_0x145b28[_0xe73f('0x4c')]?_0x145b28[_0xe73f('0x4c')]:_0x325518[_0xe73f('0x26')][_0xe73f('0x15')][_0xe73f('0x4c')],'substatus':null,'substatusAt':moment()[_0xe73f('0x4d')](_0xe73f('0x4e')),'lastMsgAt':moment()[_0xe73f('0x4d')](_0xe73f('0x4e')),'lastMsgDirection':'in'});}else{return _0x145b28;}}})[_0xe73f('0xe')](function(_0x22ed80){_0x1df376[_0xe73f('0x56')]=_0x22ed80['get']({'plain':!![]});_0x1df376[_0xe73f('0x56')][_0xe73f('0x57')]=_0xb836e8;return db['MailMessage'][_0xe73f('0x47')]({'body':_0x325518['body'][_0xe73f('0x26')],'MailAccountId':_0x325518[_0xe73f('0x3a')]['id'],'MailInteractionId':_0x22ed80['id'],'direction':'in','ContactId':_0x1df376[_0xe73f('0x48')]['id'],'messageId':_0x325518['body'][_0xe73f('0x15')][_0xe73f('0x49')],'from':_0x325518[_0xe73f('0x26')]['message'][_0xe73f('0x32')],'to':_0x325518['body'][_0xe73f('0x15')]['to'],'cc':_0x325518[_0xe73f('0x26')][_0xe73f('0x15')]['cc'],'subject':_0x325518['body'][_0xe73f('0x15')][_0xe73f('0x4b')],'attach':_0x325518[_0xe73f('0x26')][_0xe73f('0x15')][_0xe73f('0x4c')],'Attachments':_0x325518['body']['message'][_0xe73f('0x58')],'originTo':_0x325518[_0xe73f('0x26')][_0xe73f('0x15')][_0xe73f('0x59')],'originCc':_0x325518[_0xe73f('0x26')][_0xe73f('0x15')][_0xe73f('0x5a')],'bcc':_0x325518[_0xe73f('0x26')][_0xe73f('0x15')]['bcc'],'ChatWebsiteId':_0x325518[_0xe73f('0x26')]['message'][_0xe73f('0x5b')]||null,'originChannel':_0x325518['body'][_0xe73f('0x15')][_0xe73f('0x5c')]||_0xe73f('0x5d'),'ChatOfflineMessageId':_0x325518['body']['message'][_0xe73f('0x5e')]||null},{'include':[{'model':db[_0xe73f('0x5f')],'as':'Attachments'}]});})['then'](function(_0x5c62ff){_0x1df376['message']=_0x5c62ff;if(_0x1df376['interaction']['UserId']){return db[_0xe73f('0x60')][_0xe73f('0x23')]({'attributes':['id',_0xe73f('0x61')],'where':{'id':_0x1df376[_0xe73f('0x56')][_0xe73f('0x62')]}})['then'](function(_0x213e41){if(_0x213e41){_0x1df376[_0xe73f('0x3c')]['unshift']({'id':0x0,'priority':0x0,'app':_0xe73f('0x63'),'appdata':_0x213e41[_0xe73f('0x61')]+','+(_0x1df376[_0xe73f('0x3a')][_0xe73f('0x64')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xe73f('0x65'),'startRouting',_0x1df376);});}return respondWithRpcPromise(_0xe73f('0x65'),_0xe73f('0x66'),_0x1df376);})[_0xe73f('0xe')](function(_0x117fc6){_0x2cd9a3(_0x117fc6);})[_0xe73f('0x20')](function(_0x3dd5bf){_0x37c638(_0x2a48af[_0xe73f('0x13')](0x1f4,_0x3dd5bf[_0xe73f('0x15')]));});});}; \ No newline at end of file +var _0x112a=['unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','findAll','options','raw','where','attributes','include','map','model','debug','ShowMailAccount','MailAccount','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','find','account','MailApplication','Applications','Smtp','get','omit','List','applications','list','orderBy','priority','asc','push','length','close','autoclose','*,*,*,*','Contacts','create','List\x20not\x20found','contact','messageId','attach','format','MailMessage','MailInteraction','Contact\x20not\x20found','spread','update','YYYY-MM-DD\x20HH:mm:ss','interaction','created','subject','attachments','originCc','bcc','ChatWebsiteId','originChannel','Email','Attachments','UserId','User'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x112a,0x1b2));var _0xa112=function(_0x109f6b,_0x38c15d){_0x109f6b=_0x109f6b-0x0;var _0x5c143d=_0x112a[_0x109f6b];return _0x5c143d;};'use strict';var _=require(_0xa112('0x0'));var util=require(_0xa112('0x1'));var moment=require(_0xa112('0x2'));var BPromise=require(_0xa112('0x3'));var rs=require(_0xa112('0x4'));var fs=require('fs');var Redis=require(_0xa112('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa112('0x6'));var logger=require(_0xa112('0x7'))(_0xa112('0x8'));var config=require(_0xa112('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa112('0xa')][_0xa112('0xb')]({'port':0x232c});config[_0xa112('0xc')]=_[_0xa112('0xd')](config['redis'],{'host':_0xa112('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailAccount.socket')[_0xa112('0xf')](socket);function respondWithRpcPromise(_0xea1ef1,_0x42fdf4,_0xd98d41){return new BPromise(function(_0x57b478,_0x2c3b2b){return client[_0xa112('0x10')](_0xea1ef1,_0xd98d41)[_0xa112('0x11')](function(_0x1d3b8f){logger[_0xa112('0x12')](_0xa112('0x13'),_0x42fdf4,_0xa112('0x14'));logger['debug'](_0xa112('0x15'),_0x42fdf4,_0xa112('0x14'),JSON[_0xa112('0x16')](_0x1d3b8f));if(_0x1d3b8f[_0xa112('0x17')]){if(_0x1d3b8f[_0xa112('0x17')][_0xa112('0x18')]===0x1f4){logger[_0xa112('0x17')](_0xa112('0x13'),_0x42fdf4,_0x1d3b8f['error'][_0xa112('0x19')]);return _0x2c3b2b(_0x1d3b8f['error'][_0xa112('0x19')]);}logger[_0xa112('0x17')](_0xa112('0x13'),_0x42fdf4,_0x1d3b8f[_0xa112('0x17')][_0xa112('0x19')]);return _0x57b478(_0x1d3b8f['error'][_0xa112('0x19')]);}else{logger[_0xa112('0x12')](_0xa112('0x13'),_0x42fdf4,_0xa112('0x14'));_0x57b478(_0x1d3b8f[_0xa112('0x1a')][_0xa112('0x19')]);}})[_0xa112('0x1b')](function(_0x33187c){logger[_0xa112('0x17')](_0xa112('0x13'),_0x42fdf4,_0x33187c);_0x2c3b2b(_0x33187c);});});}exports[_0xa112('0x1c')]=function(_0x5464e6){var _0x443229=this;return new Promise(function(_0x4c50f0,_0xc281c3){return db['MailAccount'][_0xa112('0x1d')]({'raw':_0x5464e6[_0xa112('0x1e')]?_0x5464e6[_0xa112('0x1e')][_0xa112('0x1f')]===undefined?!![]:![]:!![],'where':_0x5464e6['options']?_0x5464e6['options'][_0xa112('0x20')]||null:null,'attributes':_0x5464e6[_0xa112('0x1e')]?_0x5464e6[_0xa112('0x1e')][_0xa112('0x21')]||null:null,'limit':_0x5464e6[_0xa112('0x1e')]?_0x5464e6['options']['limit']||null:null,'include':_0x5464e6[_0xa112('0x1e')]?_0x5464e6[_0xa112('0x1e')][_0xa112('0x22')]?_[_0xa112('0x23')](_0x5464e6[_0xa112('0x1e')]['include'],function(_0x28e564){return{'model':db[_0x28e564[_0xa112('0x24')]],'as':_0x28e564['as'],'attributes':_0x28e564[_0xa112('0x21')],'include':_0x28e564[_0xa112('0x22')]?_[_0xa112('0x23')](_0x28e564[_0xa112('0x22')],function(_0x397ad5){return{'model':db[_0x397ad5[_0xa112('0x24')]],'as':_0x397ad5['as'],'attributes':_0x397ad5['attributes'],'include':_0x397ad5[_0xa112('0x22')]?_[_0xa112('0x23')](_0x397ad5[_0xa112('0x22')],function(_0x32071c){return{'model':db[_0x32071c[_0xa112('0x24')]],'as':_0x32071c['as'],'attributes':_0x32071c[_0xa112('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa112('0x11')](function(_0x34604f){logger[_0xa112('0x12')](_0xa112('0x1c'),_0x5464e6);logger[_0xa112('0x25')](_0xa112('0x1c'),_0x5464e6,JSON[_0xa112('0x16')](_0x34604f));_0x4c50f0(_0x34604f);})[_0xa112('0x1b')](function(_0x2a9e0e){logger[_0xa112('0x17')]('GetMailAccount',_0x2a9e0e['message'],_0x5464e6);_0xc281c3(_0x443229['error'](0x1f4,_0x2a9e0e[_0xa112('0x19')]));});});};exports[_0xa112('0x26')]=function(_0x4a9077){var _0x5c5a63=this;return new Promise(function(_0x1d8aba,_0x2fd686){return db[_0xa112('0x27')]['find']({'raw':_0x4a9077['options']?_0x4a9077[_0xa112('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x4a9077['options']?_0x4a9077[_0xa112('0x1e')][_0xa112('0x20')]||null:null,'attributes':_0x4a9077[_0xa112('0x1e')]?_0x4a9077[_0xa112('0x1e')][_0xa112('0x21')]||null:null,'include':_0x4a9077['options']?_0x4a9077['options'][_0xa112('0x22')]?_['map'](_0x4a9077[_0xa112('0x1e')][_0xa112('0x22')],function(_0x4cb233){return{'model':db[_0x4cb233[_0xa112('0x24')]],'as':_0x4cb233['as'],'attributes':_0x4cb233[_0xa112('0x21')],'include':_0x4cb233[_0xa112('0x22')]?_[_0xa112('0x23')](_0x4cb233[_0xa112('0x22')],function(_0x31c905){return{'model':db[_0x31c905[_0xa112('0x24')]],'as':_0x31c905['as'],'attributes':_0x31c905['attributes'],'include':_0x31c905[_0xa112('0x22')]?_[_0xa112('0x23')](_0x31c905[_0xa112('0x22')],function(_0x2f8dcf){return{'model':db[_0x2f8dcf[_0xa112('0x24')]],'as':_0x2f8dcf['as'],'attributes':_0x2f8dcf[_0xa112('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa112('0x11')](function(_0x52cca7){logger['info'](_0xa112('0x26'),_0x4a9077);logger[_0xa112('0x25')](_0xa112('0x26'),_0x4a9077,JSON[_0xa112('0x16')](_0x52cca7));_0x1d8aba(_0x52cca7);})['catch'](function(_0x478ea8){logger[_0xa112('0x17')](_0xa112('0x26'),_0x478ea8[_0xa112('0x19')],_0x4a9077);_0x2fd686(_0x5c5a63[_0xa112('0x17')](0x1f4,_0x478ea8[_0xa112('0x19')]));});});};exports[_0xa112('0x28')]=function(_0x225733){var _0xda1f74=this;return new Promise(function(_0x4a93bc,_0x4a92d9){var _0x151fff={'body':_0x225733[_0xa112('0x29')],'channel':_0xa112('0x2a')};var _0x49b433=_[_0xa112('0x2b')](_[_0xa112('0x2c')](db[_0xa112('0x2d')][_0xa112('0x2e')]),[_0xa112('0x2f'),_0xa112('0x30'),_0xa112('0x31'),_0xa112('0x32')]);var _0x1e6c65=![];if(_0x225733[_0xa112('0x29')]['id']){delete _0x225733[_0xa112('0x29')]['id'];}if(_[_0xa112('0x33')](_0x225733['body'][_0xa112('0x34')])){return _0x4a92d9(_0xda1f74[_0xa112('0x17')](0x1f4,_0xa112('0x35')));}if(_[_0xa112('0x33')](_0x225733[_0xa112('0x29')]['body'])||_0x225733['body'][_0xa112('0x29')]===''){return _0x4a92d9(_0xda1f74[_0xa112('0x17')](0x1f4,_0xa112('0x36')));}if(_[_0xa112('0x33')](_0x225733[_0xa112('0x29')]['mapKey'])){return _0x4a92d9(_0xda1f74[_0xa112('0x17')](0x1f4,_0xa112('0x37')+_0x49b433));}if(!_['includes'](_0x49b433,_0x225733[_0xa112('0x29')]['mapKey'])){return _0x4a92d9(_0xda1f74[_0xa112('0x17')](0x1f4,_0xa112('0x38')+_0x49b433));}var _0x4ead6f={};_0x4ead6f[_0x225733[_0xa112('0x29')][_0xa112('0x39')]]=_0x225733[_0xa112('0x29')]['from'];return db[_0xa112('0x27')][_0xa112('0x3a')]({'where':{'id':_0x225733[_0xa112('0x3b')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xa112('0x2d')],'as':'Contacts','where':_0x4ead6f,'limit':0x1,'order':[[_0xa112('0x30'),'DESC']]}]},{'model':db[_0xa112('0x3c')],'as':_0xa112('0x3d')},{'model':db['MailServerOut'],'as':_0xa112('0x3e')}]})[_0xa112('0x11')](function(_0x53bfce){if(_0x53bfce&&_0x53bfce['List']){var _0x47493b=_0x53bfce[_0xa112('0x3f')]({'plain':!![]});_0x151fff[_0xa112('0x3b')]=_[_0xa112('0x40')](_0x47493b,['Applications',_0xa112('0x41')]);_0x151fff[_0xa112('0x42')]=_0x47493b[_0xa112('0x3d')];_0x151fff[_0xa112('0x43')]=_0x47493b['List'];_0x151fff[_0xa112('0x42')]=_[_0xa112('0x44')](_0x151fff[_0xa112('0x42')],[_0xa112('0x45')],[_0xa112('0x46')]);if(_0x151fff[_0xa112('0x3b')]&&_0x151fff['account']['autoclose']){_0x151fff['applications'][_0xa112('0x47')]({'id':0x0,'priority':_0x151fff[_0xa112('0x42')][_0xa112('0x48')]+0x1,'app':_0xa112('0x49'),'appdata':_0xa112('0x4a'),'interval':_0xa112('0x4b')});}if(_0x151fff[_0xa112('0x3b')]['Applications']){delete _0x151fff[_0xa112('0x3b')][_0xa112('0x3d')];}if(_0x151fff[_0xa112('0x3b')][_0xa112('0x41')]){delete _0x151fff[_0xa112('0x3b')][_0xa112('0x41')];}if(_0x47493b[_0xa112('0x41')][_0xa112('0x4c')][_0xa112('0x48')]){return _0x47493b[_0xa112('0x41')][_0xa112('0x4c')][0x0];}var _0xd82be3=_[_0xa112('0xd')](_0x225733[_0xa112('0x29')],{'firstName':_0x225733[_0xa112('0x29')][_0xa112('0x34')],'ListId':_0x47493b[_0xa112('0x32')]});_0xd82be3[_0x225733[_0xa112('0x29')][_0xa112('0x39')]]=_0x225733[_0xa112('0x29')][_0xa112('0x34')];return db[_0xa112('0x2d')][_0xa112('0x4d')](_0xd82be3);}else{throw new Error(_0xa112('0x4e'));}})[_0xa112('0x11')](function(_0x3cf31b){_0x151fff[_0xa112('0x4f')]=_0x3cf31b;if(_0x3cf31b){if(!_0x225733[_0xa112('0x29')][_0xa112('0x19')]['messageId']){_0x225733[_0xa112('0x29')]['message'][_0xa112('0x50')]=rs['generate']()+'\x20'+_0x225733['body'][_0xa112('0x19')][_0xa112('0x34')];}var _0x3adb4f={'ContactId':_0x3cf31b['id'],'MailAccountId':_0x225733[_0xa112('0x3b')]['id'],'inReplyTo':_0x225733[_0xa112('0x29')][_0xa112('0x19')][_0xa112('0x50')],'to':_0x225733[_0xa112('0x29')][_0xa112('0x19')][_0xa112('0x34')],'cc':_0x225733['body'][_0xa112('0x19')]['cc'],'subject':_0x225733[_0xa112('0x29')][_0xa112('0x19')]['subject'],'attach':_0x225733[_0xa112('0x29')][_0xa112('0x19')][_0xa112('0x51')],'lastMsgAt':moment()[_0xa112('0x52')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0xa112('0x3a')]({'where':{'closed':![],'MailAccountId':_0x225733[_0xa112('0x3b')]['id']},'include':[{'model':db[_0xa112('0x53')],'as':'Messages','attributes':['messageId'],'where':{'messageId':_0x225733[_0xa112('0x29')][_0xa112('0x19')]['inReplyTo']}}]})[_0xa112('0x11')](function(_0x258a57){if(_0x258a57){return[_0x258a57,![]];}return db[_0xa112('0x54')][_0xa112('0x4d')](_0x3adb4f)[_0xa112('0x11')](function(_0x136a00){return[_0x136a00,!![]];});});}else{throw new Error(_0xa112('0x55'));}})[_0xa112('0x56')](function(_0x2f317c,_0x5c8b7a){if(_0x2f317c){_0x1e6c65=_0x5c8b7a;if(!_0x5c8b7a){return _0x2f317c[_0xa112('0x57')]({'inReplyTo':_0x225733[_0xa112('0x29')][_0xa112('0x19')]['messageId'],'to':_0x225733['body']['message'][_0xa112('0x34')],'cc':_0x225733[_0xa112('0x29')][_0xa112('0x19')]['cc'],'subject':_0x225733['body'][_0xa112('0x19')]['subject'],'attach':_0x2f317c[_0xa112('0x51')]?_0x2f317c[_0xa112('0x51')]:_0x225733[_0xa112('0x29')][_0xa112('0x19')]['attach'],'substatus':null,'substatusAt':moment()[_0xa112('0x52')](_0xa112('0x58')),'lastMsgAt':moment()[_0xa112('0x52')](_0xa112('0x58')),'lastMsgDirection':'in'});}else{return _0x2f317c;}}})[_0xa112('0x11')](function(_0x518e10){_0x151fff[_0xa112('0x59')]=_0x518e10[_0xa112('0x3f')]({'plain':!![]});_0x151fff[_0xa112('0x59')][_0xa112('0x5a')]=_0x1e6c65;return db[_0xa112('0x53')]['create']({'body':_0x225733['body'][_0xa112('0x29')],'MailAccountId':_0x225733[_0xa112('0x3b')]['id'],'MailInteractionId':_0x518e10['id'],'direction':'in','ContactId':_0x151fff[_0xa112('0x4f')]['id'],'messageId':_0x225733[_0xa112('0x29')]['message'][_0xa112('0x50')],'from':_0x225733['body'][_0xa112('0x19')][_0xa112('0x34')],'to':_0x225733[_0xa112('0x29')][_0xa112('0x19')]['to'],'cc':_0x225733[_0xa112('0x29')][_0xa112('0x19')]['cc'],'subject':_0x225733['body'][_0xa112('0x19')][_0xa112('0x5b')],'attach':_0x225733[_0xa112('0x29')][_0xa112('0x19')]['attach'],'Attachments':_0x225733[_0xa112('0x29')][_0xa112('0x19')][_0xa112('0x5c')],'originTo':_0x225733[_0xa112('0x29')][_0xa112('0x19')]['originTo'],'originCc':_0x225733[_0xa112('0x29')][_0xa112('0x19')][_0xa112('0x5d')],'bcc':_0x225733['body'][_0xa112('0x19')][_0xa112('0x5e')],'ChatWebsiteId':_0x225733['body'][_0xa112('0x19')][_0xa112('0x5f')]||null,'originChannel':_0x225733[_0xa112('0x29')][_0xa112('0x19')][_0xa112('0x60')]||_0xa112('0x61'),'ChatOfflineMessageId':_0x225733[_0xa112('0x29')][_0xa112('0x19')]['ChatOfflineMessageId']||null},{'include':[{'model':db['Attachment'],'as':_0xa112('0x62')}]});})['then'](function(_0x371231){_0x151fff[_0xa112('0x19')]=_0x371231;if(_0x151fff[_0xa112('0x59')][_0xa112('0x63')]){return db[_0xa112('0x64')]['find']({'attributes':['id','name'],'where':{'id':_0x151fff[_0xa112('0x59')][_0xa112('0x63')]}})['then'](function(_0xb4db68){if(_0xb4db68){_0x151fff[_0xa112('0x42')][_0xa112('0x65')]({'id':0x0,'priority':0x0,'app':_0xa112('0x66'),'appdata':_0xb4db68[_0xa112('0x67')]+','+(_0x151fff[_0xa112('0x3b')][_0xa112('0x68')]||0xa),'interval':_0xa112('0x4b')});}return respondWithRpcPromise(_0xa112('0x69'),_0xa112('0x6a'),_0x151fff);});}return respondWithRpcPromise(_0xa112('0x69'),_0xa112('0x6a'),_0x151fff);})['then'](function(_0x142427){_0x4a93bc(_0x142427);})[_0xa112('0x1b')](function(_0x4fdbe7){_0x4a92d9(_0xda1f74['error'](0x1f4,_0x4fdbe7[_0xa112('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 71deee0..b612a72 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 _0xf094=['removeListener','register','length','mailAccount:','./mailAccount.events','remove','update'];(function(_0x298a2f,_0x42610d){var _0x2d36dd=function(_0x1c5b53){while(--_0x1c5b53){_0x298a2f['push'](_0x298a2f['shift']());}};_0x2d36dd(++_0x42610d);}(_0xf094,0x1ee));var _0x4f09=function(_0x33feca,_0x2bd9ae){_0x33feca=_0x33feca-0x0;var _0x3c558f=_0xf094[_0x33feca];return _0x3c558f;};'use strict';var MailAccountEvents=require(_0x4f09('0x0'));var events=['save',_0x4f09('0x1'),_0x4f09('0x2')];function createListener(_0x5e77b8,_0x253051){return function(_0x1c48ab){_0x253051['emit'](_0x5e77b8,_0x1c48ab);};}function removeListener(_0x47e3b4,_0x524ee3){return function(){MailAccountEvents[_0x4f09('0x3')](_0x47e3b4,_0x524ee3);};}exports[_0x4f09('0x4')]=function(_0x1cb6fa){for(var _0x518bca=0x0,_0x5c8273=events[_0x4f09('0x5')];_0x518bca<_0x5c8273;_0x518bca++){var _0x1b33ee=events[_0x518bca];var _0x2b4ad7=createListener(_0x4f09('0x6')+_0x1b33ee,_0x1cb6fa);MailAccountEvents['on'](_0x1b33ee,_0x2b4ad7);}}; \ No newline at end of file +var _0xa2d5=['./mailAccount.events','save','update','emit','removeListener','register','length','mailAccount:'];(function(_0x512d22,_0x37bb3a){var _0x2440c3=function(_0x4436d3){while(--_0x4436d3){_0x512d22['push'](_0x512d22['shift']());}};_0x2440c3(++_0x37bb3a);}(_0xa2d5,0x70));var _0x5a2d=function(_0x37dd26,_0x1dc982){_0x37dd26=_0x37dd26-0x0;var _0x365d53=_0xa2d5[_0x37dd26];return _0x365d53;};'use strict';var MailAccountEvents=require(_0x5a2d('0x0'));var events=[_0x5a2d('0x1'),'remove',_0x5a2d('0x2')];function createListener(_0x18f97d,_0x5a3771){return function(_0x211ec4){_0x5a3771[_0x5a2d('0x3')](_0x18f97d,_0x211ec4);};}function removeListener(_0x4a3cfa,_0x4328c8){return function(){MailAccountEvents[_0x5a2d('0x4')](_0x4a3cfa,_0x4328c8);};}exports[_0x5a2d('0x5')]=function(_0x557724){for(var _0x5574e0=0x0,_0xda5f50=events[_0x5a2d('0x6')];_0x5574e0<_0xda5f50;_0x5574e0++){var _0x26834b=events[_0x5574e0];var _0x5b5312=createListener(_0x5a2d('0x7')+_0x26834b,_0x557724);MailAccountEvents['on'](_0x26834b,_0x5b5312);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 1f7440a..341e185 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 _0xb3d8=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','show','put','isAuthenticated','delete','exports'];(function(_0x45c536,_0x52a556){var _0x10e06d=function(_0x3fcca0){while(--_0x3fcca0){_0x45c536['push'](_0x45c536['shift']());}};_0x10e06d(++_0x52a556);}(_0xb3d8,0x132));var _0x8b3d=function(_0x94d3e7,_0x568558){_0x94d3e7=_0x94d3e7-0x0;var _0x3f76a9=_0xb3d8[_0x94d3e7];return _0x3f76a9;};'use strict';var multer=require(_0x8b3d('0x0'));var util=require(_0x8b3d('0x1'));var path=require(_0x8b3d('0x2'));var timeout=require(_0x8b3d('0x3'));var express=require('express');var router=express[_0x8b3d('0x4')]();var fs_extra=require(_0x8b3d('0x5'));var auth=require(_0x8b3d('0x6'));var interaction=require(_0x8b3d('0x7'));var config=require(_0x8b3d('0x8'));var controller=require(_0x8b3d('0x9'));router[_0x8b3d('0xa')](_0x8b3d('0xb'),auth['isAuthenticated'](),controller[_0x8b3d('0xc')]);router[_0x8b3d('0xd')](_0x8b3d('0xb'),auth[_0x8b3d('0xe')](),controller['update']);router[_0x8b3d('0xf')](_0x8b3d('0xb'),auth[_0x8b3d('0xe')](),controller['destroy']);module[_0x8b3d('0x10')]=router; \ No newline at end of file +var _0xa989=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','show','update','destroy','path','connect-timeout','fs-extra'];(function(_0x5de366,_0x42e495){var _0x5687c5=function(_0x406090){while(--_0x406090){_0x5de366['push'](_0x5de366['shift']());}};_0x5687c5(++_0x42e495);}(_0xa989,0xd5));var _0x9a98=function(_0x53599c,_0x8a48d1){_0x53599c=_0x53599c-0x0;var _0x2aa120=_0xa989[_0x53599c];return _0x2aa120;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9a98('0x0'));var timeout=require(_0x9a98('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9a98('0x2'));var auth=require(_0x9a98('0x3'));var interaction=require(_0x9a98('0x4'));var config=require(_0x9a98('0x5'));var controller=require(_0x9a98('0x6'));router[_0x9a98('0x7')](_0x9a98('0x8'),auth['isAuthenticated'](),controller[_0x9a98('0x9')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9a98('0xa')]);router['delete'](_0x9a98('0x8'),auth['isAuthenticated'](),controller[_0x9a98('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 815818f..fca4b48 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 _0x4b37=['*,*,*,*','sequelize','exports','INTEGER','noop','TEXT'];(function(_0x5d860f,_0x467498){var _0x236490=function(_0x5e045c){while(--_0x5e045c){_0x5d860f['push'](_0x5d860f['shift']());}};_0x236490(++_0x467498);}(_0x4b37,0x103));var _0x74b3=function(_0x431cbc,_0x17ed2d){_0x431cbc=_0x431cbc-0x0;var _0x166eec=_0x4b37[_0x431cbc];return _0x166eec;};'use strict';var Sequelize=require(_0x74b3('0x0'));module[_0x74b3('0x1')]={'priority':{'type':Sequelize[_0x74b3('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x74b3('0x3')},'appdata':{'type':Sequelize[_0x74b3('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x74b3('0x5')}}; \ No newline at end of file +var _0x3970=['STRING','*,*,*,*','sequelize','exports','noop','TEXT'];(function(_0x2cacb6,_0x3a9cdc){var _0x309a16=function(_0x56d7d3){while(--_0x56d7d3){_0x2cacb6['push'](_0x2cacb6['shift']());}};_0x309a16(++_0x3a9cdc);}(_0x3970,0x1dc));var _0x0397=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x3970[_0x5f09c5];return _0x426ad9;};'use strict';var Sequelize=require(_0x0397('0x0'));module[_0x0397('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0397('0x2')},'appdata':{'type':Sequelize[_0x0397('0x3')]()},'description':{'type':Sequelize[_0x0397('0x4')]},'interval':{'type':Sequelize[_0x0397('0x4')],'defaultValue':_0x0397('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index db053d3..b8c5d35 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['limit','count','set','apply','reject','then','stack','name','send','params','model','keys','MailApplication','query','filters','intersection','attributes','fields','length','include','merge','options','find','update','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa88,0x137));var _0x8aa8=function(_0x4f0e62,_0x28e44f){_0x4f0e62=_0x4f0e62-0x0;var _0x117ab8=_0xaa88[_0x4f0e62];return _0x117ab8;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require(_0x8aa8('0x2'));var jsonpatch=require(_0x8aa8('0x3'));var rp=require('request-promise');var moment=require(_0x8aa8('0x4'));var BPromise=require(_0x8aa8('0x5'));var Mustache=require(_0x8aa8('0x6'));var util=require(_0x8aa8('0x7'));var path=require(_0x8aa8('0x8'));var sox=require(_0x8aa8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa8('0xa'));var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var as=require(_0x8aa8('0x13'));var hardwareService=require(_0x8aa8('0x14'));var logger=require(_0x8aa8('0x15'))('api');var utils=require(_0x8aa8('0x16'));var config=require(_0x8aa8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa8('0x18'))['db'];function respondWithStatusCode(_0xa691d6,_0x28132f){_0x28132f=_0x28132f||0xcc;return function(_0x535aa0){if(_0x535aa0){return _0xa691d6[_0x8aa8('0x19')](_0x28132f);}return _0xa691d6[_0x8aa8('0x1a')](_0x28132f)[_0x8aa8('0x1b')]();};}function respondWithResult(_0x4b686e,_0x391642){_0x391642=_0x391642||0xc8;return function(_0x4af534){if(_0x4af534){return _0x4b686e['status'](_0x391642)[_0x8aa8('0x1c')](_0x4af534);}};}function respondWithFilteredResult(_0x200662,_0xae81a0){return function(_0xa6c2af){if(_0xa6c2af){var _0x42a6a4=typeof _0xae81a0[_0x8aa8('0x1d')]===_0x8aa8('0x1e')&&typeof _0xae81a0[_0x8aa8('0x1f')]===_0x8aa8('0x1e');var _0x4e8ce3=_0xa6c2af['count'];var _0x2c1b9a=_0x42a6a4?0x0:_0xae81a0['offset'];var _0x557adc=_0x42a6a4?_0xa6c2af[_0x8aa8('0x20')]:_0xae81a0['offset']+_0xae81a0[_0x8aa8('0x1f')];var _0x41092b;if(_0x557adc>=_0x4e8ce3){_0x557adc=_0x4e8ce3;_0x41092b=0xc8;}else{_0x41092b=0xce;}_0x200662[_0x8aa8('0x1a')](_0x41092b);return _0x200662[_0x8aa8('0x21')]('Content-Range',_0x2c1b9a+'-'+_0x557adc+'/'+_0x4e8ce3)[_0x8aa8('0x1c')](_0xa6c2af);}return null;};}function patchUpdates(_0x36c445){return function(_0x2825fd){try{jsonpatch[_0x8aa8('0x22')](_0x2825fd,_0x36c445,!![]);}catch(_0x4c754e){return BPromise[_0x8aa8('0x23')](_0x4c754e);}return _0x2825fd['save']();};}function saveUpdates(_0x26cf63,_0x4cc455){return function(_0x1fdadd){if(_0x1fdadd){return _0x1fdadd['update'](_0x26cf63)[_0x8aa8('0x24')](function(_0x557e4e){return _0x557e4e;});}return null;};}function removeEntity(_0x65945b,_0x40adb5){return function(_0x3ca7dc){if(_0x3ca7dc){return _0x3ca7dc['destroy']()[_0x8aa8('0x24')](function(){_0x65945b[_0x8aa8('0x1a')](0xcc)[_0x8aa8('0x1b')]();});}};}function handleEntityNotFound(_0x547a7b,_0x57acd2){return function(_0x2d1508){if(!_0x2d1508){_0x547a7b[_0x8aa8('0x19')](0x194);}return _0x2d1508;};}function handleError(_0x2f91f3,_0x3a3c7a){_0x3a3c7a=_0x3a3c7a||0x1f4;return function(_0x24143e){logger['error'](_0x24143e[_0x8aa8('0x25')]);if(_0x24143e['name']){delete _0x24143e[_0x8aa8('0x26')];}_0x2f91f3[_0x8aa8('0x1a')](_0x3a3c7a)[_0x8aa8('0x27')](_0x24143e);};}exports['show']=function(_0x4c5c5c,_0x10810d){var _0x5e96c9={'raw':!![],'where':{'id':_0x4c5c5c[_0x8aa8('0x28')]['id']}},_0x385208={};_0x385208[_0x8aa8('0x29')]=_[_0x8aa8('0x2a')](db[_0x8aa8('0x2b')]['rawAttributes']);_0x385208[_0x8aa8('0x2c')]=_[_0x8aa8('0x2a')](_0x4c5c5c['query']);_0x385208[_0x8aa8('0x2d')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],_0x385208['query']);_0x5e96c9[_0x8aa8('0x2f')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],qs[_0x8aa8('0x30')](_0x4c5c5c[_0x8aa8('0x2c')][_0x8aa8('0x30')]));_0x5e96c9[_0x8aa8('0x2f')]=_0x5e96c9[_0x8aa8('0x2f')][_0x8aa8('0x31')]?_0x5e96c9[_0x8aa8('0x2f')]:_0x385208[_0x8aa8('0x29')];if(_0x4c5c5c['query']['includeAll']){_0x5e96c9[_0x8aa8('0x32')]=[{'all':!![]}];}_0x5e96c9=_[_0x8aa8('0x33')]({},_0x5e96c9,_0x4c5c5c[_0x8aa8('0x34')]);return db[_0x8aa8('0x2b')][_0x8aa8('0x35')](_0x5e96c9)[_0x8aa8('0x24')](handleEntityNotFound(_0x10810d,null))['then'](respondWithResult(_0x10810d,null))['catch'](handleError(_0x10810d,null));};exports[_0x8aa8('0x36')]=function(_0x5755b5,_0x24997c){if(_0x5755b5[_0x8aa8('0x37')]['id']){delete _0x5755b5[_0x8aa8('0x37')]['id'];}return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x5755b5[_0x8aa8('0x28')]['id']}})[_0x8aa8('0x24')](handleEntityNotFound(_0x24997c,null))['then'](saveUpdates(_0x5755b5['body'],null))[_0x8aa8('0x24')](respondWithResult(_0x24997c,null))[_0x8aa8('0x38')](handleError(_0x24997c,null));};exports['destroy']=function(_0x24eb18,_0x2e1f52){return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x24eb18['params']['id']}})['then'](handleEntityNotFound(_0x2e1f52,null))[_0x8aa8('0x24')](removeEntity(_0x2e1f52,null))['catch'](handleError(_0x2e1f52,null));}; \ No newline at end of file +var _0xb43b=['name','status','send','show','params','keys','MailApplication','rawAttributes','query','intersection','model','fields','attributes','length','includeAll','merge','options','find','then','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus'];(function(_0x4c4332,_0x26c832){var _0x534b16=function(_0xc488d){while(--_0xc488d){_0x4c4332['push'](_0x4c4332['shift']());}};_0x534b16(++_0x26c832);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2aa1c8,_0x1cf1af){_0x2aa1c8=_0x2aa1c8-0x0;var _0x4b9970=_0xb43b[_0x2aa1c8];return _0x4b9970;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];function respondWithStatusCode(_0x50e2c0,_0x578392){_0x578392=_0x578392||0xcc;return function(_0x41e7e5){if(_0x41e7e5){return _0x50e2c0['sendStatus'](_0x578392);}return _0x50e2c0['status'](_0x578392)[_0xbb43('0x19')]();};}function respondWithResult(_0x5a509f,_0x68d45d){_0x68d45d=_0x68d45d||0xc8;return function(_0x43021d){if(_0x43021d){return _0x5a509f['status'](_0x68d45d)['json'](_0x43021d);}};}function respondWithFilteredResult(_0x4d5bcf,_0x338120){return function(_0x2abce0){if(_0x2abce0){var _0x57bd1d=typeof _0x338120['offset']===_0xbb43('0x1a')&&typeof _0x338120['limit']==='undefined';var _0x2b0797=_0x2abce0[_0xbb43('0x1b')];var _0x2e3b43=_0x57bd1d?0x0:_0x338120['offset'];var _0x1c16d7=_0x57bd1d?_0x2abce0['count']:_0x338120[_0xbb43('0x1c')]+_0x338120[_0xbb43('0x1d')];var _0x4dfc54;if(_0x1c16d7>=_0x2b0797){_0x1c16d7=_0x2b0797;_0x4dfc54=0xc8;}else{_0x4dfc54=0xce;}_0x4d5bcf['status'](_0x4dfc54);return _0x4d5bcf[_0xbb43('0x1e')](_0xbb43('0x1f'),_0x2e3b43+'-'+_0x1c16d7+'/'+_0x2b0797)[_0xbb43('0x20')](_0x2abce0);}return null;};}function patchUpdates(_0x2bf2d4){return function(_0x5bcce7){try{jsonpatch[_0xbb43('0x21')](_0x5bcce7,_0x2bf2d4,!![]);}catch(_0x5f4416){return BPromise[_0xbb43('0x22')](_0x5f4416);}return _0x5bcce7['save']();};}function saveUpdates(_0x2f5e31,_0x565256){return function(_0x3f323e){if(_0x3f323e){return _0x3f323e[_0xbb43('0x23')](_0x2f5e31)['then'](function(_0x1d0768){return _0x1d0768;});}return null;};}function removeEntity(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(_0x298ce2){return _0x298ce2[_0xbb43('0x24')]()['then'](function(){_0x4dfb7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x269ca5,_0x32d7f0){return function(_0x5d8310){if(!_0x5d8310){_0x269ca5[_0xbb43('0x25')](0x194);}return _0x5d8310;};}function handleError(_0x2da653,_0x226827){_0x226827=_0x226827||0x1f4;return function(_0x3874fb){logger['error'](_0x3874fb['stack']);if(_0x3874fb[_0xbb43('0x26')]){delete _0x3874fb[_0xbb43('0x26')];}_0x2da653[_0xbb43('0x27')](_0x226827)[_0xbb43('0x28')](_0x3874fb);};}exports[_0xbb43('0x29')]=function(_0x40b04b,_0x21d386){var _0x473828={'raw':!![],'where':{'id':_0x40b04b[_0xbb43('0x2a')]['id']}},_0x539730={};_0x539730['model']=_[_0xbb43('0x2b')](db[_0xbb43('0x2c')][_0xbb43('0x2d')]);_0x539730[_0xbb43('0x2e')]=_['keys'](_0x40b04b[_0xbb43('0x2e')]);_0x539730['filters']=_['intersection'](_0x539730['model'],_0x539730[_0xbb43('0x2e')]);_0x473828['attributes']=_[_0xbb43('0x2f')](_0x539730[_0xbb43('0x30')],qs[_0xbb43('0x31')](_0x40b04b['query'][_0xbb43('0x31')]));_0x473828[_0xbb43('0x32')]=_0x473828[_0xbb43('0x32')][_0xbb43('0x33')]?_0x473828[_0xbb43('0x32')]:_0x539730[_0xbb43('0x30')];if(_0x40b04b[_0xbb43('0x2e')][_0xbb43('0x34')]){_0x473828['include']=[{'all':!![]}];}_0x473828=_[_0xbb43('0x35')]({},_0x473828,_0x40b04b[_0xbb43('0x36')]);return db[_0xbb43('0x2c')][_0xbb43('0x37')](_0x473828)[_0xbb43('0x38')](handleEntityNotFound(_0x21d386,null))[_0xbb43('0x38')](respondWithResult(_0x21d386,null))[_0xbb43('0x39')](handleError(_0x21d386,null));};exports[_0xbb43('0x23')]=function(_0x349a83,_0x57105c){if(_0x349a83[_0xbb43('0x3a')]['id']){delete _0x349a83[_0xbb43('0x3a')]['id'];}return db[_0xbb43('0x2c')][_0xbb43('0x37')]({'where':{'id':_0x349a83[_0xbb43('0x2a')]['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x57105c,null))['then'](saveUpdates(_0x349a83[_0xbb43('0x3a')],null))[_0xbb43('0x38')](respondWithResult(_0x57105c,null))['catch'](handleError(_0x57105c,null));};exports[_0xbb43('0x24')]=function(_0x2c9a7c,_0x11d384){return db['MailApplication']['find']({'where':{'id':_0x2c9a7c['params']['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x11d384,null))[_0xbb43('0x38')](removeEntity(_0x11d384,null))['catch'](handleError(_0x11d384,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 516b87e..1b4060a 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 _0x3517=['rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4af90c,_0x590f88){var _0x2a71b2=function(_0x2acc7e){while(--_0x2acc7e){_0x4af90c['push'](_0x4af90c['shift']());}};_0x2a71b2(++_0x590f88);}(_0x3517,0x1d9));var _0x7351=function(_0x6d1b0,_0x11f5fb){_0x6d1b0=_0x6d1b0-0x0;var _0x188e3e=_0x3517[_0x6d1b0];return _0x188e3e;};'use strict';var _=require(_0x7351('0x0'));var util=require(_0x7351('0x1'));var logger=require(_0x7351('0x2'))(_0x7351('0x3'));var moment=require(_0x7351('0x4'));var BPromise=require(_0x7351('0x5'));var rp=require(_0x7351('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7351('0x7'));var config=require(_0x7351('0x8'));var attributes=require(_0x7351('0x9'));module[_0x7351('0xa')]=function(_0x312b5e,_0x2ba4a2){return _0x312b5e[_0x7351('0xb')](_0x7351('0xc'),attributes,{'tableName':_0x7351('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7351('0xe'),'collate':_0x7351('0xf')});}; \ No newline at end of file +var _0xb8c3=['../../config/environment','./mailApplication.attributes','define','mail_applications','utf8mb4_unicode_ci','util','moment','request-promise','path','rimraf'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xb8c3,0x159));var _0x3b8c=function(_0x14fda1,_0x5e8ab1){_0x14fda1=_0x14fda1-0x0;var _0x3bade2=_0xb8c3[_0x14fda1];return _0x3bade2;};'use strict';var _=require('lodash');var util=require(_0x3b8c('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3b8c('0x1'));var BPromise=require('bluebird');var rp=require(_0x3b8c('0x2'));var fs=require('fs');var path=require(_0x3b8c('0x3'));var rimraf=require(_0x3b8c('0x4'));var config=require(_0x3b8c('0x5'));var attributes=require(_0x3b8c('0x6'));module['exports']=function(_0x418d60,_0x3ca384){return _0x418d60[_0x3b8c('0x7')]('MailApplication',attributes,{'tableName':_0x3b8c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3b8c('0x9')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index c69c2b1..4ee46e4 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 _0x4442=['message','result','UpdateMailApplication','MailApplication','update','body','options','raw','where','limit','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','MailApplication,\x20%s,\x20%s'];(function(_0x13d5f3,_0x323fb8){var _0x5350c4=function(_0x3b1e0f){while(--_0x3b1e0f){_0x13d5f3['push'](_0x13d5f3['shift']());}};_0x5350c4(++_0x323fb8);}(_0x4442,0x1cb));var _0x2444=function(_0x30bc9f,_0x240bab){_0x30bc9f=_0x30bc9f-0x0;var _0x19926b=_0x4442[_0x30bc9f];return _0x19926b;};'use strict';var _=require(_0x2444('0x0'));var util=require(_0x2444('0x1'));var moment=require(_0x2444('0x2'));var BPromise=require(_0x2444('0x3'));var rs=require(_0x2444('0x4'));var fs=require('fs');var Redis=require(_0x2444('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2444('0x6'));var logger=require(_0x2444('0x7'))(_0x2444('0x8'));var config=require('../../config/environment');var jayson=require(_0x2444('0x9'));var client=jayson[_0x2444('0xa')][_0x2444('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1023fc,_0x59feb5,_0x261fa6){return new BPromise(function(_0x3f0d43,_0x14848b){return client[_0x2444('0xc')](_0x1023fc,_0x261fa6)[_0x2444('0xd')](function(_0x5a30ae){logger[_0x2444('0xe')]('MailApplication,\x20%s,\x20%s',_0x59feb5,_0x2444('0xf'));logger[_0x2444('0x10')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x59feb5,_0x2444('0xf'),JSON[_0x2444('0x11')](_0x5a30ae));if(_0x5a30ae[_0x2444('0x12')]){if(_0x5a30ae[_0x2444('0x12')][_0x2444('0x13')]===0x1f4){logger[_0x2444('0x12')](_0x2444('0x14'),_0x59feb5,_0x5a30ae[_0x2444('0x12')][_0x2444('0x15')]);return _0x14848b(_0x5a30ae['error'][_0x2444('0x15')]);}logger[_0x2444('0x12')](_0x2444('0x14'),_0x59feb5,_0x5a30ae[_0x2444('0x12')][_0x2444('0x15')]);return _0x3f0d43(_0x5a30ae[_0x2444('0x12')][_0x2444('0x15')]);}else{logger['info'](_0x2444('0x14'),_0x59feb5,_0x2444('0xf'));_0x3f0d43(_0x5a30ae[_0x2444('0x16')][_0x2444('0x15')]);}})['catch'](function(_0xf15162){logger[_0x2444('0x12')](_0x2444('0x14'),_0x59feb5,_0xf15162);_0x14848b(_0xf15162);});});}exports[_0x2444('0x17')]=function(_0x5bade3){var _0x163e83=this;return new Promise(function(_0x436836,_0x4376c6){return db[_0x2444('0x18')][_0x2444('0x19')](_0x5bade3[_0x2444('0x1a')],{'raw':_0x5bade3[_0x2444('0x1b')]?_0x5bade3[_0x2444('0x1b')][_0x2444('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bade3[_0x2444('0x1b')]?_0x5bade3['options'][_0x2444('0x1d')]||null:null,'attributes':_0x5bade3[_0x2444('0x1b')]?_0x5bade3[_0x2444('0x1b')]['attributes']||null:null,'limit':_0x5bade3[_0x2444('0x1b')]?_0x5bade3[_0x2444('0x1b')][_0x2444('0x1e')]||null:null})[_0x2444('0xd')](function(_0x239a19){logger[_0x2444('0xe')](_0x2444('0x17'),_0x5bade3);logger[_0x2444('0x10')](_0x2444('0x17'),_0x5bade3,JSON['stringify'](_0x239a19));_0x436836(_0x239a19);})[_0x2444('0x1f')](function(_0x3ed97c){logger[_0x2444('0x12')](_0x2444('0x17'),_0x3ed97c['message'],_0x5bade3);_0x4376c6(_0x163e83[_0x2444('0x12')](0x1f4,_0x3ed97c[_0x2444('0x15')]));});});}; \ No newline at end of file +var _0x559a=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailApplication','update','body','options','where','attributes','limit','then','UpdateMailApplication','debug','lodash','util','moment','bluebird'];(function(_0x186331,_0x2bdd6d){var _0x5bbcaa=function(_0x130ab7){while(--_0x130ab7){_0x186331['push'](_0x186331['shift']());}};_0x5bbcaa(++_0x2bdd6d);}(_0x559a,0xe3));var _0xa559=function(_0x32195d,_0x58f630){_0x32195d=_0x32195d-0x0;var _0x271ed5=_0x559a[_0x32195d];return _0x271ed5;};'use strict';var _=require(_0xa559('0x0'));var util=require(_0xa559('0x1'));var moment=require(_0xa559('0x2'));var BPromise=require(_0xa559('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa559('0x4'));var db=require(_0xa559('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa559('0x6'))(_0xa559('0x7'));var config=require(_0xa559('0x8'));var jayson=require(_0xa559('0x9'));var client=jayson[_0xa559('0xa')][_0xa559('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e5b9a,_0x159f55,_0x766adc){return new BPromise(function(_0x352428,_0x546c5a){return client[_0xa559('0xc')](_0x2e5b9a,_0x766adc)['then'](function(_0xb8ba66){logger[_0xa559('0xd')](_0xa559('0xe'),_0x159f55,_0xa559('0xf'));logger['debug'](_0xa559('0x10'),_0x159f55,_0xa559('0xf'),JSON[_0xa559('0x11')](_0xb8ba66));if(_0xb8ba66['error']){if(_0xb8ba66[_0xa559('0x12')][_0xa559('0x13')]===0x1f4){logger[_0xa559('0x12')]('MailApplication,\x20%s,\x20%s',_0x159f55,_0xb8ba66[_0xa559('0x12')]['message']);return _0x546c5a(_0xb8ba66[_0xa559('0x12')]['message']);}logger[_0xa559('0x12')](_0xa559('0xe'),_0x159f55,_0xb8ba66[_0xa559('0x12')][_0xa559('0x14')]);return _0x352428(_0xb8ba66[_0xa559('0x12')][_0xa559('0x14')]);}else{logger['info'](_0xa559('0xe'),_0x159f55,_0xa559('0xf'));_0x352428(_0xb8ba66[_0xa559('0x15')][_0xa559('0x14')]);}})[_0xa559('0x16')](function(_0x2678db){logger[_0xa559('0x12')]('MailApplication,\x20%s,\x20%s',_0x159f55,_0x2678db);_0x546c5a(_0x2678db);});});}exports['UpdateMailApplication']=function(_0x108841){var _0x27036d=this;return new Promise(function(_0x1e1264,_0x392124){return db[_0xa559('0x17')][_0xa559('0x18')](_0x108841[_0xa559('0x19')],{'raw':_0x108841[_0xa559('0x1a')]?_0x108841[_0xa559('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x108841[_0xa559('0x1a')]?_0x108841[_0xa559('0x1a')][_0xa559('0x1b')]||null:null,'attributes':_0x108841['options']?_0x108841['options'][_0xa559('0x1c')]||null:null,'limit':_0x108841[_0xa559('0x1a')]?_0x108841[_0xa559('0x1a')][_0xa559('0x1d')]||null:null})[_0xa559('0x1e')](function(_0x514863){logger[_0xa559('0xd')](_0xa559('0x1f'),_0x108841);logger[_0xa559('0x20')](_0xa559('0x1f'),_0x108841,JSON[_0xa559('0x11')](_0x514863));_0x1e1264(_0x514863);})[_0xa559('0x16')](function(_0x1343a7){logger[_0xa559('0x12')]('UpdateMailApplication',_0x1343a7['message'],_0x108841);_0x392124(_0x27036d[_0xa559('0x12')](0x1f4,_0x1343a7[_0xa559('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 618971e..5073fe8 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 _0xcf48=['describe','/:id','show','/:id/messages','/:id/download','download','post','addMessage','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','delete','destroy','/:id/tags','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xcf48,0x64));var _0x8cf4=function(_0x3fac84,_0x4c279c){_0x3fac84=_0x3fac84-0x0;var _0x582fbb=_0xcf48[_0x3fac84];return _0x582fbb;};'use strict';var express=require(_0x8cf4('0x0'));var router=express[_0x8cf4('0x1')]();var auth=require(_0x8cf4('0x2'));var interaction=require(_0x8cf4('0x3'));var controller=require('./mailInteraction.controller');router[_0x8cf4('0x4')]('/',auth[_0x8cf4('0x5')](),controller[_0x8cf4('0x6')]);router[_0x8cf4('0x4')](_0x8cf4('0x7'),auth[_0x8cf4('0x5')](),controller[_0x8cf4('0x8')]);router[_0x8cf4('0x4')](_0x8cf4('0x9'),auth[_0x8cf4('0x5')](),controller[_0x8cf4('0xa')]);router[_0x8cf4('0x4')](_0x8cf4('0xb'),auth[_0x8cf4('0x5')](),controller['getMessages']);router[_0x8cf4('0x4')](_0x8cf4('0xc'),auth[_0x8cf4('0x5')](),controller[_0x8cf4('0xd')]);router[_0x8cf4('0xe')]('/',auth[_0x8cf4('0x5')](),controller['create']);router['post'](_0x8cf4('0xb'),auth[_0x8cf4('0x5')](),controller[_0x8cf4('0xf')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0x8cf4('0x10')](_0x8cf4('0x11'),_0x8cf4('0x12')),controller[_0x8cf4('0x13')]);router[_0x8cf4('0x14')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x8cf4('0x11'),_0x8cf4('0x15')),controller['update']);router[_0x8cf4('0x16')]('/:id',auth['isAuthenticated'](),interaction[_0x8cf4('0x10')](_0x8cf4('0x11'),'mailinteraction:destroy'),controller[_0x8cf4('0x17')]);router['delete'](_0x8cf4('0x18'),auth['isAuthenticated'](),controller[_0x8cf4('0x19')]);module[_0x8cf4('0x1a')]=router; \ No newline at end of file +var _0x5001=['update','delete','mailinteraction:destroy','destroy','removeTags','express','Router','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','get','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update'];(function(_0x331c51,_0x42b39b){var _0x5091fa=function(_0xfdac4f){while(--_0xfdac4f){_0x331c51['push'](_0x331c51['shift']());}};_0x5091fa(++_0x42b39b);}(_0x5001,0x1b5));var _0x1500=function(_0x35e31e,_0x2a70a7){_0x35e31e=_0x35e31e-0x0;var _0x281b37=_0x5001[_0x35e31e];return _0x281b37;};'use strict';var express=require(_0x1500('0x0'));var router=express[_0x1500('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x1500('0x2'));var controller=require(_0x1500('0x3'));router['get']('/',auth[_0x1500('0x4')](),controller[_0x1500('0x5')]);router[_0x1500('0x6')]('/describe',auth[_0x1500('0x4')](),controller['describe']);router[_0x1500('0x6')](_0x1500('0x7'),auth[_0x1500('0x4')](),controller[_0x1500('0x8')]);router['get'](_0x1500('0x9'),auth['isAuthenticated'](),controller[_0x1500('0xa')]);router[_0x1500('0x6')](_0x1500('0xb'),auth['isAuthenticated'](),controller[_0x1500('0xc')]);router['post']('/',auth[_0x1500('0x4')](),controller[_0x1500('0xd')]);router['post']('/:id/messages',auth[_0x1500('0x4')](),controller['addMessage']);router[_0x1500('0xe')](_0x1500('0xf'),auth[_0x1500('0x4')](),interaction[_0x1500('0x10')](_0x1500('0x11'),_0x1500('0x12')),controller[_0x1500('0x13')]);router[_0x1500('0x14')](_0x1500('0x7'),auth[_0x1500('0x4')](),interaction[_0x1500('0x10')]('mail',_0x1500('0x15')),controller[_0x1500('0x16')]);router[_0x1500('0x17')](_0x1500('0x7'),auth[_0x1500('0x4')](),interaction['tracked'](_0x1500('0x11'),_0x1500('0x18')),controller[_0x1500('0x19')]);router[_0x1500('0x17')](_0x1500('0xf'),auth['isAuthenticated'](),controller[_0x1500('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index d945dab..e649385 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 _0xbd5f=['STRING','TEXT','long','out','ENUM','sequelize','iconv','exports','BOOLEAN','DATE'];(function(_0x1ff9e0,_0x573a06){var _0x23ebbe=function(_0x3e78ab){while(--_0x3e78ab){_0x1ff9e0['push'](_0x1ff9e0['shift']());}};_0x23ebbe(++_0x573a06);}(_0xbd5f,0x1db));var _0xfbd5=function(_0x1e1029,_0x1d8dad){_0x1e1029=_0x1e1029-0x0;var _0x12d5d1=_0xbd5f[_0x1e1029];return _0x12d5d1;};'use strict';var Sequelize=require(_0xfbd5('0x0'));var iconv=require(_0xfbd5('0x1'));module[_0xfbd5('0x2')]={'closed':{'type':Sequelize[_0xfbd5('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfbd5('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xfbd5('0x5')]},'note':{'type':Sequelize[_0xfbd5('0x5')]},'inReplyTo':{'type':Sequelize[_0xfbd5('0x5')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xfbd5('0x6')](_0xfbd5('0x7'))},'subject':{'type':Sequelize[_0xfbd5('0x6')]()},'attach':{'type':Sequelize[_0xfbd5('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xfbd5('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xfbd5('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xfbd5('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfbd5('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xfbd5('0x9')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xfbd5('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xbc48=['sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','ENUM','out'];(function(_0x275ef6,_0x5587d9){var _0x39f124=function(_0x45cbe6){while(--_0x45cbe6){_0x275ef6['push'](_0x275ef6['shift']());}};_0x39f124(++_0x5587d9);}(_0xbc48,0x90));var _0x8bc4=function(_0x275793,_0x496d98){_0x275793=_0x275793-0x0;var _0x294acc=_0xbc48[_0x275793];return _0x294acc;};'use strict';var Sequelize=require(_0x8bc4('0x0'));var iconv=require(_0x8bc4('0x1'));module[_0x8bc4('0x2')]={'closed':{'type':Sequelize[_0x8bc4('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8bc4('0x4')]},'disposition':{'type':Sequelize[_0x8bc4('0x5')]},'secondDisposition':{'type':Sequelize[_0x8bc4('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8bc4('0x5')]},'inReplyTo':{'type':Sequelize[_0x8bc4('0x5')](0x1fe)},'to':{'type':Sequelize[_0x8bc4('0x5')]},'cc':{'type':Sequelize[_0x8bc4('0x6')]('long')},'subject':{'type':Sequelize[_0x8bc4('0x6')]()},'attach':{'type':Sequelize[_0x8bc4('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x8bc4('0x4')]},'substatus':{'type':Sequelize[_0x8bc4('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x8bc4('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x8bc4('0x7')]('in',_0x8bc4('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8bc4('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x8bc4('0x7')]('in',_0x8bc4('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8bc4('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index b06ab8b..acee9a6 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 _0x553f=['Users','map','fullname','TagIds','Tags','split','forEach','push','MailMessage','-id','trimStart','answered','total','closed','UserId','waiting','talking','unmanaged','MailInteraction','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','mail_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','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','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','having','`\x20>\x200','Contact','operator','value','length','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','end','Tag','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','isNumeric','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','fields','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','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','MailInteractionId','Setting','findOne','enableEmailPreview','all','catch','params','options','create','body','describe','addMessage','ids','omit','getMessages','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','count','includeAll','include','findAll','inlineCss','rows','addTags','setTags','spread','mailInteractionTags:save','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','Attachment','Messages','bcc','subject','createdAt','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','Attachments','basename','existsSync','attachments','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','register','json','offset','undefined','limit','status','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send'];(function(_0xe1b12b,_0x241bd1){var _0x1b697a=function(_0x1ce999){while(--_0x1ce999){_0xe1b12b['push'](_0xe1b12b['shift']());}};_0x1b697a(++_0x241bd1);}(_0x553f,0x1c2));var _0xf553=function(_0x2f7ba8,_0x302127){_0x2f7ba8=_0x2f7ba8-0x0;var _0x43e409=_0x553f[_0x2f7ba8];return _0x43e409;};'use strict';var emlformat=require(_0xf553('0x0'));var rimraf=require(_0xf553('0x1'));var zipdir=require(_0xf553('0x2'));var moment=require(_0xf553('0x3'));var BPromise=require(_0xf553('0x4'));var util=require(_0xf553('0x5'));var path=require(_0xf553('0x6'));var fs=require('fs');var _=require(_0xf553('0x7'));var squel=require(_0xf553('0x8'));var juice=require(_0xf553('0x9'));var Redis=require(_0xf553('0xa'));var qs=require(_0xf553('0xb'));var as=require(_0xf553('0xc'));var logger=require(_0xf553('0xd'))(_0xf553('0xe'));var config=require(_0xf553('0xf'));var db=require(_0xf553('0x10'))['db'];var htmlEntities=require(_0xf553('0x11'));config[_0xf553('0x12')]=_[_0xf553('0x13')](config[_0xf553('0x12')],{'host':_0xf553('0x14'),'port':0x18eb});var socket=require(_0xf553('0x15'))(new Redis(config[_0xf553('0x12')]));require('./mailInteraction.socket')[_0xf553('0x16')](socket);function respondWithStatusCode(_0x4c1110,_0x38604f){_0x38604f=_0x38604f||0xcc;return function(_0x1dd7e3){if(_0x1dd7e3){return _0x4c1110['sendStatus'](_0x38604f);}return _0x4c1110['status'](_0x38604f)['end']();};}function respondWithResult(_0x4a1cbb,_0x45457d){_0x45457d=_0x45457d||0xc8;return function(_0x1091f6){if(_0x1091f6){return _0x4a1cbb['status'](_0x45457d)[_0xf553('0x17')](_0x1091f6);}};}function respondWithFilteredResult(_0x184a72,_0x45aeec){return function(_0x1aa65e){if(_0x1aa65e){var _0x4942ae=typeof _0x45aeec[_0xf553('0x18')]===_0xf553('0x19')&&typeof _0x45aeec[_0xf553('0x1a')]==='undefined';var _0x2d2d3f=_0x1aa65e['count'];var _0x169c00=_0x4942ae?0x0:_0x45aeec['offset'];var _0x4888a7=_0x4942ae?_0x1aa65e['count']:_0x45aeec[_0xf553('0x18')]+_0x45aeec[_0xf553('0x1a')];var _0x282610;if(_0x4888a7>=_0x2d2d3f){_0x4888a7=_0x2d2d3f;_0x282610=0xc8;}else{_0x282610=0xce;}_0x184a72[_0xf553('0x1b')](_0x282610);return _0x184a72[_0xf553('0x1c')](_0xf553('0x1d'),_0x169c00+'-'+_0x4888a7+'/'+_0x2d2d3f)[_0xf553('0x17')](_0x1aa65e);}return null;};}function saveUpdates(_0x509171){return function(_0x428cfe){if(_0x428cfe){return _0x428cfe[_0xf553('0x1e')](_0x509171)[_0xf553('0x1f')](function(_0x5f5a93){return _0x5f5a93;});}return null;};}function removeEntity(_0x2c68ed){return function(_0x5973d5){if(_0x5973d5){return _0x5973d5[_0xf553('0x20')]()['then'](function(){_0x2c68ed[_0xf553('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x398c41){return function(_0x3f88c7){if(!_0x3f88c7){_0x398c41[_0xf553('0x21')](0x194);}return _0x3f88c7;};}function handleError(_0x197000,_0x2c042a){_0x2c042a=_0x2c042a||0x1f4;return function(_0x1edc8c){logger[_0xf553('0x22')](_0x1edc8c[_0xf553('0x23')]);if(_0x1edc8c[_0xf553('0x24')]){delete _0x1edc8c['name'];}_0x197000[_0xf553('0x1b')](_0x2c042a)[_0xf553('0x25')](_0x1edc8c);};}function getInteractionUsers(_0x4cef37,_0x1d2a60){return new BPromise(function(_0x119201,_0x38cee3){try{if(_0x1d2a60[_0x4cef37['id']]){_0x4cef37[_0xf553('0x26')]=_[_0xf553('0x27')](_0x1d2a60[_0x4cef37['id']],function(_0x9c24b0){return{'id':_0x9c24b0['id'],'fullname':_0x9c24b0[_0xf553('0x28')]};});}}catch(_0x1259af){_0x38cee3(_0x1259af);}_0x119201(_0x4cef37);});}function getInteractionTags(_0x1203e5,_0x17df18){return new BPromise(function(_0x136a81,_0x363a45){try{if(_0x1203e5[_0xf553('0x29')]){_0x1203e5[_0xf553('0x2a')]=[];_0x1203e5[_0xf553('0x29')][_0xf553('0x2b')](',')[_0xf553('0x2c')](function(_0x565c8d){_0x1203e5[_0xf553('0x2a')][_0xf553('0x2d')](_0x17df18[_0x565c8d]);});}delete _0x1203e5['TagIds'];}catch(_0x4caa18){_0x363a45(_0x4caa18);}_0x136a81(_0x1203e5);});}function getLastMessageText(_0x3e3056){return new BPromise(function(_0x4c987f,_0x3569ca){return db[_0xf553('0x2e')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x3e3056['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xf553('0x2f'),'raw':!![]})[_0xf553('0x1f')](function(_0x1558c8){if(_0x1558c8&&_0x1558c8['plainBody']){_0x3e3056['lastMsgText']=_[_0xf553('0x30')](_0x1558c8['plainBody']);}_0x4c987f(_0x3e3056);})['catch'](function(_0x32ea10){_0x3569ca(_0x32ea10);});});}function updateMailInteraction(_0xdc10df,_0x35d679,_0x307dfb,_0xb6a127){return new BPromise(function(_0x62c3ac,_0x3749fc){return getInteractionUsers(_0xdc10df,_0x307dfb)[_0xf553('0x1f')](function(_0x534306){return getInteractionTags(_0x534306,_0x35d679);})[_0xf553('0x1f')](function(_0x32965e){return getStateInteraction(_0x32965e);})['then'](function(_0x53f65e){if(_0xb6a127){_0x62c3ac(getLastMessageText(_0x53f65e));}else{_0x62c3ac(_0x53f65e);}})['catch'](function(_0x2e3cc9){_0x3749fc(_0x2e3cc9);});});}function getStateInteraction(_0x4c7cf7){return new BPromise(function(_0x4d1ffe){_0x4c7cf7['waiting']=0x0;_0x4c7cf7['talking']=0x0;_0x4c7cf7[_0xf553('0x31')]=0x0;_0x4c7cf7['unmanaged']=0x0;_0x4c7cf7[_0xf553('0x32')]=0x0;if(!_0x4c7cf7[_0xf553('0x33')]&&!_0x4c7cf7[_0xf553('0x34')]){_0x4c7cf7[_0xf553('0x35')]+=0x1;}if(!_0x4c7cf7[_0xf553('0x33')]&&_0x4c7cf7[_0xf553('0x34')]){_0x4c7cf7['talking']+=0x1;if(_0x4c7cf7['waiting']){_0x4c7cf7[_0xf553('0x35')]-=0x1;}}if(_0x4c7cf7[_0xf553('0x33')]&&_0x4c7cf7[_0xf553('0x34')]){_0x4c7cf7[_0xf553('0x31')]+=0x1;if(_0x4c7cf7[_0xf553('0x36')]){_0x4c7cf7['talking']-=0x1;}}if(_0x4c7cf7[_0xf553('0x33')]&&!_0x4c7cf7[_0xf553('0x34')]){_0x4c7cf7[_0xf553('0x37')]+=0x1;if(_0x4c7cf7[_0xf553('0x35')]){_0x4c7cf7[_0xf553('0x35')]-=0x1;}}_0x4c7cf7[_0xf553('0x32')]+=0x1;_0x4d1ffe(_0x4c7cf7);});}exports['index']=function(_0x48f8d4,_0x318092){var _0x1a1ce5={},_0x5b5e0e={},_0x2b2fe0={'count':0x0,'rows':[]};var _0x296a4c=_['map'](db[_0xf553('0x38')][_0xf553('0x39')],function(_0x2ce89b){return{'name':_0x2ce89b[_0xf553('0x3a')],'type':_0x2ce89b[_0xf553('0x3b')]['key']};});_0x5b5e0e[_0xf553('0x3c')]=_[_0xf553('0x27')](_0x296a4c,_0xf553('0x24'));_0x5b5e0e[_0xf553('0x3d')]=_[_0xf553('0x3e')](_0x48f8d4['query']);_0x5b5e0e[_0xf553('0x3f')]=_[_0xf553('0x40')](_0x5b5e0e['model'],_0x5b5e0e[_0xf553('0x3d')]);_0x1a1ce5['attributes']=_['intersection'](_0x5b5e0e['model'],qs['fields'](_0x48f8d4[_0xf553('0x3d')]['fields']));_0x1a1ce5[_0xf553('0x41')]=_0x1a1ce5[_0xf553('0x41')]['length']?_0x1a1ce5[_0xf553('0x41')]:_0x5b5e0e['model'];if(!_0x48f8d4['query']['hasOwnProperty'](_0xf553('0x42'))){_0x1a1ce5[_0xf553('0x1a')]=qs[_0xf553('0x1a')](_0x48f8d4[_0xf553('0x3d')][_0xf553('0x1a')]);_0x1a1ce5['offset']=qs[_0xf553('0x18')](_0x48f8d4['query'][_0xf553('0x18')]);}_0x1a1ce5[_0xf553('0x43')]=qs[_0xf553('0x44')](_0x48f8d4[_0xf553('0x3d')][_0xf553('0x44')]);_0x1a1ce5[_0xf553('0x45')]=qs['filters'](_[_0xf553('0x46')](_0x48f8d4['query'],_0x5b5e0e[_0xf553('0x3f')]),_0x296a4c);var _0x2e1c84=[];var _0x3dbc8d=squel[_0xf553('0x47')]()[_0xf553('0x48')]('id')[_0xf553('0x48')]('name')[_0xf553('0x48')](_0xf553('0x49'))[_0xf553('0x4a')](_0xf553('0x4b'));var _0x528855=squel[_0xf553('0x47')]()[_0xf553('0x48')](_0xf553('0x4c'))[_0xf553('0x48')](_0xf553('0x4d'))[_0xf553('0x48')](_0xf553('0x4e'))[_0xf553('0x4a')](_0xf553('0x4f'),'ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0x17f9a7=squel['select']()[_0xf553('0x4a')](_0xf553('0x50'),'i')[_0xf553('0x51')]('cm_contacts','c',_0xf553('0x52'))[_0xf553('0x51')](_0xf553('0x53'),'o',_0xf553('0x54'))[_0xf553('0x51')](_0xf553('0x55'),'a',_0xf553('0x56'))[_0xf553('0x51')](_0xf553('0x57'),'me',_0xf553('0x58'))['left_join'](_0xf553('0x59'),'it',_0xf553('0x5a'))[_0xf553('0x51')](_0xf553('0x4b'),'t',_0xf553('0x5b'));var _0x4d3860=squel['expr']();var _0x1074c8=[];var _0x3b3efd=squel[_0xf553('0x5c')]();var _0x2acd85;if(_0x48f8d4[_0xf553('0x3d')][_0xf553('0x5d')]){_0x2acd85=as['parseSearch'](_0x48f8d4['query'][_0xf553('0x5d')]);var _0x29df2d=_0x2acd85[_0xf553('0x5e')];for(var _0x4ae1e7=0x0;_0x4ae1e7<_0x2acd85[_0xf553('0x5f')]['length'];_0x4ae1e7++){var _0x5c5b89=_0x2acd85[_0xf553('0x5f')][_0x4ae1e7];var _0x516c75='i';var _0x587f61=_[_0xf553('0x60')](_0x296a4c,[_0xf553('0x24'),_0x5c5b89['field']]);if(!_0x587f61){switch(_0x5c5b89['field']){case _0xf553('0x61'):if(_0x5c5b89['value']==0x1){_0x17f9a7[_0xf553('0x62')]('`'+_0x5c5b89['field']+'`\x20=\x200');}else{_0x17f9a7[_0xf553('0x62')]('`'+_0x5c5b89[_0xf553('0x48')]+_0xf553('0x63'));}break;case _0xf553('0x64'):if(_0x5c5b89[_0xf553('0x65')]==='$substring'){if(_0x5c5b89[_0xf553('0x66')][_0xf553('0x2b')]('\x20')[_0xf553('0x67')]>0x1){_0x4d3860[_0x29df2d]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf553('0x68')](_0x5c5b89[_0xf553('0x66')]),null);}else{var _0x185403='%'+_0x5c5b89[_0xf553('0x66')]+'%';_0x4d3860[_0x29df2d](_0xf553('0x69'),_0x185403,_0x185403,_0x185403);}}else{_0x587f61=_[_0xf553('0x60')](_0x296a4c,[_0xf553('0x24'),_0xf553('0x6a')]);_0x5c5b89[_0xf553('0x48')]=_0xf553('0x6a');_0x8e30f7=as[_0xf553('0x6b')](_0x516c75,_0x587f61[_0xf553('0x3b')],_0x5c5b89);_0x4d3860[_0x29df2d](_0x8e30f7[_0xf553('0x6c')],_0x8e30f7[_0xf553('0x66')][_0xf553('0x6d')],_0x8e30f7[_0xf553('0x66')][_0xf553('0x6e')]);}break;case _0xf553('0x6f'):var _0x6dcead=_0x5c5b89[_0xf553('0x66')][_0xf553('0x2b')](',')[_0xf553('0x27')](function(_0xd34685){return Number(_0xd34685);});_0x6dcead[_0xf553('0x2c')](function(_0x125e1a){_0x3b3efd['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x125e1a+',%');});_0x1074c8=_[_0xf553('0x70')](_0x1074c8,_0x6dcead);break;case _0xf553('0x71'):if(_0x5c5b89[_0xf553('0x65')]===_0xf553('0x72')){_0x4d3860[_0x29df2d](_0xf553('0x73'),'%'+_0x5c5b89[_0xf553('0x66')]+'%',null);}else{_0x587f61=_[_0xf553('0x60')](_0x296a4c,['name',_0xf553('0x34')]);_0x5c5b89['field']=_0xf553('0x34');_0x8e30f7=as['buildExpression'](_0x516c75,_0x587f61[_0xf553('0x3b')],_0x5c5b89);_0x4d3860[_0x29df2d](_0x8e30f7[_0xf553('0x6c')],_0x8e30f7[_0xf553('0x66')][_0xf553('0x6d')],_0x8e30f7[_0xf553('0x66')][_0xf553('0x6e')]);}break;case'plainBody':_0x8e30f7=as[_0xf553('0x6b')]('me',null,_0x5c5b89);_0x4d3860[_0x29df2d](_0x8e30f7[_0xf553('0x6c')],_0x8e30f7['value']['start'],_0x8e30f7[_0xf553('0x66')]['end']);break;}}else{var _0x8e30f7=as[_0xf553('0x6b')](_0x516c75,_0x587f61[_0xf553('0x3b')],_0x5c5b89);_0x4d3860[_0x29df2d](_0x8e30f7['text'],_0x8e30f7[_0xf553('0x66')][_0xf553('0x6d')],_0x8e30f7[_0xf553('0x66')][_0xf553('0x6e')]);}}}else{var _0x37e4de=_(_0x48f8d4[_0xf553('0x3d')])[_0xf553('0x3e')]()['map'](function(_0x4f3063){return _[_0xf553('0x74')](_0x296a4c,[_0xf553('0x24'),_0x4f3063])?_0x4f3063:undefined;})[_0xf553('0x75')]()[_0xf553('0x66')]();if(!_[_0xf553('0x76')](_0x37e4de)){_0x37e4de[_0xf553('0x2c')](function(_0x46c1b9){if(_0x46c1b9===_0xf553('0x77')){_0x17f9a7[_0xf553('0x45')](_0xf553('0x78'),[][_0xf553('0x79')](_0x48f8d4[_0xf553('0x3d')][_0x46c1b9]));}else if(_0x46c1b9==='createdAt'){var _0x1d108c=JSON['parse'](_0x48f8d4[_0xf553('0x3d')][_0x46c1b9])[_0xf553('0x7a')];var _0x26abcc=JSON[_0xf553('0x7b')](_0x48f8d4[_0xf553('0x3d')][_0x46c1b9])[_0xf553('0x7c')];_0x17f9a7[_0xf553('0x45')](_0xf553('0x7d'),_0x1d108c,_0x26abcc);}else{if(_0x48f8d4['query'][_0x46c1b9]===_0xf553('0x7e')){_0x17f9a7[_0xf553('0x45')]('i.'+_0x46c1b9+_0xf553('0x7f'));}else{_0x17f9a7[_0xf553('0x45')]('i.'+_0x46c1b9+_0xf553('0x80'),_0x48f8d4[_0xf553('0x3d')][_0x46c1b9]);}}});}if(_0x48f8d4['query']['read']){if(_0x48f8d4[_0xf553('0x3d')][_0xf553('0x81')]==0x1){_0x17f9a7[_0xf553('0x62')](_0xf553('0x82'));}else{_0x17f9a7[_0xf553('0x62')](_0xf553('0x83'));}}if(_0x48f8d4[_0xf553('0x3d')][_0xf553('0x84')]){_0x1074c8=_[_0xf553('0x85')](_0x48f8d4['query']['tag'])?_0x48f8d4[_0xf553('0x3d')][_0xf553('0x84')]:new Array(_0x48f8d4[_0xf553('0x3d')][_0xf553('0x84')]);_0x1074c8['forEach'](function(_0x3b4146){_0x3b3efd['or'](_0xf553('0x86'),'%,'+_0x3b4146+',%');});}if(_0x48f8d4[_0xf553('0x3d')][_0xf553('0x87')]){var _0x3f1121=_0x48f8d4[_0xf553('0x3d')]['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xf553('0x88')](_0x3f1121)){_0x4d3860['or']('i.id\x20LIKE\x20?',_0x3f1121+'%');}else if(qs[_0xf553('0x89')](_0x3f1121)){_0x4d3860['or']('c.email\x20LIKE\x20?',_0x3f1121+'%');}else{_0x4d3860['or'](_0xf553('0x8a'),qs['getFullTextValue'](_0x3f1121))['or'](_0xf553('0x8b'),qs[_0xf553('0x68')](_0x3f1121));}}}_0x17f9a7[_0xf553('0x45')](_0x4d3860);_0x17f9a7[_0xf553('0x8c')]('i.id');var _0x248e61={'type':db[_0xf553('0x8d')][_0xf553('0x8e')][_0xf553('0x8f')],'raw':!![]};var _0x421ed7=_0x17f9a7[_0xf553('0x90')]();_0x421ed7[_0xf553('0x48')](_0xf553('0x91'));_0x421ed7[_0xf553('0x48')](_0xf553('0x92'),_0xf553('0x61'));if(_0x1a1ce5[_0xf553('0x43')]){_0x1a1ce5[_0xf553('0x43')][_0xf553('0x2c')](function(_0xb01a43){var _0x23c62d=_0xb01a43[0x0]===_0xf553('0x93')?_0xb01a43[0x0]:'i.'+_0xb01a43[0x0];_0x17f9a7['order'](_0x23c62d,_0xb01a43[0x1]==='DESC'?![]:!![]);});}if(!_[_0xf553('0x76')](_0x1074c8)){_0x17f9a7[_0xf553('0x62')](_0x3b3efd);_0x421ed7[_0xf553('0x45')]('t.id\x20IN\x20?',_0x1074c8);}BPromise[_0xf553('0x94')]()[_0xf553('0x1f')](function(){if(!_0x2acd85){if(_0x48f8d4[_0xf553('0x3d')][_0xf553('0x77')])return;_0x421ed7[_0xf553('0x45')](_0xf553('0x95'));_0x17f9a7[_0xf553('0x45')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x48f8d4[_0xf553('0x96')][_0xf553('0x97')]!==_0xf553('0x98'))return;return _0x48f8d4[_0xf553('0x96')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0xf553('0x1f')](function(_0x1edf2d){if(_['isEmpty'](_0x1edf2d)){_0x421ed7[_0xf553('0x45')](_0xf553('0x99'));_0x17f9a7['where'](_0xf553('0x99'));}else{_0x421ed7[_0xf553('0x45')](_0xf553('0x78'),_[_0xf553('0x27')](_0x1edf2d,'id'));_0x17f9a7[_0xf553('0x45')](_0xf553('0x78'),_[_0xf553('0x27')](_0x1edf2d,'id'));}});})[_0xf553('0x1f')](function(){if(_0x48f8d4[_0xf553('0x96')][_0xf553('0x97')]===_0xf553('0x98')&&!_0x2acd85&&!_0x48f8d4[_0xf553('0x3d')][_0xf553('0x77')])return[];return db[_0xf553('0x9a')][_0xf553('0x3d')](_0x421ed7[_0xf553('0x9b')](),_0x248e61);})[_0xf553('0x1f')](function(_0xffbf05){_0x2b2fe0['count']=_0xffbf05[_0xf553('0x67')];if(_0x2b2fe0['count']===0x0)return[];return db[_0xf553('0x9a')][_0xf553('0x3d')](_0x3dbc8d[_0xf553('0x9b')](),_0x248e61)[_0xf553('0x1f')](function(_0x1ca415){_0x2e1c84=_[_0xf553('0x9c')](_0x1ca415,'id');_0x248e61=_[_0xf553('0x9d')](_0x248e61,{'model':db[_0xf553('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x48f8d4[_0xf553('0x3d')][_0xf553('0x9e')]){_0x1a1ce5[_0xf553('0x41')][_0xf553('0x2c')](function(_0x122f0a){_0x17f9a7['field']('i.'+_0x122f0a);});}else{_0x17f9a7[_0xf553('0x48')](_0xf553('0x92'),'unreadMessages');_0x17f9a7[_0xf553('0x48')](_0xf553('0x9f'),_0xf553('0xa0'));_0x17f9a7[_0xf553('0x48')]('a.mandatoryDisposition',_0xf553('0xa1'));_0x17f9a7[_0xf553('0x48')](_0xf553('0xa2'),_0xf553('0x93'));_0x17f9a7[_0xf553('0x48')](_0xf553('0x91'));_0x17f9a7[_0xf553('0x48')]('i.createdAt');_0x17f9a7['field'](_0xf553('0xa3'));_0x17f9a7[_0xf553('0x48')](_0xf553('0xa4'));_0x17f9a7['field'](_0xf553('0xa5'));_0x17f9a7[_0xf553('0x48')](_0xf553('0xa6'));_0x17f9a7[_0xf553('0x48')](_0xf553('0xa7'));_0x17f9a7[_0xf553('0x48')]('i.lastMsgDirection');_0x17f9a7[_0xf553('0x48')](_0xf553('0xa8'));_0x17f9a7[_0xf553('0x48')](_0xf553('0xa9'));_0x17f9a7[_0xf553('0x48')](_0xf553('0xaa'));_0x17f9a7[_0xf553('0x48')]('i.thirdDisposition');_0x17f9a7[_0xf553('0x48')](_0xf553('0xab'));_0x17f9a7[_0xf553('0x48')](_0xf553('0xac'));_0x17f9a7[_0xf553('0x48')](_0xf553('0xad'));_0x17f9a7[_0xf553('0x48')](_0xf553('0xae'));_0x17f9a7[_0xf553('0x48')](_0xf553('0xaf'));_0x17f9a7[_0xf553('0x48')](_0xf553('0xb0'),_0xf553('0xb1'));_0x17f9a7[_0xf553('0x48')](_0xf553('0xb2'),_0xf553('0xb3'));_0x17f9a7[_0xf553('0x48')](_0xf553('0xb4'),_0xf553('0xb5'));_0x17f9a7[_0xf553('0x48')](_0xf553('0xb6'),'Contact.phone');_0x17f9a7[_0xf553('0x48')](_0xf553('0xb7'),_0xf553('0xb8'));_0x17f9a7['field'](_0xf553('0xb9'),_0xf553('0xba'));_0x17f9a7[_0xf553('0x48')](_0xf553('0xbb'),'Owner.fullname');_0x17f9a7[_0xf553('0x48')](_0xf553('0xbc'),'Owner.internal');_0x17f9a7[_0xf553('0x48')](_0xf553('0xbd'),_0xf553('0x29'));}if(_0x1a1ce5[_0xf553('0x1a')])_0x17f9a7['limit'](_0x1a1ce5[_0xf553('0x1a')]);if(_0x1a1ce5[_0xf553('0x18')])_0x17f9a7['offset'](_0x1a1ce5[_0xf553('0x18')]);return db['sequelize'][_0xf553('0x3d')](_0x17f9a7[_0xf553('0x9b')](),_0x248e61);})['then'](function(_0x506f21){if(_0x506f21[_0xf553('0x67')]>0x0)_0x528855['where'](_0xf553('0xbe'),_[_0xf553('0x27')](_0x506f21,'id'));return db['sequelize'][_0xf553('0x3d')](_0x528855[_0xf553('0x9b')](),_0x248e61)[_0xf553('0x1f')](function(_0x5bd9f6){var _0x30ea4c=_['groupBy'](_0x5bd9f6,_0xf553('0xbf'));var _0x2ea011=[];return db[_0xf553('0xc0')][_0xf553('0xc1')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0xf553('0x1f')](function(_0x5d6c7d){var _0x4c3f55=_0x5d6c7d[_0xf553('0xc2')];_0x506f21['forEach'](function(_0x46ea96){_0x2ea011['push'](updateMailInteraction(_0x46ea96,_0x2e1c84,_0x30ea4c,_0x4c3f55));});return BPromise[_0xf553('0xc3')](_0x2ea011);});});});})[_0xf553('0x1f')](function(_0x28e3dd){_0x2b2fe0['rows']=_0x28e3dd;return _0x2b2fe0;})['then'](respondWithFilteredResult(_0x318092,_0x1a1ce5))[_0xf553('0xc4')](handleError(_0x318092,null));};exports['show']=function(_0x3306b3,_0x1a9961){var _0x395827={'raw':![],'where':{'id':_0x3306b3[_0xf553('0xc5')]['id']}},_0x34524d={};_0x34524d[_0xf553('0x3c')]=_['keys'](db['MailInteraction'][_0xf553('0x39')]);_0x34524d[_0xf553('0x3d')]=_['keys'](_0x3306b3[_0xf553('0x3d')]);_0x34524d['filters']=_[_0xf553('0x40')](_0x34524d[_0xf553('0x3c')],_0x34524d[_0xf553('0x3d')]);_0x395827[_0xf553('0x41')]=_[_0xf553('0x40')](_0x34524d[_0xf553('0x3c')],qs[_0xf553('0x9e')](_0x3306b3[_0xf553('0x3d')][_0xf553('0x9e')]));_0x395827[_0xf553('0x41')]=_0x395827[_0xf553('0x41')][_0xf553('0x67')]?_0x395827[_0xf553('0x41')]:_0x34524d['model'];if(_0x3306b3['query']['includeAll']){_0x395827['include']=[{'all':!![]}];}_0x395827=_['merge']({},_0x395827,_0x3306b3[_0xf553('0xc6')]);return db['MailInteraction'][_0xf553('0x60')](_0x395827)[_0xf553('0x1f')](handleEntityNotFound(_0x1a9961,null))['then'](respondWithResult(_0x1a9961,null))[_0xf553('0xc4')](handleError(_0x1a9961,null));};exports[_0xf553('0xc7')]=function(_0x136dd4,_0x289483){return db[_0xf553('0x38')][_0xf553('0xc7')](_0x136dd4['body'],{})[_0xf553('0x1f')](respondWithResult(_0x289483,0xc9))[_0xf553('0xc4')](handleError(_0x289483,null));};exports['update']=function(_0xbe0be7,_0x9e18e1){if(_0xbe0be7['body']['id']){delete _0xbe0be7[_0xf553('0xc8')]['id'];}return db[_0xf553('0x38')]['find']({'where':{'id':_0xbe0be7[_0xf553('0xc5')]['id']}})[_0xf553('0x1f')](handleEntityNotFound(_0x9e18e1,null))[_0xf553('0x1f')](saveUpdates(_0xbe0be7[_0xf553('0xc8')],null))[_0xf553('0x1f')](respondWithResult(_0x9e18e1,null))['catch'](handleError(_0x9e18e1,null));};exports[_0xf553('0x20')]=function(_0xb23883,_0x4ba334){return db[_0xf553('0x38')][_0xf553('0x60')]({'where':{'id':_0xb23883[_0xf553('0xc5')]['id']}})[_0xf553('0x1f')](handleEntityNotFound(_0x4ba334,null))[_0xf553('0x1f')](removeEntity(_0x4ba334,null))['catch'](handleError(_0x4ba334,null));};exports[_0xf553('0xc9')]=function(_0x5e9e27,_0x497134){return db[_0xf553('0x38')][_0xf553('0xc9')]()[_0xf553('0x1f')](respondWithResult(_0x497134,null))[_0xf553('0xc4')](handleError(_0x497134,null));};exports['addMessage']=function(_0x1b8e42,_0xc6244f){return db[_0xf553('0x2e')]['find']({'where':{'id':_0x1b8e42[_0xf553('0xc5')]['id']}})[_0xf553('0x1f')](handleEntityNotFound(_0xc6244f,null))[_0xf553('0x1f')](function(_0x23da85){if(_0x23da85){return _0x23da85[_0xf553('0xca')](_0x1b8e42[_0xf553('0xc8')][_0xf553('0xcb')],_[_0xf553('0xcc')](_0x1b8e42[_0xf553('0xc8')],[_0xf553('0xcb'),'id'])||{});}})[_0xf553('0x1f')](respondWithResult(_0xc6244f,null))['catch'](handleError(_0xc6244f,null));};exports[_0xf553('0xcd')]=function(_0x14e27f,_0x155bf7){var _0x146981={'raw':![],'where':{}};var _0x1e94af={};var _0x13edcf={'count':0x0,'rows':[]};return db[_0xf553('0x38')][_0xf553('0xc1')]({'where':{'id':_0x14e27f[_0xf553('0xc5')]['id']}})[_0xf553('0x1f')](handleEntityNotFound(_0x155bf7,null))[_0xf553('0x1f')](function(_0x1c0743){if(_0x1c0743){_0x1e94af[_0xf553('0x3c')]=_['keys'](db[_0xf553('0x2e')][_0xf553('0x39')]);_0x1e94af['query']=_[_0xf553('0x3e')](_0x14e27f['query']);_0x1e94af[_0xf553('0x3f')]=_[_0xf553('0x40')](_0x1e94af[_0xf553('0x3c')],_0x1e94af[_0xf553('0x3d')]);_0x146981[_0xf553('0x41')]=_['intersection'](_0x1e94af[_0xf553('0x3c')],qs[_0xf553('0x9e')](_0x14e27f['query']['fields']));_0x146981[_0xf553('0x41')]=_0x146981['attributes'][_0xf553('0x67')]?_0x146981[_0xf553('0x41')]:_0x1e94af[_0xf553('0x3c')];if(!_0x14e27f[_0xf553('0x3d')][_0xf553('0xce')](_0xf553('0x42'))){_0x146981['limit']=qs['limit'](_0x14e27f['query'][_0xf553('0x1a')]);_0x146981['offset']=qs[_0xf553('0x18')](_0x14e27f[_0xf553('0x3d')][_0xf553('0x18')]);}_0x146981[_0xf553('0x43')]=qs[_0xf553('0x44')](_0x14e27f[_0xf553('0x3d')][_0xf553('0x44')]);_0x146981[_0xf553('0x45')]=qs['filters'](_[_0xf553('0x46')](_0x14e27f[_0xf553('0x3d')],_0x1e94af['filters']));_0x146981['where'][_0xf553('0xbf')]=_0x1c0743['id'];if(_0x14e27f[_0xf553('0x3d')][_0xf553('0x87')]){_0x146981['where']=_[_0xf553('0x9d')](_0x146981['where'],{'$or':_[_0xf553('0x27')](_0x146981[_0xf553('0x41')],function(_0x128860){var _0x19ae8e={};_0x19ae8e[_0x128860]={'$like':'%'+_0x14e27f[_0xf553('0x3d')][_0xf553('0x87')]+'%'};return _0x19ae8e;})});}if(_0x14e27f[_0xf553('0x3d')][_0xf553('0x7a')]){var _0x24f3a5=_0x14e27f[_0xf553('0x3d')]['$gte']['split'](',');var _0x119afe={};_0x119afe[_0x24f3a5[0x0]]={'$gte':moment(_0x24f3a5[0x1])[_0xf553('0xcf')](_0xf553('0xd0'))};_0x146981[_0xf553('0x45')]=_['merge'](_0x146981[_0xf553('0x45')],_0x119afe);}_0x146981=_['merge']({},_0x146981,_0x14e27f[_0xf553('0xc6')]);return db[_0xf553('0x2e')][_0xf553('0xd1')]({'where':_0x146981[_0xf553('0x45')]})[_0xf553('0x1f')](function(_0x3adf58){_0x13edcf[_0xf553('0xd1')]=_0x3adf58;if(_0x14e27f[_0xf553('0x3d')][_0xf553('0xd2')]){_0x146981[_0xf553('0xd3')]=[{'all':!![]}];}return db[_0xf553('0x2e')][_0xf553('0xd4')](_0x146981);})[_0xf553('0x1f')](function(_0x3b612c){if(_0x14e27f[_0xf553('0x3d')][_0xf553('0xd5')]==='true'){for(var _0x5081b6=0x0;_0x5081b6<_0x3b612c['length'];_0x5081b6++){_0x3b612c[_0x5081b6]['body']=juice(_0x3b612c[_0x5081b6][_0xf553('0xc8')]);}}_0x13edcf[_0xf553('0xd6')]=_0x3b612c;return _0x13edcf;});}})[_0xf553('0x1f')](respondWithFilteredResult(_0x155bf7,_0x146981))[_0xf553('0xc4')](handleError(_0x155bf7,null));};exports[_0xf553('0xd7')]=function(_0x2c78c6,_0x5ee4b7){return db[_0xf553('0x38')][_0xf553('0x60')]({'where':{'id':_0x2c78c6[_0xf553('0xc5')]['id']}})[_0xf553('0x1f')](handleEntityNotFound(_0x5ee4b7,null))[_0xf553('0x1f')](function(_0x5b5001){if(_0x5b5001){return _0x5b5001[_0xf553('0xd8')](_0x2c78c6[_0xf553('0xc8')][_0xf553('0xcb')],_[_0xf553('0xcc')](_0x2c78c6['body'],['ids','id'])||{})[_0xf553('0xd9')](function(){return db[_0xf553('0x6f')][_0xf553('0xd4')]({'attributes':['id',_0xf553('0x24'),_0xf553('0x49')],'where':{'id':_0x2c78c6[_0xf553('0xc8')][_0xf553('0xcb')]}});})['then'](function(_0x1625f3){socket['emit'](_0xf553('0xda'),{'id':Number(_0x2c78c6[_0xf553('0xc5')]['id']),'tags':_0x1625f3||[]});return{'id':Number(_0x2c78c6['params']['id']),'tags':_0x1625f3||[]};});}})[_0xf553('0x1f')](respondWithResult(_0x5ee4b7,null))[_0xf553('0xc4')](handleError(_0x5ee4b7,null));};exports['removeTags']=function(_0x7ded81,_0x3e2a65){return db[_0xf553('0x38')][_0xf553('0x60')]({'where':{'id':_0x7ded81['params']['id']}})['then'](handleEntityNotFound(_0x3e2a65,null))[_0xf553('0x1f')](function(_0x4f33fb){if(_0x4f33fb){return _0x4f33fb['removeTags'](_0x7ded81[_0xf553('0x3d')][_0xf553('0xcb')]);}})[_0xf553('0x1f')](respondWithStatusCode(_0x3e2a65,null))[_0xf553('0xc4')](handleError(_0x3e2a65,null));};exports[_0xf553('0xdb')]=function(_0x4dd6c4,_0x50a79f){var _0x205d42=moment()[_0xf553('0xdc')]()[_0xf553('0x9b')]();var _0x2ac079=path[_0xf553('0xdd')](config[_0xf553('0xde')],_0xf553('0xdf'),_0xf553('0xe0'),_0xf553('0xe1'));var _0x14809e=path[_0xf553('0xdd')](config['root'],_0xf553('0xdf'),'files','attachments');var _0x4cee3f=path[_0xf553('0xdd')](_0x2ac079,_0x205d42);var _0x7b019b=util[_0xf553('0xcf')](_0xf553('0xe2'),_0x4dd6c4[_0xf553('0xc5')]['id'],_0x205d42);var _0xc2a881=path[_0xf553('0xdd')](_0x2ac079,_0x7b019b);var _0x40ff66=[];if(_0x4dd6c4[_0xf553('0x3d')]['attachments']){_0x40ff66[_0xf553('0x2d')]({'model':db[_0xf553('0xe3')],'as':'Attachments','raw':!![]});}var _0x2894d3=[{'model':db['MailMessage'],'as':_0xf553('0xe4'),'attributes':['id','body',_0xf553('0x4a'),'to','cc',_0xf553('0xe5'),_0xf553('0xe6'),_0xf553('0xe7')],'where':{'secret':![]},'order':qs[_0xf553('0x44')]('id'),'include':_0x40ff66}];return db['MailInteraction'][_0xf553('0x60')]({'where':{'id':_0x4dd6c4[_0xf553('0xc5')]['id']},'include':_0x2894d3})[_0xf553('0x1f')](handleEntityNotFound(_0x50a79f,null))[_0xf553('0x1f')](function(_0x429173){if(_0x429173&&_0x429173['Messages']){var _0x18760e=_0x429173[_0xf553('0xe8')]({'plain':!![]});fs[_0xf553('0xe9')](_0x4cee3f);return BPromise[_0xf553('0xea')](_0x18760e[_0xf553('0xe4')],function(_0x5b0af8,_0x500b7a){var _0x957c6={'from':_0x5b0af8['from'],'to':_0x5b0af8['to'],'subject':_0x5b0af8[_0xf553('0xe6')],'html':htmlEntities[_0xf553('0xeb')](_0x5b0af8[_0xf553('0xc8')]),'headers':{'Date':moment(_0x5b0af8[_0xf553('0xe7')])[_0xf553('0xcf')](_0xf553('0xec'))},'attachments':[]};if(_0x5b0af8['cc']){_0x957c6['headers']['Cc']=_0x5b0af8['cc'];}if(_0x5b0af8['bcc']){_0x957c6['headers'][_0xf553('0xed')]=_0x5b0af8['bcc'];}return new BPromise(function(_0x57d7dc,_0x549689){if(_0x5b0af8[_0xf553('0xee')]){for(var _0x13d46f=0x0;_0x13d46f<_0x5b0af8[_0xf553('0xee')][_0xf553('0x67')];_0x13d46f++){var _0x57e151=_0x5b0af8[_0xf553('0xee')][_0x13d46f];var _0x14548e=path[_0xf553('0xdd')](_0x14809e,_0x57e151[_0xf553('0xef')]);if(fs[_0xf553('0xf0')](_0x14548e)){_0x957c6[_0xf553('0xf1')][_0xf553('0x2d')]({'name':_0x57e151['name'],'contentType':_0x57e151['type'],'data':fs['readFileSync'](_0x14548e)});}}}emlformat['build'](_0x957c6,function(_0xfb6893,_0x499597){if(_0xfb6893)return _0x549689(_0xfb6893);fs['writeFileSync'](path['join'](_0x4cee3f,util['format'](_0xf553('0xf2'),_0x500b7a)),_0x499597);return _0x57d7dc(_0x499597);});});})[_0xf553('0x1f')](function(){return new BPromise(function(_0x3ae065,_0x10bf12){zipdir(_0x4cee3f,{'saveTo':_0xc2a881},function(_0x48227a,_0x428414){if(_0x48227a)return _0x10bf12(_0x48227a);return _0x3ae065(_0x428414);});})[_0xf553('0x1f')](function(){return new BPromise(function(_0x5ba6f1,_0x523334){rimraf(_0x4cee3f,function(_0xbb1e60){if(_0xbb1e60)_0x523334(_0xbb1e60);return _0x5ba6f1();});});})[_0xf553('0x1f')](function(){return _0x50a79f[_0xf553('0xdb')](_0xc2a881,_0x7b019b,function(_0x269b01){if(!_0x269b01)fs[_0xf553('0xf3')](_0xc2a881);});});});}else{return _0x50a79f[_0xf553('0x21')](0xc8);}})[_0xf553('0xc4')](handleError(_0x50a79f,null));}; \ No newline at end of file +var _0xf82b=['it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','Contact','split','getFullTextValue','ContactId','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?','buildExpression','text','start','some','where','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','getMailAccounts','isEmpty','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','i.createdAt','i.updatedAt','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','c.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Owner.fullname','ui.MailInteractionId\x20IN\x20?','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','include','options','create','body','describe','addMessage','ids','omit','$gte','format','includeAll','findAll','inlineCss','addTags','Tag','mailInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachments','Messages','bcc','subject','get','mkdirSync','each','decode','headers','basename','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','squel','juice','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','offset','undefined','limit','count','set','update','then','destroy','sendStatus','name','send','Users','map','fullname','Tags','TagIds','forEach','push','MailMessage','findOne','out','plainBody','-id','lastMsgText','catch','waiting','talking','unmanaged','total','UserId','answered','MailInteraction','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','select','field','color','from','tools_tags','ui.MailInteractionId','user_has_mail_interactions','left_join','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id'];(function(_0x16a6df,_0x58537f){var _0x190c55=function(_0x424b7d){while(--_0x424b7d){_0x16a6df['push'](_0x16a6df['shift']());}};_0x190c55(++_0x58537f);}(_0xf82b,0x89));var _0xbf82=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf82b[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf82('0x0'));var zipdir=require(_0xbf82('0x1'));var moment=require(_0xbf82('0x2'));var BPromise=require(_0xbf82('0x3'));var util=require(_0xbf82('0x4'));var path=require(_0xbf82('0x5'));var fs=require('fs');var _=require(_0xbf82('0x6'));var squel=require(_0xbf82('0x7'));var juice=require(_0xbf82('0x8'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var logger=require(_0xbf82('0x9'))(_0xbf82('0xa'));var config=require(_0xbf82('0xb'));var db=require(_0xbf82('0xc'))['db'];var htmlEntities=require('html-entities');config[_0xbf82('0xd')]=_[_0xbf82('0xe')](config[_0xbf82('0xd')],{'host':_0xbf82('0xf'),'port':0x18eb});var socket=require(_0xbf82('0x10'))(new Redis(config[_0xbf82('0xd')]));require('./mailInteraction.socket')[_0xbf82('0x11')](socket);function respondWithStatusCode(_0x3730d2,_0x1ad97a){_0x1ad97a=_0x1ad97a||0xcc;return function(_0x501f6c){if(_0x501f6c){return _0x3730d2['sendStatus'](_0x1ad97a);}return _0x3730d2[_0xbf82('0x12')](_0x1ad97a)[_0xbf82('0x13')]();};}function respondWithResult(_0x4fc6c9,_0x27116c){_0x27116c=_0x27116c||0xc8;return function(_0x3e6450){if(_0x3e6450){return _0x4fc6c9[_0xbf82('0x12')](_0x27116c)['json'](_0x3e6450);}};}function respondWithFilteredResult(_0x4b34fb,_0x4020f7){return function(_0xf50380){if(_0xf50380){var _0x25842a=typeof _0x4020f7[_0xbf82('0x14')]===_0xbf82('0x15')&&typeof _0x4020f7[_0xbf82('0x16')]===_0xbf82('0x15');var _0x2b5694=_0xf50380['count'];var _0x3c577a=_0x25842a?0x0:_0x4020f7[_0xbf82('0x14')];var _0x21d266=_0x25842a?_0xf50380[_0xbf82('0x17')]:_0x4020f7['offset']+_0x4020f7[_0xbf82('0x16')];var _0x44238c;if(_0x21d266>=_0x2b5694){_0x21d266=_0x2b5694;_0x44238c=0xc8;}else{_0x44238c=0xce;}_0x4b34fb[_0xbf82('0x12')](_0x44238c);return _0x4b34fb[_0xbf82('0x18')]('Content-Range',_0x3c577a+'-'+_0x21d266+'/'+_0x2b5694)['json'](_0xf50380);}return null;};}function saveUpdates(_0x288fba){return function(_0x852ad7){if(_0x852ad7){return _0x852ad7[_0xbf82('0x19')](_0x288fba)[_0xbf82('0x1a')](function(_0x1309d3){return _0x1309d3;});}return null;};}function removeEntity(_0x3f8fc2){return function(_0x3aab51){if(_0x3aab51){return _0x3aab51[_0xbf82('0x1b')]()['then'](function(){_0x3f8fc2[_0xbf82('0x12')](0xcc)[_0xbf82('0x13')]();});}};}function handleEntityNotFound(_0x34564e){return function(_0x37de28){if(!_0x37de28){_0x34564e[_0xbf82('0x1c')](0x194);}return _0x37de28;};}function handleError(_0x5eac63,_0x13f4e3){_0x13f4e3=_0x13f4e3||0x1f4;return function(_0x558b2b){logger['error'](_0x558b2b['stack']);if(_0x558b2b[_0xbf82('0x1d')]){delete _0x558b2b[_0xbf82('0x1d')];}_0x5eac63[_0xbf82('0x12')](_0x13f4e3)[_0xbf82('0x1e')](_0x558b2b);};}function getInteractionUsers(_0x2fccb8,_0x71170b){return new BPromise(function(_0x104b68,_0x49f3b1){try{if(_0x71170b[_0x2fccb8['id']]){_0x2fccb8[_0xbf82('0x1f')]=_[_0xbf82('0x20')](_0x71170b[_0x2fccb8['id']],function(_0x30b3e2){return{'id':_0x30b3e2['id'],'fullname':_0x30b3e2[_0xbf82('0x21')]};});}}catch(_0x492626){_0x49f3b1(_0x492626);}_0x104b68(_0x2fccb8);});}function getInteractionTags(_0x3b6401,_0x5e7d79){return new BPromise(function(_0x443b46,_0x29da54){try{if(_0x3b6401['TagIds']){_0x3b6401[_0xbf82('0x22')]=[];_0x3b6401[_0xbf82('0x23')]['split'](',')[_0xbf82('0x24')](function(_0x589f7b){_0x3b6401[_0xbf82('0x22')][_0xbf82('0x25')](_0x5e7d79[_0x589f7b]);});}delete _0x3b6401[_0xbf82('0x23')];}catch(_0x2be79e){_0x29da54(_0x2be79e);}_0x443b46(_0x3b6401);});}function getLastMessageText(_0x3abb48){return new BPromise(function(_0x53231a,_0x3c8daa){return db[_0xbf82('0x26')][_0xbf82('0x27')]({'where':{'$and':[{'MailInteractionId':_0x3abb48['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xbf82('0x28')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xbf82('0x29')],'order':_0xbf82('0x2a'),'raw':!![]})['then'](function(_0x537219){if(_0x537219&&_0x537219[_0xbf82('0x29')]){_0x3abb48[_0xbf82('0x2b')]=_['trimStart'](_0x537219['plainBody']);}_0x53231a(_0x3abb48);})['catch'](function(_0x45e059){_0x3c8daa(_0x45e059);});});}function updateMailInteraction(_0x2fbbf5,_0x289c15,_0x5666ae,_0x541edb){return new BPromise(function(_0xaa169,_0x38ef9f){return getInteractionUsers(_0x2fbbf5,_0x5666ae)[_0xbf82('0x1a')](function(_0x53e4d2){return getInteractionTags(_0x53e4d2,_0x289c15);})['then'](function(_0x44a2b7){return getStateInteraction(_0x44a2b7);})[_0xbf82('0x1a')](function(_0x250971){if(_0x541edb){_0xaa169(getLastMessageText(_0x250971));}else{_0xaa169(_0x250971);}})[_0xbf82('0x2c')](function(_0x1f9176){_0x38ef9f(_0x1f9176);});});}function getStateInteraction(_0x16dcc2){return new BPromise(function(_0x2d0a02){_0x16dcc2[_0xbf82('0x2d')]=0x0;_0x16dcc2[_0xbf82('0x2e')]=0x0;_0x16dcc2['answered']=0x0;_0x16dcc2[_0xbf82('0x2f')]=0x0;_0x16dcc2[_0xbf82('0x30')]=0x0;if(!_0x16dcc2['closed']&&!_0x16dcc2['UserId']){_0x16dcc2[_0xbf82('0x2d')]+=0x1;}if(!_0x16dcc2['closed']&&_0x16dcc2[_0xbf82('0x31')]){_0x16dcc2[_0xbf82('0x2e')]+=0x1;if(_0x16dcc2[_0xbf82('0x2d')]){_0x16dcc2[_0xbf82('0x2d')]-=0x1;}}if(_0x16dcc2['closed']&&_0x16dcc2[_0xbf82('0x31')]){_0x16dcc2[_0xbf82('0x32')]+=0x1;if(_0x16dcc2['talking']){_0x16dcc2[_0xbf82('0x2e')]-=0x1;}}if(_0x16dcc2['closed']&&!_0x16dcc2['UserId']){_0x16dcc2[_0xbf82('0x2f')]+=0x1;if(_0x16dcc2[_0xbf82('0x2d')]){_0x16dcc2['waiting']-=0x1;}}_0x16dcc2[_0xbf82('0x30')]+=0x1;_0x2d0a02(_0x16dcc2);});}exports['index']=function(_0x216415,_0x91cc65){var _0x57bac1={},_0x5414ca={},_0x42a4a0={'count':0x0,'rows':[]};var _0x3811ef=_['map'](db[_0xbf82('0x33')][_0xbf82('0x34')],function(_0x13224d){return{'name':_0x13224d['fieldName'],'type':_0x13224d[_0xbf82('0x35')][_0xbf82('0x36')]};});_0x5414ca[_0xbf82('0x37')]=_['map'](_0x3811ef,_0xbf82('0x1d'));_0x5414ca[_0xbf82('0x38')]=_[_0xbf82('0x39')](_0x216415[_0xbf82('0x38')]);_0x5414ca['filters']=_[_0xbf82('0x3a')](_0x5414ca['model'],_0x5414ca[_0xbf82('0x38')]);_0x57bac1[_0xbf82('0x3b')]=_[_0xbf82('0x3a')](_0x5414ca[_0xbf82('0x37')],qs[_0xbf82('0x3c')](_0x216415[_0xbf82('0x38')]['fields']));_0x57bac1[_0xbf82('0x3b')]=_0x57bac1['attributes'][_0xbf82('0x3d')]?_0x57bac1[_0xbf82('0x3b')]:_0x5414ca['model'];if(!_0x216415['query'][_0xbf82('0x3e')](_0xbf82('0x3f'))){_0x57bac1[_0xbf82('0x16')]=qs['limit'](_0x216415[_0xbf82('0x38')][_0xbf82('0x16')]);_0x57bac1[_0xbf82('0x14')]=qs['offset'](_0x216415[_0xbf82('0x38')][_0xbf82('0x14')]);}_0x57bac1[_0xbf82('0x40')]=qs[_0xbf82('0x41')](_0x216415['query'][_0xbf82('0x41')]);_0x57bac1['where']=qs['filters'](_[_0xbf82('0x42')](_0x216415['query'],_0x5414ca[_0xbf82('0x43')]),_0x3811ef);var _0x304b4d=[];var _0x59004f=squel[_0xbf82('0x44')]()[_0xbf82('0x45')]('id')[_0xbf82('0x45')](_0xbf82('0x1d'))[_0xbf82('0x45')](_0xbf82('0x46'))[_0xbf82('0x47')](_0xbf82('0x48'));var _0x5f21a6=squel[_0xbf82('0x44')]()[_0xbf82('0x45')]('u.id')[_0xbf82('0x45')]('u.fullname')[_0xbf82('0x45')](_0xbf82('0x49'))[_0xbf82('0x47')](_0xbf82('0x4a'),'ui')[_0xbf82('0x4b')]('users','u','u.id\x20=\x20ui.UserId');var _0x129ed8=squel[_0xbf82('0x44')]()[_0xbf82('0x47')](_0xbf82('0x4c'),'i')[_0xbf82('0x4b')](_0xbf82('0x4d'),'c',_0xbf82('0x4e'))['left_join'](_0xbf82('0x4f'),'o',_0xbf82('0x50'))[_0xbf82('0x4b')]('mail_accounts','a',_0xbf82('0x51'))[_0xbf82('0x4b')](_0xbf82('0x52'),'me',_0xbf82('0x53'))[_0xbf82('0x4b')]('mail_interaction_has_tags','it',_0xbf82('0x54'))[_0xbf82('0x4b')](_0xbf82('0x48'),'t',_0xbf82('0x55'));var _0xee57df=squel[_0xbf82('0x56')]();var _0x362370=[];var _0x3151fb=squel[_0xbf82('0x56')]();var _0x27a50b;if(_0x216415[_0xbf82('0x38')][_0xbf82('0x57')]){_0x27a50b=as[_0xbf82('0x58')](_0x216415[_0xbf82('0x38')][_0xbf82('0x57')]);var _0x1e2339=_0x27a50b[_0xbf82('0x59')];for(var _0x4e39d0=0x0;_0x4e39d0<_0x27a50b[_0xbf82('0x5a')][_0xbf82('0x3d')];_0x4e39d0++){var _0xbde226=_0x27a50b[_0xbf82('0x5a')][_0x4e39d0];var _0x4f6dcd='i';var _0x38420b=_[_0xbf82('0x5b')](_0x3811ef,['name',_0xbde226['field']]);if(!_0x38420b){switch(_0xbde226[_0xbf82('0x45')]){case _0xbf82('0x5c'):if(_0xbde226[_0xbf82('0x5d')]==0x1){_0x129ed8['having']('`'+_0xbde226[_0xbf82('0x45')]+_0xbf82('0x5e'));}else{_0x129ed8[_0xbf82('0x5f')]('`'+_0xbde226[_0xbf82('0x45')]+'`\x20>\x200');}break;case _0xbf82('0x60'):if(_0xbde226['operator']==='$substring'){if(_0xbde226[_0xbf82('0x5d')][_0xbf82('0x61')]('\x20')[_0xbf82('0x3d')]>0x1){_0xee57df[_0x1e2339]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xbf82('0x62')](_0xbde226[_0xbf82('0x5d')]),null);}else{var _0x369069='%'+_0xbde226[_0xbf82('0x5d')]+'%';_0xee57df[_0x1e2339]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x369069,_0x369069,_0x369069);}}else{_0x38420b=_['find'](_0x3811ef,[_0xbf82('0x1d'),_0xbf82('0x63')]);_0xbde226[_0xbf82('0x45')]=_0xbf82('0x63');_0x17d163=as['buildExpression'](_0x4f6dcd,_0x38420b['type'],_0xbde226);_0xee57df[_0x1e2339](_0x17d163['text'],_0x17d163[_0xbf82('0x5d')]['start'],_0x17d163['value'][_0xbf82('0x13')]);}break;case'Tag':var _0xbc5a7a=_0xbde226[_0xbf82('0x5d')][_0xbf82('0x61')](',')['map'](function(_0x1062e9){return Number(_0x1062e9);});_0xbc5a7a[_0xbf82('0x24')](function(_0x464356){_0x3151fb['or'](_0xbf82('0x64'),'%,'+_0x464356+',%');});_0x362370=_[_0xbf82('0x65')](_0x362370,_0xbc5a7a);break;case _0xbf82('0x66'):if(_0xbde226[_0xbf82('0x67')]===_0xbf82('0x68')){_0xee57df[_0x1e2339](_0xbf82('0x69'),'%'+_0xbde226[_0xbf82('0x5d')]+'%',null);}else{_0x38420b=_['find'](_0x3811ef,[_0xbf82('0x1d'),_0xbf82('0x31')]);_0xbde226[_0xbf82('0x45')]=_0xbf82('0x31');_0x17d163=as[_0xbf82('0x6a')](_0x4f6dcd,_0x38420b[_0xbf82('0x35')],_0xbde226);_0xee57df[_0x1e2339](_0x17d163[_0xbf82('0x6b')],_0x17d163[_0xbf82('0x5d')][_0xbf82('0x6c')],_0x17d163['value'][_0xbf82('0x13')]);}break;case'plainBody':_0x17d163=as[_0xbf82('0x6a')]('me',null,_0xbde226);_0xee57df[_0x1e2339](_0x17d163['text'],_0x17d163[_0xbf82('0x5d')][_0xbf82('0x6c')],_0x17d163[_0xbf82('0x5d')][_0xbf82('0x13')]);break;}}else{var _0x17d163=as[_0xbf82('0x6a')](_0x4f6dcd,_0x38420b[_0xbf82('0x35')],_0xbde226);_0xee57df[_0x1e2339](_0x17d163['text'],_0x17d163[_0xbf82('0x5d')][_0xbf82('0x6c')],_0x17d163['value'][_0xbf82('0x13')]);}}}else{var _0x1682ff=_(_0x216415[_0xbf82('0x38')])[_0xbf82('0x39')]()[_0xbf82('0x20')](function(_0x52babb){return _[_0xbf82('0x6d')](_0x3811ef,['name',_0x52babb])?_0x52babb:undefined;})['compact']()[_0xbf82('0x5d')]();if(!_['isEmpty'](_0x1682ff)){_0x1682ff['forEach'](function(_0x176caf){if(_0x176caf==='MailAccountId'){_0x129ed8[_0xbf82('0x6e')]('i.MailAccountId\x20IN\x20?',[]['concat'](_0x216415[_0xbf82('0x38')][_0x176caf]));}else if(_0x176caf===_0xbf82('0x6f')){var _0x103cfd=JSON[_0xbf82('0x70')](_0x216415[_0xbf82('0x38')][_0x176caf])['$gte'];var _0xb496b5=JSON[_0xbf82('0x70')](_0x216415[_0xbf82('0x38')][_0x176caf])['$lte'];_0x129ed8['where'](_0xbf82('0x71'),_0x103cfd,_0xb496b5);}else{if(_0x216415['query'][_0x176caf]===_0xbf82('0x72')){_0x129ed8[_0xbf82('0x6e')]('i.'+_0x176caf+_0xbf82('0x73'));}else{_0x129ed8[_0xbf82('0x6e')]('i.'+_0x176caf+_0xbf82('0x74'),_0x216415[_0xbf82('0x38')][_0x176caf]);}}});}if(_0x216415[_0xbf82('0x38')]['read']){if(_0x216415[_0xbf82('0x38')][_0xbf82('0x75')]==0x1){_0x129ed8[_0xbf82('0x5f')](_0xbf82('0x76'));}else{_0x129ed8[_0xbf82('0x5f')]('`unreadMessages`\x20>\x200');}}if(_0x216415[_0xbf82('0x38')][_0xbf82('0x77')]){_0x362370=_[_0xbf82('0x78')](_0x216415[_0xbf82('0x38')][_0xbf82('0x77')])?_0x216415[_0xbf82('0x38')][_0xbf82('0x77')]:new Array(_0x216415[_0xbf82('0x38')][_0xbf82('0x77')]);_0x362370[_0xbf82('0x24')](function(_0x4ef8f9){_0x3151fb['or'](_0xbf82('0x64'),'%,'+_0x4ef8f9+',%');});}if(_0x216415[_0xbf82('0x38')][_0xbf82('0x79')]){var _0x3d5730=_0x216415[_0xbf82('0x38')][_0xbf82('0x79')][_0xbf82('0x7a')]('\x5c','\x5c\x5c')[_0xbf82('0x7a')](/'/g,'\x27\x27');if(qs[_0xbf82('0x7b')](_0x3d5730)){_0xee57df['or'](_0xbf82('0x7c'),_0x3d5730+'%');}else if(qs[_0xbf82('0x7d')](_0x3d5730)){_0xee57df['or'](_0xbf82('0x7e'),_0x3d5730+'%');}else{_0xee57df['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3d5730))['or'](_0xbf82('0x7f'),qs[_0xbf82('0x62')](_0x3d5730));}}}_0x129ed8[_0xbf82('0x6e')](_0xee57df);_0x129ed8[_0xbf82('0x80')](_0xbf82('0x81'));var _0x1a591f={'type':db[_0xbf82('0x82')]['QueryTypes']['SELECT'],'raw':!![]};var _0x488650=_0x129ed8[_0xbf82('0x83')]();_0x488650[_0xbf82('0x45')](_0xbf82('0x81'));_0x488650[_0xbf82('0x45')](_0xbf82('0x84'),'unreadMessages');if(_0x57bac1['order']){_0x57bac1[_0xbf82('0x40')][_0xbf82('0x24')](function(_0x371901){var _0x3de700=_0x371901[0x0]===_0xbf82('0x85')?_0x371901[0x0]:'i.'+_0x371901[0x0];_0x129ed8[_0xbf82('0x40')](_0x3de700,_0x371901[0x1]===_0xbf82('0x86')?![]:!![]);});}if(!_['isEmpty'](_0x362370)){_0x129ed8['having'](_0x3151fb);_0x488650[_0xbf82('0x6e')](_0xbf82('0x87'),_0x362370);}BPromise[_0xbf82('0x88')]()[_0xbf82('0x1a')](function(){if(!_0x27a50b){if(_0x216415[_0xbf82('0x38')][_0xbf82('0x89')])return;_0x488650[_0xbf82('0x6e')](_0xbf82('0x8a'));_0x129ed8[_0xbf82('0x6e')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x216415[_0xbf82('0x8b')][_0xbf82('0x8c')]!=='agent')return;return _0x216415['user'][_0xbf82('0x8d')]({'attributes':['id'],'raw':!![]})[_0xbf82('0x1a')](function(_0x12b956){if(_[_0xbf82('0x8e')](_0x12b956)){_0x488650[_0xbf82('0x6e')]('i.MailAccountId\x20IS\x20NULL');_0x129ed8[_0xbf82('0x6e')](_0xbf82('0x8f'));}else{_0x488650[_0xbf82('0x6e')](_0xbf82('0x90'),_[_0xbf82('0x20')](_0x12b956,'id'));_0x129ed8['where'](_0xbf82('0x90'),_[_0xbf82('0x20')](_0x12b956,'id'));}});})[_0xbf82('0x1a')](function(){if(_0x216415[_0xbf82('0x8b')]['role']==='agent'&&!_0x27a50b&&!_0x216415['query']['MailAccountId'])return[];return db[_0xbf82('0x91')][_0xbf82('0x38')](_0x488650[_0xbf82('0x92')](),_0x1a591f);})[_0xbf82('0x1a')](function(_0x17e9d4){_0x42a4a0[_0xbf82('0x17')]=_0x17e9d4[_0xbf82('0x3d')];if(_0x42a4a0[_0xbf82('0x17')]===0x0)return[];return db[_0xbf82('0x91')][_0xbf82('0x38')](_0x59004f['toString'](),_0x1a591f)[_0xbf82('0x1a')](function(_0x542e2a){_0x304b4d=_[_0xbf82('0x93')](_0x542e2a,'id');_0x1a591f=_[_0xbf82('0x94')](_0x1a591f,{'model':db[_0xbf82('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x216415[_0xbf82('0x38')][_0xbf82('0x3c')]){_0x57bac1['attributes'][_0xbf82('0x24')](function(_0x5e71cd){_0x129ed8['field']('i.'+_0x5e71cd);});}else{_0x129ed8['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xbf82('0x5c'));_0x129ed8[_0xbf82('0x45')](_0xbf82('0x95'),_0xbf82('0x96'));_0x129ed8[_0xbf82('0x45')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x129ed8[_0xbf82('0x45')]('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',_0xbf82('0x85'));_0x129ed8['field'](_0xbf82('0x81'));_0x129ed8['field'](_0xbf82('0x97'));_0x129ed8[_0xbf82('0x45')](_0xbf82('0x98'));_0x129ed8['field']('i.closed');_0x129ed8[_0xbf82('0x45')](_0xbf82('0x99'));_0x129ed8[_0xbf82('0x45')]('i.attach');_0x129ed8['field'](_0xbf82('0x9a'));_0x129ed8[_0xbf82('0x45')](_0xbf82('0x9b'));_0x129ed8[_0xbf82('0x45')](_0xbf82('0x9c'));_0x129ed8[_0xbf82('0x45')](_0xbf82('0x9d'));_0x129ed8[_0xbf82('0x45')]('i.secondDisposition');_0x129ed8[_0xbf82('0x45')](_0xbf82('0x9e'));_0x129ed8[_0xbf82('0x45')](_0xbf82('0x9f'));_0x129ed8[_0xbf82('0x45')](_0xbf82('0xa0'));_0x129ed8[_0xbf82('0x45')]('i.ContactId');_0x129ed8[_0xbf82('0x45')](_0xbf82('0xa1'));_0x129ed8[_0xbf82('0x45')]('i.UserId');_0x129ed8[_0xbf82('0x45')](_0xbf82('0xa2'),'Contact.firstName');_0x129ed8[_0xbf82('0x45')](_0xbf82('0xa3'),'Contact.lastName');_0x129ed8['field'](_0xbf82('0xa4'),_0xbf82('0xa5'));_0x129ed8[_0xbf82('0x45')](_0xbf82('0xa6'),_0xbf82('0xa7'));_0x129ed8[_0xbf82('0x45')](_0xbf82('0xa8'),_0xbf82('0xa9'));_0x129ed8[_0xbf82('0x45')](_0xbf82('0xaa'),'Contact.fax');_0x129ed8[_0xbf82('0x45')]('o.fullname',_0xbf82('0xab'));_0x129ed8[_0xbf82('0x45')]('o.internal','Owner.internal');_0x129ed8[_0xbf82('0x45')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x57bac1[_0xbf82('0x16')])_0x129ed8[_0xbf82('0x16')](_0x57bac1[_0xbf82('0x16')]);if(_0x57bac1[_0xbf82('0x14')])_0x129ed8[_0xbf82('0x14')](_0x57bac1[_0xbf82('0x14')]);return db['sequelize'][_0xbf82('0x38')](_0x129ed8[_0xbf82('0x92')](),_0x1a591f);})[_0xbf82('0x1a')](function(_0x4f7794){if(_0x4f7794[_0xbf82('0x3d')]>0x0)_0x5f21a6[_0xbf82('0x6e')](_0xbf82('0xac'),_['map'](_0x4f7794,'id'));return db[_0xbf82('0x91')][_0xbf82('0x38')](_0x5f21a6[_0xbf82('0x92')](),_0x1a591f)[_0xbf82('0x1a')](function(_0x1b523b){var _0x15cbf6=_['groupBy'](_0x1b523b,_0xbf82('0xad'));var _0x16fe9b=[];return db[_0xbf82('0xae')][_0xbf82('0x27')]({'attributes':[_0xbf82('0xaf')],'raw':!![]})['then'](function(_0x829cb2){var _0x1973c3=_0x829cb2['enableEmailPreview'];_0x4f7794['forEach'](function(_0x246f1f){_0x16fe9b['push'](updateMailInteraction(_0x246f1f,_0x304b4d,_0x15cbf6,_0x1973c3));});return BPromise[_0xbf82('0xb0')](_0x16fe9b);});});});})[_0xbf82('0x1a')](function(_0x4fa263){_0x42a4a0[_0xbf82('0xb1')]=_0x4fa263;return _0x42a4a0;})[_0xbf82('0x1a')](respondWithFilteredResult(_0x91cc65,_0x57bac1))[_0xbf82('0x2c')](handleError(_0x91cc65,null));};exports[_0xbf82('0xb2')]=function(_0x34f9f8,_0x66353e){var _0x339daf={'raw':![],'where':{'id':_0x34f9f8[_0xbf82('0xb3')]['id']}},_0x104b6b={};_0x104b6b[_0xbf82('0x37')]=_[_0xbf82('0x39')](db[_0xbf82('0x33')][_0xbf82('0x34')]);_0x104b6b['query']=_[_0xbf82('0x39')](_0x34f9f8[_0xbf82('0x38')]);_0x104b6b[_0xbf82('0x43')]=_[_0xbf82('0x3a')](_0x104b6b[_0xbf82('0x37')],_0x104b6b[_0xbf82('0x38')]);_0x339daf[_0xbf82('0x3b')]=_[_0xbf82('0x3a')](_0x104b6b['model'],qs[_0xbf82('0x3c')](_0x34f9f8[_0xbf82('0x38')][_0xbf82('0x3c')]));_0x339daf[_0xbf82('0x3b')]=_0x339daf[_0xbf82('0x3b')]['length']?_0x339daf[_0xbf82('0x3b')]:_0x104b6b[_0xbf82('0x37')];if(_0x34f9f8['query']['includeAll']){_0x339daf[_0xbf82('0xb4')]=[{'all':!![]}];}_0x339daf=_[_0xbf82('0x94')]({},_0x339daf,_0x34f9f8[_0xbf82('0xb5')]);return db[_0xbf82('0x33')][_0xbf82('0x5b')](_0x339daf)[_0xbf82('0x1a')](handleEntityNotFound(_0x66353e,null))['then'](respondWithResult(_0x66353e,null))[_0xbf82('0x2c')](handleError(_0x66353e,null));};exports[_0xbf82('0xb6')]=function(_0x4df895,_0x5a2ee0){return db[_0xbf82('0x33')][_0xbf82('0xb6')](_0x4df895[_0xbf82('0xb7')],{})[_0xbf82('0x1a')](respondWithResult(_0x5a2ee0,0xc9))[_0xbf82('0x2c')](handleError(_0x5a2ee0,null));};exports[_0xbf82('0x19')]=function(_0x5673f3,_0x4c9134){if(_0x5673f3[_0xbf82('0xb7')]['id']){delete _0x5673f3['body']['id'];}return db[_0xbf82('0x33')][_0xbf82('0x5b')]({'where':{'id':_0x5673f3[_0xbf82('0xb3')]['id']}})[_0xbf82('0x1a')](handleEntityNotFound(_0x4c9134,null))[_0xbf82('0x1a')](saveUpdates(_0x5673f3[_0xbf82('0xb7')],null))['then'](respondWithResult(_0x4c9134,null))[_0xbf82('0x2c')](handleError(_0x4c9134,null));};exports[_0xbf82('0x1b')]=function(_0x462b29,_0x336cd1){return db[_0xbf82('0x33')][_0xbf82('0x5b')]({'where':{'id':_0x462b29[_0xbf82('0xb3')]['id']}})[_0xbf82('0x1a')](handleEntityNotFound(_0x336cd1,null))[_0xbf82('0x1a')](removeEntity(_0x336cd1,null))['catch'](handleError(_0x336cd1,null));};exports['describe']=function(_0x133940,_0x249b55){return db[_0xbf82('0x33')][_0xbf82('0xb8')]()[_0xbf82('0x1a')](respondWithResult(_0x249b55,null))[_0xbf82('0x2c')](handleError(_0x249b55,null));};exports[_0xbf82('0xb9')]=function(_0x24a856,_0x5cd8eb){return db[_0xbf82('0x26')]['find']({'where':{'id':_0x24a856[_0xbf82('0xb3')]['id']}})[_0xbf82('0x1a')](handleEntityNotFound(_0x5cd8eb,null))['then'](function(_0x50fd4e){if(_0x50fd4e){return _0x50fd4e[_0xbf82('0xb9')](_0x24a856[_0xbf82('0xb7')][_0xbf82('0xba')],_[_0xbf82('0xbb')](_0x24a856['body'],[_0xbf82('0xba'),'id'])||{});}})[_0xbf82('0x1a')](respondWithResult(_0x5cd8eb,null))[_0xbf82('0x2c')](handleError(_0x5cd8eb,null));};exports['getMessages']=function(_0x1fddb8,_0x4a626a){var _0x9da293={'raw':![],'where':{}};var _0x53a09e={};var _0x38f218={'count':0x0,'rows':[]};return db['MailInteraction'][_0xbf82('0x27')]({'where':{'id':_0x1fddb8['params']['id']}})[_0xbf82('0x1a')](handleEntityNotFound(_0x4a626a,null))[_0xbf82('0x1a')](function(_0x50e56d){if(_0x50e56d){_0x53a09e['model']=_[_0xbf82('0x39')](db['MailMessage'][_0xbf82('0x34')]);_0x53a09e[_0xbf82('0x38')]=_[_0xbf82('0x39')](_0x1fddb8['query']);_0x53a09e[_0xbf82('0x43')]=_[_0xbf82('0x3a')](_0x53a09e[_0xbf82('0x37')],_0x53a09e[_0xbf82('0x38')]);_0x9da293[_0xbf82('0x3b')]=_['intersection'](_0x53a09e['model'],qs[_0xbf82('0x3c')](_0x1fddb8[_0xbf82('0x38')][_0xbf82('0x3c')]));_0x9da293[_0xbf82('0x3b')]=_0x9da293[_0xbf82('0x3b')]['length']?_0x9da293[_0xbf82('0x3b')]:_0x53a09e[_0xbf82('0x37')];if(!_0x1fddb8[_0xbf82('0x38')][_0xbf82('0x3e')](_0xbf82('0x3f'))){_0x9da293[_0xbf82('0x16')]=qs[_0xbf82('0x16')](_0x1fddb8[_0xbf82('0x38')][_0xbf82('0x16')]);_0x9da293[_0xbf82('0x14')]=qs[_0xbf82('0x14')](_0x1fddb8[_0xbf82('0x38')][_0xbf82('0x14')]);}_0x9da293['order']=qs['sort'](_0x1fddb8[_0xbf82('0x38')][_0xbf82('0x41')]);_0x9da293['where']=qs['filters'](_[_0xbf82('0x42')](_0x1fddb8[_0xbf82('0x38')],_0x53a09e[_0xbf82('0x43')]));_0x9da293[_0xbf82('0x6e')][_0xbf82('0xad')]=_0x50e56d['id'];if(_0x1fddb8[_0xbf82('0x38')][_0xbf82('0x79')]){_0x9da293['where']=_['merge'](_0x9da293[_0xbf82('0x6e')],{'$or':_[_0xbf82('0x20')](_0x9da293[_0xbf82('0x3b')],function(_0x37b45f){var _0x5c0315={};_0x5c0315[_0x37b45f]={'$like':'%'+_0x1fddb8[_0xbf82('0x38')][_0xbf82('0x79')]+'%'};return _0x5c0315;})});}if(_0x1fddb8[_0xbf82('0x38')][_0xbf82('0xbc')]){var _0x48b342=_0x1fddb8['query'][_0xbf82('0xbc')][_0xbf82('0x61')](',');var _0xd4fc8c={};_0xd4fc8c[_0x48b342[0x0]]={'$gte':moment(_0x48b342[0x1])[_0xbf82('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')};_0x9da293['where']=_[_0xbf82('0x94')](_0x9da293[_0xbf82('0x6e')],_0xd4fc8c);}_0x9da293=_[_0xbf82('0x94')]({},_0x9da293,_0x1fddb8[_0xbf82('0xb5')]);return db['MailMessage']['count']({'where':_0x9da293['where']})['then'](function(_0x29935c){_0x38f218[_0xbf82('0x17')]=_0x29935c;if(_0x1fddb8['query'][_0xbf82('0xbe')]){_0x9da293['include']=[{'all':!![]}];}return db[_0xbf82('0x26')][_0xbf82('0xbf')](_0x9da293);})['then'](function(_0x222e26){if(_0x1fddb8[_0xbf82('0x38')][_0xbf82('0xc0')]==='true'){for(var _0x23d30b=0x0;_0x23d30b<_0x222e26[_0xbf82('0x3d')];_0x23d30b++){_0x222e26[_0x23d30b]['body']=juice(_0x222e26[_0x23d30b]['body']);}}_0x38f218[_0xbf82('0xb1')]=_0x222e26;return _0x38f218;});}})['then'](respondWithFilteredResult(_0x4a626a,_0x9da293))[_0xbf82('0x2c')](handleError(_0x4a626a,null));};exports[_0xbf82('0xc1')]=function(_0x45c95d,_0x409648){return db[_0xbf82('0x33')][_0xbf82('0x5b')]({'where':{'id':_0x45c95d['params']['id']}})['then'](handleEntityNotFound(_0x409648,null))[_0xbf82('0x1a')](function(_0x3b3ce7){if(_0x3b3ce7){return _0x3b3ce7['setTags'](_0x45c95d[_0xbf82('0xb7')][_0xbf82('0xba')],_[_0xbf82('0xbb')](_0x45c95d['body'],['ids','id'])||{})['spread'](function(){return db[_0xbf82('0xc2')][_0xbf82('0xbf')]({'attributes':['id',_0xbf82('0x1d'),'color'],'where':{'id':_0x45c95d[_0xbf82('0xb7')][_0xbf82('0xba')]}});})['then'](function(_0x54bc63){socket['emit'](_0xbf82('0xc3'),{'id':Number(_0x45c95d[_0xbf82('0xb3')]['id']),'tags':_0x54bc63||[]});return{'id':Number(_0x45c95d[_0xbf82('0xb3')]['id']),'tags':_0x54bc63||[]};});}})[_0xbf82('0x1a')](respondWithResult(_0x409648,null))[_0xbf82('0x2c')](handleError(_0x409648,null));};exports[_0xbf82('0xc4')]=function(_0xe68e7,_0x54e7a1){return db[_0xbf82('0x33')]['find']({'where':{'id':_0xe68e7[_0xbf82('0xb3')]['id']}})[_0xbf82('0x1a')](handleEntityNotFound(_0x54e7a1,null))[_0xbf82('0x1a')](function(_0x5bcb08){if(_0x5bcb08){return _0x5bcb08[_0xbf82('0xc4')](_0xe68e7[_0xbf82('0x38')][_0xbf82('0xba')]);}})[_0xbf82('0x1a')](respondWithStatusCode(_0x54e7a1,null))['catch'](handleError(_0x54e7a1,null));};exports[_0xbf82('0xc5')]=function(_0x5be69d,_0x5024c5){var _0x4169fb=moment()[_0xbf82('0xc6')]()['toString']();var _0x11b1db=path[_0xbf82('0xc7')](config[_0xbf82('0xc8')],_0xbf82('0xc9'),_0xbf82('0xca'),_0xbf82('0xcb'));var _0x32196c=path[_0xbf82('0xc7')](config[_0xbf82('0xc8')],'server',_0xbf82('0xca'),_0xbf82('0xcc'));var _0xb994ce=path[_0xbf82('0xc7')](_0x11b1db,_0x4169fb);var _0x4afa5c=util[_0xbf82('0xbd')](_0xbf82('0xcd'),_0x5be69d[_0xbf82('0xb3')]['id'],_0x4169fb);var _0x18df82=path[_0xbf82('0xc7')](_0x11b1db,_0x4afa5c);var _0x126516=[];if(_0x5be69d[_0xbf82('0x38')][_0xbf82('0xcc')]){_0x126516[_0xbf82('0x25')]({'model':db['Attachment'],'as':_0xbf82('0xce'),'raw':!![]});}var _0x1320d6=[{'model':db[_0xbf82('0x26')],'as':_0xbf82('0xcf'),'attributes':['id','body',_0xbf82('0x47'),'to','cc',_0xbf82('0xd0'),_0xbf82('0xd1'),'createdAt'],'where':{'secret':![]},'order':qs[_0xbf82('0x41')]('id'),'include':_0x126516}];return db[_0xbf82('0x33')][_0xbf82('0x5b')]({'where':{'id':_0x5be69d['params']['id']},'include':_0x1320d6})[_0xbf82('0x1a')](handleEntityNotFound(_0x5024c5,null))[_0xbf82('0x1a')](function(_0xadaacb){if(_0xadaacb&&_0xadaacb[_0xbf82('0xcf')]){var _0x140a55=_0xadaacb[_0xbf82('0xd2')]({'plain':!![]});fs[_0xbf82('0xd3')](_0xb994ce);return BPromise[_0xbf82('0xd4')](_0x140a55[_0xbf82('0xcf')],function(_0x5a1458,_0x134593){var _0x505369={'from':_0x5a1458[_0xbf82('0x47')],'to':_0x5a1458['to'],'subject':_0x5a1458[_0xbf82('0xd1')],'html':htmlEntities[_0xbf82('0xd5')](_0x5a1458['body']),'headers':{'Date':moment(_0x5a1458['createdAt'])[_0xbf82('0xbd')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x5a1458['cc']){_0x505369[_0xbf82('0xd6')]['Cc']=_0x5a1458['cc'];}if(_0x5a1458[_0xbf82('0xd0')]){_0x505369['headers']['Bcc']=_0x5a1458[_0xbf82('0xd0')];}return new BPromise(function(_0x28bb88,_0x4f70ec){if(_0x5a1458[_0xbf82('0xce')]){for(var _0x51634c=0x0;_0x51634c<_0x5a1458[_0xbf82('0xce')][_0xbf82('0x3d')];_0x51634c++){var _0x21a047=_0x5a1458[_0xbf82('0xce')][_0x51634c];var _0xba8430=path[_0xbf82('0xc7')](_0x32196c,_0x21a047[_0xbf82('0xd7')]);if(fs['existsSync'](_0xba8430)){_0x505369[_0xbf82('0xcc')][_0xbf82('0x25')]({'name':_0x21a047['name'],'contentType':_0x21a047[_0xbf82('0x35')],'data':fs[_0xbf82('0xd8')](_0xba8430)});}}}emlformat[_0xbf82('0xd9')](_0x505369,function(_0x407b3e,_0x520225){if(_0x407b3e)return _0x4f70ec(_0x407b3e);fs[_0xbf82('0xda')](path[_0xbf82('0xc7')](_0xb994ce,util[_0xbf82('0xbd')](_0xbf82('0xdb'),_0x134593)),_0x520225);return _0x28bb88(_0x520225);});});})[_0xbf82('0x1a')](function(){return new BPromise(function(_0x4858bd,_0x17a438){zipdir(_0xb994ce,{'saveTo':_0x18df82},function(_0x57d419,_0x4f70c0){if(_0x57d419)return _0x17a438(_0x57d419);return _0x4858bd(_0x4f70c0);});})[_0xbf82('0x1a')](function(){return new BPromise(function(_0x3b61a3,_0x4a59bf){rimraf(_0xb994ce,function(_0x46b621){if(_0x46b621)_0x4a59bf(_0x46b621);return _0x3b61a3();});});})[_0xbf82('0x1a')](function(){return _0x5024c5['download'](_0x18df82,_0x4afa5c,function(_0x5c9804){if(!_0x5c9804)fs[_0xbf82('0xdc')](_0x18df82);});});});}else{return _0x5024c5[_0xbf82('0x1c')](0xc8);}})[_0xbf82('0x2c')](handleError(_0x5024c5,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index d344d39..bd6e9d1 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 _0x9a65=['setMaxListeners','update','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','MailInteraction','MailMessage'];(function(_0x3712a0,_0x42e538){var _0x5395cc=function(_0x355453){while(--_0x355453){_0x3712a0['push'](_0x3712a0['shift']());}};_0x5395cc(++_0x42e538);}(_0x9a65,0x1cd));var _0x59a6=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9a65[_0x6cf19c];return _0xce14f3;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x59a6('0x0'))['db'][_0x59a6('0x1')];var MailMessage=require(_0x59a6('0x0'))['db'][_0x59a6('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x59a6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x59a6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x52da02){return function(_0x2b9a08,_0x7b0f76,_0x428a3c){_0x2b9a08['getUsers']({'attributes':['id'],'raw':!![]})[_0x59a6('0x5')](function(_0x3e152f){_0x2b9a08[_0x59a6('0x6')]('Users',_0x3e152f[_0x59a6('0x7')](function(_0x57175f){return{'id':_0x57175f['id']};}));return MailMessage[_0x59a6('0x8')]({'where':{'MailInteractionId':_0x2b9a08['id'],'direction':'in','read':![]},'raw':!![]});})[_0x59a6('0x5')](function(_0x21818c){_0x2b9a08[_0x59a6('0x6')](_0x59a6('0x9'),_0x21818c[_0x59a6('0xa')]);MailInteractionEvents['emit'](_0x52da02+':'+_0x2b9a08['id'],_0x2b9a08);MailInteractionEvents[_0x59a6('0xb')](_0x52da02,_0x2b9a08);_0x428a3c(null);})[_0x59a6('0xc')](_0x428a3c(null));};}for(var e in events){if(events[_0x59a6('0xd')](e)){var event=events[e];MailInteraction[_0x59a6('0xe')](e,emitEvent(event));}}module[_0x59a6('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0x0604=['hook','exports','MailInteraction','../../mysqldb','setMaxListeners','save','update','getUsers','then','Users','map','setDataValue','unreadMessages','emit','catch','hasOwnProperty'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x0604,0xa2));var _0x4060=function(_0x4f1b29,_0x27531b){_0x4f1b29=_0x4f1b29-0x0;var _0x320db7=_0x0604[_0x4f1b29];return _0x320db7;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0x4060('0x0')];var MailMessage=require(_0x4060('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x4060('0x2')](0x0);var events={'afterCreate':_0x4060('0x3'),'afterUpdate':_0x4060('0x4'),'afterDestroy':'remove'};function emitEvent(_0x40b4a9){return function(_0x3d9970,_0x386deb,_0x46ddfe){_0x3d9970[_0x4060('0x5')]({'attributes':['id'],'raw':!![]})[_0x4060('0x6')](function(_0x3d322f){_0x3d9970['setDataValue'](_0x4060('0x7'),_0x3d322f[_0x4060('0x8')](function(_0x386a1e){return{'id':_0x386a1e['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x3d9970['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4060('0x6')](function(_0x223980){_0x3d9970[_0x4060('0x9')](_0x4060('0xa'),_0x223980['length']);MailInteractionEvents['emit'](_0x40b4a9+':'+_0x3d9970['id'],_0x3d9970);MailInteractionEvents[_0x4060('0xb')](_0x40b4a9,_0x3d9970);_0x46ddfe(null);})[_0x4060('0xc')](_0x46ddfe(null));};}for(var e in events){if(events[_0x4060('0xd')](e)){var event=events[e];MailInteraction[_0x4060('0xe')](e,emitEvent(event));}}module[_0x4060('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 4fecc88..1721f25 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 _0xe00f=['MailInteraction','mail_interactions','fti_mail_interactions','subject','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','models','get','MailMessage','update','then','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailInteraction.attributes'];(function(_0xd839e7,_0x4209e9){var _0xc3cf23=function(_0x16ace2){while(--_0x16ace2){_0xd839e7['push'](_0xd839e7['shift']());}};_0xc3cf23(++_0x4209e9);}(_0xe00f,0x17c));var _0xfe00=function(_0x7729b1,_0x468322){_0x7729b1=_0x7729b1-0x0;var _0x349504=_0xe00f[_0x7729b1];return _0x349504;};'use strict';var _=require(_0xfe00('0x0'));var util=require(_0xfe00('0x1'));var logger=require(_0xfe00('0x2'))(_0xfe00('0x3'));var moment=require(_0xfe00('0x4'));var BPromise=require(_0xfe00('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe00('0x6'));var rimraf=require(_0xfe00('0x7'));var config=require(_0xfe00('0x8'));var attributes=require(_0xfe00('0x9'));module['exports']=function(_0x1b72f7,_0x5bb380){return _0x1b72f7['define'](_0xfe00('0xa'),attributes,{'tableName':_0xfe00('0xb'),'paranoid':![],'indexes':[{'name':_0xfe00('0xc'),'fields':[_0xfe00('0xd'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xfeb62,_0x41c1bd,_0x583d00){if(_0xfeb62[_0xfe00('0xe')]){_0xfeb62[_0xfe00('0xf')]=moment()['format'](_0xfe00('0x10'));}if(_0xfeb62[_0xfe00('0x11')]){_0xfeb62[_0xfe00('0x12')]=moment()[_0xfe00('0x13')]('YYYY-MM-DD\x20HH:mm:ss');}_0x583d00(null,_0x41c1bd);},'beforeUpdate':function(_0x207d9d,_0xbdec77,_0x3cbec5){if(_0x207d9d['changed'](_0xfe00('0xe'))){_0x207d9d[_0xfe00('0xf')]=_0x207d9d[_0xfe00('0xe')]?moment()['format'](_0xfe00('0x10')):null;}if(_0x207d9d['changed'](_0xfe00('0x11'))){_0x207d9d['closedAt']=moment()['format'](_0xfe00('0x10'));_0x207d9d[_0xfe00('0xe')]=null;_0x207d9d['substatusAt']=null;}_0x3cbec5(null,_0x207d9d);},'afterUpdate':function(_0x1018e7,_0x22777b,_0xed1e45){var _0x2c888e=_0x1b72f7[_0xfe00('0x14')];var _0x3b288a=_0x1018e7[_0xfe00('0x15')]({'plain':!![]});if(_0x3b288a[_0xfe00('0x11')]){return _0x2c888e[_0xfe00('0x16')][_0xfe00('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x3b288a['id']}})[_0xfe00('0x18')](function(){_0xed1e45();})['catch'](function(_0x45f476){_0xed1e45(_0x45f476);});}else{_0xed1e45();}}},'charset':_0xfe00('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2276=['./mailInteraction.attributes','define','MailInteraction','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','then','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x2f479d,_0x1d6836){var _0x300d48=function(_0x338a74){while(--_0x338a74){_0x2f479d['push'](_0x2f479d['shift']());}};_0x300d48(++_0x1d6836);}(_0x2276,0x1a1));var _0x6227=function(_0x561771,_0x554760){_0x561771=_0x561771-0x0;var _0x54d16e=_0x2276[_0x561771];return _0x54d16e;};'use strict';var _=require(_0x6227('0x0'));var util=require(_0x6227('0x1'));var logger=require(_0x6227('0x2'))(_0x6227('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6227('0x4'));var fs=require('fs');var path=require(_0x6227('0x5'));var rimraf=require(_0x6227('0x6'));var config=require(_0x6227('0x7'));var attributes=require(_0x6227('0x8'));module['exports']=function(_0x2ee517,_0x10149b){return _0x2ee517[_0x6227('0x9')](_0x6227('0xa'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x6227('0xb'),'fields':['subject','to'],'type':_0x6227('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4e00f7,_0x17abdf,_0xbb88ba){if(_0x4e00f7[_0x6227('0xd')]){_0x4e00f7[_0x6227('0xe')]=moment()[_0x6227('0xf')](_0x6227('0x10'));}if(_0x4e00f7[_0x6227('0x11')]){_0x4e00f7[_0x6227('0x12')]=moment()[_0x6227('0xf')](_0x6227('0x10'));}_0xbb88ba(null,_0x17abdf);},'beforeUpdate':function(_0x341cd0,_0x274ff4,_0x5bab81){if(_0x341cd0[_0x6227('0x13')](_0x6227('0xd'))){_0x341cd0[_0x6227('0xe')]=_0x341cd0[_0x6227('0xd')]?moment()[_0x6227('0xf')](_0x6227('0x10')):null;}if(_0x341cd0[_0x6227('0x13')](_0x6227('0x11'))){_0x341cd0[_0x6227('0x12')]=moment()['format'](_0x6227('0x10'));_0x341cd0['substatus']=null;_0x341cd0[_0x6227('0xe')]=null;}_0x5bab81(null,_0x341cd0);},'afterUpdate':function(_0x31d203,_0x2d731b,_0x13ea60){var _0x303fc3=_0x2ee517[_0x6227('0x14')];var _0x533306=_0x31d203[_0x6227('0x15')]({'plain':!![]});if(_0x533306['closed']){return _0x303fc3[_0x6227('0x16')][_0x6227('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x533306['id']}})[_0x6227('0x18')](function(){_0x13ea60();})['catch'](function(_0x4bdd06){_0x13ea60(_0x4bdd06);});}else{_0x13ea60();}}},'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 d93b552..3634a3d 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 _0x6788=['socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailInteraction','update','options','raw','where','debug','stringify','AddTagsToMailInteraction','MailInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x2b7248,_0x17b24e){var _0x418838=function(_0x3fc27d){while(--_0x3fc27d){_0x2b7248['push'](_0x2b7248['shift']());}};_0x418838(++_0x17b24e);}(_0x6788,0xfa));var _0x8678=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x6788[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x8678('0x0'));var util=require(_0x8678('0x1'));var moment=require(_0x8678('0x2'));var BPromise=require(_0x8678('0x3'));var rs=require(_0x8678('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8678('0x5'))(_0x8678('0x6'));var config=require(_0x8678('0x7'));var jayson=require(_0x8678('0x8'));var client=jayson[_0x8678('0x9')][_0x8678('0xa')]({'port':0x232a});config[_0x8678('0xb')]=_[_0x8678('0xc')](config[_0x8678('0xb')],{'host':_0x8678('0xd'),'port':0x18eb});var socket=require(_0x8678('0xe'))(new Redis(config['redis']));require(_0x8678('0xf'))[_0x8678('0x10')](socket);function respondWithRpcPromise(_0x19648e,_0x4623d4,_0x3c6652){return new BPromise(function(_0x466c3b,_0x37249a){return client[_0x8678('0x11')](_0x19648e,_0x3c6652)[_0x8678('0x12')](function(_0x472da5){logger[_0x8678('0x13')](_0x8678('0x14'),_0x4623d4,_0x8678('0x15'));logger['debug'](_0x8678('0x16'),_0x4623d4,_0x8678('0x15'),JSON['stringify'](_0x472da5));if(_0x472da5[_0x8678('0x17')]){if(_0x472da5[_0x8678('0x17')][_0x8678('0x18')]===0x1f4){logger[_0x8678('0x17')](_0x8678('0x14'),_0x4623d4,_0x472da5['error'][_0x8678('0x19')]);return _0x37249a(_0x472da5[_0x8678('0x17')][_0x8678('0x19')]);}logger[_0x8678('0x17')](_0x8678('0x14'),_0x4623d4,_0x472da5[_0x8678('0x17')]['message']);return _0x466c3b(_0x472da5['error']['message']);}else{logger[_0x8678('0x13')](_0x8678('0x14'),_0x4623d4,'request\x20sent');_0x466c3b(_0x472da5[_0x8678('0x1a')]['message']);}})[_0x8678('0x1b')](function(_0x66a0e7){logger[_0x8678('0x17')]('MailInteraction,\x20%s,\x20%s',_0x4623d4,_0x66a0e7);_0x37249a(_0x66a0e7);});});}exports[_0x8678('0x1c')]=function(_0x2a7cf8){var _0x5aaaf0=this;return new Promise(function(_0x4b79a9,_0x2659b9){return db['MailInteraction'][_0x8678('0x1d')](_0x2a7cf8['body'],{'raw':_0x2a7cf8['options']?_0x2a7cf8[_0x8678('0x1e')][_0x8678('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a7cf8[_0x8678('0x1e')]?_0x2a7cf8['options'][_0x8678('0x20')]||null:null,'attributes':_0x2a7cf8['options']?_0x2a7cf8[_0x8678('0x1e')]['attributes']||null:null,'limit':_0x2a7cf8[_0x8678('0x1e')]?_0x2a7cf8[_0x8678('0x1e')]['limit']||null:null})[_0x8678('0x12')](function(_0x19301b){logger[_0x8678('0x13')]('UpdateMailInteraction',_0x2a7cf8);logger[_0x8678('0x21')]('UpdateMailInteraction',_0x2a7cf8,JSON[_0x8678('0x22')](_0x19301b));_0x4b79a9(_0x19301b);})[_0x8678('0x1b')](function(_0x1bd5b9){logger[_0x8678('0x17')](_0x8678('0x1c'),_0x1bd5b9[_0x8678('0x19')],_0x2a7cf8);_0x2659b9(_0x5aaaf0[_0x8678('0x17')](0x1f4,_0x1bd5b9['message']));});});};exports[_0x8678('0x23')]=function(_0x332c52){return new Promise(function(_0x1f0379,_0x2369e0){return db[_0x8678('0x24')][_0x8678('0x25')]({'where':_0x332c52[_0x8678('0x1e')]?_0x332c52[_0x8678('0x1e')][_0x8678('0x20')]||null:null})[_0x8678('0x12')](function(_0x2bdc5a){if(_0x2bdc5a){return _0x2bdc5a[_0x8678('0x26')](_0x332c52[_0x8678('0x27')][_0x8678('0x28')],_[_0x8678('0x29')](_0x332c52[_0x8678('0x27')],[_0x8678('0x28'),'id'])||{});}})[_0x8678('0x2a')](function(_0x4db654){logger['info'](_0x8678('0x2b'),_0x332c52);logger['debug'](_0x8678('0x2b'),_0x332c52,JSON[_0x8678('0x22')](_0x4db654));_0x1f0379(_0x4db654);})[_0x8678('0x1b')](function(_0x461019){logger[_0x8678('0x17')](_0x8678('0x2b'),_0x461019[_0x8678('0x19')],_0x332c52);_0x2369e0(_this['error'](0x1f4,_0x461019[_0x8678('0x19')]));});});}; \ No newline at end of file +var _0xfa74=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','UpdateMailInteraction','MailInteraction','body','options','where','attributes','limit','AddTagsToMailInteraction','find','addTags','ids','omit','AddTags'];(function(_0x2261e0,_0x2abd54){var _0x4ad95f=function(_0xfd0f7a){while(--_0xfd0f7a){_0x2261e0['push'](_0x2261e0['shift']());}};_0x4ad95f(++_0x2abd54);}(_0xfa74,0x1b0));var _0x4fa7=function(_0x6c7390,_0x11febc){_0x6c7390=_0x6c7390-0x0;var _0x5d94d0=_0xfa74[_0x6c7390];return _0x5d94d0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4fa7('0x0'));var BPromise=require('bluebird');var rs=require(_0x4fa7('0x1'));var fs=require('fs');var Redis=require(_0x4fa7('0x2'));var db=require(_0x4fa7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4fa7('0x4'))(_0x4fa7('0x5'));var config=require(_0x4fa7('0x6'));var jayson=require(_0x4fa7('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x4fa7('0x8')]=_['defaults'](config[_0x4fa7('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x4fa7('0x9'))(new Redis(config['redis']));require(_0x4fa7('0xa'))[_0x4fa7('0xb')](socket);function respondWithRpcPromise(_0x18d650,_0xd437f4,_0xdadb3f){return new BPromise(function(_0x4945a8,_0x309db8){return client[_0x4fa7('0xc')](_0x18d650,_0xdadb3f)[_0x4fa7('0xd')](function(_0x38425e){logger[_0x4fa7('0xe')](_0x4fa7('0xf'),_0xd437f4,_0x4fa7('0x10'));logger[_0x4fa7('0x11')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0xd437f4,'request\x20sent',JSON[_0x4fa7('0x12')](_0x38425e));if(_0x38425e[_0x4fa7('0x13')]){if(_0x38425e[_0x4fa7('0x13')][_0x4fa7('0x14')]===0x1f4){logger[_0x4fa7('0x13')](_0x4fa7('0xf'),_0xd437f4,_0x38425e[_0x4fa7('0x13')][_0x4fa7('0x15')]);return _0x309db8(_0x38425e[_0x4fa7('0x13')][_0x4fa7('0x15')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0xd437f4,_0x38425e['error'][_0x4fa7('0x15')]);return _0x4945a8(_0x38425e[_0x4fa7('0x13')][_0x4fa7('0x15')]);}else{logger[_0x4fa7('0xe')](_0x4fa7('0xf'),_0xd437f4,_0x4fa7('0x10'));_0x4945a8(_0x38425e['result']['message']);}})[_0x4fa7('0x16')](function(_0x531f10){logger['error'](_0x4fa7('0xf'),_0xd437f4,_0x531f10);_0x309db8(_0x531f10);});});}exports[_0x4fa7('0x17')]=function(_0x3bdbc3){var _0x40f6b8=this;return new Promise(function(_0x34976b,_0x4869ef){return db[_0x4fa7('0x18')]['update'](_0x3bdbc3[_0x4fa7('0x19')],{'raw':_0x3bdbc3['options']?_0x3bdbc3['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bdbc3[_0x4fa7('0x1a')]?_0x3bdbc3[_0x4fa7('0x1a')][_0x4fa7('0x1b')]||null:null,'attributes':_0x3bdbc3[_0x4fa7('0x1a')]?_0x3bdbc3['options'][_0x4fa7('0x1c')]||null:null,'limit':_0x3bdbc3['options']?_0x3bdbc3[_0x4fa7('0x1a')][_0x4fa7('0x1d')]||null:null})[_0x4fa7('0xd')](function(_0x4b2f4d){logger[_0x4fa7('0xe')]('UpdateMailInteraction',_0x3bdbc3);logger[_0x4fa7('0x11')](_0x4fa7('0x17'),_0x3bdbc3,JSON[_0x4fa7('0x12')](_0x4b2f4d));_0x34976b(_0x4b2f4d);})[_0x4fa7('0x16')](function(_0x164795){logger[_0x4fa7('0x13')](_0x4fa7('0x17'),_0x164795[_0x4fa7('0x15')],_0x3bdbc3);_0x4869ef(_0x40f6b8[_0x4fa7('0x13')](0x1f4,_0x164795[_0x4fa7('0x15')]));});});};exports[_0x4fa7('0x1e')]=function(_0x28c058){return new Promise(function(_0x3a8bf0,_0x541d6c){return db[_0x4fa7('0x18')][_0x4fa7('0x1f')]({'where':_0x28c058[_0x4fa7('0x1a')]?_0x28c058[_0x4fa7('0x1a')][_0x4fa7('0x1b')]||null:null})[_0x4fa7('0xd')](function(_0x26b935){if(_0x26b935){return _0x26b935[_0x4fa7('0x20')](_0x28c058[_0x4fa7('0x19')][_0x4fa7('0x21')],_[_0x4fa7('0x22')](_0x28c058[_0x4fa7('0x19')],['ids','id'])||{});}})['spread'](function(_0x3a97c0){logger['info'](_0x4fa7('0x23'),_0x28c058);logger['debug']('AddTags',_0x28c058,JSON[_0x4fa7('0x12')](_0x3a97c0));_0x3a8bf0(_0x3a97c0);})[_0x4fa7('0x16')](function(_0x57466b){logger[_0x4fa7('0x13')](_0x4fa7('0x23'),_0x57466b[_0x4fa7('0x15')],_0x28c058);_0x541d6c(_this[_0x4fa7('0x13')](0x1f4,_0x57466b['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index bd709f1..96ddcba 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 _0x2c57=['update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events','save','remove'];(function(_0x151334,_0x1e11ac){var _0x3d03da=function(_0x2099cf){while(--_0x2099cf){_0x151334['push'](_0x151334['shift']());}};_0x3d03da(++_0x1e11ac);}(_0x2c57,0x14a));var _0x72c5=function(_0x592e34,_0x2265f2){_0x592e34=_0x592e34-0x0;var _0x4a3353=_0x2c57[_0x592e34];return _0x4a3353;};'use strict';var MailInteractionEvents=require(_0x72c5('0x0'));var events=[_0x72c5('0x1'),_0x72c5('0x2'),_0x72c5('0x3')];function createListener(_0x314fda,_0x484a3d){return function(_0x5d012f){_0x484a3d[_0x72c5('0x4')](_0x314fda,_0x5d012f);};}function removeListener(_0x2c5e71,_0x2f21db){return function(){MailInteractionEvents[_0x72c5('0x5')](_0x2c5e71,_0x2f21db);};}exports[_0x72c5('0x6')]=function(_0x4a0bcd){for(var _0x4fac76=0x0,_0x3da2f1=events[_0x72c5('0x7')];_0x4fac76<_0x3da2f1;_0x4fac76++){var _0x32f89c=events[_0x4fac76];var _0x5f096c=createListener(_0x72c5('0x8')+_0x32f89c,_0x4a0bcd);MailInteractionEvents['on'](_0x32f89c,_0x5f096c);}}; \ No newline at end of file +var _0x0873=['update','length','mailInteraction:','./mailInteraction.events','save','remove'];(function(_0x2d9da8,_0x5d5072){var _0x57a29c=function(_0x2f562d){while(--_0x2f562d){_0x2d9da8['push'](_0x2d9da8['shift']());}};_0x57a29c(++_0x5d5072);}(_0x0873,0xb1));var _0x3087=function(_0x1dcc9f,_0x11c9ec){_0x1dcc9f=_0x1dcc9f-0x0;var _0x3693c3=_0x0873[_0x1dcc9f];return _0x3693c3;};'use strict';var MailInteractionEvents=require(_0x3087('0x0'));var events=[_0x3087('0x1'),_0x3087('0x2'),_0x3087('0x3')];function createListener(_0x28a501,_0x31d4e2){return function(_0xe35eff){_0x31d4e2['emit'](_0x28a501,_0xe35eff);};}function removeListener(_0x50f889,_0x7fc0ba){return function(){MailInteractionEvents['removeListener'](_0x50f889,_0x7fc0ba);};}exports['register']=function(_0x16b270){for(var _0x394df3=0x0,_0x3ae874=events[_0x3087('0x4')];_0x394df3<_0x3ae874;_0x394df3++){var _0x598ea9=events[_0x394df3];var _0x985e9e=createListener(_0x3087('0x5')+_0x598ea9,_0x16b270);MailInteractionEvents['on'](_0x598ea9,_0x985e9e);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 040afdd..d8cfe8b 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 _0x4ffa=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','download','post','tracked','mailmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5526fa,_0x20d96c){var _0x5e59b5=function(_0x1a46dc){while(--_0x1a46dc){_0x5526fa['push'](_0x5526fa['shift']());}};_0x5e59b5(++_0x20d96c);}(_0x4ffa,0x124));var _0xa4ff=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x4ffa[_0x178e48];return _0x440d7e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa4ff('0x0'));var timeout=require('connect-timeout');var express=require(_0xa4ff('0x1'));var router=express[_0xa4ff('0x2')]();var fs_extra=require(_0xa4ff('0x3'));var auth=require(_0xa4ff('0x4'));var interaction=require(_0xa4ff('0x5'));var config=require(_0xa4ff('0x6'));var controller=require('./mailMessage.controller');router[_0xa4ff('0x7')]('/',auth[_0xa4ff('0x8')](),controller[_0xa4ff('0x9')]);router['get'](_0xa4ff('0xa'),auth['isAuthenticated'](),controller[_0xa4ff('0xb')]);router[_0xa4ff('0x7')](_0xa4ff('0xc'),auth['isAuthenticated'](),controller[_0xa4ff('0xd')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xa4ff('0xe')]);router[_0xa4ff('0xf')]('/',auth[_0xa4ff('0x8')](),interaction[_0xa4ff('0x10')]('mail',_0xa4ff('0x11')),controller[_0xa4ff('0x12')]);router['put'](_0xa4ff('0xc'),auth[_0xa4ff('0x8')](),controller['update']);router[_0xa4ff('0x13')](_0xa4ff('0x14'),auth['isAuthenticated'](),controller[_0xa4ff('0x15')]);router['put'](_0xa4ff('0x16'),auth['isAuthenticated'](),controller[_0xa4ff('0x17')]);router[_0xa4ff('0x18')]('/:id',auth[_0xa4ff('0x8')](),controller[_0xa4ff('0x19')]);module[_0xa4ff('0x1a')]=router; \ No newline at end of file +var _0x4edf=['/:id','download','post','tracked','mail','mailmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x58ec5e,_0x38af9e){var _0x1861e0=function(_0x49db85){while(--_0x49db85){_0x58ec5e['push'](_0x58ec5e['shift']());}};_0x1861e0(++_0x38af9e);}(_0x4edf,0x196));var _0xf4ed=function(_0x5bf420,_0x2d068d){_0x5bf420=_0x5bf420-0x0;var _0x1c5255=_0x4edf[_0x5bf420];return _0x1c5255;};'use strict';var multer=require(_0xf4ed('0x0'));var util=require(_0xf4ed('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf4ed('0x2'));var router=express[_0xf4ed('0x3')]();var fs_extra=require(_0xf4ed('0x4'));var auth=require(_0xf4ed('0x5'));var interaction=require(_0xf4ed('0x6'));var config=require(_0xf4ed('0x7'));var controller=require(_0xf4ed('0x8'));router[_0xf4ed('0x9')]('/',auth['isAuthenticated'](),controller[_0xf4ed('0xa')]);router[_0xf4ed('0x9')](_0xf4ed('0xb'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0xd')]);router[_0xf4ed('0x9')](_0xf4ed('0xe'),auth[_0xf4ed('0xc')](),controller['show']);router[_0xf4ed('0x9')]('/:id/download',auth[_0xf4ed('0xc')](),controller[_0xf4ed('0xf')]);router[_0xf4ed('0x10')]('/',auth[_0xf4ed('0xc')](),interaction[_0xf4ed('0x11')](_0xf4ed('0x12'),_0xf4ed('0x13')),controller[_0xf4ed('0x14')]);router[_0xf4ed('0x15')](_0xf4ed('0xe'),auth[_0xf4ed('0xc')](),controller['update']);router['put'](_0xf4ed('0x16'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x17')]);router[_0xf4ed('0x15')](_0xf4ed('0x18'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x19')]);router['delete']('/:id',auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x1a')]);module[_0xf4ed('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index c2c3d69..b5b6ed7 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 _0xdae5=['BOOLEAN','out','STRING','INTEGER','ENUM','Email','Chat','exports','TEXT','long','medium'];(function(_0x2e77d7,_0x11d2ca){var _0x3b06ef=function(_0x270ba0){while(--_0x270ba0){_0x2e77d7['push'](_0x2e77d7['shift']());}};_0x3b06ef(++_0x11d2ca);}(_0xdae5,0x1e0));var _0x5dae=function(_0x3e6fe6,_0x3dc811){_0x3e6fe6=_0x3e6fe6-0x0;var _0xedaf09=_0xdae5[_0x3e6fe6];return _0xedaf09;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x5dae('0x0')]={'body':{'type':Sequelize[_0x5dae('0x1')](_0x5dae('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x5dae('0x3'))},'read':{'type':Sequelize[_0x5dae('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5dae('0x5')),'defaultValue':_0x5dae('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5dae('0x6')](0x1fe)},'from':{'type':Sequelize[_0x5dae('0x6')]},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize[_0x5dae('0x1')](_0x5dae('0x2'))},'bcc':{'type':Sequelize[_0x5dae('0x1')]('long')},'subject':{'type':Sequelize[_0x5dae('0x1')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x5dae('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x5dae('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x5dae('0x1')](_0x5dae('0x2'))},'originCc':{'type':Sequelize[_0x5dae('0x1')](_0x5dae('0x2'))},'originChannel':{'type':Sequelize[_0x5dae('0x8')](_0x5dae('0x9'),_0x5dae('0xa')),'defaultValue':_0x5dae('0x9'),'allowNull':![]}}; \ No newline at end of file +var _0x26f2=['ENUM','out','STRING','long','DATE','Email','Chat','sequelize','lodash','exports','TEXT','medium','BOOLEAN'];(function(_0x471bb6,_0x419b98){var _0x37dff3=function(_0x222363){while(--_0x222363){_0x471bb6['push'](_0x471bb6['shift']());}};_0x37dff3(++_0x419b98);}(_0x26f2,0xa3));var _0x226f=function(_0x38646d,_0x1a5ee6){_0x38646d=_0x38646d-0x0;var _0x51cf41=_0x26f2[_0x38646d];return _0x51cf41;};'use strict';var Sequelize=require(_0x226f('0x0'));var _=require(_0x226f('0x1'));module[_0x226f('0x2')]={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x226f('0x3')](_0x226f('0x4'))},'read':{'type':Sequelize[_0x226f('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x226f('0x6')]('in','out'),'defaultValue':_0x226f('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x226f('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x226f('0x3')](_0x226f('0x9'))},'cc':{'type':Sequelize['TEXT'](_0x226f('0x9'))},'bcc':{'type':Sequelize[_0x226f('0x3')]('long')},'subject':{'type':Sequelize[_0x226f('0x3')]},'sentAt':{'type':Sequelize[_0x226f('0xa')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x226f('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x226f('0xa')]},'originTo':{'type':Sequelize[_0x226f('0x3')](_0x226f('0x9'))},'originCc':{'type':Sequelize['TEXT']('long')},'originChannel':{'type':Sequelize[_0x226f('0x6')](_0x226f('0xb'),_0x226f('0xc')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 0946169..b60674f 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 _0xe18e=['mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','QueryTypes','internal','SIP/%s','download','toString','join','server','files','tmp','message-%s.eml','bcc','subject','Attachment','from','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','readFileSync','build','writeFileSync','bluebird','util','lodash','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','redis','defaults','localhost','./mailMessage.socket','jayson/promise','http','client','request','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','offset','undefined','limit','count','set','json','update','then','end','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','show','params','intersection','find','body','destroy','describe','direction','out','findOne','CmList','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','root','server/files/attachments','basename','List','Contacts','create','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','read','readAt','UserId','agent','get','MailInteraction','MailInteractionId','read1stAt','interaction','info','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','manual','interface','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject'];(function(_0x528b0b,_0x47ec6b){var _0x2c8790=function(_0x10ee1a){while(--_0x10ee1a){_0x528b0b['push'](_0x528b0b['shift']());}};_0x2c8790(++_0x47ec6b);}(_0xe18e,0x15b));var _0xee18=function(_0x35840e,_0x484f82){_0x35840e=_0x35840e-0x0;var _0x5c1882=_0xe18e[_0x35840e];return _0x5c1882;};'use strict';var emlformat=require('eml-format');var moment=require('moment');var BPromise=require(_0xee18('0x0'));var util=require(_0xee18('0x1'));var path=require('path');var fs=require('fs');var _=require(_0xee18('0x2'));var Redis=require('ioredis');var htmlToText=require('html-to-text');var qs=require(_0xee18('0x3'));var logger=require(_0xee18('0x4'))('api');var interaction_log=require(_0xee18('0x4'))(_0xee18('0x5'));var config=require(_0xee18('0x6'));var db=require('../../mysqldb')['db'];config[_0xee18('0x7')]=_[_0xee18('0x8')](config['redis'],{'host':_0xee18('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xee18('0x7')]));var htmlEntities=require('html-entities');require(_0xee18('0xa'))['register'](socket);var jayson=require(_0xee18('0xb'));var client=jayson['client'][_0xee18('0xc')]({'port':0x232c});var client9003=jayson[_0xee18('0xd')][_0xee18('0xc')]({'port':0x232b});var client9002=jayson[_0xee18('0xd')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e5bf8,_0x487c67,_0x3941ec,_0x362050){return new BPromise(function(_0x15c308,_0x30df1c){var _0x13f5a1=_0x362050||client;return _0x13f5a1[_0xee18('0xe')](_0x4e5bf8,_0x3941ec)['then'](function(_0x43a126){logger['info'](_0xee18('0xf'),_0x487c67,_0xee18('0x10'));logger['debug'](_0xee18('0x11'),_0x487c67,_0xee18('0x10'),JSON[_0xee18('0x12')](_0x43a126));if(_0x43a126[_0xee18('0x13')]){if(_0x43a126[_0xee18('0x13')]['code']===0x1f4){logger[_0xee18('0x13')](_0xee18('0xf'),_0x487c67,_0x43a126[_0xee18('0x13')][_0xee18('0x14')]);return _0x30df1c(_0x43a126['error'][_0xee18('0x14')]);}logger[_0xee18('0x13')](_0xee18('0xf'),_0x487c67,_0x43a126[_0xee18('0x13')][_0xee18('0x14')]);return _0x15c308(_0x43a126[_0xee18('0x13')][_0xee18('0x14')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x487c67,_0xee18('0x10'));_0x15c308(_0x43a126['result']['message']);}})[_0xee18('0x15')](function(_0x302016){logger['error'](_0xee18('0xf'),_0x487c67,_0x302016);_0x30df1c(_0x302016);});});}function respondWithResult(_0x77050c,_0x2295c2){_0x2295c2=_0x2295c2||0xc8;return function(_0xec45d4){if(_0xec45d4){return _0x77050c[_0xee18('0x16')](_0x2295c2)['json'](_0xec45d4);}};}function respondWithFilteredResult(_0x37eef4,_0x34e11e){return function(_0x4c9cdd){if(_0x4c9cdd){var _0x3a8eda=typeof _0x34e11e[_0xee18('0x17')]===_0xee18('0x18')&&typeof _0x34e11e[_0xee18('0x19')]==='undefined';var _0x4d8604=_0x4c9cdd[_0xee18('0x1a')];var _0x280e12=_0x3a8eda?0x0:_0x34e11e[_0xee18('0x17')];var _0x582903=_0x3a8eda?_0x4c9cdd[_0xee18('0x1a')]:_0x34e11e[_0xee18('0x17')]+_0x34e11e[_0xee18('0x19')];var _0x2555af;if(_0x582903>=_0x4d8604){_0x582903=_0x4d8604;_0x2555af=0xc8;}else{_0x2555af=0xce;}_0x37eef4['status'](_0x2555af);return _0x37eef4[_0xee18('0x1b')]('Content-Range',_0x280e12+'-'+_0x582903+'/'+_0x4d8604)[_0xee18('0x1c')](_0x4c9cdd);}return null;};}function saveUpdates(_0x3c0c76){return function(_0x3672d5){if(_0x3672d5){return _0x3672d5[_0xee18('0x1d')](_0x3c0c76)['then'](function(_0x503452){return _0x503452;});}return null;};}function removeEntity(_0x273ea7){return function(_0x2942f2){if(_0x2942f2){return _0x2942f2['destroy']()[_0xee18('0x1e')](function(){_0x273ea7[_0xee18('0x16')](0xcc)[_0xee18('0x1f')]();});}};}function handleEntityNotFound(_0x5bfe7c){return function(_0xdcb547){if(!_0xdcb547){_0x5bfe7c['sendStatus'](0x194);}return _0xdcb547;};}function handleError(_0xd8fdfb,_0xbb9efc){_0xbb9efc=_0xbb9efc||0x1f4;return function(_0x10e3c9){logger[_0xee18('0x13')](_0x10e3c9[_0xee18('0x20')]);if(_0x10e3c9['name']){delete _0x10e3c9[_0xee18('0x21')];}_0xd8fdfb['status'](_0xbb9efc)[_0xee18('0x22')](_0x10e3c9);};}exports[_0xee18('0x23')]=function(_0x572611,_0x44e119){var _0x4f98b7={},_0x59ea05={},_0x45e266={'count':0x0,'rows':[]};var _0x348209=_[_0xee18('0x24')](db[_0xee18('0x25')][_0xee18('0x26')],function(_0x588e7f){return{'name':_0x588e7f[_0xee18('0x27')],'type':_0x588e7f[_0xee18('0x28')][_0xee18('0x29')]};});_0x59ea05['model']=_[_0xee18('0x24')](_0x348209,_0xee18('0x21'));_0x59ea05[_0xee18('0x2a')]=_[_0xee18('0x2b')](_0x572611[_0xee18('0x2a')]);_0x59ea05[_0xee18('0x2c')]=_['intersection'](_0x59ea05[_0xee18('0x2d')],_0x59ea05[_0xee18('0x2a')]);_0x4f98b7[_0xee18('0x2e')]=_['intersection'](_0x59ea05[_0xee18('0x2d')],qs['fields'](_0x572611[_0xee18('0x2a')][_0xee18('0x2f')]));_0x4f98b7['attributes']=_0x4f98b7[_0xee18('0x2e')][_0xee18('0x30')]?_0x4f98b7[_0xee18('0x2e')]:_0x59ea05[_0xee18('0x2d')];if(!_0x572611['query'][_0xee18('0x31')](_0xee18('0x32'))){_0x4f98b7[_0xee18('0x19')]=qs[_0xee18('0x19')](_0x572611['query'][_0xee18('0x19')]);_0x4f98b7[_0xee18('0x17')]=qs['offset'](_0x572611[_0xee18('0x2a')][_0xee18('0x17')]);}_0x4f98b7[_0xee18('0x33')]=qs[_0xee18('0x34')](_0x572611[_0xee18('0x2a')]['sort']);_0x4f98b7['where']=qs[_0xee18('0x2c')](_[_0xee18('0x35')](_0x572611[_0xee18('0x2a')],_0x59ea05[_0xee18('0x2c')]),_0x348209);if(_0x572611[_0xee18('0x2a')][_0xee18('0x36')]){_0x4f98b7['where']=_[_0xee18('0x37')](_0x4f98b7[_0xee18('0x38')],{'$or':_[_0xee18('0x24')](_0x348209,function(_0x930ed4){if(_0x930ed4['type']!==_0xee18('0x39')){var _0x5bbc80={};_0x5bbc80[_0x930ed4[_0xee18('0x21')]]={'$like':'%'+_0x572611[_0xee18('0x2a')][_0xee18('0x36')]+'%'};return _0x5bbc80;}})});}_0x4f98b7=_[_0xee18('0x37')]({},_0x4f98b7,_0x572611['options']);var _0x5c8702={'where':_0x4f98b7[_0xee18('0x38')]};return db['MailMessage'][_0xee18('0x1a')](_0x5c8702)[_0xee18('0x1e')](function(_0x39aa06){_0x45e266['count']=_0x39aa06;if(_0x572611[_0xee18('0x2a')][_0xee18('0x3a')]){_0x4f98b7[_0xee18('0x3b')]=[{'all':!![]}];}return db['MailMessage'][_0xee18('0x3c')](_0x4f98b7);})[_0xee18('0x1e')](function(_0x8dd71d){_0x45e266[_0xee18('0x3d')]=_0x8dd71d;return _0x45e266;})[_0xee18('0x1e')](respondWithFilteredResult(_0x44e119,_0x4f98b7))['catch'](handleError(_0x44e119,null));};exports[_0xee18('0x3e')]=function(_0x5bec2a,_0x28d084){var _0x4751be={'raw':!![],'where':{'id':_0x5bec2a[_0xee18('0x3f')]['id']}},_0xcea2d6={};_0xcea2d6[_0xee18('0x2d')]=_[_0xee18('0x2b')](db[_0xee18('0x25')]['rawAttributes']);_0xcea2d6['query']=_[_0xee18('0x2b')](_0x5bec2a[_0xee18('0x2a')]);_0xcea2d6['filters']=_['intersection'](_0xcea2d6[_0xee18('0x2d')],_0xcea2d6[_0xee18('0x2a')]);_0x4751be['attributes']=_[_0xee18('0x40')](_0xcea2d6[_0xee18('0x2d')],qs[_0xee18('0x2f')](_0x5bec2a['query']['fields']));_0x4751be[_0xee18('0x2e')]=_0x4751be[_0xee18('0x2e')][_0xee18('0x30')]?_0x4751be['attributes']:_0xcea2d6[_0xee18('0x2d')];if(_0x5bec2a['query'][_0xee18('0x3a')]){_0x4751be[_0xee18('0x3b')]=[{'all':!![]}];}_0x4751be=_[_0xee18('0x37')]({},_0x4751be,_0x5bec2a['options']);return db[_0xee18('0x25')][_0xee18('0x41')](_0x4751be)[_0xee18('0x1e')](handleEntityNotFound(_0x28d084,null))['then'](respondWithResult(_0x28d084,null))[_0xee18('0x15')](handleError(_0x28d084,null));};exports[_0xee18('0x1d')]=function(_0x21f601,_0x5bce33){if(_0x21f601['body']['id']){delete _0x21f601[_0xee18('0x42')]['id'];}return db[_0xee18('0x25')]['find']({'where':{'id':_0x21f601[_0xee18('0x3f')]['id']}})[_0xee18('0x1e')](handleEntityNotFound(_0x5bce33,null))['then'](saveUpdates(_0x21f601[_0xee18('0x42')],null))[_0xee18('0x1e')](respondWithResult(_0x5bce33,null))[_0xee18('0x15')](handleError(_0x5bce33,null));};exports[_0xee18('0x43')]=function(_0xb70f9f,_0x59bc8d){return db['MailMessage'][_0xee18('0x41')]({'where':{'id':_0xb70f9f[_0xee18('0x3f')]['id']}})[_0xee18('0x1e')](handleEntityNotFound(_0x59bc8d,null))[_0xee18('0x1e')](removeEntity(_0x59bc8d,null))['catch'](handleError(_0x59bc8d,null));};exports['describe']=function(_0x5acd67,_0x29ea54){return db[_0xee18('0x25')][_0xee18('0x44')]()[_0xee18('0x1e')](respondWithResult(_0x29ea54,null))['catch'](handleError(_0x29ea54,null));};exports['create']=function(_0x4e25a2,_0x1bcbd8){return db['MailMessage']['create'](_0x4e25a2['body'])[_0xee18('0x1e')](function(_0x3f422c){if(_0x3f422c){if(_0x3f422c[_0xee18('0x45')]===_0xee18('0x46')&&!_0x3f422c['secret']){var _0x37e875,_0x1dda15,_0x298540;if(_0x4e25a2[_0xee18('0x42')]['to']){_0x1dda15=_0x4e25a2[_0xee18('0x42')]['to']['split'](',')[0x0];}return db['MailAccount'][_0xee18('0x47')]({'where':{'id':_0x3f422c['MailAccountId']},'include':[{'model':db[_0xee18('0x48')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x1dda15},'limit':0x1,'order':[[_0xee18('0x49'),_0xee18('0x4a')]]}]},{'model':db[_0xee18('0x4b')],'as':_0xee18('0x4c'),'raw':!![]}]})[_0xee18('0x1e')](function(_0x4c5b95){_0x37e875=_0x4c5b95;if(_0x37e875&&_0x37e875[_0xee18('0x4c')]){var _0x72181b={'tls':{'rejectUnauthorized':![]}};if(_[_0xee18('0x4d')](_0x37e875[_0xee18('0x4c')][_0xee18('0x4e')])){_0x72181b[_0xee18('0x4f')]=_0x37e875[_0xee18('0x4c')][_0xee18('0x4f')];_0x72181b[_0xee18('0x50')]=_0x37e875[_0xee18('0x4c')]['port'];_0x72181b[_0xee18('0x51')]=_0x37e875['Smtp'][_0xee18('0x51')];if(_0x37e875[_0xee18('0x4c')][_0xee18('0x52')]){_0x72181b[_0xee18('0x53')]={'user':_0x37e875[_0xee18('0x4c')][_0xee18('0x54')],'pass':_0x37e875['Smtp'][_0xee18('0x55')]};}}else{_0x72181b[_0xee18('0x4e')]=_0x37e875[_0xee18('0x4c')][_0xee18('0x4e')];_0x72181b[_0xee18('0x53')]={'user':_0x37e875[_0xee18('0x4c')][_0xee18('0x54')],'pass':_0x37e875[_0xee18('0x4c')][_0xee18('0x55')]};_0x72181b[_0xee18('0x51')]=_0x37e875[_0xee18('0x4c')][_0xee18('0x51')];}if(_0x4e25a2['body']['attachments']&&_0x4e25a2[_0xee18('0x42')][_0xee18('0x56')][_0xee18('0x30')]){for(var _0xee2084=0x0;_0xee2084<_0x4e25a2[_0xee18('0x42')][_0xee18('0x56')][_0xee18('0x30')];_0xee2084+=0x1){_0x4e25a2['body'][_0xee18('0x56')][_0xee2084]={'filename':_0x4e25a2['body'][_0xee18('0x56')][_0xee2084][_0xee18('0x21')],'path':path['join'](config[_0xee18('0x57')],_0xee18('0x58'),_0x4e25a2[_0xee18('0x42')]['attachments'][_0xee2084][_0xee18('0x59')])};}}_0x298540={'account':_0x72181b,'message':_0x4e25a2[_0xee18('0x42')]};return;}})[_0xee18('0x1e')](function(){if(_0x37e875['List']){if(_0x37e875[_0xee18('0x5a')]['Contacts'][_0xee18('0x30')]){return _0x37e875[_0xee18('0x5a')][_0xee18('0x5b')][0x0];}else{return db['CmContact'][_0xee18('0x5c')](_[_0xee18('0x8')](_0x4e25a2[_0xee18('0x42')],{'firstName':_0x4e25a2[_0xee18('0x42')]['to'],'email':_0x4e25a2[_0xee18('0x42')]['to'],'phone':_0x4e25a2[_0xee18('0x42')]['to'],'ListId':_0x37e875[_0xee18('0x5d')]}));}}else{throw new Error(_0xee18('0x5e'));}})[_0xee18('0x1e')](function(){if(_0x298540){return respondWithRpcPromise(_0xee18('0x5f'),_0xee18('0x60'),_0x298540,client9003)['then'](function(_0x5c1a62){return _0x3f422c['update']({'read':!![],'messageId':_0x5c1a62[_0xee18('0x61')],'sentAt':moment()[_0xee18('0x62')](_0xee18('0x63'))});})[_0xee18('0x15')](function(_0x52ba2f){logger[_0xee18('0x13')]('%s',JSON['stringify'](_0x52ba2f));return _0x3f422c;});}return _0x3f422c;});}return _0x3f422c;}})[_0xee18('0x1e')](respondWithResult(_0x1bcbd8,0xc9))['catch'](handleError(_0x1bcbd8,null));};exports[_0xee18('0x64')]=function(_0x289843,_0x31f42c){var _0x2e81b4={'agent':{},'channel':'mail'};if(_0x289843['body']['id']){delete _0x289843['body']['id'];}_0x289843[_0xee18('0x42')][_0xee18('0x65')]=!![];_0x289843[_0xee18('0x42')][_0xee18('0x66')]=moment()[_0xee18('0x62')](_0xee18('0x63'));_0x289843[_0xee18('0x42')][_0xee18('0x67')]=_0x289843[_0xee18('0x42')][_0xee18('0x67')]||_0x289843['user']['id'];_0x2e81b4[_0xee18('0x68')]['id']=_0x289843[_0xee18('0x42')][_0xee18('0x67')];return db[_0xee18('0x25')][_0xee18('0x41')]({'where':{'id':_0x289843[_0xee18('0x3f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x31f42c,null))[_0xee18('0x1e')](saveUpdates(_0x289843[_0xee18('0x42')],null))[_0xee18('0x1e')](function(_0x17f560){if(_0x17f560){_0x2e81b4[_0xee18('0x14')]=_0x17f560[_0xee18('0x69')]({'plain':!![]});return db[_0xee18('0x6a')]['find']({'where':{'id':_0x17f560[_0xee18('0x6b')]}});}return null;})['then'](handleEntityNotFound(_0x31f42c,null))[_0xee18('0x1e')](function(_0x44e7d4){if(_0x44e7d4){return _0x44e7d4[_0xee18('0x1d')]({'UserId':_0x289843[_0xee18('0x42')][_0xee18('0x67')],'read1stAt':_[_0xee18('0x4d')](_0x44e7d4[_0xee18('0x6c')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x46c6fc){if(_0x46c6fc){_0x2e81b4[_0xee18('0x6d')]=_0x46c6fc[_0xee18('0x69')]({'plain':!![]});interaction_log[_0xee18('0x6e')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x289843[_0xee18('0x54')]['id'],_0x289843[_0xee18('0x54')][_0xee18('0x21')],_0x289843['user'][_0xee18('0x6f')],_0x2e81b4[_0xee18('0x6d')]['id'],_0x289843['body']?JSON[_0xee18('0x12')](_0x289843[_0xee18('0x42')]):_0xee18('0x70'));return respondWithRpcPromise(_0xee18('0x71'),_0xee18('0x72'),_0x2e81b4);}return null;})[_0xee18('0x1e')](function(_0x2fb05c){var _0x47cf11=_0xee18('0x73')+_0x2fb05c[_0xee18('0x14')][_0xee18('0x74')];return db[_0xee18('0x75')]['query'](_0x47cf11,{'type':db[_0xee18('0x76')]['QueryTypes'][_0xee18('0x77')],'raw':!![]})['then'](function(_0x362f1c){return _0x362f1c;});})[_0xee18('0x1e')](function(_0x146b53){if(_0x146b53){_0x2e81b4[_0xee18('0x14')][_0xee18('0x78')]=_0x146b53[0x0];if(!_0x289843[_0xee18('0x42')]['UserId'])return;return db[_0xee18('0x79')][_0xee18('0x41')]({'where':{'id':_0x289843[_0xee18('0x42')]['UserId'],'role':_0xee18('0x68')},'attributes':['id',_0xee18('0x21'),_0xee18('0x7a'),_0xee18('0x7b'),'internal'],'raw':!![]});}return null;})[_0xee18('0x1e')](function(_0x37b314){if(!_0x37b314)return null;_0x2e81b4['message'][_0xee18('0x68')]=_0x37b314;return _0x2e81b4;})[_0xee18('0x1e')](function(_0x588632){if(_0x588632){if(_0x289843['body'][_0xee18('0x7c')]){_0x2e81b4[_0xee18('0x14')][_0xee18('0x7d')]=util[_0xee18('0x62')]('SIP/%s',_0x289843['user'][_0xee18('0x21')]);_0x2e81b4[_0xee18('0x14')][_0xee18('0x7e')]=_0x2e81b4[_0xee18('0x7e')];_0x2e81b4[_0xee18('0x14')][_0xee18('0x7f')]=_0x2e81b4[_0xee18('0x7e')];_0x2e81b4[_0xee18('0x14')][_0xee18('0x80')]='accept';_0x2e81b4[_0xee18('0x14')][_0xee18('0x42')]=htmlToText[_0xee18('0x81')](_0x2e81b4[_0xee18('0x14')][_0xee18('0x42')]);return respondWithRpcPromise(_0xee18('0x82'),_0xee18('0x82'),{'event':_0xee18('0x83'),'message':_0x2e81b4[_0xee18('0x14')]},client9002)['then'](function(){return _0x2e81b4;});}return _0x2e81b4;}return null;})[_0xee18('0x1e')](respondWithResult(_0x31f42c,null))[_0xee18('0x15')](handleError(_0x31f42c,null));};exports[_0xee18('0x84')]=function(_0x83da42,_0x519dfb){var _0x3174c5={'agent':{},'channel':_0xee18('0x85')};if(_0x83da42[_0xee18('0x42')]['id']){delete _0x83da42[_0xee18('0x42')]['id'];}_0x83da42[_0xee18('0x42')][_0xee18('0x67')]=_0x83da42[_0xee18('0x42')]['UserId']||_0x83da42[_0xee18('0x54')]['id'];_0x3174c5[_0xee18('0x68')]['id']=_0x83da42['body'][_0xee18('0x67')];return db[_0xee18('0x25')][_0xee18('0x41')]({'where':{'id':_0x83da42[_0xee18('0x3f')]['id'],'UserId':null}})[_0xee18('0x1e')](handleEntityNotFound(_0x519dfb,null))[_0xee18('0x1e')](function(_0x258972){if(_0x258972){_0x3174c5[_0xee18('0x14')]=_0x258972['get']({'plain':!![]});return db['MailInteraction'][_0xee18('0x41')]({'where':{'id':_0x258972[_0xee18('0x6b')]}});}return null;})[_0xee18('0x1e')](handleEntityNotFound(_0x519dfb,null))[_0xee18('0x1e')](function(_0x1ae947){if(_0x1ae947){_0x3174c5[_0xee18('0x6d')]=_0x1ae947[_0xee18('0x69')]({'plain':!![]});interaction_log[_0xee18('0x6e')](_0xee18('0x86'),_0x83da42[_0xee18('0x54')]['id'],_0x83da42['user'][_0xee18('0x21')],_0x83da42['user']['role'],_0x3174c5[_0xee18('0x6d')]['id'],_0x83da42[_0xee18('0x42')]?JSON[_0xee18('0x12')](_0x83da42[_0xee18('0x42')]):_0xee18('0x70'));return respondWithRpcPromise('RejectMessage',_0xee18('0x87'),_0x3174c5);}return null;})[_0xee18('0x1e')](function(_0x3dc86d){var _0x2ad1bc=_0xee18('0x73')+_0x3dc86d[_0xee18('0x14')][_0xee18('0x74')];return db[_0xee18('0x75')][_0xee18('0x2a')](_0x2ad1bc,{'type':db[_0xee18('0x76')][_0xee18('0x88')]['SELECT'],'raw':!![]})[_0xee18('0x1e')](function(_0x21f665){return _0x21f665;});})[_0xee18('0x1e')](function(_0x2e7b65){if(_0x2e7b65){_0x3174c5[_0xee18('0x14')]['contact']=_0x2e7b65[0x0];if(!_0x83da42[_0xee18('0x42')][_0xee18('0x67')])return;return db[_0xee18('0x79')][_0xee18('0x41')]({'where':{'id':_0x83da42['body']['UserId'],'role':_0xee18('0x68')},'attributes':['id',_0xee18('0x21'),_0xee18('0x7a'),_0xee18('0x7b'),_0xee18('0x89')],'raw':!![]});}return null;})[_0xee18('0x1e')](function(_0x2b43d6){if(!_0x2b43d6)return null;_0x3174c5[_0xee18('0x14')][_0xee18('0x68')]=_0x2b43d6;return _0x3174c5;})['then'](function(_0x478f7b){if(_0x478f7b){_0x478f7b[_0xee18('0x14')][_0xee18('0x7d')]=util[_0xee18('0x62')](_0xee18('0x8a'),_0x83da42[_0xee18('0x54')][_0xee18('0x21')]);_0x478f7b[_0xee18('0x14')][_0xee18('0x7e')]=_0x3174c5[_0xee18('0x7e')];_0x478f7b['message'][_0xee18('0x7f')]=_0x3174c5[_0xee18('0x7e')];_0x478f7b[_0xee18('0x14')][_0xee18('0x80')]=_0xee18('0x84');_0x478f7b[_0xee18('0x14')][_0xee18('0x42')]=htmlToText[_0xee18('0x81')](_0x3174c5[_0xee18('0x14')][_0xee18('0x42')]);respondWithRpcPromise(_0xee18('0x82'),'EventManager',{'event':'rejectmessage','message':_0x478f7b[_0xee18('0x14')]},client9002);return _0x3174c5;}return null;})[_0xee18('0x1e')](respondWithResult(_0x519dfb,null))[_0xee18('0x15')](handleError(_0x519dfb,null));};exports[_0xee18('0x8b')]=function(_0x4577e0,_0x21ba3e){var _0x233d3f=moment()['unix']()[_0xee18('0x8c')]();var _0x517359=path[_0xee18('0x8d')](config[_0xee18('0x57')],_0xee18('0x8e'),_0xee18('0x8f'),_0xee18('0x90'));var _0x2a78f1=path['join'](config['root'],'server',_0xee18('0x8f'),'attachments');var _0x144583=util[_0xee18('0x62')](_0xee18('0x91'),_0x233d3f);return db[_0xee18('0x25')][_0xee18('0x41')]({'where':{'id':_0x4577e0[_0xee18('0x3f')]['id']},'attributes':['id',_0xee18('0x42'),'from','to','cc',_0xee18('0x92'),_0xee18('0x93'),'createdAt'],'include':_0x4577e0['query'][_0xee18('0x56')]?[{'model':db[_0xee18('0x94')],'as':'Attachments'}]:undefined})[_0xee18('0x1e')](handleEntityNotFound(_0x21ba3e,null))['then'](function(_0x16a41e){if(_0x16a41e){var _0x5c1809=_0x16a41e;var _0x302693={'from':_0x5c1809[_0xee18('0x95')],'to':_0x5c1809['to'],'subject':_0x5c1809[_0xee18('0x93')],'html':htmlEntities[_0xee18('0x96')](_0x5c1809[_0xee18('0x42')]),'headers':{'Date':moment(_0x5c1809[_0xee18('0x97')])[_0xee18('0x62')](_0xee18('0x98'))},'attachments':[]};if(_0x16a41e['cc']){_0x302693['headers']['Cc']=_0x16a41e['cc'];}if(_0x16a41e['bcc']){_0x302693[_0xee18('0x99')][_0xee18('0x9a')]=_0x16a41e[_0xee18('0x92')];}return new BPromise(function(_0x5ab3cf,_0x2c63df){if(_0x16a41e[_0xee18('0x9b')]){for(var _0x41b2fc=0x0;_0x41b2fc<_0x16a41e[_0xee18('0x9b')][_0xee18('0x30')];_0x41b2fc++){var _0x3720bf=_0x16a41e['Attachments'][_0x41b2fc];var _0xf24bf8=path['join'](_0x2a78f1,_0x3720bf[_0xee18('0x59')]);if(fs[_0xee18('0x9c')](_0xf24bf8)){_0x302693[_0xee18('0x56')]['push']({'name':_0x3720bf[_0xee18('0x21')],'contentType':_0x3720bf[_0xee18('0x28')],'data':fs[_0xee18('0x9d')](_0xf24bf8)});}}}emlformat[_0xee18('0x9e')](_0x302693,function(_0x46c197,_0x32f559){if(_0x46c197)return _0x2c63df(_0x46c197);fs[_0xee18('0x9f')](path[_0xee18('0x8d')](_0x517359,_0x144583),_0x32f559);return _0x5ab3cf(_0x32f559);});});}})[_0xee18('0x1e')](function(_0x163843){if(_0x163843){return _0x21ba3e['download'](path['join'](_0x517359,_0x144583),_0x144583,function(_0x4c99ec){if(!_0x4c99ec)fs['unlinkSync'](path['join'](_0x517359,_0x144583));});}})[_0xee18('0x15')](handleError(_0x21ba3e,null));}; \ No newline at end of file +var _0xffaa=['rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','include','rows','params','keys','find','body','describe','create','out','secret','split','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','user','pass','auth','attachments','join','server/files/attachments','basename','ListId','List\x20not\x20found','messageId','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','read','readAt','format','UserId','agent','MailInteractionId','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','SIP/%s','channel','motionChannel','EventManager','acceptmessage','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','email','interface','rejectmessage','download','root','server','message-%s.eml','from','bcc','Attachment','Attachments','subject','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','push','readFileSync','build','writeFileSync','moment','util','path','lodash','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','register','jayson/promise','client','http','request','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','offset','count','update','destroy','end','sendStatus','name','index','map','MailMessage'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xffaa,0x10a));var _0xaffa=function(_0x425bd9,_0x1f7324){_0x425bd9=_0x425bd9-0x0;var _0xdc394b=_0xffaa[_0x425bd9];return _0xdc394b;};'use strict';var emlformat=require('eml-format');var moment=require(_0xaffa('0x0'));var BPromise=require('bluebird');var util=require(_0xaffa('0x1'));var path=require(_0xaffa('0x2'));var fs=require('fs');var _=require(_0xaffa('0x3'));var Redis=require('ioredis');var htmlToText=require('html-to-text');var qs=require(_0xaffa('0x4'));var logger=require(_0xaffa('0x5'))(_0xaffa('0x6'));var interaction_log=require('../../config/logger')(_0xaffa('0x7'));var config=require('../../config/environment');var db=require(_0xaffa('0x8'))['db'];config[_0xaffa('0x9')]=_['defaults'](config[_0xaffa('0x9')],{'host':_0xaffa('0xa'),'port':0x18eb});var socket=require(_0xaffa('0xb'))(new Redis(config[_0xaffa('0x9')]));var htmlEntities=require(_0xaffa('0xc'));require('./mailMessage.socket')[_0xaffa('0xd')](socket);var jayson=require(_0xaffa('0xe'));var client=jayson[_0xaffa('0xf')]['http']({'port':0x232c});var client9003=jayson[_0xaffa('0xf')][_0xaffa('0x10')]({'port':0x232b});var client9002=jayson[_0xaffa('0xf')][_0xaffa('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x420afd,_0x4c189d,_0x290d0e,_0x347488){return new BPromise(function(_0x2d371a,_0xb1c517){var _0x22679c=_0x347488||client;return _0x22679c[_0xaffa('0x11')](_0x420afd,_0x290d0e)[_0xaffa('0x12')](function(_0x14fde8){logger[_0xaffa('0x13')](_0xaffa('0x14'),_0x4c189d,_0xaffa('0x15'));logger[_0xaffa('0x16')](_0xaffa('0x17'),_0x4c189d,_0xaffa('0x15'),JSON['stringify'](_0x14fde8));if(_0x14fde8[_0xaffa('0x18')]){if(_0x14fde8[_0xaffa('0x18')]['code']===0x1f4){logger['error'](_0xaffa('0x14'),_0x4c189d,_0x14fde8['error']['message']);return _0xb1c517(_0x14fde8[_0xaffa('0x18')][_0xaffa('0x19')]);}logger[_0xaffa('0x18')](_0xaffa('0x14'),_0x4c189d,_0x14fde8['error'][_0xaffa('0x19')]);return _0x2d371a(_0x14fde8['error'][_0xaffa('0x19')]);}else{logger['info'](_0xaffa('0x14'),_0x4c189d,_0xaffa('0x15'));_0x2d371a(_0x14fde8[_0xaffa('0x1a')][_0xaffa('0x19')]);}})[_0xaffa('0x1b')](function(_0x1d17d2){logger[_0xaffa('0x18')](_0xaffa('0x14'),_0x4c189d,_0x1d17d2);_0xb1c517(_0x1d17d2);});});}function respondWithResult(_0x319b86,_0x12d931){_0x12d931=_0x12d931||0xc8;return function(_0xa2644a){if(_0xa2644a){return _0x319b86[_0xaffa('0x1c')](_0x12d931)[_0xaffa('0x1d')](_0xa2644a);}};}function respondWithFilteredResult(_0xd3d865,_0x1ce364){return function(_0x2f3136){if(_0x2f3136){var _0x290fdb=typeof _0x1ce364['offset']===_0xaffa('0x1e')&&typeof _0x1ce364[_0xaffa('0x1f')]===_0xaffa('0x1e');var _0x466d71=_0x2f3136['count'];var _0x3ca1cf=_0x290fdb?0x0:_0x1ce364[_0xaffa('0x20')];var _0x2f745d=_0x290fdb?_0x2f3136[_0xaffa('0x21')]:_0x1ce364[_0xaffa('0x20')]+_0x1ce364[_0xaffa('0x1f')];var _0x1db2ab;if(_0x2f745d>=_0x466d71){_0x2f745d=_0x466d71;_0x1db2ab=0xc8;}else{_0x1db2ab=0xce;}_0xd3d865[_0xaffa('0x1c')](_0x1db2ab);return _0xd3d865['set']('Content-Range',_0x3ca1cf+'-'+_0x2f745d+'/'+_0x466d71)[_0xaffa('0x1d')](_0x2f3136);}return null;};}function saveUpdates(_0x113f88){return function(_0x6e1c86){if(_0x6e1c86){return _0x6e1c86[_0xaffa('0x22')](_0x113f88)[_0xaffa('0x12')](function(_0xa2a455){return _0xa2a455;});}return null;};}function removeEntity(_0x15b7c8){return function(_0x159fb1){if(_0x159fb1){return _0x159fb1[_0xaffa('0x23')]()[_0xaffa('0x12')](function(){_0x15b7c8[_0xaffa('0x1c')](0xcc)[_0xaffa('0x24')]();});}};}function handleEntityNotFound(_0x21dee4){return function(_0x1fa755){if(!_0x1fa755){_0x21dee4[_0xaffa('0x25')](0x194);}return _0x1fa755;};}function handleError(_0x29bd30,_0x13456b){_0x13456b=_0x13456b||0x1f4;return function(_0xc40184){logger[_0xaffa('0x18')](_0xc40184['stack']);if(_0xc40184[_0xaffa('0x26')]){delete _0xc40184[_0xaffa('0x26')];}_0x29bd30[_0xaffa('0x1c')](_0x13456b)['send'](_0xc40184);};}exports[_0xaffa('0x27')]=function(_0x5a8cf4,_0xce27b5){var _0x456e2c={},_0x531835={},_0x4fc4e3={'count':0x0,'rows':[]};var _0x124d04=_[_0xaffa('0x28')](db[_0xaffa('0x29')][_0xaffa('0x2a')],function(_0x13cd28){return{'name':_0x13cd28['fieldName'],'type':_0x13cd28[_0xaffa('0x2b')][_0xaffa('0x2c')]};});_0x531835[_0xaffa('0x2d')]=_['map'](_0x124d04,_0xaffa('0x26'));_0x531835[_0xaffa('0x2e')]=_['keys'](_0x5a8cf4[_0xaffa('0x2e')]);_0x531835[_0xaffa('0x2f')]=_[_0xaffa('0x30')](_0x531835[_0xaffa('0x2d')],_0x531835[_0xaffa('0x2e')]);_0x456e2c[_0xaffa('0x31')]=_['intersection'](_0x531835[_0xaffa('0x2d')],qs[_0xaffa('0x32')](_0x5a8cf4[_0xaffa('0x2e')][_0xaffa('0x32')]));_0x456e2c[_0xaffa('0x31')]=_0x456e2c[_0xaffa('0x31')][_0xaffa('0x33')]?_0x456e2c[_0xaffa('0x31')]:_0x531835[_0xaffa('0x2d')];if(!_0x5a8cf4[_0xaffa('0x2e')][_0xaffa('0x34')](_0xaffa('0x35'))){_0x456e2c[_0xaffa('0x1f')]=qs[_0xaffa('0x1f')](_0x5a8cf4[_0xaffa('0x2e')][_0xaffa('0x1f')]);_0x456e2c[_0xaffa('0x20')]=qs[_0xaffa('0x20')](_0x5a8cf4['query'][_0xaffa('0x20')]);}_0x456e2c['order']=qs[_0xaffa('0x36')](_0x5a8cf4['query'][_0xaffa('0x36')]);_0x456e2c['where']=qs[_0xaffa('0x2f')](_[_0xaffa('0x37')](_0x5a8cf4[_0xaffa('0x2e')],_0x531835['filters']),_0x124d04);if(_0x5a8cf4[_0xaffa('0x2e')][_0xaffa('0x38')]){_0x456e2c[_0xaffa('0x39')]=_[_0xaffa('0x3a')](_0x456e2c[_0xaffa('0x39')],{'$or':_['map'](_0x124d04,function(_0x287a9c){if(_0x287a9c[_0xaffa('0x2b')]!=='VIRTUAL'){var _0x3ce474={};_0x3ce474[_0x287a9c[_0xaffa('0x26')]]={'$like':'%'+_0x5a8cf4[_0xaffa('0x2e')]['filter']+'%'};return _0x3ce474;}})});}_0x456e2c=_['merge']({},_0x456e2c,_0x5a8cf4[_0xaffa('0x3b')]);var _0x48d8cc={'where':_0x456e2c['where']};return db[_0xaffa('0x29')]['count'](_0x48d8cc)[_0xaffa('0x12')](function(_0x3cc717){_0x4fc4e3['count']=_0x3cc717;if(_0x5a8cf4[_0xaffa('0x2e')][_0xaffa('0x3c')]){_0x456e2c[_0xaffa('0x3d')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x456e2c);})[_0xaffa('0x12')](function(_0x256eeb){_0x4fc4e3[_0xaffa('0x3e')]=_0x256eeb;return _0x4fc4e3;})[_0xaffa('0x12')](respondWithFilteredResult(_0xce27b5,_0x456e2c))[_0xaffa('0x1b')](handleError(_0xce27b5,null));};exports['show']=function(_0x157c44,_0x427189){var _0x2ff87a={'raw':!![],'where':{'id':_0x157c44[_0xaffa('0x3f')]['id']}},_0x13468d={};_0x13468d[_0xaffa('0x2d')]=_[_0xaffa('0x40')](db['MailMessage'][_0xaffa('0x2a')]);_0x13468d['query']=_[_0xaffa('0x40')](_0x157c44[_0xaffa('0x2e')]);_0x13468d['filters']=_[_0xaffa('0x30')](_0x13468d[_0xaffa('0x2d')],_0x13468d[_0xaffa('0x2e')]);_0x2ff87a[_0xaffa('0x31')]=_[_0xaffa('0x30')](_0x13468d[_0xaffa('0x2d')],qs[_0xaffa('0x32')](_0x157c44[_0xaffa('0x2e')][_0xaffa('0x32')]));_0x2ff87a['attributes']=_0x2ff87a[_0xaffa('0x31')][_0xaffa('0x33')]?_0x2ff87a[_0xaffa('0x31')]:_0x13468d['model'];if(_0x157c44[_0xaffa('0x2e')][_0xaffa('0x3c')]){_0x2ff87a[_0xaffa('0x3d')]=[{'all':!![]}];}_0x2ff87a=_[_0xaffa('0x3a')]({},_0x2ff87a,_0x157c44[_0xaffa('0x3b')]);return db['MailMessage'][_0xaffa('0x41')](_0x2ff87a)[_0xaffa('0x12')](handleEntityNotFound(_0x427189,null))[_0xaffa('0x12')](respondWithResult(_0x427189,null))[_0xaffa('0x1b')](handleError(_0x427189,null));};exports[_0xaffa('0x22')]=function(_0x37feba,_0x42364b){if(_0x37feba[_0xaffa('0x42')]['id']){delete _0x37feba['body']['id'];}return db[_0xaffa('0x29')]['find']({'where':{'id':_0x37feba['params']['id']}})[_0xaffa('0x12')](handleEntityNotFound(_0x42364b,null))['then'](saveUpdates(_0x37feba[_0xaffa('0x42')],null))[_0xaffa('0x12')](respondWithResult(_0x42364b,null))[_0xaffa('0x1b')](handleError(_0x42364b,null));};exports['destroy']=function(_0x21aabc,_0x4fba56){return db[_0xaffa('0x29')]['find']({'where':{'id':_0x21aabc[_0xaffa('0x3f')]['id']}})[_0xaffa('0x12')](handleEntityNotFound(_0x4fba56,null))[_0xaffa('0x12')](removeEntity(_0x4fba56,null))[_0xaffa('0x1b')](handleError(_0x4fba56,null));};exports[_0xaffa('0x43')]=function(_0x427485,_0x9fe5d3){return db[_0xaffa('0x29')][_0xaffa('0x43')]()[_0xaffa('0x12')](respondWithResult(_0x9fe5d3,null))['catch'](handleError(_0x9fe5d3,null));};exports[_0xaffa('0x44')]=function(_0x43093,_0x20da49){return db[_0xaffa('0x29')]['create'](_0x43093['body'])[_0xaffa('0x12')](function(_0x216fc5){if(_0x216fc5){if(_0x216fc5['direction']===_0xaffa('0x45')&&!_0x216fc5[_0xaffa('0x46')]){var _0x106215,_0x425031,_0xbbc5b4;if(_0x43093[_0xaffa('0x42')]['to']){_0x425031=_0x43093[_0xaffa('0x42')]['to'][_0xaffa('0x47')](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x216fc5[_0xaffa('0x48')]},'include':[{'model':db[_0xaffa('0x49')],'as':_0xaffa('0x4a'),'include':[{'model':db[_0xaffa('0x4b')],'as':_0xaffa('0x4c'),'where':{'email':_0x425031},'limit':0x1,'order':[[_0xaffa('0x4d'),_0xaffa('0x4e')]]}]},{'model':db[_0xaffa('0x4f')],'as':_0xaffa('0x50'),'raw':!![]}]})[_0xaffa('0x12')](function(_0x1da28d){_0x106215=_0x1da28d;if(_0x106215&&_0x106215['Smtp']){var _0x38f8bf={'tls':{'rejectUnauthorized':![]}};if(_[_0xaffa('0x51')](_0x106215[_0xaffa('0x50')][_0xaffa('0x52')])){_0x38f8bf['host']=_0x106215[_0xaffa('0x50')][_0xaffa('0x53')];_0x38f8bf[_0xaffa('0x54')]=_0x106215['Smtp'][_0xaffa('0x54')];_0x38f8bf[_0xaffa('0x55')]=_0x106215['Smtp'][_0xaffa('0x55')];if(_0x106215[_0xaffa('0x50')][_0xaffa('0x56')]){_0x38f8bf['auth']={'user':_0x106215['Smtp'][_0xaffa('0x57')],'pass':_0x106215[_0xaffa('0x50')][_0xaffa('0x58')]};}}else{_0x38f8bf[_0xaffa('0x52')]=_0x106215[_0xaffa('0x50')][_0xaffa('0x52')];_0x38f8bf[_0xaffa('0x59')]={'user':_0x106215[_0xaffa('0x50')][_0xaffa('0x57')],'pass':_0x106215[_0xaffa('0x50')]['pass']};_0x38f8bf[_0xaffa('0x55')]=_0x106215[_0xaffa('0x50')][_0xaffa('0x55')];}if(_0x43093[_0xaffa('0x42')][_0xaffa('0x5a')]&&_0x43093[_0xaffa('0x42')]['attachments']['length']){for(var _0x12151d=0x0;_0x12151d<_0x43093[_0xaffa('0x42')][_0xaffa('0x5a')][_0xaffa('0x33')];_0x12151d+=0x1){_0x43093['body'][_0xaffa('0x5a')][_0x12151d]={'filename':_0x43093[_0xaffa('0x42')][_0xaffa('0x5a')][_0x12151d][_0xaffa('0x26')],'path':path[_0xaffa('0x5b')](config['root'],_0xaffa('0x5c'),_0x43093[_0xaffa('0x42')][_0xaffa('0x5a')][_0x12151d][_0xaffa('0x5d')])};}}_0xbbc5b4={'account':_0x38f8bf,'message':_0x43093[_0xaffa('0x42')]};return;}})[_0xaffa('0x12')](function(){if(_0x106215[_0xaffa('0x4a')]){if(_0x106215[_0xaffa('0x4a')]['Contacts'][_0xaffa('0x33')]){return _0x106215[_0xaffa('0x4a')][_0xaffa('0x4c')][0x0];}else{return db[_0xaffa('0x4b')][_0xaffa('0x44')](_['defaults'](_0x43093[_0xaffa('0x42')],{'firstName':_0x43093[_0xaffa('0x42')]['to'],'email':_0x43093[_0xaffa('0x42')]['to'],'phone':_0x43093['body']['to'],'ListId':_0x106215[_0xaffa('0x5e')]}));}}else{throw new Error(_0xaffa('0x5f'));}})[_0xaffa('0x12')](function(){if(_0xbbc5b4){return respondWithRpcPromise('SendMail','sendMail',_0xbbc5b4,client9003)[_0xaffa('0x12')](function(_0x5402d4){return _0x216fc5[_0xaffa('0x22')]({'read':!![],'messageId':_0x5402d4[_0xaffa('0x60')],'sentAt':moment()['format'](_0xaffa('0x61'))});})['catch'](function(_0x4dc3ed){logger[_0xaffa('0x18')]('%s',JSON[_0xaffa('0x62')](_0x4dc3ed));return _0x216fc5;});}return _0x216fc5;});}return _0x216fc5;}})['then'](respondWithResult(_0x20da49,0xc9))['catch'](handleError(_0x20da49,null));};exports[_0xaffa('0x63')]=function(_0x1b062d,_0x5dfaf6){var _0x427560={'agent':{},'channel':_0xaffa('0x64')};if(_0x1b062d[_0xaffa('0x42')]['id']){delete _0x1b062d[_0xaffa('0x42')]['id'];}_0x1b062d[_0xaffa('0x42')][_0xaffa('0x65')]=!![];_0x1b062d[_0xaffa('0x42')][_0xaffa('0x66')]=moment()[_0xaffa('0x67')]('YYYY-MM-DD\x20HH:mm:ss');_0x1b062d['body'][_0xaffa('0x68')]=_0x1b062d[_0xaffa('0x42')][_0xaffa('0x68')]||_0x1b062d[_0xaffa('0x57')]['id'];_0x427560[_0xaffa('0x69')]['id']=_0x1b062d['body'][_0xaffa('0x68')];return db[_0xaffa('0x29')][_0xaffa('0x41')]({'where':{'id':_0x1b062d[_0xaffa('0x3f')]['id'],'UserId':null}})[_0xaffa('0x12')](handleEntityNotFound(_0x5dfaf6,null))[_0xaffa('0x12')](saveUpdates(_0x1b062d[_0xaffa('0x42')],null))[_0xaffa('0x12')](function(_0x25efec){if(_0x25efec){_0x427560[_0xaffa('0x19')]=_0x25efec['get']({'plain':!![]});return db['MailInteraction'][_0xaffa('0x41')]({'where':{'id':_0x25efec[_0xaffa('0x6a')]}});}return null;})[_0xaffa('0x12')](handleEntityNotFound(_0x5dfaf6,null))[_0xaffa('0x12')](function(_0xa473d2){if(_0xa473d2){return _0xa473d2[_0xaffa('0x22')]({'UserId':_0x1b062d[_0xaffa('0x42')][_0xaffa('0x68')],'read1stAt':_[_0xaffa('0x51')](_0xa473d2[_0xaffa('0x6b')])?moment()[_0xaffa('0x67')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xaffa('0x12')](function(_0x36c564){if(_0x36c564){_0x427560[_0xaffa('0x6c')]=_0x36c564[_0xaffa('0x6d')]({'plain':!![]});interaction_log['info'](_0xaffa('0x6e'),_0x1b062d[_0xaffa('0x57')]['id'],_0x1b062d[_0xaffa('0x57')][_0xaffa('0x26')],_0x1b062d[_0xaffa('0x57')]['role'],_0x427560[_0xaffa('0x6c')]['id'],_0x1b062d[_0xaffa('0x42')]?JSON[_0xaffa('0x62')](_0x1b062d[_0xaffa('0x42')]):'null');return respondWithRpcPromise(_0xaffa('0x6f'),'acceptMessage',_0x427560);}return null;})[_0xaffa('0x12')](function(_0x437c89){var _0x4d00dd='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x437c89[_0xaffa('0x19')][_0xaffa('0x70')];return db[_0xaffa('0x71')][_0xaffa('0x2e')](_0x4d00dd,{'type':db['Sequelize'][_0xaffa('0x72')][_0xaffa('0x73')],'raw':!![]})[_0xaffa('0x12')](function(_0x360836){return _0x360836;});})[_0xaffa('0x12')](function(_0x356b8c){if(_0x356b8c){_0x427560[_0xaffa('0x19')][_0xaffa('0x74')]=_0x356b8c[0x0];if(!_0x1b062d['body']['UserId'])return;return db[_0xaffa('0x75')][_0xaffa('0x41')]({'where':{'id':_0x1b062d['body'][_0xaffa('0x68')],'role':'agent'},'attributes':['id',_0xaffa('0x26'),_0xaffa('0x76'),'email',_0xaffa('0x77')],'raw':!![]});}return null;})[_0xaffa('0x12')](function(_0x33824d){if(!_0x33824d)return null;_0x427560[_0xaffa('0x19')][_0xaffa('0x69')]=_0x33824d;return _0x427560;})[_0xaffa('0x12')](function(_0x3e6388){if(_0x3e6388){if(_0x1b062d[_0xaffa('0x42')][_0xaffa('0x78')]){_0x427560[_0xaffa('0x19')]['interface']=util['format'](_0xaffa('0x79'),_0x1b062d['user'][_0xaffa('0x26')]);_0x427560[_0xaffa('0x19')]['channel']=_0x427560[_0xaffa('0x7a')];_0x427560['message'][_0xaffa('0x7b')]=_0x427560['channel'];_0x427560[_0xaffa('0x19')]['event']=_0xaffa('0x63');_0x427560['message']['body']=htmlToText['fromString'](_0x427560[_0xaffa('0x19')]['body']);return respondWithRpcPromise('EventManager',_0xaffa('0x7c'),{'event':_0xaffa('0x7d'),'message':_0x427560[_0xaffa('0x19')]},client9002)[_0xaffa('0x12')](function(){return _0x427560;});}return _0x427560;}return null;})[_0xaffa('0x12')](respondWithResult(_0x5dfaf6,null))['catch'](handleError(_0x5dfaf6,null));};exports[_0xaffa('0x7e')]=function(_0x2cdbf6,_0x47f608){var _0x488305={'agent':{},'channel':'mail'};if(_0x2cdbf6[_0xaffa('0x42')]['id']){delete _0x2cdbf6[_0xaffa('0x42')]['id'];}_0x2cdbf6['body'][_0xaffa('0x68')]=_0x2cdbf6['body'][_0xaffa('0x68')]||_0x2cdbf6['user']['id'];_0x488305[_0xaffa('0x69')]['id']=_0x2cdbf6[_0xaffa('0x42')][_0xaffa('0x68')];return db[_0xaffa('0x29')][_0xaffa('0x41')]({'where':{'id':_0x2cdbf6[_0xaffa('0x3f')]['id'],'UserId':null}})[_0xaffa('0x12')](handleEntityNotFound(_0x47f608,null))['then'](function(_0xfa1a0b){if(_0xfa1a0b){_0x488305[_0xaffa('0x19')]=_0xfa1a0b[_0xaffa('0x6d')]({'plain':!![]});return db[_0xaffa('0x7f')][_0xaffa('0x41')]({'where':{'id':_0xfa1a0b[_0xaffa('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x47f608,null))[_0xaffa('0x12')](function(_0x37c47e){if(_0x37c47e){_0x488305[_0xaffa('0x6c')]=_0x37c47e[_0xaffa('0x6d')]({'plain':!![]});interaction_log['info'](_0xaffa('0x80'),_0x2cdbf6[_0xaffa('0x57')]['id'],_0x2cdbf6['user']['name'],_0x2cdbf6['user']['role'],_0x488305[_0xaffa('0x6c')]['id'],_0x2cdbf6[_0xaffa('0x42')]?JSON[_0xaffa('0x62')](_0x2cdbf6['body']):_0xaffa('0x81'));return respondWithRpcPromise(_0xaffa('0x82'),_0xaffa('0x83'),_0x488305);}return null;})['then'](function(_0x11ccd5){var _0x354695=_0xaffa('0x84')+_0x11ccd5[_0xaffa('0x19')][_0xaffa('0x70')];return db[_0xaffa('0x71')]['query'](_0x354695,{'type':db[_0xaffa('0x85')][_0xaffa('0x72')][_0xaffa('0x73')],'raw':!![]})['then'](function(_0x1bf3a4){return _0x1bf3a4;});})[_0xaffa('0x12')](function(_0x345da5){if(_0x345da5){_0x488305[_0xaffa('0x19')][_0xaffa('0x74')]=_0x345da5[0x0];if(!_0x2cdbf6[_0xaffa('0x42')]['UserId'])return;return db[_0xaffa('0x75')][_0xaffa('0x41')]({'where':{'id':_0x2cdbf6[_0xaffa('0x42')][_0xaffa('0x68')],'role':_0xaffa('0x69')},'attributes':['id',_0xaffa('0x26'),_0xaffa('0x76'),_0xaffa('0x86'),_0xaffa('0x77')],'raw':!![]});}return null;})[_0xaffa('0x12')](function(_0x2b70c9){if(!_0x2b70c9)return null;_0x488305[_0xaffa('0x19')][_0xaffa('0x69')]=_0x2b70c9;return _0x488305;})[_0xaffa('0x12')](function(_0x333f8a){if(_0x333f8a){_0x333f8a[_0xaffa('0x19')][_0xaffa('0x87')]=util['format'](_0xaffa('0x79'),_0x2cdbf6['user'][_0xaffa('0x26')]);_0x333f8a['message']['channel']=_0x488305[_0xaffa('0x7a')];_0x333f8a[_0xaffa('0x19')]['motionChannel']=_0x488305[_0xaffa('0x7a')];_0x333f8a[_0xaffa('0x19')]['event']=_0xaffa('0x7e');_0x333f8a[_0xaffa('0x19')]['body']=htmlToText['fromString'](_0x488305[_0xaffa('0x19')][_0xaffa('0x42')]);respondWithRpcPromise(_0xaffa('0x7c'),'EventManager',{'event':_0xaffa('0x88'),'message':_0x333f8a['message']},client9002);return _0x488305;}return null;})['then'](respondWithResult(_0x47f608,null))[_0xaffa('0x1b')](handleError(_0x47f608,null));};exports[_0xaffa('0x89')]=function(_0x5ac0ea,_0x28574d){var _0x53b632=moment()['unix']()['toString']();var _0x43453e=path[_0xaffa('0x5b')](config[_0xaffa('0x8a')],'server','files','tmp');var _0x4d998d=path[_0xaffa('0x5b')](config[_0xaffa('0x8a')],_0xaffa('0x8b'),'files',_0xaffa('0x5a'));var _0x29d8d4=util[_0xaffa('0x67')](_0xaffa('0x8c'),_0x53b632);return db[_0xaffa('0x29')][_0xaffa('0x41')]({'where':{'id':_0x5ac0ea[_0xaffa('0x3f')]['id']},'attributes':['id',_0xaffa('0x42'),_0xaffa('0x8d'),'to','cc',_0xaffa('0x8e'),'subject','createdAt'],'include':_0x5ac0ea[_0xaffa('0x2e')][_0xaffa('0x5a')]?[{'model':db[_0xaffa('0x8f')],'as':_0xaffa('0x90')}]:undefined})[_0xaffa('0x12')](handleEntityNotFound(_0x28574d,null))['then'](function(_0x2b6f28){if(_0x2b6f28){var _0x27aa0c=_0x2b6f28;var _0x436d9a={'from':_0x27aa0c['from'],'to':_0x27aa0c['to'],'subject':_0x27aa0c[_0xaffa('0x91')],'html':htmlEntities['decode'](_0x27aa0c[_0xaffa('0x42')]),'headers':{'Date':moment(_0x27aa0c[_0xaffa('0x92')])[_0xaffa('0x67')](_0xaffa('0x93'))},'attachments':[]};if(_0x2b6f28['cc']){_0x436d9a[_0xaffa('0x94')]['Cc']=_0x2b6f28['cc'];}if(_0x2b6f28[_0xaffa('0x8e')]){_0x436d9a[_0xaffa('0x94')]['Bcc']=_0x2b6f28[_0xaffa('0x8e')];}return new BPromise(function(_0x455149,_0x136888){if(_0x2b6f28[_0xaffa('0x90')]){for(var _0x1c6a1e=0x0;_0x1c6a1e<_0x2b6f28[_0xaffa('0x90')]['length'];_0x1c6a1e++){var _0x44735c=_0x2b6f28[_0xaffa('0x90')][_0x1c6a1e];var _0x17acca=path['join'](_0x4d998d,_0x44735c['basename']);if(fs[_0xaffa('0x95')](_0x17acca)){_0x436d9a[_0xaffa('0x5a')][_0xaffa('0x96')]({'name':_0x44735c['name'],'contentType':_0x44735c[_0xaffa('0x2b')],'data':fs[_0xaffa('0x97')](_0x17acca)});}}}emlformat[_0xaffa('0x98')](_0x436d9a,function(_0x24b245,_0x5d19b3){if(_0x24b245)return _0x136888(_0x24b245);fs[_0xaffa('0x99')](path['join'](_0x43453e,_0x29d8d4),_0x5d19b3);return _0x455149(_0x5d19b3);});});}})[_0xaffa('0x12')](function(_0x2dce16){if(_0x2dce16){return _0x28574d[_0xaffa('0x89')](path[_0xaffa('0x5b')](_0x43453e,_0x29d8d4),_0x29d8d4,function(_0x2a0a13){if(!_0x2a0a13)fs['unlinkSync'](path['join'](_0x43453e,_0x29d8d4));});}})['catch'](handleError(_0x28574d,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 81126f7..f80a91e 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 _0x3dae=['emit','hasOwnProperty','hook','exports','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x2c7477,_0x37d975){var _0x478328=function(_0x588eac){while(--_0x588eac){_0x2c7477['push'](_0x2c7477['shift']());}};_0x478328(++_0x37d975);}(_0x3dae,0x1a4));var _0xe3da=function(_0x2c7fd8,_0x1b5649){_0x2c7fd8=_0x2c7fd8-0x0;var _0xc6f519=_0x3dae[_0x2c7fd8];return _0xc6f519;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xe3da('0x0'))['db'][_0xe3da('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xe3da('0x2')](0x0);var events={'afterCreate':_0xe3da('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1e5095){return function(_0x247429,_0x5af1b8,_0x12ce35){MailMessageEvents[_0xe3da('0x4')](_0x1e5095+':'+_0x247429['id'],_0x247429);MailMessageEvents['emit'](_0x1e5095,_0x247429);_0x12ce35(null);};}for(var e in events){if(events[_0xe3da('0x5')](e)){var event=events[e];MailMessage[_0xe3da('0x6')](e,emitEvent(event));}}module[_0xe3da('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x5ca8=['remove','hasOwnProperty','hook','events','../../mysqldb','MailMessage','update'];(function(_0x1f42fd,_0x38f97e){var _0x5d417c=function(_0x3875be){while(--_0x3875be){_0x1f42fd['push'](_0x1f42fd['shift']());}};_0x5d417c(++_0x38f97e);}(_0x5ca8,0x1d8));var _0x85ca=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5ca8[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require(_0x85ca('0x0'));var MailMessage=require(_0x85ca('0x1'))['db'][_0x85ca('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x85ca('0x3'),'afterDestroy':_0x85ca('0x4')};function emitEvent(_0x2a9c03){return function(_0x554d5d,_0x4fc19a,_0x20e0de){MailMessageEvents['emit'](_0x2a9c03+':'+_0x554d5d['id'],_0x554d5d);MailMessageEvents['emit'](_0x2a9c03,_0x554d5d);_0x20e0de(null);};}for(var e in events){if(events[_0x85ca('0x5')](e)){var event=events[e];MailMessage[_0x85ca('0x6')](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 df39217..1877fb6 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 _0x93a5=['subject','body','plainBody','fromString','get','toLowerCase','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','direction','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x93a5,0xb9));var _0x593a=function(_0x3794a0,_0x1a9cfc){_0x3794a0=_0x3794a0-0x0;var _0x5bdaba=_0x93a5[_0x3794a0];return _0x5bdaba;};'use strict';var _=require(_0x593a('0x0'));var util=require(_0x593a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x593a('0x2'));var rp=require(_0x593a('0x3'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x593a('0x4'));var rimraf=require(_0x593a('0x5'));var config=require(_0x593a('0x6'));var attributes=require('./mailMessage.attributes');module[_0x593a('0x7')]=function(_0x155dd9,_0x3a4757){return _0x155dd9[_0x593a('0x8')](_0x593a('0x9'),attributes,{'tableName':_0x593a('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x593a('0xb')]},{'name':_0x593a('0xc'),'fields':['plainBody',_0x593a('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1d55bb,_0x3346ed,_0xb1ec61){if(_0x1d55bb[_0x593a('0xe')]){_0x1d55bb[_0x593a('0xf')]=htmlToText[_0x593a('0x10')](_0x1d55bb[_0x593a('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xb1ec61(null,_0x3346ed);},'afterCreate':function(_0xe29fa4,_0x1390e3,_0x234df8){var _0x284e30=_0x155dd9['models'];var _0xc5b0a7=_0xe29fa4[_0x593a('0x11')]({'plain':!![]});if(_0xc5b0a7['direction']['toLowerCase']()==='in'||_0xc5b0a7['direction'][_0x593a('0x12')]()==='out'&&!_0xc5b0a7[_0x593a('0x13')]&&!_[_0x593a('0x14')](_0xc5b0a7[_0x593a('0x15')])){_0x284e30[_0x593a('0x16')][_0x593a('0x17')]({'where':{'id':_0xc5b0a7[_0x593a('0x18')]}})[_0x593a('0x19')](function(_0x2a4b0a){if(_0x2a4b0a){_0x2a4b0a[_0x593a('0x1a')]({'lastMsgAt':_0xc5b0a7[_0x593a('0x1b')],'lastMsgDirection':_0xc5b0a7[_0x593a('0x1c')][_0x593a('0x12')]()});}})[_0x593a('0x1d')](function(_0x31e462){console[_0x593a('0x1e')](_0x31e462);});}_0x234df8();}},'charset':_0x593a('0x1f'),'collate':_0x593a('0x20')});}; \ No newline at end of file +var _0xe70c=['secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','plainBody','body','fromString','models','get','direction','toLowerCase','out'];(function(_0x5400b,_0x55943a){var _0x36a39b=function(_0x56963c){while(--_0x56963c){_0x5400b['push'](_0x5400b['shift']());}};_0x36a39b(++_0x55943a);}(_0xe70c,0xa6));var _0xce70=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xe70c[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0xce70('0x0'));var util=require(_0xce70('0x1'));var logger=require(_0xce70('0x2'))('api');var moment=require(_0xce70('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require(_0xce70('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xce70('0x5'));var config=require(_0xce70('0x6'));var attributes=require(_0xce70('0x7'));module[_0xce70('0x8')]=function(_0xadafa1,_0x4b454a){return _0xadafa1['define'](_0xce70('0x9'),attributes,{'tableName':_0xce70('0xa'),'paranoid':![],'indexes':[{'name':_0xce70('0xb'),'fields':[_0xce70('0xb')]},{'name':'fti_mail_messages','fields':[_0xce70('0xc'),'subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x231597,_0x36d04e,_0x579a0b){if(_0x231597[_0xce70('0xd')]){_0x231597[_0xce70('0xc')]=htmlToText[_0xce70('0xe')](_0x231597[_0xce70('0xd')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x579a0b(null,_0x36d04e);},'afterCreate':function(_0x5e6ab6,_0x421fdf,_0x4cc111){var _0xdec285=_0xadafa1[_0xce70('0xf')];var _0x3c5e4c=_0x5e6ab6[_0xce70('0x10')]({'plain':!![]});if(_0x3c5e4c['direction']['toLowerCase']()==='in'||_0x3c5e4c[_0xce70('0x11')][_0xce70('0x12')]()===_0xce70('0x13')&&!_0x3c5e4c[_0xce70('0x14')]&&!_[_0xce70('0x15')](_0x3c5e4c[_0xce70('0x16')])){_0xdec285[_0xce70('0x17')][_0xce70('0x18')]({'where':{'id':_0x3c5e4c[_0xce70('0x19')]}})[_0xce70('0x1a')](function(_0x59bd7c){if(_0x59bd7c){_0x59bd7c['update']({'lastMsgAt':_0x3c5e4c[_0xce70('0x1b')],'lastMsgDirection':_0x3c5e4c['direction'][_0xce70('0x12')]()});}})[_0xce70('0x1c')](function(_0x192384){console[_0xce70('0x1d')](_0x192384);});}_0x4cc111();}},'charset':'utf8mb4','collate':_0xce70('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 1b7328a..dd41450 100644 --- a/server/api/mailMessage/mailMessage.rpc.js +++ b/server/api/mailMessage/mailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd4f=['request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s'];(function(_0x2f0057,_0x448b27){var _0x17f2c3=function(_0x12efc3){while(--_0x12efc3){_0x2f0057['push'](_0x2f0057['shift']());}};_0x17f2c3(++_0x448b27);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x56df51,_0x54c20d){_0x56df51=_0x56df51-0x0;var _0x16a4db=_0xdd4f[_0x56df51];return _0x16a4db;};'use strict';var _=require(_0xfdd4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfdd4('0x1'));var fs=require('fs');var Redis=require(_0xfdd4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfdd4('0x3'));var logger=require(_0xfdd4('0x4'))(_0xfdd4('0x5'));var config=require('../../config/environment');var jayson=require(_0xfdd4('0x6'));var client=jayson[_0xfdd4('0x7')][_0xfdd4('0x8')]({'port':0x232a});config[_0xfdd4('0x9')]=_[_0xfdd4('0xa')](config['redis'],{'host':_0xfdd4('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfdd4('0x9')]));require(_0xfdd4('0xc'))[_0xfdd4('0xd')](socket);function respondWithRpcPromise(_0x4ee02f,_0x3d06c9,_0x4b4f1d){return new BPromise(function(_0x27a9f3,_0x3ce77a){return client[_0xfdd4('0xe')](_0x4ee02f,_0x4b4f1d)[_0xfdd4('0xf')](function(_0x35e22d){logger[_0xfdd4('0x10')](_0xfdd4('0x11'),_0x3d06c9,_0xfdd4('0x12'));logger[_0xfdd4('0x13')](_0xfdd4('0x14'),_0x3d06c9,_0xfdd4('0x12'),JSON['stringify'](_0x35e22d));if(_0x35e22d[_0xfdd4('0x15')]){if(_0x35e22d[_0xfdd4('0x15')][_0xfdd4('0x16')]===0x1f4){logger['error'](_0xfdd4('0x11'),_0x3d06c9,_0x35e22d['error'][_0xfdd4('0x17')]);return _0x3ce77a(_0x35e22d[_0xfdd4('0x15')][_0xfdd4('0x17')]);}logger[_0xfdd4('0x15')](_0xfdd4('0x11'),_0x3d06c9,_0x35e22d['error']['message']);return _0x27a9f3(_0x35e22d['error'][_0xfdd4('0x17')]);}else{logger[_0xfdd4('0x10')](_0xfdd4('0x11'),_0x3d06c9,_0xfdd4('0x12'));_0x27a9f3(_0x35e22d[_0xfdd4('0x18')][_0xfdd4('0x17')]);}})[_0xfdd4('0x19')](function(_0x2ffd5f){logger[_0xfdd4('0x15')]('MailMessage,\x20%s,\x20%s',_0x3d06c9,_0x2ffd5f);_0x3ce77a(_0x2ffd5f);});});}exports[_0xfdd4('0x1a')]=function(_0x3e8eac){var _0x2dc51c=this;return new Promise(function(_0x36e611,_0x1454f1){return db[_0xfdd4('0x1b')][_0xfdd4('0x1c')](_0x3e8eac[_0xfdd4('0x1d')],{'raw':_0x3e8eac['options']?_0x3e8eac[_0xfdd4('0x1e')][_0xfdd4('0x1f')]===undefined?!![]:![]:!![]})[_0xfdd4('0xf')](function(_0x16e81b){logger[_0xfdd4('0x10')](_0xfdd4('0x1a'),_0x3e8eac);logger[_0xfdd4('0x13')](_0xfdd4('0x1a'),_0x3e8eac,JSON['stringify'](_0x16e81b));_0x36e611(_0x16e81b);})[_0xfdd4('0x19')](function(_0x1112e8){logger[_0xfdd4('0x15')]('CreateMailMessage',_0x1112e8[_0xfdd4('0x17')],_0x3e8eac);_0x1454f1(_0x2dc51c[_0xfdd4('0x15')](0x1f4,_0x1112e8[_0xfdd4('0x17')]));});});}; \ No newline at end of file +var _0xb574=['../../config/environment','http','socket.io-emitter','redis','./mailMessage.socket','register','request','then','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailMessage,\x20%s,\x20%s','info','catch','CreateMailMessage','MailMessage','body','options','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4cb095,_0x58da07){var _0x2b565d=function(_0x4d41b3){while(--_0x4d41b3){_0x4cb095['push'](_0x4cb095['shift']());}};_0x2b565d(++_0x58da07);}(_0xb574,0x106));var _0x4b57=function(_0x3fa894,_0x55e583){_0x3fa894=_0x3fa894-0x0;var _0x363840=_0xb574[_0x3fa894];return _0x363840;};'use strict';var _=require(_0x4b57('0x0'));var util=require(_0x4b57('0x1'));var moment=require('moment');var BPromise=require(_0x4b57('0x2'));var rs=require(_0x4b57('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b57('0x4'))['db'];var utils=require(_0x4b57('0x5'));var logger=require(_0x4b57('0x6'))(_0x4b57('0x7'));var config=require(_0x4b57('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4b57('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4b57('0xa'))(new Redis(config[_0x4b57('0xb')]));require(_0x4b57('0xc'))[_0x4b57('0xd')](socket);function respondWithRpcPromise(_0xce47ad,_0x116958,_0x1db79a){return new BPromise(function(_0x43b108,_0x5593b8){return client[_0x4b57('0xe')](_0xce47ad,_0x1db79a)[_0x4b57('0xf')](function(_0x274912){logger['info']('MailMessage,\x20%s,\x20%s',_0x116958,_0x4b57('0x10'));logger[_0x4b57('0x11')](_0x4b57('0x12'),_0x116958,_0x4b57('0x10'),JSON[_0x4b57('0x13')](_0x274912));if(_0x274912[_0x4b57('0x14')]){if(_0x274912[_0x4b57('0x14')][_0x4b57('0x15')]===0x1f4){logger[_0x4b57('0x14')]('MailMessage,\x20%s,\x20%s',_0x116958,_0x274912['error'][_0x4b57('0x16')]);return _0x5593b8(_0x274912[_0x4b57('0x14')][_0x4b57('0x16')]);}logger['error'](_0x4b57('0x17'),_0x116958,_0x274912['error'][_0x4b57('0x16')]);return _0x43b108(_0x274912[_0x4b57('0x14')][_0x4b57('0x16')]);}else{logger[_0x4b57('0x18')](_0x4b57('0x17'),_0x116958,_0x4b57('0x10'));_0x43b108(_0x274912['result'][_0x4b57('0x16')]);}})[_0x4b57('0x19')](function(_0x53f29a){logger[_0x4b57('0x14')]('MailMessage,\x20%s,\x20%s',_0x116958,_0x53f29a);_0x5593b8(_0x53f29a);});});}exports[_0x4b57('0x1a')]=function(_0x1ca49e){var _0xad9165=this;return new Promise(function(_0x2682d6,_0xef1eae){return db[_0x4b57('0x1b')]['create'](_0x1ca49e[_0x4b57('0x1c')],{'raw':_0x1ca49e[_0x4b57('0x1d')]?_0x1ca49e[_0x4b57('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x4b57('0xf')](function(_0x4a34b2){logger[_0x4b57('0x18')](_0x4b57('0x1a'),_0x1ca49e);logger['debug'](_0x4b57('0x1a'),_0x1ca49e,JSON[_0x4b57('0x13')](_0x4a34b2));_0x2682d6(_0x4a34b2);})['catch'](function(_0x3e7b96){logger[_0x4b57('0x14')](_0x4b57('0x1a'),_0x3e7b96[_0x4b57('0x16')],_0x1ca49e);_0xef1eae(_0xad9165['error'](0x1f4,_0x3e7b96[_0x4b57('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 4b257d4..d47eda6 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 _0x6250=['mailMessage:','save','remove','removeListener','register','length'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0x6250,0x85));var _0x0625=function(_0x301fd8,_0x30123f){_0x301fd8=_0x301fd8-0x0;var _0x264dc5=_0x6250[_0x301fd8];return _0x264dc5;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x0625('0x0'),_0x0625('0x1'),'update'];function createListener(_0x4dd230,_0x4b5f07){return function(_0x3358a0){_0x4b5f07['emit'](_0x4dd230,_0x3358a0);};}function removeListener(_0x2c4434,_0x345b5a){return function(){MailMessageEvents[_0x0625('0x2')](_0x2c4434,_0x345b5a);};}exports[_0x0625('0x3')]=function(_0x44cc7e){for(var _0x7ed7c=0x0,_0x471922=events[_0x0625('0x4')];_0x7ed7c<_0x471922;_0x7ed7c++){var _0x4b4368=events[_0x7ed7c];var _0x45f888=createListener(_0x0625('0x5')+_0x4b4368,_0x44cc7e);MailMessageEvents['on'](_0x4b4368,_0x45f888);}}; \ No newline at end of file +var _0x5d44=['save','remove','emit','removeListener','mailMessage:','./mailMessage.events'];(function(_0x1dede5,_0x34f753){var _0xa5202d=function(_0x58e7e5){while(--_0x58e7e5){_0x1dede5['push'](_0x1dede5['shift']());}};_0xa5202d(++_0x34f753);}(_0x5d44,0xd1));var _0x45d4=function(_0x56e49b,_0xdc8c92){_0x56e49b=_0x56e49b-0x0;var _0x271d4b=_0x5d44[_0x56e49b];return _0x271d4b;};'use strict';var MailMessageEvents=require(_0x45d4('0x0'));var events=[_0x45d4('0x1'),_0x45d4('0x2'),'update'];function createListener(_0xed644d,_0x183dc5){return function(_0x40f3b5){_0x183dc5[_0x45d4('0x3')](_0xed644d,_0x40f3b5);};}function removeListener(_0x3274b4,_0xd87eda){return function(){MailMessageEvents[_0x45d4('0x4')](_0x3274b4,_0xd87eda);};}exports['register']=function(_0x1c9d70){for(var _0x17e99c=0x0,_0x32d570=events['length'];_0x17e99c<_0x32d570;_0x17e99c++){var _0x2717b2=events[_0x17e99c];var _0x4ecf33=createListener(_0x45d4('0x5')+_0x2717b2,_0x1c9d70);MailMessageEvents['on'](_0x2717b2,_0x4ecf33);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index ae1ed31..13fa178 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 _0x47a5=['show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','/describe','get','/:id'];(function(_0x644ecd,_0x397f36){var _0x1c66ce=function(_0x4cf42b){while(--_0x4cf42b){_0x644ecd['push'](_0x644ecd['shift']());}};_0x1c66ce(++_0x397f36);}(_0x47a5,0x179));var _0x547a=function(_0x4a57c6,_0x4810ee){_0x4a57c6=_0x4a57c6-0x0;var _0x2cfa7e=_0x47a5[_0x4a57c6];return _0x2cfa7e;};'use strict';var multer=require(_0x547a('0x0'));var util=require(_0x547a('0x1'));var path=require(_0x547a('0x2'));var timeout=require(_0x547a('0x3'));var express=require(_0x547a('0x4'));var router=express[_0x547a('0x5')]();var fs_extra=require(_0x547a('0x6'));var auth=require(_0x547a('0x7'));var interaction=require(_0x547a('0x8'));var config=require(_0x547a('0x9'));var controller=require(_0x547a('0xa'));router['get']('/',auth[_0x547a('0xb')](),controller['index']);router['get'](_0x547a('0xc'),auth[_0x547a('0xb')](),controller['describe']);router[_0x547a('0xd')](_0x547a('0xe'),auth[_0x547a('0xb')](),controller[_0x547a('0xf')]);router['get']('/:id/members',auth[_0x547a('0xb')](),controller[_0x547a('0x10')]);router[_0x547a('0xd')](_0x547a('0x11'),auth[_0x547a('0xb')](),controller[_0x547a('0x12')]);router[_0x547a('0xd')](_0x547a('0x13'),auth[_0x547a('0xb')](),controller[_0x547a('0x14')]);router[_0x547a('0x15')]('/',auth[_0x547a('0xb')](),controller['create']);router['post'](_0x547a('0x11'),auth[_0x547a('0xb')](),controller['addTeams']);router[_0x547a('0x15')](_0x547a('0x13'),auth[_0x547a('0xb')](),controller['addAgents']);router[_0x547a('0x16')](_0x547a('0xe'),auth[_0x547a('0xb')](),controller[_0x547a('0x17')]);router[_0x547a('0x18')](_0x547a('0xe'),auth['isAuthenticated'](),controller[_0x547a('0x19')]);router[_0x547a('0x18')](_0x547a('0x11'),auth[_0x547a('0xb')](),controller['removeTeams']);router['delete'](_0x547a('0x13'),auth[_0x547a('0xb')](),controller[_0x547a('0x1a')]);module[_0x547a('0x1b')]=router; \ No newline at end of file +var _0xa4d6=['get','describe','/:id','isAuthenticated','/:id/members','getAgents','post','create','addAgents','put','update','destroy','delete','/:id/teams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailQueue.controller','index'];(function(_0x1f647d,_0x517668){var _0x3de573=function(_0x1cc9c9){while(--_0x1cc9c9){_0x1f647d['push'](_0x1f647d['shift']());}};_0x3de573(++_0x517668);}(_0xa4d6,0x79));var _0x6a4d=function(_0x257b0e,_0x563d7e){_0x257b0e=_0x257b0e-0x0;var _0x27ac2a=_0xa4d6[_0x257b0e];return _0x27ac2a;};'use strict';var multer=require(_0x6a4d('0x0'));var util=require('util');var path=require(_0x6a4d('0x1'));var timeout=require(_0x6a4d('0x2'));var express=require(_0x6a4d('0x3'));var router=express[_0x6a4d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6a4d('0x5'));var config=require(_0x6a4d('0x6'));var controller=require(_0x6a4d('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x6a4d('0x8')]);router[_0x6a4d('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x6a4d('0xa')]);router[_0x6a4d('0x9')](_0x6a4d('0xb'),auth[_0x6a4d('0xc')](),controller['show']);router[_0x6a4d('0x9')](_0x6a4d('0xd'),auth['isAuthenticated'](),controller['getMembers']);router[_0x6a4d('0x9')]('/:id/teams',auth[_0x6a4d('0xc')](),controller['getTeams']);router[_0x6a4d('0x9')]('/:id/users',auth[_0x6a4d('0xc')](),controller[_0x6a4d('0xe')]);router[_0x6a4d('0xf')]('/',auth[_0x6a4d('0xc')](),controller[_0x6a4d('0x10')]);router[_0x6a4d('0xf')]('/:id/teams',auth[_0x6a4d('0xc')](),controller['addTeams']);router[_0x6a4d('0xf')]('/:id/users',auth[_0x6a4d('0xc')](),controller[_0x6a4d('0x11')]);router[_0x6a4d('0x12')](_0x6a4d('0xb'),auth[_0x6a4d('0xc')](),controller[_0x6a4d('0x13')]);router['delete'](_0x6a4d('0xb'),auth[_0x6a4d('0xc')](),controller[_0x6a4d('0x14')]);router[_0x6a4d('0x15')](_0x6a4d('0x16'),auth[_0x6a4d('0xc')](),controller['removeTeams']);router[_0x6a4d('0x15')](_0x6a4d('0x17'),auth[_0x6a4d('0xc')](),controller[_0x6a4d('0x18')]);module[_0x6a4d('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 47e9dfc..7f99937 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 _0xbdad=['roundrobin','sequelize','name','STRING','rrmemory'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xbdad,0x13c));var _0xdbda=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xbdad[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0xdbda('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xdbda('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdbda('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xdbda('0x3'),'beepall',_0xdbda('0x4'))}}; \ No newline at end of file +var _0xce1f=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x5f25b3,_0x35481a){var _0x4ab9bf=function(_0x49baf7){while(--_0x49baf7){_0x5f25b3['push'](_0x5f25b3['shift']());}};_0x4ab9bf(++_0x35481a);}(_0xce1f,0x11f));var _0xfce1=function(_0x5788a1,_0x20ee1d){_0x5788a1=_0x5788a1-0x0;var _0xd66764=_0xce1f[_0x5788a1];return _0xd66764;};'use strict';var Sequelize=require(_0xfce1('0x0'));module[_0xfce1('0x1')]={'name':{'type':Sequelize[_0xfce1('0x2')],'unique':_0xfce1('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfce1('0x2')]},'timeout':{'type':Sequelize[_0xfce1('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfce1('0x5')](_0xfce1('0x6'),_0xfce1('0x7'),_0xfce1('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 3864f56..ccd8624 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 _0x08e5=['isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','MailQueue','rawAttributes','type','key','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','model','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','MailQueueId','User','UserId','agent','mailPause','updatedAt','createdAt','format','SIP','getTeams','Team','voicePause','interface','flatMap','Agents','sequelize','each','findOrCreate','forEach','userMailQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread'];(function(_0x4cf8d4,_0x5aee73){var _0x2c1beb=function(_0x39b0a4){while(--_0x39b0a4){_0x4cf8d4['push'](_0x4cf8d4['shift']());}};_0x2c1beb(++_0x5aee73);}(_0x08e5,0x1a9));var _0x508e=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x08e5[_0x1d1779];return _0x2377e9;};'use strict';var emlformat=require(_0x508e('0x0'));var rimraf=require(_0x508e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x508e('0x2'));var rp=require(_0x508e('0x3'));var moment=require(_0x508e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x508e('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x508e('0x6'));var ejs=require(_0x508e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x508e('0x8'));var squel=require(_0x508e('0x9'));var crypto=require(_0x508e('0xa'));var jsforce=require(_0x508e('0xb'));var deskjs=require(_0x508e('0xc'));var toCsv=require(_0x508e('0x6'));var querystring=require(_0x508e('0xd'));var Papa=require(_0x508e('0xe'));var Redis=require(_0x508e('0xf'));var authService=require(_0x508e('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x508e('0x11'))(_0x508e('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x508e('0x13'));var db=require('../../mysqldb')['db'];config[_0x508e('0x14')]=_[_0x508e('0x15')](config[_0x508e('0x14')],{'host':_0x508e('0x16'),'port':0x18eb});var socket=require(_0x508e('0x17'))(new Redis(config[_0x508e('0x14')]));require(_0x508e('0x18'))[_0x508e('0x19')](socket);function respondWithStatusCode(_0x14ebe2,_0x48ce42){_0x48ce42=_0x48ce42||0xcc;return function(_0x58f77d){if(_0x58f77d){return _0x14ebe2[_0x508e('0x1a')](_0x48ce42);}return _0x14ebe2[_0x508e('0x1b')](_0x48ce42)['end']();};}function respondWithResult(_0x5b665b,_0x32d74a){_0x32d74a=_0x32d74a||0xc8;return function(_0x1c65a3){if(_0x1c65a3){return _0x5b665b[_0x508e('0x1b')](_0x32d74a)[_0x508e('0x1c')](_0x1c65a3);}};}function respondWithFilteredResult(_0x5afc02,_0x217c48){return function(_0x24ffcb){if(_0x24ffcb){var _0x5900ab=typeof _0x217c48[_0x508e('0x1d')]===_0x508e('0x1e')&&typeof _0x217c48[_0x508e('0x1f')]===_0x508e('0x1e');var _0x262dce=_0x24ffcb[_0x508e('0x20')];var _0x5a6e39=_0x5900ab?0x0:_0x217c48[_0x508e('0x1d')];var _0x3b6358=_0x5900ab?_0x24ffcb['count']:_0x217c48[_0x508e('0x1d')]+_0x217c48['limit'];var _0x3c0720;if(_0x3b6358>=_0x262dce){_0x3b6358=_0x262dce;_0x3c0720=0xc8;}else{_0x3c0720=0xce;}_0x5afc02[_0x508e('0x1b')](_0x3c0720);return _0x5afc02[_0x508e('0x21')](_0x508e('0x22'),_0x5a6e39+'-'+_0x3b6358+'/'+_0x262dce)[_0x508e('0x1c')](_0x24ffcb);}return null;};}function patchUpdates(_0x24ad18){return function(_0x19ac5a){try{jsonpatch[_0x508e('0x23')](_0x19ac5a,_0x24ad18,!![]);}catch(_0x4c29c6){return BPromise[_0x508e('0x24')](_0x4c29c6);}return _0x19ac5a[_0x508e('0x25')]();};}function saveUpdates(_0x593f6c,_0x27fb56){return function(_0xe75898){if(_0xe75898){return _0xe75898['update'](_0x593f6c)[_0x508e('0x26')](function(_0xbfbdf4){return _0xbfbdf4;});}return null;};}function removeEntity(_0x48f7c6,_0x2b8bcf){return function(_0x56da9d){if(_0x56da9d){return _0x56da9d[_0x508e('0x27')]()[_0x508e('0x26')](function(){var _0x4460c6=_0x56da9d[_0x508e('0x28')]({'plain':!![]});var _0x1695d6='MailQueues';return db[_0x508e('0x29')][_0x508e('0x27')]({'where':{'type':_0x1695d6,'resourceId':_0x4460c6['id']}})[_0x508e('0x26')](function(){return _0x56da9d;});})[_0x508e('0x26')](function(){_0x48f7c6['status'](0xcc)[_0x508e('0x2a')]();});}};}function handleEntityNotFound(_0x825603,_0x1f17ff){return function(_0x183c81){if(!_0x183c81){_0x825603[_0x508e('0x1a')](0x194);}return _0x183c81;};}function handleError(_0x423fea,_0x3203c0){_0x3203c0=_0x3203c0||0x1f4;return function(_0x421878){logger[_0x508e('0x2b')](_0x421878[_0x508e('0x2c')]);if(_0x421878[_0x508e('0x2d')]){delete _0x421878['name'];}_0x423fea[_0x508e('0x1b')](_0x3203c0)[_0x508e('0x2e')](_0x421878);};}exports[_0x508e('0x2f')]=function(_0x35b749,_0x44f21a){var _0x3503b7={},_0x379373={},_0xc0e7cf={'count':0x0,'rows':[]};var _0x34539c=_[_0x508e('0x30')](db[_0x508e('0x31')][_0x508e('0x32')],function(_0x522813){return{'name':_0x522813['fieldName'],'type':_0x522813[_0x508e('0x33')][_0x508e('0x34')]};});_0x379373['model']=_[_0x508e('0x30')](_0x34539c,_0x508e('0x2d'));_0x379373[_0x508e('0x35')]=_['keys'](_0x35b749[_0x508e('0x35')]);_0x379373['filters']=_[_0x508e('0x36')](_0x379373['model'],_0x379373[_0x508e('0x35')]);_0x3503b7['attributes']=_['intersection'](_0x379373['model'],qs[_0x508e('0x37')](_0x35b749['query'][_0x508e('0x37')]));_0x3503b7[_0x508e('0x38')]=_0x3503b7[_0x508e('0x38')][_0x508e('0x39')]?_0x3503b7[_0x508e('0x38')]:_0x379373['model'];if(!_0x35b749[_0x508e('0x35')]['hasOwnProperty'](_0x508e('0x3a'))){_0x3503b7[_0x508e('0x1f')]=qs[_0x508e('0x1f')](_0x35b749[_0x508e('0x35')][_0x508e('0x1f')]);_0x3503b7[_0x508e('0x1d')]=qs[_0x508e('0x1d')](_0x35b749[_0x508e('0x35')][_0x508e('0x1d')]);}_0x3503b7[_0x508e('0x3b')]=qs['sort'](_0x35b749['query'][_0x508e('0x3c')]);_0x3503b7[_0x508e('0x3d')]=qs[_0x508e('0x3e')](_[_0x508e('0x3f')](_0x35b749['query'],_0x379373[_0x508e('0x3e')]),_0x34539c);if(_0x35b749[_0x508e('0x35')][_0x508e('0x40')]){_0x3503b7[_0x508e('0x3d')]=_[_0x508e('0x41')](_0x3503b7[_0x508e('0x3d')],{'$or':_['map'](_0x34539c,function(_0x4fe993){if(_0x4fe993[_0x508e('0x33')]!==_0x508e('0x42')){var _0x3358b3={};_0x3358b3[_0x4fe993[_0x508e('0x2d')]]={'$like':'%'+_0x35b749[_0x508e('0x35')][_0x508e('0x40')]+'%'};return _0x3358b3;}})});}_0x3503b7=_[_0x508e('0x41')]({},_0x3503b7,_0x35b749[_0x508e('0x43')]);var _0x17eabf={'where':_0x3503b7['where']};return db[_0x508e('0x31')][_0x508e('0x20')](_0x17eabf)['then'](function(_0x2c583f){_0xc0e7cf[_0x508e('0x20')]=_0x2c583f;if(_0x35b749[_0x508e('0x35')][_0x508e('0x44')]){_0x3503b7['include']=[{'all':!![]}];}return db['MailQueue'][_0x508e('0x45')](_0x3503b7);})[_0x508e('0x26')](function(_0x1b807f){_0xc0e7cf[_0x508e('0x46')]=_0x1b807f;return _0xc0e7cf;})['then'](respondWithFilteredResult(_0x44f21a,_0x3503b7))[_0x508e('0x47')](handleError(_0x44f21a,null));};exports['show']=function(_0x18fea0,_0x1ee4b8){var _0x5cb777={'raw':!![],'where':{'id':_0x18fea0[_0x508e('0x48')]['id']}},_0x388fcf={};_0x388fcf[_0x508e('0x49')]=_['keys'](db[_0x508e('0x31')]['rawAttributes']);_0x388fcf['query']=_[_0x508e('0x4a')](_0x18fea0['query']);_0x388fcf[_0x508e('0x3e')]=_[_0x508e('0x36')](_0x388fcf[_0x508e('0x49')],_0x388fcf[_0x508e('0x35')]);_0x5cb777['attributes']=_[_0x508e('0x36')](_0x388fcf[_0x508e('0x49')],qs[_0x508e('0x37')](_0x18fea0[_0x508e('0x35')]['fields']));_0x5cb777[_0x508e('0x38')]=_0x5cb777['attributes']['length']?_0x5cb777[_0x508e('0x38')]:_0x388fcf[_0x508e('0x49')];if(_0x18fea0[_0x508e('0x35')][_0x508e('0x44')]){_0x5cb777[_0x508e('0x4b')]=[{'all':!![]}];}_0x5cb777=_['merge']({},_0x5cb777,_0x18fea0[_0x508e('0x43')]);return db[_0x508e('0x31')][_0x508e('0x4c')](_0x5cb777)[_0x508e('0x26')](handleEntityNotFound(_0x1ee4b8,null))['then'](respondWithResult(_0x1ee4b8,null))[_0x508e('0x47')](handleError(_0x1ee4b8,null));};exports[_0x508e('0x4d')]=function(_0xb5dab9,_0x1a21c4){return db['MailQueue'][_0x508e('0x4d')](_0xb5dab9['body'],{})[_0x508e('0x26')](function(_0x7304c2){var _0x68541d=_0xb5dab9[_0x508e('0x4e')][_0x508e('0x28')]({'plain':!![]});if(!_0x68541d)throw new Error(_0x508e('0x4f'));if(_0x68541d[_0x508e('0x50')]===_0x508e('0x4e')){var _0x587a87=_0x7304c2[_0x508e('0x28')]({'plain':!![]});var _0x4ba38e=_0x508e('0x51');return db[_0x508e('0x52')][_0x508e('0x4c')]({'where':{'name':_0x4ba38e,'userProfileId':_0x68541d[_0x508e('0x53')]},'raw':!![]})[_0x508e('0x26')](function(_0x125996){if(_0x125996&&_0x125996[_0x508e('0x54')]===0x0){return db[_0x508e('0x29')][_0x508e('0x4d')]({'name':_0x587a87[_0x508e('0x2d')],'resourceId':_0x587a87['id'],'type':_0x125996['name'],'sectionId':_0x125996['id']},{})[_0x508e('0x26')](function(){return _0x7304c2;});}else{return _0x7304c2;}})['catch'](function(_0xd91419){logger[_0x508e('0x2b')](_0x508e('0x55'),_0xd91419);throw _0xd91419;});}return _0x7304c2;})['then'](respondWithResult(_0x1a21c4,0xc9))[_0x508e('0x47')](handleError(_0x1a21c4,null));};exports[_0x508e('0x56')]=function(_0x5948f1,_0xcbc265){if(_0x5948f1[_0x508e('0x57')]['id']){delete _0x5948f1[_0x508e('0x57')]['id'];}return db[_0x508e('0x31')][_0x508e('0x4c')]({'where':{'id':_0x5948f1[_0x508e('0x48')]['id']}})['then'](handleEntityNotFound(_0xcbc265,null))[_0x508e('0x26')](saveUpdates(_0x5948f1[_0x508e('0x57')],null))['then'](respondWithResult(_0xcbc265,null))[_0x508e('0x47')](handleError(_0xcbc265,null));};exports[_0x508e('0x27')]=function(_0x4e3693,_0x4f0233){return db['MailQueue'][_0x508e('0x4c')]({'where':{'id':_0x4e3693['params']['id']}})[_0x508e('0x26')](handleEntityNotFound(_0x4f0233,null))['then'](removeEntity(_0x4f0233,null))['catch'](handleError(_0x4f0233,null));};exports[_0x508e('0x58')]=function(_0xb269d8,_0xc7c4c1){return db[_0x508e('0x31')][_0x508e('0x58')]()['then'](respondWithResult(_0xc7c4c1,null))[_0x508e('0x47')](handleError(_0xc7c4c1,null));};exports[_0x508e('0x59')]=function(_0x36aa84,_0x516c48,_0x1eb76b){var _0x4621a5={'raw':!![],'where':{}},_0x167d14={},_0x450f16;return db[_0x508e('0x31')][_0x508e('0x5a')]({'where':{'id':_0x36aa84[_0x508e('0x48')]['id']}})[_0x508e('0x26')](handleEntityNotFound(_0x516c48,null))[_0x508e('0x26')](function(_0x4cdfc5){if(_0x4cdfc5){_0x450f16=_0x4cdfc5['get']({'plain':!![]});_0x167d14[_0x508e('0x49')]=_[_0x508e('0x4a')](db[_0x508e('0x5b')][_0x508e('0x32')]);_0x167d14[_0x508e('0x35')]=_['keys'](_0x36aa84[_0x508e('0x35')]);_0x167d14[_0x508e('0x3e')]=_[_0x508e('0x36')](_0x167d14[_0x508e('0x49')],_0x167d14[_0x508e('0x35')]);_0x4621a5[_0x508e('0x38')]=_[_0x508e('0x36')](_0x167d14[_0x508e('0x49')],qs[_0x508e('0x37')](_0x36aa84[_0x508e('0x35')][_0x508e('0x37')]));_0x4621a5[_0x508e('0x38')]=_0x4621a5[_0x508e('0x38')][_0x508e('0x39')]?_0x4621a5['attributes']:_0x167d14[_0x508e('0x49')];if(!_0x36aa84['query'][_0x508e('0x5c')](_0x508e('0x3a'))){_0x4621a5[_0x508e('0x1f')]=qs[_0x508e('0x1f')](_0x36aa84['query'][_0x508e('0x1f')]);_0x4621a5[_0x508e('0x1d')]=qs[_0x508e('0x1d')](_0x36aa84[_0x508e('0x35')][_0x508e('0x1d')]);}_0x4621a5[_0x508e('0x3b')]=qs[_0x508e('0x3c')](_0x36aa84[_0x508e('0x35')][_0x508e('0x3c')]);_0x4621a5[_0x508e('0x3d')]=qs[_0x508e('0x3e')](_[_0x508e('0x3f')](_0x36aa84[_0x508e('0x35')],_0x167d14['filters']));_0x4621a5['where'][_0x508e('0x5d')]=_0x4cdfc5['id'];if(_0x36aa84[_0x508e('0x35')]['filter']){_0x4621a5[_0x508e('0x3d')]=_['merge'](_0x4621a5['where'],{'$or':_[_0x508e('0x30')](_0x4621a5[_0x508e('0x38')],function(_0x293519){var _0x458ab2={};_0x458ab2[_0x293519]={'$like':'%'+_0x36aa84[_0x508e('0x35')][_0x508e('0x40')]+'%'};return _0x458ab2;})});}_0x4621a5=_[_0x508e('0x41')]({},_0x4621a5,_0x36aa84[_0x508e('0x43')]);return db[_0x508e('0x5b')][_0x508e('0x45')](_0x4621a5);}})[_0x508e('0x26')](function(_0x41dd99){if(_0x41dd99){return db[_0x508e('0x5e')]['findAndCountAll']({'where':{'id':_[_0x508e('0x30')](_0x41dd99,_0x508e('0x5f')),'role':_0x508e('0x60')},'attributes':['id',_0x508e('0x2d'),_0x508e('0x61'),_0x508e('0x62'),_0x508e('0x63')]});}})['then'](function(_0x1510cf){if(_0x1510cf){return{'count':_0x1510cf[_0x508e('0x20')],'rows':_[_0x508e('0x30')](_0x1510cf[_0x508e('0x46')],function(_0x4dd579){return{'membername':_0x4dd579[_0x508e('0x2d')],'UserId':_0x4dd579['id'],'queue_name':_0x450f16['name'],'MailQueueId':_0x450f16['id'],'interface':util[_0x508e('0x64')]('%s/%s',_0x508e('0x65'),_0x4dd579[_0x508e('0x2d')]),'penalty':0x0,'paused':_0x4dd579[_0x508e('0x61')],'createdAt':_0x4dd579[_0x508e('0x63')],'updatedAt':_0x4dd579['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x508e('0x26')](respondWithFilteredResult(_0x516c48,_0x4621a5))[_0x508e('0x47')](handleError(_0x516c48,null));};exports[_0x508e('0x66')]=function(_0x25ec95,_0x20950f,_0x3309e7){var _0x4edddf={};var _0x415d2f={};var _0xd76d33;var _0x274754;return db[_0x508e('0x31')][_0x508e('0x5a')]({'where':{'id':_0x25ec95[_0x508e('0x48')]['id']}})[_0x508e('0x26')](handleEntityNotFound(_0x20950f,null))[_0x508e('0x26')](function(_0x22f062){if(_0x22f062){_0xd76d33=_0x22f062;_0x415d2f[_0x508e('0x49')]=_['keys'](db[_0x508e('0x67')][_0x508e('0x32')]);_0x415d2f[_0x508e('0x35')]=_[_0x508e('0x4a')](_0x25ec95['query']);_0x415d2f['filters']=_[_0x508e('0x36')](_0x415d2f[_0x508e('0x49')],_0x415d2f[_0x508e('0x35')]);_0x4edddf[_0x508e('0x38')]=_[_0x508e('0x36')](_0x415d2f[_0x508e('0x49')],qs[_0x508e('0x37')](_0x25ec95[_0x508e('0x35')]['fields']));_0x4edddf['attributes']=_0x4edddf[_0x508e('0x38')][_0x508e('0x39')]?_0x4edddf[_0x508e('0x38')]:_0x415d2f[_0x508e('0x49')];_0x4edddf[_0x508e('0x3b')]=qs[_0x508e('0x3c')](_0x25ec95[_0x508e('0x35')][_0x508e('0x3c')]);_0x4edddf['where']=qs['filters'](_[_0x508e('0x3f')](_0x25ec95[_0x508e('0x35')],_0x415d2f['filters']));if(_0x25ec95[_0x508e('0x35')][_0x508e('0x40')]){_0x4edddf[_0x508e('0x3d')]=_[_0x508e('0x41')](_0x4edddf['where'],{'$or':_[_0x508e('0x30')](_0x4edddf['attributes'],function(_0x284c4e){var _0x6a4387={};_0x6a4387[_0x284c4e]={'$like':'%'+_0x25ec95[_0x508e('0x35')][_0x508e('0x40')]+'%'};return _0x6a4387;})});}_0x4edddf=_['merge']({},_0x4edddf,_0x25ec95[_0x508e('0x43')]);return _0xd76d33[_0x508e('0x66')](_0x4edddf);}})[_0x508e('0x26')](function(_0x15c8e2){if(_0x15c8e2){_0x274754=_0x15c8e2[_0x508e('0x39')];if(!_0x25ec95[_0x508e('0x35')][_0x508e('0x5c')](_0x508e('0x3a'))){_0x4edddf[_0x508e('0x1f')]=qs[_0x508e('0x1f')](_0x25ec95['query'][_0x508e('0x1f')]);_0x4edddf[_0x508e('0x1d')]=qs[_0x508e('0x1d')](_0x25ec95[_0x508e('0x35')][_0x508e('0x1d')]);}return _0xd76d33['getTeams'](_0x4edddf);}})['then'](function(_0x17025c){if(_0x17025c){return _0x17025c?{'count':_0x274754,'rows':_0x17025c}:null;}})[_0x508e('0x26')](respondWithResult(_0x20950f,null))[_0x508e('0x47')](handleError(_0x20950f,null));};exports['addTeams']=function(_0x2b5078,_0x586d3e,_0x49ae1e){var _0x1acc91=_0x2b5078[_0x508e('0x57')]['ids'];return db['Team'][_0x508e('0x45')]({'where':{'id':_0x1acc91},'attributes':['id'],'include':[{'model':db[_0x508e('0x5e')],'as':'Agents','attributes':['id',_0x508e('0x2d'),'online',_0x508e('0x68'),_0x508e('0x69')],'raw':!![]}]})[_0x508e('0x26')](function(_0x319579){if(_0x319579){var _0x489e6e=_[_0x508e('0x6a')](_0x319579,function(_0x1f947e){var _0x1419c1=_0x1f947e[_0x508e('0x28')]({'plain':!![]});return _0x1419c1[_0x508e('0x6b')];});return db['MailQueue'][_0x508e('0x4c')]({'where':{'id':_0x2b5078[_0x508e('0x48')]['id']}})[_0x508e('0x26')](function(_0x4c3ee1){return db[_0x508e('0x6c')]['transaction'](function(_0x2c34b2){return _0x4c3ee1['addTeams'](_0x1acc91,{'transaction':_0x2c34b2})['then'](function(){return BPromise[_0x508e('0x6d')](_0x489e6e,function(_0xe42cb3){return db[_0x508e('0x5b')][_0x508e('0x6e')]({'where':{'UserId':_0xe42cb3['id'],'MailQueueId':_0x2b5078['params']['id']},'transaction':_0x2c34b2});});})[_0x508e('0x26')](function(){_0x489e6e[_0x508e('0x6f')](function(_0x2972cc){socket['emit'](_0x508e('0x70'),{'UserId':_0x2972cc['id'],'MailQueueId':_0x4c3ee1['id']});});});});});}})[_0x508e('0x26')](respondWithStatusCode(_0x586d3e,null))[_0x508e('0x47')](handleError(_0x586d3e,null));};exports[_0x508e('0x71')]=function(_0x1807ae,_0x321b3a,_0x1238b0){return db[_0x508e('0x67')][_0x508e('0x45')]({'where':{'id':_0x1807ae[_0x508e('0x35')][_0x508e('0x72')]},'attributes':['id'],'include':[{'model':db[_0x508e('0x5e')],'as':_0x508e('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x508e('0x26')](handleEntityNotFound(_0x321b3a,null))['then'](function(_0x3f7783){var _0x24628a=_[_0x508e('0x30')](_0x3f7783,'id');var _0xf6514d=[];var _0x2f8fc0=[];var _0x492cdd=squel[_0x508e('0x73')]();_0x492cdd['field'](_0x508e('0x74'))[_0x508e('0x75')](_0x508e('0x76'),'tq')[_0x508e('0x77')](_0x508e('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('MailQueueId\x20=\x20?',_0x1807ae[_0x508e('0x48')]['id']);for(var _0x3efbab=0x0;_0x3efbab<_0x3f7783[_0x508e('0x39')];_0x3efbab+=0x1){let _0x267479=_0x3f7783[_0x3efbab];for(var _0x141794=0x0;_0x141794<_0x267479[_0x508e('0x6b')][_0x508e('0x39')];_0x141794+=0x1){let _0x4eb8aa=_0x267479['Agents'][_0x141794];var _0x162d7f=_0x492cdd[_0x508e('0x79')]();_0x162d7f['where'](_0x508e('0x7a'),_0x4eb8aa['id']);_0x2f8fc0['push'](db['sequelize'][_0x508e('0x35')](_0x162d7f['toString'](),{'type':db[_0x508e('0x6c')][_0x508e('0x7b')][_0x508e('0x7c')]})[_0x508e('0x26')](function(_0x258631){if(_0x258631[_0x508e('0x39')]===0x1){return _0x4eb8aa['id'];}else{var _0x3725c9=_['every'](_['map'](_0x258631,_0x508e('0x7d')),function(_0x241a20){return _[_0x508e('0x7e')](_0x24628a,_0x241a20);});if(_0x3725c9){return _0x4eb8aa['id'];}}}));}}return BPromise[_0x508e('0x7f')](_0x2f8fc0)['then'](function(_0x333a1d){_0xf6514d=_(_0xf6514d)[_0x508e('0x80')](_0x333a1d)[_0x508e('0x81')]()[_0x508e('0x82')]();return db['MailQueue'][_0x508e('0x4c')]({'where':{'id':_0x1807ae['params']['id']}})[_0x508e('0x26')](function(_0x348eb1){return db[_0x508e('0x6c')][_0x508e('0x83')](function(_0x5e5dd6){return _0x348eb1[_0x508e('0x71')](_0x1807ae[_0x508e('0x35')][_0x508e('0x72')],{'transaction':_0x5e5dd6})[_0x508e('0x26')](function(){if(!_[_0x508e('0x84')](_0xf6514d)){return _0x348eb1[_0x508e('0x85')](_0xf6514d,{'transaction':_0x5e5dd6});}})[_0x508e('0x26')](function(){_0xf6514d[_0x508e('0x6f')](function(_0x179c01){socket[_0x508e('0x86')](_0x508e('0x87'),{'UserId':_0x179c01,'MailQueueId':_0x348eb1['id']});});});});});});})[_0x508e('0x26')](respondWithStatusCode(_0x321b3a,null))['catch'](handleError(_0x321b3a,null));};exports[_0x508e('0x88')]=function(_0x4a4d20,_0x15416d,_0x42cc6b){return db[_0x508e('0x31')][_0x508e('0x4c')]({'where':{'id':_0x4a4d20[_0x508e('0x48')]['id']}})[_0x508e('0x26')](handleEntityNotFound(_0x15416d,null))['then'](function(_0x816df9){if(_0x816df9){return _0x816df9[_0x508e('0x88')](_0x4a4d20[_0x508e('0x57')][_0x508e('0x72')],_[_0x508e('0x89')](_0x4a4d20[_0x508e('0x57')],[_0x508e('0x72'),'id'])||{})[_0x508e('0x8a')](function(_0x6c3d74){for(var _0x14e3fb=0x0;_0x14e3fb<_0x4a4d20[_0x508e('0x57')]['ids'][_0x508e('0x39')];_0x14e3fb+=0x1){socket[_0x508e('0x86')]('userMailQueue:save',{'UserId':Number(_0x4a4d20[_0x508e('0x57')]['ids'][_0x14e3fb]),'MailQueueId':Number(_0x4a4d20[_0x508e('0x48')]['id'])});}return _0x6c3d74;});}})[_0x508e('0x26')](respondWithResult(_0x15416d,null))[_0x508e('0x47')](handleError(_0x15416d,null));};exports['removeAgents']=function(_0x457591,_0x2d1fb7,_0x45a749){return db[_0x508e('0x31')][_0x508e('0x4c')]({'where':{'id':_0x457591[_0x508e('0x48')]['id']}})[_0x508e('0x26')](handleEntityNotFound(_0x2d1fb7,null))[_0x508e('0x26')](function(_0x1fb998){if(_0x1fb998){return _0x1fb998[_0x508e('0x85')](_0x457591[_0x508e('0x35')][_0x508e('0x72')])[_0x508e('0x26')](function(){if(_[_0x508e('0x8b')](_0x457591[_0x508e('0x35')][_0x508e('0x72')])){for(var _0xc3662c=0x0;_0xc3662c<_0x457591['query'][_0x508e('0x72')][_0x508e('0x39')];_0xc3662c+=0x1){socket['emit'](_0x508e('0x87'),{'UserId':Number(_0x457591[_0x508e('0x35')][_0x508e('0x72')][_0xc3662c]),'MailQueueId':Number(_0x457591['params']['id'])});}}else{socket[_0x508e('0x86')](_0x508e('0x87'),{'UserId':Number(_0x457591[_0x508e('0x35')]['ids']),'MailQueueId':Number(_0x457591['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2d1fb7,null))['catch'](handleError(_0x2d1fb7,null));};exports[_0x508e('0x8c')]=function(_0x23d94d,_0x57ac2e,_0x26a4ce){var _0x282465={};var _0x5ac4aa={};var _0xd48fe3;var _0x200296;return db[_0x508e('0x31')][_0x508e('0x5a')]({'where':{'id':_0x23d94d[_0x508e('0x48')]['id']}})[_0x508e('0x26')](handleEntityNotFound(_0x57ac2e,null))['then'](function(_0x43d158){if(_0x43d158){_0xd48fe3=_0x43d158;_0x5ac4aa[_0x508e('0x49')]=_[_0x508e('0x4a')](db[_0x508e('0x5e')][_0x508e('0x32')]);_0x5ac4aa[_0x508e('0x35')]=_[_0x508e('0x4a')](_0x23d94d['query']);_0x5ac4aa[_0x508e('0x3e')]=_[_0x508e('0x36')](_0x5ac4aa['model'],_0x5ac4aa[_0x508e('0x35')]);_0x282465[_0x508e('0x38')]=_[_0x508e('0x36')](_0x5ac4aa[_0x508e('0x49')],qs[_0x508e('0x37')](_0x23d94d[_0x508e('0x35')][_0x508e('0x37')]));_0x282465[_0x508e('0x38')]=_0x282465['attributes'][_0x508e('0x39')]?_0x282465[_0x508e('0x38')]:_0x5ac4aa[_0x508e('0x49')];_0x282465[_0x508e('0x3b')]=qs['sort'](_0x23d94d[_0x508e('0x35')][_0x508e('0x3c')]);_0x282465[_0x508e('0x3d')]=qs[_0x508e('0x3e')](_[_0x508e('0x3f')](_0x23d94d[_0x508e('0x35')],_0x5ac4aa[_0x508e('0x3e')]));if(_0x23d94d[_0x508e('0x35')][_0x508e('0x40')]){_0x282465[_0x508e('0x3d')]=_[_0x508e('0x41')](_0x282465[_0x508e('0x3d')],{'$or':_[_0x508e('0x30')](_0x282465[_0x508e('0x38')],function(_0x32ab45){var _0x4f8b92={};_0x4f8b92[_0x32ab45]={'$like':'%'+_0x23d94d[_0x508e('0x35')][_0x508e('0x40')]+'%'};return _0x4f8b92;})});}_0x282465=_[_0x508e('0x41')]({},_0x282465,_0x23d94d[_0x508e('0x43')]);return _0xd48fe3[_0x508e('0x8c')](_0x282465);}})[_0x508e('0x26')](function(_0x175e9c){if(_0x175e9c){_0x200296=_0x175e9c[_0x508e('0x39')];if(!_0x23d94d['query'][_0x508e('0x5c')](_0x508e('0x3a'))){_0x282465[_0x508e('0x1f')]=qs[_0x508e('0x1f')](_0x23d94d[_0x508e('0x35')][_0x508e('0x1f')]);_0x282465[_0x508e('0x1d')]=qs[_0x508e('0x1d')](_0x23d94d['query'][_0x508e('0x1d')]);}return _0xd48fe3[_0x508e('0x8c')](_0x282465);}})[_0x508e('0x26')](function(_0x17adf8){if(_0x17adf8){return _0x17adf8?{'count':_0x200296,'rows':_0x17adf8}:null;}})[_0x508e('0x26')](respondWithResult(_0x57ac2e,null))[_0x508e('0x47')](handleError(_0x57ac2e,null));}; \ No newline at end of file +var _0xa39f=['describe','getMembers','findOne','length','UserMailQueue','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','ids','findAll','User','Agents','flatMap','sequelize','transaction','each','findOrCreate','emit','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','join','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','error','stack','name','send','map','MailQueue','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','show','params','rawAttributes','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','create'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa39f,0x1e4));var _0xfa39=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0xa39f[_0x1992f1];return _0x413dfe;};'use strict';var emlformat=require(_0xfa39('0x0'));var rimraf=require(_0xfa39('0x1'));var zipdir=require(_0xfa39('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfa39('0x3'));var moment=require(_0xfa39('0x4'));var BPromise=require(_0xfa39('0x5'));var Mustache=require(_0xfa39('0x6'));var util=require(_0xfa39('0x7'));var path=require(_0xfa39('0x8'));var sox=require(_0xfa39('0x9'));var csv=require(_0xfa39('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfa39('0xb'));var squel=require(_0xfa39('0xc'));var crypto=require(_0xfa39('0xd'));var jsforce=require(_0xfa39('0xe'));var deskjs=require(_0xfa39('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfa39('0x10'));var Papa=require(_0xfa39('0x11'));var Redis=require(_0xfa39('0x12'));var authService=require(_0xfa39('0x13'));var qs=require(_0xfa39('0x14'));var as=require(_0xfa39('0x15'));var hardwareService=require(_0xfa39('0x16'));var logger=require(_0xfa39('0x17'))('api');var utils=require(_0xfa39('0x18'));var config=require(_0xfa39('0x19'));var licenseUtil=require(_0xfa39('0x1a'));var db=require(_0xfa39('0x1b'))['db'];config[_0xfa39('0x1c')]=_[_0xfa39('0x1d')](config[_0xfa39('0x1c')],{'host':_0xfa39('0x1e'),'port':0x18eb});var socket=require(_0xfa39('0x1f'))(new Redis(config['redis']));require('./mailQueue.socket')[_0xfa39('0x20')](socket);function respondWithStatusCode(_0x23acf0,_0x3f2c3c){_0x3f2c3c=_0x3f2c3c||0xcc;return function(_0x4c2bc7){if(_0x4c2bc7){return _0x23acf0['sendStatus'](_0x3f2c3c);}return _0x23acf0[_0xfa39('0x21')](_0x3f2c3c)[_0xfa39('0x22')]();};}function respondWithResult(_0x49e8ed,_0x5be2db){_0x5be2db=_0x5be2db||0xc8;return function(_0x4f84db){if(_0x4f84db){return _0x49e8ed[_0xfa39('0x21')](_0x5be2db)[_0xfa39('0x23')](_0x4f84db);}};}function respondWithFilteredResult(_0x8d38a4,_0x596e45){return function(_0x9db170){if(_0x9db170){var _0x271064=typeof _0x596e45[_0xfa39('0x24')]===_0xfa39('0x25')&&typeof _0x596e45[_0xfa39('0x26')]===_0xfa39('0x25');var _0x1eb352=_0x9db170[_0xfa39('0x27')];var _0x5e200b=_0x271064?0x0:_0x596e45[_0xfa39('0x24')];var _0x4f10b6=_0x271064?_0x9db170[_0xfa39('0x27')]:_0x596e45[_0xfa39('0x24')]+_0x596e45[_0xfa39('0x26')];var _0x55db8d;if(_0x4f10b6>=_0x1eb352){_0x4f10b6=_0x1eb352;_0x55db8d=0xc8;}else{_0x55db8d=0xce;}_0x8d38a4[_0xfa39('0x21')](_0x55db8d);return _0x8d38a4[_0xfa39('0x28')](_0xfa39('0x29'),_0x5e200b+'-'+_0x4f10b6+'/'+_0x1eb352)[_0xfa39('0x23')](_0x9db170);}return null;};}function patchUpdates(_0x2ac54a){return function(_0xc186e1){try{jsonpatch[_0xfa39('0x2a')](_0xc186e1,_0x2ac54a,!![]);}catch(_0x3d5dd2){return BPromise[_0xfa39('0x2b')](_0x3d5dd2);}return _0xc186e1[_0xfa39('0x2c')]();};}function saveUpdates(_0xf885c7,_0x2768f2){return function(_0x2a3d7b){if(_0x2a3d7b){return _0x2a3d7b[_0xfa39('0x2d')](_0xf885c7)[_0xfa39('0x2e')](function(_0x2b9612){return _0x2b9612;});}return null;};}function removeEntity(_0x1010ca,_0x3a21be){return function(_0xd0ddb){if(_0xd0ddb){return _0xd0ddb[_0xfa39('0x2f')]()['then'](function(){var _0x41a1d2=_0xd0ddb[_0xfa39('0x30')]({'plain':!![]});var _0x2f10a7=_0xfa39('0x31');return db[_0xfa39('0x32')][_0xfa39('0x2f')]({'where':{'type':_0x2f10a7,'resourceId':_0x41a1d2['id']}})[_0xfa39('0x2e')](function(){return _0xd0ddb;});})[_0xfa39('0x2e')](function(){_0x1010ca[_0xfa39('0x21')](0xcc)[_0xfa39('0x22')]();});}};}function handleEntityNotFound(_0x3ff1bf,_0x46d660){return function(_0x44981e){if(!_0x44981e){_0x3ff1bf['sendStatus'](0x194);}return _0x44981e;};}function handleError(_0x29e68b,_0x41aad1){_0x41aad1=_0x41aad1||0x1f4;return function(_0x2c5c72){logger[_0xfa39('0x33')](_0x2c5c72[_0xfa39('0x34')]);if(_0x2c5c72['name']){delete _0x2c5c72[_0xfa39('0x35')];}_0x29e68b[_0xfa39('0x21')](_0x41aad1)[_0xfa39('0x36')](_0x2c5c72);};}exports['index']=function(_0x692946,_0x25127f){var _0x59d58e={},_0xf091de={},_0x3dbead={'count':0x0,'rows':[]};var _0x23d5de=_[_0xfa39('0x37')](db[_0xfa39('0x38')]['rawAttributes'],function(_0x537742){return{'name':_0x537742['fieldName'],'type':_0x537742['type'][_0xfa39('0x39')]};});_0xf091de['model']=_[_0xfa39('0x37')](_0x23d5de,'name');_0xf091de[_0xfa39('0x3a')]=_[_0xfa39('0x3b')](_0x692946[_0xfa39('0x3a')]);_0xf091de[_0xfa39('0x3c')]=_[_0xfa39('0x3d')](_0xf091de['model'],_0xf091de[_0xfa39('0x3a')]);_0x59d58e[_0xfa39('0x3e')]=_[_0xfa39('0x3d')](_0xf091de[_0xfa39('0x3f')],qs[_0xfa39('0x40')](_0x692946[_0xfa39('0x3a')][_0xfa39('0x40')]));_0x59d58e[_0xfa39('0x3e')]=_0x59d58e[_0xfa39('0x3e')]['length']?_0x59d58e[_0xfa39('0x3e')]:_0xf091de['model'];if(!_0x692946[_0xfa39('0x3a')][_0xfa39('0x41')](_0xfa39('0x42'))){_0x59d58e[_0xfa39('0x26')]=qs[_0xfa39('0x26')](_0x692946[_0xfa39('0x3a')][_0xfa39('0x26')]);_0x59d58e['offset']=qs[_0xfa39('0x24')](_0x692946[_0xfa39('0x3a')][_0xfa39('0x24')]);}_0x59d58e[_0xfa39('0x43')]=qs[_0xfa39('0x44')](_0x692946[_0xfa39('0x3a')][_0xfa39('0x44')]);_0x59d58e[_0xfa39('0x45')]=qs[_0xfa39('0x3c')](_[_0xfa39('0x46')](_0x692946[_0xfa39('0x3a')],_0xf091de[_0xfa39('0x3c')]),_0x23d5de);if(_0x692946[_0xfa39('0x3a')][_0xfa39('0x47')]){_0x59d58e[_0xfa39('0x45')]=_[_0xfa39('0x48')](_0x59d58e['where'],{'$or':_[_0xfa39('0x37')](_0x23d5de,function(_0x9d4819){if(_0x9d4819[_0xfa39('0x49')]!==_0xfa39('0x4a')){var _0x552d2b={};_0x552d2b[_0x9d4819[_0xfa39('0x35')]]={'$like':'%'+_0x692946['query'][_0xfa39('0x47')]+'%'};return _0x552d2b;}})});}_0x59d58e=_[_0xfa39('0x48')]({},_0x59d58e,_0x692946['options']);var _0x56492b={'where':_0x59d58e['where']};return db[_0xfa39('0x38')][_0xfa39('0x27')](_0x56492b)[_0xfa39('0x2e')](function(_0x529f6b){_0x3dbead[_0xfa39('0x27')]=_0x529f6b;if(_0x692946['query'][_0xfa39('0x4b')]){_0x59d58e[_0xfa39('0x4c')]=[{'all':!![]}];}return db[_0xfa39('0x38')]['findAll'](_0x59d58e);})[_0xfa39('0x2e')](function(_0x307da4){_0x3dbead[_0xfa39('0x4d')]=_0x307da4;return _0x3dbead;})['then'](respondWithFilteredResult(_0x25127f,_0x59d58e))[_0xfa39('0x4e')](handleError(_0x25127f,null));};exports[_0xfa39('0x4f')]=function(_0x4f4d9f,_0x274c0a){var _0x2f1dc0={'raw':!![],'where':{'id':_0x4f4d9f[_0xfa39('0x50')]['id']}},_0x245441={};_0x245441[_0xfa39('0x3f')]=_[_0xfa39('0x3b')](db[_0xfa39('0x38')][_0xfa39('0x51')]);_0x245441['query']=_['keys'](_0x4f4d9f[_0xfa39('0x3a')]);_0x245441['filters']=_[_0xfa39('0x3d')](_0x245441[_0xfa39('0x3f')],_0x245441['query']);_0x2f1dc0[_0xfa39('0x3e')]=_['intersection'](_0x245441[_0xfa39('0x3f')],qs[_0xfa39('0x40')](_0x4f4d9f[_0xfa39('0x3a')][_0xfa39('0x40')]));_0x2f1dc0['attributes']=_0x2f1dc0[_0xfa39('0x3e')]['length']?_0x2f1dc0[_0xfa39('0x3e')]:_0x245441[_0xfa39('0x3f')];if(_0x4f4d9f['query'][_0xfa39('0x4b')]){_0x2f1dc0['include']=[{'all':!![]}];}_0x2f1dc0=_['merge']({},_0x2f1dc0,_0x4f4d9f[_0xfa39('0x52')]);return db[_0xfa39('0x38')][_0xfa39('0x53')](_0x2f1dc0)[_0xfa39('0x2e')](handleEntityNotFound(_0x274c0a,null))[_0xfa39('0x2e')](respondWithResult(_0x274c0a,null))[_0xfa39('0x4e')](handleError(_0x274c0a,null));};exports['create']=function(_0x5ac7bf,_0x5362f6){return db[_0xfa39('0x38')]['create'](_0x5ac7bf[_0xfa39('0x54')],{})[_0xfa39('0x2e')](function(_0xc674ae){var _0x5bf42c=_0x5ac7bf[_0xfa39('0x55')][_0xfa39('0x30')]({'plain':!![]});if(!_0x5bf42c)throw new Error(_0xfa39('0x56'));if(_0x5bf42c['role']===_0xfa39('0x55')){var _0x3bd8fb=_0xc674ae[_0xfa39('0x30')]({'plain':!![]});var _0x210ef5='MailQueues';return db['UserProfileSection']['find']({'where':{'name':_0x210ef5,'userProfileId':_0x5bf42c['userProfileId']},'raw':!![]})[_0xfa39('0x2e')](function(_0x17a7a6){if(_0x17a7a6&&_0x17a7a6['autoAssociation']===0x0){return db[_0xfa39('0x32')][_0xfa39('0x57')]({'name':_0x3bd8fb['name'],'resourceId':_0x3bd8fb['id'],'type':_0x17a7a6[_0xfa39('0x35')],'sectionId':_0x17a7a6['id']},{})[_0xfa39('0x2e')](function(){return _0xc674ae;});}else{return _0xc674ae;}})[_0xfa39('0x4e')](function(_0x287b8a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x287b8a);throw _0x287b8a;});}return _0xc674ae;})[_0xfa39('0x2e')](respondWithResult(_0x5362f6,0xc9))[_0xfa39('0x4e')](handleError(_0x5362f6,null));};exports[_0xfa39('0x2d')]=function(_0xdbf73e,_0x41ad2b){if(_0xdbf73e[_0xfa39('0x54')]['id']){delete _0xdbf73e['body']['id'];}return db[_0xfa39('0x38')]['find']({'where':{'id':_0xdbf73e[_0xfa39('0x50')]['id']}})[_0xfa39('0x2e')](handleEntityNotFound(_0x41ad2b,null))[_0xfa39('0x2e')](saveUpdates(_0xdbf73e[_0xfa39('0x54')],null))['then'](respondWithResult(_0x41ad2b,null))['catch'](handleError(_0x41ad2b,null));};exports[_0xfa39('0x2f')]=function(_0x7d4f34,_0x19366d){return db[_0xfa39('0x38')][_0xfa39('0x53')]({'where':{'id':_0x7d4f34[_0xfa39('0x50')]['id']}})[_0xfa39('0x2e')](handleEntityNotFound(_0x19366d,null))['then'](removeEntity(_0x19366d,null))[_0xfa39('0x4e')](handleError(_0x19366d,null));};exports[_0xfa39('0x58')]=function(_0x2f04d6,_0x4a11a5){return db[_0xfa39('0x38')][_0xfa39('0x58')]()[_0xfa39('0x2e')](respondWithResult(_0x4a11a5,null))['catch'](handleError(_0x4a11a5,null));};exports[_0xfa39('0x59')]=function(_0x2799ca,_0x870f56,_0xe6f95){var _0x4d2a2b={'raw':!![],'where':{}},_0x36c97f={},_0x42f2c2;return db[_0xfa39('0x38')][_0xfa39('0x5a')]({'where':{'id':_0x2799ca[_0xfa39('0x50')]['id']}})[_0xfa39('0x2e')](handleEntityNotFound(_0x870f56,null))['then'](function(_0x4b18ad){if(_0x4b18ad){_0x42f2c2=_0x4b18ad['get']({'plain':!![]});_0x36c97f[_0xfa39('0x3f')]=_[_0xfa39('0x3b')](db['UserMailQueue']['rawAttributes']);_0x36c97f['query']=_[_0xfa39('0x3b')](_0x2799ca[_0xfa39('0x3a')]);_0x36c97f[_0xfa39('0x3c')]=_['intersection'](_0x36c97f[_0xfa39('0x3f')],_0x36c97f[_0xfa39('0x3a')]);_0x4d2a2b[_0xfa39('0x3e')]=_[_0xfa39('0x3d')](_0x36c97f[_0xfa39('0x3f')],qs[_0xfa39('0x40')](_0x2799ca[_0xfa39('0x3a')][_0xfa39('0x40')]));_0x4d2a2b['attributes']=_0x4d2a2b[_0xfa39('0x3e')][_0xfa39('0x5b')]?_0x4d2a2b[_0xfa39('0x3e')]:_0x36c97f[_0xfa39('0x3f')];if(!_0x2799ca[_0xfa39('0x3a')]['hasOwnProperty']('nolimit')){_0x4d2a2b[_0xfa39('0x26')]=qs['limit'](_0x2799ca[_0xfa39('0x3a')]['limit']);_0x4d2a2b['offset']=qs['offset'](_0x2799ca[_0xfa39('0x3a')][_0xfa39('0x24')]);}_0x4d2a2b[_0xfa39('0x43')]=qs[_0xfa39('0x44')](_0x2799ca[_0xfa39('0x3a')][_0xfa39('0x44')]);_0x4d2a2b['where']=qs[_0xfa39('0x3c')](_['pick'](_0x2799ca[_0xfa39('0x3a')],_0x36c97f[_0xfa39('0x3c')]));_0x4d2a2b[_0xfa39('0x45')]['MailQueueId']=_0x4b18ad['id'];if(_0x2799ca[_0xfa39('0x3a')]['filter']){_0x4d2a2b[_0xfa39('0x45')]=_[_0xfa39('0x48')](_0x4d2a2b[_0xfa39('0x45')],{'$or':_[_0xfa39('0x37')](_0x4d2a2b[_0xfa39('0x3e')],function(_0x41400a){var _0x216e72={};_0x216e72[_0x41400a]={'$like':'%'+_0x2799ca[_0xfa39('0x3a')][_0xfa39('0x47')]+'%'};return _0x216e72;})});}_0x4d2a2b=_[_0xfa39('0x48')]({},_0x4d2a2b,_0x2799ca[_0xfa39('0x52')]);return db[_0xfa39('0x5c')]['findAll'](_0x4d2a2b);}})[_0xfa39('0x2e')](function(_0x4000e2){if(_0x4000e2){return db['User'][_0xfa39('0x5d')]({'where':{'id':_[_0xfa39('0x37')](_0x4000e2,_0xfa39('0x5e')),'role':_0xfa39('0x5f')},'attributes':['id',_0xfa39('0x35'),_0xfa39('0x60'),_0xfa39('0x61'),_0xfa39('0x62')]});}})[_0xfa39('0x2e')](function(_0x5d6397){if(_0x5d6397){return{'count':_0x5d6397[_0xfa39('0x27')],'rows':_['map'](_0x5d6397[_0xfa39('0x4d')],function(_0x176ef2){return{'membername':_0x176ef2[_0xfa39('0x35')],'UserId':_0x176ef2['id'],'queue_name':_0x42f2c2['name'],'MailQueueId':_0x42f2c2['id'],'interface':util[_0xfa39('0x63')](_0xfa39('0x64'),_0xfa39('0x65'),_0x176ef2[_0xfa39('0x35')]),'penalty':0x0,'paused':_0x176ef2['mailPause'],'createdAt':_0x176ef2['createdAt'],'updatedAt':_0x176ef2[_0xfa39('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfa39('0x2e')](respondWithFilteredResult(_0x870f56,_0x4d2a2b))[_0xfa39('0x4e')](handleError(_0x870f56,null));};exports[_0xfa39('0x66')]=function(_0x4f5493,_0x38f132,_0x5ad164){var _0x3bd8a3={};var _0x4b98f6={};var _0x33e549;var _0x552f25;return db[_0xfa39('0x38')]['findOne']({'where':{'id':_0x4f5493[_0xfa39('0x50')]['id']}})[_0xfa39('0x2e')](handleEntityNotFound(_0x38f132,null))[_0xfa39('0x2e')](function(_0xfd5feb){if(_0xfd5feb){_0x33e549=_0xfd5feb;_0x4b98f6[_0xfa39('0x3f')]=_['keys'](db[_0xfa39('0x67')][_0xfa39('0x51')]);_0x4b98f6[_0xfa39('0x3a')]=_['keys'](_0x4f5493[_0xfa39('0x3a')]);_0x4b98f6[_0xfa39('0x3c')]=_[_0xfa39('0x3d')](_0x4b98f6['model'],_0x4b98f6[_0xfa39('0x3a')]);_0x3bd8a3['attributes']=_[_0xfa39('0x3d')](_0x4b98f6[_0xfa39('0x3f')],qs['fields'](_0x4f5493[_0xfa39('0x3a')][_0xfa39('0x40')]));_0x3bd8a3[_0xfa39('0x3e')]=_0x3bd8a3[_0xfa39('0x3e')][_0xfa39('0x5b')]?_0x3bd8a3[_0xfa39('0x3e')]:_0x4b98f6[_0xfa39('0x3f')];_0x3bd8a3[_0xfa39('0x43')]=qs[_0xfa39('0x44')](_0x4f5493[_0xfa39('0x3a')][_0xfa39('0x44')]);_0x3bd8a3[_0xfa39('0x45')]=qs[_0xfa39('0x3c')](_['pick'](_0x4f5493[_0xfa39('0x3a')],_0x4b98f6['filters']));if(_0x4f5493[_0xfa39('0x3a')][_0xfa39('0x47')]){_0x3bd8a3[_0xfa39('0x45')]=_['merge'](_0x3bd8a3['where'],{'$or':_[_0xfa39('0x37')](_0x3bd8a3[_0xfa39('0x3e')],function(_0x27495a){var _0x4d99d9={};_0x4d99d9[_0x27495a]={'$like':'%'+_0x4f5493[_0xfa39('0x3a')]['filter']+'%'};return _0x4d99d9;})});}_0x3bd8a3=_[_0xfa39('0x48')]({},_0x3bd8a3,_0x4f5493[_0xfa39('0x52')]);return _0x33e549[_0xfa39('0x66')](_0x3bd8a3);}})['then'](function(_0x533e56){if(_0x533e56){_0x552f25=_0x533e56['length'];if(!_0x4f5493['query'][_0xfa39('0x41')](_0xfa39('0x42'))){_0x3bd8a3[_0xfa39('0x26')]=qs[_0xfa39('0x26')](_0x4f5493[_0xfa39('0x3a')][_0xfa39('0x26')]);_0x3bd8a3[_0xfa39('0x24')]=qs[_0xfa39('0x24')](_0x4f5493[_0xfa39('0x3a')]['offset']);}return _0x33e549[_0xfa39('0x66')](_0x3bd8a3);}})[_0xfa39('0x2e')](function(_0x2f23b5){if(_0x2f23b5){return _0x2f23b5?{'count':_0x552f25,'rows':_0x2f23b5}:null;}})[_0xfa39('0x2e')](respondWithResult(_0x38f132,null))['catch'](handleError(_0x38f132,null));};exports['addTeams']=function(_0x3ea95c,_0x221dfb,_0xa7e958){var _0xef3b65=_0x3ea95c[_0xfa39('0x54')][_0xfa39('0x68')];return db['Team'][_0xfa39('0x69')]({'where':{'id':_0xef3b65},'attributes':['id'],'include':[{'model':db[_0xfa39('0x6a')],'as':_0xfa39('0x6b'),'attributes':['id','name','online','voicePause','interface'],'raw':!![]}]})[_0xfa39('0x2e')](function(_0x305a3d){if(_0x305a3d){var _0x56c82=_[_0xfa39('0x6c')](_0x305a3d,function(_0x41dda){var _0x4d9d77=_0x41dda['get']({'plain':!![]});return _0x4d9d77['Agents'];});return db[_0xfa39('0x38')]['find']({'where':{'id':_0x3ea95c[_0xfa39('0x50')]['id']}})['then'](function(_0x582755){return db[_0xfa39('0x6d')][_0xfa39('0x6e')](function(_0x108d99){return _0x582755['addTeams'](_0xef3b65,{'transaction':_0x108d99})[_0xfa39('0x2e')](function(){return BPromise[_0xfa39('0x6f')](_0x56c82,function(_0x875db9){return db['UserMailQueue'][_0xfa39('0x70')]({'where':{'UserId':_0x875db9['id'],'MailQueueId':_0x3ea95c[_0xfa39('0x50')]['id']},'transaction':_0x108d99});});})[_0xfa39('0x2e')](function(){_0x56c82['forEach'](function(_0x52606f){socket[_0xfa39('0x71')]('userMailQueue:save',{'UserId':_0x52606f['id'],'MailQueueId':_0x582755['id']});});});});});}})[_0xfa39('0x2e')](respondWithStatusCode(_0x221dfb,null))['catch'](handleError(_0x221dfb,null));};exports[_0xfa39('0x72')]=function(_0x57debc,_0x1e63e6,_0x1c69a7){return db[_0xfa39('0x67')][_0xfa39('0x69')]({'where':{'id':_0x57debc[_0xfa39('0x3a')][_0xfa39('0x68')]},'attributes':['id'],'include':[{'model':db[_0xfa39('0x6a')],'as':_0xfa39('0x6b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1e63e6,null))[_0xfa39('0x2e')](function(_0x543560){var _0x2d3d42=_['map'](_0x543560,'id');var _0x2adcfe=[];var _0x45bac6=[];var _0x4413fa=squel[_0xfa39('0x73')]();_0x4413fa[_0xfa39('0x74')](_0xfa39('0x75'))[_0xfa39('0x76')](_0xfa39('0x77'),'tq')[_0xfa39('0x78')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xfa39('0x45')](_0xfa39('0x79'),_0x57debc[_0xfa39('0x50')]['id']);for(var _0x4548db=0x0;_0x4548db<_0x543560[_0xfa39('0x5b')];_0x4548db+=0x1){let _0x354e8a=_0x543560[_0x4548db];for(var _0x3b7140=0x0;_0x3b7140<_0x354e8a[_0xfa39('0x6b')][_0xfa39('0x5b')];_0x3b7140+=0x1){let _0x228c80=_0x354e8a[_0xfa39('0x6b')][_0x3b7140];var _0x27d4cf=_0x4413fa[_0xfa39('0x7a')]();_0x27d4cf['where'](_0xfa39('0x7b'),_0x228c80['id']);_0x45bac6[_0xfa39('0x7c')](db[_0xfa39('0x6d')][_0xfa39('0x3a')](_0x27d4cf[_0xfa39('0x7d')](),{'type':db[_0xfa39('0x6d')]['QueryTypes'][_0xfa39('0x7e')]})[_0xfa39('0x2e')](function(_0x1b308e){if(_0x1b308e[_0xfa39('0x5b')]===0x1){return _0x228c80['id'];}else{var _0x9f6d7d=_[_0xfa39('0x7f')](_[_0xfa39('0x37')](_0x1b308e,_0xfa39('0x80')),function(_0x4b3eea){return _['includes'](_0x2d3d42,_0x4b3eea);});if(_0x9f6d7d){return _0x228c80['id'];}}}));}}return BPromise[_0xfa39('0x81')](_0x45bac6)[_0xfa39('0x2e')](function(_0x4f9e57){_0x2adcfe=_(_0x2adcfe)[_0xfa39('0x82')](_0x4f9e57)[_0xfa39('0x83')]()[_0xfa39('0x84')]();return db[_0xfa39('0x38')][_0xfa39('0x53')]({'where':{'id':_0x57debc[_0xfa39('0x50')]['id']}})['then'](function(_0x5eb053){return db['sequelize'][_0xfa39('0x6e')](function(_0x345ed2){return _0x5eb053['removeTeams'](_0x57debc['query'][_0xfa39('0x68')],{'transaction':_0x345ed2})[_0xfa39('0x2e')](function(){if(!_[_0xfa39('0x85')](_0x2adcfe)){return _0x5eb053[_0xfa39('0x86')](_0x2adcfe,{'transaction':_0x345ed2});}})['then'](function(){_0x2adcfe[_0xfa39('0x87')](function(_0x1c56ed){socket['emit'](_0xfa39('0x88'),{'UserId':_0x1c56ed,'MailQueueId':_0x5eb053['id']});});});});});});})[_0xfa39('0x2e')](respondWithStatusCode(_0x1e63e6,null))[_0xfa39('0x4e')](handleError(_0x1e63e6,null));};exports[_0xfa39('0x89')]=function(_0x14f454,_0x1f4bc1,_0x55e2a4){return db[_0xfa39('0x38')][_0xfa39('0x53')]({'where':{'id':_0x14f454[_0xfa39('0x50')]['id']}})[_0xfa39('0x2e')](handleEntityNotFound(_0x1f4bc1,null))['then'](function(_0x170118){if(_0x170118){return _0x170118[_0xfa39('0x89')](_0x14f454[_0xfa39('0x54')][_0xfa39('0x68')],_[_0xfa39('0x8a')](_0x14f454[_0xfa39('0x54')],[_0xfa39('0x68'),'id'])||{})[_0xfa39('0x8b')](function(_0x1b2bc2){for(var _0x319fef=0x0;_0x319fef<_0x14f454['body']['ids'][_0xfa39('0x5b')];_0x319fef+=0x1){socket[_0xfa39('0x71')](_0xfa39('0x8c'),{'UserId':Number(_0x14f454[_0xfa39('0x54')][_0xfa39('0x68')][_0x319fef]),'MailQueueId':Number(_0x14f454['params']['id'])});}return _0x1b2bc2;});}})[_0xfa39('0x2e')](respondWithResult(_0x1f4bc1,null))[_0xfa39('0x4e')](handleError(_0x1f4bc1,null));};exports['removeAgents']=function(_0x213725,_0x76739f,_0x20689b){return db[_0xfa39('0x38')][_0xfa39('0x53')]({'where':{'id':_0x213725[_0xfa39('0x50')]['id']}})[_0xfa39('0x2e')](handleEntityNotFound(_0x76739f,null))[_0xfa39('0x2e')](function(_0x2f0510){if(_0x2f0510){return _0x2f0510[_0xfa39('0x86')](_0x213725[_0xfa39('0x3a')][_0xfa39('0x68')])[_0xfa39('0x2e')](function(){if(_[_0xfa39('0x8d')](_0x213725['query'][_0xfa39('0x68')])){for(var _0x2f905d=0x0;_0x2f905d<_0x213725[_0xfa39('0x3a')][_0xfa39('0x68')][_0xfa39('0x5b')];_0x2f905d+=0x1){socket[_0xfa39('0x71')](_0xfa39('0x88'),{'UserId':Number(_0x213725[_0xfa39('0x3a')][_0xfa39('0x68')][_0x2f905d]),'MailQueueId':Number(_0x213725[_0xfa39('0x50')]['id'])});}}else{socket[_0xfa39('0x71')]('userMailQueue:remove',{'UserId':Number(_0x213725['query'][_0xfa39('0x68')]),'MailQueueId':Number(_0x213725[_0xfa39('0x50')]['id'])});}});}})[_0xfa39('0x2e')](respondWithStatusCode(_0x76739f,null))[_0xfa39('0x4e')](handleError(_0x76739f,null));};exports['getAgents']=function(_0x5e9113,_0x45ad06,_0x21960e){var _0x5d47a7={};var _0xcc054c={};var _0x2348f3;var _0x1e4f7a;return db[_0xfa39('0x38')]['findOne']({'where':{'id':_0x5e9113[_0xfa39('0x50')]['id']}})[_0xfa39('0x2e')](handleEntityNotFound(_0x45ad06,null))[_0xfa39('0x2e')](function(_0x1d91b2){if(_0x1d91b2){_0x2348f3=_0x1d91b2;_0xcc054c['model']=_['keys'](db[_0xfa39('0x6a')][_0xfa39('0x51')]);_0xcc054c[_0xfa39('0x3a')]=_[_0xfa39('0x3b')](_0x5e9113[_0xfa39('0x3a')]);_0xcc054c[_0xfa39('0x3c')]=_[_0xfa39('0x3d')](_0xcc054c['model'],_0xcc054c[_0xfa39('0x3a')]);_0x5d47a7[_0xfa39('0x3e')]=_['intersection'](_0xcc054c[_0xfa39('0x3f')],qs['fields'](_0x5e9113[_0xfa39('0x3a')][_0xfa39('0x40')]));_0x5d47a7[_0xfa39('0x3e')]=_0x5d47a7[_0xfa39('0x3e')][_0xfa39('0x5b')]?_0x5d47a7[_0xfa39('0x3e')]:_0xcc054c[_0xfa39('0x3f')];_0x5d47a7[_0xfa39('0x43')]=qs[_0xfa39('0x44')](_0x5e9113[_0xfa39('0x3a')][_0xfa39('0x44')]);_0x5d47a7[_0xfa39('0x45')]=qs['filters'](_[_0xfa39('0x46')](_0x5e9113['query'],_0xcc054c[_0xfa39('0x3c')]));if(_0x5e9113[_0xfa39('0x3a')][_0xfa39('0x47')]){_0x5d47a7[_0xfa39('0x45')]=_[_0xfa39('0x48')](_0x5d47a7[_0xfa39('0x45')],{'$or':_['map'](_0x5d47a7['attributes'],function(_0x376490){var _0x12cb16={};_0x12cb16[_0x376490]={'$like':'%'+_0x5e9113[_0xfa39('0x3a')]['filter']+'%'};return _0x12cb16;})});}_0x5d47a7=_[_0xfa39('0x48')]({},_0x5d47a7,_0x5e9113['options']);return _0x2348f3[_0xfa39('0x8e')](_0x5d47a7);}})[_0xfa39('0x2e')](function(_0x46c433){if(_0x46c433){_0x1e4f7a=_0x46c433['length'];if(!_0x5e9113[_0xfa39('0x3a')][_0xfa39('0x41')]('nolimit')){_0x5d47a7['limit']=qs[_0xfa39('0x26')](_0x5e9113[_0xfa39('0x3a')][_0xfa39('0x26')]);_0x5d47a7[_0xfa39('0x24')]=qs[_0xfa39('0x24')](_0x5e9113[_0xfa39('0x3a')][_0xfa39('0x24')]);}return _0x2348f3[_0xfa39('0x8e')](_0x5d47a7);}})[_0xfa39('0x2e')](function(_0x33cb00){if(_0x33cb00){return _0x33cb00?{'count':_0x1e4f7a,'rows':_0x33cb00}:null;}})['then'](respondWithResult(_0x45ad06,null))[_0xfa39('0x4e')](handleError(_0x45ad06,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index e53fcac..00099c9 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 _0x1101=['hook','events','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x1101,0xf1));var _0x1110=function(_0x13d9f0,_0x5e68c4){_0x13d9f0=_0x13d9f0-0x0;var _0x439d4e=_0x1101[_0x13d9f0];return _0x439d4e;};'use strict';var EventEmitter=require(_0x1110('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x1110('0x1')](0x0);var events={'afterCreate':_0x1110('0x2'),'afterUpdate':_0x1110('0x3'),'afterDestroy':_0x1110('0x4')};function emitEvent(_0x14e1c6){return function(_0x231844,_0x7ca63e,_0x2a5ff2){MailQueueEvents[_0x1110('0x5')](_0x14e1c6+':'+_0x231844['id'],_0x231844);MailQueueEvents[_0x1110('0x5')](_0x14e1c6,_0x231844);_0x2a5ff2(null);};}for(var e in events){if(events[_0x1110('0x6')](e)){var event=events[e];MailQueue[_0x1110('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x6b09=['remove','emit','hasOwnProperty','events','../../mysqldb','MailQueue','setMaxListeners','update'];(function(_0x210526,_0x5c4d1a){var _0x51afdc=function(_0x1e1840){while(--_0x1e1840){_0x210526['push'](_0x210526['shift']());}};_0x51afdc(++_0x5c4d1a);}(_0x6b09,0xc3));var _0x96b0=function(_0x49677a,_0x197e86){_0x49677a=_0x49677a-0x0;var _0x115408=_0x6b09[_0x49677a];return _0x115408;};'use strict';var EventEmitter=require(_0x96b0('0x0'));var MailQueue=require(_0x96b0('0x1'))['db'][_0x96b0('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x96b0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x96b0('0x4'),'afterDestroy':_0x96b0('0x5')};function emitEvent(_0x526fed){return function(_0x2c9c9d,_0xd570a,_0x354381){MailQueueEvents[_0x96b0('0x6')](_0x526fed+':'+_0x2c9c9d['id'],_0x2c9c9d);MailQueueEvents[_0x96b0('0x6')](_0x526fed,_0x2c9c9d);_0x354381(null);};}for(var e in events){if(events[_0x96b0('0x7')](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 a265e9d..273a3a8 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 _0xf186=['moment','rimraf','../../config/environment','./mailQueue.attributes','mail_queues','lodash','../../config/logger','api'];(function(_0x4e4f15,_0xc99f54){var _0x2f0a16=function(_0x42067b){while(--_0x42067b){_0x4e4f15['push'](_0x4e4f15['shift']());}};_0x2f0a16(++_0xc99f54);}(_0xf186,0x6d));var _0x6f18=function(_0x497f9b,_0x383465){_0x497f9b=_0x497f9b-0x0;var _0xf04327=_0xf186[_0x497f9b];return _0xf04327;};'use strict';var _=require(_0x6f18('0x0'));var util=require('util');var logger=require(_0x6f18('0x1'))(_0x6f18('0x2'));var moment=require(_0x6f18('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6f18('0x4'));var config=require(_0x6f18('0x5'));var attributes=require(_0x6f18('0x6'));module['exports']=function(_0x5852b9,_0x295292){return _0x5852b9['define']('MailQueue',attributes,{'tableName':_0x6f18('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7725=['rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','util','api','bluebird','request-promise'];(function(_0x4f75e8,_0x2f0ac4){var _0x1902f0=function(_0x15773a){while(--_0x15773a){_0x4f75e8['push'](_0x4f75e8['shift']());}};_0x1902f0(++_0x2f0ac4);}(_0x7725,0x13c));var _0x5772=function(_0x40d339,_0xb726c3){_0x40d339=_0x40d339-0x0;var _0x5cbd0b=_0x7725[_0x40d339];return _0x5cbd0b;};'use strict';var _=require('lodash');var util=require(_0x5772('0x0'));var logger=require('../../config/logger')(_0x5772('0x1'));var moment=require('moment');var BPromise=require(_0x5772('0x2'));var rp=require(_0x5772('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5772('0x4'));var config=require(_0x5772('0x5'));var attributes=require(_0x5772('0x6'));module[_0x5772('0x7')]=function(_0x4a7ece,_0x433e11){return _0x4a7ece[_0x5772('0x8')](_0x5772('0x9'),attributes,{'tableName':'mail_queues','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 022981d..4cd89a2 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 _0x2ac2=['../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailQueue','MailQueue','options','raw','limit','include','attributes','map','model','then','find','where','ShowMailQueue','util','bluebird','../../config/utils'];(function(_0x2474ac,_0x335d3a){var _0x384a8f=function(_0x402bf6){while(--_0x402bf6){_0x2474ac['push'](_0x2474ac['shift']());}};_0x384a8f(++_0x335d3a);}(_0x2ac2,0x125));var _0x22ac=function(_0x900a62,_0x52889d){_0x900a62=_0x900a62-0x0;var _0x1f537a=_0x2ac2[_0x900a62];return _0x1f537a;};'use strict';var _=require('lodash');var util=require(_0x22ac('0x0'));var moment=require('moment');var BPromise=require(_0x22ac('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x22ac('0x2'));var logger=require(_0x22ac('0x3'))(_0x22ac('0x4'));var config=require('../../config/environment');var jayson=require(_0x22ac('0x5'));var client=jayson[_0x22ac('0x6')][_0x22ac('0x7')]({'port':0x232a});config[_0x22ac('0x8')]=_[_0x22ac('0x9')](config[_0x22ac('0x8')],{'host':_0x22ac('0xa'),'port':0x18eb});var socket=require(_0x22ac('0xb'))(new Redis(config['redis']));require(_0x22ac('0xc'))[_0x22ac('0xd')](socket);function respondWithRpcPromise(_0x1ef4ad,_0x43f826,_0x149755){return new BPromise(function(_0x34dbf2,_0x172a70){return client['request'](_0x1ef4ad,_0x149755)['then'](function(_0x28aeb0){logger[_0x22ac('0xe')](_0x22ac('0xf'),_0x43f826,_0x22ac('0x10'));logger[_0x22ac('0x11')](_0x22ac('0x12'),_0x43f826,_0x22ac('0x10'),JSON['stringify'](_0x28aeb0));if(_0x28aeb0[_0x22ac('0x13')]){if(_0x28aeb0[_0x22ac('0x13')][_0x22ac('0x14')]===0x1f4){logger[_0x22ac('0x13')](_0x22ac('0xf'),_0x43f826,_0x28aeb0[_0x22ac('0x13')][_0x22ac('0x15')]);return _0x172a70(_0x28aeb0[_0x22ac('0x13')][_0x22ac('0x15')]);}logger[_0x22ac('0x13')](_0x22ac('0xf'),_0x43f826,_0x28aeb0[_0x22ac('0x13')][_0x22ac('0x15')]);return _0x34dbf2(_0x28aeb0[_0x22ac('0x13')]['message']);}else{logger[_0x22ac('0xe')](_0x22ac('0xf'),_0x43f826,_0x22ac('0x10'));_0x34dbf2(_0x28aeb0[_0x22ac('0x16')][_0x22ac('0x15')]);}})[_0x22ac('0x17')](function(_0x45f780){logger['error'](_0x22ac('0xf'),_0x43f826,_0x45f780);_0x172a70(_0x45f780);});});}exports[_0x22ac('0x18')]=function(_0x1e8191){var _0x2f1c2d=this;return new Promise(function(_0x5b2a87,_0x4233f1){return db[_0x22ac('0x19')]['findAll']({'raw':_0x1e8191[_0x22ac('0x1a')]?_0x1e8191[_0x22ac('0x1a')][_0x22ac('0x1b')]===undefined?!![]:![]:!![],'where':_0x1e8191[_0x22ac('0x1a')]?_0x1e8191[_0x22ac('0x1a')]['where']||null:null,'attributes':_0x1e8191[_0x22ac('0x1a')]?_0x1e8191[_0x22ac('0x1a')]['attributes']||null:null,'limit':_0x1e8191[_0x22ac('0x1a')]?_0x1e8191[_0x22ac('0x1a')][_0x22ac('0x1c')]||null:null,'include':_0x1e8191[_0x22ac('0x1a')]?_0x1e8191[_0x22ac('0x1a')]['include']?_['map'](_0x1e8191[_0x22ac('0x1a')][_0x22ac('0x1d')],function(_0x48bf0f){return{'model':db[_0x48bf0f['model']],'as':_0x48bf0f['as'],'attributes':_0x48bf0f[_0x22ac('0x1e')],'include':_0x48bf0f[_0x22ac('0x1d')]?_[_0x22ac('0x1f')](_0x48bf0f['include'],function(_0x8e860c){return{'model':db[_0x8e860c[_0x22ac('0x20')]],'as':_0x8e860c['as'],'attributes':_0x8e860c[_0x22ac('0x1e')],'include':_0x8e860c['include']?_[_0x22ac('0x1f')](_0x8e860c[_0x22ac('0x1d')],function(_0x4166fb){return{'model':db[_0x4166fb[_0x22ac('0x20')]],'as':_0x4166fb['as'],'attributes':_0x4166fb['attributes']};}):[]};}):[]};}):[]:[]})[_0x22ac('0x21')](function(_0x4229e8){logger['info']('GetMailQueue',_0x1e8191);logger[_0x22ac('0x11')](_0x22ac('0x18'),_0x1e8191,JSON['stringify'](_0x4229e8));_0x5b2a87(_0x4229e8);})['catch'](function(_0x1ce9b5){logger['error']('GetMailQueue',_0x1ce9b5[_0x22ac('0x15')],_0x1e8191);_0x4233f1(_0x2f1c2d['error'](0x1f4,_0x1ce9b5[_0x22ac('0x15')]));});});};exports['ShowMailQueue']=function(_0x3f64de){var _0x224008=this;return new Promise(function(_0x2d7792,_0x15d148){return db['MailQueue'][_0x22ac('0x22')]({'raw':_0x3f64de['options']?_0x3f64de['options'][_0x22ac('0x1b')]===undefined?!![]:![]:!![],'where':_0x3f64de[_0x22ac('0x1a')]?_0x3f64de[_0x22ac('0x1a')][_0x22ac('0x23')]||null:null,'attributes':_0x3f64de[_0x22ac('0x1a')]?_0x3f64de['options'][_0x22ac('0x1e')]||null:null,'include':_0x3f64de[_0x22ac('0x1a')]?_0x3f64de[_0x22ac('0x1a')][_0x22ac('0x1d')]?_['map'](_0x3f64de['options']['include'],function(_0x1a1b21){return{'model':db[_0x1a1b21[_0x22ac('0x20')]],'as':_0x1a1b21['as'],'attributes':_0x1a1b21[_0x22ac('0x1e')],'include':_0x1a1b21[_0x22ac('0x1d')]?_[_0x22ac('0x1f')](_0x1a1b21[_0x22ac('0x1d')],function(_0x1e606d){return{'model':db[_0x1e606d[_0x22ac('0x20')]],'as':_0x1e606d['as'],'attributes':_0x1e606d['attributes'],'include':_0x1e606d['include']?_['map'](_0x1e606d[_0x22ac('0x1d')],function(_0x2b2906){return{'model':db[_0x2b2906['model']],'as':_0x2b2906['as'],'attributes':_0x2b2906[_0x22ac('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x22ac('0x21')](function(_0x4b4fc2){logger[_0x22ac('0xe')](_0x22ac('0x24'),_0x3f64de);logger[_0x22ac('0x11')]('ShowMailQueue',_0x3f64de,JSON['stringify'](_0x4b4fc2));_0x2d7792(_0x4b4fc2);})['catch'](function(_0x24be54){logger[_0x22ac('0x13')](_0x22ac('0x24'),_0x24be54[_0x22ac('0x15')],_0x3f64de);_0x15d148(_0x224008['error'](0x1f4,_0x24be54['message']));});});}; \ No newline at end of file +var _0x6f8d=['map','model','then','ShowMailQueue','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','./mailQueue.socket','request','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','GetMailQueue','MailQueue','findAll','options','where','attributes','limit','include'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6f8d,0x11d));var _0xd6f8=function(_0x3c59fc,_0x10dbd2){_0x3c59fc=_0x3c59fc-0x0;var _0x2b78d4=_0x6f8d[_0x3c59fc];return _0x2b78d4;};'use strict';var _=require(_0xd6f8('0x0'));var util=require(_0xd6f8('0x1'));var moment=require(_0xd6f8('0x2'));var BPromise=require(_0xd6f8('0x3'));var rs=require(_0xd6f8('0x4'));var fs=require('fs');var Redis=require(_0xd6f8('0x5'));var db=require(_0xd6f8('0x6'))['db'];var utils=require(_0xd6f8('0x7'));var logger=require(_0xd6f8('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd6f8('0x9'));var client=jayson[_0xd6f8('0xa')][_0xd6f8('0xb')]({'port':0x232a});config['redis']=_[_0xd6f8('0xc')](config[_0xd6f8('0xd')],{'host':_0xd6f8('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd6f8('0xd')]));require(_0xd6f8('0xf'))['register'](socket);function respondWithRpcPromise(_0x305215,_0x454a2c,_0x9e7e49){return new BPromise(function(_0x530f6f,_0x19f46c){return client[_0xd6f8('0x10')](_0x305215,_0x9e7e49)['then'](function(_0x150728){logger['info'](_0xd6f8('0x11'),_0x454a2c,'request\x20sent');logger[_0xd6f8('0x12')](_0xd6f8('0x13'),_0x454a2c,_0xd6f8('0x14'),JSON[_0xd6f8('0x15')](_0x150728));if(_0x150728[_0xd6f8('0x16')]){if(_0x150728['error'][_0xd6f8('0x17')]===0x1f4){logger[_0xd6f8('0x16')](_0xd6f8('0x11'),_0x454a2c,_0x150728[_0xd6f8('0x16')][_0xd6f8('0x18')]);return _0x19f46c(_0x150728[_0xd6f8('0x16')][_0xd6f8('0x18')]);}logger[_0xd6f8('0x16')](_0xd6f8('0x11'),_0x454a2c,_0x150728[_0xd6f8('0x16')][_0xd6f8('0x18')]);return _0x530f6f(_0x150728[_0xd6f8('0x16')][_0xd6f8('0x18')]);}else{logger[_0xd6f8('0x19')](_0xd6f8('0x11'),_0x454a2c,'request\x20sent');_0x530f6f(_0x150728['result'][_0xd6f8('0x18')]);}})[_0xd6f8('0x1a')](function(_0x4053b7){logger[_0xd6f8('0x16')](_0xd6f8('0x11'),_0x454a2c,_0x4053b7);_0x19f46c(_0x4053b7);});});}exports[_0xd6f8('0x1b')]=function(_0x22a20b){var _0x62f982=this;return new Promise(function(_0x50f2e1,_0x54fe5d){return db[_0xd6f8('0x1c')][_0xd6f8('0x1d')]({'raw':_0x22a20b[_0xd6f8('0x1e')]?_0x22a20b[_0xd6f8('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x22a20b[_0xd6f8('0x1e')]?_0x22a20b[_0xd6f8('0x1e')][_0xd6f8('0x1f')]||null:null,'attributes':_0x22a20b[_0xd6f8('0x1e')]?_0x22a20b[_0xd6f8('0x1e')][_0xd6f8('0x20')]||null:null,'limit':_0x22a20b['options']?_0x22a20b['options'][_0xd6f8('0x21')]||null:null,'include':_0x22a20b[_0xd6f8('0x1e')]?_0x22a20b['options'][_0xd6f8('0x22')]?_[_0xd6f8('0x23')](_0x22a20b['options'][_0xd6f8('0x22')],function(_0xb0b293){return{'model':db[_0xb0b293[_0xd6f8('0x24')]],'as':_0xb0b293['as'],'attributes':_0xb0b293['attributes'],'include':_0xb0b293[_0xd6f8('0x22')]?_[_0xd6f8('0x23')](_0xb0b293[_0xd6f8('0x22')],function(_0x230313){return{'model':db[_0x230313[_0xd6f8('0x24')]],'as':_0x230313['as'],'attributes':_0x230313[_0xd6f8('0x20')],'include':_0x230313[_0xd6f8('0x22')]?_[_0xd6f8('0x23')](_0x230313[_0xd6f8('0x22')],function(_0x43db6b){return{'model':db[_0x43db6b[_0xd6f8('0x24')]],'as':_0x43db6b['as'],'attributes':_0x43db6b[_0xd6f8('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd6f8('0x25')](function(_0x4222bf){logger[_0xd6f8('0x19')](_0xd6f8('0x1b'),_0x22a20b);logger['debug'](_0xd6f8('0x1b'),_0x22a20b,JSON[_0xd6f8('0x15')](_0x4222bf));_0x50f2e1(_0x4222bf);})['catch'](function(_0x7cea54){logger[_0xd6f8('0x16')](_0xd6f8('0x1b'),_0x7cea54['message'],_0x22a20b);_0x54fe5d(_0x62f982[_0xd6f8('0x16')](0x1f4,_0x7cea54['message']));});});};exports[_0xd6f8('0x26')]=function(_0x48dc4d){var _0x54521a=this;return new Promise(function(_0x2e7232,_0x2f4dd1){return db[_0xd6f8('0x1c')]['find']({'raw':_0x48dc4d['options']?_0x48dc4d[_0xd6f8('0x1e')][_0xd6f8('0x27')]===undefined?!![]:![]:!![],'where':_0x48dc4d[_0xd6f8('0x1e')]?_0x48dc4d[_0xd6f8('0x1e')][_0xd6f8('0x1f')]||null:null,'attributes':_0x48dc4d[_0xd6f8('0x1e')]?_0x48dc4d[_0xd6f8('0x1e')][_0xd6f8('0x20')]||null:null,'include':_0x48dc4d[_0xd6f8('0x1e')]?_0x48dc4d['options']['include']?_[_0xd6f8('0x23')](_0x48dc4d[_0xd6f8('0x1e')][_0xd6f8('0x22')],function(_0x2db5d1){return{'model':db[_0x2db5d1[_0xd6f8('0x24')]],'as':_0x2db5d1['as'],'attributes':_0x2db5d1[_0xd6f8('0x20')],'include':_0x2db5d1[_0xd6f8('0x22')]?_['map'](_0x2db5d1[_0xd6f8('0x22')],function(_0x3a6f4c){return{'model':db[_0x3a6f4c[_0xd6f8('0x24')]],'as':_0x3a6f4c['as'],'attributes':_0x3a6f4c[_0xd6f8('0x20')],'include':_0x3a6f4c[_0xd6f8('0x22')]?_['map'](_0x3a6f4c[_0xd6f8('0x22')],function(_0x5ddcde){return{'model':db[_0x5ddcde[_0xd6f8('0x24')]],'as':_0x5ddcde['as'],'attributes':_0x5ddcde[_0xd6f8('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd6f8('0x25')](function(_0x36851a){logger[_0xd6f8('0x19')]('ShowMailQueue',_0x48dc4d);logger[_0xd6f8('0x12')]('ShowMailQueue',_0x48dc4d,JSON[_0xd6f8('0x15')](_0x36851a));_0x2e7232(_0x36851a);})[_0xd6f8('0x1a')](function(_0xc2ec5d){logger['error'](_0xd6f8('0x26'),_0xc2ec5d[_0xd6f8('0x18')],_0x48dc4d);_0x2f4dd1(_0x54521a[_0xd6f8('0x16')](0x1f4,_0xc2ec5d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index a649f43..8a62c5b 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 _0x9f05=['update','emit','removeListener','register','length','mailQueue:','./mailQueue.events','save','remove'];(function(_0x3fc97b,_0x20ca29){var _0x3a0c82=function(_0x1c15ec){while(--_0x1c15ec){_0x3fc97b['push'](_0x3fc97b['shift']());}};_0x3a0c82(++_0x20ca29);}(_0x9f05,0xf9));var _0x59f0=function(_0x1f5a3d,_0x180ccc){_0x1f5a3d=_0x1f5a3d-0x0;var _0x5dd2c2=_0x9f05[_0x1f5a3d];return _0x5dd2c2;};'use strict';var MailQueueEvents=require(_0x59f0('0x0'));var events=[_0x59f0('0x1'),_0x59f0('0x2'),_0x59f0('0x3')];function createListener(_0x1ba104,_0x2acfc8){return function(_0x10643a){_0x2acfc8[_0x59f0('0x4')](_0x1ba104,_0x10643a);};}function removeListener(_0xfea892,_0x58db19){return function(){MailQueueEvents[_0x59f0('0x5')](_0xfea892,_0x58db19);};}exports[_0x59f0('0x6')]=function(_0x3a45ef){for(var _0x339d9a=0x0,_0x4b7b82=events[_0x59f0('0x7')];_0x339d9a<_0x4b7b82;_0x339d9a++){var _0x252889=events[_0x339d9a];var _0x48263f=createListener(_0x59f0('0x8')+_0x252889,_0x3a45ef);MailQueueEvents['on'](_0x252889,_0x48263f);}}; \ No newline at end of file +var _0x0f03=['register','length','mailQueue:','./mailQueue.events','remove','update','emit','removeListener'];(function(_0x2c0655,_0x3d2737){var _0xf986ff=function(_0x3c8b8c){while(--_0x3c8b8c){_0x2c0655['push'](_0x2c0655['shift']());}};_0xf986ff(++_0x3d2737);}(_0x0f03,0x113));var _0x30f0=function(_0x1e1761,_0x32be7a){_0x1e1761=_0x1e1761-0x0;var _0x16f0c9=_0x0f03[_0x1e1761];return _0x16f0c9;};'use strict';var MailQueueEvents=require(_0x30f0('0x0'));var events=['save',_0x30f0('0x1'),_0x30f0('0x2')];function createListener(_0x2a8f11,_0x1d1970){return function(_0x292aaf){_0x1d1970[_0x30f0('0x3')](_0x2a8f11,_0x292aaf);};}function removeListener(_0x3000d,_0x48816a){return function(){MailQueueEvents[_0x30f0('0x4')](_0x3000d,_0x48816a);};}exports[_0x30f0('0x5')]=function(_0x213cb3){for(var _0x58ea11=0x0,_0x21ffcb=events[_0x30f0('0x6')];_0x58ea11<_0x21ffcb;_0x58ea11++){var _0x3cdd7b=events[_0x58ea11];var _0x1e6ee2=createListener(_0x30f0('0x7')+_0x3cdd7b,_0x213cb3);MailQueueEvents['on'](_0x3cdd7b,_0x1e6ee2);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 596a641..c27286b 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 _0x6c9e=['multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','/describe','get','show','post','put','/:id','destroy','exports'];(function(_0x10fe84,_0x3c079b){var _0x30f422=function(_0x1736b0){while(--_0x1736b0){_0x10fe84['push'](_0x10fe84['shift']());}};_0x30f422(++_0x3c079b);}(_0x6c9e,0x110));var _0xe6c9=function(_0x5b1755,_0x4fdeb4){_0x5b1755=_0x5b1755-0x0;var _0x402a28=_0x6c9e[_0x5b1755];return _0x402a28;};'use strict';var multer=require(_0xe6c9('0x0'));var util=require(_0xe6c9('0x1'));var path=require(_0xe6c9('0x2'));var timeout=require(_0xe6c9('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe6c9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe6c9('0x5'));var controller=require(_0xe6c9('0x6'));router['get']('/',auth[_0xe6c9('0x7')](),controller[_0xe6c9('0x8')]);router['get'](_0xe6c9('0x9'),auth[_0xe6c9('0x7')](),controller['describe']);router[_0xe6c9('0xa')]('/:id',auth[_0xe6c9('0x7')](),controller[_0xe6c9('0xb')]);router[_0xe6c9('0xc')]('/',auth[_0xe6c9('0x7')](),controller['create']);router[_0xe6c9('0xd')](_0xe6c9('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xe6c9('0xe'),auth['isAuthenticated'](),controller[_0xe6c9('0xf')]);module[_0xe6c9('0x10')]=router; \ No newline at end of file +var _0x0caa=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','describe','post','create','put','/:id'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x0caa,0x17d));var _0xa0ca=function(_0x24844d,_0x727f98){_0x24844d=_0x24844d-0x0;var _0x458a84=_0x0caa[_0x24844d];return _0x458a84;};'use strict';var multer=require(_0xa0ca('0x0'));var util=require(_0xa0ca('0x1'));var path=require(_0xa0ca('0x2'));var timeout=require(_0xa0ca('0x3'));var express=require(_0xa0ca('0x4'));var router=express[_0xa0ca('0x5')]();var fs_extra=require(_0xa0ca('0x6'));var auth=require(_0xa0ca('0x7'));var interaction=require(_0xa0ca('0x8'));var config=require(_0xa0ca('0x9'));var controller=require(_0xa0ca('0xa'));router[_0xa0ca('0xb')]('/',auth[_0xa0ca('0xc')](),controller['index']);router[_0xa0ca('0xb')]('/describe',auth[_0xa0ca('0xc')](),controller[_0xa0ca('0xd')]);router[_0xa0ca('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa0ca('0xe')]('/',auth['isAuthenticated'](),controller[_0xa0ca('0xf')]);router[_0xa0ca('0x10')](_0xa0ca('0x11'),auth[_0xa0ca('0xc')](),controller[_0xa0ca('0x12')]);router[_0xa0ca('0x13')](_0xa0ca('0x11'),auth[_0xa0ca('0xc')](),controller[_0xa0ca('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index bad17fd..e009040 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 _0x0084=['moment','sequelize','STRING','DATE'];(function(_0xd45112,_0x68c8b4){var _0x2cddb8=function(_0x399d25){while(--_0x399d25){_0xd45112['push'](_0xd45112['shift']());}};_0x2cddb8(++_0x68c8b4);}(_0x0084,0x140));var _0x4008=function(_0x475bf1,_0x5235b6){_0x475bf1=_0x475bf1-0x0;var _0x4095d1=_0x0084[_0x475bf1];return _0x4095d1;};'use strict';var moment=require(_0x4008('0x0'));var Sequelize=require(_0x4008('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x4008('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x4008('0x2')]},'joinAt':{'type':Sequelize[_0x4008('0x3')]},'leaveAt':{'type':Sequelize[_0x4008('0x3')]},'acceptAt':{'type':Sequelize[_0x4008('0x3')]},'exitAt':{'type':Sequelize[_0x4008('0x3')]},'reason':{'type':Sequelize[_0x4008('0x2')]}}; \ No newline at end of file +var _0xf165=['STRING','DATE','moment','exports'];(function(_0x5ece84,_0xc06c9f){var _0x2a12c4=function(_0x133bf3){while(--_0x133bf3){_0x5ece84['push'](_0x5ece84['shift']());}};_0x2a12c4(++_0xc06c9f);}(_0xf165,0xae));var _0x5f16=function(_0x559d92,_0x281843){_0x559d92=_0x559d92-0x0;var _0x8029d=_0xf165[_0x559d92];return _0x8029d;};'use strict';var moment=require(_0x5f16('0x0'));var Sequelize=require('sequelize');module[_0x5f16('0x1')]={'uniqueid':{'type':Sequelize[_0x5f16('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x5f16('0x2')]},'joinAt':{'type':Sequelize[_0x5f16('0x3')]},'leaveAt':{'type':Sequelize[_0x5f16('0x3')]},'acceptAt':{'type':Sequelize[_0x5f16('0x3')]},'exitAt':{'type':Sequelize[_0x5f16('0x3')]},'reason':{'type':Sequelize[_0x5f16('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index a948550..daae6c8 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 _0x1a37=['index','map','MailQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1a37,0xb4));var _0x71a3=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x1a37[_0x381589];return _0x2a075d;};'use strict';var emlformat=require(_0x71a3('0x0'));var rimraf=require(_0x71a3('0x1'));var zipdir=require(_0x71a3('0x2'));var jsonpatch=require(_0x71a3('0x3'));var rp=require(_0x71a3('0x4'));var moment=require(_0x71a3('0x5'));var BPromise=require(_0x71a3('0x6'));var Mustache=require(_0x71a3('0x7'));var util=require(_0x71a3('0x8'));var path=require(_0x71a3('0x9'));var sox=require('sox');var csv=require(_0x71a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71a3('0xb'));var _=require(_0x71a3('0xc'));var squel=require(_0x71a3('0xd'));var crypto=require(_0x71a3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71a3('0xf'));var Redis=require(_0x71a3('0x10'));var authService=require(_0x71a3('0x11'));var qs=require(_0x71a3('0x12'));var as=require(_0x71a3('0x13'));var hardwareService=require(_0x71a3('0x14'));var logger=require(_0x71a3('0x15'))(_0x71a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71a3('0x17'))['db'];function respondWithStatusCode(_0x3830cb,_0x27e46d){_0x27e46d=_0x27e46d||0xcc;return function(_0x229134){if(_0x229134){return _0x3830cb[_0x71a3('0x18')](_0x27e46d);}return _0x3830cb[_0x71a3('0x19')](_0x27e46d)[_0x71a3('0x1a')]();};}function respondWithResult(_0x3b256c,_0x4dc4ed){_0x4dc4ed=_0x4dc4ed||0xc8;return function(_0x203ee1){if(_0x203ee1){return _0x3b256c[_0x71a3('0x19')](_0x4dc4ed)['json'](_0x203ee1);}};}function respondWithFilteredResult(_0x1743d7,_0x32591a){return function(_0x59021f){if(_0x59021f){var _0x4aa918=typeof _0x32591a[_0x71a3('0x1b')]===_0x71a3('0x1c')&&typeof _0x32591a[_0x71a3('0x1d')]===_0x71a3('0x1c');var _0x1af1bc=_0x59021f[_0x71a3('0x1e')];var _0x5d4dee=_0x4aa918?0x0:_0x32591a[_0x71a3('0x1b')];var _0x27bfb4=_0x4aa918?_0x59021f['count']:_0x32591a['offset']+_0x32591a[_0x71a3('0x1d')];var _0x250db3;if(_0x27bfb4>=_0x1af1bc){_0x27bfb4=_0x1af1bc;_0x250db3=0xc8;}else{_0x250db3=0xce;}_0x1743d7[_0x71a3('0x19')](_0x250db3);return _0x1743d7[_0x71a3('0x1f')](_0x71a3('0x20'),_0x5d4dee+'-'+_0x27bfb4+'/'+_0x1af1bc)['json'](_0x59021f);}return null;};}function patchUpdates(_0x1ab947){return function(_0x4156e1){try{jsonpatch[_0x71a3('0x21')](_0x4156e1,_0x1ab947,!![]);}catch(_0x3ea036){return BPromise[_0x71a3('0x22')](_0x3ea036);}return _0x4156e1['save']();};}function saveUpdates(_0x1af24b,_0x5bbaee){return function(_0x3bf78e){if(_0x3bf78e){return _0x3bf78e[_0x71a3('0x23')](_0x1af24b)[_0x71a3('0x24')](function(_0x21899d){return _0x21899d;});}return null;};}function removeEntity(_0x452bc4,_0x2847b4){return function(_0x5f33c5){if(_0x5f33c5){return _0x5f33c5[_0x71a3('0x25')]()[_0x71a3('0x24')](function(){_0x452bc4[_0x71a3('0x19')](0xcc)[_0x71a3('0x1a')]();});}};}function handleEntityNotFound(_0xb0f3aa,_0x4fd214){return function(_0x107fbd){if(!_0x107fbd){_0xb0f3aa[_0x71a3('0x18')](0x194);}return _0x107fbd;};}function handleError(_0x4c1a3d,_0x412746){_0x412746=_0x412746||0x1f4;return function(_0x515519){logger[_0x71a3('0x26')](_0x515519[_0x71a3('0x27')]);if(_0x515519[_0x71a3('0x28')]){delete _0x515519[_0x71a3('0x28')];}_0x4c1a3d[_0x71a3('0x19')](_0x412746)[_0x71a3('0x29')](_0x515519);};}exports[_0x71a3('0x2a')]=function(_0x242b85,_0x305eb1){var _0x3fc578={},_0x3ea7aa={},_0x228afa={'count':0x0,'rows':[]};var _0x51cde3=_[_0x71a3('0x2b')](db[_0x71a3('0x2c')][_0x71a3('0x2d')],function(_0x23ae85){return{'name':_0x23ae85['fieldName'],'type':_0x23ae85[_0x71a3('0x2e')][_0x71a3('0x2f')]};});_0x3ea7aa[_0x71a3('0x30')]=_[_0x71a3('0x2b')](_0x51cde3,_0x71a3('0x28'));_0x3ea7aa[_0x71a3('0x31')]=_[_0x71a3('0x32')](_0x242b85['query']);_0x3ea7aa[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],_0x3ea7aa[_0x71a3('0x31')]);_0x3fc578[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x36')]));_0x3fc578[_0x71a3('0x35')]=_0x3fc578[_0x71a3('0x35')][_0x71a3('0x37')]?_0x3fc578['attributes']:_0x3ea7aa['model'];if(!_0x242b85[_0x71a3('0x31')][_0x71a3('0x38')]('nolimit')){_0x3fc578[_0x71a3('0x1d')]=qs[_0x71a3('0x1d')](_0x242b85['query'][_0x71a3('0x1d')]);_0x3fc578[_0x71a3('0x1b')]=qs[_0x71a3('0x1b')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x1b')]);}_0x3fc578[_0x71a3('0x39')]=qs[_0x71a3('0x3a')](_0x242b85['query'][_0x71a3('0x3a')]);_0x3fc578[_0x71a3('0x3b')]=qs[_0x71a3('0x33')](_['pick'](_0x242b85[_0x71a3('0x31')],_0x3ea7aa[_0x71a3('0x33')]),_0x51cde3);if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]){_0x3fc578[_0x71a3('0x3b')]=_['merge'](_0x3fc578['where'],{'$or':_[_0x71a3('0x2b')](_0x51cde3,function(_0x2b3197){if(_0x2b3197[_0x71a3('0x2e')]!==_0x71a3('0x3d')){var _0x36ed2e={};_0x36ed2e[_0x2b3197['name']]={'$like':'%'+_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]+'%'};return _0x36ed2e;}})});}_0x3fc578=_[_0x71a3('0x3e')]({},_0x3fc578,_0x242b85['options']);var _0x17c467={'where':_0x3fc578['where']};return db[_0x71a3('0x2c')][_0x71a3('0x1e')](_0x17c467)[_0x71a3('0x24')](function(_0x43c6d1){_0x228afa[_0x71a3('0x1e')]=_0x43c6d1;if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x3fc578[_0x71a3('0x40')]=[{'all':!![]}];}return db[_0x71a3('0x2c')][_0x71a3('0x41')](_0x3fc578);})['then'](function(_0xa49846){_0x228afa['rows']=_0xa49846;return _0x228afa;})[_0x71a3('0x24')](respondWithFilteredResult(_0x305eb1,_0x3fc578))[_0x71a3('0x42')](handleError(_0x305eb1,null));};exports[_0x71a3('0x43')]=function(_0x18974c,_0x59c7c9){var _0x412bce={'raw':!![],'where':{'id':_0x18974c['params']['id']}},_0x4b4fde={};_0x4b4fde[_0x71a3('0x30')]=_[_0x71a3('0x32')](db[_0x71a3('0x2c')][_0x71a3('0x2d')]);_0x4b4fde['query']=_[_0x71a3('0x32')](_0x18974c[_0x71a3('0x31')]);_0x4b4fde[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],_0x4b4fde[_0x71a3('0x31')]);_0x412bce[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x18974c[_0x71a3('0x31')][_0x71a3('0x36')]));_0x412bce[_0x71a3('0x35')]=_0x412bce[_0x71a3('0x35')][_0x71a3('0x37')]?_0x412bce[_0x71a3('0x35')]:_0x4b4fde['model'];if(_0x18974c[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x412bce['include']=[{'all':!![]}];}_0x412bce=_[_0x71a3('0x3e')]({},_0x412bce,_0x18974c[_0x71a3('0x44')]);return db[_0x71a3('0x2c')][_0x71a3('0x45')](_0x412bce)[_0x71a3('0x24')](handleEntityNotFound(_0x59c7c9,null))['then'](respondWithResult(_0x59c7c9,null))['catch'](handleError(_0x59c7c9,null));};exports[_0x71a3('0x46')]=function(_0x4305ee,_0x51d20d){return db[_0x71a3('0x2c')][_0x71a3('0x46')](_0x4305ee[_0x71a3('0x47')],{})[_0x71a3('0x24')](respondWithResult(_0x51d20d,0xc9))[_0x71a3('0x42')](handleError(_0x51d20d,null));};exports[_0x71a3('0x23')]=function(_0x501a62,_0x1c9ba6){if(_0x501a62['body']['id']){delete _0x501a62[_0x71a3('0x47')]['id'];}return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x501a62[_0x71a3('0x48')]['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x1c9ba6,null))['then'](saveUpdates(_0x501a62[_0x71a3('0x47')],null))[_0x71a3('0x24')](respondWithResult(_0x1c9ba6,null))[_0x71a3('0x42')](handleError(_0x1c9ba6,null));};exports['destroy']=function(_0x6c34,_0x4e6423){return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x6c34['params']['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x4e6423,null))[_0x71a3('0x24')](removeEntity(_0x4e6423,null))[_0x71a3('0x42')](handleError(_0x4e6423,null));};exports[_0x71a3('0x49')]=function(_0x11391d,_0x3952c0){return db[_0x71a3('0x2c')]['describe']()[_0x71a3('0x24')](respondWithResult(_0x3952c0,null))['catch'](handleError(_0x3952c0,null));}; \ No newline at end of file +var _0xd7d1=['update','then','destroy','end','error','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','rows','catch','length','include','create','body','find','params','describe','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/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save'];(function(_0x31ff63,_0x15ab56){var _0x445ba1=function(_0x265e1e){while(--_0x265e1e){_0x31ff63['push'](_0x31ff63['shift']());}};_0x445ba1(++_0x15ab56);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x1e54d6,_0x16946e){_0x1e54d6=_0x1e54d6-0x0;var _0x45c277=_0xd7d1[_0x1e54d6];return _0x45c277;};'use strict';var emlformat=require(_0x1d7d('0x0'));var rimraf=require(_0x1d7d('0x1'));var zipdir=require(_0x1d7d('0x2'));var jsonpatch=require(_0x1d7d('0x3'));var rp=require(_0x1d7d('0x4'));var moment=require(_0x1d7d('0x5'));var BPromise=require(_0x1d7d('0x6'));var Mustache=require(_0x1d7d('0x7'));var util=require(_0x1d7d('0x8'));var path=require(_0x1d7d('0x9'));var sox=require(_0x1d7d('0xa'));var csv=require(_0x1d7d('0xb'));var ejs=require(_0x1d7d('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d7d('0xd'));var squel=require(_0x1d7d('0xe'));var crypto=require(_0x1d7d('0xf'));var jsforce=require(_0x1d7d('0x10'));var deskjs=require(_0x1d7d('0x11'));var toCsv=require(_0x1d7d('0xb'));var querystring=require(_0x1d7d('0x12'));var Papa=require(_0x1d7d('0x13'));var Redis=require(_0x1d7d('0x14'));var authService=require(_0x1d7d('0x15'));var qs=require(_0x1d7d('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d7d('0x17'));var logger=require('../../config/logger')(_0x1d7d('0x18'));var utils=require(_0x1d7d('0x19'));var config=require(_0x1d7d('0x1a'));var licenseUtil=require(_0x1d7d('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11b83f,_0x5ae1c9){_0x5ae1c9=_0x5ae1c9||0xcc;return function(_0x577e07){if(_0x577e07){return _0x11b83f[_0x1d7d('0x1c')](_0x5ae1c9);}return _0x11b83f[_0x1d7d('0x1d')](_0x5ae1c9)['end']();};}function respondWithResult(_0x55dba7,_0x1d3822){_0x1d3822=_0x1d3822||0xc8;return function(_0x334e78){if(_0x334e78){return _0x55dba7[_0x1d7d('0x1d')](_0x1d3822)[_0x1d7d('0x1e')](_0x334e78);}};}function respondWithFilteredResult(_0xeb05b3,_0x53423f){return function(_0x28adf3){if(_0x28adf3){var _0x1de6cc=typeof _0x53423f['offset']===_0x1d7d('0x1f')&&typeof _0x53423f[_0x1d7d('0x20')]===_0x1d7d('0x1f');var _0x47826a=_0x28adf3[_0x1d7d('0x21')];var _0x4db4f2=_0x1de6cc?0x0:_0x53423f[_0x1d7d('0x22')];var _0x191024=_0x1de6cc?_0x28adf3['count']:_0x53423f['offset']+_0x53423f[_0x1d7d('0x20')];var _0x1a5101;if(_0x191024>=_0x47826a){_0x191024=_0x47826a;_0x1a5101=0xc8;}else{_0x1a5101=0xce;}_0xeb05b3[_0x1d7d('0x1d')](_0x1a5101);return _0xeb05b3[_0x1d7d('0x23')](_0x1d7d('0x24'),_0x4db4f2+'-'+_0x191024+'/'+_0x47826a)[_0x1d7d('0x1e')](_0x28adf3);}return null;};}function patchUpdates(_0x54d401){return function(_0x225f85){try{jsonpatch[_0x1d7d('0x25')](_0x225f85,_0x54d401,!![]);}catch(_0x3a93d0){return BPromise['reject'](_0x3a93d0);}return _0x225f85[_0x1d7d('0x26')]();};}function saveUpdates(_0x12c54b,_0x4a1cdc){return function(_0x5950bd){if(_0x5950bd){return _0x5950bd[_0x1d7d('0x27')](_0x12c54b)[_0x1d7d('0x28')](function(_0x3d631f){return _0x3d631f;});}return null;};}function removeEntity(_0x5097b8,_0x377653){return function(_0x106376){if(_0x106376){return _0x106376[_0x1d7d('0x29')]()[_0x1d7d('0x28')](function(){_0x5097b8['status'](0xcc)[_0x1d7d('0x2a')]();});}};}function handleEntityNotFound(_0x151198,_0x5c8257){return function(_0x57bbd8){if(!_0x57bbd8){_0x151198[_0x1d7d('0x1c')](0x194);}return _0x57bbd8;};}function handleError(_0x52c618,_0x38c323){_0x38c323=_0x38c323||0x1f4;return function(_0x2d4de4){logger[_0x1d7d('0x2b')](_0x2d4de4[_0x1d7d('0x2c')]);if(_0x2d4de4[_0x1d7d('0x2d')]){delete _0x2d4de4['name'];}_0x52c618[_0x1d7d('0x1d')](_0x38c323)[_0x1d7d('0x2e')](_0x2d4de4);};}exports[_0x1d7d('0x2f')]=function(_0x58672c,_0x78adbe){var _0x1a935a={},_0x23ad85={},_0x482367={'count':0x0,'rows':[]};var _0x5aeb1f=_['map'](db[_0x1d7d('0x30')][_0x1d7d('0x31')],function(_0x559f19){return{'name':_0x559f19[_0x1d7d('0x32')],'type':_0x559f19[_0x1d7d('0x33')][_0x1d7d('0x34')]};});_0x23ad85[_0x1d7d('0x35')]=_[_0x1d7d('0x36')](_0x5aeb1f,_0x1d7d('0x2d'));_0x23ad85[_0x1d7d('0x37')]=_[_0x1d7d('0x38')](_0x58672c[_0x1d7d('0x37')]);_0x23ad85[_0x1d7d('0x39')]=_['intersection'](_0x23ad85['model'],_0x23ad85[_0x1d7d('0x37')]);_0x1a935a[_0x1d7d('0x3a')]=_[_0x1d7d('0x3b')](_0x23ad85[_0x1d7d('0x35')],qs[_0x1d7d('0x3c')](_0x58672c[_0x1d7d('0x37')][_0x1d7d('0x3c')]));_0x1a935a[_0x1d7d('0x3a')]=_0x1a935a[_0x1d7d('0x3a')]['length']?_0x1a935a[_0x1d7d('0x3a')]:_0x23ad85[_0x1d7d('0x35')];if(!_0x58672c[_0x1d7d('0x37')][_0x1d7d('0x3d')]('nolimit')){_0x1a935a['limit']=qs[_0x1d7d('0x20')](_0x58672c[_0x1d7d('0x37')]['limit']);_0x1a935a[_0x1d7d('0x22')]=qs[_0x1d7d('0x22')](_0x58672c['query']['offset']);}_0x1a935a[_0x1d7d('0x3e')]=qs[_0x1d7d('0x3f')](_0x58672c[_0x1d7d('0x37')][_0x1d7d('0x3f')]);_0x1a935a[_0x1d7d('0x40')]=qs[_0x1d7d('0x39')](_[_0x1d7d('0x41')](_0x58672c[_0x1d7d('0x37')],_0x23ad85[_0x1d7d('0x39')]),_0x5aeb1f);if(_0x58672c[_0x1d7d('0x37')]['filter']){_0x1a935a['where']=_['merge'](_0x1a935a['where'],{'$or':_[_0x1d7d('0x36')](_0x5aeb1f,function(_0x5e7e8b){if(_0x5e7e8b[_0x1d7d('0x33')]!==_0x1d7d('0x42')){var _0x3d7c65={};_0x3d7c65[_0x5e7e8b['name']]={'$like':'%'+_0x58672c[_0x1d7d('0x37')][_0x1d7d('0x43')]+'%'};return _0x3d7c65;}})});}_0x1a935a=_[_0x1d7d('0x44')]({},_0x1a935a,_0x58672c['options']);var _0x1a6a8c={'where':_0x1a935a[_0x1d7d('0x40')]};return db[_0x1d7d('0x30')][_0x1d7d('0x21')](_0x1a6a8c)['then'](function(_0x1db8e8){_0x482367[_0x1d7d('0x21')]=_0x1db8e8;if(_0x58672c[_0x1d7d('0x37')][_0x1d7d('0x45')]){_0x1a935a['include']=[{'all':!![]}];}return db[_0x1d7d('0x30')]['findAll'](_0x1a935a);})[_0x1d7d('0x28')](function(_0x31b850){_0x482367[_0x1d7d('0x46')]=_0x31b850;return _0x482367;})[_0x1d7d('0x28')](respondWithFilteredResult(_0x78adbe,_0x1a935a))[_0x1d7d('0x47')](handleError(_0x78adbe,null));};exports['show']=function(_0x59b8e7,_0x33582a){var _0xe57fa5={'raw':!![],'where':{'id':_0x59b8e7['params']['id']}},_0x1637fc={};_0x1637fc['model']=_[_0x1d7d('0x38')](db['MailQueueReport'][_0x1d7d('0x31')]);_0x1637fc[_0x1d7d('0x37')]=_[_0x1d7d('0x38')](_0x59b8e7[_0x1d7d('0x37')]);_0x1637fc[_0x1d7d('0x39')]=_[_0x1d7d('0x3b')](_0x1637fc[_0x1d7d('0x35')],_0x1637fc['query']);_0xe57fa5[_0x1d7d('0x3a')]=_[_0x1d7d('0x3b')](_0x1637fc['model'],qs[_0x1d7d('0x3c')](_0x59b8e7[_0x1d7d('0x37')][_0x1d7d('0x3c')]));_0xe57fa5[_0x1d7d('0x3a')]=_0xe57fa5[_0x1d7d('0x3a')][_0x1d7d('0x48')]?_0xe57fa5[_0x1d7d('0x3a')]:_0x1637fc[_0x1d7d('0x35')];if(_0x59b8e7[_0x1d7d('0x37')][_0x1d7d('0x45')]){_0xe57fa5[_0x1d7d('0x49')]=[{'all':!![]}];}_0xe57fa5=_[_0x1d7d('0x44')]({},_0xe57fa5,_0x59b8e7['options']);return db[_0x1d7d('0x30')]['find'](_0xe57fa5)[_0x1d7d('0x28')](handleEntityNotFound(_0x33582a,null))['then'](respondWithResult(_0x33582a,null))[_0x1d7d('0x47')](handleError(_0x33582a,null));};exports[_0x1d7d('0x4a')]=function(_0x7ebc25,_0xf25490){return db['MailQueueReport'][_0x1d7d('0x4a')](_0x7ebc25['body'],{})['then'](respondWithResult(_0xf25490,0xc9))[_0x1d7d('0x47')](handleError(_0xf25490,null));};exports['update']=function(_0x57e416,_0x3727be){if(_0x57e416[_0x1d7d('0x4b')]['id']){delete _0x57e416['body']['id'];}return db[_0x1d7d('0x30')][_0x1d7d('0x4c')]({'where':{'id':_0x57e416['params']['id']}})[_0x1d7d('0x28')](handleEntityNotFound(_0x3727be,null))[_0x1d7d('0x28')](saveUpdates(_0x57e416[_0x1d7d('0x4b')],null))[_0x1d7d('0x28')](respondWithResult(_0x3727be,null))['catch'](handleError(_0x3727be,null));};exports['destroy']=function(_0x3f73eb,_0x44d38d){return db[_0x1d7d('0x30')][_0x1d7d('0x4c')]({'where':{'id':_0x3f73eb[_0x1d7d('0x4d')]['id']}})['then'](handleEntityNotFound(_0x44d38d,null))[_0x1d7d('0x28')](removeEntity(_0x44d38d,null))[_0x1d7d('0x47')](handleError(_0x44d38d,null));};exports[_0x1d7d('0x4e')]=function(_0x18a2d1,_0x471418){return db[_0x1d7d('0x30')][_0x1d7d('0x4e')]()[_0x1d7d('0x28')](respondWithResult(_0x471418,null))[_0x1d7d('0x47')](handleError(_0x471418,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 9a0ce3e..2808578 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 _0x0607=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0607,0x99));var _0x7060=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0607[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x7060('0x0'));var util=require(_0x7060('0x1'));var logger=require(_0x7060('0x2'))('api');var moment=require(_0x7060('0x3'));var BPromise=require(_0x7060('0x4'));var rp=require(_0x7060('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7060('0x6'));var config=require(_0x7060('0x7'));var attributes=require(_0x7060('0x8'));module['exports']=function(_0x1d1e19,_0x200a20){return _0x1d1e19[_0x7060('0x9')](_0x7060('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x50d4=['path','rimraf','../../config/environment','./mailQueueReport.attributes','define','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x50d4,0x181));var _0x450d=function(_0x25b0ef,_0x36cd53){_0x25b0ef=_0x25b0ef-0x0;var _0x4a7f02=_0x50d4[_0x25b0ef];return _0x4a7f02;};'use strict';var _=require(_0x450d('0x0'));var util=require(_0x450d('0x1'));var logger=require(_0x450d('0x2'))(_0x450d('0x3'));var moment=require(_0x450d('0x4'));var BPromise=require(_0x450d('0x5'));var rp=require(_0x450d('0x6'));var fs=require('fs');var path=require(_0x450d('0x7'));var rimraf=require(_0x450d('0x8'));var config=require(_0x450d('0x9'));var attributes=require(_0x450d('0xa'));module['exports']=function(_0x536780,_0x1c564d){return _0x536780[_0x450d('0xb')]('MailQueueReport',attributes,{'tableName':_0x450d('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x450d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 37c587b..0acc25d 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 _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x96c546,_0x10eb01){var _0x23bec9=function(_0x2a8d2c){while(--_0x2a8d2c){_0x96c546['push'](_0x96c546['shift']());}};_0x23bec9(++_0x10eb01);}(_0x7a54,0x106));var _0x47a5=function(_0x4e2fa8,_0x423188){_0x4e2fa8=_0x4e2fa8-0x0;var _0x5f26cd=_0x7a54[_0x4e2fa8];return _0x5f26cd;};'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')]('MailQueueReport,\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['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x158765,_0x179867){var _0x54fe00=function(_0xd6a95a){while(--_0xd6a95a){_0x158765['push'](_0x158765['shift']());}};_0x54fe00(++_0x179867);}(_0x7a54,0x106));var _0x47a5=function(_0x5cdd7e,_0x2527f1){_0x5cdd7e=_0x5cdd7e-0x0;var _0x20301c=_0x7a54[_0x5cdd7e];return _0x20301c;};'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')]('MailQueueReport,\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['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 730c100..99f5439 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2da201,_0x49e466){var _0x112faa=function(_0x53ffa9){while(--_0x53ffa9){_0x2da201['push'](_0x2da201['shift']());}};_0x112faa(++_0x49e466);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1486e5,_0x39684f){_0x1486e5=_0x1486e5-0x0;var _0x29d89b=_0xcb91[_0x1486e5];return _0x29d89b;};'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(_0x3cda3b,_0x5cdfee){var _0x18da9f=function(_0x15af7b){while(--_0x15af7b){_0x3cda3b['push'](_0x3cda3b['shift']());}};_0x18da9f(++_0x5cdfee);}(_0x70e0,0x17b));var _0x070e=function(_0x191140,_0x116478){_0x191140=_0x191140-0x0;var _0x1cb276=_0x70e0[_0x191140];return _0x1cb276;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 951d9c6..384a30d 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 _0xc1f3=['STRING','BOOLEAN','INTEGER','INBOX','sequelize','exports'];(function(_0x116334,_0x780e19){var _0x4d726d=function(_0x2f3d07){while(--_0x2f3d07){_0x116334['push'](_0x116334['shift']());}};_0x4d726d(++_0x780e19);}(_0xc1f3,0x76));var _0x3c1f=function(_0x3f4d15,_0x2557a8){_0x3f4d15=_0x3f4d15-0x0;var _0x15c6f4=_0xc1f3[_0x3f4d15];return _0x15c6f4;};'use strict';var Sequelize=require(_0x3c1f('0x0'));module[_0x3c1f('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x3c1f('0x2')]},'authentication':{'type':Sequelize[_0x3c1f('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x3c1f('0x2')]},'password':{'type':Sequelize[_0x3c1f('0x2')]},'port':{'type':Sequelize[_0x3c1f('0x4')]},'tls':{'type':Sequelize[_0x3c1f('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x3c1f('0x2')],'defaultValue':_0x3c1f('0x5')},'connTimeout':{'type':Sequelize[_0x3c1f('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x3c1f('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x3c1f('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6cdd=['INTEGER','INBOX','sequelize','STRING','BOOLEAN'];(function(_0x20f8ea,_0x5b08b5){var _0x482969=function(_0x4919a9){while(--_0x4919a9){_0x20f8ea['push'](_0x20f8ea['shift']());}};_0x482969(++_0x5b08b5);}(_0x6cdd,0x8e));var _0xd6cd=function(_0x1a5fe6,_0xfe8d7d){_0x1a5fe6=_0x1a5fe6-0x0;var _0x1ca227=_0x6cdd[_0x1a5fe6];return _0x1ca227;};'use strict';var Sequelize=require(_0xd6cd('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xd6cd('0x1')]},'authentication':{'type':Sequelize[_0xd6cd('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xd6cd('0x1')]},'password':{'type':Sequelize[_0xd6cd('0x1')]},'port':{'type':Sequelize[_0xd6cd('0x3')]},'tls':{'type':Sequelize[_0xd6cd('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xd6cd('0x1')],'defaultValue':_0xd6cd('0x4')},'connTimeout':{'type':Sequelize[_0xd6cd('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xd6cd('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index a271c73..c956998 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 _0x30bc=['rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x30bc,0x12d));var _0xc30b=function(_0x5e2b34,_0x58385c){_0x5e2b34=_0x5e2b34-0x0;var _0x4859f9=_0x30bc[_0x5e2b34];return _0x4859f9;};'use strict';var _=require(_0xc30b('0x0'));var util=require(_0xc30b('0x1'));var logger=require(_0xc30b('0x2'))('api');var moment=require(_0xc30b('0x3'));var BPromise=require(_0xc30b('0x4'));var rp=require(_0xc30b('0x5'));var fs=require('fs');var path=require(_0xc30b('0x6'));var rimraf=require(_0xc30b('0x7'));var config=require(_0xc30b('0x8'));var attributes=require(_0xc30b('0x9'));module[_0xc30b('0xa')]=function(_0x2264c4,_0x178ffd){return _0x2264c4[_0xc30b('0xb')](_0xc30b('0xc'),attributes,{'tableName':_0xc30b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7154=['define','mail_servers_in','lodash','util','api','path','rimraf','../../config/environment','./mailServerIn.attributes','exports'];(function(_0x1d0cdf,_0x2a9114){var _0x1d7710=function(_0x373e27){while(--_0x373e27){_0x1d0cdf['push'](_0x1d0cdf['shift']());}};_0x1d7710(++_0x2a9114);}(_0x7154,0x1a6));var _0x4715=function(_0xd0cd0b,_0x490956){_0xd0cd0b=_0xd0cd0b-0x0;var _0x59cced=_0x7154[_0xd0cd0b];return _0x59cced;};'use strict';var _=require(_0x4715('0x0'));var util=require(_0x4715('0x1'));var logger=require('../../config/logger')(_0x4715('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4715('0x3'));var rimraf=require(_0x4715('0x4'));var config=require(_0x4715('0x5'));var attributes=require(_0x4715('0x6'));module[_0x4715('0x7')]=function(_0x2d9773,_0x352460){return _0x2d9773[_0x4715('0x8')]('MailServerIn',attributes,{'tableName':_0x4715('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 34a3e91..31d5a2e 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 _0xb386=['GetMailServerIn','findAll','options','raw','attributes','limit','include','model','map','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x9203bd,_0x264759){var _0x4c5226=function(_0x59d6eb){while(--_0x59d6eb){_0x9203bd['push'](_0x9203bd['shift']());}};_0x4c5226(++_0x264759);}(_0xb386,0x190));var _0x6b38=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xb386[_0x8c43de];return _0xa6591b;};'use strict';var _=require('lodash');var util=require(_0x6b38('0x0'));var moment=require(_0x6b38('0x1'));var BPromise=require(_0x6b38('0x2'));var rs=require(_0x6b38('0x3'));var fs=require('fs');var Redis=require(_0x6b38('0x4'));var db=require(_0x6b38('0x5'))['db'];var utils=require(_0x6b38('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6b38('0x7'));var client=jayson[_0x6b38('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fd422,_0x3082f3,_0x2db51e){return new BPromise(function(_0x2f28b7,_0x15e4ff){return client['request'](_0x1fd422,_0x2db51e)[_0x6b38('0x9')](function(_0x43f278){logger[_0x6b38('0xa')](_0x6b38('0xb'),_0x3082f3,_0x6b38('0xc'));logger['debug'](_0x6b38('0xd'),_0x3082f3,'request\x20sent',JSON[_0x6b38('0xe')](_0x43f278));if(_0x43f278[_0x6b38('0xf')]){if(_0x43f278['error'][_0x6b38('0x10')]===0x1f4){logger[_0x6b38('0xf')](_0x6b38('0xb'),_0x3082f3,_0x43f278[_0x6b38('0xf')][_0x6b38('0x11')]);return _0x15e4ff(_0x43f278[_0x6b38('0xf')][_0x6b38('0x11')]);}logger[_0x6b38('0xf')](_0x6b38('0xb'),_0x3082f3,_0x43f278[_0x6b38('0xf')]['message']);return _0x2f28b7(_0x43f278[_0x6b38('0xf')][_0x6b38('0x11')]);}else{logger[_0x6b38('0xa')](_0x6b38('0xb'),_0x3082f3,_0x6b38('0xc'));_0x2f28b7(_0x43f278[_0x6b38('0x12')]['message']);}})[_0x6b38('0x13')](function(_0x4c0de1){logger[_0x6b38('0xf')](_0x6b38('0xb'),_0x3082f3,_0x4c0de1);_0x15e4ff(_0x4c0de1);});});}exports[_0x6b38('0x14')]=function(_0x1da560){var _0x52b5c0=this;return new Promise(function(_0x308e66,_0xdcecd6){return db['MailServerIn'][_0x6b38('0x15')]({'raw':_0x1da560[_0x6b38('0x16')]?_0x1da560[_0x6b38('0x16')][_0x6b38('0x17')]===undefined?!![]:![]:!![],'where':_0x1da560[_0x6b38('0x16')]?_0x1da560['options']['where']||null:null,'attributes':_0x1da560[_0x6b38('0x16')]?_0x1da560[_0x6b38('0x16')][_0x6b38('0x18')]||null:null,'limit':_0x1da560['options']?_0x1da560[_0x6b38('0x16')][_0x6b38('0x19')]||null:null,'include':_0x1da560[_0x6b38('0x16')]?_0x1da560[_0x6b38('0x16')]['include']?_['map'](_0x1da560[_0x6b38('0x16')][_0x6b38('0x1a')],function(_0x20964f){return{'model':db[_0x20964f[_0x6b38('0x1b')]],'as':_0x20964f['as'],'attributes':_0x20964f[_0x6b38('0x18')],'include':_0x20964f[_0x6b38('0x1a')]?_[_0x6b38('0x1c')](_0x20964f['include'],function(_0x1c7d7b){return{'model':db[_0x1c7d7b[_0x6b38('0x1b')]],'as':_0x1c7d7b['as'],'attributes':_0x1c7d7b[_0x6b38('0x18')],'include':_0x1c7d7b[_0x6b38('0x1a')]?_[_0x6b38('0x1c')](_0x1c7d7b[_0x6b38('0x1a')],function(_0x517d64){return{'model':db[_0x517d64[_0x6b38('0x1b')]],'as':_0x517d64['as'],'attributes':_0x517d64['attributes']};}):[]};}):[]};}):[]:[]})[_0x6b38('0x9')](function(_0x55d789){logger['info'](_0x6b38('0x14'),_0x1da560);logger[_0x6b38('0x1d')](_0x6b38('0x14'),_0x1da560,JSON['stringify'](_0x55d789));_0x308e66(_0x55d789);})[_0x6b38('0x13')](function(_0x127f59){logger[_0x6b38('0xf')](_0x6b38('0x14'),_0x127f59[_0x6b38('0x11')],_0x1da560);_0xdcecd6(_0x52b5c0[_0x6b38('0xf')](0x1f4,_0x127f59['message']));});});}; \ No newline at end of file +var _0xd976=['attributes','limit','include','map','model','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMailServerIn','MailServerIn','findAll','options'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd976,0x12f));var _0x6d97=function(_0x140b1d,_0x6542f2){_0x140b1d=_0x140b1d-0x0;var _0x9ba520=_0xd976[_0x140b1d];return _0x9ba520;};'use strict';var _=require(_0x6d97('0x0'));var util=require(_0x6d97('0x1'));var moment=require(_0x6d97('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d97('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d97('0x4'));var logger=require(_0x6d97('0x5'))(_0x6d97('0x6'));var config=require(_0x6d97('0x7'));var jayson=require(_0x6d97('0x8'));var client=jayson[_0x6d97('0x9')][_0x6d97('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x464f96,_0x41a599,_0x30c104){return new BPromise(function(_0x254fde,_0x4d162d){return client[_0x6d97('0xb')](_0x464f96,_0x30c104)['then'](function(_0x27bec6){logger['info'](_0x6d97('0xc'),_0x41a599,_0x6d97('0xd'));logger[_0x6d97('0xe')](_0x6d97('0xf'),_0x41a599,_0x6d97('0xd'),JSON[_0x6d97('0x10')](_0x27bec6));if(_0x27bec6[_0x6d97('0x11')]){if(_0x27bec6[_0x6d97('0x11')][_0x6d97('0x12')]===0x1f4){logger['error'](_0x6d97('0xc'),_0x41a599,_0x27bec6[_0x6d97('0x11')][_0x6d97('0x13')]);return _0x4d162d(_0x27bec6[_0x6d97('0x11')][_0x6d97('0x13')]);}logger['error'](_0x6d97('0xc'),_0x41a599,_0x27bec6[_0x6d97('0x11')][_0x6d97('0x13')]);return _0x254fde(_0x27bec6['error'][_0x6d97('0x13')]);}else{logger[_0x6d97('0x14')]('MailServerIn,\x20%s,\x20%s',_0x41a599,_0x6d97('0xd'));_0x254fde(_0x27bec6[_0x6d97('0x15')]['message']);}})[_0x6d97('0x16')](function(_0x577845){logger[_0x6d97('0x11')](_0x6d97('0xc'),_0x41a599,_0x577845);_0x4d162d(_0x577845);});});}exports[_0x6d97('0x17')]=function(_0x42297e){var _0x2b3ca7=this;return new Promise(function(_0x39f466,_0x1dbca6){return db[_0x6d97('0x18')][_0x6d97('0x19')]({'raw':_0x42297e[_0x6d97('0x1a')]?_0x42297e[_0x6d97('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x42297e[_0x6d97('0x1a')]?_0x42297e[_0x6d97('0x1a')]['where']||null:null,'attributes':_0x42297e['options']?_0x42297e[_0x6d97('0x1a')][_0x6d97('0x1b')]||null:null,'limit':_0x42297e[_0x6d97('0x1a')]?_0x42297e[_0x6d97('0x1a')][_0x6d97('0x1c')]||null:null,'include':_0x42297e[_0x6d97('0x1a')]?_0x42297e['options'][_0x6d97('0x1d')]?_[_0x6d97('0x1e')](_0x42297e[_0x6d97('0x1a')][_0x6d97('0x1d')],function(_0x318a0b){return{'model':db[_0x318a0b[_0x6d97('0x1f')]],'as':_0x318a0b['as'],'attributes':_0x318a0b['attributes'],'include':_0x318a0b[_0x6d97('0x1d')]?_[_0x6d97('0x1e')](_0x318a0b[_0x6d97('0x1d')],function(_0x2cb61b){return{'model':db[_0x2cb61b[_0x6d97('0x1f')]],'as':_0x2cb61b['as'],'attributes':_0x2cb61b[_0x6d97('0x1b')],'include':_0x2cb61b[_0x6d97('0x1d')]?_[_0x6d97('0x1e')](_0x2cb61b[_0x6d97('0x1d')],function(_0x5e2fab){return{'model':db[_0x5e2fab[_0x6d97('0x1f')]],'as':_0x5e2fab['as'],'attributes':_0x5e2fab['attributes']};}):[]};}):[]};}):[]:[]})[_0x6d97('0x20')](function(_0x31947a){logger[_0x6d97('0x14')](_0x6d97('0x17'),_0x42297e);logger[_0x6d97('0xe')](_0x6d97('0x17'),_0x42297e,JSON[_0x6d97('0x10')](_0x31947a));_0x39f466(_0x31947a);})[_0x6d97('0x16')](function(_0x146706){logger[_0x6d97('0x11')](_0x6d97('0x17'),_0x146706[_0x6d97('0x13')],_0x42297e);_0x1dbca6(_0x2b3ca7[_0x6d97('0x11')](0x1f4,_0x146706[_0x6d97('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index cf3fe35..2c0819a 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _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(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 dabc203..bfc06be 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 _0xe511=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x551f8b,_0x15fac5){var _0x28a22c=function(_0x40eec1){while(--_0x40eec1){_0x551f8b['push'](_0x551f8b['shift']());}};_0x28a22c(++_0x15fac5);}(_0xe511,0x16f));var _0x1e51=function(_0x187cda,_0x2e27e8){_0x187cda=_0x187cda-0x0;var _0x1a066d=_0xe511[_0x187cda];return _0x1a066d;};'use strict';var Sequelize=require(_0x1e51('0x0'));module[_0x1e51('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x1e51('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x1e51('0x2')]},'port':{'type':Sequelize[_0x1e51('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x1e51('0x2')]},'authentication':{'type':Sequelize[_0x1e51('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x1e51('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x0fd9=['BOOLEAN','exports','STRING'];(function(_0xd2a43f,_0x29c2ed){var _0x22232a=function(_0x4e5f5a){while(--_0x4e5f5a){_0xd2a43f['push'](_0xd2a43f['shift']());}};_0x22232a(++_0x29c2ed);}(_0x0fd9,0xa3));var _0x90fd=function(_0x2e6dbf,_0x57dd06){_0x2e6dbf=_0x2e6dbf-0x0;var _0x2680e5=_0x0fd9[_0x2e6dbf];return _0x2680e5;};'use strict';var Sequelize=require('sequelize');module[_0x90fd('0x0')]={'description':{'type':Sequelize[_0x90fd('0x1')]},'host':{'type':Sequelize[_0x90fd('0x1')]},'user':{'type':Sequelize[_0x90fd('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x90fd('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0x90fd('0x1')]},'authentication':{'type':Sequelize[_0x90fd('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x90fd('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 785b8ed..2baed92 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 _0xa0a1=['count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','MailServerOut','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','eml-format','zip-dir','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit'];(function(_0x8718bc,_0x41d4a6){var _0x3dfb6c=function(_0x5ee10f){while(--_0x5ee10f){_0x8718bc['push'](_0x8718bc['shift']());}};_0x3dfb6c(++_0x41d4a6);}(_0xa0a1,0xc4));var _0x1a0a=function(_0x9ec014,_0x50f1d5){_0x9ec014=_0x9ec014-0x0;var _0x313c13=_0xa0a1[_0x9ec014];return _0x313c13;};'use strict';var emlformat=require(_0x1a0a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1a0a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1a0a('0x2'));var Mustache=require('mustache');var util=require(_0x1a0a('0x3'));var path=require(_0x1a0a('0x4'));var sox=require(_0x1a0a('0x5'));var csv=require(_0x1a0a('0x6'));var ejs=require(_0x1a0a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1a0a('0x8'));var crypto=require(_0x1a0a('0x9'));var jsforce=require(_0x1a0a('0xa'));var deskjs=require(_0x1a0a('0xb'));var toCsv=require(_0x1a0a('0x6'));var querystring=require(_0x1a0a('0xc'));var Papa=require('papaparse');var Redis=require(_0x1a0a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x1a0a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1a0a('0xf'));var logger=require('../../config/logger')(_0x1a0a('0x10'));var utils=require(_0x1a0a('0x11'));var config=require(_0x1a0a('0x12'));var licenseUtil=require(_0x1a0a('0x13'));var db=require(_0x1a0a('0x14'))['db'];function respondWithStatusCode(_0x5bda6c,_0x4e383b){_0x4e383b=_0x4e383b||0xcc;return function(_0x130f2e){if(_0x130f2e){return _0x5bda6c['sendStatus'](_0x4e383b);}return _0x5bda6c['status'](_0x4e383b)[_0x1a0a('0x15')]();};}function respondWithResult(_0xab15ef,_0x2d2d1f){_0x2d2d1f=_0x2d2d1f||0xc8;return function(_0x5b2b44){if(_0x5b2b44){return _0xab15ef[_0x1a0a('0x16')](_0x2d2d1f)['json'](_0x5b2b44);}};}function respondWithFilteredResult(_0x13bd14,_0xe9ead7){return function(_0x5b682a){if(_0x5b682a){var _0x402012=typeof _0xe9ead7[_0x1a0a('0x17')]===_0x1a0a('0x18')&&typeof _0xe9ead7[_0x1a0a('0x19')]===_0x1a0a('0x18');var _0x39a5a2=_0x5b682a[_0x1a0a('0x1a')];var _0x53ae73=_0x402012?0x0:_0xe9ead7['offset'];var _0x15294e=_0x402012?_0x5b682a[_0x1a0a('0x1a')]:_0xe9ead7[_0x1a0a('0x17')]+_0xe9ead7[_0x1a0a('0x19')];var _0x2e510b;if(_0x15294e>=_0x39a5a2){_0x15294e=_0x39a5a2;_0x2e510b=0xc8;}else{_0x2e510b=0xce;}_0x13bd14[_0x1a0a('0x16')](_0x2e510b);return _0x13bd14[_0x1a0a('0x1b')](_0x1a0a('0x1c'),_0x53ae73+'-'+_0x15294e+'/'+_0x39a5a2)[_0x1a0a('0x1d')](_0x5b682a);}return null;};}function patchUpdates(_0x319e02){return function(_0xffa85e){try{jsonpatch[_0x1a0a('0x1e')](_0xffa85e,_0x319e02,!![]);}catch(_0x67be82){return BPromise[_0x1a0a('0x1f')](_0x67be82);}return _0xffa85e[_0x1a0a('0x20')]();};}function saveUpdates(_0x4a9027,_0x311d3e){return function(_0x27f27c){if(_0x27f27c){return _0x27f27c[_0x1a0a('0x21')](_0x4a9027)[_0x1a0a('0x22')](function(_0x464fc2){return _0x464fc2;});}return null;};}function removeEntity(_0x2afb02,_0x3c2f9a){return function(_0x59cac2){if(_0x59cac2){return _0x59cac2[_0x1a0a('0x23')]()[_0x1a0a('0x22')](function(){_0x2afb02[_0x1a0a('0x16')](0xcc)[_0x1a0a('0x15')]();});}};}function handleEntityNotFound(_0x191889,_0x4d563c){return function(_0xd1229f){if(!_0xd1229f){_0x191889['sendStatus'](0x194);}return _0xd1229f;};}function handleError(_0x168f50,_0x239f85){_0x239f85=_0x239f85||0x1f4;return function(_0x57f630){logger[_0x1a0a('0x24')](_0x57f630[_0x1a0a('0x25')]);if(_0x57f630[_0x1a0a('0x26')]){delete _0x57f630[_0x1a0a('0x26')];}_0x168f50[_0x1a0a('0x16')](_0x239f85)['send'](_0x57f630);};}exports[_0x1a0a('0x27')]=function(_0x186e1d,_0x5bdee4){var _0x7de261={},_0x2912b9={},_0xc43536={'count':0x0,'rows':[]};var _0x287cef=_[_0x1a0a('0x28')](db[_0x1a0a('0x29')][_0x1a0a('0x2a')],function(_0x459e93){return{'name':_0x459e93[_0x1a0a('0x2b')],'type':_0x459e93['type'][_0x1a0a('0x2c')]};});_0x2912b9[_0x1a0a('0x2d')]=_[_0x1a0a('0x28')](_0x287cef,_0x1a0a('0x26'));_0x2912b9[_0x1a0a('0x2e')]=_[_0x1a0a('0x2f')](_0x186e1d[_0x1a0a('0x2e')]);_0x2912b9[_0x1a0a('0x30')]=_[_0x1a0a('0x31')](_0x2912b9[_0x1a0a('0x2d')],_0x2912b9[_0x1a0a('0x2e')]);_0x7de261[_0x1a0a('0x32')]=_[_0x1a0a('0x31')](_0x2912b9[_0x1a0a('0x2d')],qs[_0x1a0a('0x33')](_0x186e1d[_0x1a0a('0x2e')][_0x1a0a('0x33')]));_0x7de261[_0x1a0a('0x32')]=_0x7de261[_0x1a0a('0x32')]['length']?_0x7de261[_0x1a0a('0x32')]:_0x2912b9[_0x1a0a('0x2d')];if(!_0x186e1d['query'][_0x1a0a('0x34')](_0x1a0a('0x35'))){_0x7de261['limit']=qs[_0x1a0a('0x19')](_0x186e1d[_0x1a0a('0x2e')][_0x1a0a('0x19')]);_0x7de261['offset']=qs[_0x1a0a('0x17')](_0x186e1d['query'][_0x1a0a('0x17')]);}_0x7de261[_0x1a0a('0x36')]=qs[_0x1a0a('0x37')](_0x186e1d[_0x1a0a('0x2e')][_0x1a0a('0x37')]);_0x7de261[_0x1a0a('0x38')]=qs['filters'](_[_0x1a0a('0x39')](_0x186e1d[_0x1a0a('0x2e')],_0x2912b9[_0x1a0a('0x30')]),_0x287cef);if(_0x186e1d[_0x1a0a('0x2e')][_0x1a0a('0x3a')]){_0x7de261[_0x1a0a('0x38')]=_[_0x1a0a('0x3b')](_0x7de261[_0x1a0a('0x38')],{'$or':_[_0x1a0a('0x28')](_0x287cef,function(_0x14e361){if(_0x14e361[_0x1a0a('0x3c')]!==_0x1a0a('0x3d')){var _0x6834a9={};_0x6834a9[_0x14e361['name']]={'$like':'%'+_0x186e1d[_0x1a0a('0x2e')]['filter']+'%'};return _0x6834a9;}})});}_0x7de261=_[_0x1a0a('0x3b')]({},_0x7de261,_0x186e1d['options']);var _0x34bdf2={'where':_0x7de261[_0x1a0a('0x38')]};return db[_0x1a0a('0x29')][_0x1a0a('0x1a')](_0x34bdf2)['then'](function(_0x51c26e){_0xc43536[_0x1a0a('0x1a')]=_0x51c26e;if(_0x186e1d['query'][_0x1a0a('0x3e')]){_0x7de261[_0x1a0a('0x3f')]=[{'all':!![]}];}return db[_0x1a0a('0x29')][_0x1a0a('0x40')](_0x7de261);})['then'](function(_0x49c429){_0xc43536[_0x1a0a('0x41')]=_0x49c429;return _0xc43536;})[_0x1a0a('0x22')](respondWithFilteredResult(_0x5bdee4,_0x7de261))[_0x1a0a('0x42')](handleError(_0x5bdee4,null));};exports[_0x1a0a('0x43')]=function(_0x202fd8,_0x3a40dd){var _0x49ec07={'raw':!![],'where':{'id':_0x202fd8[_0x1a0a('0x44')]['id']}},_0x3d77b9={};_0x3d77b9[_0x1a0a('0x2d')]=_['keys'](db['MailServerOut']['rawAttributes']);_0x3d77b9[_0x1a0a('0x2e')]=_[_0x1a0a('0x2f')](_0x202fd8['query']);_0x3d77b9[_0x1a0a('0x30')]=_[_0x1a0a('0x31')](_0x3d77b9[_0x1a0a('0x2d')],_0x3d77b9[_0x1a0a('0x2e')]);_0x49ec07[_0x1a0a('0x32')]=_[_0x1a0a('0x31')](_0x3d77b9['model'],qs[_0x1a0a('0x33')](_0x202fd8['query'][_0x1a0a('0x33')]));_0x49ec07['attributes']=_0x49ec07['attributes'][_0x1a0a('0x45')]?_0x49ec07[_0x1a0a('0x32')]:_0x3d77b9[_0x1a0a('0x2d')];if(_0x202fd8[_0x1a0a('0x2e')][_0x1a0a('0x3e')]){_0x49ec07[_0x1a0a('0x3f')]=[{'all':!![]}];}_0x49ec07=_[_0x1a0a('0x3b')]({},_0x49ec07,_0x202fd8[_0x1a0a('0x46')]);return db['MailServerOut'][_0x1a0a('0x47')](_0x49ec07)['then'](handleEntityNotFound(_0x3a40dd,null))[_0x1a0a('0x22')](respondWithResult(_0x3a40dd,null))['catch'](handleError(_0x3a40dd,null));};exports[_0x1a0a('0x48')]=function(_0x1554fa,_0x14d59b){return db[_0x1a0a('0x29')][_0x1a0a('0x48')](_0x1554fa['body'],{})['then'](respondWithResult(_0x14d59b,0xc9))[_0x1a0a('0x42')](handleError(_0x14d59b,null));};exports['update']=function(_0x4f7321,_0x24e296){if(_0x4f7321[_0x1a0a('0x49')]['id']){delete _0x4f7321['body']['id'];}return db['MailServerOut']['find']({'where':{'id':_0x4f7321[_0x1a0a('0x44')]['id']}})[_0x1a0a('0x22')](handleEntityNotFound(_0x24e296,null))[_0x1a0a('0x22')](saveUpdates(_0x4f7321[_0x1a0a('0x49')],null))[_0x1a0a('0x22')](respondWithResult(_0x24e296,null))[_0x1a0a('0x42')](handleError(_0x24e296,null));};exports[_0x1a0a('0x23')]=function(_0x1a67df,_0x2597b9){return db[_0x1a0a('0x29')][_0x1a0a('0x47')]({'where':{'id':_0x1a67df[_0x1a0a('0x44')]['id']}})['then'](handleEntityNotFound(_0x2597b9,null))[_0x1a0a('0x22')](removeEntity(_0x2597b9,null))['catch'](handleError(_0x2597b9,null));}; \ No newline at end of file +var _0x11de=['VIRTUAL','merge','options','MailServerOut','include','findAll','rows','catch','show','includeAll','find','create','body','destroy','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','stack','name','index','map','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x44dcdb,_0x4ebb58){var _0x152a5b=function(_0x2c8e7f){while(--_0x2c8e7f){_0x44dcdb['push'](_0x44dcdb['shift']());}};_0x152a5b(++_0x4ebb58);}(_0x11de,0x1dd));var _0xe11d=function(_0x30926c,_0x24d52e){_0x30926c=_0x30926c-0x0;var _0x33c418=_0x11de[_0x30926c];return _0x33c418;};'use strict';var emlformat=require(_0xe11d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe11d('0x1'));var jsonpatch=require(_0xe11d('0x2'));var rp=require(_0xe11d('0x3'));var moment=require(_0xe11d('0x4'));var BPromise=require(_0xe11d('0x5'));var Mustache=require(_0xe11d('0x6'));var util=require('util');var path=require(_0xe11d('0x7'));var sox=require('sox');var csv=require(_0xe11d('0x8'));var ejs=require(_0xe11d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe11d('0xa'));var squel=require(_0xe11d('0xb'));var crypto=require(_0xe11d('0xc'));var jsforce=require(_0xe11d('0xd'));var deskjs=require(_0xe11d('0xe'));var toCsv=require(_0xe11d('0x8'));var querystring=require('querystring');var Papa=require(_0xe11d('0xf'));var Redis=require(_0xe11d('0x10'));var authService=require(_0xe11d('0x11'));var qs=require(_0xe11d('0x12'));var as=require(_0xe11d('0x13'));var hardwareService=require(_0xe11d('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xe11d('0x15'));var config=require(_0xe11d('0x16'));var licenseUtil=require(_0xe11d('0x17'));var db=require(_0xe11d('0x18'))['db'];function respondWithStatusCode(_0x2087fd,_0x28668a){_0x28668a=_0x28668a||0xcc;return function(_0x5625cc){if(_0x5625cc){return _0x2087fd[_0xe11d('0x19')](_0x28668a);}return _0x2087fd['status'](_0x28668a)[_0xe11d('0x1a')]();};}function respondWithResult(_0x1a4297,_0x180a15){_0x180a15=_0x180a15||0xc8;return function(_0x551838){if(_0x551838){return _0x1a4297[_0xe11d('0x1b')](_0x180a15)[_0xe11d('0x1c')](_0x551838);}};}function respondWithFilteredResult(_0x408975,_0x247ba0){return function(_0x4bc15f){if(_0x4bc15f){var _0x5e04ab=typeof _0x247ba0[_0xe11d('0x1d')]===_0xe11d('0x1e')&&typeof _0x247ba0[_0xe11d('0x1f')]===_0xe11d('0x1e');var _0x4fa06b=_0x4bc15f[_0xe11d('0x20')];var _0x5443c4=_0x5e04ab?0x0:_0x247ba0[_0xe11d('0x1d')];var _0x4bb986=_0x5e04ab?_0x4bc15f['count']:_0x247ba0[_0xe11d('0x1d')]+_0x247ba0[_0xe11d('0x1f')];var _0x3ad2ae;if(_0x4bb986>=_0x4fa06b){_0x4bb986=_0x4fa06b;_0x3ad2ae=0xc8;}else{_0x3ad2ae=0xce;}_0x408975[_0xe11d('0x1b')](_0x3ad2ae);return _0x408975[_0xe11d('0x21')](_0xe11d('0x22'),_0x5443c4+'-'+_0x4bb986+'/'+_0x4fa06b)[_0xe11d('0x1c')](_0x4bc15f);}return null;};}function patchUpdates(_0x56ab58){return function(_0x125141){try{jsonpatch[_0xe11d('0x23')](_0x125141,_0x56ab58,!![]);}catch(_0xf0a4ab){return BPromise['reject'](_0xf0a4ab);}return _0x125141[_0xe11d('0x24')]();};}function saveUpdates(_0x1b5db5,_0x1b3934){return function(_0x42fecd){if(_0x42fecd){return _0x42fecd[_0xe11d('0x25')](_0x1b5db5)[_0xe11d('0x26')](function(_0x25ff08){return _0x25ff08;});}return null;};}function removeEntity(_0x51ccee,_0x5dad41){return function(_0x599c2c){if(_0x599c2c){return _0x599c2c['destroy']()[_0xe11d('0x26')](function(){_0x51ccee[_0xe11d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x462086,_0x4285c1){return function(_0x5467ab){if(!_0x5467ab){_0x462086[_0xe11d('0x19')](0x194);}return _0x5467ab;};}function handleError(_0x33393e,_0x2867c5){_0x2867c5=_0x2867c5||0x1f4;return function(_0x16516){logger['error'](_0x16516[_0xe11d('0x27')]);if(_0x16516[_0xe11d('0x28')]){delete _0x16516[_0xe11d('0x28')];}_0x33393e['status'](_0x2867c5)['send'](_0x16516);};}exports[_0xe11d('0x29')]=function(_0x59b75b,_0x3fdcee){var _0x225112={},_0x329131={},_0x1396dc={'count':0x0,'rows':[]};var _0x55ba4f=_[_0xe11d('0x2a')](db['MailServerOut'][_0xe11d('0x2b')],function(_0x3b0e8d){return{'name':_0x3b0e8d[_0xe11d('0x2c')],'type':_0x3b0e8d[_0xe11d('0x2d')][_0xe11d('0x2e')]};});_0x329131['model']=_['map'](_0x55ba4f,'name');_0x329131['query']=_[_0xe11d('0x2f')](_0x59b75b[_0xe11d('0x30')]);_0x329131[_0xe11d('0x31')]=_['intersection'](_0x329131[_0xe11d('0x32')],_0x329131[_0xe11d('0x30')]);_0x225112[_0xe11d('0x33')]=_[_0xe11d('0x34')](_0x329131[_0xe11d('0x32')],qs['fields'](_0x59b75b[_0xe11d('0x30')][_0xe11d('0x35')]));_0x225112['attributes']=_0x225112[_0xe11d('0x33')][_0xe11d('0x36')]?_0x225112['attributes']:_0x329131[_0xe11d('0x32')];if(!_0x59b75b[_0xe11d('0x30')][_0xe11d('0x37')](_0xe11d('0x38'))){_0x225112['limit']=qs[_0xe11d('0x1f')](_0x59b75b[_0xe11d('0x30')][_0xe11d('0x1f')]);_0x225112['offset']=qs[_0xe11d('0x1d')](_0x59b75b[_0xe11d('0x30')][_0xe11d('0x1d')]);}_0x225112[_0xe11d('0x39')]=qs[_0xe11d('0x3a')](_0x59b75b['query'][_0xe11d('0x3a')]);_0x225112[_0xe11d('0x3b')]=qs[_0xe11d('0x31')](_[_0xe11d('0x3c')](_0x59b75b['query'],_0x329131[_0xe11d('0x31')]),_0x55ba4f);if(_0x59b75b[_0xe11d('0x30')][_0xe11d('0x3d')]){_0x225112[_0xe11d('0x3b')]=_['merge'](_0x225112['where'],{'$or':_[_0xe11d('0x2a')](_0x55ba4f,function(_0x1fdd9a){if(_0x1fdd9a[_0xe11d('0x2d')]!==_0xe11d('0x3e')){var _0x540399={};_0x540399[_0x1fdd9a[_0xe11d('0x28')]]={'$like':'%'+_0x59b75b[_0xe11d('0x30')][_0xe11d('0x3d')]+'%'};return _0x540399;}})});}_0x225112=_[_0xe11d('0x3f')]({},_0x225112,_0x59b75b[_0xe11d('0x40')]);var _0xcfdfeb={'where':_0x225112['where']};return db[_0xe11d('0x41')][_0xe11d('0x20')](_0xcfdfeb)[_0xe11d('0x26')](function(_0x5ec7e6){_0x1396dc[_0xe11d('0x20')]=_0x5ec7e6;if(_0x59b75b[_0xe11d('0x30')]['includeAll']){_0x225112[_0xe11d('0x42')]=[{'all':!![]}];}return db[_0xe11d('0x41')][_0xe11d('0x43')](_0x225112);})['then'](function(_0x31b7ad){_0x1396dc[_0xe11d('0x44')]=_0x31b7ad;return _0x1396dc;})[_0xe11d('0x26')](respondWithFilteredResult(_0x3fdcee,_0x225112))[_0xe11d('0x45')](handleError(_0x3fdcee,null));};exports[_0xe11d('0x46')]=function(_0x3541da,_0x21b03f){var _0x23c59e={'raw':!![],'where':{'id':_0x3541da['params']['id']}},_0x557840={};_0x557840[_0xe11d('0x32')]=_[_0xe11d('0x2f')](db['MailServerOut'][_0xe11d('0x2b')]);_0x557840[_0xe11d('0x30')]=_[_0xe11d('0x2f')](_0x3541da['query']);_0x557840[_0xe11d('0x31')]=_[_0xe11d('0x34')](_0x557840[_0xe11d('0x32')],_0x557840[_0xe11d('0x30')]);_0x23c59e[_0xe11d('0x33')]=_[_0xe11d('0x34')](_0x557840['model'],qs[_0xe11d('0x35')](_0x3541da['query'][_0xe11d('0x35')]));_0x23c59e['attributes']=_0x23c59e[_0xe11d('0x33')][_0xe11d('0x36')]?_0x23c59e[_0xe11d('0x33')]:_0x557840['model'];if(_0x3541da['query'][_0xe11d('0x47')]){_0x23c59e['include']=[{'all':!![]}];}_0x23c59e=_[_0xe11d('0x3f')]({},_0x23c59e,_0x3541da[_0xe11d('0x40')]);return db[_0xe11d('0x41')][_0xe11d('0x48')](_0x23c59e)[_0xe11d('0x26')](handleEntityNotFound(_0x21b03f,null))[_0xe11d('0x26')](respondWithResult(_0x21b03f,null))[_0xe11d('0x45')](handleError(_0x21b03f,null));};exports[_0xe11d('0x49')]=function(_0x48a8c6,_0x22c7fb){return db[_0xe11d('0x41')]['create'](_0x48a8c6[_0xe11d('0x4a')],{})[_0xe11d('0x26')](respondWithResult(_0x22c7fb,0xc9))[_0xe11d('0x45')](handleError(_0x22c7fb,null));};exports[_0xe11d('0x25')]=function(_0x1f2a91,_0x1b3759){if(_0x1f2a91[_0xe11d('0x4a')]['id']){delete _0x1f2a91['body']['id'];}return db['MailServerOut']['find']({'where':{'id':_0x1f2a91['params']['id']}})['then'](handleEntityNotFound(_0x1b3759,null))[_0xe11d('0x26')](saveUpdates(_0x1f2a91['body'],null))[_0xe11d('0x26')](respondWithResult(_0x1b3759,null))[_0xe11d('0x45')](handleError(_0x1b3759,null));};exports[_0xe11d('0x4b')]=function(_0x4a814d,_0x1a0aee){return db[_0xe11d('0x41')][_0xe11d('0x48')]({'where':{'id':_0x4a814d[_0xe11d('0x4c')]['id']}})[_0xe11d('0x26')](handleEntityNotFound(_0x1a0aee,null))[_0xe11d('0x26')](removeEntity(_0x1a0aee,null))['catch'](handleError(_0x1a0aee,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index a2ed9e7..aed570f 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 _0xe82c=['../../config/environment','exports','define','MailServerOut','mail_servers_out','../../config/logger','moment','request-promise'];(function(_0x49d4d1,_0x4b2f76){var _0x2ab8d0=function(_0x338de6){while(--_0x338de6){_0x49d4d1['push'](_0x49d4d1['shift']());}};_0x2ab8d0(++_0x4b2f76);}(_0xe82c,0x1ad));var _0xce82=function(_0x486850,_0x51955d){_0x486850=_0x486850-0x0;var _0x125484=_0xe82c[_0x486850];return _0x125484;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xce82('0x0'))('api');var moment=require(_0xce82('0x1'));var BPromise=require('bluebird');var rp=require(_0xce82('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xce82('0x3'));var attributes=require('./mailServerOut.attributes');module[_0xce82('0x4')]=function(_0x26067d,_0x22104f){return _0x26067d[_0xce82('0x5')](_0xce82('0x6'),attributes,{'tableName':_0xce82('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1832=['./mailServerOut.attributes','exports','define','MailServerOut','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1b16eb,_0x17bd54){var _0x7f90f2=function(_0x4b5bcc){while(--_0x4b5bcc){_0x1b16eb['push'](_0x1b16eb['shift']());}};_0x7f90f2(++_0x17bd54);}(_0x1832,0xad));var _0x2183=function(_0x4773fd,_0x26247c){_0x4773fd=_0x4773fd-0x0;var _0x190bdc=_0x1832[_0x4773fd];return _0x190bdc;};'use strict';var _=require(_0x2183('0x0'));var util=require('util');var logger=require(_0x2183('0x1'))(_0x2183('0x2'));var moment=require(_0x2183('0x3'));var BPromise=require(_0x2183('0x4'));var rp=require(_0x2183('0x5'));var fs=require('fs');var path=require(_0x2183('0x6'));var rimraf=require(_0x2183('0x7'));var config=require(_0x2183('0x8'));var attributes=require(_0x2183('0x9'));module[_0x2183('0xa')]=function(_0x4526c1,_0x20c1f5){return _0x4526c1[_0x2183('0xb')](_0x2183('0xc'),attributes,{'tableName':'mail_servers_out','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 a84649c..bf7740d 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 _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(_0x422cb2,_0x5ce0db){var _0x13069f=function(_0x102228){while(--_0x102228){_0x422cb2['push'](_0x422cb2['shift']());}};_0x13069f(++_0x5ce0db);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc4aa[_0x46698a];return _0x356db0;};'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 +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x35e75a,_0x5ed225){var _0xb23c7f=function(_0x2fa40c){while(--_0x2fa40c){_0x35e75a['push'](_0x35e75a['shift']());}};_0xb23c7f(++_0x5ed225);}(_0xadb5,0xad));var _0x5adb=function(_0x24d1a3,_0x1b8126){_0x24d1a3=_0x24d1a3-0x0;var _0x53dd5c=_0xadb5[_0x24d1a3];return _0x53dd5c;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 1608462..5fc0193 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 _0x8822=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','post','create','/:id','update'];(function(_0x708b92,_0x85e1b6){var _0x1f73a3=function(_0x26ca65){while(--_0x26ca65){_0x708b92['push'](_0x708b92['shift']());}};_0x1f73a3(++_0x85e1b6);}(_0x8822,0xd2));var _0x2882=function(_0x250ad3,_0x28ad0e){_0x250ad3=_0x250ad3-0x0;var _0x197725=_0x8822[_0x250ad3];return _0x197725;};'use strict';var multer=require(_0x2882('0x0'));var util=require(_0x2882('0x1'));var path=require(_0x2882('0x2'));var timeout=require(_0x2882('0x3'));var express=require(_0x2882('0x4'));var router=express[_0x2882('0x5')]();var fs_extra=require(_0x2882('0x6'));var auth=require(_0x2882('0x7'));var interaction=require(_0x2882('0x8'));var config=require(_0x2882('0x9'));var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x2882('0xa')](),controller[_0x2882('0xb')]);router[_0x2882('0xc')](_0x2882('0xd'),auth[_0x2882('0xa')](),controller[_0x2882('0xe')]);router[_0x2882('0xc')]('/:id',auth[_0x2882('0xa')](),controller[_0x2882('0xf')]);router[_0x2882('0x10')]('/',auth[_0x2882('0xa')](),controller[_0x2882('0x11')]);router['put'](_0x2882('0x12'),auth[_0x2882('0xa')](),controller[_0x2882('0x13')]);router[_0x2882('0x14')](_0x2882('0x12'),auth[_0x2882('0xa')](),controller[_0x2882('0x15')]);module[_0x2882('0x16')]=router; \ No newline at end of file +var _0x6cca=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','express'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x6cca,0x1b5));var _0xa6cc=function(_0x2aee4a,_0x3213e1){_0x2aee4a=_0x2aee4a-0x0;var _0x4d9280=_0x6cca[_0x2aee4a];return _0x4d9280;};'use strict';var multer=require(_0xa6cc('0x0'));var util=require(_0xa6cc('0x1'));var path=require(_0xa6cc('0x2'));var timeout=require('connect-timeout');var express=require(_0xa6cc('0x3'));var router=express[_0xa6cc('0x4')]();var fs_extra=require(_0xa6cc('0x5'));var auth=require(_0xa6cc('0x6'));var interaction=require(_0xa6cc('0x7'));var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router[_0xa6cc('0x8')]('/',auth[_0xa6cc('0x9')](),controller[_0xa6cc('0xa')]);router[_0xa6cc('0x8')](_0xa6cc('0xb'),auth[_0xa6cc('0x9')](),controller[_0xa6cc('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa6cc('0xd')]);router[_0xa6cc('0xe')]('/',auth[_0xa6cc('0x9')](),controller[_0xa6cc('0xf')]);router[_0xa6cc('0x10')](_0xa6cc('0x11'),auth['isAuthenticated'](),controller['update']);router[_0xa6cc('0x12')](_0xa6cc('0x11'),auth[_0xa6cc('0x9')](),controller[_0xa6cc('0x13')]);module[_0xa6cc('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 6321f9b..a034cba 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 _0x5334=['sequelize','exports','STRING','name'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x5334,0x84));var _0x4533=function(_0x1194f9,_0x4957f0){_0x1194f9=_0x1194f9-0x0;var _0x12b497=_0x5334[_0x1194f9];return _0x12b497;};'use strict';var Sequelize=require(_0x4533('0x0'));module[_0x4533('0x1')]={'name':{'type':Sequelize[_0x4533('0x2')],'unique':_0x4533('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4533('0x2')]}}; \ No newline at end of file +var _0x8375=['sequelize','exports','STRING'];(function(_0x2fc69c,_0x6c31a6){var _0x489173=function(_0x2304ad){while(--_0x2304ad){_0x2fc69c['push'](_0x2fc69c['shift']());}};_0x489173(++_0x6c31a6);}(_0x8375,0xa8));var _0x5837=function(_0x4d4e43,_0x5c2c3b){_0x4d4e43=_0x4d4e43-0x0;var _0x5993db=_0x8375[_0x4d4e43];return _0x5993db;};'use strict';var Sequelize=require(_0x5837('0x0'));module[_0x5837('0x1')]={'name':{'type':Sequelize[_0x5837('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5837('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 2863ae5..aa1e40e 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 _0x44e7=['findAll','catch','length','options','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','json','apply','reject','save','destroy','then','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','MailSubstatus','includeAll','include'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x44e7,0xe7));var _0x744e=function(_0x2d9e27,_0x5965b2){_0x2d9e27=_0x2d9e27-0x0;var _0xd35381=_0x44e7[_0x2d9e27];return _0xd35381;};'use strict';var emlformat=require(_0x744e('0x0'));var rimraf=require(_0x744e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x744e('0x2'));var rp=require(_0x744e('0x3'));var moment=require('moment');var BPromise=require(_0x744e('0x4'));var Mustache=require(_0x744e('0x5'));var util=require(_0x744e('0x6'));var path=require(_0x744e('0x7'));var sox=require(_0x744e('0x8'));var csv=require(_0x744e('0x9'));var ejs=require(_0x744e('0xa'));var fs=require('fs');var fs_extra=require(_0x744e('0xb'));var _=require(_0x744e('0xc'));var squel=require(_0x744e('0xd'));var crypto=require(_0x744e('0xe'));var jsforce=require(_0x744e('0xf'));var deskjs=require(_0x744e('0x10'));var toCsv=require(_0x744e('0x9'));var querystring=require(_0x744e('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x744e('0x12'));var hardwareService=require(_0x744e('0x13'));var logger=require(_0x744e('0x14'))(_0x744e('0x15'));var utils=require(_0x744e('0x16'));var config=require(_0x744e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x744e('0x18'))['db'];function respondWithStatusCode(_0x4c7b11,_0x3bd21e){_0x3bd21e=_0x3bd21e||0xcc;return function(_0x40cbbd){if(_0x40cbbd){return _0x4c7b11[_0x744e('0x19')](_0x3bd21e);}return _0x4c7b11[_0x744e('0x1a')](_0x3bd21e)[_0x744e('0x1b')]();};}function respondWithResult(_0x5a7462,_0x50d74f){_0x50d74f=_0x50d74f||0xc8;return function(_0x10e228){if(_0x10e228){return _0x5a7462[_0x744e('0x1a')](_0x50d74f)['json'](_0x10e228);}};}function respondWithFilteredResult(_0x49392e,_0x3873e4){return function(_0x5634fd){if(_0x5634fd){var _0x109c65=typeof _0x3873e4[_0x744e('0x1c')]==='undefined'&&typeof _0x3873e4[_0x744e('0x1d')]===_0x744e('0x1e');var _0x30238f=_0x5634fd[_0x744e('0x1f')];var _0x326553=_0x109c65?0x0:_0x3873e4[_0x744e('0x1c')];var _0x261a7f=_0x109c65?_0x5634fd[_0x744e('0x1f')]:_0x3873e4[_0x744e('0x1c')]+_0x3873e4[_0x744e('0x1d')];var _0x2a74a6;if(_0x261a7f>=_0x30238f){_0x261a7f=_0x30238f;_0x2a74a6=0xc8;}else{_0x2a74a6=0xce;}_0x49392e['status'](_0x2a74a6);return _0x49392e['set']('Content-Range',_0x326553+'-'+_0x261a7f+'/'+_0x30238f)[_0x744e('0x20')](_0x5634fd);}return null;};}function patchUpdates(_0x4a689a){return function(_0x3e7fbd){try{jsonpatch[_0x744e('0x21')](_0x3e7fbd,_0x4a689a,!![]);}catch(_0x5d61){return BPromise[_0x744e('0x22')](_0x5d61);}return _0x3e7fbd[_0x744e('0x23')]();};}function saveUpdates(_0x527f29,_0x35f6cf){return function(_0x47e427){if(_0x47e427){return _0x47e427['update'](_0x527f29)['then'](function(_0x3c52df){return _0x3c52df;});}return null;};}function removeEntity(_0x2092e1,_0x41b731){return function(_0xe1775f){if(_0xe1775f){return _0xe1775f[_0x744e('0x24')]()[_0x744e('0x25')](function(){_0x2092e1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d716a,_0x507af7){return function(_0x3f908d){if(!_0x3f908d){_0x4d716a[_0x744e('0x19')](0x194);}return _0x3f908d;};}function handleError(_0x375b5c,_0x402303){_0x402303=_0x402303||0x1f4;return function(_0x41410d){logger[_0x744e('0x26')](_0x41410d[_0x744e('0x27')]);if(_0x41410d[_0x744e('0x28')]){delete _0x41410d[_0x744e('0x28')];}_0x375b5c[_0x744e('0x1a')](_0x402303)['send'](_0x41410d);};}exports['index']=function(_0x2baeaa,_0x130f6f){var _0x4a04c1={},_0x3aa77b={},_0x9c1dd4={'count':0x0,'rows':[]};var _0x53eedb=_[_0x744e('0x29')](db['MailSubstatus'][_0x744e('0x2a')],function(_0x4f92b2){return{'name':_0x4f92b2[_0x744e('0x2b')],'type':_0x4f92b2[_0x744e('0x2c')][_0x744e('0x2d')]};});_0x3aa77b[_0x744e('0x2e')]=_[_0x744e('0x29')](_0x53eedb,_0x744e('0x28'));_0x3aa77b[_0x744e('0x2f')]=_[_0x744e('0x30')](_0x2baeaa[_0x744e('0x2f')]);_0x3aa77b[_0x744e('0x31')]=_[_0x744e('0x32')](_0x3aa77b[_0x744e('0x2e')],_0x3aa77b[_0x744e('0x2f')]);_0x4a04c1[_0x744e('0x33')]=_['intersection'](_0x3aa77b[_0x744e('0x2e')],qs[_0x744e('0x34')](_0x2baeaa['query'][_0x744e('0x34')]));_0x4a04c1[_0x744e('0x33')]=_0x4a04c1[_0x744e('0x33')]['length']?_0x4a04c1[_0x744e('0x33')]:_0x3aa77b[_0x744e('0x2e')];if(!_0x2baeaa['query'][_0x744e('0x35')](_0x744e('0x36'))){_0x4a04c1['limit']=qs['limit'](_0x2baeaa['query']['limit']);_0x4a04c1[_0x744e('0x1c')]=qs[_0x744e('0x1c')](_0x2baeaa[_0x744e('0x2f')]['offset']);}_0x4a04c1[_0x744e('0x37')]=qs['sort'](_0x2baeaa[_0x744e('0x2f')][_0x744e('0x38')]);_0x4a04c1[_0x744e('0x39')]=qs[_0x744e('0x31')](_[_0x744e('0x3a')](_0x2baeaa[_0x744e('0x2f')],_0x3aa77b[_0x744e('0x31')]),_0x53eedb);if(_0x2baeaa[_0x744e('0x2f')]['filter']){_0x4a04c1['where']=_['merge'](_0x4a04c1[_0x744e('0x39')],{'$or':_[_0x744e('0x29')](_0x53eedb,function(_0x2c30ce){if(_0x2c30ce['type']!==_0x744e('0x3b')){var _0x1a835b={};_0x1a835b[_0x2c30ce[_0x744e('0x28')]]={'$like':'%'+_0x2baeaa[_0x744e('0x2f')][_0x744e('0x3c')]+'%'};return _0x1a835b;}})});}_0x4a04c1=_[_0x744e('0x3d')]({},_0x4a04c1,_0x2baeaa['options']);var _0x12e6d1={'where':_0x4a04c1['where']};return db[_0x744e('0x3e')][_0x744e('0x1f')](_0x12e6d1)[_0x744e('0x25')](function(_0x5b8725){_0x9c1dd4[_0x744e('0x1f')]=_0x5b8725;if(_0x2baeaa[_0x744e('0x2f')][_0x744e('0x3f')]){_0x4a04c1[_0x744e('0x40')]=[{'all':!![]}];}return db[_0x744e('0x3e')][_0x744e('0x41')](_0x4a04c1);})[_0x744e('0x25')](function(_0x2e2f48){_0x9c1dd4['rows']=_0x2e2f48;return _0x9c1dd4;})[_0x744e('0x25')](respondWithFilteredResult(_0x130f6f,_0x4a04c1))[_0x744e('0x42')](handleError(_0x130f6f,null));};exports['show']=function(_0x5537bf,_0x3079f9){var _0x4ac10a={'raw':!![],'where':{'id':_0x5537bf['params']['id']}},_0x53fcd2={};_0x53fcd2[_0x744e('0x2e')]=_['keys'](db[_0x744e('0x3e')][_0x744e('0x2a')]);_0x53fcd2['query']=_['keys'](_0x5537bf['query']);_0x53fcd2['filters']=_[_0x744e('0x32')](_0x53fcd2['model'],_0x53fcd2['query']);_0x4ac10a['attributes']=_[_0x744e('0x32')](_0x53fcd2[_0x744e('0x2e')],qs[_0x744e('0x34')](_0x5537bf[_0x744e('0x2f')][_0x744e('0x34')]));_0x4ac10a[_0x744e('0x33')]=_0x4ac10a[_0x744e('0x33')][_0x744e('0x43')]?_0x4ac10a[_0x744e('0x33')]:_0x53fcd2['model'];if(_0x5537bf[_0x744e('0x2f')][_0x744e('0x3f')]){_0x4ac10a[_0x744e('0x40')]=[{'all':!![]}];}_0x4ac10a=_[_0x744e('0x3d')]({},_0x4ac10a,_0x5537bf[_0x744e('0x44')]);return db[_0x744e('0x3e')][_0x744e('0x45')](_0x4ac10a)['then'](handleEntityNotFound(_0x3079f9,null))[_0x744e('0x25')](respondWithResult(_0x3079f9,null))[_0x744e('0x42')](handleError(_0x3079f9,null));};exports[_0x744e('0x46')]=function(_0x58d02e,_0x5c1b94){return db[_0x744e('0x3e')][_0x744e('0x46')](_0x58d02e[_0x744e('0x47')],{})[_0x744e('0x25')](respondWithResult(_0x5c1b94,0xc9))[_0x744e('0x42')](handleError(_0x5c1b94,null));};exports[_0x744e('0x48')]=function(_0x56a556,_0x863948){if(_0x56a556[_0x744e('0x47')]['id']){delete _0x56a556['body']['id'];}return db[_0x744e('0x3e')][_0x744e('0x45')]({'where':{'id':_0x56a556['params']['id']}})[_0x744e('0x25')](handleEntityNotFound(_0x863948,null))[_0x744e('0x25')](saveUpdates(_0x56a556[_0x744e('0x47')],null))[_0x744e('0x25')](respondWithResult(_0x863948,null))['catch'](handleError(_0x863948,null));};exports[_0x744e('0x24')]=function(_0x29c22c,_0x51dfcf){return db[_0x744e('0x3e')]['find']({'where':{'id':_0x29c22c['params']['id']}})[_0x744e('0x25')](handleEntityNotFound(_0x51dfcf,null))[_0x744e('0x25')](removeEntity(_0x51dfcf,null))[_0x744e('0x42')](handleError(_0x51dfcf,null));};exports[_0x744e('0x49')]=function(_0x3b2b89,_0x5de7d0){return db[_0x744e('0x3e')][_0x744e('0x49')]()[_0x744e('0x25')](respondWithResult(_0x5de7d0,null))['catch'](handleError(_0x5de7d0,null));}; \ No newline at end of file +var _0x6c11=['includeAll','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','name','map','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','merge','where','VIRTUAL','filter','options','include','MailSubstatus','findAll','catch','show','params','keys'];(function(_0xf59df9,_0x7f1c0){var _0x5d4a87=function(_0x5ba52e){while(--_0x5ba52e){_0xf59df9['push'](_0xf59df9['shift']());}};_0x5d4a87(++_0x7f1c0);}(_0x6c11,0xde));var _0x16c1=function(_0x2d607b,_0x455193){_0x2d607b=_0x2d607b-0x0;var _0x5be31d=_0x6c11[_0x2d607b];return _0x5be31d;};'use strict';var emlformat=require(_0x16c1('0x0'));var rimraf=require(_0x16c1('0x1'));var zipdir=require(_0x16c1('0x2'));var jsonpatch=require(_0x16c1('0x3'));var rp=require(_0x16c1('0x4'));var moment=require('moment');var BPromise=require(_0x16c1('0x5'));var Mustache=require(_0x16c1('0x6'));var util=require(_0x16c1('0x7'));var path=require('path');var sox=require(_0x16c1('0x8'));var csv=require(_0x16c1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x16c1('0xa'));var _=require(_0x16c1('0xb'));var squel=require(_0x16c1('0xc'));var crypto=require(_0x16c1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x16c1('0xe'));var toCsv=require(_0x16c1('0x9'));var querystring=require(_0x16c1('0xf'));var Papa=require(_0x16c1('0x10'));var Redis=require(_0x16c1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x16c1('0x12'));var as=require(_0x16c1('0x13'));var hardwareService=require(_0x16c1('0x14'));var logger=require(_0x16c1('0x15'))(_0x16c1('0x16'));var utils=require(_0x16c1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x16c1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45385f,_0x47a92f){_0x47a92f=_0x47a92f||0xcc;return function(_0x5abb60){if(_0x5abb60){return _0x45385f[_0x16c1('0x19')](_0x47a92f);}return _0x45385f[_0x16c1('0x1a')](_0x47a92f)[_0x16c1('0x1b')]();};}function respondWithResult(_0x289d82,_0x3dd728){_0x3dd728=_0x3dd728||0xc8;return function(_0x6c3023){if(_0x6c3023){return _0x289d82[_0x16c1('0x1a')](_0x3dd728)['json'](_0x6c3023);}};}function respondWithFilteredResult(_0x454b69,_0x4dbbcd){return function(_0x2df909){if(_0x2df909){var _0x324753=typeof _0x4dbbcd[_0x16c1('0x1c')]===_0x16c1('0x1d')&&typeof _0x4dbbcd['limit']==='undefined';var _0xd39949=_0x2df909['count'];var _0x2dd53c=_0x324753?0x0:_0x4dbbcd[_0x16c1('0x1c')];var _0x386cc8=_0x324753?_0x2df909[_0x16c1('0x1e')]:_0x4dbbcd[_0x16c1('0x1c')]+_0x4dbbcd[_0x16c1('0x1f')];var _0x54d121;if(_0x386cc8>=_0xd39949){_0x386cc8=_0xd39949;_0x54d121=0xc8;}else{_0x54d121=0xce;}_0x454b69[_0x16c1('0x1a')](_0x54d121);return _0x454b69[_0x16c1('0x20')](_0x16c1('0x21'),_0x2dd53c+'-'+_0x386cc8+'/'+_0xd39949)[_0x16c1('0x22')](_0x2df909);}return null;};}function patchUpdates(_0x3775f8){return function(_0x186144){try{jsonpatch[_0x16c1('0x23')](_0x186144,_0x3775f8,!![]);}catch(_0x5806d9){return BPromise[_0x16c1('0x24')](_0x5806d9);}return _0x186144['save']();};}function saveUpdates(_0x118c80,_0x30c893){return function(_0x279011){if(_0x279011){return _0x279011[_0x16c1('0x25')](_0x118c80)['then'](function(_0x570576){return _0x570576;});}return null;};}function removeEntity(_0x5c8308,_0x2f4a4e){return function(_0xb69383){if(_0xb69383){return _0xb69383['destroy']()[_0x16c1('0x26')](function(){_0x5c8308[_0x16c1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5abfbf,_0x1509cb){return function(_0x3a43bb){if(!_0x3a43bb){_0x5abfbf[_0x16c1('0x19')](0x194);}return _0x3a43bb;};}function handleError(_0x3a29d6,_0x503165){_0x503165=_0x503165||0x1f4;return function(_0xfd9c2){logger['error'](_0xfd9c2['stack']);if(_0xfd9c2[_0x16c1('0x27')]){delete _0xfd9c2[_0x16c1('0x27')];}_0x3a29d6[_0x16c1('0x1a')](_0x503165)['send'](_0xfd9c2);};}exports['index']=function(_0x4aa902,_0x36f7a2){var _0xaabc39={},_0xb38e8b={},_0x4d9d63={'count':0x0,'rows':[]};var _0x3fa604=_[_0x16c1('0x28')](db['MailSubstatus']['rawAttributes'],function(_0x573253){return{'name':_0x573253[_0x16c1('0x29')],'type':_0x573253[_0x16c1('0x2a')][_0x16c1('0x2b')]};});_0xb38e8b[_0x16c1('0x2c')]=_[_0x16c1('0x28')](_0x3fa604,_0x16c1('0x27'));_0xb38e8b['query']=_['keys'](_0x4aa902[_0x16c1('0x2d')]);_0xb38e8b['filters']=_[_0x16c1('0x2e')](_0xb38e8b[_0x16c1('0x2c')],_0xb38e8b[_0x16c1('0x2d')]);_0xaabc39[_0x16c1('0x2f')]=_[_0x16c1('0x2e')](_0xb38e8b[_0x16c1('0x2c')],qs['fields'](_0x4aa902[_0x16c1('0x2d')][_0x16c1('0x30')]));_0xaabc39[_0x16c1('0x2f')]=_0xaabc39[_0x16c1('0x2f')][_0x16c1('0x31')]?_0xaabc39[_0x16c1('0x2f')]:_0xb38e8b['model'];if(!_0x4aa902[_0x16c1('0x2d')][_0x16c1('0x32')](_0x16c1('0x33'))){_0xaabc39['limit']=qs[_0x16c1('0x1f')](_0x4aa902[_0x16c1('0x2d')]['limit']);_0xaabc39[_0x16c1('0x1c')]=qs[_0x16c1('0x1c')](_0x4aa902[_0x16c1('0x2d')][_0x16c1('0x1c')]);}_0xaabc39['order']=qs[_0x16c1('0x34')](_0x4aa902['query'][_0x16c1('0x34')]);_0xaabc39['where']=qs[_0x16c1('0x35')](_['pick'](_0x4aa902['query'],_0xb38e8b['filters']),_0x3fa604);if(_0x4aa902['query']['filter']){_0xaabc39['where']=_[_0x16c1('0x36')](_0xaabc39[_0x16c1('0x37')],{'$or':_['map'](_0x3fa604,function(_0x2394c8){if(_0x2394c8[_0x16c1('0x2a')]!==_0x16c1('0x38')){var _0x4b83a7={};_0x4b83a7[_0x2394c8[_0x16c1('0x27')]]={'$like':'%'+_0x4aa902[_0x16c1('0x2d')][_0x16c1('0x39')]+'%'};return _0x4b83a7;}})});}_0xaabc39=_[_0x16c1('0x36')]({},_0xaabc39,_0x4aa902[_0x16c1('0x3a')]);var _0x155892={'where':_0xaabc39['where']};return db['MailSubstatus'][_0x16c1('0x1e')](_0x155892)['then'](function(_0x5d81d7){_0x4d9d63[_0x16c1('0x1e')]=_0x5d81d7;if(_0x4aa902[_0x16c1('0x2d')]['includeAll']){_0xaabc39[_0x16c1('0x3b')]=[{'all':!![]}];}return db[_0x16c1('0x3c')][_0x16c1('0x3d')](_0xaabc39);})[_0x16c1('0x26')](function(_0x317d71){_0x4d9d63['rows']=_0x317d71;return _0x4d9d63;})[_0x16c1('0x26')](respondWithFilteredResult(_0x36f7a2,_0xaabc39))[_0x16c1('0x3e')](handleError(_0x36f7a2,null));};exports[_0x16c1('0x3f')]=function(_0x21ac23,_0x34af2b){var _0x1b6624={'raw':!![],'where':{'id':_0x21ac23[_0x16c1('0x40')]['id']}},_0x2dcc6e={};_0x2dcc6e['model']=_[_0x16c1('0x41')](db[_0x16c1('0x3c')]['rawAttributes']);_0x2dcc6e[_0x16c1('0x2d')]=_[_0x16c1('0x41')](_0x21ac23[_0x16c1('0x2d')]);_0x2dcc6e['filters']=_[_0x16c1('0x2e')](_0x2dcc6e[_0x16c1('0x2c')],_0x2dcc6e['query']);_0x1b6624[_0x16c1('0x2f')]=_[_0x16c1('0x2e')](_0x2dcc6e['model'],qs['fields'](_0x21ac23[_0x16c1('0x2d')][_0x16c1('0x30')]));_0x1b6624[_0x16c1('0x2f')]=_0x1b6624['attributes'][_0x16c1('0x31')]?_0x1b6624[_0x16c1('0x2f')]:_0x2dcc6e[_0x16c1('0x2c')];if(_0x21ac23[_0x16c1('0x2d')][_0x16c1('0x42')]){_0x1b6624['include']=[{'all':!![]}];}_0x1b6624=_[_0x16c1('0x36')]({},_0x1b6624,_0x21ac23['options']);return db[_0x16c1('0x3c')][_0x16c1('0x43')](_0x1b6624)[_0x16c1('0x26')](handleEntityNotFound(_0x34af2b,null))[_0x16c1('0x26')](respondWithResult(_0x34af2b,null))[_0x16c1('0x3e')](handleError(_0x34af2b,null));};exports['create']=function(_0x4efe70,_0x36dc05){return db[_0x16c1('0x3c')][_0x16c1('0x44')](_0x4efe70[_0x16c1('0x45')],{})[_0x16c1('0x26')](respondWithResult(_0x36dc05,0xc9))[_0x16c1('0x3e')](handleError(_0x36dc05,null));};exports['update']=function(_0x4f3565,_0x48d62e){if(_0x4f3565['body']['id']){delete _0x4f3565[_0x16c1('0x45')]['id'];}return db[_0x16c1('0x3c')][_0x16c1('0x43')]({'where':{'id':_0x4f3565[_0x16c1('0x40')]['id']}})[_0x16c1('0x26')](handleEntityNotFound(_0x48d62e,null))[_0x16c1('0x26')](saveUpdates(_0x4f3565[_0x16c1('0x45')],null))['then'](respondWithResult(_0x48d62e,null))[_0x16c1('0x3e')](handleError(_0x48d62e,null));};exports[_0x16c1('0x46')]=function(_0xa92048,_0xd09fa3){return db['MailSubstatus'][_0x16c1('0x43')]({'where':{'id':_0xa92048['params']['id']}})[_0x16c1('0x26')](handleEntityNotFound(_0xd09fa3,null))['then'](removeEntity(_0xd09fa3,null))['catch'](handleError(_0xd09fa3,null));};exports[_0x16c1('0x47')]=function(_0x2d63ad,_0x52ed38){return db[_0x16c1('0x3c')][_0x16c1('0x47')]()['then'](respondWithResult(_0x52ed38,null))[_0x16c1('0x3e')](handleError(_0x52ed38,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 3157dd6..b7d2e70 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe1c8=['hook','exports','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x5c18ef,_0x32deb8){var _0x4fad7c=function(_0x3827b0){while(--_0x3827b0){_0x5c18ef['push'](_0x5c18ef['shift']());}};_0x4fad7c(++_0x32deb8);}(_0xe1c8,0x6a));var _0x8e1c=function(_0x5afdaa,_0x2847f5){_0x5afdaa=_0x5afdaa-0x0;var _0x49827f=_0xe1c8[_0x5afdaa];return _0x49827f;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x8e1c('0x0'))['db'][_0x8e1c('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x8e1c('0x2')](0x0);var events={'afterUpdate':_0x8e1c('0x3')};function emitEvent(_0x50606c){return function(_0x17d60d,_0x2bff2b,_0x4bf2b0){MailSubstatusEvents['emit'](_0x50606c+':'+_0x17d60d['id'],_0x17d60d);MailSubstatusEvents[_0x8e1c('0x4')](_0x50606c,_0x17d60d);_0x4bf2b0(null);};}for(var e in events){if(events[_0x8e1c('0x5')](e)){var event=events[e];MailSubstatus[_0x8e1c('0x6')](e,emitEvent(event));}}module[_0x8e1c('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0x3abd=['hook','exports','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x4df3f1,_0x5c29fb){var _0x19942a=function(_0x1d9b1d){while(--_0x1d9b1d){_0x4df3f1['push'](_0x4df3f1['shift']());}};_0x19942a(++_0x5c29fb);}(_0x3abd,0xb1));var _0xd3ab=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x3abd[_0x5f09c5];return _0x426ad9;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0xd3ab('0x0'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xd3ab('0x1')](0x0);var events={'afterUpdate':_0xd3ab('0x2')};function emitEvent(_0x4dce86){return function(_0x109a64,_0x3c68cb,_0x156065){MailSubstatusEvents[_0xd3ab('0x3')](_0x4dce86+':'+_0x109a64['id'],_0x109a64);MailSubstatusEvents[_0xd3ab('0x3')](_0x4dce86,_0x109a64);_0x156065(null);};}for(var e in events){if(events[_0xd3ab('0x4')](e)){var event=events[e];MailSubstatus[_0xd3ab('0x5')](e,emitEvent(event));}}module[_0xd3ab('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 5d5f015..be06773 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 _0x1c76=['exports','models','define','mail_substatuses','Condition','update','name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes'];(function(_0x17c96f,_0x5ce6f4){var _0xd3774b=function(_0x4e4c45){while(--_0x4e4c45){_0x17c96f['push'](_0x17c96f['shift']());}};_0xd3774b(++_0x5ce6f4);}(_0x1c76,0x107));var _0x61c7=function(_0x36bf53,_0x393a65){_0x36bf53=_0x36bf53-0x0;var _0x1cf535=_0x1c76[_0x36bf53];return _0x1cf535;};'use strict';var attributes=require(_0x61c7('0x0'));module[_0x61c7('0x1')]=function(_0x3fe3be){var _0x2f3620=_0x3fe3be[_0x61c7('0x2')];return _0x3fe3be[_0x61c7('0x3')]('MailSubstatus',attributes,{'tableName':_0x61c7('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0xbdbee5,_0x6b87b7,_0x4de42a){return _0x2f3620[_0x61c7('0x5')][_0x61c7('0x6')]({'value':_0xbdbee5[_0x61c7('0x7')]},{'where':{'field':_0x61c7('0x8'),'value':_0xbdbee5[_0x61c7('0x9')][_0x61c7('0x7')]}})[_0x61c7('0xa')](function(){_0x4de42a();})[_0x61c7('0xb')](function(_0x407437){_0x4de42a(_0x407437);});}}});}; \ No newline at end of file +var _0x0764=['models','MailSubstatus','mail_substatuses','update','mailSubstatus','_previousDataValues','name','then','catch','./mailSubstatus.attributes','exports'];(function(_0x961254,_0x297a88){var _0x88b9c8=function(_0x3098d5){while(--_0x3098d5){_0x961254['push'](_0x961254['shift']());}};_0x88b9c8(++_0x297a88);}(_0x0764,0x174));var _0x4076=function(_0x1bddad,_0x15ba8e){_0x1bddad=_0x1bddad-0x0;var _0x4e3560=_0x0764[_0x1bddad];return _0x4e3560;};'use strict';var attributes=require(_0x4076('0x0'));module[_0x4076('0x1')]=function(_0xc6f21a){var _0x37263c=_0xc6f21a[_0x4076('0x2')];return _0xc6f21a['define'](_0x4076('0x3'),attributes,{'tableName':_0x4076('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2ef59e,_0x39140b,_0x3d6b31){return _0x37263c['Condition'][_0x4076('0x5')]({'value':_0x2ef59e['name']},{'where':{'field':_0x4076('0x6'),'value':_0x2ef59e[_0x4076('0x7')][_0x4076('0x8')]}})[_0x4076('0x9')](function(){_0x3d6b31();})[_0x4076('0xa')](function(_0x5a8c85){_0x3d6b31(_0x5a8c85);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index e51d8af..f9e366d 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 _0x5cfa=['http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client'];(function(_0x37715d,_0xdb0d52){var _0x2caac8=function(_0x4a18e9){while(--_0x4a18e9){_0x37715d['push'](_0x37715d['shift']());}};_0x2caac8(++_0xdb0d52);}(_0x5cfa,0x186));var _0xa5cf=function(_0x1da807,_0x5c1789){_0x1da807=_0x1da807-0x0;var _0x85ba90=_0x5cfa[_0x1da807];return _0x85ba90;};'use strict';var _=require(_0xa5cf('0x0'));var util=require('util');var moment=require(_0xa5cf('0x1'));var BPromise=require(_0xa5cf('0x2'));var rs=require(_0xa5cf('0x3'));var fs=require('fs');var Redis=require(_0xa5cf('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa5cf('0x5'))(_0xa5cf('0x6'));var config=require('../../config/environment');var jayson=require(_0xa5cf('0x7'));var client=jayson[_0xa5cf('0x8')][_0xa5cf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x38a156,_0x1b10cd,_0x3f7e87){return new BPromise(function(_0x141de2,_0x262f1f){return client[_0xa5cf('0xa')](_0x38a156,_0x3f7e87)['then'](function(_0x861b13){logger[_0xa5cf('0xb')](_0xa5cf('0xc'),_0x1b10cd,_0xa5cf('0xd'));logger[_0xa5cf('0xe')](_0xa5cf('0xf'),_0x1b10cd,'request\x20sent',JSON['stringify'](_0x861b13));if(_0x861b13['error']){if(_0x861b13[_0xa5cf('0x10')][_0xa5cf('0x11')]===0x1f4){logger['error'](_0xa5cf('0xc'),_0x1b10cd,_0x861b13[_0xa5cf('0x10')]['message']);return _0x262f1f(_0x861b13['error'][_0xa5cf('0x12')]);}logger[_0xa5cf('0x10')](_0xa5cf('0xc'),_0x1b10cd,_0x861b13['error'][_0xa5cf('0x12')]);return _0x141de2(_0x861b13['error']['message']);}else{logger[_0xa5cf('0xb')](_0xa5cf('0xc'),_0x1b10cd,'request\x20sent');_0x141de2(_0x861b13[_0xa5cf('0x13')][_0xa5cf('0x12')]);}})[_0xa5cf('0x14')](function(_0x160070){logger[_0xa5cf('0x10')](_0xa5cf('0xc'),_0x1b10cd,_0x160070);_0x262f1f(_0x160070);});});} \ No newline at end of file +var _0x6b6a=['client','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1158d5,_0x4e7ee8){var _0x3e9d61=function(_0x182cc7){while(--_0x182cc7){_0x1158d5['push'](_0x1158d5['shift']());}};_0x3e9d61(++_0x4e7ee8);}(_0x6b6a,0x1ee));var _0xa6b6=function(_0x53d0f2,_0x461fff){_0x53d0f2=_0x53d0f2-0x0;var _0x4039fe=_0x6b6a[_0x53d0f2];return _0x4039fe;};'use strict';var _=require('lodash');var util=require(_0xa6b6('0x0'));var moment=require('moment');var BPromise=require(_0xa6b6('0x1'));var rs=require(_0xa6b6('0x2'));var fs=require('fs');var Redis=require(_0xa6b6('0x3'));var db=require(_0xa6b6('0x4'))['db'];var utils=require(_0xa6b6('0x5'));var logger=require(_0xa6b6('0x6'))(_0xa6b6('0x7'));var config=require(_0xa6b6('0x8'));var jayson=require(_0xa6b6('0x9'));var client=jayson[_0xa6b6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7579ab,_0x3fbbe0,_0x436a61){return new BPromise(function(_0x26497c,_0x78056){return client[_0xa6b6('0xb')](_0x7579ab,_0x436a61)[_0xa6b6('0xc')](function(_0x4cddb3){logger[_0xa6b6('0xd')](_0xa6b6('0xe'),_0x3fbbe0,_0xa6b6('0xf'));logger[_0xa6b6('0x10')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x3fbbe0,_0xa6b6('0xf'),JSON['stringify'](_0x4cddb3));if(_0x4cddb3[_0xa6b6('0x11')]){if(_0x4cddb3['error'][_0xa6b6('0x12')]===0x1f4){logger[_0xa6b6('0x11')](_0xa6b6('0xe'),_0x3fbbe0,_0x4cddb3[_0xa6b6('0x11')]['message']);return _0x78056(_0x4cddb3['error'][_0xa6b6('0x13')]);}logger[_0xa6b6('0x11')](_0xa6b6('0xe'),_0x3fbbe0,_0x4cddb3['error']['message']);return _0x26497c(_0x4cddb3[_0xa6b6('0x11')][_0xa6b6('0x13')]);}else{logger[_0xa6b6('0xd')](_0xa6b6('0xe'),_0x3fbbe0,_0xa6b6('0xf'));_0x26497c(_0x4cddb3[_0xa6b6('0x14')][_0xa6b6('0x13')]);}})['catch'](function(_0x4fd02a){logger[_0xa6b6('0x11')](_0xa6b6('0xe'),_0x3fbbe0,_0x4fd02a);_0x78056(_0x4fd02a);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 420b522..18ee9c3 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 _0x91ca=['put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create'];(function(_0x344e38,_0x469799){var _0x473b94=function(_0x49a6a7){while(--_0x49a6a7){_0x344e38['push'](_0x344e38['shift']());}};_0x473b94(++_0x469799);}(_0x91ca,0x12a));var _0xa91c=function(_0x3a5b1f,_0x57ee12){_0x3a5b1f=_0x3a5b1f-0x0;var _0x2e7fe8=_0x91ca[_0x3a5b1f];return _0x2e7fe8;};'use strict';var multer=require('multer');var util=require(_0xa91c('0x0'));var path=require(_0xa91c('0x1'));var timeout=require(_0xa91c('0x2'));var express=require(_0xa91c('0x3'));var router=express[_0xa91c('0x4')]();var fs_extra=require(_0xa91c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa91c('0x6'));var config=require(_0xa91c('0x7'));var controller=require(_0xa91c('0x8'));router[_0xa91c('0x9')]('/',auth['isAuthenticated'](),controller[_0xa91c('0xa')]);router[_0xa91c('0x9')](_0xa91c('0xb'),auth[_0xa91c('0xc')](),controller[_0xa91c('0xd')]);router[_0xa91c('0x9')](_0xa91c('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xa91c('0xf')]('/',auth['isAuthenticated'](),controller[_0xa91c('0x10')]);router[_0xa91c('0x11')](_0xa91c('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xa91c('0x12')](_0xa91c('0xe'),auth[_0xa91c('0xc')](),controller[_0xa91c('0x13')]);module[_0xa91c('0x14')]=router; \ No newline at end of file +var _0x8fc1=['get','index','/describe','isAuthenticated','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8fc1,0x74));var _0x18fc=function(_0x11bf0b,_0x24abfc){_0x11bf0b=_0x11bf0b-0x0;var _0x453aac=_0x8fc1[_0x11bf0b];return _0x453aac;};'use strict';var multer=require(_0x18fc('0x0'));var util=require(_0x18fc('0x1'));var path=require(_0x18fc('0x2'));var timeout=require(_0x18fc('0x3'));var express=require(_0x18fc('0x4'));var router=express[_0x18fc('0x5')]();var fs_extra=require(_0x18fc('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x18fc('0x7'));var config=require(_0x18fc('0x8'));var controller=require(_0x18fc('0x9'));router[_0x18fc('0xa')]('/',auth['isAuthenticated'](),controller[_0x18fc('0xb')]);router[_0x18fc('0xa')](_0x18fc('0xc'),auth[_0x18fc('0xd')](),controller['describe']);router[_0x18fc('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x18fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x18fc('0xf')]);router[_0x18fc('0x10')](_0x18fc('0x11'),auth[_0x18fc('0xd')](),controller['update']);router[_0x18fc('0x12')](_0x18fc('0x11'),auth['isAuthenticated'](),controller[_0x18fc('0x13')]);module[_0x18fc('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index fc5a1b1..4aae306 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x3e25c1,_0x1d15f9){var _0x52e7f2=function(_0x597a5a){while(--_0x597a5a){_0x3e25c1['push'](_0x3e25c1['shift']());}};_0x52e7f2(++_0x1d15f9);}(_0x9bde,0xe1));var _0xe9bd=function(_0x58633c,_0x3d0ad0){_0x58633c=_0x58633c-0x0;var _0x218607=_0x9bde[_0x58633c];return _0x218607;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x008c,0x188));var _0xc008=function(_0x2e092e,_0x1bbef3){_0x2e092e=_0x2e092e-0x0;var _0x4d4f52=_0x008c[_0x2e092e];return _0x4d4f52;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 08e19e4..33060c0 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 _0x1a0d=['options','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','util','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','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','send','index','map','MailTransferReport','rawAttributes','fieldName','key','name','query','keys','filters','intersection','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','includeAll','findAll','rows','catch','params','fields'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x1a0d,0xe9));var _0xd1a0=function(_0x9d6959,_0x307e24){_0x9d6959=_0x9d6959-0x0;var _0x28e1a3=_0x1a0d[_0x9d6959];return _0x28e1a3;};'use strict';var emlformat=require(_0xd1a0('0x0'));var rimraf=require(_0xd1a0('0x1'));var zipdir=require(_0xd1a0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd1a0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd1a0('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xd1a0('0x5'));var ejs=require(_0xd1a0('0x6'));var fs=require('fs');var fs_extra=require(_0xd1a0('0x7'));var _=require(_0xd1a0('0x8'));var squel=require(_0xd1a0('0x9'));var crypto=require(_0xd1a0('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd1a0('0xb'));var toCsv=require('to-csv');var querystring=require(_0xd1a0('0xc'));var Papa=require(_0xd1a0('0xd'));var Redis=require(_0xd1a0('0xe'));var authService=require(_0xd1a0('0xf'));var qs=require(_0xd1a0('0x10'));var as=require(_0xd1a0('0x11'));var hardwareService=require(_0xd1a0('0x12'));var logger=require(_0xd1a0('0x13'))(_0xd1a0('0x14'));var utils=require(_0xd1a0('0x15'));var config=require(_0xd1a0('0x16'));var licenseUtil=require(_0xd1a0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fa0a0,_0xfc43e4){_0xfc43e4=_0xfc43e4||0xcc;return function(_0x2cde96){if(_0x2cde96){return _0x2fa0a0['sendStatus'](_0xfc43e4);}return _0x2fa0a0['status'](_0xfc43e4)['end']();};}function respondWithResult(_0xcf48bc,_0x8883a9){_0x8883a9=_0x8883a9||0xc8;return function(_0x5eecba){if(_0x5eecba){return _0xcf48bc[_0xd1a0('0x18')](_0x8883a9)[_0xd1a0('0x19')](_0x5eecba);}};}function respondWithFilteredResult(_0x71940a,_0x5e7165){return function(_0x3561d6){if(_0x3561d6){var _0xe7f495=typeof _0x5e7165[_0xd1a0('0x1a')]==='undefined'&&typeof _0x5e7165[_0xd1a0('0x1b')]===_0xd1a0('0x1c');var _0x492e8c=_0x3561d6[_0xd1a0('0x1d')];var _0x7cc3bc=_0xe7f495?0x0:_0x5e7165['offset'];var _0x573ac0=_0xe7f495?_0x3561d6[_0xd1a0('0x1d')]:_0x5e7165['offset']+_0x5e7165[_0xd1a0('0x1b')];var _0x49d2cf;if(_0x573ac0>=_0x492e8c){_0x573ac0=_0x492e8c;_0x49d2cf=0xc8;}else{_0x49d2cf=0xce;}_0x71940a[_0xd1a0('0x18')](_0x49d2cf);return _0x71940a[_0xd1a0('0x1e')](_0xd1a0('0x1f'),_0x7cc3bc+'-'+_0x573ac0+'/'+_0x492e8c)[_0xd1a0('0x19')](_0x3561d6);}return null;};}function patchUpdates(_0x2db26d){return function(_0x10f716){try{jsonpatch[_0xd1a0('0x20')](_0x10f716,_0x2db26d,!![]);}catch(_0x315f98){return BPromise[_0xd1a0('0x21')](_0x315f98);}return _0x10f716[_0xd1a0('0x22')]();};}function saveUpdates(_0x5ae3b9,_0x43b0ac){return function(_0xb2935c){if(_0xb2935c){return _0xb2935c[_0xd1a0('0x23')](_0x5ae3b9)[_0xd1a0('0x24')](function(_0x14b987){return _0x14b987;});}return null;};}function removeEntity(_0x28699b,_0x4cf00a){return function(_0x3cbd94){if(_0x3cbd94){return _0x3cbd94[_0xd1a0('0x25')]()[_0xd1a0('0x24')](function(){_0x28699b['status'](0xcc)[_0xd1a0('0x26')]();});}};}function handleEntityNotFound(_0x157644,_0x1143de){return function(_0x93c1e0){if(!_0x93c1e0){_0x157644[_0xd1a0('0x27')](0x194);}return _0x93c1e0;};}function handleError(_0x4fc04e,_0x37d70a){_0x37d70a=_0x37d70a||0x1f4;return function(_0x19877e){logger['error'](_0x19877e[_0xd1a0('0x28')]);if(_0x19877e['name']){delete _0x19877e['name'];}_0x4fc04e[_0xd1a0('0x18')](_0x37d70a)[_0xd1a0('0x29')](_0x19877e);};}exports[_0xd1a0('0x2a')]=function(_0x377f7c,_0x4eb41d){var _0x3dcbb6={},_0x43ad8c={},_0x37b7a7={'count':0x0,'rows':[]};var _0xe62a97=_[_0xd1a0('0x2b')](db[_0xd1a0('0x2c')][_0xd1a0('0x2d')],function(_0x304cd9){return{'name':_0x304cd9[_0xd1a0('0x2e')],'type':_0x304cd9['type'][_0xd1a0('0x2f')]};});_0x43ad8c['model']=_['map'](_0xe62a97,_0xd1a0('0x30'));_0x43ad8c[_0xd1a0('0x31')]=_[_0xd1a0('0x32')](_0x377f7c[_0xd1a0('0x31')]);_0x43ad8c[_0xd1a0('0x33')]=_[_0xd1a0('0x34')](_0x43ad8c['model'],_0x43ad8c[_0xd1a0('0x31')]);_0x3dcbb6[_0xd1a0('0x35')]=_['intersection'](_0x43ad8c['model'],qs['fields'](_0x377f7c[_0xd1a0('0x31')]['fields']));_0x3dcbb6[_0xd1a0('0x35')]=_0x3dcbb6[_0xd1a0('0x35')][_0xd1a0('0x36')]?_0x3dcbb6[_0xd1a0('0x35')]:_0x43ad8c[_0xd1a0('0x37')];if(!_0x377f7c[_0xd1a0('0x31')][_0xd1a0('0x38')](_0xd1a0('0x39'))){_0x3dcbb6[_0xd1a0('0x1b')]=qs[_0xd1a0('0x1b')](_0x377f7c[_0xd1a0('0x31')]['limit']);_0x3dcbb6[_0xd1a0('0x1a')]=qs['offset'](_0x377f7c[_0xd1a0('0x31')][_0xd1a0('0x1a')]);}_0x3dcbb6[_0xd1a0('0x3a')]=qs[_0xd1a0('0x3b')](_0x377f7c[_0xd1a0('0x31')][_0xd1a0('0x3b')]);_0x3dcbb6[_0xd1a0('0x3c')]=qs[_0xd1a0('0x33')](_['pick'](_0x377f7c[_0xd1a0('0x31')],_0x43ad8c[_0xd1a0('0x33')]),_0xe62a97);if(_0x377f7c[_0xd1a0('0x31')]['filter']){_0x3dcbb6[_0xd1a0('0x3c')]=_[_0xd1a0('0x3d')](_0x3dcbb6[_0xd1a0('0x3c')],{'$or':_[_0xd1a0('0x2b')](_0xe62a97,function(_0x1b0edd){if(_0x1b0edd[_0xd1a0('0x3e')]!==_0xd1a0('0x3f')){var _0x762450={};_0x762450[_0x1b0edd[_0xd1a0('0x30')]]={'$like':'%'+_0x377f7c[_0xd1a0('0x31')][_0xd1a0('0x40')]+'%'};return _0x762450;}})});}_0x3dcbb6=_[_0xd1a0('0x3d')]({},_0x3dcbb6,_0x377f7c['options']);var _0xea88e5={'where':_0x3dcbb6[_0xd1a0('0x3c')]};return db['MailTransferReport']['count'](_0xea88e5)[_0xd1a0('0x24')](function(_0x4118a8){_0x37b7a7[_0xd1a0('0x1d')]=_0x4118a8;if(_0x377f7c['query'][_0xd1a0('0x41')]){_0x3dcbb6['include']=[{'all':!![]}];}return db['MailTransferReport'][_0xd1a0('0x42')](_0x3dcbb6);})['then'](function(_0x5dfd70){_0x37b7a7[_0xd1a0('0x43')]=_0x5dfd70;return _0x37b7a7;})[_0xd1a0('0x24')](respondWithFilteredResult(_0x4eb41d,_0x3dcbb6))[_0xd1a0('0x44')](handleError(_0x4eb41d,null));};exports['show']=function(_0x3bf1df,_0xa57a1d){var _0xa0564d={'raw':!![],'where':{'id':_0x3bf1df[_0xd1a0('0x45')]['id']}},_0x2d4f13={};_0x2d4f13[_0xd1a0('0x37')]=_[_0xd1a0('0x32')](db[_0xd1a0('0x2c')][_0xd1a0('0x2d')]);_0x2d4f13['query']=_[_0xd1a0('0x32')](_0x3bf1df[_0xd1a0('0x31')]);_0x2d4f13[_0xd1a0('0x33')]=_[_0xd1a0('0x34')](_0x2d4f13['model'],_0x2d4f13[_0xd1a0('0x31')]);_0xa0564d['attributes']=_[_0xd1a0('0x34')](_0x2d4f13[_0xd1a0('0x37')],qs[_0xd1a0('0x46')](_0x3bf1df[_0xd1a0('0x31')]['fields']));_0xa0564d[_0xd1a0('0x35')]=_0xa0564d['attributes'][_0xd1a0('0x36')]?_0xa0564d[_0xd1a0('0x35')]:_0x2d4f13[_0xd1a0('0x37')];if(_0x3bf1df[_0xd1a0('0x31')]['includeAll']){_0xa0564d['include']=[{'all':!![]}];}_0xa0564d=_['merge']({},_0xa0564d,_0x3bf1df[_0xd1a0('0x47')]);return db[_0xd1a0('0x2c')]['find'](_0xa0564d)[_0xd1a0('0x24')](handleEntityNotFound(_0xa57a1d,null))[_0xd1a0('0x24')](respondWithResult(_0xa57a1d,null))['catch'](handleError(_0xa57a1d,null));};exports[_0xd1a0('0x48')]=function(_0xebf82e,_0x430b59){return db['MailTransferReport'][_0xd1a0('0x48')](_0xebf82e[_0xd1a0('0x49')],{})['then'](respondWithResult(_0x430b59,0xc9))[_0xd1a0('0x44')](handleError(_0x430b59,null));};exports[_0xd1a0('0x23')]=function(_0x4ef24d,_0x121505){if(_0x4ef24d['body']['id']){delete _0x4ef24d[_0xd1a0('0x49')]['id'];}return db[_0xd1a0('0x2c')][_0xd1a0('0x4a')]({'where':{'id':_0x4ef24d['params']['id']}})[_0xd1a0('0x24')](handleEntityNotFound(_0x121505,null))[_0xd1a0('0x24')](saveUpdates(_0x4ef24d[_0xd1a0('0x49')],null))[_0xd1a0('0x24')](respondWithResult(_0x121505,null))['catch'](handleError(_0x121505,null));};exports[_0xd1a0('0x25')]=function(_0x31974a,_0x15269c){return db['MailTransferReport'][_0xd1a0('0x4a')]({'where':{'id':_0x31974a['params']['id']}})[_0xd1a0('0x24')](handleEntityNotFound(_0x15269c,null))[_0xd1a0('0x24')](removeEntity(_0x15269c,null))['catch'](handleError(_0x15269c,null));};exports['describe']=function(_0x42a6e0,_0x20e8bc){return db['MailTransferReport'][_0xd1a0('0x4b')]()['then'](respondWithResult(_0x20e8bc,null))[_0xd1a0('0x44')](handleError(_0x20e8bc,null));}; \ No newline at end of file +var _0xe361=['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','undefined','limit','count','set','Content-Range','reject','update','then','destroy','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','pick','filter','where','merge','VIRTUAL','options','MailTransferReport','includeAll','findAll','rows','catch','params','include','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x36c13e,_0xe8926a){var _0x59c52a=function(_0x4f7874){while(--_0x4f7874){_0x36c13e['push'](_0x36c13e['shift']());}};_0x59c52a(++_0xe8926a);}(_0xe361,0x90));var _0x1e36=function(_0x35e75a,_0x5ed225){_0x35e75a=_0x35e75a-0x0;var _0xb23c7f=_0xe361[_0x35e75a];return _0xb23c7f;};'use strict';var emlformat=require(_0x1e36('0x0'));var rimraf=require(_0x1e36('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e36('0x2'));var rp=require(_0x1e36('0x3'));var moment=require(_0x1e36('0x4'));var BPromise=require(_0x1e36('0x5'));var Mustache=require(_0x1e36('0x6'));var util=require(_0x1e36('0x7'));var path=require(_0x1e36('0x8'));var sox=require(_0x1e36('0x9'));var csv=require(_0x1e36('0xa'));var ejs=require(_0x1e36('0xb'));var fs=require('fs');var fs_extra=require(_0x1e36('0xc'));var _=require(_0x1e36('0xd'));var squel=require(_0x1e36('0xe'));var crypto=require(_0x1e36('0xf'));var jsforce=require(_0x1e36('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x1e36('0xa'));var querystring=require(_0x1e36('0x11'));var Papa=require(_0x1e36('0x12'));var Redis=require(_0x1e36('0x13'));var authService=require(_0x1e36('0x14'));var qs=require(_0x1e36('0x15'));var as=require(_0x1e36('0x16'));var hardwareService=require(_0x1e36('0x17'));var logger=require(_0x1e36('0x18'))(_0x1e36('0x19'));var utils=require(_0x1e36('0x1a'));var config=require(_0x1e36('0x1b'));var licenseUtil=require(_0x1e36('0x1c'));var db=require(_0x1e36('0x1d'))['db'];function respondWithStatusCode(_0x3daa96,_0x4d16f4){_0x4d16f4=_0x4d16f4||0xcc;return function(_0x57cdec){if(_0x57cdec){return _0x3daa96[_0x1e36('0x1e')](_0x4d16f4);}return _0x3daa96[_0x1e36('0x1f')](_0x4d16f4)[_0x1e36('0x20')]();};}function respondWithResult(_0x2e8b95,_0x3db2c9){_0x3db2c9=_0x3db2c9||0xc8;return function(_0x22ea38){if(_0x22ea38){return _0x2e8b95[_0x1e36('0x1f')](_0x3db2c9)[_0x1e36('0x21')](_0x22ea38);}};}function respondWithFilteredResult(_0x178e65,_0x54219a){return function(_0x1da1b4){if(_0x1da1b4){var _0x1ba6c3=typeof _0x54219a[_0x1e36('0x22')]===_0x1e36('0x23')&&typeof _0x54219a[_0x1e36('0x24')]===_0x1e36('0x23');var _0x15f93a=_0x1da1b4['count'];var _0x301edb=_0x1ba6c3?0x0:_0x54219a[_0x1e36('0x22')];var _0xfae5fb=_0x1ba6c3?_0x1da1b4[_0x1e36('0x25')]:_0x54219a[_0x1e36('0x22')]+_0x54219a[_0x1e36('0x24')];var _0x1eef1b;if(_0xfae5fb>=_0x15f93a){_0xfae5fb=_0x15f93a;_0x1eef1b=0xc8;}else{_0x1eef1b=0xce;}_0x178e65[_0x1e36('0x1f')](_0x1eef1b);return _0x178e65[_0x1e36('0x26')](_0x1e36('0x27'),_0x301edb+'-'+_0xfae5fb+'/'+_0x15f93a)['json'](_0x1da1b4);}return null;};}function patchUpdates(_0x58505a){return function(_0x502c04){try{jsonpatch['apply'](_0x502c04,_0x58505a,!![]);}catch(_0x480ec8){return BPromise[_0x1e36('0x28')](_0x480ec8);}return _0x502c04['save']();};}function saveUpdates(_0x33b0a3,_0xad65d8){return function(_0x320f71){if(_0x320f71){return _0x320f71[_0x1e36('0x29')](_0x33b0a3)[_0x1e36('0x2a')](function(_0x16c84c){return _0x16c84c;});}return null;};}function removeEntity(_0x161c9e,_0x4e9e73){return function(_0xbcf6a1){if(_0xbcf6a1){return _0xbcf6a1[_0x1e36('0x2b')]()[_0x1e36('0x2a')](function(){_0x161c9e[_0x1e36('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26daf0,_0x352bc4){return function(_0x28dbff){if(!_0x28dbff){_0x26daf0['sendStatus'](0x194);}return _0x28dbff;};}function handleError(_0x55aa0f,_0x3ed699){_0x3ed699=_0x3ed699||0x1f4;return function(_0x1d4bb5){logger['error'](_0x1d4bb5[_0x1e36('0x2c')]);if(_0x1d4bb5[_0x1e36('0x2d')]){delete _0x1d4bb5[_0x1e36('0x2d')];}_0x55aa0f['status'](_0x3ed699)[_0x1e36('0x2e')](_0x1d4bb5);};}exports[_0x1e36('0x2f')]=function(_0x1fd008,_0x113a09){var _0x1b20b0={},_0x19375f={},_0x2dd17b={'count':0x0,'rows':[]};var _0x3d3473=_['map'](db['MailTransferReport'][_0x1e36('0x30')],function(_0x193b01){return{'name':_0x193b01['fieldName'],'type':_0x193b01[_0x1e36('0x31')][_0x1e36('0x32')]};});_0x19375f[_0x1e36('0x33')]=_[_0x1e36('0x34')](_0x3d3473,_0x1e36('0x2d'));_0x19375f[_0x1e36('0x35')]=_[_0x1e36('0x36')](_0x1fd008[_0x1e36('0x35')]);_0x19375f[_0x1e36('0x37')]=_['intersection'](_0x19375f[_0x1e36('0x33')],_0x19375f[_0x1e36('0x35')]);_0x1b20b0[_0x1e36('0x38')]=_[_0x1e36('0x39')](_0x19375f['model'],qs['fields'](_0x1fd008[_0x1e36('0x35')][_0x1e36('0x3a')]));_0x1b20b0['attributes']=_0x1b20b0['attributes'][_0x1e36('0x3b')]?_0x1b20b0['attributes']:_0x19375f[_0x1e36('0x33')];if(!_0x1fd008['query']['hasOwnProperty'](_0x1e36('0x3c'))){_0x1b20b0['limit']=qs[_0x1e36('0x24')](_0x1fd008['query'][_0x1e36('0x24')]);_0x1b20b0[_0x1e36('0x22')]=qs[_0x1e36('0x22')](_0x1fd008[_0x1e36('0x35')][_0x1e36('0x22')]);}_0x1b20b0['order']=qs['sort'](_0x1fd008[_0x1e36('0x35')]['sort']);_0x1b20b0['where']=qs[_0x1e36('0x37')](_[_0x1e36('0x3d')](_0x1fd008[_0x1e36('0x35')],_0x19375f[_0x1e36('0x37')]),_0x3d3473);if(_0x1fd008[_0x1e36('0x35')][_0x1e36('0x3e')]){_0x1b20b0[_0x1e36('0x3f')]=_[_0x1e36('0x40')](_0x1b20b0[_0x1e36('0x3f')],{'$or':_[_0x1e36('0x34')](_0x3d3473,function(_0x52aef4){if(_0x52aef4[_0x1e36('0x31')]!==_0x1e36('0x41')){var _0x1a9546={};_0x1a9546[_0x52aef4[_0x1e36('0x2d')]]={'$like':'%'+_0x1fd008['query'][_0x1e36('0x3e')]+'%'};return _0x1a9546;}})});}_0x1b20b0=_[_0x1e36('0x40')]({},_0x1b20b0,_0x1fd008[_0x1e36('0x42')]);var _0x172b7f={'where':_0x1b20b0['where']};return db[_0x1e36('0x43')][_0x1e36('0x25')](_0x172b7f)[_0x1e36('0x2a')](function(_0x421de1){_0x2dd17b[_0x1e36('0x25')]=_0x421de1;if(_0x1fd008[_0x1e36('0x35')][_0x1e36('0x44')]){_0x1b20b0['include']=[{'all':!![]}];}return db[_0x1e36('0x43')][_0x1e36('0x45')](_0x1b20b0);})[_0x1e36('0x2a')](function(_0x3c13c2){_0x2dd17b[_0x1e36('0x46')]=_0x3c13c2;return _0x2dd17b;})[_0x1e36('0x2a')](respondWithFilteredResult(_0x113a09,_0x1b20b0))[_0x1e36('0x47')](handleError(_0x113a09,null));};exports['show']=function(_0xdb31e,_0x15622b){var _0x170fbd={'raw':!![],'where':{'id':_0xdb31e[_0x1e36('0x48')]['id']}},_0x5c209a={};_0x5c209a[_0x1e36('0x33')]=_['keys'](db['MailTransferReport'][_0x1e36('0x30')]);_0x5c209a[_0x1e36('0x35')]=_[_0x1e36('0x36')](_0xdb31e[_0x1e36('0x35')]);_0x5c209a[_0x1e36('0x37')]=_[_0x1e36('0x39')](_0x5c209a[_0x1e36('0x33')],_0x5c209a[_0x1e36('0x35')]);_0x170fbd['attributes']=_[_0x1e36('0x39')](_0x5c209a[_0x1e36('0x33')],qs[_0x1e36('0x3a')](_0xdb31e['query'][_0x1e36('0x3a')]));_0x170fbd[_0x1e36('0x38')]=_0x170fbd[_0x1e36('0x38')][_0x1e36('0x3b')]?_0x170fbd[_0x1e36('0x38')]:_0x5c209a[_0x1e36('0x33')];if(_0xdb31e[_0x1e36('0x35')]['includeAll']){_0x170fbd[_0x1e36('0x49')]=[{'all':!![]}];}_0x170fbd=_[_0x1e36('0x40')]({},_0x170fbd,_0xdb31e[_0x1e36('0x42')]);return db['MailTransferReport'][_0x1e36('0x4a')](_0x170fbd)[_0x1e36('0x2a')](handleEntityNotFound(_0x15622b,null))['then'](respondWithResult(_0x15622b,null))[_0x1e36('0x47')](handleError(_0x15622b,null));};exports[_0x1e36('0x4b')]=function(_0x235ced,_0x3ddec1){return db['MailTransferReport'][_0x1e36('0x4b')](_0x235ced[_0x1e36('0x4c')],{})[_0x1e36('0x2a')](respondWithResult(_0x3ddec1,0xc9))['catch'](handleError(_0x3ddec1,null));};exports['update']=function(_0x1d37b0,_0x58039e){if(_0x1d37b0[_0x1e36('0x4c')]['id']){delete _0x1d37b0[_0x1e36('0x4c')]['id'];}return db[_0x1e36('0x43')][_0x1e36('0x4a')]({'where':{'id':_0x1d37b0[_0x1e36('0x48')]['id']}})['then'](handleEntityNotFound(_0x58039e,null))[_0x1e36('0x2a')](saveUpdates(_0x1d37b0['body'],null))[_0x1e36('0x2a')](respondWithResult(_0x58039e,null))[_0x1e36('0x47')](handleError(_0x58039e,null));};exports[_0x1e36('0x2b')]=function(_0x83570,_0x406bd0){return db['MailTransferReport'][_0x1e36('0x4a')]({'where':{'id':_0x83570[_0x1e36('0x48')]['id']}})[_0x1e36('0x2a')](handleEntityNotFound(_0x406bd0,null))['then'](removeEntity(_0x406bd0,null))['catch'](handleError(_0x406bd0,null));};exports[_0x1e36('0x4d')]=function(_0x2b8479,_0x4f8fbd){return db[_0x1e36('0x43')][_0x1e36('0x4d')]()[_0x1e36('0x2a')](respondWithResult(_0x4f8fbd,null))[_0x1e36('0x47')](handleError(_0x4f8fbd,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index a43e357..5ed59fb 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 _0x25ad=['exports','define','MailTransferReport','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes'];(function(_0x12bcb6,_0x442795){var _0x1d05d0=function(_0x383242){while(--_0x383242){_0x12bcb6['push'](_0x12bcb6['shift']());}};_0x1d05d0(++_0x442795);}(_0x25ad,0x1b1));var _0xd25a=function(_0x5dd181,_0x1eac8b){_0x5dd181=_0x5dd181-0x0;var _0x27cc98=_0x25ad[_0x5dd181];return _0x27cc98;};'use strict';var _=require(_0xd25a('0x0'));var util=require('util');var logger=require(_0xd25a('0x1'))(_0xd25a('0x2'));var moment=require(_0xd25a('0x3'));var BPromise=require('bluebird');var rp=require(_0xd25a('0x4'));var fs=require('fs');var path=require(_0xd25a('0x5'));var rimraf=require(_0xd25a('0x6'));var config=require(_0xd25a('0x7'));var attributes=require(_0xd25a('0x8'));module[_0xd25a('0x9')]=function(_0x544053,_0x4ca0db){return _0x544053[_0xd25a('0xa')](_0xd25a('0xb'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xd25a('0xc'),'fields':[_0xd25a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3efe=['report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./mailTransferReport.attributes','define'];(function(_0x59a1a0,_0x45d4a8){var _0x442238=function(_0x48f6e5){while(--_0x48f6e5){_0x59a1a0['push'](_0x59a1a0['shift']());}};_0x442238(++_0x45d4a8);}(_0x3efe,0x136));var _0xe3ef=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x3efe[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xe3ef('0x0'));var util=require(_0xe3ef('0x1'));var logger=require(_0xe3ef('0x2'))(_0xe3ef('0x3'));var moment=require(_0xe3ef('0x4'));var BPromise=require('bluebird');var rp=require(_0xe3ef('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe3ef('0x6'));var config=require('../../config/environment');var attributes=require(_0xe3ef('0x7'));module['exports']=function(_0xedbab6,_0x37bf01){return _0xedbab6[_0xe3ef('0x8')]('MailTransferReport',attributes,{'tableName':_0xe3ef('0x9'),'paranoid':![],'indexes':[{'name':_0xe3ef('0xa'),'fields':[_0xe3ef('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 8279667..87f7242 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 _0xeaa4=['error','code','MailTransferReport,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','then','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0xeaa4,0xa1));var _0x4eaa=function(_0xff95ab,_0x58eb7a){_0xff95ab=_0xff95ab-0x0;var _0x471ba5=_0xeaa4[_0xff95ab];return _0x471ba5;};'use strict';var _=require(_0x4eaa('0x0'));var util=require(_0x4eaa('0x1'));var moment=require(_0x4eaa('0x2'));var BPromise=require(_0x4eaa('0x3'));var rs=require(_0x4eaa('0x4'));var fs=require('fs');var Redis=require(_0x4eaa('0x5'));var db=require(_0x4eaa('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4eaa('0x7'));var jayson=require(_0x4eaa('0x8'));var client=jayson[_0x4eaa('0x9')][_0x4eaa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1dc4b5,_0x4e87d1,_0xccd04){return new BPromise(function(_0x12ecc0,_0x3c08fe){return client['request'](_0x1dc4b5,_0xccd04)[_0x4eaa('0xb')](function(_0x1dd5bb){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x4e87d1,'request\x20sent');logger[_0x4eaa('0xc')](_0x4eaa('0xd'),_0x4e87d1,'request\x20sent',JSON[_0x4eaa('0xe')](_0x1dd5bb));if(_0x1dd5bb[_0x4eaa('0xf')]){if(_0x1dd5bb['error'][_0x4eaa('0x10')]===0x1f4){logger['error'](_0x4eaa('0x11'),_0x4e87d1,_0x1dd5bb[_0x4eaa('0xf')][_0x4eaa('0x12')]);return _0x3c08fe(_0x1dd5bb[_0x4eaa('0xf')]['message']);}logger[_0x4eaa('0xf')](_0x4eaa('0x11'),_0x4e87d1,_0x1dd5bb[_0x4eaa('0xf')]['message']);return _0x12ecc0(_0x1dd5bb[_0x4eaa('0xf')][_0x4eaa('0x12')]);}else{logger['info'](_0x4eaa('0x11'),_0x4e87d1,_0x4eaa('0x13'));_0x12ecc0(_0x1dd5bb[_0x4eaa('0x14')][_0x4eaa('0x12')]);}})[_0x4eaa('0x15')](function(_0x281e20){logger[_0x4eaa('0xf')](_0x4eaa('0x11'),_0x4e87d1,_0x281e20);_0x3c08fe(_0x281e20);});});} \ No newline at end of file +var _0xc7b7=['MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailTransferReport,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x5be9cd,_0x42d55e){var _0x1ca7c6=function(_0x51d554){while(--_0x51d554){_0x5be9cd['push'](_0x5be9cd['shift']());}};_0x1ca7c6(++_0x42d55e);}(_0xc7b7,0xd9));var _0x7c7b=function(_0x49df93,_0x2bb7ac){_0x49df93=_0x49df93-0x0;var _0x471bac=_0xc7b7[_0x49df93];return _0x471bac;};'use strict';var _=require('lodash');var util=require(_0x7c7b('0x0'));var moment=require(_0x7c7b('0x1'));var BPromise=require(_0x7c7b('0x2'));var rs=require(_0x7c7b('0x3'));var fs=require('fs');var Redis=require(_0x7c7b('0x4'));var db=require(_0x7c7b('0x5'))['db'];var utils=require(_0x7c7b('0x6'));var logger=require('../../config/logger')(_0x7c7b('0x7'));var config=require(_0x7c7b('0x8'));var jayson=require(_0x7c7b('0x9'));var client=jayson['client'][_0x7c7b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53cdb6,_0x2aec88,_0x3effaf){return new BPromise(function(_0x296b7c,_0x445364){return client[_0x7c7b('0xb')](_0x53cdb6,_0x3effaf)[_0x7c7b('0xc')](function(_0x4854a4){logger[_0x7c7b('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x2aec88,'request\x20sent');logger['debug'](_0x7c7b('0xe'),_0x2aec88,_0x7c7b('0xf'),JSON[_0x7c7b('0x10')](_0x4854a4));if(_0x4854a4[_0x7c7b('0x11')]){if(_0x4854a4['error']['code']===0x1f4){logger['error'](_0x7c7b('0x12'),_0x2aec88,_0x4854a4[_0x7c7b('0x11')][_0x7c7b('0x13')]);return _0x445364(_0x4854a4[_0x7c7b('0x11')][_0x7c7b('0x13')]);}logger['error'](_0x7c7b('0x12'),_0x2aec88,_0x4854a4['error'][_0x7c7b('0x13')]);return _0x296b7c(_0x4854a4[_0x7c7b('0x11')]['message']);}else{logger[_0x7c7b('0xd')](_0x7c7b('0x12'),_0x2aec88,'request\x20sent');_0x296b7c(_0x4854a4[_0x7c7b('0x14')][_0x7c7b('0x13')]);}})['catch'](function(_0xf6d713){logger[_0x7c7b('0x11')](_0x7c7b('0x12'),_0x2aec88,_0xf6d713);_0x445364(_0xf6d713);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 94fbe4e..4e9f3aa 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 _0x876b=['../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x2fc422,_0xb20647){var _0x3dd380=function(_0x594156){while(--_0x594156){_0x2fc422['push'](_0x2fc422['shift']());}};_0x3dd380(++_0xb20647);}(_0x876b,0x185));var _0xb876=function(_0x1edd67,_0x53b272){_0x1edd67=_0x1edd67-0x0;var _0x2bb94e=_0x876b[_0x1edd67];return _0x2bb94e;};'use strict';var multer=require(_0xb876('0x0'));var util=require(_0xb876('0x1'));var path=require(_0xb876('0x2'));var timeout=require(_0xb876('0x3'));var express=require(_0xb876('0x4'));var router=express[_0xb876('0x5')]();var fs_extra=require(_0xb876('0x6'));var auth=require(_0xb876('0x7'));var interaction=require(_0xb876('0x8'));var config=require('../../config/environment');var controller=require(_0xb876('0x9'));router[_0xb876('0xa')]('/',auth[_0xb876('0xb')](),controller[_0xb876('0xc')]);router[_0xb876('0xa')](_0xb876('0xd'),auth[_0xb876('0xb')](),controller[_0xb876('0xe')]);router[_0xb876('0xa')](_0xb876('0xf'),auth[_0xb876('0xb')](),controller['show']);router[_0xb876('0x10')]('/',auth[_0xb876('0xb')](),controller[_0xb876('0x11')]);router[_0xb876('0x12')]('/:id',auth[_0xb876('0xb')](),controller[_0xb876('0x13')]);router['delete'](_0xb876('0xf'),auth[_0xb876('0xb')](),controller[_0xb876('0x14')]);module[_0xb876('0x15')]=router; \ No newline at end of file +var _0xe607=['../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe607,0xa0));var _0x7e60=function(_0x17ca6f,_0x1df9df){_0x17ca6f=_0x17ca6f-0x0;var _0x25facb=_0xe607[_0x17ca6f];return _0x25facb;};'use strict';var multer=require(_0x7e60('0x0'));var util=require(_0x7e60('0x1'));var path=require(_0x7e60('0x2'));var timeout=require('connect-timeout');var express=require(_0x7e60('0x3'));var router=express[_0x7e60('0x4')]();var fs_extra=require(_0x7e60('0x5'));var auth=require(_0x7e60('0x6'));var interaction=require(_0x7e60('0x7'));var config=require(_0x7e60('0x8'));var controller=require('./memberReport.controller');router[_0x7e60('0x9')]('/',auth['isAuthenticated'](),controller[_0x7e60('0xa')]);router[_0x7e60('0x9')](_0x7e60('0xb'),auth[_0x7e60('0xc')](),controller[_0x7e60('0xd')]);router[_0x7e60('0x9')](_0x7e60('0xe'),auth[_0x7e60('0xc')](),controller[_0x7e60('0xf')]);router[_0x7e60('0x10')]('/',auth[_0x7e60('0xc')](),controller[_0x7e60('0x11')]);router['put']('/:id',auth[_0x7e60('0xc')](),controller[_0x7e60('0x12')]);router[_0x7e60('0x13')]('/:id',auth[_0x7e60('0xc')](),controller['destroy']);module[_0x7e60('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 756b62a..909463e 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 _0x21dc=['talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]'];(function(_0x4be60d,_0x3cfaf8){var _0x2d69d2=function(_0x5e3242){while(--_0x5e3242){_0x4be60d['push'](_0x4be60d['shift']());}};_0x2d69d2(++_0x3cfaf8);}(_0x21dc,0x81));var _0xc21d=function(_0x592dde,_0x47d759){_0x592dde=_0x592dde-0x0;var _0x4a1c49=_0x21dc[_0x592dde];return _0x4a1c49;};'use strict';var Sequelize=require(_0xc21d('0x0'));var moment=require(_0xc21d('0x1'));module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xc21d('0x2')]},'interface':{'type':Sequelize[_0xc21d('0x2')]},'type':{'type':Sequelize[_0xc21d('0x2')],'defaultValue':_0xc21d('0x3'),'comment':_0xc21d('0x4')},'duration':{'type':Sequelize[_0xc21d('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xc21d('0x6')],'set':function(_0xa09e43){var _0x28ce85=moment(_0xa09e43);var _0x156a6a=moment(this[_0xc21d('0x7')](_0xc21d('0x8')));var _0x4a917c=_0x28ce85[_0xc21d('0x9')](_0x156a6a,_0xc21d('0xa'));this[_0xc21d('0xb')]('exitAt',_0xa09e43);this['setDataValue'](_0xc21d('0xc'),_0x4a917c>=0x0?_0x4a917c:null);}},'data1':{'type':Sequelize[_0xc21d('0x2')],'comment':_0xc21d('0xd')},'data2':{'type':Sequelize['STRING'],'comment':_0xc21d('0xe')},'data3':{'type':Sequelize['STRING'],'comment':_0xc21d('0xf')},'data4':{'type':Sequelize[_0xc21d('0x2')],'comment':_0xc21d('0x10')},'data5':{'type':Sequelize[_0xc21d('0x2')],'comment':_0xc21d('0x11')},'role':{'type':Sequelize[_0xc21d('0x2')]},'internal':{'type':Sequelize[_0xc21d('0x5')]},'uniqueid':{'type':Sequelize[_0xc21d('0x2')]}}; \ No newline at end of file +var _0x682e=['talk:[dial\x20string]','talk:[queue]','moment','STRING','INTEGER','DATE','getDataValue','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]'];(function(_0x3d8986,_0x49a285){var _0x47cfda=function(_0x18c717){while(--_0x18c717){_0x3d8986['push'](_0x3d8986['shift']());}};_0x47cfda(++_0x49a285);}(_0x682e,0x11a));var _0xe682=function(_0x3d31c3,_0x2d7ea6){_0x3d31c3=_0x3d31c3-0x0;var _0x2b31e8=_0x682e[_0x3d31c3];return _0x2b31e8;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe682('0x0'));module['exports']={'channel':{'type':Sequelize[_0xe682('0x1')]},'membername':{'type':Sequelize[_0xe682('0x1')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe682('0x1')],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xe682('0x2')]},'enterAt':{'type':Sequelize[_0xe682('0x3')]},'exitAt':{'type':Sequelize[_0xe682('0x3')],'set':function(_0x3c7f67){var _0x1d9a47=moment(_0x3c7f67);var _0x29592a=moment(this[_0xe682('0x4')]('enterAt'));var _0x5810a0=_0x1d9a47[_0xe682('0x5')](_0x29592a,_0xe682('0x6'));this[_0xe682('0x7')](_0xe682('0x8'),_0x3c7f67);this[_0xe682('0x7')](_0xe682('0x9'),_0x5810a0>=0x0?_0x5810a0:null);}},'data1':{'type':Sequelize[_0xe682('0x1')],'comment':_0xe682('0xa')},'data2':{'type':Sequelize[_0xe682('0x1')],'comment':_0xe682('0xb')},'data3':{'type':Sequelize[_0xe682('0x1')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xe682('0x1')],'comment':_0xe682('0xc')},'data5':{'type':Sequelize[_0xe682('0x1')],'comment':_0xe682('0xd')},'role':{'type':Sequelize[_0xe682('0x1')]},'internal':{'type':Sequelize[_0xe682('0x2')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index dca6d09..161feeb 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 _0x008c=['destroy','sendStatus','send','index','MemberReport','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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'];(function(_0x60047e,_0x5b82ff){var _0x4057b1=function(_0x5b319c){while(--_0x5b319c){_0x60047e['push'](_0x60047e['shift']());}};_0x4057b1(++_0x5b82ff);}(_0x008c,0x188));var _0xc008=function(_0x23f50a,_0x1e0fbc){_0x23f50a=_0x23f50a-0x0;var _0x3d48e2=_0x008c[_0x23f50a];return _0x3d48e2;};'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(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,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(_0x4247e5,_0x30b7bb){_0x4247e5=_0x4247e5-0x0;var _0x5ee3d5=_0x55ca[_0x4247e5];return _0x5ee3d5;};'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 0044e88..e9b008a 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 _0x563e=['exports','define','report_member','interface','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./memberReport.attributes'];(function(_0x5496ff,_0x104d17){var _0x36881c=function(_0x395a82){while(--_0x395a82){_0x5496ff['push'](_0x5496ff['shift']());}};_0x36881c(++_0x104d17);}(_0x563e,0x1cb));var _0xe563=function(_0x46884f,_0x2b5c5a){_0x46884f=_0x46884f-0x0;var _0x78c6c0=_0x563e[_0x46884f];return _0x78c6c0;};'use strict';var _=require(_0xe563('0x0'));var util=require(_0xe563('0x1'));var logger=require(_0xe563('0x2'))(_0xe563('0x3'));var moment=require('moment');var BPromise=require(_0xe563('0x4'));var rp=require(_0xe563('0x5'));var fs=require('fs');var path=require(_0xe563('0x6'));var rimraf=require('rimraf');var config=require(_0xe563('0x7'));var attributes=require(_0xe563('0x8'));module[_0xe563('0x9')]=function(_0x563644,_0x39fdd0){return _0x563644[_0xe563('0xa')]('MemberReport',attributes,{'tableName':_0xe563('0xb'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername',_0xe563('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe0ae=['bluebird','request-promise','rimraf','./memberReport.attributes','define','MemberReport','report_member','membername_interface','interface','lodash','../../config/logger','moment'];(function(_0xc005f6,_0x4b4f9f){var _0x66f690=function(_0x9e4a27){while(--_0x9e4a27){_0xc005f6['push'](_0xc005f6['shift']());}};_0x66f690(++_0x4b4f9f);}(_0xe0ae,0x1a1));var _0xee0a=function(_0x503564,_0x55867e){_0x503564=_0x503564-0x0;var _0x4be9fd=_0xe0ae[_0x503564];return _0x4be9fd;};'use strict';var _=require(_0xee0a('0x0'));var util=require('util');var logger=require(_0xee0a('0x1'))('api');var moment=require(_0xee0a('0x2'));var BPromise=require(_0xee0a('0x3'));var rp=require(_0xee0a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee0a('0x5'));var config=require('../../config/environment');var attributes=require(_0xee0a('0x6'));module['exports']=function(_0x1b5e7d,_0x4ebf18){return _0x1b5e7d[_0xee0a('0x7')](_0xee0a('0x8'),attributes,{'tableName':_0xee0a('0x9'),'paranoid':![],'indexes':[{'name':_0xee0a('0xa'),'fields':['membername',_0xee0a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index ecc53bf..45d956d 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 _0xe626=['CreateMemberReport','create','raw','UpdateMemberReport','update','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','MemberReport','findAll','options','where','attributes','limit','map','include','model','then','debug'];(function(_0x134d5e,_0x2a47d8){var _0x1e166a=function(_0x53f10d){while(--_0x53f10d){_0x134d5e['push'](_0x134d5e['shift']());}};_0x1e166a(++_0x2a47d8);}(_0xe626,0x9d));var _0x6e62=function(_0x96dbe9,_0x5a9d09){_0x96dbe9=_0x96dbe9-0x0;var _0x58cf3f=_0xe626[_0x96dbe9];return _0x58cf3f;};'use strict';var _=require(_0x6e62('0x0'));var util=require(_0x6e62('0x1'));var moment=require(_0x6e62('0x2'));var BPromise=require(_0x6e62('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e62('0x4'));var db=require(_0x6e62('0x5'))['db'];var utils=require(_0x6e62('0x6'));var logger=require(_0x6e62('0x7'))(_0x6e62('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6e62('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x157047,_0x55165e,_0x32fd89){return new BPromise(function(_0x1dfbaf,_0x16fa52){return client[_0x6e62('0xa')](_0x157047,_0x32fd89)['then'](function(_0xa6e8be){logger[_0x6e62('0xb')]('MemberReport,\x20%s,\x20%s',_0x55165e,_0x6e62('0xc'));logger['debug'](_0x6e62('0xd'),_0x55165e,'request\x20sent',JSON[_0x6e62('0xe')](_0xa6e8be));if(_0xa6e8be['error']){if(_0xa6e8be[_0x6e62('0xf')][_0x6e62('0x10')]===0x1f4){logger[_0x6e62('0xf')](_0x6e62('0x11'),_0x55165e,_0xa6e8be[_0x6e62('0xf')][_0x6e62('0x12')]);return _0x16fa52(_0xa6e8be[_0x6e62('0xf')]['message']);}logger['error'](_0x6e62('0x11'),_0x55165e,_0xa6e8be[_0x6e62('0xf')]['message']);return _0x1dfbaf(_0xa6e8be[_0x6e62('0xf')][_0x6e62('0x12')]);}else{logger[_0x6e62('0xb')](_0x6e62('0x11'),_0x55165e,'request\x20sent');_0x1dfbaf(_0xa6e8be[_0x6e62('0x13')][_0x6e62('0x12')]);}})[_0x6e62('0x14')](function(_0x35748b){logger[_0x6e62('0xf')](_0x6e62('0x11'),_0x55165e,_0x35748b);_0x16fa52(_0x35748b);});});}exports[_0x6e62('0x15')]=function(_0x45d7ee){var _0x474e58=this;return new Promise(function(_0x15bce5,_0x50c535){return db[_0x6e62('0x16')][_0x6e62('0x17')]({'raw':_0x45d7ee['options']?_0x45d7ee[_0x6e62('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x45d7ee[_0x6e62('0x18')]?_0x45d7ee[_0x6e62('0x18')][_0x6e62('0x19')]||null:null,'attributes':_0x45d7ee[_0x6e62('0x18')]?_0x45d7ee[_0x6e62('0x18')][_0x6e62('0x1a')]||null:null,'limit':_0x45d7ee[_0x6e62('0x18')]?_0x45d7ee[_0x6e62('0x18')][_0x6e62('0x1b')]||null:null,'include':_0x45d7ee[_0x6e62('0x18')]?_0x45d7ee[_0x6e62('0x18')]['include']?_[_0x6e62('0x1c')](_0x45d7ee['options'][_0x6e62('0x1d')],function(_0x3dad96){return{'model':db[_0x3dad96[_0x6e62('0x1e')]],'as':_0x3dad96['as'],'attributes':_0x3dad96[_0x6e62('0x1a')],'include':_0x3dad96[_0x6e62('0x1d')]?_[_0x6e62('0x1c')](_0x3dad96[_0x6e62('0x1d')],function(_0x3a1683){return{'model':db[_0x3a1683[_0x6e62('0x1e')]],'as':_0x3a1683['as'],'attributes':_0x3a1683[_0x6e62('0x1a')],'include':_0x3a1683['include']?_[_0x6e62('0x1c')](_0x3a1683['include'],function(_0x2f9c68){return{'model':db[_0x2f9c68[_0x6e62('0x1e')]],'as':_0x2f9c68['as'],'attributes':_0x2f9c68[_0x6e62('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6e62('0x1f')](function(_0x3b7dfa){logger[_0x6e62('0xb')]('GetMemberReport',_0x45d7ee);logger[_0x6e62('0x20')](_0x6e62('0x15'),_0x45d7ee,JSON[_0x6e62('0xe')](_0x3b7dfa));_0x15bce5(_0x3b7dfa);})['catch'](function(_0x58afab){logger[_0x6e62('0xf')]('GetMemberReport',_0x58afab['message'],_0x45d7ee);_0x50c535(_0x474e58['error'](0x1f4,_0x58afab['message']));});});};exports[_0x6e62('0x21')]=function(_0x4c6af1){var _0x2d9172=this;return new Promise(function(_0x5a8516,_0x1dc29e){return db[_0x6e62('0x16')][_0x6e62('0x22')](_0x4c6af1['body'],{'raw':_0x4c6af1['options']?_0x4c6af1[_0x6e62('0x18')][_0x6e62('0x23')]===undefined?!![]:![]:!![]})['then'](function(_0x5e2969){logger['info'](_0x6e62('0x21'),_0x4c6af1);logger['debug'](_0x6e62('0x21'),_0x4c6af1,JSON[_0x6e62('0xe')](_0x5e2969));_0x5a8516(_0x5e2969);})[_0x6e62('0x14')](function(_0xe525c){logger[_0x6e62('0xf')]('CreateMemberReport',_0xe525c['message'],_0x4c6af1);_0x1dc29e(_0x2d9172[_0x6e62('0xf')](0x1f4,_0xe525c[_0x6e62('0x12')]));});});};exports[_0x6e62('0x24')]=function(_0x372f72){var _0xf650a=this;return new Promise(function(_0xfe729c,_0x9c62b){return db[_0x6e62('0x16')][_0x6e62('0x25')](_0x372f72['body'],{'raw':_0x372f72[_0x6e62('0x18')]?_0x372f72[_0x6e62('0x18')][_0x6e62('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x372f72['options']?_0x372f72[_0x6e62('0x18')][_0x6e62('0x19')]||null:null,'attributes':_0x372f72['options']?_0x372f72[_0x6e62('0x18')][_0x6e62('0x1a')]||null:null,'limit':_0x372f72[_0x6e62('0x18')]?_0x372f72[_0x6e62('0x18')][_0x6e62('0x1b')]||null:null})['then'](function(_0x34f99e){logger[_0x6e62('0xb')](_0x6e62('0x24'),_0x372f72);logger[_0x6e62('0x20')](_0x6e62('0x24'),_0x372f72,JSON['stringify'](_0x34f99e));_0xfe729c(_0x34f99e);})[_0x6e62('0x14')](function(_0x6f8397){logger[_0x6e62('0xf')]('UpdateMemberReport',_0x6f8397[_0x6e62('0x12')],_0x372f72);_0x9c62b(_0xf650a[_0x6e62('0xf')](0x1f4,_0x6f8397['message']));});});}; \ No newline at end of file +var _0x6011=['code','message','result','GetMemberReport','MemberReport','options','raw','where','attributes','limit','map','model','include','debug','stringify','catch','create','body','CreateMemberReport','update','UpdateMemberReport','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','error'];(function(_0x276da3,_0x4768f0){var _0x209c2d=function(_0x3cea98){while(--_0x3cea98){_0x276da3['push'](_0x276da3['shift']());}};_0x209c2d(++_0x4768f0);}(_0x6011,0x196));var _0x1601=function(_0x298f65,_0x40e478){_0x298f65=_0x298f65-0x0;var _0x443739=_0x6011[_0x298f65];return _0x443739;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1601('0x0'));var db=require(_0x1601('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x1601('0x2'))(_0x1601('0x3'));var config=require(_0x1601('0x4'));var jayson=require(_0x1601('0x5'));var client=jayson[_0x1601('0x6')][_0x1601('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x277bfc,_0x1e7cf6,_0x18e06c){return new BPromise(function(_0x99dee1,_0x55b751){return client[_0x1601('0x8')](_0x277bfc,_0x18e06c)[_0x1601('0x9')](function(_0x1e3488){logger[_0x1601('0xa')](_0x1601('0xb'),_0x1e7cf6,'request\x20sent');logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x1e7cf6,_0x1601('0xc'),JSON['stringify'](_0x1e3488));if(_0x1e3488[_0x1601('0xd')]){if(_0x1e3488[_0x1601('0xd')][_0x1601('0xe')]===0x1f4){logger[_0x1601('0xd')](_0x1601('0xb'),_0x1e7cf6,_0x1e3488[_0x1601('0xd')][_0x1601('0xf')]);return _0x55b751(_0x1e3488[_0x1601('0xd')]['message']);}logger[_0x1601('0xd')]('MemberReport,\x20%s,\x20%s',_0x1e7cf6,_0x1e3488[_0x1601('0xd')]['message']);return _0x99dee1(_0x1e3488[_0x1601('0xd')][_0x1601('0xf')]);}else{logger['info'](_0x1601('0xb'),_0x1e7cf6,_0x1601('0xc'));_0x99dee1(_0x1e3488[_0x1601('0x10')]['message']);}})['catch'](function(_0x24c0ab){logger[_0x1601('0xd')](_0x1601('0xb'),_0x1e7cf6,_0x24c0ab);_0x55b751(_0x24c0ab);});});}exports[_0x1601('0x11')]=function(_0x1d8563){var _0x302350=this;return new Promise(function(_0x23b992,_0x3ae0c6){return db[_0x1601('0x12')]['findAll']({'raw':_0x1d8563['options']?_0x1d8563[_0x1601('0x13')][_0x1601('0x14')]===undefined?!![]:![]:!![],'where':_0x1d8563[_0x1601('0x13')]?_0x1d8563['options'][_0x1601('0x15')]||null:null,'attributes':_0x1d8563[_0x1601('0x13')]?_0x1d8563[_0x1601('0x13')][_0x1601('0x16')]||null:null,'limit':_0x1d8563[_0x1601('0x13')]?_0x1d8563['options'][_0x1601('0x17')]||null:null,'include':_0x1d8563[_0x1601('0x13')]?_0x1d8563[_0x1601('0x13')]['include']?_[_0x1601('0x18')](_0x1d8563[_0x1601('0x13')]['include'],function(_0x2b01da){return{'model':db[_0x2b01da[_0x1601('0x19')]],'as':_0x2b01da['as'],'attributes':_0x2b01da['attributes'],'include':_0x2b01da['include']?_[_0x1601('0x18')](_0x2b01da[_0x1601('0x1a')],function(_0x34d021){return{'model':db[_0x34d021['model']],'as':_0x34d021['as'],'attributes':_0x34d021[_0x1601('0x16')],'include':_0x34d021[_0x1601('0x1a')]?_[_0x1601('0x18')](_0x34d021[_0x1601('0x1a')],function(_0x296c34){return{'model':db[_0x296c34['model']],'as':_0x296c34['as'],'attributes':_0x296c34['attributes']};}):[]};}):[]};}):[]:[]})[_0x1601('0x9')](function(_0x1aef35){logger[_0x1601('0xa')]('GetMemberReport',_0x1d8563);logger[_0x1601('0x1b')]('GetMemberReport',_0x1d8563,JSON[_0x1601('0x1c')](_0x1aef35));_0x23b992(_0x1aef35);})[_0x1601('0x1d')](function(_0x389f0f){logger['error'](_0x1601('0x11'),_0x389f0f[_0x1601('0xf')],_0x1d8563);_0x3ae0c6(_0x302350[_0x1601('0xd')](0x1f4,_0x389f0f[_0x1601('0xf')]));});});};exports['CreateMemberReport']=function(_0x32740e){var _0x3ef6a7=this;return new Promise(function(_0x2a4ef9,_0x224a1c){return db[_0x1601('0x12')][_0x1601('0x1e')](_0x32740e[_0x1601('0x1f')],{'raw':_0x32740e[_0x1601('0x13')]?_0x32740e[_0x1601('0x13')][_0x1601('0x14')]===undefined?!![]:![]:!![]})[_0x1601('0x9')](function(_0x46050f){logger[_0x1601('0xa')]('CreateMemberReport',_0x32740e);logger[_0x1601('0x1b')](_0x1601('0x20'),_0x32740e,JSON[_0x1601('0x1c')](_0x46050f));_0x2a4ef9(_0x46050f);})[_0x1601('0x1d')](function(_0x3a350d){logger['error'](_0x1601('0x20'),_0x3a350d[_0x1601('0xf')],_0x32740e);_0x224a1c(_0x3ef6a7['error'](0x1f4,_0x3a350d[_0x1601('0xf')]));});});};exports['UpdateMemberReport']=function(_0x3a92d9){var _0x39e89f=this;return new Promise(function(_0x4b2f6c,_0x7a11dd){return db[_0x1601('0x12')][_0x1601('0x21')](_0x3a92d9[_0x1601('0x1f')],{'raw':_0x3a92d9[_0x1601('0x13')]?_0x3a92d9[_0x1601('0x13')][_0x1601('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a92d9['options']?_0x3a92d9[_0x1601('0x13')][_0x1601('0x15')]||null:null,'attributes':_0x3a92d9['options']?_0x3a92d9['options'][_0x1601('0x16')]||null:null,'limit':_0x3a92d9[_0x1601('0x13')]?_0x3a92d9[_0x1601('0x13')][_0x1601('0x17')]||null:null})[_0x1601('0x9')](function(_0x2a585b){logger[_0x1601('0xa')]('UpdateMemberReport',_0x3a92d9);logger[_0x1601('0x1b')](_0x1601('0x22'),_0x3a92d9,JSON['stringify'](_0x2a585b));_0x4b2f6c(_0x2a585b);})['catch'](function(_0x3f0522){logger['error']('UpdateMemberReport',_0x3f0522['message'],_0x3a92d9);_0x7a11dd(_0x39e89f[_0x1601('0xd')](0x1f4,_0x3f0522[_0x1601('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 2439d88..65de8a6 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 _0x2155=['get','index','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x4b46fd,_0x172722){var _0x5e8a81=function(_0x23217b){while(--_0x23217b){_0x4b46fd['push'](_0x4b46fd['shift']());}};_0x5e8a81(++_0x172722);}(_0x2155,0xbe));var _0x5215=function(_0x18e0bb,_0x28f0e0){_0x18e0bb=_0x18e0bb-0x0;var _0x5f14af=_0x2155[_0x18e0bb];return _0x5f14af;};'use strict';var multer=require(_0x5215('0x0'));var util=require(_0x5215('0x1'));var path=require('path');var timeout=require(_0x5215('0x2'));var express=require(_0x5215('0x3'));var router=express[_0x5215('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5215('0x5'));var config=require(_0x5215('0x6'));var controller=require(_0x5215('0x7'));router[_0x5215('0x8')]('/',controller[_0x5215('0x9')]);module[_0x5215('0xa')]=router; \ No newline at end of file +var _0x3ef1=['get','index','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3ef1,0x99));var _0x13ef=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x3ef1[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require('multer');var util=require(_0x13ef('0x0'));var path=require(_0x13ef('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x13ef('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x13ef('0x3'));var interaction=require(_0x13ef('0x4'));var config=require(_0x13ef('0x5'));var controller=require(_0x13ef('0x6'));router[_0x13ef('0x7')]('/',controller[_0x13ef('0x8')]);module[_0x13ef('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 2e1a306..88e1272 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 _0x7393=['version','sequelize','exports','STRING'];(function(_0x3ddb9c,_0x3aaafb){var _0x43a775=function(_0x193d24){while(--_0x193d24){_0x3ddb9c['push'](_0x3ddb9c['shift']());}};_0x43a775(++_0x3aaafb);}(_0x7393,0x10d));var _0x3739=function(_0x576745,_0x2588a0){_0x576745=_0x576745-0x0;var _0x4bb159=_0x7393[_0x576745];return _0x4bb159;};'use strict';var Sequelize=require(_0x3739('0x0'));module[_0x3739('0x1')]={'version':{'type':Sequelize[_0x3739('0x2')],'unique':_0x3739('0x3')}}; \ No newline at end of file +var _0x1b6e=['version','sequelize','exports'];(function(_0xb44454,_0x6dda61){var _0x52f048=function(_0x8742f){while(--_0x8742f){_0xb44454['push'](_0xb44454['shift']());}};_0x52f048(++_0x6dda61);}(_0x1b6e,0xbb));var _0xe1b6=function(_0x489ba6,_0x14de0b){_0x489ba6=_0x489ba6-0x0;var _0x273c45=_0x1b6e[_0x489ba6];return _0x273c45;};'use strict';var Sequelize=require(_0xe1b6('0x0'));module[_0xe1b6('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0xe1b6('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index b4784db..387c6d4 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 _0x192e=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','stack','send','rawAttributes','fieldName','key','model','map','name','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','Migration','includeAll','include','rows','catch'];(function(_0x454f6b,_0x27b89a){var _0x163f6e=function(_0x1decbd){while(--_0x1decbd){_0x454f6b['push'](_0x454f6b['shift']());}};_0x163f6e(++_0x27b89a);}(_0x192e,0x1e3));var _0xe192=function(_0x3b8a21,_0x2f8c7a){_0x3b8a21=_0x3b8a21-0x0;var _0x4140e9=_0x192e[_0x3b8a21];return _0x4140e9;};'use strict';var emlformat=require(_0xe192('0x0'));var rimraf=require(_0xe192('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe192('0x2'));var rp=require(_0xe192('0x3'));var moment=require(_0xe192('0x4'));var BPromise=require(_0xe192('0x5'));var Mustache=require(_0xe192('0x6'));var util=require(_0xe192('0x7'));var path=require(_0xe192('0x8'));var sox=require(_0xe192('0x9'));var csv=require(_0xe192('0xa'));var ejs=require(_0xe192('0xb'));var fs=require('fs');var fs_extra=require(_0xe192('0xc'));var _=require(_0xe192('0xd'));var squel=require(_0xe192('0xe'));var crypto=require(_0xe192('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xe192('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe192('0x11'));var Papa=require(_0xe192('0x12'));var Redis=require(_0xe192('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe192('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe192('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xe192('0x16'));var licenseUtil=require(_0xe192('0x17'));var db=require(_0xe192('0x18'))['db'];function respondWithStatusCode(_0x37a92f,_0x126d4a){_0x126d4a=_0x126d4a||0xcc;return function(_0x5cff91){if(_0x5cff91){return _0x37a92f['sendStatus'](_0x126d4a);}return _0x37a92f['status'](_0x126d4a)['end']();};}function respondWithResult(_0x216d08,_0x439b89){_0x439b89=_0x439b89||0xc8;return function(_0x4ebd4d){if(_0x4ebd4d){return _0x216d08[_0xe192('0x19')](_0x439b89)[_0xe192('0x1a')](_0x4ebd4d);}};}function respondWithFilteredResult(_0x3ddfa6,_0x416c9b){return function(_0xb21d4c){if(_0xb21d4c){var _0x2e4d63=typeof _0x416c9b[_0xe192('0x1b')]===_0xe192('0x1c')&&typeof _0x416c9b['limit']===_0xe192('0x1c');var _0x14f186=_0xb21d4c['count'];var _0x5eb18e=_0x2e4d63?0x0:_0x416c9b['offset'];var _0x369279=_0x2e4d63?_0xb21d4c[_0xe192('0x1d')]:_0x416c9b['offset']+_0x416c9b[_0xe192('0x1e')];var _0x167e82;if(_0x369279>=_0x14f186){_0x369279=_0x14f186;_0x167e82=0xc8;}else{_0x167e82=0xce;}_0x3ddfa6[_0xe192('0x19')](_0x167e82);return _0x3ddfa6[_0xe192('0x1f')](_0xe192('0x20'),_0x5eb18e+'-'+_0x369279+'/'+_0x14f186)[_0xe192('0x1a')](_0xb21d4c);}return null;};}function patchUpdates(_0x202f0b){return function(_0x52ca27){try{jsonpatch[_0xe192('0x21')](_0x52ca27,_0x202f0b,!![]);}catch(_0xd6da71){return BPromise[_0xe192('0x22')](_0xd6da71);}return _0x52ca27['save']();};}function saveUpdates(_0x32f33f,_0x1b0232){return function(_0x21a0fa){if(_0x21a0fa){return _0x21a0fa[_0xe192('0x23')](_0x32f33f)[_0xe192('0x24')](function(_0x4a7812){return _0x4a7812;});}return null;};}function removeEntity(_0x3a2884,_0x79a0c0){return function(_0x304586){if(_0x304586){return _0x304586[_0xe192('0x25')]()[_0xe192('0x24')](function(){_0x3a2884[_0xe192('0x19')](0xcc)[_0xe192('0x26')]();});}};}function handleEntityNotFound(_0x3c53eb,_0x5422f4){return function(_0x3c647e){if(!_0x3c647e){_0x3c53eb[_0xe192('0x27')](0x194);}return _0x3c647e;};}function handleError(_0x4772ae,_0x174d4b){_0x174d4b=_0x174d4b||0x1f4;return function(_0x1133dd){logger[_0xe192('0x28')](_0x1133dd[_0xe192('0x29')]);if(_0x1133dd['name']){delete _0x1133dd['name'];}_0x4772ae[_0xe192('0x19')](_0x174d4b)[_0xe192('0x2a')](_0x1133dd);};}exports['index']=function(_0x249c29,_0x10a598){var _0x338c7b={},_0x1f32ca={},_0x1e2cfc={'count':0x0,'rows':[]};var _0x19cad2=_['map'](db['Migration'][_0xe192('0x2b')],function(_0x5d7145){return{'name':_0x5d7145[_0xe192('0x2c')],'type':_0x5d7145['type'][_0xe192('0x2d')]};});_0x1f32ca[_0xe192('0x2e')]=_[_0xe192('0x2f')](_0x19cad2,_0xe192('0x30'));_0x1f32ca['query']=_[_0xe192('0x31')](_0x249c29[_0xe192('0x32')]);_0x1f32ca[_0xe192('0x33')]=_[_0xe192('0x34')](_0x1f32ca[_0xe192('0x2e')],_0x1f32ca[_0xe192('0x32')]);_0x338c7b[_0xe192('0x35')]=_['intersection'](_0x1f32ca[_0xe192('0x2e')],qs[_0xe192('0x36')](_0x249c29['query'][_0xe192('0x36')]));_0x338c7b[_0xe192('0x35')]=_0x338c7b['attributes']['length']?_0x338c7b[_0xe192('0x35')]:_0x1f32ca[_0xe192('0x2e')];if(!_0x249c29[_0xe192('0x32')]['hasOwnProperty'](_0xe192('0x37'))){_0x338c7b[_0xe192('0x1e')]=qs[_0xe192('0x1e')](_0x249c29[_0xe192('0x32')][_0xe192('0x1e')]);_0x338c7b[_0xe192('0x1b')]=qs[_0xe192('0x1b')](_0x249c29['query']['offset']);}_0x338c7b[_0xe192('0x38')]=qs[_0xe192('0x39')](_0x249c29['query'][_0xe192('0x39')]);_0x338c7b[_0xe192('0x3a')]=qs[_0xe192('0x33')](_['pick'](_0x249c29[_0xe192('0x32')],_0x1f32ca[_0xe192('0x33')]),_0x19cad2);if(_0x249c29[_0xe192('0x32')]['filter']){_0x338c7b['where']=_[_0xe192('0x3b')](_0x338c7b[_0xe192('0x3a')],{'$or':_[_0xe192('0x2f')](_0x19cad2,function(_0x3908e0){if(_0x3908e0[_0xe192('0x3c')]!==_0xe192('0x3d')){var _0x16120f={};_0x16120f[_0x3908e0[_0xe192('0x30')]]={'$like':'%'+_0x249c29[_0xe192('0x32')][_0xe192('0x3e')]+'%'};return _0x16120f;}})});}_0x338c7b=_[_0xe192('0x3b')]({},_0x338c7b,_0x249c29[_0xe192('0x3f')]);var _0x5d4fee={'where':_0x338c7b[_0xe192('0x3a')]};return db[_0xe192('0x40')]['count'](_0x5d4fee)[_0xe192('0x24')](function(_0x427c14){_0x1e2cfc[_0xe192('0x1d')]=_0x427c14;if(_0x249c29[_0xe192('0x32')][_0xe192('0x41')]){_0x338c7b[_0xe192('0x42')]=[{'all':!![]}];}return db['Migration']['findAll'](_0x338c7b);})[_0xe192('0x24')](function(_0xbf8782){_0x1e2cfc[_0xe192('0x43')]=_0xbf8782;return _0x1e2cfc;})['then'](respondWithFilteredResult(_0x10a598,_0x338c7b))[_0xe192('0x44')](handleError(_0x10a598,null));}; \ No newline at end of file +var _0xa783=['save','update','then','end','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','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','set','Content-Range','apply','reject'];(function(_0xa54fc7,_0x540a74){var _0xe909b1=function(_0xd3f416){while(--_0xd3f416){_0xa54fc7['push'](_0xa54fc7['shift']());}};_0xe909b1(++_0x540a74);}(_0xa783,0x1c5));var _0x3a78=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xa783[_0xdea41a];return _0x15d0d8;};'use strict';var emlformat=require(_0x3a78('0x0'));var rimraf=require(_0x3a78('0x1'));var zipdir=require(_0x3a78('0x2'));var jsonpatch=require(_0x3a78('0x3'));var rp=require(_0x3a78('0x4'));var moment=require('moment');var BPromise=require(_0x3a78('0x5'));var Mustache=require(_0x3a78('0x6'));var util=require(_0x3a78('0x7'));var path=require(_0x3a78('0x8'));var sox=require(_0x3a78('0x9'));var csv=require('to-csv');var ejs=require(_0x3a78('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3a78('0xb'));var squel=require(_0x3a78('0xc'));var crypto=require(_0x3a78('0xd'));var jsforce=require(_0x3a78('0xe'));var deskjs=require(_0x3a78('0xf'));var toCsv=require(_0x3a78('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3a78('0x11'));var authService=require(_0x3a78('0x12'));var qs=require(_0x3a78('0x13'));var as=require(_0x3a78('0x14'));var hardwareService=require(_0x3a78('0x15'));var logger=require(_0x3a78('0x16'))('api');var utils=require(_0x3a78('0x17'));var config=require(_0x3a78('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3a78('0x19'))['db'];function respondWithStatusCode(_0x321de0,_0x3c9dad){_0x3c9dad=_0x3c9dad||0xcc;return function(_0x1fa2a0){if(_0x1fa2a0){return _0x321de0[_0x3a78('0x1a')](_0x3c9dad);}return _0x321de0[_0x3a78('0x1b')](_0x3c9dad)['end']();};}function respondWithResult(_0x115fd0,_0x4312f8){_0x4312f8=_0x4312f8||0xc8;return function(_0x44a259){if(_0x44a259){return _0x115fd0[_0x3a78('0x1b')](_0x4312f8)[_0x3a78('0x1c')](_0x44a259);}};}function respondWithFilteredResult(_0x4fdda7,_0x1a34bf){return function(_0x43dbc8){if(_0x43dbc8){var _0x70df20=typeof _0x1a34bf[_0x3a78('0x1d')]==='undefined'&&typeof _0x1a34bf[_0x3a78('0x1e')]===_0x3a78('0x1f');var _0x3234b4=_0x43dbc8[_0x3a78('0x20')];var _0x438c33=_0x70df20?0x0:_0x1a34bf[_0x3a78('0x1d')];var _0x3f6a6f=_0x70df20?_0x43dbc8[_0x3a78('0x20')]:_0x1a34bf[_0x3a78('0x1d')]+_0x1a34bf[_0x3a78('0x1e')];var _0x526e9d;if(_0x3f6a6f>=_0x3234b4){_0x3f6a6f=_0x3234b4;_0x526e9d=0xc8;}else{_0x526e9d=0xce;}_0x4fdda7['status'](_0x526e9d);return _0x4fdda7[_0x3a78('0x21')](_0x3a78('0x22'),_0x438c33+'-'+_0x3f6a6f+'/'+_0x3234b4)[_0x3a78('0x1c')](_0x43dbc8);}return null;};}function patchUpdates(_0x20c160){return function(_0x29888c){try{jsonpatch[_0x3a78('0x23')](_0x29888c,_0x20c160,!![]);}catch(_0x309eae){return BPromise[_0x3a78('0x24')](_0x309eae);}return _0x29888c[_0x3a78('0x25')]();};}function saveUpdates(_0x32e7ce,_0x31a2ca){return function(_0x36946d){if(_0x36946d){return _0x36946d[_0x3a78('0x26')](_0x32e7ce)[_0x3a78('0x27')](function(_0x3f0a18){return _0x3f0a18;});}return null;};}function removeEntity(_0x43083b,_0x2349f7){return function(_0x3aa62d){if(_0x3aa62d){return _0x3aa62d['destroy']()['then'](function(){_0x43083b[_0x3a78('0x1b')](0xcc)[_0x3a78('0x28')]();});}};}function handleEntityNotFound(_0xd0947,_0x387e0a){return function(_0x1fc29b){if(!_0x1fc29b){_0xd0947[_0x3a78('0x1a')](0x194);}return _0x1fc29b;};}function handleError(_0x4c5a88,_0x21174c){_0x21174c=_0x21174c||0x1f4;return function(_0x3af4c4){logger[_0x3a78('0x29')](_0x3af4c4[_0x3a78('0x2a')]);if(_0x3af4c4[_0x3a78('0x2b')]){delete _0x3af4c4[_0x3a78('0x2b')];}_0x4c5a88['status'](_0x21174c)[_0x3a78('0x2c')](_0x3af4c4);};}exports[_0x3a78('0x2d')]=function(_0x14c36,_0x448b15){var _0x98f0be={},_0x4277be={},_0x1ac25={'count':0x0,'rows':[]};var _0x361dec=_[_0x3a78('0x2e')](db[_0x3a78('0x2f')][_0x3a78('0x30')],function(_0x560b45){return{'name':_0x560b45[_0x3a78('0x31')],'type':_0x560b45['type']['key']};});_0x4277be['model']=_[_0x3a78('0x2e')](_0x361dec,'name');_0x4277be[_0x3a78('0x32')]=_[_0x3a78('0x33')](_0x14c36[_0x3a78('0x32')]);_0x4277be[_0x3a78('0x34')]=_[_0x3a78('0x35')](_0x4277be['model'],_0x4277be['query']);_0x98f0be[_0x3a78('0x36')]=_[_0x3a78('0x35')](_0x4277be['model'],qs[_0x3a78('0x37')](_0x14c36[_0x3a78('0x32')][_0x3a78('0x37')]));_0x98f0be['attributes']=_0x98f0be[_0x3a78('0x36')][_0x3a78('0x38')]?_0x98f0be['attributes']:_0x4277be['model'];if(!_0x14c36[_0x3a78('0x32')][_0x3a78('0x39')]('nolimit')){_0x98f0be['limit']=qs[_0x3a78('0x1e')](_0x14c36[_0x3a78('0x32')][_0x3a78('0x1e')]);_0x98f0be[_0x3a78('0x1d')]=qs[_0x3a78('0x1d')](_0x14c36['query']['offset']);}_0x98f0be[_0x3a78('0x3a')]=qs[_0x3a78('0x3b')](_0x14c36[_0x3a78('0x32')][_0x3a78('0x3b')]);_0x98f0be[_0x3a78('0x3c')]=qs[_0x3a78('0x34')](_[_0x3a78('0x3d')](_0x14c36['query'],_0x4277be['filters']),_0x361dec);if(_0x14c36[_0x3a78('0x32')][_0x3a78('0x3e')]){_0x98f0be[_0x3a78('0x3c')]=_[_0x3a78('0x3f')](_0x98f0be['where'],{'$or':_[_0x3a78('0x2e')](_0x361dec,function(_0x8ad39d){if(_0x8ad39d[_0x3a78('0x40')]!=='VIRTUAL'){var _0x41c9d2={};_0x41c9d2[_0x8ad39d['name']]={'$like':'%'+_0x14c36['query'][_0x3a78('0x3e')]+'%'};return _0x41c9d2;}})});}_0x98f0be=_[_0x3a78('0x3f')]({},_0x98f0be,_0x14c36[_0x3a78('0x41')]);var _0x19a883={'where':_0x98f0be[_0x3a78('0x3c')]};return db[_0x3a78('0x2f')][_0x3a78('0x20')](_0x19a883)[_0x3a78('0x27')](function(_0x29497b){_0x1ac25['count']=_0x29497b;if(_0x14c36['query'][_0x3a78('0x42')]){_0x98f0be['include']=[{'all':!![]}];}return db[_0x3a78('0x2f')][_0x3a78('0x43')](_0x98f0be);})['then'](function(_0x195003){_0x1ac25[_0x3a78('0x44')]=_0x195003;return _0x1ac25;})[_0x3a78('0x27')](respondWithFilteredResult(_0x448b15,_0x98f0be))[_0x3a78('0x45')](handleError(_0x448b15,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index ab730c6..48e0890 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 _0x7d4c=['migrations','../../config/logger','api','moment','request-promise','../../config/environment','./migration.attributes','exports','define','Migration'];(function(_0x41963f,_0x863402){var _0x4e544d=function(_0x17f839){while(--_0x17f839){_0x41963f['push'](_0x41963f['shift']());}};_0x4e544d(++_0x863402);}(_0x7d4c,0x1cd));var _0xc7d4=function(_0x3bef2c,_0x5a86fd){_0x3bef2c=_0x3bef2c-0x0;var _0x331503=_0x7d4c[_0x3bef2c];return _0x331503;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc7d4('0x0'))(_0xc7d4('0x1'));var moment=require(_0xc7d4('0x2'));var BPromise=require('bluebird');var rp=require(_0xc7d4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc7d4('0x4'));var attributes=require(_0xc7d4('0x5'));module[_0xc7d4('0x6')]=function(_0x2db6a0,_0x401b04){return _0x2db6a0[_0xc7d4('0x7')](_0xc7d4('0x8'),attributes,{'tableName':_0xc7d4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f88=['exports','define','Migration','migrations','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./migration.attributes'];(function(_0x2c753c,_0x3378e7){var _0x23ba20=function(_0xac82d){while(--_0xac82d){_0x2c753c['push'](_0x2c753c['shift']());}};_0x23ba20(++_0x3378e7);}(_0x7f88,0x18a));var _0x87f8=function(_0x1673c7,_0x49edd6){_0x1673c7=_0x1673c7-0x0;var _0x1a7828=_0x7f88[_0x1673c7];return _0x1a7828;};'use strict';var _=require(_0x87f8('0x0'));var util=require(_0x87f8('0x1'));var logger=require('../../config/logger')(_0x87f8('0x2'));var moment=require(_0x87f8('0x3'));var BPromise=require(_0x87f8('0x4'));var rp=require(_0x87f8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x87f8('0x6'));var config=require(_0x87f8('0x7'));var attributes=require(_0x87f8('0x8'));module[_0x87f8('0x9')]=function(_0x2ee4c8,_0x1c0fc3){return _0x2ee4c8[_0x87f8('0xa')](_0x87f8('0xb'),attributes,{'tableName':_0x87f8('0xc'),'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 5cc43eb..d7e6973 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 _0x235a=['http','then','Migration,\x20%s,\x20%s','debug','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x21a0db,_0x42aa69){var _0x45b602=function(_0x1da543){while(--_0x1da543){_0x21a0db['push'](_0x21a0db['shift']());}};_0x45b602(++_0x42aa69);}(_0x235a,0x1ef));var _0xa235=function(_0x1ecbda,_0x13bcb5){_0x1ecbda=_0x1ecbda-0x0;var _0x32594c=_0x235a[_0x1ecbda];return _0x32594c;};'use strict';var _=require(_0xa235('0x0'));var util=require(_0xa235('0x1'));var moment=require(_0xa235('0x2'));var BPromise=require('bluebird');var rs=require(_0xa235('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa235('0x4'))['db'];var utils=require(_0xa235('0x5'));var logger=require(_0xa235('0x6'))(_0xa235('0x7'));var config=require(_0xa235('0x8'));var jayson=require(_0xa235('0x9'));var client=jayson[_0xa235('0xa')][_0xa235('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b849b,_0x2e535e,_0x2dc1ba){return new BPromise(function(_0x450e27,_0x2f3403){return client['request'](_0x4b849b,_0x2dc1ba)[_0xa235('0xc')](function(_0x561602){logger['info'](_0xa235('0xd'),_0x2e535e,'request\x20sent');logger[_0xa235('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0x2e535e,'request\x20sent',JSON['stringify'](_0x561602));if(_0x561602[_0xa235('0xf')]){if(_0x561602[_0xa235('0xf')][_0xa235('0x10')]===0x1f4){logger[_0xa235('0xf')]('Migration,\x20%s,\x20%s',_0x2e535e,_0x561602['error']['message']);return _0x2f3403(_0x561602[_0xa235('0xf')][_0xa235('0x11')]);}logger[_0xa235('0xf')](_0xa235('0xd'),_0x2e535e,_0x561602[_0xa235('0xf')][_0xa235('0x11')]);return _0x450e27(_0x561602[_0xa235('0xf')][_0xa235('0x11')]);}else{logger[_0xa235('0x12')]('Migration,\x20%s,\x20%s',_0x2e535e,_0xa235('0x13'));_0x450e27(_0x561602[_0xa235('0x14')][_0xa235('0x11')]);}})[_0xa235('0x15')](function(_0x16dbe9){logger[_0xa235('0xf')]('Migration,\x20%s,\x20%s',_0x2e535e,_0x16dbe9);_0x2f3403(_0x16dbe9);});});} \ No newline at end of file +var _0x0e35=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2b70f8,_0x33de31){var _0x1bffd4=function(_0x5807b9){while(--_0x5807b9){_0x2b70f8['push'](_0x2b70f8['shift']());}};_0x1bffd4(++_0x33de31);}(_0x0e35,0xc2));var _0x50e3=function(_0x193a2d,_0x3f3127){_0x193a2d=_0x193a2d-0x0;var _0x4db8eb=_0x0e35[_0x193a2d];return _0x4db8eb;};'use strict';var _=require(_0x50e3('0x0'));var util=require(_0x50e3('0x1'));var moment=require(_0x50e3('0x2'));var BPromise=require(_0x50e3('0x3'));var rs=require(_0x50e3('0x4'));var fs=require('fs');var Redis=require(_0x50e3('0x5'));var db=require(_0x50e3('0x6'))['db'];var utils=require(_0x50e3('0x7'));var logger=require(_0x50e3('0x8'))(_0x50e3('0x9'));var config=require('../../config/environment');var jayson=require(_0x50e3('0xa'));var client=jayson[_0x50e3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5defe6,_0x2ac084,_0x1ed6ec){return new BPromise(function(_0x57bb5f,_0x48382f){return client[_0x50e3('0xc')](_0x5defe6,_0x1ed6ec)[_0x50e3('0xd')](function(_0x3e0a06){logger[_0x50e3('0xe')](_0x50e3('0xf'),_0x2ac084,_0x50e3('0x10'));logger[_0x50e3('0x11')](_0x50e3('0x12'),_0x2ac084,_0x50e3('0x10'),JSON[_0x50e3('0x13')](_0x3e0a06));if(_0x3e0a06[_0x50e3('0x14')]){if(_0x3e0a06[_0x50e3('0x14')][_0x50e3('0x15')]===0x1f4){logger['error'](_0x50e3('0xf'),_0x2ac084,_0x3e0a06[_0x50e3('0x14')][_0x50e3('0x16')]);return _0x48382f(_0x3e0a06[_0x50e3('0x14')]['message']);}logger[_0x50e3('0x14')](_0x50e3('0xf'),_0x2ac084,_0x3e0a06['error'][_0x50e3('0x16')]);return _0x57bb5f(_0x3e0a06[_0x50e3('0x14')][_0x50e3('0x16')]);}else{logger[_0x50e3('0xe')](_0x50e3('0xf'),_0x2ac084,'request\x20sent');_0x57bb5f(_0x3e0a06[_0x50e3('0x17')]['message']);}})[_0x50e3('0x18')](function(_0x1bf9df){logger[_0x50e3('0x14')]('Migration,\x20%s,\x20%s',_0x2ac084,_0x1bf9df);_0x48382f(_0x1bf9df);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 9a9112b..5af5c88 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 _0xc029=['show','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id'];(function(_0x895b28,_0x39f7bd){var _0x19eea5=function(_0x9f419e){while(--_0x9f419e){_0x895b28['push'](_0x895b28['shift']());}};_0x19eea5(++_0x39f7bd);}(_0xc029,0x1df));var _0x9c02=function(_0x1e8b1e,_0x407bbd){_0x1e8b1e=_0x1e8b1e-0x0;var _0x4a0fde=_0xc029[_0x1e8b1e];return _0x4a0fde;};'use strict';var multer=require(_0x9c02('0x0'));var util=require(_0x9c02('0x1'));var path=require(_0x9c02('0x2'));var timeout=require(_0x9c02('0x3'));var express=require(_0x9c02('0x4'));var router=express[_0x9c02('0x5')]();var fs_extra=require(_0x9c02('0x6'));var auth=require(_0x9c02('0x7'));var interaction=require(_0x9c02('0x8'));var config=require(_0x9c02('0x9'));var controller=require(_0x9c02('0xa'));router[_0x9c02('0xb')]('/',auth[_0x9c02('0xc')](),controller[_0x9c02('0xd')]);router[_0x9c02('0xb')](_0x9c02('0xe'),auth[_0x9c02('0xc')](),controller[_0x9c02('0xf')]);router['post']('/',auth[_0x9c02('0xc')](),controller['create']);router[_0x9c02('0x10')](_0x9c02('0xe'),auth[_0x9c02('0xc')](),controller[_0x9c02('0x11')]);router['delete'](_0x9c02('0xe'),auth['isAuthenticated'](),controller[_0x9c02('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa2c6=['../../components/interaction/service','../../config/environment','./network.controller','get','/:id','isAuthenticated','show','post','create','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x550b1d,_0x3ffff0){var _0x1c5b25=function(_0x4b81ef){while(--_0x4b81ef){_0x550b1d['push'](_0x550b1d['shift']());}};_0x1c5b25(++_0x3ffff0);}(_0xa2c6,0x1bb));var _0x6a2c=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xa2c6[_0x29d915];return _0x160f86;};'use strict';var multer=require(_0x6a2c('0x0'));var util=require('util');var path=require(_0x6a2c('0x1'));var timeout=require(_0x6a2c('0x2'));var express=require(_0x6a2c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6a2c('0x4'));var interaction=require(_0x6a2c('0x5'));var config=require(_0x6a2c('0x6'));var controller=require(_0x6a2c('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6a2c('0x8')](_0x6a2c('0x9'),auth[_0x6a2c('0xa')](),controller[_0x6a2c('0xb')]);router[_0x6a2c('0xc')]('/',auth['isAuthenticated'](),controller[_0x6a2c('0xd')]);router['put'](_0x6a2c('0x9'),auth[_0x6a2c('0xa')](),controller['update']);router['delete'](_0x6a2c('0x9'),auth[_0x6a2c('0xa')](),controller[_0x6a2c('0xe')]);module[_0x6a2c('0xf')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 562efe2..5a9bcfa 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 _0xe861=['ENUM','localnet','externip','stun','turn','STRING','exports'];(function(_0x131585,_0x1abd33){var _0x1fcca2=function(_0x8f165b){while(--_0x8f165b){_0x131585['push'](_0x131585['shift']());}};_0x1fcca2(++_0x1abd33);}(_0xe861,0x1a3));var _0x1e86=function(_0x1911a1,_0x3252cf){_0x1911a1=_0x1911a1-0x0;var _0x58572a=_0xe861[_0x1911a1];return _0x58572a;};'use strict';var Sequelize=require('sequelize');module[_0x1e86('0x0')]={'type':{'type':Sequelize[_0x1e86('0x1')](_0x1e86('0x2'),_0x1e86('0x3'),_0x1e86('0x4'),_0x1e86('0x5'))},'value':{'type':Sequelize[_0x1e86('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfd8b=['ENUM','externip','stun','turn','STRING','sequelize'];(function(_0x14ccae,_0x6b138f){var _0x317cc6=function(_0x330faa){while(--_0x330faa){_0x14ccae['push'](_0x14ccae['shift']());}};_0x317cc6(++_0x6b138f);}(_0xfd8b,0x1b5));var _0xbfd8=function(_0x842858,_0x3a3ca0){_0x842858=_0x842858-0x0;var _0x46c2a2=_0xfd8b[_0x842858];return _0x46c2a2;};'use strict';var Sequelize=require(_0xbfd8('0x0'));module['exports']={'type':{'type':Sequelize[_0xbfd8('0x1')]('localnet',_0xbfd8('0x2'),_0xbfd8('0x3'),_0xbfd8('0x4'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xbfd8('0x5')]},'password':{'type':Sequelize[_0xbfd8('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 4802dbf..f251194 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 _0x530e=['save','update','destroy','sendStatus','stack','index','map','Network','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','params','keys','rawAttributes','include','find','create','transaction','body','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','render','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','catch','chan_sip.so','STUN','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','http','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','info','result','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x1c978f,_0x5edd0a){var _0x5c9861=function(_0x5f232f){while(--_0x5f232f){_0x1c978f['push'](_0x1c978f['shift']());}};_0x5c9861(++_0x5edd0a);}(_0x530e,0x10c));var _0xe530=function(_0x1c8fc0,_0x2bfdee){_0x1c8fc0=_0x1c8fc0-0x0;var _0x540d6d=_0x530e[_0x1c8fc0];return _0x540d6d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe530('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe530('0x1'));var rp=require(_0xe530('0x2'));var moment=require(_0xe530('0x3'));var BPromise=require(_0xe530('0x4'));var Mustache=require('mustache');var util=require(_0xe530('0x5'));var path=require(_0xe530('0x6'));var sox=require(_0xe530('0x7'));var csv=require('to-csv');var ejs=require(_0xe530('0x8'));var fs=require('fs');var fs_extra=require(_0xe530('0x9'));var _=require(_0xe530('0xa'));var squel=require('squel');var crypto=require(_0xe530('0xb'));var jsforce=require(_0xe530('0xc'));var deskjs=require(_0xe530('0xd'));var toCsv=require(_0xe530('0xe'));var querystring=require(_0xe530('0xf'));var Papa=require(_0xe530('0x10'));var Redis=require(_0xe530('0x11'));var authService=require(_0xe530('0x12'));var qs=require(_0xe530('0x13'));var as=require(_0xe530('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe530('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe530('0x16'));var db=require(_0xe530('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xe530('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x1d71c9,_0xb8b74,_0x361f89,_0x119a3f){return new BPromise(function(_0x59a494,_0x1f005d){var _0x4b6e7d=_0x119a3f||client;return _0x4b6e7d[_0xe530('0x19')](_0x1d71c9,_0x361f89)[_0xe530('0x1a')](function(_0x363be3){logger['info'](_0xe530('0x1b'),_0xb8b74,_0xe530('0x1c'));logger[_0xe530('0x1d')](_0xe530('0x1e'),_0xb8b74,'request\x20sent',JSON['stringify'](_0x363be3));if(_0x363be3[_0xe530('0x1f')]){if(_0x363be3[_0xe530('0x1f')][_0xe530('0x20')]===0x1f4){logger[_0xe530('0x1f')](_0xe530('0x1b'),_0xb8b74,_0x363be3[_0xe530('0x1f')][_0xe530('0x21')]);return _0x1f005d(_0x363be3[_0xe530('0x1f')][_0xe530('0x21')]);}logger[_0xe530('0x1f')](_0xe530('0x1b'),_0xb8b74,_0x363be3[_0xe530('0x1f')][_0xe530('0x21')]);return _0x59a494(_0x363be3[_0xe530('0x1f')]['message']);}else{logger[_0xe530('0x22')]('Network,\x20%s,\x20%s',_0xb8b74,_0xe530('0x1c'));_0x59a494(_0x363be3[_0xe530('0x23')][_0xe530('0x21')]);}})['catch'](function(_0x52cad2){logger[_0xe530('0x1f')]('Network,\x20%s,\x20%s',_0xb8b74,_0x52cad2);_0x1f005d(_0x52cad2);});});}function respondWithStatusCode(_0x41d6cd,_0x28a7f7){_0x28a7f7=_0x28a7f7||0xcc;return function(_0x334630){if(_0x334630){return _0x41d6cd['sendStatus'](_0x28a7f7);}return _0x41d6cd[_0xe530('0x24')](_0x28a7f7)[_0xe530('0x25')]();};}function respondWithResult(_0x10ff16,_0x42696b){_0x42696b=_0x42696b||0xc8;return function(_0x4bfa22){if(_0x4bfa22){return _0x10ff16['status'](_0x42696b)[_0xe530('0x26')](_0x4bfa22);}};}function respondWithFilteredResult(_0x56e064,_0x4564f5){return function(_0xba4818){if(_0xba4818){var _0x436eaf=typeof _0x4564f5[_0xe530('0x27')]===_0xe530('0x28')&&typeof _0x4564f5[_0xe530('0x29')]===_0xe530('0x28');var _0x2dd206=_0xba4818[_0xe530('0x2a')];var _0x3b4606=_0x436eaf?0x0:_0x4564f5[_0xe530('0x27')];var _0x591265=_0x436eaf?_0xba4818['count']:_0x4564f5[_0xe530('0x27')]+_0x4564f5['limit'];var _0x393f1e;if(_0x591265>=_0x2dd206){_0x591265=_0x2dd206;_0x393f1e=0xc8;}else{_0x393f1e=0xce;}_0x56e064['status'](_0x393f1e);return _0x56e064[_0xe530('0x2b')](_0xe530('0x2c'),_0x3b4606+'-'+_0x591265+'/'+_0x2dd206)[_0xe530('0x26')](_0xba4818);}return null;};}function patchUpdates(_0xaee18d){return function(_0x3de672){try{jsonpatch[_0xe530('0x2d')](_0x3de672,_0xaee18d,!![]);}catch(_0x50fa81){return BPromise[_0xe530('0x2e')](_0x50fa81);}return _0x3de672[_0xe530('0x2f')]();};}function saveUpdates(_0x302bc2,_0x1a644a){return function(_0xfcaa74){if(_0xfcaa74){return _0xfcaa74[_0xe530('0x30')](_0x302bc2)[_0xe530('0x1a')](function(_0x4c715c){return _0x4c715c;});}return null;};}function removeEntity(_0x2b97f0,_0x41d381){return function(_0x3187d8){if(_0x3187d8){return _0x3187d8[_0xe530('0x31')]()[_0xe530('0x1a')](function(){_0x2b97f0[_0xe530('0x24')](0xcc)[_0xe530('0x25')]();});}};}function handleEntityNotFound(_0x4064fc,_0x487dc9){return function(_0x3ae87c){if(!_0x3ae87c){_0x4064fc[_0xe530('0x32')](0x194);}return _0x3ae87c;};}function handleError(_0xaa4f0,_0x4cd411){_0x4cd411=_0x4cd411||0x1f4;return function(_0x3438c6){logger[_0xe530('0x1f')](_0x3438c6[_0xe530('0x33')]);if(_0x3438c6['name']){delete _0x3438c6['name'];}_0xaa4f0[_0xe530('0x24')](_0x4cd411)['send'](_0x3438c6);};}exports[_0xe530('0x34')]=function(_0x403e1f,_0x330c33){var _0x26726e={},_0x2040da={},_0x5a4aec={'count':0x0,'rows':[]};var _0x360ae9=_[_0xe530('0x35')](db[_0xe530('0x36')]['rawAttributes'],function(_0x5f540d){return{'name':_0x5f540d[_0xe530('0x37')],'type':_0x5f540d[_0xe530('0x38')][_0xe530('0x39')]};});_0x2040da[_0xe530('0x3a')]=_[_0xe530('0x35')](_0x360ae9,_0xe530('0x3b'));_0x2040da[_0xe530('0x3c')]=_['keys'](_0x403e1f['query']);_0x2040da[_0xe530('0x3d')]=_[_0xe530('0x3e')](_0x2040da[_0xe530('0x3a')],_0x2040da['query']);_0x26726e[_0xe530('0x3f')]=_[_0xe530('0x3e')](_0x2040da[_0xe530('0x3a')],qs['fields'](_0x403e1f['query'][_0xe530('0x40')]));_0x26726e[_0xe530('0x3f')]=_0x26726e[_0xe530('0x3f')][_0xe530('0x41')]?_0x26726e[_0xe530('0x3f')]:_0x2040da[_0xe530('0x3a')];if(!_0x403e1f[_0xe530('0x3c')][_0xe530('0x42')](_0xe530('0x43'))){_0x26726e[_0xe530('0x29')]=qs[_0xe530('0x29')](_0x403e1f[_0xe530('0x3c')][_0xe530('0x29')]);_0x26726e[_0xe530('0x27')]=qs['offset'](_0x403e1f[_0xe530('0x3c')][_0xe530('0x27')]);}_0x26726e['order']=qs['sort'](_0x403e1f['query'][_0xe530('0x44')]);_0x26726e[_0xe530('0x45')]=qs[_0xe530('0x3d')](_[_0xe530('0x46')](_0x403e1f['query'],_0x2040da['filters']),_0x360ae9);if(_0x403e1f[_0xe530('0x3c')]['filter']){_0x26726e[_0xe530('0x45')]=_[_0xe530('0x47')](_0x26726e[_0xe530('0x45')],{'$or':_[_0xe530('0x35')](_0x360ae9,function(_0x2dc2fc){if(_0x2dc2fc[_0xe530('0x38')]!==_0xe530('0x48')){var _0x95da79={};_0x95da79[_0x2dc2fc[_0xe530('0x3b')]]={'$like':'%'+_0x403e1f['query'][_0xe530('0x49')]+'%'};return _0x95da79;}})});}_0x26726e=_['merge']({},_0x26726e,_0x403e1f[_0xe530('0x4a')]);var _0xb2e1ff={'where':_0x26726e['where']};return db[_0xe530('0x36')][_0xe530('0x2a')](_0xb2e1ff)['then'](function(_0x43e64d){_0x5a4aec[_0xe530('0x2a')]=_0x43e64d;if(_0x403e1f[_0xe530('0x3c')][_0xe530('0x4b')]){_0x26726e['include']=[{'all':!![]}];}return db[_0xe530('0x36')][_0xe530('0x4c')](_0x26726e);})[_0xe530('0x1a')](function(_0x35a330){_0x5a4aec['rows']=_0x35a330;return _0x5a4aec;})[_0xe530('0x1a')](respondWithFilteredResult(_0x330c33,_0x26726e))['catch'](handleError(_0x330c33,null));};exports['show']=function(_0x24af3b,_0x6716c0){var _0xbb7e44={'raw':!![],'where':{'id':_0x24af3b[_0xe530('0x4d')]['id']}},_0x2b20c2={};_0x2b20c2[_0xe530('0x3a')]=_[_0xe530('0x4e')](db[_0xe530('0x36')][_0xe530('0x4f')]);_0x2b20c2[_0xe530('0x3c')]=_[_0xe530('0x4e')](_0x24af3b[_0xe530('0x3c')]);_0x2b20c2[_0xe530('0x3d')]=_['intersection'](_0x2b20c2[_0xe530('0x3a')],_0x2b20c2['query']);_0xbb7e44[_0xe530('0x3f')]=_[_0xe530('0x3e')](_0x2b20c2[_0xe530('0x3a')],qs[_0xe530('0x40')](_0x24af3b['query']['fields']));_0xbb7e44[_0xe530('0x3f')]=_0xbb7e44[_0xe530('0x3f')][_0xe530('0x41')]?_0xbb7e44[_0xe530('0x3f')]:_0x2b20c2[_0xe530('0x3a')];if(_0x24af3b[_0xe530('0x3c')][_0xe530('0x4b')]){_0xbb7e44[_0xe530('0x50')]=[{'all':!![]}];}_0xbb7e44=_[_0xe530('0x47')]({},_0xbb7e44,_0x24af3b['options']);return db['Network'][_0xe530('0x51')](_0xbb7e44)[_0xe530('0x1a')](handleEntityNotFound(_0x6716c0,null))['then'](respondWithResult(_0x6716c0,null))['catch'](handleError(_0x6716c0,null));};exports[_0xe530('0x52')]=function(_0x38e360,_0x39c0d1,_0x438cf6){var _0x3c9e22;return db['sequelize'][_0xe530('0x53')](function(_0x2c5675){return db[_0xe530('0x36')][_0xe530('0x52')](_0x38e360[_0xe530('0x54')],{'raw':!![]})[_0xe530('0x1a')](function(_0x3cd0f5){_0x3c9e22=_0x3cd0f5;return db[_0xe530('0x36')]['findAll']({'where':{'type':_0x38e360['body'][_0xe530('0x38')]},'raw':!![]});})[_0xe530('0x1a')](function(_0x1c4588){if(_0x3c9e22['type'][_0xe530('0x55')]()=='STUN'){var _0x6ff882=fs[_0xe530('0x56')](path[_0xe530('0x57')](config[_0xe530('0x58')],_0xe530('0x59')),_0xe530('0x5a'));var _0x102c61=ejs['render'](_0x6ff882,{'networks':_0x1c4588||[]});fs[_0xe530('0x5b')](_0xe530('0x5c'),_0x102c61);return respondWithRpcPromise(_0xe530('0x5d'),'create',{'module':_0xe530('0x5e')});}else if(_0x3c9e22[_0xe530('0x38')][_0xe530('0x55')]()=='TURN'){var _0x4cdf36=fs[_0xe530('0x56')](path[_0xe530('0x57')](config[_0xe530('0x58')],_0xe530('0x5f')),_0xe530('0x5a'));var _0x55d8e7=ejs['render'](_0x4cdf36,{'networks':_0x1c4588||[]});fs[_0xe530('0x5b')](_0xe530('0x60'),_0x55d8e7);return respondWithRpcPromise(_0xe530('0x5d'),_0xe530('0x52'),{'module':'res_stun_monitor.so'});}else{var _0xa9b3d8=fs[_0xe530('0x56')](path[_0xe530('0x57')](config[_0xe530('0x58')],_0xe530('0x61')),'utf8');var _0xf8620a=ejs[_0xe530('0x62')](_0xa9b3d8,{'networks':_0x1c4588||[]});fs[_0xe530('0x5b')](util[_0xe530('0x63')](_0xe530('0x64'),_0x38e360[_0xe530('0x54')]['type'][_0xe530('0x65')]()),_0xf8620a);return respondWithRpcPromise(_0xe530('0x5d'),_0xe530('0x52'),{'module':'chan_sip.so'});}return null;})[_0xe530('0x1a')](function(){return _0x3c9e22;});})[_0xe530('0x1a')](respondWithResult(_0x39c0d1,0xc9))[_0xe530('0x66')](handleError(_0x39c0d1,null));};exports[_0xe530('0x30')]=function(_0x17ed91,_0x308762,_0x1f43d2){var _0x221720;return db['sequelize'][_0xe530('0x53')](function(_0x19e9ee){return db[_0xe530('0x36')][_0xe530('0x51')]({'where':{'id':_0x17ed91[_0xe530('0x4d')]['id']}})[_0xe530('0x1a')](handleEntityNotFound(_0x308762,null))[_0xe530('0x1a')](saveUpdates(_0x17ed91[_0xe530('0x54')],null))['then'](function(_0x2c0d3d){if(_0x2c0d3d){_0x221720=_0x2c0d3d;return db[_0xe530('0x36')][_0xe530('0x4c')]({'where':{'type':_0x221720[_0xe530('0x38')]},'raw':!![]});}return null;})[_0xe530('0x1a')](function(_0x167628){if(_0x221720[_0xe530('0x38')][_0xe530('0x55')]()=='STUN'){var _0x323519=fs['readFileSync'](path['join'](config[_0xe530('0x58')],_0xe530('0x59')),_0xe530('0x5a'));var _0x1f95c9=ejs['render'](_0x323519,{'networks':_0x167628||[]});fs[_0xe530('0x5b')](_0xe530('0x5c'),_0x1f95c9);return respondWithRpcPromise(_0xe530('0x5d'),_0xe530('0x30'),{'module':'res_stun_monitor.so'});}else if(_0x221720[_0xe530('0x38')][_0xe530('0x55')]()=='TURN'){var _0x291284=fs[_0xe530('0x56')](path[_0xe530('0x57')](config[_0xe530('0x58')],'server/files/templates/turn_multiple.ejs'),_0xe530('0x5a'));var _0x3a0d15=ejs[_0xe530('0x62')](_0x291284,{'networks':_0x167628||[]});fs[_0xe530('0x5b')](_0xe530('0x60'),_0x3a0d15);return respondWithRpcPromise(_0xe530('0x5d'),_0xe530('0x30'),{'module':_0xe530('0x5e')});}else{var _0x45eb79=fs[_0xe530('0x56')](path[_0xe530('0x57')](config[_0xe530('0x58')],_0xe530('0x61')),_0xe530('0x5a'));var _0x5d936f=ejs[_0xe530('0x62')](_0x45eb79,{'networks':_0x167628||[]});fs[_0xe530('0x5b')](util[_0xe530('0x63')](_0xe530('0x64'),_0x17ed91[_0xe530('0x54')][_0xe530('0x38')]['toLowerCase']()),_0x5d936f);return respondWithRpcPromise(_0xe530('0x5d'),'update',{'module':_0xe530('0x67')});}return null;})['then'](function(_0x33494b){if(_0x33494b){return _0x221720;}return null;});})[_0xe530('0x1a')](respondWithResult(_0x308762,null))[_0xe530('0x66')](handleError(_0x308762,null));};exports[_0xe530('0x31')]=function(_0x204077,_0x1d37c1,_0x167bfd){var _0x55aaac;return db[_0xe530('0x36')][_0xe530('0x51')]({'where':{'id':_0x204077[_0xe530('0x4d')]['id']}})['then'](function(_0x2f651d){_0x55aaac=_0x2f651d;return _0x2f651d;})['then'](handleEntityNotFound(_0x1d37c1,null))[_0xe530('0x1a')](removeEntity(_0x1d37c1,null))[_0xe530('0x1a')](function(){if(_0x55aaac){return db['Network'][_0xe530('0x4c')]({'where':{'type':_0x55aaac['type']},'raw':!![]});}})[_0xe530('0x1a')](function(_0x43421c){if(_0x55aaac[_0xe530('0x38')][_0xe530('0x55')]()==_0xe530('0x68')){var _0x993cb4=fs[_0xe530('0x56')](path[_0xe530('0x57')](config[_0xe530('0x58')],_0xe530('0x59')),'utf8');var _0x35446d=ejs[_0xe530('0x62')](_0x993cb4,{'networks':_0x43421c||[]});fs[_0xe530('0x5b')]('/etc/asterisk/stun_xcally.conf',_0x35446d);return respondWithRpcPromise(_0xe530('0x5d'),_0xe530('0x31'),{'module':_0xe530('0x5e')});}else if(_0x55aaac[_0xe530('0x38')]['toUpperCase']()=='TURN'){var _0x4db8f2=fs[_0xe530('0x56')](path[_0xe530('0x57')](config[_0xe530('0x58')],_0xe530('0x5f')),_0xe530('0x5a'));var _0x4fc1d8=ejs[_0xe530('0x62')](_0x4db8f2,{'networks':_0x43421c||[]});fs['writeFileSync'](_0xe530('0x60'),_0x4fc1d8);return respondWithRpcPromise('Reload','destroy',{'module':'res_stun_monitor.so'});}else{var _0x50d3bb=fs[_0xe530('0x56')](path[_0xe530('0x57')](config[_0xe530('0x58')],_0xe530('0x61')),_0xe530('0x5a'));var _0x5ba8a7=ejs['render'](_0x50d3bb,{'networks':_0x43421c||[]});fs[_0xe530('0x5b')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x204077[_0xe530('0x54')][_0xe530('0x38')][_0xe530('0x65')]()),_0x5ba8a7);return respondWithRpcPromise('Reload',_0xe530('0x31'),{'module':'chan_sip.so'});}return null;})[_0xe530('0x66')](handleError(_0x1d37c1,null));}; \ No newline at end of file +var _0x8a5e=['../../config/environment','../../mysqldb','client','http','request','then','Network,\x20%s,\x20%s','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','end','stack','name','send','index','Network','fieldName','type','key','map','query','keys','model','attributes','intersection','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','sequelize','transaction','body','findAll','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','server/files/templates/turn_multiple.ejs','writeFileSync','server/files/templates/network.ejs','utf8','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','/etc/asterisk/turn_xcally.conf','toLowerCase','eml-format','zip-dir','fast-json-patch','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x8a5e,0xc0));var _0xe8a5=function(_0x4bb516,_0x37884f){_0x4bb516=_0x4bb516-0x0;var _0x435871=_0x8a5e[_0x4bb516];return _0x435871;};'use strict';var emlformat=require(_0xe8a5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe8a5('0x1'));var jsonpatch=require(_0xe8a5('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe8a5('0x3'));var util=require('util');var path=require(_0xe8a5('0x4'));var sox=require('sox');var csv=require(_0xe8a5('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8a5('0x6'));var _=require(_0xe8a5('0x7'));var squel=require(_0xe8a5('0x8'));var crypto=require(_0xe8a5('0x9'));var jsforce=require(_0xe8a5('0xa'));var deskjs=require(_0xe8a5('0xb'));var toCsv=require(_0xe8a5('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe8a5('0xc'));var authService=require(_0xe8a5('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xe8a5('0xe'));var hardwareService=require(_0xe8a5('0xf'));var logger=require('../../config/logger')(_0xe8a5('0x10'));var utils=require(_0xe8a5('0x11'));var config=require(_0xe8a5('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xe8a5('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe8a5('0x14')][_0xe8a5('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x37432f,_0x42c984,_0x465ef5,_0x132892){return new BPromise(function(_0x3825c1,_0x315aba){var _0x59662a=_0x132892||client;return _0x59662a[_0xe8a5('0x16')](_0x37432f,_0x465ef5)[_0xe8a5('0x17')](function(_0x40ffce){logger['info'](_0xe8a5('0x18'),_0x42c984,'request\x20sent');logger['debug'](_0xe8a5('0x19'),_0x42c984,_0xe8a5('0x1a'),JSON[_0xe8a5('0x1b')](_0x40ffce));if(_0x40ffce['error']){if(_0x40ffce[_0xe8a5('0x1c')][_0xe8a5('0x1d')]===0x1f4){logger[_0xe8a5('0x1c')](_0xe8a5('0x18'),_0x42c984,_0x40ffce[_0xe8a5('0x1c')][_0xe8a5('0x1e')]);return _0x315aba(_0x40ffce[_0xe8a5('0x1c')][_0xe8a5('0x1e')]);}logger['error'](_0xe8a5('0x18'),_0x42c984,_0x40ffce[_0xe8a5('0x1c')][_0xe8a5('0x1e')]);return _0x3825c1(_0x40ffce[_0xe8a5('0x1c')][_0xe8a5('0x1e')]);}else{logger['info'](_0xe8a5('0x18'),_0x42c984,_0xe8a5('0x1a'));_0x3825c1(_0x40ffce[_0xe8a5('0x1f')][_0xe8a5('0x1e')]);}})['catch'](function(_0x55f684){logger[_0xe8a5('0x1c')](_0xe8a5('0x18'),_0x42c984,_0x55f684);_0x315aba(_0x55f684);});});}function respondWithStatusCode(_0x136868,_0x3932d4){_0x3932d4=_0x3932d4||0xcc;return function(_0x18f654){if(_0x18f654){return _0x136868[_0xe8a5('0x20')](_0x3932d4);}return _0x136868[_0xe8a5('0x21')](_0x3932d4)['end']();};}function respondWithResult(_0x54a4e3,_0x1df5c4){_0x1df5c4=_0x1df5c4||0xc8;return function(_0x1fd6ae){if(_0x1fd6ae){return _0x54a4e3[_0xe8a5('0x21')](_0x1df5c4)[_0xe8a5('0x22')](_0x1fd6ae);}};}function respondWithFilteredResult(_0x477b15,_0x401cf6){return function(_0x1e135c){if(_0x1e135c){var _0x12caab=typeof _0x401cf6[_0xe8a5('0x23')]===_0xe8a5('0x24')&&typeof _0x401cf6[_0xe8a5('0x25')]===_0xe8a5('0x24');var _0x46b706=_0x1e135c['count'];var _0x3d66a2=_0x12caab?0x0:_0x401cf6['offset'];var _0x57d421=_0x12caab?_0x1e135c[_0xe8a5('0x26')]:_0x401cf6['offset']+_0x401cf6[_0xe8a5('0x25')];var _0x5d0c36;if(_0x57d421>=_0x46b706){_0x57d421=_0x46b706;_0x5d0c36=0xc8;}else{_0x5d0c36=0xce;}_0x477b15[_0xe8a5('0x21')](_0x5d0c36);return _0x477b15[_0xe8a5('0x27')](_0xe8a5('0x28'),_0x3d66a2+'-'+_0x57d421+'/'+_0x46b706)[_0xe8a5('0x22')](_0x1e135c);}return null;};}function patchUpdates(_0x105ae4){return function(_0x4a46e1){try{jsonpatch[_0xe8a5('0x29')](_0x4a46e1,_0x105ae4,!![]);}catch(_0x2360c9){return BPromise['reject'](_0x2360c9);}return _0x4a46e1[_0xe8a5('0x2a')]();};}function saveUpdates(_0x27bcab,_0x1ecead){return function(_0x34c83e){if(_0x34c83e){return _0x34c83e[_0xe8a5('0x2b')](_0x27bcab)[_0xe8a5('0x17')](function(_0x1446e6){return _0x1446e6;});}return null;};}function removeEntity(_0x141a56,_0xb3a1fe){return function(_0x4ef175){if(_0x4ef175){return _0x4ef175[_0xe8a5('0x2c')]()[_0xe8a5('0x17')](function(){_0x141a56['status'](0xcc)[_0xe8a5('0x2d')]();});}};}function handleEntityNotFound(_0x5f5589,_0x355f05){return function(_0x5587b4){if(!_0x5587b4){_0x5f5589[_0xe8a5('0x20')](0x194);}return _0x5587b4;};}function handleError(_0x3c329d,_0x1e166e){_0x1e166e=_0x1e166e||0x1f4;return function(_0x16f0b6){logger[_0xe8a5('0x1c')](_0x16f0b6[_0xe8a5('0x2e')]);if(_0x16f0b6[_0xe8a5('0x2f')]){delete _0x16f0b6[_0xe8a5('0x2f')];}_0x3c329d[_0xe8a5('0x21')](_0x1e166e)[_0xe8a5('0x30')](_0x16f0b6);};}exports[_0xe8a5('0x31')]=function(_0x1be5ea,_0x1b124b){var _0x1e3433={},_0x446ade={},_0x1e0049={'count':0x0,'rows':[]};var _0x3bbd60=_['map'](db[_0xe8a5('0x32')]['rawAttributes'],function(_0x40c730){return{'name':_0x40c730[_0xe8a5('0x33')],'type':_0x40c730[_0xe8a5('0x34')][_0xe8a5('0x35')]};});_0x446ade['model']=_[_0xe8a5('0x36')](_0x3bbd60,_0xe8a5('0x2f'));_0x446ade[_0xe8a5('0x37')]=_[_0xe8a5('0x38')](_0x1be5ea[_0xe8a5('0x37')]);_0x446ade['filters']=_['intersection'](_0x446ade[_0xe8a5('0x39')],_0x446ade[_0xe8a5('0x37')]);_0x1e3433[_0xe8a5('0x3a')]=_[_0xe8a5('0x3b')](_0x446ade[_0xe8a5('0x39')],qs[_0xe8a5('0x3c')](_0x1be5ea[_0xe8a5('0x37')]['fields']));_0x1e3433[_0xe8a5('0x3a')]=_0x1e3433['attributes']['length']?_0x1e3433['attributes']:_0x446ade[_0xe8a5('0x39')];if(!_0x1be5ea['query']['hasOwnProperty'](_0xe8a5('0x3d'))){_0x1e3433['limit']=qs[_0xe8a5('0x25')](_0x1be5ea[_0xe8a5('0x37')]['limit']);_0x1e3433[_0xe8a5('0x23')]=qs[_0xe8a5('0x23')](_0x1be5ea[_0xe8a5('0x37')]['offset']);}_0x1e3433[_0xe8a5('0x3e')]=qs[_0xe8a5('0x3f')](_0x1be5ea['query'][_0xe8a5('0x3f')]);_0x1e3433[_0xe8a5('0x40')]=qs[_0xe8a5('0x41')](_[_0xe8a5('0x42')](_0x1be5ea[_0xe8a5('0x37')],_0x446ade['filters']),_0x3bbd60);if(_0x1be5ea[_0xe8a5('0x37')][_0xe8a5('0x43')]){_0x1e3433['where']=_[_0xe8a5('0x44')](_0x1e3433[_0xe8a5('0x40')],{'$or':_['map'](_0x3bbd60,function(_0x33db91){if(_0x33db91[_0xe8a5('0x34')]!==_0xe8a5('0x45')){var _0x844e62={};_0x844e62[_0x33db91[_0xe8a5('0x2f')]]={'$like':'%'+_0x1be5ea['query'][_0xe8a5('0x43')]+'%'};return _0x844e62;}})});}_0x1e3433=_[_0xe8a5('0x44')]({},_0x1e3433,_0x1be5ea[_0xe8a5('0x46')]);var _0x3f56c7={'where':_0x1e3433['where']};return db[_0xe8a5('0x32')]['count'](_0x3f56c7)[_0xe8a5('0x17')](function(_0x576d58){_0x1e0049[_0xe8a5('0x26')]=_0x576d58;if(_0x1be5ea[_0xe8a5('0x37')][_0xe8a5('0x47')]){_0x1e3433[_0xe8a5('0x48')]=[{'all':!![]}];}return db[_0xe8a5('0x32')]['findAll'](_0x1e3433);})[_0xe8a5('0x17')](function(_0x3056c6){_0x1e0049[_0xe8a5('0x49')]=_0x3056c6;return _0x1e0049;})['then'](respondWithFilteredResult(_0x1b124b,_0x1e3433))[_0xe8a5('0x4a')](handleError(_0x1b124b,null));};exports[_0xe8a5('0x4b')]=function(_0xd9b7fd,_0x3c7a2f){var _0x1ced64={'raw':!![],'where':{'id':_0xd9b7fd[_0xe8a5('0x4c')]['id']}},_0x11cb4e={};_0x11cb4e[_0xe8a5('0x39')]=_[_0xe8a5('0x38')](db['Network'][_0xe8a5('0x4d')]);_0x11cb4e[_0xe8a5('0x37')]=_[_0xe8a5('0x38')](_0xd9b7fd['query']);_0x11cb4e[_0xe8a5('0x41')]=_[_0xe8a5('0x3b')](_0x11cb4e[_0xe8a5('0x39')],_0x11cb4e[_0xe8a5('0x37')]);_0x1ced64['attributes']=_[_0xe8a5('0x3b')](_0x11cb4e[_0xe8a5('0x39')],qs['fields'](_0xd9b7fd[_0xe8a5('0x37')][_0xe8a5('0x3c')]));_0x1ced64[_0xe8a5('0x3a')]=_0x1ced64[_0xe8a5('0x3a')][_0xe8a5('0x4e')]?_0x1ced64[_0xe8a5('0x3a')]:_0x11cb4e[_0xe8a5('0x39')];if(_0xd9b7fd[_0xe8a5('0x37')]['includeAll']){_0x1ced64[_0xe8a5('0x48')]=[{'all':!![]}];}_0x1ced64=_[_0xe8a5('0x44')]({},_0x1ced64,_0xd9b7fd[_0xe8a5('0x46')]);return db[_0xe8a5('0x32')][_0xe8a5('0x4f')](_0x1ced64)[_0xe8a5('0x17')](handleEntityNotFound(_0x3c7a2f,null))[_0xe8a5('0x17')](respondWithResult(_0x3c7a2f,null))['catch'](handleError(_0x3c7a2f,null));};exports[_0xe8a5('0x50')]=function(_0xf3570d,_0x5de257,_0x2409c5){var _0x1c091c;return db[_0xe8a5('0x51')][_0xe8a5('0x52')](function(_0x16c6ef){return db[_0xe8a5('0x32')][_0xe8a5('0x50')](_0xf3570d[_0xe8a5('0x53')],{'raw':!![]})[_0xe8a5('0x17')](function(_0x42703d){_0x1c091c=_0x42703d;return db[_0xe8a5('0x32')][_0xe8a5('0x54')]({'where':{'type':_0xf3570d['body']['type']},'raw':!![]});})[_0xe8a5('0x17')](function(_0x509706){if(_0x1c091c[_0xe8a5('0x34')]['toUpperCase']()==_0xe8a5('0x55')){var _0x16df6a=fs[_0xe8a5('0x56')](path[_0xe8a5('0x57')](config[_0xe8a5('0x58')],_0xe8a5('0x59')),'utf8');var _0x4a5b05=ejs[_0xe8a5('0x5a')](_0x16df6a,{'networks':_0x509706||[]});fs['writeFileSync'](_0xe8a5('0x5b'),_0x4a5b05);return respondWithRpcPromise(_0xe8a5('0x5c'),_0xe8a5('0x50'),{'module':_0xe8a5('0x5d')});}else if(_0x1c091c[_0xe8a5('0x34')][_0xe8a5('0x5e')]()==_0xe8a5('0x5f')){var _0x32fe65=fs[_0xe8a5('0x56')](path['join'](config['root'],_0xe8a5('0x60')),'utf8');var _0x52b47a=ejs['render'](_0x32fe65,{'networks':_0x509706||[]});fs[_0xe8a5('0x61')]('/etc/asterisk/turn_xcally.conf',_0x52b47a);return respondWithRpcPromise(_0xe8a5('0x5c'),'create',{'module':'res_stun_monitor.so'});}else{var _0x20b248=fs[_0xe8a5('0x56')](path[_0xe8a5('0x57')](config[_0xe8a5('0x58')],_0xe8a5('0x62')),_0xe8a5('0x63'));var _0x688489=ejs[_0xe8a5('0x5a')](_0x20b248,{'networks':_0x509706||[]});fs[_0xe8a5('0x61')](util[_0xe8a5('0x64')](_0xe8a5('0x65'),_0xf3570d['body']['type']['toLowerCase']()),_0x688489);return respondWithRpcPromise(_0xe8a5('0x5c'),'create',{'module':_0xe8a5('0x66')});}return null;})[_0xe8a5('0x17')](function(){return _0x1c091c;});})[_0xe8a5('0x17')](respondWithResult(_0x5de257,0xc9))[_0xe8a5('0x4a')](handleError(_0x5de257,null));};exports[_0xe8a5('0x2b')]=function(_0x285b1b,_0x5071e5,_0x3bdbd4){var _0x23bc3c;return db[_0xe8a5('0x51')]['transaction'](function(_0x2506de){return db[_0xe8a5('0x32')][_0xe8a5('0x4f')]({'where':{'id':_0x285b1b[_0xe8a5('0x4c')]['id']}})[_0xe8a5('0x17')](handleEntityNotFound(_0x5071e5,null))[_0xe8a5('0x17')](saveUpdates(_0x285b1b[_0xe8a5('0x53')],null))[_0xe8a5('0x17')](function(_0x206aae){if(_0x206aae){_0x23bc3c=_0x206aae;return db[_0xe8a5('0x32')][_0xe8a5('0x54')]({'where':{'type':_0x23bc3c[_0xe8a5('0x34')]},'raw':!![]});}return null;})[_0xe8a5('0x17')](function(_0x119739){if(_0x23bc3c[_0xe8a5('0x34')][_0xe8a5('0x5e')]()==_0xe8a5('0x55')){var _0x450931=fs[_0xe8a5('0x56')](path[_0xe8a5('0x57')](config[_0xe8a5('0x58')],_0xe8a5('0x59')),_0xe8a5('0x63'));var _0x38a6e1=ejs[_0xe8a5('0x5a')](_0x450931,{'networks':_0x119739||[]});fs[_0xe8a5('0x61')](_0xe8a5('0x5b'),_0x38a6e1);return respondWithRpcPromise(_0xe8a5('0x5c'),_0xe8a5('0x2b'),{'module':_0xe8a5('0x5d')});}else if(_0x23bc3c[_0xe8a5('0x34')][_0xe8a5('0x5e')]()=='TURN'){var _0x3cc477=fs[_0xe8a5('0x56')](path['join'](config['root'],_0xe8a5('0x60')),'utf8');var _0xf87078=ejs[_0xe8a5('0x5a')](_0x3cc477,{'networks':_0x119739||[]});fs[_0xe8a5('0x61')](_0xe8a5('0x67'),_0xf87078);return respondWithRpcPromise(_0xe8a5('0x5c'),_0xe8a5('0x2b'),{'module':_0xe8a5('0x5d')});}else{var _0x3aea2d=fs[_0xe8a5('0x56')](path[_0xe8a5('0x57')](config['root'],_0xe8a5('0x62')),_0xe8a5('0x63'));var _0x57fa5b=ejs['render'](_0x3aea2d,{'networks':_0x119739||[]});fs[_0xe8a5('0x61')](util[_0xe8a5('0x64')]('/etc/asterisk/sip_xcally_%s.conf',_0x285b1b[_0xe8a5('0x53')][_0xe8a5('0x34')][_0xe8a5('0x68')]()),_0x57fa5b);return respondWithRpcPromise('Reload',_0xe8a5('0x2b'),{'module':_0xe8a5('0x66')});}return null;})[_0xe8a5('0x17')](function(_0x1843ae){if(_0x1843ae){return _0x23bc3c;}return null;});})['then'](respondWithResult(_0x5071e5,null))[_0xe8a5('0x4a')](handleError(_0x5071e5,null));};exports['destroy']=function(_0x29b692,_0x295cd6,_0x517601){var _0x3c69e8;return db[_0xe8a5('0x32')]['find']({'where':{'id':_0x29b692['params']['id']}})[_0xe8a5('0x17')](function(_0x569a49){_0x3c69e8=_0x569a49;return _0x569a49;})['then'](handleEntityNotFound(_0x295cd6,null))[_0xe8a5('0x17')](removeEntity(_0x295cd6,null))['then'](function(){if(_0x3c69e8){return db[_0xe8a5('0x32')][_0xe8a5('0x54')]({'where':{'type':_0x3c69e8['type']},'raw':!![]});}})[_0xe8a5('0x17')](function(_0x2305fd){if(_0x3c69e8[_0xe8a5('0x34')]['toUpperCase']()=='STUN'){var _0x1cf645=fs[_0xe8a5('0x56')](path[_0xe8a5('0x57')](config[_0xe8a5('0x58')],_0xe8a5('0x59')),_0xe8a5('0x63'));var _0x1ecfc8=ejs[_0xe8a5('0x5a')](_0x1cf645,{'networks':_0x2305fd||[]});fs['writeFileSync'](_0xe8a5('0x5b'),_0x1ecfc8);return respondWithRpcPromise('Reload',_0xe8a5('0x2c'),{'module':_0xe8a5('0x5d')});}else if(_0x3c69e8[_0xe8a5('0x34')]['toUpperCase']()==_0xe8a5('0x5f')){var _0x3d0148=fs[_0xe8a5('0x56')](path[_0xe8a5('0x57')](config[_0xe8a5('0x58')],_0xe8a5('0x60')),'utf8');var _0x509f23=ejs[_0xe8a5('0x5a')](_0x3d0148,{'networks':_0x2305fd||[]});fs['writeFileSync'](_0xe8a5('0x67'),_0x509f23);return respondWithRpcPromise(_0xe8a5('0x5c'),_0xe8a5('0x2c'),{'module':'res_stun_monitor.so'});}else{var _0x173f25=fs[_0xe8a5('0x56')](path[_0xe8a5('0x57')](config[_0xe8a5('0x58')],_0xe8a5('0x62')),_0xe8a5('0x63'));var _0xeddf71=ejs[_0xe8a5('0x5a')](_0x173f25,{'networks':_0x2305fd||[]});fs['writeFileSync'](util[_0xe8a5('0x64')](_0xe8a5('0x65'),_0x29b692[_0xe8a5('0x53')][_0xe8a5('0x34')][_0xe8a5('0x68')]()),_0xeddf71);return respondWithRpcPromise(_0xe8a5('0x5c'),_0xe8a5('0x2c'),{'module':'chan_sip.so'});}return null;})[_0xe8a5('0x4a')](handleError(_0x295cd6,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index d6b65dc..7b65ce5 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 _0xbb53=['define','Network','network','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x53d03d,_0x5f08d7){var _0x13b886=function(_0x102d58){while(--_0x102d58){_0x53d03d['push'](_0x53d03d['shift']());}};_0x13b886(++_0x5f08d7);}(_0xbb53,0x121));var _0x3bb5=function(_0x56bf42,_0x4958ac){_0x56bf42=_0x56bf42-0x0;var _0x78c3e5=_0xbb53[_0x56bf42];return _0x78c3e5;};'use strict';var _=require(_0x3bb5('0x0'));var util=require(_0x3bb5('0x1'));var logger=require(_0x3bb5('0x2'))(_0x3bb5('0x3'));var moment=require(_0x3bb5('0x4'));var BPromise=require(_0x3bb5('0x5'));var rp=require(_0x3bb5('0x6'));var fs=require('fs');var path=require(_0x3bb5('0x7'));var rimraf=require(_0x3bb5('0x8'));var config=require(_0x3bb5('0x9'));var attributes=require('./network.attributes');module['exports']=function(_0x23f11e,_0x2460b0){return _0x23f11e[_0x3bb5('0xa')](_0x3bb5('0xb'),attributes,{'tableName':_0x3bb5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4eb=['./network.attributes','exports','define','network','lodash','bluebird','rimraf','../../config/environment'];(function(_0x2145c0,_0x549319){var _0x4c613a=function(_0x4e7350){while(--_0x4e7350){_0x2145c0['push'](_0x2145c0['shift']());}};_0x4c613a(++_0x549319);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4c3dac,_0x459bd6){_0x4c3dac=_0x4c3dac-0x0;var _0x44985c=_0xf4eb[_0x4c3dac];return _0x44985c;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbf4e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var attributes=require(_0xbf4e('0x4'));module[_0xbf4e('0x5')]=function(_0xa4dcf5,_0x2fcfed){return _0xa4dcf5[_0xbf4e('0x6')]('Network',attributes,{'tableName':_0xbf4e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 286fdc3..1cb563c 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x3ed454,_0x5e2215){_0x3ed454=_0x3ed454-0x0;var _0x196881=_0x7a54[_0x3ed454];return _0x196881;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _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(_0x43f04d,_0x1e2639){var _0x339a44=function(_0x1b5045){while(--_0x1b5045){_0x43f04d['push'](_0x43f04d['shift']());}};_0x339a44(++_0x1e2639);}(_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 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 diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 28f4107..11e99bb 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 _0x8e91=['getApplications','/:id/interactions','getInteractions','create','post','addAnswer','/:id/notify','addApplications','/:id/users','addAgents','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications'];(function(_0x12c693,_0x288e80){var _0x1cb0ac=function(_0x47301a){while(--_0x47301a){_0x12c693['push'](_0x12c693['shift']());}};_0x1cb0ac(++_0x288e80);}(_0x8e91,0x1ac));var _0x18e9=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x8e91[_0x36884e];return _0x1cc367;};'use strict';var multer=require(_0x18e9('0x0'));var util=require(_0x18e9('0x1'));var path=require('path');var timeout=require(_0x18e9('0x2'));var express=require('express');var router=express[_0x18e9('0x3')]();var fs_extra=require(_0x18e9('0x4'));var auth=require(_0x18e9('0x5'));var interaction=require(_0x18e9('0x6'));var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router[_0x18e9('0x7')]('/',auth[_0x18e9('0x8')](),controller['index']);router[_0x18e9('0x7')]('/describe',auth[_0x18e9('0x8')](),controller['describe']);router[_0x18e9('0x7')]('/:id',auth[_0x18e9('0x8')](),controller[_0x18e9('0x9')]);router[_0x18e9('0x7')](_0x18e9('0xa'),auth[_0x18e9('0x8')](),controller['getDispositions']);router[_0x18e9('0x7')](_0x18e9('0xb'),auth[_0x18e9('0x8')](),controller[_0x18e9('0xc')]);router['get'](_0x18e9('0xd'),auth[_0x18e9('0x8')](),controller[_0x18e9('0xe')]);router['get'](_0x18e9('0xf'),auth['isAuthenticated'](),controller[_0x18e9('0x10')]);router[_0x18e9('0x7')]('/:id/users',auth[_0x18e9('0x8')](),controller['getAgents']);router['post']('/',auth[_0x18e9('0x8')](),controller[_0x18e9('0x11')]);router[_0x18e9('0x12')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0x18e9('0x12')]('/:id/canned_answers',auth[_0x18e9('0x8')](),controller[_0x18e9('0x13')]);router[_0x18e9('0x12')](_0x18e9('0x14'),controller['notify']);router[_0x18e9('0x12')]('/:id/applications',auth[_0x18e9('0x8')](),controller[_0x18e9('0x15')]);router[_0x18e9('0x12')](_0x18e9('0x16'),auth['isAuthenticated'](),controller[_0x18e9('0x17')]);router[_0x18e9('0x12')](_0x18e9('0x18'),auth['isAuthenticated'](),controller[_0x18e9('0x19')]);router[_0x18e9('0x1a')](_0x18e9('0x1b'),auth[_0x18e9('0x8')](),controller[_0x18e9('0x1c')]);router[_0x18e9('0x1d')](_0x18e9('0x1b'),auth[_0x18e9('0x8')](),controller[_0x18e9('0x1e')]);router[_0x18e9('0x1d')](_0x18e9('0xa'),auth[_0x18e9('0x8')](),controller[_0x18e9('0x1f')]);router[_0x18e9('0x1d')]('/:id/canned_answers',auth[_0x18e9('0x8')](),controller['removeAnswers']);router[_0x18e9('0x1d')](_0x18e9('0x16'),auth['isAuthenticated'](),controller[_0x18e9('0x20')]);module[_0x18e9('0x21')]=router; \ No newline at end of file +var _0x3ef5=['addDisposition','addAnswer','notify','addApplications','addAgents','/:id/send','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','post','create'];(function(_0x5429ec,_0xd6b53e){var _0x12166a=function(_0x5c8d70){while(--_0x5c8d70){_0x5429ec['push'](_0x5429ec['shift']());}};_0x12166a(++_0xd6b53e);}(_0x3ef5,0x164));var _0x53ef=function(_0x6ed83e,_0x5c406c){_0x6ed83e=_0x6ed83e-0x0;var _0x4a5d59=_0x3ef5[_0x6ed83e];return _0x4a5d59;};'use strict';var multer=require(_0x53ef('0x0'));var util=require(_0x53ef('0x1'));var path=require(_0x53ef('0x2'));var timeout=require(_0x53ef('0x3'));var express=require(_0x53ef('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x53ef('0x5'));var interaction=require(_0x53ef('0x6'));var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router[_0x53ef('0x7')]('/',auth[_0x53ef('0x8')](),controller[_0x53ef('0x9')]);router['get'](_0x53ef('0xa'),auth[_0x53ef('0x8')](),controller[_0x53ef('0xb')]);router[_0x53ef('0x7')](_0x53ef('0xc'),auth[_0x53ef('0x8')](),controller[_0x53ef('0xd')]);router[_0x53ef('0x7')](_0x53ef('0xe'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x53ef('0x7')](_0x53ef('0xf'),auth[_0x53ef('0x8')](),controller[_0x53ef('0x10')]);router[_0x53ef('0x7')](_0x53ef('0x11'),auth[_0x53ef('0x8')](),controller[_0x53ef('0x12')]);router[_0x53ef('0x7')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x53ef('0x13')]);router[_0x53ef('0x7')](_0x53ef('0x14'),auth[_0x53ef('0x8')](),controller[_0x53ef('0x15')]);router[_0x53ef('0x16')]('/',auth['isAuthenticated'](),controller[_0x53ef('0x17')]);router[_0x53ef('0x16')]('/:id/dispositions',auth[_0x53ef('0x8')](),controller[_0x53ef('0x18')]);router['post'](_0x53ef('0xf'),auth['isAuthenticated'](),controller[_0x53ef('0x19')]);router['post']('/:id/notify',controller[_0x53ef('0x1a')]);router['post'](_0x53ef('0x11'),auth['isAuthenticated'](),controller[_0x53ef('0x1b')]);router[_0x53ef('0x16')](_0x53ef('0x14'),auth[_0x53ef('0x8')](),controller[_0x53ef('0x1c')]);router['post'](_0x53ef('0x1d'),auth[_0x53ef('0x8')](),controller['send']);router[_0x53ef('0x1e')]('/:id',auth[_0x53ef('0x8')](),controller[_0x53ef('0x1f')]);router['delete'](_0x53ef('0xc'),auth[_0x53ef('0x8')](),controller[_0x53ef('0x20')]);router[_0x53ef('0x21')]('/:id/dispositions',auth[_0x53ef('0x8')](),controller[_0x53ef('0x22')]);router[_0x53ef('0x21')]('/:id/canned_answers',auth[_0x53ef('0x8')](),controller[_0x53ef('0x23')]);router['delete'](_0x53ef('0x14'),auth[_0x53ef('0x8')](),controller[_0x53ef('0x24')]);module[_0x53ef('0x25')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index ddad504..9f7aef2 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 _0xe54a=['generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name'];(function(_0x5ea4e2,_0x4d83a7){var _0x4babb4=function(_0x2dcfcc){while(--_0x2dcfcc){_0x5ea4e2['push'](_0x5ea4e2['shift']());}};_0x4babb4(++_0x4d83a7);}(_0xe54a,0x100));var _0xae54=function(_0x3e1d65,_0x5d82e7){_0x3e1d65=_0x3e1d65-0x0;var _0x5ce60c=_0xe54a[_0x3e1d65];return _0x5ce60c;};'use strict';var Sequelize=require(_0xae54('0x0'));var rs=require('randomstring');module[_0xae54('0x1')]={'name':{'type':Sequelize[_0xae54('0x2')],'unique':_0xae54('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xae54('0x2')]},'token':{'type':Sequelize[_0xae54('0x2')],'defaultValue':function(){return rs[_0xae54('0x4')]();}},'replyUri':{'type':Sequelize[_0xae54('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xae54('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xae54('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xae54('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xae54('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xae54('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xae54('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xae54('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xae54('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xae54('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xae54('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xae54('0x6')],'defaultValue':![],'comment':_0xae54('0x9'),'set':function(_0x12d0d6){if(!_0x12d0d6)this[_0xae54('0xa')](_0xae54('0xb'),null);this[_0xae54('0xa')](_0xae54('0xc'),_0x12d0d6);}}}; \ No newline at end of file +var _0xe816=['generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name'];(function(_0x3c9d61,_0x1de4f3){var _0xe14a3f=function(_0x46b58a){while(--_0x46b58a){_0x3c9d61['push'](_0x3c9d61['shift']());}};_0xe14a3f(++_0x1de4f3);}(_0xe816,0xa4));var _0x6e81=function(_0x5eca82,_0x48efe1){_0x5eca82=_0x5eca82-0x0;var _0x55187e=_0xe816[_0x5eca82];return _0x55187e;};'use strict';var Sequelize=require(_0x6e81('0x0'));var rs=require(_0x6e81('0x1'));module[_0x6e81('0x2')]={'name':{'type':Sequelize[_0x6e81('0x3')],'unique':_0x6e81('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x6e81('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x6e81('0x5')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x6e81('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6e81('0x6')],'defaultValue':function(){return _0x6e81('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6e81('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6e81('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x6e81('0x3')]},'queueTransfer':{'type':Sequelize[_0x6e81('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6e81('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6e81('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6e81('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x6e81('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x6e81('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5a91c6){if(!_0x5a91c6)this[_0x6e81('0xb')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x6e81('0xc'),_0x5a91c6);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 5994597..b2842f4 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 _0x9097=['count','set','Content-Range','reject','save','update','destroy','OpenchannelAccounts','UserProfileResource','end','sendStatus','stack','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','show','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','OpenchannelAccountId','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','List','DESC','OpenchannelApplication','account','applications','list','orderBy','priority','asc','Applications','Contacts','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','Contact','User','Owner','fullname','internal','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','out','Messages','dataValues','eml-format','rimraf','zip-dir','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','json','offset','limit'];(function(_0x519c8a,_0x2d1333){var _0x1030aa=function(_0x56de3a){while(--_0x56de3a){_0x519c8a['push'](_0x519c8a['shift']());}};_0x1030aa(++_0x2d1333);}(_0x9097,0x158));var _0x7909=function(_0x5516f0,_0x12fd32){_0x5516f0=_0x5516f0-0x0;var _0x44b6a2=_0x9097[_0x5516f0];return _0x44b6a2;};'use strict';var emlformat=require(_0x7909('0x0'));var rimraf=require(_0x7909('0x1'));var zipdir=require(_0x7909('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7909('0x3'));var util=require(_0x7909('0x4'));var path=require(_0x7909('0x5'));var sox=require(_0x7909('0x6'));var csv=require(_0x7909('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7909('0x8'));var _=require(_0x7909('0x9'));var squel=require(_0x7909('0xa'));var crypto=require('crypto');var jsforce=require(_0x7909('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7909('0x7'));var querystring=require('querystring');var Papa=require(_0x7909('0xc'));var Redis=require(_0x7909('0xd'));var authService=require(_0x7909('0xe'));var qs=require(_0x7909('0xf'));var as=require(_0x7909('0x10'));var hardwareService=require(_0x7909('0x11'));var logger=require(_0x7909('0x12'))(_0x7909('0x13'));var utils=require(_0x7909('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7909('0x15'));var db=require(_0x7909('0x16'))['db'];config[_0x7909('0x17')]=_[_0x7909('0x18')](config['redis'],{'host':_0x7909('0x19'),'port':0x18eb});var socket=require(_0x7909('0x1a'))(new Redis(config[_0x7909('0x17')]));require(_0x7909('0x1b'))['register'](socket);var jayson=require(_0x7909('0x1c'));var client=jayson[_0x7909('0x1d')]['http']({'port':0x232c});var client9002=jayson['client'][_0x7909('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1126fc,_0x56b294,_0x482d75,_0x2450eb){return new BPromise(function(_0x504417,_0x2eda26){var _0x10f969=_0x2450eb||client;return _0x10f969['request'](_0x1126fc,_0x482d75)[_0x7909('0x1f')](function(_0x597b95){logger[_0x7909('0x20')](_0x7909('0x21'),_0x56b294,_0x7909('0x22'));logger[_0x7909('0x23')](_0x7909('0x24'),_0x56b294,'request\x20sent',JSON[_0x7909('0x25')](_0x597b95));if(_0x597b95[_0x7909('0x26')]){if(_0x597b95[_0x7909('0x26')][_0x7909('0x27')]===0x1f4){logger[_0x7909('0x26')](_0x7909('0x21'),_0x56b294,_0x597b95[_0x7909('0x26')][_0x7909('0x28')]);return _0x2eda26(_0x597b95[_0x7909('0x26')][_0x7909('0x28')]);}logger[_0x7909('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x56b294,_0x597b95[_0x7909('0x26')]['message']);return _0x504417(_0x597b95['error']['message']);}else{logger[_0x7909('0x20')](_0x7909('0x21'),_0x56b294,_0x7909('0x22'));_0x504417(_0x597b95[_0x7909('0x29')]['message']);}})['catch'](function(_0x7e62ea){logger[_0x7909('0x26')](_0x7909('0x21'),_0x56b294,_0x7e62ea);_0x2eda26(_0x7e62ea);});});}function respondWithStatusCode(_0x3171df,_0x1a0e6f){_0x1a0e6f=_0x1a0e6f||0xcc;return function(_0x5db138){if(_0x5db138){return _0x3171df['sendStatus'](_0x1a0e6f);}return _0x3171df[_0x7909('0x2a')](_0x1a0e6f)['end']();};}function respondWithResult(_0x1509c8,_0xc6cdce){_0xc6cdce=_0xc6cdce||0xc8;return function(_0x5d8212){if(_0x5d8212){return _0x1509c8[_0x7909('0x2a')](_0xc6cdce)[_0x7909('0x2b')](_0x5d8212);}};}function respondWithFilteredResult(_0x20e757,_0x338da1){return function(_0x4cf097){if(_0x4cf097){var _0x4ea16f=typeof _0x338da1[_0x7909('0x2c')]==='undefined'&&typeof _0x338da1[_0x7909('0x2d')]==='undefined';var _0x1c02f9=_0x4cf097[_0x7909('0x2e')];var _0x328de7=_0x4ea16f?0x0:_0x338da1[_0x7909('0x2c')];var _0x1fd59a=_0x4ea16f?_0x4cf097['count']:_0x338da1[_0x7909('0x2c')]+_0x338da1[_0x7909('0x2d')];var _0x926994;if(_0x1fd59a>=_0x1c02f9){_0x1fd59a=_0x1c02f9;_0x926994=0xc8;}else{_0x926994=0xce;}_0x20e757[_0x7909('0x2a')](_0x926994);return _0x20e757[_0x7909('0x2f')](_0x7909('0x30'),_0x328de7+'-'+_0x1fd59a+'/'+_0x1c02f9)[_0x7909('0x2b')](_0x4cf097);}return null;};}function patchUpdates(_0x5a4ab5){return function(_0x2a3c17){try{jsonpatch['apply'](_0x2a3c17,_0x5a4ab5,!![]);}catch(_0x3bbc27){return BPromise[_0x7909('0x31')](_0x3bbc27);}return _0x2a3c17[_0x7909('0x32')]();};}function saveUpdates(_0xa07995,_0x26ea66){return function(_0x45341a){if(_0x45341a){return _0x45341a[_0x7909('0x33')](_0xa07995)['then'](function(_0x374829){return _0x374829;});}return null;};}function removeEntity(_0x4eb6c4,_0x33f18d){return function(_0x34718b){if(_0x34718b){return _0x34718b[_0x7909('0x34')]()[_0x7909('0x1f')](function(){var _0x294ea9=_0x34718b['get']({'plain':!![]});var _0x3b0f5b=_0x7909('0x35');return db[_0x7909('0x36')][_0x7909('0x34')]({'where':{'type':_0x3b0f5b,'resourceId':_0x294ea9['id']}})[_0x7909('0x1f')](function(){return _0x34718b;});})[_0x7909('0x1f')](function(){_0x4eb6c4[_0x7909('0x2a')](0xcc)[_0x7909('0x37')]();});}};}function handleEntityNotFound(_0x452262,_0xe6ef92){return function(_0x4c43c8){if(!_0x4c43c8){_0x452262[_0x7909('0x38')](0x194);}return _0x4c43c8;};}function handleError(_0x49f00e,_0x3327d7){_0x3327d7=_0x3327d7||0x1f4;return function(_0x311ae5){logger[_0x7909('0x26')](_0x311ae5[_0x7909('0x39')]);if(_0x311ae5['name']){delete _0x311ae5['name'];}_0x49f00e[_0x7909('0x2a')](_0x3327d7)[_0x7909('0x3a')](_0x311ae5);};}exports[_0x7909('0x3b')]=function(_0x9a3bf1,_0x4c4dc6){var _0x22e9cd={'include':[{'model':db[_0x7909('0x3c')],'as':_0x7909('0x3d')}]},_0x47d88b={},_0x5143ea={'count':0x0,'rows':[]};var _0x3088e6=_[_0x7909('0x3e')](db[_0x7909('0x3f')][_0x7909('0x40')],function(_0x143d1d){return{'name':_0x143d1d[_0x7909('0x41')],'type':_0x143d1d['type']['key']};});_0x47d88b[_0x7909('0x42')]=_[_0x7909('0x3e')](_0x3088e6,_0x7909('0x43'));_0x47d88b[_0x7909('0x44')]=_[_0x7909('0x45')](_0x9a3bf1['query']);_0x47d88b[_0x7909('0x46')]=_[_0x7909('0x47')](_0x47d88b[_0x7909('0x42')],_0x47d88b['query']);_0x22e9cd['attributes']=_['intersection'](_0x47d88b['model'],qs[_0x7909('0x48')](_0x9a3bf1['query'][_0x7909('0x48')]));_0x22e9cd[_0x7909('0x49')]=_0x22e9cd[_0x7909('0x49')][_0x7909('0x4a')]?_0x22e9cd['attributes']:_0x47d88b[_0x7909('0x42')];if(!_0x9a3bf1[_0x7909('0x44')][_0x7909('0x4b')]('nolimit')){_0x22e9cd[_0x7909('0x2d')]=qs[_0x7909('0x2d')](_0x9a3bf1[_0x7909('0x44')]['limit']);_0x22e9cd[_0x7909('0x2c')]=qs['offset'](_0x9a3bf1[_0x7909('0x44')][_0x7909('0x2c')]);}_0x22e9cd[_0x7909('0x4c')]=qs['sort'](_0x9a3bf1[_0x7909('0x44')][_0x7909('0x4d')]);_0x22e9cd[_0x7909('0x4e')]=qs['filters'](_[_0x7909('0x4f')](_0x9a3bf1['query'],_0x47d88b[_0x7909('0x46')]),_0x3088e6);if(_0x9a3bf1[_0x7909('0x44')][_0x7909('0x50')]){_0x22e9cd['where']=_[_0x7909('0x51')](_0x22e9cd[_0x7909('0x4e')],{'$or':_['map'](_0x3088e6,function(_0x45a1a4){if(_0x45a1a4[_0x7909('0x52')]!=='VIRTUAL'){var _0x447ab3={};_0x447ab3[_0x45a1a4[_0x7909('0x43')]]={'$like':'%'+_0x9a3bf1['query'][_0x7909('0x50')]+'%'};return _0x447ab3;}})});}_0x22e9cd=_[_0x7909('0x51')]({},_0x22e9cd,_0x9a3bf1['options']);var _0x5ae53e={'where':_0x22e9cd[_0x7909('0x4e')]};return db[_0x7909('0x3f')][_0x7909('0x2e')](_0x5ae53e)[_0x7909('0x1f')](function(_0x1a6d22){_0x5143ea['count']=_0x1a6d22;if(_0x9a3bf1['query'][_0x7909('0x53')]){_0x22e9cd[_0x7909('0x54')]=[{'all':!![]}];}return db[_0x7909('0x3f')][_0x7909('0x55')](_0x22e9cd);})[_0x7909('0x1f')](function(_0x24c8fb){_0x5143ea[_0x7909('0x56')]=_0x24c8fb;return _0x5143ea;})['then'](respondWithFilteredResult(_0x4c4dc6,_0x22e9cd))[_0x7909('0x57')](handleError(_0x4c4dc6,null));};exports[_0x7909('0x58')]=function(_0x35cc0a,_0x533835){var _0x30ec3f={'raw':![],'where':{'id':_0x35cc0a['params']['id']},'include':[{'model':db[_0x7909('0x3c')],'as':_0x7909('0x3d')}]},_0x589e29={};_0x589e29[_0x7909('0x42')]=_['keys'](db[_0x7909('0x3f')]['rawAttributes']);_0x589e29[_0x7909('0x44')]=_[_0x7909('0x45')](_0x35cc0a[_0x7909('0x44')]);_0x589e29['filters']=_[_0x7909('0x47')](_0x589e29[_0x7909('0x42')],_0x589e29[_0x7909('0x44')]);_0x30ec3f['attributes']=_[_0x7909('0x47')](_0x589e29[_0x7909('0x42')],qs['fields'](_0x35cc0a[_0x7909('0x44')][_0x7909('0x48')]));_0x30ec3f['attributes']=_0x30ec3f[_0x7909('0x49')][_0x7909('0x4a')]?_0x30ec3f[_0x7909('0x49')]:_0x589e29['model'];if(_0x35cc0a[_0x7909('0x44')][_0x7909('0x53')]){_0x30ec3f['include']=[{'all':!![]}];}_0x30ec3f=_[_0x7909('0x51')]({},_0x30ec3f,_0x35cc0a[_0x7909('0x59')]);return db[_0x7909('0x3f')][_0x7909('0x5a')](_0x30ec3f)['then'](handleEntityNotFound(_0x533835,null))[_0x7909('0x1f')](respondWithResult(_0x533835,null))[_0x7909('0x57')](handleError(_0x533835,null));};exports[_0x7909('0x5b')]=function(_0xb54db5,_0x5310b7){return db[_0x7909('0x3f')][_0x7909('0x5b')](_0xb54db5[_0x7909('0x5c')],{})[_0x7909('0x1f')](function(_0x23f771){var _0x4ed61d=_0xb54db5['user'][_0x7909('0x5d')]({'plain':!![]});if(!_0x4ed61d)throw new Error(_0x7909('0x5e'));if(_0x4ed61d[_0x7909('0x5f')]===_0x7909('0x60')){var _0x1cfd83=_0x23f771[_0x7909('0x5d')]({'plain':!![]});var _0x427d1f=_0x7909('0x35');return db[_0x7909('0x61')][_0x7909('0x5a')]({'where':{'name':_0x427d1f,'userProfileId':_0x4ed61d[_0x7909('0x62')]},'raw':!![]})[_0x7909('0x1f')](function(_0x378e53){if(_0x378e53&&_0x378e53[_0x7909('0x63')]===0x0){return db[_0x7909('0x36')][_0x7909('0x5b')]({'name':_0x1cfd83[_0x7909('0x43')],'resourceId':_0x1cfd83['id'],'type':_0x378e53[_0x7909('0x43')],'sectionId':_0x378e53['id']},{})[_0x7909('0x1f')](function(){return _0x23f771;});}else{return _0x23f771;}})['catch'](function(_0x913192){logger[_0x7909('0x26')](_0x7909('0x64'),_0x913192);throw _0x913192;});}return _0x23f771;})[_0x7909('0x1f')](respondWithResult(_0x5310b7,0xc9))[_0x7909('0x57')](handleError(_0x5310b7,null));};exports[_0x7909('0x33')]=function(_0x10a99c,_0x4f9604){if(_0x10a99c[_0x7909('0x5c')]['id']){delete _0x10a99c[_0x7909('0x5c')]['id'];}return db['OpenchannelAccount'][_0x7909('0x5a')]({'where':{'id':_0x10a99c['params']['id']},'include':[{'model':db[_0x7909('0x3c')],'as':'mandatoryDispositionPause'}]})[_0x7909('0x1f')](handleEntityNotFound(_0x4f9604,null))[_0x7909('0x1f')](saveUpdates(_0x10a99c[_0x7909('0x5c')],null))['then'](respondWithResult(_0x4f9604,null))['catch'](handleError(_0x4f9604,null));};exports[_0x7909('0x34')]=function(_0x4a0728,_0x12e136){return db['OpenchannelAccount'][_0x7909('0x5a')]({'where':{'id':_0x4a0728[_0x7909('0x65')]['id']}})[_0x7909('0x1f')](handleEntityNotFound(_0x12e136,null))['then'](removeEntity(_0x12e136,null))[_0x7909('0x57')](handleError(_0x12e136,null));};exports[_0x7909('0x66')]=function(_0x158c57,_0x48d052){return db[_0x7909('0x3f')]['describe']()[_0x7909('0x1f')](respondWithResult(_0x48d052,null))[_0x7909('0x57')](handleError(_0x48d052,null));};exports[_0x7909('0x67')]=function(_0x207b17,_0x52f6d6,_0x3071bb){if(_0x207b17[_0x7909('0x5c')]['id']){delete _0x207b17[_0x7909('0x5c')]['id'];}return db[_0x7909('0x3f')][_0x7909('0x5a')]({'where':{'id':_0x207b17[_0x7909('0x65')]['id']}})[_0x7909('0x1f')](handleEntityNotFound(_0x52f6d6,null))[_0x7909('0x1f')](function(_0x55aabf){if(_0x55aabf){_0x207b17[_0x7909('0x5c')]['OpenchannelAccountId']=_0x55aabf['id'];return db[_0x7909('0x68')]['create'](_0x207b17[_0x7909('0x5c')]);}})[_0x7909('0x1f')](respondWithResult(_0x52f6d6,null))[_0x7909('0x57')](handleError(_0x52f6d6,null));};exports[_0x7909('0x69')]=function(_0x3bc4b7,_0x4dd323,_0x4748a1){var _0x229dd0={'raw':![],'where':{}};var _0x58ed48={};var _0x50164f={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x7909('0x6a')]({'where':{'id':_0x3bc4b7[_0x7909('0x65')]['id']}})[_0x7909('0x1f')](handleEntityNotFound(_0x4dd323,null))['then'](function(_0x284286){if(_0x284286){_0x58ed48['model']=_[_0x7909('0x45')](db['Disposition'][_0x7909('0x40')]);_0x58ed48[_0x7909('0x44')]=_['keys'](_0x3bc4b7[_0x7909('0x44')]);_0x58ed48[_0x7909('0x46')]=_[_0x7909('0x47')](_0x58ed48[_0x7909('0x42')],_0x58ed48[_0x7909('0x44')]);_0x229dd0['attributes']=_['intersection'](_0x58ed48[_0x7909('0x42')],qs['fields'](_0x3bc4b7['query'][_0x7909('0x48')]));_0x229dd0[_0x7909('0x49')]=_0x229dd0[_0x7909('0x49')][_0x7909('0x4a')]?_0x229dd0[_0x7909('0x49')]:_0x58ed48['model'];if(!_0x3bc4b7[_0x7909('0x44')][_0x7909('0x4b')](_0x7909('0x6b'))){_0x229dd0['limit']=qs[_0x7909('0x2d')](_0x3bc4b7['query'][_0x7909('0x2d')]);_0x229dd0[_0x7909('0x2c')]=qs[_0x7909('0x2c')](_0x3bc4b7['query'][_0x7909('0x2c')]);}_0x229dd0[_0x7909('0x4c')]=qs[_0x7909('0x4d')](_0x3bc4b7[_0x7909('0x44')][_0x7909('0x4d')]);_0x229dd0[_0x7909('0x4e')]=qs[_0x7909('0x46')](_['pick'](_0x3bc4b7['query'],_0x58ed48[_0x7909('0x46')]));_0x229dd0[_0x7909('0x4e')]['OpenchannelAccountId']=_0x284286['id'];if(_0x3bc4b7['query'][_0x7909('0x50')]){_0x229dd0[_0x7909('0x4e')]=_[_0x7909('0x51')](_0x229dd0[_0x7909('0x4e')],{'$or':_[_0x7909('0x3e')](_0x229dd0['attributes'],function(_0x2e7aa1){var _0x14a875={};_0x14a875[_0x2e7aa1]={'$like':'%'+_0x3bc4b7['query'][_0x7909('0x50')]+'%'};return _0x14a875;})});}_0x229dd0=_[_0x7909('0x51')]({},_0x229dd0,_0x3bc4b7[_0x7909('0x59')]);return db[_0x7909('0x68')][_0x7909('0x2e')]({'where':_0x229dd0[_0x7909('0x4e')]})['then'](function(_0x5199dd){_0x50164f['count']=_0x5199dd;if(_0x3bc4b7[_0x7909('0x44')][_0x7909('0x53')]){_0x229dd0[_0x7909('0x54')]=[{'all':!![]}];}return db[_0x7909('0x68')][_0x7909('0x55')](_0x229dd0);})[_0x7909('0x1f')](function(_0x45e606){_0x50164f[_0x7909('0x56')]=_0x45e606;return _0x50164f;});}})[_0x7909('0x1f')](respondWithFilteredResult(_0x4dd323,_0x229dd0))['catch'](handleError(_0x4dd323,null));};exports[_0x7909('0x6c')]=function(_0x59ab6b,_0xfaee07,_0x5e019){return db[_0x7909('0x3f')][_0x7909('0x5a')]({'where':{'id':_0x59ab6b[_0x7909('0x65')]['id']}})[_0x7909('0x1f')](handleEntityNotFound(_0xfaee07,null))[_0x7909('0x1f')](function(_0x1e3dcb){if(_0x1e3dcb){return _0x1e3dcb['removeDispositions'](_0x59ab6b['query'][_0x7909('0x6d')]);}})[_0x7909('0x1f')](respondWithStatusCode(_0xfaee07,null))['catch'](handleError(_0xfaee07,null));};exports[_0x7909('0x6e')]=function(_0x20940d,_0x959dcc,_0x24dd0c){if(_0x20940d[_0x7909('0x5c')]['id']){delete _0x20940d['body']['id'];}return db[_0x7909('0x3f')][_0x7909('0x5a')]({'where':{'id':_0x20940d[_0x7909('0x65')]['id']}})[_0x7909('0x1f')](handleEntityNotFound(_0x959dcc,null))[_0x7909('0x1f')](function(_0x4c0963){if(_0x4c0963){_0x20940d[_0x7909('0x5c')]['OpenchannelAccountId']=_0x4c0963['id'];return db[_0x7909('0x6f')]['create'](_0x20940d['body']);}})[_0x7909('0x1f')](respondWithResult(_0x959dcc,null))[_0x7909('0x57')](handleError(_0x959dcc,null));};exports[_0x7909('0x70')]=function(_0x4b5bb5,_0xc937d7,_0x2110a4){var _0x16eadc={'raw':![],'where':{}};var _0x5d4d00={};var _0x334c27={'count':0x0,'rows':[]};return db[_0x7909('0x3f')][_0x7909('0x6a')]({'where':{'id':_0x4b5bb5[_0x7909('0x65')]['id']}})['then'](handleEntityNotFound(_0xc937d7,null))[_0x7909('0x1f')](function(_0xfb632b){if(_0xfb632b){_0x5d4d00[_0x7909('0x42')]=_[_0x7909('0x45')](db['CannedAnswer'][_0x7909('0x40')]);_0x5d4d00[_0x7909('0x44')]=_[_0x7909('0x45')](_0x4b5bb5[_0x7909('0x44')]);_0x5d4d00[_0x7909('0x46')]=_[_0x7909('0x47')](_0x5d4d00[_0x7909('0x42')],_0x5d4d00[_0x7909('0x44')]);_0x16eadc[_0x7909('0x49')]=_[_0x7909('0x47')](_0x5d4d00[_0x7909('0x42')],qs[_0x7909('0x48')](_0x4b5bb5[_0x7909('0x44')]['fields']));_0x16eadc[_0x7909('0x49')]=_0x16eadc['attributes']['length']?_0x16eadc[_0x7909('0x49')]:_0x5d4d00[_0x7909('0x42')];if(!_0x4b5bb5['query']['hasOwnProperty']('nolimit')){_0x16eadc[_0x7909('0x2d')]=qs[_0x7909('0x2d')](_0x4b5bb5[_0x7909('0x44')][_0x7909('0x2d')]);_0x16eadc[_0x7909('0x2c')]=qs[_0x7909('0x2c')](_0x4b5bb5[_0x7909('0x44')][_0x7909('0x2c')]);}_0x16eadc[_0x7909('0x4c')]=qs[_0x7909('0x4d')](_0x4b5bb5[_0x7909('0x44')][_0x7909('0x4d')]);_0x16eadc['where']=qs[_0x7909('0x46')](_[_0x7909('0x4f')](_0x4b5bb5['query'],_0x5d4d00[_0x7909('0x46')]));_0x16eadc[_0x7909('0x4e')][_0x7909('0x71')]=_0xfb632b['id'];if(_0x4b5bb5[_0x7909('0x44')]['filter']){_0x16eadc[_0x7909('0x4e')]=_[_0x7909('0x51')](_0x16eadc[_0x7909('0x4e')],{'$or':_[_0x7909('0x3e')](_0x16eadc[_0x7909('0x49')],function(_0x218398){var _0xb16176={};_0xb16176[_0x218398]={'$like':'%'+_0x4b5bb5[_0x7909('0x44')][_0x7909('0x50')]+'%'};return _0xb16176;})});}_0x16eadc=_[_0x7909('0x51')]({},_0x16eadc,_0x4b5bb5[_0x7909('0x59')]);return db['CannedAnswer'][_0x7909('0x2e')]({'where':_0x16eadc[_0x7909('0x4e')]})[_0x7909('0x1f')](function(_0x354ae5){_0x334c27[_0x7909('0x2e')]=_0x354ae5;if(_0x4b5bb5[_0x7909('0x44')]['includeAll']){_0x16eadc[_0x7909('0x54')]=[{'all':!![]}];}return db[_0x7909('0x6f')][_0x7909('0x55')](_0x16eadc);})[_0x7909('0x1f')](function(_0x1f5434){_0x334c27[_0x7909('0x56')]=_0x1f5434;return _0x334c27;});}})[_0x7909('0x1f')](respondWithFilteredResult(_0xc937d7,_0x16eadc))['catch'](handleError(_0xc937d7,null));};exports[_0x7909('0x72')]=function(_0x3707db,_0x1f3a37,_0xdafa2a){return db[_0x7909('0x3f')][_0x7909('0x5a')]({'where':{'id':_0x3707db['params']['id']}})[_0x7909('0x1f')](handleEntityNotFound(_0x1f3a37,null))[_0x7909('0x1f')](function(_0x4f55a2){if(_0x4f55a2){return _0x4f55a2[_0x7909('0x72')](_0x3707db[_0x7909('0x44')][_0x7909('0x6d')]);}})[_0x7909('0x1f')](respondWithStatusCode(_0x1f3a37,null))['catch'](handleError(_0x1f3a37,null));};exports[_0x7909('0x73')]=function(_0x16ec5e,_0x1643c1,_0x33a15f){var _0x3159c8={'body':_0x16ec5e[_0x7909('0x5c')],'channel':_0x7909('0x74')};var _0xe272a3=[];var _0x2f6efa=[];var _0x58e88a={};var _0x35a3d5=![];return db[_0x7909('0x75')][_0x7909('0x66')]()['then'](function(_0x1c3889){if(!_0x1c3889){throw new db[(_0x7909('0x76'))][(_0x7909('0x77'))](_0x7909('0x78'));}_0xe272a3=_[_0x7909('0x79')](_['keys'](_0x1c3889),['createdAt','updatedAt']);_0x2f6efa=_[_0x7909('0x79')](_[_0x7909('0x45')](_0x1c3889),[_0x7909('0x7a'),_0x7909('0x7b'),'CompanyId',_0x7909('0x7c')]);if(_0x16ec5e[_0x7909('0x5c')]['id']){delete _0x16ec5e[_0x7909('0x5c')]['id'];}if(_[_0x7909('0x7d')](_0x16ec5e['body']['from'])){throw new db[(_0x7909('0x76'))][(_0x7909('0x77'))](_0x7909('0x7e'));}if(_[_0x7909('0x7d')](_0x16ec5e['body'][_0x7909('0x5c')])||_0x16ec5e[_0x7909('0x5c')][_0x7909('0x5c')]===''){throw new db[(_0x7909('0x76'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7909('0x7d')](_0x16ec5e['body'][_0x7909('0x7f')])){throw new db[(_0x7909('0x76'))]['ValidationError'](_0x7909('0x80')+_0x2f6efa);}if(!_[_0x7909('0x81')](_0x2f6efa,_0x16ec5e[_0x7909('0x5c')][_0x7909('0x7f')])){throw new db[(_0x7909('0x76'))][(_0x7909('0x77'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2f6efa);}_0x58e88a[_0x16ec5e['body'][_0x7909('0x7f')]]=_0x16ec5e['body'][_0x7909('0x82')];})[_0x7909('0x1f')](function(){return db['OpenchannelAccount'][_0x7909('0x5a')]({'where':{'id':_0x16ec5e[_0x7909('0x65')]['id']},'include':[{'model':db['CmList'],'as':_0x7909('0x83'),'include':[{'model':db[_0x7909('0x75')],'as':'Contacts','where':_0x58e88a,'limit':0x1,'order':[[_0x7909('0x7b'),_0x7909('0x84')]]}]},{'model':db[_0x7909('0x85')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x1643c1,null))[_0x7909('0x1f')](function(_0x487d78){if(_0x487d78&&_0x487d78[_0x7909('0x83')]){_0x3159c8[_0x7909('0x86')]=_0x487d78;_0x3159c8[_0x7909('0x87')]=_0x487d78['Applications'];_0x3159c8[_0x7909('0x88')]=_0x487d78['List'];_0x3159c8[_0x7909('0x87')]=_[_0x7909('0x89')](_0x3159c8[_0x7909('0x87')],[_0x7909('0x8a')],[_0x7909('0x8b')]);if(_0x3159c8[_0x7909('0x86')]['Applications']){delete _0x3159c8[_0x7909('0x86')][_0x7909('0x8c')];}if(_0x3159c8[_0x7909('0x86')][_0x7909('0x83')]&&_0x3159c8[_0x7909('0x86')][_0x7909('0x83')][_0x7909('0x8d')][_0x7909('0x4a')]){return _0x3159c8['account'][_0x7909('0x83')][_0x7909('0x8d')][0x0];}var _0x384546=_['defaults'](_0x16ec5e[_0x7909('0x5c')],{'firstName':_0x16ec5e['body'][_0x7909('0x82')],'ListId':_0x487d78[_0x7909('0x7c')]});_0x384546[_0x16ec5e[_0x7909('0x5c')][_0x7909('0x7f')]]=_0x16ec5e['body'][_0x7909('0x82')];return db[_0x7909('0x75')]['create'](_0x384546,{'fields':_0xe272a3,'raw':!![]});}})[_0x7909('0x1f')](handleEntityNotFound(_0x1643c1,null))['then'](function(_0xb71dbc){_0x3159c8[_0x7909('0x8e')]=_0xb71dbc;if(_0xb71dbc){var _0xee0b6d={'ContactId':_0xb71dbc['id'],'OpenchannelAccountId':_0x16ec5e['params']['id'],'from':(_0xb71dbc[_0x7909('0x8f')]||'')+'\x20'+(_0xb71dbc[_0x7909('0x90')]||'')};var _0x956142={'OpenchannelAccountId':_0x16ec5e[_0x7909('0x65')]['id'],'closed':![]};if(_0x16ec5e[_0x7909('0x5c')]['threadId']){_0x956142[_0x7909('0x91')]=_0x16ec5e['body'][_0x7909('0x91')];return db[_0x7909('0x92')][_0x7909('0x5a')]({'where':_0x956142})[_0x7909('0x1f')](function(_0x3ac31a){if(_0x3ac31a){return[_0x3ac31a,![]];}_0xee0b6d[_0x7909('0x91')]=_0x16ec5e[_0x7909('0x5c')][_0x7909('0x91')];_0xee0b6d[_0x7909('0x93')]=_0x16ec5e['body'][_0x7909('0x93')];return db[_0x7909('0x92')][_0x7909('0x5b')](_0xee0b6d)['then'](function(_0x9cbac){return[_0x9cbac,!![]];});});}else{_0x956142['threadId']=null;}_0x956142['ContactId']=_0xb71dbc['id'];return db['OpenchannelInteraction']['find']({'where':_0x956142})[_0x7909('0x1f')](function(_0x1865d0){if(_0x1865d0){return[_0x1865d0,![]];}return db[_0x7909('0x92')][_0x7909('0x5b')](_0xee0b6d)[_0x7909('0x1f')](function(_0x5c4844){return[_0x5c4844,!![]];});});}})[_0x7909('0x94')](function(_0x126b8c,_0x4dbded){if(_0x126b8c){_0x35a3d5=_0x4dbded;if(!_0x4dbded){var _0x117863={'from':(_0x3159c8[_0x7909('0x8e')][_0x7909('0x8f')]||'')+'\x20'+(_0x3159c8[_0x7909('0x8e')][_0x7909('0x90')]||'')};if(_0x16ec5e['body'][_0x7909('0x91')]&&_0x16ec5e[_0x7909('0x5c')][_0x7909('0x95')]&&_0x16ec5e[_0x7909('0x5c')][_0x7909('0x91')]!=_0x16ec5e['body']['messageId']){_0x117863[_0x7909('0x91')]=_0x16ec5e['body']['messageId'];}return _0x126b8c[_0x7909('0x33')](_0x117863);}else{return _0x126b8c;}}})[_0x7909('0x1f')](function(_0x1e366){_0x3159c8[_0x7909('0x96')]=_0x1e366[_0x7909('0x5d')]({'plain':!![]});_0x3159c8[_0x7909('0x96')]['created']=_0x35a3d5;if(_0x3159c8[_0x7909('0x96')][_0x7909('0x97')]){if(_0x3159c8[_0x7909('0x86')][_0x7909('0x98')]){_0x3159c8[_0x7909('0x87')][_0x7909('0x99')]({'id':0x0,'priority':_0x3159c8[_0x7909('0x87')][_0x7909('0x4a')]+0x1,'app':_0x7909('0x9a'),'appdata':_0x7909('0x9b'),'interval':_0x7909('0x9c')});}}return db[_0x7909('0x9d')][_0x7909('0x5b')]({'body':_0x16ec5e[_0x7909('0x5c')][_0x7909('0x5c')],'OpenchannelAccountId':_0x16ec5e['params']['id'],'OpenchannelInteractionId':_0x1e366['id'],'direction':'in','ContactId':_0x3159c8['contact']['id'],'AttachmentId':_0x16ec5e[_0x7909('0x5c')]['AttachmentId']});})['then'](function(_0x5171c2){_0x3159c8[_0x7909('0x28')]=_0x5171c2;if(_0x3159c8[_0x7909('0x96')][_0x7909('0x9e')]){return db['User'][_0x7909('0x5a')]({'attributes':['id',_0x7909('0x43')],'where':{'id':_0x3159c8[_0x7909('0x96')][_0x7909('0x9e')]}})[_0x7909('0x1f')](function(_0x54c270){if(_0x54c270){_0x3159c8[_0x7909('0x87')][_0x7909('0x9f')]({'id':0x0,'priority':0x0,'app':_0x7909('0xa0'),'appdata':_0x54c270['name']+','+(_0x3159c8['account'][_0x7909('0xa1')]||0xa),'interval':_0x7909('0x9c')});_0x3159c8['forcedOwnership']=![];}return respondWithRpcPromise(_0x7909('0xa2'),_0x7909('0xa3'),_0x3159c8);});}return respondWithRpcPromise(_0x7909('0xa2'),_0x7909('0xa3'),_0x3159c8);})['then'](function(_0x3c97b7){respondWithRpcPromise(_0x7909('0xa4'),_0x7909('0xa4'),{'event':'notify','message':_0x3c97b7},client9002);return _0x3c97b7;})[_0x7909('0x1f')](respondWithResult(_0x1643c1,null))['catch'](handleError(_0x1643c1,null));};exports[_0x7909('0xa5')]=function(_0x5a577a,_0x5dfe61){var _0x2eb1bc=_0x5a577a[_0x7909('0x65')]['id'];var _0x5af36b=_0x5a577a[_0x7909('0x5c')];var _0x130f04=0xc8;var _0x53b9f9=null;return db[_0x7909('0xa6')][_0x7909('0xa7')]({'isolationLevel':db['sequelize'][_0x7909('0xa8')][_0x7909('0xa9')][_0x7909('0xaa')]},function(_0x33353c){return db[_0x7909('0x3f')]['findOne']({'where':{'id':_0x2eb1bc},'transaction':_0x33353c})['then'](function(_0x41afd3){if(_0x41afd3){return db[_0x7909('0x85')][_0x7909('0x34')]({'where':{'OpenchannelAccountId':_0x2eb1bc},'transaction':_0x33353c})[_0x7909('0x1f')](function(){var _0x32c043=_[_0x7909('0x3e')](_0x5af36b,function(_0x89cccd){_0x89cccd['OpenchannelAccountId']=_0x2eb1bc;return _0x89cccd;});return db[_0x7909('0x85')][_0x7909('0xab')](_0x32c043,{'transaction':_0x33353c});});}else{_0x130f04=0x194;_0x53b9f9=[];}});})['then'](function(){if(_0x130f04!==0x194){return db[_0x7909('0x85')][_0x7909('0xac')]({'where':{'OpenchannelAccountId':_0x2eb1bc},'order':'priority'})[_0x7909('0x1f')](function(_0x2491db){_0x53b9f9=_0x2491db;});}})[_0x7909('0x57')](function(_0x52f22e){_0x130f04=0x1f4;logger['error'](_0x52f22e['stack']);if(_0x52f22e['name']){delete _0x52f22e['name'];}_0x53b9f9=_0x52f22e;})[_0x7909('0xad')](function(){if(_0x53b9f9===null){_0x5dfe61[_0x7909('0x38')](_0x130f04);}else{if(_0x130f04===0x1f4){_0x5dfe61[_0x7909('0x2a')](_0x130f04)[_0x7909('0x3a')](_0x53b9f9);}else{_0x5dfe61[_0x7909('0x2a')](_0x130f04)[_0x7909('0x2b')](_0x53b9f9);}}});};exports[_0x7909('0xae')]=function(_0x338210,_0x243faf,_0x4b63d0){var _0x3836c9={};var _0x5caddb={};var _0x4d809e;var _0x12c5cd;return db[_0x7909('0x3f')]['findOne']({'where':{'id':_0x338210[_0x7909('0x65')]['id']}})[_0x7909('0x1f')](handleEntityNotFound(_0x243faf,null))[_0x7909('0x1f')](function(_0x256386){if(_0x256386){_0x4d809e=_0x256386;_0x5caddb[_0x7909('0x42')]=_[_0x7909('0x45')](db[_0x7909('0x85')][_0x7909('0x40')]);_0x5caddb[_0x7909('0x44')]=_[_0x7909('0x45')](_0x338210['query']);_0x5caddb[_0x7909('0x46')]=_[_0x7909('0x47')](_0x5caddb[_0x7909('0x42')],_0x5caddb[_0x7909('0x44')]);_0x3836c9[_0x7909('0x49')]=_[_0x7909('0x47')](_0x5caddb['model'],qs['fields'](_0x338210[_0x7909('0x44')][_0x7909('0x48')]));_0x3836c9['attributes']=_0x3836c9[_0x7909('0x49')][_0x7909('0x4a')]?_0x3836c9[_0x7909('0x49')]:_0x5caddb[_0x7909('0x42')];_0x3836c9[_0x7909('0x4c')]=qs[_0x7909('0x4d')](_0x338210[_0x7909('0x44')][_0x7909('0x4d')]);_0x3836c9[_0x7909('0x4e')]=qs['filters'](_[_0x7909('0x4f')](_0x338210[_0x7909('0x44')],_0x5caddb[_0x7909('0x46')]));if(_0x338210['query'][_0x7909('0x50')]){_0x3836c9[_0x7909('0x4e')]=_['merge'](_0x3836c9[_0x7909('0x4e')],{'$or':_['map'](_0x3836c9[_0x7909('0x49')],function(_0x3f9d8d){var _0x2713f0={};_0x2713f0[_0x3f9d8d]={'$like':'%'+_0x338210[_0x7909('0x44')][_0x7909('0x50')]+'%'};return _0x2713f0;})});}_0x3836c9=_[_0x7909('0x51')]({},_0x3836c9,_0x338210['options']);return _0x4d809e[_0x7909('0xae')](_0x3836c9);}})[_0x7909('0x1f')](function(_0x5c71a8){if(_0x5c71a8){_0x12c5cd=_0x5c71a8['length'];if(!_0x338210[_0x7909('0x44')]['hasOwnProperty'](_0x7909('0x6b'))){_0x3836c9[_0x7909('0x2d')]=qs['limit'](_0x338210[_0x7909('0x44')][_0x7909('0x2d')]);_0x3836c9[_0x7909('0x2c')]=qs[_0x7909('0x2c')](_0x338210[_0x7909('0x44')][_0x7909('0x2c')]);}return _0x4d809e[_0x7909('0xae')](_0x3836c9);}})[_0x7909('0x1f')](function(_0x2b38a9){if(_0x2b38a9){return _0x2b38a9?{'count':_0x12c5cd,'rows':_0x2b38a9}:null;}})[_0x7909('0x1f')](respondWithResult(_0x243faf,null))[_0x7909('0x57')](handleError(_0x243faf,null));};exports['getInteractions']=function(_0x860253,_0x46d736,_0x4a393c){var _0x1b679c={'raw':![],'where':{}};var _0x278164={};var _0x50cc2c={'count':0x0,'rows':[]};return db[_0x7909('0x3f')][_0x7909('0x6a')]({'where':{'id':_0x860253['params']['id']}})[_0x7909('0x1f')](handleEntityNotFound(_0x46d736,null))[_0x7909('0x1f')](function(_0x2ae0aa){if(_0x2ae0aa){_0x278164[_0x7909('0x42')]=_[_0x7909('0x45')](db['OpenchannelInteraction'][_0x7909('0x40')]);_0x278164[_0x7909('0x44')]=_[_0x7909('0x45')](_0x860253[_0x7909('0x44')]);_0x278164[_0x7909('0x46')]=_[_0x7909('0x47')](_0x278164[_0x7909('0x42')],_0x278164['query']);_0x1b679c[_0x7909('0x49')]=_[_0x7909('0x47')](_0x278164['model'],qs[_0x7909('0x48')](_0x860253[_0x7909('0x44')][_0x7909('0x48')]));_0x1b679c[_0x7909('0x49')]=_0x1b679c[_0x7909('0x49')][_0x7909('0x4a')]?_0x1b679c['attributes']:_0x278164['model'];if(!_0x860253[_0x7909('0x44')][_0x7909('0x4b')](_0x7909('0x6b'))){_0x1b679c[_0x7909('0x2d')]=qs['limit'](_0x860253[_0x7909('0x44')]['limit']);_0x1b679c['offset']=qs[_0x7909('0x2c')](_0x860253[_0x7909('0x44')][_0x7909('0x2c')]);}_0x1b679c['order']=qs['sort'](_0x860253[_0x7909('0x44')][_0x7909('0x4d')]);_0x1b679c[_0x7909('0x4e')]=qs[_0x7909('0x46')](_[_0x7909('0x4f')](_0x860253[_0x7909('0x44')],_0x278164[_0x7909('0x46')]));_0x1b679c[_0x7909('0x4e')][_0x7909('0x71')]=_0x2ae0aa['id'];if(_0x860253[_0x7909('0x44')][_0x7909('0x50')]){_0x1b679c[_0x7909('0x4e')]=_[_0x7909('0x51')](_0x1b679c[_0x7909('0x4e')],{'$or':_[_0x7909('0x3e')](_0x1b679c['attributes'],function(_0x3a0c11){var _0x28544a={};_0x28544a[_0x3a0c11]={'$like':'%'+_0x860253[_0x7909('0x44')][_0x7909('0x50')]+'%'};return _0x28544a;})});}_0x1b679c=_[_0x7909('0x51')]({},_0x1b679c,_0x860253[_0x7909('0x59')]);return db[_0x7909('0x92')]['count']({'where':_0x1b679c[_0x7909('0x4e')]})[_0x7909('0x1f')](function(_0x450008){_0x50cc2c[_0x7909('0x2e')]=_0x450008;if(_0x860253['query'][_0x7909('0x53')]){_0x1b679c[_0x7909('0x54')]=[{'model':db[_0x7909('0x75')],'as':_0x7909('0xaf'),'required':![]},{'model':db[_0x7909('0xb0')],'as':_0x7909('0xb1'),'attributes':[_0x7909('0x43'),_0x7909('0xb2'),_0x7909('0xb3')],'required':![]},{'model':db['Tag'],'as':_0x7909('0xb4'),'attributes':['id',_0x7909('0x43'),_0x7909('0xb5')],'where':_0x860253[_0x7909('0x44')][_0x7909('0xb6')]?{'id':_0x860253[_0x7909('0x44')][_0x7909('0xb6')]}:undefined,'required':_0x860253[_0x7909('0x44')][_0x7909('0xb6')]?!![]:![]}];}return db[_0x7909('0x92')][_0x7909('0x55')](_0x1b679c);})['then'](function(_0x110f24){_0x50cc2c[_0x7909('0x56')]=_0x110f24;return _0x50cc2c;});}})['then'](respondWithFilteredResult(_0x46d736,_0x1b679c))[_0x7909('0x57')](handleError(_0x46d736,null));};exports[_0x7909('0xb7')]=function(_0x10bf3c,_0x5bc9d0,_0x10398d){return db[_0x7909('0x3f')][_0x7909('0x5a')]({'where':{'id':_0x10bf3c[_0x7909('0x65')]['id']}})[_0x7909('0x1f')](handleEntityNotFound(_0x5bc9d0,null))[_0x7909('0x1f')](function(_0x54e2c2){if(_0x54e2c2){return _0x54e2c2[_0x7909('0xb7')](_0x10bf3c[_0x7909('0x5c')]['ids'],_['omit'](_0x10bf3c[_0x7909('0x5c')],[_0x7909('0x6d'),'id'])||{})['spread'](function(_0x196004){for(var _0x1983cb=0x0;_0x1983cb<_0x10bf3c[_0x7909('0x5c')][_0x7909('0x6d')][_0x7909('0x4a')];_0x1983cb+=0x1){socket[_0x7909('0xb8')](_0x7909('0xb9'),{'UserId':Number(_0x10bf3c[_0x7909('0x5c')]['ids'][_0x1983cb]),'OpenchannelAccountId':Number(_0x10bf3c[_0x7909('0x65')]['id'])});}return _0x196004;});}})['then'](respondWithResult(_0x5bc9d0,null))['catch'](handleError(_0x5bc9d0,null));};exports[_0x7909('0xba')]=function(_0x655f6f,_0x196591,_0x31bdd8){return db[_0x7909('0x3f')][_0x7909('0x5a')]({'where':{'id':_0x655f6f[_0x7909('0x65')]['id']}})[_0x7909('0x1f')](handleEntityNotFound(_0x196591,null))[_0x7909('0x1f')](function(_0x18dd67){if(_0x18dd67){return _0x18dd67['removeAgents'](_0x655f6f[_0x7909('0x44')]['ids'])[_0x7909('0x1f')](function(){if(_[_0x7909('0xbb')](_0x655f6f[_0x7909('0x44')][_0x7909('0x6d')])){for(var _0x3252cb=0x0;_0x3252cb<_0x655f6f[_0x7909('0x44')][_0x7909('0x6d')][_0x7909('0x4a')];_0x3252cb+=0x1){socket[_0x7909('0xb8')]('userOpenchannelAccount:remove',{'UserId':Number(_0x655f6f[_0x7909('0x44')][_0x7909('0x6d')][_0x3252cb]),'OpenchannelAccountId':Number(_0x655f6f['params']['id'])});}}else{socket[_0x7909('0xb8')](_0x7909('0xbc'),{'UserId':Number(_0x655f6f[_0x7909('0x44')][_0x7909('0x6d')]),'OpenchannelAccountId':Number(_0x655f6f[_0x7909('0x65')]['id'])});}});}})[_0x7909('0x1f')](respondWithStatusCode(_0x196591,null))['catch'](handleError(_0x196591,null));};exports[_0x7909('0xbd')]=function(_0x2030d6,_0x58a760,_0x392b68){var _0x326d1b={};var _0x9905cb={};var _0x2f8df4;var _0x572702;return db['OpenchannelAccount'][_0x7909('0x6a')]({'where':{'id':_0x2030d6['params']['id']}})[_0x7909('0x1f')](handleEntityNotFound(_0x58a760,null))[_0x7909('0x1f')](function(_0x1d8144){if(_0x1d8144){_0x2f8df4=_0x1d8144;_0x9905cb[_0x7909('0x42')]=_[_0x7909('0x45')](db[_0x7909('0xb0')][_0x7909('0x40')]);_0x9905cb[_0x7909('0x44')]=_['keys'](_0x2030d6[_0x7909('0x44')]);_0x9905cb[_0x7909('0x46')]=_[_0x7909('0x47')](_0x9905cb['model'],_0x9905cb[_0x7909('0x44')]);_0x326d1b[_0x7909('0x49')]=_[_0x7909('0x47')](_0x9905cb['model'],qs['fields'](_0x2030d6[_0x7909('0x44')]['fields']));_0x326d1b[_0x7909('0x49')]=_0x326d1b[_0x7909('0x49')][_0x7909('0x4a')]?_0x326d1b['attributes']:_0x9905cb[_0x7909('0x42')];_0x326d1b[_0x7909('0x4c')]=qs[_0x7909('0x4d')](_0x2030d6[_0x7909('0x44')][_0x7909('0x4d')]);_0x326d1b[_0x7909('0x4e')]=qs[_0x7909('0x46')](_[_0x7909('0x4f')](_0x2030d6[_0x7909('0x44')],_0x9905cb[_0x7909('0x46')]));if(_0x2030d6[_0x7909('0x44')][_0x7909('0x50')]){_0x326d1b['where']=_['merge'](_0x326d1b[_0x7909('0x4e')],{'$or':_[_0x7909('0x3e')](_0x326d1b['attributes'],function(_0x157dba){var _0x2a404a={};_0x2a404a[_0x157dba]={'$like':'%'+_0x2030d6[_0x7909('0x44')]['filter']+'%'};return _0x2a404a;})});}_0x326d1b=_[_0x7909('0x51')]({},_0x326d1b,_0x2030d6[_0x7909('0x59')]);return _0x2f8df4[_0x7909('0xbd')](_0x326d1b);}})[_0x7909('0x1f')](function(_0xb659e2){if(_0xb659e2){_0x572702=_0xb659e2['length'];if(!_0x2030d6[_0x7909('0x44')]['hasOwnProperty'](_0x7909('0x6b'))){_0x326d1b[_0x7909('0x2d')]=qs[_0x7909('0x2d')](_0x2030d6[_0x7909('0x44')][_0x7909('0x2d')]);_0x326d1b['offset']=qs[_0x7909('0x2c')](_0x2030d6[_0x7909('0x44')][_0x7909('0x2c')]);}return _0x2f8df4['getAgents'](_0x326d1b);}})[_0x7909('0x1f')](function(_0x218adc){if(_0x218adc){return _0x218adc?{'count':_0x572702,'rows':_0x218adc}:null;}})[_0x7909('0x1f')](respondWithResult(_0x58a760,null))[_0x7909('0x57')](handleError(_0x58a760,null));};exports[_0x7909('0x3a')]=function(_0x9c3b13,_0x142bc2,_0x249380){var _0x4d6e2f,_0x3c7814,_0x5015f7;if(_[_0x7909('0x7d')](_0x9c3b13[_0x7909('0x5c')][_0x7909('0x5c')])||_0x9c3b13['body'][_0x7909('0x5c')]===''){throw new db['Sequelize'][(_0x7909('0x77'))](_0x7909('0xbe'));}if(_['isNil'](_0x9c3b13[_0x7909('0x5c')]['to'])){}_0x4d6e2f=_0x9c3b13[_0x7909('0x5c')]['to'];return db[_0x7909('0x3f')][_0x7909('0x6a')]({'where':{'id':_0x9c3b13[_0x7909('0x65')]['id']}})[_0x7909('0x1f')](handleEntityNotFound(_0x142bc2,null))[_0x7909('0x1f')](function(_0x85fdb9){if(_0x85fdb9){return db['OpenchannelAccount']['find']({'where':{'id':_0x85fdb9['id']},'include':[{'model':db[_0x7909('0xbf')],'as':_0x7909('0x83'),'include':[{'model':db['CmContact'],'as':_0x7909('0x8d'),'where':{[_0x85fdb9[_0x7909('0x7f')]]:_0x4d6e2f},'limit':0x1,'order':[[_0x7909('0x7b'),_0x7909('0x84')]]}]}]})[_0x7909('0x1f')](handleEntityNotFound(_0x142bc2,null))[_0x7909('0x1f')](function(_0xe5efc0){if(_0xe5efc0&&_0xe5efc0[_0x7909('0x83')]){_0x3c7814=_0xe5efc0[_0x7909('0x5d')]({'plain':!![]});if(_0x3c7814['List']&&_0x3c7814[_0x7909('0x83')][_0x7909('0x8d')][_0x7909('0x4a')]){return _0x3c7814[_0x7909('0x83')][_0x7909('0x8d')][0x0];}return db[_0x7909('0x75')]['create'](_[_0x7909('0x18')](_0x9c3b13[_0x7909('0x5c')],{'firstName':_0x4d6e2f,[_0xe5efc0[_0x7909('0x7f')]]:_0x4d6e2f,'phone':_0x4d6e2f,'ListId':_0x3c7814['ListId']}));}})[_0x7909('0x1f')](handleEntityNotFound(_0x142bc2,null))[_0x7909('0x1f')](function(_0x13301e){if(_0x13301e){_0x5015f7=_0x13301e;return db[_0x7909('0x92')][_0x7909('0x5a')]({'where':{'ContactId':_0x5015f7['id'],'closed':![],'OpenchannelAccountId':_0x3c7814['id']}})[_0x7909('0x1f')](function(_0x4479ac){if(_0x4479ac){return[_0x4479ac,![]];}return db[_0x7909('0x92')][_0x7909('0x5b')]({'UserId':_0x9c3b13[_0x7909('0x60')]['id'],'ContactId':_0x5015f7['id'],'OpenchannelAccountId':_0x3c7814['id'],'lastMsgDirection':_0x7909('0xc0'),'Messages':[_[_0x7909('0x51')](_0x9c3b13[_0x7909('0x5c')],{'read':![],'body':_0x9c3b13[_0x7909('0x5c')][_0x7909('0x5c')],'OpenchannelAccountId':_0x3c7814['id'],'UserId':_0x9c3b13[_0x7909('0x60')]['id'],'ContactId':_0x5015f7['id']})]},{'include':[{'model':db[_0x7909('0x9d')],'as':_0x7909('0xc1')}]})[_0x7909('0x1f')](function(_0x2d0158){return[_0x2d0158,!![]];});});}})[_0x7909('0x94')](function(_0x17f466,_0x1e4a14){if(_0x1e4a14){return _0x17f466;}return db['OpenchannelMessage'][_0x7909('0x5b')](_['merge'](_0x9c3b13[_0x7909('0x5c')],{'read':![],'body':_0x9c3b13['body'][_0x7909('0x5c')],'OpenchannelAccountId':_0x3c7814['id'],'OpenchannelInteractionId':_0x17f466['id'],'UserId':_0x9c3b13[_0x7909('0x60')]['id'],'ContactId':_0x5015f7['id']}))[_0x7909('0x1f')](function(_0x4eae8a){_0x17f466['dataValues'][_0x7909('0xc1')]=[];_0x17f466[_0x7909('0xc2')][_0x7909('0xc1')][_0x7909('0x99')](_0x4eae8a[_0x7909('0xc2')]);return _0x17f466;});});}})[_0x7909('0x1f')](respondWithResult(_0x142bc2,null))[_0x7909('0x57')](handleError(_0x142bc2,null));}; \ No newline at end of file +var _0x562d=['order','sort','where','pick','options','includeAll','include','findAll','rows','show','params','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','describe','addDisposition','OpenchannelAccountId','Disposition','findOne','nolimit','filter','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','CmList','List','CmContact','Contacts','DESC','Applications','applications','list','orderBy','priority','account','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','User','UserId','waitForTheAssignedAgent','forcedOwnership','Start','EventManager','sequelize','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','addAgents','omit','spread','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','get','OpenchannelAccounts','UserProfileResource','sendStatus','stack','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x48999d,_0x1e02cb){var _0x1ad0d1=function(_0x3f974e){while(--_0x3f974e){_0x48999d['push'](_0x48999d['shift']());}};_0x1ad0d1(++_0x1e02cb);}(_0x562d,0x1eb));var _0xd562=function(_0xacf6f0,_0x15c178){_0xacf6f0=_0xacf6f0-0x0;var _0x2c83b4=_0x562d[_0xacf6f0];return _0x2c83b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd562('0x0'));var zipdir=require(_0xd562('0x1'));var jsonpatch=require(_0xd562('0x2'));var rp=require(_0xd562('0x3'));var moment=require(_0xd562('0x4'));var BPromise=require(_0xd562('0x5'));var Mustache=require(_0xd562('0x6'));var util=require(_0xd562('0x7'));var path=require(_0xd562('0x8'));var sox=require('sox');var csv=require(_0xd562('0x9'));var ejs=require(_0xd562('0xa'));var fs=require('fs');var fs_extra=require(_0xd562('0xb'));var _=require('lodash');var squel=require(_0xd562('0xc'));var crypto=require(_0xd562('0xd'));var jsforce=require(_0xd562('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd562('0xf'));var Papa=require(_0xd562('0x10'));var Redis=require(_0xd562('0x11'));var authService=require(_0xd562('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd562('0x13'));var hardwareService=require(_0xd562('0x14'));var logger=require(_0xd562('0x15'))(_0xd562('0x16'));var utils=require(_0xd562('0x17'));var config=require(_0xd562('0x18'));var licenseUtil=require(_0xd562('0x19'));var db=require('../../mysqldb')['db'];config[_0xd562('0x1a')]=_[_0xd562('0x1b')](config[_0xd562('0x1a')],{'host':_0xd562('0x1c'),'port':0x18eb});var socket=require(_0xd562('0x1d'))(new Redis(config['redis']));require(_0xd562('0x1e'))[_0xd562('0x1f')](socket);var jayson=require(_0xd562('0x20'));var client=jayson[_0xd562('0x21')]['http']({'port':0x232c});var client9002=jayson[_0xd562('0x21')][_0xd562('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x390dfe,_0x326ec2,_0xa0f41f,_0x3611ad){return new BPromise(function(_0x276ae3,_0x1df817){var _0x1d0fb9=_0x3611ad||client;return _0x1d0fb9[_0xd562('0x23')](_0x390dfe,_0xa0f41f)[_0xd562('0x24')](function(_0x165376){logger[_0xd562('0x25')](_0xd562('0x26'),_0x326ec2,_0xd562('0x27'));logger[_0xd562('0x28')](_0xd562('0x29'),_0x326ec2,_0xd562('0x27'),JSON[_0xd562('0x2a')](_0x165376));if(_0x165376[_0xd562('0x2b')]){if(_0x165376['error'][_0xd562('0x2c')]===0x1f4){logger[_0xd562('0x2b')](_0xd562('0x26'),_0x326ec2,_0x165376[_0xd562('0x2b')][_0xd562('0x2d')]);return _0x1df817(_0x165376['error'][_0xd562('0x2d')]);}logger['error'](_0xd562('0x26'),_0x326ec2,_0x165376['error'][_0xd562('0x2d')]);return _0x276ae3(_0x165376[_0xd562('0x2b')][_0xd562('0x2d')]);}else{logger['info'](_0xd562('0x26'),_0x326ec2,_0xd562('0x27'));_0x276ae3(_0x165376[_0xd562('0x2e')]['message']);}})[_0xd562('0x2f')](function(_0x5de408){logger[_0xd562('0x2b')](_0xd562('0x26'),_0x326ec2,_0x5de408);_0x1df817(_0x5de408);});});}function respondWithStatusCode(_0x554423,_0x174906){_0x174906=_0x174906||0xcc;return function(_0x58fe60){if(_0x58fe60){return _0x554423['sendStatus'](_0x174906);}return _0x554423[_0xd562('0x30')](_0x174906)[_0xd562('0x31')]();};}function respondWithResult(_0x117d2b,_0x10ccf7){_0x10ccf7=_0x10ccf7||0xc8;return function(_0x47904a){if(_0x47904a){return _0x117d2b['status'](_0x10ccf7)[_0xd562('0x32')](_0x47904a);}};}function respondWithFilteredResult(_0x1f093f,_0x354530){return function(_0x5c7810){if(_0x5c7810){var _0x1ea026=typeof _0x354530[_0xd562('0x33')]===_0xd562('0x34')&&typeof _0x354530[_0xd562('0x35')]===_0xd562('0x34');var _0x3d26cd=_0x5c7810['count'];var _0x5202ca=_0x1ea026?0x0:_0x354530[_0xd562('0x33')];var _0x377e8b=_0x1ea026?_0x5c7810[_0xd562('0x36')]:_0x354530[_0xd562('0x33')]+_0x354530[_0xd562('0x35')];var _0x5392d4;if(_0x377e8b>=_0x3d26cd){_0x377e8b=_0x3d26cd;_0x5392d4=0xc8;}else{_0x5392d4=0xce;}_0x1f093f['status'](_0x5392d4);return _0x1f093f[_0xd562('0x37')](_0xd562('0x38'),_0x5202ca+'-'+_0x377e8b+'/'+_0x3d26cd)['json'](_0x5c7810);}return null;};}function patchUpdates(_0x4d7934){return function(_0x4c98e3){try{jsonpatch['apply'](_0x4c98e3,_0x4d7934,!![]);}catch(_0x3f63be){return BPromise[_0xd562('0x39')](_0x3f63be);}return _0x4c98e3['save']();};}function saveUpdates(_0x2f8919,_0x72322a){return function(_0x4042f0){if(_0x4042f0){return _0x4042f0[_0xd562('0x3a')](_0x2f8919)['then'](function(_0x18d8ff){return _0x18d8ff;});}return null;};}function removeEntity(_0x40e762,_0x370ad9){return function(_0x5e0feb){if(_0x5e0feb){return _0x5e0feb[_0xd562('0x3b')]()[_0xd562('0x24')](function(){var _0x519a57=_0x5e0feb[_0xd562('0x3c')]({'plain':!![]});var _0x6bbd1c=_0xd562('0x3d');return db[_0xd562('0x3e')][_0xd562('0x3b')]({'where':{'type':_0x6bbd1c,'resourceId':_0x519a57['id']}})['then'](function(){return _0x5e0feb;});})[_0xd562('0x24')](function(){_0x40e762[_0xd562('0x30')](0xcc)[_0xd562('0x31')]();});}};}function handleEntityNotFound(_0x2dcfaf,_0x4b0dc1){return function(_0x5ddbd9){if(!_0x5ddbd9){_0x2dcfaf[_0xd562('0x3f')](0x194);}return _0x5ddbd9;};}function handleError(_0x56ab72,_0x3fd7c1){_0x3fd7c1=_0x3fd7c1||0x1f4;return function(_0x2a86c1){logger[_0xd562('0x2b')](_0x2a86c1[_0xd562('0x40')]);if(_0x2a86c1['name']){delete _0x2a86c1['name'];}_0x56ab72[_0xd562('0x30')](_0x3fd7c1)[_0xd562('0x41')](_0x2a86c1);};}exports[_0xd562('0x42')]=function(_0x54a942,_0x338ab5){var _0x31e74f={'include':[{'model':db[_0xd562('0x43')],'as':_0xd562('0x44')}]},_0xf9e39e={},_0x1b3eee={'count':0x0,'rows':[]};var _0x2c606f=_[_0xd562('0x45')](db[_0xd562('0x46')][_0xd562('0x47')],function(_0x48707c){return{'name':_0x48707c[_0xd562('0x48')],'type':_0x48707c[_0xd562('0x49')][_0xd562('0x4a')]};});_0xf9e39e[_0xd562('0x4b')]=_[_0xd562('0x45')](_0x2c606f,_0xd562('0x4c'));_0xf9e39e[_0xd562('0x4d')]=_[_0xd562('0x4e')](_0x54a942['query']);_0xf9e39e[_0xd562('0x4f')]=_[_0xd562('0x50')](_0xf9e39e[_0xd562('0x4b')],_0xf9e39e[_0xd562('0x4d')]);_0x31e74f[_0xd562('0x51')]=_['intersection'](_0xf9e39e[_0xd562('0x4b')],qs[_0xd562('0x52')](_0x54a942[_0xd562('0x4d')][_0xd562('0x52')]));_0x31e74f[_0xd562('0x51')]=_0x31e74f[_0xd562('0x51')][_0xd562('0x53')]?_0x31e74f[_0xd562('0x51')]:_0xf9e39e[_0xd562('0x4b')];if(!_0x54a942[_0xd562('0x4d')][_0xd562('0x54')]('nolimit')){_0x31e74f[_0xd562('0x35')]=qs[_0xd562('0x35')](_0x54a942[_0xd562('0x4d')][_0xd562('0x35')]);_0x31e74f['offset']=qs[_0xd562('0x33')](_0x54a942[_0xd562('0x4d')]['offset']);}_0x31e74f[_0xd562('0x55')]=qs[_0xd562('0x56')](_0x54a942['query']['sort']);_0x31e74f[_0xd562('0x57')]=qs[_0xd562('0x4f')](_[_0xd562('0x58')](_0x54a942[_0xd562('0x4d')],_0xf9e39e[_0xd562('0x4f')]),_0x2c606f);if(_0x54a942[_0xd562('0x4d')]['filter']){_0x31e74f[_0xd562('0x57')]=_['merge'](_0x31e74f['where'],{'$or':_[_0xd562('0x45')](_0x2c606f,function(_0x5c0036){if(_0x5c0036[_0xd562('0x49')]!=='VIRTUAL'){var _0x14dea2={};_0x14dea2[_0x5c0036['name']]={'$like':'%'+_0x54a942['query']['filter']+'%'};return _0x14dea2;}})});}_0x31e74f=_['merge']({},_0x31e74f,_0x54a942[_0xd562('0x59')]);var _0x2a111b={'where':_0x31e74f[_0xd562('0x57')]};return db[_0xd562('0x46')][_0xd562('0x36')](_0x2a111b)[_0xd562('0x24')](function(_0x402935){_0x1b3eee[_0xd562('0x36')]=_0x402935;if(_0x54a942[_0xd562('0x4d')][_0xd562('0x5a')]){_0x31e74f[_0xd562('0x5b')]=[{'all':!![]}];}return db[_0xd562('0x46')][_0xd562('0x5c')](_0x31e74f);})['then'](function(_0x45d1fc){_0x1b3eee[_0xd562('0x5d')]=_0x45d1fc;return _0x1b3eee;})[_0xd562('0x24')](respondWithFilteredResult(_0x338ab5,_0x31e74f))[_0xd562('0x2f')](handleError(_0x338ab5,null));};exports[_0xd562('0x5e')]=function(_0x1edeba,_0x2c6a86){var _0x369e81={'raw':![],'where':{'id':_0x1edeba[_0xd562('0x5f')]['id']},'include':[{'model':db[_0xd562('0x43')],'as':'mandatoryDispositionPause'}]},_0x5c6766={};_0x5c6766['model']=_['keys'](db[_0xd562('0x46')][_0xd562('0x47')]);_0x5c6766[_0xd562('0x4d')]=_[_0xd562('0x4e')](_0x1edeba[_0xd562('0x4d')]);_0x5c6766[_0xd562('0x4f')]=_['intersection'](_0x5c6766[_0xd562('0x4b')],_0x5c6766[_0xd562('0x4d')]);_0x369e81[_0xd562('0x51')]=_['intersection'](_0x5c6766[_0xd562('0x4b')],qs[_0xd562('0x52')](_0x1edeba[_0xd562('0x4d')][_0xd562('0x52')]));_0x369e81['attributes']=_0x369e81['attributes'][_0xd562('0x53')]?_0x369e81['attributes']:_0x5c6766['model'];if(_0x1edeba[_0xd562('0x4d')][_0xd562('0x5a')]){_0x369e81[_0xd562('0x5b')]=[{'all':!![]}];}_0x369e81=_[_0xd562('0x60')]({},_0x369e81,_0x1edeba['options']);return db[_0xd562('0x46')][_0xd562('0x61')](_0x369e81)[_0xd562('0x24')](handleEntityNotFound(_0x2c6a86,null))[_0xd562('0x24')](respondWithResult(_0x2c6a86,null))[_0xd562('0x2f')](handleError(_0x2c6a86,null));};exports[_0xd562('0x62')]=function(_0x472529,_0x307604){return db[_0xd562('0x46')]['create'](_0x472529[_0xd562('0x63')],{})[_0xd562('0x24')](function(_0x1494df){var _0x4bdff3=_0x472529[_0xd562('0x64')][_0xd562('0x3c')]({'plain':!![]});if(!_0x4bdff3)throw new Error(_0xd562('0x65'));if(_0x4bdff3[_0xd562('0x66')]===_0xd562('0x64')){var _0x493270=_0x1494df[_0xd562('0x3c')]({'plain':!![]});var _0x5a4970='OpenchannelAccounts';return db[_0xd562('0x67')][_0xd562('0x61')]({'where':{'name':_0x5a4970,'userProfileId':_0x4bdff3['userProfileId']},'raw':!![]})[_0xd562('0x24')](function(_0x11bfe6){if(_0x11bfe6&&_0x11bfe6[_0xd562('0x68')]===0x0){return db[_0xd562('0x3e')][_0xd562('0x62')]({'name':_0x493270[_0xd562('0x4c')],'resourceId':_0x493270['id'],'type':_0x11bfe6[_0xd562('0x4c')],'sectionId':_0x11bfe6['id']},{})[_0xd562('0x24')](function(){return _0x1494df;});}else{return _0x1494df;}})[_0xd562('0x2f')](function(_0x3f3dca){logger[_0xd562('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f3dca);throw _0x3f3dca;});}return _0x1494df;})[_0xd562('0x24')](respondWithResult(_0x307604,0xc9))[_0xd562('0x2f')](handleError(_0x307604,null));};exports['update']=function(_0x3cc441,_0x22f99b){if(_0x3cc441[_0xd562('0x63')]['id']){delete _0x3cc441[_0xd562('0x63')]['id'];}return db['OpenchannelAccount'][_0xd562('0x61')]({'where':{'id':_0x3cc441[_0xd562('0x5f')]['id']},'include':[{'model':db[_0xd562('0x43')],'as':_0xd562('0x44')}]})[_0xd562('0x24')](handleEntityNotFound(_0x22f99b,null))[_0xd562('0x24')](saveUpdates(_0x3cc441[_0xd562('0x63')],null))['then'](respondWithResult(_0x22f99b,null))[_0xd562('0x2f')](handleError(_0x22f99b,null));};exports[_0xd562('0x3b')]=function(_0x10cd8a,_0x123fd8){return db[_0xd562('0x46')][_0xd562('0x61')]({'where':{'id':_0x10cd8a[_0xd562('0x5f')]['id']}})['then'](handleEntityNotFound(_0x123fd8,null))[_0xd562('0x24')](removeEntity(_0x123fd8,null))['catch'](handleError(_0x123fd8,null));};exports[_0xd562('0x69')]=function(_0x597148,_0x51f230){return db[_0xd562('0x46')][_0xd562('0x69')]()[_0xd562('0x24')](respondWithResult(_0x51f230,null))[_0xd562('0x2f')](handleError(_0x51f230,null));};exports[_0xd562('0x6a')]=function(_0x21e78f,_0x3f267c,_0x4ac32c){if(_0x21e78f[_0xd562('0x63')]['id']){delete _0x21e78f['body']['id'];}return db[_0xd562('0x46')][_0xd562('0x61')]({'where':{'id':_0x21e78f[_0xd562('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3f267c,null))[_0xd562('0x24')](function(_0x15d680){if(_0x15d680){_0x21e78f[_0xd562('0x63')][_0xd562('0x6b')]=_0x15d680['id'];return db[_0xd562('0x6c')][_0xd562('0x62')](_0x21e78f[_0xd562('0x63')]);}})[_0xd562('0x24')](respondWithResult(_0x3f267c,null))[_0xd562('0x2f')](handleError(_0x3f267c,null));};exports['getDispositions']=function(_0x4b1b0e,_0x4749b0,_0x1cd2b5){var _0x456fe7={'raw':![],'where':{}};var _0x4853f8={};var _0x388e42={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xd562('0x6d')]({'where':{'id':_0x4b1b0e[_0xd562('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4749b0,null))[_0xd562('0x24')](function(_0x1cffc7){if(_0x1cffc7){_0x4853f8[_0xd562('0x4b')]=_[_0xd562('0x4e')](db[_0xd562('0x6c')]['rawAttributes']);_0x4853f8[_0xd562('0x4d')]=_[_0xd562('0x4e')](_0x4b1b0e[_0xd562('0x4d')]);_0x4853f8['filters']=_[_0xd562('0x50')](_0x4853f8[_0xd562('0x4b')],_0x4853f8[_0xd562('0x4d')]);_0x456fe7[_0xd562('0x51')]=_[_0xd562('0x50')](_0x4853f8['model'],qs[_0xd562('0x52')](_0x4b1b0e['query'][_0xd562('0x52')]));_0x456fe7[_0xd562('0x51')]=_0x456fe7[_0xd562('0x51')][_0xd562('0x53')]?_0x456fe7['attributes']:_0x4853f8[_0xd562('0x4b')];if(!_0x4b1b0e[_0xd562('0x4d')][_0xd562('0x54')](_0xd562('0x6e'))){_0x456fe7[_0xd562('0x35')]=qs['limit'](_0x4b1b0e['query'][_0xd562('0x35')]);_0x456fe7[_0xd562('0x33')]=qs['offset'](_0x4b1b0e[_0xd562('0x4d')][_0xd562('0x33')]);}_0x456fe7[_0xd562('0x55')]=qs[_0xd562('0x56')](_0x4b1b0e['query']['sort']);_0x456fe7[_0xd562('0x57')]=qs[_0xd562('0x4f')](_[_0xd562('0x58')](_0x4b1b0e[_0xd562('0x4d')],_0x4853f8[_0xd562('0x4f')]));_0x456fe7[_0xd562('0x57')][_0xd562('0x6b')]=_0x1cffc7['id'];if(_0x4b1b0e[_0xd562('0x4d')][_0xd562('0x6f')]){_0x456fe7['where']=_['merge'](_0x456fe7[_0xd562('0x57')],{'$or':_[_0xd562('0x45')](_0x456fe7[_0xd562('0x51')],function(_0x39cd80){var _0x5713d5={};_0x5713d5[_0x39cd80]={'$like':'%'+_0x4b1b0e[_0xd562('0x4d')][_0xd562('0x6f')]+'%'};return _0x5713d5;})});}_0x456fe7=_['merge']({},_0x456fe7,_0x4b1b0e[_0xd562('0x59')]);return db[_0xd562('0x6c')][_0xd562('0x36')]({'where':_0x456fe7[_0xd562('0x57')]})['then'](function(_0x4b539e){_0x388e42[_0xd562('0x36')]=_0x4b539e;if(_0x4b1b0e[_0xd562('0x4d')][_0xd562('0x5a')]){_0x456fe7[_0xd562('0x5b')]=[{'all':!![]}];}return db['Disposition'][_0xd562('0x5c')](_0x456fe7);})[_0xd562('0x24')](function(_0x367997){_0x388e42[_0xd562('0x5d')]=_0x367997;return _0x388e42;});}})[_0xd562('0x24')](respondWithFilteredResult(_0x4749b0,_0x456fe7))[_0xd562('0x2f')](handleError(_0x4749b0,null));};exports[_0xd562('0x70')]=function(_0x1477e7,_0x9dac41,_0x15b894){return db[_0xd562('0x46')][_0xd562('0x61')]({'where':{'id':_0x1477e7[_0xd562('0x5f')]['id']}})[_0xd562('0x24')](handleEntityNotFound(_0x9dac41,null))[_0xd562('0x24')](function(_0x386783){if(_0x386783){return _0x386783[_0xd562('0x70')](_0x1477e7[_0xd562('0x4d')][_0xd562('0x71')]);}})[_0xd562('0x24')](respondWithStatusCode(_0x9dac41,null))[_0xd562('0x2f')](handleError(_0x9dac41,null));};exports[_0xd562('0x72')]=function(_0x59639b,_0x5a650c,_0xcca8aa){if(_0x59639b[_0xd562('0x63')]['id']){delete _0x59639b[_0xd562('0x63')]['id'];}return db[_0xd562('0x46')][_0xd562('0x61')]({'where':{'id':_0x59639b[_0xd562('0x5f')]['id']}})[_0xd562('0x24')](handleEntityNotFound(_0x5a650c,null))[_0xd562('0x24')](function(_0x26d7fa){if(_0x26d7fa){_0x59639b[_0xd562('0x63')]['OpenchannelAccountId']=_0x26d7fa['id'];return db[_0xd562('0x73')][_0xd562('0x62')](_0x59639b['body']);}})[_0xd562('0x24')](respondWithResult(_0x5a650c,null))[_0xd562('0x2f')](handleError(_0x5a650c,null));};exports[_0xd562('0x74')]=function(_0x1213bc,_0x384694,_0x47cf2f){var _0xfffbde={'raw':![],'where':{}};var _0x222396={};var _0x334781={'count':0x0,'rows':[]};return db[_0xd562('0x46')]['findOne']({'where':{'id':_0x1213bc['params']['id']}})[_0xd562('0x24')](handleEntityNotFound(_0x384694,null))[_0xd562('0x24')](function(_0x6508a6){if(_0x6508a6){_0x222396[_0xd562('0x4b')]=_[_0xd562('0x4e')](db[_0xd562('0x73')]['rawAttributes']);_0x222396[_0xd562('0x4d')]=_[_0xd562('0x4e')](_0x1213bc[_0xd562('0x4d')]);_0x222396[_0xd562('0x4f')]=_[_0xd562('0x50')](_0x222396['model'],_0x222396[_0xd562('0x4d')]);_0xfffbde[_0xd562('0x51')]=_[_0xd562('0x50')](_0x222396[_0xd562('0x4b')],qs[_0xd562('0x52')](_0x1213bc[_0xd562('0x4d')][_0xd562('0x52')]));_0xfffbde[_0xd562('0x51')]=_0xfffbde['attributes'][_0xd562('0x53')]?_0xfffbde['attributes']:_0x222396[_0xd562('0x4b')];if(!_0x1213bc[_0xd562('0x4d')][_0xd562('0x54')](_0xd562('0x6e'))){_0xfffbde['limit']=qs[_0xd562('0x35')](_0x1213bc['query'][_0xd562('0x35')]);_0xfffbde[_0xd562('0x33')]=qs[_0xd562('0x33')](_0x1213bc[_0xd562('0x4d')][_0xd562('0x33')]);}_0xfffbde[_0xd562('0x55')]=qs[_0xd562('0x56')](_0x1213bc[_0xd562('0x4d')]['sort']);_0xfffbde[_0xd562('0x57')]=qs[_0xd562('0x4f')](_['pick'](_0x1213bc[_0xd562('0x4d')],_0x222396[_0xd562('0x4f')]));_0xfffbde[_0xd562('0x57')][_0xd562('0x6b')]=_0x6508a6['id'];if(_0x1213bc['query'][_0xd562('0x6f')]){_0xfffbde[_0xd562('0x57')]=_[_0xd562('0x60')](_0xfffbde[_0xd562('0x57')],{'$or':_[_0xd562('0x45')](_0xfffbde[_0xd562('0x51')],function(_0x1a491f){var _0x4d2a80={};_0x4d2a80[_0x1a491f]={'$like':'%'+_0x1213bc['query'][_0xd562('0x6f')]+'%'};return _0x4d2a80;})});}_0xfffbde=_[_0xd562('0x60')]({},_0xfffbde,_0x1213bc[_0xd562('0x59')]);return db[_0xd562('0x73')][_0xd562('0x36')]({'where':_0xfffbde['where']})[_0xd562('0x24')](function(_0x21cc2c){_0x334781[_0xd562('0x36')]=_0x21cc2c;if(_0x1213bc[_0xd562('0x4d')]['includeAll']){_0xfffbde[_0xd562('0x5b')]=[{'all':!![]}];}return db['CannedAnswer'][_0xd562('0x5c')](_0xfffbde);})[_0xd562('0x24')](function(_0x332305){_0x334781[_0xd562('0x5d')]=_0x332305;return _0x334781;});}})['then'](respondWithFilteredResult(_0x384694,_0xfffbde))['catch'](handleError(_0x384694,null));};exports[_0xd562('0x75')]=function(_0x3cc5e5,_0x431c28,_0x469391){return db['OpenchannelAccount'][_0xd562('0x61')]({'where':{'id':_0x3cc5e5[_0xd562('0x5f')]['id']}})[_0xd562('0x24')](handleEntityNotFound(_0x431c28,null))[_0xd562('0x24')](function(_0x80299b){if(_0x80299b){return _0x80299b['removeAnswers'](_0x3cc5e5[_0xd562('0x4d')]['ids']);}})[_0xd562('0x24')](respondWithStatusCode(_0x431c28,null))['catch'](handleError(_0x431c28,null));};exports[_0xd562('0x76')]=function(_0x4c030d,_0x4b6cc9,_0x4db27d){var _0x3a18b6={'body':_0x4c030d['body'],'channel':_0xd562('0x77')};var _0x5b0991=[];var _0x11421d=[];var _0x230587={};var _0x4f6f13=![];return db['CmContact']['describe']()[_0xd562('0x24')](function(_0x9cc83e){if(!_0x9cc83e){throw new db[(_0xd562('0x78'))][(_0xd562('0x79'))](_0xd562('0x7a'));}_0x5b0991=_['difference'](_[_0xd562('0x4e')](_0x9cc83e),[_0xd562('0x7b'),_0xd562('0x7c')]);_0x11421d=_[_0xd562('0x7d')](_[_0xd562('0x4e')](_0x9cc83e),[_0xd562('0x7b'),_0xd562('0x7c'),'CompanyId',_0xd562('0x7e')]);if(_0x4c030d[_0xd562('0x63')]['id']){delete _0x4c030d[_0xd562('0x63')]['id'];}if(_['isNil'](_0x4c030d[_0xd562('0x63')]['from'])){throw new db[(_0xd562('0x78'))][(_0xd562('0x79'))](_0xd562('0x7f'));}if(_[_0xd562('0x80')](_0x4c030d[_0xd562('0x63')][_0xd562('0x63')])||_0x4c030d['body'][_0xd562('0x63')]===''){throw new db['Sequelize'][(_0xd562('0x79'))](_0xd562('0x81'));}if(_[_0xd562('0x80')](_0x4c030d[_0xd562('0x63')][_0xd562('0x82')])){throw new db[(_0xd562('0x78'))]['ValidationError'](_0xd562('0x83')+_0x11421d);}if(!_[_0xd562('0x84')](_0x11421d,_0x4c030d[_0xd562('0x63')][_0xd562('0x82')])){throw new db[(_0xd562('0x78'))][(_0xd562('0x79'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x11421d);}_0x230587[_0x4c030d['body'][_0xd562('0x82')]]=_0x4c030d['body'][_0xd562('0x85')];})['then'](function(){return db[_0xd562('0x46')][_0xd562('0x61')]({'where':{'id':_0x4c030d[_0xd562('0x5f')]['id']},'include':[{'model':db[_0xd562('0x86')],'as':_0xd562('0x87'),'include':[{'model':db[_0xd562('0x88')],'as':_0xd562('0x89'),'where':_0x230587,'limit':0x1,'order':[[_0xd562('0x7c'),_0xd562('0x8a')]]}]},{'model':db['OpenchannelApplication'],'as':_0xd562('0x8b')}]});})[_0xd562('0x24')](handleEntityNotFound(_0x4b6cc9,null))[_0xd562('0x24')](function(_0xb18c5c){if(_0xb18c5c&&_0xb18c5c['List']){_0x3a18b6['account']=_0xb18c5c;_0x3a18b6[_0xd562('0x8c')]=_0xb18c5c[_0xd562('0x8b')];_0x3a18b6[_0xd562('0x8d')]=_0xb18c5c[_0xd562('0x87')];_0x3a18b6[_0xd562('0x8c')]=_[_0xd562('0x8e')](_0x3a18b6[_0xd562('0x8c')],[_0xd562('0x8f')],['asc']);if(_0x3a18b6[_0xd562('0x90')][_0xd562('0x8b')]){delete _0x3a18b6[_0xd562('0x90')][_0xd562('0x8b')];}if(_0x3a18b6[_0xd562('0x90')][_0xd562('0x87')]&&_0x3a18b6[_0xd562('0x90')][_0xd562('0x87')][_0xd562('0x89')][_0xd562('0x53')]){return _0x3a18b6[_0xd562('0x90')][_0xd562('0x87')][_0xd562('0x89')][0x0];}var _0x17b7b8=_[_0xd562('0x1b')](_0x4c030d[_0xd562('0x63')],{'firstName':_0x4c030d['body'][_0xd562('0x85')],'ListId':_0xb18c5c[_0xd562('0x7e')]});_0x17b7b8[_0x4c030d[_0xd562('0x63')]['mapKey']]=_0x4c030d[_0xd562('0x63')][_0xd562('0x85')];return db[_0xd562('0x88')][_0xd562('0x62')](_0x17b7b8,{'fields':_0x5b0991,'raw':!![]});}})[_0xd562('0x24')](handleEntityNotFound(_0x4b6cc9,null))[_0xd562('0x24')](function(_0x1cdcfa){_0x3a18b6[_0xd562('0x91')]=_0x1cdcfa;if(_0x1cdcfa){var _0x2aab80={'ContactId':_0x1cdcfa['id'],'OpenchannelAccountId':_0x4c030d[_0xd562('0x5f')]['id'],'from':(_0x1cdcfa[_0xd562('0x92')]||'')+'\x20'+(_0x1cdcfa[_0xd562('0x93')]||'')};var _0x154b72={'OpenchannelAccountId':_0x4c030d[_0xd562('0x5f')]['id'],'closed':![]};if(_0x4c030d['body']['threadId']){_0x154b72[_0xd562('0x94')]=_0x4c030d[_0xd562('0x63')][_0xd562('0x94')];return db['OpenchannelInteraction']['find']({'where':_0x154b72})[_0xd562('0x24')](function(_0xc42337){if(_0xc42337){return[_0xc42337,![]];}_0x2aab80[_0xd562('0x94')]=_0x4c030d['body'][_0xd562('0x94')];_0x2aab80[_0xd562('0x95')]=_0x4c030d[_0xd562('0x63')][_0xd562('0x95')];return db[_0xd562('0x96')][_0xd562('0x62')](_0x2aab80)[_0xd562('0x24')](function(_0x82eb4f){return[_0x82eb4f,!![]];});});}else{_0x154b72[_0xd562('0x94')]=null;}_0x154b72['ContactId']=_0x1cdcfa['id'];return db[_0xd562('0x96')]['find']({'where':_0x154b72})[_0xd562('0x24')](function(_0xfea212){if(_0xfea212){return[_0xfea212,![]];}return db[_0xd562('0x96')][_0xd562('0x62')](_0x2aab80)[_0xd562('0x24')](function(_0x421e76){return[_0x421e76,!![]];});});}})['spread'](function(_0x329bed,_0x4f9787){if(_0x329bed){_0x4f6f13=_0x4f9787;if(!_0x4f9787){var _0x4f21c7={'from':(_0x3a18b6[_0xd562('0x91')][_0xd562('0x92')]||'')+'\x20'+(_0x3a18b6[_0xd562('0x91')][_0xd562('0x93')]||'')};if(_0x4c030d['body'][_0xd562('0x94')]&&_0x4c030d['body'][_0xd562('0x97')]&&_0x4c030d['body']['threadId']!=_0x4c030d[_0xd562('0x63')][_0xd562('0x97')]){_0x4f21c7[_0xd562('0x94')]=_0x4c030d[_0xd562('0x63')][_0xd562('0x97')];}return _0x329bed[_0xd562('0x3a')](_0x4f21c7);}else{return _0x329bed;}}})[_0xd562('0x24')](function(_0x45d9a3){_0x3a18b6['interaction']=_0x45d9a3['get']({'plain':!![]});_0x3a18b6[_0xd562('0x98')][_0xd562('0x99')]=_0x4f6f13;if(_0x3a18b6[_0xd562('0x98')][_0xd562('0x99')]){if(_0x3a18b6[_0xd562('0x90')][_0xd562('0x9a')]){_0x3a18b6[_0xd562('0x8c')][_0xd562('0x9b')]({'id':0x0,'priority':_0x3a18b6[_0xd562('0x8c')][_0xd562('0x53')]+0x1,'app':_0xd562('0x9c'),'appdata':_0xd562('0x9d'),'interval':_0xd562('0x9e')});}}return db[_0xd562('0x9f')][_0xd562('0x62')]({'body':_0x4c030d[_0xd562('0x63')][_0xd562('0x63')],'OpenchannelAccountId':_0x4c030d[_0xd562('0x5f')]['id'],'OpenchannelInteractionId':_0x45d9a3['id'],'direction':'in','ContactId':_0x3a18b6[_0xd562('0x91')]['id'],'AttachmentId':_0x4c030d[_0xd562('0x63')][_0xd562('0xa0')]});})[_0xd562('0x24')](function(_0x10cfad){_0x3a18b6['message']=_0x10cfad;if(_0x3a18b6[_0xd562('0x98')]['UserId']){return db[_0xd562('0xa1')][_0xd562('0x61')]({'attributes':['id','name'],'where':{'id':_0x3a18b6['interaction'][_0xd562('0xa2')]}})[_0xd562('0x24')](function(_0x454c04){if(_0x454c04){_0x3a18b6[_0xd562('0x8c')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x454c04[_0xd562('0x4c')]+','+(_0x3a18b6[_0xd562('0x90')][_0xd562('0xa3')]||0xa),'interval':'*,*,*,*'});_0x3a18b6[_0xd562('0xa4')]=![];}return respondWithRpcPromise(_0xd562('0xa5'),'startRouting',_0x3a18b6);});}return respondWithRpcPromise(_0xd562('0xa5'),'startRouting',_0x3a18b6);})[_0xd562('0x24')](function(_0x14f1ec){respondWithRpcPromise(_0xd562('0xa6'),_0xd562('0xa6'),{'event':_0xd562('0x76'),'message':_0x14f1ec},client9002);return _0x14f1ec;})['then'](respondWithResult(_0x4b6cc9,null))[_0xd562('0x2f')](handleError(_0x4b6cc9,null));};exports['addApplications']=function(_0x44a8f3,_0x5d8862){var _0x377c47=_0x44a8f3[_0xd562('0x5f')]['id'];var _0x4bae70=_0x44a8f3['body'];var _0x8bd629=0xc8;var _0x374db7=null;return db[_0xd562('0xa7')]['transaction']({'isolationLevel':db[_0xd562('0xa7')]['Transaction'][_0xd562('0xa8')][_0xd562('0xa9')]},function(_0x4901b3){return db['OpenchannelAccount'][_0xd562('0x6d')]({'where':{'id':_0x377c47},'transaction':_0x4901b3})[_0xd562('0x24')](function(_0x91f0c5){if(_0x91f0c5){return db['OpenchannelApplication']['destroy']({'where':{'OpenchannelAccountId':_0x377c47},'transaction':_0x4901b3})[_0xd562('0x24')](function(){var _0x4ac552=_[_0xd562('0x45')](_0x4bae70,function(_0x10da06){_0x10da06[_0xd562('0x6b')]=_0x377c47;return _0x10da06;});return db[_0xd562('0xaa')]['bulkCreate'](_0x4ac552,{'transaction':_0x4901b3});});}else{_0x8bd629=0x194;_0x374db7=[];}});})['then'](function(){if(_0x8bd629!==0x194){return db[_0xd562('0xaa')][_0xd562('0xab')]({'where':{'OpenchannelAccountId':_0x377c47},'order':_0xd562('0x8f')})[_0xd562('0x24')](function(_0x17e0f5){_0x374db7=_0x17e0f5;});}})[_0xd562('0x2f')](function(_0x361a95){_0x8bd629=0x1f4;logger[_0xd562('0x2b')](_0x361a95[_0xd562('0x40')]);if(_0x361a95[_0xd562('0x4c')]){delete _0x361a95[_0xd562('0x4c')];}_0x374db7=_0x361a95;})[_0xd562('0xac')](function(){if(_0x374db7===null){_0x5d8862[_0xd562('0x3f')](_0x8bd629);}else{if(_0x8bd629===0x1f4){_0x5d8862[_0xd562('0x30')](_0x8bd629)['send'](_0x374db7);}else{_0x5d8862[_0xd562('0x30')](_0x8bd629)[_0xd562('0x32')](_0x374db7);}}});};exports[_0xd562('0xad')]=function(_0x214fcd,_0x2fe17c,_0xbb4eeb){var _0x476736={};var _0xe9b33c={};var _0x2d765e;var _0x56cd5e;return db[_0xd562('0x46')]['findOne']({'where':{'id':_0x214fcd[_0xd562('0x5f')]['id']}})[_0xd562('0x24')](handleEntityNotFound(_0x2fe17c,null))['then'](function(_0x3e2862){if(_0x3e2862){_0x2d765e=_0x3e2862;_0xe9b33c[_0xd562('0x4b')]=_[_0xd562('0x4e')](db[_0xd562('0xaa')]['rawAttributes']);_0xe9b33c[_0xd562('0x4d')]=_['keys'](_0x214fcd[_0xd562('0x4d')]);_0xe9b33c['filters']=_[_0xd562('0x50')](_0xe9b33c['model'],_0xe9b33c[_0xd562('0x4d')]);_0x476736['attributes']=_['intersection'](_0xe9b33c['model'],qs[_0xd562('0x52')](_0x214fcd[_0xd562('0x4d')][_0xd562('0x52')]));_0x476736[_0xd562('0x51')]=_0x476736['attributes']['length']?_0x476736[_0xd562('0x51')]:_0xe9b33c[_0xd562('0x4b')];_0x476736['order']=qs['sort'](_0x214fcd['query'][_0xd562('0x56')]);_0x476736[_0xd562('0x57')]=qs['filters'](_[_0xd562('0x58')](_0x214fcd[_0xd562('0x4d')],_0xe9b33c[_0xd562('0x4f')]));if(_0x214fcd['query'][_0xd562('0x6f')]){_0x476736['where']=_['merge'](_0x476736[_0xd562('0x57')],{'$or':_['map'](_0x476736['attributes'],function(_0x2ba025){var _0x32f38c={};_0x32f38c[_0x2ba025]={'$like':'%'+_0x214fcd['query'][_0xd562('0x6f')]+'%'};return _0x32f38c;})});}_0x476736=_[_0xd562('0x60')]({},_0x476736,_0x214fcd[_0xd562('0x59')]);return _0x2d765e[_0xd562('0xad')](_0x476736);}})[_0xd562('0x24')](function(_0x206fdf){if(_0x206fdf){_0x56cd5e=_0x206fdf['length'];if(!_0x214fcd[_0xd562('0x4d')][_0xd562('0x54')](_0xd562('0x6e'))){_0x476736['limit']=qs['limit'](_0x214fcd[_0xd562('0x4d')][_0xd562('0x35')]);_0x476736[_0xd562('0x33')]=qs['offset'](_0x214fcd[_0xd562('0x4d')]['offset']);}return _0x2d765e[_0xd562('0xad')](_0x476736);}})[_0xd562('0x24')](function(_0x1575dd){if(_0x1575dd){return _0x1575dd?{'count':_0x56cd5e,'rows':_0x1575dd}:null;}})['then'](respondWithResult(_0x2fe17c,null))[_0xd562('0x2f')](handleError(_0x2fe17c,null));};exports[_0xd562('0xae')]=function(_0x2ea0f7,_0x42b27a,_0x8463f6){var _0x4a85fc={'raw':![],'where':{}};var _0x4b0c9b={};var _0x47645b={'count':0x0,'rows':[]};return db[_0xd562('0x46')][_0xd562('0x6d')]({'where':{'id':_0x2ea0f7['params']['id']}})[_0xd562('0x24')](handleEntityNotFound(_0x42b27a,null))[_0xd562('0x24')](function(_0x1f852e){if(_0x1f852e){_0x4b0c9b[_0xd562('0x4b')]=_[_0xd562('0x4e')](db['OpenchannelInteraction'][_0xd562('0x47')]);_0x4b0c9b[_0xd562('0x4d')]=_[_0xd562('0x4e')](_0x2ea0f7['query']);_0x4b0c9b[_0xd562('0x4f')]=_[_0xd562('0x50')](_0x4b0c9b['model'],_0x4b0c9b[_0xd562('0x4d')]);_0x4a85fc['attributes']=_['intersection'](_0x4b0c9b['model'],qs[_0xd562('0x52')](_0x2ea0f7['query'][_0xd562('0x52')]));_0x4a85fc[_0xd562('0x51')]=_0x4a85fc['attributes']['length']?_0x4a85fc[_0xd562('0x51')]:_0x4b0c9b[_0xd562('0x4b')];if(!_0x2ea0f7[_0xd562('0x4d')][_0xd562('0x54')]('nolimit')){_0x4a85fc[_0xd562('0x35')]=qs[_0xd562('0x35')](_0x2ea0f7['query'][_0xd562('0x35')]);_0x4a85fc[_0xd562('0x33')]=qs[_0xd562('0x33')](_0x2ea0f7['query'][_0xd562('0x33')]);}_0x4a85fc[_0xd562('0x55')]=qs[_0xd562('0x56')](_0x2ea0f7[_0xd562('0x4d')]['sort']);_0x4a85fc[_0xd562('0x57')]=qs[_0xd562('0x4f')](_[_0xd562('0x58')](_0x2ea0f7[_0xd562('0x4d')],_0x4b0c9b['filters']));_0x4a85fc[_0xd562('0x57')][_0xd562('0x6b')]=_0x1f852e['id'];if(_0x2ea0f7[_0xd562('0x4d')][_0xd562('0x6f')]){_0x4a85fc['where']=_[_0xd562('0x60')](_0x4a85fc[_0xd562('0x57')],{'$or':_[_0xd562('0x45')](_0x4a85fc['attributes'],function(_0x15790d){var _0x294b41={};_0x294b41[_0x15790d]={'$like':'%'+_0x2ea0f7[_0xd562('0x4d')]['filter']+'%'};return _0x294b41;})});}_0x4a85fc=_[_0xd562('0x60')]({},_0x4a85fc,_0x2ea0f7[_0xd562('0x59')]);return db[_0xd562('0x96')]['count']({'where':_0x4a85fc['where']})[_0xd562('0x24')](function(_0x550501){_0x47645b['count']=_0x550501;if(_0x2ea0f7['query']['includeAll']){_0x4a85fc[_0xd562('0x5b')]=[{'model':db[_0xd562('0x88')],'as':_0xd562('0xaf'),'required':![]},{'model':db[_0xd562('0xa1')],'as':_0xd562('0xb0'),'attributes':['name',_0xd562('0xb1'),_0xd562('0xb2')],'required':![]},{'model':db[_0xd562('0xb3')],'as':'Tags','attributes':['id',_0xd562('0x4c'),_0xd562('0xb4')],'where':_0x2ea0f7[_0xd562('0x4d')]['tag']?{'id':_0x2ea0f7['query'][_0xd562('0xb5')]}:undefined,'required':_0x2ea0f7[_0xd562('0x4d')][_0xd562('0xb5')]?!![]:![]}];}return db[_0xd562('0x96')][_0xd562('0x5c')](_0x4a85fc);})[_0xd562('0x24')](function(_0x25453e){_0x47645b[_0xd562('0x5d')]=_0x25453e;return _0x47645b;});}})[_0xd562('0x24')](respondWithFilteredResult(_0x42b27a,_0x4a85fc))[_0xd562('0x2f')](handleError(_0x42b27a,null));};exports[_0xd562('0xb6')]=function(_0x360954,_0x53fbb8,_0xb710a){return db[_0xd562('0x46')][_0xd562('0x61')]({'where':{'id':_0x360954[_0xd562('0x5f')]['id']}})[_0xd562('0x24')](handleEntityNotFound(_0x53fbb8,null))[_0xd562('0x24')](function(_0x241cfa){if(_0x241cfa){return _0x241cfa['addAgents'](_0x360954[_0xd562('0x63')][_0xd562('0x71')],_[_0xd562('0xb7')](_0x360954[_0xd562('0x63')],['ids','id'])||{})[_0xd562('0xb8')](function(_0x170381){for(var _0x3d7986=0x0;_0x3d7986<_0x360954[_0xd562('0x63')][_0xd562('0x71')][_0xd562('0x53')];_0x3d7986+=0x1){socket[_0xd562('0xb9')]('userOpenchannelAccount:save',{'UserId':Number(_0x360954[_0xd562('0x63')][_0xd562('0x71')][_0x3d7986]),'OpenchannelAccountId':Number(_0x360954['params']['id'])});}return _0x170381;});}})[_0xd562('0x24')](respondWithResult(_0x53fbb8,null))[_0xd562('0x2f')](handleError(_0x53fbb8,null));};exports[_0xd562('0xba')]=function(_0xc627e7,_0x3a4f62,_0x5ac3c1){return db[_0xd562('0x46')][_0xd562('0x61')]({'where':{'id':_0xc627e7['params']['id']}})[_0xd562('0x24')](handleEntityNotFound(_0x3a4f62,null))[_0xd562('0x24')](function(_0x3091d9){if(_0x3091d9){return _0x3091d9[_0xd562('0xba')](_0xc627e7[_0xd562('0x4d')]['ids'])[_0xd562('0x24')](function(){if(_[_0xd562('0xbb')](_0xc627e7[_0xd562('0x4d')][_0xd562('0x71')])){for(var _0x314ea8=0x0;_0x314ea8<_0xc627e7['query']['ids'][_0xd562('0x53')];_0x314ea8+=0x1){socket['emit'](_0xd562('0xbc'),{'UserId':Number(_0xc627e7['query'][_0xd562('0x71')][_0x314ea8]),'OpenchannelAccountId':Number(_0xc627e7[_0xd562('0x5f')]['id'])});}}else{socket['emit'](_0xd562('0xbc'),{'UserId':Number(_0xc627e7['query'][_0xd562('0x71')]),'OpenchannelAccountId':Number(_0xc627e7['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3a4f62,null))['catch'](handleError(_0x3a4f62,null));};exports[_0xd562('0xbd')]=function(_0x230b16,_0x11f866,_0x25f26e){var _0x4fc766={};var _0x1c4c34={};var _0x13d115;var _0x4c4f00;return db[_0xd562('0x46')][_0xd562('0x6d')]({'where':{'id':_0x230b16[_0xd562('0x5f')]['id']}})[_0xd562('0x24')](handleEntityNotFound(_0x11f866,null))[_0xd562('0x24')](function(_0x549bc7){if(_0x549bc7){_0x13d115=_0x549bc7;_0x1c4c34[_0xd562('0x4b')]=_[_0xd562('0x4e')](db[_0xd562('0xa1')][_0xd562('0x47')]);_0x1c4c34[_0xd562('0x4d')]=_[_0xd562('0x4e')](_0x230b16[_0xd562('0x4d')]);_0x1c4c34[_0xd562('0x4f')]=_['intersection'](_0x1c4c34[_0xd562('0x4b')],_0x1c4c34[_0xd562('0x4d')]);_0x4fc766[_0xd562('0x51')]=_['intersection'](_0x1c4c34[_0xd562('0x4b')],qs[_0xd562('0x52')](_0x230b16[_0xd562('0x4d')][_0xd562('0x52')]));_0x4fc766[_0xd562('0x51')]=_0x4fc766[_0xd562('0x51')]['length']?_0x4fc766[_0xd562('0x51')]:_0x1c4c34[_0xd562('0x4b')];_0x4fc766[_0xd562('0x55')]=qs[_0xd562('0x56')](_0x230b16[_0xd562('0x4d')]['sort']);_0x4fc766['where']=qs['filters'](_['pick'](_0x230b16['query'],_0x1c4c34[_0xd562('0x4f')]));if(_0x230b16[_0xd562('0x4d')][_0xd562('0x6f')]){_0x4fc766[_0xd562('0x57')]=_[_0xd562('0x60')](_0x4fc766['where'],{'$or':_[_0xd562('0x45')](_0x4fc766['attributes'],function(_0xe0ab43){var _0x357a87={};_0x357a87[_0xe0ab43]={'$like':'%'+_0x230b16['query']['filter']+'%'};return _0x357a87;})});}_0x4fc766=_['merge']({},_0x4fc766,_0x230b16[_0xd562('0x59')]);return _0x13d115[_0xd562('0xbd')](_0x4fc766);}})[_0xd562('0x24')](function(_0x3f52c4){if(_0x3f52c4){_0x4c4f00=_0x3f52c4[_0xd562('0x53')];if(!_0x230b16[_0xd562('0x4d')][_0xd562('0x54')]('nolimit')){_0x4fc766['limit']=qs[_0xd562('0x35')](_0x230b16['query']['limit']);_0x4fc766[_0xd562('0x33')]=qs['offset'](_0x230b16['query'][_0xd562('0x33')]);}return _0x13d115[_0xd562('0xbd')](_0x4fc766);}})[_0xd562('0x24')](function(_0x395819){if(_0x395819){return _0x395819?{'count':_0x4c4f00,'rows':_0x395819}:null;}})[_0xd562('0x24')](respondWithResult(_0x11f866,null))[_0xd562('0x2f')](handleError(_0x11f866,null));};exports['send']=function(_0x47c4e2,_0x14569e,_0x364df5){var _0xd79132,_0x59267e,_0x11e571;if(_[_0xd562('0x80')](_0x47c4e2[_0xd562('0x63')][_0xd562('0x63')])||_0x47c4e2[_0xd562('0x63')][_0xd562('0x63')]===''){throw new db[(_0xd562('0x78'))][(_0xd562('0x79'))](_0xd562('0x81'));}if(_[_0xd562('0x80')](_0x47c4e2[_0xd562('0x63')]['to'])){}_0xd79132=_0x47c4e2['body']['to'];return db[_0xd562('0x46')][_0xd562('0x6d')]({'where':{'id':_0x47c4e2[_0xd562('0x5f')]['id']}})[_0xd562('0x24')](handleEntityNotFound(_0x14569e,null))[_0xd562('0x24')](function(_0x4c53e0){if(_0x4c53e0){return db[_0xd562('0x46')][_0xd562('0x61')]({'where':{'id':_0x4c53e0['id']},'include':[{'model':db['CmList'],'as':_0xd562('0x87'),'include':[{'model':db[_0xd562('0x88')],'as':_0xd562('0x89'),'where':{[_0x4c53e0['mapKey']]:_0xd79132},'limit':0x1,'order':[[_0xd562('0x7c'),_0xd562('0x8a')]]}]}]})[_0xd562('0x24')](handleEntityNotFound(_0x14569e,null))[_0xd562('0x24')](function(_0x2dfc76){if(_0x2dfc76&&_0x2dfc76[_0xd562('0x87')]){_0x59267e=_0x2dfc76[_0xd562('0x3c')]({'plain':!![]});if(_0x59267e[_0xd562('0x87')]&&_0x59267e[_0xd562('0x87')][_0xd562('0x89')][_0xd562('0x53')]){return _0x59267e[_0xd562('0x87')][_0xd562('0x89')][0x0];}return db[_0xd562('0x88')][_0xd562('0x62')](_['defaults'](_0x47c4e2['body'],{'firstName':_0xd79132,[_0x2dfc76[_0xd562('0x82')]]:_0xd79132,'phone':_0xd79132,'ListId':_0x59267e[_0xd562('0x7e')]}));}})[_0xd562('0x24')](handleEntityNotFound(_0x14569e,null))[_0xd562('0x24')](function(_0x2c8838){if(_0x2c8838){_0x11e571=_0x2c8838;return db[_0xd562('0x96')][_0xd562('0x61')]({'where':{'ContactId':_0x11e571['id'],'closed':![],'OpenchannelAccountId':_0x59267e['id']}})['then'](function(_0x347130){if(_0x347130){return[_0x347130,![]];}return db[_0xd562('0x96')]['create']({'UserId':_0x47c4e2[_0xd562('0x64')]['id'],'ContactId':_0x11e571['id'],'OpenchannelAccountId':_0x59267e['id'],'lastMsgDirection':'out','Messages':[_[_0xd562('0x60')](_0x47c4e2[_0xd562('0x63')],{'read':![],'body':_0x47c4e2[_0xd562('0x63')][_0xd562('0x63')],'OpenchannelAccountId':_0x59267e['id'],'UserId':_0x47c4e2['user']['id'],'ContactId':_0x11e571['id']})]},{'include':[{'model':db[_0xd562('0x9f')],'as':_0xd562('0xbe')}]})[_0xd562('0x24')](function(_0x4b5e45){return[_0x4b5e45,!![]];});});}})[_0xd562('0xb8')](function(_0x398662,_0x569b4e){if(_0x569b4e){return _0x398662;}return db[_0xd562('0x9f')][_0xd562('0x62')](_[_0xd562('0x60')](_0x47c4e2[_0xd562('0x63')],{'read':![],'body':_0x47c4e2[_0xd562('0x63')][_0xd562('0x63')],'OpenchannelAccountId':_0x59267e['id'],'OpenchannelInteractionId':_0x398662['id'],'UserId':_0x47c4e2[_0xd562('0x64')]['id'],'ContactId':_0x11e571['id']}))[_0xd562('0x24')](function(_0x4dafbe){_0x398662[_0xd562('0xbf')][_0xd562('0xbe')]=[];_0x398662['dataValues'][_0xd562('0xbe')]['push'](_0x4dafbe['dataValues']);return _0x398662;});});}})[_0xd562('0x24')](respondWithResult(_0x14569e,null))[_0xd562('0x2f')](handleError(_0x14569e,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 2ac16f9..6a0f592 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(_0x124157,_0x13d8f6){var _0x475783=function(_0x997985){while(--_0x997985){_0x124157['push'](_0x124157['shift']());}};_0x475783(++_0x13d8f6);}(_0x4522,0x1a0));var _0x2452=function(_0x3bf90a,_0x4dc699){_0x3bf90a=_0x3bf90a-0x0;var _0x47a390=_0x4522[_0x3bf90a];return _0x47a390;};'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 _0x9bde=['exports','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x5743e3,_0x4a2aab){var _0x24d100=function(_0x10737c){while(--_0x10737c){_0x5743e3['push'](_0x5743e3['shift']());}};_0x24d100(++_0x4a2aab);}(_0x9bde,0xe1));var _0xe9bd=function(_0x38760d,_0x4fcd06){_0x38760d=_0x38760d-0x0;var _0xcafdb3=_0x9bde[_0x38760d];return _0xcafdb3;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xe9bd('0x0'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xe9bd('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe9bd('0x2'),'afterDestroy':_0xe9bd('0x3')};function emitEvent(_0x131f6a){return function(_0x1c1b34,_0x10822d,_0x1a4d14){OpenchannelAccountEvents[_0xe9bd('0x4')](_0x131f6a+':'+_0x1c1b34['id'],_0x1c1b34);OpenchannelAccountEvents['emit'](_0x131f6a,_0x1c1b34);_0x1a4d14(null);};}for(var e in events){if(events[_0xe9bd('0x5')](e)){var event=events[e];OpenchannelAccount[_0xe9bd('0x6')](e,emitEvent(event));}}module[_0xe9bd('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index a1dff1e..368a2c6 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(_0x42bf39,_0xb761c9){var _0x2856d1=function(_0x1ccb65){while(--_0x1ccb65){_0x42bf39['push'](_0x42bf39['shift']());}};_0x2856d1(++_0xb761c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x3f5c49,_0x477b11){var _0x124526=function(_0x449d6d){while(--_0x449d6d){_0x3f5c49['push'](_0x3f5c49['shift']());}};_0x124526(++_0x477b11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index d4b6b19..c7cec9b 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 _0x80ed=['../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x5e11a3,_0x3e7ff6){var _0x5eba75=function(_0x39ae0f){while(--_0x39ae0f){_0x5e11a3['push'](_0x5e11a3['shift']());}};_0x5eba75(++_0x3e7ff6);}(_0x80ed,0x11c));var _0xd80e=function(_0x3ef210,_0x101371){_0x3ef210=_0x3ef210-0x0;var _0x36d3ca=_0x80ed[_0x3ef210];return _0x36d3ca;};'use strict';var _=require(_0xd80e('0x0'));var util=require('util');var moment=require(_0xd80e('0x1'));var BPromise=require(_0xd80e('0x2'));var rs=require(_0xd80e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd80e('0x4'))['db'];var utils=require(_0xd80e('0x5'));var logger=require(_0xd80e('0x6'))(_0xd80e('0x7'));var config=require('../../config/environment');var jayson=require(_0xd80e('0x8'));var client=jayson[_0xd80e('0x9')][_0xd80e('0xa')]({'port':0x232a});config['redis']=_[_0xd80e('0xb')](config[_0xd80e('0xc')],{'host':_0xd80e('0xd'),'port':0x18eb});var socket=require(_0xd80e('0xe'))(new Redis(config[_0xd80e('0xc')]));require(_0xd80e('0xf'))[_0xd80e('0x10')](socket);function respondWithRpcPromise(_0x2457f5,_0x68625,_0x7f93b4){return new BPromise(function(_0x4eee08,_0x450b44){return client[_0xd80e('0x11')](_0x2457f5,_0x7f93b4)[_0xd80e('0x12')](function(_0x30c9d0){logger[_0xd80e('0x13')](_0xd80e('0x14'),_0x68625,_0xd80e('0x15'));logger[_0xd80e('0x16')](_0xd80e('0x17'),_0x68625,'request\x20sent',JSON['stringify'](_0x30c9d0));if(_0x30c9d0['error']){if(_0x30c9d0['error'][_0xd80e('0x18')]===0x1f4){logger[_0xd80e('0x19')](_0xd80e('0x14'),_0x68625,_0x30c9d0[_0xd80e('0x19')][_0xd80e('0x1a')]);return _0x450b44(_0x30c9d0['error'][_0xd80e('0x1a')]);}logger[_0xd80e('0x19')](_0xd80e('0x14'),_0x68625,_0x30c9d0[_0xd80e('0x19')][_0xd80e('0x1a')]);return _0x4eee08(_0x30c9d0[_0xd80e('0x19')][_0xd80e('0x1a')]);}else{logger[_0xd80e('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x68625,_0xd80e('0x15'));_0x4eee08(_0x30c9d0[_0xd80e('0x1b')][_0xd80e('0x1a')]);}})[_0xd80e('0x1c')](function(_0x593af6){logger[_0xd80e('0x19')](_0xd80e('0x14'),_0x68625,_0x593af6);_0x450b44(_0x593af6);});});} \ No newline at end of file +var _0x6b24=['code','message','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6b24,0x1ce));var _0x46b2=function(_0x3f3f40,_0x4c71f4){_0x3f3f40=_0x3f3f40-0x0;var _0x403b7a=_0x6b24[_0x3f3f40];return _0x403b7a;};'use strict';var _=require('lodash');var util=require(_0x46b2('0x0'));var moment=require(_0x46b2('0x1'));var BPromise=require(_0x46b2('0x2'));var rs=require(_0x46b2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x46b2('0x4'))('rpc');var config=require(_0x46b2('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x46b2('0x6')]['http']({'port':0x232a});config['redis']=_[_0x46b2('0x7')](config[_0x46b2('0x8')],{'host':_0x46b2('0x9'),'port':0x18eb});var socket=require(_0x46b2('0xa'))(new Redis(config[_0x46b2('0x8')]));require(_0x46b2('0xb'))[_0x46b2('0xc')](socket);function respondWithRpcPromise(_0xde459c,_0x3e6b4d,_0x4eb77c){return new BPromise(function(_0x579340,_0x36e63a){return client[_0x46b2('0xd')](_0xde459c,_0x4eb77c)[_0x46b2('0xe')](function(_0x5bb2c3){logger[_0x46b2('0xf')](_0x46b2('0x10'),_0x3e6b4d,_0x46b2('0x11'));logger['debug'](_0x46b2('0x12'),_0x3e6b4d,_0x46b2('0x11'),JSON[_0x46b2('0x13')](_0x5bb2c3));if(_0x5bb2c3[_0x46b2('0x14')]){if(_0x5bb2c3[_0x46b2('0x14')][_0x46b2('0x15')]===0x1f4){logger[_0x46b2('0x14')](_0x46b2('0x10'),_0x3e6b4d,_0x5bb2c3[_0x46b2('0x14')][_0x46b2('0x16')]);return _0x36e63a(_0x5bb2c3['error'][_0x46b2('0x16')]);}logger[_0x46b2('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x3e6b4d,_0x5bb2c3[_0x46b2('0x14')][_0x46b2('0x16')]);return _0x579340(_0x5bb2c3[_0x46b2('0x14')][_0x46b2('0x16')]);}else{logger[_0x46b2('0xf')](_0x46b2('0x10'),_0x3e6b4d,_0x46b2('0x11'));_0x579340(_0x5bb2c3['result'][_0x46b2('0x16')]);}})['catch'](function(_0x2fc246){logger[_0x46b2('0x14')](_0x46b2('0x10'),_0x3e6b4d,_0x2fc246);_0x36e63a(_0x2fc246);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 3eb5568..e778b50 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 _0x847d=['length','openchannelAccount:','save','remove','update','emit','removeListener','register'];(function(_0x1cd634,_0x2fc2e0){var _0x42898f=function(_0x34f21f){while(--_0x34f21f){_0x1cd634['push'](_0x1cd634['shift']());}};_0x42898f(++_0x2fc2e0);}(_0x847d,0x14a));var _0xd847=function(_0xaa6a4,_0x64b067){_0xaa6a4=_0xaa6a4-0x0;var _0xdc31a4=_0x847d[_0xaa6a4];return _0xdc31a4;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xd847('0x0'),_0xd847('0x1'),_0xd847('0x2')];function createListener(_0x4f2500,_0x202b1c){return function(_0x4a85d8){_0x202b1c[_0xd847('0x3')](_0x4f2500,_0x4a85d8);};}function removeListener(_0x18051f,_0x5258c0){return function(){OpenchannelAccountEvents[_0xd847('0x4')](_0x18051f,_0x5258c0);};}exports[_0xd847('0x5')]=function(_0x375a88){for(var _0x13d8d4=0x0,_0x5f3349=events[_0xd847('0x6')];_0x13d8d4<_0x5f3349;_0x13d8d4++){var _0x19fdb5=events[_0x13d8d4];var _0x2bb22b=createListener(_0xd847('0x7')+_0x19fdb5,_0x375a88);OpenchannelAccountEvents['on'](_0x19fdb5,_0x2bb22b);}}; \ No newline at end of file +var _0xcb18=['remove','emit','removeListener','register','openchannelAccount:'];(function(_0x4c0c7b,_0x3a9920){var _0xdf711b=function(_0x276a8e){while(--_0x276a8e){_0x4c0c7b['push'](_0x4c0c7b['shift']());}};_0xdf711b(++_0x3a9920);}(_0xcb18,0x159));var _0x8cb1=function(_0x1fb3fe,_0x333cc5){_0x1fb3fe=_0x1fb3fe-0x0;var _0x4c40a8=_0xcb18[_0x1fb3fe];return _0x4c40a8;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x8cb1('0x0'),'update'];function createListener(_0x3df352,_0x50513d){return function(_0x5e800d){_0x50513d[_0x8cb1('0x1')](_0x3df352,_0x5e800d);};}function removeListener(_0x87b1d3,_0x15d761){return function(){OpenchannelAccountEvents[_0x8cb1('0x2')](_0x87b1d3,_0x15d761);};}exports[_0x8cb1('0x3')]=function(_0x503927){for(var _0x355d91=0x0,_0x335e41=events['length'];_0x355d91<_0x335e41;_0x355d91++){var _0x186f71=events[_0x355d91];var _0x510e92=createListener(_0x8cb1('0x4')+_0x186f71,_0x503927);OpenchannelAccountEvents['on'](_0x186f71,_0x510e92);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index d93eac9..86db301 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 _0x7c7b=['Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','express'];(function(_0x42e5d5,_0x5c1766){var _0x1c426e=function(_0xa406f9){while(--_0xa406f9){_0x42e5d5['push'](_0x42e5d5['shift']());}};_0x1c426e(++_0x5c1766);}(_0x7c7b,0x11a));var _0xb7c7=function(_0x174175,_0x251250){_0x174175=_0x174175-0x0;var _0x2eff46=_0x7c7b[_0x174175];return _0x2eff46;};'use strict';var multer=require(_0xb7c7('0x0'));var util=require(_0xb7c7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb7c7('0x2'));var router=express[_0xb7c7('0x3')]();var fs_extra=require(_0xb7c7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb7c7('0x5'));var config=require(_0xb7c7('0x6'));var controller=require(_0xb7c7('0x7'));router[_0xb7c7('0x8')]('/',auth[_0xb7c7('0x9')](),controller[_0xb7c7('0xa')]);router[_0xb7c7('0x8')](_0xb7c7('0xb'),auth[_0xb7c7('0x9')](),controller[_0xb7c7('0xc')]);router[_0xb7c7('0xd')]('/',auth[_0xb7c7('0x9')](),controller[_0xb7c7('0xe')]);router[_0xb7c7('0xf')](_0xb7c7('0xb'),auth[_0xb7c7('0x9')](),controller[_0xb7c7('0x10')]);router[_0xb7c7('0x11')]('/:id',auth[_0xb7c7('0x9')](),controller['destroy']);module[_0xb7c7('0x12')]=router; \ No newline at end of file +var _0x0ff7=['destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete'];(function(_0x155a1a,_0x4fd637){var _0x362df7=function(_0x3e2b15){while(--_0x3e2b15){_0x155a1a['push'](_0x155a1a['shift']());}};_0x362df7(++_0x4fd637);}(_0x0ff7,0x12e));var _0x70ff=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x0ff7[_0x4b2436];return _0x4f5ab2;};'use strict';var multer=require('multer');var util=require(_0x70ff('0x0'));var path=require('path');var timeout=require(_0x70ff('0x1'));var express=require(_0x70ff('0x2'));var router=express[_0x70ff('0x3')]();var fs_extra=require(_0x70ff('0x4'));var auth=require(_0x70ff('0x5'));var interaction=require(_0x70ff('0x6'));var config=require(_0x70ff('0x7'));var controller=require(_0x70ff('0x8'));router[_0x70ff('0x9')]('/',auth['isAuthenticated'](),controller[_0x70ff('0xa')]);router['get'](_0x70ff('0xb'),auth[_0x70ff('0xc')](),controller[_0x70ff('0xd')]);router[_0x70ff('0xe')]('/',auth[_0x70ff('0xc')](),controller['create']);router[_0x70ff('0xf')]('/:id',auth[_0x70ff('0xc')](),controller[_0x70ff('0x10')]);router[_0x70ff('0x11')](_0x70ff('0xb'),auth[_0x70ff('0xc')](),controller[_0x70ff('0x12')]);module[_0x70ff('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index b377683..e4e822f 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 _0xd149=['*,*,*,*','sequelize','exports','INTEGER','noop','TEXT','STRING'];(function(_0x569d6c,_0x38e90e){var _0x5462bd=function(_0x502129){while(--_0x502129){_0x569d6c['push'](_0x569d6c['shift']());}};_0x5462bd(++_0x38e90e);}(_0xd149,0x189));var _0x9d14=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xd149[_0x39096d];return _0x13da4f;};'use strict';var Sequelize=require(_0x9d14('0x0'));module[_0x9d14('0x1')]={'priority':{'type':Sequelize[_0x9d14('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9d14('0x3')},'appdata':{'type':Sequelize[_0x9d14('0x4')]()},'description':{'type':Sequelize[_0x9d14('0x5')]},'interval':{'type':Sequelize[_0x9d14('0x5')],'defaultValue':_0x9d14('0x6')}}; \ No newline at end of file +var _0x98ab=['sequelize','exports','INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x31cd9a,_0x150ae1){var _0x558637=function(_0x2d18ee){while(--_0x2d18ee){_0x31cd9a['push'](_0x31cd9a['shift']());}};_0x558637(++_0x150ae1);}(_0x98ab,0xfc));var _0xb98a=function(_0x2ff142,_0x1616be){_0x2ff142=_0x2ff142-0x0;var _0x3c2e10=_0x98ab[_0x2ff142];return _0x3c2e10;};'use strict';var Sequelize=require(_0xb98a('0x0'));module[_0xb98a('0x1')]={'priority':{'type':Sequelize[_0xb98a('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb98a('0x3')},'appdata':{'type':Sequelize[_0xb98a('0x4')]()},'description':{'type':Sequelize[_0xb98a('0x5')]},'interval':{'type':Sequelize[_0xb98a('0x5')],'defaultValue':_0xb98a('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index be95fbf..4653145 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 _0x6e60=['count','offset','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','index','map','OpenchannelApplication','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','params','rawAttributes','find','create','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit'];(function(_0x3d0fa1,_0xd57cd6){var _0x4660bc=function(_0x5358ac){while(--_0x5358ac){_0x3d0fa1['push'](_0x3d0fa1['shift']());}};_0x4660bc(++_0xd57cd6);}(_0x6e60,0x195));var _0x06e6=function(_0x1badf3,_0x4fadc8){_0x1badf3=_0x1badf3-0x0;var _0x2c4471=_0x6e60[_0x1badf3];return _0x2c4471;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x06e6('0x0'));var zipdir=require(_0x06e6('0x1'));var jsonpatch=require(_0x06e6('0x2'));var rp=require(_0x06e6('0x3'));var moment=require('moment');var BPromise=require(_0x06e6('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x06e6('0x5'));var csv=require('to-csv');var ejs=require(_0x06e6('0x6'));var fs=require('fs');var fs_extra=require(_0x06e6('0x7'));var _=require(_0x06e6('0x8'));var squel=require(_0x06e6('0x9'));var crypto=require('crypto');var jsforce=require(_0x06e6('0xa'));var deskjs=require(_0x06e6('0xb'));var toCsv=require(_0x06e6('0xc'));var querystring=require(_0x06e6('0xd'));var Papa=require(_0x06e6('0xe'));var Redis=require('ioredis');var authService=require(_0x06e6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x06e6('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x06e6('0x11'))(_0x06e6('0x12'));var utils=require(_0x06e6('0x13'));var config=require(_0x06e6('0x14'));var licenseUtil=require(_0x06e6('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55aa6c,_0x29f67b){_0x29f67b=_0x29f67b||0xcc;return function(_0x58a19d){if(_0x58a19d){return _0x55aa6c[_0x06e6('0x16')](_0x29f67b);}return _0x55aa6c[_0x06e6('0x17')](_0x29f67b)['end']();};}function respondWithResult(_0x4ac73a,_0x521f8a){_0x521f8a=_0x521f8a||0xc8;return function(_0x3a58fd){if(_0x3a58fd){return _0x4ac73a[_0x06e6('0x17')](_0x521f8a)[_0x06e6('0x18')](_0x3a58fd);}};}function respondWithFilteredResult(_0x330b35,_0x5473f6){return function(_0x2325a2){if(_0x2325a2){var _0xc57b59=typeof _0x5473f6['offset']===_0x06e6('0x19')&&typeof _0x5473f6[_0x06e6('0x1a')]===_0x06e6('0x19');var _0x1d6d8a=_0x2325a2[_0x06e6('0x1b')];var _0x2efe13=_0xc57b59?0x0:_0x5473f6[_0x06e6('0x1c')];var _0x59b150=_0xc57b59?_0x2325a2[_0x06e6('0x1b')]:_0x5473f6[_0x06e6('0x1c')]+_0x5473f6[_0x06e6('0x1a')];var _0x60026c;if(_0x59b150>=_0x1d6d8a){_0x59b150=_0x1d6d8a;_0x60026c=0xc8;}else{_0x60026c=0xce;}_0x330b35[_0x06e6('0x17')](_0x60026c);return _0x330b35[_0x06e6('0x1d')](_0x06e6('0x1e'),_0x2efe13+'-'+_0x59b150+'/'+_0x1d6d8a)[_0x06e6('0x18')](_0x2325a2);}return null;};}function patchUpdates(_0x295d2d){return function(_0x108ee7){try{jsonpatch[_0x06e6('0x1f')](_0x108ee7,_0x295d2d,!![]);}catch(_0x185050){return BPromise[_0x06e6('0x20')](_0x185050);}return _0x108ee7[_0x06e6('0x21')]();};}function saveUpdates(_0x388483,_0x320ea6){return function(_0x283402){if(_0x283402){return _0x283402[_0x06e6('0x22')](_0x388483)['then'](function(_0x39f812){return _0x39f812;});}return null;};}function removeEntity(_0x30f097,_0x1e002e){return function(_0x4452a8){if(_0x4452a8){return _0x4452a8['destroy']()[_0x06e6('0x23')](function(){_0x30f097[_0x06e6('0x17')](0xcc)[_0x06e6('0x24')]();});}};}function handleEntityNotFound(_0x227ea4,_0xc7768){return function(_0x1c2fcd){if(!_0x1c2fcd){_0x227ea4[_0x06e6('0x16')](0x194);}return _0x1c2fcd;};}function handleError(_0x27ae3d,_0xdb07b4){_0xdb07b4=_0xdb07b4||0x1f4;return function(_0x26d01c){logger[_0x06e6('0x25')](_0x26d01c[_0x06e6('0x26')]);if(_0x26d01c[_0x06e6('0x27')]){delete _0x26d01c[_0x06e6('0x27')];}_0x27ae3d[_0x06e6('0x17')](_0xdb07b4)['send'](_0x26d01c);};}exports[_0x06e6('0x28')]=function(_0x3cfb72,_0x451a3b){var _0x3450cf={},_0x32c8a2={},_0x57a552={'count':0x0,'rows':[]};var _0x19ad81=_[_0x06e6('0x29')](db[_0x06e6('0x2a')]['rawAttributes'],function(_0x487dc7){return{'name':_0x487dc7[_0x06e6('0x2b')],'type':_0x487dc7[_0x06e6('0x2c')]['key']};});_0x32c8a2['model']=_[_0x06e6('0x29')](_0x19ad81,_0x06e6('0x27'));_0x32c8a2[_0x06e6('0x2d')]=_[_0x06e6('0x2e')](_0x3cfb72[_0x06e6('0x2d')]);_0x32c8a2[_0x06e6('0x2f')]=_[_0x06e6('0x30')](_0x32c8a2[_0x06e6('0x31')],_0x32c8a2[_0x06e6('0x2d')]);_0x3450cf['attributes']=_[_0x06e6('0x30')](_0x32c8a2[_0x06e6('0x31')],qs['fields'](_0x3cfb72[_0x06e6('0x2d')][_0x06e6('0x32')]));_0x3450cf[_0x06e6('0x33')]=_0x3450cf[_0x06e6('0x33')][_0x06e6('0x34')]?_0x3450cf['attributes']:_0x32c8a2['model'];if(!_0x3cfb72['query'][_0x06e6('0x35')](_0x06e6('0x36'))){_0x3450cf[_0x06e6('0x1a')]=qs[_0x06e6('0x1a')](_0x3cfb72[_0x06e6('0x2d')][_0x06e6('0x1a')]);_0x3450cf['offset']=qs[_0x06e6('0x1c')](_0x3cfb72[_0x06e6('0x2d')]['offset']);}_0x3450cf[_0x06e6('0x37')]=qs[_0x06e6('0x38')](_0x3cfb72[_0x06e6('0x2d')][_0x06e6('0x38')]);_0x3450cf[_0x06e6('0x39')]=qs['filters'](_[_0x06e6('0x3a')](_0x3cfb72['query'],_0x32c8a2['filters']),_0x19ad81);if(_0x3cfb72['query'][_0x06e6('0x3b')]){_0x3450cf[_0x06e6('0x39')]=_['merge'](_0x3450cf['where'],{'$or':_['map'](_0x19ad81,function(_0x59f319){if(_0x59f319['type']!==_0x06e6('0x3c')){var _0x4bacee={};_0x4bacee[_0x59f319[_0x06e6('0x27')]]={'$like':'%'+_0x3cfb72[_0x06e6('0x2d')][_0x06e6('0x3b')]+'%'};return _0x4bacee;}})});}_0x3450cf=_[_0x06e6('0x3d')]({},_0x3450cf,_0x3cfb72['options']);var _0x423a91={'where':_0x3450cf[_0x06e6('0x39')]};return db[_0x06e6('0x2a')][_0x06e6('0x1b')](_0x423a91)[_0x06e6('0x23')](function(_0x461a55){_0x57a552[_0x06e6('0x1b')]=_0x461a55;if(_0x3cfb72[_0x06e6('0x2d')][_0x06e6('0x3e')]){_0x3450cf[_0x06e6('0x3f')]=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x3450cf);})[_0x06e6('0x23')](function(_0x58b345){_0x57a552[_0x06e6('0x40')]=_0x58b345;return _0x57a552;})[_0x06e6('0x23')](respondWithFilteredResult(_0x451a3b,_0x3450cf))[_0x06e6('0x41')](handleError(_0x451a3b,null));};exports[_0x06e6('0x42')]=function(_0x21491f,_0x55d556){var _0x343553={'raw':!![],'where':{'id':_0x21491f[_0x06e6('0x43')]['id']}},_0xaf851e={};_0xaf851e[_0x06e6('0x31')]=_[_0x06e6('0x2e')](db[_0x06e6('0x2a')][_0x06e6('0x44')]);_0xaf851e[_0x06e6('0x2d')]=_[_0x06e6('0x2e')](_0x21491f[_0x06e6('0x2d')]);_0xaf851e['filters']=_[_0x06e6('0x30')](_0xaf851e['model'],_0xaf851e[_0x06e6('0x2d')]);_0x343553[_0x06e6('0x33')]=_['intersection'](_0xaf851e['model'],qs[_0x06e6('0x32')](_0x21491f[_0x06e6('0x2d')][_0x06e6('0x32')]));_0x343553[_0x06e6('0x33')]=_0x343553['attributes'][_0x06e6('0x34')]?_0x343553['attributes']:_0xaf851e[_0x06e6('0x31')];if(_0x21491f[_0x06e6('0x2d')][_0x06e6('0x3e')]){_0x343553[_0x06e6('0x3f')]=[{'all':!![]}];}_0x343553=_['merge']({},_0x343553,_0x21491f['options']);return db[_0x06e6('0x2a')][_0x06e6('0x45')](_0x343553)[_0x06e6('0x23')](handleEntityNotFound(_0x55d556,null))[_0x06e6('0x23')](respondWithResult(_0x55d556,null))[_0x06e6('0x41')](handleError(_0x55d556,null));};exports[_0x06e6('0x46')]=function(_0x5d7b7c,_0x518f07){return db[_0x06e6('0x2a')][_0x06e6('0x46')](_0x5d7b7c['body'],{})[_0x06e6('0x23')](respondWithResult(_0x518f07,0xc9))[_0x06e6('0x41')](handleError(_0x518f07,null));};exports[_0x06e6('0x22')]=function(_0x5a0381,_0x30df79){if(_0x5a0381['body']['id']){delete _0x5a0381['body']['id'];}return db[_0x06e6('0x2a')][_0x06e6('0x45')]({'where':{'id':_0x5a0381[_0x06e6('0x43')]['id']}})[_0x06e6('0x23')](handleEntityNotFound(_0x30df79,null))[_0x06e6('0x23')](saveUpdates(_0x5a0381['body'],null))[_0x06e6('0x23')](respondWithResult(_0x30df79,null))[_0x06e6('0x41')](handleError(_0x30df79,null));};exports[_0x06e6('0x47')]=function(_0x32923f,_0x2159e1){return db[_0x06e6('0x2a')][_0x06e6('0x45')]({'where':{'id':_0x32923f[_0x06e6('0x43')]['id']}})[_0x06e6('0x23')](handleEntityNotFound(_0x2159e1,null))[_0x06e6('0x23')](removeEntity(_0x2159e1,null))[_0x06e6('0x41')](handleError(_0x2159e1,null));}; \ No newline at end of file +var _0xf2ac=['apply','reject','save','update','then','destroy','end','sendStatus','error','name','index','map','OpenchannelApplication','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','show','keys','include','find','catch','create','body','params','eml-format','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set'];(function(_0x10c4ba,_0x3893ab){var _0x30cdc5=function(_0x109fa9){while(--_0x109fa9){_0x10c4ba['push'](_0x10c4ba['shift']());}};_0x30cdc5(++_0x3893ab);}(_0xf2ac,0x108));var _0xcf2a=function(_0x299f23,_0x2d9fce){_0x299f23=_0x299f23-0x0;var _0x34c76a=_0xf2ac[_0x299f23];return _0x34c76a;};'use strict';var emlformat=require(_0xcf2a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcf2a('0x1'));var rp=require(_0xcf2a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcf2a('0x3'));var path=require(_0xcf2a('0x4'));var sox=require(_0xcf2a('0x5'));var csv=require(_0xcf2a('0x6'));var ejs=require(_0xcf2a('0x7'));var fs=require('fs');var fs_extra=require(_0xcf2a('0x8'));var _=require(_0xcf2a('0x9'));var squel=require(_0xcf2a('0xa'));var crypto=require(_0xcf2a('0xb'));var jsforce=require(_0xcf2a('0xc'));var deskjs=require(_0xcf2a('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcf2a('0xe'));var Papa=require(_0xcf2a('0xf'));var Redis=require(_0xcf2a('0x10'));var authService=require(_0xcf2a('0x11'));var qs=require(_0xcf2a('0x12'));var as=require(_0xcf2a('0x13'));var hardwareService=require(_0xcf2a('0x14'));var logger=require(_0xcf2a('0x15'))(_0xcf2a('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcf2a('0x17'));var db=require(_0xcf2a('0x18'))['db'];function respondWithStatusCode(_0x3a95e8,_0x4fffd){_0x4fffd=_0x4fffd||0xcc;return function(_0x241429){if(_0x241429){return _0x3a95e8['sendStatus'](_0x4fffd);}return _0x3a95e8[_0xcf2a('0x19')](_0x4fffd)['end']();};}function respondWithResult(_0x40c18d,_0x41e7aa){_0x41e7aa=_0x41e7aa||0xc8;return function(_0x2dcf1e){if(_0x2dcf1e){return _0x40c18d[_0xcf2a('0x19')](_0x41e7aa)[_0xcf2a('0x1a')](_0x2dcf1e);}};}function respondWithFilteredResult(_0x283db2,_0x2cd8af){return function(_0xa23500){if(_0xa23500){var _0x3f33f0=typeof _0x2cd8af[_0xcf2a('0x1b')]==='undefined'&&typeof _0x2cd8af[_0xcf2a('0x1c')]===_0xcf2a('0x1d');var _0x48c28b=_0xa23500[_0xcf2a('0x1e')];var _0x40c95f=_0x3f33f0?0x0:_0x2cd8af[_0xcf2a('0x1b')];var _0x51fb22=_0x3f33f0?_0xa23500[_0xcf2a('0x1e')]:_0x2cd8af[_0xcf2a('0x1b')]+_0x2cd8af[_0xcf2a('0x1c')];var _0x487c53;if(_0x51fb22>=_0x48c28b){_0x51fb22=_0x48c28b;_0x487c53=0xc8;}else{_0x487c53=0xce;}_0x283db2[_0xcf2a('0x19')](_0x487c53);return _0x283db2[_0xcf2a('0x1f')]('Content-Range',_0x40c95f+'-'+_0x51fb22+'/'+_0x48c28b)[_0xcf2a('0x1a')](_0xa23500);}return null;};}function patchUpdates(_0x4807f2){return function(_0x28aba7){try{jsonpatch[_0xcf2a('0x20')](_0x28aba7,_0x4807f2,!![]);}catch(_0x55a885){return BPromise[_0xcf2a('0x21')](_0x55a885);}return _0x28aba7[_0xcf2a('0x22')]();};}function saveUpdates(_0x41abfe,_0x58e129){return function(_0x21136e){if(_0x21136e){return _0x21136e[_0xcf2a('0x23')](_0x41abfe)[_0xcf2a('0x24')](function(_0x55809b){return _0x55809b;});}return null;};}function removeEntity(_0x45b5a0,_0x215a24){return function(_0x5c0e63){if(_0x5c0e63){return _0x5c0e63[_0xcf2a('0x25')]()[_0xcf2a('0x24')](function(){_0x45b5a0['status'](0xcc)[_0xcf2a('0x26')]();});}};}function handleEntityNotFound(_0x2fa2c3,_0x5ac646){return function(_0xe06ddd){if(!_0xe06ddd){_0x2fa2c3[_0xcf2a('0x27')](0x194);}return _0xe06ddd;};}function handleError(_0x581226,_0x393fc6){_0x393fc6=_0x393fc6||0x1f4;return function(_0x12e7f8){logger[_0xcf2a('0x28')](_0x12e7f8['stack']);if(_0x12e7f8[_0xcf2a('0x29')]){delete _0x12e7f8[_0xcf2a('0x29')];}_0x581226[_0xcf2a('0x19')](_0x393fc6)['send'](_0x12e7f8);};}exports[_0xcf2a('0x2a')]=function(_0x23679c,_0x473505){var _0x4a1b81={},_0x50ec5e={},_0x5408aa={'count':0x0,'rows':[]};var _0x5ebe10=_[_0xcf2a('0x2b')](db[_0xcf2a('0x2c')][_0xcf2a('0x2d')],function(_0x295974){return{'name':_0x295974['fieldName'],'type':_0x295974[_0xcf2a('0x2e')][_0xcf2a('0x2f')]};});_0x50ec5e[_0xcf2a('0x30')]=_['map'](_0x5ebe10,'name');_0x50ec5e[_0xcf2a('0x31')]=_['keys'](_0x23679c['query']);_0x50ec5e[_0xcf2a('0x32')]=_[_0xcf2a('0x33')](_0x50ec5e['model'],_0x50ec5e[_0xcf2a('0x31')]);_0x4a1b81[_0xcf2a('0x34')]=_[_0xcf2a('0x33')](_0x50ec5e[_0xcf2a('0x30')],qs[_0xcf2a('0x35')](_0x23679c['query'][_0xcf2a('0x35')]));_0x4a1b81['attributes']=_0x4a1b81[_0xcf2a('0x34')][_0xcf2a('0x36')]?_0x4a1b81[_0xcf2a('0x34')]:_0x50ec5e[_0xcf2a('0x30')];if(!_0x23679c[_0xcf2a('0x31')][_0xcf2a('0x37')](_0xcf2a('0x38'))){_0x4a1b81[_0xcf2a('0x1c')]=qs['limit'](_0x23679c['query']['limit']);_0x4a1b81[_0xcf2a('0x1b')]=qs['offset'](_0x23679c['query']['offset']);}_0x4a1b81[_0xcf2a('0x39')]=qs[_0xcf2a('0x3a')](_0x23679c[_0xcf2a('0x31')][_0xcf2a('0x3a')]);_0x4a1b81[_0xcf2a('0x3b')]=qs[_0xcf2a('0x32')](_[_0xcf2a('0x3c')](_0x23679c[_0xcf2a('0x31')],_0x50ec5e[_0xcf2a('0x32')]),_0x5ebe10);if(_0x23679c['query'][_0xcf2a('0x3d')]){_0x4a1b81[_0xcf2a('0x3b')]=_[_0xcf2a('0x3e')](_0x4a1b81[_0xcf2a('0x3b')],{'$or':_[_0xcf2a('0x2b')](_0x5ebe10,function(_0x374491){if(_0x374491[_0xcf2a('0x2e')]!=='VIRTUAL'){var _0x3d1414={};_0x3d1414[_0x374491[_0xcf2a('0x29')]]={'$like':'%'+_0x23679c[_0xcf2a('0x31')][_0xcf2a('0x3d')]+'%'};return _0x3d1414;}})});}_0x4a1b81=_[_0xcf2a('0x3e')]({},_0x4a1b81,_0x23679c[_0xcf2a('0x3f')]);var _0x34179d={'where':_0x4a1b81['where']};return db[_0xcf2a('0x2c')][_0xcf2a('0x1e')](_0x34179d)[_0xcf2a('0x24')](function(_0x51ba2c){_0x5408aa[_0xcf2a('0x1e')]=_0x51ba2c;if(_0x23679c[_0xcf2a('0x31')][_0xcf2a('0x40')]){_0x4a1b81['include']=[{'all':!![]}];}return db[_0xcf2a('0x2c')][_0xcf2a('0x41')](_0x4a1b81);})['then'](function(_0x34e26c){_0x5408aa['rows']=_0x34e26c;return _0x5408aa;})[_0xcf2a('0x24')](respondWithFilteredResult(_0x473505,_0x4a1b81))['catch'](handleError(_0x473505,null));};exports[_0xcf2a('0x42')]=function(_0x415547,_0x3d4b3b){var _0x2382fc={'raw':!![],'where':{'id':_0x415547['params']['id']}},_0x569f26={};_0x569f26[_0xcf2a('0x30')]=_[_0xcf2a('0x43')](db['OpenchannelApplication'][_0xcf2a('0x2d')]);_0x569f26['query']=_[_0xcf2a('0x43')](_0x415547[_0xcf2a('0x31')]);_0x569f26[_0xcf2a('0x32')]=_['intersection'](_0x569f26[_0xcf2a('0x30')],_0x569f26[_0xcf2a('0x31')]);_0x2382fc[_0xcf2a('0x34')]=_[_0xcf2a('0x33')](_0x569f26[_0xcf2a('0x30')],qs[_0xcf2a('0x35')](_0x415547[_0xcf2a('0x31')][_0xcf2a('0x35')]));_0x2382fc[_0xcf2a('0x34')]=_0x2382fc['attributes']['length']?_0x2382fc[_0xcf2a('0x34')]:_0x569f26[_0xcf2a('0x30')];if(_0x415547['query'][_0xcf2a('0x40')]){_0x2382fc[_0xcf2a('0x44')]=[{'all':!![]}];}_0x2382fc=_[_0xcf2a('0x3e')]({},_0x2382fc,_0x415547[_0xcf2a('0x3f')]);return db[_0xcf2a('0x2c')][_0xcf2a('0x45')](_0x2382fc)[_0xcf2a('0x24')](handleEntityNotFound(_0x3d4b3b,null))['then'](respondWithResult(_0x3d4b3b,null))[_0xcf2a('0x46')](handleError(_0x3d4b3b,null));};exports[_0xcf2a('0x47')]=function(_0xc26e8e,_0x150efa){return db[_0xcf2a('0x2c')]['create'](_0xc26e8e[_0xcf2a('0x48')],{})[_0xcf2a('0x24')](respondWithResult(_0x150efa,0xc9))[_0xcf2a('0x46')](handleError(_0x150efa,null));};exports[_0xcf2a('0x23')]=function(_0x14f59c,_0x12351b){if(_0x14f59c[_0xcf2a('0x48')]['id']){delete _0x14f59c[_0xcf2a('0x48')]['id'];}return db[_0xcf2a('0x2c')][_0xcf2a('0x45')]({'where':{'id':_0x14f59c['params']['id']}})[_0xcf2a('0x24')](handleEntityNotFound(_0x12351b,null))['then'](saveUpdates(_0x14f59c[_0xcf2a('0x48')],null))['then'](respondWithResult(_0x12351b,null))[_0xcf2a('0x46')](handleError(_0x12351b,null));};exports[_0xcf2a('0x25')]=function(_0x57db5e,_0x132f56){return db['OpenchannelApplication'][_0xcf2a('0x45')]({'where':{'id':_0x57db5e[_0xcf2a('0x49')]['id']}})['then'](handleEntityNotFound(_0x132f56,null))[_0xcf2a('0x24')](removeEntity(_0x132f56,null))[_0xcf2a('0x46')](handleError(_0x132f56,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index ff5e77d..095d2b2 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 _0x1eb0=['path','../../config/environment','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird'];(function(_0x52017c,_0x393604){var _0xada67d=function(_0x452feb){while(--_0x452feb){_0x52017c['push'](_0x52017c['shift']());}};_0xada67d(++_0x393604);}(_0x1eb0,0x67));var _0x01eb=function(_0x4fb7e1,_0x3ff808){_0x4fb7e1=_0x4fb7e1-0x0;var _0x59ce31=_0x1eb0[_0x4fb7e1];return _0x59ce31;};'use strict';var _=require(_0x01eb('0x0'));var util=require('util');var logger=require(_0x01eb('0x1'))(_0x01eb('0x2'));var moment=require(_0x01eb('0x3'));var BPromise=require(_0x01eb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x01eb('0x5'));var rimraf=require('rimraf');var config=require(_0x01eb('0x6'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x16d286,_0x5215a7){return _0x16d286[_0x01eb('0x7')](_0x01eb('0x8'),attributes,{'tableName':_0x01eb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x01eb('0xa'),'collate':_0x01eb('0xb')});}; \ No newline at end of file +var _0x3040=['lodash','api','moment','bluebird','request-promise','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4'];(function(_0xc4036c,_0x112c80){var _0x27d3dc=function(_0x5c6806){while(--_0x5c6806){_0xc4036c['push'](_0xc4036c['shift']());}};_0x27d3dc(++_0x112c80);}(_0x3040,0x12c));var _0x0304=function(_0x276504,_0x55a6ea){_0x276504=_0x276504-0x0;var _0x1304c1=_0x3040[_0x276504];return _0x1304c1;};'use strict';var _=require(_0x0304('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0304('0x1'));var moment=require(_0x0304('0x2'));var BPromise=require(_0x0304('0x3'));var rp=require(_0x0304('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0304('0x5'));var attributes=require(_0x0304('0x6'));module[_0x0304('0x7')]=function(_0x2ea246,_0x18af9f){return _0x2ea246[_0x0304('0x8')](_0x0304('0x9'),attributes,{'tableName':_0x0304('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0304('0xb'),'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 32400e7..51d15ea 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 _0xa719=['jayson/promise','http','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','UpdateOpenchannelApplication','update','options','where','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5992b4,_0x414e4d){var _0x3df19c=function(_0x29bf04){while(--_0x29bf04){_0x5992b4['push'](_0x5992b4['shift']());}};_0x3df19c(++_0x414e4d);}(_0xa719,0x1dc));var _0x9a71=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xa719[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x9a71('0x0'));var util=require(_0x9a71('0x1'));var moment=require('moment');var BPromise=require(_0x9a71('0x2'));var rs=require(_0x9a71('0x3'));var fs=require('fs');var Redis=require(_0x9a71('0x4'));var db=require(_0x9a71('0x5'))['db'];var utils=require(_0x9a71('0x6'));var logger=require(_0x9a71('0x7'))(_0x9a71('0x8'));var config=require(_0x9a71('0x9'));var jayson=require(_0x9a71('0xa'));var client=jayson['client'][_0x9a71('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x101623,_0x21bf2d,_0x45e133){return new BPromise(function(_0x291a69,_0x3415a1){return client['request'](_0x101623,_0x45e133)[_0x9a71('0xc')](function(_0x45ae69){logger['info'](_0x9a71('0xd'),_0x21bf2d,_0x9a71('0xe'));logger[_0x9a71('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x21bf2d,_0x9a71('0xe'),JSON[_0x9a71('0x10')](_0x45ae69));if(_0x45ae69[_0x9a71('0x11')]){if(_0x45ae69[_0x9a71('0x11')][_0x9a71('0x12')]===0x1f4){logger[_0x9a71('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x21bf2d,_0x45ae69[_0x9a71('0x11')][_0x9a71('0x13')]);return _0x3415a1(_0x45ae69[_0x9a71('0x11')][_0x9a71('0x13')]);}logger[_0x9a71('0x11')](_0x9a71('0xd'),_0x21bf2d,_0x45ae69[_0x9a71('0x11')][_0x9a71('0x13')]);return _0x291a69(_0x45ae69[_0x9a71('0x11')][_0x9a71('0x13')]);}else{logger[_0x9a71('0x14')](_0x9a71('0xd'),_0x21bf2d,_0x9a71('0xe'));_0x291a69(_0x45ae69[_0x9a71('0x15')][_0x9a71('0x13')]);}})['catch'](function(_0x24a003){logger[_0x9a71('0x11')](_0x9a71('0xd'),_0x21bf2d,_0x24a003);_0x3415a1(_0x24a003);});});}exports[_0x9a71('0x16')]=function(_0xf41861){var _0x87cb26=this;return new Promise(function(_0x2bc514,_0xde80a1){return db['OpenchannelApplication'][_0x9a71('0x17')](_0xf41861['body'],{'raw':_0xf41861[_0x9a71('0x18')]?_0xf41861[_0x9a71('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf41861[_0x9a71('0x18')]?_0xf41861[_0x9a71('0x18')][_0x9a71('0x19')]||null:null,'attributes':_0xf41861[_0x9a71('0x18')]?_0xf41861['options']['attributes']||null:null,'limit':_0xf41861['options']?_0xf41861[_0x9a71('0x18')]['limit']||null:null})[_0x9a71('0xc')](function(_0x13a236){logger['info'](_0x9a71('0x16'),_0xf41861);logger[_0x9a71('0xf')](_0x9a71('0x16'),_0xf41861,JSON[_0x9a71('0x10')](_0x13a236));_0x2bc514(_0x13a236);})[_0x9a71('0x1a')](function(_0x595e80){logger[_0x9a71('0x11')](_0x9a71('0x16'),_0x595e80[_0x9a71('0x13')],_0xf41861);_0xde80a1(_0x87cb26['error'](0x1f4,_0x595e80[_0x9a71('0x13')]));});});}; \ No newline at end of file +var _0x2d7f=['error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','raw','options','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x7d1b89,_0x58faa5){var _0x435a5b=function(_0x358473){while(--_0x358473){_0x7d1b89['push'](_0x7d1b89['shift']());}};_0x435a5b(++_0x58faa5);}(_0x2d7f,0x14d));var _0xf2d7=function(_0x512096,_0x32653e){_0x512096=_0x512096-0x0;var _0x1c120f=_0x2d7f[_0x512096];return _0x1c120f;};'use strict';var _=require(_0xf2d7('0x0'));var util=require('util');var moment=require(_0xf2d7('0x1'));var BPromise=require(_0xf2d7('0x2'));var rs=require(_0xf2d7('0x3'));var fs=require('fs');var Redis=require(_0xf2d7('0x4'));var db=require(_0xf2d7('0x5'))['db'];var utils=require(_0xf2d7('0x6'));var logger=require(_0xf2d7('0x7'))('rpc');var config=require(_0xf2d7('0x8'));var jayson=require(_0xf2d7('0x9'));var client=jayson[_0xf2d7('0xa')][_0xf2d7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c6e02,_0x20a9f8,_0x32affe){return new BPromise(function(_0x48c379,_0x160f11){return client[_0xf2d7('0xc')](_0x3c6e02,_0x32affe)[_0xf2d7('0xd')](function(_0x2178ad){logger[_0xf2d7('0xe')](_0xf2d7('0xf'),_0x20a9f8,_0xf2d7('0x10'));logger[_0xf2d7('0x11')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x20a9f8,_0xf2d7('0x10'),JSON[_0xf2d7('0x12')](_0x2178ad));if(_0x2178ad[_0xf2d7('0x13')]){if(_0x2178ad['error'][_0xf2d7('0x14')]===0x1f4){logger['error'](_0xf2d7('0xf'),_0x20a9f8,_0x2178ad[_0xf2d7('0x13')][_0xf2d7('0x15')]);return _0x160f11(_0x2178ad['error']['message']);}logger[_0xf2d7('0x13')](_0xf2d7('0xf'),_0x20a9f8,_0x2178ad[_0xf2d7('0x13')]['message']);return _0x48c379(_0x2178ad[_0xf2d7('0x13')][_0xf2d7('0x15')]);}else{logger[_0xf2d7('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x20a9f8,_0xf2d7('0x10'));_0x48c379(_0x2178ad[_0xf2d7('0x16')][_0xf2d7('0x15')]);}})[_0xf2d7('0x17')](function(_0x3d363e){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x20a9f8,_0x3d363e);_0x160f11(_0x3d363e);});});}exports[_0xf2d7('0x18')]=function(_0xba83f9){var _0x5c8e2b=this;return new Promise(function(_0x2ae710,_0x5e841d){return db[_0xf2d7('0x19')][_0xf2d7('0x1a')](_0xba83f9[_0xf2d7('0x1b')],{'raw':_0xba83f9['options']?_0xba83f9['options'][_0xf2d7('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xba83f9[_0xf2d7('0x1d')]?_0xba83f9[_0xf2d7('0x1d')]['where']||null:null,'attributes':_0xba83f9[_0xf2d7('0x1d')]?_0xba83f9[_0xf2d7('0x1d')][_0xf2d7('0x1e')]||null:null,'limit':_0xba83f9[_0xf2d7('0x1d')]?_0xba83f9[_0xf2d7('0x1d')][_0xf2d7('0x1f')]||null:null})[_0xf2d7('0xd')](function(_0x55ee13){logger[_0xf2d7('0xe')](_0xf2d7('0x18'),_0xba83f9);logger[_0xf2d7('0x11')](_0xf2d7('0x18'),_0xba83f9,JSON['stringify'](_0x55ee13));_0x2ae710(_0x55ee13);})['catch'](function(_0x2f5717){logger['error'](_0xf2d7('0x18'),_0x2f5717[_0xf2d7('0x15')],_0xba83f9);_0x5e841d(_0x5c8e2b[_0xf2d7('0x13')](0x1f4,_0x2f5717['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 7335c1d..2719f57 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 _0x1a77=['tracked','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','/:id/tags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','openchannel','openchannelinteraction:addtags','addTags','put'];(function(_0x5ad0d7,_0x2645f8){var _0xd83bd=function(_0x33d3bd){while(--_0x33d3bd){_0x5ad0d7['push'](_0x5ad0d7['shift']());}};_0xd83bd(++_0x2645f8);}(_0x1a77,0x118));var _0x71a7=function(_0x2d2910,_0x2e1172){_0x2d2910=_0x2d2910-0x0;var _0x394e5c=_0x1a77[_0x2d2910];return _0x394e5c;};'use strict';var multer=require('multer');var util=require(_0x71a7('0x0'));var path=require(_0x71a7('0x1'));var timeout=require(_0x71a7('0x2'));var express=require(_0x71a7('0x3'));var router=express[_0x71a7('0x4')]();var fs_extra=require(_0x71a7('0x5'));var auth=require(_0x71a7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x71a7('0x7'));var controller=require(_0x71a7('0x8'));router[_0x71a7('0x9')]('/',auth[_0x71a7('0xa')](),controller[_0x71a7('0xb')]);router[_0x71a7('0x9')](_0x71a7('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x71a7('0x9')](_0x71a7('0xd'),auth[_0x71a7('0xa')](),controller[_0x71a7('0xe')]);router[_0x71a7('0x9')](_0x71a7('0xf'),auth[_0x71a7('0xa')](),controller[_0x71a7('0x10')]);router[_0x71a7('0x9')](_0x71a7('0x11'),auth[_0x71a7('0xa')](),controller[_0x71a7('0x12')]);router[_0x71a7('0x13')]('/',auth[_0x71a7('0xa')](),controller[_0x71a7('0x14')]);router[_0x71a7('0x13')]('/:id/messages',auth[_0x71a7('0xa')](),controller[_0x71a7('0x15')]);router['post']('/:id/tags',auth[_0x71a7('0xa')](),interaction['tracked'](_0x71a7('0x16'),_0x71a7('0x17')),controller[_0x71a7('0x18')]);router[_0x71a7('0x19')](_0x71a7('0xd'),auth[_0x71a7('0xa')](),interaction[_0x71a7('0x1a')]('openchannel',_0x71a7('0x1b')),controller[_0x71a7('0x1c')]);router[_0x71a7('0x1d')](_0x71a7('0xd'),auth[_0x71a7('0xa')](),interaction[_0x71a7('0x1a')]('openchannel',_0x71a7('0x1e')),controller[_0x71a7('0x1f')]);router[_0x71a7('0x1d')](_0x71a7('0x20'),auth[_0x71a7('0xa')](),controller['removeTags']);module[_0x71a7('0x21')]=router; \ No newline at end of file +var _0x0977=['delete','openchannelinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','update'];(function(_0x13df0d,_0x1f751d){var _0x225c47=function(_0x591060){while(--_0x591060){_0x13df0d['push'](_0x13df0d['shift']());}};_0x225c47(++_0x1f751d);}(_0x0977,0x1c4));var _0x7097=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x0977[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7097('0x0'));var util=require(_0x7097('0x1'));var path=require(_0x7097('0x2'));var timeout=require(_0x7097('0x3'));var express=require(_0x7097('0x4'));var router=express[_0x7097('0x5')]();var fs_extra=require(_0x7097('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7097('0x7'));var config=require(_0x7097('0x8'));var controller=require(_0x7097('0x9'));router[_0x7097('0xa')]('/',auth[_0x7097('0xb')](),controller[_0x7097('0xc')]);router['get'](_0x7097('0xd'),auth['isAuthenticated'](),controller[_0x7097('0xe')]);router['get'](_0x7097('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x7097('0xa')](_0x7097('0x10'),auth[_0x7097('0xb')](),controller[_0x7097('0x11')]);router[_0x7097('0xa')](_0x7097('0x12'),auth[_0x7097('0xb')](),controller['download']);router[_0x7097('0x13')]('/',auth[_0x7097('0xb')](),controller[_0x7097('0x14')]);router[_0x7097('0x13')](_0x7097('0x10'),auth['isAuthenticated'](),controller[_0x7097('0x15')]);router[_0x7097('0x13')](_0x7097('0x16'),auth[_0x7097('0xb')](),interaction[_0x7097('0x17')](_0x7097('0x18'),_0x7097('0x19')),controller[_0x7097('0x1a')]);router['put'](_0x7097('0xf'),auth[_0x7097('0xb')](),interaction['tracked'](_0x7097('0x18'),'openchannelinteraction:update'),controller[_0x7097('0x1b')]);router[_0x7097('0x1c')](_0x7097('0xf'),auth['isAuthenticated'](),interaction[_0x7097('0x17')]('openchannel',_0x7097('0x1d')),controller[_0x7097('0x1e')]);router[_0x7097('0x1c')](_0x7097('0x16'),auth['isAuthenticated'](),controller[_0x7097('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 418ff60..fa80025 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 _0x8828=['DATE','out','BOOLEAN','sequelize','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8828,0x1d1));var _0x8882=function(_0x1d6c1c,_0x458f42){_0x1d6c1c=_0x1d6c1c-0x0;var _0x24f8e4=_0x8828[_0x1d6c1c];return _0x24f8e4;};'use strict';var Sequelize=require(_0x8882('0x0'));module[_0x8882('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8882('0x2')]},'secondDisposition':{'type':Sequelize[_0x8882('0x2')]},'thirdDisposition':{'type':Sequelize[_0x8882('0x2')]},'note':{'type':Sequelize[_0x8882('0x2')]},'read1stAt':{'type':Sequelize[_0x8882('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x8882('0x2')]},'lastMsgAt':{'type':Sequelize[_0x8882('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x8882('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x8882('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x871e=['sequelize','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x1d5400,_0x567e3c){var _0x21d9fe=function(_0x23fb75){while(--_0x23fb75){_0x1d5400['push'](_0x1d5400['shift']());}};_0x21d9fe(++_0x567e3c);}(_0x871e,0x1b0));var _0xe871=function(_0xbdabf9,_0x25f011){_0xbdabf9=_0xbdabf9-0x0;var _0x257058=_0x871e[_0xbdabf9];return _0x257058;};'use strict';var Sequelize=require(_0xe871('0x0'));module['exports']={'closed':{'type':Sequelize[_0xe871('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe871('0x2')]},'disposition':{'type':Sequelize[_0xe871('0x3')]},'secondDisposition':{'type':Sequelize[_0xe871('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe871('0x3')]},'read1stAt':{'type':Sequelize[_0xe871('0x2')]},'threadId':{'type':Sequelize[_0xe871('0x3')]},'externalUrl':{'type':Sequelize[_0xe871('0x3')]},'lastMsgAt':{'type':Sequelize[_0xe871('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xe871('0x4')]('in',_0xe871('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xe871('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xe871('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index adb700c..16ad02a 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 _0xd532=['SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','Account.key','a.mandatoryDisposition','i.*','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','rows','params','includeAll','include','options','create','describe','addMessage','OpenchannelMessage','ids','nolimit','$gte','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','omit','spread','Tag','findAll','emit','openchannelInteractionTags:save','removeTags','download','unix','server','files','tmp','root','attachments','transcript-%d-%s.zip','join','CmContact','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Owner','get','mkdirSync','Openchannel','Account','closedAt','disposition','threadId','Public','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','firstName','views','transcript-','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','error','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','keys','query','filters','intersection','fields','length','attributes','model','hasOwnProperty','sort','where','pick','select','field','color','from','u.id','u.fullname','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','body','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone'];(function(_0x2812ee,_0x52256a){var _0x1537e7=function(_0x5821bc){while(--_0x5821bc){_0x2812ee['push'](_0x2812ee['shift']());}};_0x1537e7(++_0x52256a);}(_0xd532,0x155));var _0x2d53=function(_0x11902c,_0x150a4e){_0x11902c=_0x11902c-0x0;var _0xab7239=_0xd532[_0x11902c];return _0xab7239;};'use strict';var emlformat=require(_0x2d53('0x0'));var rimraf=require(_0x2d53('0x1'));var zipdir=require(_0x2d53('0x2'));var jsonpatch=require(_0x2d53('0x3'));var rp=require(_0x2d53('0x4'));var moment=require(_0x2d53('0x5'));var BPromise=require(_0x2d53('0x6'));var Mustache=require(_0x2d53('0x7'));var util=require(_0x2d53('0x8'));var path=require(_0x2d53('0x9'));var sox=require(_0x2d53('0xa'));var csv=require(_0x2d53('0xb'));var ejs=require(_0x2d53('0xc'));var fs=require('fs');var fs_extra=require(_0x2d53('0xd'));var _=require('lodash');var squel=require(_0x2d53('0xe'));var crypto=require(_0x2d53('0xf'));var jsforce=require(_0x2d53('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x2d53('0xb'));var querystring=require(_0x2d53('0x11'));var Papa=require(_0x2d53('0x12'));var Redis=require(_0x2d53('0x13'));var authService=require(_0x2d53('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x2d53('0x15'));var pdf=require(_0x2d53('0x16'));var hardwareService=require(_0x2d53('0x17'));var logger=require(_0x2d53('0x18'))('api');var utils=require(_0x2d53('0x19'));var config=require(_0x2d53('0x1a'));var licenseUtil=require(_0x2d53('0x1b'));var db=require(_0x2d53('0x1c'))['db'];config['redis']=_[_0x2d53('0x1d')](config['redis'],{'host':_0x2d53('0x1e'),'port':0x18eb});var socket=require(_0x2d53('0x1f'))(new Redis(config[_0x2d53('0x20')]));require(_0x2d53('0x21'))[_0x2d53('0x22')](socket);function respondWithStatusCode(_0x54ab83,_0x414ef1){_0x414ef1=_0x414ef1||0xcc;return function(_0x301ef6){if(_0x301ef6){return _0x54ab83[_0x2d53('0x23')](_0x414ef1);}return _0x54ab83[_0x2d53('0x24')](_0x414ef1)[_0x2d53('0x25')]();};}function respondWithResult(_0x1909a5,_0x4b3dd4){_0x4b3dd4=_0x4b3dd4||0xc8;return function(_0x458793){if(_0x458793){return _0x1909a5['status'](_0x4b3dd4)[_0x2d53('0x26')](_0x458793);}};}function respondWithFilteredResult(_0x1cef80,_0x14afbd){return function(_0x391b59){if(_0x391b59){var _0x3fcd9c=typeof _0x14afbd[_0x2d53('0x27')]===_0x2d53('0x28')&&typeof _0x14afbd[_0x2d53('0x29')]===_0x2d53('0x28');var _0x5c084b=_0x391b59[_0x2d53('0x2a')];var _0x5c7034=_0x3fcd9c?0x0:_0x14afbd[_0x2d53('0x27')];var _0x296b3e=_0x3fcd9c?_0x391b59['count']:_0x14afbd['offset']+_0x14afbd[_0x2d53('0x29')];var _0x420cfb;if(_0x296b3e>=_0x5c084b){_0x296b3e=_0x5c084b;_0x420cfb=0xc8;}else{_0x420cfb=0xce;}_0x1cef80[_0x2d53('0x24')](_0x420cfb);return _0x1cef80['set'](_0x2d53('0x2b'),_0x5c7034+'-'+_0x296b3e+'/'+_0x5c084b)[_0x2d53('0x26')](_0x391b59);}return null;};}function patchUpdates(_0x29342e){return function(_0x203b4f){try{jsonpatch[_0x2d53('0x2c')](_0x203b4f,_0x29342e,!![]);}catch(_0x40fcfb){return BPromise['reject'](_0x40fcfb);}return _0x203b4f[_0x2d53('0x2d')]();};}function saveUpdates(_0x5be7e6,_0x3b3322){return function(_0x1274f4){if(_0x1274f4){return _0x1274f4[_0x2d53('0x2e')](_0x5be7e6)['then'](function(_0xc2cb45){return _0xc2cb45;});}return null;};}function removeEntity(_0x32ef74,_0x48ae5a){return function(_0x8be1cb){if(_0x8be1cb){return _0x8be1cb[_0x2d53('0x2f')]()[_0x2d53('0x30')](function(){_0x32ef74['status'](0xcc)[_0x2d53('0x25')]();});}};}function handleEntityNotFound(_0x4e89a7,_0x2e179d){return function(_0x348542){if(!_0x348542){_0x4e89a7[_0x2d53('0x23')](0x194);}return _0x348542;};}function handleError(_0x537e6b,_0x577692){_0x577692=_0x577692||0x1f4;return function(_0x3e3652){logger[_0x2d53('0x31')](_0x3e3652[_0x2d53('0x32')]);if(_0x3e3652['name']){delete _0x3e3652[_0x2d53('0x33')];}_0x537e6b[_0x2d53('0x24')](_0x577692)['send'](_0x3e3652);};}function getInteractionUsers(_0x201abc,_0x147577){return new BPromise(function(_0x30dea9,_0x31db22){try{if(_0x147577[_0x201abc['id']]){_0x201abc[_0x2d53('0x34')]=_[_0x2d53('0x35')](_0x147577[_0x201abc['id']],function(_0x15f9be){return{'id':_0x15f9be['id'],'fullname':_0x15f9be[_0x2d53('0x36')]};});}}catch(_0x1bf43f){_0x31db22(_0x1bf43f);}_0x30dea9(_0x201abc);});}function getInteractionTags(_0x5a0ef0,_0x16620b){return new BPromise(function(_0x405cbf,_0x2ea62d){try{if(_0x5a0ef0[_0x2d53('0x37')]){_0x5a0ef0[_0x2d53('0x38')]=[];_0x5a0ef0['TagIds'][_0x2d53('0x39')](',')[_0x2d53('0x3a')](function(_0x140d5b){_0x5a0ef0[_0x2d53('0x38')][_0x2d53('0x3b')](_0x16620b[_0x140d5b]);});}delete _0x5a0ef0[_0x2d53('0x37')];}catch(_0x47ca14){_0x2ea62d(_0x47ca14);}_0x405cbf(_0x5a0ef0);});}function updateOpenchannelInteraction(_0x4f832d,_0x5f25a2,_0x54876c){return new BPromise(function(_0x1544f2,_0x1638f6){return getInteractionUsers(_0x4f832d,_0x54876c)[_0x2d53('0x30')](function(_0x1ead7b){return getInteractionTags(_0x1ead7b,_0x5f25a2);})[_0x2d53('0x30')](function(_0x570322){return getStateInteraction(_0x570322);})[_0x2d53('0x30')](function(_0x275479){_0x1544f2(_0x275479);})[_0x2d53('0x3c')](function(_0x11ca36){_0x1638f6(_0x11ca36);});});}function getStateInteraction(_0x55f6fd){return new BPromise(function(_0x37451d){_0x55f6fd[_0x2d53('0x3d')]=0x0;_0x55f6fd[_0x2d53('0x3e')]=0x0;_0x55f6fd[_0x2d53('0x3f')]=0x0;_0x55f6fd[_0x2d53('0x40')]=0x0;_0x55f6fd[_0x2d53('0x41')]=0x0;if(!_0x55f6fd[_0x2d53('0x42')]&&!_0x55f6fd['UserId']){_0x55f6fd[_0x2d53('0x3d')]+=0x1;}if(!_0x55f6fd['closed']&&_0x55f6fd[_0x2d53('0x43')]){_0x55f6fd[_0x2d53('0x3e')]+=0x1;ids['push'](_0x55f6fd['id']);if(_0x55f6fd[_0x2d53('0x3d')]){_0x55f6fd['waiting']-=0x1;}}if(_0x55f6fd[_0x2d53('0x42')]&&_0x55f6fd[_0x2d53('0x43')]){_0x55f6fd[_0x2d53('0x3f')]+=0x1;if(_0x55f6fd[_0x2d53('0x3e')]){_0x55f6fd[_0x2d53('0x3e')]-=0x1;}}if(_0x55f6fd[_0x2d53('0x42')]&&!_0x55f6fd[_0x2d53('0x43')]){_0x55f6fd[_0x2d53('0x40')]+=0x1;if(_0x55f6fd[_0x2d53('0x3d')]){_0x55f6fd[_0x2d53('0x3d')]-=0x1;}}_0x55f6fd['total']+=0x1;_0x37451d(_0x55f6fd);});}exports[_0x2d53('0x44')]=function(_0x2d4a10,_0x414d76){var _0x5670d3={},_0x5d7e5f={},_0x56f627={'count':0x0,'rows':[]};var _0x5a1e03=_['map'](db[_0x2d53('0x45')][_0x2d53('0x46')],function(_0x1bd00e){return{'name':_0x1bd00e[_0x2d53('0x47')],'type':_0x1bd00e[_0x2d53('0x48')][_0x2d53('0x49')]};});_0x5d7e5f['model']=_[_0x2d53('0x35')](_0x5a1e03,'name');_0x5d7e5f['query']=_[_0x2d53('0x4a')](_0x2d4a10[_0x2d53('0x4b')]);_0x5d7e5f[_0x2d53('0x4c')]=_[_0x2d53('0x4d')](_0x5d7e5f['model'],_0x5d7e5f[_0x2d53('0x4b')]);_0x5670d3['attributes']=_[_0x2d53('0x4d')](_0x5d7e5f['model'],qs[_0x2d53('0x4e')](_0x2d4a10[_0x2d53('0x4b')]['fields']));_0x5670d3['attributes']=_0x5670d3['attributes'][_0x2d53('0x4f')]?_0x5670d3[_0x2d53('0x50')]:_0x5d7e5f[_0x2d53('0x51')];if(!_0x2d4a10[_0x2d53('0x4b')][_0x2d53('0x52')]('nolimit')){_0x5670d3['limit']=qs[_0x2d53('0x29')](_0x2d4a10['query'][_0x2d53('0x29')]);_0x5670d3[_0x2d53('0x27')]=qs[_0x2d53('0x27')](_0x2d4a10[_0x2d53('0x4b')]['offset']);}_0x5670d3['order']=qs[_0x2d53('0x53')](_0x2d4a10[_0x2d53('0x4b')][_0x2d53('0x53')]);_0x5670d3[_0x2d53('0x54')]=qs[_0x2d53('0x4c')](_[_0x2d53('0x55')](_0x2d4a10[_0x2d53('0x4b')],_0x5d7e5f['filters']),_0x5a1e03);var _0x1f5433=[];var _0x1319aa=squel[_0x2d53('0x56')]()[_0x2d53('0x57')]('id')[_0x2d53('0x57')](_0x2d53('0x33'))['field'](_0x2d53('0x58'))[_0x2d53('0x59')]('tools_tags');var _0x231bb0=squel[_0x2d53('0x56')]()[_0x2d53('0x57')](_0x2d53('0x5a'))[_0x2d53('0x57')](_0x2d53('0x5b'))[_0x2d53('0x57')]('ui.OpenchannelInteractionId')[_0x2d53('0x59')](_0x2d53('0x5c'),'ui')['left_join'](_0x2d53('0x5d'),'u',_0x2d53('0x5e'));var _0x2fc217=squel[_0x2d53('0x56')]()[_0x2d53('0x59')](_0x2d53('0x5f'),'i')[_0x2d53('0x60')]('cm_contacts','c',_0x2d53('0x61'))['left_join']('users','o',_0x2d53('0x62'))['left_join']('openchannel_accounts','a',_0x2d53('0x63'))[_0x2d53('0x60')](_0x2d53('0x64'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x2d53('0x60')](_0x2d53('0x65'),'it',_0x2d53('0x66'))[_0x2d53('0x60')](_0x2d53('0x67'),'t',_0x2d53('0x68'));var _0x44b7c8=squel['expr']();var _0x443c35=[];var _0x38c51a=squel[_0x2d53('0x69')]();var _0x415763;if(_0x2d4a10[_0x2d53('0x4b')][_0x2d53('0x6a')]){_0x415763=as[_0x2d53('0x6b')](_0x2d4a10[_0x2d53('0x4b')][_0x2d53('0x6a')]);var _0x317ecb=_0x415763[_0x2d53('0x6c')];for(var _0x12a858=0x0;_0x12a858<_0x415763[_0x2d53('0x6d')]['length'];_0x12a858++){var _0x3a4ef6=_0x415763[_0x2d53('0x6d')][_0x12a858];var _0x264860='i';var _0x490d3e=_[_0x2d53('0x6e')](_0x5a1e03,['name',_0x3a4ef6[_0x2d53('0x57')]]);if(!_0x490d3e){switch(_0x3a4ef6[_0x2d53('0x57')]){case _0x2d53('0x6f'):if(_0x3a4ef6[_0x2d53('0x70')]==0x1){_0x2fc217[_0x2d53('0x71')]('`'+_0x3a4ef6['field']+'`\x20=\x200');}else{_0x2fc217[_0x2d53('0x71')]('`'+_0x3a4ef6['field']+_0x2d53('0x72'));}break;case _0x2d53('0x73'):if(_0x3a4ef6[_0x2d53('0x74')]==='$substring'){if(_0x3a4ef6['value']['split']('\x20')[_0x2d53('0x4f')]>0x1){_0x44b7c8[_0x317ecb](_0x2d53('0x75'),qs[_0x2d53('0x76')](_0x3a4ef6[_0x2d53('0x70')]),null);}else{var _0x3b35cb='%'+_0x3a4ef6[_0x2d53('0x70')]+'%';_0x44b7c8[_0x317ecb](_0x2d53('0x77'),_0x3b35cb,_0x3b35cb,_0x3b35cb);}}else{_0x490d3e=_[_0x2d53('0x6e')](_0x5a1e03,[_0x2d53('0x33'),_0x2d53('0x78')]);_0x3a4ef6[_0x2d53('0x57')]=_0x2d53('0x78');_0x5ef312=as[_0x2d53('0x79')](_0x264860,_0x490d3e[_0x2d53('0x48')],_0x3a4ef6);_0x44b7c8[_0x317ecb](_0x5ef312[_0x2d53('0x7a')],_0x5ef312[_0x2d53('0x70')]['start'],_0x5ef312[_0x2d53('0x70')][_0x2d53('0x25')]);}break;case'Tag':var _0x2d744b=_0x3a4ef6['value'][_0x2d53('0x39')](',')[_0x2d53('0x35')](function(_0x29723d){return Number(_0x29723d);});_0x2d744b['forEach'](function(_0x1ca6f3){_0x38c51a['or'](_0x2d53('0x7b'),'%,'+_0x1ca6f3+',%');});_0x443c35=_['union'](_0x443c35,_0x2d744b);break;case _0x2d53('0x7c'):if(_0x3a4ef6['operator']==='$substring'){_0x44b7c8[_0x317ecb](_0x2d53('0x7d'),'%'+_0x3a4ef6[_0x2d53('0x70')]+'%',null);}else{_0x490d3e=_[_0x2d53('0x6e')](_0x5a1e03,[_0x2d53('0x33'),_0x2d53('0x43')]);_0x3a4ef6[_0x2d53('0x57')]=_0x2d53('0x43');_0x5ef312=as[_0x2d53('0x79')](_0x264860,_0x490d3e[_0x2d53('0x48')],_0x3a4ef6);_0x44b7c8[_0x317ecb](_0x5ef312[_0x2d53('0x7a')],_0x5ef312[_0x2d53('0x70')][_0x2d53('0x7e')],_0x5ef312[_0x2d53('0x70')]['end']);}break;case _0x2d53('0x7f'):_0x5ef312=as[_0x2d53('0x79')]('me',null,_0x3a4ef6);_0x44b7c8[_0x317ecb](_0x5ef312['text'],_0x5ef312[_0x2d53('0x70')][_0x2d53('0x7e')],_0x5ef312[_0x2d53('0x70')][_0x2d53('0x25')]);break;}}else{var _0x5ef312=as[_0x2d53('0x79')](_0x264860,_0x490d3e[_0x2d53('0x48')],_0x3a4ef6);_0x44b7c8[_0x317ecb](_0x5ef312[_0x2d53('0x7a')],_0x5ef312['value'][_0x2d53('0x7e')],_0x5ef312[_0x2d53('0x70')][_0x2d53('0x25')]);}}}else{var _0x4831ef=_(_0x2d4a10[_0x2d53('0x4b')])[_0x2d53('0x4a')]()[_0x2d53('0x35')](function(_0x3316fc){return _['some'](_0x5a1e03,['name',_0x3316fc])?_0x3316fc:undefined;})['compact']()[_0x2d53('0x70')]();if(!_[_0x2d53('0x80')](_0x4831ef)){_0x4831ef['forEach'](function(_0x23bcae){if(_0x23bcae===_0x2d53('0x81')){_0x2fc217['where'](_0x2d53('0x82'),[][_0x2d53('0x83')](_0x2d4a10['query'][_0x23bcae]));}else if(_0x23bcae===_0x2d53('0x84')){var _0x4c095b=JSON['parse'](_0x2d4a10[_0x2d53('0x4b')][_0x23bcae])['$gte'];var _0x42ab12=JSON[_0x2d53('0x85')](_0x2d4a10['query'][_0x23bcae])[_0x2d53('0x86')];_0x2fc217[_0x2d53('0x54')](_0x2d53('0x87'),_0x4c095b,_0x42ab12);}else{if(_0x2d4a10[_0x2d53('0x4b')][_0x23bcae]===_0x2d53('0x88')){_0x2fc217[_0x2d53('0x54')]('i.'+_0x23bcae+_0x2d53('0x89'));}else{_0x2fc217[_0x2d53('0x54')]('i.'+_0x23bcae+_0x2d53('0x8a'),_0x2d4a10[_0x2d53('0x4b')][_0x23bcae]);}}});}if(_0x2d4a10[_0x2d53('0x4b')]['read']){if(_0x2d4a10['query']['read']==0x1){_0x2fc217[_0x2d53('0x71')](_0x2d53('0x8b'));}else{_0x2fc217[_0x2d53('0x71')]('`unreadMessages`\x20>\x200');}}if(_0x2d4a10[_0x2d53('0x4b')][_0x2d53('0x8c')]){_0x443c35=_[_0x2d53('0x8d')](_0x2d4a10[_0x2d53('0x4b')][_0x2d53('0x8c')])?_0x2d4a10['query'][_0x2d53('0x8c')]:new Array(_0x2d4a10[_0x2d53('0x4b')][_0x2d53('0x8c')]);_0x443c35[_0x2d53('0x3a')](function(_0x32a674){_0x38c51a['or'](_0x2d53('0x7b'),'%,'+_0x32a674+',%');});}if(_0x2d4a10[_0x2d53('0x4b')][_0x2d53('0x8e')]){var _0x26b644=_0x2d4a10['query'][_0x2d53('0x8e')][_0x2d53('0x8f')]('\x5c','\x5c\x5c')[_0x2d53('0x8f')](/'/g,'\x27\x27');if(qs[_0x2d53('0x90')](_0x26b644)){_0x44b7c8['or'](_0x2d53('0x91'),_0x26b644+'%');}else{_0x44b7c8['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2d53('0x76')](_0x26b644))['or'](_0x2d53('0x92'),_0x26b644+'%')['or'](_0x2d53('0x93'),_0x26b644+'%');}}}_0x2fc217[_0x2d53('0x54')](_0x44b7c8);_0x2fc217[_0x2d53('0x94')](_0x2d53('0x95'));var _0x145e12={'type':db['Sequelize'][_0x2d53('0x96')][_0x2d53('0x97')],'raw':!![]};var _0xe0df59=_0x2fc217[_0x2d53('0x98')]();_0xe0df59[_0x2d53('0x57')]('i.id');_0xe0df59[_0x2d53('0x57')](_0x2d53('0x99'),_0x2d53('0x6f'));if(_0x5670d3['order']){_0x5670d3[_0x2d53('0x9a')]['forEach'](function(_0x2da7f4){var _0x5ad4a3=_0x2da7f4[0x0]===_0x2d53('0x9b')?_0x2da7f4[0x0]:'i.'+_0x2da7f4[0x0];_0x2fc217[_0x2d53('0x9a')](_0x5ad4a3,_0x2da7f4[0x1]===_0x2d53('0x9c')?![]:!![]);});}if(!_[_0x2d53('0x80')](_0x443c35)){_0x2fc217[_0x2d53('0x71')](_0x38c51a);_0xe0df59[_0x2d53('0x54')](_0x2d53('0x9d'),_0x443c35);}BPromise[_0x2d53('0x9e')]()[_0x2d53('0x30')](function(){if(!_0x415763){if(_0x2d4a10[_0x2d53('0x4b')][_0x2d53('0x81')])return;_0xe0df59['where'](_0x2d53('0x9f'));_0x2fc217[_0x2d53('0x54')](_0x2d53('0x9f'));return;}if(_0x2d4a10[_0x2d53('0xa0')][_0x2d53('0xa1')]!==_0x2d53('0xa2'))return;return _0x2d4a10['user'][_0x2d53('0xa3')]({'attributes':['id'],'raw':!![]})[_0x2d53('0x30')](function(_0x5346d5){if(_[_0x2d53('0x80')](_0x5346d5)){_0xe0df59[_0x2d53('0x54')](_0x2d53('0xa4'));_0x2fc217[_0x2d53('0x54')](_0x2d53('0xa4'));}else{_0xe0df59[_0x2d53('0x54')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x5346d5,'id'));_0x2fc217['where'](_0x2d53('0x82'),_[_0x2d53('0x35')](_0x5346d5,'id'));}});})[_0x2d53('0x30')](function(){if(_0x2d4a10[_0x2d53('0xa0')][_0x2d53('0xa1')]==='agent'&&!_0x415763&&!_0x2d4a10[_0x2d53('0x4b')][_0x2d53('0x81')])return[];return db['sequelize'][_0x2d53('0x4b')](_0xe0df59[_0x2d53('0xa5')](),_0x145e12);})[_0x2d53('0x30')](function(_0x1f012a){_0x56f627[_0x2d53('0x2a')]=_0x1f012a[_0x2d53('0x4f')];if(_0x56f627['count']===0x0)return[];return db[_0x2d53('0xa6')][_0x2d53('0x4b')](_0x1319aa[_0x2d53('0xa5')](),_0x145e12)[_0x2d53('0x30')](function(_0x4c1f95){_0x1f5433=_[_0x2d53('0xa7')](_0x4c1f95,'id');_0x145e12=_[_0x2d53('0xa8')](_0x145e12,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2d4a10['query']['fields']){_0x5670d3[_0x2d53('0x50')]['forEach'](function(_0x4627ed){_0x2fc217[_0x2d53('0x57')]('i.'+_0x4627ed);});}else{_0x2fc217[_0x2d53('0x57')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x2d53('0x6f'));_0x2fc217[_0x2d53('0x57')]('a.key',_0x2d53('0xa9'));_0x2fc217[_0x2d53('0x57')](_0x2d53('0xaa'),'Account.mandatoryDisposition');_0x2fc217[_0x2d53('0x57')]('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',_0x2d53('0x9b'));_0x2fc217['field'](_0x2d53('0xab'));_0x2fc217[_0x2d53('0x57')]('c.firstName',_0x2d53('0xac'));_0x2fc217[_0x2d53('0x57')](_0x2d53('0xad'),'Contact.lastName');_0x2fc217[_0x2d53('0x57')](_0x2d53('0xae'),_0x2d53('0xaf'));_0x2fc217[_0x2d53('0x57')](_0x2d53('0xb0'),_0x2d53('0xb1'));_0x2fc217[_0x2d53('0x57')]('c.mobile',_0x2d53('0xb2'));_0x2fc217[_0x2d53('0x57')](_0x2d53('0xb3'),_0x2d53('0xb4'));_0x2fc217['field'](_0x2d53('0xb5'),_0x2d53('0xb6'));_0x2fc217[_0x2d53('0x57')]('o.internal',_0x2d53('0xb7'));_0x2fc217[_0x2d53('0x57')](_0x2d53('0xb8'),'TagIds');}if(_0x5670d3['limit'])_0x2fc217['limit'](_0x5670d3[_0x2d53('0x29')]);if(_0x5670d3[_0x2d53('0x27')])_0x2fc217[_0x2d53('0x27')](_0x5670d3['offset']);return db[_0x2d53('0xa6')][_0x2d53('0x4b')](_0x2fc217['toString'](),_0x145e12);})[_0x2d53('0x30')](function(_0x32ebd2){if(_0x32ebd2[_0x2d53('0x4f')]>0x0)_0x231bb0[_0x2d53('0x54')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0x2d53('0x35')](_0x32ebd2,'id'));return db[_0x2d53('0xa6')][_0x2d53('0x4b')](_0x231bb0['toString'](),_0x145e12)[_0x2d53('0x30')](function(_0x45ce8c){var _0x152ff6=_[_0x2d53('0xb9')](_0x45ce8c,'OpenchannelInteractionId');var _0x5a6720=[];_0x32ebd2[_0x2d53('0x3a')](function(_0x28ab41){_0x5a6720[_0x2d53('0x3b')](updateOpenchannelInteraction(_0x28ab41,_0x1f5433,_0x152ff6));});return BPromise[_0x2d53('0xba')](_0x5a6720);});});})[_0x2d53('0x30')](function(_0x43551a){_0x56f627[_0x2d53('0xbb')]=_0x43551a;return _0x56f627;})[_0x2d53('0x30')](respondWithFilteredResult(_0x414d76,_0x5670d3))[_0x2d53('0x3c')](handleError(_0x414d76,null));};exports['show']=function(_0x19d1c9,_0x1d5adc){var _0x3a0b3c={};if(_0x19d1c9[_0x2d53('0x4b')][_0x2d53('0x48')]&&_0x19d1c9[_0x2d53('0x4b')][_0x2d53('0x48')]===_0x2d53('0x59')){_0x3a0b3c[_0x2d53('0x59')]=_0x19d1c9[_0x2d53('0xbc')]['id'];}else{_0x3a0b3c['id']=_0x19d1c9[_0x2d53('0xbc')]['id'];}var _0x21d9eb={'raw':![],'where':_0x3a0b3c},_0x45379d={};_0x45379d[_0x2d53('0x51')]=_[_0x2d53('0x4a')](db['OpenchannelInteraction'][_0x2d53('0x46')]);_0x45379d['query']=_['keys'](_0x19d1c9[_0x2d53('0x4b')]);_0x45379d[_0x2d53('0x4c')]=_[_0x2d53('0x4d')](_0x45379d[_0x2d53('0x51')],_0x45379d[_0x2d53('0x4b')]);_0x21d9eb[_0x2d53('0x50')]=_[_0x2d53('0x4d')](_0x45379d[_0x2d53('0x51')],qs[_0x2d53('0x4e')](_0x19d1c9[_0x2d53('0x4b')][_0x2d53('0x4e')]));_0x21d9eb[_0x2d53('0x50')]=_0x21d9eb[_0x2d53('0x50')][_0x2d53('0x4f')]?_0x21d9eb[_0x2d53('0x50')]:_0x45379d['model'];if(_0x19d1c9[_0x2d53('0x4b')][_0x2d53('0xbd')]){_0x21d9eb[_0x2d53('0xbe')]=[{'all':!![]}];}_0x21d9eb=_[_0x2d53('0xa8')]({},_0x21d9eb,_0x19d1c9[_0x2d53('0xbf')]);return db[_0x2d53('0x45')][_0x2d53('0x6e')](_0x21d9eb)[_0x2d53('0x30')](handleEntityNotFound(_0x1d5adc,null))[_0x2d53('0x30')](respondWithResult(_0x1d5adc,null))[_0x2d53('0x3c')](handleError(_0x1d5adc,null));};exports[_0x2d53('0xc0')]=function(_0x38701f,_0x287c41){return db[_0x2d53('0x45')][_0x2d53('0xc0')](_0x38701f[_0x2d53('0x7f')],{})['then'](respondWithResult(_0x287c41,0xc9))['catch'](handleError(_0x287c41,null));};exports[_0x2d53('0x2e')]=function(_0x5b96d1,_0x1f416f){if(_0x5b96d1['body']['id']){delete _0x5b96d1[_0x2d53('0x7f')]['id'];}return db[_0x2d53('0x45')][_0x2d53('0x6e')]({'where':{'id':_0x5b96d1[_0x2d53('0xbc')]['id']}})[_0x2d53('0x30')](handleEntityNotFound(_0x1f416f,null))[_0x2d53('0x30')](saveUpdates(_0x5b96d1[_0x2d53('0x7f')],null))[_0x2d53('0x30')](respondWithResult(_0x1f416f,null))[_0x2d53('0x3c')](handleError(_0x1f416f,null));};exports[_0x2d53('0x2f')]=function(_0x51ee78,_0x4ffe29){return db[_0x2d53('0x45')][_0x2d53('0x6e')]({'where':{'id':_0x51ee78[_0x2d53('0xbc')]['id']}})[_0x2d53('0x30')](handleEntityNotFound(_0x4ffe29,null))[_0x2d53('0x30')](removeEntity(_0x4ffe29,null))['catch'](handleError(_0x4ffe29,null));};exports[_0x2d53('0xc1')]=function(_0x5e9aca,_0x2e883f){return db['OpenchannelInteraction'][_0x2d53('0xc1')]()['then'](respondWithResult(_0x2e883f,null))[_0x2d53('0x3c')](handleError(_0x2e883f,null));};exports[_0x2d53('0xc2')]=function(_0x57bd20,_0x463023,_0x3f9356){return db[_0x2d53('0xc3')]['find']({'where':{'id':_0x57bd20[_0x2d53('0xbc')]['id']}})[_0x2d53('0x30')](handleEntityNotFound(_0x463023,null))[_0x2d53('0x30')](function(_0x39b8b8){if(_0x39b8b8){return _0x39b8b8['addMessage'](_0x57bd20[_0x2d53('0x7f')][_0x2d53('0xc4')],_['omit'](_0x57bd20['body'],[_0x2d53('0xc4'),'id'])||{});}})[_0x2d53('0x30')](respondWithResult(_0x463023,null))['catch'](handleError(_0x463023,null));};exports['getMessages']=function(_0x3dd186,_0x3c410a,_0x373cc8){var _0x1010d8={'raw':![],'where':{}};var _0x458bfa={};var _0x4b51f2={'count':0x0,'rows':[]};return db['OpenchannelInteraction']['findOne']({'where':{'id':_0x3dd186[_0x2d53('0xbc')]['id']}})[_0x2d53('0x30')](handleEntityNotFound(_0x3c410a,null))['then'](function(_0x205362){if(_0x205362){_0x458bfa[_0x2d53('0x51')]=_[_0x2d53('0x4a')](db[_0x2d53('0xc3')][_0x2d53('0x46')]);_0x458bfa[_0x2d53('0x4b')]=_[_0x2d53('0x4a')](_0x3dd186[_0x2d53('0x4b')]);_0x458bfa[_0x2d53('0x4c')]=_['intersection'](_0x458bfa[_0x2d53('0x51')],_0x458bfa[_0x2d53('0x4b')]);_0x1010d8[_0x2d53('0x50')]=_['intersection'](_0x458bfa[_0x2d53('0x51')],qs[_0x2d53('0x4e')](_0x3dd186[_0x2d53('0x4b')]['fields']));_0x1010d8[_0x2d53('0x50')]=_0x1010d8[_0x2d53('0x50')]['length']?_0x1010d8[_0x2d53('0x50')]:_0x458bfa['model'];if(!_0x3dd186['query']['hasOwnProperty'](_0x2d53('0xc5'))){_0x1010d8[_0x2d53('0x29')]=qs[_0x2d53('0x29')](_0x3dd186[_0x2d53('0x4b')][_0x2d53('0x29')]);_0x1010d8['offset']=qs[_0x2d53('0x27')](_0x3dd186[_0x2d53('0x4b')][_0x2d53('0x27')]);}_0x1010d8['order']=qs['sort'](_0x3dd186[_0x2d53('0x4b')]['sort']);_0x1010d8[_0x2d53('0x54')]=qs[_0x2d53('0x4c')](_[_0x2d53('0x55')](_0x3dd186['query'],_0x458bfa['filters']));_0x1010d8[_0x2d53('0x54')]['OpenchannelInteractionId']=_0x205362['id'];if(_0x3dd186[_0x2d53('0x4b')][_0x2d53('0x8e')]){_0x1010d8[_0x2d53('0x54')]=_[_0x2d53('0xa8')](_0x1010d8[_0x2d53('0x54')],{'$or':_['map'](_0x1010d8[_0x2d53('0x50')],function(_0x58721e){var _0x4189ac={};_0x4189ac[_0x58721e]={'$like':'%'+_0x3dd186[_0x2d53('0x4b')][_0x2d53('0x8e')]+'%'};return _0x4189ac;})});}if(_0x3dd186['query'][_0x2d53('0xc6')]){var _0x5c28bc=_0x3dd186['query'][_0x2d53('0xc6')][_0x2d53('0x39')](',');var _0x8b27ab={};_0x8b27ab[_0x5c28bc[0x0]]={'$gte':moment(_0x5c28bc[0x1])[_0x2d53('0xc7')](_0x2d53('0xc8'))};_0x1010d8['where']=_[_0x2d53('0xa8')](_0x1010d8[_0x2d53('0x54')],_0x8b27ab);}_0x1010d8=_[_0x2d53('0xa8')]({},_0x1010d8,_0x3dd186['options']);return db['OpenchannelMessage'][_0x2d53('0x2a')]({'where':_0x1010d8[_0x2d53('0x54')]})[_0x2d53('0x30')](function(_0x53974c){_0x4b51f2['count']=_0x53974c;if(_0x3dd186[_0x2d53('0x4b')][_0x2d53('0xbd')]){_0x1010d8['include']=[{'all':!![]}];}return db[_0x2d53('0xc3')]['findAll'](_0x1010d8);})[_0x2d53('0x30')](function(_0x41e790){_0x4b51f2[_0x2d53('0xbb')]=_0x41e790;return _0x4b51f2;});}})[_0x2d53('0x30')](respondWithFilteredResult(_0x3c410a,_0x1010d8))[_0x2d53('0x3c')](handleError(_0x3c410a,null));};exports[_0x2d53('0xc9')]=function(_0x30515f,_0x92d03a,_0x45be8d){return db[_0x2d53('0x45')][_0x2d53('0x6e')]({'where':{'id':_0x30515f[_0x2d53('0xbc')]['id']}})[_0x2d53('0x30')](handleEntityNotFound(_0x92d03a,null))[_0x2d53('0x30')](function(_0x3bd48d){if(_0x3bd48d){return _0x3bd48d[_0x2d53('0xca')](_0x30515f[_0x2d53('0x7f')][_0x2d53('0xc4')],_[_0x2d53('0xcb')](_0x30515f[_0x2d53('0x7f')],[_0x2d53('0xc4'),'id'])||{})[_0x2d53('0xcc')](function(){return db[_0x2d53('0xcd')][_0x2d53('0xce')]({'attributes':['id',_0x2d53('0x33'),_0x2d53('0x58')],'where':{'id':_0x30515f['body'][_0x2d53('0xc4')]}});})[_0x2d53('0x30')](function(_0x470307){socket[_0x2d53('0xcf')](_0x2d53('0xd0'),{'id':Number(_0x30515f[_0x2d53('0xbc')]['id']),'tags':_0x470307||[]});return{'id':Number(_0x30515f[_0x2d53('0xbc')]['id']),'tags':_0x470307||[]};});}})[_0x2d53('0x30')](respondWithResult(_0x92d03a,null))['catch'](handleError(_0x92d03a,null));};exports[_0x2d53('0xd1')]=function(_0x3e0d31,_0x43f192,_0x6fb0c8){return db['OpenchannelInteraction'][_0x2d53('0x6e')]({'where':{'id':_0x3e0d31[_0x2d53('0xbc')]['id']}})['then'](handleEntityNotFound(_0x43f192,null))[_0x2d53('0x30')](function(_0x4f75a2){if(_0x4f75a2){return _0x4f75a2[_0x2d53('0xd1')](_0x3e0d31[_0x2d53('0x4b')][_0x2d53('0xc4')]);}})['then'](respondWithStatusCode(_0x43f192,null))['catch'](handleError(_0x43f192,null));};exports[_0x2d53('0xd2')]=function(_0x35d500,_0x400929){var _0x2bcf86=moment()[_0x2d53('0xd3')]()[_0x2d53('0xa5')]();var _0x49416b=path['join'](config['root'],_0x2d53('0xd4'),_0x2d53('0xd5'),_0x2d53('0xd6'));var _0x58f8c2=path['join'](config[_0x2d53('0xd7')],_0x2d53('0xd4'),_0x2d53('0xd5'),_0x2d53('0xd8'));var _0x313e69=path['join'](_0x49416b,_0x2bcf86);var _0x54a7f2=util[_0x2d53('0xc7')](_0x2d53('0xd9'),_0x35d500[_0x2d53('0xbc')]['id'],_0x2bcf86);var _0x1853f1=path[_0x2d53('0xda')](_0x49416b,_0x54a7f2);var _0x4d6394=[];_0x4d6394[_0x2d53('0x3b')]({'model':db[_0x2d53('0x7c')],'as':_0x2d53('0x7c'),'attributes':['id',_0x2d53('0x36')],'raw':!![]});_0x4d6394[_0x2d53('0x3b')]({'model':db[_0x2d53('0xdb')],'as':_0x2d53('0x73'),'attributes':['id','firstName',_0x2d53('0xdc')],'raw':!![]});if(_0x35d500['query']['attachments']){_0x4d6394[_0x2d53('0x3b')]({'model':db[_0x2d53('0xdd')],'as':_0x2d53('0xdd'),'raw':!![]});}var _0x47ec3b=[{'model':db[_0x2d53('0xc3')],'as':_0x2d53('0xde'),'attributes':['id',_0x2d53('0x7f'),_0x2d53('0x84'),_0x2d53('0xdf'),_0x2d53('0xe0'),'read'],'include':_0x4d6394}];_0x47ec3b[_0x2d53('0x3b')]({'model':db[_0x2d53('0xe1')],'as':'Account','attributes':['id',_0x2d53('0x33')]});_0x47ec3b[_0x2d53('0x3b')]({'model':db[_0x2d53('0x7c')],'as':_0x2d53('0xe2'),'attributes':['id',_0x2d53('0x36')]});return db['OpenchannelInteraction'][_0x2d53('0x6e')]({'where':{'id':_0x35d500[_0x2d53('0xbc')]['id']},'include':_0x47ec3b})[_0x2d53('0x30')](handleEntityNotFound(_0x400929,null))['then'](function(_0x463a44){if(_0x463a44){var _0x5d3630=_0x463a44[_0x2d53('0xe3')]({'plain':!![]});fs[_0x2d53('0xe4')](_0x313e69);var _0x4dfbaf={'channel':_0x2d53('0xe5'),'account':_0x5d3630[_0x2d53('0xe6')][_0x2d53('0x33')],'agent':_0x5d3630[_0x2d53('0xe2')]?_0x5d3630[_0x2d53('0xe2')][_0x2d53('0x36')]:'N.A.','createdAt':moment(_0x5d3630['createdAt'])[_0x2d53('0xc7')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2d53('0xa5')](),'closedAt':_0x5d3630['closed']?moment(_0x5d3630[_0x2d53('0xe7')])[_0x2d53('0xc7')](_0x2d53('0xc8'))[_0x2d53('0xa5')]():'','disposition':_0x5d3630[_0x2d53('0xe8')],'visibility':_0x5d3630[_0x2d53('0xe9')]?_0x2d53('0xea'):'Private','messages':_(_0x5d3630[_0x2d53('0xde')])[_0x2d53('0x8e')]({'secret':![]})[_0x2d53('0x35')](function(_0x31a36a){if(_0x31a36a[_0x2d53('0xdd')]){var _0x1317ef=path[_0x2d53('0xda')](_0x58f8c2,_0x31a36a[_0x2d53('0xdd')][_0x2d53('0xeb')]);if(fs[_0x2d53('0xec')](_0x1317ef)){fs[_0x2d53('0xed')](_0x1317ef)[_0x2d53('0xee')](fs[_0x2d53('0xef')](path[_0x2d53('0xda')](_0x313e69,_0x31a36a['Attachment'][_0x2d53('0xeb')])));}}return{'date':moment(_0x31a36a[_0x2d53('0x84')])[_0x2d53('0xc7')](_0x2d53('0xc8'))[_0x2d53('0xa5')](),'sender':_0x31a36a['direction']===_0x2d53('0xf0')?_0x31a36a[_0x2d53('0x7c')]?_0x31a36a['User'][_0x2d53('0x36')]:_0x2d53('0xf1'):_0x31a36a[_0x2d53('0x73')][_0x2d53('0xf2')]+(_0x31a36a[_0x2d53('0x73')][_0x2d53('0xdc')]?'\x20'+_0x31a36a[_0x2d53('0x73')][_0x2d53('0xdc')]:''),'body':_0x31a36a[_0x2d53('0xdd')]?_0x31a36a[_0x2d53('0xdd')][_0x2d53('0xeb')]:_0x31a36a[_0x2d53('0x7f')],'direction':_0x31a36a['direction']===_0x2d53('0xf0')?'A':'C','secret':_0x31a36a[_0x2d53('0xe0')],'read':_0x31a36a['read'],'attachment':_0x31a36a['Attachment']};})['value']()};return ejs['renderFile'](path['join'](config[_0x2d53('0xd7')],_0x2d53('0xd4'),_0x2d53('0xf3'),'downloadInteraction.ejs'),{'interaction':_0x4dfbaf})['then'](function(_0x52d8fc){var _0x12d59d=path['join'](_0x313e69,_0x2d53('0xf4')+_0x5d3630['id']+'-'+_0x2bcf86+'.pdf');var _0x167dc2={'path':_0x12d59d,'channel':_0x2d53('0xe5'),'interactionId':_0x5d3630['id']};return pdf['createPdfFromHTML'](_0x52d8fc,_0x167dc2);})['then'](function(){return new BPromise(function(_0x1916cb,_0x47f80f){zipdir(_0x313e69,{'saveTo':_0x1853f1},function(_0x553438,_0x1f07e6){if(_0x553438)return _0x47f80f(_0x553438);return _0x1916cb(_0x1f07e6);});})[_0x2d53('0x30')](function(){return new BPromise(function(_0x2a1f6f,_0x4a01ff){rimraf(_0x313e69,function(_0x521c54){if(_0x521c54)_0x4a01ff(_0x521c54);return _0x2a1f6f();});});})[_0x2d53('0x30')](function(){return _0x400929[_0x2d53('0xd2')](_0x1853f1,_0x54a7f2,function(_0x678ea9){if(_0x678ea9){console['log'](_0x2d53('0xf5'),_0x678ea9);}else{fs[_0x2d53('0xf6')](_0x1853f1);}});});});}else{return _0x400929[_0x2d53('0x23')](0xc8);}})['catch'](handleError(_0x400929,null));}; \ No newline at end of file +var _0xdd0f=['u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','openchannel_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','createdAt','$gte','$lte','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','agent','getOpenchannelAccounts','isEmpty','i.OpenchannelAccountId\x20IS\x20NULL','toString','count','sequelize','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','catch','show','params','includeAll','include','options','create','update','describe','OpenchannelMessage','addMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','removeTags','download','unix','join','tmp','root','server','files','attachments','transcript-%d-%s.zip','CmContact','firstName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','mkdirSync','Owner','N.A.','closedAt','threadId','Public','basename','existsSync','pipe','createWriteStream','out','System','lastName','downloadInteraction.ejs','transcript-','.pdf','Openchannel','createPdfFromHTML','log','unlinkSync','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','querystring','ioredis','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','status','json','offset','limit','undefined','set','Content-Range','apply','reject','then','destroy','error','name','send','Users','fullname','Tags','TagIds','split','forEach','push','waiting','unmanaged','total','closed','UserId','talking','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','select','field','color','from'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0xdd0f,0x9e));var _0xfdd0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdd0f[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xfdd0('0x0'));var rimraf=require(_0xfdd0('0x1'));var zipdir=require(_0xfdd0('0x2'));var jsonpatch=require(_0xfdd0('0x3'));var rp=require(_0xfdd0('0x4'));var moment=require(_0xfdd0('0x5'));var BPromise=require(_0xfdd0('0x6'));var Mustache=require(_0xfdd0('0x7'));var util=require(_0xfdd0('0x8'));var path=require(_0xfdd0('0x9'));var sox=require(_0xfdd0('0xa'));var csv=require('to-csv');var ejs=require(_0xfdd0('0xb'));var fs=require('fs');var fs_extra=require(_0xfdd0('0xc'));var _=require(_0xfdd0('0xd'));var squel=require(_0xfdd0('0xe'));var crypto=require(_0xfdd0('0xf'));var jsforce=require(_0xfdd0('0x10'));var deskjs=require(_0xfdd0('0x11'));var toCsv=require('to-csv');var querystring=require(_0xfdd0('0x12'));var Papa=require('papaparse');var Redis=require(_0xfdd0('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xfdd0('0x14'));var hardwareService=require(_0xfdd0('0x15'));var logger=require(_0xfdd0('0x16'))('api');var utils=require(_0xfdd0('0x17'));var config=require(_0xfdd0('0x18'));var licenseUtil=require(_0xfdd0('0x19'));var db=require(_0xfdd0('0x1a'))['db'];config[_0xfdd0('0x1b')]=_[_0xfdd0('0x1c')](config['redis'],{'host':_0xfdd0('0x1d'),'port':0x18eb});var socket=require(_0xfdd0('0x1e'))(new Redis(config['redis']));require(_0xfdd0('0x1f'))[_0xfdd0('0x20')](socket);function respondWithStatusCode(_0xc7dad2,_0x22fce6){_0x22fce6=_0x22fce6||0xcc;return function(_0x183ada){if(_0x183ada){return _0xc7dad2[_0xfdd0('0x21')](_0x22fce6);}return _0xc7dad2['status'](_0x22fce6)[_0xfdd0('0x22')]();};}function respondWithResult(_0x294924,_0x267cf2){_0x267cf2=_0x267cf2||0xc8;return function(_0x58bd70){if(_0x58bd70){return _0x294924[_0xfdd0('0x23')](_0x267cf2)[_0xfdd0('0x24')](_0x58bd70);}};}function respondWithFilteredResult(_0x37823d,_0x39b23d){return function(_0x12864f){if(_0x12864f){var _0x541a60=typeof _0x39b23d[_0xfdd0('0x25')]==='undefined'&&typeof _0x39b23d[_0xfdd0('0x26')]===_0xfdd0('0x27');var _0x5a64a2=_0x12864f['count'];var _0x1b4de=_0x541a60?0x0:_0x39b23d[_0xfdd0('0x25')];var _0x4098e0=_0x541a60?_0x12864f['count']:_0x39b23d[_0xfdd0('0x25')]+_0x39b23d[_0xfdd0('0x26')];var _0x463f12;if(_0x4098e0>=_0x5a64a2){_0x4098e0=_0x5a64a2;_0x463f12=0xc8;}else{_0x463f12=0xce;}_0x37823d[_0xfdd0('0x23')](_0x463f12);return _0x37823d[_0xfdd0('0x28')](_0xfdd0('0x29'),_0x1b4de+'-'+_0x4098e0+'/'+_0x5a64a2)[_0xfdd0('0x24')](_0x12864f);}return null;};}function patchUpdates(_0x2c367e){return function(_0x4ebc9c){try{jsonpatch[_0xfdd0('0x2a')](_0x4ebc9c,_0x2c367e,!![]);}catch(_0xf78d12){return BPromise[_0xfdd0('0x2b')](_0xf78d12);}return _0x4ebc9c['save']();};}function saveUpdates(_0x3c23e6,_0x17ff32){return function(_0x51d51f){if(_0x51d51f){return _0x51d51f['update'](_0x3c23e6)[_0xfdd0('0x2c')](function(_0x5eaa09){return _0x5eaa09;});}return null;};}function removeEntity(_0x332980,_0x1cb1c2){return function(_0x3310c7){if(_0x3310c7){return _0x3310c7[_0xfdd0('0x2d')]()[_0xfdd0('0x2c')](function(){_0x332980[_0xfdd0('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c9749,_0x2db742){return function(_0x12c536){if(!_0x12c536){_0x4c9749['sendStatus'](0x194);}return _0x12c536;};}function handleError(_0x55b886,_0x5be56d){_0x5be56d=_0x5be56d||0x1f4;return function(_0x1f09ad){logger[_0xfdd0('0x2e')](_0x1f09ad['stack']);if(_0x1f09ad[_0xfdd0('0x2f')]){delete _0x1f09ad[_0xfdd0('0x2f')];}_0x55b886[_0xfdd0('0x23')](_0x5be56d)[_0xfdd0('0x30')](_0x1f09ad);};}function getInteractionUsers(_0x38aeff,_0x1160c4){return new BPromise(function(_0x3b1f98,_0x222578){try{if(_0x1160c4[_0x38aeff['id']]){_0x38aeff[_0xfdd0('0x31')]=_['map'](_0x1160c4[_0x38aeff['id']],function(_0x210a3a){return{'id':_0x210a3a['id'],'fullname':_0x210a3a[_0xfdd0('0x32')]};});}}catch(_0x104dfc){_0x222578(_0x104dfc);}_0x3b1f98(_0x38aeff);});}function getInteractionTags(_0x8cb61d,_0x3c8837){return new BPromise(function(_0x21cffe,_0x1c6c6f){try{if(_0x8cb61d['TagIds']){_0x8cb61d[_0xfdd0('0x33')]=[];_0x8cb61d[_0xfdd0('0x34')][_0xfdd0('0x35')](',')[_0xfdd0('0x36')](function(_0x59f9ab){_0x8cb61d[_0xfdd0('0x33')][_0xfdd0('0x37')](_0x3c8837[_0x59f9ab]);});}delete _0x8cb61d[_0xfdd0('0x34')];}catch(_0x5e8175){_0x1c6c6f(_0x5e8175);}_0x21cffe(_0x8cb61d);});}function updateOpenchannelInteraction(_0x18c3ff,_0x490e59,_0x5e9fef){return new BPromise(function(_0x5d1341,_0x100aa4){return getInteractionUsers(_0x18c3ff,_0x5e9fef)[_0xfdd0('0x2c')](function(_0x14be6e){return getInteractionTags(_0x14be6e,_0x490e59);})['then'](function(_0x4f4a4e){return getStateInteraction(_0x4f4a4e);})[_0xfdd0('0x2c')](function(_0x4233ad){_0x5d1341(_0x4233ad);})['catch'](function(_0x36a347){_0x100aa4(_0x36a347);});});}function getStateInteraction(_0x1d73e4){return new BPromise(function(_0x1343ae){_0x1d73e4[_0xfdd0('0x38')]=0x0;_0x1d73e4['talking']=0x0;_0x1d73e4['answered']=0x0;_0x1d73e4[_0xfdd0('0x39')]=0x0;_0x1d73e4[_0xfdd0('0x3a')]=0x0;if(!_0x1d73e4[_0xfdd0('0x3b')]&&!_0x1d73e4['UserId']){_0x1d73e4[_0xfdd0('0x38')]+=0x1;}if(!_0x1d73e4[_0xfdd0('0x3b')]&&_0x1d73e4[_0xfdd0('0x3c')]){_0x1d73e4['talking']+=0x1;ids[_0xfdd0('0x37')](_0x1d73e4['id']);if(_0x1d73e4['waiting']){_0x1d73e4[_0xfdd0('0x38')]-=0x1;}}if(_0x1d73e4['closed']&&_0x1d73e4[_0xfdd0('0x3c')]){_0x1d73e4['answered']+=0x1;if(_0x1d73e4['talking']){_0x1d73e4[_0xfdd0('0x3d')]-=0x1;}}if(_0x1d73e4[_0xfdd0('0x3b')]&&!_0x1d73e4['UserId']){_0x1d73e4['unmanaged']+=0x1;if(_0x1d73e4['waiting']){_0x1d73e4[_0xfdd0('0x38')]-=0x1;}}_0x1d73e4['total']+=0x1;_0x1343ae(_0x1d73e4);});}exports[_0xfdd0('0x3e')]=function(_0x215d90,_0x28fbd4){var _0x5d5e83={},_0x248ef2={},_0x499cef={'count':0x0,'rows':[]};var _0x3162c9=_['map'](db[_0xfdd0('0x3f')][_0xfdd0('0x40')],function(_0x3c1078){return{'name':_0x3c1078[_0xfdd0('0x41')],'type':_0x3c1078[_0xfdd0('0x42')][_0xfdd0('0x43')]};});_0x248ef2[_0xfdd0('0x44')]=_[_0xfdd0('0x45')](_0x3162c9,_0xfdd0('0x2f'));_0x248ef2[_0xfdd0('0x46')]=_[_0xfdd0('0x47')](_0x215d90[_0xfdd0('0x46')]);_0x248ef2[_0xfdd0('0x48')]=_[_0xfdd0('0x49')](_0x248ef2['model'],_0x248ef2[_0xfdd0('0x46')]);_0x5d5e83[_0xfdd0('0x4a')]=_[_0xfdd0('0x49')](_0x248ef2[_0xfdd0('0x44')],qs[_0xfdd0('0x4b')](_0x215d90[_0xfdd0('0x46')]['fields']));_0x5d5e83['attributes']=_0x5d5e83['attributes'][_0xfdd0('0x4c')]?_0x5d5e83[_0xfdd0('0x4a')]:_0x248ef2[_0xfdd0('0x44')];if(!_0x215d90['query'][_0xfdd0('0x4d')]('nolimit')){_0x5d5e83[_0xfdd0('0x26')]=qs[_0xfdd0('0x26')](_0x215d90[_0xfdd0('0x46')][_0xfdd0('0x26')]);_0x5d5e83[_0xfdd0('0x25')]=qs['offset'](_0x215d90[_0xfdd0('0x46')][_0xfdd0('0x25')]);}_0x5d5e83[_0xfdd0('0x4e')]=qs[_0xfdd0('0x4f')](_0x215d90['query']['sort']);_0x5d5e83[_0xfdd0('0x50')]=qs[_0xfdd0('0x48')](_[_0xfdd0('0x51')](_0x215d90[_0xfdd0('0x46')],_0x248ef2[_0xfdd0('0x48')]),_0x3162c9);var _0x3b1ed3=[];var _0x31ff87=squel[_0xfdd0('0x52')]()[_0xfdd0('0x53')]('id')[_0xfdd0('0x53')](_0xfdd0('0x2f'))['field'](_0xfdd0('0x54'))[_0xfdd0('0x55')]('tools_tags');var _0x24ab51=squel[_0xfdd0('0x52')]()[_0xfdd0('0x53')](_0xfdd0('0x56'))[_0xfdd0('0x53')](_0xfdd0('0x57'))[_0xfdd0('0x53')](_0xfdd0('0x58'))[_0xfdd0('0x55')](_0xfdd0('0x59'),'ui')[_0xfdd0('0x5a')](_0xfdd0('0x5b'),'u','u.id\x20=\x20ui.UserId');var _0x56b674=squel[_0xfdd0('0x52')]()[_0xfdd0('0x55')](_0xfdd0('0x5c'),'i')[_0xfdd0('0x5a')]('cm_contacts','c',_0xfdd0('0x5d'))[_0xfdd0('0x5a')](_0xfdd0('0x5b'),'o',_0xfdd0('0x5e'))[_0xfdd0('0x5a')](_0xfdd0('0x5f'),'a',_0xfdd0('0x60'))[_0xfdd0('0x5a')](_0xfdd0('0x61'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0xfdd0('0x5a')](_0xfdd0('0x62'),'it',_0xfdd0('0x63'))[_0xfdd0('0x5a')](_0xfdd0('0x64'),'t',_0xfdd0('0x65'));var _0x5136df=squel[_0xfdd0('0x66')]();var _0x2130ad=[];var _0x1e8711=squel['expr']();var _0x22a1dc;if(_0x215d90[_0xfdd0('0x46')][_0xfdd0('0x67')]){_0x22a1dc=as[_0xfdd0('0x68')](_0x215d90[_0xfdd0('0x46')]['search']);var _0x532ccd=_0x22a1dc[_0xfdd0('0x69')];for(var _0x459d1b=0x0;_0x459d1b<_0x22a1dc['conditions'][_0xfdd0('0x4c')];_0x459d1b++){var _0x30e913=_0x22a1dc['conditions'][_0x459d1b];var _0xfa8ba1='i';var _0x266335=_[_0xfdd0('0x6a')](_0x3162c9,[_0xfdd0('0x2f'),_0x30e913[_0xfdd0('0x53')]]);if(!_0x266335){switch(_0x30e913[_0xfdd0('0x53')]){case _0xfdd0('0x6b'):if(_0x30e913[_0xfdd0('0x6c')]==0x1){_0x56b674['having']('`'+_0x30e913[_0xfdd0('0x53')]+_0xfdd0('0x6d'));}else{_0x56b674[_0xfdd0('0x6e')]('`'+_0x30e913[_0xfdd0('0x53')]+_0xfdd0('0x6f'));}break;case _0xfdd0('0x70'):if(_0x30e913['operator']===_0xfdd0('0x71')){if(_0x30e913[_0xfdd0('0x6c')]['split']('\x20')[_0xfdd0('0x4c')]>0x1){_0x5136df[_0x532ccd](_0xfdd0('0x72'),qs['getFullTextValue'](_0x30e913[_0xfdd0('0x6c')]),null);}else{var _0x2f3726='%'+_0x30e913[_0xfdd0('0x6c')]+'%';_0x5136df[_0x532ccd](_0xfdd0('0x73'),_0x2f3726,_0x2f3726,_0x2f3726);}}else{_0x266335=_['find'](_0x3162c9,['name',_0xfdd0('0x74')]);_0x30e913['field']=_0xfdd0('0x74');_0x1bbf26=as[_0xfdd0('0x75')](_0xfa8ba1,_0x266335['type'],_0x30e913);_0x5136df[_0x532ccd](_0x1bbf26[_0xfdd0('0x76')],_0x1bbf26[_0xfdd0('0x6c')][_0xfdd0('0x77')],_0x1bbf26['value'][_0xfdd0('0x22')]);}break;case _0xfdd0('0x78'):var _0x3dece6=_0x30e913[_0xfdd0('0x6c')][_0xfdd0('0x35')](',')[_0xfdd0('0x45')](function(_0x77240b){return Number(_0x77240b);});_0x3dece6[_0xfdd0('0x36')](function(_0x28dc55){_0x1e8711['or'](_0xfdd0('0x79'),'%,'+_0x28dc55+',%');});_0x2130ad=_['union'](_0x2130ad,_0x3dece6);break;case _0xfdd0('0x7a'):if(_0x30e913[_0xfdd0('0x7b')]==='$substring'){_0x5136df[_0x532ccd](_0xfdd0('0x7c'),'%'+_0x30e913[_0xfdd0('0x6c')]+'%',null);}else{_0x266335=_[_0xfdd0('0x6a')](_0x3162c9,[_0xfdd0('0x2f'),'UserId']);_0x30e913[_0xfdd0('0x53')]=_0xfdd0('0x3c');_0x1bbf26=as[_0xfdd0('0x75')](_0xfa8ba1,_0x266335[_0xfdd0('0x42')],_0x30e913);_0x5136df[_0x532ccd](_0x1bbf26[_0xfdd0('0x76')],_0x1bbf26[_0xfdd0('0x6c')][_0xfdd0('0x77')],_0x1bbf26['value'][_0xfdd0('0x22')]);}break;case _0xfdd0('0x7d'):_0x1bbf26=as[_0xfdd0('0x75')]('me',null,_0x30e913);_0x5136df[_0x532ccd](_0x1bbf26[_0xfdd0('0x76')],_0x1bbf26[_0xfdd0('0x6c')][_0xfdd0('0x77')],_0x1bbf26[_0xfdd0('0x6c')][_0xfdd0('0x22')]);break;}}else{var _0x1bbf26=as['buildExpression'](_0xfa8ba1,_0x266335[_0xfdd0('0x42')],_0x30e913);_0x5136df[_0x532ccd](_0x1bbf26[_0xfdd0('0x76')],_0x1bbf26[_0xfdd0('0x6c')][_0xfdd0('0x77')],_0x1bbf26[_0xfdd0('0x6c')]['end']);}}}else{var _0x121cb5=_(_0x215d90[_0xfdd0('0x46')])[_0xfdd0('0x47')]()[_0xfdd0('0x45')](function(_0x52bee2){return _[_0xfdd0('0x7e')](_0x3162c9,['name',_0x52bee2])?_0x52bee2:undefined;})['compact']()[_0xfdd0('0x6c')]();if(!_['isEmpty'](_0x121cb5)){_0x121cb5['forEach'](function(_0x11ecb0){if(_0x11ecb0===_0xfdd0('0x7f')){_0x56b674[_0xfdd0('0x50')](_0xfdd0('0x80'),[]['concat'](_0x215d90[_0xfdd0('0x46')][_0x11ecb0]));}else if(_0x11ecb0===_0xfdd0('0x81')){var _0x5b1ea0=JSON['parse'](_0x215d90[_0xfdd0('0x46')][_0x11ecb0])[_0xfdd0('0x82')];var _0x4b2395=JSON['parse'](_0x215d90[_0xfdd0('0x46')][_0x11ecb0])[_0xfdd0('0x83')];_0x56b674[_0xfdd0('0x50')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b1ea0,_0x4b2395);}else{if(_0x215d90[_0xfdd0('0x46')][_0x11ecb0]==='null'){_0x56b674[_0xfdd0('0x50')]('i.'+_0x11ecb0+_0xfdd0('0x84'));}else{_0x56b674['where']('i.'+_0x11ecb0+_0xfdd0('0x85'),_0x215d90[_0xfdd0('0x46')][_0x11ecb0]);}}});}if(_0x215d90[_0xfdd0('0x46')][_0xfdd0('0x86')]){if(_0x215d90[_0xfdd0('0x46')][_0xfdd0('0x86')]==0x1){_0x56b674['having'](_0xfdd0('0x87'));}else{_0x56b674['having']('`unreadMessages`\x20>\x200');}}if(_0x215d90['query'][_0xfdd0('0x88')]){_0x2130ad=_[_0xfdd0('0x89')](_0x215d90[_0xfdd0('0x46')][_0xfdd0('0x88')])?_0x215d90[_0xfdd0('0x46')]['tag']:new Array(_0x215d90[_0xfdd0('0x46')][_0xfdd0('0x88')]);_0x2130ad[_0xfdd0('0x36')](function(_0x1cd683){_0x1e8711['or'](_0xfdd0('0x79'),'%,'+_0x1cd683+',%');});}if(_0x215d90[_0xfdd0('0x46')][_0xfdd0('0x8a')]){var _0x20b0d3=_0x215d90[_0xfdd0('0x46')][_0xfdd0('0x8a')]['replace']('\x5c','\x5c\x5c')[_0xfdd0('0x8b')](/'/g,'\x27\x27');if(qs[_0xfdd0('0x8c')](_0x20b0d3)){_0x5136df['or'](_0xfdd0('0x8d'),_0x20b0d3+'%');}else{_0x5136df['or'](_0xfdd0('0x8e'),qs[_0xfdd0('0x8f')](_0x20b0d3))['or'](_0xfdd0('0x90'),_0x20b0d3+'%')['or'](_0xfdd0('0x91'),_0x20b0d3+'%');}}}_0x56b674[_0xfdd0('0x50')](_0x5136df);_0x56b674[_0xfdd0('0x92')]('i.id');var _0x3430f6={'type':db[_0xfdd0('0x93')]['QueryTypes'][_0xfdd0('0x94')],'raw':!![]};var _0x1e113f=_0x56b674[_0xfdd0('0x95')]();_0x1e113f['field']('i.id');_0x1e113f[_0xfdd0('0x53')](_0xfdd0('0x96'),_0xfdd0('0x6b'));if(_0x5d5e83[_0xfdd0('0x4e')]){_0x5d5e83[_0xfdd0('0x4e')][_0xfdd0('0x36')](function(_0xba116c){var _0xb8563=_0xba116c[0x0]===_0xfdd0('0x97')?_0xba116c[0x0]:'i.'+_0xba116c[0x0];_0x56b674[_0xfdd0('0x4e')](_0xb8563,_0xba116c[0x1]===_0xfdd0('0x98')?![]:!![]);});}if(!_['isEmpty'](_0x2130ad)){_0x56b674[_0xfdd0('0x6e')](_0x1e8711);_0x1e113f['where']('t.id\x20IN\x20?',_0x2130ad);}BPromise[_0xfdd0('0x99')]()['then'](function(){if(!_0x22a1dc){if(_0x215d90[_0xfdd0('0x46')][_0xfdd0('0x7f')])return;_0x1e113f[_0xfdd0('0x50')](_0xfdd0('0x9a'));_0x56b674[_0xfdd0('0x50')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x215d90['user'][_0xfdd0('0x9b')]!==_0xfdd0('0x9c'))return;return _0x215d90['user'][_0xfdd0('0x9d')]({'attributes':['id'],'raw':!![]})[_0xfdd0('0x2c')](function(_0x3142b9){if(_[_0xfdd0('0x9e')](_0x3142b9)){_0x1e113f['where'](_0xfdd0('0x9f'));_0x56b674[_0xfdd0('0x50')](_0xfdd0('0x9f'));}else{_0x1e113f[_0xfdd0('0x50')](_0xfdd0('0x80'),_[_0xfdd0('0x45')](_0x3142b9,'id'));_0x56b674[_0xfdd0('0x50')](_0xfdd0('0x80'),_[_0xfdd0('0x45')](_0x3142b9,'id'));}});})['then'](function(){if(_0x215d90['user'][_0xfdd0('0x9b')]===_0xfdd0('0x9c')&&!_0x22a1dc&&!_0x215d90['query'][_0xfdd0('0x7f')])return[];return db['sequelize']['query'](_0x1e113f[_0xfdd0('0xa0')](),_0x3430f6);})[_0xfdd0('0x2c')](function(_0x55952f){_0x499cef[_0xfdd0('0xa1')]=_0x55952f['length'];if(_0x499cef['count']===0x0)return[];return db[_0xfdd0('0xa2')][_0xfdd0('0x46')](_0x31ff87['toString'](),_0x3430f6)[_0xfdd0('0x2c')](function(_0x70e990){_0x3b1ed3=_[_0xfdd0('0xa3')](_0x70e990,'id');_0x3430f6=_[_0xfdd0('0xa4')](_0x3430f6,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x215d90[_0xfdd0('0x46')][_0xfdd0('0x4b')]){_0x5d5e83['attributes']['forEach'](function(_0x5eabe2){_0x56b674[_0xfdd0('0x53')]('i.'+_0x5eabe2);});}else{_0x56b674[_0xfdd0('0x53')](_0xfdd0('0x96'),_0xfdd0('0x6b'));_0x56b674['field'](_0xfdd0('0xa5'),_0xfdd0('0xa6'));_0x56b674[_0xfdd0('0x53')]('a.mandatoryDisposition',_0xfdd0('0xa7'));_0x56b674[_0xfdd0('0x53')]('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',_0xfdd0('0x97'));_0x56b674[_0xfdd0('0x53')](_0xfdd0('0xa8'));_0x56b674[_0xfdd0('0x53')](_0xfdd0('0xa9'),_0xfdd0('0xaa'));_0x56b674[_0xfdd0('0x53')](_0xfdd0('0xab'),_0xfdd0('0xac'));_0x56b674[_0xfdd0('0x53')]('c.email','Contact.email');_0x56b674[_0xfdd0('0x53')](_0xfdd0('0xad'),_0xfdd0('0xae'));_0x56b674['field']('c.mobile',_0xfdd0('0xaf'));_0x56b674[_0xfdd0('0x53')](_0xfdd0('0xb0'),_0xfdd0('0xb1'));_0x56b674[_0xfdd0('0x53')]('o.fullname','Owner.fullname');_0x56b674[_0xfdd0('0x53')](_0xfdd0('0xb2'),'Owner.internal');_0x56b674['field'](_0xfdd0('0xb3'),_0xfdd0('0x34'));}if(_0x5d5e83[_0xfdd0('0x26')])_0x56b674[_0xfdd0('0x26')](_0x5d5e83[_0xfdd0('0x26')]);if(_0x5d5e83[_0xfdd0('0x25')])_0x56b674[_0xfdd0('0x25')](_0x5d5e83['offset']);return db[_0xfdd0('0xa2')][_0xfdd0('0x46')](_0x56b674[_0xfdd0('0xa0')](),_0x3430f6);})[_0xfdd0('0x2c')](function(_0xbe17f8){if(_0xbe17f8[_0xfdd0('0x4c')]>0x0)_0x24ab51['where'](_0xfdd0('0xb4'),_[_0xfdd0('0x45')](_0xbe17f8,'id'));return db[_0xfdd0('0xa2')][_0xfdd0('0x46')](_0x24ab51[_0xfdd0('0xa0')](),_0x3430f6)[_0xfdd0('0x2c')](function(_0x29532b){var _0x345b9c=_[_0xfdd0('0xb5')](_0x29532b,_0xfdd0('0xb6'));var _0x14735b=[];_0xbe17f8[_0xfdd0('0x36')](function(_0x345884){_0x14735b[_0xfdd0('0x37')](updateOpenchannelInteraction(_0x345884,_0x3b1ed3,_0x345b9c));});return BPromise[_0xfdd0('0xb7')](_0x14735b);});});})[_0xfdd0('0x2c')](function(_0x2200e5){_0x499cef['rows']=_0x2200e5;return _0x499cef;})[_0xfdd0('0x2c')](respondWithFilteredResult(_0x28fbd4,_0x5d5e83))[_0xfdd0('0xb8')](handleError(_0x28fbd4,null));};exports[_0xfdd0('0xb9')]=function(_0x3b7814,_0x1579c4){var _0x559931={};if(_0x3b7814[_0xfdd0('0x46')][_0xfdd0('0x42')]&&_0x3b7814['query'][_0xfdd0('0x42')]===_0xfdd0('0x55')){_0x559931[_0xfdd0('0x55')]=_0x3b7814['params']['id'];}else{_0x559931['id']=_0x3b7814[_0xfdd0('0xba')]['id'];}var _0x29ea4c={'raw':![],'where':_0x559931},_0x12cb5a={};_0x12cb5a[_0xfdd0('0x44')]=_[_0xfdd0('0x47')](db[_0xfdd0('0x3f')][_0xfdd0('0x40')]);_0x12cb5a[_0xfdd0('0x46')]=_[_0xfdd0('0x47')](_0x3b7814[_0xfdd0('0x46')]);_0x12cb5a[_0xfdd0('0x48')]=_['intersection'](_0x12cb5a[_0xfdd0('0x44')],_0x12cb5a['query']);_0x29ea4c['attributes']=_[_0xfdd0('0x49')](_0x12cb5a['model'],qs[_0xfdd0('0x4b')](_0x3b7814['query'][_0xfdd0('0x4b')]));_0x29ea4c[_0xfdd0('0x4a')]=_0x29ea4c[_0xfdd0('0x4a')]['length']?_0x29ea4c[_0xfdd0('0x4a')]:_0x12cb5a['model'];if(_0x3b7814[_0xfdd0('0x46')][_0xfdd0('0xbb')]){_0x29ea4c[_0xfdd0('0xbc')]=[{'all':!![]}];}_0x29ea4c=_[_0xfdd0('0xa4')]({},_0x29ea4c,_0x3b7814[_0xfdd0('0xbd')]);return db[_0xfdd0('0x3f')]['find'](_0x29ea4c)[_0xfdd0('0x2c')](handleEntityNotFound(_0x1579c4,null))[_0xfdd0('0x2c')](respondWithResult(_0x1579c4,null))['catch'](handleError(_0x1579c4,null));};exports[_0xfdd0('0xbe')]=function(_0x581f34,_0x292398){return db[_0xfdd0('0x3f')][_0xfdd0('0xbe')](_0x581f34['body'],{})[_0xfdd0('0x2c')](respondWithResult(_0x292398,0xc9))[_0xfdd0('0xb8')](handleError(_0x292398,null));};exports[_0xfdd0('0xbf')]=function(_0x8201e7,_0x28f5c0){if(_0x8201e7[_0xfdd0('0x7d')]['id']){delete _0x8201e7[_0xfdd0('0x7d')]['id'];}return db['OpenchannelInteraction'][_0xfdd0('0x6a')]({'where':{'id':_0x8201e7[_0xfdd0('0xba')]['id']}})[_0xfdd0('0x2c')](handleEntityNotFound(_0x28f5c0,null))[_0xfdd0('0x2c')](saveUpdates(_0x8201e7[_0xfdd0('0x7d')],null))[_0xfdd0('0x2c')](respondWithResult(_0x28f5c0,null))[_0xfdd0('0xb8')](handleError(_0x28f5c0,null));};exports['destroy']=function(_0x2d6186,_0x2ab85a){return db[_0xfdd0('0x3f')][_0xfdd0('0x6a')]({'where':{'id':_0x2d6186[_0xfdd0('0xba')]['id']}})[_0xfdd0('0x2c')](handleEntityNotFound(_0x2ab85a,null))[_0xfdd0('0x2c')](removeEntity(_0x2ab85a,null))[_0xfdd0('0xb8')](handleError(_0x2ab85a,null));};exports[_0xfdd0('0xc0')]=function(_0x2470eb,_0x230d6b){return db['OpenchannelInteraction'][_0xfdd0('0xc0')]()[_0xfdd0('0x2c')](respondWithResult(_0x230d6b,null))[_0xfdd0('0xb8')](handleError(_0x230d6b,null));};exports['addMessage']=function(_0xae5115,_0x17ad32,_0x2785b0){return db[_0xfdd0('0xc1')][_0xfdd0('0x6a')]({'where':{'id':_0xae5115[_0xfdd0('0xba')]['id']}})['then'](handleEntityNotFound(_0x17ad32,null))[_0xfdd0('0x2c')](function(_0x33dbe4){if(_0x33dbe4){return _0x33dbe4[_0xfdd0('0xc2')](_0xae5115[_0xfdd0('0x7d')][_0xfdd0('0xc3')],_[_0xfdd0('0xc4')](_0xae5115[_0xfdd0('0x7d')],['ids','id'])||{});}})['then'](respondWithResult(_0x17ad32,null))[_0xfdd0('0xb8')](handleError(_0x17ad32,null));};exports[_0xfdd0('0xc5')]=function(_0x3fc3de,_0xaca82d,_0x3008ea){var _0x573c9f={'raw':![],'where':{}};var _0x375f14={};var _0x81cb8b={'count':0x0,'rows':[]};return db[_0xfdd0('0x3f')][_0xfdd0('0xc6')]({'where':{'id':_0x3fc3de['params']['id']}})[_0xfdd0('0x2c')](handleEntityNotFound(_0xaca82d,null))[_0xfdd0('0x2c')](function(_0x2252e6){if(_0x2252e6){_0x375f14[_0xfdd0('0x44')]=_[_0xfdd0('0x47')](db[_0xfdd0('0xc1')][_0xfdd0('0x40')]);_0x375f14[_0xfdd0('0x46')]=_['keys'](_0x3fc3de['query']);_0x375f14['filters']=_['intersection'](_0x375f14[_0xfdd0('0x44')],_0x375f14[_0xfdd0('0x46')]);_0x573c9f[_0xfdd0('0x4a')]=_['intersection'](_0x375f14['model'],qs[_0xfdd0('0x4b')](_0x3fc3de['query']['fields']));_0x573c9f[_0xfdd0('0x4a')]=_0x573c9f[_0xfdd0('0x4a')]['length']?_0x573c9f[_0xfdd0('0x4a')]:_0x375f14[_0xfdd0('0x44')];if(!_0x3fc3de[_0xfdd0('0x46')][_0xfdd0('0x4d')]('nolimit')){_0x573c9f[_0xfdd0('0x26')]=qs[_0xfdd0('0x26')](_0x3fc3de['query'][_0xfdd0('0x26')]);_0x573c9f[_0xfdd0('0x25')]=qs['offset'](_0x3fc3de[_0xfdd0('0x46')][_0xfdd0('0x25')]);}_0x573c9f[_0xfdd0('0x4e')]=qs['sort'](_0x3fc3de['query'][_0xfdd0('0x4f')]);_0x573c9f[_0xfdd0('0x50')]=qs[_0xfdd0('0x48')](_[_0xfdd0('0x51')](_0x3fc3de['query'],_0x375f14[_0xfdd0('0x48')]));_0x573c9f[_0xfdd0('0x50')][_0xfdd0('0xb6')]=_0x2252e6['id'];if(_0x3fc3de[_0xfdd0('0x46')]['filter']){_0x573c9f[_0xfdd0('0x50')]=_['merge'](_0x573c9f[_0xfdd0('0x50')],{'$or':_[_0xfdd0('0x45')](_0x573c9f[_0xfdd0('0x4a')],function(_0x2a3487){var _0x42035a={};_0x42035a[_0x2a3487]={'$like':'%'+_0x3fc3de[_0xfdd0('0x46')]['filter']+'%'};return _0x42035a;})});}if(_0x3fc3de[_0xfdd0('0x46')][_0xfdd0('0x82')]){var _0x31db94=_0x3fc3de[_0xfdd0('0x46')][_0xfdd0('0x82')][_0xfdd0('0x35')](',');var _0x53f791={};_0x53f791[_0x31db94[0x0]]={'$gte':moment(_0x31db94[0x1])[_0xfdd0('0xc7')](_0xfdd0('0xc8'))};_0x573c9f[_0xfdd0('0x50')]=_[_0xfdd0('0xa4')](_0x573c9f[_0xfdd0('0x50')],_0x53f791);}_0x573c9f=_[_0xfdd0('0xa4')]({},_0x573c9f,_0x3fc3de[_0xfdd0('0xbd')]);return db[_0xfdd0('0xc1')][_0xfdd0('0xa1')]({'where':_0x573c9f['where']})[_0xfdd0('0x2c')](function(_0x5dbf3d){_0x81cb8b[_0xfdd0('0xa1')]=_0x5dbf3d;if(_0x3fc3de[_0xfdd0('0x46')][_0xfdd0('0xbb')]){_0x573c9f[_0xfdd0('0xbc')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xfdd0('0xc9')](_0x573c9f);})[_0xfdd0('0x2c')](function(_0x1f7106){_0x81cb8b[_0xfdd0('0xca')]=_0x1f7106;return _0x81cb8b;});}})[_0xfdd0('0x2c')](respondWithFilteredResult(_0xaca82d,_0x573c9f))[_0xfdd0('0xb8')](handleError(_0xaca82d,null));};exports[_0xfdd0('0xcb')]=function(_0x3970a2,_0x1b061b,_0x47ce6f){return db[_0xfdd0('0x3f')][_0xfdd0('0x6a')]({'where':{'id':_0x3970a2[_0xfdd0('0xba')]['id']}})['then'](handleEntityNotFound(_0x1b061b,null))[_0xfdd0('0x2c')](function(_0x27e512){if(_0x27e512){return _0x27e512[_0xfdd0('0xcc')](_0x3970a2[_0xfdd0('0x7d')][_0xfdd0('0xc3')],_['omit'](_0x3970a2[_0xfdd0('0x7d')],['ids','id'])||{})[_0xfdd0('0xcd')](function(){return db[_0xfdd0('0x78')][_0xfdd0('0xc9')]({'attributes':['id',_0xfdd0('0x2f'),'color'],'where':{'id':_0x3970a2[_0xfdd0('0x7d')][_0xfdd0('0xc3')]}});})['then'](function(_0x721a7b){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x3970a2[_0xfdd0('0xba')]['id']),'tags':_0x721a7b||[]});return{'id':Number(_0x3970a2[_0xfdd0('0xba')]['id']),'tags':_0x721a7b||[]};});}})[_0xfdd0('0x2c')](respondWithResult(_0x1b061b,null))['catch'](handleError(_0x1b061b,null));};exports[_0xfdd0('0xce')]=function(_0x2f1b34,_0xb2b785,_0x13e965){return db[_0xfdd0('0x3f')]['find']({'where':{'id':_0x2f1b34[_0xfdd0('0xba')]['id']}})[_0xfdd0('0x2c')](handleEntityNotFound(_0xb2b785,null))[_0xfdd0('0x2c')](function(_0x1af1b1){if(_0x1af1b1){return _0x1af1b1[_0xfdd0('0xce')](_0x2f1b34[_0xfdd0('0x46')]['ids']);}})[_0xfdd0('0x2c')](respondWithStatusCode(_0xb2b785,null))[_0xfdd0('0xb8')](handleError(_0xb2b785,null));};exports[_0xfdd0('0xcf')]=function(_0x510cac,_0x5435e6){var _0x4644c5=moment()[_0xfdd0('0xd0')]()[_0xfdd0('0xa0')]();var _0x27d6e8=path[_0xfdd0('0xd1')](config['root'],'server','files',_0xfdd0('0xd2'));var _0x1eae86=path[_0xfdd0('0xd1')](config[_0xfdd0('0xd3')],_0xfdd0('0xd4'),_0xfdd0('0xd5'),_0xfdd0('0xd6'));var _0x3968f4=path[_0xfdd0('0xd1')](_0x27d6e8,_0x4644c5);var _0x1009e8=util[_0xfdd0('0xc7')](_0xfdd0('0xd7'),_0x510cac[_0xfdd0('0xba')]['id'],_0x4644c5);var _0x47b953=path['join'](_0x27d6e8,_0x1009e8);var _0x2989e8=[];_0x2989e8[_0xfdd0('0x37')]({'model':db['User'],'as':_0xfdd0('0x7a'),'attributes':['id',_0xfdd0('0x32')],'raw':!![]});_0x2989e8[_0xfdd0('0x37')]({'model':db[_0xfdd0('0xd8')],'as':'Contact','attributes':['id',_0xfdd0('0xd9'),'lastName'],'raw':!![]});if(_0x510cac[_0xfdd0('0x46')][_0xfdd0('0xd6')]){_0x2989e8[_0xfdd0('0x37')]({'model':db[_0xfdd0('0xda')],'as':_0xfdd0('0xda'),'raw':!![]});}var _0x178541=[{'model':db[_0xfdd0('0xc1')],'as':_0xfdd0('0xdb'),'attributes':['id',_0xfdd0('0x7d'),_0xfdd0('0x81'),_0xfdd0('0xdc'),_0xfdd0('0xdd'),'read'],'include':_0x2989e8}];_0x178541[_0xfdd0('0x37')]({'model':db[_0xfdd0('0xde')],'as':_0xfdd0('0xdf'),'attributes':['id',_0xfdd0('0x2f')]});_0x178541['push']({'model':db['User'],'as':'Owner','attributes':['id','fullname']});return db[_0xfdd0('0x3f')][_0xfdd0('0x6a')]({'where':{'id':_0x510cac[_0xfdd0('0xba')]['id']},'include':_0x178541})[_0xfdd0('0x2c')](handleEntityNotFound(_0x5435e6,null))[_0xfdd0('0x2c')](function(_0x589e7a){if(_0x589e7a){var _0x5cdfd7=_0x589e7a['get']({'plain':!![]});fs[_0xfdd0('0xe0')](_0x3968f4);var _0x4b5a9a={'channel':'Openchannel','account':_0x5cdfd7['Account']['name'],'agent':_0x5cdfd7[_0xfdd0('0xe1')]?_0x5cdfd7['Owner'][_0xfdd0('0x32')]:_0xfdd0('0xe2'),'createdAt':moment(_0x5cdfd7['createdAt'])[_0xfdd0('0xc7')](_0xfdd0('0xc8'))[_0xfdd0('0xa0')](),'closedAt':_0x5cdfd7['closed']?moment(_0x5cdfd7[_0xfdd0('0xe3')])[_0xfdd0('0xc7')](_0xfdd0('0xc8'))[_0xfdd0('0xa0')]():'','disposition':_0x5cdfd7['disposition'],'visibility':_0x5cdfd7[_0xfdd0('0xe4')]?_0xfdd0('0xe5'):'Private','messages':_(_0x5cdfd7[_0xfdd0('0xdb')])[_0xfdd0('0x8a')]({'secret':![]})[_0xfdd0('0x45')](function(_0x901ab6){if(_0x901ab6[_0xfdd0('0xda')]){var _0x4f7cef=path[_0xfdd0('0xd1')](_0x1eae86,_0x901ab6['Attachment'][_0xfdd0('0xe6')]);if(fs[_0xfdd0('0xe7')](_0x4f7cef)){fs['createReadStream'](_0x4f7cef)[_0xfdd0('0xe8')](fs[_0xfdd0('0xe9')](path['join'](_0x3968f4,_0x901ab6[_0xfdd0('0xda')][_0xfdd0('0xe6')])));}}return{'date':moment(_0x901ab6['createdAt'])[_0xfdd0('0xc7')](_0xfdd0('0xc8'))[_0xfdd0('0xa0')](),'sender':_0x901ab6['direction']===_0xfdd0('0xea')?_0x901ab6['User']?_0x901ab6[_0xfdd0('0x7a')][_0xfdd0('0x32')]:_0xfdd0('0xeb'):_0x901ab6['Contact'][_0xfdd0('0xd9')]+(_0x901ab6[_0xfdd0('0x70')][_0xfdd0('0xec')]?'\x20'+_0x901ab6['Contact']['lastName']:''),'body':_0x901ab6['Attachment']?_0x901ab6[_0xfdd0('0xda')][_0xfdd0('0xe6')]:_0x901ab6[_0xfdd0('0x7d')],'direction':_0x901ab6['direction']===_0xfdd0('0xea')?'A':'C','secret':_0x901ab6['secret'],'read':_0x901ab6[_0xfdd0('0x86')],'attachment':_0x901ab6[_0xfdd0('0xda')]};})[_0xfdd0('0x6c')]()};return ejs['renderFile'](path[_0xfdd0('0xd1')](config['root'],'server','views',_0xfdd0('0xed')),{'interaction':_0x4b5a9a})[_0xfdd0('0x2c')](function(_0x438e13){var _0x14131c=path[_0xfdd0('0xd1')](_0x3968f4,_0xfdd0('0xee')+_0x5cdfd7['id']+'-'+_0x4644c5+_0xfdd0('0xef'));var _0x3c67d0={'path':_0x14131c,'channel':_0xfdd0('0xf0'),'interactionId':_0x5cdfd7['id']};return pdf[_0xfdd0('0xf1')](_0x438e13,_0x3c67d0);})['then'](function(){return new BPromise(function(_0x48e77e,_0x2977ab){zipdir(_0x3968f4,{'saveTo':_0x47b953},function(_0x3c8841,_0xe8133a){if(_0x3c8841)return _0x2977ab(_0x3c8841);return _0x48e77e(_0xe8133a);});})[_0xfdd0('0x2c')](function(){return new BPromise(function(_0x5b878d,_0x4148fd){rimraf(_0x3968f4,function(_0x510ee9){if(_0x510ee9)_0x4148fd(_0x510ee9);return _0x5b878d();});});})[_0xfdd0('0x2c')](function(){return _0x5435e6[_0xfdd0('0xcf')](_0x47b953,_0x1009e8,function(_0x3b6447){if(_0x3b6447){console[_0xfdd0('0xf2')]('err',_0x3b6447);}else{fs[_0xfdd0('0xf3')](_0x47b953);}});});});}else{return _0x5435e6[_0xfdd0('0x21')](0xc8);}})['catch'](handleError(_0x5435e6,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 48af8e9..0d70239 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 _0x1a1a=['hook','exports','events','OpenchannelInteraction','../../mysqldb','save','update','getUsers','Users','map','findAll','then','setDataValue','unreadMessages','emit','hasOwnProperty'];(function(_0x3bc022,_0x398082){var _0x4a19c6=function(_0x1e3281){while(--_0x1e3281){_0x3bc022['push'](_0x3bc022['shift']());}};_0x4a19c6(++_0x398082);}(_0x1a1a,0x192));var _0xa1a1=function(_0x19354b,_0xd46d4e){_0x19354b=_0x19354b-0x0;var _0x428d50=_0x1a1a[_0x19354b];return _0x428d50;};'use strict';var EventEmitter=require(_0xa1a1('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xa1a1('0x1')];var OpenchannelMessage=require(_0xa1a1('0x2'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa1a1('0x3'),'afterUpdate':_0xa1a1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x378ca0){return function(_0xdd0559,_0x55561d,_0x3d580c){_0xdd0559[_0xa1a1('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0xbfd40d){_0xdd0559['setDataValue'](_0xa1a1('0x6'),_0xbfd40d[_0xa1a1('0x7')](function(_0x30e854){return{'id':_0x30e854['id']};}));return OpenchannelMessage[_0xa1a1('0x8')]({'where':{'OpenchannelInteractionId':_0xdd0559['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa1a1('0x9')](function(_0x1e34f2){_0xdd0559[_0xa1a1('0xa')](_0xa1a1('0xb'),_0x1e34f2['length']);OpenchannelInteractionEvents[_0xa1a1('0xc')](_0x378ca0+':'+_0xdd0559['id'],_0xdd0559);OpenchannelInteractionEvents[_0xa1a1('0xc')](_0x378ca0,_0xdd0559);_0x3d580c(null);})['catch'](_0x3d580c(null));};}for(var e in events){if(events[_0xa1a1('0xd')](e)){var event=events[e];OpenchannelInteraction[_0xa1a1('0xe')](e,emitEvent(event));}}module[_0xa1a1('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xd2cf=['remove','getUsers','setDataValue','map','findAll','then','length','emit','catch','hasOwnProperty','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save'];(function(_0x2191f5,_0x4655b8){var _0x47033f=function(_0x43dd13){while(--_0x43dd13){_0x2191f5['push'](_0x2191f5['shift']());}};_0x47033f(++_0x4655b8);}(_0xd2cf,0xea));var _0xfd2c=function(_0xf26d40,_0x2f4f46){_0xf26d40=_0xf26d40-0x0;var _0x50b68c=_0xd2cf[_0xf26d40];return _0x50b68c;};'use strict';var EventEmitter=require(_0xfd2c('0x0'));var OpenchannelInteraction=require(_0xfd2c('0x1'))['db'][_0xfd2c('0x2')];var OpenchannelMessage=require(_0xfd2c('0x1'))['db'][_0xfd2c('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xfd2c('0x4')](0x0);var events={'afterCreate':_0xfd2c('0x5'),'afterUpdate':'update','afterDestroy':_0xfd2c('0x6')};function emitEvent(_0x7427e1){return function(_0x264d22,_0x468165,_0x359502){_0x264d22[_0xfd2c('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3b68af){_0x264d22[_0xfd2c('0x8')]('Users',_0x3b68af[_0xfd2c('0x9')](function(_0x4ec0e8){return{'id':_0x4ec0e8['id']};}));return OpenchannelMessage[_0xfd2c('0xa')]({'where':{'OpenchannelInteractionId':_0x264d22['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfd2c('0xb')](function(_0x3570cf){_0x264d22[_0xfd2c('0x8')]('unreadMessages',_0x3570cf[_0xfd2c('0xc')]);OpenchannelInteractionEvents[_0xfd2c('0xd')](_0x7427e1+':'+_0x264d22['id'],_0x264d22);OpenchannelInteractionEvents[_0xfd2c('0xd')](_0x7427e1,_0x264d22);_0x359502(null);})[_0xfd2c('0xe')](_0x359502(null));};}for(var e in events){if(events[_0xfd2c('0xf')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 0d28b6c..47c616f 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 _0x03ab=['openchannel_interactions','utf8mb4_unicode_ci','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction'];(function(_0x47ac44,_0x279c05){var _0x192f24=function(_0x8d5c47){while(--_0x8d5c47){_0x47ac44['push'](_0x47ac44['shift']());}};_0x192f24(++_0x279c05);}(_0x03ab,0x1e5));var _0xb03a=function(_0x418766,_0x1f2c03){_0x418766=_0x418766-0x0;var _0x41970a=_0x03ab[_0x418766];return _0x41970a;};'use strict';var _=require('lodash');var util=require(_0xb03a('0x0'));var logger=require(_0xb03a('0x1'))('api');var moment=require(_0xb03a('0x2'));var BPromise=require(_0xb03a('0x3'));var rp=require(_0xb03a('0x4'));var fs=require('fs');var path=require(_0xb03a('0x5'));var rimraf=require(_0xb03a('0x6'));var config=require(_0xb03a('0x7'));var attributes=require(_0xb03a('0x8'));module[_0xb03a('0x9')]=function(_0x35cc34,_0x5bab10){return _0x35cc34['define'](_0xb03a('0xa'),attributes,{'tableName':_0xb03a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xb03a('0xc'),'hooks':{'beforeUpdate':function(_0x118eab,_0xc55cbf,_0x2b2ab8){if(_0x118eab['changed'](_0xb03a('0xd'))){_0x118eab['closedAt']=moment()[_0xb03a('0xe')](_0xb03a('0xf'));}_0x2b2ab8(null,_0x118eab);}}});}; \ No newline at end of file +var _0x6377=['utf8mb4_unicode_ci','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelInteraction.attributes','define','openchannel_interactions'];(function(_0x2e3b9d,_0x232e1f){var _0x8fae4f=function(_0x447b46){while(--_0x447b46){_0x2e3b9d['push'](_0x2e3b9d['shift']());}};_0x8fae4f(++_0x232e1f);}(_0x6377,0x112));var _0x7637=function(_0x3f03bb,_0x50247c){_0x3f03bb=_0x3f03bb-0x0;var _0x17199a=_0x6377[_0x3f03bb];return _0x17199a;};'use strict';var _=require('lodash');var util=require(_0x7637('0x0'));var logger=require(_0x7637('0x1'))(_0x7637('0x2'));var moment=require(_0x7637('0x3'));var BPromise=require(_0x7637('0x4'));var rp=require(_0x7637('0x5'));var fs=require('fs');var path=require(_0x7637('0x6'));var rimraf=require('rimraf');var config=require(_0x7637('0x7'));var attributes=require(_0x7637('0x8'));module['exports']=function(_0xa1176b,_0x18b7cd){return _0xa1176b[_0x7637('0x9')]('OpenchannelInteraction',attributes,{'tableName':_0x7637('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7637('0xb'),'hooks':{'beforeUpdate':function(_0x2db264,_0x3641b4,_0x39469e){if(_0x2db264['changed']('closed')){_0x2db264[_0x7637('0xc')]=moment()[_0x7637('0xd')](_0x7637('0xe'));}_0x39469e(null,_0x2db264);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 07667d7..5e61436 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 _0x89c0=['OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','options','raw','attributes','limit','info','AddTagsToOpenchannelInteraction','find','where','body','ids','AddTags','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then'];(function(_0x1f8148,_0x1fad95){var _0x25dc29=function(_0xac66bc){while(--_0xac66bc){_0x1f8148['push'](_0x1f8148['shift']());}};_0x25dc29(++_0x1fad95);}(_0x89c0,0xb1));var _0x089c=function(_0x489ab8,_0x321477){_0x489ab8=_0x489ab8-0x0;var _0x12927f=_0x89c0[_0x489ab8];return _0x12927f;};'use strict';var _=require(_0x089c('0x0'));var util=require('util');var moment=require(_0x089c('0x1'));var BPromise=require(_0x089c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x089c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x089c('0x4'));var logger=require(_0x089c('0x5'))(_0x089c('0x6'));var config=require(_0x089c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x089c('0x8')][_0x089c('0x9')]({'port':0x232a});config[_0x089c('0xa')]=_[_0x089c('0xb')](config[_0x089c('0xa')],{'host':_0x089c('0xc'),'port':0x18eb});var socket=require(_0x089c('0xd'))(new Redis(config[_0x089c('0xa')]));require(_0x089c('0xe'))[_0x089c('0xf')](socket);function respondWithRpcPromise(_0x110691,_0x13ee60,_0x5d63db){return new BPromise(function(_0x1f8c46,_0x31b3c3){return client[_0x089c('0x10')](_0x110691,_0x5d63db)[_0x089c('0x11')](function(_0x4968a4){logger['info'](_0x089c('0x12'),_0x13ee60,_0x089c('0x13'));logger[_0x089c('0x14')](_0x089c('0x15'),_0x13ee60,'request\x20sent',JSON[_0x089c('0x16')](_0x4968a4));if(_0x4968a4[_0x089c('0x17')]){if(_0x4968a4[_0x089c('0x17')]['code']===0x1f4){logger[_0x089c('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x13ee60,_0x4968a4[_0x089c('0x17')][_0x089c('0x18')]);return _0x31b3c3(_0x4968a4[_0x089c('0x17')][_0x089c('0x18')]);}logger[_0x089c('0x17')](_0x089c('0x12'),_0x13ee60,_0x4968a4[_0x089c('0x17')][_0x089c('0x18')]);return _0x1f8c46(_0x4968a4[_0x089c('0x17')]['message']);}else{logger['info'](_0x089c('0x12'),_0x13ee60,_0x089c('0x13'));_0x1f8c46(_0x4968a4['result']['message']);}})[_0x089c('0x19')](function(_0x457e4f){logger[_0x089c('0x17')](_0x089c('0x12'),_0x13ee60,_0x457e4f);_0x31b3c3(_0x457e4f);});});}exports[_0x089c('0x1a')]=function(_0x10d70a){var _0x1e42b1=this;return new Promise(function(_0x1449ea,_0x31c0b7){return db[_0x089c('0x1b')]['update'](_0x10d70a['body'],{'raw':_0x10d70a[_0x089c('0x1c')]?_0x10d70a['options'][_0x089c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10d70a[_0x089c('0x1c')]?_0x10d70a[_0x089c('0x1c')]['where']||null:null,'attributes':_0x10d70a[_0x089c('0x1c')]?_0x10d70a[_0x089c('0x1c')][_0x089c('0x1e')]||null:null,'limit':_0x10d70a[_0x089c('0x1c')]?_0x10d70a[_0x089c('0x1c')][_0x089c('0x1f')]||null:null})['then'](function(_0x1cdc86){logger[_0x089c('0x20')]('UpdateOpenchannelInteraction',_0x10d70a);logger[_0x089c('0x14')](_0x089c('0x1a'),_0x10d70a,JSON[_0x089c('0x16')](_0x1cdc86));_0x1449ea(_0x1cdc86);})['catch'](function(_0x41bfce){logger[_0x089c('0x17')](_0x089c('0x1a'),_0x41bfce[_0x089c('0x18')],_0x10d70a);_0x31c0b7(_0x1e42b1['error'](0x1f4,_0x41bfce[_0x089c('0x18')]));});});};exports[_0x089c('0x21')]=function(_0x4fbff9){return new Promise(function(_0x5bec14,_0x28977a){return db[_0x089c('0x1b')][_0x089c('0x22')]({'where':_0x4fbff9[_0x089c('0x1c')]?_0x4fbff9[_0x089c('0x1c')][_0x089c('0x23')]||null:null})[_0x089c('0x11')](function(_0x50aeee){if(_0x50aeee){return _0x50aeee['addTags'](_0x4fbff9[_0x089c('0x24')][_0x089c('0x25')],_['omit'](_0x4fbff9[_0x089c('0x24')],[_0x089c('0x25'),'id'])||{});}})['spread'](function(_0x237686){logger[_0x089c('0x20')](_0x089c('0x26'),_0x4fbff9);logger['debug'](_0x089c('0x26'),_0x4fbff9,JSON[_0x089c('0x16')](_0x237686));_0x5bec14(_0x237686);})[_0x089c('0x19')](function(_0x20da63){logger[_0x089c('0x17')](_0x089c('0x26'),_0x20da63[_0x089c('0x18')],_0x4fbff9);_0x28977a(_this[_0x089c('0x17')](0x1f4,_0x20da63['message']));});});}; \ No newline at end of file +var _0xe32b=['register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','update','body','options','raw','attributes','limit','AddTagsToOpenchannelInteraction','where','addTags','ids','omit','spread','AddTags','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','socket.io-emitter','./openchannelInteraction.socket'];(function(_0x4907de,_0x5bbdc6){var _0x482054=function(_0x39ecf6){while(--_0x39ecf6){_0x4907de['push'](_0x4907de['shift']());}};_0x482054(++_0x5bbdc6);}(_0xe32b,0x90));var _0xbe32=function(_0x155eb5,_0x4eb613){_0x155eb5=_0x155eb5-0x0;var _0x43c254=_0xe32b[_0x155eb5];return _0x43c254;};'use strict';var _=require('lodash');var util=require(_0xbe32('0x0'));var moment=require(_0xbe32('0x1'));var BPromise=require('bluebird');var rs=require(_0xbe32('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbe32('0x3'))['db'];var utils=require(_0xbe32('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe32('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xbe32('0x6')][_0xbe32('0x7')]({'port':0x232a});config[_0xbe32('0x8')]=_[_0xbe32('0x9')](config[_0xbe32('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xbe32('0xa'))(new Redis(config[_0xbe32('0x8')]));require(_0xbe32('0xb'))[_0xbe32('0xc')](socket);function respondWithRpcPromise(_0x8c6331,_0x22e5c2,_0x36d721){return new BPromise(function(_0x242c07,_0x9f949){return client[_0xbe32('0xd')](_0x8c6331,_0x36d721)[_0xbe32('0xe')](function(_0x3dde69){logger[_0xbe32('0xf')](_0xbe32('0x10'),_0x22e5c2,_0xbe32('0x11'));logger[_0xbe32('0x12')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x22e5c2,'request\x20sent',JSON[_0xbe32('0x13')](_0x3dde69));if(_0x3dde69[_0xbe32('0x14')]){if(_0x3dde69[_0xbe32('0x14')][_0xbe32('0x15')]===0x1f4){logger[_0xbe32('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x22e5c2,_0x3dde69[_0xbe32('0x14')][_0xbe32('0x16')]);return _0x9f949(_0x3dde69[_0xbe32('0x14')]['message']);}logger['error'](_0xbe32('0x10'),_0x22e5c2,_0x3dde69['error'][_0xbe32('0x16')]);return _0x242c07(_0x3dde69['error'][_0xbe32('0x16')]);}else{logger[_0xbe32('0xf')](_0xbe32('0x10'),_0x22e5c2,'request\x20sent');_0x242c07(_0x3dde69[_0xbe32('0x17')][_0xbe32('0x16')]);}})[_0xbe32('0x18')](function(_0x21713a){logger['error'](_0xbe32('0x10'),_0x22e5c2,_0x21713a);_0x9f949(_0x21713a);});});}exports[_0xbe32('0x19')]=function(_0x121864){var _0x20a368=this;return new Promise(function(_0x4d7ba3,_0x40a98a){return db['OpenchannelInteraction'][_0xbe32('0x1a')](_0x121864[_0xbe32('0x1b')],{'raw':_0x121864['options']?_0x121864[_0xbe32('0x1c')][_0xbe32('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x121864['options']?_0x121864['options']['where']||null:null,'attributes':_0x121864[_0xbe32('0x1c')]?_0x121864['options'][_0xbe32('0x1e')]||null:null,'limit':_0x121864[_0xbe32('0x1c')]?_0x121864[_0xbe32('0x1c')][_0xbe32('0x1f')]||null:null})[_0xbe32('0xe')](function(_0x17af8d){logger[_0xbe32('0xf')](_0xbe32('0x19'),_0x121864);logger[_0xbe32('0x12')]('UpdateOpenchannelInteraction',_0x121864,JSON['stringify'](_0x17af8d));_0x4d7ba3(_0x17af8d);})[_0xbe32('0x18')](function(_0x5a0217){logger[_0xbe32('0x14')]('UpdateOpenchannelInteraction',_0x5a0217[_0xbe32('0x16')],_0x121864);_0x40a98a(_0x20a368[_0xbe32('0x14')](0x1f4,_0x5a0217['message']));});});};exports[_0xbe32('0x20')]=function(_0x574588){return new Promise(function(_0x34782c,_0xe833f0){return db['OpenchannelInteraction']['find']({'where':_0x574588[_0xbe32('0x1c')]?_0x574588[_0xbe32('0x1c')][_0xbe32('0x21')]||null:null})[_0xbe32('0xe')](function(_0x17a599){if(_0x17a599){return _0x17a599[_0xbe32('0x22')](_0x574588[_0xbe32('0x1b')][_0xbe32('0x23')],_[_0xbe32('0x24')](_0x574588['body'],['ids','id'])||{});}})[_0xbe32('0x25')](function(_0x2d5eef){logger[_0xbe32('0xf')](_0xbe32('0x26'),_0x574588);logger[_0xbe32('0x12')]('AddTags',_0x574588,JSON['stringify'](_0x2d5eef));_0x34782c(_0x2d5eef);})['catch'](function(_0x2352c5){logger[_0xbe32('0x14')](_0xbe32('0x26'),_0x2352c5[_0xbe32('0x16')],_0x574588);_0xe833f0(_this['error'](0x1f4,_0x2352c5['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 0eb1e0e..80ee12c 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 _0x9beb=['emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','remove'];(function(_0x4b6830,_0x2bf6fb){var _0x239e4a=function(_0x364735){while(--_0x364735){_0x4b6830['push'](_0x4b6830['shift']());}};_0x239e4a(++_0x2bf6fb);}(_0x9beb,0x1ef));var _0xb9be=function(_0x440fcb,_0x2b3129){_0x440fcb=_0x440fcb-0x0;var _0x55823a=_0x9beb[_0x440fcb];return _0x55823a;};'use strict';var OpenchannelInteractionEvents=require(_0xb9be('0x0'));var events=['save',_0xb9be('0x1'),'update'];function createListener(_0x41c583,_0x278564){return function(_0xca20a4){_0x278564[_0xb9be('0x2')](_0x41c583,_0xca20a4);};}function removeListener(_0x473cc3,_0xb42a0c){return function(){OpenchannelInteractionEvents[_0xb9be('0x3')](_0x473cc3,_0xb42a0c);};}exports[_0xb9be('0x4')]=function(_0x1e45f0){for(var _0xe1ad5c=0x0,_0x13e095=events[_0xb9be('0x5')];_0xe1ad5c<_0x13e095;_0xe1ad5c++){var _0xf5c1a2=events[_0xe1ad5c];var _0xa64860=createListener(_0xb9be('0x6')+_0xf5c1a2,_0x1e45f0);OpenchannelInteractionEvents['on'](_0xf5c1a2,_0xa64860);}}; \ No newline at end of file +var _0x8395=['emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update'];(function(_0x545a69,_0x353dbd){var _0x219923=function(_0x355884){while(--_0x355884){_0x545a69['push'](_0x545a69['shift']());}};_0x219923(++_0x353dbd);}(_0x8395,0x191));var _0x5839=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x8395[_0x5f09c5];return _0x426ad9;};'use strict';var OpenchannelInteractionEvents=require(_0x5839('0x0'));var events=[_0x5839('0x1'),_0x5839('0x2'),_0x5839('0x3')];function createListener(_0x2233ae,_0x2df002){return function(_0x51ba23){_0x2df002[_0x5839('0x4')](_0x2233ae,_0x51ba23);};}function removeListener(_0x4e2d8f,_0x5e0563){return function(){OpenchannelInteractionEvents[_0x5839('0x5')](_0x4e2d8f,_0x5e0563);};}exports[_0x5839('0x6')]=function(_0x2e937f){for(var _0x5446d4=0x0,_0x4c4ff0=events[_0x5839('0x7')];_0x5446d4<_0x4c4ff0;_0x5446d4++){var _0x38ab33=events[_0x5446d4];var _0x51fda4=createListener(_0x5839('0x8')+_0x38ab33,_0x2e937f);OpenchannelInteractionEvents['on'](_0x38ab33,_0x51fda4);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 13086d0..140d05e 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(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_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 _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x2df523,_0x11b09e){var _0x43f919=function(_0x53c3d6){while(--_0x53c3d6){_0x2df523['push'](_0x2df523['shift']());}};_0x43f919(++_0x11b09e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x14d896,_0x53578b){_0x14d896=_0x14d896-0x0;var _0x28679a=_0xcb91[_0x14d896];return _0x28679a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index db64e81..a2f94fb 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 _0x3266=['out','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x44137c,_0x21e931){var _0x5cecf8=function(_0x6b63ca){while(--_0x6b63ca){_0x44137c['push'](_0x44137c['shift']());}};_0x5cecf8(++_0x21e931);}(_0x3266,0x6a));var _0x6326=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x3266[_0x5a9c0c];return _0x53c77d;};'use strict';var Sequelize=require(_0x6326('0x0'));module[_0x6326('0x1')]={'body':{'type':Sequelize[_0x6326('0x2')](_0x6326('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x6326('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x6326('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6326('0x5')]('in',_0x6326('0x6')),'defaultValue':_0x6326('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x6326('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x5ba3=['sequelize','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x5986e9,_0x4dd273){var _0xaa27d5=function(_0xaf5c41){while(--_0xaf5c41){_0x5986e9['push'](_0x5986e9['shift']());}};_0xaa27d5(++_0x4dd273);}(_0x5ba3,0x140));var _0x35ba=function(_0x5ea7eb,_0x2f1d71){_0x5ea7eb=_0x5ea7eb-0x0;var _0x30d511=_0x5ba3[_0x5ea7eb];return _0x30d511;};'use strict';var Sequelize=require(_0x35ba('0x0'));module['exports']={'body':{'type':Sequelize[_0x35ba('0x1')](_0x35ba('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x35ba('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x35ba('0x4')]('in',_0x35ba('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x35ba('0x6')]},'providerName':{'type':Sequelize[_0x35ba('0x7')]},'providerResponse':{'type':Sequelize[_0x35ba('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index a40207c..4f959c6 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 _0xf505=['socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','status','undefined','limit','count','offset','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','OpenchannelMessage','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','catch','describe','readAt','format','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','contact','fullname','internal','SIP/%s','channel','motionChannel','event','EventManager','openchannel-interactions','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','User','email','interface','rejectmessage','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost'];(function(_0x30a699,_0x5e1b6e){var _0x1ca8fc=function(_0x7c0875){while(--_0x7c0875){_0x30a699['push'](_0x30a699['shift']());}};_0x1ca8fc(++_0x5e1b6e);}(_0xf505,0x1e7));var _0x5f50=function(_0x438434,_0x36f21f){_0x438434=_0x438434-0x0;var _0x3b97c9=_0xf505[_0x438434];return _0x3b97c9;};'use strict';var emlformat=require(_0x5f50('0x0'));var rimraf=require(_0x5f50('0x1'));var zipdir=require(_0x5f50('0x2'));var jsonpatch=require(_0x5f50('0x3'));var rp=require(_0x5f50('0x4'));var moment=require(_0x5f50('0x5'));var BPromise=require(_0x5f50('0x6'));var Mustache=require(_0x5f50('0x7'));var util=require(_0x5f50('0x8'));var path=require(_0x5f50('0x9'));var sox=require(_0x5f50('0xa'));var csv=require(_0x5f50('0xb'));var ejs=require(_0x5f50('0xc'));var fs=require('fs');var fs_extra=require(_0x5f50('0xd'));var _=require(_0x5f50('0xe'));var squel=require(_0x5f50('0xf'));var crypto=require(_0x5f50('0x10'));var jsforce=require(_0x5f50('0x11'));var deskjs=require(_0x5f50('0x12'));var toCsv=require('to-csv');var querystring=require(_0x5f50('0x13'));var Papa=require(_0x5f50('0x14'));var Redis=require('ioredis');var authService=require(_0x5f50('0x15'));var qs=require(_0x5f50('0x16'));var as=require(_0x5f50('0x17'));var hardwareService=require(_0x5f50('0x18'));var logger=require(_0x5f50('0x19'))('api');var utils=require(_0x5f50('0x1a'));var config=require(_0x5f50('0x1b'));var licenseUtil=require(_0x5f50('0x1c'));var db=require(_0x5f50('0x1d'))['db'];config[_0x5f50('0x1e')]=_[_0x5f50('0x1f')](config[_0x5f50('0x1e')],{'host':_0x5f50('0x20'),'port':0x18eb});var socket=require(_0x5f50('0x21'))(new Redis(config[_0x5f50('0x1e')]));require(_0x5f50('0x22'))[_0x5f50('0x23')](socket);var jayson=require(_0x5f50('0x24'));var client=jayson[_0x5f50('0x25')][_0x5f50('0x26')]({'port':0x232c});var client9002=jayson['client'][_0x5f50('0x26')]({'port':0x232a});function respondWithRpcPromise(_0x5de282,_0x12041a,_0x5de208,_0x18fc13){return new BPromise(function(_0x39d68c,_0xcb2d41){var _0x6468f1=_0x18fc13||client;return _0x6468f1[_0x5f50('0x27')](_0x5de282,_0x5de208)[_0x5f50('0x28')](function(_0x252e02){logger[_0x5f50('0x29')](_0x5f50('0x2a'),_0x12041a,_0x5f50('0x2b'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x12041a,'request\x20sent',JSON[_0x5f50('0x2c')](_0x252e02));if(_0x252e02[_0x5f50('0x2d')]){if(_0x252e02[_0x5f50('0x2d')][_0x5f50('0x2e')]===0x1f4){logger['error'](_0x5f50('0x2a'),_0x12041a,_0x252e02[_0x5f50('0x2d')]['message']);return _0xcb2d41(_0x252e02[_0x5f50('0x2d')][_0x5f50('0x2f')]);}logger[_0x5f50('0x2d')](_0x5f50('0x2a'),_0x12041a,_0x252e02[_0x5f50('0x2d')][_0x5f50('0x2f')]);return _0x39d68c(_0x252e02[_0x5f50('0x2d')]['message']);}else{logger[_0x5f50('0x29')](_0x5f50('0x2a'),_0x12041a,'request\x20sent');_0x39d68c(_0x252e02['result'][_0x5f50('0x2f')]);}})['catch'](function(_0x87e68c){logger[_0x5f50('0x2d')](_0x5f50('0x2a'),_0x12041a,_0x87e68c);_0xcb2d41(_0x87e68c);});});}function respondWithStatusCode(_0x229bd2,_0x305120){_0x305120=_0x305120||0xcc;return function(_0x4a896a){if(_0x4a896a){return _0x229bd2['sendStatus'](_0x305120);}return _0x229bd2[_0x5f50('0x30')](_0x305120)['end']();};}function respondWithResult(_0x5d2be7,_0x2266e6){_0x2266e6=_0x2266e6||0xc8;return function(_0x5a878c){if(_0x5a878c){return _0x5d2be7[_0x5f50('0x30')](_0x2266e6)['json'](_0x5a878c);}};}function respondWithFilteredResult(_0x2cbdb8,_0x2c3c15){return function(_0x3bfc7b){if(_0x3bfc7b){var _0x59f881=typeof _0x2c3c15['offset']===_0x5f50('0x31')&&typeof _0x2c3c15[_0x5f50('0x32')]===_0x5f50('0x31');var _0x1eb4af=_0x3bfc7b[_0x5f50('0x33')];var _0xb0e6cf=_0x59f881?0x0:_0x2c3c15[_0x5f50('0x34')];var _0x59b053=_0x59f881?_0x3bfc7b[_0x5f50('0x33')]:_0x2c3c15['offset']+_0x2c3c15[_0x5f50('0x32')];var _0x2236e8;if(_0x59b053>=_0x1eb4af){_0x59b053=_0x1eb4af;_0x2236e8=0xc8;}else{_0x2236e8=0xce;}_0x2cbdb8[_0x5f50('0x30')](_0x2236e8);return _0x2cbdb8['set']('Content-Range',_0xb0e6cf+'-'+_0x59b053+'/'+_0x1eb4af)['json'](_0x3bfc7b);}return null;};}function patchUpdates(_0x5579e1){return function(_0x1f924f){try{jsonpatch[_0x5f50('0x35')](_0x1f924f,_0x5579e1,!![]);}catch(_0x56dff6){return BPromise[_0x5f50('0x36')](_0x56dff6);}return _0x1f924f[_0x5f50('0x37')]();};}function saveUpdates(_0x3faf18,_0x216c13){return function(_0x7aa40f){if(_0x7aa40f){return _0x7aa40f[_0x5f50('0x38')](_0x3faf18)[_0x5f50('0x28')](function(_0x4c7614){return _0x4c7614;});}return null;};}function removeEntity(_0x3b133d,_0x34d75d){return function(_0x3c3c37){if(_0x3c3c37){return _0x3c3c37[_0x5f50('0x39')]()[_0x5f50('0x28')](function(){_0x3b133d[_0x5f50('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a51f8,_0x177450){return function(_0x3e9a20){if(!_0x3e9a20){_0x3a51f8[_0x5f50('0x3a')](0x194);}return _0x3e9a20;};}function handleError(_0x4d6d18,_0x281e2c){_0x281e2c=_0x281e2c||0x1f4;return function(_0x340f81){logger[_0x5f50('0x2d')](_0x340f81[_0x5f50('0x3b')]);if(_0x340f81[_0x5f50('0x3c')]){delete _0x340f81[_0x5f50('0x3c')];}_0x4d6d18[_0x5f50('0x30')](_0x281e2c)[_0x5f50('0x3d')](_0x340f81);};}exports[_0x5f50('0x3e')]=function(_0x4042ce,_0x55cb0e){var _0x50d6cd={},_0x26a8c7={},_0x4a452={'count':0x0,'rows':[]};var _0xb388d5=_[_0x5f50('0x3f')](db[_0x5f50('0x40')]['rawAttributes'],function(_0x551ec2){return{'name':_0x551ec2['fieldName'],'type':_0x551ec2[_0x5f50('0x41')]['key']};});_0x26a8c7[_0x5f50('0x42')]=_[_0x5f50('0x3f')](_0xb388d5,_0x5f50('0x3c'));_0x26a8c7[_0x5f50('0x43')]=_[_0x5f50('0x44')](_0x4042ce[_0x5f50('0x43')]);_0x26a8c7[_0x5f50('0x45')]=_[_0x5f50('0x46')](_0x26a8c7['model'],_0x26a8c7[_0x5f50('0x43')]);_0x50d6cd[_0x5f50('0x47')]=_[_0x5f50('0x46')](_0x26a8c7['model'],qs[_0x5f50('0x48')](_0x4042ce['query'][_0x5f50('0x48')]));_0x50d6cd[_0x5f50('0x47')]=_0x50d6cd[_0x5f50('0x47')][_0x5f50('0x49')]?_0x50d6cd['attributes']:_0x26a8c7['model'];if(!_0x4042ce[_0x5f50('0x43')][_0x5f50('0x4a')](_0x5f50('0x4b'))){_0x50d6cd[_0x5f50('0x32')]=qs[_0x5f50('0x32')](_0x4042ce['query'][_0x5f50('0x32')]);_0x50d6cd[_0x5f50('0x34')]=qs['offset'](_0x4042ce[_0x5f50('0x43')]['offset']);}_0x50d6cd['order']=qs['sort'](_0x4042ce['query']['sort']);_0x50d6cd[_0x5f50('0x4c')]=qs['filters'](_[_0x5f50('0x4d')](_0x4042ce[_0x5f50('0x43')],_0x26a8c7['filters']),_0xb388d5);if(_0x4042ce[_0x5f50('0x43')][_0x5f50('0x4e')]){_0x50d6cd[_0x5f50('0x4c')]=_[_0x5f50('0x4f')](_0x50d6cd[_0x5f50('0x4c')],{'$or':_[_0x5f50('0x3f')](_0xb388d5,function(_0x300588){if(_0x300588['type']!==_0x5f50('0x50')){var _0x24f23c={};_0x24f23c[_0x300588[_0x5f50('0x3c')]]={'$like':'%'+_0x4042ce[_0x5f50('0x43')][_0x5f50('0x4e')]+'%'};return _0x24f23c;}})});}_0x50d6cd=_[_0x5f50('0x4f')]({},_0x50d6cd,_0x4042ce[_0x5f50('0x51')]);var _0x223a04={'where':_0x50d6cd[_0x5f50('0x4c')]};return db['OpenchannelMessage']['count'](_0x223a04)[_0x5f50('0x28')](function(_0x10f720){_0x4a452['count']=_0x10f720;if(_0x4042ce[_0x5f50('0x43')][_0x5f50('0x52')]){_0x50d6cd[_0x5f50('0x53')]=[{'all':!![]}];}return db[_0x5f50('0x40')][_0x5f50('0x54')](_0x50d6cd);})[_0x5f50('0x28')](function(_0x13b520){_0x4a452[_0x5f50('0x55')]=_0x13b520;return _0x4a452;})[_0x5f50('0x28')](respondWithFilteredResult(_0x55cb0e,_0x50d6cd))['catch'](handleError(_0x55cb0e,null));};exports[_0x5f50('0x56')]=function(_0xb8fc6b,_0x301c9c){var _0x54e772={'raw':!![],'where':{'id':_0xb8fc6b[_0x5f50('0x57')]['id']}},_0x33874f={};_0x33874f[_0x5f50('0x42')]=_[_0x5f50('0x44')](db[_0x5f50('0x40')][_0x5f50('0x58')]);_0x33874f[_0x5f50('0x43')]=_[_0x5f50('0x44')](_0xb8fc6b[_0x5f50('0x43')]);_0x33874f['filters']=_['intersection'](_0x33874f[_0x5f50('0x42')],_0x33874f[_0x5f50('0x43')]);_0x54e772[_0x5f50('0x47')]=_[_0x5f50('0x46')](_0x33874f[_0x5f50('0x42')],qs[_0x5f50('0x48')](_0xb8fc6b[_0x5f50('0x43')]['fields']));_0x54e772['attributes']=_0x54e772['attributes']['length']?_0x54e772[_0x5f50('0x47')]:_0x33874f[_0x5f50('0x42')];if(_0xb8fc6b[_0x5f50('0x43')][_0x5f50('0x52')]){_0x54e772[_0x5f50('0x53')]=[{'all':!![]}];}_0x54e772=_[_0x5f50('0x4f')]({},_0x54e772,_0xb8fc6b[_0x5f50('0x51')]);return db[_0x5f50('0x40')][_0x5f50('0x59')](_0x54e772)[_0x5f50('0x28')](handleEntityNotFound(_0x301c9c,null))[_0x5f50('0x28')](respondWithResult(_0x301c9c,null))['catch'](handleError(_0x301c9c,null));};exports[_0x5f50('0x5a')]=function(_0x4e0cbd,_0x5885f3){return db[_0x5f50('0x40')][_0x5f50('0x5a')](_0x4e0cbd[_0x5f50('0x5b')],{})['then'](respondWithResult(_0x5885f3,0xc9))[_0x5f50('0x5c')](handleError(_0x5885f3,null));};exports[_0x5f50('0x38')]=function(_0x2636a4,_0x54562c){if(_0x2636a4['body']['id']){delete _0x2636a4[_0x5f50('0x5b')]['id'];}return db[_0x5f50('0x40')][_0x5f50('0x59')]({'where':{'id':_0x2636a4[_0x5f50('0x57')]['id']}})['then'](handleEntityNotFound(_0x54562c,null))[_0x5f50('0x28')](saveUpdates(_0x2636a4[_0x5f50('0x5b')],null))[_0x5f50('0x28')](respondWithResult(_0x54562c,null))[_0x5f50('0x5c')](handleError(_0x54562c,null));};exports[_0x5f50('0x39')]=function(_0x1ef1c7,_0x28815e){return db['OpenchannelMessage'][_0x5f50('0x59')]({'where':{'id':_0x1ef1c7[_0x5f50('0x57')]['id']}})['then'](handleEntityNotFound(_0x28815e,null))['then'](removeEntity(_0x28815e,null))[_0x5f50('0x5c')](handleError(_0x28815e,null));};exports['describe']=function(_0x3cea45,_0x57f477){return db['OpenchannelMessage'][_0x5f50('0x5d')]()['then'](respondWithResult(_0x57f477,null))['catch'](handleError(_0x57f477,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports['accept']=function(_0xf504d3,_0x138ca2,_0x252201){var _0x148284={'agent':{},'channel':'openchannel'};if(_0xf504d3[_0x5f50('0x5b')]['id']){delete _0xf504d3[_0x5f50('0x5b')]['id'];}_0xf504d3['body']['read']=!![];_0xf504d3[_0x5f50('0x5b')][_0x5f50('0x5e')]=moment()[_0x5f50('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0xf504d3[_0x5f50('0x5b')][_0x5f50('0x60')]=_0xf504d3['body'][_0x5f50('0x60')]||_0xf504d3['user']['id'];_0x148284[_0x5f50('0x61')]['id']=_0xf504d3[_0x5f50('0x5b')][_0x5f50('0x60')];return db[_0x5f50('0x40')][_0x5f50('0x59')]({'where':{'id':_0xf504d3[_0x5f50('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x138ca2,null))[_0x5f50('0x28')](saveUpdates(_0xf504d3[_0x5f50('0x5b')],null))[_0x5f50('0x28')](function(_0x51b846){if(_0x51b846){_0x148284[_0x5f50('0x2f')]=_0x51b846[_0x5f50('0x62')]({'plain':!![]});return db[_0x5f50('0x63')][_0x5f50('0x59')]({'where':{'id':_0x51b846[_0x5f50('0x64')]}});}return null;})[_0x5f50('0x28')](handleEntityNotFound(_0x138ca2,null))[_0x5f50('0x28')](function(_0x1b02c1){if(_0x1b02c1){return _0x1b02c1[_0x5f50('0x38')]({'UserId':_0xf504d3[_0x5f50('0x5b')][_0x5f50('0x60')],'read1stAt':_['isNil'](_0x1b02c1[_0x5f50('0x65')])?moment()[_0x5f50('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x5f50('0x28')](function(_0x266586){if(_0x266586){_0x148284[_0x5f50('0x66')]=_0x266586[_0x5f50('0x62')]({'plain':!![]});interaction_log['info'](_0x5f50('0x67'),_0xf504d3[_0x5f50('0x68')]['id'],_0xf504d3[_0x5f50('0x68')]['name'],_0xf504d3[_0x5f50('0x68')][_0x5f50('0x69')],_0x148284['interaction']['id'],_0xf504d3[_0x5f50('0x5b')]?JSON[_0x5f50('0x2c')](_0xf504d3[_0x5f50('0x5b')]):_0x5f50('0x6a'));return respondWithRpcPromise(_0x5f50('0x6b'),_0x5f50('0x6c'),_0x148284);}return null;})[_0x5f50('0x28')](function(_0x5aee0e){var _0x94186f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5aee0e[_0x5f50('0x2f')][_0x5f50('0x6d')];return db[_0x5f50('0x6e')]['query'](_0x94186f,{'type':db[_0x5f50('0x6f')][_0x5f50('0x70')]['SELECT'],'raw':!![]})[_0x5f50('0x28')](function(_0x4830ef){return _0x4830ef;});})[_0x5f50('0x28')](function(_0x58d32e){if(_0x58d32e){_0x148284[_0x5f50('0x2f')][_0x5f50('0x71')]=_0x58d32e[0x0];if(!_0xf504d3['body'][_0x5f50('0x60')])return;return db['User'][_0x5f50('0x59')]({'where':{'id':_0xf504d3[_0x5f50('0x5b')]['UserId'],'role':_0x5f50('0x61')},'attributes':['id',_0x5f50('0x3c'),_0x5f50('0x72'),'email',_0x5f50('0x73')],'raw':!![]});}return null;})[_0x5f50('0x28')](function(_0x734f4b){if(!_0x734f4b)return null;_0x148284[_0x5f50('0x2f')]['agent']=_0x734f4b;return _0x148284;})[_0x5f50('0x28')](function(_0x3f0624){if(_0x3f0624){if(_0xf504d3[_0x5f50('0x5b')]['manual']){_0x148284[_0x5f50('0x2f')]['interface']=util[_0x5f50('0x5f')](_0x5f50('0x74'),_0xf504d3[_0x5f50('0x68')][_0x5f50('0x3c')]);_0x148284['message']['channel']=_0x148284[_0x5f50('0x75')];_0x148284[_0x5f50('0x2f')][_0x5f50('0x76')]=_0x148284['channel'];_0x148284[_0x5f50('0x2f')][_0x5f50('0x77')]='accept';return respondWithRpcPromise(_0x5f50('0x78'),'EventManager',{'event':'acceptmessage','message':_0x148284[_0x5f50('0x2f')]},client9002)[_0x5f50('0x28')](function(){return _0x148284;});}return _0x148284;}return null;})['then'](respondWithResult(_0x138ca2,null))[_0x5f50('0x5c')](handleError(_0x138ca2,null));};var interaction_log=require(_0x5f50('0x19'))(_0x5f50('0x79'));exports[_0x5f50('0x36')]=function(_0xe21222,_0x5900bf,_0x238623){var _0x136f84={'agent':{},'channel':_0x5f50('0x7a')};if(_0xe21222[_0x5f50('0x5b')]['id']){delete _0xe21222['body']['id'];}_0xe21222[_0x5f50('0x5b')]['UserId']=_0xe21222[_0x5f50('0x5b')][_0x5f50('0x60')]||_0xe21222[_0x5f50('0x68')]['id'];_0x136f84[_0x5f50('0x61')]['id']=_0xe21222[_0x5f50('0x5b')]['UserId'];return db[_0x5f50('0x40')][_0x5f50('0x59')]({'where':{'id':_0xe21222[_0x5f50('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5900bf,null))[_0x5f50('0x28')](function(_0x2cf908){if(_0x2cf908){_0x136f84['message']=_0x2cf908[_0x5f50('0x62')]({'plain':!![]});return db[_0x5f50('0x63')][_0x5f50('0x59')]({'where':{'id':_0x2cf908[_0x5f50('0x64')]}});}return null;})[_0x5f50('0x28')](handleEntityNotFound(_0x5900bf,null))[_0x5f50('0x28')](function(_0x531985){if(_0x531985){_0x136f84[_0x5f50('0x66')]=_0x531985[_0x5f50('0x62')]({'plain':!![]});interaction_log[_0x5f50('0x29')](_0x5f50('0x7b'),_0xe21222['user']['id'],_0xe21222[_0x5f50('0x68')][_0x5f50('0x3c')],_0xe21222[_0x5f50('0x68')][_0x5f50('0x69')],_0x136f84['interaction']['id'],_0xe21222[_0x5f50('0x5b')]?JSON[_0x5f50('0x2c')](_0xe21222[_0x5f50('0x5b')]):'null');return respondWithRpcPromise(_0x5f50('0x7c'),'rejectMessage',_0x136f84);}return null;})[_0x5f50('0x28')](function(_0x2f8b51){var _0x6d89b2=_0x5f50('0x7d')+_0x2f8b51['message']['ContactId'];return db[_0x5f50('0x6e')][_0x5f50('0x43')](_0x6d89b2,{'type':db[_0x5f50('0x6f')][_0x5f50('0x70')]['SELECT'],'raw':!![]})['then'](function(_0x177c86){return _0x177c86;});})['then'](function(_0x12d24a){if(_0x12d24a){_0x136f84['message'][_0x5f50('0x71')]=_0x12d24a[0x0];if(!_0xe21222['body'][_0x5f50('0x60')])return;return db[_0x5f50('0x7e')][_0x5f50('0x59')]({'where':{'id':_0xe21222['body'][_0x5f50('0x60')],'role':'agent'},'attributes':['id',_0x5f50('0x3c'),_0x5f50('0x72'),_0x5f50('0x7f'),_0x5f50('0x73')],'raw':!![]});}return null;})[_0x5f50('0x28')](function(_0xcebea){if(!_0xcebea)return null;_0x136f84['message'][_0x5f50('0x61')]=_0xcebea;return _0x136f84;})[_0x5f50('0x28')](function(_0x3abaf3){if(_0x3abaf3){_0x3abaf3[_0x5f50('0x2f')][_0x5f50('0x80')]=util['format'](_0x5f50('0x74'),_0xe21222['user'][_0x5f50('0x3c')]);_0x3abaf3[_0x5f50('0x2f')][_0x5f50('0x75')]=_0x136f84[_0x5f50('0x75')];_0x3abaf3['message']['motionChannel']=_0x136f84[_0x5f50('0x75')];_0x3abaf3['message'][_0x5f50('0x77')]=_0x5f50('0x36');respondWithRpcPromise(_0x5f50('0x78'),_0x5f50('0x78'),{'event':_0x5f50('0x81'),'message':_0x3abaf3[_0x5f50('0x2f')]},client9002);return _0x136f84;}return null;})[_0x5f50('0x28')](respondWithResult(_0x5900bf,null))[_0x5f50('0x5c')](handleError(_0x5900bf,null));}; \ No newline at end of file +var _0x7919=['http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','offset','limit','undefined','count','status','set','json','reject','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','OpenchannelMessage','includeAll','findAll','rows','show','length','find','create','body','params','describe','openchannel-interactions','accept','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','get','[OPENCHANNELMESSAGE: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','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','QueryTypes','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client'];(function(_0x4f9bfe,_0x45cfdf){var _0xadcb82=function(_0x3b7680){while(--_0x3b7680){_0x4f9bfe['push'](_0x4f9bfe['shift']());}};_0xadcb82(++_0x45cfdf);}(_0x7919,0xeb));var _0x9791=function(_0xc4551c,_0x2581f0){_0xc4551c=_0xc4551c-0x0;var _0x413dfc=_0x7919[_0xc4551c];return _0x413dfc;};'use strict';var emlformat=require(_0x9791('0x0'));var rimraf=require(_0x9791('0x1'));var zipdir=require(_0x9791('0x2'));var jsonpatch=require(_0x9791('0x3'));var rp=require(_0x9791('0x4'));var moment=require(_0x9791('0x5'));var BPromise=require(_0x9791('0x6'));var Mustache=require('mustache');var util=require(_0x9791('0x7'));var path=require(_0x9791('0x8'));var sox=require('sox');var csv=require(_0x9791('0x9'));var ejs=require(_0x9791('0xa'));var fs=require('fs');var fs_extra=require(_0x9791('0xb'));var _=require(_0x9791('0xc'));var squel=require(_0x9791('0xd'));var crypto=require('crypto');var jsforce=require(_0x9791('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9791('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9791('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9791('0x10'));var as=require(_0x9791('0x11'));var hardwareService=require(_0x9791('0x12'));var logger=require(_0x9791('0x13'))(_0x9791('0x14'));var utils=require(_0x9791('0x15'));var config=require(_0x9791('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9791('0x17'))['db'];config['redis']=_[_0x9791('0x18')](config[_0x9791('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x9791('0x1a'))(new Redis(config['redis']));require(_0x9791('0x1b'))[_0x9791('0x1c')](socket);var jayson=require(_0x9791('0x1d'));var client=jayson[_0x9791('0x1e')][_0x9791('0x1f')]({'port':0x232c});var client9002=jayson[_0x9791('0x1e')][_0x9791('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3e1eca,_0x1b3626,_0x263bf4,_0x43a07e){return new BPromise(function(_0xfc61ae,_0xe68a0a){var _0x566a69=_0x43a07e||client;return _0x566a69[_0x9791('0x20')](_0x3e1eca,_0x263bf4)[_0x9791('0x21')](function(_0x22b6fb){logger[_0x9791('0x22')](_0x9791('0x23'),_0x1b3626,'request\x20sent');logger[_0x9791('0x24')](_0x9791('0x25'),_0x1b3626,_0x9791('0x26'),JSON[_0x9791('0x27')](_0x22b6fb));if(_0x22b6fb[_0x9791('0x28')]){if(_0x22b6fb[_0x9791('0x28')][_0x9791('0x29')]===0x1f4){logger[_0x9791('0x28')](_0x9791('0x23'),_0x1b3626,_0x22b6fb[_0x9791('0x28')][_0x9791('0x2a')]);return _0xe68a0a(_0x22b6fb['error'][_0x9791('0x2a')]);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x1b3626,_0x22b6fb[_0x9791('0x28')][_0x9791('0x2a')]);return _0xfc61ae(_0x22b6fb['error'][_0x9791('0x2a')]);}else{logger[_0x9791('0x22')](_0x9791('0x23'),_0x1b3626,'request\x20sent');_0xfc61ae(_0x22b6fb[_0x9791('0x2b')][_0x9791('0x2a')]);}})[_0x9791('0x2c')](function(_0x4c3c00){logger[_0x9791('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x1b3626,_0x4c3c00);_0xe68a0a(_0x4c3c00);});});}function respondWithStatusCode(_0xc286ac,_0x15beb8){_0x15beb8=_0x15beb8||0xcc;return function(_0x50760e){if(_0x50760e){return _0xc286ac[_0x9791('0x2d')](_0x15beb8);}return _0xc286ac['status'](_0x15beb8)[_0x9791('0x2e')]();};}function respondWithResult(_0x545b9b,_0x3baa79){_0x3baa79=_0x3baa79||0xc8;return function(_0x38d348){if(_0x38d348){return _0x545b9b['status'](_0x3baa79)['json'](_0x38d348);}};}function respondWithFilteredResult(_0x55614a,_0x339932){return function(_0x228703){if(_0x228703){var _0x24bb84=typeof _0x339932[_0x9791('0x2f')]==='undefined'&&typeof _0x339932[_0x9791('0x30')]===_0x9791('0x31');var _0x52e9fd=_0x228703[_0x9791('0x32')];var _0x309e58=_0x24bb84?0x0:_0x339932[_0x9791('0x2f')];var _0x33bd3a=_0x24bb84?_0x228703[_0x9791('0x32')]:_0x339932[_0x9791('0x2f')]+_0x339932['limit'];var _0x26652e;if(_0x33bd3a>=_0x52e9fd){_0x33bd3a=_0x52e9fd;_0x26652e=0xc8;}else{_0x26652e=0xce;}_0x55614a[_0x9791('0x33')](_0x26652e);return _0x55614a[_0x9791('0x34')]('Content-Range',_0x309e58+'-'+_0x33bd3a+'/'+_0x52e9fd)[_0x9791('0x35')](_0x228703);}return null;};}function patchUpdates(_0x4eb36b){return function(_0x43ef6a){try{jsonpatch['apply'](_0x43ef6a,_0x4eb36b,!![]);}catch(_0x4c64ef){return BPromise[_0x9791('0x36')](_0x4c64ef);}return _0x43ef6a['save']();};}function saveUpdates(_0x436d00,_0x145e94){return function(_0x57cb8c){if(_0x57cb8c){return _0x57cb8c[_0x9791('0x37')](_0x436d00)[_0x9791('0x21')](function(_0xf852ac){return _0xf852ac;});}return null;};}function removeEntity(_0x5db559,_0x3cc803){return function(_0x1ff53c){if(_0x1ff53c){return _0x1ff53c[_0x9791('0x38')]()['then'](function(){_0x5db559[_0x9791('0x33')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c1f72,_0x5d1e88){return function(_0x1811b9){if(!_0x1811b9){_0x1c1f72[_0x9791('0x2d')](0x194);}return _0x1811b9;};}function handleError(_0x52effb,_0x430ed0){_0x430ed0=_0x430ed0||0x1f4;return function(_0x34f7ff){logger[_0x9791('0x28')](_0x34f7ff[_0x9791('0x39')]);if(_0x34f7ff[_0x9791('0x3a')]){delete _0x34f7ff['name'];}_0x52effb[_0x9791('0x33')](_0x430ed0)[_0x9791('0x3b')](_0x34f7ff);};}exports[_0x9791('0x3c')]=function(_0xf3a1be,_0x234bd9){var _0x32e6c5={},_0x205ff5={},_0x5443d8={'count':0x0,'rows':[]};var _0x263000=_[_0x9791('0x3d')](db['OpenchannelMessage'][_0x9791('0x3e')],function(_0x5ae670){return{'name':_0x5ae670[_0x9791('0x3f')],'type':_0x5ae670[_0x9791('0x40')]['key']};});_0x205ff5[_0x9791('0x41')]=_['map'](_0x263000,_0x9791('0x3a'));_0x205ff5['query']=_[_0x9791('0x42')](_0xf3a1be['query']);_0x205ff5['filters']=_[_0x9791('0x43')](_0x205ff5[_0x9791('0x41')],_0x205ff5['query']);_0x32e6c5['attributes']=_[_0x9791('0x43')](_0x205ff5[_0x9791('0x41')],qs['fields'](_0xf3a1be[_0x9791('0x44')][_0x9791('0x45')]));_0x32e6c5['attributes']=_0x32e6c5[_0x9791('0x46')]['length']?_0x32e6c5[_0x9791('0x46')]:_0x205ff5[_0x9791('0x41')];if(!_0xf3a1be['query'][_0x9791('0x47')](_0x9791('0x48'))){_0x32e6c5['limit']=qs['limit'](_0xf3a1be[_0x9791('0x44')][_0x9791('0x30')]);_0x32e6c5[_0x9791('0x2f')]=qs[_0x9791('0x2f')](_0xf3a1be[_0x9791('0x44')][_0x9791('0x2f')]);}_0x32e6c5[_0x9791('0x49')]=qs[_0x9791('0x4a')](_0xf3a1be[_0x9791('0x44')]['sort']);_0x32e6c5[_0x9791('0x4b')]=qs[_0x9791('0x4c')](_[_0x9791('0x4d')](_0xf3a1be[_0x9791('0x44')],_0x205ff5[_0x9791('0x4c')]),_0x263000);if(_0xf3a1be[_0x9791('0x44')][_0x9791('0x4e')]){_0x32e6c5['where']=_[_0x9791('0x4f')](_0x32e6c5[_0x9791('0x4b')],{'$or':_[_0x9791('0x3d')](_0x263000,function(_0x1a59d4){if(_0x1a59d4[_0x9791('0x40')]!==_0x9791('0x50')){var _0x3e45a3={};_0x3e45a3[_0x1a59d4[_0x9791('0x3a')]]={'$like':'%'+_0xf3a1be['query'][_0x9791('0x4e')]+'%'};return _0x3e45a3;}})});}_0x32e6c5=_[_0x9791('0x4f')]({},_0x32e6c5,_0xf3a1be[_0x9791('0x51')]);var _0x4714e6={'where':_0x32e6c5['where']};return db[_0x9791('0x52')][_0x9791('0x32')](_0x4714e6)[_0x9791('0x21')](function(_0x511695){_0x5443d8[_0x9791('0x32')]=_0x511695;if(_0xf3a1be['query'][_0x9791('0x53')]){_0x32e6c5['include']=[{'all':!![]}];}return db[_0x9791('0x52')][_0x9791('0x54')](_0x32e6c5);})[_0x9791('0x21')](function(_0x44d7f6){_0x5443d8[_0x9791('0x55')]=_0x44d7f6;return _0x5443d8;})[_0x9791('0x21')](respondWithFilteredResult(_0x234bd9,_0x32e6c5))['catch'](handleError(_0x234bd9,null));};exports[_0x9791('0x56')]=function(_0x1ea8a8,_0x483536){var _0x1cdb98={'raw':!![],'where':{'id':_0x1ea8a8['params']['id']}},_0x5882ed={};_0x5882ed[_0x9791('0x41')]=_[_0x9791('0x42')](db[_0x9791('0x52')][_0x9791('0x3e')]);_0x5882ed[_0x9791('0x44')]=_[_0x9791('0x42')](_0x1ea8a8[_0x9791('0x44')]);_0x5882ed[_0x9791('0x4c')]=_[_0x9791('0x43')](_0x5882ed[_0x9791('0x41')],_0x5882ed[_0x9791('0x44')]);_0x1cdb98[_0x9791('0x46')]=_[_0x9791('0x43')](_0x5882ed[_0x9791('0x41')],qs[_0x9791('0x45')](_0x1ea8a8['query']['fields']));_0x1cdb98[_0x9791('0x46')]=_0x1cdb98[_0x9791('0x46')][_0x9791('0x57')]?_0x1cdb98[_0x9791('0x46')]:_0x5882ed[_0x9791('0x41')];if(_0x1ea8a8[_0x9791('0x44')][_0x9791('0x53')]){_0x1cdb98['include']=[{'all':!![]}];}_0x1cdb98=_[_0x9791('0x4f')]({},_0x1cdb98,_0x1ea8a8[_0x9791('0x51')]);return db[_0x9791('0x52')][_0x9791('0x58')](_0x1cdb98)[_0x9791('0x21')](handleEntityNotFound(_0x483536,null))[_0x9791('0x21')](respondWithResult(_0x483536,null))[_0x9791('0x2c')](handleError(_0x483536,null));};exports[_0x9791('0x59')]=function(_0x4e879a,_0x3cf7c2){return db['OpenchannelMessage']['create'](_0x4e879a[_0x9791('0x5a')],{})['then'](respondWithResult(_0x3cf7c2,0xc9))[_0x9791('0x2c')](handleError(_0x3cf7c2,null));};exports[_0x9791('0x37')]=function(_0x180b91,_0x5033cc){if(_0x180b91[_0x9791('0x5a')]['id']){delete _0x180b91['body']['id'];}return db[_0x9791('0x52')][_0x9791('0x58')]({'where':{'id':_0x180b91[_0x9791('0x5b')]['id']}})[_0x9791('0x21')](handleEntityNotFound(_0x5033cc,null))[_0x9791('0x21')](saveUpdates(_0x180b91[_0x9791('0x5a')],null))[_0x9791('0x21')](respondWithResult(_0x5033cc,null))['catch'](handleError(_0x5033cc,null));};exports['destroy']=function(_0x1da2a0,_0x1908c9){return db['OpenchannelMessage']['find']({'where':{'id':_0x1da2a0[_0x9791('0x5b')]['id']}})[_0x9791('0x21')](handleEntityNotFound(_0x1908c9,null))[_0x9791('0x21')](removeEntity(_0x1908c9,null))[_0x9791('0x2c')](handleError(_0x1908c9,null));};exports['describe']=function(_0x83618d,_0x160aaa){return db[_0x9791('0x52')][_0x9791('0x5c')]()[_0x9791('0x21')](respondWithResult(_0x160aaa,null))[_0x9791('0x2c')](handleError(_0x160aaa,null));};var interaction_log=require('../../config/logger')(_0x9791('0x5d'));exports[_0x9791('0x5e')]=function(_0xd14a1d,_0x364575,_0x4fbddc){var _0x419716={'agent':{},'channel':_0x9791('0x5f')};if(_0xd14a1d[_0x9791('0x5a')]['id']){delete _0xd14a1d[_0x9791('0x5a')]['id'];}_0xd14a1d['body'][_0x9791('0x60')]=!![];_0xd14a1d[_0x9791('0x5a')]['readAt']=moment()[_0x9791('0x61')](_0x9791('0x62'));_0xd14a1d[_0x9791('0x5a')]['UserId']=_0xd14a1d[_0x9791('0x5a')][_0x9791('0x63')]||_0xd14a1d[_0x9791('0x64')]['id'];_0x419716['agent']['id']=_0xd14a1d[_0x9791('0x5a')][_0x9791('0x63')];return db[_0x9791('0x52')][_0x9791('0x58')]({'where':{'id':_0xd14a1d['params']['id'],'UserId':null}})[_0x9791('0x21')](handleEntityNotFound(_0x364575,null))['then'](saveUpdates(_0xd14a1d[_0x9791('0x5a')],null))['then'](function(_0x338d14){if(_0x338d14){_0x419716[_0x9791('0x2a')]=_0x338d14['get']({'plain':!![]});return db[_0x9791('0x65')][_0x9791('0x58')]({'where':{'id':_0x338d14[_0x9791('0x66')]}});}return null;})[_0x9791('0x21')](handleEntityNotFound(_0x364575,null))[_0x9791('0x21')](function(_0x1ac15c){if(_0x1ac15c){return _0x1ac15c[_0x9791('0x37')]({'UserId':_0xd14a1d[_0x9791('0x5a')]['UserId'],'read1stAt':_[_0x9791('0x67')](_0x1ac15c[_0x9791('0x68')])?moment()[_0x9791('0x61')](_0x9791('0x62')):undefined});}return null;})[_0x9791('0x21')](function(_0x3ec163){if(_0x3ec163){_0x419716[_0x9791('0x69')]=_0x3ec163[_0x9791('0x6a')]({'plain':!![]});interaction_log[_0x9791('0x22')](_0x9791('0x6b'),_0xd14a1d[_0x9791('0x64')]['id'],_0xd14a1d[_0x9791('0x64')][_0x9791('0x3a')],_0xd14a1d[_0x9791('0x64')][_0x9791('0x6c')],_0x419716[_0x9791('0x69')]['id'],_0xd14a1d[_0x9791('0x5a')]?JSON[_0x9791('0x27')](_0xd14a1d[_0x9791('0x5a')]):_0x9791('0x6d'));return respondWithRpcPromise(_0x9791('0x6e'),_0x9791('0x6f'),_0x419716);}return null;})[_0x9791('0x21')](function(_0x14fb20){var _0x4eb698=_0x9791('0x70')+_0x14fb20[_0x9791('0x2a')]['ContactId'];return db[_0x9791('0x71')][_0x9791('0x44')](_0x4eb698,{'type':db[_0x9791('0x72')]['QueryTypes'][_0x9791('0x73')],'raw':!![]})[_0x9791('0x21')](function(_0x1642c9){return _0x1642c9;});})['then'](function(_0x53ca97){if(_0x53ca97){_0x419716[_0x9791('0x2a')][_0x9791('0x74')]=_0x53ca97[0x0];if(!_0xd14a1d[_0x9791('0x5a')][_0x9791('0x63')])return;return db[_0x9791('0x75')][_0x9791('0x58')]({'where':{'id':_0xd14a1d['body'][_0x9791('0x63')],'role':_0x9791('0x76')},'attributes':['id',_0x9791('0x3a'),_0x9791('0x77'),_0x9791('0x78'),_0x9791('0x79')],'raw':!![]});}return null;})['then'](function(_0x58eae5){if(!_0x58eae5)return null;_0x419716[_0x9791('0x2a')][_0x9791('0x76')]=_0x58eae5;return _0x419716;})[_0x9791('0x21')](function(_0x82f01c){if(_0x82f01c){if(_0xd14a1d['body'][_0x9791('0x7a')]){_0x419716[_0x9791('0x2a')][_0x9791('0x7b')]=util['format'](_0x9791('0x7c'),_0xd14a1d[_0x9791('0x64')][_0x9791('0x3a')]);_0x419716[_0x9791('0x2a')][_0x9791('0x7d')]=_0x419716[_0x9791('0x7d')];_0x419716[_0x9791('0x2a')][_0x9791('0x7e')]=_0x419716[_0x9791('0x7d')];_0x419716['message'][_0x9791('0x7f')]=_0x9791('0x5e');return respondWithRpcPromise(_0x9791('0x80'),_0x9791('0x80'),{'event':_0x9791('0x81'),'message':_0x419716[_0x9791('0x2a')]},client9002)[_0x9791('0x21')](function(){return _0x419716;});}return _0x419716;}return null;})[_0x9791('0x21')](respondWithResult(_0x364575,null))['catch'](handleError(_0x364575,null));};var interaction_log=require(_0x9791('0x13'))(_0x9791('0x5d'));exports[_0x9791('0x36')]=function(_0x3e2ba3,_0x388d4f,_0x2db2e6){var _0x948f8c={'agent':{},'channel':_0x9791('0x5f')};if(_0x3e2ba3[_0x9791('0x5a')]['id']){delete _0x3e2ba3['body']['id'];}_0x3e2ba3['body'][_0x9791('0x63')]=_0x3e2ba3[_0x9791('0x5a')][_0x9791('0x63')]||_0x3e2ba3['user']['id'];_0x948f8c[_0x9791('0x76')]['id']=_0x3e2ba3[_0x9791('0x5a')][_0x9791('0x63')];return db[_0x9791('0x52')][_0x9791('0x58')]({'where':{'id':_0x3e2ba3['params']['id'],'UserId':null}})[_0x9791('0x21')](handleEntityNotFound(_0x388d4f,null))['then'](function(_0x242b63){if(_0x242b63){_0x948f8c[_0x9791('0x2a')]=_0x242b63[_0x9791('0x6a')]({'plain':!![]});return db[_0x9791('0x65')][_0x9791('0x58')]({'where':{'id':_0x242b63['OpenchannelInteractionId']}});}return null;})[_0x9791('0x21')](handleEntityNotFound(_0x388d4f,null))[_0x9791('0x21')](function(_0x569219){if(_0x569219){_0x948f8c[_0x9791('0x69')]=_0x569219[_0x9791('0x6a')]({'plain':!![]});interaction_log[_0x9791('0x22')](_0x9791('0x82'),_0x3e2ba3[_0x9791('0x64')]['id'],_0x3e2ba3[_0x9791('0x64')]['name'],_0x3e2ba3[_0x9791('0x64')][_0x9791('0x6c')],_0x948f8c[_0x9791('0x69')]['id'],_0x3e2ba3[_0x9791('0x5a')]?JSON[_0x9791('0x27')](_0x3e2ba3[_0x9791('0x5a')]):_0x9791('0x6d'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x948f8c);}return null;})[_0x9791('0x21')](function(_0x1a8b3b){var _0x4eaeba=_0x9791('0x70')+_0x1a8b3b[_0x9791('0x2a')]['ContactId'];return db[_0x9791('0x71')][_0x9791('0x44')](_0x4eaeba,{'type':db[_0x9791('0x72')][_0x9791('0x83')][_0x9791('0x73')],'raw':!![]})[_0x9791('0x21')](function(_0x2bb121){return _0x2bb121;});})[_0x9791('0x21')](function(_0x396710){if(_0x396710){_0x948f8c[_0x9791('0x2a')][_0x9791('0x74')]=_0x396710[0x0];if(!_0x3e2ba3[_0x9791('0x5a')][_0x9791('0x63')])return;return db[_0x9791('0x75')]['find']({'where':{'id':_0x3e2ba3['body'][_0x9791('0x63')],'role':_0x9791('0x76')},'attributes':['id','name','fullname',_0x9791('0x78'),_0x9791('0x79')],'raw':!![]});}return null;})[_0x9791('0x21')](function(_0x25b9b3){if(!_0x25b9b3)return null;_0x948f8c[_0x9791('0x2a')]['agent']=_0x25b9b3;return _0x948f8c;})[_0x9791('0x21')](function(_0x38cd20){if(_0x38cd20){_0x38cd20[_0x9791('0x2a')]['interface']=util[_0x9791('0x61')](_0x9791('0x7c'),_0x3e2ba3[_0x9791('0x64')][_0x9791('0x3a')]);_0x38cd20[_0x9791('0x2a')][_0x9791('0x7d')]=_0x948f8c['channel'];_0x38cd20[_0x9791('0x2a')][_0x9791('0x7e')]=_0x948f8c[_0x9791('0x7d')];_0x38cd20[_0x9791('0x2a')][_0x9791('0x7f')]='reject';respondWithRpcPromise(_0x9791('0x80'),_0x9791('0x80'),{'event':_0x9791('0x84'),'message':_0x38cd20['message']},client9002);return _0x948f8c;}return null;})[_0x9791('0x21')](respondWithResult(_0x388d4f,null))['catch'](handleError(_0x388d4f,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index f0f4875..5279f1d 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 _0xcdd8=['setMaxListeners','save','update','remove','hook','exports','../../mysqldb','OpenchannelMessage'];(function(_0x422f3e,_0x116ac9){var _0xe2de65=function(_0x28b26e){while(--_0x28b26e){_0x422f3e['push'](_0x422f3e['shift']());}};_0xe2de65(++_0x116ac9);}(_0xcdd8,0xa6));var _0x8cdd=function(_0x53aa6b,_0x34d29b){_0x53aa6b=_0x53aa6b-0x0;var _0x522155=_0xcdd8[_0x53aa6b];return _0x522155;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x8cdd('0x0'))['db'][_0x8cdd('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x8cdd('0x2')](0x0);var events={'afterCreate':_0x8cdd('0x3'),'afterUpdate':_0x8cdd('0x4'),'afterDestroy':_0x8cdd('0x5')};function emitEvent(_0x5670ec){return function(_0x107574,_0x699631,_0x49a11d){OpenchannelMessageEvents['emit'](_0x5670ec+':'+_0x107574['id'],_0x107574);OpenchannelMessageEvents['emit'](_0x5670ec,_0x107574);_0x49a11d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x8cdd('0x6')](e,emitEvent(event));}}module[_0x8cdd('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x523f=['events','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x523f,0x172));var _0xf523=function(_0x24255b,_0x2c3448){_0x24255b=_0x24255b-0x0;var _0x3b80c3=_0x523f[_0x24255b];return _0x3b80c3;};'use strict';var EventEmitter=require(_0xf523('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xf523('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xf523('0x2')](0x0);var events={'afterCreate':_0xf523('0x3'),'afterUpdate':_0xf523('0x4'),'afterDestroy':_0xf523('0x5')};function emitEvent(_0x5963e9){return function(_0xfb0a14,_0x416972,_0x3d7d88){OpenchannelMessageEvents[_0xf523('0x6')](_0x5963e9+':'+_0xfb0a14['id'],_0xfb0a14);OpenchannelMessageEvents[_0xf523('0x6')](_0x5963e9,_0xfb0a14);_0x3d7d88(null);};}for(var e in events){if(events[_0xf523('0x7')](e)){var event=events[e];OpenchannelMessage[_0xf523('0x8')](e,emitEvent(event));}}module[_0xf523('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index a264c0d..cd993fe 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 _0xed3c=['OpenchannelInteractionId','createdAt','catch','error','CmContact','describe','find','OpenchannelAccountId','Interactions','Contact','keys','then','get','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','omit','replyUri','GET','POST','body','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','update','OpenchannelMessage,\x20%s,\x20%s','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','./openchannelMessage.attributes','exports','fti_openchannel_messages','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne'];(function(_0x5b5eb4,_0x117c87){var _0x42af53=function(_0xdf6fcb){while(--_0xdf6fcb){_0x5b5eb4['push'](_0x5b5eb4['shift']());}};_0x42af53(++_0x117c87);}(_0xed3c,0x1a6));var _0xced3=function(_0x314b56,_0x292792){_0x314b56=_0x314b56-0x0;var _0x34e0d4=_0xed3c[_0x314b56];return _0x34e0d4;};'use strict';var _=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var logger=require(_0xced3('0x2'))(_0xced3('0x3'));var moment=require('moment');var BPromise=require(_0xced3('0x4'));var rp=require(_0xced3('0x5'));var fs=require('fs');var path=require(_0xced3('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xced3('0x7'));module[_0xced3('0x8')]=function(_0x2f92f8,_0x1cd694){return _0x2f92f8['define']('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xced3('0x9'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4be020,_0x19a727,_0x321c42){var _0x3e5a04=_0x2f92f8[_0xced3('0xa')];var _0x1cb639=_0x4be020['get']({'plain':!![]});if(_0x1cb639[_0xced3('0xb')][_0xced3('0xc')]()==='in'||_0x1cb639[_0xced3('0xb')]['toLowerCase']()===_0xced3('0xd')&&!_0x1cb639[_0xced3('0xe')]&&!_[_0xced3('0xf')](_0x1cb639[_0xced3('0x10')])){_0x3e5a04[_0xced3('0x11')][_0xced3('0x12')]({'where':{'id':_0x1cb639[_0xced3('0x13')]}})['then'](function(_0x65bb58){if(_0x65bb58){_0x65bb58['update']({'lastMsgAt':_0x1cb639[_0xced3('0x14')],'lastMsgDirection':_0x1cb639[_0xced3('0xb')][_0xced3('0xc')]()});}})[_0xced3('0x15')](function(_0x4dd4c3){console[_0xced3('0x16')](_0x4dd4c3);});}if(_0x1cb639[_0xced3('0xb')]==='out'&&!_0x1cb639[_0xced3('0xe')]){var _0x37e2d5;_0x3e5a04[_0xced3('0x17')][_0xced3('0x18')]()['then'](function(_0x4569af){return _0x3e5a04['OpenchannelAccount'][_0xced3('0x19')]({'where':{'id':_0x1cb639[_0xced3('0x1a')]},'include':[{'model':_0x3e5a04[_0xced3('0x11')],'as':_0xced3('0x1b'),'where':{'id':_0x1cb639[_0xced3('0x13')]},'limit':0x1,'include':[{'model':_0x3e5a04[_0xced3('0x17')],'as':_0xced3('0x1c'),'attributes':_[_0xced3('0x1d')](_0x4569af)}]}]});})[_0xced3('0x1e')](function(_0x17c011){_0x37e2d5=_0x17c011[_0xced3('0x1f')]({'plain':!![]});if(_0x37e2d5&&_0x37e2d5['replyUri']){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0xced3('0x20'),util[_0xced3('0x21')](_0xced3('0x22'),_0x1cb639['id'],_0x37e2d5['replyUri']));if(_0x37e2d5[_0xced3('0x1b')]&&_0x37e2d5[_0xced3('0x1b')]['length']){_0x1cb639['Interaction']=_[_0xced3('0x23')](_0x37e2d5[_0xced3('0x1b')][0x0],_0xced3('0x1c'));_0x1cb639[_0xced3('0x1c')]=_0x37e2d5['Interactions'][0x0][_0xced3('0x1c')];}var _0x19a727={'method':'POST','uri':encodeURI(_0x37e2d5[_0xced3('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x19a727['method']){case _0xced3('0x25'):_0x19a727['qs']=_0x1cb639;break;case _0xced3('0x26'):_0x19a727[_0xced3('0x27')]=_0x1cb639;break;}return rp(_0x19a727)[_0xced3('0x1e')](function(_0x2ec2c4){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0xced3('0x20'),util['format'](_0xced3('0x28'),_0x1cb639['id'],_0x37e2d5[_0xced3('0x24')]));if(_0x2ec2c4['body'][_0xced3('0x29')]&&_0x2ec2c4[_0xced3('0x27')][_0xced3('0x29')]!=_0x1cb639[_0xced3('0x2a')][_0xced3('0x29')]){return _0x3e5a04[_0xced3('0x11')][_0xced3('0x2b')]({'threadId':_0x2ec2c4[_0xced3('0x27')][_0xced3('0x29')]},{'logging':!![],'where':{'id':_0x1cb639['Interaction']['id']}});}else{return;}})[_0xced3('0x1e')](function(){return _0x4be020[_0xced3('0x2b')]({'read':!![]});})[_0xced3('0x15')](function(_0x5867af){logger[_0xced3('0x16')](_0xced3('0x2c'),_0xced3('0x20'),util[_0xced3('0x2d')](_0x5867af,{'showHidden':![],'depth':null}));_0x321c42();});}else{_0x321c42();}})[_0xced3('0x2e')](function(){_0x321c42();});}else{_0x321c42();}}},'charset':_0xced3('0x2f'),'collate':_0xced3('0x30')});}; \ No newline at end of file +var _0xf4f4=['Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','omit','POST','method','Message\x20%d\x20forwarded\x20to\x20%s','Interaction','threadId','error','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','update','createdAt','catch','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId'];(function(_0x400bb8,_0x5cf890){var _0x37e539=function(_0x1d3cc5){while(--_0x1d3cc5){_0x400bb8['push'](_0x400bb8['shift']());}};_0x37e539(++_0x5cf890);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x19bf5f,_0x1ca6b9){_0x19bf5f=_0x19bf5f-0x0;var _0x237efa=_0xf4f4[_0x19bf5f];return _0x237efa;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var logger=require('../../config/logger')(_0x4f4f('0x2'));var moment=require(_0x4f4f('0x3'));var BPromise=require(_0x4f4f('0x4'));var rp=require(_0x4f4f('0x5'));var fs=require('fs');var path=require(_0x4f4f('0x6'));var rimraf=require('rimraf');var config=require(_0x4f4f('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0x4f4f('0x8')]=function(_0x132d5c,_0x20ee6e){return _0x132d5c[_0x4f4f('0x9')](_0x4f4f('0xa'),attributes,{'tableName':_0x4f4f('0xb'),'paranoid':![],'indexes':[{'name':_0x4f4f('0xc'),'fields':[_0x4f4f('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xc066a4,_0x38d110,_0x39e36b){var _0x2d86d1=_0x132d5c[_0x4f4f('0xe')];var _0x11940f=_0xc066a4[_0x4f4f('0xf')]({'plain':!![]});if(_0x11940f[_0x4f4f('0x10')]['toLowerCase']()==='in'||_0x11940f['direction'][_0x4f4f('0x11')]()===_0x4f4f('0x12')&&!_0x11940f[_0x4f4f('0x13')]&&!_[_0x4f4f('0x14')](_0x11940f[_0x4f4f('0x15')])){_0x2d86d1[_0x4f4f('0x16')]['findOne']({'where':{'id':_0x11940f[_0x4f4f('0x17')]}})['then'](function(_0x216ba8){if(_0x216ba8){_0x216ba8[_0x4f4f('0x18')]({'lastMsgAt':_0x11940f[_0x4f4f('0x19')],'lastMsgDirection':_0x11940f[_0x4f4f('0x10')]['toLowerCase']()});}})[_0x4f4f('0x1a')](function(_0x4c68f4){console['error'](_0x4c68f4);});}if(_0x11940f['direction']===_0x4f4f('0x12')&&!_0x11940f[_0x4f4f('0x13')]){var _0x2d21ed;_0x2d86d1[_0x4f4f('0x1b')][_0x4f4f('0x1c')]()[_0x4f4f('0x1d')](function(_0x1245c4){return _0x2d86d1[_0x4f4f('0x1e')][_0x4f4f('0x1f')]({'where':{'id':_0x11940f[_0x4f4f('0x20')]},'include':[{'model':_0x2d86d1[_0x4f4f('0x16')],'as':_0x4f4f('0x21'),'where':{'id':_0x11940f['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x2d86d1[_0x4f4f('0x1b')],'as':_0x4f4f('0x22'),'attributes':_[_0x4f4f('0x23')](_0x1245c4)}]}]});})[_0x4f4f('0x1d')](function(_0x302a79){_0x2d21ed=_0x302a79[_0x4f4f('0xf')]({'plain':!![]});if(_0x2d21ed&&_0x2d21ed[_0x4f4f('0x24')]){logger[_0x4f4f('0x25')](_0x4f4f('0x26'),_0x4f4f('0x27'),util[_0x4f4f('0x28')](_0x4f4f('0x29'),_0x11940f['id'],_0x2d21ed[_0x4f4f('0x24')]));if(_0x2d21ed[_0x4f4f('0x21')]&&_0x2d21ed['Interactions']['length']){_0x11940f['Interaction']=_[_0x4f4f('0x2a')](_0x2d21ed[_0x4f4f('0x21')][0x0],'Contact');_0x11940f[_0x4f4f('0x22')]=_0x2d21ed[_0x4f4f('0x21')][0x0][_0x4f4f('0x22')];}var _0x38d110={'method':_0x4f4f('0x2b'),'uri':encodeURI(_0x2d21ed[_0x4f4f('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x38d110[_0x4f4f('0x2c')]){case'GET':_0x38d110['qs']=_0x11940f;break;case _0x4f4f('0x2b'):_0x38d110[_0x4f4f('0xd')]=_0x11940f;break;}return rp(_0x38d110)[_0x4f4f('0x1d')](function(_0x15c79c){logger[_0x4f4f('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x4f4f('0x27'),util[_0x4f4f('0x28')](_0x4f4f('0x2d'),_0x11940f['id'],_0x2d21ed['replyUri']));if(_0x15c79c['body']['threadId']&&_0x15c79c[_0x4f4f('0xd')]['threadId']!=_0x11940f[_0x4f4f('0x2e')][_0x4f4f('0x2f')]){return _0x2d86d1[_0x4f4f('0x16')]['update']({'threadId':_0x15c79c[_0x4f4f('0xd')][_0x4f4f('0x2f')]},{'logging':!![],'where':{'id':_0x11940f['Interaction']['id']}});}else{return;}})[_0x4f4f('0x1d')](function(){return _0xc066a4[_0x4f4f('0x18')]({'read':!![]});})[_0x4f4f('0x1a')](function(_0x5b937e){logger[_0x4f4f('0x30')](_0x4f4f('0x26'),'afterCreate',util['inspect'](_0x5b937e,{'showHidden':![],'depth':null}));_0x39e36b();});}else{_0x39e36b();}})[_0x4f4f('0x31')](function(){_0x39e36b();});}else{_0x39e36b();}}},'charset':_0x4f4f('0x32'),'collate':_0x4f4f('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index e3cccc2..f9cf1c0 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 _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x286900,_0x21dcba){var _0xb8f84a=function(_0x49bdea){while(--_0x49bdea){_0x286900['push'](_0x286900['shift']());}};_0xb8f84a(++_0x21dcba);}(_0x7a54,0x106));var _0x47a5=function(_0x5b7732,_0x59e3c2){_0x5b7732=_0x5b7732-0x0;var _0x1ac427=_0x7a54[_0x5b7732];return _0x1ac427;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file +var _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x545a86,_0x278f09){var _0x10bcc6=function(_0x2ce788){while(--_0x2ce788){_0x545a86['push'](_0x545a86['shift']());}};_0x10bcc6(++_0x278f09);}(_0x2ef3,0xba));var _0x32ef=function(_0x18c187,_0x50a968){_0x18c187=_0x18c187-0x0;var _0x5351e2=_0x2ef3[_0x18c187];return _0x5351e2;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index ed3586b..f5d3d7c 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 _0x242e=['emit','removeListener','openchannelMessage:','./openchannelMessage.events','remove','update'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x242e,0x12f));var _0xe242=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x242e[_0x502c7d];return _0x30b7ed;};'use strict';var OpenchannelMessageEvents=require(_0xe242('0x0'));var events=['save',_0xe242('0x1'),_0xe242('0x2')];function createListener(_0x5a24a7,_0x579440){return function(_0xf85009){_0x579440[_0xe242('0x3')](_0x5a24a7,_0xf85009);};}function removeListener(_0x35be65,_0x1da0f6){return function(){OpenchannelMessageEvents[_0xe242('0x4')](_0x35be65,_0x1da0f6);};}exports['register']=function(_0x53fdde){for(var _0x362bb0=0x0,_0x44a5a7=events['length'];_0x362bb0<_0x44a5a7;_0x362bb0++){var _0x28385b=events[_0x362bb0];var _0x1a4c05=createListener(_0xe242('0x5')+_0x28385b,_0x53fdde);OpenchannelMessageEvents['on'](_0x28385b,_0x1a4c05);}}; \ No newline at end of file +var _0x7e02=['openchannelMessage:','./openchannelMessage.events','save','remove','update','register','length'];(function(_0x2f227c,_0x360c3a){var _0x5032bc=function(_0x824bb){while(--_0x824bb){_0x2f227c['push'](_0x2f227c['shift']());}};_0x5032bc(++_0x360c3a);}(_0x7e02,0x71));var _0x27e0=function(_0x141c01,_0x1556f0){_0x141c01=_0x141c01-0x0;var _0x49e963=_0x7e02[_0x141c01];return _0x49e963;};'use strict';var OpenchannelMessageEvents=require(_0x27e0('0x0'));var events=[_0x27e0('0x1'),_0x27e0('0x2'),_0x27e0('0x3')];function createListener(_0x6daf9e,_0x3bfa3b){return function(_0x310a36){_0x3bfa3b['emit'](_0x6daf9e,_0x310a36);};}function removeListener(_0x4fa613,_0x3d4f41){return function(){OpenchannelMessageEvents['removeListener'](_0x4fa613,_0x3d4f41);};}exports[_0x27e0('0x4')]=function(_0x1f98c5){for(var _0x3ddcd2=0x0,_0x1cc944=events[_0x27e0('0x5')];_0x3ddcd2<_0x1cc944;_0x3ddcd2++){var _0x2dff51=events[_0x3ddcd2];var _0x44ae54=createListener(_0x27e0('0x6')+_0x2dff51,_0x1f98c5);OpenchannelMessageEvents['on'](_0x2dff51,_0x44ae54);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index ccab6c3..54ef033 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 _0x920e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','/describe','describe','get','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addAgents','put','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout'];(function(_0x23c937,_0x3a2762){var _0x171edc=function(_0x200237){while(--_0x200237){_0x23c937['push'](_0x23c937['shift']());}};_0x171edc(++_0x3a2762);}(_0x920e,0x1ae));var _0xe920=function(_0x42645f,_0x4c37db){_0x42645f=_0x42645f-0x0;var _0x1134a1=_0x920e[_0x42645f];return _0x1134a1;};'use strict';var multer=require(_0xe920('0x0'));var util=require(_0xe920('0x1'));var path=require(_0xe920('0x2'));var timeout=require(_0xe920('0x3'));var express=require(_0xe920('0x4'));var router=express[_0xe920('0x5')]();var fs_extra=require(_0xe920('0x6'));var auth=require(_0xe920('0x7'));var interaction=require(_0xe920('0x8'));var config=require(_0xe920('0x9'));var controller=require(_0xe920('0xa'));router['get']('/',auth[_0xe920('0xb')](),controller[_0xe920('0xc')]);router['get'](_0xe920('0xd'),auth['isAuthenticated'](),controller[_0xe920('0xe')]);router[_0xe920('0xf')](_0xe920('0x10'),auth[_0xe920('0xb')](),controller['show']);router['get'](_0xe920('0x11'),auth['isAuthenticated'](),controller[_0xe920('0x12')]);router[_0xe920('0xf')]('/:id/teams',auth[_0xe920('0xb')](),controller[_0xe920('0x13')]);router[_0xe920('0xf')](_0xe920('0x14'),auth[_0xe920('0xb')](),controller[_0xe920('0x15')]);router[_0xe920('0x16')]('/',auth[_0xe920('0xb')](),controller[_0xe920('0x17')]);router['post'](_0xe920('0x18'),auth[_0xe920('0xb')](),controller['addTeams']);router[_0xe920('0x16')](_0xe920('0x14'),auth[_0xe920('0xb')](),controller[_0xe920('0x19')]);router[_0xe920('0x1a')](_0xe920('0x10'),auth[_0xe920('0xb')](),controller['update']);router[_0xe920('0x1b')](_0xe920('0x10'),auth[_0xe920('0xb')](),controller[_0xe920('0x1c')]);router[_0xe920('0x1b')]('/:id/teams',auth[_0xe920('0xb')](),controller[_0xe920('0x1d')]);router[_0xe920('0x1b')](_0xe920('0x14'),auth[_0xe920('0xb')](),controller[_0xe920('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xb337=['addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','/:id','/:id/members','getTeams','getAgents','create','post','/:id/teams'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb337,0x10a));var _0x7b33=function(_0x32568f,_0x5d6028){_0x32568f=_0x32568f-0x0;var _0x45acee=_0xb337[_0x32568f];return _0x45acee;};'use strict';var multer=require(_0x7b33('0x0'));var util=require(_0x7b33('0x1'));var path=require(_0x7b33('0x2'));var timeout=require(_0x7b33('0x3'));var express=require(_0x7b33('0x4'));var router=express[_0x7b33('0x5')]();var fs_extra=require(_0x7b33('0x6'));var auth=require(_0x7b33('0x7'));var interaction=require(_0x7b33('0x8'));var config=require(_0x7b33('0x9'));var controller=require(_0x7b33('0xa'));router[_0x7b33('0xb')]('/',auth[_0x7b33('0xc')](),controller[_0x7b33('0xd')]);router['get'](_0x7b33('0xe'),auth[_0x7b33('0xc')](),controller['describe']);router[_0x7b33('0xb')](_0x7b33('0xf'),auth[_0x7b33('0xc')](),controller['show']);router[_0x7b33('0xb')](_0x7b33('0x10'),auth[_0x7b33('0xc')](),controller['getMembers']);router[_0x7b33('0xb')]('/:id/teams',auth[_0x7b33('0xc')](),controller[_0x7b33('0x11')]);router[_0x7b33('0xb')]('/:id/users',auth[_0x7b33('0xc')](),controller[_0x7b33('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7b33('0x13')]);router[_0x7b33('0x14')](_0x7b33('0x15'),auth['isAuthenticated'](),controller[_0x7b33('0x16')]);router[_0x7b33('0x14')](_0x7b33('0x17'),auth['isAuthenticated'](),controller[_0x7b33('0x18')]);router[_0x7b33('0x19')](_0x7b33('0xf'),auth[_0x7b33('0xc')](),controller[_0x7b33('0x1a')]);router[_0x7b33('0x1b')](_0x7b33('0xf'),auth[_0x7b33('0xc')](),controller[_0x7b33('0x1c')]);router[_0x7b33('0x1b')](_0x7b33('0x15'),auth[_0x7b33('0xc')](),controller[_0x7b33('0x1d')]);router[_0x7b33('0x1b')](_0x7b33('0x17'),auth[_0x7b33('0xc')](),controller[_0x7b33('0x1e')]);module[_0x7b33('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index e129c05..d412824 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 _0xf056=['STRING','INTEGER','ENUM','beepall','roundrobin','name'];(function(_0x37d63b,_0x2f9b41){var _0x57b5b6=function(_0x3030a9){while(--_0x3030a9){_0x37d63b['push'](_0x37d63b['shift']());}};_0x57b5b6(++_0x2f9b41);}(_0xf056,0x173));var _0x6f05=function(_0x3ef637,_0x17becb){_0x3ef637=_0x3ef637-0x0;var _0xa89d87=_0xf056[_0x3ef637];return _0xa89d87;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x6f05('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6f05('0x1')]},'timeout':{'type':Sequelize[_0x6f05('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6f05('0x3')]('rrmemory',_0x6f05('0x4'),_0x6f05('0x5'))}}; \ No newline at end of file +var _0xcad4=['rrmemory','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x58b900,_0x4067f4){var _0x142565=function(_0x475ac2){while(--_0x475ac2){_0x58b900['push'](_0x58b900['shift']());}};_0x142565(++_0x4067f4);}(_0xcad4,0x13c));var _0x4cad=function(_0x1a6d4e,_0x5cdbde){_0x1a6d4e=_0x1a6d4e-0x0;var _0x582cf4=_0xcad4[_0x1a6d4e];return _0x582cf4;};'use strict';var Sequelize=require(_0x4cad('0x0'));module[_0x4cad('0x1')]={'name':{'type':Sequelize[_0x4cad('0x2')],'unique':_0x4cad('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4cad('0x2')]},'timeout':{'type':Sequelize[_0x4cad('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4cad('0x5')](_0x4cad('0x6'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 8b7f428..3bf7c1b 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 _0x1520=['each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','union','compact','value','isEmpty','removeAgents','addAgents','spread','isArray','userOpenchannelQueue:remove','User','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','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/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','set','json','reject','OpenchannelQueues','UserProfileResource','then','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','OpenchannelQueue','findAll','rows','catch','show','params','length','find','create','body','user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','describe','getMembers','findOne','UserOpenchannelQueue','pick','OpenchannelQueueId','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','openchannelPause','getTeams','addTeams','ids','Team','Agents','online','transaction'];(function(_0x50859e,_0x2c958a){var _0x5847a2=function(_0x265a30){while(--_0x265a30){_0x50859e['push'](_0x50859e['shift']());}};_0x5847a2(++_0x2c958a);}(_0x1520,0xae));var _0x0152=function(_0x1b5e1f,_0x2ffd90){_0x1b5e1f=_0x1b5e1f-0x0;var _0x2b09bc=_0x1520[_0x1b5e1f];return _0x2b09bc;};'use strict';var emlformat=require(_0x0152('0x0'));var rimraf=require(_0x0152('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0152('0x2'));var rp=require(_0x0152('0x3'));var moment=require(_0x0152('0x4'));var BPromise=require(_0x0152('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0152('0x6'));var sox=require(_0x0152('0x7'));var csv=require('to-csv');var ejs=require(_0x0152('0x8'));var fs=require('fs');var fs_extra=require(_0x0152('0x9'));var _=require('lodash');var squel=require(_0x0152('0xa'));var crypto=require(_0x0152('0xb'));var jsforce=require(_0x0152('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0152('0xd'));var Papa=require(_0x0152('0xe'));var Redis=require(_0x0152('0xf'));var authService=require(_0x0152('0x10'));var qs=require(_0x0152('0x11'));var as=require(_0x0152('0x12'));var hardwareService=require(_0x0152('0x13'));var logger=require(_0x0152('0x14'))(_0x0152('0x15'));var utils=require(_0x0152('0x16'));var config=require(_0x0152('0x17'));var licenseUtil=require(_0x0152('0x18'));var db=require(_0x0152('0x19'))['db'];config[_0x0152('0x1a')]=_[_0x0152('0x1b')](config[_0x0152('0x1a')],{'host':_0x0152('0x1c'),'port':0x18eb});var socket=require(_0x0152('0x1d'))(new Redis(config[_0x0152('0x1a')]));require('./openchannelQueue.socket')[_0x0152('0x1e')](socket);function respondWithStatusCode(_0x6bb70a,_0x3315c4){_0x3315c4=_0x3315c4||0xcc;return function(_0x51eeb8){if(_0x51eeb8){return _0x6bb70a[_0x0152('0x1f')](_0x3315c4);}return _0x6bb70a[_0x0152('0x20')](_0x3315c4)[_0x0152('0x21')]();};}function respondWithResult(_0x25a8d3,_0x142ed5){_0x142ed5=_0x142ed5||0xc8;return function(_0x10534b){if(_0x10534b){return _0x25a8d3[_0x0152('0x20')](_0x142ed5)['json'](_0x10534b);}};}function respondWithFilteredResult(_0xaabe86,_0x4faf2b){return function(_0x3d6023){if(_0x3d6023){var _0x324ce1=typeof _0x4faf2b[_0x0152('0x22')]===_0x0152('0x23')&&typeof _0x4faf2b['limit']===_0x0152('0x23');var _0x2c5a5d=_0x3d6023[_0x0152('0x24')];var _0x2cc1fe=_0x324ce1?0x0:_0x4faf2b[_0x0152('0x22')];var _0x1d0ff4=_0x324ce1?_0x3d6023[_0x0152('0x24')]:_0x4faf2b[_0x0152('0x22')]+_0x4faf2b['limit'];var _0x1f7f67;if(_0x1d0ff4>=_0x2c5a5d){_0x1d0ff4=_0x2c5a5d;_0x1f7f67=0xc8;}else{_0x1f7f67=0xce;}_0xaabe86[_0x0152('0x20')](_0x1f7f67);return _0xaabe86[_0x0152('0x25')]('Content-Range',_0x2cc1fe+'-'+_0x1d0ff4+'/'+_0x2c5a5d)[_0x0152('0x26')](_0x3d6023);}return null;};}function patchUpdates(_0x170151){return function(_0xd6bb4e){try{jsonpatch['apply'](_0xd6bb4e,_0x170151,!![]);}catch(_0x49d2d1){return BPromise[_0x0152('0x27')](_0x49d2d1);}return _0xd6bb4e['save']();};}function saveUpdates(_0x8ce386,_0x534693){return function(_0x11d0db){if(_0x11d0db){return _0x11d0db['update'](_0x8ce386)['then'](function(_0x574efa){return _0x574efa;});}return null;};}function removeEntity(_0xaefbc9,_0x27f35b){return function(_0x2ee94f){if(_0x2ee94f){return _0x2ee94f['destroy']()['then'](function(){var _0xf01427=_0x2ee94f['get']({'plain':!![]});var _0x1df8eb=_0x0152('0x28');return db[_0x0152('0x29')]['destroy']({'where':{'type':_0x1df8eb,'resourceId':_0xf01427['id']}})[_0x0152('0x2a')](function(){return _0x2ee94f;});})['then'](function(){_0xaefbc9[_0x0152('0x20')](0xcc)[_0x0152('0x21')]();});}};}function handleEntityNotFound(_0x184b28,_0x1d76eb){return function(_0x4cd315){if(!_0x4cd315){_0x184b28['sendStatus'](0x194);}return _0x4cd315;};}function handleError(_0xc260dd,_0x3a80d2){_0x3a80d2=_0x3a80d2||0x1f4;return function(_0x34a052){logger['error'](_0x34a052['stack']);if(_0x34a052['name']){delete _0x34a052[_0x0152('0x2b')];}_0xc260dd[_0x0152('0x20')](_0x3a80d2)['send'](_0x34a052);};}exports[_0x0152('0x2c')]=function(_0x4af1ce,_0x435c8e){var _0x26c4c0={},_0x1e0fc8={},_0x5e05a3={'count':0x0,'rows':[]};var _0x1e7c36=_[_0x0152('0x2d')](db['OpenchannelQueue'][_0x0152('0x2e')],function(_0x1bd419){return{'name':_0x1bd419[_0x0152('0x2f')],'type':_0x1bd419[_0x0152('0x30')][_0x0152('0x31')]};});_0x1e0fc8[_0x0152('0x32')]=_[_0x0152('0x2d')](_0x1e7c36,_0x0152('0x2b'));_0x1e0fc8[_0x0152('0x33')]=_[_0x0152('0x34')](_0x4af1ce[_0x0152('0x33')]);_0x1e0fc8[_0x0152('0x35')]=_['intersection'](_0x1e0fc8[_0x0152('0x32')],_0x1e0fc8['query']);_0x26c4c0[_0x0152('0x36')]=_[_0x0152('0x37')](_0x1e0fc8[_0x0152('0x32')],qs[_0x0152('0x38')](_0x4af1ce[_0x0152('0x33')][_0x0152('0x38')]));_0x26c4c0['attributes']=_0x26c4c0[_0x0152('0x36')]['length']?_0x26c4c0[_0x0152('0x36')]:_0x1e0fc8[_0x0152('0x32')];if(!_0x4af1ce[_0x0152('0x33')][_0x0152('0x39')](_0x0152('0x3a'))){_0x26c4c0[_0x0152('0x3b')]=qs[_0x0152('0x3b')](_0x4af1ce[_0x0152('0x33')][_0x0152('0x3b')]);_0x26c4c0[_0x0152('0x22')]=qs[_0x0152('0x22')](_0x4af1ce[_0x0152('0x33')][_0x0152('0x22')]);}_0x26c4c0[_0x0152('0x3c')]=qs[_0x0152('0x3d')](_0x4af1ce[_0x0152('0x33')]['sort']);_0x26c4c0[_0x0152('0x3e')]=qs[_0x0152('0x35')](_['pick'](_0x4af1ce['query'],_0x1e0fc8['filters']),_0x1e7c36);if(_0x4af1ce[_0x0152('0x33')]['filter']){_0x26c4c0['where']=_[_0x0152('0x3f')](_0x26c4c0[_0x0152('0x3e')],{'$or':_['map'](_0x1e7c36,function(_0x5e035e){if(_0x5e035e['type']!==_0x0152('0x40')){var _0x300988={};_0x300988[_0x5e035e[_0x0152('0x2b')]]={'$like':'%'+_0x4af1ce[_0x0152('0x33')][_0x0152('0x41')]+'%'};return _0x300988;}})});}_0x26c4c0=_[_0x0152('0x3f')]({},_0x26c4c0,_0x4af1ce[_0x0152('0x42')]);var _0xd86ddd={'where':_0x26c4c0['where']};return db['OpenchannelQueue'][_0x0152('0x24')](_0xd86ddd)[_0x0152('0x2a')](function(_0x5175d1){_0x5e05a3[_0x0152('0x24')]=_0x5175d1;if(_0x4af1ce['query'][_0x0152('0x43')]){_0x26c4c0[_0x0152('0x44')]=[{'all':!![]}];}return db[_0x0152('0x45')][_0x0152('0x46')](_0x26c4c0);})[_0x0152('0x2a')](function(_0x3fa115){_0x5e05a3[_0x0152('0x47')]=_0x3fa115;return _0x5e05a3;})[_0x0152('0x2a')](respondWithFilteredResult(_0x435c8e,_0x26c4c0))[_0x0152('0x48')](handleError(_0x435c8e,null));};exports[_0x0152('0x49')]=function(_0x54f1c3,_0x55886e){var _0x17eb14={'raw':!![],'where':{'id':_0x54f1c3[_0x0152('0x4a')]['id']}},_0x38ce72={};_0x38ce72['model']=_[_0x0152('0x34')](db[_0x0152('0x45')][_0x0152('0x2e')]);_0x38ce72[_0x0152('0x33')]=_[_0x0152('0x34')](_0x54f1c3[_0x0152('0x33')]);_0x38ce72['filters']=_[_0x0152('0x37')](_0x38ce72['model'],_0x38ce72[_0x0152('0x33')]);_0x17eb14[_0x0152('0x36')]=_['intersection'](_0x38ce72[_0x0152('0x32')],qs[_0x0152('0x38')](_0x54f1c3[_0x0152('0x33')][_0x0152('0x38')]));_0x17eb14[_0x0152('0x36')]=_0x17eb14[_0x0152('0x36')][_0x0152('0x4b')]?_0x17eb14['attributes']:_0x38ce72[_0x0152('0x32')];if(_0x54f1c3[_0x0152('0x33')][_0x0152('0x43')]){_0x17eb14[_0x0152('0x44')]=[{'all':!![]}];}_0x17eb14=_[_0x0152('0x3f')]({},_0x17eb14,_0x54f1c3[_0x0152('0x42')]);return db[_0x0152('0x45')][_0x0152('0x4c')](_0x17eb14)[_0x0152('0x2a')](handleEntityNotFound(_0x55886e,null))[_0x0152('0x2a')](respondWithResult(_0x55886e,null))[_0x0152('0x48')](handleError(_0x55886e,null));};exports[_0x0152('0x4d')]=function(_0x18fcf2,_0xecd92c){return db[_0x0152('0x45')][_0x0152('0x4d')](_0x18fcf2[_0x0152('0x4e')],{})[_0x0152('0x2a')](function(_0x22eb23){var _0x3ed112=_0x18fcf2[_0x0152('0x4f')]['get']({'plain':!![]});if(!_0x3ed112)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ed112[_0x0152('0x50')]===_0x0152('0x4f')){var _0x3e3cbe=_0x22eb23[_0x0152('0x51')]({'plain':!![]});var _0x5bbdde='OpenchannelQueues';return db[_0x0152('0x52')]['find']({'where':{'name':_0x5bbdde,'userProfileId':_0x3ed112[_0x0152('0x53')]},'raw':!![]})[_0x0152('0x2a')](function(_0x179570){if(_0x179570&&_0x179570[_0x0152('0x54')]===0x0){return db[_0x0152('0x29')][_0x0152('0x4d')]({'name':_0x3e3cbe[_0x0152('0x2b')],'resourceId':_0x3e3cbe['id'],'type':_0x179570['name'],'sectionId':_0x179570['id']},{})[_0x0152('0x2a')](function(){return _0x22eb23;});}else{return _0x22eb23;}})[_0x0152('0x48')](function(_0x24b05c){logger['error'](_0x0152('0x55'),_0x24b05c);throw _0x24b05c;});}return _0x22eb23;})['then'](respondWithResult(_0xecd92c,0xc9))['catch'](handleError(_0xecd92c,null));};exports[_0x0152('0x56')]=function(_0x3b31b4,_0x4959a8){if(_0x3b31b4[_0x0152('0x4e')]['id']){delete _0x3b31b4[_0x0152('0x4e')]['id'];}return db[_0x0152('0x45')]['find']({'where':{'id':_0x3b31b4[_0x0152('0x4a')]['id']}})[_0x0152('0x2a')](handleEntityNotFound(_0x4959a8,null))[_0x0152('0x2a')](saveUpdates(_0x3b31b4[_0x0152('0x4e')],null))['then'](respondWithResult(_0x4959a8,null))[_0x0152('0x48')](handleError(_0x4959a8,null));};exports[_0x0152('0x57')]=function(_0x4faf1b,_0x4d0802){return db[_0x0152('0x45')][_0x0152('0x4c')]({'where':{'id':_0x4faf1b[_0x0152('0x4a')]['id']}})[_0x0152('0x2a')](handleEntityNotFound(_0x4d0802,null))[_0x0152('0x2a')](removeEntity(_0x4d0802,null))['catch'](handleError(_0x4d0802,null));};exports['describe']=function(_0x26ad69,_0x4f9066){return db[_0x0152('0x45')][_0x0152('0x58')]()['then'](respondWithResult(_0x4f9066,null))[_0x0152('0x48')](handleError(_0x4f9066,null));};exports[_0x0152('0x59')]=function(_0x5347f3,_0x3cec1e,_0x1a5e71){var _0x1dc1f1={'raw':!![],'where':{}},_0xbbfd54={},_0x14d407;return db[_0x0152('0x45')][_0x0152('0x5a')]({'where':{'id':_0x5347f3['params']['id']}})[_0x0152('0x2a')](handleEntityNotFound(_0x3cec1e,null))[_0x0152('0x2a')](function(_0x5e4ead){if(_0x5e4ead){_0x14d407=_0x5e4ead[_0x0152('0x51')]({'plain':!![]});_0xbbfd54[_0x0152('0x32')]=_[_0x0152('0x34')](db[_0x0152('0x5b')][_0x0152('0x2e')]);_0xbbfd54[_0x0152('0x33')]=_[_0x0152('0x34')](_0x5347f3[_0x0152('0x33')]);_0xbbfd54[_0x0152('0x35')]=_[_0x0152('0x37')](_0xbbfd54['model'],_0xbbfd54[_0x0152('0x33')]);_0x1dc1f1[_0x0152('0x36')]=_['intersection'](_0xbbfd54[_0x0152('0x32')],qs[_0x0152('0x38')](_0x5347f3[_0x0152('0x33')][_0x0152('0x38')]));_0x1dc1f1[_0x0152('0x36')]=_0x1dc1f1[_0x0152('0x36')][_0x0152('0x4b')]?_0x1dc1f1[_0x0152('0x36')]:_0xbbfd54[_0x0152('0x32')];if(!_0x5347f3[_0x0152('0x33')][_0x0152('0x39')](_0x0152('0x3a'))){_0x1dc1f1[_0x0152('0x3b')]=qs[_0x0152('0x3b')](_0x5347f3[_0x0152('0x33')][_0x0152('0x3b')]);_0x1dc1f1[_0x0152('0x22')]=qs[_0x0152('0x22')](_0x5347f3['query'][_0x0152('0x22')]);}_0x1dc1f1[_0x0152('0x3c')]=qs['sort'](_0x5347f3[_0x0152('0x33')][_0x0152('0x3d')]);_0x1dc1f1[_0x0152('0x3e')]=qs[_0x0152('0x35')](_[_0x0152('0x5c')](_0x5347f3['query'],_0xbbfd54[_0x0152('0x35')]));_0x1dc1f1[_0x0152('0x3e')][_0x0152('0x5d')]=_0x5e4ead['id'];if(_0x5347f3[_0x0152('0x33')][_0x0152('0x41')]){_0x1dc1f1[_0x0152('0x3e')]=_[_0x0152('0x3f')](_0x1dc1f1[_0x0152('0x3e')],{'$or':_[_0x0152('0x2d')](_0x1dc1f1[_0x0152('0x36')],function(_0x3b70aa){var _0x15367f={};_0x15367f[_0x3b70aa]={'$like':'%'+_0x5347f3[_0x0152('0x33')]['filter']+'%'};return _0x15367f;})});}_0x1dc1f1=_[_0x0152('0x3f')]({},_0x1dc1f1,_0x5347f3[_0x0152('0x42')]);return db[_0x0152('0x5b')][_0x0152('0x46')](_0x1dc1f1);}})[_0x0152('0x2a')](function(_0x42a8f1){if(_0x42a8f1){return db['User'][_0x0152('0x5e')]({'where':{'id':_[_0x0152('0x2d')](_0x42a8f1,_0x0152('0x5f')),'role':'agent'},'attributes':['id',_0x0152('0x2b'),'openchannelPause',_0x0152('0x60'),_0x0152('0x61')]});}})[_0x0152('0x2a')](function(_0x31df99){if(_0x31df99){return{'count':_0x31df99['count'],'rows':_[_0x0152('0x2d')](_0x31df99[_0x0152('0x47')],function(_0x382e59){return{'membername':_0x382e59[_0x0152('0x2b')],'UserId':_0x382e59['id'],'queue_name':_0x14d407[_0x0152('0x2b')],'OpenchannelQueueId':_0x14d407['id'],'interface':util[_0x0152('0x62')](_0x0152('0x63'),'SIP',_0x382e59['name']),'penalty':0x0,'paused':_0x382e59[_0x0152('0x64')],'createdAt':_0x382e59[_0x0152('0x61')],'updatedAt':_0x382e59[_0x0152('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0152('0x2a')](respondWithFilteredResult(_0x3cec1e,_0x1dc1f1))[_0x0152('0x48')](handleError(_0x3cec1e,null));};exports[_0x0152('0x65')]=function(_0x3f630f,_0x3d5ce5,_0x5832c6){var _0x5206cf={};var _0xd34833={};var _0x4775d3;var _0x329198;return db[_0x0152('0x45')][_0x0152('0x5a')]({'where':{'id':_0x3f630f[_0x0152('0x4a')]['id']}})[_0x0152('0x2a')](handleEntityNotFound(_0x3d5ce5,null))['then'](function(_0x36b189){if(_0x36b189){_0x4775d3=_0x36b189;_0xd34833[_0x0152('0x32')]=_[_0x0152('0x34')](db['Team']['rawAttributes']);_0xd34833['query']=_['keys'](_0x3f630f[_0x0152('0x33')]);_0xd34833[_0x0152('0x35')]=_[_0x0152('0x37')](_0xd34833[_0x0152('0x32')],_0xd34833[_0x0152('0x33')]);_0x5206cf[_0x0152('0x36')]=_[_0x0152('0x37')](_0xd34833[_0x0152('0x32')],qs[_0x0152('0x38')](_0x3f630f[_0x0152('0x33')][_0x0152('0x38')]));_0x5206cf[_0x0152('0x36')]=_0x5206cf[_0x0152('0x36')][_0x0152('0x4b')]?_0x5206cf['attributes']:_0xd34833[_0x0152('0x32')];_0x5206cf['order']=qs[_0x0152('0x3d')](_0x3f630f[_0x0152('0x33')][_0x0152('0x3d')]);_0x5206cf[_0x0152('0x3e')]=qs['filters'](_[_0x0152('0x5c')](_0x3f630f[_0x0152('0x33')],_0xd34833[_0x0152('0x35')]));if(_0x3f630f[_0x0152('0x33')][_0x0152('0x41')]){_0x5206cf[_0x0152('0x3e')]=_[_0x0152('0x3f')](_0x5206cf[_0x0152('0x3e')],{'$or':_[_0x0152('0x2d')](_0x5206cf[_0x0152('0x36')],function(_0x2edfe3){var _0x9bce13={};_0x9bce13[_0x2edfe3]={'$like':'%'+_0x3f630f[_0x0152('0x33')][_0x0152('0x41')]+'%'};return _0x9bce13;})});}_0x5206cf=_['merge']({},_0x5206cf,_0x3f630f['options']);return _0x4775d3[_0x0152('0x65')](_0x5206cf);}})[_0x0152('0x2a')](function(_0x13eeba){if(_0x13eeba){_0x329198=_0x13eeba[_0x0152('0x4b')];if(!_0x3f630f[_0x0152('0x33')][_0x0152('0x39')](_0x0152('0x3a'))){_0x5206cf[_0x0152('0x3b')]=qs[_0x0152('0x3b')](_0x3f630f['query']['limit']);_0x5206cf[_0x0152('0x22')]=qs[_0x0152('0x22')](_0x3f630f['query']['offset']);}return _0x4775d3[_0x0152('0x65')](_0x5206cf);}})[_0x0152('0x2a')](function(_0x20d2a2){if(_0x20d2a2){return _0x20d2a2?{'count':_0x329198,'rows':_0x20d2a2}:null;}})[_0x0152('0x2a')](respondWithResult(_0x3d5ce5,null))['catch'](handleError(_0x3d5ce5,null));};exports[_0x0152('0x66')]=function(_0x26c5ab,_0x23652e,_0x232505){var _0x55fd36=_0x26c5ab[_0x0152('0x4e')][_0x0152('0x67')];return db[_0x0152('0x68')][_0x0152('0x46')]({'where':{'id':_0x55fd36},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0152('0x69'),'attributes':['id',_0x0152('0x2b'),_0x0152('0x6a'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x1e0648){if(_0x1e0648){var _0x30157b=_['flatMap'](_0x1e0648,function(_0x35b2aa){var _0x3b827f=_0x35b2aa[_0x0152('0x51')]({'plain':!![]});return _0x3b827f['Agents'];});return db[_0x0152('0x45')][_0x0152('0x4c')]({'where':{'id':_0x26c5ab[_0x0152('0x4a')]['id']}})['then'](function(_0x3cb687){return db['sequelize'][_0x0152('0x6b')](function(_0x35b000){return _0x3cb687['addTeams'](_0x55fd36,{'transaction':_0x35b000})['then'](function(){return BPromise[_0x0152('0x6c')](_0x30157b,function(_0x3979bc){return db[_0x0152('0x5b')][_0x0152('0x6d')]({'where':{'UserId':_0x3979bc['id'],'OpenchannelQueueId':_0x26c5ab['params']['id']},'transaction':_0x35b000});});})[_0x0152('0x2a')](function(){_0x30157b[_0x0152('0x6e')](function(_0x52798c){socket[_0x0152('0x6f')](_0x0152('0x70'),{'UserId':_0x52798c['id'],'OpenchannelQueueId':_0x3cb687['id']});});});});});}})[_0x0152('0x2a')](respondWithStatusCode(_0x23652e,null))[_0x0152('0x48')](handleError(_0x23652e,null));};exports[_0x0152('0x71')]=function(_0x206347,_0x256266,_0x221b98){return db[_0x0152('0x68')]['findAll']({'where':{'id':_0x206347['query'][_0x0152('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0152('0x69'),'attributes':['id'],'raw':!![]}]})[_0x0152('0x2a')](handleEntityNotFound(_0x256266,null))[_0x0152('0x2a')](function(_0x266eda){var _0x2c5497=_[_0x0152('0x2d')](_0x266eda,'id');var _0x3e5344=[];var _0x14f866=[];var _0x20821b=squel[_0x0152('0x72')]();_0x20821b[_0x0152('0x73')](_0x0152('0x74'))['from'](_0x0152('0x75'),'tq')[_0x0152('0x76')](_0x0152('0x77'),'ut',_0x0152('0x78'))[_0x0152('0x3e')]('OpenchannelQueueId\x20=\x20?',_0x206347['params']['id']);for(var _0x91a57e=0x0;_0x91a57e<_0x266eda[_0x0152('0x4b')];_0x91a57e+=0x1){let _0x6be0b9=_0x266eda[_0x91a57e];for(var _0x25bf68=0x0;_0x25bf68<_0x6be0b9[_0x0152('0x69')][_0x0152('0x4b')];_0x25bf68+=0x1){let _0x1d441e=_0x6be0b9[_0x0152('0x69')][_0x25bf68];var _0x45d9a9=_0x20821b[_0x0152('0x79')]();_0x45d9a9[_0x0152('0x3e')](_0x0152('0x7a'),_0x1d441e['id']);_0x14f866[_0x0152('0x7b')](db[_0x0152('0x7c')]['query'](_0x45d9a9[_0x0152('0x7d')](),{'type':db[_0x0152('0x7c')][_0x0152('0x7e')][_0x0152('0x7f')]})['then'](function(_0x56de84){if(_0x56de84[_0x0152('0x4b')]===0x1){return _0x1d441e['id'];}else{var _0x38b2a1=_[_0x0152('0x80')](_[_0x0152('0x2d')](_0x56de84,_0x0152('0x81')),function(_0x375464){return _['includes'](_0x2c5497,_0x375464);});if(_0x38b2a1){return _0x1d441e['id'];}}}));}}return BPromise['all'](_0x14f866)[_0x0152('0x2a')](function(_0xe2d245){_0x3e5344=_(_0x3e5344)[_0x0152('0x82')](_0xe2d245)[_0x0152('0x83')]()[_0x0152('0x84')]();return db['OpenchannelQueue'][_0x0152('0x4c')]({'where':{'id':_0x206347[_0x0152('0x4a')]['id']}})[_0x0152('0x2a')](function(_0x41ebfe){return db['sequelize'][_0x0152('0x6b')](function(_0x20a1dc){return _0x41ebfe['removeTeams'](_0x206347[_0x0152('0x33')]['ids'],{'transaction':_0x20a1dc})[_0x0152('0x2a')](function(){if(!_[_0x0152('0x85')](_0x3e5344)){return _0x41ebfe[_0x0152('0x86')](_0x3e5344,{'transaction':_0x20a1dc});}})[_0x0152('0x2a')](function(){_0x3e5344[_0x0152('0x6e')](function(_0x997dea){socket[_0x0152('0x6f')]('userOpenchannelQueue:remove',{'UserId':_0x997dea,'OpenchannelQueueId':_0x41ebfe['id']});});});});});});})[_0x0152('0x2a')](respondWithStatusCode(_0x256266,null))[_0x0152('0x48')](handleError(_0x256266,null));};exports['addAgents']=function(_0x3c2d79,_0x225158,_0x628f89){return db[_0x0152('0x45')][_0x0152('0x4c')]({'where':{'id':_0x3c2d79['params']['id']}})[_0x0152('0x2a')](handleEntityNotFound(_0x225158,null))[_0x0152('0x2a')](function(_0x3cc267){if(_0x3cc267){return _0x3cc267[_0x0152('0x87')](_0x3c2d79[_0x0152('0x4e')][_0x0152('0x67')],_['omit'](_0x3c2d79['body'],[_0x0152('0x67'),'id'])||{})[_0x0152('0x88')](function(_0x1f5432){for(var _0x265fed=0x0;_0x265fed<_0x3c2d79[_0x0152('0x4e')][_0x0152('0x67')][_0x0152('0x4b')];_0x265fed+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':Number(_0x3c2d79[_0x0152('0x4e')][_0x0152('0x67')][_0x265fed]),'OpenchannelQueueId':Number(_0x3c2d79[_0x0152('0x4a')]['id'])});}return _0x1f5432;});}})['then'](respondWithResult(_0x225158,null))[_0x0152('0x48')](handleError(_0x225158,null));};exports[_0x0152('0x86')]=function(_0x357e74,_0x4e233e,_0x2cb864){return db[_0x0152('0x45')][_0x0152('0x4c')]({'where':{'id':_0x357e74['params']['id']}})[_0x0152('0x2a')](handleEntityNotFound(_0x4e233e,null))['then'](function(_0x46bae9){if(_0x46bae9){return _0x46bae9['removeAgents'](_0x357e74[_0x0152('0x33')][_0x0152('0x67')])[_0x0152('0x2a')](function(){if(_[_0x0152('0x89')](_0x357e74[_0x0152('0x33')][_0x0152('0x67')])){for(var _0xe2722b=0x0;_0xe2722b<_0x357e74['query'][_0x0152('0x67')][_0x0152('0x4b')];_0xe2722b+=0x1){socket[_0x0152('0x6f')](_0x0152('0x8a'),{'UserId':Number(_0x357e74['query']['ids'][_0xe2722b]),'OpenchannelQueueId':Number(_0x357e74['params']['id'])});}}else{socket[_0x0152('0x6f')](_0x0152('0x8a'),{'UserId':Number(_0x357e74[_0x0152('0x33')][_0x0152('0x67')]),'OpenchannelQueueId':Number(_0x357e74[_0x0152('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x4e233e,null))['catch'](handleError(_0x4e233e,null));};exports['getAgents']=function(_0x502f1d,_0x4f433f,_0x14e795){var _0x5673d6={};var _0x41597a={};var _0x3ebd7d;var _0x2a4789;return db[_0x0152('0x45')][_0x0152('0x5a')]({'where':{'id':_0x502f1d[_0x0152('0x4a')]['id']}})[_0x0152('0x2a')](handleEntityNotFound(_0x4f433f,null))['then'](function(_0x3508c3){if(_0x3508c3){_0x3ebd7d=_0x3508c3;_0x41597a[_0x0152('0x32')]=_[_0x0152('0x34')](db[_0x0152('0x8b')]['rawAttributes']);_0x41597a[_0x0152('0x33')]=_[_0x0152('0x34')](_0x502f1d['query']);_0x41597a[_0x0152('0x35')]=_['intersection'](_0x41597a[_0x0152('0x32')],_0x41597a[_0x0152('0x33')]);_0x5673d6[_0x0152('0x36')]=_['intersection'](_0x41597a[_0x0152('0x32')],qs[_0x0152('0x38')](_0x502f1d[_0x0152('0x33')][_0x0152('0x38')]));_0x5673d6[_0x0152('0x36')]=_0x5673d6[_0x0152('0x36')][_0x0152('0x4b')]?_0x5673d6[_0x0152('0x36')]:_0x41597a[_0x0152('0x32')];_0x5673d6[_0x0152('0x3c')]=qs[_0x0152('0x3d')](_0x502f1d[_0x0152('0x33')][_0x0152('0x3d')]);_0x5673d6[_0x0152('0x3e')]=qs[_0x0152('0x35')](_['pick'](_0x502f1d[_0x0152('0x33')],_0x41597a['filters']));if(_0x502f1d[_0x0152('0x33')]['filter']){_0x5673d6[_0x0152('0x3e')]=_[_0x0152('0x3f')](_0x5673d6[_0x0152('0x3e')],{'$or':_[_0x0152('0x2d')](_0x5673d6[_0x0152('0x36')],function(_0x5f02d2){var _0x373993={};_0x373993[_0x5f02d2]={'$like':'%'+_0x502f1d['query']['filter']+'%'};return _0x373993;})});}_0x5673d6=_[_0x0152('0x3f')]({},_0x5673d6,_0x502f1d[_0x0152('0x42')]);return _0x3ebd7d[_0x0152('0x8c')](_0x5673d6);}})[_0x0152('0x2a')](function(_0x194fd6){if(_0x194fd6){_0x2a4789=_0x194fd6[_0x0152('0x4b')];if(!_0x502f1d[_0x0152('0x33')][_0x0152('0x39')](_0x0152('0x3a'))){_0x5673d6[_0x0152('0x3b')]=qs['limit'](_0x502f1d[_0x0152('0x33')][_0x0152('0x3b')]);_0x5673d6[_0x0152('0x22')]=qs[_0x0152('0x22')](_0x502f1d[_0x0152('0x33')][_0x0152('0x22')]);}return _0x3ebd7d[_0x0152('0x8c')](_0x5673d6);}})['then'](function(_0x3734ed){if(_0x3734ed){return _0x3734ed?{'count':_0x2a4789,'rows':_0x3734ed}:null;}})[_0x0152('0x2a')](respondWithResult(_0x4f433f,null))[_0x0152('0x48')](handleError(_0x4f433f,null));}; \ No newline at end of file +var _0x8cb9=['voicePause','interface','flatMap','transaction','addTeams','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','Team','select','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','toString','sequelize','QueryTypes','SELECT','TeamId','includes','all','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','request-promise','moment','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./openchannelQueue.socket','status','json','undefined','count','offset','limit','set','Content-Range','save','update','destroy','then','sendStatus','stack','name','map','rawAttributes','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','OpenchannelQueue','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','describe','getMembers','findOne','pick','OpenchannelQueueId','User','UserId','agent','openchannelPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','ids','Agents','online'];(function(_0x5f746f,_0x5b05ab){var _0x198d15=function(_0x58c7e7){while(--_0x58c7e7){_0x5f746f['push'](_0x5f746f['shift']());}};_0x198d15(++_0x5b05ab);}(_0x8cb9,0x139));var _0x98cb=function(_0xcd7ef9,_0x2e0c1e){_0xcd7ef9=_0xcd7ef9-0x0;var _0x3cd1ff=_0x8cb9[_0xcd7ef9];return _0x3cd1ff;};'use strict';var emlformat=require(_0x98cb('0x0'));var rimraf=require(_0x98cb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x98cb('0x2'));var moment=require(_0x98cb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x98cb('0x4'));var util=require(_0x98cb('0x5'));var path=require(_0x98cb('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x98cb('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x98cb('0x8'));var squel=require('squel');var crypto=require(_0x98cb('0x9'));var jsforce=require(_0x98cb('0xa'));var deskjs=require(_0x98cb('0xb'));var toCsv=require(_0x98cb('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x98cb('0xd'));var authService=require(_0x98cb('0xe'));var qs=require(_0x98cb('0xf'));var as=require(_0x98cb('0x10'));var hardwareService=require(_0x98cb('0x11'));var logger=require(_0x98cb('0x12'))(_0x98cb('0x13'));var utils=require(_0x98cb('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x98cb('0x15'));var db=require(_0x98cb('0x16'))['db'];config[_0x98cb('0x17')]=_['defaults'](config[_0x98cb('0x17')],{'host':_0x98cb('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x98cb('0x19'))['register'](socket);function respondWithStatusCode(_0x4a3549,_0x39c45b){_0x39c45b=_0x39c45b||0xcc;return function(_0x235cc2){if(_0x235cc2){return _0x4a3549['sendStatus'](_0x39c45b);}return _0x4a3549[_0x98cb('0x1a')](_0x39c45b)['end']();};}function respondWithResult(_0x431e8f,_0x19a047){_0x19a047=_0x19a047||0xc8;return function(_0x4a9133){if(_0x4a9133){return _0x431e8f[_0x98cb('0x1a')](_0x19a047)[_0x98cb('0x1b')](_0x4a9133);}};}function respondWithFilteredResult(_0x37b432,_0x3664ba){return function(_0x5883da){if(_0x5883da){var _0x1df7d4=typeof _0x3664ba['offset']===_0x98cb('0x1c')&&typeof _0x3664ba['limit']==='undefined';var _0x37131e=_0x5883da[_0x98cb('0x1d')];var _0x3bea54=_0x1df7d4?0x0:_0x3664ba[_0x98cb('0x1e')];var _0x21959c=_0x1df7d4?_0x5883da[_0x98cb('0x1d')]:_0x3664ba[_0x98cb('0x1e')]+_0x3664ba[_0x98cb('0x1f')];var _0x47c243;if(_0x21959c>=_0x37131e){_0x21959c=_0x37131e;_0x47c243=0xc8;}else{_0x47c243=0xce;}_0x37b432['status'](_0x47c243);return _0x37b432[_0x98cb('0x20')](_0x98cb('0x21'),_0x3bea54+'-'+_0x21959c+'/'+_0x37131e)[_0x98cb('0x1b')](_0x5883da);}return null;};}function patchUpdates(_0x39254d){return function(_0x47d235){try{jsonpatch['apply'](_0x47d235,_0x39254d,!![]);}catch(_0x3a2d9a){return BPromise['reject'](_0x3a2d9a);}return _0x47d235[_0x98cb('0x22')]();};}function saveUpdates(_0x396098,_0x53d355){return function(_0x2aece9){if(_0x2aece9){return _0x2aece9[_0x98cb('0x23')](_0x396098)['then'](function(_0x23f01f){return _0x23f01f;});}return null;};}function removeEntity(_0x452cd8,_0x5aa751){return function(_0x4ea7e0){if(_0x4ea7e0){return _0x4ea7e0[_0x98cb('0x24')]()[_0x98cb('0x25')](function(){var _0x28f341=_0x4ea7e0['get']({'plain':!![]});var _0x476a35='OpenchannelQueues';return db['UserProfileResource'][_0x98cb('0x24')]({'where':{'type':_0x476a35,'resourceId':_0x28f341['id']}})[_0x98cb('0x25')](function(){return _0x4ea7e0;});})[_0x98cb('0x25')](function(){_0x452cd8[_0x98cb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x537bac,_0x5464b5){return function(_0x245157){if(!_0x245157){_0x537bac[_0x98cb('0x26')](0x194);}return _0x245157;};}function handleError(_0x5a8ee3,_0x4e4850){_0x4e4850=_0x4e4850||0x1f4;return function(_0x563e35){logger['error'](_0x563e35[_0x98cb('0x27')]);if(_0x563e35['name']){delete _0x563e35[_0x98cb('0x28')];}_0x5a8ee3['status'](_0x4e4850)['send'](_0x563e35);};}exports['index']=function(_0x5d0be6,_0x54e417){var _0xa9d712={},_0x4d4b16={},_0x5570ae={'count':0x0,'rows':[]};var _0x4b1689=_[_0x98cb('0x29')](db['OpenchannelQueue'][_0x98cb('0x2a')],function(_0x1e33f4){return{'name':_0x1e33f4['fieldName'],'type':_0x1e33f4[_0x98cb('0x2b')][_0x98cb('0x2c')]};});_0x4d4b16['model']=_[_0x98cb('0x29')](_0x4b1689,_0x98cb('0x28'));_0x4d4b16[_0x98cb('0x2d')]=_[_0x98cb('0x2e')](_0x5d0be6[_0x98cb('0x2d')]);_0x4d4b16[_0x98cb('0x2f')]=_['intersection'](_0x4d4b16[_0x98cb('0x30')],_0x4d4b16[_0x98cb('0x2d')]);_0xa9d712['attributes']=_[_0x98cb('0x31')](_0x4d4b16[_0x98cb('0x30')],qs[_0x98cb('0x32')](_0x5d0be6['query'][_0x98cb('0x32')]));_0xa9d712[_0x98cb('0x33')]=_0xa9d712[_0x98cb('0x33')][_0x98cb('0x34')]?_0xa9d712[_0x98cb('0x33')]:_0x4d4b16[_0x98cb('0x30')];if(!_0x5d0be6[_0x98cb('0x2d')][_0x98cb('0x35')](_0x98cb('0x36'))){_0xa9d712[_0x98cb('0x1f')]=qs[_0x98cb('0x1f')](_0x5d0be6[_0x98cb('0x2d')][_0x98cb('0x1f')]);_0xa9d712[_0x98cb('0x1e')]=qs[_0x98cb('0x1e')](_0x5d0be6['query'][_0x98cb('0x1e')]);}_0xa9d712[_0x98cb('0x37')]=qs['sort'](_0x5d0be6[_0x98cb('0x2d')][_0x98cb('0x38')]);_0xa9d712[_0x98cb('0x39')]=qs[_0x98cb('0x2f')](_['pick'](_0x5d0be6[_0x98cb('0x2d')],_0x4d4b16['filters']),_0x4b1689);if(_0x5d0be6[_0x98cb('0x2d')][_0x98cb('0x3a')]){_0xa9d712['where']=_[_0x98cb('0x3b')](_0xa9d712[_0x98cb('0x39')],{'$or':_[_0x98cb('0x29')](_0x4b1689,function(_0x38a1a3){if(_0x38a1a3[_0x98cb('0x2b')]!==_0x98cb('0x3c')){var _0x4daddd={};_0x4daddd[_0x38a1a3[_0x98cb('0x28')]]={'$like':'%'+_0x5d0be6['query'][_0x98cb('0x3a')]+'%'};return _0x4daddd;}})});}_0xa9d712=_[_0x98cb('0x3b')]({},_0xa9d712,_0x5d0be6[_0x98cb('0x3d')]);var _0x5d2fb0={'where':_0xa9d712[_0x98cb('0x39')]};return db[_0x98cb('0x3e')]['count'](_0x5d2fb0)[_0x98cb('0x25')](function(_0x5a8f06){_0x5570ae[_0x98cb('0x1d')]=_0x5a8f06;if(_0x5d0be6[_0x98cb('0x2d')][_0x98cb('0x3f')]){_0xa9d712['include']=[{'all':!![]}];}return db[_0x98cb('0x3e')][_0x98cb('0x40')](_0xa9d712);})[_0x98cb('0x25')](function(_0x2183b2){_0x5570ae[_0x98cb('0x41')]=_0x2183b2;return _0x5570ae;})[_0x98cb('0x25')](respondWithFilteredResult(_0x54e417,_0xa9d712))[_0x98cb('0x42')](handleError(_0x54e417,null));};exports[_0x98cb('0x43')]=function(_0x4fd6d8,_0xae7834){var _0x157634={'raw':!![],'where':{'id':_0x4fd6d8[_0x98cb('0x44')]['id']}},_0xc1b76e={};_0xc1b76e['model']=_[_0x98cb('0x2e')](db[_0x98cb('0x3e')]['rawAttributes']);_0xc1b76e[_0x98cb('0x2d')]=_[_0x98cb('0x2e')](_0x4fd6d8['query']);_0xc1b76e['filters']=_['intersection'](_0xc1b76e[_0x98cb('0x30')],_0xc1b76e['query']);_0x157634['attributes']=_['intersection'](_0xc1b76e['model'],qs[_0x98cb('0x32')](_0x4fd6d8[_0x98cb('0x2d')]['fields']));_0x157634[_0x98cb('0x33')]=_0x157634[_0x98cb('0x33')][_0x98cb('0x34')]?_0x157634[_0x98cb('0x33')]:_0xc1b76e[_0x98cb('0x30')];if(_0x4fd6d8[_0x98cb('0x2d')][_0x98cb('0x3f')]){_0x157634[_0x98cb('0x45')]=[{'all':!![]}];}_0x157634=_[_0x98cb('0x3b')]({},_0x157634,_0x4fd6d8['options']);return db[_0x98cb('0x3e')][_0x98cb('0x46')](_0x157634)[_0x98cb('0x25')](handleEntityNotFound(_0xae7834,null))[_0x98cb('0x25')](respondWithResult(_0xae7834,null))['catch'](handleError(_0xae7834,null));};exports[_0x98cb('0x47')]=function(_0x16a193,_0x153d47){return db[_0x98cb('0x3e')][_0x98cb('0x47')](_0x16a193[_0x98cb('0x48')],{})[_0x98cb('0x25')](function(_0x255da9){var _0x377f86=_0x16a193[_0x98cb('0x49')][_0x98cb('0x4a')]({'plain':!![]});if(!_0x377f86)throw new Error(_0x98cb('0x4b'));if(_0x377f86[_0x98cb('0x4c')]===_0x98cb('0x49')){var _0x39fb9a=_0x255da9['get']({'plain':!![]});var _0xef3d24=_0x98cb('0x4d');return db[_0x98cb('0x4e')]['find']({'where':{'name':_0xef3d24,'userProfileId':_0x377f86[_0x98cb('0x4f')]},'raw':!![]})[_0x98cb('0x25')](function(_0x29d6ed){if(_0x29d6ed&&_0x29d6ed[_0x98cb('0x50')]===0x0){return db[_0x98cb('0x51')][_0x98cb('0x47')]({'name':_0x39fb9a[_0x98cb('0x28')],'resourceId':_0x39fb9a['id'],'type':_0x29d6ed['name'],'sectionId':_0x29d6ed['id']},{})['then'](function(){return _0x255da9;});}else{return _0x255da9;}})['catch'](function(_0x11eb7f){logger[_0x98cb('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11eb7f);throw _0x11eb7f;});}return _0x255da9;})['then'](respondWithResult(_0x153d47,0xc9))[_0x98cb('0x42')](handleError(_0x153d47,null));};exports[_0x98cb('0x23')]=function(_0x3d17aa,_0x3982fd){if(_0x3d17aa[_0x98cb('0x48')]['id']){delete _0x3d17aa['body']['id'];}return db['OpenchannelQueue'][_0x98cb('0x46')]({'where':{'id':_0x3d17aa[_0x98cb('0x44')]['id']}})[_0x98cb('0x25')](handleEntityNotFound(_0x3982fd,null))[_0x98cb('0x25')](saveUpdates(_0x3d17aa[_0x98cb('0x48')],null))[_0x98cb('0x25')](respondWithResult(_0x3982fd,null))['catch'](handleError(_0x3982fd,null));};exports['destroy']=function(_0x5739f8,_0x10d98f){return db[_0x98cb('0x3e')][_0x98cb('0x46')]({'where':{'id':_0x5739f8['params']['id']}})['then'](handleEntityNotFound(_0x10d98f,null))[_0x98cb('0x25')](removeEntity(_0x10d98f,null))[_0x98cb('0x42')](handleError(_0x10d98f,null));};exports[_0x98cb('0x53')]=function(_0x45361d,_0x2f893f){return db[_0x98cb('0x3e')][_0x98cb('0x53')]()['then'](respondWithResult(_0x2f893f,null))[_0x98cb('0x42')](handleError(_0x2f893f,null));};exports[_0x98cb('0x54')]=function(_0x51725c,_0x30c021,_0x10f625){var _0x225055={'raw':!![],'where':{}},_0x1a4f5c={},_0x1a0118;return db[_0x98cb('0x3e')][_0x98cb('0x55')]({'where':{'id':_0x51725c['params']['id']}})[_0x98cb('0x25')](handleEntityNotFound(_0x30c021,null))[_0x98cb('0x25')](function(_0x19dd57){if(_0x19dd57){_0x1a0118=_0x19dd57['get']({'plain':!![]});_0x1a4f5c[_0x98cb('0x30')]=_[_0x98cb('0x2e')](db['UserOpenchannelQueue'][_0x98cb('0x2a')]);_0x1a4f5c['query']=_[_0x98cb('0x2e')](_0x51725c[_0x98cb('0x2d')]);_0x1a4f5c[_0x98cb('0x2f')]=_[_0x98cb('0x31')](_0x1a4f5c[_0x98cb('0x30')],_0x1a4f5c[_0x98cb('0x2d')]);_0x225055[_0x98cb('0x33')]=_['intersection'](_0x1a4f5c[_0x98cb('0x30')],qs[_0x98cb('0x32')](_0x51725c['query'][_0x98cb('0x32')]));_0x225055[_0x98cb('0x33')]=_0x225055[_0x98cb('0x33')][_0x98cb('0x34')]?_0x225055[_0x98cb('0x33')]:_0x1a4f5c[_0x98cb('0x30')];if(!_0x51725c[_0x98cb('0x2d')][_0x98cb('0x35')](_0x98cb('0x36'))){_0x225055['limit']=qs[_0x98cb('0x1f')](_0x51725c[_0x98cb('0x2d')][_0x98cb('0x1f')]);_0x225055[_0x98cb('0x1e')]=qs['offset'](_0x51725c[_0x98cb('0x2d')][_0x98cb('0x1e')]);}_0x225055[_0x98cb('0x37')]=qs[_0x98cb('0x38')](_0x51725c['query'][_0x98cb('0x38')]);_0x225055[_0x98cb('0x39')]=qs['filters'](_[_0x98cb('0x56')](_0x51725c[_0x98cb('0x2d')],_0x1a4f5c[_0x98cb('0x2f')]));_0x225055['where'][_0x98cb('0x57')]=_0x19dd57['id'];if(_0x51725c[_0x98cb('0x2d')][_0x98cb('0x3a')]){_0x225055[_0x98cb('0x39')]=_[_0x98cb('0x3b')](_0x225055['where'],{'$or':_[_0x98cb('0x29')](_0x225055[_0x98cb('0x33')],function(_0x16974d){var _0x5dbb2e={};_0x5dbb2e[_0x16974d]={'$like':'%'+_0x51725c['query']['filter']+'%'};return _0x5dbb2e;})});}_0x225055=_[_0x98cb('0x3b')]({},_0x225055,_0x51725c['options']);return db['UserOpenchannelQueue'][_0x98cb('0x40')](_0x225055);}})['then'](function(_0xc205e){if(_0xc205e){return db[_0x98cb('0x58')]['findAndCountAll']({'where':{'id':_[_0x98cb('0x29')](_0xc205e,_0x98cb('0x59')),'role':_0x98cb('0x5a')},'attributes':['id',_0x98cb('0x28'),_0x98cb('0x5b'),_0x98cb('0x5c'),'createdAt']});}})[_0x98cb('0x25')](function(_0x541f1a){if(_0x541f1a){return{'count':_0x541f1a[_0x98cb('0x1d')],'rows':_['map'](_0x541f1a[_0x98cb('0x41')],function(_0x3228bd){return{'membername':_0x3228bd[_0x98cb('0x28')],'UserId':_0x3228bd['id'],'queue_name':_0x1a0118['name'],'OpenchannelQueueId':_0x1a0118['id'],'interface':util[_0x98cb('0x5d')](_0x98cb('0x5e'),_0x98cb('0x5f'),_0x3228bd[_0x98cb('0x28')]),'penalty':0x0,'paused':_0x3228bd[_0x98cb('0x5b')],'createdAt':_0x3228bd[_0x98cb('0x60')],'updatedAt':_0x3228bd[_0x98cb('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x30c021,_0x225055))[_0x98cb('0x42')](handleError(_0x30c021,null));};exports['getTeams']=function(_0x6fe8a0,_0x59608e,_0x17c367){var _0x1a9702={};var _0x238e8c={};var _0x536f69;var _0x4541aa;return db[_0x98cb('0x3e')][_0x98cb('0x55')]({'where':{'id':_0x6fe8a0[_0x98cb('0x44')]['id']}})['then'](handleEntityNotFound(_0x59608e,null))[_0x98cb('0x25')](function(_0x1ad151){if(_0x1ad151){_0x536f69=_0x1ad151;_0x238e8c[_0x98cb('0x30')]=_[_0x98cb('0x2e')](db['Team']['rawAttributes']);_0x238e8c['query']=_[_0x98cb('0x2e')](_0x6fe8a0['query']);_0x238e8c[_0x98cb('0x2f')]=_[_0x98cb('0x31')](_0x238e8c[_0x98cb('0x30')],_0x238e8c[_0x98cb('0x2d')]);_0x1a9702['attributes']=_[_0x98cb('0x31')](_0x238e8c['model'],qs[_0x98cb('0x32')](_0x6fe8a0[_0x98cb('0x2d')][_0x98cb('0x32')]));_0x1a9702['attributes']=_0x1a9702[_0x98cb('0x33')]['length']?_0x1a9702[_0x98cb('0x33')]:_0x238e8c['model'];_0x1a9702[_0x98cb('0x37')]=qs[_0x98cb('0x38')](_0x6fe8a0[_0x98cb('0x2d')][_0x98cb('0x38')]);_0x1a9702['where']=qs[_0x98cb('0x2f')](_[_0x98cb('0x56')](_0x6fe8a0[_0x98cb('0x2d')],_0x238e8c['filters']));if(_0x6fe8a0[_0x98cb('0x2d')][_0x98cb('0x3a')]){_0x1a9702[_0x98cb('0x39')]=_['merge'](_0x1a9702['where'],{'$or':_['map'](_0x1a9702['attributes'],function(_0x4c488f){var _0x29e7d8={};_0x29e7d8[_0x4c488f]={'$like':'%'+_0x6fe8a0[_0x98cb('0x2d')][_0x98cb('0x3a')]+'%'};return _0x29e7d8;})});}_0x1a9702=_['merge']({},_0x1a9702,_0x6fe8a0['options']);return _0x536f69[_0x98cb('0x61')](_0x1a9702);}})['then'](function(_0x5d8105){if(_0x5d8105){_0x4541aa=_0x5d8105[_0x98cb('0x34')];if(!_0x6fe8a0[_0x98cb('0x2d')]['hasOwnProperty'](_0x98cb('0x36'))){_0x1a9702['limit']=qs['limit'](_0x6fe8a0[_0x98cb('0x2d')][_0x98cb('0x1f')]);_0x1a9702[_0x98cb('0x1e')]=qs[_0x98cb('0x1e')](_0x6fe8a0[_0x98cb('0x2d')]['offset']);}return _0x536f69[_0x98cb('0x61')](_0x1a9702);}})[_0x98cb('0x25')](function(_0xa8eebe){if(_0xa8eebe){return _0xa8eebe?{'count':_0x4541aa,'rows':_0xa8eebe}:null;}})['then'](respondWithResult(_0x59608e,null))[_0x98cb('0x42')](handleError(_0x59608e,null));};exports['addTeams']=function(_0x1fae79,_0x24a0b1,_0x50800d){var _0x147312=_0x1fae79['body'][_0x98cb('0x62')];return db['Team'][_0x98cb('0x40')]({'where':{'id':_0x147312},'attributes':['id'],'include':[{'model':db[_0x98cb('0x58')],'as':_0x98cb('0x63'),'attributes':['id',_0x98cb('0x28'),_0x98cb('0x64'),_0x98cb('0x65'),_0x98cb('0x66')],'raw':!![]}]})[_0x98cb('0x25')](function(_0x4abcbe){if(_0x4abcbe){var _0x57e478=_[_0x98cb('0x67')](_0x4abcbe,function(_0x393a71){var _0x285748=_0x393a71[_0x98cb('0x4a')]({'plain':!![]});return _0x285748[_0x98cb('0x63')];});return db[_0x98cb('0x3e')][_0x98cb('0x46')]({'where':{'id':_0x1fae79['params']['id']}})[_0x98cb('0x25')](function(_0x5475a2){return db['sequelize'][_0x98cb('0x68')](function(_0x345b77){return _0x5475a2[_0x98cb('0x69')](_0x147312,{'transaction':_0x345b77})[_0x98cb('0x25')](function(){return BPromise['each'](_0x57e478,function(_0x5ca21d){return db['UserOpenchannelQueue'][_0x98cb('0x6a')]({'where':{'UserId':_0x5ca21d['id'],'OpenchannelQueueId':_0x1fae79[_0x98cb('0x44')]['id']},'transaction':_0x345b77});});})[_0x98cb('0x25')](function(){_0x57e478[_0x98cb('0x6b')](function(_0xfe7710){socket[_0x98cb('0x6c')](_0x98cb('0x6d'),{'UserId':_0xfe7710['id'],'OpenchannelQueueId':_0x5475a2['id']});});});});});}})[_0x98cb('0x25')](respondWithStatusCode(_0x24a0b1,null))['catch'](handleError(_0x24a0b1,null));};exports[_0x98cb('0x6e')]=function(_0x1b64f4,_0x5f177f,_0x4ad8ff){return db[_0x98cb('0x6f')][_0x98cb('0x40')]({'where':{'id':_0x1b64f4[_0x98cb('0x2d')][_0x98cb('0x62')]},'attributes':['id'],'include':[{'model':db[_0x98cb('0x58')],'as':_0x98cb('0x63'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5f177f,null))[_0x98cb('0x25')](function(_0x3df1c3){var _0x38c1bf=_['map'](_0x3df1c3,'id');var _0x404e25=[];var _0x481ff6=[];var _0x24ec7b=squel[_0x98cb('0x70')]();_0x24ec7b['field']('tq.TeamId')[_0x98cb('0x71')](_0x98cb('0x72'),'tq')[_0x98cb('0x73')](_0x98cb('0x74'),'ut',_0x98cb('0x75'))[_0x98cb('0x39')](_0x98cb('0x76'),_0x1b64f4[_0x98cb('0x44')]['id']);for(var _0x5d5608=0x0;_0x5d5608<_0x3df1c3[_0x98cb('0x34')];_0x5d5608+=0x1){let _0x320684=_0x3df1c3[_0x5d5608];for(var _0x334b24=0x0;_0x334b24<_0x320684[_0x98cb('0x63')][_0x98cb('0x34')];_0x334b24+=0x1){let _0x5e4d66=_0x320684[_0x98cb('0x63')][_0x334b24];var _0x2f9fc2=_0x24ec7b[_0x98cb('0x77')]();_0x2f9fc2[_0x98cb('0x39')]('ut.UserId\x20=\x20?',_0x5e4d66['id']);_0x481ff6[_0x98cb('0x78')](db['sequelize'][_0x98cb('0x2d')](_0x2f9fc2[_0x98cb('0x79')](),{'type':db[_0x98cb('0x7a')][_0x98cb('0x7b')][_0x98cb('0x7c')]})['then'](function(_0x4282e7){if(_0x4282e7[_0x98cb('0x34')]===0x1){return _0x5e4d66['id'];}else{var _0x7a0472=_['every'](_[_0x98cb('0x29')](_0x4282e7,_0x98cb('0x7d')),function(_0x29081a){return _[_0x98cb('0x7e')](_0x38c1bf,_0x29081a);});if(_0x7a0472){return _0x5e4d66['id'];}}}));}}return BPromise[_0x98cb('0x7f')](_0x481ff6)[_0x98cb('0x25')](function(_0x209449){_0x404e25=_(_0x404e25)['union'](_0x209449)[_0x98cb('0x80')]()[_0x98cb('0x81')]();return db[_0x98cb('0x3e')]['find']({'where':{'id':_0x1b64f4[_0x98cb('0x44')]['id']}})[_0x98cb('0x25')](function(_0x3fbda5){return db[_0x98cb('0x7a')]['transaction'](function(_0x448f25){return _0x3fbda5[_0x98cb('0x6e')](_0x1b64f4['query'][_0x98cb('0x62')],{'transaction':_0x448f25})[_0x98cb('0x25')](function(){if(!_[_0x98cb('0x82')](_0x404e25)){return _0x3fbda5[_0x98cb('0x83')](_0x404e25,{'transaction':_0x448f25});}})['then'](function(){_0x404e25[_0x98cb('0x6b')](function(_0x4b7a66){socket['emit'](_0x98cb('0x84'),{'UserId':_0x4b7a66,'OpenchannelQueueId':_0x3fbda5['id']});});});});});});})[_0x98cb('0x25')](respondWithStatusCode(_0x5f177f,null))[_0x98cb('0x42')](handleError(_0x5f177f,null));};exports[_0x98cb('0x85')]=function(_0x3095be,_0x2ab1e7,_0x22492b){return db['OpenchannelQueue']['find']({'where':{'id':_0x3095be[_0x98cb('0x44')]['id']}})[_0x98cb('0x25')](handleEntityNotFound(_0x2ab1e7,null))['then'](function(_0x206318){if(_0x206318){return _0x206318[_0x98cb('0x85')](_0x3095be[_0x98cb('0x48')]['ids'],_[_0x98cb('0x86')](_0x3095be[_0x98cb('0x48')],[_0x98cb('0x62'),'id'])||{})[_0x98cb('0x87')](function(_0x2c357a){for(var _0x590914=0x0;_0x590914<_0x3095be['body'][_0x98cb('0x62')]['length'];_0x590914+=0x1){socket[_0x98cb('0x6c')]('userOpenchannelQueue:save',{'UserId':Number(_0x3095be[_0x98cb('0x48')][_0x98cb('0x62')][_0x590914]),'OpenchannelQueueId':Number(_0x3095be[_0x98cb('0x44')]['id'])});}return _0x2c357a;});}})['then'](respondWithResult(_0x2ab1e7,null))[_0x98cb('0x42')](handleError(_0x2ab1e7,null));};exports[_0x98cb('0x83')]=function(_0x2e05db,_0x2f8f23,_0x57b207){return db[_0x98cb('0x3e')]['find']({'where':{'id':_0x2e05db[_0x98cb('0x44')]['id']}})[_0x98cb('0x25')](handleEntityNotFound(_0x2f8f23,null))[_0x98cb('0x25')](function(_0x12e0fe){if(_0x12e0fe){return _0x12e0fe[_0x98cb('0x83')](_0x2e05db[_0x98cb('0x2d')][_0x98cb('0x62')])[_0x98cb('0x25')](function(){if(_[_0x98cb('0x88')](_0x2e05db[_0x98cb('0x2d')][_0x98cb('0x62')])){for(var _0x44d282=0x0;_0x44d282<_0x2e05db[_0x98cb('0x2d')]['ids'][_0x98cb('0x34')];_0x44d282+=0x1){socket['emit'](_0x98cb('0x84'),{'UserId':Number(_0x2e05db[_0x98cb('0x2d')][_0x98cb('0x62')][_0x44d282]),'OpenchannelQueueId':Number(_0x2e05db[_0x98cb('0x44')]['id'])});}}else{socket[_0x98cb('0x6c')]('userOpenchannelQueue:remove',{'UserId':Number(_0x2e05db[_0x98cb('0x2d')]['ids']),'OpenchannelQueueId':Number(_0x2e05db[_0x98cb('0x44')]['id'])});}});}})['then'](respondWithStatusCode(_0x2f8f23,null))[_0x98cb('0x42')](handleError(_0x2f8f23,null));};exports['getAgents']=function(_0xc6a77b,_0x28f289,_0x3dfc9c){var _0x1d4247={};var _0xc052e2={};var _0x4bcd1d;var _0x828efe;return db['OpenchannelQueue'][_0x98cb('0x55')]({'where':{'id':_0xc6a77b['params']['id']}})[_0x98cb('0x25')](handleEntityNotFound(_0x28f289,null))[_0x98cb('0x25')](function(_0x1716fa){if(_0x1716fa){_0x4bcd1d=_0x1716fa;_0xc052e2[_0x98cb('0x30')]=_['keys'](db['User'][_0x98cb('0x2a')]);_0xc052e2[_0x98cb('0x2d')]=_[_0x98cb('0x2e')](_0xc6a77b['query']);_0xc052e2[_0x98cb('0x2f')]=_[_0x98cb('0x31')](_0xc052e2[_0x98cb('0x30')],_0xc052e2[_0x98cb('0x2d')]);_0x1d4247[_0x98cb('0x33')]=_[_0x98cb('0x31')](_0xc052e2[_0x98cb('0x30')],qs[_0x98cb('0x32')](_0xc6a77b[_0x98cb('0x2d')][_0x98cb('0x32')]));_0x1d4247[_0x98cb('0x33')]=_0x1d4247[_0x98cb('0x33')][_0x98cb('0x34')]?_0x1d4247[_0x98cb('0x33')]:_0xc052e2[_0x98cb('0x30')];_0x1d4247[_0x98cb('0x37')]=qs[_0x98cb('0x38')](_0xc6a77b[_0x98cb('0x2d')]['sort']);_0x1d4247[_0x98cb('0x39')]=qs[_0x98cb('0x2f')](_[_0x98cb('0x56')](_0xc6a77b[_0x98cb('0x2d')],_0xc052e2['filters']));if(_0xc6a77b[_0x98cb('0x2d')][_0x98cb('0x3a')]){_0x1d4247['where']=_[_0x98cb('0x3b')](_0x1d4247['where'],{'$or':_[_0x98cb('0x29')](_0x1d4247[_0x98cb('0x33')],function(_0x1cf52c){var _0x1aed92={};_0x1aed92[_0x1cf52c]={'$like':'%'+_0xc6a77b[_0x98cb('0x2d')][_0x98cb('0x3a')]+'%'};return _0x1aed92;})});}_0x1d4247=_[_0x98cb('0x3b')]({},_0x1d4247,_0xc6a77b['options']);return _0x4bcd1d['getAgents'](_0x1d4247);}})[_0x98cb('0x25')](function(_0x412c93){if(_0x412c93){_0x828efe=_0x412c93[_0x98cb('0x34')];if(!_0xc6a77b[_0x98cb('0x2d')][_0x98cb('0x35')](_0x98cb('0x36'))){_0x1d4247[_0x98cb('0x1f')]=qs[_0x98cb('0x1f')](_0xc6a77b[_0x98cb('0x2d')][_0x98cb('0x1f')]);_0x1d4247[_0x98cb('0x1e')]=qs[_0x98cb('0x1e')](_0xc6a77b['query'][_0x98cb('0x1e')]);}return _0x4bcd1d[_0x98cb('0x89')](_0x1d4247);}})[_0x98cb('0x25')](function(_0x33adaf){if(_0x33adaf){return _0x33adaf?{'count':_0x828efe,'rows':_0x33adaf}:null;}})[_0x98cb('0x25')](respondWithResult(_0x28f289,null))['catch'](handleError(_0x28f289,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 54554e0..a53d312 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 _0xcf7d=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','save','update'];(function(_0x3f97e,_0x8d4e6a){var _0x2faf07=function(_0x6d1dd0){while(--_0x6d1dd0){_0x3f97e['push'](_0x3f97e['shift']());}};_0x2faf07(++_0x8d4e6a);}(_0xcf7d,0x11b));var _0xdcf7=function(_0x2a75e7,_0x75c5af){_0x2a75e7=_0x2a75e7-0x0;var _0x360dd2=_0xcf7d[_0x2a75e7];return _0x360dd2;};'use strict';var EventEmitter=require(_0xdcf7('0x0'));var OpenchannelQueue=require(_0xdcf7('0x1'))['db'][_0xdcf7('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdcf7('0x3'),'afterUpdate':_0xdcf7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2271cc){return function(_0x28f4d2,_0x40c564,_0x4345cf){OpenchannelQueueEvents['emit'](_0x2271cc+':'+_0x28f4d2['id'],_0x28f4d2);OpenchannelQueueEvents[_0xdcf7('0x5')](_0x2271cc,_0x28f4d2);_0x4345cf(null);};}for(var e in events){if(events[_0xdcf7('0x6')](e)){var event=events[e];OpenchannelQueue[_0xdcf7('0x7')](e,emitEvent(event));}}module[_0xdcf7('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x7ece=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0x13a144,_0x2554cf){var _0xb78fbd=function(_0x55247e){while(--_0x55247e){_0x13a144['push'](_0x13a144['shift']());}};_0xb78fbd(++_0x2554cf);}(_0x7ece,0xcc));var _0xe7ec=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x7ece[_0x5d2803];return _0xdcad2c;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xe7ec('0x0'))['db'][_0xe7ec('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xe7ec('0x2')](0x0);var events={'afterCreate':_0xe7ec('0x3'),'afterUpdate':_0xe7ec('0x4'),'afterDestroy':_0xe7ec('0x5')};function emitEvent(_0x2d50d3){return function(_0x4f6993,_0x205067,_0x49ba91){OpenchannelQueueEvents[_0xe7ec('0x6')](_0x2d50d3+':'+_0x4f6993['id'],_0x4f6993);OpenchannelQueueEvents[_0xe7ec('0x6')](_0x2d50d3,_0x4f6993);_0x49ba91(null);};}for(var e in events){if(events[_0xe7ec('0x7')](e)){var event=events[e];OpenchannelQueue[_0xe7ec('0x8')](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 f56aa02..5373307 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 _0x9d3e=['./openchannelQueue.attributes','define','OpenchannelQueue','openchannel_queues','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3e8129,_0x30a03c){var _0x27e892=function(_0x1979db){while(--_0x1979db){_0x3e8129['push'](_0x3e8129['shift']());}};_0x27e892(++_0x30a03c);}(_0x9d3e,0xac));var _0xe9d3=function(_0x38f6b6,_0x563d40){_0x38f6b6=_0x38f6b6-0x0;var _0x26632e=_0x9d3e[_0x38f6b6];return _0x26632e;};'use strict';var _=require(_0xe9d3('0x0'));var util=require('util');var logger=require(_0xe9d3('0x1'))(_0xe9d3('0x2'));var moment=require(_0xe9d3('0x3'));var BPromise=require('bluebird');var rp=require(_0xe9d3('0x4'));var fs=require('fs');var path=require(_0xe9d3('0x5'));var rimraf=require(_0xe9d3('0x6'));var config=require(_0xe9d3('0x7'));var attributes=require(_0xe9d3('0x8'));module['exports']=function(_0xca9ba0,_0x2a6df4){return _0xca9ba0[_0xe9d3('0x9')](_0xe9d3('0xa'),attributes,{'tableName':_0xe9d3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef8f=['../../config/environment','./openchannelQueue.attributes','exports','OpenchannelQueue','openchannel_queues','lodash','util','moment','request-promise','path','rimraf'];(function(_0x45b771,_0x2caece){var _0x7ef73d=function(_0x44283a){while(--_0x44283a){_0x45b771['push'](_0x45b771['shift']());}};_0x7ef73d(++_0x2caece);}(_0xef8f,0x1b2));var _0xfef8=function(_0x1f40f,_0x4d537f){_0x1f40f=_0x1f40f-0x0;var _0x4896e8=_0xef8f[_0x1f40f];return _0x4896e8;};'use strict';var _=require(_0xfef8('0x0'));var util=require(_0xfef8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfef8('0x2'));var BPromise=require('bluebird');var rp=require(_0xfef8('0x3'));var fs=require('fs');var path=require(_0xfef8('0x4'));var rimraf=require(_0xfef8('0x5'));var config=require(_0xfef8('0x6'));var attributes=require(_0xfef8('0x7'));module[_0xfef8('0x8')]=function(_0x4eef95,_0x1a340e){return _0x4eef95['define'](_0xfef8('0x9'),attributes,{'tableName':_0xfef8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index ffdaee7..f0070d9 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 _0xa901=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetOpenchannelQueue','catch','find','ShowOpenchannelQueue','lodash'];(function(_0x1cd65a,_0x29fa8f){var _0xf93849=function(_0x29fbe1){while(--_0x29fbe1){_0x1cd65a['push'](_0x1cd65a['shift']());}};_0xf93849(++_0x29fa8f);}(_0xa901,0x137));var _0x1a90=function(_0x5e8497,_0x5496d4){_0x5e8497=_0x5e8497-0x0;var _0x375096=_0xa901[_0x5e8497];return _0x375096;};'use strict';var _=require(_0x1a90('0x0'));var util=require(_0x1a90('0x1'));var moment=require(_0x1a90('0x2'));var BPromise=require(_0x1a90('0x3'));var rs=require(_0x1a90('0x4'));var fs=require('fs');var Redis=require(_0x1a90('0x5'));var db=require(_0x1a90('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1a90('0x7'))('rpc');var config=require(_0x1a90('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1a90('0x9')][_0x1a90('0xa')]({'port':0x232a});config[_0x1a90('0xb')]=_['defaults'](config['redis'],{'host':_0x1a90('0xc'),'port':0x18eb});var socket=require(_0x1a90('0xd'))(new Redis(config[_0x1a90('0xb')]));require(_0x1a90('0xe'))['register'](socket);function respondWithRpcPromise(_0x5defeb,_0x34f842,_0x3fb3b0){return new BPromise(function(_0x2046cb,_0x3764be){return client['request'](_0x5defeb,_0x3fb3b0)[_0x1a90('0xf')](function(_0x5340c3){logger[_0x1a90('0x10')](_0x1a90('0x11'),_0x34f842,_0x1a90('0x12'));logger[_0x1a90('0x13')](_0x1a90('0x14'),_0x34f842,_0x1a90('0x12'),JSON[_0x1a90('0x15')](_0x5340c3));if(_0x5340c3[_0x1a90('0x16')]){if(_0x5340c3[_0x1a90('0x16')]['code']===0x1f4){logger[_0x1a90('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x34f842,_0x5340c3['error'][_0x1a90('0x17')]);return _0x3764be(_0x5340c3[_0x1a90('0x16')][_0x1a90('0x17')]);}logger[_0x1a90('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x34f842,_0x5340c3[_0x1a90('0x16')][_0x1a90('0x17')]);return _0x2046cb(_0x5340c3[_0x1a90('0x16')][_0x1a90('0x17')]);}else{logger[_0x1a90('0x10')](_0x1a90('0x11'),_0x34f842,_0x1a90('0x12'));_0x2046cb(_0x5340c3[_0x1a90('0x18')][_0x1a90('0x17')]);}})['catch'](function(_0x3953da){logger[_0x1a90('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x34f842,_0x3953da);_0x3764be(_0x3953da);});});}exports['GetOpenchannelQueue']=function(_0x2e6eb3){var _0x105517=this;return new Promise(function(_0x794255,_0x41ccfb){return db[_0x1a90('0x19')][_0x1a90('0x1a')]({'raw':_0x2e6eb3[_0x1a90('0x1b')]?_0x2e6eb3['options'][_0x1a90('0x1c')]===undefined?!![]:![]:!![],'where':_0x2e6eb3[_0x1a90('0x1b')]?_0x2e6eb3[_0x1a90('0x1b')][_0x1a90('0x1d')]||null:null,'attributes':_0x2e6eb3[_0x1a90('0x1b')]?_0x2e6eb3[_0x1a90('0x1b')][_0x1a90('0x1e')]||null:null,'limit':_0x2e6eb3[_0x1a90('0x1b')]?_0x2e6eb3[_0x1a90('0x1b')][_0x1a90('0x1f')]||null:null,'include':_0x2e6eb3[_0x1a90('0x1b')]?_0x2e6eb3[_0x1a90('0x1b')][_0x1a90('0x20')]?_['map'](_0x2e6eb3[_0x1a90('0x1b')][_0x1a90('0x20')],function(_0x35c2bb){return{'model':db[_0x35c2bb['model']],'as':_0x35c2bb['as'],'attributes':_0x35c2bb[_0x1a90('0x1e')],'include':_0x35c2bb['include']?_[_0x1a90('0x21')](_0x35c2bb[_0x1a90('0x20')],function(_0x515add){return{'model':db[_0x515add[_0x1a90('0x22')]],'as':_0x515add['as'],'attributes':_0x515add[_0x1a90('0x1e')],'include':_0x515add['include']?_[_0x1a90('0x21')](_0x515add[_0x1a90('0x20')],function(_0x166a83){return{'model':db[_0x166a83[_0x1a90('0x22')]],'as':_0x166a83['as'],'attributes':_0x166a83[_0x1a90('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x584ca2){logger[_0x1a90('0x10')](_0x1a90('0x23'),_0x2e6eb3);logger[_0x1a90('0x13')](_0x1a90('0x23'),_0x2e6eb3,JSON[_0x1a90('0x15')](_0x584ca2));_0x794255(_0x584ca2);})[_0x1a90('0x24')](function(_0x7ce29c){logger[_0x1a90('0x16')](_0x1a90('0x23'),_0x7ce29c[_0x1a90('0x17')],_0x2e6eb3);_0x41ccfb(_0x105517[_0x1a90('0x16')](0x1f4,_0x7ce29c['message']));});});};exports['ShowOpenchannelQueue']=function(_0x25e6e2){var _0x174027=this;return new Promise(function(_0x36a5ea,_0x43c565){return db[_0x1a90('0x19')][_0x1a90('0x25')]({'raw':_0x25e6e2[_0x1a90('0x1b')]?_0x25e6e2[_0x1a90('0x1b')][_0x1a90('0x1c')]===undefined?!![]:![]:!![],'where':_0x25e6e2[_0x1a90('0x1b')]?_0x25e6e2[_0x1a90('0x1b')]['where']||null:null,'attributes':_0x25e6e2[_0x1a90('0x1b')]?_0x25e6e2['options']['attributes']||null:null,'include':_0x25e6e2[_0x1a90('0x1b')]?_0x25e6e2[_0x1a90('0x1b')][_0x1a90('0x20')]?_['map'](_0x25e6e2[_0x1a90('0x1b')][_0x1a90('0x20')],function(_0x441712){return{'model':db[_0x441712[_0x1a90('0x22')]],'as':_0x441712['as'],'attributes':_0x441712['attributes'],'include':_0x441712[_0x1a90('0x20')]?_['map'](_0x441712['include'],function(_0x48a7c6){return{'model':db[_0x48a7c6[_0x1a90('0x22')]],'as':_0x48a7c6['as'],'attributes':_0x48a7c6['attributes'],'include':_0x48a7c6[_0x1a90('0x20')]?_[_0x1a90('0x21')](_0x48a7c6[_0x1a90('0x20')],function(_0x37f02a){return{'model':db[_0x37f02a[_0x1a90('0x22')]],'as':_0x37f02a['as'],'attributes':_0x37f02a[_0x1a90('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1a90('0xf')](function(_0xc423c9){logger['info']('ShowOpenchannelQueue',_0x25e6e2);logger[_0x1a90('0x13')](_0x1a90('0x26'),_0x25e6e2,JSON['stringify'](_0xc423c9));_0x36a5ea(_0xc423c9);})[_0x1a90('0x24')](function(_0x1fa164){logger[_0x1a90('0x16')](_0x1a90('0x26'),_0x1fa164[_0x1a90('0x17')],_0x25e6e2);_0x43c565(_0x174027[_0x1a90('0x16')](0x1f4,_0x1fa164['message']));});});}; \ No newline at end of file +var _0xf7af=['ShowOpenchannelQueue','raw','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueue','findAll','options','where','attributes','limit','include','map','model','GetOpenchannelQueue'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xf7af,0x12a));var _0xff7a=function(_0x5b1c37,_0x3f02e8){_0x5b1c37=_0x5b1c37-0x0;var _0x16af68=_0xf7af[_0x5b1c37];return _0x16af68;};'use strict';var _=require(_0xff7a('0x0'));var util=require(_0xff7a('0x1'));var moment=require(_0xff7a('0x2'));var BPromise=require('bluebird');var rs=require(_0xff7a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xff7a('0x4'));var logger=require(_0xff7a('0x5'))('rpc');var config=require(_0xff7a('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xff7a('0x7')]=_['defaults'](config[_0xff7a('0x7')],{'host':_0xff7a('0x8'),'port':0x18eb});var socket=require(_0xff7a('0x9'))(new Redis(config[_0xff7a('0x7')]));require(_0xff7a('0xa'))[_0xff7a('0xb')](socket);function respondWithRpcPromise(_0x111db8,_0x3466c8,_0x4d748e){return new BPromise(function(_0x2f8d40,_0x54feea){return client[_0xff7a('0xc')](_0x111db8,_0x4d748e)[_0xff7a('0xd')](function(_0x22e3b2){logger[_0xff7a('0xe')](_0xff7a('0xf'),_0x3466c8,_0xff7a('0x10'));logger[_0xff7a('0x11')](_0xff7a('0x12'),_0x3466c8,'request\x20sent',JSON[_0xff7a('0x13')](_0x22e3b2));if(_0x22e3b2[_0xff7a('0x14')]){if(_0x22e3b2[_0xff7a('0x14')][_0xff7a('0x15')]===0x1f4){logger[_0xff7a('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x3466c8,_0x22e3b2[_0xff7a('0x14')][_0xff7a('0x16')]);return _0x54feea(_0x22e3b2['error'][_0xff7a('0x16')]);}logger[_0xff7a('0x14')](_0xff7a('0xf'),_0x3466c8,_0x22e3b2[_0xff7a('0x14')][_0xff7a('0x16')]);return _0x2f8d40(_0x22e3b2[_0xff7a('0x14')][_0xff7a('0x16')]);}else{logger[_0xff7a('0xe')]('OpenchannelQueue,\x20%s,\x20%s',_0x3466c8,'request\x20sent');_0x2f8d40(_0x22e3b2[_0xff7a('0x17')][_0xff7a('0x16')]);}})[_0xff7a('0x18')](function(_0x3036b1){logger[_0xff7a('0x14')](_0xff7a('0xf'),_0x3466c8,_0x3036b1);_0x54feea(_0x3036b1);});});}exports['GetOpenchannelQueue']=function(_0x472717){var _0xa1118f=this;return new Promise(function(_0x4c36d7,_0x4c57e7){return db[_0xff7a('0x19')][_0xff7a('0x1a')]({'raw':_0x472717[_0xff7a('0x1b')]?_0x472717['options']['raw']===undefined?!![]:![]:!![],'where':_0x472717[_0xff7a('0x1b')]?_0x472717[_0xff7a('0x1b')][_0xff7a('0x1c')]||null:null,'attributes':_0x472717[_0xff7a('0x1b')]?_0x472717[_0xff7a('0x1b')][_0xff7a('0x1d')]||null:null,'limit':_0x472717[_0xff7a('0x1b')]?_0x472717[_0xff7a('0x1b')][_0xff7a('0x1e')]||null:null,'include':_0x472717['options']?_0x472717[_0xff7a('0x1b')][_0xff7a('0x1f')]?_[_0xff7a('0x20')](_0x472717['options'][_0xff7a('0x1f')],function(_0x3ae933){return{'model':db[_0x3ae933[_0xff7a('0x21')]],'as':_0x3ae933['as'],'attributes':_0x3ae933[_0xff7a('0x1d')],'include':_0x3ae933['include']?_[_0xff7a('0x20')](_0x3ae933[_0xff7a('0x1f')],function(_0x28f29c){return{'model':db[_0x28f29c['model']],'as':_0x28f29c['as'],'attributes':_0x28f29c[_0xff7a('0x1d')],'include':_0x28f29c[_0xff7a('0x1f')]?_[_0xff7a('0x20')](_0x28f29c[_0xff7a('0x1f')],function(_0x24321e){return{'model':db[_0x24321e[_0xff7a('0x21')]],'as':_0x24321e['as'],'attributes':_0x24321e[_0xff7a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xff7a('0xd')](function(_0x409550){logger[_0xff7a('0xe')](_0xff7a('0x22'),_0x472717);logger[_0xff7a('0x11')](_0xff7a('0x22'),_0x472717,JSON[_0xff7a('0x13')](_0x409550));_0x4c36d7(_0x409550);})['catch'](function(_0x313216){logger[_0xff7a('0x14')](_0xff7a('0x22'),_0x313216['message'],_0x472717);_0x4c57e7(_0xa1118f['error'](0x1f4,_0x313216['message']));});});};exports[_0xff7a('0x23')]=function(_0x396569){var _0x4a0b3f=this;return new Promise(function(_0x1fa5d3,_0x22231f){return db[_0xff7a('0x19')]['find']({'raw':_0x396569['options']?_0x396569[_0xff7a('0x1b')][_0xff7a('0x24')]===undefined?!![]:![]:!![],'where':_0x396569[_0xff7a('0x1b')]?_0x396569['options'][_0xff7a('0x1c')]||null:null,'attributes':_0x396569[_0xff7a('0x1b')]?_0x396569[_0xff7a('0x1b')][_0xff7a('0x1d')]||null:null,'include':_0x396569[_0xff7a('0x1b')]?_0x396569[_0xff7a('0x1b')][_0xff7a('0x1f')]?_[_0xff7a('0x20')](_0x396569[_0xff7a('0x1b')][_0xff7a('0x1f')],function(_0x413117){return{'model':db[_0x413117[_0xff7a('0x21')]],'as':_0x413117['as'],'attributes':_0x413117[_0xff7a('0x1d')],'include':_0x413117[_0xff7a('0x1f')]?_[_0xff7a('0x20')](_0x413117['include'],function(_0x9b15ea){return{'model':db[_0x9b15ea[_0xff7a('0x21')]],'as':_0x9b15ea['as'],'attributes':_0x9b15ea[_0xff7a('0x1d')],'include':_0x9b15ea['include']?_[_0xff7a('0x20')](_0x9b15ea[_0xff7a('0x1f')],function(_0x4b7264){return{'model':db[_0x4b7264[_0xff7a('0x21')]],'as':_0x4b7264['as'],'attributes':_0x4b7264[_0xff7a('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46be10){logger[_0xff7a('0xe')](_0xff7a('0x23'),_0x396569);logger[_0xff7a('0x11')](_0xff7a('0x23'),_0x396569,JSON[_0xff7a('0x13')](_0x46be10));_0x1fa5d3(_0x46be10);})[_0xff7a('0x18')](function(_0x50b450){logger[_0xff7a('0x14')](_0xff7a('0x23'),_0x50b450['message'],_0x396569);_0x22231f(_0x4a0b3f[_0xff7a('0x14')](0x1f4,_0x50b450['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index bc0fc75..13aa4ca 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 _0xc343=['register','length','openchannelQueue:','./openchannelQueue.events','remove','update','emit','removeListener'];(function(_0x585d81,_0xf6d74f){var _0x1aca0d=function(_0x3782d3){while(--_0x3782d3){_0x585d81['push'](_0x585d81['shift']());}};_0x1aca0d(++_0xf6d74f);}(_0xc343,0x173));var _0x3c34=function(_0xba52b2,_0x58739b){_0xba52b2=_0xba52b2-0x0;var _0x245e01=_0xc343[_0xba52b2];return _0x245e01;};'use strict';var OpenchannelQueueEvents=require(_0x3c34('0x0'));var events=['save',_0x3c34('0x1'),_0x3c34('0x2')];function createListener(_0x2968f0,_0x569f93){return function(_0x517861){_0x569f93[_0x3c34('0x3')](_0x2968f0,_0x517861);};}function removeListener(_0x3f968d,_0x35238d){return function(){OpenchannelQueueEvents[_0x3c34('0x4')](_0x3f968d,_0x35238d);};}exports[_0x3c34('0x5')]=function(_0x37ddf8){for(var _0x401457=0x0,_0x2b12df=events[_0x3c34('0x6')];_0x401457<_0x2b12df;_0x401457++){var _0x3d7335=events[_0x401457];var _0x351315=createListener(_0x3c34('0x7')+_0x3d7335,_0x37ddf8);OpenchannelQueueEvents['on'](_0x3d7335,_0x351315);}}; \ No newline at end of file +var _0xf6a4=['emit','removeListener','length','openchannelQueue:','update'];(function(_0x5a7fae,_0x53c917){var _0x44bbd2=function(_0x3dcf05){while(--_0x3dcf05){_0x5a7fae['push'](_0x5a7fae['shift']());}};_0x44bbd2(++_0x53c917);}(_0xf6a4,0x6d));var _0x4f6a=function(_0x2d7837,_0xd3989){_0x2d7837=_0x2d7837-0x0;var _0x1a9a7e=_0xf6a4[_0x2d7837];return _0x1a9a7e;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save','remove',_0x4f6a('0x0')];function createListener(_0x32fa75,_0x58b872){return function(_0x3a9985){_0x58b872[_0x4f6a('0x1')](_0x32fa75,_0x3a9985);};}function removeListener(_0x5b529f,_0x4270e0){return function(){OpenchannelQueueEvents[_0x4f6a('0x2')](_0x5b529f,_0x4270e0);};}exports['register']=function(_0x4423be){for(var _0x281f1a=0x0,_0x2b8238=events[_0x4f6a('0x3')];_0x281f1a<_0x2b8238;_0x281f1a++){var _0x2c96f4=events[_0x281f1a];var _0x47b348=createListener(_0x4f6a('0x4')+_0x2c96f4,_0x4423be);OpenchannelQueueEvents['on'](_0x2c96f4,_0x47b348);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 374fb5f..b4478e2 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 _0xc9d1=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','delete','destroy','exports'];(function(_0x5152ad,_0x3e3a07){var _0x2d41ae=function(_0x194a1a){while(--_0x194a1a){_0x5152ad['push'](_0x5152ad['shift']());}};_0x2d41ae(++_0x3e3a07);}(_0xc9d1,0xc8));var _0x1c9d=function(_0x52e563,_0x452980){_0x52e563=_0x52e563-0x0;var _0xfc3dd0=_0xc9d1[_0x52e563];return _0xfc3dd0;};'use strict';var multer=require(_0x1c9d('0x0'));var util=require(_0x1c9d('0x1'));var path=require(_0x1c9d('0x2'));var timeout=require('connect-timeout');var express=require(_0x1c9d('0x3'));var router=express[_0x1c9d('0x4')]();var fs_extra=require(_0x1c9d('0x5'));var auth=require(_0x1c9d('0x6'));var interaction=require(_0x1c9d('0x7'));var config=require('../../config/environment');var controller=require(_0x1c9d('0x8'));router[_0x1c9d('0x9')]('/',auth[_0x1c9d('0xa')](),controller[_0x1c9d('0xb')]);router[_0x1c9d('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x1c9d('0xc')]);router[_0x1c9d('0x9')](_0x1c9d('0xd'),auth[_0x1c9d('0xa')](),controller[_0x1c9d('0xe')]);router[_0x1c9d('0xf')]('/',auth[_0x1c9d('0xa')](),controller[_0x1c9d('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1c9d('0x11')]('/:id',auth[_0x1c9d('0xa')](),controller[_0x1c9d('0x12')]);module[_0x1c9d('0x13')]=router; \ No newline at end of file +var _0x4475=['fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x38d072,_0x582ba7){var _0x5bb4ef=function(_0x139dda){while(--_0x139dda){_0x38d072['push'](_0x38d072['shift']());}};_0x5bb4ef(++_0x582ba7);}(_0x4475,0x1de));var _0x5447=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4475[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x5447('0x0'));var util=require(_0x5447('0x1'));var path=require('path');var timeout=require(_0x5447('0x2'));var express=require(_0x5447('0x3'));var router=express[_0x5447('0x4')]();var fs_extra=require(_0x5447('0x5'));var auth=require(_0x5447('0x6'));var interaction=require(_0x5447('0x7'));var config=require('../../config/environment');var controller=require(_0x5447('0x8'));router[_0x5447('0x9')]('/',auth[_0x5447('0xa')](),controller[_0x5447('0xb')]);router['get'](_0x5447('0xc'),auth[_0x5447('0xa')](),controller[_0x5447('0xd')]);router[_0x5447('0x9')](_0x5447('0xe'),auth[_0x5447('0xa')](),controller[_0x5447('0xf')]);router[_0x5447('0x10')]('/',auth[_0x5447('0xa')](),controller[_0x5447('0x11')]);router[_0x5447('0x12')](_0x5447('0xe'),auth[_0x5447('0xa')](),controller[_0x5447('0x13')]);router[_0x5447('0x14')](_0x5447('0xe'),auth['isAuthenticated'](),controller[_0x5447('0x15')]);module[_0x5447('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index b1bfc6b..6cbdd7e 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 _0xa921=['DATE','moment','exports','STRING'];(function(_0x3cde2e,_0x1d3514){var _0x39cae4=function(_0x405ff2){while(--_0x405ff2){_0x3cde2e['push'](_0x3cde2e['shift']());}};_0x39cae4(++_0x1d3514);}(_0xa921,0x181));var _0x1a92=function(_0x1dfb69,_0x5629de){_0x1dfb69=_0x1dfb69-0x0;var _0x589757=_0xa921[_0x1dfb69];return _0x589757;};'use strict';var moment=require(_0x1a92('0x0'));var Sequelize=require('sequelize');module[_0x1a92('0x1')]={'uniqueid':{'type':Sequelize[_0x1a92('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x1a92('0x2')]},'joinAt':{'type':Sequelize[_0x1a92('0x3')]},'leaveAt':{'type':Sequelize[_0x1a92('0x3')]},'acceptAt':{'type':Sequelize[_0x1a92('0x3')]},'exitAt':{'type':Sequelize[_0x1a92('0x3')]},'reason':{'type':Sequelize[_0x1a92('0x2')]}}; \ No newline at end of file +var _0x88ff=['DATE','moment','sequelize','exports','STRING'];(function(_0x52eea5,_0x45820e){var _0x2afdb8=function(_0x28c594){while(--_0x28c594){_0x52eea5['push'](_0x52eea5['shift']());}};_0x2afdb8(++_0x45820e);}(_0x88ff,0x196));var _0xf88f=function(_0x42bbc8,_0x231dbd){_0x42bbc8=_0x42bbc8-0x0;var _0x4a2a4f=_0x88ff[_0x42bbc8];return _0x4a2a4f;};'use strict';var moment=require(_0xf88f('0x0'));var Sequelize=require(_0xf88f('0x1'));module[_0xf88f('0x2')]={'uniqueid':{'type':Sequelize[_0xf88f('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xf88f('0x3')]},'joinAt':{'type':Sequelize[_0xf88f('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xf88f('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index cb10bd1..be264fe 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 _0x044c=['include','findAll','rawAttributes','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','set','Content-Range','json','reject','save','update','destroy','then','error','stack','name','index','map','OpenchannelQueueReport','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x191307,_0x357a37){var _0x1090d0=function(_0x452d10){while(--_0x452d10){_0x191307['push'](_0x191307['shift']());}};_0x1090d0(++_0x357a37);}(_0x044c,0x16b));var _0xc044=function(_0x491192,_0x43417b){_0x491192=_0x491192-0x0;var _0x24a1e1=_0x044c[_0x491192];return _0x24a1e1;};'use strict';var emlformat=require(_0xc044('0x0'));var rimraf=require(_0xc044('0x1'));var zipdir=require(_0xc044('0x2'));var jsonpatch=require(_0xc044('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc044('0x4'));var Mustache=require(_0xc044('0x5'));var util=require(_0xc044('0x6'));var path=require(_0xc044('0x7'));var sox=require(_0xc044('0x8'));var csv=require(_0xc044('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc044('0xa'));var _=require('lodash');var squel=require(_0xc044('0xb'));var crypto=require(_0xc044('0xc'));var jsforce=require(_0xc044('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc044('0x9'));var querystring=require('querystring');var Papa=require(_0xc044('0xe'));var Redis=require('ioredis');var authService=require(_0xc044('0xf'));var qs=require(_0xc044('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc044('0x11'));var logger=require('../../config/logger')(_0xc044('0x12'));var utils=require(_0xc044('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc044('0x14'));var db=require(_0xc044('0x15'))['db'];function respondWithStatusCode(_0xcbd7e5,_0x10d4c2){_0x10d4c2=_0x10d4c2||0xcc;return function(_0x34b24d){if(_0x34b24d){return _0xcbd7e5[_0xc044('0x16')](_0x10d4c2);}return _0xcbd7e5[_0xc044('0x17')](_0x10d4c2)[_0xc044('0x18')]();};}function respondWithResult(_0x1e54cf,_0x43da98){_0x43da98=_0x43da98||0xc8;return function(_0x34a9ec){if(_0x34a9ec){return _0x1e54cf['status'](_0x43da98)['json'](_0x34a9ec);}};}function respondWithFilteredResult(_0x54db49,_0x329e44){return function(_0x3efa59){if(_0x3efa59){var _0x5af1f5=typeof _0x329e44[_0xc044('0x19')]==='undefined'&&typeof _0x329e44[_0xc044('0x1a')]===_0xc044('0x1b');var _0xa597d3=_0x3efa59['count'];var _0x5b8ea9=_0x5af1f5?0x0:_0x329e44[_0xc044('0x19')];var _0x57caae=_0x5af1f5?_0x3efa59['count']:_0x329e44['offset']+_0x329e44[_0xc044('0x1a')];var _0x530bf5;if(_0x57caae>=_0xa597d3){_0x57caae=_0xa597d3;_0x530bf5=0xc8;}else{_0x530bf5=0xce;}_0x54db49[_0xc044('0x17')](_0x530bf5);return _0x54db49[_0xc044('0x1c')](_0xc044('0x1d'),_0x5b8ea9+'-'+_0x57caae+'/'+_0xa597d3)[_0xc044('0x1e')](_0x3efa59);}return null;};}function patchUpdates(_0x6e7882){return function(_0x26682b){try{jsonpatch['apply'](_0x26682b,_0x6e7882,!![]);}catch(_0x5d68ce){return BPromise[_0xc044('0x1f')](_0x5d68ce);}return _0x26682b[_0xc044('0x20')]();};}function saveUpdates(_0xaab5a,_0x4c0d94){return function(_0x1e88cb){if(_0x1e88cb){return _0x1e88cb[_0xc044('0x21')](_0xaab5a)['then'](function(_0x2ebee0){return _0x2ebee0;});}return null;};}function removeEntity(_0x580706,_0x4af50a){return function(_0x5608cb){if(_0x5608cb){return _0x5608cb[_0xc044('0x22')]()[_0xc044('0x23')](function(){_0x580706[_0xc044('0x17')](0xcc)[_0xc044('0x18')]();});}};}function handleEntityNotFound(_0x530da9,_0x3778){return function(_0x128f92){if(!_0x128f92){_0x530da9[_0xc044('0x16')](0x194);}return _0x128f92;};}function handleError(_0x1e70c3,_0x21f166){_0x21f166=_0x21f166||0x1f4;return function(_0x42758d){logger[_0xc044('0x24')](_0x42758d[_0xc044('0x25')]);if(_0x42758d[_0xc044('0x26')]){delete _0x42758d['name'];}_0x1e70c3[_0xc044('0x17')](_0x21f166)['send'](_0x42758d);};}exports[_0xc044('0x27')]=function(_0x56f823,_0x4883c8){var _0x422df7={},_0x3c5036={},_0x466871={'count':0x0,'rows':[]};var _0x4e5950=_[_0xc044('0x28')](db[_0xc044('0x29')]['rawAttributes'],function(_0x5b8aeb){return{'name':_0x5b8aeb[_0xc044('0x2a')],'type':_0x5b8aeb[_0xc044('0x2b')][_0xc044('0x2c')]};});_0x3c5036['model']=_[_0xc044('0x28')](_0x4e5950,_0xc044('0x26'));_0x3c5036[_0xc044('0x2d')]=_[_0xc044('0x2e')](_0x56f823[_0xc044('0x2d')]);_0x3c5036[_0xc044('0x2f')]=_[_0xc044('0x30')](_0x3c5036[_0xc044('0x31')],_0x3c5036[_0xc044('0x2d')]);_0x422df7[_0xc044('0x32')]=_[_0xc044('0x30')](_0x3c5036['model'],qs[_0xc044('0x33')](_0x56f823[_0xc044('0x2d')][_0xc044('0x33')]));_0x422df7[_0xc044('0x32')]=_0x422df7[_0xc044('0x32')][_0xc044('0x34')]?_0x422df7[_0xc044('0x32')]:_0x3c5036[_0xc044('0x31')];if(!_0x56f823[_0xc044('0x2d')][_0xc044('0x35')](_0xc044('0x36'))){_0x422df7['limit']=qs[_0xc044('0x1a')](_0x56f823[_0xc044('0x2d')][_0xc044('0x1a')]);_0x422df7[_0xc044('0x19')]=qs['offset'](_0x56f823[_0xc044('0x2d')][_0xc044('0x19')]);}_0x422df7['order']=qs[_0xc044('0x37')](_0x56f823[_0xc044('0x2d')][_0xc044('0x37')]);_0x422df7[_0xc044('0x38')]=qs[_0xc044('0x2f')](_[_0xc044('0x39')](_0x56f823[_0xc044('0x2d')],_0x3c5036['filters']),_0x4e5950);if(_0x56f823[_0xc044('0x2d')][_0xc044('0x3a')]){_0x422df7['where']=_[_0xc044('0x3b')](_0x422df7['where'],{'$or':_[_0xc044('0x28')](_0x4e5950,function(_0x203522){if(_0x203522[_0xc044('0x2b')]!==_0xc044('0x3c')){var _0xceeeca={};_0xceeeca[_0x203522[_0xc044('0x26')]]={'$like':'%'+_0x56f823[_0xc044('0x2d')][_0xc044('0x3a')]+'%'};return _0xceeeca;}})});}_0x422df7=_[_0xc044('0x3b')]({},_0x422df7,_0x56f823[_0xc044('0x3d')]);var _0x5d8561={'where':_0x422df7[_0xc044('0x38')]};return db[_0xc044('0x29')]['count'](_0x5d8561)[_0xc044('0x23')](function(_0x5e55a3){_0x466871['count']=_0x5e55a3;if(_0x56f823[_0xc044('0x2d')][_0xc044('0x3e')]){_0x422df7[_0xc044('0x3f')]=[{'all':!![]}];}return db[_0xc044('0x29')][_0xc044('0x40')](_0x422df7);})[_0xc044('0x23')](function(_0x4d84f8){_0x466871['rows']=_0x4d84f8;return _0x466871;})[_0xc044('0x23')](respondWithFilteredResult(_0x4883c8,_0x422df7))['catch'](handleError(_0x4883c8,null));};exports['show']=function(_0x552d1d,_0x1e61bf){var _0x3ac59={'raw':!![],'where':{'id':_0x552d1d['params']['id']}},_0x3c06df={};_0x3c06df[_0xc044('0x31')]=_['keys'](db[_0xc044('0x29')][_0xc044('0x41')]);_0x3c06df['query']=_[_0xc044('0x2e')](_0x552d1d[_0xc044('0x2d')]);_0x3c06df['filters']=_['intersection'](_0x3c06df[_0xc044('0x31')],_0x3c06df[_0xc044('0x2d')]);_0x3ac59[_0xc044('0x32')]=_['intersection'](_0x3c06df['model'],qs[_0xc044('0x33')](_0x552d1d['query'][_0xc044('0x33')]));_0x3ac59[_0xc044('0x32')]=_0x3ac59['attributes'][_0xc044('0x34')]?_0x3ac59[_0xc044('0x32')]:_0x3c06df[_0xc044('0x31')];if(_0x552d1d[_0xc044('0x2d')][_0xc044('0x3e')]){_0x3ac59[_0xc044('0x3f')]=[{'all':!![]}];}_0x3ac59=_[_0xc044('0x3b')]({},_0x3ac59,_0x552d1d[_0xc044('0x3d')]);return db['OpenchannelQueueReport'][_0xc044('0x42')](_0x3ac59)[_0xc044('0x23')](handleEntityNotFound(_0x1e61bf,null))[_0xc044('0x23')](respondWithResult(_0x1e61bf,null))[_0xc044('0x43')](handleError(_0x1e61bf,null));};exports[_0xc044('0x44')]=function(_0x5ca9db,_0x2e8db8){return db[_0xc044('0x29')][_0xc044('0x44')](_0x5ca9db[_0xc044('0x45')],{})[_0xc044('0x23')](respondWithResult(_0x2e8db8,0xc9))[_0xc044('0x43')](handleError(_0x2e8db8,null));};exports[_0xc044('0x21')]=function(_0x56d88d,_0x385d9d){if(_0x56d88d[_0xc044('0x45')]['id']){delete _0x56d88d[_0xc044('0x45')]['id'];}return db[_0xc044('0x29')]['find']({'where':{'id':_0x56d88d['params']['id']}})[_0xc044('0x23')](handleEntityNotFound(_0x385d9d,null))[_0xc044('0x23')](saveUpdates(_0x56d88d[_0xc044('0x45')],null))[_0xc044('0x23')](respondWithResult(_0x385d9d,null))[_0xc044('0x43')](handleError(_0x385d9d,null));};exports[_0xc044('0x22')]=function(_0x413457,_0x55f9d9){return db['OpenchannelQueueReport'][_0xc044('0x42')]({'where':{'id':_0x413457['params']['id']}})[_0xc044('0x23')](handleEntityNotFound(_0x55f9d9,null))[_0xc044('0x23')](removeEntity(_0x55f9d9,null))[_0xc044('0x43')](handleError(_0x55f9d9,null));};exports[_0xc044('0x46')]=function(_0x4cdaa8,_0x31741d){return db[_0xc044('0x29')][_0xc044('0x46')]()[_0xc044('0x23')](respondWithResult(_0x31741d,null))['catch'](handleError(_0x31741d,null));}; \ No newline at end of file +var _0x185f=['squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','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','util','sox','to-csv','ejs','lodash'];(function(_0x5c993d,_0x1efa08){var _0x293459=function(_0x4f2685){while(--_0x4f2685){_0x5c993d['push'](_0x5c993d['shift']());}};_0x293459(++_0x1efa08);}(_0x185f,0x12f));var _0xf185=function(_0x2288af,_0x54e639){_0x2288af=_0x2288af-0x0;var _0x13e6a1=_0x185f[_0x2288af];return _0x13e6a1;};'use strict';var emlformat=require(_0xf185('0x0'));var rimraf=require(_0xf185('0x1'));var zipdir=require(_0xf185('0x2'));var jsonpatch=require(_0xf185('0x3'));var rp=require(_0xf185('0x4'));var moment=require(_0xf185('0x5'));var BPromise=require(_0xf185('0x6'));var Mustache=require(_0xf185('0x7'));var util=require(_0xf185('0x8'));var path=require('path');var sox=require(_0xf185('0x9'));var csv=require(_0xf185('0xa'));var ejs=require(_0xf185('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf185('0xc'));var squel=require(_0xf185('0xd'));var crypto=require(_0xf185('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf185('0xf'));var toCsv=require(_0xf185('0xa'));var querystring=require(_0xf185('0x10'));var Papa=require('papaparse');var Redis=require(_0xf185('0x11'));var authService=require(_0xf185('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf185('0x13'));var hardwareService=require(_0xf185('0x14'));var logger=require('../../config/logger')(_0xf185('0x15'));var utils=require('../../config/utils');var config=require(_0xf185('0x16'));var licenseUtil=require(_0xf185('0x17'));var db=require(_0xf185('0x18'))['db'];function respondWithStatusCode(_0x8b4aef,_0x51b627){_0x51b627=_0x51b627||0xcc;return function(_0x12e44c){if(_0x12e44c){return _0x8b4aef[_0xf185('0x19')](_0x51b627);}return _0x8b4aef[_0xf185('0x1a')](_0x51b627)[_0xf185('0x1b')]();};}function respondWithResult(_0x452920,_0x414f6a){_0x414f6a=_0x414f6a||0xc8;return function(_0x341e81){if(_0x341e81){return _0x452920[_0xf185('0x1a')](_0x414f6a)['json'](_0x341e81);}};}function respondWithFilteredResult(_0x4c118d,_0x914c20){return function(_0x28fa0a){if(_0x28fa0a){var _0x32f544=typeof _0x914c20[_0xf185('0x1c')]===_0xf185('0x1d')&&typeof _0x914c20['limit']===_0xf185('0x1d');var _0x41ff90=_0x28fa0a[_0xf185('0x1e')];var _0xf0f55e=_0x32f544?0x0:_0x914c20[_0xf185('0x1c')];var _0x207fc1=_0x32f544?_0x28fa0a[_0xf185('0x1e')]:_0x914c20[_0xf185('0x1c')]+_0x914c20[_0xf185('0x1f')];var _0x468f71;if(_0x207fc1>=_0x41ff90){_0x207fc1=_0x41ff90;_0x468f71=0xc8;}else{_0x468f71=0xce;}_0x4c118d[_0xf185('0x1a')](_0x468f71);return _0x4c118d[_0xf185('0x20')](_0xf185('0x21'),_0xf0f55e+'-'+_0x207fc1+'/'+_0x41ff90)[_0xf185('0x22')](_0x28fa0a);}return null;};}function patchUpdates(_0x4be92d){return function(_0x398349){try{jsonpatch[_0xf185('0x23')](_0x398349,_0x4be92d,!![]);}catch(_0x1d74fa){return BPromise[_0xf185('0x24')](_0x1d74fa);}return _0x398349[_0xf185('0x25')]();};}function saveUpdates(_0x2bb4de,_0x327af6){return function(_0x39fd6c){if(_0x39fd6c){return _0x39fd6c[_0xf185('0x26')](_0x2bb4de)[_0xf185('0x27')](function(_0x151efd){return _0x151efd;});}return null;};}function removeEntity(_0x260d29,_0x247515){return function(_0x48b523){if(_0x48b523){return _0x48b523[_0xf185('0x28')]()[_0xf185('0x27')](function(){_0x260d29[_0xf185('0x1a')](0xcc)[_0xf185('0x1b')]();});}};}function handleEntityNotFound(_0xe17c93,_0x2529ce){return function(_0x1940c1){if(!_0x1940c1){_0xe17c93[_0xf185('0x19')](0x194);}return _0x1940c1;};}function handleError(_0x2dfcbb,_0x396d52){_0x396d52=_0x396d52||0x1f4;return function(_0x4d4335){logger[_0xf185('0x29')](_0x4d4335[_0xf185('0x2a')]);if(_0x4d4335[_0xf185('0x2b')]){delete _0x4d4335[_0xf185('0x2b')];}_0x2dfcbb['status'](_0x396d52)[_0xf185('0x2c')](_0x4d4335);};}exports[_0xf185('0x2d')]=function(_0x4e67c8,_0x357680){var _0x4ccc86={},_0x1a0658={},_0x166e60={'count':0x0,'rows':[]};var _0x41edb9=_[_0xf185('0x2e')](db[_0xf185('0x2f')][_0xf185('0x30')],function(_0x306eb8){return{'name':_0x306eb8[_0xf185('0x31')],'type':_0x306eb8[_0xf185('0x32')][_0xf185('0x33')]};});_0x1a0658[_0xf185('0x34')]=_[_0xf185('0x2e')](_0x41edb9,_0xf185('0x2b'));_0x1a0658[_0xf185('0x35')]=_['keys'](_0x4e67c8[_0xf185('0x35')]);_0x1a0658[_0xf185('0x36')]=_[_0xf185('0x37')](_0x1a0658[_0xf185('0x34')],_0x1a0658['query']);_0x4ccc86['attributes']=_[_0xf185('0x37')](_0x1a0658[_0xf185('0x34')],qs[_0xf185('0x38')](_0x4e67c8[_0xf185('0x35')][_0xf185('0x38')]));_0x4ccc86[_0xf185('0x39')]=_0x4ccc86[_0xf185('0x39')][_0xf185('0x3a')]?_0x4ccc86[_0xf185('0x39')]:_0x1a0658[_0xf185('0x34')];if(!_0x4e67c8[_0xf185('0x35')]['hasOwnProperty'](_0xf185('0x3b'))){_0x4ccc86['limit']=qs[_0xf185('0x1f')](_0x4e67c8[_0xf185('0x35')]['limit']);_0x4ccc86['offset']=qs[_0xf185('0x1c')](_0x4e67c8[_0xf185('0x35')]['offset']);}_0x4ccc86['order']=qs[_0xf185('0x3c')](_0x4e67c8[_0xf185('0x35')][_0xf185('0x3c')]);_0x4ccc86['where']=qs[_0xf185('0x36')](_[_0xf185('0x3d')](_0x4e67c8['query'],_0x1a0658[_0xf185('0x36')]),_0x41edb9);if(_0x4e67c8[_0xf185('0x35')][_0xf185('0x3e')]){_0x4ccc86[_0xf185('0x3f')]=_[_0xf185('0x40')](_0x4ccc86['where'],{'$or':_[_0xf185('0x2e')](_0x41edb9,function(_0x1cb61e){if(_0x1cb61e['type']!==_0xf185('0x41')){var _0x54bbc2={};_0x54bbc2[_0x1cb61e[_0xf185('0x2b')]]={'$like':'%'+_0x4e67c8['query']['filter']+'%'};return _0x54bbc2;}})});}_0x4ccc86=_[_0xf185('0x40')]({},_0x4ccc86,_0x4e67c8[_0xf185('0x42')]);var _0x8fa815={'where':_0x4ccc86[_0xf185('0x3f')]};return db[_0xf185('0x2f')][_0xf185('0x1e')](_0x8fa815)['then'](function(_0x6b7ef5){_0x166e60[_0xf185('0x1e')]=_0x6b7ef5;if(_0x4e67c8[_0xf185('0x35')][_0xf185('0x43')]){_0x4ccc86[_0xf185('0x44')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xf185('0x45')](_0x4ccc86);})[_0xf185('0x27')](function(_0x47d9ba){_0x166e60[_0xf185('0x46')]=_0x47d9ba;return _0x166e60;})[_0xf185('0x27')](respondWithFilteredResult(_0x357680,_0x4ccc86))[_0xf185('0x47')](handleError(_0x357680,null));};exports[_0xf185('0x48')]=function(_0xffd1bb,_0x16f496){var _0x66b63d={'raw':!![],'where':{'id':_0xffd1bb[_0xf185('0x49')]['id']}},_0x451075={};_0x451075['model']=_[_0xf185('0x4a')](db[_0xf185('0x2f')]['rawAttributes']);_0x451075[_0xf185('0x35')]=_[_0xf185('0x4a')](_0xffd1bb[_0xf185('0x35')]);_0x451075[_0xf185('0x36')]=_[_0xf185('0x37')](_0x451075['model'],_0x451075[_0xf185('0x35')]);_0x66b63d['attributes']=_['intersection'](_0x451075[_0xf185('0x34')],qs['fields'](_0xffd1bb[_0xf185('0x35')][_0xf185('0x38')]));_0x66b63d['attributes']=_0x66b63d[_0xf185('0x39')][_0xf185('0x3a')]?_0x66b63d[_0xf185('0x39')]:_0x451075[_0xf185('0x34')];if(_0xffd1bb[_0xf185('0x35')]['includeAll']){_0x66b63d[_0xf185('0x44')]=[{'all':!![]}];}_0x66b63d=_[_0xf185('0x40')]({},_0x66b63d,_0xffd1bb['options']);return db[_0xf185('0x2f')][_0xf185('0x4b')](_0x66b63d)[_0xf185('0x27')](handleEntityNotFound(_0x16f496,null))[_0xf185('0x27')](respondWithResult(_0x16f496,null))['catch'](handleError(_0x16f496,null));};exports[_0xf185('0x4c')]=function(_0x44487d,_0x2194b3){return db['OpenchannelQueueReport'][_0xf185('0x4c')](_0x44487d[_0xf185('0x4d')],{})['then'](respondWithResult(_0x2194b3,0xc9))[_0xf185('0x47')](handleError(_0x2194b3,null));};exports['update']=function(_0xbb7aed,_0x5b9f22){if(_0xbb7aed[_0xf185('0x4d')]['id']){delete _0xbb7aed[_0xf185('0x4d')]['id'];}return db[_0xf185('0x2f')][_0xf185('0x4b')]({'where':{'id':_0xbb7aed[_0xf185('0x49')]['id']}})[_0xf185('0x27')](handleEntityNotFound(_0x5b9f22,null))[_0xf185('0x27')](saveUpdates(_0xbb7aed[_0xf185('0x4d')],null))[_0xf185('0x27')](respondWithResult(_0x5b9f22,null))['catch'](handleError(_0x5b9f22,null));};exports[_0xf185('0x28')]=function(_0x39422c,_0x1ff11f){return db['OpenchannelQueueReport'][_0xf185('0x4b')]({'where':{'id':_0x39422c[_0xf185('0x49')]['id']}})['then'](handleEntityNotFound(_0x1ff11f,null))['then'](removeEntity(_0x1ff11f,null))['catch'](handleError(_0x1ff11f,null));};exports[_0xf185('0x4e')]=function(_0x53231a,_0x14b241){return db[_0xf185('0x2f')][_0xf185('0x4e')]()[_0xf185('0x27')](respondWithResult(_0x14b241,null))[_0xf185('0x47')](handleError(_0x14b241,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index d011877..f959efb 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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x35b0bb,_0x355853){var _0x119c96=function(_0x33fe4c){while(--_0x33fe4c){_0x35b0bb['push'](_0x35b0bb['shift']());}};_0x119c96(++_0x355853);}(_0x1261,0x144));var _0x1126=function(_0x251fa4,_0x3d5860){_0x251fa4=_0x251fa4-0x0;var _0x453047=_0x1261[_0x251fa4];return _0x453047;};'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 +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x5bbb5a,_0xb5f0d6){var _0x3b38c7=function(_0x48845a){while(--_0x48845a){_0x5bbb5a['push'](_0x5bbb5a['shift']());}};_0x3b38c7(++_0xb5f0d6);}(_0x5fc3,0xa8));var _0x35fc=function(_0xd1b4d7,_0x28b2c1){_0xd1b4d7=_0xd1b4d7-0x0;var _0x3002ec=_0x5fc3[_0xd1b4d7];return _0x3002ec;};'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 diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index a1845e8..deb7d88 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 _0x7fce=['options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes','limit','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','client','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','create','body'];(function(_0x1cd7cb,_0x9e7eff){var _0x33c2ca=function(_0x1df113){while(--_0x1df113){_0x1cd7cb['push'](_0x1cd7cb['shift']());}};_0x33c2ca(++_0x9e7eff);}(_0x7fce,0xdc));var _0xe7fc=function(_0x5db20c,_0x28c1d3){_0x5db20c=_0x5db20c-0x0;var _0x3fba82=_0x7fce[_0x5db20c];return _0x3fba82;};'use strict';var _=require(_0xe7fc('0x0'));var util=require(_0xe7fc('0x1'));var moment=require(_0xe7fc('0x2'));var BPromise=require('bluebird');var rs=require(_0xe7fc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe7fc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe7fc('0x5'))(_0xe7fc('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe7fc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4665f6,_0x161dca,_0x296b2e){return new BPromise(function(_0x19eeef,_0x22fabf){return client['request'](_0x4665f6,_0x296b2e)[_0xe7fc('0x8')](function(_0x4a1209){logger[_0xe7fc('0x9')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x161dca,_0xe7fc('0xa'));logger[_0xe7fc('0xb')](_0xe7fc('0xc'),_0x161dca,_0xe7fc('0xa'),JSON['stringify'](_0x4a1209));if(_0x4a1209[_0xe7fc('0xd')]){if(_0x4a1209[_0xe7fc('0xd')]['code']===0x1f4){logger['error'](_0xe7fc('0xe'),_0x161dca,_0x4a1209['error'][_0xe7fc('0xf')]);return _0x22fabf(_0x4a1209['error']['message']);}logger[_0xe7fc('0xd')](_0xe7fc('0xe'),_0x161dca,_0x4a1209[_0xe7fc('0xd')][_0xe7fc('0xf')]);return _0x19eeef(_0x4a1209[_0xe7fc('0xd')]['message']);}else{logger[_0xe7fc('0x9')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x161dca,'request\x20sent');_0x19eeef(_0x4a1209[_0xe7fc('0x10')][_0xe7fc('0xf')]);}})[_0xe7fc('0x11')](function(_0x3a44a6){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x161dca,_0x3a44a6);_0x22fabf(_0x3a44a6);});});}exports['CreateOpenchannelQueueReport']=function(_0x4aa4f0){var _0x52902f=this;return new Promise(function(_0x490a99,_0x14515d){return db['OpenchannelQueueReport'][_0xe7fc('0x12')](_0x4aa4f0[_0xe7fc('0x13')],{'raw':_0x4aa4f0[_0xe7fc('0x14')]?_0x4aa4f0[_0xe7fc('0x14')][_0xe7fc('0x15')]===undefined?!![]:![]:!![]})[_0xe7fc('0x8')](function(_0x329051){logger[_0xe7fc('0x9')]('CreateOpenchannelQueueReport',_0x4aa4f0);logger[_0xe7fc('0xb')](_0xe7fc('0x16'),_0x4aa4f0,JSON['stringify'](_0x329051));_0x490a99(_0x329051);})['catch'](function(_0x35bb53){logger[_0xe7fc('0xd')](_0xe7fc('0x16'),_0x35bb53[_0xe7fc('0xf')],_0x4aa4f0);_0x14515d(_0x52902f[_0xe7fc('0xd')](0x1f4,_0x35bb53[_0xe7fc('0xf')]));});});};exports[_0xe7fc('0x17')]=function(_0x1731b6){var _0xb00cb9=this;return new Promise(function(_0x3e7e7e,_0x1d1348){return db[_0xe7fc('0x18')][_0xe7fc('0x19')](_0x1731b6['body'],{'raw':_0x1731b6[_0xe7fc('0x14')]?_0x1731b6[_0xe7fc('0x14')][_0xe7fc('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1731b6[_0xe7fc('0x14')]?_0x1731b6[_0xe7fc('0x14')][_0xe7fc('0x1a')]||null:null,'attributes':_0x1731b6['options']?_0x1731b6[_0xe7fc('0x14')][_0xe7fc('0x1b')]||null:null,'limit':_0x1731b6[_0xe7fc('0x14')]?_0x1731b6[_0xe7fc('0x14')][_0xe7fc('0x1c')]||null:null})[_0xe7fc('0x8')](function(_0x383ca6){logger['info'](_0xe7fc('0x17'),_0x1731b6);logger[_0xe7fc('0xb')]('UpdateOpenchannelQueueReport',_0x1731b6,JSON[_0xe7fc('0x1d')](_0x383ca6));_0x3e7e7e(_0x383ca6);})['catch'](function(_0x39d908){logger[_0xe7fc('0xd')]('UpdateOpenchannelQueueReport',_0x39d908[_0xe7fc('0xf')],_0x1731b6);_0x1d1348(_0xb00cb9['error'](0x1f4,_0x39d908[_0xe7fc('0xf')]));});});}; \ No newline at end of file +var _0x4e2e=['OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','OpenchannelQueueReport','create','body','options','raw','CreateOpenchannelQueueReport','debug','catch','update','attributes','UpdateOpenchannelQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x3c37b2,_0x38f81b){_0x3c37b2=_0x3c37b2-0x0;var _0x2d0774=_0x4e2e[_0x3c37b2];return _0x2d0774;};'use strict';var _=require('lodash');var util=require(_0xe4e2('0x0'));var moment=require(_0xe4e2('0x1'));var BPromise=require(_0xe4e2('0x2'));var rs=require(_0xe4e2('0x3'));var fs=require('fs');var Redis=require(_0xe4e2('0x4'));var db=require(_0xe4e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe4e2('0x6'))(_0xe4e2('0x7'));var config=require(_0xe4e2('0x8'));var jayson=require(_0xe4e2('0x9'));var client=jayson['client'][_0xe4e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36b1c6,_0x1c4e64,_0x125338){return new BPromise(function(_0x956c75,_0x27304b){return client[_0xe4e2('0xb')](_0x36b1c6,_0x125338)[_0xe4e2('0xc')](function(_0x4912da){logger[_0xe4e2('0xd')](_0xe4e2('0xe'),_0x1c4e64,_0xe4e2('0xf'));logger['debug'](_0xe4e2('0x10'),_0x1c4e64,_0xe4e2('0xf'),JSON[_0xe4e2('0x11')](_0x4912da));if(_0x4912da[_0xe4e2('0x12')]){if(_0x4912da[_0xe4e2('0x12')]['code']===0x1f4){logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x4912da[_0xe4e2('0x12')][_0xe4e2('0x13')]);return _0x27304b(_0x4912da['error'][_0xe4e2('0x13')]);}logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x4912da[_0xe4e2('0x12')][_0xe4e2('0x13')]);return _0x956c75(_0x4912da['error']['message']);}else{logger[_0xe4e2('0xd')](_0xe4e2('0xe'),_0x1c4e64,_0xe4e2('0xf'));_0x956c75(_0x4912da[_0xe4e2('0x14')][_0xe4e2('0x13')]);}})['catch'](function(_0x754778){logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x754778);_0x27304b(_0x754778);});});}exports['CreateOpenchannelQueueReport']=function(_0x196f16){var _0x54c80b=this;return new Promise(function(_0x1d5e9d,_0x3f313b){return db[_0xe4e2('0x15')][_0xe4e2('0x16')](_0x196f16[_0xe4e2('0x17')],{'raw':_0x196f16[_0xe4e2('0x18')]?_0x196f16[_0xe4e2('0x18')][_0xe4e2('0x19')]===undefined?!![]:![]:!![]})[_0xe4e2('0xc')](function(_0x362741){logger['info'](_0xe4e2('0x1a'),_0x196f16);logger[_0xe4e2('0x1b')](_0xe4e2('0x1a'),_0x196f16,JSON[_0xe4e2('0x11')](_0x362741));_0x1d5e9d(_0x362741);})[_0xe4e2('0x1c')](function(_0x23b466){logger[_0xe4e2('0x12')]('CreateOpenchannelQueueReport',_0x23b466[_0xe4e2('0x13')],_0x196f16);_0x3f313b(_0x54c80b[_0xe4e2('0x12')](0x1f4,_0x23b466[_0xe4e2('0x13')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x353030){var _0x12ad33=this;return new Promise(function(_0x598fa3,_0xcba85a){return db[_0xe4e2('0x15')][_0xe4e2('0x1d')](_0x353030[_0xe4e2('0x17')],{'raw':_0x353030[_0xe4e2('0x18')]?_0x353030['options'][_0xe4e2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x353030[_0xe4e2('0x18')]?_0x353030[_0xe4e2('0x18')]['where']||null:null,'attributes':_0x353030[_0xe4e2('0x18')]?_0x353030[_0xe4e2('0x18')][_0xe4e2('0x1e')]||null:null,'limit':_0x353030['options']?_0x353030[_0xe4e2('0x18')]['limit']||null:null})[_0xe4e2('0xc')](function(_0x1e21c0){logger['info'](_0xe4e2('0x1f'),_0x353030);logger[_0xe4e2('0x1b')](_0xe4e2('0x1f'),_0x353030,JSON[_0xe4e2('0x11')](_0x1e21c0));_0x598fa3(_0x1e21c0);})[_0xe4e2('0x1c')](function(_0x4d33de){logger['error'](_0xe4e2('0x1f'),_0x4d33de[_0xe4e2('0x13')],_0x353030);_0xcba85a(_0x12ad33[_0xe4e2('0x12')](0x1f4,_0x4d33de[_0xe4e2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index c9b7f32..e5384d5 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 _0x2cee=['isAuthenticated','index','/describe','describe','show','create','put','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get'];(function(_0x4bb849,_0xa2c928){var _0x2df4ee=function(_0x156230){while(--_0x156230){_0x4bb849['push'](_0x4bb849['shift']());}};_0x2df4ee(++_0xa2c928);}(_0x2cee,0x6d));var _0xe2ce=function(_0x34f24f,_0x722b97){_0x34f24f=_0x34f24f-0x0;var _0xaba4ab=_0x2cee[_0x34f24f];return _0xaba4ab;};'use strict';var multer=require(_0xe2ce('0x0'));var util=require('util');var path=require(_0xe2ce('0x1'));var timeout=require(_0xe2ce('0x2'));var express=require(_0xe2ce('0x3'));var router=express[_0xe2ce('0x4')]();var fs_extra=require(_0xe2ce('0x5'));var auth=require(_0xe2ce('0x6'));var interaction=require(_0xe2ce('0x7'));var config=require(_0xe2ce('0x8'));var controller=require(_0xe2ce('0x9'));router[_0xe2ce('0xa')]('/',auth[_0xe2ce('0xb')](),controller[_0xe2ce('0xc')]);router[_0xe2ce('0xa')](_0xe2ce('0xd'),auth[_0xe2ce('0xb')](),controller[_0xe2ce('0xe')]);router['get']('/:id',auth[_0xe2ce('0xb')](),controller[_0xe2ce('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe2ce('0x10')]);router[_0xe2ce('0x11')]('/:id',auth[_0xe2ce('0xb')](),controller[_0xe2ce('0x12')]);router['delete']('/:id',auth[_0xe2ce('0xb')](),controller[_0xe2ce('0x13')]);module['exports']=router; \ No newline at end of file +var _0xb6ec=['put','update','delete','destroy','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','create'];(function(_0x35f83e,_0x30ec55){var _0x249b05=function(_0x2c2fcc){while(--_0x2c2fcc){_0x35f83e['push'](_0x35f83e['shift']());}};_0x249b05(++_0x30ec55);}(_0xb6ec,0xfb));var _0xcb6e=function(_0x20ed87,_0x1cdbfd){_0x20ed87=_0x20ed87-0x0;var _0x2961e0=_0xb6ec[_0x20ed87];return _0x2961e0;};'use strict';var multer=require(_0xcb6e('0x0'));var util=require(_0xcb6e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcb6e('0x2'));var router=express[_0xcb6e('0x3')]();var fs_extra=require(_0xcb6e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcb6e('0x5'));var config=require(_0xcb6e('0x6'));var controller=require('./openchannelTransferReport.controller');router[_0xcb6e('0x7')]('/',auth['isAuthenticated'](),controller[_0xcb6e('0x8')]);router[_0xcb6e('0x7')](_0xcb6e('0x9'),auth[_0xcb6e('0xa')](),controller[_0xcb6e('0xb')]);router[_0xcb6e('0x7')](_0xcb6e('0xc'),auth[_0xcb6e('0xa')](),controller[_0xcb6e('0xd')]);router['post']('/',auth[_0xcb6e('0xa')](),controller[_0xcb6e('0xe')]);router[_0xcb6e('0xf')](_0xcb6e('0xc'),auth[_0xcb6e('0xa')](),controller[_0xcb6e('0x10')]);router[_0xcb6e('0x11')](_0xcb6e('0xc'),auth[_0xcb6e('0xa')](),controller[_0xcb6e('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index fc7e695..11a6e90 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x4a095e,_0x381cd5){var _0x10ef73=function(_0x1f6964){while(--_0x1f6964){_0x4a095e['push'](_0x4a095e['shift']());}};_0x10ef73(++_0x381cd5);}(_0x9c44,0x178));var _0x49c4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9c44[_0x3d42d8];return _0x27fc41;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x50ebdc,_0xa97455){var _0x135f61=function(_0x3f3436){while(--_0x3f3436){_0x50ebdc['push'](_0x50ebdc['shift']());}};_0x135f61(++_0xa97455);}(_0x4b84,0x1cc));var _0x44b8=function(_0x4ca333,_0x1218a3){_0x4ca333=_0x4ca333-0x0;var _0x13b2e1=_0x4b84[_0x4ca333];return _0x13b2e1;};'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 diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 2ffe463..6d6cdfb 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 _0xf413=['include','findAll','rows','show','params','keys','rawAttributes','options','find','catch','create','body','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','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','undefined','count','offset','set','Content-Range','json','reject','save','update','destroy','then','stack','name','index','OpenchannelTransferReport','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','merge','map','VIRTUAL','filter','includeAll'];(function(_0x46167a,_0x5698b8){var _0x460872=function(_0x23f06c){while(--_0x23f06c){_0x46167a['push'](_0x46167a['shift']());}};_0x460872(++_0x5698b8);}(_0xf413,0x1ce));var _0x3f41=function(_0x3fa10c,_0x1db998){_0x3fa10c=_0x3fa10c-0x0;var _0x1ed01b=_0xf413[_0x3fa10c];return _0x1ed01b;};'use strict';var emlformat=require(_0x3f41('0x0'));var rimraf=require(_0x3f41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3f41('0x2'));var rp=require(_0x3f41('0x3'));var moment=require(_0x3f41('0x4'));var BPromise=require(_0x3f41('0x5'));var Mustache=require(_0x3f41('0x6'));var util=require(_0x3f41('0x7'));var path=require('path');var sox=require(_0x3f41('0x8'));var csv=require(_0x3f41('0x9'));var ejs=require(_0x3f41('0xa'));var fs=require('fs');var fs_extra=require(_0x3f41('0xb'));var _=require(_0x3f41('0xc'));var squel=require(_0x3f41('0xd'));var crypto=require(_0x3f41('0xe'));var jsforce=require(_0x3f41('0xf'));var deskjs=require(_0x3f41('0x10'));var toCsv=require(_0x3f41('0x9'));var querystring=require(_0x3f41('0x11'));var Papa=require(_0x3f41('0x12'));var Redis=require('ioredis');var authService=require(_0x3f41('0x13'));var qs=require(_0x3f41('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f41('0x15'))(_0x3f41('0x16'));var utils=require(_0x3f41('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3f41('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5fc2f9,_0x6e7b20){_0x6e7b20=_0x6e7b20||0xcc;return function(_0x295bee){if(_0x295bee){return _0x5fc2f9[_0x3f41('0x19')](_0x6e7b20);}return _0x5fc2f9[_0x3f41('0x1a')](_0x6e7b20)[_0x3f41('0x1b')]();};}function respondWithResult(_0x92abd9,_0x563f37){_0x563f37=_0x563f37||0xc8;return function(_0x599a8a){if(_0x599a8a){return _0x92abd9['status'](_0x563f37)['json'](_0x599a8a);}};}function respondWithFilteredResult(_0x221b81,_0x394a3c){return function(_0x12b1eb){if(_0x12b1eb){var _0x42033c=typeof _0x394a3c['offset']===_0x3f41('0x1c')&&typeof _0x394a3c['limit']===_0x3f41('0x1c');var _0x439090=_0x12b1eb[_0x3f41('0x1d')];var _0x6c3a29=_0x42033c?0x0:_0x394a3c[_0x3f41('0x1e')];var _0x41d731=_0x42033c?_0x12b1eb[_0x3f41('0x1d')]:_0x394a3c[_0x3f41('0x1e')]+_0x394a3c['limit'];var _0x58e59e;if(_0x41d731>=_0x439090){_0x41d731=_0x439090;_0x58e59e=0xc8;}else{_0x58e59e=0xce;}_0x221b81['status'](_0x58e59e);return _0x221b81[_0x3f41('0x1f')](_0x3f41('0x20'),_0x6c3a29+'-'+_0x41d731+'/'+_0x439090)[_0x3f41('0x21')](_0x12b1eb);}return null;};}function patchUpdates(_0x211010){return function(_0x194e11){try{jsonpatch['apply'](_0x194e11,_0x211010,!![]);}catch(_0x1b60bf){return BPromise[_0x3f41('0x22')](_0x1b60bf);}return _0x194e11[_0x3f41('0x23')]();};}function saveUpdates(_0x12dbb3,_0x3e9f3f){return function(_0x5dbbdf){if(_0x5dbbdf){return _0x5dbbdf[_0x3f41('0x24')](_0x12dbb3)['then'](function(_0x2508b2){return _0x2508b2;});}return null;};}function removeEntity(_0x29cbcc,_0x28b328){return function(_0x51474e){if(_0x51474e){return _0x51474e[_0x3f41('0x25')]()[_0x3f41('0x26')](function(){_0x29cbcc[_0x3f41('0x1a')](0xcc)[_0x3f41('0x1b')]();});}};}function handleEntityNotFound(_0x9188fe,_0x10358c){return function(_0x25c1cf){if(!_0x25c1cf){_0x9188fe[_0x3f41('0x19')](0x194);}return _0x25c1cf;};}function handleError(_0x1168fa,_0x4216d1){_0x4216d1=_0x4216d1||0x1f4;return function(_0x35e58a){logger['error'](_0x35e58a[_0x3f41('0x27')]);if(_0x35e58a[_0x3f41('0x28')]){delete _0x35e58a[_0x3f41('0x28')];}_0x1168fa['status'](_0x4216d1)['send'](_0x35e58a);};}exports[_0x3f41('0x29')]=function(_0x355968,_0x7c0795){var _0x5dafa6={},_0x430cc3={},_0x28ab78={'count':0x0,'rows':[]};var _0x3f1aae=_['map'](db[_0x3f41('0x2a')]['rawAttributes'],function(_0x54a6eb){return{'name':_0x54a6eb['fieldName'],'type':_0x54a6eb[_0x3f41('0x2b')][_0x3f41('0x2c')]};});_0x430cc3[_0x3f41('0x2d')]=_['map'](_0x3f1aae,'name');_0x430cc3[_0x3f41('0x2e')]=_['keys'](_0x355968[_0x3f41('0x2e')]);_0x430cc3['filters']=_[_0x3f41('0x2f')](_0x430cc3[_0x3f41('0x2d')],_0x430cc3[_0x3f41('0x2e')]);_0x5dafa6[_0x3f41('0x30')]=_[_0x3f41('0x2f')](_0x430cc3[_0x3f41('0x2d')],qs[_0x3f41('0x31')](_0x355968['query']['fields']));_0x5dafa6[_0x3f41('0x30')]=_0x5dafa6[_0x3f41('0x30')][_0x3f41('0x32')]?_0x5dafa6[_0x3f41('0x30')]:_0x430cc3[_0x3f41('0x2d')];if(!_0x355968['query'][_0x3f41('0x33')](_0x3f41('0x34'))){_0x5dafa6[_0x3f41('0x35')]=qs['limit'](_0x355968[_0x3f41('0x2e')][_0x3f41('0x35')]);_0x5dafa6[_0x3f41('0x1e')]=qs[_0x3f41('0x1e')](_0x355968[_0x3f41('0x2e')][_0x3f41('0x1e')]);}_0x5dafa6['order']=qs['sort'](_0x355968[_0x3f41('0x2e')][_0x3f41('0x36')]);_0x5dafa6[_0x3f41('0x37')]=qs[_0x3f41('0x38')](_[_0x3f41('0x39')](_0x355968[_0x3f41('0x2e')],_0x430cc3['filters']),_0x3f1aae);if(_0x355968[_0x3f41('0x2e')]['filter']){_0x5dafa6['where']=_[_0x3f41('0x3a')](_0x5dafa6[_0x3f41('0x37')],{'$or':_[_0x3f41('0x3b')](_0x3f1aae,function(_0x409816){if(_0x409816[_0x3f41('0x2b')]!==_0x3f41('0x3c')){var _0x89dd0a={};_0x89dd0a[_0x409816[_0x3f41('0x28')]]={'$like':'%'+_0x355968[_0x3f41('0x2e')][_0x3f41('0x3d')]+'%'};return _0x89dd0a;}})});}_0x5dafa6=_[_0x3f41('0x3a')]({},_0x5dafa6,_0x355968['options']);var _0x230ef7={'where':_0x5dafa6['where']};return db['OpenchannelTransferReport'][_0x3f41('0x1d')](_0x230ef7)['then'](function(_0x37d0d5){_0x28ab78[_0x3f41('0x1d')]=_0x37d0d5;if(_0x355968[_0x3f41('0x2e')][_0x3f41('0x3e')]){_0x5dafa6[_0x3f41('0x3f')]=[{'all':!![]}];}return db[_0x3f41('0x2a')][_0x3f41('0x40')](_0x5dafa6);})['then'](function(_0x3639f7){_0x28ab78[_0x3f41('0x41')]=_0x3639f7;return _0x28ab78;})[_0x3f41('0x26')](respondWithFilteredResult(_0x7c0795,_0x5dafa6))['catch'](handleError(_0x7c0795,null));};exports[_0x3f41('0x42')]=function(_0x1d8a36,_0x2f2d83){var _0x2308da={'raw':!![],'where':{'id':_0x1d8a36[_0x3f41('0x43')]['id']}},_0x1977af={};_0x1977af[_0x3f41('0x2d')]=_[_0x3f41('0x44')](db['OpenchannelTransferReport'][_0x3f41('0x45')]);_0x1977af[_0x3f41('0x2e')]=_[_0x3f41('0x44')](_0x1d8a36[_0x3f41('0x2e')]);_0x1977af[_0x3f41('0x38')]=_[_0x3f41('0x2f')](_0x1977af['model'],_0x1977af[_0x3f41('0x2e')]);_0x2308da['attributes']=_[_0x3f41('0x2f')](_0x1977af[_0x3f41('0x2d')],qs['fields'](_0x1d8a36[_0x3f41('0x2e')]['fields']));_0x2308da[_0x3f41('0x30')]=_0x2308da['attributes']['length']?_0x2308da[_0x3f41('0x30')]:_0x1977af['model'];if(_0x1d8a36['query'][_0x3f41('0x3e')]){_0x2308da[_0x3f41('0x3f')]=[{'all':!![]}];}_0x2308da=_[_0x3f41('0x3a')]({},_0x2308da,_0x1d8a36[_0x3f41('0x46')]);return db['OpenchannelTransferReport'][_0x3f41('0x47')](_0x2308da)['then'](handleEntityNotFound(_0x2f2d83,null))[_0x3f41('0x26')](respondWithResult(_0x2f2d83,null))[_0x3f41('0x48')](handleError(_0x2f2d83,null));};exports['create']=function(_0x19b821,_0x10d393){return db['OpenchannelTransferReport'][_0x3f41('0x49')](_0x19b821[_0x3f41('0x4a')],{})[_0x3f41('0x26')](respondWithResult(_0x10d393,0xc9))[_0x3f41('0x48')](handleError(_0x10d393,null));};exports['update']=function(_0x3701d9,_0x5e099f){if(_0x3701d9[_0x3f41('0x4a')]['id']){delete _0x3701d9['body']['id'];}return db[_0x3f41('0x2a')][_0x3f41('0x47')]({'where':{'id':_0x3701d9['params']['id']}})[_0x3f41('0x26')](handleEntityNotFound(_0x5e099f,null))[_0x3f41('0x26')](saveUpdates(_0x3701d9[_0x3f41('0x4a')],null))[_0x3f41('0x26')](respondWithResult(_0x5e099f,null))[_0x3f41('0x48')](handleError(_0x5e099f,null));};exports[_0x3f41('0x25')]=function(_0x196e4b,_0x5e8446){return db[_0x3f41('0x2a')][_0x3f41('0x47')]({'where':{'id':_0x196e4b['params']['id']}})[_0x3f41('0x26')](handleEntityNotFound(_0x5e8446,null))['then'](removeEntity(_0x5e8446,null))['catch'](handleError(_0x5e8446,null));};exports['describe']=function(_0xf89c06,_0x4b7406){return db[_0x3f41('0x2a')]['describe']()[_0x3f41('0x26')](respondWithResult(_0x4b7406,null))['catch'](handleError(_0x4b7406,null));}; \ No newline at end of file +var _0x37ae=['sendStatus','stack','name','send','index','OpenchannelTransferReport','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','catch','show','include','options','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','apply','reject','save','update','then','destroy','end'];(function(_0x3e3936,_0x24c3a6){var _0x10be4e=function(_0x271a5d){while(--_0x271a5d){_0x3e3936['push'](_0x3e3936['shift']());}};_0x10be4e(++_0x24c3a6);}(_0x37ae,0xfd));var _0xe37a=function(_0x22663b,_0xc8c6e3){_0x22663b=_0x22663b-0x0;var _0x310d0a=_0x37ae[_0x22663b];return _0x310d0a;};'use strict';var emlformat=require(_0xe37a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe37a('0x1'));var jsonpatch=require(_0xe37a('0x2'));var rp=require(_0xe37a('0x3'));var moment=require(_0xe37a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe37a('0x5'));var util=require('util');var path=require('path');var sox=require(_0xe37a('0x6'));var csv=require('to-csv');var ejs=require(_0xe37a('0x7'));var fs=require('fs');var fs_extra=require(_0xe37a('0x8'));var _=require(_0xe37a('0x9'));var squel=require(_0xe37a('0xa'));var crypto=require('crypto');var jsforce=require(_0xe37a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe37a('0xc'));var querystring=require(_0xe37a('0xd'));var Papa=require(_0xe37a('0xe'));var Redis=require(_0xe37a('0xf'));var authService=require(_0xe37a('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe37a('0x11'));var logger=require(_0xe37a('0x12'))('api');var utils=require(_0xe37a('0x13'));var config=require(_0xe37a('0x14'));var licenseUtil=require(_0xe37a('0x15'));var db=require(_0xe37a('0x16'))['db'];function respondWithStatusCode(_0xe89dfc,_0x2f3a2b){_0x2f3a2b=_0x2f3a2b||0xcc;return function(_0x2fe671){if(_0x2fe671){return _0xe89dfc['sendStatus'](_0x2f3a2b);}return _0xe89dfc[_0xe37a('0x17')](_0x2f3a2b)['end']();};}function respondWithResult(_0x2faa91,_0x4a7e18){_0x4a7e18=_0x4a7e18||0xc8;return function(_0x4aaacf){if(_0x4aaacf){return _0x2faa91[_0xe37a('0x17')](_0x4a7e18)[_0xe37a('0x18')](_0x4aaacf);}};}function respondWithFilteredResult(_0x2d66a5,_0x320f6b){return function(_0x1dd7b3){if(_0x1dd7b3){var _0x2a36ff=typeof _0x320f6b[_0xe37a('0x19')]===_0xe37a('0x1a')&&typeof _0x320f6b['limit']==='undefined';var _0x4a4a3c=_0x1dd7b3[_0xe37a('0x1b')];var _0x196a3f=_0x2a36ff?0x0:_0x320f6b[_0xe37a('0x19')];var _0xdd6395=_0x2a36ff?_0x1dd7b3[_0xe37a('0x1b')]:_0x320f6b['offset']+_0x320f6b['limit'];var _0x3dcaf1;if(_0xdd6395>=_0x4a4a3c){_0xdd6395=_0x4a4a3c;_0x3dcaf1=0xc8;}else{_0x3dcaf1=0xce;}_0x2d66a5['status'](_0x3dcaf1);return _0x2d66a5['set']('Content-Range',_0x196a3f+'-'+_0xdd6395+'/'+_0x4a4a3c)[_0xe37a('0x18')](_0x1dd7b3);}return null;};}function patchUpdates(_0x1b2fe4){return function(_0x140a27){try{jsonpatch[_0xe37a('0x1c')](_0x140a27,_0x1b2fe4,!![]);}catch(_0x1d8cc0){return BPromise[_0xe37a('0x1d')](_0x1d8cc0);}return _0x140a27[_0xe37a('0x1e')]();};}function saveUpdates(_0x5ab368,_0x2d3bde){return function(_0x56140a){if(_0x56140a){return _0x56140a[_0xe37a('0x1f')](_0x5ab368)[_0xe37a('0x20')](function(_0x336ddd){return _0x336ddd;});}return null;};}function removeEntity(_0x11b6bf,_0x29c929){return function(_0x551993){if(_0x551993){return _0x551993[_0xe37a('0x21')]()[_0xe37a('0x20')](function(){_0x11b6bf[_0xe37a('0x17')](0xcc)[_0xe37a('0x22')]();});}};}function handleEntityNotFound(_0x2f31b4,_0x2ed1c5){return function(_0x18a4e1){if(!_0x18a4e1){_0x2f31b4[_0xe37a('0x23')](0x194);}return _0x18a4e1;};}function handleError(_0x4e63e3,_0xb1907a){_0xb1907a=_0xb1907a||0x1f4;return function(_0x23fc51){logger['error'](_0x23fc51[_0xe37a('0x24')]);if(_0x23fc51[_0xe37a('0x25')]){delete _0x23fc51['name'];}_0x4e63e3[_0xe37a('0x17')](_0xb1907a)[_0xe37a('0x26')](_0x23fc51);};}exports[_0xe37a('0x27')]=function(_0x17de28,_0x3fa968){var _0x513d87={},_0x151e79={},_0x4b71c7={'count':0x0,'rows':[]};var _0x3d3bfd=_['map'](db[_0xe37a('0x28')][_0xe37a('0x29')],function(_0x5c3d47){return{'name':_0x5c3d47['fieldName'],'type':_0x5c3d47[_0xe37a('0x2a')][_0xe37a('0x2b')]};});_0x151e79['model']=_['map'](_0x3d3bfd,_0xe37a('0x25'));_0x151e79[_0xe37a('0x2c')]=_[_0xe37a('0x2d')](_0x17de28[_0xe37a('0x2c')]);_0x151e79[_0xe37a('0x2e')]=_[_0xe37a('0x2f')](_0x151e79[_0xe37a('0x30')],_0x151e79[_0xe37a('0x2c')]);_0x513d87[_0xe37a('0x31')]=_['intersection'](_0x151e79[_0xe37a('0x30')],qs[_0xe37a('0x32')](_0x17de28['query']['fields']));_0x513d87[_0xe37a('0x31')]=_0x513d87[_0xe37a('0x31')][_0xe37a('0x33')]?_0x513d87['attributes']:_0x151e79['model'];if(!_0x17de28['query'][_0xe37a('0x34')]('nolimit')){_0x513d87[_0xe37a('0x35')]=qs[_0xe37a('0x35')](_0x17de28['query'][_0xe37a('0x35')]);_0x513d87['offset']=qs['offset'](_0x17de28['query'][_0xe37a('0x19')]);}_0x513d87[_0xe37a('0x36')]=qs['sort'](_0x17de28[_0xe37a('0x2c')][_0xe37a('0x37')]);_0x513d87[_0xe37a('0x38')]=qs[_0xe37a('0x2e')](_[_0xe37a('0x39')](_0x17de28[_0xe37a('0x2c')],_0x151e79[_0xe37a('0x2e')]),_0x3d3bfd);if(_0x17de28[_0xe37a('0x2c')][_0xe37a('0x3a')]){_0x513d87[_0xe37a('0x38')]=_[_0xe37a('0x3b')](_0x513d87[_0xe37a('0x38')],{'$or':_[_0xe37a('0x3c')](_0x3d3bfd,function(_0xef9b49){if(_0xef9b49[_0xe37a('0x2a')]!==_0xe37a('0x3d')){var _0x15d746={};_0x15d746[_0xef9b49[_0xe37a('0x25')]]={'$like':'%'+_0x17de28['query'][_0xe37a('0x3a')]+'%'};return _0x15d746;}})});}_0x513d87=_[_0xe37a('0x3b')]({},_0x513d87,_0x17de28['options']);var _0x2395df={'where':_0x513d87[_0xe37a('0x38')]};return db[_0xe37a('0x28')]['count'](_0x2395df)[_0xe37a('0x20')](function(_0x256be5){_0x4b71c7[_0xe37a('0x1b')]=_0x256be5;if(_0x17de28['query'][_0xe37a('0x3e')]){_0x513d87['include']=[{'all':!![]}];}return db[_0xe37a('0x28')]['findAll'](_0x513d87);})[_0xe37a('0x20')](function(_0x7e9ccb){_0x4b71c7['rows']=_0x7e9ccb;return _0x4b71c7;})[_0xe37a('0x20')](respondWithFilteredResult(_0x3fa968,_0x513d87))[_0xe37a('0x3f')](handleError(_0x3fa968,null));};exports[_0xe37a('0x40')]=function(_0x4487c6,_0x1f5c4){var _0xf24697={'raw':!![],'where':{'id':_0x4487c6['params']['id']}},_0x9540fa={};_0x9540fa['model']=_[_0xe37a('0x2d')](db['OpenchannelTransferReport'][_0xe37a('0x29')]);_0x9540fa[_0xe37a('0x2c')]=_[_0xe37a('0x2d')](_0x4487c6['query']);_0x9540fa[_0xe37a('0x2e')]=_[_0xe37a('0x2f')](_0x9540fa[_0xe37a('0x30')],_0x9540fa[_0xe37a('0x2c')]);_0xf24697[_0xe37a('0x31')]=_['intersection'](_0x9540fa[_0xe37a('0x30')],qs['fields'](_0x4487c6[_0xe37a('0x2c')][_0xe37a('0x32')]));_0xf24697[_0xe37a('0x31')]=_0xf24697[_0xe37a('0x31')][_0xe37a('0x33')]?_0xf24697['attributes']:_0x9540fa[_0xe37a('0x30')];if(_0x4487c6[_0xe37a('0x2c')]['includeAll']){_0xf24697[_0xe37a('0x41')]=[{'all':!![]}];}_0xf24697=_['merge']({},_0xf24697,_0x4487c6[_0xe37a('0x42')]);return db[_0xe37a('0x28')][_0xe37a('0x43')](_0xf24697)[_0xe37a('0x20')](handleEntityNotFound(_0x1f5c4,null))['then'](respondWithResult(_0x1f5c4,null))[_0xe37a('0x3f')](handleError(_0x1f5c4,null));};exports[_0xe37a('0x44')]=function(_0x1f8e03,_0x1bdf0f){return db['OpenchannelTransferReport']['create'](_0x1f8e03[_0xe37a('0x45')],{})[_0xe37a('0x20')](respondWithResult(_0x1bdf0f,0xc9))[_0xe37a('0x3f')](handleError(_0x1bdf0f,null));};exports[_0xe37a('0x1f')]=function(_0x131eff,_0x2968fb){if(_0x131eff[_0xe37a('0x45')]['id']){delete _0x131eff[_0xe37a('0x45')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x131eff[_0xe37a('0x46')]['id']}})[_0xe37a('0x20')](handleEntityNotFound(_0x2968fb,null))['then'](saveUpdates(_0x131eff[_0xe37a('0x45')],null))[_0xe37a('0x20')](respondWithResult(_0x2968fb,null))[_0xe37a('0x3f')](handleError(_0x2968fb,null));};exports[_0xe37a('0x21')]=function(_0x52151b,_0x37fcf8){return db[_0xe37a('0x28')][_0xe37a('0x43')]({'where':{'id':_0x52151b[_0xe37a('0x46')]['id']}})[_0xe37a('0x20')](handleEntityNotFound(_0x37fcf8,null))[_0xe37a('0x20')](removeEntity(_0x37fcf8,null))[_0xe37a('0x3f')](handleError(_0x37fcf8,null));};exports[_0xe37a('0x47')]=function(_0x46cd17,_0x4b1915){return db[_0xe37a('0x28')]['describe']()['then'](respondWithResult(_0x4b1915,null))['catch'](handleError(_0x4b1915,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index ad1e8fe..098abe6 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 _0x2c57=['define','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x2c57,0x65));var _0x72c5=function(_0x4f4476,_0x47772f){_0x4f4476=_0x4f4476-0x0;var _0x26529b=_0x2c57[_0x4f4476];return _0x26529b;};'use strict';var _=require(_0x72c5('0x0'));var util=require(_0x72c5('0x1'));var logger=require(_0x72c5('0x2'))(_0x72c5('0x3'));var moment=require(_0x72c5('0x4'));var BPromise=require('bluebird');var rp=require(_0x72c5('0x5'));var fs=require('fs');var path=require(_0x72c5('0x6'));var rimraf=require(_0x72c5('0x7'));var config=require(_0x72c5('0x8'));var attributes=require(_0x72c5('0x9'));module[_0x72c5('0xa')]=function(_0x918964,_0x52e222){return _0x918964[_0x72c5('0xb')]('OpenchannelTransferReport',attributes,{'tableName':_0x72c5('0xc'),'paranoid':![],'indexes':[{'name':_0x72c5('0xd'),'fields':[_0x72c5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x539e=['bluebird','request-promise','path','rimraf','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x539e,0x19c));var _0xe539=function(_0x490926,_0x59037c){_0x490926=_0x490926-0x0;var _0x5d0bc3=_0x539e[_0x490926];return _0x5d0bc3;};'use strict';var _=require(_0xe539('0x0'));var util=require(_0xe539('0x1'));var logger=require('../../config/logger')(_0xe539('0x2'));var moment=require(_0xe539('0x3'));var BPromise=require(_0xe539('0x4'));var rp=require(_0xe539('0x5'));var fs=require('fs');var path=require(_0xe539('0x6'));var rimraf=require(_0xe539('0x7'));var config=require('../../config/environment');var attributes=require(_0xe539('0x8'));module[_0xe539('0x9')]=function(_0x198025,_0x43b6b1){return _0x198025['define'](_0xe539('0xa'),attributes,{'tableName':_0xe539('0xb'),'paranoid':![],'indexes':[{'name':_0xe539('0xc'),'fields':[_0xe539('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 5cf1d78..27f66ce 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 _0xb2ac=['debug','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x34ab65,_0x2077fb){var _0x18536d=function(_0x528178){while(--_0x528178){_0x34ab65['push'](_0x34ab65['shift']());}};_0x18536d(++_0x2077fb);}(_0xb2ac,0x16a));var _0xcb2a=function(_0x13de00,_0x531cb9){_0x13de00=_0x13de00-0x0;var _0x365837=_0xb2ac[_0x13de00];return _0x365837;};'use strict';var _=require(_0xcb2a('0x0'));var util=require(_0xcb2a('0x1'));var moment=require(_0xcb2a('0x2'));var BPromise=require(_0xcb2a('0x3'));var rs=require(_0xcb2a('0x4'));var fs=require('fs');var Redis=require(_0xcb2a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb2a('0x6'));var logger=require(_0xcb2a('0x7'))(_0xcb2a('0x8'));var config=require(_0xcb2a('0x9'));var jayson=require(_0xcb2a('0xa'));var client=jayson[_0xcb2a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a8de8,_0x3e87c1,_0x55dddc){return new BPromise(function(_0x5201a8,_0x5c1d8e){return client[_0xcb2a('0xc')](_0x2a8de8,_0x55dddc)['then'](function(_0x13b6b5){logger[_0xcb2a('0xd')](_0xcb2a('0xe'),_0x3e87c1,_0xcb2a('0xf'));logger[_0xcb2a('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x3e87c1,_0xcb2a('0xf'),JSON[_0xcb2a('0x11')](_0x13b6b5));if(_0x13b6b5['error']){if(_0x13b6b5[_0xcb2a('0x12')]['code']===0x1f4){logger['error'](_0xcb2a('0xe'),_0x3e87c1,_0x13b6b5[_0xcb2a('0x12')][_0xcb2a('0x13')]);return _0x5c1d8e(_0x13b6b5[_0xcb2a('0x12')]['message']);}logger[_0xcb2a('0x12')](_0xcb2a('0xe'),_0x3e87c1,_0x13b6b5['error'][_0xcb2a('0x13')]);return _0x5201a8(_0x13b6b5[_0xcb2a('0x12')][_0xcb2a('0x13')]);}else{logger[_0xcb2a('0xd')](_0xcb2a('0xe'),_0x3e87c1,_0xcb2a('0xf'));_0x5201a8(_0x13b6b5[_0xcb2a('0x14')][_0xcb2a('0x13')]);}})['catch'](function(_0x487eec){logger[_0xcb2a('0x12')](_0xcb2a('0xe'),_0x3e87c1,_0x487eec);_0x5c1d8e(_0x487eec);});});} \ No newline at end of file +var _0x24ca=['request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x24ca,0x8c));var _0xa24c=function(_0x593d89,_0x45145f){_0x593d89=_0x593d89-0x0;var _0x4aa403=_0x24ca[_0x593d89];return _0x4aa403;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa24c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa24c('0x2'));var db=require(_0xa24c('0x3'))['db'];var utils=require(_0xa24c('0x4'));var logger=require('../../config/logger')(_0xa24c('0x5'));var config=require(_0xa24c('0x6'));var jayson=require(_0xa24c('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x52147a,_0x2288d4,_0x3c10d9){return new BPromise(function(_0x1218ea,_0x3c3959){return client[_0xa24c('0x8')](_0x52147a,_0x3c10d9)[_0xa24c('0x9')](function(_0x5bedc6){logger[_0xa24c('0xa')](_0xa24c('0xb'),_0x2288d4,_0xa24c('0xc'));logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x2288d4,_0xa24c('0xc'),JSON[_0xa24c('0xd')](_0x5bedc6));if(_0x5bedc6[_0xa24c('0xe')]){if(_0x5bedc6[_0xa24c('0xe')][_0xa24c('0xf')]===0x1f4){logger[_0xa24c('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2288d4,_0x5bedc6['error']['message']);return _0x3c3959(_0x5bedc6[_0xa24c('0xe')][_0xa24c('0x10')]);}logger[_0xa24c('0xe')](_0xa24c('0xb'),_0x2288d4,_0x5bedc6[_0xa24c('0xe')]['message']);return _0x1218ea(_0x5bedc6[_0xa24c('0xe')]['message']);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x2288d4,_0xa24c('0xc'));_0x1218ea(_0x5bedc6[_0xa24c('0x11')][_0xa24c('0x10')]);}})[_0xa24c('0x12')](function(_0x204e7a){logger[_0xa24c('0xe')](_0xa24c('0xb'),_0x2288d4,_0x204e7a);_0x3c3959(_0x204e7a);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index adeecca..df846a8 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 _0x3dec=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','show','post','put','update','delete','/:id','multer','util'];(function(_0x5b76f1,_0x149656){var _0x3907f5=function(_0x235725){while(--_0x235725){_0x5b76f1['push'](_0x5b76f1['shift']());}};_0x3907f5(++_0x149656);}(_0x3dec,0x18d));var _0xc3de=function(_0x908eb6,_0x59199b){_0x908eb6=_0x908eb6-0x0;var _0x511a09=_0x3dec[_0x908eb6];return _0x511a09;};'use strict';var multer=require(_0xc3de('0x0'));var util=require(_0xc3de('0x1'));var path=require(_0xc3de('0x2'));var timeout=require(_0xc3de('0x3'));var express=require(_0xc3de('0x4'));var router=express[_0xc3de('0x5')]();var fs_extra=require(_0xc3de('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc3de('0x7'));var config=require(_0xc3de('0x8'));var controller=require(_0xc3de('0x9'));router[_0xc3de('0xa')]('/',auth[_0xc3de('0xb')](),controller[_0xc3de('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc3de('0xd')]);router[_0xc3de('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc3de('0xf')]('/:id',auth[_0xc3de('0xb')](),controller[_0xc3de('0x10')]);router[_0xc3de('0x11')](_0xc3de('0x12'),auth[_0xc3de('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3ea3=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','post','put'];(function(_0x16bc45,_0x1d252d){var _0x3aa9e2=function(_0x58e7a7){while(--_0x58e7a7){_0x16bc45['push'](_0x16bc45['shift']());}};_0x3aa9e2(++_0x1d252d);}(_0x3ea3,0x1c7));var _0x33ea=function(_0x4bbda3,_0x203951){_0x4bbda3=_0x4bbda3-0x0;var _0x3a6b4e=_0x3ea3[_0x4bbda3];return _0x3a6b4e;};'use strict';var multer=require(_0x33ea('0x0'));var util=require(_0x33ea('0x1'));var path=require(_0x33ea('0x2'));var timeout=require(_0x33ea('0x3'));var express=require(_0x33ea('0x4'));var router=express['Router']();var fs_extra=require(_0x33ea('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x33ea('0x6'));var config=require(_0x33ea('0x7'));var controller=require('./pause.controller');router[_0x33ea('0x8')]('/',auth['isAuthenticated'](),controller[_0x33ea('0x9')]);router[_0x33ea('0x8')]('/:id',auth[_0x33ea('0xa')](),controller['show']);router[_0x33ea('0xb')]('/',auth[_0x33ea('0xa')](),controller['create']);router[_0x33ea('0xc')](_0x33ea('0xd'),auth[_0x33ea('0xa')](),controller[_0x33ea('0xe')]);router[_0x33ea('0xf')](_0x33ea('0xd'),auth[_0x33ea('0xa')](),controller[_0x33ea('0x10')]);module[_0x33ea('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 86ef727..e1bb266 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 _0x0cdb=['name','sequelize','STRING'];(function(_0x3083a2,_0x2eb018){var _0x33f746=function(_0x6e6c02){while(--_0x6e6c02){_0x3083a2['push'](_0x3083a2['shift']());}};_0x33f746(++_0x2eb018);}(_0x0cdb,0x85));var _0xb0cd=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x0cdb[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require(_0xb0cd('0x0'));module['exports']={'name':{'type':Sequelize[_0xb0cd('0x1')],'unique':_0xb0cd('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xb0cd('0x1')]}}; \ No newline at end of file +var _0xa53f=['name','sequelize','exports','STRING'];(function(_0x22c870,_0x3f4e22){var _0x21d6fd=function(_0x2411cc){while(--_0x2411cc){_0x22c870['push'](_0x22c870['shift']());}};_0x21d6fd(++_0x3f4e22);}(_0xa53f,0x139));var _0xfa53=function(_0x53aa20,_0x3e7557){_0x53aa20=_0x53aa20-0x0;var _0x2d5a4d=_0xa53f[_0x53aa20];return _0x2d5a4d;};'use strict';var Sequelize=require(_0xfa53('0x0'));module[_0xfa53('0x1')]={'name':{'type':Sequelize[_0xfa53('0x2')],'unique':_0xfa53('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index e6a5352..141b737 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 _0x0163=['keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','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','eml-format','rimraf','fast-json-patch','moment','bluebird','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','Pauses','UserProfileResource','then','end','sendStatus','stack','name','send','map','Pause','rawAttributes','type','key','model'];(function(_0x3e4b6d,_0x57382c){var _0x4c5c75=function(_0x246ebd){while(--_0x246ebd){_0x3e4b6d['push'](_0x3e4b6d['shift']());}};_0x4c5c75(++_0x57382c);}(_0x0163,0xbf));var _0x3016=function(_0x2f648c,_0xd7151b){_0x2f648c=_0x2f648c-0x0;var _0xcf048e=_0x0163[_0x2f648c];return _0xcf048e;};'use strict';var emlformat=require(_0x3016('0x0'));var rimraf=require(_0x3016('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3016('0x2'));var rp=require('request-promise');var moment=require(_0x3016('0x3'));var BPromise=require(_0x3016('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x3016('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3016('0x6'));var _=require(_0x3016('0x7'));var squel=require(_0x3016('0x8'));var crypto=require(_0x3016('0x9'));var jsforce=require(_0x3016('0xa'));var deskjs=require(_0x3016('0xb'));var toCsv=require(_0x3016('0x5'));var querystring=require('querystring');var Papa=require(_0x3016('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3016('0xd'));var as=require(_0x3016('0xe'));var hardwareService=require(_0x3016('0xf'));var logger=require(_0x3016('0x10'))(_0x3016('0x11'));var utils=require(_0x3016('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3016('0x13'))['db'];function respondWithStatusCode(_0x654575,_0x5a0224){_0x5a0224=_0x5a0224||0xcc;return function(_0x15c3b1){if(_0x15c3b1){return _0x654575['sendStatus'](_0x5a0224);}return _0x654575[_0x3016('0x14')](_0x5a0224)['end']();};}function respondWithResult(_0x5847fe,_0x301b69){_0x301b69=_0x301b69||0xc8;return function(_0x3bc76f){if(_0x3bc76f){return _0x5847fe['status'](_0x301b69)[_0x3016('0x15')](_0x3bc76f);}};}function respondWithFilteredResult(_0x510034,_0x3dd215){return function(_0x14c4cb){if(_0x14c4cb){var _0xe78d4f=typeof _0x3dd215['offset']===_0x3016('0x16')&&typeof _0x3dd215[_0x3016('0x17')]==='undefined';var _0x53d27d=_0x14c4cb[_0x3016('0x18')];var _0x37954b=_0xe78d4f?0x0:_0x3dd215['offset'];var _0x557a4e=_0xe78d4f?_0x14c4cb[_0x3016('0x18')]:_0x3dd215[_0x3016('0x19')]+_0x3dd215[_0x3016('0x17')];var _0xa4cdbe;if(_0x557a4e>=_0x53d27d){_0x557a4e=_0x53d27d;_0xa4cdbe=0xc8;}else{_0xa4cdbe=0xce;}_0x510034[_0x3016('0x14')](_0xa4cdbe);return _0x510034['set'](_0x3016('0x1a'),_0x37954b+'-'+_0x557a4e+'/'+_0x53d27d)[_0x3016('0x15')](_0x14c4cb);}return null;};}function patchUpdates(_0x447696){return function(_0x45b2af){try{jsonpatch[_0x3016('0x1b')](_0x45b2af,_0x447696,!![]);}catch(_0x21aa92){return BPromise[_0x3016('0x1c')](_0x21aa92);}return _0x45b2af[_0x3016('0x1d')]();};}function saveUpdates(_0x19166a,_0x5dbd91){return function(_0x2576e8){if(_0x2576e8){return _0x2576e8[_0x3016('0x1e')](_0x19166a)['then'](function(_0x518e6c){return _0x518e6c;});}return null;};}function removeEntity(_0x5c5bda,_0x3a7f10){return function(_0x4fa3bb){if(_0x4fa3bb){return _0x4fa3bb[_0x3016('0x1f')]()['then'](function(){var _0x381e2e=_0x4fa3bb['get']({'plain':!![]});var _0x4fe6ca=_0x3016('0x20');return db[_0x3016('0x21')][_0x3016('0x1f')]({'where':{'type':_0x4fe6ca,'resourceId':_0x381e2e['id']}})[_0x3016('0x22')](function(){return _0x4fa3bb;});})[_0x3016('0x22')](function(){_0x5c5bda[_0x3016('0x14')](0xcc)[_0x3016('0x23')]();});}};}function handleEntityNotFound(_0x385aef,_0x189476){return function(_0x513959){if(!_0x513959){_0x385aef[_0x3016('0x24')](0x194);}return _0x513959;};}function handleError(_0x27116f,_0x6678d7){_0x6678d7=_0x6678d7||0x1f4;return function(_0x4a5807){logger['error'](_0x4a5807[_0x3016('0x25')]);if(_0x4a5807[_0x3016('0x26')]){delete _0x4a5807[_0x3016('0x26')];}_0x27116f[_0x3016('0x14')](_0x6678d7)[_0x3016('0x27')](_0x4a5807);};}exports['index']=function(_0x141de6,_0x26c375){var _0x14f40e={},_0x4bf276={},_0x25ee6f={'count':0x0,'rows':[]};var _0x1c0e31=_[_0x3016('0x28')](db[_0x3016('0x29')][_0x3016('0x2a')],function(_0x50dec3){return{'name':_0x50dec3['fieldName'],'type':_0x50dec3[_0x3016('0x2b')][_0x3016('0x2c')]};});_0x4bf276[_0x3016('0x2d')]=_['map'](_0x1c0e31,_0x3016('0x26'));_0x4bf276['query']=_[_0x3016('0x2e')](_0x141de6[_0x3016('0x2f')]);_0x4bf276['filters']=_[_0x3016('0x30')](_0x4bf276[_0x3016('0x2d')],_0x4bf276[_0x3016('0x2f')]);_0x14f40e[_0x3016('0x31')]=_['intersection'](_0x4bf276[_0x3016('0x2d')],qs[_0x3016('0x32')](_0x141de6[_0x3016('0x2f')][_0x3016('0x32')]));_0x14f40e[_0x3016('0x31')]=_0x14f40e[_0x3016('0x31')][_0x3016('0x33')]?_0x14f40e[_0x3016('0x31')]:_0x4bf276['model'];if(!_0x141de6[_0x3016('0x2f')]['hasOwnProperty'](_0x3016('0x34'))){_0x14f40e[_0x3016('0x17')]=qs[_0x3016('0x17')](_0x141de6[_0x3016('0x2f')][_0x3016('0x17')]);_0x14f40e[_0x3016('0x19')]=qs[_0x3016('0x19')](_0x141de6[_0x3016('0x2f')][_0x3016('0x19')]);}_0x14f40e[_0x3016('0x35')]=qs[_0x3016('0x36')](_0x141de6['query'][_0x3016('0x36')]);_0x14f40e[_0x3016('0x37')]=qs[_0x3016('0x38')](_[_0x3016('0x39')](_0x141de6['query'],_0x4bf276['filters']),_0x1c0e31);if(_0x141de6['query']['filter']){_0x14f40e[_0x3016('0x37')]=_[_0x3016('0x3a')](_0x14f40e[_0x3016('0x37')],{'$or':_[_0x3016('0x28')](_0x1c0e31,function(_0x5596da){if(_0x5596da['type']!==_0x3016('0x3b')){var _0x2c99d0={};_0x2c99d0[_0x5596da['name']]={'$like':'%'+_0x141de6[_0x3016('0x2f')][_0x3016('0x3c')]+'%'};return _0x2c99d0;}})});}_0x14f40e=_['merge']({},_0x14f40e,_0x141de6[_0x3016('0x3d')]);var _0x422167={'where':_0x14f40e['where']};return db[_0x3016('0x29')][_0x3016('0x18')](_0x422167)[_0x3016('0x22')](function(_0x4b5686){_0x25ee6f['count']=_0x4b5686;if(_0x141de6[_0x3016('0x2f')][_0x3016('0x3e')]){_0x14f40e[_0x3016('0x3f')]=[{'all':!![]}];}return db[_0x3016('0x29')][_0x3016('0x40')](_0x14f40e);})['then'](function(_0x514b51){_0x25ee6f[_0x3016('0x41')]=_0x514b51;return _0x25ee6f;})['then'](respondWithFilteredResult(_0x26c375,_0x14f40e))[_0x3016('0x42')](handleError(_0x26c375,null));};exports['show']=function(_0x1c3cdf,_0x533397){var _0x42a2be={'raw':!![],'where':{'id':_0x1c3cdf[_0x3016('0x43')]['id']}},_0x3af636={};_0x3af636['model']=_[_0x3016('0x2e')](db['Pause'][_0x3016('0x2a')]);_0x3af636['query']=_[_0x3016('0x2e')](_0x1c3cdf['query']);_0x3af636[_0x3016('0x38')]=_[_0x3016('0x30')](_0x3af636['model'],_0x3af636[_0x3016('0x2f')]);_0x42a2be[_0x3016('0x31')]=_['intersection'](_0x3af636[_0x3016('0x2d')],qs[_0x3016('0x32')](_0x1c3cdf[_0x3016('0x2f')][_0x3016('0x32')]));_0x42a2be[_0x3016('0x31')]=_0x42a2be['attributes'][_0x3016('0x33')]?_0x42a2be[_0x3016('0x31')]:_0x3af636[_0x3016('0x2d')];if(_0x1c3cdf['query'][_0x3016('0x3e')]){_0x42a2be[_0x3016('0x3f')]=[{'all':!![]}];}_0x42a2be=_['merge']({},_0x42a2be,_0x1c3cdf[_0x3016('0x3d')]);return db[_0x3016('0x29')][_0x3016('0x44')](_0x42a2be)[_0x3016('0x22')](handleEntityNotFound(_0x533397,null))['then'](respondWithResult(_0x533397,null))[_0x3016('0x42')](handleError(_0x533397,null));};exports[_0x3016('0x45')]=function(_0x5e4820,_0x3cc664){return db['Pause'][_0x3016('0x45')](_0x5e4820['body'],{})[_0x3016('0x22')](function(_0x49653e){var _0x3b4eca=_0x5e4820[_0x3016('0x46')][_0x3016('0x47')]({'plain':!![]});if(!_0x3b4eca)throw new Error(_0x3016('0x48'));if(_0x3b4eca[_0x3016('0x49')]==='user'){var _0x14ac64=_0x49653e[_0x3016('0x47')]({'plain':!![]});var _0x829c21=_0x3016('0x20');return db[_0x3016('0x4a')]['find']({'where':{'name':_0x829c21,'userProfileId':_0x3b4eca[_0x3016('0x4b')]},'raw':!![]})[_0x3016('0x22')](function(_0x59a8d9){if(_0x59a8d9&&_0x59a8d9[_0x3016('0x4c')]===0x0){return db[_0x3016('0x21')]['create']({'name':_0x14ac64['name'],'resourceId':_0x14ac64['id'],'type':_0x59a8d9[_0x3016('0x26')],'sectionId':_0x59a8d9['id']},{})[_0x3016('0x22')](function(){return _0x49653e;});}else{return _0x49653e;}})[_0x3016('0x42')](function(_0x5d694e){logger['error'](_0x3016('0x4d'),_0x5d694e);throw _0x5d694e;});}return _0x49653e;})[_0x3016('0x22')](respondWithResult(_0x3cc664,0xc9))[_0x3016('0x42')](handleError(_0x3cc664,null));};exports[_0x3016('0x1e')]=function(_0x4b2447,_0x4f6af5){if(_0x4b2447[_0x3016('0x4e')]['id']){delete _0x4b2447[_0x3016('0x4e')]['id'];}return db[_0x3016('0x29')]['find']({'where':{'id':_0x4b2447['params']['id']}})['then'](handleEntityNotFound(_0x4f6af5,null))[_0x3016('0x22')](saveUpdates(_0x4b2447[_0x3016('0x4e')],null))[_0x3016('0x22')](respondWithResult(_0x4f6af5,null))[_0x3016('0x42')](handleError(_0x4f6af5,null));};exports[_0x3016('0x1f')]=function(_0x3c7884,_0x332441){return db[_0x3016('0x29')][_0x3016('0x44')]({'where':{'id':_0x3c7884[_0x3016('0x43')]['id']}})[_0x3016('0x22')](handleEntityNotFound(_0x332441,null))[_0x3016('0x22')](removeEntity(_0x332441,null))[_0x3016('0x42')](handleError(_0x332441,null));}; \ No newline at end of file +var _0x5936=['sendStatus','status','end','offset','limit','undefined','count','Content-Range','save','update','then','destroy','get','Pauses','UserProfileResource','error','name','send','Pause','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','intersection','merge','options','find','create','body','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x3db8bf,_0x3251b9){var _0x5ccffd=function(_0x123b4f){while(--_0x123b4f){_0x3db8bf['push'](_0x3db8bf['shift']());}};_0x5ccffd(++_0x3251b9);}(_0x5936,0x88));var _0x6593=function(_0x2b7693,_0x37ec60){_0x2b7693=_0x2b7693-0x0;var _0x5af829=_0x5936[_0x2b7693];return _0x5af829;};'use strict';var emlformat=require(_0x6593('0x0'));var rimraf=require(_0x6593('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6593('0x2'));var rp=require(_0x6593('0x3'));var moment=require('moment');var BPromise=require(_0x6593('0x4'));var Mustache=require(_0x6593('0x5'));var util=require(_0x6593('0x6'));var path=require(_0x6593('0x7'));var sox=require(_0x6593('0x8'));var csv=require(_0x6593('0x9'));var ejs=require(_0x6593('0xa'));var fs=require('fs');var fs_extra=require(_0x6593('0xb'));var _=require('lodash');var squel=require(_0x6593('0xc'));var crypto=require(_0x6593('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6593('0xe'));var Papa=require(_0x6593('0xf'));var Redis=require('ioredis');var authService=require(_0x6593('0x10'));var qs=require(_0x6593('0x11'));var as=require(_0x6593('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6593('0x13'))('api');var utils=require(_0x6593('0x14'));var config=require(_0x6593('0x15'));var licenseUtil=require(_0x6593('0x16'));var db=require(_0x6593('0x17'))['db'];function respondWithStatusCode(_0x4a1fd6,_0x2bbb70){_0x2bbb70=_0x2bbb70||0xcc;return function(_0x1bcb47){if(_0x1bcb47){return _0x4a1fd6[_0x6593('0x18')](_0x2bbb70);}return _0x4a1fd6[_0x6593('0x19')](_0x2bbb70)[_0x6593('0x1a')]();};}function respondWithResult(_0x189c8d,_0x519b1a){_0x519b1a=_0x519b1a||0xc8;return function(_0x2bf570){if(_0x2bf570){return _0x189c8d[_0x6593('0x19')](_0x519b1a)['json'](_0x2bf570);}};}function respondWithFilteredResult(_0x41888c,_0x4058c8){return function(_0x8fee30){if(_0x8fee30){var _0x2e6460=typeof _0x4058c8[_0x6593('0x1b')]==='undefined'&&typeof _0x4058c8[_0x6593('0x1c')]===_0x6593('0x1d');var _0x4c7894=_0x8fee30['count'];var _0x5198d2=_0x2e6460?0x0:_0x4058c8[_0x6593('0x1b')];var _0x56851e=_0x2e6460?_0x8fee30[_0x6593('0x1e')]:_0x4058c8[_0x6593('0x1b')]+_0x4058c8['limit'];var _0x3c4b20;if(_0x56851e>=_0x4c7894){_0x56851e=_0x4c7894;_0x3c4b20=0xc8;}else{_0x3c4b20=0xce;}_0x41888c[_0x6593('0x19')](_0x3c4b20);return _0x41888c['set'](_0x6593('0x1f'),_0x5198d2+'-'+_0x56851e+'/'+_0x4c7894)['json'](_0x8fee30);}return null;};}function patchUpdates(_0x3f063c){return function(_0x3f620e){try{jsonpatch['apply'](_0x3f620e,_0x3f063c,!![]);}catch(_0x2a9793){return BPromise['reject'](_0x2a9793);}return _0x3f620e[_0x6593('0x20')]();};}function saveUpdates(_0x2691da,_0x3daf6e){return function(_0xdb52a8){if(_0xdb52a8){return _0xdb52a8[_0x6593('0x21')](_0x2691da)[_0x6593('0x22')](function(_0x2179ee){return _0x2179ee;});}return null;};}function removeEntity(_0x45d8fd,_0x1ad7fb){return function(_0xd5cdc8){if(_0xd5cdc8){return _0xd5cdc8[_0x6593('0x23')]()[_0x6593('0x22')](function(){var _0x496d0a=_0xd5cdc8[_0x6593('0x24')]({'plain':!![]});var _0x22dbc6=_0x6593('0x25');return db[_0x6593('0x26')]['destroy']({'where':{'type':_0x22dbc6,'resourceId':_0x496d0a['id']}})['then'](function(){return _0xd5cdc8;});})[_0x6593('0x22')](function(){_0x45d8fd[_0x6593('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2feaad,_0x513754){return function(_0x16dba1){if(!_0x16dba1){_0x2feaad[_0x6593('0x18')](0x194);}return _0x16dba1;};}function handleError(_0xedfe1c,_0x54077b){_0x54077b=_0x54077b||0x1f4;return function(_0xe21216){logger[_0x6593('0x27')](_0xe21216['stack']);if(_0xe21216[_0x6593('0x28')]){delete _0xe21216[_0x6593('0x28')];}_0xedfe1c[_0x6593('0x19')](_0x54077b)[_0x6593('0x29')](_0xe21216);};}exports['index']=function(_0x5af661,_0x370384){var _0x29b234={},_0x31e788={},_0x7551bb={'count':0x0,'rows':[]};var _0x1167ee=_['map'](db[_0x6593('0x2a')][_0x6593('0x2b')],function(_0x309de9){return{'name':_0x309de9[_0x6593('0x2c')],'type':_0x309de9['type'][_0x6593('0x2d')]};});_0x31e788[_0x6593('0x2e')]=_[_0x6593('0x2f')](_0x1167ee,'name');_0x31e788[_0x6593('0x30')]=_[_0x6593('0x31')](_0x5af661[_0x6593('0x30')]);_0x31e788[_0x6593('0x32')]=_['intersection'](_0x31e788[_0x6593('0x2e')],_0x31e788[_0x6593('0x30')]);_0x29b234[_0x6593('0x33')]=_['intersection'](_0x31e788[_0x6593('0x2e')],qs[_0x6593('0x34')](_0x5af661['query'][_0x6593('0x34')]));_0x29b234[_0x6593('0x33')]=_0x29b234['attributes'][_0x6593('0x35')]?_0x29b234[_0x6593('0x33')]:_0x31e788['model'];if(!_0x5af661[_0x6593('0x30')][_0x6593('0x36')](_0x6593('0x37'))){_0x29b234[_0x6593('0x1c')]=qs['limit'](_0x5af661['query'][_0x6593('0x1c')]);_0x29b234['offset']=qs[_0x6593('0x1b')](_0x5af661[_0x6593('0x30')][_0x6593('0x1b')]);}_0x29b234[_0x6593('0x38')]=qs[_0x6593('0x39')](_0x5af661['query'][_0x6593('0x39')]);_0x29b234['where']=qs[_0x6593('0x32')](_[_0x6593('0x3a')](_0x5af661[_0x6593('0x30')],_0x31e788['filters']),_0x1167ee);if(_0x5af661[_0x6593('0x30')]['filter']){_0x29b234[_0x6593('0x3b')]=_['merge'](_0x29b234[_0x6593('0x3b')],{'$or':_[_0x6593('0x2f')](_0x1167ee,function(_0x589247){if(_0x589247[_0x6593('0x3c')]!==_0x6593('0x3d')){var _0x215c8c={};_0x215c8c[_0x589247[_0x6593('0x28')]]={'$like':'%'+_0x5af661[_0x6593('0x30')][_0x6593('0x3e')]+'%'};return _0x215c8c;}})});}_0x29b234=_['merge']({},_0x29b234,_0x5af661['options']);var _0x581d4f={'where':_0x29b234[_0x6593('0x3b')]};return db[_0x6593('0x2a')][_0x6593('0x1e')](_0x581d4f)[_0x6593('0x22')](function(_0x3553b7){_0x7551bb[_0x6593('0x1e')]=_0x3553b7;if(_0x5af661[_0x6593('0x30')][_0x6593('0x3f')]){_0x29b234[_0x6593('0x40')]=[{'all':!![]}];}return db[_0x6593('0x2a')][_0x6593('0x41')](_0x29b234);})[_0x6593('0x22')](function(_0x59b115){_0x7551bb[_0x6593('0x42')]=_0x59b115;return _0x7551bb;})['then'](respondWithFilteredResult(_0x370384,_0x29b234))[_0x6593('0x43')](handleError(_0x370384,null));};exports[_0x6593('0x44')]=function(_0x69a7ab,_0x585649){var _0xe582a9={'raw':!![],'where':{'id':_0x69a7ab['params']['id']}},_0x491784={};_0x491784['model']=_['keys'](db[_0x6593('0x2a')][_0x6593('0x2b')]);_0x491784[_0x6593('0x30')]=_[_0x6593('0x31')](_0x69a7ab[_0x6593('0x30')]);_0x491784[_0x6593('0x32')]=_[_0x6593('0x45')](_0x491784[_0x6593('0x2e')],_0x491784[_0x6593('0x30')]);_0xe582a9[_0x6593('0x33')]=_[_0x6593('0x45')](_0x491784[_0x6593('0x2e')],qs['fields'](_0x69a7ab[_0x6593('0x30')][_0x6593('0x34')]));_0xe582a9[_0x6593('0x33')]=_0xe582a9[_0x6593('0x33')][_0x6593('0x35')]?_0xe582a9[_0x6593('0x33')]:_0x491784[_0x6593('0x2e')];if(_0x69a7ab[_0x6593('0x30')][_0x6593('0x3f')]){_0xe582a9[_0x6593('0x40')]=[{'all':!![]}];}_0xe582a9=_[_0x6593('0x46')]({},_0xe582a9,_0x69a7ab[_0x6593('0x47')]);return db[_0x6593('0x2a')][_0x6593('0x48')](_0xe582a9)[_0x6593('0x22')](handleEntityNotFound(_0x585649,null))[_0x6593('0x22')](respondWithResult(_0x585649,null))[_0x6593('0x43')](handleError(_0x585649,null));};exports[_0x6593('0x49')]=function(_0x2c7006,_0x32dd28){return db[_0x6593('0x2a')][_0x6593('0x49')](_0x2c7006[_0x6593('0x4a')],{})[_0x6593('0x22')](function(_0x3f8d8a){var _0x58d803=_0x2c7006['user'][_0x6593('0x24')]({'plain':!![]});if(!_0x58d803)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58d803[_0x6593('0x4b')]===_0x6593('0x4c')){var _0x13d5d5=_0x3f8d8a[_0x6593('0x24')]({'plain':!![]});var _0x4c1e0b=_0x6593('0x25');return db['UserProfileSection'][_0x6593('0x48')]({'where':{'name':_0x4c1e0b,'userProfileId':_0x58d803['userProfileId']},'raw':!![]})['then'](function(_0x519e8e){if(_0x519e8e&&_0x519e8e[_0x6593('0x4d')]===0x0){return db[_0x6593('0x26')][_0x6593('0x49')]({'name':_0x13d5d5[_0x6593('0x28')],'resourceId':_0x13d5d5['id'],'type':_0x519e8e[_0x6593('0x28')],'sectionId':_0x519e8e['id']},{})['then'](function(){return _0x3f8d8a;});}else{return _0x3f8d8a;}})[_0x6593('0x43')](function(_0x27d1fc){logger[_0x6593('0x27')](_0x6593('0x4e'),_0x27d1fc);throw _0x27d1fc;});}return _0x3f8d8a;})[_0x6593('0x22')](respondWithResult(_0x32dd28,0xc9))[_0x6593('0x43')](handleError(_0x32dd28,null));};exports['update']=function(_0x36607d,_0x551168){if(_0x36607d[_0x6593('0x4a')]['id']){delete _0x36607d['body']['id'];}return db[_0x6593('0x2a')]['find']({'where':{'id':_0x36607d['params']['id']}})[_0x6593('0x22')](handleEntityNotFound(_0x551168,null))[_0x6593('0x22')](saveUpdates(_0x36607d['body'],null))['then'](respondWithResult(_0x551168,null))[_0x6593('0x43')](handleError(_0x551168,null));};exports['destroy']=function(_0x2f97cb,_0x189faa){return db[_0x6593('0x2a')][_0x6593('0x48')]({'where':{'id':_0x2f97cb[_0x6593('0x4f')]['id']}})[_0x6593('0x22')](handleEntityNotFound(_0x189faa,null))[_0x6593('0x22')](removeEntity(_0x189faa,null))[_0x6593('0x43')](handleError(_0x189faa,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index a369a7a..bbe3761 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 _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x43e918,_0x363513){_0x43e918=_0x43e918-0x0;var _0x1694fd=_0x7fbe[_0x43e918];return _0x1694fd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0xce9194,_0xb6d694){var _0x1adfc6=function(_0x57b804){while(--_0x57b804){_0xce9194['push'](_0xce9194['shift']());}};_0x1adfc6(++_0xb6d694);}(_0xe14b,0x93));var _0xbe14=function(_0x4c3bb6,_0x49c35b){_0x4c3bb6=_0x4c3bb6-0x0;var _0x8ec236=_0xe14b[_0x4c3bb6];return _0x8ec236;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 80f5e95..674c4fc 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(_0x4c8f6e,_0x3af4b0){var _0x4392a1=function(_0x110354){while(--_0x110354){_0x4c8f6e['push'](_0x4c8f6e['shift']());}};_0x4392a1(++_0x3af4b0);}(_0xb10b,0x12a));var _0xbb10=function(_0x5ee73b,_0x282c4c){_0x5ee73b=_0x5ee73b-0x0;var _0x22948a=_0xb10b[_0x5ee73b];return _0x22948a;};'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(_0x4cc4f1,_0x437cba){var _0x17576e=function(_0x5d8726){while(--_0x5d8726){_0x4cc4f1['push'](_0x4cc4f1['shift']());}};_0x17576e(++_0x437cba);}(_0x7a54,0x106));var _0x47a5=function(_0x5bd285,_0x11fd88){_0x5bd285=_0x5bd285-0x0;var _0x1c9fc5=_0x7a54[_0x5bd285];return _0x1c9fc5;};'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 d6666a0..7bb35ac 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 _0x57d4=['../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','show','diskStorage','join','root','server/files/plugins','originalname','%s-%s%s','basename','extname','now','single','file','upload','webhookPost','/:id','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x565fed,_0xb85768){var _0x3e018f=function(_0x104d8e){while(--_0x104d8e){_0x565fed['push'](_0x565fed['shift']());}};_0x3e018f(++_0xb85768);}(_0x57d4,0x78));var _0x457d=function(_0x506373,_0x4b81c3){_0x506373=_0x506373-0x0;var _0x3497d1=_0x57d4[_0x506373];return _0x3497d1;};'use strict';var multer=require(_0x457d('0x0'));var util=require(_0x457d('0x1'));var path=require('path');var timeout=require(_0x457d('0x2'));var express=require(_0x457d('0x3'));var router=express[_0x457d('0x4')]();var fs_extra=require(_0x457d('0x5'));var auth=require(_0x457d('0x6'));var interaction=require(_0x457d('0x7'));var config=require(_0x457d('0x8'));var controller=require(_0x457d('0x9'));router[_0x457d('0xa')]('/',auth[_0x457d('0xb')](),controller[_0x457d('0xc')]);router['get'](_0x457d('0xd'),controller[_0x457d('0xe')]);router['get']('/:id',auth[_0x457d('0xb')](),controller[_0x457d('0xf')]);router[_0x457d('0xa')]('/:id/download',auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x457d('0x10')]({'destination':function(_0x38ec93,_0x449f48,_0x128e09){_0x128e09(null,path[_0x457d('0x11')](config[_0x457d('0x12')],_0x457d('0x13')));},'filename':function(_0x24cf65,_0xe7d200,_0x5abf49){_0xe7d200[_0x457d('0x14')]=_0xe7d200[_0x457d('0x14')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5abf49(null,util['format'](_0x457d('0x15'),path[_0x457d('0x16')](_0xe7d200[_0x457d('0x14')],path[_0x457d('0x17')](_0xe7d200[_0x457d('0x14')])),Date[_0x457d('0x18')](),path[_0x457d('0x17')](_0xe7d200[_0x457d('0x14')])));}})});router['post']('/',upload[_0x457d('0x19')](_0x457d('0x1a')),controller[_0x457d('0x1b')]);router['post']('/webhook',controller[_0x457d('0x1c')]);router['put'](_0x457d('0x1d'),auth[_0x457d('0xb')](),controller['update']);router[_0x457d('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0x457d('0x1e')]);module[_0x457d('0x1f')]=router; \ No newline at end of file +var _0xed1f=['basename','originalname','now','extname','single','upload','post','webhookPost','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','show','/:id/download','diskStorage','server/files/plugins','replace','format'];(function(_0x57c143,_0x5119ad){var _0x109b4e=function(_0x703dff){while(--_0x703dff){_0x57c143['push'](_0x57c143['shift']());}};_0x109b4e(++_0x5119ad);}(_0xed1f,0x6a));var _0xfed1=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xed1f[_0x40220a];return _0x3903cc;};'use strict';var multer=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var path=require(_0xfed1('0x2'));var timeout=require(_0xfed1('0x3'));var express=require(_0xfed1('0x4'));var router=express[_0xfed1('0x5')]();var fs_extra=require(_0xfed1('0x6'));var auth=require(_0xfed1('0x7'));var interaction=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var controller=require(_0xfed1('0xa'));router[_0xfed1('0xb')]('/',auth[_0xfed1('0xc')](),controller[_0xfed1('0xd')]);router[_0xfed1('0xb')](_0xfed1('0xe'),controller[_0xfed1('0xf')]);router[_0xfed1('0xb')]('/:id',auth[_0xfed1('0xc')](),controller[_0xfed1('0x10')]);router['get'](_0xfed1('0x11'),auth[_0xfed1('0xc')](),controller['download']);var upload=multer({'storage':multer[_0xfed1('0x12')]({'destination':function(_0x48c338,_0x1c3f40,_0x234f4e){_0x234f4e(null,path['join'](config['root'],_0xfed1('0x13')));},'filename':function(_0xe84ba6,_0x569a6e,_0x17f4fe){_0x569a6e['originalname']=_0x569a6e['originalname'][_0xfed1('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x17f4fe(null,util[_0xfed1('0x15')]('%s-%s%s',path[_0xfed1('0x16')](_0x569a6e['originalname'],path['extname'](_0x569a6e[_0xfed1('0x17')])),Date[_0xfed1('0x18')](),path[_0xfed1('0x19')](_0x569a6e[_0xfed1('0x17')])));}})});router['post']('/',upload[_0xfed1('0x1a')]('file'),controller[_0xfed1('0x1b')]);router[_0xfed1('0x1c')]('/webhook',controller[_0xfed1('0x1d')]);router[_0xfed1('0x1e')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfed1('0x1f')]('/:id',auth[_0xfed1('0xc')](),controller[_0xfed1('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index d5f3ada..f8bb565 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 _0x22e1=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN'];(function(_0x49103a,_0x5c78b8){var _0x24a833=function(_0x393dfd){while(--_0x393dfd){_0x49103a['push'](_0x49103a['shift']());}};_0x24a833(++_0x5c78b8);}(_0x22e1,0x1c5));var _0x122e=function(_0xa81a7f,_0xc1b7a8){_0xa81a7f=_0xa81a7f-0x0;var _0x29cb87=_0x22e1[_0xa81a7f];return _0x29cb87;};'use strict';var Sequelize=require(_0x122e('0x0'));module[_0x122e('0x1')]={'name':{'type':Sequelize[_0x122e('0x2')]},'type':{'type':Sequelize[_0x122e('0x3')](_0x122e('0x4'),_0x122e('0x5'))},'description':{'type':Sequelize[_0x122e('0x6')]},'version':{'type':Sequelize[_0x122e('0x6')]},'path':{'type':Sequelize[_0x122e('0x2')],'comment':_0x122e('0x7')},'active':{'type':Sequelize[_0x122e('0x8')],'defaultValue':0x0,'comment':_0x122e('0x9')},'sidebar':{'type':Sequelize[_0x122e('0x3')](_0x122e('0xa'),_0x122e('0xb'),_0x122e('0xc'),'never'),'defaultValue':_0x122e('0xc'),'comment':_0x122e('0xd')},'icon':{'type':Sequelize[_0x122e('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x122e('0x2')]},'scriptName':{'type':Sequelize[_0x122e('0x2')]},'scriptPath':{'type':Sequelize[_0x122e('0x2')]}}; \ No newline at end of file +var _0x8b68=['exports','ENUM','html','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x4778a3,_0x1e33c5){var _0x19cb45=function(_0x121e7b){while(--_0x121e7b){_0x4778a3['push'](_0x4778a3['shift']());}};_0x19cb45(++_0x1e33c5);}(_0x8b68,0x1b8));var _0x88b6=function(_0x13d803,_0x314abe){_0x13d803=_0x13d803-0x0;var _0x4b4a24=_0x8b68[_0x13d803];return _0x4b4a24;};'use strict';var Sequelize=require('sequelize');module[_0x88b6('0x0')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x88b6('0x1')](_0x88b6('0x2'),'script')},'description':{'type':Sequelize[_0x88b6('0x3')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x88b6('0x4')],'comment':_0x88b6('0x5')},'active':{'type':Sequelize[_0x88b6('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x88b6('0x1')](_0x88b6('0x7'),'agentOnly',_0x88b6('0x8'),_0x88b6('0x9')),'defaultValue':_0x88b6('0x8'),'comment':_0x88b6('0xa')},'icon':{'type':Sequelize[_0x88b6('0x4')]},'adminUrl':{'type':Sequelize[_0x88b6('0x4')]},'agentUrl':{'type':Sequelize[_0x88b6('0x4')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 2dc02b9..e447c40 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 _0x4779=['script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','resolve','http://localhost:','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','end','json','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','status','stack','name','send','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','length','find','params','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','error','pipe','glob','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','html','views','Invalid\x20manifest:\x20views\x20missing','parameters','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified'];(function(_0x4243e7,_0x124ea8){var _0x18f287=function(_0x1d926c){while(--_0x1d926c){_0x4243e7['push'](_0x4243e7['shift']());}};_0x18f287(++_0x124ea8);}(_0x4779,0xda));var _0x9477=function(_0x408cc2,_0x32ab31){_0x408cc2=_0x408cc2-0x0;var _0x200a63=_0x4779[_0x408cc2];return _0x200a63;};'use strict';var emlformat=require(_0x9477('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9477('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9477('0x2'));var moment=require(_0x9477('0x3'));var BPromise=require(_0x9477('0x4'));var Mustache=require(_0x9477('0x5'));var util=require(_0x9477('0x6'));var path=require(_0x9477('0x7'));var sox=require('sox');var csv=require(_0x9477('0x8'));var ejs=require(_0x9477('0x9'));var fs=require('fs');var fs_extra=require(_0x9477('0xa'));var _=require(_0x9477('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9477('0xc'));var deskjs=require(_0x9477('0xd'));var toCsv=require(_0x9477('0x8'));var querystring=require(_0x9477('0xe'));var Papa=require(_0x9477('0xf'));var extract=require(_0x9477('0x10'));var rimraf=require(_0x9477('0x11'));var archiver=require(_0x9477('0x12'));var Redis=require(_0x9477('0x13'));var authService=require(_0x9477('0x14'));var qs=require(_0x9477('0x15'));var as=require(_0x9477('0x16'));var hardwareService=require(_0x9477('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x9477('0x18'));var config=require(_0x9477('0x19'));var licenseUtil=require(_0x9477('0x1a'));var db=require('../../mysqldb')['db'];config[_0x9477('0x1b')]=_[_0x9477('0x1c')](config[_0x9477('0x1b')],{'host':_0x9477('0x1d'),'port':0x18eb});var socket=require(_0x9477('0x1e'))(new Redis(config[_0x9477('0x1b')]));require(_0x9477('0x1f'))[_0x9477('0x20')](socket);function respondWithStatusCode(_0x5825f8,_0x28e342){_0x28e342=_0x28e342||0xcc;return function(_0x1a4ac7){if(_0x1a4ac7){return _0x5825f8[_0x9477('0x21')](_0x28e342);}return _0x5825f8['status'](_0x28e342)[_0x9477('0x22')]();};}function respondWithResult(_0x586c05,_0xdba62d){_0xdba62d=_0xdba62d||0xc8;return function(_0x5476b8){if(_0x5476b8){return _0x586c05['status'](_0xdba62d)[_0x9477('0x23')](_0x5476b8);}};}function respondWithFilteredResult(_0xc9c156,_0xf874b5){return function(_0x29c4d8){if(_0x29c4d8){var _0x38fad9=typeof _0xf874b5['offset']==='undefined'&&typeof _0xf874b5['limit']===_0x9477('0x24');var _0x408858=_0x29c4d8[_0x9477('0x25')];var _0x2bf3d7=_0x38fad9?0x0:_0xf874b5['offset'];var _0x15cac0=_0x38fad9?_0x29c4d8[_0x9477('0x25')]:_0xf874b5[_0x9477('0x26')]+_0xf874b5[_0x9477('0x27')];var _0x536d98;if(_0x15cac0>=_0x408858){_0x15cac0=_0x408858;_0x536d98=0xc8;}else{_0x536d98=0xce;}_0xc9c156['status'](_0x536d98);return _0xc9c156[_0x9477('0x28')]('Content-Range',_0x2bf3d7+'-'+_0x15cac0+'/'+_0x408858)['json'](_0x29c4d8);}return null;};}function patchUpdates(_0xeefcdb){return function(_0x5ba9e9){try{jsonpatch[_0x9477('0x29')](_0x5ba9e9,_0xeefcdb,!![]);}catch(_0xc03506){return BPromise[_0x9477('0x2a')](_0xc03506);}return _0x5ba9e9[_0x9477('0x2b')]();};}function saveUpdates(_0x2a7531,_0x116aa3){return function(_0x38be7f){if(_0x38be7f){return _0x38be7f[_0x9477('0x2c')](_0x2a7531)[_0x9477('0x2d')](function(_0x41f34e){return _0x41f34e;});}return null;};}function removeEntity(_0x1fb916,_0x4e938d){return function(_0x584493){if(_0x584493){return _0x584493[_0x9477('0x2e')]()['then'](function(){var _0x3dd85b=_0x584493[_0x9477('0x2f')]({'plain':!![]});var _0x2157b5=_0x9477('0x30');return db[_0x9477('0x31')][_0x9477('0x2e')]({'where':{'type':_0x2157b5,'resourceId':_0x3dd85b['id']}})[_0x9477('0x2d')](function(){return _0x584493;});})['then'](function(){_0x1fb916[_0x9477('0x32')](0xcc)[_0x9477('0x22')]();});}};}function handleEntityNotFound(_0x33bbcf,_0x46806e){return function(_0x2815f3){if(!_0x2815f3){_0x33bbcf['sendStatus'](0x194);}return _0x2815f3;};}function handleError(_0x203c6c,_0x3db0df){_0x3db0df=_0x3db0df||0x1f4;return function(_0x31e263){logger['error'](_0x31e263[_0x9477('0x33')]);if(_0x31e263[_0x9477('0x34')]){delete _0x31e263[_0x9477('0x34')];}_0x203c6c['status'](_0x3db0df)[_0x9477('0x35')](_0x31e263);};}exports['index']=function(_0x5236c6,_0x48a62c){var _0x42f39a={},_0x59d306={},_0x38d50f={'count':0x0,'rows':[]};var _0x17c967=_[_0x9477('0x36')](db[_0x9477('0x37')][_0x9477('0x38')],function(_0xf1e8ce){return{'name':_0xf1e8ce[_0x9477('0x39')],'type':_0xf1e8ce[_0x9477('0x3a')][_0x9477('0x3b')]};});_0x59d306[_0x9477('0x3c')]=_[_0x9477('0x36')](_0x17c967,_0x9477('0x34'));_0x59d306[_0x9477('0x3d')]=_[_0x9477('0x3e')](_0x5236c6[_0x9477('0x3d')]);_0x59d306[_0x9477('0x3f')]=_['intersection'](_0x59d306[_0x9477('0x3c')],_0x59d306[_0x9477('0x3d')]);_0x42f39a[_0x9477('0x40')]=_[_0x9477('0x41')](_0x59d306[_0x9477('0x3c')],qs[_0x9477('0x42')](_0x5236c6[_0x9477('0x3d')]['fields']));_0x42f39a['attributes']=_0x42f39a[_0x9477('0x40')]['length']?_0x42f39a[_0x9477('0x40')]:_0x59d306[_0x9477('0x3c')];if(!_0x5236c6[_0x9477('0x3d')]['hasOwnProperty'](_0x9477('0x43'))){_0x42f39a[_0x9477('0x27')]=qs[_0x9477('0x27')](_0x5236c6[_0x9477('0x3d')]['limit']);_0x42f39a[_0x9477('0x26')]=qs[_0x9477('0x26')](_0x5236c6[_0x9477('0x3d')][_0x9477('0x26')]);}_0x42f39a['order']=qs[_0x9477('0x44')](_0x5236c6[_0x9477('0x3d')]['sort']);_0x42f39a[_0x9477('0x45')]=qs['filters'](_['pick'](_0x5236c6[_0x9477('0x3d')],_0x59d306[_0x9477('0x3f')]),_0x17c967);if(_0x5236c6[_0x9477('0x3d')]['filter']){_0x42f39a[_0x9477('0x45')]=_[_0x9477('0x46')](_0x42f39a['where'],{'$or':_[_0x9477('0x36')](_0x17c967,function(_0x1b5d09){if(_0x1b5d09[_0x9477('0x3a')]!==_0x9477('0x47')){var _0x30e36b={};_0x30e36b[_0x1b5d09[_0x9477('0x34')]]={'$like':'%'+_0x5236c6[_0x9477('0x3d')][_0x9477('0x48')]+'%'};return _0x30e36b;}})});}_0x42f39a=_[_0x9477('0x46')]({},_0x42f39a,_0x5236c6[_0x9477('0x49')]);var _0x3f404d={'where':_0x42f39a[_0x9477('0x45')]};return db['Plugin'][_0x9477('0x25')](_0x3f404d)['then'](function(_0x854612){_0x38d50f[_0x9477('0x25')]=_0x854612;if(_0x5236c6[_0x9477('0x3d')][_0x9477('0x4a')]){_0x42f39a[_0x9477('0x4b')]=[{'all':!![]}];}return db[_0x9477('0x37')][_0x9477('0x4c')](_0x42f39a);})['then'](function(_0x182453){_0x38d50f[_0x9477('0x4d')]=_0x182453;return _0x38d50f;})[_0x9477('0x2d')](respondWithFilteredResult(_0x48a62c,_0x42f39a))[_0x9477('0x4e')](handleError(_0x48a62c,null));};exports['show']=function(_0x204bd9,_0x1cabcf){var _0x52c3e9={'raw':!![],'where':{'id':_0x204bd9['params']['id']}},_0x57f38c={};_0x57f38c['model']=_[_0x9477('0x3e')](db[_0x9477('0x37')][_0x9477('0x38')]);_0x57f38c[_0x9477('0x3d')]=_[_0x9477('0x3e')](_0x204bd9['query']);_0x57f38c[_0x9477('0x3f')]=_['intersection'](_0x57f38c['model'],_0x57f38c['query']);_0x52c3e9['attributes']=_[_0x9477('0x41')](_0x57f38c[_0x9477('0x3c')],qs[_0x9477('0x42')](_0x204bd9['query'][_0x9477('0x42')]));_0x52c3e9[_0x9477('0x40')]=_0x52c3e9['attributes'][_0x9477('0x4f')]?_0x52c3e9[_0x9477('0x40')]:_0x57f38c['model'];if(_0x204bd9[_0x9477('0x3d')]['includeAll']){_0x52c3e9['include']=[{'all':!![]}];}_0x52c3e9=_[_0x9477('0x46')]({},_0x52c3e9,_0x204bd9[_0x9477('0x49')]);return db[_0x9477('0x37')][_0x9477('0x50')](_0x52c3e9)[_0x9477('0x2d')](handleEntityNotFound(_0x1cabcf,null))[_0x9477('0x2d')](respondWithResult(_0x1cabcf,null))['catch'](handleError(_0x1cabcf,null));};exports['download']=function(_0x20090c,_0x1510fd,_0xa559ff){return db[_0x9477('0x37')][_0x9477('0x50')]({'where':{'id':_0x20090c[_0x9477('0x51')]['id']},'attributes':['name',_0x9477('0x7')],'raw':!![]})[_0x9477('0x2d')](handleEntityNotFound(_0x1510fd,null))[_0x9477('0x2d')](function(_0x422023){if(_0x422023){var _0x42fdaa=path[_0x9477('0x52')](config[_0x9477('0x53')],_0x9477('0x54'),util[_0x9477('0x55')](_0x9477('0x56'),path[_0x9477('0x57')](_0x422023[_0x9477('0x7')])));var _0x46ba94=fs[_0x9477('0x58')](_0x42fdaa);var _0x40ba06=archiver(_0x9477('0x59'),{'zlib':{'level':0x9}});_0x40ba06['on'](_0x9477('0x5a'),function(_0x5ad618){if(_0x5ad618['code']===_0x9477('0x5b')){logger['error'](_0x5ad618);}else{throw new db[(_0x9477('0x5c'))][(_0x9477('0x5d'))](_0x9477('0x5e'));}});_0x40ba06['on'](_0x9477('0x5f'),function(_0x52d45c){throw new db[(_0x9477('0x5c'))]['Error'](_0x9477('0x5e'));});_0x40ba06[_0x9477('0x60')](_0x46ba94);_0x40ba06[_0x9477('0x61')]('**/*',{'cwd':path[_0x9477('0x52')](config['root'],'server/files/plugins',path[_0x9477('0x62')](_0x422023[_0x9477('0x7')])),'ignore':[path['join'](path[_0x9477('0x57')](_0x422023[_0x9477('0x7')]),_0x9477('0x63')),path['join'](path[_0x9477('0x57')](_0x422023[_0x9477('0x7')]),_0x9477('0x64'))],'nodir':!![]})[_0x9477('0x65')]();_0x46ba94['on'](_0x9477('0x66'),function(){if(!fs[_0x9477('0x67')](_0x42fdaa)){throw new db[(_0x9477('0x5c'))]['Error']('Plugin\x20not\x20found');}return _0x1510fd[_0x9477('0x68')](_0x42fdaa,util['format']('%s.zip',path[_0x9477('0x57')](_0x422023['path'])),function(_0x23206d){if(_0x23206d){throw new db[(_0x9477('0x5c'))]['Error'](_0x9477('0x69'));}fs[_0x9477('0x6a')](_0x42fdaa);logger['info'](_0x9477('0x6b'));logger[_0x9477('0x6c')](_0x9477('0x6d'));});});}return null;})[_0x9477('0x4e')](handleError(_0x1510fd,null));};exports[_0x9477('0x6e')]=function(_0x24792a,_0x489668,_0x3a93ea){var _0x20268a=path[_0x9477('0x57')](_0x24792a[_0x9477('0x6f')]['filename'],path[_0x9477('0x70')](_0x24792a[_0x9477('0x6f')][_0x9477('0x71')]));var _0x3f484a=path[_0x9477('0x52')](config['root'],_0x9477('0x54'),_0x24792a[_0x9477('0x6f')][_0x9477('0x71')]);var _0x49afe9=path[_0x9477('0x52')](config['root'],_0x9477('0x54'),_0x20268a);logger['info'](_0x9477('0x72'),_0x3f484a);logger[_0x9477('0x6c')](_0x9477('0x73'),_0x49afe9);try{fs[_0x9477('0x74')](_0x3f484a,parseInt('0777',0x8));extract(_0x3f484a,{'dir':_0x49afe9},function(_0x513e13){if(_0x513e13){logger[_0x9477('0x5f')](_0x513e13);handleError(_0x513e13,!![]);};var _0x337a14=fs[_0x9477('0x75')](_0x49afe9);if(_0x337a14[_0x9477('0x4f')]>0x1){removeReferences(_0x3f484a,_0x49afe9);logger[_0x9477('0x5f')](_0x9477('0x76'));return _0x3a93ea(new Error(_0x9477('0x76')));}var _0x536caa=fs[_0x9477('0x77')](path[_0x9477('0x52')](_0x49afe9,_0x337a14[0x0]));if(_0x536caa[_0x9477('0x78')]()){removeReferences(_0x3f484a,_0x49afe9);logger[_0x9477('0x5f')](_0x9477('0x76'));return _0x3a93ea(new Error(_0x9477('0x76')));}if(_0x536caa[_0x9477('0x79')]()){var _0x384b0d=fs[_0x9477('0x75')](path['join'](_0x49afe9,_0x337a14[0x0]));if(_0x384b0d['length']===0x0){removeReferences(_0x3f484a,_0x49afe9);logger['error'](_0x9477('0x76'));return _0x3a93ea(new Error(_0x9477('0x76')));}var _0x182414=_0x384b0d[_0x9477('0x7a')](function(_0x4fbbd1){return _0x4fbbd1===_0x9477('0x7b');});if(!_0x182414){return _0x3a93ea(new Error(_0x9477('0x7c')));}var _0x503f7e=fs[_0x9477('0x7d')](path[_0x9477('0x52')](_0x49afe9,_0x337a14[0x0],_0x9477('0x7b')));var _0x586edd=JSON[_0x9477('0x7e')](_0x503f7e);if(_0x9477('0x24')==typeof _0x586edd[_0x9477('0x34')]){return _0x3a93ea(new Error(_0x9477('0x7f')));}if(_0x9477('0x24')==typeof _0x586edd[_0x9477('0x3a')]){return _0x3a93ea(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x586edd['version']){return _0x3a93ea(new Error(_0x9477('0x80')));}if('undefined'==typeof _0x586edd['parameters']){return _0x3a93ea(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x586edd[_0x9477('0x3a')]===_0x9477('0x81')){if('undefined'==typeof _0x586edd['parameters'][_0x9477('0x82')]){return _0x3a93ea(new Error(_0x9477('0x83')));}if(_0x9477('0x24')==typeof _0x586edd[_0x9477('0x84')][_0x9477('0x82')][_0x9477('0x85')]&&_0x9477('0x24')==typeof _0x586edd[_0x9477('0x84')]['views'][_0x9477('0x86')]){return _0x3a93ea(new Error(_0x9477('0x87')));}}else if(_0x586edd[_0x9477('0x3a')]===_0x9477('0x88')){if(_0x9477('0x24')==typeof _0x586edd[_0x9477('0x84')][_0x9477('0x89')]){return _0x3a93ea(new Error(_0x9477('0x8a')));}if(_0x9477('0x24')==typeof _0x586edd[_0x9477('0x84')][_0x9477('0x8b')]){return _0x3a93ea(new Error(_0x9477('0x8c')));}}else{return _0x3a93ea(new Error(_0x9477('0x8d')));}var _0x249cdd=_0x586edd[_0x9477('0x34')];var _0x5d7180=_0x586edd[_0x9477('0x8e')];var _0xba0d3b=_0x586edd[_0x9477('0x3a')];var _0x269b55=_0x586edd['sidebar']?_0x586edd[_0x9477('0x8f')]:_0x9477('0x90');var _0x14bf3c=_0x586edd['icon']?_0x586edd[_0x9477('0x91')]:_0x9477('0x92');var _0xd509db='';var _0x2b08f0='';var _0x1d5a79='';var _0x737202='';var _0x4a3799=_0x586edd[_0x9477('0x93')];if(_0xba0d3b===_0x9477('0x81')){if(_0x9477('0x24')!=typeof _0x586edd[_0x9477('0x84')][_0x9477('0x82')][_0x9477('0x85')]){var _0x336fb8=_0x586edd[_0x9477('0x84')][_0x9477('0x82')][_0x9477('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x9477('0x94')](_0x336fb8)){_0xd509db=path[_0x9477('0x52')](_0x9477('0x95'),_0x20268a,_0x337a14[0x0],_0x336fb8);}else{_0xd509db=_0x336fb8;}}else{logger[_0x9477('0x6c')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x9477('0x24')!=typeof _0x586edd['parameters'][_0x9477('0x82')][_0x9477('0x86')]){var _0x1bd085=_0x586edd['parameters'][_0x9477('0x82')][_0x9477('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x9477('0x94')](_0x1bd085)){_0x2b08f0=path[_0x9477('0x52')]('plugins',_0x20268a,_0x337a14[0x0],_0x1bd085);}else{_0x2b08f0=_0x1bd085;}}else{logger[_0x9477('0x6c')](_0x9477('0x96'));}}else if(_0xba0d3b==='script'){_0x1d5a79=_0x586edd[_0x9477('0x84')][_0x9477('0x89')];_0x737202=_0x586edd[_0x9477('0x84')]['scriptPath'];if('undefined'!=typeof _0x586edd[_0x9477('0x84')][_0x9477('0x82')]){if(_0x9477('0x24')!=typeof _0x586edd[_0x9477('0x84')][_0x9477('0x82')][_0x9477('0x85')]){var _0x336fb8=_0x586edd[_0x9477('0x84')][_0x9477('0x82')][_0x9477('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x9477('0x94')](_0x336fb8)){_0xd509db=path['join'](_0x9477('0x95'),_0x20268a,_0x337a14[0x0],_0x336fb8);}else{_0xd509db=_0x336fb8;}}if('undefined'!=typeof _0x586edd['parameters'][_0x9477('0x82')]['agent']){var _0x1bd085=_0x586edd[_0x9477('0x84')][_0x9477('0x82')][_0x9477('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x9477('0x94')](_0x1bd085)){_0x2b08f0=path['join'](_0x9477('0x95'),_0x20268a,_0x337a14[0x0],_0x1bd085);}else{_0x2b08f0=_0x1bd085;}}}}var _0x4aee51={'name':_0x249cdd,'description':_0x5d7180,'path':path[_0x9477('0x52')](_0x20268a,_0x337a14[0x0]),'type':_0xba0d3b,'sidebar':_0x269b55,'icon':_0x14bf3c,'adminUrl':_0xd509db,'agentUrl':_0x2b08f0,'scriptName':_0x1d5a79,'scriptPath':_0x737202,'version':_0x4a3799};removeReferences(_0x3f484a,null);return db[_0x9477('0x37')][_0x9477('0x97')](_0x4aee51)[_0x9477('0x2d')](function(_0x1f747f){var _0x51f51e={'role':_0x24792a[_0x9477('0x98')][_0x9477('0x99')],'userProfileId':_0x24792a['body'][_0x9477('0x9a')]};if(!_0x51f51e)throw new Error(_0x9477('0x9b'));if(_0x51f51e['role']===_0x9477('0x9c')){var _0x2dff04=_0x1f747f[_0x9477('0x2f')]({'plain':!![]});return db[_0x9477('0x9d')]['find']({'where':{'name':_0x9477('0x30'),'userProfileId':_0x51f51e['userProfileId']},'raw':!![]})[_0x9477('0x2d')](function(_0x4ad043){if(_0x4ad043&&_0x4ad043[_0x9477('0x9e')]===0x0){return db[_0x9477('0x31')]['create']({'name':_0x2dff04[_0x9477('0x34')],'resourceId':_0x2dff04['id'],'type':_0x4ad043[_0x9477('0x34')],'sectionId':_0x4ad043['id']},{})[_0x9477('0x2d')](function(){return _0x1f747f;});}else{return _0x1f747f;}})[_0x9477('0x4e')](function(_0x137d73){logger[_0x9477('0x5f')](_0x9477('0x9f'),_0x137d73);throw _0x137d73;});}return _0x1f747f;})[_0x9477('0x2d')](respondWithResult(_0x489668,null))[_0x9477('0x4e')](handleError(_0x489668,null));}});}catch(_0x377cec){_0x489668[_0x9477('0x32')](0x1f4)[_0x9477('0x35')](_0x377cec);}};function removeReferences(_0x4677b5,_0xb2b421){try{if(_0x4677b5){fs[_0x9477('0x6a')](_0x4677b5);logger[_0x9477('0x6c')](_0x9477('0xa0'));}if(_0xb2b421){rimraf(_0xb2b421,function(){});logger[_0x9477('0x6c')]('Extracted\x20folder\x20removed');}}catch(_0x2e35aa){logger[_0x9477('0x5f')](_0x2e35aa);}}exports[_0x9477('0x2c')]=function(_0x115551,_0x3c23d8,_0x5b6e47){return db[_0x9477('0x37')][_0x9477('0x50')]({'where':{'id':_0x115551[_0x9477('0x51')]['id']}})[_0x9477('0x2d')](handleEntityNotFound(_0x3c23d8,null))[_0x9477('0x2d')](saveUpdates(_0x115551[_0x9477('0x98')],null))[_0x9477('0x2d')](respondWithResult(_0x3c23d8,null))[_0x9477('0x4e')](handleError(_0x3c23d8,null));};exports[_0x9477('0xa1')]=function(_0xefe54b,_0xb6161b,_0x48cb6a){return db[_0x9477('0x37')][_0x9477('0x50')]({'where':{'id':_0xefe54b[_0x9477('0x51')]['id']}})['then'](function(_0x1101be){if(_0x1101be){return _0x1101be['destroy']();}})[_0x9477('0x2d')](function(_0xfb8379){rimraf(path[_0x9477('0x52')](config[_0x9477('0x53')],_0x9477('0x54'),path[_0x9477('0x62')](_0xfb8379[_0x9477('0x7')])),function(){});return _0xfb8379;})[_0x9477('0x2d')](handleEntityNotFound(_0xb6161b,null))['then'](respondWithStatusCode(_0xb6161b,null))[_0x9477('0x4e')](handleError(_0xb6161b,null));};exports[_0x9477('0xa2')]=function(_0x5dacca,_0x58345c,_0xf7e81c){return BPromise['resolve']()['then'](function(){if(!_0x5dacca[_0x9477('0x3d')][_0x9477('0x7')]){throw new Error(_0x9477('0xa3'));}if(!_0x5dacca[_0x9477('0x3d')][_0x9477('0xa4')]){throw new Error(_0x9477('0xa5'));}var _0x3ace03=_0x5dacca[_0x9477('0x3d')][_0x9477('0xa6')]?_0x5dacca['query']['hostname']+':'+_0x5dacca['query'][_0x9477('0xa4')]:'http://localhost:'+_0x5dacca[_0x9477('0x3d')][_0x9477('0xa4')];var _0x160f9b=_0x5dacca['query'][_0x9477('0x23')]?_0x5dacca[_0x9477('0x3d')][_0x9477('0x23')]:!![];var _0x68d05=_0x5dacca[_0x9477('0x3d')][_0x9477('0xa7')]?_0x5dacca[_0x9477('0x3d')][_0x9477('0xa7')]:null;var _0x346caf={'method':_0x5dacca[_0x9477('0xa8')],'uri':util[_0x9477('0x55')](_0x9477('0xa9'),_0x3ace03,_0x5dacca['query'][_0x9477('0x7')]),'json':_0x160f9b,'resolveWithFullResponse':!![],'encoding':_0x68d05,'qs':_0x5dacca[_0x9477('0x3d')]};if(_0x5dacca[_0x9477('0xaa')]){_0x346caf[_0x9477('0xaa')]=_0x5dacca['headers'];if(_0x346caf[_0x9477('0xaa')][_0x9477('0xab')]){delete _0x346caf[_0x9477('0xaa')][_0x9477('0xab')];}}if(_0x346caf[_0x9477('0xaa')][_0x9477('0xac')]){delete _0x346caf[_0x9477('0xaa')][_0x9477('0xac')];}return rp(_0x346caf);})[_0x9477('0x2d')](function(_0x2c920a){if(_0x2c920a){_0x58345c[_0x9477('0x28')](_0x2c920a[_0x9477('0xaa')]);logger[_0x9477('0x6c')](_0x2c920a[_0x9477('0x98')]);if(_[_0x9477('0xad')](_0x5dacca[_0x9477('0x3d')][_0x9477('0x7')],_0x9477('0x68'))&&_0x2c920a[_0x9477('0xae')]==0x1f4){return _0x58345c[_0x9477('0x21')](_0x2c920a[_0x9477('0xae')]);}else{return _0x58345c[_0x9477('0x32')](_0x2c920a[_0x9477('0xae')])[_0x9477('0x35')](_0x2c920a[_0x9477('0x98')]);}}else{return _0x58345c[_0x9477('0x21')](0xc8);}})[_0x9477('0x4e')](handleError(_0x58345c,null));};exports['webhookPost']=function(_0x135e3a,_0x6a04c3,_0x574068){return BPromise[_0x9477('0xaf')]()[_0x9477('0x2d')](function(){if(!_0x135e3a[_0x9477('0x3d')][_0x9477('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x135e3a[_0x9477('0x3d')][_0x9477('0xa4')]){throw new Error(_0x9477('0xa5'));}var _0x18f4b7=_0x135e3a['query'][_0x9477('0xa6')]?_0x135e3a[_0x9477('0x3d')][_0x9477('0xa6')]+':'+_0x135e3a[_0x9477('0x3d')][_0x9477('0xa4')]:_0x9477('0xb0')+_0x135e3a[_0x9477('0x3d')]['port'];var _0x4773ae=_0x135e3a[_0x9477('0x3d')][_0x9477('0x23')]?_0x135e3a[_0x9477('0x3d')][_0x9477('0x23')]:!![];var _0x5a77c4=_0x135e3a[_0x9477('0x3d')][_0x9477('0xa7')]?_0x135e3a[_0x9477('0x3d')][_0x9477('0xa7')]:null;var _0xcb6a3f={'method':_0x135e3a[_0x9477('0xa8')],'uri':util[_0x9477('0x55')]('%s%s',_0x18f4b7,_0x135e3a[_0x9477('0x3d')][_0x9477('0x7')]),'json':_0x4773ae,'resolveWithFullResponse':!![],'encoding':_0x5a77c4,'body':_0x135e3a[_0x9477('0x98')]};if(_0x135e3a[_0x9477('0xaa')]){_0xcb6a3f[_0x9477('0xaa')]=_0x135e3a[_0x9477('0xaa')];if(_0xcb6a3f[_0x9477('0xaa')][_0x9477('0xab')]){delete _0xcb6a3f[_0x9477('0xaa')][_0x9477('0xab')];}}if(_0xcb6a3f[_0x9477('0xaa')][_0x9477('0xac')]){delete _0xcb6a3f['headers'][_0x9477('0xac')];}return rp(_0xcb6a3f);})[_0x9477('0x2d')](function(_0x5a0799){if(_0x5a0799){_0x6a04c3['set'](_0x5a0799[_0x9477('0xaa')]);logger['info'](_0x5a0799[_0x9477('0x98')]);return _0x6a04c3[_0x9477('0x32')](_0x5a0799[_0x9477('0xae')])['send'](_0x5a0799[_0x9477('0x98')]);}else{return _0x6a04c3['sendStatus'](0xc8);}})[_0x9477('0x4e')](handleError(_0x6a04c3,null));}; \ No newline at end of file +var _0x4c93=['limit','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','end','error','stack','name','send','Plugin','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','include','catch','show','params','includeAll','options','find','path','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','code','ENOENT','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','Error','**/*','dirname','node_modules/**/*','attachments/**/*','close','existsSync','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','file','filename','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','some','Plugin\x20manifest\x20missing','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','scriptName','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','autoAssociation','create','Zip\x20archive\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','json','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','http://localhost:','%s%s','eml-format','rimraf','fast-json-patch','moment','bluebird','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','archiver','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','offset','undefined','count'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0x4c93,0x1c2));var _0x34c9=function(_0x2c9254,_0x518dc5){_0x2c9254=_0x2c9254-0x0;var _0x277663=_0x4c93[_0x2c9254];return _0x277663;};'use strict';var emlformat=require(_0x34c9('0x0'));var rimraf=require(_0x34c9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x34c9('0x2'));var rp=require('request-promise');var moment=require(_0x34c9('0x3'));var BPromise=require(_0x34c9('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x34c9('0x5'));var fs=require('fs');var fs_extra=require(_0x34c9('0x6'));var _=require('lodash');var squel=require(_0x34c9('0x7'));var crypto=require(_0x34c9('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x34c9('0x9'));var toCsv=require(_0x34c9('0xa'));var querystring=require(_0x34c9('0xb'));var Papa=require(_0x34c9('0xc'));var extract=require('extract-zip');var rimraf=require(_0x34c9('0x1'));var archiver=require(_0x34c9('0xd'));var Redis=require(_0x34c9('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x34c9('0xf'));var hardwareService=require(_0x34c9('0x10'));var logger=require(_0x34c9('0x11'))(_0x34c9('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x34c9('0x13'))['db'];config[_0x34c9('0x14')]=_['defaults'](config[_0x34c9('0x14')],{'host':_0x34c9('0x15'),'port':0x18eb});var socket=require(_0x34c9('0x16'))(new Redis(config[_0x34c9('0x14')]));require(_0x34c9('0x17'))[_0x34c9('0x18')](socket);function respondWithStatusCode(_0x412b03,_0x41ffae){_0x41ffae=_0x41ffae||0xcc;return function(_0x5eb2d4){if(_0x5eb2d4){return _0x412b03[_0x34c9('0x19')](_0x41ffae);}return _0x412b03[_0x34c9('0x1a')](_0x41ffae)['end']();};}function respondWithResult(_0x2328b2,_0x2f5963){_0x2f5963=_0x2f5963||0xc8;return function(_0x73a291){if(_0x73a291){return _0x2328b2['status'](_0x2f5963)['json'](_0x73a291);}};}function respondWithFilteredResult(_0x29dd29,_0x119726){return function(_0x24b35a){if(_0x24b35a){var _0x1f5be1=typeof _0x119726[_0x34c9('0x1b')]===_0x34c9('0x1c')&&typeof _0x119726['limit']==='undefined';var _0x223e6e=_0x24b35a[_0x34c9('0x1d')];var _0xee5ef4=_0x1f5be1?0x0:_0x119726[_0x34c9('0x1b')];var _0x40b562=_0x1f5be1?_0x24b35a['count']:_0x119726['offset']+_0x119726[_0x34c9('0x1e')];var _0x21bddb;if(_0x40b562>=_0x223e6e){_0x40b562=_0x223e6e;_0x21bddb=0xc8;}else{_0x21bddb=0xce;}_0x29dd29[_0x34c9('0x1a')](_0x21bddb);return _0x29dd29[_0x34c9('0x1f')](_0x34c9('0x20'),_0xee5ef4+'-'+_0x40b562+'/'+_0x223e6e)['json'](_0x24b35a);}return null;};}function patchUpdates(_0x2b862d){return function(_0xb20535){try{jsonpatch[_0x34c9('0x21')](_0xb20535,_0x2b862d,!![]);}catch(_0x1fbb28){return BPromise[_0x34c9('0x22')](_0x1fbb28);}return _0xb20535[_0x34c9('0x23')]();};}function saveUpdates(_0x155ea4,_0x52538e){return function(_0x2f3796){if(_0x2f3796){return _0x2f3796['update'](_0x155ea4)[_0x34c9('0x24')](function(_0x3fc97b){return _0x3fc97b;});}return null;};}function removeEntity(_0xc2fd1c,_0x3b68d0){return function(_0x31ecfa){if(_0x31ecfa){return _0x31ecfa[_0x34c9('0x25')]()[_0x34c9('0x24')](function(){var _0x7b89a=_0x31ecfa['get']({'plain':!![]});var _0x3b6f40='Plugins';return db[_0x34c9('0x26')][_0x34c9('0x25')]({'where':{'type':_0x3b6f40,'resourceId':_0x7b89a['id']}})[_0x34c9('0x24')](function(){return _0x31ecfa;});})[_0x34c9('0x24')](function(){_0xc2fd1c[_0x34c9('0x1a')](0xcc)[_0x34c9('0x27')]();});}};}function handleEntityNotFound(_0x262983,_0x824cab){return function(_0x34137a){if(!_0x34137a){_0x262983[_0x34c9('0x19')](0x194);}return _0x34137a;};}function handleError(_0x10ea3f,_0x240cb8){_0x240cb8=_0x240cb8||0x1f4;return function(_0x1da1e4){logger[_0x34c9('0x28')](_0x1da1e4[_0x34c9('0x29')]);if(_0x1da1e4[_0x34c9('0x2a')]){delete _0x1da1e4['name'];}_0x10ea3f['status'](_0x240cb8)[_0x34c9('0x2b')](_0x1da1e4);};}exports['index']=function(_0x4c596d,_0x26669f){var _0x3c10a7={},_0x18b302={},_0x4f7aff={'count':0x0,'rows':[]};var _0xcd6f1f=_['map'](db[_0x34c9('0x2c')][_0x34c9('0x2d')],function(_0x27d365){return{'name':_0x27d365[_0x34c9('0x2e')],'type':_0x27d365[_0x34c9('0x2f')][_0x34c9('0x30')]};});_0x18b302[_0x34c9('0x31')]=_[_0x34c9('0x32')](_0xcd6f1f,_0x34c9('0x2a'));_0x18b302['query']=_[_0x34c9('0x33')](_0x4c596d['query']);_0x18b302[_0x34c9('0x34')]=_[_0x34c9('0x35')](_0x18b302['model'],_0x18b302[_0x34c9('0x36')]);_0x3c10a7[_0x34c9('0x37')]=_[_0x34c9('0x35')](_0x18b302[_0x34c9('0x31')],qs[_0x34c9('0x38')](_0x4c596d[_0x34c9('0x36')][_0x34c9('0x38')]));_0x3c10a7['attributes']=_0x3c10a7[_0x34c9('0x37')][_0x34c9('0x39')]?_0x3c10a7[_0x34c9('0x37')]:_0x18b302['model'];if(!_0x4c596d['query'][_0x34c9('0x3a')]('nolimit')){_0x3c10a7[_0x34c9('0x1e')]=qs[_0x34c9('0x1e')](_0x4c596d[_0x34c9('0x36')][_0x34c9('0x1e')]);_0x3c10a7[_0x34c9('0x1b')]=qs[_0x34c9('0x1b')](_0x4c596d[_0x34c9('0x36')][_0x34c9('0x1b')]);}_0x3c10a7['order']=qs[_0x34c9('0x3b')](_0x4c596d['query']['sort']);_0x3c10a7['where']=qs[_0x34c9('0x34')](_[_0x34c9('0x3c')](_0x4c596d[_0x34c9('0x36')],_0x18b302[_0x34c9('0x34')]),_0xcd6f1f);if(_0x4c596d[_0x34c9('0x36')][_0x34c9('0x3d')]){_0x3c10a7[_0x34c9('0x3e')]=_[_0x34c9('0x3f')](_0x3c10a7[_0x34c9('0x3e')],{'$or':_[_0x34c9('0x32')](_0xcd6f1f,function(_0x2066ea){if(_0x2066ea[_0x34c9('0x2f')]!==_0x34c9('0x40')){var _0x5e8243={};_0x5e8243[_0x2066ea[_0x34c9('0x2a')]]={'$like':'%'+_0x4c596d[_0x34c9('0x36')][_0x34c9('0x3d')]+'%'};return _0x5e8243;}})});}_0x3c10a7=_['merge']({},_0x3c10a7,_0x4c596d['options']);var _0x109614={'where':_0x3c10a7['where']};return db[_0x34c9('0x2c')][_0x34c9('0x1d')](_0x109614)['then'](function(_0x1261ad){_0x4f7aff['count']=_0x1261ad;if(_0x4c596d[_0x34c9('0x36')]['includeAll']){_0x3c10a7[_0x34c9('0x41')]=[{'all':!![]}];}return db[_0x34c9('0x2c')]['findAll'](_0x3c10a7);})[_0x34c9('0x24')](function(_0x28c6f4){_0x4f7aff['rows']=_0x28c6f4;return _0x4f7aff;})[_0x34c9('0x24')](respondWithFilteredResult(_0x26669f,_0x3c10a7))[_0x34c9('0x42')](handleError(_0x26669f,null));};exports[_0x34c9('0x43')]=function(_0x16a8d1,_0x5e7c5e){var _0x1ef52d={'raw':!![],'where':{'id':_0x16a8d1[_0x34c9('0x44')]['id']}},_0x461a47={};_0x461a47[_0x34c9('0x31')]=_[_0x34c9('0x33')](db[_0x34c9('0x2c')][_0x34c9('0x2d')]);_0x461a47[_0x34c9('0x36')]=_[_0x34c9('0x33')](_0x16a8d1['query']);_0x461a47[_0x34c9('0x34')]=_[_0x34c9('0x35')](_0x461a47[_0x34c9('0x31')],_0x461a47[_0x34c9('0x36')]);_0x1ef52d[_0x34c9('0x37')]=_[_0x34c9('0x35')](_0x461a47[_0x34c9('0x31')],qs[_0x34c9('0x38')](_0x16a8d1[_0x34c9('0x36')][_0x34c9('0x38')]));_0x1ef52d[_0x34c9('0x37')]=_0x1ef52d[_0x34c9('0x37')]['length']?_0x1ef52d[_0x34c9('0x37')]:_0x461a47['model'];if(_0x16a8d1[_0x34c9('0x36')][_0x34c9('0x45')]){_0x1ef52d[_0x34c9('0x41')]=[{'all':!![]}];}_0x1ef52d=_[_0x34c9('0x3f')]({},_0x1ef52d,_0x16a8d1[_0x34c9('0x46')]);return db[_0x34c9('0x2c')][_0x34c9('0x47')](_0x1ef52d)[_0x34c9('0x24')](handleEntityNotFound(_0x5e7c5e,null))[_0x34c9('0x24')](respondWithResult(_0x5e7c5e,null))['catch'](handleError(_0x5e7c5e,null));};exports['download']=function(_0x22cbfa,_0x20e327,_0x100a09){return db['Plugin'][_0x34c9('0x47')]({'where':{'id':_0x22cbfa[_0x34c9('0x44')]['id']},'attributes':['name',_0x34c9('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0x20e327,null))['then'](function(_0x465521){if(_0x465521){var _0x525e79=path[_0x34c9('0x49')](config[_0x34c9('0x4a')],_0x34c9('0x4b'),util[_0x34c9('0x4c')](_0x34c9('0x4d'),path[_0x34c9('0x4e')](_0x465521['path'])));var _0x3f253e=fs[_0x34c9('0x4f')](_0x525e79);var _0x2bb884=archiver(_0x34c9('0x50'),{'zlib':{'level':0x9}});_0x2bb884['on']('warning',function(_0x403777){if(_0x403777[_0x34c9('0x51')]===_0x34c9('0x52')){logger[_0x34c9('0x28')](_0x403777);}else{throw new db['Sequelize']['Error'](_0x34c9('0x53'));}});_0x2bb884['on'](_0x34c9('0x28'),function(_0x218959){throw new db[(_0x34c9('0x54'))][(_0x34c9('0x55'))](_0x34c9('0x53'));});_0x2bb884['pipe'](_0x3f253e);_0x2bb884['glob'](_0x34c9('0x56'),{'cwd':path[_0x34c9('0x49')](config[_0x34c9('0x4a')],_0x34c9('0x4b'),path[_0x34c9('0x57')](_0x465521[_0x34c9('0x48')])),'ignore':[path[_0x34c9('0x49')](path['basename'](_0x465521[_0x34c9('0x48')]),_0x34c9('0x58')),path[_0x34c9('0x49')](path[_0x34c9('0x4e')](_0x465521[_0x34c9('0x48')]),_0x34c9('0x59'))],'nodir':!![]})['finalize']();_0x3f253e['on'](_0x34c9('0x5a'),function(){if(!fs[_0x34c9('0x5b')](_0x525e79)){throw new db[(_0x34c9('0x54'))][(_0x34c9('0x55'))](_0x34c9('0x5c'));}return _0x20e327[_0x34c9('0x5d')](_0x525e79,util[_0x34c9('0x4c')](_0x34c9('0x4d'),path[_0x34c9('0x4e')](_0x465521[_0x34c9('0x48')])),function(_0x13e995){if(_0x13e995){throw new db[(_0x34c9('0x54'))][(_0x34c9('0x55'))](_0x34c9('0x5e'));}fs[_0x34c9('0x5f')](_0x525e79);logger['info'](_0x34c9('0x60'));logger[_0x34c9('0x61')](_0x34c9('0x62'));});});}return null;})['catch'](handleError(_0x20e327,null));};exports['upload']=function(_0x2f907c,_0x38d7ea,_0x577e78){var _0x2bb669=path[_0x34c9('0x4e')](_0x2f907c[_0x34c9('0x63')][_0x34c9('0x64')],path['extname'](_0x2f907c[_0x34c9('0x63')][_0x34c9('0x64')]));var _0x5356db=path['join'](config[_0x34c9('0x4a')],_0x34c9('0x4b'),_0x2f907c['file'][_0x34c9('0x64')]);var _0x3252fe=path[_0x34c9('0x49')](config[_0x34c9('0x4a')],_0x34c9('0x4b'),_0x2bb669);logger[_0x34c9('0x61')]('Plugin\x20upload\x20filepath:\x20%s',_0x5356db);logger['info'](_0x34c9('0x65'),_0x3252fe);try{fs[_0x34c9('0x66')](_0x5356db,parseInt(_0x34c9('0x67'),0x8));extract(_0x5356db,{'dir':_0x3252fe},function(_0x36d915){if(_0x36d915){logger['error'](_0x36d915);handleError(_0x36d915,!![]);};var _0x327e98=fs[_0x34c9('0x68')](_0x3252fe);if(_0x327e98[_0x34c9('0x39')]>0x1){removeReferences(_0x5356db,_0x3252fe);logger[_0x34c9('0x28')](_0x34c9('0x69'));return _0x577e78(new Error(_0x34c9('0x69')));}var _0x4bb421=fs[_0x34c9('0x6a')](path[_0x34c9('0x49')](_0x3252fe,_0x327e98[0x0]));if(_0x4bb421['isFile']()){removeReferences(_0x5356db,_0x3252fe);logger[_0x34c9('0x28')](_0x34c9('0x69'));return _0x577e78(new Error(_0x34c9('0x69')));}if(_0x4bb421['isDirectory']()){var _0x4ff502=fs['readdirSync'](path[_0x34c9('0x49')](_0x3252fe,_0x327e98[0x0]));if(_0x4ff502[_0x34c9('0x39')]===0x0){removeReferences(_0x5356db,_0x3252fe);logger[_0x34c9('0x28')](_0x34c9('0x69'));return _0x577e78(new Error(_0x34c9('0x69')));}var _0x482b76=_0x4ff502[_0x34c9('0x6b')](function(_0x3a5075){return _0x3a5075==='manifest.json';});if(!_0x482b76){return _0x577e78(new Error(_0x34c9('0x6c')));}var _0x118649=fs['readFileSync'](path[_0x34c9('0x49')](_0x3252fe,_0x327e98[0x0],_0x34c9('0x6d')));var _0x2d6208=JSON[_0x34c9('0x6e')](_0x118649);if(_0x34c9('0x1c')==typeof _0x2d6208[_0x34c9('0x2a')]){return _0x577e78(new Error(_0x34c9('0x6f')));}if(_0x34c9('0x1c')==typeof _0x2d6208[_0x34c9('0x2f')]){return _0x577e78(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x34c9('0x1c')==typeof _0x2d6208[_0x34c9('0x70')]){return _0x577e78(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x34c9('0x1c')==typeof _0x2d6208['parameters']){return _0x577e78(new Error(_0x34c9('0x71')));}if(_0x2d6208[_0x34c9('0x2f')]===_0x34c9('0x72')){if(_0x34c9('0x1c')==typeof _0x2d6208[_0x34c9('0x73')][_0x34c9('0x74')]){return _0x577e78(new Error(_0x34c9('0x75')));}if(_0x34c9('0x1c')==typeof _0x2d6208[_0x34c9('0x73')]['views'][_0x34c9('0x76')]&&_0x34c9('0x1c')==typeof _0x2d6208['parameters'][_0x34c9('0x74')]['agent']){return _0x577e78(new Error(_0x34c9('0x77')));}}else if(_0x2d6208['type']==='script'){if('undefined'==typeof _0x2d6208[_0x34c9('0x73')]['scriptName']){return _0x577e78(new Error(_0x34c9('0x78')));}if(_0x34c9('0x1c')==typeof _0x2d6208[_0x34c9('0x73')][_0x34c9('0x79')]){return _0x577e78(new Error(_0x34c9('0x7a')));}}else{return _0x577e78(new Error(_0x34c9('0x7b')));}var _0x23a25e=_0x2d6208[_0x34c9('0x2a')];var _0x2afd52=_0x2d6208['description'];var _0x11c4da=_0x2d6208[_0x34c9('0x2f')];var _0x564c0c=_0x2d6208[_0x34c9('0x7c')]?_0x2d6208[_0x34c9('0x7c')]:_0x34c9('0x7d');var _0x2249b2=_0x2d6208['icon']?_0x2d6208['icon']:_0x34c9('0x7e');var _0x2bb07e='';var _0x459326='';var _0x4e8ec3='';var _0x246325='';var _0x167403=_0x2d6208[_0x34c9('0x70')];if(_0x11c4da==='html'){if(_0x34c9('0x1c')!=typeof _0x2d6208[_0x34c9('0x73')][_0x34c9('0x74')][_0x34c9('0x76')]){var _0x4510c0=_0x2d6208[_0x34c9('0x73')][_0x34c9('0x74')][_0x34c9('0x76')];if(!/^(f|ht)tps?:\/\//i[_0x34c9('0x7f')](_0x4510c0)){_0x2bb07e=path[_0x34c9('0x49')](_0x34c9('0x80'),_0x2bb669,_0x327e98[0x0],_0x4510c0);}else{_0x2bb07e=_0x4510c0;}}else{logger[_0x34c9('0x61')](_0x34c9('0x81'));}if(_0x34c9('0x1c')!=typeof _0x2d6208[_0x34c9('0x73')]['views'][_0x34c9('0x82')]){var _0x27ea1d=_0x2d6208[_0x34c9('0x73')][_0x34c9('0x74')][_0x34c9('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x34c9('0x7f')](_0x27ea1d)){_0x459326=path[_0x34c9('0x49')](_0x34c9('0x80'),_0x2bb669,_0x327e98[0x0],_0x27ea1d);}else{_0x459326=_0x27ea1d;}}else{logger[_0x34c9('0x61')](_0x34c9('0x83'));}}else if(_0x11c4da==='script'){_0x4e8ec3=_0x2d6208[_0x34c9('0x73')][_0x34c9('0x84')];_0x246325=_0x2d6208[_0x34c9('0x73')][_0x34c9('0x79')];if('undefined'!=typeof _0x2d6208[_0x34c9('0x73')][_0x34c9('0x74')]){if(_0x34c9('0x1c')!=typeof _0x2d6208[_0x34c9('0x73')][_0x34c9('0x74')][_0x34c9('0x76')]){var _0x4510c0=_0x2d6208['parameters']['views'][_0x34c9('0x76')];if(!/^(f|ht)tps?:\/\//i[_0x34c9('0x7f')](_0x4510c0)){_0x2bb07e=path[_0x34c9('0x49')](_0x34c9('0x80'),_0x2bb669,_0x327e98[0x0],_0x4510c0);}else{_0x2bb07e=_0x4510c0;}}if('undefined'!=typeof _0x2d6208[_0x34c9('0x73')][_0x34c9('0x74')]['agent']){var _0x27ea1d=_0x2d6208[_0x34c9('0x73')][_0x34c9('0x74')][_0x34c9('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x34c9('0x7f')](_0x27ea1d)){_0x459326=path[_0x34c9('0x49')]('plugins',_0x2bb669,_0x327e98[0x0],_0x27ea1d);}else{_0x459326=_0x27ea1d;}}}}var _0x19e143={'name':_0x23a25e,'description':_0x2afd52,'path':path[_0x34c9('0x49')](_0x2bb669,_0x327e98[0x0]),'type':_0x11c4da,'sidebar':_0x564c0c,'icon':_0x2249b2,'adminUrl':_0x2bb07e,'agentUrl':_0x459326,'scriptName':_0x4e8ec3,'scriptPath':_0x246325,'version':_0x167403};removeReferences(_0x5356db,null);return db['Plugin']['create'](_0x19e143)[_0x34c9('0x24')](function(_0x196871){var _0xbdbb2d={'role':_0x2f907c[_0x34c9('0x85')][_0x34c9('0x86')],'userProfileId':_0x2f907c['body'][_0x34c9('0x87')]};if(!_0xbdbb2d)throw new Error(_0x34c9('0x88'));if(_0xbdbb2d[_0x34c9('0x86')]===_0x34c9('0x89')){var _0x5b51dc=_0x196871['get']({'plain':!![]});return db[_0x34c9('0x8a')][_0x34c9('0x47')]({'where':{'name':_0x34c9('0x8b'),'userProfileId':_0xbdbb2d['userProfileId']},'raw':!![]})[_0x34c9('0x24')](function(_0x1fe3b4){if(_0x1fe3b4&&_0x1fe3b4[_0x34c9('0x8c')]===0x0){return db[_0x34c9('0x26')][_0x34c9('0x8d')]({'name':_0x5b51dc[_0x34c9('0x2a')],'resourceId':_0x5b51dc['id'],'type':_0x1fe3b4[_0x34c9('0x2a')],'sectionId':_0x1fe3b4['id']},{})[_0x34c9('0x24')](function(){return _0x196871;});}else{return _0x196871;}})['catch'](function(_0x21cb13){logger[_0x34c9('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21cb13);throw _0x21cb13;});}return _0x196871;})[_0x34c9('0x24')](respondWithResult(_0x38d7ea,null))['catch'](handleError(_0x38d7ea,null));}});}catch(_0x195f08){_0x38d7ea[_0x34c9('0x1a')](0x1f4)['send'](_0x195f08);}};function removeReferences(_0x4983a3,_0x2d7a4c){try{if(_0x4983a3){fs[_0x34c9('0x5f')](_0x4983a3);logger[_0x34c9('0x61')](_0x34c9('0x8e'));}if(_0x2d7a4c){rimraf(_0x2d7a4c,function(){});logger[_0x34c9('0x61')]('Extracted\x20folder\x20removed');}}catch(_0x3d9a96){logger[_0x34c9('0x28')](_0x3d9a96);}}exports['update']=function(_0xee1a0a,_0x5073d7,_0x47b350){return db[_0x34c9('0x2c')][_0x34c9('0x47')]({'where':{'id':_0xee1a0a[_0x34c9('0x44')]['id']}})['then'](handleEntityNotFound(_0x5073d7,null))[_0x34c9('0x24')](saveUpdates(_0xee1a0a['body'],null))[_0x34c9('0x24')](respondWithResult(_0x5073d7,null))[_0x34c9('0x42')](handleError(_0x5073d7,null));};exports[_0x34c9('0x8f')]=function(_0x389efd,_0x4a6b3e,_0x4bff5f){return db['Plugin']['find']({'where':{'id':_0x389efd['params']['id']}})[_0x34c9('0x24')](function(_0x1d59a8){if(_0x1d59a8){return _0x1d59a8[_0x34c9('0x25')]();}})[_0x34c9('0x24')](function(_0x1a355c){rimraf(path[_0x34c9('0x49')](config[_0x34c9('0x4a')],_0x34c9('0x4b'),path[_0x34c9('0x57')](_0x1a355c[_0x34c9('0x48')])),function(){});return _0x1a355c;})['then'](handleEntityNotFound(_0x4a6b3e,null))[_0x34c9('0x24')](respondWithStatusCode(_0x4a6b3e,null))['catch'](handleError(_0x4a6b3e,null));};exports[_0x34c9('0x90')]=function(_0x596c9c,_0x43bd04,_0x57bbc6){return BPromise[_0x34c9('0x91')]()[_0x34c9('0x24')](function(){if(!_0x596c9c[_0x34c9('0x36')][_0x34c9('0x48')]){throw new Error(_0x34c9('0x92'));}if(!_0x596c9c[_0x34c9('0x36')][_0x34c9('0x93')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0xe9ac23=_0x596c9c['query'][_0x34c9('0x94')]?_0x596c9c[_0x34c9('0x36')][_0x34c9('0x94')]+':'+_0x596c9c['query'][_0x34c9('0x93')]:'http://localhost:'+_0x596c9c[_0x34c9('0x36')][_0x34c9('0x93')];var _0xfc64b9=_0x596c9c['query'][_0x34c9('0x95')]?_0x596c9c['query'][_0x34c9('0x95')]:!![];var _0x4095cf=_0x596c9c[_0x34c9('0x36')][_0x34c9('0x96')]?_0x596c9c[_0x34c9('0x36')][_0x34c9('0x96')]:null;var _0x5326a8={'method':_0x596c9c[_0x34c9('0x97')],'uri':util['format']('%s%s',_0xe9ac23,_0x596c9c['query']['path']),'json':_0xfc64b9,'resolveWithFullResponse':!![],'encoding':_0x4095cf,'qs':_0x596c9c[_0x34c9('0x36')]};if(_0x596c9c[_0x34c9('0x98')]){_0x5326a8[_0x34c9('0x98')]=_0x596c9c['headers'];if(_0x5326a8['headers'][_0x34c9('0x99')]){delete _0x5326a8[_0x34c9('0x98')][_0x34c9('0x99')];}}if(_0x5326a8[_0x34c9('0x98')][_0x34c9('0x9a')]){delete _0x5326a8[_0x34c9('0x98')][_0x34c9('0x9a')];}return rp(_0x5326a8);})[_0x34c9('0x24')](function(_0x23ba6c){if(_0x23ba6c){_0x43bd04[_0x34c9('0x1f')](_0x23ba6c['headers']);logger['info'](_0x23ba6c[_0x34c9('0x85')]);if(_[_0x34c9('0x9b')](_0x596c9c[_0x34c9('0x36')][_0x34c9('0x48')],'download')&&_0x23ba6c[_0x34c9('0x9c')]==0x1f4){return _0x43bd04['sendStatus'](_0x23ba6c['statusCode']);}else{return _0x43bd04[_0x34c9('0x1a')](_0x23ba6c['statusCode'])[_0x34c9('0x2b')](_0x23ba6c['body']);}}else{return _0x43bd04['sendStatus'](0xc8);}})[_0x34c9('0x42')](handleError(_0x43bd04,null));};exports[_0x34c9('0x9d')]=function(_0x5f41da,_0x112575,_0x2a8ca9){return BPromise[_0x34c9('0x91')]()[_0x34c9('0x24')](function(){if(!_0x5f41da[_0x34c9('0x36')][_0x34c9('0x48')]){throw new Error(_0x34c9('0x92'));}if(!_0x5f41da[_0x34c9('0x36')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0xf64d9e=_0x5f41da['query']['hostname']?_0x5f41da['query'][_0x34c9('0x94')]+':'+_0x5f41da['query']['port']:_0x34c9('0x9e')+_0x5f41da['query'][_0x34c9('0x93')];var _0x39f1e9=_0x5f41da['query'][_0x34c9('0x95')]?_0x5f41da[_0x34c9('0x36')]['json']:!![];var _0x52f8cb=_0x5f41da[_0x34c9('0x36')][_0x34c9('0x96')]?_0x5f41da[_0x34c9('0x36')][_0x34c9('0x96')]:null;var _0x1cb130={'method':_0x5f41da[_0x34c9('0x97')],'uri':util[_0x34c9('0x4c')](_0x34c9('0x9f'),_0xf64d9e,_0x5f41da[_0x34c9('0x36')]['path']),'json':_0x39f1e9,'resolveWithFullResponse':!![],'encoding':_0x52f8cb,'body':_0x5f41da[_0x34c9('0x85')]};if(_0x5f41da[_0x34c9('0x98')]){_0x1cb130[_0x34c9('0x98')]=_0x5f41da['headers'];if(_0x1cb130[_0x34c9('0x98')][_0x34c9('0x99')]){delete _0x1cb130[_0x34c9('0x98')][_0x34c9('0x99')];}}if(_0x1cb130[_0x34c9('0x98')][_0x34c9('0x9a')]){delete _0x1cb130[_0x34c9('0x98')][_0x34c9('0x9a')];}return rp(_0x1cb130);})['then'](function(_0x4e650b){if(_0x4e650b){_0x112575[_0x34c9('0x1f')](_0x4e650b[_0x34c9('0x98')]);logger['info'](_0x4e650b[_0x34c9('0x85')]);return _0x112575['status'](_0x4e650b[_0x34c9('0x9c')])['send'](_0x4e650b[_0x34c9('0x85')]);}else{return _0x112575[_0x34c9('0x19')](0xc8);}})[_0x34c9('0x42')](handleError(_0x112575,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index c872912..7f4c462 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 _0x33ac=['../../mysqldb','save','update','remove','emit','exports'];(function(_0x5a725c,_0x44cc8c){var _0x2cab90=function(_0x429094){while(--_0x429094){_0x5a725c['push'](_0x5a725c['shift']());}};_0x2cab90(++_0x44cc8c);}(_0x33ac,0x1f2));var _0xc33a=function(_0x6de426,_0x1ea3bb){_0x6de426=_0x6de426-0x0;var _0x4991c9=_0x33ac[_0x6de426];return _0x4991c9;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xc33a('0x0'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc33a('0x1'),'afterUpdate':_0xc33a('0x2'),'afterDestroy':_0xc33a('0x3')};function emitEvent(_0x2b7f66){return function(_0x380461,_0xf33498,_0x477d0b){PluginEvents[_0xc33a('0x4')](_0x2b7f66+':'+_0x380461['id'],_0x380461);PluginEvents[_0xc33a('0x4')](_0x2b7f66,_0x380461);_0x477d0b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xc33a('0x5')]=PluginEvents; \ No newline at end of file +var _0x553a=['emit','hook','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x5a2299,_0x3e2922){var _0xedff0f=function(_0x1624cb){while(--_0x1624cb){_0x5a2299['push'](_0x5a2299['shift']());}};_0xedff0f(++_0x3e2922);}(_0x553a,0x192));var _0xa553=function(_0x380016,_0x178dd6){_0x380016=_0x380016-0x0;var _0x5c7ac0=_0x553a[_0x380016];return _0x5c7ac0;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xa553('0x0'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xa553('0x1')](0x0);var events={'afterCreate':_0xa553('0x2'),'afterUpdate':_0xa553('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4d5106){return function(_0x367421,_0x50ecee,_0x4b0e9b){PluginEvents[_0xa553('0x4')](_0x4d5106+':'+_0x367421['id'],_0x367421);PluginEvents['emit'](_0x4d5106,_0x367421);_0x4b0e9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xa553('0x5')](e,emitEvent(event));}}module[_0xa553('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 5d80310..797af95 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 _0x21d7=['../../config/environment','./plugin.attributes','exports','Plugin','plugins','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x321df4,_0x3efec5){var _0x50d06c=function(_0x3ac0f4){while(--_0x3ac0f4){_0x321df4['push'](_0x321df4['shift']());}};_0x50d06c(++_0x3efec5);}(_0x21d7,0xf7));var _0x721d=function(_0x5df083,_0xb7ce9b){_0x5df083=_0x5df083-0x0;var _0x52d5bf=_0x21d7[_0x5df083];return _0x52d5bf;};'use strict';var _=require(_0x721d('0x0'));var util=require(_0x721d('0x1'));var logger=require(_0x721d('0x2'))('api');var moment=require(_0x721d('0x3'));var BPromise=require(_0x721d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x721d('0x5'));var rimraf=require('rimraf');var config=require(_0x721d('0x6'));var attributes=require(_0x721d('0x7'));module[_0x721d('0x8')]=function(_0x399c34,_0xd74f08){return _0x399c34['define'](_0x721d('0x9'),attributes,{'tableName':_0x721d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7140=['../../config/environment','./plugin.attributes','exports','define','plugins','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x7140,0xbb));var _0x0714=function(_0x166e96,_0x55191d){_0x166e96=_0x166e96-0x0;var _0x553d73=_0x7140[_0x166e96];return _0x553d73;};'use strict';var _=require(_0x0714('0x0'));var util=require(_0x0714('0x1'));var logger=require(_0x0714('0x2'))(_0x0714('0x3'));var moment=require(_0x0714('0x4'));var BPromise=require(_0x0714('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0714('0x6'));var rimraf=require(_0x0714('0x7'));var config=require(_0x0714('0x8'));var attributes=require(_0x0714('0x9'));module[_0x0714('0xa')]=function(_0x322d89,_0x4faa0c){return _0x322d89[_0x0714('0xb')]('Plugin',attributes,{'tableName':_0x0714('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 73e0a89..2e34e3d 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 _0xa5c2=['CreatePlugin','Plugin','body','options','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','Plugin,\x20%s,\x20%s','message','result','catch'];(function(_0x1d1333,_0x45b39b){var _0x35a2a9=function(_0x2ef5df){while(--_0x2ef5df){_0x1d1333['push'](_0x1d1333['shift']());}};_0x35a2a9(++_0x45b39b);}(_0xa5c2,0x1a5));var _0x2a5c=function(_0x1e06f1,_0x59d7e1){_0x1e06f1=_0x1e06f1-0x0;var _0x34f77e=_0xa5c2[_0x1e06f1];return _0x34f77e;};'use strict';var _=require(_0x2a5c('0x0'));var util=require('util');var moment=require(_0x2a5c('0x1'));var BPromise=require('bluebird');var rs=require(_0x2a5c('0x2'));var fs=require('fs');var Redis=require(_0x2a5c('0x3'));var db=require(_0x2a5c('0x4'))['db'];var utils=require(_0x2a5c('0x5'));var logger=require(_0x2a5c('0x6'))(_0x2a5c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2a5c('0x8')][_0x2a5c('0x9')]({'port':0x232a});config[_0x2a5c('0xa')]=_[_0x2a5c('0xb')](config[_0x2a5c('0xa')],{'host':_0x2a5c('0xc'),'port':0x18eb});var socket=require(_0x2a5c('0xd'))(new Redis(config[_0x2a5c('0xa')]));require(_0x2a5c('0xe'))[_0x2a5c('0xf')](socket);function respondWithRpcPromise(_0x2cc4d5,_0x62d0ea,_0x346147){return new BPromise(function(_0x11b4b2,_0x2e534c){return client[_0x2a5c('0x10')](_0x2cc4d5,_0x346147)[_0x2a5c('0x11')](function(_0x4d3658){logger[_0x2a5c('0x12')]('Plugin,\x20%s,\x20%s',_0x62d0ea,_0x2a5c('0x13'));logger[_0x2a5c('0x14')](_0x2a5c('0x15'),_0x62d0ea,_0x2a5c('0x13'),JSON['stringify'](_0x4d3658));if(_0x4d3658[_0x2a5c('0x16')]){if(_0x4d3658[_0x2a5c('0x16')]['code']===0x1f4){logger[_0x2a5c('0x16')](_0x2a5c('0x17'),_0x62d0ea,_0x4d3658[_0x2a5c('0x16')][_0x2a5c('0x18')]);return _0x2e534c(_0x4d3658[_0x2a5c('0x16')]['message']);}logger['error'](_0x2a5c('0x17'),_0x62d0ea,_0x4d3658[_0x2a5c('0x16')][_0x2a5c('0x18')]);return _0x11b4b2(_0x4d3658[_0x2a5c('0x16')][_0x2a5c('0x18')]);}else{logger[_0x2a5c('0x12')](_0x2a5c('0x17'),_0x62d0ea,'request\x20sent');_0x11b4b2(_0x4d3658[_0x2a5c('0x19')]['message']);}})[_0x2a5c('0x1a')](function(_0xebd744){logger[_0x2a5c('0x16')](_0x2a5c('0x17'),_0x62d0ea,_0xebd744);_0x2e534c(_0xebd744);});});}exports[_0x2a5c('0x1b')]=function(_0x310d17){var _0x56c505=this;return new Promise(function(_0x56c4ca,_0x3111b4){return db[_0x2a5c('0x1c')]['create'](_0x310d17[_0x2a5c('0x1d')],{'raw':_0x310d17[_0x2a5c('0x1e')]?_0x310d17[_0x2a5c('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x2a5c('0x11')](function(_0x3114de){logger[_0x2a5c('0x12')](_0x2a5c('0x1b'),_0x310d17);logger[_0x2a5c('0x14')]('CreatePlugin',_0x310d17,JSON[_0x2a5c('0x1f')](_0x3114de));_0x56c4ca(_0x3114de);})[_0x2a5c('0x1a')](function(_0x1d39b0){logger[_0x2a5c('0x16')]('CreatePlugin',_0x1d39b0[_0x2a5c('0x18')],_0x310d17);_0x3111b4(_0x56c505[_0x2a5c('0x16')](0x1f4,_0x1d39b0['message']));});});}; \ No newline at end of file +var _0xb4d3=['Plugin','options','raw','then','debug','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Plugin,\x20%s,\x20%s','message','result','CreatePlugin'];(function(_0x20acdb,_0x210c8e){var _0x383b0d=function(_0x5d0919){while(--_0x5d0919){_0x20acdb['push'](_0x20acdb['shift']());}};_0x383b0d(++_0x210c8e);}(_0xb4d3,0x199));var _0x3b4d=function(_0x383dbb,_0x17d41b){_0x383dbb=_0x383dbb-0x0;var _0x6e8bde=_0xb4d3[_0x383dbb];return _0x6e8bde;};'use strict';var _=require(_0x3b4d('0x0'));var util=require(_0x3b4d('0x1'));var moment=require('moment');var BPromise=require(_0x3b4d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3b4d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3b4d('0x4'))(_0x3b4d('0x5'));var config=require(_0x3b4d('0x6'));var jayson=require(_0x3b4d('0x7'));var client=jayson[_0x3b4d('0x8')]['http']({'port':0x232a});config[_0x3b4d('0x9')]=_['defaults'](config[_0x3b4d('0x9')],{'host':_0x3b4d('0xa'),'port':0x18eb});var socket=require(_0x3b4d('0xb'))(new Redis(config[_0x3b4d('0x9')]));require(_0x3b4d('0xc'))[_0x3b4d('0xd')](socket);function respondWithRpcPromise(_0x24794f,_0x2b0c8f,_0x488aed){return new BPromise(function(_0xec3417,_0x3c07f7){return client[_0x3b4d('0xe')](_0x24794f,_0x488aed)['then'](function(_0x278097){logger[_0x3b4d('0xf')]('Plugin,\x20%s,\x20%s',_0x2b0c8f,'request\x20sent');logger['debug'](_0x3b4d('0x10'),_0x2b0c8f,_0x3b4d('0x11'),JSON[_0x3b4d('0x12')](_0x278097));if(_0x278097[_0x3b4d('0x13')]){if(_0x278097['error'][_0x3b4d('0x14')]===0x1f4){logger[_0x3b4d('0x13')](_0x3b4d('0x15'),_0x2b0c8f,_0x278097[_0x3b4d('0x13')][_0x3b4d('0x16')]);return _0x3c07f7(_0x278097[_0x3b4d('0x13')][_0x3b4d('0x16')]);}logger[_0x3b4d('0x13')](_0x3b4d('0x15'),_0x2b0c8f,_0x278097[_0x3b4d('0x13')][_0x3b4d('0x16')]);return _0xec3417(_0x278097[_0x3b4d('0x13')][_0x3b4d('0x16')]);}else{logger['info'](_0x3b4d('0x15'),_0x2b0c8f,'request\x20sent');_0xec3417(_0x278097[_0x3b4d('0x17')][_0x3b4d('0x16')]);}})['catch'](function(_0x4e1097){logger['error'](_0x3b4d('0x15'),_0x2b0c8f,_0x4e1097);_0x3c07f7(_0x4e1097);});});}exports[_0x3b4d('0x18')]=function(_0x38a6c2){var _0x12a3d1=this;return new Promise(function(_0xba75b3,_0x3661da){return db[_0x3b4d('0x19')]['create'](_0x38a6c2['body'],{'raw':_0x38a6c2[_0x3b4d('0x1a')]?_0x38a6c2[_0x3b4d('0x1a')][_0x3b4d('0x1b')]===undefined?!![]:![]:!![]})[_0x3b4d('0x1c')](function(_0x1d9874){logger['info'](_0x3b4d('0x18'),_0x38a6c2);logger[_0x3b4d('0x1d')](_0x3b4d('0x18'),_0x38a6c2,JSON[_0x3b4d('0x12')](_0x1d9874));_0xba75b3(_0x1d9874);})[_0x3b4d('0x1e')](function(_0x12fd54){logger[_0x3b4d('0x13')](_0x3b4d('0x18'),_0x12fd54[_0x3b4d('0x16')],_0x38a6c2);_0x3661da(_0x12a3d1[_0x3b4d('0x13')](0x1f4,_0x12fd54['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index e560a2d..3b4959a 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 _0x935c=['emit','register','length','plugin:','./plugin.events','save','remove'];(function(_0x4a5494,_0x3ad336){var _0x57cbb5=function(_0xa5a1ac){while(--_0xa5a1ac){_0x4a5494['push'](_0x4a5494['shift']());}};_0x57cbb5(++_0x3ad336);}(_0x935c,0x170));var _0xc935=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x935c[_0x13d07a];return _0x5ee0ee;};'use strict';var PluginEvents=require(_0xc935('0x0'));var events=[_0xc935('0x1'),_0xc935('0x2'),'update'];function createListener(_0x45d209,_0x4cc0e5){return function(_0x371a68){_0x4cc0e5[_0xc935('0x3')](_0x45d209,_0x371a68);};}function removeListener(_0x22b1db,_0x40093a){return function(){PluginEvents['removeListener'](_0x22b1db,_0x40093a);};}exports[_0xc935('0x4')]=function(_0x1d909d){for(var _0x45f0c8=0x0,_0x2c9209=events[_0xc935('0x5')];_0x45f0c8<_0x2c9209;_0x45f0c8++){var _0x3514bf=events[_0x45f0c8];var _0x11f074=createListener(_0xc935('0x6')+_0x3514bf,_0x1d909d);PluginEvents['on'](_0x3514bf,_0x11f074);}}; \ No newline at end of file +var _0x1c49=['update','emit','removeListener','register','length','./plugin.events','save','remove'];(function(_0x4ef0c8,_0x3bd417){var _0x525a36=function(_0x2c40b7){while(--_0x2c40b7){_0x4ef0c8['push'](_0x4ef0c8['shift']());}};_0x525a36(++_0x3bd417);}(_0x1c49,0x95));var _0x91c4=function(_0x450a43,_0xf805b6){_0x450a43=_0x450a43-0x0;var _0x2f283f=_0x1c49[_0x450a43];return _0x2f283f;};'use strict';var PluginEvents=require(_0x91c4('0x0'));var events=[_0x91c4('0x1'),_0x91c4('0x2'),_0x91c4('0x3')];function createListener(_0x45d70b,_0x281641){return function(_0x49b11e){_0x281641[_0x91c4('0x4')](_0x45d70b,_0x49b11e);};}function removeListener(_0xf474da,_0x4b8faf){return function(){PluginEvents[_0x91c4('0x5')](_0xf474da,_0x4b8faf);};}exports[_0x91c4('0x6')]=function(_0x46eec4){for(var _0x3b3922=0x0,_0x3dc702=events[_0x91c4('0x7')];_0x3b3922<_0x3dc702;_0x3b3922++){var _0x2804d0=events[_0x3b3922];var _0x5c10cd=createListener('plugin:'+_0x2804d0,_0x46eec4);PluginEvents['on'](_0x2804d0,_0x5c10cd);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index ef30d39..b658065 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(_0xa2ace2,_0x535b28){var _0xd4b012=function(_0xae11f3){while(--_0xae11f3){_0xa2ace2['push'](_0xa2ace2['shift']());}};_0xd4b012(++_0x535b28);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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(_0x234669,_0x37a754){var _0x363ed2=function(_0x331c19){while(--_0x331c19){_0x234669['push'](_0x234669['shift']());}};_0x363ed2(++_0x37a754);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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 b8e06bb..793c021 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 _0xa8a8=['dirname','start','dump','update','restart','Unknown\x20status','destroy','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','child_process','exec','bluebird','sendStatus','status','json','name','send','npm\x20install','info','error','list','then','reject','length','catch','show','describe','params','create','script','join','../../files/plugins','body','cwd','chdir'];(function(_0x15876a,_0x15383d){var _0xbd900f=function(_0x103e59){while(--_0x103e59){_0x15876a['push'](_0x15876a['shift']());}};_0xbd900f(++_0x15383d);}(_0xa8a8,0xec));var _0x8a8a=function(_0x2687de,_0xebcba1){_0x2687de=_0x2687de-0x0;var _0x1046c2=_0xa8a8[_0x2687de];return _0x1046c2;};'use strict';var _=require(_0x8a8a('0x0'));var pm2=require(_0x8a8a('0x1'));var logger=require(_0x8a8a('0x2'))(_0x8a8a('0x3'));var path=require('path');var exec=require(_0x8a8a('0x4'))[_0x8a8a('0x5')];var BPromise=require(_0x8a8a('0x6'));function handleEntityNotFound(_0x3ed1de,_0x45515d){return function(_0x1cecd4){if(!_0x1cecd4){_0x3ed1de[_0x8a8a('0x7')](0x194);;}return _0x1cecd4;};}function respondWithResult(_0x12db82,_0x2e8193){_0x2e8193=_0x2e8193||0xc8;return function(_0x315fe9){if(_0x315fe9){return _0x12db82[_0x8a8a('0x8')](_0x2e8193)[_0x8a8a('0x9')](_0x315fe9);}return null;};}function handleError(_0x4225b9,_0xecaa6f){_0xecaa6f=_0xecaa6f||0x1f4;return function(_0x3287f5){logger['error'](_0x3287f5['stack']);if(_0x3287f5[_0x8a8a('0xa')]){delete _0x3287f5['name'];}_0x4225b9[_0x8a8a('0x8')](_0xecaa6f)[_0x8a8a('0xb')](_0x3287f5);};}function execChildProcess(){return new BPromise(function(_0x532621,_0x118380){exec(_0x8a8a('0xc'),function(_0xb13fca,_0x5e448d,_0x679da2){logger[_0x8a8a('0xd')](_0x5e448d);logger[_0x8a8a('0xd')](_0x679da2);if(_0xb13fca){logger[_0x8a8a('0xe')](_0xb13fca);return _0x118380(_0xb13fca);}return _0x532621(_0x5e448d);});});}exports['index']=function(_0x23febf,_0x4e5d74){return pm2[_0x8a8a('0xf')]()[_0x8a8a('0x10')](function(_0x787eec){if(_0x787eec){var _0x2f6e33=_[_0x8a8a('0x11')](_0x787eec,function(_0x78b0f0){return _0x78b0f0[_0x8a8a('0xa')]==='express'||_0x78b0f0[_0x8a8a('0xa')]==='motion2';});return{'rows':_0x2f6e33,'count':_0x2f6e33[_0x8a8a('0x12')]};}return null;})[_0x8a8a('0x10')](respondWithResult(_0x4e5d74,null))[_0x8a8a('0x13')](handleError(_0x4e5d74,null));};exports[_0x8a8a('0x14')]=function(_0x42e8b6,_0x5dd616){return pm2[_0x8a8a('0x15')](_0x42e8b6[_0x8a8a('0x16')]['id'])[_0x8a8a('0x10')](respondWithResult(_0x5dd616,null))[_0x8a8a('0x10')](handleEntityNotFound(_0x5dd616,null))[_0x8a8a('0x13')](handleError(_0x5dd616,null));};exports[_0x8a8a('0x17')]=function(_0x4d7a45,_0x5dc5ae){if(_0x4d7a45['body']['name']&&_0x4d7a45['body'][_0x8a8a('0x18')]){var _0x45095b=path[_0x8a8a('0x19')](__dirname,_0x8a8a('0x1a'),_0x4d7a45[_0x8a8a('0x1b')][_0x8a8a('0x18')]);var _0x242bac=process[_0x8a8a('0x1c')]();process[_0x8a8a('0x1d')](path[_0x8a8a('0x1e')](_0x45095b));return execChildProcess()[_0x8a8a('0x10')](function(_0x3aa2bb){process[_0x8a8a('0x1d')](_0x242bac);return pm2[_0x8a8a('0x1f')]({'name':_0x4d7a45[_0x8a8a('0x1b')]['name'],'script':_0x45095b});})[_0x8a8a('0x10')](function(_0x16c55b){pm2[_0x8a8a('0x20')]();return _0x16c55b[0x0];})[_0x8a8a('0x10')](respondWithResult(_0x5dc5ae,0xc9))[_0x8a8a('0x13')](handleError(_0x5dc5ae,null));}else{return _0x5dc5ae[_0x8a8a('0x8')](0x1f4)[_0x8a8a('0xb')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x8a8a('0x21')]=function(_0x38c1e0,_0x2e217a){if(_0x38c1e0['body']['id']){delete _0x38c1e0['body']['id'];}var _0x2dafcd={'online':_0x8a8a('0x22'),'stopped':'stop'};if(_0x2dafcd['hasOwnProperty'](_0x38c1e0['body'][_0x8a8a('0x8')])){return pm2[_0x2dafcd[_0x38c1e0['body'][_0x8a8a('0x8')]]](_0x38c1e0[_0x8a8a('0x16')]['id'])['then'](respondWithResult(_0x2e217a,0xc8))[_0x8a8a('0x13')](handleError(_0x2e217a,null));}else{return _0x2e217a[_0x8a8a('0x8')](0x1f4)[_0x8a8a('0xb')]({'message':_0x8a8a('0x23')});}};exports[_0x8a8a('0x24')]=function(_0x3d6594,_0x3e73b1){if(_0x3d6594[_0x8a8a('0x1b')]['id']){delete _0x3d6594['body']['id'];}if(_0x3d6594['params']['id']){return pm2['delete'](_0x3d6594[_0x8a8a('0x16')]['id'])[_0x8a8a('0x10')](function(_0x5f301e){pm2[_0x8a8a('0x20')]();return _0x5f301e[0x0];})[_0x8a8a('0x10')](respondWithResult(_0x3e73b1,null))['catch'](handleError(_0x3e73b1,null));}else{return _0x3e73b1[_0x8a8a('0x8')](0x1f4)[_0x8a8a('0xb')]({'message':_0x8a8a('0x25')});}}; \ No newline at end of file +var _0xc368=['update','restart','Unknown\x20status','destroy','delete','dump','../../config/pm2','api','path','child_process','exec','bluebird','sendStatus','status','json','error','send','npm\x20install','info','index','list','then','reject','name','express','motion2','length','catch','show','describe','params','body','script','join','../../files/plugins','cwd','chdir','start','Missing\x20name\x20and/or\x20path'];(function(_0x3fd0bd,_0x29c208){var _0x2572d8=function(_0x10f8cb){while(--_0x10f8cb){_0x3fd0bd['push'](_0x3fd0bd['shift']());}};_0x2572d8(++_0x29c208);}(_0xc368,0x7b));var _0x8c36=function(_0x4dc497,_0x4fb021){_0x4dc497=_0x4dc497-0x0;var _0xc05543=_0xc368[_0x4dc497];return _0xc05543;};'use strict';var _=require('lodash');var pm2=require(_0x8c36('0x0'));var logger=require('../../config/logger')(_0x8c36('0x1'));var path=require(_0x8c36('0x2'));var exec=require(_0x8c36('0x3'))[_0x8c36('0x4')];var BPromise=require(_0x8c36('0x5'));function handleEntityNotFound(_0x5d3b27,_0x3e9034){return function(_0x3bb30e){if(!_0x3bb30e){_0x5d3b27[_0x8c36('0x6')](0x194);;}return _0x3bb30e;};}function respondWithResult(_0x1d3660,_0x5ebfc1){_0x5ebfc1=_0x5ebfc1||0xc8;return function(_0x554022){if(_0x554022){return _0x1d3660[_0x8c36('0x7')](_0x5ebfc1)[_0x8c36('0x8')](_0x554022);}return null;};}function handleError(_0x3e76be,_0x26bad1){_0x26bad1=_0x26bad1||0x1f4;return function(_0x3af839){logger[_0x8c36('0x9')](_0x3af839['stack']);if(_0x3af839['name']){delete _0x3af839['name'];}_0x3e76be[_0x8c36('0x7')](_0x26bad1)[_0x8c36('0xa')](_0x3af839);};}function execChildProcess(){return new BPromise(function(_0x5132f6,_0x36cb13){exec(_0x8c36('0xb'),function(_0x1d5c61,_0xe7857e,_0x2a8e73){logger[_0x8c36('0xc')](_0xe7857e);logger[_0x8c36('0xc')](_0x2a8e73);if(_0x1d5c61){logger[_0x8c36('0x9')](_0x1d5c61);return _0x36cb13(_0x1d5c61);}return _0x5132f6(_0xe7857e);});});}exports[_0x8c36('0xd')]=function(_0x11f8fa,_0x43736d){return pm2[_0x8c36('0xe')]()[_0x8c36('0xf')](function(_0x220f18){if(_0x220f18){var _0x5dfcd5=_[_0x8c36('0x10')](_0x220f18,function(_0x5e32ad){return _0x5e32ad[_0x8c36('0x11')]===_0x8c36('0x12')||_0x5e32ad[_0x8c36('0x11')]===_0x8c36('0x13');});return{'rows':_0x5dfcd5,'count':_0x5dfcd5[_0x8c36('0x14')]};}return null;})[_0x8c36('0xf')](respondWithResult(_0x43736d,null))[_0x8c36('0x15')](handleError(_0x43736d,null));};exports[_0x8c36('0x16')]=function(_0x30229e,_0x49cafe){return pm2[_0x8c36('0x17')](_0x30229e[_0x8c36('0x18')]['id'])[_0x8c36('0xf')](respondWithResult(_0x49cafe,null))[_0x8c36('0xf')](handleEntityNotFound(_0x49cafe,null))[_0x8c36('0x15')](handleError(_0x49cafe,null));};exports['create']=function(_0x15100f,_0x409de0){if(_0x15100f[_0x8c36('0x19')][_0x8c36('0x11')]&&_0x15100f[_0x8c36('0x19')][_0x8c36('0x1a')]){var _0xfb9763=path[_0x8c36('0x1b')](__dirname,_0x8c36('0x1c'),_0x15100f[_0x8c36('0x19')][_0x8c36('0x1a')]);var _0x14ee6b=process[_0x8c36('0x1d')]();process['chdir'](path['dirname'](_0xfb9763));return execChildProcess()['then'](function(_0x55b844){process[_0x8c36('0x1e')](_0x14ee6b);return pm2[_0x8c36('0x1f')]({'name':_0x15100f[_0x8c36('0x19')][_0x8c36('0x11')],'script':_0xfb9763});})[_0x8c36('0xf')](function(_0x27c0df){pm2['dump']();return _0x27c0df[0x0];})[_0x8c36('0xf')](respondWithResult(_0x409de0,0xc9))['catch'](handleError(_0x409de0,null));}else{return _0x409de0[_0x8c36('0x7')](0x1f4)['send']({'message':_0x8c36('0x20')});}};exports[_0x8c36('0x21')]=function(_0x271ec4,_0x1010c8){if(_0x271ec4['body']['id']){delete _0x271ec4['body']['id'];}var _0x7e7e56={'online':_0x8c36('0x22'),'stopped':'stop'};if(_0x7e7e56['hasOwnProperty'](_0x271ec4[_0x8c36('0x19')][_0x8c36('0x7')])){return pm2[_0x7e7e56[_0x271ec4['body'][_0x8c36('0x7')]]](_0x271ec4[_0x8c36('0x18')]['id'])[_0x8c36('0xf')](respondWithResult(_0x1010c8,0xc8))['catch'](handleError(_0x1010c8,null));}else{return _0x1010c8['status'](0x1f4)[_0x8c36('0xa')]({'message':_0x8c36('0x23')});}};exports[_0x8c36('0x24')]=function(_0x192ce3,_0x3ae970){if(_0x192ce3[_0x8c36('0x19')]['id']){delete _0x192ce3[_0x8c36('0x19')]['id'];}if(_0x192ce3[_0x8c36('0x18')]['id']){return pm2[_0x8c36('0x25')](_0x192ce3[_0x8c36('0x18')]['id'])[_0x8c36('0xf')](function(_0x36648e){pm2[_0x8c36('0x26')]();return _0x36648e[0x0];})[_0x8c36('0xf')](respondWithResult(_0x3ae970,null))[_0x8c36('0x15')](handleError(_0x3ae970,null));}else{return _0x3ae970[_0x8c36('0x7')](0x1f4)[_0x8c36('0xa')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index b3068d0..1061553 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 _0xd489=['isAuthenticated','getAgents','get','/queues','getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','/agents'];(function(_0x1857d0,_0x6eade0){var _0x3e3c46=function(_0x3915b8){while(--_0x3915b8){_0x1857d0['push'](_0x1857d0['shift']());}};_0x3e3c46(++_0x6eade0);}(_0xd489,0xed));var _0x9d48=function(_0x4905e6,_0xf1295c){_0x4905e6=_0x4905e6-0x0;var _0x1f7655=_0xd489[_0x4905e6];return _0x1f7655;};'use strict';var express=require(_0x9d48('0x0'));var router=express[_0x9d48('0x1')]();var auth=require(_0x9d48('0x2'));var controller=require(_0x9d48('0x3'));router['get'](_0x9d48('0x4'),auth[_0x9d48('0x5')](),controller[_0x9d48('0x6')]);router[_0x9d48('0x7')](_0x9d48('0x8'),auth[_0x9d48('0x5')](),controller[_0x9d48('0x9')]);module[_0x9d48('0xa')]=router; \ No newline at end of file +var _0x25ef=['/queues','isAuthenticated','getQueues','exports','express','Router','./realtime.controller','get','/agents','getAgents'];(function(_0x1354c9,_0x475347){var _0x116916=function(_0x24051b){while(--_0x24051b){_0x1354c9['push'](_0x1354c9['shift']());}};_0x116916(++_0x475347);}(_0x25ef,0xcc));var _0xf25e=function(_0x3cdfb6,_0x21361d){_0x3cdfb6=_0x3cdfb6-0x0;var _0xa8181c=_0x25ef[_0x3cdfb6];return _0xa8181c;};'use strict';var express=require(_0xf25e('0x0'));var router=express[_0xf25e('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xf25e('0x2'));router[_0xf25e('0x3')](_0xf25e('0x4'),auth['isAuthenticated'](),controller[_0xf25e('0x5')]);router[_0xf25e('0x3')](_0xf25e('0x6'),auth[_0xf25e('0x7')](),controller[_0xf25e('0x8')]);module[_0xf25e('0x9')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 12ebd45..61edf39 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 _0xd0a4=['Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','talking','paused','push','pTalking','originated','dialMethod','startPredictive','startProgressive','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','map','agents','loggedInDb','busy','find','merge','pick','filter','some','connectedlinenum','internal','getMembers','length','UserId','accountcode','voiceStatus','online','User','startCase','findAll','unknown','unavailable','ringing','isNil','chatPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','idle','pause','chatStatus','mailStatus','openchannelStatus','getAgents','userpic','lastLoginAt','pauseType','address','faxPause','chatCapacity','openchannelCapacity','mailCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','smsStatus','whatsappStatus','faxStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','rawAttributes','fieldName','type','key','query','role','agent','getOptions','raw','user','userProfileId','nolimit','sort','UserProfile','getResources','findAndCountAll','rows','omit','globalStatus','globalStatusFilter','pauseTypeFilter','mail','sms','openchannel','channel','includes','Invalid\x20channel','Queue','outbound','QueueCampaigns','all','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','../../mysqldb','client','http','offset','undefined','limit','count','status','set','Content-Range','error','stack','name','send','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','catch','voice','Queues','format'];(function(_0x1b224d,_0x7d6e65){var _0x32a920=function(_0x28679b){while(--_0x28679b){_0x1b224d['push'](_0x1b224d['shift']());}};_0x32a920(++_0x7d6e65);}(_0xd0a4,0x72));var _0x4d0a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xd0a4[_0x3b380d];return _0x54502b;};'use strict';var util=require('util');var _=require(_0x4d0a('0x0'));var jayson=require(_0x4d0a('0x1'));var qs=require(_0x4d0a('0x2'));var logger=require(_0x4d0a('0x3'))('api');var db=require(_0x4d0a('0x4'))['db'];var amiClient=jayson[_0x4d0a('0x5')][_0x4d0a('0x6')]({'port':0x232a});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithFilteredResult(_0x8aa86c,_0x2f3786){return function(_0x198bde){if(_0x198bde){var _0x440901=typeof _0x2f3786[_0x4d0a('0x7')]===_0x4d0a('0x8')&&typeof _0x2f3786[_0x4d0a('0x9')]===_0x4d0a('0x8');var _0x339dde=_0x198bde[_0x4d0a('0xa')];var _0x11b83d=_0x440901?0x0:_0x2f3786[_0x4d0a('0x7')];var _0x42e4a7=_0x440901?_0x198bde[_0x4d0a('0xa')]:_0x2f3786[_0x4d0a('0x7')]+_0x2f3786[_0x4d0a('0x9')];var _0xdf2e3f;if(_0x42e4a7>=_0x339dde){_0x42e4a7=_0x339dde;_0xdf2e3f=0xc8;}else{_0xdf2e3f=0xce;}_0x8aa86c[_0x4d0a('0xb')](_0xdf2e3f);return _0x8aa86c[_0x4d0a('0xc')](_0x4d0a('0xd'),_0x11b83d+'-'+_0x42e4a7+'/'+_0x339dde)['json'](_0x198bde);}return null;};}function handleError(_0x179935,_0x1038a5){_0x1038a5=_0x1038a5||0x1f4;return function(_0x38b084){logger[_0x4d0a('0xe')](_0x38b084[_0x4d0a('0xf')]);if(_0x38b084[_0x4d0a('0x10')]){delete _0x38b084['name'];}_0x179935[_0x4d0a('0xb')](_0x1038a5)[_0x4d0a('0x11')](_0x38b084);};}function getRealtimeAgents(){return new Promise(function(_0x5a00bf,_0xbfcc3f){return amiClient[_0x4d0a('0x12')](_0x4d0a('0x13'),{})[_0x4d0a('0x14')](function(_0x51f1a4){if(_0x51f1a4[_0x4d0a('0xe')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');var _0x326fcd=_0x51f1a4['result'];return routingClient[_0x4d0a('0x12')](_0x4d0a('0x13'),{})[_0x4d0a('0x14')](function(_0x294a08){if(_0x294a08[_0x4d0a('0xe')])throw new Error(_0x4d0a('0x15'));var _0x36c141=_0x294a08[_0x4d0a('0x16')];return _0x5a00bf(_['merge']({},_0x326fcd,_0x36c141));});})[_0x4d0a('0x17')](function(_0x206fe6){_0xbfcc3f(_0x206fe6);});});}function getRealtimeQueues(_0x5b1fa7,_0x4774bd){return new Promise(function(_0x3edb66,_0x4f148f){var _0x2d4a26=_0x4774bd===_0x4d0a('0x18')?amiClient:routingClient;return _0x2d4a26[_0x4d0a('0x12')](_['startCase'](_0x4774bd)+_0x4d0a('0x19'),_0x5b1fa7)[_0x4d0a('0x14')](function(_0x56c9d0){if(_0x56c9d0[_0x4d0a('0xe')])throw new Error(util[_0x4d0a('0x1a')](_0x4d0a('0x1b'),_0x4774bd));return _0x3edb66(_0x56c9d0[_0x4d0a('0x16')]);})[_0x4d0a('0x17')](function(_0x5bad05){_0x4f148f(_0x5bad05);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x180660,_0x2ddeef){return amiClient[_0x4d0a('0x12')](_0x4d0a('0x1c'),{})[_0x4d0a('0x14')](function(_0x1c4028){if(_0x1c4028[_0x4d0a('0xe')])throw new Error(_0x4d0a('0x1d'));return _0x180660(_0x1c4028[_0x4d0a('0x16')]);})[_0x4d0a('0x17')](function(_0x1ed1a0){_0x2ddeef(_0x1ed1a0);});});}function initializeQueues(_0x59d7bf,_0x1a3010,_0x3a63c5,_0x468bc7){var _0x75ce88=[_0x4d0a('0x1e'),_0x4d0a('0x1f'),'waiting',_0x4d0a('0x20'),_0x4d0a('0x21')];if(_0x3a63c5==='voice'&&_0x468bc7==='outbound'){_0x75ce88[_0x4d0a('0x22')](_0x4d0a('0x23'),_0x4d0a('0x24'),'message','dialActive',_0x4d0a('0x25'),'Trunk',_0x4d0a('0x26'),_0x4d0a('0x27'),'erlangCalls','erlangCallToSecond',_0x4d0a('0x28'),'erlangBusyFactor',_0x4d0a('0x29'),_0x4d0a('0x2a'),'dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0x4d0a('0x2b'),_0x4d0a('0x2c'),'predictiveIntervalAvgTalktime');}return _0x59d7bf[_0x4d0a('0x2d')](function(_0x3f1b93){var _0x13dc82=_0x3f1b93['get']({'plain':!![]});_0x13dc82[_0x4d0a('0x2e')]=[];_0x13dc82[_0x4d0a('0x21')]=0x0;_0x13dc82[_0x4d0a('0x2f')]=0x0;_0x13dc82['loggedIn']=0x0;_0x13dc82[_0x4d0a('0x1f')]=0x0;_0x13dc82['waiting']=0x0;if(_0x3a63c5===_0x4d0a('0x18')){_0x13dc82['talking']=0x0;_0x13dc82[_0x4d0a('0x30')]=0x0;if(_0x468bc7==='outbound'){_0x13dc82[_0x4d0a('0x23')]=0x0;_0x13dc82[_0x4d0a('0x24')]=0x0;}}var _0x46083e=_[_0x4d0a('0x31')](_0x1a3010,['id',_0x13dc82['id']]);if(_0x46083e)_[_0x4d0a('0x32')](_0x13dc82,_[_0x4d0a('0x33')](_0x46083e,_0x75ce88));return _0x13dc82;});}function updateAgentVoiceStatus(_0x36219f,_0x12ac9c,_0x5c606b){var _0x32ca76=_[_0x4d0a('0x34')](_0x5c606b,['queue',_0x12ac9c[_0x4d0a('0x10')]]);if(_0x32ca76['length']===0x0)return _0x36219f[_0x4d0a('0x30')]=!![];if(_[_0x4d0a('0x35')](_0x32ca76,[_0x4d0a('0x36'),_0x36219f[_0x4d0a('0x37')]['toString']()]))return _0x36219f[_0x4d0a('0x20')]=!![];if(!_0x36219f[_0x4d0a('0x20')])return _0x36219f[_0x4d0a('0x30')]=!![];}function getVoiceQueueAgents(_0x10500a,_0x37ec6b,_0x49b4a0,_0x596d05){var _0x275ff1=_['find'](_0x37ec6b,['id',_0x10500a['id']]);if(!_0x275ff1)return _0x10500a;return _0x275ff1[_0x4d0a('0x38')]({'raw':!![]})[_0x4d0a('0x14')](function(_0x3baf1d){for(var _0x5c2427=0x0;_0x5c2427<_0x3baf1d[_0x4d0a('0x39')];_0x5c2427++){var _0x243257=_['find'](_0x49b4a0,['id',_0x3baf1d[_0x5c2427][_0x4d0a('0x3a')]]);if(!_0x243257){_0x243257={'id':_0x3baf1d[_0x5c2427][_0x4d0a('0x3a')],'name':_0x3baf1d[_0x5c2427][_0x4d0a('0x3a')],'accountcode':'','online':![]};}var _0x483c0e={'id':_0x243257['id'],'name':_0x243257['name'],'internal':_0x243257[_0x4d0a('0x3b')],'online':Boolean(_0x243257['online']),'paused':Boolean(_0x3baf1d[_0x5c2427][_0x4d0a('0x21')])};if(_0x243257[_0x4d0a('0x3c')]===_0x4d0a('0x20'))updateAgentVoiceStatus(_0x483c0e,_0x10500a,_0x596d05);if(_0x483c0e[_0x4d0a('0x3d')])_0x10500a[_0x4d0a('0x2f')]++;if(_0x483c0e[_0x4d0a('0x30')])_0x10500a[_0x4d0a('0x30')]++;if(_0x483c0e[_0x4d0a('0x21')]&&!_0x483c0e[_0x4d0a('0x30')]&&!_0x483c0e[_0x4d0a('0x20')])_0x10500a[_0x4d0a('0x21')]++;_0x10500a['agents']['push'](_0x483c0e);}return _0x10500a;});}function getQueueAgents(_0x2d19e9,_0xf670b3,_0x128cea){var _0x519ec0=_0x4d0a('0x3e')+_[_0x4d0a('0x3f')](_0x128cea)+'Queue';var _0x5bdf2e=_0x128cea+'Pause';return db[_0x519ec0][_0x4d0a('0x40')]({'where':{[_[_0x4d0a('0x3f')](_0x128cea)+'QueueId']:_0x2d19e9['id']},'raw':!![]})['then'](function(_0xd24332){for(var _0x51a996=0x0;_0x51a996<_0xd24332['length'];_0x51a996++){var _0x5d55ed=_[_0x4d0a('0x31')](_0xf670b3,['id',_0xd24332[_0x51a996][_0x4d0a('0x3a')]]);if(!_0x5d55ed){_0x5d55ed={'id':_0xd24332[_0x51a996]['UserId'],'name':_0xd24332[_0x51a996][_0x4d0a('0x3a')],'online':![],['pauseField']:![]};}var _0x298df8={'id':_0x5d55ed['id'],'name':_0x5d55ed[_0x4d0a('0x10')],'online':Boolean(_0x5d55ed[_0x4d0a('0x3d')]),'paused':Boolean(_0x5d55ed[_0x5bdf2e])};if(_0x298df8['online'])_0x2d19e9['loggedInDb']++;_0x2d19e9[_0x4d0a('0x2e')][_0x4d0a('0x22')](_0x298df8);}return _0x2d19e9;});}function isIdle(_0x235cc0){return _0x235cc0==='idle'||_0x235cc0===_0x4d0a('0x41')||_0x235cc0===_0x4d0a('0x42')||_0x235cc0===_0x4d0a('0x43')||_[_0x4d0a('0x44')](_0x235cc0);}function isAgentPaused(_0x9376d7,_0x554ea4){var _0x89b1f8=[_0x9376d7[_0x4d0a('0x45')],_0x9376d7['faxPause'],_0x9376d7[_0x4d0a('0x46')],_0x9376d7[_0x4d0a('0x47')],_0x9376d7[_0x4d0a('0x48')],_0x9376d7[_0x4d0a('0x49')],_0x9376d7[_0x4d0a('0x4a')]];if(!_0x554ea4)return _[_0x4d0a('0x4b')](_0x89b1f8);var _0x452fe4=_[_0x4d0a('0x34')](_0x89b1f8);return _0x452fe4['length']>0x0&&_0x452fe4[_0x4d0a('0x39')]<_0x89b1f8[_0x4d0a('0x39')]?!![]:![];}function isAgentIdle(_0xe10d98){if(_0xe10d98[_0x4d0a('0x3c')]!==_0x4d0a('0x4c')&&_0xe10d98['voicePause']){_0xe10d98[_0x4d0a('0x3c')]=_0x4d0a('0x4d');return![];}return _[_0x4d0a('0x4b')]([_0xe10d98[_0x4d0a('0x4e')],_0xe10d98['faxStatus'],_0xe10d98[_0x4d0a('0x4f')],_0xe10d98[_0x4d0a('0x50')],_0xe10d98['smsStatus'],_0xe10d98[_0x4d0a('0x3c')],_0xe10d98['whatsappStatus']],isIdle);}function getAgentStatus(_0x110e3b){var _0x3064a2=_0x4d0a('0x41');if(isAgentPaused(_0x110e3b))_0x3064a2='pause';else if(isAgentPaused(_0x110e3b,!![]))_0x3064a2='*pause';else if(isAgentIdle(_0x110e3b))_0x3064a2=_0x4d0a('0x4c');else _0x3064a2=_0x4d0a('0x30');return _0x3064a2;}exports[_0x4d0a('0x51')]=function(_0x69827d,_0x203ab7){var _0x2fd9b6={'count':0x0,'rows':[]},_0x1f790c={},_0x531505,_0x2a66d6,_0x5ee42b=[_0x4d0a('0x52'),_0x4d0a('0x3d'),_0x4d0a('0x53'),'lastPauseAt',_0x4d0a('0x54'),'lastPauseAt',_0x4d0a('0x37'),_0x4d0a('0x55'),'chatPause',_0x4d0a('0x47'),_0x4d0a('0x46'),_0x4d0a('0x48'),_0x4d0a('0x4a'),_0x4d0a('0x56'),'voicePause',_0x4d0a('0x57'),_0x4d0a('0x58'),_0x4d0a('0x59'),'smsCapacity',_0x4d0a('0x5a'),_0x4d0a('0x5b'),'chatCurrentCapacity',_0x4d0a('0x5c'),_0x4d0a('0x5d'),_0x4d0a('0x5e'),'whatsappCurrentCapacity','faxCurrentCapacity','chatStatus',_0x4d0a('0x50'),_0x4d0a('0x4f'),_0x4d0a('0x5f'),_0x4d0a('0x60'),_0x4d0a('0x61'),_0x4d0a('0x3c'),_0x4d0a('0x62'),_0x4d0a('0x63'),_0x4d0a('0x64'),'smsStatusTime',_0x4d0a('0x65'),_0x4d0a('0x66'),'voiceStatusTime',_0x4d0a('0x67'),_0x4d0a('0x68'),_0x4d0a('0x69'),_0x4d0a('0x6a'),_0x4d0a('0x6b'),_0x4d0a('0x6c')],_0x5c94eb=['chatPause',_0x4d0a('0x47'),_0x4d0a('0x46'),_0x4d0a('0x48'),'whatsappPause',_0x4d0a('0x56'),_0x4d0a('0x49'),_0x4d0a('0x3d')];Promise[_0x4d0a('0x6d')]()['then'](function(){var _0x272301=_[_0x4d0a('0x2d')](db[_0x4d0a('0x3e')][_0x4d0a('0x6e')],function(_0x4c66de){return{'name':_0x4c66de[_0x4d0a('0x6f')],'type':_0x4c66de[_0x4d0a('0x70')][_0x4d0a('0x71')]};});_0x69827d[_0x4d0a('0x72')][_0x4d0a('0x73')]=_0x4d0a('0x74');_0x69827d[_0x4d0a('0x72')][_0x4d0a('0x3d')]=!![];_0x1f790c=qs[_0x4d0a('0x75')](_0x272301,_0x69827d);_0x1f790c[_0x4d0a('0x76')]=!![];if(_0x69827d[_0x4d0a('0x77')][_0x4d0a('0x73')]===_0x4d0a('0x77')){var _0x1d1d9d={'params':{'id':_0x69827d[_0x4d0a('0x77')][_0x4d0a('0x78')]},'query':{'section':_0x4d0a('0x13'),'role':_0x4d0a('0x74'),'online':!![],'nolimit':_0x69827d[_0x4d0a('0x72')][_0x4d0a('0x79')],'sort':_0x69827d[_0x4d0a('0x72')][_0x4d0a('0x7a')],'filter':_0x69827d[_0x4d0a('0x72')]['filter']},'raw':!![]};return db[_0x4d0a('0x7b')][_0x4d0a('0x7c')](_0x1d1d9d);}return db[_0x4d0a('0x3e')][_0x4d0a('0x7d')](_0x1f790c);})['then'](function(_0x423e51){_0x2fd9b6[_0x4d0a('0xa')]=_0x423e51[_0x4d0a('0xa')];_0x531505=_0x423e51[_0x4d0a('0x7e')];return getRealtimeAgents();})[_0x4d0a('0x14')](function(_0x59d480){_0x2a66d6=_0x59d480[_0x4d0a('0x7e')];return _0x531505[_0x4d0a('0x2d')](function(_0x341df0){var _0x4ce10e=_[_0x4d0a('0x31')](_0x2a66d6,['id',_0x341df0['id']]);if(_0x4ce10e)_[_0x4d0a('0x32')](_0x341df0,_[_0x4d0a('0x33')](_[_0x4d0a('0x7f')](_0x4ce10e,_0x5c94eb),_0x5ee42b));_0x341df0[_0x4d0a('0x80')]=getAgentStatus(_0x341df0);return _0x341df0;});})[_0x4d0a('0x14')](function(_0x271754){if(_0x69827d[_0x4d0a('0x72')][_0x4d0a('0x81')]){var _0x22b96f=_['filter'](_0x271754,['globalStatus',_0x69827d[_0x4d0a('0x72')]['globalStatusFilter']]);if(_0x69827d[_0x4d0a('0x72')][_0x4d0a('0x82')]){_0x22b96f=_['filter'](_0x22b96f,[_0x4d0a('0x54'),_0x69827d[_0x4d0a('0x72')][_0x4d0a('0x82')]]);}}_0x2fd9b6['rows']=_0x22b96f||_0x271754;return _0x2fd9b6;})[_0x4d0a('0x14')](respondWithFilteredResult(_0x203ab7,_0x1f790c))[_0x4d0a('0x17')](handleError(_0x203ab7,null));};exports['getQueues']=function(_0x37840c,_0x2c7e7d){var _0x2fcb46=[_0x4d0a('0x83'),'chat',_0x4d0a('0x84'),_0x4d0a('0x85'),'fax','whatsapp',_0x4d0a('0x18')];var _0x55663a={'count':0x0,'rows':[]},_0x1ef03f={},_0x1b5558,_0x57bfe7,_0x3ba86f,_0xe23c38,_0x222db1;Promise[_0x4d0a('0x6d')]()[_0x4d0a('0x14')](function(){if(_0x37840c['query'][_0x4d0a('0x86')]){if(!_[_0x4d0a('0x87')](_0x2fcb46,_0x37840c[_0x4d0a('0x72')]['channel']['toLowerCase']()))throw new Error(_0x4d0a('0x88'));_0x1b5558=_0x37840c[_0x4d0a('0x72')]['channel']['toLowerCase']();}var _0x1f3d24=_['startCase'](_0x1b5558)+_0x4d0a('0x89');var _0x548dad=_[_0x4d0a('0x2d')](db[_0x1f3d24][_0x4d0a('0x6e')],function(_0x46fb89){return{'name':_0x46fb89['fieldName'],'type':_0x46fb89[_0x4d0a('0x70')][_0x4d0a('0x71')]};});_0x1ef03f=qs[_0x4d0a('0x75')](_0x548dad,_0x37840c);if(_0x37840c[_0x4d0a('0x77')][_0x4d0a('0x73')]==='user'){var _0x56bce0={'params':{'id':_0x37840c[_0x4d0a('0x77')]['userProfileId']},'query':{'section':_0x1b5558==='voice'&&_0x37840c[_0x4d0a('0x72')][_0x4d0a('0x70')]===_0x4d0a('0x8a')?_0x4d0a('0x8b'):_[_0x4d0a('0x3f')](_0x1b5558)+'Queues','type':_0x37840c[_0x4d0a('0x72')][_0x4d0a('0x70')],'nolimit':!![],'sort':_0x4d0a('0x10'),'filter':_0x37840c[_0x4d0a('0x72')][_0x4d0a('0x34')]}};return db[_0x4d0a('0x7b')][_0x4d0a('0x7c')](_0x56bce0);}return db[_0x1f3d24][_0x4d0a('0x7d')](_0x1ef03f);})[_0x4d0a('0x14')](function(_0x3e92c0){_0x55663a['count']=_0x3e92c0[_0x4d0a('0xa')];_0x57bfe7=_0x3e92c0[_0x4d0a('0x7e')];return getRealtimeQueues(_0x37840c,_0x1b5558);})[_0x4d0a('0x14')](function(_0x3375ca){_0xe23c38=_0x3375ca[_0x4d0a('0x7e')];return getRealtimeAgents();})[_0x4d0a('0x14')](function(_0x51e4b1){_0x3ba86f=_0x51e4b1[_0x4d0a('0x7e')];if(_0x1b5558!=_0x4d0a('0x18'))return;return getRealtimeVoiceQueueChannels();})[_0x4d0a('0x14')](function(_0x70b1a1){_0x222db1=_0x70b1a1?_0x70b1a1['rows']:[];return initializeQueues(_0x57bfe7,_0xe23c38,_0x1b5558,_0x37840c[_0x4d0a('0x72')]['type']);})[_0x4d0a('0x14')](function(_0x2463a0){var _0x49f376=_0x2463a0[_0x4d0a('0x2d')](function(_0x2bc435){if(_0x1b5558===_0x4d0a('0x18'))return getVoiceQueueAgents(_0x2bc435,_0x57bfe7,_0x3ba86f,_0x222db1);else return getQueueAgents(_0x2bc435,_0x3ba86f,_0x1b5558);});return Promise[_0x4d0a('0x8c')](_0x49f376);})['then'](function(_0x46505a){_0x55663a[_0x4d0a('0x7e')]=_0x46505a;return _0x55663a;})[_0x4d0a('0x14')](respondWithFilteredResult(_0x2c7e7d,_0x1ef03f))[_0x4d0a('0x17')](handleError(_0x2c7e7d,null));}; \ No newline at end of file +var _0x0616=['merge','catch','voice','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','outbound','push','pTalking','originated','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','agents','loggedInDb','talking','find','pick','queue','length','internal','toString','busy','getMembers','UserId','accountcode','online','paused','voiceStatus','findAll','idle','unknown','unavailable','isNil','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','every','filter','voicePause','pause','chatStatus','faxStatus','openchannelStatus','whatsappStatus','*pause','getAgents','lastLoginAt','lastPauseAt','pauseType','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','faxCapacity','smsCurrentCapacity','whatsappCurrentCapacity','mailStatus','smsStatus','chatStatusTime','openchannelStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','routealias','mailPause','User','rawAttributes','fieldName','type','key','query','agent','getOptions','raw','user','userProfileId','nolimit','getResources','findAndCountAll','rows','globalStatus','globalStatusFilter','pauseTypeFilter','mail','chat','sms','openchannel','fax','whatsapp','resolve','channel','Invalid\x20channel','toLowerCase','Queue','UserProfile','util','../../components/parsers/qs','api','../../mysqldb','http','offset','undefined','count','limit','status','set','json','error','stack','name','send','request','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents'];(function(_0xf120c2,_0x1b8fea){var _0x1899b9=function(_0x8a05db){while(--_0x8a05db){_0xf120c2['push'](_0xf120c2['shift']());}};_0x1899b9(++_0x1b8fea);}(_0x0616,0xfd));var _0x6061=function(_0x309458,_0xba6e63){_0x309458=_0x309458-0x0;var _0x3306ee=_0x0616[_0x309458];return _0x3306ee;};'use strict';var util=require(_0x6061('0x0'));var _=require('lodash');var jayson=require('jayson/promise');var qs=require(_0x6061('0x1'));var logger=require('../../config/logger')(_0x6061('0x2'));var db=require(_0x6061('0x3'))['db'];var amiClient=jayson['client'][_0x6061('0x4')]({'port':0x232a});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithFilteredResult(_0x44b416,_0x2f5f15){return function(_0xb6b91d){if(_0xb6b91d){var _0x1cf92f=typeof _0x2f5f15[_0x6061('0x5')]===_0x6061('0x6')&&typeof _0x2f5f15['limit']===_0x6061('0x6');var _0x4d0c72=_0xb6b91d['count'];var _0x1fa1e4=_0x1cf92f?0x0:_0x2f5f15['offset'];var _0xf6d81a=_0x1cf92f?_0xb6b91d[_0x6061('0x7')]:_0x2f5f15[_0x6061('0x5')]+_0x2f5f15[_0x6061('0x8')];var _0x36b749;if(_0xf6d81a>=_0x4d0c72){_0xf6d81a=_0x4d0c72;_0x36b749=0xc8;}else{_0x36b749=0xce;}_0x44b416[_0x6061('0x9')](_0x36b749);return _0x44b416[_0x6061('0xa')]('Content-Range',_0x1fa1e4+'-'+_0xf6d81a+'/'+_0x4d0c72)[_0x6061('0xb')](_0xb6b91d);}return null;};}function handleError(_0x3dea2e,_0x1adc7c){_0x1adc7c=_0x1adc7c||0x1f4;return function(_0x2d6fed){logger[_0x6061('0xc')](_0x2d6fed[_0x6061('0xd')]);if(_0x2d6fed[_0x6061('0xe')]){delete _0x2d6fed['name'];}_0x3dea2e['status'](_0x1adc7c)[_0x6061('0xf')](_0x2d6fed);};}function getRealtimeAgents(){return new Promise(function(_0x1401ee,_0x5af218){return amiClient[_0x6061('0x10')]('Agents',{})[_0x6061('0x11')](function(_0x46ce7e){if(_0x46ce7e[_0x6061('0xc')])throw new Error(_0x6061('0x12'));var _0x4cebe5=_0x46ce7e[_0x6061('0x13')];return routingClient[_0x6061('0x10')](_0x6061('0x14'),{})[_0x6061('0x11')](function(_0x56c88a){if(_0x56c88a[_0x6061('0xc')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');var _0x1e7038=_0x56c88a['result'];return _0x1401ee(_[_0x6061('0x15')]({},_0x4cebe5,_0x1e7038));});})[_0x6061('0x16')](function(_0x59ebca){_0x5af218(_0x59ebca);});});}function getRealtimeQueues(_0x2e74c9,_0x552c51){return new Promise(function(_0x2f55ab,_0xcefe6f){var _0x2b9b7b=_0x552c51===_0x6061('0x17')?amiClient:routingClient;return _0x2b9b7b[_0x6061('0x10')](_[_0x6061('0x18')](_0x552c51)+_0x6061('0x19'),_0x2e74c9)[_0x6061('0x11')](function(_0x5638c0){if(_0x5638c0[_0x6061('0xc')])throw new Error(util[_0x6061('0x1a')](_0x6061('0x1b'),_0x552c51));return _0x2f55ab(_0x5638c0[_0x6061('0x13')]);})[_0x6061('0x16')](function(_0x14883d){_0xcefe6f(_0x14883d);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x239550,_0x6797f9){return amiClient['request']('VoiceQueuesChannels',{})[_0x6061('0x11')](function(_0x94850d){if(_0x94850d[_0x6061('0xc')])throw new Error(_0x6061('0x1c'));return _0x239550(_0x94850d['result']);})[_0x6061('0x16')](function(_0x38103c){_0x6797f9(_0x38103c);});});}function initializeQueues(_0x2d83e1,_0x1a7991,_0x349c72,_0x4ec776){var _0x25e295=[_0x6061('0x1d'),'available','waiting','talking','paused'];if(_0x349c72===_0x6061('0x17')&&_0x4ec776===_0x6061('0x1e')){_0x25e295[_0x6061('0x1f')](_0x6061('0x20'),_0x6061('0x21'),'message','dialActive',_0x6061('0x22'),_0x6061('0x23'),_0x6061('0x24'),_0x6061('0x25'),_0x6061('0x26'),'erlangCallToSecond',_0x6061('0x27'),_0x6061('0x28'),_0x6061('0x29'),'dialPredictiveIntervalMaxThreshold',_0x6061('0x2a'),'predictiveIntervalAvailable',_0x6061('0x2b'),'predictiveIntervalAnsweredCalls',_0x6061('0x2c'),_0x6061('0x2d'),_0x6061('0x2e'),_0x6061('0x2f'));}return _0x2d83e1[_0x6061('0x30')](function(_0x5beaeb){var _0x3fe1fa=_0x5beaeb[_0x6061('0x31')]({'plain':!![]});_0x3fe1fa[_0x6061('0x32')]=[];_0x3fe1fa['paused']=0x0;_0x3fe1fa[_0x6061('0x33')]=0x0;_0x3fe1fa['loggedIn']=0x0;_0x3fe1fa['available']=0x0;_0x3fe1fa['waiting']=0x0;if(_0x349c72==='voice'){_0x3fe1fa[_0x6061('0x34')]=0x0;_0x3fe1fa['busy']=0x0;if(_0x4ec776===_0x6061('0x1e')){_0x3fe1fa[_0x6061('0x20')]=0x0;_0x3fe1fa[_0x6061('0x21')]=0x0;}}var _0x576c48=_[_0x6061('0x35')](_0x1a7991,['id',_0x3fe1fa['id']]);if(_0x576c48)_[_0x6061('0x15')](_0x3fe1fa,_[_0x6061('0x36')](_0x576c48,_0x25e295));return _0x3fe1fa;});}function updateAgentVoiceStatus(_0x18bcc5,_0x3fc249,_0x2bcc72){var _0x1328b0=_['filter'](_0x2bcc72,[_0x6061('0x37'),_0x3fc249[_0x6061('0xe')]]);if(_0x1328b0[_0x6061('0x38')]===0x0)return _0x18bcc5['busy']=!![];if(_['some'](_0x1328b0,['connectedlinenum',_0x18bcc5[_0x6061('0x39')][_0x6061('0x3a')]()]))return _0x18bcc5[_0x6061('0x34')]=!![];if(!_0x18bcc5[_0x6061('0x34')])return _0x18bcc5[_0x6061('0x3b')]=!![];}function getVoiceQueueAgents(_0x497c36,_0x106ae5,_0x4b028e,_0x2631b0){var _0x496ec1=_[_0x6061('0x35')](_0x106ae5,['id',_0x497c36['id']]);if(!_0x496ec1)return _0x497c36;return _0x496ec1[_0x6061('0x3c')]({'raw':!![]})[_0x6061('0x11')](function(_0x10642f){for(var _0x234da7=0x0;_0x234da7<_0x10642f['length'];_0x234da7++){var _0x479de8=_[_0x6061('0x35')](_0x4b028e,['id',_0x10642f[_0x234da7][_0x6061('0x3d')]]);if(!_0x479de8){_0x479de8={'id':_0x10642f[_0x234da7][_0x6061('0x3d')],'name':_0x10642f[_0x234da7]['UserId'],'accountcode':'','online':![]};}var _0x4a4116={'id':_0x479de8['id'],'name':_0x479de8[_0x6061('0xe')],'internal':_0x479de8[_0x6061('0x3e')],'online':Boolean(_0x479de8[_0x6061('0x3f')]),'paused':Boolean(_0x10642f[_0x234da7][_0x6061('0x40')])};if(_0x479de8[_0x6061('0x41')]===_0x6061('0x34'))updateAgentVoiceStatus(_0x4a4116,_0x497c36,_0x2631b0);if(_0x4a4116['online'])_0x497c36[_0x6061('0x33')]++;if(_0x4a4116[_0x6061('0x3b')])_0x497c36['busy']++;if(_0x4a4116[_0x6061('0x40')]&&!_0x4a4116['busy']&&!_0x4a4116[_0x6061('0x34')])_0x497c36['paused']++;_0x497c36[_0x6061('0x32')][_0x6061('0x1f')](_0x4a4116);}return _0x497c36;});}function getQueueAgents(_0x1ffffa,_0x234578,_0x28e12a){var _0x5dadec='User'+_[_0x6061('0x18')](_0x28e12a)+'Queue';var _0x46d5c5=_0x28e12a+'Pause';return db[_0x5dadec][_0x6061('0x42')]({'where':{[_[_0x6061('0x18')](_0x28e12a)+'QueueId']:_0x1ffffa['id']},'raw':!![]})[_0x6061('0x11')](function(_0x941e86){for(var _0x4c75a5=0x0;_0x4c75a5<_0x941e86[_0x6061('0x38')];_0x4c75a5++){var _0xcd98ca=_[_0x6061('0x35')](_0x234578,['id',_0x941e86[_0x4c75a5][_0x6061('0x3d')]]);if(!_0xcd98ca){_0xcd98ca={'id':_0x941e86[_0x4c75a5][_0x6061('0x3d')],'name':_0x941e86[_0x4c75a5]['UserId'],'online':![],['pauseField']:![]};}var _0x4dd34f={'id':_0xcd98ca['id'],'name':_0xcd98ca[_0x6061('0xe')],'online':Boolean(_0xcd98ca[_0x6061('0x3f')]),'paused':Boolean(_0xcd98ca[_0x46d5c5])};if(_0x4dd34f[_0x6061('0x3f')])_0x1ffffa[_0x6061('0x33')]++;_0x1ffffa[_0x6061('0x32')][_0x6061('0x1f')](_0x4dd34f);}return _0x1ffffa;});}function isIdle(_0xb03f30){return _0xb03f30===_0x6061('0x43')||_0xb03f30===_0x6061('0x44')||_0xb03f30===_0x6061('0x45')||_0xb03f30==='ringing'||_[_0x6061('0x46')](_0xb03f30);}function isAgentPaused(_0x3d4e7d,_0x27ae9a){var _0x132e7e=[_0x3d4e7d[_0x6061('0x47')],_0x3d4e7d[_0x6061('0x48')],_0x3d4e7d['mailPause'],_0x3d4e7d[_0x6061('0x49')],_0x3d4e7d[_0x6061('0x4a')],_0x3d4e7d['voicePause'],_0x3d4e7d[_0x6061('0x4b')]];if(!_0x27ae9a)return _[_0x6061('0x4c')](_0x132e7e);var _0x36c867=_[_0x6061('0x4d')](_0x132e7e);return _0x36c867[_0x6061('0x38')]>0x0&&_0x36c867['length']<_0x132e7e[_0x6061('0x38')]?!![]:![];}function isAgentIdle(_0x75995d){if(_0x75995d['voiceStatus']!==_0x6061('0x43')&&_0x75995d[_0x6061('0x4e')]){_0x75995d[_0x6061('0x41')]=_0x6061('0x4f');return![];}return _[_0x6061('0x4c')]([_0x75995d[_0x6061('0x50')],_0x75995d[_0x6061('0x51')],_0x75995d['mailStatus'],_0x75995d[_0x6061('0x52')],_0x75995d['smsStatus'],_0x75995d['voiceStatus'],_0x75995d[_0x6061('0x53')]],isIdle);}function getAgentStatus(_0x2f073d){var _0xe56e76=_0x6061('0x44');if(isAgentPaused(_0x2f073d))_0xe56e76='pause';else if(isAgentPaused(_0x2f073d,!![]))_0xe56e76=_0x6061('0x54');else if(isAgentIdle(_0x2f073d))_0xe56e76='idle';else _0xe56e76=_0x6061('0x3b');return _0xe56e76;}exports[_0x6061('0x55')]=function(_0x58f553,_0x370e4b){var _0xae9c4c={'count':0x0,'rows':[]},_0x31051e={},_0x44fda3,_0xd057e1,_0x2c8507=['userpic',_0x6061('0x3f'),_0x6061('0x56'),_0x6061('0x57'),_0x6061('0x58'),_0x6061('0x57'),_0x6061('0x39'),'address',_0x6061('0x47'),_0x6061('0x49'),'mailPause',_0x6061('0x4a'),_0x6061('0x4b'),_0x6061('0x48'),_0x6061('0x4e'),_0x6061('0x59'),_0x6061('0x5a'),_0x6061('0x5b'),_0x6061('0x5c'),'whatsappCapacity',_0x6061('0x5d'),'chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity',_0x6061('0x5e'),_0x6061('0x5f'),'faxCurrentCapacity',_0x6061('0x50'),'openchannelStatus',_0x6061('0x60'),_0x6061('0x61'),_0x6061('0x53'),'faxStatus',_0x6061('0x41'),_0x6061('0x62'),_0x6061('0x63'),'mailStatusTime','smsStatusTime',_0x6061('0x64'),_0x6061('0x65'),_0x6061('0x66'),'queue',_0x6061('0x67'),'screenrecording',_0x6061('0x68'),'phoneBarEnableAutomaticScreenRecording',_0x6061('0x69')],_0x2af658=[_0x6061('0x47'),_0x6061('0x49'),_0x6061('0x6a'),_0x6061('0x4a'),_0x6061('0x4b'),_0x6061('0x48'),'voicePause',_0x6061('0x3f')];Promise['resolve']()['then'](function(){var _0x206063=_[_0x6061('0x30')](db[_0x6061('0x6b')][_0x6061('0x6c')],function(_0xc4b2ab){return{'name':_0xc4b2ab[_0x6061('0x6d')],'type':_0xc4b2ab[_0x6061('0x6e')][_0x6061('0x6f')]};});_0x58f553[_0x6061('0x70')]['role']=_0x6061('0x71');_0x58f553[_0x6061('0x70')][_0x6061('0x3f')]=!![];_0x31051e=qs[_0x6061('0x72')](_0x206063,_0x58f553);_0x31051e[_0x6061('0x73')]=!![];if(_0x58f553[_0x6061('0x74')]['role']===_0x6061('0x74')){var _0x1be78f={'params':{'id':_0x58f553[_0x6061('0x74')][_0x6061('0x75')]},'query':{'section':_0x6061('0x14'),'role':_0x6061('0x71'),'online':!![],'nolimit':_0x58f553[_0x6061('0x70')][_0x6061('0x76')],'sort':_0x58f553['query']['sort'],'filter':_0x58f553[_0x6061('0x70')][_0x6061('0x4d')]},'raw':!![]};return db['UserProfile'][_0x6061('0x77')](_0x1be78f);}return db[_0x6061('0x6b')][_0x6061('0x78')](_0x31051e);})[_0x6061('0x11')](function(_0x5cb2a0){_0xae9c4c[_0x6061('0x7')]=_0x5cb2a0[_0x6061('0x7')];_0x44fda3=_0x5cb2a0[_0x6061('0x79')];return getRealtimeAgents();})['then'](function(_0x3cb4af){_0xd057e1=_0x3cb4af['rows'];return _0x44fda3[_0x6061('0x30')](function(_0x1c8839){var _0x21fc4b=_[_0x6061('0x35')](_0xd057e1,['id',_0x1c8839['id']]);if(_0x21fc4b)_['merge'](_0x1c8839,_[_0x6061('0x36')](_['omit'](_0x21fc4b,_0x2af658),_0x2c8507));_0x1c8839[_0x6061('0x7a')]=getAgentStatus(_0x1c8839);return _0x1c8839;});})[_0x6061('0x11')](function(_0x4a6723){if(_0x58f553[_0x6061('0x70')][_0x6061('0x7b')]){var _0x46d338=_[_0x6061('0x4d')](_0x4a6723,[_0x6061('0x7a'),_0x58f553[_0x6061('0x70')][_0x6061('0x7b')]]);if(_0x58f553[_0x6061('0x70')][_0x6061('0x7c')]){_0x46d338=_[_0x6061('0x4d')](_0x46d338,['pauseType',_0x58f553[_0x6061('0x70')][_0x6061('0x7c')]]);}}_0xae9c4c[_0x6061('0x79')]=_0x46d338||_0x4a6723;return _0xae9c4c;})['then'](respondWithFilteredResult(_0x370e4b,_0x31051e))['catch'](handleError(_0x370e4b,null));};exports['getQueues']=function(_0x4a7aa0,_0x5e146d){var _0x4e93fa=[_0x6061('0x7d'),_0x6061('0x7e'),_0x6061('0x7f'),_0x6061('0x80'),_0x6061('0x81'),_0x6061('0x82'),'voice'];var _0x3b2ed0={'count':0x0,'rows':[]},_0x5a8cd0={},_0x23e750,_0x59c941,_0x43164f,_0x203e72,_0x41fb64;Promise[_0x6061('0x83')]()[_0x6061('0x11')](function(){if(_0x4a7aa0['query'][_0x6061('0x84')]){if(!_['includes'](_0x4e93fa,_0x4a7aa0[_0x6061('0x70')][_0x6061('0x84')]['toLowerCase']()))throw new Error(_0x6061('0x85'));_0x23e750=_0x4a7aa0['query'][_0x6061('0x84')][_0x6061('0x86')]();}var _0x58f730=_['startCase'](_0x23e750)+_0x6061('0x87');var _0x2e7a90=_[_0x6061('0x30')](db[_0x58f730][_0x6061('0x6c')],function(_0x409fe6){return{'name':_0x409fe6[_0x6061('0x6d')],'type':_0x409fe6[_0x6061('0x6e')]['key']};});_0x5a8cd0=qs[_0x6061('0x72')](_0x2e7a90,_0x4a7aa0);if(_0x4a7aa0[_0x6061('0x74')]['role']===_0x6061('0x74')){var _0x286517={'params':{'id':_0x4a7aa0[_0x6061('0x74')][_0x6061('0x75')]},'query':{'section':_0x23e750==='voice'&&_0x4a7aa0[_0x6061('0x70')]['type']===_0x6061('0x1e')?'QueueCampaigns':_['startCase'](_0x23e750)+_0x6061('0x19'),'type':_0x4a7aa0[_0x6061('0x70')]['type'],'nolimit':!![],'sort':_0x6061('0xe'),'filter':_0x4a7aa0[_0x6061('0x70')][_0x6061('0x4d')]}};return db[_0x6061('0x88')][_0x6061('0x77')](_0x286517);}return db[_0x58f730]['findAndCountAll'](_0x5a8cd0);})[_0x6061('0x11')](function(_0x339b6d){_0x3b2ed0[_0x6061('0x7')]=_0x339b6d[_0x6061('0x7')];_0x59c941=_0x339b6d[_0x6061('0x79')];return getRealtimeQueues(_0x4a7aa0,_0x23e750);})[_0x6061('0x11')](function(_0x9158bf){_0x203e72=_0x9158bf[_0x6061('0x79')];return getRealtimeAgents();})[_0x6061('0x11')](function(_0x3768e4){_0x43164f=_0x3768e4['rows'];if(_0x23e750!=_0x6061('0x17'))return;return getRealtimeVoiceQueueChannels();})[_0x6061('0x11')](function(_0x1db351){_0x41fb64=_0x1db351?_0x1db351[_0x6061('0x79')]:[];return initializeQueues(_0x59c941,_0x203e72,_0x23e750,_0x4a7aa0[_0x6061('0x70')][_0x6061('0x6e')]);})['then'](function(_0x1413cf){var _0x1cab11=_0x1413cf[_0x6061('0x30')](function(_0xe29e8f){if(_0x23e750===_0x6061('0x17'))return getVoiceQueueAgents(_0xe29e8f,_0x59c941,_0x43164f,_0x41fb64);else return getQueueAgents(_0xe29e8f,_0x43164f,_0x23e750);});return Promise['all'](_0x1cab11);})[_0x6061('0x11')](function(_0x2f1b76){_0x3b2ed0[_0x6061('0x79')]=_0x2f1b76;return _0x3b2ed0;})[_0x6061('0x11')](respondWithFilteredResult(_0x5e146d,_0x5a8cd0))[_0x6061('0x16')](handleError(_0x5e146d,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index b42504a..dd2ee68 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(_0x21cc35,_0x5d582a){var _0x4d14d4=function(_0x44e7b5){while(--_0x44e7b5){_0x21cc35['push'](_0x21cc35['shift']());}};_0x4d14d4(++_0x5d582a);}(_0x70e0,0x17b));var _0x070e=function(_0x2d9224,_0x277f81){_0x2d9224=_0x2d9224-0x0;var _0x4f5562=_0x70e0[_0x2d9224];return _0x4f5562;};'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(_0x490615,_0x1def77){var _0x217048=function(_0x152f60){while(--_0x152f60){_0x490615['push'](_0x490615['shift']());}};_0x217048(++_0x1def77);}(_0x70e0,0x17b));var _0x070e=function(_0x507fee,_0x536e37){_0x507fee=_0x507fee-0x0;var _0x563545=_0x70e0[_0x507fee];return _0x563545;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 7367bb0..207808d 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 _0x5a43=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0xec39e6,_0x53b960){var _0x100d07=function(_0xa22239){while(--_0xa22239){_0xec39e6['push'](_0xec39e6['shift']());}};_0x100d07(++_0x53b960);}(_0x5a43,0xf1));var _0x35a4=function(_0x336623,_0x506da1){_0x336623=_0x336623-0x0;var _0x381329=_0x5a43[_0x336623];return _0x381329;};'use strict';var Sequelize=require(_0x35a4('0x0'));module[_0x35a4('0x1')]={'state':{'type':Sequelize[_0x35a4('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x35a4('0x3')]},'scheduledat':{'type':Sequelize[_0x35a4('0x4')]},'uniqueid':{'type':Sequelize[_0x35a4('0x3')]},'starttime':{'type':Sequelize[_0x35a4('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x35a4('0x3')]}}; \ No newline at end of file +var _0x398a=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x6a82c7,_0x252267){var _0x521e0d=function(_0x272961){while(--_0x272961){_0x6a82c7['push'](_0x6a82c7['shift']());}};_0x521e0d(++_0x252267);}(_0x398a,0x11a));var _0xa398=function(_0x17cc73,_0x4729a7){_0x17cc73=_0x17cc73-0x0;var _0x3888a3=_0x398a[_0x17cc73];return _0x3888a3;};'use strict';var Sequelize=require(_0xa398('0x0'));module[_0xa398('0x1')]={'state':{'type':Sequelize[_0xa398('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xa398('0x3')]},'scheduledat':{'type':Sequelize[_0xa398('0x4')]},'uniqueid':{'type':Sequelize[_0xa398('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xa398('0x3')]},'campaigntype':{'type':Sequelize[_0xa398('0x3')]},'membername':{'type':Sequelize[_0xa398('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index f1861c5..cf96839 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 _0x5f7c=['request-promise','path','rimraf','./reportAgentPreview.attributes','exports','define','report_agent_preview','lodash','../../config/logger','api','bluebird'];(function(_0x267451,_0x271677){var _0x412df1=function(_0xb21dce){while(--_0xb21dce){_0x267451['push'](_0x267451['shift']());}};_0x412df1(++_0x271677);}(_0x5f7c,0x130));var _0xc5f7=function(_0xedead4,_0x18571c){_0xedead4=_0xedead4-0x0;var _0x11bc1e=_0x5f7c[_0xedead4];return _0x11bc1e;};'use strict';var _=require(_0xc5f7('0x0'));var util=require('util');var logger=require(_0xc5f7('0x1'))(_0xc5f7('0x2'));var moment=require('moment');var BPromise=require(_0xc5f7('0x3'));var rp=require(_0xc5f7('0x4'));var fs=require('fs');var path=require(_0xc5f7('0x5'));var rimraf=require(_0xc5f7('0x6'));var config=require('../../config/environment');var attributes=require(_0xc5f7('0x7'));module[_0xc5f7('0x8')]=function(_0x144b01,_0x4153b8){return _0x144b01[_0xc5f7('0x9')]('ReportAgentPreview',attributes,{'tableName':_0xc5f7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0966=['ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x4777f2,_0x349fbd){var _0xede8b0=function(_0x366a80){while(--_0x366a80){_0x4777f2['push'](_0x4777f2['shift']());}};_0xede8b0(++_0x349fbd);}(_0x0966,0x138));var _0x6096=function(_0x17580b,_0x3ec7ac){_0x17580b=_0x17580b-0x0;var _0x371372=_0x0966[_0x17580b];return _0x371372;};'use strict';var _=require(_0x6096('0x0'));var util=require(_0x6096('0x1'));var logger=require(_0x6096('0x2'))(_0x6096('0x3'));var moment=require(_0x6096('0x4'));var BPromise=require(_0x6096('0x5'));var rp=require(_0x6096('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6096('0x7'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x47c4f9,_0x435423){return _0x47c4f9['define'](_0x6096('0x8'),attributes,{'tableName':_0x6096('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 fb20f85..1a5b6da 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 _0x97f9=['request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x256c8e,_0x252cfc){var _0x14dca9=function(_0x44cf09){while(--_0x44cf09){_0x256c8e['push'](_0x256c8e['shift']());}};_0x14dca9(++_0x252cfc);}(_0x97f9,0xf2));var _0x997f=function(_0x14216c,_0x14830a){_0x14216c=_0x14216c-0x0;var _0x2130e1=_0x97f9[_0x14216c];return _0x2130e1;};'use strict';var _=require(_0x997f('0x0'));var util=require(_0x997f('0x1'));var moment=require(_0x997f('0x2'));var BPromise=require(_0x997f('0x3'));var rs=require(_0x997f('0x4'));var fs=require('fs');var Redis=require(_0x997f('0x5'));var db=require(_0x997f('0x6'))['db'];var utils=require(_0x997f('0x7'));var logger=require(_0x997f('0x8'))(_0x997f('0x9'));var config=require(_0x997f('0xa'));var jayson=require(_0x997f('0xb'));var client=jayson[_0x997f('0xc')][_0x997f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x569ffe,_0x1ae7c2,_0x43ed7b){return new BPromise(function(_0x228f62,_0x2e9c36){return client[_0x997f('0xe')](_0x569ffe,_0x43ed7b)[_0x997f('0xf')](function(_0x1515fb){logger[_0x997f('0x10')](_0x997f('0x11'),_0x1ae7c2,_0x997f('0x12'));logger[_0x997f('0x13')](_0x997f('0x14'),_0x1ae7c2,_0x997f('0x12'),JSON[_0x997f('0x15')](_0x1515fb));if(_0x1515fb['error']){if(_0x1515fb[_0x997f('0x16')][_0x997f('0x17')]===0x1f4){logger[_0x997f('0x16')](_0x997f('0x11'),_0x1ae7c2,_0x1515fb[_0x997f('0x16')][_0x997f('0x18')]);return _0x2e9c36(_0x1515fb[_0x997f('0x16')][_0x997f('0x18')]);}logger[_0x997f('0x16')](_0x997f('0x11'),_0x1ae7c2,_0x1515fb[_0x997f('0x16')][_0x997f('0x18')]);return _0x228f62(_0x1515fb[_0x997f('0x16')][_0x997f('0x18')]);}else{logger[_0x997f('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x1ae7c2,_0x997f('0x12'));_0x228f62(_0x1515fb[_0x997f('0x19')]['message']);}})[_0x997f('0x1a')](function(_0x4e11b0){logger[_0x997f('0x16')](_0x997f('0x11'),_0x1ae7c2,_0x4e11b0);_0x2e9c36(_0x4e11b0);});});}exports[_0x997f('0x1b')]=function(_0x2445af){var _0x5adfca=this;return new Promise(function(_0x706008,_0x54a542){return db['ReportAgentPreview'][_0x997f('0x1c')](_0x2445af[_0x997f('0x1d')],{'raw':_0x2445af['options']?_0x2445af[_0x997f('0x1e')][_0x997f('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x4684c0){logger[_0x997f('0x10')](_0x997f('0x1b'),_0x2445af);logger[_0x997f('0x13')](_0x997f('0x1b'),_0x2445af,JSON[_0x997f('0x15')](_0x4684c0));_0x706008(_0x4684c0);})[_0x997f('0x1a')](function(_0x7a0490){logger[_0x997f('0x16')](_0x997f('0x1b'),_0x7a0490[_0x997f('0x18')],_0x2445af);_0x54a542(_0x5adfca[_0x997f('0x16')](0x1f4,_0x7a0490[_0x997f('0x18')]));});});}; \ No newline at end of file +var _0x9aa9=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','options','raw','stringify','lodash','moment'];(function(_0x814fc5,_0x43eba8){var _0x20f2cb=function(_0x45ad0c){while(--_0x45ad0c){_0x814fc5['push'](_0x814fc5['shift']());}};_0x20f2cb(++_0x43eba8);}(_0x9aa9,0x193));var _0x99aa=function(_0x37c1c2,_0x19c8e6){_0x37c1c2=_0x37c1c2-0x0;var _0x4a4951=_0x9aa9[_0x37c1c2];return _0x4a4951;};'use strict';var _=require(_0x99aa('0x0'));var util=require('util');var moment=require(_0x99aa('0x1'));var BPromise=require(_0x99aa('0x2'));var rs=require(_0x99aa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x99aa('0x4'))['db'];var utils=require(_0x99aa('0x5'));var logger=require('../../config/logger')(_0x99aa('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x99aa('0x7')][_0x99aa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1411ee,_0x4c1186,_0x22e6e8){return new BPromise(function(_0x182cc0,_0x5994a8){return client[_0x99aa('0x9')](_0x1411ee,_0x22e6e8)[_0x99aa('0xa')](function(_0x466635){logger['info'](_0x99aa('0xb'),_0x4c1186,'request\x20sent');logger[_0x99aa('0xc')](_0x99aa('0xd'),_0x4c1186,_0x99aa('0xe'),JSON['stringify'](_0x466635));if(_0x466635[_0x99aa('0xf')]){if(_0x466635[_0x99aa('0xf')][_0x99aa('0x10')]===0x1f4){logger[_0x99aa('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0x4c1186,_0x466635[_0x99aa('0xf')][_0x99aa('0x11')]);return _0x5994a8(_0x466635['error'][_0x99aa('0x11')]);}logger[_0x99aa('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0x4c1186,_0x466635[_0x99aa('0xf')][_0x99aa('0x11')]);return _0x182cc0(_0x466635[_0x99aa('0xf')][_0x99aa('0x11')]);}else{logger[_0x99aa('0x12')](_0x99aa('0xb'),_0x4c1186,_0x99aa('0xe'));_0x182cc0(_0x466635[_0x99aa('0x13')]['message']);}})[_0x99aa('0x14')](function(_0x44391c){logger[_0x99aa('0xf')](_0x99aa('0xb'),_0x4c1186,_0x44391c);_0x5994a8(_0x44391c);});});}exports[_0x99aa('0x15')]=function(_0x47d1e6){var _0x436403=this;return new Promise(function(_0xd2675,_0x3db4e7){return db[_0x99aa('0x16')][_0x99aa('0x17')](_0x47d1e6['body'],{'raw':_0x47d1e6[_0x99aa('0x18')]?_0x47d1e6[_0x99aa('0x18')][_0x99aa('0x19')]===undefined?!![]:![]:!![]})[_0x99aa('0xa')](function(_0x22e80a){logger[_0x99aa('0x12')](_0x99aa('0x15'),_0x47d1e6);logger[_0x99aa('0xc')](_0x99aa('0x15'),_0x47d1e6,JSON[_0x99aa('0x1a')](_0x22e80a));_0xd2675(_0x22e80a);})[_0x99aa('0x14')](function(_0x441ff1){logger[_0x99aa('0xf')](_0x99aa('0x15'),_0x441ff1[_0x99aa('0x11')],_0x47d1e6);_0x3db4e7(_0x436403[_0x99aa('0xf')](0x1f4,_0x441ff1['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index ed1aa4e..c65d179 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 _0x571e=['showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','exports','multer','util','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','campaigns','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','mail','/chat/queues/:id/notify','queueNotify','/chat/queues/:id'];(function(_0x3daad6,_0x38f789){var _0x4f27ea=function(_0x3122d5){while(--_0x3122d5){_0x3daad6['push'](_0x3daad6['shift']());}};_0x4f27ea(++_0x38f789);}(_0x571e,0x1a4));var _0xe571=function(_0x21c0f4,_0x535c84){_0x21c0f4=_0x21c0f4-0x0;var _0x78ff61=_0x571e[_0x21c0f4];return _0x78ff61;};'use strict';var multer=require(_0xe571('0x0'));var util=require(_0xe571('0x1'));var path=require('path');var express=require(_0xe571('0x2'));var router=express[_0xe571('0x3')]();var auth=require(_0xe571('0x4'));var controller=require(_0xe571('0x5'));router[_0xe571('0x6')](_0xe571('0x7'),auth[_0xe571('0x8')](),controller['voiceChannels']);router[_0xe571('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0xe571('0x9')]);router['get'](_0xe571('0xa'),auth[_0xe571('0x8')](),controller[_0xe571('0xb')]);router[_0xe571('0x6')](_0xe571('0xc'),auth['isAuthenticated'](),controller[_0xe571('0xd')]);router[_0xe571('0x6')](_0xe571('0xe'),auth[_0xe571('0x8')](),controller[_0xe571('0xf')]);router[_0xe571('0x6')](_0xe571('0x10'),auth[_0xe571('0x8')](),controller[_0xe571('0x11')]);router['get'](_0xe571('0x12'),auth['isAuthenticated'](),controller[_0xe571('0x13')]);router['get'](_0xe571('0x14'),auth[_0xe571('0x8')](),controller[_0xe571('0x15')]);router[_0xe571('0x6')](_0xe571('0x16'),auth[_0xe571('0x8')](),controller[_0xe571('0x17')]);router[_0xe571('0x6')]('/whatsapp/queues',auth['isAuthenticated'](),controller[_0xe571('0x18')]);router[_0xe571('0x6')]('/fax/queues',auth['isAuthenticated'](),controller[_0xe571('0x19')]);router[_0xe571('0x6')](_0xe571('0x1a'),auth[_0xe571('0x8')](),controller[_0xe571('0x1b')]);router[_0xe571('0x6')](_0xe571('0x1c'),auth['isAuthenticated'](),controller[_0xe571('0x1d')]);router[_0xe571('0x6')](_0xe571('0x1e'),auth[_0xe571('0x8')](),controller['voiceQueuesChannel']);router['get'](_0xe571('0x1f'),auth['isAuthenticated'](),controller[_0xe571('0x20')]);router[_0xe571('0x6')](_0xe571('0x21'),auth[_0xe571('0x8')](),controller[_0xe571('0x22')]);router['get'](_0xe571('0x23'),auth[_0xe571('0x8')](),controller['showVoiceQueues']);router[_0xe571('0x24')]('/voice/queues/:id',auth[_0xe571('0x8')](),controller[_0xe571('0x25')]);router[_0xe571('0x6')](_0xe571('0x26'),auth[_0xe571('0x8')](),controller[_0xe571('0x27')]);router['get'](_0xe571('0x28'),auth[_0xe571('0x8')](),controller['outboundChannels']);router[_0xe571('0x6')](_0xe571('0x29'),auth[_0xe571('0x8')](),controller[_0xe571('0x2a')]);router[_0xe571('0x24')](_0xe571('0x2b'),auth[_0xe571('0x8')](),controller[_0xe571('0x2c')]);router['get'](_0xe571('0x2d'),auth['isAuthenticated'](),controller[_0xe571('0x2e')]);router[_0xe571('0x6')](_0xe571('0x2f'),auth[_0xe571('0x8')](),controller[_0xe571('0x30')]);router[_0xe571('0x6')]('/campaigns',auth[_0xe571('0x8')](),controller[_0xe571('0x31')]);router[_0xe571('0x6')]('/fax/accounts',auth['isAuthenticated'](),controller[_0xe571('0x32')]);router['get']('/chat/queues/waitinginteractions',auth[_0xe571('0x8')](),controller[_0xe571('0x33')]);router[_0xe571('0x6')](_0xe571('0x34'),auth['isAuthenticated'](),controller['mailQueuesWaitingInteractions']);router['get'](_0xe571('0x35'),auth['isAuthenticated'](),controller[_0xe571('0x36')]);router[_0xe571('0x6')](_0xe571('0x37'),auth[_0xe571('0x8')](),controller[_0xe571('0x38')]);router[_0xe571('0x6')](_0xe571('0x39'),auth[_0xe571('0x8')](),controller['smsQueuesWaitingInteractions']);router['get']('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xe571('0x3a')]);router[_0xe571('0x6')](_0xe571('0x3b'),auth[_0xe571('0x8')](),controller['faxQueuesWaitingInteractions']);router[_0xe571('0x3c')](_0xe571('0x3d'),auth[_0xe571('0x8')](),controller['queueNotify'](_0xe571('0x3e')));router[_0xe571('0x6')]('/mail/queues/:id',auth[_0xe571('0x8')](),controller['showMailQueues']);router[_0xe571('0x3c')](_0xe571('0x3f'),auth[_0xe571('0x8')](),controller[_0xe571('0x40')]('chat'));router['get'](_0xe571('0x41'),auth[_0xe571('0x8')](),controller[_0xe571('0x42')]);router[_0xe571('0x3c')](_0xe571('0x43'),auth[_0xe571('0x8')](),controller['queueNotify'](_0xe571('0x44')));router[_0xe571('0x6')]('/fax/queues/:id',auth[_0xe571('0x8')](),controller[_0xe571('0x45')]);router['post'](_0xe571('0x46'),auth[_0xe571('0x8')](),controller[_0xe571('0x40')](_0xe571('0x47')));router[_0xe571('0x6')](_0xe571('0x48'),auth['isAuthenticated'](),controller['showOpenchannelQueues']);router['post'](_0xe571('0x49'),auth['isAuthenticated'](),controller[_0xe571('0x40')](_0xe571('0x4a')));router['post'](_0xe571('0x4b'),auth['isAuthenticated'](),controller[_0xe571('0x40')](_0xe571('0x4c')));router['get'](_0xe571('0x4d'),auth[_0xe571('0x8')](),controller['showSmsQueues']);router[_0xe571('0x6')](_0xe571('0x4e'),auth[_0xe571('0x8')](),controller[_0xe571('0x4f')]);router[_0xe571('0x3c')]('/agents/:id/notify',auth['isAuthenticated'](),controller['agentNotify']);module[_0xe571('0x50')]=router; \ No newline at end of file +var _0x6ef4=['faxQueuesWaitingInteractions','mail','showMailQueues','chat','/chat/queues/:id','post','queueNotify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outboundChannels','/agents','agents','/telephones','/trunks','trunks','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions'];(function(_0x16f790,_0x2f6d8c){var _0x503510=function(_0x342f16){while(--_0x342f16){_0x16f790['push'](_0x16f790['shift']());}};_0x503510(++_0x2f6d8c);}(_0x6ef4,0xa3));var _0x46ef=function(_0x187790,_0x2a083b){_0x187790=_0x187790-0x0;var _0x472705=_0x6ef4[_0x187790];return _0x472705;};'use strict';var multer=require(_0x46ef('0x0'));var util=require(_0x46ef('0x1'));var path=require(_0x46ef('0x2'));var express=require(_0x46ef('0x3'));var router=express[_0x46ef('0x4')]();var auth=require(_0x46ef('0x5'));var controller=require('./rpc.controller');router[_0x46ef('0x6')](_0x46ef('0x7'),auth[_0x46ef('0x8')](),controller['voiceChannels']);router[_0x46ef('0x6')](_0x46ef('0x9'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0x46ef('0x6')](_0x46ef('0xa'),auth[_0x46ef('0x8')](),controller[_0x46ef('0xb')]);router['get'](_0x46ef('0xc'),auth[_0x46ef('0x8')](),controller[_0x46ef('0xd')]);router['get'](_0x46ef('0xe'),auth['isAuthenticated'](),controller[_0x46ef('0xf')]);router[_0x46ef('0x6')]('/mail/queues',auth['isAuthenticated'](),controller[_0x46ef('0x10')]);router[_0x46ef('0x6')](_0x46ef('0x11'),auth[_0x46ef('0x8')](),controller[_0x46ef('0x12')]);router[_0x46ef('0x6')](_0x46ef('0x13'),auth[_0x46ef('0x8')](),controller[_0x46ef('0x14')]);router['get']('/sms/queues',auth[_0x46ef('0x8')](),controller[_0x46ef('0x15')]);router['get'](_0x46ef('0x16'),auth[_0x46ef('0x8')](),controller['whatsappQueues']);router[_0x46ef('0x6')](_0x46ef('0x17'),auth['isAuthenticated'](),controller[_0x46ef('0x18')]);router[_0x46ef('0x6')](_0x46ef('0x19'),auth['isAuthenticated'](),controller[_0x46ef('0x1a')]);router[_0x46ef('0x6')](_0x46ef('0x1b'),auth[_0x46ef('0x8')](),controller[_0x46ef('0x1c')]);router[_0x46ef('0x6')](_0x46ef('0x1d'),auth[_0x46ef('0x8')](),controller['voiceQueuesChannel']);router[_0x46ef('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x46ef('0x8')](),controller[_0x46ef('0x1e')]);router[_0x46ef('0x6')](_0x46ef('0x1f'),auth[_0x46ef('0x8')](),controller[_0x46ef('0x20')]);router[_0x46ef('0x6')](_0x46ef('0x21'),auth[_0x46ef('0x8')](),controller[_0x46ef('0x22')]);router[_0x46ef('0x23')]('/voice/queues/:id',auth[_0x46ef('0x8')](),controller[_0x46ef('0x24')]);router[_0x46ef('0x6')](_0x46ef('0x25'),auth[_0x46ef('0x8')](),controller['outbound']);router[_0x46ef('0x6')]('/outbound/channels',auth[_0x46ef('0x8')](),controller[_0x46ef('0x26')]);router[_0x46ef('0x6')](_0x46ef('0x27'),auth['isAuthenticated'](),controller[_0x46ef('0x28')]);router[_0x46ef('0x23')]('/agents/:id/capacity',auth['isAuthenticated'](),controller['agentCapacity']);router['get'](_0x46ef('0x29'),auth[_0x46ef('0x8')](),controller['telephones']);router[_0x46ef('0x6')](_0x46ef('0x2a'),auth[_0x46ef('0x8')](),controller[_0x46ef('0x2b')]);router[_0x46ef('0x6')]('/campaigns',auth[_0x46ef('0x8')](),controller['campaigns']);router[_0x46ef('0x6')]('/fax/accounts',auth[_0x46ef('0x8')](),controller['faxAccounts']);router[_0x46ef('0x6')]('/chat/queues/waitinginteractions',auth[_0x46ef('0x8')](),controller[_0x46ef('0x2c')]);router[_0x46ef('0x6')](_0x46ef('0x2d'),auth[_0x46ef('0x8')](),controller[_0x46ef('0x2e')]);router[_0x46ef('0x6')](_0x46ef('0x2f'),auth[_0x46ef('0x8')](),controller[_0x46ef('0x30')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x46ef('0x6')](_0x46ef('0x31'),auth[_0x46ef('0x8')](),controller[_0x46ef('0x32')]);router[_0x46ef('0x6')](_0x46ef('0x33'),auth[_0x46ef('0x8')](),controller['whatsappQueuesWaitingInteractions']);router[_0x46ef('0x6')](_0x46ef('0x34'),auth[_0x46ef('0x8')](),controller[_0x46ef('0x35')]);router['post']('/mail/queues/:id/notify',auth[_0x46ef('0x8')](),controller['queueNotify'](_0x46ef('0x36')));router['get']('/mail/queues/:id',auth[_0x46ef('0x8')](),controller[_0x46ef('0x37')]);router['post']('/chat/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0x46ef('0x38')));router[_0x46ef('0x6')](_0x46ef('0x39'),auth[_0x46ef('0x8')](),controller['showChatQueues']);router[_0x46ef('0x3a')]('/fax/queues/:id/notify',auth['isAuthenticated'](),controller[_0x46ef('0x3b')](_0x46ef('0x3c')));router[_0x46ef('0x6')](_0x46ef('0x3d'),auth['isAuthenticated'](),controller[_0x46ef('0x3e')]);router[_0x46ef('0x3a')](_0x46ef('0x3f'),auth[_0x46ef('0x8')](),controller[_0x46ef('0x3b')]('openchannel'));router[_0x46ef('0x6')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller[_0x46ef('0x40')]);router['post']('/sms/queues/:id/notify',auth['isAuthenticated'](),controller[_0x46ef('0x3b')](_0x46ef('0x41')));router[_0x46ef('0x3a')](_0x46ef('0x42'),auth['isAuthenticated'](),controller[_0x46ef('0x3b')](_0x46ef('0x43')));router['get'](_0x46ef('0x44'),auth['isAuthenticated'](),controller['showSmsQueues']);router[_0x46ef('0x6')]('/whatsapp/queues/:id',auth[_0x46ef('0x8')](),controller['showWhatsappQueues']);router[_0x46ef('0x3a')](_0x46ef('0x45'),auth[_0x46ef('0x8')](),controller[_0x46ef('0x46')]);module[_0x46ef('0x47')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 9155cda..f9039c4 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 _0x032e=['MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','queue_id','uniq','value','filter','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','findOne','Interaction','update','queue','MessageId','InteractionId','From','TransferReport','agentNotify','Channel\x20field\x20is\x20mandatory','channel','Agent\x20not\x20found','Message','\x20Message\x20not\x20found','create','Start','bluebird','lodash','util','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','params','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesChannels','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','format','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x032e,0x124));var _0xe032=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x032e[_0x5447fd];return _0x15b28a;};'use strict';var BPromise=require(_0xe032('0x0'));var moment=require('moment');var _=require(_0xe032('0x1'));var util=require(_0xe032('0x2'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xe032('0x3'));var jayson=require(_0xe032('0x4'));var amiClient=jayson[_0xe032('0x5')][_0xe032('0x6')]({'port':0x232a});var mailClient=jayson[_0xe032('0x5')][_0xe032('0x6')]({'port':0x232b});var routingClient=jayson[_0xe032('0x5')][_0xe032('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x37432f,_0x1576c8,_0x3289b0){return new BPromise(function(_0xd84027,_0xaf3907){var _0x3b0ef8=_0x3289b0?_0x3289b0:amiClient;return _0x3b0ef8[_0xe032('0x7')](_0x37432f,_0x1576c8)[_0xe032('0x8')](function(_0x2dc9e5){if(_0x2dc9e5[_0xe032('0x9')]){if(_0x2dc9e5['error'][_0xe032('0xa')]===0x1f4){return _0xaf3907(_0x2dc9e5[_0xe032('0x9')][_0xe032('0xb')]);}return _0xd84027(_0x2dc9e5[_0xe032('0x9')][_0xe032('0xb')]);}else{_0xd84027(_0x2dc9e5[_0xe032('0xc')]);}})[_0xe032('0xd')](function(_0x5bcb5b){_0xaf3907(_0x5bcb5b);});});}function respondWithResult(_0x646979,_0x266d71){_0x266d71=_0x266d71||0xc8;return function(_0x28c2b6){if(_0x28c2b6){return _0x646979[_0xe032('0xe')](_0x266d71)['json'](_0x28c2b6);}return _0x646979[_0xe032('0xf')](0x194);};}function handleError(_0x2e267b,_0x176547){_0x176547=_0x176547||0x1f4;return function(_0x422e96){logger[_0xe032('0x9')](_0x422e96[_0xe032('0x10')]);if(_0x422e96[_0xe032('0x11')]){delete _0x422e96['name'];}_0x2e267b[_0xe032('0xe')](_0x176547)[_0xe032('0x12')](_0x422e96);};}function findById(_0x36fb7c){return function(_0x3b57d3){if(!_[_0xe032('0x13')](_0x36fb7c)&&!_[_0xe032('0x13')](_0x3b57d3)&&!_['isNil'](_0x3b57d3[_0xe032('0x14')])){return _[_0xe032('0x15')](_0x3b57d3[_0xe032('0x14')],function(_0x41d2a5){return _0x41d2a5['id']==_0x36fb7c;});}return null;};}exports[_0xe032('0x16')]=function(_0x5721ce,_0x4b644b){return respondWithRpcPromise('VoiceChannels',_0x5721ce[_0xe032('0x17')])['then'](respondWithResult(_0x4b644b,null))[_0xe032('0xd')](handleError(_0x4b644b,null));};exports[_0xe032('0x18')]=function(_0x3f0257,_0x2aa342){return respondWithRpcPromise(_0xe032('0x19'),_[_0xe032('0x1a')](_0x3f0257[_0xe032('0x17')],_0x3f0257['params']))[_0xe032('0x8')](respondWithResult(_0x2aa342,null))[_0xe032('0xd')](handleError(_0x2aa342,null));};exports[_0xe032('0x1b')]=function(_0x2be433,_0x2ca592){return respondWithRpcPromise(_0xe032('0x1c'),_[_0xe032('0x1a')](_0x2be433[_0xe032('0x17')],_0x2be433['params']))['then'](respondWithResult(_0x2ca592,null))['catch'](handleError(_0x2ca592,null));};exports[_0xe032('0x1d')]=function(_0x2568ce,_0x302559){return respondWithRpcPromise(_0xe032('0x1e'),_0x2568ce[_0xe032('0x17')])[_0xe032('0x8')](respondWithResult(_0x302559,null))[_0xe032('0xd')](handleError(_0x302559,null));};exports[_0xe032('0x1f')]=function(_0x4dcbf1,_0x1ac20b){return respondWithRpcPromise('VoiceQueues',_0x4dcbf1[_0xe032('0x17')])[_0xe032('0x8')](findById(_0x4dcbf1[_0xe032('0x20')]['id']))[_0xe032('0x8')](respondWithResult(_0x1ac20b,null))['catch'](handleError(_0x1ac20b,null));};exports['updateVoiceQueue']=function(_0x3e2575,_0x38e7ea){return respondWithRpcPromise(_0xe032('0x21'),_[_0xe032('0x1a')](_0x3e2575['body'],_0x3e2575['params']))['then'](respondWithResult(_0x38e7ea,null))[_0xe032('0xd')](handleError(_0x38e7ea,null));};exports[_0xe032('0x22')]=function(_0x5518ac,_0x707b){return respondWithRpcPromise('VoiceQueuesPreview',_[_0xe032('0x1a')](_0x5518ac[_0xe032('0x17')],_0x5518ac[_0xe032('0x20')]))[_0xe032('0x8')](respondWithResult(_0x707b,null))[_0xe032('0xd')](handleError(_0x707b,null));};exports['voiceQueuesChannels']=function(_0xd90bd5,_0x33634c){return respondWithRpcPromise(_0xe032('0x23'),_0xd90bd5[_0xe032('0x17')])['then'](respondWithResult(_0x33634c,null))[_0xe032('0xd')](handleError(_0x33634c,null));};exports['voiceQueuesChannel']=function(_0x2f3e59,_0x53df28){return respondWithRpcPromise(_0xe032('0x24'),_['merge'](_0x2f3e59[_0xe032('0x17')],_0x2f3e59['params']))[_0xe032('0x8')](respondWithResult(_0x53df28,null))[_0xe032('0xd')](handleError(_0x53df28,null));};exports['voiceQueuesChannelHangup']=function(_0x3e3598,_0x2fdf41){return respondWithRpcPromise(_0xe032('0x25'),_[_0xe032('0x1a')](_0x3e3598['query'],_0x3e3598[_0xe032('0x20')]))['then'](respondWithResult(_0x2fdf41,null))[_0xe032('0xd')](handleError(_0x2fdf41,null));};exports[_0xe032('0x26')]=function(_0x5d02c1,_0x450ba4){return respondWithRpcPromise(_0xe032('0x27'),_['merge'](_0x5d02c1[_0xe032('0x17')],_0x5d02c1[_0xe032('0x20')]))[_0xe032('0x8')](respondWithResult(_0x450ba4,null))[_0xe032('0xd')](handleError(_0x450ba4,null));};exports[_0xe032('0x28')]=function(_0x42f58a,_0x19ee0a){return respondWithRpcPromise(_0xe032('0x29'),_0x42f58a[_0xe032('0x17')])[_0xe032('0x8')](respondWithResult(_0x19ee0a,null))[_0xe032('0xd')](handleError(_0x19ee0a,null));};exports[_0xe032('0x2a')]=function(_0x30571c,_0x28ba5d){return respondWithRpcPromise(_0xe032('0x2b'),_0x30571c[_0xe032('0x17')])[_0xe032('0x8')](respondWithResult(_0x28ba5d,null))['catch'](handleError(_0x28ba5d,null));};exports[_0xe032('0x2c')]=function(_0x536c76,_0x3d02c1){var _0x2bcfb4;return respondWithRpcPromise(_0xe032('0x2d'),_0x536c76[_0xe032('0x17')])[_0xe032('0x8')](function(_0x5eccad){_0x2bcfb4=_0x5eccad;return respondWithRpcPromise(_0xe032('0x2d'),_0x536c76['query'],routingClient);})[_0xe032('0x8')](function(_0x590be2){return _[_0xe032('0x1a')]({},_0x590be2,_0x2bcfb4);})[_0xe032('0x8')](respondWithResult(_0x3d02c1,null))[_0xe032('0xd')](handleError(_0x3d02c1,null));};exports[_0xe032('0x2e')]=function(_0x4dc836,_0x477360){if(_0x4dc836['body']&&_0x4dc836[_0xe032('0x2f')][_0xe032('0x30')]&&_0x4dc836[_0xe032('0x31')]&&_0x4dc836[_0xe032('0x31')]['name']){for(var _0x513b0c in _0x4dc836[_0xe032('0x2f')][_0xe032('0x30')]){if(_0x4dc836['body'][_0xe032('0x30')][_0xe032('0x32')](_0x513b0c)){db[_0xe032('0x33')][_0xe032('0x34')]({'where':{'channel':_0x513b0c,'membername':_0x4dc836[_0xe032('0x31')]['name'],'type':_0xe032('0x35'),'exitAt':null,'uniqueid':_0x4dc836[_0xe032('0x2f')][_0xe032('0x30')][_0x513b0c]&&_0x4dc836[_0xe032('0x2f')][_0xe032('0x30')][_0x513b0c][_0xe032('0x36')]?{'$notIn':_0x4dc836[_0xe032('0x2f')][_0xe032('0x30')][_0x513b0c]}:{'$ne':null}}})['then'](function(_0x535f34){var _0x1b0e28=moment()['format'](_0xe032('0x37'));for(var _0x277207=0x0,_0x1873a6=_0x535f34[_0xe032('0x36')];_0x277207<_0x1873a6;_0x277207+=0x1){_0x535f34[_0x277207][_0xe032('0x38')]({'exitAt':_0x1b0e28});}});for(var _0x3dfb51=0x0;_0x3dfb51<_0x4dc836[_0xe032('0x2f')][_0xe032('0x30')][_0x513b0c][_0xe032('0x36')];_0x3dfb51+=0x1){db['MemberReport'][_0xe032('0x39')]({'where':{'channel':_0x513b0c,'membername':_0x4dc836['user']['name'],'type':_0xe032('0x35'),'uniqueid':_0x4dc836[_0xe032('0x2f')][_0xe032('0x30')][_0x513b0c][_0x3dfb51],'exitAt':null},'defaults':{'channel':_0x513b0c,'membername':_0x4dc836[_0xe032('0x31')]['name'],'interface':_[_0xe032('0x13')](_0x4dc836[_0xe032('0x31')][_0xe032('0x3a')])?util[_0xe032('0x3b')](_0xe032('0x3c'),_0x4dc836[_0xe032('0x31')][_0xe032('0x11')]):_0x4dc836['user'][_0xe032('0x3a')],'type':_0xe032('0x35'),'enterAt':moment()['format'](_0xe032('0x37')),'role':_0xe032('0x3d'),'internal':_0x4dc836[_0xe032('0x31')][_0xe032('0x3e')],'uniqueid':_0x4dc836[_0xe032('0x2f')][_0xe032('0x30')][_0x513b0c][_0x3dfb51]}});}}}}return respondWithRpcPromise(_0xe032('0x3f'),{'id':_0x4dc836[_0xe032('0x20')]['id'],'capacity':_0x4dc836[_0xe032('0x2f')][_0xe032('0x40')]},routingClient)[_0xe032('0x8')](respondWithResult(_0x477360,null))[_0xe032('0xd')](handleError(_0x477360,null));};exports[_0xe032('0x41')]=function(_0x2f8114,_0x4eabfc){return respondWithRpcPromise(_0xe032('0x42'),_0x2f8114['query'])[_0xe032('0x8')](respondWithResult(_0x4eabfc,null))[_0xe032('0xd')](handleError(_0x4eabfc,null));};exports[_0xe032('0x43')]=function(_0x11ae58,_0x41289d){return respondWithRpcPromise(_0xe032('0x44'),_0x11ae58[_0xe032('0x17')])[_0xe032('0x8')](respondWithResult(_0x41289d,null))[_0xe032('0xd')](handleError(_0x41289d,null));};exports[_0xe032('0x45')]=function(_0x1b9012,_0x564fe0){return respondWithRpcPromise(_0xe032('0x46'),_0x1b9012[_0xe032('0x17')])['then'](respondWithResult(_0x564fe0,null))[_0xe032('0xd')](handleError(_0x564fe0,null));};exports['chatQueues']=function(_0x39b878,_0x1f2422){return respondWithRpcPromise(_0xe032('0x47'),_0x39b878[_0xe032('0x17')],routingClient)[_0xe032('0x8')](respondWithResult(_0x1f2422,null))['catch'](handleError(_0x1f2422,null));};exports[_0xe032('0x48')]=function(_0x2dbc33,_0x1e1277){return respondWithRpcPromise(_0xe032('0x47'),_0x2dbc33[_0xe032('0x17')],routingClient)[_0xe032('0x8')](findById(_0x2dbc33[_0xe032('0x20')]['id']))['then'](respondWithResult(_0x1e1277,null))[_0xe032('0xd')](handleError(_0x1e1277,null));};exports[_0xe032('0x49')]=function(_0x454b29,_0x15325e){return respondWithRpcPromise(_0xe032('0x4a'),_0x454b29[_0xe032('0x17')],routingClient)[_0xe032('0x8')](respondWithResult(_0x15325e,null))[_0xe032('0xd')](handleError(_0x15325e,null));};exports[_0xe032('0x4b')]=function(_0x54c0b0,_0x795a58){return respondWithRpcPromise(_0xe032('0x4a'),_0x54c0b0[_0xe032('0x17')],routingClient)['then'](findById(_0x54c0b0[_0xe032('0x20')]['id']))[_0xe032('0x8')](respondWithResult(_0x795a58,null))['catch'](handleError(_0x795a58,null));};exports[_0xe032('0x4c')]=function(_0x29dfa7,_0x43ad0d){return respondWithRpcPromise(_0xe032('0x4d'),_0x29dfa7[_0xe032('0x17')],mailClient)[_0xe032('0x8')](respondWithResult(_0x43ad0d,null))[_0xe032('0xd')](handleError(_0x43ad0d,null));};exports[_0xe032('0x4e')]=function(_0x1aa18e,_0x19ce2b){return respondWithRpcPromise(_0xe032('0x4f'),_0x1aa18e['query'],routingClient)[_0xe032('0x8')](respondWithResult(_0x19ce2b,null))[_0xe032('0xd')](handleError(_0x19ce2b,null));};exports[_0xe032('0x50')]=function(_0xd5cf55,_0x3d7a3f){return respondWithRpcPromise('OpenchannelQueues',_0xd5cf55[_0xe032('0x17')],routingClient)['then'](findById(_0xd5cf55[_0xe032('0x20')]['id']))[_0xe032('0x8')](respondWithResult(_0x3d7a3f,null))[_0xe032('0xd')](handleError(_0x3d7a3f,null));};exports[_0xe032('0x51')]=function(_0x3c5eb8,_0x1ddb11){return respondWithRpcPromise(_0xe032('0x52'),_0x3c5eb8[_0xe032('0x17')],routingClient)[_0xe032('0x8')](respondWithResult(_0x1ddb11,null))['catch'](handleError(_0x1ddb11,null));};exports['showSmsQueues']=function(_0x5c516a,_0x221473){return respondWithRpcPromise(_0xe032('0x52'),_0x5c516a[_0xe032('0x17')],routingClient)[_0xe032('0x8')](findById(_0x5c516a[_0xe032('0x20')]['id']))[_0xe032('0x8')](respondWithResult(_0x221473,null))['catch'](handleError(_0x221473,null));};exports[_0xe032('0x53')]=function(_0x1d66c3,_0x1018d4){return respondWithRpcPromise('WhatsappQueues',_0x1d66c3[_0xe032('0x17')],routingClient)['then'](respondWithResult(_0x1018d4,null))[_0xe032('0xd')](handleError(_0x1018d4,null));};exports[_0xe032('0x54')]=function(_0x48063d,_0x590905){return respondWithRpcPromise('WhatsappQueues',_0x48063d[_0xe032('0x17')],routingClient)['then'](findById(_0x48063d['params']['id']))[_0xe032('0x8')](respondWithResult(_0x590905,null))[_0xe032('0xd')](handleError(_0x590905,null));};exports[_0xe032('0x55')]=function(_0x4ed078,_0x193a0f){return respondWithRpcPromise('FaxQueues',_0x4ed078[_0xe032('0x17')],routingClient)[_0xe032('0x8')](respondWithResult(_0x193a0f,null))[_0xe032('0xd')](handleError(_0x193a0f,null));};exports[_0xe032('0x56')]=function(_0x1f24ec,_0x2b987b){return respondWithRpcPromise(_0xe032('0x57'),_0x1f24ec[_0xe032('0x17')],routingClient)[_0xe032('0x8')](findById(_0x1f24ec[_0xe032('0x20')]['id']))[_0xe032('0x8')](respondWithResult(_0x2b987b,null))['catch'](handleError(_0x2b987b,null));};exports[_0xe032('0x58')]=function(_0x338ef2,_0x5aa7a6){return respondWithRpcPromise('FaxAccounts',_0x338ef2[_0xe032('0x17')])[_0xe032('0x8')](respondWithResult(_0x5aa7a6,null))[_0xe032('0xd')](handleError(_0x5aa7a6,null));};exports[_0xe032('0x59')]=function(_0x1e38bd,_0x23922e){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x1e38bd[_0xe032('0x17')],routingClient)[_0xe032('0x8')](respondWithResult(_0x23922e,null))['catch'](handleError(_0x23922e,null));};exports[_0xe032('0x5a')]=function(_0x2ea4a5,_0x1c3601){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x2ea4a5[_0xe032('0x17')],routingClient)[_0xe032('0x8')](respondWithResult(_0x1c3601,null))[_0xe032('0xd')](handleError(_0x1c3601,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x52dfa0,_0xdd691c){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x52dfa0[_0xe032('0x17')],routingClient)[_0xe032('0x8')](respondWithResult(_0xdd691c,null))[_0xe032('0xd')](handleError(_0xdd691c,null));};exports[_0xe032('0x5b')]=function(_0x37af62,_0x443fcc){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x37af62[_0xe032('0x17')],routingClient)[_0xe032('0x8')](function(_0x33e7c3){if(_0x37af62['query'][_0xe032('0x5c')]!==undefined){var _0x48e9c9=_(_0x33e7c3[_0xe032('0x14')])['filter']([_0x37af62[_0xe032('0x17')][_0xe032('0x5c')],_0x37af62[_0xe032('0x20')]['id']])['map'](_0xe032('0x5d'))[_0xe032('0x5e')]()[_0xe032('0x5f')]();return _0x33e7c3[_0xe032('0x14')][_0xe032('0x60')](function(_0x2a2c98){return _0x48e9c9['indexOf'](_0x2a2c98[_0xe032('0x5d')])>-0x1;});}else{return _0x33e7c3[_0xe032('0x14')]['filter'](function(_0x50fd01){return _0x50fd01[_0xe032('0x5d')]===parseInt(_0x37af62[_0xe032('0x20')]['id']);});}})[_0xe032('0x8')](respondWithResult(_0x443fcc,null))[_0xe032('0xd')](handleError(_0x443fcc,null));};exports[_0xe032('0x61')]=function(_0x54803e,_0x3a04b9){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x54803e[_0xe032('0x17')],routingClient)['then'](respondWithResult(_0x3a04b9,null))[_0xe032('0xd')](handleError(_0x3a04b9,null));};exports[_0xe032('0x62')]=function(_0x36137b,_0x2ecdc7){return respondWithRpcPromise(_0xe032('0x63'),_0x36137b[_0xe032('0x17')],routingClient)['then'](respondWithResult(_0x2ecdc7,null))[_0xe032('0xd')](handleError(_0x2ecdc7,null));};exports['faxQueuesWaitingInteractions']=function(_0x4ee54a,_0x485458){return respondWithRpcPromise(_0xe032('0x64'),_0x4ee54a[_0xe032('0x17')],routingClient)['then'](respondWithResult(_0x485458,null))[_0xe032('0xd')](handleError(_0x485458,null));};exports['queueNotify']=function(_0x5f42b1){return function(_0x2f2b74,_0x10873b){var _0x577f56,_0x4ab179;var _0x45e28d=_[_0xe032('0x65')](_0x5f42b1);var _0x51d89a=_0x5f42b1===_0xe032('0x66')?_0xe032('0x67'):_0xe032('0x68');return db[_0x45e28d+_0xe032('0x69')]['findOne']({'raw':!![],'where':{'id':_0x2f2b74[_0xe032('0x20')]['id']}})['then'](function(_0x1caebf){if(_[_0xe032('0x13')](_0x1caebf)){throw new Error(_0x45e28d+_0xe032('0x6a'));}_0x577f56=_0x1caebf;return db[_0x45e28d+'Message'][_0xe032('0x6b')]({'where':{'id':_0x2f2b74[_0xe032('0x2f')]['messageId']},'include':[{'model':db[_0x45e28d+_0xe032('0x6c')],'as':_0xe032('0x6c')},{'model':db[_0x45e28d+_0x51d89a],'as':_0xe032('0x68')}]});})[_0xe032('0x8')](function(_0x3c1b08){if(_[_0xe032('0x13')](_0x3c1b08)){throw new Error(_0x45e28d+'\x20Message\x20not\x20found');}_0x4ab179=_0x3c1b08;return _0x3c1b08[_0xe032('0x6d')]({'read':0x0,'readAt':null,'UserId':null});})[_0xe032('0x8')](function(){var _0x27eb0c={'uniqueid':_0x5f42b1+'.'+_0x4ab179['id']+'.'+_0x4ab179[_0xe032('0x6c')]['id'],'FromUserId':_0x2f2b74[_0xe032('0x31')]['id'],'type':_0xe032('0x6e')};_0x27eb0c[_0x45e28d+_0xe032('0x6f')]=_0x4ab179['id'];_0x27eb0c[_0x45e28d+_0xe032('0x70')]=_0x4ab179[_0xe032('0x6c')]['id'];_0x27eb0c[_0xe032('0x71')+_0x45e28d+_0x51d89a+'Id']=_0x4ab179[_0xe032('0x68')]['id'];_0x27eb0c['To'+_0x45e28d+'QueueId']=_0x577f56['id'];return db[_0x45e28d+_0xe032('0x72')]['create'](_0x27eb0c);})[_0xe032('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x5f42b1,'interaction':_0x4ab179[_0xe032('0x6c')],'message':_0x4ab179,'account':_0x4ab179[_0xe032('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x577f56[_0xe032('0x11')]+','+(_0x4ab179['Account']['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xe032('0x8')](respondWithResult(_0x10873b,null))[_0xe032('0xd')](handleError(_0x10873b,null));};};exports[_0xe032('0x73')]=function(_0x4e9f83,_0x210e7a){var _0x2e6dad,_0x2d68aa;if(_['isNil'](_0x4e9f83[_0xe032('0x2f')]['channel'])){throw new Error(_0xe032('0x74'));}var _0x868fad=_0x4e9f83[_0xe032('0x2f')][_0xe032('0x75')];var _0x3ee725=_[_0xe032('0x65')](_0x868fad);var _0x205058=_0x868fad===_0xe032('0x66')?_0xe032('0x67'):_0xe032('0x68');return db['User']['findOne']({'raw':!![],'where':{'id':_0x4e9f83[_0xe032('0x20')]['id'],'role':_0xe032('0x3d')}})[_0xe032('0x8')](function(_0x1d9498){if(_['isNil'](_0x1d9498)){throw new Error(_0xe032('0x76'));}_0x2e6dad=_0x1d9498;return db[_0x3ee725+_0xe032('0x77')][_0xe032('0x6b')]({'where':{'id':_0x4e9f83[_0xe032('0x2f')]['messageId']},'include':[{'model':db[_0x3ee725+_0xe032('0x6c')],'as':_0xe032('0x6c')},{'model':db[_0x3ee725+_0x205058],'as':_0xe032('0x68')}]});})[_0xe032('0x8')](function(_0x3cf0bc){if(_[_0xe032('0x13')](_0x3cf0bc)){throw new Error(_0x3ee725+_0xe032('0x78'));}_0x2d68aa=_0x3cf0bc;return _0x3cf0bc['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x56523f={'uniqueid':_0x868fad+'.'+_0x2d68aa['id']+'.'+_0x2d68aa['Interaction']['id'],'FromUserId':_0x4e9f83['user']['id'],'type':_0xe032('0x6e'),'ToUserId':_0x2e6dad['id']};_0x56523f[_0x3ee725+_0xe032('0x6f')]=_0x2d68aa['id'];_0x56523f[_0x3ee725+_0xe032('0x70')]=_0x2d68aa[_0xe032('0x6c')]['id'];_0x56523f[_0xe032('0x71')+_0x3ee725+_0x205058+'Id']=_0x2d68aa['Account']['id'];return db[_0x3ee725+_0xe032('0x72')][_0xe032('0x79')](_0x56523f);})[_0xe032('0x8')](function(){return respondWithRpcPromise(_0xe032('0x7a'),{'channel':_0x868fad,'interaction':_0x2d68aa[_0xe032('0x6c')],'message':_0x2d68aa,'account':_0x2d68aa[_0xe032('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0xe032('0x3d'),'appdata':_0x2e6dad[_0xe032('0x11')]+','+(_0x2d68aa[_0xe032('0x68')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x210e7a,null))[_0xe032('0xd')](handleError(_0x210e7a,null));}; \ No newline at end of file +var _0x3e74=['http','client','then','error','code','message','result','sendStatus','stack','name','status','isNil','find','rows','voiceChannels','VoiceChannels','query','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','user','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','showFaxQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','MessageId','From','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','InteractionId','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','jayson/promise'];(function(_0x5ccd50,_0x176554){var _0xc67e2d=function(_0x10841a){while(--_0x10841a){_0x5ccd50['push'](_0x5ccd50['shift']());}};_0xc67e2d(++_0x176554);}(_0x3e74,0x175));var _0x43e7=function(_0x585b20,_0x407bcd){_0x585b20=_0x585b20-0x0;var _0x38567a=_0x3e74[_0x585b20];return _0x38567a;};'use strict';var BPromise=require(_0x43e7('0x0'));var moment=require('moment');var _=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var db=require(_0x43e7('0x3'))['db'];var logger=require('../../config/logger')('api');var jayson=require(_0x43e7('0x4'));var amiClient=jayson['client'][_0x43e7('0x5')]({'port':0x232a});var mailClient=jayson[_0x43e7('0x6')][_0x43e7('0x5')]({'port':0x232b});var routingClient=jayson[_0x43e7('0x6')][_0x43e7('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){var _0x21f491=_0x3491d6?_0x3491d6:amiClient;return _0x21f491['request'](_0x503698,_0x45a0d1)[_0x43e7('0x7')](function(_0x554d44){if(_0x554d44['error']){if(_0x554d44[_0x43e7('0x8')][_0x43e7('0x9')]===0x1f4){return _0x8528fc(_0x554d44['error'][_0x43e7('0xa')]);}return _0x2ede2d(_0x554d44['error'][_0x43e7('0xa')]);}else{_0x2ede2d(_0x554d44[_0x43e7('0xb')]);}})['catch'](function(_0x3eb206){_0x8528fc(_0x3eb206);});});}function respondWithResult(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xc8;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['status'](_0x2718d3)['json'](_0x3bb83f);}return _0xc960ea[_0x43e7('0xc')](0x194);};}function handleError(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0x1f4;return function(_0x51b974){logger['error'](_0x51b974[_0x43e7('0xd')]);if(_0x51b974[_0x43e7('0xe')]){delete _0x51b974[_0x43e7('0xe')];}_0x21fdd3[_0x43e7('0xf')](_0x44b0bd)['send'](_0x51b974);};}function findById(_0x5c4eaa){return function(_0xdf16c){if(!_[_0x43e7('0x10')](_0x5c4eaa)&&!_[_0x43e7('0x10')](_0xdf16c)&&!_['isNil'](_0xdf16c['rows'])){return _[_0x43e7('0x11')](_0xdf16c[_0x43e7('0x12')],function(_0x9037d3){return _0x9037d3['id']==_0x5c4eaa;});}return null;};}exports[_0x43e7('0x13')]=function(_0x3776f5,_0x1f24fb){return respondWithRpcPromise(_0x43e7('0x14'),_0x3776f5[_0x43e7('0x15')])[_0x43e7('0x7')](respondWithResult(_0x1f24fb,null))[_0x43e7('0x16')](handleError(_0x1f24fb,null));};exports[_0x43e7('0x17')]=function(_0x177ee1,_0x4b5d64){return respondWithRpcPromise(_0x43e7('0x18'),_[_0x43e7('0x19')](_0x177ee1['query'],_0x177ee1[_0x43e7('0x1a')]))[_0x43e7('0x7')](respondWithResult(_0x4b5d64,null))[_0x43e7('0x16')](handleError(_0x4b5d64,null));};exports[_0x43e7('0x1b')]=function(_0x4077fb,_0x2f4cb4){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x43e7('0x19')](_0x4077fb['query'],_0x4077fb['params']))[_0x43e7('0x7')](respondWithResult(_0x2f4cb4,null))[_0x43e7('0x16')](handleError(_0x2f4cb4,null));};exports['voiceQueues']=function(_0x1f0673,_0x4ca5cf){return respondWithRpcPromise(_0x43e7('0x1c'),_0x1f0673['query'])[_0x43e7('0x7')](respondWithResult(_0x4ca5cf,null))[_0x43e7('0x16')](handleError(_0x4ca5cf,null));};exports[_0x43e7('0x1d')]=function(_0x405f85,_0x51f4d7){return respondWithRpcPromise('VoiceQueues',_0x405f85[_0x43e7('0x15')])['then'](findById(_0x405f85[_0x43e7('0x1a')]['id']))[_0x43e7('0x7')](respondWithResult(_0x51f4d7,null))[_0x43e7('0x16')](handleError(_0x51f4d7,null));};exports[_0x43e7('0x1e')]=function(_0x5087d7,_0x33a1a5){return respondWithRpcPromise(_0x43e7('0x1f'),_[_0x43e7('0x19')](_0x5087d7[_0x43e7('0x20')],_0x5087d7[_0x43e7('0x1a')]))[_0x43e7('0x7')](respondWithResult(_0x33a1a5,null))[_0x43e7('0x16')](handleError(_0x33a1a5,null));};exports[_0x43e7('0x21')]=function(_0x3bf475,_0x35dbcd){return respondWithRpcPromise(_0x43e7('0x22'),_[_0x43e7('0x19')](_0x3bf475[_0x43e7('0x15')],_0x3bf475[_0x43e7('0x1a')]))['then'](respondWithResult(_0x35dbcd,null))[_0x43e7('0x16')](handleError(_0x35dbcd,null));};exports[_0x43e7('0x23')]=function(_0x3b8f78,_0x183c81){return respondWithRpcPromise(_0x43e7('0x24'),_0x3b8f78['query'])[_0x43e7('0x7')](respondWithResult(_0x183c81,null))[_0x43e7('0x16')](handleError(_0x183c81,null));};exports[_0x43e7('0x25')]=function(_0x3f280d,_0x4c61b9){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x3f280d[_0x43e7('0x15')],_0x3f280d[_0x43e7('0x1a')]))[_0x43e7('0x7')](respondWithResult(_0x4c61b9,null))[_0x43e7('0x16')](handleError(_0x4c61b9,null));};exports[_0x43e7('0x26')]=function(_0xde7ed,_0x485c6c){return respondWithRpcPromise('VoiceQueuesChannelHangup',_['merge'](_0xde7ed['query'],_0xde7ed['params']))['then'](respondWithResult(_0x485c6c,null))['catch'](handleError(_0x485c6c,null));};exports[_0x43e7('0x27')]=function(_0x49cda6,_0x2b4bfd){return respondWithRpcPromise(_0x43e7('0x28'),_[_0x43e7('0x19')](_0x49cda6[_0x43e7('0x15')],_0x49cda6[_0x43e7('0x1a')]))[_0x43e7('0x7')](respondWithResult(_0x2b4bfd,null))[_0x43e7('0x16')](handleError(_0x2b4bfd,null));};exports['outbound']=function(_0x5332d9,_0x5d84f4){return respondWithRpcPromise(_0x43e7('0x29'),_0x5332d9[_0x43e7('0x15')])[_0x43e7('0x7')](respondWithResult(_0x5d84f4,null))[_0x43e7('0x16')](handleError(_0x5d84f4,null));};exports[_0x43e7('0x2a')]=function(_0x1ed538,_0x1d4589){return respondWithRpcPromise(_0x43e7('0x2b'),_0x1ed538['query'])[_0x43e7('0x7')](respondWithResult(_0x1d4589,null))[_0x43e7('0x16')](handleError(_0x1d4589,null));};exports['agents']=function(_0x2d54c1,_0x4c0c7a){var _0x44d8e4;return respondWithRpcPromise(_0x43e7('0x2c'),_0x2d54c1[_0x43e7('0x15')])[_0x43e7('0x7')](function(_0x35ac85){_0x44d8e4=_0x35ac85;return respondWithRpcPromise(_0x43e7('0x2c'),_0x2d54c1['query'],routingClient);})['then'](function(_0x30dfa9){return _[_0x43e7('0x19')]({},_0x30dfa9,_0x44d8e4);})[_0x43e7('0x7')](respondWithResult(_0x4c0c7a,null))[_0x43e7('0x16')](handleError(_0x4c0c7a,null));};exports[_0x43e7('0x2d')]=function(_0x4a4a85,_0x32a451){if(_0x4a4a85[_0x43e7('0x20')]&&_0x4a4a85['body'][_0x43e7('0x2e')]&&_0x4a4a85['user']&&_0x4a4a85[_0x43e7('0x2f')]['name']){for(var _0x3d81ae in _0x4a4a85[_0x43e7('0x20')][_0x43e7('0x2e')]){if(_0x4a4a85[_0x43e7('0x20')]['interaction']['hasOwnProperty'](_0x3d81ae)){db[_0x43e7('0x30')][_0x43e7('0x31')]({'where':{'channel':_0x3d81ae,'membername':_0x4a4a85[_0x43e7('0x2f')][_0x43e7('0xe')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x4a4a85['body']['interaction'][_0x3d81ae]&&_0x4a4a85[_0x43e7('0x20')]['interaction'][_0x3d81ae][_0x43e7('0x32')]?{'$notIn':_0x4a4a85['body']['interaction'][_0x3d81ae]}:{'$ne':null}}})[_0x43e7('0x7')](function(_0x5ee1c5){var _0x2de14f=moment()[_0x43e7('0x33')](_0x43e7('0x34'));for(var _0x99b9e1=0x0,_0x4fc5e8=_0x5ee1c5[_0x43e7('0x32')];_0x99b9e1<_0x4fc5e8;_0x99b9e1+=0x1){_0x5ee1c5[_0x99b9e1][_0x43e7('0x35')]({'exitAt':_0x2de14f});}});for(var _0x23a611=0x0;_0x23a611<_0x4a4a85[_0x43e7('0x20')][_0x43e7('0x2e')][_0x3d81ae][_0x43e7('0x32')];_0x23a611+=0x1){db['MemberReport']['findOrCreate']({'where':{'channel':_0x3d81ae,'membername':_0x4a4a85[_0x43e7('0x2f')][_0x43e7('0xe')],'type':_0x43e7('0x36'),'uniqueid':_0x4a4a85['body']['interaction'][_0x3d81ae][_0x23a611],'exitAt':null},'defaults':{'channel':_0x3d81ae,'membername':_0x4a4a85['user'][_0x43e7('0xe')],'interface':_[_0x43e7('0x10')](_0x4a4a85['user'][_0x43e7('0x37')])?util[_0x43e7('0x33')](_0x43e7('0x38'),_0x4a4a85['user']['name']):_0x4a4a85['user']['interface'],'type':_0x43e7('0x36'),'enterAt':moment()[_0x43e7('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x43e7('0x39'),'internal':_0x4a4a85[_0x43e7('0x2f')][_0x43e7('0x3a')],'uniqueid':_0x4a4a85[_0x43e7('0x20')]['interaction'][_0x3d81ae][_0x23a611]}});}}}}return respondWithRpcPromise(_0x43e7('0x3b'),{'id':_0x4a4a85['params']['id'],'capacity':_0x4a4a85['body'][_0x43e7('0x3c')]},routingClient)[_0x43e7('0x7')](respondWithResult(_0x32a451,null))[_0x43e7('0x16')](handleError(_0x32a451,null));};exports[_0x43e7('0x3d')]=function(_0x13503c,_0x2351cf){return respondWithRpcPromise(_0x43e7('0x3e'),_0x13503c[_0x43e7('0x15')])[_0x43e7('0x7')](respondWithResult(_0x2351cf,null))[_0x43e7('0x16')](handleError(_0x2351cf,null));};exports['trunks']=function(_0x119d34,_0x46c910){return respondWithRpcPromise('Trunks',_0x119d34[_0x43e7('0x15')])['then'](respondWithResult(_0x46c910,null))[_0x43e7('0x16')](handleError(_0x46c910,null));};exports[_0x43e7('0x3f')]=function(_0x34e2ec,_0x1f561f){return respondWithRpcPromise(_0x43e7('0x40'),_0x34e2ec['query'])['then'](respondWithResult(_0x1f561f,null))[_0x43e7('0x16')](handleError(_0x1f561f,null));};exports[_0x43e7('0x41')]=function(_0x399942,_0x29c53d){return respondWithRpcPromise(_0x43e7('0x42'),_0x399942[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](respondWithResult(_0x29c53d,null))[_0x43e7('0x16')](handleError(_0x29c53d,null));};exports[_0x43e7('0x43')]=function(_0x24e758,_0x312306){return respondWithRpcPromise('ChatQueues',_0x24e758[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](findById(_0x24e758['params']['id']))[_0x43e7('0x7')](respondWithResult(_0x312306,null))[_0x43e7('0x16')](handleError(_0x312306,null));};exports[_0x43e7('0x44')]=function(_0x558d54,_0x5d63c6){return respondWithRpcPromise(_0x43e7('0x45'),_0x558d54[_0x43e7('0x15')],routingClient)['then'](respondWithResult(_0x5d63c6,null))[_0x43e7('0x16')](handleError(_0x5d63c6,null));};exports['showMailQueues']=function(_0x49a6ce,_0x1fa3f6){return respondWithRpcPromise(_0x43e7('0x45'),_0x49a6ce[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](findById(_0x49a6ce[_0x43e7('0x1a')]['id']))['then'](respondWithResult(_0x1fa3f6,null))[_0x43e7('0x16')](handleError(_0x1fa3f6,null));};exports[_0x43e7('0x46')]=function(_0x4d89bd,_0x20283b){return respondWithRpcPromise(_0x43e7('0x47'),_0x4d89bd[_0x43e7('0x15')],mailClient)['then'](respondWithResult(_0x20283b,null))['catch'](handleError(_0x20283b,null));};exports['openchannelQueues']=function(_0x2ada55,_0x4058ce){return respondWithRpcPromise(_0x43e7('0x48'),_0x2ada55[_0x43e7('0x15')],routingClient)['then'](respondWithResult(_0x4058ce,null))['catch'](handleError(_0x4058ce,null));};exports[_0x43e7('0x49')]=function(_0x8b50bb,_0x140438){return respondWithRpcPromise(_0x43e7('0x48'),_0x8b50bb['query'],routingClient)[_0x43e7('0x7')](findById(_0x8b50bb[_0x43e7('0x1a')]['id']))[_0x43e7('0x7')](respondWithResult(_0x140438,null))[_0x43e7('0x16')](handleError(_0x140438,null));};exports[_0x43e7('0x4a')]=function(_0xd41e79,_0x4665db){return respondWithRpcPromise(_0x43e7('0x4b'),_0xd41e79[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](respondWithResult(_0x4665db,null))[_0x43e7('0x16')](handleError(_0x4665db,null));};exports['showSmsQueues']=function(_0x5f3824,_0x2b0711){return respondWithRpcPromise('SmsQueues',_0x5f3824['query'],routingClient)['then'](findById(_0x5f3824[_0x43e7('0x1a')]['id']))[_0x43e7('0x7')](respondWithResult(_0x2b0711,null))['catch'](handleError(_0x2b0711,null));};exports[_0x43e7('0x4c')]=function(_0x135791,_0x1d8438){return respondWithRpcPromise('WhatsappQueues',_0x135791[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](respondWithResult(_0x1d8438,null))[_0x43e7('0x16')](handleError(_0x1d8438,null));};exports[_0x43e7('0x4d')]=function(_0x2f43d7,_0x472a19){return respondWithRpcPromise(_0x43e7('0x4e'),_0x2f43d7['query'],routingClient)[_0x43e7('0x7')](findById(_0x2f43d7[_0x43e7('0x1a')]['id']))[_0x43e7('0x7')](respondWithResult(_0x472a19,null))['catch'](handleError(_0x472a19,null));};exports['faxQueues']=function(_0x30377a,_0x5c3ad8){return respondWithRpcPromise('FaxQueues',_0x30377a[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](respondWithResult(_0x5c3ad8,null))['catch'](handleError(_0x5c3ad8,null));};exports[_0x43e7('0x4f')]=function(_0x28b21d,_0x1e2fed){return respondWithRpcPromise(_0x43e7('0x50'),_0x28b21d[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](findById(_0x28b21d[_0x43e7('0x1a')]['id']))['then'](respondWithResult(_0x1e2fed,null))[_0x43e7('0x16')](handleError(_0x1e2fed,null));};exports[_0x43e7('0x51')]=function(_0x4e5956,_0x418213){return respondWithRpcPromise('FaxAccounts',_0x4e5956[_0x43e7('0x15')])[_0x43e7('0x7')](respondWithResult(_0x418213,null))[_0x43e7('0x16')](handleError(_0x418213,null));};exports[_0x43e7('0x52')]=function(_0x506361,_0x2d25b5){return respondWithRpcPromise(_0x43e7('0x53'),_0x506361[_0x43e7('0x15')],routingClient)['then'](respondWithResult(_0x2d25b5,null))[_0x43e7('0x16')](handleError(_0x2d25b5,null));};exports[_0x43e7('0x54')]=function(_0x219dc6,_0x703a30){return respondWithRpcPromise(_0x43e7('0x55'),_0x219dc6['query'],routingClient)[_0x43e7('0x7')](respondWithResult(_0x703a30,null))[_0x43e7('0x16')](handleError(_0x703a30,null));};exports[_0x43e7('0x56')]=function(_0x2499ef,_0x433d3c){return respondWithRpcPromise(_0x43e7('0x57'),_0x2499ef[_0x43e7('0x15')],routingClient)['then'](respondWithResult(_0x433d3c,null))['catch'](handleError(_0x433d3c,null));};exports[_0x43e7('0x58')]=function(_0x536477,_0x550036){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x536477[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](function(_0x230fda){if(_0x536477[_0x43e7('0x15')][_0x43e7('0x59')]!==undefined){var _0x1ae0c8=_(_0x230fda['rows'])[_0x43e7('0x5a')]([_0x536477[_0x43e7('0x15')][_0x43e7('0x59')],_0x536477['params']['id']])[_0x43e7('0x5b')](_0x43e7('0x5c'))[_0x43e7('0x5d')]()[_0x43e7('0x5e')]();return _0x230fda[_0x43e7('0x12')][_0x43e7('0x5a')](function(_0x1d4a29){return _0x1ae0c8[_0x43e7('0x5f')](_0x1d4a29['queue_id'])>-0x1;});}else{return _0x230fda['rows']['filter'](function(_0x156074){return _0x156074[_0x43e7('0x5c')]===parseInt(_0x536477['params']['id']);});}})[_0x43e7('0x7')](respondWithResult(_0x550036,null))[_0x43e7('0x16')](handleError(_0x550036,null));};exports[_0x43e7('0x60')]=function(_0x8e60f1,_0x5a5565){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x8e60f1['query'],routingClient)[_0x43e7('0x7')](respondWithResult(_0x5a5565,null))[_0x43e7('0x16')](handleError(_0x5a5565,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x58cbb7,_0x21adf7){return respondWithRpcPromise(_0x43e7('0x61'),_0x58cbb7[_0x43e7('0x15')],routingClient)['then'](respondWithResult(_0x21adf7,null))[_0x43e7('0x16')](handleError(_0x21adf7,null));};exports[_0x43e7('0x62')]=function(_0x401654,_0xb04082){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x401654[_0x43e7('0x15')],routingClient)['then'](respondWithResult(_0xb04082,null))[_0x43e7('0x16')](handleError(_0xb04082,null));};exports[_0x43e7('0x63')]=function(_0x24a168){return function(_0x90667c,_0xa7cb2c){var _0x45adef,_0x126133;var _0x5e8d4e=_[_0x43e7('0x64')](_0x24a168);var _0x40257e=_0x24a168===_0x43e7('0x65')?_0x43e7('0x66'):'Account';return db[_0x5e8d4e+'Queue']['findOne']({'raw':!![],'where':{'id':_0x90667c[_0x43e7('0x1a')]['id']}})['then'](function(_0x240f0d){if(_[_0x43e7('0x10')](_0x240f0d)){throw new Error(_0x5e8d4e+_0x43e7('0x67'));}_0x45adef=_0x240f0d;return db[_0x5e8d4e+_0x43e7('0x68')][_0x43e7('0x69')]({'where':{'id':_0x90667c[_0x43e7('0x20')][_0x43e7('0x6a')]},'include':[{'model':db[_0x5e8d4e+_0x43e7('0x6b')],'as':_0x43e7('0x6b')},{'model':db[_0x5e8d4e+_0x40257e],'as':_0x43e7('0x6c')}]});})[_0x43e7('0x7')](function(_0x5b3565){if(_[_0x43e7('0x10')](_0x5b3565)){throw new Error(_0x5e8d4e+_0x43e7('0x6d'));}_0x126133=_0x5b3565;return _0x5b3565[_0x43e7('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x43e7('0x7')](function(){var _0x206e54={'uniqueid':_0x24a168+'.'+_0x126133['id']+'.'+_0x126133['Interaction']['id'],'FromUserId':_0x90667c['user']['id'],'type':_0x43e7('0x6f')};_0x206e54[_0x5e8d4e+_0x43e7('0x70')]=_0x126133['id'];_0x206e54[_0x5e8d4e+'InteractionId']=_0x126133[_0x43e7('0x6b')]['id'];_0x206e54[_0x43e7('0x71')+_0x5e8d4e+_0x40257e+'Id']=_0x126133['Account']['id'];_0x206e54['To'+_0x5e8d4e+'QueueId']=_0x45adef['id'];return db[_0x5e8d4e+_0x43e7('0x72')][_0x43e7('0x73')](_0x206e54);})[_0x43e7('0x7')](function(){return respondWithRpcPromise(_0x43e7('0x74'),{'channel':_0x24a168,'interaction':_0x126133[_0x43e7('0x6b')],'message':_0x126133,'account':_0x126133['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x45adef[_0x43e7('0xe')]+','+(_0x126133[_0x43e7('0x6c')][_0x43e7('0x75')]||0x12c),'interval':_0x43e7('0x76')}]},routingClient);})['then'](respondWithResult(_0xa7cb2c,null))[_0x43e7('0x16')](handleError(_0xa7cb2c,null));};};exports[_0x43e7('0x77')]=function(_0x1ed590,_0x15ee83){var _0x5bc060,_0x3a4962;if(_[_0x43e7('0x10')](_0x1ed590[_0x43e7('0x20')][_0x43e7('0x78')])){throw new Error(_0x43e7('0x79'));}var _0x4ef289=_0x1ed590[_0x43e7('0x20')][_0x43e7('0x78')];var _0x509d8d=_[_0x43e7('0x64')](_0x4ef289);var _0x2ca6fb=_0x4ef289===_0x43e7('0x65')?_0x43e7('0x66'):'Account';return db[_0x43e7('0x7a')]['findOne']({'raw':!![],'where':{'id':_0x1ed590[_0x43e7('0x1a')]['id'],'role':_0x43e7('0x39')}})[_0x43e7('0x7')](function(_0x2614ff){if(_[_0x43e7('0x10')](_0x2614ff)){throw new Error(_0x43e7('0x7b'));}_0x5bc060=_0x2614ff;return db[_0x509d8d+_0x43e7('0x68')][_0x43e7('0x69')]({'where':{'id':_0x1ed590[_0x43e7('0x20')]['messageId']},'include':[{'model':db[_0x509d8d+_0x43e7('0x6b')],'as':_0x43e7('0x6b')},{'model':db[_0x509d8d+_0x2ca6fb],'as':_0x43e7('0x6c')}]});})[_0x43e7('0x7')](function(_0x56593f){if(_['isNil'](_0x56593f)){throw new Error(_0x509d8d+_0x43e7('0x6d'));}_0x3a4962=_0x56593f;return _0x56593f[_0x43e7('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x43e7('0x7')](function(){var _0x4d30f7={'uniqueid':_0x4ef289+'.'+_0x3a4962['id']+'.'+_0x3a4962[_0x43e7('0x6b')]['id'],'FromUserId':_0x1ed590['user']['id'],'type':'queue','ToUserId':_0x5bc060['id']};_0x4d30f7[_0x509d8d+'MessageId']=_0x3a4962['id'];_0x4d30f7[_0x509d8d+_0x43e7('0x7c')]=_0x3a4962['Interaction']['id'];_0x4d30f7[_0x43e7('0x71')+_0x509d8d+_0x2ca6fb+'Id']=_0x3a4962[_0x43e7('0x6c')]['id'];return db[_0x509d8d+_0x43e7('0x72')][_0x43e7('0x73')](_0x4d30f7);})[_0x43e7('0x7')](function(){return respondWithRpcPromise('Start',{'channel':_0x4ef289,'interaction':_0x3a4962['Interaction'],'message':_0x3a4962,'account':_0x3a4962[_0x43e7('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x43e7('0x39'),'appdata':_0x5bc060['name']+','+(_0x3a4962[_0x43e7('0x6c')][_0x43e7('0x7d')]||0x12c),'interval':_0x43e7('0x76')}]},routingClient);})[_0x43e7('0x7')](respondWithResult(_0x15ee83,null))[_0x43e7('0x16')](handleError(_0x15ee83,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 27f160d..b789018 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 _0x83c8=['../../components/auth/service','./schedule.controller','get','isAuthenticated','show','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x83c8,0x1aa));var _0x883c=function(_0x44b3f6,_0x2f0b79){_0x44b3f6=_0x44b3f6-0x0;var _0x4a6207=_0x83c8[_0x44b3f6];return _0x4a6207;};'use strict';var multer=require(_0x883c('0x0'));var util=require(_0x883c('0x1'));var path=require(_0x883c('0x2'));var timeout=require('connect-timeout');var express=require(_0x883c('0x3'));var router=express[_0x883c('0x4')]();var fs_extra=require(_0x883c('0x5'));var auth=require(_0x883c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x883c('0x7'));router[_0x883c('0x8')]('/',auth[_0x883c('0x9')](),controller['index']);router[_0x883c('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x883c('0xa')]);router[_0x883c('0x8')]('/:id/run',auth[_0x883c('0x9')](),controller['run']);router['post']('/',auth['isAuthenticated'](),controller[_0x883c('0xb')]);router[_0x883c('0xc')](_0x883c('0xd'),auth[_0x883c('0x9')](),controller[_0x883c('0xe')]);router[_0x883c('0xf')](_0x883c('0xd'),auth['isAuthenticated'](),controller[_0x883c('0x10')]);module[_0x883c('0x11')]=router; \ No newline at end of file +var _0x00a2=['index','/:id','show','get','run','create','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./schedule.controller','isAuthenticated'];(function(_0x1ce924,_0x220d57){var _0x2a8240=function(_0x320eba){while(--_0x320eba){_0x1ce924['push'](_0x1ce924['shift']());}};_0x2a8240(++_0x220d57);}(_0x00a2,0x1dc));var _0x200a=function(_0x7d5466,_0x2291b2){_0x7d5466=_0x7d5466-0x0;var _0x40121c=_0x00a2[_0x7d5466];return _0x40121c;};'use strict';var multer=require(_0x200a('0x0'));var util=require(_0x200a('0x1'));var path=require(_0x200a('0x2'));var timeout=require('connect-timeout');var express=require(_0x200a('0x3'));var router=express[_0x200a('0x4')]();var fs_extra=require(_0x200a('0x5'));var auth=require(_0x200a('0x6'));var interaction=require(_0x200a('0x7'));var config=require('../../config/environment');var controller=require(_0x200a('0x8'));router['get']('/',auth[_0x200a('0x9')](),controller[_0x200a('0xa')]);router['get'](_0x200a('0xb'),auth['isAuthenticated'](),controller[_0x200a('0xc')]);router[_0x200a('0xd')]('/:id/run',auth[_0x200a('0x9')](),controller[_0x200a('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x200a('0xf')]);router['put'](_0x200a('0xb'),auth['isAuthenticated'](),controller[_0x200a('0x10')]);router['delete'](_0x200a('0xb'),auth['isAuthenticated'](),controller[_0x200a('0x11')]);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 838c367..de5e5cf 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 _0x00cd=['default','TEXT','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','months','weeks','days','hours','minutes','csv','pdf','custom'];(function(_0x5979ff,_0x350c2e){var _0x2b7a96=function(_0x30332a){while(--_0x30332a){_0x5979ff['push'](_0x5979ff['shift']());}};_0x2b7a96(++_0x350c2e);}(_0x00cd,0x134));var _0xd00c=function(_0x1b02bb,_0x3d9fde){_0x1b02bb=_0x1b02bb-0x0;var _0x131245=_0x00cd[_0x1b02bb];return _0x131245;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd00c('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xd00c('0x0')]},'active':{'type':Sequelize[_0xd00c('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd00c('0x2')},'startAt':{'type':Sequelize[_0xd00c('0x3')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xd00c('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xd00c('0x5')]('years',_0xd00c('0x6'),_0xd00c('0x7'),_0xd00c('0x8'),_0xd00c('0x9'),_0xd00c('0xa'),_0xd00c('0xb')),'allowNull':![],'defaultValue':_0xd00c('0x9')},'output':{'type':Sequelize['ENUM'](_0xd00c('0xc'),_0xd00c('0xd'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xd00c('0x5')](_0xd00c('0xe'),_0xd00c('0xf')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xd00c('0x0')]},'cc':{'type':Sequelize[_0xd00c('0x10')]},'bcc':{'type':Sequelize[_0xd00c('0x10')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x78ef=['days','hours','minutes','csv','xlsx','custom','default','TEXT','BOOLEAN','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','ENUM','years','quarters','months'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x78ef,0x14d));var _0xf78e=function(_0x1ec66,_0x1d05b2){_0x1ec66=_0x1ec66-0x0;var _0x3e3820=_0x78ef[_0x1ec66];return _0x3e3820;};'use strict';var Sequelize=require(_0xf78e('0x0'));module[_0xf78e('0x1')]={'name':{'type':Sequelize[_0xf78e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf78e('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf78e('0x3')},'startAt':{'type':Sequelize[_0xf78e('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xf78e('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xf78e('0x5')](_0xf78e('0x6'),_0xf78e('0x7'),_0xf78e('0x8'),'weeks',_0xf78e('0x9'),_0xf78e('0xa'),_0xf78e('0xb')),'allowNull':![],'defaultValue':_0xf78e('0x9')},'output':{'type':Sequelize[_0xf78e('0x5')](_0xf78e('0xc'),'pdf',_0xf78e('0xd')),'allowNull':![],'defaultValue':_0xf78e('0xc')},'type':{'type':Sequelize[_0xf78e('0x5')](_0xf78e('0xe'),_0xf78e('0xf')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xf78e('0x2')]},'cc':{'type':Sequelize[_0xf78e('0x10')]},'bcc':{'type':Sequelize[_0xf78e('0x10')]},'sendIfEmpty':{'type':Sequelize[_0xf78e('0x11')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 57be56b..0194b3b 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 _0x7738=['hasOwnProperty','nolimit','order','filters','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','Scheduler','UserProfileResource','end','error','stack','name','send','index','map','Schedule','fieldName','type','key','query','keys','intersection','model','fields','attributes','length'];(function(_0x3c81ea,_0x17e322){var _0x18daa3=function(_0x1404ea){while(--_0x1404ea){_0x3c81ea['push'](_0x3c81ea['shift']());}};_0x18daa3(++_0x17e322);}(_0x7738,0x121));var _0x8773=function(_0x75aebf,_0xb132d7){_0x75aebf=_0x75aebf-0x0;var _0x148756=_0x7738[_0x75aebf];return _0x148756;};'use strict';var emlformat=require(_0x8773('0x0'));var rimraf=require(_0x8773('0x1'));var zipdir=require(_0x8773('0x2'));var jsonpatch=require(_0x8773('0x3'));var rp=require(_0x8773('0x4'));var moment=require(_0x8773('0x5'));var BPromise=require(_0x8773('0x6'));var Mustache=require(_0x8773('0x7'));var util=require(_0x8773('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x8773('0x9'));var ejs=require(_0x8773('0xa'));var fs=require('fs');var fs_extra=require(_0x8773('0xb'));var _=require('lodash');var squel=require(_0x8773('0xc'));var crypto=require(_0x8773('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8773('0xe'));var toCsv=require(_0x8773('0x9'));var querystring=require(_0x8773('0xf'));var Papa=require(_0x8773('0x10'));var Redis=require(_0x8773('0x11'));var authService=require(_0x8773('0x12'));var qs=require(_0x8773('0x13'));var as=require(_0x8773('0x14'));var hardwareService=require(_0x8773('0x15'));var logger=require(_0x8773('0x16'))(_0x8773('0x17'));var utils=require(_0x8773('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8773('0x19'))['db'];function respondWithStatusCode(_0x55a6b7,_0xdb16eb){_0xdb16eb=_0xdb16eb||0xcc;return function(_0x5fbab0){if(_0x5fbab0){return _0x55a6b7[_0x8773('0x1a')](_0xdb16eb);}return _0x55a6b7[_0x8773('0x1b')](_0xdb16eb)['end']();};}function respondWithResult(_0x1d620d,_0x2e7be4){_0x2e7be4=_0x2e7be4||0xc8;return function(_0x3d3f54){if(_0x3d3f54){return _0x1d620d[_0x8773('0x1b')](_0x2e7be4)[_0x8773('0x1c')](_0x3d3f54);}};}function respondWithFilteredResult(_0x148528,_0x4ce7fc){return function(_0x25e3ff){if(_0x25e3ff){var _0x12aed6=typeof _0x4ce7fc[_0x8773('0x1d')]===_0x8773('0x1e')&&typeof _0x4ce7fc['limit']==='undefined';var _0x575823=_0x25e3ff[_0x8773('0x1f')];var _0x33f5e1=_0x12aed6?0x0:_0x4ce7fc[_0x8773('0x1d')];var _0x5dc687=_0x12aed6?_0x25e3ff[_0x8773('0x1f')]:_0x4ce7fc[_0x8773('0x1d')]+_0x4ce7fc[_0x8773('0x20')];var _0x30bbbd;if(_0x5dc687>=_0x575823){_0x5dc687=_0x575823;_0x30bbbd=0xc8;}else{_0x30bbbd=0xce;}_0x148528[_0x8773('0x1b')](_0x30bbbd);return _0x148528[_0x8773('0x21')]('Content-Range',_0x33f5e1+'-'+_0x5dc687+'/'+_0x575823)[_0x8773('0x1c')](_0x25e3ff);}return null;};}function patchUpdates(_0x2b6e67){return function(_0x620f25){try{jsonpatch[_0x8773('0x22')](_0x620f25,_0x2b6e67,!![]);}catch(_0x1d93be){return BPromise[_0x8773('0x23')](_0x1d93be);}return _0x620f25[_0x8773('0x24')]();};}function saveUpdates(_0x1520c1,_0x58e18a){return function(_0x18bcf7){if(_0x18bcf7){return _0x18bcf7[_0x8773('0x25')](_0x1520c1)[_0x8773('0x26')](function(_0x2cd847){return _0x2cd847;});}return null;};}function removeEntity(_0x1baf9c,_0x3aa333){return function(_0x5ea95c){if(_0x5ea95c){return _0x5ea95c['destroy']()[_0x8773('0x26')](function(){var _0x2de354=_0x5ea95c['get']({'plain':!![]});var _0x3f7c23=_0x8773('0x27');return db[_0x8773('0x28')]['destroy']({'where':{'type':_0x3f7c23,'resourceId':_0x2de354['id']}})['then'](function(){return _0x5ea95c;});})['then'](function(){_0x1baf9c[_0x8773('0x1b')](0xcc)[_0x8773('0x29')]();});}};}function handleEntityNotFound(_0x3c99be,_0x1c0adf){return function(_0x378a0e){if(!_0x378a0e){_0x3c99be[_0x8773('0x1a')](0x194);}return _0x378a0e;};}function handleError(_0x448eab,_0x317332){_0x317332=_0x317332||0x1f4;return function(_0x5ac156){logger[_0x8773('0x2a')](_0x5ac156[_0x8773('0x2b')]);if(_0x5ac156[_0x8773('0x2c')]){delete _0x5ac156['name'];}_0x448eab[_0x8773('0x1b')](_0x317332)[_0x8773('0x2d')](_0x5ac156);};}exports[_0x8773('0x2e')]=function(_0x5a67cb,_0x79d037){var _0x48ff87={},_0x27704b={},_0x273493={'count':0x0,'rows':[]};var _0x4b54c2=_[_0x8773('0x2f')](db[_0x8773('0x30')]['rawAttributes'],function(_0x152ac8){return{'name':_0x152ac8[_0x8773('0x31')],'type':_0x152ac8[_0x8773('0x32')][_0x8773('0x33')]};});_0x27704b['model']=_['map'](_0x4b54c2,_0x8773('0x2c'));_0x27704b[_0x8773('0x34')]=_[_0x8773('0x35')](_0x5a67cb[_0x8773('0x34')]);_0x27704b['filters']=_[_0x8773('0x36')](_0x27704b[_0x8773('0x37')],_0x27704b[_0x8773('0x34')]);_0x48ff87['attributes']=_[_0x8773('0x36')](_0x27704b['model'],qs['fields'](_0x5a67cb[_0x8773('0x34')][_0x8773('0x38')]));_0x48ff87['attributes']=_0x48ff87[_0x8773('0x39')][_0x8773('0x3a')]?_0x48ff87[_0x8773('0x39')]:_0x27704b[_0x8773('0x37')];if(!_0x5a67cb[_0x8773('0x34')][_0x8773('0x3b')](_0x8773('0x3c'))){_0x48ff87['limit']=qs[_0x8773('0x20')](_0x5a67cb['query'][_0x8773('0x20')]);_0x48ff87[_0x8773('0x1d')]=qs[_0x8773('0x1d')](_0x5a67cb[_0x8773('0x34')]['offset']);}_0x48ff87[_0x8773('0x3d')]=qs['sort'](_0x5a67cb[_0x8773('0x34')]['sort']);_0x48ff87['where']=qs[_0x8773('0x3e')](_['pick'](_0x5a67cb[_0x8773('0x34')],_0x27704b[_0x8773('0x3e')]),_0x4b54c2);if(_0x5a67cb['query'][_0x8773('0x3f')]){_0x48ff87[_0x8773('0x40')]=_['merge'](_0x48ff87[_0x8773('0x40')],{'$or':_['map'](_0x4b54c2,function(_0x428d69){if(_0x428d69[_0x8773('0x32')]!==_0x8773('0x41')){var _0x1110de={};_0x1110de[_0x428d69[_0x8773('0x2c')]]={'$like':'%'+_0x5a67cb[_0x8773('0x34')]['filter']+'%'};return _0x1110de;}})});}_0x48ff87=_[_0x8773('0x42')]({},_0x48ff87,_0x5a67cb['options']);var _0x2a86bd={'where':_0x48ff87['where']};return db['Schedule']['count'](_0x2a86bd)['then'](function(_0x33e637){_0x273493['count']=_0x33e637;if(_0x5a67cb[_0x8773('0x34')][_0x8773('0x43')]){_0x48ff87[_0x8773('0x44')]=[{'all':!![]}];}return db[_0x8773('0x30')][_0x8773('0x45')](_0x48ff87);})['then'](function(_0x1147b0){_0x273493[_0x8773('0x46')]=_0x1147b0;return _0x273493;})[_0x8773('0x26')](respondWithFilteredResult(_0x79d037,_0x48ff87))[_0x8773('0x47')](handleError(_0x79d037,null));};exports['show']=function(_0x20db1f,_0x3f280a){var _0x4b4100={'raw':![],'where':{'id':_0x20db1f[_0x8773('0x48')]['id']}},_0xbf1b5f={};_0xbf1b5f[_0x8773('0x37')]=_['keys'](db[_0x8773('0x30')][_0x8773('0x49')]);_0xbf1b5f[_0x8773('0x34')]=_['keys'](_0x20db1f['query']);_0xbf1b5f[_0x8773('0x3e')]=_[_0x8773('0x36')](_0xbf1b5f[_0x8773('0x37')],_0xbf1b5f[_0x8773('0x34')]);_0x4b4100[_0x8773('0x39')]=_['intersection'](_0xbf1b5f[_0x8773('0x37')],qs[_0x8773('0x38')](_0x20db1f[_0x8773('0x34')][_0x8773('0x38')]));_0x4b4100[_0x8773('0x39')]=_0x4b4100[_0x8773('0x39')]['length']?_0x4b4100[_0x8773('0x39')]:_0xbf1b5f[_0x8773('0x37')];if(_0x20db1f[_0x8773('0x34')][_0x8773('0x43')]){_0x4b4100['include']=[{'all':!![]}];}_0x4b4100=_[_0x8773('0x42')]({},_0x4b4100,_0x20db1f[_0x8773('0x4a')]);return db[_0x8773('0x30')][_0x8773('0x4b')](_0x4b4100)['then'](handleEntityNotFound(_0x3f280a,null))['then'](respondWithResult(_0x3f280a,null))['catch'](handleError(_0x3f280a,null));};exports['create']=function(_0x4a6c86,_0x3a5dfb){return db[_0x8773('0x30')][_0x8773('0x4c')](_0x4a6c86[_0x8773('0x4d')],{})[_0x8773('0x26')](function(_0x4dd44a){var _0x3d89d8=_0x4a6c86['user'][_0x8773('0x4e')]({'plain':!![]});if(!_0x3d89d8)throw new Error(_0x8773('0x4f'));if(_0x3d89d8[_0x8773('0x50')]===_0x8773('0x51')){var _0x11cc4d=_0x4dd44a[_0x8773('0x4e')]({'plain':!![]});var _0x5ba5ec=_0x8773('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x5ba5ec,'userProfileId':_0x3d89d8[_0x8773('0x52')]},'raw':!![]})['then'](function(_0x19dcde){if(_0x19dcde&&_0x19dcde[_0x8773('0x53')]===0x0){return db[_0x8773('0x28')][_0x8773('0x4c')]({'name':_0x11cc4d[_0x8773('0x2c')],'resourceId':_0x11cc4d['id'],'type':_0x19dcde[_0x8773('0x2c')],'sectionId':_0x19dcde['id']},{})[_0x8773('0x26')](function(){return _0x4dd44a;});}else{return _0x4dd44a;}})[_0x8773('0x47')](function(_0x3e971b){logger['error'](_0x8773('0x54'),_0x3e971b);throw _0x3e971b;});}return _0x4dd44a;})[_0x8773('0x26')](respondWithResult(_0x3a5dfb,0xc9))['catch'](handleError(_0x3a5dfb,null));};exports[_0x8773('0x25')]=function(_0x56d9bf,_0x32c871){if(_0x56d9bf[_0x8773('0x4d')]['id']){delete _0x56d9bf[_0x8773('0x4d')]['id'];}return db['Schedule'][_0x8773('0x4b')]({'where':{'id':_0x56d9bf[_0x8773('0x48')]['id']}})[_0x8773('0x26')](handleEntityNotFound(_0x32c871,null))[_0x8773('0x26')](saveUpdates(_0x56d9bf[_0x8773('0x4d')],null))[_0x8773('0x26')](respondWithResult(_0x32c871,null))[_0x8773('0x47')](handleError(_0x32c871,null));};exports['destroy']=function(_0x172872,_0x1304fe){return db[_0x8773('0x30')][_0x8773('0x4b')]({'where':{'id':_0x172872[_0x8773('0x48')]['id']}})[_0x8773('0x26')](handleEntityNotFound(_0x1304fe,null))[_0x8773('0x26')](removeEntity(_0x1304fe,null))[_0x8773('0x47')](handleError(_0x1304fe,null));};exports[_0x8773('0x55')]=function(_0x484278,_0x59d299,_0x10080c){var _0xb33c21=require(_0x8773('0x56'));return db[_0x8773('0x30')]['find']({'where':{'id':_0x484278['params']['id']},'raw':!![]})[_0x8773('0x26')](handleEntityNotFound(_0x59d299,null))[_0x8773('0x26')](function(){_0xb33c21[_0x8773('0x55')](_0x484278[_0x8773('0x48')]['id']);})[_0x8773('0x26')](respondWithStatusCode(_0x59d299,null))[_0x8773('0x47')](handleError(_0x59d299,null));}; \ No newline at end of file +var _0x7479=['filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','userProfileId','body','run','../../config/schedule','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','Schedule','fieldName','type','key','model','query','keys'];(function(_0x5da27f,_0x504b76){var _0x54a3fb=function(_0x3b65a8){while(--_0x3b65a8){_0x5da27f['push'](_0x5da27f['shift']());}};_0x54a3fb(++_0x504b76);}(_0x7479,0x76));var _0x9747=function(_0x4ae6b0,_0x1544e9){_0x4ae6b0=_0x4ae6b0-0x0;var _0x591637=_0x7479[_0x4ae6b0];return _0x591637;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9747('0x0'));var zipdir=require(_0x9747('0x1'));var jsonpatch=require(_0x9747('0x2'));var rp=require(_0x9747('0x3'));var moment=require('moment');var BPromise=require(_0x9747('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9747('0x5'));var sox=require('sox');var csv=require(_0x9747('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9747('0x7'));var deskjs=require(_0x9747('0x8'));var toCsv=require(_0x9747('0x6'));var querystring=require(_0x9747('0x9'));var Papa=require(_0x9747('0xa'));var Redis=require(_0x9747('0xb'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9747('0xc'));var hardwareService=require(_0x9747('0xd'));var logger=require(_0x9747('0xe'))('api');var utils=require(_0x9747('0xf'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9747('0x10'))['db'];function respondWithStatusCode(_0x73abd4,_0x2c7eb0){_0x2c7eb0=_0x2c7eb0||0xcc;return function(_0x541f41){if(_0x541f41){return _0x73abd4[_0x9747('0x11')](_0x2c7eb0);}return _0x73abd4['status'](_0x2c7eb0)[_0x9747('0x12')]();};}function respondWithResult(_0x17e151,_0x33a2f8){_0x33a2f8=_0x33a2f8||0xc8;return function(_0x47120f){if(_0x47120f){return _0x17e151[_0x9747('0x13')](_0x33a2f8)[_0x9747('0x14')](_0x47120f);}};}function respondWithFilteredResult(_0x5d2d02,_0x560358){return function(_0x5673e1){if(_0x5673e1){var _0x50f204=typeof _0x560358[_0x9747('0x15')]===_0x9747('0x16')&&typeof _0x560358['limit']===_0x9747('0x16');var _0x38c8cd=_0x5673e1[_0x9747('0x17')];var _0x3c6c06=_0x50f204?0x0:_0x560358['offset'];var _0x119df1=_0x50f204?_0x5673e1[_0x9747('0x17')]:_0x560358[_0x9747('0x15')]+_0x560358[_0x9747('0x18')];var _0x5eb8af;if(_0x119df1>=_0x38c8cd){_0x119df1=_0x38c8cd;_0x5eb8af=0xc8;}else{_0x5eb8af=0xce;}_0x5d2d02['status'](_0x5eb8af);return _0x5d2d02[_0x9747('0x19')](_0x9747('0x1a'),_0x3c6c06+'-'+_0x119df1+'/'+_0x38c8cd)['json'](_0x5673e1);}return null;};}function patchUpdates(_0xc1f8d6){return function(_0x58e1c9){try{jsonpatch[_0x9747('0x1b')](_0x58e1c9,_0xc1f8d6,!![]);}catch(_0x3444fd){return BPromise[_0x9747('0x1c')](_0x3444fd);}return _0x58e1c9[_0x9747('0x1d')]();};}function saveUpdates(_0x306730,_0x119bc9){return function(_0x36fea9){if(_0x36fea9){return _0x36fea9[_0x9747('0x1e')](_0x306730)[_0x9747('0x1f')](function(_0x5e85d3){return _0x5e85d3;});}return null;};}function removeEntity(_0x4f7e8a,_0x5f3306){return function(_0x3a6e90){if(_0x3a6e90){return _0x3a6e90[_0x9747('0x20')]()['then'](function(){var _0x235bef=_0x3a6e90['get']({'plain':!![]});var _0x4f5327='Scheduler';return db[_0x9747('0x21')][_0x9747('0x20')]({'where':{'type':_0x4f5327,'resourceId':_0x235bef['id']}})['then'](function(){return _0x3a6e90;});})[_0x9747('0x1f')](function(){_0x4f7e8a[_0x9747('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21ce63,_0x32b79a){return function(_0x50eef1){if(!_0x50eef1){_0x21ce63[_0x9747('0x11')](0x194);}return _0x50eef1;};}function handleError(_0x612809,_0x420045){_0x420045=_0x420045||0x1f4;return function(_0x56a971){logger[_0x9747('0x22')](_0x56a971[_0x9747('0x23')]);if(_0x56a971[_0x9747('0x24')]){delete _0x56a971[_0x9747('0x24')];}_0x612809['status'](_0x420045)[_0x9747('0x25')](_0x56a971);};}exports[_0x9747('0x26')]=function(_0x3a4ac8,_0x4d73b5){var _0x203214={},_0x46f868={},_0x1aa657={'count':0x0,'rows':[]};var _0x153f55=_['map'](db[_0x9747('0x27')]['rawAttributes'],function(_0x254da9){return{'name':_0x254da9[_0x9747('0x28')],'type':_0x254da9[_0x9747('0x29')][_0x9747('0x2a')]};});_0x46f868[_0x9747('0x2b')]=_['map'](_0x153f55,'name');_0x46f868[_0x9747('0x2c')]=_[_0x9747('0x2d')](_0x3a4ac8['query']);_0x46f868[_0x9747('0x2e')]=_['intersection'](_0x46f868[_0x9747('0x2b')],_0x46f868[_0x9747('0x2c')]);_0x203214[_0x9747('0x2f')]=_[_0x9747('0x30')](_0x46f868['model'],qs[_0x9747('0x31')](_0x3a4ac8[_0x9747('0x2c')][_0x9747('0x31')]));_0x203214[_0x9747('0x2f')]=_0x203214['attributes'][_0x9747('0x32')]?_0x203214['attributes']:_0x46f868[_0x9747('0x2b')];if(!_0x3a4ac8['query'][_0x9747('0x33')](_0x9747('0x34'))){_0x203214[_0x9747('0x18')]=qs[_0x9747('0x18')](_0x3a4ac8[_0x9747('0x2c')][_0x9747('0x18')]);_0x203214[_0x9747('0x15')]=qs[_0x9747('0x15')](_0x3a4ac8[_0x9747('0x2c')][_0x9747('0x15')]);}_0x203214[_0x9747('0x35')]=qs[_0x9747('0x36')](_0x3a4ac8[_0x9747('0x2c')]['sort']);_0x203214[_0x9747('0x37')]=qs['filters'](_[_0x9747('0x38')](_0x3a4ac8[_0x9747('0x2c')],_0x46f868[_0x9747('0x2e')]),_0x153f55);if(_0x3a4ac8['query'][_0x9747('0x39')]){_0x203214[_0x9747('0x37')]=_['merge'](_0x203214[_0x9747('0x37')],{'$or':_[_0x9747('0x3a')](_0x153f55,function(_0x25ece3){if(_0x25ece3[_0x9747('0x29')]!==_0x9747('0x3b')){var _0x4f3a4a={};_0x4f3a4a[_0x25ece3[_0x9747('0x24')]]={'$like':'%'+_0x3a4ac8[_0x9747('0x2c')][_0x9747('0x39')]+'%'};return _0x4f3a4a;}})});}_0x203214=_[_0x9747('0x3c')]({},_0x203214,_0x3a4ac8[_0x9747('0x3d')]);var _0x330dd5={'where':_0x203214[_0x9747('0x37')]};return db['Schedule'][_0x9747('0x17')](_0x330dd5)[_0x9747('0x1f')](function(_0x493330){_0x1aa657[_0x9747('0x17')]=_0x493330;if(_0x3a4ac8[_0x9747('0x2c')][_0x9747('0x3e')]){_0x203214[_0x9747('0x3f')]=[{'all':!![]}];}return db[_0x9747('0x27')][_0x9747('0x40')](_0x203214);})[_0x9747('0x1f')](function(_0x4a97fb){_0x1aa657[_0x9747('0x41')]=_0x4a97fb;return _0x1aa657;})[_0x9747('0x1f')](respondWithFilteredResult(_0x4d73b5,_0x203214))[_0x9747('0x42')](handleError(_0x4d73b5,null));};exports[_0x9747('0x43')]=function(_0x260aaa,_0x2a951e){var _0x4d3278={'raw':![],'where':{'id':_0x260aaa[_0x9747('0x44')]['id']}},_0x2800f9={};_0x2800f9[_0x9747('0x2b')]=_[_0x9747('0x2d')](db[_0x9747('0x27')][_0x9747('0x45')]);_0x2800f9['query']=_[_0x9747('0x2d')](_0x260aaa[_0x9747('0x2c')]);_0x2800f9['filters']=_[_0x9747('0x30')](_0x2800f9['model'],_0x2800f9['query']);_0x4d3278[_0x9747('0x2f')]=_[_0x9747('0x30')](_0x2800f9[_0x9747('0x2b')],qs['fields'](_0x260aaa['query'][_0x9747('0x31')]));_0x4d3278['attributes']=_0x4d3278[_0x9747('0x2f')][_0x9747('0x32')]?_0x4d3278['attributes']:_0x2800f9[_0x9747('0x2b')];if(_0x260aaa[_0x9747('0x2c')][_0x9747('0x3e')]){_0x4d3278[_0x9747('0x3f')]=[{'all':!![]}];}_0x4d3278=_[_0x9747('0x3c')]({},_0x4d3278,_0x260aaa[_0x9747('0x3d')]);return db[_0x9747('0x27')][_0x9747('0x46')](_0x4d3278)[_0x9747('0x1f')](handleEntityNotFound(_0x2a951e,null))[_0x9747('0x1f')](respondWithResult(_0x2a951e,null))['catch'](handleError(_0x2a951e,null));};exports[_0x9747('0x47')]=function(_0x5815b0,_0x3a12c8){return db['Schedule']['create'](_0x5815b0['body'],{})[_0x9747('0x1f')](function(_0x225a0e){var _0x561525=_0x5815b0[_0x9747('0x48')][_0x9747('0x49')]({'plain':!![]});if(!_0x561525)throw new Error(_0x9747('0x4a'));if(_0x561525[_0x9747('0x4b')]==='user'){var _0x2b02f9=_0x225a0e[_0x9747('0x49')]({'plain':!![]});var _0x473d8c=_0x9747('0x4c');return db[_0x9747('0x4d')][_0x9747('0x46')]({'where':{'name':_0x473d8c,'userProfileId':_0x561525[_0x9747('0x4e')]},'raw':!![]})['then'](function(_0x403fc8){if(_0x403fc8&&_0x403fc8['autoAssociation']===0x0){return db[_0x9747('0x21')]['create']({'name':_0x2b02f9[_0x9747('0x24')],'resourceId':_0x2b02f9['id'],'type':_0x403fc8[_0x9747('0x24')],'sectionId':_0x403fc8['id']},{})[_0x9747('0x1f')](function(){return _0x225a0e;});}else{return _0x225a0e;}})['catch'](function(_0x50a735){logger[_0x9747('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50a735);throw _0x50a735;});}return _0x225a0e;})[_0x9747('0x1f')](respondWithResult(_0x3a12c8,0xc9))[_0x9747('0x42')](handleError(_0x3a12c8,null));};exports[_0x9747('0x1e')]=function(_0x2580a7,_0x3c5df6){if(_0x2580a7[_0x9747('0x4f')]['id']){delete _0x2580a7['body']['id'];}return db[_0x9747('0x27')]['find']({'where':{'id':_0x2580a7[_0x9747('0x44')]['id']}})[_0x9747('0x1f')](handleEntityNotFound(_0x3c5df6,null))[_0x9747('0x1f')](saveUpdates(_0x2580a7[_0x9747('0x4f')],null))[_0x9747('0x1f')](respondWithResult(_0x3c5df6,null))[_0x9747('0x42')](handleError(_0x3c5df6,null));};exports[_0x9747('0x20')]=function(_0x202ea3,_0x123c4f){return db[_0x9747('0x27')]['find']({'where':{'id':_0x202ea3[_0x9747('0x44')]['id']}})[_0x9747('0x1f')](handleEntityNotFound(_0x123c4f,null))[_0x9747('0x1f')](removeEntity(_0x123c4f,null))['catch'](handleError(_0x123c4f,null));};exports[_0x9747('0x50')]=function(_0x3267ec,_0x5c97be,_0xca49){var _0x3b675e=require(_0x9747('0x51'));return db[_0x9747('0x27')]['find']({'where':{'id':_0x3267ec[_0x9747('0x44')]['id']},'raw':!![]})[_0x9747('0x1f')](handleEntityNotFound(_0x5c97be,null))[_0x9747('0x1f')](function(){_0x3b675e[_0x9747('0x50')](_0x3267ec[_0x9747('0x44')]['id']);})['then'](respondWithStatusCode(_0x5c97be,null))[_0x9747('0x42')](handleError(_0x5c97be,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index d5795cc..9c7733f 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 _0xce0b=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules'];(function(_0x2539cd,_0x19da95){var _0xb446c2=function(_0x57c5b7){while(--_0x57c5b7){_0x2539cd['push'](_0x2539cd['shift']());}};_0xb446c2(++_0x19da95);}(_0xce0b,0xd0));var _0xbce0=function(_0x577c65,_0x3a464d){_0x577c65=_0x577c65-0x0;var _0x17423e=_0xce0b[_0x577c65];return _0x17423e;};'use strict';var _=require('lodash');var util=require(_0xbce0('0x0'));var logger=require('../../config/logger')(_0xbce0('0x1'));var moment=require(_0xbce0('0x2'));var BPromise=require(_0xbce0('0x3'));var rp=require(_0xbce0('0x4'));var fs=require('fs');var path=require(_0xbce0('0x5'));var rimraf=require(_0xbce0('0x6'));var config=require(_0xbce0('0x7'));var attributes=require(_0xbce0('0x8'));module[_0xbce0('0x9')]=function(_0x36f832,_0x52c4c5){return _0x36f832[_0xbce0('0xa')](_0xbce0('0xb'),attributes,{'tableName':_0xbce0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3454=['tools_schedules','lodash','util','../../config/logger','api','request-promise','path','rimraf','./schedule.attributes','exports','define','Schedule'];(function(_0x138365,_0x5b6312){var _0x48c245=function(_0x6f165){while(--_0x6f165){_0x138365['push'](_0x138365['shift']());}};_0x48c245(++_0x5b6312);}(_0x3454,0x1c9));var _0x4345=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3454[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4345('0x0'));var util=require(_0x4345('0x1'));var logger=require(_0x4345('0x2'))(_0x4345('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4345('0x4'));var fs=require('fs');var path=require(_0x4345('0x5'));var rimraf=require(_0x4345('0x6'));var config=require('../../config/environment');var attributes=require(_0x4345('0x7'));module[_0x4345('0x8')]=function(_0x4635ba,_0x1c8e85){return _0x4635ba[_0x4345('0x9')](_0x4345('0xa'),attributes,{'tableName':_0x4345('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 1d44e46..3fa3197 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 _0xd82c=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util'];(function(_0x49aa7d,_0x5d46d8){var _0xdd0d26=function(_0x159df7){while(--_0x159df7){_0x49aa7d['push'](_0x49aa7d['shift']());}};_0xdd0d26(++_0x5d46d8);}(_0xd82c,0x116));var _0xcd82=function(_0x47a7c2,_0x2852c0){_0x47a7c2=_0x47a7c2-0x0;var _0x455ee7=_0xd82c[_0x47a7c2];return _0x455ee7;};'use strict';var _=require(_0xcd82('0x0'));var util=require(_0xcd82('0x1'));var moment=require('moment');var BPromise=require(_0xcd82('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcd82('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcd82('0x4'));var logger=require(_0xcd82('0x5'))(_0xcd82('0x6'));var config=require(_0xcd82('0x7'));var jayson=require(_0xcd82('0x8'));var client=jayson[_0xcd82('0x9')][_0xcd82('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58d44d,_0x29a2b8,_0x46865f){return new BPromise(function(_0x3055d2,_0x56c68f){return client['request'](_0x58d44d,_0x46865f)[_0xcd82('0xb')](function(_0x5106cf){logger['info'](_0xcd82('0xc'),_0x29a2b8,_0xcd82('0xd'));logger['debug'](_0xcd82('0xe'),_0x29a2b8,_0xcd82('0xd'),JSON[_0xcd82('0xf')](_0x5106cf));if(_0x5106cf[_0xcd82('0x10')]){if(_0x5106cf[_0xcd82('0x10')]['code']===0x1f4){logger[_0xcd82('0x10')](_0xcd82('0xc'),_0x29a2b8,_0x5106cf['error']['message']);return _0x56c68f(_0x5106cf[_0xcd82('0x10')][_0xcd82('0x11')]);}logger[_0xcd82('0x10')](_0xcd82('0xc'),_0x29a2b8,_0x5106cf[_0xcd82('0x10')][_0xcd82('0x11')]);return _0x3055d2(_0x5106cf['error']['message']);}else{logger[_0xcd82('0x12')](_0xcd82('0xc'),_0x29a2b8,_0xcd82('0xd'));_0x3055d2(_0x5106cf[_0xcd82('0x13')][_0xcd82('0x11')]);}})['catch'](function(_0x105362){logger[_0xcd82('0x10')]('Schedule,\x20%s,\x20%s',_0x29a2b8,_0x105362);_0x56c68f(_0x105362);});});} \ No newline at end of file +var _0x5f7d=['error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x404cdf,_0xe3be3c){var _0x18f3d7=function(_0x5ea284){while(--_0x5ea284){_0x404cdf['push'](_0x404cdf['shift']());}};_0x18f3d7(++_0xe3be3c);}(_0x5f7d,0xd5));var _0xd5f7=function(_0x4d6826,_0x50de8d){_0x4d6826=_0x4d6826-0x0;var _0x2764bc=_0x5f7d[_0x4d6826];return _0x2764bc;};'use strict';var _=require(_0xd5f7('0x0'));var util=require(_0xd5f7('0x1'));var moment=require(_0xd5f7('0x2'));var BPromise=require(_0xd5f7('0x3'));var rs=require(_0xd5f7('0x4'));var fs=require('fs');var Redis=require(_0xd5f7('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd5f7('0x6'))('rpc');var config=require(_0xd5f7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd5f7('0x8')][_0xd5f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x584122,_0x1a21a6,_0x16642b){return new BPromise(function(_0x586f15,_0x2dd61a){return client[_0xd5f7('0xa')](_0x584122,_0x16642b)[_0xd5f7('0xb')](function(_0x354822){logger['info'](_0xd5f7('0xc'),_0x1a21a6,_0xd5f7('0xd'));logger[_0xd5f7('0xe')](_0xd5f7('0xf'),_0x1a21a6,_0xd5f7('0xd'),JSON[_0xd5f7('0x10')](_0x354822));if(_0x354822[_0xd5f7('0x11')]){if(_0x354822[_0xd5f7('0x11')][_0xd5f7('0x12')]===0x1f4){logger[_0xd5f7('0x11')]('Schedule,\x20%s,\x20%s',_0x1a21a6,_0x354822[_0xd5f7('0x11')][_0xd5f7('0x13')]);return _0x2dd61a(_0x354822[_0xd5f7('0x11')]['message']);}logger[_0xd5f7('0x11')](_0xd5f7('0xc'),_0x1a21a6,_0x354822[_0xd5f7('0x11')][_0xd5f7('0x13')]);return _0x586f15(_0x354822['error'][_0xd5f7('0x13')]);}else{logger[_0xd5f7('0x14')](_0xd5f7('0xc'),_0x1a21a6,_0xd5f7('0xd'));_0x586f15(_0x354822[_0xd5f7('0x15')][_0xd5f7('0x13')]);}})[_0xd5f7('0x16')](function(_0x53d17f){logger[_0xd5f7('0x11')](_0xd5f7('0xc'),_0x1a21a6,_0x53d17f);_0x2dd61a(_0x53d17f);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 9b5b350..7921dbb 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 _0xa4b3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','/describe','isAuthenticated','show','/:id/download','download','post','create','/:id','delete','destroy','multer','util','connect-timeout','Router','fs-extra'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa4b3,0x163));var _0x3a4b=function(_0x18f6c2,_0x4a7f78){_0x18f6c2=_0x18f6c2-0x0;var _0x805abc=_0xa4b3[_0x18f6c2];return _0x805abc;};'use strict';var multer=require(_0x3a4b('0x0'));var util=require(_0x3a4b('0x1'));var path=require('path');var timeout=require(_0x3a4b('0x2'));var express=require('express');var router=express[_0x3a4b('0x3')]();var fs_extra=require(_0x3a4b('0x4'));var auth=require(_0x3a4b('0x5'));var interaction=require(_0x3a4b('0x6'));var config=require(_0x3a4b('0x7'));var controller=require(_0x3a4b('0x8'));router[_0x3a4b('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3a4b('0x9')](_0x3a4b('0xa'),auth[_0x3a4b('0xb')](),controller['describe']);router[_0x3a4b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x3a4b('0xc')]);router[_0x3a4b('0x9')](_0x3a4b('0xd'),auth['isAuthenticated'](),controller[_0x3a4b('0xe')]);router[_0x3a4b('0xf')]('/',auth[_0x3a4b('0xb')](),controller[_0x3a4b('0x10')]);router['put'](_0x3a4b('0x11'),auth[_0x3a4b('0xb')](),controller['update']);router[_0x3a4b('0x12')](_0x3a4b('0x11'),auth['isAuthenticated'](),controller[_0x3a4b('0x13')]);module['exports']=router; \ No newline at end of file +var _0xcc26=['../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x34822c,_0x1c6829){var _0x4d01ab=function(_0x421b06){while(--_0x421b06){_0x34822c['push'](_0x34822c['shift']());}};_0x4d01ab(++_0x1c6829);}(_0xcc26,0x1af));var _0x6cc2=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xcc26[_0x1da527];return _0x40fc7c;};'use strict';var multer=require('multer');var util=require(_0x6cc2('0x0'));var path=require(_0x6cc2('0x1'));var timeout=require('connect-timeout');var express=require(_0x6cc2('0x2'));var router=express[_0x6cc2('0x3')]();var fs_extra=require(_0x6cc2('0x4'));var auth=require(_0x6cc2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6cc2('0x6'));var controller=require(_0x6cc2('0x7'));router[_0x6cc2('0x8')]('/',auth[_0x6cc2('0x9')](),controller[_0x6cc2('0xa')]);router['get'](_0x6cc2('0xb'),auth[_0x6cc2('0x9')](),controller[_0x6cc2('0xc')]);router[_0x6cc2('0x8')](_0x6cc2('0xd'),auth['isAuthenticated'](),controller[_0x6cc2('0xe')]);router[_0x6cc2('0x8')](_0x6cc2('0xf'),auth[_0x6cc2('0x9')](),controller[_0x6cc2('0x10')]);router['post']('/',auth[_0x6cc2('0x9')](),controller[_0x6cc2('0x11')]);router[_0x6cc2('0x12')](_0x6cc2('0xd'),auth[_0x6cc2('0x9')](),controller[_0x6cc2('0x13')]);router[_0x6cc2('0x14')](_0x6cc2('0xd'),auth['isAuthenticated'](),controller[_0x6cc2('0x15')]);module[_0x6cc2('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index a6fae2a..59d6573 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 _0xd983=['moment','path','../../config/environment','exports','value','extname','getDataValue','STRING','replace','setDataValue','INTEGER','startedAt','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize'];(function(_0x23d685,_0x39d486){var _0x558a3e=function(_0x5f4ad6){while(--_0x5f4ad6){_0x23d685['push'](_0x23d685['shift']());}};_0x558a3e(++_0x39d486);}(_0xd983,0x1df));var _0x3d98=function(_0x51a01d,_0x4f8911){_0x51a01d=_0x51a01d-0x0;var _0x4880f1=_0xd983[_0x51a01d];return _0x4880f1;};'use strict';var Sequelize=require(_0x3d98('0x0'));var moment=require(_0x3d98('0x1'));var path=require(_0x3d98('0x2'));var config=require(_0x3d98('0x3'));module[_0x3d98('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x3d98('0x5'))?path[_0x3d98('0x6')](this[_0x3d98('0x7')](_0x3d98('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x3d98('0x8')]},'channel':{'type':Sequelize[_0x3d98('0x8')]},'value':{'type':Sequelize[_0x3d98('0x8')],'set':function(_0x5452ef){var _0x3f5c17=_0x5452ef[_0x3d98('0x9')](/\\/g,'/');this[_0x3d98('0xa')](_0x3d98('0x5'),_0x3f5c17);}},'rating':{'type':Sequelize[_0x3d98('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x3d98('0xb')],'set':function(_0x274a9f){this[_0x3d98('0xa')](_0x3d98('0xc'),moment()['subtract'](_0x274a9f,'ms'));this['setDataValue'](_0x3d98('0xd'),moment());this[_0x3d98('0xa')](_0x3d98('0xe'),_0x274a9f);}},'startedAt':{'type':Sequelize[_0x3d98('0xf')],'get':function(){return moment(this['getDataValue']('startedAt'))[_0x3d98('0x10')](_0x3d98('0x11'))[_0x3d98('0x12')]();}},'closedAt':{'type':Sequelize[_0x3d98('0xf')],'get':function(){return moment(this['getDataValue'](_0x3d98('0xd')))[_0x3d98('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x3d98('0x12')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x3d98('0x7')]('createdAt'))['format'](_0x3d98('0x11'))[_0x3d98('0x12')]();}},'updatedAt':{'type':Sequelize[_0x3d98('0xf')],'get':function(){return moment(this['getDataValue'](_0x3d98('0x13')))[_0x3d98('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x3d98('0x12')]();}}}; \ No newline at end of file +var _0x38b8=['updatedAt','sequelize','path','../../config/environment','VIRTUAL','extname','getDataValue','STRING','replace','INTEGER','startedAt','setDataValue','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x38b8,0x7f));var _0x838b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x38b8[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x838b('0x0'));var moment=require('moment');var path=require(_0x838b('0x1'));var config=require(_0x838b('0x2'));module['exports']={'format':{'type':Sequelize[_0x838b('0x3')],'get':function(){return this['getDataValue']('value')?path[_0x838b('0x4')](this[_0x838b('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x838b('0x6')]},'value':{'type':Sequelize[_0x838b('0x6')],'set':function(_0x5c516c){var _0x2d3e96=_0x5c516c[_0x838b('0x7')](/\\/g,'/');this['setDataValue']('value',_0x2d3e96);}},'rating':{'type':Sequelize[_0x838b('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x838b('0x8')],'set':function(_0x31ba84){this['setDataValue'](_0x838b('0x9'),moment()['subtract'](_0x31ba84,'ms'));this[_0x838b('0xa')](_0x838b('0xb'),moment());this[_0x838b('0xa')](_0x838b('0xc'),_0x31ba84);}},'startedAt':{'type':Sequelize[_0x838b('0xd')],'get':function(){return moment(this[_0x838b('0x5')]('startedAt'))[_0x838b('0xe')](_0x838b('0xf'))[_0x838b('0x10')]();}},'closedAt':{'type':Sequelize[_0x838b('0xd')],'get':function(){return moment(this[_0x838b('0x5')](_0x838b('0xb')))[_0x838b('0xe')](_0x838b('0xf'))[_0x838b('0x10')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x838b('0x5')]('createdAt'))['format']('MM-DD-YYYY\x20HH:mm')[_0x838b('0x10')]();}},'updatedAt':{'type':Sequelize[_0x838b('0xd')],'get':function(){return moment(this[_0x838b('0x5')](_0x838b('0x11')))[_0x838b('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x838b('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index abead0f..3377772 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 _0x5636=['rawAttributes','fieldName','type','key','model','differenceBy','map','format','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ScreenRecording','count','includeAll','include','findAll','rows','catch','show','find','create','body','duration','createdAt','closedAt','value','describe','uniqueid','params','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','download','filename','extname','unlink','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','index'];(function(_0x1b8ee0,_0x6560e6){var _0x424b53=function(_0x555565){while(--_0x555565){_0x1b8ee0['push'](_0x1b8ee0['shift']());}};_0x424b53(++_0x6560e6);}(_0x5636,0x102));var _0x6563=function(_0x401751,_0x48701c){_0x401751=_0x401751-0x0;var _0xf3c3e2=_0x5636[_0x401751];return _0xf3c3e2;};'use strict';var emlformat=require(_0x6563('0x0'));var rimraf=require(_0x6563('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6563('0x2'));var BPromise=require(_0x6563('0x3'));var Mustache=require(_0x6563('0x4'));var util=require('util');var path=require(_0x6563('0x5'));var sox=require(_0x6563('0x6'));var csv=require(_0x6563('0x7'));var ejs=require(_0x6563('0x8'));var fs=require('fs');var fs_extra=require(_0x6563('0x9'));var _=require(_0x6563('0xa'));var squel=require(_0x6563('0xb'));var crypto=require(_0x6563('0xc'));var jsforce=require(_0x6563('0xd'));var deskjs=require(_0x6563('0xe'));var toCsv=require(_0x6563('0x7'));var querystring=require(_0x6563('0xf'));var Papa=require(_0x6563('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6563('0x11'));var as=require(_0x6563('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6563('0x13'));var config=require(_0x6563('0x14'));var licenseUtil=require(_0x6563('0x15'));var db=require(_0x6563('0x16'))['db'];function respondWithStatusCode(_0x33816e,_0x2ed676){_0x2ed676=_0x2ed676||0xcc;return function(_0x31d3fa){if(_0x31d3fa){return _0x33816e[_0x6563('0x17')](_0x2ed676);}return _0x33816e[_0x6563('0x18')](_0x2ed676)['end']();};}function respondWithResult(_0xa0a0b6,_0x5e9329){_0x5e9329=_0x5e9329||0xc8;return function(_0x37131e){if(_0x37131e){return _0xa0a0b6[_0x6563('0x18')](_0x5e9329)[_0x6563('0x19')](_0x37131e);}};}function respondWithFilteredResult(_0x10d08c,_0x5af5d0){return function(_0x26f26e){if(_0x26f26e){var _0x11baa2=typeof _0x5af5d0[_0x6563('0x1a')]===_0x6563('0x1b')&&typeof _0x5af5d0['limit']===_0x6563('0x1b');var _0x589632=_0x26f26e['count'];var _0x47972a=_0x11baa2?0x0:_0x5af5d0[_0x6563('0x1a')];var _0x4f5609=_0x11baa2?_0x26f26e['count']:_0x5af5d0[_0x6563('0x1a')]+_0x5af5d0[_0x6563('0x1c')];var _0x17a29f;if(_0x4f5609>=_0x589632){_0x4f5609=_0x589632;_0x17a29f=0xc8;}else{_0x17a29f=0xce;}_0x10d08c[_0x6563('0x18')](_0x17a29f);return _0x10d08c[_0x6563('0x1d')](_0x6563('0x1e'),_0x47972a+'-'+_0x4f5609+'/'+_0x589632)[_0x6563('0x19')](_0x26f26e);}return null;};}function patchUpdates(_0x93a45){return function(_0x2a70f0){try{jsonpatch['apply'](_0x2a70f0,_0x93a45,!![]);}catch(_0x2f2905){return BPromise[_0x6563('0x1f')](_0x2f2905);}return _0x2a70f0[_0x6563('0x20')]();};}function saveUpdates(_0x5a335c,_0x293db2){return function(_0x5c37bb){if(_0x5c37bb){return _0x5c37bb[_0x6563('0x21')](_0x5a335c)[_0x6563('0x22')](function(_0x5610b0){return _0x5610b0;});}return null;};}function removeEntity(_0x5773e2,_0x3ab7f6){return function(_0x492f45){if(_0x492f45){return _0x492f45[_0x6563('0x23')]()[_0x6563('0x22')](function(){_0x5773e2[_0x6563('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd860d5,_0x51ff06){return function(_0x7ea857){if(!_0x7ea857){_0xd860d5[_0x6563('0x17')](0x194);}return _0x7ea857;};}function handleError(_0x5e5aeb,_0x365b16){_0x365b16=_0x365b16||0x1f4;return function(_0x28252d){logger['error'](_0x28252d[_0x6563('0x24')]);if(_0x28252d['name']){delete _0x28252d[_0x6563('0x25')];}_0x5e5aeb['status'](_0x365b16)['send'](_0x28252d);};}exports[_0x6563('0x26')]=function(_0x118d31,_0x17326c){var _0x2a1550={},_0x3eb23b={},_0x4b4d3b={'count':0x0,'rows':[]};var _0x3c8bd1=_['map'](db['ScreenRecording'][_0x6563('0x27')],function(_0x35af37){return{'name':_0x35af37[_0x6563('0x28')],'type':_0x35af37[_0x6563('0x29')][_0x6563('0x2a')]};});_0x3eb23b[_0x6563('0x2b')]=_[_0x6563('0x2c')](_[_0x6563('0x2d')](_0x3c8bd1,_0x6563('0x25')),[_0x6563('0x2e')]);_0x3eb23b['query']=_[_0x6563('0x2f')](_0x118d31[_0x6563('0x30')]);_0x3eb23b[_0x6563('0x31')]=_[_0x6563('0x32')](_0x3eb23b[_0x6563('0x2b')],_0x3eb23b[_0x6563('0x30')]);_0x2a1550[_0x6563('0x33')]=_['intersection'](_0x3eb23b[_0x6563('0x2b')],qs[_0x6563('0x34')](_0x118d31[_0x6563('0x30')][_0x6563('0x34')]));_0x2a1550[_0x6563('0x33')]=_0x2a1550[_0x6563('0x33')]['length']?_0x2a1550[_0x6563('0x33')]:_0x3eb23b[_0x6563('0x2b')];if(!_0x118d31[_0x6563('0x30')][_0x6563('0x35')](_0x6563('0x36'))){_0x2a1550[_0x6563('0x1c')]=qs[_0x6563('0x1c')](_0x118d31['query'][_0x6563('0x1c')]);_0x2a1550[_0x6563('0x1a')]=qs['offset'](_0x118d31[_0x6563('0x30')][_0x6563('0x1a')]);}_0x2a1550['order']=qs['sort'](_0x118d31[_0x6563('0x30')][_0x6563('0x37')]);_0x2a1550[_0x6563('0x38')]=qs[_0x6563('0x31')](_['pick'](_0x118d31[_0x6563('0x30')],_0x3eb23b[_0x6563('0x31')]),_0x3c8bd1);if(_0x118d31['query'][_0x6563('0x39')]){_0x2a1550[_0x6563('0x38')]=_[_0x6563('0x3a')](_0x2a1550[_0x6563('0x38')],{'$or':_[_0x6563('0x2d')](_0x3c8bd1,function(_0x1f6341){if(_0x1f6341[_0x6563('0x29')]!==_0x6563('0x3b')){var _0x2e4177={};_0x2e4177[_0x1f6341['name']]={'$like':'%'+_0x118d31[_0x6563('0x30')][_0x6563('0x39')]+'%'};return _0x2e4177;}})});}_0x2a1550=_[_0x6563('0x3a')]({},_0x2a1550,_0x118d31[_0x6563('0x3c')]);var _0x5ebe88={'where':_0x2a1550['where']};return db[_0x6563('0x3d')][_0x6563('0x3e')](_0x5ebe88)[_0x6563('0x22')](function(_0x5db29d){_0x4b4d3b[_0x6563('0x3e')]=_0x5db29d;if(_0x118d31['query'][_0x6563('0x3f')]){_0x2a1550[_0x6563('0x40')]=[{'all':!![]}];}return db['ScreenRecording'][_0x6563('0x41')](_0x2a1550);})[_0x6563('0x22')](function(_0xea186){_0x4b4d3b[_0x6563('0x42')]=_0xea186;return _0x4b4d3b;})[_0x6563('0x22')](respondWithFilteredResult(_0x17326c,_0x2a1550))[_0x6563('0x43')](handleError(_0x17326c,null));};exports[_0x6563('0x44')]=function(_0x32932f,_0xd30789){var _0xfc7eb1={'raw':![],'where':{'id':_0x32932f['params']['id']}},_0x2acb52={};_0x2acb52['model']=_[_0x6563('0x2f')](db[_0x6563('0x3d')][_0x6563('0x27')]);_0x2acb52[_0x6563('0x30')]=_[_0x6563('0x2f')](_0x32932f[_0x6563('0x30')]);_0x2acb52[_0x6563('0x31')]=_['intersection'](_0x2acb52[_0x6563('0x2b')],_0x2acb52[_0x6563('0x30')]);_0xfc7eb1[_0x6563('0x33')]=_[_0x6563('0x32')](_0x2acb52['model'],qs[_0x6563('0x34')](_0x32932f[_0x6563('0x30')][_0x6563('0x34')]));_0xfc7eb1[_0x6563('0x33')]=_0xfc7eb1[_0x6563('0x33')]['length']?_0xfc7eb1['attributes']:_0x2acb52[_0x6563('0x2b')];if(_0x32932f[_0x6563('0x30')][_0x6563('0x3f')]){_0xfc7eb1['include']=[{'all':!![]}];}_0xfc7eb1=_[_0x6563('0x3a')]({},_0xfc7eb1,_0x32932f[_0x6563('0x3c')]);return db[_0x6563('0x3d')][_0x6563('0x45')](_0xfc7eb1)['then'](handleEntityNotFound(_0xd30789,null))[_0x6563('0x22')](respondWithResult(_0xd30789,null))[_0x6563('0x43')](handleError(_0xd30789,null));};exports[_0x6563('0x46')]=function(_0x55e927,_0x35b0ce){return db['ScreenRecording'][_0x6563('0x46')](_0x55e927['body'],{})['then'](respondWithResult(_0x35b0ce,0xc9))[_0x6563('0x43')](handleError(_0x35b0ce,null));};exports[_0x6563('0x21')]=function(_0x2ebab0,_0xb84325){if(_0x2ebab0[_0x6563('0x47')]['id']){delete _0x2ebab0[_0x6563('0x47')]['id'];}delete _0x2ebab0[_0x6563('0x47')][_0x6563('0x48')];delete _0x2ebab0[_0x6563('0x47')][_0x6563('0x49')];delete _0x2ebab0['body'][_0x6563('0x4a')];delete _0x2ebab0['body'][_0x6563('0x4b')];return db[_0x6563('0x3d')][_0x6563('0x45')]({'where':{'id':_0x2ebab0['params']['id']}})[_0x6563('0x22')](handleEntityNotFound(_0xb84325,null))[_0x6563('0x22')](saveUpdates(_0x2ebab0['body'],null))[_0x6563('0x22')](respondWithResult(_0xb84325,null))[_0x6563('0x43')](handleError(_0xb84325,null));};exports[_0x6563('0x4c')]=function(_0x3883f3,_0xbd920a){return db['ScreenRecording'][_0x6563('0x4c')]()['then'](respondWithResult(_0xbd920a,null))[_0x6563('0x43')](handleError(_0xbd920a,null));};exports['download']=function(_0xd2ed6b,_0x5992c8,_0x55e002){var _0x5c8274=require('../../components/encryptor');var _0x270667=![];var _0x5ade56={};if(_0xd2ed6b[_0x6563('0x30')]['type']&&_0xd2ed6b[_0x6563('0x30')][_0x6563('0x29')]===_0x6563('0x4d')){_0x5ade56[_0x6563('0x4d')]=_0xd2ed6b[_0x6563('0x4e')]['id'];}else{_0x5ade56['id']=_0xd2ed6b[_0x6563('0x4e')]['id'];}return db[_0x6563('0x3d')][_0x6563('0x45')]({'where':_0x5ade56,'attributes':['id',_0x6563('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x5992c8,null))[_0x6563('0x22')](function(_0x28b1c6){if(_0x28b1c6){var _0x97ee3=path[_0x6563('0x4f')](config[_0x6563('0x50')],_0x6563('0x51'),_0x28b1c6[_0x6563('0x4b')]);var _0x32c715=util[_0x6563('0x2e')](_0x6563('0x52'),_0x97ee3);if(fs[_0x6563('0x53')](_0x32c715)){_0x270667=!![];return _0x5c8274['decryptFile'](_0x32c715,_0x97ee3,config[_0x6563('0x54')][_0x6563('0x55')])[_0x6563('0x22')](function(){return _0x28b1c6;});}return _0x28b1c6;}})[_0x6563('0x22')](function(_0x46c26c){if(_0x46c26c){var _0x3c06ac=path[_0x6563('0x4f')](config[_0x6563('0x50')],'server/files/screen_recordings',_0x46c26c[_0x6563('0x4b')]);if(!fs['existsSync'](_0x3c06ac)){throw new db[(_0x6563('0x56'))][(_0x6563('0x57'))]('ScreenRecording\x20not\x20found');}if(_0x46c26c['filename']){return _0x5992c8[_0x6563('0x58')](_0x3c06ac,_0x46c26c[_0x6563('0x59')]+path[_0x6563('0x5a')](_0x3c06ac),function(){if(_0x270667){fs[_0x6563('0x5b')](_0x3c06ac);}});}else{return _0x5992c8['download'](_0x3c06ac,function(_0x2a3df0){if(_0x270667){fs['unlink'](_0x3c06ac);}});}}})[_0x6563('0x43')](function(_0x29aecb){if(_0x29aecb['message']==='ScreenRecording\x20not\x20found'){_0x5992c8[_0x6563('0x18')](0x194)['send']('Not\x20found');}else{return handleError(_0x5992c8,null);}});};exports[_0x6563('0x23')]=function(_0x49d6a5,_0x356010){return db[_0x6563('0x3d')][_0x6563('0x45')]({'where':{'id':_0x49d6a5[_0x6563('0x4e')]['id']}})['then'](function(_0x83d5c){if(_[_0x6563('0x5c')](_0x83d5c)){throw new ReferenceError(_0x6563('0x5d'));}return _0x83d5c;})[_0x6563('0x22')](function(_0x3ffb7f){var _0x2d4694=path[_0x6563('0x4f')](config[_0x6563('0x50')],'server/files/screen_recordings',_0x3ffb7f['value']);logger[_0x6563('0x5e')](_0x6563('0x5f'),_0x2d4694);if(!_['isNil'](_0x3ffb7f['value'])&&fs['existsSync'](_0x2d4694)){logger[_0x6563('0x5e')](_0x6563('0x60')+_0x2d4694+_0x6563('0x61'));fs[_0x6563('0x62')](_0x2d4694);}_0x2d4694=_0x2d4694+'.cypher';if(!_[_0x6563('0x5c')](_0x3ffb7f[_0x6563('0x4b')])&&fs[_0x6563('0x53')](_0x2d4694)){logger[_0x6563('0x5e')](_0x6563('0x60')+_0x2d4694+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x2d4694);}return _0x3ffb7f;})[_0x6563('0x22')](function(_0x1d7b5d){if(!_0x1d7b5d)throw new InternalError();return _0x1d7b5d[_0x6563('0x23')]();})['then'](function(){_0x356010[_0x6563('0x18')](0xcc)['end']();})[_0x6563('0x43')](handleError(_0x356010,null));}; \ No newline at end of file +var _0x8958=['pick','merge','VIRTUAL','filter','options','ScreenRecording','include','findAll','params','rawAttributes','includeAll','create','catch','body','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','find','value','join','root','server/files/screen_recordings','%s.cypher','decryptFile','secrets','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','destroy','rimraf','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','error','name','send','index','map','fieldName','type','key','model','format','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x42f0cb,_0x55b26d){var _0x44a5b5=function(_0x4bf479){while(--_0x4bf479){_0x42f0cb['push'](_0x42f0cb['shift']());}};_0x44a5b5(++_0x55b26d);}(_0x8958,0x93));var _0x8895=function(_0x12b77d,_0x27509f){_0x12b77d=_0x12b77d-0x0;var _0x5e924e=_0x8958[_0x12b77d];return _0x5e924e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8895('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8895('0x1'));var Mustache=require('mustache');var util=require(_0x8895('0x2'));var path=require(_0x8895('0x3'));var sox=require(_0x8895('0x4'));var csv=require('to-csv');var ejs=require(_0x8895('0x5'));var fs=require('fs');var fs_extra=require(_0x8895('0x6'));var _=require(_0x8895('0x7'));var squel=require(_0x8895('0x8'));var crypto=require(_0x8895('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8895('0xa'));var toCsv=require(_0x8895('0xb'));var querystring=require(_0x8895('0xc'));var Papa=require(_0x8895('0xd'));var Redis=require(_0x8895('0xe'));var authService=require(_0x8895('0xf'));var qs=require(_0x8895('0x10'));var as=require(_0x8895('0x11'));var hardwareService=require(_0x8895('0x12'));var logger=require(_0x8895('0x13'))('api');var utils=require(_0x8895('0x14'));var config=require(_0x8895('0x15'));var licenseUtil=require(_0x8895('0x16'));var db=require(_0x8895('0x17'))['db'];function respondWithStatusCode(_0x446e1a,_0xaf93bc){_0xaf93bc=_0xaf93bc||0xcc;return function(_0x5af0ef){if(_0x5af0ef){return _0x446e1a[_0x8895('0x18')](_0xaf93bc);}return _0x446e1a[_0x8895('0x19')](_0xaf93bc)[_0x8895('0x1a')]();};}function respondWithResult(_0x57d40a,_0x47b9fe){_0x47b9fe=_0x47b9fe||0xc8;return function(_0x9191b8){if(_0x9191b8){return _0x57d40a['status'](_0x47b9fe)[_0x8895('0x1b')](_0x9191b8);}};}function respondWithFilteredResult(_0x337101,_0x195789){return function(_0x3d7b59){if(_0x3d7b59){var _0x2c9d40=typeof _0x195789['offset']===_0x8895('0x1c')&&typeof _0x195789[_0x8895('0x1d')]===_0x8895('0x1c');var _0xcdd661=_0x3d7b59[_0x8895('0x1e')];var _0x1b5c82=_0x2c9d40?0x0:_0x195789[_0x8895('0x1f')];var _0x26cee0=_0x2c9d40?_0x3d7b59[_0x8895('0x1e')]:_0x195789[_0x8895('0x1f')]+_0x195789[_0x8895('0x1d')];var _0x6b8a16;if(_0x26cee0>=_0xcdd661){_0x26cee0=_0xcdd661;_0x6b8a16=0xc8;}else{_0x6b8a16=0xce;}_0x337101[_0x8895('0x19')](_0x6b8a16);return _0x337101['set']('Content-Range',_0x1b5c82+'-'+_0x26cee0+'/'+_0xcdd661)['json'](_0x3d7b59);}return null;};}function patchUpdates(_0x3daf43){return function(_0x456282){try{jsonpatch[_0x8895('0x20')](_0x456282,_0x3daf43,!![]);}catch(_0x29449a){return BPromise[_0x8895('0x21')](_0x29449a);}return _0x456282[_0x8895('0x22')]();};}function saveUpdates(_0x461346,_0xc1ce17){return function(_0x5219ca){if(_0x5219ca){return _0x5219ca[_0x8895('0x23')](_0x461346)[_0x8895('0x24')](function(_0x2a403){return _0x2a403;});}return null;};}function removeEntity(_0x1f71f3,_0x29223d){return function(_0x4d092d){if(_0x4d092d){return _0x4d092d['destroy']()[_0x8895('0x24')](function(){_0x1f71f3[_0x8895('0x19')](0xcc)[_0x8895('0x1a')]();});}};}function handleEntityNotFound(_0x24a376,_0x4fc150){return function(_0x25da11){if(!_0x25da11){_0x24a376[_0x8895('0x18')](0x194);}return _0x25da11;};}function handleError(_0x187a15,_0x5486a6){_0x5486a6=_0x5486a6||0x1f4;return function(_0x4aee03){logger[_0x8895('0x25')](_0x4aee03['stack']);if(_0x4aee03[_0x8895('0x26')]){delete _0x4aee03[_0x8895('0x26')];}_0x187a15[_0x8895('0x19')](_0x5486a6)[_0x8895('0x27')](_0x4aee03);};}exports[_0x8895('0x28')]=function(_0x5c03ea,_0x4d567a){var _0x6e449d={},_0x37ac3a={},_0x3fc4cc={'count':0x0,'rows':[]};var _0x16b65b=_[_0x8895('0x29')](db['ScreenRecording']['rawAttributes'],function(_0x46ae32){return{'name':_0x46ae32[_0x8895('0x2a')],'type':_0x46ae32[_0x8895('0x2b')][_0x8895('0x2c')]};});_0x37ac3a[_0x8895('0x2d')]=_['differenceBy'](_[_0x8895('0x29')](_0x16b65b,'name'),[_0x8895('0x2e')]);_0x37ac3a['query']=_[_0x8895('0x2f')](_0x5c03ea[_0x8895('0x30')]);_0x37ac3a[_0x8895('0x31')]=_[_0x8895('0x32')](_0x37ac3a[_0x8895('0x2d')],_0x37ac3a['query']);_0x6e449d[_0x8895('0x33')]=_[_0x8895('0x32')](_0x37ac3a[_0x8895('0x2d')],qs[_0x8895('0x34')](_0x5c03ea[_0x8895('0x30')]['fields']));_0x6e449d[_0x8895('0x33')]=_0x6e449d['attributes'][_0x8895('0x35')]?_0x6e449d['attributes']:_0x37ac3a[_0x8895('0x2d')];if(!_0x5c03ea[_0x8895('0x30')][_0x8895('0x36')](_0x8895('0x37'))){_0x6e449d[_0x8895('0x1d')]=qs['limit'](_0x5c03ea[_0x8895('0x30')]['limit']);_0x6e449d[_0x8895('0x1f')]=qs[_0x8895('0x1f')](_0x5c03ea[_0x8895('0x30')][_0x8895('0x1f')]);}_0x6e449d[_0x8895('0x38')]=qs[_0x8895('0x39')](_0x5c03ea['query'][_0x8895('0x39')]);_0x6e449d[_0x8895('0x3a')]=qs['filters'](_[_0x8895('0x3b')](_0x5c03ea['query'],_0x37ac3a[_0x8895('0x31')]),_0x16b65b);if(_0x5c03ea[_0x8895('0x30')]['filter']){_0x6e449d[_0x8895('0x3a')]=_[_0x8895('0x3c')](_0x6e449d['where'],{'$or':_['map'](_0x16b65b,function(_0x202130){if(_0x202130[_0x8895('0x2b')]!==_0x8895('0x3d')){var _0x331a9e={};_0x331a9e[_0x202130[_0x8895('0x26')]]={'$like':'%'+_0x5c03ea['query'][_0x8895('0x3e')]+'%'};return _0x331a9e;}})});}_0x6e449d=_[_0x8895('0x3c')]({},_0x6e449d,_0x5c03ea[_0x8895('0x3f')]);var _0x10005f={'where':_0x6e449d[_0x8895('0x3a')]};return db[_0x8895('0x40')]['count'](_0x10005f)[_0x8895('0x24')](function(_0x5ebfc4){_0x3fc4cc[_0x8895('0x1e')]=_0x5ebfc4;if(_0x5c03ea[_0x8895('0x30')]['includeAll']){_0x6e449d[_0x8895('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0x8895('0x42')](_0x6e449d);})['then'](function(_0x4af3b1){_0x3fc4cc['rows']=_0x4af3b1;return _0x3fc4cc;})['then'](respondWithFilteredResult(_0x4d567a,_0x6e449d))['catch'](handleError(_0x4d567a,null));};exports['show']=function(_0x447ed6,_0x206f57){var _0x596531={'raw':![],'where':{'id':_0x447ed6[_0x8895('0x43')]['id']}},_0x4835d7={};_0x4835d7[_0x8895('0x2d')]=_['keys'](db[_0x8895('0x40')][_0x8895('0x44')]);_0x4835d7[_0x8895('0x30')]=_[_0x8895('0x2f')](_0x447ed6[_0x8895('0x30')]);_0x4835d7['filters']=_['intersection'](_0x4835d7['model'],_0x4835d7[_0x8895('0x30')]);_0x596531['attributes']=_[_0x8895('0x32')](_0x4835d7[_0x8895('0x2d')],qs[_0x8895('0x34')](_0x447ed6[_0x8895('0x30')]['fields']));_0x596531[_0x8895('0x33')]=_0x596531[_0x8895('0x33')][_0x8895('0x35')]?_0x596531[_0x8895('0x33')]:_0x4835d7[_0x8895('0x2d')];if(_0x447ed6[_0x8895('0x30')][_0x8895('0x45')]){_0x596531[_0x8895('0x41')]=[{'all':!![]}];}_0x596531=_['merge']({},_0x596531,_0x447ed6[_0x8895('0x3f')]);return db[_0x8895('0x40')]['find'](_0x596531)[_0x8895('0x24')](handleEntityNotFound(_0x206f57,null))['then'](respondWithResult(_0x206f57,null))['catch'](handleError(_0x206f57,null));};exports[_0x8895('0x46')]=function(_0x337a9f,_0x130018){return db['ScreenRecording'][_0x8895('0x46')](_0x337a9f['body'],{})[_0x8895('0x24')](respondWithResult(_0x130018,0xc9))[_0x8895('0x47')](handleError(_0x130018,null));};exports[_0x8895('0x23')]=function(_0x1ca539,_0x2f3bf1){if(_0x1ca539[_0x8895('0x48')]['id']){delete _0x1ca539[_0x8895('0x48')]['id'];}delete _0x1ca539['body']['duration'];delete _0x1ca539[_0x8895('0x48')][_0x8895('0x49')];delete _0x1ca539['body'][_0x8895('0x4a')];delete _0x1ca539['body']['value'];return db[_0x8895('0x40')]['find']({'where':{'id':_0x1ca539[_0x8895('0x43')]['id']}})[_0x8895('0x24')](handleEntityNotFound(_0x2f3bf1,null))[_0x8895('0x24')](saveUpdates(_0x1ca539[_0x8895('0x48')],null))[_0x8895('0x24')](respondWithResult(_0x2f3bf1,null))[_0x8895('0x47')](handleError(_0x2f3bf1,null));};exports[_0x8895('0x4b')]=function(_0x38d6ae,_0x583419){return db[_0x8895('0x40')][_0x8895('0x4b')]()[_0x8895('0x24')](respondWithResult(_0x583419,null))['catch'](handleError(_0x583419,null));};exports[_0x8895('0x4c')]=function(_0x3935fd,_0xd7ffeb,_0x14e769){var _0x1e264a=require(_0x8895('0x4d'));var _0x434ab8=![];var _0x216e6e={};if(_0x3935fd[_0x8895('0x30')][_0x8895('0x2b')]&&_0x3935fd['query'][_0x8895('0x2b')]===_0x8895('0x4e')){_0x216e6e[_0x8895('0x4e')]=_0x3935fd[_0x8895('0x43')]['id'];}else{_0x216e6e['id']=_0x3935fd[_0x8895('0x43')]['id'];}return db['ScreenRecording'][_0x8895('0x4f')]({'where':_0x216e6e,'attributes':['id',_0x8895('0x50')],'raw':!![]})[_0x8895('0x24')](handleEntityNotFound(_0xd7ffeb,null))[_0x8895('0x24')](function(_0x37a7b4){if(_0x37a7b4){var _0x58dd6c=path[_0x8895('0x51')](config[_0x8895('0x52')],_0x8895('0x53'),_0x37a7b4['value']);var _0x20422f=util[_0x8895('0x2e')](_0x8895('0x54'),_0x58dd6c);if(fs['existsSync'](_0x20422f)){_0x434ab8=!![];return _0x1e264a[_0x8895('0x55')](_0x20422f,_0x58dd6c,config[_0x8895('0x56')]['recording'])[_0x8895('0x24')](function(){return _0x37a7b4;});}return _0x37a7b4;}})[_0x8895('0x24')](function(_0x5198f8){if(_0x5198f8){var _0x2f990a=path[_0x8895('0x51')](config[_0x8895('0x52')],_0x8895('0x53'),_0x5198f8['value']);if(!fs['existsSync'](_0x2f990a)){throw new db[(_0x8895('0x57'))][(_0x8895('0x58'))](_0x8895('0x59'));}if(_0x5198f8['filename']){return _0xd7ffeb[_0x8895('0x4c')](_0x2f990a,_0x5198f8[_0x8895('0x5a')]+path['extname'](_0x2f990a),function(){if(_0x434ab8){fs[_0x8895('0x5b')](_0x2f990a);}});}else{return _0xd7ffeb['download'](_0x2f990a,function(_0x435e36){if(_0x434ab8){fs[_0x8895('0x5b')](_0x2f990a);}});}}})[_0x8895('0x47')](function(_0x14f8a4){if(_0x14f8a4[_0x8895('0x5c')]==='ScreenRecording\x20not\x20found'){_0xd7ffeb['status'](0x194)[_0x8895('0x27')](_0x8895('0x5d'));}else{return handleError(_0xd7ffeb,null);}});};exports['destroy']=function(_0x46f8ae,_0x131476){return db[_0x8895('0x40')][_0x8895('0x4f')]({'where':{'id':_0x46f8ae['params']['id']}})[_0x8895('0x24')](function(_0x2d2bf9){if(_[_0x8895('0x5e')](_0x2d2bf9)){throw new ReferenceError(_0x8895('0x5f'));}return _0x2d2bf9;})[_0x8895('0x24')](function(_0x41a2fe){var _0x261d4b=path[_0x8895('0x51')](config[_0x8895('0x52')],_0x8895('0x53'),_0x41a2fe[_0x8895('0x50')]);logger[_0x8895('0x60')](_0x8895('0x61'),_0x261d4b);if(!_[_0x8895('0x5e')](_0x41a2fe[_0x8895('0x50')])&&fs['existsSync'](_0x261d4b)){logger['info']('File:\x20\x22'+_0x261d4b+_0x8895('0x62'));fs[_0x8895('0x63')](_0x261d4b);}_0x261d4b=_0x261d4b+_0x8895('0x64');if(!_[_0x8895('0x5e')](_0x41a2fe[_0x8895('0x50')])&&fs['existsSync'](_0x261d4b)){logger[_0x8895('0x60')](_0x8895('0x65')+_0x261d4b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x8895('0x63')](_0x261d4b);}return _0x41a2fe;})[_0x8895('0x24')](function(_0xf51f48){if(!_0xf51f48)throw new InternalError();return _0xf51f48[_0x8895('0x66')]();})[_0x8895('0x24')](function(){_0x131476['status'](0xcc)[_0x8895('0x1a')]();})[_0x8895('0x47')](handleError(_0x131476,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index a833de1..45525a1 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 _0x97a9=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x97a9,0x104));var _0x997a=function(_0x4f7e0e,_0xbd2836){_0x4f7e0e=_0x4f7e0e-0x0;var _0x35ecf0=_0x97a9[_0x4f7e0e];return _0x35ecf0;};'use strict';var _=require('lodash');var util=require(_0x997a('0x0'));var logger=require(_0x997a('0x1'))(_0x997a('0x2'));var moment=require(_0x997a('0x3'));var BPromise=require(_0x997a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x997a('0x5'));var rimraf=require(_0x997a('0x6'));var config=require(_0x997a('0x7'));var attributes=require(_0x997a('0x8'));module[_0x997a('0x9')]=function(_0x24e9a9,_0x227558){return _0x24e9a9['define'](_0x997a('0xa'),attributes,{'tableName':_0x997a('0xb'),'paranoid':![],'indexes':[{'name':_0x997a('0xc'),'fields':[_0x997a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc939=['define','screen_recordings','interactionid','lodash','api','moment','bluebird','request-promise','../../config/environment','./screenRecording.attributes'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc939,0x189));var _0x9c93=function(_0x396721,_0x24395a){_0x396721=_0x396721-0x0;var _0x43208b=_0xc939[_0x396721];return _0x43208b;};'use strict';var _=require(_0x9c93('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9c93('0x1'));var moment=require(_0x9c93('0x2'));var BPromise=require(_0x9c93('0x3'));var rp=require(_0x9c93('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9c93('0x5'));var attributes=require(_0x9c93('0x6'));module['exports']=function(_0x5a338d,_0x41318b){return _0x5a338d[_0x9c93('0x7')]('ScreenRecording',attributes,{'tableName':_0x9c93('0x8'),'paranoid':![],'indexes':[{'name':_0x9c93('0x9'),'fields':[_0x9c93('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 3c44d72..652ffe7 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 _0x19ca=['catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x714212,_0x565721){var _0x50d8d0=function(_0x2e2326){while(--_0x2e2326){_0x714212['push'](_0x714212['shift']());}};_0x50d8d0(++_0x565721);}(_0x19ca,0x144));var _0xa19c=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x19ca[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0xa19c('0x0'));var util=require(_0xa19c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa19c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa19c('0x3'))['db'];var utils=require(_0xa19c('0x4'));var logger=require(_0xa19c('0x5'))(_0xa19c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa19c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b954a,_0x37f842,_0x13dff1){return new BPromise(function(_0x3dafb0,_0x49989f){return client[_0xa19c('0x8')](_0x2b954a,_0x13dff1)['then'](function(_0x22d6ce){logger[_0xa19c('0x9')](_0xa19c('0xa'),_0x37f842,_0xa19c('0xb'));logger[_0xa19c('0xc')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x37f842,_0xa19c('0xb'),JSON[_0xa19c('0xd')](_0x22d6ce));if(_0x22d6ce[_0xa19c('0xe')]){if(_0x22d6ce['error'][_0xa19c('0xf')]===0x1f4){logger['error'](_0xa19c('0xa'),_0x37f842,_0x22d6ce[_0xa19c('0xe')][_0xa19c('0x10')]);return _0x49989f(_0x22d6ce[_0xa19c('0xe')]['message']);}logger['error'](_0xa19c('0xa'),_0x37f842,_0x22d6ce[_0xa19c('0xe')]['message']);return _0x3dafb0(_0x22d6ce[_0xa19c('0xe')][_0xa19c('0x10')]);}else{logger[_0xa19c('0x9')](_0xa19c('0xa'),_0x37f842,_0xa19c('0xb'));_0x3dafb0(_0x22d6ce[_0xa19c('0x11')]['message']);}})[_0xa19c('0x12')](function(_0x33e02d){logger[_0xa19c('0xe')](_0xa19c('0xa'),_0x37f842,_0x33e02d);_0x49989f(_0x33e02d);});});} \ No newline at end of file +var _0x0a81=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','ScreenRecording,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x312654,_0x64b402){var _0x46b0c3=function(_0x8535a2){while(--_0x8535a2){_0x312654['push'](_0x312654['shift']());}};_0x46b0c3(++_0x64b402);}(_0x0a81,0x1df));var _0x10a8=function(_0x29035d,_0x19a9e8){_0x29035d=_0x29035d-0x0;var _0x233184=_0x0a81[_0x29035d];return _0x233184;};'use strict';var _=require(_0x10a8('0x0'));var util=require(_0x10a8('0x1'));var moment=require(_0x10a8('0x2'));var BPromise=require(_0x10a8('0x3'));var rs=require(_0x10a8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x10a8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x10a8('0x6'))(_0x10a8('0x7'));var config=require(_0x10a8('0x8'));var jayson=require(_0x10a8('0x9'));var client=jayson['client'][_0x10a8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8de215,_0x4f6357,_0x3c278e){return new BPromise(function(_0x115c68,_0x30afc0){return client[_0x10a8('0xb')](_0x8de215,_0x3c278e)['then'](function(_0x18d2cb){logger[_0x10a8('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x4f6357,'request\x20sent');logger[_0x10a8('0xd')](_0x10a8('0xe'),_0x4f6357,_0x10a8('0xf'),JSON['stringify'](_0x18d2cb));if(_0x18d2cb[_0x10a8('0x10')]){if(_0x18d2cb[_0x10a8('0x10')]['code']===0x1f4){logger[_0x10a8('0x10')](_0x10a8('0x11'),_0x4f6357,_0x18d2cb[_0x10a8('0x10')][_0x10a8('0x12')]);return _0x30afc0(_0x18d2cb[_0x10a8('0x10')][_0x10a8('0x12')]);}logger[_0x10a8('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x4f6357,_0x18d2cb[_0x10a8('0x10')][_0x10a8('0x12')]);return _0x115c68(_0x18d2cb[_0x10a8('0x10')]['message']);}else{logger['info'](_0x10a8('0x11'),_0x4f6357,'request\x20sent');_0x115c68(_0x18d2cb[_0x10a8('0x13')][_0x10a8('0x12')]);}})[_0x10a8('0x14')](function(_0x1ef142){logger[_0x10a8('0x10')](_0x10a8('0x11'),_0x4f6357,_0x1ef142);_0x30afc0(_0x1ef142);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index cefda95..3d78894 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 _0x6c7b=['originalname','post','single','addLogo','logologin','file','addLogoLogin','root','preferred','/:id/preferred','addPreferred','favicon','/:id/favicon','addFavicon','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','/:id/logo_login','getPreferred','getFavicon','diskStorage','join','server/files/images/logos/','format','%s%s','logo','extname'];(function(_0x9df3d8,_0x4074e3){var _0x366da1=function(_0x5af940){while(--_0x5af940){_0x9df3d8['push'](_0x9df3d8['shift']());}};_0x366da1(++_0x4074e3);}(_0x6c7b,0x1d2));var _0xb6c7=function(_0x2c668d,_0x54b0a3){_0x2c668d=_0x2c668d-0x0;var _0x4e180c=_0x6c7b[_0x2c668d];return _0x4e180c;};'use strict';var multer=require(_0xb6c7('0x0'));var util=require(_0xb6c7('0x1'));var path=require(_0xb6c7('0x2'));var timeout=require(_0xb6c7('0x3'));var express=require(_0xb6c7('0x4'));var router=express[_0xb6c7('0x5')]();var fs_extra=require(_0xb6c7('0x6'));var auth=require(_0xb6c7('0x7'));var interaction=require(_0xb6c7('0x8'));var config=require(_0xb6c7('0x9'));var controller=require(_0xb6c7('0xa'));router[_0xb6c7('0xb')]('/',auth[_0xb6c7('0xc')](),controller[_0xb6c7('0xd')]);router[_0xb6c7('0xb')](_0xb6c7('0xe'),controller[_0xb6c7('0xf')]);router[_0xb6c7('0xb')](_0xb6c7('0x10'),controller[_0xb6c7('0x11')]);router['get'](_0xb6c7('0x12'),controller['getLogo']);router[_0xb6c7('0xb')](_0xb6c7('0x13'),controller['getLogoLogin']);router['get']('/:id/gdpr',controller['gdpr']);router[_0xb6c7('0xb')]('/:id/preferred',controller[_0xb6c7('0x14')]);router[_0xb6c7('0xb')]('/:id/favicon',controller[_0xb6c7('0x15')]);var upload=multer({'storage':multer[_0xb6c7('0x16')]({'destination':function(_0x545422,_0x255e92,_0x35eb71){_0x35eb71(null,path[_0xb6c7('0x17')](config['root'],_0xb6c7('0x18')));},'filename':function(_0x35b68b,_0xa42579,_0x3e9673){_0x3e9673(null,util[_0xb6c7('0x19')](_0xb6c7('0x1a'),_0xb6c7('0x1b'),path[_0xb6c7('0x1c')](_0xa42579[_0xb6c7('0x1d')])));}})});router[_0xb6c7('0x1e')](_0xb6c7('0x12'),upload[_0xb6c7('0x1f')]('file'),controller[_0xb6c7('0x20')]);var upload=multer({'storage':multer[_0xb6c7('0x16')]({'destination':function(_0x651372,_0x151ec7,_0x1b69eb){_0x1b69eb(null,path['join'](config['root'],_0xb6c7('0x18')));},'filename':function(_0x5542bb,_0x10350a,_0x5a2857){_0x5a2857(null,util['format'](_0xb6c7('0x1a'),_0xb6c7('0x21'),path['extname'](_0x10350a[_0xb6c7('0x1d')])));}})});router['post'](_0xb6c7('0x13'),upload[_0xb6c7('0x1f')](_0xb6c7('0x22')),controller[_0xb6c7('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2f458b,_0x39ec46,_0x364ddd){_0x364ddd(null,path[_0xb6c7('0x17')](config[_0xb6c7('0x24')],_0xb6c7('0x18')));},'filename':function(_0x19ec9d,_0xbffece,_0x4acedc){_0x4acedc(null,util[_0xb6c7('0x19')](_0xb6c7('0x1a'),_0xb6c7('0x25'),path[_0xb6c7('0x1c')](_0xbffece[_0xb6c7('0x1d')])));}})});router[_0xb6c7('0x1e')](_0xb6c7('0x26'),upload['single'](_0xb6c7('0x22')),controller[_0xb6c7('0x27')]);var upload=multer({'storage':multer[_0xb6c7('0x16')]({'destination':function(_0x3be084,_0x3b88ab,_0x402f2d){_0x402f2d(null,path[_0xb6c7('0x17')](config[_0xb6c7('0x24')],_0xb6c7('0x18')));},'filename':function(_0xcb153a,_0x319363,_0x5c3309){_0x5c3309(null,util['format'](_0xb6c7('0x1a'),_0xb6c7('0x28'),path[_0xb6c7('0x1c')](_0x319363[_0xb6c7('0x1d')])));}})});router[_0xb6c7('0x1e')](_0xb6c7('0x29'),upload[_0xb6c7('0x1f')](_0xb6c7('0x22')),controller[_0xb6c7('0x2a')]);router['put']('/:id',auth[_0xb6c7('0xc')](),controller[_0xb6c7('0x2b')]);module[_0xb6c7('0x2c')]=router; \ No newline at end of file +var _0x6844=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','getDate','/:id','getLogo','/:id/logo_login','getLogoLogin','gdpr','getPreferred','/:id/favicon','getFavicon','join','root','server/files/images/logos/','format','%s%s','originalname','post','single','file','diskStorage','extname','preferred','/:id/preferred','favicon','isAuthenticated','exports','util'];(function(_0x366e33,_0x132335){var _0x3e11c4=function(_0x5b9b81){while(--_0x5b9b81){_0x366e33['push'](_0x366e33['shift']());}};_0x3e11c4(++_0x132335);}(_0x6844,0x153));var _0x4684=function(_0x14e9a5,_0x3f2840){_0x14e9a5=_0x14e9a5-0x0;var _0x56b6c7=_0x6844[_0x14e9a5];return _0x56b6c7;};'use strict';var multer=require('multer');var util=require(_0x4684('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4684('0x1'));var router=express['Router']();var fs_extra=require(_0x4684('0x2'));var auth=require(_0x4684('0x3'));var interaction=require(_0x4684('0x4'));var config=require(_0x4684('0x5'));var controller=require(_0x4684('0x6'));router[_0x4684('0x7')]('/',auth['isAuthenticated'](),controller[_0x4684('0x8')]);router[_0x4684('0x7')]('/now',controller[_0x4684('0x9')]);router[_0x4684('0x7')](_0x4684('0xa'),controller['show']);router[_0x4684('0x7')]('/:id/logo',controller[_0x4684('0xb')]);router[_0x4684('0x7')](_0x4684('0xc'),controller[_0x4684('0xd')]);router[_0x4684('0x7')]('/:id/gdpr',controller[_0x4684('0xe')]);router[_0x4684('0x7')]('/:id/preferred',controller[_0x4684('0xf')]);router[_0x4684('0x7')](_0x4684('0x10'),controller[_0x4684('0x11')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2cc354,_0xe379aa,_0x136f7e){_0x136f7e(null,path[_0x4684('0x12')](config[_0x4684('0x13')],_0x4684('0x14')));},'filename':function(_0x1f9c59,_0x45179e,_0x357cec){_0x357cec(null,util[_0x4684('0x15')](_0x4684('0x16'),'logo',path['extname'](_0x45179e[_0x4684('0x17')])));}})});router[_0x4684('0x18')]('/:id/logo',upload[_0x4684('0x19')](_0x4684('0x1a')),controller['addLogo']);var upload=multer({'storage':multer[_0x4684('0x1b')]({'destination':function(_0x52da4f,_0x5596c6,_0x5700d6){_0x5700d6(null,path['join'](config[_0x4684('0x13')],_0x4684('0x14')));},'filename':function(_0x95d016,_0x39e0cc,_0x466891){_0x466891(null,util['format'](_0x4684('0x16'),'logologin',path[_0x4684('0x1c')](_0x39e0cc[_0x4684('0x17')])));}})});router[_0x4684('0x18')](_0x4684('0xc'),upload[_0x4684('0x19')](_0x4684('0x1a')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x4684('0x1b')]({'destination':function(_0x88db58,_0x6f60cc,_0x546215){_0x546215(null,path[_0x4684('0x12')](config[_0x4684('0x13')],_0x4684('0x14')));},'filename':function(_0x560c20,_0x49d264,_0x4eaa40){_0x4eaa40(null,util[_0x4684('0x15')](_0x4684('0x16'),_0x4684('0x1d'),path['extname'](_0x49d264[_0x4684('0x17')])));}})});router[_0x4684('0x18')](_0x4684('0x1e'),upload[_0x4684('0x19')](_0x4684('0x1a')),controller['addPreferred']);var upload=multer({'storage':multer[_0x4684('0x1b')]({'destination':function(_0x23be65,_0xb79358,_0xe2eb9b){_0xe2eb9b(null,path[_0x4684('0x12')](config[_0x4684('0x13')],'server/files/images/logos/'));},'filename':function(_0x1baf43,_0x5b71ee,_0x2878e0){_0x2878e0(null,util[_0x4684('0x15')](_0x4684('0x16'),_0x4684('0x1f'),path['extname'](_0x5b71ee['originalname'])));}})});router[_0x4684('0x18')](_0x4684('0x10'),upload[_0x4684('0x19')](_0x4684('0x1a')),controller['addFavicon']);router['put']('/:id',auth[_0x4684('0x20')](),controller['update']);module[_0x4684('0x21')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 85e12c0..13ddabb 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 _0x34e8=['https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x4e38fd,_0x13d776){var _0x2fe8b7=function(_0x22127a){while(--_0x22127a){_0x4e38fd['push'](_0x4e38fd['shift']());}};_0x2fe8b7(++_0x13d776);}(_0x34e8,0x12c));var _0x834e=function(_0x5b74cf,_0x45e299){_0x5b74cf=_0x5b74cf-0x0;var _0x18b76e=_0x34e8[_0x5b74cf];return _0x18b76e;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'min_internal':{'type':Sequelize[_0x834e('0x2')](0xb),'unique':_0x834e('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x834e('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x834e('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x834e('0x5')],'defaultValue':_0x834e('0x6')},'logo':{'type':Sequelize[_0x834e('0x5')]},'defaultLogo':{'type':Sequelize[_0x834e('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x834e('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x834e('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x834e('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x834e('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x834e('0x5')]},'turnaddr':{'type':Sequelize[_0x834e('0x5')]},'turnusername':{'type':Sequelize[_0x834e('0x5')]},'turnpassword':{'type':Sequelize[_0x834e('0x5')]},'pageTitle':{'type':Sequelize[_0x834e('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x834e('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x834e('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x834e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x834e('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x834e('0x5')],'defaultValue':_0x834e('0x8')},'enableEmailPreview':{'type':Sequelize[_0x834e('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x834e('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x834e('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x834e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x834e('0x5')],'defaultValue':_0x834e('0x9')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x834e('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x834e('0x5')]},'defaultPreferred':{'type':Sequelize[_0x834e('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x834e('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x834e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x834e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x834e('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x834e('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x834e('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x834e('0x5')]},'sentiment':{'type':Sequelize[_0x834e('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x834e('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x834e('0x5')]},'language':{'type':Sequelize[_0x834e('0x5')]},'bucket':{'type':Sequelize[_0x834e('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x834e('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x834e('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x834e('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x834e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x834e('0x2')](0x2)[_0x834e('0xa')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x834e('0x2')](0x2)[_0x834e('0xa')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x834e('0xa')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x834e('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x834e('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x834e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x834e('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x834e('0x7')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x834e('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x44731a,_0x3417bb){var _0x5541bd=function(_0x26d125){while(--_0x26d125){_0x44731a['push'](_0x44731a['shift']());}};_0x5541bd(++_0x3417bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 8bd2945..c8ce6fd 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 _0x21d1=['request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','offset','undefined','limit','count','json','apply','reject','save','update','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','params','keys','body','file','filename','find','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','Sequelize','ValidationError','download','getLogoLogin','defaultLoginLogo','upperFirst','custom','default_loginLogo.svg','\x20not\x20found','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','http'];(function(_0x28f32c,_0x4cc342){var _0x355402=function(_0xdb5032){while(--_0xdb5032){_0x28f32c['push'](_0x28f32c['shift']());}};_0x355402(++_0x4cc342);}(_0x21d1,0x1c9));var _0x121d=function(_0x4589da,_0x4e4e39){_0x4589da=_0x4589da-0x0;var _0x14df7c=_0x21d1[_0x4589da];return _0x14df7c;};'use strict';var emlformat=require(_0x121d('0x0'));var rimraf=require(_0x121d('0x1'));var zipdir=require(_0x121d('0x2'));var jsonpatch=require(_0x121d('0x3'));var rp=require(_0x121d('0x4'));var moment=require(_0x121d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x121d('0x6'));var path=require(_0x121d('0x7'));var sox=require(_0x121d('0x8'));var csv=require(_0x121d('0x9'));var ejs=require(_0x121d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x121d('0xb'));var squel=require(_0x121d('0xc'));var crypto=require(_0x121d('0xd'));var jsforce=require(_0x121d('0xe'));var deskjs=require(_0x121d('0xf'));var toCsv=require(_0x121d('0x9'));var querystring=require(_0x121d('0x10'));var Papa=require(_0x121d('0x11'));var Redis=require(_0x121d('0x12'));var authService=require(_0x121d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x121d('0x14'));var hardwareService=require(_0x121d('0x15'));var logger=require(_0x121d('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x121d('0x17'));var licenseUtil=require(_0x121d('0x18'));var db=require(_0x121d('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x121d('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x54a257,_0x1bb2cb,_0x580862,_0x280c80){return new BPromise(function(_0x48e4ce,_0x224e01){var _0x10786c=_0x280c80||client;return _0x10786c[_0x121d('0x1b')](_0x54a257,_0x580862)[_0x121d('0x1c')](function(_0x13f76a){logger[_0x121d('0x1d')](_0x121d('0x1e'),_0x1bb2cb,_0x121d('0x1f'));logger[_0x121d('0x20')](_0x121d('0x21'),_0x1bb2cb,_0x121d('0x1f'),JSON[_0x121d('0x22')](_0x13f76a));if(_0x13f76a[_0x121d('0x23')]){if(_0x13f76a['error']['code']===0x1f4){logger['error'](_0x121d('0x1e'),_0x1bb2cb,_0x13f76a[_0x121d('0x23')]['message']);return _0x224e01(_0x13f76a[_0x121d('0x23')][_0x121d('0x24')]);}logger[_0x121d('0x23')](_0x121d('0x1e'),_0x1bb2cb,_0x13f76a[_0x121d('0x23')][_0x121d('0x24')]);return _0x48e4ce(_0x13f76a[_0x121d('0x23')][_0x121d('0x24')]);}else{logger[_0x121d('0x1d')](_0x121d('0x1e'),_0x1bb2cb,_0x121d('0x1f'));_0x48e4ce(_0x13f76a[_0x121d('0x25')][_0x121d('0x24')]);}})[_0x121d('0x26')](function(_0x368f20){logger[_0x121d('0x23')](_0x121d('0x1e'),_0x1bb2cb,_0x368f20);_0x224e01(_0x368f20);});});}function respondWithStatusCode(_0x208a7c,_0x331e9c){_0x331e9c=_0x331e9c||0xcc;return function(_0x1de3f8){if(_0x1de3f8){return _0x208a7c[_0x121d('0x27')](_0x331e9c);}return _0x208a7c['status'](_0x331e9c)[_0x121d('0x28')]();};}function respondWithResult(_0x18392c,_0x78cb1a){_0x78cb1a=_0x78cb1a||0xc8;return function(_0x29bf27){if(_0x29bf27){return _0x18392c[_0x121d('0x29')](_0x78cb1a)['json'](_0x29bf27);}};}function respondWithFilteredResult(_0x2255e7,_0x54eb38){return function(_0x2aa75c){if(_0x2aa75c){var _0x2697f0=typeof _0x54eb38[_0x121d('0x2a')]===_0x121d('0x2b')&&typeof _0x54eb38[_0x121d('0x2c')]===_0x121d('0x2b');var _0x6cb2ce=_0x2aa75c[_0x121d('0x2d')];var _0x309e30=_0x2697f0?0x0:_0x54eb38[_0x121d('0x2a')];var _0x4d6638=_0x2697f0?_0x2aa75c[_0x121d('0x2d')]:_0x54eb38['offset']+_0x54eb38[_0x121d('0x2c')];var _0xce0cac;if(_0x4d6638>=_0x6cb2ce){_0x4d6638=_0x6cb2ce;_0xce0cac=0xc8;}else{_0xce0cac=0xce;}_0x2255e7[_0x121d('0x29')](_0xce0cac);return _0x2255e7['set']('Content-Range',_0x309e30+'-'+_0x4d6638+'/'+_0x6cb2ce)[_0x121d('0x2e')](_0x2aa75c);}return null;};}function patchUpdates(_0xd95b6b){return function(_0x308e96){try{jsonpatch[_0x121d('0x2f')](_0x308e96,_0xd95b6b,!![]);}catch(_0x28126d){return BPromise[_0x121d('0x30')](_0x28126d);}return _0x308e96[_0x121d('0x31')]();};}function saveUpdates(_0x4d5314,_0x1cf82c){return function(_0x14b8f4){if(_0x14b8f4){return _0x14b8f4[_0x121d('0x32')](_0x4d5314)[_0x121d('0x1c')](function(_0x3196ba){return _0x3196ba;});}return null;};}function removeEntity(_0x4346a7,_0xff170f){return function(_0x250436){if(_0x250436){return _0x250436['destroy']()[_0x121d('0x1c')](function(){_0x4346a7[_0x121d('0x29')](0xcc)[_0x121d('0x28')]();});}};}function handleEntityNotFound(_0x42781d,_0x588f1d){return function(_0x2507ec){if(!_0x2507ec){_0x42781d[_0x121d('0x27')](0x194);}return _0x2507ec;};}function handleError(_0x1c626a,_0x16dc47){_0x16dc47=_0x16dc47||0x1f4;return function(_0x4af480){logger[_0x121d('0x23')](_0x4af480[_0x121d('0x33')]);if(_0x4af480[_0x121d('0x34')]){delete _0x4af480['name'];}_0x1c626a[_0x121d('0x29')](_0x16dc47)[_0x121d('0x35')](_0x4af480);};}exports[_0x121d('0x36')]=function(_0x75d06b,_0x152ec6){var _0x10c83c={},_0x2487fa={},_0x546264={'count':0x0,'rows':[]};var _0x3767c2=_[_0x121d('0x37')](db[_0x121d('0x38')][_0x121d('0x39')],function(_0x4b6e54){return{'name':_0x4b6e54[_0x121d('0x3a')],'type':_0x4b6e54[_0x121d('0x3b')][_0x121d('0x3c')]};});_0x2487fa[_0x121d('0x3d')]=_[_0x121d('0x37')](_0x3767c2,_0x121d('0x34'));_0x2487fa[_0x121d('0x3e')]=_['keys'](_0x75d06b[_0x121d('0x3e')]);_0x2487fa[_0x121d('0x3f')]=_[_0x121d('0x40')](_0x2487fa[_0x121d('0x3d')],_0x2487fa[_0x121d('0x3e')]);_0x10c83c[_0x121d('0x41')]=_[_0x121d('0x40')](_0x2487fa['model'],qs[_0x121d('0x42')](_0x75d06b['query']['fields']));_0x10c83c[_0x121d('0x41')]=_0x10c83c[_0x121d('0x41')][_0x121d('0x43')]?_0x10c83c['attributes']:_0x2487fa['model'];if(!_0x75d06b[_0x121d('0x3e')]['hasOwnProperty'](_0x121d('0x44'))){_0x10c83c[_0x121d('0x2c')]=qs['limit'](_0x75d06b[_0x121d('0x3e')][_0x121d('0x2c')]);_0x10c83c['offset']=qs['offset'](_0x75d06b[_0x121d('0x3e')][_0x121d('0x2a')]);}_0x10c83c['order']=qs['sort'](_0x75d06b['query']['sort']);_0x10c83c[_0x121d('0x45')]=qs[_0x121d('0x3f')](_[_0x121d('0x46')](_0x75d06b[_0x121d('0x3e')],_0x2487fa[_0x121d('0x3f')]),_0x3767c2);if(_0x75d06b[_0x121d('0x3e')][_0x121d('0x47')]){_0x10c83c[_0x121d('0x45')]=_['merge'](_0x10c83c[_0x121d('0x45')],{'$or':_[_0x121d('0x37')](_0x3767c2,function(_0x58db87){if(_0x58db87[_0x121d('0x3b')]!==_0x121d('0x48')){var _0x4ba57c={};_0x4ba57c[_0x58db87[_0x121d('0x34')]]={'$like':'%'+_0x75d06b[_0x121d('0x3e')][_0x121d('0x47')]+'%'};return _0x4ba57c;}})});}_0x10c83c=_[_0x121d('0x49')]({},_0x10c83c,_0x75d06b[_0x121d('0x4a')]);var _0x398681={'where':_0x10c83c['where']};return db['Setting'][_0x121d('0x2d')](_0x398681)[_0x121d('0x1c')](function(_0x3e70c3){_0x546264[_0x121d('0x2d')]=_0x3e70c3;if(_0x75d06b[_0x121d('0x3e')][_0x121d('0x4b')]){_0x10c83c[_0x121d('0x4c')]=[{'all':!![]}];}return db['Setting'][_0x121d('0x4d')](_0x10c83c);})['then'](function(_0x275c79){_0x546264['rows']=_0x275c79;return _0x546264;})[_0x121d('0x1c')](respondWithFilteredResult(_0x152ec6,_0x10c83c))[_0x121d('0x26')](handleError(_0x152ec6,null));};exports['show']=function(_0x2b5c6b,_0x295fd8){var _0x2039ff={'raw':![],'where':{'id':_0x2b5c6b[_0x121d('0x4e')]['id']}},_0x43fc76={};_0x43fc76[_0x121d('0x3d')]=_[_0x121d('0x4f')](db['Setting'][_0x121d('0x39')]);_0x43fc76[_0x121d('0x3e')]=_[_0x121d('0x4f')](_0x2b5c6b[_0x121d('0x3e')]);_0x43fc76['filters']=_[_0x121d('0x40')](_0x43fc76['model'],_0x43fc76[_0x121d('0x3e')]);_0x2039ff[_0x121d('0x41')]=_['intersection'](_0x43fc76[_0x121d('0x3d')],qs[_0x121d('0x42')](_0x2b5c6b['query'][_0x121d('0x42')]));_0x2039ff[_0x121d('0x41')]=_0x2039ff['attributes']['length']?_0x2039ff[_0x121d('0x41')]:_0x43fc76['model'];if(_0x2b5c6b[_0x121d('0x3e')][_0x121d('0x4b')]){_0x2039ff[_0x121d('0x4c')]=[{'all':!![]}];}_0x2039ff=_['merge']({},_0x2039ff,_0x2b5c6b['options']);return db[_0x121d('0x38')]['find'](_0x2039ff)[_0x121d('0x1c')](handleEntityNotFound(_0x295fd8,null))[_0x121d('0x1c')](respondWithResult(_0x295fd8,null))['catch'](handleError(_0x295fd8,null));};exports[_0x121d('0x32')]=function(_0x1e3e35,_0x20021f){if(_0x1e3e35[_0x121d('0x50')]['id']){delete _0x1e3e35[_0x121d('0x50')]['id'];}return db[_0x121d('0x38')]['find']({'where':{'id':_0x1e3e35[_0x121d('0x4e')]['id']}})[_0x121d('0x1c')](handleEntityNotFound(_0x20021f,null))[_0x121d('0x1c')](saveUpdates(_0x1e3e35['body'],null))[_0x121d('0x1c')](respondWithResult(_0x20021f,null))['catch'](handleError(_0x20021f,null));};exports['addLogo']=function(_0x8313f2,_0xa33419,_0x14b0d9){if(_0x8313f2[_0x121d('0x51')]&&_0x8313f2[_0x121d('0x51')][_0x121d('0x52')]){_0x8313f2['body']['logo']=_0x8313f2[_0x121d('0x51')]['filename'];}return db[_0x121d('0x38')][_0x121d('0x53')]({'where':{'id':_0x8313f2[_0x121d('0x4e')]['id']}})['then'](handleEntityNotFound(_0xa33419,null))[_0x121d('0x1c')](saveUpdates(_0x8313f2[_0x121d('0x50')],null))['then'](respondWithResult(_0xa33419,null))[_0x121d('0x26')](handleError(_0xa33419,null));};exports[_0x121d('0x54')]=function(_0x539542,_0x5f2b91,_0x5c3179){if(_0x539542['file']&&_0x539542[_0x121d('0x51')][_0x121d('0x52')]){_0x539542[_0x121d('0x50')][_0x121d('0x55')]=_0x539542[_0x121d('0x51')][_0x121d('0x52')];}return db[_0x121d('0x38')][_0x121d('0x53')]({'where':{'id':_0x539542[_0x121d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5f2b91,null))[_0x121d('0x1c')](saveUpdates(_0x539542[_0x121d('0x50')],null))['then'](respondWithResult(_0x5f2b91,null))[_0x121d('0x26')](handleError(_0x5f2b91,null));};var utilLicense=require(_0x121d('0x18'));exports[_0x121d('0x56')]=function(_0x38919f,_0x40eaa8,_0x3103b3){var _0x5cc26a=_0x121d('0x57');var _0x4414a8={'custom':![]};return utilLicense[_0x121d('0x58')]()[_0x121d('0x1c')](function(_0x1ea7fe){if(_0x1ea7fe){_0x4414a8=_0x1ea7fe;}return db[_0x121d('0x38')][_0x121d('0x53')]({'where':{'id':_0x38919f[_0x121d('0x4e')]['id']},'attributes':[_0x121d('0x59'),_0x121d('0x55'),_0x121d('0x5a'),_0x121d('0x5b'),_0x121d('0x5c'),'defaultLoginLogo',_0x121d('0x5d'),_0x121d('0x5e')],'raw':!![]});})[_0x121d('0x1c')](handleEntityNotFound(_0x40eaa8,null))['then'](function(_0x3dcbfd){if(_0x3dcbfd){var _0x524210=_0x3dcbfd[_0x121d('0x59')]&&fs[_0x121d('0x5f')](path['join'](config['root'],_0x5cc26a,_['toLower'](_0x3dcbfd['logo'])))?path[_0x121d('0x60')](config[_0x121d('0x61')],_0x5cc26a,_[_0x121d('0x62')](_0x3dcbfd[_0x121d('0x59')])):path[_0x121d('0x60')](config['root'],_0x5cc26a,_[_0x121d('0x62')](_0x121d('0x63')));var _0x108739=_0x121d('0x64')+_['upperFirst'](_0x121d('0x59'));if(_0x3dcbfd[_0x108739]||!_0x4414a8['custom']){_0x524210=path[_0x121d('0x60')](config['root'],_0x5cc26a,_[_0x121d('0x62')](_0x121d('0x63')));}if(!fs[_0x121d('0x5f')](_0x524210)){throw new db[(_0x121d('0x65'))][(_0x121d('0x66'))](_['upperFirst'](_0x121d('0x59'))+'\x20not\x20found');}return _0x40eaa8[_0x121d('0x67')](_0x524210);}})['catch'](handleError(_0x40eaa8,null));};var utilLicense=require(_0x121d('0x18'));exports[_0x121d('0x68')]=function(_0x271d94,_0x48c5cd,_0x11c78c){var _0x26ea0a=_0x121d('0x57');var _0x5c7c84={'custom':![]};return utilLicense['getLicense']()[_0x121d('0x1c')](function(_0x52a4eb){if(_0x52a4eb){_0x5c7c84=_0x52a4eb;}return db[_0x121d('0x38')][_0x121d('0x53')]({'where':{'id':_0x271d94[_0x121d('0x4e')]['id']},'attributes':[_0x121d('0x59'),'loginLogo','preferred','favicon',_0x121d('0x5c'),_0x121d('0x69'),_0x121d('0x5d'),'defaultFavicon'],'raw':!![]});})[_0x121d('0x1c')](handleEntityNotFound(_0x48c5cd,null))[_0x121d('0x1c')](function(_0x2caa3a){if(_0x2caa3a){var _0x33495e=_0x2caa3a[_0x121d('0x55')]&&fs[_0x121d('0x5f')](path[_0x121d('0x60')](config[_0x121d('0x61')],_0x26ea0a,_[_0x121d('0x62')](_0x2caa3a[_0x121d('0x55')])))?path[_0x121d('0x60')](config[_0x121d('0x61')],_0x26ea0a,_[_0x121d('0x62')](_0x2caa3a['loginLogo'])):path[_0x121d('0x60')](config['root'],_0x26ea0a,_['toLower']('default_loginLogo.svg'));var _0x4bf245=_0x121d('0x64')+_[_0x121d('0x6a')]('loginLogo');if(_0x2caa3a[_0x4bf245]||!_0x5c7c84[_0x121d('0x6b')]){_0x33495e=path[_0x121d('0x60')](config[_0x121d('0x61')],_0x26ea0a,_[_0x121d('0x62')](_0x121d('0x6c')));}if(!fs[_0x121d('0x5f')](_0x33495e)){throw new db[(_0x121d('0x65'))][(_0x121d('0x66'))](_[_0x121d('0x6a')](_0x121d('0x55'))+_0x121d('0x6d'));}return _0x48c5cd['download'](_0x33495e);}})[_0x121d('0x26')](handleError(_0x48c5cd,null));};exports[_0x121d('0x6e')]=function(_0x59caf1,_0x58f1fa){return db['Setting']['find']({'where':{'id':_0x59caf1[_0x121d('0x4e')]['id']},'attributes':[_0x121d('0x6f')]})[_0x121d('0x1c')](respondWithResult(_0x58f1fa,null))[_0x121d('0x26')](handleError(_0x58f1fa,null));};exports[_0x121d('0x70')]=function(_0x456c1e,_0x1ad107,_0x4d93f6){if(_0x456c1e[_0x121d('0x51')]&&_0x456c1e[_0x121d('0x51')][_0x121d('0x52')]){_0x456c1e['body'][_0x121d('0x5a')]=_0x456c1e[_0x121d('0x51')]['filename'];}return db[_0x121d('0x38')][_0x121d('0x53')]({'where':{'id':_0x456c1e[_0x121d('0x4e')]['id']}})[_0x121d('0x1c')](handleEntityNotFound(_0x1ad107,null))[_0x121d('0x1c')](saveUpdates(_0x456c1e[_0x121d('0x50')],null))['then'](respondWithResult(_0x1ad107,null))[_0x121d('0x26')](handleError(_0x1ad107,null));};var utilLicense=require(_0x121d('0x18'));exports[_0x121d('0x71')]=function(_0xeeaaa8,_0x2bcd66,_0x168caf){var _0x1d7294=_0x121d('0x57');var _0x13c9e0={'custom':![]};return utilLicense[_0x121d('0x58')]()[_0x121d('0x1c')](function(_0xa526d1){if(_0xa526d1){_0x13c9e0=_0xa526d1;}return db[_0x121d('0x38')][_0x121d('0x53')]({'where':{'id':_0xeeaaa8[_0x121d('0x4e')]['id']},'attributes':[_0x121d('0x59'),_0x121d('0x55'),_0x121d('0x5a'),_0x121d('0x5b'),'defaultLogo','defaultLoginLogo',_0x121d('0x5d'),_0x121d('0x5e')],'raw':!![]});})[_0x121d('0x1c')](handleEntityNotFound(_0x2bcd66,null))['then'](function(_0x1b317c){if(_0x1b317c){var _0x422e1c=_0x1b317c[_0x121d('0x5a')]&&fs['existsSync'](path[_0x121d('0x60')](config['root'],_0x1d7294,_[_0x121d('0x62')](_0x1b317c[_0x121d('0x5a')])))?path[_0x121d('0x60')](config[_0x121d('0x61')],_0x1d7294,_['toLower'](_0x1b317c[_0x121d('0x5a')])):path[_0x121d('0x60')](config[_0x121d('0x61')],_0x1d7294,_[_0x121d('0x62')](_0x121d('0x72')));var _0x35d82b=_0x121d('0x64')+_['upperFirst'](_0x121d('0x5a'));if(_0x1b317c[_0x35d82b]||!_0x13c9e0[_0x121d('0x6b')]||!_0x13c9e0[_0x121d('0x5a')]){_0x422e1c=path[_0x121d('0x60')](config[_0x121d('0x61')],_0x1d7294,_[_0x121d('0x62')](_0x121d('0x72')));}if(!fs[_0x121d('0x5f')](_0x422e1c)){throw new db[(_0x121d('0x65'))][(_0x121d('0x66'))](_['upperFirst'](_0x121d('0x5a'))+_0x121d('0x6d'));}return _0x2bcd66[_0x121d('0x67')](_0x422e1c);}})[_0x121d('0x26')](handleError(_0x2bcd66,null));};exports['addFavicon']=function(_0x4f7f28,_0x5f001b,_0x10a26b){if(_0x4f7f28[_0x121d('0x51')]&&_0x4f7f28[_0x121d('0x51')][_0x121d('0x52')]){_0x4f7f28[_0x121d('0x50')]['favicon']=_0x4f7f28[_0x121d('0x51')][_0x121d('0x52')];}return db['Setting']['find']({'where':{'id':_0x4f7f28[_0x121d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5f001b,null))[_0x121d('0x1c')](saveUpdates(_0x4f7f28['body'],null))[_0x121d('0x1c')](respondWithResult(_0x5f001b,null))[_0x121d('0x26')](handleError(_0x5f001b,null));};var utilLicense=require(_0x121d('0x18'));exports[_0x121d('0x73')]=function(_0x528159,_0x21c901,_0x5eb043){var _0x40061e=_0x121d('0x57');var _0x1867c8={'custom':![]};return utilLicense[_0x121d('0x58')]()[_0x121d('0x1c')](function(_0xab222a){if(_0xab222a){_0x1867c8=_0xab222a;}return db['Setting'][_0x121d('0x53')]({'where':{'id':_0x528159['params']['id']},'attributes':['logo',_0x121d('0x55'),_0x121d('0x5a'),_0x121d('0x5b'),'defaultLogo',_0x121d('0x69'),_0x121d('0x5d'),_0x121d('0x5e')],'raw':!![]});})[_0x121d('0x1c')](handleEntityNotFound(_0x21c901,null))['then'](function(_0x516673){if(_0x516673){var _0x49545c=_0x516673[_0x121d('0x5b')]&&fs['existsSync'](path['join'](config[_0x121d('0x61')],_0x40061e,_['toLower'](_0x516673[_0x121d('0x5b')])))?path[_0x121d('0x60')](config[_0x121d('0x61')],_0x40061e,_[_0x121d('0x62')](_0x516673[_0x121d('0x5b')])):path[_0x121d('0x60')](config['root'],_0x40061e,_['toLower'](_0x121d('0x74')));var _0x27d159=_0x121d('0x64')+_[_0x121d('0x6a')](_0x121d('0x5b'));if(_0x516673[_0x27d159]||!_0x1867c8[_0x121d('0x6b')]){_0x49545c=path[_0x121d('0x60')](config[_0x121d('0x61')],_0x40061e,_[_0x121d('0x62')]('default_favicon.ico'));}if(!fs[_0x121d('0x5f')](_0x49545c)){throw new db[(_0x121d('0x65'))][(_0x121d('0x66'))](_['upperFirst']('favicon')+_0x121d('0x6d'));}return _0x21c901['download'](_0x49545c);}})[_0x121d('0x26')](handleError(_0x21c901,null));};exports[_0x121d('0x75')]=function(_0x3066e3,_0x3a3644){var _0x3a31eb={'offset':moment()[_0x121d('0x76')]()};_0x3a31eb[_0x121d('0x77')]=moment()[_0x121d('0x76')](_0x3a31eb[_0x121d('0x2a')])[_0x121d('0x78')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x3a3644['status'](0xc8)[_0x121d('0x35')](_0x3a31eb);}; \ No newline at end of file +var _0xac9d=['key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','where','includeAll','include','findAll','rows','show','params','keys','length','options','find','body','addLogo','file','filename','logo','addLogoLogin','getLogo','server/files/images/logos','loginLogo','preferred','defaultLogo','defaultFavicon','root','toLower','join','default_logo.svg','default','upperFirst','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','getLicense','favicon','defaultLoginLogo','defaultPreferred','existsSync','default_loginLogo.svg','securePassword','addPreferred','default_preferred.png','custom','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','Setting','rawAttributes','fieldName','type'];(function(_0x534393,_0x121ae0){var _0x4626b3=function(_0x368044){while(--_0x368044){_0x534393['push'](_0x534393['shift']());}};_0x4626b3(++_0x121ae0);}(_0xac9d,0x14d));var _0xdac9=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0xac9d[_0x243217];return _0x478029;};'use strict';var emlformat=require(_0xdac9('0x0'));var rimraf=require(_0xdac9('0x1'));var zipdir=require(_0xdac9('0x2'));var jsonpatch=require(_0xdac9('0x3'));var rp=require(_0xdac9('0x4'));var moment=require(_0xdac9('0x5'));var BPromise=require(_0xdac9('0x6'));var Mustache=require(_0xdac9('0x7'));var util=require('util');var path=require(_0xdac9('0x8'));var sox=require('sox');var csv=require(_0xdac9('0x9'));var ejs=require(_0xdac9('0xa'));var fs=require('fs');var fs_extra=require(_0xdac9('0xb'));var _=require(_0xdac9('0xc'));var squel=require(_0xdac9('0xd'));var crypto=require(_0xdac9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdac9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdac9('0x10'));var Papa=require(_0xdac9('0x11'));var Redis=require(_0xdac9('0x12'));var authService=require(_0xdac9('0x13'));var qs=require(_0xdac9('0x14'));var as=require(_0xdac9('0x15'));var hardwareService=require(_0xdac9('0x16'));var logger=require(_0xdac9('0x17'))(_0xdac9('0x18'));var utils=require('../../config/utils');var config=require(_0xdac9('0x19'));var licenseUtil=require(_0xdac9('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0xdac9('0x1b'));var client=jayson[_0xdac9('0x1c')][_0xdac9('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4b2436,_0x16063f,_0x33ba20,_0x9e1bf6){return new BPromise(function(_0x5f0bbd,_0x5dd536){var _0x52cbd4=_0x9e1bf6||client;return _0x52cbd4[_0xdac9('0x1e')](_0x4b2436,_0x33ba20)['then'](function(_0x76af7a){logger[_0xdac9('0x1f')](_0xdac9('0x20'),_0x16063f,_0xdac9('0x21'));logger[_0xdac9('0x22')](_0xdac9('0x23'),_0x16063f,_0xdac9('0x21'),JSON[_0xdac9('0x24')](_0x76af7a));if(_0x76af7a['error']){if(_0x76af7a[_0xdac9('0x25')][_0xdac9('0x26')]===0x1f4){logger['error'](_0xdac9('0x20'),_0x16063f,_0x76af7a[_0xdac9('0x25')][_0xdac9('0x27')]);return _0x5dd536(_0x76af7a[_0xdac9('0x25')]['message']);}logger['error'](_0xdac9('0x20'),_0x16063f,_0x76af7a[_0xdac9('0x25')][_0xdac9('0x27')]);return _0x5f0bbd(_0x76af7a[_0xdac9('0x25')]['message']);}else{logger[_0xdac9('0x1f')](_0xdac9('0x20'),_0x16063f,_0xdac9('0x21'));_0x5f0bbd(_0x76af7a[_0xdac9('0x28')][_0xdac9('0x27')]);}})[_0xdac9('0x29')](function(_0x41335a){logger[_0xdac9('0x25')](_0xdac9('0x20'),_0x16063f,_0x41335a);_0x5dd536(_0x41335a);});});}function respondWithStatusCode(_0x33de5c,_0x5a0fa2){_0x5a0fa2=_0x5a0fa2||0xcc;return function(_0x2943f5){if(_0x2943f5){return _0x33de5c[_0xdac9('0x2a')](_0x5a0fa2);}return _0x33de5c[_0xdac9('0x2b')](_0x5a0fa2)[_0xdac9('0x2c')]();};}function respondWithResult(_0x5ca076,_0x1e631a){_0x1e631a=_0x1e631a||0xc8;return function(_0x5686db){if(_0x5686db){return _0x5ca076[_0xdac9('0x2b')](_0x1e631a)[_0xdac9('0x2d')](_0x5686db);}};}function respondWithFilteredResult(_0x566d8c,_0x433be9){return function(_0x5105f1){if(_0x5105f1){var _0x450f91=typeof _0x433be9[_0xdac9('0x2e')]===_0xdac9('0x2f')&&typeof _0x433be9[_0xdac9('0x30')]==='undefined';var _0x4b87bc=_0x5105f1[_0xdac9('0x31')];var _0x170afd=_0x450f91?0x0:_0x433be9['offset'];var _0x4c4e21=_0x450f91?_0x5105f1[_0xdac9('0x31')]:_0x433be9[_0xdac9('0x2e')]+_0x433be9[_0xdac9('0x30')];var _0x2dbb7a;if(_0x4c4e21>=_0x4b87bc){_0x4c4e21=_0x4b87bc;_0x2dbb7a=0xc8;}else{_0x2dbb7a=0xce;}_0x566d8c[_0xdac9('0x2b')](_0x2dbb7a);return _0x566d8c[_0xdac9('0x32')](_0xdac9('0x33'),_0x170afd+'-'+_0x4c4e21+'/'+_0x4b87bc)[_0xdac9('0x2d')](_0x5105f1);}return null;};}function patchUpdates(_0x406ed0){return function(_0x2f36f4){try{jsonpatch[_0xdac9('0x34')](_0x2f36f4,_0x406ed0,!![]);}catch(_0x42c276){return BPromise[_0xdac9('0x35')](_0x42c276);}return _0x2f36f4[_0xdac9('0x36')]();};}function saveUpdates(_0x410cec,_0x446080){return function(_0x372f02){if(_0x372f02){return _0x372f02[_0xdac9('0x37')](_0x410cec)[_0xdac9('0x38')](function(_0x20397e){return _0x20397e;});}return null;};}function removeEntity(_0x92c891,_0x514eee){return function(_0x5e7ebe){if(_0x5e7ebe){return _0x5e7ebe[_0xdac9('0x39')]()[_0xdac9('0x38')](function(){_0x92c891[_0xdac9('0x2b')](0xcc)[_0xdac9('0x2c')]();});}};}function handleEntityNotFound(_0x15dc5f,_0x49d59f){return function(_0x1d125a){if(!_0x1d125a){_0x15dc5f['sendStatus'](0x194);}return _0x1d125a;};}function handleError(_0xe8b2a8,_0x2a611e){_0x2a611e=_0x2a611e||0x1f4;return function(_0x5cfebf){logger[_0xdac9('0x25')](_0x5cfebf['stack']);if(_0x5cfebf['name']){delete _0x5cfebf[_0xdac9('0x3a')];}_0xe8b2a8[_0xdac9('0x2b')](_0x2a611e)[_0xdac9('0x3b')](_0x5cfebf);};}exports[_0xdac9('0x3c')]=function(_0x3bab10,_0x363d93){var _0x51cde6={},_0x265975={},_0x22ca1d={'count':0x0,'rows':[]};var _0x5608c2=_[_0xdac9('0x3d')](db[_0xdac9('0x3e')][_0xdac9('0x3f')],function(_0x27bdfb){return{'name':_0x27bdfb[_0xdac9('0x40')],'type':_0x27bdfb[_0xdac9('0x41')][_0xdac9('0x42')]};});_0x265975['model']=_[_0xdac9('0x3d')](_0x5608c2,_0xdac9('0x3a'));_0x265975[_0xdac9('0x43')]=_['keys'](_0x3bab10[_0xdac9('0x43')]);_0x265975[_0xdac9('0x44')]=_[_0xdac9('0x45')](_0x265975[_0xdac9('0x46')],_0x265975['query']);_0x51cde6['attributes']=_[_0xdac9('0x45')](_0x265975[_0xdac9('0x46')],qs[_0xdac9('0x47')](_0x3bab10[_0xdac9('0x43')][_0xdac9('0x47')]));_0x51cde6['attributes']=_0x51cde6[_0xdac9('0x48')]['length']?_0x51cde6[_0xdac9('0x48')]:_0x265975[_0xdac9('0x46')];if(!_0x3bab10[_0xdac9('0x43')][_0xdac9('0x49')](_0xdac9('0x4a'))){_0x51cde6[_0xdac9('0x30')]=qs[_0xdac9('0x30')](_0x3bab10[_0xdac9('0x43')][_0xdac9('0x30')]);_0x51cde6[_0xdac9('0x2e')]=qs[_0xdac9('0x2e')](_0x3bab10[_0xdac9('0x43')][_0xdac9('0x2e')]);}_0x51cde6[_0xdac9('0x4b')]=qs['sort'](_0x3bab10[_0xdac9('0x43')][_0xdac9('0x4c')]);_0x51cde6['where']=qs[_0xdac9('0x44')](_[_0xdac9('0x4d')](_0x3bab10[_0xdac9('0x43')],_0x265975[_0xdac9('0x44')]),_0x5608c2);if(_0x3bab10[_0xdac9('0x43')][_0xdac9('0x4e')]){_0x51cde6['where']=_[_0xdac9('0x4f')](_0x51cde6['where'],{'$or':_[_0xdac9('0x3d')](_0x5608c2,function(_0x2ade08){if(_0x2ade08[_0xdac9('0x41')]!==_0xdac9('0x50')){var _0x5e61ac={};_0x5e61ac[_0x2ade08['name']]={'$like':'%'+_0x3bab10['query'][_0xdac9('0x4e')]+'%'};return _0x5e61ac;}})});}_0x51cde6=_['merge']({},_0x51cde6,_0x3bab10['options']);var _0x4159fd={'where':_0x51cde6[_0xdac9('0x51')]};return db['Setting']['count'](_0x4159fd)[_0xdac9('0x38')](function(_0x24f045){_0x22ca1d[_0xdac9('0x31')]=_0x24f045;if(_0x3bab10[_0xdac9('0x43')][_0xdac9('0x52')]){_0x51cde6[_0xdac9('0x53')]=[{'all':!![]}];}return db[_0xdac9('0x3e')][_0xdac9('0x54')](_0x51cde6);})['then'](function(_0x621cf){_0x22ca1d[_0xdac9('0x55')]=_0x621cf;return _0x22ca1d;})[_0xdac9('0x38')](respondWithFilteredResult(_0x363d93,_0x51cde6))[_0xdac9('0x29')](handleError(_0x363d93,null));};exports[_0xdac9('0x56')]=function(_0x2122e6,_0x1dece7){var _0x37b498={'raw':![],'where':{'id':_0x2122e6[_0xdac9('0x57')]['id']}},_0x140dc5={};_0x140dc5[_0xdac9('0x46')]=_[_0xdac9('0x58')](db[_0xdac9('0x3e')][_0xdac9('0x3f')]);_0x140dc5['query']=_['keys'](_0x2122e6['query']);_0x140dc5[_0xdac9('0x44')]=_[_0xdac9('0x45')](_0x140dc5['model'],_0x140dc5[_0xdac9('0x43')]);_0x37b498[_0xdac9('0x48')]=_[_0xdac9('0x45')](_0x140dc5['model'],qs[_0xdac9('0x47')](_0x2122e6[_0xdac9('0x43')]['fields']));_0x37b498['attributes']=_0x37b498[_0xdac9('0x48')][_0xdac9('0x59')]?_0x37b498[_0xdac9('0x48')]:_0x140dc5[_0xdac9('0x46')];if(_0x2122e6[_0xdac9('0x43')][_0xdac9('0x52')]){_0x37b498[_0xdac9('0x53')]=[{'all':!![]}];}_0x37b498=_[_0xdac9('0x4f')]({},_0x37b498,_0x2122e6[_0xdac9('0x5a')]);return db[_0xdac9('0x3e')][_0xdac9('0x5b')](_0x37b498)[_0xdac9('0x38')](handleEntityNotFound(_0x1dece7,null))[_0xdac9('0x38')](respondWithResult(_0x1dece7,null))[_0xdac9('0x29')](handleError(_0x1dece7,null));};exports[_0xdac9('0x37')]=function(_0x5d0b43,_0x439d13){if(_0x5d0b43[_0xdac9('0x5c')]['id']){delete _0x5d0b43[_0xdac9('0x5c')]['id'];}return db[_0xdac9('0x3e')][_0xdac9('0x5b')]({'where':{'id':_0x5d0b43[_0xdac9('0x57')]['id']}})['then'](handleEntityNotFound(_0x439d13,null))[_0xdac9('0x38')](saveUpdates(_0x5d0b43[_0xdac9('0x5c')],null))[_0xdac9('0x38')](respondWithResult(_0x439d13,null))[_0xdac9('0x29')](handleError(_0x439d13,null));};exports[_0xdac9('0x5d')]=function(_0x2a5bf9,_0x1eec39,_0x243862){if(_0x2a5bf9[_0xdac9('0x5e')]&&_0x2a5bf9['file'][_0xdac9('0x5f')]){_0x2a5bf9[_0xdac9('0x5c')][_0xdac9('0x60')]=_0x2a5bf9[_0xdac9('0x5e')][_0xdac9('0x5f')];}return db[_0xdac9('0x3e')]['find']({'where':{'id':_0x2a5bf9['params']['id']}})[_0xdac9('0x38')](handleEntityNotFound(_0x1eec39,null))[_0xdac9('0x38')](saveUpdates(_0x2a5bf9[_0xdac9('0x5c')],null))[_0xdac9('0x38')](respondWithResult(_0x1eec39,null))[_0xdac9('0x29')](handleError(_0x1eec39,null));};exports[_0xdac9('0x61')]=function(_0x518e01,_0x58faf2,_0x5dde5e){if(_0x518e01[_0xdac9('0x5e')]&&_0x518e01[_0xdac9('0x5e')][_0xdac9('0x5f')]){_0x518e01[_0xdac9('0x5c')]['loginLogo']=_0x518e01[_0xdac9('0x5e')][_0xdac9('0x5f')];}return db[_0xdac9('0x3e')][_0xdac9('0x5b')]({'where':{'id':_0x518e01[_0xdac9('0x57')]['id']}})['then'](handleEntityNotFound(_0x58faf2,null))[_0xdac9('0x38')](saveUpdates(_0x518e01['body'],null))[_0xdac9('0x38')](respondWithResult(_0x58faf2,null))['catch'](handleError(_0x58faf2,null));};var utilLicense=require(_0xdac9('0x1a'));exports[_0xdac9('0x62')]=function(_0x2fd7c8,_0x360499,_0x303008){var _0x40dec7=_0xdac9('0x63');var _0x53d9ed={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x3f92a8){if(_0x3f92a8){_0x53d9ed=_0x3f92a8;}return db[_0xdac9('0x3e')][_0xdac9('0x5b')]({'where':{'id':_0x2fd7c8[_0xdac9('0x57')]['id']},'attributes':[_0xdac9('0x60'),_0xdac9('0x64'),_0xdac9('0x65'),'favicon',_0xdac9('0x66'),'defaultLoginLogo','defaultPreferred',_0xdac9('0x67')],'raw':!![]});})['then'](handleEntityNotFound(_0x360499,null))['then'](function(_0x3c89e6){if(_0x3c89e6){var _0x156e91=_0x3c89e6[_0xdac9('0x60')]&&fs['existsSync'](path['join'](config[_0xdac9('0x68')],_0x40dec7,_[_0xdac9('0x69')](_0x3c89e6['logo'])))?path[_0xdac9('0x6a')](config[_0xdac9('0x68')],_0x40dec7,_[_0xdac9('0x69')](_0x3c89e6[_0xdac9('0x60')])):path[_0xdac9('0x6a')](config[_0xdac9('0x68')],_0x40dec7,_[_0xdac9('0x69')](_0xdac9('0x6b')));var _0xa8d621=_0xdac9('0x6c')+_[_0xdac9('0x6d')](_0xdac9('0x60'));if(_0x3c89e6[_0xa8d621]||!_0x53d9ed['custom']){_0x156e91=path[_0xdac9('0x6a')](config['root'],_0x40dec7,_[_0xdac9('0x69')](_0xdac9('0x6b')));}if(!fs['existsSync'](_0x156e91)){throw new db[(_0xdac9('0x6e'))][(_0xdac9('0x6f'))](_[_0xdac9('0x6d')](_0xdac9('0x60'))+_0xdac9('0x70'));}return _0x360499[_0xdac9('0x71')](_0x156e91);}})[_0xdac9('0x29')](handleError(_0x360499,null));};var utilLicense=require(_0xdac9('0x1a'));exports[_0xdac9('0x72')]=function(_0x45f183,_0x263b84,_0x467fa5){var _0x1ea181=_0xdac9('0x63');var _0x40d903={'custom':![]};return utilLicense[_0xdac9('0x73')]()['then'](function(_0x3a457b){if(_0x3a457b){_0x40d903=_0x3a457b;}return db[_0xdac9('0x3e')][_0xdac9('0x5b')]({'where':{'id':_0x45f183[_0xdac9('0x57')]['id']},'attributes':['logo',_0xdac9('0x64'),_0xdac9('0x65'),_0xdac9('0x74'),'defaultLogo',_0xdac9('0x75'),_0xdac9('0x76'),'defaultFavicon'],'raw':!![]});})[_0xdac9('0x38')](handleEntityNotFound(_0x263b84,null))[_0xdac9('0x38')](function(_0x2a4d12){if(_0x2a4d12){var _0x4d3d3e=_0x2a4d12[_0xdac9('0x64')]&&fs[_0xdac9('0x77')](path[_0xdac9('0x6a')](config['root'],_0x1ea181,_['toLower'](_0x2a4d12[_0xdac9('0x64')])))?path[_0xdac9('0x6a')](config[_0xdac9('0x68')],_0x1ea181,_[_0xdac9('0x69')](_0x2a4d12[_0xdac9('0x64')])):path[_0xdac9('0x6a')](config[_0xdac9('0x68')],_0x1ea181,_[_0xdac9('0x69')](_0xdac9('0x78')));var _0x13e8d8=_0xdac9('0x6c')+_[_0xdac9('0x6d')](_0xdac9('0x64'));if(_0x2a4d12[_0x13e8d8]||!_0x40d903['custom']){_0x4d3d3e=path['join'](config[_0xdac9('0x68')],_0x1ea181,_['toLower']('default_loginLogo.svg'));}if(!fs[_0xdac9('0x77')](_0x4d3d3e)){throw new db[(_0xdac9('0x6e'))][(_0xdac9('0x6f'))](_[_0xdac9('0x6d')]('loginLogo')+_0xdac9('0x70'));}return _0x263b84[_0xdac9('0x71')](_0x4d3d3e);}})[_0xdac9('0x29')](handleError(_0x263b84,null));};exports['gdpr']=function(_0x147e21,_0x51db47){return db['Setting'][_0xdac9('0x5b')]({'where':{'id':_0x147e21['params']['id']},'attributes':[_0xdac9('0x79')]})['then'](respondWithResult(_0x51db47,null))[_0xdac9('0x29')](handleError(_0x51db47,null));};exports[_0xdac9('0x7a')]=function(_0x3223ce,_0x251011,_0x9981f){if(_0x3223ce['file']&&_0x3223ce[_0xdac9('0x5e')][_0xdac9('0x5f')]){_0x3223ce[_0xdac9('0x5c')][_0xdac9('0x65')]=_0x3223ce[_0xdac9('0x5e')][_0xdac9('0x5f')];}return db[_0xdac9('0x3e')][_0xdac9('0x5b')]({'where':{'id':_0x3223ce[_0xdac9('0x57')]['id']}})['then'](handleEntityNotFound(_0x251011,null))[_0xdac9('0x38')](saveUpdates(_0x3223ce[_0xdac9('0x5c')],null))[_0xdac9('0x38')](respondWithResult(_0x251011,null))['catch'](handleError(_0x251011,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x5adc83,_0x5576ad,_0x325407){var _0x3c1313=_0xdac9('0x63');var _0x3f9aec={'custom':![]};return utilLicense['getLicense']()[_0xdac9('0x38')](function(_0x4cf65d){if(_0x4cf65d){_0x3f9aec=_0x4cf65d;}return db[_0xdac9('0x3e')][_0xdac9('0x5b')]({'where':{'id':_0x5adc83[_0xdac9('0x57')]['id']},'attributes':[_0xdac9('0x60'),'loginLogo',_0xdac9('0x65'),_0xdac9('0x74'),_0xdac9('0x66'),_0xdac9('0x75'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xdac9('0x38')](handleEntityNotFound(_0x5576ad,null))[_0xdac9('0x38')](function(_0x2893f3){if(_0x2893f3){var _0x4a183b=_0x2893f3['preferred']&&fs[_0xdac9('0x77')](path[_0xdac9('0x6a')](config[_0xdac9('0x68')],_0x3c1313,_[_0xdac9('0x69')](_0x2893f3[_0xdac9('0x65')])))?path[_0xdac9('0x6a')](config[_0xdac9('0x68')],_0x3c1313,_[_0xdac9('0x69')](_0x2893f3[_0xdac9('0x65')])):path[_0xdac9('0x6a')](config[_0xdac9('0x68')],_0x3c1313,_[_0xdac9('0x69')](_0xdac9('0x7b')));var _0x563406=_0xdac9('0x6c')+_[_0xdac9('0x6d')]('preferred');if(_0x2893f3[_0x563406]||!_0x3f9aec[_0xdac9('0x7c')]||!_0x3f9aec['preferred']){_0x4a183b=path[_0xdac9('0x6a')](config[_0xdac9('0x68')],_0x3c1313,_[_0xdac9('0x69')](_0xdac9('0x7b')));}if(!fs[_0xdac9('0x77')](_0x4a183b)){throw new db[(_0xdac9('0x6e'))][(_0xdac9('0x6f'))](_[_0xdac9('0x6d')](_0xdac9('0x65'))+_0xdac9('0x70'));}return _0x5576ad[_0xdac9('0x71')](_0x4a183b);}})['catch'](handleError(_0x5576ad,null));};exports[_0xdac9('0x7d')]=function(_0x2d55c5,_0x284247,_0x366e6c){if(_0x2d55c5[_0xdac9('0x5e')]&&_0x2d55c5['file']['filename']){_0x2d55c5[_0xdac9('0x5c')]['favicon']=_0x2d55c5['file'][_0xdac9('0x5f')];}return db[_0xdac9('0x3e')][_0xdac9('0x5b')]({'where':{'id':_0x2d55c5[_0xdac9('0x57')]['id']}})['then'](handleEntityNotFound(_0x284247,null))[_0xdac9('0x38')](saveUpdates(_0x2d55c5[_0xdac9('0x5c')],null))[_0xdac9('0x38')](respondWithResult(_0x284247,null))['catch'](handleError(_0x284247,null));};var utilLicense=require('../../config/license/util');exports[_0xdac9('0x7e')]=function(_0x12c338,_0x537bbb,_0x5d9a27){var _0x529322=_0xdac9('0x63');var _0x18fd0a={'custom':![]};return utilLicense[_0xdac9('0x73')]()['then'](function(_0x1117eb){if(_0x1117eb){_0x18fd0a=_0x1117eb;}return db[_0xdac9('0x3e')][_0xdac9('0x5b')]({'where':{'id':_0x12c338[_0xdac9('0x57')]['id']},'attributes':[_0xdac9('0x60'),'loginLogo',_0xdac9('0x65'),_0xdac9('0x74'),'defaultLogo',_0xdac9('0x75'),_0xdac9('0x76'),_0xdac9('0x67')],'raw':!![]});})[_0xdac9('0x38')](handleEntityNotFound(_0x537bbb,null))['then'](function(_0x5b03e0){if(_0x5b03e0){var _0x2c0062=_0x5b03e0[_0xdac9('0x74')]&&fs['existsSync'](path['join'](config[_0xdac9('0x68')],_0x529322,_['toLower'](_0x5b03e0[_0xdac9('0x74')])))?path['join'](config['root'],_0x529322,_[_0xdac9('0x69')](_0x5b03e0[_0xdac9('0x74')])):path[_0xdac9('0x6a')](config[_0xdac9('0x68')],_0x529322,_[_0xdac9('0x69')](_0xdac9('0x7f')));var _0x3180c2=_0xdac9('0x6c')+_[_0xdac9('0x6d')](_0xdac9('0x74'));if(_0x5b03e0[_0x3180c2]||!_0x18fd0a[_0xdac9('0x7c')]){_0x2c0062=path[_0xdac9('0x6a')](config[_0xdac9('0x68')],_0x529322,_['toLower'](_0xdac9('0x7f')));}if(!fs[_0xdac9('0x77')](_0x2c0062)){throw new db[(_0xdac9('0x6e'))][(_0xdac9('0x6f'))](_[_0xdac9('0x6d')](_0xdac9('0x74'))+_0xdac9('0x70'));}return _0x537bbb[_0xdac9('0x71')](_0x2c0062);}})[_0xdac9('0x29')](handleError(_0x537bbb,null));};exports[_0xdac9('0x80')]=function(_0x403302,_0x4f5c11){var _0x2837c2={'offset':moment()[_0xdac9('0x81')]()};_0x2837c2[_0xdac9('0x82')]=moment()[_0xdac9('0x81')](_0x2837c2[_0xdac9('0x2e')])[_0xdac9('0x83')](_0xdac9('0x84'));return _0x4f5c11[_0xdac9('0x2b')](0xc8)[_0xdac9('0x3b')](_0x2837c2);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index ffa2c21..4340811 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x18b344,_0x271f68){var _0x5ef6bb=function(_0x3345b3){while(--_0x3345b3){_0x18b344['push'](_0x18b344['shift']());}};_0x5ef6bb(++_0x271f68);}(_0x55ca,0x126));var _0xa55c=function(_0xc0213d,_0x4a3b1d){_0xc0213d=_0xc0213d-0x0;var _0x1a93c4=_0x55ca[_0xc0213d];return _0x1a93c4;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0xd67867,_0x559ab5){var _0x33886f=function(_0x5ca48){while(--_0x5ca48){_0xd67867['push'](_0xd67867['shift']());}};_0x33886f(++_0x559ab5);}(_0x34e8,0x12c));var _0x834e=function(_0x474ec4,_0x118b8b){_0x474ec4=_0x474ec4-0x0;var _0x10d9cf=_0x34e8[_0x474ec4];return _0x10d9cf;};'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/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 4ee04c0..c65f571 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 _0xded3=['options','raw','where','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','request','then','info','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','ShowSetting','Setting','find'];(function(_0x313f4f,_0x3a4519){var _0x217df0=function(_0x37b6d2){while(--_0x37b6d2){_0x313f4f['push'](_0x313f4f['shift']());}};_0x217df0(++_0x3a4519);}(_0xded3,0x83));var _0x3ded=function(_0x3248c3,_0x355905){_0x3248c3=_0x3248c3-0x0;var _0x123814=_0xded3[_0x3248c3];return _0x123814;};'use strict';var _=require('lodash');var util=require(_0x3ded('0x0'));var moment=require(_0x3ded('0x1'));var BPromise=require(_0x3ded('0x2'));var rs=require(_0x3ded('0x3'));var fs=require('fs');var Redis=require(_0x3ded('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3ded('0x5'));var logger=require(_0x3ded('0x6'))(_0x3ded('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x476a38,_0x1e4ec3,_0x323987){return new BPromise(function(_0x4df867,_0x5c56c4){return client[_0x3ded('0x8')](_0x476a38,_0x323987)[_0x3ded('0x9')](function(_0x31ffd4){logger[_0x3ded('0xa')]('Setting,\x20%s,\x20%s',_0x1e4ec3,'request\x20sent');logger[_0x3ded('0xb')](_0x3ded('0xc'),_0x1e4ec3,_0x3ded('0xd'),JSON[_0x3ded('0xe')](_0x31ffd4));if(_0x31ffd4[_0x3ded('0xf')]){if(_0x31ffd4['error'][_0x3ded('0x10')]===0x1f4){logger[_0x3ded('0xf')](_0x3ded('0x11'),_0x1e4ec3,_0x31ffd4[_0x3ded('0xf')]['message']);return _0x5c56c4(_0x31ffd4[_0x3ded('0xf')][_0x3ded('0x12')]);}logger[_0x3ded('0xf')]('Setting,\x20%s,\x20%s',_0x1e4ec3,_0x31ffd4[_0x3ded('0xf')]['message']);return _0x4df867(_0x31ffd4['error'][_0x3ded('0x12')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x1e4ec3,'request\x20sent');_0x4df867(_0x31ffd4[_0x3ded('0x13')][_0x3ded('0x12')]);}})[_0x3ded('0x14')](function(_0x5aec5e){logger[_0x3ded('0xf')](_0x3ded('0x11'),_0x1e4ec3,_0x5aec5e);_0x5c56c4(_0x5aec5e);});});}exports[_0x3ded('0x15')]=function(_0x5646f9){var _0x3fda8c=this;return new Promise(function(_0x293f2b,_0x120c40){return db[_0x3ded('0x16')][_0x3ded('0x17')]({'raw':_0x5646f9[_0x3ded('0x18')]?_0x5646f9[_0x3ded('0x18')][_0x3ded('0x19')]===undefined?!![]:![]:!![],'where':_0x5646f9[_0x3ded('0x18')]?_0x5646f9[_0x3ded('0x18')][_0x3ded('0x1a')]||null:null,'attributes':_0x5646f9[_0x3ded('0x18')]?_0x5646f9[_0x3ded('0x18')][_0x3ded('0x1b')]||null:null,'include':_0x5646f9[_0x3ded('0x18')]?_0x5646f9['options'][_0x3ded('0x1c')]?_[_0x3ded('0x1d')](_0x5646f9[_0x3ded('0x18')][_0x3ded('0x1c')],function(_0x1f48a3){return{'model':db[_0x1f48a3[_0x3ded('0x1e')]],'as':_0x1f48a3['as'],'attributes':_0x1f48a3[_0x3ded('0x1b')],'include':_0x1f48a3[_0x3ded('0x1c')]?_[_0x3ded('0x1d')](_0x1f48a3[_0x3ded('0x1c')],function(_0x3a2e36){return{'model':db[_0x3a2e36[_0x3ded('0x1e')]],'as':_0x3a2e36['as'],'attributes':_0x3a2e36[_0x3ded('0x1b')],'include':_0x3a2e36[_0x3ded('0x1c')]?_[_0x3ded('0x1d')](_0x3a2e36[_0x3ded('0x1c')],function(_0x4c4127){return{'model':db[_0x4c4127['model']],'as':_0x4c4127['as'],'attributes':_0x4c4127[_0x3ded('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3ded('0x9')](function(_0x132bbb){logger[_0x3ded('0xa')](_0x3ded('0x15'),_0x5646f9);logger[_0x3ded('0xb')](_0x3ded('0x15'),_0x5646f9,JSON[_0x3ded('0xe')](_0x132bbb));_0x293f2b(_0x132bbb);})[_0x3ded('0x14')](function(_0x315905){logger[_0x3ded('0xf')](_0x3ded('0x15'),_0x315905[_0x3ded('0x12')],_0x5646f9);_0x120c40(_0x3fda8c[_0x3ded('0xf')](0x1f4,_0x315905['message']));});});}; \ No newline at end of file +var _0xc68a=['randomstring','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSetting','Setting','find','options','raw','attributes','include','map','model','debug','util','moment'];(function(_0x1e56f8,_0x353daa){var _0x17b7fe=function(_0x20a680){while(--_0x20a680){_0x1e56f8['push'](_0x1e56f8['shift']());}};_0x17b7fe(++_0x353daa);}(_0xc68a,0xc9));var _0xac68=function(_0x1a3917,_0x4f02ea){_0x1a3917=_0x1a3917-0x0;var _0x49172a=_0xc68a[_0x1a3917];return _0x49172a;};'use strict';var _=require('lodash');var util=require(_0xac68('0x0'));var moment=require(_0xac68('0x1'));var BPromise=require('bluebird');var rs=require(_0xac68('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac68('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xac68('0x4'))(_0xac68('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xac68('0x6')][_0xac68('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x55b055,_0x2a64de,_0x40c324){return new BPromise(function(_0x4d8014,_0x2e6680){return client[_0xac68('0x8')](_0x55b055,_0x40c324)[_0xac68('0x9')](function(_0x11992d){logger[_0xac68('0xa')](_0xac68('0xb'),_0x2a64de,_0xac68('0xc'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x2a64de,_0xac68('0xc'),JSON[_0xac68('0xd')](_0x11992d));if(_0x11992d[_0xac68('0xe')]){if(_0x11992d['error'][_0xac68('0xf')]===0x1f4){logger[_0xac68('0xe')](_0xac68('0xb'),_0x2a64de,_0x11992d['error'][_0xac68('0x10')]);return _0x2e6680(_0x11992d[_0xac68('0xe')][_0xac68('0x10')]);}logger[_0xac68('0xe')]('Setting,\x20%s,\x20%s',_0x2a64de,_0x11992d['error'][_0xac68('0x10')]);return _0x4d8014(_0x11992d['error'][_0xac68('0x10')]);}else{logger[_0xac68('0xa')](_0xac68('0xb'),_0x2a64de,_0xac68('0xc'));_0x4d8014(_0x11992d[_0xac68('0x11')][_0xac68('0x10')]);}})[_0xac68('0x12')](function(_0x2a87a2){logger['error'](_0xac68('0xb'),_0x2a64de,_0x2a87a2);_0x2e6680(_0x2a87a2);});});}exports[_0xac68('0x13')]=function(_0xd75d09){var _0x5c8c0d=this;return new Promise(function(_0x360683,_0xca66b){return db[_0xac68('0x14')][_0xac68('0x15')]({'raw':_0xd75d09[_0xac68('0x16')]?_0xd75d09[_0xac68('0x16')][_0xac68('0x17')]===undefined?!![]:![]:!![],'where':_0xd75d09[_0xac68('0x16')]?_0xd75d09[_0xac68('0x16')]['where']||null:null,'attributes':_0xd75d09[_0xac68('0x16')]?_0xd75d09[_0xac68('0x16')][_0xac68('0x18')]||null:null,'include':_0xd75d09[_0xac68('0x16')]?_0xd75d09[_0xac68('0x16')][_0xac68('0x19')]?_[_0xac68('0x1a')](_0xd75d09[_0xac68('0x16')]['include'],function(_0x448ffc){return{'model':db[_0x448ffc[_0xac68('0x1b')]],'as':_0x448ffc['as'],'attributes':_0x448ffc[_0xac68('0x18')],'include':_0x448ffc[_0xac68('0x19')]?_['map'](_0x448ffc[_0xac68('0x19')],function(_0x59847c){return{'model':db[_0x59847c[_0xac68('0x1b')]],'as':_0x59847c['as'],'attributes':_0x59847c['attributes'],'include':_0x59847c['include']?_[_0xac68('0x1a')](_0x59847c[_0xac68('0x19')],function(_0x3743cd){return{'model':db[_0x3743cd[_0xac68('0x1b')]],'as':_0x3743cd['as'],'attributes':_0x3743cd[_0xac68('0x18')]};}):[]};}):[]};}):[]:[]})[_0xac68('0x9')](function(_0x4ee0e0){logger[_0xac68('0xa')]('ShowSetting',_0xd75d09);logger[_0xac68('0x1c')]('ShowSetting',_0xd75d09,JSON[_0xac68('0xd')](_0x4ee0e0));_0x360683(_0x4ee0e0);})[_0xac68('0x12')](function(_0x45981f){logger[_0xac68('0xe')]('ShowSetting',_0x45981f[_0xac68('0x10')],_0xd75d09);_0xca66b(_0x5c8c0d[_0xac68('0xe')](0x1f4,_0x45981f[_0xac68('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 9141ed0..0caff93 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 _0x814b=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/send','status','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated'];(function(_0x25ca44,_0x111633){var _0x4897c1=function(_0xf344b9){while(--_0xf344b9){_0x25ca44['push'](_0x25ca44['shift']());}};_0x4897c1(++_0x111633);}(_0x814b,0x1a2));var _0xb814=function(_0x24431a,_0x52459a){_0x24431a=_0x24431a-0x0;var _0x454ec7=_0x814b[_0x24431a];return _0x454ec7;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0xa')](_0xb814('0x16'),auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0xa')](_0xb814('0x18'),controller[_0xb814('0x19')]);router[_0xb814('0xa')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router[_0xb814('0x1c')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x1e')]);router['post'](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x1f')]);router[_0xb814('0x1c')]('/:id/notify',controller['notify']);router['post'](_0xb814('0x14'),auth['isAuthenticated'](),controller['addApplications']);router[_0xb814('0x1c')](_0xb814('0x20'),auth[_0xb814('0xb')](),controller['send']);router[_0xb814('0x1c')]('/:id/status',controller[_0xb814('0x21')]);router[_0xb814('0x1c')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x22')]);router[_0xb814('0x23')](_0xb814('0xe'),auth['isAuthenticated'](),controller[_0xb814('0x24')]);router['delete'](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x25')]);router[_0xb814('0x26')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x27')]);router['delete'](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x28')]);router[_0xb814('0x26')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x29')]);module[_0xb814('0x2a')]=router; \ No newline at end of file +var _0x7fbe=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','post','create','/:id/notify','notify','put','delete','removeAnswers','path','connect-timeout','express'];(function(_0x355fd9,_0x1823e5){var _0x3a444d=function(_0x56c14c){while(--_0x56c14c){_0x355fd9['push'](_0x355fd9['shift']());}};_0x3a444d(++_0x1823e5);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x34af74,_0x59ab9d){_0x34af74=_0x34af74-0x0;var _0x12d74b=_0x7fbe[_0x34af74];return _0x12d74b;};'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['get'](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x10')]);router[_0xe7fb('0x9')](_0xe7fb('0x11'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x12')]);router[_0xe7fb('0x9')](_0xe7fb('0x13'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x14')]);router[_0xe7fb('0x9')](_0xe7fb('0x15'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x16')]);router['get'](_0xe7fb('0x17'),controller[_0xe7fb('0x18')]);router['get'](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['getAgents']);router[_0xe7fb('0x1a')]('/',auth['isAuthenticated'](),controller[_0xe7fb('0x1b')]);router[_0xe7fb('0x1a')](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller['addDisposition']);router[_0xe7fb('0x1a')]('/:id/canned_answers',auth[_0xe7fb('0xa')](),controller['addAnswer']);router[_0xe7fb('0x1a')](_0xe7fb('0x1c'),controller[_0xe7fb('0x1d')]);router[_0xe7fb('0x1a')]('/:id/applications',auth[_0xe7fb('0xa')](),controller['addApplications']);router[_0xe7fb('0x1a')]('/:id/send',auth[_0xe7fb('0xa')](),controller['send']);router[_0xe7fb('0x1a')](_0xe7fb('0x17'),controller['status']);router[_0xe7fb('0x1a')](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['addAgents']);router[_0xe7fb('0x1e')](_0xe7fb('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xe7fb('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0xe7fb('0x1f')](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller['removeDispositions']);router[_0xe7fb('0x1f')](_0xe7fb('0x11'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x20')]);router[_0xe7fb('0x1f')](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index ee6ccfe..cc8a7f7 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 _0xbca5=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','csc','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x27dfd1,_0x3c3977){var _0x275659=function(_0x255c69){while(--_0x255c69){_0x27dfd1['push'](_0x27dfd1['shift']());}};_0x275659(++_0x3c3977);}(_0xbca5,0xea));var _0x5bca=function(_0x57c22b,_0x54a1fa){_0x57c22b=_0x57c22b-0x0;var _0x5c982e=_0xbca5[_0x57c22b];return _0x5c982e;};'use strict';var Sequelize=require(_0x5bca('0x0'));var rs=require(_0x5bca('0x1'));module[_0x5bca('0x2')]={'name':{'type':Sequelize[_0x5bca('0x3')],'unique':_0x5bca('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x5bca('0x3')],'defaultValue':function(){return rs[_0x5bca('0x5')]();}},'phone':{'type':Sequelize[_0x5bca('0x3')]},'type':{'type':Sequelize[_0x5bca('0x6')](_0x5bca('0x7'),_0x5bca('0x8'),_0x5bca('0x9'),_0x5bca('0xa'),_0x5bca('0xb'),_0x5bca('0xc'),'bandwidth',_0x5bca('0xd'),'infobip',_0x5bca('0xe'))},'accountSid':{'type':Sequelize[_0x5bca('0x3')]},'authId':{'type':Sequelize[_0x5bca('0x3')]},'authToken':{'type':Sequelize[_0x5bca('0x3')]},'smsMethod':{'type':Sequelize[_0x5bca('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x5bca('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x5bca('0x3')]},'applicationId':{'type':Sequelize[_0x5bca('0x3')]},'accountId':{'type':Sequelize[_0x5bca('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x5bca('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x5bca('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x5bca('0x10');}},'notificationSound':{'type':Sequelize[_0x5bca('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5bca('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5bca('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5bca('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5bca('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5bca('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5bca('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x5bca('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5bca('0x11')],'comment':_0x5bca('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x5bca('0x13'),'set':function(_0x5422a1){if(!_0x5422a1)this['setDataValue'](_0x5bca('0x14'),null);this[_0x5bca('0x15')](_0x5bca('0x16'),_0x5422a1);}}}; \ No newline at end of file +var _0xcad3=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','name','STRING','generate','twilio','clicksend','plivo','clickatell','bandwidth','csc','intelepeer'];(function(_0x195051,_0x3c3af2){var _0x2b1019=function(_0x381f8f){while(--_0x381f8f){_0x195051['push'](_0x195051['shift']());}};_0x2b1019(++_0x3c3af2);}(_0xcad3,0x120));var _0x3cad=function(_0x18474f,_0x51e0f9){_0x18474f=_0x18474f-0x0;var _0xab5297=_0xcad3[_0x18474f];return _0xab5297;};'use strict';var Sequelize=require(_0x3cad('0x0'));var rs=require(_0x3cad('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x3cad('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x3cad('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x3cad('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x3cad('0x3')],'defaultValue':function(){return rs[_0x3cad('0x4')]();}},'phone':{'type':Sequelize[_0x3cad('0x3')]},'type':{'type':Sequelize['ENUM'](_0x3cad('0x5'),'skebby','connectel',_0x3cad('0x6'),_0x3cad('0x7'),_0x3cad('0x8'),_0x3cad('0x9'),_0x3cad('0xa'),'infobip',_0x3cad('0xb'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x3cad('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x3cad('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x3cad('0x3')]},'senderString':{'type':Sequelize[_0x3cad('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x3cad('0x3')]},'notificationTemplate':{'type':Sequelize[_0x3cad('0xc')],'defaultValue':function(){return _0x3cad('0xd');}},'notificationSound':{'type':Sequelize[_0x3cad('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3cad('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3cad('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3cad('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3cad('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3cad('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x3cad('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x3cad('0xe')],'defaultValue':![],'comment':_0x3cad('0x10'),'set':function(_0x438eb4){if(!_0x438eb4)this[_0x3cad('0x11')](_0x3cad('0x12'),null);this[_0x3cad('0x11')](_0x3cad('0x13'),_0x438eb4);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index a6aa437..1811660 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 _0xe310=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./smsAccount.socket','register','jayson/promise','client','http','request','info','SmsAccount,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','Pause','SmsAccount','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','show','mandatoryDispositionPause','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsAccounts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','Disposition','getDispositions','length','rows','removeDispositions','ids','addAnswer','SmsAccountId','getAnswers','findOne','CannedAnswer','removeAnswers','notify','sms','Applications','applications','orderBy','priority','account','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','from','From','Body','messageId','skebby','sender','text','connectel','clicksend','message_id','Text','MessageUUID','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','bandwidth','intelepeer','refid','isNil','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','omit','contact','SmsInteraction','interaction','created','push','unmanaged','*,*,*,*','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','twilio','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','SmsApplication','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','DESC','ListId','out','SmsMessage','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','redif','DELIVERED','infobip','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x379895,_0x4dd9ee){var _0x1ae206=function(_0x3544f6){while(--_0x3544f6){_0x379895['push'](_0x379895['shift']());}};_0x1ae206(++_0x4dd9ee);}(_0xe310,0xd7));var _0x0e31=function(_0x27e72a,_0x17f72f){_0x27e72a=_0x27e72a-0x0;var _0xf59f4=_0xe310[_0x27e72a];return _0xf59f4;};'use strict';var emlformat=require(_0x0e31('0x0'));var rimraf=require(_0x0e31('0x1'));var zipdir=require(_0x0e31('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0e31('0x3'));var moment=require(_0x0e31('0x4'));var BPromise=require(_0x0e31('0x5'));var Mustache=require('mustache');var util=require(_0x0e31('0x6'));var path=require('path');var sox=require(_0x0e31('0x7'));var csv=require(_0x0e31('0x8'));var ejs=require(_0x0e31('0x9'));var fs=require('fs');var fs_extra=require(_0x0e31('0xa'));var _=require(_0x0e31('0xb'));var squel=require(_0x0e31('0xc'));var crypto=require(_0x0e31('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0e31('0xe'));var toCsv=require(_0x0e31('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0e31('0xf'));var authService=require(_0x0e31('0x10'));var qs=require(_0x0e31('0x11'));var as=require(_0x0e31('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e31('0x13'))(_0x0e31('0x14'));var utils=require(_0x0e31('0x15'));var config=require(_0x0e31('0x16'));var licenseUtil=require(_0x0e31('0x17'));var db=require(_0x0e31('0x18'))['db'];config['redis']=_[_0x0e31('0x19')](config[_0x0e31('0x1a')],{'host':_0x0e31('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0e31('0x1c'))[_0x0e31('0x1d')](socket);var jayson=require(_0x0e31('0x1e'));var client=jayson[_0x0e31('0x1f')][_0x0e31('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x4767ec,_0x4e8cc6,_0x6f31e5,_0x2f3ead){return new BPromise(function(_0x20025b,_0x40e17d){var _0x1c1b33=_0x2f3ead||client;return _0x1c1b33[_0x0e31('0x21')](_0x4767ec,_0x6f31e5)['then'](function(_0x4c3682){logger[_0x0e31('0x22')](_0x0e31('0x23'),_0x4e8cc6,'request\x20sent');logger[_0x0e31('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4e8cc6,'request\x20sent',JSON[_0x0e31('0x25')](_0x4c3682));if(_0x4c3682['error']){if(_0x4c3682[_0x0e31('0x26')][_0x0e31('0x27')]===0x1f4){logger[_0x0e31('0x26')](_0x0e31('0x23'),_0x4e8cc6,_0x4c3682[_0x0e31('0x26')][_0x0e31('0x28')]);return _0x40e17d(_0x4c3682[_0x0e31('0x26')]['message']);}logger[_0x0e31('0x26')]('SmsAccount,\x20%s,\x20%s',_0x4e8cc6,_0x4c3682['error'][_0x0e31('0x28')]);return _0x20025b(_0x4c3682[_0x0e31('0x26')][_0x0e31('0x28')]);}else{logger['info'](_0x0e31('0x23'),_0x4e8cc6,'request\x20sent');_0x20025b(_0x4c3682[_0x0e31('0x29')]['message']);}})[_0x0e31('0x2a')](function(_0x295abd){logger[_0x0e31('0x26')](_0x0e31('0x23'),_0x4e8cc6,_0x295abd);_0x40e17d(_0x295abd);});});}function respondWithStatusCode(_0x29eaf0,_0x572393){_0x572393=_0x572393||0xcc;return function(_0x2f8d28){if(_0x2f8d28){return _0x29eaf0['sendStatus'](_0x572393);}return _0x29eaf0[_0x0e31('0x2b')](_0x572393)[_0x0e31('0x2c')]();};}function respondWithResult(_0x1ec81e,_0x8a4808){_0x8a4808=_0x8a4808||0xc8;return function(_0x5601e7){if(_0x5601e7){return _0x1ec81e[_0x0e31('0x2b')](_0x8a4808)[_0x0e31('0x2d')](_0x5601e7);}};}function respondWithFilteredResult(_0xe0004e,_0x2defe2){return function(_0x3b1d97){if(_0x3b1d97){var _0x539d4a=typeof _0x2defe2[_0x0e31('0x2e')]===_0x0e31('0x2f')&&typeof _0x2defe2[_0x0e31('0x30')]===_0x0e31('0x2f');var _0x25d790=_0x3b1d97[_0x0e31('0x31')];var _0x5e32cd=_0x539d4a?0x0:_0x2defe2['offset'];var _0x22197f=_0x539d4a?_0x3b1d97[_0x0e31('0x31')]:_0x2defe2[_0x0e31('0x2e')]+_0x2defe2[_0x0e31('0x30')];var _0x54110f;if(_0x22197f>=_0x25d790){_0x22197f=_0x25d790;_0x54110f=0xc8;}else{_0x54110f=0xce;}_0xe0004e[_0x0e31('0x2b')](_0x54110f);return _0xe0004e['set'](_0x0e31('0x32'),_0x5e32cd+'-'+_0x22197f+'/'+_0x25d790)[_0x0e31('0x2d')](_0x3b1d97);}return null;};}function patchUpdates(_0x5b2cbb){return function(_0x3373ae){try{jsonpatch[_0x0e31('0x33')](_0x3373ae,_0x5b2cbb,!![]);}catch(_0x2defa8){return BPromise[_0x0e31('0x34')](_0x2defa8);}return _0x3373ae[_0x0e31('0x35')]();};}function saveUpdates(_0xa255fe,_0x7eb3ac){return function(_0x16ed0f){if(_0x16ed0f){return _0x16ed0f[_0x0e31('0x36')](_0xa255fe)[_0x0e31('0x37')](function(_0x108880){return _0x108880;});}return null;};}function removeEntity(_0x4b8dea,_0x1ec017){return function(_0x45b311){if(_0x45b311){return _0x45b311[_0x0e31('0x38')]()[_0x0e31('0x37')](function(){var _0xbdffe=_0x45b311[_0x0e31('0x39')]({'plain':!![]});var _0x6f40c1='SmsAccounts';return db[_0x0e31('0x3a')][_0x0e31('0x38')]({'where':{'type':_0x6f40c1,'resourceId':_0xbdffe['id']}})[_0x0e31('0x37')](function(){return _0x45b311;});})[_0x0e31('0x37')](function(){_0x4b8dea[_0x0e31('0x2b')](0xcc)[_0x0e31('0x2c')]();});}};}function handleEntityNotFound(_0x313b81,_0x299c72){return function(_0x2f15c9){if(!_0x2f15c9){_0x313b81[_0x0e31('0x3b')](0x194);}return _0x2f15c9;};}function handleError(_0x26b019,_0x20fae3){_0x20fae3=_0x20fae3||0x1f4;return function(_0x429914){logger[_0x0e31('0x26')](_0x429914[_0x0e31('0x3c')]);if(_0x429914[_0x0e31('0x3d')]){delete _0x429914[_0x0e31('0x3d')];}_0x26b019['status'](_0x20fae3)[_0x0e31('0x3e')](_0x429914);};}exports[_0x0e31('0x3f')]=function(_0x289178,_0x313c9a){var _0x298e65={'include':[{'model':db[_0x0e31('0x40')],'as':'mandatoryDispositionPause'}]},_0x46f8f7={},_0x1545ad={'count':0x0,'rows':[]};var _0x18552e=_['map'](db[_0x0e31('0x41')][_0x0e31('0x42')],function(_0xebf833){return{'name':_0xebf833[_0x0e31('0x43')],'type':_0xebf833[_0x0e31('0x44')][_0x0e31('0x45')]};});_0x46f8f7[_0x0e31('0x46')]=_[_0x0e31('0x47')](_0x18552e,'name');_0x46f8f7['query']=_['keys'](_0x289178[_0x0e31('0x48')]);_0x46f8f7[_0x0e31('0x49')]=_['intersection'](_0x46f8f7['model'],_0x46f8f7['query']);_0x298e65[_0x0e31('0x4a')]=_[_0x0e31('0x4b')](_0x46f8f7[_0x0e31('0x46')],qs[_0x0e31('0x4c')](_0x289178[_0x0e31('0x48')]['fields']));_0x298e65['attributes']=_0x298e65['attributes']['length']?_0x298e65['attributes']:_0x46f8f7[_0x0e31('0x46')];if(!_0x289178['query'][_0x0e31('0x4d')](_0x0e31('0x4e'))){_0x298e65[_0x0e31('0x30')]=qs['limit'](_0x289178['query'][_0x0e31('0x30')]);_0x298e65[_0x0e31('0x2e')]=qs[_0x0e31('0x2e')](_0x289178['query'][_0x0e31('0x2e')]);}_0x298e65[_0x0e31('0x4f')]=qs[_0x0e31('0x50')](_0x289178[_0x0e31('0x48')][_0x0e31('0x50')]);_0x298e65[_0x0e31('0x51')]=qs['filters'](_[_0x0e31('0x52')](_0x289178[_0x0e31('0x48')],_0x46f8f7['filters']),_0x18552e);if(_0x289178['query'][_0x0e31('0x53')]){_0x298e65[_0x0e31('0x51')]=_['merge'](_0x298e65[_0x0e31('0x51')],{'$or':_['map'](_0x18552e,function(_0x3ca152){if(_0x3ca152[_0x0e31('0x44')]!==_0x0e31('0x54')){var _0x28fbf5={};_0x28fbf5[_0x3ca152[_0x0e31('0x3d')]]={'$like':'%'+_0x289178[_0x0e31('0x48')]['filter']+'%'};return _0x28fbf5;}})});}_0x298e65=_[_0x0e31('0x55')]({},_0x298e65,_0x289178['options']);var _0x1b0ce7={'where':_0x298e65[_0x0e31('0x51')]};return db['SmsAccount']['count'](_0x1b0ce7)[_0x0e31('0x37')](function(_0x1a8ef9){_0x1545ad['count']=_0x1a8ef9;if(_0x289178[_0x0e31('0x48')][_0x0e31('0x56')]){_0x298e65[_0x0e31('0x57')]=[{'all':!![]}];}return db[_0x0e31('0x41')][_0x0e31('0x58')](_0x298e65);})[_0x0e31('0x37')](function(_0x254616){_0x1545ad['rows']=_0x254616;return _0x1545ad;})[_0x0e31('0x37')](respondWithFilteredResult(_0x313c9a,_0x298e65))[_0x0e31('0x2a')](handleError(_0x313c9a,null));};exports[_0x0e31('0x59')]=function(_0x3034a6,_0x56c7f1){var _0x13d77a={'raw':![],'where':{'id':_0x3034a6['params']['id']},'include':[{'model':db['Pause'],'as':_0x0e31('0x5a')}]},_0x2349ba={};_0x2349ba['model']=_['keys'](db[_0x0e31('0x41')]['rawAttributes']);_0x2349ba[_0x0e31('0x48')]=_[_0x0e31('0x5b')](_0x3034a6[_0x0e31('0x48')]);_0x2349ba[_0x0e31('0x49')]=_[_0x0e31('0x4b')](_0x2349ba[_0x0e31('0x46')],_0x2349ba[_0x0e31('0x48')]);_0x13d77a['attributes']=_['intersection'](_0x2349ba[_0x0e31('0x46')],qs['fields'](_0x3034a6['query'][_0x0e31('0x4c')]));_0x13d77a[_0x0e31('0x4a')]=_0x13d77a[_0x0e31('0x4a')]['length']?_0x13d77a[_0x0e31('0x4a')]:_0x2349ba['model'];if(_0x3034a6[_0x0e31('0x48')][_0x0e31('0x56')]){_0x13d77a[_0x0e31('0x57')]=[{'all':!![]}];}_0x13d77a=_['merge']({},_0x13d77a,_0x3034a6[_0x0e31('0x5c')]);return db[_0x0e31('0x41')][_0x0e31('0x5d')](_0x13d77a)[_0x0e31('0x37')](handleEntityNotFound(_0x56c7f1,null))[_0x0e31('0x37')](respondWithResult(_0x56c7f1,null))[_0x0e31('0x2a')](handleError(_0x56c7f1,null));};exports[_0x0e31('0x5e')]=function(_0x349052,_0x28511c){return db[_0x0e31('0x41')][_0x0e31('0x5e')](_0x349052[_0x0e31('0x5f')],{})[_0x0e31('0x37')](function(_0x3d447e){var _0x221706=_0x349052[_0x0e31('0x60')][_0x0e31('0x39')]({'plain':!![]});if(!_0x221706)throw new Error(_0x0e31('0x61'));if(_0x221706['role']===_0x0e31('0x60')){var _0xc7a47e=_0x3d447e[_0x0e31('0x39')]({'plain':!![]});var _0x4fbfd3=_0x0e31('0x62');return db['UserProfileSection'][_0x0e31('0x5d')]({'where':{'name':_0x4fbfd3,'userProfileId':_0x221706['userProfileId']},'raw':!![]})['then'](function(_0x2f434f){if(_0x2f434f&&_0x2f434f[_0x0e31('0x63')]===0x0){return db['UserProfileResource'][_0x0e31('0x5e')]({'name':_0xc7a47e[_0x0e31('0x3d')],'resourceId':_0xc7a47e['id'],'type':_0x2f434f[_0x0e31('0x3d')],'sectionId':_0x2f434f['id']},{})[_0x0e31('0x37')](function(){return _0x3d447e;});}else{return _0x3d447e;}})[_0x0e31('0x2a')](function(_0x15081a){logger['error'](_0x0e31('0x64'),_0x15081a);throw _0x15081a;});}return _0x3d447e;})[_0x0e31('0x37')](respondWithResult(_0x28511c,0xc9))[_0x0e31('0x2a')](handleError(_0x28511c,null));};exports['update']=function(_0x3a1556,_0x691a02){if(_0x3a1556[_0x0e31('0x5f')]['id']){delete _0x3a1556[_0x0e31('0x5f')]['id'];}return db[_0x0e31('0x41')][_0x0e31('0x5d')]({'where':{'id':_0x3a1556['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x0e31('0x37')](handleEntityNotFound(_0x691a02,null))[_0x0e31('0x37')](saveUpdates(_0x3a1556['body'],null))[_0x0e31('0x37')](respondWithResult(_0x691a02,null))[_0x0e31('0x2a')](handleError(_0x691a02,null));};exports['destroy']=function(_0x4532e2,_0xb31997){return db[_0x0e31('0x41')][_0x0e31('0x5d')]({'where':{'id':_0x4532e2[_0x0e31('0x65')]['id']}})['then'](handleEntityNotFound(_0xb31997,null))['then'](removeEntity(_0xb31997,null))[_0x0e31('0x2a')](handleError(_0xb31997,null));};exports['describe']=function(_0x1d6c08,_0x11c25f){return db[_0x0e31('0x41')][_0x0e31('0x66')]()[_0x0e31('0x37')](respondWithResult(_0x11c25f,null))[_0x0e31('0x2a')](handleError(_0x11c25f,null));};exports['addDisposition']=function(_0x479d77,_0x4e339c,_0xe4716b){if(_0x479d77[_0x0e31('0x5f')]['id']){delete _0x479d77[_0x0e31('0x5f')]['id'];}return db[_0x0e31('0x41')][_0x0e31('0x5d')]({'where':{'id':_0x479d77[_0x0e31('0x65')]['id']}})[_0x0e31('0x37')](handleEntityNotFound(_0x4e339c,null))['then'](function(_0x3e27ad){if(_0x3e27ad){_0x479d77['body']['SmsAccountId']=_0x3e27ad['id'];return db[_0x0e31('0x67')]['create'](_0x479d77['body']);}})[_0x0e31('0x37')](respondWithResult(_0x4e339c,null))[_0x0e31('0x2a')](handleError(_0x4e339c,null));};exports[_0x0e31('0x68')]=function(_0x58a765,_0x1f8c41,_0x538e3a){var _0x2069ff={'raw':![],'where':{}};var _0x36caaf={};var _0x1dcf69={'count':0x0,'rows':[]};return db[_0x0e31('0x41')]['findOne']({'where':{'id':_0x58a765[_0x0e31('0x65')]['id']}})[_0x0e31('0x37')](handleEntityNotFound(_0x1f8c41,null))[_0x0e31('0x37')](function(_0xfb3d9d){if(_0xfb3d9d){_0x36caaf[_0x0e31('0x46')]=_[_0x0e31('0x5b')](db[_0x0e31('0x67')]['rawAttributes']);_0x36caaf['query']=_[_0x0e31('0x5b')](_0x58a765[_0x0e31('0x48')]);_0x36caaf[_0x0e31('0x49')]=_[_0x0e31('0x4b')](_0x36caaf[_0x0e31('0x46')],_0x36caaf[_0x0e31('0x48')]);_0x2069ff['attributes']=_[_0x0e31('0x4b')](_0x36caaf[_0x0e31('0x46')],qs[_0x0e31('0x4c')](_0x58a765['query'][_0x0e31('0x4c')]));_0x2069ff[_0x0e31('0x4a')]=_0x2069ff[_0x0e31('0x4a')][_0x0e31('0x69')]?_0x2069ff[_0x0e31('0x4a')]:_0x36caaf[_0x0e31('0x46')];if(!_0x58a765['query'][_0x0e31('0x4d')](_0x0e31('0x4e'))){_0x2069ff[_0x0e31('0x30')]=qs[_0x0e31('0x30')](_0x58a765['query']['limit']);_0x2069ff[_0x0e31('0x2e')]=qs[_0x0e31('0x2e')](_0x58a765[_0x0e31('0x48')]['offset']);}_0x2069ff[_0x0e31('0x4f')]=qs[_0x0e31('0x50')](_0x58a765[_0x0e31('0x48')][_0x0e31('0x50')]);_0x2069ff[_0x0e31('0x51')]=qs[_0x0e31('0x49')](_[_0x0e31('0x52')](_0x58a765[_0x0e31('0x48')],_0x36caaf['filters']));_0x2069ff[_0x0e31('0x51')]['SmsAccountId']=_0xfb3d9d['id'];if(_0x58a765[_0x0e31('0x48')][_0x0e31('0x53')]){_0x2069ff[_0x0e31('0x51')]=_[_0x0e31('0x55')](_0x2069ff[_0x0e31('0x51')],{'$or':_[_0x0e31('0x47')](_0x2069ff['attributes'],function(_0x2f89e){var _0x29989e={};_0x29989e[_0x2f89e]={'$like':'%'+_0x58a765['query'][_0x0e31('0x53')]+'%'};return _0x29989e;})});}_0x2069ff=_[_0x0e31('0x55')]({},_0x2069ff,_0x58a765[_0x0e31('0x5c')]);return db[_0x0e31('0x67')][_0x0e31('0x31')]({'where':_0x2069ff[_0x0e31('0x51')]})[_0x0e31('0x37')](function(_0x344e7d){_0x1dcf69[_0x0e31('0x31')]=_0x344e7d;if(_0x58a765['query'][_0x0e31('0x56')]){_0x2069ff['include']=[{'all':!![]}];}return db[_0x0e31('0x67')][_0x0e31('0x58')](_0x2069ff);})[_0x0e31('0x37')](function(_0x2f4f06){_0x1dcf69[_0x0e31('0x6a')]=_0x2f4f06;return _0x1dcf69;});}})[_0x0e31('0x37')](respondWithFilteredResult(_0x1f8c41,_0x2069ff))['catch'](handleError(_0x1f8c41,null));};exports[_0x0e31('0x6b')]=function(_0x45378,_0x3825e5,_0x335492){return db['SmsAccount']['find']({'where':{'id':_0x45378[_0x0e31('0x65')]['id']}})[_0x0e31('0x37')](handleEntityNotFound(_0x3825e5,null))['then'](function(_0x40b6ab){if(_0x40b6ab){return _0x40b6ab[_0x0e31('0x6b')](_0x45378[_0x0e31('0x48')][_0x0e31('0x6c')]);}})[_0x0e31('0x37')](respondWithStatusCode(_0x3825e5,null))[_0x0e31('0x2a')](handleError(_0x3825e5,null));};exports[_0x0e31('0x6d')]=function(_0x4b1054,_0x197a42,_0x4d1480){if(_0x4b1054[_0x0e31('0x5f')]['id']){delete _0x4b1054[_0x0e31('0x5f')]['id'];}return db[_0x0e31('0x41')][_0x0e31('0x5d')]({'where':{'id':_0x4b1054[_0x0e31('0x65')]['id']}})['then'](handleEntityNotFound(_0x197a42,null))[_0x0e31('0x37')](function(_0x24e244){if(_0x24e244){_0x4b1054[_0x0e31('0x5f')][_0x0e31('0x6e')]=_0x24e244['id'];return db['CannedAnswer'][_0x0e31('0x5e')](_0x4b1054['body']);}})['then'](respondWithResult(_0x197a42,null))[_0x0e31('0x2a')](handleError(_0x197a42,null));};exports[_0x0e31('0x6f')]=function(_0x459a94,_0x3bc89c,_0x3b3323){var _0x408ec6={'raw':![],'where':{}};var _0x1c131c={};var _0xa43442={'count':0x0,'rows':[]};return db['SmsAccount'][_0x0e31('0x70')]({'where':{'id':_0x459a94['params']['id']}})[_0x0e31('0x37')](handleEntityNotFound(_0x3bc89c,null))[_0x0e31('0x37')](function(_0x209a4a){if(_0x209a4a){_0x1c131c[_0x0e31('0x46')]=_[_0x0e31('0x5b')](db[_0x0e31('0x71')]['rawAttributes']);_0x1c131c[_0x0e31('0x48')]=_['keys'](_0x459a94[_0x0e31('0x48')]);_0x1c131c[_0x0e31('0x49')]=_[_0x0e31('0x4b')](_0x1c131c[_0x0e31('0x46')],_0x1c131c[_0x0e31('0x48')]);_0x408ec6[_0x0e31('0x4a')]=_[_0x0e31('0x4b')](_0x1c131c['model'],qs[_0x0e31('0x4c')](_0x459a94[_0x0e31('0x48')]['fields']));_0x408ec6[_0x0e31('0x4a')]=_0x408ec6['attributes'][_0x0e31('0x69')]?_0x408ec6[_0x0e31('0x4a')]:_0x1c131c[_0x0e31('0x46')];if(!_0x459a94['query'][_0x0e31('0x4d')](_0x0e31('0x4e'))){_0x408ec6['limit']=qs['limit'](_0x459a94[_0x0e31('0x48')][_0x0e31('0x30')]);_0x408ec6[_0x0e31('0x2e')]=qs['offset'](_0x459a94[_0x0e31('0x48')][_0x0e31('0x2e')]);}_0x408ec6[_0x0e31('0x4f')]=qs[_0x0e31('0x50')](_0x459a94['query'][_0x0e31('0x50')]);_0x408ec6['where']=qs[_0x0e31('0x49')](_[_0x0e31('0x52')](_0x459a94[_0x0e31('0x48')],_0x1c131c[_0x0e31('0x49')]));_0x408ec6['where'][_0x0e31('0x6e')]=_0x209a4a['id'];if(_0x459a94[_0x0e31('0x48')][_0x0e31('0x53')]){_0x408ec6[_0x0e31('0x51')]=_[_0x0e31('0x55')](_0x408ec6[_0x0e31('0x51')],{'$or':_[_0x0e31('0x47')](_0x408ec6['attributes'],function(_0x39fa68){var _0x25b4e8={};_0x25b4e8[_0x39fa68]={'$like':'%'+_0x459a94['query']['filter']+'%'};return _0x25b4e8;})});}_0x408ec6=_[_0x0e31('0x55')]({},_0x408ec6,_0x459a94['options']);return db[_0x0e31('0x71')][_0x0e31('0x31')]({'where':_0x408ec6[_0x0e31('0x51')]})[_0x0e31('0x37')](function(_0xec2dda){_0xa43442[_0x0e31('0x31')]=_0xec2dda;if(_0x459a94['query'][_0x0e31('0x56')]){_0x408ec6[_0x0e31('0x57')]=[{'all':!![]}];}return db[_0x0e31('0x71')]['findAll'](_0x408ec6);})[_0x0e31('0x37')](function(_0x1f90e6){_0xa43442['rows']=_0x1f90e6;return _0xa43442;});}})[_0x0e31('0x37')](respondWithFilteredResult(_0x3bc89c,_0x408ec6))['catch'](handleError(_0x3bc89c,null));};exports[_0x0e31('0x72')]=function(_0x101c97,_0x3f0714,_0x47fc39){return db[_0x0e31('0x41')][_0x0e31('0x5d')]({'where':{'id':_0x101c97[_0x0e31('0x65')]['id']}})[_0x0e31('0x37')](handleEntityNotFound(_0x3f0714,null))[_0x0e31('0x37')](function(_0x3a9202){if(_0x3a9202){return _0x3a9202[_0x0e31('0x72')](_0x101c97[_0x0e31('0x48')][_0x0e31('0x6c')]);}})[_0x0e31('0x37')](respondWithStatusCode(_0x3f0714,null))['catch'](handleError(_0x3f0714,null));};exports[_0x0e31('0x73')]=function(_0xaf41f0,_0x535d4f,_0x150807){var _0x183e6c={'channel':_0x0e31('0x74')};var _0x83f78d=[];var _0x23cf21=[];var _0x57bbbc={};return db[_0x0e31('0x41')][_0x0e31('0x5d')]({'where':{'id':_0xaf41f0['params']['id']},'include':[{'model':db['SmsApplication'],'as':_0x0e31('0x75')}]})['then'](handleEntityNotFound(_0x535d4f,null))[_0x0e31('0x37')](function(_0x43d924){_0x183e6c['account']=_0x43d924;_0x183e6c[_0x0e31('0x76')]=_[_0x0e31('0x77')](_0x43d924[_0x0e31('0x75')],[_0x0e31('0x78')],['asc']);if(_0x183e6c['account'][_0x0e31('0x75')]){delete _0x183e6c[_0x0e31('0x79')]['Applications'];}return db[_0x0e31('0x7a')]['describe']();})[_0x0e31('0x37')](function(_0x31adb7){if(!_0x31adb7){throw new db['Sequelize'][(_0x0e31('0x7b'))](_0x0e31('0x7c'));}_0x83f78d=_[_0x0e31('0x7d')](_[_0x0e31('0x5b')](_0x31adb7),[_0x0e31('0x7e'),'updatedAt']);_0x23cf21=_[_0x0e31('0x7d')](_[_0x0e31('0x5b')](_0x31adb7),[_0x0e31('0x7e'),_0x0e31('0x7f'),_0x0e31('0x80'),'ListId']);_0x183e6c[_0x0e31('0x5f')]={'mapKey':_0x0e31('0x81')};if(_0x183e6c['account']['type']){switch(_0x183e6c[_0x0e31('0x79')][_0x0e31('0x44')]){case'twilio':_0x183e6c[_0x0e31('0x5f')][_0x0e31('0x82')]=_0xaf41f0[_0x0e31('0x5f')][_0x0e31('0x83')];_0x183e6c['body'][_0x0e31('0x5f')]=_0xaf41f0[_0x0e31('0x5f')][_0x0e31('0x84')];_0x183e6c[_0x0e31('0x5f')][_0x0e31('0x85')]=_0xaf41f0['body']['MessageSid'];break;case _0x0e31('0x86'):_0x183e6c['body'][_0x0e31('0x82')]='+'+_0xaf41f0[_0x0e31('0x5f')][_0x0e31('0x87')];_0x183e6c['body']['body']=_0xaf41f0['body'][_0x0e31('0x88')];break;case _0x0e31('0x89'):_0x183e6c[_0x0e31('0x5f')][_0x0e31('0x82')]=_0xaf41f0[_0x0e31('0x5f')][_0x0e31('0x82')];_0x183e6c['body']['body']=_0xaf41f0[_0x0e31('0x5f')][_0x0e31('0x28')];break;case _0x0e31('0x8a'):_0x183e6c[_0x0e31('0x5f')][_0x0e31('0x82')]=_0xaf41f0[_0x0e31('0x5f')]['from'];_0x183e6c[_0x0e31('0x5f')]['body']=_0xaf41f0['body'][_0x0e31('0x5f')];_0x183e6c[_0x0e31('0x5f')][_0x0e31('0x85')]=_0xaf41f0['body'][_0x0e31('0x8b')];break;case'plivo':_0x183e6c[_0x0e31('0x5f')][_0x0e31('0x82')]=_0xaf41f0['body'][_0x0e31('0x83')];_0x183e6c[_0x0e31('0x5f')][_0x0e31('0x5f')]=_0xaf41f0[_0x0e31('0x5f')][_0x0e31('0x8c')];_0x183e6c[_0x0e31('0x5f')][_0x0e31('0x85')]=_0xaf41f0['body'][_0x0e31('0x8d')];break;case'infobip':_0x183e6c[_0x0e31('0x5f')]['from']='+'+_0xaf41f0['body'][_0x0e31('0x8e')][0x0][_0x0e31('0x82')];_0x183e6c[_0x0e31('0x5f')][_0x0e31('0x5f')]=_0xaf41f0['body']['results'][0x0][_0x0e31('0x88')];_0x183e6c[_0x0e31('0x5f')][_0x0e31('0x85')]=_0xaf41f0['body'][_0x0e31('0x8e')][0x0][_0x0e31('0x85')];break;case _0x0e31('0x8f'):_0x183e6c['body'][_0x0e31('0x82')]=_0xaf41f0[_0x0e31('0x5f')][_0x0e31('0x90')];_0x183e6c[_0x0e31('0x5f')][_0x0e31('0x5f')]=_0xaf41f0[_0x0e31('0x5f')][_0x0e31('0x91')][_0x0e31('0x28')];break;case _0x0e31('0x92'):_0x183e6c[_0x0e31('0x5f')]['from']=_0xaf41f0[_0x0e31('0x5f')][_0x0e31('0x93')];_0x183e6c[_0x0e31('0x5f')]['body']=_0xaf41f0[_0x0e31('0x5f')][_0x0e31('0x88')];_0x183e6c[_0x0e31('0x5f')][_0x0e31('0x85')]=_0xaf41f0[_0x0e31('0x5f')]['replyMessageId'];break;case _0x0e31('0x94'):_0x183e6c['body']['messageId']=_0xaf41f0[_0x0e31('0x5f')][0x0][_0x0e31('0x28')]['id'];_0x183e6c[_0x0e31('0x5f')]['from']=_0xaf41f0['body'][0x0][_0x0e31('0x28')][_0x0e31('0x82')];_0x183e6c[_0x0e31('0x5f')][_0x0e31('0x5f')]=_0xaf41f0[_0x0e31('0x5f')][0x0]['message'][_0x0e31('0x88')];break;case _0x0e31('0x95'):_0x183e6c[_0x0e31('0x5f')][_0x0e31('0x82')]=_0xaf41f0[_0x0e31('0x5f')][_0x0e31('0x82')];_0x183e6c['body'][_0x0e31('0x5f')]=_0xaf41f0[_0x0e31('0x5f')][_0x0e31('0x28')];_0x183e6c['body'][_0x0e31('0x85')]=_0xaf41f0['body'][_0x0e31('0x96')];break;}}if(_0x183e6c[_0x0e31('0x5f')]['id']){delete _0x183e6c['body']['id'];}if(_[_0x0e31('0x97')](_0x183e6c[_0x0e31('0x5f')][_0x0e31('0x82')])){throw new db[(_0x0e31('0x98'))][(_0x0e31('0x7b'))](_0x0e31('0x99'));}if(_['isNil'](_0x183e6c[_0x0e31('0x5f')][_0x0e31('0x5f')])||_0x183e6c[_0x0e31('0x5f')][_0x0e31('0x5f')]===''){throw new db[(_0x0e31('0x98'))][(_0x0e31('0x7b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0e31('0x97')](_0x183e6c[_0x0e31('0x5f')][_0x0e31('0x9a')])){throw new db[(_0x0e31('0x98'))][(_0x0e31('0x7b'))](_0x0e31('0x9b')+_0x23cf21);}if(!_[_0x0e31('0x9c')](_0x23cf21,_0x183e6c[_0x0e31('0x5f')][_0x0e31('0x9a')])){throw new db[(_0x0e31('0x98'))][(_0x0e31('0x7b'))](_0x0e31('0x9d')+_0x23cf21);}_0x57bbbc[_0x183e6c[_0x0e31('0x5f')]['mapKey']]=_0x183e6c[_0x0e31('0x5f')][_0x0e31('0x82')];return db[_0x0e31('0x9e')][_0x0e31('0x5d')]({'where':{'id':_0x183e6c[_0x0e31('0x79')]['ListId']},'include':[{'model':db[_0x0e31('0x7a')],'as':_0x0e31('0x9f'),'where':_0x57bbbc,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x0e31('0x37')](handleEntityNotFound(_0x535d4f,null))[_0x0e31('0x37')](function(_0x529adf){if(_0x529adf){_0x183e6c['list']=_[_0x0e31('0xa0')](_0x529adf,['Contacts']);if(_0x529adf['Contacts'][_0x0e31('0x69')]){return _0x529adf['Contacts'][0x0];}var _0x46b0d3=_[_0x0e31('0x19')](_0x183e6c[_0x0e31('0x5f')],{'firstName':_0x183e6c['body']['from'],'ListId':_0x529adf['id']});_0x46b0d3[_0x183e6c[_0x0e31('0x5f')][_0x0e31('0x9a')]]=_0x183e6c[_0x0e31('0x5f')][_0x0e31('0x82')];return db['CmContact'][_0x0e31('0x5e')](_0x46b0d3,{'fields':_0x83f78d,'raw':!![]});}})[_0x0e31('0x37')](handleEntityNotFound(_0x535d4f,null))[_0x0e31('0x37')](function(_0x23b5cb){if(_0x23b5cb){_0x183e6c[_0x0e31('0xa1')]=_0x23b5cb;var _0x52363c={'ContactId':_0x23b5cb['id'],'phone':_0x183e6c[_0x0e31('0x5f')][_0x0e31('0x82')],'SmsAccountId':_0xaf41f0['params']['id']};var _0x1902c6={'ContactId':_0x23b5cb['id'],'SmsAccountId':_0xaf41f0[_0x0e31('0x65')]['id'],'closed':![]};return db[_0x0e31('0xa2')][_0x0e31('0x5d')]({'where':_0x1902c6})[_0x0e31('0x37')](function(_0xad357b){if(_0xad357b){return[_0xad357b,![]];}return db['SmsInteraction'][_0x0e31('0x5e')](_0x52363c)[_0x0e31('0x37')](function(_0x48f1f1){return[_0x48f1f1,!![]];});});}})['spread'](function(_0x1de522,_0x5a5cf2){_0x183e6c[_0x0e31('0xa3')]=_0x1de522[_0x0e31('0x39')]({'plain':!![]});_0x183e6c[_0x0e31('0xa3')][_0x0e31('0xa4')]=![];if(_0x5a5cf2){if(_0x183e6c['account']['autoclose']){_0x183e6c[_0x0e31('0x76')][_0x0e31('0xa5')]({'id':0x0,'priority':_0x183e6c[_0x0e31('0x76')][_0x0e31('0x69')]+0x1,'app':'close','appdata':_0x0e31('0xa6'),'interval':_0x0e31('0xa7')});}_0x183e6c[_0x0e31('0xa3')][_0x0e31('0xa4')]=!![];}return db['SmsMessage'][_0x0e31('0x5e')]({'phone':_0x183e6c[_0x0e31('0x5f')]['from'],'messageId':_0x183e6c[_0x0e31('0x5f')][_0x0e31('0x85')],'body':_0x183e6c[_0x0e31('0x5f')][_0x0e31('0x5f')],'SmsAccountId':_0xaf41f0['params']['id'],'SmsInteractionId':_0x1de522['id'],'direction':'in','ContactId':_0x1de522['ContactId'],'AttachmentId':_0x183e6c[_0x0e31('0x5f')][_0x0e31('0xa8')]});})[_0x0e31('0x37')](function(_0x231866){_0x183e6c[_0x0e31('0x28')]=_0x231866;if(_0x183e6c[_0x0e31('0xa3')]['UserId']){return db[_0x0e31('0xa9')][_0x0e31('0x5d')]({'attributes':['id',_0x0e31('0x3d')],'where':{'id':_0x183e6c[_0x0e31('0xa3')][_0x0e31('0xaa')]}})[_0x0e31('0x37')](function(_0x2016c1){if(_0x2016c1){_0x183e6c[_0x0e31('0x76')][_0x0e31('0xab')]({'id':0x0,'priority':0x0,'app':_0x0e31('0xac'),'appdata':_0x2016c1[_0x0e31('0x3d')]+','+(_0x183e6c['account'][_0x0e31('0xad')]||0xa),'interval':_0x0e31('0xa7')});}return respondWithRpcPromise(_0x0e31('0xae'),_0x0e31('0xaf'),_0x183e6c);});}return respondWithRpcPromise(_0x0e31('0xae'),_0x0e31('0xaf'),_0x183e6c);})[_0x0e31('0x37')](function(_0x4f0e81){if(_0x4f0e81){var _0x4a9fca=0xc8;var _0x12adaa=_0x0e31('0xb0');logger[_0x0e31('0x22')](_0x0e31('0xb1'),_0x12adaa,_0x4a9fca,'entity\x20found');logger[_0x0e31('0x24')](_0x0e31('0xb2'),_0x12adaa,_0x4a9fca,_0x0e31('0xb3'),JSON['stringify'](_0x4f0e81));if(_0x183e6c['account']['type']===_0x0e31('0xb4')){return _0x535d4f['status'](_0x4a9fca)['set'](_0x0e31('0xb5'),_0x0e31('0xb6'))[_0x0e31('0x3e')](_0x0e31('0xb7'));}else{return _0x535d4f['status'](_0x4a9fca)['json'](_0x4f0e81);}}})[_0x0e31('0x2a')](handleError(_0x535d4f,null));};exports[_0x0e31('0xb8')]=function(_0x593833,_0x6292a0){var _0x3a75dc=_0x593833[_0x0e31('0x65')]['id'];var _0x3feb90=_0x593833[_0x0e31('0x5f')];var _0x4dc00b=0xc8;var _0x295e51=null;return db[_0x0e31('0xb9')][_0x0e31('0xba')]({'isolationLevel':db[_0x0e31('0xb9')][_0x0e31('0xbb')]['ISOLATION_LEVELS'][_0x0e31('0xbc')]},function(_0x266024){return db['SmsAccount'][_0x0e31('0x70')]({'where':{'id':_0x3a75dc},'transaction':_0x266024})[_0x0e31('0x37')](function(_0x43e801){if(_0x43e801){return db[_0x0e31('0xbd')][_0x0e31('0x38')]({'where':{'SmsAccountId':_0x3a75dc},'transaction':_0x266024})[_0x0e31('0x37')](function(){var _0x395702=_[_0x0e31('0x47')](_0x3feb90,function(_0xc84bfb){_0xc84bfb[_0x0e31('0x6e')]=_0x3a75dc;return _0xc84bfb;});return db[_0x0e31('0xbd')][_0x0e31('0xbe')](_0x395702,{'transaction':_0x266024});});}else{_0x4dc00b=0x194;_0x295e51=[];}});})['then'](function(){if(_0x4dc00b!==0x194){return db['SmsApplication'][_0x0e31('0xbf')]({'where':{'SmsAccountId':_0x3a75dc},'order':_0x0e31('0x78')})['then'](function(_0xaa28ba){_0x295e51=_0xaa28ba;});}})[_0x0e31('0x2a')](function(_0x8afc29){_0x4dc00b=0x1f4;logger['error'](_0x8afc29[_0x0e31('0x3c')]);if(_0x8afc29[_0x0e31('0x3d')]){delete _0x8afc29[_0x0e31('0x3d')];}_0x295e51=_0x8afc29;})[_0x0e31('0xc0')](function(){if(_0x295e51===null){_0x6292a0[_0x0e31('0x3b')](_0x4dc00b);}else{if(_0x4dc00b===0x1f4){_0x6292a0[_0x0e31('0x2b')](_0x4dc00b)[_0x0e31('0x3e')](_0x295e51);}else{_0x6292a0[_0x0e31('0x2b')](_0x4dc00b)[_0x0e31('0x2d')](_0x295e51);}}});};exports[_0x0e31('0xc1')]=function(_0x6e9140,_0x3f3854,_0x5d3410){var _0x89162d={};var _0x3c5665={};var _0x880743;var _0x16e266;return db['SmsAccount'][_0x0e31('0x70')]({'where':{'id':_0x6e9140[_0x0e31('0x65')]['id']}})[_0x0e31('0x37')](handleEntityNotFound(_0x3f3854,null))[_0x0e31('0x37')](function(_0x4d8be3){if(_0x4d8be3){_0x880743=_0x4d8be3;_0x3c5665[_0x0e31('0x46')]=_['keys'](db['SmsApplication'][_0x0e31('0x42')]);_0x3c5665[_0x0e31('0x48')]=_[_0x0e31('0x5b')](_0x6e9140[_0x0e31('0x48')]);_0x3c5665[_0x0e31('0x49')]=_[_0x0e31('0x4b')](_0x3c5665['model'],_0x3c5665[_0x0e31('0x48')]);_0x89162d[_0x0e31('0x4a')]=_[_0x0e31('0x4b')](_0x3c5665[_0x0e31('0x46')],qs[_0x0e31('0x4c')](_0x6e9140['query'][_0x0e31('0x4c')]));_0x89162d['attributes']=_0x89162d['attributes'][_0x0e31('0x69')]?_0x89162d[_0x0e31('0x4a')]:_0x3c5665['model'];_0x89162d[_0x0e31('0x4f')]=qs['sort'](_0x6e9140['query']['sort']);_0x89162d[_0x0e31('0x51')]=qs[_0x0e31('0x49')](_[_0x0e31('0x52')](_0x6e9140[_0x0e31('0x48')],_0x3c5665[_0x0e31('0x49')]));if(_0x6e9140[_0x0e31('0x48')]['filter']){_0x89162d[_0x0e31('0x51')]=_[_0x0e31('0x55')](_0x89162d[_0x0e31('0x51')],{'$or':_[_0x0e31('0x47')](_0x89162d[_0x0e31('0x4a')],function(_0x274e38){var _0x739442={};_0x739442[_0x274e38]={'$like':'%'+_0x6e9140[_0x0e31('0x48')][_0x0e31('0x53')]+'%'};return _0x739442;})});}_0x89162d=_['merge']({},_0x89162d,_0x6e9140[_0x0e31('0x5c')]);return _0x880743[_0x0e31('0xc1')](_0x89162d);}})[_0x0e31('0x37')](function(_0x14e5cb){if(_0x14e5cb){_0x16e266=_0x14e5cb[_0x0e31('0x69')];if(!_0x6e9140[_0x0e31('0x48')][_0x0e31('0x4d')](_0x0e31('0x4e'))){_0x89162d[_0x0e31('0x30')]=qs[_0x0e31('0x30')](_0x6e9140[_0x0e31('0x48')][_0x0e31('0x30')]);_0x89162d['offset']=qs[_0x0e31('0x2e')](_0x6e9140[_0x0e31('0x48')][_0x0e31('0x2e')]);}return _0x880743[_0x0e31('0xc1')](_0x89162d);}})['then'](function(_0xce70ba){if(_0xce70ba){return _0xce70ba?{'count':_0x16e266,'rows':_0xce70ba}:null;}})[_0x0e31('0x37')](respondWithResult(_0x3f3854,null))[_0x0e31('0x2a')](handleError(_0x3f3854,null));};exports[_0x0e31('0xc2')]=function(_0x18810f,_0x5babb9,_0x5304e2){var _0x1a4c0a={'raw':![],'where':{}};var _0x39f637={};var _0x4e0872={'count':0x0,'rows':[]};return db['SmsAccount'][_0x0e31('0x70')]({'where':{'id':_0x18810f[_0x0e31('0x65')]['id']}})[_0x0e31('0x37')](handleEntityNotFound(_0x5babb9,null))[_0x0e31('0x37')](function(_0x61b4c){if(_0x61b4c){_0x39f637[_0x0e31('0x46')]=_[_0x0e31('0x5b')](db[_0x0e31('0xa2')][_0x0e31('0x42')]);_0x39f637[_0x0e31('0x48')]=_[_0x0e31('0x5b')](_0x18810f['query']);_0x39f637[_0x0e31('0x49')]=_[_0x0e31('0x4b')](_0x39f637[_0x0e31('0x46')],_0x39f637[_0x0e31('0x48')]);_0x1a4c0a[_0x0e31('0x4a')]=_[_0x0e31('0x4b')](_0x39f637['model'],qs['fields'](_0x18810f[_0x0e31('0x48')][_0x0e31('0x4c')]));_0x1a4c0a[_0x0e31('0x4a')]=_0x1a4c0a['attributes']['length']?_0x1a4c0a[_0x0e31('0x4a')]:_0x39f637[_0x0e31('0x46')];if(!_0x18810f['query'][_0x0e31('0x4d')](_0x0e31('0x4e'))){_0x1a4c0a[_0x0e31('0x30')]=qs[_0x0e31('0x30')](_0x18810f[_0x0e31('0x48')]['limit']);_0x1a4c0a['offset']=qs[_0x0e31('0x2e')](_0x18810f['query'][_0x0e31('0x2e')]);}_0x1a4c0a[_0x0e31('0x4f')]=qs[_0x0e31('0x50')](_0x18810f[_0x0e31('0x48')][_0x0e31('0x50')]);_0x1a4c0a[_0x0e31('0x51')]=qs[_0x0e31('0x49')](_[_0x0e31('0x52')](_0x18810f[_0x0e31('0x48')],_0x39f637[_0x0e31('0x49')]));_0x1a4c0a[_0x0e31('0x51')][_0x0e31('0x6e')]=_0x61b4c['id'];if(_0x18810f[_0x0e31('0x48')][_0x0e31('0x53')]){_0x1a4c0a[_0x0e31('0x51')]=_[_0x0e31('0x55')](_0x1a4c0a['where'],{'$or':_[_0x0e31('0x47')](_0x1a4c0a[_0x0e31('0x4a')],function(_0x27b2dd){var _0xefe6a6={};_0xefe6a6[_0x27b2dd]={'$like':'%'+_0x18810f[_0x0e31('0x48')][_0x0e31('0x53')]+'%'};return _0xefe6a6;})});}_0x1a4c0a=_[_0x0e31('0x55')]({},_0x1a4c0a,_0x18810f[_0x0e31('0x5c')]);return db[_0x0e31('0xa2')][_0x0e31('0x31')]({'where':_0x1a4c0a[_0x0e31('0x51')]})[_0x0e31('0x37')](function(_0x2ab9c4){_0x4e0872[_0x0e31('0x31')]=_0x2ab9c4;if(_0x18810f[_0x0e31('0x48')][_0x0e31('0x56')]){_0x1a4c0a[_0x0e31('0x57')]=[{'model':db[_0x0e31('0x7a')],'as':_0x0e31('0xc3'),'required':![]},{'model':db[_0x0e31('0xa9')],'as':_0x0e31('0xc4'),'attributes':[_0x0e31('0x3d'),_0x0e31('0xc5'),_0x0e31('0xc6')],'required':![]},{'model':db[_0x0e31('0xc7')],'as':'Tags','attributes':['id',_0x0e31('0x3d'),_0x0e31('0xc8')],'where':_0x18810f['query'][_0x0e31('0xc9')]?{'id':_0x18810f[_0x0e31('0x48')][_0x0e31('0xc9')]}:undefined,'required':_0x18810f['query']['tag']?!![]:![]}];}return db[_0x0e31('0xa2')]['findAll'](_0x1a4c0a);})[_0x0e31('0x37')](function(_0x42f2c2){_0x4e0872[_0x0e31('0x6a')]=_0x42f2c2;return _0x4e0872;});}})[_0x0e31('0x37')](respondWithFilteredResult(_0x5babb9,_0x1a4c0a))[_0x0e31('0x2a')](handleError(_0x5babb9,null));};exports[_0x0e31('0x3e')]=function(_0x2698ff,_0x486937,_0x3f1f4b){var _0x5b5e8d,_0x609ef8,_0x3a7a35;if(_['isNil'](_0x2698ff['body'][_0x0e31('0x5f')])||_0x2698ff[_0x0e31('0x5f')][_0x0e31('0x5f')]===''){throw new db[(_0x0e31('0x98'))][(_0x0e31('0x7b'))](_0x0e31('0xca'));}if(_[_0x0e31('0x97')](_0x2698ff['body']['to'])){throw new db[(_0x0e31('0x98'))][(_0x0e31('0x7b'))](_0x0e31('0xcb'));}_0x5b5e8d=_0x2698ff[_0x0e31('0x5f')]['to'];return db[_0x0e31('0x41')][_0x0e31('0x5d')]({'where':{'id':_0x2698ff[_0x0e31('0x65')]['id']},'include':[{'model':db[_0x0e31('0x9e')],'as':_0x0e31('0xcc'),'include':[{'model':db[_0x0e31('0x7a')],'as':_0x0e31('0x9f'),'where':{'mobile':_0x5b5e8d},'limit':0x1,'order':[[_0x0e31('0x7f'),_0x0e31('0xcd')]]}]}]})[_0x0e31('0x37')](handleEntityNotFound(_0x486937,null))[_0x0e31('0x37')](function(_0x4c7620){if(_0x4c7620&&_0x4c7620[_0x0e31('0xcc')]){_0x609ef8=_0x4c7620[_0x0e31('0x39')]({'plain':!![]});if(_0x609ef8[_0x0e31('0xcc')]&&_0x609ef8[_0x0e31('0xcc')][_0x0e31('0x9f')][_0x0e31('0x69')]){return _0x609ef8['List'][_0x0e31('0x9f')][0x0];}return db[_0x0e31('0x7a')][_0x0e31('0x5e')](_[_0x0e31('0x19')](_0x2698ff['body'],{'firstName':_0x5b5e8d,'mobile':_0x5b5e8d,'phone':_0x5b5e8d,'ListId':_0x609ef8[_0x0e31('0xce')]}));}})[_0x0e31('0x37')](handleEntityNotFound(_0x486937,null))[_0x0e31('0x37')](function(_0x1532af){if(_0x1532af){_0x3a7a35=_0x1532af;return db[_0x0e31('0xa2')][_0x0e31('0x5d')]({'where':{'ContactId':_0x3a7a35['id'],'closed':![],'SmsAccountId':_0x609ef8['id']}})[_0x0e31('0x37')](function(_0x406784){if(_0x406784){return[_0x406784,![]];}return db[_0x0e31('0xa2')]['create']({'UserId':_0x2698ff[_0x0e31('0x60')]['id'],'ContactId':_0x3a7a35['id'],'SmsAccountId':_0x609ef8['id'],'phone':_0x5b5e8d,'firstMsgDirection':_0x0e31('0xcf'),'Messages':[_[_0x0e31('0x55')](_0x2698ff[_0x0e31('0x5f')],{'read':![],'body':_0x2698ff[_0x0e31('0x5f')][_0x0e31('0x5f')],'phone':_0x5b5e8d,'SmsAccountId':_0x609ef8['id'],'UserId':_0x2698ff[_0x0e31('0x60')]['id'],'ContactId':_0x3a7a35['id']})]},{'include':[{'model':db[_0x0e31('0xd0')],'as':_0x0e31('0xd1')}]})[_0x0e31('0x37')](function(_0x17face){return[_0x17face,!![]];});});}})[_0x0e31('0xd2')](function(_0x521f4e,_0x9bbf4e){if(_0x9bbf4e){return _0x521f4e;}return db[_0x0e31('0xd0')][_0x0e31('0x5e')](_[_0x0e31('0x55')](_0x2698ff[_0x0e31('0x5f')],{'read':![],'body':_0x2698ff[_0x0e31('0x5f')][_0x0e31('0x5f')],'phone':_0x5b5e8d,'SmsAccountId':_0x609ef8['id'],'SmsInteractionId':_0x521f4e['id'],'UserId':_0x2698ff[_0x0e31('0x60')]['id'],'ContactId':_0x3a7a35['id']}))[_0x0e31('0x37')](function(_0x1d744d){_0x521f4e['dataValues'][_0x0e31('0xd1')]=[];_0x521f4e[_0x0e31('0xd3')]['Messages'][_0x0e31('0xa5')](_0x1d744d[_0x0e31('0xd3')]);return _0x521f4e;});})[_0x0e31('0x37')](respondWithResult(_0x486937,null))[_0x0e31('0x2a')](handleError(_0x486937,null));};exports[_0x0e31('0x2b')]=function(_0x29e260,_0x170204,_0x12943e){if(_0x29e260[_0x0e31('0x5f')]['id']){delete _0x29e260[_0x0e31('0x5f')]['id'];}var _0x294d11,_0xe2a31d,_0x2777db;return db[_0x0e31('0x41')][_0x0e31('0x5d')]({'where':{'id':_0x29e260[_0x0e31('0x65')]['id']}})[_0x0e31('0x37')](handleEntityNotFound(_0x170204,null))[_0x0e31('0x37')](function(_0x56a776){if(_0x56a776){_0x2777db=_0x56a776;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0e31('0x2b'),_0x0e31('0xd4'),_0x56a776[_0x0e31('0x44')],util[_0x0e31('0xd5')](_0x29e260[_0x0e31('0x5f')],{'showHidden':![],'depth':null}));switch(_0x56a776[_0x0e31('0x44')]){case _0x0e31('0x86'):if(_0x29e260['body'][_0x0e31('0xd6')]&&_0x29e260['body'][_0x0e31('0x2b')]){_0xe2a31d=_0x29e260[_0x0e31('0x5f')][_0x0e31('0x2b')];return db['SmsMessage'][_0x0e31('0x5d')]({'where':{'messageId':_0x29e260[_0x0e31('0x5f')][_0x0e31('0xd6')]}});}break;case _0x0e31('0x89'):if(_0x29e260[_0x0e31('0x5f')][_0x0e31('0xd7')]&&_0x29e260[_0x0e31('0x5f')][_0x0e31('0xd8')]){_0xe2a31d=_0x29e260[_0x0e31('0x5f')]['statusInt'];return db[_0x0e31('0xd0')]['find']({'where':{'messageId':_0x29e260[_0x0e31('0x5f')][_0x0e31('0xd7')]}});}break;case _0x0e31('0x8a'):if(_0x29e260[_0x0e31('0x5f')][_0x0e31('0x8b')]&&_0x29e260[_0x0e31('0x5f')][_0x0e31('0xd9')]){_0xe2a31d=_0x29e260['body']['status_code'];return db[_0x0e31('0xd0')]['find']({'where':{'messageId':_0x29e260[_0x0e31('0x5f')][_0x0e31('0x8b')]}});}break;case'infobip':var _0x2a1296=_0x29e260[_0x0e31('0x5f')][_0x0e31('0x8e')][0x0];if(_0x2a1296['messageId']&&_0x2a1296['status']['groupName']==='DELIVERED'){_0xe2a31d=_0x2a1296['status'][_0x0e31('0xda')];return db['SmsMessage'][_0x0e31('0x5d')]({'where':{'messageId':_0x2a1296[_0x0e31('0x85')]}});}break;case _0x0e31('0x92'):if(_0x29e260[_0x0e31('0x5f')]['messageId']&&_0x29e260['body'][_0x0e31('0x2b')]){_0xe2a31d=_0x29e260['body'][_0x0e31('0x2b')];return db['SmsMessage'][_0x0e31('0x5d')]({'where':{'messageId':_0x29e260[_0x0e31('0x5f')][_0x0e31('0x85')]}});}break;case _0x0e31('0x94'):if(_0x29e260[_0x0e31('0x5f')][0x0][_0x0e31('0x28')]['id']){_0xe2a31d=_0x29e260[_0x0e31('0x5f')][0x0]['type'];return db[_0x0e31('0xd0')]['find']({'where':{'messageId':_0x29e260[_0x0e31('0x5f')][0x0]['message']['id']}});}break;case _0x0e31('0x95'):if(_0x29e260['body'][_0x0e31('0xdb')]&&_0x29e260[_0x0e31('0x5f')][_0x0e31('0x2b')]){_0xe2a31d=_0x29e260['body']['status'];return db[_0x0e31('0xd0')][_0x0e31('0x5d')]({'where':{'messageId':_0x29e260[_0x0e31('0x5f')][_0x0e31('0xdb')]}});}break;}}})['then'](handleEntityNotFound(_0x170204,null))[_0x0e31('0x37')](function(_0x2138ac){if(_0x2138ac){_0x294d11=_0x2138ac;switch(_0x2777db[_0x0e31('0x44')]){case _0x0e31('0x86'):if(_0xe2a31d===_0x0e31('0xdc')){return _0x294d11[_0x0e31('0x36')]({'read':!![]});}else{logger[_0x0e31('0x26')](_0x0e31('0xb1'),'status','skebby',util[_0x0e31('0xd5')](_0x29e260[_0x0e31('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x0e31('0x89'):if(_0xe2a31d==='1'){return _0x294d11[_0x0e31('0x36')]({'read':!![]});}else{logger[_0x0e31('0x26')](_0x0e31('0xb1'),'status',_0x0e31('0x86'),util[_0x0e31('0xd5')](_0x29e260[_0x0e31('0x5f')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x29e260[_0x0e31('0x5f')]['error_code']&&_0xe2a31d>=0xc8&&_0xe2a31d<=0xce){return _0x294d11[_0x0e31('0x36')]({'read':!![]});}else{logger[_0x0e31('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0e31('0x2b'),_0x0e31('0x8a'),util[_0x0e31('0xd5')](_0x29e260[_0x0e31('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x0e31('0xdd'):var _0x4abb15=_0x29e260['body'][_0x0e31('0x8e')][0x0];if(_0x4abb15[_0x0e31('0x2b')][_0x0e31('0xda')]===_0x0e31('0xdc')){return _0x294d11[_0x0e31('0x36')]({'read':!![]});}else{logger[_0x0e31('0x26')](_0x0e31('0xb1'),_0x0e31('0x2b'),_0x0e31('0xdd'),util[_0x0e31('0xd5')](_0x29e260['body'],{'showHidden':![],'depth':null}));}break;case _0x0e31('0x92'):if(_0xe2a31d==_0x0e31('0xde')||_0xe2a31d=='RECEIVED_BY_RECIPIENT'){return _0x294d11['update']({'read':!![]});}else{logger['error'](_0x0e31('0xb1'),_0x0e31('0x2b'),_0x0e31('0x92'),util['inspect'](_0x29e260[_0x0e31('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x0e31('0x94'):if(_0xe2a31d==_0x0e31('0xdf')){return _0x294d11[_0x0e31('0x36')]({'read':!![]});}else{logger[_0x0e31('0x26')](_0x0e31('0xb1'),_0x0e31('0x2b'),'bandwidth',util[_0x0e31('0xd5')](_0x29e260[_0x0e31('0x5f')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0xe2a31d===_0x0e31('0xe0')||_0xe2a31d===_0x0e31('0xe1')){return _0x294d11[_0x0e31('0x36')]({'read':!![]});}else{logger[_0x0e31('0x26')](_0x0e31('0xb1'),_0x0e31('0x2b'),_0x0e31('0x95'),util['inspect'](_0x29e260[_0x0e31('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x294d11;}})['then'](respondWithResult(_0x170204,null))[_0x0e31('0x2a')](handleError(_0x170204,null));};exports['statusGet']=function(_0x4aef86,_0x49ac66,_0x576577){var _0x37ba11,_0x3635fb,_0x4cebcc;return db[_0x0e31('0x41')]['find']({'where':{'id':_0x4aef86[_0x0e31('0x65')]['id']}})[_0x0e31('0x37')](handleEntityNotFound(_0x49ac66,null))[_0x0e31('0x37')](function(_0x5ede21){if(_0x5ede21){_0x4cebcc=_0x5ede21;logger[_0x0e31('0x24')](_0x0e31('0xb1'),_0x0e31('0x2b'),_0x0e31('0xd4'),_0x5ede21[_0x0e31('0x44')],util[_0x0e31('0xd5')](_0x4aef86[_0x0e31('0x48')],{'showHidden':![],'depth':null}));switch(_0x5ede21['type']){case'csc':if(_0x4aef86[_0x0e31('0x48')][_0x0e31('0xe2')]&&_0x4aef86['query'][_0x0e31('0xe3')]){_0x3635fb=_0x4aef86[_0x0e31('0x48')][_0x0e31('0xe3')];return db[_0x0e31('0xd0')][_0x0e31('0x5d')]({'where':{'messageId':_0x4aef86[_0x0e31('0x48')][_0x0e31('0xe2')]}});}break;}}})[_0x0e31('0x37')](handleEntityNotFound(_0x49ac66,null))['then'](function(_0x487114){if(_0x487114){_0x37ba11=_0x487114;switch(_0x4cebcc[_0x0e31('0x44')]){case _0x0e31('0x8f'):if(_0x3635fb==='2'||_0x3635fb==='6'){return _0x37ba11['update']({'read':!![]});}else{logger['error'](_0x0e31('0xb1'),'status',_0x0e31('0x8f'),util['inspect'](_0x4aef86[_0x0e31('0x48')],{'showHidden':![],'depth':null}));};break;}return _0x37ba11;}})[_0x0e31('0x37')](respondWithResult(_0x49ac66,null))[_0x0e31('0x2a')](handleError(_0x49ac66,null));};exports[_0x0e31('0xe4')]=function(_0x4f2a5c,_0x1e54f2,_0x402add){return db['SmsAccount'][_0x0e31('0x5d')]({'where':{'id':_0x4f2a5c[_0x0e31('0x65')]['id']}})[_0x0e31('0x37')](handleEntityNotFound(_0x1e54f2,null))['then'](function(_0x45e483){if(_0x45e483){return _0x45e483[_0x0e31('0xe4')](_0x4f2a5c[_0x0e31('0x5f')][_0x0e31('0x6c')],_['omit'](_0x4f2a5c[_0x0e31('0x5f')],[_0x0e31('0x6c'),'id'])||{})[_0x0e31('0xd2')](function(_0x5e8d89){for(var _0x3b58bb=0x0;_0x3b58bb<_0x4f2a5c[_0x0e31('0x5f')][_0x0e31('0x6c')][_0x0e31('0x69')];_0x3b58bb+=0x1){socket[_0x0e31('0xe5')](_0x0e31('0xe6'),{'UserId':Number(_0x4f2a5c[_0x0e31('0x5f')][_0x0e31('0x6c')][_0x3b58bb]),'SmsAccountId':Number(_0x4f2a5c[_0x0e31('0x65')]['id'])});}return _0x5e8d89;});}})[_0x0e31('0x37')](respondWithResult(_0x1e54f2,null))[_0x0e31('0x2a')](handleError(_0x1e54f2,null));};exports[_0x0e31('0xe7')]=function(_0x14829b,_0x5d5e9d,_0x486c4f){return db['SmsAccount'][_0x0e31('0x5d')]({'where':{'id':_0x14829b[_0x0e31('0x65')]['id']}})[_0x0e31('0x37')](handleEntityNotFound(_0x5d5e9d,null))[_0x0e31('0x37')](function(_0x4e3c97){if(_0x4e3c97){return _0x4e3c97[_0x0e31('0xe7')](_0x14829b[_0x0e31('0x48')][_0x0e31('0x6c')])['then'](function(){if(_[_0x0e31('0xe8')](_0x14829b[_0x0e31('0x48')][_0x0e31('0x6c')])){for(var _0x3f1dcd=0x0;_0x3f1dcd<_0x14829b['query'][_0x0e31('0x6c')][_0x0e31('0x69')];_0x3f1dcd+=0x1){socket[_0x0e31('0xe5')](_0x0e31('0xe9'),{'UserId':Number(_0x14829b[_0x0e31('0x48')]['ids'][_0x3f1dcd]),'SmsAccountId':Number(_0x14829b[_0x0e31('0x65')]['id'])});}}else{socket[_0x0e31('0xe5')]('userSmsAccount:remove',{'UserId':Number(_0x14829b[_0x0e31('0x48')][_0x0e31('0x6c')]),'SmsAccountId':Number(_0x14829b[_0x0e31('0x65')]['id'])});}});}})[_0x0e31('0x37')](respondWithStatusCode(_0x5d5e9d,null))[_0x0e31('0x2a')](handleError(_0x5d5e9d,null));};exports[_0x0e31('0xea')]=function(_0x58c5b6,_0x2362c9,_0x39a1fe){var _0x2c47f8={};var _0x1f308d={};var _0x3ca987;var _0x3aba00;return db['SmsAccount']['findOne']({'where':{'id':_0x58c5b6[_0x0e31('0x65')]['id']}})[_0x0e31('0x37')](handleEntityNotFound(_0x2362c9,null))[_0x0e31('0x37')](function(_0x1dcfdc){if(_0x1dcfdc){_0x3ca987=_0x1dcfdc;_0x1f308d[_0x0e31('0x46')]=_[_0x0e31('0x5b')](db[_0x0e31('0xa9')][_0x0e31('0x42')]);_0x1f308d[_0x0e31('0x48')]=_[_0x0e31('0x5b')](_0x58c5b6[_0x0e31('0x48')]);_0x1f308d[_0x0e31('0x49')]=_[_0x0e31('0x4b')](_0x1f308d[_0x0e31('0x46')],_0x1f308d[_0x0e31('0x48')]);_0x2c47f8[_0x0e31('0x4a')]=_[_0x0e31('0x4b')](_0x1f308d[_0x0e31('0x46')],qs[_0x0e31('0x4c')](_0x58c5b6[_0x0e31('0x48')][_0x0e31('0x4c')]));_0x2c47f8[_0x0e31('0x4a')]=_0x2c47f8[_0x0e31('0x4a')][_0x0e31('0x69')]?_0x2c47f8[_0x0e31('0x4a')]:_0x1f308d[_0x0e31('0x46')];_0x2c47f8['order']=qs[_0x0e31('0x50')](_0x58c5b6['query'][_0x0e31('0x50')]);_0x2c47f8['where']=qs['filters'](_[_0x0e31('0x52')](_0x58c5b6[_0x0e31('0x48')],_0x1f308d[_0x0e31('0x49')]));if(_0x58c5b6[_0x0e31('0x48')]['filter']){_0x2c47f8[_0x0e31('0x51')]=_[_0x0e31('0x55')](_0x2c47f8['where'],{'$or':_[_0x0e31('0x47')](_0x2c47f8[_0x0e31('0x4a')],function(_0x12d8bc){var _0xa66ee8={};_0xa66ee8[_0x12d8bc]={'$like':'%'+_0x58c5b6[_0x0e31('0x48')][_0x0e31('0x53')]+'%'};return _0xa66ee8;})});}_0x2c47f8=_[_0x0e31('0x55')]({},_0x2c47f8,_0x58c5b6[_0x0e31('0x5c')]);return _0x3ca987[_0x0e31('0xea')](_0x2c47f8);}})['then'](function(_0x463af9){if(_0x463af9){_0x3aba00=_0x463af9['length'];if(!_0x58c5b6['query'][_0x0e31('0x4d')]('nolimit')){_0x2c47f8[_0x0e31('0x30')]=qs[_0x0e31('0x30')](_0x58c5b6[_0x0e31('0x48')][_0x0e31('0x30')]);_0x2c47f8[_0x0e31('0x2e')]=qs[_0x0e31('0x2e')](_0x58c5b6['query'][_0x0e31('0x2e')]);}return _0x3ca987[_0x0e31('0xea')](_0x2c47f8);}})[_0x0e31('0x37')](function(_0x3102e6){if(_0x3102e6){return _0x3102e6?{'count':_0x3aba00,'rows':_0x3102e6}:null;}})[_0x0e31('0x37')](respondWithResult(_0x2362c9,null))[_0x0e31('0x2a')](handleError(_0x2362c9,null));}; \ No newline at end of file +var _0x9de9=['bulkCreate','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','CmList','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','groupName','clickatell','DELIVERED','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','SmsAccount,\x20%s,\x20%s','message','info','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','SmsAccount','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','params','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','includeAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','ids','sms','SmsApplication','Applications','priority','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','text','clicksend','message_id','Text','MessageUUID','infobip','results','csc','segmentedMessage','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','omit','defaults','contact','SmsInteraction','spread','interaction','autoclose','push','applications','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','READ_COMMITTED'];(function(_0x2074fb,_0x26707f){var _0x4c71d3=function(_0x4d32ef){while(--_0x4d32ef){_0x2074fb['push'](_0x2074fb['shift']());}};_0x4c71d3(++_0x26707f);}(_0x9de9,0x113));var _0x99de=function(_0x42e89f,_0x1a1462){_0x42e89f=_0x42e89f-0x0;var _0x148847=_0x9de9[_0x42e89f];return _0x148847;};'use strict';var emlformat=require(_0x99de('0x0'));var rimraf=require(_0x99de('0x1'));var zipdir=require(_0x99de('0x2'));var jsonpatch=require(_0x99de('0x3'));var rp=require(_0x99de('0x4'));var moment=require(_0x99de('0x5'));var BPromise=require(_0x99de('0x6'));var Mustache=require(_0x99de('0x7'));var util=require(_0x99de('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x99de('0x9'));var fs=require('fs');var fs_extra=require(_0x99de('0xa'));var _=require(_0x99de('0xb'));var squel=require('squel');var crypto=require(_0x99de('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x99de('0xd'));var toCsv=require(_0x99de('0xe'));var querystring=require('querystring');var Papa=require(_0x99de('0xf'));var Redis=require(_0x99de('0x10'));var authService=require(_0x99de('0x11'));var qs=require(_0x99de('0x12'));var as=require(_0x99de('0x13'));var hardwareService=require(_0x99de('0x14'));var logger=require(_0x99de('0x15'))(_0x99de('0x16'));var utils=require(_0x99de('0x17'));var config=require(_0x99de('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x99de('0x19')]=_['defaults'](config[_0x99de('0x19')],{'host':_0x99de('0x1a'),'port':0x18eb});var socket=require(_0x99de('0x1b'))(new Redis(config[_0x99de('0x19')]));require(_0x99de('0x1c'))[_0x99de('0x1d')](socket);var jayson=require(_0x99de('0x1e'));var client=jayson[_0x99de('0x1f')][_0x99de('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x3c4f34,_0x27f1a6,_0x4008f9,_0x2d5819){return new BPromise(function(_0x493559,_0x335f9a){var _0x45beca=_0x2d5819||client;return _0x45beca[_0x99de('0x21')](_0x3c4f34,_0x4008f9)[_0x99de('0x22')](function(_0x48cd2e){logger['info']('SmsAccount,\x20%s,\x20%s',_0x27f1a6,_0x99de('0x23'));logger[_0x99de('0x24')](_0x99de('0x25'),_0x27f1a6,_0x99de('0x23'),JSON[_0x99de('0x26')](_0x48cd2e));if(_0x48cd2e[_0x99de('0x27')]){if(_0x48cd2e['error']['code']===0x1f4){logger[_0x99de('0x27')](_0x99de('0x28'),_0x27f1a6,_0x48cd2e['error'][_0x99de('0x29')]);return _0x335f9a(_0x48cd2e[_0x99de('0x27')]['message']);}logger[_0x99de('0x27')]('SmsAccount,\x20%s,\x20%s',_0x27f1a6,_0x48cd2e['error'][_0x99de('0x29')]);return _0x493559(_0x48cd2e[_0x99de('0x27')][_0x99de('0x29')]);}else{logger[_0x99de('0x2a')](_0x99de('0x28'),_0x27f1a6,_0x99de('0x23'));_0x493559(_0x48cd2e[_0x99de('0x2b')]['message']);}})['catch'](function(_0x5cf44e){logger['error'](_0x99de('0x28'),_0x27f1a6,_0x5cf44e);_0x335f9a(_0x5cf44e);});});}function respondWithStatusCode(_0x59ff23,_0x4f837a){_0x4f837a=_0x4f837a||0xcc;return function(_0x24cd22){if(_0x24cd22){return _0x59ff23[_0x99de('0x2c')](_0x4f837a);}return _0x59ff23[_0x99de('0x2d')](_0x4f837a)[_0x99de('0x2e')]();};}function respondWithResult(_0x3fa8d9,_0x33a66c){_0x33a66c=_0x33a66c||0xc8;return function(_0x1ffbf5){if(_0x1ffbf5){return _0x3fa8d9[_0x99de('0x2d')](_0x33a66c)[_0x99de('0x2f')](_0x1ffbf5);}};}function respondWithFilteredResult(_0xb9e36c,_0x1f60e1){return function(_0x21c224){if(_0x21c224){var _0x2f1542=typeof _0x1f60e1[_0x99de('0x30')]==='undefined'&&typeof _0x1f60e1['limit']===_0x99de('0x31');var _0x345441=_0x21c224[_0x99de('0x32')];var _0x23bebc=_0x2f1542?0x0:_0x1f60e1[_0x99de('0x30')];var _0x180a43=_0x2f1542?_0x21c224['count']:_0x1f60e1[_0x99de('0x30')]+_0x1f60e1[_0x99de('0x33')];var _0x643f1b;if(_0x180a43>=_0x345441){_0x180a43=_0x345441;_0x643f1b=0xc8;}else{_0x643f1b=0xce;}_0xb9e36c[_0x99de('0x2d')](_0x643f1b);return _0xb9e36c[_0x99de('0x34')](_0x99de('0x35'),_0x23bebc+'-'+_0x180a43+'/'+_0x345441)[_0x99de('0x2f')](_0x21c224);}return null;};}function patchUpdates(_0x51f604){return function(_0x265ba4){try{jsonpatch[_0x99de('0x36')](_0x265ba4,_0x51f604,!![]);}catch(_0x334cb7){return BPromise[_0x99de('0x37')](_0x334cb7);}return _0x265ba4[_0x99de('0x38')]();};}function saveUpdates(_0x1f3da3,_0x13c393){return function(_0x2cd0dc){if(_0x2cd0dc){return _0x2cd0dc[_0x99de('0x39')](_0x1f3da3)[_0x99de('0x22')](function(_0x30c703){return _0x30c703;});}return null;};}function removeEntity(_0x304542,_0x2ffcad){return function(_0x10da24){if(_0x10da24){return _0x10da24[_0x99de('0x3a')]()['then'](function(){var _0x2ec258=_0x10da24[_0x99de('0x3b')]({'plain':!![]});var _0x30e1c0='SmsAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x30e1c0,'resourceId':_0x2ec258['id']}})[_0x99de('0x22')](function(){return _0x10da24;});})[_0x99de('0x22')](function(){_0x304542[_0x99de('0x2d')](0xcc)[_0x99de('0x2e')]();});}};}function handleEntityNotFound(_0x3a3773,_0x68784d){return function(_0x4584a3){if(!_0x4584a3){_0x3a3773[_0x99de('0x2c')](0x194);}return _0x4584a3;};}function handleError(_0x2f8abd,_0x3c429a){_0x3c429a=_0x3c429a||0x1f4;return function(_0x3e890a){logger[_0x99de('0x27')](_0x3e890a['stack']);if(_0x3e890a[_0x99de('0x3c')]){delete _0x3e890a[_0x99de('0x3c')];}_0x2f8abd[_0x99de('0x2d')](_0x3c429a)[_0x99de('0x3d')](_0x3e890a);};}exports[_0x99de('0x3e')]=function(_0x1fdfe1,_0x13e95f){var _0x486324={'include':[{'model':db[_0x99de('0x3f')],'as':_0x99de('0x40')}]},_0x470bc1={},_0x536626={'count':0x0,'rows':[]};var _0x4c0699=_[_0x99de('0x41')](db['SmsAccount'][_0x99de('0x42')],function(_0x50f094){return{'name':_0x50f094['fieldName'],'type':_0x50f094[_0x99de('0x43')][_0x99de('0x44')]};});_0x470bc1[_0x99de('0x45')]=_[_0x99de('0x41')](_0x4c0699,'name');_0x470bc1[_0x99de('0x46')]=_[_0x99de('0x47')](_0x1fdfe1[_0x99de('0x46')]);_0x470bc1[_0x99de('0x48')]=_[_0x99de('0x49')](_0x470bc1[_0x99de('0x45')],_0x470bc1[_0x99de('0x46')]);_0x486324[_0x99de('0x4a')]=_[_0x99de('0x49')](_0x470bc1[_0x99de('0x45')],qs['fields'](_0x1fdfe1[_0x99de('0x46')][_0x99de('0x4b')]));_0x486324[_0x99de('0x4a')]=_0x486324['attributes'][_0x99de('0x4c')]?_0x486324['attributes']:_0x470bc1['model'];if(!_0x1fdfe1['query'][_0x99de('0x4d')](_0x99de('0x4e'))){_0x486324[_0x99de('0x33')]=qs['limit'](_0x1fdfe1[_0x99de('0x46')][_0x99de('0x33')]);_0x486324[_0x99de('0x30')]=qs[_0x99de('0x30')](_0x1fdfe1[_0x99de('0x46')][_0x99de('0x30')]);}_0x486324[_0x99de('0x4f')]=qs[_0x99de('0x50')](_0x1fdfe1[_0x99de('0x46')][_0x99de('0x50')]);_0x486324[_0x99de('0x51')]=qs[_0x99de('0x48')](_[_0x99de('0x52')](_0x1fdfe1[_0x99de('0x46')],_0x470bc1[_0x99de('0x48')]),_0x4c0699);if(_0x1fdfe1[_0x99de('0x46')][_0x99de('0x53')]){_0x486324[_0x99de('0x51')]=_[_0x99de('0x54')](_0x486324[_0x99de('0x51')],{'$or':_[_0x99de('0x41')](_0x4c0699,function(_0x13bf8c){if(_0x13bf8c[_0x99de('0x43')]!==_0x99de('0x55')){var _0x4c2282={};_0x4c2282[_0x13bf8c[_0x99de('0x3c')]]={'$like':'%'+_0x1fdfe1[_0x99de('0x46')]['filter']+'%'};return _0x4c2282;}})});}_0x486324=_[_0x99de('0x54')]({},_0x486324,_0x1fdfe1[_0x99de('0x56')]);var _0x56b097={'where':_0x486324['where']};return db['SmsAccount'][_0x99de('0x32')](_0x56b097)['then'](function(_0x189d76){_0x536626[_0x99de('0x32')]=_0x189d76;if(_0x1fdfe1[_0x99de('0x46')]['includeAll']){_0x486324[_0x99de('0x57')]=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x486324);})[_0x99de('0x22')](function(_0x88fc86){_0x536626[_0x99de('0x58')]=_0x88fc86;return _0x536626;})[_0x99de('0x22')](respondWithFilteredResult(_0x13e95f,_0x486324))[_0x99de('0x59')](handleError(_0x13e95f,null));};exports['show']=function(_0x344b50,_0x110af9){var _0x22eb6f={'raw':![],'where':{'id':_0x344b50['params']['id']},'include':[{'model':db[_0x99de('0x3f')],'as':_0x99de('0x40')}]},_0x2a7df5={};_0x2a7df5[_0x99de('0x45')]=_[_0x99de('0x47')](db[_0x99de('0x5a')][_0x99de('0x42')]);_0x2a7df5[_0x99de('0x46')]=_[_0x99de('0x47')](_0x344b50[_0x99de('0x46')]);_0x2a7df5[_0x99de('0x48')]=_[_0x99de('0x49')](_0x2a7df5[_0x99de('0x45')],_0x2a7df5[_0x99de('0x46')]);_0x22eb6f[_0x99de('0x4a')]=_[_0x99de('0x49')](_0x2a7df5[_0x99de('0x45')],qs['fields'](_0x344b50['query']['fields']));_0x22eb6f[_0x99de('0x4a')]=_0x22eb6f[_0x99de('0x4a')][_0x99de('0x4c')]?_0x22eb6f[_0x99de('0x4a')]:_0x2a7df5[_0x99de('0x45')];if(_0x344b50[_0x99de('0x46')]['includeAll']){_0x22eb6f[_0x99de('0x57')]=[{'all':!![]}];}_0x22eb6f=_[_0x99de('0x54')]({},_0x22eb6f,_0x344b50['options']);return db[_0x99de('0x5a')]['find'](_0x22eb6f)[_0x99de('0x22')](handleEntityNotFound(_0x110af9,null))['then'](respondWithResult(_0x110af9,null))[_0x99de('0x59')](handleError(_0x110af9,null));};exports[_0x99de('0x5b')]=function(_0x2d9f49,_0x24e229){return db[_0x99de('0x5a')][_0x99de('0x5b')](_0x2d9f49[_0x99de('0x5c')],{})[_0x99de('0x22')](function(_0x2d82c0){var _0x486765=_0x2d9f49[_0x99de('0x5d')][_0x99de('0x3b')]({'plain':!![]});if(!_0x486765)throw new Error(_0x99de('0x5e'));if(_0x486765[_0x99de('0x5f')]===_0x99de('0x5d')){var _0x2fdc9f=_0x2d82c0[_0x99de('0x3b')]({'plain':!![]});var _0x1b6eff='SmsAccounts';return db['UserProfileSection'][_0x99de('0x60')]({'where':{'name':_0x1b6eff,'userProfileId':_0x486765[_0x99de('0x61')]},'raw':!![]})[_0x99de('0x22')](function(_0x2246c0){if(_0x2246c0&&_0x2246c0[_0x99de('0x62')]===0x0){return db[_0x99de('0x63')]['create']({'name':_0x2fdc9f[_0x99de('0x3c')],'resourceId':_0x2fdc9f['id'],'type':_0x2246c0[_0x99de('0x3c')],'sectionId':_0x2246c0['id']},{})[_0x99de('0x22')](function(){return _0x2d82c0;});}else{return _0x2d82c0;}})[_0x99de('0x59')](function(_0x39b260){logger[_0x99de('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x39b260);throw _0x39b260;});}return _0x2d82c0;})[_0x99de('0x22')](respondWithResult(_0x24e229,0xc9))[_0x99de('0x59')](handleError(_0x24e229,null));};exports[_0x99de('0x39')]=function(_0x1803e8,_0x4d4a9e){if(_0x1803e8[_0x99de('0x5c')]['id']){delete _0x1803e8['body']['id'];}return db[_0x99de('0x5a')][_0x99de('0x60')]({'where':{'id':_0x1803e8[_0x99de('0x64')]['id']},'include':[{'model':db[_0x99de('0x3f')],'as':_0x99de('0x40')}]})['then'](handleEntityNotFound(_0x4d4a9e,null))[_0x99de('0x22')](saveUpdates(_0x1803e8[_0x99de('0x5c')],null))[_0x99de('0x22')](respondWithResult(_0x4d4a9e,null))['catch'](handleError(_0x4d4a9e,null));};exports['destroy']=function(_0x2845ea,_0x4fe13d){return db[_0x99de('0x5a')][_0x99de('0x60')]({'where':{'id':_0x2845ea[_0x99de('0x64')]['id']}})['then'](handleEntityNotFound(_0x4fe13d,null))[_0x99de('0x22')](removeEntity(_0x4fe13d,null))[_0x99de('0x59')](handleError(_0x4fe13d,null));};exports[_0x99de('0x65')]=function(_0x274eaa,_0x572e1c){return db[_0x99de('0x5a')]['describe']()[_0x99de('0x22')](respondWithResult(_0x572e1c,null))[_0x99de('0x59')](handleError(_0x572e1c,null));};exports[_0x99de('0x66')]=function(_0x37d4dd,_0x139253,_0x29e512){if(_0x37d4dd[_0x99de('0x5c')]['id']){delete _0x37d4dd[_0x99de('0x5c')]['id'];}return db['SmsAccount'][_0x99de('0x60')]({'where':{'id':_0x37d4dd[_0x99de('0x64')]['id']}})[_0x99de('0x22')](handleEntityNotFound(_0x139253,null))['then'](function(_0x3ce604){if(_0x3ce604){_0x37d4dd[_0x99de('0x5c')][_0x99de('0x67')]=_0x3ce604['id'];return db['Disposition'][_0x99de('0x5b')](_0x37d4dd[_0x99de('0x5c')]);}})[_0x99de('0x22')](respondWithResult(_0x139253,null))[_0x99de('0x59')](handleError(_0x139253,null));};exports[_0x99de('0x68')]=function(_0x5ecaa4,_0x45fca5,_0x5378fb){var _0x4c9007={'raw':![],'where':{}};var _0x4c9442={};var _0x19f41c={'count':0x0,'rows':[]};return db[_0x99de('0x5a')][_0x99de('0x69')]({'where':{'id':_0x5ecaa4['params']['id']}})[_0x99de('0x22')](handleEntityNotFound(_0x45fca5,null))[_0x99de('0x22')](function(_0x3a7aa5){if(_0x3a7aa5){_0x4c9442[_0x99de('0x45')]=_['keys'](db[_0x99de('0x6a')][_0x99de('0x42')]);_0x4c9442[_0x99de('0x46')]=_['keys'](_0x5ecaa4[_0x99de('0x46')]);_0x4c9442['filters']=_[_0x99de('0x49')](_0x4c9442['model'],_0x4c9442['query']);_0x4c9007[_0x99de('0x4a')]=_[_0x99de('0x49')](_0x4c9442[_0x99de('0x45')],qs['fields'](_0x5ecaa4['query'][_0x99de('0x4b')]));_0x4c9007[_0x99de('0x4a')]=_0x4c9007[_0x99de('0x4a')][_0x99de('0x4c')]?_0x4c9007['attributes']:_0x4c9442[_0x99de('0x45')];if(!_0x5ecaa4[_0x99de('0x46')][_0x99de('0x4d')](_0x99de('0x4e'))){_0x4c9007[_0x99de('0x33')]=qs[_0x99de('0x33')](_0x5ecaa4[_0x99de('0x46')]['limit']);_0x4c9007[_0x99de('0x30')]=qs[_0x99de('0x30')](_0x5ecaa4[_0x99de('0x46')]['offset']);}_0x4c9007[_0x99de('0x4f')]=qs[_0x99de('0x50')](_0x5ecaa4[_0x99de('0x46')][_0x99de('0x50')]);_0x4c9007['where']=qs['filters'](_[_0x99de('0x52')](_0x5ecaa4['query'],_0x4c9442[_0x99de('0x48')]));_0x4c9007[_0x99de('0x51')]['SmsAccountId']=_0x3a7aa5['id'];if(_0x5ecaa4[_0x99de('0x46')]['filter']){_0x4c9007[_0x99de('0x51')]=_['merge'](_0x4c9007['where'],{'$or':_[_0x99de('0x41')](_0x4c9007[_0x99de('0x4a')],function(_0x3784e0){var _0x5d0089={};_0x5d0089[_0x3784e0]={'$like':'%'+_0x5ecaa4['query']['filter']+'%'};return _0x5d0089;})});}_0x4c9007=_['merge']({},_0x4c9007,_0x5ecaa4[_0x99de('0x56')]);return db['Disposition'][_0x99de('0x32')]({'where':_0x4c9007[_0x99de('0x51')]})['then'](function(_0x38d4bc){_0x19f41c[_0x99de('0x32')]=_0x38d4bc;if(_0x5ecaa4['query'][_0x99de('0x6b')]){_0x4c9007[_0x99de('0x57')]=[{'all':!![]}];}return db[_0x99de('0x6a')]['findAll'](_0x4c9007);})[_0x99de('0x22')](function(_0x125091){_0x19f41c[_0x99de('0x58')]=_0x125091;return _0x19f41c;});}})['then'](respondWithFilteredResult(_0x45fca5,_0x4c9007))[_0x99de('0x59')](handleError(_0x45fca5,null));};exports[_0x99de('0x6c')]=function(_0x17d49e,_0xb1640,_0x1b9187){return db[_0x99de('0x5a')][_0x99de('0x60')]({'where':{'id':_0x17d49e[_0x99de('0x64')]['id']}})['then'](handleEntityNotFound(_0xb1640,null))[_0x99de('0x22')](function(_0x332dac){if(_0x332dac){return _0x332dac['removeDispositions'](_0x17d49e[_0x99de('0x46')]['ids']);}})['then'](respondWithStatusCode(_0xb1640,null))[_0x99de('0x59')](handleError(_0xb1640,null));};exports[_0x99de('0x6d')]=function(_0xc9c1b5,_0x105ba7,_0x44a4a9){if(_0xc9c1b5[_0x99de('0x5c')]['id']){delete _0xc9c1b5['body']['id'];}return db[_0x99de('0x5a')][_0x99de('0x60')]({'where':{'id':_0xc9c1b5['params']['id']}})[_0x99de('0x22')](handleEntityNotFound(_0x105ba7,null))[_0x99de('0x22')](function(_0x281317){if(_0x281317){_0xc9c1b5[_0x99de('0x5c')]['SmsAccountId']=_0x281317['id'];return db[_0x99de('0x6e')]['create'](_0xc9c1b5[_0x99de('0x5c')]);}})['then'](respondWithResult(_0x105ba7,null))['catch'](handleError(_0x105ba7,null));};exports[_0x99de('0x6f')]=function(_0x25ffaa,_0x353587,_0x8bcf8e){var _0x25d3e1={'raw':![],'where':{}};var _0x163330={};var _0x36147e={'count':0x0,'rows':[]};return db[_0x99de('0x5a')][_0x99de('0x69')]({'where':{'id':_0x25ffaa[_0x99de('0x64')]['id']}})[_0x99de('0x22')](handleEntityNotFound(_0x353587,null))['then'](function(_0x300b49){if(_0x300b49){_0x163330[_0x99de('0x45')]=_[_0x99de('0x47')](db['CannedAnswer'][_0x99de('0x42')]);_0x163330[_0x99de('0x46')]=_['keys'](_0x25ffaa[_0x99de('0x46')]);_0x163330[_0x99de('0x48')]=_[_0x99de('0x49')](_0x163330[_0x99de('0x45')],_0x163330[_0x99de('0x46')]);_0x25d3e1['attributes']=_[_0x99de('0x49')](_0x163330[_0x99de('0x45')],qs[_0x99de('0x4b')](_0x25ffaa[_0x99de('0x46')][_0x99de('0x4b')]));_0x25d3e1[_0x99de('0x4a')]=_0x25d3e1[_0x99de('0x4a')][_0x99de('0x4c')]?_0x25d3e1[_0x99de('0x4a')]:_0x163330[_0x99de('0x45')];if(!_0x25ffaa['query'][_0x99de('0x4d')](_0x99de('0x4e'))){_0x25d3e1[_0x99de('0x33')]=qs[_0x99de('0x33')](_0x25ffaa[_0x99de('0x46')][_0x99de('0x33')]);_0x25d3e1[_0x99de('0x30')]=qs[_0x99de('0x30')](_0x25ffaa[_0x99de('0x46')][_0x99de('0x30')]);}_0x25d3e1['order']=qs[_0x99de('0x50')](_0x25ffaa[_0x99de('0x46')][_0x99de('0x50')]);_0x25d3e1[_0x99de('0x51')]=qs[_0x99de('0x48')](_[_0x99de('0x52')](_0x25ffaa['query'],_0x163330[_0x99de('0x48')]));_0x25d3e1[_0x99de('0x51')][_0x99de('0x67')]=_0x300b49['id'];if(_0x25ffaa[_0x99de('0x46')][_0x99de('0x53')]){_0x25d3e1[_0x99de('0x51')]=_[_0x99de('0x54')](_0x25d3e1[_0x99de('0x51')],{'$or':_[_0x99de('0x41')](_0x25d3e1[_0x99de('0x4a')],function(_0x4691f8){var _0x6a9b93={};_0x6a9b93[_0x4691f8]={'$like':'%'+_0x25ffaa[_0x99de('0x46')][_0x99de('0x53')]+'%'};return _0x6a9b93;})});}_0x25d3e1=_[_0x99de('0x54')]({},_0x25d3e1,_0x25ffaa[_0x99de('0x56')]);return db[_0x99de('0x6e')][_0x99de('0x32')]({'where':_0x25d3e1[_0x99de('0x51')]})[_0x99de('0x22')](function(_0xda2427){_0x36147e[_0x99de('0x32')]=_0xda2427;if(_0x25ffaa[_0x99de('0x46')][_0x99de('0x6b')]){_0x25d3e1[_0x99de('0x57')]=[{'all':!![]}];}return db[_0x99de('0x6e')][_0x99de('0x70')](_0x25d3e1);})['then'](function(_0x1f9e7d){_0x36147e[_0x99de('0x58')]=_0x1f9e7d;return _0x36147e;});}})[_0x99de('0x22')](respondWithFilteredResult(_0x353587,_0x25d3e1))['catch'](handleError(_0x353587,null));};exports[_0x99de('0x71')]=function(_0x255629,_0x5d4451,_0x19b128){return db[_0x99de('0x5a')]['find']({'where':{'id':_0x255629[_0x99de('0x64')]['id']}})['then'](handleEntityNotFound(_0x5d4451,null))[_0x99de('0x22')](function(_0x20221c){if(_0x20221c){return _0x20221c[_0x99de('0x71')](_0x255629[_0x99de('0x46')][_0x99de('0x72')]);}})['then'](respondWithStatusCode(_0x5d4451,null))[_0x99de('0x59')](handleError(_0x5d4451,null));};exports['notify']=function(_0x1901f8,_0x349d40,_0x211729){var _0x51bfb1={'channel':_0x99de('0x73')};var _0x14ea47=[];var _0x1d7b84=[];var _0x46819f={};return db['SmsAccount'][_0x99de('0x60')]({'where':{'id':_0x1901f8[_0x99de('0x64')]['id']},'include':[{'model':db[_0x99de('0x74')],'as':'Applications'}]})[_0x99de('0x22')](handleEntityNotFound(_0x349d40,null))[_0x99de('0x22')](function(_0x13bf40){_0x51bfb1['account']=_0x13bf40;_0x51bfb1['applications']=_['orderBy'](_0x13bf40[_0x99de('0x75')],[_0x99de('0x76')],[_0x99de('0x77')]);if(_0x51bfb1[_0x99de('0x78')][_0x99de('0x75')]){delete _0x51bfb1['account']['Applications'];}return db[_0x99de('0x79')]['describe']();})[_0x99de('0x22')](function(_0x2650e0){if(!_0x2650e0){throw new db[(_0x99de('0x7a'))][(_0x99de('0x7b'))](_0x99de('0x7c'));}_0x14ea47=_[_0x99de('0x7d')](_[_0x99de('0x47')](_0x2650e0),[_0x99de('0x7e'),_0x99de('0x7f')]);_0x1d7b84=_[_0x99de('0x7d')](_[_0x99de('0x47')](_0x2650e0),[_0x99de('0x7e'),_0x99de('0x7f'),_0x99de('0x80'),_0x99de('0x81')]);_0x51bfb1[_0x99de('0x5c')]={'mapKey':_0x99de('0x82')};if(_0x51bfb1[_0x99de('0x78')][_0x99de('0x43')]){switch(_0x51bfb1[_0x99de('0x78')][_0x99de('0x43')]){case _0x99de('0x83'):_0x51bfb1['body'][_0x99de('0x84')]=_0x1901f8[_0x99de('0x5c')][_0x99de('0x85')];_0x51bfb1[_0x99de('0x5c')][_0x99de('0x5c')]=_0x1901f8['body'][_0x99de('0x86')];_0x51bfb1[_0x99de('0x5c')][_0x99de('0x87')]=_0x1901f8[_0x99de('0x5c')][_0x99de('0x88')];break;case _0x99de('0x89'):_0x51bfb1[_0x99de('0x5c')][_0x99de('0x84')]='+'+_0x1901f8['body']['sender'];_0x51bfb1[_0x99de('0x5c')][_0x99de('0x5c')]=_0x1901f8[_0x99de('0x5c')][_0x99de('0x8a')];break;case'connectel':_0x51bfb1[_0x99de('0x5c')][_0x99de('0x84')]=_0x1901f8[_0x99de('0x5c')][_0x99de('0x84')];_0x51bfb1['body'][_0x99de('0x5c')]=_0x1901f8[_0x99de('0x5c')]['message'];break;case _0x99de('0x8b'):_0x51bfb1['body']['from']=_0x1901f8[_0x99de('0x5c')][_0x99de('0x84')];_0x51bfb1[_0x99de('0x5c')][_0x99de('0x5c')]=_0x1901f8[_0x99de('0x5c')][_0x99de('0x5c')];_0x51bfb1['body'][_0x99de('0x87')]=_0x1901f8[_0x99de('0x5c')][_0x99de('0x8c')];break;case'plivo':_0x51bfb1[_0x99de('0x5c')]['from']=_0x1901f8[_0x99de('0x5c')][_0x99de('0x85')];_0x51bfb1[_0x99de('0x5c')]['body']=_0x1901f8['body'][_0x99de('0x8d')];_0x51bfb1[_0x99de('0x5c')][_0x99de('0x87')]=_0x1901f8[_0x99de('0x5c')][_0x99de('0x8e')];break;case _0x99de('0x8f'):_0x51bfb1['body'][_0x99de('0x84')]='+'+_0x1901f8[_0x99de('0x5c')][_0x99de('0x90')][0x0][_0x99de('0x84')];_0x51bfb1[_0x99de('0x5c')][_0x99de('0x5c')]=_0x1901f8['body'][_0x99de('0x90')][0x0]['text'];_0x51bfb1[_0x99de('0x5c')]['messageId']=_0x1901f8[_0x99de('0x5c')][_0x99de('0x90')][0x0]['messageId'];break;case _0x99de('0x91'):_0x51bfb1[_0x99de('0x5c')][_0x99de('0x84')]=_0x1901f8[_0x99de('0x5c')]['originatingAddress'];_0x51bfb1[_0x99de('0x5c')][_0x99de('0x5c')]=_0x1901f8['body'][_0x99de('0x92')][_0x99de('0x29')];break;case'clickatell':_0x51bfb1[_0x99de('0x5c')][_0x99de('0x84')]=_0x1901f8[_0x99de('0x5c')]['fromNumber'];_0x51bfb1['body'][_0x99de('0x5c')]=_0x1901f8[_0x99de('0x5c')][_0x99de('0x8a')];_0x51bfb1[_0x99de('0x5c')]['messageId']=_0x1901f8['body'][_0x99de('0x93')];break;case _0x99de('0x94'):_0x51bfb1[_0x99de('0x5c')]['messageId']=_0x1901f8[_0x99de('0x5c')][0x0]['message']['id'];_0x51bfb1[_0x99de('0x5c')]['from']=_0x1901f8[_0x99de('0x5c')][0x0][_0x99de('0x29')][_0x99de('0x84')];_0x51bfb1[_0x99de('0x5c')][_0x99de('0x5c')]=_0x1901f8[_0x99de('0x5c')][0x0][_0x99de('0x29')][_0x99de('0x8a')];break;case _0x99de('0x95'):_0x51bfb1[_0x99de('0x5c')][_0x99de('0x84')]=_0x1901f8[_0x99de('0x5c')][_0x99de('0x84')];_0x51bfb1[_0x99de('0x5c')]['body']=_0x1901f8[_0x99de('0x5c')][_0x99de('0x29')];_0x51bfb1[_0x99de('0x5c')][_0x99de('0x87')]=_0x1901f8[_0x99de('0x5c')][_0x99de('0x96')];break;}}if(_0x51bfb1['body']['id']){delete _0x51bfb1['body']['id'];}if(_[_0x99de('0x97')](_0x51bfb1['body'][_0x99de('0x84')])){throw new db[(_0x99de('0x7a'))][(_0x99de('0x7b'))](_0x99de('0x98'));}if(_[_0x99de('0x97')](_0x51bfb1[_0x99de('0x5c')]['body'])||_0x51bfb1[_0x99de('0x5c')][_0x99de('0x5c')]===''){throw new db[(_0x99de('0x7a'))][(_0x99de('0x7b'))](_0x99de('0x99'));}if(_[_0x99de('0x97')](_0x51bfb1[_0x99de('0x5c')][_0x99de('0x9a')])){throw new db[(_0x99de('0x7a'))][(_0x99de('0x7b'))](_0x99de('0x9b')+_0x1d7b84);}if(!_[_0x99de('0x9c')](_0x1d7b84,_0x51bfb1[_0x99de('0x5c')][_0x99de('0x9a')])){throw new db[(_0x99de('0x7a'))]['ValidationError'](_0x99de('0x9d')+_0x1d7b84);}_0x46819f[_0x51bfb1['body']['mapKey']]=_0x51bfb1[_0x99de('0x5c')][_0x99de('0x84')];return db['CmList'][_0x99de('0x60')]({'where':{'id':_0x51bfb1[_0x99de('0x78')][_0x99de('0x81')]},'include':[{'model':db[_0x99de('0x79')],'as':_0x99de('0x9e'),'where':_0x46819f,'limit':0x1,'order':[[_0x99de('0x7f'),_0x99de('0x9f')]]}]});})['then'](handleEntityNotFound(_0x349d40,null))[_0x99de('0x22')](function(_0x461639){if(_0x461639){_0x51bfb1[_0x99de('0xa0')]=_[_0x99de('0xa1')](_0x461639,[_0x99de('0x9e')]);if(_0x461639[_0x99de('0x9e')][_0x99de('0x4c')]){return _0x461639[_0x99de('0x9e')][0x0];}var _0x21924d=_[_0x99de('0xa2')](_0x51bfb1['body'],{'firstName':_0x51bfb1[_0x99de('0x5c')][_0x99de('0x84')],'ListId':_0x461639['id']});_0x21924d[_0x51bfb1['body'][_0x99de('0x9a')]]=_0x51bfb1['body'][_0x99de('0x84')];return db[_0x99de('0x79')][_0x99de('0x5b')](_0x21924d,{'fields':_0x14ea47,'raw':!![]});}})[_0x99de('0x22')](handleEntityNotFound(_0x349d40,null))[_0x99de('0x22')](function(_0x2251ea){if(_0x2251ea){_0x51bfb1[_0x99de('0xa3')]=_0x2251ea;var _0x5d74ca={'ContactId':_0x2251ea['id'],'phone':_0x51bfb1['body'][_0x99de('0x84')],'SmsAccountId':_0x1901f8[_0x99de('0x64')]['id']};var _0x53ac1e={'ContactId':_0x2251ea['id'],'SmsAccountId':_0x1901f8[_0x99de('0x64')]['id'],'closed':![]};return db[_0x99de('0xa4')][_0x99de('0x60')]({'where':_0x53ac1e})['then'](function(_0x1f8e2e){if(_0x1f8e2e){return[_0x1f8e2e,![]];}return db['SmsInteraction'][_0x99de('0x5b')](_0x5d74ca)[_0x99de('0x22')](function(_0x4e68ff){return[_0x4e68ff,!![]];});});}})[_0x99de('0xa5')](function(_0x6c2101,_0x21f000){_0x51bfb1[_0x99de('0xa6')]=_0x6c2101[_0x99de('0x3b')]({'plain':!![]});_0x51bfb1[_0x99de('0xa6')]['created']=![];if(_0x21f000){if(_0x51bfb1['account'][_0x99de('0xa7')]){_0x51bfb1['applications'][_0x99de('0xa8')]({'id':0x0,'priority':_0x51bfb1[_0x99de('0xa9')][_0x99de('0x4c')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x99de('0xaa')});}_0x51bfb1[_0x99de('0xa6')][_0x99de('0xab')]=!![];}return db[_0x99de('0xac')][_0x99de('0x5b')]({'phone':_0x51bfb1[_0x99de('0x5c')][_0x99de('0x84')],'messageId':_0x51bfb1[_0x99de('0x5c')]['messageId'],'body':_0x51bfb1[_0x99de('0x5c')]['body'],'SmsAccountId':_0x1901f8[_0x99de('0x64')]['id'],'SmsInteractionId':_0x6c2101['id'],'direction':'in','ContactId':_0x6c2101[_0x99de('0xad')],'AttachmentId':_0x51bfb1['body'][_0x99de('0xae')]});})['then'](function(_0x25807e){_0x51bfb1[_0x99de('0x29')]=_0x25807e;if(_0x51bfb1[_0x99de('0xa6')][_0x99de('0xaf')]){return db[_0x99de('0xb0')][_0x99de('0x60')]({'attributes':['id',_0x99de('0x3c')],'where':{'id':_0x51bfb1['interaction'][_0x99de('0xaf')]}})[_0x99de('0x22')](function(_0x195986){if(_0x195986){_0x51bfb1[_0x99de('0xa9')][_0x99de('0xb1')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x195986['name']+','+(_0x51bfb1[_0x99de('0x78')][_0x99de('0xb2')]||0xa),'interval':_0x99de('0xaa')});}return respondWithRpcPromise(_0x99de('0xb3'),_0x99de('0xb4'),_0x51bfb1);});}return respondWithRpcPromise('Start','startRouting',_0x51bfb1);})[_0x99de('0x22')](function(_0x32bd45){if(_0x32bd45){var _0x4e2f60=0xc8;var _0x2f98d5='receiveMessage';logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2f98d5,_0x4e2f60,'entity\x20found');logger['debug'](_0x99de('0xb5'),_0x2f98d5,_0x4e2f60,_0x99de('0xb6'),JSON[_0x99de('0x26')](_0x32bd45));if(_0x51bfb1['account']['type']==='twilio'){return _0x349d40['status'](_0x4e2f60)[_0x99de('0x34')](_0x99de('0xb7'),_0x99de('0xb8'))['send'](_0x99de('0xb9'));}else{return _0x349d40[_0x99de('0x2d')](_0x4e2f60)[_0x99de('0x2f')](_0x32bd45);}}})[_0x99de('0x59')](handleError(_0x349d40,null));};exports[_0x99de('0xba')]=function(_0x2bd622,_0x4d0c83){var _0x320d41=_0x2bd622[_0x99de('0x64')]['id'];var _0x4cb96d=_0x2bd622[_0x99de('0x5c')];var _0x589d79=0xc8;var _0x4e5ceb=null;return db[_0x99de('0xbb')][_0x99de('0xbc')]({'isolationLevel':db[_0x99de('0xbb')][_0x99de('0xbd')]['ISOLATION_LEVELS'][_0x99de('0xbe')]},function(_0x602ffa){return db[_0x99de('0x5a')]['findOne']({'where':{'id':_0x320d41},'transaction':_0x602ffa})[_0x99de('0x22')](function(_0x30f2bb){if(_0x30f2bb){return db[_0x99de('0x74')]['destroy']({'where':{'SmsAccountId':_0x320d41},'transaction':_0x602ffa})['then'](function(){var _0xa9eb9d=_[_0x99de('0x41')](_0x4cb96d,function(_0x26ed9b){_0x26ed9b[_0x99de('0x67')]=_0x320d41;return _0x26ed9b;});return db['SmsApplication'][_0x99de('0xbf')](_0xa9eb9d,{'transaction':_0x602ffa});});}else{_0x589d79=0x194;_0x4e5ceb=[];}});})[_0x99de('0x22')](function(){if(_0x589d79!==0x194){return db[_0x99de('0x74')][_0x99de('0xc0')]({'where':{'SmsAccountId':_0x320d41},'order':_0x99de('0x76')})[_0x99de('0x22')](function(_0x1f40d1){_0x4e5ceb=_0x1f40d1;});}})[_0x99de('0x59')](function(_0x34340f){_0x589d79=0x1f4;logger[_0x99de('0x27')](_0x34340f[_0x99de('0xc1')]);if(_0x34340f['name']){delete _0x34340f['name'];}_0x4e5ceb=_0x34340f;})[_0x99de('0xc2')](function(){if(_0x4e5ceb===null){_0x4d0c83['sendStatus'](_0x589d79);}else{if(_0x589d79===0x1f4){_0x4d0c83['status'](_0x589d79)[_0x99de('0x3d')](_0x4e5ceb);}else{_0x4d0c83['status'](_0x589d79)[_0x99de('0x2f')](_0x4e5ceb);}}});};exports[_0x99de('0xc3')]=function(_0x10903c,_0x53d335,_0x4e1c96){var _0x20a29d={};var _0x210fe8={};var _0xc7a4ea;var _0x5417e1;return db['SmsAccount'][_0x99de('0x69')]({'where':{'id':_0x10903c[_0x99de('0x64')]['id']}})['then'](handleEntityNotFound(_0x53d335,null))[_0x99de('0x22')](function(_0x394507){if(_0x394507){_0xc7a4ea=_0x394507;_0x210fe8[_0x99de('0x45')]=_[_0x99de('0x47')](db[_0x99de('0x74')]['rawAttributes']);_0x210fe8['query']=_[_0x99de('0x47')](_0x10903c[_0x99de('0x46')]);_0x210fe8['filters']=_[_0x99de('0x49')](_0x210fe8[_0x99de('0x45')],_0x210fe8['query']);_0x20a29d[_0x99de('0x4a')]=_[_0x99de('0x49')](_0x210fe8[_0x99de('0x45')],qs['fields'](_0x10903c[_0x99de('0x46')][_0x99de('0x4b')]));_0x20a29d[_0x99de('0x4a')]=_0x20a29d['attributes']['length']?_0x20a29d[_0x99de('0x4a')]:_0x210fe8[_0x99de('0x45')];_0x20a29d['order']=qs[_0x99de('0x50')](_0x10903c[_0x99de('0x46')]['sort']);_0x20a29d[_0x99de('0x51')]=qs['filters'](_[_0x99de('0x52')](_0x10903c[_0x99de('0x46')],_0x210fe8[_0x99de('0x48')]));if(_0x10903c[_0x99de('0x46')]['filter']){_0x20a29d[_0x99de('0x51')]=_[_0x99de('0x54')](_0x20a29d[_0x99de('0x51')],{'$or':_['map'](_0x20a29d[_0x99de('0x4a')],function(_0x26eef6){var _0x50c5b9={};_0x50c5b9[_0x26eef6]={'$like':'%'+_0x10903c['query'][_0x99de('0x53')]+'%'};return _0x50c5b9;})});}_0x20a29d=_['merge']({},_0x20a29d,_0x10903c[_0x99de('0x56')]);return _0xc7a4ea[_0x99de('0xc3')](_0x20a29d);}})['then'](function(_0x22d0af){if(_0x22d0af){_0x5417e1=_0x22d0af[_0x99de('0x4c')];if(!_0x10903c[_0x99de('0x46')][_0x99de('0x4d')](_0x99de('0x4e'))){_0x20a29d[_0x99de('0x33')]=qs['limit'](_0x10903c[_0x99de('0x46')][_0x99de('0x33')]);_0x20a29d['offset']=qs[_0x99de('0x30')](_0x10903c['query'][_0x99de('0x30')]);}return _0xc7a4ea[_0x99de('0xc3')](_0x20a29d);}})[_0x99de('0x22')](function(_0x57cbfe){if(_0x57cbfe){return _0x57cbfe?{'count':_0x5417e1,'rows':_0x57cbfe}:null;}})[_0x99de('0x22')](respondWithResult(_0x53d335,null))[_0x99de('0x59')](handleError(_0x53d335,null));};exports[_0x99de('0xc4')]=function(_0x4da3ae,_0x263f9b,_0x24fa9d){var _0x6b0a20={'raw':![],'where':{}};var _0x3297d1={};var _0x39f50e={'count':0x0,'rows':[]};return db[_0x99de('0x5a')]['findOne']({'where':{'id':_0x4da3ae[_0x99de('0x64')]['id']}})[_0x99de('0x22')](handleEntityNotFound(_0x263f9b,null))[_0x99de('0x22')](function(_0x4006f8){if(_0x4006f8){_0x3297d1[_0x99de('0x45')]=_[_0x99de('0x47')](db[_0x99de('0xa4')][_0x99de('0x42')]);_0x3297d1[_0x99de('0x46')]=_[_0x99de('0x47')](_0x4da3ae['query']);_0x3297d1[_0x99de('0x48')]=_[_0x99de('0x49')](_0x3297d1[_0x99de('0x45')],_0x3297d1[_0x99de('0x46')]);_0x6b0a20['attributes']=_[_0x99de('0x49')](_0x3297d1[_0x99de('0x45')],qs[_0x99de('0x4b')](_0x4da3ae[_0x99de('0x46')][_0x99de('0x4b')]));_0x6b0a20[_0x99de('0x4a')]=_0x6b0a20[_0x99de('0x4a')][_0x99de('0x4c')]?_0x6b0a20[_0x99de('0x4a')]:_0x3297d1['model'];if(!_0x4da3ae[_0x99de('0x46')][_0x99de('0x4d')]('nolimit')){_0x6b0a20['limit']=qs[_0x99de('0x33')](_0x4da3ae[_0x99de('0x46')][_0x99de('0x33')]);_0x6b0a20['offset']=qs[_0x99de('0x30')](_0x4da3ae[_0x99de('0x46')][_0x99de('0x30')]);}_0x6b0a20['order']=qs[_0x99de('0x50')](_0x4da3ae['query'][_0x99de('0x50')]);_0x6b0a20[_0x99de('0x51')]=qs[_0x99de('0x48')](_['pick'](_0x4da3ae[_0x99de('0x46')],_0x3297d1['filters']));_0x6b0a20[_0x99de('0x51')][_0x99de('0x67')]=_0x4006f8['id'];if(_0x4da3ae[_0x99de('0x46')]['filter']){_0x6b0a20[_0x99de('0x51')]=_[_0x99de('0x54')](_0x6b0a20['where'],{'$or':_['map'](_0x6b0a20['attributes'],function(_0x480af6){var _0x267385={};_0x267385[_0x480af6]={'$like':'%'+_0x4da3ae[_0x99de('0x46')][_0x99de('0x53')]+'%'};return _0x267385;})});}_0x6b0a20=_[_0x99de('0x54')]({},_0x6b0a20,_0x4da3ae['options']);return db['SmsInteraction'][_0x99de('0x32')]({'where':_0x6b0a20[_0x99de('0x51')]})[_0x99de('0x22')](function(_0x503e4a){_0x39f50e[_0x99de('0x32')]=_0x503e4a;if(_0x4da3ae['query'][_0x99de('0x6b')]){_0x6b0a20['include']=[{'model':db[_0x99de('0x79')],'as':_0x99de('0xc5'),'required':![]},{'model':db['User'],'as':_0x99de('0xc6'),'attributes':['name',_0x99de('0xc7'),_0x99de('0xc8')],'required':![]},{'model':db[_0x99de('0xc9')],'as':_0x99de('0xca'),'attributes':['id',_0x99de('0x3c'),_0x99de('0xcb')],'where':_0x4da3ae['query'][_0x99de('0xcc')]?{'id':_0x4da3ae[_0x99de('0x46')][_0x99de('0xcc')]}:undefined,'required':_0x4da3ae[_0x99de('0x46')][_0x99de('0xcc')]?!![]:![]}];}return db[_0x99de('0xa4')][_0x99de('0x70')](_0x6b0a20);})[_0x99de('0x22')](function(_0x17c03d){_0x39f50e[_0x99de('0x58')]=_0x17c03d;return _0x39f50e;});}})[_0x99de('0x22')](respondWithFilteredResult(_0x263f9b,_0x6b0a20))[_0x99de('0x59')](handleError(_0x263f9b,null));};exports['send']=function(_0x35e932,_0x3294dd,_0x3bbc32){var _0x462694,_0x101bbe,_0x3fb50d;if(_['isNil'](_0x35e932[_0x99de('0x5c')][_0x99de('0x5c')])||_0x35e932[_0x99de('0x5c')][_0x99de('0x5c')]===''){throw new db[(_0x99de('0x7a'))][(_0x99de('0x7b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x99de('0x97')](_0x35e932[_0x99de('0x5c')]['to'])){throw new db[(_0x99de('0x7a'))][(_0x99de('0x7b'))]('to\x20is\x20mandatory');}_0x462694=_0x35e932[_0x99de('0x5c')]['to'];return db[_0x99de('0x5a')][_0x99de('0x60')]({'where':{'id':_0x35e932['params']['id']},'include':[{'model':db[_0x99de('0xcd')],'as':_0x99de('0xce'),'include':[{'model':db[_0x99de('0x79')],'as':_0x99de('0x9e'),'where':{'mobile':_0x462694},'limit':0x1,'order':[[_0x99de('0x7f'),'DESC']]}]}]})[_0x99de('0x22')](handleEntityNotFound(_0x3294dd,null))[_0x99de('0x22')](function(_0x208a06){if(_0x208a06&&_0x208a06[_0x99de('0xce')]){_0x101bbe=_0x208a06[_0x99de('0x3b')]({'plain':!![]});if(_0x101bbe[_0x99de('0xce')]&&_0x101bbe[_0x99de('0xce')][_0x99de('0x9e')][_0x99de('0x4c')]){return _0x101bbe[_0x99de('0xce')]['Contacts'][0x0];}return db[_0x99de('0x79')][_0x99de('0x5b')](_[_0x99de('0xa2')](_0x35e932[_0x99de('0x5c')],{'firstName':_0x462694,'mobile':_0x462694,'phone':_0x462694,'ListId':_0x101bbe[_0x99de('0x81')]}));}})[_0x99de('0x22')](handleEntityNotFound(_0x3294dd,null))['then'](function(_0x5d3ab1){if(_0x5d3ab1){_0x3fb50d=_0x5d3ab1;return db[_0x99de('0xa4')]['find']({'where':{'ContactId':_0x3fb50d['id'],'closed':![],'SmsAccountId':_0x101bbe['id']}})[_0x99de('0x22')](function(_0x32d9bf){if(_0x32d9bf){return[_0x32d9bf,![]];}return db[_0x99de('0xa4')][_0x99de('0x5b')]({'UserId':_0x35e932[_0x99de('0x5d')]['id'],'ContactId':_0x3fb50d['id'],'SmsAccountId':_0x101bbe['id'],'phone':_0x462694,'firstMsgDirection':_0x99de('0xcf'),'Messages':[_[_0x99de('0x54')](_0x35e932[_0x99de('0x5c')],{'read':![],'body':_0x35e932['body'][_0x99de('0x5c')],'phone':_0x462694,'SmsAccountId':_0x101bbe['id'],'UserId':_0x35e932[_0x99de('0x5d')]['id'],'ContactId':_0x3fb50d['id']})]},{'include':[{'model':db[_0x99de('0xac')],'as':_0x99de('0xd0')}]})['then'](function(_0x56854d){return[_0x56854d,!![]];});});}})['spread'](function(_0x10b247,_0x37a425){if(_0x37a425){return _0x10b247;}return db[_0x99de('0xac')]['create'](_[_0x99de('0x54')](_0x35e932[_0x99de('0x5c')],{'read':![],'body':_0x35e932['body'][_0x99de('0x5c')],'phone':_0x462694,'SmsAccountId':_0x101bbe['id'],'SmsInteractionId':_0x10b247['id'],'UserId':_0x35e932[_0x99de('0x5d')]['id'],'ContactId':_0x3fb50d['id']}))[_0x99de('0x22')](function(_0x48285e){_0x10b247[_0x99de('0xd1')][_0x99de('0xd0')]=[];_0x10b247['dataValues'][_0x99de('0xd0')]['push'](_0x48285e['dataValues']);return _0x10b247;});})[_0x99de('0x22')](respondWithResult(_0x3294dd,null))[_0x99de('0x59')](handleError(_0x3294dd,null));};exports[_0x99de('0x2d')]=function(_0x1518f6,_0x1ba80a,_0x30d169){if(_0x1518f6['body']['id']){delete _0x1518f6[_0x99de('0x5c')]['id'];}var _0x287670,_0x3654aa,_0x2d5f92;return db[_0x99de('0x5a')]['find']({'where':{'id':_0x1518f6[_0x99de('0x64')]['id']}})[_0x99de('0x22')](handleEntityNotFound(_0x1ba80a,null))[_0x99de('0x22')](function(_0x526c9a){if(_0x526c9a){_0x2d5f92=_0x526c9a;logger['debug'](_0x99de('0x25'),_0x99de('0x2d'),_0x99de('0xd2'),_0x526c9a[_0x99de('0x43')],util[_0x99de('0xd3')](_0x1518f6[_0x99de('0x5c')],{'showHidden':![],'depth':null}));switch(_0x526c9a['type']){case _0x99de('0x89'):if(_0x1518f6[_0x99de('0x5c')][_0x99de('0xd4')]&&_0x1518f6[_0x99de('0x5c')][_0x99de('0x2d')]){_0x3654aa=_0x1518f6[_0x99de('0x5c')][_0x99de('0x2d')];return db[_0x99de('0xac')][_0x99de('0x60')]({'where':{'messageId':_0x1518f6['body'][_0x99de('0xd4')]}});}break;case _0x99de('0xd5'):if(_0x1518f6[_0x99de('0x5c')][_0x99de('0xd6')]&&_0x1518f6[_0x99de('0x5c')][_0x99de('0xd7')]){_0x3654aa=_0x1518f6['body']['statusInt'];return db[_0x99de('0xac')][_0x99de('0x60')]({'where':{'messageId':_0x1518f6[_0x99de('0x5c')][_0x99de('0xd6')]}});}break;case _0x99de('0x8b'):if(_0x1518f6[_0x99de('0x5c')]['message_id']&&_0x1518f6[_0x99de('0x5c')][_0x99de('0xd8')]){_0x3654aa=_0x1518f6[_0x99de('0x5c')]['status_code'];return db[_0x99de('0xac')]['find']({'where':{'messageId':_0x1518f6[_0x99de('0x5c')]['message_id']}});}break;case _0x99de('0x8f'):var _0x3b77ea=_0x1518f6[_0x99de('0x5c')]['results'][0x0];if(_0x3b77ea[_0x99de('0x87')]&&_0x3b77ea[_0x99de('0x2d')][_0x99de('0xd9')]==='DELIVERED'){_0x3654aa=_0x3b77ea[_0x99de('0x2d')][_0x99de('0xd9')];return db['SmsMessage'][_0x99de('0x60')]({'where':{'messageId':_0x3b77ea[_0x99de('0x87')]}});}break;case _0x99de('0xda'):if(_0x1518f6[_0x99de('0x5c')][_0x99de('0x87')]&&_0x1518f6[_0x99de('0x5c')][_0x99de('0x2d')]){_0x3654aa=_0x1518f6['body']['status'];return db[_0x99de('0xac')][_0x99de('0x60')]({'where':{'messageId':_0x1518f6['body'][_0x99de('0x87')]}});}break;case _0x99de('0x94'):if(_0x1518f6[_0x99de('0x5c')][0x0][_0x99de('0x29')]['id']){_0x3654aa=_0x1518f6[_0x99de('0x5c')][0x0][_0x99de('0x43')];return db[_0x99de('0xac')][_0x99de('0x60')]({'where':{'messageId':_0x1518f6[_0x99de('0x5c')][0x0][_0x99de('0x29')]['id']}});}break;case _0x99de('0x95'):if(_0x1518f6[_0x99de('0x5c')]['redif']&&_0x1518f6[_0x99de('0x5c')][_0x99de('0x2d')]){_0x3654aa=_0x1518f6[_0x99de('0x5c')][_0x99de('0x2d')];return db[_0x99de('0xac')][_0x99de('0x60')]({'where':{'messageId':_0x1518f6[_0x99de('0x5c')]['redif']}});}break;}}})[_0x99de('0x22')](handleEntityNotFound(_0x1ba80a,null))[_0x99de('0x22')](function(_0x5c3d17){if(_0x5c3d17){_0x287670=_0x5c3d17;switch(_0x2d5f92[_0x99de('0x43')]){case _0x99de('0x89'):if(_0x3654aa===_0x99de('0xdb')){return _0x287670[_0x99de('0x39')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x99de('0x2d'),_0x99de('0x89'),util[_0x99de('0xd3')](_0x1518f6['body'],{'showHidden':![],'depth':null}));}break;case _0x99de('0xd5'):if(_0x3654aa==='1'){return _0x287670[_0x99de('0x39')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x99de('0x2d'),_0x99de('0x89'),util[_0x99de('0xd3')](_0x1518f6[_0x99de('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x99de('0x8b'):if(!_0x1518f6[_0x99de('0x5c')]['error_code']&&_0x3654aa>=0xc8&&_0x3654aa<=0xce){return _0x287670[_0x99de('0x39')]({'read':!![]});}else{logger[_0x99de('0x27')](_0x99de('0x25'),_0x99de('0x2d'),'clicksend',util[_0x99de('0xd3')](_0x1518f6['body'],{'showHidden':![],'depth':null}));}break;case _0x99de('0x8f'):var _0x3d9675=_0x1518f6[_0x99de('0x5c')]['results'][0x0];if(_0x3d9675['status'][_0x99de('0xd9')]===_0x99de('0xdb')){return _0x287670['update']({'read':!![]});}else{logger[_0x99de('0x27')](_0x99de('0x25'),_0x99de('0x2d'),_0x99de('0x8f'),util[_0x99de('0xd3')](_0x1518f6[_0x99de('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x99de('0xda'):if(_0x3654aa==_0x99de('0xdc')||_0x3654aa==_0x99de('0xdd')){return _0x287670[_0x99de('0x39')]({'read':!![]});}else{logger[_0x99de('0x27')](_0x99de('0x25'),_0x99de('0x2d'),'clickatell',util[_0x99de('0xd3')](_0x1518f6[_0x99de('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x99de('0x94'):if(_0x3654aa=='message-delivered'){return _0x287670[_0x99de('0x39')]({'read':!![]});}else{logger[_0x99de('0x27')](_0x99de('0x25'),'status',_0x99de('0x94'),util[_0x99de('0xd3')](_0x1518f6[_0x99de('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x99de('0x95'):if(_0x3654aa===_0x99de('0xde')||_0x3654aa===_0x99de('0xdf')){return _0x287670['update']({'read':!![]});}else{logger[_0x99de('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x99de('0x2d'),'intelepeer',util[_0x99de('0xd3')](_0x1518f6['body'],{'showHidden':![],'depth':null}));}break;}return _0x287670;}})['then'](respondWithResult(_0x1ba80a,null))[_0x99de('0x59')](handleError(_0x1ba80a,null));};exports[_0x99de('0xe0')]=function(_0x49f95f,_0x35cde2,_0x5b7c60){var _0x3a7464,_0x14f47b,_0x318f3a;return db[_0x99de('0x5a')][_0x99de('0x60')]({'where':{'id':_0x49f95f[_0x99de('0x64')]['id']}})[_0x99de('0x22')](handleEntityNotFound(_0x35cde2,null))['then'](function(_0x4276f1){if(_0x4276f1){_0x318f3a=_0x4276f1;logger[_0x99de('0x24')](_0x99de('0x25'),_0x99de('0x2d'),'received\x20delivery\x20report\x20from',_0x4276f1[_0x99de('0x43')],util[_0x99de('0xd3')](_0x49f95f[_0x99de('0x46')],{'showHidden':![],'depth':null}));switch(_0x4276f1['type']){case _0x99de('0x91'):if(_0x49f95f[_0x99de('0x46')]['message-id']&&_0x49f95f['query'][_0x99de('0xe1')]){_0x14f47b=_0x49f95f[_0x99de('0x46')][_0x99de('0xe1')];return db[_0x99de('0xac')]['find']({'where':{'messageId':_0x49f95f[_0x99de('0x46')]['message-id']}});}break;}}})[_0x99de('0x22')](handleEntityNotFound(_0x35cde2,null))[_0x99de('0x22')](function(_0xfa1f97){if(_0xfa1f97){_0x3a7464=_0xfa1f97;switch(_0x318f3a[_0x99de('0x43')]){case _0x99de('0x91'):if(_0x14f47b==='2'||_0x14f47b==='6'){return _0x3a7464[_0x99de('0x39')]({'read':!![]});}else{logger[_0x99de('0x27')](_0x99de('0x25'),_0x99de('0x2d'),_0x99de('0x91'),util[_0x99de('0xd3')](_0x49f95f[_0x99de('0x46')],{'showHidden':![],'depth':null}));};break;}return _0x3a7464;}})['then'](respondWithResult(_0x35cde2,null))[_0x99de('0x59')](handleError(_0x35cde2,null));};exports[_0x99de('0xe2')]=function(_0x25e8d9,_0x5845ab,_0x257d0a){return db[_0x99de('0x5a')][_0x99de('0x60')]({'where':{'id':_0x25e8d9['params']['id']}})[_0x99de('0x22')](handleEntityNotFound(_0x5845ab,null))[_0x99de('0x22')](function(_0x162211){if(_0x162211){return _0x162211['addAgents'](_0x25e8d9['body'][_0x99de('0x72')],_[_0x99de('0xa1')](_0x25e8d9[_0x99de('0x5c')],['ids','id'])||{})['spread'](function(_0x2b06e4){for(var _0x593ce1=0x0;_0x593ce1<_0x25e8d9[_0x99de('0x5c')][_0x99de('0x72')][_0x99de('0x4c')];_0x593ce1+=0x1){socket[_0x99de('0xe3')](_0x99de('0xe4'),{'UserId':Number(_0x25e8d9[_0x99de('0x5c')]['ids'][_0x593ce1]),'SmsAccountId':Number(_0x25e8d9[_0x99de('0x64')]['id'])});}return _0x2b06e4;});}})[_0x99de('0x22')](respondWithResult(_0x5845ab,null))[_0x99de('0x59')](handleError(_0x5845ab,null));};exports['removeAgents']=function(_0x24525f,_0x45ebf4,_0x14164c){return db[_0x99de('0x5a')]['find']({'where':{'id':_0x24525f[_0x99de('0x64')]['id']}})[_0x99de('0x22')](handleEntityNotFound(_0x45ebf4,null))['then'](function(_0x505604){if(_0x505604){return _0x505604[_0x99de('0xe5')](_0x24525f[_0x99de('0x46')][_0x99de('0x72')])[_0x99de('0x22')](function(){if(_[_0x99de('0xe6')](_0x24525f[_0x99de('0x46')][_0x99de('0x72')])){for(var _0xe18cb=0x0;_0xe18cb<_0x24525f['query'][_0x99de('0x72')][_0x99de('0x4c')];_0xe18cb+=0x1){socket[_0x99de('0xe3')](_0x99de('0xe7'),{'UserId':Number(_0x24525f[_0x99de('0x46')][_0x99de('0x72')][_0xe18cb]),'SmsAccountId':Number(_0x24525f[_0x99de('0x64')]['id'])});}}else{socket[_0x99de('0xe3')](_0x99de('0xe7'),{'UserId':Number(_0x24525f[_0x99de('0x46')][_0x99de('0x72')]),'SmsAccountId':Number(_0x24525f[_0x99de('0x64')]['id'])});}});}})['then'](respondWithStatusCode(_0x45ebf4,null))[_0x99de('0x59')](handleError(_0x45ebf4,null));};exports[_0x99de('0xe8')]=function(_0x125f37,_0x33cf66,_0x19fb68){var _0x221447={};var _0x5e9af2={};var _0x209e03;var _0x4c6e34;return db['SmsAccount'][_0x99de('0x69')]({'where':{'id':_0x125f37[_0x99de('0x64')]['id']}})[_0x99de('0x22')](handleEntityNotFound(_0x33cf66,null))[_0x99de('0x22')](function(_0x53d568){if(_0x53d568){_0x209e03=_0x53d568;_0x5e9af2[_0x99de('0x45')]=_['keys'](db[_0x99de('0xb0')][_0x99de('0x42')]);_0x5e9af2['query']=_[_0x99de('0x47')](_0x125f37['query']);_0x5e9af2[_0x99de('0x48')]=_[_0x99de('0x49')](_0x5e9af2[_0x99de('0x45')],_0x5e9af2[_0x99de('0x46')]);_0x221447[_0x99de('0x4a')]=_[_0x99de('0x49')](_0x5e9af2['model'],qs[_0x99de('0x4b')](_0x125f37['query'][_0x99de('0x4b')]));_0x221447['attributes']=_0x221447['attributes'][_0x99de('0x4c')]?_0x221447[_0x99de('0x4a')]:_0x5e9af2['model'];_0x221447[_0x99de('0x4f')]=qs[_0x99de('0x50')](_0x125f37[_0x99de('0x46')][_0x99de('0x50')]);_0x221447[_0x99de('0x51')]=qs['filters'](_['pick'](_0x125f37[_0x99de('0x46')],_0x5e9af2['filters']));if(_0x125f37[_0x99de('0x46')]['filter']){_0x221447['where']=_[_0x99de('0x54')](_0x221447[_0x99de('0x51')],{'$or':_[_0x99de('0x41')](_0x221447[_0x99de('0x4a')],function(_0x3a5b6d){var _0x3aefb6={};_0x3aefb6[_0x3a5b6d]={'$like':'%'+_0x125f37[_0x99de('0x46')]['filter']+'%'};return _0x3aefb6;})});}_0x221447=_[_0x99de('0x54')]({},_0x221447,_0x125f37['options']);return _0x209e03[_0x99de('0xe8')](_0x221447);}})[_0x99de('0x22')](function(_0x24c64c){if(_0x24c64c){_0x4c6e34=_0x24c64c['length'];if(!_0x125f37[_0x99de('0x46')][_0x99de('0x4d')](_0x99de('0x4e'))){_0x221447['limit']=qs[_0x99de('0x33')](_0x125f37['query'][_0x99de('0x33')]);_0x221447['offset']=qs[_0x99de('0x30')](_0x125f37[_0x99de('0x46')]['offset']);}return _0x209e03[_0x99de('0xe8')](_0x221447);}})['then'](function(_0x528a31){if(_0x528a31){return _0x528a31?{'count':_0x4c6e34,'rows':_0x528a31}:null;}})[_0x99de('0x22')](respondWithResult(_0x33cf66,null))[_0x99de('0x59')](handleError(_0x33cf66,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index ffafdbd..16297b0 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 _0x0f19=['save','update','remove','emit','exports','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0f19,0x135));var _0x90f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f19[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x90f1('0x0'))['db'][_0x90f1('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x90f1('0x2')](0x0);var events={'afterCreate':_0x90f1('0x3'),'afterUpdate':_0x90f1('0x4'),'afterDestroy':_0x90f1('0x5')};function emitEvent(_0x1c2dc9){return function(_0x2434ce,_0x8c0839,_0x5b0625){SmsAccountEvents[_0x90f1('0x6')](_0x1c2dc9+':'+_0x2434ce['id'],_0x2434ce);SmsAccountEvents['emit'](_0x1c2dc9,_0x2434ce);_0x5b0625(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x90f1('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0x2db9=['remove','emit','hook','exports','../../mysqldb','SmsAccount','setMaxListeners','save'];(function(_0x59989f,_0xed813b){var _0x2ac4a8=function(_0x351171){while(--_0x351171){_0x59989f['push'](_0x59989f['shift']());}};_0x2ac4a8(++_0xed813b);}(_0x2db9,0xcc));var _0x92db=function(_0x537620,_0x593471){_0x537620=_0x537620-0x0;var _0x11f940=_0x2db9[_0x537620];return _0x11f940;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x92db('0x0'))['db'][_0x92db('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x92db('0x2')](0x0);var events={'afterCreate':_0x92db('0x3'),'afterUpdate':'update','afterDestroy':_0x92db('0x4')};function emitEvent(_0x5ea6a1){return function(_0x41e882,_0x28f301,_0x57f652){SmsAccountEvents[_0x92db('0x5')](_0x5ea6a1+':'+_0x41e882['id'],_0x41e882);SmsAccountEvents[_0x92db('0x5')](_0x5ea6a1,_0x41e882);_0x57f652(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x92db('0x6')](e,emitEvent(event));}}module[_0x92db('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 378e7da..fd1d639 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 _0x7594=['sms_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','define','SmsAccount'];(function(_0x1e9905,_0x1fe76f){var _0x5be824=function(_0x50b582){while(--_0x50b582){_0x1e9905['push'](_0x1e9905['shift']());}};_0x5be824(++_0x1fe76f);}(_0x7594,0x169));var _0x4759=function(_0x240261,_0x4fe66c){_0x240261=_0x240261-0x0;var _0x45c332=_0x7594[_0x240261];return _0x45c332;};'use strict';var _=require(_0x4759('0x0'));var util=require(_0x4759('0x1'));var logger=require(_0x4759('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4759('0x3'));var rp=require(_0x4759('0x4'));var fs=require('fs');var path=require(_0x4759('0x5'));var rimraf=require(_0x4759('0x6'));var config=require(_0x4759('0x7'));var attributes=require(_0x4759('0x8'));module['exports']=function(_0x20f49c,_0x3b6ae4){return _0x20f49c[_0x4759('0x9')](_0x4759('0xa'),attributes,{'tableName':_0x4759('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x58fd=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger'];(function(_0x25a42a,_0x3d489b){var _0x1129b1=function(_0x4ae61b){while(--_0x4ae61b){_0x25a42a['push'](_0x25a42a['shift']());}};_0x1129b1(++_0x3d489b);}(_0x58fd,0xc1));var _0xd58f=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x58fd[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0xd58f('0x0'));var util=require(_0xd58f('0x1'));var logger=require(_0xd58f('0x2'))(_0xd58f('0x3'));var moment=require(_0xd58f('0x4'));var BPromise=require(_0xd58f('0x5'));var rp=require(_0xd58f('0x6'));var fs=require('fs');var path=require(_0xd58f('0x7'));var rimraf=require(_0xd58f('0x8'));var config=require(_0xd58f('0x9'));var attributes=require('./smsAccount.attributes');module[_0xd58f('0xa')]=function(_0x32a702,_0x4d41ba){return _0x32a702[_0xd58f('0xb')](_0xd58f('0xc'),attributes,{'tableName':_0xd58f('0xd'),'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 429f2f4..a9bf24c 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 _0x4434=['error','message','result','catch','SmsAccount','find','options','raw','where','include','map','model','attributes','ShowSmsAccount','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x11981,_0x33501f){var _0x1abe4f=function(_0x5e0ce1){while(--_0x5e0ce1){_0x11981['push'](_0x11981['shift']());}};_0x1abe4f(++_0x33501f);}(_0x4434,0xe6));var _0x4443=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x4434[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x4443('0x0'));var util=require(_0x4443('0x1'));var moment=require(_0x4443('0x2'));var BPromise=require('bluebird');var rs=require(_0x4443('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4443('0x4'))['db'];var utils=require(_0x4443('0x5'));var logger=require(_0x4443('0x6'))('rpc');var config=require(_0x4443('0x7'));var jayson=require(_0x4443('0x8'));var client=jayson[_0x4443('0x9')][_0x4443('0xa')]({'port':0x232a});config[_0x4443('0xb')]=_[_0x4443('0xc')](config[_0x4443('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x4443('0xd'))(new Redis(config['redis']));require(_0x4443('0xe'))[_0x4443('0xf')](socket);function respondWithRpcPromise(_0x5bf5b0,_0x3750ff,_0x2a1492){return new BPromise(function(_0x29ac00,_0x2dfe0f){return client[_0x4443('0x10')](_0x5bf5b0,_0x2a1492)[_0x4443('0x11')](function(_0x20847e){logger[_0x4443('0x12')](_0x4443('0x13'),_0x3750ff,_0x4443('0x14'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3750ff,_0x4443('0x14'),JSON[_0x4443('0x15')](_0x20847e));if(_0x20847e['error']){if(_0x20847e[_0x4443('0x16')]['code']===0x1f4){logger[_0x4443('0x16')]('SmsAccount,\x20%s,\x20%s',_0x3750ff,_0x20847e['error']['message']);return _0x2dfe0f(_0x20847e[_0x4443('0x16')][_0x4443('0x17')]);}logger[_0x4443('0x16')]('SmsAccount,\x20%s,\x20%s',_0x3750ff,_0x20847e[_0x4443('0x16')][_0x4443('0x17')]);return _0x29ac00(_0x20847e['error']['message']);}else{logger[_0x4443('0x12')](_0x4443('0x13'),_0x3750ff,_0x4443('0x14'));_0x29ac00(_0x20847e[_0x4443('0x18')][_0x4443('0x17')]);}})[_0x4443('0x19')](function(_0x5e2993){logger[_0x4443('0x16')]('SmsAccount,\x20%s,\x20%s',_0x3750ff,_0x5e2993);_0x2dfe0f(_0x5e2993);});});}exports['ShowSmsAccount']=function(_0x233ee5){var _0x5dabbd=this;return new Promise(function(_0x6082a4,_0x178699){return db[_0x4443('0x1a')][_0x4443('0x1b')]({'raw':_0x233ee5[_0x4443('0x1c')]?_0x233ee5[_0x4443('0x1c')][_0x4443('0x1d')]===undefined?!![]:![]:!![],'where':_0x233ee5['options']?_0x233ee5['options'][_0x4443('0x1e')]||null:null,'attributes':_0x233ee5[_0x4443('0x1c')]?_0x233ee5[_0x4443('0x1c')]['attributes']||null:null,'include':_0x233ee5['options']?_0x233ee5[_0x4443('0x1c')][_0x4443('0x1f')]?_[_0x4443('0x20')](_0x233ee5[_0x4443('0x1c')][_0x4443('0x1f')],function(_0xa8a756){return{'model':db[_0xa8a756[_0x4443('0x21')]],'as':_0xa8a756['as'],'attributes':_0xa8a756[_0x4443('0x22')],'include':_0xa8a756['include']?_[_0x4443('0x20')](_0xa8a756[_0x4443('0x1f')],function(_0x44167c){return{'model':db[_0x44167c['model']],'as':_0x44167c['as'],'attributes':_0x44167c[_0x4443('0x22')],'include':_0x44167c[_0x4443('0x1f')]?_['map'](_0x44167c[_0x4443('0x1f')],function(_0x49f79a){return{'model':db[_0x49f79a[_0x4443('0x21')]],'as':_0x49f79a['as'],'attributes':_0x49f79a[_0x4443('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x455e4f){logger[_0x4443('0x12')]('ShowSmsAccount',_0x233ee5);logger['debug'](_0x4443('0x23'),_0x233ee5,JSON[_0x4443('0x15')](_0x455e4f));_0x6082a4(_0x455e4f);})[_0x4443('0x19')](function(_0x2634b2){logger[_0x4443('0x16')](_0x4443('0x23'),_0x2634b2[_0x4443('0x17')],_0x233ee5);_0x178699(_0x5dabbd['error'](0x1f4,_0x2634b2[_0x4443('0x17')]));});});}; \ No newline at end of file +var _0x1f8d=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','options','raw','where','attributes','include','map','model','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x23292a,_0x1e08ea){var _0x4564f2=function(_0x1ae201){while(--_0x1ae201){_0x23292a['push'](_0x23292a['shift']());}};_0x4564f2(++_0x1e08ea);}(_0x1f8d,0xf5));var _0xd1f8=function(_0x5051ef,_0x385b0b){_0x5051ef=_0x5051ef-0x0;var _0x58e625=_0x1f8d[_0x5051ef];return _0x58e625;};'use strict';var _=require('lodash');var util=require(_0xd1f8('0x0'));var moment=require('moment');var BPromise=require(_0xd1f8('0x1'));var rs=require(_0xd1f8('0x2'));var fs=require('fs');var Redis=require(_0xd1f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd1f8('0x4'));var logger=require(_0xd1f8('0x5'))(_0xd1f8('0x6'));var config=require('../../config/environment');var jayson=require(_0xd1f8('0x7'));var client=jayson[_0xd1f8('0x8')][_0xd1f8('0x9')]({'port':0x232a});config[_0xd1f8('0xa')]=_['defaults'](config[_0xd1f8('0xa')],{'host':_0xd1f8('0xb'),'port':0x18eb});var socket=require(_0xd1f8('0xc'))(new Redis(config['redis']));require(_0xd1f8('0xd'))[_0xd1f8('0xe')](socket);function respondWithRpcPromise(_0x30c218,_0x69c59b,_0x25b3dc){return new BPromise(function(_0x4352a6,_0x5d1aaa){return client[_0xd1f8('0xf')](_0x30c218,_0x25b3dc)[_0xd1f8('0x10')](function(_0x25e494){logger[_0xd1f8('0x11')](_0xd1f8('0x12'),_0x69c59b,_0xd1f8('0x13'));logger[_0xd1f8('0x14')](_0xd1f8('0x15'),_0x69c59b,_0xd1f8('0x13'),JSON[_0xd1f8('0x16')](_0x25e494));if(_0x25e494[_0xd1f8('0x17')]){if(_0x25e494[_0xd1f8('0x17')][_0xd1f8('0x18')]===0x1f4){logger[_0xd1f8('0x17')](_0xd1f8('0x12'),_0x69c59b,_0x25e494[_0xd1f8('0x17')][_0xd1f8('0x19')]);return _0x5d1aaa(_0x25e494['error'][_0xd1f8('0x19')]);}logger[_0xd1f8('0x17')](_0xd1f8('0x12'),_0x69c59b,_0x25e494[_0xd1f8('0x17')]['message']);return _0x4352a6(_0x25e494[_0xd1f8('0x17')][_0xd1f8('0x19')]);}else{logger[_0xd1f8('0x11')](_0xd1f8('0x12'),_0x69c59b,_0xd1f8('0x13'));_0x4352a6(_0x25e494[_0xd1f8('0x1a')]['message']);}})[_0xd1f8('0x1b')](function(_0x184b71){logger[_0xd1f8('0x17')](_0xd1f8('0x12'),_0x69c59b,_0x184b71);_0x5d1aaa(_0x184b71);});});}exports[_0xd1f8('0x1c')]=function(_0x47e1f7){var _0x4d8308=this;return new Promise(function(_0x117754,_0x233380){return db['SmsAccount']['find']({'raw':_0x47e1f7[_0xd1f8('0x1d')]?_0x47e1f7['options'][_0xd1f8('0x1e')]===undefined?!![]:![]:!![],'where':_0x47e1f7['options']?_0x47e1f7[_0xd1f8('0x1d')][_0xd1f8('0x1f')]||null:null,'attributes':_0x47e1f7['options']?_0x47e1f7[_0xd1f8('0x1d')][_0xd1f8('0x20')]||null:null,'include':_0x47e1f7[_0xd1f8('0x1d')]?_0x47e1f7['options'][_0xd1f8('0x21')]?_[_0xd1f8('0x22')](_0x47e1f7[_0xd1f8('0x1d')]['include'],function(_0x1638a8){return{'model':db[_0x1638a8[_0xd1f8('0x23')]],'as':_0x1638a8['as'],'attributes':_0x1638a8[_0xd1f8('0x20')],'include':_0x1638a8[_0xd1f8('0x21')]?_['map'](_0x1638a8[_0xd1f8('0x21')],function(_0x50e762){return{'model':db[_0x50e762[_0xd1f8('0x23')]],'as':_0x50e762['as'],'attributes':_0x50e762[_0xd1f8('0x20')],'include':_0x50e762[_0xd1f8('0x21')]?_['map'](_0x50e762['include'],function(_0x25adde){return{'model':db[_0x25adde[_0xd1f8('0x23')]],'as':_0x25adde['as'],'attributes':_0x25adde[_0xd1f8('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd1f8('0x10')](function(_0x2dc965){logger['info']('ShowSmsAccount',_0x47e1f7);logger['debug'](_0xd1f8('0x1c'),_0x47e1f7,JSON[_0xd1f8('0x16')](_0x2dc965));_0x117754(_0x2dc965);})['catch'](function(_0x20b75a){logger['error']('ShowSmsAccount',_0x20b75a[_0xd1f8('0x19')],_0x47e1f7);_0x233380(_0x4d8308[_0xd1f8('0x17')](0x1f4,_0x20b75a[_0xd1f8('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 703cdf2..6ec768b 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 d559d05..23dfad1 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x2a34f2,_0x599e7e){var _0x3813ea=function(_0x1c6af3){while(--_0x1c6af3){_0x2a34f2['push'](_0x2a34f2['shift']());}};_0x3813ea(++_0x599e7e);}(_0x3e74,0x175));var _0x43e7=function(_0x506555,_0x1acd3f){_0x506555=_0x506555-0x0;var _0x1e91a4=_0x3e74[_0x506555];return _0x1e91a4;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +var _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x114016,_0x42bc91){var _0x4ca393=function(_0x474d94){while(--_0x474d94){_0x114016['push'](_0x114016['shift']());}};_0x4ca393(++_0x42bc91);}(_0x55ca,0x126));var _0xa55c=function(_0x53efa4,_0x1e673b){_0x53efa4=_0x53efa4-0x0;var _0x276274=_0x55ca[_0x53efa4];return _0x276274;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index ec23e58..add1e22 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 _0x26d1=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x26d1,0xf2));var _0x126d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x26d1[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x126d('0x0'));module[_0x126d('0x1')]={'priority':{'type':Sequelize[_0x126d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x126d('0x3')],'allowNull':![],'defaultValue':_0x126d('0x4')},'appdata':{'type':Sequelize[_0x126d('0x5')]()},'description':{'type':Sequelize[_0x126d('0x3')]},'interval':{'type':Sequelize[_0x126d('0x3')],'defaultValue':_0x126d('0x6')}}; \ No newline at end of file +var _0x950e=['noop','TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x20eca8,_0x5cf63f){var _0x1dd774=function(_0x85e754){while(--_0x85e754){_0x20eca8['push'](_0x20eca8['shift']());}};_0x1dd774(++_0x5cf63f);}(_0x950e,0xf3));var _0xe950=function(_0x4d78fb,_0x280202){_0x4d78fb=_0x4d78fb-0x0;var _0x2898bf=_0x950e[_0x4d78fb];return _0x2898bf;};'use strict';var Sequelize=require(_0xe950('0x0'));module['exports']={'priority':{'type':Sequelize[_0xe950('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xe950('0x2')],'allowNull':![],'defaultValue':_0xe950('0x3')},'appdata':{'type':Sequelize[_0xe950('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe950('0x2')],'defaultValue':_0xe950('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index a3d8ba0..574febe 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 _0xd6ef=['save','then','error','stack','send','index','SmsApplication','rawAttributes','fieldName','type','key','map','name','keys','filters','intersection','model','fields','attributes','length','query','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','options','find','body','update','params','destroy','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject'];(function(_0x3a7b72,_0x43751b){var _0x2752a3=function(_0x564050){while(--_0x564050){_0x3a7b72['push'](_0x3a7b72['shift']());}};_0x2752a3(++_0x43751b);}(_0xd6ef,0x14f));var _0xfd6e=function(_0x4c52da,_0x34a57b){_0x4c52da=_0x4c52da-0x0;var _0x55c9f2=_0xd6ef[_0x4c52da];return _0x55c9f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfd6e('0x0'));var zipdir=require(_0xfd6e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfd6e('0x2'));var moment=require(_0xfd6e('0x3'));var BPromise=require(_0xfd6e('0x4'));var Mustache=require(_0xfd6e('0x5'));var util=require(_0xfd6e('0x6'));var path=require(_0xfd6e('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfd6e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfd6e('0x9'));var squel=require(_0xfd6e('0xa'));var crypto=require(_0xfd6e('0xb'));var jsforce=require(_0xfd6e('0xc'));var deskjs=require(_0xfd6e('0xd'));var toCsv=require(_0xfd6e('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfd6e('0xf'));var authService=require(_0xfd6e('0x10'));var qs=require(_0xfd6e('0x11'));var as=require(_0xfd6e('0x12'));var hardwareService=require(_0xfd6e('0x13'));var logger=require(_0xfd6e('0x14'))(_0xfd6e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfd6e('0x16'));var db=require(_0xfd6e('0x17'))['db'];function respondWithStatusCode(_0x1fe2a5,_0x24484c){_0x24484c=_0x24484c||0xcc;return function(_0x59578f){if(_0x59578f){return _0x1fe2a5[_0xfd6e('0x18')](_0x24484c);}return _0x1fe2a5[_0xfd6e('0x19')](_0x24484c)['end']();};}function respondWithResult(_0x15e3aa,_0x272250){_0x272250=_0x272250||0xc8;return function(_0x301b90){if(_0x301b90){return _0x15e3aa[_0xfd6e('0x19')](_0x272250)[_0xfd6e('0x1a')](_0x301b90);}};}function respondWithFilteredResult(_0x867cda,_0x4f40fe){return function(_0x1ff253){if(_0x1ff253){var _0xda37b5=typeof _0x4f40fe['offset']===_0xfd6e('0x1b')&&typeof _0x4f40fe[_0xfd6e('0x1c')]==='undefined';var _0x11e85b=_0x1ff253[_0xfd6e('0x1d')];var _0xeaa54a=_0xda37b5?0x0:_0x4f40fe[_0xfd6e('0x1e')];var _0x477155=_0xda37b5?_0x1ff253[_0xfd6e('0x1d')]:_0x4f40fe['offset']+_0x4f40fe[_0xfd6e('0x1c')];var _0x4ef3e9;if(_0x477155>=_0x11e85b){_0x477155=_0x11e85b;_0x4ef3e9=0xc8;}else{_0x4ef3e9=0xce;}_0x867cda[_0xfd6e('0x19')](_0x4ef3e9);return _0x867cda[_0xfd6e('0x1f')](_0xfd6e('0x20'),_0xeaa54a+'-'+_0x477155+'/'+_0x11e85b)[_0xfd6e('0x1a')](_0x1ff253);}return null;};}function patchUpdates(_0x4ac048){return function(_0x59fec9){try{jsonpatch[_0xfd6e('0x21')](_0x59fec9,_0x4ac048,!![]);}catch(_0x3a33b6){return BPromise[_0xfd6e('0x22')](_0x3a33b6);}return _0x59fec9[_0xfd6e('0x23')]();};}function saveUpdates(_0x3a356d,_0x2dd72a){return function(_0xcf503){if(_0xcf503){return _0xcf503['update'](_0x3a356d)[_0xfd6e('0x24')](function(_0xccb334){return _0xccb334;});}return null;};}function removeEntity(_0x47922e,_0xba4b06){return function(_0xeb8381){if(_0xeb8381){return _0xeb8381['destroy']()['then'](function(){_0x47922e[_0xfd6e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4afe39,_0x355514){return function(_0x3d097e){if(!_0x3d097e){_0x4afe39[_0xfd6e('0x18')](0x194);}return _0x3d097e;};}function handleError(_0x9bea85,_0x4c5a68){_0x4c5a68=_0x4c5a68||0x1f4;return function(_0x5c3e5b){logger[_0xfd6e('0x25')](_0x5c3e5b[_0xfd6e('0x26')]);if(_0x5c3e5b['name']){delete _0x5c3e5b['name'];}_0x9bea85[_0xfd6e('0x19')](_0x4c5a68)[_0xfd6e('0x27')](_0x5c3e5b);};}exports[_0xfd6e('0x28')]=function(_0x2e6650,_0x3990a3){var _0x24f86d={},_0x5f1dbd={},_0x2af58f={'count':0x0,'rows':[]};var _0x20bf81=_['map'](db[_0xfd6e('0x29')][_0xfd6e('0x2a')],function(_0x1fc4ce){return{'name':_0x1fc4ce[_0xfd6e('0x2b')],'type':_0x1fc4ce[_0xfd6e('0x2c')][_0xfd6e('0x2d')]};});_0x5f1dbd['model']=_[_0xfd6e('0x2e')](_0x20bf81,_0xfd6e('0x2f'));_0x5f1dbd['query']=_[_0xfd6e('0x30')](_0x2e6650['query']);_0x5f1dbd[_0xfd6e('0x31')]=_[_0xfd6e('0x32')](_0x5f1dbd['model'],_0x5f1dbd['query']);_0x24f86d['attributes']=_[_0xfd6e('0x32')](_0x5f1dbd[_0xfd6e('0x33')],qs[_0xfd6e('0x34')](_0x2e6650['query'][_0xfd6e('0x34')]));_0x24f86d[_0xfd6e('0x35')]=_0x24f86d[_0xfd6e('0x35')][_0xfd6e('0x36')]?_0x24f86d['attributes']:_0x5f1dbd[_0xfd6e('0x33')];if(!_0x2e6650[_0xfd6e('0x37')][_0xfd6e('0x38')](_0xfd6e('0x39'))){_0x24f86d[_0xfd6e('0x1c')]=qs[_0xfd6e('0x1c')](_0x2e6650['query']['limit']);_0x24f86d[_0xfd6e('0x1e')]=qs['offset'](_0x2e6650[_0xfd6e('0x37')][_0xfd6e('0x1e')]);}_0x24f86d['order']=qs[_0xfd6e('0x3a')](_0x2e6650['query'][_0xfd6e('0x3a')]);_0x24f86d['where']=qs['filters'](_['pick'](_0x2e6650['query'],_0x5f1dbd[_0xfd6e('0x31')]),_0x20bf81);if(_0x2e6650[_0xfd6e('0x37')]['filter']){_0x24f86d[_0xfd6e('0x3b')]=_[_0xfd6e('0x3c')](_0x24f86d[_0xfd6e('0x3b')],{'$or':_[_0xfd6e('0x2e')](_0x20bf81,function(_0x12a71e){if(_0x12a71e[_0xfd6e('0x2c')]!==_0xfd6e('0x3d')){var _0x39ebce={};_0x39ebce[_0x12a71e[_0xfd6e('0x2f')]]={'$like':'%'+_0x2e6650[_0xfd6e('0x37')][_0xfd6e('0x3e')]+'%'};return _0x39ebce;}})});}_0x24f86d=_[_0xfd6e('0x3c')]({},_0x24f86d,_0x2e6650['options']);var _0x56f375={'where':_0x24f86d[_0xfd6e('0x3b')]};return db[_0xfd6e('0x29')][_0xfd6e('0x1d')](_0x56f375)[_0xfd6e('0x24')](function(_0x5c0a64){_0x2af58f[_0xfd6e('0x1d')]=_0x5c0a64;if(_0x2e6650[_0xfd6e('0x37')][_0xfd6e('0x3f')]){_0x24f86d[_0xfd6e('0x40')]=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0x24f86d);})[_0xfd6e('0x24')](function(_0x433b3e){_0x2af58f[_0xfd6e('0x41')]=_0x433b3e;return _0x2af58f;})['then'](respondWithFilteredResult(_0x3990a3,_0x24f86d))[_0xfd6e('0x42')](handleError(_0x3990a3,null));};exports[_0xfd6e('0x43')]=function(_0x20810b,_0x3cf3fb){var _0x4fe30d={'raw':!![],'where':{'id':_0x20810b['params']['id']}},_0x778502={};_0x778502['model']=_[_0xfd6e('0x30')](db[_0xfd6e('0x29')]['rawAttributes']);_0x778502[_0xfd6e('0x37')]=_[_0xfd6e('0x30')](_0x20810b[_0xfd6e('0x37')]);_0x778502[_0xfd6e('0x31')]=_['intersection'](_0x778502[_0xfd6e('0x33')],_0x778502[_0xfd6e('0x37')]);_0x4fe30d[_0xfd6e('0x35')]=_['intersection'](_0x778502[_0xfd6e('0x33')],qs[_0xfd6e('0x34')](_0x20810b['query'][_0xfd6e('0x34')]));_0x4fe30d[_0xfd6e('0x35')]=_0x4fe30d[_0xfd6e('0x35')][_0xfd6e('0x36')]?_0x4fe30d['attributes']:_0x778502[_0xfd6e('0x33')];if(_0x20810b[_0xfd6e('0x37')][_0xfd6e('0x3f')]){_0x4fe30d[_0xfd6e('0x40')]=[{'all':!![]}];}_0x4fe30d=_[_0xfd6e('0x3c')]({},_0x4fe30d,_0x20810b[_0xfd6e('0x44')]);return db[_0xfd6e('0x29')][_0xfd6e('0x45')](_0x4fe30d)[_0xfd6e('0x24')](handleEntityNotFound(_0x3cf3fb,null))[_0xfd6e('0x24')](respondWithResult(_0x3cf3fb,null))[_0xfd6e('0x42')](handleError(_0x3cf3fb,null));};exports['create']=function(_0xeba609,_0x4697c7){return db[_0xfd6e('0x29')]['create'](_0xeba609[_0xfd6e('0x46')],{})[_0xfd6e('0x24')](respondWithResult(_0x4697c7,0xc9))[_0xfd6e('0x42')](handleError(_0x4697c7,null));};exports[_0xfd6e('0x47')]=function(_0x2b00b9,_0x2eb65e){if(_0x2b00b9[_0xfd6e('0x46')]['id']){delete _0x2b00b9[_0xfd6e('0x46')]['id'];}return db[_0xfd6e('0x29')][_0xfd6e('0x45')]({'where':{'id':_0x2b00b9[_0xfd6e('0x48')]['id']}})[_0xfd6e('0x24')](handleEntityNotFound(_0x2eb65e,null))[_0xfd6e('0x24')](saveUpdates(_0x2b00b9[_0xfd6e('0x46')],null))['then'](respondWithResult(_0x2eb65e,null))[_0xfd6e('0x42')](handleError(_0x2eb65e,null));};exports[_0xfd6e('0x49')]=function(_0x5c8340,_0x2b0ec4){return db[_0xfd6e('0x29')]['find']({'where':{'id':_0x5c8340['params']['id']}})[_0xfd6e('0x24')](handleEntityNotFound(_0x2b0ec4,null))[_0xfd6e('0x24')](removeEntity(_0x2b0ec4,null))[_0xfd6e('0x42')](handleError(_0x2b0ec4,null));}; \ No newline at end of file +var _0xe8aa=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','SmsApplication','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware'];(function(_0x133a4f,_0x28b5cf){var _0x21256a=function(_0xa64661){while(--_0xa64661){_0x133a4f['push'](_0x133a4f['shift']());}};_0x21256a(++_0x28b5cf);}(_0xe8aa,0x11c));var _0xae8a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe8aa[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xae8a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xae8a('0x1'));var jsonpatch=require(_0xae8a('0x2'));var rp=require(_0xae8a('0x3'));var moment=require(_0xae8a('0x4'));var BPromise=require(_0xae8a('0x5'));var Mustache=require('mustache');var util=require(_0xae8a('0x6'));var path=require(_0xae8a('0x7'));var sox=require(_0xae8a('0x8'));var csv=require('to-csv');var ejs=require(_0xae8a('0x9'));var fs=require('fs');var fs_extra=require(_0xae8a('0xa'));var _=require(_0xae8a('0xb'));var squel=require('squel');var crypto=require(_0xae8a('0xc'));var jsforce=require(_0xae8a('0xd'));var deskjs=require(_0xae8a('0xe'));var toCsv=require(_0xae8a('0xf'));var querystring=require(_0xae8a('0x10'));var Papa=require(_0xae8a('0x11'));var Redis=require(_0xae8a('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae8a('0x13'));var logger=require(_0xae8a('0x14'))(_0xae8a('0x15'));var utils=require(_0xae8a('0x16'));var config=require(_0xae8a('0x17'));var licenseUtil=require(_0xae8a('0x18'));var db=require(_0xae8a('0x19'))['db'];function respondWithStatusCode(_0x3b72a1,_0x47d783){_0x47d783=_0x47d783||0xcc;return function(_0x52787e){if(_0x52787e){return _0x3b72a1[_0xae8a('0x1a')](_0x47d783);}return _0x3b72a1['status'](_0x47d783)[_0xae8a('0x1b')]();};}function respondWithResult(_0x4287b1,_0x1d63cd){_0x1d63cd=_0x1d63cd||0xc8;return function(_0x261c05){if(_0x261c05){return _0x4287b1['status'](_0x1d63cd)['json'](_0x261c05);}};}function respondWithFilteredResult(_0x47bdfa,_0x514ba5){return function(_0xa23054){if(_0xa23054){var _0x30d3c2=typeof _0x514ba5[_0xae8a('0x1c')]===_0xae8a('0x1d')&&typeof _0x514ba5[_0xae8a('0x1e')]===_0xae8a('0x1d');var _0x4d7d61=_0xa23054[_0xae8a('0x1f')];var _0x223fcf=_0x30d3c2?0x0:_0x514ba5[_0xae8a('0x1c')];var _0x2263be=_0x30d3c2?_0xa23054[_0xae8a('0x1f')]:_0x514ba5[_0xae8a('0x1c')]+_0x514ba5[_0xae8a('0x1e')];var _0x213b5d;if(_0x2263be>=_0x4d7d61){_0x2263be=_0x4d7d61;_0x213b5d=0xc8;}else{_0x213b5d=0xce;}_0x47bdfa[_0xae8a('0x20')](_0x213b5d);return _0x47bdfa['set']('Content-Range',_0x223fcf+'-'+_0x2263be+'/'+_0x4d7d61)['json'](_0xa23054);}return null;};}function patchUpdates(_0x42af74){return function(_0xee2365){try{jsonpatch[_0xae8a('0x21')](_0xee2365,_0x42af74,!![]);}catch(_0x4ea268){return BPromise[_0xae8a('0x22')](_0x4ea268);}return _0xee2365['save']();};}function saveUpdates(_0x113487,_0x225842){return function(_0x511b45){if(_0x511b45){return _0x511b45[_0xae8a('0x23')](_0x113487)[_0xae8a('0x24')](function(_0xdc069d){return _0xdc069d;});}return null;};}function removeEntity(_0x1a308a,_0x50b0e5){return function(_0x1e2b09){if(_0x1e2b09){return _0x1e2b09[_0xae8a('0x25')]()['then'](function(){_0x1a308a[_0xae8a('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13b3f2,_0x385e87){return function(_0xda27fd){if(!_0xda27fd){_0x13b3f2[_0xae8a('0x1a')](0x194);}return _0xda27fd;};}function handleError(_0xc0a311,_0x38b747){_0x38b747=_0x38b747||0x1f4;return function(_0x366701){logger[_0xae8a('0x26')](_0x366701[_0xae8a('0x27')]);if(_0x366701[_0xae8a('0x28')]){delete _0x366701[_0xae8a('0x28')];}_0xc0a311[_0xae8a('0x20')](_0x38b747)[_0xae8a('0x29')](_0x366701);};}exports[_0xae8a('0x2a')]=function(_0x41103e,_0x34274e){var _0x8af995={},_0x26bd88={},_0x147c46={'count':0x0,'rows':[]};var _0x528a43=_[_0xae8a('0x2b')](db['SmsApplication'][_0xae8a('0x2c')],function(_0x5dd66a){return{'name':_0x5dd66a[_0xae8a('0x2d')],'type':_0x5dd66a['type']['key']};});_0x26bd88['model']=_[_0xae8a('0x2b')](_0x528a43,'name');_0x26bd88['query']=_['keys'](_0x41103e[_0xae8a('0x2e')]);_0x26bd88[_0xae8a('0x2f')]=_[_0xae8a('0x30')](_0x26bd88['model'],_0x26bd88[_0xae8a('0x2e')]);_0x8af995[_0xae8a('0x31')]=_[_0xae8a('0x30')](_0x26bd88['model'],qs['fields'](_0x41103e[_0xae8a('0x2e')][_0xae8a('0x32')]));_0x8af995[_0xae8a('0x31')]=_0x8af995[_0xae8a('0x31')][_0xae8a('0x33')]?_0x8af995[_0xae8a('0x31')]:_0x26bd88[_0xae8a('0x34')];if(!_0x41103e[_0xae8a('0x2e')][_0xae8a('0x35')](_0xae8a('0x36'))){_0x8af995[_0xae8a('0x1e')]=qs[_0xae8a('0x1e')](_0x41103e[_0xae8a('0x2e')][_0xae8a('0x1e')]);_0x8af995[_0xae8a('0x1c')]=qs['offset'](_0x41103e[_0xae8a('0x2e')][_0xae8a('0x1c')]);}_0x8af995[_0xae8a('0x37')]=qs[_0xae8a('0x38')](_0x41103e['query'][_0xae8a('0x38')]);_0x8af995[_0xae8a('0x39')]=qs[_0xae8a('0x2f')](_[_0xae8a('0x3a')](_0x41103e[_0xae8a('0x2e')],_0x26bd88['filters']),_0x528a43);if(_0x41103e['query'][_0xae8a('0x3b')]){_0x8af995['where']=_[_0xae8a('0x3c')](_0x8af995[_0xae8a('0x39')],{'$or':_['map'](_0x528a43,function(_0x31a806){if(_0x31a806[_0xae8a('0x3d')]!==_0xae8a('0x3e')){var _0x5adb4e={};_0x5adb4e[_0x31a806['name']]={'$like':'%'+_0x41103e[_0xae8a('0x2e')][_0xae8a('0x3b')]+'%'};return _0x5adb4e;}})});}_0x8af995=_['merge']({},_0x8af995,_0x41103e[_0xae8a('0x3f')]);var _0x2b56fc={'where':_0x8af995[_0xae8a('0x39')]};return db[_0xae8a('0x40')][_0xae8a('0x1f')](_0x2b56fc)[_0xae8a('0x24')](function(_0x298a64){_0x147c46[_0xae8a('0x1f')]=_0x298a64;if(_0x41103e[_0xae8a('0x2e')][_0xae8a('0x41')]){_0x8af995[_0xae8a('0x42')]=[{'all':!![]}];}return db[_0xae8a('0x40')][_0xae8a('0x43')](_0x8af995);})['then'](function(_0x26e8ec){_0x147c46[_0xae8a('0x44')]=_0x26e8ec;return _0x147c46;})[_0xae8a('0x24')](respondWithFilteredResult(_0x34274e,_0x8af995))[_0xae8a('0x45')](handleError(_0x34274e,null));};exports[_0xae8a('0x46')]=function(_0x212fb7,_0x270497){var _0x47668b={'raw':!![],'where':{'id':_0x212fb7[_0xae8a('0x47')]['id']}},_0x3ab9f9={};_0x3ab9f9['model']=_[_0xae8a('0x48')](db['SmsApplication'][_0xae8a('0x2c')]);_0x3ab9f9[_0xae8a('0x2e')]=_[_0xae8a('0x48')](_0x212fb7['query']);_0x3ab9f9['filters']=_[_0xae8a('0x30')](_0x3ab9f9[_0xae8a('0x34')],_0x3ab9f9['query']);_0x47668b[_0xae8a('0x31')]=_[_0xae8a('0x30')](_0x3ab9f9[_0xae8a('0x34')],qs[_0xae8a('0x32')](_0x212fb7[_0xae8a('0x2e')][_0xae8a('0x32')]));_0x47668b['attributes']=_0x47668b[_0xae8a('0x31')][_0xae8a('0x33')]?_0x47668b[_0xae8a('0x31')]:_0x3ab9f9[_0xae8a('0x34')];if(_0x212fb7[_0xae8a('0x2e')]['includeAll']){_0x47668b[_0xae8a('0x42')]=[{'all':!![]}];}_0x47668b=_[_0xae8a('0x3c')]({},_0x47668b,_0x212fb7['options']);return db[_0xae8a('0x40')][_0xae8a('0x49')](_0x47668b)[_0xae8a('0x24')](handleEntityNotFound(_0x270497,null))['then'](respondWithResult(_0x270497,null))[_0xae8a('0x45')](handleError(_0x270497,null));};exports['create']=function(_0xdc1570,_0x1f48ac){return db[_0xae8a('0x40')][_0xae8a('0x4a')](_0xdc1570['body'],{})[_0xae8a('0x24')](respondWithResult(_0x1f48ac,0xc9))[_0xae8a('0x45')](handleError(_0x1f48ac,null));};exports[_0xae8a('0x23')]=function(_0x46e22b,_0x58937a){if(_0x46e22b[_0xae8a('0x4b')]['id']){delete _0x46e22b[_0xae8a('0x4b')]['id'];}return db[_0xae8a('0x40')][_0xae8a('0x49')]({'where':{'id':_0x46e22b[_0xae8a('0x47')]['id']}})[_0xae8a('0x24')](handleEntityNotFound(_0x58937a,null))[_0xae8a('0x24')](saveUpdates(_0x46e22b[_0xae8a('0x4b')],null))[_0xae8a('0x24')](respondWithResult(_0x58937a,null))['catch'](handleError(_0x58937a,null));};exports[_0xae8a('0x25')]=function(_0x69f55d,_0x1e5473){return db['SmsApplication'][_0xae8a('0x49')]({'where':{'id':_0x69f55d[_0xae8a('0x47')]['id']}})[_0xae8a('0x24')](handleEntityNotFound(_0x1e5473,null))[_0xae8a('0x24')](removeEntity(_0x1e5473,null))['catch'](handleError(_0x1e5473,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 0a1b7ee..305b501 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 _0x0637=['path','./smsApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2ca2d0,_0x3ea8e4){var _0x521c23=function(_0x5b0731){while(--_0x5b0731){_0x2ca2d0['push'](_0x2ca2d0['shift']());}};_0x521c23(++_0x3ea8e4);}(_0x0637,0x7e));var _0x7063=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0637[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7063('0x0'));var util=require('util');var logger=require(_0x7063('0x1'))(_0x7063('0x2'));var moment=require(_0x7063('0x3'));var BPromise=require(_0x7063('0x4'));var rp=require(_0x7063('0x5'));var fs=require('fs');var path=require(_0x7063('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7063('0x7'));module[_0x7063('0x8')]=function(_0x4b8552,_0x11e9f){return _0x4b8552[_0x7063('0x9')]('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7063('0xa'),'collate':_0x7063('0xb')});}; \ No newline at end of file +var _0x2b17=['define','SmsApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','path','rimraf','./smsApplication.attributes'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x2b17,0xca));var _0x72b1=function(_0x3b1566,_0x4d8134){_0x3b1566=_0x3b1566-0x0;var _0x393111=_0x2b17[_0x3b1566];return _0x393111;};'use strict';var _=require(_0x72b1('0x0'));var util=require(_0x72b1('0x1'));var logger=require(_0x72b1('0x2'))(_0x72b1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x72b1('0x4'));var rimraf=require(_0x72b1('0x5'));var config=require('../../config/environment');var attributes=require(_0x72b1('0x6'));module['exports']=function(_0xdaa09c,_0x57d005){return _0xdaa09c[_0x72b1('0x7')](_0x72b1('0x8'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x72b1('0x9'),'collate':_0x72b1('0xa')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 18cb4e7..6ca8e51 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 _0x6365=['rpc','jayson/promise','client','http','then','info','SmsApplication,\x20%s,\x20%s','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x26c4d3,_0x60bfe8){var _0x19d0b7=function(_0x2932f4){while(--_0x2932f4){_0x26c4d3['push'](_0x26c4d3['shift']());}};_0x19d0b7(++_0x60bfe8);}(_0x6365,0x148));var _0x5636=function(_0x4481aa,_0x22ec5b){_0x4481aa=_0x4481aa-0x0;var _0x58ab3b=_0x6365[_0x4481aa];return _0x58ab3b;};'use strict';var _=require(_0x5636('0x0'));var util=require(_0x5636('0x1'));var moment=require(_0x5636('0x2'));var BPromise=require(_0x5636('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5636('0x4'));var db=require(_0x5636('0x5'))['db'];var utils=require(_0x5636('0x6'));var logger=require(_0x5636('0x7'))(_0x5636('0x8'));var config=require('../../config/environment');var jayson=require(_0x5636('0x9'));var client=jayson[_0x5636('0xa')][_0x5636('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3575b7,_0x53d5b4,_0x17439f){return new BPromise(function(_0x10769f,_0x54eb5c){return client['request'](_0x3575b7,_0x17439f)[_0x5636('0xc')](function(_0x43e880){logger[_0x5636('0xd')](_0x5636('0xe'),_0x53d5b4,'request\x20sent');logger['debug'](_0x5636('0xf'),_0x53d5b4,'request\x20sent',JSON[_0x5636('0x10')](_0x43e880));if(_0x43e880[_0x5636('0x11')]){if(_0x43e880[_0x5636('0x11')][_0x5636('0x12')]===0x1f4){logger[_0x5636('0x11')](_0x5636('0xe'),_0x53d5b4,_0x43e880['error'][_0x5636('0x13')]);return _0x54eb5c(_0x43e880[_0x5636('0x11')]['message']);}logger[_0x5636('0x11')](_0x5636('0xe'),_0x53d5b4,_0x43e880['error']['message']);return _0x10769f(_0x43e880[_0x5636('0x11')][_0x5636('0x13')]);}else{logger[_0x5636('0xd')](_0x5636('0xe'),_0x53d5b4,_0x5636('0x14'));_0x10769f(_0x43e880['result'][_0x5636('0x13')]);}})['catch'](function(_0x55de40){logger[_0x5636('0x11')](_0x5636('0xe'),_0x53d5b4,_0x55de40);_0x54eb5c(_0x55de40);});});} \ No newline at end of file +var _0x3149=['stringify','error','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s'];(function(_0x96aabf,_0xf7ed45){var _0x30da72=function(_0x549bc7){while(--_0x549bc7){_0x96aabf['push'](_0x96aabf['shift']());}};_0x30da72(++_0xf7ed45);}(_0x3149,0x181));var _0x9314=function(_0x2cf761,_0x10be5b){_0x2cf761=_0x2cf761-0x0;var _0x5e54b1=_0x3149[_0x2cf761];return _0x5e54b1;};'use strict';var _=require(_0x9314('0x0'));var util=require('util');var moment=require(_0x9314('0x1'));var BPromise=require(_0x9314('0x2'));var rs=require(_0x9314('0x3'));var fs=require('fs');var Redis=require(_0x9314('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9314('0x5'));var logger=require(_0x9314('0x6'))(_0x9314('0x7'));var config=require(_0x9314('0x8'));var jayson=require(_0x9314('0x9'));var client=jayson['client'][_0x9314('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bb49e,_0x37d3f6,_0xf24d0c){return new BPromise(function(_0x341882,_0x51f785){return client[_0x9314('0xb')](_0x3bb49e,_0xf24d0c)['then'](function(_0x2d6cb8){logger['info'](_0x9314('0xc'),_0x37d3f6,_0x9314('0xd'));logger['debug'](_0x9314('0xe'),_0x37d3f6,'request\x20sent',JSON[_0x9314('0xf')](_0x2d6cb8));if(_0x2d6cb8[_0x9314('0x10')]){if(_0x2d6cb8[_0x9314('0x10')]['code']===0x1f4){logger[_0x9314('0x10')](_0x9314('0xc'),_0x37d3f6,_0x2d6cb8[_0x9314('0x10')][_0x9314('0x11')]);return _0x51f785(_0x2d6cb8[_0x9314('0x10')][_0x9314('0x11')]);}logger[_0x9314('0x10')]('SmsApplication,\x20%s,\x20%s',_0x37d3f6,_0x2d6cb8[_0x9314('0x10')][_0x9314('0x11')]);return _0x341882(_0x2d6cb8[_0x9314('0x10')]['message']);}else{logger[_0x9314('0x12')](_0x9314('0xc'),_0x37d3f6,_0x9314('0xd'));_0x341882(_0x2d6cb8['result'][_0x9314('0x11')]);}})[_0x9314('0x13')](function(_0x5b7e6a){logger[_0x9314('0x10')](_0x9314('0xc'),_0x37d3f6,_0x5b7e6a);_0x51f785(_0x5b7e6a);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 01a2c8d..28ecdd7 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 _0x5c00=['smsinteraction:addtags','addTags','/:id','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','sms'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x5c00,0x17e));var _0x05c0=function(_0x2cb984,_0x365f50){_0x2cb984=_0x2cb984-0x0;var _0x2f73e6=_0x5c00[_0x2cb984];return _0x2f73e6;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var fs_extra=require(_0x05c0('0x4'));var auth=require(_0x05c0('0x5'));var interaction=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var controller=require('./smsInteraction.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/describe',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xc')]);router[_0x05c0('0x8')](_0x05c0('0xd'),auth[_0x05c0('0x9')](),controller[_0x05c0('0xe')]);router['get']('/:id/download',auth[_0x05c0('0x9')](),controller['download']);router[_0x05c0('0xf')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0x10')]);router['post'](_0x05c0('0xd'),auth['isAuthenticated'](),controller[_0x05c0('0x11')]);router[_0x05c0('0xf')](_0x05c0('0x12'),auth[_0x05c0('0x9')](),interaction[_0x05c0('0x13')](_0x05c0('0x14'),_0x05c0('0x15')),controller[_0x05c0('0x16')]);router['put'](_0x05c0('0x17'),auth[_0x05c0('0x9')](),interaction[_0x05c0('0x13')](_0x05c0('0x14'),_0x05c0('0x18')),controller[_0x05c0('0x19')]);router[_0x05c0('0x1a')](_0x05c0('0x17'),auth[_0x05c0('0x9')](),interaction['tracked'](_0x05c0('0x14'),_0x05c0('0x1b')),controller[_0x05c0('0x1c')]);router['delete'](_0x05c0('0x12'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x1d')]);module[_0x05c0('0x1e')]=router; \ No newline at end of file +var _0x4483=['isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','sms','addTags','put','/:id','smsinteraction:update','update','delete','smsinteraction:destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4483,0x1a3));var _0x3448=function(_0x30dd66,_0xb8fa04){_0x30dd66=_0x30dd66-0x0;var _0x2d2dab=_0x4483[_0x30dd66];return _0x2d2dab;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var fs_extra=require(_0x3448('0x5'));var auth=require(_0x3448('0x6'));var interaction=require(_0x3448('0x7'));var config=require('../../config/environment');var controller=require(_0x3448('0x8'));router[_0x3448('0x9')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0x9')](_0x3448('0xc'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['get']('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);router[_0x3448('0x9')](_0x3448('0xf'),auth[_0x3448('0xa')](),controller[_0x3448('0x10')]);router[_0x3448('0x9')](_0x3448('0x11'),auth[_0x3448('0xa')](),controller[_0x3448('0x12')]);router[_0x3448('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3448('0x13')](_0x3448('0xf'),auth['isAuthenticated'](),controller[_0x3448('0x14')]);router[_0x3448('0x13')](_0x3448('0x15'),auth['isAuthenticated'](),interaction[_0x3448('0x16')](_0x3448('0x17'),'smsinteraction:addtags'),controller[_0x3448('0x18')]);router[_0x3448('0x19')](_0x3448('0x1a'),auth['isAuthenticated'](),interaction[_0x3448('0x16')](_0x3448('0x17'),_0x3448('0x1b')),controller[_0x3448('0x1c')]);router[_0x3448('0x1d')](_0x3448('0x1a'),auth[_0x3448('0xa')](),interaction[_0x3448('0x16')]('sms',_0x3448('0x1e')),controller['destroy']);router['delete']('/:id/tags',auth[_0x3448('0xa')](),controller[_0x3448('0x1f')]);module[_0x3448('0x20')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index e472ba9..57467c8 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 _0x522b=['DATE','ENUM','out','sequelize','moment','BOOLEAN','STRING'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x522b,0x1c3));var _0xb522=function(_0x29dda1,_0x508e13){_0x29dda1=_0x29dda1-0x0;var _0x21b0ef=_0x522b[_0x29dda1];return _0x21b0ef;};'use strict';var Sequelize=require(_0xb522('0x0'));var moment=require(_0xb522('0x1'));module['exports']={'closed':{'type':Sequelize[_0xb522('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xb522('0x3')]},'thirdDisposition':{'type':Sequelize[_0xb522('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xb522('0x3')]},'read1stAt':{'type':Sequelize[_0xb522('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xb522('0x5')]('in',_0xb522('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb522('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xb522('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb522('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xeea0=['out','sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x42c430,_0x5e5107){var _0x5245dc=function(_0x548acc){while(--_0x548acc){_0x42c430['push'](_0x42c430['shift']());}};_0x5245dc(++_0x5e5107);}(_0xeea0,0x91));var _0x0eea=function(_0x2305fa,_0x3bf1c6){_0x2305fa=_0x2305fa-0x0;var _0x885fe6=_0xeea0[_0x2305fa];return _0x885fe6;};'use strict';var Sequelize=require(_0x0eea('0x0'));var moment=require(_0x0eea('0x1'));module[_0x0eea('0x2')]={'closed':{'type':Sequelize[_0x0eea('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0eea('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0eea('0x5')]},'thirdDisposition':{'type':Sequelize[_0x0eea('0x5')]},'note':{'type':Sequelize[_0x0eea('0x5')]},'phone':{'type':Sequelize[_0x0eea('0x5')]},'read1stAt':{'type':Sequelize[_0x0eea('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x0eea('0x6')]('in',_0x0eea('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x0eea('0x6')]('in',_0x0eea('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0eea('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 85e1484..63970e9 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 _0xa870=['i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','i.SmsAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','SmsInteraction','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','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','show','params','includeAll','include','merge','options','describe','addMessage','SmsMessage','ids','getMessages','findOne','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','omit','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','push','CmContact','Contact','firstName','lastName','Messages','direction','secret','SmsAccount','Account','Owner','get','mkdirSync','Sms','fullname','N.A.','format','closedAt','disposition','out','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','eml-format','fast-json-patch','request-promise','moment','mustache','path','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','Users','map','TagIds','Tags','catch','waiting','total','UserId','closed','talking','answered','unmanaged','index','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','left_join','users','sms_interactions','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','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','text','start','Tag','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','body','some','compact','isEmpty','forEach','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','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)','order','contactName','DESC','t.id\x20IN\x20?','resolve'];(function(_0x48051b,_0x339115){var _0x2a4f6e=function(_0x5b7756){while(--_0x5b7756){_0x48051b['push'](_0x48051b['shift']());}};_0x2a4f6e(++_0x339115);}(_0xa870,0x143));var _0x0a87=function(_0x334ed6,_0x545790){_0x334ed6=_0x334ed6-0x0;var _0xf92d69=_0xa870[_0x334ed6];return _0xf92d69;};'use strict';var emlformat=require(_0x0a87('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0a87('0x1'));var rp=require(_0x0a87('0x2'));var moment=require(_0x0a87('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a87('0x4'));var util=require('util');var path=require(_0x0a87('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0a87('0x6'));var fs=require('fs');var fs_extra=require(_0x0a87('0x7'));var _=require(_0x0a87('0x8'));var squel=require(_0x0a87('0x9'));var crypto=require('crypto');var jsforce=require(_0x0a87('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x0a87('0xb'));var querystring=require(_0x0a87('0xc'));var Papa=require(_0x0a87('0xd'));var Redis=require(_0x0a87('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0a87('0xf'));var pdf=require(_0x0a87('0x10'));var hardwareService=require(_0x0a87('0x11'));var logger=require(_0x0a87('0x12'))(_0x0a87('0x13'));var utils=require(_0x0a87('0x14'));var config=require(_0x0a87('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a87('0x16'))['db'];config[_0x0a87('0x17')]=_[_0x0a87('0x18')](config[_0x0a87('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a87('0x19'))(new Redis(config[_0x0a87('0x17')]));require(_0x0a87('0x1a'))[_0x0a87('0x1b')](socket);function respondWithStatusCode(_0x464c96,_0x250005){_0x250005=_0x250005||0xcc;return function(_0x42e210){if(_0x42e210){return _0x464c96[_0x0a87('0x1c')](_0x250005);}return _0x464c96[_0x0a87('0x1d')](_0x250005)[_0x0a87('0x1e')]();};}function respondWithResult(_0xa705b4,_0x3d6f44){_0x3d6f44=_0x3d6f44||0xc8;return function(_0x4622c4){if(_0x4622c4){return _0xa705b4['status'](_0x3d6f44)[_0x0a87('0x1f')](_0x4622c4);}};}function respondWithFilteredResult(_0x275df2,_0x347d0c){return function(_0x209851){if(_0x209851){var _0x3ce4b1=typeof _0x347d0c['offset']==='undefined'&&typeof _0x347d0c[_0x0a87('0x20')]===_0x0a87('0x21');var _0x3ba608=_0x209851[_0x0a87('0x22')];var _0x393b4f=_0x3ce4b1?0x0:_0x347d0c[_0x0a87('0x23')];var _0x290bbc=_0x3ce4b1?_0x209851[_0x0a87('0x22')]:_0x347d0c['offset']+_0x347d0c[_0x0a87('0x20')];var _0x42a743;if(_0x290bbc>=_0x3ba608){_0x290bbc=_0x3ba608;_0x42a743=0xc8;}else{_0x42a743=0xce;}_0x275df2['status'](_0x42a743);return _0x275df2[_0x0a87('0x24')](_0x0a87('0x25'),_0x393b4f+'-'+_0x290bbc+'/'+_0x3ba608)[_0x0a87('0x1f')](_0x209851);}return null;};}function patchUpdates(_0x558abe){return function(_0x2103c9){try{jsonpatch[_0x0a87('0x26')](_0x2103c9,_0x558abe,!![]);}catch(_0x3c65f1){return BPromise[_0x0a87('0x27')](_0x3c65f1);}return _0x2103c9[_0x0a87('0x28')]();};}function saveUpdates(_0xfc4c7a,_0x1fa6c0){return function(_0x3e89b1){if(_0x3e89b1){return _0x3e89b1[_0x0a87('0x29')](_0xfc4c7a)['then'](function(_0x211929){return _0x211929;});}return null;};}function removeEntity(_0x54933a,_0x38f446){return function(_0x3189e1){if(_0x3189e1){return _0x3189e1[_0x0a87('0x2a')]()[_0x0a87('0x2b')](function(){_0x54933a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x318b07,_0x34478e){return function(_0x37fbab){if(!_0x37fbab){_0x318b07[_0x0a87('0x1c')](0x194);}return _0x37fbab;};}function handleError(_0x1c62c1,_0x4ff267){_0x4ff267=_0x4ff267||0x1f4;return function(_0x260e3b){logger['error'](_0x260e3b[_0x0a87('0x2c')]);if(_0x260e3b[_0x0a87('0x2d')]){delete _0x260e3b[_0x0a87('0x2d')];}_0x1c62c1[_0x0a87('0x1d')](_0x4ff267)[_0x0a87('0x2e')](_0x260e3b);};}function getInteractionUsers(_0x1513b1,_0x131a9c){return new BPromise(function(_0x1d1223,_0x2be468){try{if(_0x131a9c[_0x1513b1['id']]){_0x1513b1[_0x0a87('0x2f')]=_[_0x0a87('0x30')](_0x131a9c[_0x1513b1['id']],function(_0x316a5f){return{'id':_0x316a5f['id'],'fullname':_0x316a5f['fullname']};});}}catch(_0x28e641){_0x2be468(_0x28e641);}_0x1d1223(_0x1513b1);});}function getInteractionTags(_0x53352b,_0x2ad0c1){return new BPromise(function(_0x21b061,_0x286264){try{if(_0x53352b['TagIds']){_0x53352b['Tags']=[];_0x53352b[_0x0a87('0x31')]['split'](',')['forEach'](function(_0x58f63f){_0x53352b[_0x0a87('0x32')]['push'](_0x2ad0c1[_0x58f63f]);});}delete _0x53352b[_0x0a87('0x31')];}catch(_0x3dcb21){_0x286264(_0x3dcb21);}_0x21b061(_0x53352b);});}function updateSmsInteraction(_0x203423,_0x206bde,_0x2a22d1){return new BPromise(function(_0x4f087e,_0x2365cc){return getInteractionUsers(_0x203423,_0x2a22d1)['then'](function(_0xcb7f33){return getInteractionTags(_0xcb7f33,_0x206bde);})[_0x0a87('0x2b')](function(_0x3a953b){return getStateInteraction(_0x3a953b);})['then'](function(_0x76e6de){_0x4f087e(_0x76e6de);})[_0x0a87('0x33')](function(_0x4324ba){_0x2365cc(_0x4324ba);});});}function getStateInteraction(_0x273045){return new BPromise(function(_0x46d778){_0x273045[_0x0a87('0x34')]=0x0;_0x273045['talking']=0x0;_0x273045['answered']=0x0;_0x273045['unmanaged']=0x0;_0x273045[_0x0a87('0x35')]=0x0;if(!_0x273045['closed']&&!_0x273045[_0x0a87('0x36')]){_0x273045[_0x0a87('0x34')]+=0x1;}if(!_0x273045[_0x0a87('0x37')]&&_0x273045[_0x0a87('0x36')]){_0x273045[_0x0a87('0x38')]+=0x1;if(_0x273045[_0x0a87('0x34')]){_0x273045['waiting']-=0x1;}}if(_0x273045[_0x0a87('0x37')]&&_0x273045['UserId']){_0x273045[_0x0a87('0x39')]+=0x1;if(_0x273045[_0x0a87('0x38')]){_0x273045['talking']-=0x1;}}if(_0x273045[_0x0a87('0x37')]&&!_0x273045[_0x0a87('0x36')]){_0x273045[_0x0a87('0x3a')]+=0x1;if(_0x273045[_0x0a87('0x34')]){_0x273045[_0x0a87('0x34')]-=0x1;}}_0x273045[_0x0a87('0x35')]+=0x1;_0x46d778(_0x273045);});}exports[_0x0a87('0x3b')]=function(_0x10f455,_0xef5fee){var _0x28ae81={},_0x15808b={},_0x3b7621={'count':0x0,'rows':[]};var _0x37378c=_[_0x0a87('0x30')](db['SmsInteraction'][_0x0a87('0x3c')],function(_0x3f12fd){return{'name':_0x3f12fd[_0x0a87('0x3d')],'type':_0x3f12fd[_0x0a87('0x3e')][_0x0a87('0x3f')]};});_0x15808b[_0x0a87('0x40')]=_[_0x0a87('0x30')](_0x37378c,'name');_0x15808b[_0x0a87('0x41')]=_[_0x0a87('0x42')](_0x10f455[_0x0a87('0x41')]);_0x15808b[_0x0a87('0x43')]=_['intersection'](_0x15808b[_0x0a87('0x40')],_0x15808b[_0x0a87('0x41')]);_0x28ae81[_0x0a87('0x44')]=_[_0x0a87('0x45')](_0x15808b[_0x0a87('0x40')],qs[_0x0a87('0x46')](_0x10f455[_0x0a87('0x41')][_0x0a87('0x46')]));_0x28ae81[_0x0a87('0x44')]=_0x28ae81[_0x0a87('0x44')][_0x0a87('0x47')]?_0x28ae81[_0x0a87('0x44')]:_0x15808b[_0x0a87('0x40')];if(!_0x10f455[_0x0a87('0x41')]['hasOwnProperty'](_0x0a87('0x48'))){_0x28ae81[_0x0a87('0x20')]=qs['limit'](_0x10f455[_0x0a87('0x41')][_0x0a87('0x20')]);_0x28ae81['offset']=qs['offset'](_0x10f455[_0x0a87('0x41')][_0x0a87('0x23')]);}_0x28ae81['order']=qs[_0x0a87('0x49')](_0x10f455[_0x0a87('0x41')][_0x0a87('0x49')]);_0x28ae81['where']=qs['filters'](_[_0x0a87('0x4a')](_0x10f455[_0x0a87('0x41')],_0x15808b[_0x0a87('0x43')]),_0x37378c);var _0xfa5343=[];var _0x26822b=squel[_0x0a87('0x4b')]()[_0x0a87('0x4c')]('id')[_0x0a87('0x4c')](_0x0a87('0x2d'))[_0x0a87('0x4c')](_0x0a87('0x4d'))[_0x0a87('0x4e')](_0x0a87('0x4f'));var _0x4ec0f4=squel[_0x0a87('0x4b')]()[_0x0a87('0x4c')](_0x0a87('0x50'))[_0x0a87('0x4c')](_0x0a87('0x51'))[_0x0a87('0x4c')](_0x0a87('0x52'))['from']('user_has_sms_interactions','ui')[_0x0a87('0x53')](_0x0a87('0x54'),'u','u.id\x20=\x20ui.UserId');var _0x4878f2=squel[_0x0a87('0x4b')]()[_0x0a87('0x4e')](_0x0a87('0x55'),'i')['left_join']('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x0a87('0x54'),'o',_0x0a87('0x56'))[_0x0a87('0x53')](_0x0a87('0x57'),'a',_0x0a87('0x58'))[_0x0a87('0x53')]('sms_messages','me','me.SmsInteractionId\x20=\x20i.id')[_0x0a87('0x53')](_0x0a87('0x59'),'it',_0x0a87('0x5a'))['left_join']('tools_tags','t',_0x0a87('0x5b'));var _0x51dd38=squel['expr']();var _0x8346cf=[];var _0x4d942b=squel[_0x0a87('0x5c')]();var _0x1e263d;if(_0x10f455[_0x0a87('0x41')][_0x0a87('0x5d')]){_0x1e263d=as[_0x0a87('0x5e')](_0x10f455[_0x0a87('0x41')]['search']);var _0x4c840f=_0x1e263d[_0x0a87('0x5f')];for(var _0x4e937b=0x0;_0x4e937b<_0x1e263d[_0x0a87('0x60')][_0x0a87('0x47')];_0x4e937b++){var _0x5f4343=_0x1e263d[_0x0a87('0x60')][_0x4e937b];var _0x5c49ce='i';var _0x3d0463=_[_0x0a87('0x61')](_0x37378c,['name',_0x5f4343[_0x0a87('0x4c')]]);if(!_0x3d0463){switch(_0x5f4343[_0x0a87('0x4c')]){case _0x0a87('0x62'):if(_0x5f4343[_0x0a87('0x63')]==0x1){_0x4878f2[_0x0a87('0x64')]('`'+_0x5f4343[_0x0a87('0x4c')]+_0x0a87('0x65'));}else{_0x4878f2['having']('`'+_0x5f4343[_0x0a87('0x4c')]+_0x0a87('0x66'));}break;case'Contact':if(_0x5f4343[_0x0a87('0x67')]==='$substring'){if(_0x5f4343[_0x0a87('0x63')][_0x0a87('0x68')]('\x20')[_0x0a87('0x47')]>0x1){_0x51dd38[_0x4c840f](_0x0a87('0x69'),qs['getFullTextValue'](_0x5f4343[_0x0a87('0x63')]),null);}else{var _0x107a29='%'+_0x5f4343[_0x0a87('0x63')]+'%';_0x51dd38[_0x4c840f](_0x0a87('0x6a'),_0x107a29,_0x107a29,_0x107a29);}}else{_0x3d0463=_['find'](_0x37378c,[_0x0a87('0x2d'),_0x0a87('0x6b')]);_0x5f4343[_0x0a87('0x4c')]=_0x0a87('0x6b');_0x270f3a=as['buildExpression'](_0x5c49ce,_0x3d0463[_0x0a87('0x3e')],_0x5f4343);_0x51dd38[_0x4c840f](_0x270f3a[_0x0a87('0x6c')],_0x270f3a[_0x0a87('0x63')][_0x0a87('0x6d')],_0x270f3a['value']['end']);}break;case _0x0a87('0x6e'):var _0x4ceb6d=_0x5f4343[_0x0a87('0x63')][_0x0a87('0x68')](',')[_0x0a87('0x30')](function(_0xcbdaba){return Number(_0xcbdaba);});_0x4ceb6d['forEach'](function(_0x22f27d){_0x4d942b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x22f27d+',%');});_0x8346cf=_['union'](_0x8346cf,_0x4ceb6d);break;case _0x0a87('0x6f'):if(_0x5f4343[_0x0a87('0x67')]===_0x0a87('0x70')){_0x51dd38[_0x4c840f](_0x0a87('0x71'),'%'+_0x5f4343[_0x0a87('0x63')]+'%',null);}else{_0x3d0463=_[_0x0a87('0x61')](_0x37378c,[_0x0a87('0x2d'),_0x0a87('0x36')]);_0x5f4343[_0x0a87('0x4c')]='UserId';_0x270f3a=as[_0x0a87('0x72')](_0x5c49ce,_0x3d0463[_0x0a87('0x3e')],_0x5f4343);_0x51dd38[_0x4c840f](_0x270f3a[_0x0a87('0x6c')],_0x270f3a[_0x0a87('0x63')][_0x0a87('0x6d')],_0x270f3a[_0x0a87('0x63')]['end']);}break;case _0x0a87('0x73'):_0x270f3a=as[_0x0a87('0x72')]('me',null,_0x5f4343);_0x51dd38[_0x4c840f](_0x270f3a[_0x0a87('0x6c')],_0x270f3a['value'][_0x0a87('0x6d')],_0x270f3a[_0x0a87('0x63')][_0x0a87('0x1e')]);break;}}else{var _0x270f3a=as[_0x0a87('0x72')](_0x5c49ce,_0x3d0463['type'],_0x5f4343);_0x51dd38[_0x4c840f](_0x270f3a[_0x0a87('0x6c')],_0x270f3a[_0x0a87('0x63')][_0x0a87('0x6d')],_0x270f3a[_0x0a87('0x63')][_0x0a87('0x1e')]);}}}else{var _0x296a3e=_(_0x10f455[_0x0a87('0x41')])[_0x0a87('0x42')]()[_0x0a87('0x30')](function(_0x16162b){return _[_0x0a87('0x74')](_0x37378c,[_0x0a87('0x2d'),_0x16162b])?_0x16162b:undefined;})[_0x0a87('0x75')]()[_0x0a87('0x63')]();if(!_[_0x0a87('0x76')](_0x296a3e)){_0x296a3e[_0x0a87('0x77')](function(_0x35d620){if(_0x35d620===_0x0a87('0x78')){_0x4878f2[_0x0a87('0x79')](_0x0a87('0x7a'),[][_0x0a87('0x7b')](_0x10f455[_0x0a87('0x41')][_0x35d620]));}else if(_0x35d620===_0x0a87('0x7c')){var _0x5a0457=JSON[_0x0a87('0x7d')](_0x10f455[_0x0a87('0x41')][_0x35d620])[_0x0a87('0x7e')];var _0x116432=JSON[_0x0a87('0x7d')](_0x10f455['query'][_0x35d620])[_0x0a87('0x7f')];_0x4878f2[_0x0a87('0x79')](_0x0a87('0x80'),_0x5a0457,_0x116432);}else{if(_0x10f455[_0x0a87('0x41')][_0x35d620]==='null'){_0x4878f2[_0x0a87('0x79')]('i.'+_0x35d620+_0x0a87('0x81'));}else{_0x4878f2[_0x0a87('0x79')]('i.'+_0x35d620+_0x0a87('0x82'),_0x10f455[_0x0a87('0x41')][_0x35d620]);}}});}if(_0x10f455[_0x0a87('0x41')][_0x0a87('0x83')]){if(_0x10f455[_0x0a87('0x41')][_0x0a87('0x83')]==0x1){_0x4878f2[_0x0a87('0x64')](_0x0a87('0x84'));}else{_0x4878f2[_0x0a87('0x64')](_0x0a87('0x85'));}}if(_0x10f455['query'][_0x0a87('0x86')]){_0x8346cf=_[_0x0a87('0x87')](_0x10f455['query'][_0x0a87('0x86')])?_0x10f455[_0x0a87('0x41')][_0x0a87('0x86')]:new Array(_0x10f455[_0x0a87('0x41')][_0x0a87('0x86')]);_0x8346cf[_0x0a87('0x77')](function(_0x25adc5){_0x4d942b['or'](_0x0a87('0x88'),'%,'+_0x25adc5+',%');});}if(_0x10f455[_0x0a87('0x41')][_0x0a87('0x89')]){var _0xd7c4b0=_0x10f455[_0x0a87('0x41')][_0x0a87('0x89')]['replace']('\x5c','\x5c\x5c')[_0x0a87('0x8a')](/'/g,'\x27\x27');if(qs['isNumeric'](_0xd7c4b0)){_0x51dd38['or'](_0x0a87('0x8b'),_0xd7c4b0+'%')['or'](_0x0a87('0x8c'),_0xd7c4b0+'%');}else{_0x51dd38['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a87('0x8d')](_0xd7c4b0))['or'](_0x0a87('0x8e'),_0xd7c4b0+'%');}}}_0x4878f2[_0x0a87('0x79')](_0x51dd38);_0x4878f2[_0x0a87('0x8f')](_0x0a87('0x90'));var _0x3aa7eb={'type':db[_0x0a87('0x91')][_0x0a87('0x92')][_0x0a87('0x93')],'raw':!![]};var _0x4fe163=_0x4878f2[_0x0a87('0x94')]();_0x4fe163[_0x0a87('0x4c')](_0x0a87('0x90'));_0x4fe163[_0x0a87('0x4c')](_0x0a87('0x95'),_0x0a87('0x62'));if(_0x28ae81[_0x0a87('0x96')]){_0x28ae81[_0x0a87('0x96')][_0x0a87('0x77')](function(_0x492dd8){var _0x2f613f=_0x492dd8[0x0]===_0x0a87('0x97')?_0x492dd8[0x0]:'i.'+_0x492dd8[0x0];_0x4878f2['order'](_0x2f613f,_0x492dd8[0x1]===_0x0a87('0x98')?![]:!![]);});}if(!_['isEmpty'](_0x8346cf)){_0x4878f2[_0x0a87('0x64')](_0x4d942b);_0x4fe163[_0x0a87('0x79')](_0x0a87('0x99'),_0x8346cf);}BPromise[_0x0a87('0x9a')]()[_0x0a87('0x2b')](function(){if(!_0x1e263d){if(_0x10f455[_0x0a87('0x41')][_0x0a87('0x78')])return;_0x4fe163['where'](_0x0a87('0x9b'));_0x4878f2['where'](_0x0a87('0x9b'));return;}if(_0x10f455[_0x0a87('0x9c')][_0x0a87('0x9d')]!=='agent')return;return _0x10f455[_0x0a87('0x9c')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x1db961){if(_[_0x0a87('0x76')](_0x1db961)){_0x4fe163[_0x0a87('0x79')](_0x0a87('0x9e'));_0x4878f2['where'](_0x0a87('0x9e'));}else{_0x4fe163['where']('i.SmsAccountId\x20IN\x20?',_[_0x0a87('0x30')](_0x1db961,'id'));_0x4878f2[_0x0a87('0x79')](_0x0a87('0x7a'),_[_0x0a87('0x30')](_0x1db961,'id'));}});})['then'](function(){if(_0x10f455[_0x0a87('0x9c')][_0x0a87('0x9d')]===_0x0a87('0x9f')&&!_0x1e263d&&!_0x10f455[_0x0a87('0x41')]['SmsAccountId'])return[];return db['sequelize'][_0x0a87('0x41')](_0x4fe163[_0x0a87('0xa0')](),_0x3aa7eb);})[_0x0a87('0x2b')](function(_0x4c05f0){_0x3b7621[_0x0a87('0x22')]=_0x4c05f0[_0x0a87('0x47')];if(_0x3b7621[_0x0a87('0x22')]===0x0)return[];return db[_0x0a87('0xa1')]['query'](_0x26822b['toString'](),_0x3aa7eb)['then'](function(_0x8dd880){_0xfa5343=_[_0x0a87('0xa2')](_0x8dd880,'id');_0x3aa7eb=_['merge'](_0x3aa7eb,{'model':db[_0x0a87('0xa3')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x10f455[_0x0a87('0x41')]['fields']){_0x28ae81[_0x0a87('0x44')][_0x0a87('0x77')](function(_0x18624d){_0x4878f2[_0x0a87('0x4c')]('i.'+_0x18624d);});}else{_0x4878f2[_0x0a87('0x4c')](_0x0a87('0x95'),'unreadMessages');_0x4878f2[_0x0a87('0x4c')](_0x0a87('0xa4'),_0x0a87('0xa5'));_0x4878f2['field'](_0x0a87('0xa6'),'Account.mandatoryDisposition');_0x4878f2[_0x0a87('0x4c')](_0x0a87('0xa7'),_0x0a87('0x97'));_0x4878f2[_0x0a87('0x4c')]('i.*');_0x4878f2[_0x0a87('0x4c')]('c.firstName',_0x0a87('0xa8'));_0x4878f2[_0x0a87('0x4c')]('c.lastName',_0x0a87('0xa9'));_0x4878f2[_0x0a87('0x4c')](_0x0a87('0xaa'),_0x0a87('0xab'));_0x4878f2[_0x0a87('0x4c')](_0x0a87('0xac'),_0x0a87('0xad'));_0x4878f2[_0x0a87('0x4c')]('c.mobile',_0x0a87('0xae'));_0x4878f2['field'](_0x0a87('0xaf'),_0x0a87('0xb0'));_0x4878f2[_0x0a87('0x4c')](_0x0a87('0xb1'),'Owner.fullname');_0x4878f2[_0x0a87('0x4c')](_0x0a87('0xb2'),_0x0a87('0xb3'));_0x4878f2['field'](_0x0a87('0xb4'),_0x0a87('0x31'));}if(_0x28ae81[_0x0a87('0x20')])_0x4878f2[_0x0a87('0x20')](_0x28ae81[_0x0a87('0x20')]);if(_0x28ae81['offset'])_0x4878f2[_0x0a87('0x23')](_0x28ae81[_0x0a87('0x23')]);return db[_0x0a87('0xa1')][_0x0a87('0x41')](_0x4878f2[_0x0a87('0xa0')](),_0x3aa7eb);})[_0x0a87('0x2b')](function(_0x48046c){if(_0x48046c[_0x0a87('0x47')]>0x0)_0x4ec0f4[_0x0a87('0x79')](_0x0a87('0xb5'),_['map'](_0x48046c,'id'));return db[_0x0a87('0xa1')][_0x0a87('0x41')](_0x4ec0f4[_0x0a87('0xa0')](),_0x3aa7eb)['then'](function(_0x2599ff){var _0x5162e4=_[_0x0a87('0xb6')](_0x2599ff,_0x0a87('0xb7'));var _0x2aac18=[];_0x48046c['forEach'](function(_0x4aaa5d){_0x2aac18['push'](updateSmsInteraction(_0x4aaa5d,_0xfa5343,_0x5162e4));});return BPromise[_0x0a87('0xb8')](_0x2aac18);});});})['then'](function(_0x4a982a){_0x3b7621['rows']=_0x4a982a;return _0x3b7621;})[_0x0a87('0x2b')](respondWithFilteredResult(_0xef5fee,_0x28ae81))[_0x0a87('0x33')](handleError(_0xef5fee,null));};exports[_0x0a87('0xb9')]=function(_0x52e9b8,_0x2078bd){var _0x5c92d1={'raw':![],'where':{'id':_0x52e9b8[_0x0a87('0xba')]['id']}},_0x1c7150={};_0x1c7150[_0x0a87('0x40')]=_[_0x0a87('0x42')](db[_0x0a87('0xa3')]['rawAttributes']);_0x1c7150[_0x0a87('0x41')]=_['keys'](_0x52e9b8[_0x0a87('0x41')]);_0x1c7150['filters']=_[_0x0a87('0x45')](_0x1c7150[_0x0a87('0x40')],_0x1c7150[_0x0a87('0x41')]);_0x5c92d1['attributes']=_[_0x0a87('0x45')](_0x1c7150[_0x0a87('0x40')],qs[_0x0a87('0x46')](_0x52e9b8['query'][_0x0a87('0x46')]));_0x5c92d1[_0x0a87('0x44')]=_0x5c92d1[_0x0a87('0x44')]['length']?_0x5c92d1[_0x0a87('0x44')]:_0x1c7150[_0x0a87('0x40')];if(_0x52e9b8[_0x0a87('0x41')][_0x0a87('0xbb')]){_0x5c92d1[_0x0a87('0xbc')]=[{'all':!![]}];}_0x5c92d1=_[_0x0a87('0xbd')]({},_0x5c92d1,_0x52e9b8[_0x0a87('0xbe')]);return db[_0x0a87('0xa3')]['find'](_0x5c92d1)['then'](handleEntityNotFound(_0x2078bd,null))[_0x0a87('0x2b')](respondWithResult(_0x2078bd,null))[_0x0a87('0x33')](handleError(_0x2078bd,null));};exports['create']=function(_0x439856,_0x4b4131){return db[_0x0a87('0xa3')]['create'](_0x439856['body'],{})['then'](respondWithResult(_0x4b4131,0xc9))['catch'](handleError(_0x4b4131,null));};exports[_0x0a87('0x29')]=function(_0x8c7317,_0x3f8808){if(_0x8c7317[_0x0a87('0x73')]['id']){delete _0x8c7317[_0x0a87('0x73')]['id'];}return db[_0x0a87('0xa3')]['find']({'where':{'id':_0x8c7317[_0x0a87('0xba')]['id']}})[_0x0a87('0x2b')](handleEntityNotFound(_0x3f8808,null))['then'](saveUpdates(_0x8c7317['body'],null))['then'](respondWithResult(_0x3f8808,null))['catch'](handleError(_0x3f8808,null));};exports['destroy']=function(_0x2a4d58,_0x5c07d8){return db[_0x0a87('0xa3')][_0x0a87('0x61')]({'where':{'id':_0x2a4d58[_0x0a87('0xba')]['id']}})[_0x0a87('0x2b')](handleEntityNotFound(_0x5c07d8,null))[_0x0a87('0x2b')](removeEntity(_0x5c07d8,null))['catch'](handleError(_0x5c07d8,null));};exports[_0x0a87('0xbf')]=function(_0x12ebb8,_0x4f7e7d){return db[_0x0a87('0xa3')][_0x0a87('0xbf')]()[_0x0a87('0x2b')](respondWithResult(_0x4f7e7d,null))['catch'](handleError(_0x4f7e7d,null));};exports[_0x0a87('0xc0')]=function(_0x12e62d,_0x1f6052,_0x3d0723){return db[_0x0a87('0xc1')][_0x0a87('0x61')]({'where':{'id':_0x12e62d['params']['id']}})['then'](handleEntityNotFound(_0x1f6052,null))[_0x0a87('0x2b')](function(_0xe2931a){if(_0xe2931a){return _0xe2931a[_0x0a87('0xc0')](_0x12e62d[_0x0a87('0x73')][_0x0a87('0xc2')],_['omit'](_0x12e62d['body'],[_0x0a87('0xc2'),'id'])||{});}})[_0x0a87('0x2b')](respondWithResult(_0x1f6052,null))[_0x0a87('0x33')](handleError(_0x1f6052,null));};exports[_0x0a87('0xc3')]=function(_0x345bc3,_0x4621ec,_0x49a702){var _0x3865d2={'raw':![],'where':{}};var _0x2d4303={};var _0xa72431={'count':0x0,'rows':[]};return db[_0x0a87('0xa3')][_0x0a87('0xc4')]({'where':{'id':_0x345bc3[_0x0a87('0xba')]['id']}})[_0x0a87('0x2b')](handleEntityNotFound(_0x4621ec,null))[_0x0a87('0x2b')](function(_0x5527b7){if(_0x5527b7){_0x2d4303[_0x0a87('0x40')]=_['keys'](db[_0x0a87('0xc1')][_0x0a87('0x3c')]);_0x2d4303['query']=_[_0x0a87('0x42')](_0x345bc3['query']);_0x2d4303[_0x0a87('0x43')]=_[_0x0a87('0x45')](_0x2d4303[_0x0a87('0x40')],_0x2d4303[_0x0a87('0x41')]);_0x3865d2[_0x0a87('0x44')]=_[_0x0a87('0x45')](_0x2d4303[_0x0a87('0x40')],qs[_0x0a87('0x46')](_0x345bc3[_0x0a87('0x41')][_0x0a87('0x46')]));_0x3865d2['attributes']=_0x3865d2[_0x0a87('0x44')][_0x0a87('0x47')]?_0x3865d2[_0x0a87('0x44')]:_0x2d4303[_0x0a87('0x40')];if(!_0x345bc3[_0x0a87('0x41')][_0x0a87('0xc5')](_0x0a87('0x48'))){_0x3865d2[_0x0a87('0x20')]=qs['limit'](_0x345bc3[_0x0a87('0x41')][_0x0a87('0x20')]);_0x3865d2['offset']=qs[_0x0a87('0x23')](_0x345bc3[_0x0a87('0x41')][_0x0a87('0x23')]);}_0x3865d2[_0x0a87('0x96')]=qs[_0x0a87('0x49')](_0x345bc3['query'][_0x0a87('0x49')]);_0x3865d2['where']=qs['filters'](_[_0x0a87('0x4a')](_0x345bc3['query'],_0x2d4303['filters']));_0x3865d2[_0x0a87('0x79')]['SmsInteractionId']=_0x5527b7['id'];if(_0x345bc3['query']['filter']){_0x3865d2[_0x0a87('0x79')]=_[_0x0a87('0xbd')](_0x3865d2[_0x0a87('0x79')],{'$or':_[_0x0a87('0x30')](_0x3865d2[_0x0a87('0x44')],function(_0x3782ed){var _0x458ff6={};_0x458ff6[_0x3782ed]={'$like':'%'+_0x345bc3['query'][_0x0a87('0x89')]+'%'};return _0x458ff6;})});}if(_0x345bc3[_0x0a87('0x41')][_0x0a87('0x7e')]){var _0x4dca56=_0x345bc3[_0x0a87('0x41')][_0x0a87('0x7e')][_0x0a87('0x68')](',');var _0x5a0496={};_0x5a0496[_0x4dca56[0x0]]={'$gte':moment(_0x4dca56[0x1])['format'](_0x0a87('0xc6'))};_0x3865d2[_0x0a87('0x79')]=_[_0x0a87('0xbd')](_0x3865d2['where'],_0x5a0496);}_0x3865d2=_[_0x0a87('0xbd')]({},_0x3865d2,_0x345bc3[_0x0a87('0xbe')]);return db[_0x0a87('0xc1')]['count']({'where':_0x3865d2[_0x0a87('0x79')]})[_0x0a87('0x2b')](function(_0x4c1775){_0xa72431[_0x0a87('0x22')]=_0x4c1775;if(_0x345bc3[_0x0a87('0x41')]['includeAll']){_0x3865d2[_0x0a87('0xbc')]=[{'all':!![]}];}return db['SmsMessage'][_0x0a87('0xc7')](_0x3865d2);})[_0x0a87('0x2b')](function(_0x4935ef){_0xa72431[_0x0a87('0xc8')]=_0x4935ef;return _0xa72431;});}})['then'](respondWithFilteredResult(_0x4621ec,_0x3865d2))[_0x0a87('0x33')](handleError(_0x4621ec,null));};exports['addTags']=function(_0x1f6bda,_0x565757,_0x3d0699){return db['SmsInteraction'][_0x0a87('0x61')]({'where':{'id':_0x1f6bda['params']['id']}})['then'](handleEntityNotFound(_0x565757,null))[_0x0a87('0x2b')](function(_0x2b8480){if(_0x2b8480){return _0x2b8480['setTags'](_0x1f6bda['body'][_0x0a87('0xc2')],_[_0x0a87('0xc9')](_0x1f6bda[_0x0a87('0x73')],[_0x0a87('0xc2'),'id'])||{})[_0x0a87('0xca')](function(){return db[_0x0a87('0x6e')]['findAll']({'attributes':['id',_0x0a87('0x2d'),_0x0a87('0x4d')],'where':{'id':_0x1f6bda[_0x0a87('0x73')][_0x0a87('0xc2')]}});})[_0x0a87('0x2b')](function(_0x3677e6){socket[_0x0a87('0xcb')](_0x0a87('0xcc'),{'id':Number(_0x1f6bda[_0x0a87('0xba')]['id']),'tags':_0x3677e6||[]});return{'id':Number(_0x1f6bda['params']['id']),'tags':_0x3677e6||[]};});}})[_0x0a87('0x2b')](respondWithResult(_0x565757,null))[_0x0a87('0x33')](handleError(_0x565757,null));};exports[_0x0a87('0xcd')]=function(_0x40a1fc,_0x359e4b,_0x58df96){return db[_0x0a87('0xa3')]['find']({'where':{'id':_0x40a1fc[_0x0a87('0xba')]['id']}})['then'](handleEntityNotFound(_0x359e4b,null))['then'](function(_0x56d59f){if(_0x56d59f){return _0x56d59f[_0x0a87('0xcd')](_0x40a1fc[_0x0a87('0x41')]['ids']);}})[_0x0a87('0x2b')](respondWithStatusCode(_0x359e4b,null))[_0x0a87('0x33')](handleError(_0x359e4b,null));};exports[_0x0a87('0xce')]=function(_0xc190cd,_0x4550f2){var _0x40333e=moment()[_0x0a87('0xcf')]()[_0x0a87('0xa0')]();var _0x30addb=path[_0x0a87('0xd0')](config[_0x0a87('0xd1')],_0x0a87('0xd2'),'files','tmp');var _0x4dc7a6=path[_0x0a87('0xd0')](config[_0x0a87('0xd1')],_0x0a87('0xd2'),_0x0a87('0xd3'),_0x0a87('0xd4'));var _0x1d7294=path[_0x0a87('0xd0')](_0x30addb,_0x40333e);var _0x2e67a0=util['format'](_0x0a87('0xd5'),_0xc190cd[_0x0a87('0xba')]['id'],_0x40333e);var _0x547cb5=path[_0x0a87('0xd0')](_0x30addb,_0x2e67a0);var _0x146def=[];_0x146def[_0x0a87('0xd6')]({'model':db['User'],'as':_0x0a87('0x6f'),'attributes':['id','fullname'],'raw':!![]});_0x146def[_0x0a87('0xd6')]({'model':db[_0x0a87('0xd7')],'as':_0x0a87('0xd8'),'attributes':['id',_0x0a87('0xd9'),_0x0a87('0xda')],'raw':!![]});var _0x3235df=[{'model':db[_0x0a87('0xc1')],'as':_0x0a87('0xdb'),'attributes':['id',_0x0a87('0x73'),_0x0a87('0x7c'),_0x0a87('0xdc'),_0x0a87('0xdd'),_0x0a87('0x83')],'include':_0x146def}];_0x3235df[_0x0a87('0xd6')]({'model':db[_0x0a87('0xde')],'as':_0x0a87('0xdf'),'attributes':['id','name']});_0x3235df[_0x0a87('0xd6')]({'model':db['User'],'as':_0x0a87('0xe0'),'attributes':['id','fullname']});return db['SmsInteraction'][_0x0a87('0x61')]({'where':{'id':_0xc190cd[_0x0a87('0xba')]['id']},'include':_0x3235df})[_0x0a87('0x2b')](handleEntityNotFound(_0x4550f2,null))[_0x0a87('0x2b')](function(_0x506d6e){if(_0x506d6e){var _0x3209e2=_0x506d6e[_0x0a87('0xe1')]({'plain':!![]});fs[_0x0a87('0xe2')](_0x1d7294);var _0x418c9e={'channel':_0x0a87('0xe3'),'account':_0x3209e2['Account'][_0x0a87('0x2d')],'agent':_0x3209e2[_0x0a87('0xe0')]?_0x3209e2[_0x0a87('0xe0')][_0x0a87('0xe4')]:_0x0a87('0xe5'),'createdAt':moment(_0x3209e2['createdAt'])[_0x0a87('0xe6')](_0x0a87('0xc6'))[_0x0a87('0xa0')](),'closedAt':_0x3209e2[_0x0a87('0x37')]?moment(_0x3209e2[_0x0a87('0xe7')])[_0x0a87('0xe6')](_0x0a87('0xc6'))['toString']():'','disposition':_0x3209e2[_0x0a87('0xe8')],'messages':_(_0x3209e2['Messages'])[_0x0a87('0x89')]({'secret':![]})[_0x0a87('0x30')](function(_0x493c19){return{'date':moment(_0x493c19[_0x0a87('0x7c')])['format'](_0x0a87('0xc6'))[_0x0a87('0xa0')](),'sender':_0x493c19['direction']==='out'?_0x493c19[_0x0a87('0x6f')]?_0x493c19[_0x0a87('0x6f')][_0x0a87('0xe4')]:'System':_0x493c19[_0x0a87('0xd8')][_0x0a87('0xd9')]+(_0x493c19[_0x0a87('0xd8')][_0x0a87('0xda')]?'\x20'+_0x493c19[_0x0a87('0xd8')][_0x0a87('0xda')]:''),'body':_0x493c19[_0x0a87('0x73')],'direction':_0x493c19[_0x0a87('0xdc')]===_0x0a87('0xe9')?'A':'C','secret':_0x493c19[_0x0a87('0xdd')],'read':_0x493c19[_0x0a87('0x83')]};})[_0x0a87('0x63')]()};return ejs['renderFile'](path[_0x0a87('0xd0')](config['root'],_0x0a87('0xd2'),'views',_0x0a87('0xea')),{'interaction':_0x418c9e})[_0x0a87('0x2b')](function(_0x32ec1d){var _0x2994a5=path[_0x0a87('0xd0')](_0x1d7294,_0x0a87('0xeb')+_0x3209e2['id']+'-'+_0x40333e+_0x0a87('0xec'));var _0x4f418f={'path':_0x2994a5,'channel':_0x0a87('0xe3'),'interactionId':_0x3209e2['id']};return pdf[_0x0a87('0xed')](_0x32ec1d,_0x4f418f);})[_0x0a87('0x2b')](function(){return new BPromise(function(_0xbd6fc7,_0x263873){zipdir(_0x1d7294,{'saveTo':_0x547cb5},function(_0x26857,_0x1dcd31){if(_0x26857)return _0x263873(_0x26857);return _0xbd6fc7(_0x1dcd31);});})['then'](function(){return new BPromise(function(_0x3f75dd,_0x1838b3){rimraf(_0x1d7294,function(_0x2e9969){if(_0x2e9969)_0x1838b3(_0x2e9969);return _0x3f75dd();});});})[_0x0a87('0x2b')](function(){return _0x4550f2[_0x0a87('0xce')](_0x547cb5,_0x2e67a0,function(_0x24c374){if(_0x24c374){console[_0x0a87('0xee')]('err',_0x24c374);}else{fs['unlinkSync'](_0x547cb5);}});});});}else{return _0x4550f2[_0x0a87('0x1c')](0xc8);}})['catch'](handleError(_0x4550f2,null));}; \ No newline at end of file +var _0xb6f5=['buildExpression','body','text','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','agent','i.SmsAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','SmsInteraction','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.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','includeAll','include','options','create','params','describe','addMessage','SmsMessage','ids','findOne','rawAttributes','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','spread','emit','removeTags','download','unix','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','fullname','firstName','Messages','createdAt','direction','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','closedAt','out','System','lastName','renderFile','downloadInteraction.ejs','transcript-','.pdf','log','unlinkSync','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','defaults','localhost','redis','./smsInteraction.socket','register','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','Users','map','TagIds','Tags','split','push','catch','waiting','talking','answered','unmanaged','total','UserId','closed','index','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.id\x20=\x20ui.UserId','sms_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','sms_accounts','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','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','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?'];(function(_0x8a89aa,_0x39e45a){var _0x5c2819=function(_0xba7c1b){while(--_0xba7c1b){_0x8a89aa['push'](_0x8a89aa['shift']());}};_0x5c2819(++_0x39e45a);}(_0xb6f5,0x160));var _0x5b6f=function(_0x4b03c9,_0x17ce03){_0x4b03c9=_0x4b03c9-0x0;var _0x161ba2=_0xb6f5[_0x4b03c9];return _0x161ba2;};'use strict';var emlformat=require(_0x5b6f('0x0'));var rimraf=require(_0x5b6f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5b6f('0x2'));var moment=require(_0x5b6f('0x3'));var BPromise=require(_0x5b6f('0x4'));var Mustache=require(_0x5b6f('0x5'));var util=require(_0x5b6f('0x6'));var path=require(_0x5b6f('0x7'));var sox=require('sox');var csv=require(_0x5b6f('0x8'));var ejs=require(_0x5b6f('0x9'));var fs=require('fs');var fs_extra=require(_0x5b6f('0xa'));var _=require(_0x5b6f('0xb'));var squel=require(_0x5b6f('0xc'));var crypto=require(_0x5b6f('0xd'));var jsforce=require(_0x5b6f('0xe'));var deskjs=require(_0x5b6f('0xf'));var toCsv=require(_0x5b6f('0x8'));var querystring=require(_0x5b6f('0x10'));var Papa=require(_0x5b6f('0x11'));var Redis=require(_0x5b6f('0x12'));var authService=require(_0x5b6f('0x13'));var qs=require(_0x5b6f('0x14'));var as=require(_0x5b6f('0x15'));var pdf=require(_0x5b6f('0x16'));var hardwareService=require(_0x5b6f('0x17'));var logger=require(_0x5b6f('0x18'))('api');var utils=require(_0x5b6f('0x19'));var config=require(_0x5b6f('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x5b6f('0x1b')](config['redis'],{'host':_0x5b6f('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5b6f('0x1d')]));require(_0x5b6f('0x1e'))[_0x5b6f('0x1f')](socket);function respondWithStatusCode(_0xf11ec9,_0x321f3c){_0x321f3c=_0x321f3c||0xcc;return function(_0x28bef6){if(_0x28bef6){return _0xf11ec9[_0x5b6f('0x20')](_0x321f3c);}return _0xf11ec9[_0x5b6f('0x21')](_0x321f3c)[_0x5b6f('0x22')]();};}function respondWithResult(_0xf3fd95,_0x118de3){_0x118de3=_0x118de3||0xc8;return function(_0x5e6e71){if(_0x5e6e71){return _0xf3fd95[_0x5b6f('0x21')](_0x118de3)['json'](_0x5e6e71);}};}function respondWithFilteredResult(_0x1a6cde,_0x419178){return function(_0x4294f3){if(_0x4294f3){var _0x883404=typeof _0x419178['offset']==='undefined'&&typeof _0x419178[_0x5b6f('0x23')]===_0x5b6f('0x24');var _0x42b3a5=_0x4294f3[_0x5b6f('0x25')];var _0x761dd9=_0x883404?0x0:_0x419178[_0x5b6f('0x26')];var _0x26befd=_0x883404?_0x4294f3[_0x5b6f('0x25')]:_0x419178['offset']+_0x419178[_0x5b6f('0x23')];var _0x3cd5e2;if(_0x26befd>=_0x42b3a5){_0x26befd=_0x42b3a5;_0x3cd5e2=0xc8;}else{_0x3cd5e2=0xce;}_0x1a6cde[_0x5b6f('0x21')](_0x3cd5e2);return _0x1a6cde[_0x5b6f('0x27')](_0x5b6f('0x28'),_0x761dd9+'-'+_0x26befd+'/'+_0x42b3a5)[_0x5b6f('0x29')](_0x4294f3);}return null;};}function patchUpdates(_0x587fbe){return function(_0x425561){try{jsonpatch[_0x5b6f('0x2a')](_0x425561,_0x587fbe,!![]);}catch(_0x34ea6a){return BPromise[_0x5b6f('0x2b')](_0x34ea6a);}return _0x425561[_0x5b6f('0x2c')]();};}function saveUpdates(_0x28c264,_0x28e699){return function(_0x161f35){if(_0x161f35){return _0x161f35[_0x5b6f('0x2d')](_0x28c264)['then'](function(_0x58e7b9){return _0x58e7b9;});}return null;};}function removeEntity(_0x1c0a6b,_0x46a395){return function(_0x4e8b67){if(_0x4e8b67){return _0x4e8b67[_0x5b6f('0x2e')]()[_0x5b6f('0x2f')](function(){_0x1c0a6b[_0x5b6f('0x21')](0xcc)[_0x5b6f('0x22')]();});}};}function handleEntityNotFound(_0xa75606,_0x1ec668){return function(_0x5e4ef2){if(!_0x5e4ef2){_0xa75606[_0x5b6f('0x20')](0x194);}return _0x5e4ef2;};}function handleError(_0x259c9a,_0x24f32a){_0x24f32a=_0x24f32a||0x1f4;return function(_0x418e52){logger[_0x5b6f('0x30')](_0x418e52[_0x5b6f('0x31')]);if(_0x418e52[_0x5b6f('0x32')]){delete _0x418e52[_0x5b6f('0x32')];}_0x259c9a[_0x5b6f('0x21')](_0x24f32a)[_0x5b6f('0x33')](_0x418e52);};}function getInteractionUsers(_0x2a4b91,_0x34e296){return new BPromise(function(_0x3cf017,_0xce6f56){try{if(_0x34e296[_0x2a4b91['id']]){_0x2a4b91[_0x5b6f('0x34')]=_[_0x5b6f('0x35')](_0x34e296[_0x2a4b91['id']],function(_0x5c1aac){return{'id':_0x5c1aac['id'],'fullname':_0x5c1aac['fullname']};});}}catch(_0x54474e){_0xce6f56(_0x54474e);}_0x3cf017(_0x2a4b91);});}function getInteractionTags(_0x141daa,_0x16143c){return new BPromise(function(_0x4f92a6,_0x478b3f){try{if(_0x141daa[_0x5b6f('0x36')]){_0x141daa[_0x5b6f('0x37')]=[];_0x141daa['TagIds'][_0x5b6f('0x38')](',')['forEach'](function(_0x238d78){_0x141daa[_0x5b6f('0x37')][_0x5b6f('0x39')](_0x16143c[_0x238d78]);});}delete _0x141daa[_0x5b6f('0x36')];}catch(_0x26083b){_0x478b3f(_0x26083b);}_0x4f92a6(_0x141daa);});}function updateSmsInteraction(_0x2d829f,_0x5a6adc,_0x544584){return new BPromise(function(_0x413f02,_0x5495b0){return getInteractionUsers(_0x2d829f,_0x544584)['then'](function(_0x49fa5d){return getInteractionTags(_0x49fa5d,_0x5a6adc);})[_0x5b6f('0x2f')](function(_0x5b28b8){return getStateInteraction(_0x5b28b8);})[_0x5b6f('0x2f')](function(_0x1fbe33){_0x413f02(_0x1fbe33);})[_0x5b6f('0x3a')](function(_0x311e20){_0x5495b0(_0x311e20);});});}function getStateInteraction(_0x5103da){return new BPromise(function(_0x244a1a){_0x5103da[_0x5b6f('0x3b')]=0x0;_0x5103da[_0x5b6f('0x3c')]=0x0;_0x5103da[_0x5b6f('0x3d')]=0x0;_0x5103da[_0x5b6f('0x3e')]=0x0;_0x5103da[_0x5b6f('0x3f')]=0x0;if(!_0x5103da['closed']&&!_0x5103da[_0x5b6f('0x40')]){_0x5103da[_0x5b6f('0x3b')]+=0x1;}if(!_0x5103da['closed']&&_0x5103da[_0x5b6f('0x40')]){_0x5103da[_0x5b6f('0x3c')]+=0x1;if(_0x5103da[_0x5b6f('0x3b')]){_0x5103da['waiting']-=0x1;}}if(_0x5103da[_0x5b6f('0x41')]&&_0x5103da['UserId']){_0x5103da[_0x5b6f('0x3d')]+=0x1;if(_0x5103da[_0x5b6f('0x3c')]){_0x5103da[_0x5b6f('0x3c')]-=0x1;}}if(_0x5103da[_0x5b6f('0x41')]&&!_0x5103da[_0x5b6f('0x40')]){_0x5103da[_0x5b6f('0x3e')]+=0x1;if(_0x5103da[_0x5b6f('0x3b')]){_0x5103da[_0x5b6f('0x3b')]-=0x1;}}_0x5103da[_0x5b6f('0x3f')]+=0x1;_0x244a1a(_0x5103da);});}exports[_0x5b6f('0x42')]=function(_0x5e25d0,_0x4a2b59){var _0x3fcb01={},_0x17602d={},_0x43e574={'count':0x0,'rows':[]};var _0x102359=_[_0x5b6f('0x35')](db['SmsInteraction']['rawAttributes'],function(_0x1c6b9){return{'name':_0x1c6b9[_0x5b6f('0x43')],'type':_0x1c6b9[_0x5b6f('0x44')][_0x5b6f('0x45')]};});_0x17602d[_0x5b6f('0x46')]=_[_0x5b6f('0x35')](_0x102359,'name');_0x17602d[_0x5b6f('0x47')]=_[_0x5b6f('0x48')](_0x5e25d0['query']);_0x17602d[_0x5b6f('0x49')]=_[_0x5b6f('0x4a')](_0x17602d[_0x5b6f('0x46')],_0x17602d['query']);_0x3fcb01[_0x5b6f('0x4b')]=_[_0x5b6f('0x4a')](_0x17602d[_0x5b6f('0x46')],qs[_0x5b6f('0x4c')](_0x5e25d0['query'][_0x5b6f('0x4c')]));_0x3fcb01[_0x5b6f('0x4b')]=_0x3fcb01[_0x5b6f('0x4b')][_0x5b6f('0x4d')]?_0x3fcb01[_0x5b6f('0x4b')]:_0x17602d[_0x5b6f('0x46')];if(!_0x5e25d0['query'][_0x5b6f('0x4e')](_0x5b6f('0x4f'))){_0x3fcb01[_0x5b6f('0x23')]=qs[_0x5b6f('0x23')](_0x5e25d0[_0x5b6f('0x47')]['limit']);_0x3fcb01[_0x5b6f('0x26')]=qs['offset'](_0x5e25d0[_0x5b6f('0x47')][_0x5b6f('0x26')]);}_0x3fcb01[_0x5b6f('0x50')]=qs[_0x5b6f('0x51')](_0x5e25d0[_0x5b6f('0x47')]['sort']);_0x3fcb01[_0x5b6f('0x52')]=qs[_0x5b6f('0x49')](_[_0x5b6f('0x53')](_0x5e25d0[_0x5b6f('0x47')],_0x17602d['filters']),_0x102359);var _0x450c0d=[];var _0x405a02=squel[_0x5b6f('0x54')]()[_0x5b6f('0x55')]('id')[_0x5b6f('0x55')](_0x5b6f('0x32'))[_0x5b6f('0x55')](_0x5b6f('0x56'))[_0x5b6f('0x57')](_0x5b6f('0x58'));var _0x4281d2=squel[_0x5b6f('0x54')]()[_0x5b6f('0x55')](_0x5b6f('0x59'))['field']('u.fullname')[_0x5b6f('0x55')]('ui.SmsInteractionId')[_0x5b6f('0x57')]('user_has_sms_interactions','ui')['left_join']('users','u',_0x5b6f('0x5a'));var _0x3cc6bc=squel['select']()[_0x5b6f('0x57')](_0x5b6f('0x5b'),'i')[_0x5b6f('0x5c')](_0x5b6f('0x5d'),'c',_0x5b6f('0x5e'))[_0x5b6f('0x5c')](_0x5b6f('0x5f'),'o',_0x5b6f('0x60'))[_0x5b6f('0x5c')](_0x5b6f('0x61'),'a','a.id\x20=\x20i.SmsAccountId')[_0x5b6f('0x5c')]('sms_messages','me',_0x5b6f('0x62'))[_0x5b6f('0x5c')](_0x5b6f('0x63'),'it','it.SmsInteractionId\x20=\x20i.id')[_0x5b6f('0x5c')](_0x5b6f('0x58'),'t',_0x5b6f('0x64'));var _0x178342=squel['expr']();var _0x2664b9=[];var _0x3cff1e=squel[_0x5b6f('0x65')]();var _0xb0831e;if(_0x5e25d0[_0x5b6f('0x47')][_0x5b6f('0x66')]){_0xb0831e=as[_0x5b6f('0x67')](_0x5e25d0[_0x5b6f('0x47')][_0x5b6f('0x66')]);var _0x196599=_0xb0831e[_0x5b6f('0x68')];for(var _0x1f2e00=0x0;_0x1f2e00<_0xb0831e[_0x5b6f('0x69')][_0x5b6f('0x4d')];_0x1f2e00++){var _0x15d850=_0xb0831e[_0x5b6f('0x69')][_0x1f2e00];var _0x4842b4='i';var _0x5d9cbc=_[_0x5b6f('0x6a')](_0x102359,['name',_0x15d850[_0x5b6f('0x55')]]);if(!_0x5d9cbc){switch(_0x15d850[_0x5b6f('0x55')]){case _0x5b6f('0x6b'):if(_0x15d850[_0x5b6f('0x6c')]==0x1){_0x3cc6bc['having']('`'+_0x15d850[_0x5b6f('0x55')]+_0x5b6f('0x6d'));}else{_0x3cc6bc[_0x5b6f('0x6e')]('`'+_0x15d850[_0x5b6f('0x55')]+_0x5b6f('0x6f'));}break;case _0x5b6f('0x70'):if(_0x15d850[_0x5b6f('0x71')]==='$substring'){if(_0x15d850[_0x5b6f('0x6c')][_0x5b6f('0x38')]('\x20')['length']>0x1){_0x178342[_0x196599](_0x5b6f('0x72'),qs[_0x5b6f('0x73')](_0x15d850[_0x5b6f('0x6c')]),null);}else{var _0x53f09a='%'+_0x15d850[_0x5b6f('0x6c')]+'%';_0x178342[_0x196599](_0x5b6f('0x74'),_0x53f09a,_0x53f09a,_0x53f09a);}}else{_0x5d9cbc=_[_0x5b6f('0x6a')](_0x102359,[_0x5b6f('0x32'),_0x5b6f('0x75')]);_0x15d850[_0x5b6f('0x55')]=_0x5b6f('0x75');_0x578334=as['buildExpression'](_0x4842b4,_0x5d9cbc[_0x5b6f('0x44')],_0x15d850);_0x178342[_0x196599](_0x578334['text'],_0x578334[_0x5b6f('0x6c')][_0x5b6f('0x76')],_0x578334['value'][_0x5b6f('0x22')]);}break;case _0x5b6f('0x77'):var _0x597065=_0x15d850[_0x5b6f('0x6c')][_0x5b6f('0x38')](',')[_0x5b6f('0x35')](function(_0x1f06bc){return Number(_0x1f06bc);});_0x597065[_0x5b6f('0x78')](function(_0x1da6a6){_0x3cff1e['or'](_0x5b6f('0x79'),'%,'+_0x1da6a6+',%');});_0x2664b9=_['union'](_0x2664b9,_0x597065);break;case _0x5b6f('0x7a'):if(_0x15d850['operator']==='$substring'){_0x178342[_0x196599](_0x5b6f('0x7b'),'%'+_0x15d850[_0x5b6f('0x6c')]+'%',null);}else{_0x5d9cbc=_['find'](_0x102359,[_0x5b6f('0x32'),_0x5b6f('0x40')]);_0x15d850[_0x5b6f('0x55')]='UserId';_0x578334=as[_0x5b6f('0x7c')](_0x4842b4,_0x5d9cbc['type'],_0x15d850);_0x178342[_0x196599](_0x578334['text'],_0x578334[_0x5b6f('0x6c')][_0x5b6f('0x76')],_0x578334['value']['end']);}break;case _0x5b6f('0x7d'):_0x578334=as[_0x5b6f('0x7c')]('me',null,_0x15d850);_0x178342[_0x196599](_0x578334['text'],_0x578334['value']['start'],_0x578334[_0x5b6f('0x6c')][_0x5b6f('0x22')]);break;}}else{var _0x578334=as['buildExpression'](_0x4842b4,_0x5d9cbc['type'],_0x15d850);_0x178342[_0x196599](_0x578334[_0x5b6f('0x7e')],_0x578334[_0x5b6f('0x6c')]['start'],_0x578334['value']['end']);}}}else{var _0x2d0cef=_(_0x5e25d0['query'])['keys']()['map'](function(_0x515df5){return _[_0x5b6f('0x7f')](_0x102359,[_0x5b6f('0x32'),_0x515df5])?_0x515df5:undefined;})[_0x5b6f('0x80')]()[_0x5b6f('0x6c')]();if(!_[_0x5b6f('0x81')](_0x2d0cef)){_0x2d0cef[_0x5b6f('0x78')](function(_0x3b2676){if(_0x3b2676===_0x5b6f('0x82')){_0x3cc6bc[_0x5b6f('0x52')](_0x5b6f('0x83'),[]['concat'](_0x5e25d0['query'][_0x3b2676]));}else if(_0x3b2676==='createdAt'){var _0x4926de=JSON['parse'](_0x5e25d0['query'][_0x3b2676])[_0x5b6f('0x84')];var _0x112991=JSON[_0x5b6f('0x85')](_0x5e25d0['query'][_0x3b2676])[_0x5b6f('0x86')];_0x3cc6bc[_0x5b6f('0x52')](_0x5b6f('0x87'),_0x4926de,_0x112991);}else{if(_0x5e25d0[_0x5b6f('0x47')][_0x3b2676]==='null'){_0x3cc6bc['where']('i.'+_0x3b2676+_0x5b6f('0x88'));}else{_0x3cc6bc['where']('i.'+_0x3b2676+_0x5b6f('0x89'),_0x5e25d0[_0x5b6f('0x47')][_0x3b2676]);}}});}if(_0x5e25d0[_0x5b6f('0x47')][_0x5b6f('0x8a')]){if(_0x5e25d0['query'][_0x5b6f('0x8a')]==0x1){_0x3cc6bc[_0x5b6f('0x6e')](_0x5b6f('0x8b'));}else{_0x3cc6bc[_0x5b6f('0x6e')](_0x5b6f('0x8c'));}}if(_0x5e25d0['query'][_0x5b6f('0x8d')]){_0x2664b9=_[_0x5b6f('0x8e')](_0x5e25d0[_0x5b6f('0x47')]['tag'])?_0x5e25d0[_0x5b6f('0x47')][_0x5b6f('0x8d')]:new Array(_0x5e25d0[_0x5b6f('0x47')][_0x5b6f('0x8d')]);_0x2664b9[_0x5b6f('0x78')](function(_0xe2bb9){_0x3cff1e['or'](_0x5b6f('0x79'),'%,'+_0xe2bb9+',%');});}if(_0x5e25d0['query'][_0x5b6f('0x8f')]){var _0x4a8780=_0x5e25d0[_0x5b6f('0x47')]['filter']['replace']('\x5c','\x5c\x5c')[_0x5b6f('0x90')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x4a8780)){_0x178342['or']('i.id\x20LIKE\x20?',_0x4a8780+'%')['or'](_0x5b6f('0x91'),_0x4a8780+'%');}else{_0x178342['or'](_0x5b6f('0x92'),qs[_0x5b6f('0x73')](_0x4a8780))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x4a8780+'%');}}}_0x3cc6bc[_0x5b6f('0x52')](_0x178342);_0x3cc6bc['group']('i.id');var _0x4e3c3a={'type':db[_0x5b6f('0x93')][_0x5b6f('0x94')][_0x5b6f('0x95')],'raw':!![]};var _0x5e7edb=_0x3cc6bc[_0x5b6f('0x96')]();_0x5e7edb['field'](_0x5b6f('0x97'));_0x5e7edb[_0x5b6f('0x55')](_0x5b6f('0x98'),'unreadMessages');if(_0x3fcb01[_0x5b6f('0x50')]){_0x3fcb01[_0x5b6f('0x50')]['forEach'](function(_0x4ec717){var _0x30874c=_0x4ec717[0x0]===_0x5b6f('0x99')?_0x4ec717[0x0]:'i.'+_0x4ec717[0x0];_0x3cc6bc[_0x5b6f('0x50')](_0x30874c,_0x4ec717[0x1]===_0x5b6f('0x9a')?![]:!![]);});}if(!_[_0x5b6f('0x81')](_0x2664b9)){_0x3cc6bc['having'](_0x3cff1e);_0x5e7edb[_0x5b6f('0x52')]('t.id\x20IN\x20?',_0x2664b9);}BPromise[_0x5b6f('0x9b')]()[_0x5b6f('0x2f')](function(){if(!_0xb0831e){if(_0x5e25d0['query'][_0x5b6f('0x82')])return;_0x5e7edb[_0x5b6f('0x52')](_0x5b6f('0x9c'));_0x3cc6bc[_0x5b6f('0x52')](_0x5b6f('0x9c'));return;}if(_0x5e25d0[_0x5b6f('0x9d')]['role']!==_0x5b6f('0x9e'))return;return _0x5e25d0[_0x5b6f('0x9d')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x5b6f('0x2f')](function(_0x157b4b){if(_['isEmpty'](_0x157b4b)){_0x5e7edb[_0x5b6f('0x52')](_0x5b6f('0x9f'));_0x3cc6bc[_0x5b6f('0x52')](_0x5b6f('0x9f'));}else{_0x5e7edb[_0x5b6f('0x52')](_0x5b6f('0x83'),_[_0x5b6f('0x35')](_0x157b4b,'id'));_0x3cc6bc['where']('i.SmsAccountId\x20IN\x20?',_[_0x5b6f('0x35')](_0x157b4b,'id'));}});})[_0x5b6f('0x2f')](function(){if(_0x5e25d0['user'][_0x5b6f('0xa0')]==='agent'&&!_0xb0831e&&!_0x5e25d0[_0x5b6f('0x47')][_0x5b6f('0x82')])return[];return db['sequelize'][_0x5b6f('0x47')](_0x5e7edb['toString'](),_0x4e3c3a);})['then'](function(_0x2dcd26){_0x43e574[_0x5b6f('0x25')]=_0x2dcd26[_0x5b6f('0x4d')];if(_0x43e574[_0x5b6f('0x25')]===0x0)return[];return db[_0x5b6f('0xa1')][_0x5b6f('0x47')](_0x405a02[_0x5b6f('0xa2')](),_0x4e3c3a)[_0x5b6f('0x2f')](function(_0x5b9fd9){_0x450c0d=_[_0x5b6f('0xa3')](_0x5b9fd9,'id');_0x4e3c3a=_[_0x5b6f('0xa4')](_0x4e3c3a,{'model':db[_0x5b6f('0xa5')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5e25d0[_0x5b6f('0x47')][_0x5b6f('0x4c')]){_0x3fcb01['attributes']['forEach'](function(_0x5f336f){_0x3cc6bc[_0x5b6f('0x55')]('i.'+_0x5f336f);});}else{_0x3cc6bc[_0x5b6f('0x55')](_0x5b6f('0x98'),_0x5b6f('0x6b'));_0x3cc6bc[_0x5b6f('0x55')](_0x5b6f('0xa6'),'Account.key');_0x3cc6bc[_0x5b6f('0x55')](_0x5b6f('0xa7'),_0x5b6f('0xa8'));_0x3cc6bc['field'](_0x5b6f('0xa9'),'contactName');_0x3cc6bc[_0x5b6f('0x55')](_0x5b6f('0xaa'));_0x3cc6bc['field'](_0x5b6f('0xab'),'Contact.firstName');_0x3cc6bc[_0x5b6f('0x55')]('c.lastName',_0x5b6f('0xac'));_0x3cc6bc['field']('c.email',_0x5b6f('0xad'));_0x3cc6bc[_0x5b6f('0x55')]('c.phone',_0x5b6f('0xae'));_0x3cc6bc[_0x5b6f('0x55')](_0x5b6f('0xaf'),_0x5b6f('0xb0'));_0x3cc6bc[_0x5b6f('0x55')]('c.fax','Contact.fax');_0x3cc6bc[_0x5b6f('0x55')](_0x5b6f('0xb1'),_0x5b6f('0xb2'));_0x3cc6bc[_0x5b6f('0x55')](_0x5b6f('0xb3'),'Owner.internal');_0x3cc6bc[_0x5b6f('0x55')](_0x5b6f('0xb4'),_0x5b6f('0x36'));}if(_0x3fcb01[_0x5b6f('0x23')])_0x3cc6bc['limit'](_0x3fcb01[_0x5b6f('0x23')]);if(_0x3fcb01[_0x5b6f('0x26')])_0x3cc6bc[_0x5b6f('0x26')](_0x3fcb01[_0x5b6f('0x26')]);return db[_0x5b6f('0xa1')][_0x5b6f('0x47')](_0x3cc6bc[_0x5b6f('0xa2')](),_0x4e3c3a);})[_0x5b6f('0x2f')](function(_0x416019){if(_0x416019[_0x5b6f('0x4d')]>0x0)_0x4281d2['where'](_0x5b6f('0xb5'),_[_0x5b6f('0x35')](_0x416019,'id'));return db[_0x5b6f('0xa1')]['query'](_0x4281d2[_0x5b6f('0xa2')](),_0x4e3c3a)['then'](function(_0x27d238){var _0x521f8b=_[_0x5b6f('0xb6')](_0x27d238,_0x5b6f('0xb7'));var _0x556666=[];_0x416019[_0x5b6f('0x78')](function(_0x145a4d){_0x556666[_0x5b6f('0x39')](updateSmsInteraction(_0x145a4d,_0x450c0d,_0x521f8b));});return BPromise[_0x5b6f('0xb8')](_0x556666);});});})[_0x5b6f('0x2f')](function(_0x294491){_0x43e574[_0x5b6f('0xb9')]=_0x294491;return _0x43e574;})['then'](respondWithFilteredResult(_0x4a2b59,_0x3fcb01))[_0x5b6f('0x3a')](handleError(_0x4a2b59,null));};exports[_0x5b6f('0xba')]=function(_0x314ba2,_0x2a31fd){var _0x447978={'raw':![],'where':{'id':_0x314ba2['params']['id']}},_0x3b2618={};_0x3b2618[_0x5b6f('0x46')]=_[_0x5b6f('0x48')](db[_0x5b6f('0xa5')]['rawAttributes']);_0x3b2618[_0x5b6f('0x47')]=_[_0x5b6f('0x48')](_0x314ba2[_0x5b6f('0x47')]);_0x3b2618[_0x5b6f('0x49')]=_[_0x5b6f('0x4a')](_0x3b2618[_0x5b6f('0x46')],_0x3b2618[_0x5b6f('0x47')]);_0x447978['attributes']=_[_0x5b6f('0x4a')](_0x3b2618[_0x5b6f('0x46')],qs['fields'](_0x314ba2[_0x5b6f('0x47')][_0x5b6f('0x4c')]));_0x447978[_0x5b6f('0x4b')]=_0x447978[_0x5b6f('0x4b')][_0x5b6f('0x4d')]?_0x447978[_0x5b6f('0x4b')]:_0x3b2618[_0x5b6f('0x46')];if(_0x314ba2[_0x5b6f('0x47')][_0x5b6f('0xbb')]){_0x447978[_0x5b6f('0xbc')]=[{'all':!![]}];}_0x447978=_[_0x5b6f('0xa4')]({},_0x447978,_0x314ba2[_0x5b6f('0xbd')]);return db[_0x5b6f('0xa5')][_0x5b6f('0x6a')](_0x447978)[_0x5b6f('0x2f')](handleEntityNotFound(_0x2a31fd,null))['then'](respondWithResult(_0x2a31fd,null))['catch'](handleError(_0x2a31fd,null));};exports[_0x5b6f('0xbe')]=function(_0xee3c2b,_0x3d7033){return db[_0x5b6f('0xa5')][_0x5b6f('0xbe')](_0xee3c2b[_0x5b6f('0x7d')],{})[_0x5b6f('0x2f')](respondWithResult(_0x3d7033,0xc9))['catch'](handleError(_0x3d7033,null));};exports['update']=function(_0x11a758,_0x348892){if(_0x11a758[_0x5b6f('0x7d')]['id']){delete _0x11a758[_0x5b6f('0x7d')]['id'];}return db[_0x5b6f('0xa5')][_0x5b6f('0x6a')]({'where':{'id':_0x11a758[_0x5b6f('0xbf')]['id']}})[_0x5b6f('0x2f')](handleEntityNotFound(_0x348892,null))[_0x5b6f('0x2f')](saveUpdates(_0x11a758['body'],null))['then'](respondWithResult(_0x348892,null))['catch'](handleError(_0x348892,null));};exports['destroy']=function(_0x1a99a7,_0x1d9275){return db[_0x5b6f('0xa5')]['find']({'where':{'id':_0x1a99a7[_0x5b6f('0xbf')]['id']}})['then'](handleEntityNotFound(_0x1d9275,null))[_0x5b6f('0x2f')](removeEntity(_0x1d9275,null))['catch'](handleError(_0x1d9275,null));};exports[_0x5b6f('0xc0')]=function(_0x29d149,_0x26ea73){return db['SmsInteraction'][_0x5b6f('0xc0')]()['then'](respondWithResult(_0x26ea73,null))[_0x5b6f('0x3a')](handleError(_0x26ea73,null));};exports[_0x5b6f('0xc1')]=function(_0x589e72,_0x463c41,_0x4366f0){return db[_0x5b6f('0xc2')][_0x5b6f('0x6a')]({'where':{'id':_0x589e72['params']['id']}})[_0x5b6f('0x2f')](handleEntityNotFound(_0x463c41,null))[_0x5b6f('0x2f')](function(_0x3d58a4){if(_0x3d58a4){return _0x3d58a4[_0x5b6f('0xc1')](_0x589e72[_0x5b6f('0x7d')][_0x5b6f('0xc3')],_['omit'](_0x589e72[_0x5b6f('0x7d')],[_0x5b6f('0xc3'),'id'])||{});}})['then'](respondWithResult(_0x463c41,null))['catch'](handleError(_0x463c41,null));};exports['getMessages']=function(_0x5cac99,_0x4d2948,_0x28818c){var _0x202ccd={'raw':![],'where':{}};var _0x1511e1={};var _0x5684b0={'count':0x0,'rows':[]};return db[_0x5b6f('0xa5')][_0x5b6f('0xc4')]({'where':{'id':_0x5cac99[_0x5b6f('0xbf')]['id']}})[_0x5b6f('0x2f')](handleEntityNotFound(_0x4d2948,null))[_0x5b6f('0x2f')](function(_0x4ca10c){if(_0x4ca10c){_0x1511e1[_0x5b6f('0x46')]=_['keys'](db[_0x5b6f('0xc2')][_0x5b6f('0xc5')]);_0x1511e1[_0x5b6f('0x47')]=_[_0x5b6f('0x48')](_0x5cac99['query']);_0x1511e1[_0x5b6f('0x49')]=_[_0x5b6f('0x4a')](_0x1511e1['model'],_0x1511e1['query']);_0x202ccd['attributes']=_['intersection'](_0x1511e1[_0x5b6f('0x46')],qs[_0x5b6f('0x4c')](_0x5cac99['query']['fields']));_0x202ccd[_0x5b6f('0x4b')]=_0x202ccd[_0x5b6f('0x4b')][_0x5b6f('0x4d')]?_0x202ccd['attributes']:_0x1511e1[_0x5b6f('0x46')];if(!_0x5cac99[_0x5b6f('0x47')][_0x5b6f('0x4e')](_0x5b6f('0x4f'))){_0x202ccd[_0x5b6f('0x23')]=qs[_0x5b6f('0x23')](_0x5cac99[_0x5b6f('0x47')][_0x5b6f('0x23')]);_0x202ccd[_0x5b6f('0x26')]=qs[_0x5b6f('0x26')](_0x5cac99[_0x5b6f('0x47')]['offset']);}_0x202ccd['order']=qs[_0x5b6f('0x51')](_0x5cac99[_0x5b6f('0x47')][_0x5b6f('0x51')]);_0x202ccd[_0x5b6f('0x52')]=qs['filters'](_[_0x5b6f('0x53')](_0x5cac99[_0x5b6f('0x47')],_0x1511e1[_0x5b6f('0x49')]));_0x202ccd[_0x5b6f('0x52')]['SmsInteractionId']=_0x4ca10c['id'];if(_0x5cac99['query'][_0x5b6f('0x8f')]){_0x202ccd['where']=_[_0x5b6f('0xa4')](_0x202ccd[_0x5b6f('0x52')],{'$or':_[_0x5b6f('0x35')](_0x202ccd['attributes'],function(_0x2e1ae0){var _0x3cb05e={};_0x3cb05e[_0x2e1ae0]={'$like':'%'+_0x5cac99['query'][_0x5b6f('0x8f')]+'%'};return _0x3cb05e;})});}if(_0x5cac99['query']['$gte']){var _0x1e9e7e=_0x5cac99[_0x5b6f('0x47')][_0x5b6f('0x84')][_0x5b6f('0x38')](',');var _0x6e6cda={};_0x6e6cda[_0x1e9e7e[0x0]]={'$gte':moment(_0x1e9e7e[0x1])[_0x5b6f('0xc6')](_0x5b6f('0xc7'))};_0x202ccd[_0x5b6f('0x52')]=_['merge'](_0x202ccd[_0x5b6f('0x52')],_0x6e6cda);}_0x202ccd=_['merge']({},_0x202ccd,_0x5cac99[_0x5b6f('0xbd')]);return db[_0x5b6f('0xc2')][_0x5b6f('0x25')]({'where':_0x202ccd[_0x5b6f('0x52')]})[_0x5b6f('0x2f')](function(_0x5ef4d5){_0x5684b0['count']=_0x5ef4d5;if(_0x5cac99[_0x5b6f('0x47')]['includeAll']){_0x202ccd[_0x5b6f('0xbc')]=[{'all':!![]}];}return db[_0x5b6f('0xc2')][_0x5b6f('0xc8')](_0x202ccd);})['then'](function(_0x40c4b1){_0x5684b0[_0x5b6f('0xb9')]=_0x40c4b1;return _0x5684b0;});}})[_0x5b6f('0x2f')](respondWithFilteredResult(_0x4d2948,_0x202ccd))[_0x5b6f('0x3a')](handleError(_0x4d2948,null));};exports[_0x5b6f('0xc9')]=function(_0x4482f2,_0x3fa587,_0x1c5f0f){return db['SmsInteraction'][_0x5b6f('0x6a')]({'where':{'id':_0x4482f2['params']['id']}})['then'](handleEntityNotFound(_0x3fa587,null))[_0x5b6f('0x2f')](function(_0x4d1ee3){if(_0x4d1ee3){return _0x4d1ee3[_0x5b6f('0xca')](_0x4482f2['body'][_0x5b6f('0xc3')],_[_0x5b6f('0xcb')](_0x4482f2[_0x5b6f('0x7d')],['ids','id'])||{})[_0x5b6f('0xcc')](function(){return db[_0x5b6f('0x77')][_0x5b6f('0xc8')]({'attributes':['id',_0x5b6f('0x32'),_0x5b6f('0x56')],'where':{'id':_0x4482f2['body'][_0x5b6f('0xc3')]}});})[_0x5b6f('0x2f')](function(_0x663de7){socket[_0x5b6f('0xcd')]('smsInteractionTags:save',{'id':Number(_0x4482f2[_0x5b6f('0xbf')]['id']),'tags':_0x663de7||[]});return{'id':Number(_0x4482f2[_0x5b6f('0xbf')]['id']),'tags':_0x663de7||[]};});}})[_0x5b6f('0x2f')](respondWithResult(_0x3fa587,null))[_0x5b6f('0x3a')](handleError(_0x3fa587,null));};exports[_0x5b6f('0xce')]=function(_0x401f17,_0x20a8f0,_0x50bb2b){return db[_0x5b6f('0xa5')][_0x5b6f('0x6a')]({'where':{'id':_0x401f17[_0x5b6f('0xbf')]['id']}})[_0x5b6f('0x2f')](handleEntityNotFound(_0x20a8f0,null))[_0x5b6f('0x2f')](function(_0x57ef58){if(_0x57ef58){return _0x57ef58[_0x5b6f('0xce')](_0x401f17['query'][_0x5b6f('0xc3')]);}})[_0x5b6f('0x2f')](respondWithStatusCode(_0x20a8f0,null))[_0x5b6f('0x3a')](handleError(_0x20a8f0,null));};exports[_0x5b6f('0xcf')]=function(_0x1b33d3,_0x3944f2){var _0x2285e9=moment()[_0x5b6f('0xd0')]()[_0x5b6f('0xa2')]();var _0x43e9d7=path[_0x5b6f('0xd1')](config['root'],_0x5b6f('0xd2'),'files',_0x5b6f('0xd3'));var _0x265304=path[_0x5b6f('0xd1')](config[_0x5b6f('0xd4')],_0x5b6f('0xd2'),_0x5b6f('0xd5'),_0x5b6f('0xd6'));var _0x2df1d0=path[_0x5b6f('0xd1')](_0x43e9d7,_0x2285e9);var _0x16c67d=util[_0x5b6f('0xc6')](_0x5b6f('0xd7'),_0x1b33d3[_0x5b6f('0xbf')]['id'],_0x2285e9);var _0x4d33eb=path[_0x5b6f('0xd1')](_0x43e9d7,_0x16c67d);var _0xcdd9d5=[];_0xcdd9d5['push']({'model':db[_0x5b6f('0x7a')],'as':_0x5b6f('0x7a'),'attributes':['id',_0x5b6f('0xd8')],'raw':!![]});_0xcdd9d5[_0x5b6f('0x39')]({'model':db['CmContact'],'as':_0x5b6f('0x70'),'attributes':['id',_0x5b6f('0xd9'),'lastName'],'raw':!![]});var _0x4e711a=[{'model':db[_0x5b6f('0xc2')],'as':_0x5b6f('0xda'),'attributes':['id',_0x5b6f('0x7d'),_0x5b6f('0xdb'),_0x5b6f('0xdc'),'secret',_0x5b6f('0x8a')],'include':_0xcdd9d5}];_0x4e711a[_0x5b6f('0x39')]({'model':db[_0x5b6f('0xdd')],'as':_0x5b6f('0xde'),'attributes':['id',_0x5b6f('0x32')]});_0x4e711a[_0x5b6f('0x39')]({'model':db['User'],'as':_0x5b6f('0xdf'),'attributes':['id','fullname']});return db['SmsInteraction'][_0x5b6f('0x6a')]({'where':{'id':_0x1b33d3[_0x5b6f('0xbf')]['id']},'include':_0x4e711a})[_0x5b6f('0x2f')](handleEntityNotFound(_0x3944f2,null))[_0x5b6f('0x2f')](function(_0x52e8da){if(_0x52e8da){var _0x44a061=_0x52e8da[_0x5b6f('0xe0')]({'plain':!![]});fs[_0x5b6f('0xe1')](_0x2df1d0);var _0x57d11e={'channel':_0x5b6f('0xe2'),'account':_0x44a061[_0x5b6f('0xde')][_0x5b6f('0x32')],'agent':_0x44a061[_0x5b6f('0xdf')]?_0x44a061['Owner']['fullname']:_0x5b6f('0xe3'),'createdAt':moment(_0x44a061['createdAt'])[_0x5b6f('0xc6')](_0x5b6f('0xc7'))[_0x5b6f('0xa2')](),'closedAt':_0x44a061[_0x5b6f('0x41')]?moment(_0x44a061[_0x5b6f('0xe4')])[_0x5b6f('0xc6')](_0x5b6f('0xc7'))[_0x5b6f('0xa2')]():'','disposition':_0x44a061['disposition'],'messages':_(_0x44a061[_0x5b6f('0xda')])[_0x5b6f('0x8f')]({'secret':![]})[_0x5b6f('0x35')](function(_0x5e552e){return{'date':moment(_0x5e552e['createdAt'])[_0x5b6f('0xc6')](_0x5b6f('0xc7'))[_0x5b6f('0xa2')](),'sender':_0x5e552e['direction']===_0x5b6f('0xe5')?_0x5e552e[_0x5b6f('0x7a')]?_0x5e552e[_0x5b6f('0x7a')][_0x5b6f('0xd8')]:_0x5b6f('0xe6'):_0x5e552e['Contact'][_0x5b6f('0xd9')]+(_0x5e552e[_0x5b6f('0x70')][_0x5b6f('0xe7')]?'\x20'+_0x5e552e[_0x5b6f('0x70')]['lastName']:''),'body':_0x5e552e[_0x5b6f('0x7d')],'direction':_0x5e552e[_0x5b6f('0xdc')]==='out'?'A':'C','secret':_0x5e552e['secret'],'read':_0x5e552e[_0x5b6f('0x8a')]};})[_0x5b6f('0x6c')]()};return ejs[_0x5b6f('0xe8')](path['join'](config[_0x5b6f('0xd4')],_0x5b6f('0xd2'),'views',_0x5b6f('0xe9')),{'interaction':_0x57d11e})['then'](function(_0x4b1aff){var _0x114dad=path['join'](_0x2df1d0,_0x5b6f('0xea')+_0x44a061['id']+'-'+_0x2285e9+_0x5b6f('0xeb'));var _0xf5b71c={'path':_0x114dad,'channel':_0x5b6f('0xe2'),'interactionId':_0x44a061['id']};return pdf['createPdfFromHTML'](_0x4b1aff,_0xf5b71c);})[_0x5b6f('0x2f')](function(){return new BPromise(function(_0x14a118,_0x16b354){zipdir(_0x2df1d0,{'saveTo':_0x4d33eb},function(_0x177418,_0x207e68){if(_0x177418)return _0x16b354(_0x177418);return _0x14a118(_0x207e68);});})[_0x5b6f('0x2f')](function(){return new BPromise(function(_0x248968,_0x17e22e){rimraf(_0x2df1d0,function(_0x6a46b2){if(_0x6a46b2)_0x17e22e(_0x6a46b2);return _0x248968();});});})[_0x5b6f('0x2f')](function(){return _0x3944f2[_0x5b6f('0xcf')](_0x4d33eb,_0x16c67d,function(_0x39d4e6){if(_0x39d4e6){console[_0x5b6f('0xec')]('err',_0x39d4e6);}else{fs[_0x5b6f('0xed')](_0x4d33eb);}});});});}else{return _0x3944f2['sendStatus'](0xc8);}})[_0x5b6f('0x3a')](handleError(_0x3944f2,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index ed3a9be..c125b54 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 _0xd824=['SmsMessage','setMaxListeners','save','update','remove','setDataValue','Users','unreadMessages','emit','catch','hasOwnProperty','hook','events','../../mysqldb'];(function(_0xb1cf84,_0x813740){var _0x4bad2e=function(_0x53e6f2){while(--_0x53e6f2){_0xb1cf84['push'](_0xb1cf84['shift']());}};_0x4bad2e(++_0x813740);}(_0xd824,0xc2));var _0x4d82=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd824[_0xfae23b];return _0x200640;};'use strict';var EventEmitter=require(_0x4d82('0x0'));var SmsInteraction=require(_0x4d82('0x1'))['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0x4d82('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x4d82('0x3')](0x0);var events={'afterCreate':_0x4d82('0x4'),'afterUpdate':_0x4d82('0x5'),'afterDestroy':_0x4d82('0x6')};function emitEvent(_0x1c8ad9){return function(_0x4bc746,_0x57850a,_0xd00023){_0x4bc746['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x464caf){_0x4bc746[_0x4d82('0x7')](_0x4d82('0x8'),_0x464caf['map'](function(_0x1ff96b){return{'id':_0x1ff96b['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x4bc746['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x580bbd){_0x4bc746[_0x4d82('0x7')](_0x4d82('0x9'),_0x580bbd['length']);SmsInteractionEvents[_0x4d82('0xa')](_0x1c8ad9+':'+_0x4bc746['id'],_0x4bc746);SmsInteractionEvents['emit'](_0x1c8ad9,_0x4bc746);_0xd00023(null);})[_0x4d82('0xb')](_0xd00023(null));};}for(var e in events){if(events[_0x4d82('0xc')](e)){var event=events[e];SmsInteraction[_0x4d82('0xd')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0xab40=['remove','then','setDataValue','Users','unreadMessages','length','emit','catch','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x29fb96,_0x3c712f){var _0x1490b5=function(_0x552ec9){while(--_0x552ec9){_0x29fb96['push'](_0x29fb96['shift']());}};_0x1490b5(++_0x3c712f);}(_0xab40,0xcd));var _0x0ab4=function(_0x11467c,_0x5c7375){_0x11467c=_0x11467c-0x0;var _0x57f71a=_0xab40[_0x11467c];return _0x57f71a;};'use strict';var EventEmitter=require(_0x0ab4('0x0'));var SmsInteraction=require(_0x0ab4('0x1'))['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x0ab4('0x2')](0x0);var events={'afterCreate':_0x0ab4('0x3'),'afterUpdate':_0x0ab4('0x4'),'afterDestroy':_0x0ab4('0x5')};function emitEvent(_0x14634a){return function(_0x57fac1,_0x5f01aa,_0x28b17a){_0x57fac1['getUsers']({'attributes':['id'],'raw':!![]})[_0x0ab4('0x6')](function(_0x46d16a){_0x57fac1[_0x0ab4('0x7')](_0x0ab4('0x8'),_0x46d16a['map'](function(_0x55263d){return{'id':_0x55263d['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x57fac1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0ab4('0x6')](function(_0x30e726){_0x57fac1[_0x0ab4('0x7')](_0x0ab4('0x9'),_0x30e726[_0x0ab4('0xa')]);SmsInteractionEvents[_0x0ab4('0xb')](_0x14634a+':'+_0x57fac1['id'],_0x57fac1);SmsInteractionEvents[_0x0ab4('0xb')](_0x14634a,_0x57fac1);_0x28b17a(null);})[_0x0ab4('0xc')](_0x28b17a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x0ab4('0xd')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 689cc40..1386484 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 _0x13cb=['YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','sms_interactions','changed','closed','closedAt'];(function(_0x347e53,_0x30f03e){var _0x5f1173=function(_0x136a4a){while(--_0x136a4a){_0x347e53['push'](_0x347e53['shift']());}};_0x5f1173(++_0x30f03e);}(_0x13cb,0x121));var _0xb13c=function(_0x58321f,_0x5730b9){_0x58321f=_0x58321f-0x0;var _0x3728ea=_0x13cb[_0x58321f];return _0x3728ea;};'use strict';var _=require(_0xb13c('0x0'));var util=require('util');var logger=require(_0xb13c('0x1'))(_0xb13c('0x2'));var moment=require(_0xb13c('0x3'));var BPromise=require(_0xb13c('0x4'));var rp=require(_0xb13c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb13c('0x6'));var config=require(_0xb13c('0x7'));var attributes=require(_0xb13c('0x8'));module[_0xb13c('0x9')]=function(_0x3eb2f7,_0x4ec2f6){return _0x3eb2f7[_0xb13c('0xa')]('SmsInteraction',attributes,{'tableName':_0xb13c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x284e89,_0x12cfae,_0x533667){if(_0x284e89[_0xb13c('0xc')](_0xb13c('0xd'))){_0x284e89[_0xb13c('0xe')]=moment()['format'](_0xb13c('0xf'));}_0x533667(null,_0x284e89);}}});}; \ No newline at end of file +var _0x541c=['sms_interactions','closedAt','lodash','util','../../config/logger','api','moment','rimraf','./smsInteraction.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x541c,0x1d8));var _0xc541=function(_0x5d3276,_0xd38063){_0x5d3276=_0x5d3276-0x0;var _0x3562f5=_0x541c[_0x5d3276];return _0x3562f5;};'use strict';var _=require(_0xc541('0x0'));var util=require(_0xc541('0x1'));var logger=require(_0xc541('0x2'))(_0xc541('0x3'));var moment=require(_0xc541('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc541('0x5'));var config=require('../../config/environment');var attributes=require(_0xc541('0x6'));module[_0xc541('0x7')]=function(_0x5f4232,_0x151c1e){return _0x5f4232['define']('SmsInteraction',attributes,{'tableName':_0xc541('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4be167,_0x122e87,_0x5048d9){if(_0x4be167['changed']('closed')){_0x4be167[_0xc541('0x9')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x5048d9(null,_0x4be167);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 37bda6f..a98fb90 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 _0x0bc8=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','limit','debug','catch','AddTagsToSmsInteraction','omit','ids','spread','AddTags','lodash','util','moment'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x0bc8,0x1cb));var _0x80bc=function(_0x343367,_0x6677f1){_0x343367=_0x343367-0x0;var _0x5c67bc=_0x0bc8[_0x343367];return _0x5c67bc;};'use strict';var _=require(_0x80bc('0x0'));var util=require(_0x80bc('0x1'));var moment=require(_0x80bc('0x2'));var BPromise=require(_0x80bc('0x3'));var rs=require(_0x80bc('0x4'));var fs=require('fs');var Redis=require(_0x80bc('0x5'));var db=require(_0x80bc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x80bc('0x7'))(_0x80bc('0x8'));var config=require(_0x80bc('0x9'));var jayson=require(_0x80bc('0xa'));var client=jayson[_0x80bc('0xb')][_0x80bc('0xc')]({'port':0x232a});config['redis']=_[_0x80bc('0xd')](config['redis'],{'host':_0x80bc('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x80bc('0xf')]));require('./smsInteraction.socket')[_0x80bc('0x10')](socket);function respondWithRpcPromise(_0x45e9f8,_0x33d40b,_0x3e6208){return new BPromise(function(_0x446ddd,_0x450cea){return client[_0x80bc('0x11')](_0x45e9f8,_0x3e6208)[_0x80bc('0x12')](function(_0x247481){logger[_0x80bc('0x13')](_0x80bc('0x14'),_0x33d40b,_0x80bc('0x15'));logger['debug'](_0x80bc('0x16'),_0x33d40b,_0x80bc('0x15'),JSON[_0x80bc('0x17')](_0x247481));if(_0x247481[_0x80bc('0x18')]){if(_0x247481[_0x80bc('0x18')][_0x80bc('0x19')]===0x1f4){logger[_0x80bc('0x18')](_0x80bc('0x14'),_0x33d40b,_0x247481[_0x80bc('0x18')][_0x80bc('0x1a')]);return _0x450cea(_0x247481[_0x80bc('0x18')][_0x80bc('0x1a')]);}logger[_0x80bc('0x18')](_0x80bc('0x14'),_0x33d40b,_0x247481[_0x80bc('0x18')][_0x80bc('0x1a')]);return _0x446ddd(_0x247481[_0x80bc('0x18')]['message']);}else{logger[_0x80bc('0x13')](_0x80bc('0x14'),_0x33d40b,_0x80bc('0x15'));_0x446ddd(_0x247481['result'][_0x80bc('0x1a')]);}})['catch'](function(_0x2f3872){logger[_0x80bc('0x18')](_0x80bc('0x14'),_0x33d40b,_0x2f3872);_0x450cea(_0x2f3872);});});}exports[_0x80bc('0x1b')]=function(_0x5b675f){var _0xfaacc0=this;return new Promise(function(_0x337413,_0x53522a){return db[_0x80bc('0x1c')][_0x80bc('0x1d')](_0x5b675f[_0x80bc('0x1e')],{'raw':_0x5b675f[_0x80bc('0x1f')]?_0x5b675f[_0x80bc('0x1f')][_0x80bc('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b675f[_0x80bc('0x1f')]?_0x5b675f[_0x80bc('0x1f')][_0x80bc('0x21')]||null:null,'attributes':_0x5b675f[_0x80bc('0x1f')]?_0x5b675f[_0x80bc('0x1f')]['attributes']||null:null,'limit':_0x5b675f[_0x80bc('0x1f')]?_0x5b675f[_0x80bc('0x1f')][_0x80bc('0x22')]||null:null})[_0x80bc('0x12')](function(_0x31c8a5){logger[_0x80bc('0x13')](_0x80bc('0x1b'),_0x5b675f);logger[_0x80bc('0x23')]('UpdateSmsInteraction',_0x5b675f,JSON[_0x80bc('0x17')](_0x31c8a5));_0x337413(_0x31c8a5);})[_0x80bc('0x24')](function(_0x1bcd9f){logger[_0x80bc('0x18')](_0x80bc('0x1b'),_0x1bcd9f['message'],_0x5b675f);_0x53522a(_0xfaacc0[_0x80bc('0x18')](0x1f4,_0x1bcd9f['message']));});});};exports[_0x80bc('0x25')]=function(_0x47b8c5){return new Promise(function(_0x4c4791,_0x521ecd){return db[_0x80bc('0x1c')]['find']({'where':_0x47b8c5['options']?_0x47b8c5['options']['where']||null:null})[_0x80bc('0x12')](function(_0x50514a){if(_0x50514a){return _0x50514a['addTags'](_0x47b8c5[_0x80bc('0x1e')]['ids'],_[_0x80bc('0x26')](_0x47b8c5[_0x80bc('0x1e')],[_0x80bc('0x27'),'id'])||{});}})[_0x80bc('0x28')](function(_0x19381d){logger['info'](_0x80bc('0x29'),_0x47b8c5);logger[_0x80bc('0x23')]('AddTags',_0x47b8c5,JSON[_0x80bc('0x17')](_0x19381d));_0x4c4791(_0x19381d);})[_0x80bc('0x24')](function(_0x2c8dc2){logger[_0x80bc('0x18')]('AddTags',_0x2c8dc2[_0x80bc('0x1a')],_0x47b8c5);_0x521ecd(_this['error'](0x1f4,_0x2c8dc2[_0x80bc('0x1a')]));});});}; \ No newline at end of file +var _0x5a5e=['request','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','catch','SmsInteraction','update','body','options','raw','where','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','ids','spread','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket'];(function(_0x4eb252,_0x4e059b){var _0x3122be=function(_0x13c49e){while(--_0x13c49e){_0x4eb252['push'](_0x4eb252['shift']());}};_0x3122be(++_0x4e059b);}(_0x5a5e,0x1f3));var _0xe5a5=function(_0x383158,_0x415e43){_0x383158=_0x383158-0x0;var _0x507985=_0x5a5e[_0x383158];return _0x507985;};'use strict';var _=require('lodash');var util=require(_0xe5a5('0x0'));var moment=require('moment');var BPromise=require(_0xe5a5('0x1'));var rs=require(_0xe5a5('0x2'));var fs=require('fs');var Redis=require(_0xe5a5('0x3'));var db=require(_0xe5a5('0x4'))['db'];var utils=require(_0xe5a5('0x5'));var logger=require(_0xe5a5('0x6'))(_0xe5a5('0x7'));var config=require(_0xe5a5('0x8'));var jayson=require(_0xe5a5('0x9'));var client=jayson[_0xe5a5('0xa')][_0xe5a5('0xb')]({'port':0x232a});config['redis']=_[_0xe5a5('0xc')](config[_0xe5a5('0xd')],{'host':_0xe5a5('0xe'),'port':0x18eb});var socket=require(_0xe5a5('0xf'))(new Redis(config['redis']));require(_0xe5a5('0x10'))['register'](socket);function respondWithRpcPromise(_0x11c6d7,_0xfd3059,_0x27a224){return new BPromise(function(_0x4a2507,_0x1dd2cd){return client[_0xe5a5('0x11')](_0x11c6d7,_0x27a224)[_0xe5a5('0x12')](function(_0x5865f2){logger[_0xe5a5('0x13')]('SmsInteraction,\x20%s,\x20%s',_0xfd3059,_0xe5a5('0x14'));logger[_0xe5a5('0x15')](_0xe5a5('0x16'),_0xfd3059,'request\x20sent',JSON[_0xe5a5('0x17')](_0x5865f2));if(_0x5865f2[_0xe5a5('0x18')]){if(_0x5865f2[_0xe5a5('0x18')][_0xe5a5('0x19')]===0x1f4){logger[_0xe5a5('0x18')](_0xe5a5('0x1a'),_0xfd3059,_0x5865f2['error'][_0xe5a5('0x1b')]);return _0x1dd2cd(_0x5865f2[_0xe5a5('0x18')][_0xe5a5('0x1b')]);}logger['error'](_0xe5a5('0x1a'),_0xfd3059,_0x5865f2[_0xe5a5('0x18')][_0xe5a5('0x1b')]);return _0x4a2507(_0x5865f2[_0xe5a5('0x18')]['message']);}else{logger[_0xe5a5('0x13')](_0xe5a5('0x1a'),_0xfd3059,_0xe5a5('0x14'));_0x4a2507(_0x5865f2['result']['message']);}})[_0xe5a5('0x1c')](function(_0x4809f6){logger[_0xe5a5('0x18')](_0xe5a5('0x1a'),_0xfd3059,_0x4809f6);_0x1dd2cd(_0x4809f6);});});}exports['UpdateSmsInteraction']=function(_0x685b68){var _0x11aa6a=this;return new Promise(function(_0xe8ffde,_0x10d1a7){return db[_0xe5a5('0x1d')][_0xe5a5('0x1e')](_0x685b68[_0xe5a5('0x1f')],{'raw':_0x685b68[_0xe5a5('0x20')]?_0x685b68[_0xe5a5('0x20')][_0xe5a5('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x685b68[_0xe5a5('0x20')]?_0x685b68[_0xe5a5('0x20')][_0xe5a5('0x22')]||null:null,'attributes':_0x685b68[_0xe5a5('0x20')]?_0x685b68['options'][_0xe5a5('0x23')]||null:null,'limit':_0x685b68[_0xe5a5('0x20')]?_0x685b68[_0xe5a5('0x20')][_0xe5a5('0x24')]||null:null})['then'](function(_0x4080d3){logger[_0xe5a5('0x13')](_0xe5a5('0x25'),_0x685b68);logger['debug'](_0xe5a5('0x25'),_0x685b68,JSON[_0xe5a5('0x17')](_0x4080d3));_0xe8ffde(_0x4080d3);})[_0xe5a5('0x1c')](function(_0xf2686d){logger['error'](_0xe5a5('0x25'),_0xf2686d[_0xe5a5('0x1b')],_0x685b68);_0x10d1a7(_0x11aa6a[_0xe5a5('0x18')](0x1f4,_0xf2686d[_0xe5a5('0x1b')]));});});};exports[_0xe5a5('0x26')]=function(_0x3686e3){return new Promise(function(_0x17efea,_0x35561a){return db[_0xe5a5('0x1d')][_0xe5a5('0x27')]({'where':_0x3686e3['options']?_0x3686e3[_0xe5a5('0x20')][_0xe5a5('0x22')]||null:null})[_0xe5a5('0x12')](function(_0x2f1530){if(_0x2f1530){return _0x2f1530['addTags'](_0x3686e3[_0xe5a5('0x1f')][_0xe5a5('0x28')],_['omit'](_0x3686e3[_0xe5a5('0x1f')],[_0xe5a5('0x28'),'id'])||{});}})[_0xe5a5('0x29')](function(_0x32ee68){logger['info']('AddTags',_0x3686e3);logger[_0xe5a5('0x15')](_0xe5a5('0x2a'),_0x3686e3,JSON[_0xe5a5('0x17')](_0x32ee68));_0x17efea(_0x32ee68);})['catch'](function(_0x234741){logger['error']('AddTags',_0x234741[_0xe5a5('0x1b')],_0x3686e3);_0x35561a(_this[_0xe5a5('0x18')](0x1f4,_0x234741[_0xe5a5('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index a770251..7991039 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 _0x04b4=['smsInteraction:','./smsInteraction.events','remove','emit','removeListener','register','length'];(function(_0x5502e5,_0x3a1b6a){var _0x2802d5=function(_0x183899){while(--_0x183899){_0x5502e5['push'](_0x5502e5['shift']());}};_0x2802d5(++_0x3a1b6a);}(_0x04b4,0x1cf));var _0x404b=function(_0x568a84,_0x12f3e9){_0x568a84=_0x568a84-0x0;var _0x135b73=_0x04b4[_0x568a84];return _0x135b73;};'use strict';var SmsInteractionEvents=require(_0x404b('0x0'));var events=['save',_0x404b('0x1'),'update'];function createListener(_0x5d0ae2,_0x2367b7){return function(_0x35610b){_0x2367b7[_0x404b('0x2')](_0x5d0ae2,_0x35610b);};}function removeListener(_0xfd82c0,_0x49bd38){return function(){SmsInteractionEvents[_0x404b('0x3')](_0xfd82c0,_0x49bd38);};}exports[_0x404b('0x4')]=function(_0x4b9757){for(var _0x30e618=0x0,_0x1cb4a7=events[_0x404b('0x5')];_0x30e618<_0x1cb4a7;_0x30e618++){var _0x3da031=events[_0x30e618];var _0x10a187=createListener(_0x404b('0x6')+_0x3da031,_0x4b9757);SmsInteractionEvents['on'](_0x3da031,_0x10a187);}}; \ No newline at end of file +var _0x29d0=['save','remove','update','removeListener','register','length','smsInteraction:','./smsInteraction.events'];(function(_0x488afb,_0xf2789){var _0x3b6955=function(_0x44b4e1){while(--_0x44b4e1){_0x488afb['push'](_0x488afb['shift']());}};_0x3b6955(++_0xf2789);}(_0x29d0,0x17f));var _0x029d=function(_0x5a2d88,_0x226490){_0x5a2d88=_0x5a2d88-0x0;var _0x2fd659=_0x29d0[_0x5a2d88];return _0x2fd659;};'use strict';var SmsInteractionEvents=require(_0x029d('0x0'));var events=[_0x029d('0x1'),_0x029d('0x2'),_0x029d('0x3')];function createListener(_0x5e5385,_0x398e1e){return function(_0x585c90){_0x398e1e['emit'](_0x5e5385,_0x585c90);};}function removeListener(_0x223572,_0x1f560f){return function(){SmsInteractionEvents[_0x029d('0x4')](_0x223572,_0x1f560f);};}exports[_0x029d('0x5')]=function(_0x1d1592){for(var _0x5a7bbe=0x0,_0x55a60f=events[_0x029d('0x6')];_0x5a7bbe<_0x55a60f;_0x5a7bbe++){var _0x2fe4b2=events[_0x5a7bbe];var _0x29a59d=createListener(_0x029d('0x7')+_0x2fe4b2,_0x1d1592);SmsInteractionEvents['on'](_0x2fe4b2,_0x29a59d);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 05da3d0..c18c8a1 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 _0xfd39=['../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','get','/describe','describe','show','post','tracked','sms','smsmessage:create','/:id/status','put','/:id','/:id/accept','/:id/reject','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x229128,_0x273558){var _0x1875b9=function(_0x275e35){while(--_0x275e35){_0x229128['push'](_0x229128['shift']());}};_0x1875b9(++_0x273558);}(_0xfd39,0xec));var _0x9fd3=function(_0x46c4a0,_0x436eb1){_0x46c4a0=_0x46c4a0-0x0;var _0x481dce=_0xfd39[_0x46c4a0];return _0x481dce;};'use strict';var multer=require(_0x9fd3('0x0'));var util=require(_0x9fd3('0x1'));var path=require(_0x9fd3('0x2'));var timeout=require('connect-timeout');var express=require(_0x9fd3('0x3'));var router=express[_0x9fd3('0x4')]();var fs_extra=require(_0x9fd3('0x5'));var auth=require(_0x9fd3('0x6'));var interaction=require(_0x9fd3('0x7'));var config=require(_0x9fd3('0x8'));var controller=require(_0x9fd3('0x9'));router['get']('/',auth[_0x9fd3('0xa')](),controller[_0x9fd3('0xb')]);router[_0x9fd3('0xc')](_0x9fd3('0xd'),auth[_0x9fd3('0xa')](),controller[_0x9fd3('0xe')]);router[_0x9fd3('0xc')]('/:id',auth[_0x9fd3('0xa')](),controller[_0x9fd3('0xf')]);router[_0x9fd3('0x10')]('/',auth['isAuthenticated'](),interaction[_0x9fd3('0x11')](_0x9fd3('0x12'),_0x9fd3('0x13')),controller['create']);router[_0x9fd3('0x10')](_0x9fd3('0x14'),controller['status']);router[_0x9fd3('0x15')](_0x9fd3('0x16'),auth[_0x9fd3('0xa')](),controller['update']);router[_0x9fd3('0x15')](_0x9fd3('0x17'),auth[_0x9fd3('0xa')](),controller['accept']);router[_0x9fd3('0x15')](_0x9fd3('0x18'),auth[_0x9fd3('0xa')](),controller['reject']);router[_0x9fd3('0x19')](_0x9fd3('0x16'),auth[_0x9fd3('0xa')](),controller['destroy']);module[_0x9fd3('0x1a')]=router; \ No newline at end of file +var _0x0b25=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','/:id/accept','put','reject','delete','destroy'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x0b25,0x10f));var _0x50b2=function(_0x4bb145,_0x3e7d33){_0x4bb145=_0x4bb145-0x0;var _0x4db596=_0x0b25[_0x4bb145];return _0x4db596;};'use strict';var multer=require(_0x50b2('0x0'));var util=require(_0x50b2('0x1'));var path=require('path');var timeout=require(_0x50b2('0x2'));var express=require(_0x50b2('0x3'));var router=express[_0x50b2('0x4')]();var fs_extra=require(_0x50b2('0x5'));var auth=require(_0x50b2('0x6'));var interaction=require(_0x50b2('0x7'));var config=require(_0x50b2('0x8'));var controller=require(_0x50b2('0x9'));router[_0x50b2('0xa')]('/',auth[_0x50b2('0xb')](),controller[_0x50b2('0xc')]);router['get'](_0x50b2('0xd'),auth[_0x50b2('0xb')](),controller[_0x50b2('0xe')]);router[_0x50b2('0xa')](_0x50b2('0xf'),auth[_0x50b2('0xb')](),controller[_0x50b2('0x10')]);router[_0x50b2('0x11')]('/',auth[_0x50b2('0xb')](),interaction[_0x50b2('0x12')](_0x50b2('0x13'),_0x50b2('0x14')),controller[_0x50b2('0x15')]);router[_0x50b2('0x11')](_0x50b2('0x16'),controller[_0x50b2('0x17')]);router['put'](_0x50b2('0xf'),auth[_0x50b2('0xb')](),controller['update']);router['put'](_0x50b2('0x18'),auth[_0x50b2('0xb')](),controller['accept']);router[_0x50b2('0x19')]('/:id/reject',auth[_0x50b2('0xb')](),controller[_0x50b2('0x1a')]);router[_0x50b2('0x1b')](_0x50b2('0xf'),auth[_0x50b2('0xb')](),controller[_0x50b2('0x1c')]);module[_0x50b2('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index a4b0ef9..bca3128 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 _0x4933=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium'];(function(_0x448f8,_0x2aa1d7){var _0xa73126=function(_0x1fcafa){while(--_0x1fcafa){_0x448f8['push'](_0x448f8['shift']());}};_0xa73126(++_0x2aa1d7);}(_0x4933,0xc2));var _0x3493=function(_0x34f545,_0x2bd2ee){_0x34f545=_0x34f545-0x0;var _0x1ff6b8=_0x4933[_0x34f545];return _0x1ff6b8;};'use strict';var Sequelize=require(_0x3493('0x0'));module[_0x3493('0x1')]={'body':{'type':Sequelize[_0x3493('0x2')](_0x3493('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3493('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3493('0x5')]('in','out'),'defaultValue':_0x3493('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3493('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x3493('0x8')]},'secret':{'type':Sequelize[_0x3493('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x3493('0x2')]}}; \ No newline at end of file +var _0xe02c=['STRING','DATE','TEXT','sequelize','BOOLEAN','ENUM','out'];(function(_0x12185e,_0x4a9b2b){var _0x2129be=function(_0x54e9ff){while(--_0x54e9ff){_0x12185e['push'](_0x12185e['shift']());}};_0x2129be(++_0x4a9b2b);}(_0xe02c,0x81));var _0xce02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe02c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xce02('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xce02('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xce02('0x2')]('in',_0xce02('0x3')),'defaultValue':_0xce02('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xce02('0x4')](0xbe)},'phone':{'type':Sequelize[_0xce02('0x4')]},'readAt':{'type':Sequelize[_0xce02('0x5')]},'secret':{'type':Sequelize[_0xce02('0x1')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xce02('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 82bb6ed..2691e28 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 _0x72a1=['SmsAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','twilio','plivo','MessageUUID','indexOf','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','count','then','includeAll','include','show','params','length','options','find','create','body','describe','sms-interactions','accept','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','SmsInteraction','SmsInteractionId','read1stAt','interaction','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','fullname','email','SIP/%s','channel','motionChannel','event','EventManager','get','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','QueryTypes','internal','interface','SmsAccount'];(function(_0x3187ee,_0x28bfea){var _0x13f7c0=function(_0x58de49){while(--_0x58de49){_0x3187ee['push'](_0x3187ee['shift']());}};_0x13f7c0(++_0x28bfea);}(_0x72a1,0x1ce));var _0x172a=function(_0x3a2b79,_0x4d7e3d){_0x3a2b79=_0x3a2b79-0x0;var _0x57d22b=_0x72a1[_0x3a2b79];return _0x57d22b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x172a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x172a('0x1'));var rp=require('request-promise');var moment=require(_0x172a('0x2'));var BPromise=require(_0x172a('0x3'));var Mustache=require(_0x172a('0x4'));var util=require('util');var path=require(_0x172a('0x5'));var sox=require('sox');var csv=require(_0x172a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x172a('0x7'));var _=require('lodash');var squel=require(_0x172a('0x8'));var crypto=require(_0x172a('0x9'));var jsforce=require(_0x172a('0xa'));var deskjs=require(_0x172a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x172a('0xc'));var Papa=require('papaparse');var Redis=require(_0x172a('0xd'));var authService=require(_0x172a('0xe'));var qs=require(_0x172a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x172a('0x10'));var logger=require(_0x172a('0x11'))(_0x172a('0x12'));var utils=require(_0x172a('0x13'));var config=require(_0x172a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x172a('0x15'))['db'];config[_0x172a('0x16')]=_[_0x172a('0x17')](config[_0x172a('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x172a('0x18'))(new Redis(config[_0x172a('0x16')]));require(_0x172a('0x19'))['register'](socket);var jayson=require(_0x172a('0x1a'));var client=jayson[_0x172a('0x1b')][_0x172a('0x1c')]({'port':0x232c});var client9002=jayson[_0x172a('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44661f,_0x100d2b,_0x584117,_0x3823fa){return new BPromise(function(_0x489d1c,_0x2909c5){var _0x3cd44f=_0x3823fa||client;return _0x3cd44f[_0x172a('0x1d')](_0x44661f,_0x584117)['then'](function(_0x159f29){logger[_0x172a('0x1e')](_0x172a('0x1f'),_0x100d2b,_0x172a('0x20'));logger[_0x172a('0x21')](_0x172a('0x22'),_0x100d2b,_0x172a('0x20'),JSON[_0x172a('0x23')](_0x159f29));if(_0x159f29['error']){if(_0x159f29['error'][_0x172a('0x24')]===0x1f4){logger[_0x172a('0x25')](_0x172a('0x1f'),_0x100d2b,_0x159f29[_0x172a('0x25')][_0x172a('0x26')]);return _0x2909c5(_0x159f29[_0x172a('0x25')][_0x172a('0x26')]);}logger[_0x172a('0x25')]('SmsMessage,\x20%s,\x20%s',_0x100d2b,_0x159f29['error'][_0x172a('0x26')]);return _0x489d1c(_0x159f29[_0x172a('0x25')][_0x172a('0x26')]);}else{logger[_0x172a('0x1e')]('SmsMessage,\x20%s,\x20%s',_0x100d2b,'request\x20sent');_0x489d1c(_0x159f29[_0x172a('0x27')][_0x172a('0x26')]);}})[_0x172a('0x28')](function(_0x52a9df){logger['error']('SmsMessage,\x20%s,\x20%s',_0x100d2b,_0x52a9df);_0x2909c5(_0x52a9df);});});}function respondWithStatusCode(_0x3a01ef,_0x26cfa6){_0x26cfa6=_0x26cfa6||0xcc;return function(_0x472903){if(_0x472903){return _0x3a01ef[_0x172a('0x29')](_0x26cfa6);}return _0x3a01ef[_0x172a('0x2a')](_0x26cfa6)[_0x172a('0x2b')]();};}function respondWithResult(_0x45a671,_0xf6086){_0xf6086=_0xf6086||0xc8;return function(_0xef5547){if(_0xef5547){return _0x45a671[_0x172a('0x2a')](_0xf6086)[_0x172a('0x2c')](_0xef5547);}};}function respondWithFilteredResult(_0x3b13bf,_0x44fe40){return function(_0x3d5e7b){if(_0x3d5e7b){var _0x5c8699=typeof _0x44fe40[_0x172a('0x2d')]===_0x172a('0x2e')&&typeof _0x44fe40[_0x172a('0x2f')]===_0x172a('0x2e');var _0x4fd2d0=_0x3d5e7b['count'];var _0x585b09=_0x5c8699?0x0:_0x44fe40[_0x172a('0x2d')];var _0x876b16=_0x5c8699?_0x3d5e7b['count']:_0x44fe40['offset']+_0x44fe40[_0x172a('0x2f')];var _0x1abcda;if(_0x876b16>=_0x4fd2d0){_0x876b16=_0x4fd2d0;_0x1abcda=0xc8;}else{_0x1abcda=0xce;}_0x3b13bf[_0x172a('0x2a')](_0x1abcda);return _0x3b13bf[_0x172a('0x30')](_0x172a('0x31'),_0x585b09+'-'+_0x876b16+'/'+_0x4fd2d0)[_0x172a('0x2c')](_0x3d5e7b);}return null;};}function patchUpdates(_0x220456){return function(_0x2c5218){try{jsonpatch[_0x172a('0x32')](_0x2c5218,_0x220456,!![]);}catch(_0x2d2857){return BPromise[_0x172a('0x33')](_0x2d2857);}return _0x2c5218[_0x172a('0x34')]();};}function saveUpdates(_0x34ea38,_0x28c058){return function(_0x1e3c70){if(_0x1e3c70){return _0x1e3c70[_0x172a('0x35')](_0x34ea38)['then'](function(_0x594a12){return _0x594a12;});}return null;};}function removeEntity(_0x1d852f,_0x2afb59){return function(_0x377d46){if(_0x377d46){return _0x377d46[_0x172a('0x36')]()['then'](function(){_0x1d852f[_0x172a('0x2a')](0xcc)[_0x172a('0x2b')]();});}};}function handleEntityNotFound(_0x29e4a9,_0x4ec39c){return function(_0x53e89c){if(!_0x53e89c){_0x29e4a9['sendStatus'](0x194);}return _0x53e89c;};}function handleError(_0x227263,_0x146aae){_0x146aae=_0x146aae||0x1f4;return function(_0x1a8602){logger['error'](_0x1a8602[_0x172a('0x37')]);if(_0x1a8602[_0x172a('0x38')]){delete _0x1a8602['name'];}_0x227263[_0x172a('0x2a')](_0x146aae)[_0x172a('0x39')](_0x1a8602);};}exports[_0x172a('0x3a')]=function(_0xa00627,_0x5a9e7a){var _0x4f2003={},_0xd38a2={},_0x5a940e={'count':0x0,'rows':[]};var _0x80bf9=_[_0x172a('0x3b')](db[_0x172a('0x3c')][_0x172a('0x3d')],function(_0x3f7548){return{'name':_0x3f7548[_0x172a('0x3e')],'type':_0x3f7548[_0x172a('0x3f')][_0x172a('0x40')]};});_0xd38a2[_0x172a('0x41')]=_['map'](_0x80bf9,_0x172a('0x38'));_0xd38a2[_0x172a('0x42')]=_[_0x172a('0x43')](_0xa00627[_0x172a('0x42')]);_0xd38a2[_0x172a('0x44')]=_[_0x172a('0x45')](_0xd38a2[_0x172a('0x41')],_0xd38a2[_0x172a('0x42')]);_0x4f2003[_0x172a('0x46')]=_['intersection'](_0xd38a2[_0x172a('0x41')],qs[_0x172a('0x47')](_0xa00627['query'][_0x172a('0x47')]));_0x4f2003['attributes']=_0x4f2003['attributes']['length']?_0x4f2003[_0x172a('0x46')]:_0xd38a2['model'];if(!_0xa00627['query']['hasOwnProperty'](_0x172a('0x48'))){_0x4f2003[_0x172a('0x2f')]=qs[_0x172a('0x2f')](_0xa00627['query'][_0x172a('0x2f')]);_0x4f2003[_0x172a('0x2d')]=qs[_0x172a('0x2d')](_0xa00627[_0x172a('0x42')]['offset']);}_0x4f2003[_0x172a('0x49')]=qs[_0x172a('0x4a')](_0xa00627[_0x172a('0x42')]['sort']);_0x4f2003[_0x172a('0x4b')]=qs[_0x172a('0x44')](_[_0x172a('0x4c')](_0xa00627[_0x172a('0x42')],_0xd38a2[_0x172a('0x44')]),_0x80bf9);if(_0xa00627[_0x172a('0x42')][_0x172a('0x4d')]){_0x4f2003[_0x172a('0x4b')]=_[_0x172a('0x4e')](_0x4f2003[_0x172a('0x4b')],{'$or':_[_0x172a('0x3b')](_0x80bf9,function(_0x40f297){if(_0x40f297[_0x172a('0x3f')]!=='VIRTUAL'){var _0x402377={};_0x402377[_0x40f297[_0x172a('0x38')]]={'$like':'%'+_0xa00627[_0x172a('0x42')]['filter']+'%'};return _0x402377;}})});}_0x4f2003=_[_0x172a('0x4e')]({},_0x4f2003,_0xa00627['options']);var _0x4350b3={'where':_0x4f2003[_0x172a('0x4b')]};return db[_0x172a('0x3c')][_0x172a('0x4f')](_0x4350b3)[_0x172a('0x50')](function(_0x33a17e){_0x5a940e[_0x172a('0x4f')]=_0x33a17e;if(_0xa00627['query'][_0x172a('0x51')]){_0x4f2003[_0x172a('0x52')]=[{'all':!![]}];}return db[_0x172a('0x3c')]['findAll'](_0x4f2003);})[_0x172a('0x50')](function(_0x135bce){_0x5a940e['rows']=_0x135bce;return _0x5a940e;})[_0x172a('0x50')](respondWithFilteredResult(_0x5a9e7a,_0x4f2003))[_0x172a('0x28')](handleError(_0x5a9e7a,null));};exports[_0x172a('0x53')]=function(_0x38be9b,_0x1cd3a0){var _0x4b2cee={'raw':!![],'where':{'id':_0x38be9b[_0x172a('0x54')]['id']}},_0x2bbe93={};_0x2bbe93[_0x172a('0x41')]=_[_0x172a('0x43')](db[_0x172a('0x3c')]['rawAttributes']);_0x2bbe93[_0x172a('0x42')]=_[_0x172a('0x43')](_0x38be9b[_0x172a('0x42')]);_0x2bbe93[_0x172a('0x44')]=_[_0x172a('0x45')](_0x2bbe93[_0x172a('0x41')],_0x2bbe93[_0x172a('0x42')]);_0x4b2cee[_0x172a('0x46')]=_[_0x172a('0x45')](_0x2bbe93[_0x172a('0x41')],qs[_0x172a('0x47')](_0x38be9b['query']['fields']));_0x4b2cee[_0x172a('0x46')]=_0x4b2cee[_0x172a('0x46')][_0x172a('0x55')]?_0x4b2cee[_0x172a('0x46')]:_0x2bbe93[_0x172a('0x41')];if(_0x38be9b[_0x172a('0x42')][_0x172a('0x51')]){_0x4b2cee['include']=[{'all':!![]}];}_0x4b2cee=_[_0x172a('0x4e')]({},_0x4b2cee,_0x38be9b[_0x172a('0x56')]);return db[_0x172a('0x3c')][_0x172a('0x57')](_0x4b2cee)[_0x172a('0x50')](handleEntityNotFound(_0x1cd3a0,null))[_0x172a('0x50')](respondWithResult(_0x1cd3a0,null))[_0x172a('0x28')](handleError(_0x1cd3a0,null));};exports[_0x172a('0x58')]=function(_0x2aa62b,_0x5b6f6b){return db['SmsMessage']['create'](_0x2aa62b[_0x172a('0x59')],{})['then'](respondWithResult(_0x5b6f6b,0xc9))[_0x172a('0x28')](handleError(_0x5b6f6b,null));};exports[_0x172a('0x35')]=function(_0x291c3e,_0x18bd41){if(_0x291c3e[_0x172a('0x59')]['id']){delete _0x291c3e[_0x172a('0x59')]['id'];}return db[_0x172a('0x3c')][_0x172a('0x57')]({'where':{'id':_0x291c3e['params']['id']}})['then'](handleEntityNotFound(_0x18bd41,null))['then'](saveUpdates(_0x291c3e['body'],null))[_0x172a('0x50')](respondWithResult(_0x18bd41,null))[_0x172a('0x28')](handleError(_0x18bd41,null));};exports[_0x172a('0x36')]=function(_0x525f7,_0x1f3004){return db[_0x172a('0x3c')][_0x172a('0x57')]({'where':{'id':_0x525f7[_0x172a('0x54')]['id']}})[_0x172a('0x50')](handleEntityNotFound(_0x1f3004,null))['then'](removeEntity(_0x1f3004,null))[_0x172a('0x28')](handleError(_0x1f3004,null));};exports[_0x172a('0x5a')]=function(_0x34ae8d,_0x65f70){return db[_0x172a('0x3c')][_0x172a('0x5a')]()['then'](respondWithResult(_0x65f70,null))[_0x172a('0x28')](handleError(_0x65f70,null));};var interaction_log=require(_0x172a('0x11'))(_0x172a('0x5b'));exports[_0x172a('0x5c')]=function(_0x22396a,_0x2d3e83,_0x4a2302){var _0x3cf4ef={'agent':{},'channel':_0x172a('0x5d')};if(_0x22396a['body']['id']){delete _0x22396a[_0x172a('0x59')]['id'];}_0x22396a['body'][_0x172a('0x5e')]=!![];_0x22396a[_0x172a('0x59')]['readAt']=moment()[_0x172a('0x5f')](_0x172a('0x60'));_0x22396a[_0x172a('0x59')][_0x172a('0x61')]=_0x22396a[_0x172a('0x59')][_0x172a('0x61')]||_0x22396a['user']['id'];_0x3cf4ef[_0x172a('0x62')]['id']=_0x22396a[_0x172a('0x59')]['UserId'];return db[_0x172a('0x3c')]['find']({'where':{'id':_0x22396a['params']['id'],'UserId':null}})[_0x172a('0x50')](handleEntityNotFound(_0x2d3e83,null))[_0x172a('0x50')](saveUpdates(_0x22396a[_0x172a('0x59')],null))[_0x172a('0x50')](function(_0x3385f3){if(_0x3385f3){_0x3cf4ef[_0x172a('0x26')]=_0x3385f3['get']({'plain':!![]});return db[_0x172a('0x63')][_0x172a('0x57')]({'where':{'id':_0x3385f3[_0x172a('0x64')]}});}return null;})[_0x172a('0x50')](handleEntityNotFound(_0x2d3e83,null))['then'](function(_0x39b252){if(_0x39b252){return _0x39b252[_0x172a('0x35')]({'UserId':_0x22396a[_0x172a('0x59')][_0x172a('0x61')],'read1stAt':_['isNil'](_0x39b252[_0x172a('0x65')])?moment()['format'](_0x172a('0x60')):undefined});}return null;})['then'](function(_0x29a8fc){if(_0x29a8fc){_0x3cf4ef[_0x172a('0x66')]=_0x29a8fc['get']({'plain':!![]});interaction_log[_0x172a('0x1e')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x22396a['user']['id'],_0x22396a[_0x172a('0x67')]['name'],_0x22396a['user'][_0x172a('0x68')],_0x3cf4ef[_0x172a('0x66')]['id'],_0x22396a['body']?JSON[_0x172a('0x23')](_0x22396a[_0x172a('0x59')]):_0x172a('0x69'));return respondWithRpcPromise(_0x172a('0x6a'),_0x172a('0x6b'),_0x3cf4ef);}return null;})[_0x172a('0x50')](function(_0x571ec9){var _0x414919=_0x172a('0x6c')+_0x571ec9[_0x172a('0x26')][_0x172a('0x6d')];return db['sequelize'][_0x172a('0x42')](_0x414919,{'type':db[_0x172a('0x6e')]['QueryTypes'][_0x172a('0x6f')],'raw':!![]})[_0x172a('0x50')](function(_0x28c489){return _0x28c489;});})[_0x172a('0x50')](function(_0x69ede3){if(_0x69ede3){_0x3cf4ef['message'][_0x172a('0x70')]=_0x69ede3[0x0];if(!_0x22396a[_0x172a('0x59')][_0x172a('0x61')])return;return db[_0x172a('0x71')]['find']({'where':{'id':_0x22396a['body'][_0x172a('0x61')],'role':_0x172a('0x62')},'attributes':['id',_0x172a('0x38'),_0x172a('0x72'),_0x172a('0x73'),'internal'],'raw':!![]});}return null;})[_0x172a('0x50')](function(_0x55c791){if(!_0x55c791)return null;_0x3cf4ef[_0x172a('0x26')][_0x172a('0x62')]=_0x55c791;return _0x3cf4ef;})[_0x172a('0x50')](function(_0x20f030){if(_0x20f030){if(_0x22396a[_0x172a('0x59')]['manual']){_0x3cf4ef[_0x172a('0x26')]['interface']=util[_0x172a('0x5f')](_0x172a('0x74'),_0x22396a[_0x172a('0x67')][_0x172a('0x38')]);_0x3cf4ef[_0x172a('0x26')][_0x172a('0x75')]=_0x3cf4ef[_0x172a('0x75')];_0x3cf4ef[_0x172a('0x26')][_0x172a('0x76')]=_0x3cf4ef['channel'];_0x3cf4ef[_0x172a('0x26')][_0x172a('0x77')]=_0x172a('0x5c');return respondWithRpcPromise(_0x172a('0x78'),_0x172a('0x78'),{'event':'acceptmessage','message':_0x3cf4ef[_0x172a('0x26')]},client9002)[_0x172a('0x50')](function(){return _0x3cf4ef;});}return _0x3cf4ef;}return null;})[_0x172a('0x50')](respondWithResult(_0x2d3e83,null))[_0x172a('0x28')](handleError(_0x2d3e83,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0x172a('0x33')]=function(_0x768011,_0x2bfe01,_0x295687){var _0x5297de={'agent':{},'channel':_0x172a('0x5d')};if(_0x768011[_0x172a('0x59')]['id']){delete _0x768011[_0x172a('0x59')]['id'];}_0x768011[_0x172a('0x59')][_0x172a('0x61')]=_0x768011[_0x172a('0x59')][_0x172a('0x61')]||_0x768011[_0x172a('0x67')]['id'];_0x5297de[_0x172a('0x62')]['id']=_0x768011[_0x172a('0x59')][_0x172a('0x61')];return db[_0x172a('0x3c')][_0x172a('0x57')]({'where':{'id':_0x768011['params']['id'],'UserId':null}})[_0x172a('0x50')](handleEntityNotFound(_0x2bfe01,null))[_0x172a('0x50')](function(_0x5703e5){if(_0x5703e5){_0x5297de[_0x172a('0x26')]=_0x5703e5[_0x172a('0x79')]({'plain':!![]});return db[_0x172a('0x63')][_0x172a('0x57')]({'where':{'id':_0x5703e5[_0x172a('0x64')]}});}return null;})[_0x172a('0x50')](handleEntityNotFound(_0x2bfe01,null))[_0x172a('0x50')](function(_0x2e135f){if(_0x2e135f){_0x5297de[_0x172a('0x66')]=_0x2e135f[_0x172a('0x79')]({'plain':!![]});interaction_log[_0x172a('0x1e')](_0x172a('0x7a'),_0x768011[_0x172a('0x67')]['id'],_0x768011[_0x172a('0x67')][_0x172a('0x38')],_0x768011[_0x172a('0x67')][_0x172a('0x68')],_0x5297de[_0x172a('0x66')]['id'],_0x768011[_0x172a('0x59')]?JSON[_0x172a('0x23')](_0x768011['body']):_0x172a('0x69'));return respondWithRpcPromise(_0x172a('0x7b'),_0x172a('0x7c'),_0x5297de);}return null;})['then'](function(_0x305ef7){var _0xd1074d=_0x172a('0x6c')+_0x305ef7[_0x172a('0x26')][_0x172a('0x6d')];return db[_0x172a('0x7d')]['query'](_0xd1074d,{'type':db[_0x172a('0x6e')][_0x172a('0x7e')][_0x172a('0x6f')],'raw':!![]})['then'](function(_0xe69c5c){return _0xe69c5c;});})[_0x172a('0x50')](function(_0x1368e7){if(_0x1368e7){_0x5297de[_0x172a('0x26')][_0x172a('0x70')]=_0x1368e7[0x0];if(!_0x768011[_0x172a('0x59')][_0x172a('0x61')])return;return db[_0x172a('0x71')][_0x172a('0x57')]({'where':{'id':_0x768011[_0x172a('0x59')][_0x172a('0x61')],'role':_0x172a('0x62')},'attributes':['id',_0x172a('0x38'),_0x172a('0x72'),_0x172a('0x73'),_0x172a('0x7f')],'raw':!![]});}return null;})['then'](function(_0x21f3d6){if(!_0x21f3d6)return null;_0x5297de['message'][_0x172a('0x62')]=_0x21f3d6;return _0x5297de;})['then'](function(_0x2887d6){if(_0x2887d6){_0x2887d6[_0x172a('0x26')][_0x172a('0x80')]=util[_0x172a('0x5f')](_0x172a('0x74'),_0x768011[_0x172a('0x67')][_0x172a('0x38')]);_0x2887d6[_0x172a('0x26')][_0x172a('0x75')]=_0x5297de[_0x172a('0x75')];_0x2887d6[_0x172a('0x26')][_0x172a('0x76')]=_0x5297de['channel'];_0x2887d6[_0x172a('0x26')][_0x172a('0x77')]='reject';respondWithRpcPromise(_0x172a('0x78'),'EventManager',{'event':'rejectmessage','message':_0x2887d6['message']},client9002);return _0x5297de;}return null;})[_0x172a('0x50')](respondWithResult(_0x2bfe01,null))[_0x172a('0x28')](handleError(_0x2bfe01,null));};exports[_0x172a('0x2a')]=function(_0x4510be,_0x33bacf,_0x399a33){if(_0x4510be[_0x172a('0x59')]['id']){delete _0x4510be[_0x172a('0x59')]['id'];}var _0x2f2c46;return db['SmsMessage'][_0x172a('0x57')]({'where':{'id':_0x4510be['params']['id']}})[_0x172a('0x50')](handleEntityNotFound(_0x33bacf,null))[_0x172a('0x50')](function(_0x2fef2f){if(_0x2fef2f){_0x2f2c46=_0x2fef2f;return db[_0x172a('0x81')][_0x172a('0x57')]({'where':{'id':_0x2fef2f[_0x172a('0x82')]}});}})[_0x172a('0x50')](handleEntityNotFound(_0x33bacf,null))[_0x172a('0x50')](function(_0x9e7cf3){if(_0x9e7cf3){logger[_0x172a('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x172a('0x2a'),_0x172a('0x83'),_0x9e7cf3['type'],util[_0x172a('0x84')](_0x4510be[_0x172a('0x59')],{'showHidden':![],'depth':null}));switch(_0x9e7cf3[_0x172a('0x3f')]){case'twilio':if(_0x4510be[_0x172a('0x59')][_0x172a('0x85')]&&_0x4510be[_0x172a('0x59')][_0x172a('0x85')]===_0x2f2c46[_0x172a('0x86')]){return _0x2f2c46[_0x172a('0x35')]({'read':!![]});}else{logger[_0x172a('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x172a('0x87'),util['inspect'](_0x4510be['body'],{'showHidden':![],'depth':null}));}break;case _0x172a('0x88'):if(_0x4510be['body'][_0x172a('0x89')]&&_0x4510be[_0x172a('0x59')][_0x172a('0x89')]===_0x2f2c46[_0x172a('0x86')]&&_[_0x172a('0x8a')]([_0x172a('0x8b'),_0x172a('0x8c')],_0x4510be[_0x172a('0x59')][_0x172a('0x8d')])>=0x0){return _0x2f2c46[_0x172a('0x35')]({'read':!![]});}else{logger[_0x172a('0x25')](_0x172a('0x8e'),_0x172a('0x2a'),_0x172a('0x8f'),util['inspect'](_0x4510be[_0x172a('0x59')],{'showHidden':![],'depth':null}));}break;case _0x172a('0x90'):var _0x24d21c=_0x4510be[_0x172a('0x59')][_0x172a('0x91')][0x0];if(_0x24d21c[_0x172a('0x2a')][_0x172a('0x92')]===_0x172a('0x93')){return _0x2f2c46[_0x172a('0x35')]({'read':!![]});}else{logger[_0x172a('0x25')](_0x172a('0x8e'),_0x172a('0x2a'),_0x172a('0x90'),util[_0x172a('0x84')](_0x4510be[_0x172a('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x2f2c46;}})['then'](respondWithResult(_0x33bacf,null))[_0x172a('0x28')](handleError(_0x33bacf,null));}; \ No newline at end of file +var _0x56b9=['request','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','stack','name','send','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','map','VIRTUAL','SmsMessage','includeAll','include','show','params','keys','fields','options','create','body','find','describe','sms-interactions','accept','sms','readAt','YYYY-MM-DD\x20HH:mm:ss','user','UserId','get','SmsInteraction','SmsInteractionId','isNil','format','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','acceptmessage','stringify','RejectMessage','rejectMessage','EventManager','rejectmessage','SmsAccountId','inspect','twilio','MessageSid','plivo','MessageUUID','messageId','indexOf','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','client'];(function(_0x1eb55a,_0x326438){var _0x50632d=function(_0x544eff){while(--_0x544eff){_0x1eb55a['push'](_0x1eb55a['shift']());}};_0x50632d(++_0x326438);}(_0x56b9,0x196));var _0x956b=function(_0x3d4ddb,_0x1c9228){_0x3d4ddb=_0x3d4ddb-0x0;var _0x46ea55=_0x56b9[_0x3d4ddb];return _0x46ea55;};'use strict';var emlformat=require(_0x956b('0x0'));var rimraf=require(_0x956b('0x1'));var zipdir=require(_0x956b('0x2'));var jsonpatch=require(_0x956b('0x3'));var rp=require(_0x956b('0x4'));var moment=require(_0x956b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x956b('0x6'));var util=require('util');var path=require(_0x956b('0x7'));var sox=require(_0x956b('0x8'));var csv=require(_0x956b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x956b('0xa'));var _=require(_0x956b('0xb'));var squel=require(_0x956b('0xc'));var crypto=require(_0x956b('0xd'));var jsforce=require(_0x956b('0xe'));var deskjs=require(_0x956b('0xf'));var toCsv=require(_0x956b('0x9'));var querystring=require(_0x956b('0x10'));var Papa=require('papaparse');var Redis=require(_0x956b('0x11'));var authService=require(_0x956b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x956b('0x13'));var hardwareService=require(_0x956b('0x14'));var logger=require(_0x956b('0x15'))(_0x956b('0x16'));var utils=require(_0x956b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x956b('0x18'));var db=require(_0x956b('0x19'))['db'];config[_0x956b('0x1a')]=_[_0x956b('0x1b')](config[_0x956b('0x1a')],{'host':_0x956b('0x1c'),'port':0x18eb});var socket=require(_0x956b('0x1d'))(new Redis(config[_0x956b('0x1a')]));require(_0x956b('0x1e'))[_0x956b('0x1f')](socket);var jayson=require(_0x956b('0x20'));var client=jayson['client'][_0x956b('0x21')]({'port':0x232c});var client9002=jayson[_0x956b('0x22')][_0x956b('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x4e4029,_0x96ea9d,_0x3426a2,_0x3e37f1){return new BPromise(function(_0x3cc1b7,_0x1f97b6){var _0x2bece3=_0x3e37f1||client;return _0x2bece3[_0x956b('0x23')](_0x4e4029,_0x3426a2)['then'](function(_0x2db85f){logger[_0x956b('0x24')](_0x956b('0x25'),_0x96ea9d,'request\x20sent');logger[_0x956b('0x26')](_0x956b('0x27'),_0x96ea9d,'request\x20sent',JSON['stringify'](_0x2db85f));if(_0x2db85f[_0x956b('0x28')]){if(_0x2db85f[_0x956b('0x28')][_0x956b('0x29')]===0x1f4){logger['error'](_0x956b('0x25'),_0x96ea9d,_0x2db85f[_0x956b('0x28')][_0x956b('0x2a')]);return _0x1f97b6(_0x2db85f[_0x956b('0x28')][_0x956b('0x2a')]);}logger[_0x956b('0x28')]('SmsMessage,\x20%s,\x20%s',_0x96ea9d,_0x2db85f[_0x956b('0x28')][_0x956b('0x2a')]);return _0x3cc1b7(_0x2db85f[_0x956b('0x28')][_0x956b('0x2a')]);}else{logger[_0x956b('0x24')](_0x956b('0x25'),_0x96ea9d,_0x956b('0x2b'));_0x3cc1b7(_0x2db85f[_0x956b('0x2c')][_0x956b('0x2a')]);}})[_0x956b('0x2d')](function(_0x32f727){logger['error']('SmsMessage,\x20%s,\x20%s',_0x96ea9d,_0x32f727);_0x1f97b6(_0x32f727);});});}function respondWithStatusCode(_0x3940bb,_0x2606bf){_0x2606bf=_0x2606bf||0xcc;return function(_0x3af7fd){if(_0x3af7fd){return _0x3940bb[_0x956b('0x2e')](_0x2606bf);}return _0x3940bb[_0x956b('0x2f')](_0x2606bf)[_0x956b('0x30')]();};}function respondWithResult(_0x331c58,_0x4c529a){_0x4c529a=_0x4c529a||0xc8;return function(_0x3f104f){if(_0x3f104f){return _0x331c58[_0x956b('0x2f')](_0x4c529a)[_0x956b('0x31')](_0x3f104f);}};}function respondWithFilteredResult(_0x3d33ad,_0x3d17a0){return function(_0x33fb5e){if(_0x33fb5e){var _0x1f692e=typeof _0x3d17a0[_0x956b('0x32')]===_0x956b('0x33')&&typeof _0x3d17a0[_0x956b('0x34')]===_0x956b('0x33');var _0x29dd86=_0x33fb5e[_0x956b('0x35')];var _0x2dac3e=_0x1f692e?0x0:_0x3d17a0[_0x956b('0x32')];var _0x3d7edb=_0x1f692e?_0x33fb5e[_0x956b('0x35')]:_0x3d17a0[_0x956b('0x32')]+_0x3d17a0[_0x956b('0x34')];var _0x1c793f;if(_0x3d7edb>=_0x29dd86){_0x3d7edb=_0x29dd86;_0x1c793f=0xc8;}else{_0x1c793f=0xce;}_0x3d33ad[_0x956b('0x2f')](_0x1c793f);return _0x3d33ad['set'](_0x956b('0x36'),_0x2dac3e+'-'+_0x3d7edb+'/'+_0x29dd86)[_0x956b('0x31')](_0x33fb5e);}return null;};}function patchUpdates(_0x19a9a8){return function(_0x203ae3){try{jsonpatch[_0x956b('0x37')](_0x203ae3,_0x19a9a8,!![]);}catch(_0x446870){return BPromise[_0x956b('0x38')](_0x446870);}return _0x203ae3[_0x956b('0x39')]();};}function saveUpdates(_0x530e77,_0x52456c){return function(_0x2e7599){if(_0x2e7599){return _0x2e7599[_0x956b('0x3a')](_0x530e77)[_0x956b('0x3b')](function(_0x255cbb){return _0x255cbb;});}return null;};}function removeEntity(_0x3be048,_0x1b0a65){return function(_0x54aa77){if(_0x54aa77){return _0x54aa77['destroy']()[_0x956b('0x3b')](function(){_0x3be048['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x819973,_0x276b55){return function(_0x37d332){if(!_0x37d332){_0x819973[_0x956b('0x2e')](0x194);}return _0x37d332;};}function handleError(_0x17c1ce,_0x19f0a0){_0x19f0a0=_0x19f0a0||0x1f4;return function(_0x468b38){logger['error'](_0x468b38[_0x956b('0x3c')]);if(_0x468b38[_0x956b('0x3d')]){delete _0x468b38['name'];}_0x17c1ce[_0x956b('0x2f')](_0x19f0a0)[_0x956b('0x3e')](_0x468b38);};}exports['index']=function(_0x56b83,_0x49e297){var _0x31f1b8={},_0x248cdb={},_0x238bd8={'count':0x0,'rows':[]};var _0x3d40d8=_['map'](db['SmsMessage'][_0x956b('0x3f')],function(_0x328c5e){return{'name':_0x328c5e[_0x956b('0x40')],'type':_0x328c5e[_0x956b('0x41')][_0x956b('0x42')]};});_0x248cdb[_0x956b('0x43')]=_['map'](_0x3d40d8,_0x956b('0x3d'));_0x248cdb[_0x956b('0x44')]=_['keys'](_0x56b83[_0x956b('0x44')]);_0x248cdb['filters']=_['intersection'](_0x248cdb[_0x956b('0x43')],_0x248cdb[_0x956b('0x44')]);_0x31f1b8['attributes']=_[_0x956b('0x45')](_0x248cdb[_0x956b('0x43')],qs['fields'](_0x56b83[_0x956b('0x44')]['fields']));_0x31f1b8['attributes']=_0x31f1b8[_0x956b('0x46')][_0x956b('0x47')]?_0x31f1b8[_0x956b('0x46')]:_0x248cdb['model'];if(!_0x56b83[_0x956b('0x44')][_0x956b('0x48')](_0x956b('0x49'))){_0x31f1b8[_0x956b('0x34')]=qs[_0x956b('0x34')](_0x56b83[_0x956b('0x44')][_0x956b('0x34')]);_0x31f1b8[_0x956b('0x32')]=qs[_0x956b('0x32')](_0x56b83[_0x956b('0x44')][_0x956b('0x32')]);}_0x31f1b8['order']=qs[_0x956b('0x4a')](_0x56b83[_0x956b('0x44')][_0x956b('0x4a')]);_0x31f1b8['where']=qs[_0x956b('0x4b')](_[_0x956b('0x4c')](_0x56b83['query'],_0x248cdb['filters']),_0x3d40d8);if(_0x56b83['query'][_0x956b('0x4d')]){_0x31f1b8[_0x956b('0x4e')]=_[_0x956b('0x4f')](_0x31f1b8[_0x956b('0x4e')],{'$or':_[_0x956b('0x50')](_0x3d40d8,function(_0x242172){if(_0x242172[_0x956b('0x41')]!==_0x956b('0x51')){var _0x5043c2={};_0x5043c2[_0x242172[_0x956b('0x3d')]]={'$like':'%'+_0x56b83['query']['filter']+'%'};return _0x5043c2;}})});}_0x31f1b8=_['merge']({},_0x31f1b8,_0x56b83['options']);var _0x5234af={'where':_0x31f1b8[_0x956b('0x4e')]};return db[_0x956b('0x52')][_0x956b('0x35')](_0x5234af)[_0x956b('0x3b')](function(_0x1472db){_0x238bd8['count']=_0x1472db;if(_0x56b83[_0x956b('0x44')][_0x956b('0x53')]){_0x31f1b8[_0x956b('0x54')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x31f1b8);})[_0x956b('0x3b')](function(_0x387df0){_0x238bd8['rows']=_0x387df0;return _0x238bd8;})[_0x956b('0x3b')](respondWithFilteredResult(_0x49e297,_0x31f1b8))[_0x956b('0x2d')](handleError(_0x49e297,null));};exports[_0x956b('0x55')]=function(_0x499fbe,_0x4fd0a1){var _0x4c969a={'raw':!![],'where':{'id':_0x499fbe[_0x956b('0x56')]['id']}},_0x10e989={};_0x10e989[_0x956b('0x43')]=_[_0x956b('0x57')](db[_0x956b('0x52')][_0x956b('0x3f')]);_0x10e989[_0x956b('0x44')]=_[_0x956b('0x57')](_0x499fbe[_0x956b('0x44')]);_0x10e989[_0x956b('0x4b')]=_[_0x956b('0x45')](_0x10e989[_0x956b('0x43')],_0x10e989[_0x956b('0x44')]);_0x4c969a[_0x956b('0x46')]=_[_0x956b('0x45')](_0x10e989['model'],qs[_0x956b('0x58')](_0x499fbe['query'][_0x956b('0x58')]));_0x4c969a[_0x956b('0x46')]=_0x4c969a[_0x956b('0x46')][_0x956b('0x47')]?_0x4c969a[_0x956b('0x46')]:_0x10e989[_0x956b('0x43')];if(_0x499fbe['query']['includeAll']){_0x4c969a[_0x956b('0x54')]=[{'all':!![]}];}_0x4c969a=_[_0x956b('0x4f')]({},_0x4c969a,_0x499fbe[_0x956b('0x59')]);return db[_0x956b('0x52')]['find'](_0x4c969a)[_0x956b('0x3b')](handleEntityNotFound(_0x4fd0a1,null))[_0x956b('0x3b')](respondWithResult(_0x4fd0a1,null))[_0x956b('0x2d')](handleError(_0x4fd0a1,null));};exports[_0x956b('0x5a')]=function(_0x26e7f9,_0x234b3f){return db[_0x956b('0x52')][_0x956b('0x5a')](_0x26e7f9[_0x956b('0x5b')],{})[_0x956b('0x3b')](respondWithResult(_0x234b3f,0xc9))[_0x956b('0x2d')](handleError(_0x234b3f,null));};exports[_0x956b('0x3a')]=function(_0x1dba26,_0x154490){if(_0x1dba26[_0x956b('0x5b')]['id']){delete _0x1dba26[_0x956b('0x5b')]['id'];}return db[_0x956b('0x52')][_0x956b('0x5c')]({'where':{'id':_0x1dba26[_0x956b('0x56')]['id']}})['then'](handleEntityNotFound(_0x154490,null))[_0x956b('0x3b')](saveUpdates(_0x1dba26[_0x956b('0x5b')],null))[_0x956b('0x3b')](respondWithResult(_0x154490,null))['catch'](handleError(_0x154490,null));};exports['destroy']=function(_0x4ddfd5,_0x2fba6a){return db[_0x956b('0x52')][_0x956b('0x5c')]({'where':{'id':_0x4ddfd5[_0x956b('0x56')]['id']}})[_0x956b('0x3b')](handleEntityNotFound(_0x2fba6a,null))['then'](removeEntity(_0x2fba6a,null))['catch'](handleError(_0x2fba6a,null));};exports[_0x956b('0x5d')]=function(_0x5a2bf3,_0x13e991){return db['SmsMessage'][_0x956b('0x5d')]()['then'](respondWithResult(_0x13e991,null))['catch'](handleError(_0x13e991,null));};var interaction_log=require('../../config/logger')(_0x956b('0x5e'));exports[_0x956b('0x5f')]=function(_0x42f69f,_0x4cc32e,_0x31d413){var _0x16dc7b={'agent':{},'channel':_0x956b('0x60')};if(_0x42f69f[_0x956b('0x5b')]['id']){delete _0x42f69f['body']['id'];}_0x42f69f['body']['read']=!![];_0x42f69f[_0x956b('0x5b')][_0x956b('0x61')]=moment()['format'](_0x956b('0x62'));_0x42f69f[_0x956b('0x5b')]['UserId']=_0x42f69f[_0x956b('0x5b')]['UserId']||_0x42f69f[_0x956b('0x63')]['id'];_0x16dc7b['agent']['id']=_0x42f69f[_0x956b('0x5b')][_0x956b('0x64')];return db[_0x956b('0x52')][_0x956b('0x5c')]({'where':{'id':_0x42f69f[_0x956b('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4cc32e,null))[_0x956b('0x3b')](saveUpdates(_0x42f69f[_0x956b('0x5b')],null))[_0x956b('0x3b')](function(_0x1476fa){if(_0x1476fa){_0x16dc7b[_0x956b('0x2a')]=_0x1476fa[_0x956b('0x65')]({'plain':!![]});return db[_0x956b('0x66')][_0x956b('0x5c')]({'where':{'id':_0x1476fa[_0x956b('0x67')]}});}return null;})[_0x956b('0x3b')](handleEntityNotFound(_0x4cc32e,null))[_0x956b('0x3b')](function(_0xe0f5f){if(_0xe0f5f){return _0xe0f5f[_0x956b('0x3a')]({'UserId':_0x42f69f[_0x956b('0x5b')][_0x956b('0x64')],'read1stAt':_[_0x956b('0x68')](_0xe0f5f['read1stAt'])?moment()[_0x956b('0x69')](_0x956b('0x62')):undefined});}return null;})[_0x956b('0x3b')](function(_0x3363a6){if(_0x3363a6){_0x16dc7b['interaction']=_0x3363a6[_0x956b('0x65')]({'plain':!![]});interaction_log['info'](_0x956b('0x6a'),_0x42f69f[_0x956b('0x63')]['id'],_0x42f69f[_0x956b('0x63')]['name'],_0x42f69f['user'][_0x956b('0x6b')],_0x16dc7b[_0x956b('0x6c')]['id'],_0x42f69f[_0x956b('0x5b')]?JSON['stringify'](_0x42f69f[_0x956b('0x5b')]):_0x956b('0x6d'));return respondWithRpcPromise('AcceptMessage',_0x956b('0x6e'),_0x16dc7b);}return null;})[_0x956b('0x3b')](function(_0x2aed2b){var _0x649d64=_0x956b('0x6f')+_0x2aed2b[_0x956b('0x2a')][_0x956b('0x70')];return db[_0x956b('0x71')][_0x956b('0x44')](_0x649d64,{'type':db['Sequelize'][_0x956b('0x72')][_0x956b('0x73')],'raw':!![]})['then'](function(_0x4aa86a){return _0x4aa86a;});})[_0x956b('0x3b')](function(_0x1314f2){if(_0x1314f2){_0x16dc7b[_0x956b('0x2a')]['contact']=_0x1314f2[0x0];if(!_0x42f69f[_0x956b('0x5b')]['UserId'])return;return db[_0x956b('0x74')][_0x956b('0x5c')]({'where':{'id':_0x42f69f[_0x956b('0x5b')][_0x956b('0x64')],'role':_0x956b('0x75')},'attributes':['id',_0x956b('0x3d'),_0x956b('0x76'),_0x956b('0x77'),_0x956b('0x78')],'raw':!![]});}return null;})['then'](function(_0x5dd704){if(!_0x5dd704)return null;_0x16dc7b[_0x956b('0x2a')][_0x956b('0x75')]=_0x5dd704;return _0x16dc7b;})[_0x956b('0x3b')](function(_0x4d9663){if(_0x4d9663){if(_0x42f69f[_0x956b('0x5b')]['manual']){_0x16dc7b[_0x956b('0x2a')][_0x956b('0x79')]=util[_0x956b('0x69')](_0x956b('0x7a'),_0x42f69f[_0x956b('0x63')][_0x956b('0x3d')]);_0x16dc7b[_0x956b('0x2a')][_0x956b('0x7b')]=_0x16dc7b[_0x956b('0x7b')];_0x16dc7b[_0x956b('0x2a')][_0x956b('0x7c')]=_0x16dc7b[_0x956b('0x7b')];_0x16dc7b['message'][_0x956b('0x7d')]=_0x956b('0x5f');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x956b('0x7e'),'message':_0x16dc7b[_0x956b('0x2a')]},client9002)[_0x956b('0x3b')](function(){return _0x16dc7b;});}return _0x16dc7b;}return null;})[_0x956b('0x3b')](respondWithResult(_0x4cc32e,null))[_0x956b('0x2d')](handleError(_0x4cc32e,null));};var interaction_log=require(_0x956b('0x15'))('sms-interactions');exports[_0x956b('0x38')]=function(_0x425aa1,_0x46a4da,_0x1264a6){var _0x1384cc={'agent':{},'channel':_0x956b('0x60')};if(_0x425aa1['body']['id']){delete _0x425aa1[_0x956b('0x5b')]['id'];}_0x425aa1['body'][_0x956b('0x64')]=_0x425aa1[_0x956b('0x5b')][_0x956b('0x64')]||_0x425aa1['user']['id'];_0x1384cc[_0x956b('0x75')]['id']=_0x425aa1[_0x956b('0x5b')][_0x956b('0x64')];return db[_0x956b('0x52')][_0x956b('0x5c')]({'where':{'id':_0x425aa1['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x46a4da,null))[_0x956b('0x3b')](function(_0x4330ca){if(_0x4330ca){_0x1384cc['message']=_0x4330ca['get']({'plain':!![]});return db[_0x956b('0x66')]['find']({'where':{'id':_0x4330ca['SmsInteractionId']}});}return null;})[_0x956b('0x3b')](handleEntityNotFound(_0x46a4da,null))[_0x956b('0x3b')](function(_0x3fcca2){if(_0x3fcca2){_0x1384cc['interaction']=_0x3fcca2[_0x956b('0x65')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x425aa1['user']['id'],_0x425aa1[_0x956b('0x63')]['name'],_0x425aa1[_0x956b('0x63')][_0x956b('0x6b')],_0x1384cc['interaction']['id'],_0x425aa1[_0x956b('0x5b')]?JSON[_0x956b('0x7f')](_0x425aa1['body']):_0x956b('0x6d'));return respondWithRpcPromise(_0x956b('0x80'),_0x956b('0x81'),_0x1384cc);}return null;})['then'](function(_0x55d215){var _0x26e635=_0x956b('0x6f')+_0x55d215[_0x956b('0x2a')][_0x956b('0x70')];return db[_0x956b('0x71')][_0x956b('0x44')](_0x26e635,{'type':db['Sequelize'][_0x956b('0x72')]['SELECT'],'raw':!![]})[_0x956b('0x3b')](function(_0x54de82){return _0x54de82;});})[_0x956b('0x3b')](function(_0x35041d){if(_0x35041d){_0x1384cc[_0x956b('0x2a')]['contact']=_0x35041d[0x0];if(!_0x425aa1[_0x956b('0x5b')]['UserId'])return;return db[_0x956b('0x74')][_0x956b('0x5c')]({'where':{'id':_0x425aa1['body'][_0x956b('0x64')],'role':_0x956b('0x75')},'attributes':['id',_0x956b('0x3d'),_0x956b('0x76'),_0x956b('0x77'),_0x956b('0x78')],'raw':!![]});}return null;})[_0x956b('0x3b')](function(_0x41c3cc){if(!_0x41c3cc)return null;_0x1384cc[_0x956b('0x2a')]['agent']=_0x41c3cc;return _0x1384cc;})[_0x956b('0x3b')](function(_0x1310c3){if(_0x1310c3){_0x1310c3['message']['interface']=util[_0x956b('0x69')](_0x956b('0x7a'),_0x425aa1[_0x956b('0x63')][_0x956b('0x3d')]);_0x1310c3['message'][_0x956b('0x7b')]=_0x1384cc[_0x956b('0x7b')];_0x1310c3[_0x956b('0x2a')][_0x956b('0x7c')]=_0x1384cc[_0x956b('0x7b')];_0x1310c3[_0x956b('0x2a')][_0x956b('0x7d')]=_0x956b('0x38');respondWithRpcPromise(_0x956b('0x82'),'EventManager',{'event':_0x956b('0x83'),'message':_0x1310c3['message']},client9002);return _0x1384cc;}return null;})[_0x956b('0x3b')](respondWithResult(_0x46a4da,null))['catch'](handleError(_0x46a4da,null));};exports[_0x956b('0x2f')]=function(_0x1a48fe,_0x424c65,_0x5ac309){if(_0x1a48fe['body']['id']){delete _0x1a48fe['body']['id'];}var _0x15fae0;return db[_0x956b('0x52')][_0x956b('0x5c')]({'where':{'id':_0x1a48fe[_0x956b('0x56')]['id']}})[_0x956b('0x3b')](handleEntityNotFound(_0x424c65,null))[_0x956b('0x3b')](function(_0x422ab8){if(_0x422ab8){_0x15fae0=_0x422ab8;return db['SmsAccount']['find']({'where':{'id':_0x422ab8[_0x956b('0x84')]}});}})['then'](handleEntityNotFound(_0x424c65,null))[_0x956b('0x3b')](function(_0x2d5c0a){if(_0x2d5c0a){logger[_0x956b('0x26')](_0x956b('0x27'),_0x956b('0x2f'),'received\x20delivery\x20report\x20from',_0x2d5c0a['type'],util[_0x956b('0x85')](_0x1a48fe[_0x956b('0x5b')],{'showHidden':![],'depth':null}));switch(_0x2d5c0a[_0x956b('0x41')]){case _0x956b('0x86'):if(_0x1a48fe['body']['MessageSid']&&_0x1a48fe[_0x956b('0x5b')][_0x956b('0x87')]===_0x15fae0['messageId']){return _0x15fae0['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status','twilio',util[_0x956b('0x85')](_0x1a48fe[_0x956b('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x956b('0x88'):if(_0x1a48fe['body'][_0x956b('0x89')]&&_0x1a48fe['body'][_0x956b('0x89')]===_0x15fae0[_0x956b('0x8a')]&&_[_0x956b('0x8b')](['sent',_0x956b('0x8c')],_0x1a48fe[_0x956b('0x5b')][_0x956b('0x8d')])>=0x0){return _0x15fae0['update']({'read':!![]});}else{logger['error'](_0x956b('0x8e'),_0x956b('0x2f'),_0x956b('0x8f'),util[_0x956b('0x85')](_0x1a48fe[_0x956b('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x956b('0x90'):var _0x1f34af=_0x1a48fe[_0x956b('0x5b')][_0x956b('0x91')][0x0];if(_0x1f34af[_0x956b('0x2f')][_0x956b('0x92')]==='DELIVERED'){return _0x15fae0[_0x956b('0x3a')]({'read':!![]});}else{logger[_0x956b('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x956b('0x2f'),_0x956b('0x90'),util[_0x956b('0x85')](_0x1a48fe[_0x956b('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x15fae0;}})[_0x956b('0x3b')](respondWithResult(_0x424c65,null))[_0x956b('0x2d')](handleError(_0x424c65,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 980f4b4..bbc9c0c 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 _0x57ed=['emit','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x57ed,0x7b));var _0xd57e=function(_0x59634d,_0x383e2e){_0x59634d=_0x59634d-0x0;var _0xe03c5=_0x57ed[_0x59634d];return _0xe03c5;};'use strict';var EventEmitter=require(_0xd57e('0x0'));var SmsMessage=require(_0xd57e('0x1'))['db'][_0xd57e('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xd57e('0x3')](0x0);var events={'afterCreate':_0xd57e('0x4'),'afterUpdate':_0xd57e('0x5'),'afterDestroy':_0xd57e('0x6')};function emitEvent(_0x4b9480){return function(_0x5cd82c,_0x2aa9d9,_0x14e51b){SmsMessageEvents['emit'](_0x4b9480+':'+_0x5cd82c['id'],_0x5cd82c);SmsMessageEvents[_0xd57e('0x7')](_0x4b9480,_0x5cd82c);_0x14e51b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xd57e('0x8')](e,emitEvent(event));}}module[_0xd57e('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0xd3f7=['../../mysqldb','SmsMessage','setMaxListeners','update','remove','emit','exports','events'];(function(_0x52caa9,_0x2ddef5){var _0x21adc4=function(_0x29e875){while(--_0x29e875){_0x52caa9['push'](_0x52caa9['shift']());}};_0x21adc4(++_0x2ddef5);}(_0xd3f7,0x15f));var _0x7d3f=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xd3f7[_0x4e1d03];return _0x362d4b;};'use strict';var EventEmitter=require(_0x7d3f('0x0'));var SmsMessage=require(_0x7d3f('0x1'))['db'][_0x7d3f('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x7d3f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7d3f('0x4'),'afterDestroy':_0x7d3f('0x5')};function emitEvent(_0x164a63){return function(_0x56f59b,_0x44c938,_0x160c00){SmsMessageEvents[_0x7d3f('0x6')](_0x164a63+':'+_0x56f59b['id'],_0x56f59b);SmsMessageEvents[_0x7d3f('0x6')](_0x164a63,_0x56f59b);_0x160c00(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x7d3f('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 343143b..3407c65 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 _0x6dd2=['plivo','/status?token=','%s:%s','authId','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','csc','crypto','apiKey','login','sender','keys','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','message','refid','finally','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','findOne','SmsInteractionId','then','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','username','smsMethod','login?username=','password','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','clickSend'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x6dd2,0x190));var _0x26dd=function(_0x504ffc,_0x53415e){_0x504ffc=_0x504ffc-0x0;var _0x37c722=_0x6dd2[_0x504ffc];return _0x37c722;};'use strict';var _=require(_0x26dd('0x0'));var util=require(_0x26dd('0x1'));var logger=require(_0x26dd('0x2'))('api');var moment=require(_0x26dd('0x3'));var BPromise=require(_0x26dd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x26dd('0x5'));var rimraf=require(_0x26dd('0x6'));var config=require(_0x26dd('0x7'));var attributes=require(_0x26dd('0x8'));module[_0x26dd('0x9')]=function(_0x31303f,_0x15a562){return _0x31303f[_0x26dd('0xa')](_0x26dd('0xb'),attributes,{'tableName':_0x26dd('0xc'),'paranoid':![],'indexes':[{'name':_0x26dd('0xd'),'fields':[_0x26dd('0xd')]},{'name':_0x26dd('0xe'),'fields':[_0x26dd('0xf')],'type':_0x26dd('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x49c3d4,_0x58307c,_0x335276){var _0x38d5bb=_0x31303f[_0x26dd('0x11')];var _0x59e3e9=_0x49c3d4['get']({'plain':!![]});if(_0x59e3e9[_0x26dd('0x12')][_0x26dd('0x13')]()==='in'||_0x59e3e9[_0x26dd('0x12')]['toLowerCase']()===_0x26dd('0x14')&&!_0x59e3e9[_0x26dd('0x15')]&&!_['isNil'](_0x59e3e9[_0x26dd('0x16')])&&!_['isNil'](_0x59e3e9['SmsInteractionId'])){_0x38d5bb['SmsInteraction'][_0x26dd('0x17')]({'where':{'id':_0x59e3e9[_0x26dd('0x18')]}})[_0x26dd('0x19')](function(_0xbadec1){if(_0xbadec1){_0xbadec1[_0x26dd('0x1a')]({'lastMsgAt':_0x59e3e9[_0x26dd('0x1b')],'lastMsgDirection':_0x59e3e9[_0x26dd('0x12')][_0x26dd('0x13')]()});}})[_0x26dd('0x1c')](function(_0x1bd25a){console[_0x26dd('0x1d')](_0x1bd25a);});}if(_0x59e3e9['direction']===_0x26dd('0x14')&&!_0x59e3e9[_0x26dd('0x15')]){var _0x5d669e;_0x38d5bb[_0x26dd('0x1e')][_0x26dd('0x1f')]({'where':{'id':_0x59e3e9[_0x26dd('0x20')]},'raw':!![]})['then'](function(_0x552664){_0x5d669e=_0x552664;if(_0x5d669e&&_0x5d669e[_0x26dd('0x21')]){switch(_0x5d669e[_0x26dd('0x21')]){case _0x26dd('0x22'):var _0x1a679e=require(_0x26dd('0x22'));if(_0x5d669e[_0x26dd('0x23')]&&_0x5d669e[_0x26dd('0x24')]&&_0x5d669e[_0x26dd('0x25')]){var _0x52a70b=new _0x1a679e(_0x5d669e[_0x26dd('0x23')],_0x5d669e[_0x26dd('0x24')]);_0x52a70b[_0x26dd('0x26')][_0x26dd('0x27')]({'body':_0x59e3e9['body'],'to':_0x59e3e9['phone'],'from':_0x5d669e['phone'],'statusCallback':_0x5d669e[_0x26dd('0x28')]+_0x26dd('0x29')+_0x59e3e9['id']+'/status?token='+_0x5d669e[_0x26dd('0x2a')]})[_0x26dd('0x19')](function(_0x51e369){if(_0x51e369[_0x26dd('0x2b')]){return _0x49c3d4[_0x26dd('0x1a')]({'messageId':_0x51e369[_0x26dd('0x2b')]});}})[_0x26dd('0x1c')](function(_0x47fcfb){logger[_0x26dd('0x1d')](_0x26dd('0x2c'),_0x26dd('0x2d'),_0x26dd('0x22'),util[_0x26dd('0x2e')](_0x47fcfb,{'showHidden':![],'depth':null}));});}else{logger[_0x26dd('0x1d')](_0x26dd('0x2c'),_0x26dd('0x2d'),'twilio',_0x26dd('0x2f'));}break;case'skebby':var _0x29d1f4='https://api.skebby.it/API/v1.0/REST/';if(_0x5d669e[_0x26dd('0x30')]&&_0x5d669e['password']){var _0xceec99={'recipient':[_0x59e3e9[_0x26dd('0x25')]],'message':_0x59e3e9[_0x26dd('0xf')],'message_type':_0x5d669e['smsMethod']};if(_0x5d669e[_0x26dd('0x31')]&&_0x5d669e[_0x26dd('0x31')]!=='SI'){_0xceec99['sender']=_0x5d669e[_0x26dd('0x25')];}var _0x3408bd={'url':_0x29d1f4+_0x26dd('0x32')+_0x5d669e[_0x26dd('0x30')]+'&password='+_0x5d669e[_0x26dd('0x33')],'method':_0x26dd('0x34')};rp(_0x3408bd)[_0x26dd('0x19')](function(_0x12bbd7){var _0x44506e=_0x12bbd7[_0x26dd('0x35')](';');var _0x373cdc={'user_key':_0x44506e[0x0],'session_key':_0x44506e[0x1]};_0x3408bd={'url':_0x29d1f4+_0x26dd('0x36'),'method':_0x26dd('0x37'),'headers':{'user_key':_0x373cdc[_0x26dd('0x38')],'Session_key':_0x373cdc[_0x26dd('0x39')]},'json':!![],'body':_0xceec99};return rp(_0x3408bd);})[_0x26dd('0x19')](function(_0x4e7492){if(_0x4e7492[_0x26dd('0x3a')]>=0x1){var _0x43c675={'messageId':_0x4e7492[_0x26dd('0x3b')]};if(_0x5d669e[_0x26dd('0x31')]!=='GP'||!_0x5d669e[_0x26dd('0x3c')]){_0x43c675[_0x26dd('0x3d')]=!![];}return _0x49c3d4[_0x26dd('0x1a')](_0x43c675);}else{return logger[_0x26dd('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x26dd('0x2d'),_0x26dd('0x3e'),util[_0x26dd('0x2e')](_0x4e7492,{'showHidden':![],'depth':null}));}})[_0x26dd('0x1c')](function(_0x22c40b){return logger['error'](_0x26dd('0x2c'),'afterCreate',_0x26dd('0x3e'),util[_0x26dd('0x2e')](_0x22c40b,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x26dd('0x3e'),_0x26dd('0x3f'));}break;case _0x26dd('0x40'):if(_0x5d669e['authToken']){var _0x542d8e={'recipient':_0x59e3e9[_0x26dd('0x25')],'message':_0x59e3e9[_0x26dd('0xf')],'sender':_0x5d669e['senderString']||_0x5d669e[_0x26dd('0x25')],'authorization':_0x5d669e[_0x26dd('0x24')]};var _0x58307c={'method':_0x26dd('0x37'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x542d8e,'json':!![]};rp(_0x58307c)[_0x26dd('0x19')](function(_0x10a3eb){var _0x1614e7={'messageId':_0x10a3eb[_0x26dd('0x41')]};if(!_0x5d669e['deliveryReport']){_0x1614e7[_0x26dd('0x3d')]=!![];}return _0x49c3d4[_0x26dd('0x1a')](_0x1614e7);})[_0x26dd('0x1c')](function(_0x42824a){logger[_0x26dd('0x1d')](_0x26dd('0x2c'),_0x26dd('0x2d'),_0x26dd('0x40'),util[_0x26dd('0x2e')](_0x42824a,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x26dd('0x40'),_0x26dd('0x42'));}break;case _0x26dd('0x43'):if(_0x5d669e[_0x26dd('0x30')]&&_0x5d669e[_0x26dd('0x33')]){var _0x542d8e={'messages':[{'source':_0x26dd('0x44'),'to':_0x59e3e9[_0x26dd('0x25')],'body':_0x59e3e9[_0x26dd('0xf')],'from':_0x5d669e[_0x26dd('0x45')]||_0x5d669e[_0x26dd('0x25')]}]};var _0x935edc=util[_0x26dd('0x46')]('%s:%s',_0x5d669e[_0x26dd('0x30')],_0x5d669e[_0x26dd('0x33')]);var _0x58307c={'method':_0x26dd('0x37'),'uri':_0x26dd('0x47'),'body':_0x542d8e,'headers':{'Authorization':util[_0x26dd('0x46')](_0x26dd('0x48'),new Buffer(_0x935edc)['toString'](_0x26dd('0x49')))},'json':!![]};rp(_0x58307c)[_0x26dd('0x19')](function(_0x4920d9){if(_0x4920d9[_0x26dd('0x4a')]>=0xc8&&_0x4920d9['http_code']<=0xce){if(_0x4920d9[_0x26dd('0x4b')]&&_0x4920d9['data'][_0x26dd('0x4c')]>0x0){var _0x3ec5f2=_[_0x26dd('0x4d')](_0x4920d9[_0x26dd('0x4b')][_0x26dd('0x26')]);var _0x33c511={'messageId':_0x3ec5f2[_0x26dd('0x4e')]};if(!_0x5d669e[_0x26dd('0x3c')]){_0x33c511['read']=!![];}return _0x49c3d4[_0x26dd('0x1a')](_0x33c511);}else{logger[_0x26dd('0x1d')](_0x26dd('0x2c'),'afterCreate',_0x26dd('0x4f'),util[_0x26dd('0x2e')](_0x4920d9,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x26dd('0x2c'),_0x26dd('0x2d'),_0x26dd('0x4f'),util[_0x26dd('0x2e')](_0x4920d9,{'showHidden':![],'depth':null}));}})['catch'](function(_0xcaab6a){logger[_0x26dd('0x1d')](_0x26dd('0x2c'),'afterCreate',_0x26dd('0x4f'),util['inspect'](_0xcaab6a,{'showHidden':![],'depth':null}));});}else{logger[_0x26dd('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x26dd('0x2d'),_0x26dd('0x4f'),_0x26dd('0x3f'));}break;case _0x26dd('0x50'):if(_0x5d669e['authId']&&_0x5d669e[_0x26dd('0x24')]){var _0x542d8e={'dst':_0x59e3e9[_0x26dd('0x25')],'text':_0x59e3e9[_0x26dd('0xf')],'src':_0x5d669e[_0x26dd('0x45')]||_0x5d669e['phone'],'url':_0x5d669e['remote']+_0x26dd('0x29')+_0x59e3e9['id']+_0x26dd('0x51')+_0x5d669e[_0x26dd('0x2a')]};var _0x935edc=util[_0x26dd('0x46')](_0x26dd('0x52'),_0x5d669e[_0x26dd('0x53')],_0x5d669e[_0x26dd('0x24')]);var _0x58307c={'method':_0x26dd('0x37'),'uri':util['format'](_0x26dd('0x54'),_0x5d669e[_0x26dd('0x53')]),'body':_0x542d8e,'headers':{'Authorization':util['format'](_0x26dd('0x48'),new Buffer(_0x935edc)[_0x26dd('0x55')]('base64'))},'json':!![]};rp(_0x58307c)['then'](function(_0x143669){var _0x149b73={'messageId':_0x143669[_0x26dd('0x56')][0x0]};return _0x49c3d4[_0x26dd('0x1a')](_0x149b73);})['catch'](function(_0x148f05){logger[_0x26dd('0x1d')](_0x26dd('0x2c'),_0x26dd('0x2d'),'plivo',util[_0x26dd('0x2e')](_0x148f05,{'showHidden':![],'depth':null}));});}else{logger[_0x26dd('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x26dd('0x2d'),_0x26dd('0x50'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x5d669e[_0x26dd('0x30')]&&_0x5d669e[_0x26dd('0x33')]){if(_0x5d669e['baseUrl']){var _0x25f8ef={'method':_0x26dd('0x37'),'uri':_0x5d669e[_0x26dd('0x57')]+_0x26dd('0x58'),'body':{'username':_0x5d669e['username'],'password':_0x5d669e['password']},'json':!![]};return rp(_0x25f8ef)[_0x26dd('0x19')](function(_0x18711d){var _0xa91797={'method':_0x26dd('0x37'),'uri':_0x5d669e['baseUrl']+_0x26dd('0x59'),'body':{'messages':[{'from':_0x5d669e[_0x26dd('0x25')],'destinations':[{'to':_0x59e3e9[_0x26dd('0x25')]}],'text':_0x59e3e9[_0x26dd('0xf')],'notifyUrl':_0x5d669e[_0x26dd('0x28')]+'/api/sms/messages/'+_0x59e3e9['id']+_0x26dd('0x51')+_0x5d669e[_0x26dd('0x2a')],'notifyContentType':_0x26dd('0x5a'),'callbackData':_0x5d669e[_0x26dd('0x25')]+';'+_0x59e3e9[_0x26dd('0xf')]}]},'headers':{'Authorization':_0x26dd('0x5b')+_0x18711d['token']},'json':!![]};return rp(_0xa91797)['then'](function(_0x230abc){if(_0x230abc['messages']){var _0x47e60a={'messageId':_0x230abc[_0x26dd('0x26')][0x0][_0x26dd('0xd')]};if(!_0x5d669e[_0x26dd('0x3c')]){_0x47e60a[_0x26dd('0x3d')]=!![];}return _0x49c3d4[_0x26dd('0x1a')](_0x47e60a);}else{return logger['error'](_0x26dd('0x2c'),_0x26dd('0x2d'),_0x26dd('0x5c'),util[_0x26dd('0x2e')](_0x230abc,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x1bc400){return logger[_0x26dd('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x26dd('0x2d'),_0x26dd('0x5c'),util['inspect'](_0x1bc400,{'showHidden':![],'depth':null}));});}else{logger[_0x26dd('0x1d')](_0x26dd('0x2c'),'afterCreate',_0x26dd('0x5c'),'Missing\x20parameters:\x20base_url');}}else{logger['error'](_0x26dd('0x2c'),'afterCreate',_0x26dd('0x5c'),_0x26dd('0x3f'));}break;case _0x26dd('0x5d'):var _0x31fd6d=require(_0x26dd('0x5e'));if(_0x5d669e[_0x26dd('0x5f')]){var _0x1d0c77={};_0x1d0c77[_0x26dd('0x60')]=_0x5d669e['username'];_0x1d0c77[_0x26dd('0x25')]=_0x59e3e9[_0x26dd('0x25')];_0x1d0c77[_0x26dd('0x61')]=_0x5d669e[_0x26dd('0x25')];_0x1d0c77['text']=_0x59e3e9[_0x26dd('0xf')];_0x1d0c77['timestamp']=+new Date();var _0x3a14e5='';var _0x565a72='';var _0x262244=Object[_0x26dd('0x62')](_0x1d0c77);_0x262244['sort']();for(var _0x6777af=0x0;_0x6777af<_0x262244[_0x26dd('0x63')];_0x6777af++){if(_0x3a14e5!=''){_0x3a14e5+='&';}_0x3a14e5+=_0x262244[_0x6777af]+'='+encodeURIComponent(_0x1d0c77[_0x262244[_0x6777af]]);_0x565a72+=_0x1d0c77[_0x262244[_0x6777af]];}_0x565a72+=_0x5d669e[_0x26dd('0x5f')];_0x565a72=_0x31fd6d[_0x26dd('0x64')](_0x26dd('0x65'))[_0x26dd('0x1a')](_0x565a72)[_0x26dd('0x66')](_0x26dd('0x67'));if(_0x3a14e5!==''){_0x3a14e5+='&';}_0x3a14e5+=_0x26dd('0x68')+_0x565a72;var _0x3408bd={'method':_0x26dd('0x34'),'uri':_0x5d669e['baseUrl']+_0x26dd('0x69')+_0x3a14e5,'json':!![]};return rp(_0x3408bd)[_0x26dd('0x19')](function(_0x5d972c){var _0x717eba=Object[_0x26dd('0x62')](_0x5d972c);if(_0x5d972c[_0x717eba[0x0]][_0x26dd('0x1d')]&&parseInt(_0x5d972c[_0x717eba[0x0]][_0x26dd('0x1d')])===0x0){var _0x35412a={'messageId':_0x5d972c[_0x717eba[0x0]][_0x26dd('0x6a')]};if(!_0x5d669e[_0x26dd('0x3c')]){_0x35412a[_0x26dd('0x3d')]=!![];}return _0x49c3d4['update'](_0x35412a);}else{return logger[_0x26dd('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x26dd('0x2d'),_0x26dd('0x5d'),util[_0x26dd('0x2e')](_0x5d972c[_0x26dd('0x1d')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x38e36f){return logger[_0x26dd('0x1d')](_0x26dd('0x2c'),_0x26dd('0x2d'),_0x26dd('0x5d'),util['inspect'](_0x38e36f,{'showHidden':![],'depth':null}));});}else{logger[_0x26dd('0x1d')](_0x26dd('0x2c'),_0x26dd('0x2d'),_0x26dd('0x5d'),_0x26dd('0x6b'));}break;case _0x26dd('0x6c'):if(_0x5d669e[_0x26dd('0x5f')]){var _0x4f3a16={'method':_0x26dd('0x37'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x5d669e[_0x26dd('0x5f')]},'body':{'content':_0x59e3e9[_0x26dd('0xf')],'to':[_0x59e3e9[_0x26dd('0x25')]],'from':_0x5d669e[_0x26dd('0x25')],'binary':![],'clientMessageId':_0x26dd('0x6d'),'charset':'UTF-8'},'json':!![]};rp(_0x4f3a16)['then'](function(_0x56bfae){if(!_0x56bfae[_0x26dd('0x1d')]){var _0x431d2f={'messageId':_0x56bfae[_0x26dd('0x26')][0x0][_0x26dd('0x6e')]};if(!_0x5d669e[_0x26dd('0x3c')]){_0x431d2f['read']=!![];}return _0x49c3d4[_0x26dd('0x1a')](_0x431d2f);}else{return logger[_0x26dd('0x1d')](_0x26dd('0x2c'),_0x26dd('0x2d'),_0x26dd('0x6c'),util[_0x26dd('0x2e')](_0x56bfae[_0x26dd('0x1d')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x27006a){return logger[_0x26dd('0x1d')](_0x26dd('0x2c'),'afterCreate',_0x26dd('0x6c'),util[_0x26dd('0x2e')](_0x27006a,{'showHidden':![],'depth':null}));});}else{logger[_0x26dd('0x1d')](_0x26dd('0x2c'),_0x26dd('0x2d'),_0x26dd('0x6c'),_0x26dd('0x6b'));}break;case _0x26dd('0x6f'):if(_0x5d669e[_0x26dd('0x30')]&&_0x5d669e[_0x26dd('0x33')]){var _0x935edc=util[_0x26dd('0x46')]('%s:%s',_0x5d669e[_0x26dd('0x30')],_0x5d669e[_0x26dd('0x33')]);var _0x58307c={'method':_0x26dd('0x37'),'uri':_0x26dd('0x70')+_0x5d669e[_0x26dd('0x71')]+_0x26dd('0x72'),'body':{'to':[_0x59e3e9['phone']],'text':_0x59e3e9[_0x26dd('0xf')],'from':_0x5d669e['phone'],'applicationId':_0x5d669e[_0x26dd('0x73')]},'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x935edc)[_0x26dd('0x55')]('base64'))},'json':!![]};rp(_0x58307c)[_0x26dd('0x19')](function(_0xf277ba){if(_0xf277ba['id']){var _0x477f5a={'messageId':_0xf277ba['id']};return _0x49c3d4[_0x26dd('0x1a')](_0x477f5a);}else{logger[_0x26dd('0x1d')](_0x26dd('0x2c'),_0x26dd('0x2d'),_0x26dd('0x6f'),util[_0x26dd('0x2e')](_0xf277ba,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2933f4){logger[_0x26dd('0x1d')](_0x26dd('0x2c'),_0x26dd('0x2d'),_0x26dd('0x6f'),util[_0x26dd('0x2e')](_0x2933f4,{'showHidden':![],'depth':null}));});}else{logger[_0x26dd('0x1d')](_0x26dd('0x2c'),_0x26dd('0x2d'),'bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0x26dd('0x74'):if(_0x5d669e[_0x26dd('0x5f')]){var _0x8e31c1={};var _0x3408bd={'method':_0x26dd('0x37'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x5d669e[_0x26dd('0x5f')],'Content-Type':_0x26dd('0x5a')},'body':{'from':_0x5d669e[_0x26dd('0x25')],'to':_0x59e3e9[_0x26dd('0x25')],'text':_0x59e3e9[_0x26dd('0xf')]},'json':!![]};return rp(_0x3408bd)[_0x26dd('0x19')](function(_0x55547d){if(_0x55547d['code']==0xca){_0x8e31c1['message']=_0x55547d;var _0x44cba4={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x5d669e[_0x26dd('0x5f')],'Content-Type':_0x26dd('0x5a')},'body':{'refid':_0x8e31c1['message']['refid']},'json':!![]};return rp(_0x44cba4)[_0x26dd('0x19')](function(_0x1e0d01){_0x8e31c1['status']=_0x1e0d01;var _0x56ec51={'messageId':_0x8e31c1[_0x26dd('0x75')][_0x26dd('0x76')],'read':!![]};return _0x49c3d4['update'](_0x56ec51);});}else{return logger[_0x26dd('0x1d')](_0x26dd('0x2c'),'afterCreate','intelepeer',util[_0x26dd('0x2e')](_0x55547d,{'showHidden':![],'depth':null}));}})[_0x26dd('0x1c')](function(_0x42ca51){return logger[_0x26dd('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x26dd('0x74'),util['inspect'](_0x42ca51,{'showHidden':![],'depth':null}));});}else{return logger[_0x26dd('0x1d')](_0x26dd('0x2c'),_0x26dd('0x2d'),'intelepeer','Token\x20not\x20received');}break;}}})[_0x26dd('0x77')](function(){_0x335276();});}else{_0x335276();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x53e3=['remote','/api/sms/messages/','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','username','password','smsMethod','sender','login?username=','&password=','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','update','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','infobip','csc','crypto','apiKey','login','keys','length','createHash','digest','hex','signature=','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','apiMessageId','%s:%s','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','Basic\x20%s','bandwidth','intelepeer','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','Token\x20not\x20received','finally','utf8mb4','lodash','moment','bluebird','path','rimraf','../../config/environment','exports','define','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','SmsInteractionId','SmsInteraction','then','catch','SmsAccount','find','type','twilio','accountSid','authToken','phone','messages','create'];(function(_0x50d77f,_0x1a76da){var _0x477ae3=function(_0x358ee2){while(--_0x358ee2){_0x50d77f['push'](_0x50d77f['shift']());}};_0x477ae3(++_0x1a76da);}(_0x53e3,0x136));var _0x353e=function(_0x47c9b1,_0x119667){_0x47c9b1=_0x47c9b1-0x0;var _0x314445=_0x53e3[_0x47c9b1];return _0x314445;};'use strict';var _=require(_0x353e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x353e('0x1'));var BPromise=require(_0x353e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x353e('0x3'));var rimraf=require(_0x353e('0x4'));var config=require(_0x353e('0x5'));var attributes=require('./smsMessage.attributes');module[_0x353e('0x6')]=function(_0x4fd84d,_0x459281){return _0x4fd84d[_0x353e('0x7')]('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x353e('0x8'),'fields':['messageId']},{'name':_0x353e('0x9'),'fields':[_0x353e('0xa')],'type':_0x353e('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xb11a65,_0x56b286,_0x544cf3){var _0x4c6611=_0x4fd84d[_0x353e('0xc')];var _0x5bb178=_0xb11a65[_0x353e('0xd')]({'plain':!![]});if(_0x5bb178[_0x353e('0xe')]['toLowerCase']()==='in'||_0x5bb178[_0x353e('0xe')][_0x353e('0xf')]()===_0x353e('0x10')&&!_0x5bb178['secret']&&!_[_0x353e('0x11')](_0x5bb178[_0x353e('0x12')])&&!_[_0x353e('0x11')](_0x5bb178[_0x353e('0x13')])){_0x4c6611[_0x353e('0x14')]['findOne']({'where':{'id':_0x5bb178[_0x353e('0x13')]}})[_0x353e('0x15')](function(_0x4476ce){if(_0x4476ce){_0x4476ce['update']({'lastMsgAt':_0x5bb178['createdAt'],'lastMsgDirection':_0x5bb178[_0x353e('0xe')][_0x353e('0xf')]()});}})[_0x353e('0x16')](function(_0x1dacbb){console['error'](_0x1dacbb);});}if(_0x5bb178[_0x353e('0xe')]===_0x353e('0x10')&&!_0x5bb178['secret']){var _0x44453d;_0x4c6611[_0x353e('0x17')][_0x353e('0x18')]({'where':{'id':_0x5bb178['SmsAccountId']},'raw':!![]})['then'](function(_0x456928){_0x44453d=_0x456928;if(_0x44453d&&_0x44453d[_0x353e('0x19')]){switch(_0x44453d['type']){case _0x353e('0x1a'):var _0x46a6f5=require('twilio');if(_0x44453d[_0x353e('0x1b')]&&_0x44453d[_0x353e('0x1c')]&&_0x44453d[_0x353e('0x1d')]){var _0x4bfd4a=new _0x46a6f5(_0x44453d[_0x353e('0x1b')],_0x44453d[_0x353e('0x1c')]);_0x4bfd4a[_0x353e('0x1e')][_0x353e('0x1f')]({'body':_0x5bb178['body'],'to':_0x5bb178[_0x353e('0x1d')],'from':_0x44453d[_0x353e('0x1d')],'statusCallback':_0x44453d[_0x353e('0x20')]+_0x353e('0x21')+_0x5bb178['id']+_0x353e('0x22')+_0x44453d[_0x353e('0x23')]})[_0x353e('0x15')](function(_0x157564){if(_0x157564[_0x353e('0x24')]){return _0xb11a65['update']({'messageId':_0x157564['sid']});}})[_0x353e('0x16')](function(_0x125c4b){logger[_0x353e('0x25')](_0x353e('0x26'),_0x353e('0x27'),_0x353e('0x1a'),util['inspect'](_0x125c4b,{'showHidden':![],'depth':null}));});}else{logger[_0x353e('0x25')](_0x353e('0x26'),_0x353e('0x27'),_0x353e('0x1a'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x353e('0x28'):var _0x40e377='https://api.skebby.it/API/v1.0/REST/';if(_0x44453d[_0x353e('0x29')]&&_0x44453d[_0x353e('0x2a')]){var _0x430dd3={'recipient':[_0x5bb178[_0x353e('0x1d')]],'message':_0x5bb178[_0x353e('0xa')],'message_type':_0x44453d['smsMethod']};if(_0x44453d['smsMethod']&&_0x44453d[_0x353e('0x2b')]!=='SI'){_0x430dd3[_0x353e('0x2c')]=_0x44453d['phone'];}var _0x4deb80={'url':_0x40e377+_0x353e('0x2d')+_0x44453d[_0x353e('0x29')]+_0x353e('0x2e')+_0x44453d[_0x353e('0x2a')],'method':'GET'};rp(_0x4deb80)[_0x353e('0x15')](function(_0x31ff89){var _0x5729bd=_0x31ff89[_0x353e('0x2f')](';');var _0x292e9b={'user_key':_0x5729bd[0x0],'session_key':_0x5729bd[0x1]};_0x4deb80={'url':_0x40e377+_0x353e('0x30'),'method':_0x353e('0x31'),'headers':{'user_key':_0x292e9b[_0x353e('0x32')],'Session_key':_0x292e9b[_0x353e('0x33')]},'json':!![],'body':_0x430dd3};return rp(_0x4deb80);})[_0x353e('0x15')](function(_0x264398){if(_0x264398[_0x353e('0x34')]>=0x1){var _0x1e94e1={'messageId':_0x264398[_0x353e('0x35')]};if(_0x44453d[_0x353e('0x2b')]!=='GP'||!_0x44453d[_0x353e('0x36')]){_0x1e94e1[_0x353e('0x37')]=!![];}return _0xb11a65[_0x353e('0x38')](_0x1e94e1);}else{return logger['error'](_0x353e('0x26'),_0x353e('0x27'),_0x353e('0x28'),util[_0x353e('0x39')](_0x264398,{'showHidden':![],'depth':null}));}})['catch'](function(_0x54721b){return logger[_0x353e('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x353e('0x27'),'skebby',util[_0x353e('0x39')](_0x54721b,{'showHidden':![],'depth':null}));});}else{logger[_0x353e('0x25')](_0x353e('0x26'),_0x353e('0x27'),'skebby',_0x353e('0x3a'));}break;case _0x353e('0x3b'):if(_0x44453d[_0x353e('0x1c')]){var _0x1e15ff={'recipient':_0x5bb178[_0x353e('0x1d')],'message':_0x5bb178[_0x353e('0xa')],'sender':_0x44453d[_0x353e('0x3c')]||_0x44453d[_0x353e('0x1d')],'authorization':_0x44453d['authToken']};var _0x56b286={'method':_0x353e('0x31'),'uri':_0x353e('0x3d'),'body':_0x1e15ff,'json':!![]};rp(_0x56b286)[_0x353e('0x15')](function(_0x1c1771){var _0x59a1a3={'messageId':_0x1c1771['requestid']};if(!_0x44453d['deliveryReport']){_0x59a1a3[_0x353e('0x37')]=!![];}return _0xb11a65[_0x353e('0x38')](_0x59a1a3);})[_0x353e('0x16')](function(_0x1c9849){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x353e('0x27'),_0x353e('0x3b'),util[_0x353e('0x39')](_0x1c9849,{'showHidden':![],'depth':null}));});}else{logger[_0x353e('0x25')](_0x353e('0x26'),_0x353e('0x27'),_0x353e('0x3b'),_0x353e('0x3e'));}break;case _0x353e('0x3f'):if(_0x44453d[_0x353e('0x29')]&&_0x44453d[_0x353e('0x2a')]){var _0x1e15ff={'messages':[{'source':_0x353e('0x40'),'to':_0x5bb178[_0x353e('0x1d')],'body':_0x5bb178[_0x353e('0xa')],'from':_0x44453d[_0x353e('0x3c')]||_0x44453d[_0x353e('0x1d')]}]};var _0x55cc87=util[_0x353e('0x41')]('%s:%s',_0x44453d[_0x353e('0x29')],_0x44453d[_0x353e('0x2a')]);var _0x56b286={'method':_0x353e('0x31'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x1e15ff,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x55cc87)[_0x353e('0x42')](_0x353e('0x43')))},'json':!![]};rp(_0x56b286)[_0x353e('0x15')](function(_0x3c321a){if(_0x3c321a[_0x353e('0x44')]>=0xc8&&_0x3c321a[_0x353e('0x44')]<=0xce){if(_0x3c321a[_0x353e('0x45')]&&_0x3c321a['data'][_0x353e('0x46')]>0x0){var _0x8320cf=_[_0x353e('0x47')](_0x3c321a[_0x353e('0x45')][_0x353e('0x1e')]);var _0x581c02={'messageId':_0x8320cf[_0x353e('0x48')]};if(!_0x44453d[_0x353e('0x36')]){_0x581c02[_0x353e('0x37')]=!![];}return _0xb11a65[_0x353e('0x38')](_0x581c02);}else{logger[_0x353e('0x25')](_0x353e('0x26'),_0x353e('0x27'),_0x353e('0x49'),util[_0x353e('0x39')](_0x3c321a,{'showHidden':![],'depth':null}));}}else{logger[_0x353e('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x353e('0x27'),_0x353e('0x49'),util['inspect'](_0x3c321a,{'showHidden':![],'depth':null}));}})[_0x353e('0x16')](function(_0xcd627b){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x353e('0x49'),util[_0x353e('0x39')](_0xcd627b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x353e('0x26'),_0x353e('0x27'),_0x353e('0x49'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x353e('0x4a'):if(_0x44453d[_0x353e('0x4b')]&&_0x44453d[_0x353e('0x1c')]){var _0x1e15ff={'dst':_0x5bb178['phone'],'text':_0x5bb178[_0x353e('0xa')],'src':_0x44453d[_0x353e('0x3c')]||_0x44453d[_0x353e('0x1d')],'url':_0x44453d[_0x353e('0x20')]+'/api/sms/messages/'+_0x5bb178['id']+_0x353e('0x22')+_0x44453d[_0x353e('0x23')]};var _0x55cc87=util[_0x353e('0x41')]('%s:%s',_0x44453d[_0x353e('0x4b')],_0x44453d[_0x353e('0x1c')]);var _0x56b286={'method':_0x353e('0x31'),'uri':util[_0x353e('0x41')]('https://api.plivo.com/v1/Account/%s/Message/',_0x44453d['authId']),'body':_0x1e15ff,'headers':{'Authorization':util[_0x353e('0x41')]('Basic\x20%s',new Buffer(_0x55cc87)[_0x353e('0x42')](_0x353e('0x43')))},'json':!![]};rp(_0x56b286)[_0x353e('0x15')](function(_0x19a83e){var _0x285489={'messageId':_0x19a83e[_0x353e('0x4c')][0x0]};return _0xb11a65[_0x353e('0x38')](_0x285489);})['catch'](function(_0x454608){logger[_0x353e('0x25')](_0x353e('0x26'),_0x353e('0x27'),_0x353e('0x4a'),util[_0x353e('0x39')](_0x454608,{'showHidden':![],'depth':null}));});}else{logger[_0x353e('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x353e('0x27'),_0x353e('0x4a'),_0x353e('0x4d'));}break;case'infobip':if(_0x44453d['username']&&_0x44453d[_0x353e('0x2a')]){if(_0x44453d[_0x353e('0x4e')]){var _0x5b29cd={'method':_0x353e('0x31'),'uri':_0x44453d['baseUrl']+_0x353e('0x4f'),'body':{'username':_0x44453d[_0x353e('0x29')],'password':_0x44453d[_0x353e('0x2a')]},'json':!![]};return rp(_0x5b29cd)['then'](function(_0x4f81a2){var _0xa77a5e={'method':'POST','uri':_0x44453d[_0x353e('0x4e')]+_0x353e('0x50'),'body':{'messages':[{'from':_0x44453d[_0x353e('0x1d')],'destinations':[{'to':_0x5bb178[_0x353e('0x1d')]}],'text':_0x5bb178['body'],'notifyUrl':_0x44453d[_0x353e('0x20')]+_0x353e('0x21')+_0x5bb178['id']+_0x353e('0x22')+_0x44453d['token'],'notifyContentType':_0x353e('0x51'),'callbackData':_0x44453d[_0x353e('0x1d')]+';'+_0x5bb178[_0x353e('0xa')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x4f81a2[_0x353e('0x23')]},'json':!![]};return rp(_0xa77a5e)[_0x353e('0x15')](function(_0x282d27){if(_0x282d27[_0x353e('0x1e')]){var _0x567257={'messageId':_0x282d27['messages'][0x0][_0x353e('0x8')]};if(!_0x44453d[_0x353e('0x36')]){_0x567257[_0x353e('0x37')]=!![];}return _0xb11a65[_0x353e('0x38')](_0x567257);}else{return logger[_0x353e('0x25')](_0x353e('0x26'),_0x353e('0x27'),_0x353e('0x52'),util['inspect'](_0x282d27,{'showHidden':![],'depth':null}));}});})[_0x353e('0x16')](function(_0x5bc447){return logger[_0x353e('0x25')](_0x353e('0x26'),'afterCreate','infobip',util[_0x353e('0x39')](_0x5bc447,{'showHidden':![],'depth':null}));});}else{logger[_0x353e('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x353e('0x27'),_0x353e('0x52'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x353e('0x25')](_0x353e('0x26'),_0x353e('0x27'),'infobip','Missing\x20parameters:\x20username,\x20password');}break;case _0x353e('0x53'):var _0x5e1aaf=require(_0x353e('0x54'));if(_0x44453d[_0x353e('0x55')]){var _0x19d11c={};_0x19d11c[_0x353e('0x56')]=_0x44453d[_0x353e('0x29')];_0x19d11c['phone']=_0x5bb178['phone'];_0x19d11c[_0x353e('0x2c')]=_0x44453d[_0x353e('0x1d')];_0x19d11c['text']=_0x5bb178['body'];_0x19d11c['timestamp']=+new Date();var _0x26a640='';var _0x18e1f9='';var _0x3837ae=Object[_0x353e('0x57')](_0x19d11c);_0x3837ae['sort']();for(var _0x1684a4=0x0;_0x1684a4<_0x3837ae[_0x353e('0x58')];_0x1684a4++){if(_0x26a640!=''){_0x26a640+='&';}_0x26a640+=_0x3837ae[_0x1684a4]+'='+encodeURIComponent(_0x19d11c[_0x3837ae[_0x1684a4]]);_0x18e1f9+=_0x19d11c[_0x3837ae[_0x1684a4]];}_0x18e1f9+=_0x44453d[_0x353e('0x55')];_0x18e1f9=_0x5e1aaf[_0x353e('0x59')]('md5')[_0x353e('0x38')](_0x18e1f9)[_0x353e('0x5a')](_0x353e('0x5b'));if(_0x26a640!==''){_0x26a640+='&';}_0x26a640+=_0x353e('0x5c')+_0x18e1f9;var _0x4deb80={'method':_0x353e('0x5d'),'uri':_0x44453d[_0x353e('0x4e')]+_0x353e('0x5e')+_0x26a640,'json':!![]};return rp(_0x4deb80)[_0x353e('0x15')](function(_0xb8b7b7){var _0x346c4b=Object[_0x353e('0x57')](_0xb8b7b7);if(_0xb8b7b7[_0x346c4b[0x0]]['error']&&parseInt(_0xb8b7b7[_0x346c4b[0x0]]['error'])===0x0){var _0x52d59f={'messageId':_0xb8b7b7[_0x346c4b[0x0]][_0x353e('0x5f')]};if(!_0x44453d[_0x353e('0x36')]){_0x52d59f[_0x353e('0x37')]=!![];}return _0xb11a65[_0x353e('0x38')](_0x52d59f);}else{return logger[_0x353e('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x353e('0x27'),_0x353e('0x53'),util[_0x353e('0x39')](_0xb8b7b7[_0x353e('0x25')],{'showHidden':![],'depth':null}));}})[_0x353e('0x16')](function(_0x8a0e98){return logger[_0x353e('0x25')](_0x353e('0x26'),'afterCreate','csc',util['inspect'](_0x8a0e98,{'showHidden':![],'depth':null}));});}else{logger[_0x353e('0x25')](_0x353e('0x26'),_0x353e('0x27'),_0x353e('0x53'),_0x353e('0x60'));}break;case _0x353e('0x61'):if(_0x44453d[_0x353e('0x55')]){var _0x3fb2f9={'method':_0x353e('0x31'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x44453d[_0x353e('0x55')]},'body':{'content':_0x5bb178[_0x353e('0xa')],'to':[_0x5bb178[_0x353e('0x1d')]],'from':_0x44453d['phone'],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x3fb2f9)[_0x353e('0x15')](function(_0x505f0c){if(!_0x505f0c['error']){var _0x3dd79b={'messageId':_0x505f0c[_0x353e('0x1e')][0x0][_0x353e('0x62')]};if(!_0x44453d[_0x353e('0x36')]){_0x3dd79b[_0x353e('0x37')]=!![];}return _0xb11a65[_0x353e('0x38')](_0x3dd79b);}else{return logger[_0x353e('0x25')](_0x353e('0x26'),_0x353e('0x27'),_0x353e('0x61'),util[_0x353e('0x39')](_0x505f0c[_0x353e('0x25')],{'showHidden':![],'depth':null}));}})['catch'](function(_0xb7cf36){return logger[_0x353e('0x25')](_0x353e('0x26'),_0x353e('0x27'),_0x353e('0x61'),util['inspect'](_0xb7cf36,{'showHidden':![],'depth':null}));});}else{logger[_0x353e('0x25')](_0x353e('0x26'),_0x353e('0x27'),_0x353e('0x61'),_0x353e('0x60'));}break;case'bandwidth':if(_0x44453d[_0x353e('0x29')]&&_0x44453d[_0x353e('0x2a')]){var _0x55cc87=util[_0x353e('0x41')](_0x353e('0x63'),_0x44453d[_0x353e('0x29')],_0x44453d[_0x353e('0x2a')]);var _0x56b286={'method':_0x353e('0x31'),'uri':_0x353e('0x64')+_0x44453d['accountId']+_0x353e('0x65'),'body':{'to':[_0x5bb178[_0x353e('0x1d')]],'text':_0x5bb178['body'],'from':_0x44453d['phone'],'applicationId':_0x44453d[_0x353e('0x66')]},'headers':{'Authorization':util[_0x353e('0x41')](_0x353e('0x67'),new Buffer(_0x55cc87)[_0x353e('0x42')](_0x353e('0x43')))},'json':!![]};rp(_0x56b286)['then'](function(_0x1a7085){if(_0x1a7085['id']){var _0x5a47ea={'messageId':_0x1a7085['id']};return _0xb11a65['update'](_0x5a47ea);}else{logger[_0x353e('0x25')](_0x353e('0x26'),_0x353e('0x27'),_0x353e('0x68'),util[_0x353e('0x39')](_0x1a7085,{'showHidden':![],'depth':null}));}})[_0x353e('0x16')](function(_0x293ef6){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x353e('0x68'),util[_0x353e('0x39')](_0x293ef6,{'showHidden':![],'depth':null}));});}else{logger[_0x353e('0x25')](_0x353e('0x26'),'afterCreate',_0x353e('0x68'),_0x353e('0x3a'));}break;case _0x353e('0x69'):if(_0x44453d['apiKey']){var _0x1649da={};var _0x4deb80={'method':_0x353e('0x31'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x353e('0x6a')+_0x44453d[_0x353e('0x55')],'Content-Type':_0x353e('0x51')},'body':{'from':_0x44453d['phone'],'to':_0x5bb178[_0x353e('0x1d')],'text':_0x5bb178[_0x353e('0xa')]},'json':!![]};return rp(_0x4deb80)[_0x353e('0x15')](function(_0x394c6a){if(_0x394c6a[_0x353e('0x6b')]==0xca){_0x1649da[_0x353e('0x6c')]=_0x394c6a;var _0x544ef2={'method':'POST','uri':_0x353e('0x6d'),'headers':{'Authorization':_0x353e('0x6a')+_0x44453d['apiKey'],'Content-Type':_0x353e('0x51')},'body':{'refid':_0x1649da[_0x353e('0x6c')][_0x353e('0x6e')]},'json':!![]};return rp(_0x544ef2)[_0x353e('0x15')](function(_0x56b349){_0x1649da['status']=_0x56b349;var _0x37ebb0={'messageId':_0x1649da['message'][_0x353e('0x6e')],'read':!![]};return _0xb11a65['update'](_0x37ebb0);});}else{return logger[_0x353e('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x353e('0x27'),_0x353e('0x69'),util[_0x353e('0x39')](_0x394c6a,{'showHidden':![],'depth':null}));}})[_0x353e('0x16')](function(_0x3995ad){return logger[_0x353e('0x25')](_0x353e('0x26'),_0x353e('0x27'),'intelepeer',util[_0x353e('0x39')](_0x3995ad,{'showHidden':![],'depth':null}));});}else{return logger[_0x353e('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x353e('0x27'),_0x353e('0x69'),_0x353e('0x6f'));}break;}}})[_0x353e('0x70')](function(){_0x544cf3();});}else{_0x544cf3();}}},'charset':_0x353e('0x71'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index aa6a8a6..0a9ee5b 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 _0xb8ac=['result','catch','CreateSmsMessage','create','options','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x29a79f,_0x3b8c8a){var _0x55ae59=function(_0x23e676){while(--_0x23e676){_0x29a79f['push'](_0x29a79f['shift']());}};_0x55ae59(++_0x3b8c8a);}(_0xb8ac,0x12f));var _0xcb8a=function(_0x548688,_0xbc19d3){_0x548688=_0x548688-0x0;var _0x16c3fa=_0xb8ac[_0x548688];return _0x16c3fa;};'use strict';var _=require(_0xcb8a('0x0'));var util=require(_0xcb8a('0x1'));var moment=require(_0xcb8a('0x2'));var BPromise=require(_0xcb8a('0x3'));var rs=require(_0xcb8a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb8a('0x5'))['db'];var utils=require(_0xcb8a('0x6'));var logger=require(_0xcb8a('0x7'))(_0xcb8a('0x8'));var config=require('../../config/environment');var jayson=require(_0xcb8a('0x9'));var client=jayson['client'][_0xcb8a('0xa')]({'port':0x232a});config['redis']=_[_0xcb8a('0xb')](config[_0xcb8a('0xc')],{'host':_0xcb8a('0xd'),'port':0x18eb});var socket=require(_0xcb8a('0xe'))(new Redis(config[_0xcb8a('0xc')]));require(_0xcb8a('0xf'))[_0xcb8a('0x10')](socket);function respondWithRpcPromise(_0xdbcff4,_0x2eb6ac,_0x124b92){return new BPromise(function(_0x151544,_0x22ddac){return client[_0xcb8a('0x11')](_0xdbcff4,_0x124b92)[_0xcb8a('0x12')](function(_0x4d19bf){logger[_0xcb8a('0x13')](_0xcb8a('0x14'),_0x2eb6ac,_0xcb8a('0x15'));logger['debug'](_0xcb8a('0x16'),_0x2eb6ac,_0xcb8a('0x15'),JSON[_0xcb8a('0x17')](_0x4d19bf));if(_0x4d19bf[_0xcb8a('0x18')]){if(_0x4d19bf[_0xcb8a('0x18')][_0xcb8a('0x19')]===0x1f4){logger[_0xcb8a('0x18')]('SmsMessage,\x20%s,\x20%s',_0x2eb6ac,_0x4d19bf['error']['message']);return _0x22ddac(_0x4d19bf[_0xcb8a('0x18')][_0xcb8a('0x1a')]);}logger[_0xcb8a('0x18')](_0xcb8a('0x14'),_0x2eb6ac,_0x4d19bf[_0xcb8a('0x18')][_0xcb8a('0x1a')]);return _0x151544(_0x4d19bf['error'][_0xcb8a('0x1a')]);}else{logger[_0xcb8a('0x13')]('SmsMessage,\x20%s,\x20%s',_0x2eb6ac,_0xcb8a('0x15'));_0x151544(_0x4d19bf[_0xcb8a('0x1b')][_0xcb8a('0x1a')]);}})[_0xcb8a('0x1c')](function(_0xaeb385){logger[_0xcb8a('0x18')](_0xcb8a('0x14'),_0x2eb6ac,_0xaeb385);_0x22ddac(_0xaeb385);});});}exports[_0xcb8a('0x1d')]=function(_0x38c792){var _0x53c560=this;return new Promise(function(_0x21d9de,_0x262ca8){return db['SmsMessage'][_0xcb8a('0x1e')](_0x38c792['body'],{'raw':_0x38c792[_0xcb8a('0x1f')]?_0x38c792[_0xcb8a('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x38f96d){logger[_0xcb8a('0x13')](_0xcb8a('0x1d'),_0x38c792);logger[_0xcb8a('0x20')]('CreateSmsMessage',_0x38c792,JSON[_0xcb8a('0x17')](_0x38f96d));_0x21d9de(_0x38f96d);})[_0xcb8a('0x1c')](function(_0x557e6c){logger[_0xcb8a('0x18')](_0xcb8a('0x1d'),_0x557e6c[_0xcb8a('0x1a')],_0x38c792);_0x262ca8(_0x53c560['error'](0x1f4,_0x557e6c['message']));});});}; \ No newline at end of file +var _0x6d31=['./smsMessage.socket','register','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SmsMessage','create','options','raw','CreateSmsMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults'];(function(_0x4a73f7,_0x1e755e){var _0x229c44=function(_0x497c4d){while(--_0x497c4d){_0x4a73f7['push'](_0x4a73f7['shift']());}};_0x229c44(++_0x1e755e);}(_0x6d31,0x192));var _0x16d3=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x6d31[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0x16d3('0x0'));var util=require(_0x16d3('0x1'));var moment=require(_0x16d3('0x2'));var BPromise=require(_0x16d3('0x3'));var rs=require(_0x16d3('0x4'));var fs=require('fs');var Redis=require(_0x16d3('0x5'));var db=require(_0x16d3('0x6'))['db'];var utils=require(_0x16d3('0x7'));var logger=require(_0x16d3('0x8'))(_0x16d3('0x9'));var config=require(_0x16d3('0xa'));var jayson=require(_0x16d3('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0x16d3('0xc')]=_[_0x16d3('0xd')](config[_0x16d3('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x16d3('0xc')]));require(_0x16d3('0xe'))[_0x16d3('0xf')](socket);function respondWithRpcPromise(_0x141064,_0x2f936e,_0x4f6203){return new BPromise(function(_0x4ebb1f,_0x5c2130){return client['request'](_0x141064,_0x4f6203)[_0x16d3('0x10')](function(_0x5ad3d2){logger[_0x16d3('0x11')](_0x16d3('0x12'),_0x2f936e,_0x16d3('0x13'));logger[_0x16d3('0x14')](_0x16d3('0x15'),_0x2f936e,_0x16d3('0x13'),JSON[_0x16d3('0x16')](_0x5ad3d2));if(_0x5ad3d2[_0x16d3('0x17')]){if(_0x5ad3d2[_0x16d3('0x17')][_0x16d3('0x18')]===0x1f4){logger[_0x16d3('0x17')](_0x16d3('0x12'),_0x2f936e,_0x5ad3d2['error'][_0x16d3('0x19')]);return _0x5c2130(_0x5ad3d2[_0x16d3('0x17')][_0x16d3('0x19')]);}logger[_0x16d3('0x17')](_0x16d3('0x12'),_0x2f936e,_0x5ad3d2['error'][_0x16d3('0x19')]);return _0x4ebb1f(_0x5ad3d2[_0x16d3('0x17')][_0x16d3('0x19')]);}else{logger[_0x16d3('0x11')](_0x16d3('0x12'),_0x2f936e,'request\x20sent');_0x4ebb1f(_0x5ad3d2[_0x16d3('0x1a')][_0x16d3('0x19')]);}})['catch'](function(_0xacdf82){logger[_0x16d3('0x17')](_0x16d3('0x12'),_0x2f936e,_0xacdf82);_0x5c2130(_0xacdf82);});});}exports['CreateSmsMessage']=function(_0x47bdea){var _0x44890b=this;return new Promise(function(_0x429fde,_0x556033){return db[_0x16d3('0x1b')][_0x16d3('0x1c')](_0x47bdea['body'],{'raw':_0x47bdea['options']?_0x47bdea[_0x16d3('0x1d')][_0x16d3('0x1e')]===undefined?!![]:![]:!![]})[_0x16d3('0x10')](function(_0x40fa15){logger['info']('CreateSmsMessage',_0x47bdea);logger['debug'](_0x16d3('0x1f'),_0x47bdea,JSON[_0x16d3('0x16')](_0x40fa15));_0x429fde(_0x40fa15);})['catch'](function(_0x2d158e){logger['error'](_0x16d3('0x1f'),_0x2d158e['message'],_0x47bdea);_0x556033(_0x44890b[_0x16d3('0x17')](0x1f4,_0x2d158e[_0x16d3('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 1a49e03..39d1415 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 _0x0439=['./smsMessage.events','remove','update','emit','removeListener','length','smsMessage:'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x0439,0x142));var _0x9043=function(_0x11d452,_0xa0446d){_0x11d452=_0x11d452-0x0;var _0x34a9e4=_0x0439[_0x11d452];return _0x34a9e4;};'use strict';var SmsMessageEvents=require(_0x9043('0x0'));var events=['save',_0x9043('0x1'),_0x9043('0x2')];function createListener(_0x251f23,_0xb13288){return function(_0x1781fd){_0xb13288[_0x9043('0x3')](_0x251f23,_0x1781fd);};}function removeListener(_0x2f958f,_0xae64ac){return function(){SmsMessageEvents[_0x9043('0x4')](_0x2f958f,_0xae64ac);};}exports['register']=function(_0x4fa7ae){for(var _0x972662=0x0,_0x5ce8e2=events[_0x9043('0x5')];_0x972662<_0x5ce8e2;_0x972662++){var _0x4f04c7=events[_0x972662];var _0x4cb4da=createListener(_0x9043('0x6')+_0x4f04c7,_0x4fa7ae);SmsMessageEvents['on'](_0x4f04c7,_0x4cb4da);}}; \ No newline at end of file +var _0x9158=['register','length','smsMessage:','./smsMessage.events','save','remove','update','emit','removeListener'];(function(_0x497db0,_0x9ada86){var _0x1c93bc=function(_0x2110db){while(--_0x2110db){_0x497db0['push'](_0x497db0['shift']());}};_0x1c93bc(++_0x9ada86);}(_0x9158,0xdb));var _0x8915=function(_0x2cf699,_0x2b5480){_0x2cf699=_0x2cf699-0x0;var _0x27ce03=_0x9158[_0x2cf699];return _0x27ce03;};'use strict';var SmsMessageEvents=require(_0x8915('0x0'));var events=[_0x8915('0x1'),_0x8915('0x2'),_0x8915('0x3')];function createListener(_0x4f3be0,_0x2c1092){return function(_0x2900a9){_0x2c1092[_0x8915('0x4')](_0x4f3be0,_0x2900a9);};}function removeListener(_0x33ed2c,_0x35318c){return function(){SmsMessageEvents[_0x8915('0x5')](_0x33ed2c,_0x35318c);};}exports[_0x8915('0x6')]=function(_0x572609){for(var _0x4f3025=0x0,_0x1077b7=events[_0x8915('0x7')];_0x4f3025<_0x1077b7;_0x4f3025++){var _0x115629=events[_0x4f3025];var _0x1ef898=createListener(_0x8915('0x8')+_0x115629,_0x572609);SmsMessageEvents['on'](_0x115629,_0x1ef898);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index d590cb4..592487c 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 _0x3cac=['util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','getAgents','post','addTeams','/:id/users','addAgents','put','destroy','delete','removeTeams','removeAgents','exports','multer'];(function(_0x26f747,_0x3c9e4d){var _0x4b4fe6=function(_0x1caad2){while(--_0x1caad2){_0x26f747['push'](_0x26f747['shift']());}};_0x4b4fe6(++_0x3c9e4d);}(_0x3cac,0xe7));var _0xc3ca=function(_0xae714f,_0x1a6ecf){_0xae714f=_0xae714f-0x0;var _0x2a00d7=_0x3cac[_0xae714f];return _0x2a00d7;};'use strict';var multer=require(_0xc3ca('0x0'));var util=require(_0xc3ca('0x1'));var path=require(_0xc3ca('0x2'));var timeout=require(_0xc3ca('0x3'));var express=require(_0xc3ca('0x4'));var router=express[_0xc3ca('0x5')]();var fs_extra=require(_0xc3ca('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc3ca('0x7'));var controller=require(_0xc3ca('0x8'));router[_0xc3ca('0x9')]('/',auth[_0xc3ca('0xa')](),controller[_0xc3ca('0xb')]);router[_0xc3ca('0x9')]('/describe',auth[_0xc3ca('0xa')](),controller[_0xc3ca('0xc')]);router[_0xc3ca('0x9')](_0xc3ca('0xd'),auth[_0xc3ca('0xa')](),controller[_0xc3ca('0xe')]);router[_0xc3ca('0x9')](_0xc3ca('0xf'),auth[_0xc3ca('0xa')](),controller[_0xc3ca('0x10')]);router[_0xc3ca('0x9')](_0xc3ca('0x11'),auth['isAuthenticated'](),controller['getTeams']);router['get']('/:id/users',auth[_0xc3ca('0xa')](),controller[_0xc3ca('0x12')]);router[_0xc3ca('0x13')]('/',auth[_0xc3ca('0xa')](),controller['create']);router[_0xc3ca('0x13')](_0xc3ca('0x11'),auth[_0xc3ca('0xa')](),controller[_0xc3ca('0x14')]);router[_0xc3ca('0x13')](_0xc3ca('0x15'),auth[_0xc3ca('0xa')](),controller[_0xc3ca('0x16')]);router[_0xc3ca('0x17')](_0xc3ca('0xd'),auth[_0xc3ca('0xa')](),controller['update']);router['delete'](_0xc3ca('0xd'),auth[_0xc3ca('0xa')](),controller[_0xc3ca('0x18')]);router[_0xc3ca('0x19')](_0xc3ca('0x11'),auth[_0xc3ca('0xa')](),controller[_0xc3ca('0x1a')]);router[_0xc3ca('0x19')](_0xc3ca('0x15'),auth[_0xc3ca('0xa')](),controller[_0xc3ca('0x1b')]);module[_0xc3ca('0x1c')]=router; \ No newline at end of file +var _0x8b8a=['index','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','post','create','addTeams','put','update','delete','destroy','removeTeams','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated'];(function(_0x2effe8,_0x43ac24){var _0xa168ce=function(_0x32ff25){while(--_0x32ff25){_0x2effe8['push'](_0x2effe8['shift']());}};_0xa168ce(++_0x43ac24);}(_0x8b8a,0xb9));var _0xa8b8=function(_0x48ce12,_0x1f24c0){_0x48ce12=_0x48ce12-0x0;var _0x1c979f=_0x8b8a[_0x48ce12];return _0x1c979f;};'use strict';var multer=require(_0xa8b8('0x0'));var util=require(_0xa8b8('0x1'));var path=require('path');var timeout=require(_0xa8b8('0x2'));var express=require(_0xa8b8('0x3'));var router=express[_0xa8b8('0x4')]();var fs_extra=require(_0xa8b8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa8b8('0x6'));var config=require(_0xa8b8('0x7'));var controller=require(_0xa8b8('0x8'));router[_0xa8b8('0x9')]('/',auth[_0xa8b8('0xa')](),controller[_0xa8b8('0xb')]);router[_0xa8b8('0x9')]('/describe',auth[_0xa8b8('0xa')](),controller[_0xa8b8('0xc')]);router[_0xa8b8('0x9')](_0xa8b8('0xd'),auth[_0xa8b8('0xa')](),controller[_0xa8b8('0xe')]);router['get'](_0xa8b8('0xf'),auth[_0xa8b8('0xa')](),controller['getMembers']);router[_0xa8b8('0x9')](_0xa8b8('0x10'),auth[_0xa8b8('0xa')](),controller[_0xa8b8('0x11')]);router[_0xa8b8('0x9')](_0xa8b8('0x12'),auth[_0xa8b8('0xa')](),controller['getAgents']);router[_0xa8b8('0x13')]('/',auth[_0xa8b8('0xa')](),controller[_0xa8b8('0x14')]);router[_0xa8b8('0x13')](_0xa8b8('0x10'),auth[_0xa8b8('0xa')](),controller[_0xa8b8('0x15')]);router[_0xa8b8('0x13')](_0xa8b8('0x12'),auth[_0xa8b8('0xa')](),controller['addAgents']);router[_0xa8b8('0x16')](_0xa8b8('0xd'),auth[_0xa8b8('0xa')](),controller[_0xa8b8('0x17')]);router[_0xa8b8('0x18')](_0xa8b8('0xd'),auth[_0xa8b8('0xa')](),controller[_0xa8b8('0x19')]);router[_0xa8b8('0x18')](_0xa8b8('0x10'),auth[_0xa8b8('0xa')](),controller[_0xa8b8('0x1a')]);router[_0xa8b8('0x18')](_0xa8b8('0x12'),auth[_0xa8b8('0xa')](),controller[_0xa8b8('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 2230860..4c1f87e 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 _0xa479=['rrmemory','beepall','roundrobin','sequelize','exports','name','STRING'];(function(_0x2c618e,_0x55b2ed){var _0x137877=function(_0x579bb3){while(--_0x579bb3){_0x2c618e['push'](_0x2c618e['shift']());}};_0x137877(++_0x55b2ed);}(_0xa479,0xd5));var _0x9a47=function(_0x5a0a30,_0x43728e){_0x5a0a30=_0x5a0a30-0x0;var _0x4b6d29=_0xa479[_0x5a0a30];return _0x4b6d29;};'use strict';var Sequelize=require(_0x9a47('0x0'));module[_0x9a47('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9a47('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9a47('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x9a47('0x4'),_0x9a47('0x5'),_0x9a47('0x6'))}}; \ No newline at end of file +var _0x99d0=['name','INTEGER','ENUM','rrmemory','sequelize','STRING'];(function(_0x577f84,_0x1f8ca4){var _0x40b31a=function(_0x4714eb){while(--_0x4714eb){_0x577f84['push'](_0x577f84['shift']());}};_0x40b31a(++_0x1f8ca4);}(_0x99d0,0x1d8));var _0x099d=function(_0x55d8c5,_0x10287a){_0x55d8c5=_0x55d8c5-0x0;var _0x225ae5=_0x99d0[_0x55d8c5];return _0x225ae5;};'use strict';var Sequelize=require(_0x099d('0x0'));module['exports']={'name':{'type':Sequelize[_0x099d('0x1')],'unique':_0x099d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x099d('0x1')]},'timeout':{'type':Sequelize[_0x099d('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x099d('0x4')](_0x099d('0x5'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 0ef402d..4a4d8f1 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 _0x68d7=['apply','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','error','name','map','SmsQueue','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','type','merge','includeAll','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','order','SmsQueueId','options','UserSmsQueue','User','findAndCountAll','agent','updatedAt','rows','format','SIP','smsPause','createdAt','getTeams','Team','addTeams','ids','findAll','Agents','online','voicePause','interface','sequelize','each','findOrCreate','forEach','emit','userSmsQueue:save','select','field','tq.TeamId','from','team_has_sms_queues','user_has_teams','clone','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','offset','undefined','count','set','Content-Range','json'];(function(_0x526252,_0x2ef977){var _0x316c4c=function(_0x2d6aa5){while(--_0x2d6aa5){_0x526252['push'](_0x526252['shift']());}};_0x316c4c(++_0x2ef977);}(_0x68d7,0xf4));var _0x768d=function(_0x112663,_0x235e72){_0x112663=_0x112663-0x0;var _0x358982=_0x68d7[_0x112663];return _0x358982;};'use strict';var emlformat=require(_0x768d('0x0'));var rimraf=require(_0x768d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x768d('0x2'));var rp=require(_0x768d('0x3'));var moment=require(_0x768d('0x4'));var BPromise=require(_0x768d('0x5'));var Mustache=require(_0x768d('0x6'));var util=require(_0x768d('0x7'));var path=require(_0x768d('0x8'));var sox=require(_0x768d('0x9'));var csv=require(_0x768d('0xa'));var ejs=require(_0x768d('0xb'));var fs=require('fs');var fs_extra=require(_0x768d('0xc'));var _=require(_0x768d('0xd'));var squel=require(_0x768d('0xe'));var crypto=require('crypto');var jsforce=require(_0x768d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x768d('0xa'));var querystring=require(_0x768d('0x10'));var Papa=require(_0x768d('0x11'));var Redis=require('ioredis');var authService=require(_0x768d('0x12'));var qs=require(_0x768d('0x13'));var as=require(_0x768d('0x14'));var hardwareService=require(_0x768d('0x15'));var logger=require(_0x768d('0x16'))(_0x768d('0x17'));var utils=require(_0x768d('0x18'));var config=require(_0x768d('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x768d('0x1a'))['db'];config['redis']=_[_0x768d('0x1b')](config[_0x768d('0x1c')],{'host':_0x768d('0x1d'),'port':0x18eb});var socket=require(_0x768d('0x1e'))(new Redis(config[_0x768d('0x1c')]));require(_0x768d('0x1f'))[_0x768d('0x20')](socket);function respondWithStatusCode(_0x50faeb,_0x1b5d22){_0x1b5d22=_0x1b5d22||0xcc;return function(_0xc0978b){if(_0xc0978b){return _0x50faeb[_0x768d('0x21')](_0x1b5d22);}return _0x50faeb[_0x768d('0x22')](_0x1b5d22)[_0x768d('0x23')]();};}function respondWithResult(_0x1a263f,_0x159c90){_0x159c90=_0x159c90||0xc8;return function(_0x3f4a93){if(_0x3f4a93){return _0x1a263f['status'](_0x159c90)['json'](_0x3f4a93);}};}function respondWithFilteredResult(_0x5b3db5,_0x2821ee){return function(_0x3b0353){if(_0x3b0353){var _0x5b6124=typeof _0x2821ee[_0x768d('0x24')]===_0x768d('0x25')&&typeof _0x2821ee['limit']==='undefined';var _0x490c61=_0x3b0353[_0x768d('0x26')];var _0x4b20d7=_0x5b6124?0x0:_0x2821ee[_0x768d('0x24')];var _0x20f717=_0x5b6124?_0x3b0353[_0x768d('0x26')]:_0x2821ee[_0x768d('0x24')]+_0x2821ee['limit'];var _0x2da488;if(_0x20f717>=_0x490c61){_0x20f717=_0x490c61;_0x2da488=0xc8;}else{_0x2da488=0xce;}_0x5b3db5[_0x768d('0x22')](_0x2da488);return _0x5b3db5[_0x768d('0x27')](_0x768d('0x28'),_0x4b20d7+'-'+_0x20f717+'/'+_0x490c61)[_0x768d('0x29')](_0x3b0353);}return null;};}function patchUpdates(_0x229555){return function(_0x27e520){try{jsonpatch[_0x768d('0x2a')](_0x27e520,_0x229555,!![]);}catch(_0x224b4c){return BPromise[_0x768d('0x2b')](_0x224b4c);}return _0x27e520[_0x768d('0x2c')]();};}function saveUpdates(_0x40fe3f,_0x4aaa5d){return function(_0x4d24df){if(_0x4d24df){return _0x4d24df[_0x768d('0x2d')](_0x40fe3f)[_0x768d('0x2e')](function(_0xb9165d){return _0xb9165d;});}return null;};}function removeEntity(_0x3dc993,_0x50577d){return function(_0x36053f){if(_0x36053f){return _0x36053f[_0x768d('0x2f')]()[_0x768d('0x2e')](function(){var _0x236a67=_0x36053f[_0x768d('0x30')]({'plain':!![]});var _0x862458=_0x768d('0x31');return db[_0x768d('0x32')][_0x768d('0x2f')]({'where':{'type':_0x862458,'resourceId':_0x236a67['id']}})[_0x768d('0x2e')](function(){return _0x36053f;});})[_0x768d('0x2e')](function(){_0x3dc993[_0x768d('0x22')](0xcc)[_0x768d('0x23')]();});}};}function handleEntityNotFound(_0x2a324f,_0x471b99){return function(_0x51b89b){if(!_0x51b89b){_0x2a324f[_0x768d('0x21')](0x194);}return _0x51b89b;};}function handleError(_0x3e0462,_0x2ea212){_0x2ea212=_0x2ea212||0x1f4;return function(_0x4f2770){logger[_0x768d('0x33')](_0x4f2770['stack']);if(_0x4f2770['name']){delete _0x4f2770[_0x768d('0x34')];}_0x3e0462[_0x768d('0x22')](_0x2ea212)['send'](_0x4f2770);};}exports['index']=function(_0x1e2335,_0xfdae1){var _0x2b4eec={},_0x2aa54c={},_0x50cf36={'count':0x0,'rows':[]};var _0x293c74=_[_0x768d('0x35')](db[_0x768d('0x36')][_0x768d('0x37')],function(_0x5d5c5c){return{'name':_0x5d5c5c[_0x768d('0x38')],'type':_0x5d5c5c['type']['key']};});_0x2aa54c[_0x768d('0x39')]=_[_0x768d('0x35')](_0x293c74,_0x768d('0x34'));_0x2aa54c[_0x768d('0x3a')]=_[_0x768d('0x3b')](_0x1e2335['query']);_0x2aa54c[_0x768d('0x3c')]=_[_0x768d('0x3d')](_0x2aa54c[_0x768d('0x39')],_0x2aa54c[_0x768d('0x3a')]);_0x2b4eec[_0x768d('0x3e')]=_[_0x768d('0x3d')](_0x2aa54c[_0x768d('0x39')],qs['fields'](_0x1e2335[_0x768d('0x3a')][_0x768d('0x3f')]));_0x2b4eec[_0x768d('0x3e')]=_0x2b4eec[_0x768d('0x3e')][_0x768d('0x40')]?_0x2b4eec[_0x768d('0x3e')]:_0x2aa54c[_0x768d('0x39')];if(!_0x1e2335[_0x768d('0x3a')][_0x768d('0x41')](_0x768d('0x42'))){_0x2b4eec[_0x768d('0x43')]=qs[_0x768d('0x43')](_0x1e2335[_0x768d('0x3a')][_0x768d('0x43')]);_0x2b4eec['offset']=qs['offset'](_0x1e2335[_0x768d('0x3a')][_0x768d('0x24')]);}_0x2b4eec['order']=qs[_0x768d('0x44')](_0x1e2335['query'][_0x768d('0x44')]);_0x2b4eec[_0x768d('0x45')]=qs[_0x768d('0x3c')](_[_0x768d('0x46')](_0x1e2335[_0x768d('0x3a')],_0x2aa54c[_0x768d('0x3c')]),_0x293c74);if(_0x1e2335[_0x768d('0x3a')][_0x768d('0x47')]){_0x2b4eec[_0x768d('0x45')]=_['merge'](_0x2b4eec[_0x768d('0x45')],{'$or':_[_0x768d('0x35')](_0x293c74,function(_0x16ef7c){if(_0x16ef7c[_0x768d('0x48')]!=='VIRTUAL'){var _0x4a7816={};_0x4a7816[_0x16ef7c[_0x768d('0x34')]]={'$like':'%'+_0x1e2335[_0x768d('0x3a')][_0x768d('0x47')]+'%'};return _0x4a7816;}})});}_0x2b4eec=_[_0x768d('0x49')]({},_0x2b4eec,_0x1e2335['options']);var _0x5afe90={'where':_0x2b4eec[_0x768d('0x45')]};return db[_0x768d('0x36')][_0x768d('0x26')](_0x5afe90)[_0x768d('0x2e')](function(_0x5ba251){_0x50cf36[_0x768d('0x26')]=_0x5ba251;if(_0x1e2335[_0x768d('0x3a')][_0x768d('0x4a')]){_0x2b4eec['include']=[{'all':!![]}];}return db[_0x768d('0x36')]['findAll'](_0x2b4eec);})[_0x768d('0x2e')](function(_0x27c727){_0x50cf36['rows']=_0x27c727;return _0x50cf36;})['then'](respondWithFilteredResult(_0xfdae1,_0x2b4eec))[_0x768d('0x4b')](handleError(_0xfdae1,null));};exports['show']=function(_0x228551,_0x3ea6c8){var _0x285dd6={'raw':!![],'where':{'id':_0x228551['params']['id']}},_0x40e663={};_0x40e663[_0x768d('0x39')]=_[_0x768d('0x3b')](db[_0x768d('0x36')][_0x768d('0x37')]);_0x40e663[_0x768d('0x3a')]=_[_0x768d('0x3b')](_0x228551[_0x768d('0x3a')]);_0x40e663[_0x768d('0x3c')]=_[_0x768d('0x3d')](_0x40e663[_0x768d('0x39')],_0x40e663[_0x768d('0x3a')]);_0x285dd6[_0x768d('0x3e')]=_[_0x768d('0x3d')](_0x40e663[_0x768d('0x39')],qs['fields'](_0x228551[_0x768d('0x3a')][_0x768d('0x3f')]));_0x285dd6['attributes']=_0x285dd6['attributes'][_0x768d('0x40')]?_0x285dd6['attributes']:_0x40e663[_0x768d('0x39')];if(_0x228551['query'][_0x768d('0x4a')]){_0x285dd6['include']=[{'all':!![]}];}_0x285dd6=_[_0x768d('0x49')]({},_0x285dd6,_0x228551['options']);return db[_0x768d('0x36')][_0x768d('0x4c')](_0x285dd6)[_0x768d('0x2e')](handleEntityNotFound(_0x3ea6c8,null))[_0x768d('0x2e')](respondWithResult(_0x3ea6c8,null))[_0x768d('0x4b')](handleError(_0x3ea6c8,null));};exports['create']=function(_0x3095d4,_0x1716ab){return db['SmsQueue'][_0x768d('0x4d')](_0x3095d4[_0x768d('0x4e')],{})[_0x768d('0x2e')](function(_0x34ac84){var _0x75e859=_0x3095d4[_0x768d('0x4f')]['get']({'plain':!![]});if(!_0x75e859)throw new Error(_0x768d('0x50'));if(_0x75e859['role']===_0x768d('0x4f')){var _0x5c0e53=_0x34ac84[_0x768d('0x30')]({'plain':!![]});var _0x24e67d=_0x768d('0x31');return db[_0x768d('0x51')][_0x768d('0x4c')]({'where':{'name':_0x24e67d,'userProfileId':_0x75e859[_0x768d('0x52')]},'raw':!![]})['then'](function(_0x108d2b){if(_0x108d2b&&_0x108d2b[_0x768d('0x53')]===0x0){return db[_0x768d('0x32')]['create']({'name':_0x5c0e53['name'],'resourceId':_0x5c0e53['id'],'type':_0x108d2b[_0x768d('0x34')],'sectionId':_0x108d2b['id']},{})[_0x768d('0x2e')](function(){return _0x34ac84;});}else{return _0x34ac84;}})[_0x768d('0x4b')](function(_0x16b4a0){logger[_0x768d('0x33')](_0x768d('0x54'),_0x16b4a0);throw _0x16b4a0;});}return _0x34ac84;})[_0x768d('0x2e')](respondWithResult(_0x1716ab,0xc9))[_0x768d('0x4b')](handleError(_0x1716ab,null));};exports[_0x768d('0x2d')]=function(_0x3b3f5b,_0x58a818){if(_0x3b3f5b[_0x768d('0x4e')]['id']){delete _0x3b3f5b[_0x768d('0x4e')]['id'];}return db[_0x768d('0x36')][_0x768d('0x4c')]({'where':{'id':_0x3b3f5b[_0x768d('0x55')]['id']}})[_0x768d('0x2e')](handleEntityNotFound(_0x58a818,null))[_0x768d('0x2e')](saveUpdates(_0x3b3f5b['body'],null))[_0x768d('0x2e')](respondWithResult(_0x58a818,null))[_0x768d('0x4b')](handleError(_0x58a818,null));};exports[_0x768d('0x2f')]=function(_0x3b435b,_0x330240){return db['SmsQueue']['find']({'where':{'id':_0x3b435b[_0x768d('0x55')]['id']}})[_0x768d('0x2e')](handleEntityNotFound(_0x330240,null))[_0x768d('0x2e')](removeEntity(_0x330240,null))[_0x768d('0x4b')](handleError(_0x330240,null));};exports[_0x768d('0x56')]=function(_0x23a632,_0x1fac07){return db[_0x768d('0x36')][_0x768d('0x56')]()['then'](respondWithResult(_0x1fac07,null))[_0x768d('0x4b')](handleError(_0x1fac07,null));};exports[_0x768d('0x57')]=function(_0x2b5384,_0x265ec7,_0x5b9770){var _0x146934={'raw':!![],'where':{}},_0x367ffe={},_0x4b42ed;return db['SmsQueue'][_0x768d('0x58')]({'where':{'id':_0x2b5384['params']['id']}})['then'](handleEntityNotFound(_0x265ec7,null))[_0x768d('0x2e')](function(_0x591889){if(_0x591889){_0x4b42ed=_0x591889[_0x768d('0x30')]({'plain':!![]});_0x367ffe[_0x768d('0x39')]=_[_0x768d('0x3b')](db['UserSmsQueue'][_0x768d('0x37')]);_0x367ffe[_0x768d('0x3a')]=_['keys'](_0x2b5384[_0x768d('0x3a')]);_0x367ffe['filters']=_[_0x768d('0x3d')](_0x367ffe['model'],_0x367ffe[_0x768d('0x3a')]);_0x146934[_0x768d('0x3e')]=_['intersection'](_0x367ffe[_0x768d('0x39')],qs[_0x768d('0x3f')](_0x2b5384['query'][_0x768d('0x3f')]));_0x146934['attributes']=_0x146934[_0x768d('0x3e')][_0x768d('0x40')]?_0x146934[_0x768d('0x3e')]:_0x367ffe[_0x768d('0x39')];if(!_0x2b5384[_0x768d('0x3a')][_0x768d('0x41')]('nolimit')){_0x146934[_0x768d('0x43')]=qs[_0x768d('0x43')](_0x2b5384[_0x768d('0x3a')][_0x768d('0x43')]);_0x146934['offset']=qs['offset'](_0x2b5384[_0x768d('0x3a')][_0x768d('0x24')]);}_0x146934[_0x768d('0x59')]=qs[_0x768d('0x44')](_0x2b5384[_0x768d('0x3a')][_0x768d('0x44')]);_0x146934[_0x768d('0x45')]=qs[_0x768d('0x3c')](_[_0x768d('0x46')](_0x2b5384[_0x768d('0x3a')],_0x367ffe[_0x768d('0x3c')]));_0x146934['where'][_0x768d('0x5a')]=_0x591889['id'];if(_0x2b5384[_0x768d('0x3a')][_0x768d('0x47')]){_0x146934[_0x768d('0x45')]=_['merge'](_0x146934[_0x768d('0x45')],{'$or':_['map'](_0x146934[_0x768d('0x3e')],function(_0x5dcf7b){var _0x711d82={};_0x711d82[_0x5dcf7b]={'$like':'%'+_0x2b5384[_0x768d('0x3a')][_0x768d('0x47')]+'%'};return _0x711d82;})});}_0x146934=_[_0x768d('0x49')]({},_0x146934,_0x2b5384[_0x768d('0x5b')]);return db[_0x768d('0x5c')]['findAll'](_0x146934);}})[_0x768d('0x2e')](function(_0x1172b0){if(_0x1172b0){return db[_0x768d('0x5d')][_0x768d('0x5e')]({'where':{'id':_[_0x768d('0x35')](_0x1172b0,'UserId'),'role':_0x768d('0x5f')},'attributes':['id',_0x768d('0x34'),'smsPause',_0x768d('0x60'),'createdAt']});}})['then'](function(_0x28e92a){if(_0x28e92a){return{'count':_0x28e92a[_0x768d('0x26')],'rows':_[_0x768d('0x35')](_0x28e92a[_0x768d('0x61')],function(_0xab7116){return{'membername':_0xab7116[_0x768d('0x34')],'UserId':_0xab7116['id'],'queue_name':_0x4b42ed[_0x768d('0x34')],'SmsQueueId':_0x4b42ed['id'],'interface':util[_0x768d('0x62')]('%s/%s',_0x768d('0x63'),_0xab7116[_0x768d('0x34')]),'penalty':0x0,'paused':_0xab7116[_0x768d('0x64')],'createdAt':_0xab7116[_0x768d('0x65')],'updatedAt':_0xab7116['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x768d('0x2e')](respondWithFilteredResult(_0x265ec7,_0x146934))['catch'](handleError(_0x265ec7,null));};exports[_0x768d('0x66')]=function(_0x4a7527,_0x482213,_0xac8b3a){var _0x2835b6={};var _0x4c916e={};var _0x639350;var _0x71b6f1;return db['SmsQueue']['findOne']({'where':{'id':_0x4a7527['params']['id']}})[_0x768d('0x2e')](handleEntityNotFound(_0x482213,null))[_0x768d('0x2e')](function(_0x4a798c){if(_0x4a798c){_0x639350=_0x4a798c;_0x4c916e[_0x768d('0x39')]=_[_0x768d('0x3b')](db[_0x768d('0x67')][_0x768d('0x37')]);_0x4c916e[_0x768d('0x3a')]=_[_0x768d('0x3b')](_0x4a7527[_0x768d('0x3a')]);_0x4c916e['filters']=_['intersection'](_0x4c916e['model'],_0x4c916e['query']);_0x2835b6[_0x768d('0x3e')]=_['intersection'](_0x4c916e[_0x768d('0x39')],qs[_0x768d('0x3f')](_0x4a7527['query'][_0x768d('0x3f')]));_0x2835b6['attributes']=_0x2835b6['attributes'][_0x768d('0x40')]?_0x2835b6[_0x768d('0x3e')]:_0x4c916e['model'];_0x2835b6['order']=qs['sort'](_0x4a7527[_0x768d('0x3a')]['sort']);_0x2835b6['where']=qs[_0x768d('0x3c')](_[_0x768d('0x46')](_0x4a7527[_0x768d('0x3a')],_0x4c916e[_0x768d('0x3c')]));if(_0x4a7527[_0x768d('0x3a')][_0x768d('0x47')]){_0x2835b6[_0x768d('0x45')]=_[_0x768d('0x49')](_0x2835b6[_0x768d('0x45')],{'$or':_['map'](_0x2835b6[_0x768d('0x3e')],function(_0x36d244){var _0x53e8ea={};_0x53e8ea[_0x36d244]={'$like':'%'+_0x4a7527[_0x768d('0x3a')]['filter']+'%'};return _0x53e8ea;})});}_0x2835b6=_[_0x768d('0x49')]({},_0x2835b6,_0x4a7527[_0x768d('0x5b')]);return _0x639350['getTeams'](_0x2835b6);}})[_0x768d('0x2e')](function(_0x33bfb7){if(_0x33bfb7){_0x71b6f1=_0x33bfb7['length'];if(!_0x4a7527[_0x768d('0x3a')]['hasOwnProperty'](_0x768d('0x42'))){_0x2835b6[_0x768d('0x43')]=qs[_0x768d('0x43')](_0x4a7527[_0x768d('0x3a')][_0x768d('0x43')]);_0x2835b6[_0x768d('0x24')]=qs[_0x768d('0x24')](_0x4a7527['query']['offset']);}return _0x639350['getTeams'](_0x2835b6);}})[_0x768d('0x2e')](function(_0x54479c){if(_0x54479c){return _0x54479c?{'count':_0x71b6f1,'rows':_0x54479c}:null;}})[_0x768d('0x2e')](respondWithResult(_0x482213,null))[_0x768d('0x4b')](handleError(_0x482213,null));};exports[_0x768d('0x68')]=function(_0x98c4bb,_0x4c03e6,_0x5c36cf){var _0x394f6a=_0x98c4bb[_0x768d('0x4e')][_0x768d('0x69')];return db['Team'][_0x768d('0x6a')]({'where':{'id':_0x394f6a},'attributes':['id'],'include':[{'model':db[_0x768d('0x5d')],'as':_0x768d('0x6b'),'attributes':['id','name',_0x768d('0x6c'),_0x768d('0x6d'),_0x768d('0x6e')],'raw':!![]}]})[_0x768d('0x2e')](function(_0xd9661e){if(_0xd9661e){var _0x3543e6=_['flatMap'](_0xd9661e,function(_0x5771fb){var _0x51b5d5=_0x5771fb[_0x768d('0x30')]({'plain':!![]});return _0x51b5d5[_0x768d('0x6b')];});return db[_0x768d('0x36')]['find']({'where':{'id':_0x98c4bb[_0x768d('0x55')]['id']}})['then'](function(_0x1b689b){return db[_0x768d('0x6f')]['transaction'](function(_0x5f545c){return _0x1b689b[_0x768d('0x68')](_0x394f6a,{'transaction':_0x5f545c})[_0x768d('0x2e')](function(){return BPromise[_0x768d('0x70')](_0x3543e6,function(_0x205452){return db['UserSmsQueue'][_0x768d('0x71')]({'where':{'UserId':_0x205452['id'],'SmsQueueId':_0x98c4bb[_0x768d('0x55')]['id']},'transaction':_0x5f545c});});})[_0x768d('0x2e')](function(){_0x3543e6[_0x768d('0x72')](function(_0x3e0788){socket[_0x768d('0x73')](_0x768d('0x74'),{'UserId':_0x3e0788['id'],'SmsQueueId':_0x1b689b['id']});});});});});}})[_0x768d('0x2e')](respondWithStatusCode(_0x4c03e6,null))['catch'](handleError(_0x4c03e6,null));};exports['removeTeams']=function(_0x2f3598,_0x2a1a87,_0x5ca659){return db[_0x768d('0x67')][_0x768d('0x6a')]({'where':{'id':_0x2f3598['query'][_0x768d('0x69')]},'attributes':['id'],'include':[{'model':db[_0x768d('0x5d')],'as':_0x768d('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x768d('0x2e')](handleEntityNotFound(_0x2a1a87,null))['then'](function(_0xaf9ace){var _0xb80c30=_['map'](_0xaf9ace,'id');var _0x4b3546=[];var _0x5f5862=[];var _0x50f2f1=squel[_0x768d('0x75')]();_0x50f2f1[_0x768d('0x76')](_0x768d('0x77'))[_0x768d('0x78')](_0x768d('0x79'),'tq')['join'](_0x768d('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x2f3598[_0x768d('0x55')]['id']);for(var _0x1f3507=0x0;_0x1f3507<_0xaf9ace['length'];_0x1f3507+=0x1){let _0x3a6c3d=_0xaf9ace[_0x1f3507];for(var _0xe5f995=0x0;_0xe5f995<_0x3a6c3d[_0x768d('0x6b')][_0x768d('0x40')];_0xe5f995+=0x1){let _0x22d702=_0x3a6c3d['Agents'][_0xe5f995];var _0x29e69a=_0x50f2f1[_0x768d('0x7b')]();_0x29e69a[_0x768d('0x45')]('ut.UserId\x20=\x20?',_0x22d702['id']);_0x5f5862[_0x768d('0x7c')](db[_0x768d('0x6f')][_0x768d('0x3a')](_0x29e69a[_0x768d('0x7d')](),{'type':db[_0x768d('0x6f')][_0x768d('0x7e')][_0x768d('0x7f')]})[_0x768d('0x2e')](function(_0x5a7c7b){if(_0x5a7c7b['length']===0x1){return _0x22d702['id'];}else{var _0xd7534d=_[_0x768d('0x80')](_[_0x768d('0x35')](_0x5a7c7b,'TeamId'),function(_0x3fd53e){return _[_0x768d('0x81')](_0xb80c30,_0x3fd53e);});if(_0xd7534d){return _0x22d702['id'];}}}));}}return BPromise[_0x768d('0x82')](_0x5f5862)[_0x768d('0x2e')](function(_0x22b1a0){_0x4b3546=_(_0x4b3546)[_0x768d('0x83')](_0x22b1a0)[_0x768d('0x84')]()[_0x768d('0x85')]();return db[_0x768d('0x36')][_0x768d('0x4c')]({'where':{'id':_0x2f3598[_0x768d('0x55')]['id']}})[_0x768d('0x2e')](function(_0x139928){return db[_0x768d('0x6f')][_0x768d('0x86')](function(_0x33fab4){return _0x139928['removeTeams'](_0x2f3598[_0x768d('0x3a')]['ids'],{'transaction':_0x33fab4})[_0x768d('0x2e')](function(){if(!_[_0x768d('0x87')](_0x4b3546)){return _0x139928[_0x768d('0x88')](_0x4b3546,{'transaction':_0x33fab4});}})['then'](function(){_0x4b3546[_0x768d('0x72')](function(_0xc3911a){socket[_0x768d('0x73')]('userSmsQueue:remove',{'UserId':_0xc3911a,'SmsQueueId':_0x139928['id']});});});});});});})[_0x768d('0x2e')](respondWithStatusCode(_0x2a1a87,null))[_0x768d('0x4b')](handleError(_0x2a1a87,null));};exports[_0x768d('0x89')]=function(_0x35197f,_0x35e0cd,_0x4b891b){return db[_0x768d('0x36')]['find']({'where':{'id':_0x35197f[_0x768d('0x55')]['id']}})[_0x768d('0x2e')](handleEntityNotFound(_0x35e0cd,null))['then'](function(_0x56a524){if(_0x56a524){return _0x56a524['addAgents'](_0x35197f[_0x768d('0x4e')]['ids'],_[_0x768d('0x8a')](_0x35197f['body'],[_0x768d('0x69'),'id'])||{})[_0x768d('0x8b')](function(_0x4768ce){for(var _0x5b1747=0x0;_0x5b1747<_0x35197f[_0x768d('0x4e')][_0x768d('0x69')][_0x768d('0x40')];_0x5b1747+=0x1){socket[_0x768d('0x73')](_0x768d('0x74'),{'UserId':Number(_0x35197f[_0x768d('0x4e')][_0x768d('0x69')][_0x5b1747]),'SmsQueueId':Number(_0x35197f[_0x768d('0x55')]['id'])});}return _0x4768ce;});}})[_0x768d('0x2e')](respondWithResult(_0x35e0cd,null))['catch'](handleError(_0x35e0cd,null));};exports[_0x768d('0x88')]=function(_0x585524,_0x574df0,_0x1608b0){return db[_0x768d('0x36')]['find']({'where':{'id':_0x585524[_0x768d('0x55')]['id']}})[_0x768d('0x2e')](handleEntityNotFound(_0x574df0,null))[_0x768d('0x2e')](function(_0x217b65){if(_0x217b65){return _0x217b65[_0x768d('0x88')](_0x585524[_0x768d('0x3a')][_0x768d('0x69')])[_0x768d('0x2e')](function(){if(_[_0x768d('0x8c')](_0x585524[_0x768d('0x3a')][_0x768d('0x69')])){for(var _0x24865a=0x0;_0x24865a<_0x585524['query'][_0x768d('0x69')][_0x768d('0x40')];_0x24865a+=0x1){socket[_0x768d('0x73')](_0x768d('0x8d'),{'UserId':Number(_0x585524[_0x768d('0x3a')][_0x768d('0x69')][_0x24865a]),'SmsQueueId':Number(_0x585524[_0x768d('0x55')]['id'])});}}else{socket[_0x768d('0x73')](_0x768d('0x8d'),{'UserId':Number(_0x585524['query'][_0x768d('0x69')]),'SmsQueueId':Number(_0x585524[_0x768d('0x55')]['id'])});}});}})[_0x768d('0x2e')](respondWithStatusCode(_0x574df0,null))[_0x768d('0x4b')](handleError(_0x574df0,null));};exports['getAgents']=function(_0x3b9a1a,_0x540324,_0x2ec191){var _0x1eb129={};var _0xea7f42={};var _0x2d6ff8;var _0x14cc24;return db[_0x768d('0x36')][_0x768d('0x58')]({'where':{'id':_0x3b9a1a[_0x768d('0x55')]['id']}})['then'](handleEntityNotFound(_0x540324,null))['then'](function(_0x61998a){if(_0x61998a){_0x2d6ff8=_0x61998a;_0xea7f42['model']=_[_0x768d('0x3b')](db[_0x768d('0x5d')]['rawAttributes']);_0xea7f42[_0x768d('0x3a')]=_[_0x768d('0x3b')](_0x3b9a1a[_0x768d('0x3a')]);_0xea7f42[_0x768d('0x3c')]=_['intersection'](_0xea7f42[_0x768d('0x39')],_0xea7f42[_0x768d('0x3a')]);_0x1eb129['attributes']=_[_0x768d('0x3d')](_0xea7f42[_0x768d('0x39')],qs[_0x768d('0x3f')](_0x3b9a1a[_0x768d('0x3a')][_0x768d('0x3f')]));_0x1eb129[_0x768d('0x3e')]=_0x1eb129[_0x768d('0x3e')][_0x768d('0x40')]?_0x1eb129[_0x768d('0x3e')]:_0xea7f42[_0x768d('0x39')];_0x1eb129[_0x768d('0x59')]=qs[_0x768d('0x44')](_0x3b9a1a[_0x768d('0x3a')][_0x768d('0x44')]);_0x1eb129[_0x768d('0x45')]=qs['filters'](_[_0x768d('0x46')](_0x3b9a1a[_0x768d('0x3a')],_0xea7f42['filters']));if(_0x3b9a1a[_0x768d('0x3a')][_0x768d('0x47')]){_0x1eb129[_0x768d('0x45')]=_['merge'](_0x1eb129['where'],{'$or':_[_0x768d('0x35')](_0x1eb129[_0x768d('0x3e')],function(_0x1d41ac){var _0x3e5636={};_0x3e5636[_0x1d41ac]={'$like':'%'+_0x3b9a1a[_0x768d('0x3a')]['filter']+'%'};return _0x3e5636;})});}_0x1eb129=_[_0x768d('0x49')]({},_0x1eb129,_0x3b9a1a['options']);return _0x2d6ff8['getAgents'](_0x1eb129);}})[_0x768d('0x2e')](function(_0x519c75){if(_0x519c75){_0x14cc24=_0x519c75[_0x768d('0x40')];if(!_0x3b9a1a[_0x768d('0x3a')][_0x768d('0x41')](_0x768d('0x42'))){_0x1eb129[_0x768d('0x43')]=qs[_0x768d('0x43')](_0x3b9a1a[_0x768d('0x3a')][_0x768d('0x43')]);_0x1eb129['offset']=qs[_0x768d('0x24')](_0x3b9a1a[_0x768d('0x3a')][_0x768d('0x24')]);}return _0x2d6ff8[_0x768d('0x8e')](_0x1eb129);}})[_0x768d('0x2e')](function(_0x4d3744){if(_0x4d3744){return _0x4d3744?{'count':_0x14cc24,'rows':_0x4d3744}:null;}})['then'](respondWithResult(_0x540324,null))[_0x768d('0x4b')](handleError(_0x540324,null));}; \ No newline at end of file +var _0x720f=['to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','SmsQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SmsQueue','includeAll','include','rows','catch','params','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','UserSmsQueue','keys','SmsQueueId','findAll','User','UserId','agent','smsPause','updatedAt','createdAt','format','SIP','getTeams','Team','rawAttributes','ids','Agents','online','voicePause','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','union','compact','value','emit','addAgents','spread','removeAgents','isArray','userSmsQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x38c632,_0x14e8e6){var _0x12737e=function(_0x3e0fe4){while(--_0x3e0fe4){_0x38c632['push'](_0x38c632['shift']());}};_0x12737e(++_0x14e8e6);}(_0x720f,0x80));var _0xf720=function(_0x96f74c,_0xfc30a4){_0x96f74c=_0x96f74c-0x0;var _0x379222=_0x720f[_0x96f74c];return _0x379222;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf720('0x0'));var zipdir=require(_0xf720('0x1'));var jsonpatch=require(_0xf720('0x2'));var rp=require(_0xf720('0x3'));var moment=require(_0xf720('0x4'));var BPromise=require(_0xf720('0x5'));var Mustache=require('mustache');var util=require(_0xf720('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf720('0x7'));var _=require('lodash');var squel=require(_0xf720('0x8'));var crypto=require(_0xf720('0x9'));var jsforce=require(_0xf720('0xa'));var deskjs=require(_0xf720('0xb'));var toCsv=require(_0xf720('0xc'));var querystring=require(_0xf720('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf720('0xe'));var qs=require(_0xf720('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf720('0x10'));var logger=require(_0xf720('0x11'))(_0xf720('0x12'));var utils=require(_0xf720('0x13'));var config=require(_0xf720('0x14'));var licenseUtil=require(_0xf720('0x15'));var db=require(_0xf720('0x16'))['db'];config[_0xf720('0x17')]=_[_0xf720('0x18')](config[_0xf720('0x17')],{'host':_0xf720('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf720('0x17')]));require(_0xf720('0x1a'))['register'](socket);function respondWithStatusCode(_0x5a24fe,_0x34f5b2){_0x34f5b2=_0x34f5b2||0xcc;return function(_0x187283){if(_0x187283){return _0x5a24fe['sendStatus'](_0x34f5b2);}return _0x5a24fe[_0xf720('0x1b')](_0x34f5b2)[_0xf720('0x1c')]();};}function respondWithResult(_0x91f4a6,_0x321134){_0x321134=_0x321134||0xc8;return function(_0x3b791a){if(_0x3b791a){return _0x91f4a6['status'](_0x321134)[_0xf720('0x1d')](_0x3b791a);}};}function respondWithFilteredResult(_0x447864,_0x675ded){return function(_0x3e0771){if(_0x3e0771){var _0x141ba5=typeof _0x675ded[_0xf720('0x1e')]===_0xf720('0x1f')&&typeof _0x675ded[_0xf720('0x20')]===_0xf720('0x1f');var _0x3a692c=_0x3e0771[_0xf720('0x21')];var _0x15fc73=_0x141ba5?0x0:_0x675ded[_0xf720('0x1e')];var _0x5559c8=_0x141ba5?_0x3e0771[_0xf720('0x21')]:_0x675ded[_0xf720('0x1e')]+_0x675ded[_0xf720('0x20')];var _0x52d418;if(_0x5559c8>=_0x3a692c){_0x5559c8=_0x3a692c;_0x52d418=0xc8;}else{_0x52d418=0xce;}_0x447864['status'](_0x52d418);return _0x447864[_0xf720('0x22')](_0xf720('0x23'),_0x15fc73+'-'+_0x5559c8+'/'+_0x3a692c)['json'](_0x3e0771);}return null;};}function patchUpdates(_0x84c1f){return function(_0x4dca3b){try{jsonpatch[_0xf720('0x24')](_0x4dca3b,_0x84c1f,!![]);}catch(_0x4f7eb4){return BPromise[_0xf720('0x25')](_0x4f7eb4);}return _0x4dca3b['save']();};}function saveUpdates(_0x662c13,_0x5b580f){return function(_0x56ceea){if(_0x56ceea){return _0x56ceea[_0xf720('0x26')](_0x662c13)[_0xf720('0x27')](function(_0x1e7cc7){return _0x1e7cc7;});}return null;};}function removeEntity(_0x747df6,_0x116c35){return function(_0x385abf){if(_0x385abf){return _0x385abf[_0xf720('0x28')]()['then'](function(){var _0x18cf33=_0x385abf[_0xf720('0x29')]({'plain':!![]});var _0x20442a=_0xf720('0x2a');return db[_0xf720('0x2b')][_0xf720('0x28')]({'where':{'type':_0x20442a,'resourceId':_0x18cf33['id']}})[_0xf720('0x27')](function(){return _0x385abf;});})[_0xf720('0x27')](function(){_0x747df6[_0xf720('0x1b')](0xcc)[_0xf720('0x1c')]();});}};}function handleEntityNotFound(_0x3f83e4,_0x3c432e){return function(_0x3bcaf2){if(!_0x3bcaf2){_0x3f83e4[_0xf720('0x2c')](0x194);}return _0x3bcaf2;};}function handleError(_0x420e6b,_0x550d29){_0x550d29=_0x550d29||0x1f4;return function(_0x927dea){logger[_0xf720('0x2d')](_0x927dea[_0xf720('0x2e')]);if(_0x927dea['name']){delete _0x927dea[_0xf720('0x2f')];}_0x420e6b[_0xf720('0x1b')](_0x550d29)[_0xf720('0x30')](_0x927dea);};}exports[_0xf720('0x31')]=function(_0x488578,_0x49d24f){var _0x2f84d9={},_0x3795e6={},_0x2cf8ae={'count':0x0,'rows':[]};var _0x10f61c=_[_0xf720('0x32')](db['SmsQueue']['rawAttributes'],function(_0x7d0a15){return{'name':_0x7d0a15[_0xf720('0x33')],'type':_0x7d0a15[_0xf720('0x34')][_0xf720('0x35')]};});_0x3795e6[_0xf720('0x36')]=_[_0xf720('0x32')](_0x10f61c,_0xf720('0x2f'));_0x3795e6[_0xf720('0x37')]=_['keys'](_0x488578[_0xf720('0x37')]);_0x3795e6[_0xf720('0x38')]=_[_0xf720('0x39')](_0x3795e6[_0xf720('0x36')],_0x3795e6[_0xf720('0x37')]);_0x2f84d9[_0xf720('0x3a')]=_[_0xf720('0x39')](_0x3795e6[_0xf720('0x36')],qs['fields'](_0x488578[_0xf720('0x37')][_0xf720('0x3b')]));_0x2f84d9[_0xf720('0x3a')]=_0x2f84d9[_0xf720('0x3a')]['length']?_0x2f84d9[_0xf720('0x3a')]:_0x3795e6[_0xf720('0x36')];if(!_0x488578[_0xf720('0x37')][_0xf720('0x3c')](_0xf720('0x3d'))){_0x2f84d9['limit']=qs['limit'](_0x488578[_0xf720('0x37')][_0xf720('0x20')]);_0x2f84d9[_0xf720('0x1e')]=qs[_0xf720('0x1e')](_0x488578[_0xf720('0x37')][_0xf720('0x1e')]);}_0x2f84d9[_0xf720('0x3e')]=qs[_0xf720('0x3f')](_0x488578[_0xf720('0x37')][_0xf720('0x3f')]);_0x2f84d9[_0xf720('0x40')]=qs[_0xf720('0x38')](_[_0xf720('0x41')](_0x488578[_0xf720('0x37')],_0x3795e6[_0xf720('0x38')]),_0x10f61c);if(_0x488578['query'][_0xf720('0x42')]){_0x2f84d9['where']=_[_0xf720('0x43')](_0x2f84d9[_0xf720('0x40')],{'$or':_[_0xf720('0x32')](_0x10f61c,function(_0x10d527){if(_0x10d527[_0xf720('0x34')]!==_0xf720('0x44')){var _0xc748f5={};_0xc748f5[_0x10d527[_0xf720('0x2f')]]={'$like':'%'+_0x488578[_0xf720('0x37')]['filter']+'%'};return _0xc748f5;}})});}_0x2f84d9=_[_0xf720('0x43')]({},_0x2f84d9,_0x488578['options']);var _0x2217bd={'where':_0x2f84d9[_0xf720('0x40')]};return db[_0xf720('0x45')][_0xf720('0x21')](_0x2217bd)[_0xf720('0x27')](function(_0x1b20cc){_0x2cf8ae[_0xf720('0x21')]=_0x1b20cc;if(_0x488578[_0xf720('0x37')][_0xf720('0x46')]){_0x2f84d9[_0xf720('0x47')]=[{'all':!![]}];}return db['SmsQueue']['findAll'](_0x2f84d9);})[_0xf720('0x27')](function(_0x464ba2){_0x2cf8ae[_0xf720('0x48')]=_0x464ba2;return _0x2cf8ae;})[_0xf720('0x27')](respondWithFilteredResult(_0x49d24f,_0x2f84d9))[_0xf720('0x49')](handleError(_0x49d24f,null));};exports['show']=function(_0x3cb4ab,_0x54e795){var _0x165c9f={'raw':!![],'where':{'id':_0x3cb4ab[_0xf720('0x4a')]['id']}},_0x150ac3={};_0x150ac3['model']=_['keys'](db[_0xf720('0x45')]['rawAttributes']);_0x150ac3[_0xf720('0x37')]=_['keys'](_0x3cb4ab[_0xf720('0x37')]);_0x150ac3[_0xf720('0x38')]=_[_0xf720('0x39')](_0x150ac3[_0xf720('0x36')],_0x150ac3[_0xf720('0x37')]);_0x165c9f[_0xf720('0x3a')]=_['intersection'](_0x150ac3[_0xf720('0x36')],qs[_0xf720('0x3b')](_0x3cb4ab[_0xf720('0x37')][_0xf720('0x3b')]));_0x165c9f[_0xf720('0x3a')]=_0x165c9f[_0xf720('0x3a')][_0xf720('0x4b')]?_0x165c9f['attributes']:_0x150ac3[_0xf720('0x36')];if(_0x3cb4ab[_0xf720('0x37')][_0xf720('0x46')]){_0x165c9f[_0xf720('0x47')]=[{'all':!![]}];}_0x165c9f=_[_0xf720('0x43')]({},_0x165c9f,_0x3cb4ab[_0xf720('0x4c')]);return db[_0xf720('0x45')][_0xf720('0x4d')](_0x165c9f)[_0xf720('0x27')](handleEntityNotFound(_0x54e795,null))['then'](respondWithResult(_0x54e795,null))['catch'](handleError(_0x54e795,null));};exports['create']=function(_0xcb3d70,_0x48cfa7){return db[_0xf720('0x45')][_0xf720('0x4e')](_0xcb3d70[_0xf720('0x4f')],{})['then'](function(_0x5dae40){var _0x490fad=_0xcb3d70[_0xf720('0x50')][_0xf720('0x29')]({'plain':!![]});if(!_0x490fad)throw new Error(_0xf720('0x51'));if(_0x490fad['role']===_0xf720('0x50')){var _0x35e1d8=_0x5dae40['get']({'plain':!![]});var _0x140981=_0xf720('0x2a');return db[_0xf720('0x52')][_0xf720('0x4d')]({'where':{'name':_0x140981,'userProfileId':_0x490fad[_0xf720('0x53')]},'raw':!![]})['then'](function(_0x133fca){if(_0x133fca&&_0x133fca[_0xf720('0x54')]===0x0){return db[_0xf720('0x2b')]['create']({'name':_0x35e1d8[_0xf720('0x2f')],'resourceId':_0x35e1d8['id'],'type':_0x133fca[_0xf720('0x2f')],'sectionId':_0x133fca['id']},{})[_0xf720('0x27')](function(){return _0x5dae40;});}else{return _0x5dae40;}})[_0xf720('0x49')](function(_0xa679df){logger[_0xf720('0x2d')](_0xf720('0x55'),_0xa679df);throw _0xa679df;});}return _0x5dae40;})['then'](respondWithResult(_0x48cfa7,0xc9))[_0xf720('0x49')](handleError(_0x48cfa7,null));};exports[_0xf720('0x26')]=function(_0x5d7e4b,_0x4d8eb4){if(_0x5d7e4b[_0xf720('0x4f')]['id']){delete _0x5d7e4b[_0xf720('0x4f')]['id'];}return db[_0xf720('0x45')]['find']({'where':{'id':_0x5d7e4b[_0xf720('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4d8eb4,null))[_0xf720('0x27')](saveUpdates(_0x5d7e4b[_0xf720('0x4f')],null))[_0xf720('0x27')](respondWithResult(_0x4d8eb4,null))[_0xf720('0x49')](handleError(_0x4d8eb4,null));};exports[_0xf720('0x28')]=function(_0x50e508,_0x261a57){return db['SmsQueue']['find']({'where':{'id':_0x50e508[_0xf720('0x4a')]['id']}})[_0xf720('0x27')](handleEntityNotFound(_0x261a57,null))['then'](removeEntity(_0x261a57,null))[_0xf720('0x49')](handleError(_0x261a57,null));};exports['describe']=function(_0x1587fd,_0x535a44){return db[_0xf720('0x45')]['describe']()['then'](respondWithResult(_0x535a44,null))['catch'](handleError(_0x535a44,null));};exports['getMembers']=function(_0x31911c,_0x1ac56b,_0x298413){var _0x8926fc={'raw':!![],'where':{}},_0x522bb0={},_0x4507e2;return db['SmsQueue'][_0xf720('0x56')]({'where':{'id':_0x31911c[_0xf720('0x4a')]['id']}})[_0xf720('0x27')](handleEntityNotFound(_0x1ac56b,null))['then'](function(_0x2896de){if(_0x2896de){_0x4507e2=_0x2896de[_0xf720('0x29')]({'plain':!![]});_0x522bb0[_0xf720('0x36')]=_['keys'](db[_0xf720('0x57')]['rawAttributes']);_0x522bb0['query']=_[_0xf720('0x58')](_0x31911c['query']);_0x522bb0[_0xf720('0x38')]=_['intersection'](_0x522bb0[_0xf720('0x36')],_0x522bb0[_0xf720('0x37')]);_0x8926fc['attributes']=_[_0xf720('0x39')](_0x522bb0[_0xf720('0x36')],qs[_0xf720('0x3b')](_0x31911c[_0xf720('0x37')][_0xf720('0x3b')]));_0x8926fc[_0xf720('0x3a')]=_0x8926fc[_0xf720('0x3a')]['length']?_0x8926fc['attributes']:_0x522bb0[_0xf720('0x36')];if(!_0x31911c[_0xf720('0x37')][_0xf720('0x3c')](_0xf720('0x3d'))){_0x8926fc[_0xf720('0x20')]=qs[_0xf720('0x20')](_0x31911c[_0xf720('0x37')][_0xf720('0x20')]);_0x8926fc[_0xf720('0x1e')]=qs[_0xf720('0x1e')](_0x31911c[_0xf720('0x37')]['offset']);}_0x8926fc[_0xf720('0x3e')]=qs[_0xf720('0x3f')](_0x31911c[_0xf720('0x37')][_0xf720('0x3f')]);_0x8926fc[_0xf720('0x40')]=qs[_0xf720('0x38')](_['pick'](_0x31911c['query'],_0x522bb0[_0xf720('0x38')]));_0x8926fc[_0xf720('0x40')][_0xf720('0x59')]=_0x2896de['id'];if(_0x31911c[_0xf720('0x37')][_0xf720('0x42')]){_0x8926fc[_0xf720('0x40')]=_[_0xf720('0x43')](_0x8926fc[_0xf720('0x40')],{'$or':_['map'](_0x8926fc[_0xf720('0x3a')],function(_0xeded1e){var _0x391c07={};_0x391c07[_0xeded1e]={'$like':'%'+_0x31911c['query'][_0xf720('0x42')]+'%'};return _0x391c07;})});}_0x8926fc=_[_0xf720('0x43')]({},_0x8926fc,_0x31911c[_0xf720('0x4c')]);return db['UserSmsQueue'][_0xf720('0x5a')](_0x8926fc);}})[_0xf720('0x27')](function(_0x11a2f9){if(_0x11a2f9){return db[_0xf720('0x5b')]['findAndCountAll']({'where':{'id':_[_0xf720('0x32')](_0x11a2f9,_0xf720('0x5c')),'role':_0xf720('0x5d')},'attributes':['id',_0xf720('0x2f'),_0xf720('0x5e'),_0xf720('0x5f'),_0xf720('0x60')]});}})[_0xf720('0x27')](function(_0x45dfa0){if(_0x45dfa0){return{'count':_0x45dfa0[_0xf720('0x21')],'rows':_[_0xf720('0x32')](_0x45dfa0[_0xf720('0x48')],function(_0x55b24c){return{'membername':_0x55b24c['name'],'UserId':_0x55b24c['id'],'queue_name':_0x4507e2[_0xf720('0x2f')],'SmsQueueId':_0x4507e2['id'],'interface':util[_0xf720('0x61')]('%s/%s',_0xf720('0x62'),_0x55b24c['name']),'penalty':0x0,'paused':_0x55b24c[_0xf720('0x5e')],'createdAt':_0x55b24c[_0xf720('0x60')],'updatedAt':_0x55b24c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1ac56b,_0x8926fc))[_0xf720('0x49')](handleError(_0x1ac56b,null));};exports[_0xf720('0x63')]=function(_0x5ef6d2,_0x4bc05c,_0x4a4845){var _0xac4b3a={};var _0x25d936={};var _0x4556b9;var _0x4ef1e3;return db[_0xf720('0x45')][_0xf720('0x56')]({'where':{'id':_0x5ef6d2[_0xf720('0x4a')]['id']}})[_0xf720('0x27')](handleEntityNotFound(_0x4bc05c,null))[_0xf720('0x27')](function(_0x54017e){if(_0x54017e){_0x4556b9=_0x54017e;_0x25d936[_0xf720('0x36')]=_['keys'](db[_0xf720('0x64')][_0xf720('0x65')]);_0x25d936['query']=_[_0xf720('0x58')](_0x5ef6d2[_0xf720('0x37')]);_0x25d936[_0xf720('0x38')]=_['intersection'](_0x25d936[_0xf720('0x36')],_0x25d936[_0xf720('0x37')]);_0xac4b3a['attributes']=_[_0xf720('0x39')](_0x25d936['model'],qs['fields'](_0x5ef6d2[_0xf720('0x37')]['fields']));_0xac4b3a[_0xf720('0x3a')]=_0xac4b3a[_0xf720('0x3a')][_0xf720('0x4b')]?_0xac4b3a[_0xf720('0x3a')]:_0x25d936[_0xf720('0x36')];_0xac4b3a[_0xf720('0x3e')]=qs[_0xf720('0x3f')](_0x5ef6d2[_0xf720('0x37')]['sort']);_0xac4b3a[_0xf720('0x40')]=qs['filters'](_[_0xf720('0x41')](_0x5ef6d2[_0xf720('0x37')],_0x25d936[_0xf720('0x38')]));if(_0x5ef6d2[_0xf720('0x37')][_0xf720('0x42')]){_0xac4b3a[_0xf720('0x40')]=_['merge'](_0xac4b3a[_0xf720('0x40')],{'$or':_[_0xf720('0x32')](_0xac4b3a['attributes'],function(_0x58b52e){var _0xeb280e={};_0xeb280e[_0x58b52e]={'$like':'%'+_0x5ef6d2[_0xf720('0x37')][_0xf720('0x42')]+'%'};return _0xeb280e;})});}_0xac4b3a=_[_0xf720('0x43')]({},_0xac4b3a,_0x5ef6d2[_0xf720('0x4c')]);return _0x4556b9['getTeams'](_0xac4b3a);}})['then'](function(_0x2580b3){if(_0x2580b3){_0x4ef1e3=_0x2580b3[_0xf720('0x4b')];if(!_0x5ef6d2[_0xf720('0x37')][_0xf720('0x3c')](_0xf720('0x3d'))){_0xac4b3a[_0xf720('0x20')]=qs[_0xf720('0x20')](_0x5ef6d2['query'][_0xf720('0x20')]);_0xac4b3a[_0xf720('0x1e')]=qs['offset'](_0x5ef6d2[_0xf720('0x37')][_0xf720('0x1e')]);}return _0x4556b9['getTeams'](_0xac4b3a);}})[_0xf720('0x27')](function(_0x31f643){if(_0x31f643){return _0x31f643?{'count':_0x4ef1e3,'rows':_0x31f643}:null;}})[_0xf720('0x27')](respondWithResult(_0x4bc05c,null))[_0xf720('0x49')](handleError(_0x4bc05c,null));};exports['addTeams']=function(_0x3e070e,_0x33c514,_0x5d035b){var _0x1f139f=_0x3e070e[_0xf720('0x4f')][_0xf720('0x66')];return db[_0xf720('0x64')][_0xf720('0x5a')]({'where':{'id':_0x1f139f},'attributes':['id'],'include':[{'model':db[_0xf720('0x5b')],'as':_0xf720('0x67'),'attributes':['id','name',_0xf720('0x68'),_0xf720('0x69'),'interface'],'raw':!![]}]})[_0xf720('0x27')](function(_0x3b22ec){if(_0x3b22ec){var _0x2067a5=_[_0xf720('0x6a')](_0x3b22ec,function(_0x1c1906){var _0x36c519=_0x1c1906[_0xf720('0x29')]({'plain':!![]});return _0x36c519[_0xf720('0x67')];});return db[_0xf720('0x45')][_0xf720('0x4d')]({'where':{'id':_0x3e070e[_0xf720('0x4a')]['id']}})[_0xf720('0x27')](function(_0x455938){return db[_0xf720('0x6b')][_0xf720('0x6c')](function(_0x3101e9){return _0x455938[_0xf720('0x6d')](_0x1f139f,{'transaction':_0x3101e9})[_0xf720('0x27')](function(){return BPromise[_0xf720('0x6e')](_0x2067a5,function(_0x36b1ed){return db[_0xf720('0x57')][_0xf720('0x6f')]({'where':{'UserId':_0x36b1ed['id'],'SmsQueueId':_0x3e070e[_0xf720('0x4a')]['id']},'transaction':_0x3101e9});});})[_0xf720('0x27')](function(){_0x2067a5[_0xf720('0x70')](function(_0x3b316f){socket['emit'](_0xf720('0x71'),{'UserId':_0x3b316f['id'],'SmsQueueId':_0x455938['id']});});});});});}})[_0xf720('0x27')](respondWithStatusCode(_0x33c514,null))[_0xf720('0x49')](handleError(_0x33c514,null));};exports[_0xf720('0x72')]=function(_0x463267,_0x3c7b21,_0x2efcfc){return db[_0xf720('0x64')][_0xf720('0x5a')]({'where':{'id':_0x463267[_0xf720('0x37')][_0xf720('0x66')]},'attributes':['id'],'include':[{'model':db[_0xf720('0x5b')],'as':_0xf720('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3c7b21,null))[_0xf720('0x27')](function(_0x39253a){var _0x1625be=_[_0xf720('0x32')](_0x39253a,'id');var _0x35cfe6=[];var _0x2980fc=[];var _0x41c8d5=squel[_0xf720('0x73')]();_0x41c8d5[_0xf720('0x74')](_0xf720('0x75'))[_0xf720('0x76')](_0xf720('0x77'),'tq')[_0xf720('0x78')]('user_has_teams','ut',_0xf720('0x79'))[_0xf720('0x40')](_0xf720('0x7a'),_0x463267['params']['id']);for(var _0x1e4d06=0x0;_0x1e4d06<_0x39253a[_0xf720('0x4b')];_0x1e4d06+=0x1){let _0x4c4f72=_0x39253a[_0x1e4d06];for(var _0x3b2a23=0x0;_0x3b2a23<_0x4c4f72['Agents'][_0xf720('0x4b')];_0x3b2a23+=0x1){let _0x4321f0=_0x4c4f72['Agents'][_0x3b2a23];var _0x1a5738=_0x41c8d5[_0xf720('0x7b')]();_0x1a5738['where'](_0xf720('0x7c'),_0x4321f0['id']);_0x2980fc['push'](db['sequelize'][_0xf720('0x37')](_0x1a5738[_0xf720('0x7d')](),{'type':db[_0xf720('0x6b')][_0xf720('0x7e')]['SELECT']})[_0xf720('0x27')](function(_0x5aeb5c){if(_0x5aeb5c[_0xf720('0x4b')]===0x1){return _0x4321f0['id'];}else{var _0x2e3898=_[_0xf720('0x7f')](_[_0xf720('0x32')](_0x5aeb5c,_0xf720('0x80')),function(_0x381cc9){return _[_0xf720('0x81')](_0x1625be,_0x381cc9);});if(_0x2e3898){return _0x4321f0['id'];}}}));}}return BPromise['all'](_0x2980fc)[_0xf720('0x27')](function(_0x22c24e){_0x35cfe6=_(_0x35cfe6)[_0xf720('0x82')](_0x22c24e)[_0xf720('0x83')]()[_0xf720('0x84')]();return db['SmsQueue'][_0xf720('0x4d')]({'where':{'id':_0x463267[_0xf720('0x4a')]['id']}})[_0xf720('0x27')](function(_0x17adee){return db['sequelize'][_0xf720('0x6c')](function(_0x1c33f4){return _0x17adee[_0xf720('0x72')](_0x463267[_0xf720('0x37')][_0xf720('0x66')],{'transaction':_0x1c33f4})[_0xf720('0x27')](function(){if(!_['isEmpty'](_0x35cfe6)){return _0x17adee['removeAgents'](_0x35cfe6,{'transaction':_0x1c33f4});}})[_0xf720('0x27')](function(){_0x35cfe6[_0xf720('0x70')](function(_0x420d4a){socket[_0xf720('0x85')]('userSmsQueue:remove',{'UserId':_0x420d4a,'SmsQueueId':_0x17adee['id']});});});});});});})['then'](respondWithStatusCode(_0x3c7b21,null))[_0xf720('0x49')](handleError(_0x3c7b21,null));};exports[_0xf720('0x86')]=function(_0x51ee92,_0xb85e7c,_0x53ae7c){return db[_0xf720('0x45')][_0xf720('0x4d')]({'where':{'id':_0x51ee92['params']['id']}})[_0xf720('0x27')](handleEntityNotFound(_0xb85e7c,null))[_0xf720('0x27')](function(_0x239b94){if(_0x239b94){return _0x239b94['addAgents'](_0x51ee92[_0xf720('0x4f')][_0xf720('0x66')],_['omit'](_0x51ee92[_0xf720('0x4f')],[_0xf720('0x66'),'id'])||{})[_0xf720('0x87')](function(_0x598146){for(var _0x5f4daf=0x0;_0x5f4daf<_0x51ee92[_0xf720('0x4f')][_0xf720('0x66')][_0xf720('0x4b')];_0x5f4daf+=0x1){socket[_0xf720('0x85')]('userSmsQueue:save',{'UserId':Number(_0x51ee92[_0xf720('0x4f')][_0xf720('0x66')][_0x5f4daf]),'SmsQueueId':Number(_0x51ee92[_0xf720('0x4a')]['id'])});}return _0x598146;});}})[_0xf720('0x27')](respondWithResult(_0xb85e7c,null))[_0xf720('0x49')](handleError(_0xb85e7c,null));};exports[_0xf720('0x88')]=function(_0x5a9fbe,_0x1b1d7d,_0x244e9c){return db['SmsQueue'][_0xf720('0x4d')]({'where':{'id':_0x5a9fbe['params']['id']}})['then'](handleEntityNotFound(_0x1b1d7d,null))[_0xf720('0x27')](function(_0x23ddd4){if(_0x23ddd4){return _0x23ddd4[_0xf720('0x88')](_0x5a9fbe[_0xf720('0x37')][_0xf720('0x66')])[_0xf720('0x27')](function(){if(_[_0xf720('0x89')](_0x5a9fbe[_0xf720('0x37')][_0xf720('0x66')])){for(var _0xdab25a=0x0;_0xdab25a<_0x5a9fbe['query'][_0xf720('0x66')][_0xf720('0x4b')];_0xdab25a+=0x1){socket[_0xf720('0x85')](_0xf720('0x8a'),{'UserId':Number(_0x5a9fbe['query'][_0xf720('0x66')][_0xdab25a]),'SmsQueueId':Number(_0x5a9fbe['params']['id'])});}}else{socket['emit'](_0xf720('0x8a'),{'UserId':Number(_0x5a9fbe['query'][_0xf720('0x66')]),'SmsQueueId':Number(_0x5a9fbe[_0xf720('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x1b1d7d,null))['catch'](handleError(_0x1b1d7d,null));};exports[_0xf720('0x8b')]=function(_0x4dc47a,_0x54277f,_0x548e2b){var _0x3dd8f1={};var _0x5d66f4={};var _0xa4f395;var _0x28a43a;return db[_0xf720('0x45')]['findOne']({'where':{'id':_0x4dc47a['params']['id']}})[_0xf720('0x27')](handleEntityNotFound(_0x54277f,null))[_0xf720('0x27')](function(_0x6e9d3b){if(_0x6e9d3b){_0xa4f395=_0x6e9d3b;_0x5d66f4['model']=_[_0xf720('0x58')](db[_0xf720('0x5b')][_0xf720('0x65')]);_0x5d66f4[_0xf720('0x37')]=_[_0xf720('0x58')](_0x4dc47a['query']);_0x5d66f4[_0xf720('0x38')]=_['intersection'](_0x5d66f4['model'],_0x5d66f4[_0xf720('0x37')]);_0x3dd8f1[_0xf720('0x3a')]=_[_0xf720('0x39')](_0x5d66f4['model'],qs['fields'](_0x4dc47a[_0xf720('0x37')][_0xf720('0x3b')]));_0x3dd8f1[_0xf720('0x3a')]=_0x3dd8f1[_0xf720('0x3a')]['length']?_0x3dd8f1[_0xf720('0x3a')]:_0x5d66f4[_0xf720('0x36')];_0x3dd8f1['order']=qs[_0xf720('0x3f')](_0x4dc47a[_0xf720('0x37')][_0xf720('0x3f')]);_0x3dd8f1[_0xf720('0x40')]=qs['filters'](_[_0xf720('0x41')](_0x4dc47a[_0xf720('0x37')],_0x5d66f4['filters']));if(_0x4dc47a[_0xf720('0x37')]['filter']){_0x3dd8f1[_0xf720('0x40')]=_['merge'](_0x3dd8f1[_0xf720('0x40')],{'$or':_['map'](_0x3dd8f1[_0xf720('0x3a')],function(_0x279b80){var _0x20c807={};_0x20c807[_0x279b80]={'$like':'%'+_0x4dc47a[_0xf720('0x37')][_0xf720('0x42')]+'%'};return _0x20c807;})});}_0x3dd8f1=_[_0xf720('0x43')]({},_0x3dd8f1,_0x4dc47a[_0xf720('0x4c')]);return _0xa4f395['getAgents'](_0x3dd8f1);}})['then'](function(_0x1a6e0a){if(_0x1a6e0a){_0x28a43a=_0x1a6e0a[_0xf720('0x4b')];if(!_0x4dc47a[_0xf720('0x37')]['hasOwnProperty'](_0xf720('0x3d'))){_0x3dd8f1[_0xf720('0x20')]=qs[_0xf720('0x20')](_0x4dc47a['query'][_0xf720('0x20')]);_0x3dd8f1[_0xf720('0x1e')]=qs[_0xf720('0x1e')](_0x4dc47a['query'][_0xf720('0x1e')]);}return _0xa4f395[_0xf720('0x8b')](_0x3dd8f1);}})[_0xf720('0x27')](function(_0x5cec40){if(_0x5cec40){return _0x5cec40?{'count':_0x28a43a,'rows':_0x5cec40}:null;}})[_0xf720('0x27')](respondWithResult(_0x54277f,null))['catch'](handleError(_0x54277f,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 7742981..1b45a86 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 _0xf122=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue'];(function(_0x5ca887,_0x336e97){var _0x18c849=function(_0x5590d3){while(--_0x5590d3){_0x5ca887['push'](_0x5ca887['shift']());}};_0x18c849(++_0x336e97);}(_0xf122,0x183));var _0x2f12=function(_0x366765,_0x1b0496){_0x366765=_0x366765-0x0;var _0x12e274=_0xf122[_0x366765];return _0x12e274;};'use strict';var EventEmitter=require(_0x2f12('0x0'));var SmsQueue=require(_0x2f12('0x1'))['db'][_0x2f12('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x2f12('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2f12('0x4'),'afterDestroy':_0x2f12('0x5')};function emitEvent(_0x38d5c0){return function(_0x348ca3,_0x478329,_0x348027){SmsQueueEvents[_0x2f12('0x6')](_0x38d5c0+':'+_0x348ca3['id'],_0x348ca3);SmsQueueEvents['emit'](_0x38d5c0,_0x348ca3);_0x348027(null);};}for(var e in events){if(events[_0x2f12('0x7')](e)){var event=events[e];SmsQueue[_0x2f12('0x8')](e,emitEvent(event));}}module[_0x2f12('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0xce79=['hook','exports','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x25576f,_0x4b16a9){var _0x49b547=function(_0x1e559d){while(--_0x1e559d){_0x25576f['push'](_0x25576f['shift']());}};_0x49b547(++_0x4b16a9);}(_0xce79,0x19c));var _0x9ce7=function(_0x485201,_0x3c533a){_0x485201=_0x485201-0x0;var _0x9ca98a=_0xce79[_0x485201];return _0x9ca98a;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x9ce7('0x0'))['db'][_0x9ce7('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x9ce7('0x2')](0x0);var events={'afterCreate':_0x9ce7('0x3'),'afterUpdate':_0x9ce7('0x4'),'afterDestroy':_0x9ce7('0x5')};function emitEvent(_0x344299){return function(_0x17bf1c,_0xcb382b,_0x5743d1){SmsQueueEvents['emit'](_0x344299+':'+_0x17bf1c['id'],_0x17bf1c);SmsQueueEvents[_0x9ce7('0x6')](_0x344299,_0x17bf1c);_0x5743d1(null);};}for(var e in events){if(events[_0x9ce7('0x7')](e)){var event=events[e];SmsQueue[_0x9ce7('0x8')](e,emitEvent(event));}}module[_0x9ce7('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 1a31fbd..ad5ff2a 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 _0x68da=['util','../../config/logger','api','request-promise','path','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x68da,0x1ea));var _0xa68d=function(_0x121d9e,_0x11b966){_0x121d9e=_0x121d9e-0x0;var _0x5df466=_0x68da[_0x121d9e];return _0x5df466;};'use strict';var _=require('lodash');var util=require(_0xa68d('0x0'));var logger=require(_0xa68d('0x1'))(_0xa68d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa68d('0x3'));var fs=require('fs');var path=require(_0xa68d('0x4'));var rimraf=require('rimraf');var config=require(_0xa68d('0x5'));var attributes=require(_0xa68d('0x6'));module[_0xa68d('0x7')]=function(_0x20ed80,_0x13163a){return _0x20ed80[_0xa68d('0x8')](_0xa68d('0x9'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1781=['SmsQueue','sms_queues','api','moment','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0x57f9f7,_0xe8f84b){var _0x16affb=function(_0x3c55c){while(--_0x3c55c){_0x57f9f7['push'](_0x57f9f7['shift']());}};_0x16affb(++_0xe8f84b);}(_0x1781,0xb6));var _0x1178=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1781[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x1178('0x0'));var moment=require(_0x1178('0x1'));var BPromise=require('bluebird');var rp=require(_0x1178('0x2'));var fs=require('fs');var path=require(_0x1178('0x3'));var rimraf=require(_0x1178('0x4'));var config=require(_0x1178('0x5'));var attributes=require(_0x1178('0x6'));module['exports']=function(_0x278a8c,_0xcb2de0){return _0x278a8c['define'](_0x1178('0x7'),attributes,{'tableName':_0x1178('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index dd0ba67..7f0935f 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 _0x3ec6=['then','info','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','catch','SmsQueue','options','attributes','include','model','GetSmsQueue','ShowSmsQueue','find','raw','where','map','lodash','util','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request'];(function(_0x406ae7,_0x12181b){var _0x5a5b9d=function(_0x3f20c2){while(--_0x3f20c2){_0x406ae7['push'](_0x406ae7['shift']());}};_0x5a5b9d(++_0x12181b);}(_0x3ec6,0xd5));var _0x63ec=function(_0x403f6b,_0x13d7bb){_0x403f6b=_0x403f6b-0x0;var _0x26203b=_0x3ec6[_0x403f6b];return _0x26203b;};'use strict';var _=require(_0x63ec('0x0'));var util=require(_0x63ec('0x1'));var moment=require(_0x63ec('0x2'));var BPromise=require(_0x63ec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x63ec('0x4'))(_0x63ec('0x5'));var config=require(_0x63ec('0x6'));var jayson=require(_0x63ec('0x7'));var client=jayson[_0x63ec('0x8')]['http']({'port':0x232a});config[_0x63ec('0x9')]=_['defaults'](config['redis'],{'host':_0x63ec('0xa'),'port':0x18eb});var socket=require(_0x63ec('0xb'))(new Redis(config[_0x63ec('0x9')]));require(_0x63ec('0xc'))[_0x63ec('0xd')](socket);function respondWithRpcPromise(_0x242a58,_0xc1558c,_0x5c8e7e){return new BPromise(function(_0x414354,_0x37d14e){return client[_0x63ec('0xe')](_0x242a58,_0x5c8e7e)[_0x63ec('0xf')](function(_0x1966b4){logger[_0x63ec('0x10')]('SmsQueue,\x20%s,\x20%s',_0xc1558c,'request\x20sent');logger[_0x63ec('0x11')](_0x63ec('0x12'),_0xc1558c,_0x63ec('0x13'),JSON[_0x63ec('0x14')](_0x1966b4));if(_0x1966b4[_0x63ec('0x15')]){if(_0x1966b4[_0x63ec('0x15')][_0x63ec('0x16')]===0x1f4){logger[_0x63ec('0x15')](_0x63ec('0x17'),_0xc1558c,_0x1966b4['error'][_0x63ec('0x18')]);return _0x37d14e(_0x1966b4['error']['message']);}logger[_0x63ec('0x15')]('SmsQueue,\x20%s,\x20%s',_0xc1558c,_0x1966b4[_0x63ec('0x15')]['message']);return _0x414354(_0x1966b4[_0x63ec('0x15')][_0x63ec('0x18')]);}else{logger[_0x63ec('0x10')]('SmsQueue,\x20%s,\x20%s',_0xc1558c,_0x63ec('0x13'));_0x414354(_0x1966b4[_0x63ec('0x19')][_0x63ec('0x18')]);}})[_0x63ec('0x1a')](function(_0x3fdbff){logger[_0x63ec('0x15')](_0x63ec('0x17'),_0xc1558c,_0x3fdbff);_0x37d14e(_0x3fdbff);});});}exports['GetSmsQueue']=function(_0x4ea15f){var _0x49509e=this;return new Promise(function(_0x224f4d,_0x231019){return db[_0x63ec('0x1b')]['findAll']({'raw':_0x4ea15f[_0x63ec('0x1c')]?_0x4ea15f[_0x63ec('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4ea15f[_0x63ec('0x1c')]?_0x4ea15f['options']['where']||null:null,'attributes':_0x4ea15f['options']?_0x4ea15f[_0x63ec('0x1c')][_0x63ec('0x1d')]||null:null,'limit':_0x4ea15f['options']?_0x4ea15f[_0x63ec('0x1c')]['limit']||null:null,'include':_0x4ea15f[_0x63ec('0x1c')]?_0x4ea15f['options'][_0x63ec('0x1e')]?_['map'](_0x4ea15f[_0x63ec('0x1c')][_0x63ec('0x1e')],function(_0x2a082c){return{'model':db[_0x2a082c[_0x63ec('0x1f')]],'as':_0x2a082c['as'],'attributes':_0x2a082c[_0x63ec('0x1d')],'include':_0x2a082c[_0x63ec('0x1e')]?_['map'](_0x2a082c[_0x63ec('0x1e')],function(_0x455000){return{'model':db[_0x455000[_0x63ec('0x1f')]],'as':_0x455000['as'],'attributes':_0x455000[_0x63ec('0x1d')],'include':_0x455000['include']?_['map'](_0x455000['include'],function(_0x2ca09a){return{'model':db[_0x2ca09a[_0x63ec('0x1f')]],'as':_0x2ca09a['as'],'attributes':_0x2ca09a[_0x63ec('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x63ec('0xf')](function(_0x37cd4b){logger[_0x63ec('0x10')](_0x63ec('0x20'),_0x4ea15f);logger[_0x63ec('0x11')]('GetSmsQueue',_0x4ea15f,JSON[_0x63ec('0x14')](_0x37cd4b));_0x224f4d(_0x37cd4b);})[_0x63ec('0x1a')](function(_0x12893f){logger[_0x63ec('0x15')](_0x63ec('0x20'),_0x12893f[_0x63ec('0x18')],_0x4ea15f);_0x231019(_0x49509e[_0x63ec('0x15')](0x1f4,_0x12893f['message']));});});};exports[_0x63ec('0x21')]=function(_0x4299a9){var _0x1df758=this;return new Promise(function(_0x7b6b30,_0xe39894){return db['SmsQueue'][_0x63ec('0x22')]({'raw':_0x4299a9[_0x63ec('0x1c')]?_0x4299a9[_0x63ec('0x1c')][_0x63ec('0x23')]===undefined?!![]:![]:!![],'where':_0x4299a9[_0x63ec('0x1c')]?_0x4299a9[_0x63ec('0x1c')][_0x63ec('0x24')]||null:null,'attributes':_0x4299a9[_0x63ec('0x1c')]?_0x4299a9[_0x63ec('0x1c')]['attributes']||null:null,'include':_0x4299a9[_0x63ec('0x1c')]?_0x4299a9[_0x63ec('0x1c')][_0x63ec('0x1e')]?_[_0x63ec('0x25')](_0x4299a9['options'][_0x63ec('0x1e')],function(_0x1ea37a){return{'model':db[_0x1ea37a[_0x63ec('0x1f')]],'as':_0x1ea37a['as'],'attributes':_0x1ea37a[_0x63ec('0x1d')],'include':_0x1ea37a[_0x63ec('0x1e')]?_[_0x63ec('0x25')](_0x1ea37a[_0x63ec('0x1e')],function(_0x10b027){return{'model':db[_0x10b027['model']],'as':_0x10b027['as'],'attributes':_0x10b027[_0x63ec('0x1d')],'include':_0x10b027[_0x63ec('0x1e')]?_['map'](_0x10b027['include'],function(_0x26eec2){return{'model':db[_0x26eec2['model']],'as':_0x26eec2['as'],'attributes':_0x26eec2[_0x63ec('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x63ec('0xf')](function(_0x68b655){logger[_0x63ec('0x10')](_0x63ec('0x21'),_0x4299a9);logger[_0x63ec('0x11')]('ShowSmsQueue',_0x4299a9,JSON['stringify'](_0x68b655));_0x7b6b30(_0x68b655);})[_0x63ec('0x1a')](function(_0x1b4461){logger['error'](_0x63ec('0x21'),_0x1b4461[_0x63ec('0x18')],_0x4299a9);_0xe39894(_0x1df758['error'](0x1f4,_0x1b4461[_0x63ec('0x18')]));});});}; \ No newline at end of file +var _0xd951=['options','raw','where','limit','include','model','attributes','map','ShowSmsQueue','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetSmsQueue','SmsQueue','findAll'];(function(_0x5c7f20,_0x4cb035){var _0x3315e7=function(_0x5bb58c){while(--_0x5bb58c){_0x5c7f20['push'](_0x5c7f20['shift']());}};_0x3315e7(++_0x4cb035);}(_0xd951,0x15a));var _0x1d95=function(_0x1fa25e,_0x3aa963){_0x1fa25e=_0x1fa25e-0x0;var _0x359ab0=_0xd951[_0x1fa25e];return _0x359ab0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1d95('0x0'));var BPromise=require(_0x1d95('0x1'));var rs=require(_0x1d95('0x2'));var fs=require('fs');var Redis=require(_0x1d95('0x3'));var db=require(_0x1d95('0x4'))['db'];var utils=require(_0x1d95('0x5'));var logger=require(_0x1d95('0x6'))(_0x1d95('0x7'));var config=require('../../config/environment');var jayson=require(_0x1d95('0x8'));var client=jayson[_0x1d95('0x9')][_0x1d95('0xa')]({'port':0x232a});config[_0x1d95('0xb')]=_[_0x1d95('0xc')](config[_0x1d95('0xb')],{'host':_0x1d95('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1d95('0xb')]));require(_0x1d95('0xe'))[_0x1d95('0xf')](socket);function respondWithRpcPromise(_0x4cab95,_0x1d02d5,_0x3ffabe){return new BPromise(function(_0x4dd47f,_0x3f44e3){return client[_0x1d95('0x10')](_0x4cab95,_0x3ffabe)[_0x1d95('0x11')](function(_0x2cec4f){logger['info'](_0x1d95('0x12'),_0x1d02d5,'request\x20sent');logger[_0x1d95('0x13')](_0x1d95('0x14'),_0x1d02d5,_0x1d95('0x15'),JSON[_0x1d95('0x16')](_0x2cec4f));if(_0x2cec4f['error']){if(_0x2cec4f[_0x1d95('0x17')][_0x1d95('0x18')]===0x1f4){logger[_0x1d95('0x17')](_0x1d95('0x12'),_0x1d02d5,_0x2cec4f[_0x1d95('0x17')][_0x1d95('0x19')]);return _0x3f44e3(_0x2cec4f[_0x1d95('0x17')][_0x1d95('0x19')]);}logger['error'](_0x1d95('0x12'),_0x1d02d5,_0x2cec4f[_0x1d95('0x17')]['message']);return _0x4dd47f(_0x2cec4f['error'][_0x1d95('0x19')]);}else{logger[_0x1d95('0x1a')]('SmsQueue,\x20%s,\x20%s',_0x1d02d5,_0x1d95('0x15'));_0x4dd47f(_0x2cec4f[_0x1d95('0x1b')]['message']);}})[_0x1d95('0x1c')](function(_0x53a775){logger[_0x1d95('0x17')](_0x1d95('0x12'),_0x1d02d5,_0x53a775);_0x3f44e3(_0x53a775);});});}exports[_0x1d95('0x1d')]=function(_0x44c1dc){var _0x5f346d=this;return new Promise(function(_0x506f71,_0x47d423){return db[_0x1d95('0x1e')][_0x1d95('0x1f')]({'raw':_0x44c1dc[_0x1d95('0x20')]?_0x44c1dc[_0x1d95('0x20')][_0x1d95('0x21')]===undefined?!![]:![]:!![],'where':_0x44c1dc[_0x1d95('0x20')]?_0x44c1dc['options'][_0x1d95('0x22')]||null:null,'attributes':_0x44c1dc[_0x1d95('0x20')]?_0x44c1dc[_0x1d95('0x20')]['attributes']||null:null,'limit':_0x44c1dc[_0x1d95('0x20')]?_0x44c1dc['options'][_0x1d95('0x23')]||null:null,'include':_0x44c1dc[_0x1d95('0x20')]?_0x44c1dc[_0x1d95('0x20')][_0x1d95('0x24')]?_['map'](_0x44c1dc[_0x1d95('0x20')][_0x1d95('0x24')],function(_0xd7a15b){return{'model':db[_0xd7a15b[_0x1d95('0x25')]],'as':_0xd7a15b['as'],'attributes':_0xd7a15b[_0x1d95('0x26')],'include':_0xd7a15b[_0x1d95('0x24')]?_[_0x1d95('0x27')](_0xd7a15b[_0x1d95('0x24')],function(_0x592189){return{'model':db[_0x592189[_0x1d95('0x25')]],'as':_0x592189['as'],'attributes':_0x592189['attributes'],'include':_0x592189['include']?_[_0x1d95('0x27')](_0x592189['include'],function(_0x38acb9){return{'model':db[_0x38acb9[_0x1d95('0x25')]],'as':_0x38acb9['as'],'attributes':_0x38acb9[_0x1d95('0x26')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9fdb19){logger[_0x1d95('0x1a')]('GetSmsQueue',_0x44c1dc);logger[_0x1d95('0x13')](_0x1d95('0x1d'),_0x44c1dc,JSON[_0x1d95('0x16')](_0x9fdb19));_0x506f71(_0x9fdb19);})[_0x1d95('0x1c')](function(_0x616935){logger[_0x1d95('0x17')](_0x1d95('0x1d'),_0x616935[_0x1d95('0x19')],_0x44c1dc);_0x47d423(_0x5f346d[_0x1d95('0x17')](0x1f4,_0x616935[_0x1d95('0x19')]));});});};exports[_0x1d95('0x28')]=function(_0x2171e1){var _0x46c7b6=this;return new Promise(function(_0xdf3328,_0x11e900){return db[_0x1d95('0x1e')][_0x1d95('0x29')]({'raw':_0x2171e1['options']?_0x2171e1[_0x1d95('0x20')][_0x1d95('0x21')]===undefined?!![]:![]:!![],'where':_0x2171e1[_0x1d95('0x20')]?_0x2171e1['options'][_0x1d95('0x22')]||null:null,'attributes':_0x2171e1[_0x1d95('0x20')]?_0x2171e1['options'][_0x1d95('0x26')]||null:null,'include':_0x2171e1[_0x1d95('0x20')]?_0x2171e1['options'][_0x1d95('0x24')]?_['map'](_0x2171e1[_0x1d95('0x20')]['include'],function(_0x257fa2){return{'model':db[_0x257fa2[_0x1d95('0x25')]],'as':_0x257fa2['as'],'attributes':_0x257fa2['attributes'],'include':_0x257fa2['include']?_[_0x1d95('0x27')](_0x257fa2[_0x1d95('0x24')],function(_0x2a15ee){return{'model':db[_0x2a15ee[_0x1d95('0x25')]],'as':_0x2a15ee['as'],'attributes':_0x2a15ee['attributes'],'include':_0x2a15ee[_0x1d95('0x24')]?_[_0x1d95('0x27')](_0x2a15ee[_0x1d95('0x24')],function(_0x5d92b6){return{'model':db[_0x5d92b6['model']],'as':_0x5d92b6['as'],'attributes':_0x5d92b6[_0x1d95('0x26')]};}):[]};}):[]};}):[]:[]})[_0x1d95('0x11')](function(_0x27a3e9){logger[_0x1d95('0x1a')](_0x1d95('0x28'),_0x2171e1);logger['debug'](_0x1d95('0x28'),_0x2171e1,JSON[_0x1d95('0x16')](_0x27a3e9));_0xdf3328(_0x27a3e9);})[_0x1d95('0x1c')](function(_0x3897e6){logger[_0x1d95('0x17')](_0x1d95('0x28'),_0x3897e6[_0x1d95('0x19')],_0x2171e1);_0x11e900(_0x46c7b6[_0x1d95('0x17')](0x1f4,_0x3897e6[_0x1d95('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index a51484d..d5f0d20 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 _0x43da=['removeListener','register','./smsQueue.events','save','update','emit'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x43da,0xf2));var _0xa43d=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x43da[_0x220f3f];return _0x1f170e;};'use strict';var SmsQueueEvents=require(_0xa43d('0x0'));var events=[_0xa43d('0x1'),'remove',_0xa43d('0x2')];function createListener(_0x4832a7,_0x49822a){return function(_0x7e8aca){_0x49822a[_0xa43d('0x3')](_0x4832a7,_0x7e8aca);};}function removeListener(_0x4b0fef,_0x1fba41){return function(){SmsQueueEvents[_0xa43d('0x4')](_0x4b0fef,_0x1fba41);};}exports[_0xa43d('0x5')]=function(_0x5848ee){for(var _0x135ba8=0x0,_0xfc4625=events['length'];_0x135ba8<_0xfc4625;_0x135ba8++){var _0x27b127=events[_0x135ba8];var _0x41addd=createListener('smsQueue:'+_0x27b127,_0x5848ee);SmsQueueEvents['on'](_0x27b127,_0x41addd);}}; \ No newline at end of file +var _0x9b64=['./smsQueue.events','save','remove','update','register','length','smsQueue:'];(function(_0x16e23a,_0x333cd1){var _0x35c9ae=function(_0x28e56b){while(--_0x28e56b){_0x16e23a['push'](_0x16e23a['shift']());}};_0x35c9ae(++_0x333cd1);}(_0x9b64,0x1f1));var _0x49b6=function(_0x12c289,_0x3376b8){_0x12c289=_0x12c289-0x0;var _0x9e28d5=_0x9b64[_0x12c289];return _0x9e28d5;};'use strict';var SmsQueueEvents=require(_0x49b6('0x0'));var events=[_0x49b6('0x1'),_0x49b6('0x2'),_0x49b6('0x3')];function createListener(_0x210011,_0x238558){return function(_0x4ffd61){_0x238558['emit'](_0x210011,_0x4ffd61);};}function removeListener(_0x7ae190,_0x238f2f){return function(){SmsQueueEvents['removeListener'](_0x7ae190,_0x238f2f);};}exports[_0x49b6('0x4')]=function(_0x1335cb){for(var _0x1d5e09=0x0,_0x4c200e=events[_0x49b6('0x5')];_0x1d5e09<_0x4c200e;_0x1d5e09++){var _0x12645d=events[_0x1d5e09];var _0x4c05e7=createListener(_0x49b6('0x6')+_0x12645d,_0x1335cb);SmsQueueEvents['on'](_0x12645d,_0x4c05e7);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 280f471..ca1aa36 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 _0x13f5=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x4dc2b5,_0x273b38){var _0x1551ec=function(_0x609abf){while(--_0x609abf){_0x4dc2b5['push'](_0x4dc2b5['shift']());}};_0x1551ec(++_0x273b38);}(_0x13f5,0xc3));var _0x513f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x13f5[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x513f('0x0'));var util=require(_0x513f('0x1'));var path=require(_0x513f('0x2'));var timeout=require(_0x513f('0x3'));var express=require('express');var router=express[_0x513f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x513f('0x5'));var config=require(_0x513f('0x6'));var controller=require(_0x513f('0x7'));router[_0x513f('0x8')]('/',auth[_0x513f('0x9')](),controller[_0x513f('0xa')]);router[_0x513f('0x8')](_0x513f('0xb'),auth[_0x513f('0x9')](),controller[_0x513f('0xc')]);router[_0x513f('0x8')](_0x513f('0xd'),auth['isAuthenticated'](),controller[_0x513f('0xe')]);router[_0x513f('0xf')]('/',auth[_0x513f('0x9')](),controller[_0x513f('0x10')]);router[_0x513f('0x11')]('/:id',auth[_0x513f('0x9')](),controller[_0x513f('0x12')]);router['delete'](_0x513f('0xd'),auth[_0x513f('0x9')](),controller[_0x513f('0x13')]);module[_0x513f('0x14')]=router; \ No newline at end of file +var _0xc164=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete'];(function(_0x2fc3ae,_0x42da14){var _0x26175b=function(_0x57fec6){while(--_0x57fec6){_0x2fc3ae['push'](_0x2fc3ae['shift']());}};_0x26175b(++_0x42da14);}(_0xc164,0x18e));var _0x4c16=function(_0x43f72f,_0x38310f){_0x43f72f=_0x43f72f-0x0;var _0x43175d=_0xc164[_0x43f72f];return _0x43175d;};'use strict';var multer=require('multer');var util=require(_0x4c16('0x0'));var path=require(_0x4c16('0x1'));var timeout=require(_0x4c16('0x2'));var express=require(_0x4c16('0x3'));var router=express[_0x4c16('0x4')]();var fs_extra=require(_0x4c16('0x5'));var auth=require(_0x4c16('0x6'));var interaction=require(_0x4c16('0x7'));var config=require('../../config/environment');var controller=require(_0x4c16('0x8'));router[_0x4c16('0x9')]('/',auth[_0x4c16('0xa')](),controller[_0x4c16('0xb')]);router[_0x4c16('0x9')]('/describe',auth[_0x4c16('0xa')](),controller[_0x4c16('0xc')]);router[_0x4c16('0x9')](_0x4c16('0xd'),auth['isAuthenticated'](),controller[_0x4c16('0xe')]);router[_0x4c16('0xf')]('/',auth[_0x4c16('0xa')](),controller[_0x4c16('0x10')]);router[_0x4c16('0x11')](_0x4c16('0xd'),auth[_0x4c16('0xa')](),controller[_0x4c16('0x12')]);router[_0x4c16('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4c16('0x14')]);module[_0x4c16('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 5b45fc7..975c8dc 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 _0x97e5=['DATE','moment','exports','STRING'];(function(_0xd88044,_0x36dc6c){var _0x4eae6b=function(_0x4934c2){while(--_0x4934c2){_0xd88044['push'](_0xd88044['shift']());}};_0x4eae6b(++_0x36dc6c);}(_0x97e5,0xcd));var _0x597e=function(_0x1b0def,_0x362ccb){_0x1b0def=_0x1b0def-0x0;var _0x22f8f5=_0x97e5[_0x1b0def];return _0x22f8f5;};'use strict';var moment=require(_0x597e('0x0'));var Sequelize=require('sequelize');module[_0x597e('0x1')]={'uniqueid':{'type':Sequelize[_0x597e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x597e('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x597e('0x3')]},'acceptAt':{'type':Sequelize[_0x597e('0x3')]},'exitAt':{'type':Sequelize[_0x597e('0x3')]},'reason':{'type':Sequelize[_0x597e('0x2')]}}; \ No newline at end of file +var _0x3f9d=['STRING','DATE','sequelize','exports'];(function(_0x514299,_0x44a553){var _0x453188=function(_0x518bc4){while(--_0x518bc4){_0x514299['push'](_0x514299['shift']());}};_0x453188(++_0x44a553);}(_0x3f9d,0x10e));var _0xd3f9=function(_0x20a68a,_0x54502e){_0x20a68a=_0x20a68a-0x0;var _0x56c5d4=_0x3f9d[_0x20a68a];return _0x56c5d4;};'use strict';var moment=require('moment');var Sequelize=require(_0xd3f9('0x0'));module[_0xd3f9('0x1')]={'uniqueid':{'type':Sequelize[_0xd3f9('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xd3f9('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xd3f9('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xd3f9('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 5c99955..edc4a30 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 _0xb445=['error','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','show','params','find','create','update','body','catch','destroy','describe','eml-format','fast-json-patch','moment','bluebird','util','path','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus'];(function(_0x53a7af,_0x1408a5){var _0x3cc7f6=function(_0x4bf101){while(--_0x4bf101){_0x53a7af['push'](_0x53a7af['shift']());}};_0x3cc7f6(++_0x1408a5);}(_0xb445,0xfc));var _0x5b44=function(_0x589bee,_0x3e06b9){_0x589bee=_0x589bee-0x0;var _0x58f126=_0xb445[_0x589bee];return _0x58f126;};'use strict';var emlformat=require(_0x5b44('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5b44('0x1'));var rp=require('request-promise');var moment=require(_0x5b44('0x2'));var BPromise=require(_0x5b44('0x3'));var Mustache=require('mustache');var util=require(_0x5b44('0x4'));var path=require(_0x5b44('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5b44('0x6'));var _=require(_0x5b44('0x7'));var squel=require('squel');var crypto=require(_0x5b44('0x8'));var jsforce=require(_0x5b44('0x9'));var deskjs=require(_0x5b44('0xa'));var toCsv=require('to-csv');var querystring=require(_0x5b44('0xb'));var Papa=require(_0x5b44('0xc'));var Redis=require(_0x5b44('0xd'));var authService=require(_0x5b44('0xe'));var qs=require(_0x5b44('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5b44('0x10'));var logger=require(_0x5b44('0x11'))('api');var utils=require(_0x5b44('0x12'));var config=require(_0x5b44('0x13'));var licenseUtil=require(_0x5b44('0x14'));var db=require(_0x5b44('0x15'))['db'];function respondWithStatusCode(_0x5ec5e2,_0xfc9d0e){_0xfc9d0e=_0xfc9d0e||0xcc;return function(_0x5b9291){if(_0x5b9291){return _0x5ec5e2['sendStatus'](_0xfc9d0e);}return _0x5ec5e2[_0x5b44('0x16')](_0xfc9d0e)[_0x5b44('0x17')]();};}function respondWithResult(_0x374342,_0x54908f){_0x54908f=_0x54908f||0xc8;return function(_0x28c70d){if(_0x28c70d){return _0x374342[_0x5b44('0x16')](_0x54908f)[_0x5b44('0x18')](_0x28c70d);}};}function respondWithFilteredResult(_0x30cd22,_0x4da7da){return function(_0x483799){if(_0x483799){var _0x5c06f9=typeof _0x4da7da[_0x5b44('0x19')]===_0x5b44('0x1a')&&typeof _0x4da7da[_0x5b44('0x1b')]===_0x5b44('0x1a');var _0x52f8de=_0x483799['count'];var _0x37efc0=_0x5c06f9?0x0:_0x4da7da[_0x5b44('0x19')];var _0x2358a9=_0x5c06f9?_0x483799[_0x5b44('0x1c')]:_0x4da7da[_0x5b44('0x19')]+_0x4da7da[_0x5b44('0x1b')];var _0x4db4ec;if(_0x2358a9>=_0x52f8de){_0x2358a9=_0x52f8de;_0x4db4ec=0xc8;}else{_0x4db4ec=0xce;}_0x30cd22['status'](_0x4db4ec);return _0x30cd22[_0x5b44('0x1d')](_0x5b44('0x1e'),_0x37efc0+'-'+_0x2358a9+'/'+_0x52f8de)[_0x5b44('0x18')](_0x483799);}return null;};}function patchUpdates(_0x2bc33f){return function(_0x4e64b6){try{jsonpatch[_0x5b44('0x1f')](_0x4e64b6,_0x2bc33f,!![]);}catch(_0x4f76b9){return BPromise[_0x5b44('0x20')](_0x4f76b9);}return _0x4e64b6[_0x5b44('0x21')]();};}function saveUpdates(_0x228c25,_0x5556d2){return function(_0xd99d93){if(_0xd99d93){return _0xd99d93['update'](_0x228c25)[_0x5b44('0x22')](function(_0x4471d3){return _0x4471d3;});}return null;};}function removeEntity(_0x1c3268,_0x35e9fb){return function(_0x56a4d9){if(_0x56a4d9){return _0x56a4d9['destroy']()[_0x5b44('0x22')](function(){_0x1c3268[_0x5b44('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f35b6,_0x49964a){return function(_0x411503){if(!_0x411503){_0x5f35b6[_0x5b44('0x23')](0x194);}return _0x411503;};}function handleError(_0x412d7f,_0x89c360){_0x89c360=_0x89c360||0x1f4;return function(_0x1018f4){logger[_0x5b44('0x24')](_0x1018f4['stack']);if(_0x1018f4[_0x5b44('0x25')]){delete _0x1018f4[_0x5b44('0x25')];}_0x412d7f[_0x5b44('0x16')](_0x89c360)[_0x5b44('0x26')](_0x1018f4);};}exports[_0x5b44('0x27')]=function(_0x51e394,_0x26d224){var _0xc44ea9={},_0x5f56a1={},_0x12130e={'count':0x0,'rows':[]};var _0x23e046=_[_0x5b44('0x28')](db[_0x5b44('0x29')][_0x5b44('0x2a')],function(_0x4efe29){return{'name':_0x4efe29[_0x5b44('0x2b')],'type':_0x4efe29[_0x5b44('0x2c')][_0x5b44('0x2d')]};});_0x5f56a1[_0x5b44('0x2e')]=_[_0x5b44('0x28')](_0x23e046,'name');_0x5f56a1[_0x5b44('0x2f')]=_[_0x5b44('0x30')](_0x51e394[_0x5b44('0x2f')]);_0x5f56a1[_0x5b44('0x31')]=_[_0x5b44('0x32')](_0x5f56a1[_0x5b44('0x2e')],_0x5f56a1[_0x5b44('0x2f')]);_0xc44ea9[_0x5b44('0x33')]=_[_0x5b44('0x32')](_0x5f56a1[_0x5b44('0x2e')],qs[_0x5b44('0x34')](_0x51e394[_0x5b44('0x2f')][_0x5b44('0x34')]));_0xc44ea9[_0x5b44('0x33')]=_0xc44ea9[_0x5b44('0x33')]['length']?_0xc44ea9[_0x5b44('0x33')]:_0x5f56a1['model'];if(!_0x51e394[_0x5b44('0x2f')][_0x5b44('0x35')](_0x5b44('0x36'))){_0xc44ea9['limit']=qs[_0x5b44('0x1b')](_0x51e394[_0x5b44('0x2f')][_0x5b44('0x1b')]);_0xc44ea9[_0x5b44('0x19')]=qs['offset'](_0x51e394[_0x5b44('0x2f')]['offset']);}_0xc44ea9[_0x5b44('0x37')]=qs['sort'](_0x51e394[_0x5b44('0x2f')]['sort']);_0xc44ea9[_0x5b44('0x38')]=qs[_0x5b44('0x31')](_[_0x5b44('0x39')](_0x51e394['query'],_0x5f56a1[_0x5b44('0x31')]),_0x23e046);if(_0x51e394[_0x5b44('0x2f')][_0x5b44('0x3a')]){_0xc44ea9[_0x5b44('0x38')]=_['merge'](_0xc44ea9[_0x5b44('0x38')],{'$or':_[_0x5b44('0x28')](_0x23e046,function(_0x18ba15){if(_0x18ba15[_0x5b44('0x2c')]!=='VIRTUAL'){var _0x89f6e3={};_0x89f6e3[_0x18ba15['name']]={'$like':'%'+_0x51e394[_0x5b44('0x2f')][_0x5b44('0x3a')]+'%'};return _0x89f6e3;}})});}_0xc44ea9=_[_0x5b44('0x3b')]({},_0xc44ea9,_0x51e394[_0x5b44('0x3c')]);var _0xc340ff={'where':_0xc44ea9[_0x5b44('0x38')]};return db['SmsQueueReport'][_0x5b44('0x1c')](_0xc340ff)[_0x5b44('0x22')](function(_0x5e373e){_0x12130e[_0x5b44('0x1c')]=_0x5e373e;if(_0x51e394[_0x5b44('0x2f')][_0x5b44('0x3d')]){_0xc44ea9[_0x5b44('0x3e')]=[{'all':!![]}];}return db[_0x5b44('0x29')]['findAll'](_0xc44ea9);})[_0x5b44('0x22')](function(_0x528486){_0x12130e['rows']=_0x528486;return _0x12130e;})[_0x5b44('0x22')](respondWithFilteredResult(_0x26d224,_0xc44ea9))['catch'](handleError(_0x26d224,null));};exports[_0x5b44('0x3f')]=function(_0x4b87f4,_0x4d0e7c){var _0x5585c0={'raw':!![],'where':{'id':_0x4b87f4[_0x5b44('0x40')]['id']}},_0x5ef7e1={};_0x5ef7e1[_0x5b44('0x2e')]=_['keys'](db[_0x5b44('0x29')]['rawAttributes']);_0x5ef7e1[_0x5b44('0x2f')]=_['keys'](_0x4b87f4[_0x5b44('0x2f')]);_0x5ef7e1[_0x5b44('0x31')]=_[_0x5b44('0x32')](_0x5ef7e1[_0x5b44('0x2e')],_0x5ef7e1[_0x5b44('0x2f')]);_0x5585c0[_0x5b44('0x33')]=_[_0x5b44('0x32')](_0x5ef7e1[_0x5b44('0x2e')],qs[_0x5b44('0x34')](_0x4b87f4[_0x5b44('0x2f')]['fields']));_0x5585c0[_0x5b44('0x33')]=_0x5585c0[_0x5b44('0x33')]['length']?_0x5585c0['attributes']:_0x5ef7e1[_0x5b44('0x2e')];if(_0x4b87f4['query'][_0x5b44('0x3d')]){_0x5585c0[_0x5b44('0x3e')]=[{'all':!![]}];}_0x5585c0=_[_0x5b44('0x3b')]({},_0x5585c0,_0x4b87f4['options']);return db[_0x5b44('0x29')][_0x5b44('0x41')](_0x5585c0)['then'](handleEntityNotFound(_0x4d0e7c,null))[_0x5b44('0x22')](respondWithResult(_0x4d0e7c,null))['catch'](handleError(_0x4d0e7c,null));};exports[_0x5b44('0x42')]=function(_0x255ef9,_0x15f326){return db['SmsQueueReport'][_0x5b44('0x42')](_0x255ef9['body'],{})[_0x5b44('0x22')](respondWithResult(_0x15f326,0xc9))['catch'](handleError(_0x15f326,null));};exports[_0x5b44('0x43')]=function(_0x25c347,_0x39850a){if(_0x25c347[_0x5b44('0x44')]['id']){delete _0x25c347[_0x5b44('0x44')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x25c347[_0x5b44('0x40')]['id']}})[_0x5b44('0x22')](handleEntityNotFound(_0x39850a,null))['then'](saveUpdates(_0x25c347[_0x5b44('0x44')],null))[_0x5b44('0x22')](respondWithResult(_0x39850a,null))[_0x5b44('0x45')](handleError(_0x39850a,null));};exports[_0x5b44('0x46')]=function(_0x509456,_0x26c7c8){return db[_0x5b44('0x29')][_0x5b44('0x41')]({'where':{'id':_0x509456['params']['id']}})[_0x5b44('0x22')](handleEntityNotFound(_0x26c7c8,null))[_0x5b44('0x22')](removeEntity(_0x26c7c8,null))[_0x5b44('0x45')](handleError(_0x26c7c8,null));};exports[_0x5b44('0x47')]=function(_0x3ec01e,_0x1ad5e8){return db[_0x5b44('0x29')][_0x5b44('0x47')]()[_0x5b44('0x22')](respondWithResult(_0x1ad5e8,null))['catch'](handleError(_0x1ad5e8,null));}; \ No newline at end of file +var _0x41bd=['nolimit','order','sort','where','pick','filter','merge','type','options','include','rows','catch','show','params','includeAll','find','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','offset','undefined','count','limit','set','Content-Range','apply','reject','destroy','then','error','stack','name','map','SmsQueueReport','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x41bd,0x9f));var _0xd41b=function(_0x5d2175,_0x3a5b3a){_0x5d2175=_0x5d2175-0x0;var _0x27d5d6=_0x41bd[_0x5d2175];return _0x27d5d6;};'use strict';var emlformat=require(_0xd41b('0x0'));var rimraf=require(_0xd41b('0x1'));var zipdir=require(_0xd41b('0x2'));var jsonpatch=require(_0xd41b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd41b('0x4'));var util=require(_0xd41b('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xd41b('0x6'));var ejs=require(_0xd41b('0x7'));var fs=require('fs');var fs_extra=require(_0xd41b('0x8'));var _=require(_0xd41b('0x9'));var squel=require(_0xd41b('0xa'));var crypto=require(_0xd41b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd41b('0xc'));var toCsv=require(_0xd41b('0x6'));var querystring=require(_0xd41b('0xd'));var Papa=require(_0xd41b('0xe'));var Redis=require(_0xd41b('0xf'));var authService=require(_0xd41b('0x10'));var qs=require(_0xd41b('0x11'));var as=require(_0xd41b('0x12'));var hardwareService=require(_0xd41b('0x13'));var logger=require(_0xd41b('0x14'))(_0xd41b('0x15'));var utils=require('../../config/utils');var config=require(_0xd41b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3673aa,_0xc406cf){_0xc406cf=_0xc406cf||0xcc;return function(_0x5f4f6e){if(_0x5f4f6e){return _0x3673aa[_0xd41b('0x17')](_0xc406cf);}return _0x3673aa[_0xd41b('0x18')](_0xc406cf)['end']();};}function respondWithResult(_0x58feb3,_0x3ddfe3){_0x3ddfe3=_0x3ddfe3||0xc8;return function(_0x12dde0){if(_0x12dde0){return _0x58feb3[_0xd41b('0x18')](_0x3ddfe3)['json'](_0x12dde0);}};}function respondWithFilteredResult(_0x5e33da,_0x4bfae0){return function(_0x3b00c7){if(_0x3b00c7){var _0x4a1fe5=typeof _0x4bfae0[_0xd41b('0x19')]===_0xd41b('0x1a')&&typeof _0x4bfae0['limit']===_0xd41b('0x1a');var _0x9424f2=_0x3b00c7['count'];var _0x2d5a46=_0x4a1fe5?0x0:_0x4bfae0['offset'];var _0x168bbc=_0x4a1fe5?_0x3b00c7[_0xd41b('0x1b')]:_0x4bfae0[_0xd41b('0x19')]+_0x4bfae0[_0xd41b('0x1c')];var _0x3c454d;if(_0x168bbc>=_0x9424f2){_0x168bbc=_0x9424f2;_0x3c454d=0xc8;}else{_0x3c454d=0xce;}_0x5e33da[_0xd41b('0x18')](_0x3c454d);return _0x5e33da[_0xd41b('0x1d')](_0xd41b('0x1e'),_0x2d5a46+'-'+_0x168bbc+'/'+_0x9424f2)['json'](_0x3b00c7);}return null;};}function patchUpdates(_0x291578){return function(_0x339da7){try{jsonpatch[_0xd41b('0x1f')](_0x339da7,_0x291578,!![]);}catch(_0x5c7eb7){return BPromise[_0xd41b('0x20')](_0x5c7eb7);}return _0x339da7['save']();};}function saveUpdates(_0x1479c6,_0x240641){return function(_0xbcd931){if(_0xbcd931){return _0xbcd931['update'](_0x1479c6)['then'](function(_0x120f89){return _0x120f89;});}return null;};}function removeEntity(_0x3d2162,_0x77de66){return function(_0x25c041){if(_0x25c041){return _0x25c041[_0xd41b('0x21')]()[_0xd41b('0x22')](function(){_0x3d2162[_0xd41b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd72f8f,_0x2c9566){return function(_0x4a8c6d){if(!_0x4a8c6d){_0xd72f8f['sendStatus'](0x194);}return _0x4a8c6d;};}function handleError(_0x194c1f,_0x47ea77){_0x47ea77=_0x47ea77||0x1f4;return function(_0x46537e){logger[_0xd41b('0x23')](_0x46537e[_0xd41b('0x24')]);if(_0x46537e[_0xd41b('0x25')]){delete _0x46537e['name'];}_0x194c1f[_0xd41b('0x18')](_0x47ea77)['send'](_0x46537e);};}exports['index']=function(_0x198896,_0x505a5e){var _0x433f07={},_0x8d9f02={},_0x538842={'count':0x0,'rows':[]};var _0x4e139f=_[_0xd41b('0x26')](db[_0xd41b('0x27')][_0xd41b('0x28')],function(_0x163811){return{'name':_0x163811[_0xd41b('0x29')],'type':_0x163811['type']['key']};});_0x8d9f02[_0xd41b('0x2a')]=_[_0xd41b('0x26')](_0x4e139f,_0xd41b('0x25'));_0x8d9f02[_0xd41b('0x2b')]=_[_0xd41b('0x2c')](_0x198896[_0xd41b('0x2b')]);_0x8d9f02[_0xd41b('0x2d')]=_['intersection'](_0x8d9f02['model'],_0x8d9f02[_0xd41b('0x2b')]);_0x433f07[_0xd41b('0x2e')]=_[_0xd41b('0x2f')](_0x8d9f02[_0xd41b('0x2a')],qs[_0xd41b('0x30')](_0x198896[_0xd41b('0x2b')][_0xd41b('0x30')]));_0x433f07[_0xd41b('0x2e')]=_0x433f07[_0xd41b('0x2e')][_0xd41b('0x31')]?_0x433f07[_0xd41b('0x2e')]:_0x8d9f02[_0xd41b('0x2a')];if(!_0x198896[_0xd41b('0x2b')][_0xd41b('0x32')](_0xd41b('0x33'))){_0x433f07[_0xd41b('0x1c')]=qs[_0xd41b('0x1c')](_0x198896[_0xd41b('0x2b')][_0xd41b('0x1c')]);_0x433f07[_0xd41b('0x19')]=qs['offset'](_0x198896[_0xd41b('0x2b')][_0xd41b('0x19')]);}_0x433f07[_0xd41b('0x34')]=qs['sort'](_0x198896[_0xd41b('0x2b')][_0xd41b('0x35')]);_0x433f07[_0xd41b('0x36')]=qs[_0xd41b('0x2d')](_[_0xd41b('0x37')](_0x198896[_0xd41b('0x2b')],_0x8d9f02[_0xd41b('0x2d')]),_0x4e139f);if(_0x198896[_0xd41b('0x2b')][_0xd41b('0x38')]){_0x433f07[_0xd41b('0x36')]=_[_0xd41b('0x39')](_0x433f07['where'],{'$or':_[_0xd41b('0x26')](_0x4e139f,function(_0x20663c){if(_0x20663c[_0xd41b('0x3a')]!=='VIRTUAL'){var _0x4d4138={};_0x4d4138[_0x20663c[_0xd41b('0x25')]]={'$like':'%'+_0x198896['query']['filter']+'%'};return _0x4d4138;}})});}_0x433f07=_[_0xd41b('0x39')]({},_0x433f07,_0x198896[_0xd41b('0x3b')]);var _0x69396d={'where':_0x433f07[_0xd41b('0x36')]};return db['SmsQueueReport']['count'](_0x69396d)[_0xd41b('0x22')](function(_0x3862b1){_0x538842[_0xd41b('0x1b')]=_0x3862b1;if(_0x198896[_0xd41b('0x2b')]['includeAll']){_0x433f07[_0xd41b('0x3c')]=[{'all':!![]}];}return db[_0xd41b('0x27')]['findAll'](_0x433f07);})[_0xd41b('0x22')](function(_0x27cf5b){_0x538842[_0xd41b('0x3d')]=_0x27cf5b;return _0x538842;})[_0xd41b('0x22')](respondWithFilteredResult(_0x505a5e,_0x433f07))[_0xd41b('0x3e')](handleError(_0x505a5e,null));};exports[_0xd41b('0x3f')]=function(_0x4ea22d,_0x1ea405){var _0x55edba={'raw':!![],'where':{'id':_0x4ea22d[_0xd41b('0x40')]['id']}},_0x1e43a1={};_0x1e43a1['model']=_[_0xd41b('0x2c')](db[_0xd41b('0x27')][_0xd41b('0x28')]);_0x1e43a1[_0xd41b('0x2b')]=_[_0xd41b('0x2c')](_0x4ea22d['query']);_0x1e43a1[_0xd41b('0x2d')]=_[_0xd41b('0x2f')](_0x1e43a1['model'],_0x1e43a1[_0xd41b('0x2b')]);_0x55edba[_0xd41b('0x2e')]=_[_0xd41b('0x2f')](_0x1e43a1[_0xd41b('0x2a')],qs[_0xd41b('0x30')](_0x4ea22d[_0xd41b('0x2b')][_0xd41b('0x30')]));_0x55edba[_0xd41b('0x2e')]=_0x55edba[_0xd41b('0x2e')]['length']?_0x55edba[_0xd41b('0x2e')]:_0x1e43a1[_0xd41b('0x2a')];if(_0x4ea22d[_0xd41b('0x2b')][_0xd41b('0x41')]){_0x55edba[_0xd41b('0x3c')]=[{'all':!![]}];}_0x55edba=_[_0xd41b('0x39')]({},_0x55edba,_0x4ea22d['options']);return db['SmsQueueReport'][_0xd41b('0x42')](_0x55edba)[_0xd41b('0x22')](handleEntityNotFound(_0x1ea405,null))[_0xd41b('0x22')](respondWithResult(_0x1ea405,null))[_0xd41b('0x3e')](handleError(_0x1ea405,null));};exports['create']=function(_0x4cd840,_0x4cd202){return db[_0xd41b('0x27')]['create'](_0x4cd840[_0xd41b('0x43')],{})[_0xd41b('0x22')](respondWithResult(_0x4cd202,0xc9))[_0xd41b('0x3e')](handleError(_0x4cd202,null));};exports[_0xd41b('0x44')]=function(_0x3f771b,_0x7a6cec){if(_0x3f771b[_0xd41b('0x43')]['id']){delete _0x3f771b[_0xd41b('0x43')]['id'];}return db[_0xd41b('0x27')][_0xd41b('0x42')]({'where':{'id':_0x3f771b['params']['id']}})[_0xd41b('0x22')](handleEntityNotFound(_0x7a6cec,null))['then'](saveUpdates(_0x3f771b[_0xd41b('0x43')],null))['then'](respondWithResult(_0x7a6cec,null))['catch'](handleError(_0x7a6cec,null));};exports[_0xd41b('0x21')]=function(_0x162a30,_0x198245){return db[_0xd41b('0x27')][_0xd41b('0x42')]({'where':{'id':_0x162a30[_0xd41b('0x40')]['id']}})[_0xd41b('0x22')](handleEntityNotFound(_0x198245,null))['then'](removeEntity(_0x198245,null))[_0xd41b('0x3e')](handleError(_0x198245,null));};exports[_0xd41b('0x45')]=function(_0x394f7c,_0x5260cb){return db[_0xd41b('0x27')]['describe']()[_0xd41b('0x22')](respondWithResult(_0x5260cb,null))[_0xd41b('0x3e')](handleError(_0x5260cb,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 0e0bdd4..39744ca 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x38aeea,_0x57522a){var _0x5e8d2c=function(_0xff08ce){while(--_0xff08ce){_0x38aeea['push'](_0x38aeea['shift']());}};_0x5e8d2c(++_0x57522a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','report_sms_queue','uniqueid','lodash'];(function(_0x905a8b,_0x39a180){var _0x3641c3=function(_0x54af7c){while(--_0x54af7c){_0x905a8b['push'](_0x905a8b['shift']());}};_0x3641c3(++_0x39a180);}(_0x70e0,0x17b));var _0x070e=function(_0x11c791,_0x2a7c2f){_0x11c791=_0x11c791-0x0;var _0x50ef57=_0x70e0[_0x11c791];return _0x50ef57;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('SmsQueueReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 98b4c77..feec11e 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 _0x5def=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw','UpdateSmsQueueReport','where','attributes','limit'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5def,0x91));var _0xf5de=function(_0x52a8da,_0x5d9213){_0x52a8da=_0x52a8da-0x0;var _0x5e9460=_0x5def[_0x52a8da];return _0x5e9460;};'use strict';var _=require(_0xf5de('0x0'));var util=require(_0xf5de('0x1'));var moment=require(_0xf5de('0x2'));var BPromise=require(_0xf5de('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf5de('0x4'))['db'];var utils=require(_0xf5de('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5de('0x6'));var jayson=require(_0xf5de('0x7'));var client=jayson['client'][_0xf5de('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42b6e2,_0x300217,_0x50fe2e){return new BPromise(function(_0x3c61b0,_0x523334){return client[_0xf5de('0x9')](_0x42b6e2,_0x50fe2e)[_0xf5de('0xa')](function(_0x167d89){logger[_0xf5de('0xb')](_0xf5de('0xc'),_0x300217,_0xf5de('0xd'));logger[_0xf5de('0xe')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x300217,_0xf5de('0xd'),JSON[_0xf5de('0xf')](_0x167d89));if(_0x167d89[_0xf5de('0x10')]){if(_0x167d89[_0xf5de('0x10')][_0xf5de('0x11')]===0x1f4){logger[_0xf5de('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x300217,_0x167d89[_0xf5de('0x10')][_0xf5de('0x12')]);return _0x523334(_0x167d89[_0xf5de('0x10')][_0xf5de('0x12')]);}logger[_0xf5de('0x10')](_0xf5de('0xc'),_0x300217,_0x167d89['error'][_0xf5de('0x12')]);return _0x3c61b0(_0x167d89[_0xf5de('0x10')]['message']);}else{logger[_0xf5de('0xb')](_0xf5de('0xc'),_0x300217,_0xf5de('0xd'));_0x3c61b0(_0x167d89['result'][_0xf5de('0x12')]);}})[_0xf5de('0x13')](function(_0x496fcc){logger[_0xf5de('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x300217,_0x496fcc);_0x523334(_0x496fcc);});});}exports[_0xf5de('0x14')]=function(_0x3c77c4){var _0x3887a7=this;return new Promise(function(_0x918040,_0x1d174c){return db[_0xf5de('0x15')]['create'](_0x3c77c4[_0xf5de('0x16')],{'raw':_0x3c77c4[_0xf5de('0x17')]?_0x3c77c4[_0xf5de('0x17')][_0xf5de('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x15afe7){logger[_0xf5de('0xb')](_0xf5de('0x14'),_0x3c77c4);logger[_0xf5de('0xe')](_0xf5de('0x14'),_0x3c77c4,JSON['stringify'](_0x15afe7));_0x918040(_0x15afe7);})['catch'](function(_0xfa3e8a){logger[_0xf5de('0x10')]('CreateSmsQueueReport',_0xfa3e8a['message'],_0x3c77c4);_0x1d174c(_0x3887a7['error'](0x1f4,_0xfa3e8a[_0xf5de('0x12')]));});});};exports[_0xf5de('0x19')]=function(_0x4d55ff){var _0x45d098=this;return new Promise(function(_0x2b7603,_0x2a4bbb){return db['SmsQueueReport']['update'](_0x4d55ff[_0xf5de('0x16')],{'raw':_0x4d55ff[_0xf5de('0x17')]?_0x4d55ff[_0xf5de('0x17')][_0xf5de('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d55ff[_0xf5de('0x17')]?_0x4d55ff[_0xf5de('0x17')][_0xf5de('0x1a')]||null:null,'attributes':_0x4d55ff['options']?_0x4d55ff[_0xf5de('0x17')][_0xf5de('0x1b')]||null:null,'limit':_0x4d55ff[_0xf5de('0x17')]?_0x4d55ff[_0xf5de('0x17')][_0xf5de('0x1c')]||null:null})['then'](function(_0x42824c){logger[_0xf5de('0xb')]('UpdateSmsQueueReport',_0x4d55ff);logger[_0xf5de('0xe')]('UpdateSmsQueueReport',_0x4d55ff,JSON[_0xf5de('0xf')](_0x42824c));_0x2b7603(_0x42824c);})[_0xf5de('0x13')](function(_0x162885){logger[_0xf5de('0x10')](_0xf5de('0x19'),_0x162885[_0xf5de('0x12')],_0x4d55ff);_0x2a4bbb(_0x45d098[_0xf5de('0x10')](0x1f4,_0x162885[_0xf5de('0x12')]));});});}; \ No newline at end of file +var _0x77a7=['randomstring','ioredis','rpc','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','UpdateSmsQueueReport','update','raw','where','limit','stringify','lodash','util','moment','bluebird'];(function(_0x3a60b8,_0x47caab){var _0x4eb583=function(_0x2251b5){while(--_0x2251b5){_0x3a60b8['push'](_0x3a60b8['shift']());}};_0x4eb583(++_0x47caab);}(_0x77a7,0x19c));var _0x777a=function(_0x484bda,_0x3ed468){_0x484bda=_0x484bda-0x0;var _0x88f9c1=_0x77a7[_0x484bda];return _0x88f9c1;};'use strict';var _=require(_0x777a('0x0'));var util=require(_0x777a('0x1'));var moment=require(_0x777a('0x2'));var BPromise=require(_0x777a('0x3'));var rs=require(_0x777a('0x4'));var fs=require('fs');var Redis=require(_0x777a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x777a('0x6'));var config=require('../../config/environment');var jayson=require(_0x777a('0x7'));var client=jayson[_0x777a('0x8')][_0x777a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e0fa5,_0x350340,_0x110ac5){return new BPromise(function(_0xd18ecf,_0x23c3ed){return client[_0x777a('0xa')](_0x1e0fa5,_0x110ac5)[_0x777a('0xb')](function(_0x48e557){logger['info'](_0x777a('0xc'),_0x350340,'request\x20sent');logger[_0x777a('0xd')](_0x777a('0xe'),_0x350340,_0x777a('0xf'),JSON['stringify'](_0x48e557));if(_0x48e557[_0x777a('0x10')]){if(_0x48e557[_0x777a('0x10')][_0x777a('0x11')]===0x1f4){logger[_0x777a('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x350340,_0x48e557[_0x777a('0x10')][_0x777a('0x12')]);return _0x23c3ed(_0x48e557['error'][_0x777a('0x12')]);}logger[_0x777a('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x350340,_0x48e557[_0x777a('0x10')][_0x777a('0x12')]);return _0xd18ecf(_0x48e557[_0x777a('0x10')][_0x777a('0x12')]);}else{logger[_0x777a('0x13')](_0x777a('0xc'),_0x350340,_0x777a('0xf'));_0xd18ecf(_0x48e557['result'][_0x777a('0x12')]);}})[_0x777a('0x14')](function(_0x4817ed){logger[_0x777a('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x350340,_0x4817ed);_0x23c3ed(_0x4817ed);});});}exports[_0x777a('0x15')]=function(_0x4c2b1b){var _0x3704c3=this;return new Promise(function(_0x29ac63,_0x58f698){return db[_0x777a('0x16')][_0x777a('0x17')](_0x4c2b1b[_0x777a('0x18')],{'raw':_0x4c2b1b[_0x777a('0x19')]?_0x4c2b1b[_0x777a('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2dd5dd){logger[_0x777a('0x13')](_0x777a('0x15'),_0x4c2b1b);logger[_0x777a('0xd')](_0x777a('0x15'),_0x4c2b1b,JSON['stringify'](_0x2dd5dd));_0x29ac63(_0x2dd5dd);})['catch'](function(_0x30d74f){logger[_0x777a('0x10')](_0x777a('0x15'),_0x30d74f[_0x777a('0x12')],_0x4c2b1b);_0x58f698(_0x3704c3['error'](0x1f4,_0x30d74f[_0x777a('0x12')]));});});};exports[_0x777a('0x1a')]=function(_0x490461){var _0x503656=this;return new Promise(function(_0x34bb91,_0x5cf3e4){return db[_0x777a('0x16')][_0x777a('0x1b')](_0x490461['body'],{'raw':_0x490461['options']?_0x490461[_0x777a('0x19')][_0x777a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x490461[_0x777a('0x19')]?_0x490461[_0x777a('0x19')][_0x777a('0x1d')]||null:null,'attributes':_0x490461[_0x777a('0x19')]?_0x490461[_0x777a('0x19')]['attributes']||null:null,'limit':_0x490461[_0x777a('0x19')]?_0x490461[_0x777a('0x19')][_0x777a('0x1e')]||null:null})[_0x777a('0xb')](function(_0x36b0fc){logger['info'](_0x777a('0x1a'),_0x490461);logger[_0x777a('0xd')](_0x777a('0x1a'),_0x490461,JSON[_0x777a('0x1f')](_0x36b0fc));_0x34bb91(_0x36b0fc);})[_0x777a('0x14')](function(_0x1c1f14){logger[_0x777a('0x10')](_0x777a('0x1a'),_0x1c1f14[_0x777a('0x12')],_0x490461);_0x5cf3e4(_0x503656[_0x777a('0x10')](0x1f4,_0x1c1f14[_0x777a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 1274d1b..5c71b8c 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 _0xb647=['get','isAuthenticated','index','/describe','describe','/:id','show','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0xea13a3,_0x577f58){var _0x1ad664=function(_0x532867){while(--_0x532867){_0xea13a3['push'](_0xea13a3['shift']());}};_0x1ad664(++_0x577f58);}(_0xb647,0xdb));var _0x7b64=function(_0x171aab,_0x1e94e2){_0x171aab=_0x171aab-0x0;var _0x478d58=_0xb647[_0x171aab];return _0x478d58;};'use strict';var multer=require(_0x7b64('0x0'));var util=require(_0x7b64('0x1'));var path=require(_0x7b64('0x2'));var timeout=require(_0x7b64('0x3'));var express=require(_0x7b64('0x4'));var router=express[_0x7b64('0x5')]();var fs_extra=require(_0x7b64('0x6'));var auth=require(_0x7b64('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7b64('0x8'));var controller=require('./smsTransferReport.controller');router[_0x7b64('0x9')]('/',auth[_0x7b64('0xa')](),controller[_0x7b64('0xb')]);router[_0x7b64('0x9')](_0x7b64('0xc'),auth[_0x7b64('0xa')](),controller[_0x7b64('0xd')]);router[_0x7b64('0x9')](_0x7b64('0xe'),auth['isAuthenticated'](),controller[_0x7b64('0xf')]);router['post']('/',auth[_0x7b64('0xa')](),controller['create']);router['put'](_0x7b64('0xe'),auth[_0x7b64('0xa')](),controller['update']);router[_0x7b64('0x10')](_0x7b64('0xe'),auth[_0x7b64('0xa')](),controller[_0x7b64('0x11')]);module[_0x7b64('0x12')]=router; \ No newline at end of file +var _0xe14b=['delete','destroy','exports','multer','util','express','Router','../../components/auth/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','show','post','/:id'];(function(_0x219f47,_0x27242b){var _0x176518=function(_0x246179){while(--_0x246179){_0x219f47['push'](_0x219f47['shift']());}};_0x176518(++_0x27242b);}(_0xe14b,0x93));var _0xbe14=function(_0x4e67af,_0x46be57){_0x4e67af=_0x4e67af-0x0;var _0x7d1143=_0xe14b[_0x4e67af];return _0x7d1143;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')]('/',auth[_0xbe14('0x7')](),controller['create']);router['put'](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0xd')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xe')]);module[_0xbe14('0xf')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index e89c721..658a80f 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x2c450e,_0x221e9b){var _0x2248fa=function(_0x579599){while(--_0x579599){_0x2c450e['push'](_0x2c450e['shift']());}};_0x2248fa(++_0x221e9b);}(_0xf4eb,0xec));var _0xbf4e=function(_0x39c707,_0x3a16eb){_0x39c707=_0x39c707-0x0;var _0x49fac7=_0xf4eb[_0x39c707];return _0x49fac7;};'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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x817388,_0x58547f){var _0x12d106=function(_0x41914a){while(--_0x41914a){_0x817388['push'](_0x817388['shift']());}};_0x12d106(++_0x58547f);}(_0x9c44,0x178));var _0x49c4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9c44[_0x3d42d8];return _0x27fc41;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 8c278dc..c9eed3d 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 _0xe218=['../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','reject','save','then','destroy','error','stack','name','send','index','SmsTransferReport','fieldName','type','key','map','query','intersection','model','attributes','fields','length','nolimit','order','sort','filters','filter','where','merge','includeAll','include','catch','keys','rawAttributes','options','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x57dcc1,_0x15067d){var _0x9650b2=function(_0x451a42){while(--_0x451a42){_0x57dcc1['push'](_0x57dcc1['shift']());}};_0x9650b2(++_0x15067d);}(_0xe218,0x195));var _0x8e21=function(_0x1f10f8,_0x3df17e){_0x1f10f8=_0x1f10f8-0x0;var _0xdc191f=_0xe218[_0x1f10f8];return _0xdc191f;};'use strict';var emlformat=require(_0x8e21('0x0'));var rimraf=require(_0x8e21('0x1'));var zipdir=require(_0x8e21('0x2'));var jsonpatch=require(_0x8e21('0x3'));var rp=require(_0x8e21('0x4'));var moment=require(_0x8e21('0x5'));var BPromise=require(_0x8e21('0x6'));var Mustache=require(_0x8e21('0x7'));var util=require('util');var path=require(_0x8e21('0x8'));var sox=require(_0x8e21('0x9'));var csv=require('to-csv');var ejs=require(_0x8e21('0xa'));var fs=require('fs');var fs_extra=require(_0x8e21('0xb'));var _=require('lodash');var squel=require(_0x8e21('0xc'));var crypto=require(_0x8e21('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8e21('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8e21('0xf'));var Papa=require(_0x8e21('0x10'));var Redis=require(_0x8e21('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8e21('0x12'));var as=require(_0x8e21('0x13'));var hardwareService=require(_0x8e21('0x14'));var logger=require(_0x8e21('0x15'))(_0x8e21('0x16'));var utils=require('../../config/utils');var config=require(_0x8e21('0x17'));var licenseUtil=require(_0x8e21('0x18'));var db=require(_0x8e21('0x19'))['db'];function respondWithStatusCode(_0x51de3c,_0x35807b){_0x35807b=_0x35807b||0xcc;return function(_0x3e7a4e){if(_0x3e7a4e){return _0x51de3c[_0x8e21('0x1a')](_0x35807b);}return _0x51de3c[_0x8e21('0x1b')](_0x35807b)['end']();};}function respondWithResult(_0xd8f60f,_0x2bda30){_0x2bda30=_0x2bda30||0xc8;return function(_0x5f001c){if(_0x5f001c){return _0xd8f60f[_0x8e21('0x1b')](_0x2bda30)[_0x8e21('0x1c')](_0x5f001c);}};}function respondWithFilteredResult(_0xd72a18,_0x52d77b){return function(_0x394335){if(_0x394335){var _0x559925=typeof _0x52d77b[_0x8e21('0x1d')]==='undefined'&&typeof _0x52d77b[_0x8e21('0x1e')]==='undefined';var _0x153a25=_0x394335[_0x8e21('0x1f')];var _0x4376e4=_0x559925?0x0:_0x52d77b['offset'];var _0x4ebc78=_0x559925?_0x394335[_0x8e21('0x1f')]:_0x52d77b['offset']+_0x52d77b[_0x8e21('0x1e')];var _0x3eb25c;if(_0x4ebc78>=_0x153a25){_0x4ebc78=_0x153a25;_0x3eb25c=0xc8;}else{_0x3eb25c=0xce;}_0xd72a18[_0x8e21('0x1b')](_0x3eb25c);return _0xd72a18[_0x8e21('0x20')]('Content-Range',_0x4376e4+'-'+_0x4ebc78+'/'+_0x153a25)[_0x8e21('0x1c')](_0x394335);}return null;};}function patchUpdates(_0x277787){return function(_0x1b968b){try{jsonpatch['apply'](_0x1b968b,_0x277787,!![]);}catch(_0x3e2a01){return BPromise[_0x8e21('0x21')](_0x3e2a01);}return _0x1b968b[_0x8e21('0x22')]();};}function saveUpdates(_0x53304a,_0x23019e){return function(_0x19d89c){if(_0x19d89c){return _0x19d89c['update'](_0x53304a)[_0x8e21('0x23')](function(_0x20ccc6){return _0x20ccc6;});}return null;};}function removeEntity(_0x5b5200,_0x219334){return function(_0x1798d3){if(_0x1798d3){return _0x1798d3[_0x8e21('0x24')]()[_0x8e21('0x23')](function(){_0x5b5200[_0x8e21('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15a26d,_0x292f46){return function(_0x1fdd78){if(!_0x1fdd78){_0x15a26d[_0x8e21('0x1a')](0x194);}return _0x1fdd78;};}function handleError(_0x18206c,_0x3fa4c6){_0x3fa4c6=_0x3fa4c6||0x1f4;return function(_0x473075){logger[_0x8e21('0x25')](_0x473075[_0x8e21('0x26')]);if(_0x473075[_0x8e21('0x27')]){delete _0x473075[_0x8e21('0x27')];}_0x18206c[_0x8e21('0x1b')](_0x3fa4c6)[_0x8e21('0x28')](_0x473075);};}exports[_0x8e21('0x29')]=function(_0x250e20,_0x17721d){var _0xf1d60b={},_0x290c3a={},_0x32f940={'count':0x0,'rows':[]};var _0x217458=_['map'](db[_0x8e21('0x2a')]['rawAttributes'],function(_0x50de7){return{'name':_0x50de7[_0x8e21('0x2b')],'type':_0x50de7[_0x8e21('0x2c')][_0x8e21('0x2d')]};});_0x290c3a['model']=_[_0x8e21('0x2e')](_0x217458,'name');_0x290c3a['query']=_['keys'](_0x250e20[_0x8e21('0x2f')]);_0x290c3a['filters']=_[_0x8e21('0x30')](_0x290c3a[_0x8e21('0x31')],_0x290c3a[_0x8e21('0x2f')]);_0xf1d60b[_0x8e21('0x32')]=_[_0x8e21('0x30')](_0x290c3a[_0x8e21('0x31')],qs['fields'](_0x250e20[_0x8e21('0x2f')][_0x8e21('0x33')]));_0xf1d60b[_0x8e21('0x32')]=_0xf1d60b[_0x8e21('0x32')][_0x8e21('0x34')]?_0xf1d60b[_0x8e21('0x32')]:_0x290c3a[_0x8e21('0x31')];if(!_0x250e20[_0x8e21('0x2f')]['hasOwnProperty'](_0x8e21('0x35'))){_0xf1d60b[_0x8e21('0x1e')]=qs[_0x8e21('0x1e')](_0x250e20[_0x8e21('0x2f')][_0x8e21('0x1e')]);_0xf1d60b['offset']=qs[_0x8e21('0x1d')](_0x250e20['query'][_0x8e21('0x1d')]);}_0xf1d60b[_0x8e21('0x36')]=qs['sort'](_0x250e20[_0x8e21('0x2f')][_0x8e21('0x37')]);_0xf1d60b['where']=qs[_0x8e21('0x38')](_['pick'](_0x250e20[_0x8e21('0x2f')],_0x290c3a[_0x8e21('0x38')]),_0x217458);if(_0x250e20[_0x8e21('0x2f')][_0x8e21('0x39')]){_0xf1d60b[_0x8e21('0x3a')]=_[_0x8e21('0x3b')](_0xf1d60b[_0x8e21('0x3a')],{'$or':_['map'](_0x217458,function(_0x587f6b){if(_0x587f6b[_0x8e21('0x2c')]!=='VIRTUAL'){var _0x24acbc={};_0x24acbc[_0x587f6b[_0x8e21('0x27')]]={'$like':'%'+_0x250e20[_0x8e21('0x2f')][_0x8e21('0x39')]+'%'};return _0x24acbc;}})});}_0xf1d60b=_[_0x8e21('0x3b')]({},_0xf1d60b,_0x250e20['options']);var _0x18c91e={'where':_0xf1d60b[_0x8e21('0x3a')]};return db[_0x8e21('0x2a')][_0x8e21('0x1f')](_0x18c91e)['then'](function(_0x1a4963){_0x32f940[_0x8e21('0x1f')]=_0x1a4963;if(_0x250e20[_0x8e21('0x2f')][_0x8e21('0x3c')]){_0xf1d60b[_0x8e21('0x3d')]=[{'all':!![]}];}return db['SmsTransferReport']['findAll'](_0xf1d60b);})['then'](function(_0x2be482){_0x32f940['rows']=_0x2be482;return _0x32f940;})['then'](respondWithFilteredResult(_0x17721d,_0xf1d60b))[_0x8e21('0x3e')](handleError(_0x17721d,null));};exports['show']=function(_0x269b86,_0x44fec6){var _0x5976bc={'raw':!![],'where':{'id':_0x269b86['params']['id']}},_0x2620c6={};_0x2620c6[_0x8e21('0x31')]=_[_0x8e21('0x3f')](db[_0x8e21('0x2a')][_0x8e21('0x40')]);_0x2620c6[_0x8e21('0x2f')]=_[_0x8e21('0x3f')](_0x269b86['query']);_0x2620c6[_0x8e21('0x38')]=_[_0x8e21('0x30')](_0x2620c6['model'],_0x2620c6['query']);_0x5976bc[_0x8e21('0x32')]=_[_0x8e21('0x30')](_0x2620c6[_0x8e21('0x31')],qs['fields'](_0x269b86[_0x8e21('0x2f')]['fields']));_0x5976bc[_0x8e21('0x32')]=_0x5976bc[_0x8e21('0x32')][_0x8e21('0x34')]?_0x5976bc['attributes']:_0x2620c6['model'];if(_0x269b86[_0x8e21('0x2f')][_0x8e21('0x3c')]){_0x5976bc[_0x8e21('0x3d')]=[{'all':!![]}];}_0x5976bc=_[_0x8e21('0x3b')]({},_0x5976bc,_0x269b86[_0x8e21('0x41')]);return db[_0x8e21('0x2a')][_0x8e21('0x42')](_0x5976bc)[_0x8e21('0x23')](handleEntityNotFound(_0x44fec6,null))[_0x8e21('0x23')](respondWithResult(_0x44fec6,null))[_0x8e21('0x3e')](handleError(_0x44fec6,null));};exports['create']=function(_0x5e85f2,_0x437a60){return db[_0x8e21('0x2a')][_0x8e21('0x43')](_0x5e85f2[_0x8e21('0x44')],{})[_0x8e21('0x23')](respondWithResult(_0x437a60,0xc9))['catch'](handleError(_0x437a60,null));};exports[_0x8e21('0x45')]=function(_0x6a4245,_0x3522bb){if(_0x6a4245['body']['id']){delete _0x6a4245[_0x8e21('0x44')]['id'];}return db[_0x8e21('0x2a')][_0x8e21('0x42')]({'where':{'id':_0x6a4245[_0x8e21('0x46')]['id']}})[_0x8e21('0x23')](handleEntityNotFound(_0x3522bb,null))[_0x8e21('0x23')](saveUpdates(_0x6a4245[_0x8e21('0x44')],null))[_0x8e21('0x23')](respondWithResult(_0x3522bb,null))[_0x8e21('0x3e')](handleError(_0x3522bb,null));};exports[_0x8e21('0x24')]=function(_0x5d6487,_0xdf0e2f){return db['SmsTransferReport'][_0x8e21('0x42')]({'where':{'id':_0x5d6487[_0x8e21('0x46')]['id']}})[_0x8e21('0x23')](handleEntityNotFound(_0xdf0e2f,null))[_0x8e21('0x23')](removeEntity(_0xdf0e2f,null))[_0x8e21('0x3e')](handleError(_0xdf0e2f,null));};exports['describe']=function(_0x4ed787,_0x4e2b94){return db[_0x8e21('0x2a')]['describe']()[_0x8e21('0x23')](respondWithResult(_0x4e2b94,null))[_0x8e21('0x3e')](handleError(_0x4e2b94,null));}; \ No newline at end of file +var _0xb9d4=['query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','include','findAll','rows','show','includeAll','find','catch','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type'];(function(_0x58ec13,_0x3fbfc1){var _0x15bc4f=function(_0x243297){while(--_0x243297){_0x58ec13['push'](_0x58ec13['shift']());}};_0x15bc4f(++_0x3fbfc1);}(_0xb9d4,0x106));var _0x4b9d=function(_0x530641,_0x514d96){_0x530641=_0x530641-0x0;var _0x5ae650=_0xb9d4[_0x530641];return _0x5ae650;};'use strict';var emlformat=require(_0x4b9d('0x0'));var rimraf=require(_0x4b9d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b9d('0x2'));var rp=require(_0x4b9d('0x3'));var moment=require(_0x4b9d('0x4'));var BPromise=require(_0x4b9d('0x5'));var Mustache=require('mustache');var util=require(_0x4b9d('0x6'));var path=require(_0x4b9d('0x7'));var sox=require(_0x4b9d('0x8'));var csv=require(_0x4b9d('0x9'));var ejs=require(_0x4b9d('0xa'));var fs=require('fs');var fs_extra=require(_0x4b9d('0xb'));var _=require('lodash');var squel=require(_0x4b9d('0xc'));var crypto=require('crypto');var jsforce=require(_0x4b9d('0xd'));var deskjs=require(_0x4b9d('0xe'));var toCsv=require(_0x4b9d('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4b9d('0xf'));var authService=require(_0x4b9d('0x10'));var qs=require(_0x4b9d('0x11'));var as=require(_0x4b9d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b9d('0x13'))(_0x4b9d('0x14'));var utils=require(_0x4b9d('0x15'));var config=require(_0x4b9d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4b9d('0x17'))['db'];function respondWithStatusCode(_0xd3227f,_0x7b5bc3){_0x7b5bc3=_0x7b5bc3||0xcc;return function(_0x2f87bf){if(_0x2f87bf){return _0xd3227f[_0x4b9d('0x18')](_0x7b5bc3);}return _0xd3227f[_0x4b9d('0x19')](_0x7b5bc3)['end']();};}function respondWithResult(_0x186489,_0x5709d3){_0x5709d3=_0x5709d3||0xc8;return function(_0x2ad080){if(_0x2ad080){return _0x186489[_0x4b9d('0x19')](_0x5709d3)[_0x4b9d('0x1a')](_0x2ad080);}};}function respondWithFilteredResult(_0x2cc9b3,_0x18deea){return function(_0x234287){if(_0x234287){var _0x4122d9=typeof _0x18deea[_0x4b9d('0x1b')]===_0x4b9d('0x1c')&&typeof _0x18deea[_0x4b9d('0x1d')]===_0x4b9d('0x1c');var _0x5abcb3=_0x234287[_0x4b9d('0x1e')];var _0x25f79c=_0x4122d9?0x0:_0x18deea[_0x4b9d('0x1b')];var _0x14571e=_0x4122d9?_0x234287[_0x4b9d('0x1e')]:_0x18deea[_0x4b9d('0x1b')]+_0x18deea[_0x4b9d('0x1d')];var _0x385fc2;if(_0x14571e>=_0x5abcb3){_0x14571e=_0x5abcb3;_0x385fc2=0xc8;}else{_0x385fc2=0xce;}_0x2cc9b3[_0x4b9d('0x19')](_0x385fc2);return _0x2cc9b3[_0x4b9d('0x1f')](_0x4b9d('0x20'),_0x25f79c+'-'+_0x14571e+'/'+_0x5abcb3)['json'](_0x234287);}return null;};}function patchUpdates(_0x1030dd){return function(_0x4ffdb3){try{jsonpatch[_0x4b9d('0x21')](_0x4ffdb3,_0x1030dd,!![]);}catch(_0x444a06){return BPromise[_0x4b9d('0x22')](_0x444a06);}return _0x4ffdb3[_0x4b9d('0x23')]();};}function saveUpdates(_0x4d9661,_0x2e6b41){return function(_0x187067){if(_0x187067){return _0x187067[_0x4b9d('0x24')](_0x4d9661)[_0x4b9d('0x25')](function(_0x4b7ff0){return _0x4b7ff0;});}return null;};}function removeEntity(_0x2e8d0a,_0x39054a){return function(_0x3beebc){if(_0x3beebc){return _0x3beebc[_0x4b9d('0x26')]()['then'](function(){_0x2e8d0a[_0x4b9d('0x19')](0xcc)[_0x4b9d('0x27')]();});}};}function handleEntityNotFound(_0x533eae,_0x1896a7){return function(_0x58ff77){if(!_0x58ff77){_0x533eae[_0x4b9d('0x18')](0x194);}return _0x58ff77;};}function handleError(_0x48c316,_0x5e2461){_0x5e2461=_0x5e2461||0x1f4;return function(_0xcb334f){logger[_0x4b9d('0x28')](_0xcb334f[_0x4b9d('0x29')]);if(_0xcb334f[_0x4b9d('0x2a')]){delete _0xcb334f['name'];}_0x48c316[_0x4b9d('0x19')](_0x5e2461)[_0x4b9d('0x2b')](_0xcb334f);};}exports[_0x4b9d('0x2c')]=function(_0x23243a,_0x1a5e1f){var _0x4728c4={},_0x117d20={},_0x565296={'count':0x0,'rows':[]};var _0x397500=_[_0x4b9d('0x2d')](db[_0x4b9d('0x2e')][_0x4b9d('0x2f')],function(_0x17c7e2){return{'name':_0x17c7e2[_0x4b9d('0x30')],'type':_0x17c7e2[_0x4b9d('0x31')]['key']};});_0x117d20['model']=_['map'](_0x397500,_0x4b9d('0x2a'));_0x117d20[_0x4b9d('0x32')]=_[_0x4b9d('0x33')](_0x23243a['query']);_0x117d20['filters']=_[_0x4b9d('0x34')](_0x117d20['model'],_0x117d20['query']);_0x4728c4[_0x4b9d('0x35')]=_[_0x4b9d('0x34')](_0x117d20[_0x4b9d('0x36')],qs[_0x4b9d('0x37')](_0x23243a[_0x4b9d('0x32')][_0x4b9d('0x37')]));_0x4728c4[_0x4b9d('0x35')]=_0x4728c4[_0x4b9d('0x35')][_0x4b9d('0x38')]?_0x4728c4[_0x4b9d('0x35')]:_0x117d20['model'];if(!_0x23243a['query'][_0x4b9d('0x39')](_0x4b9d('0x3a'))){_0x4728c4[_0x4b9d('0x1d')]=qs['limit'](_0x23243a[_0x4b9d('0x32')][_0x4b9d('0x1d')]);_0x4728c4[_0x4b9d('0x1b')]=qs[_0x4b9d('0x1b')](_0x23243a['query']['offset']);}_0x4728c4[_0x4b9d('0x3b')]=qs[_0x4b9d('0x3c')](_0x23243a[_0x4b9d('0x32')][_0x4b9d('0x3c')]);_0x4728c4[_0x4b9d('0x3d')]=qs[_0x4b9d('0x3e')](_[_0x4b9d('0x3f')](_0x23243a[_0x4b9d('0x32')],_0x117d20[_0x4b9d('0x3e')]),_0x397500);if(_0x23243a[_0x4b9d('0x32')]['filter']){_0x4728c4[_0x4b9d('0x3d')]=_[_0x4b9d('0x40')](_0x4728c4['where'],{'$or':_['map'](_0x397500,function(_0xc14e29){if(_0xc14e29[_0x4b9d('0x31')]!=='VIRTUAL'){var _0x11fa69={};_0x11fa69[_0xc14e29['name']]={'$like':'%'+_0x23243a[_0x4b9d('0x32')][_0x4b9d('0x41')]+'%'};return _0x11fa69;}})});}_0x4728c4=_[_0x4b9d('0x40')]({},_0x4728c4,_0x23243a[_0x4b9d('0x42')]);var _0x3db1ce={'where':_0x4728c4[_0x4b9d('0x3d')]};return db['SmsTransferReport'][_0x4b9d('0x1e')](_0x3db1ce)['then'](function(_0x53477c){_0x565296[_0x4b9d('0x1e')]=_0x53477c;if(_0x23243a[_0x4b9d('0x32')]['includeAll']){_0x4728c4[_0x4b9d('0x43')]=[{'all':!![]}];}return db[_0x4b9d('0x2e')][_0x4b9d('0x44')](_0x4728c4);})[_0x4b9d('0x25')](function(_0xdae9f1){_0x565296[_0x4b9d('0x45')]=_0xdae9f1;return _0x565296;})[_0x4b9d('0x25')](respondWithFilteredResult(_0x1a5e1f,_0x4728c4))['catch'](handleError(_0x1a5e1f,null));};exports[_0x4b9d('0x46')]=function(_0x5156ee,_0x5e49ab){var _0x55219d={'raw':!![],'where':{'id':_0x5156ee['params']['id']}},_0x828d8c={};_0x828d8c['model']=_['keys'](db[_0x4b9d('0x2e')]['rawAttributes']);_0x828d8c['query']=_[_0x4b9d('0x33')](_0x5156ee[_0x4b9d('0x32')]);_0x828d8c[_0x4b9d('0x3e')]=_[_0x4b9d('0x34')](_0x828d8c[_0x4b9d('0x36')],_0x828d8c[_0x4b9d('0x32')]);_0x55219d[_0x4b9d('0x35')]=_[_0x4b9d('0x34')](_0x828d8c[_0x4b9d('0x36')],qs[_0x4b9d('0x37')](_0x5156ee['query'][_0x4b9d('0x37')]));_0x55219d[_0x4b9d('0x35')]=_0x55219d[_0x4b9d('0x35')][_0x4b9d('0x38')]?_0x55219d[_0x4b9d('0x35')]:_0x828d8c[_0x4b9d('0x36')];if(_0x5156ee['query'][_0x4b9d('0x47')]){_0x55219d[_0x4b9d('0x43')]=[{'all':!![]}];}_0x55219d=_[_0x4b9d('0x40')]({},_0x55219d,_0x5156ee[_0x4b9d('0x42')]);return db[_0x4b9d('0x2e')][_0x4b9d('0x48')](_0x55219d)[_0x4b9d('0x25')](handleEntityNotFound(_0x5e49ab,null))[_0x4b9d('0x25')](respondWithResult(_0x5e49ab,null))[_0x4b9d('0x49')](handleError(_0x5e49ab,null));};exports[_0x4b9d('0x4a')]=function(_0x54234c,_0x491388){return db['SmsTransferReport'][_0x4b9d('0x4a')](_0x54234c['body'],{})[_0x4b9d('0x25')](respondWithResult(_0x491388,0xc9))[_0x4b9d('0x49')](handleError(_0x491388,null));};exports[_0x4b9d('0x24')]=function(_0x44e0e4,_0x467fb0){if(_0x44e0e4[_0x4b9d('0x4b')]['id']){delete _0x44e0e4[_0x4b9d('0x4b')]['id'];}return db['SmsTransferReport'][_0x4b9d('0x48')]({'where':{'id':_0x44e0e4['params']['id']}})[_0x4b9d('0x25')](handleEntityNotFound(_0x467fb0,null))[_0x4b9d('0x25')](saveUpdates(_0x44e0e4[_0x4b9d('0x4b')],null))[_0x4b9d('0x25')](respondWithResult(_0x467fb0,null))['catch'](handleError(_0x467fb0,null));};exports[_0x4b9d('0x26')]=function(_0x128e78,_0x5cdf46){return db[_0x4b9d('0x2e')][_0x4b9d('0x48')]({'where':{'id':_0x128e78[_0x4b9d('0x4c')]['id']}})[_0x4b9d('0x25')](handleEntityNotFound(_0x5cdf46,null))['then'](removeEntity(_0x5cdf46,null))[_0x4b9d('0x49')](handleError(_0x5cdf46,null));};exports[_0x4b9d('0x4d')]=function(_0x4be346,_0x537a08){return db[_0x4b9d('0x2e')]['describe']()[_0x4b9d('0x25')](respondWithResult(_0x537a08,null))[_0x4b9d('0x49')](handleError(_0x537a08,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 8aaae0d..06d1719 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 _0xde50=['path','../../config/environment','define','SmsTransferReport','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x573e3e,_0x1a8b5d){var _0xbb1424=function(_0x1c67f2){while(--_0x1c67f2){_0x573e3e['push'](_0x573e3e['shift']());}};_0xbb1424(++_0x1a8b5d);}(_0xde50,0x140));var _0x0de5=function(_0x2869f5,_0x1a9221){_0x2869f5=_0x2869f5-0x0;var _0x599f8e=_0xde50[_0x2869f5];return _0x599f8e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0de5('0x0'))(_0x0de5('0x1'));var moment=require(_0x0de5('0x2'));var BPromise=require(_0x0de5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0de5('0x4'));var rimraf=require('rimraf');var config=require(_0x0de5('0x5'));var attributes=require('./smsTransferReport.attributes');module['exports']=function(_0x5f05a1,_0x444955){return _0x5f05a1[_0x0de5('0x6')](_0x0de5('0x7'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x0de5('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd976=['../../config/logger','moment','request-promise','rimraf','./smsTransferReport.attributes','define','SmsTransferReport','uniqueid','lodash'];(function(_0x4712ef,_0x3e5e22){var _0x30ec75=function(_0x237589){while(--_0x237589){_0x4712ef['push'](_0x4712ef['shift']());}};_0x30ec75(++_0x3e5e22);}(_0xd976,0x179));var _0x6d97=function(_0xd56285,_0x542c2d){_0xd56285=_0xd56285-0x0;var _0x7f46cc=_0xd976[_0xd56285];return _0x7f46cc;};'use strict';var _=require(_0x6d97('0x0'));var util=require('util');var logger=require(_0x6d97('0x1'))('api');var moment=require(_0x6d97('0x2'));var BPromise=require('bluebird');var rp=require(_0x6d97('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6d97('0x4'));var config=require('../../config/environment');var attributes=require(_0x6d97('0x5'));module['exports']=function(_0x3aa3fc,_0x16bda8){return _0x3aa3fc[_0x6d97('0x6')](_0x6d97('0x7'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x6d97('0x8'),'fields':[_0x6d97('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index cee9d0c..91889a5 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 _0x5178=['request','info','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x5178,0x171));var _0x8517=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5178[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0x8517('0x0'));var moment=require(_0x8517('0x1'));var BPromise=require(_0x8517('0x2'));var rs=require(_0x8517('0x3'));var fs=require('fs');var Redis=require(_0x8517('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8517('0x5'))(_0x8517('0x6'));var config=require('../../config/environment');var jayson=require(_0x8517('0x7'));var client=jayson['client'][_0x8517('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45498e,_0x3615b2,_0x10f918){return new BPromise(function(_0x25146d,_0x49739b){return client[_0x8517('0x9')](_0x45498e,_0x10f918)['then'](function(_0x485677){logger[_0x8517('0xa')](_0x8517('0xb'),_0x3615b2,'request\x20sent');logger[_0x8517('0xc')](_0x8517('0xd'),_0x3615b2,_0x8517('0xe'),JSON[_0x8517('0xf')](_0x485677));if(_0x485677[_0x8517('0x10')]){if(_0x485677[_0x8517('0x10')][_0x8517('0x11')]===0x1f4){logger[_0x8517('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x3615b2,_0x485677[_0x8517('0x10')][_0x8517('0x12')]);return _0x49739b(_0x485677[_0x8517('0x10')][_0x8517('0x12')]);}logger[_0x8517('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x3615b2,_0x485677[_0x8517('0x10')][_0x8517('0x12')]);return _0x25146d(_0x485677[_0x8517('0x10')][_0x8517('0x12')]);}else{logger[_0x8517('0xa')](_0x8517('0xb'),_0x3615b2,_0x8517('0xe'));_0x25146d(_0x485677[_0x8517('0x13')][_0x8517('0x12')]);}})[_0x8517('0x14')](function(_0x22b687){logger[_0x8517('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x3615b2,_0x22b687);_0x49739b(_0x22b687);});});} \ No newline at end of file +var _0xf350=['request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','SmsTransferReport,\x20%s,\x20%s'];(function(_0x527703,_0x1b06ac){var _0xc4b689=function(_0x22f9c4){while(--_0x22f9c4){_0x527703['push'](_0x527703['shift']());}};_0xc4b689(++_0x1b06ac);}(_0xf350,0x105));var _0x0f35=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf350[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0f35('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0f35('0x1'));var rs=require(_0x0f35('0x2'));var fs=require('fs');var Redis=require(_0x0f35('0x3'));var db=require(_0x0f35('0x4'))['db'];var utils=require(_0x0f35('0x5'));var logger=require(_0x0f35('0x6'))(_0x0f35('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0f35('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c61c4,_0x481712,_0x544342){return new BPromise(function(_0x2c716b,_0x49c0fe){return client[_0x0f35('0x9')](_0x2c61c4,_0x544342)['then'](function(_0x3d928d){logger[_0x0f35('0xa')](_0x0f35('0xb'),_0x481712,_0x0f35('0xc'));logger[_0x0f35('0xd')](_0x0f35('0xe'),_0x481712,_0x0f35('0xc'),JSON[_0x0f35('0xf')](_0x3d928d));if(_0x3d928d[_0x0f35('0x10')]){if(_0x3d928d['error'][_0x0f35('0x11')]===0x1f4){logger[_0x0f35('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x481712,_0x3d928d[_0x0f35('0x10')]['message']);return _0x49c0fe(_0x3d928d[_0x0f35('0x10')]['message']);}logger['error'](_0x0f35('0xb'),_0x481712,_0x3d928d[_0x0f35('0x10')][_0x0f35('0x12')]);return _0x2c716b(_0x3d928d['error'][_0x0f35('0x12')]);}else{logger[_0x0f35('0xa')](_0x0f35('0xb'),_0x481712,_0x0f35('0xc'));_0x2c716b(_0x3d928d[_0x0f35('0x13')][_0x0f35('0x12')]);}})[_0x0f35('0x14')](function(_0x1a2ffc){logger[_0x0f35('0x10')](_0x0f35('0xb'),_0x481712,_0x1a2ffc);_0x49c0fe(_0x1a2ffc);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 93f8551..45c70ae 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 _0x4d19=['server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','single','file','create','put','/:id','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','index','isAuthenticated','show','download','join','root'];(function(_0x9e7409,_0x587579){var _0x4e129b=function(_0x4e25d7){while(--_0x4e25d7){_0x9e7409['push'](_0x9e7409['shift']());}};_0x4e129b(++_0x587579);}(_0x4d19,0x12f));var _0x94d1=function(_0x352a73,_0x961008){_0x352a73=_0x352a73-0x0;var _0xb2f556=_0x4d19[_0x352a73];return _0xb2f556;};'use strict';var multer=require(_0x94d1('0x0'));var util=require(_0x94d1('0x1'));var path=require(_0x94d1('0x2'));var timeout=require(_0x94d1('0x3'));var express=require(_0x94d1('0x4'));var router=express['Router']();var fs_extra=require(_0x94d1('0x5'));var auth=require(_0x94d1('0x6'));var interaction=require(_0x94d1('0x7'));var config=require(_0x94d1('0x8'));var controller=require(_0x94d1('0x9'));router[_0x94d1('0xa')]('/',auth['isAuthenticated'](),controller[_0x94d1('0xb')]);router[_0x94d1('0xa')]('/:id',auth[_0x94d1('0xc')](),controller[_0x94d1('0xd')]);router[_0x94d1('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0x94d1('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5da82a,_0x22396e,_0x3cd2ee){_0x3cd2ee(null,path[_0x94d1('0xf')](config[_0x94d1('0x10')],_0x94d1('0x11')));},'filename':function(_0x2735cf,_0x4f6c8f,_0x501611){_0x4f6c8f[_0x94d1('0x12')]=_0x4f6c8f['originalname'][_0x94d1('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x501611(null,util[_0x94d1('0x14')](_0x94d1('0x15'),path[_0x94d1('0x16')](_0x4f6c8f[_0x94d1('0x12')],path[_0x94d1('0x17')](_0x4f6c8f['originalname'])),Date[_0x94d1('0x18')](),path['extname'](_0x4f6c8f[_0x94d1('0x12')])));}})});router['post']('/',upload[_0x94d1('0x19')](_0x94d1('0x1a')),controller[_0x94d1('0x1b')]);router[_0x94d1('0x1c')](_0x94d1('0x1d'),auth[_0x94d1('0xc')](),controller['update']);router[_0x94d1('0x1e')](_0x94d1('0x1d'),auth[_0x94d1('0xc')](),controller['delete']);module[_0x94d1('0x1f')]=router; \ No newline at end of file +var _0x61e4=['originalname','replace','%s-%s%s','basename','now','extname','single','file','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./sound.controller','get','index','/:id','isAuthenticated','/:id/download','download','root'];(function(_0x291a2c,_0x3ce061){var _0x530a1f=function(_0x1d1bbb){while(--_0x1d1bbb){_0x291a2c['push'](_0x291a2c['shift']());}};_0x530a1f(++_0x3ce061);}(_0x61e4,0x112));var _0x461e=function(_0x270a02,_0x223adb){_0x270a02=_0x270a02-0x0;var _0x3cd07b=_0x61e4[_0x270a02];return _0x3cd07b;};'use strict';var multer=require(_0x461e('0x0'));var util=require(_0x461e('0x1'));var path=require(_0x461e('0x2'));var timeout=require(_0x461e('0x3'));var express=require('express');var router=express[_0x461e('0x4')]();var fs_extra=require(_0x461e('0x5'));var auth=require(_0x461e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x461e('0x7'));var controller=require(_0x461e('0x8'));router[_0x461e('0x9')]('/',auth['isAuthenticated'](),controller[_0x461e('0xa')]);router['get'](_0x461e('0xb'),auth[_0x461e('0xc')](),controller['show']);router['get'](_0x461e('0xd'),auth[_0x461e('0xc')](),controller[_0x461e('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x535a1f,_0x206521,_0xd8f891){_0xd8f891(null,path['join'](config[_0x461e('0xf')],'server/files/sounds/original/'));},'filename':function(_0xb42da,_0x5ddc82,_0x41508e){_0x5ddc82[_0x461e('0x10')]=_0x5ddc82[_0x461e('0x10')][_0x461e('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x41508e(null,util['format'](_0x461e('0x12'),path[_0x461e('0x13')](_0x5ddc82[_0x461e('0x10')],path['extname'](_0x5ddc82[_0x461e('0x10')])),Date[_0x461e('0x14')](),path[_0x461e('0x15')](_0x5ddc82[_0x461e('0x10')])));}})});router['post']('/',upload[_0x461e('0x16')](_0x461e('0x17')),controller[_0x461e('0x18')]);router[_0x461e('0x19')](_0x461e('0xb'),auth[_0x461e('0xc')](),controller[_0x461e('0x1a')]);router[_0x461e('0x1b')](_0x461e('0xb'),auth[_0x461e('0xc')](),controller[_0x461e('0x1b')]);module[_0x461e('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index bc923a9..db22baf 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 _0x22e0=['INTEGER','sequelize','exports','STRING','name','FLOAT','BIGINT'];(function(_0x12877b,_0x8650cf){var _0x3549ff=function(_0x4f96b7){while(--_0x4f96b7){_0x12877b['push'](_0x12877b['shift']());}};_0x3549ff(++_0x8650cf);}(_0x22e0,0x1dd));var _0x022e=function(_0x587a80,_0x4b0de4){_0x587a80=_0x587a80-0x0;var _0x35926d=_0x22e0[_0x587a80];return _0x35926d;};'use strict';var Sequelize=require(_0x022e('0x0'));module[_0x022e('0x1')]={'name':{'type':Sequelize[_0x022e('0x2')],'unique':_0x022e('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x022e('0x2')]},'original_format':{'type':Sequelize[_0x022e('0x2')]},'original_duration':{'type':Sequelize[_0x022e('0x4')]},'original_sampleCount':{'type':Sequelize[_0x022e('0x5')]},'original_channelCount':{'type':Sequelize[_0x022e('0x6')]},'original_bitRate':{'type':Sequelize[_0x022e('0x5')]},'original_sampleRate':{'type':Sequelize[_0x022e('0x6')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x022e('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x022e('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x022e('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x022e('0x6')]}}; \ No newline at end of file +var _0xfb1f=['INTEGER','STRING','name','FLOAT','BIGINT'];(function(_0x29ceb7,_0x464552){var _0x26e370=function(_0x44b53c){while(--_0x44b53c){_0x29ceb7['push'](_0x29ceb7['shift']());}};_0x26e370(++_0x464552);}(_0xfb1f,0x6a));var _0xffb1=function(_0x1debea,_0x4b9871){_0x1debea=_0x1debea-0x0;var _0x48371a=_0xfb1f[_0x1debea];return _0x48371a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xffb1('0x0')],'unique':_0xffb1('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0xffb1('0x0')]},'display_name':{'type':Sequelize[_0xffb1('0x0')],'defaultValue':''},'description':{'type':Sequelize[_0xffb1('0x0')]},'original_format':{'type':Sequelize[_0xffb1('0x0')]},'original_duration':{'type':Sequelize[_0xffb1('0x2')]},'original_sampleCount':{'type':Sequelize[_0xffb1('0x3')]},'original_channelCount':{'type':Sequelize[_0xffb1('0x4')]},'original_bitRate':{'type':Sequelize[_0xffb1('0x3')]},'original_sampleRate':{'type':Sequelize[_0xffb1('0x4')]},'converted_format':{'type':Sequelize[_0xffb1('0x0')]},'converted_duration':{'type':Sequelize[_0xffb1('0x2')]},'converted_sampleCount':{'type':Sequelize[_0xffb1('0x3')]},'converted_channelCount':{'type':Sequelize[_0xffb1('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xffb1('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 333904e..dab0702 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 _0xad3a=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Sounds','error','stack','index','map','Sound','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','name','options','includeAll','include','rows','catch','params','find','download','converted_format','existsSync','join','root','server/files/sounds/converted','save_name','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','filename','extname','substring','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','0777','transcode','wav','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_bitRate','converted_sampleRate','chmodSync','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','UserProfileResource','send','description','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xad3a,0x6a));var _0xaad3=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0xad3a[_0x412e27];return _0x53da42;};'use strict';var emlformat=require(_0xaad3('0x0'));var rimraf=require(_0xaad3('0x1'));var zipdir=require(_0xaad3('0x2'));var jsonpatch=require(_0xaad3('0x3'));var rp=require('request-promise');var moment=require(_0xaad3('0x4'));var BPromise=require(_0xaad3('0x5'));var Mustache=require('mustache');var util=require(_0xaad3('0x6'));var path=require('path');var sox=require(_0xaad3('0x7'));var csv=require(_0xaad3('0x8'));var ejs=require(_0xaad3('0x9'));var fs=require('fs');var fs_extra=require(_0xaad3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xaad3('0xb'));var deskjs=require(_0xaad3('0xc'));var toCsv=require('to-csv');var querystring=require(_0xaad3('0xd'));var Papa=require(_0xaad3('0xe'));var Redis=require(_0xaad3('0xf'));var authService=require(_0xaad3('0x10'));var qs=require(_0xaad3('0x11'));var as=require(_0xaad3('0x12'));var hardwareService=require(_0xaad3('0x13'));var logger=require(_0xaad3('0x14'))(_0xaad3('0x15'));var utils=require(_0xaad3('0x16'));var config=require(_0xaad3('0x17'));var licenseUtil=require(_0xaad3('0x18'));var db=require(_0xaad3('0x19'))['db'];function respondWithStatusCode(_0x39302a,_0x54b40f){_0x54b40f=_0x54b40f||0xcc;return function(_0x109d2a){if(_0x109d2a){return _0x39302a[_0xaad3('0x1a')](_0x54b40f);}return _0x39302a[_0xaad3('0x1b')](_0x54b40f)[_0xaad3('0x1c')]();};}function respondWithResult(_0x3c464c,_0x201cf6){_0x201cf6=_0x201cf6||0xc8;return function(_0x2c3ff0){if(_0x2c3ff0){return _0x3c464c[_0xaad3('0x1b')](_0x201cf6)[_0xaad3('0x1d')](_0x2c3ff0);}};}function respondWithFilteredResult(_0x1fe98c,_0x2e9dcc){return function(_0x10cd3b){if(_0x10cd3b){var _0x3245a9=typeof _0x2e9dcc[_0xaad3('0x1e')]===_0xaad3('0x1f')&&typeof _0x2e9dcc[_0xaad3('0x20')]===_0xaad3('0x1f');var _0xc4dc6d=_0x10cd3b[_0xaad3('0x21')];var _0x3f7d9f=_0x3245a9?0x0:_0x2e9dcc[_0xaad3('0x1e')];var _0xdcfcdd=_0x3245a9?_0x10cd3b[_0xaad3('0x21')]:_0x2e9dcc[_0xaad3('0x1e')]+_0x2e9dcc[_0xaad3('0x20')];var _0xfba245;if(_0xdcfcdd>=_0xc4dc6d){_0xdcfcdd=_0xc4dc6d;_0xfba245=0xc8;}else{_0xfba245=0xce;}_0x1fe98c[_0xaad3('0x1b')](_0xfba245);return _0x1fe98c[_0xaad3('0x22')](_0xaad3('0x23'),_0x3f7d9f+'-'+_0xdcfcdd+'/'+_0xc4dc6d)['json'](_0x10cd3b);}return null;};}function patchUpdates(_0x4f1247){return function(_0x31e938){try{jsonpatch[_0xaad3('0x24')](_0x31e938,_0x4f1247,!![]);}catch(_0x54d918){return BPromise[_0xaad3('0x25')](_0x54d918);}return _0x31e938[_0xaad3('0x26')]();};}function saveUpdates(_0x6ea247,_0x433f10){return function(_0x2ae19f){if(_0x2ae19f){return _0x2ae19f[_0xaad3('0x27')](_0x6ea247)['then'](function(_0x430b1a){return _0x430b1a;});}return null;};}function removeEntity(_0x38cd7e,_0x3f5c20){return function(_0x4a484e){if(_0x4a484e){return _0x4a484e[_0xaad3('0x28')]()[_0xaad3('0x29')](function(){var _0x5cea82=_0x4a484e[_0xaad3('0x2a')]({'plain':!![]});var _0x13fa57=_0xaad3('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x13fa57,'resourceId':_0x5cea82['id']}})['then'](function(){return _0x4a484e;});})[_0xaad3('0x29')](function(){_0x38cd7e[_0xaad3('0x1b')](0xcc)[_0xaad3('0x1c')]();});}};}function handleEntityNotFound(_0x518cb0,_0x52c9ff){return function(_0x54e4ce){if(!_0x54e4ce){_0x518cb0[_0xaad3('0x1a')](0x194);}return _0x54e4ce;};}function handleError(_0x63a81,_0x70757a){_0x70757a=_0x70757a||0x1f4;return function(_0x33a262){logger[_0xaad3('0x2c')](_0x33a262[_0xaad3('0x2d')]);if(_0x33a262['name']){delete _0x33a262['name'];}_0x63a81[_0xaad3('0x1b')](_0x70757a)['send'](_0x33a262);};}exports[_0xaad3('0x2e')]=function(_0x41504a,_0x202a5a){var _0x1916b4={},_0x2ec16f={},_0x5ce1f8={'count':0x0,'rows':[]};var _0x216d75=_[_0xaad3('0x2f')](db[_0xaad3('0x30')][_0xaad3('0x31')],function(_0x36d90c){return{'name':_0x36d90c[_0xaad3('0x32')],'type':_0x36d90c[_0xaad3('0x33')][_0xaad3('0x34')]};});_0x2ec16f['model']=_[_0xaad3('0x2f')](_0x216d75,'name');_0x2ec16f[_0xaad3('0x35')]=_[_0xaad3('0x36')](_0x41504a[_0xaad3('0x35')]);_0x2ec16f[_0xaad3('0x37')]=_['intersection'](_0x2ec16f[_0xaad3('0x38')],_0x2ec16f[_0xaad3('0x35')]);_0x1916b4[_0xaad3('0x39')]=_[_0xaad3('0x3a')](_0x2ec16f['model'],qs[_0xaad3('0x3b')](_0x41504a[_0xaad3('0x35')][_0xaad3('0x3b')]));_0x1916b4[_0xaad3('0x39')]=_0x1916b4[_0xaad3('0x39')][_0xaad3('0x3c')]?_0x1916b4[_0xaad3('0x39')]:_0x2ec16f[_0xaad3('0x38')];if(!_0x41504a[_0xaad3('0x35')]['hasOwnProperty'](_0xaad3('0x3d'))){_0x1916b4['limit']=qs[_0xaad3('0x20')](_0x41504a['query']['limit']);_0x1916b4['offset']=qs[_0xaad3('0x1e')](_0x41504a[_0xaad3('0x35')][_0xaad3('0x1e')]);}_0x1916b4[_0xaad3('0x3e')]=qs['sort'](_0x41504a['query'][_0xaad3('0x3f')]);_0x1916b4['where']=qs[_0xaad3('0x37')](_[_0xaad3('0x40')](_0x41504a[_0xaad3('0x35')],_0x2ec16f[_0xaad3('0x37')]),_0x216d75);if(_0x41504a[_0xaad3('0x35')][_0xaad3('0x41')]){_0x1916b4[_0xaad3('0x42')]=_[_0xaad3('0x43')](_0x1916b4[_0xaad3('0x42')],{'$or':_[_0xaad3('0x2f')](_0x216d75,function(_0x5ace43){if(_0x5ace43[_0xaad3('0x33')]!==_0xaad3('0x44')){var _0x59b665={};_0x59b665[_0x5ace43[_0xaad3('0x45')]]={'$like':'%'+_0x41504a[_0xaad3('0x35')]['filter']+'%'};return _0x59b665;}})});}_0x1916b4=_[_0xaad3('0x43')]({},_0x1916b4,_0x41504a[_0xaad3('0x46')]);var _0x444df5={'where':_0x1916b4[_0xaad3('0x42')]};return db[_0xaad3('0x30')][_0xaad3('0x21')](_0x444df5)[_0xaad3('0x29')](function(_0xbd93a4){_0x5ce1f8[_0xaad3('0x21')]=_0xbd93a4;if(_0x41504a[_0xaad3('0x35')][_0xaad3('0x47')]){_0x1916b4[_0xaad3('0x48')]=[{'all':!![]}];}return db[_0xaad3('0x30')]['findAll'](_0x1916b4);})['then'](function(_0x32bb21){_0x5ce1f8[_0xaad3('0x49')]=_0x32bb21;return _0x5ce1f8;})['then'](respondWithFilteredResult(_0x202a5a,_0x1916b4))[_0xaad3('0x4a')](handleError(_0x202a5a,null));};exports['show']=function(_0x13091d,_0x1461ba){var _0x1d8e46={'raw':!![],'where':{'id':_0x13091d[_0xaad3('0x4b')]['id']}},_0x41b248={};_0x41b248[_0xaad3('0x38')]=_[_0xaad3('0x36')](db[_0xaad3('0x30')][_0xaad3('0x31')]);_0x41b248['query']=_[_0xaad3('0x36')](_0x13091d[_0xaad3('0x35')]);_0x41b248[_0xaad3('0x37')]=_['intersection'](_0x41b248[_0xaad3('0x38')],_0x41b248[_0xaad3('0x35')]);_0x1d8e46[_0xaad3('0x39')]=_[_0xaad3('0x3a')](_0x41b248[_0xaad3('0x38')],qs[_0xaad3('0x3b')](_0x13091d[_0xaad3('0x35')]['fields']));_0x1d8e46[_0xaad3('0x39')]=_0x1d8e46['attributes'][_0xaad3('0x3c')]?_0x1d8e46['attributes']:_0x41b248[_0xaad3('0x38')];if(_0x13091d[_0xaad3('0x35')][_0xaad3('0x47')]){_0x1d8e46[_0xaad3('0x48')]=[{'all':!![]}];}_0x1d8e46=_['merge']({},_0x1d8e46,_0x13091d[_0xaad3('0x46')]);return db['Sound'][_0xaad3('0x4c')](_0x1d8e46)[_0xaad3('0x29')](handleEntityNotFound(_0x1461ba,null))[_0xaad3('0x29')](respondWithResult(_0x1461ba,null))['catch'](handleError(_0x1461ba,null));};exports[_0xaad3('0x4d')]=function(_0x2cf30d,_0x5415e2,_0x3df192){return db[_0xaad3('0x30')]['find']({'where':{'id':_0x2cf30d[_0xaad3('0x4b')]['id']},'attributes':[_0xaad3('0x45'),'save_name',_0xaad3('0x4e')],'raw':!![]})[_0xaad3('0x29')](handleEntityNotFound(_0x5415e2,null))[_0xaad3('0x29')](function(_0x5685d0){if(_0x5685d0){if(!fs[_0xaad3('0x4f')](path[_0xaad3('0x50')](config[_0xaad3('0x51')],_0xaad3('0x52'),_0x5685d0[_0xaad3('0x53')]+'.'+_0x5685d0[_0xaad3('0x4e')]))){throw new db[(_0xaad3('0x54'))][(_0xaad3('0x55'))](_0xaad3('0x56'));}return _0x5415e2[_0xaad3('0x4d')](path['join'](config[_0xaad3('0x51')],'server/files/sounds/converted',util[_0xaad3('0x57')]('%s.%s',_0x5685d0['save_name'],_0x5685d0[_0xaad3('0x4e')])),util[_0xaad3('0x57')](_0xaad3('0x58'),_0x5685d0['name'],_0x5685d0[_0xaad3('0x4e')]));}return null;})[_0xaad3('0x4a')](handleError(_0x5415e2,null));};exports[_0xaad3('0x59')]=function(_0x6c1f08,_0x1c6863,_0x46b8ba){var _0x235134={'name':path[_0xaad3('0x5a')](_0x6c1f08[_0xaad3('0x5b')][_0xaad3('0x5c')],path['extname'](_0x6c1f08[_0xaad3('0x5b')]['originalname'])),'save_name':path[_0xaad3('0x5a')](_0x6c1f08[_0xaad3('0x5b')][_0xaad3('0x5d')],path[_0xaad3('0x5e')](_0x6c1f08[_0xaad3('0x5b')][_0xaad3('0x5d')])),'original_format':path[_0xaad3('0x5e')](_0x6c1f08['file']['originalname'])[_0xaad3('0x5f')](0x1),'converted_format':'wav'};var _0x4276f7=path[_0xaad3('0x50')](config[_0xaad3('0x51')],_0xaad3('0x60'),_0x6c1f08['file'][_0xaad3('0x5d')]);var _0x30d49c=path[_0xaad3('0x50')](config[_0xaad3('0x51')],_0xaad3('0x52'),util['format'](_0xaad3('0x58'),path['basename'](_0x6c1f08[_0xaad3('0x5b')][_0xaad3('0x5d')],path[_0xaad3('0x5e')](_0x6c1f08[_0xaad3('0x5b')][_0xaad3('0x5d')])),_0x235134['converted_format']));logger[_0xaad3('0x61')]('Sound\x20upload\x20filepath:\x20%s',_0x4276f7);logger[_0xaad3('0x61')](_0xaad3('0x62'),_0x30d49c);try{fs['chmodSync'](_0x4276f7,parseInt(_0xaad3('0x63'),0x8));var _0x52cdd7=sox[_0xaad3('0x64')](_0x4276f7,_0x30d49c,{'sampleRate':0x1f40,'format':_0xaad3('0x65'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x52cdd7['on']('error',function(_0x3af230){fs[_0xaad3('0x66')](_0x4276f7);_0x1c6863[_0xaad3('0x1b')](0x1f4)['send'](_0x3af230);});_0x52cdd7['on']('src',function(_0xdf554d){_0x235134[_0xaad3('0x67')]=isNaN(_0xdf554d[_0xaad3('0x68')])?null:_0xdf554d[_0xaad3('0x68')]*0x3e8;_0x235134[_0xaad3('0x69')]=isNaN(_0xdf554d['sampleCount'])?null:_0xdf554d[_0xaad3('0x6a')];_0x235134[_0xaad3('0x6b')]=isNaN(_0xdf554d[_0xaad3('0x6c')])?null:_0xdf554d['channelCount'];_0x235134[_0xaad3('0x6d')]=isNaN(_0xdf554d['bitRate'])?null:_0xdf554d[_0xaad3('0x6e')];_0x235134[_0xaad3('0x6f')]=isNaN(_0xdf554d[_0xaad3('0x70')])?null:_0xdf554d['sampleRate'];});_0x52cdd7['on'](_0xaad3('0x71'),function(_0x5daf73){_0x235134['converted_duration']=isNaN(_0x5daf73[_0xaad3('0x68')])?null:_0x5daf73[_0xaad3('0x68')]*0x3e8;_0x235134['converted_sampleCount']=isNaN(_0x5daf73[_0xaad3('0x6a')])?null:_0x5daf73['sampleCount'];_0x235134['converted_channelCount']=isNaN(_0x5daf73['channelCount'])?null:_0x5daf73[_0xaad3('0x6c')];_0x235134[_0xaad3('0x72')]=isNaN(_0x5daf73[_0xaad3('0x6e')])?null:_0x5daf73['bitRate'];_0x235134[_0xaad3('0x73')]=isNaN(_0x5daf73['sampleRate'])?null:_0x5daf73['sampleRate'];});_0x52cdd7['on'](_0xaad3('0x1c'),function(){fs[_0xaad3('0x74')](_0x30d49c,parseInt('0777',0x8));return db[_0xaad3('0x30')][_0xaad3('0x59')](_0x235134)[_0xaad3('0x29')](function(_0xdc84af){var _0x3b7a1f={'role':_0x6c1f08[_0xaad3('0x75')][_0xaad3('0x76')],'userProfileId':_0x6c1f08[_0xaad3('0x75')][_0xaad3('0x77')]};if(!_0x3b7a1f)throw new Error(_0xaad3('0x78'));if(_0x3b7a1f['role']===_0xaad3('0x79')){var _0x5e2d87=_0xdc84af[_0xaad3('0x2a')]({'plain':!![]});return db['UserProfileSection'][_0xaad3('0x4c')]({'where':{'name':'Sounds','userProfileId':_0x3b7a1f[_0xaad3('0x77')]},'raw':!![]})[_0xaad3('0x29')](function(_0x255b06){if(_0x255b06&&_0x255b06[_0xaad3('0x7a')]===0x0){return db[_0xaad3('0x7b')][_0xaad3('0x59')]({'name':_0x5e2d87[_0xaad3('0x45')],'resourceId':_0x5e2d87['id'],'type':_0x255b06['name'],'sectionId':_0x255b06['id']},{})['then'](function(){return _0xdc84af;});}else{return _0xdc84af;}})['catch'](function(_0x32136e){logger[_0xaad3('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32136e);throw _0x32136e;});}return _0xdc84af;})[_0xaad3('0x29')](respondWithResult(_0x1c6863,null))[_0xaad3('0x4a')](handleError(_0x1c6863,null));});_0x52cdd7['start']();}catch(_0x1ee5df){_0x1c6863[_0xaad3('0x1b')](0x1f4)[_0xaad3('0x7c')](_0x1ee5df);}};exports[_0xaad3('0x27')]=function(_0x2dba33,_0x16b948,_0x54567d){return db[_0xaad3('0x30')][_0xaad3('0x4c')]({'where':{'id':_0x2dba33[_0xaad3('0x4b')]['id']}})[_0xaad3('0x29')](handleEntityNotFound(_0x16b948,null))[_0xaad3('0x29')](saveUpdates(_[_0xaad3('0x40')](_0x2dba33[_0xaad3('0x75')],[_0xaad3('0x45'),_0xaad3('0x7d')]),null))[_0xaad3('0x29')](respondWithResult(_0x16b948,null))[_0xaad3('0x4a')](handleError(_0x16b948,null));};exports[_0xaad3('0x7e')]=function(_0x5b8cea,_0x534cea,_0x3d1c71){return db[_0xaad3('0x30')][_0xaad3('0x4c')]({'where':{'id':_0x5b8cea['params']['id']}})['then'](function(_0x144ee2){if(_0x144ee2){return _0x144ee2[_0xaad3('0x28')]();}})['then'](function(_0x41c2d8){var _0x241f12=path[_0xaad3('0x50')](config[_0xaad3('0x51')],_0xaad3('0x60'),util[_0xaad3('0x57')](_0xaad3('0x58'),_0x41c2d8['save_name'],_0x41c2d8[_0xaad3('0x7f')]));var _0x399d8c=path[_0xaad3('0x50')](config[_0xaad3('0x51')],_0xaad3('0x52'),util['format']('%s.%s',_0x41c2d8[_0xaad3('0x53')],_0x41c2d8['converted_format']));fs[_0xaad3('0x66')](_0x241f12);fs[_0xaad3('0x66')](_0x399d8c);return _0x41c2d8;})[_0xaad3('0x29')](function(_0x14d820){if(_0x14d820){return _0x534cea['status'](0xcc)[_0xaad3('0x1c')]();}})[_0xaad3('0x29')](handleEntityNotFound(_0x534cea,null))[_0xaad3('0x4a')](handleError(_0x534cea,null));}; \ No newline at end of file +var _0x9892=['hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Sound','count','include','findAll','rows','catch','show','params','keys','includeAll','find','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','ValidationError','download','%s.%s','create','basename','originalname','extname','file','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','send','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','destroy','format','original_format','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','get','Sounds','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length'];(function(_0x2c01b5,_0x3927b6){var _0x4c4f86=function(_0xecd981){while(--_0xecd981){_0x2c01b5['push'](_0x2c01b5['shift']());}};_0x4c4f86(++_0x3927b6);}(_0x9892,0x14e));var _0x2989=function(_0x17f7d9,_0x550daf){_0x17f7d9=_0x17f7d9-0x0;var _0x178a78=_0x9892[_0x17f7d9];return _0x178a78;};'use strict';var emlformat=require(_0x2989('0x0'));var rimraf=require(_0x2989('0x1'));var zipdir=require(_0x2989('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2989('0x3'));var moment=require(_0x2989('0x4'));var BPromise=require(_0x2989('0x5'));var Mustache=require('mustache');var util=require(_0x2989('0x6'));var path=require(_0x2989('0x7'));var sox=require(_0x2989('0x8'));var csv=require(_0x2989('0x9'));var ejs=require(_0x2989('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2989('0xb'));var crypto=require('crypto');var jsforce=require(_0x2989('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2989('0x9'));var querystring=require(_0x2989('0xd'));var Papa=require(_0x2989('0xe'));var Redis=require('ioredis');var authService=require(_0x2989('0xf'));var qs=require(_0x2989('0x10'));var as=require(_0x2989('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2989('0x12'))(_0x2989('0x13'));var utils=require(_0x2989('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2989('0x15'));var db=require(_0x2989('0x16'))['db'];function respondWithStatusCode(_0x4a3bbf,_0x2a1173){_0x2a1173=_0x2a1173||0xcc;return function(_0x117c36){if(_0x117c36){return _0x4a3bbf[_0x2989('0x17')](_0x2a1173);}return _0x4a3bbf[_0x2989('0x18')](_0x2a1173)[_0x2989('0x19')]();};}function respondWithResult(_0x5564b7,_0xa481ce){_0xa481ce=_0xa481ce||0xc8;return function(_0x21088b){if(_0x21088b){return _0x5564b7[_0x2989('0x18')](_0xa481ce)[_0x2989('0x1a')](_0x21088b);}};}function respondWithFilteredResult(_0xe17460,_0x50bf15){return function(_0x4dc269){if(_0x4dc269){var _0x54b621=typeof _0x50bf15[_0x2989('0x1b')]===_0x2989('0x1c')&&typeof _0x50bf15[_0x2989('0x1d')]===_0x2989('0x1c');var _0x428cb1=_0x4dc269['count'];var _0x4a7cc0=_0x54b621?0x0:_0x50bf15[_0x2989('0x1b')];var _0x5e37eb=_0x54b621?_0x4dc269['count']:_0x50bf15['offset']+_0x50bf15[_0x2989('0x1d')];var _0xc4a48f;if(_0x5e37eb>=_0x428cb1){_0x5e37eb=_0x428cb1;_0xc4a48f=0xc8;}else{_0xc4a48f=0xce;}_0xe17460[_0x2989('0x18')](_0xc4a48f);return _0xe17460[_0x2989('0x1e')](_0x2989('0x1f'),_0x4a7cc0+'-'+_0x5e37eb+'/'+_0x428cb1)[_0x2989('0x1a')](_0x4dc269);}return null;};}function patchUpdates(_0x1a96c4){return function(_0x3f6743){try{jsonpatch['apply'](_0x3f6743,_0x1a96c4,!![]);}catch(_0x49e318){return BPromise[_0x2989('0x20')](_0x49e318);}return _0x3f6743[_0x2989('0x21')]();};}function saveUpdates(_0x253db5,_0x867c5b){return function(_0x3e7cc6){if(_0x3e7cc6){return _0x3e7cc6[_0x2989('0x22')](_0x253db5)[_0x2989('0x23')](function(_0x48db82){return _0x48db82;});}return null;};}function removeEntity(_0x3c3be4,_0x11d6ff){return function(_0x54348c){if(_0x54348c){return _0x54348c['destroy']()['then'](function(){var _0x381ff1=_0x54348c[_0x2989('0x24')]({'plain':!![]});var _0x540372=_0x2989('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x540372,'resourceId':_0x381ff1['id']}})[_0x2989('0x23')](function(){return _0x54348c;});})['then'](function(){_0x3c3be4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55a2cd,_0x34fd2d){return function(_0x5ade59){if(!_0x5ade59){_0x55a2cd[_0x2989('0x17')](0x194);}return _0x5ade59;};}function handleError(_0x2db1a8,_0x1b29fb){_0x1b29fb=_0x1b29fb||0x1f4;return function(_0x1c0f81){logger[_0x2989('0x26')](_0x1c0f81[_0x2989('0x27')]);if(_0x1c0f81[_0x2989('0x28')]){delete _0x1c0f81[_0x2989('0x28')];}_0x2db1a8[_0x2989('0x18')](_0x1b29fb)['send'](_0x1c0f81);};}exports[_0x2989('0x29')]=function(_0x370afe,_0x8e1de){var _0x565a49={},_0x2ffb2b={},_0x5916cc={'count':0x0,'rows':[]};var _0xc5729b=_[_0x2989('0x2a')](db['Sound'][_0x2989('0x2b')],function(_0x3e6e0a){return{'name':_0x3e6e0a[_0x2989('0x2c')],'type':_0x3e6e0a[_0x2989('0x2d')][_0x2989('0x2e')]};});_0x2ffb2b[_0x2989('0x2f')]=_[_0x2989('0x2a')](_0xc5729b,_0x2989('0x28'));_0x2ffb2b[_0x2989('0x30')]=_['keys'](_0x370afe['query']);_0x2ffb2b['filters']=_[_0x2989('0x31')](_0x2ffb2b[_0x2989('0x2f')],_0x2ffb2b['query']);_0x565a49['attributes']=_[_0x2989('0x31')](_0x2ffb2b[_0x2989('0x2f')],qs[_0x2989('0x32')](_0x370afe[_0x2989('0x30')][_0x2989('0x32')]));_0x565a49['attributes']=_0x565a49[_0x2989('0x33')][_0x2989('0x34')]?_0x565a49[_0x2989('0x33')]:_0x2ffb2b[_0x2989('0x2f')];if(!_0x370afe[_0x2989('0x30')][_0x2989('0x35')]('nolimit')){_0x565a49[_0x2989('0x1d')]=qs[_0x2989('0x1d')](_0x370afe[_0x2989('0x30')]['limit']);_0x565a49[_0x2989('0x1b')]=qs[_0x2989('0x1b')](_0x370afe[_0x2989('0x30')][_0x2989('0x1b')]);}_0x565a49[_0x2989('0x36')]=qs['sort'](_0x370afe[_0x2989('0x30')][_0x2989('0x37')]);_0x565a49[_0x2989('0x38')]=qs[_0x2989('0x39')](_[_0x2989('0x3a')](_0x370afe[_0x2989('0x30')],_0x2ffb2b['filters']),_0xc5729b);if(_0x370afe[_0x2989('0x30')][_0x2989('0x3b')]){_0x565a49[_0x2989('0x38')]=_[_0x2989('0x3c')](_0x565a49['where'],{'$or':_[_0x2989('0x2a')](_0xc5729b,function(_0xf4960b){if(_0xf4960b['type']!==_0x2989('0x3d')){var _0x4f5d51={};_0x4f5d51[_0xf4960b[_0x2989('0x28')]]={'$like':'%'+_0x370afe['query'][_0x2989('0x3b')]+'%'};return _0x4f5d51;}})});}_0x565a49=_[_0x2989('0x3c')]({},_0x565a49,_0x370afe[_0x2989('0x3e')]);var _0x3f5ceb={'where':_0x565a49[_0x2989('0x38')]};return db[_0x2989('0x3f')][_0x2989('0x40')](_0x3f5ceb)[_0x2989('0x23')](function(_0x4eb8b8){_0x5916cc[_0x2989('0x40')]=_0x4eb8b8;if(_0x370afe[_0x2989('0x30')]['includeAll']){_0x565a49[_0x2989('0x41')]=[{'all':!![]}];}return db['Sound'][_0x2989('0x42')](_0x565a49);})['then'](function(_0x10fcba){_0x5916cc[_0x2989('0x43')]=_0x10fcba;return _0x5916cc;})[_0x2989('0x23')](respondWithFilteredResult(_0x8e1de,_0x565a49))[_0x2989('0x44')](handleError(_0x8e1de,null));};exports[_0x2989('0x45')]=function(_0x23f86d,_0x2edc3e){var _0x4b7bdc={'raw':!![],'where':{'id':_0x23f86d[_0x2989('0x46')]['id']}},_0x522995={};_0x522995[_0x2989('0x2f')]=_['keys'](db[_0x2989('0x3f')][_0x2989('0x2b')]);_0x522995['query']=_[_0x2989('0x47')](_0x23f86d['query']);_0x522995[_0x2989('0x39')]=_[_0x2989('0x31')](_0x522995[_0x2989('0x2f')],_0x522995[_0x2989('0x30')]);_0x4b7bdc[_0x2989('0x33')]=_[_0x2989('0x31')](_0x522995[_0x2989('0x2f')],qs[_0x2989('0x32')](_0x23f86d[_0x2989('0x30')][_0x2989('0x32')]));_0x4b7bdc[_0x2989('0x33')]=_0x4b7bdc[_0x2989('0x33')]['length']?_0x4b7bdc[_0x2989('0x33')]:_0x522995[_0x2989('0x2f')];if(_0x23f86d[_0x2989('0x30')][_0x2989('0x48')]){_0x4b7bdc['include']=[{'all':!![]}];}_0x4b7bdc=_['merge']({},_0x4b7bdc,_0x23f86d[_0x2989('0x3e')]);return db[_0x2989('0x3f')]['find'](_0x4b7bdc)[_0x2989('0x23')](handleEntityNotFound(_0x2edc3e,null))['then'](respondWithResult(_0x2edc3e,null))[_0x2989('0x44')](handleError(_0x2edc3e,null));};exports['download']=function(_0x24954c,_0x5f3846,_0x3ae193){return db[_0x2989('0x3f')][_0x2989('0x49')]({'where':{'id':_0x24954c[_0x2989('0x46')]['id']},'attributes':['name',_0x2989('0x4a'),_0x2989('0x4b')],'raw':!![]})[_0x2989('0x23')](handleEntityNotFound(_0x5f3846,null))[_0x2989('0x23')](function(_0x3c80d2){if(_0x3c80d2){if(!fs['existsSync'](path[_0x2989('0x4c')](config[_0x2989('0x4d')],_0x2989('0x4e'),_0x3c80d2[_0x2989('0x4a')]+'.'+_0x3c80d2['converted_format']))){throw new db[(_0x2989('0x4f'))][(_0x2989('0x50'))]('Sound\x20not\x20found');}return _0x5f3846[_0x2989('0x51')](path[_0x2989('0x4c')](config['root'],_0x2989('0x4e'),util['format'](_0x2989('0x52'),_0x3c80d2['save_name'],_0x3c80d2[_0x2989('0x4b')])),util['format'](_0x2989('0x52'),_0x3c80d2[_0x2989('0x28')],_0x3c80d2['converted_format']));}return null;})[_0x2989('0x44')](handleError(_0x5f3846,null));};exports[_0x2989('0x53')]=function(_0x5e234e,_0x2ded08,_0x29de90){var _0x373732={'name':path[_0x2989('0x54')](_0x5e234e['file'][_0x2989('0x55')],path[_0x2989('0x56')](_0x5e234e[_0x2989('0x57')][_0x2989('0x55')])),'save_name':path[_0x2989('0x54')](_0x5e234e[_0x2989('0x57')][_0x2989('0x58')],path['extname'](_0x5e234e[_0x2989('0x57')][_0x2989('0x58')])),'original_format':path[_0x2989('0x56')](_0x5e234e[_0x2989('0x57')][_0x2989('0x55')])[_0x2989('0x59')](0x1),'converted_format':_0x2989('0x5a')};var _0x245730=path[_0x2989('0x4c')](config[_0x2989('0x4d')],_0x2989('0x5b'),_0x5e234e['file'][_0x2989('0x58')]);var _0x3c2fff=path[_0x2989('0x4c')](config[_0x2989('0x4d')],_0x2989('0x4e'),util['format'](_0x2989('0x52'),path[_0x2989('0x54')](_0x5e234e['file'][_0x2989('0x58')],path[_0x2989('0x56')](_0x5e234e[_0x2989('0x57')][_0x2989('0x58')])),_0x373732[_0x2989('0x4b')]));logger[_0x2989('0x5c')](_0x2989('0x5d'),_0x245730);logger[_0x2989('0x5c')](_0x2989('0x5e'),_0x3c2fff);try{fs[_0x2989('0x5f')](_0x245730,parseInt(_0x2989('0x60'),0x8));var _0x5dd9ea=sox[_0x2989('0x61')](_0x245730,_0x3c2fff,{'sampleRate':0x1f40,'format':_0x2989('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5dd9ea['on'](_0x2989('0x26'),function(_0x593282){fs['unlinkSync'](_0x245730);_0x2ded08[_0x2989('0x18')](0x1f4)[_0x2989('0x62')](_0x593282);});_0x5dd9ea['on'](_0x2989('0x63'),function(_0x498495){_0x373732[_0x2989('0x64')]=isNaN(_0x498495[_0x2989('0x65')])?null:_0x498495[_0x2989('0x65')]*0x3e8;_0x373732[_0x2989('0x66')]=isNaN(_0x498495[_0x2989('0x67')])?null:_0x498495[_0x2989('0x67')];_0x373732[_0x2989('0x68')]=isNaN(_0x498495['channelCount'])?null:_0x498495[_0x2989('0x69')];_0x373732['original_bitRate']=isNaN(_0x498495['bitRate'])?null:_0x498495[_0x2989('0x6a')];_0x373732[_0x2989('0x6b')]=isNaN(_0x498495['sampleRate'])?null:_0x498495[_0x2989('0x6c')];});_0x5dd9ea['on'](_0x2989('0x6d'),function(_0x44be51){_0x373732['converted_duration']=isNaN(_0x44be51[_0x2989('0x65')])?null:_0x44be51[_0x2989('0x65')]*0x3e8;_0x373732[_0x2989('0x6e')]=isNaN(_0x44be51['sampleCount'])?null:_0x44be51['sampleCount'];_0x373732[_0x2989('0x6f')]=isNaN(_0x44be51['channelCount'])?null:_0x44be51[_0x2989('0x69')];_0x373732[_0x2989('0x70')]=isNaN(_0x44be51['bitRate'])?null:_0x44be51[_0x2989('0x6a')];_0x373732[_0x2989('0x71')]=isNaN(_0x44be51[_0x2989('0x6c')])?null:_0x44be51[_0x2989('0x6c')];});_0x5dd9ea['on'](_0x2989('0x19'),function(){fs[_0x2989('0x5f')](_0x3c2fff,parseInt(_0x2989('0x60'),0x8));return db[_0x2989('0x3f')][_0x2989('0x53')](_0x373732)[_0x2989('0x23')](function(_0x377fb5){var _0x390d78={'role':_0x5e234e[_0x2989('0x72')][_0x2989('0x73')],'userProfileId':_0x5e234e[_0x2989('0x72')][_0x2989('0x74')]};if(!_0x390d78)throw new Error(_0x2989('0x75'));if(_0x390d78[_0x2989('0x73')]===_0x2989('0x76')){var _0x2b37c2=_0x377fb5[_0x2989('0x24')]({'plain':!![]});return db[_0x2989('0x77')][_0x2989('0x49')]({'where':{'name':_0x2989('0x25'),'userProfileId':_0x390d78['userProfileId']},'raw':!![]})[_0x2989('0x23')](function(_0x10e73e){if(_0x10e73e&&_0x10e73e['autoAssociation']===0x0){return db[_0x2989('0x78')][_0x2989('0x53')]({'name':_0x2b37c2[_0x2989('0x28')],'resourceId':_0x2b37c2['id'],'type':_0x10e73e[_0x2989('0x28')],'sectionId':_0x10e73e['id']},{})[_0x2989('0x23')](function(){return _0x377fb5;});}else{return _0x377fb5;}})['catch'](function(_0x1698fe){logger[_0x2989('0x26')](_0x2989('0x79'),_0x1698fe);throw _0x1698fe;});}return _0x377fb5;})['then'](respondWithResult(_0x2ded08,null))[_0x2989('0x44')](handleError(_0x2ded08,null));});_0x5dd9ea[_0x2989('0x7a')]();}catch(_0x510f8c){_0x2ded08[_0x2989('0x18')](0x1f4)[_0x2989('0x62')](_0x510f8c);}};exports[_0x2989('0x22')]=function(_0x316132,_0x472970,_0x3daa34){return db[_0x2989('0x3f')][_0x2989('0x49')]({'where':{'id':_0x316132[_0x2989('0x46')]['id']}})[_0x2989('0x23')](handleEntityNotFound(_0x472970,null))[_0x2989('0x23')](saveUpdates(_[_0x2989('0x3a')](_0x316132[_0x2989('0x72')],[_0x2989('0x28'),_0x2989('0x7b')]),null))[_0x2989('0x23')](respondWithResult(_0x472970,null))[_0x2989('0x44')](handleError(_0x472970,null));};exports[_0x2989('0x7c')]=function(_0x242fae,_0x3bea2d,_0x349190){return db[_0x2989('0x3f')][_0x2989('0x49')]({'where':{'id':_0x242fae[_0x2989('0x46')]['id']}})['then'](function(_0x5d9484){if(_0x5d9484){return _0x5d9484[_0x2989('0x7d')]();}})[_0x2989('0x23')](function(_0x4e64c6){var _0x1b21cb=path[_0x2989('0x4c')](config[_0x2989('0x4d')],'server/files/sounds/original',util[_0x2989('0x7e')](_0x2989('0x52'),_0x4e64c6[_0x2989('0x4a')],_0x4e64c6[_0x2989('0x7f')]));var _0x2ae0e2=path[_0x2989('0x4c')](config[_0x2989('0x4d')],_0x2989('0x4e'),util[_0x2989('0x7e')](_0x2989('0x52'),_0x4e64c6[_0x2989('0x4a')],_0x4e64c6[_0x2989('0x4b')]));fs[_0x2989('0x80')](_0x1b21cb);fs[_0x2989('0x80')](_0x2ae0e2);return _0x4e64c6;})['then'](function(_0x402d99){if(_0x402d99){return _0x3bea2d[_0x2989('0x18')](0xcc)[_0x2989('0x19')]();}})['then'](handleEntityNotFound(_0x3bea2d,null))[_0x2989('0x44')](handleError(_0x3bea2d,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 5d7dd34..8563e65 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 _0x0ad1=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','Sound','tools_sounds','util','../../config/logger'];(function(_0x5528ad,_0x10a077){var _0x55001a=function(_0x111d24){while(--_0x111d24){_0x5528ad['push'](_0x5528ad['shift']());}};_0x55001a(++_0x10a077);}(_0x0ad1,0x6a));var _0x10ad=function(_0x2311d3,_0x405d5b){_0x2311d3=_0x2311d3-0x0;var _0x473601=_0x0ad1[_0x2311d3];return _0x473601;};'use strict';var _=require('lodash');var util=require(_0x10ad('0x0'));var logger=require(_0x10ad('0x1'))(_0x10ad('0x2'));var moment=require(_0x10ad('0x3'));var BPromise=require(_0x10ad('0x4'));var rp=require(_0x10ad('0x5'));var fs=require('fs');var path=require(_0x10ad('0x6'));var rimraf=require(_0x10ad('0x7'));var config=require(_0x10ad('0x8'));var attributes=require(_0x10ad('0x9'));module['exports']=function(_0x15d609,_0x2e1d5c){return _0x15d609['define'](_0x10ad('0xa'),attributes,{'tableName':_0x10ad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdc1=['api','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','tools_sounds','lodash','../../config/logger'];(function(_0x393c66,_0xe4c493){var _0x212796=function(_0x3a3df9){while(--_0x3a3df9){_0x393c66['push'](_0x393c66['shift']());}};_0x212796(++_0xe4c493);}(_0xfdc1,0xfa));var _0x1fdc=function(_0x2fcf18,_0x10009a){_0x2fcf18=_0x2fcf18-0x0;var _0x4c68cc=_0xfdc1[_0x2fcf18];return _0x4c68cc;};'use strict';var _=require(_0x1fdc('0x0'));var util=require('util');var logger=require(_0x1fdc('0x1'))(_0x1fdc('0x2'));var moment=require('moment');var BPromise=require(_0x1fdc('0x3'));var rp=require(_0x1fdc('0x4'));var fs=require('fs');var path=require(_0x1fdc('0x5'));var rimraf=require(_0x1fdc('0x6'));var config=require(_0x1fdc('0x7'));var attributes=require(_0x1fdc('0x8'));module[_0x1fdc('0x9')]=function(_0x12aa51,_0x15fc8e){return _0x12aa51[_0x1fdc('0xa')]('Sound',attributes,{'tableName':_0x1fdc('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 df2334d..cd5ad87 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 _0x19d6=['options','raw','where','attributes','include','map','model','ShowSound','util','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','Sound','find'];(function(_0x475eac,_0x2fa495){var _0x4ad158=function(_0x2d7c4c){while(--_0x2d7c4c){_0x475eac['push'](_0x475eac['shift']());}};_0x4ad158(++_0x2fa495);}(_0x19d6,0xb6));var _0x619d=function(_0x5864d9,_0x4ea69c){_0x5864d9=_0x5864d9-0x0;var _0x27ad48=_0x19d6[_0x5864d9];return _0x27ad48;};'use strict';var _=require('lodash');var util=require(_0x619d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x619d('0x1'));var fs=require('fs');var Redis=require(_0x619d('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x619d('0x3'))(_0x619d('0x4'));var config=require('../../config/environment');var jayson=require(_0x619d('0x5'));var client=jayson[_0x619d('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3db151,_0x14a565,_0x2f9726){return new BPromise(function(_0xa50cdc,_0x3969c0){return client[_0x619d('0x7')](_0x3db151,_0x2f9726)[_0x619d('0x8')](function(_0x26df76){logger[_0x619d('0x9')](_0x619d('0xa'),_0x14a565,_0x619d('0xb'));logger[_0x619d('0xc')]('Sound,\x20%s,\x20%s,\x20%s',_0x14a565,_0x619d('0xb'),JSON[_0x619d('0xd')](_0x26df76));if(_0x26df76[_0x619d('0xe')]){if(_0x26df76[_0x619d('0xe')][_0x619d('0xf')]===0x1f4){logger[_0x619d('0xe')](_0x619d('0xa'),_0x14a565,_0x26df76[_0x619d('0xe')][_0x619d('0x10')]);return _0x3969c0(_0x26df76[_0x619d('0xe')][_0x619d('0x10')]);}logger['error'](_0x619d('0xa'),_0x14a565,_0x26df76['error'][_0x619d('0x10')]);return _0xa50cdc(_0x26df76[_0x619d('0xe')][_0x619d('0x10')]);}else{logger['info'](_0x619d('0xa'),_0x14a565,_0x619d('0xb'));_0xa50cdc(_0x26df76[_0x619d('0x11')]['message']);}})[_0x619d('0x12')](function(_0x211033){logger[_0x619d('0xe')](_0x619d('0xa'),_0x14a565,_0x211033);_0x3969c0(_0x211033);});});}exports['ShowSound']=function(_0x55c03b){var _0x1228ed=this;return new Promise(function(_0x3a6c3d,_0x3d65ca){return db[_0x619d('0x13')][_0x619d('0x14')]({'raw':_0x55c03b[_0x619d('0x15')]?_0x55c03b[_0x619d('0x15')][_0x619d('0x16')]===undefined?!![]:![]:!![],'where':_0x55c03b[_0x619d('0x15')]?_0x55c03b[_0x619d('0x15')][_0x619d('0x17')]||null:null,'attributes':_0x55c03b[_0x619d('0x15')]?_0x55c03b[_0x619d('0x15')][_0x619d('0x18')]||null:null,'include':_0x55c03b['options']?_0x55c03b['options'][_0x619d('0x19')]?_[_0x619d('0x1a')](_0x55c03b[_0x619d('0x15')][_0x619d('0x19')],function(_0x31e7d9){return{'model':db[_0x31e7d9[_0x619d('0x1b')]],'as':_0x31e7d9['as'],'attributes':_0x31e7d9[_0x619d('0x18')],'include':_0x31e7d9[_0x619d('0x19')]?_['map'](_0x31e7d9[_0x619d('0x19')],function(_0x107a05){return{'model':db[_0x107a05[_0x619d('0x1b')]],'as':_0x107a05['as'],'attributes':_0x107a05[_0x619d('0x18')],'include':_0x107a05['include']?_[_0x619d('0x1a')](_0x107a05['include'],function(_0x315803){return{'model':db[_0x315803[_0x619d('0x1b')]],'as':_0x315803['as'],'attributes':_0x315803['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x33ea28){logger[_0x619d('0x9')](_0x619d('0x1c'),_0x55c03b);logger[_0x619d('0xc')](_0x619d('0x1c'),_0x55c03b,JSON[_0x619d('0xd')](_0x33ea28));_0x3a6c3d(_0x33ea28);})['catch'](function(_0x2f2e22){logger[_0x619d('0xe')](_0x619d('0x1c'),_0x2f2e22['message'],_0x55c03b);_0x3d65ca(_0x1228ed['error'](0x1f4,_0x2f2e22[_0x619d('0x10')]));});});}; \ No newline at end of file +var _0x0ca0=['../../config/environment','jayson/promise','http','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ShowSound','find','options','raw','where','attributes','map','include','model','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x142020,_0x1f7233){var _0x40da8f=function(_0x17f0a3){while(--_0x17f0a3){_0x142020['push'](_0x142020['shift']());}};_0x40da8f(++_0x1f7233);}(_0x0ca0,0x86));var _0x00ca=function(_0x3a1977,_0x2dbd67){_0x3a1977=_0x3a1977-0x0;var _0x1353cc=_0x0ca0[_0x3a1977];return _0x1353cc;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x00ca('0x0'));var fs=require('fs');var Redis=require(_0x00ca('0x1'));var db=require(_0x00ca('0x2'))['db'];var utils=require(_0x00ca('0x3'));var logger=require(_0x00ca('0x4'))(_0x00ca('0x5'));var config=require(_0x00ca('0x6'));var jayson=require(_0x00ca('0x7'));var client=jayson['client'][_0x00ca('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x32a133,_0x577594,_0x3770cb){return new BPromise(function(_0x37dd8d,_0x1736b5){return client['request'](_0x32a133,_0x3770cb)[_0x00ca('0x9')](function(_0x14add1){logger[_0x00ca('0xa')](_0x00ca('0xb'),_0x577594,_0x00ca('0xc'));logger[_0x00ca('0xd')](_0x00ca('0xe'),_0x577594,_0x00ca('0xc'),JSON[_0x00ca('0xf')](_0x14add1));if(_0x14add1[_0x00ca('0x10')]){if(_0x14add1['error']['code']===0x1f4){logger['error'](_0x00ca('0xb'),_0x577594,_0x14add1['error']['message']);return _0x1736b5(_0x14add1['error']['message']);}logger[_0x00ca('0x10')](_0x00ca('0xb'),_0x577594,_0x14add1[_0x00ca('0x10')]['message']);return _0x37dd8d(_0x14add1[_0x00ca('0x10')][_0x00ca('0x11')]);}else{logger[_0x00ca('0xa')]('Sound,\x20%s,\x20%s',_0x577594,_0x00ca('0xc'));_0x37dd8d(_0x14add1['result']['message']);}})[_0x00ca('0x12')](function(_0x59eee1){logger[_0x00ca('0x10')]('Sound,\x20%s,\x20%s',_0x577594,_0x59eee1);_0x1736b5(_0x59eee1);});});}exports[_0x00ca('0x13')]=function(_0x1fd96e){var _0x3542f5=this;return new Promise(function(_0x48ef25,_0x3fbf52){return db['Sound'][_0x00ca('0x14')]({'raw':_0x1fd96e[_0x00ca('0x15')]?_0x1fd96e[_0x00ca('0x15')][_0x00ca('0x16')]===undefined?!![]:![]:!![],'where':_0x1fd96e[_0x00ca('0x15')]?_0x1fd96e[_0x00ca('0x15')][_0x00ca('0x17')]||null:null,'attributes':_0x1fd96e[_0x00ca('0x15')]?_0x1fd96e[_0x00ca('0x15')][_0x00ca('0x18')]||null:null,'include':_0x1fd96e[_0x00ca('0x15')]?_0x1fd96e[_0x00ca('0x15')]['include']?_[_0x00ca('0x19')](_0x1fd96e[_0x00ca('0x15')][_0x00ca('0x1a')],function(_0x252bb0){return{'model':db[_0x252bb0[_0x00ca('0x1b')]],'as':_0x252bb0['as'],'attributes':_0x252bb0[_0x00ca('0x18')],'include':_0x252bb0[_0x00ca('0x1a')]?_[_0x00ca('0x19')](_0x252bb0[_0x00ca('0x1a')],function(_0x51dcb0){return{'model':db[_0x51dcb0[_0x00ca('0x1b')]],'as':_0x51dcb0['as'],'attributes':_0x51dcb0['attributes'],'include':_0x51dcb0['include']?_['map'](_0x51dcb0[_0x00ca('0x1a')],function(_0x355c33){return{'model':db[_0x355c33['model']],'as':_0x355c33['as'],'attributes':_0x355c33[_0x00ca('0x18')]};}):[]};}):[]};}):[]:[]})[_0x00ca('0x9')](function(_0xa51e37){logger[_0x00ca('0xa')](_0x00ca('0x13'),_0x1fd96e);logger[_0x00ca('0xd')](_0x00ca('0x13'),_0x1fd96e,JSON[_0x00ca('0xf')](_0xa51e37));_0x48ef25(_0xa51e37);})[_0x00ca('0x12')](function(_0x506436){logger[_0x00ca('0x10')](_0x00ca('0x13'),_0x506436[_0x00ca('0x11')],_0x1fd96e);_0x3fbf52(_0x3542f5[_0x00ca('0x10')](0x1f4,_0x506436['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index f3828e0..6648811 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 _0x757a=['destroy','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete'];(function(_0xde92c8,_0x24e8df){var _0x232515=function(_0x34ce95){while(--_0x34ce95){_0xde92c8['push'](_0xde92c8['shift']());}};_0x232515(++_0x24e8df);}(_0x757a,0xde));var _0xa757=function(_0x1450ad,_0x1e4c58){_0x1450ad=_0x1450ad-0x0;var _0x58db4e=_0x757a[_0x1450ad];return _0x58db4e;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0xb')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xc')]);router['put'](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0x10')]);module['exports']=router; \ No newline at end of file +var _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareMessage.controller'];(function(_0x435fed,_0x4009ec){var _0x2c6ab9=function(_0x10e812){while(--_0x10e812){_0x435fed['push'](_0x435fed['shift']());}};_0x2c6ab9(++_0x4009ec);}(_0x14a0,0x8e));var _0x014a=function(_0xc297bc,_0x2aed50){_0xc297bc=_0xc297bc-0x0;var _0xed03d3=_0x14a0[_0xc297bc];return _0xed03d3;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x014a('0xd')]('/:id',auth[_0x014a('0x9')](),controller[_0x014a('0xe')]);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 28bb058..b5e385b 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 _0x9032=['TEXT','medium','ENUM','out','sequelize','exports','STRING'];(function(_0x53dcb8,_0x550e86){var _0x3751cd=function(_0x5e23ab){while(--_0x5e23ab){_0x53dcb8['push'](_0x53dcb8['shift']());}};_0x3751cd(++_0x550e86);}(_0x9032,0xf2));var _0x2903=function(_0x3d3b65,_0x4bc090){_0x3d3b65=_0x3d3b65-0x0;var _0x4b484e=_0x9032[_0x3d3b65];return _0x4b484e;};'use strict';var Sequelize=require(_0x2903('0x0'));module[_0x2903('0x1')]={'uniqueid':{'type':Sequelize[_0x2903('0x2')]},'body':{'type':Sequelize[_0x2903('0x3')](_0x2903('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x2903('0x5')]('in',_0x2903('0x6')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x2903('0x2')]},'providerResponse':{'type':Sequelize[_0x2903('0x3')]}}; \ No newline at end of file +var _0xcc1e=['TEXT','medium','ENUM','sequelize','STRING'];(function(_0x426634,_0x1bbe11){var _0x1570f1=function(_0x538b7e){while(--_0x538b7e){_0x426634['push'](_0x426634['shift']());}};_0x1570f1(++_0x1bbe11);}(_0xcc1e,0xd0));var _0xecc1=function(_0x5b0837,_0x4820be){_0x5b0837=_0x5b0837-0x0;var _0x143220=_0xcc1e[_0x5b0837];return _0x143220;};'use strict';var Sequelize=require(_0xecc1('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xecc1('0x1')]},'body':{'type':Sequelize[_0xecc1('0x2')](_0xecc1('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xecc1('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xecc1('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index f1289b3..a2f792b 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 _0x3140=['attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','reject','update','then','destroy','end','stack','index','SquareMessage','rawAttributes','model','map','name','query','keys','filters','intersection'];(function(_0x29483a,_0x25ce96){var _0x335089=function(_0x246fe9){while(--_0x246fe9){_0x29483a['push'](_0x29483a['shift']());}};_0x335089(++_0x25ce96);}(_0x3140,0xee));var _0x0314=function(_0x32f3d0,_0x18caa6){_0x32f3d0=_0x32f3d0-0x0;var _0x3cfb65=_0x3140[_0x32f3d0];return _0x3cfb65;};'use strict';var emlformat=require(_0x0314('0x0'));var rimraf=require(_0x0314('0x1'));var zipdir=require(_0x0314('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0314('0x3'));var moment=require(_0x0314('0x4'));var BPromise=require(_0x0314('0x5'));var Mustache=require(_0x0314('0x6'));var util=require(_0x0314('0x7'));var path=require(_0x0314('0x8'));var sox=require(_0x0314('0x9'));var csv=require(_0x0314('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0314('0xb'));var _=require(_0x0314('0xc'));var squel=require(_0x0314('0xd'));var crypto=require(_0x0314('0xe'));var jsforce=require(_0x0314('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0314('0xa'));var querystring=require('querystring');var Papa=require(_0x0314('0x10'));var Redis=require(_0x0314('0x11'));var authService=require(_0x0314('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0314('0x13'));var hardwareService=require(_0x0314('0x14'));var logger=require(_0x0314('0x15'))(_0x0314('0x16'));var utils=require(_0x0314('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0314('0x18'));var db=require(_0x0314('0x19'))['db'];function respondWithStatusCode(_0x192a28,_0x181feb){_0x181feb=_0x181feb||0xcc;return function(_0x2a9f94){if(_0x2a9f94){return _0x192a28[_0x0314('0x1a')](_0x181feb);}return _0x192a28[_0x0314('0x1b')](_0x181feb)['end']();};}function respondWithResult(_0x34b9c4,_0x40711a){_0x40711a=_0x40711a||0xc8;return function(_0x2e4791){if(_0x2e4791){return _0x34b9c4[_0x0314('0x1b')](_0x40711a)[_0x0314('0x1c')](_0x2e4791);}};}function respondWithFilteredResult(_0x3a7799,_0x10ef70){return function(_0x3bb321){if(_0x3bb321){var _0x17bcde=typeof _0x10ef70['offset']===_0x0314('0x1d')&&typeof _0x10ef70[_0x0314('0x1e')]==='undefined';var _0x430d1a=_0x3bb321['count'];var _0x3500a8=_0x17bcde?0x0:_0x10ef70[_0x0314('0x1f')];var _0x2f5a9f=_0x17bcde?_0x3bb321[_0x0314('0x20')]:_0x10ef70[_0x0314('0x1f')]+_0x10ef70[_0x0314('0x1e')];var _0x4878e2;if(_0x2f5a9f>=_0x430d1a){_0x2f5a9f=_0x430d1a;_0x4878e2=0xc8;}else{_0x4878e2=0xce;}_0x3a7799[_0x0314('0x1b')](_0x4878e2);return _0x3a7799[_0x0314('0x21')]('Content-Range',_0x3500a8+'-'+_0x2f5a9f+'/'+_0x430d1a)[_0x0314('0x1c')](_0x3bb321);}return null;};}function patchUpdates(_0x2e429e){return function(_0x545226){try{jsonpatch['apply'](_0x545226,_0x2e429e,!![]);}catch(_0x1fb214){return BPromise[_0x0314('0x22')](_0x1fb214);}return _0x545226['save']();};}function saveUpdates(_0x5958f6,_0x479c68){return function(_0x199b20){if(_0x199b20){return _0x199b20[_0x0314('0x23')](_0x5958f6)[_0x0314('0x24')](function(_0x5cd021){return _0x5cd021;});}return null;};}function removeEntity(_0x319e9d,_0x5298f8){return function(_0x502166){if(_0x502166){return _0x502166[_0x0314('0x25')]()[_0x0314('0x24')](function(){_0x319e9d[_0x0314('0x1b')](0xcc)[_0x0314('0x26')]();});}};}function handleEntityNotFound(_0x17eef1,_0x287d90){return function(_0x392189){if(!_0x392189){_0x17eef1[_0x0314('0x1a')](0x194);}return _0x392189;};}function handleError(_0x2afd67,_0x3766c6){_0x3766c6=_0x3766c6||0x1f4;return function(_0x55127a){logger['error'](_0x55127a[_0x0314('0x27')]);if(_0x55127a['name']){delete _0x55127a['name'];}_0x2afd67[_0x0314('0x1b')](_0x3766c6)['send'](_0x55127a);};}exports[_0x0314('0x28')]=function(_0x369a89,_0x5ac920){var _0x168cca={},_0x1efb37={},_0x4a85cd={'count':0x0,'rows':[]};var _0x1f890d=_['map'](db[_0x0314('0x29')][_0x0314('0x2a')],function(_0x13dc3f){return{'name':_0x13dc3f['fieldName'],'type':_0x13dc3f['type']['key']};});_0x1efb37[_0x0314('0x2b')]=_[_0x0314('0x2c')](_0x1f890d,_0x0314('0x2d'));_0x1efb37[_0x0314('0x2e')]=_[_0x0314('0x2f')](_0x369a89[_0x0314('0x2e')]);_0x1efb37[_0x0314('0x30')]=_[_0x0314('0x31')](_0x1efb37[_0x0314('0x2b')],_0x1efb37[_0x0314('0x2e')]);_0x168cca[_0x0314('0x32')]=_['intersection'](_0x1efb37[_0x0314('0x2b')],qs[_0x0314('0x33')](_0x369a89[_0x0314('0x2e')]['fields']));_0x168cca[_0x0314('0x32')]=_0x168cca[_0x0314('0x32')][_0x0314('0x34')]?_0x168cca[_0x0314('0x32')]:_0x1efb37[_0x0314('0x2b')];if(!_0x369a89[_0x0314('0x2e')][_0x0314('0x35')]('nolimit')){_0x168cca[_0x0314('0x1e')]=qs[_0x0314('0x1e')](_0x369a89[_0x0314('0x2e')][_0x0314('0x1e')]);_0x168cca[_0x0314('0x1f')]=qs[_0x0314('0x1f')](_0x369a89[_0x0314('0x2e')][_0x0314('0x1f')]);}_0x168cca[_0x0314('0x36')]=qs['sort'](_0x369a89['query'][_0x0314('0x37')]);_0x168cca['where']=qs['filters'](_[_0x0314('0x38')](_0x369a89[_0x0314('0x2e')],_0x1efb37[_0x0314('0x30')]),_0x1f890d);if(_0x369a89[_0x0314('0x2e')][_0x0314('0x39')]){_0x168cca['where']=_[_0x0314('0x3a')](_0x168cca[_0x0314('0x3b')],{'$or':_[_0x0314('0x2c')](_0x1f890d,function(_0x3cbe47){if(_0x3cbe47[_0x0314('0x3c')]!==_0x0314('0x3d')){var _0x117461={};_0x117461[_0x3cbe47[_0x0314('0x2d')]]={'$like':'%'+_0x369a89['query'][_0x0314('0x39')]+'%'};return _0x117461;}})});}_0x168cca=_[_0x0314('0x3a')]({},_0x168cca,_0x369a89[_0x0314('0x3e')]);var _0x39f7c5={'where':_0x168cca['where']};return db[_0x0314('0x29')][_0x0314('0x20')](_0x39f7c5)[_0x0314('0x24')](function(_0xd41234){_0x4a85cd[_0x0314('0x20')]=_0xd41234;if(_0x369a89[_0x0314('0x2e')][_0x0314('0x3f')]){_0x168cca[_0x0314('0x40')]=[{'all':!![]}];}return db['SquareMessage'][_0x0314('0x41')](_0x168cca);})[_0x0314('0x24')](function(_0x303f59){_0x4a85cd[_0x0314('0x42')]=_0x303f59;return _0x4a85cd;})['then'](respondWithFilteredResult(_0x5ac920,_0x168cca))[_0x0314('0x43')](handleError(_0x5ac920,null));};exports['show']=function(_0x1759c7,_0x337746){var _0x2c3a6c={'raw':!![],'where':{'id':_0x1759c7['params']['id']}},_0x5c8ffa={};_0x5c8ffa[_0x0314('0x2b')]=_[_0x0314('0x2f')](db[_0x0314('0x29')][_0x0314('0x2a')]);_0x5c8ffa[_0x0314('0x2e')]=_[_0x0314('0x2f')](_0x1759c7[_0x0314('0x2e')]);_0x5c8ffa[_0x0314('0x30')]=_[_0x0314('0x31')](_0x5c8ffa[_0x0314('0x2b')],_0x5c8ffa[_0x0314('0x2e')]);_0x2c3a6c['attributes']=_[_0x0314('0x31')](_0x5c8ffa[_0x0314('0x2b')],qs[_0x0314('0x33')](_0x1759c7[_0x0314('0x2e')]['fields']));_0x2c3a6c[_0x0314('0x32')]=_0x2c3a6c[_0x0314('0x32')]['length']?_0x2c3a6c[_0x0314('0x32')]:_0x5c8ffa['model'];if(_0x1759c7[_0x0314('0x2e')]['includeAll']){_0x2c3a6c[_0x0314('0x40')]=[{'all':!![]}];}_0x2c3a6c=_[_0x0314('0x3a')]({},_0x2c3a6c,_0x1759c7[_0x0314('0x3e')]);return db['SquareMessage'][_0x0314('0x44')](_0x2c3a6c)[_0x0314('0x24')](handleEntityNotFound(_0x337746,null))['then'](respondWithResult(_0x337746,null))[_0x0314('0x43')](handleError(_0x337746,null));};exports[_0x0314('0x45')]=function(_0x123adb,_0x285591){return db['SquareMessage'][_0x0314('0x45')](_0x123adb[_0x0314('0x46')],{})[_0x0314('0x24')](respondWithResult(_0x285591,0xc9))[_0x0314('0x43')](handleError(_0x285591,null));};exports[_0x0314('0x23')]=function(_0x4e7fc7,_0x3c44f3){if(_0x4e7fc7[_0x0314('0x46')]['id']){delete _0x4e7fc7[_0x0314('0x46')]['id'];}return db[_0x0314('0x29')][_0x0314('0x44')]({'where':{'id':_0x4e7fc7[_0x0314('0x47')]['id']}})[_0x0314('0x24')](handleEntityNotFound(_0x3c44f3,null))[_0x0314('0x24')](saveUpdates(_0x4e7fc7['body'],null))[_0x0314('0x24')](respondWithResult(_0x3c44f3,null))['catch'](handleError(_0x3c44f3,null));};exports[_0x0314('0x25')]=function(_0x51d671,_0x3f4644){return db['SquareMessage'][_0x0314('0x44')]({'where':{'id':_0x51d671[_0x0314('0x47')]['id']}})['then'](handleEntityNotFound(_0x3f4644,null))[_0x0314('0x24')](removeEntity(_0x3f4644,null))[_0x0314('0x43')](handleError(_0x3f4644,null));}; \ No newline at end of file +var _0x36ee=['catch','create','body','find','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','SquareMessage','rawAttributes','type','key','model','map','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys'];(function(_0xe2904,_0x1caf92){var _0x425487=function(_0x1cbd6f){while(--_0x1cbd6f){_0xe2904['push'](_0xe2904['shift']());}};_0x425487(++_0x1caf92);}(_0x36ee,0xe8));var _0xe36e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x36ee[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe36e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe36e('0x1'));var moment=require(_0xe36e('0x2'));var BPromise=require(_0xe36e('0x3'));var Mustache=require(_0xe36e('0x4'));var util=require(_0xe36e('0x5'));var path=require(_0xe36e('0x6'));var sox=require(_0xe36e('0x7'));var csv=require(_0xe36e('0x8'));var ejs=require(_0xe36e('0x9'));var fs=require('fs');var fs_extra=require(_0xe36e('0xa'));var _=require(_0xe36e('0xb'));var squel=require(_0xe36e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe36e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe36e('0x8'));var querystring=require(_0xe36e('0xe'));var Papa=require(_0xe36e('0xf'));var Redis=require('ioredis');var authService=require(_0xe36e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe36e('0x11'));var hardwareService=require(_0xe36e('0x12'));var logger=require(_0xe36e('0x13'))(_0xe36e('0x14'));var utils=require(_0xe36e('0x15'));var config=require(_0xe36e('0x16'));var licenseUtil=require(_0xe36e('0x17'));var db=require(_0xe36e('0x18'))['db'];function respondWithStatusCode(_0x4fbdb2,_0x32981d){_0x32981d=_0x32981d||0xcc;return function(_0x27841e){if(_0x27841e){return _0x4fbdb2[_0xe36e('0x19')](_0x32981d);}return _0x4fbdb2[_0xe36e('0x1a')](_0x32981d)['end']();};}function respondWithResult(_0x3e264a,_0x521afa){_0x521afa=_0x521afa||0xc8;return function(_0x525155){if(_0x525155){return _0x3e264a[_0xe36e('0x1a')](_0x521afa)[_0xe36e('0x1b')](_0x525155);}};}function respondWithFilteredResult(_0x26fb37,_0x278135){return function(_0xd6828e){if(_0xd6828e){var _0x924cd5=typeof _0x278135[_0xe36e('0x1c')]===_0xe36e('0x1d')&&typeof _0x278135[_0xe36e('0x1e')]===_0xe36e('0x1d');var _0x5792e8=_0xd6828e[_0xe36e('0x1f')];var _0x2184ae=_0x924cd5?0x0:_0x278135['offset'];var _0x21d9a3=_0x924cd5?_0xd6828e['count']:_0x278135[_0xe36e('0x1c')]+_0x278135[_0xe36e('0x1e')];var _0x5e15f5;if(_0x21d9a3>=_0x5792e8){_0x21d9a3=_0x5792e8;_0x5e15f5=0xc8;}else{_0x5e15f5=0xce;}_0x26fb37[_0xe36e('0x1a')](_0x5e15f5);return _0x26fb37[_0xe36e('0x20')](_0xe36e('0x21'),_0x2184ae+'-'+_0x21d9a3+'/'+_0x5792e8)['json'](_0xd6828e);}return null;};}function patchUpdates(_0x21e95e){return function(_0x21bcf9){try{jsonpatch[_0xe36e('0x22')](_0x21bcf9,_0x21e95e,!![]);}catch(_0x3c4017){return BPromise[_0xe36e('0x23')](_0x3c4017);}return _0x21bcf9[_0xe36e('0x24')]();};}function saveUpdates(_0x4f438a,_0xd71137){return function(_0x4f214a){if(_0x4f214a){return _0x4f214a[_0xe36e('0x25')](_0x4f438a)[_0xe36e('0x26')](function(_0x437f3f){return _0x437f3f;});}return null;};}function removeEntity(_0x53e13a,_0x598a7a){return function(_0x4749a8){if(_0x4749a8){return _0x4749a8[_0xe36e('0x27')]()[_0xe36e('0x26')](function(){_0x53e13a[_0xe36e('0x1a')](0xcc)[_0xe36e('0x28')]();});}};}function handleEntityNotFound(_0x1507f9,_0x1a045c){return function(_0x5ac484){if(!_0x5ac484){_0x1507f9[_0xe36e('0x19')](0x194);}return _0x5ac484;};}function handleError(_0x35f9e7,_0x10597f){_0x10597f=_0x10597f||0x1f4;return function(_0x262caa){logger['error'](_0x262caa[_0xe36e('0x29')]);if(_0x262caa['name']){delete _0x262caa[_0xe36e('0x2a')];}_0x35f9e7['status'](_0x10597f)[_0xe36e('0x2b')](_0x262caa);};}exports['index']=function(_0x410504,_0x4c5d98){var _0x3b1045={},_0x59548b={},_0x4bb75b={'count':0x0,'rows':[]};var _0x5d8fd8=_['map'](db[_0xe36e('0x2c')][_0xe36e('0x2d')],function(_0x4cf185){return{'name':_0x4cf185['fieldName'],'type':_0x4cf185[_0xe36e('0x2e')][_0xe36e('0x2f')]};});_0x59548b[_0xe36e('0x30')]=_[_0xe36e('0x31')](_0x5d8fd8,_0xe36e('0x2a'));_0x59548b[_0xe36e('0x32')]=_['keys'](_0x410504[_0xe36e('0x32')]);_0x59548b[_0xe36e('0x33')]=_['intersection'](_0x59548b[_0xe36e('0x30')],_0x59548b[_0xe36e('0x32')]);_0x3b1045[_0xe36e('0x34')]=_[_0xe36e('0x35')](_0x59548b[_0xe36e('0x30')],qs[_0xe36e('0x36')](_0x410504[_0xe36e('0x32')][_0xe36e('0x36')]));_0x3b1045[_0xe36e('0x34')]=_0x3b1045[_0xe36e('0x34')][_0xe36e('0x37')]?_0x3b1045['attributes']:_0x59548b[_0xe36e('0x30')];if(!_0x410504['query']['hasOwnProperty'](_0xe36e('0x38'))){_0x3b1045['limit']=qs[_0xe36e('0x1e')](_0x410504[_0xe36e('0x32')][_0xe36e('0x1e')]);_0x3b1045[_0xe36e('0x1c')]=qs['offset'](_0x410504['query'][_0xe36e('0x1c')]);}_0x3b1045[_0xe36e('0x39')]=qs[_0xe36e('0x3a')](_0x410504[_0xe36e('0x32')]['sort']);_0x3b1045[_0xe36e('0x3b')]=qs[_0xe36e('0x33')](_[_0xe36e('0x3c')](_0x410504['query'],_0x59548b[_0xe36e('0x33')]),_0x5d8fd8);if(_0x410504[_0xe36e('0x32')]['filter']){_0x3b1045[_0xe36e('0x3b')]=_[_0xe36e('0x3d')](_0x3b1045[_0xe36e('0x3b')],{'$or':_[_0xe36e('0x31')](_0x5d8fd8,function(_0xeadfa6){if(_0xeadfa6[_0xe36e('0x2e')]!==_0xe36e('0x3e')){var _0x20877d={};_0x20877d[_0xeadfa6[_0xe36e('0x2a')]]={'$like':'%'+_0x410504[_0xe36e('0x32')][_0xe36e('0x3f')]+'%'};return _0x20877d;}})});}_0x3b1045=_[_0xe36e('0x3d')]({},_0x3b1045,_0x410504[_0xe36e('0x40')]);var _0x5f396c={'where':_0x3b1045[_0xe36e('0x3b')]};return db[_0xe36e('0x2c')][_0xe36e('0x1f')](_0x5f396c)[_0xe36e('0x26')](function(_0x295feb){_0x4bb75b['count']=_0x295feb;if(_0x410504['query'][_0xe36e('0x41')]){_0x3b1045[_0xe36e('0x42')]=[{'all':!![]}];}return db[_0xe36e('0x2c')][_0xe36e('0x43')](_0x3b1045);})[_0xe36e('0x26')](function(_0x34a1ba){_0x4bb75b[_0xe36e('0x44')]=_0x34a1ba;return _0x4bb75b;})[_0xe36e('0x26')](respondWithFilteredResult(_0x4c5d98,_0x3b1045))['catch'](handleError(_0x4c5d98,null));};exports[_0xe36e('0x45')]=function(_0x2d392c,_0x4788a0){var _0x21dc35={'raw':!![],'where':{'id':_0x2d392c[_0xe36e('0x46')]['id']}},_0x5ef3e4={};_0x5ef3e4[_0xe36e('0x30')]=_[_0xe36e('0x47')](db[_0xe36e('0x2c')][_0xe36e('0x2d')]);_0x5ef3e4['query']=_[_0xe36e('0x47')](_0x2d392c[_0xe36e('0x32')]);_0x5ef3e4[_0xe36e('0x33')]=_[_0xe36e('0x35')](_0x5ef3e4[_0xe36e('0x30')],_0x5ef3e4[_0xe36e('0x32')]);_0x21dc35['attributes']=_[_0xe36e('0x35')](_0x5ef3e4[_0xe36e('0x30')],qs[_0xe36e('0x36')](_0x2d392c[_0xe36e('0x32')][_0xe36e('0x36')]));_0x21dc35['attributes']=_0x21dc35[_0xe36e('0x34')][_0xe36e('0x37')]?_0x21dc35[_0xe36e('0x34')]:_0x5ef3e4[_0xe36e('0x30')];if(_0x2d392c[_0xe36e('0x32')][_0xe36e('0x41')]){_0x21dc35[_0xe36e('0x42')]=[{'all':!![]}];}_0x21dc35=_[_0xe36e('0x3d')]({},_0x21dc35,_0x2d392c[_0xe36e('0x40')]);return db['SquareMessage']['find'](_0x21dc35)[_0xe36e('0x26')](handleEntityNotFound(_0x4788a0,null))['then'](respondWithResult(_0x4788a0,null))[_0xe36e('0x48')](handleError(_0x4788a0,null));};exports[_0xe36e('0x49')]=function(_0x38b93f,_0x25aa09){return db['SquareMessage'][_0xe36e('0x49')](_0x38b93f[_0xe36e('0x4a')],{})['then'](respondWithResult(_0x25aa09,0xc9))[_0xe36e('0x48')](handleError(_0x25aa09,null));};exports[_0xe36e('0x25')]=function(_0x2c26e6,_0x42eae5){if(_0x2c26e6[_0xe36e('0x4a')]['id']){delete _0x2c26e6[_0xe36e('0x4a')]['id'];}return db[_0xe36e('0x2c')][_0xe36e('0x4b')]({'where':{'id':_0x2c26e6[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x42eae5,null))[_0xe36e('0x26')](saveUpdates(_0x2c26e6[_0xe36e('0x4a')],null))[_0xe36e('0x26')](respondWithResult(_0x42eae5,null))[_0xe36e('0x48')](handleError(_0x42eae5,null));};exports[_0xe36e('0x27')]=function(_0x5678d3,_0x3262bf){return db['SquareMessage']['find']({'where':{'id':_0x5678d3[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x3262bf,null))['then'](removeEntity(_0x3262bf,null))[_0xe36e('0x48')](handleError(_0x3262bf,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 27ff4ca..aa1598d 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 _0x4fef=['rimraf','../../config/environment','./squareMessage.attributes','exports','define','square_messages','lodash','../../config/logger','bluebird','request-promise','path'];(function(_0x322d52,_0x35c41c){var _0x32578e=function(_0xc92eef){while(--_0xc92eef){_0x322d52['push'](_0x322d52['shift']());}};_0x32578e(++_0x35c41c);}(_0x4fef,0xe2));var _0xf4fe=function(_0x1711ae,_0x37b20c){_0x1711ae=_0x1711ae-0x0;var _0x1cd45d=_0x4fef[_0x1711ae];return _0x1cd45d;};'use strict';var _=require(_0xf4fe('0x0'));var util=require('util');var logger=require(_0xf4fe('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf4fe('0x2'));var rp=require(_0xf4fe('0x3'));var fs=require('fs');var path=require(_0xf4fe('0x4'));var rimraf=require(_0xf4fe('0x5'));var config=require(_0xf4fe('0x6'));var attributes=require(_0xf4fe('0x7'));module[_0xf4fe('0x8')]=function(_0x170455,_0x2f3676){return _0x170455[_0xf4fe('0x9')]('SquareMessage',attributes,{'tableName':_0xf4fe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b10=['define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x43fbee,_0x2564d6){var _0x8bc792=function(_0x3d9de4){while(--_0x3d9de4){_0x43fbee['push'](_0x43fbee['shift']());}};_0x8bc792(++_0x2564d6);}(_0x3b10,0x1e4));var _0x03b1=function(_0x370dd8,_0x11daf3){_0x370dd8=_0x370dd8-0x0;var _0x39217a=_0x3b10[_0x370dd8];return _0x39217a;};'use strict';var _=require(_0x03b1('0x0'));var util=require(_0x03b1('0x1'));var logger=require(_0x03b1('0x2'))(_0x03b1('0x3'));var moment=require(_0x03b1('0x4'));var BPromise=require(_0x03b1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x03b1('0x6'));var rimraf=require(_0x03b1('0x7'));var config=require(_0x03b1('0x8'));var attributes=require('./squareMessage.attributes');module[_0x03b1('0x9')]=function(_0x5ceed0,_0x5ac42a){return _0x5ceed0[_0x03b1('0xa')](_0x03b1('0xb'),attributes,{'tableName':_0x03b1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index fda0b50..c60698b 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 _0x926a=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','stringify','util'];(function(_0x1f1f3b,_0x227aa9){var _0x2e63aa=function(_0x165a34){while(--_0x165a34){_0x1f1f3b['push'](_0x1f1f3b['shift']());}};_0x2e63aa(++_0x227aa9);}(_0x926a,0x197));var _0xa926=function(_0x49d5b1,_0x3a15de){_0x49d5b1=_0x49d5b1-0x0;var _0x3e6760=_0x926a[_0x49d5b1];return _0x3e6760;};'use strict';var _=require('lodash');var util=require(_0xa926('0x0'));var moment=require(_0xa926('0x1'));var BPromise=require(_0xa926('0x2'));var rs=require(_0xa926('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa926('0x4'));var logger=require(_0xa926('0x5'))(_0xa926('0x6'));var config=require('../../config/environment');var jayson=require(_0xa926('0x7'));var client=jayson[_0xa926('0x8')][_0xa926('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd330b8,_0x1be8b8,_0x10c50d){return new BPromise(function(_0x3fc815,_0xa93889){return client['request'](_0xd330b8,_0x10c50d)['then'](function(_0x3e7337){logger[_0xa926('0xa')](_0xa926('0xb'),_0x1be8b8,_0xa926('0xc'));logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0x1be8b8,'request\x20sent',JSON['stringify'](_0x3e7337));if(_0x3e7337['error']){if(_0x3e7337[_0xa926('0xd')][_0xa926('0xe')]===0x1f4){logger['error'](_0xa926('0xb'),_0x1be8b8,_0x3e7337[_0xa926('0xd')][_0xa926('0xf')]);return _0xa93889(_0x3e7337['error'][_0xa926('0xf')]);}logger[_0xa926('0xd')](_0xa926('0xb'),_0x1be8b8,_0x3e7337[_0xa926('0xd')]['message']);return _0x3fc815(_0x3e7337[_0xa926('0xd')][_0xa926('0xf')]);}else{logger[_0xa926('0xa')](_0xa926('0xb'),_0x1be8b8,_0xa926('0xc'));_0x3fc815(_0x3e7337[_0xa926('0x10')][_0xa926('0xf')]);}})[_0xa926('0x11')](function(_0x504219){logger[_0xa926('0xd')](_0xa926('0xb'),_0x1be8b8,_0x504219);_0xa93889(_0x504219);});});}exports[_0xa926('0x12')]=function(_0x537509){var _0xfb8b79=this;return new Promise(function(_0x59c06b,_0x1ec315){return db[_0xa926('0x13')][_0xa926('0x14')](_0x537509[_0xa926('0x15')],{'raw':_0x537509['options']?_0x537509[_0xa926('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x15bca0){logger[_0xa926('0xa')](_0xa926('0x12'),_0x537509);logger['debug'](_0xa926('0x12'),_0x537509,JSON[_0xa926('0x17')](_0x15bca0));_0x59c06b(_0x15bca0);})[_0xa926('0x11')](function(_0x12d7df){logger[_0xa926('0xd')](_0xa926('0x12'),_0x12d7df['message'],_0x537509);_0x1ec315(_0xfb8b79[_0xa926('0xd')](0x1f4,_0x12d7df[_0xa926('0xf')]));});});}; \ No newline at end of file +var _0x1c9b=['info','result','CreateSquareMessage','SquareMessage','create','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x306d5d,_0x3293d5){var _0xb5cee4=function(_0x38fe31){while(--_0x38fe31){_0x306d5d['push'](_0x306d5d['shift']());}};_0xb5cee4(++_0x3293d5);}(_0x1c9b,0x1b0));var _0xb1c9=function(_0xda6ad1,_0x5f09e3){_0xda6ad1=_0xda6ad1-0x0;var _0xedc3a5=_0x1c9b[_0xda6ad1];return _0xedc3a5;};'use strict';var _=require(_0xb1c9('0x0'));var util=require(_0xb1c9('0x1'));var moment=require(_0xb1c9('0x2'));var BPromise=require(_0xb1c9('0x3'));var rs=require(_0xb1c9('0x4'));var fs=require('fs');var Redis=require(_0xb1c9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb1c9('0x6'));var logger=require(_0xb1c9('0x7'))(_0xb1c9('0x8'));var config=require('../../config/environment');var jayson=require(_0xb1c9('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xf478c,_0x37e339,_0x1adb55){return new BPromise(function(_0xb15360,_0x1df536){return client[_0xb1c9('0xa')](_0xf478c,_0x1adb55)[_0xb1c9('0xb')](function(_0x249140){logger['info'](_0xb1c9('0xc'),_0x37e339,_0xb1c9('0xd'));logger[_0xb1c9('0xe')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x37e339,'request\x20sent',JSON[_0xb1c9('0xf')](_0x249140));if(_0x249140[_0xb1c9('0x10')]){if(_0x249140[_0xb1c9('0x10')]['code']===0x1f4){logger['error'](_0xb1c9('0xc'),_0x37e339,_0x249140[_0xb1c9('0x10')]['message']);return _0x1df536(_0x249140[_0xb1c9('0x10')][_0xb1c9('0x11')]);}logger[_0xb1c9('0x10')](_0xb1c9('0xc'),_0x37e339,_0x249140[_0xb1c9('0x10')][_0xb1c9('0x11')]);return _0xb15360(_0x249140[_0xb1c9('0x10')][_0xb1c9('0x11')]);}else{logger[_0xb1c9('0x12')](_0xb1c9('0xc'),_0x37e339,'request\x20sent');_0xb15360(_0x249140[_0xb1c9('0x13')]['message']);}})['catch'](function(_0x1d35d8){logger[_0xb1c9('0x10')](_0xb1c9('0xc'),_0x37e339,_0x1d35d8);_0x1df536(_0x1d35d8);});});}exports[_0xb1c9('0x14')]=function(_0x573306){var _0x305aab=this;return new Promise(function(_0x114471,_0x101534){return db[_0xb1c9('0x15')][_0xb1c9('0x16')](_0x573306[_0xb1c9('0x17')],{'raw':_0x573306[_0xb1c9('0x18')]?_0x573306[_0xb1c9('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xb1c9('0xb')](function(_0x2d3d66){logger['info'](_0xb1c9('0x14'),_0x573306);logger[_0xb1c9('0xe')](_0xb1c9('0x14'),_0x573306,JSON[_0xb1c9('0xf')](_0x2d3d66));_0x114471(_0x2d3d66);})['catch'](function(_0x985f45){logger[_0xb1c9('0x10')](_0xb1c9('0x14'),_0x985f45[_0xb1c9('0x11')],_0x573306);_0x101534(_0x305aab[_0xb1c9('0x10')](0x1f4,_0x985f45['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 8589a51..9f046c9 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 _0x835f=['/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/test','15s','post','create'];(function(_0x68e07e,_0x2f7cdd){var _0x261074=function(_0x3b4054){while(--_0x3b4054){_0x68e07e['push'](_0x68e07e['shift']());}};_0x261074(++_0x2f7cdd);}(_0x835f,0x1e0));var _0xf835=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0x835f[_0x1f1a97];return _0x29fc6a;};'use strict';var multer=require('multer');var util=require(_0xf835('0x0'));var path=require(_0xf835('0x1'));var timeout=require(_0xf835('0x2'));var express=require(_0xf835('0x3'));var router=express['Router']();var fs_extra=require(_0xf835('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf835('0x5'));var config=require(_0xf835('0x6'));var controller=require('./squareOdbc.controller');router[_0xf835('0x7')]('/',auth[_0xf835('0x8')](),controller['index']);router['get']('/:id',auth[_0xf835('0x8')](),controller[_0xf835('0x9')]);router[_0xf835('0x7')](_0xf835('0xa'),auth[_0xf835('0x8')](),timeout(_0xf835('0xb')),controller['test']);router[_0xf835('0xc')]('/',auth[_0xf835('0x8')](),controller[_0xf835('0xd')]);router['put'](_0xf835('0xe'),auth[_0xf835('0x8')](),controller[_0xf835('0xf')]);router[_0xf835('0x10')](_0xf835('0xe'),auth['isAuthenticated'](),controller[_0xf835('0x11')]);module[_0xf835('0x12')]=router; \ No newline at end of file +var _0xf5f2=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/test','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x2c27ed,_0x5c50f0){var _0x597bd1=function(_0xd6db18){while(--_0xd6db18){_0x2c27ed['push'](_0x2c27ed['shift']());}};_0x597bd1(++_0x5c50f0);}(_0xf5f2,0x161));var _0x2f5f=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xf5f2[_0x173d7e];return _0x2220d6;};'use strict';var multer=require(_0x2f5f('0x0'));var util=require(_0x2f5f('0x1'));var path=require(_0x2f5f('0x2'));var timeout=require(_0x2f5f('0x3'));var express=require(_0x2f5f('0x4'));var router=express[_0x2f5f('0x5')]();var fs_extra=require(_0x2f5f('0x6'));var auth=require(_0x2f5f('0x7'));var interaction=require(_0x2f5f('0x8'));var config=require(_0x2f5f('0x9'));var controller=require('./squareOdbc.controller');router[_0x2f5f('0xa')]('/',auth[_0x2f5f('0xb')](),controller[_0x2f5f('0xc')]);router[_0x2f5f('0xa')](_0x2f5f('0xd'),auth[_0x2f5f('0xb')](),controller['show']);router[_0x2f5f('0xa')](_0x2f5f('0xe'),auth[_0x2f5f('0xb')](),timeout('15s'),controller['test']);router[_0x2f5f('0xf')]('/',auth[_0x2f5f('0xb')](),controller[_0x2f5f('0x10')]);router[_0x2f5f('0x11')](_0x2f5f('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x2f5f('0x12')](_0x2f5f('0xd'),auth[_0x2f5f('0xb')](),controller['destroy']);module[_0x2f5f('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 4a5c84a..df4cf4c 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 _0xf4b8=['name','STRING'];(function(_0x37bbc0,_0x4bdf0a){var _0x5e5e60=function(_0x55c236){while(--_0x55c236){_0x37bbc0['push'](_0x37bbc0['shift']());}};_0x5e5e60(++_0x4bdf0a);}(_0xf4b8,0x16b));var _0x8f4b=function(_0xb90394,_0x58bc00){_0xb90394=_0xb90394-0x0;var _0x59e2da=_0xf4b8[_0xb90394];return _0x59e2da;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8f4b('0x0')],'unique':_0x8f4b('0x1'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8f4b('0x0')]}}; \ No newline at end of file +var _0x6c85=['STRING','name','exports'];(function(_0x280a17,_0xa981e6){var _0x2e8716=function(_0x29afaf){while(--_0x29afaf){_0x280a17['push'](_0x280a17['shift']());}};_0x2e8716(++_0xa981e6);}(_0x6c85,0x107));var _0x56c8=function(_0xe7c78b,_0x1d1dba){_0xe7c78b=_0xe7c78b-0x0;var _0x3a25e4=_0x6c85[_0xe7c78b];return _0x3a25e4;};'use strict';var Sequelize=require('sequelize');module[_0x56c8('0x0')]={'name':{'type':Sequelize[_0x56c8('0x1')],'unique':_0x56c8('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x56c8('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index b238975..33043c8 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 _0x07ce=['where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','closeSync','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','ODBC','UserProfileResource','end','error','name','send','index','map','SquareOdbc','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order'];(function(_0x504a56,_0x552cd1){var _0x282251=function(_0x997338){while(--_0x997338){_0x504a56['push'](_0x504a56['shift']());}};_0x282251(++_0x552cd1);}(_0x07ce,0xb9));var _0xe07c=function(_0x4b3b8c,_0x1b3a3f){_0x4b3b8c=_0x4b3b8c-0x0;var _0x2deb28=_0x07ce[_0x4b3b8c];return _0x2deb28;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe07c('0x0'));var jsonpatch=require(_0xe07c('0x1'));var rp=require(_0xe07c('0x2'));var moment=require('moment');var BPromise=require(_0xe07c('0x3'));var Mustache=require(_0xe07c('0x4'));var util=require(_0xe07c('0x5'));var path=require('path');var sox=require(_0xe07c('0x6'));var csv=require('to-csv');var ejs=require(_0xe07c('0x7'));var fs=require('fs');var fs_extra=require(_0xe07c('0x8'));var _=require(_0xe07c('0x9'));var squel=require(_0xe07c('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe07c('0xb'));var toCsv=require(_0xe07c('0xc'));var querystring=require('querystring');var Papa=require(_0xe07c('0xd'));var Redis=require(_0xe07c('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe07c('0xf'));var logger=require(_0xe07c('0x10'))(_0xe07c('0x11'));var utils=require(_0xe07c('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17504b,_0x4f4bac){_0x4f4bac=_0x4f4bac||0xcc;return function(_0x51c277){if(_0x51c277){return _0x17504b[_0xe07c('0x13')](_0x4f4bac);}return _0x17504b[_0xe07c('0x14')](_0x4f4bac)['end']();};}function respondWithResult(_0x55306e,_0x3d9bc3){_0x3d9bc3=_0x3d9bc3||0xc8;return function(_0x373261){if(_0x373261){return _0x55306e['status'](_0x3d9bc3)['json'](_0x373261);}};}function respondWithFilteredResult(_0x35acc5,_0x2e3e59){return function(_0x8018cb){if(_0x8018cb){var _0x4a957d=typeof _0x2e3e59[_0xe07c('0x15')]===_0xe07c('0x16')&&typeof _0x2e3e59['limit']===_0xe07c('0x16');var _0x9f5192=_0x8018cb[_0xe07c('0x17')];var _0x54a35b=_0x4a957d?0x0:_0x2e3e59[_0xe07c('0x15')];var _0x216916=_0x4a957d?_0x8018cb[_0xe07c('0x17')]:_0x2e3e59[_0xe07c('0x15')]+_0x2e3e59['limit'];var _0x3eb7c9;if(_0x216916>=_0x9f5192){_0x216916=_0x9f5192;_0x3eb7c9=0xc8;}else{_0x3eb7c9=0xce;}_0x35acc5[_0xe07c('0x14')](_0x3eb7c9);return _0x35acc5[_0xe07c('0x18')](_0xe07c('0x19'),_0x54a35b+'-'+_0x216916+'/'+_0x9f5192)['json'](_0x8018cb);}return null;};}function patchUpdates(_0x27d836){return function(_0x2743fd){try{jsonpatch[_0xe07c('0x1a')](_0x2743fd,_0x27d836,!![]);}catch(_0x3d26ca){return BPromise[_0xe07c('0x1b')](_0x3d26ca);}return _0x2743fd['save']();};}function saveUpdates(_0x4b8916,_0xa68112){return function(_0x2cac1b){if(_0x2cac1b){return _0x2cac1b[_0xe07c('0x1c')](_0x4b8916)[_0xe07c('0x1d')](function(_0x322a19){return _0x322a19;});}return null;};}function removeEntity(_0x4bf3f9,_0x243663){return function(_0x5ac2ab){if(_0x5ac2ab){return _0x5ac2ab[_0xe07c('0x1e')]()[_0xe07c('0x1d')](function(){var _0x31e4e1=_0x5ac2ab[_0xe07c('0x1f')]({'plain':!![]});var _0x15f159=_0xe07c('0x20');return db[_0xe07c('0x21')][_0xe07c('0x1e')]({'where':{'type':_0x15f159,'resourceId':_0x31e4e1['id']}})['then'](function(){return _0x5ac2ab;});})[_0xe07c('0x1d')](function(){_0x4bf3f9[_0xe07c('0x14')](0xcc)[_0xe07c('0x22')]();});}};}function handleEntityNotFound(_0x4b8e33,_0x1a7926){return function(_0x21028c){if(!_0x21028c){_0x4b8e33['sendStatus'](0x194);}return _0x21028c;};}function handleError(_0x192536,_0x18eb66){_0x18eb66=_0x18eb66||0x1f4;return function(_0x2eb5fd){logger[_0xe07c('0x23')](_0x2eb5fd['stack']);if(_0x2eb5fd['name']){delete _0x2eb5fd[_0xe07c('0x24')];}_0x192536[_0xe07c('0x14')](_0x18eb66)[_0xe07c('0x25')](_0x2eb5fd);};}exports[_0xe07c('0x26')]=function(_0x1c86ce,_0x2744f7){var _0x9b13c5={},_0x4301d0={},_0x19864f={'count':0x0,'rows':[]};var _0x27bfcd=_[_0xe07c('0x27')](db[_0xe07c('0x28')][_0xe07c('0x29')],function(_0x22951e){return{'name':_0x22951e['fieldName'],'type':_0x22951e[_0xe07c('0x2a')][_0xe07c('0x2b')]};});_0x4301d0[_0xe07c('0x2c')]=_[_0xe07c('0x27')](_0x27bfcd,_0xe07c('0x24'));_0x4301d0[_0xe07c('0x2d')]=_[_0xe07c('0x2e')](_0x1c86ce[_0xe07c('0x2d')]);_0x4301d0[_0xe07c('0x2f')]=_['intersection'](_0x4301d0[_0xe07c('0x2c')],_0x4301d0['query']);_0x9b13c5['attributes']=_[_0xe07c('0x30')](_0x4301d0[_0xe07c('0x2c')],qs[_0xe07c('0x31')](_0x1c86ce[_0xe07c('0x2d')][_0xe07c('0x31')]));_0x9b13c5[_0xe07c('0x32')]=_0x9b13c5[_0xe07c('0x32')][_0xe07c('0x33')]?_0x9b13c5[_0xe07c('0x32')]:_0x4301d0[_0xe07c('0x2c')];if(!_0x1c86ce[_0xe07c('0x2d')]['hasOwnProperty'](_0xe07c('0x34'))){_0x9b13c5['limit']=qs['limit'](_0x1c86ce[_0xe07c('0x2d')][_0xe07c('0x35')]);_0x9b13c5[_0xe07c('0x15')]=qs['offset'](_0x1c86ce['query'][_0xe07c('0x15')]);}_0x9b13c5[_0xe07c('0x36')]=qs['sort'](_0x1c86ce[_0xe07c('0x2d')]['sort']);_0x9b13c5[_0xe07c('0x37')]=qs[_0xe07c('0x2f')](_[_0xe07c('0x38')](_0x1c86ce[_0xe07c('0x2d')],_0x4301d0[_0xe07c('0x2f')]),_0x27bfcd);if(_0x1c86ce[_0xe07c('0x2d')][_0xe07c('0x39')]){_0x9b13c5[_0xe07c('0x37')]=_[_0xe07c('0x3a')](_0x9b13c5['where'],{'$or':_[_0xe07c('0x27')](_0x27bfcd,function(_0x4578cb){if(_0x4578cb[_0xe07c('0x2a')]!==_0xe07c('0x3b')){var _0x28beb1={};_0x28beb1[_0x4578cb[_0xe07c('0x24')]]={'$like':'%'+_0x1c86ce[_0xe07c('0x2d')][_0xe07c('0x39')]+'%'};return _0x28beb1;}})});}_0x9b13c5=_[_0xe07c('0x3a')]({},_0x9b13c5,_0x1c86ce[_0xe07c('0x3c')]);var _0x4ee921={'where':_0x9b13c5['where']};return db[_0xe07c('0x28')][_0xe07c('0x17')](_0x4ee921)[_0xe07c('0x1d')](function(_0x65d300){_0x19864f[_0xe07c('0x17')]=_0x65d300;if(_0x1c86ce[_0xe07c('0x2d')][_0xe07c('0x3d')]){_0x9b13c5['include']=[{'all':!![]}];}return db[_0xe07c('0x28')][_0xe07c('0x3e')](_0x9b13c5);})[_0xe07c('0x1d')](function(_0x45ef67){_0x19864f[_0xe07c('0x3f')]=_0x45ef67;return _0x19864f;})['then'](respondWithFilteredResult(_0x2744f7,_0x9b13c5))[_0xe07c('0x40')](handleError(_0x2744f7,null));};exports['show']=function(_0x2460fa,_0x3be6e5){var _0x4b5ed9={'raw':!![],'where':{'id':_0x2460fa[_0xe07c('0x41')]['id']}},_0x13d00d={};_0x13d00d[_0xe07c('0x2c')]=_[_0xe07c('0x2e')](db[_0xe07c('0x28')]['rawAttributes']);_0x13d00d[_0xe07c('0x2d')]=_[_0xe07c('0x2e')](_0x2460fa['query']);_0x13d00d[_0xe07c('0x2f')]=_[_0xe07c('0x30')](_0x13d00d[_0xe07c('0x2c')],_0x13d00d[_0xe07c('0x2d')]);_0x4b5ed9[_0xe07c('0x32')]=_[_0xe07c('0x30')](_0x13d00d[_0xe07c('0x2c')],qs['fields'](_0x2460fa['query'][_0xe07c('0x31')]));_0x4b5ed9['attributes']=_0x4b5ed9[_0xe07c('0x32')][_0xe07c('0x33')]?_0x4b5ed9[_0xe07c('0x32')]:_0x13d00d[_0xe07c('0x2c')];if(_0x2460fa[_0xe07c('0x2d')]['includeAll']){_0x4b5ed9[_0xe07c('0x42')]=[{'all':!![]}];}_0x4b5ed9=_['merge']({},_0x4b5ed9,_0x2460fa[_0xe07c('0x3c')]);return db['SquareOdbc'][_0xe07c('0x43')](_0x4b5ed9)['then'](handleEntityNotFound(_0x3be6e5,null))[_0xe07c('0x1d')](respondWithResult(_0x3be6e5,null))[_0xe07c('0x40')](handleError(_0x3be6e5,null));};exports['create']=function(_0x4c0fbb,_0x1e256c){return db['SquareOdbc']['create'](_0x4c0fbb[_0xe07c('0x44')],{})[_0xe07c('0x1d')](function(_0x567083){var _0x44441e=_0x4c0fbb[_0xe07c('0x45')]['get']({'plain':!![]});if(!_0x44441e)throw new Error(_0xe07c('0x46'));if(_0x44441e[_0xe07c('0x47')]===_0xe07c('0x45')){var _0x5ad73d=_0x567083['get']({'plain':!![]});var _0x139193='ODBC';return db[_0xe07c('0x48')]['find']({'where':{'name':_0x139193,'userProfileId':_0x44441e[_0xe07c('0x49')]},'raw':!![]})[_0xe07c('0x1d')](function(_0x4f41a5){if(_0x4f41a5&&_0x4f41a5[_0xe07c('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0x5ad73d['name'],'resourceId':_0x5ad73d['id'],'type':_0x4f41a5[_0xe07c('0x24')],'sectionId':_0x4f41a5['id']},{})[_0xe07c('0x1d')](function(){return _0x567083;});}else{return _0x567083;}})[_0xe07c('0x40')](function(_0x5ed3fa){logger[_0xe07c('0x23')](_0xe07c('0x4b'),_0x5ed3fa);throw _0x5ed3fa;});}return _0x567083;})[_0xe07c('0x1d')](respondWithResult(_0x1e256c,0xc9))[_0xe07c('0x40')](handleError(_0x1e256c,null));};exports[_0xe07c('0x1c')]=function(_0x158817,_0x8e843){if(_0x158817[_0xe07c('0x44')]['id']){delete _0x158817['body']['id'];}return db[_0xe07c('0x28')][_0xe07c('0x43')]({'where':{'id':_0x158817[_0xe07c('0x41')]['id']}})['then'](handleEntityNotFound(_0x8e843,null))['then'](saveUpdates(_0x158817[_0xe07c('0x44')],null))[_0xe07c('0x1d')](respondWithResult(_0x8e843,null))['catch'](handleError(_0x8e843,null));};exports[_0xe07c('0x1e')]=function(_0x33d9b3,_0x40b29c){return db[_0xe07c('0x28')][_0xe07c('0x43')]({'where':{'id':_0x33d9b3[_0xe07c('0x41')]['id']}})[_0xe07c('0x1d')](handleEntityNotFound(_0x40b29c,null))['then'](removeEntity(_0x40b29c,null))['catch'](handleError(_0x40b29c,null));};exports[_0xe07c('0x4c')]=function(_0x590617,_0x5b1024,_0x2612a7){var _0x229cc9;return db['SquareOdbc'][_0xe07c('0x43')]({'where':{'id':_0x590617[_0xe07c('0x41')]['id']},'attributes':['id',_0xe07c('0x4d')]})[_0xe07c('0x1d')](handleEntityNotFound(_0x5b1024,null))['then'](function(_0x32d55a){if(_0x32d55a){var _0xe9d9a4=require(_0xe07c('0x4e'))();_0xe9d9a4['openSync'](_0x32d55a['dsn']);_0xe9d9a4[_0xe07c('0x4f')]();return _0x32d55a;}})['then'](respondWithResult(_0x5b1024,null))[_0xe07c('0x40')](handleError(_0x5b1024,null));}; \ No newline at end of file +var _0x0a31=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','get','ODBC','UserProfileResource','end','error','stack','name','send','SquareOdbc','rawAttributes','fieldName','type','map','keys','query','filters','model','attributes','intersection','fields','length','nolimit','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x2133ee,_0x59c0f5){var _0xf53ff6=function(_0x1f538a){while(--_0x1f538a){_0x2133ee['push'](_0x2133ee['shift']());}};_0xf53ff6(++_0x59c0f5);}(_0x0a31,0x19d));var _0x10a3=function(_0x4eacd3,_0x456c4d){_0x4eacd3=_0x4eacd3-0x0;var _0x4157db=_0x0a31[_0x4eacd3];return _0x4157db;};'use strict';var emlformat=require(_0x10a3('0x0'));var rimraf=require(_0x10a3('0x1'));var zipdir=require(_0x10a3('0x2'));var jsonpatch=require(_0x10a3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x10a3('0x4'));var Mustache=require(_0x10a3('0x5'));var util=require('util');var path=require(_0x10a3('0x6'));var sox=require('sox');var csv=require(_0x10a3('0x7'));var ejs=require(_0x10a3('0x8'));var fs=require('fs');var fs_extra=require(_0x10a3('0x9'));var _=require(_0x10a3('0xa'));var squel=require(_0x10a3('0xb'));var crypto=require(_0x10a3('0xc'));var jsforce=require(_0x10a3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x10a3('0x7'));var querystring=require(_0x10a3('0xe'));var Papa=require(_0x10a3('0xf'));var Redis=require(_0x10a3('0x10'));var authService=require(_0x10a3('0x11'));var qs=require(_0x10a3('0x12'));var as=require(_0x10a3('0x13'));var hardwareService=require(_0x10a3('0x14'));var logger=require(_0x10a3('0x15'))(_0x10a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x10a3('0x17'));var db=require(_0x10a3('0x18'))['db'];function respondWithStatusCode(_0x14ae4a,_0x3cfdb5){_0x3cfdb5=_0x3cfdb5||0xcc;return function(_0x592ccb){if(_0x592ccb){return _0x14ae4a[_0x10a3('0x19')](_0x3cfdb5);}return _0x14ae4a['status'](_0x3cfdb5)['end']();};}function respondWithResult(_0x3493bd,_0x500f62){_0x500f62=_0x500f62||0xc8;return function(_0x323862){if(_0x323862){return _0x3493bd[_0x10a3('0x1a')](_0x500f62)[_0x10a3('0x1b')](_0x323862);}};}function respondWithFilteredResult(_0x13fe84,_0x3e1d25){return function(_0x3d2f90){if(_0x3d2f90){var _0x330fd3=typeof _0x3e1d25[_0x10a3('0x1c')]===_0x10a3('0x1d')&&typeof _0x3e1d25['limit']==='undefined';var _0x5ca37c=_0x3d2f90[_0x10a3('0x1e')];var _0x1abc7b=_0x330fd3?0x0:_0x3e1d25[_0x10a3('0x1c')];var _0x23ff9e=_0x330fd3?_0x3d2f90['count']:_0x3e1d25[_0x10a3('0x1c')]+_0x3e1d25[_0x10a3('0x1f')];var _0x3737bc;if(_0x23ff9e>=_0x5ca37c){_0x23ff9e=_0x5ca37c;_0x3737bc=0xc8;}else{_0x3737bc=0xce;}_0x13fe84[_0x10a3('0x1a')](_0x3737bc);return _0x13fe84[_0x10a3('0x20')](_0x10a3('0x21'),_0x1abc7b+'-'+_0x23ff9e+'/'+_0x5ca37c)['json'](_0x3d2f90);}return null;};}function patchUpdates(_0x3d59e7){return function(_0x473d97){try{jsonpatch['apply'](_0x473d97,_0x3d59e7,!![]);}catch(_0x207f46){return BPromise[_0x10a3('0x22')](_0x207f46);}return _0x473d97[_0x10a3('0x23')]();};}function saveUpdates(_0x3dc50b,_0x73f219){return function(_0x48b241){if(_0x48b241){return _0x48b241[_0x10a3('0x24')](_0x3dc50b)[_0x10a3('0x25')](function(_0x57e92e){return _0x57e92e;});}return null;};}function removeEntity(_0x41e700,_0x3e17d7){return function(_0x3045af){if(_0x3045af){return _0x3045af[_0x10a3('0x26')]()[_0x10a3('0x25')](function(){var _0x40bf13=_0x3045af[_0x10a3('0x27')]({'plain':!![]});var _0x35c101=_0x10a3('0x28');return db[_0x10a3('0x29')][_0x10a3('0x26')]({'where':{'type':_0x35c101,'resourceId':_0x40bf13['id']}})[_0x10a3('0x25')](function(){return _0x3045af;});})[_0x10a3('0x25')](function(){_0x41e700[_0x10a3('0x1a')](0xcc)[_0x10a3('0x2a')]();});}};}function handleEntityNotFound(_0x26215e,_0xbc83ff){return function(_0x2603c7){if(!_0x2603c7){_0x26215e['sendStatus'](0x194);}return _0x2603c7;};}function handleError(_0x213d2e,_0x5b4006){_0x5b4006=_0x5b4006||0x1f4;return function(_0x25c482){logger[_0x10a3('0x2b')](_0x25c482[_0x10a3('0x2c')]);if(_0x25c482[_0x10a3('0x2d')]){delete _0x25c482[_0x10a3('0x2d')];}_0x213d2e[_0x10a3('0x1a')](_0x5b4006)[_0x10a3('0x2e')](_0x25c482);};}exports['index']=function(_0x4b70e6,_0x359743){var _0x1bdec3={},_0x544822={},_0xc4e615={'count':0x0,'rows':[]};var _0x559c5a=_['map'](db[_0x10a3('0x2f')][_0x10a3('0x30')],function(_0x4c6648){return{'name':_0x4c6648[_0x10a3('0x31')],'type':_0x4c6648[_0x10a3('0x32')]['key']};});_0x544822['model']=_[_0x10a3('0x33')](_0x559c5a,'name');_0x544822['query']=_[_0x10a3('0x34')](_0x4b70e6[_0x10a3('0x35')]);_0x544822[_0x10a3('0x36')]=_['intersection'](_0x544822[_0x10a3('0x37')],_0x544822[_0x10a3('0x35')]);_0x1bdec3[_0x10a3('0x38')]=_[_0x10a3('0x39')](_0x544822['model'],qs[_0x10a3('0x3a')](_0x4b70e6[_0x10a3('0x35')]['fields']));_0x1bdec3['attributes']=_0x1bdec3[_0x10a3('0x38')][_0x10a3('0x3b')]?_0x1bdec3['attributes']:_0x544822['model'];if(!_0x4b70e6[_0x10a3('0x35')]['hasOwnProperty'](_0x10a3('0x3c'))){_0x1bdec3[_0x10a3('0x1f')]=qs['limit'](_0x4b70e6['query']['limit']);_0x1bdec3[_0x10a3('0x1c')]=qs[_0x10a3('0x1c')](_0x4b70e6[_0x10a3('0x35')]['offset']);}_0x1bdec3['order']=qs[_0x10a3('0x3d')](_0x4b70e6[_0x10a3('0x35')][_0x10a3('0x3d')]);_0x1bdec3['where']=qs['filters'](_['pick'](_0x4b70e6[_0x10a3('0x35')],_0x544822[_0x10a3('0x36')]),_0x559c5a);if(_0x4b70e6[_0x10a3('0x35')]['filter']){_0x1bdec3[_0x10a3('0x3e')]=_['merge'](_0x1bdec3[_0x10a3('0x3e')],{'$or':_['map'](_0x559c5a,function(_0x523305){if(_0x523305['type']!=='VIRTUAL'){var _0x219813={};_0x219813[_0x523305[_0x10a3('0x2d')]]={'$like':'%'+_0x4b70e6[_0x10a3('0x35')][_0x10a3('0x3f')]+'%'};return _0x219813;}})});}_0x1bdec3=_[_0x10a3('0x40')]({},_0x1bdec3,_0x4b70e6[_0x10a3('0x41')]);var _0x9d58ac={'where':_0x1bdec3[_0x10a3('0x3e')]};return db[_0x10a3('0x2f')][_0x10a3('0x1e')](_0x9d58ac)[_0x10a3('0x25')](function(_0x1038a1){_0xc4e615[_0x10a3('0x1e')]=_0x1038a1;if(_0x4b70e6[_0x10a3('0x35')][_0x10a3('0x42')]){_0x1bdec3['include']=[{'all':!![]}];}return db[_0x10a3('0x2f')][_0x10a3('0x43')](_0x1bdec3);})[_0x10a3('0x25')](function(_0x332eae){_0xc4e615[_0x10a3('0x44')]=_0x332eae;return _0xc4e615;})[_0x10a3('0x25')](respondWithFilteredResult(_0x359743,_0x1bdec3))[_0x10a3('0x45')](handleError(_0x359743,null));};exports[_0x10a3('0x46')]=function(_0x45565b,_0x33fd74){var _0x375057={'raw':!![],'where':{'id':_0x45565b[_0x10a3('0x47')]['id']}},_0x2dfd6d={};_0x2dfd6d['model']=_['keys'](db[_0x10a3('0x2f')][_0x10a3('0x30')]);_0x2dfd6d[_0x10a3('0x35')]=_['keys'](_0x45565b[_0x10a3('0x35')]);_0x2dfd6d[_0x10a3('0x36')]=_[_0x10a3('0x39')](_0x2dfd6d['model'],_0x2dfd6d[_0x10a3('0x35')]);_0x375057[_0x10a3('0x38')]=_[_0x10a3('0x39')](_0x2dfd6d[_0x10a3('0x37')],qs[_0x10a3('0x3a')](_0x45565b[_0x10a3('0x35')][_0x10a3('0x3a')]));_0x375057['attributes']=_0x375057[_0x10a3('0x38')][_0x10a3('0x3b')]?_0x375057[_0x10a3('0x38')]:_0x2dfd6d[_0x10a3('0x37')];if(_0x45565b[_0x10a3('0x35')]['includeAll']){_0x375057[_0x10a3('0x48')]=[{'all':!![]}];}_0x375057=_[_0x10a3('0x40')]({},_0x375057,_0x45565b[_0x10a3('0x41')]);return db[_0x10a3('0x2f')][_0x10a3('0x49')](_0x375057)[_0x10a3('0x25')](handleEntityNotFound(_0x33fd74,null))[_0x10a3('0x25')](respondWithResult(_0x33fd74,null))[_0x10a3('0x45')](handleError(_0x33fd74,null));};exports[_0x10a3('0x4a')]=function(_0x425075,_0x21d61c){return db[_0x10a3('0x2f')][_0x10a3('0x4a')](_0x425075[_0x10a3('0x4b')],{})[_0x10a3('0x25')](function(_0x8a3bad){var _0x2d543a=_0x425075[_0x10a3('0x4c')][_0x10a3('0x27')]({'plain':!![]});if(!_0x2d543a)throw new Error(_0x10a3('0x4d'));if(_0x2d543a[_0x10a3('0x4e')]==='user'){var _0x2368ad=_0x8a3bad['get']({'plain':!![]});var _0x2cb782=_0x10a3('0x28');return db[_0x10a3('0x4f')]['find']({'where':{'name':_0x2cb782,'userProfileId':_0x2d543a[_0x10a3('0x50')]},'raw':!![]})[_0x10a3('0x25')](function(_0x18fe14){if(_0x18fe14&&_0x18fe14['autoAssociation']===0x0){return db['UserProfileResource'][_0x10a3('0x4a')]({'name':_0x2368ad[_0x10a3('0x2d')],'resourceId':_0x2368ad['id'],'type':_0x18fe14[_0x10a3('0x2d')],'sectionId':_0x18fe14['id']},{})[_0x10a3('0x25')](function(){return _0x8a3bad;});}else{return _0x8a3bad;}})[_0x10a3('0x45')](function(_0x2c6680){logger[_0x10a3('0x2b')](_0x10a3('0x51'),_0x2c6680);throw _0x2c6680;});}return _0x8a3bad;})[_0x10a3('0x25')](respondWithResult(_0x21d61c,0xc9))[_0x10a3('0x45')](handleError(_0x21d61c,null));};exports['update']=function(_0x542b37,_0x1bc7e6){if(_0x542b37['body']['id']){delete _0x542b37['body']['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x542b37[_0x10a3('0x47')]['id']}})[_0x10a3('0x25')](handleEntityNotFound(_0x1bc7e6,null))['then'](saveUpdates(_0x542b37[_0x10a3('0x4b')],null))[_0x10a3('0x25')](respondWithResult(_0x1bc7e6,null))['catch'](handleError(_0x1bc7e6,null));};exports[_0x10a3('0x26')]=function(_0x5d8b56,_0x237a73){return db['SquareOdbc']['find']({'where':{'id':_0x5d8b56['params']['id']}})[_0x10a3('0x25')](handleEntityNotFound(_0x237a73,null))[_0x10a3('0x25')](removeEntity(_0x237a73,null))[_0x10a3('0x45')](handleError(_0x237a73,null));};exports[_0x10a3('0x52')]=function(_0x261f5a,_0x47d6dc,_0x4af5b6){var _0x29414d;return db[_0x10a3('0x2f')]['find']({'where':{'id':_0x261f5a[_0x10a3('0x47')]['id']},'attributes':['id',_0x10a3('0x53')]})[_0x10a3('0x25')](handleEntityNotFound(_0x47d6dc,null))['then'](function(_0x430ee1){if(_0x430ee1){var _0x256ffe=require('odbc')();_0x256ffe[_0x10a3('0x54')](_0x430ee1[_0x10a3('0x53')]);_0x256ffe[_0x10a3('0x55')]();return _0x430ee1;}})[_0x10a3('0x25')](respondWithResult(_0x47d6dc,null))[_0x10a3('0x45')](handleError(_0x47d6dc,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 67f8e1c..69d13e9 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 _0x0de8=['square_odbc','lodash','util','moment','bluebird','request-promise','path','rimraf','./squareOdbc.attributes','SquareOdbc'];(function(_0x1bb6aa,_0x40fe82){var _0x2ef28e=function(_0x32b4eb){while(--_0x32b4eb){_0x1bb6aa['push'](_0x1bb6aa['shift']());}};_0x2ef28e(++_0x40fe82);}(_0x0de8,0xa1));var _0x80de=function(_0x38d9cb,_0x30654d){_0x38d9cb=_0x38d9cb-0x0;var _0x15102a=_0x0de8[_0x38d9cb];return _0x15102a;};'use strict';var _=require(_0x80de('0x0'));var util=require(_0x80de('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x80de('0x2'));var BPromise=require(_0x80de('0x3'));var rp=require(_0x80de('0x4'));var fs=require('fs');var path=require(_0x80de('0x5'));var rimraf=require(_0x80de('0x6'));var config=require('../../config/environment');var attributes=require(_0x80de('0x7'));module['exports']=function(_0x15e469,_0x5a2a2a){return _0x15e469['define'](_0x80de('0x8'),attributes,{'tableName':_0x80de('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6554=['exports','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareOdbc.attributes'];(function(_0x109214,_0x53102a){var _0x4faf0f=function(_0x4a81a7){while(--_0x4a81a7){_0x109214['push'](_0x109214['shift']());}};_0x4faf0f(++_0x53102a);}(_0x6554,0xed));var _0x4655=function(_0x3aff6c,_0x29e141){_0x3aff6c=_0x3aff6c-0x0;var _0x229d9e=_0x6554[_0x3aff6c];return _0x229d9e;};'use strict';var _=require(_0x4655('0x0'));var util=require(_0x4655('0x1'));var logger=require(_0x4655('0x2'))(_0x4655('0x3'));var moment=require(_0x4655('0x4'));var BPromise=require(_0x4655('0x5'));var rp=require(_0x4655('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4655('0x7'));var config=require(_0x4655('0x8'));var attributes=require(_0x4655('0x9'));module[_0x4655('0xa')]=function(_0x2b273c,_0x271a3c){return _0x2b273c['define'](_0x4655('0xb'),attributes,{'tableName':_0x4655('0xc'),'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 633f9ff..8d53a14 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 _0x8ddf=['debug','stringify','code','message','error','result','ShowSquareOdbc','find','options','raw','attributes','include','map','model','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent'];(function(_0x3e6b2f,_0x1ffa07){var _0x323215=function(_0x5c4d82){while(--_0x5c4d82){_0x3e6b2f['push'](_0x3e6b2f['shift']());}};_0x323215(++_0x1ffa07);}(_0x8ddf,0x1df));var _0xf8dd=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x8ddf[_0x3054be];return _0x3df150;};'use strict';var _=require('lodash');var util=require(_0xf8dd('0x0'));var moment=require(_0xf8dd('0x1'));var BPromise=require(_0xf8dd('0x2'));var rs=require(_0xf8dd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf8dd('0x4'))['db'];var utils=require(_0xf8dd('0x5'));var logger=require(_0xf8dd('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf8dd('0x7'));var client=jayson['client'][_0xf8dd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f3534,_0x5bf91f,_0x4b1026){return new BPromise(function(_0x1b44af,_0x5906b2){return client[_0xf8dd('0x9')](_0x2f3534,_0x4b1026)[_0xf8dd('0xa')](function(_0x4b353e){logger[_0xf8dd('0xb')](_0xf8dd('0xc'),_0x5bf91f,_0xf8dd('0xd'));logger[_0xf8dd('0xe')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x5bf91f,_0xf8dd('0xd'),JSON[_0xf8dd('0xf')](_0x4b353e));if(_0x4b353e['error']){if(_0x4b353e['error'][_0xf8dd('0x10')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x5bf91f,_0x4b353e['error'][_0xf8dd('0x11')]);return _0x5906b2(_0x4b353e['error']['message']);}logger[_0xf8dd('0x12')](_0xf8dd('0xc'),_0x5bf91f,_0x4b353e[_0xf8dd('0x12')][_0xf8dd('0x11')]);return _0x1b44af(_0x4b353e[_0xf8dd('0x12')][_0xf8dd('0x11')]);}else{logger[_0xf8dd('0xb')]('SquareOdbc,\x20%s,\x20%s',_0x5bf91f,_0xf8dd('0xd'));_0x1b44af(_0x4b353e[_0xf8dd('0x13')]['message']);}})['catch'](function(_0x26429d){logger[_0xf8dd('0x12')](_0xf8dd('0xc'),_0x5bf91f,_0x26429d);_0x5906b2(_0x26429d);});});}exports[_0xf8dd('0x14')]=function(_0x4df94e){var _0x4a3444=this;return new Promise(function(_0x8885cd,_0x5524af){return db['SquareOdbc'][_0xf8dd('0x15')]({'raw':_0x4df94e['options']?_0x4df94e[_0xf8dd('0x16')][_0xf8dd('0x17')]===undefined?!![]:![]:!![],'where':_0x4df94e['options']?_0x4df94e[_0xf8dd('0x16')]['where']||null:null,'attributes':_0x4df94e[_0xf8dd('0x16')]?_0x4df94e['options'][_0xf8dd('0x18')]||null:null,'include':_0x4df94e[_0xf8dd('0x16')]?_0x4df94e[_0xf8dd('0x16')]['include']?_['map'](_0x4df94e[_0xf8dd('0x16')][_0xf8dd('0x19')],function(_0x8ca1d9){return{'model':db[_0x8ca1d9['model']],'as':_0x8ca1d9['as'],'attributes':_0x8ca1d9['attributes'],'include':_0x8ca1d9[_0xf8dd('0x19')]?_[_0xf8dd('0x1a')](_0x8ca1d9[_0xf8dd('0x19')],function(_0x4ce02f){return{'model':db[_0x4ce02f[_0xf8dd('0x1b')]],'as':_0x4ce02f['as'],'attributes':_0x4ce02f['attributes'],'include':_0x4ce02f['include']?_[_0xf8dd('0x1a')](_0x4ce02f[_0xf8dd('0x19')],function(_0xcbcc77){return{'model':db[_0xcbcc77[_0xf8dd('0x1b')]],'as':_0xcbcc77['as'],'attributes':_0xcbcc77[_0xf8dd('0x18')]};}):[]};}):[]};}):[]:[]})[_0xf8dd('0xa')](function(_0x18e5e6){logger['info'](_0xf8dd('0x14'),_0x4df94e);logger[_0xf8dd('0xe')](_0xf8dd('0x14'),_0x4df94e,JSON[_0xf8dd('0xf')](_0x18e5e6));_0x8885cd(_0x18e5e6);})[_0xf8dd('0x1c')](function(_0x53f68f){logger[_0xf8dd('0x12')](_0xf8dd('0x14'),_0x53f68f[_0xf8dd('0x11')],_0x4df94e);_0x5524af(_0x4a3444[_0xf8dd('0x12')](0x1f4,_0x53f68f[_0xf8dd('0x11')]));});});}; \ No newline at end of file +var _0x1c58=['catch','SquareOdbc','options','raw','where','attributes','include','map','model','then','ShowSquareOdbc','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','info','result'];(function(_0x303d67,_0x46e74f){var _0x277c3f=function(_0x39717d){while(--_0x39717d){_0x303d67['push'](_0x303d67['shift']());}};_0x277c3f(++_0x46e74f);}(_0x1c58,0x16b));var _0x81c5=function(_0x587354,_0x389234){_0x587354=_0x587354-0x0;var _0x459567=_0x1c58[_0x587354];return _0x459567;};'use strict';var _=require(_0x81c5('0x0'));var util=require(_0x81c5('0x1'));var moment=require(_0x81c5('0x2'));var BPromise=require(_0x81c5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x81c5('0x4'));var db=require(_0x81c5('0x5'))['db'];var utils=require(_0x81c5('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x81c5('0x7'));var jayson=require(_0x81c5('0x8'));var client=jayson[_0x81c5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26edac,_0x29fd30,_0x55e808){return new BPromise(function(_0x3d4883,_0x19b3d8){return client[_0x81c5('0xa')](_0x26edac,_0x55e808)['then'](function(_0xe1aa83){logger['info']('SquareOdbc,\x20%s,\x20%s',_0x29fd30,'request\x20sent');logger[_0x81c5('0xb')](_0x81c5('0xc'),_0x29fd30,_0x81c5('0xd'),JSON[_0x81c5('0xe')](_0xe1aa83));if(_0xe1aa83['error']){if(_0xe1aa83[_0x81c5('0xf')][_0x81c5('0x10')]===0x1f4){logger[_0x81c5('0xf')](_0x81c5('0x11'),_0x29fd30,_0xe1aa83[_0x81c5('0xf')][_0x81c5('0x12')]);return _0x19b3d8(_0xe1aa83[_0x81c5('0xf')][_0x81c5('0x12')]);}logger['error'](_0x81c5('0x11'),_0x29fd30,_0xe1aa83[_0x81c5('0xf')][_0x81c5('0x12')]);return _0x3d4883(_0xe1aa83[_0x81c5('0xf')]['message']);}else{logger[_0x81c5('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x29fd30,_0x81c5('0xd'));_0x3d4883(_0xe1aa83[_0x81c5('0x14')]['message']);}})[_0x81c5('0x15')](function(_0x1ba41d){logger[_0x81c5('0xf')](_0x81c5('0x11'),_0x29fd30,_0x1ba41d);_0x19b3d8(_0x1ba41d);});});}exports['ShowSquareOdbc']=function(_0x1f1043){var _0x5d3b87=this;return new Promise(function(_0x3b9a7d,_0x4b702b){return db[_0x81c5('0x16')]['find']({'raw':_0x1f1043['options']?_0x1f1043[_0x81c5('0x17')][_0x81c5('0x18')]===undefined?!![]:![]:!![],'where':_0x1f1043[_0x81c5('0x17')]?_0x1f1043[_0x81c5('0x17')][_0x81c5('0x19')]||null:null,'attributes':_0x1f1043['options']?_0x1f1043[_0x81c5('0x17')][_0x81c5('0x1a')]||null:null,'include':_0x1f1043[_0x81c5('0x17')]?_0x1f1043[_0x81c5('0x17')][_0x81c5('0x1b')]?_[_0x81c5('0x1c')](_0x1f1043[_0x81c5('0x17')]['include'],function(_0x41fee0){return{'model':db[_0x41fee0[_0x81c5('0x1d')]],'as':_0x41fee0['as'],'attributes':_0x41fee0['attributes'],'include':_0x41fee0['include']?_['map'](_0x41fee0[_0x81c5('0x1b')],function(_0x1e2cf8){return{'model':db[_0x1e2cf8['model']],'as':_0x1e2cf8['as'],'attributes':_0x1e2cf8[_0x81c5('0x1a')],'include':_0x1e2cf8[_0x81c5('0x1b')]?_[_0x81c5('0x1c')](_0x1e2cf8[_0x81c5('0x1b')],function(_0x4cf166){return{'model':db[_0x4cf166[_0x81c5('0x1d')]],'as':_0x4cf166['as'],'attributes':_0x4cf166[_0x81c5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x81c5('0x1e')](function(_0xf75266){logger['info'](_0x81c5('0x1f'),_0x1f1043);logger[_0x81c5('0xb')](_0x81c5('0x1f'),_0x1f1043,JSON[_0x81c5('0xe')](_0xf75266));_0x3b9a7d(_0xf75266);})[_0x81c5('0x15')](function(_0x1f1c8e){logger[_0x81c5('0xf')]('ShowSquareOdbc',_0x1f1c8e[_0x81c5('0x12')],_0x1f1043);_0x4b702b(_0x5d3b87[_0x81c5('0xf')](0x1f4,_0x1f1c8e['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 3c1ba93..b68e1df 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 _0x62c0=['util','path','connect-timeout','../../components/auth/service','../../config/environment','./squareProject.controller','get','index','isAuthenticated','/:id/users','getUsers','post','create','addUsers','put','update','delete','/:id','destroy','removeUsers','exports','multer'];(function(_0x16c4a1,_0x5e8c53){var _0x2bc4ec=function(_0x2cfe20){while(--_0x2cfe20){_0x16c4a1['push'](_0x16c4a1['shift']());}};_0x2bc4ec(++_0x5e8c53);}(_0x62c0,0xdb));var _0x062c=function(_0x81e39d,_0x4c3934){_0x81e39d=_0x81e39d-0x0;var _0x548fbb=_0x62c0[_0x81e39d];return _0x548fbb;};'use strict';var multer=require(_0x062c('0x0'));var util=require(_0x062c('0x1'));var path=require(_0x062c('0x2'));var timeout=require(_0x062c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x062c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x062c('0x5'));var controller=require(_0x062c('0x6'));router[_0x062c('0x7')]('/',auth['isAuthenticated'](),controller[_0x062c('0x8')]);router[_0x062c('0x7')]('/:id',auth[_0x062c('0x9')](),controller['show']);router[_0x062c('0x7')](_0x062c('0xa'),auth[_0x062c('0x9')](),controller[_0x062c('0xb')]);router[_0x062c('0xc')]('/',auth[_0x062c('0x9')](),controller[_0x062c('0xd')]);router['post'](_0x062c('0xa'),auth[_0x062c('0x9')](),controller[_0x062c('0xe')]);router[_0x062c('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x062c('0x10')]);router[_0x062c('0x11')](_0x062c('0x12'),auth['isAuthenticated'](),controller[_0x062c('0x13')]);router['delete'](_0x062c('0xa'),auth[_0x062c('0x9')](),controller[_0x062c('0x14')]);module[_0x062c('0x15')]=router; \ No newline at end of file +var _0x68ee=['get','isAuthenticated','/:id','show','getUsers','create','post','/:id/users','addUsers','update','delete','removeUsers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x2ca1c4,_0x22186a){var _0x53077b=function(_0x2a1e46){while(--_0x2a1e46){_0x2ca1c4['push'](_0x2ca1c4['shift']());}};_0x53077b(++_0x22186a);}(_0x68ee,0xd3));var _0xe68e=function(_0x187f18,_0x228a1d){_0x187f18=_0x187f18-0x0;var _0x134d94=_0x68ee[_0x187f18];return _0x134d94;};'use strict';var multer=require(_0xe68e('0x0'));var util=require(_0xe68e('0x1'));var path=require(_0xe68e('0x2'));var timeout=require(_0xe68e('0x3'));var express=require(_0xe68e('0x4'));var router=express[_0xe68e('0x5')]();var fs_extra=require(_0xe68e('0x6'));var auth=require(_0xe68e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe68e('0x8'));var controller=require('./squareProject.controller');router[_0xe68e('0x9')]('/',auth[_0xe68e('0xa')](),controller['index']);router[_0xe68e('0x9')](_0xe68e('0xb'),auth['isAuthenticated'](),controller[_0xe68e('0xc')]);router[_0xe68e('0x9')]('/:id/users',auth[_0xe68e('0xa')](),controller[_0xe68e('0xd')]);router['post']('/',auth[_0xe68e('0xa')](),controller[_0xe68e('0xe')]);router[_0xe68e('0xf')](_0xe68e('0x10'),auth[_0xe68e('0xa')](),controller[_0xe68e('0x11')]);router['put']('/:id',auth[_0xe68e('0xa')](),controller[_0xe68e('0x12')]);router[_0xe68e('0x13')](_0xe68e('0xb'),auth[_0xe68e('0xa')](),controller['destroy']);router[_0xe68e('0x13')]('/:id/users',auth[_0xe68e('0xa')](),controller[_0xe68e('0x14')]);module[_0xe68e('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 14a4268..36de2eb 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 _0x6afc=['sequelize','STRING','TEXT','long','getDataValue','preproduction','toString','utf8','BLOB','production','DATE'];(function(_0x10bd3b,_0x50fee9){var _0x5d1fd6=function(_0xcd9cd8){while(--_0xcd9cd8){_0x10bd3b['push'](_0x10bd3b['shift']());}};_0x5d1fd6(++_0x50fee9);}(_0x6afc,0x16b));var _0xc6af=function(_0x5e2910,_0x22d253){_0x5e2910=_0x5e2910-0x0;var _0x305995=_0x6afc[_0x5e2910];return _0x305995;};'use strict';var Sequelize=require(_0xc6af('0x0'));module['exports']={'name':{'type':Sequelize[_0xc6af('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xc6af('0x1')]},'notes':{'type':Sequelize[_0xc6af('0x2')]},'preproduction':{'type':Sequelize['BLOB'](_0xc6af('0x3')),'get':function(){if(this[_0xc6af('0x4')](_0xc6af('0x5'))){return this[_0xc6af('0x4')]('preproduction')[_0xc6af('0x6')](_0xc6af('0x7'));}}},'production':{'type':Sequelize[_0xc6af('0x8')](_0xc6af('0x3')),'get':function(){if(this[_0xc6af('0x4')](_0xc6af('0x9'))){return this['getDataValue'](_0xc6af('0x9'))[_0xc6af('0x6')]('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xc6af('0xa')]}}; \ No newline at end of file +var _0x9960=['production','toString','DATE','sequelize','exports','STRING','TEXT','BLOB','long','getDataValue','preproduction','utf8'];(function(_0x5aed3b,_0x5152ca){var _0x17cbf7=function(_0x340221){while(--_0x340221){_0x5aed3b['push'](_0x5aed3b['shift']());}};_0x17cbf7(++_0x5152ca);}(_0x9960,0x147));var _0x0996=function(_0x3adb0a,_0x575adf){_0x3adb0a=_0x3adb0a-0x0;var _0x33ddc0=_0x9960[_0x3adb0a];return _0x33ddc0;};'use strict';var Sequelize=require(_0x0996('0x0'));module[_0x0996('0x1')]={'name':{'type':Sequelize[_0x0996('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x0996('0x3')]},'preproduction':{'type':Sequelize[_0x0996('0x4')](_0x0996('0x5')),'get':function(){if(this[_0x0996('0x6')](_0x0996('0x7'))){return this[_0x0996('0x6')](_0x0996('0x7'))['toString'](_0x0996('0x8'));}}},'production':{'type':Sequelize[_0x0996('0x4')]('long'),'get':function(){if(this[_0x0996('0x6')](_0x0996('0x9'))){return this[_0x0996('0x6')](_0x0996('0x9'))[_0x0996('0xa')]('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x0996('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 5cd6c3d..732d8f1 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 _0x05e8=['jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./squareProject.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','get','SquareProjects','UserProfileResource','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','SquareProject','includeAll','include','findAll','catch','params','length','find','create','body','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','userSquareProject:remove','emit','findOne','User','getUsers','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash'];(function(_0x29c768,_0x56446f){var _0x19fcdb=function(_0x2ee4a8){while(--_0x2ee4a8){_0x29c768['push'](_0x29c768['shift']());}};_0x19fcdb(++_0x56446f);}(_0x05e8,0x1bd));var _0x805e=function(_0x171d6f,_0x1fffad){_0x171d6f=_0x171d6f-0x0;var _0x8f2028=_0x05e8[_0x171d6f];return _0x8f2028;};'use strict';var emlformat=require(_0x805e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x805e('0x1'));var jsonpatch=require(_0x805e('0x2'));var rp=require(_0x805e('0x3'));var moment=require('moment');var BPromise=require(_0x805e('0x4'));var Mustache=require(_0x805e('0x5'));var util=require('util');var path=require(_0x805e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x805e('0x7'));var fs=require('fs');var fs_extra=require(_0x805e('0x8'));var _=require(_0x805e('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x805e('0xa'));var deskjs=require(_0x805e('0xb'));var toCsv=require(_0x805e('0xc'));var querystring=require(_0x805e('0xd'));var Papa=require(_0x805e('0xe'));var Redis=require('ioredis');var authService=require(_0x805e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x805e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x805e('0x11'));var config=require(_0x805e('0x12'));var licenseUtil=require(_0x805e('0x13'));var db=require(_0x805e('0x14'))['db'];config[_0x805e('0x15')]=_[_0x805e('0x16')](config[_0x805e('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x805e('0x15')]));require(_0x805e('0x17'))[_0x805e('0x18')](socket);function respondWithStatusCode(_0xd6f482,_0x501b27){_0x501b27=_0x501b27||0xcc;return function(_0x41b3bb){if(_0x41b3bb){return _0xd6f482['sendStatus'](_0x501b27);}return _0xd6f482[_0x805e('0x19')](_0x501b27)[_0x805e('0x1a')]();};}function respondWithResult(_0x427861,_0xe0d2de){_0xe0d2de=_0xe0d2de||0xc8;return function(_0x3ab2e3){if(_0x3ab2e3){return _0x427861[_0x805e('0x19')](_0xe0d2de)[_0x805e('0x1b')](_0x3ab2e3);}};}function respondWithFilteredResult(_0x167d16,_0x3aadc1){return function(_0x30123b){if(_0x30123b){var _0x202116=typeof _0x3aadc1[_0x805e('0x1c')]===_0x805e('0x1d')&&typeof _0x3aadc1[_0x805e('0x1e')]===_0x805e('0x1d');var _0x3243c4=_0x30123b[_0x805e('0x1f')];var _0x22ea5f=_0x202116?0x0:_0x3aadc1[_0x805e('0x1c')];var _0xb06a9=_0x202116?_0x30123b[_0x805e('0x1f')]:_0x3aadc1[_0x805e('0x1c')]+_0x3aadc1['limit'];var _0x422d9b;if(_0xb06a9>=_0x3243c4){_0xb06a9=_0x3243c4;_0x422d9b=0xc8;}else{_0x422d9b=0xce;}_0x167d16[_0x805e('0x19')](_0x422d9b);return _0x167d16[_0x805e('0x20')](_0x805e('0x21'),_0x22ea5f+'-'+_0xb06a9+'/'+_0x3243c4)[_0x805e('0x1b')](_0x30123b);}return null;};}function patchUpdates(_0x50fa2a){return function(_0x1eaec4){try{jsonpatch['apply'](_0x1eaec4,_0x50fa2a,!![]);}catch(_0x31a3b7){return BPromise[_0x805e('0x22')](_0x31a3b7);}return _0x1eaec4['save']();};}function saveUpdates(_0x5cfa06,_0x27ee85){return function(_0x42a513){if(_0x42a513){return _0x42a513[_0x805e('0x23')](_0x5cfa06)['then'](function(_0x5f4fe7){return _0x5f4fe7;});}return null;};}function removeEntity(_0x204892,_0x252858){return function(_0x5e5d51){if(_0x5e5d51){return _0x5e5d51['destroy']()[_0x805e('0x24')](function(){var _0xf22e42=_0x5e5d51[_0x805e('0x25')]({'plain':!![]});var _0x4d20d7=_0x805e('0x26');return db[_0x805e('0x27')][_0x805e('0x28')]({'where':{'type':_0x4d20d7,'resourceId':_0xf22e42['id']}})[_0x805e('0x24')](function(){return _0x5e5d51;});})[_0x805e('0x24')](function(){_0x204892[_0x805e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe67cb0,_0x4d4a67){return function(_0x2db691){if(!_0x2db691){_0xe67cb0[_0x805e('0x29')](0x194);}return _0x2db691;};}function handleError(_0x36a615,_0x12553a){_0x12553a=_0x12553a||0x1f4;return function(_0x22f0b5){logger[_0x805e('0x2a')](_0x22f0b5[_0x805e('0x2b')]);if(_0x22f0b5[_0x805e('0x2c')]){delete _0x22f0b5['name'];}_0x36a615['status'](_0x12553a)['send'](_0x22f0b5);};}exports[_0x805e('0x2d')]=function(_0x21ed9b,_0x5454d4){var _0x582f4d={},_0x3006a2={},_0x459069={'count':0x0,'rows':[]};var _0x5d4583=_[_0x805e('0x2e')](db['SquareProject'][_0x805e('0x2f')],function(_0x499175){return{'name':_0x499175[_0x805e('0x30')],'type':_0x499175[_0x805e('0x31')][_0x805e('0x32')]};});_0x3006a2[_0x805e('0x33')]=_[_0x805e('0x2e')](_0x5d4583,'name');_0x3006a2[_0x805e('0x34')]=_[_0x805e('0x35')](_0x21ed9b[_0x805e('0x34')]);_0x3006a2[_0x805e('0x36')]=_[_0x805e('0x37')](_0x3006a2['model'],_0x3006a2[_0x805e('0x34')]);_0x582f4d[_0x805e('0x38')]=_[_0x805e('0x37')](_0x3006a2[_0x805e('0x33')],qs[_0x805e('0x39')](_0x21ed9b[_0x805e('0x34')][_0x805e('0x39')]));_0x582f4d['attributes']=_0x582f4d[_0x805e('0x38')]['length']?_0x582f4d[_0x805e('0x38')]:_0x3006a2[_0x805e('0x33')];if(!_0x21ed9b[_0x805e('0x34')][_0x805e('0x3a')](_0x805e('0x3b'))){_0x582f4d[_0x805e('0x1e')]=qs['limit'](_0x21ed9b[_0x805e('0x34')][_0x805e('0x1e')]);_0x582f4d[_0x805e('0x1c')]=qs[_0x805e('0x1c')](_0x21ed9b[_0x805e('0x34')]['offset']);}_0x582f4d[_0x805e('0x3c')]=qs[_0x805e('0x3d')](_0x21ed9b[_0x805e('0x34')][_0x805e('0x3d')]);_0x582f4d[_0x805e('0x3e')]=qs[_0x805e('0x36')](_[_0x805e('0x3f')](_0x21ed9b['query'],_0x3006a2[_0x805e('0x36')]),_0x5d4583);if(_0x21ed9b[_0x805e('0x34')][_0x805e('0x40')]){_0x582f4d[_0x805e('0x3e')]=_['merge'](_0x582f4d[_0x805e('0x3e')],{'$or':_[_0x805e('0x2e')](_0x5d4583,function(_0x411896){if(_0x411896['type']!==_0x805e('0x41')){var _0x2778d6={};_0x2778d6[_0x411896['name']]={'$like':'%'+_0x21ed9b['query'][_0x805e('0x40')]+'%'};return _0x2778d6;}})});}_0x582f4d=_[_0x805e('0x42')]({},_0x582f4d,_0x21ed9b[_0x805e('0x43')]);var _0x7e0cd8={'where':_0x582f4d['where']};return db[_0x805e('0x44')][_0x805e('0x1f')](_0x7e0cd8)['then'](function(_0x5e16cb){_0x459069[_0x805e('0x1f')]=_0x5e16cb;if(_0x21ed9b[_0x805e('0x34')][_0x805e('0x45')]){_0x582f4d[_0x805e('0x46')]=[{'all':!![]}];}return db['SquareProject'][_0x805e('0x47')](_0x582f4d);})['then'](function(_0x312298){_0x459069['rows']=_0x312298;return _0x459069;})[_0x805e('0x24')](respondWithFilteredResult(_0x5454d4,_0x582f4d))[_0x805e('0x48')](handleError(_0x5454d4,null));};exports['show']=function(_0x322492,_0x44abbb){var _0x435d1f={'raw':![],'where':{'id':_0x322492[_0x805e('0x49')]['id']}},_0x46b883={};_0x46b883[_0x805e('0x33')]=_[_0x805e('0x35')](db[_0x805e('0x44')][_0x805e('0x2f')]);_0x46b883[_0x805e('0x34')]=_[_0x805e('0x35')](_0x322492['query']);_0x46b883[_0x805e('0x36')]=_[_0x805e('0x37')](_0x46b883[_0x805e('0x33')],_0x46b883[_0x805e('0x34')]);_0x435d1f[_0x805e('0x38')]=_[_0x805e('0x37')](_0x46b883['model'],qs[_0x805e('0x39')](_0x322492['query'][_0x805e('0x39')]));_0x435d1f[_0x805e('0x38')]=_0x435d1f[_0x805e('0x38')][_0x805e('0x4a')]?_0x435d1f[_0x805e('0x38')]:_0x46b883['model'];if(_0x322492['query']['includeAll']){_0x435d1f['include']=[{'all':!![]}];}_0x435d1f=_[_0x805e('0x42')]({},_0x435d1f,_0x322492[_0x805e('0x43')]);return db['SquareProject'][_0x805e('0x4b')](_0x435d1f)[_0x805e('0x24')](handleEntityNotFound(_0x44abbb,null))[_0x805e('0x24')](respondWithResult(_0x44abbb,null))[_0x805e('0x48')](handleError(_0x44abbb,null));};exports[_0x805e('0x4c')]=function(_0x22182f,_0x458494){return db[_0x805e('0x44')][_0x805e('0x4c')](_0x22182f[_0x805e('0x4d')],{})[_0x805e('0x24')](function(_0x2832b1){var _0x5583db=_0x22182f['user'][_0x805e('0x25')]({'plain':!![]});if(!_0x5583db)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5583db[_0x805e('0x4e')]===_0x805e('0x4f')){var _0x64d74=_0x2832b1['get']({'plain':!![]});var _0x38f7eb=_0x805e('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x38f7eb,'userProfileId':_0x5583db[_0x805e('0x50')]},'raw':!![]})[_0x805e('0x24')](function(_0x322b21){if(_0x322b21&&_0x322b21['autoAssociation']===0x0){return db[_0x805e('0x27')][_0x805e('0x4c')]({'name':_0x64d74[_0x805e('0x2c')],'resourceId':_0x64d74['id'],'type':_0x322b21['name'],'sectionId':_0x322b21['id']},{})[_0x805e('0x24')](function(){return _0x2832b1;});}else{return _0x2832b1;}})['catch'](function(_0x380fad){logger[_0x805e('0x2a')](_0x805e('0x51'),_0x380fad);throw _0x380fad;});}return _0x2832b1;})['then'](respondWithResult(_0x458494,0xc9))[_0x805e('0x48')](handleError(_0x458494,null));};exports[_0x805e('0x23')]=function(_0x35ec39,_0x353b40){if(_0x35ec39['body']['id']){delete _0x35ec39[_0x805e('0x4d')]['id'];}return db['SquareProject'][_0x805e('0x4b')]({'where':{'id':_0x35ec39[_0x805e('0x49')]['id']}})['then'](handleEntityNotFound(_0x353b40,null))[_0x805e('0x24')](saveUpdates(_0x35ec39[_0x805e('0x4d')],null))[_0x805e('0x24')](respondWithResult(_0x353b40,null))[_0x805e('0x48')](handleError(_0x353b40,null));};exports['destroy']=function(_0x1d6462,_0x3a67ee){return db[_0x805e('0x44')]['find']({'where':{'id':_0x1d6462[_0x805e('0x49')]['id']}})[_0x805e('0x24')](handleEntityNotFound(_0x3a67ee,null))[_0x805e('0x24')](removeEntity(_0x3a67ee,null))[_0x805e('0x48')](handleError(_0x3a67ee,null));};exports[_0x805e('0x52')]=function(_0xe83f8d,_0x2b6efd,_0x249efb){return db[_0x805e('0x44')][_0x805e('0x4b')]({'where':{'id':_0xe83f8d[_0x805e('0x49')]['id']}})['then'](handleEntityNotFound(_0x2b6efd,null))[_0x805e('0x24')](function(_0x586de8){if(_0x586de8){return _0x586de8[_0x805e('0x52')](_0xe83f8d[_0x805e('0x4d')][_0x805e('0x53')],_[_0x805e('0x54')](_0xe83f8d[_0x805e('0x4d')],[_0x805e('0x53'),'id'])||{});}})[_0x805e('0x24')](respondWithResult(_0x2b6efd,null))[_0x805e('0x48')](handleError(_0x2b6efd,null));};exports[_0x805e('0x55')]=function(_0x47843b,_0xd2ab83,_0x92d490){return db[_0x805e('0x44')]['find']({'where':{'id':_0x47843b[_0x805e('0x49')]['id']}})[_0x805e('0x24')](handleEntityNotFound(_0xd2ab83,null))['then'](function(_0x574be9){if(_0x574be9){return _0x574be9[_0x805e('0x55')](_0x47843b[_0x805e('0x34')]['ids'])['then'](function(){if(_['isArray'](_0x47843b[_0x805e('0x34')][_0x805e('0x53')])){for(var _0x3c365a=0x0;_0x3c365a<_0x47843b[_0x805e('0x34')]['ids'][_0x805e('0x4a')];_0x3c365a+=0x1){socket['emit'](_0x805e('0x56'),{'UserId':Number(_0x47843b[_0x805e('0x34')][_0x805e('0x53')][_0x3c365a]),'SquareProjectId':Number(_0x47843b[_0x805e('0x49')]['id'])});}}else{socket[_0x805e('0x57')](_0x805e('0x56'),{'UserId':Number(_0x47843b[_0x805e('0x34')][_0x805e('0x53')]),'SquareProjectId':Number(_0x47843b[_0x805e('0x49')]['id'])});}});}})[_0x805e('0x24')](respondWithStatusCode(_0xd2ab83,null))[_0x805e('0x48')](handleError(_0xd2ab83,null));};exports['getUsers']=function(_0x10346d,_0x2d8a06,_0x1d9ddb){var _0x290670={};var _0x279825={};var _0x1266b6;var _0x57597d;return db[_0x805e('0x44')][_0x805e('0x58')]({'where':{'id':_0x10346d[_0x805e('0x49')]['id']}})[_0x805e('0x24')](handleEntityNotFound(_0x2d8a06,null))[_0x805e('0x24')](function(_0x3e46b3){if(_0x3e46b3){_0x1266b6=_0x3e46b3;_0x279825[_0x805e('0x33')]=_['keys'](db[_0x805e('0x59')][_0x805e('0x2f')]);_0x279825[_0x805e('0x34')]=_[_0x805e('0x35')](_0x10346d['query']);_0x279825[_0x805e('0x36')]=_['intersection'](_0x279825[_0x805e('0x33')],_0x279825['query']);_0x290670[_0x805e('0x38')]=_[_0x805e('0x37')](_0x279825[_0x805e('0x33')],qs['fields'](_0x10346d[_0x805e('0x34')][_0x805e('0x39')]));_0x290670[_0x805e('0x38')]=_0x290670[_0x805e('0x38')]['length']?_0x290670['attributes']:_0x279825[_0x805e('0x33')];_0x290670[_0x805e('0x3c')]=qs[_0x805e('0x3d')](_0x10346d['query'][_0x805e('0x3d')]);_0x290670[_0x805e('0x3e')]=qs[_0x805e('0x36')](_['pick'](_0x10346d[_0x805e('0x34')],_0x279825[_0x805e('0x36')]));if(_0x10346d[_0x805e('0x34')]['filter']){_0x290670[_0x805e('0x3e')]=_[_0x805e('0x42')](_0x290670[_0x805e('0x3e')],{'$or':_['map'](_0x290670[_0x805e('0x38')],function(_0x2672b1){var _0x32699b={};_0x32699b[_0x2672b1]={'$like':'%'+_0x10346d[_0x805e('0x34')]['filter']+'%'};return _0x32699b;})});}_0x290670=_[_0x805e('0x42')]({},_0x290670,_0x10346d[_0x805e('0x43')]);return _0x1266b6[_0x805e('0x5a')](_0x290670);}})[_0x805e('0x24')](function(_0x570141){if(_0x570141){_0x57597d=_0x570141[_0x805e('0x4a')];if(!_0x10346d['query'][_0x805e('0x3a')](_0x805e('0x3b'))){_0x290670['limit']=qs[_0x805e('0x1e')](_0x10346d['query'][_0x805e('0x1e')]);_0x290670[_0x805e('0x1c')]=qs[_0x805e('0x1c')](_0x10346d[_0x805e('0x34')][_0x805e('0x1c')]);}return _0x1266b6[_0x805e('0x5a')](_0x290670);}})[_0x805e('0x24')](function(_0x390996){if(_0x390996){return _0x390996?{'count':_0x57597d,'rows':_0x390996}:null;}})[_0x805e('0x24')](respondWithResult(_0x2d8a06,null))[_0x805e('0x48')](handleError(_0x2d8a06,null));}; \ No newline at end of file +var _0x18af=['query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','ids','omit','removeUsers','isArray','userSquareProject:remove','emit','getUsers','findOne','User','sort','eml-format','zip-dir','request-promise','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','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','status','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','get','SquareProjects','UserProfileResource','sendStatus','error','stack','name','index','map','SquareProject','rawAttributes','type','key'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x18af,0x8b));var _0xf18a=function(_0x3097b5,_0x45920a){_0x3097b5=_0x3097b5-0x0;var _0x35d9c9=_0x18af[_0x3097b5];return _0x35d9c9;};'use strict';var emlformat=require(_0xf18a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf18a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf18a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf18a('0x3'));var path=require(_0xf18a('0x4'));var sox=require(_0xf18a('0x5'));var csv=require(_0xf18a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf18a('0x7'));var _=require(_0xf18a('0x8'));var squel=require(_0xf18a('0x9'));var crypto=require('crypto');var jsforce=require(_0xf18a('0xa'));var deskjs=require(_0xf18a('0xb'));var toCsv=require(_0xf18a('0x6'));var querystring=require(_0xf18a('0xc'));var Papa=require(_0xf18a('0xd'));var Redis=require(_0xf18a('0xe'));var authService=require(_0xf18a('0xf'));var qs=require(_0xf18a('0x10'));var as=require(_0xf18a('0x11'));var hardwareService=require(_0xf18a('0x12'));var logger=require(_0xf18a('0x13'))(_0xf18a('0x14'));var utils=require(_0xf18a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf18a('0x16'));var db=require(_0xf18a('0x17'))['db'];config[_0xf18a('0x18')]=_[_0xf18a('0x19')](config[_0xf18a('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xf18a('0x1a'))(new Redis(config[_0xf18a('0x18')]));require('./squareProject.socket')[_0xf18a('0x1b')](socket);function respondWithStatusCode(_0x5a06b5,_0x27428a){_0x27428a=_0x27428a||0xcc;return function(_0x30d3d5){if(_0x30d3d5){return _0x5a06b5['sendStatus'](_0x27428a);}return _0x5a06b5[_0xf18a('0x1c')](_0x27428a)['end']();};}function respondWithResult(_0x39fe13,_0x36458c){_0x36458c=_0x36458c||0xc8;return function(_0x52fcfa){if(_0x52fcfa){return _0x39fe13['status'](_0x36458c)[_0xf18a('0x1d')](_0x52fcfa);}};}function respondWithFilteredResult(_0x23c8f1,_0x5192b8){return function(_0x5e3da3){if(_0x5e3da3){var _0x285900=typeof _0x5192b8[_0xf18a('0x1e')]===_0xf18a('0x1f')&&typeof _0x5192b8['limit']===_0xf18a('0x1f');var _0x4a348e=_0x5e3da3[_0xf18a('0x20')];var _0x31cb63=_0x285900?0x0:_0x5192b8['offset'];var _0x1aa0b2=_0x285900?_0x5e3da3[_0xf18a('0x20')]:_0x5192b8['offset']+_0x5192b8[_0xf18a('0x21')];var _0x42854d;if(_0x1aa0b2>=_0x4a348e){_0x1aa0b2=_0x4a348e;_0x42854d=0xc8;}else{_0x42854d=0xce;}_0x23c8f1[_0xf18a('0x1c')](_0x42854d);return _0x23c8f1['set']('Content-Range',_0x31cb63+'-'+_0x1aa0b2+'/'+_0x4a348e)[_0xf18a('0x1d')](_0x5e3da3);}return null;};}function patchUpdates(_0x4438ed){return function(_0xabe9a2){try{jsonpatch[_0xf18a('0x22')](_0xabe9a2,_0x4438ed,!![]);}catch(_0x1ad933){return BPromise[_0xf18a('0x23')](_0x1ad933);}return _0xabe9a2[_0xf18a('0x24')]();};}function saveUpdates(_0x304bd4,_0xa5e2c7){return function(_0x56778f){if(_0x56778f){return _0x56778f[_0xf18a('0x25')](_0x304bd4)[_0xf18a('0x26')](function(_0x179b4e){return _0x179b4e;});}return null;};}function removeEntity(_0x30609e,_0x5dd917){return function(_0x44369e){if(_0x44369e){return _0x44369e[_0xf18a('0x27')]()[_0xf18a('0x26')](function(){var _0x4f540d=_0x44369e[_0xf18a('0x28')]({'plain':!![]});var _0x40d6d3=_0xf18a('0x29');return db[_0xf18a('0x2a')]['destroy']({'where':{'type':_0x40d6d3,'resourceId':_0x4f540d['id']}})[_0xf18a('0x26')](function(){return _0x44369e;});})[_0xf18a('0x26')](function(){_0x30609e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa8e81c,_0x14183c){return function(_0x7e668c){if(!_0x7e668c){_0xa8e81c[_0xf18a('0x2b')](0x194);}return _0x7e668c;};}function handleError(_0x528e37,_0x855ab4){_0x855ab4=_0x855ab4||0x1f4;return function(_0x40596f){logger[_0xf18a('0x2c')](_0x40596f[_0xf18a('0x2d')]);if(_0x40596f[_0xf18a('0x2e')]){delete _0x40596f[_0xf18a('0x2e')];}_0x528e37['status'](_0x855ab4)['send'](_0x40596f);};}exports[_0xf18a('0x2f')]=function(_0x3ea07a,_0x459fdb){var _0x532772={},_0x57146a={},_0x26fbde={'count':0x0,'rows':[]};var _0x33adad=_[_0xf18a('0x30')](db[_0xf18a('0x31')][_0xf18a('0x32')],function(_0x2489c0){return{'name':_0x2489c0['fieldName'],'type':_0x2489c0[_0xf18a('0x33')][_0xf18a('0x34')]};});_0x57146a['model']=_[_0xf18a('0x30')](_0x33adad,'name');_0x57146a[_0xf18a('0x35')]=_[_0xf18a('0x36')](_0x3ea07a['query']);_0x57146a['filters']=_[_0xf18a('0x37')](_0x57146a[_0xf18a('0x38')],_0x57146a[_0xf18a('0x35')]);_0x532772[_0xf18a('0x39')]=_['intersection'](_0x57146a[_0xf18a('0x38')],qs[_0xf18a('0x3a')](_0x3ea07a['query'][_0xf18a('0x3a')]));_0x532772[_0xf18a('0x39')]=_0x532772[_0xf18a('0x39')]['length']?_0x532772['attributes']:_0x57146a[_0xf18a('0x38')];if(!_0x3ea07a[_0xf18a('0x35')][_0xf18a('0x3b')](_0xf18a('0x3c'))){_0x532772[_0xf18a('0x21')]=qs[_0xf18a('0x21')](_0x3ea07a[_0xf18a('0x35')][_0xf18a('0x21')]);_0x532772[_0xf18a('0x1e')]=qs[_0xf18a('0x1e')](_0x3ea07a['query'][_0xf18a('0x1e')]);}_0x532772[_0xf18a('0x3d')]=qs['sort'](_0x3ea07a[_0xf18a('0x35')]['sort']);_0x532772[_0xf18a('0x3e')]=qs[_0xf18a('0x3f')](_[_0xf18a('0x40')](_0x3ea07a['query'],_0x57146a[_0xf18a('0x3f')]),_0x33adad);if(_0x3ea07a[_0xf18a('0x35')]['filter']){_0x532772[_0xf18a('0x3e')]=_[_0xf18a('0x41')](_0x532772[_0xf18a('0x3e')],{'$or':_['map'](_0x33adad,function(_0x4dca63){if(_0x4dca63[_0xf18a('0x33')]!==_0xf18a('0x42')){var _0x22ec57={};_0x22ec57[_0x4dca63['name']]={'$like':'%'+_0x3ea07a[_0xf18a('0x35')][_0xf18a('0x43')]+'%'};return _0x22ec57;}})});}_0x532772=_['merge']({},_0x532772,_0x3ea07a[_0xf18a('0x44')]);var _0x4bd61a={'where':_0x532772[_0xf18a('0x3e')]};return db[_0xf18a('0x31')][_0xf18a('0x20')](_0x4bd61a)[_0xf18a('0x26')](function(_0x8564e4){_0x26fbde['count']=_0x8564e4;if(_0x3ea07a[_0xf18a('0x35')][_0xf18a('0x45')]){_0x532772[_0xf18a('0x46')]=[{'all':!![]}];}return db[_0xf18a('0x31')][_0xf18a('0x47')](_0x532772);})[_0xf18a('0x26')](function(_0x2b0085){_0x26fbde['rows']=_0x2b0085;return _0x26fbde;})[_0xf18a('0x26')](respondWithFilteredResult(_0x459fdb,_0x532772))[_0xf18a('0x48')](handleError(_0x459fdb,null));};exports[_0xf18a('0x49')]=function(_0x5d744a,_0x2f0922){var _0x52e18f={'raw':![],'where':{'id':_0x5d744a[_0xf18a('0x4a')]['id']}},_0x146857={};_0x146857['model']=_[_0xf18a('0x36')](db[_0xf18a('0x31')][_0xf18a('0x32')]);_0x146857[_0xf18a('0x35')]=_[_0xf18a('0x36')](_0x5d744a['query']);_0x146857['filters']=_['intersection'](_0x146857['model'],_0x146857[_0xf18a('0x35')]);_0x52e18f[_0xf18a('0x39')]=_[_0xf18a('0x37')](_0x146857[_0xf18a('0x38')],qs[_0xf18a('0x3a')](_0x5d744a[_0xf18a('0x35')][_0xf18a('0x3a')]));_0x52e18f['attributes']=_0x52e18f[_0xf18a('0x39')][_0xf18a('0x4b')]?_0x52e18f['attributes']:_0x146857[_0xf18a('0x38')];if(_0x5d744a[_0xf18a('0x35')][_0xf18a('0x45')]){_0x52e18f[_0xf18a('0x46')]=[{'all':!![]}];}_0x52e18f=_[_0xf18a('0x41')]({},_0x52e18f,_0x5d744a[_0xf18a('0x44')]);return db[_0xf18a('0x31')]['find'](_0x52e18f)[_0xf18a('0x26')](handleEntityNotFound(_0x2f0922,null))[_0xf18a('0x26')](respondWithResult(_0x2f0922,null))['catch'](handleError(_0x2f0922,null));};exports[_0xf18a('0x4c')]=function(_0x42fdd3,_0xea9d1d){return db[_0xf18a('0x31')]['create'](_0x42fdd3[_0xf18a('0x4d')],{})[_0xf18a('0x26')](function(_0xccde4){var _0x33b537=_0x42fdd3[_0xf18a('0x4e')]['get']({'plain':!![]});if(!_0x33b537)throw new Error(_0xf18a('0x4f'));if(_0x33b537[_0xf18a('0x50')]===_0xf18a('0x4e')){var _0x222ac4=_0xccde4[_0xf18a('0x28')]({'plain':!![]});var _0x2b2a4d=_0xf18a('0x29');return db[_0xf18a('0x51')][_0xf18a('0x52')]({'where':{'name':_0x2b2a4d,'userProfileId':_0x33b537[_0xf18a('0x53')]},'raw':!![]})[_0xf18a('0x26')](function(_0x2fcfcb){if(_0x2fcfcb&&_0x2fcfcb[_0xf18a('0x54')]===0x0){return db['UserProfileResource'][_0xf18a('0x4c')]({'name':_0x222ac4[_0xf18a('0x2e')],'resourceId':_0x222ac4['id'],'type':_0x2fcfcb[_0xf18a('0x2e')],'sectionId':_0x2fcfcb['id']},{})[_0xf18a('0x26')](function(){return _0xccde4;});}else{return _0xccde4;}})[_0xf18a('0x48')](function(_0x119339){logger[_0xf18a('0x2c')](_0xf18a('0x55'),_0x119339);throw _0x119339;});}return _0xccde4;})[_0xf18a('0x26')](respondWithResult(_0xea9d1d,0xc9))[_0xf18a('0x48')](handleError(_0xea9d1d,null));};exports['update']=function(_0x3c5f9c,_0x31653a){if(_0x3c5f9c[_0xf18a('0x4d')]['id']){delete _0x3c5f9c['body']['id'];}return db[_0xf18a('0x31')][_0xf18a('0x52')]({'where':{'id':_0x3c5f9c['params']['id']}})['then'](handleEntityNotFound(_0x31653a,null))[_0xf18a('0x26')](saveUpdates(_0x3c5f9c['body'],null))[_0xf18a('0x26')](respondWithResult(_0x31653a,null))[_0xf18a('0x48')](handleError(_0x31653a,null));};exports[_0xf18a('0x27')]=function(_0x5d495b,_0x398988){return db[_0xf18a('0x31')][_0xf18a('0x52')]({'where':{'id':_0x5d495b[_0xf18a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x398988,null))[_0xf18a('0x26')](removeEntity(_0x398988,null))[_0xf18a('0x48')](handleError(_0x398988,null));};exports['addUsers']=function(_0x2df1d6,_0x417fa4,_0x41f5a9){return db[_0xf18a('0x31')]['find']({'where':{'id':_0x2df1d6['params']['id']}})['then'](handleEntityNotFound(_0x417fa4,null))[_0xf18a('0x26')](function(_0x4d1b95){if(_0x4d1b95){return _0x4d1b95['addUsers'](_0x2df1d6[_0xf18a('0x4d')][_0xf18a('0x56')],_[_0xf18a('0x57')](_0x2df1d6[_0xf18a('0x4d')],[_0xf18a('0x56'),'id'])||{});}})[_0xf18a('0x26')](respondWithResult(_0x417fa4,null))[_0xf18a('0x48')](handleError(_0x417fa4,null));};exports[_0xf18a('0x58')]=function(_0x250af5,_0x363a03,_0x1de2ba){return db[_0xf18a('0x31')][_0xf18a('0x52')]({'where':{'id':_0x250af5[_0xf18a('0x4a')]['id']}})[_0xf18a('0x26')](handleEntityNotFound(_0x363a03,null))[_0xf18a('0x26')](function(_0x46e492){if(_0x46e492){return _0x46e492[_0xf18a('0x58')](_0x250af5[_0xf18a('0x35')][_0xf18a('0x56')])[_0xf18a('0x26')](function(){if(_[_0xf18a('0x59')](_0x250af5[_0xf18a('0x35')][_0xf18a('0x56')])){for(var _0xa859f9=0x0;_0xa859f9<_0x250af5['query']['ids']['length'];_0xa859f9+=0x1){socket['emit'](_0xf18a('0x5a'),{'UserId':Number(_0x250af5[_0xf18a('0x35')][_0xf18a('0x56')][_0xa859f9]),'SquareProjectId':Number(_0x250af5[_0xf18a('0x4a')]['id'])});}}else{socket[_0xf18a('0x5b')]('userSquareProject:remove',{'UserId':Number(_0x250af5[_0xf18a('0x35')][_0xf18a('0x56')]),'SquareProjectId':Number(_0x250af5[_0xf18a('0x4a')]['id'])});}});}})[_0xf18a('0x26')](respondWithStatusCode(_0x363a03,null))[_0xf18a('0x48')](handleError(_0x363a03,null));};exports[_0xf18a('0x5c')]=function(_0x27ea99,_0x1a7617,_0x262d61){var _0x10bf4c={};var _0x31c7ca={};var _0x268d31;var _0x40098b;return db[_0xf18a('0x31')][_0xf18a('0x5d')]({'where':{'id':_0x27ea99[_0xf18a('0x4a')]['id']}})[_0xf18a('0x26')](handleEntityNotFound(_0x1a7617,null))[_0xf18a('0x26')](function(_0x37b7b2){if(_0x37b7b2){_0x268d31=_0x37b7b2;_0x31c7ca['model']=_[_0xf18a('0x36')](db[_0xf18a('0x5e')][_0xf18a('0x32')]);_0x31c7ca['query']=_[_0xf18a('0x36')](_0x27ea99[_0xf18a('0x35')]);_0x31c7ca[_0xf18a('0x3f')]=_[_0xf18a('0x37')](_0x31c7ca[_0xf18a('0x38')],_0x31c7ca[_0xf18a('0x35')]);_0x10bf4c[_0xf18a('0x39')]=_[_0xf18a('0x37')](_0x31c7ca[_0xf18a('0x38')],qs['fields'](_0x27ea99[_0xf18a('0x35')][_0xf18a('0x3a')]));_0x10bf4c['attributes']=_0x10bf4c[_0xf18a('0x39')]['length']?_0x10bf4c[_0xf18a('0x39')]:_0x31c7ca[_0xf18a('0x38')];_0x10bf4c['order']=qs[_0xf18a('0x5f')](_0x27ea99[_0xf18a('0x35')][_0xf18a('0x5f')]);_0x10bf4c[_0xf18a('0x3e')]=qs[_0xf18a('0x3f')](_[_0xf18a('0x40')](_0x27ea99['query'],_0x31c7ca['filters']));if(_0x27ea99[_0xf18a('0x35')][_0xf18a('0x43')]){_0x10bf4c[_0xf18a('0x3e')]=_[_0xf18a('0x41')](_0x10bf4c[_0xf18a('0x3e')],{'$or':_[_0xf18a('0x30')](_0x10bf4c['attributes'],function(_0x4c2384){var _0xe15f19={};_0xe15f19[_0x4c2384]={'$like':'%'+_0x27ea99['query'][_0xf18a('0x43')]+'%'};return _0xe15f19;})});}_0x10bf4c=_[_0xf18a('0x41')]({},_0x10bf4c,_0x27ea99[_0xf18a('0x44')]);return _0x268d31[_0xf18a('0x5c')](_0x10bf4c);}})[_0xf18a('0x26')](function(_0x517f17){if(_0x517f17){_0x40098b=_0x517f17[_0xf18a('0x4b')];if(!_0x27ea99[_0xf18a('0x35')][_0xf18a('0x3b')]('nolimit')){_0x10bf4c[_0xf18a('0x21')]=qs[_0xf18a('0x21')](_0x27ea99['query'][_0xf18a('0x21')]);_0x10bf4c['offset']=qs[_0xf18a('0x1e')](_0x27ea99[_0xf18a('0x35')][_0xf18a('0x1e')]);}return _0x268d31[_0xf18a('0x5c')](_0x10bf4c);}})[_0xf18a('0x26')](function(_0x3bf81c){if(_0x3bf81c){return _0x3bf81c?{'count':_0x40098b,'rows':_0x3bf81c}:null;}})[_0xf18a('0x26')](respondWithResult(_0x1a7617,null))[_0xf18a('0x48')](handleError(_0x1a7617,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index ceb1a2e..fa67702 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 _0xbbf8=['hasOwnProperty','hook','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0xbbf8,0x142));var _0x8bbf=function(_0x284b22,_0x1e0f2c){_0x284b22=_0x284b22-0x0;var _0x261e08=_0xbbf8[_0x284b22];return _0x261e08;};'use strict';var EventEmitter=require(_0x8bbf('0x0'));var SquareProject=require(_0x8bbf('0x1'))['db'][_0x8bbf('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x8bbf('0x3')](0x0);var events={'afterCreate':_0x8bbf('0x4'),'afterUpdate':_0x8bbf('0x5'),'afterDestroy':_0x8bbf('0x6')};function emitEvent(_0x3db05b){return function(_0x1abc95,_0x5015c8,_0x5513df){SquareProjectEvents['emit'](_0x3db05b+':'+_0x1abc95['id'],_0x1abc95);SquareProjectEvents[_0x8bbf('0x7')](_0x3db05b,_0x1abc95);_0x5513df(null);};}for(var e in events){if(events[_0x8bbf('0x8')](e)){var event=events[e];SquareProject[_0x8bbf('0x9')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x80f2=['save','emit','hasOwnProperty','exports','SquareProject','setMaxListeners'];(function(_0x331f16,_0x521736){var _0x4da231=function(_0x487664){while(--_0x487664){_0x331f16['push'](_0x331f16['shift']());}};_0x4da231(++_0x521736);}(_0x80f2,0x196));var _0x280f=function(_0x2d147c,_0x1c88b6){_0x2d147c=_0x2d147c-0x0;var _0x43ef9d=_0x80f2[_0x2d147c];return _0x43ef9d;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0x280f('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x280f('0x1')](0x0);var events={'afterCreate':_0x280f('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x38e832){return function(_0x4b8bea,_0x35fc9f,_0x24ae22){SquareProjectEvents[_0x280f('0x3')](_0x38e832+':'+_0x4b8bea['id'],_0x4b8bea);SquareProjectEvents['emit'](_0x38e832,_0x4b8bea);_0x24ae22(null);};}for(var e in events){if(events[_0x280f('0x4')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x280f('0x5')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index e3bf12f..4fa904d 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 _0xeff2=['moment','path','rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','preproduction','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x519c88,_0xb84103){var _0x4668d7=function(_0x596c2c){while(--_0x596c2c){_0x519c88['push'](_0x519c88['shift']());}};_0x4668d7(++_0xb84103);}(_0xeff2,0x1a0));var _0x2eff=function(_0x4df212,_0xc25315){_0x4df212=_0x4df212-0x0;var _0x4ca1fd=_0xeff2[_0x4df212];return _0x4ca1fd;};'use strict';var _=require(_0x2eff('0x0'));var util=require(_0x2eff('0x1'));var logger=require(_0x2eff('0x2'))(_0x2eff('0x3'));var moment=require(_0x2eff('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2eff('0x5'));var rimraf=require(_0x2eff('0x6'));var config=require(_0x2eff('0x7'));var attributes=require(_0x2eff('0x8'));module[_0x2eff('0x9')]=function(_0x29439e,_0x3a8628){return _0x29439e['define'](_0x2eff('0xa'),attributes,{'tableName':_0x2eff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3100f9,_0x3694a9,_0xa7db9){if(_0x3100f9['changed'](_0x2eff('0xc'))){_0x3100f9['savedAt']=moment()['format'](_0x2eff('0xd'));}if(_0x3100f9['changed']('production')){_0x3100f9['publishedAt']=moment()['format'](_0x2eff('0xd'));}_0xa7db9(null,_0x3100f9);}}});}; \ No newline at end of file +var _0x5d10=['request-promise','path','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','publishedAt','lodash','../../config/logger','api','moment','bluebird'];(function(_0x20c9ec,_0x1265b0){var _0x28b0ca=function(_0x13fad7){while(--_0x13fad7){_0x20c9ec['push'](_0x20c9ec['shift']());}};_0x28b0ca(++_0x1265b0);}(_0x5d10,0x175));var _0x05d1=function(_0x4825ce,_0x3cdc1b){_0x4825ce=_0x4825ce-0x0;var _0x264411=_0x5d10[_0x4825ce];return _0x264411;};'use strict';var _=require(_0x05d1('0x0'));var util=require('util');var logger=require(_0x05d1('0x1'))(_0x05d1('0x2'));var moment=require(_0x05d1('0x3'));var BPromise=require(_0x05d1('0x4'));var rp=require(_0x05d1('0x5'));var fs=require('fs');var path=require(_0x05d1('0x6'));var rimraf=require('rimraf');var config=require(_0x05d1('0x7'));var attributes=require(_0x05d1('0x8'));module[_0x05d1('0x9')]=function(_0x1e0b8f,_0x23c547){return _0x1e0b8f[_0x05d1('0xa')](_0x05d1('0xb'),attributes,{'tableName':_0x05d1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x539154,_0x7441d4,_0x566037){if(_0x539154[_0x05d1('0xd')](_0x05d1('0xe'))){_0x539154['savedAt']=moment()[_0x05d1('0xf')](_0x05d1('0x10'));}if(_0x539154[_0x05d1('0xd')]('production')){_0x539154[_0x05d1('0x11')]=moment()[_0x05d1('0xf')](_0x05d1('0x10'));}_0x566037(null,_0x539154);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 22fc912..5993bd0 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 _0x0b26=['error','code','message','result','ShowSquareProject','SquareProject','options','where','attributes','model','include','map','info','catch','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','then','SquareProject,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x345695,_0x2ba140){var _0x5002d3=function(_0x1f6cbb){while(--_0x1f6cbb){_0x345695['push'](_0x345695['shift']());}};_0x5002d3(++_0x2ba140);}(_0x0b26,0xfc));var _0x60b2=function(_0x529059,_0x294a33){_0x529059=_0x529059-0x0;var _0x156bc2=_0x0b26[_0x529059];return _0x156bc2;};'use strict';var _=require(_0x60b2('0x0'));var util=require(_0x60b2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x60b2('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x60b2('0x3'));var logger=require(_0x60b2('0x4'))(_0x60b2('0x5'));var config=require('../../config/environment');var jayson=require(_0x60b2('0x6'));var client=jayson['client'][_0x60b2('0x7')]({'port':0x232a});config[_0x60b2('0x8')]=_[_0x60b2('0x9')](config[_0x60b2('0x8')],{'host':_0x60b2('0xa'),'port':0x18eb});var socket=require(_0x60b2('0xb'))(new Redis(config[_0x60b2('0x8')]));require(_0x60b2('0xc'))[_0x60b2('0xd')](socket);function respondWithRpcPromise(_0x146108,_0x21ea73,_0x501c24){return new BPromise(function(_0x2d64a3,_0x197b21){return client[_0x60b2('0xe')](_0x146108,_0x501c24)[_0x60b2('0xf')](function(_0xdeddd){logger['info'](_0x60b2('0x10'),_0x21ea73,_0x60b2('0x11'));logger[_0x60b2('0x12')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x21ea73,_0x60b2('0x11'),JSON[_0x60b2('0x13')](_0xdeddd));if(_0xdeddd[_0x60b2('0x14')]){if(_0xdeddd[_0x60b2('0x14')][_0x60b2('0x15')]===0x1f4){logger[_0x60b2('0x14')](_0x60b2('0x10'),_0x21ea73,_0xdeddd[_0x60b2('0x14')][_0x60b2('0x16')]);return _0x197b21(_0xdeddd[_0x60b2('0x14')][_0x60b2('0x16')]);}logger[_0x60b2('0x14')](_0x60b2('0x10'),_0x21ea73,_0xdeddd[_0x60b2('0x14')][_0x60b2('0x16')]);return _0x2d64a3(_0xdeddd[_0x60b2('0x14')]['message']);}else{logger['info'](_0x60b2('0x10'),_0x21ea73,_0x60b2('0x11'));_0x2d64a3(_0xdeddd[_0x60b2('0x17')][_0x60b2('0x16')]);}})['catch'](function(_0x4075e5){logger['error'](_0x60b2('0x10'),_0x21ea73,_0x4075e5);_0x197b21(_0x4075e5);});});}exports[_0x60b2('0x18')]=function(_0x4c6fc5){var _0x3f65fd=this;return new Promise(function(_0x3f818a,_0x51cb77){return db[_0x60b2('0x19')]['find']({'raw':_0x4c6fc5[_0x60b2('0x1a')]?_0x4c6fc5[_0x60b2('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4c6fc5[_0x60b2('0x1a')]?_0x4c6fc5['options'][_0x60b2('0x1b')]||null:null,'attributes':_0x4c6fc5[_0x60b2('0x1a')]?_0x4c6fc5['options'][_0x60b2('0x1c')]||null:null,'include':_0x4c6fc5['options']?_0x4c6fc5[_0x60b2('0x1a')]['include']?_['map'](_0x4c6fc5[_0x60b2('0x1a')]['include'],function(_0x41ed93){return{'model':db[_0x41ed93[_0x60b2('0x1d')]],'as':_0x41ed93['as'],'attributes':_0x41ed93[_0x60b2('0x1c')],'include':_0x41ed93[_0x60b2('0x1e')]?_['map'](_0x41ed93[_0x60b2('0x1e')],function(_0x594624){return{'model':db[_0x594624[_0x60b2('0x1d')]],'as':_0x594624['as'],'attributes':_0x594624[_0x60b2('0x1c')],'include':_0x594624['include']?_[_0x60b2('0x1f')](_0x594624[_0x60b2('0x1e')],function(_0x390bbe){return{'model':db[_0x390bbe['model']],'as':_0x390bbe['as'],'attributes':_0x390bbe[_0x60b2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x60b2('0xf')](function(_0x5dc7f9){logger[_0x60b2('0x20')](_0x60b2('0x18'),_0x4c6fc5);logger[_0x60b2('0x12')]('ShowSquareProject',_0x4c6fc5,JSON['stringify'](_0x5dc7f9));_0x3f818a(_0x5dc7f9);})[_0x60b2('0x21')](function(_0x2e4121){logger[_0x60b2('0x14')](_0x60b2('0x18'),_0x2e4121[_0x60b2('0x16')],_0x4c6fc5);_0x51cb77(_0x3f65fd[_0x60b2('0x14')](0x1f4,_0x2e4121[_0x60b2('0x16')]));});});}; \ No newline at end of file +var _0x815e=['map','model','ShowSquareProject','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','redis','defaults','localhost','./squareProject.socket','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareProject','find','raw','options','where','attributes','include'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x815e,0x16c));var _0xe815=function(_0x3e3241,_0xd474ba){_0x3e3241=_0x3e3241-0x0;var _0xeeb216=_0x815e[_0x3e3241];return _0xeeb216;};'use strict';var _=require(_0xe815('0x0'));var util=require(_0xe815('0x1'));var moment=require(_0xe815('0x2'));var BPromise=require(_0xe815('0x3'));var rs=require(_0xe815('0x4'));var fs=require('fs');var Redis=require(_0xe815('0x5'));var db=require(_0xe815('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe815('0x7'))(_0xe815('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe815('0x9')]({'port':0x232a});config[_0xe815('0xa')]=_[_0xe815('0xb')](config[_0xe815('0xa')],{'host':_0xe815('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe815('0xa')]));require(_0xe815('0xd'))['register'](socket);function respondWithRpcPromise(_0x2bd866,_0x102913,_0x4de648){return new BPromise(function(_0x1d5239,_0x2fd1e2){return client[_0xe815('0xe')](_0x2bd866,_0x4de648)[_0xe815('0xf')](function(_0x66bc92){logger[_0xe815('0x10')](_0xe815('0x11'),_0x102913,_0xe815('0x12'));logger['debug']('SquareProject,\x20%s,\x20%s,\x20%s',_0x102913,_0xe815('0x12'),JSON[_0xe815('0x13')](_0x66bc92));if(_0x66bc92['error']){if(_0x66bc92[_0xe815('0x14')][_0xe815('0x15')]===0x1f4){logger[_0xe815('0x14')](_0xe815('0x11'),_0x102913,_0x66bc92[_0xe815('0x14')][_0xe815('0x16')]);return _0x2fd1e2(_0x66bc92[_0xe815('0x14')]['message']);}logger[_0xe815('0x14')](_0xe815('0x11'),_0x102913,_0x66bc92[_0xe815('0x14')][_0xe815('0x16')]);return _0x1d5239(_0x66bc92[_0xe815('0x14')][_0xe815('0x16')]);}else{logger[_0xe815('0x10')](_0xe815('0x11'),_0x102913,_0xe815('0x12'));_0x1d5239(_0x66bc92[_0xe815('0x17')][_0xe815('0x16')]);}})[_0xe815('0x18')](function(_0x2a8a93){logger[_0xe815('0x14')](_0xe815('0x11'),_0x102913,_0x2a8a93);_0x2fd1e2(_0x2a8a93);});});}exports['ShowSquareProject']=function(_0x57399e){var _0x597e23=this;return new Promise(function(_0x4a92b9,_0x3103c9){return db[_0xe815('0x19')][_0xe815('0x1a')]({'raw':_0x57399e['options']?_0x57399e['options'][_0xe815('0x1b')]===undefined?!![]:![]:!![],'where':_0x57399e[_0xe815('0x1c')]?_0x57399e[_0xe815('0x1c')][_0xe815('0x1d')]||null:null,'attributes':_0x57399e[_0xe815('0x1c')]?_0x57399e[_0xe815('0x1c')][_0xe815('0x1e')]||null:null,'include':_0x57399e[_0xe815('0x1c')]?_0x57399e[_0xe815('0x1c')][_0xe815('0x1f')]?_[_0xe815('0x20')](_0x57399e['options'][_0xe815('0x1f')],function(_0x2b27aa){return{'model':db[_0x2b27aa['model']],'as':_0x2b27aa['as'],'attributes':_0x2b27aa[_0xe815('0x1e')],'include':_0x2b27aa[_0xe815('0x1f')]?_[_0xe815('0x20')](_0x2b27aa['include'],function(_0x115c24){return{'model':db[_0x115c24[_0xe815('0x21')]],'as':_0x115c24['as'],'attributes':_0x115c24[_0xe815('0x1e')],'include':_0x115c24['include']?_[_0xe815('0x20')](_0x115c24[_0xe815('0x1f')],function(_0x32f4e4){return{'model':db[_0x32f4e4[_0xe815('0x21')]],'as':_0x32f4e4['as'],'attributes':_0x32f4e4[_0xe815('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe815('0xf')](function(_0x5dc283){logger[_0xe815('0x10')](_0xe815('0x22'),_0x57399e);logger[_0xe815('0x23')](_0xe815('0x22'),_0x57399e,JSON[_0xe815('0x13')](_0x5dc283));_0x4a92b9(_0x5dc283);})[_0xe815('0x18')](function(_0x44d19b){logger[_0xe815('0x14')](_0xe815('0x22'),_0x44d19b[_0xe815('0x16')],_0x57399e);_0x3103c9(_0x597e23['error'](0x1f4,_0x44d19b[_0xe815('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 3616a93..6f20fb4 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 _0x6721=['remove','update','length','save'];(function(_0x8e85e9,_0x37179b){var _0x4d34a3=function(_0x17dd94){while(--_0x17dd94){_0x8e85e9['push'](_0x8e85e9['shift']());}};_0x4d34a3(++_0x37179b);}(_0x6721,0x193));var _0x1672=function(_0x216510,_0x1228e1){_0x216510=_0x216510-0x0;var _0x2e3cdc=_0x6721[_0x216510];return _0x2e3cdc;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x1672('0x0'),_0x1672('0x1'),_0x1672('0x2')];function createListener(_0x3954ac,_0x1af6e3){return function(_0x54a05c){_0x1af6e3['emit'](_0x3954ac,_0x54a05c);};}function removeListener(_0x2b225b,_0x54ec6a){return function(){SquareProjectEvents['removeListener'](_0x2b225b,_0x54ec6a);};}exports['register']=function(_0x3417f9){for(var _0x126744=0x0,_0x957ed3=events[_0x1672('0x3')];_0x126744<_0x957ed3;_0x126744++){var _0x3a3ffc=events[_0x126744];var _0x1c8962=createListener('squareProject:'+_0x3a3ffc,_0x3417f9);SquareProjectEvents['on'](_0x3a3ffc,_0x1c8962);}}; \ No newline at end of file +var _0x7432=['register','length','squareProject:','./squareProject.events','save','remove','update','emit','removeListener'];(function(_0x230355,_0x7feab7){var _0x591394=function(_0x547f2a){while(--_0x547f2a){_0x230355['push'](_0x230355['shift']());}};_0x591394(++_0x7feab7);}(_0x7432,0xdb));var _0x2743=function(_0x28951d,_0x28dbcb){_0x28951d=_0x28951d-0x0;var _0x4e8c1e=_0x7432[_0x28951d];return _0x4e8c1e;};'use strict';var SquareProjectEvents=require(_0x2743('0x0'));var events=[_0x2743('0x1'),_0x2743('0x2'),_0x2743('0x3')];function createListener(_0x416415,_0x59851c){return function(_0x4b26d4){_0x59851c[_0x2743('0x4')](_0x416415,_0x4b26d4);};}function removeListener(_0x264807,_0x3a42db){return function(){SquareProjectEvents[_0x2743('0x5')](_0x264807,_0x3a42db);};}exports[_0x2743('0x6')]=function(_0x9d6991){for(var _0x4eb372=0x0,_0x1382db=events[_0x2743('0x7')];_0x4eb372<_0x1382db;_0x4eb372++){var _0x336665=events[_0x4eb372];var _0x12ef50=createListener(_0x2743('0x8')+_0x336665,_0x9d6991);SquareProjectEvents['on'](_0x336665,_0x12ef50);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 8ac31af..1ca3ee1 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 _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(_0x322cee,_0x5e5f76){var _0x4e9b6b=function(_0x10bc96){while(--_0x10bc96){_0x322cee['push'](_0x322cee['shift']());}};_0x4e9b6b(++_0x5e5f76);}(_0xf494,0x1c6));var _0x4f49=function(_0x21a339,_0x7de50f){_0x21a339=_0x21a339-0x0;var _0x45ddf9=_0xf494[_0x21a339];return _0x45ddf9;};'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 +var _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x122edb,_0x46a192){var _0x2ddc03=function(_0x27bbbd){while(--_0x27bbbd){_0x122edb['push'](_0x122edb['shift']());}};_0x2ddc03(++_0x46a192);}(_0x5fab,0x177));var _0xb5fa=function(_0x52ab0a,_0xf641d5){_0x52ab0a=_0x52ab0a-0x0;var _0x1d2cab=_0x5fab[_0x52ab0a];return _0x1d2cab;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index fd5cfdb..9934564 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 _0x0e85=['STRING','getDataValue','savePath','substring','lastIndexOf','sequelize','exports'];(function(_0x4f02c1,_0x1e9f9b){var _0x484fb4=function(_0x5cc81e){while(--_0x5cc81e){_0x4f02c1['push'](_0x4f02c1['shift']());}};_0x484fb4(++_0x1e9f9b);}(_0x0e85,0x7c));var _0x50e8=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x0e85[_0x4dc7b9];return _0x3ab114;};'use strict';var Sequelize=require(_0x50e8('0x0'));module[_0x50e8('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x50e8('0x2')]},'calleridname':{'type':Sequelize[_0x50e8('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x50e8('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x50e8('0x2')]},'saveName':{'type':Sequelize[_0x50e8('0x2')]},'filename':{'type':Sequelize[_0x50e8('0x2')]},'savePath':{'type':Sequelize[_0x50e8('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x3ce904='';var _0x108edc=this[_0x50e8('0x3')](_0x50e8('0x4'));if(_0x108edc){_0x3ce904=_0x108edc[_0x50e8('0x5')](_0x108edc[_0x50e8('0x6')]('.'));}return _0x3ce904;}}}; \ No newline at end of file +var _0x7c09=['exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf'];(function(_0x604d02,_0xd24a44){var _0x12fedc=function(_0x5b34d8){while(--_0x5b34d8){_0x604d02['push'](_0x604d02['shift']());}};_0x12fedc(++_0xd24a44);}(_0x7c09,0x102));var _0x97c0=function(_0x1dd1fa,_0x66c816){_0x1dd1fa=_0x1dd1fa-0x0;var _0x1cab40=_0x7c09[_0x1dd1fa];return _0x1cab40;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'uniqueid':{'type':Sequelize[_0x97c0('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x97c0('0x1')]},'context':{'type':Sequelize[_0x97c0('0x1')]},'extension':{'type':Sequelize[_0x97c0('0x1')]},'priority':{'type':Sequelize[_0x97c0('0x1')]},'accountcode':{'type':Sequelize[_0x97c0('0x1')]},'dnid':{'type':Sequelize[_0x97c0('0x1')]},'projectName':{'type':Sequelize[_0x97c0('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x97c0('0x2')],'get':function(){var _0x42c6c7='';var _0x2c19fa=this[_0x97c0('0x3')](_0x97c0('0x4'));if(_0x2c19fa){_0x42c6c7=_0x2c19fa['substring'](_0x2c19fa[_0x97c0('0x5')]('.'));}return _0x42c6c7;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 83d0965..9640a6c 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 _0x31bf=['extname','unlink','message','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','undefined','limit','count','offset','apply','update','destroy','stack','name','send','index','SquareRecording','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','type','filter','options','where','then','include','rows','catch','show','params','rawAttributes','includeAll','create','body','find','download','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','Sequelize','SquareRecording\x20not\x20found'];(function(_0xdb0c2,_0x432206){var _0x397d40=function(_0x1d359d){while(--_0x1d359d){_0xdb0c2['push'](_0xdb0c2['shift']());}};_0x397d40(++_0x432206);}(_0x31bf,0x1dc));var _0xf31b=function(_0x25d11e,_0x4c8c02){_0x25d11e=_0x25d11e-0x0;var _0x4bb6ed=_0x31bf[_0x25d11e];return _0x4bb6ed;};'use strict';var emlformat=require(_0xf31b('0x0'));var rimraf=require(_0xf31b('0x1'));var zipdir=require(_0xf31b('0x2'));var jsonpatch=require(_0xf31b('0x3'));var rp=require('request-promise');var moment=require(_0xf31b('0x4'));var BPromise=require(_0xf31b('0x5'));var Mustache=require('mustache');var util=require(_0xf31b('0x6'));var path=require(_0xf31b('0x7'));var sox=require('sox');var csv=require(_0xf31b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf31b('0x9'));var _=require(_0xf31b('0xa'));var squel=require('squel');var crypto=require(_0xf31b('0xb'));var jsforce=require(_0xf31b('0xc'));var deskjs=require(_0xf31b('0xd'));var toCsv=require(_0xf31b('0x8'));var querystring=require(_0xf31b('0xe'));var Papa=require(_0xf31b('0xf'));var Redis=require(_0xf31b('0x10'));var authService=require(_0xf31b('0x11'));var qs=require(_0xf31b('0x12'));var as=require(_0xf31b('0x13'));var hardwareService=require(_0xf31b('0x14'));var logger=require(_0xf31b('0x15'))(_0xf31b('0x16'));var utils=require('../../config/utils');var config=require(_0xf31b('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fd2b7,_0x43c8d9){_0x43c8d9=_0x43c8d9||0xcc;return function(_0x3e7e0d){if(_0x3e7e0d){return _0x4fd2b7[_0xf31b('0x18')](_0x43c8d9);}return _0x4fd2b7[_0xf31b('0x19')](_0x43c8d9)['end']();};}function respondWithResult(_0x53469d,_0x152698){_0x152698=_0x152698||0xc8;return function(_0x3aad43){if(_0x3aad43){return _0x53469d[_0xf31b('0x19')](_0x152698)[_0xf31b('0x1a')](_0x3aad43);}};}function respondWithFilteredResult(_0x17fe3c,_0x4273c5){return function(_0x539692){if(_0x539692){var _0x30c5f3=typeof _0x4273c5['offset']===_0xf31b('0x1b')&&typeof _0x4273c5[_0xf31b('0x1c')]===_0xf31b('0x1b');var _0x21a590=_0x539692[_0xf31b('0x1d')];var _0x35d27b=_0x30c5f3?0x0:_0x4273c5[_0xf31b('0x1e')];var _0x52d2bf=_0x30c5f3?_0x539692['count']:_0x4273c5[_0xf31b('0x1e')]+_0x4273c5['limit'];var _0x3eef7c;if(_0x52d2bf>=_0x21a590){_0x52d2bf=_0x21a590;_0x3eef7c=0xc8;}else{_0x3eef7c=0xce;}_0x17fe3c[_0xf31b('0x19')](_0x3eef7c);return _0x17fe3c['set']('Content-Range',_0x35d27b+'-'+_0x52d2bf+'/'+_0x21a590)[_0xf31b('0x1a')](_0x539692);}return null;};}function patchUpdates(_0x5abb0d){return function(_0x505756){try{jsonpatch[_0xf31b('0x1f')](_0x505756,_0x5abb0d,!![]);}catch(_0x38232a){return BPromise['reject'](_0x38232a);}return _0x505756['save']();};}function saveUpdates(_0x413db3,_0x2e2ced){return function(_0x101ddb){if(_0x101ddb){return _0x101ddb[_0xf31b('0x20')](_0x413db3)['then'](function(_0x5a88c0){return _0x5a88c0;});}return null;};}function removeEntity(_0x2052aa,_0x50053b){return function(_0x4754d1){if(_0x4754d1){return _0x4754d1[_0xf31b('0x21')]()['then'](function(){_0x2052aa[_0xf31b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50fc70,_0xb8f4b1){return function(_0x3b62c1){if(!_0x3b62c1){_0x50fc70[_0xf31b('0x18')](0x194);}return _0x3b62c1;};}function handleError(_0x24c880,_0x4f389f){_0x4f389f=_0x4f389f||0x1f4;return function(_0x368395){logger['error'](_0x368395[_0xf31b('0x22')]);if(_0x368395[_0xf31b('0x23')]){delete _0x368395[_0xf31b('0x23')];}_0x24c880['status'](_0x4f389f)[_0xf31b('0x24')](_0x368395);};}exports[_0xf31b('0x25')]=function(_0x45a9d0,_0x352469){var _0x3c5d7a={},_0x4a3df1={},_0x5bb5c5={'count':0x0,'rows':[]};var _0x1311f6=_['map'](db[_0xf31b('0x26')]['rawAttributes'],function(_0x39a9f9){return{'name':_0x39a9f9[_0xf31b('0x27')],'type':_0x39a9f9['type'][_0xf31b('0x28')]};});_0x4a3df1[_0xf31b('0x29')]=_[_0xf31b('0x2a')](_0x1311f6,_0xf31b('0x23'));_0x4a3df1[_0xf31b('0x2b')]=_[_0xf31b('0x2c')](_0x45a9d0[_0xf31b('0x2b')]);_0x4a3df1[_0xf31b('0x2d')]=_[_0xf31b('0x2e')](_0x4a3df1['model'],_0x4a3df1[_0xf31b('0x2b')]);_0x3c5d7a['attributes']=_[_0xf31b('0x2e')](_0x4a3df1['model'],qs['fields'](_0x45a9d0[_0xf31b('0x2b')][_0xf31b('0x2f')]));_0x3c5d7a[_0xf31b('0x30')]=_0x3c5d7a[_0xf31b('0x30')][_0xf31b('0x31')]?_0x3c5d7a[_0xf31b('0x30')]:_0x4a3df1[_0xf31b('0x29')];if(!_0x45a9d0['query'][_0xf31b('0x32')](_0xf31b('0x33'))){_0x3c5d7a['limit']=qs[_0xf31b('0x1c')](_0x45a9d0[_0xf31b('0x2b')]['limit']);_0x3c5d7a[_0xf31b('0x1e')]=qs[_0xf31b('0x1e')](_0x45a9d0[_0xf31b('0x2b')][_0xf31b('0x1e')]);}_0x3c5d7a[_0xf31b('0x34')]=qs[_0xf31b('0x35')](_0x45a9d0[_0xf31b('0x2b')][_0xf31b('0x35')]);_0x3c5d7a['where']=qs['filters'](_[_0xf31b('0x36')](_0x45a9d0[_0xf31b('0x2b')],_0x4a3df1[_0xf31b('0x2d')]),_0x1311f6);if(_0x45a9d0['query']['filter']){_0x3c5d7a['where']=_[_0xf31b('0x37')](_0x3c5d7a['where'],{'$or':_[_0xf31b('0x2a')](_0x1311f6,function(_0x204362){if(_0x204362[_0xf31b('0x38')]!=='VIRTUAL'){var _0x498314={};_0x498314[_0x204362['name']]={'$like':'%'+_0x45a9d0[_0xf31b('0x2b')][_0xf31b('0x39')]+'%'};return _0x498314;}})});}_0x3c5d7a=_[_0xf31b('0x37')]({},_0x3c5d7a,_0x45a9d0[_0xf31b('0x3a')]);var _0x11290b={'where':_0x3c5d7a[_0xf31b('0x3b')]};return db[_0xf31b('0x26')][_0xf31b('0x1d')](_0x11290b)[_0xf31b('0x3c')](function(_0x2eb01f){_0x5bb5c5[_0xf31b('0x1d')]=_0x2eb01f;if(_0x45a9d0['query']['includeAll']){_0x3c5d7a[_0xf31b('0x3d')]=[{'all':!![]}];}return db[_0xf31b('0x26')]['findAll'](_0x3c5d7a);})[_0xf31b('0x3c')](function(_0x208110){_0x5bb5c5[_0xf31b('0x3e')]=_0x208110;return _0x5bb5c5;})[_0xf31b('0x3c')](respondWithFilteredResult(_0x352469,_0x3c5d7a))[_0xf31b('0x3f')](handleError(_0x352469,null));};exports[_0xf31b('0x40')]=function(_0x328a02,_0x132768){var _0x4a46b6={'raw':!![],'where':{'id':_0x328a02[_0xf31b('0x41')]['id']}},_0x37f62e={};_0x37f62e[_0xf31b('0x29')]=_['keys'](db['SquareRecording'][_0xf31b('0x42')]);_0x37f62e['query']=_[_0xf31b('0x2c')](_0x328a02[_0xf31b('0x2b')]);_0x37f62e[_0xf31b('0x2d')]=_[_0xf31b('0x2e')](_0x37f62e['model'],_0x37f62e[_0xf31b('0x2b')]);_0x4a46b6[_0xf31b('0x30')]=_[_0xf31b('0x2e')](_0x37f62e[_0xf31b('0x29')],qs[_0xf31b('0x2f')](_0x328a02[_0xf31b('0x2b')][_0xf31b('0x2f')]));_0x4a46b6[_0xf31b('0x30')]=_0x4a46b6['attributes']['length']?_0x4a46b6[_0xf31b('0x30')]:_0x37f62e[_0xf31b('0x29')];if(_0x328a02[_0xf31b('0x2b')][_0xf31b('0x43')]){_0x4a46b6['include']=[{'all':!![]}];}_0x4a46b6=_[_0xf31b('0x37')]({},_0x4a46b6,_0x328a02[_0xf31b('0x3a')]);return db[_0xf31b('0x26')]['find'](_0x4a46b6)[_0xf31b('0x3c')](handleEntityNotFound(_0x132768,null))[_0xf31b('0x3c')](respondWithResult(_0x132768,null))['catch'](handleError(_0x132768,null));};exports[_0xf31b('0x44')]=function(_0x31b090,_0x42f814){return db['SquareRecording'][_0xf31b('0x44')](_0x31b090[_0xf31b('0x45')],{})[_0xf31b('0x3c')](respondWithResult(_0x42f814,0xc9))[_0xf31b('0x3f')](handleError(_0x42f814,null));};exports['update']=function(_0x527e9d,_0x27ba32){if(_0x527e9d[_0xf31b('0x45')]['id']){delete _0x527e9d[_0xf31b('0x45')]['id'];}return db['SquareRecording'][_0xf31b('0x46')]({'where':{'id':_0x527e9d['params']['id']}})[_0xf31b('0x3c')](handleEntityNotFound(_0x27ba32,null))['then'](saveUpdates(_0x527e9d[_0xf31b('0x45')],null))[_0xf31b('0x3c')](respondWithResult(_0x27ba32,null))[_0xf31b('0x3f')](handleError(_0x27ba32,null));};exports[_0xf31b('0x47')]=function(_0x573bf4,_0x5e78fe,_0x188541){var _0x585499=require(_0xf31b('0x48'));var _0x4d5fc5=![];var _0x36d24f={};if(_0x573bf4[_0xf31b('0x2b')][_0xf31b('0x38')]&&_0x573bf4[_0xf31b('0x2b')][_0xf31b('0x38')]===_0xf31b('0x49')){_0x36d24f[_0xf31b('0x49')]=_0x573bf4[_0xf31b('0x41')]['id'];}else{_0x36d24f['id']=_0x573bf4[_0xf31b('0x41')]['id'];}return db[_0xf31b('0x26')][_0xf31b('0x46')]({'where':_0x36d24f,'attributes':['id',_0xf31b('0x4a'),_0xf31b('0x4b')],'raw':!![]})[_0xf31b('0x3c')](handleEntityNotFound(_0x5e78fe,null))[_0xf31b('0x3c')](function(_0x2dd63b){if(_0x2dd63b){var _0x371200=_0x2dd63b['savePath'];var _0xe5b2f0=util['format'](_0xf31b('0x4c'),_0x371200);if(fs[_0xf31b('0x4d')](_0xe5b2f0)){_0x4d5fc5=!![];return _0x585499[_0xf31b('0x4e')](_0xe5b2f0,_0x371200,config[_0xf31b('0x4f')]['recording'])[_0xf31b('0x3c')](function(){return _0x2dd63b;});}return _0x2dd63b;}})[_0xf31b('0x3c')](function(_0x2a14fb){if(_0x2a14fb){var _0x3e2f10=_0x2a14fb[_0xf31b('0x4a')];if(!fs[_0xf31b('0x4d')](_0x3e2f10)){throw new db[(_0xf31b('0x50'))]['ValidationError'](_0xf31b('0x51'));}if(_0x2a14fb[_0xf31b('0x4b')]){return _0x5e78fe[_0xf31b('0x47')](_0x3e2f10,_0x2a14fb[_0xf31b('0x4b')]+path[_0xf31b('0x52')](_0x3e2f10),function(){if(_0x4d5fc5){fs['unlink'](_0x3e2f10);}});}else{return _0x5e78fe[_0xf31b('0x47')](_0x3e2f10,function(_0x220833){if(_0x4d5fc5){fs[_0xf31b('0x53')](_0x3e2f10);}});}}})[_0xf31b('0x3f')](function(_0x4b1710){if(_0x4b1710[_0xf31b('0x54')]===_0xf31b('0x51')){_0x5e78fe[_0xf31b('0x19')](0x194)[_0xf31b('0x24')]('Not\x20found');}else{return handleError(_0x5e78fe,null);}});};exports[_0xf31b('0x21')]=function(_0x24e85b,_0x36d16d){return db[_0xf31b('0x26')]['find']({'where':{'id':_0x24e85b['params']['id']}})[_0xf31b('0x3c')](function(_0x38dac6){if(_[_0xf31b('0x55')](_0x38dac6)){throw new ReferenceError(_0xf31b('0x56'));}return _0x38dac6;})[_0xf31b('0x3c')](function(_0x3aa59f){var _0xeb6ac5=_0x3aa59f[_0xf31b('0x4a')];logger[_0xf31b('0x57')](_0xf31b('0x58'),_0xeb6ac5);if(!_[_0xf31b('0x55')](_0x3aa59f[_0xf31b('0x4a')])&&fs['existsSync'](_0xeb6ac5)){logger[_0xf31b('0x57')](_0xf31b('0x59')+_0xeb6ac5+_0xf31b('0x5a'));fs[_0xf31b('0x5b')](_0xeb6ac5);}_0xeb6ac5=_0xeb6ac5+_0xf31b('0x5c');if(!_[_0xf31b('0x55')](_0x3aa59f[_0xf31b('0x4a')])&&fs[_0xf31b('0x4d')](_0xeb6ac5)){logger[_0xf31b('0x57')]('File:\x20\x22'+_0xeb6ac5+_0xf31b('0x5a'));fs[_0xf31b('0x5b')](_0xeb6ac5);}return _0x3aa59f;})[_0xf31b('0x3c')](function(_0x477d64){if(!_0x477d64)throw new InternalError();return _0x477d64['destroy']();})[_0xf31b('0x3c')](function(){_0x36d16d[_0xf31b('0x19')](0xcc)['end']();})[_0xf31b('0x3f')](handleError(_0x36d16d,null));}; \ No newline at end of file +var _0x43b1=['attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','params','download','../../components/encryptor','uniqueid','savePath','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','message','send','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x43b1,0x1b2));var _0x143b=function(_0x2cf9eb,_0x2d4c2f){_0x2cf9eb=_0x2cf9eb-0x0;var _0x1637c8=_0x43b1[_0x2cf9eb];return _0x1637c8;};'use strict';var emlformat=require(_0x143b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x143b('0x1'));var jsonpatch=require(_0x143b('0x2'));var rp=require(_0x143b('0x3'));var moment=require('moment');var BPromise=require(_0x143b('0x4'));var Mustache=require('mustache');var util=require(_0x143b('0x5'));var path=require(_0x143b('0x6'));var sox=require('sox');var csv=require(_0x143b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x143b('0x8'));var _=require(_0x143b('0x9'));var squel=require('squel');var crypto=require(_0x143b('0xa'));var jsforce=require(_0x143b('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x143b('0xc'));var Papa=require(_0x143b('0xd'));var Redis=require(_0x143b('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x143b('0xf'));var hardwareService=require(_0x143b('0x10'));var logger=require('../../config/logger')(_0x143b('0x11'));var utils=require(_0x143b('0x12'));var config=require(_0x143b('0x13'));var licenseUtil=require(_0x143b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9391e0,_0x322be2){_0x322be2=_0x322be2||0xcc;return function(_0x14a732){if(_0x14a732){return _0x9391e0[_0x143b('0x15')](_0x322be2);}return _0x9391e0[_0x143b('0x16')](_0x322be2)[_0x143b('0x17')]();};}function respondWithResult(_0x3a5131,_0xd30a36){_0xd30a36=_0xd30a36||0xc8;return function(_0x19939d){if(_0x19939d){return _0x3a5131['status'](_0xd30a36)[_0x143b('0x18')](_0x19939d);}};}function respondWithFilteredResult(_0x28d829,_0x50bd1b){return function(_0x507218){if(_0x507218){var _0x30fb7b=typeof _0x50bd1b[_0x143b('0x19')]===_0x143b('0x1a')&&typeof _0x50bd1b[_0x143b('0x1b')]===_0x143b('0x1a');var _0x1a07f7=_0x507218[_0x143b('0x1c')];var _0xf8b218=_0x30fb7b?0x0:_0x50bd1b[_0x143b('0x19')];var _0x3988a9=_0x30fb7b?_0x507218[_0x143b('0x1c')]:_0x50bd1b['offset']+_0x50bd1b['limit'];var _0x2cd027;if(_0x3988a9>=_0x1a07f7){_0x3988a9=_0x1a07f7;_0x2cd027=0xc8;}else{_0x2cd027=0xce;}_0x28d829[_0x143b('0x16')](_0x2cd027);return _0x28d829[_0x143b('0x1d')]('Content-Range',_0xf8b218+'-'+_0x3988a9+'/'+_0x1a07f7)[_0x143b('0x18')](_0x507218);}return null;};}function patchUpdates(_0x54d54f){return function(_0x3e59cd){try{jsonpatch[_0x143b('0x1e')](_0x3e59cd,_0x54d54f,!![]);}catch(_0x598e12){return BPromise[_0x143b('0x1f')](_0x598e12);}return _0x3e59cd[_0x143b('0x20')]();};}function saveUpdates(_0x45a84a,_0x43fd99){return function(_0x4f9fba){if(_0x4f9fba){return _0x4f9fba[_0x143b('0x21')](_0x45a84a)[_0x143b('0x22')](function(_0x58e552){return _0x58e552;});}return null;};}function removeEntity(_0xdc263e,_0x1e11b8){return function(_0x1da4ce){if(_0x1da4ce){return _0x1da4ce[_0x143b('0x23')]()['then'](function(){_0xdc263e[_0x143b('0x16')](0xcc)[_0x143b('0x17')]();});}};}function handleEntityNotFound(_0x17131c,_0x31424f){return function(_0x5e221c){if(!_0x5e221c){_0x17131c['sendStatus'](0x194);}return _0x5e221c;};}function handleError(_0x5cb800,_0x289985){_0x289985=_0x289985||0x1f4;return function(_0x2865fa){logger[_0x143b('0x24')](_0x2865fa[_0x143b('0x25')]);if(_0x2865fa[_0x143b('0x26')]){delete _0x2865fa[_0x143b('0x26')];}_0x5cb800[_0x143b('0x16')](_0x289985)['send'](_0x2865fa);};}exports[_0x143b('0x27')]=function(_0x5b9323,_0x291970){var _0x5aa41f={},_0x51c6a0={},_0x5d45b1={'count':0x0,'rows':[]};var _0x23d7b7=_[_0x143b('0x28')](db[_0x143b('0x29')][_0x143b('0x2a')],function(_0x1bfb2d){return{'name':_0x1bfb2d[_0x143b('0x2b')],'type':_0x1bfb2d[_0x143b('0x2c')][_0x143b('0x2d')]};});_0x51c6a0[_0x143b('0x2e')]=_['map'](_0x23d7b7,_0x143b('0x26'));_0x51c6a0['query']=_[_0x143b('0x2f')](_0x5b9323[_0x143b('0x30')]);_0x51c6a0[_0x143b('0x31')]=_[_0x143b('0x32')](_0x51c6a0[_0x143b('0x2e')],_0x51c6a0[_0x143b('0x30')]);_0x5aa41f[_0x143b('0x33')]=_[_0x143b('0x32')](_0x51c6a0[_0x143b('0x2e')],qs[_0x143b('0x34')](_0x5b9323['query'][_0x143b('0x34')]));_0x5aa41f[_0x143b('0x33')]=_0x5aa41f[_0x143b('0x33')][_0x143b('0x35')]?_0x5aa41f[_0x143b('0x33')]:_0x51c6a0[_0x143b('0x2e')];if(!_0x5b9323[_0x143b('0x30')][_0x143b('0x36')]('nolimit')){_0x5aa41f[_0x143b('0x1b')]=qs['limit'](_0x5b9323['query'][_0x143b('0x1b')]);_0x5aa41f['offset']=qs['offset'](_0x5b9323['query'][_0x143b('0x19')]);}_0x5aa41f[_0x143b('0x37')]=qs[_0x143b('0x38')](_0x5b9323[_0x143b('0x30')][_0x143b('0x38')]);_0x5aa41f[_0x143b('0x39')]=qs['filters'](_['pick'](_0x5b9323['query'],_0x51c6a0[_0x143b('0x31')]),_0x23d7b7);if(_0x5b9323[_0x143b('0x30')][_0x143b('0x3a')]){_0x5aa41f[_0x143b('0x39')]=_[_0x143b('0x3b')](_0x5aa41f[_0x143b('0x39')],{'$or':_[_0x143b('0x28')](_0x23d7b7,function(_0x1bea24){if(_0x1bea24['type']!==_0x143b('0x3c')){var _0x31cddb={};_0x31cddb[_0x1bea24[_0x143b('0x26')]]={'$like':'%'+_0x5b9323[_0x143b('0x30')][_0x143b('0x3a')]+'%'};return _0x31cddb;}})});}_0x5aa41f=_[_0x143b('0x3b')]({},_0x5aa41f,_0x5b9323[_0x143b('0x3d')]);var _0x4f4964={'where':_0x5aa41f['where']};return db[_0x143b('0x29')][_0x143b('0x1c')](_0x4f4964)[_0x143b('0x22')](function(_0x135339){_0x5d45b1[_0x143b('0x1c')]=_0x135339;if(_0x5b9323['query']['includeAll']){_0x5aa41f[_0x143b('0x3e')]=[{'all':!![]}];}return db['SquareRecording'][_0x143b('0x3f')](_0x5aa41f);})[_0x143b('0x22')](function(_0x491f9f){_0x5d45b1[_0x143b('0x40')]=_0x491f9f;return _0x5d45b1;})[_0x143b('0x22')](respondWithFilteredResult(_0x291970,_0x5aa41f))[_0x143b('0x41')](handleError(_0x291970,null));};exports[_0x143b('0x42')]=function(_0x12b77e,_0x28501b){var _0x43f75a={'raw':!![],'where':{'id':_0x12b77e['params']['id']}},_0x40c070={};_0x40c070[_0x143b('0x2e')]=_[_0x143b('0x2f')](db[_0x143b('0x29')][_0x143b('0x2a')]);_0x40c070['query']=_['keys'](_0x12b77e[_0x143b('0x30')]);_0x40c070[_0x143b('0x31')]=_[_0x143b('0x32')](_0x40c070[_0x143b('0x2e')],_0x40c070['query']);_0x43f75a['attributes']=_[_0x143b('0x32')](_0x40c070[_0x143b('0x2e')],qs['fields'](_0x12b77e[_0x143b('0x30')][_0x143b('0x34')]));_0x43f75a[_0x143b('0x33')]=_0x43f75a[_0x143b('0x33')][_0x143b('0x35')]?_0x43f75a[_0x143b('0x33')]:_0x40c070['model'];if(_0x12b77e[_0x143b('0x30')][_0x143b('0x43')]){_0x43f75a[_0x143b('0x3e')]=[{'all':!![]}];}_0x43f75a=_[_0x143b('0x3b')]({},_0x43f75a,_0x12b77e[_0x143b('0x3d')]);return db[_0x143b('0x29')][_0x143b('0x44')](_0x43f75a)[_0x143b('0x22')](handleEntityNotFound(_0x28501b,null))[_0x143b('0x22')](respondWithResult(_0x28501b,null))['catch'](handleError(_0x28501b,null));};exports['create']=function(_0x9110ba,_0x5000d4){return db[_0x143b('0x29')][_0x143b('0x45')](_0x9110ba[_0x143b('0x46')],{})[_0x143b('0x22')](respondWithResult(_0x5000d4,0xc9))['catch'](handleError(_0x5000d4,null));};exports[_0x143b('0x21')]=function(_0x630d9c,_0x51d2f3){if(_0x630d9c[_0x143b('0x46')]['id']){delete _0x630d9c[_0x143b('0x46')]['id'];}return db[_0x143b('0x29')][_0x143b('0x44')]({'where':{'id':_0x630d9c[_0x143b('0x47')]['id']}})[_0x143b('0x22')](handleEntityNotFound(_0x51d2f3,null))[_0x143b('0x22')](saveUpdates(_0x630d9c[_0x143b('0x46')],null))['then'](respondWithResult(_0x51d2f3,null))[_0x143b('0x41')](handleError(_0x51d2f3,null));};exports[_0x143b('0x48')]=function(_0x275132,_0x2671e7,_0x18d366){var _0x4f058c=require(_0x143b('0x49'));var _0x1f8bb0=![];var _0x9f7f5a={};if(_0x275132[_0x143b('0x30')][_0x143b('0x2c')]&&_0x275132[_0x143b('0x30')][_0x143b('0x2c')]===_0x143b('0x4a')){_0x9f7f5a[_0x143b('0x4a')]=_0x275132[_0x143b('0x47')]['id'];}else{_0x9f7f5a['id']=_0x275132[_0x143b('0x47')]['id'];}return db[_0x143b('0x29')][_0x143b('0x44')]({'where':_0x9f7f5a,'attributes':['id',_0x143b('0x4b'),'filename'],'raw':!![]})[_0x143b('0x22')](handleEntityNotFound(_0x2671e7,null))[_0x143b('0x22')](function(_0x1b17cb){if(_0x1b17cb){var _0x23b59b=_0x1b17cb[_0x143b('0x4b')];var _0x25a59c=util[_0x143b('0x4c')](_0x143b('0x4d'),_0x23b59b);if(fs[_0x143b('0x4e')](_0x25a59c)){_0x1f8bb0=!![];return _0x4f058c[_0x143b('0x4f')](_0x25a59c,_0x23b59b,config[_0x143b('0x50')][_0x143b('0x51')])[_0x143b('0x22')](function(){return _0x1b17cb;});}return _0x1b17cb;}})[_0x143b('0x22')](function(_0x13910c){if(_0x13910c){var _0x4ffc22=_0x13910c['savePath'];if(!fs[_0x143b('0x4e')](_0x4ffc22)){throw new db[(_0x143b('0x52'))][(_0x143b('0x53'))](_0x143b('0x54'));}if(_0x13910c[_0x143b('0x55')]){return _0x2671e7[_0x143b('0x48')](_0x4ffc22,_0x13910c['filename']+path[_0x143b('0x56')](_0x4ffc22),function(){if(_0x1f8bb0){fs['unlink'](_0x4ffc22);}});}else{return _0x2671e7['download'](_0x4ffc22,function(_0x26f4a5){if(_0x1f8bb0){fs['unlink'](_0x4ffc22);}});}}})['catch'](function(_0x571e23){if(_0x571e23[_0x143b('0x57')]===_0x143b('0x54')){_0x2671e7['status'](0x194)[_0x143b('0x58')](_0x143b('0x59'));}else{return handleError(_0x2671e7,null);}});};exports[_0x143b('0x23')]=function(_0x21752f,_0x48a23f){return db['SquareRecording'][_0x143b('0x44')]({'where':{'id':_0x21752f['params']['id']}})[_0x143b('0x22')](function(_0x33ce24){if(_['isNil'](_0x33ce24)){throw new ReferenceError(_0x143b('0x5a'));}return _0x33ce24;})['then'](function(_0x9c5aff){var _0x27d90e=_0x9c5aff[_0x143b('0x4b')];logger[_0x143b('0x5b')](_0x143b('0x5c'),_0x27d90e);if(!_['isNil'](_0x9c5aff[_0x143b('0x4b')])&&fs['existsSync'](_0x27d90e)){logger['info']('File:\x20\x22'+_0x27d90e+_0x143b('0x5d'));fs[_0x143b('0x5e')](_0x27d90e);}_0x27d90e=_0x27d90e+_0x143b('0x5f');if(!_['isNil'](_0x9c5aff['savePath'])&&fs['existsSync'](_0x27d90e)){logger['info'](_0x143b('0x60')+_0x27d90e+_0x143b('0x5d'));fs[_0x143b('0x5e')](_0x27d90e);}return _0x9c5aff;})['then'](function(_0x2408cb){if(!_0x2408cb)throw new InternalError();return _0x2408cb[_0x143b('0x23')]();})[_0x143b('0x22')](function(){_0x48a23f['status'](0xcc)[_0x143b('0x17')]();})['catch'](handleError(_0x48a23f,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index f3729eb..9556e87 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 _0x0a1c=['square_recordings','../../config/logger','api','moment','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording'];(function(_0x2dc367,_0x591c8a){var _0x14845a=function(_0xaef88b){while(--_0xaef88b){_0x2dc367['push'](_0x2dc367['shift']());}};_0x14845a(++_0x591c8a);}(_0x0a1c,0xd2));var _0xc0a1=function(_0x17bb31,_0x2fc6f8){_0x17bb31=_0x17bb31-0x0;var _0x505c71=_0x0a1c[_0x17bb31];return _0x505c71;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc0a1('0x0'))(_0xc0a1('0x1'));var moment=require(_0xc0a1('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc0a1('0x3'));var rimraf=require(_0xc0a1('0x4'));var config=require(_0xc0a1('0x5'));var attributes=require(_0xc0a1('0x6'));module[_0xc0a1('0x7')]=function(_0x3549cf,_0x2eec13){return _0x3549cf[_0xc0a1('0x8')](_0xc0a1('0x9'),attributes,{'tableName':_0xc0a1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0650=['bluebird','path','rimraf','../../config/environment','exports','SquareRecording','square_recordings','lodash','../../config/logger','api'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x0650,0xed));var _0x0065=function(_0x57db4c,_0x8f9084){_0x57db4c=_0x57db4c-0x0;var _0x1758f2=_0x0650[_0x57db4c];return _0x1758f2;};'use strict';var _=require(_0x0065('0x0'));var util=require('util');var logger=require(_0x0065('0x1'))(_0x0065('0x2'));var moment=require('moment');var BPromise=require(_0x0065('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0065('0x4'));var rimraf=require(_0x0065('0x5'));var config=require(_0x0065('0x6'));var attributes=require('./squareRecording.attributes');module[_0x0065('0x7')]=function(_0x507ed3,_0x5cf16e){return _0x507ed3['define'](_0x0065('0x8'),attributes,{'tableName':_0x0065('0x9'),'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 7825d49..a6e2019 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 _0x7b14=['code','message','result','catch','CreateSquareRecording','create','body','options','lodash','util','../../config/utils','rpc','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5b633e,_0x1ed203){var _0x2153ed=function(_0x3cd3c0){while(--_0x3cd3c0){_0x5b633e['push'](_0x5b633e['shift']());}};_0x2153ed(++_0x1ed203);}(_0x7b14,0x9b));var _0x47b1=function(_0x2bb687,_0x29943b){_0x2bb687=_0x2bb687-0x0;var _0x4e2d03=_0x7b14[_0x2bb687];return _0x4e2d03;};'use strict';var _=require(_0x47b1('0x0'));var util=require(_0x47b1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x47b1('0x2'));var logger=require('../../config/logger')(_0x47b1('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x47b1('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x5af647,_0x11e76d,_0x5c77d7){return new BPromise(function(_0x476dd7,_0x19b07f){return client['request'](_0x5af647,_0x5c77d7)[_0x47b1('0x5')](function(_0x33ee67){logger[_0x47b1('0x6')](_0x47b1('0x7'),_0x11e76d,_0x47b1('0x8'));logger[_0x47b1('0x9')](_0x47b1('0xa'),_0x11e76d,'request\x20sent',JSON[_0x47b1('0xb')](_0x33ee67));if(_0x33ee67[_0x47b1('0xc')]){if(_0x33ee67[_0x47b1('0xc')][_0x47b1('0xd')]===0x1f4){logger[_0x47b1('0xc')](_0x47b1('0x7'),_0x11e76d,_0x33ee67['error'][_0x47b1('0xe')]);return _0x19b07f(_0x33ee67[_0x47b1('0xc')][_0x47b1('0xe')]);}logger['error'](_0x47b1('0x7'),_0x11e76d,_0x33ee67[_0x47b1('0xc')]['message']);return _0x476dd7(_0x33ee67['error'][_0x47b1('0xe')]);}else{logger[_0x47b1('0x6')]('SquareRecording,\x20%s,\x20%s',_0x11e76d,_0x47b1('0x8'));_0x476dd7(_0x33ee67[_0x47b1('0xf')][_0x47b1('0xe')]);}})[_0x47b1('0x10')](function(_0xf0c58f){logger[_0x47b1('0xc')]('SquareRecording,\x20%s,\x20%s',_0x11e76d,_0xf0c58f);_0x19b07f(_0xf0c58f);});});}exports[_0x47b1('0x11')]=function(_0x25881a){var _0x318d95=this;return new Promise(function(_0xc83517,_0x1ed72e){return db['SquareRecording'][_0x47b1('0x12')](_0x25881a[_0x47b1('0x13')],{'raw':_0x25881a['options']?_0x25881a[_0x47b1('0x14')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x11513a){logger[_0x47b1('0x6')](_0x47b1('0x11'),_0x25881a);logger['debug'](_0x47b1('0x11'),_0x25881a,JSON[_0x47b1('0xb')](_0x11513a));_0xc83517(_0x11513a);})[_0x47b1('0x10')](function(_0x5cb4bf){logger[_0x47b1('0xc')](_0x47b1('0x11'),_0x5cb4bf[_0x47b1('0xe')],_0x25881a);_0x1ed72e(_0x318d95['error'](0x1f4,_0x5cb4bf[_0x47b1('0xe')]));});});}; \ No newline at end of file +var _0x7e30=['SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSquareRecording','SquareRecording','create','body','options','raw','debug','stringify','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent'];(function(_0x4621a0,_0x16e78b){var _0x2ca267=function(_0x292732){while(--_0x292732){_0x4621a0['push'](_0x4621a0['shift']());}};_0x2ca267(++_0x16e78b);}(_0x7e30,0x1de));var _0x07e3=function(_0x13ecb7,_0x2de1f2){_0x13ecb7=_0x13ecb7-0x0;var _0x317e9d=_0x7e30[_0x13ecb7];return _0x317e9d;};'use strict';var _=require('lodash');var util=require(_0x07e3('0x0'));var moment=require(_0x07e3('0x1'));var BPromise=require(_0x07e3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x07e3('0x3'));var db=require(_0x07e3('0x4'))['db'];var utils=require(_0x07e3('0x5'));var logger=require(_0x07e3('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x07e3('0x7'));var client=jayson[_0x07e3('0x8')][_0x07e3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21f1c2,_0xefb37c,_0x5cd2e4){return new BPromise(function(_0x5972cd,_0x582e2a){return client[_0x07e3('0xa')](_0x21f1c2,_0x5cd2e4)[_0x07e3('0xb')](function(_0x804738){logger[_0x07e3('0xc')](_0x07e3('0xd'),_0xefb37c,_0x07e3('0xe'));logger['debug'](_0x07e3('0xf'),_0xefb37c,_0x07e3('0xe'),JSON['stringify'](_0x804738));if(_0x804738[_0x07e3('0x10')]){if(_0x804738[_0x07e3('0x10')][_0x07e3('0x11')]===0x1f4){logger[_0x07e3('0x10')](_0x07e3('0xd'),_0xefb37c,_0x804738[_0x07e3('0x10')][_0x07e3('0x12')]);return _0x582e2a(_0x804738['error'][_0x07e3('0x12')]);}logger['error'](_0x07e3('0xd'),_0xefb37c,_0x804738[_0x07e3('0x10')][_0x07e3('0x12')]);return _0x5972cd(_0x804738[_0x07e3('0x10')][_0x07e3('0x12')]);}else{logger[_0x07e3('0xc')](_0x07e3('0xd'),_0xefb37c,_0x07e3('0xe'));_0x5972cd(_0x804738[_0x07e3('0x13')][_0x07e3('0x12')]);}})['catch'](function(_0xc50b7){logger[_0x07e3('0x10')]('SquareRecording,\x20%s,\x20%s',_0xefb37c,_0xc50b7);_0x582e2a(_0xc50b7);});});}exports[_0x07e3('0x14')]=function(_0xc44b94){var _0x3a6a0c=this;return new Promise(function(_0x2a1e06,_0x4a299d){return db[_0x07e3('0x15')][_0x07e3('0x16')](_0xc44b94[_0x07e3('0x17')],{'raw':_0xc44b94[_0x07e3('0x18')]?_0xc44b94[_0x07e3('0x18')][_0x07e3('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x24fbf3){logger[_0x07e3('0xc')](_0x07e3('0x14'),_0xc44b94);logger[_0x07e3('0x1a')]('CreateSquareRecording',_0xc44b94,JSON[_0x07e3('0x1b')](_0x24fbf3));_0x2a1e06(_0x24fbf3);})[_0x07e3('0x1c')](function(_0x53a5f5){logger[_0x07e3('0x10')](_0x07e3('0x14'),_0x53a5f5[_0x07e3('0x12')],_0xc44b94);_0x4a299d(_0x3a6a0c[_0x07e3('0x10')](0x1f4,_0x53a5f5[_0x07e3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 8e3395b..d0c321d 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(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x4084c0,_0x2bf513){var _0x2e2e2f=function(_0x17d926){while(--_0x17d926){_0x4084c0['push'](_0x4084c0['shift']());}};_0x2e2e2f(++_0x2bf513);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index f8ba943..3fdd490 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 _0xca16=['DATE','BOOLEAN','sequelize','STRING'];(function(_0x411269,_0x2ada88){var _0xc4eed7=function(_0x4a97b0){while(--_0x4a97b0){_0x411269['push'](_0x411269['shift']());}};_0xc4eed7(++_0x2ada88);}(_0xca16,0xd2));var _0x6ca1=function(_0x37fd44,_0x4b681f){_0x37fd44=_0x37fd44-0x0;var _0x39289a=_0xca16[_0x37fd44];return _0x39289a;};'use strict';var Sequelize=require(_0x6ca1('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x6ca1('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x6ca1('0x1')]},'language':{'type':Sequelize[_0x6ca1('0x1')]},'type':{'type':Sequelize[_0x6ca1('0x1')]},'uniqueid':{'type':Sequelize[_0x6ca1('0x1')]},'version':{'type':Sequelize[_0x6ca1('0x1')]},'callerid':{'type':Sequelize[_0x6ca1('0x1')]},'calleridname':{'type':Sequelize[_0x6ca1('0x1')]},'callingpres':{'type':Sequelize[_0x6ca1('0x1')]},'callingani2':{'type':Sequelize[_0x6ca1('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x6ca1('0x1')]},'rdnis':{'type':Sequelize[_0x6ca1('0x1')]},'context':{'type':Sequelize[_0x6ca1('0x1')]},'extension':{'type':Sequelize[_0x6ca1('0x1')]},'priority':{'type':Sequelize[_0x6ca1('0x1')]},'enhanced':{'type':Sequelize[_0x6ca1('0x1')]},'accountcode':{'type':Sequelize[_0x6ca1('0x1')]},'threadid':{'type':Sequelize[_0x6ca1('0x1')]},'project_name':{'type':Sequelize[_0x6ca1('0x1')]},'joinAt':{'type':Sequelize[_0x6ca1('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x6ca1('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf71f=['STRING','sequelize','exports'];(function(_0x37e0d2,_0x56f025){var _0x55e780=function(_0x41b635){while(--_0x41b635){_0x37e0d2['push'](_0x37e0d2['shift']());}};_0x55e780(++_0x56f025);}(_0xf71f,0x1ab));var _0xff71=function(_0x247000,_0x244450){_0x247000=_0x247000-0x0;var _0x3562ae=_0xf71f[_0x247000];return _0x3562ae;};'use strict';var Sequelize=require(_0xff71('0x0'));module[_0xff71('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xff71('0x2')]},'request':{'type':Sequelize[_0xff71('0x2')]},'channel':{'type':Sequelize[_0xff71('0x2')]},'language':{'type':Sequelize[_0xff71('0x2')]},'type':{'type':Sequelize[_0xff71('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xff71('0x2')]},'callerid':{'type':Sequelize[_0xff71('0x2')]},'calleridname':{'type':Sequelize[_0xff71('0x2')]},'callingpres':{'type':Sequelize[_0xff71('0x2')]},'callingani2':{'type':Sequelize[_0xff71('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xff71('0x2')]},'rdnis':{'type':Sequelize[_0xff71('0x2')]},'context':{'type':Sequelize[_0xff71('0x2')]},'extension':{'type':Sequelize[_0xff71('0x2')]},'priority':{'type':Sequelize[_0xff71('0x2')]},'enhanced':{'type':Sequelize[_0xff71('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xff71('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index bf52881..01143cc 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 _0x6c1c=['fields','length','hasOwnProperty','order','sort','filter','where','merge','options','includeAll','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','SquareReport','rawAttributes','fieldName','type','map','keys','query','filters','intersection','model','attributes'];(function(_0x389aff,_0x16144e){var _0x33d2fc=function(_0x292543){while(--_0x292543){_0x389aff['push'](_0x389aff['shift']());}};_0x33d2fc(++_0x16144e);}(_0x6c1c,0x140));var _0xc6c1=function(_0x366388,_0x4595a6){_0x366388=_0x366388-0x0;var _0x41c97e=_0x6c1c[_0x366388];return _0x41c97e;};'use strict';var emlformat=require(_0xc6c1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc6c1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc6c1('0x2'));var util=require(_0xc6c1('0x3'));var path=require(_0xc6c1('0x4'));var sox=require(_0xc6c1('0x5'));var csv=require(_0xc6c1('0x6'));var ejs=require(_0xc6c1('0x7'));var fs=require('fs');var fs_extra=require(_0xc6c1('0x8'));var _=require(_0xc6c1('0x9'));var squel=require(_0xc6c1('0xa'));var crypto=require(_0xc6c1('0xb'));var jsforce=require(_0xc6c1('0xc'));var deskjs=require(_0xc6c1('0xd'));var toCsv=require(_0xc6c1('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc6c1('0xe'));var authService=require(_0xc6c1('0xf'));var qs=require(_0xc6c1('0x10'));var as=require(_0xc6c1('0x11'));var hardwareService=require(_0xc6c1('0x12'));var logger=require(_0xc6c1('0x13'))(_0xc6c1('0x14'));var utils=require(_0xc6c1('0x15'));var config=require(_0xc6c1('0x16'));var licenseUtil=require(_0xc6c1('0x17'));var db=require(_0xc6c1('0x18'))['db'];function respondWithStatusCode(_0xbafe46,_0xbf131d){_0xbf131d=_0xbf131d||0xcc;return function(_0x386452){if(_0x386452){return _0xbafe46['sendStatus'](_0xbf131d);}return _0xbafe46[_0xc6c1('0x19')](_0xbf131d)[_0xc6c1('0x1a')]();};}function respondWithResult(_0x1b9104,_0x322ecc){_0x322ecc=_0x322ecc||0xc8;return function(_0x1f67a2){if(_0x1f67a2){return _0x1b9104[_0xc6c1('0x19')](_0x322ecc)[_0xc6c1('0x1b')](_0x1f67a2);}};}function respondWithFilteredResult(_0x44805c,_0x8d9834){return function(_0x3d932a){if(_0x3d932a){var _0x2f33ff=typeof _0x8d9834[_0xc6c1('0x1c')]===_0xc6c1('0x1d')&&typeof _0x8d9834[_0xc6c1('0x1e')]==='undefined';var _0x47251a=_0x3d932a[_0xc6c1('0x1f')];var _0x202b59=_0x2f33ff?0x0:_0x8d9834[_0xc6c1('0x1c')];var _0x5e17f7=_0x2f33ff?_0x3d932a[_0xc6c1('0x1f')]:_0x8d9834[_0xc6c1('0x1c')]+_0x8d9834['limit'];var _0x3e403a;if(_0x5e17f7>=_0x47251a){_0x5e17f7=_0x47251a;_0x3e403a=0xc8;}else{_0x3e403a=0xce;}_0x44805c[_0xc6c1('0x19')](_0x3e403a);return _0x44805c[_0xc6c1('0x20')](_0xc6c1('0x21'),_0x202b59+'-'+_0x5e17f7+'/'+_0x47251a)[_0xc6c1('0x1b')](_0x3d932a);}return null;};}function patchUpdates(_0x4c0d47){return function(_0x488cca){try{jsonpatch[_0xc6c1('0x22')](_0x488cca,_0x4c0d47,!![]);}catch(_0x255c1f){return BPromise[_0xc6c1('0x23')](_0x255c1f);}return _0x488cca[_0xc6c1('0x24')]();};}function saveUpdates(_0x567668,_0x9298d9){return function(_0x2ac486){if(_0x2ac486){return _0x2ac486[_0xc6c1('0x25')](_0x567668)[_0xc6c1('0x26')](function(_0x5de63c){return _0x5de63c;});}return null;};}function removeEntity(_0xffff13,_0x30751f){return function(_0x28546d){if(_0x28546d){return _0x28546d['destroy']()[_0xc6c1('0x26')](function(){_0xffff13[_0xc6c1('0x19')](0xcc)[_0xc6c1('0x1a')]();});}};}function handleEntityNotFound(_0x18d3c0,_0x58a40b){return function(_0x13b7fe){if(!_0x13b7fe){_0x18d3c0[_0xc6c1('0x27')](0x194);}return _0x13b7fe;};}function handleError(_0x49c807,_0xe334f9){_0xe334f9=_0xe334f9||0x1f4;return function(_0x4a137b){logger['error'](_0x4a137b[_0xc6c1('0x28')]);if(_0x4a137b[_0xc6c1('0x29')]){delete _0x4a137b[_0xc6c1('0x29')];}_0x49c807[_0xc6c1('0x19')](_0xe334f9)[_0xc6c1('0x2a')](_0x4a137b);};}exports[_0xc6c1('0x2b')]=function(_0x38550f,_0x162f8a){var _0x226c4d={},_0x13ffca={},_0x32afd5={'count':0x0,'rows':[]};var _0x4d09eb=_['map'](db[_0xc6c1('0x2c')][_0xc6c1('0x2d')],function(_0x3003d6){return{'name':_0x3003d6[_0xc6c1('0x2e')],'type':_0x3003d6[_0xc6c1('0x2f')]['key']};});_0x13ffca['model']=_[_0xc6c1('0x30')](_0x4d09eb,_0xc6c1('0x29'));_0x13ffca['query']=_[_0xc6c1('0x31')](_0x38550f[_0xc6c1('0x32')]);_0x13ffca[_0xc6c1('0x33')]=_[_0xc6c1('0x34')](_0x13ffca[_0xc6c1('0x35')],_0x13ffca[_0xc6c1('0x32')]);_0x226c4d[_0xc6c1('0x36')]=_[_0xc6c1('0x34')](_0x13ffca[_0xc6c1('0x35')],qs[_0xc6c1('0x37')](_0x38550f[_0xc6c1('0x32')]['fields']));_0x226c4d[_0xc6c1('0x36')]=_0x226c4d[_0xc6c1('0x36')][_0xc6c1('0x38')]?_0x226c4d['attributes']:_0x13ffca[_0xc6c1('0x35')];if(!_0x38550f[_0xc6c1('0x32')][_0xc6c1('0x39')]('nolimit')){_0x226c4d['limit']=qs['limit'](_0x38550f['query'][_0xc6c1('0x1e')]);_0x226c4d[_0xc6c1('0x1c')]=qs[_0xc6c1('0x1c')](_0x38550f[_0xc6c1('0x32')][_0xc6c1('0x1c')]);}_0x226c4d[_0xc6c1('0x3a')]=qs[_0xc6c1('0x3b')](_0x38550f[_0xc6c1('0x32')][_0xc6c1('0x3b')]);_0x226c4d['where']=qs[_0xc6c1('0x33')](_['pick'](_0x38550f['query'],_0x13ffca[_0xc6c1('0x33')]),_0x4d09eb);if(_0x38550f[_0xc6c1('0x32')][_0xc6c1('0x3c')]){_0x226c4d[_0xc6c1('0x3d')]=_[_0xc6c1('0x3e')](_0x226c4d[_0xc6c1('0x3d')],{'$or':_['map'](_0x4d09eb,function(_0x1bc269){if(_0x1bc269[_0xc6c1('0x2f')]!=='VIRTUAL'){var _0x356dc0={};_0x356dc0[_0x1bc269[_0xc6c1('0x29')]]={'$like':'%'+_0x38550f[_0xc6c1('0x32')][_0xc6c1('0x3c')]+'%'};return _0x356dc0;}})});}_0x226c4d=_[_0xc6c1('0x3e')]({},_0x226c4d,_0x38550f[_0xc6c1('0x3f')]);var _0x4000c7={'where':_0x226c4d['where']};return db[_0xc6c1('0x2c')][_0xc6c1('0x1f')](_0x4000c7)[_0xc6c1('0x26')](function(_0x347ccb){_0x32afd5[_0xc6c1('0x1f')]=_0x347ccb;if(_0x38550f['query'][_0xc6c1('0x40')]){_0x226c4d['include']=[{'all':!![]}];}return db[_0xc6c1('0x2c')][_0xc6c1('0x41')](_0x226c4d);})[_0xc6c1('0x26')](function(_0x17696b){_0x32afd5[_0xc6c1('0x42')]=_0x17696b;return _0x32afd5;})[_0xc6c1('0x26')](respondWithFilteredResult(_0x162f8a,_0x226c4d))[_0xc6c1('0x43')](handleError(_0x162f8a,null));};exports[_0xc6c1('0x44')]=function(_0x422d47,_0x45e4f2){var _0x117a96={'raw':!![],'where':{'id':_0x422d47[_0xc6c1('0x45')]['id']}},_0x299da9={};_0x299da9[_0xc6c1('0x35')]=_[_0xc6c1('0x31')](db['SquareReport'][_0xc6c1('0x2d')]);_0x299da9[_0xc6c1('0x32')]=_[_0xc6c1('0x31')](_0x422d47[_0xc6c1('0x32')]);_0x299da9[_0xc6c1('0x33')]=_[_0xc6c1('0x34')](_0x299da9[_0xc6c1('0x35')],_0x299da9[_0xc6c1('0x32')]);_0x117a96[_0xc6c1('0x36')]=_[_0xc6c1('0x34')](_0x299da9[_0xc6c1('0x35')],qs[_0xc6c1('0x37')](_0x422d47[_0xc6c1('0x32')][_0xc6c1('0x37')]));_0x117a96[_0xc6c1('0x36')]=_0x117a96[_0xc6c1('0x36')][_0xc6c1('0x38')]?_0x117a96[_0xc6c1('0x36')]:_0x299da9['model'];if(_0x422d47[_0xc6c1('0x32')][_0xc6c1('0x40')]){_0x117a96['include']=[{'all':!![]}];}_0x117a96=_[_0xc6c1('0x3e')]({},_0x117a96,_0x422d47[_0xc6c1('0x3f')]);return db[_0xc6c1('0x2c')][_0xc6c1('0x46')](_0x117a96)['then'](handleEntityNotFound(_0x45e4f2,null))['then'](respondWithResult(_0x45e4f2,null))[_0xc6c1('0x43')](handleError(_0x45e4f2,null));};exports[_0xc6c1('0x47')]=function(_0x417fb9,_0x4cb740){return db[_0xc6c1('0x2c')][_0xc6c1('0x47')](_0x417fb9['body'],{})[_0xc6c1('0x26')](respondWithResult(_0x4cb740,0xc9))['catch'](handleError(_0x4cb740,null));};exports[_0xc6c1('0x25')]=function(_0x4407b2,_0x13edd0){if(_0x4407b2['body']['id']){delete _0x4407b2[_0xc6c1('0x48')]['id'];}return db[_0xc6c1('0x2c')][_0xc6c1('0x46')]({'where':{'id':_0x4407b2[_0xc6c1('0x45')]['id']}})[_0xc6c1('0x26')](handleEntityNotFound(_0x13edd0,null))[_0xc6c1('0x26')](saveUpdates(_0x4407b2[_0xc6c1('0x48')],null))[_0xc6c1('0x26')](respondWithResult(_0x13edd0,null))['catch'](handleError(_0x13edd0,null));};exports[_0xc6c1('0x49')]=function(_0x2a4fd6,_0x36af5e){return db['SquareReport'][_0xc6c1('0x46')]({'where':{'id':_0x2a4fd6[_0xc6c1('0x45')]['id']}})[_0xc6c1('0x26')](handleEntityNotFound(_0x36af5e,null))['then'](removeEntity(_0x36af5e,null))[_0xc6c1('0x43')](handleError(_0x36af5e,null));};exports['describe']=function(_0x12b9ec,_0x21ec24){return db[_0xc6c1('0x2c')][_0xc6c1('0x4a')]()[_0xc6c1('0x26')](respondWithResult(_0x21ec24,null))[_0xc6c1('0x43')](handleError(_0x21ec24,null));}; \ No newline at end of file +var _0x78cb=['options','find','create','body','destroy','describe','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','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','offset','count','set','Content-Range','reject','save','update','then','stack','name','send','SquareReport','rawAttributes','fieldName','type','key','map','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','findAll','rows','catch','show','params','includeAll','include'];(function(_0x1cab55,_0x3dfe12){var _0x249425=function(_0x5e2de9){while(--_0x5e2de9){_0x1cab55['push'](_0x1cab55['shift']());}};_0x249425(++_0x3dfe12);}(_0x78cb,0x9c));var _0xb78c=function(_0x59cdd9,_0x19cca7){_0x59cdd9=_0x59cdd9-0x0;var _0x6447b2=_0x78cb[_0x59cdd9];return _0x6447b2;};'use strict';var emlformat=require(_0xb78c('0x0'));var rimraf=require(_0xb78c('0x1'));var zipdir=require(_0xb78c('0x2'));var jsonpatch=require(_0xb78c('0x3'));var rp=require(_0xb78c('0x4'));var moment=require(_0xb78c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb78c('0x6'));var util=require(_0xb78c('0x7'));var path=require(_0xb78c('0x8'));var sox=require(_0xb78c('0x9'));var csv=require(_0xb78c('0xa'));var ejs=require(_0xb78c('0xb'));var fs=require('fs');var fs_extra=require(_0xb78c('0xc'));var _=require(_0xb78c('0xd'));var squel=require(_0xb78c('0xe'));var crypto=require(_0xb78c('0xf'));var jsforce=require(_0xb78c('0x10'));var deskjs=require(_0xb78c('0x11'));var toCsv=require(_0xb78c('0xa'));var querystring=require('querystring');var Papa=require(_0xb78c('0x12'));var Redis=require(_0xb78c('0x13'));var authService=require(_0xb78c('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb78c('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xb78c('0x16'));var licenseUtil=require(_0xb78c('0x17'));var db=require(_0xb78c('0x18'))['db'];function respondWithStatusCode(_0x4c595d,_0x110639){_0x110639=_0x110639||0xcc;return function(_0x3fc66d){if(_0x3fc66d){return _0x4c595d['sendStatus'](_0x110639);}return _0x4c595d[_0xb78c('0x19')](_0x110639)[_0xb78c('0x1a')]();};}function respondWithResult(_0xa97713,_0xca0a24){_0xca0a24=_0xca0a24||0xc8;return function(_0x18464c){if(_0x18464c){return _0xa97713[_0xb78c('0x19')](_0xca0a24)[_0xb78c('0x1b')](_0x18464c);}};}function respondWithFilteredResult(_0x49ad3c,_0x5b440f){return function(_0x3ae1a5){if(_0x3ae1a5){var _0x54397c=typeof _0x5b440f['offset']==='undefined'&&typeof _0x5b440f[_0xb78c('0x1c')]==='undefined';var _0x35f6be=_0x3ae1a5['count'];var _0x12bb67=_0x54397c?0x0:_0x5b440f[_0xb78c('0x1d')];var _0x52e4a7=_0x54397c?_0x3ae1a5[_0xb78c('0x1e')]:_0x5b440f[_0xb78c('0x1d')]+_0x5b440f[_0xb78c('0x1c')];var _0x1d2af8;if(_0x52e4a7>=_0x35f6be){_0x52e4a7=_0x35f6be;_0x1d2af8=0xc8;}else{_0x1d2af8=0xce;}_0x49ad3c[_0xb78c('0x19')](_0x1d2af8);return _0x49ad3c[_0xb78c('0x1f')](_0xb78c('0x20'),_0x12bb67+'-'+_0x52e4a7+'/'+_0x35f6be)['json'](_0x3ae1a5);}return null;};}function patchUpdates(_0x368316){return function(_0x2a232){try{jsonpatch['apply'](_0x2a232,_0x368316,!![]);}catch(_0x20391c){return BPromise[_0xb78c('0x21')](_0x20391c);}return _0x2a232[_0xb78c('0x22')]();};}function saveUpdates(_0x198c6d,_0x55e48a){return function(_0x276f69){if(_0x276f69){return _0x276f69[_0xb78c('0x23')](_0x198c6d)[_0xb78c('0x24')](function(_0x122845){return _0x122845;});}return null;};}function removeEntity(_0x5b2710,_0x201dbe){return function(_0xbec3cb){if(_0xbec3cb){return _0xbec3cb['destroy']()[_0xb78c('0x24')](function(){_0x5b2710[_0xb78c('0x19')](0xcc)[_0xb78c('0x1a')]();});}};}function handleEntityNotFound(_0x22ac95,_0x4e1ea8){return function(_0x4f7316){if(!_0x4f7316){_0x22ac95['sendStatus'](0x194);}return _0x4f7316;};}function handleError(_0x540546,_0x1b7c9d){_0x1b7c9d=_0x1b7c9d||0x1f4;return function(_0x1ba6f4){logger['error'](_0x1ba6f4[_0xb78c('0x25')]);if(_0x1ba6f4['name']){delete _0x1ba6f4[_0xb78c('0x26')];}_0x540546[_0xb78c('0x19')](_0x1b7c9d)[_0xb78c('0x27')](_0x1ba6f4);};}exports['index']=function(_0x43e361,_0x529f62){var _0x43516a={},_0x58e1ca={},_0x251076={'count':0x0,'rows':[]};var _0x7b8f5f=_['map'](db[_0xb78c('0x28')][_0xb78c('0x29')],function(_0xca7bb){return{'name':_0xca7bb[_0xb78c('0x2a')],'type':_0xca7bb[_0xb78c('0x2b')][_0xb78c('0x2c')]};});_0x58e1ca['model']=_[_0xb78c('0x2d')](_0x7b8f5f,_0xb78c('0x26'));_0x58e1ca['query']=_[_0xb78c('0x2e')](_0x43e361[_0xb78c('0x2f')]);_0x58e1ca['filters']=_[_0xb78c('0x30')](_0x58e1ca[_0xb78c('0x31')],_0x58e1ca[_0xb78c('0x2f')]);_0x43516a['attributes']=_[_0xb78c('0x30')](_0x58e1ca[_0xb78c('0x31')],qs[_0xb78c('0x32')](_0x43e361[_0xb78c('0x2f')][_0xb78c('0x32')]));_0x43516a[_0xb78c('0x33')]=_0x43516a[_0xb78c('0x33')][_0xb78c('0x34')]?_0x43516a[_0xb78c('0x33')]:_0x58e1ca[_0xb78c('0x31')];if(!_0x43e361[_0xb78c('0x2f')][_0xb78c('0x35')](_0xb78c('0x36'))){_0x43516a[_0xb78c('0x1c')]=qs[_0xb78c('0x1c')](_0x43e361[_0xb78c('0x2f')][_0xb78c('0x1c')]);_0x43516a['offset']=qs[_0xb78c('0x1d')](_0x43e361[_0xb78c('0x2f')]['offset']);}_0x43516a[_0xb78c('0x37')]=qs['sort'](_0x43e361[_0xb78c('0x2f')][_0xb78c('0x38')]);_0x43516a[_0xb78c('0x39')]=qs['filters'](_[_0xb78c('0x3a')](_0x43e361['query'],_0x58e1ca[_0xb78c('0x3b')]),_0x7b8f5f);if(_0x43e361[_0xb78c('0x2f')][_0xb78c('0x3c')]){_0x43516a[_0xb78c('0x39')]=_[_0xb78c('0x3d')](_0x43516a[_0xb78c('0x39')],{'$or':_[_0xb78c('0x2d')](_0x7b8f5f,function(_0xdd0803){if(_0xdd0803[_0xb78c('0x2b')]!=='VIRTUAL'){var _0x21e36a={};_0x21e36a[_0xdd0803[_0xb78c('0x26')]]={'$like':'%'+_0x43e361[_0xb78c('0x2f')]['filter']+'%'};return _0x21e36a;}})});}_0x43516a=_[_0xb78c('0x3d')]({},_0x43516a,_0x43e361['options']);var _0x5a2947={'where':_0x43516a[_0xb78c('0x39')]};return db['SquareReport'][_0xb78c('0x1e')](_0x5a2947)['then'](function(_0x3a88ee){_0x251076[_0xb78c('0x1e')]=_0x3a88ee;if(_0x43e361[_0xb78c('0x2f')]['includeAll']){_0x43516a['include']=[{'all':!![]}];}return db[_0xb78c('0x28')][_0xb78c('0x3e')](_0x43516a);})['then'](function(_0x1b6fa2){_0x251076[_0xb78c('0x3f')]=_0x1b6fa2;return _0x251076;})['then'](respondWithFilteredResult(_0x529f62,_0x43516a))[_0xb78c('0x40')](handleError(_0x529f62,null));};exports[_0xb78c('0x41')]=function(_0xd27b78,_0x516fc7){var _0x35ce26={'raw':!![],'where':{'id':_0xd27b78[_0xb78c('0x42')]['id']}},_0x453c23={};_0x453c23[_0xb78c('0x31')]=_['keys'](db['SquareReport'][_0xb78c('0x29')]);_0x453c23[_0xb78c('0x2f')]=_['keys'](_0xd27b78[_0xb78c('0x2f')]);_0x453c23[_0xb78c('0x3b')]=_[_0xb78c('0x30')](_0x453c23['model'],_0x453c23[_0xb78c('0x2f')]);_0x35ce26[_0xb78c('0x33')]=_[_0xb78c('0x30')](_0x453c23[_0xb78c('0x31')],qs[_0xb78c('0x32')](_0xd27b78['query'][_0xb78c('0x32')]));_0x35ce26['attributes']=_0x35ce26[_0xb78c('0x33')]['length']?_0x35ce26[_0xb78c('0x33')]:_0x453c23['model'];if(_0xd27b78[_0xb78c('0x2f')][_0xb78c('0x43')]){_0x35ce26[_0xb78c('0x44')]=[{'all':!![]}];}_0x35ce26=_[_0xb78c('0x3d')]({},_0x35ce26,_0xd27b78[_0xb78c('0x45')]);return db['SquareReport'][_0xb78c('0x46')](_0x35ce26)[_0xb78c('0x24')](handleEntityNotFound(_0x516fc7,null))[_0xb78c('0x24')](respondWithResult(_0x516fc7,null))[_0xb78c('0x40')](handleError(_0x516fc7,null));};exports[_0xb78c('0x47')]=function(_0x337756,_0x482553){return db['SquareReport'][_0xb78c('0x47')](_0x337756[_0xb78c('0x48')],{})[_0xb78c('0x24')](respondWithResult(_0x482553,0xc9))[_0xb78c('0x40')](handleError(_0x482553,null));};exports['update']=function(_0x4eabe6,_0x1cf41c){if(_0x4eabe6[_0xb78c('0x48')]['id']){delete _0x4eabe6[_0xb78c('0x48')]['id'];}return db[_0xb78c('0x28')][_0xb78c('0x46')]({'where':{'id':_0x4eabe6[_0xb78c('0x42')]['id']}})[_0xb78c('0x24')](handleEntityNotFound(_0x1cf41c,null))[_0xb78c('0x24')](saveUpdates(_0x4eabe6[_0xb78c('0x48')],null))[_0xb78c('0x24')](respondWithResult(_0x1cf41c,null))[_0xb78c('0x40')](handleError(_0x1cf41c,null));};exports[_0xb78c('0x49')]=function(_0x4d9c35,_0x4d0961){return db['SquareReport'][_0xb78c('0x46')]({'where':{'id':_0x4d9c35[_0xb78c('0x42')]['id']}})['then'](handleEntityNotFound(_0x4d0961,null))['then'](removeEntity(_0x4d0961,null))['catch'](handleError(_0x4d0961,null));};exports[_0xb78c('0x4a')]=function(_0x2ad12b,_0x2189ab){return db['SquareReport'][_0xb78c('0x4a')]()[_0xb78c('0x24')](respondWithResult(_0x2189ab,null))['catch'](handleError(_0x2189ab,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 3da5db2..c8cc045 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 _0x4a3f=['define','SquareReport','report_square','uniqueid','project_name','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./squareReport.attributes'];(function(_0x19d0b6,_0x85209a){var _0x16060b=function(_0x33d5d3){while(--_0x33d5d3){_0x19d0b6['push'](_0x19d0b6['shift']());}};_0x16060b(++_0x85209a);}(_0x4a3f,0x1a9));var _0xf4a3=function(_0x1d453f,_0x5793a9){_0x1d453f=_0x1d453f-0x0;var _0x50996a=_0x4a3f[_0x1d453f];return _0x50996a;};'use strict';var _=require(_0xf4a3('0x0'));var util=require(_0xf4a3('0x1'));var logger=require(_0xf4a3('0x2'))('api');var moment=require(_0xf4a3('0x3'));var BPromise=require(_0xf4a3('0x4'));var rp=require(_0xf4a3('0x5'));var fs=require('fs');var path=require(_0xf4a3('0x6'));var rimraf=require(_0xf4a3('0x7'));var config=require('../../config/environment');var attributes=require(_0xf4a3('0x8'));module['exports']=function(_0x57573f,_0x25633b){return _0x57573f[_0xf4a3('0x9')](_0xf4a3('0xa'),attributes,{'tableName':_0xf4a3('0xb'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xf4a3('0xc'),_0xf4a3('0xd')]},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1ed1=['moment','request-promise','rimraf','../../config/environment','./squareReport.attributes','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1ed1,0x6e));var _0x11ed=function(_0x545468,_0x33cbbd){_0x545468=_0x545468-0x0;var _0x3716e6=_0x1ed1[_0x545468];return _0x3716e6;};'use strict';var _=require(_0x11ed('0x0'));var util=require(_0x11ed('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x11ed('0x2'));var BPromise=require('bluebird');var rp=require(_0x11ed('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x11ed('0x4'));var config=require(_0x11ed('0x5'));var attributes=require(_0x11ed('0x6'));module['exports']=function(_0x3b352d,_0x236aec){return _0x3b352d[_0x11ed('0x7')](_0x11ed('0x8'),attributes,{'tableName':_0x11ed('0x9'),'paranoid':![],'indexes':[{'name':_0x11ed('0xa'),'fields':[_0x11ed('0xb'),_0x11ed('0xc')]},{'name':_0x11ed('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 b1c62bf..8529961 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 _0xc959=['SquareReport','body','options','UpdateSquareReport','raw','where','attributes','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareReport'];(function(_0x573c94,_0x4ae309){var _0x5ab1a1=function(_0x1eaca9){while(--_0x1eaca9){_0x573c94['push'](_0x573c94['shift']());}};_0x5ab1a1(++_0x4ae309);}(_0xc959,0x8c));var _0x9c95=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xc959[_0x1deb03];return _0x189fe7;};'use strict';var _=require('lodash');var util=require(_0x9c95('0x0'));var moment=require('moment');var BPromise=require(_0x9c95('0x1'));var rs=require(_0x9c95('0x2'));var fs=require('fs');var Redis=require(_0x9c95('0x3'));var db=require(_0x9c95('0x4'))['db'];var utils=require(_0x9c95('0x5'));var logger=require(_0x9c95('0x6'))(_0x9c95('0x7'));var config=require('../../config/environment');var jayson=require(_0x9c95('0x8'));var client=jayson[_0x9c95('0x9')][_0x9c95('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ed770,_0xe5c4ae,_0x4415f9){return new BPromise(function(_0x34fd86,_0x393047){return client[_0x9c95('0xb')](_0x5ed770,_0x4415f9)[_0x9c95('0xc')](function(_0x17e0ee){logger[_0x9c95('0xd')](_0x9c95('0xe'),_0xe5c4ae,_0x9c95('0xf'));logger[_0x9c95('0x10')](_0x9c95('0x11'),_0xe5c4ae,_0x9c95('0xf'),JSON[_0x9c95('0x12')](_0x17e0ee));if(_0x17e0ee[_0x9c95('0x13')]){if(_0x17e0ee[_0x9c95('0x13')][_0x9c95('0x14')]===0x1f4){logger[_0x9c95('0x13')](_0x9c95('0xe'),_0xe5c4ae,_0x17e0ee[_0x9c95('0x13')][_0x9c95('0x15')]);return _0x393047(_0x17e0ee[_0x9c95('0x13')][_0x9c95('0x15')]);}logger[_0x9c95('0x13')](_0x9c95('0xe'),_0xe5c4ae,_0x17e0ee[_0x9c95('0x13')][_0x9c95('0x15')]);return _0x34fd86(_0x17e0ee['error'][_0x9c95('0x15')]);}else{logger[_0x9c95('0xd')]('SquareReport,\x20%s,\x20%s',_0xe5c4ae,_0x9c95('0xf'));_0x34fd86(_0x17e0ee[_0x9c95('0x16')][_0x9c95('0x15')]);}})[_0x9c95('0x17')](function(_0x3705ec){logger[_0x9c95('0x13')](_0x9c95('0xe'),_0xe5c4ae,_0x3705ec);_0x393047(_0x3705ec);});});}exports[_0x9c95('0x18')]=function(_0x1bd581){var _0x40a8b6=this;return new Promise(function(_0x482abc,_0x38381f){return db[_0x9c95('0x19')]['create'](_0x1bd581[_0x9c95('0x1a')],{'raw':_0x1bd581[_0x9c95('0x1b')]?_0x1bd581[_0x9c95('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x9c95('0xc')](function(_0x5e76a4){logger[_0x9c95('0xd')](_0x9c95('0x18'),_0x1bd581);logger['debug'](_0x9c95('0x18'),_0x1bd581,JSON['stringify'](_0x5e76a4));_0x482abc(_0x5e76a4);})[_0x9c95('0x17')](function(_0x33d4ee){logger[_0x9c95('0x13')](_0x9c95('0x18'),_0x33d4ee['message'],_0x1bd581);_0x38381f(_0x40a8b6[_0x9c95('0x13')](0x1f4,_0x33d4ee['message']));});});};exports[_0x9c95('0x1c')]=function(_0x224bb3){var _0x31dafb=this;return new Promise(function(_0x503090,_0x5276a5){return db['SquareReport']['update'](_0x224bb3['body'],{'raw':_0x224bb3[_0x9c95('0x1b')]?_0x224bb3['options'][_0x9c95('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x224bb3[_0x9c95('0x1b')]?_0x224bb3[_0x9c95('0x1b')][_0x9c95('0x1e')]||null:null,'attributes':_0x224bb3[_0x9c95('0x1b')]?_0x224bb3[_0x9c95('0x1b')][_0x9c95('0x1f')]||null:null,'limit':_0x224bb3['options']?_0x224bb3[_0x9c95('0x1b')][_0x9c95('0x20')]||null:null})[_0x9c95('0xc')](function(_0x2b5da5){logger[_0x9c95('0xd')]('UpdateSquareReport',_0x224bb3);logger[_0x9c95('0x10')](_0x9c95('0x1c'),_0x224bb3,JSON[_0x9c95('0x12')](_0x2b5da5));_0x503090(_0x2b5da5);})[_0x9c95('0x17')](function(_0x3e48a6){logger['error'](_0x9c95('0x1c'),_0x3e48a6[_0x9c95('0x15')],_0x224bb3);_0x5276a5(_0x31dafb[_0x9c95('0x13')](0x1f4,_0x3e48a6['message']));});});}; \ No newline at end of file +var _0x35b5=['SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','create','body','options','raw','CreateSquareReport','UpdateSquareReport','SquareReport','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x46a1eb,_0x1ac28b){var _0x2aef1d=function(_0x13b740){while(--_0x13b740){_0x46a1eb['push'](_0x46a1eb['shift']());}};_0x2aef1d(++_0x1ac28b);}(_0x35b5,0x137));var _0x535b=function(_0x35ba3a,_0x1f5a46){_0x35ba3a=_0x35ba3a-0x0;var _0x4ec69f=_0x35b5[_0x35ba3a];return _0x4ec69f;};'use strict';var _=require(_0x535b('0x0'));var util=require(_0x535b('0x1'));var moment=require(_0x535b('0x2'));var BPromise=require('bluebird');var rs=require(_0x535b('0x3'));var fs=require('fs');var Redis=require(_0x535b('0x4'));var db=require(_0x535b('0x5'))['db'];var utils=require(_0x535b('0x6'));var logger=require(_0x535b('0x7'))(_0x535b('0x8'));var config=require(_0x535b('0x9'));var jayson=require(_0x535b('0xa'));var client=jayson[_0x535b('0xb')][_0x535b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ea1a3,_0x220bcb,_0x548288){return new BPromise(function(_0x3a4dba,_0x3901ab){return client[_0x535b('0xd')](_0x1ea1a3,_0x548288)[_0x535b('0xe')](function(_0x4fe799){logger[_0x535b('0xf')](_0x535b('0x10'),_0x220bcb,_0x535b('0x11'));logger[_0x535b('0x12')](_0x535b('0x13'),_0x220bcb,_0x535b('0x11'),JSON[_0x535b('0x14')](_0x4fe799));if(_0x4fe799['error']){if(_0x4fe799[_0x535b('0x15')]['code']===0x1f4){logger[_0x535b('0x15')](_0x535b('0x10'),_0x220bcb,_0x4fe799[_0x535b('0x15')][_0x535b('0x16')]);return _0x3901ab(_0x4fe799[_0x535b('0x15')][_0x535b('0x16')]);}logger[_0x535b('0x15')]('SquareReport,\x20%s,\x20%s',_0x220bcb,_0x4fe799[_0x535b('0x15')]['message']);return _0x3a4dba(_0x4fe799[_0x535b('0x15')][_0x535b('0x16')]);}else{logger[_0x535b('0xf')](_0x535b('0x10'),_0x220bcb,_0x535b('0x11'));_0x3a4dba(_0x4fe799['result'][_0x535b('0x16')]);}})[_0x535b('0x17')](function(_0x50794b){logger[_0x535b('0x15')](_0x535b('0x10'),_0x220bcb,_0x50794b);_0x3901ab(_0x50794b);});});}exports['CreateSquareReport']=function(_0x210c77){var _0xaffed5=this;return new Promise(function(_0x454a28,_0xf52a56){return db['SquareReport'][_0x535b('0x18')](_0x210c77[_0x535b('0x19')],{'raw':_0x210c77['options']?_0x210c77[_0x535b('0x1a')][_0x535b('0x1b')]===undefined?!![]:![]:!![]})[_0x535b('0xe')](function(_0x4fbae2){logger[_0x535b('0xf')](_0x535b('0x1c'),_0x210c77);logger['debug']('CreateSquareReport',_0x210c77,JSON[_0x535b('0x14')](_0x4fbae2));_0x454a28(_0x4fbae2);})[_0x535b('0x17')](function(_0x51ff84){logger[_0x535b('0x15')](_0x535b('0x1c'),_0x51ff84[_0x535b('0x16')],_0x210c77);_0xf52a56(_0xaffed5[_0x535b('0x15')](0x1f4,_0x51ff84[_0x535b('0x16')]));});});};exports[_0x535b('0x1d')]=function(_0x2d4dee){var _0x4b76b6=this;return new Promise(function(_0x4210d0,_0x4d294d){return db[_0x535b('0x1e')]['update'](_0x2d4dee[_0x535b('0x19')],{'raw':_0x2d4dee[_0x535b('0x1a')]?_0x2d4dee['options'][_0x535b('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d4dee[_0x535b('0x1a')]?_0x2d4dee[_0x535b('0x1a')]['where']||null:null,'attributes':_0x2d4dee['options']?_0x2d4dee[_0x535b('0x1a')][_0x535b('0x1f')]||null:null,'limit':_0x2d4dee['options']?_0x2d4dee[_0x535b('0x1a')][_0x535b('0x20')]||null:null})[_0x535b('0xe')](function(_0x1fd2f8){logger[_0x535b('0xf')]('UpdateSquareReport',_0x2d4dee);logger[_0x535b('0x12')](_0x535b('0x1d'),_0x2d4dee,JSON[_0x535b('0x14')](_0x1fd2f8));_0x4210d0(_0x1fd2f8);})[_0x535b('0x17')](function(_0x3dcdb6){logger[_0x535b('0x15')]('UpdateSquareReport',_0x3dcdb6['message'],_0x2d4dee);_0x4d294d(_0x4b76b6[_0x535b('0x15')](0x1f4,_0x3dcdb6[_0x535b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 0c04355..15009ff 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 _0x9dca=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x1b3a5c,_0x2f9d5f){var _0x2ae8cb=function(_0x549ab8){while(--_0x549ab8){_0x1b3a5c['push'](_0x1b3a5c['shift']());}};_0x2ae8cb(++_0x2f9d5f);}(_0x9dca,0x84));var _0xa9dc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9dca[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa9dc('0x0'));var util=require(_0xa9dc('0x1'));var path=require(_0xa9dc('0x2'));var timeout=require(_0xa9dc('0x3'));var express=require(_0xa9dc('0x4'));var router=express[_0xa9dc('0x5')]();var fs_extra=require(_0xa9dc('0x6'));var auth=require(_0xa9dc('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xa9dc('0x8')]('/',auth[_0xa9dc('0x9')](),controller[_0xa9dc('0xa')]);router[_0xa9dc('0x8')](_0xa9dc('0xb'),auth[_0xa9dc('0x9')](),controller[_0xa9dc('0xc')]);router[_0xa9dc('0x8')](_0xa9dc('0xd'),auth[_0xa9dc('0x9')](),controller[_0xa9dc('0xe')]);router[_0xa9dc('0xf')]('/',auth[_0xa9dc('0x9')](),controller['create']);router[_0xa9dc('0x10')]('/:id',auth[_0xa9dc('0x9')](),controller[_0xa9dc('0x11')]);router[_0xa9dc('0x12')](_0xa9dc('0xd'),auth[_0xa9dc('0x9')](),controller[_0xa9dc('0x13')]);module[_0xa9dc('0x14')]=router; \ No newline at end of file +var _0x6301=['fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','/describe','describe','show','post','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router'];(function(_0x4a354b,_0x3256e5){var _0x5b28e3=function(_0x23c6db){while(--_0x23c6db){_0x4a354b['push'](_0x4a354b['shift']());}};_0x5b28e3(++_0x3256e5);}(_0x6301,0x9b));var _0x1630=function(_0xb11639,_0x9c8aa8){_0xb11639=_0xb11639-0x0;var _0x2f87de=_0x6301[_0xb11639];return _0x2f87de;};'use strict';var multer=require(_0x1630('0x0'));var util=require(_0x1630('0x1'));var path=require('path');var timeout=require(_0x1630('0x2'));var express=require(_0x1630('0x3'));var router=express[_0x1630('0x4')]();var fs_extra=require(_0x1630('0x5'));var auth=require(_0x1630('0x6'));var interaction=require(_0x1630('0x7'));var config=require('../../config/environment');var controller=require(_0x1630('0x8'));router[_0x1630('0x9')]('/',auth[_0x1630('0xa')](),controller['index']);router[_0x1630('0x9')](_0x1630('0xb'),auth['isAuthenticated'](),controller[_0x1630('0xc')]);router[_0x1630('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x1630('0xd')]);router[_0x1630('0xe')]('/',auth[_0x1630('0xa')](),controller['create']);router[_0x1630('0xf')](_0x1630('0x10'),auth[_0x1630('0xa')](),controller[_0x1630('0x11')]);router[_0x1630('0x12')](_0x1630('0x10'),auth['isAuthenticated'](),controller[_0x1630('0x13')]);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 1ebd4a3..5f45732 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 _0x620d=['TEXT','sequelize','exports','STRING'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x620d,0xf5));var _0xd620=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x620d[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0xd620('0x0'));module[_0xd620('0x1')]={'uniqueid':{'type':Sequelize[_0xd620('0x2')]},'node':{'type':Sequelize[_0xd620('0x2')]},'application':{'type':Sequelize[_0xd620('0x2')]},'data':{'type':Sequelize[_0xd620('0x3')]},'project_name':{'type':Sequelize[_0xd620('0x2')]},'callerid':{'type':Sequelize[_0xd620('0x2')]}}; \ No newline at end of file +var _0x48d5=['sequelize','STRING','TEXT'];(function(_0x5707d2,_0x280c70){var _0x4e358d=function(_0x4a741e){while(--_0x4a741e){_0x5707d2['push'](_0x5707d2['shift']());}};_0x4e358d(++_0x280c70);}(_0x48d5,0xa8));var _0x548d=function(_0x2bbcda,_0x1b2b5e){_0x2bbcda=_0x2bbcda-0x0;var _0x571a2c=_0x48d5[_0x2bbcda];return _0x571a2c;};'use strict';var Sequelize=require(_0x548d('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x548d('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x548d('0x2')]},'project_name':{'type':Sequelize[_0x548d('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 80bc8c4..3f92ff8 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 _0x81d3=['query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','status','json','undefined','count','offset','limit','set','reject','update','then','end','sendStatus','stack','name','send','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','keys'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x81d3,0x1ec));var _0x381d=function(_0x314640,_0x22f104){_0x314640=_0x314640-0x0;var _0x10dfff=_0x81d3[_0x314640];return _0x10dfff;};'use strict';var emlformat=require(_0x381d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x381d('0x1'));var jsonpatch=require(_0x381d('0x2'));var rp=require(_0x381d('0x3'));var moment=require(_0x381d('0x4'));var BPromise=require(_0x381d('0x5'));var Mustache=require('mustache');var util=require(_0x381d('0x6'));var path=require(_0x381d('0x7'));var sox=require('sox');var csv=require(_0x381d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x381d('0x9'));var crypto=require('crypto');var jsforce=require(_0x381d('0xa'));var deskjs=require(_0x381d('0xb'));var toCsv=require(_0x381d('0x8'));var querystring=require(_0x381d('0xc'));var Papa=require(_0x381d('0xd'));var Redis=require(_0x381d('0xe'));var authService=require(_0x381d('0xf'));var qs=require(_0x381d('0x10'));var as=require(_0x381d('0x11'));var hardwareService=require(_0x381d('0x12'));var logger=require(_0x381d('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x381d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fb3c1,_0x15e274){_0x15e274=_0x15e274||0xcc;return function(_0x22f6d8){if(_0x22f6d8){return _0x3fb3c1['sendStatus'](_0x15e274);}return _0x3fb3c1[_0x381d('0x15')](_0x15e274)['end']();};}function respondWithResult(_0x4060eb,_0x295f16){_0x295f16=_0x295f16||0xc8;return function(_0x30b6e1){if(_0x30b6e1){return _0x4060eb[_0x381d('0x15')](_0x295f16)[_0x381d('0x16')](_0x30b6e1);}};}function respondWithFilteredResult(_0x1cd366,_0x3728b3){return function(_0x5b5089){if(_0x5b5089){var _0x47e4d8=typeof _0x3728b3['offset']===_0x381d('0x17')&&typeof _0x3728b3['limit']===_0x381d('0x17');var _0x1177fc=_0x5b5089[_0x381d('0x18')];var _0x4c6151=_0x47e4d8?0x0:_0x3728b3[_0x381d('0x19')];var _0x4e381f=_0x47e4d8?_0x5b5089[_0x381d('0x18')]:_0x3728b3[_0x381d('0x19')]+_0x3728b3[_0x381d('0x1a')];var _0xf29e3;if(_0x4e381f>=_0x1177fc){_0x4e381f=_0x1177fc;_0xf29e3=0xc8;}else{_0xf29e3=0xce;}_0x1cd366['status'](_0xf29e3);return _0x1cd366[_0x381d('0x1b')]('Content-Range',_0x4c6151+'-'+_0x4e381f+'/'+_0x1177fc)[_0x381d('0x16')](_0x5b5089);}return null;};}function patchUpdates(_0x37248b){return function(_0x370634){try{jsonpatch['apply'](_0x370634,_0x37248b,!![]);}catch(_0x19c3cc){return BPromise[_0x381d('0x1c')](_0x19c3cc);}return _0x370634['save']();};}function saveUpdates(_0x46c444,_0x2a06d7){return function(_0x1147cb){if(_0x1147cb){return _0x1147cb[_0x381d('0x1d')](_0x46c444)[_0x381d('0x1e')](function(_0x40f396){return _0x40f396;});}return null;};}function removeEntity(_0x4d7de4,_0x4605b1){return function(_0x435909){if(_0x435909){return _0x435909['destroy']()[_0x381d('0x1e')](function(){_0x4d7de4[_0x381d('0x15')](0xcc)[_0x381d('0x1f')]();});}};}function handleEntityNotFound(_0x4a07ba,_0x256928){return function(_0x5cf70d){if(!_0x5cf70d){_0x4a07ba[_0x381d('0x20')](0x194);}return _0x5cf70d;};}function handleError(_0xf099ef,_0x25bccf){_0x25bccf=_0x25bccf||0x1f4;return function(_0x3d1165){logger['error'](_0x3d1165[_0x381d('0x21')]);if(_0x3d1165[_0x381d('0x22')]){delete _0x3d1165[_0x381d('0x22')];}_0xf099ef[_0x381d('0x15')](_0x25bccf)[_0x381d('0x23')](_0x3d1165);};}exports['index']=function(_0x3c1653,_0x1f64b){var _0x194e03={},_0x23fc89={},_0x38b6a7={'count':0x0,'rows':[]};var _0x5d3b3f=_[_0x381d('0x24')](db[_0x381d('0x25')][_0x381d('0x26')],function(_0x207947){return{'name':_0x207947[_0x381d('0x27')],'type':_0x207947[_0x381d('0x28')][_0x381d('0x29')]};});_0x23fc89[_0x381d('0x2a')]=_['map'](_0x5d3b3f,_0x381d('0x22'));_0x23fc89['query']=_[_0x381d('0x2b')](_0x3c1653[_0x381d('0x2c')]);_0x23fc89[_0x381d('0x2d')]=_[_0x381d('0x2e')](_0x23fc89[_0x381d('0x2a')],_0x23fc89[_0x381d('0x2c')]);_0x194e03['attributes']=_['intersection'](_0x23fc89[_0x381d('0x2a')],qs[_0x381d('0x2f')](_0x3c1653[_0x381d('0x2c')][_0x381d('0x2f')]));_0x194e03['attributes']=_0x194e03[_0x381d('0x30')][_0x381d('0x31')]?_0x194e03['attributes']:_0x23fc89[_0x381d('0x2a')];if(!_0x3c1653[_0x381d('0x2c')]['hasOwnProperty'](_0x381d('0x32'))){_0x194e03[_0x381d('0x1a')]=qs[_0x381d('0x1a')](_0x3c1653[_0x381d('0x2c')][_0x381d('0x1a')]);_0x194e03[_0x381d('0x19')]=qs[_0x381d('0x19')](_0x3c1653[_0x381d('0x2c')][_0x381d('0x19')]);}_0x194e03[_0x381d('0x33')]=qs[_0x381d('0x34')](_0x3c1653[_0x381d('0x2c')][_0x381d('0x34')]);_0x194e03[_0x381d('0x35')]=qs['filters'](_[_0x381d('0x36')](_0x3c1653[_0x381d('0x2c')],_0x23fc89[_0x381d('0x2d')]),_0x5d3b3f);if(_0x3c1653[_0x381d('0x2c')][_0x381d('0x37')]){_0x194e03[_0x381d('0x35')]=_['merge'](_0x194e03[_0x381d('0x35')],{'$or':_[_0x381d('0x24')](_0x5d3b3f,function(_0x3d8c6b){if(_0x3d8c6b[_0x381d('0x28')]!==_0x381d('0x38')){var _0x118a42={};_0x118a42[_0x3d8c6b[_0x381d('0x22')]]={'$like':'%'+_0x3c1653[_0x381d('0x2c')]['filter']+'%'};return _0x118a42;}})});}_0x194e03=_[_0x381d('0x39')]({},_0x194e03,_0x3c1653[_0x381d('0x3a')]);var _0xa13b31={'where':_0x194e03[_0x381d('0x35')]};return db['SquareDetailsReport'][_0x381d('0x18')](_0xa13b31)['then'](function(_0x139f79){_0x38b6a7[_0x381d('0x18')]=_0x139f79;if(_0x3c1653['query'][_0x381d('0x3b')]){_0x194e03[_0x381d('0x3c')]=[{'all':!![]}];}return db[_0x381d('0x25')]['findAll'](_0x194e03);})['then'](function(_0x1785b4){_0x38b6a7[_0x381d('0x3d')]=_0x1785b4;return _0x38b6a7;})[_0x381d('0x1e')](respondWithFilteredResult(_0x1f64b,_0x194e03))[_0x381d('0x3e')](handleError(_0x1f64b,null));};exports['show']=function(_0x44628a,_0x5cadc6){var _0x5f0779={'raw':!![],'where':{'id':_0x44628a[_0x381d('0x3f')]['id']}},_0x4e730b={};_0x4e730b[_0x381d('0x2a')]=_[_0x381d('0x2b')](db['SquareDetailsReport'][_0x381d('0x26')]);_0x4e730b['query']=_['keys'](_0x44628a[_0x381d('0x2c')]);_0x4e730b['filters']=_[_0x381d('0x2e')](_0x4e730b[_0x381d('0x2a')],_0x4e730b[_0x381d('0x2c')]);_0x5f0779['attributes']=_['intersection'](_0x4e730b['model'],qs[_0x381d('0x2f')](_0x44628a[_0x381d('0x2c')]['fields']));_0x5f0779['attributes']=_0x5f0779[_0x381d('0x30')][_0x381d('0x31')]?_0x5f0779['attributes']:_0x4e730b[_0x381d('0x2a')];if(_0x44628a[_0x381d('0x2c')][_0x381d('0x3b')]){_0x5f0779[_0x381d('0x3c')]=[{'all':!![]}];}_0x5f0779=_['merge']({},_0x5f0779,_0x44628a['options']);return db[_0x381d('0x25')]['find'](_0x5f0779)['then'](handleEntityNotFound(_0x5cadc6,null))['then'](respondWithResult(_0x5cadc6,null))['catch'](handleError(_0x5cadc6,null));};exports['create']=function(_0x470a9b,_0x4b650c){return db[_0x381d('0x25')]['create'](_0x470a9b[_0x381d('0x40')],{})['then'](respondWithResult(_0x4b650c,0xc9))[_0x381d('0x3e')](handleError(_0x4b650c,null));};exports[_0x381d('0x1d')]=function(_0x1a4497,_0x89858c){if(_0x1a4497[_0x381d('0x40')]['id']){delete _0x1a4497[_0x381d('0x40')]['id'];}return db[_0x381d('0x25')][_0x381d('0x41')]({'where':{'id':_0x1a4497['params']['id']}})['then'](handleEntityNotFound(_0x89858c,null))[_0x381d('0x1e')](saveUpdates(_0x1a4497[_0x381d('0x40')],null))[_0x381d('0x1e')](respondWithResult(_0x89858c,null))[_0x381d('0x3e')](handleError(_0x89858c,null));};exports['destroy']=function(_0x1ec012,_0x503b6f){return db[_0x381d('0x25')][_0x381d('0x41')]({'where':{'id':_0x1ec012[_0x381d('0x3f')]['id']}})[_0x381d('0x1e')](handleEntityNotFound(_0x503b6f,null))[_0x381d('0x1e')](removeEntity(_0x503b6f,null))[_0x381d('0x3e')](handleError(_0x503b6f,null));};exports[_0x381d('0x42')]=function(_0x53eca9,_0x40fd2b){return db[_0x381d('0x25')][_0x381d('0x42')]()[_0x381d('0x1e')](respondWithResult(_0x40fd2b,null))['catch'](handleError(_0x40fd2b,null));}; \ No newline at end of file +var _0x1f0c=['create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','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','json','undefined','limit','count','offset','status','set','Content-Range','reject','save','update','then','end','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','params','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1f0c,0x18f));var _0xc1f0=function(_0x347b4,_0x4dfef4){_0x347b4=_0x347b4-0x0;var _0x3ad038=_0x1f0c[_0x347b4];return _0x3ad038;};'use strict';var emlformat=require(_0xc1f0('0x0'));var rimraf=require(_0xc1f0('0x1'));var zipdir=require(_0xc1f0('0x2'));var jsonpatch=require(_0xc1f0('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc1f0('0x4'));var Mustache=require(_0xc1f0('0x5'));var util=require(_0xc1f0('0x6'));var path=require('path');var sox=require(_0xc1f0('0x7'));var csv=require(_0xc1f0('0x8'));var ejs=require(_0xc1f0('0x9'));var fs=require('fs');var fs_extra=require(_0xc1f0('0xa'));var _=require(_0xc1f0('0xb'));var squel=require('squel');var crypto=require(_0xc1f0('0xc'));var jsforce=require(_0xc1f0('0xd'));var deskjs=require(_0xc1f0('0xe'));var toCsv=require(_0xc1f0('0x8'));var querystring=require('querystring');var Papa=require(_0xc1f0('0xf'));var Redis=require(_0xc1f0('0x10'));var authService=require(_0xc1f0('0x11'));var qs=require(_0xc1f0('0x12'));var as=require(_0xc1f0('0x13'));var hardwareService=require(_0xc1f0('0x14'));var logger=require(_0xc1f0('0x15'))(_0xc1f0('0x16'));var utils=require(_0xc1f0('0x17'));var config=require(_0xc1f0('0x18'));var licenseUtil=require(_0xc1f0('0x19'));var db=require(_0xc1f0('0x1a'))['db'];function respondWithStatusCode(_0x52335d,_0xd6f1ba){_0xd6f1ba=_0xd6f1ba||0xcc;return function(_0x5c2d54){if(_0x5c2d54){return _0x52335d['sendStatus'](_0xd6f1ba);}return _0x52335d['status'](_0xd6f1ba)['end']();};}function respondWithResult(_0x2d5b8f,_0xeec306){_0xeec306=_0xeec306||0xc8;return function(_0x59538e){if(_0x59538e){return _0x2d5b8f['status'](_0xeec306)[_0xc1f0('0x1b')](_0x59538e);}};}function respondWithFilteredResult(_0x2466f9,_0x59d19e){return function(_0x1fd542){if(_0x1fd542){var _0x4cb65e=typeof _0x59d19e['offset']===_0xc1f0('0x1c')&&typeof _0x59d19e[_0xc1f0('0x1d')]===_0xc1f0('0x1c');var _0x264291=_0x1fd542[_0xc1f0('0x1e')];var _0xdafeec=_0x4cb65e?0x0:_0x59d19e[_0xc1f0('0x1f')];var _0x870e6f=_0x4cb65e?_0x1fd542[_0xc1f0('0x1e')]:_0x59d19e[_0xc1f0('0x1f')]+_0x59d19e[_0xc1f0('0x1d')];var _0x62942a;if(_0x870e6f>=_0x264291){_0x870e6f=_0x264291;_0x62942a=0xc8;}else{_0x62942a=0xce;}_0x2466f9[_0xc1f0('0x20')](_0x62942a);return _0x2466f9[_0xc1f0('0x21')](_0xc1f0('0x22'),_0xdafeec+'-'+_0x870e6f+'/'+_0x264291)[_0xc1f0('0x1b')](_0x1fd542);}return null;};}function patchUpdates(_0x5af6d4){return function(_0x2a9411){try{jsonpatch['apply'](_0x2a9411,_0x5af6d4,!![]);}catch(_0x25b701){return BPromise[_0xc1f0('0x23')](_0x25b701);}return _0x2a9411[_0xc1f0('0x24')]();};}function saveUpdates(_0x276313,_0x4857fb){return function(_0x3db6a2){if(_0x3db6a2){return _0x3db6a2[_0xc1f0('0x25')](_0x276313)[_0xc1f0('0x26')](function(_0x40296f){return _0x40296f;});}return null;};}function removeEntity(_0x417707,_0x4e0fdd){return function(_0x4f4f2f){if(_0x4f4f2f){return _0x4f4f2f['destroy']()[_0xc1f0('0x26')](function(){_0x417707['status'](0xcc)[_0xc1f0('0x27')]();});}};}function handleEntityNotFound(_0x4cf32f,_0xe33ba){return function(_0xb02ab2){if(!_0xb02ab2){_0x4cf32f['sendStatus'](0x194);}return _0xb02ab2;};}function handleError(_0x37b3f5,_0x589196){_0x589196=_0x589196||0x1f4;return function(_0x46aecd){logger[_0xc1f0('0x28')](_0x46aecd[_0xc1f0('0x29')]);if(_0x46aecd[_0xc1f0('0x2a')]){delete _0x46aecd['name'];}_0x37b3f5[_0xc1f0('0x20')](_0x589196)[_0xc1f0('0x2b')](_0x46aecd);};}exports[_0xc1f0('0x2c')]=function(_0x50d4a1,_0x44241e){var _0x22930c={},_0x25172d={},_0xcfd0c8={'count':0x0,'rows':[]};var _0x4708ef=_[_0xc1f0('0x2d')](db[_0xc1f0('0x2e')][_0xc1f0('0x2f')],function(_0x44a9d7){return{'name':_0x44a9d7[_0xc1f0('0x30')],'type':_0x44a9d7[_0xc1f0('0x31')][_0xc1f0('0x32')]};});_0x25172d['model']=_[_0xc1f0('0x2d')](_0x4708ef,_0xc1f0('0x2a'));_0x25172d[_0xc1f0('0x33')]=_[_0xc1f0('0x34')](_0x50d4a1[_0xc1f0('0x33')]);_0x25172d['filters']=_[_0xc1f0('0x35')](_0x25172d[_0xc1f0('0x36')],_0x25172d[_0xc1f0('0x33')]);_0x22930c[_0xc1f0('0x37')]=_[_0xc1f0('0x35')](_0x25172d[_0xc1f0('0x36')],qs[_0xc1f0('0x38')](_0x50d4a1[_0xc1f0('0x33')][_0xc1f0('0x38')]));_0x22930c[_0xc1f0('0x37')]=_0x22930c[_0xc1f0('0x37')][_0xc1f0('0x39')]?_0x22930c[_0xc1f0('0x37')]:_0x25172d['model'];if(!_0x50d4a1['query'][_0xc1f0('0x3a')](_0xc1f0('0x3b'))){_0x22930c[_0xc1f0('0x1d')]=qs[_0xc1f0('0x1d')](_0x50d4a1[_0xc1f0('0x33')]['limit']);_0x22930c['offset']=qs[_0xc1f0('0x1f')](_0x50d4a1['query'][_0xc1f0('0x1f')]);}_0x22930c[_0xc1f0('0x3c')]=qs['sort'](_0x50d4a1['query'][_0xc1f0('0x3d')]);_0x22930c[_0xc1f0('0x3e')]=qs[_0xc1f0('0x3f')](_[_0xc1f0('0x40')](_0x50d4a1[_0xc1f0('0x33')],_0x25172d[_0xc1f0('0x3f')]),_0x4708ef);if(_0x50d4a1[_0xc1f0('0x33')][_0xc1f0('0x41')]){_0x22930c[_0xc1f0('0x3e')]=_[_0xc1f0('0x42')](_0x22930c[_0xc1f0('0x3e')],{'$or':_[_0xc1f0('0x2d')](_0x4708ef,function(_0x5c2a5e){if(_0x5c2a5e[_0xc1f0('0x31')]!=='VIRTUAL'){var _0xd49421={};_0xd49421[_0x5c2a5e['name']]={'$like':'%'+_0x50d4a1[_0xc1f0('0x33')]['filter']+'%'};return _0xd49421;}})});}_0x22930c=_[_0xc1f0('0x42')]({},_0x22930c,_0x50d4a1[_0xc1f0('0x43')]);var _0x253a23={'where':_0x22930c[_0xc1f0('0x3e')]};return db[_0xc1f0('0x2e')][_0xc1f0('0x1e')](_0x253a23)[_0xc1f0('0x26')](function(_0x26b4b0){_0xcfd0c8[_0xc1f0('0x1e')]=_0x26b4b0;if(_0x50d4a1[_0xc1f0('0x33')]['includeAll']){_0x22930c[_0xc1f0('0x44')]=[{'all':!![]}];}return db[_0xc1f0('0x2e')][_0xc1f0('0x45')](_0x22930c);})[_0xc1f0('0x26')](function(_0x472f29){_0xcfd0c8[_0xc1f0('0x46')]=_0x472f29;return _0xcfd0c8;})['then'](respondWithFilteredResult(_0x44241e,_0x22930c))[_0xc1f0('0x47')](handleError(_0x44241e,null));};exports[_0xc1f0('0x48')]=function(_0x1c539f,_0x1ed3ac){var _0x1be622={'raw':!![],'where':{'id':_0x1c539f[_0xc1f0('0x49')]['id']}},_0x520a03={};_0x520a03[_0xc1f0('0x36')]=_[_0xc1f0('0x34')](db[_0xc1f0('0x2e')][_0xc1f0('0x2f')]);_0x520a03[_0xc1f0('0x33')]=_[_0xc1f0('0x34')](_0x1c539f[_0xc1f0('0x33')]);_0x520a03[_0xc1f0('0x3f')]=_['intersection'](_0x520a03[_0xc1f0('0x36')],_0x520a03[_0xc1f0('0x33')]);_0x1be622[_0xc1f0('0x37')]=_[_0xc1f0('0x35')](_0x520a03[_0xc1f0('0x36')],qs[_0xc1f0('0x38')](_0x1c539f['query'][_0xc1f0('0x38')]));_0x1be622[_0xc1f0('0x37')]=_0x1be622[_0xc1f0('0x37')][_0xc1f0('0x39')]?_0x1be622[_0xc1f0('0x37')]:_0x520a03['model'];if(_0x1c539f['query']['includeAll']){_0x1be622[_0xc1f0('0x44')]=[{'all':!![]}];}_0x1be622=_[_0xc1f0('0x42')]({},_0x1be622,_0x1c539f[_0xc1f0('0x43')]);return db['SquareDetailsReport'][_0xc1f0('0x4a')](_0x1be622)[_0xc1f0('0x26')](handleEntityNotFound(_0x1ed3ac,null))['then'](respondWithResult(_0x1ed3ac,null))[_0xc1f0('0x47')](handleError(_0x1ed3ac,null));};exports[_0xc1f0('0x4b')]=function(_0x522ded,_0x5d1562){return db[_0xc1f0('0x2e')][_0xc1f0('0x4b')](_0x522ded[_0xc1f0('0x4c')],{})[_0xc1f0('0x26')](respondWithResult(_0x5d1562,0xc9))[_0xc1f0('0x47')](handleError(_0x5d1562,null));};exports['update']=function(_0x52fabc,_0x1432fc){if(_0x52fabc['body']['id']){delete _0x52fabc[_0xc1f0('0x4c')]['id'];}return db[_0xc1f0('0x2e')][_0xc1f0('0x4a')]({'where':{'id':_0x52fabc['params']['id']}})[_0xc1f0('0x26')](handleEntityNotFound(_0x1432fc,null))['then'](saveUpdates(_0x52fabc[_0xc1f0('0x4c')],null))[_0xc1f0('0x26')](respondWithResult(_0x1432fc,null))[_0xc1f0('0x47')](handleError(_0x1432fc,null));};exports[_0xc1f0('0x4d')]=function(_0x3a2d49,_0x8701fd){return db['SquareDetailsReport']['find']({'where':{'id':_0x3a2d49[_0xc1f0('0x49')]['id']}})[_0xc1f0('0x26')](handleEntityNotFound(_0x8701fd,null))[_0xc1f0('0x26')](removeEntity(_0x8701fd,null))['catch'](handleError(_0x8701fd,null));};exports[_0xc1f0('0x4e')]=function(_0x113431,_0x3a5333){return db[_0xc1f0('0x2e')][_0xc1f0('0x4e')]()[_0xc1f0('0x26')](respondWithResult(_0x3a5333,null))[_0xc1f0('0x47')](handleError(_0x3a5333,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 651385d..9fb9806 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 _0x5464=['exports','define','report_square_details','lodash','moment','bluebird','rimraf','../../config/environment','./squareReportDetail.attributes'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x5464,0x159));var _0x4546=function(_0x4b6f7f,_0x566475){_0x4b6f7f=_0x4b6f7f-0x0;var _0x1a203b=_0x5464[_0x4b6f7f];return _0x1a203b;};'use strict';var _=require(_0x4546('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4546('0x1'));var BPromise=require(_0x4546('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4546('0x3'));var config=require(_0x4546('0x4'));var attributes=require(_0x4546('0x5'));module[_0x4546('0x6')]=function(_0x45b786,_0x59892c){return _0x45b786[_0x4546('0x7')]('SquareDetailsReport',attributes,{'tableName':_0x4546('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x157b=['report_square_details','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./squareReportDetail.attributes','define','SquareDetailsReport'];(function(_0x2a0e09,_0x45c8b8){var _0x16c932=function(_0x4aefed){while(--_0x4aefed){_0x2a0e09['push'](_0x2a0e09['shift']());}};_0x16c932(++_0x45c8b8);}(_0x157b,0x199));var _0xb157=function(_0x8e2b30,_0x4c6caf){_0x8e2b30=_0x8e2b30-0x0;var _0x29ff9a=_0x157b[_0x8e2b30];return _0x29ff9a;};'use strict';var _=require(_0xb157('0x0'));var util=require(_0xb157('0x1'));var logger=require(_0xb157('0x2'))(_0xb157('0x3'));var moment=require('moment');var BPromise=require(_0xb157('0x4'));var rp=require(_0xb157('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb157('0x6'));var config=require(_0xb157('0x7'));var attributes=require(_0xb157('0x8'));module['exports']=function(_0x34ee15,_0x2c44a0){return _0x34ee15[_0xb157('0x9')](_0xb157('0xa'),attributes,{'tableName':_0xb157('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 fd09860..661d058 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(_0x4139b8,_0x554564){var _0x40c6d6=function(_0x4a743b){while(--_0x4a743b){_0x4139b8['push'](_0x4139b8['shift']());}};_0x40c6d6(++_0x554564);}(_0x5ba3,0x140));var _0x35ba=function(_0x5c3272,_0x3c4290){_0x5c3272=_0x5c3272-0x0;var _0x391a97=_0x5ba3[_0x5c3272];return _0x391a97;};'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 _0x056b=['catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','then','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x30a76e,_0x26022a){var _0x4c6caf=function(_0x10bcc8){while(--_0x10bcc8){_0x30a76e['push'](_0x30a76e['shift']());}};_0x4c6caf(++_0x26022a);}(_0x056b,0xb6));var _0xb056=function(_0x2d0fc7,_0x273339){_0x2d0fc7=_0x2d0fc7-0x0;var _0xe84c0c=_0x056b[_0x2d0fc7];return _0xe84c0c;};'use strict';var _=require('lodash');var util=require(_0xb056('0x0'));var moment=require(_0xb056('0x1'));var BPromise=require(_0xb056('0x2'));var rs=require(_0xb056('0x3'));var fs=require('fs');var Redis=require(_0xb056('0x4'));var db=require(_0xb056('0x5'))['db'];var utils=require(_0xb056('0x6'));var logger=require(_0xb056('0x7'))(_0xb056('0x8'));var config=require(_0xb056('0x9'));var jayson=require(_0xb056('0xa'));var client=jayson['client'][_0xb056('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x314637,_0x3eae69,_0x3c9b89){return new BPromise(function(_0x80daf1,_0x6bf4c){return client['request'](_0x314637,_0x3c9b89)['then'](function(_0x37a86d){logger[_0xb056('0xc')](_0xb056('0xd'),_0x3eae69,_0xb056('0xe'));logger['debug'](_0xb056('0xf'),_0x3eae69,'request\x20sent',JSON[_0xb056('0x10')](_0x37a86d));if(_0x37a86d[_0xb056('0x11')]){if(_0x37a86d[_0xb056('0x11')][_0xb056('0x12')]===0x1f4){logger[_0xb056('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x3eae69,_0x37a86d['error'][_0xb056('0x13')]);return _0x6bf4c(_0x37a86d[_0xb056('0x11')]['message']);}logger[_0xb056('0x11')](_0xb056('0xd'),_0x3eae69,_0x37a86d[_0xb056('0x11')][_0xb056('0x13')]);return _0x80daf1(_0x37a86d[_0xb056('0x11')][_0xb056('0x13')]);}else{logger[_0xb056('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x3eae69,_0xb056('0xe'));_0x80daf1(_0x37a86d[_0xb056('0x14')][_0xb056('0x13')]);}})[_0xb056('0x15')](function(_0x5a4ef1){logger[_0xb056('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x3eae69,_0x5a4ef1);_0x6bf4c(_0x5a4ef1);});});}exports[_0xb056('0x16')]=function(_0x311eb9){var _0x48e140=this;return new Promise(function(_0x29c77e,_0x4c57e6){return db[_0xb056('0x17')][_0xb056('0x18')](_0x311eb9['body'],{'raw':_0x311eb9[_0xb056('0x19')]?_0x311eb9['options'][_0xb056('0x1a')]===undefined?!![]:![]:!![]})[_0xb056('0x1b')](function(_0x457b54){logger[_0xb056('0xc')]('CreateSquareDetailsReport',_0x311eb9);logger[_0xb056('0x1c')]('CreateSquareDetailsReport',_0x311eb9,JSON[_0xb056('0x10')](_0x457b54));_0x29c77e(_0x457b54);})['catch'](function(_0x324ce6){logger[_0xb056('0x11')](_0xb056('0x16'),_0x324ce6[_0xb056('0x13')],_0x311eb9);_0x4c57e6(_0x48e140[_0xb056('0x11')](0x1f4,_0x324ce6[_0xb056('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index d6e161c..d1a7515 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 _0x0623=['express','Router','../../components/auth/service','./system.controller','get','index','/process/:pid/kill','isAuthenticated','killProcess'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x0623,0x1b9));var _0x3062=function(_0x499f67,_0x3ebcdc){_0x499f67=_0x499f67-0x0;var _0x3e67f=_0x0623[_0x499f67];return _0x3e67f;};'use strict';var express=require(_0x3062('0x0'));var router=express[_0x3062('0x1')]();var auth=require(_0x3062('0x2'));var controller=require(_0x3062('0x3'));router[_0x3062('0x4')]('/',auth['isAuthenticated'](),controller[_0x3062('0x5')]);router['get'](_0x3062('0x6'),auth[_0x3062('0x7')](),controller[_0x3062('0x8')]);module['exports']=router; \ No newline at end of file +var _0xda3f=['exports','Router','../../components/auth/service','get','index','killProcess'];(function(_0x1be57b,_0x51c1bb){var _0x4a4360=function(_0x228eff){while(--_0x228eff){_0x1be57b['push'](_0x1be57b['shift']());}};_0x4a4360(++_0x51c1bb);}(_0xda3f,0x15d));var _0xfda3=function(_0x49f4c6,_0x265876){_0x49f4c6=_0x49f4c6-0x0;var _0x5efc2d=_0xda3f[_0x49f4c6];return _0x5efc2d;};'use strict';var express=require('express');var router=express[_0xfda3('0x0')]();var auth=require(_0xfda3('0x1'));var controller=require('./system.controller');router[_0xfda3('0x2')]('/',auth['isAuthenticated'](),controller[_0xfda3('0x3')]);router[_0xfda3('0x2')]('/process/:pid/kill',auth['isAuthenticated'](),controller[_0xfda3('0x4')]);module[_0xfda3('0x5')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index d826bcd..deec72c 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 _0xd386=['length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','status','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','child_process','exec','../../config/logger','api','util','bluebird','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','send','index','getAllData','then','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split'];(function(_0x4a452c,_0x713aef){var _0xf1f336=function(_0xca52f6){while(--_0xca52f6){_0x4a452c['push'](_0x4a452c['shift']());}};_0xf1f336(++_0x713aef);}(_0xd386,0x1d2));var _0x6d38=function(_0x513683,_0x56bd88){_0x513683=_0x513683-0x0;var _0x6028e=_0xd386[_0x513683];return _0x6028e;};'use strict';var info=require('systeminformation');var exec=require(_0x6d38('0x0'))[_0x6d38('0x1')];var logger=require(_0x6d38('0x2'))(_0x6d38('0x3'));var util=require(_0x6d38('0x4'));var BPromise=require(_0x6d38('0x5'));var _=require('lodash');function handleError(_0x31c722,_0x5870fd,_0xcb63cf){_0x5870fd=_0x5870fd||0x1f4;return function(_0x8dfa38){logger['error'](_0x6d38('0x6'),_0xcb63cf,_0x5870fd,util['inspect'](_0x8dfa38,{'showHidden':![],'depth':null}));delete _0x8dfa38[_0x6d38('0x7')];_0x31c722['status'](_0x5870fd)[_0x6d38('0x8')](_0x8dfa38);};}exports[_0x6d38('0x9')]=function(_0x416833,_0x39074f){return info[_0x6d38('0xa')]()[_0x6d38('0xb')](function(_0x379406){return _0x39074f['status'](0xc8)[_0x6d38('0xc')](_0x379406);})['catch'](function(_0x247cdb){return _0x39074f['status'](0x1f4)['json'](_0x247cdb);});};exports[_0x6d38('0xd')]=function(_0x2d0419,_0x3e306a){var _0x137d59=[_0x6d38('0xe')];return new BPromise(function(_0x1f2522,_0x363d91){return exec(util[_0x6d38('0xf')](_0x6d38('0x10'),_0x2d0419[_0x6d38('0x11')][_0x6d38('0x12')]),function(_0x14ef3b,_0x54f780,_0x3f1bc4){if(_0x14ef3b){return _0x363d91(_0x14ef3b);}return _0x1f2522(_0x54f780);});})[_0x6d38('0xb')](function(_0x3cea90){var _0x4eccce=![];var _0x564143=_0x3cea90[_0x6d38('0x13')](/\n/);for(var _0x496eb3=0x0,_0x1c7219=_0x137d59[_0x6d38('0x14')];_0x496eb3<_0x1c7219,_0x4eccce===![];_0x496eb3+=0x1){if(_0x3cea90['indexOf'](_0x137d59[_0x496eb3])>=0x0){_0x4eccce=!![];}}if(!_0x4eccce){throw new Error(util[_0x6d38('0xf')](_0x6d38('0x15'),_0x2d0419['params']['pid']));}process[_0x6d38('0x16')](_0x2d0419[_0x6d38('0x11')][_0x6d38('0x12')],_0x6d38('0x17'));return _0x3e306a[_0x6d38('0x18')](0xc8)[_0x6d38('0xc')]({'message':util[_0x6d38('0xf')](_0x6d38('0x19'),_0x2d0419[_0x6d38('0x11')][_0x6d38('0x12')])});})[_0x6d38('0x1a')](handleError(_0x3e306a,null,_0x6d38('0xd')));}; \ No newline at end of file +var _0x3293=['pid','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','../../config/logger','api','bluebird','lodash','error','name','status','send','getAllData','then','json','catch','killProcess','format','params'];(function(_0x418574,_0x2f8592){var _0xcb1350=function(_0x9bf142){while(--_0x9bf142){_0x418574['push'](_0x418574['shift']());}};_0xcb1350(++_0x2f8592);}(_0x3293,0x1bb));var _0x3329=function(_0x17f4a2,_0x294aca){_0x17f4a2=_0x17f4a2-0x0;var _0x46905c=_0x3293[_0x17f4a2];return _0x46905c;};'use strict';var info=require(_0x3329('0x0'));var exec=require('child_process')[_0x3329('0x1')];var logger=require(_0x3329('0x2'))(_0x3329('0x3'));var util=require('util');var BPromise=require(_0x3329('0x4'));var _=require(_0x3329('0x5'));function handleError(_0x2a3a30,_0x5d938a,_0xcd05a5){_0x5d938a=_0x5d938a||0x1f4;return function(_0x432a19){logger[_0x3329('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0xcd05a5,_0x5d938a,util['inspect'](_0x432a19,{'showHidden':![],'depth':null}));delete _0x432a19[_0x3329('0x7')];_0x2a3a30[_0x3329('0x8')](_0x5d938a)[_0x3329('0x9')](_0x432a19);};}exports['index']=function(_0x43d27b,_0xcd1b06){return info[_0x3329('0xa')]()[_0x3329('0xb')](function(_0x1fdd8d){return _0xcd1b06['status'](0xc8)[_0x3329('0xc')](_0x1fdd8d);})[_0x3329('0xd')](function(_0x29fce3){return _0xcd1b06[_0x3329('0x8')](0x1f4)['json'](_0x29fce3);});};exports[_0x3329('0xe')]=function(_0x53819,_0x2ef8e0){var _0x35e714=['components/import/cm'];return new BPromise(function(_0x4bbc56,_0x3c62f3){return exec(util[_0x3329('0xf')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x53819[_0x3329('0x10')][_0x3329('0x11')]),function(_0x6edc46,_0x2cf369,_0x492cba){if(_0x6edc46){return _0x3c62f3(_0x6edc46);}return _0x4bbc56(_0x2cf369);});})[_0x3329('0xb')](function(_0x591cc4){var _0x40befd=![];var _0x546c85=_0x591cc4[_0x3329('0x12')](/\n/);for(var _0x31127b=0x0,_0xd9c383=_0x35e714['length'];_0x31127b<_0xd9c383,_0x40befd===![];_0x31127b+=0x1){if(_0x591cc4[_0x3329('0x13')](_0x35e714[_0x31127b])>=0x0){_0x40befd=!![];}}if(!_0x40befd){throw new Error(util[_0x3329('0xf')](_0x3329('0x14'),_0x53819['params'][_0x3329('0x11')]));}process['kill'](_0x53819[_0x3329('0x10')][_0x3329('0x11')],_0x3329('0x15'));return _0x2ef8e0[_0x3329('0x8')](0xc8)['json']({'message':util[_0x3329('0xf')](_0x3329('0x16'),_0x53819[_0x3329('0x10')][_0x3329('0x11')])});})['catch'](handleError(_0x2ef8e0,null,_0x3329('0xe')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 3629d24..0893cce 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 _0x016d=['fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2ff022,_0x183a9c){var _0x1cbaa5=function(_0x342bd9){while(--_0x342bd9){_0x2ff022['push'](_0x2ff022['shift']());}};_0x1cbaa5(++_0x183a9c);}(_0x016d,0x102));var _0xd016=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x016d[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xd016('0x0'));var util=require(_0xd016('0x1'));var path=require(_0xd016('0x2'));var timeout=require(_0xd016('0x3'));var express=require(_0xd016('0x4'));var router=express[_0xd016('0x5')]();var fs_extra=require(_0xd016('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd016('0x7'));var config=require(_0xd016('0x8'));var controller=require(_0xd016('0x9'));router['get']('/',auth[_0xd016('0xa')](),controller[_0xd016('0xb')]);router[_0xd016('0xc')](_0xd016('0xd'),auth['isAuthenticated'](),controller[_0xd016('0xe')]);router[_0xd016('0xf')]('/',auth['isAuthenticated'](),controller[_0xd016('0x10')]);router[_0xd016('0x11')](_0xd016('0xd'),auth[_0xd016('0xa')](),controller[_0xd016('0x12')]);router[_0xd016('0x13')](_0xd016('0xd'),auth[_0xd016('0xa')](),controller[_0xd016('0x14')]);module[_0xd016('0x15')]=router; \ No newline at end of file +var _0x5692=['fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','show','post','create','update','delete','/:id','destroy','exports','util','connect-timeout'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x5692,0x1b8));var _0x2569=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5692[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require(_0x2569('0x0'));var path=require('path');var timeout=require(_0x2569('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2569('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x2569('0x3'));var config=require(_0x2569('0x4'));var controller=require(_0x2569('0x5'));router[_0x2569('0x6')]('/',auth[_0x2569('0x7')](),controller[_0x2569('0x8')]);router[_0x2569('0x6')]('/:id',auth[_0x2569('0x7')](),controller[_0x2569('0x9')]);router[_0x2569('0xa')]('/',auth[_0x2569('0x7')](),controller[_0x2569('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2569('0xc')]);router[_0x2569('0xd')](_0x2569('0xe'),auth[_0x2569('0x7')](),controller[_0x2569('0xf')]);module[_0x2569('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 6497d6f..645fc2e 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 _0x3aa2=['exports','name','STRING','sequelize'];(function(_0x16d70a,_0x499adf){var _0x1a139f=function(_0x60eaf1){while(--_0x60eaf1){_0x16d70a['push'](_0x16d70a['shift']());}};_0x1a139f(++_0x499adf);}(_0x3aa2,0x13b));var _0x23aa=function(_0x49f37e,_0x4d9211){_0x49f37e=_0x49f37e-0x0;var _0x3c30e6=_0x3aa2[_0x49f37e];return _0x3c30e6;};'use strict';var Sequelize=require(_0x23aa('0x0'));module[_0x23aa('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x23aa('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x23aa('0x3')]}}; \ No newline at end of file +var _0xf4f4=['STRING','#0091EA','sequelize','exports','name'];(function(_0x4a0d2e,_0xa20f3d){var _0x4ea0e1=function(_0x530515){while(--_0x530515){_0x4a0d2e['push'](_0x4a0d2e['shift']());}};_0x4ea0e1(++_0xa20f3d);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x7f82c7,_0x2bec9d){_0x7f82c7=_0x7f82c7-0x0;var _0xccd46=_0xf4f4[_0x7f82c7];return _0xccd46;};'use strict';var Sequelize=require(_0x4f4f('0x0'));module[_0x4f4f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4f4f('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x4f4f('0x3')],'defaultValue':_0x4f4f('0x4')},'description':{'type':Sequelize[_0x4f4f('0x3')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index f6e6c58..fc16c88 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 _0x1be1=['bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Tags','destroy','sendStatus','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','include','findAll','rows','show','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','zip-dir','fast-json-patch','moment'];(function(_0x20a899,_0x1379ae){var _0x26acc1=function(_0x4f45dd){while(--_0x4f45dd){_0x20a899['push'](_0x20a899['shift']());}};_0x26acc1(++_0x1379ae);}(_0x1be1,0x192));var _0x11be=function(_0x49284f,_0x1e394f){_0x49284f=_0x49284f-0x0;var _0x2dd420=_0x1be1[_0x49284f];return _0x2dd420;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x11be('0x0'));var jsonpatch=require(_0x11be('0x1'));var rp=require('request-promise');var moment=require(_0x11be('0x2'));var BPromise=require(_0x11be('0x3'));var Mustache=require(_0x11be('0x4'));var util=require(_0x11be('0x5'));var path=require('path');var sox=require(_0x11be('0x6'));var csv=require(_0x11be('0x7'));var ejs=require(_0x11be('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11be('0x9'));var squel=require('squel');var crypto=require(_0x11be('0xa'));var jsforce=require(_0x11be('0xb'));var deskjs=require(_0x11be('0xc'));var toCsv=require(_0x11be('0x7'));var querystring=require(_0x11be('0xd'));var Papa=require('papaparse');var Redis=require(_0x11be('0xe'));var authService=require(_0x11be('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x11be('0x10'));var hardwareService=require(_0x11be('0x11'));var logger=require(_0x11be('0x12'))(_0x11be('0x13'));var utils=require('../../config/utils');var config=require(_0x11be('0x14'));var licenseUtil=require(_0x11be('0x15'));var db=require(_0x11be('0x16'))['db'];function respondWithStatusCode(_0x4b36c8,_0x3ff31f){_0x3ff31f=_0x3ff31f||0xcc;return function(_0x2dad05){if(_0x2dad05){return _0x4b36c8['sendStatus'](_0x3ff31f);}return _0x4b36c8[_0x11be('0x17')](_0x3ff31f)['end']();};}function respondWithResult(_0x49228e,_0x569842){_0x569842=_0x569842||0xc8;return function(_0x4b6e7e){if(_0x4b6e7e){return _0x49228e['status'](_0x569842)['json'](_0x4b6e7e);}};}function respondWithFilteredResult(_0x588871,_0x2280e2){return function(_0x52bbef){if(_0x52bbef){var _0x31047c=typeof _0x2280e2[_0x11be('0x18')]===_0x11be('0x19')&&typeof _0x2280e2[_0x11be('0x1a')]==='undefined';var _0x2ed725=_0x52bbef[_0x11be('0x1b')];var _0x56ab61=_0x31047c?0x0:_0x2280e2[_0x11be('0x18')];var _0xc3263c=_0x31047c?_0x52bbef[_0x11be('0x1b')]:_0x2280e2['offset']+_0x2280e2['limit'];var _0x141391;if(_0xc3263c>=_0x2ed725){_0xc3263c=_0x2ed725;_0x141391=0xc8;}else{_0x141391=0xce;}_0x588871[_0x11be('0x17')](_0x141391);return _0x588871[_0x11be('0x1c')](_0x11be('0x1d'),_0x56ab61+'-'+_0xc3263c+'/'+_0x2ed725)['json'](_0x52bbef);}return null;};}function patchUpdates(_0x12a5bd){return function(_0x45136f){try{jsonpatch[_0x11be('0x1e')](_0x45136f,_0x12a5bd,!![]);}catch(_0x452315){return BPromise[_0x11be('0x1f')](_0x452315);}return _0x45136f[_0x11be('0x20')]();};}function saveUpdates(_0xa944ac,_0x17678d){return function(_0x3aea14){if(_0x3aea14){return _0x3aea14[_0x11be('0x21')](_0xa944ac)['then'](function(_0xfe3737){return _0xfe3737;});}return null;};}function removeEntity(_0x46b7c2,_0x2fe43c){return function(_0x5d1690){if(_0x5d1690){return _0x5d1690['destroy']()[_0x11be('0x22')](function(){var _0x10ce04=_0x5d1690[_0x11be('0x23')]({'plain':!![]});var _0x4cb27f=_0x11be('0x24');return db['UserProfileResource'][_0x11be('0x25')]({'where':{'type':_0x4cb27f,'resourceId':_0x10ce04['id']}})['then'](function(){return _0x5d1690;});})[_0x11be('0x22')](function(){_0x46b7c2[_0x11be('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48029b,_0x28b3a0){return function(_0x1d3b5c){if(!_0x1d3b5c){_0x48029b[_0x11be('0x26')](0x194);}return _0x1d3b5c;};}function handleError(_0x30427b,_0x17c67f){_0x17c67f=_0x17c67f||0x1f4;return function(_0xf5a6ac){logger[_0x11be('0x27')](_0xf5a6ac[_0x11be('0x28')]);if(_0xf5a6ac['name']){delete _0xf5a6ac[_0x11be('0x29')];}_0x30427b['status'](_0x17c67f)[_0x11be('0x2a')](_0xf5a6ac);};}exports[_0x11be('0x2b')]=function(_0x510476,_0x584d4c){var _0x49fd5c={},_0x265fc9={},_0x5e8f9a={'count':0x0,'rows':[]};var _0x66316d=_[_0x11be('0x2c')](db[_0x11be('0x2d')][_0x11be('0x2e')],function(_0x25e214){return{'name':_0x25e214[_0x11be('0x2f')],'type':_0x25e214['type'][_0x11be('0x30')]};});_0x265fc9[_0x11be('0x31')]=_[_0x11be('0x2c')](_0x66316d,_0x11be('0x29'));_0x265fc9[_0x11be('0x32')]=_[_0x11be('0x33')](_0x510476['query']);_0x265fc9[_0x11be('0x34')]=_[_0x11be('0x35')](_0x265fc9[_0x11be('0x31')],_0x265fc9[_0x11be('0x32')]);_0x49fd5c[_0x11be('0x36')]=_['intersection'](_0x265fc9[_0x11be('0x31')],qs[_0x11be('0x37')](_0x510476[_0x11be('0x32')]['fields']));_0x49fd5c[_0x11be('0x36')]=_0x49fd5c['attributes']['length']?_0x49fd5c['attributes']:_0x265fc9['model'];if(!_0x510476[_0x11be('0x32')][_0x11be('0x38')](_0x11be('0x39'))){_0x49fd5c['limit']=qs[_0x11be('0x1a')](_0x510476[_0x11be('0x32')]['limit']);_0x49fd5c[_0x11be('0x18')]=qs['offset'](_0x510476[_0x11be('0x32')]['offset']);}_0x49fd5c[_0x11be('0x3a')]=qs[_0x11be('0x3b')](_0x510476[_0x11be('0x32')][_0x11be('0x3b')]);_0x49fd5c['where']=qs[_0x11be('0x34')](_[_0x11be('0x3c')](_0x510476[_0x11be('0x32')],_0x265fc9[_0x11be('0x34')]),_0x66316d);if(_0x510476['query'][_0x11be('0x3d')]){_0x49fd5c[_0x11be('0x3e')]=_[_0x11be('0x3f')](_0x49fd5c[_0x11be('0x3e')],{'$or':_[_0x11be('0x2c')](_0x66316d,function(_0x1b1aac){if(_0x1b1aac[_0x11be('0x40')]!=='VIRTUAL'){var _0x2618f5={};_0x2618f5[_0x1b1aac[_0x11be('0x29')]]={'$like':'%'+_0x510476['query'][_0x11be('0x3d')]+'%'};return _0x2618f5;}})});}_0x49fd5c=_[_0x11be('0x3f')]({},_0x49fd5c,_0x510476['options']);var _0x30b67a={'where':_0x49fd5c['where']};return db[_0x11be('0x2d')]['count'](_0x30b67a)[_0x11be('0x22')](function(_0x30be21){_0x5e8f9a['count']=_0x30be21;if(_0x510476[_0x11be('0x32')]['includeAll']){_0x49fd5c[_0x11be('0x41')]=[{'all':!![]}];}return db[_0x11be('0x2d')][_0x11be('0x42')](_0x49fd5c);})[_0x11be('0x22')](function(_0x2b847a){_0x5e8f9a[_0x11be('0x43')]=_0x2b847a;return _0x5e8f9a;})[_0x11be('0x22')](respondWithFilteredResult(_0x584d4c,_0x49fd5c))['catch'](handleError(_0x584d4c,null));};exports[_0x11be('0x44')]=function(_0x18cddf,_0x9610a1){var _0x317e2d={'raw':!![],'where':{'id':_0x18cddf['params']['id']}},_0x589ac4={};_0x589ac4['model']=_[_0x11be('0x33')](db['Tag'][_0x11be('0x2e')]);_0x589ac4['query']=_[_0x11be('0x33')](_0x18cddf[_0x11be('0x32')]);_0x589ac4[_0x11be('0x34')]=_[_0x11be('0x35')](_0x589ac4[_0x11be('0x31')],_0x589ac4[_0x11be('0x32')]);_0x317e2d[_0x11be('0x36')]=_['intersection'](_0x589ac4[_0x11be('0x31')],qs['fields'](_0x18cddf[_0x11be('0x32')][_0x11be('0x37')]));_0x317e2d[_0x11be('0x36')]=_0x317e2d['attributes']['length']?_0x317e2d['attributes']:_0x589ac4[_0x11be('0x31')];if(_0x18cddf[_0x11be('0x32')]['includeAll']){_0x317e2d['include']=[{'all':!![]}];}_0x317e2d=_['merge']({},_0x317e2d,_0x18cddf[_0x11be('0x45')]);return db[_0x11be('0x2d')][_0x11be('0x46')](_0x317e2d)[_0x11be('0x22')](handleEntityNotFound(_0x9610a1,null))[_0x11be('0x22')](respondWithResult(_0x9610a1,null))[_0x11be('0x47')](handleError(_0x9610a1,null));};exports[_0x11be('0x48')]=function(_0x3f2070,_0x2ce110){return db[_0x11be('0x2d')][_0x11be('0x48')](_0x3f2070['body'],{})[_0x11be('0x22')](function(_0x29f82f){var _0x534ee7=_0x3f2070['user']['get']({'plain':!![]});if(!_0x534ee7)throw new Error(_0x11be('0x49'));if(_0x534ee7['role']===_0x11be('0x4a')){var _0x1c1626=_0x29f82f[_0x11be('0x23')]({'plain':!![]});var _0x1fb48d=_0x11be('0x24');return db[_0x11be('0x4b')][_0x11be('0x46')]({'where':{'name':_0x1fb48d,'userProfileId':_0x534ee7[_0x11be('0x4c')]},'raw':!![]})[_0x11be('0x22')](function(_0x4c873a){if(_0x4c873a&&_0x4c873a[_0x11be('0x4d')]===0x0){return db['UserProfileResource'][_0x11be('0x48')]({'name':_0x1c1626[_0x11be('0x29')],'resourceId':_0x1c1626['id'],'type':_0x4c873a['name'],'sectionId':_0x4c873a['id']},{})[_0x11be('0x22')](function(){return _0x29f82f;});}else{return _0x29f82f;}})[_0x11be('0x47')](function(_0x4c0e37){logger[_0x11be('0x27')](_0x11be('0x4e'),_0x4c0e37);throw _0x4c0e37;});}return _0x29f82f;})['then'](respondWithResult(_0x2ce110,0xc9))['catch'](handleError(_0x2ce110,null));};exports[_0x11be('0x21')]=function(_0x2886ac,_0x50eeab){if(_0x2886ac['body']['id']){delete _0x2886ac[_0x11be('0x4f')]['id'];}return db[_0x11be('0x2d')][_0x11be('0x46')]({'where':{'id':_0x2886ac['params']['id']}})['then'](handleEntityNotFound(_0x50eeab,null))['then'](saveUpdates(_0x2886ac[_0x11be('0x4f')],null))[_0x11be('0x22')](respondWithResult(_0x50eeab,null))[_0x11be('0x47')](handleError(_0x50eeab,null));};exports['destroy']=function(_0x4db963,_0x33409c){return db[_0x11be('0x2d')][_0x11be('0x46')]({'where':{'id':_0x4db963[_0x11be('0x50')]['id']}})['then'](handleEntityNotFound(_0x33409c,null))[_0x11be('0x22')](removeEntity(_0x33409c,null))['catch'](handleError(_0x33409c,null));}; \ No newline at end of file +var _0xb469=['to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','limit','set','Content-Range','apply','update','then','get','Tags','UserProfileResource','destroy','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','filter','includeAll','findAll','rows','catch','show','params','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x5e4a49,_0x2816ea){var _0x4f49d9=function(_0x2fdd59){while(--_0x2fdd59){_0x5e4a49['push'](_0x5e4a49['shift']());}};_0x4f49d9(++_0x2816ea);}(_0xb469,0x13b));var _0x9b46=function(_0x1b3ee5,_0x371203){_0x1b3ee5=_0x1b3ee5-0x0;var _0x240a60=_0xb469[_0x1b3ee5];return _0x240a60;};'use strict';var emlformat=require(_0x9b46('0x0'));var rimraf=require(_0x9b46('0x1'));var zipdir=require(_0x9b46('0x2'));var jsonpatch=require(_0x9b46('0x3'));var rp=require(_0x9b46('0x4'));var moment=require(_0x9b46('0x5'));var BPromise=require(_0x9b46('0x6'));var Mustache=require('mustache');var util=require(_0x9b46('0x7'));var path=require(_0x9b46('0x8'));var sox=require('sox');var csv=require(_0x9b46('0x9'));var ejs=require(_0x9b46('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9b46('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9b46('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9b46('0x9'));var querystring=require(_0x9b46('0xd'));var Papa=require(_0x9b46('0xe'));var Redis=require('ioredis');var authService=require(_0x9b46('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9b46('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9b46('0x11'))('api');var utils=require(_0x9b46('0x12'));var config=require(_0x9b46('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9b46('0x14'))['db'];function respondWithStatusCode(_0x417df5,_0x5b65c2){_0x5b65c2=_0x5b65c2||0xcc;return function(_0x14362a){if(_0x14362a){return _0x417df5[_0x9b46('0x15')](_0x5b65c2);}return _0x417df5[_0x9b46('0x16')](_0x5b65c2)[_0x9b46('0x17')]();};}function respondWithResult(_0xa8f4ac,_0x35c5c1){_0x35c5c1=_0x35c5c1||0xc8;return function(_0x2136bc){if(_0x2136bc){return _0xa8f4ac[_0x9b46('0x16')](_0x35c5c1)[_0x9b46('0x18')](_0x2136bc);}};}function respondWithFilteredResult(_0x178293,_0xbc1ba6){return function(_0x135cc2){if(_0x135cc2){var _0x1e6911=typeof _0xbc1ba6['offset']==='undefined'&&typeof _0xbc1ba6['limit']===_0x9b46('0x19');var _0x5a380c=_0x135cc2[_0x9b46('0x1a')];var _0x5c5cc9=_0x1e6911?0x0:_0xbc1ba6['offset'];var _0x3d9efa=_0x1e6911?_0x135cc2['count']:_0xbc1ba6['offset']+_0xbc1ba6[_0x9b46('0x1b')];var _0x3a15cc;if(_0x3d9efa>=_0x5a380c){_0x3d9efa=_0x5a380c;_0x3a15cc=0xc8;}else{_0x3a15cc=0xce;}_0x178293['status'](_0x3a15cc);return _0x178293[_0x9b46('0x1c')](_0x9b46('0x1d'),_0x5c5cc9+'-'+_0x3d9efa+'/'+_0x5a380c)['json'](_0x135cc2);}return null;};}function patchUpdates(_0x55aece){return function(_0xbec2ea){try{jsonpatch[_0x9b46('0x1e')](_0xbec2ea,_0x55aece,!![]);}catch(_0x204098){return BPromise['reject'](_0x204098);}return _0xbec2ea['save']();};}function saveUpdates(_0x2b3440,_0x51d2ca){return function(_0x21dacb){if(_0x21dacb){return _0x21dacb[_0x9b46('0x1f')](_0x2b3440)['then'](function(_0xadff19){return _0xadff19;});}return null;};}function removeEntity(_0x5182b1,_0x141cb6){return function(_0x2b6f72){if(_0x2b6f72){return _0x2b6f72['destroy']()[_0x9b46('0x20')](function(){var _0x31ca63=_0x2b6f72[_0x9b46('0x21')]({'plain':!![]});var _0x319930=_0x9b46('0x22');return db[_0x9b46('0x23')][_0x9b46('0x24')]({'where':{'type':_0x319930,'resourceId':_0x31ca63['id']}})['then'](function(){return _0x2b6f72;});})[_0x9b46('0x20')](function(){_0x5182b1[_0x9b46('0x16')](0xcc)[_0x9b46('0x17')]();});}};}function handleEntityNotFound(_0x268821,_0x2468be){return function(_0x2a79a5){if(!_0x2a79a5){_0x268821[_0x9b46('0x15')](0x194);}return _0x2a79a5;};}function handleError(_0x50fb4a,_0x3bf5b9){_0x3bf5b9=_0x3bf5b9||0x1f4;return function(_0xee519e){logger[_0x9b46('0x25')](_0xee519e[_0x9b46('0x26')]);if(_0xee519e[_0x9b46('0x27')]){delete _0xee519e[_0x9b46('0x27')];}_0x50fb4a[_0x9b46('0x16')](_0x3bf5b9)[_0x9b46('0x28')](_0xee519e);};}exports[_0x9b46('0x29')]=function(_0x20090a,_0x2e1c51){var _0x5ab8b7={},_0x1f722d={},_0x27f326={'count':0x0,'rows':[]};var _0x807f2=_[_0x9b46('0x2a')](db[_0x9b46('0x2b')][_0x9b46('0x2c')],function(_0xbf8bc5){return{'name':_0xbf8bc5[_0x9b46('0x2d')],'type':_0xbf8bc5[_0x9b46('0x2e')][_0x9b46('0x2f')]};});_0x1f722d[_0x9b46('0x30')]=_['map'](_0x807f2,_0x9b46('0x27'));_0x1f722d['query']=_[_0x9b46('0x31')](_0x20090a[_0x9b46('0x32')]);_0x1f722d[_0x9b46('0x33')]=_['intersection'](_0x1f722d[_0x9b46('0x30')],_0x1f722d[_0x9b46('0x32')]);_0x5ab8b7[_0x9b46('0x34')]=_[_0x9b46('0x35')](_0x1f722d[_0x9b46('0x30')],qs['fields'](_0x20090a['query'][_0x9b46('0x36')]));_0x5ab8b7[_0x9b46('0x34')]=_0x5ab8b7[_0x9b46('0x34')][_0x9b46('0x37')]?_0x5ab8b7['attributes']:_0x1f722d[_0x9b46('0x30')];if(!_0x20090a['query'][_0x9b46('0x38')](_0x9b46('0x39'))){_0x5ab8b7[_0x9b46('0x1b')]=qs[_0x9b46('0x1b')](_0x20090a['query'][_0x9b46('0x1b')]);_0x5ab8b7['offset']=qs[_0x9b46('0x3a')](_0x20090a[_0x9b46('0x32')][_0x9b46('0x3a')]);}_0x5ab8b7[_0x9b46('0x3b')]=qs[_0x9b46('0x3c')](_0x20090a[_0x9b46('0x32')][_0x9b46('0x3c')]);_0x5ab8b7[_0x9b46('0x3d')]=qs[_0x9b46('0x33')](_[_0x9b46('0x3e')](_0x20090a[_0x9b46('0x32')],_0x1f722d['filters']),_0x807f2);if(_0x20090a[_0x9b46('0x32')]['filter']){_0x5ab8b7[_0x9b46('0x3d')]=_[_0x9b46('0x3f')](_0x5ab8b7['where'],{'$or':_[_0x9b46('0x2a')](_0x807f2,function(_0x4f953e){if(_0x4f953e[_0x9b46('0x2e')]!=='VIRTUAL'){var _0x443226={};_0x443226[_0x4f953e[_0x9b46('0x27')]]={'$like':'%'+_0x20090a[_0x9b46('0x32')][_0x9b46('0x40')]+'%'};return _0x443226;}})});}_0x5ab8b7=_[_0x9b46('0x3f')]({},_0x5ab8b7,_0x20090a['options']);var _0x4e268c={'where':_0x5ab8b7[_0x9b46('0x3d')]};return db['Tag']['count'](_0x4e268c)['then'](function(_0x4e1911){_0x27f326[_0x9b46('0x1a')]=_0x4e1911;if(_0x20090a['query'][_0x9b46('0x41')]){_0x5ab8b7['include']=[{'all':!![]}];}return db[_0x9b46('0x2b')][_0x9b46('0x42')](_0x5ab8b7);})[_0x9b46('0x20')](function(_0xa14b){_0x27f326[_0x9b46('0x43')]=_0xa14b;return _0x27f326;})[_0x9b46('0x20')](respondWithFilteredResult(_0x2e1c51,_0x5ab8b7))[_0x9b46('0x44')](handleError(_0x2e1c51,null));};exports[_0x9b46('0x45')]=function(_0x148d86,_0x5602a9){var _0x447302={'raw':!![],'where':{'id':_0x148d86[_0x9b46('0x46')]['id']}},_0xe7d0fc={};_0xe7d0fc[_0x9b46('0x30')]=_[_0x9b46('0x31')](db[_0x9b46('0x2b')][_0x9b46('0x2c')]);_0xe7d0fc[_0x9b46('0x32')]=_[_0x9b46('0x31')](_0x148d86[_0x9b46('0x32')]);_0xe7d0fc[_0x9b46('0x33')]=_[_0x9b46('0x35')](_0xe7d0fc[_0x9b46('0x30')],_0xe7d0fc[_0x9b46('0x32')]);_0x447302['attributes']=_['intersection'](_0xe7d0fc[_0x9b46('0x30')],qs[_0x9b46('0x36')](_0x148d86[_0x9b46('0x32')]['fields']));_0x447302['attributes']=_0x447302[_0x9b46('0x34')][_0x9b46('0x37')]?_0x447302[_0x9b46('0x34')]:_0xe7d0fc[_0x9b46('0x30')];if(_0x148d86[_0x9b46('0x32')][_0x9b46('0x41')]){_0x447302['include']=[{'all':!![]}];}_0x447302=_[_0x9b46('0x3f')]({},_0x447302,_0x148d86[_0x9b46('0x47')]);return db[_0x9b46('0x2b')]['find'](_0x447302)[_0x9b46('0x20')](handleEntityNotFound(_0x5602a9,null))['then'](respondWithResult(_0x5602a9,null))[_0x9b46('0x44')](handleError(_0x5602a9,null));};exports[_0x9b46('0x48')]=function(_0x16e6d8,_0x566bad){return db[_0x9b46('0x2b')][_0x9b46('0x48')](_0x16e6d8[_0x9b46('0x49')],{})[_0x9b46('0x20')](function(_0x3d4c13){var _0x373ffd=_0x16e6d8['user'][_0x9b46('0x21')]({'plain':!![]});if(!_0x373ffd)throw new Error(_0x9b46('0x4a'));if(_0x373ffd[_0x9b46('0x4b')]===_0x9b46('0x4c')){var _0x362311=_0x3d4c13[_0x9b46('0x21')]({'plain':!![]});var _0x4a1df0=_0x9b46('0x22');return db['UserProfileSection'][_0x9b46('0x4d')]({'where':{'name':_0x4a1df0,'userProfileId':_0x373ffd[_0x9b46('0x4e')]},'raw':!![]})[_0x9b46('0x20')](function(_0x33d9ac){if(_0x33d9ac&&_0x33d9ac[_0x9b46('0x4f')]===0x0){return db['UserProfileResource'][_0x9b46('0x48')]({'name':_0x362311[_0x9b46('0x27')],'resourceId':_0x362311['id'],'type':_0x33d9ac[_0x9b46('0x27')],'sectionId':_0x33d9ac['id']},{})[_0x9b46('0x20')](function(){return _0x3d4c13;});}else{return _0x3d4c13;}})[_0x9b46('0x44')](function(_0x14080e){logger[_0x9b46('0x25')](_0x9b46('0x50'),_0x14080e);throw _0x14080e;});}return _0x3d4c13;})[_0x9b46('0x20')](respondWithResult(_0x566bad,0xc9))[_0x9b46('0x44')](handleError(_0x566bad,null));};exports[_0x9b46('0x1f')]=function(_0x4d473f,_0x551a64){if(_0x4d473f['body']['id']){delete _0x4d473f[_0x9b46('0x49')]['id'];}return db['Tag'][_0x9b46('0x4d')]({'where':{'id':_0x4d473f['params']['id']}})[_0x9b46('0x20')](handleEntityNotFound(_0x551a64,null))['then'](saveUpdates(_0x4d473f[_0x9b46('0x49')],null))[_0x9b46('0x20')](respondWithResult(_0x551a64,null))[_0x9b46('0x44')](handleError(_0x551a64,null));};exports[_0x9b46('0x24')]=function(_0x35f71d,_0x5bcaad){return db[_0x9b46('0x2b')][_0x9b46('0x4d')]({'where':{'id':_0x35f71d[_0x9b46('0x46')]['id']}})[_0x9b46('0x20')](handleEntityNotFound(_0x5bcaad,null))[_0x9b46('0x20')](removeEntity(_0x5bcaad,null))['catch'](handleError(_0x5bcaad,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 85bce8c..073c7d7 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 _0xc47c=['request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','moment'];(function(_0x84c668,_0x1adb70){var _0x514350=function(_0x26b18a){while(--_0x26b18a){_0x84c668['push'](_0x84c668['shift']());}};_0x514350(++_0x1adb70);}(_0xc47c,0xe0));var _0xcc47=function(_0x2d04a4,_0x2dbab9){_0x2d04a4=_0x2d04a4-0x0;var _0x5994ff=_0xc47c[_0x2d04a4];return _0x5994ff;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xcc47('0x0'));var BPromise=require('bluebird');var rp=require(_0xcc47('0x1'));var fs=require('fs');var path=require(_0xcc47('0x2'));var rimraf=require(_0xcc47('0x3'));var config=require(_0xcc47('0x4'));var attributes=require(_0xcc47('0x5'));module[_0xcc47('0x6')]=function(_0x462acf,_0x5e52b0){return _0x462acf[_0xcc47('0x7')](_0xcc47('0x8'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe65=['bluebird','request-promise','rimraf','./tag.attributes','exports','define','tools_tags','lodash','util','../../config/logger','api'];(function(_0x4884a7,_0x18e38a){var _0x56b60e=function(_0x2ba8a3){while(--_0x2ba8a3){_0x4884a7['push'](_0x4884a7['shift']());}};_0x56b60e(++_0x18e38a);}(_0xfe65,0xb7));var _0x5fe6=function(_0x288f77,_0x4a26a6){_0x288f77=_0x288f77-0x0;var _0x119855=_0xfe65[_0x288f77];return _0x119855;};'use strict';var _=require(_0x5fe6('0x0'));var util=require(_0x5fe6('0x1'));var logger=require(_0x5fe6('0x2'))(_0x5fe6('0x3'));var moment=require('moment');var BPromise=require(_0x5fe6('0x4'));var rp=require(_0x5fe6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5fe6('0x6'));var config=require('../../config/environment');var attributes=require(_0x5fe6('0x7'));module[_0x5fe6('0x8')]=function(_0x563c56,_0x3533c9){return _0x563c56[_0x5fe6('0x9')]('Tag',attributes,{'tableName':_0x5fe6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index c1c6e14..f47cdcb 100644 --- a/server/api/tag/tag.rpc.js +++ b/server/api/tag/tag.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0faf=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xd843bc,_0x7e3cae){var _0x3c827d=function(_0x5d7d34){while(--_0x5d7d34){_0xd843bc['push'](_0xd843bc['shift']());}};_0x3c827d(++_0x7e3cae);}(_0x0faf,0x132));var _0xf0fa=function(_0x50e0b4,_0x1057f7){_0x50e0b4=_0x50e0b4-0x0;var _0x2fa8b0=_0x0faf[_0x50e0b4];return _0x2fa8b0;};'use strict';var _=require(_0xf0fa('0x0'));var util=require('util');var moment=require(_0xf0fa('0x1'));var BPromise=require(_0xf0fa('0x2'));var rs=require(_0xf0fa('0x3'));var fs=require('fs');var Redis=require(_0xf0fa('0x4'));var db=require(_0xf0fa('0x5'))['db'];var utils=require(_0xf0fa('0x6'));var logger=require(_0xf0fa('0x7'))(_0xf0fa('0x8'));var config=require(_0xf0fa('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf0fa('0xa')][_0xf0fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25b5c4,_0x3a703b,_0x2db1d9){return new BPromise(function(_0x587865,_0x42f7fd){return client[_0xf0fa('0xc')](_0x25b5c4,_0x2db1d9)['then'](function(_0x4df4d1){logger[_0xf0fa('0xd')](_0xf0fa('0xe'),_0x3a703b,_0xf0fa('0xf'));logger[_0xf0fa('0x10')](_0xf0fa('0x11'),_0x3a703b,_0xf0fa('0xf'),JSON[_0xf0fa('0x12')](_0x4df4d1));if(_0x4df4d1[_0xf0fa('0x13')]){if(_0x4df4d1['error'][_0xf0fa('0x14')]===0x1f4){logger['error'](_0xf0fa('0xe'),_0x3a703b,_0x4df4d1['error'][_0xf0fa('0x15')]);return _0x42f7fd(_0x4df4d1[_0xf0fa('0x13')][_0xf0fa('0x15')]);}logger['error']('Tag,\x20%s,\x20%s',_0x3a703b,_0x4df4d1[_0xf0fa('0x13')]['message']);return _0x587865(_0x4df4d1[_0xf0fa('0x13')][_0xf0fa('0x15')]);}else{logger[_0xf0fa('0xd')](_0xf0fa('0xe'),_0x3a703b,_0xf0fa('0xf'));_0x587865(_0x4df4d1[_0xf0fa('0x16')][_0xf0fa('0x15')]);}})[_0xf0fa('0x17')](function(_0x497542){logger[_0xf0fa('0x13')](_0xf0fa('0xe'),_0x3a703b,_0x497542);_0x42f7fd(_0x497542);});});} \ No newline at end of file +var _0xdd0c=['error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2cb51d,_0x504607){var _0x96c409=function(_0x4e190e){while(--_0x4e190e){_0x2cb51d['push'](_0x2cb51d['shift']());}};_0x96c409(++_0x504607);}(_0xdd0c,0x165));var _0xcdd0=function(_0xb223ed,_0x4180c6){_0xb223ed=_0xb223ed-0x0;var _0x238be0=_0xdd0c[_0xb223ed];return _0x238be0;};'use strict';var _=require('lodash');var util=require(_0xcdd0('0x0'));var moment=require(_0xcdd0('0x1'));var BPromise=require(_0xcdd0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcdd0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcdd0('0x4'));var logger=require(_0xcdd0('0x5'))(_0xcdd0('0x6'));var config=require(_0xcdd0('0x7'));var jayson=require(_0xcdd0('0x8'));var client=jayson['client'][_0xcdd0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b6f5d,_0x1fd3f6,_0x15c402){return new BPromise(function(_0x337496,_0x557a65){return client[_0xcdd0('0xa')](_0x1b6f5d,_0x15c402)['then'](function(_0x5db720){logger[_0xcdd0('0xb')](_0xcdd0('0xc'),_0x1fd3f6,_0xcdd0('0xd'));logger[_0xcdd0('0xe')](_0xcdd0('0xf'),_0x1fd3f6,_0xcdd0('0xd'),JSON[_0xcdd0('0x10')](_0x5db720));if(_0x5db720[_0xcdd0('0x11')]){if(_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x12')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x1fd3f6,_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x13')]);return _0x557a65(_0x5db720['error'][_0xcdd0('0x13')]);}logger[_0xcdd0('0x11')]('Tag,\x20%s,\x20%s',_0x1fd3f6,_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x13')]);return _0x337496(_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x13')]);}else{logger[_0xcdd0('0xb')]('Tag,\x20%s,\x20%s',_0x1fd3f6,'request\x20sent');_0x337496(_0x5db720[_0xcdd0('0x14')][_0xcdd0('0x13')]);}})[_0xcdd0('0x15')](function(_0xf7af04){logger[_0xcdd0('0x11')](_0xcdd0('0xc'),_0x1fd3f6,_0xf7af04);_0x557a65(_0xf7af04);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 05de0c7..ddbc134 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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 c0c2fd8..c3b0a34 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 _0x2032=['name','exports','STRING'];(function(_0x4924b3,_0x4521cb){var _0x1ee472=function(_0x12d4f4){while(--_0x12d4f4){_0x4924b3['push'](_0x4924b3['shift']());}};_0x1ee472(++_0x4521cb);}(_0x2032,0xd9));var _0x2203=function(_0x4567b3,_0x4a9bb0){_0x4567b3=_0x4567b3-0x0;var _0xb44182=_0x2032[_0x4567b3];return _0xb44182;};'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 _0xb7e7=['STRING','sequelize'];(function(_0x264545,_0x214037){var _0x114d10=function(_0x9e3461){while(--_0x9e3461){_0x264545['push'](_0x264545['shift']());}};_0x114d10(++_0x214037);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xb7e7[_0x4ea69d];return _0x5318e0;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index cf39057..85d4758 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 _0x294f=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Teams','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','params','sequelize','Sequelize','QueryTypes','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','VoicePrefixId','UserProfileResource','getQueues','findOne','isValidChannel','channel','Unknown\x20channel','capitalize','toLowerCase','Queues','addQueues','ValidationError','add','ids','removeQueues','Voice','Mail','Sms','Fax','Openchannel','Whatsapp','transaction','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','TeamVoicePrefix','UserVoicePrefix','addAgents','spread','removeAgents','Queue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','stack','send','index','Team','rawAttributes','type','map','name','query','keys','filters','intersection','model','attributes','fields','length'];(function(_0x3767b7,_0x566f18){var _0x1f31fb=function(_0x567582){while(--_0x567582){_0x3767b7['push'](_0x3767b7['shift']());}};_0x1f31fb(++_0x566f18);}(_0x294f,0xfa));var _0xf294=function(_0x274208,_0x3182ff){_0x274208=_0x274208-0x0;var _0x209164=_0x294f[_0x274208];return _0x209164;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf294('0x0'));var zipdir=require(_0xf294('0x1'));var jsonpatch=require(_0xf294('0x2'));var rp=require(_0xf294('0x3'));var moment=require(_0xf294('0x4'));var BPromise=require(_0xf294('0x5'));var Mustache=require(_0xf294('0x6'));var util=require('util');var path=require(_0xf294('0x7'));var sox=require(_0xf294('0x8'));var csv=require(_0xf294('0x9'));var ejs=require(_0xf294('0xa'));var fs=require('fs');var fs_extra=require(_0xf294('0xb'));var _=require(_0xf294('0xc'));var squel=require(_0xf294('0xd'));var crypto=require(_0xf294('0xe'));var jsforce=require(_0xf294('0xf'));var deskjs=require(_0xf294('0x10'));var toCsv=require(_0xf294('0x9'));var querystring=require('querystring');var Papa=require(_0xf294('0x11'));var Redis=require(_0xf294('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf294('0x13'));var as=require(_0xf294('0x14'));var hardwareService=require(_0xf294('0x15'));var logger=require('../../config/logger')(_0xf294('0x16'));var utils=require(_0xf294('0x17'));var config=require(_0xf294('0x18'));var licenseUtil=require(_0xf294('0x19'));var db=require(_0xf294('0x1a'))['db'];config[_0xf294('0x1b')]=_[_0xf294('0x1c')](config[_0xf294('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xf294('0x1d'))(new Redis(config[_0xf294('0x1b')]));require(_0xf294('0x1e'))[_0xf294('0x1f')](socket);function respondWithStatusCode(_0x555ab8,_0x3de373){_0x3de373=_0x3de373||0xcc;return function(_0x123aac){if(_0x123aac){return _0x555ab8[_0xf294('0x20')](_0x3de373);}return _0x555ab8[_0xf294('0x21')](_0x3de373)['end']();};}function respondWithResult(_0x103eee,_0x235cc6){_0x235cc6=_0x235cc6||0xc8;return function(_0x46fe0c){if(_0x46fe0c){return _0x103eee[_0xf294('0x21')](_0x235cc6)[_0xf294('0x22')](_0x46fe0c);}};}function respondWithFilteredResult(_0x2de8d3,_0x2911fd){return function(_0x4e3193){if(_0x4e3193){var _0x5aa53e=typeof _0x2911fd[_0xf294('0x23')]===_0xf294('0x24')&&typeof _0x2911fd[_0xf294('0x25')]===_0xf294('0x24');var _0x49104b=_0x4e3193[_0xf294('0x26')];var _0x4a162d=_0x5aa53e?0x0:_0x2911fd[_0xf294('0x23')];var _0x177724=_0x5aa53e?_0x4e3193['count']:_0x2911fd[_0xf294('0x23')]+_0x2911fd[_0xf294('0x25')];var _0x2158f2;if(_0x177724>=_0x49104b){_0x177724=_0x49104b;_0x2158f2=0xc8;}else{_0x2158f2=0xce;}_0x2de8d3[_0xf294('0x21')](_0x2158f2);return _0x2de8d3[_0xf294('0x27')](_0xf294('0x28'),_0x4a162d+'-'+_0x177724+'/'+_0x49104b)[_0xf294('0x22')](_0x4e3193);}return null;};}function patchUpdates(_0x34e50d){return function(_0x3cdb16){try{jsonpatch[_0xf294('0x29')](_0x3cdb16,_0x34e50d,!![]);}catch(_0x4b6b02){return BPromise[_0xf294('0x2a')](_0x4b6b02);}return _0x3cdb16[_0xf294('0x2b')]();};}function saveUpdates(_0x4f54ce,_0x5a3cd5){return function(_0x180e8f){if(_0x180e8f){return _0x180e8f['update'](_0x4f54ce)['then'](function(_0x29d2ff){return _0x29d2ff;});}return null;};}function handleEntityNotFound(_0x4f5d0e,_0x10a557){return function(_0x113fd4){if(!_0x113fd4){_0x4f5d0e[_0xf294('0x20')](0x194);}return _0x113fd4;};}function handleError(_0x52cbd7,_0x51186b){_0x51186b=_0x51186b||0x1f4;return function(_0x1fcf08){logger['error'](_0x1fcf08[_0xf294('0x2c')]);if(_0x1fcf08['name']){delete _0x1fcf08['name'];}_0x52cbd7[_0xf294('0x21')](_0x51186b)[_0xf294('0x2d')](_0x1fcf08);};}exports[_0xf294('0x2e')]=function(_0x8b2d89,_0x575d89){var _0x3c544c={},_0x212607={},_0x2d2908={'count':0x0,'rows':[]};var _0x2fcf8b=_['map'](db[_0xf294('0x2f')][_0xf294('0x30')],function(_0x12040a){return{'name':_0x12040a['fieldName'],'type':_0x12040a[_0xf294('0x31')]['key']};});_0x212607['model']=_[_0xf294('0x32')](_0x2fcf8b,_0xf294('0x33'));_0x212607[_0xf294('0x34')]=_[_0xf294('0x35')](_0x8b2d89[_0xf294('0x34')]);_0x212607[_0xf294('0x36')]=_[_0xf294('0x37')](_0x212607[_0xf294('0x38')],_0x212607[_0xf294('0x34')]);_0x3c544c[_0xf294('0x39')]=_[_0xf294('0x37')](_0x212607[_0xf294('0x38')],qs[_0xf294('0x3a')](_0x8b2d89[_0xf294('0x34')][_0xf294('0x3a')]));_0x3c544c[_0xf294('0x39')]=_0x3c544c['attributes'][_0xf294('0x3b')]?_0x3c544c[_0xf294('0x39')]:_0x212607['model'];if(!_0x8b2d89['query'][_0xf294('0x3c')](_0xf294('0x3d'))){_0x3c544c[_0xf294('0x25')]=qs['limit'](_0x8b2d89[_0xf294('0x34')][_0xf294('0x25')]);_0x3c544c[_0xf294('0x23')]=qs[_0xf294('0x23')](_0x8b2d89['query'][_0xf294('0x23')]);}_0x3c544c[_0xf294('0x3e')]=qs[_0xf294('0x3f')](_0x8b2d89[_0xf294('0x34')][_0xf294('0x3f')]);_0x3c544c[_0xf294('0x40')]=qs['filters'](_[_0xf294('0x41')](_0x8b2d89[_0xf294('0x34')],_0x212607[_0xf294('0x36')]),_0x2fcf8b);if(_0x8b2d89[_0xf294('0x34')][_0xf294('0x42')]){_0x3c544c['where']=_[_0xf294('0x43')](_0x3c544c['where'],{'$or':_[_0xf294('0x32')](_0x2fcf8b,function(_0x5266cc){if(_0x5266cc[_0xf294('0x31')]!==_0xf294('0x44')){var _0x4020c7={};_0x4020c7[_0x5266cc[_0xf294('0x33')]]={'$like':'%'+_0x8b2d89[_0xf294('0x34')][_0xf294('0x42')]+'%'};return _0x4020c7;}})});}_0x3c544c=_[_0xf294('0x43')]({},_0x3c544c,_0x8b2d89[_0xf294('0x45')]);var _0x2dfbcf={'where':_0x3c544c[_0xf294('0x40')]};return db[_0xf294('0x2f')][_0xf294('0x26')](_0x2dfbcf)[_0xf294('0x46')](function(_0x4fd4f1){_0x2d2908[_0xf294('0x26')]=_0x4fd4f1;if(_0x8b2d89[_0xf294('0x34')][_0xf294('0x47')]){_0x3c544c[_0xf294('0x48')]=[{'all':!![]}];}return db[_0xf294('0x2f')][_0xf294('0x49')](_0x3c544c);})['then'](function(_0x3a7c73){_0x2d2908[_0xf294('0x4a')]=_0x3a7c73;return _0x2d2908;})['then'](respondWithFilteredResult(_0x575d89,_0x3c544c))[_0xf294('0x4b')](handleError(_0x575d89,null));};exports[_0xf294('0x4c')]=function(_0x14491f,_0x5a8ce3){var _0x492f84={'raw':![],'where':{'id':_0x14491f['params']['id']}},_0x26ab71={};_0x26ab71[_0xf294('0x38')]=_['keys'](db[_0xf294('0x2f')][_0xf294('0x30')]);_0x26ab71[_0xf294('0x34')]=_[_0xf294('0x35')](_0x14491f[_0xf294('0x34')]);_0x26ab71[_0xf294('0x36')]=_[_0xf294('0x37')](_0x26ab71[_0xf294('0x38')],_0x26ab71[_0xf294('0x34')]);_0x492f84[_0xf294('0x39')]=_[_0xf294('0x37')](_0x26ab71[_0xf294('0x38')],qs[_0xf294('0x3a')](_0x14491f['query'][_0xf294('0x3a')]));_0x492f84[_0xf294('0x39')]=_0x492f84[_0xf294('0x39')][_0xf294('0x3b')]?_0x492f84[_0xf294('0x39')]:_0x26ab71['model'];if(_0x14491f['query']['includeAll']){_0x492f84[_0xf294('0x48')]=[{'all':!![]}];}_0x492f84=_[_0xf294('0x43')]({},_0x492f84,_0x14491f[_0xf294('0x45')]);return db[_0xf294('0x2f')][_0xf294('0x4d')](_0x492f84)['then'](handleEntityNotFound(_0x5a8ce3,null))[_0xf294('0x46')](respondWithResult(_0x5a8ce3,null))[_0xf294('0x4b')](handleError(_0x5a8ce3,null));};exports[_0xf294('0x4e')]=function(_0x13b289,_0x554b83){return db['Team'][_0xf294('0x4e')](_0x13b289[_0xf294('0x4f')],{})['then'](function(_0x3df595){var _0x2fab25=_0x13b289[_0xf294('0x50')]['get']({'plain':!![]});if(!_0x2fab25)throw new Error(_0xf294('0x51'));if(_0x2fab25[_0xf294('0x52')]===_0xf294('0x50')){var _0x4b6c45=_0x3df595[_0xf294('0x53')]({'plain':!![]});var _0x549028=_0xf294('0x54');return db[_0xf294('0x55')]['find']({'where':{'name':_0x549028,'userProfileId':_0x2fab25['userProfileId']},'raw':!![]})[_0xf294('0x46')](function(_0x5cc014){if(_0x5cc014&&_0x5cc014['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4b6c45['name'],'resourceId':_0x4b6c45['id'],'type':_0x5cc014['name'],'sectionId':_0x5cc014['id']},{})[_0xf294('0x46')](function(){return _0x3df595;});}else{return _0x3df595;}})[_0xf294('0x4b')](function(_0x2207cf){logger[_0xf294('0x56')](_0xf294('0x57'),_0x2207cf);throw _0x2207cf;});}return _0x3df595;})[_0xf294('0x46')](respondWithResult(_0x554b83,0xc9))[_0xf294('0x4b')](handleError(_0x554b83,null));};exports[_0xf294('0x58')]=function(_0x3cf4c8,_0x4ef09a){if(_0x3cf4c8[_0xf294('0x4f')]['id']){delete _0x3cf4c8['body']['id'];}return db[_0xf294('0x2f')][_0xf294('0x4d')]({'where':{'id':_0x3cf4c8['params']['id']}})[_0xf294('0x46')](handleEntityNotFound(_0x4ef09a,null))[_0xf294('0x46')](saveUpdates(_0x3cf4c8[_0xf294('0x4f')],null))[_0xf294('0x46')](respondWithResult(_0x4ef09a,null))['catch'](handleError(_0x4ef09a,null));};exports[_0xf294('0x59')]=function(_0x58f9ca,_0x36a585){var _0x50b962=_0x58f9ca[_0xf294('0x5a')]['id'];var _0x40c89c=[];return db[_0xf294('0x5b')]['transaction'](function(_0x4be648){var _0x3fe980='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x50b962;return db[_0xf294('0x5b')]['query'](_0x3fe980,{'type':db[_0xf294('0x5c')][_0xf294('0x5d')]['SELECT'],'raw':!![],'transaction':_0x4be648})[_0xf294('0x46')](function(_0x5538b0){_0x40c89c=_[_0xf294('0x32')](_0x5538b0,function(_0x2400a6){return Number(_0x2400a6['UserId']);});})['then'](function(){var _0x16eef5=_0xf294('0x5e')+_0x50b962;return db[_0xf294('0x5b')]['query'](_0x16eef5,{'type':db[_0xf294('0x5c')]['QueryTypes'][_0xf294('0x5f')],'raw':!![],'transaction':_0x4be648});})[_0xf294('0x46')](function(_0x1eccdf){var _0x3523cd=_[_0xf294('0x32')](_0x1eccdf,function(_0x5aeba6){return Number(_0x5aeba6['VoiceQueueId']);});return db[_0xf294('0x60')]['destroy']({'where':{'UserId':{'$in':_0x40c89c},'VoiceQueueId':{'$in':_0x3523cd}},'transaction':_0x4be648});})[_0xf294('0x46')](function(){var _0x3ee2f2=_0xf294('0x61')+_0x50b962;return db['sequelize'][_0xf294('0x34')](_0x3ee2f2,{'type':db[_0xf294('0x5c')][_0xf294('0x5d')][_0xf294('0x5f')],'raw':!![],'transaction':_0x4be648});})['then'](function(_0x117e23){var _0x23a4c8=_['map'](_0x117e23,function(_0x3ec3e4){return Number(_0x3ec3e4['MailQueueId']);});return db[_0xf294('0x62')][_0xf294('0x59')]({'where':{'UserId':{'$in':_0x40c89c},'MailQueueId':{'$in':_0x23a4c8}},'transaction':_0x4be648});})[_0xf294('0x46')](function(){var _0x337dbd=_0xf294('0x63')+_0x50b962;return db['sequelize'][_0xf294('0x34')](_0x337dbd,{'type':db[_0xf294('0x5c')]['QueryTypes'][_0xf294('0x5f')],'raw':!![],'transaction':_0x4be648});})['then'](function(_0x323f11){var _0x424435=_[_0xf294('0x32')](_0x323f11,function(_0x22fed6){return Number(_0x22fed6[_0xf294('0x64')]);});return db['UserSmsQueue'][_0xf294('0x59')]({'where':{'UserId':{'$in':_0x40c89c},'SmsQueueId':{'$in':_0x424435}},'transaction':_0x4be648});})[_0xf294('0x46')](function(){var _0x46bbc2=_0xf294('0x65')+_0x50b962;return db[_0xf294('0x5b')][_0xf294('0x34')](_0x46bbc2,{'type':db['Sequelize'][_0xf294('0x5d')][_0xf294('0x5f')],'raw':!![],'transaction':_0x4be648});})[_0xf294('0x46')](function(_0xc61cb7){var _0xcd706d=_[_0xf294('0x32')](_0xc61cb7,function(_0x509dd9){return Number(_0x509dd9[_0xf294('0x66')]);});return db['UserChatQueue']['destroy']({'where':{'UserId':{'$in':_0x40c89c},'ChatQueueId':{'$in':_0xcd706d}},'transaction':_0x4be648});})[_0xf294('0x46')](function(){var _0x25967f=_0xf294('0x67')+_0x50b962;return db['sequelize'][_0xf294('0x34')](_0x25967f,{'type':db['Sequelize'][_0xf294('0x5d')][_0xf294('0x5f')],'raw':!![],'transaction':_0x4be648});})[_0xf294('0x46')](function(_0x4b177f){var _0x327134=_['map'](_0x4b177f,function(_0x12117c){return Number(_0x12117c['FaxQueueId']);});return db[_0xf294('0x68')][_0xf294('0x59')]({'where':{'UserId':{'$in':_0x40c89c},'FaxQueueId':{'$in':_0x327134}},'transaction':_0x4be648});})[_0xf294('0x46')](function(){var _0x4aa4e6='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x50b962;return db[_0xf294('0x5b')][_0xf294('0x34')](_0x4aa4e6,{'type':db[_0xf294('0x5c')][_0xf294('0x5d')][_0xf294('0x5f')],'raw':!![],'transaction':_0x4be648});})[_0xf294('0x46')](function(_0x36a26e){var _0x1e26d7=_[_0xf294('0x32')](_0x36a26e,function(_0x3baa38){return Number(_0x3baa38[_0xf294('0x69')]);});return db[_0xf294('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x40c89c},'OpenchannelQueueId':{'$in':_0x1e26d7}},'transaction':_0x4be648});})[_0xf294('0x46')](function(){var _0x3196d4=_0xf294('0x6b')+_0x50b962;return db['sequelize'][_0xf294('0x34')](_0x3196d4,{'type':db['Sequelize']['QueryTypes'][_0xf294('0x5f')],'raw':!![],'transaction':_0x4be648});})['then'](function(_0x1dea1d){var _0x1e6814=_[_0xf294('0x32')](_0x1dea1d,function(_0x4d769d){return Number(_0x4d769d[_0xf294('0x6c')]);});return db[_0xf294('0x6d')][_0xf294('0x59')]({'where':{'UserId':{'$in':_0x40c89c},'WhatsappQueueId':{'$in':_0x1e6814}},'transaction':_0x4be648});})[_0xf294('0x46')](function(){return db['TeamVoicePrefix'][_0xf294('0x4d')]({'where':{'TeamId':_0x50b962}});})[_0xf294('0x46')](function(_0x2b6477){if(_0x2b6477===null){return;}return db['UserVoicePrefix'][_0xf294('0x59')]({'where':{'UserId':{'$in':_0x40c89c},'VoicePrefixId':_0x2b6477[_0xf294('0x6e')]},'transaction':_0x4be648});})[_0xf294('0x46')](function(){return db[_0xf294('0x2f')]['destroy']({'where':{'id':_0x50b962},'cascade':!![],'transaction':_0x4be648});})[_0xf294('0x46')](function(_0xd95d56){if(_0xd95d56===0x0){_0x36a585[_0xf294('0x20')](0x194);}else{return db[_0xf294('0x6f')][_0xf294('0x59')]({'where':{'type':'Teams','resourceId':_0x50b962},'cascade':!![],'transaction':_0x4be648})[_0xf294('0x46')](function(){_0x36a585[_0xf294('0x21')](0xcc)['end']();});}})[_0xf294('0x4b')](function(_0x2acb4f){_0x36a585[_0xf294('0x21')](0x1f4)['send'](_0x2acb4f);});});};exports[_0xf294('0x70')]=function(_0x278527,_0x386228,_0x4740ae){return db[_0xf294('0x2f')][_0xf294('0x71')]({'where':{'id':_0x278527[_0xf294('0x5a')]['id']}})[_0xf294('0x46')](handleEntityNotFound(_0x386228,null))[_0xf294('0x46')](function(_0x126b2a){if(!_0x278527[_0xf294('0x34')]['channel']||!utils[_0xf294('0x72')](_0x278527[_0xf294('0x34')][_0xf294('0x73')])){throw new db[(_0xf294('0x5c'))]['ValidationError'](_0xf294('0x74'));}var _0x7970c={};var _0xbd1585={};_0xbd1585[_0xf294('0x38')]=_[_0xf294('0x35')](db[_[_0xf294('0x75')](_0x278527[_0xf294('0x34')]['channel']['toLowerCase']())+'Queue'][_0xf294('0x30')]);_0xbd1585[_0xf294('0x34')]=_[_0xf294('0x35')](_0x278527['query']);_0xbd1585[_0xf294('0x36')]=_[_0xf294('0x37')](_0xbd1585[_0xf294('0x38')],_0xbd1585[_0xf294('0x34')]);_0x7970c['attributes']=_[_0xf294('0x37')](_0xbd1585[_0xf294('0x38')],qs[_0xf294('0x3a')](_0x278527[_0xf294('0x34')][_0xf294('0x3a')]));_0x7970c[_0xf294('0x39')]=_0x7970c[_0xf294('0x39')]['length']?_0x7970c[_0xf294('0x39')]:_0xbd1585[_0xf294('0x38')];_0x7970c[_0xf294('0x25')]=qs['limit'](_0x278527[_0xf294('0x34')][_0xf294('0x25')]);_0x7970c['offset']=qs['offset'](_0x278527[_0xf294('0x34')][_0xf294('0x23')]);_0x7970c[_0xf294('0x3e')]=qs[_0xf294('0x3f')](_0x278527[_0xf294('0x34')]['sort']);_0x7970c[_0xf294('0x40')]=qs['filters'](_[_0xf294('0x41')](_0x278527['query'],_0xbd1585[_0xf294('0x36')]));_0x7970c=_[_0xf294('0x43')]({},_0x7970c,_0x278527[_0xf294('0x45')]);return _0x126b2a[_0xf294('0x53')+_['capitalize'](_0x278527['query'][_0xf294('0x73')][_0xf294('0x76')]())+_0xf294('0x77')](_0x7970c);})[_0xf294('0x46')](respondWithResult(_0x386228,null))[_0xf294('0x4b')](handleError(_0x386228,null));};exports[_0xf294('0x78')]=function(_0x3ba939,_0xcbadeb,_0x47c6cc){return db[_0xf294('0x2f')]['findOne']({'where':{'id':_0x3ba939[_0xf294('0x5a')]['id']}})[_0xf294('0x46')](function(_0x3b226f){if(_0x3b226f){if(!_0x3ba939[_0xf294('0x4f')]['channel']||!utils['isValidChannel'](_0x3ba939[_0xf294('0x4f')]['channel'])){throw new db[(_0xf294('0x5c'))][(_0xf294('0x79'))]('Unknown\x20channel');}return _0x3b226f[_0xf294('0x7a')+_[_0xf294('0x75')](_0x3ba939[_0xf294('0x4f')][_0xf294('0x73')][_0xf294('0x76')]())+_0xf294('0x77')](_0x3ba939[_0xf294('0x4f')][_0xf294('0x7b')]);}return null;})['then'](handleEntityNotFound(_0xcbadeb,null))[_0xf294('0x46')](respondWithStatusCode(_0xcbadeb,null))[_0xf294('0x4b')](handleError(_0xcbadeb,null));};exports[_0xf294('0x7c')]=function(_0x125541,_0x37246b,_0x420899){return db[_0xf294('0x2f')]['findOne']({'where':{'id':_0x125541['params']['id']}})['then'](function(_0x112230){if(_0x112230){if(!_0x125541[_0xf294('0x34')][_0xf294('0x73')]||!utils['isValidChannel'](_0x125541[_0xf294('0x34')]['channel'])){throw new db['Sequelize'][(_0xf294('0x79'))](_0xf294('0x74'));}return _0x112230['remove'+_[_0xf294('0x75')](_0x125541[_0xf294('0x34')][_0xf294('0x73')][_0xf294('0x76')]())+'Queues'](_0x125541[_0xf294('0x34')]['ids']);}return null;})[_0xf294('0x46')](handleEntityNotFound(_0x37246b,null))['then'](respondWithStatusCode(_0x37246b,null))['catch'](handleError(_0x37246b,null));};exports['addAgents']=function(_0x5544ab,_0x273cff){var _0x5dccd5=_['isArray'](_0x5544ab['body'][_0xf294('0x7b')])?_0x5544ab[_0xf294('0x4f')][_0xf294('0x7b')]:[_0x5544ab[_0xf294('0x4f')][_0xf294('0x7b')]];var _0xcab192=_0x5544ab[_0xf294('0x5a')]['id'];return db[_0xf294('0x2f')][_0xf294('0x4d')]({'where':{'id':_0xcab192}})[_0xf294('0x46')](handleEntityNotFound(_0x273cff,null))[_0xf294('0x46')](function(_0x3c2ee8){if(_0x3c2ee8){var _0x53a156=[_0xf294('0x7d'),'Chat',_0xf294('0x7e'),_0xf294('0x7f'),_0xf294('0x80'),_0xf294('0x81'),_0xf294('0x82')];return db[_0xf294('0x5b')][_0xf294('0x83')](function(_0x59cb7f){var _0x2894a0=_[_0xf294('0x32')](_0x53a156,function(_0x471d9f){var _0x2da87b={'attributes':['id',_0xf294('0x33')]};if(_0x471d9f===_0xf294('0x7d')){_0x2da87b['through']={'attributes':[_0xf294('0x84')]};}return _0x3c2ee8[_0xf294('0x53')+_0x471d9f+_0xf294('0x77')](_0x2da87b)[_0xf294('0x46')](function(_0x4cd0f6){var _0x2364d3=_[_0xf294('0x32')](_0x4cd0f6,function(_0x5c9f86){var _0x438dda=_[_0xf294('0x32')](_0x5dccd5,function(_0x14570a){var _0x15018c={'where':{'UserId':_0x14570a,[_0x471d9f+_0xf294('0x85')]:_0x5c9f86['id']},'transaction':_0x59cb7f};if(_0x471d9f==='Voice'){_0x15018c[_0xf294('0x1c')]={'penalty':_0x5c9f86[_0xf294('0x86')][_0xf294('0x84')]};}return db[_0xf294('0x87')+_0x471d9f+'Queue'][_0xf294('0x88')](_0x15018c)[_0xf294('0x46')](function(){socket[_0xf294('0x89')](_0xf294('0x50')+_0x471d9f+_0xf294('0x8a'),{'UserId':_0x14570a,[_0x471d9f+_0xf294('0x85')]:_0x5c9f86['id']});if(_0x471d9f!==_0xf294('0x7d')){return;}return db[_0xf294('0x87')]['findAll']({'where':{'id':_0x5dccd5,'online':0x1},'attributes':['id',_0xf294('0x33'),_0xf294('0x8b'),_0xf294('0x8c'),_0xf294('0x8d')],'raw':!![]})['then'](function(_0x399e70){var _0x380bdb=_[_0xf294('0x32')](_0x399e70,function(_0x12b053){return db[_0xf294('0x8e')][_0xf294('0x8f')]({'membername':_0x12b053['name'],'UserId':_0x12b053['id'],'queue_name':_0x5c9f86[_0xf294('0x33')],'VoiceQueueId':_0x5c9f86['id'],'interface':_[_0xf294('0x90')](_0x12b053['interface'])?util[_0xf294('0x91')](_0xf294('0x92'),_0x12b053[_0xf294('0x33')]):_0x12b053['interface'],'paused':_0x12b053[_0xf294('0x8c')]||![],'penalty':_0x5c9f86[_0xf294('0x86')][_0xf294('0x84')]},{'transaction':_0x59cb7f});});return Promise[_0xf294('0x93')](_0x380bdb);});});});return Promise[_0xf294('0x93')](_0x438dda);});return Promise[_0xf294('0x93')](_0x2364d3);})[_0xf294('0x46')](function(){return db[_0xf294('0x94')]['findOne']({'where':{'teamId':_0xcab192}})[_0xf294('0x46')](function(_0x46b8ff){if(_0x46b8ff){var _0x4f7a32=_[_0xf294('0x32')](_0x5dccd5,function(_0x2587d4){db[_0xf294('0x95')]['upsert']({'UserId':_0x2587d4,'VoicePrefixId':_0x46b8ff[_0xf294('0x6e')]});});return Promise[_0xf294('0x93')](_0x4f7a32);}});});});return Promise[_0xf294('0x93')](_0x2894a0)[_0xf294('0x46')](function(){return _0x3c2ee8[_0xf294('0x96')](_0x5dccd5,{'transaction':_0x59cb7f})[_0xf294('0x97')](function(_0x1b8cd5){return _0x1b8cd5;});});});}})['then'](respondWithResult(_0x273cff,null))[_0xf294('0x4b')](handleError(_0x273cff,null));};exports[_0xf294('0x98')]=function(_0x3c4eb3,_0x2a199d){var _0x1dc2fb=_['isArray'](_0x3c4eb3[_0xf294('0x34')][_0xf294('0x7b')])?_0x3c4eb3[_0xf294('0x34')][_0xf294('0x7b')]:[_0x3c4eb3['query'][_0xf294('0x7b')]];var _0x29323f=_0x3c4eb3[_0xf294('0x5a')]['id'];return db[_0xf294('0x2f')][_0xf294('0x4d')]({'where':{'id':_0x29323f}})['then'](handleEntityNotFound(_0x2a199d,null))[_0xf294('0x46')](function(_0x55f1ce){if(_0x55f1ce){var _0x33ac94=['Voice','Chat',_0xf294('0x7e'),'Sms','Fax',_0xf294('0x81'),_0xf294('0x82')];return db[_0xf294('0x5b')][_0xf294('0x83')](function(_0x47fa88){var _0x4846a4=_[_0xf294('0x32')](_0x33ac94,function(_0x18e2df){var _0x205616={'attributes':['id','name']};return _0x55f1ce[_0xf294('0x53')+_0x18e2df+_0xf294('0x77')](_0x205616)[_0xf294('0x46')](function(_0x22a153){var _0x1ab172=_[_0xf294('0x32')](_0x22a153,function(_0x58a082){return _0x58a082[_0xf294('0x98')](_0x1dc2fb,{'transaction':_0x47fa88})[_0xf294('0x46')](function(){var _0xd2050=_['map'](_0x1dc2fb,function(_0x447fee){socket['emit']('user'+_0x18e2df+_0xf294('0x99'),{'UserId':Number(_0x447fee),[_0x18e2df+_0xf294('0x85')]:_0x58a082['id']});if(_0x18e2df!==_0xf294('0x7d')){return;}return db[_0xf294('0x8e')]['destroy']({'where':{'VoiceQueueId':_0x58a082['id'],'UserId':_0x447fee},'transaction':_0x47fa88});});return Promise['all'](_0xd2050);});});return Promise[_0xf294('0x93')](_0x1ab172);});});return Promise[_0xf294('0x93')](_0x4846a4)[_0xf294('0x46')](function(){return _0x55f1ce[_0xf294('0x98')](_0x1dc2fb,{'transaction':_0x47fa88});})['then'](function(){return db[_0xf294('0x94')][_0xf294('0x71')]({'where':{'teamId':_0x29323f}})['then'](function(_0x2c8e2a){if(_0x2c8e2a){var _0x2c8fa0=_[_0xf294('0x32')](_0x1dc2fb,function(_0x145273){db['UserVoicePrefix'][_0xf294('0x59')]({'where':{'UserId':_0x145273,'VoicePrefixId':_0x2c8e2a[_0xf294('0x6e')]}});});return Promise['all'](_0x2c8fa0);}});});});}})[_0xf294('0x46')](respondWithStatusCode(_0x2a199d,null))[_0xf294('0x4b')](handleError(_0x2a199d,null));};exports[_0xf294('0x9a')]=function(_0x124742,_0x3df979,_0xa2a462){var _0x2224b1={};var _0x19e04b={};var _0xebc56c;var _0x19cc5a;return db[_0xf294('0x2f')][_0xf294('0x71')]({'where':{'id':_0x124742[_0xf294('0x5a')]['id']}})[_0xf294('0x46')](handleEntityNotFound(_0x3df979,null))[_0xf294('0x46')](function(_0x2a8768){if(_0x2a8768){_0xebc56c=_0x2a8768;_0x19e04b['model']=_['keys'](db[_0xf294('0x87')][_0xf294('0x30')]);_0x19e04b[_0xf294('0x34')]=_[_0xf294('0x35')](_0x124742[_0xf294('0x34')]);_0x19e04b['filters']=_['intersection'](_0x19e04b[_0xf294('0x38')],_0x19e04b[_0xf294('0x34')]);_0x2224b1[_0xf294('0x39')]=_[_0xf294('0x37')](_0x19e04b[_0xf294('0x38')],qs[_0xf294('0x3a')](_0x124742[_0xf294('0x34')][_0xf294('0x3a')]));_0x2224b1[_0xf294('0x39')]=_0x2224b1[_0xf294('0x39')][_0xf294('0x3b')]?_0x2224b1[_0xf294('0x39')]:_0x19e04b[_0xf294('0x38')];_0x2224b1[_0xf294('0x3e')]=qs[_0xf294('0x3f')](_0x124742[_0xf294('0x34')][_0xf294('0x3f')]);_0x2224b1['where']=qs['filters'](_[_0xf294('0x41')](_0x124742[_0xf294('0x34')],_0x19e04b[_0xf294('0x36')]));if(_0x124742['query']['filter']){_0x2224b1[_0xf294('0x40')]=_['merge'](_0x2224b1['where'],{'$or':_[_0xf294('0x32')](_0x2224b1[_0xf294('0x39')],function(_0x1b68c0){var _0x26540f={};_0x26540f[_0x1b68c0]={'$like':'%'+_0x124742[_0xf294('0x34')][_0xf294('0x42')]+'%'};return _0x26540f;})});}_0x2224b1=_[_0xf294('0x43')]({},_0x2224b1,_0x124742[_0xf294('0x45')]);return _0xebc56c[_0xf294('0x9a')](_0x2224b1);}})[_0xf294('0x46')](function(_0x4ef100){if(_0x4ef100){_0x19cc5a=_0x4ef100['length'];if(!_0x124742[_0xf294('0x34')][_0xf294('0x3c')](_0xf294('0x3d'))){_0x2224b1['limit']=qs[_0xf294('0x25')](_0x124742[_0xf294('0x34')][_0xf294('0x25')]);_0x2224b1[_0xf294('0x23')]=qs[_0xf294('0x23')](_0x124742[_0xf294('0x34')][_0xf294('0x23')]);}return _0xebc56c[_0xf294('0x9a')](_0x2224b1);}})[_0xf294('0x46')](function(_0xae353d){if(_0xae353d){return _0xae353d?{'count':_0x19cc5a,'rows':_0xae353d}:null;}})[_0xf294('0x46')](respondWithResult(_0x3df979,null))[_0xf294('0x4b')](handleError(_0x3df979,null));}; \ No newline at end of file +var _0x1062=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','defaults','redis','socket.io-emitter','./team.socket','register','sendStatus','end','json','undefined','count','offset','limit','status','Content-Range','apply','update','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','then','findAll','rows','params','include','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Teams','UserProfileSection','userProfileId','autoAssociation','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','QueryTypes','VoiceQueueId','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','channel','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','Queue','order','Queues','addQueues','findOne','ValidationError','add','remove','ids','addAgents','Voice','Chat','Mail','Fax','Openchannel','transaction','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','online','voicePause','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','spread','removeAgents','isArray','Sms','Whatsapp','emit','Queue:remove','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce'];(function(_0x1f465a,_0x1d03bb){var _0x56f67f=function(_0x47389a){while(--_0x47389a){_0x1f465a['push'](_0x1f465a['shift']());}};_0x56f67f(++_0x1d03bb);}(_0x1062,0x1b2));var _0x2106=function(_0xd2490,_0x23862a){_0xd2490=_0xd2490-0x0;var _0x401b12=_0x1062[_0xd2490];return _0x401b12;};'use strict';var emlformat=require(_0x2106('0x0'));var rimraf=require(_0x2106('0x1'));var zipdir=require(_0x2106('0x2'));var jsonpatch=require(_0x2106('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2106('0x4'));var Mustache=require(_0x2106('0x5'));var util=require(_0x2106('0x6'));var path=require(_0x2106('0x7'));var sox=require(_0x2106('0x8'));var csv=require(_0x2106('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2106('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2106('0xb'));var jsforce=require(_0x2106('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2106('0x9'));var querystring=require(_0x2106('0xd'));var Papa=require(_0x2106('0xe'));var Redis=require('ioredis');var authService=require(_0x2106('0xf'));var qs=require(_0x2106('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2106('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x2106('0x12'));var config=require(_0x2106('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x2106('0x14')](config[_0x2106('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x2106('0x16'))(new Redis(config[_0x2106('0x15')]));require(_0x2106('0x17'))[_0x2106('0x18')](socket);function respondWithStatusCode(_0x24c5a8,_0x3115b5){_0x3115b5=_0x3115b5||0xcc;return function(_0xf11632){if(_0xf11632){return _0x24c5a8[_0x2106('0x19')](_0x3115b5);}return _0x24c5a8['status'](_0x3115b5)[_0x2106('0x1a')]();};}function respondWithResult(_0x3fc8d0,_0x3c8b61){_0x3c8b61=_0x3c8b61||0xc8;return function(_0x35d255){if(_0x35d255){return _0x3fc8d0['status'](_0x3c8b61)[_0x2106('0x1b')](_0x35d255);}};}function respondWithFilteredResult(_0xec0ede,_0x8be3a3){return function(_0x52c0eb){if(_0x52c0eb){var _0x41eb54=typeof _0x8be3a3['offset']===_0x2106('0x1c')&&typeof _0x8be3a3['limit']===_0x2106('0x1c');var _0x4eed25=_0x52c0eb[_0x2106('0x1d')];var _0x2df7bf=_0x41eb54?0x0:_0x8be3a3[_0x2106('0x1e')];var _0xcc687=_0x41eb54?_0x52c0eb[_0x2106('0x1d')]:_0x8be3a3[_0x2106('0x1e')]+_0x8be3a3[_0x2106('0x1f')];var _0x374475;if(_0xcc687>=_0x4eed25){_0xcc687=_0x4eed25;_0x374475=0xc8;}else{_0x374475=0xce;}_0xec0ede[_0x2106('0x20')](_0x374475);return _0xec0ede['set'](_0x2106('0x21'),_0x2df7bf+'-'+_0xcc687+'/'+_0x4eed25)[_0x2106('0x1b')](_0x52c0eb);}return null;};}function patchUpdates(_0x4283de){return function(_0x3cdb3b){try{jsonpatch[_0x2106('0x22')](_0x3cdb3b,_0x4283de,!![]);}catch(_0x101133){return BPromise['reject'](_0x101133);}return _0x3cdb3b['save']();};}function saveUpdates(_0x742064,_0x4229a7){return function(_0x5091f6){if(_0x5091f6){return _0x5091f6[_0x2106('0x23')](_0x742064)['then'](function(_0x2c1471){return _0x2c1471;});}return null;};}function handleEntityNotFound(_0x1e6736,_0x12fc6b){return function(_0x431a10){if(!_0x431a10){_0x1e6736['sendStatus'](0x194);}return _0x431a10;};}function handleError(_0x5d887f,_0xd1468b){_0xd1468b=_0xd1468b||0x1f4;return function(_0x31c8a1){logger[_0x2106('0x24')](_0x31c8a1[_0x2106('0x25')]);if(_0x31c8a1[_0x2106('0x26')]){delete _0x31c8a1['name'];}_0x5d887f[_0x2106('0x20')](_0xd1468b)[_0x2106('0x27')](_0x31c8a1);};}exports[_0x2106('0x28')]=function(_0x2f718a,_0x13d6ec){var _0x413ce5={},_0x1985ac={},_0x45a96f={'count':0x0,'rows':[]};var _0x56c479=_[_0x2106('0x29')](db[_0x2106('0x2a')][_0x2106('0x2b')],function(_0x5927cd){return{'name':_0x5927cd[_0x2106('0x2c')],'type':_0x5927cd[_0x2106('0x2d')][_0x2106('0x2e')]};});_0x1985ac[_0x2106('0x2f')]=_[_0x2106('0x29')](_0x56c479,_0x2106('0x26'));_0x1985ac['query']=_[_0x2106('0x30')](_0x2f718a[_0x2106('0x31')]);_0x1985ac[_0x2106('0x32')]=_[_0x2106('0x33')](_0x1985ac[_0x2106('0x2f')],_0x1985ac[_0x2106('0x31')]);_0x413ce5['attributes']=_[_0x2106('0x33')](_0x1985ac['model'],qs[_0x2106('0x34')](_0x2f718a[_0x2106('0x31')]['fields']));_0x413ce5[_0x2106('0x35')]=_0x413ce5[_0x2106('0x35')][_0x2106('0x36')]?_0x413ce5[_0x2106('0x35')]:_0x1985ac[_0x2106('0x2f')];if(!_0x2f718a[_0x2106('0x31')]['hasOwnProperty'](_0x2106('0x37'))){_0x413ce5[_0x2106('0x1f')]=qs[_0x2106('0x1f')](_0x2f718a[_0x2106('0x31')][_0x2106('0x1f')]);_0x413ce5[_0x2106('0x1e')]=qs[_0x2106('0x1e')](_0x2f718a[_0x2106('0x31')]['offset']);}_0x413ce5['order']=qs['sort'](_0x2f718a[_0x2106('0x31')][_0x2106('0x38')]);_0x413ce5[_0x2106('0x39')]=qs[_0x2106('0x32')](_[_0x2106('0x3a')](_0x2f718a[_0x2106('0x31')],_0x1985ac[_0x2106('0x32')]),_0x56c479);if(_0x2f718a[_0x2106('0x31')][_0x2106('0x3b')]){_0x413ce5[_0x2106('0x39')]=_[_0x2106('0x3c')](_0x413ce5[_0x2106('0x39')],{'$or':_[_0x2106('0x29')](_0x56c479,function(_0x5c7a6b){if(_0x5c7a6b[_0x2106('0x2d')]!==_0x2106('0x3d')){var _0x4fcf4c={};_0x4fcf4c[_0x5c7a6b['name']]={'$like':'%'+_0x2f718a['query'][_0x2106('0x3b')]+'%'};return _0x4fcf4c;}})});}_0x413ce5=_[_0x2106('0x3c')]({},_0x413ce5,_0x2f718a[_0x2106('0x3e')]);var _0xa6ace2={'where':_0x413ce5['where']};return db[_0x2106('0x2a')][_0x2106('0x1d')](_0xa6ace2)[_0x2106('0x3f')](function(_0x871a8c){_0x45a96f['count']=_0x871a8c;if(_0x2f718a[_0x2106('0x31')]['includeAll']){_0x413ce5['include']=[{'all':!![]}];}return db[_0x2106('0x2a')][_0x2106('0x40')](_0x413ce5);})['then'](function(_0x3edeca){_0x45a96f[_0x2106('0x41')]=_0x3edeca;return _0x45a96f;})['then'](respondWithFilteredResult(_0x13d6ec,_0x413ce5))['catch'](handleError(_0x13d6ec,null));};exports['show']=function(_0x39fe35,_0x13c44a){var _0x499c0e={'raw':![],'where':{'id':_0x39fe35[_0x2106('0x42')]['id']}},_0x64f1d5={};_0x64f1d5[_0x2106('0x2f')]=_['keys'](db[_0x2106('0x2a')][_0x2106('0x2b')]);_0x64f1d5[_0x2106('0x31')]=_[_0x2106('0x30')](_0x39fe35[_0x2106('0x31')]);_0x64f1d5[_0x2106('0x32')]=_[_0x2106('0x33')](_0x64f1d5[_0x2106('0x2f')],_0x64f1d5[_0x2106('0x31')]);_0x499c0e['attributes']=_[_0x2106('0x33')](_0x64f1d5['model'],qs['fields'](_0x39fe35[_0x2106('0x31')][_0x2106('0x34')]));_0x499c0e[_0x2106('0x35')]=_0x499c0e[_0x2106('0x35')][_0x2106('0x36')]?_0x499c0e[_0x2106('0x35')]:_0x64f1d5[_0x2106('0x2f')];if(_0x39fe35[_0x2106('0x31')]['includeAll']){_0x499c0e[_0x2106('0x43')]=[{'all':!![]}];}_0x499c0e=_['merge']({},_0x499c0e,_0x39fe35['options']);return db['Team'][_0x2106('0x44')](_0x499c0e)['then'](handleEntityNotFound(_0x13c44a,null))[_0x2106('0x3f')](respondWithResult(_0x13c44a,null))[_0x2106('0x45')](handleError(_0x13c44a,null));};exports[_0x2106('0x46')]=function(_0x1ffcff,_0x82f40){return db[_0x2106('0x2a')][_0x2106('0x46')](_0x1ffcff[_0x2106('0x47')],{})['then'](function(_0x1023a1){var _0x5ad964=_0x1ffcff['user'][_0x2106('0x48')]({'plain':!![]});if(!_0x5ad964)throw new Error(_0x2106('0x49'));if(_0x5ad964['role']===_0x2106('0x4a')){var _0x339b5a=_0x1023a1[_0x2106('0x48')]({'plain':!![]});var _0x18d2a8=_0x2106('0x4b');return db[_0x2106('0x4c')]['find']({'where':{'name':_0x18d2a8,'userProfileId':_0x5ad964[_0x2106('0x4d')]},'raw':!![]})[_0x2106('0x3f')](function(_0x1864d2){if(_0x1864d2&&_0x1864d2[_0x2106('0x4e')]===0x0){return db['UserProfileResource'][_0x2106('0x46')]({'name':_0x339b5a[_0x2106('0x26')],'resourceId':_0x339b5a['id'],'type':_0x1864d2[_0x2106('0x26')],'sectionId':_0x1864d2['id']},{})[_0x2106('0x3f')](function(){return _0x1023a1;});}else{return _0x1023a1;}})[_0x2106('0x45')](function(_0x282250){logger[_0x2106('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x282250);throw _0x282250;});}return _0x1023a1;})[_0x2106('0x3f')](respondWithResult(_0x82f40,0xc9))[_0x2106('0x45')](handleError(_0x82f40,null));};exports[_0x2106('0x23')]=function(_0x2b5846,_0x21dda2){if(_0x2b5846['body']['id']){delete _0x2b5846[_0x2106('0x47')]['id'];}return db['Team'][_0x2106('0x44')]({'where':{'id':_0x2b5846[_0x2106('0x42')]['id']}})['then'](handleEntityNotFound(_0x21dda2,null))[_0x2106('0x3f')](saveUpdates(_0x2b5846[_0x2106('0x47')],null))[_0x2106('0x3f')](respondWithResult(_0x21dda2,null))[_0x2106('0x45')](handleError(_0x21dda2,null));};exports[_0x2106('0x4f')]=function(_0x127281,_0x36a705){var _0x1cc53b=_0x127281[_0x2106('0x42')]['id'];var _0x54a8e0=[];return db[_0x2106('0x50')]['transaction'](function(_0x14fad0){var _0x2ae480=_0x2106('0x51')+_0x1cc53b;return db[_0x2106('0x50')][_0x2106('0x31')](_0x2ae480,{'type':db[_0x2106('0x52')]['QueryTypes'][_0x2106('0x53')],'raw':!![],'transaction':_0x14fad0})[_0x2106('0x3f')](function(_0x2bbc74){_0x54a8e0=_[_0x2106('0x29')](_0x2bbc74,function(_0x4170f7){return Number(_0x4170f7['UserId']);});})['then'](function(){var _0xaa0f22='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1cc53b;return db[_0x2106('0x50')][_0x2106('0x31')](_0xaa0f22,{'type':db[_0x2106('0x52')][_0x2106('0x54')][_0x2106('0x53')],'raw':!![],'transaction':_0x14fad0});})[_0x2106('0x3f')](function(_0x4f4b98){var _0x4d36f5=_[_0x2106('0x29')](_0x4f4b98,function(_0x2b7d15){return Number(_0x2b7d15[_0x2106('0x55')]);});return db['UserVoiceQueue'][_0x2106('0x4f')]({'where':{'UserId':{'$in':_0x54a8e0},'VoiceQueueId':{'$in':_0x4d36f5}},'transaction':_0x14fad0});})['then'](function(){var _0x1ab23a='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1cc53b;return db[_0x2106('0x50')]['query'](_0x1ab23a,{'type':db[_0x2106('0x52')][_0x2106('0x54')][_0x2106('0x53')],'raw':!![],'transaction':_0x14fad0});})[_0x2106('0x3f')](function(_0x51115b){var _0x14e0be=_[_0x2106('0x29')](_0x51115b,function(_0x40a881){return Number(_0x40a881[_0x2106('0x56')]);});return db[_0x2106('0x57')][_0x2106('0x4f')]({'where':{'UserId':{'$in':_0x54a8e0},'MailQueueId':{'$in':_0x14e0be}},'transaction':_0x14fad0});})['then'](function(){var _0x4d4d40=_0x2106('0x58')+_0x1cc53b;return db[_0x2106('0x50')][_0x2106('0x31')](_0x4d4d40,{'type':db[_0x2106('0x52')][_0x2106('0x54')][_0x2106('0x53')],'raw':!![],'transaction':_0x14fad0});})[_0x2106('0x3f')](function(_0x18045d){var _0x4608f2=_['map'](_0x18045d,function(_0xb70351){return Number(_0xb70351[_0x2106('0x59')]);});return db[_0x2106('0x5a')][_0x2106('0x4f')]({'where':{'UserId':{'$in':_0x54a8e0},'SmsQueueId':{'$in':_0x4608f2}},'transaction':_0x14fad0});})[_0x2106('0x3f')](function(){var _0x1aabca=_0x2106('0x5b')+_0x1cc53b;return db[_0x2106('0x50')][_0x2106('0x31')](_0x1aabca,{'type':db[_0x2106('0x52')]['QueryTypes'][_0x2106('0x53')],'raw':!![],'transaction':_0x14fad0});})[_0x2106('0x3f')](function(_0x38fe00){var _0x7bceb=_[_0x2106('0x29')](_0x38fe00,function(_0x14eebd){return Number(_0x14eebd[_0x2106('0x5c')]);});return db[_0x2106('0x5d')][_0x2106('0x4f')]({'where':{'UserId':{'$in':_0x54a8e0},'ChatQueueId':{'$in':_0x7bceb}},'transaction':_0x14fad0});})['then'](function(){var _0x543b90=_0x2106('0x5e')+_0x1cc53b;return db['sequelize']['query'](_0x543b90,{'type':db[_0x2106('0x52')][_0x2106('0x54')]['SELECT'],'raw':!![],'transaction':_0x14fad0});})[_0x2106('0x3f')](function(_0x869e34){var _0x5ae3b4=_['map'](_0x869e34,function(_0x4f2b54){return Number(_0x4f2b54[_0x2106('0x5f')]);});return db['UserFaxQueue'][_0x2106('0x4f')]({'where':{'UserId':{'$in':_0x54a8e0},'FaxQueueId':{'$in':_0x5ae3b4}},'transaction':_0x14fad0});})[_0x2106('0x3f')](function(){var _0xcc1370=_0x2106('0x60')+_0x1cc53b;return db[_0x2106('0x50')][_0x2106('0x31')](_0xcc1370,{'type':db[_0x2106('0x52')]['QueryTypes'][_0x2106('0x53')],'raw':!![],'transaction':_0x14fad0});})[_0x2106('0x3f')](function(_0x150698){var _0xb476e0=_[_0x2106('0x29')](_0x150698,function(_0x599ad4){return Number(_0x599ad4[_0x2106('0x61')]);});return db[_0x2106('0x62')][_0x2106('0x4f')]({'where':{'UserId':{'$in':_0x54a8e0},'OpenchannelQueueId':{'$in':_0xb476e0}},'transaction':_0x14fad0});})[_0x2106('0x3f')](function(){var _0xca8705=_0x2106('0x63')+_0x1cc53b;return db['sequelize'][_0x2106('0x31')](_0xca8705,{'type':db[_0x2106('0x52')][_0x2106('0x54')][_0x2106('0x53')],'raw':!![],'transaction':_0x14fad0});})[_0x2106('0x3f')](function(_0xd22e15){var _0x30f69e=_[_0x2106('0x29')](_0xd22e15,function(_0xd0915d){return Number(_0xd0915d[_0x2106('0x64')]);});return db[_0x2106('0x65')][_0x2106('0x4f')]({'where':{'UserId':{'$in':_0x54a8e0},'WhatsappQueueId':{'$in':_0x30f69e}},'transaction':_0x14fad0});})[_0x2106('0x3f')](function(){return db[_0x2106('0x66')][_0x2106('0x44')]({'where':{'TeamId':_0x1cc53b}});})['then'](function(_0x3d03af){if(_0x3d03af===null){return;}return db[_0x2106('0x67')][_0x2106('0x4f')]({'where':{'UserId':{'$in':_0x54a8e0},'VoicePrefixId':_0x3d03af[_0x2106('0x68')]},'transaction':_0x14fad0});})['then'](function(){return db[_0x2106('0x2a')][_0x2106('0x4f')]({'where':{'id':_0x1cc53b},'cascade':!![],'transaction':_0x14fad0});})[_0x2106('0x3f')](function(_0x365e68){if(_0x365e68===0x0){_0x36a705[_0x2106('0x19')](0x194);}else{return db['UserProfileResource'][_0x2106('0x4f')]({'where':{'type':_0x2106('0x4b'),'resourceId':_0x1cc53b},'cascade':!![],'transaction':_0x14fad0})[_0x2106('0x3f')](function(){_0x36a705[_0x2106('0x20')](0xcc)['end']();});}})[_0x2106('0x45')](function(_0x123d11){_0x36a705['status'](0x1f4)['send'](_0x123d11);});});};exports[_0x2106('0x69')]=function(_0x1fd22e,_0x383964,_0x13b95c){return db[_0x2106('0x2a')]['findOne']({'where':{'id':_0x1fd22e[_0x2106('0x42')]['id']}})[_0x2106('0x3f')](handleEntityNotFound(_0x383964,null))[_0x2106('0x3f')](function(_0x5864d5){if(!_0x1fd22e['query'][_0x2106('0x6a')]||!utils[_0x2106('0x6b')](_0x1fd22e[_0x2106('0x31')]['channel'])){throw new db[(_0x2106('0x52'))]['ValidationError'](_0x2106('0x6c'));}var _0x466704={};var _0x117323={};_0x117323[_0x2106('0x2f')]=_['keys'](db[_[_0x2106('0x6d')](_0x1fd22e[_0x2106('0x31')][_0x2106('0x6a')][_0x2106('0x6e')]())+_0x2106('0x6f')][_0x2106('0x2b')]);_0x117323[_0x2106('0x31')]=_['keys'](_0x1fd22e[_0x2106('0x31')]);_0x117323[_0x2106('0x32')]=_[_0x2106('0x33')](_0x117323[_0x2106('0x2f')],_0x117323['query']);_0x466704[_0x2106('0x35')]=_[_0x2106('0x33')](_0x117323[_0x2106('0x2f')],qs[_0x2106('0x34')](_0x1fd22e[_0x2106('0x31')][_0x2106('0x34')]));_0x466704['attributes']=_0x466704[_0x2106('0x35')][_0x2106('0x36')]?_0x466704[_0x2106('0x35')]:_0x117323[_0x2106('0x2f')];_0x466704['limit']=qs['limit'](_0x1fd22e[_0x2106('0x31')]['limit']);_0x466704[_0x2106('0x1e')]=qs['offset'](_0x1fd22e[_0x2106('0x31')][_0x2106('0x1e')]);_0x466704[_0x2106('0x70')]=qs[_0x2106('0x38')](_0x1fd22e[_0x2106('0x31')][_0x2106('0x38')]);_0x466704[_0x2106('0x39')]=qs['filters'](_[_0x2106('0x3a')](_0x1fd22e[_0x2106('0x31')],_0x117323[_0x2106('0x32')]));_0x466704=_[_0x2106('0x3c')]({},_0x466704,_0x1fd22e[_0x2106('0x3e')]);return _0x5864d5[_0x2106('0x48')+_['capitalize'](_0x1fd22e[_0x2106('0x31')][_0x2106('0x6a')][_0x2106('0x6e')]())+_0x2106('0x71')](_0x466704);})['then'](respondWithResult(_0x383964,null))[_0x2106('0x45')](handleError(_0x383964,null));};exports[_0x2106('0x72')]=function(_0x5b9bcf,_0xb6db38,_0x3de57f){return db[_0x2106('0x2a')][_0x2106('0x73')]({'where':{'id':_0x5b9bcf[_0x2106('0x42')]['id']}})[_0x2106('0x3f')](function(_0x1aeee9){if(_0x1aeee9){if(!_0x5b9bcf['body'][_0x2106('0x6a')]||!utils[_0x2106('0x6b')](_0x5b9bcf[_0x2106('0x47')]['channel'])){throw new db[(_0x2106('0x52'))][(_0x2106('0x74'))](_0x2106('0x6c'));}return _0x1aeee9[_0x2106('0x75')+_[_0x2106('0x6d')](_0x5b9bcf[_0x2106('0x47')][_0x2106('0x6a')]['toLowerCase']())+_0x2106('0x71')](_0x5b9bcf[_0x2106('0x47')]['ids']);}return null;})[_0x2106('0x3f')](handleEntityNotFound(_0xb6db38,null))[_0x2106('0x3f')](respondWithStatusCode(_0xb6db38,null))[_0x2106('0x45')](handleError(_0xb6db38,null));};exports['removeQueues']=function(_0x2ffc32,_0x38b6d1,_0xd16561){return db['Team']['findOne']({'where':{'id':_0x2ffc32[_0x2106('0x42')]['id']}})['then'](function(_0x2e868d){if(_0x2e868d){if(!_0x2ffc32[_0x2106('0x31')][_0x2106('0x6a')]||!utils['isValidChannel'](_0x2ffc32[_0x2106('0x31')][_0x2106('0x6a')])){throw new db[(_0x2106('0x52'))][(_0x2106('0x74'))](_0x2106('0x6c'));}return _0x2e868d[_0x2106('0x76')+_[_0x2106('0x6d')](_0x2ffc32['query'][_0x2106('0x6a')][_0x2106('0x6e')]())+_0x2106('0x71')](_0x2ffc32[_0x2106('0x31')][_0x2106('0x77')]);}return null;})[_0x2106('0x3f')](handleEntityNotFound(_0x38b6d1,null))[_0x2106('0x3f')](respondWithStatusCode(_0x38b6d1,null))[_0x2106('0x45')](handleError(_0x38b6d1,null));};exports[_0x2106('0x78')]=function(_0x54addd,_0x5aa553){var _0x1942e8=_['isArray'](_0x54addd[_0x2106('0x47')][_0x2106('0x77')])?_0x54addd['body'][_0x2106('0x77')]:[_0x54addd[_0x2106('0x47')][_0x2106('0x77')]];var _0x141392=_0x54addd[_0x2106('0x42')]['id'];return db[_0x2106('0x2a')][_0x2106('0x44')]({'where':{'id':_0x141392}})[_0x2106('0x3f')](handleEntityNotFound(_0x5aa553,null))[_0x2106('0x3f')](function(_0x2431ed){if(_0x2431ed){var _0xd80c0c=[_0x2106('0x79'),_0x2106('0x7a'),_0x2106('0x7b'),'Sms',_0x2106('0x7c'),_0x2106('0x7d'),'Whatsapp'];return db['sequelize'][_0x2106('0x7e')](function(_0x51c2ae){var _0x4fae37=_[_0x2106('0x29')](_0xd80c0c,function(_0x6a044a){var _0x28a2ec={'attributes':['id','name']};if(_0x6a044a===_0x2106('0x79')){_0x28a2ec['through']={'attributes':[_0x2106('0x7f')]};}return _0x2431ed[_0x2106('0x48')+_0x6a044a+_0x2106('0x71')](_0x28a2ec)['then'](function(_0x4dbcaa){var _0x4fc565=_[_0x2106('0x29')](_0x4dbcaa,function(_0x45ebd7){var _0x41650d=_[_0x2106('0x29')](_0x1942e8,function(_0x109c5b){var _0x5da2b6={'where':{'UserId':_0x109c5b,[_0x6a044a+_0x2106('0x80')]:_0x45ebd7['id']},'transaction':_0x51c2ae};if(_0x6a044a===_0x2106('0x79')){_0x5da2b6['defaults']={'penalty':_0x45ebd7[_0x2106('0x81')][_0x2106('0x7f')]};}return db[_0x2106('0x82')+_0x6a044a+_0x2106('0x6f')][_0x2106('0x83')](_0x5da2b6)[_0x2106('0x3f')](function(){socket['emit']('user'+_0x6a044a+'Queue:save',{'UserId':_0x109c5b,[_0x6a044a+_0x2106('0x80')]:_0x45ebd7['id']});if(_0x6a044a!==_0x2106('0x79')){return;}return db[_0x2106('0x82')][_0x2106('0x40')]({'where':{'id':_0x1942e8,'online':0x1},'attributes':['id',_0x2106('0x26'),_0x2106('0x84'),_0x2106('0x85'),'interface'],'raw':!![]})[_0x2106('0x3f')](function(_0x23faef){var _0x3ba5d3=_[_0x2106('0x29')](_0x23faef,function(_0x4a54e5){return db[_0x2106('0x86')][_0x2106('0x87')]({'membername':_0x4a54e5['name'],'UserId':_0x4a54e5['id'],'queue_name':_0x45ebd7[_0x2106('0x26')],'VoiceQueueId':_0x45ebd7['id'],'interface':_[_0x2106('0x88')](_0x4a54e5['interface'])?util[_0x2106('0x89')](_0x2106('0x8a'),_0x4a54e5[_0x2106('0x26')]):_0x4a54e5['interface'],'paused':_0x4a54e5['voicePause']||![],'penalty':_0x45ebd7[_0x2106('0x81')][_0x2106('0x7f')]},{'transaction':_0x51c2ae});});return Promise['all'](_0x3ba5d3);});});});return Promise[_0x2106('0x8b')](_0x41650d);});return Promise['all'](_0x4fc565);})[_0x2106('0x3f')](function(){return db[_0x2106('0x66')][_0x2106('0x73')]({'where':{'teamId':_0x141392}})[_0x2106('0x3f')](function(_0xbd34b2){if(_0xbd34b2){var _0x3900c5=_[_0x2106('0x29')](_0x1942e8,function(_0x4d9bdf){db[_0x2106('0x67')][_0x2106('0x87')]({'UserId':_0x4d9bdf,'VoicePrefixId':_0xbd34b2[_0x2106('0x68')]});});return Promise[_0x2106('0x8b')](_0x3900c5);}});});});return Promise[_0x2106('0x8b')](_0x4fae37)[_0x2106('0x3f')](function(){return _0x2431ed[_0x2106('0x78')](_0x1942e8,{'transaction':_0x51c2ae})[_0x2106('0x8c')](function(_0x5eff6b){return _0x5eff6b;});});});}})[_0x2106('0x3f')](respondWithResult(_0x5aa553,null))['catch'](handleError(_0x5aa553,null));};exports[_0x2106('0x8d')]=function(_0x2bca10,_0x1eedd1){var _0x2432c8=_[_0x2106('0x8e')](_0x2bca10[_0x2106('0x31')][_0x2106('0x77')])?_0x2bca10[_0x2106('0x31')][_0x2106('0x77')]:[_0x2bca10[_0x2106('0x31')][_0x2106('0x77')]];var _0x1af6f4=_0x2bca10[_0x2106('0x42')]['id'];return db[_0x2106('0x2a')][_0x2106('0x44')]({'where':{'id':_0x1af6f4}})['then'](handleEntityNotFound(_0x1eedd1,null))['then'](function(_0x5edf75){if(_0x5edf75){var _0x3472b9=[_0x2106('0x79'),_0x2106('0x7a'),_0x2106('0x7b'),_0x2106('0x8f'),'Fax',_0x2106('0x7d'),_0x2106('0x90')];return db['sequelize'][_0x2106('0x7e')](function(_0x3d7a77){var _0x3cffd4=_[_0x2106('0x29')](_0x3472b9,function(_0x19ae1d){var _0x1b61fa={'attributes':['id',_0x2106('0x26')]};return _0x5edf75[_0x2106('0x48')+_0x19ae1d+_0x2106('0x71')](_0x1b61fa)[_0x2106('0x3f')](function(_0x15744a){var _0x3d4e9d=_[_0x2106('0x29')](_0x15744a,function(_0x2e710d){return _0x2e710d[_0x2106('0x8d')](_0x2432c8,{'transaction':_0x3d7a77})[_0x2106('0x3f')](function(){var _0x5fd224=_[_0x2106('0x29')](_0x2432c8,function(_0x5d4d31){socket[_0x2106('0x91')]('user'+_0x19ae1d+_0x2106('0x92'),{'UserId':Number(_0x5d4d31),[_0x19ae1d+'QueueId']:_0x2e710d['id']});if(_0x19ae1d!==_0x2106('0x79')){return;}return db[_0x2106('0x86')][_0x2106('0x4f')]({'where':{'VoiceQueueId':_0x2e710d['id'],'UserId':_0x5d4d31},'transaction':_0x3d7a77});});return Promise[_0x2106('0x8b')](_0x5fd224);});});return Promise[_0x2106('0x8b')](_0x3d4e9d);});});return Promise[_0x2106('0x8b')](_0x3cffd4)['then'](function(){return _0x5edf75[_0x2106('0x8d')](_0x2432c8,{'transaction':_0x3d7a77});})[_0x2106('0x3f')](function(){return db[_0x2106('0x66')][_0x2106('0x73')]({'where':{'teamId':_0x1af6f4}})['then'](function(_0x5f32d4){if(_0x5f32d4){var _0x17caf5=_['map'](_0x2432c8,function(_0xe9a2b7){db[_0x2106('0x67')][_0x2106('0x4f')]({'where':{'UserId':_0xe9a2b7,'VoicePrefixId':_0x5f32d4[_0x2106('0x68')]}});});return Promise[_0x2106('0x8b')](_0x17caf5);}});});});}})['then'](respondWithStatusCode(_0x1eedd1,null))['catch'](handleError(_0x1eedd1,null));};exports[_0x2106('0x93')]=function(_0x4cc250,_0x43575b,_0x2b715c){var _0x22ea93={};var _0x46149d={};var _0x2c0ffc;var _0x5cf93f;return db['Team'][_0x2106('0x73')]({'where':{'id':_0x4cc250[_0x2106('0x42')]['id']}})[_0x2106('0x3f')](handleEntityNotFound(_0x43575b,null))[_0x2106('0x3f')](function(_0x2a651a){if(_0x2a651a){_0x2c0ffc=_0x2a651a;_0x46149d['model']=_[_0x2106('0x30')](db['User'][_0x2106('0x2b')]);_0x46149d[_0x2106('0x31')]=_[_0x2106('0x30')](_0x4cc250['query']);_0x46149d[_0x2106('0x32')]=_[_0x2106('0x33')](_0x46149d[_0x2106('0x2f')],_0x46149d[_0x2106('0x31')]);_0x22ea93[_0x2106('0x35')]=_[_0x2106('0x33')](_0x46149d['model'],qs[_0x2106('0x34')](_0x4cc250[_0x2106('0x31')]['fields']));_0x22ea93['attributes']=_0x22ea93[_0x2106('0x35')]['length']?_0x22ea93[_0x2106('0x35')]:_0x46149d[_0x2106('0x2f')];_0x22ea93['order']=qs[_0x2106('0x38')](_0x4cc250[_0x2106('0x31')][_0x2106('0x38')]);_0x22ea93[_0x2106('0x39')]=qs['filters'](_[_0x2106('0x3a')](_0x4cc250[_0x2106('0x31')],_0x46149d[_0x2106('0x32')]));if(_0x4cc250[_0x2106('0x31')][_0x2106('0x3b')]){_0x22ea93[_0x2106('0x39')]=_['merge'](_0x22ea93[_0x2106('0x39')],{'$or':_[_0x2106('0x29')](_0x22ea93[_0x2106('0x35')],function(_0x4dcf53){var _0x4e6bee={};_0x4e6bee[_0x4dcf53]={'$like':'%'+_0x4cc250[_0x2106('0x31')][_0x2106('0x3b')]+'%'};return _0x4e6bee;})});}_0x22ea93=_[_0x2106('0x3c')]({},_0x22ea93,_0x4cc250[_0x2106('0x3e')]);return _0x2c0ffc[_0x2106('0x93')](_0x22ea93);}})[_0x2106('0x3f')](function(_0x486ced){if(_0x486ced){_0x5cf93f=_0x486ced[_0x2106('0x36')];if(!_0x4cc250['query'][_0x2106('0x94')](_0x2106('0x37'))){_0x22ea93[_0x2106('0x1f')]=qs['limit'](_0x4cc250[_0x2106('0x31')]['limit']);_0x22ea93['offset']=qs['offset'](_0x4cc250[_0x2106('0x31')]['offset']);}return _0x2c0ffc[_0x2106('0x93')](_0x22ea93);}})['then'](function(_0x274cb5){if(_0x274cb5){return _0x274cb5?{'count':_0x5cf93f,'rows':_0x274cb5}:null;}})[_0x2106('0x3f')](respondWithResult(_0x43575b,null))[_0x2106('0x45')](handleError(_0x43575b,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index f95d9a1..888e916 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 _0x67f8=['exports','events','../../mysqldb','Team','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x40db3c,_0xc79c1c){var _0x27ac19=function(_0x5f130f){while(--_0x5f130f){_0x40db3c['push'](_0x40db3c['shift']());}};_0x27ac19(++_0xc79c1c);}(_0x67f8,0x105));var _0x867f=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x67f8[_0x432fca];return _0x3adba4;};'use strict';var EventEmitter=require(_0x867f('0x0'));var Team=require(_0x867f('0x1'))['db'][_0x867f('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x867f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x867f('0x4'),'afterDestroy':_0x867f('0x5')};function emitEvent(_0x56d87a){return function(_0x3a0425,_0x4b4e0d,_0x38f7bd){TeamEvents[_0x867f('0x6')](_0x56d87a+':'+_0x3a0425['id'],_0x3a0425);TeamEvents['emit'](_0x56d87a,_0x3a0425);_0x38f7bd(null);};}for(var e in events){if(events[_0x867f('0x7')](e)){var event=events[e];Team[_0x867f('0x8')](e,emitEvent(event));}}module[_0x867f('0x9')]=TeamEvents; \ No newline at end of file +var _0x3e0c=['hasOwnProperty','hook','exports','events','Team','setMaxListeners','save','remove','emit'];(function(_0x2473b8,_0x8fb948){var _0x458e3e=function(_0x1e9ba6){while(--_0x1e9ba6){_0x2473b8['push'](_0x2473b8['shift']());}};_0x458e3e(++_0x8fb948);}(_0x3e0c,0xe4));var _0xc3e0=function(_0x2bac49,_0x3ae389){_0x2bac49=_0x2bac49-0x0;var _0x183acc=_0x3e0c[_0x2bac49];return _0x183acc;};'use strict';var EventEmitter=require(_0xc3e0('0x0'));var Team=require('../../mysqldb')['db'][_0xc3e0('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xc3e0('0x2')](0x0);var events={'afterCreate':_0xc3e0('0x3'),'afterUpdate':'update','afterDestroy':_0xc3e0('0x4')};function emitEvent(_0xefccc3){return function(_0x28fb43,_0x1d16a0,_0x472332){TeamEvents['emit'](_0xefccc3+':'+_0x28fb43['id'],_0x28fb43);TeamEvents[_0xc3e0('0x5')](_0xefccc3,_0x28fb43);_0x472332(null);};}for(var e in events){if(events[_0xc3e0('0x6')](e)){var event=events[e];Team[_0xc3e0('0x7')](e,emitEvent(event));}}module[_0xc3e0('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 0ac7b97..a8c6b95 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 _0x972f=['bluebird','request-promise','path','../../config/environment','./team.attributes','exports','define','Team','teams','lodash','util','api'];(function(_0xb24fad,_0xd58756){var _0x173226=function(_0x33b4d6){while(--_0x33b4d6){_0xb24fad['push'](_0xb24fad['shift']());}};_0x173226(++_0xd58756);}(_0x972f,0xd5));var _0xf972=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x972f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf972('0x0'));var util=require(_0xf972('0x1'));var logger=require('../../config/logger')(_0xf972('0x2'));var moment=require('moment');var BPromise=require(_0xf972('0x3'));var rp=require(_0xf972('0x4'));var fs=require('fs');var path=require(_0xf972('0x5'));var rimraf=require('rimraf');var config=require(_0xf972('0x6'));var attributes=require(_0xf972('0x7'));module[_0xf972('0x8')]=function(_0x374863,_0x587bd2){return _0x374863[_0xf972('0x9')](_0xf972('0xa'),attributes,{'tableName':_0xf972('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc038=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./team.attributes','define','Team','teams','lodash'];(function(_0x150734,_0x3090bc){var _0x2f9e53=function(_0x49f08b){while(--_0x49f08b){_0x150734['push'](_0x150734['shift']());}};_0x2f9e53(++_0x3090bc);}(_0xc038,0x1b9));var _0x8c03=function(_0x501e4b,_0x55473a){_0x501e4b=_0x501e4b-0x0;var _0x2259e2=_0xc038[_0x501e4b];return _0x2259e2;};'use strict';var _=require(_0x8c03('0x0'));var util=require(_0x8c03('0x1'));var logger=require(_0x8c03('0x2'))(_0x8c03('0x3'));var moment=require('moment');var BPromise=require(_0x8c03('0x4'));var rp=require(_0x8c03('0x5'));var fs=require('fs');var path=require(_0x8c03('0x6'));var rimraf=require(_0x8c03('0x7'));var config=require(_0x8c03('0x8'));var attributes=require(_0x8c03('0x9'));module['exports']=function(_0x2bec04,_0x678587){return _0x2bec04[_0x8c03('0xa')](_0x8c03('0xb'),attributes,{'tableName':_0x8c03('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 99e3113..a205df8 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 _0x1d65=['error','code','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','info','Team,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1d65,0xad));var _0x51d6=function(_0x513eb9,_0x17286a){_0x513eb9=_0x513eb9-0x0;var _0x58591a=_0x1d65[_0x513eb9];return _0x58591a;};'use strict';var _=require('lodash');var util=require(_0x51d6('0x0'));var moment=require(_0x51d6('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x51d6('0x2'))['db'];var utils=require(_0x51d6('0x3'));var logger=require(_0x51d6('0x4'))('rpc');var config=require(_0x51d6('0x5'));var jayson=require(_0x51d6('0x6'));var client=jayson['client'][_0x51d6('0x7')]({'port':0x232a});config[_0x51d6('0x8')]=_[_0x51d6('0x9')](config[_0x51d6('0x8')],{'host':_0x51d6('0xa'),'port':0x18eb});var socket=require(_0x51d6('0xb'))(new Redis(config[_0x51d6('0x8')]));require(_0x51d6('0xc'))[_0x51d6('0xd')](socket);function respondWithRpcPromise(_0x584703,_0x416116,_0x553bc6){return new BPromise(function(_0x367cdd,_0x547d5e){return client[_0x51d6('0xe')](_0x584703,_0x553bc6)['then'](function(_0x4c1738){logger[_0x51d6('0xf')](_0x51d6('0x10'),_0x416116,'request\x20sent');logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x416116,_0x51d6('0x11'),JSON[_0x51d6('0x12')](_0x4c1738));if(_0x4c1738[_0x51d6('0x13')]){if(_0x4c1738[_0x51d6('0x13')][_0x51d6('0x14')]===0x1f4){logger[_0x51d6('0x13')](_0x51d6('0x10'),_0x416116,_0x4c1738[_0x51d6('0x13')]['message']);return _0x547d5e(_0x4c1738[_0x51d6('0x13')][_0x51d6('0x15')]);}logger['error']('Team,\x20%s,\x20%s',_0x416116,_0x4c1738['error'][_0x51d6('0x15')]);return _0x367cdd(_0x4c1738['error'][_0x51d6('0x15')]);}else{logger[_0x51d6('0xf')](_0x51d6('0x10'),_0x416116,_0x51d6('0x11'));_0x367cdd(_0x4c1738[_0x51d6('0x16')]['message']);}})[_0x51d6('0x17')](function(_0xc680b6){logger['error'](_0x51d6('0x10'),_0x416116,_0xc680b6);_0x547d5e(_0xc680b6);});});} \ No newline at end of file +var _0x4472=['./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','redis','localhost','socket.io-emitter'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4472,0x7a));var _0x2447=function(_0x5d31ec,_0x5a5854){_0x5d31ec=_0x5d31ec-0x0;var _0xf04617=_0x4472[_0x5d31ec];return _0xf04617;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2447('0x0'));var BPromise=require('bluebird');var rs=require(_0x2447('0x1'));var fs=require('fs');var Redis=require(_0x2447('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2447('0x3'));var logger=require(_0x2447('0x4'))('rpc');var config=require(_0x2447('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2447('0x6')]({'port':0x232a});config[_0x2447('0x7')]=_['defaults'](config[_0x2447('0x7')],{'host':_0x2447('0x8'),'port':0x18eb});var socket=require(_0x2447('0x9'))(new Redis(config[_0x2447('0x7')]));require(_0x2447('0xa'))[_0x2447('0xb')](socket);function respondWithRpcPromise(_0x2b0e39,_0x352b14,_0x2e0acd){return new BPromise(function(_0x2d3865,_0x2d7fab){return client[_0x2447('0xc')](_0x2b0e39,_0x2e0acd)[_0x2447('0xd')](function(_0x553a97){logger[_0x2447('0xe')](_0x2447('0xf'),_0x352b14,_0x2447('0x10'));logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x352b14,'request\x20sent',JSON[_0x2447('0x11')](_0x553a97));if(_0x553a97[_0x2447('0x12')]){if(_0x553a97['error']['code']===0x1f4){logger[_0x2447('0x12')](_0x2447('0xf'),_0x352b14,_0x553a97[_0x2447('0x12')][_0x2447('0x13')]);return _0x2d7fab(_0x553a97['error'][_0x2447('0x13')]);}logger[_0x2447('0x12')]('Team,\x20%s,\x20%s',_0x352b14,_0x553a97['error']['message']);return _0x2d3865(_0x553a97[_0x2447('0x12')]['message']);}else{logger[_0x2447('0xe')](_0x2447('0xf'),_0x352b14,_0x2447('0x10'));_0x2d3865(_0x553a97[_0x2447('0x14')][_0x2447('0x13')]);}})[_0x2447('0x15')](function(_0x188c01){logger[_0x2447('0x12')](_0x2447('0xf'),_0x352b14,_0x188c01);_0x2d7fab(_0x188c01);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index fa8e502..4b95f71 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 _0x79ad=['team:','./team.events','update','emit','length'];(function(_0x5ba27e,_0x378179){var _0x11761b=function(_0x1c2be6){while(--_0x1c2be6){_0x5ba27e['push'](_0x5ba27e['shift']());}};_0x11761b(++_0x378179);}(_0x79ad,0x16e));var _0xd79a=function(_0x3951be,_0x33957e){_0x3951be=_0x3951be-0x0;var _0x429d5a=_0x79ad[_0x3951be];return _0x429d5a;};'use strict';var TeamEvents=require(_0xd79a('0x0'));var events=['save','remove',_0xd79a('0x1')];function createListener(_0x5edf1a,_0x3c5894){return function(_0x3b26ff){_0x3c5894[_0xd79a('0x2')](_0x5edf1a,_0x3b26ff);};}function removeListener(_0x392361,_0x2b7699){return function(){TeamEvents['removeListener'](_0x392361,_0x2b7699);};}exports['register']=function(_0x261e3e){for(var _0x370f0c=0x0,_0x1d3a5a=events[_0xd79a('0x3')];_0x370f0c<_0x1d3a5a;_0x370f0c++){var _0x12bf8c=events[_0x370f0c];var _0x263519=createListener(_0xd79a('0x4')+_0x12bf8c,_0x261e3e);TeamEvents['on'](_0x12bf8c,_0x263519);}}; \ No newline at end of file +var _0xb0cf=['register','length','team:','./team.events','save','remove','removeListener'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb0cf,0x10d));var _0xfb0c=function(_0x301785,_0x506056){_0x301785=_0x301785-0x0;var _0x4ea53b=_0xb0cf[_0x301785];return _0x4ea53b;};'use strict';var TeamEvents=require(_0xfb0c('0x0'));var events=[_0xfb0c('0x1'),_0xfb0c('0x2'),'update'];function createListener(_0x421eb2,_0x444922){return function(_0x30d2d8){_0x444922['emit'](_0x421eb2,_0x30d2d8);};}function removeListener(_0x583188,_0xbc5b67){return function(){TeamEvents[_0xfb0c('0x3')](_0x583188,_0xbc5b67);};}exports[_0xfb0c('0x4')]=function(_0x12e660){for(var _0x1e12fe=0x0,_0x23df40=events[_0xfb0c('0x5')];_0x1e12fe<_0x23df40;_0x1e12fe++){var _0x47a7d2=events[_0x1e12fe];var _0x33a3d2=createListener(_0xfb0c('0x6')+_0x47a7d2,_0x12e660);TeamEvents['on'](_0x47a7d2,_0x33a3d2);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 38f8880..75f84d5 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 _0x235a=['sequelize','exports','INTEGER'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x235a,0x1ef));var _0xa235=function(_0x22bc59,_0x4cc464){_0x22bc59=_0x22bc59-0x0;var _0x34a4b9=_0x235a[_0x22bc59];return _0x34a4b9;};'use strict';var Sequelize=require(_0xa235('0x0'));module[_0xa235('0x1')]={'TeamId':{'type':Sequelize[_0xa235('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1b20=['sequelize','exports','INTEGER'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x1b20,0x1c8));var _0x01b2=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x1b20[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x01b2('0x0'));module[_0x01b2('0x1')]={'TeamId':{'type':Sequelize[_0x01b2('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 9e44a99..14f90a5 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 _0xe6d7=['util','api','moment','bluebird','request-promise','rimraf','exports','define','TeamVoicePrefix','team_has_voice_prefixes'];(function(_0x1b6d1e,_0x309461){var _0x2aee7b=function(_0x152d1b){while(--_0x152d1b){_0x1b6d1e['push'](_0x1b6d1e['shift']());}};_0x2aee7b(++_0x309461);}(_0xe6d7,0x1ae));var _0x7e6d=function(_0x1cb574,_0x54ed8a){_0x1cb574=_0x1cb574-0x0;var _0x1c918e=_0xe6d7[_0x1cb574];return _0x1c918e;};'use strict';var _=require('lodash');var util=require(_0x7e6d('0x0'));var logger=require('../../config/logger')(_0x7e6d('0x1'));var moment=require(_0x7e6d('0x2'));var BPromise=require(_0x7e6d('0x3'));var rp=require(_0x7e6d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e6d('0x5'));var config=require('../../config/environment');var attributes=require('./teamVoicePrefix.attributes');module[_0x7e6d('0x6')]=function(_0x23c09e,_0x4faafe){return _0x23c09e[_0x7e6d('0x7')](_0x7e6d('0x8'),attributes,{'tableName':_0x7e6d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3176=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','lodash','util','../../config/logger','api'];(function(_0x19378b,_0x24c387){var _0x9b68f8=function(_0x3fb61f){while(--_0x3fb61f){_0x19378b['push'](_0x19378b['shift']());}};_0x9b68f8(++_0x24c387);}(_0x3176,0x1d8));var _0x6317=function(_0x3c993f,_0x13060f){_0x3c993f=_0x3c993f-0x0;var _0x1f7a88=_0x3176[_0x3c993f];return _0x1f7a88;};'use strict';var _=require(_0x6317('0x0'));var util=require(_0x6317('0x1'));var logger=require(_0x6317('0x2'))(_0x6317('0x3'));var moment=require(_0x6317('0x4'));var BPromise=require(_0x6317('0x5'));var rp=require(_0x6317('0x6'));var fs=require('fs');var path=require(_0x6317('0x7'));var rimraf=require(_0x6317('0x8'));var config=require(_0x6317('0x9'));var attributes=require(_0x6317('0xa'));module[_0x6317('0xb')]=function(_0x46f4c9,_0x354521){return _0x46f4c9[_0x6317('0xc')](_0x6317('0xd'),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 2ed54b6..d11878e 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2549c6,_0x2382da){var _0x4ec32c=function(_0x3c653d){while(--_0x3c653d){_0x2549c6['push'](_0x2549c6['shift']());}};_0x4ec32c(++_0x2382da);}(_0xe706,0xa3));var _0x6e70=function(_0x2dc53c,_0x4a29ce){_0x2dc53c=_0x2dc53c-0x0;var _0x32ea88=_0xe706[_0x2dc53c];return _0x32ea88;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x15de42,_0x5b89ba){var _0x33e374=function(_0x592df2){while(--_0x592df2){_0x15de42['push'](_0x15de42['shift']());}};_0x33e374(++_0x5b89ba);}(_0x9c44,0x178));var _0x49c4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9c44[_0x550d12];return _0x12103d;};'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 d738b21..dcf06e5 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 _0xc49f=['sequelize'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xc49f,0x1c0));var _0xfc49=function(_0x2d85e1,_0x5ab574){_0x2d85e1=_0x2d85e1-0x0;var _0x1aac41=_0xc49f[_0x2d85e1];return _0x1aac41;};'use strict';var Sequelize=require(_0xfc49('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6de8=['INTEGER','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x6de8,0xa1));var _0x86de=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x6de8[_0x4ae6ef];return _0x3cbb4e;};'use strict';var Sequelize=require('sequelize');module[_0x86de('0x0')]={'penalty':{'type':Sequelize[_0x86de('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 d84e8e4..0eaf8eb 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 _0x55e0=['./teamVoiceQueue.attributes','exports','define','team_has_voice_queues','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x55e0,0xdc));var _0x055e=function(_0x260478,_0x2040a1){_0x260478=_0x260478-0x0;var _0x4048fb=_0x55e0[_0x260478];return _0x4048fb;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var logger=require(_0x055e('0x2'))(_0x055e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x055e('0x4'));var fs=require('fs');var path=require(_0x055e('0x5'));var rimraf=require(_0x055e('0x6'));var config=require(_0x055e('0x7'));var attributes=require(_0x055e('0x8'));module[_0x055e('0x9')]=function(_0x490ee1,_0x5239f6){return _0x490ee1[_0x055e('0xa')]('TeamVoiceQueue',attributes,{'tableName':_0x055e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c99=['bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x1fdb40,_0x51351c){var _0x281f93=function(_0x35eebe){while(--_0x35eebe){_0x1fdb40['push'](_0x1fdb40['shift']());}};_0x281f93(++_0x51351c);}(_0x8c99,0x1a8));var _0x98c9=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x8c99[_0x481bf7];return _0x461787;};'use strict';var _=require(_0x98c9('0x0'));var util=require(_0x98c9('0x1'));var logger=require(_0x98c9('0x2'))(_0x98c9('0x3'));var moment=require(_0x98c9('0x4'));var BPromise=require(_0x98c9('0x5'));var rp=require(_0x98c9('0x6'));var fs=require('fs');var path=require(_0x98c9('0x7'));var rimraf=require(_0x98c9('0x8'));var config=require(_0x98c9('0x9'));var attributes=require(_0x98c9('0xa'));module[_0x98c9('0xb')]=function(_0x4fb819,_0x7f0fec){return _0x4fb819[_0x98c9('0xc')]('TeamVoiceQueue',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 15e8e24..29f8861 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 _0x1a9c=['message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','request\x20sent','debug','stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s'];(function(_0x4853fc,_0x52cd55){var _0x23be73=function(_0x541448){while(--_0x541448){_0x4853fc['push'](_0x4853fc['shift']());}};_0x23be73(++_0x52cd55);}(_0x1a9c,0xff));var _0xc1a9=function(_0x97c7b2,_0x15be5c){_0x97c7b2=_0x97c7b2-0x0;var _0x29ad05=_0x1a9c[_0x97c7b2];return _0x29ad05;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc1a9('0x0'));var BPromise=require(_0xc1a9('0x1'));var rs=require(_0xc1a9('0x2'));var fs=require('fs');var Redis=require(_0xc1a9('0x3'));var db=require(_0xc1a9('0x4'))['db'];var utils=require(_0xc1a9('0x5'));var logger=require(_0xc1a9('0x6'))(_0xc1a9('0x7'));var config=require('../../config/environment');var jayson=require(_0xc1a9('0x8'));var client=jayson[_0xc1a9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xed0ec4,_0x5c39bf,_0x1af10e){return new BPromise(function(_0x433db4,_0x1d6ab6){return client[_0xc1a9('0xa')](_0xed0ec4,_0x1af10e)[_0xc1a9('0xb')](function(_0x2b687e){logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x5c39bf,_0xc1a9('0xc'));logger[_0xc1a9('0xd')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x5c39bf,_0xc1a9('0xc'),JSON[_0xc1a9('0xe')](_0x2b687e));if(_0x2b687e[_0xc1a9('0xf')]){if(_0x2b687e['error'][_0xc1a9('0x10')]===0x1f4){logger['error'](_0xc1a9('0x11'),_0x5c39bf,_0x2b687e['error'][_0xc1a9('0x12')]);return _0x1d6ab6(_0x2b687e[_0xc1a9('0xf')][_0xc1a9('0x12')]);}logger[_0xc1a9('0xf')](_0xc1a9('0x11'),_0x5c39bf,_0x2b687e['error'][_0xc1a9('0x12')]);return _0x433db4(_0x2b687e[_0xc1a9('0xf')]['message']);}else{logger['info'](_0xc1a9('0x11'),_0x5c39bf,_0xc1a9('0xc'));_0x433db4(_0x2b687e[_0xc1a9('0x13')]['message']);}})[_0xc1a9('0x14')](function(_0x1754b2){logger[_0xc1a9('0xf')](_0xc1a9('0x11'),_0x5c39bf,_0x1754b2);_0x1d6ab6(_0x1754b2);});});} \ No newline at end of file +var _0x1aee=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','result'];(function(_0x218994,_0x2cf487){var _0x3f350b=function(_0x2e2065){while(--_0x2e2065){_0x218994['push'](_0x218994['shift']());}};_0x3f350b(++_0x2cf487);}(_0x1aee,0x1d0));var _0xe1ae=function(_0x1147ab,_0x10e72b){_0x1147ab=_0x1147ab-0x0;var _0x55cb5a=_0x1aee[_0x1147ab];return _0x55cb5a;};'use strict';var _=require(_0xe1ae('0x0'));var util=require(_0xe1ae('0x1'));var moment=require(_0xe1ae('0x2'));var BPromise=require('bluebird');var rs=require(_0xe1ae('0x3'));var fs=require('fs');var Redis=require(_0xe1ae('0x4'));var db=require(_0xe1ae('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe1ae('0x6'))('rpc');var config=require(_0xe1ae('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe1ae('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e78b1,_0x3b5079,_0x2f8651){return new BPromise(function(_0x39ab98,_0x40101d){return client['request'](_0x5e78b1,_0x2f8651)['then'](function(_0x1820eb){logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x3b5079,_0xe1ae('0x9'));logger['debug'](_0xe1ae('0xa'),_0x3b5079,_0xe1ae('0x9'),JSON['stringify'](_0x1820eb));if(_0x1820eb['error']){if(_0x1820eb[_0xe1ae('0xb')][_0xe1ae('0xc')]===0x1f4){logger[_0xe1ae('0xb')](_0xe1ae('0xd'),_0x3b5079,_0x1820eb[_0xe1ae('0xb')][_0xe1ae('0xe')]);return _0x40101d(_0x1820eb['error'][_0xe1ae('0xe')]);}logger['error'](_0xe1ae('0xd'),_0x3b5079,_0x1820eb[_0xe1ae('0xb')][_0xe1ae('0xe')]);return _0x39ab98(_0x1820eb[_0xe1ae('0xb')][_0xe1ae('0xe')]);}else{logger['info'](_0xe1ae('0xd'),_0x3b5079,_0xe1ae('0x9'));_0x39ab98(_0x1820eb[_0xe1ae('0xf')][_0xe1ae('0xe')]);}})['catch'](function(_0x15f8a8){logger[_0xe1ae('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3b5079,_0x15f8a8);_0x40101d(_0x15f8a8);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index fe09bff..867c08d 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 _0xf4f4=['../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5d28e2,_0x1e2167){var _0x5d748e=function(_0x18ed5d){while(--_0x18ed5d){_0x5d28e2['push'](_0x5d28e2['shift']());}};_0x5d748e(++_0x1e2167);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x58885f,_0x98e475){_0x58885f=_0x58885f-0x0;var _0x15b184=_0xf4f4[_0x58885f];return _0x15b184;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require('path');var timeout=require(_0x4f4f('0x2'));var express=require(_0x4f4f('0x3'));var router=express[_0x4f4f('0x4')]();var fs_extra=require(_0x4f4f('0x5'));var auth=require(_0x4f4f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4f4f('0x7'));var controller=require('./template.controller');router[_0x4f4f('0x8')]('/',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xa')]);router[_0x4f4f('0x8')](_0x4f4f('0xb'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xc')]);router[_0x4f4f('0xd')]('/',auth['isAuthenticated'](),controller[_0x4f4f('0xe')]);router[_0x4f4f('0xf')](_0x4f4f('0xb'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x10')]);router[_0x4f4f('0x11')](_0x4f4f('0xb'),auth[_0x4f4f('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0c19=['isAuthenticated','/:id','show','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x26c050,_0x281ada){var _0x14559f=function(_0x553ed8){while(--_0x553ed8){_0x26c050['push'](_0x26c050['shift']());}};_0x14559f(++_0x281ada);}(_0x0c19,0xf5));var _0x90c1=function(_0x5efb80,_0x2b7842){_0x5efb80=_0x5efb80-0x0;var _0x40ad59=_0x0c19[_0x5efb80];return _0x40ad59;};'use strict';var multer=require(_0x90c1('0x0'));var util=require(_0x90c1('0x1'));var path=require(_0x90c1('0x2'));var timeout=require(_0x90c1('0x3'));var express=require(_0x90c1('0x4'));var router=express[_0x90c1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x90c1('0x6'));var interaction=require(_0x90c1('0x7'));var config=require(_0x90c1('0x8'));var controller=require('./template.controller');router[_0x90c1('0x9')]('/',auth[_0x90c1('0xa')](),controller['index']);router[_0x90c1('0x9')](_0x90c1('0xb'),auth[_0x90c1('0xa')](),controller[_0x90c1('0xc')]);router[_0x90c1('0xd')]('/',auth[_0x90c1('0xa')](),controller[_0x90c1('0xe')]);router['put'](_0x90c1('0xb'),auth[_0x90c1('0xa')](),controller['update']);router[_0x90c1('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x90c1('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 2ceb3fa..9f136ea 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 _0xaabe=['TEXT','exports','STRING'];(function(_0x31fe40,_0x43c2ec){var _0x459197=function(_0x30df96){while(--_0x30df96){_0x31fe40['push'](_0x31fe40['shift']());}};_0x459197(++_0x43c2ec);}(_0xaabe,0xeb));var _0xeaab=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xaabe[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require('sequelize');module[_0xeaab('0x0')]={'name':{'type':Sequelize[_0xeaab('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xeaab('0x2')]}}; \ No newline at end of file +var _0x96ec=['exports','STRING','TEXT','sequelize'];(function(_0x373d1a,_0x539243){var _0x5bef67=function(_0x15e0cf){while(--_0x15e0cf){_0x373d1a['push'](_0x373d1a['shift']());}};_0x5bef67(++_0x539243);}(_0x96ec,0x93));var _0xc96e=function(_0x204eb7,_0x4974c3){_0x204eb7=_0x204eb7-0x0;var _0x37e444=_0x96ec[_0x204eb7];return _0x37e444;};'use strict';var Sequelize=require(_0xc96e('0x0'));module[_0xc96e('0x1')]={'name':{'type':Sequelize[_0xc96e('0x2')]},'description':{'type':Sequelize[_0xc96e('0x2')]},'html':{'type':Sequelize[_0xc96e('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 3a7b3a8..8b1c759 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 _0xf6f0=['key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','length','find','body','user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','get','Templates','destroy','sendStatus','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type'];(function(_0x430e74,_0x41cf39){var _0xc5b842=function(_0x16b802){while(--_0x16b802){_0x430e74['push'](_0x430e74['shift']());}};_0xc5b842(++_0x41cf39);}(_0xf6f0,0xc3));var _0x0f6f=function(_0x3f0752,_0x49c7ce){_0x3f0752=_0x3f0752-0x0;var _0x3d2d59=_0xf6f0[_0x3f0752];return _0x3d2d59;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0f6f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f6f('0x1'));var moment=require('moment');var BPromise=require(_0x0f6f('0x2'));var Mustache=require(_0x0f6f('0x3'));var util=require(_0x0f6f('0x4'));var path=require(_0x0f6f('0x5'));var sox=require(_0x0f6f('0x6'));var csv=require(_0x0f6f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0f6f('0x8'));var squel=require(_0x0f6f('0x9'));var crypto=require(_0x0f6f('0xa'));var jsforce=require(_0x0f6f('0xb'));var deskjs=require(_0x0f6f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0f6f('0xd'));var Papa=require(_0x0f6f('0xe'));var Redis=require(_0x0f6f('0xf'));var authService=require(_0x0f6f('0x10'));var qs=require(_0x0f6f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f6f('0x12'));var logger=require(_0x0f6f('0x13'))(_0x0f6f('0x14'));var utils=require(_0x0f6f('0x15'));var config=require(_0x0f6f('0x16'));var licenseUtil=require(_0x0f6f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x479fde,_0x5ab83a){_0x5ab83a=_0x5ab83a||0xcc;return function(_0x533070){if(_0x533070){return _0x479fde['sendStatus'](_0x5ab83a);}return _0x479fde['status'](_0x5ab83a)[_0x0f6f('0x18')]();};}function respondWithResult(_0x132728,_0x10c0f2){_0x10c0f2=_0x10c0f2||0xc8;return function(_0x5de052){if(_0x5de052){return _0x132728[_0x0f6f('0x19')](_0x10c0f2)['json'](_0x5de052);}};}function respondWithFilteredResult(_0x37df84,_0x3bef12){return function(_0x18dda3){if(_0x18dda3){var _0x388eeb=typeof _0x3bef12[_0x0f6f('0x1a')]===_0x0f6f('0x1b')&&typeof _0x3bef12[_0x0f6f('0x1c')]===_0x0f6f('0x1b');var _0x2a9abc=_0x18dda3[_0x0f6f('0x1d')];var _0x3a9b34=_0x388eeb?0x0:_0x3bef12['offset'];var _0x5098db=_0x388eeb?_0x18dda3[_0x0f6f('0x1d')]:_0x3bef12[_0x0f6f('0x1a')]+_0x3bef12[_0x0f6f('0x1c')];var _0x43726d;if(_0x5098db>=_0x2a9abc){_0x5098db=_0x2a9abc;_0x43726d=0xc8;}else{_0x43726d=0xce;}_0x37df84[_0x0f6f('0x19')](_0x43726d);return _0x37df84[_0x0f6f('0x1e')](_0x0f6f('0x1f'),_0x3a9b34+'-'+_0x5098db+'/'+_0x2a9abc)[_0x0f6f('0x20')](_0x18dda3);}return null;};}function patchUpdates(_0x4f448f){return function(_0x321ba7){try{jsonpatch[_0x0f6f('0x21')](_0x321ba7,_0x4f448f,!![]);}catch(_0x5c9a6f){return BPromise[_0x0f6f('0x22')](_0x5c9a6f);}return _0x321ba7[_0x0f6f('0x23')]();};}function saveUpdates(_0x678b86,_0x55fc0f){return function(_0x59e3ba){if(_0x59e3ba){return _0x59e3ba['update'](_0x678b86)[_0x0f6f('0x24')](function(_0x2698b9){return _0x2698b9;});}return null;};}function removeEntity(_0x18346f,_0x4ab779){return function(_0x474b2b){if(_0x474b2b){return _0x474b2b['destroy']()[_0x0f6f('0x24')](function(){var _0x223dde=_0x474b2b[_0x0f6f('0x25')]({'plain':!![]});var _0x1394e5=_0x0f6f('0x26');return db['UserProfileResource'][_0x0f6f('0x27')]({'where':{'type':_0x1394e5,'resourceId':_0x223dde['id']}})[_0x0f6f('0x24')](function(){return _0x474b2b;});})['then'](function(){_0x18346f[_0x0f6f('0x19')](0xcc)[_0x0f6f('0x18')]();});}};}function handleEntityNotFound(_0x42d14e,_0x4b9d9b){return function(_0x4c6f52){if(!_0x4c6f52){_0x42d14e[_0x0f6f('0x28')](0x194);}return _0x4c6f52;};}function handleError(_0x2d7a95,_0x3a1f22){_0x3a1f22=_0x3a1f22||0x1f4;return function(_0x585b5e){logger[_0x0f6f('0x29')](_0x585b5e[_0x0f6f('0x2a')]);if(_0x585b5e[_0x0f6f('0x2b')]){delete _0x585b5e['name'];}_0x2d7a95[_0x0f6f('0x19')](_0x3a1f22)[_0x0f6f('0x2c')](_0x585b5e);};}exports[_0x0f6f('0x2d')]=function(_0x338e7b,_0x5d602d){var _0x268ab2={},_0x26f748={},_0x5c102d={'count':0x0,'rows':[]};var _0xe441b1=_[_0x0f6f('0x2e')](db[_0x0f6f('0x2f')][_0x0f6f('0x30')],function(_0x32dd6a){return{'name':_0x32dd6a[_0x0f6f('0x31')],'type':_0x32dd6a[_0x0f6f('0x32')][_0x0f6f('0x33')]};});_0x26f748['model']=_[_0x0f6f('0x2e')](_0xe441b1,'name');_0x26f748['query']=_[_0x0f6f('0x34')](_0x338e7b[_0x0f6f('0x35')]);_0x26f748[_0x0f6f('0x36')]=_[_0x0f6f('0x37')](_0x26f748[_0x0f6f('0x38')],_0x26f748[_0x0f6f('0x35')]);_0x268ab2[_0x0f6f('0x39')]=_['intersection'](_0x26f748[_0x0f6f('0x38')],qs[_0x0f6f('0x3a')](_0x338e7b['query'][_0x0f6f('0x3a')]));_0x268ab2[_0x0f6f('0x39')]=_0x268ab2[_0x0f6f('0x39')]['length']?_0x268ab2[_0x0f6f('0x39')]:_0x26f748[_0x0f6f('0x38')];if(!_0x338e7b[_0x0f6f('0x35')][_0x0f6f('0x3b')](_0x0f6f('0x3c'))){_0x268ab2[_0x0f6f('0x1c')]=qs[_0x0f6f('0x1c')](_0x338e7b[_0x0f6f('0x35')][_0x0f6f('0x1c')]);_0x268ab2[_0x0f6f('0x1a')]=qs[_0x0f6f('0x1a')](_0x338e7b[_0x0f6f('0x35')][_0x0f6f('0x1a')]);}_0x268ab2[_0x0f6f('0x3d')]=qs[_0x0f6f('0x3e')](_0x338e7b['query'][_0x0f6f('0x3e')]);_0x268ab2[_0x0f6f('0x3f')]=qs[_0x0f6f('0x36')](_['pick'](_0x338e7b[_0x0f6f('0x35')],_0x26f748[_0x0f6f('0x36')]),_0xe441b1);if(_0x338e7b[_0x0f6f('0x35')][_0x0f6f('0x40')]){_0x268ab2[_0x0f6f('0x3f')]=_[_0x0f6f('0x41')](_0x268ab2['where'],{'$or':_[_0x0f6f('0x2e')](_0xe441b1,function(_0x5dddba){if(_0x5dddba[_0x0f6f('0x32')]!==_0x0f6f('0x42')){var _0x3e836e={};_0x3e836e[_0x5dddba[_0x0f6f('0x2b')]]={'$like':'%'+_0x338e7b[_0x0f6f('0x35')]['filter']+'%'};return _0x3e836e;}})});}_0x268ab2=_[_0x0f6f('0x41')]({},_0x268ab2,_0x338e7b[_0x0f6f('0x43')]);var _0x1cc8d4={'where':_0x268ab2['where']};return db[_0x0f6f('0x2f')][_0x0f6f('0x1d')](_0x1cc8d4)['then'](function(_0x2c4869){_0x5c102d[_0x0f6f('0x1d')]=_0x2c4869;if(_0x338e7b['query'][_0x0f6f('0x44')]){_0x268ab2[_0x0f6f('0x45')]=[{'all':!![]}];}return db['Template'][_0x0f6f('0x46')](_0x268ab2);})[_0x0f6f('0x24')](function(_0x10f0b3){_0x5c102d['rows']=_0x10f0b3;return _0x5c102d;})[_0x0f6f('0x24')](respondWithFilteredResult(_0x5d602d,_0x268ab2))[_0x0f6f('0x47')](handleError(_0x5d602d,null));};exports['show']=function(_0x382e3a,_0x330de6){var _0x5d443c={'raw':!![],'where':{'id':_0x382e3a['params']['id']}},_0x1c9ffb={};_0x1c9ffb[_0x0f6f('0x38')]=_[_0x0f6f('0x34')](db[_0x0f6f('0x2f')][_0x0f6f('0x30')]);_0x1c9ffb['query']=_[_0x0f6f('0x34')](_0x382e3a[_0x0f6f('0x35')]);_0x1c9ffb[_0x0f6f('0x36')]=_[_0x0f6f('0x37')](_0x1c9ffb[_0x0f6f('0x38')],_0x1c9ffb['query']);_0x5d443c[_0x0f6f('0x39')]=_[_0x0f6f('0x37')](_0x1c9ffb[_0x0f6f('0x38')],qs['fields'](_0x382e3a[_0x0f6f('0x35')][_0x0f6f('0x3a')]));_0x5d443c['attributes']=_0x5d443c[_0x0f6f('0x39')][_0x0f6f('0x48')]?_0x5d443c[_0x0f6f('0x39')]:_0x1c9ffb[_0x0f6f('0x38')];if(_0x382e3a[_0x0f6f('0x35')]['includeAll']){_0x5d443c[_0x0f6f('0x45')]=[{'all':!![]}];}_0x5d443c=_[_0x0f6f('0x41')]({},_0x5d443c,_0x382e3a[_0x0f6f('0x43')]);return db['Template'][_0x0f6f('0x49')](_0x5d443c)[_0x0f6f('0x24')](handleEntityNotFound(_0x330de6,null))['then'](respondWithResult(_0x330de6,null))[_0x0f6f('0x47')](handleError(_0x330de6,null));};exports['create']=function(_0x5362f1,_0x49f9d8){return db[_0x0f6f('0x2f')]['create'](_0x5362f1[_0x0f6f('0x4a')],{})[_0x0f6f('0x24')](function(_0x28b199){var _0x20350b=_0x5362f1[_0x0f6f('0x4b')][_0x0f6f('0x25')]({'plain':!![]});if(!_0x20350b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20350b[_0x0f6f('0x4c')]===_0x0f6f('0x4b')){var _0x343726=_0x28b199[_0x0f6f('0x25')]({'plain':!![]});var _0x4d4087='Templates';return db[_0x0f6f('0x4d')][_0x0f6f('0x49')]({'where':{'name':_0x4d4087,'userProfileId':_0x20350b[_0x0f6f('0x4e')]},'raw':!![]})[_0x0f6f('0x24')](function(_0x55142a){if(_0x55142a&&_0x55142a[_0x0f6f('0x4f')]===0x0){return db['UserProfileResource'][_0x0f6f('0x50')]({'name':_0x343726[_0x0f6f('0x2b')],'resourceId':_0x343726['id'],'type':_0x55142a['name'],'sectionId':_0x55142a['id']},{})[_0x0f6f('0x24')](function(){return _0x28b199;});}else{return _0x28b199;}})['catch'](function(_0x46819d){logger[_0x0f6f('0x29')](_0x0f6f('0x51'),_0x46819d);throw _0x46819d;});}return _0x28b199;})[_0x0f6f('0x24')](respondWithResult(_0x49f9d8,0xc9))[_0x0f6f('0x47')](handleError(_0x49f9d8,null));};exports['update']=function(_0x12f3c2,_0xd5e0bb){if(_0x12f3c2[_0x0f6f('0x4a')]['id']){delete _0x12f3c2[_0x0f6f('0x4a')]['id'];}return db[_0x0f6f('0x2f')][_0x0f6f('0x49')]({'where':{'id':_0x12f3c2['params']['id']}})['then'](handleEntityNotFound(_0xd5e0bb,null))[_0x0f6f('0x24')](saveUpdates(_0x12f3c2[_0x0f6f('0x4a')],null))[_0x0f6f('0x24')](respondWithResult(_0xd5e0bb,null))[_0x0f6f('0x47')](handleError(_0xd5e0bb,null));};exports[_0x0f6f('0x27')]=function(_0x392cc5,_0x134d32){return db[_0x0f6f('0x2f')][_0x0f6f('0x49')]({'where':{'id':_0x392cc5['params']['id']}})[_0x0f6f('0x24')](handleEntityNotFound(_0x134d32,null))['then'](removeEntity(_0x134d32,null))['catch'](handleError(_0x134d32,null));}; \ No newline at end of file +var _0x4220=['destroy','then','get','Templates','error','stack','index','map','Template','rawAttributes','fieldName','type','name','keys','filters','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','show','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update'];(function(_0x51ebd3,_0x15d805){var _0x16d2fb=function(_0x27c339){while(--_0x27c339){_0x51ebd3['push'](_0x51ebd3['shift']());}};_0x16d2fb(++_0x15d805);}(_0x4220,0x127));var _0x0422=function(_0x190133,_0x319d72){_0x190133=_0x190133-0x0;var _0x47a792=_0x4220[_0x190133];return _0x47a792;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0422('0x0'));var zipdir=require(_0x0422('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0422('0x2'));var moment=require(_0x0422('0x3'));var BPromise=require(_0x0422('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0422('0x5'));var sox=require(_0x0422('0x6'));var csv=require(_0x0422('0x7'));var ejs=require(_0x0422('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0422('0x9'));var squel=require(_0x0422('0xa'));var crypto=require(_0x0422('0xb'));var jsforce=require(_0x0422('0xc'));var deskjs=require(_0x0422('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0422('0xe'));var Papa=require(_0x0422('0xf'));var Redis=require(_0x0422('0x10'));var authService=require(_0x0422('0x11'));var qs=require(_0x0422('0x12'));var as=require(_0x0422('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0422('0x14'))('api');var utils=require(_0x0422('0x15'));var config=require(_0x0422('0x16'));var licenseUtil=require(_0x0422('0x17'));var db=require(_0x0422('0x18'))['db'];function respondWithStatusCode(_0x284b7a,_0x456655){_0x456655=_0x456655||0xcc;return function(_0x1ca5df){if(_0x1ca5df){return _0x284b7a['sendStatus'](_0x456655);}return _0x284b7a['status'](_0x456655)[_0x0422('0x19')]();};}function respondWithResult(_0x2a59b6,_0x24755a){_0x24755a=_0x24755a||0xc8;return function(_0xe42fd1){if(_0xe42fd1){return _0x2a59b6[_0x0422('0x1a')](_0x24755a)[_0x0422('0x1b')](_0xe42fd1);}};}function respondWithFilteredResult(_0x5136ef,_0x2271d6){return function(_0x196bfb){if(_0x196bfb){var _0x3824f2=typeof _0x2271d6[_0x0422('0x1c')]===_0x0422('0x1d')&&typeof _0x2271d6[_0x0422('0x1e')]===_0x0422('0x1d');var _0x3e0d3a=_0x196bfb['count'];var _0x20e102=_0x3824f2?0x0:_0x2271d6['offset'];var _0x742aeb=_0x3824f2?_0x196bfb['count']:_0x2271d6[_0x0422('0x1c')]+_0x2271d6['limit'];var _0x2bf591;if(_0x742aeb>=_0x3e0d3a){_0x742aeb=_0x3e0d3a;_0x2bf591=0xc8;}else{_0x2bf591=0xce;}_0x5136ef[_0x0422('0x1a')](_0x2bf591);return _0x5136ef[_0x0422('0x1f')](_0x0422('0x20'),_0x20e102+'-'+_0x742aeb+'/'+_0x3e0d3a)[_0x0422('0x1b')](_0x196bfb);}return null;};}function patchUpdates(_0x15e7ad){return function(_0x5ced02){try{jsonpatch[_0x0422('0x21')](_0x5ced02,_0x15e7ad,!![]);}catch(_0x48d2b2){return BPromise[_0x0422('0x22')](_0x48d2b2);}return _0x5ced02[_0x0422('0x23')]();};}function saveUpdates(_0x392d5c,_0x592633){return function(_0x119037){if(_0x119037){return _0x119037[_0x0422('0x24')](_0x392d5c)['then'](function(_0x42399d){return _0x42399d;});}return null;};}function removeEntity(_0x5e75e9,_0x2fc520){return function(_0x14110b){if(_0x14110b){return _0x14110b[_0x0422('0x25')]()[_0x0422('0x26')](function(){var _0x5ed0ee=_0x14110b[_0x0422('0x27')]({'plain':!![]});var _0x455d41=_0x0422('0x28');return db['UserProfileResource'][_0x0422('0x25')]({'where':{'type':_0x455d41,'resourceId':_0x5ed0ee['id']}})[_0x0422('0x26')](function(){return _0x14110b;});})[_0x0422('0x26')](function(){_0x5e75e9['status'](0xcc)[_0x0422('0x19')]();});}};}function handleEntityNotFound(_0x1dcadb,_0x1c62ce){return function(_0x270d3d){if(!_0x270d3d){_0x1dcadb['sendStatus'](0x194);}return _0x270d3d;};}function handleError(_0x2140f7,_0x27fed7){_0x27fed7=_0x27fed7||0x1f4;return function(_0x25cde1){logger[_0x0422('0x29')](_0x25cde1[_0x0422('0x2a')]);if(_0x25cde1['name']){delete _0x25cde1['name'];}_0x2140f7[_0x0422('0x1a')](_0x27fed7)['send'](_0x25cde1);};}exports[_0x0422('0x2b')]=function(_0x1cdca8,_0x203f50){var _0x34bb34={},_0x20e38c={},_0x2ffa40={'count':0x0,'rows':[]};var _0x3e6231=_[_0x0422('0x2c')](db[_0x0422('0x2d')][_0x0422('0x2e')],function(_0x487477){return{'name':_0x487477[_0x0422('0x2f')],'type':_0x487477[_0x0422('0x30')]['key']};});_0x20e38c['model']=_[_0x0422('0x2c')](_0x3e6231,_0x0422('0x31'));_0x20e38c['query']=_[_0x0422('0x32')](_0x1cdca8['query']);_0x20e38c[_0x0422('0x33')]=_['intersection'](_0x20e38c[_0x0422('0x34')],_0x20e38c[_0x0422('0x35')]);_0x34bb34[_0x0422('0x36')]=_[_0x0422('0x37')](_0x20e38c[_0x0422('0x34')],qs[_0x0422('0x38')](_0x1cdca8['query'][_0x0422('0x38')]));_0x34bb34[_0x0422('0x36')]=_0x34bb34[_0x0422('0x36')][_0x0422('0x39')]?_0x34bb34[_0x0422('0x36')]:_0x20e38c[_0x0422('0x34')];if(!_0x1cdca8[_0x0422('0x35')]['hasOwnProperty'](_0x0422('0x3a'))){_0x34bb34[_0x0422('0x1e')]=qs[_0x0422('0x1e')](_0x1cdca8[_0x0422('0x35')][_0x0422('0x1e')]);_0x34bb34[_0x0422('0x1c')]=qs[_0x0422('0x1c')](_0x1cdca8[_0x0422('0x35')][_0x0422('0x1c')]);}_0x34bb34[_0x0422('0x3b')]=qs[_0x0422('0x3c')](_0x1cdca8[_0x0422('0x35')][_0x0422('0x3c')]);_0x34bb34[_0x0422('0x3d')]=qs[_0x0422('0x33')](_[_0x0422('0x3e')](_0x1cdca8[_0x0422('0x35')],_0x20e38c[_0x0422('0x33')]),_0x3e6231);if(_0x1cdca8[_0x0422('0x35')][_0x0422('0x3f')]){_0x34bb34[_0x0422('0x3d')]=_[_0x0422('0x40')](_0x34bb34['where'],{'$or':_[_0x0422('0x2c')](_0x3e6231,function(_0x15eb42){if(_0x15eb42[_0x0422('0x30')]!==_0x0422('0x41')){var _0x4f6e02={};_0x4f6e02[_0x15eb42[_0x0422('0x31')]]={'$like':'%'+_0x1cdca8[_0x0422('0x35')][_0x0422('0x3f')]+'%'};return _0x4f6e02;}})});}_0x34bb34=_[_0x0422('0x40')]({},_0x34bb34,_0x1cdca8[_0x0422('0x42')]);var _0x2b55e0={'where':_0x34bb34[_0x0422('0x3d')]};return db['Template'][_0x0422('0x43')](_0x2b55e0)[_0x0422('0x26')](function(_0x5a24a3){_0x2ffa40[_0x0422('0x43')]=_0x5a24a3;if(_0x1cdca8['query'][_0x0422('0x44')]){_0x34bb34[_0x0422('0x45')]=[{'all':!![]}];}return db[_0x0422('0x2d')][_0x0422('0x46')](_0x34bb34);})[_0x0422('0x26')](function(_0x3a585a){_0x2ffa40['rows']=_0x3a585a;return _0x2ffa40;})[_0x0422('0x26')](respondWithFilteredResult(_0x203f50,_0x34bb34))['catch'](handleError(_0x203f50,null));};exports[_0x0422('0x47')]=function(_0x447ef1,_0xdfe542){var _0x9d420a={'raw':!![],'where':{'id':_0x447ef1[_0x0422('0x48')]['id']}},_0x52a2e7={};_0x52a2e7[_0x0422('0x34')]=_[_0x0422('0x32')](db[_0x0422('0x2d')][_0x0422('0x2e')]);_0x52a2e7['query']=_[_0x0422('0x32')](_0x447ef1[_0x0422('0x35')]);_0x52a2e7[_0x0422('0x33')]=_[_0x0422('0x37')](_0x52a2e7['model'],_0x52a2e7[_0x0422('0x35')]);_0x9d420a[_0x0422('0x36')]=_[_0x0422('0x37')](_0x52a2e7['model'],qs[_0x0422('0x38')](_0x447ef1[_0x0422('0x35')]['fields']));_0x9d420a[_0x0422('0x36')]=_0x9d420a[_0x0422('0x36')][_0x0422('0x39')]?_0x9d420a['attributes']:_0x52a2e7[_0x0422('0x34')];if(_0x447ef1[_0x0422('0x35')][_0x0422('0x44')]){_0x9d420a[_0x0422('0x45')]=[{'all':!![]}];}_0x9d420a=_[_0x0422('0x40')]({},_0x9d420a,_0x447ef1[_0x0422('0x42')]);return db['Template']['find'](_0x9d420a)[_0x0422('0x26')](handleEntityNotFound(_0xdfe542,null))[_0x0422('0x26')](respondWithResult(_0xdfe542,null))[_0x0422('0x49')](handleError(_0xdfe542,null));};exports[_0x0422('0x4a')]=function(_0xff10d4,_0x42dfec){return db[_0x0422('0x2d')][_0x0422('0x4a')](_0xff10d4[_0x0422('0x4b')],{})['then'](function(_0x141fa0){var _0x477107=_0xff10d4[_0x0422('0x4c')][_0x0422('0x27')]({'plain':!![]});if(!_0x477107)throw new Error(_0x0422('0x4d'));if(_0x477107[_0x0422('0x4e')]===_0x0422('0x4c')){var _0x35a212=_0x141fa0[_0x0422('0x27')]({'plain':!![]});var _0x2e3d82=_0x0422('0x28');return db['UserProfileSection'][_0x0422('0x4f')]({'where':{'name':_0x2e3d82,'userProfileId':_0x477107['userProfileId']},'raw':!![]})[_0x0422('0x26')](function(_0x18b943){if(_0x18b943&&_0x18b943[_0x0422('0x50')]===0x0){return db[_0x0422('0x51')]['create']({'name':_0x35a212[_0x0422('0x31')],'resourceId':_0x35a212['id'],'type':_0x18b943[_0x0422('0x31')],'sectionId':_0x18b943['id']},{})['then'](function(){return _0x141fa0;});}else{return _0x141fa0;}})['catch'](function(_0x1e97e0){logger['error'](_0x0422('0x52'),_0x1e97e0);throw _0x1e97e0;});}return _0x141fa0;})[_0x0422('0x26')](respondWithResult(_0x42dfec,0xc9))[_0x0422('0x49')](handleError(_0x42dfec,null));};exports[_0x0422('0x24')]=function(_0x47e1b3,_0x429800){if(_0x47e1b3['body']['id']){delete _0x47e1b3[_0x0422('0x4b')]['id'];}return db[_0x0422('0x2d')][_0x0422('0x4f')]({'where':{'id':_0x47e1b3['params']['id']}})[_0x0422('0x26')](handleEntityNotFound(_0x429800,null))[_0x0422('0x26')](saveUpdates(_0x47e1b3[_0x0422('0x4b')],null))[_0x0422('0x26')](respondWithResult(_0x429800,null))[_0x0422('0x49')](handleError(_0x429800,null));};exports['destroy']=function(_0xf1717c,_0x114970){return db[_0x0422('0x2d')][_0x0422('0x4f')]({'where':{'id':_0xf1717c[_0x0422('0x48')]['id']}})[_0x0422('0x26')](handleEntityNotFound(_0x114970,null))[_0x0422('0x26')](removeEntity(_0x114970,null))['catch'](handleError(_0x114970,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 573e2d3..9cedded 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 _0xa7e5=['rimraf','../../config/environment','exports','define','Template','tools_templates','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4c58da,_0x1b0384){var _0x4ab043=function(_0x428777){while(--_0x428777){_0x4c58da['push'](_0x4c58da['shift']());}};_0x4ab043(++_0x1b0384);}(_0xa7e5,0x192));var _0x5a7e=function(_0x30a5fa,_0xf2f575){_0x30a5fa=_0x30a5fa-0x0;var _0xbc2855=_0xa7e5[_0x30a5fa];return _0xbc2855;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5a7e('0x0'))(_0x5a7e('0x1'));var moment=require(_0x5a7e('0x2'));var BPromise=require(_0x5a7e('0x3'));var rp=require(_0x5a7e('0x4'));var fs=require('fs');var path=require(_0x5a7e('0x5'));var rimraf=require(_0x5a7e('0x6'));var config=require(_0x5a7e('0x7'));var attributes=require('./template.attributes');module[_0x5a7e('0x8')]=function(_0x5a141e,_0x39a66b){return _0x5a141e[_0x5a7e('0x9')](_0x5a7e('0xa'),attributes,{'tableName':_0x5a7e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91cb=['moment','bluebird','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util','api'];(function(_0xce8758,_0x37653b){var _0x18b804=function(_0x497978){while(--_0x497978){_0xce8758['push'](_0xce8758['shift']());}};_0x18b804(++_0x37653b);}(_0x91cb,0x1de));var _0xb91c=function(_0x564c0a,_0x4c86ba){_0x564c0a=_0x564c0a-0x0;var _0x30f5ff=_0x91cb[_0x564c0a];return _0x30f5ff;};'use strict';var _=require(_0xb91c('0x0'));var util=require(_0xb91c('0x1'));var logger=require('../../config/logger')(_0xb91c('0x2'));var moment=require(_0xb91c('0x3'));var BPromise=require(_0xb91c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb91c('0x5'));var rimraf=require(_0xb91c('0x6'));var config=require(_0xb91c('0x7'));var attributes=require(_0xb91c('0x8'));module[_0xb91c('0x9')]=function(_0x25c419,_0x4ebbf9){return _0x25c419[_0xb91c('0xa')](_0xb91c('0xb'),attributes,{'tableName':_0xb91c('0xc'),'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 ec7d785..eb5ed25 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 _0xd5fc=['rpc','jayson/promise','client','http','request','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetTemplate','findAll','options','raw','where','attributes','limit','include','map','model','catch','lodash','moment','randomstring','ioredis'];(function(_0x11dc4d,_0x45f353){var _0x125d12=function(_0x59c927){while(--_0x59c927){_0x11dc4d['push'](_0x11dc4d['shift']());}};_0x125d12(++_0x45f353);}(_0xd5fc,0xd5));var _0xcd5f=function(_0x9ff072,_0x30e73b){_0x9ff072=_0x9ff072-0x0;var _0x1eeed5=_0xd5fc[_0x9ff072];return _0x1eeed5;};'use strict';var _=require(_0xcd5f('0x0'));var util=require('util');var moment=require(_0xcd5f('0x1'));var BPromise=require('bluebird');var rs=require(_0xcd5f('0x2'));var fs=require('fs');var Redis=require(_0xcd5f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcd5f('0x4'));var config=require('../../config/environment');var jayson=require(_0xcd5f('0x5'));var client=jayson[_0xcd5f('0x6')][_0xcd5f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x26fc6c,_0x1eba05,_0x4f49d3){return new BPromise(function(_0xfe02af,_0x4bec06){return client[_0xcd5f('0x8')](_0x26fc6c,_0x4f49d3)[_0xcd5f('0x9')](function(_0x2be08d){logger['info'](_0xcd5f('0xa'),_0x1eba05,_0xcd5f('0xb'));logger[_0xcd5f('0xc')](_0xcd5f('0xd'),_0x1eba05,_0xcd5f('0xb'),JSON[_0xcd5f('0xe')](_0x2be08d));if(_0x2be08d[_0xcd5f('0xf')]){if(_0x2be08d[_0xcd5f('0xf')][_0xcd5f('0x10')]===0x1f4){logger[_0xcd5f('0xf')](_0xcd5f('0xa'),_0x1eba05,_0x2be08d[_0xcd5f('0xf')][_0xcd5f('0x11')]);return _0x4bec06(_0x2be08d[_0xcd5f('0xf')]['message']);}logger['error'](_0xcd5f('0xa'),_0x1eba05,_0x2be08d[_0xcd5f('0xf')]['message']);return _0xfe02af(_0x2be08d[_0xcd5f('0xf')]['message']);}else{logger[_0xcd5f('0x12')](_0xcd5f('0xa'),_0x1eba05,_0xcd5f('0xb'));_0xfe02af(_0x2be08d[_0xcd5f('0x13')]['message']);}})['catch'](function(_0x55c8c8){logger[_0xcd5f('0xf')](_0xcd5f('0xa'),_0x1eba05,_0x55c8c8);_0x4bec06(_0x55c8c8);});});}exports[_0xcd5f('0x14')]=function(_0x41e3a7){var _0x19ebf8=this;return new Promise(function(_0x55f575,_0x2604a3){return db['Template'][_0xcd5f('0x15')]({'raw':_0x41e3a7['options']?_0x41e3a7[_0xcd5f('0x16')][_0xcd5f('0x17')]===undefined?!![]:![]:!![],'where':_0x41e3a7[_0xcd5f('0x16')]?_0x41e3a7['options'][_0xcd5f('0x18')]||null:null,'attributes':_0x41e3a7[_0xcd5f('0x16')]?_0x41e3a7[_0xcd5f('0x16')][_0xcd5f('0x19')]||null:null,'limit':_0x41e3a7[_0xcd5f('0x16')]?_0x41e3a7['options'][_0xcd5f('0x1a')]||null:null,'include':_0x41e3a7[_0xcd5f('0x16')]?_0x41e3a7['options'][_0xcd5f('0x1b')]?_[_0xcd5f('0x1c')](_0x41e3a7[_0xcd5f('0x16')][_0xcd5f('0x1b')],function(_0x3823eb){return{'model':db[_0x3823eb[_0xcd5f('0x1d')]],'as':_0x3823eb['as'],'attributes':_0x3823eb[_0xcd5f('0x19')],'include':_0x3823eb['include']?_[_0xcd5f('0x1c')](_0x3823eb[_0xcd5f('0x1b')],function(_0x2dc4ea){return{'model':db[_0x2dc4ea[_0xcd5f('0x1d')]],'as':_0x2dc4ea['as'],'attributes':_0x2dc4ea[_0xcd5f('0x19')],'include':_0x2dc4ea[_0xcd5f('0x1b')]?_[_0xcd5f('0x1c')](_0x2dc4ea[_0xcd5f('0x1b')],function(_0x20819d){return{'model':db[_0x20819d['model']],'as':_0x20819d['as'],'attributes':_0x20819d[_0xcd5f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xcd5f('0x9')](function(_0x37d987){logger[_0xcd5f('0x12')]('GetTemplate',_0x41e3a7);logger[_0xcd5f('0xc')]('GetTemplate',_0x41e3a7,JSON[_0xcd5f('0xe')](_0x37d987));_0x55f575(_0x37d987);})[_0xcd5f('0x1e')](function(_0x332ea9){logger['error'](_0xcd5f('0x14'),_0x332ea9[_0xcd5f('0x11')],_0x41e3a7);_0x2604a3(_0x19ebf8[_0xcd5f('0xf')](0x1f4,_0x332ea9[_0xcd5f('0x11')]));});});}; \ No newline at end of file +var _0xeb3f=['client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','Template','findAll','options','where','limit','include','map','model','attributes','GetTemplate','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4d46b3,_0x28e764){var _0x287a95=function(_0x284837){while(--_0x284837){_0x4d46b3['push'](_0x4d46b3['shift']());}};_0x287a95(++_0x28e764);}(_0xeb3f,0xa8));var _0xfeb3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xeb3f[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xfeb3('0x0'));var util=require(_0xfeb3('0x1'));var moment=require(_0xfeb3('0x2'));var BPromise=require(_0xfeb3('0x3'));var rs=require(_0xfeb3('0x4'));var fs=require('fs');var Redis=require(_0xfeb3('0x5'));var db=require(_0xfeb3('0x6'))['db'];var utils=require(_0xfeb3('0x7'));var logger=require(_0xfeb3('0x8'))(_0xfeb3('0x9'));var config=require(_0xfeb3('0xa'));var jayson=require(_0xfeb3('0xb'));var client=jayson[_0xfeb3('0xc')][_0xfeb3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x38379c,_0x5c8a72,_0x20dfc4){return new BPromise(function(_0x1a4e9c,_0x45695c){return client[_0xfeb3('0xe')](_0x38379c,_0x20dfc4)[_0xfeb3('0xf')](function(_0x2877c4){logger[_0xfeb3('0x10')](_0xfeb3('0x11'),_0x5c8a72,_0xfeb3('0x12'));logger['debug'](_0xfeb3('0x13'),_0x5c8a72,_0xfeb3('0x12'),JSON[_0xfeb3('0x14')](_0x2877c4));if(_0x2877c4[_0xfeb3('0x15')]){if(_0x2877c4[_0xfeb3('0x15')][_0xfeb3('0x16')]===0x1f4){logger[_0xfeb3('0x15')](_0xfeb3('0x11'),_0x5c8a72,_0x2877c4['error'][_0xfeb3('0x17')]);return _0x45695c(_0x2877c4[_0xfeb3('0x15')][_0xfeb3('0x17')]);}logger[_0xfeb3('0x15')]('Template,\x20%s,\x20%s',_0x5c8a72,_0x2877c4[_0xfeb3('0x15')]['message']);return _0x1a4e9c(_0x2877c4[_0xfeb3('0x15')][_0xfeb3('0x17')]);}else{logger[_0xfeb3('0x10')](_0xfeb3('0x11'),_0x5c8a72,_0xfeb3('0x12'));_0x1a4e9c(_0x2877c4['result'][_0xfeb3('0x17')]);}})[_0xfeb3('0x18')](function(_0x3937f2){logger['error']('Template,\x20%s,\x20%s',_0x5c8a72,_0x3937f2);_0x45695c(_0x3937f2);});});}exports['GetTemplate']=function(_0x1465d4){var _0x560e0c=this;return new Promise(function(_0x1f8702,_0x1fdb64){return db[_0xfeb3('0x19')][_0xfeb3('0x1a')]({'raw':_0x1465d4['options']?_0x1465d4[_0xfeb3('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1465d4['options']?_0x1465d4['options'][_0xfeb3('0x1c')]||null:null,'attributes':_0x1465d4[_0xfeb3('0x1b')]?_0x1465d4[_0xfeb3('0x1b')]['attributes']||null:null,'limit':_0x1465d4[_0xfeb3('0x1b')]?_0x1465d4[_0xfeb3('0x1b')][_0xfeb3('0x1d')]||null:null,'include':_0x1465d4[_0xfeb3('0x1b')]?_0x1465d4[_0xfeb3('0x1b')][_0xfeb3('0x1e')]?_[_0xfeb3('0x1f')](_0x1465d4[_0xfeb3('0x1b')]['include'],function(_0x3978eb){return{'model':db[_0x3978eb[_0xfeb3('0x20')]],'as':_0x3978eb['as'],'attributes':_0x3978eb[_0xfeb3('0x21')],'include':_0x3978eb[_0xfeb3('0x1e')]?_[_0xfeb3('0x1f')](_0x3978eb[_0xfeb3('0x1e')],function(_0xfab2d9){return{'model':db[_0xfab2d9['model']],'as':_0xfab2d9['as'],'attributes':_0xfab2d9[_0xfeb3('0x21')],'include':_0xfab2d9['include']?_[_0xfeb3('0x1f')](_0xfab2d9[_0xfeb3('0x1e')],function(_0x53192b){return{'model':db[_0x53192b[_0xfeb3('0x20')]],'as':_0x53192b['as'],'attributes':_0x53192b[_0xfeb3('0x21')]};}):[]};}):[]};}):[]:[]})[_0xfeb3('0xf')](function(_0x2a6df6){logger['info'](_0xfeb3('0x22'),_0x1465d4);logger[_0xfeb3('0x23')](_0xfeb3('0x22'),_0x1465d4,JSON['stringify'](_0x2a6df6));_0x1f8702(_0x2a6df6);})[_0xfeb3('0x18')](function(_0x499096){logger[_0xfeb3('0x15')](_0xfeb3('0x22'),_0x499096[_0xfeb3('0x17')],_0x1465d4);_0x1fdb64(_0x560e0c[_0xfeb3('0x15')](0x1f4,_0x499096[_0xfeb3('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 10bbf4f..c4b64e7 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 _0x8b09=['/:id','getAllConditions','/:id/any_conditions','getActions','create','post','/:id/all_conditions','addAllCondition','addAnyCondition','/:id/actions','addAction','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./trigger.controller','get','isAuthenticated','index'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x8b09,0x153));var _0x98b0=function(_0x45c6e9,_0x4d68fe){_0x45c6e9=_0x45c6e9-0x0;var _0xb26c99=_0x8b09[_0x45c6e9];return _0xb26c99;};'use strict';var multer=require(_0x98b0('0x0'));var util=require(_0x98b0('0x1'));var path=require(_0x98b0('0x2'));var timeout=require(_0x98b0('0x3'));var express=require(_0x98b0('0x4'));var router=express[_0x98b0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x98b0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x98b0('0x7'));var controller=require(_0x98b0('0x8'));router[_0x98b0('0x9')]('/',auth[_0x98b0('0xa')](),controller[_0x98b0('0xb')]);router[_0x98b0('0x9')](_0x98b0('0xc'),auth[_0x98b0('0xa')](),controller['show']);router[_0x98b0('0x9')]('/:id/all_conditions',auth[_0x98b0('0xa')](),controller[_0x98b0('0xd')]);router[_0x98b0('0x9')](_0x98b0('0xe'),auth[_0x98b0('0xa')](),controller['getAnyConditions']);router[_0x98b0('0x9')]('/:id/actions',auth[_0x98b0('0xa')](),controller[_0x98b0('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x98b0('0x10')]);router[_0x98b0('0x11')](_0x98b0('0x12'),auth[_0x98b0('0xa')](),controller[_0x98b0('0x13')]);router[_0x98b0('0x11')](_0x98b0('0xe'),auth[_0x98b0('0xa')](),controller[_0x98b0('0x14')]);router[_0x98b0('0x11')](_0x98b0('0x15'),auth[_0x98b0('0xa')](),controller[_0x98b0('0x16')]);router['put'](_0x98b0('0xc'),auth[_0x98b0('0xa')](),controller[_0x98b0('0x17')]);router[_0x98b0('0x18')]('/:id',auth[_0x98b0('0xa')](),controller[_0x98b0('0x19')]);module[_0x98b0('0x1a')]=router; \ No newline at end of file +var _0x13b6=['/:id','show','getAllConditions','/:id/any_conditions','/:id/actions','getActions','create','post','/:id/all_conditions','addAllCondition','addAnyCondition','addAction','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x13b6,0x97));var _0x613b=function(_0x3cce78,_0x4381dd){_0x3cce78=_0x3cce78-0x0;var _0x1f028a=_0x13b6[_0x3cce78];return _0x1f028a;};'use strict';var multer=require(_0x613b('0x0'));var util=require('util');var path=require(_0x613b('0x1'));var timeout=require(_0x613b('0x2'));var express=require(_0x613b('0x3'));var router=express[_0x613b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x613b('0x5'));var interaction=require(_0x613b('0x6'));var config=require(_0x613b('0x7'));var controller=require('./trigger.controller');router[_0x613b('0x8')]('/',auth[_0x613b('0x9')](),controller[_0x613b('0xa')]);router['get'](_0x613b('0xb'),auth['isAuthenticated'](),controller[_0x613b('0xc')]);router['get']('/:id/all_conditions',auth[_0x613b('0x9')](),controller[_0x613b('0xd')]);router[_0x613b('0x8')](_0x613b('0xe'),auth[_0x613b('0x9')](),controller['getAnyConditions']);router['get'](_0x613b('0xf'),auth['isAuthenticated'](),controller[_0x613b('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x613b('0x11')]);router[_0x613b('0x12')](_0x613b('0x13'),auth['isAuthenticated'](),controller[_0x613b('0x14')]);router[_0x613b('0x12')](_0x613b('0xe'),auth[_0x613b('0x9')](),controller[_0x613b('0x15')]);router[_0x613b('0x12')](_0x613b('0xf'),auth[_0x613b('0x9')](),controller[_0x613b('0x16')]);router[_0x613b('0x17')]('/:id',auth[_0x613b('0x9')](),controller[_0x613b('0x18')]);router[_0x613b('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x613b('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 1ae45af..8c63048 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 _0x877e=['sequelize','exports','STRING','BOOLEAN'];(function(_0x32f21f,_0x4a2a04){var _0x161272=function(_0x14671f){while(--_0x14671f){_0x32f21f['push'](_0x32f21f['shift']());}};_0x161272(++_0x4a2a04);}(_0x877e,0x1f0));var _0xe877=function(_0x122ad2,_0x5f5241){_0x122ad2=_0x122ad2-0x0;var _0x2a3b08=_0x877e[_0x122ad2];return _0x2a3b08;};'use strict';var Sequelize=require(_0xe877('0x0'));module[_0xe877('0x1')]={'name':{'type':Sequelize[_0xe877('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe877('0x2')]},'status':{'type':Sequelize[_0xe877('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xd1d8=['exports','STRING','BOOLEAN','sequelize'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xd1d8,0x1e3));var _0x8d1d=function(_0x22e11c,_0x32ef49){_0x22e11c=_0x22e11c-0x0;var _0x4fd8ed=_0xd1d8[_0x22e11c];return _0x4fd8ed;};'use strict';var Sequelize=require(_0x8d1d('0x0'));module[_0x8d1d('0x1')]={'name':{'type':Sequelize[_0x8d1d('0x2')]},'channel':{'type':Sequelize[_0x8d1d('0x2')]},'description':{'type':Sequelize[_0x8d1d('0x2')]},'status':{'type':Sequelize[_0x8d1d('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 604393d..86a6ee3 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 _0xd57b=['getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','Triggers','UserProfileResource','destroy','error','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Trigger','findAll','rows','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','TriggerAllId','getAllConditions','findOne','Condition','rawAttributes','getAnyConditions','addAction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd57b,0x1d8));var _0xbd57=function(_0x370284,_0x3348d5){_0x370284=_0x370284-0x0;var _0x1445c8=_0xd57b[_0x370284];return _0x1445c8;};'use strict';var emlformat=require(_0xbd57('0x0'));var rimraf=require(_0xbd57('0x1'));var zipdir=require(_0xbd57('0x2'));var jsonpatch=require(_0xbd57('0x3'));var rp=require(_0xbd57('0x4'));var moment=require(_0xbd57('0x5'));var BPromise=require(_0xbd57('0x6'));var Mustache=require(_0xbd57('0x7'));var util=require(_0xbd57('0x8'));var path=require('path');var sox=require(_0xbd57('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbd57('0xa'));var squel=require(_0xbd57('0xb'));var crypto=require(_0xbd57('0xc'));var jsforce=require(_0xbd57('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbd57('0xe'));var querystring=require(_0xbd57('0xf'));var Papa=require(_0xbd57('0x10'));var Redis=require(_0xbd57('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbd57('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd57('0x13'));var logger=require(_0xbd57('0x14'))(_0xbd57('0x15'));var utils=require(_0xbd57('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbd57('0x17'));var db=require(_0xbd57('0x18'))['db'];function respondWithStatusCode(_0x79ebbd,_0x33387a){_0x33387a=_0x33387a||0xcc;return function(_0x1365e2){if(_0x1365e2){return _0x79ebbd[_0xbd57('0x19')](_0x33387a);}return _0x79ebbd[_0xbd57('0x1a')](_0x33387a)[_0xbd57('0x1b')]();};}function respondWithResult(_0x5d5fde,_0x53c4ce){_0x53c4ce=_0x53c4ce||0xc8;return function(_0xfcd011){if(_0xfcd011){return _0x5d5fde[_0xbd57('0x1a')](_0x53c4ce)[_0xbd57('0x1c')](_0xfcd011);}};}function respondWithFilteredResult(_0x47d501,_0xb5cf4a){return function(_0x1176bf){if(_0x1176bf){var _0x455cd9=typeof _0xb5cf4a[_0xbd57('0x1d')]===_0xbd57('0x1e')&&typeof _0xb5cf4a[_0xbd57('0x1f')]===_0xbd57('0x1e');var _0x2944c6=_0x1176bf[_0xbd57('0x20')];var _0x2d26fd=_0x455cd9?0x0:_0xb5cf4a[_0xbd57('0x1d')];var _0x2df275=_0x455cd9?_0x1176bf['count']:_0xb5cf4a[_0xbd57('0x1d')]+_0xb5cf4a[_0xbd57('0x1f')];var _0x4b21f3;if(_0x2df275>=_0x2944c6){_0x2df275=_0x2944c6;_0x4b21f3=0xc8;}else{_0x4b21f3=0xce;}_0x47d501[_0xbd57('0x1a')](_0x4b21f3);return _0x47d501[_0xbd57('0x21')]('Content-Range',_0x2d26fd+'-'+_0x2df275+'/'+_0x2944c6)[_0xbd57('0x1c')](_0x1176bf);}return null;};}function patchUpdates(_0x2f62ba){return function(_0x3ff11f){try{jsonpatch[_0xbd57('0x22')](_0x3ff11f,_0x2f62ba,!![]);}catch(_0x5afb35){return BPromise[_0xbd57('0x23')](_0x5afb35);}return _0x3ff11f[_0xbd57('0x24')]();};}function saveUpdates(_0xf32e1c,_0x3daa96){return function(_0x5b80a0){if(_0x5b80a0){return _0x5b80a0[_0xbd57('0x25')](_0xf32e1c)[_0xbd57('0x26')](function(_0x5a14dc){return _0x5a14dc;});}return null;};}function removeEntity(_0x5f388e,_0x2fb1e1){return function(_0x53a276){if(_0x53a276){return _0x53a276['destroy']()['then'](function(){var _0x4586dc=_0x53a276[_0xbd57('0x27')]({'plain':!![]});var _0x26a94d=_0xbd57('0x28');return db[_0xbd57('0x29')][_0xbd57('0x2a')]({'where':{'type':_0x26a94d,'resourceId':_0x4586dc['id']}})[_0xbd57('0x26')](function(){return _0x53a276;});})[_0xbd57('0x26')](function(){_0x5f388e['status'](0xcc)[_0xbd57('0x1b')]();});}};}function handleEntityNotFound(_0x78fb61,_0x3b2d77){return function(_0x1292a){if(!_0x1292a){_0x78fb61['sendStatus'](0x194);}return _0x1292a;};}function handleError(_0x2257b4,_0x58af01){_0x58af01=_0x58af01||0x1f4;return function(_0x57bdf6){logger[_0xbd57('0x2b')](_0x57bdf6['stack']);if(_0x57bdf6[_0xbd57('0x2c')]){delete _0x57bdf6[_0xbd57('0x2c')];}_0x2257b4[_0xbd57('0x1a')](_0x58af01)[_0xbd57('0x2d')](_0x57bdf6);};}exports['index']=function(_0x24133b,_0x7dbdae){var _0x20e8a5={},_0x41715e={},_0x565691={'count':0x0,'rows':[]};var _0x43d49f=_[_0xbd57('0x2e')](db['Trigger']['rawAttributes'],function(_0x1ef588){return{'name':_0x1ef588[_0xbd57('0x2f')],'type':_0x1ef588[_0xbd57('0x30')][_0xbd57('0x31')]};});_0x41715e[_0xbd57('0x32')]=_[_0xbd57('0x2e')](_0x43d49f,'name');_0x41715e[_0xbd57('0x33')]=_[_0xbd57('0x34')](_0x24133b['query']);_0x41715e[_0xbd57('0x35')]=_[_0xbd57('0x36')](_0x41715e[_0xbd57('0x32')],_0x41715e[_0xbd57('0x33')]);_0x20e8a5[_0xbd57('0x37')]=_['intersection'](_0x41715e[_0xbd57('0x32')],qs[_0xbd57('0x38')](_0x24133b['query'][_0xbd57('0x38')]));_0x20e8a5[_0xbd57('0x37')]=_0x20e8a5[_0xbd57('0x37')][_0xbd57('0x39')]?_0x20e8a5['attributes']:_0x41715e[_0xbd57('0x32')];if(!_0x24133b[_0xbd57('0x33')][_0xbd57('0x3a')](_0xbd57('0x3b'))){_0x20e8a5[_0xbd57('0x1f')]=qs[_0xbd57('0x1f')](_0x24133b[_0xbd57('0x33')][_0xbd57('0x1f')]);_0x20e8a5[_0xbd57('0x1d')]=qs[_0xbd57('0x1d')](_0x24133b[_0xbd57('0x33')][_0xbd57('0x1d')]);}_0x20e8a5[_0xbd57('0x3c')]=qs[_0xbd57('0x3d')](_0x24133b[_0xbd57('0x33')][_0xbd57('0x3d')]);_0x20e8a5[_0xbd57('0x3e')]=qs[_0xbd57('0x35')](_[_0xbd57('0x3f')](_0x24133b[_0xbd57('0x33')],_0x41715e['filters']),_0x43d49f);if(_0x24133b[_0xbd57('0x33')][_0xbd57('0x40')]){_0x20e8a5[_0xbd57('0x3e')]=_[_0xbd57('0x41')](_0x20e8a5['where'],{'$or':_['map'](_0x43d49f,function(_0x4d7179){if(_0x4d7179[_0xbd57('0x30')]!==_0xbd57('0x42')){var _0x17c663={};_0x17c663[_0x4d7179[_0xbd57('0x2c')]]={'$like':'%'+_0x24133b[_0xbd57('0x33')][_0xbd57('0x40')]+'%'};return _0x17c663;}})});}_0x20e8a5=_[_0xbd57('0x41')]({},_0x20e8a5,_0x24133b[_0xbd57('0x43')]);var _0x51a061={'where':_0x20e8a5[_0xbd57('0x3e')]};return db['Trigger']['count'](_0x51a061)[_0xbd57('0x26')](function(_0x22675a){_0x565691[_0xbd57('0x20')]=_0x22675a;if(_0x24133b['query'][_0xbd57('0x44')]){_0x20e8a5[_0xbd57('0x45')]=[{'all':!![]}];}return db[_0xbd57('0x46')][_0xbd57('0x47')](_0x20e8a5);})[_0xbd57('0x26')](function(_0x402d71){_0x565691[_0xbd57('0x48')]=_0x402d71;return _0x565691;})[_0xbd57('0x26')](respondWithFilteredResult(_0x7dbdae,_0x20e8a5))[_0xbd57('0x49')](handleError(_0x7dbdae,null));};exports['show']=function(_0x38d5ad,_0x1ef7e9){var _0x28e0ff={'raw':![],'where':{'id':_0x38d5ad['params']['id']}},_0x26f5fe={};_0x26f5fe[_0xbd57('0x32')]=_['keys'](db[_0xbd57('0x46')]['rawAttributes']);_0x26f5fe[_0xbd57('0x33')]=_[_0xbd57('0x34')](_0x38d5ad['query']);_0x26f5fe[_0xbd57('0x35')]=_[_0xbd57('0x36')](_0x26f5fe[_0xbd57('0x32')],_0x26f5fe['query']);_0x28e0ff['attributes']=_[_0xbd57('0x36')](_0x26f5fe[_0xbd57('0x32')],qs[_0xbd57('0x38')](_0x38d5ad[_0xbd57('0x33')][_0xbd57('0x38')]));_0x28e0ff['attributes']=_0x28e0ff[_0xbd57('0x37')]['length']?_0x28e0ff[_0xbd57('0x37')]:_0x26f5fe[_0xbd57('0x32')];if(_0x38d5ad[_0xbd57('0x33')][_0xbd57('0x44')]){_0x28e0ff[_0xbd57('0x45')]=[{'all':!![]}];}_0x28e0ff=_[_0xbd57('0x41')]({},_0x28e0ff,_0x38d5ad[_0xbd57('0x43')]);return db[_0xbd57('0x46')][_0xbd57('0x4a')](_0x28e0ff)[_0xbd57('0x26')](handleEntityNotFound(_0x1ef7e9,null))[_0xbd57('0x26')](respondWithResult(_0x1ef7e9,null))['catch'](handleError(_0x1ef7e9,null));};exports['create']=function(_0x25d06b,_0xac0583){return db[_0xbd57('0x46')][_0xbd57('0x4b')](_0x25d06b[_0xbd57('0x4c')],{})[_0xbd57('0x26')](function(_0x27002e){var _0x182588=_0x25d06b[_0xbd57('0x4d')]['get']({'plain':!![]});if(!_0x182588)throw new Error(_0xbd57('0x4e'));if(_0x182588[_0xbd57('0x4f')]===_0xbd57('0x4d')){var _0x9cc017=_0x27002e['get']({'plain':!![]});var _0x489357='Triggers';return db[_0xbd57('0x50')]['find']({'where':{'name':_0x489357,'userProfileId':_0x182588[_0xbd57('0x51')]},'raw':!![]})[_0xbd57('0x26')](function(_0x1e830c){if(_0x1e830c&&_0x1e830c[_0xbd57('0x52')]===0x0){return db[_0xbd57('0x29')]['create']({'name':_0x9cc017[_0xbd57('0x2c')],'resourceId':_0x9cc017['id'],'type':_0x1e830c[_0xbd57('0x2c')],'sectionId':_0x1e830c['id']},{})[_0xbd57('0x26')](function(){return _0x27002e;});}else{return _0x27002e;}})[_0xbd57('0x49')](function(_0x22c5fe){logger[_0xbd57('0x2b')](_0xbd57('0x53'),_0x22c5fe);throw _0x22c5fe;});}return _0x27002e;})['then'](respondWithResult(_0xac0583,0xc9))[_0xbd57('0x49')](handleError(_0xac0583,null));};exports[_0xbd57('0x25')]=function(_0x479dcf,_0x14a95b){if(_0x479dcf[_0xbd57('0x4c')]['id']){delete _0x479dcf[_0xbd57('0x4c')]['id'];}return db[_0xbd57('0x46')]['find']({'where':{'id':_0x479dcf[_0xbd57('0x54')]['id']}})[_0xbd57('0x26')](handleEntityNotFound(_0x14a95b,null))[_0xbd57('0x26')](saveUpdates(_0x479dcf[_0xbd57('0x4c')],null))[_0xbd57('0x26')](respondWithResult(_0x14a95b,null))[_0xbd57('0x49')](handleError(_0x14a95b,null));};exports[_0xbd57('0x2a')]=function(_0x5d6392,_0xd725d5){return db[_0xbd57('0x46')][_0xbd57('0x4a')]({'where':{'id':_0x5d6392[_0xbd57('0x54')]['id']}})[_0xbd57('0x26')](handleEntityNotFound(_0xd725d5,null))[_0xbd57('0x26')](removeEntity(_0xd725d5,null))['catch'](handleError(_0xd725d5,null));};exports['addAllCondition']=function(_0x26adab,_0xd1bf9f,_0x139a00){if(_0x26adab['body']['id']){delete _0x26adab[_0xbd57('0x4c')]['id'];}return db[_0xbd57('0x46')][_0xbd57('0x4a')]({'where':{'id':_0x26adab[_0xbd57('0x54')]['id']}})['then'](handleEntityNotFound(_0xd1bf9f,null))[_0xbd57('0x26')](function(_0x4e91e3){if(_0x4e91e3){_0x26adab[_0xbd57('0x4c')][_0xbd57('0x55')]=_0x4e91e3['id'];return db['Condition'][_0xbd57('0x4b')](_0x26adab[_0xbd57('0x4c')]);}})[_0xbd57('0x26')](respondWithResult(_0xd1bf9f,null))[_0xbd57('0x49')](handleError(_0xd1bf9f,null));};exports['addAnyCondition']=function(_0x34018f,_0x2c3adb,_0x198d7f){if(_0x34018f[_0xbd57('0x4c')]['id']){delete _0x34018f[_0xbd57('0x4c')]['id'];}return db[_0xbd57('0x46')][_0xbd57('0x4a')]({'where':{'id':_0x34018f[_0xbd57('0x54')]['id']}})[_0xbd57('0x26')](handleEntityNotFound(_0x2c3adb,null))[_0xbd57('0x26')](function(_0x103f47){if(_0x103f47){_0x34018f[_0xbd57('0x4c')]['TriggerAnyId']=_0x103f47['id'];return db['Condition'][_0xbd57('0x4b')](_0x34018f[_0xbd57('0x4c')]);}})[_0xbd57('0x26')](respondWithResult(_0x2c3adb,null))[_0xbd57('0x49')](handleError(_0x2c3adb,null));};exports[_0xbd57('0x56')]=function(_0x38dc61,_0x13ff00,_0x52769f){var _0x254900={};var _0xf3c6d8={};var _0x428d2b;var _0x58d39a;return db['Trigger'][_0xbd57('0x57')]({'where':{'id':_0x38dc61[_0xbd57('0x54')]['id']}})[_0xbd57('0x26')](handleEntityNotFound(_0x13ff00,null))[_0xbd57('0x26')](function(_0x20a36a){if(_0x20a36a){_0x428d2b=_0x20a36a;_0xf3c6d8['model']=_[_0xbd57('0x34')](db[_0xbd57('0x58')][_0xbd57('0x59')]);_0xf3c6d8[_0xbd57('0x33')]=_[_0xbd57('0x34')](_0x38dc61[_0xbd57('0x33')]);_0xf3c6d8['filters']=_[_0xbd57('0x36')](_0xf3c6d8[_0xbd57('0x32')],_0xf3c6d8[_0xbd57('0x33')]);_0x254900[_0xbd57('0x37')]=_[_0xbd57('0x36')](_0xf3c6d8[_0xbd57('0x32')],qs[_0xbd57('0x38')](_0x38dc61[_0xbd57('0x33')][_0xbd57('0x38')]));_0x254900[_0xbd57('0x37')]=_0x254900[_0xbd57('0x37')][_0xbd57('0x39')]?_0x254900[_0xbd57('0x37')]:_0xf3c6d8[_0xbd57('0x32')];_0x254900[_0xbd57('0x3c')]=qs[_0xbd57('0x3d')](_0x38dc61['query'][_0xbd57('0x3d')]);_0x254900[_0xbd57('0x3e')]=qs[_0xbd57('0x35')](_[_0xbd57('0x3f')](_0x38dc61['query'],_0xf3c6d8[_0xbd57('0x35')]));if(_0x38dc61[_0xbd57('0x33')]['filter']){_0x254900['where']=_['merge'](_0x254900[_0xbd57('0x3e')],{'$or':_[_0xbd57('0x2e')](_0x254900[_0xbd57('0x37')],function(_0x4ddad2){var _0x2c4cbb={};_0x2c4cbb[_0x4ddad2]={'$like':'%'+_0x38dc61[_0xbd57('0x33')][_0xbd57('0x40')]+'%'};return _0x2c4cbb;})});}_0x254900=_[_0xbd57('0x41')]({},_0x254900,_0x38dc61['options']);return _0x428d2b[_0xbd57('0x56')](_0x254900);}})[_0xbd57('0x26')](function(_0x18b9cd){if(_0x18b9cd){_0x58d39a=_0x18b9cd[_0xbd57('0x39')];if(!_0x38dc61[_0xbd57('0x33')][_0xbd57('0x3a')]('nolimit')){_0x254900[_0xbd57('0x1f')]=qs[_0xbd57('0x1f')](_0x38dc61[_0xbd57('0x33')][_0xbd57('0x1f')]);_0x254900[_0xbd57('0x1d')]=qs[_0xbd57('0x1d')](_0x38dc61[_0xbd57('0x33')][_0xbd57('0x1d')]);}return _0x428d2b[_0xbd57('0x56')](_0x254900);}})[_0xbd57('0x26')](function(_0x1e8a05){if(_0x1e8a05){return _0x1e8a05?{'count':_0x58d39a,'rows':_0x1e8a05}:null;}})[_0xbd57('0x26')](respondWithResult(_0x13ff00,null))[_0xbd57('0x49')](handleError(_0x13ff00,null));};exports[_0xbd57('0x5a')]=function(_0x4ef5fe,_0x5cbb68,_0x1e619c){var _0x1bef31={};var _0x3d421e={};var _0x353412;var _0x5970a7;return db[_0xbd57('0x46')][_0xbd57('0x57')]({'where':{'id':_0x4ef5fe[_0xbd57('0x54')]['id']}})[_0xbd57('0x26')](handleEntityNotFound(_0x5cbb68,null))[_0xbd57('0x26')](function(_0x2a733b){if(_0x2a733b){_0x353412=_0x2a733b;_0x3d421e[_0xbd57('0x32')]=_[_0xbd57('0x34')](db[_0xbd57('0x58')][_0xbd57('0x59')]);_0x3d421e['query']=_['keys'](_0x4ef5fe['query']);_0x3d421e[_0xbd57('0x35')]=_[_0xbd57('0x36')](_0x3d421e[_0xbd57('0x32')],_0x3d421e['query']);_0x1bef31[_0xbd57('0x37')]=_[_0xbd57('0x36')](_0x3d421e[_0xbd57('0x32')],qs['fields'](_0x4ef5fe[_0xbd57('0x33')]['fields']));_0x1bef31[_0xbd57('0x37')]=_0x1bef31[_0xbd57('0x37')][_0xbd57('0x39')]?_0x1bef31[_0xbd57('0x37')]:_0x3d421e[_0xbd57('0x32')];_0x1bef31[_0xbd57('0x3c')]=qs['sort'](_0x4ef5fe['query'][_0xbd57('0x3d')]);_0x1bef31[_0xbd57('0x3e')]=qs[_0xbd57('0x35')](_[_0xbd57('0x3f')](_0x4ef5fe[_0xbd57('0x33')],_0x3d421e[_0xbd57('0x35')]));if(_0x4ef5fe['query'][_0xbd57('0x40')]){_0x1bef31[_0xbd57('0x3e')]=_['merge'](_0x1bef31['where'],{'$or':_[_0xbd57('0x2e')](_0x1bef31['attributes'],function(_0x3d12e5){var _0x43212d={};_0x43212d[_0x3d12e5]={'$like':'%'+_0x4ef5fe['query']['filter']+'%'};return _0x43212d;})});}_0x1bef31=_[_0xbd57('0x41')]({},_0x1bef31,_0x4ef5fe[_0xbd57('0x43')]);return _0x353412[_0xbd57('0x5a')](_0x1bef31);}})['then'](function(_0x46a209){if(_0x46a209){_0x5970a7=_0x46a209[_0xbd57('0x39')];if(!_0x4ef5fe['query'][_0xbd57('0x3a')](_0xbd57('0x3b'))){_0x1bef31[_0xbd57('0x1f')]=qs[_0xbd57('0x1f')](_0x4ef5fe[_0xbd57('0x33')]['limit']);_0x1bef31['offset']=qs[_0xbd57('0x1d')](_0x4ef5fe[_0xbd57('0x33')][_0xbd57('0x1d')]);}return _0x353412[_0xbd57('0x5a')](_0x1bef31);}})['then'](function(_0xdf202a){if(_0xdf202a){return _0xdf202a?{'count':_0x5970a7,'rows':_0xdf202a}:null;}})[_0xbd57('0x26')](respondWithResult(_0x5cbb68,null))['catch'](handleError(_0x5cbb68,null));};exports[_0xbd57('0x5b')]=function(_0x3bec55,_0x5aa703,_0x417847){if(_0x3bec55[_0xbd57('0x4c')]['id']){delete _0x3bec55[_0xbd57('0x4c')]['id'];}return db['Trigger'][_0xbd57('0x4a')]({'where':{'id':_0x3bec55['params']['id']}})[_0xbd57('0x26')](handleEntityNotFound(_0x5aa703,null))['then'](function(_0x144b77){if(_0x144b77){_0x3bec55[_0xbd57('0x4c')]['TriggerId']=_0x144b77['id'];return db['Action'][_0xbd57('0x4b')](_0x3bec55['body']);}})[_0xbd57('0x26')](respondWithResult(_0x5aa703,null))[_0xbd57('0x49')](handleError(_0x5aa703,null));};exports[_0xbd57('0x5c')]=function(_0x4c82cd,_0x547ec6,_0x43f910){var _0x22ef80={};var _0x3c428d={};var _0x455996;var _0x276e11;return db['Trigger'][_0xbd57('0x57')]({'where':{'id':_0x4c82cd[_0xbd57('0x54')]['id']}})[_0xbd57('0x26')](handleEntityNotFound(_0x547ec6,null))['then'](function(_0x15287a){if(_0x15287a){_0x455996=_0x15287a;_0x3c428d[_0xbd57('0x32')]=_[_0xbd57('0x34')](db[_0xbd57('0x5d')][_0xbd57('0x59')]);_0x3c428d['query']=_[_0xbd57('0x34')](_0x4c82cd['query']);_0x3c428d['filters']=_[_0xbd57('0x36')](_0x3c428d[_0xbd57('0x32')],_0x3c428d[_0xbd57('0x33')]);_0x22ef80[_0xbd57('0x37')]=_[_0xbd57('0x36')](_0x3c428d['model'],qs['fields'](_0x4c82cd[_0xbd57('0x33')][_0xbd57('0x38')]));_0x22ef80[_0xbd57('0x37')]=_0x22ef80['attributes'][_0xbd57('0x39')]?_0x22ef80[_0xbd57('0x37')]:_0x3c428d[_0xbd57('0x32')];_0x22ef80['order']=qs[_0xbd57('0x3d')](_0x4c82cd[_0xbd57('0x33')][_0xbd57('0x3d')]);_0x22ef80[_0xbd57('0x3e')]=qs[_0xbd57('0x35')](_['pick'](_0x4c82cd[_0xbd57('0x33')],_0x3c428d[_0xbd57('0x35')]));if(_0x4c82cd[_0xbd57('0x33')][_0xbd57('0x40')]){_0x22ef80[_0xbd57('0x3e')]=_[_0xbd57('0x41')](_0x22ef80[_0xbd57('0x3e')],{'$or':_['map'](_0x22ef80['attributes'],function(_0x46755a){var _0x3273f3={};_0x3273f3[_0x46755a]={'$like':'%'+_0x4c82cd['query']['filter']+'%'};return _0x3273f3;})});}_0x22ef80=_['merge']({},_0x22ef80,_0x4c82cd[_0xbd57('0x43')]);return _0x455996[_0xbd57('0x5c')](_0x22ef80);}})[_0xbd57('0x26')](function(_0x2665f8){if(_0x2665f8){_0x276e11=_0x2665f8[_0xbd57('0x39')];if(!_0x4c82cd[_0xbd57('0x33')]['hasOwnProperty'](_0xbd57('0x3b'))){_0x22ef80[_0xbd57('0x1f')]=qs[_0xbd57('0x1f')](_0x4c82cd[_0xbd57('0x33')][_0xbd57('0x1f')]);_0x22ef80[_0xbd57('0x1d')]=qs['offset'](_0x4c82cd[_0xbd57('0x33')][_0xbd57('0x1d')]);}return _0x455996['getActions'](_0x22ef80);}})['then'](function(_0x368a0d){if(_0x368a0d){return _0x368a0d?{'count':_0x276e11,'rows':_0x368a0d}:null;}})[_0xbd57('0x26')](respondWithResult(_0x547ec6,null))['catch'](handleError(_0x547ec6,null));}; \ No newline at end of file +var _0xc5c7=['getAnyConditions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','then','destroy','Triggers','UserProfileResource','error','stack','send','index','map','Trigger','rawAttributes','fieldName','key','name','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','catch','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','update','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','pick','hasOwnProperty'];(function(_0x83af7f,_0x49c6fd){var _0x32d85c=function(_0xf0e8bc){while(--_0xf0e8bc){_0x83af7f['push'](_0x83af7f['shift']());}};_0x32d85c(++_0x49c6fd);}(_0xc5c7,0x11a));var _0x7c5c=function(_0x362057,_0x5e6dab){_0x362057=_0x362057-0x0;var _0x26b192=_0xc5c7[_0x362057];return _0x26b192;};'use strict';var emlformat=require(_0x7c5c('0x0'));var rimraf=require(_0x7c5c('0x1'));var zipdir=require(_0x7c5c('0x2'));var jsonpatch=require(_0x7c5c('0x3'));var rp=require(_0x7c5c('0x4'));var moment=require(_0x7c5c('0x5'));var BPromise=require(_0x7c5c('0x6'));var Mustache=require(_0x7c5c('0x7'));var util=require(_0x7c5c('0x8'));var path=require(_0x7c5c('0x9'));var sox=require('sox');var csv=require(_0x7c5c('0xa'));var ejs=require(_0x7c5c('0xb'));var fs=require('fs');var fs_extra=require(_0x7c5c('0xc'));var _=require('lodash');var squel=require(_0x7c5c('0xd'));var crypto=require(_0x7c5c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7c5c('0xf'));var toCsv=require(_0x7c5c('0xa'));var querystring=require(_0x7c5c('0x10'));var Papa=require('papaparse');var Redis=require(_0x7c5c('0x11'));var authService=require(_0x7c5c('0x12'));var qs=require(_0x7c5c('0x13'));var as=require(_0x7c5c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7c5c('0x15'));var utils=require(_0x7c5c('0x16'));var config=require(_0x7c5c('0x17'));var licenseUtil=require(_0x7c5c('0x18'));var db=require(_0x7c5c('0x19'))['db'];function respondWithStatusCode(_0x4b612b,_0x1e78ad){_0x1e78ad=_0x1e78ad||0xcc;return function(_0x1cddda){if(_0x1cddda){return _0x4b612b[_0x7c5c('0x1a')](_0x1e78ad);}return _0x4b612b['status'](_0x1e78ad)[_0x7c5c('0x1b')]();};}function respondWithResult(_0x21f901,_0x2d58d0){_0x2d58d0=_0x2d58d0||0xc8;return function(_0x1971f3){if(_0x1971f3){return _0x21f901[_0x7c5c('0x1c')](_0x2d58d0)[_0x7c5c('0x1d')](_0x1971f3);}};}function respondWithFilteredResult(_0x12b81a,_0x33626b){return function(_0x4462c5){if(_0x4462c5){var _0x2d0041=typeof _0x33626b['offset']==='undefined'&&typeof _0x33626b[_0x7c5c('0x1e')]===_0x7c5c('0x1f');var _0x53650d=_0x4462c5[_0x7c5c('0x20')];var _0x2a8f49=_0x2d0041?0x0:_0x33626b[_0x7c5c('0x21')];var _0x5e1c3e=_0x2d0041?_0x4462c5[_0x7c5c('0x20')]:_0x33626b[_0x7c5c('0x21')]+_0x33626b[_0x7c5c('0x1e')];var _0x1d0634;if(_0x5e1c3e>=_0x53650d){_0x5e1c3e=_0x53650d;_0x1d0634=0xc8;}else{_0x1d0634=0xce;}_0x12b81a[_0x7c5c('0x1c')](_0x1d0634);return _0x12b81a[_0x7c5c('0x22')](_0x7c5c('0x23'),_0x2a8f49+'-'+_0x5e1c3e+'/'+_0x53650d)['json'](_0x4462c5);}return null;};}function patchUpdates(_0x21f281){return function(_0x3d33ab){try{jsonpatch[_0x7c5c('0x24')](_0x3d33ab,_0x21f281,!![]);}catch(_0x14ad84){return BPromise['reject'](_0x14ad84);}return _0x3d33ab[_0x7c5c('0x25')]();};}function saveUpdates(_0x26e262,_0x17cb8a){return function(_0x36c01d){if(_0x36c01d){return _0x36c01d['update'](_0x26e262)[_0x7c5c('0x26')](function(_0xea927){return _0xea927;});}return null;};}function removeEntity(_0x27abff,_0x517938){return function(_0x5998db){if(_0x5998db){return _0x5998db[_0x7c5c('0x27')]()[_0x7c5c('0x26')](function(){var _0x12a838=_0x5998db['get']({'plain':!![]});var _0x799963=_0x7c5c('0x28');return db[_0x7c5c('0x29')]['destroy']({'where':{'type':_0x799963,'resourceId':_0x12a838['id']}})[_0x7c5c('0x26')](function(){return _0x5998db;});})[_0x7c5c('0x26')](function(){_0x27abff[_0x7c5c('0x1c')](0xcc)[_0x7c5c('0x1b')]();});}};}function handleEntityNotFound(_0x5ea536,_0x5ba5a0){return function(_0x3fdbc5){if(!_0x3fdbc5){_0x5ea536['sendStatus'](0x194);}return _0x3fdbc5;};}function handleError(_0x6c575f,_0x7dd6b4){_0x7dd6b4=_0x7dd6b4||0x1f4;return function(_0x427f90){logger[_0x7c5c('0x2a')](_0x427f90[_0x7c5c('0x2b')]);if(_0x427f90['name']){delete _0x427f90['name'];}_0x6c575f['status'](_0x7dd6b4)[_0x7c5c('0x2c')](_0x427f90);};}exports[_0x7c5c('0x2d')]=function(_0x5a3ad0,_0x446485){var _0x5473f4={},_0x23d53f={},_0x1c090e={'count':0x0,'rows':[]};var _0x55f532=_[_0x7c5c('0x2e')](db[_0x7c5c('0x2f')][_0x7c5c('0x30')],function(_0x523013){return{'name':_0x523013[_0x7c5c('0x31')],'type':_0x523013['type'][_0x7c5c('0x32')]};});_0x23d53f['model']=_[_0x7c5c('0x2e')](_0x55f532,_0x7c5c('0x33'));_0x23d53f[_0x7c5c('0x34')]=_[_0x7c5c('0x35')](_0x5a3ad0[_0x7c5c('0x34')]);_0x23d53f[_0x7c5c('0x36')]=_[_0x7c5c('0x37')](_0x23d53f[_0x7c5c('0x38')],_0x23d53f[_0x7c5c('0x34')]);_0x5473f4['attributes']=_[_0x7c5c('0x37')](_0x23d53f['model'],qs[_0x7c5c('0x39')](_0x5a3ad0[_0x7c5c('0x34')][_0x7c5c('0x39')]));_0x5473f4[_0x7c5c('0x3a')]=_0x5473f4['attributes'][_0x7c5c('0x3b')]?_0x5473f4[_0x7c5c('0x3a')]:_0x23d53f[_0x7c5c('0x38')];if(!_0x5a3ad0[_0x7c5c('0x34')]['hasOwnProperty'](_0x7c5c('0x3c'))){_0x5473f4['limit']=qs[_0x7c5c('0x1e')](_0x5a3ad0['query'][_0x7c5c('0x1e')]);_0x5473f4[_0x7c5c('0x21')]=qs[_0x7c5c('0x21')](_0x5a3ad0[_0x7c5c('0x34')]['offset']);}_0x5473f4[_0x7c5c('0x3d')]=qs[_0x7c5c('0x3e')](_0x5a3ad0[_0x7c5c('0x34')][_0x7c5c('0x3e')]);_0x5473f4[_0x7c5c('0x3f')]=qs[_0x7c5c('0x36')](_['pick'](_0x5a3ad0['query'],_0x23d53f['filters']),_0x55f532);if(_0x5a3ad0[_0x7c5c('0x34')][_0x7c5c('0x40')]){_0x5473f4['where']=_[_0x7c5c('0x41')](_0x5473f4[_0x7c5c('0x3f')],{'$or':_[_0x7c5c('0x2e')](_0x55f532,function(_0x2c8612){if(_0x2c8612[_0x7c5c('0x42')]!==_0x7c5c('0x43')){var _0x5e4a81={};_0x5e4a81[_0x2c8612['name']]={'$like':'%'+_0x5a3ad0[_0x7c5c('0x34')]['filter']+'%'};return _0x5e4a81;}})});}_0x5473f4=_[_0x7c5c('0x41')]({},_0x5473f4,_0x5a3ad0[_0x7c5c('0x44')]);var _0x230462={'where':_0x5473f4['where']};return db[_0x7c5c('0x2f')]['count'](_0x230462)[_0x7c5c('0x26')](function(_0x3bc9d7){_0x1c090e[_0x7c5c('0x20')]=_0x3bc9d7;if(_0x5a3ad0[_0x7c5c('0x34')]['includeAll']){_0x5473f4[_0x7c5c('0x45')]=[{'all':!![]}];}return db[_0x7c5c('0x2f')]['findAll'](_0x5473f4);})['then'](function(_0x261a22){_0x1c090e['rows']=_0x261a22;return _0x1c090e;})[_0x7c5c('0x26')](respondWithFilteredResult(_0x446485,_0x5473f4))[_0x7c5c('0x46')](handleError(_0x446485,null));};exports['show']=function(_0x5e426b,_0x62ef40){var _0x393b63={'raw':![],'where':{'id':_0x5e426b[_0x7c5c('0x47')]['id']}},_0x5247d9={};_0x5247d9[_0x7c5c('0x38')]=_['keys'](db['Trigger'][_0x7c5c('0x30')]);_0x5247d9[_0x7c5c('0x34')]=_['keys'](_0x5e426b[_0x7c5c('0x34')]);_0x5247d9[_0x7c5c('0x36')]=_[_0x7c5c('0x37')](_0x5247d9[_0x7c5c('0x38')],_0x5247d9[_0x7c5c('0x34')]);_0x393b63[_0x7c5c('0x3a')]=_[_0x7c5c('0x37')](_0x5247d9[_0x7c5c('0x38')],qs['fields'](_0x5e426b[_0x7c5c('0x34')][_0x7c5c('0x39')]));_0x393b63[_0x7c5c('0x3a')]=_0x393b63[_0x7c5c('0x3a')][_0x7c5c('0x3b')]?_0x393b63[_0x7c5c('0x3a')]:_0x5247d9[_0x7c5c('0x38')];if(_0x5e426b[_0x7c5c('0x34')][_0x7c5c('0x48')]){_0x393b63[_0x7c5c('0x45')]=[{'all':!![]}];}_0x393b63=_[_0x7c5c('0x41')]({},_0x393b63,_0x5e426b[_0x7c5c('0x44')]);return db['Trigger'][_0x7c5c('0x49')](_0x393b63)[_0x7c5c('0x26')](handleEntityNotFound(_0x62ef40,null))[_0x7c5c('0x26')](respondWithResult(_0x62ef40,null))[_0x7c5c('0x46')](handleError(_0x62ef40,null));};exports[_0x7c5c('0x4a')]=function(_0x20679e,_0x11b618){return db[_0x7c5c('0x2f')]['create'](_0x20679e[_0x7c5c('0x4b')],{})[_0x7c5c('0x26')](function(_0x384de8){var _0x63de4f=_0x20679e[_0x7c5c('0x4c')][_0x7c5c('0x4d')]({'plain':!![]});if(!_0x63de4f)throw new Error(_0x7c5c('0x4e'));if(_0x63de4f['role']===_0x7c5c('0x4c')){var _0x1db9f4=_0x384de8[_0x7c5c('0x4d')]({'plain':!![]});var _0xbc325f=_0x7c5c('0x28');return db['UserProfileSection'][_0x7c5c('0x49')]({'where':{'name':_0xbc325f,'userProfileId':_0x63de4f[_0x7c5c('0x4f')]},'raw':!![]})[_0x7c5c('0x26')](function(_0x18baf2){if(_0x18baf2&&_0x18baf2[_0x7c5c('0x50')]===0x0){return db[_0x7c5c('0x29')]['create']({'name':_0x1db9f4[_0x7c5c('0x33')],'resourceId':_0x1db9f4['id'],'type':_0x18baf2[_0x7c5c('0x33')],'sectionId':_0x18baf2['id']},{})['then'](function(){return _0x384de8;});}else{return _0x384de8;}})[_0x7c5c('0x46')](function(_0x258e44){logger[_0x7c5c('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x258e44);throw _0x258e44;});}return _0x384de8;})[_0x7c5c('0x26')](respondWithResult(_0x11b618,0xc9))[_0x7c5c('0x46')](handleError(_0x11b618,null));};exports[_0x7c5c('0x51')]=function(_0xdd3c16,_0x3fc303){if(_0xdd3c16[_0x7c5c('0x4b')]['id']){delete _0xdd3c16[_0x7c5c('0x4b')]['id'];}return db[_0x7c5c('0x2f')][_0x7c5c('0x49')]({'where':{'id':_0xdd3c16[_0x7c5c('0x47')]['id']}})['then'](handleEntityNotFound(_0x3fc303,null))[_0x7c5c('0x26')](saveUpdates(_0xdd3c16['body'],null))['then'](respondWithResult(_0x3fc303,null))[_0x7c5c('0x46')](handleError(_0x3fc303,null));};exports[_0x7c5c('0x27')]=function(_0x206757,_0x34a9c4){return db[_0x7c5c('0x2f')]['find']({'where':{'id':_0x206757[_0x7c5c('0x47')]['id']}})[_0x7c5c('0x26')](handleEntityNotFound(_0x34a9c4,null))[_0x7c5c('0x26')](removeEntity(_0x34a9c4,null))[_0x7c5c('0x46')](handleError(_0x34a9c4,null));};exports['addAllCondition']=function(_0xf4c696,_0x23df64,_0xbca960){if(_0xf4c696[_0x7c5c('0x4b')]['id']){delete _0xf4c696[_0x7c5c('0x4b')]['id'];}return db[_0x7c5c('0x2f')][_0x7c5c('0x49')]({'where':{'id':_0xf4c696['params']['id']}})[_0x7c5c('0x26')](handleEntityNotFound(_0x23df64,null))[_0x7c5c('0x26')](function(_0x18c0ca){if(_0x18c0ca){_0xf4c696['body'][_0x7c5c('0x52')]=_0x18c0ca['id'];return db['Condition']['create'](_0xf4c696[_0x7c5c('0x4b')]);}})[_0x7c5c('0x26')](respondWithResult(_0x23df64,null))[_0x7c5c('0x46')](handleError(_0x23df64,null));};exports[_0x7c5c('0x53')]=function(_0xd59ceb,_0xc863b8,_0x444d1e){if(_0xd59ceb[_0x7c5c('0x4b')]['id']){delete _0xd59ceb['body']['id'];}return db[_0x7c5c('0x2f')][_0x7c5c('0x49')]({'where':{'id':_0xd59ceb['params']['id']}})[_0x7c5c('0x26')](handleEntityNotFound(_0xc863b8,null))['then'](function(_0x35fec1){if(_0x35fec1){_0xd59ceb[_0x7c5c('0x4b')][_0x7c5c('0x54')]=_0x35fec1['id'];return db[_0x7c5c('0x55')]['create'](_0xd59ceb[_0x7c5c('0x4b')]);}})[_0x7c5c('0x26')](respondWithResult(_0xc863b8,null))[_0x7c5c('0x46')](handleError(_0xc863b8,null));};exports[_0x7c5c('0x56')]=function(_0x1a0431,_0x59c329,_0x4daf9a){var _0x458aaa={};var _0xdc2dec={};var _0x4c62d3;var _0x5eab80;return db['Trigger'][_0x7c5c('0x57')]({'where':{'id':_0x1a0431[_0x7c5c('0x47')]['id']}})['then'](handleEntityNotFound(_0x59c329,null))[_0x7c5c('0x26')](function(_0x47b844){if(_0x47b844){_0x4c62d3=_0x47b844;_0xdc2dec[_0x7c5c('0x38')]=_[_0x7c5c('0x35')](db[_0x7c5c('0x55')][_0x7c5c('0x30')]);_0xdc2dec[_0x7c5c('0x34')]=_[_0x7c5c('0x35')](_0x1a0431['query']);_0xdc2dec[_0x7c5c('0x36')]=_[_0x7c5c('0x37')](_0xdc2dec[_0x7c5c('0x38')],_0xdc2dec[_0x7c5c('0x34')]);_0x458aaa[_0x7c5c('0x3a')]=_[_0x7c5c('0x37')](_0xdc2dec[_0x7c5c('0x38')],qs[_0x7c5c('0x39')](_0x1a0431['query'][_0x7c5c('0x39')]));_0x458aaa[_0x7c5c('0x3a')]=_0x458aaa['attributes'][_0x7c5c('0x3b')]?_0x458aaa['attributes']:_0xdc2dec[_0x7c5c('0x38')];_0x458aaa[_0x7c5c('0x3d')]=qs[_0x7c5c('0x3e')](_0x1a0431['query'][_0x7c5c('0x3e')]);_0x458aaa[_0x7c5c('0x3f')]=qs['filters'](_[_0x7c5c('0x58')](_0x1a0431[_0x7c5c('0x34')],_0xdc2dec[_0x7c5c('0x36')]));if(_0x1a0431['query']['filter']){_0x458aaa[_0x7c5c('0x3f')]=_[_0x7c5c('0x41')](_0x458aaa['where'],{'$or':_[_0x7c5c('0x2e')](_0x458aaa[_0x7c5c('0x3a')],function(_0x51aa22){var _0x1d4cad={};_0x1d4cad[_0x51aa22]={'$like':'%'+_0x1a0431[_0x7c5c('0x34')][_0x7c5c('0x40')]+'%'};return _0x1d4cad;})});}_0x458aaa=_[_0x7c5c('0x41')]({},_0x458aaa,_0x1a0431['options']);return _0x4c62d3[_0x7c5c('0x56')](_0x458aaa);}})['then'](function(_0x1e54fb){if(_0x1e54fb){_0x5eab80=_0x1e54fb[_0x7c5c('0x3b')];if(!_0x1a0431['query'][_0x7c5c('0x59')](_0x7c5c('0x3c'))){_0x458aaa[_0x7c5c('0x1e')]=qs['limit'](_0x1a0431[_0x7c5c('0x34')][_0x7c5c('0x1e')]);_0x458aaa[_0x7c5c('0x21')]=qs[_0x7c5c('0x21')](_0x1a0431[_0x7c5c('0x34')][_0x7c5c('0x21')]);}return _0x4c62d3['getAllConditions'](_0x458aaa);}})[_0x7c5c('0x26')](function(_0x29e03c){if(_0x29e03c){return _0x29e03c?{'count':_0x5eab80,'rows':_0x29e03c}:null;}})[_0x7c5c('0x26')](respondWithResult(_0x59c329,null))[_0x7c5c('0x46')](handleError(_0x59c329,null));};exports['getAnyConditions']=function(_0x5504a2,_0x2b1892,_0x504bc5){var _0x4de7f9={};var _0x3994db={};var _0x1ce9a0;var _0x5d9288;return db['Trigger'][_0x7c5c('0x57')]({'where':{'id':_0x5504a2[_0x7c5c('0x47')]['id']}})[_0x7c5c('0x26')](handleEntityNotFound(_0x2b1892,null))['then'](function(_0x430476){if(_0x430476){_0x1ce9a0=_0x430476;_0x3994db[_0x7c5c('0x38')]=_['keys'](db['Condition']['rawAttributes']);_0x3994db['query']=_[_0x7c5c('0x35')](_0x5504a2[_0x7c5c('0x34')]);_0x3994db[_0x7c5c('0x36')]=_[_0x7c5c('0x37')](_0x3994db[_0x7c5c('0x38')],_0x3994db[_0x7c5c('0x34')]);_0x4de7f9[_0x7c5c('0x3a')]=_[_0x7c5c('0x37')](_0x3994db[_0x7c5c('0x38')],qs[_0x7c5c('0x39')](_0x5504a2[_0x7c5c('0x34')][_0x7c5c('0x39')]));_0x4de7f9['attributes']=_0x4de7f9[_0x7c5c('0x3a')][_0x7c5c('0x3b')]?_0x4de7f9[_0x7c5c('0x3a')]:_0x3994db[_0x7c5c('0x38')];_0x4de7f9['order']=qs['sort'](_0x5504a2[_0x7c5c('0x34')]['sort']);_0x4de7f9[_0x7c5c('0x3f')]=qs[_0x7c5c('0x36')](_['pick'](_0x5504a2[_0x7c5c('0x34')],_0x3994db['filters']));if(_0x5504a2[_0x7c5c('0x34')][_0x7c5c('0x40')]){_0x4de7f9[_0x7c5c('0x3f')]=_[_0x7c5c('0x41')](_0x4de7f9['where'],{'$or':_[_0x7c5c('0x2e')](_0x4de7f9['attributes'],function(_0x246d08){var _0x3758d5={};_0x3758d5[_0x246d08]={'$like':'%'+_0x5504a2[_0x7c5c('0x34')]['filter']+'%'};return _0x3758d5;})});}_0x4de7f9=_['merge']({},_0x4de7f9,_0x5504a2[_0x7c5c('0x44')]);return _0x1ce9a0[_0x7c5c('0x5a')](_0x4de7f9);}})[_0x7c5c('0x26')](function(_0x3fa1e6){if(_0x3fa1e6){_0x5d9288=_0x3fa1e6[_0x7c5c('0x3b')];if(!_0x5504a2[_0x7c5c('0x34')][_0x7c5c('0x59')]('nolimit')){_0x4de7f9[_0x7c5c('0x1e')]=qs[_0x7c5c('0x1e')](_0x5504a2[_0x7c5c('0x34')][_0x7c5c('0x1e')]);_0x4de7f9[_0x7c5c('0x21')]=qs['offset'](_0x5504a2[_0x7c5c('0x34')][_0x7c5c('0x21')]);}return _0x1ce9a0[_0x7c5c('0x5a')](_0x4de7f9);}})['then'](function(_0x4bef42){if(_0x4bef42){return _0x4bef42?{'count':_0x5d9288,'rows':_0x4bef42}:null;}})[_0x7c5c('0x26')](respondWithResult(_0x2b1892,null))[_0x7c5c('0x46')](handleError(_0x2b1892,null));};exports['addAction']=function(_0x45fd35,_0x84a1dd,_0x321ac9){if(_0x45fd35[_0x7c5c('0x4b')]['id']){delete _0x45fd35[_0x7c5c('0x4b')]['id'];}return db[_0x7c5c('0x2f')][_0x7c5c('0x49')]({'where':{'id':_0x45fd35[_0x7c5c('0x47')]['id']}})[_0x7c5c('0x26')](handleEntityNotFound(_0x84a1dd,null))[_0x7c5c('0x26')](function(_0x5c3519){if(_0x5c3519){_0x45fd35[_0x7c5c('0x4b')]['TriggerId']=_0x5c3519['id'];return db['Action'][_0x7c5c('0x4a')](_0x45fd35[_0x7c5c('0x4b')]);}})[_0x7c5c('0x26')](respondWithResult(_0x84a1dd,null))[_0x7c5c('0x46')](handleError(_0x84a1dd,null));};exports['getActions']=function(_0xfccc7e,_0x74859a,_0x431154){var _0x848456={};var _0x2b744b={};var _0x3b1daa;var _0x57bd6d;return db['Trigger'][_0x7c5c('0x57')]({'where':{'id':_0xfccc7e[_0x7c5c('0x47')]['id']}})[_0x7c5c('0x26')](handleEntityNotFound(_0x74859a,null))['then'](function(_0xe8fb58){if(_0xe8fb58){_0x3b1daa=_0xe8fb58;_0x2b744b[_0x7c5c('0x38')]=_[_0x7c5c('0x35')](db[_0x7c5c('0x5b')][_0x7c5c('0x30')]);_0x2b744b[_0x7c5c('0x34')]=_['keys'](_0xfccc7e['query']);_0x2b744b[_0x7c5c('0x36')]=_[_0x7c5c('0x37')](_0x2b744b[_0x7c5c('0x38')],_0x2b744b[_0x7c5c('0x34')]);_0x848456[_0x7c5c('0x3a')]=_['intersection'](_0x2b744b['model'],qs['fields'](_0xfccc7e[_0x7c5c('0x34')][_0x7c5c('0x39')]));_0x848456['attributes']=_0x848456['attributes'][_0x7c5c('0x3b')]?_0x848456[_0x7c5c('0x3a')]:_0x2b744b['model'];_0x848456['order']=qs[_0x7c5c('0x3e')](_0xfccc7e[_0x7c5c('0x34')][_0x7c5c('0x3e')]);_0x848456[_0x7c5c('0x3f')]=qs['filters'](_[_0x7c5c('0x58')](_0xfccc7e['query'],_0x2b744b[_0x7c5c('0x36')]));if(_0xfccc7e[_0x7c5c('0x34')][_0x7c5c('0x40')]){_0x848456[_0x7c5c('0x3f')]=_[_0x7c5c('0x41')](_0x848456[_0x7c5c('0x3f')],{'$or':_['map'](_0x848456[_0x7c5c('0x3a')],function(_0x548770){var _0x2c097d={};_0x2c097d[_0x548770]={'$like':'%'+_0xfccc7e['query'][_0x7c5c('0x40')]+'%'};return _0x2c097d;})});}_0x848456=_[_0x7c5c('0x41')]({},_0x848456,_0xfccc7e['options']);return _0x3b1daa[_0x7c5c('0x5c')](_0x848456);}})[_0x7c5c('0x26')](function(_0x5a3fdb){if(_0x5a3fdb){_0x57bd6d=_0x5a3fdb[_0x7c5c('0x3b')];if(!_0xfccc7e[_0x7c5c('0x34')][_0x7c5c('0x59')](_0x7c5c('0x3c'))){_0x848456[_0x7c5c('0x1e')]=qs[_0x7c5c('0x1e')](_0xfccc7e[_0x7c5c('0x34')]['limit']);_0x848456[_0x7c5c('0x21')]=qs['offset'](_0xfccc7e['query']['offset']);}return _0x3b1daa[_0x7c5c('0x5c')](_0x848456);}})['then'](function(_0x3753ba){if(_0x3753ba){return _0x3753ba?{'count':_0x57bd6d,'rows':_0x3753ba}:null;}})[_0x7c5c('0x26')](respondWithResult(_0x74859a,null))[_0x7c5c('0x46')](handleError(_0x74859a,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 211ef4d..9fc8949 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 _0x8ebf=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','Trigger','tools_triggers'];(function(_0x506eb3,_0x5a1f1c){var _0x58efc2=function(_0x59e243){while(--_0x59e243){_0x506eb3['push'](_0x506eb3['shift']());}};_0x58efc2(++_0x5a1f1c);}(_0x8ebf,0x15c));var _0xf8eb=function(_0x420d8d,_0x78b67f){_0x420d8d=_0x420d8d-0x0;var _0x4865d7=_0x8ebf[_0x420d8d];return _0x4865d7;};'use strict';var _=require(_0xf8eb('0x0'));var util=require(_0xf8eb('0x1'));var logger=require(_0xf8eb('0x2'))('api');var moment=require(_0xf8eb('0x3'));var BPromise=require(_0xf8eb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf8eb('0x5'));var rimraf=require(_0xf8eb('0x6'));var config=require(_0xf8eb('0x7'));var attributes=require('./trigger.attributes');module[_0xf8eb('0x8')]=function(_0x36fde3,_0x4cbeaa){return _0x36fde3[_0xf8eb('0x9')](_0xf8eb('0xa'),attributes,{'tableName':_0xf8eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ab0=['exports','define','Trigger','tools_triggers','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0x4ab0,0xd5));var _0x04ab=function(_0x2490f9,_0x39e019){_0x2490f9=_0x2490f9-0x0;var _0x2b12a2=_0x4ab0[_0x2490f9];return _0x2b12a2;};'use strict';var _=require('lodash');var util=require(_0x04ab('0x0'));var logger=require(_0x04ab('0x1'))(_0x04ab('0x2'));var moment=require(_0x04ab('0x3'));var BPromise=require(_0x04ab('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x04ab('0x5'));var config=require(_0x04ab('0x6'));var attributes=require('./trigger.attributes');module[_0x04ab('0x7')]=function(_0x2c5730,_0x4edd2e){return _0x2c5730[_0x04ab('0x8')](_0x04ab('0x9'),attributes,{'tableName':_0x04ab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 38c42be..3640372 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 _0x8714=['catch','GetTrigger','Trigger','options','raw','where','attributes','limit','include','map','model','ShowTrigger','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x56e813,_0x2f7fe0){var _0x2ae2a4=function(_0x526bfd){while(--_0x526bfd){_0x56e813['push'](_0x56e813['shift']());}};_0x2ae2a4(++_0x2f7fe0);}(_0x8714,0x99));var _0x4871=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x8714[_0x550d12];return _0x12103d;};'use strict';var _=require(_0x4871('0x0'));var util=require(_0x4871('0x1'));var moment=require(_0x4871('0x2'));var BPromise=require(_0x4871('0x3'));var rs=require(_0x4871('0x4'));var fs=require('fs');var Redis=require(_0x4871('0x5'));var db=require(_0x4871('0x6'))['db'];var utils=require(_0x4871('0x7'));var logger=require(_0x4871('0x8'))(_0x4871('0x9'));var config=require('../../config/environment');var jayson=require(_0x4871('0xa'));var client=jayson['client'][_0x4871('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47a319,_0x2b738c,_0x700267){return new BPromise(function(_0x4bd313,_0x3805a2){return client[_0x4871('0xc')](_0x47a319,_0x700267)[_0x4871('0xd')](function(_0x271cc4){logger[_0x4871('0xe')](_0x4871('0xf'),_0x2b738c,_0x4871('0x10'));logger[_0x4871('0x11')](_0x4871('0x12'),_0x2b738c,_0x4871('0x10'),JSON[_0x4871('0x13')](_0x271cc4));if(_0x271cc4[_0x4871('0x14')]){if(_0x271cc4[_0x4871('0x14')]['code']===0x1f4){logger[_0x4871('0x14')](_0x4871('0xf'),_0x2b738c,_0x271cc4[_0x4871('0x14')]['message']);return _0x3805a2(_0x271cc4[_0x4871('0x14')][_0x4871('0x15')]);}logger[_0x4871('0x14')]('Trigger,\x20%s,\x20%s',_0x2b738c,_0x271cc4[_0x4871('0x14')][_0x4871('0x15')]);return _0x4bd313(_0x271cc4['error'][_0x4871('0x15')]);}else{logger['info'](_0x4871('0xf'),_0x2b738c,_0x4871('0x10'));_0x4bd313(_0x271cc4['result'][_0x4871('0x15')]);}})[_0x4871('0x16')](function(_0x4798ee){logger['error'](_0x4871('0xf'),_0x2b738c,_0x4798ee);_0x3805a2(_0x4798ee);});});}exports[_0x4871('0x17')]=function(_0x4c31f5){var _0x5dd7ad=this;return new Promise(function(_0x1cef25,_0x558e84){return db[_0x4871('0x18')]['findAll']({'raw':_0x4c31f5[_0x4871('0x19')]?_0x4c31f5[_0x4871('0x19')][_0x4871('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c31f5[_0x4871('0x19')]?_0x4c31f5[_0x4871('0x19')][_0x4871('0x1b')]||null:null,'attributes':_0x4c31f5[_0x4871('0x19')]?_0x4c31f5[_0x4871('0x19')][_0x4871('0x1c')]||null:null,'limit':_0x4c31f5[_0x4871('0x19')]?_0x4c31f5[_0x4871('0x19')][_0x4871('0x1d')]||null:null,'include':_0x4c31f5[_0x4871('0x19')]?_0x4c31f5[_0x4871('0x19')][_0x4871('0x1e')]?_[_0x4871('0x1f')](_0x4c31f5[_0x4871('0x19')]['include'],function(_0x172230){return{'model':db[_0x172230['model']],'as':_0x172230['as'],'attributes':_0x172230[_0x4871('0x1c')],'include':_0x172230[_0x4871('0x1e')]?_[_0x4871('0x1f')](_0x172230['include'],function(_0x2208af){return{'model':db[_0x2208af[_0x4871('0x20')]],'as':_0x2208af['as'],'attributes':_0x2208af[_0x4871('0x1c')],'include':_0x2208af[_0x4871('0x1e')]?_['map'](_0x2208af[_0x4871('0x1e')],function(_0x488ed2){return{'model':db[_0x488ed2[_0x4871('0x20')]],'as':_0x488ed2['as'],'attributes':_0x488ed2[_0x4871('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4871('0xd')](function(_0x7fea27){logger[_0x4871('0xe')](_0x4871('0x17'),_0x4c31f5);logger[_0x4871('0x11')](_0x4871('0x17'),_0x4c31f5,JSON[_0x4871('0x13')](_0x7fea27));_0x1cef25(_0x7fea27);})['catch'](function(_0x41c455){logger['error'](_0x4871('0x17'),_0x41c455[_0x4871('0x15')],_0x4c31f5);_0x558e84(_0x5dd7ad['error'](0x1f4,_0x41c455[_0x4871('0x15')]));});});};exports[_0x4871('0x21')]=function(_0xba22df){var _0x47d1d1=this;return new Promise(function(_0xc351e8,_0x1d8bf0){return db['Trigger'][_0x4871('0x22')]({'raw':_0xba22df['options']?_0xba22df[_0x4871('0x19')][_0x4871('0x1a')]===undefined?!![]:![]:!![],'where':_0xba22df['options']?_0xba22df[_0x4871('0x19')][_0x4871('0x1b')]||null:null,'attributes':_0xba22df['options']?_0xba22df[_0x4871('0x19')]['attributes']||null:null,'include':_0xba22df[_0x4871('0x19')]?_0xba22df[_0x4871('0x19')]['include']?_[_0x4871('0x1f')](_0xba22df[_0x4871('0x19')][_0x4871('0x1e')],function(_0x492fd3){return{'model':db[_0x492fd3[_0x4871('0x20')]],'as':_0x492fd3['as'],'attributes':_0x492fd3[_0x4871('0x1c')],'include':_0x492fd3[_0x4871('0x1e')]?_[_0x4871('0x1f')](_0x492fd3['include'],function(_0x5f303c){return{'model':db[_0x5f303c['model']],'as':_0x5f303c['as'],'attributes':_0x5f303c['attributes'],'include':_0x5f303c[_0x4871('0x1e')]?_[_0x4871('0x1f')](_0x5f303c[_0x4871('0x1e')],function(_0x35ffad){return{'model':db[_0x35ffad[_0x4871('0x20')]],'as':_0x35ffad['as'],'attributes':_0x35ffad[_0x4871('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4871('0xd')](function(_0x222658){logger[_0x4871('0xe')](_0x4871('0x21'),_0xba22df);logger['debug']('ShowTrigger',_0xba22df,JSON[_0x4871('0x13')](_0x222658));_0xc351e8(_0x222658);})[_0x4871('0x16')](function(_0x59b316){logger['error'](_0x4871('0x21'),_0x59b316[_0x4871('0x15')],_0xba22df);_0x1d8bf0(_0x47d1d1['error'](0x1f4,_0x59b316[_0x4871('0x15')]));});});}; \ No newline at end of file +var _0x2af5=['info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetTrigger','Trigger','options','raw','where','map','include','model','attributes','then','ShowTrigger','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x487b09,_0x349b11){var _0x28830b=function(_0x51705f){while(--_0x51705f){_0x487b09['push'](_0x487b09['shift']());}};_0x28830b(++_0x349b11);}(_0x2af5,0xba));var _0x52af=function(_0x42d22a,_0xf11dd4){_0x42d22a=_0x42d22a-0x0;var _0x173c1b=_0x2af5[_0x42d22a];return _0x173c1b;};'use strict';var _=require(_0x52af('0x0'));var util=require(_0x52af('0x1'));var moment=require(_0x52af('0x2'));var BPromise=require(_0x52af('0x3'));var rs=require(_0x52af('0x4'));var fs=require('fs');var Redis=require(_0x52af('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x52af('0x6'))(_0x52af('0x7'));var config=require(_0x52af('0x8'));var jayson=require(_0x52af('0x9'));var client=jayson[_0x52af('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d0770,_0x5ee5b8,_0x378258){return new BPromise(function(_0x2f1976,_0x390440){return client[_0x52af('0xb')](_0x1d0770,_0x378258)['then'](function(_0x18afb3){logger[_0x52af('0xc')](_0x52af('0xd'),_0x5ee5b8,_0x52af('0xe'));logger[_0x52af('0xf')]('Trigger,\x20%s,\x20%s,\x20%s',_0x5ee5b8,_0x52af('0xe'),JSON[_0x52af('0x10')](_0x18afb3));if(_0x18afb3[_0x52af('0x11')]){if(_0x18afb3[_0x52af('0x11')][_0x52af('0x12')]===0x1f4){logger['error'](_0x52af('0xd'),_0x5ee5b8,_0x18afb3[_0x52af('0x11')]['message']);return _0x390440(_0x18afb3['error'][_0x52af('0x13')]);}logger[_0x52af('0x11')](_0x52af('0xd'),_0x5ee5b8,_0x18afb3[_0x52af('0x11')][_0x52af('0x13')]);return _0x2f1976(_0x18afb3[_0x52af('0x11')]['message']);}else{logger[_0x52af('0xc')](_0x52af('0xd'),_0x5ee5b8,'request\x20sent');_0x2f1976(_0x18afb3['result']['message']);}})[_0x52af('0x14')](function(_0x377007){logger[_0x52af('0x11')]('Trigger,\x20%s,\x20%s',_0x5ee5b8,_0x377007);_0x390440(_0x377007);});});}exports[_0x52af('0x15')]=function(_0xc1b3d){var _0x185ebd=this;return new Promise(function(_0x399b40,_0x24ddf7){return db[_0x52af('0x16')]['findAll']({'raw':_0xc1b3d[_0x52af('0x17')]?_0xc1b3d['options'][_0x52af('0x18')]===undefined?!![]:![]:!![],'where':_0xc1b3d[_0x52af('0x17')]?_0xc1b3d['options'][_0x52af('0x19')]||null:null,'attributes':_0xc1b3d['options']?_0xc1b3d[_0x52af('0x17')]['attributes']||null:null,'limit':_0xc1b3d['options']?_0xc1b3d[_0x52af('0x17')]['limit']||null:null,'include':_0xc1b3d[_0x52af('0x17')]?_0xc1b3d[_0x52af('0x17')]['include']?_[_0x52af('0x1a')](_0xc1b3d['options'][_0x52af('0x1b')],function(_0x27ba33){return{'model':db[_0x27ba33[_0x52af('0x1c')]],'as':_0x27ba33['as'],'attributes':_0x27ba33[_0x52af('0x1d')],'include':_0x27ba33[_0x52af('0x1b')]?_[_0x52af('0x1a')](_0x27ba33[_0x52af('0x1b')],function(_0x2a2dcc){return{'model':db[_0x2a2dcc['model']],'as':_0x2a2dcc['as'],'attributes':_0x2a2dcc[_0x52af('0x1d')],'include':_0x2a2dcc[_0x52af('0x1b')]?_['map'](_0x2a2dcc[_0x52af('0x1b')],function(_0x57544b){return{'model':db[_0x57544b[_0x52af('0x1c')]],'as':_0x57544b['as'],'attributes':_0x57544b[_0x52af('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x52af('0x1e')](function(_0x351a70){logger[_0x52af('0xc')](_0x52af('0x15'),_0xc1b3d);logger[_0x52af('0xf')]('GetTrigger',_0xc1b3d,JSON[_0x52af('0x10')](_0x351a70));_0x399b40(_0x351a70);})[_0x52af('0x14')](function(_0x38ba52){logger['error']('GetTrigger',_0x38ba52[_0x52af('0x13')],_0xc1b3d);_0x24ddf7(_0x185ebd[_0x52af('0x11')](0x1f4,_0x38ba52[_0x52af('0x13')]));});});};exports[_0x52af('0x1f')]=function(_0x23b361){var _0x4cfcc6=this;return new Promise(function(_0x494d8f,_0x4c7463){return db[_0x52af('0x16')][_0x52af('0x20')]({'raw':_0x23b361[_0x52af('0x17')]?_0x23b361[_0x52af('0x17')][_0x52af('0x18')]===undefined?!![]:![]:!![],'where':_0x23b361[_0x52af('0x17')]?_0x23b361[_0x52af('0x17')]['where']||null:null,'attributes':_0x23b361[_0x52af('0x17')]?_0x23b361['options'][_0x52af('0x1d')]||null:null,'include':_0x23b361[_0x52af('0x17')]?_0x23b361[_0x52af('0x17')]['include']?_[_0x52af('0x1a')](_0x23b361[_0x52af('0x17')][_0x52af('0x1b')],function(_0x9adb23){return{'model':db[_0x9adb23[_0x52af('0x1c')]],'as':_0x9adb23['as'],'attributes':_0x9adb23[_0x52af('0x1d')],'include':_0x9adb23[_0x52af('0x1b')]?_['map'](_0x9adb23[_0x52af('0x1b')],function(_0x64affc){return{'model':db[_0x64affc[_0x52af('0x1c')]],'as':_0x64affc['as'],'attributes':_0x64affc['attributes'],'include':_0x64affc[_0x52af('0x1b')]?_[_0x52af('0x1a')](_0x64affc[_0x52af('0x1b')],function(_0x36f3c0){return{'model':db[_0x36f3c0[_0x52af('0x1c')]],'as':_0x36f3c0['as'],'attributes':_0x36f3c0[_0x52af('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x52af('0x1e')](function(_0x379ced){logger[_0x52af('0xc')](_0x52af('0x1f'),_0x23b361);logger[_0x52af('0xf')]('ShowTrigger',_0x23b361,JSON[_0x52af('0x10')](_0x379ced));_0x494d8f(_0x379ced);})['catch'](function(_0x4dd859){logger[_0x52af('0x11')](_0x52af('0x1f'),_0x4dd859['message'],_0x23b361);_0x4c7463(_0x4cfcc6[_0x52af('0x11')](0x1f4,_0x4dd859[_0x52af('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 141d303..481d78c 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 _0xe016=['/:id','show','post','/:id/clone','clone','create','put','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x4c7911,_0x4ae3fc){var _0x21591d=function(_0x1058e3){while(--_0x1058e3){_0x4c7911['push'](_0x4c7911['shift']());}};_0x21591d(++_0x4ae3fc);}(_0xe016,0x185));var _0x6e01=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xe016[_0x45d55e];return _0x29812a;};'use strict';var multer=require('multer');var util=require(_0x6e01('0x0'));var path=require(_0x6e01('0x1'));var timeout=require(_0x6e01('0x2'));var express=require(_0x6e01('0x3'));var router=express[_0x6e01('0x4')]();var fs_extra=require(_0x6e01('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6e01('0x6'));var config=require('../../config/environment');var controller=require('./trunk.controller');router[_0x6e01('0x7')]('/',auth[_0x6e01('0x8')](),controller[_0x6e01('0x9')]);router[_0x6e01('0x7')](_0x6e01('0xa'),auth[_0x6e01('0x8')](),controller[_0x6e01('0xb')]);router[_0x6e01('0xc')](_0x6e01('0xd'),auth['isAuthenticated'](),controller[_0x6e01('0xe')]);router[_0x6e01('0xc')]('/',auth['isAuthenticated'](),controller[_0x6e01('0xf')]);router[_0x6e01('0x10')](_0x6e01('0xa'),auth[_0x6e01('0x8')](),controller['update']);router[_0x6e01('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x6e01('0x12')]);module['exports']=router; \ No newline at end of file +var _0xbbf5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','show','/:id/clone','post','create','/:id','update','delete','destroy','exports','multer','util','path','express','fs-extra'];(function(_0x3038be,_0x425d69){var _0x581d4e=function(_0x1f0731){while(--_0x1f0731){_0x3038be['push'](_0x3038be['shift']());}};_0x581d4e(++_0x425d69);}(_0xbbf5,0xa3));var _0x5bbf=function(_0xed40c3,_0x58a254){_0xed40c3=_0xed40c3-0x0;var _0x42267b=_0xbbf5[_0xed40c3];return _0x42267b;};'use strict';var multer=require(_0x5bbf('0x0'));var util=require(_0x5bbf('0x1'));var path=require(_0x5bbf('0x2'));var timeout=require('connect-timeout');var express=require(_0x5bbf('0x3'));var router=express['Router']();var fs_extra=require(_0x5bbf('0x4'));var auth=require(_0x5bbf('0x5'));var interaction=require(_0x5bbf('0x6'));var config=require(_0x5bbf('0x7'));var controller=require(_0x5bbf('0x8'));router[_0x5bbf('0x9')]('/',auth[_0x5bbf('0xa')](),controller[_0x5bbf('0xb')]);router[_0x5bbf('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x5bbf('0xc')]);router['post'](_0x5bbf('0xd'),auth[_0x5bbf('0xa')](),controller['clone']);router[_0x5bbf('0xe')]('/',auth[_0x5bbf('0xa')](),controller[_0x5bbf('0xf')]);router['put'](_0x5bbf('0x10'),auth[_0x5bbf('0xa')](),controller[_0x5bbf('0x11')]);router[_0x5bbf('0x12')](_0x5bbf('0x10'),auth['isAuthenticated'](),controller[_0x5bbf('0x13')]);module[_0x5bbf('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 41435da..29fbba1 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 _0xed3e=['PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','yes','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','passive','actpass','dynamic','nonat','update,nonat','exports','name','ENUM','friend','peer','STRING','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN'];(function(_0xb61f52,_0x1200a4){var _0x55102c=function(_0x151823){while(--_0x151823){_0xb61f52['push'](_0xb61f52['shift']());}};_0x55102c(++_0x1200a4);}(_0xed3e,0x19d));var _0xeed3=function(_0xd9caad,_0x5856b7){_0xd9caad=_0xd9caad-0x0;var _0x3127e6=_0xed3e[_0xd9caad];return _0x3127e6;};'use strict';var Sequelize=require('sequelize');module[_0xeed3('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xeed3('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xeed3('0x2')](_0xeed3('0x3'),'user',_0xeed3('0x4')),'allowNull':![],'defaultValue':_0xeed3('0x3')},'context':{'type':Sequelize[_0xeed3('0x5')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xeed3('0x2')](_0xeed3('0x6'),_0xeed3('0x7'),'ALLOWED_FAILED_SCREEN',_0xeed3('0x8'),_0xeed3('0x9'),_0xeed3('0xa'),_0xeed3('0xb'),_0xeed3('0xc'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xeed3('0x5')]},'md5secret':{'type':Sequelize[_0xeed3('0x5')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xeed3('0x5')],'defaultValue':_0xeed3('0xd'),'set':function(_0x16286b){this[_0xeed3('0xe')](_0xeed3('0xf'),_0x16286b?_0x16286b[_0xeed3('0x10')](','):null);},'get':function(){return this[_0xeed3('0x11')](_0xeed3('0xf'))?this[_0xeed3('0x11')]('transport')[_0xeed3('0x12')](','):null;},'comment':_0xeed3('0x13')},'dtmfmode':{'type':Sequelize[_0xeed3('0x2')](_0xeed3('0x14'),_0xeed3('0x15'),_0xeed3('0x16'),_0xeed3('0x17'),_0xeed3('0x18')),'defaultValue':_0xeed3('0x14')},'directmedia':{'type':Sequelize[_0xeed3('0x2')]('yes','no','nonat',_0xeed3('0x19'),_0xeed3('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xeed3('0x2')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xeed3('0x5')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xeed3('0x5')],'defaultValue':_0xeed3('0x1b'),'set':function(_0x143339){this['setDataValue'](_0xeed3('0x1c'),_0x143339?_0x143339['join'](','):null);},'get':function(){return this[_0xeed3('0x11')](_0xeed3('0x1c'))?this['getDataValue'](_0xeed3('0x1c'))[_0xeed3('0x12')](','):null;},'comment':_0xeed3('0x1d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xeed3('0x5')]},'pickupgroup':{'type':Sequelize[_0xeed3('0x5')]},'namedpickupgroup':{'type':Sequelize[_0xeed3('0x5')]},'language':{'type':Sequelize[_0xeed3('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xeed3('0x5')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xeed3('0x5')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xeed3('0x5')],'allowNull':![],'defaultValue':_0xeed3('0x1e'),'set':function(_0x5b6f7f){this['setDataValue']('allow',_0x5b6f7f?_0x5b6f7f[_0xeed3('0x10')](';'):_0xeed3('0x1e'));},'get':function(){return this['getDataValue'](_0xeed3('0x1f'))?this[_0xeed3('0x11')](_0xeed3('0x1f'))[_0xeed3('0x12')](';'):null;},'comment':_0xeed3('0x20')},'autoframing':{'type':Sequelize[_0xeed3('0x2')](_0xeed3('0x21'),'no')},'insecure':{'type':Sequelize[_0xeed3('0x5')],'defaultValue':_0xeed3('0x22'),'set':function(_0x11cec8){this[_0xeed3('0xe')](_0xeed3('0x23'),_0x11cec8?_0x11cec8[_0xeed3('0x10')](','):null);},'get':function(){return this[_0xeed3('0x11')]('insecure')?this[_0xeed3('0x11')](_0xeed3('0x23'))['split'](','):null;},'comment':_0xeed3('0x24')},'trustrpid':{'type':Sequelize[_0xeed3('0x2')](_0xeed3('0x21'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xeed3('0x21'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xeed3('0x2')](_0xeed3('0x21'),'no',_0xeed3('0x25'))},'promiscredir':{'type':Sequelize['ENUM'](_0xeed3('0x21'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0xeed3('0x21'),'no')},'accountcode':{'type':Sequelize[_0xeed3('0x26')](0xb)},'setvar':{'type':Sequelize[_0xeed3('0x5')]},'callerid':{'type':Sequelize[_0xeed3('0x5')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM'](_0xeed3('0x21'),'no'),'defaultValue':_0xeed3('0x21')},'busylevel':{'type':Sequelize[_0xeed3('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0xeed3('0x2')](_0xeed3('0x21'),'no')},'allowsubscribe':{'type':Sequelize[_0xeed3('0x2')](_0xeed3('0x21'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xeed3('0x2')](_0xeed3('0x21'),'no')},'subscribecontext':{'type':Sequelize[_0xeed3('0x5')]},'template':{'type':Sequelize[_0xeed3('0x5')]},'videosupport':{'type':Sequelize[_0xeed3('0x2')](_0xeed3('0x21'),'no',_0xeed3('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xeed3('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xeed3('0x2')]('yes','no')},'mailbox':{'type':Sequelize[_0xeed3('0x5')]},'session_timers':{'type':Sequelize[_0xeed3('0x2')](_0xeed3('0x28'),_0xeed3('0x29'),_0xeed3('0x2a'))},'session_expires':{'type':Sequelize[_0xeed3('0x26')](0xb)},'session_minse':{'type':Sequelize[_0xeed3('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0xeed3('0x2')](_0xeed3('0x2b'),'uas'),'defaultValue':_0xeed3('0x2c')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xeed3('0x5')]},'fromdomain':{'type':Sequelize[_0xeed3('0x5')]},'fromuser':{'type':Sequelize[_0xeed3('0x5')]},'port':{'type':Sequelize[_0xeed3('0x26')](0x5)},'qualify':{'type':Sequelize[_0xeed3('0x2')](_0xeed3('0x21'),'no'),'defaultValue':_0xeed3('0x21')},'keepalive':{'type':Sequelize[_0xeed3('0x26')](0xb)},'defaultip':{'type':Sequelize[_0xeed3('0x5')]},'defaultuser':{'type':Sequelize[_0xeed3('0x5')]},'rtptimeout':{'type':Sequelize[_0xeed3('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xeed3('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xeed3('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0xeed3('0x2')](_0xeed3('0x21'),'no',_0xeed3('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xeed3('0x5')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xeed3('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0xeed3('0x5')]},'contactdeny':{'type':Sequelize[_0xeed3('0x5')]},'contactacl':{'type':Sequelize[_0xeed3('0x5')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xeed3('0x26')](0xb)},'encryption':{'type':Sequelize[_0xeed3('0x2')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xeed3('0x2')](_0xeed3('0x21'),'no')},'force_avp':{'type':Sequelize[_0xeed3('0x2')](_0xeed3('0x21'),'no')},'icesupport':{'type':Sequelize[_0xeed3('0x2')](_0xeed3('0x21'),'no')},'dtlsenable':{'type':Sequelize[_0xeed3('0x2')](_0xeed3('0x21'),'no')},'dtlsverify':{'type':Sequelize[_0xeed3('0x2')]('yes','no',_0xeed3('0x2e'),_0xeed3('0x2f'))},'dtlsrekey':{'type':Sequelize[_0xeed3('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0xeed3('0x5')]},'dtlsprivatekey':{'type':Sequelize[_0xeed3('0x5')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xeed3('0x5')]},'dtlscapath':{'type':Sequelize[_0xeed3('0x5')]},'dtlssetup':{'type':Sequelize[_0xeed3('0x2')]('active',_0xeed3('0x30'),_0xeed3('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xeed3('0x5')]},'usereqphone':{'type':Sequelize[_0xeed3('0x2')](_0xeed3('0x21'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xeed3('0x5')]},'call_limit':{'type':Sequelize[_0xeed3('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xeed3('0x2')](_0xeed3('0x21'),'no')},'subscribemwi':{'type':Sequelize[_0xeed3('0x2')](_0xeed3('0x21'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xeed3('0x5')]},'mohsuggest':{'type':Sequelize[_0xeed3('0x5')]},'parkinglot':{'type':Sequelize[_0xeed3('0x5')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xeed3('0x5')],'defaultValue':_0xeed3('0x32')},'canreinvite':{'type':Sequelize[_0xeed3('0x2')](_0xeed3('0x21'),'no',_0xeed3('0x33'),_0xeed3('0x19'),_0xeed3('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xeed3('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xeed3('0x5')],'defaultValue':'no'}}; \ No newline at end of file +var _0x0952=['join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','ENUM','rfc2833','info','shortinfo','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','accept','originate','uac','uas','pai','active','actpass','dynamic','BOOLEAN','sequelize','exports','STRING','name','friend','user','peer','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_FAILED_SCREEN','udp','setDataValue','transport'];(function(_0x174374,_0x2a4c8f){var _0x1166fa=function(_0x4b19c3){while(--_0x4b19c3){_0x174374['push'](_0x174374['shift']());}};_0x1166fa(++_0x2a4c8f);}(_0x0952,0xaa));var _0x2095=function(_0x5cbd77,_0x34f7fa){_0x5cbd77=_0x5cbd77-0x0;var _0x58182a=_0x0952[_0x5cbd77];return _0x58182a;};'use strict';var Sequelize=require(_0x2095('0x0'));module[_0x2095('0x1')]={'name':{'type':Sequelize[_0x2095('0x2')],'allowNull':![],'unique':_0x2095('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x2095('0x4'),_0x2095('0x5'),_0x2095('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0x2095('0x7'),_0x2095('0x8'),_0x2095('0x9'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0x2095('0xa'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x2095('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x2095('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x2095('0x2')],'defaultValue':_0x2095('0xb'),'set':function(_0x46b90d){this[_0x2095('0xc')](_0x2095('0xd'),_0x46b90d?_0x46b90d[_0x2095('0xe')](','):null);},'get':function(){return this[_0x2095('0xf')]('transport')?this[_0x2095('0xf')](_0x2095('0xd'))['split'](','):null;},'comment':_0x2095('0x10')},'dtmfmode':{'type':Sequelize[_0x2095('0x11')](_0x2095('0x12'),_0x2095('0x13'),_0x2095('0x14'),_0x2095('0x15'),_0x2095('0x16')),'defaultValue':_0x2095('0x12')},'directmedia':{'type':Sequelize[_0x2095('0x11')](_0x2095('0x17'),'no',_0x2095('0x18'),'update',_0x2095('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2095('0x11')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x2095('0x2')],'defaultValue':_0x2095('0x1a'),'set':function(_0x520fb6){this[_0x2095('0xc')](_0x2095('0x1b'),_0x520fb6?_0x520fb6['join'](','):null);},'get':function(){return this[_0x2095('0xf')](_0x2095('0x1b'))?this[_0x2095('0xf')](_0x2095('0x1b'))[_0x2095('0x1c')](','):null;},'comment':_0x2095('0x1d')},'callgroup':{'type':Sequelize[_0x2095('0x2')]},'namedcallgroup':{'type':Sequelize[_0x2095('0x2')]},'pickupgroup':{'type':Sequelize[_0x2095('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x2095('0x2')]},'language':{'type':Sequelize[_0x2095('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2095('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0x2095('0x2')],'allowNull':![],'defaultValue':_0x2095('0x1e'),'set':function(_0x2284cc){this[_0x2095('0xc')](_0x2095('0x1f'),_0x2284cc?_0x2284cc[_0x2095('0xe')](';'):_0x2095('0x1e'));},'get':function(){return this[_0x2095('0xf')](_0x2095('0x1f'))?this[_0x2095('0xf')](_0x2095('0x1f'))[_0x2095('0x1c')](';'):null;},'comment':_0x2095('0x20')},'autoframing':{'type':Sequelize[_0x2095('0x11')]('yes','no')},'insecure':{'type':Sequelize[_0x2095('0x2')],'defaultValue':_0x2095('0x21'),'set':function(_0xcd1060){this['setDataValue'](_0x2095('0x22'),_0xcd1060?_0xcd1060[_0x2095('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x2095('0x22'))?this[_0x2095('0xf')]('insecure')[_0x2095('0x1c')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x2095('0x11')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2095('0x11')](_0x2095('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2095('0x11')](_0x2095('0x17'),'no',_0x2095('0x23'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0x2095('0x11')](_0x2095('0x17'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x2095('0x2')]},'callerid':{'type':Sequelize[_0x2095('0x2')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x2095('0x11')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x2095('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x2095('0x11')](_0x2095('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x2095('0x11')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x2095('0x11')](_0x2095('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0x2095('0x11')](_0x2095('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0x2095('0x2')]},'template':{'type':Sequelize[_0x2095('0x2')]},'videosupport':{'type':Sequelize['ENUM']('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2095('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x2095('0x17'),'no')},'mailbox':{'type':Sequelize[_0x2095('0x2')]},'session_timers':{'type':Sequelize[_0x2095('0x11')](_0x2095('0x25'),'refuse',_0x2095('0x26'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x2095('0x24')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x2095('0x27'),_0x2095('0x28')),'defaultValue':_0x2095('0x28')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x2095('0x2')]},'fromdomain':{'type':Sequelize[_0x2095('0x2')]},'fromuser':{'type':Sequelize[_0x2095('0x2')]},'port':{'type':Sequelize[_0x2095('0x24')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x2095('0x17'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x2095('0x2')]},'defaultuser':{'type':Sequelize[_0x2095('0x2')]},'rtptimeout':{'type':Sequelize[_0x2095('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2095('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x2095('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x2095('0x11')](_0x2095('0x17'),'no',_0x2095('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x2095('0x2')]},'timert1':{'type':Sequelize[_0x2095('0x24')](0xb)},'timerb':{'type':Sequelize[_0x2095('0x24')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x2095('0x2')]},'contactacl':{'type':Sequelize[_0x2095('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x2095('0x2')]},'use_q850_reason':{'type':Sequelize[_0x2095('0x2')]},'maxforwards':{'type':Sequelize[_0x2095('0x24')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x2095('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2095('0x11')](_0x2095('0x17'),'no')},'force_avp':{'type':Sequelize[_0x2095('0x11')](_0x2095('0x17'),'no')},'icesupport':{'type':Sequelize[_0x2095('0x11')](_0x2095('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0x2095('0x11')](_0x2095('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x2095('0x11')](_0x2095('0x17'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0x2095('0x24')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x2095('0x2')]},'dtlscipher':{'type':Sequelize[_0x2095('0x2')]},'dtlscafile':{'type':Sequelize[_0x2095('0x2')]},'dtlscapath':{'type':Sequelize[_0x2095('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x2095('0x2a'),'passive',_0x2095('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2095('0x2')]},'usereqphone':{'type':Sequelize[_0x2095('0x11')](_0x2095('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x2095('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2095('0x11')](_0x2095('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0x2095('0x11')](_0x2095('0x17'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x2095('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x2095('0x2')]},'description':{'type':Sequelize[_0x2095('0x2')]},'host':{'type':Sequelize[_0x2095('0x2')],'defaultValue':_0x2095('0x2c')},'canreinvite':{'type':Sequelize[_0x2095('0x11')](_0x2095('0x17'),'no',_0x2095('0x18'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2095('0x2')]},'otherFields':{'type':Sequelize[_0x2095('0x2')]},'active':{'type':Sequelize[_0x2095('0x2d')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2095('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 7ab9483..6142dae 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(_0x465d81,_0xf39305){var _0x2eb437=function(_0xe32468){while(--_0xe32468){_0x465d81['push'](_0x465d81['shift']());}};_0x2eb437(++_0xf39305);}(_0x24ca,0x1bc));var _0xa24c=function(_0x19babd,_0x1d4ef7){_0x19babd=_0x19babd-0x0;var _0x314eaf=_0x24ca[_0x19babd];return _0x314eaf;};'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 _0xd6d6=['sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','get','Trunks','UserProfileResource','stack','send','index','rawAttributes','fieldName','type','model','map','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','VIRTUAL','filter','merge','options','Trunk','includeAll','include','findAll','rows','show','params','find','clone','omit','createdAt','updatedAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','create','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','role','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch'];(function(_0x4dadce,_0x39a85e){var _0xc5997f=function(_0x54c8ab){while(--_0x54c8ab){_0x4dadce['push'](_0x4dadce['shift']());}};_0xc5997f(++_0x39a85e);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x3dde2e,_0x5e976b){_0x3dde2e=_0x3dde2e-0x0;var _0x60ff39=_0xd6d6[_0x3dde2e];return _0x60ff39;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];var jayson=require(_0x6d6d('0x19'));var client=jayson[_0x6d6d('0x1a')][_0x6d6d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2b74ed,_0x41fbdf,_0x19cf50,_0x2cb2dd){return new BPromise(function(_0x5f4154,_0xd09ea7){var _0x3dd4b3=_0x2cb2dd||client;return _0x3dd4b3[_0x6d6d('0x1c')](_0x2b74ed,_0x19cf50)[_0x6d6d('0x1d')](function(_0x29cbd8){logger['info'](_0x6d6d('0x1e'),_0x41fbdf,'request\x20sent');logger[_0x6d6d('0x1f')](_0x6d6d('0x20'),_0x41fbdf,_0x6d6d('0x21'),JSON['stringify'](_0x29cbd8));if(_0x29cbd8['error']){if(_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x23')]===0x1f4){logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x29cbd8['error']['message']);return _0xd09ea7(_0x29cbd8[_0x6d6d('0x22')]['message']);}logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x24')]);return _0x5f4154(_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x24')]);}else{logger[_0x6d6d('0x25')](_0x6d6d('0x1e'),_0x41fbdf,_0x6d6d('0x21'));_0x5f4154(_0x29cbd8[_0x6d6d('0x26')][_0x6d6d('0x24')]);}})[_0x6d6d('0x27')](function(_0x466a29){logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x466a29);_0xd09ea7(_0x466a29);});});}function respondWithStatusCode(_0x25a02e,_0xced622){_0xced622=_0xced622||0xcc;return function(_0x583b10){if(_0x583b10){return _0x25a02e[_0x6d6d('0x28')](_0xced622);}return _0x25a02e[_0x6d6d('0x29')](_0xced622)[_0x6d6d('0x2a')]();};}function respondWithResult(_0x97ec9e,_0xf0df7f){_0xf0df7f=_0xf0df7f||0xc8;return function(_0x12fab2){if(_0x12fab2){return _0x97ec9e['status'](_0xf0df7f)[_0x6d6d('0x2b')](_0x12fab2);}};}function respondWithFilteredResult(_0x2b5e31,_0x235451){return function(_0x126ac8){if(_0x126ac8){var _0x25c121=typeof _0x235451[_0x6d6d('0x2c')]===_0x6d6d('0x2d')&&typeof _0x235451['limit']===_0x6d6d('0x2d');var _0x9595d8=_0x126ac8['count'];var _0x553645=_0x25c121?0x0:_0x235451[_0x6d6d('0x2c')];var _0x5273cd=_0x25c121?_0x126ac8[_0x6d6d('0x2e')]:_0x235451['offset']+_0x235451[_0x6d6d('0x2f')];var _0x20255e;if(_0x5273cd>=_0x9595d8){_0x5273cd=_0x9595d8;_0x20255e=0xc8;}else{_0x20255e=0xce;}_0x2b5e31[_0x6d6d('0x29')](_0x20255e);return _0x2b5e31[_0x6d6d('0x30')](_0x6d6d('0x31'),_0x553645+'-'+_0x5273cd+'/'+_0x9595d8)[_0x6d6d('0x2b')](_0x126ac8);}return null;};}function patchUpdates(_0xdda3f2){return function(_0x359cfd){try{jsonpatch[_0x6d6d('0x32')](_0x359cfd,_0xdda3f2,!![]);}catch(_0x34050a){return BPromise['reject'](_0x34050a);}return _0x359cfd[_0x6d6d('0x33')]();};}function saveUpdates(_0x4f1fc5,_0x18015a){return function(_0x1ea9b2){if(_0x1ea9b2){return _0x1ea9b2[_0x6d6d('0x34')](_0x4f1fc5)[_0x6d6d('0x1d')](function(_0x5c6248){return _0x5c6248;});}return null;};}function removeEntity(_0x182441,_0x4f2f13){return function(_0x3cc702){if(_0x3cc702){return _0x3cc702[_0x6d6d('0x35')]()['then'](function(){var _0x37993f=_0x3cc702[_0x6d6d('0x36')]({'plain':!![]});var _0x37ac94=_0x6d6d('0x37');return db[_0x6d6d('0x38')][_0x6d6d('0x35')]({'where':{'type':_0x37ac94,'resourceId':_0x37993f['id']}})[_0x6d6d('0x1d')](function(){return _0x3cc702;});})[_0x6d6d('0x1d')](function(){_0x182441[_0x6d6d('0x29')](0xcc)[_0x6d6d('0x2a')]();});}};}function handleEntityNotFound(_0x2fcf88,_0x3693da){return function(_0x17d863){if(!_0x17d863){_0x2fcf88[_0x6d6d('0x28')](0x194);}return _0x17d863;};}function handleError(_0x5a2397,_0x1335ef){_0x1335ef=_0x1335ef||0x1f4;return function(_0xf98bfa){logger[_0x6d6d('0x22')](_0xf98bfa[_0x6d6d('0x39')]);if(_0xf98bfa['name']){delete _0xf98bfa['name'];}_0x5a2397[_0x6d6d('0x29')](_0x1335ef)[_0x6d6d('0x3a')](_0xf98bfa);};}exports[_0x6d6d('0x3b')]=function(_0x4d42ff,_0x2a3f67){var _0x2607c1={},_0x23c173={},_0x125d79={'count':0x0,'rows':[]};var _0x52556b=_['map'](db['Trunk'][_0x6d6d('0x3c')],function(_0x4196f0){return{'name':_0x4196f0[_0x6d6d('0x3d')],'type':_0x4196f0[_0x6d6d('0x3e')]['key']};});_0x23c173[_0x6d6d('0x3f')]=_[_0x6d6d('0x40')](_0x52556b,_0x6d6d('0x41'));_0x23c173[_0x6d6d('0x42')]=_[_0x6d6d('0x43')](_0x4d42ff[_0x6d6d('0x42')]);_0x23c173['filters']=_[_0x6d6d('0x44')](_0x23c173[_0x6d6d('0x3f')],_0x23c173[_0x6d6d('0x42')]);_0x2607c1[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x23c173[_0x6d6d('0x3f')],qs[_0x6d6d('0x46')](_0x4d42ff['query'][_0x6d6d('0x46')]));_0x2607c1[_0x6d6d('0x45')]=_0x2607c1[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x2607c1[_0x6d6d('0x45')]:_0x23c173['model'];if(!_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x48')]('nolimit')){_0x2607c1[_0x6d6d('0x2f')]=qs['limit'](_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x2f')]);_0x2607c1['offset']=qs[_0x6d6d('0x2c')](_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x2c')]);}_0x2607c1[_0x6d6d('0x49')]=qs[_0x6d6d('0x4a')](_0x4d42ff['query']['sort']);_0x2607c1[_0x6d6d('0x4b')]=qs['filters'](_['pick'](_0x4d42ff[_0x6d6d('0x42')],_0x23c173[_0x6d6d('0x4c')]),_0x52556b);if(_0x4d42ff[_0x6d6d('0x42')]['filter']){_0x2607c1[_0x6d6d('0x4b')]=_['merge'](_0x2607c1[_0x6d6d('0x4b')],{'$or':_[_0x6d6d('0x40')](_0x52556b,function(_0x1d3826){if(_0x1d3826[_0x6d6d('0x3e')]!==_0x6d6d('0x4d')){var _0x2669f0={};_0x2669f0[_0x1d3826[_0x6d6d('0x41')]]={'$like':'%'+_0x4d42ff['query'][_0x6d6d('0x4e')]+'%'};return _0x2669f0;}})});}_0x2607c1=_[_0x6d6d('0x4f')]({},_0x2607c1,_0x4d42ff[_0x6d6d('0x50')]);var _0x389e51={'where':_0x2607c1[_0x6d6d('0x4b')]};return db[_0x6d6d('0x51')][_0x6d6d('0x2e')](_0x389e51)[_0x6d6d('0x1d')](function(_0x24cec2){_0x125d79['count']=_0x24cec2;if(_0x4d42ff['query'][_0x6d6d('0x52')]){_0x2607c1[_0x6d6d('0x53')]=[{'all':!![]}];}return db[_0x6d6d('0x51')][_0x6d6d('0x54')](_0x2607c1);})[_0x6d6d('0x1d')](function(_0x492834){_0x125d79[_0x6d6d('0x55')]=_0x492834;return _0x125d79;})[_0x6d6d('0x1d')](respondWithFilteredResult(_0x2a3f67,_0x2607c1))[_0x6d6d('0x27')](handleError(_0x2a3f67,null));};exports[_0x6d6d('0x56')]=function(_0x2ee917,_0x23c2db){var _0x1f7a09={'raw':![],'where':{'id':_0x2ee917[_0x6d6d('0x57')]['id']}},_0x39ec2a={};_0x39ec2a[_0x6d6d('0x3f')]=_[_0x6d6d('0x43')](db[_0x6d6d('0x51')]['rawAttributes']);_0x39ec2a[_0x6d6d('0x42')]=_[_0x6d6d('0x43')](_0x2ee917[_0x6d6d('0x42')]);_0x39ec2a[_0x6d6d('0x4c')]=_[_0x6d6d('0x44')](_0x39ec2a['model'],_0x39ec2a[_0x6d6d('0x42')]);_0x1f7a09[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x39ec2a['model'],qs['fields'](_0x2ee917[_0x6d6d('0x42')]['fields']));_0x1f7a09[_0x6d6d('0x45')]=_0x1f7a09[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x1f7a09[_0x6d6d('0x45')]:_0x39ec2a[_0x6d6d('0x3f')];if(_0x2ee917[_0x6d6d('0x42')][_0x6d6d('0x52')]){_0x1f7a09[_0x6d6d('0x53')]=[{'all':!![]}];}_0x1f7a09=_[_0x6d6d('0x4f')]({},_0x1f7a09,_0x2ee917[_0x6d6d('0x50')]);return db['Trunk'][_0x6d6d('0x58')](_0x1f7a09)[_0x6d6d('0x1d')](handleEntityNotFound(_0x23c2db,null))[_0x6d6d('0x1d')](respondWithResult(_0x23c2db,null))[_0x6d6d('0x27')](handleError(_0x23c2db,null));};exports[_0x6d6d('0x59')]=function(_0x45f44a,_0x243be3){var _0x5e5ace={'where':{'id':_0x45f44a[_0x6d6d('0x57')]['id']}},_0x5a1cdc={};_0x5a1cdc[_0x6d6d('0x3f')]=_['keys'](db[_0x6d6d('0x51')][_0x6d6d('0x3c')]);_0x5e5ace[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x5a1cdc[_0x6d6d('0x3f')],qs[_0x6d6d('0x46')](_0x45f44a[_0x6d6d('0x42')][_0x6d6d('0x46')]));_0x5e5ace[_0x6d6d('0x45')]=_0x5e5ace[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x5e5ace[_0x6d6d('0x45')]:_0x5a1cdc[_0x6d6d('0x3f')];if(_0x45f44a[_0x6d6d('0x42')][_0x6d6d('0x52')]){_0x5e5ace['include']=[{'all':!![]}];}_0x5e5ace=_[_0x6d6d('0x4f')]({},_0x5e5ace,_0x45f44a[_0x6d6d('0x50')]);return db['Trunk'][_0x6d6d('0x58')](_0x5e5ace)[_0x6d6d('0x1d')](handleEntityNotFound(_0x243be3,null))[_0x6d6d('0x1d')](function(_0x407357){if(_0x407357){var _0x2d61cc=_0x407357[_0x6d6d('0x36')]({'plain':!![]});_0x2d61cc=qs[_0x6d6d('0x5a')](_0x2d61cc,['id',_0x6d6d('0x5b'),_0x6d6d('0x5c')]);_0x45f44a['body']=_['omit'](_0x45f44a[_0x6d6d('0x5d')],['id',_0x6d6d('0x5b'),_0x6d6d('0x5c')]);return db['Trunk']['create'](_[_0x6d6d('0x4f')](_0x2d61cc,_0x45f44a['body']),{'include':_0x45f44a[_0x6d6d('0x42')]['includeAll']?[{'all':!![]}]:undefined})[_0x6d6d('0x1d')](function(_0x367a6f){var _0x21f14c=_0x45f44a[_0x6d6d('0x5e')][_0x6d6d('0x36')]({'plain':!![]});if(!_0x21f14c)throw new Error(_0x6d6d('0x5f'));if(_0x21f14c['role']===_0x6d6d('0x5e')){var _0x5eb78f=_0x367a6f[_0x6d6d('0x36')]({'plain':!![]});var _0x52d9e7=_0x6d6d('0x37');return db[_0x6d6d('0x60')][_0x6d6d('0x58')]({'where':{'name':_0x52d9e7,'userProfileId':_0x21f14c[_0x6d6d('0x61')]},'raw':!![]})[_0x6d6d('0x1d')](function(_0x163bb7){if(_0x163bb7&&_0x163bb7[_0x6d6d('0x62')]===0x0){return db['UserProfileResource']['create']({'name':_0x5eb78f[_0x6d6d('0x41')],'resourceId':_0x5eb78f['id'],'type':_0x163bb7['name'],'sectionId':_0x163bb7['id']},{})[_0x6d6d('0x1d')](function(){return _0x367a6f;});}else{return _0x367a6f;}})['catch'](function(_0xe19d23){logger[_0x6d6d('0x22')](_0x6d6d('0x63'),_0xe19d23);throw _0xe19d23;});}return _0x367a6f;});}})[_0x6d6d('0x1d')](respondWithResult(_0x243be3,0xc9))[_0x6d6d('0x27')](handleError(_0x243be3,null));};exports[_0x6d6d('0x64')]=function(_0x5dd3b0,_0x3cedc0,_0xbca58e){var _0x3a6d79;return db[_0x6d6d('0x51')][_0x6d6d('0x64')](_0x5dd3b0[_0x6d6d('0x5d')],{'raw':!![]})[_0x6d6d('0x1d')](function(_0x589d64){_0x3a6d79=_0x589d64;return db[_0x6d6d('0x51')][_0x6d6d('0x54')]({'raw':!![]});})[_0x6d6d('0x1d')](function(_0x3bf8a7){var _0x1aa25d=fs[_0x6d6d('0x65')](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],_0x6d6d('0x68')),_0x6d6d('0x69'));var _0x1efc55=fs['readFileSync'](path['join'](config[_0x6d6d('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x5b6ca7=ejs[_0x6d6d('0x6a')](_0x1aa25d,{'trunks':_0x3bf8a7||[]});fs[_0x6d6d('0x6b')](_0x6d6d('0x6c'),_0x5b6ca7);if(_0x3a6d79[_0x6d6d('0x6d')]){var _0x2d4a04=ejs[_0x6d6d('0x6a')](_0x1efc55,{'trunks':_0x3bf8a7||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x2d4a04);}})[_0x6d6d('0x1d')](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})[_0x6d6d('0x1d')](function(){var _0x5cd494=_0x5dd3b0[_0x6d6d('0x5e')]['get']({'plain':!![]});if(!_0x5cd494)throw new Error(_0x6d6d('0x5f'));if(_0x5cd494[_0x6d6d('0x6e')]==='user'){var _0x52dca9=_0x3a6d79[_0x6d6d('0x36')]({'plain':!![]});return db[_0x6d6d('0x60')][_0x6d6d('0x58')]({'where':{'name':_0x6d6d('0x37'),'userProfileId':_0x5cd494['userProfileId']},'raw':!![]})[_0x6d6d('0x1d')](function(_0x264d24){if(_0x264d24&&_0x264d24[_0x6d6d('0x62')]===0x0){return db[_0x6d6d('0x38')]['create']({'name':_0x52dca9[_0x6d6d('0x41')],'resourceId':_0x52dca9['id'],'type':_0x264d24['name'],'sectionId':_0x264d24['id']},{})['then'](function(){return _0x3a6d79;});}else{return _0x3a6d79;}})['catch'](function(_0x3da125){logger['error'](_0x6d6d('0x63'),_0x3da125);throw _0x3da125;});}return _0x3a6d79;})[_0x6d6d('0x1d')](respondWithResult(_0x3cedc0,0xc9))[_0x6d6d('0x27')](handleError(_0x3cedc0,null));};exports['update']=function(_0x5146a4,_0x55d877,_0xcba8dd){var _0x542386;return db['Trunk'][_0x6d6d('0x58')]({'where':{'id':_0x5146a4[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x1d')](handleEntityNotFound(_0x55d877,null))[_0x6d6d('0x1d')](saveUpdates(_0x5146a4[_0x6d6d('0x5d')],null))[_0x6d6d('0x1d')](function(_0x3f9aad){if(_0x3f9aad){_0x542386=_0x3f9aad;return db['Trunk']['findAll']({'raw':!![]});}})['then'](function(_0x5c20c5){if(_0x5c20c5){var _0x54bdef=fs['readFileSync'](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],_0x6d6d('0x68')),_0x6d6d('0x69'));var _0x59998e=fs['readFileSync'](path['join'](config[_0x6d6d('0x67')],_0x6d6d('0x6f')),_0x6d6d('0x69'));var _0x1c8d15=ejs['render'](_0x54bdef,{'trunks':_0x5c20c5||[]});fs['writeFileSync'](_0x6d6d('0x6c'),_0x1c8d15);var _0x1e1c4e=ejs['render'](_0x59998e,{'trunks':_0x5c20c5||[]});fs[_0x6d6d('0x6b')](_0x6d6d('0x70'),_0x1e1c4e);return respondWithRpcPromise(_0x6d6d('0x71'),_0x6d6d('0x34'),{'module':_0x6d6d('0x72')});}return null;})['then'](function(_0xf5586f){if(_0xf5586f){return _0x542386;}})['then'](respondWithResult(_0x55d877,null))[_0x6d6d('0x27')](handleError(_0x55d877,null));};exports['destroy']=function(_0x108108,_0x54a5a9,_0x445196){var _0x1bfce6;return db[_0x6d6d('0x51')][_0x6d6d('0x58')]({'where':{'id':_0x108108[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x1d')](handleEntityNotFound(_0x54a5a9,null))[_0x6d6d('0x1d')](removeEntity(_0x54a5a9,null))[_0x6d6d('0x1d')](function(){return db[_0x6d6d('0x51')][_0x6d6d('0x54')]({'raw':!![]});})[_0x6d6d('0x1d')](function(_0xb2940d){var _0x7c1934=fs[_0x6d6d('0x65')](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],'server/files/templates/trunk.ejs'),'utf8');var _0x139b61=fs['readFileSync'](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x1d2668=ejs['render'](_0x7c1934,{'trunks':_0xb2940d});var _0x2ab52f=ejs[_0x6d6d('0x6a')](_0x139b61,{'trunks':_0xb2940d});fs[_0x6d6d('0x6b')](_0x6d6d('0x6c'),_0x1d2668);fs[_0x6d6d('0x6b')](_0x6d6d('0x70'),_0x2ab52f);return respondWithRpcPromise(_0x6d6d('0x71'),_0x6d6d('0x35'),{'module':'chan_sip.so'});})[_0x6d6d('0x27')](handleError(_0x54a5a9,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 5271c67..4f595f6 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 _0x1d49=['path','rimraf','../../config/environment','./trunk.attributes','exports','define','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2bc400,_0x27208f){var _0x36ab53=function(_0x257660){while(--_0x257660){_0x2bc400['push'](_0x2bc400['shift']());}};_0x36ab53(++_0x27208f);}(_0x1d49,0xf8));var _0x91d4=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1d49[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x91d4('0x0'))(_0x91d4('0x1'));var moment=require(_0x91d4('0x2'));var BPromise=require(_0x91d4('0x3'));var rp=require(_0x91d4('0x4'));var fs=require('fs');var path=require(_0x91d4('0x5'));var rimraf=require(_0x91d4('0x6'));var config=require(_0x91d4('0x7'));var attributes=require(_0x91d4('0x8'));module[_0x91d4('0x9')]=function(_0x3cd067,_0x9764a4){return _0x3cd067[_0x91d4('0xa')]('Trunk',attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd137=['exports','define','tools_trunks','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes'];(function(_0x472caf,_0x42c3d5){var _0x16cd58=function(_0x42d6fc){while(--_0x42d6fc){_0x472caf['push'](_0x472caf['shift']());}};_0x16cd58(++_0x42c3d5);}(_0xd137,0x10b));var _0x7d13=function(_0x5579d1,_0x3d803d){_0x5579d1=_0x5579d1-0x0;var _0x54b3d5=_0xd137[_0x5579d1];return _0x54b3d5;};'use strict';var _=require(_0x7d13('0x0'));var util=require('util');var logger=require(_0x7d13('0x1'))(_0x7d13('0x2'));var moment=require('moment');var BPromise=require(_0x7d13('0x3'));var rp=require(_0x7d13('0x4'));var fs=require('fs');var path=require(_0x7d13('0x5'));var rimraf=require(_0x7d13('0x6'));var config=require(_0x7d13('0x7'));var attributes=require(_0x7d13('0x8'));module[_0x7d13('0x9')]=function(_0x1da5b1,_0x2d78a1){return _0x1da5b1[_0x7d13('0xa')]('Trunk',attributes,{'tableName':_0x7d13('0xb'),'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 8c56ea1..a99388d 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 _0x7db2=['code','message','info','result','catch','Trunk','findAll','options','raw','where','limit','include','map','attributes','model','GetTrunk','ShowTrunk','debug','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x477fdb,_0x462b55){var _0x32beaf=function(_0x1f9528){while(--_0x1f9528){_0x477fdb['push'](_0x477fdb['shift']());}};_0x32beaf(++_0x462b55);}(_0x7db2,0x1d9));var _0x27db=function(_0x2fccf3,_0x328409){_0x2fccf3=_0x2fccf3-0x0;var _0x3205a4=_0x7db2[_0x2fccf3];return _0x3205a4;};'use strict';var _=require('lodash');var util=require(_0x27db('0x0'));var moment=require(_0x27db('0x1'));var BPromise=require(_0x27db('0x2'));var rs=require(_0x27db('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x27db('0x4'))['db'];var utils=require(_0x27db('0x5'));var logger=require(_0x27db('0x6'))('rpc');var config=require(_0x27db('0x7'));var jayson=require(_0x27db('0x8'));var client=jayson[_0x27db('0x9')][_0x27db('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47152b,_0x3c7057,_0x30ea9b){return new BPromise(function(_0x2df205,_0x36a168){return client['request'](_0x47152b,_0x30ea9b)[_0x27db('0xb')](function(_0x35a1c9){logger['info'](_0x27db('0xc'),_0x3c7057,_0x27db('0xd'));logger['debug'](_0x27db('0xe'),_0x3c7057,_0x27db('0xd'),JSON[_0x27db('0xf')](_0x35a1c9));if(_0x35a1c9[_0x27db('0x10')]){if(_0x35a1c9['error'][_0x27db('0x11')]===0x1f4){logger[_0x27db('0x10')](_0x27db('0xc'),_0x3c7057,_0x35a1c9[_0x27db('0x10')][_0x27db('0x12')]);return _0x36a168(_0x35a1c9[_0x27db('0x10')][_0x27db('0x12')]);}logger['error'](_0x27db('0xc'),_0x3c7057,_0x35a1c9[_0x27db('0x10')][_0x27db('0x12')]);return _0x2df205(_0x35a1c9[_0x27db('0x10')][_0x27db('0x12')]);}else{logger[_0x27db('0x13')](_0x27db('0xc'),_0x3c7057,_0x27db('0xd'));_0x2df205(_0x35a1c9[_0x27db('0x14')]['message']);}})[_0x27db('0x15')](function(_0x3a1dc2){logger[_0x27db('0x10')](_0x27db('0xc'),_0x3c7057,_0x3a1dc2);_0x36a168(_0x3a1dc2);});});}exports['GetTrunk']=function(_0x1d2db4){var _0x5b7624=this;return new Promise(function(_0x29aa8c,_0x3b7eb6){return db[_0x27db('0x16')][_0x27db('0x17')]({'raw':_0x1d2db4[_0x27db('0x18')]?_0x1d2db4[_0x27db('0x18')][_0x27db('0x19')]===undefined?!![]:![]:!![],'where':_0x1d2db4[_0x27db('0x18')]?_0x1d2db4[_0x27db('0x18')][_0x27db('0x1a')]||null:null,'attributes':_0x1d2db4[_0x27db('0x18')]?_0x1d2db4[_0x27db('0x18')]['attributes']||null:null,'limit':_0x1d2db4[_0x27db('0x18')]?_0x1d2db4['options'][_0x27db('0x1b')]||null:null,'include':_0x1d2db4[_0x27db('0x18')]?_0x1d2db4[_0x27db('0x18')][_0x27db('0x1c')]?_[_0x27db('0x1d')](_0x1d2db4[_0x27db('0x18')][_0x27db('0x1c')],function(_0x523a8f){return{'model':db[_0x523a8f['model']],'as':_0x523a8f['as'],'attributes':_0x523a8f[_0x27db('0x1e')],'include':_0x523a8f[_0x27db('0x1c')]?_[_0x27db('0x1d')](_0x523a8f[_0x27db('0x1c')],function(_0x56bb15){return{'model':db[_0x56bb15['model']],'as':_0x56bb15['as'],'attributes':_0x56bb15[_0x27db('0x1e')],'include':_0x56bb15['include']?_['map'](_0x56bb15[_0x27db('0x1c')],function(_0x1f2f3b){return{'model':db[_0x1f2f3b[_0x27db('0x1f')]],'as':_0x1f2f3b['as'],'attributes':_0x1f2f3b[_0x27db('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x28742a){logger['info'](_0x27db('0x20'),_0x1d2db4);logger['debug'](_0x27db('0x20'),_0x1d2db4,JSON[_0x27db('0xf')](_0x28742a));_0x29aa8c(_0x28742a);})[_0x27db('0x15')](function(_0x1e1b81){logger[_0x27db('0x10')](_0x27db('0x20'),_0x1e1b81[_0x27db('0x12')],_0x1d2db4);_0x3b7eb6(_0x5b7624[_0x27db('0x10')](0x1f4,_0x1e1b81[_0x27db('0x12')]));});});};exports[_0x27db('0x21')]=function(_0x43f821){var _0x5aeb3e=this;return new Promise(function(_0x5491f2,_0x5e5040){return db['Trunk']['find']({'raw':_0x43f821[_0x27db('0x18')]?_0x43f821['options'][_0x27db('0x19')]===undefined?!![]:![]:!![],'where':_0x43f821[_0x27db('0x18')]?_0x43f821[_0x27db('0x18')][_0x27db('0x1a')]||null:null,'attributes':_0x43f821[_0x27db('0x18')]?_0x43f821[_0x27db('0x18')][_0x27db('0x1e')]||null:null,'include':_0x43f821[_0x27db('0x18')]?_0x43f821['options']['include']?_[_0x27db('0x1d')](_0x43f821['options'][_0x27db('0x1c')],function(_0x2e6d32){return{'model':db[_0x2e6d32[_0x27db('0x1f')]],'as':_0x2e6d32['as'],'attributes':_0x2e6d32[_0x27db('0x1e')],'include':_0x2e6d32['include']?_[_0x27db('0x1d')](_0x2e6d32[_0x27db('0x1c')],function(_0x1d06ea){return{'model':db[_0x1d06ea[_0x27db('0x1f')]],'as':_0x1d06ea['as'],'attributes':_0x1d06ea[_0x27db('0x1e')],'include':_0x1d06ea[_0x27db('0x1c')]?_[_0x27db('0x1d')](_0x1d06ea[_0x27db('0x1c')],function(_0x1460d8){return{'model':db[_0x1460d8['model']],'as':_0x1460d8['as'],'attributes':_0x1460d8[_0x27db('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x490b29){logger['info']('ShowTrunk',_0x43f821);logger[_0x27db('0x22')](_0x27db('0x21'),_0x43f821,JSON[_0x27db('0xf')](_0x490b29));_0x5491f2(_0x490b29);})[_0x27db('0x15')](function(_0x4ca104){logger[_0x27db('0x10')](_0x27db('0x21'),_0x4ca104[_0x27db('0x12')],_0x43f821);_0x5e5040(_0x5aeb3e[_0x27db('0x10')](0x1f4,_0x4ca104[_0x27db('0x12')]));});});}; \ No newline at end of file +var _0xd721=['rpc','../../config/environment','jayson/promise','client','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','Trunk','findAll','options','where','attributes','limit','map','include','model','then','debug','GetTrunk','stringify','catch','ShowTrunk','find','raw','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4aa4e6,_0x278c45){var _0x322588=function(_0x19279d){while(--_0x19279d){_0x4aa4e6['push'](_0x4aa4e6['shift']());}};_0x322588(++_0x278c45);}(_0xd721,0x19e));var _0x1d72=function(_0x4d20da,_0xec96cc){_0x4d20da=_0x4d20da-0x0;var _0x488b59=_0xd721[_0x4d20da];return _0x488b59;};'use strict';var _=require(_0x1d72('0x0'));var util=require('util');var moment=require(_0x1d72('0x1'));var BPromise=require('bluebird');var rs=require(_0x1d72('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d72('0x3'))['db'];var utils=require(_0x1d72('0x4'));var logger=require(_0x1d72('0x5'))(_0x1d72('0x6'));var config=require(_0x1d72('0x7'));var jayson=require(_0x1d72('0x8'));var client=jayson[_0x1d72('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e8651,_0x22496d,_0x567cd0){return new BPromise(function(_0x718bfa,_0x491cae){return client['request'](_0x1e8651,_0x567cd0)['then'](function(_0x3b24e3){logger[_0x1d72('0xa')](_0x1d72('0xb'),_0x22496d,_0x1d72('0xc'));logger['debug'](_0x1d72('0xd'),_0x22496d,_0x1d72('0xc'),JSON['stringify'](_0x3b24e3));if(_0x3b24e3[_0x1d72('0xe')]){if(_0x3b24e3[_0x1d72('0xe')][_0x1d72('0xf')]===0x1f4){logger[_0x1d72('0xe')](_0x1d72('0xb'),_0x22496d,_0x3b24e3[_0x1d72('0xe')][_0x1d72('0x10')]);return _0x491cae(_0x3b24e3[_0x1d72('0xe')][_0x1d72('0x10')]);}logger[_0x1d72('0xe')]('Trunk,\x20%s,\x20%s',_0x22496d,_0x3b24e3[_0x1d72('0xe')][_0x1d72('0x10')]);return _0x718bfa(_0x3b24e3[_0x1d72('0xe')][_0x1d72('0x10')]);}else{logger[_0x1d72('0xa')](_0x1d72('0xb'),_0x22496d,'request\x20sent');_0x718bfa(_0x3b24e3[_0x1d72('0x11')]['message']);}})['catch'](function(_0x52e271){logger[_0x1d72('0xe')]('Trunk,\x20%s,\x20%s',_0x22496d,_0x52e271);_0x491cae(_0x52e271);});});}exports['GetTrunk']=function(_0xb0a266){var _0x42bf0f=this;return new Promise(function(_0x14ff05,_0x4362d0){return db[_0x1d72('0x12')][_0x1d72('0x13')]({'raw':_0xb0a266[_0x1d72('0x14')]?_0xb0a266[_0x1d72('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0xb0a266['options']?_0xb0a266[_0x1d72('0x14')][_0x1d72('0x15')]||null:null,'attributes':_0xb0a266[_0x1d72('0x14')]?_0xb0a266[_0x1d72('0x14')][_0x1d72('0x16')]||null:null,'limit':_0xb0a266['options']?_0xb0a266['options'][_0x1d72('0x17')]||null:null,'include':_0xb0a266[_0x1d72('0x14')]?_0xb0a266[_0x1d72('0x14')]['include']?_[_0x1d72('0x18')](_0xb0a266[_0x1d72('0x14')][_0x1d72('0x19')],function(_0x21b302){return{'model':db[_0x21b302[_0x1d72('0x1a')]],'as':_0x21b302['as'],'attributes':_0x21b302[_0x1d72('0x16')],'include':_0x21b302[_0x1d72('0x19')]?_['map'](_0x21b302[_0x1d72('0x19')],function(_0x546db7){return{'model':db[_0x546db7[_0x1d72('0x1a')]],'as':_0x546db7['as'],'attributes':_0x546db7[_0x1d72('0x16')],'include':_0x546db7[_0x1d72('0x19')]?_[_0x1d72('0x18')](_0x546db7[_0x1d72('0x19')],function(_0x3a0691){return{'model':db[_0x3a0691[_0x1d72('0x1a')]],'as':_0x3a0691['as'],'attributes':_0x3a0691['attributes']};}):[]};}):[]};}):[]:[]})[_0x1d72('0x1b')](function(_0x4546c7){logger['info']('GetTrunk',_0xb0a266);logger[_0x1d72('0x1c')](_0x1d72('0x1d'),_0xb0a266,JSON[_0x1d72('0x1e')](_0x4546c7));_0x14ff05(_0x4546c7);})[_0x1d72('0x1f')](function(_0x4bdfbc){logger['error']('GetTrunk',_0x4bdfbc['message'],_0xb0a266);_0x4362d0(_0x42bf0f[_0x1d72('0xe')](0x1f4,_0x4bdfbc[_0x1d72('0x10')]));});});};exports[_0x1d72('0x20')]=function(_0x48a788){var _0x1f9fe6=this;return new Promise(function(_0x33e6e3,_0x784bc9){return db[_0x1d72('0x12')][_0x1d72('0x21')]({'raw':_0x48a788[_0x1d72('0x14')]?_0x48a788[_0x1d72('0x14')][_0x1d72('0x22')]===undefined?!![]:![]:!![],'where':_0x48a788[_0x1d72('0x14')]?_0x48a788[_0x1d72('0x14')][_0x1d72('0x15')]||null:null,'attributes':_0x48a788[_0x1d72('0x14')]?_0x48a788[_0x1d72('0x14')][_0x1d72('0x16')]||null:null,'include':_0x48a788[_0x1d72('0x14')]?_0x48a788['options']['include']?_[_0x1d72('0x18')](_0x48a788[_0x1d72('0x14')][_0x1d72('0x19')],function(_0x3fdc01){return{'model':db[_0x3fdc01[_0x1d72('0x1a')]],'as':_0x3fdc01['as'],'attributes':_0x3fdc01[_0x1d72('0x16')],'include':_0x3fdc01['include']?_['map'](_0x3fdc01[_0x1d72('0x19')],function(_0x24406e){return{'model':db[_0x24406e['model']],'as':_0x24406e['as'],'attributes':_0x24406e[_0x1d72('0x16')],'include':_0x24406e['include']?_[_0x1d72('0x18')](_0x24406e['include'],function(_0x13448d){return{'model':db[_0x13448d[_0x1d72('0x1a')]],'as':_0x13448d['as'],'attributes':_0x13448d['attributes']};}):[]};}):[]};}):[]:[]})[_0x1d72('0x1b')](function(_0x46b909){logger['info']('ShowTrunk',_0x48a788);logger[_0x1d72('0x1c')](_0x1d72('0x20'),_0x48a788,JSON[_0x1d72('0x1e')](_0x46b909));_0x33e6e3(_0x46b909);})[_0x1d72('0x1f')](function(_0x51cacc){logger[_0x1d72('0xe')](_0x1d72('0x20'),_0x51cacc[_0x1d72('0x10')],_0x48a788);_0x784bc9(_0x1f9fe6[_0x1d72('0xe')](0x1f4,_0x51cacc[_0x1d72('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index d3eac0f..67bc7a0 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 _0x6132=['exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','bulkCreate','addQueues','diskStorage','join','root','format','%s-%s','now','file','addAvatar','/:id/login','login','/:id/logout','/:id/pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','put','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0x6132,0xef));var _0x2613=function(_0xdd20e5,_0x36c656){_0xdd20e5=_0xdd20e5-0x0;var _0x27e341=_0x6132[_0xdd20e5];return _0x27e341;};'use strict';var multer=require('multer');var util=require(_0x2613('0x0'));var path=require('path');var timeout=require(_0x2613('0x1'));var express=require(_0x2613('0x2'));var router=express['Router']();var fs_extra=require(_0x2613('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2613('0x4'));var config=require(_0x2613('0x5'));var controller=require(_0x2613('0x6'));router[_0x2613('0x7')]('/',auth[_0x2613('0x8')](),controller[_0x2613('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x2613('0xa')]);router[_0x2613('0x7')](_0x2613('0xb'),auth['isAuthenticated'](),controller[_0x2613('0xc')]);router[_0x2613('0x7')](_0x2613('0xd'),auth[_0x2613('0x8')](),controller[_0x2613('0xe')]);router[_0x2613('0x7')](_0x2613('0xf'),auth[_0x2613('0x8')](),controller[_0x2613('0x10')]);router[_0x2613('0x7')](_0x2613('0x11'),controller[_0x2613('0x12')]);router[_0x2613('0x7')](_0x2613('0x13'),auth[_0x2613('0x8')](),controller['getOpenTabs']);router[_0x2613('0x7')](_0x2613('0x14'),auth[_0x2613('0x8')](),controller[_0x2613('0x15')]);router[_0x2613('0x7')](_0x2613('0x16'),auth[_0x2613('0x8')](),controller[_0x2613('0x17')]);router[_0x2613('0x7')](_0x2613('0x18'),auth[_0x2613('0x8')](),controller[_0x2613('0x19')]);router['get'](_0x2613('0x1a'),auth['isAuthenticated'](),controller[_0x2613('0x1b')]);router[_0x2613('0x7')](_0x2613('0x1c'),auth[_0x2613('0x8')](),controller[_0x2613('0x1d')]);router['get'](_0x2613('0x1e'),auth[_0x2613('0x8')](),controller[_0x2613('0x1f')]);router['get'](_0x2613('0x20'),auth[_0x2613('0x8')](),controller[_0x2613('0x21')]);router[_0x2613('0x7')](_0x2613('0x22'),auth[_0x2613('0x8')](),controller[_0x2613('0x23')]);router[_0x2613('0x7')](_0x2613('0x24'),auth[_0x2613('0x8')](),controller[_0x2613('0x25')]);router[_0x2613('0x7')]('/:id/sms/interactions',auth[_0x2613('0x8')](),controller['getSmsInteractions']);router[_0x2613('0x7')]('/:id/fax/interactions',auth[_0x2613('0x8')](),controller[_0x2613('0x26')]);router['get'](_0x2613('0x27'),auth['isAuthenticated'](),controller[_0x2613('0x28')]);router[_0x2613('0x7')](_0x2613('0x29'),auth[_0x2613('0x8')](),controller[_0x2613('0x2a')]);router[_0x2613('0x7')](_0x2613('0x2b'),auth[_0x2613('0x8')](),controller[_0x2613('0x2c')]);router[_0x2613('0x7')]('/:id/agents',auth['isAuthenticated'](),controller[_0x2613('0x2d')]);router[_0x2613('0x7')](_0x2613('0x2e'),auth['isAuthenticated'](),controller[_0x2613('0x2f')]);router[_0x2613('0x7')](_0x2613('0x30'),auth[_0x2613('0x8')](),controller[_0x2613('0x31')]);router[_0x2613('0x7')](_0x2613('0x32'),auth[_0x2613('0x8')](),controller[_0x2613('0x33')]);router['get'](_0x2613('0x34'),auth[_0x2613('0x8')](),controller[_0x2613('0x35')]);router[_0x2613('0x7')](_0x2613('0x36'),auth[_0x2613('0x8')](),controller[_0x2613('0x37')]);router[_0x2613('0x7')](_0x2613('0x38'),auth[_0x2613('0x8')](),controller[_0x2613('0x39')]);router[_0x2613('0x7')]('/:id/whatsapp_accounts',auth[_0x2613('0x8')](),controller['getWhatsappAccounts']);router[_0x2613('0x7')](_0x2613('0x3a'),auth['isAuthenticated'](),controller[_0x2613('0x3b')]);router[_0x2613('0x7')]('/:id/scheduled_calls',auth[_0x2613('0x8')](),controller[_0x2613('0x3c')]);router[_0x2613('0x7')](_0x2613('0x3d'),auth[_0x2613('0x8')](),controller[_0x2613('0x3e')]);router[_0x2613('0x3f')](_0x2613('0x14'),auth[_0x2613('0x8')](),controller[_0x2613('0x40')]);router[_0x2613('0x3f')]('/',auth['isAuthenticated'](),controller[_0x2613('0x41')]);router[_0x2613('0x3f')]('/create_many',auth['isAuthenticated'](),controller[_0x2613('0x42')]);router[_0x2613('0x3f')](_0x2613('0x16'),auth[_0x2613('0x8')](),controller[_0x2613('0x43')]);var upload=multer({'storage':multer[_0x2613('0x44')]({'destination':function(_0x57ad5f,_0x28add5,_0x3789eb){_0x3789eb(null,path[_0x2613('0x45')](config[_0x2613('0x46')],'server/files/images/'));},'filename':function(_0x431125,_0x4afcd3,_0xda7b0b){_0xda7b0b(null,util[_0x2613('0x47')](_0x2613('0x48'),Date[_0x2613('0x49')](),_0x4afcd3['originalname']));}})});router[_0x2613('0x3f')](_0x2613('0x11'),upload['single'](_0x2613('0x4a')),controller[_0x2613('0x4b')]);router[_0x2613('0x3f')](_0x2613('0x4c'),auth['isAuthenticated'](),controller[_0x2613('0x4d')]);router[_0x2613('0x3f')](_0x2613('0x4e'),auth[_0x2613('0x8')](),controller['logout']);router['post'](_0x2613('0x4f'),auth['isAuthenticated'](),controller['pause']);router[_0x2613('0x3f')](_0x2613('0x50'),auth['isAuthenticated'](),controller[_0x2613('0x51')]);router[_0x2613('0x3f')](_0x2613('0x29'),auth[_0x2613('0x8')](),controller['addTeams']);router['post'](_0x2613('0x52'),auth[_0x2613('0x8')](),controller[_0x2613('0x53')]);router[_0x2613('0x3f')]('/:id/mail_interactions',auth[_0x2613('0x8')](),controller[_0x2613('0x54')]);router[_0x2613('0x3f')](_0x2613('0x55'),auth[_0x2613('0x8')](),controller[_0x2613('0x56')]);router[_0x2613('0x3f')](_0x2613('0x57'),auth[_0x2613('0x8')](),controller[_0x2613('0x58')]);router['post'](_0x2613('0x59'),auth[_0x2613('0x8')](),controller[_0x2613('0x5a')]);router['post'](_0x2613('0x5b'),auth['isAuthenticated'](),controller[_0x2613('0x5c')]);router[_0x2613('0x3f')](_0x2613('0x30'),auth[_0x2613('0x8')](),controller[_0x2613('0x5d')]);router['post'](_0x2613('0x32'),auth['isAuthenticated'](),controller[_0x2613('0x5e')]);router['post'](_0x2613('0x34'),auth[_0x2613('0x8')](),controller['addOpenchannelAccounts']);router[_0x2613('0x3f')](_0x2613('0x36'),auth[_0x2613('0x8')](),controller['addSmsAccounts']);router[_0x2613('0x3f')](_0x2613('0x38'),auth[_0x2613('0x8')](),controller[_0x2613('0x5f')]);router['post'](_0x2613('0x60'),auth['isAuthenticated'](),controller[_0x2613('0x61')]);router[_0x2613('0x3f')](_0x2613('0x3a'),auth['isAuthenticated'](),controller['addSquareProjects']);router[_0x2613('0x3f')](_0x2613('0x3d'),auth[_0x2613('0x8')](),controller['createApiKey']);router[_0x2613('0x62')]('/:id',auth[_0x2613('0x8')](),controller['update']);router['put'](_0x2613('0x63'),auth[_0x2613('0x8')](),controller[_0x2613('0x64')]);router[_0x2613('0x65')](_0x2613('0x16'),auth['isAuthenticated'](),controller[_0x2613('0x66')]);router[_0x2613('0x65')](_0x2613('0x29'),auth[_0x2613('0x8')](),controller[_0x2613('0x67')]);router[_0x2613('0x65')]('/:id',auth[_0x2613('0x8')](),controller[_0x2613('0x68')]);router[_0x2613('0x65')](_0x2613('0x52'),auth[_0x2613('0x8')](),controller[_0x2613('0x69')]);router[_0x2613('0x65')](_0x2613('0x6a'),auth[_0x2613('0x8')](),controller[_0x2613('0x6b')]);router[_0x2613('0x65')](_0x2613('0x55'),auth[_0x2613('0x8')](),controller[_0x2613('0x6c')]);router[_0x2613('0x65')]('/:id/sms_interactions',auth[_0x2613('0x8')](),controller[_0x2613('0x6d')]);router['delete'](_0x2613('0x59'),auth[_0x2613('0x8')](),controller[_0x2613('0x6e')]);router[_0x2613('0x65')]('/:id/whatsapp_interactions',auth[_0x2613('0x8')](),controller[_0x2613('0x6f')]);router['delete'](_0x2613('0x30'),auth[_0x2613('0x8')](),controller[_0x2613('0x70')]);router['delete'](_0x2613('0x32'),auth[_0x2613('0x8')](),controller['removeMailAccounts']);router[_0x2613('0x65')]('/:id/openchannel_accounts',auth[_0x2613('0x8')](),controller[_0x2613('0x71')]);router[_0x2613('0x65')](_0x2613('0x36'),auth[_0x2613('0x8')](),controller['removeSmsAccounts']);router['delete'](_0x2613('0x38'),auth['isAuthenticated'](),controller[_0x2613('0x72')]);router[_0x2613('0x65')]('/:id/whatsapp_accounts',auth[_0x2613('0x8')](),controller[_0x2613('0x73')]);router[_0x2613('0x65')](_0x2613('0x3a'),auth[_0x2613('0x8')](),controller[_0x2613('0x74')]);router[_0x2613('0x65')]('/:id/api_key',auth[_0x2613('0x8')](),controller[_0x2613('0x75')]);module[_0x2613('0x76')]=router; \ No newline at end of file +var _0xe00b=['connect-timeout','express','Router','fs-extra','../../config/environment','./user.controller','isAuthenticated','index','/describe','describe','get','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/mail_accounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','/:id/sms_accounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','put','update','changePassword','delete','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path'];(function(_0x3076ed,_0x23db8a){var _0x25a6a9=function(_0x24f0a3){while(--_0x24f0a3){_0x3076ed['push'](_0x3076ed['shift']());}};_0x25a6a9(++_0x23db8a);}(_0xe00b,0x73));var _0xbe00=function(_0x458837,_0x5ca8af){_0x458837=_0x458837-0x0;var _0x2d4c57=_0xe00b[_0x458837];return _0x2d4c57;};'use strict';var multer=require(_0xbe00('0x0'));var util=require(_0xbe00('0x1'));var path=require(_0xbe00('0x2'));var timeout=require(_0xbe00('0x3'));var express=require(_0xbe00('0x4'));var router=express[_0xbe00('0x5')]();var fs_extra=require(_0xbe00('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbe00('0x7'));var controller=require(_0xbe00('0x8'));router['get']('/',auth[_0xbe00('0x9')](),controller[_0xbe00('0xa')]);router['get'](_0xbe00('0xb'),auth[_0xbe00('0x9')](),controller[_0xbe00('0xc')]);router[_0xbe00('0xd')](_0xbe00('0xe'),auth[_0xbe00('0x9')](),controller[_0xbe00('0xf')]);router[_0xbe00('0xd')](_0xbe00('0x10'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x11')]);router[_0xbe00('0xd')](_0xbe00('0x12'),auth['isAuthenticated'](),controller[_0xbe00('0x13')]);router[_0xbe00('0xd')](_0xbe00('0x14'),controller[_0xbe00('0x15')]);router[_0xbe00('0xd')](_0xbe00('0x16'),auth[_0xbe00('0x9')](),controller['getOpenTabs']);router[_0xbe00('0xd')](_0xbe00('0x17'),auth[_0xbe00('0x9')](),controller['getContacts']);router[_0xbe00('0xd')](_0xbe00('0x18'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x19')]);router[_0xbe00('0xd')](_0xbe00('0x1a'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x1b')]);router[_0xbe00('0xd')](_0xbe00('0x1c'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x1d')]);router[_0xbe00('0xd')](_0xbe00('0x1e'),auth[_0xbe00('0x9')](),controller['getRecordings']);router['get'](_0xbe00('0x1f'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x20')]);router['get'](_0xbe00('0x21'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x22')]);router[_0xbe00('0xd')]('/:id/openchannel/interactions',auth[_0xbe00('0x9')](),controller['getOpenchannelInteractions']);router[_0xbe00('0xd')](_0xbe00('0x23'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x24')]);router[_0xbe00('0xd')]('/:id/sms/interactions',auth['isAuthenticated'](),controller[_0xbe00('0x25')]);router[_0xbe00('0xd')]('/:id/fax/interactions',auth[_0xbe00('0x9')](),controller['getFaxInteractions']);router[_0xbe00('0xd')](_0xbe00('0x26'),auth[_0xbe00('0x9')](),controller['getWhatsappInteractions']);router['get'](_0xbe00('0x27'),auth['isAuthenticated'](),controller[_0xbe00('0x28')]);router[_0xbe00('0xd')](_0xbe00('0x29'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x2a')]);router['get'](_0xbe00('0x2b'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x2c')]);router[_0xbe00('0xd')](_0xbe00('0x2d'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x2e')]);router[_0xbe00('0xd')]('/:id/fax_accounts',auth[_0xbe00('0x9')](),controller['getFaxAccounts']);router[_0xbe00('0xd')](_0xbe00('0x2f'),auth[_0xbe00('0x9')](),controller['getMailAccounts']);router[_0xbe00('0xd')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router['get']('/:id/sms_accounts',auth['isAuthenticated'](),controller['getSmsAccounts']);router[_0xbe00('0xd')](_0xbe00('0x30'),auth[_0xbe00('0x9')](),controller['getChatWebsites']);router[_0xbe00('0xd')](_0xbe00('0x31'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x32')]);router['get'](_0xbe00('0x33'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x34')]);router[_0xbe00('0xd')]('/:id/scheduled_calls',auth['isAuthenticated'](),controller[_0xbe00('0x35')]);router[_0xbe00('0xd')](_0xbe00('0x36'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x37')]);router[_0xbe00('0x38')]('/:id/contacts',auth[_0xbe00('0x9')](),controller[_0xbe00('0x39')]);router[_0xbe00('0x38')]('/',auth[_0xbe00('0x9')](),controller['create']);router[_0xbe00('0x38')](_0xbe00('0x3a'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x3b')]);router[_0xbe00('0x38')]('/:id/queues',auth[_0xbe00('0x9')](),controller[_0xbe00('0x3c')]);var upload=multer({'storage':multer[_0xbe00('0x3d')]({'destination':function(_0x5ce45,_0x4581c5,_0x4a8180){_0x4a8180(null,path[_0xbe00('0x3e')](config[_0xbe00('0x3f')],_0xbe00('0x40')));},'filename':function(_0x1bdd4e,_0x307009,_0x3ea35c){_0x3ea35c(null,util[_0xbe00('0x41')](_0xbe00('0x42'),Date[_0xbe00('0x43')](),_0x307009[_0xbe00('0x44')]));}})});router[_0xbe00('0x38')](_0xbe00('0x14'),upload[_0xbe00('0x45')](_0xbe00('0x46')),controller['addAvatar']);router[_0xbe00('0x38')](_0xbe00('0x47'),auth['isAuthenticated'](),controller[_0xbe00('0x48')]);router[_0xbe00('0x38')](_0xbe00('0x49'),auth['isAuthenticated'](),controller[_0xbe00('0x4a')]);router['post'](_0xbe00('0x4b'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x4c')]);router[_0xbe00('0x38')](_0xbe00('0x4d'),auth['isAuthenticated'](),controller[_0xbe00('0x4e')]);router[_0xbe00('0x38')](_0xbe00('0x27'),auth['isAuthenticated'](),controller[_0xbe00('0x4f')]);router[_0xbe00('0x38')]('/:id/chat_interactions',auth[_0xbe00('0x9')](),controller[_0xbe00('0x50')]);router[_0xbe00('0x38')](_0xbe00('0x51'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x52')]);router[_0xbe00('0x38')](_0xbe00('0x53'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x54')]);router['post'](_0xbe00('0x55'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x56')]);router['post'](_0xbe00('0x57'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x58')]);router[_0xbe00('0x38')](_0xbe00('0x59'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x5a')]);router[_0xbe00('0x38')](_0xbe00('0x5b'),auth['isAuthenticated'](),controller[_0xbe00('0x5c')]);router[_0xbe00('0x38')]('/:id/mail_accounts',auth[_0xbe00('0x9')](),controller[_0xbe00('0x5d')]);router[_0xbe00('0x38')](_0xbe00('0x5e'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x5f')]);router[_0xbe00('0x38')](_0xbe00('0x60'),auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0xbe00('0x38')](_0xbe00('0x30'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x61')]);router['post'](_0xbe00('0x31'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x62')]);router[_0xbe00('0x38')](_0xbe00('0x33'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x63')]);router[_0xbe00('0x38')](_0xbe00('0x36'),auth[_0xbe00('0x9')](),controller['createApiKey']);router[_0xbe00('0x64')]('/:id',auth[_0xbe00('0x9')](),controller[_0xbe00('0x65')]);router[_0xbe00('0x64')]('/:id/password',auth[_0xbe00('0x9')](),controller[_0xbe00('0x66')]);router['delete'](_0xbe00('0x18'),auth[_0xbe00('0x9')](),controller['removeQueues']);router[_0xbe00('0x67')](_0xbe00('0x27'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x68')]);router[_0xbe00('0x67')](_0xbe00('0x12'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x69')]);router[_0xbe00('0x67')](_0xbe00('0x6a'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x6b')]);router[_0xbe00('0x67')](_0xbe00('0x51'),auth[_0xbe00('0x9')](),controller['removeMailInteractions']);router['delete'](_0xbe00('0x53'),auth[_0xbe00('0x9')](),controller['removeFaxInteractions']);router[_0xbe00('0x67')](_0xbe00('0x55'),auth['isAuthenticated'](),controller['removeSmsInteractions']);router[_0xbe00('0x67')](_0xbe00('0x57'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x6c')]);router[_0xbe00('0x67')](_0xbe00('0x59'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x6d')]);router[_0xbe00('0x67')](_0xbe00('0x5b'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x6e')]);router[_0xbe00('0x67')](_0xbe00('0x2f'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x6f')]);router['delete'](_0xbe00('0x5e'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x70')]);router[_0xbe00('0x67')](_0xbe00('0x60'),auth[_0xbe00('0x9')](),controller['removeSmsAccounts']);router[_0xbe00('0x67')](_0xbe00('0x30'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x71')]);router[_0xbe00('0x67')](_0xbe00('0x31'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x72')]);router[_0xbe00('0x67')](_0xbe00('0x33'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x73')]);router[_0xbe00('0x67')](_0xbe00('0x36'),auth[_0xbe00('0x9')](),controller[_0xbe00('0x74')]);module[_0xbe00('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 0617eaf..8917d29 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 _0x0e42=['certificate','active','passive','actpass','update,nonat','TEXT','showWebBar','get','isArray','udp','wss','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlsprivatekey','rtcp_mux','force_avp','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','format','getDataValue','internal','email','toLowerCase','admin','user','telephone','local','INTEGER','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','insecure','never','\x22\x22\x20<>','always','accept','refuse','uac','uas'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x0e42,0x7a));var _0x20e4=function(_0x15e74d,_0x194875){_0x15e74d=_0x15e74d-0x0;var _0x2f65d7=_0x0e42[_0x15e74d];return _0x2f65d7;};'use strict';var Sequelize=require(_0x20e4('0x0'));var moment=require(_0x20e4('0x1'));var util=require(_0x20e4('0x2'));var _=require(_0x20e4('0x3'));module[_0x20e4('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x20e4('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2bda92){this[_0x20e4('0x6')]('name',_0x2bda92);this[_0x20e4('0x6')](_0x20e4('0x7'),_0x2bda92);},'comment':_0x20e4('0x8')},'fullname':{'type':Sequelize[_0x20e4('0x9')],'allowNull':![],'set':function(_0x577dad){this['setDataValue'](_0x20e4('0xa'),_0x577dad);this[_0x20e4('0x6')](_0x20e4('0xb'),util[_0x20e4('0xc')]('\x22%s\x22\x20<%s>',_0x577dad,this[_0x20e4('0xd')](_0x20e4('0xe'))));}},'alias':{'type':Sequelize[_0x20e4('0x9')]},'email':{'type':Sequelize[_0x20e4('0x9')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x32c15d){if(_0x32c15d){this['setDataValue'](_0x20e4('0xf'),_0x32c15d[_0x20e4('0x10')]());}}},'role':{'type':Sequelize['ENUM'](_0x20e4('0x11'),_0x20e4('0x12'),'agent',_0x20e4('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x20e4('0x9')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x20e4('0x9')],'defaultValue':_0x20e4('0x14')},'internal':{'type':Sequelize[_0x20e4('0x15')](0xb),'allowNull':![],'unique':'internal','set':function(_0x1fda23){this[_0x20e4('0x6')](_0x20e4('0xe'),_0x1fda23);this[_0x20e4('0x6')](_0x20e4('0x16'),_0x1fda23);this[_0x20e4('0x6')](_0x20e4('0xb'),util[_0x20e4('0xc')]('\x22%s\x22\x20<%s>',this[_0x20e4('0xd')]('fullname'),_0x1fda23));}},'salt':{'type':Sequelize[_0x20e4('0x9')]},'phone':{'type':Sequelize[_0x20e4('0x9')]},'mobile':{'type':Sequelize[_0x20e4('0x9')]},'address':{'type':Sequelize[_0x20e4('0x9')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x20e4('0x9')]},'country':{'type':Sequelize[_0x20e4('0x9')]},'online':{'type':Sequelize[_0x20e4('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x20e4('0x18')]},'voicePause':{'type':Sequelize[_0x20e4('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x20e4('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x20e4('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x20e4('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x20e4('0x9')],'defaultValue':_0x20e4('0x19')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x20e4('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x20e4('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x20e4('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x20e4('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x20e4('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x20e4('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x20e4('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x20e4('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x20e4('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x20e4('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x20e4('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x20e4('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x20e4('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![],'defaultValue':_0x20e4('0x1a')},'ipaddr':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'port':{'type':Sequelize[_0x20e4('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x20e4('0x1b')](_0x20e4('0x1c'),'user',_0x20e4('0x1d')),'allowNull':!![],'defaultValue':_0x20e4('0x1c')},'context':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![],'defaultValue':_0x20e4('0x1e')},'callingpres':{'type':Sequelize['ENUM'](_0x20e4('0x1f'),_0x20e4('0x20'),_0x20e4('0x21'),_0x20e4('0x22'),_0x20e4('0x23'),_0x20e4('0x24'),_0x20e4('0x25'),_0x20e4('0x26')),'allowNull':!![]},'deny':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'permit':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'transport':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![],'defaultValue':'udp','set':function(_0x45c5dd){this[_0x20e4('0x6')](_0x20e4('0x27'),_0x45c5dd?_0x45c5dd[_0x20e4('0x28')](','):null);},'get':function(){return this[_0x20e4('0xd')](_0x20e4('0x27'))?this[_0x20e4('0xd')](_0x20e4('0x27'))[_0x20e4('0x29')](','):null;},'comment':_0x20e4('0x2a')},'dtmfmode':{'type':Sequelize[_0x20e4('0x1b')](_0x20e4('0x2b'),_0x20e4('0x2c'),_0x20e4('0x2d'),_0x20e4('0x2e'),_0x20e4('0x2f')),'allowNull':!![],'defaultValue':_0x20e4('0x2b')},'directmedia':{'type':Sequelize['ENUM'](_0x20e4('0x30'),'no',_0x20e4('0x31'),_0x20e4('0x32'),_0x20e4('0x33')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x20e4('0x30'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'nat':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x58455d){this[_0x20e4('0x6')](_0x20e4('0x34'),_0x58455d?_0x58455d['join'](','):null);},'get':function(){return this[_0x20e4('0xd')](_0x20e4('0x34'))?this[_0x20e4('0xd')](_0x20e4('0x34'))[_0x20e4('0x29')](','):null;},'comment':_0x20e4('0x35')},'callgroup':{'type':Sequelize[_0x20e4('0x9')]},'namedcallgroup':{'type':Sequelize[_0x20e4('0x9')]},'pickupgroup':{'type':Sequelize[_0x20e4('0x9')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x20e4('0x9')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x20e4('0x9')],'allowNull':![],'defaultValue':_0x20e4('0x36'),'set':function(_0x3a6170){this[_0x20e4('0x6')](_0x20e4('0x37'),_0x3a6170?_0x3a6170[_0x20e4('0x28')](';'):_0x20e4('0x36'));},'get':function(){return this[_0x20e4('0xd')](_0x20e4('0x37'))?this[_0x20e4('0xd')]('allow')[_0x20e4('0x29')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x20e4('0x1b')](_0x20e4('0x30'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![],'set':function(_0x15ddd3){this['setDataValue'](_0x20e4('0x38'),_0x15ddd3?_0x15ddd3[_0x20e4('0x28')](','):null);},'get':function(){return this[_0x20e4('0xd')](_0x20e4('0x38'))?this[_0x20e4('0xd')]('insecure')[_0x20e4('0x29')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x20e4('0x30'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x20e4('0x30'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x20e4('0x30'),'no',_0x20e4('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x20e4('0x1b')](_0x20e4('0x30'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x20e4('0x1b')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x20e4('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![],'defaultValue':_0x20e4('0x3a')},'amaflags':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x20e4('0x30'),'no'),'allowNull':!![],'defaultValue':_0x20e4('0x30')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x20e4('0x1b')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x20e4('0x1b')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x20e4('0x1b')](_0x20e4('0x30'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x20e4('0x1b')](_0x20e4('0x30'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'template':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x20e4('0x1b')](_0x20e4('0x30'),'no',_0x20e4('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x20e4('0x1b')](_0x20e4('0x30'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x20e4('0x1b')](_0x20e4('0x3c'),_0x20e4('0x3d'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x20e4('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x20e4('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x20e4('0x1b')](_0x20e4('0x3e'),_0x20e4('0x3f')),'allowNull':!![],'defaultValue':_0x20e4('0x3f')},'t38pt_usertpsource':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x20e4('0x30'),'no'),'allowNull':!![],'defaultValue':_0x20e4('0x30')},'keepalive':{'type':Sequelize[_0x20e4('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x20e4('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x20e4('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x20e4('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x20e4('0x1b')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x20e4('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x20e4('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x20e4('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x20e4('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x20e4('0x30'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x20e4('0x1b')](_0x20e4('0x30'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x20e4('0x1b')](_0x20e4('0x30'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x20e4('0x1b')](_0x20e4('0x30'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x20e4('0x1b')](_0x20e4('0x30'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x20e4('0x1b')](_0x20e4('0x30'),'no','fingerprint',_0x20e4('0x40')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x20e4('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x20e4('0x41'),_0x20e4('0x42'),_0x20e4('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x20e4('0x30'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x20e4('0x30'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x20e4('0x1b')](_0x20e4('0x30'),'no',_0x20e4('0x31'),'update',_0x20e4('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x20e4('0x9')]},'resetPasswordExpires':{'type':Sequelize[_0x20e4('0x18')]},'passwordResetAt':{'type':Sequelize[_0x20e4('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x20e4('0x45')]},'showWebBar':{'type':Sequelize[_0x20e4('0x15')],'defaultValue':0x0,'set':function(_0x371d7d){this[_0x20e4('0x6')](_0x20e4('0x46'),_0x371d7d);var _0x5a2085=this[_0x20e4('0x47')]({'plain':!![]});switch(_0x371d7d){case 0x0:case 0x1:var _0x1f1a8f=_0x5a2085[_0x20e4('0x27')]?_[_0x20e4('0x48')](_0x5a2085['transport'])?_0x5a2085[_0x20e4('0x27')]['join']():_0x5a2085[_0x20e4('0x27')]:_0x20e4('0x49');if(_0x1f1a8f===_0x20e4('0x4a')){_0x1f1a8f=_0x20e4('0x49');}this[_0x20e4('0x6')](_0x20e4('0x27'),_0x1f1a8f);this['setDataValue'](_0x20e4('0x4b'),'no');this[_0x20e4('0x6')](_0x20e4('0x4c'),null);this[_0x20e4('0x6')]('force_avp',null);this[_0x20e4('0x6')](_0x20e4('0x4d'),null);this[_0x20e4('0x6')](_0x20e4('0x4e'),null);this[_0x20e4('0x6')](_0x20e4('0x4f'),null);this[_0x20e4('0x6')]('dtlssetup',null);this[_0x20e4('0x6')]('dtlscertfile',null);this['setDataValue'](_0x20e4('0x50'),null);this['setDataValue'](_0x20e4('0x51'),'no');break;case 0x2:this[_0x20e4('0x6')]('transport',_0x20e4('0x4a'));this[_0x20e4('0x6')](_0x20e4('0x4b'),_0x20e4('0x30'));this[_0x20e4('0x6')](_0x20e4('0x4c'),_0x20e4('0x30'));this[_0x20e4('0x6')](_0x20e4('0x52'),_0x20e4('0x30'));this[_0x20e4('0x6')](_0x20e4('0x4d'),_0x20e4('0x30'));this[_0x20e4('0x6')](_0x20e4('0x4e'),_0x20e4('0x30'));this[_0x20e4('0x6')]('dtlsverify','no');this['setDataValue']('dtlssetup',_0x20e4('0x43'));this[_0x20e4('0x6')](_0x20e4('0x53'),_0x5a2085[_0x20e4('0x53')]||_0x20e4('0x54'));this[_0x20e4('0x6')](_0x20e4('0x50'),_0x5a2085[_0x20e4('0x50')]||_0x20e4('0x55'));this[_0x20e4('0x6')](_0x20e4('0x51'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x20e4('0x45')],'set':function(_0x4e28a9){this[_0x20e4('0x6')](_0x20e4('0x56'),_0x4e28a9?_0x4e28a9['join'](','):[]);},'get':function(){return this[_0x20e4('0xd')]('permissions')?_['map'](this[_0x20e4('0xd')](_0x20e4('0x56'))['split'](','),function(_0x49ecf2){return parseInt(_0x49ecf2,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x20e4('0x9')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x20e4('0x9')]},'phoneBarBusyNumber':{'type':Sequelize[_0x20e4('0x9')]},'phoneBarUnconditional':{'type':Sequelize[_0x20e4('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x20e4('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x20e4('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x20e4('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x20e4('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x20e4('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x20e4('0x9')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x20e4('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x20e4('0x1b')](_0x20e4('0x30'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x20e4('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x20e4('0x9')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x20e4('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x20e4('0x57')],'get':function(){return this['getDataValue'](_0x20e4('0x58'))?this[_0x20e4('0xd')](_0x20e4('0x58')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x20e4('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x20e4('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x20e4('0x9')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x20e4('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x20e4('0x9')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x20e4('0x17')],'defaultValue':![],'set':function(_0x389608){if(typeof _0x389608===_0x20e4('0x59')){var _0x378554=_0x389608==='1'?!![]:_0x389608==='0'?![]:_0x389608==='true'?!![]:_0x389608==='false'?![]:![];this['setDataValue']('screenrecording',_0x378554);}else{this[_0x20e4('0x6')]('screenrecording',_0x389608);}}},'blocked':{'type':Sequelize[_0x20e4('0x17')],'defaultValue':![],'set':function(_0x1d2934){this[_0x20e4('0x6')]('blocked',_0x1d2934);if(_0x1d2934===!![]){this[_0x20e4('0x6')](_0x20e4('0x5a'),moment());this['setDataValue'](_0x20e4('0x5b'),0x0);}else{this[_0x20e4('0x6')](_0x20e4('0x5a'),null);}}},'blockedAt':{'type':Sequelize[_0x20e4('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x20e4('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x20e4('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x20e4('0x15')](0x5)[_0x20e4('0x5c')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x20e4('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x20e4('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x20e4('0x17')],'defaultValue':![]}}; \ No newline at end of file +var _0xd05e=['auto','yes','nonat','outgoing','ENUM','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\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','refuse','originate','uas','certificate','active','actpass','update,nonat','showWebBar','get','isArray','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','wss','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','name','setDataValue','defaultuser','STRING','fullname','callerid','format','getDataValue','internal','email','toLowerCase','user','telephone','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','split','rfc2833','info','shortinfo'];(function(_0x411b5c,_0x4e6ad8){var _0x583dcc=function(_0x3faaee){while(--_0x3faaee){_0x411b5c['push'](_0x411b5c['shift']());}};_0x583dcc(++_0x4e6ad8);}(_0xd05e,0x1a3));var _0xed05=function(_0xfa58eb,_0x47d63a){_0xfa58eb=_0xfa58eb-0x0;var _0x284055=_0xd05e[_0xfa58eb];return _0x284055;};'use strict';var Sequelize=require(_0xed05('0x0'));var moment=require(_0xed05('0x1'));var util=require(_0xed05('0x2'));var _=require(_0xed05('0x3'));module[_0xed05('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xed05('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1c66bc){this[_0xed05('0x6')](_0xed05('0x5'),_0x1c66bc);this[_0xed05('0x6')](_0xed05('0x7'),_0x1c66bc);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0xed05('0x8')],'allowNull':![],'set':function(_0x26c18c){this[_0xed05('0x6')](_0xed05('0x9'),_0x26c18c);this['setDataValue'](_0xed05('0xa'),util[_0xed05('0xb')]('\x22%s\x22\x20<%s>',_0x26c18c,this[_0xed05('0xc')](_0xed05('0xd'))));}},'alias':{'type':Sequelize[_0xed05('0x8')]},'email':{'type':Sequelize[_0xed05('0x8')],'allowNull':![],'unique':_0xed05('0xe'),'validate':{'isEmail':!![]},'set':function(_0x2f0eac){if(_0x2f0eac){this[_0xed05('0x6')](_0xed05('0xe'),_0x2f0eac[_0xed05('0xf')]());}}},'role':{'type':Sequelize['ENUM']('admin',_0xed05('0x10'),'agent',_0xed05('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0xed05('0x8')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0xed05('0x12')},'internal':{'type':Sequelize[_0xed05('0x13')](0xb),'allowNull':![],'unique':_0xed05('0xd'),'set':function(_0x8852e2){this[_0xed05('0x6')](_0xed05('0xd'),_0x8852e2);this['setDataValue'](_0xed05('0x14'),_0x8852e2);this[_0xed05('0x6')](_0xed05('0xa'),util[_0xed05('0xb')](_0xed05('0x15'),this[_0xed05('0xc')]('fullname'),_0x8852e2));}},'salt':{'type':Sequelize[_0xed05('0x8')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xed05('0x8')]},'address':{'type':Sequelize[_0xed05('0x8')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xed05('0x8')]},'city':{'type':Sequelize[_0xed05('0x8')]},'country':{'type':Sequelize[_0xed05('0x8')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xed05('0x16')]},'voicePause':{'type':Sequelize[_0xed05('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xed05('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xed05('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xed05('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xed05('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xed05('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xed05('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0xed05('0x18')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0xed05('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xed05('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xed05('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xed05('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xed05('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xed05('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xed05('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xed05('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xed05('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xed05('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xed05('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xed05('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xed05('0x19')},'ipaddr':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'port':{'type':Sequelize[_0xed05('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xed05('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xed05('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0xed05('0x1a'),_0xed05('0x10'),_0xed05('0x1b')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xed05('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0xed05('0x1d'),_0xed05('0x1e'),_0xed05('0x1f'),_0xed05('0x20'),'PROHIB_NOT_SCREENED',_0xed05('0x21'),_0xed05('0x22'),_0xed05('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'permit':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'secret':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'transport':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![],'defaultValue':'udp','set':function(_0x595616){this[_0xed05('0x6')]('transport',_0x595616?_0x595616['join'](','):null);},'get':function(){return this[_0xed05('0xc')]('transport')?this[_0xed05('0xc')](_0xed05('0x24'))[_0xed05('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0xed05('0x26'),_0xed05('0x27'),_0xed05('0x28'),'inband',_0xed05('0x29')),'allowNull':!![],'defaultValue':_0xed05('0x26')},'directmedia':{'type':Sequelize['ENUM'](_0xed05('0x2a'),'no',_0xed05('0x2b'),'update',_0xed05('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xed05('0x2d')](_0xed05('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'nat':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![],'defaultValue':_0xed05('0x2e'),'set':function(_0x4e23c8){this[_0xed05('0x6')](_0xed05('0x2f'),_0x4e23c8?_0x4e23c8[_0xed05('0x30')](','):null);},'get':function(){return this[_0xed05('0xc')]('nat')?this[_0xed05('0xc')]('nat')[_0xed05('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xed05('0x8')]},'namedcallgroup':{'type':Sequelize[_0xed05('0x8')]},'pickupgroup':{'type':Sequelize[_0xed05('0x8')]},'namedpickupgroup':{'type':Sequelize[_0xed05('0x8')]},'language':{'type':Sequelize[_0xed05('0x8')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xed05('0x8')]},'disallow':{'type':Sequelize[_0xed05('0x8')],'allowNull':![],'defaultValue':_0xed05('0x31')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xed05('0x32'),'set':function(_0x3dcdb2){this['setDataValue']('allow',_0x3dcdb2?_0x3dcdb2[_0xed05('0x30')](';'):_0xed05('0x32'));},'get':function(){return this['getDataValue'](_0xed05('0x33'))?this[_0xed05('0xc')]('allow')[_0xed05('0x25')](';'):null;},'comment':_0xed05('0x34')},'autoframing':{'type':Sequelize['ENUM'](_0xed05('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![],'set':function(_0x50433b){this[_0xed05('0x6')](_0xed05('0x35'),_0x50433b?_0x50433b[_0xed05('0x30')](','):null);},'get':function(){return this[_0xed05('0xc')](_0xed05('0x35'))?this[_0xed05('0xc')](_0xed05('0x35'))[_0xed05('0x25')](','):null;},'comment':_0xed05('0x36')},'trustrpid':{'type':Sequelize[_0xed05('0x2d')](_0xed05('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xed05('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xed05('0x2d')](_0xed05('0x2a'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xed05('0x2d')](_0xed05('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xed05('0x2d')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![],'defaultValue':_0xed05('0x37')},'amaflags':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xed05('0x2d')](_0xed05('0x2a'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xed05('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xed05('0x2d')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xed05('0x2d')](_0xed05('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0xed05('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xed05('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM']('yes','no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xed05('0x2d')](_0xed05('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xed05('0x38'),_0xed05('0x39'),_0xed05('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xed05('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xed05('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xed05('0x2d')]('uac','uas'),'allowNull':!![],'defaultValue':_0xed05('0x3b')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xed05('0x2d')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xed05('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xed05('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xed05('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xed05('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xed05('0x2d')](_0xed05('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xed05('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xed05('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xed05('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xed05('0x2d')](_0xed05('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xed05('0x2d')](_0xed05('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xed05('0x2d')](_0xed05('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xed05('0x2d')](_0xed05('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xed05('0x2d')](_0xed05('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xed05('0x2a'),'no','fingerprint',_0xed05('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xed05('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xed05('0x3d'),'passive',_0xed05('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xed05('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xed05('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xed05('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0xed05('0x2a'),'no','nonat','update',_0xed05('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xed05('0x8')]},'resetPasswordExpires':{'type':Sequelize[_0xed05('0x16')]},'passwordResetAt':{'type':Sequelize[_0xed05('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x23f853){this['setDataValue'](_0xed05('0x40'),_0x23f853);var _0x19df00=this[_0xed05('0x41')]({'plain':!![]});switch(_0x23f853){case 0x0:case 0x1:var _0xb38748=_0x19df00[_0xed05('0x24')]?_[_0xed05('0x42')](_0x19df00[_0xed05('0x24')])?_0x19df00[_0xed05('0x24')]['join']():_0x19df00['transport']:_0xed05('0x43');if(_0xb38748==='wss'){_0xb38748=_0xed05('0x43');}this[_0xed05('0x6')]('transport',_0xb38748);this[_0xed05('0x6')](_0xed05('0x44'),'no');this[_0xed05('0x6')](_0xed05('0x45'),null);this[_0xed05('0x6')](_0xed05('0x46'),null);this[_0xed05('0x6')](_0xed05('0x47'),null);this[_0xed05('0x6')](_0xed05('0x48'),null);this['setDataValue'](_0xed05('0x49'),null);this[_0xed05('0x6')](_0xed05('0x4a'),null);this[_0xed05('0x6')](_0xed05('0x4b'),null);this[_0xed05('0x6')]('dtlsprivatekey',null);this[_0xed05('0x6')](_0xed05('0x4c'),'no');break;case 0x2:this[_0xed05('0x6')]('transport',_0xed05('0x4d'));this[_0xed05('0x6')](_0xed05('0x44'),_0xed05('0x2a'));this[_0xed05('0x6')](_0xed05('0x45'),_0xed05('0x2a'));this[_0xed05('0x6')](_0xed05('0x46'),'yes');this[_0xed05('0x6')](_0xed05('0x47'),_0xed05('0x2a'));this['setDataValue'](_0xed05('0x48'),_0xed05('0x2a'));this['setDataValue'](_0xed05('0x49'),'no');this[_0xed05('0x6')](_0xed05('0x4a'),'actpass');this[_0xed05('0x6')](_0xed05('0x4b'),_0x19df00[_0xed05('0x4b')]||_0xed05('0x4e'));this[_0xed05('0x6')]('dtlsprivatekey',_0x19df00['dtlsprivatekey']||_0xed05('0x4f'));this['setDataValue'](_0xed05('0x4c'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xed05('0x50')],'set':function(_0x3f5515){this['setDataValue'](_0xed05('0x51'),_0x3f5515?_0x3f5515[_0xed05('0x30')](','):[]);},'get':function(){return this[_0xed05('0xc')](_0xed05('0x51'))?_[_0xed05('0x52')](this[_0xed05('0xc')](_0xed05('0x51'))['split'](','),function(_0x404829){return parseInt(_0x404829,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xed05('0x8')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xed05('0x8')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xed05('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xed05('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xed05('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xed05('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xed05('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xed05('0x8')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xed05('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xed05('0x2d')](_0xed05('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xed05('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xed05('0x8')]},'phoneBarEnableJaws':{'type':Sequelize[_0xed05('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xed05('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xed05('0x53')],'get':function(){return this['getDataValue'](_0xed05('0x54'))?this[_0xed05('0xc')](_0xed05('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xed05('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xed05('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0xed05('0x8')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xed05('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xed05('0x8')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xed05('0x17')],'defaultValue':![],'set':function(_0x29459a){if(typeof _0x29459a===_0xed05('0x55')){var _0x4c8ee6=_0x29459a==='1'?!![]:_0x29459a==='0'?![]:_0x29459a===_0xed05('0x56')?!![]:_0x29459a===_0xed05('0x57')?![]:![];this[_0xed05('0x6')]('screenrecording',_0x4c8ee6);}else{this[_0xed05('0x6')]('screenrecording',_0x29459a);}}},'blocked':{'type':Sequelize[_0xed05('0x17')],'defaultValue':![],'set':function(_0x128195){this[_0xed05('0x6')](_0xed05('0x58'),_0x128195);if(_0x128195===!![]){this[_0xed05('0x6')](_0xed05('0x59'),moment());this[_0xed05('0x6')](_0xed05('0x5a'),0x0);}else{this[_0xed05('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xed05('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xed05('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xed05('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xed05('0x13')](0x5)[_0xed05('0x5b')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xed05('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xed05('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xed05('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xed05('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xed05('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index d6fc72a..8974c7a 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 _0x5c3c=['email','permissions','102','103','113','110','104','106','108','109','100','111','114','user','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','create','VoiceMail','UserProfileSection','autoAssociation','UserProfileResource','bulkCreate','some','each','isEmpty','changePassword','oldPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','securePassword','passwordHistoryLimit','enforcePasswordHistory','previousPasswords','validatePasswordHistory','addQueues','channel','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','QueueId','emit','voice','get','UserVoiceQueueRt','upsert','removeQueues','remove','isArray','Queue:remove','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','userpic','existsSync','server/files/images/','download','getOpenTabs','whatsapp','CHAT','FaxOpenTabs','FAX','createdAt','MailOpenTabs','SmsOpenTabs','SMS','WhatsappOpenTabs','CmContact','fields','order','sort','pick','getContacts','hasOwnProperty','CmList','List','Tag','Tags','color','tag','getQueues','Unknown\x20role','nolimit','Queue','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','mobile','loginInPause','format','intrf','SIP/%s','user:%s','x-forwarded-for','socket','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','MemberReport','concat','isMiddleware','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','manual','getTeams','Team','addTeams','setDataValue','Voice','getChatQueues','Chat','getMailQueues','getSmsQueues','Sms','Whatsapp','getFaxQueues','Fax','Openchannel','flatten','transaction','addAgent','online','getDataValue','voicePause','Queue:save','UserVoicePrefix','VoicePrefixId','removeTeams','Mail','getWhatsappQueues','getOpenchannelQueues','removeAgent','TeamVoicePrefix','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$gt','$gte','$lte','$ne','$not','$between','$notBetween','$notIn','$notLike','$iLike','$like','$overlap','$contains','$contained','$any','firstName','lastName','Contact','getApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','iat','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','resolve','teams','inbound','queues','lower','col','toString','desc','asc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','voiceStatus','busy','slice','charAt','SELECT','select','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','moment','bluebird','util','path','squel','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','./user.socket','defaults','localhost','client','request','then','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','destroy','role','admin','Users','Agents','agent','Telephones','telephone','filter','ignore','map','value','includes','find','name','stack','send','index','User','fieldName','type','key','password','salt','where','query','include','findAll','rows','openTabs','length','push','dataValues','sms','mail','openchannel','all','show','params','model','differenceBy','keys','rawAttributes','filters','intersection','attributes','includeAll','merge','options','true','chat','fax','body','describe','addContacts','omit','ids','internal','findById','validatePasswordPattern','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','from','voicemail','mailbox','fullname'];(function(_0x3c79d1,_0x1e55d4){var _0x1646e8=function(_0x278dfe){while(--_0x278dfe){_0x3c79d1['push'](_0x3c79d1['shift']());}};_0x1646e8(++_0x1e55d4);}(_0x5c3c,0x132));var _0xc5c3=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x5c3c[_0x68ee8b];return _0x5148f7;};'use strict';var moment=require(_0xc5c3('0x0'));var BPromise=require(_0xc5c3('0x1'));var util=require(_0xc5c3('0x2'));var path=require(_0xc5c3('0x3'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc5c3('0x4'));var jayson=require(_0xc5c3('0x5'));var Redis=require(_0xc5c3('0x6'));var authService=require(_0xc5c3('0x7'));var qs=require(_0xc5c3('0x8'));var logger=require(_0xc5c3('0x9'))(_0xc5c3('0xa'));var utils=require(_0xc5c3('0xb'));var config=require(_0xc5c3('0xc'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xc5c3('0xd')]));require(_0xc5c3('0xe'))['register'](socket);config[_0xc5c3('0xd')]=_[_0xc5c3('0xf')](config['redis'],{'host':_0xc5c3('0x10'),'port':0x18eb});var client=jayson[_0xc5c3('0x11')]['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x1f2e34,_0x105e43,_0x3b27e8,_0x59fb60){return new BPromise(function(_0x2915ab,_0x6d6a29){var _0x532065=_0x59fb60||client;return _0x532065[_0xc5c3('0x12')](_0x1f2e34,_0x3b27e8)[_0xc5c3('0x13')](function(_0x3f0f45){logger['info'](_0xc5c3('0x14'),_0x105e43,_0xc5c3('0x15'));logger[_0xc5c3('0x16')](_0xc5c3('0x17'),_0x105e43,_0xc5c3('0x15'),JSON['stringify'](_0x3f0f45));if(_0x3f0f45['error']){if(_0x3f0f45[_0xc5c3('0x18')][_0xc5c3('0x19')]===0x1f4){logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x105e43,_0x3f0f45['error']['message']);return _0x6d6a29(_0x3f0f45[_0xc5c3('0x18')]['message']);}logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x105e43,_0x3f0f45[_0xc5c3('0x18')][_0xc5c3('0x1a')]);return _0x2915ab(_0x3f0f45[_0xc5c3('0x18')]['message']);}else{logger[_0xc5c3('0x1b')](_0xc5c3('0x14'),_0x105e43,_0xc5c3('0x15'));_0x2915ab(_0x3f0f45[_0xc5c3('0x1c')]['message']);}})[_0xc5c3('0x1d')](function(_0x41578a){logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x105e43,_0x41578a);_0x6d6a29(_0x41578a);});});}function respondWithStatusCode(_0x333a29,_0x564815){_0x564815=_0x564815||0xcc;return function(_0xb07420){if(_0xb07420){return _0x333a29[_0xc5c3('0x1e')](_0x564815);}return _0x333a29[_0xc5c3('0x1f')](_0x564815)[_0xc5c3('0x20')]();};}function respondWithResult(_0x1c5793,_0x67445){_0x67445=_0x67445||0xc8;return function(_0x40ebcc){if(_0x40ebcc){return _0x1c5793['status'](_0x67445)['json'](_0x40ebcc);}};}function respondWithFilteredResult(_0x45affe,_0x38dd9e){return function(_0x53ab72){if(_0x53ab72){var _0x5c7329=typeof _0x38dd9e[_0xc5c3('0x21')]===_0xc5c3('0x22')&&typeof _0x38dd9e[_0xc5c3('0x23')]==='undefined';var _0x4af067=_0x53ab72[_0xc5c3('0x24')];var _0x22f607=_0x5c7329?0x0:_0x38dd9e[_0xc5c3('0x21')];var _0x29791c=_0x5c7329?_0x53ab72['count']:_0x38dd9e[_0xc5c3('0x21')]+_0x38dd9e['limit'];var _0x2eacec;if(_0x29791c>=_0x4af067){_0x29791c=_0x4af067;_0x2eacec=0xc8;}else{_0x2eacec=0xce;}_0x45affe['status'](_0x2eacec);return _0x45affe[_0xc5c3('0x25')](_0xc5c3('0x26'),_0x22f607+'-'+_0x29791c+'/'+_0x4af067)[_0xc5c3('0x27')](_0x53ab72);}return null;};}function saveUpdates(_0x4773c5){return function(_0x15361c){if(_0x15361c){return _0x15361c[_0xc5c3('0x28')](_0x4773c5)[_0xc5c3('0x13')](function(_0x4b5a0c){return _0x4b5a0c;});}return null;};}function removeEntity(_0xbcafd6){return function(_0x4a3300){if(_0x4a3300){return _0x4a3300[_0xc5c3('0x29')]()[_0xc5c3('0x13')](function(){var _0x5b26e9=_0x4a3300['get']({'plain':!![]});if(_0x5b26e9[_0xc5c3('0x2a')]===_0xc5c3('0x2b'))return;var _0x66e83c=[{'name':_0xc5c3('0x2c'),'value':'user','ignore':!![]},{'name':_0xc5c3('0x2d'),'value':_0xc5c3('0x2e'),'ignore':![]},{'name':_0xc5c3('0x2f'),'value':_0xc5c3('0x30'),'ignore':![]}];var _0x1b4538=_(_0x66e83c)[_0xc5c3('0x31')](_0xc5c3('0x32'))[_0xc5c3('0x33')](_0xc5c3('0x34'))['value']();if(_[_0xc5c3('0x35')](_0x1b4538,_0x5b26e9[_0xc5c3('0x2a')])){return;}var _0x6de4ac=_[_0xc5c3('0x36')](_0x66e83c,[_0xc5c3('0x34'),_0x5b26e9[_0xc5c3('0x2a')]])[_0xc5c3('0x37')];return db['UserProfileResource']['destroy']({'where':{'type':_0x6de4ac,'resourceId':_0x5b26e9['id']}})[_0xc5c3('0x13')](function(){return _0x4a3300;});})['then'](function(){_0xbcafd6[_0xc5c3('0x1f')](0xcc)[_0xc5c3('0x20')]();});}};}function handleEntityNotFound(_0x30a01e){return function(_0x15c656){if(!_0x15c656){_0x30a01e[_0xc5c3('0x1e')](0x194);}return _0x15c656;};}function handleError(_0x498677,_0x21b243){_0x21b243=_0x21b243||0x1f4;return function(_0xdaecce){logger['error'](_0xdaecce[_0xc5c3('0x38')]);if(_0xdaecce[_0xc5c3('0x37')]){delete _0xdaecce[_0xc5c3('0x37')];}_0x498677[_0xc5c3('0x1f')](_0x21b243)[_0xc5c3('0x39')](_0xdaecce);};}exports[_0xc5c3('0x3a')]=function(_0x168056,_0x2ad440){var _0x1fb127={},_0xf4f027={'count':0x0,'rows':[]};var _0x49523a=_(db[_0xc5c3('0x3b')]['rawAttributes'])['map'](function(_0x11c029){return{'name':_0x11c029[_0xc5c3('0x3c')],'type':_0x11c029[_0xc5c3('0x3d')][_0xc5c3('0x3e')]};})[_0xc5c3('0x31')](function(_0x499791){return!_['includes']([_0xc5c3('0x3f'),_0xc5c3('0x40')],_0x499791['name']);})[_0xc5c3('0x34')]();_0x1fb127=qs['getOptions'](_0x49523a,_0x168056);var _0x40d1bc={'where':_0x1fb127[_0xc5c3('0x41')]};return db[_0xc5c3('0x3b')]['count'](_0x40d1bc)[_0xc5c3('0x13')](function(_0x34f376){_0xf4f027['count']=_0x34f376;if(_0x168056[_0xc5c3('0x42')]['includeAll']){_0x1fb127[_0xc5c3('0x43')]=[{'all':!![]}];}if(!_[_0xc5c3('0x35')](_0x1fb127['attributes'],'id')){_0x1fb127['attributes']['push']('id');}return db[_0xc5c3('0x3b')][_0xc5c3('0x44')](_0x1fb127);})['then'](function(_0x1a8490){_0xf4f027[_0xc5c3('0x45')]=_0x1a8490;if(_0x168056[_0xc5c3('0x42')][_0xc5c3('0x46')]==='true'){var _0x3688a9=[];for(var _0x523fdf=0x0;_0x523fdf<_0xf4f027['rows'][_0xc5c3('0x47')];_0x523fdf++){_0x3688a9[_0xc5c3('0x48')](get_open_tabs('chat',_0xf4f027[_0xc5c3('0x45')][_0x523fdf][_0xc5c3('0x49')]));_0x3688a9['push'](get_open_tabs(_0xc5c3('0x4a'),_0xf4f027['rows'][_0x523fdf][_0xc5c3('0x49')]));_0x3688a9[_0xc5c3('0x48')](get_open_tabs('fax',_0xf4f027[_0xc5c3('0x45')][_0x523fdf]['dataValues']));_0x3688a9[_0xc5c3('0x48')](get_open_tabs(_0xc5c3('0x4b'),_0xf4f027['rows'][_0x523fdf][_0xc5c3('0x49')]));_0x3688a9[_0xc5c3('0x48')](get_open_tabs(_0xc5c3('0x4c'),_0xf4f027[_0xc5c3('0x45')][_0x523fdf][_0xc5c3('0x49')]));_0x3688a9[_0xc5c3('0x48')](get_open_tabs('whatsapp',_0xf4f027[_0xc5c3('0x45')][_0x523fdf][_0xc5c3('0x49')]));}return BPromise[_0xc5c3('0x4d')](_0x3688a9)[_0xc5c3('0x13')](function(_0x23002b){return _0xf4f027;});}else{return _0xf4f027;}})['then'](respondWithFilteredResult(_0x2ad440,_0x1fb127))['catch'](handleError(_0x2ad440,null));};exports[_0xc5c3('0x4e')]=function(_0xbe635b,_0x22a414){var _0x5f0ee4={'raw':![],'where':{'id':_0xbe635b[_0xc5c3('0x4f')]['id']}},_0x38d82f={};_0x38d82f[_0xc5c3('0x50')]=_[_0xc5c3('0x51')](_[_0xc5c3('0x52')](db[_0xc5c3('0x3b')][_0xc5c3('0x53')]),['password',_0xc5c3('0x40')]);_0x38d82f[_0xc5c3('0x42')]=_[_0xc5c3('0x52')](_0xbe635b['query']);_0x38d82f[_0xc5c3('0x54')]=_[_0xc5c3('0x55')](_0x38d82f[_0xc5c3('0x50')],_0x38d82f[_0xc5c3('0x42')]);_0x5f0ee4[_0xc5c3('0x56')]=_['intersection'](_0x38d82f[_0xc5c3('0x50')],qs['fields'](_0xbe635b[_0xc5c3('0x42')]['fields']));_0x5f0ee4[_0xc5c3('0x56')]=_0x5f0ee4[_0xc5c3('0x56')][_0xc5c3('0x47')]?_0x5f0ee4[_0xc5c3('0x56')]:_0x38d82f[_0xc5c3('0x50')];if(_0xbe635b['query'][_0xc5c3('0x57')]){_0x5f0ee4[_0xc5c3('0x43')]=[{'all':!![]}];}_0x5f0ee4=_[_0xc5c3('0x58')]({},_0x5f0ee4,_0xbe635b[_0xc5c3('0x59')]);if(!_[_0xc5c3('0x35')](_0x5f0ee4['attributes'],'id')){_0x5f0ee4[_0xc5c3('0x56')][_0xc5c3('0x48')]('id');}return db[_0xc5c3('0x3b')]['find'](_0x5f0ee4)[_0xc5c3('0x13')](handleEntityNotFound(_0x22a414,null))['then'](function(_0x5a6480){var _0x39f83a=[];values=_0x5a6480;if(_0xbe635b[_0xc5c3('0x42')][_0xc5c3('0x46')]===_0xc5c3('0x5a')){_0x39f83a[_0xc5c3('0x48')](get_open_tabs(_0xc5c3('0x5b'),_0x5a6480['dataValues']));_0x39f83a[_0xc5c3('0x48')](get_open_tabs(_0xc5c3('0x4a'),_0x5a6480[_0xc5c3('0x49')]));_0x39f83a[_0xc5c3('0x48')](get_open_tabs(_0xc5c3('0x4c'),_0x5a6480[_0xc5c3('0x49')]));_0x39f83a[_0xc5c3('0x48')](get_open_tabs('whatsapp',_0x5a6480['dataValues']));_0x39f83a[_0xc5c3('0x48')](get_open_tabs(_0xc5c3('0x5c'),_0x5a6480['dataValues']));_0x39f83a[_0xc5c3('0x48')](get_open_tabs(_0xc5c3('0x4b'),_0x5a6480[_0xc5c3('0x49')]));return BPromise[_0xc5c3('0x4d')](_0x39f83a);}else{return values;}})['then'](function(_0x41fc40){return values;})[_0xc5c3('0x13')](respondWithResult(_0x22a414,null))[_0xc5c3('0x1d')](handleError(_0x22a414,null));};exports[_0xc5c3('0x28')]=function(_0x1b66bf,_0x36420a){if(_0x1b66bf[_0xc5c3('0x5d')]['id']){delete _0x1b66bf[_0xc5c3('0x5d')]['id'];}delete _0x1b66bf[_0xc5c3('0x5d')]['role'];return db[_0xc5c3('0x3b')][_0xc5c3('0x36')]({'where':{'id':_0x1b66bf[_0xc5c3('0x4f')]['id']}})['then'](handleEntityNotFound(_0x36420a,null))[_0xc5c3('0x13')](saveUpdates(_0x1b66bf[_0xc5c3('0x5d')],null))[_0xc5c3('0x13')](respondWithResult(_0x36420a,null))[_0xc5c3('0x1d')](handleError(_0x36420a,null));};exports[_0xc5c3('0x5e')]=function(_0x5067ed,_0xf54924){return db[_0xc5c3('0x3b')][_0xc5c3('0x5e')]()[_0xc5c3('0x13')](respondWithResult(_0xf54924,null))[_0xc5c3('0x1d')](handleError(_0xf54924,null));};exports[_0xc5c3('0x5f')]=function(_0x2ed4eb,_0x529759){return db[_0xc5c3('0x3b')][_0xc5c3('0x36')]({'where':{'id':_0x2ed4eb[_0xc5c3('0x4f')]['id']}})[_0xc5c3('0x13')](handleEntityNotFound(_0x529759,null))[_0xc5c3('0x13')](function(_0x3cd213){if(_0x3cd213){return _0x3cd213[_0xc5c3('0x5f')](_0x2ed4eb['body']['ids'],_[_0xc5c3('0x60')](_0x2ed4eb[_0xc5c3('0x5d')],[_0xc5c3('0x61'),'id'])||{});}})[_0xc5c3('0x13')](respondWithResult(_0x529759,null))[_0xc5c3('0x1d')](handleError(_0x529759,null));};function validateUser(_0x28412e){return new BPromise(function(_0x17520e,_0x2cdd7a){if(_0x28412e[_0xc5c3('0x62')])return _0x17520e(_0x28412e);return db['Setting'][_0xc5c3('0x63')](0x1)[_0xc5c3('0x13')](function(_0x578843){if(_0x578843['securePassword'])authService[_0xc5c3('0x64')](_0x28412e[_0xc5c3('0x3f')]);db[_0xc5c3('0x3b')][_0xc5c3('0x65')](_0xc5c3('0x62'))[_0xc5c3('0x13')](function(_0x34f284){if(_[_0xc5c3('0x66')](_0x34f284)){_0x28412e[_0xc5c3('0x62')]=_0x578843['min_internal']||0x1;return;}if(_[_0xc5c3('0x66')](_0x578843[_0xc5c3('0x67')])||_0x578843[_0xc5c3('0x67')]===_0x34f284){_0x28412e[_0xc5c3('0x62')]=_0x34f284+0x1;return;}if(_0x578843[_0xc5c3('0x67')]>_0x34f284){_0x28412e[_0xc5c3('0x62')]=_0x578843[_0xc5c3('0x67')];return;}return db[_0xc5c3('0x68')][_0xc5c3('0x42')](_0xc5c3('0x69'),{'type':db[_0xc5c3('0x68')]['QueryTypes']['SELECT']})[_0xc5c3('0x13')](function(_0xcf6fc0){if(_0xcf6fc0&&_0xcf6fc0[_0xc5c3('0x47')]){for(var _0x1951a5=0x0,_0x5540c0=_0xcf6fc0[_0xc5c3('0x47')];_0x1951a5<_0x5540c0&&_[_0xc5c3('0x66')](_0x28412e[_0xc5c3('0x62')]);_0x1951a5++){if(_0x578843[_0xc5c3('0x67')]<=_0xcf6fc0[_0x1951a5][_0xc5c3('0x6a')]){_0x28412e[_0xc5c3('0x62')]=_0xcf6fc0[_0x1951a5][_0xc5c3('0x6a')];}else if(_0x578843['min_internal']>_0xcf6fc0[_0x1951a5][_0xc5c3('0x6a')]&&_0x578843['min_internal']<=_0xcf6fc0[_0x1951a5]['to']){_0x28412e[_0xc5c3('0x62')]=_0x578843[_0xc5c3('0x67')];}}}if(_[_0xc5c3('0x66')](_0x28412e[_0xc5c3('0x62')])){_0x28412e[_0xc5c3('0x62')]=_0x34f284+0x1;}return _0x17520e(_0x28412e);});});})[_0xc5c3('0x1d')](function(_0x18822e){_0x2cdd7a(_0x18822e);});});}function updateUser(_0x1667ee){return new BPromise(function(_0x4813a0,_0x46f271){try{if(_0x1667ee[_0xc5c3('0x6b')]){_0x1667ee[_0xc5c3('0x6c')]=_0x1667ee['internal'];_0x1667ee['VoiceMail']={'mailbox':_0x1667ee[_0xc5c3('0x62')],'password':_0x1667ee['password'],'fullname':_0x1667ee[_0xc5c3('0x6d')],'email':_0x1667ee[_0xc5c3('0x6e')]};}if(_0x1667ee[_0xc5c3('0x2a')]==='agent'){if(!_0x1667ee[_0xc5c3('0x6f')])_0x1667ee['permissions']=['101',_0xc5c3('0x70'),_0xc5c3('0x71'),_0xc5c3('0x72'),_0xc5c3('0x73'),_0xc5c3('0x74'),'105',_0xc5c3('0x75'),'107',_0xc5c3('0x76'),_0xc5c3('0x77'),_0xc5c3('0x78'),_0xc5c3('0x79'),_0xc5c3('0x7a'),'115'];}_0x4813a0(_0x1667ee);}catch(_0x5588d9){_0x46f271(_0x5588d9);}});}exports['create']=function(_0x42a235,_0x40b74f){if(_0x42a235[_0xc5c3('0x7b')]['role']===_0xc5c3('0x2e'))throw new Error(_0xc5c3('0x7c'));if(_0x42a235['body'][_0xc5c3('0x2a')]==='user'&&_0x42a235[_0xc5c3('0x7b')][_0xc5c3('0x2a')]!==_0xc5c3('0x2b')){throw new Error(_0xc5c3('0x7d'));}if(_0x42a235['body'][_0xc5c3('0x2a')]===_0xc5c3('0x2b')&&_0x42a235[_0xc5c3('0x7b')][_0xc5c3('0x2a')]!==_0xc5c3('0x2b')){throw new Error(_0xc5c3('0x7e'));}return licenseUtil[_0xc5c3('0x7f')]([_0x42a235[_0xc5c3('0x5d')]])['then'](function(){return validateUser(_0x42a235['body']);})['then'](function(_0x5a9704){return updateUser(_0x5a9704)[_0xc5c3('0x13')](function(_0x420e49){if(_0x420e49[_0xc5c3('0x2a')]===_0xc5c3('0x2b')){_0x420e49[_0xc5c3('0x80')]=_0x42a235[_0xc5c3('0x7b')][_0xc5c3('0x80')];delete _0x420e49[_0xc5c3('0x81')];}return _0x420e49;});})[_0xc5c3('0x13')](function(_0x5929f6){return db[_0xc5c3('0x3b')][_0xc5c3('0x82')](_0x5929f6,{'include':[{'model':db[_0xc5c3('0x83')],'as':_0xc5c3('0x83')}]});})[_0xc5c3('0x13')](function(_0x258e36){if(_0x42a235[_0xc5c3('0x5d')]['role']==='user')return _0x258e36;if(_0x42a235[_0xc5c3('0x7b')][_0xc5c3('0x2a')]!==_0xc5c3('0x7b'))return _0x258e36;return db[_0xc5c3('0x84')][_0xc5c3('0x36')]({'where':{'name':_0x258e36[_0xc5c3('0x2a')]===_0xc5c3('0x2e')?_0xc5c3('0x2d'):_0xc5c3('0x2f'),'userProfileId':_0x42a235[_0xc5c3('0x7b')][_0xc5c3('0x81')]},'raw':!![]})['then'](function(_0x2f1b19){if(!_0x2f1b19||_0x2f1b19[_0xc5c3('0x85')]!=0x0)return _0x258e36;return db[_0xc5c3('0x86')][_0xc5c3('0x82')]({'name':_0x258e36[_0xc5c3('0x37')],'resourceId':_0x258e36['id'],'type':_0x2f1b19['name'],'sectionId':_0x2f1b19['id']},{})[_0xc5c3('0x13')](function(){return _0x258e36;});})[_0xc5c3('0x1d')](function(_0x330cf9){logger[_0xc5c3('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x330cf9);throw _0x330cf9;});})[_0xc5c3('0x13')](respondWithResult(_0x40b74f,0xc9))[_0xc5c3('0x1d')](handleError(_0x40b74f,null));};exports[_0xc5c3('0x87')]=function(_0x5d1d51,_0x42cfc9){var _0x1e565d=_0x5d1d51[_0xc5c3('0x5d')];var _0x282bee=[];if(_0x5d1d51[_0xc5c3('0x7b')][_0xc5c3('0x2a')]===_0xc5c3('0x2e'))throw new Error(_0xc5c3('0x7c'));if(_[_0xc5c3('0x88')](_0x1e565d,[_0xc5c3('0x2a'),_0xc5c3('0x7b')])&&_0x5d1d51[_0xc5c3('0x7b')][_0xc5c3('0x2a')]!==_0xc5c3('0x2b')){throw new Error(_0xc5c3('0x7d'));}if(_[_0xc5c3('0x88')](_0x1e565d,['role',_0xc5c3('0x2b')])&&_0x5d1d51[_0xc5c3('0x7b')]['role']!==_0xc5c3('0x2b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0xc5c3('0x7f')](_0x1e565d)[_0xc5c3('0x13')](function(){return validateUser(_0x1e565d[0x0]);})[_0xc5c3('0x13')](function(){for(var _0x1800a0=0x1;_0x1800a0<_0x1e565d[_0xc5c3('0x47')];_0x1800a0++){var _0x590fb8=_0x1e565d[_0x1800a0-0x1][_0xc5c3('0x62')];if(!_0x1e565d[_0x1800a0][_0xc5c3('0x62')])_0x1e565d[_0x1800a0][_0xc5c3('0x62')]=_0x590fb8+0x1;_0x282bee['push'](validateUser(_0x1e565d[_0x1800a0]));}return BPromise['all'](_0x282bee);})[_0xc5c3('0x13')](function(){_0x282bee=[];for(var _0x4a7dab=0x0;_0x4a7dab<_0x1e565d[_0xc5c3('0x47')];_0x4a7dab++){_0x282bee[_0xc5c3('0x48')](updateUser(_0x1e565d[_0x4a7dab]));}return BPromise[_0xc5c3('0x4d')](_0x282bee);})['then'](function(){return BPromise[_0xc5c3('0x89')](_0x1e565d,function(_0x3325b6){return db[_0xc5c3('0x3b')][_0xc5c3('0x82')](_0x3325b6,{'include':[{'model':db[_0xc5c3('0x83')],'as':'VoiceMail'}]})[_0xc5c3('0x13')](function(_0x37ef35){_0x3325b6['id']=_0x37ef35['id'];return _0x3325b6;});});})[_0xc5c3('0x13')](function(_0x5d5248){if(_0x5d1d51[_0xc5c3('0x5d')][_0xc5c3('0x2a')]===_0xc5c3('0x7b'))return _0x5d5248;if(_0x5d1d51[_0xc5c3('0x7b')][_0xc5c3('0x2a')]!==_0xc5c3('0x7b'))return _0x5d5248;var _0x46c783=_[_0xc5c3('0x88')](_0x5d5248,function(_0x515a7c){return _0x515a7c[_0xc5c3('0x2a')]==='agent'||_0x515a7c[_0xc5c3('0x2a')]===_0xc5c3('0x30');});if(!_0x46c783)return _0x5d5248;return db['UserProfileSection'][_0xc5c3('0x44')]({'where':{'name':{'$or':[_0xc5c3('0x2d'),'Telephones']},'userProfileId':_0x5d1d51[_0xc5c3('0x7b')][_0xc5c3('0x81')]},'raw':!![]})[_0xc5c3('0x13')](function(_0x15f070){if(_[_0xc5c3('0x8a')](_0x15f070)||!_['some'](_0x15f070,[_0xc5c3('0x85'),0x0]))return _0x5d5248;_0x282bee=[];var _0x1156a2=_(_0x15f070)[_0xc5c3('0x33')](function(_0x4f5f07){if(_0x4f5f07[_0xc5c3('0x85')]===0x1)return;return _0x4f5f07[_0xc5c3('0x37')]==='Agents'?_0xc5c3('0x2e'):_0xc5c3('0x30');})['compact']()['value']();for(var _0x28305d=0x0;_0x28305d<_0x5d5248[_0xc5c3('0x47')];_0x28305d++){if(!_['includes'](_0x1156a2,_0x5d5248[_0x28305d][_0xc5c3('0x2a')]))return;var _0x337a54=_0x5d5248[_0x28305d][_0xc5c3('0x2a')]==='agent'?_0xc5c3('0x2d'):_0xc5c3('0x2f');_0x282bee[_0xc5c3('0x48')](db[_0xc5c3('0x86')][_0xc5c3('0x82')]({'name':_0x5d5248[_0x28305d][_0xc5c3('0x37')],'resourceId':_0x5d5248[_0x28305d]['id'],'type':_0x337a54,'sectionId':_[_0xc5c3('0x36')](_0x15f070,[_0xc5c3('0x37'),_0x337a54])['id']},{}));}return BPromise[_0xc5c3('0x4d')](_0x282bee);});})[_0xc5c3('0x13')](respondWithResult(_0x42cfc9,0xc9))[_0xc5c3('0x1d')](handleError(_0x42cfc9,null));};exports[_0xc5c3('0x8b')]=function(_0x4d1f82,_0x48e3a2){if(_0x4d1f82[_0xc5c3('0x5d')]['id']){delete _0x4d1f82['body']['id'];}return db['User'][_0xc5c3('0x36')]({'where':{'id':_0x4d1f82['params']['id']}})[_0xc5c3('0x13')](function(_0x3936ca){if(!_0x3936ca)return null;if(_0x3936ca['id']===_0x4d1f82['user']['id']){if(!_0x4d1f82['body'][_0xc5c3('0x8c')]||!_0x4d1f82['body']['newPassword']){throw new db[(_0xc5c3('0x8d'))][(_0xc5c3('0x8e'))](_0xc5c3('0x8f'));}if(!_0x3936ca[_0xc5c3('0x90')](_0x4d1f82[_0xc5c3('0x5d')][_0xc5c3('0x8c')])){throw new db[(_0xc5c3('0x8d'))][(_0xc5c3('0x8e'))](_0xc5c3('0x91'));}if(_0x4d1f82['body']['oldPassword']===_0x4d1f82[_0xc5c3('0x5d')][_0xc5c3('0x92')]){throw new db[(_0xc5c3('0x8d'))][(_0xc5c3('0x8e'))](_0xc5c3('0x93'));}}else if(_0x4d1f82['user'][_0xc5c3('0x2a')]==='admin'){if(!_0x4d1f82[_0xc5c3('0x5d')][_0xc5c3('0x92')]){throw new db[(_0xc5c3('0x8d'))][(_0xc5c3('0x8e'))](_0xc5c3('0x94'));}}else if(_0x4d1f82[_0xc5c3('0x7b')][_0xc5c3('0x2a')]===_0xc5c3('0x7b')){if(!_0x4d1f82['body']['newPassword']){throw new db['Sequelize'][(_0xc5c3('0x8e'))](_0xc5c3('0x94'));}if(_0x3936ca[_0xc5c3('0x2a')]!==_0xc5c3('0x2e')){throw new db[(_0xc5c3('0x8d'))][(_0xc5c3('0x8e'))](_0xc5c3('0x7c'));}}else{throw new db[(_0xc5c3('0x8d'))][(_0xc5c3('0x8e'))](_0xc5c3('0x7c'));}return _0x3936ca;})['then'](handleEntityNotFound(_0x48e3a2,null))[_0xc5c3('0x13')](function(_0x463900){return db[_0xc5c3('0x95')][_0xc5c3('0x96')]({'attributes':['id',_0xc5c3('0x97'),'enforcePasswordHistory',_0xc5c3('0x98')]})[_0xc5c3('0x13')](function(_0x30b85d){if(_0x30b85d['securePassword'])authService[_0xc5c3('0x64')](_0x4d1f82[_0xc5c3('0x5d')][_0xc5c3('0x92')]);if(!_0x30b85d[_0xc5c3('0x99')]||!_0x463900[_0xc5c3('0x9a')])return _0x463900;authService[_0xc5c3('0x9b')](_0x4d1f82[_0xc5c3('0x5d')]['newPassword'],_0x463900[_0xc5c3('0x9a')],_0x30b85d[_0xc5c3('0x98')]);return _0x463900;})['then'](saveUpdates({'password':_0x4d1f82[_0xc5c3('0x5d')][_0xc5c3('0x92')],'passwordResetAt':_0x4d1f82[_0xc5c3('0x7b')]['id']==_0x4d1f82[_0xc5c3('0x4f')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x4d1f82[_0xc5c3('0x5d')][_0xc5c3('0x92')],_0x463900[_0xc5c3('0x9a')])},null));})[_0xc5c3('0x13')](respondWithResult(_0x48e3a2,null))[_0xc5c3('0x1d')](handleError(_0x48e3a2,null));};exports[_0xc5c3('0x9c')]=function(_0x47bd08,_0x314072){var _0x41944d=_0x47bd08['body'][_0xc5c3('0x9d')];return db['User'][_0xc5c3('0x36')]({'where':{'id':_0x47bd08[_0xc5c3('0x4f')]['id']},'attributes':['id',_0xc5c3('0x37'),_0xc5c3('0x2a'),'online','loginInPause','voicePause',_0xc5c3('0x9e')]})[_0xc5c3('0x13')](handleEntityNotFound(_0x314072,null))[_0xc5c3('0x13')](function(_0x5cebbc){if(_0x5cebbc){if(!utils[_0xc5c3('0x9f')](_0x41944d)){throw new db['Sequelize'][(_0xc5c3('0x8e'))](_0xc5c3('0xa0'));}return _0x5cebbc[_0xc5c3('0xa1')+_[_0xc5c3('0xa2')](_0x41944d[_0xc5c3('0xa3')]())+_0xc5c3('0xa4')](_0x47bd08[_0xc5c3('0x5d')][_0xc5c3('0x61')],{'penalty':_0x47bd08[_0xc5c3('0x5d')][_0xc5c3('0xa5')]||0x0})['spread'](function(_0x21fded){for(var _0x4aaa2f=0x0;_0x4aaa2f<_0x47bd08[_0xc5c3('0x5d')][_0xc5c3('0x61')][_0xc5c3('0x47')];_0x4aaa2f+=0x1){var _0x21941a={'UserId':Number(_0x47bd08['params']['id'])};_0x21941a[_[_0xc5c3('0xa2')](_0x41944d[_0xc5c3('0xa3')]())+_0xc5c3('0xa6')]=Number(_0x47bd08['body']['ids'][_0x4aaa2f]);socket[_0xc5c3('0xa7')]('user'+_[_0xc5c3('0xa2')](_0x41944d[_0xc5c3('0xa3')]())+'Queue:save',_0x21941a);}return _0x21fded;})[_0xc5c3('0x13')](function(){if(_0x41944d===_0xc5c3('0xa8')){return db['VoiceQueue']['findAll']({'where':{'id':_0x47bd08[_0xc5c3('0x5d')][_0xc5c3('0x61')]||[]},'raw':!![],'attributes':['id',_0xc5c3('0x37')]});}})[_0xc5c3('0x13')](function(_0x4fa64c){var _0x252d5a=_0x5cebbc[_0xc5c3('0xa9')]({'plain':!![]});var _0x40d4ba=[];if(_0x41944d==='voice'&&_0x252d5a[_0xc5c3('0x2a')]===_0xc5c3('0x2e')&&_0x252d5a['online']){for(var _0x8ec6b6=0x0;_0x8ec6b6<_0x4fa64c[_0xc5c3('0x47')];_0x8ec6b6+=0x1){_0x40d4ba[_0xc5c3('0x48')]({'membername':_0x252d5a[_0xc5c3('0x37')],'UserId':_0x252d5a['id'],'queue_name':_0x4fa64c[_0x8ec6b6][_0xc5c3('0x37')],'VoiceQueueId':_0x4fa64c[_0x8ec6b6]['id'],'interface':_['isNil'](_0x252d5a[_0xc5c3('0x9e')])?util['format']('SIP/%s',_0x252d5a['name']):_0x252d5a[_0xc5c3('0x9e')],'paused':_0x252d5a['voicePause']||![],'penalty':_0x47bd08[_0xc5c3('0x5d')]['penalty']||0x0});}return BPromise[_0xc5c3('0x89')](_0x40d4ba,function(_0x48eea4){return db[_0xc5c3('0xaa')][_0xc5c3('0xab')](_0x48eea4);});}return _0x5cebbc;});}})[_0xc5c3('0x13')](respondWithStatusCode(_0x314072,null))[_0xc5c3('0x1d')](handleError(_0x314072,null));};exports[_0xc5c3('0xac')]=function(_0x4c12bc,_0x130b8f){var _0x551558;return db['User']['find']({'where':{'id':_0x4c12bc[_0xc5c3('0x4f')]['id']},'attributes':['id',_0xc5c3('0x37'),_0xc5c3('0x2a')]})[_0xc5c3('0x13')](handleEntityNotFound(_0x130b8f,null))[_0xc5c3('0x13')](function(_0x20abd2){if(_0x20abd2){_0x551558=_0x20abd2;if(!_0x4c12bc[_0xc5c3('0x42')][_0xc5c3('0x9d')]||!utils[_0xc5c3('0x9f')](_0x4c12bc[_0xc5c3('0x42')][_0xc5c3('0x9d')])){throw new db['Sequelize'][(_0xc5c3('0x8e'))](_0xc5c3('0xa0'));}return _0x20abd2[_0xc5c3('0xad')+_[_0xc5c3('0xa2')](_0x4c12bc[_0xc5c3('0x42')][_0xc5c3('0x9d')][_0xc5c3('0xa3')]())+'Queues'](_0x4c12bc[_0xc5c3('0x42')][_0xc5c3('0x61')]);}})['then'](function(_0x50a5b7){if(_[_0xc5c3('0xae')](_0x4c12bc[_0xc5c3('0x42')][_0xc5c3('0x61')])){for(var _0x5aec22=0x0;_0x5aec22<_0x4c12bc[_0xc5c3('0x42')][_0xc5c3('0x61')][_0xc5c3('0x47')];_0x5aec22+=0x1){var _0x1dd206={'UserId':Number(_0x4c12bc[_0xc5c3('0x4f')]['id'])};_0x1dd206[_[_0xc5c3('0xa2')](_0x4c12bc[_0xc5c3('0x42')][_0xc5c3('0x9d')][_0xc5c3('0xa3')]())+_0xc5c3('0xa6')]=Number(_0x4c12bc[_0xc5c3('0x42')]['ids'][_0x5aec22]);socket[_0xc5c3('0xa7')](_0xc5c3('0x7b')+_[_0xc5c3('0xa2')](_0x4c12bc[_0xc5c3('0x42')][_0xc5c3('0x9d')][_0xc5c3('0xa3')]())+_0xc5c3('0xaf'),_0x1dd206);}}else{var _0x1dd206={'UserId':Number(_0x4c12bc[_0xc5c3('0x4f')]['id'])};_0x1dd206[_[_0xc5c3('0xa2')](_0x4c12bc['query']['channel'][_0xc5c3('0xa3')]())+_0xc5c3('0xa6')]=Number(_0x4c12bc[_0xc5c3('0x42')][_0xc5c3('0x61')]);socket[_0xc5c3('0xa7')](_0xc5c3('0x7b')+_[_0xc5c3('0xa2')](_0x4c12bc[_0xc5c3('0x42')]['channel']['toLowerCase']())+'Queue:remove',_0x1dd206);}return _0x50a5b7;})[_0xc5c3('0x13')](function(){if(_0x4c12bc[_0xc5c3('0x42')][_0xc5c3('0x9d')]===_0xc5c3('0xa8')){return db['UserVoiceQueueRt'][_0xc5c3('0x29')]({'where':{'UserId':_0x4c12bc[_0xc5c3('0x4f')]['id'],'VoiceQueueId':_0x4c12bc[_0xc5c3('0x42')]['ids']},'individualHooks':!![]})[_0xc5c3('0x13')](function(){return _0x551558;});}return _0x551558;})[_0xc5c3('0x13')](respondWithStatusCode(_0x130b8f,null))[_0xc5c3('0x1d')](handleError(_0x130b8f,null));};exports['addAvatar']=function(_0x5d1d4d,_0x5dd300){_0x5d1d4d[_0xc5c3('0x5d')]['userpic']=_0x5d1d4d[_0xc5c3('0xb0')][_0xc5c3('0xb1')];return db[_0xc5c3('0x3b')][_0xc5c3('0x36')]({'where':{'id':_0x5d1d4d[_0xc5c3('0x4f')]['id']}})[_0xc5c3('0x13')](handleEntityNotFound(_0x5dd300,null))['then'](saveUpdates(_0x5d1d4d[_0xc5c3('0x5d')],null))[_0xc5c3('0x13')](respondWithResult(_0x5dd300,null))[_0xc5c3('0x1d')](handleError(_0x5dd300,null));};exports[_0xc5c3('0xb2')]=function(_0x5672fc,_0x46a273){var _0x3d2db5=path[_0xc5c3('0xb3')](config[_0xc5c3('0xb4')],_0xc5c3('0xb5'));return db['User'][_0xc5c3('0x36')]({'where':{'id':_0x5672fc[_0xc5c3('0x4f')]['id']},'attributes':['id',_0xc5c3('0xb6')],'raw':!![]})[_0xc5c3('0x13')](handleEntityNotFound(_0x46a273,null))['then'](function(_0xbd0a3){if(_0xbd0a3){if(_[_0xc5c3('0x66')](_0xbd0a3['userpic'])){return _0x46a273['download'](_0x3d2db5);}else{if(!fs[_0xc5c3('0xb7')](path[_0xc5c3('0xb3')](config[_0xc5c3('0xb4')],_0xc5c3('0xb8'),_0xbd0a3[_0xc5c3('0xb6')]))){return _0x46a273[_0xc5c3('0xb9')](_0x3d2db5);}return _0x46a273['download'](path['join'](config[_0xc5c3('0xb4')],_0xc5c3('0xb8'),_0xbd0a3[_0xc5c3('0xb6')]));}}})[_0xc5c3('0x1d')](handleError(_0x46a273,null));};exports[_0xc5c3('0xba')]=function(_0x4c6bbb,_0x1b98f7){return db[_0xc5c3('0x3b')][_0xc5c3('0x36')]({'where':{'id':_0x4c6bbb[_0xc5c3('0x4f')]['id']},'attributes':['id']})[_0xc5c3('0x13')](handleEntityNotFound(_0x1b98f7,null))[_0xc5c3('0x13')](function(_0x53dfda){var _0x1eba02=[];values=_0x53dfda['dataValues'];_0x1eba02['push'](get_open_tabs(_0xc5c3('0x5b'),_0x53dfda['dataValues']));_0x1eba02[_0xc5c3('0x48')](get_open_tabs(_0xc5c3('0x4a'),_0x53dfda[_0xc5c3('0x49')]));_0x1eba02[_0xc5c3('0x48')](get_open_tabs(_0xc5c3('0x4c'),_0x53dfda['dataValues']));_0x1eba02[_0xc5c3('0x48')](get_open_tabs(_0xc5c3('0xbb'),_0x53dfda[_0xc5c3('0x49')]));_0x1eba02['push'](get_open_tabs(_0xc5c3('0x5c'),_0x53dfda[_0xc5c3('0x49')]));_0x1eba02['push'](get_open_tabs('mail',_0x53dfda[_0xc5c3('0x49')]));return BPromise[_0xc5c3('0x4d')](_0x1eba02);})[_0xc5c3('0x13')](function(_0x34e392){var _0x20c34e=[];if(_0x34e392){for(var _0xbd55c2=0x0;_0xbd55c2=_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=_0x30890c['agents']){throw new Error(_0x8499('0x50'));}})[_0x8499('0x10')](function(){if(_0x71f717){return db[_0x8499('0x3e')][_0x8499('0x51')]({'where':{'membername':_0x71f717[_0x8499('0x29')]},'individualHooks':!![]});}})[_0x8499('0x10')](function(){if(_0x71f717){return _0x71f717['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x3350ac){if(_0x71f717){if(_0x3350ac){var _0x42ab30=[];_0x31949d=_0x3350ac;if(_0x31949d[_0x8499('0x2e')]){for(var _0x2d767e=0x0;_0x2d767e<_0x31949d[_0x8499('0x2e')];_0x2d767e++){_0x42ab30[_0x8499('0x31')](db[_0x8499('0x3e')][_0x8499('0x52')]({'membername':_0x71f717['name'],'UserId':_0x71f717['id'],'queue_name':_0x31949d[_0x2d767e][_0x8499('0x29')],'VoiceQueueId':_0x31949d[_0x2d767e]['id'],'interface':_0x2baede,'paused':_0x71f717['loginInPause']||![],'penalty':_0x31949d[_0x2d767e][_0x8499('0x53')]||0x0}));}return BPromise[_0x8499('0x47')](_0x42ab30);}}}})[_0x8499('0x10')](function(){if(_0x71f717){return db[_0x8499('0x2d')][_0x8499('0x1d')]({'where':{'membername':_0x71f717[_0x8499('0x29')],'exitAt':null}});}})[_0x8499('0x10')](function(_0x4b7ac5){if(_0x71f717){if(_0x4b7ac5&&_0x4b7ac5[_0x8499('0x2e')]){var _0x35ab47=[];_0x4b7ac5[_0x8499('0x30')](function(_0x4f38ae){_0x35ab47[_0x8499('0x31')](_0x4f38ae[_0x8499('0x2c')]({'exitAt':moment()[_0x8499('0x2f')](_0x8499('0x35'))}));});return BPromise[_0x8499('0x47')](_0x35ab47);}}})[_0x8499('0x10')](function(_0x2031f3){if(_0x71f717){var _0x3d9cad=[];var _0x107e5a=[];var _0x8721af=utils[_0x8499('0x54')]();var _0x86086b={'membername':_0x71f717['name'],'interface':_0x2baede,'enterAt':moment()[_0x8499('0x2f')](_0x8499('0x35')),'role':_0x71f717['role'],'internal':_0x71f717[_0x8499('0x2b')]};_0x8721af['forEach'](function(_0x577179){_0x3d9cad['push'](_[_0x8499('0x55')]({'channel':_0x577179,'type':'LOGIN','data1':_0x8499('0x56'),'data2':_0x2baede},_0x86086b));if(_0x71f717['loginInPause']){_0x107e5a[_0x8499('0x31')](_['merge']({'channel':_0x577179,'type':_0x8499('0x34'),'data1':_0x8499('0x57')},_0x86086b));}});return db[_0x8499('0x2d')]['bulkCreate'](_0x3d9cad[_0x8499('0x58')](_0x107e5a),{'individualHooks':!![]});}})[_0x8499('0x10')](function(){if(_0x71f717){return _0x71f717[_0x8499('0x2c')]({'online':!![],'lastLoginAt':moment()[_0x8499('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x71f717[_0x8499('0x4b')]||![],'mailPause':_0x71f717[_0x8499('0x4b')]||![],'chatPause':_0x71f717[_0x8499('0x4b')]||![],'faxPause':_0x71f717[_0x8499('0x4b')]||![],'smsPause':_0x71f717[_0x8499('0x4b')]||![],'openchannelPause':_0x71f717[_0x8499('0x4b')]||![],'pauseType':_0x71f717[_0x8499('0x4b')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x8499('0x2f')](_0x8499('0x35')),'interface':_0x2baede});}})[_0x8499('0x10')](function(_0x4ef2a3){_0x492cba(_0x4ef2a3);})['catch'](function(_0x57db1e){_0x2f4a28(_0x15f322['error'](0x1f4,_0x57db1e['message']));});});}; \ No newline at end of file +var _0x8b69=['forEach','isNil','body','type','DEFAULT\x20PAUSE','internal','uniqueid','bulkCreate','UnpauseUser','isValidChannel','Unknown\x20channel','voice','find','chat','fax','openchannel','whatsapp','channel','system','set','%s%s','push','all','LogoutUser','findOne','destroy','LoginUser','phone','loginInPause','count','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','merge','callysquare','LOGININPAUSE','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','User,\x20%s,\x20%s,\x20%s','error','code','User,\x20%s,\x20%s','message','catch','GetUser','User','findAll','options','limit','include','map','model','attributes','raw','where','info','ShowUser','debug','stringify','PauseUser','name','role','interface','UserVoiceQueueRt','update','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels'];(function(_0x4bda36,_0xf55fdd){var _0x186e06=function(_0x2cc919){while(--_0x2cc919){_0x4bda36['push'](_0x4bda36['shift']());}};_0x186e06(++_0xf55fdd);}(_0x8b69,0x1f3));var _0x98b6=function(_0x419c19,_0x2c3f45){_0x419c19=_0x419c19-0x0;var _0x1df196=_0x8b69[_0x419c19];return _0x1df196;};'use strict';var _=require(_0x98b6('0x0'));var util=require(_0x98b6('0x1'));var moment=require(_0x98b6('0x2'));var BPromise=require(_0x98b6('0x3'));var rs=require(_0x98b6('0x4'));var fs=require('fs');var Redis=require(_0x98b6('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x98b6('0x6'))(_0x98b6('0x7'));var config=require(_0x98b6('0x8'));var jayson=require(_0x98b6('0x9'));var client=jayson[_0x98b6('0xa')]['http']({'port':0x232a});config[_0x98b6('0xb')]=_[_0x98b6('0xc')](config[_0x98b6('0xb')],{'host':_0x98b6('0xd'),'port':0x18eb});var socket=require(_0x98b6('0xe'))(new Redis(config[_0x98b6('0xb')]));require('./user.socket')[_0x98b6('0xf')](socket);function respondWithRpcPromise(_0x4491f8,_0xcdb2ed,_0x583f94){return new BPromise(function(_0x58f8ec,_0x487a30){return client[_0x98b6('0x10')](_0x4491f8,_0x583f94)[_0x98b6('0x11')](function(_0x451a63){logger['info']('User,\x20%s,\x20%s',_0xcdb2ed,_0x98b6('0x12'));logger['debug'](_0x98b6('0x13'),_0xcdb2ed,_0x98b6('0x12'),JSON['stringify'](_0x451a63));if(_0x451a63[_0x98b6('0x14')]){if(_0x451a63[_0x98b6('0x14')][_0x98b6('0x15')]===0x1f4){logger[_0x98b6('0x14')](_0x98b6('0x16'),_0xcdb2ed,_0x451a63['error'][_0x98b6('0x17')]);return _0x487a30(_0x451a63[_0x98b6('0x14')][_0x98b6('0x17')]);}logger[_0x98b6('0x14')]('User,\x20%s,\x20%s',_0xcdb2ed,_0x451a63[_0x98b6('0x14')][_0x98b6('0x17')]);return _0x58f8ec(_0x451a63[_0x98b6('0x14')]['message']);}else{logger['info']('User,\x20%s,\x20%s',_0xcdb2ed,_0x98b6('0x12'));_0x58f8ec(_0x451a63['result']['message']);}})[_0x98b6('0x18')](function(_0x575c42){logger[_0x98b6('0x14')]('User,\x20%s,\x20%s',_0xcdb2ed,_0x575c42);_0x487a30(_0x575c42);});});}exports[_0x98b6('0x19')]=function(_0x5e9fb2){var _0x343603=this;return new Promise(function(_0x498279,_0x3b2407){return db[_0x98b6('0x1a')][_0x98b6('0x1b')]({'raw':_0x5e9fb2['options']?_0x5e9fb2[_0x98b6('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5e9fb2[_0x98b6('0x1c')]?_0x5e9fb2[_0x98b6('0x1c')]['where']||null:null,'attributes':_0x5e9fb2[_0x98b6('0x1c')]?_0x5e9fb2[_0x98b6('0x1c')]['attributes']||null:null,'limit':_0x5e9fb2[_0x98b6('0x1c')]?_0x5e9fb2[_0x98b6('0x1c')][_0x98b6('0x1d')]||null:null,'include':_0x5e9fb2[_0x98b6('0x1c')]?_0x5e9fb2[_0x98b6('0x1c')][_0x98b6('0x1e')]?_[_0x98b6('0x1f')](_0x5e9fb2[_0x98b6('0x1c')][_0x98b6('0x1e')],function(_0x47dd49){return{'model':db[_0x47dd49[_0x98b6('0x20')]],'as':_0x47dd49['as'],'attributes':_0x47dd49['attributes'],'include':_0x47dd49['include']?_[_0x98b6('0x1f')](_0x47dd49[_0x98b6('0x1e')],function(_0x1c2525){return{'model':db[_0x1c2525[_0x98b6('0x20')]],'as':_0x1c2525['as'],'attributes':_0x1c2525['attributes'],'include':_0x1c2525[_0x98b6('0x1e')]?_[_0x98b6('0x1f')](_0x1c2525[_0x98b6('0x1e')],function(_0xf09c2b){return{'model':db[_0xf09c2b['model']],'as':_0xf09c2b['as'],'attributes':_0xf09c2b[_0x98b6('0x21')]};}):[]};}):[]};}):[]:[]})[_0x98b6('0x11')](function(_0x3a112c){logger['info'](_0x98b6('0x19'),_0x5e9fb2);logger['debug']('GetUser',_0x5e9fb2,JSON['stringify'](_0x3a112c));_0x498279(_0x3a112c);})[_0x98b6('0x18')](function(_0x5b3ee7){logger[_0x98b6('0x14')]('GetUser',_0x5b3ee7[_0x98b6('0x17')],_0x5e9fb2);_0x3b2407(_0x343603[_0x98b6('0x14')](0x1f4,_0x5b3ee7[_0x98b6('0x17')]));});});};exports['ShowUser']=function(_0x29bcef){var _0x13128b=this;return new Promise(function(_0x167bcb,_0x32d4b2){return db[_0x98b6('0x1a')]['find']({'raw':_0x29bcef[_0x98b6('0x1c')]?_0x29bcef['options'][_0x98b6('0x22')]===undefined?!![]:![]:!![],'where':_0x29bcef[_0x98b6('0x1c')]?_0x29bcef[_0x98b6('0x1c')][_0x98b6('0x23')]||null:null,'attributes':_0x29bcef[_0x98b6('0x1c')]?_0x29bcef[_0x98b6('0x1c')][_0x98b6('0x21')]||null:null,'include':_0x29bcef[_0x98b6('0x1c')]?_0x29bcef['options']['include']?_[_0x98b6('0x1f')](_0x29bcef['options'][_0x98b6('0x1e')],function(_0x5335df){return{'model':db[_0x5335df[_0x98b6('0x20')]],'as':_0x5335df['as'],'attributes':_0x5335df[_0x98b6('0x21')],'include':_0x5335df[_0x98b6('0x1e')]?_[_0x98b6('0x1f')](_0x5335df[_0x98b6('0x1e')],function(_0x579b10){return{'model':db[_0x579b10['model']],'as':_0x579b10['as'],'attributes':_0x579b10[_0x98b6('0x21')],'include':_0x579b10[_0x98b6('0x1e')]?_[_0x98b6('0x1f')](_0x579b10[_0x98b6('0x1e')],function(_0x10642e){return{'model':db[_0x10642e[_0x98b6('0x20')]],'as':_0x10642e['as'],'attributes':_0x10642e[_0x98b6('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3baa64){logger[_0x98b6('0x24')](_0x98b6('0x25'),_0x29bcef);logger[_0x98b6('0x26')](_0x98b6('0x25'),_0x29bcef,JSON[_0x98b6('0x27')](_0x3baa64));_0x167bcb(_0x3baa64);})[_0x98b6('0x18')](function(_0x23ea9b){logger[_0x98b6('0x14')](_0x98b6('0x25'),_0x23ea9b['message'],_0x29bcef);_0x32d4b2(_0x13128b[_0x98b6('0x14')](0x1f4,_0x23ea9b[_0x98b6('0x17')]));});});};exports[_0x98b6('0x28')]=function(_0x2552b5){var _0x520b69=this;return new Promise(function(_0x2737b0,_0x1857a4){var _0x2a5e41;return db[_0x98b6('0x1a')]['find']({'where':_0x2552b5['options'][_0x98b6('0x23')]||{},'attributes':['id',_0x98b6('0x29'),_0x98b6('0x2a'),'internal',_0x98b6('0x2b')]})[_0x98b6('0x11')](function(_0x28a21e){if(_0x28a21e){_0x2a5e41=_0x28a21e;return db[_0x98b6('0x2c')][_0x98b6('0x2d')]({'paused':0x1},{'where':{'UserId':_0x2a5e41['id']},'individualHooks':!![]});}})['then'](function(){if(_0x2a5e41){return db[_0x98b6('0x2e')]['findAll']({'where':{'membername':_0x2a5e41[_0x98b6('0x29')],'type':_0x98b6('0x2f'),'exitAt':null}});}})[_0x98b6('0x11')](function(_0x33730f){if(_0x2a5e41){if(_0x33730f&&_0x33730f[_0x98b6('0x30')]){var _0x43020e=moment()[_0x98b6('0x31')](_0x98b6('0x32'));for(var _0x4b6389=0x0,_0x192e69=_0x33730f[_0x98b6('0x30')];_0x4b6389<_0x192e69;_0x4b6389++){_0x33730f[_0x4b6389][_0x98b6('0x33')]({'exitAt':_0x43020e});}}}})[_0x98b6('0x11')](function(){if(_0x2a5e41){var _0x35b600=[];var _0x20caff=utils[_0x98b6('0x34')]();_0x20caff[_0x98b6('0x35')](function(_0x2f6d5f){_0x35b600['push']({'channel':_0x2f6d5f,'membername':_0x2a5e41['name'],'interface':_[_0x98b6('0x36')](_0x2a5e41[_0x98b6('0x2b')])?util[_0x98b6('0x31')]('SIP/%s',_0x2a5e41[_0x98b6('0x29')]):_0x2a5e41[_0x98b6('0x2b')],'type':_0x98b6('0x2f'),'enterAt':moment()['format'](_0x98b6('0x32')),'data1':_0x2552b5[_0x98b6('0x37')][_0x98b6('0x38')]||_0x98b6('0x39'),'role':_0x2a5e41[_0x98b6('0x2a')],'internal':_0x2a5e41[_0x98b6('0x3a')],'uniqueid':_0x2552b5[_0x98b6('0x37')][_0x98b6('0x3b')]||null});});return db[_0x98b6('0x2e')][_0x98b6('0x3c')](_0x35b600,{'individualHooks':!![]});}})['then'](function(){if(_0x2a5e41){return _0x2a5e41[_0x98b6('0x2d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x2552b5[_0x98b6('0x37')][_0x98b6('0x38')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format'](_0x98b6('0x32'))});}})[_0x98b6('0x11')](function(_0x41171d){_0x2737b0(_0x41171d);})[_0x98b6('0x18')](function(_0x5ad8a2){_0x1857a4(_0x520b69[_0x98b6('0x14')](0x1f4,_0x5ad8a2[_0x98b6('0x17')]));});});};exports[_0x98b6('0x3d')]=function(_0x46633a){var _0x552ef5=this;return new Promise(function(_0x1692b0,_0xbfc577){var _0x1ee350;return db[_0x98b6('0x1a')]['findOne']({'where':_0x46633a[_0x98b6('0x1c')]['where']||{},'attributes':['id',_0x98b6('0x29')]})['then'](function(_0x5df522){if(_0x5df522){_0x1ee350=_0x5df522;if(_0x46633a[_0x98b6('0x37')]['channel']&&!utils[_0x98b6('0x3e')](_0x46633a[_0x98b6('0x37')]['channel'])){throw new Error(_0x98b6('0x3f'));}switch(_0x46633a[_0x98b6('0x37')]['channel']){case _0x98b6('0x40'):return db[_0x98b6('0x2c')][_0x98b6('0x2d')]({'paused':0x0},{'where':{'UserId':_0x1ee350['id']}})[_0x98b6('0x11')](function(){return db[_0x98b6('0x2e')][_0x98b6('0x41')]({'where':{'channel':_0x46633a[_0x98b6('0x37')]['channel'],'membername':_0x1ee350[_0x98b6('0x29')],'type':_0x98b6('0x2f'),'exitAt':null}});})[_0x98b6('0x11')](function(_0x1be346){if(_0x1be346){return _0x1be346[_0x98b6('0x2d')]({'exitAt':moment()[_0x98b6('0x31')](_0x98b6('0x32')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0x98b6('0x11')](function(){return _0x1ee350[_0x98b6('0x2d')]({'voicePause':![]});});case'mail':case _0x98b6('0x42'):case _0x98b6('0x43'):case'sms':case _0x98b6('0x44'):case _0x98b6('0x45'):return db[_0x98b6('0x2e')][_0x98b6('0x41')]({'where':{'channel':_0x46633a[_0x98b6('0x37')][_0x98b6('0x46')],'membername':_0x1ee350[_0x98b6('0x29')],'type':_0x98b6('0x2f'),'exitAt':null}})[_0x98b6('0x11')](function(_0x548bc8){return _0x548bc8[_0x98b6('0x2d')]({'exitAt':moment()[_0x98b6('0x31')](_0x98b6('0x32')),'data2':_0x98b6('0x47')},{'individualHooks':!![]});})[_0x98b6('0x11')](function(){var _0x191924={};_[_0x98b6('0x48')](_0x191924,util[_0x98b6('0x31')](_0x98b6('0x49'),_0x46633a[_0x98b6('0x37')][_0x98b6('0x46')],'Pause'),![]);return _0x1ee350[_0x98b6('0x2d')](_0x191924);});default:return db['UserVoiceQueueRt'][_0x98b6('0x2d')]({'paused':0x0},{'where':{'UserId':_0x1ee350['id']}})[_0x98b6('0x11')](function(){return db[_0x98b6('0x2e')][_0x98b6('0x1b')]({'where':{'membername':_0x1ee350['name'],'type':_0x98b6('0x2f'),'exitAt':null}});})[_0x98b6('0x11')](function(_0x2ad96a){var _0x263d89=[];_0x2ad96a[_0x98b6('0x35')](function(_0x1c6ceb){_0x263d89[_0x98b6('0x4a')](_0x1c6ceb['update']({'exitAt':moment()[_0x98b6('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'}));});return BPromise[_0x98b6('0x4b')](_0x263d89);})[_0x98b6('0x11')](function(){return _0x1ee350['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})['then'](function(_0x32002b){_0x1692b0(_0x32002b);})[_0x98b6('0x18')](function(_0x226b1b){_0xbfc577(_0x552ef5[_0x98b6('0x14')](0x1f4,_0x226b1b[_0x98b6('0x17')]));});});};exports[_0x98b6('0x4c')]=function(_0x389725){var _0x3cad40=this;return new Promise(function(_0x4aa611,_0x3f7772){var _0x299162;return db[_0x98b6('0x1a')][_0x98b6('0x4d')]({'where':_0x389725[_0x98b6('0x1c')][_0x98b6('0x23')]||{},'attributes':['id',_0x98b6('0x29')]})[_0x98b6('0x11')](function(_0x5cb6a1){if(_0x5cb6a1){_0x299162=_0x5cb6a1;return db[_0x98b6('0x2c')][_0x98b6('0x4e')]({'where':{'membername':_0x299162[_0x98b6('0x29')]},'individualHooks':!![]});}})[_0x98b6('0x11')](function(){if(_0x299162){return db['MemberReport'][_0x98b6('0x1b')]({'where':{'membername':_0x299162['name'],'exitAt':null}});}})['then'](function(_0x16824c){if(_0x299162){if(_0x16824c&&_0x16824c['length']){var _0x2af31c=[];_0x16824c[_0x98b6('0x35')](function(_0x3dbdcf){_0x2af31c['push'](_0x3dbdcf['update']({'exitAt':moment()[_0x98b6('0x31')](_0x98b6('0x32'))}));});return BPromise[_0x98b6('0x4b')](_0x2af31c);}}})[_0x98b6('0x11')](function(){if(_0x299162){return _0x299162['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x98b6('0x11')](function(_0x498f9e){_0x4aa611(_0x498f9e);})[_0x98b6('0x18')](function(_0x213e0c){_0x3f7772(_0x3cad40[_0x98b6('0x14')](0x1f4,_0x213e0c[_0x98b6('0x17')]));});});};exports[_0x98b6('0x4f')]=function(_0x1cc227){var _0x3e2dee=this;return new Promise(function(_0x301fef,_0x26bea2){var _0x4af880;var _0x24ded;var _0x17198f;var _0x339363;return db[_0x98b6('0x1a')][_0x98b6('0x4d')]({'where':_0x1cc227['options'][_0x98b6('0x23')]||{},'attributes':['id',_0x98b6('0x29'),_0x98b6('0x2a'),'mobile',_0x98b6('0x50'),_0x98b6('0x3a'),_0x98b6('0x51'),_0x98b6('0x2b')]})[_0x98b6('0x11')](function(_0x174a73){if(_0x174a73){_0x4af880=_0x174a73;_0x339363=_0x1cc227[_0x98b6('0x37')]['interface']?_0x1cc227[_0x98b6('0x37')][_0x98b6('0x2b')]:util[_0x98b6('0x31')]('SIP/%s',_0x4af880[_0x98b6('0x29')]);return db[_0x98b6('0x1a')][_0x98b6('0x52')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x4af880['id']}}});}})[_0x98b6('0x11')](function(_0x3ff8b6){if(_0x3ff8b6){_0x17198f=_0x3ff8b6;return require(_0x98b6('0x53'))[_0x98b6('0x54')]();}})['then'](function(_0x143115){if(_0x143115&&_0x143115[_0x98b6('0x55')]&&_0x17198f>=_0x143115[_0x98b6('0x55')]){throw new Error(_0x98b6('0x56'));}})[_0x98b6('0x11')](function(){if(_0x4af880){return db[_0x98b6('0x2c')][_0x98b6('0x4e')]({'where':{'membername':_0x4af880[_0x98b6('0x29')]},'individualHooks':!![]});}})[_0x98b6('0x11')](function(){if(_0x4af880){return _0x4af880['getVoiceQueues']({'raw':!![]});}})[_0x98b6('0x11')](function(_0x260743){if(_0x4af880){if(_0x260743){var _0x165eac=[];_0x24ded=_0x260743;if(_0x24ded['length']){for(var _0x4533af=0x0;_0x4533af<_0x24ded[_0x98b6('0x30')];_0x4533af++){_0x165eac['push'](db[_0x98b6('0x2c')][_0x98b6('0x57')]({'membername':_0x4af880[_0x98b6('0x29')],'UserId':_0x4af880['id'],'queue_name':_0x24ded[_0x4533af]['name'],'VoiceQueueId':_0x24ded[_0x4533af]['id'],'interface':_0x339363,'paused':_0x4af880['loginInPause']||![],'penalty':_0x24ded[_0x4533af][_0x98b6('0x58')]||0x0}));}return BPromise[_0x98b6('0x4b')](_0x165eac);}}}})[_0x98b6('0x11')](function(){if(_0x4af880){return db[_0x98b6('0x2e')]['findAll']({'where':{'membername':_0x4af880[_0x98b6('0x29')],'exitAt':null}});}})['then'](function(_0x53d545){if(_0x4af880){if(_0x53d545&&_0x53d545[_0x98b6('0x30')]){var _0x1c4447=[];_0x53d545['forEach'](function(_0x6b992a){_0x1c4447[_0x98b6('0x4a')](_0x6b992a['update']({'exitAt':moment()[_0x98b6('0x31')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x1c4447);}}})['then'](function(_0x360e62){if(_0x4af880){var _0x42a60d=[];var _0x5618bd=[];var _0x48c487=utils['getChannels']();var _0x18f54e={'membername':_0x4af880[_0x98b6('0x29')],'interface':_0x339363,'enterAt':moment()['format'](_0x98b6('0x32')),'role':_0x4af880[_0x98b6('0x2a')],'internal':_0x4af880['internal']};_0x48c487['forEach'](function(_0x3d56a7){_0x42a60d[_0x98b6('0x4a')](_[_0x98b6('0x59')]({'channel':_0x3d56a7,'type':'LOGIN','data1':_0x98b6('0x5a'),'data2':_0x339363},_0x18f54e));if(_0x4af880['loginInPause']){_0x5618bd['push'](_[_0x98b6('0x59')]({'channel':_0x3d56a7,'type':_0x98b6('0x2f'),'data1':'LOGININPAUSE'},_0x18f54e));}});return db[_0x98b6('0x2e')][_0x98b6('0x3c')](_0x42a60d['concat'](_0x5618bd),{'individualHooks':!![]});}})['then'](function(){if(_0x4af880){return _0x4af880[_0x98b6('0x2d')]({'online':!![],'lastLoginAt':moment()['format'](_0x98b6('0x32')),'voicePause':_0x4af880[_0x98b6('0x51')]||![],'mailPause':_0x4af880[_0x98b6('0x51')]||![],'chatPause':_0x4af880[_0x98b6('0x51')]||![],'faxPause':_0x4af880[_0x98b6('0x51')]||![],'smsPause':_0x4af880[_0x98b6('0x51')]||![],'openchannelPause':_0x4af880['loginInPause']||![],'pauseType':_0x4af880[_0x98b6('0x51')]?_0x98b6('0x5b'):null,'lastPauseAt':moment()['format'](_0x98b6('0x32')),'interface':_0x339363});}})[_0x98b6('0x11')](function(_0x3ec9c5){_0x301fef(_0x3ec9c5);})['catch'](function(_0x58e5b2){_0x26bea2(_0x3e2dee['error'](0x1f4,_0x58e5b2['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index d938f52..25fd1f3 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 _0x2247=['remove','emit','removeListener','length','user:','save'];(function(_0x302c39,_0x3b65bd){var _0x715207=function(_0x1d8b1c){while(--_0x1d8b1c){_0x302c39['push'](_0x302c39['shift']());}};_0x715207(++_0x3b65bd);}(_0x2247,0x83));var _0x7224=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x2247[_0x465a0c];return _0x1e202e;};'use strict';var UserEvents=require('./user.events');var events=[_0x7224('0x0'),_0x7224('0x1'),'update'];function createListener(_0x4d1211,_0x515dad){return function(_0x59f330){_0x515dad[_0x7224('0x2')](_0x4d1211,_0x59f330);};}function removeListener(_0x130620,_0x471edb){return function(){UserEvents[_0x7224('0x3')](_0x130620,_0x471edb);};}exports['register']=function(_0x48a75a){for(var _0x5a0405=0x0,_0x2295bc=events[_0x7224('0x4')];_0x5a0405<_0x2295bc;_0x5a0405++){var _0x4a4dab=events[_0x5a0405];var _0x3e8725=createListener(_0x7224('0x5')+_0x4a4dab,_0x48a75a);UserEvents['on'](_0x4a4dab,_0x3e8725);}}; \ No newline at end of file +var _0x3a18=['register','length','./user.events','remove','emit','removeListener'];(function(_0x10291b,_0x518773){var _0x1d5fbe=function(_0x24df58){while(--_0x24df58){_0x10291b['push'](_0x10291b['shift']());}};_0x1d5fbe(++_0x518773);}(_0x3a18,0xec));var _0x83a1=function(_0x36f502,_0x2eb401){_0x36f502=_0x36f502-0x0;var _0xbbce8b=_0x3a18[_0x36f502];return _0xbbce8b;};'use strict';var UserEvents=require(_0x83a1('0x0'));var events=['save',_0x83a1('0x1'),'update'];function createListener(_0x313941,_0xa94b8a){return function(_0x3c1d11){_0xa94b8a[_0x83a1('0x2')](_0x313941,_0x3c1d11);};}function removeListener(_0x53393d,_0x48b2a6){return function(){UserEvents[_0x83a1('0x3')](_0x53393d,_0x48b2a6);};}exports[_0x83a1('0x4')]=function(_0x2025e1){for(var _0x5f4d1a=0x0,_0x29069c=events[_0x83a1('0x5')];_0x5f4d1a<_0x29069c;_0x5f4d1a++){var _0x130d07=events[_0x5f4d1a];var _0x57eb8a=createListener('user:'+_0x130d07,_0x2025e1);UserEvents['on'](_0x130d07,_0x57eb8a);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index d11b430..a87763c 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4f1ed7,_0x1cb746){var _0x3a822a=function(_0x48fa07){while(--_0x48fa07){_0x4f1ed7['push'](_0x4f1ed7['shift']());}};_0x3a822a(++_0x1cb746);}(_0x70e0,0x17b));var _0x070e=function(_0x355927,_0x19cd34){_0x355927=_0x355927-0x0;var _0x3f428e=_0x70e0[_0x355927];return _0x3f428e;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x397062,_0x4aab61){var _0x3c0e4e=function(_0x18bf78){while(--_0x18bf78){_0x397062['push'](_0x397062['shift']());}};_0x3c0e4e(++_0x4aab61);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x438685,_0x4ec0c0){_0x438685=_0x438685-0x0;var _0x41cca2=_0xcb91[_0x438685];return _0x41cca2;};'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 54a0b6a..e2df234 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 _0x4093=['INTEGER','sequelize','exports'];(function(_0x44d163,_0x324c7e){var _0x38fd98=function(_0x5ca06f){while(--_0x5ca06f){_0x44d163['push'](_0x44d163['shift']());}};_0x38fd98(++_0x324c7e);}(_0x4093,0x18d));var _0x3409=function(_0x3ce6cb,_0x37e063){_0x3ce6cb=_0x3ce6cb-0x0;var _0x29e774=_0x4093[_0x3ce6cb];return _0x29e774;};'use strict';var Sequelize=require(_0x3409('0x0'));module[_0x3409('0x1')]={'penalty':{'type':Sequelize[_0x3409('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xef6d=['exports','INTEGER'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xef6d,0x12c));var _0xdef6=function(_0x4a50ea,_0xfbf1a7){_0x4a50ea=_0x4a50ea-0x0;var _0x31dd6c=_0xef6d[_0x4a50ea];return _0x31dd6c;};'use strict';var Sequelize=require('sequelize');module[_0xdef6('0x0')]={'penalty':{'type':Sequelize[_0xdef6('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index ddf3826..bdd78b3 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 _0x3446=['lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userChatQueue.attributes','define','UserChatQueue'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3446,0x172));var _0x6344=function(_0x25210d,_0x33e6f4){_0x25210d=_0x25210d-0x0;var _0x24b740=_0x3446[_0x25210d];return _0x24b740;};'use strict';var _=require(_0x6344('0x0'));var util=require('util');var logger=require(_0x6344('0x1'))(_0x6344('0x2'));var moment=require(_0x6344('0x3'));var BPromise=require('bluebird');var rp=require(_0x6344('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6344('0x5'));var config=require(_0x6344('0x6'));var attributes=require(_0x6344('0x7'));module['exports']=function(_0x351f0d,_0x3cd6c9){return _0x351f0d[_0x6344('0x8')](_0x6344('0x9'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1a1=['rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2a4097,_0x26529d){var _0x549104=function(_0x3bf607){while(--_0x3bf607){_0x2a4097['push'](_0x2a4097['shift']());}};_0x549104(++_0x26529d);}(_0xe1a1,0x1e7));var _0x1e1a=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xe1a1[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x1e1a('0x0'));var util=require(_0x1e1a('0x1'));var logger=require(_0x1e1a('0x2'))(_0x1e1a('0x3'));var moment=require(_0x1e1a('0x4'));var BPromise=require(_0x1e1a('0x5'));var rp=require(_0x1e1a('0x6'));var fs=require('fs');var path=require(_0x1e1a('0x7'));var rimraf=require(_0x1e1a('0x8'));var config=require(_0x1e1a('0x9'));var attributes=require(_0x1e1a('0xa'));module[_0x1e1a('0xb')]=function(_0x57739d,_0x2f3ece){return _0x57739d[_0x1e1a('0xc')](_0x1e1a('0xd'),attributes,{'tableName':_0x1e1a('0xe'),'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 ca2ddf0..3835693 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 _0x9f91=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird'];(function(_0x1655bd,_0x4f0990){var _0x1de8b9=function(_0x42342f){while(--_0x42342f){_0x1655bd['push'](_0x1655bd['shift']());}};_0x1de8b9(++_0x4f0990);}(_0x9f91,0x1b5));var _0x19f9=function(_0x4382bc,_0x231a2d){_0x4382bc=_0x4382bc-0x0;var _0x13c82a=_0x9f91[_0x4382bc];return _0x13c82a;};'use strict';var _=require(_0x19f9('0x0'));var util=require(_0x19f9('0x1'));var moment=require(_0x19f9('0x2'));var BPromise=require(_0x19f9('0x3'));var rs=require(_0x19f9('0x4'));var fs=require('fs');var Redis=require(_0x19f9('0x5'));var db=require(_0x19f9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x19f9('0x7'))(_0x19f9('0x8'));var config=require(_0x19f9('0x9'));var jayson=require(_0x19f9('0xa'));var client=jayson[_0x19f9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x72852d,_0x139bcb,_0x54ed28){return new BPromise(function(_0x464ec6,_0x19746e){return client['request'](_0x72852d,_0x54ed28)['then'](function(_0x4b10e7){logger[_0x19f9('0xc')](_0x19f9('0xd'),_0x139bcb,'request\x20sent');logger[_0x19f9('0xe')](_0x19f9('0xf'),_0x139bcb,_0x19f9('0x10'),JSON[_0x19f9('0x11')](_0x4b10e7));if(_0x4b10e7['error']){if(_0x4b10e7[_0x19f9('0x12')][_0x19f9('0x13')]===0x1f4){logger['error'](_0x19f9('0xd'),_0x139bcb,_0x4b10e7[_0x19f9('0x12')][_0x19f9('0x14')]);return _0x19746e(_0x4b10e7['error'][_0x19f9('0x14')]);}logger[_0x19f9('0x12')](_0x19f9('0xd'),_0x139bcb,_0x4b10e7[_0x19f9('0x12')]['message']);return _0x464ec6(_0x4b10e7[_0x19f9('0x12')][_0x19f9('0x14')]);}else{logger['info'](_0x19f9('0xd'),_0x139bcb,_0x19f9('0x10'));_0x464ec6(_0x4b10e7['result'][_0x19f9('0x14')]);}})['catch'](function(_0x48fdab){logger[_0x19f9('0x12')](_0x19f9('0xd'),_0x139bcb,_0x48fdab);_0x19746e(_0x48fdab);});});} \ No newline at end of file +var _0x99cd=['info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x99cd,0x17a));var _0xd99c=function(_0x543a45,_0x46ae0b){_0x543a45=_0x543a45-0x0;var _0x54094a=_0x99cd[_0x543a45];return _0x54094a;};'use strict';var _=require(_0xd99c('0x0'));var util=require(_0xd99c('0x1'));var moment=require(_0xd99c('0x2'));var BPromise=require(_0xd99c('0x3'));var rs=require(_0xd99c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd99c('0x5'))['db'];var utils=require(_0xd99c('0x6'));var logger=require('../../config/logger')(_0xd99c('0x7'));var config=require('../../config/environment');var jayson=require(_0xd99c('0x8'));var client=jayson[_0xd99c('0x9')][_0xd99c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d9578,_0x56c7d4,_0x13a978){return new BPromise(function(_0x354276,_0x514d42){return client[_0xd99c('0xb')](_0x3d9578,_0x13a978)[_0xd99c('0xc')](function(_0x464849){logger[_0xd99c('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x56c7d4,_0xd99c('0xe'));logger[_0xd99c('0xf')](_0xd99c('0x10'),_0x56c7d4,_0xd99c('0xe'),JSON[_0xd99c('0x11')](_0x464849));if(_0x464849['error']){if(_0x464849[_0xd99c('0x12')][_0xd99c('0x13')]===0x1f4){logger[_0xd99c('0x12')](_0xd99c('0x14'),_0x56c7d4,_0x464849[_0xd99c('0x12')][_0xd99c('0x15')]);return _0x514d42(_0x464849[_0xd99c('0x12')][_0xd99c('0x15')]);}logger[_0xd99c('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x56c7d4,_0x464849[_0xd99c('0x12')][_0xd99c('0x15')]);return _0x354276(_0x464849['error']['message']);}else{logger[_0xd99c('0xd')](_0xd99c('0x14'),_0x56c7d4,_0xd99c('0xe'));_0x354276(_0x464849['result']['message']);}})[_0xd99c('0x16')](function(_0x7e690d){logger[_0xd99c('0x12')](_0xd99c('0x14'),_0x56c7d4,_0x7e690d);_0x514d42(_0x7e690d);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 1f42220..2338700 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4aba6d,_0x2674fe){var _0x1d4aa7=function(_0xcf41dc){while(--_0xcf41dc){_0x4aba6d['push'](_0x4aba6d['shift']());}};_0x1d4aa7(++_0x2674fe);}(_0xe706,0xa3));var _0x6e70=function(_0x5f1d5a,_0x1c85a7){_0x5f1d5a=_0x5f1d5a-0x0;var _0x449071=_0xe706[_0x5f1d5a];return _0x449071;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x24ec6f,_0x1de736){var _0x2b3d05=function(_0x1d5215){while(--_0x1d5215){_0x24ec6f['push'](_0x24ec6f['shift']());}};_0x2b3d05(++_0x1de736);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 3c34ac8..9d3fb0c 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 _0xea59=['sequelize','exports','INTEGER','STRING'];(function(_0xfa4074,_0x49a334){var _0x59f498=function(_0x1d0ed3){while(--_0x1d0ed3){_0xfa4074['push'](_0xfa4074['shift']());}};_0x59f498(++_0x49a334);}(_0xea59,0x158));var _0x9ea5=function(_0x46099d,_0x37a1ea){_0x46099d=_0x46099d-0x0;var _0x3edbbf=_0xea59[_0x46099d];return _0x3edbbf;};'use strict';var Sequelize=require(_0x9ea5('0x0'));module[_0x9ea5('0x1')]={'penalty':{'type':Sequelize[_0x9ea5('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x9ea5('0x3')]}}; \ No newline at end of file +var _0xe78a=['STRING','sequelize','exports','INTEGER'];(function(_0x577f8c,_0x18216f){var _0x1c742e=function(_0xb73f87){while(--_0xb73f87){_0x577f8c['push'](_0x577f8c['shift']());}};_0x1c742e(++_0x18216f);}(_0xe78a,0x69));var _0xae78=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe78a[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xae78('0x0'));module[_0xae78('0x1')]={'penalty':{'type':Sequelize[_0xae78('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xae78('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xae78('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index d530f9a..b64597f 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 _0x9b88=['bluebird','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','UserFaxQueue','user_has_fax_queues','lodash','util','api','moment'];(function(_0xf5bbc2,_0x49e6c5){var _0x3d9a7b=function(_0x2c5e32){while(--_0x2c5e32){_0xf5bbc2['push'](_0xf5bbc2['shift']());}};_0x3d9a7b(++_0x49e6c5);}(_0x9b88,0xb0));var _0x89b8=function(_0x448e8d,_0x43a056){_0x448e8d=_0x448e8d-0x0;var _0x46e774=_0x9b88[_0x448e8d];return _0x46e774;};'use strict';var _=require(_0x89b8('0x0'));var util=require(_0x89b8('0x1'));var logger=require('../../config/logger')(_0x89b8('0x2'));var moment=require(_0x89b8('0x3'));var BPromise=require(_0x89b8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x89b8('0x5'));var rimraf=require(_0x89b8('0x6'));var config=require(_0x89b8('0x7'));var attributes=require(_0x89b8('0x8'));module[_0x89b8('0x9')]=function(_0x4e57f0,_0x1ef9a0){return _0x4e57f0['define'](_0x89b8('0xa'),attributes,{'tableName':_0x89b8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b1b=['../../config/logger','api','bluebird','request-promise','path','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','util'];(function(_0x5a0e3a,_0x20b187){var _0x1a57be=function(_0x4435cd){while(--_0x4435cd){_0x5a0e3a['push'](_0x5a0e3a['shift']());}};_0x1a57be(++_0x20b187);}(_0x9b1b,0x154));var _0xb9b1=function(_0x75fb94,_0x293b77){_0x75fb94=_0x75fb94-0x0;var _0x11a386=_0x9b1b[_0x75fb94];return _0x11a386;};'use strict';var _=require('lodash');var util=require(_0xb9b1('0x0'));var logger=require(_0xb9b1('0x1'))(_0xb9b1('0x2'));var moment=require('moment');var BPromise=require(_0xb9b1('0x3'));var rp=require(_0xb9b1('0x4'));var fs=require('fs');var path=require(_0xb9b1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb9b1('0x6'));module[_0xb9b1('0x7')]=function(_0x2b483d,_0x2a50d0){return _0x2b483d[_0xb9b1('0x8')](_0xb9b1('0x9'),attributes,{'tableName':_0xb9b1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index b06fb9e..7ee81aa 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 _0xef71=['util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','info','request\x20sent','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef71,0xe6));var _0x1ef7=function(_0x37ab7b,_0x509b5b){_0x37ab7b=_0x37ab7b-0x0;var _0x3b871f=_0xef71[_0x37ab7b];return _0x3b871f;};'use strict';var _=require('lodash');var util=require(_0x1ef7('0x0'));var moment=require(_0x1ef7('0x1'));var BPromise=require('bluebird');var rs=require(_0x1ef7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1ef7('0x3'));var logger=require(_0x1ef7('0x4'))(_0x1ef7('0x5'));var config=require(_0x1ef7('0x6'));var jayson=require(_0x1ef7('0x7'));var client=jayson[_0x1ef7('0x8')][_0x1ef7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c1d8f,_0x137c04,_0x32acbe){return new BPromise(function(_0x55f91b,_0x405f45){return client[_0x1ef7('0xa')](_0x5c1d8f,_0x32acbe)[_0x1ef7('0xb')](function(_0x4ddafc){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x137c04,'request\x20sent');logger[_0x1ef7('0xc')](_0x1ef7('0xd'),_0x137c04,'request\x20sent',JSON[_0x1ef7('0xe')](_0x4ddafc));if(_0x4ddafc[_0x1ef7('0xf')]){if(_0x4ddafc[_0x1ef7('0xf')][_0x1ef7('0x10')]===0x1f4){logger[_0x1ef7('0xf')](_0x1ef7('0x11'),_0x137c04,_0x4ddafc['error']['message']);return _0x405f45(_0x4ddafc[_0x1ef7('0xf')][_0x1ef7('0x12')]);}logger[_0x1ef7('0xf')](_0x1ef7('0x11'),_0x137c04,_0x4ddafc[_0x1ef7('0xf')][_0x1ef7('0x12')]);return _0x55f91b(_0x4ddafc[_0x1ef7('0xf')]['message']);}else{logger[_0x1ef7('0x13')](_0x1ef7('0x11'),_0x137c04,_0x1ef7('0x14'));_0x55f91b(_0x4ddafc[_0x1ef7('0x15')][_0x1ef7('0x12')]);}})[_0x1ef7('0x16')](function(_0x35a06b){logger[_0x1ef7('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x137c04,_0x35a06b);_0x405f45(_0x35a06b);});});} \ No newline at end of file +var _0x8f91=['code','message','UserFaxQueue,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x185f00,_0x1f9754){var _0x2ef08e=function(_0x1c3c93){while(--_0x1c3c93){_0x185f00['push'](_0x185f00['shift']());}};_0x2ef08e(++_0x1f9754);}(_0x8f91,0x12b));var _0x18f9=function(_0x2e0ad4,_0x9d440b){_0x2e0ad4=_0x2e0ad4-0x0;var _0x515575=_0x8f91[_0x2e0ad4];return _0x515575;};'use strict';var _=require('lodash');var util=require(_0x18f9('0x0'));var moment=require(_0x18f9('0x1'));var BPromise=require(_0x18f9('0x2'));var rs=require(_0x18f9('0x3'));var fs=require('fs');var Redis=require(_0x18f9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x18f9('0x5'));var logger=require(_0x18f9('0x6'))(_0x18f9('0x7'));var config=require(_0x18f9('0x8'));var jayson=require(_0x18f9('0x9'));var client=jayson[_0x18f9('0xa')][_0x18f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x578088,_0x2f6404,_0x5d54a9){return new BPromise(function(_0x1d63d3,_0x4670ab){return client['request'](_0x578088,_0x5d54a9)['then'](function(_0x5cf115){logger[_0x18f9('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x2f6404,_0x18f9('0xd'));logger['debug'](_0x18f9('0xe'),_0x2f6404,'request\x20sent',JSON['stringify'](_0x5cf115));if(_0x5cf115[_0x18f9('0xf')]){if(_0x5cf115[_0x18f9('0xf')][_0x18f9('0x10')]===0x1f4){logger[_0x18f9('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x2f6404,_0x5cf115[_0x18f9('0xf')][_0x18f9('0x11')]);return _0x4670ab(_0x5cf115[_0x18f9('0xf')][_0x18f9('0x11')]);}logger[_0x18f9('0xf')](_0x18f9('0x12'),_0x2f6404,_0x5cf115[_0x18f9('0xf')][_0x18f9('0x11')]);return _0x1d63d3(_0x5cf115['error']['message']);}else{logger[_0x18f9('0xc')](_0x18f9('0x12'),_0x2f6404,_0x18f9('0xd'));_0x1d63d3(_0x5cf115[_0x18f9('0x13')]['message']);}})[_0x18f9('0x14')](function(_0x136d93){logger[_0x18f9('0xf')](_0x18f9('0x12'),_0x2f6404,_0x136d93);_0x4670ab(_0x136d93);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index e2ba7ac..dc66561 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3a0e69,_0x32be95){var _0x5529ef=function(_0x37deeb){while(--_0x37deeb){_0x3a0e69['push'](_0x3a0e69['shift']());}};_0x5529ef(++_0x32be95);}(_0xe706,0xa3));var _0x6e70=function(_0x425561,_0x3a4598){_0x425561=_0x425561-0x0;var _0x303b28=_0xe706[_0x425561];return _0x303b28;};'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(_0x1620b3,_0x5639c3){var _0x44e88e=function(_0x11e7d4){while(--_0x11e7d4){_0x1620b3['push'](_0x1620b3['shift']());}};_0x44e88e(++_0x5639c3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2bf5bd,_0x120787){_0x2bf5bd=_0x2bf5bd-0x0;var _0xc810c0=_0xcb91[_0x2bf5bd];return _0xc810c0;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 763de7c..ed579c6 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 _0x5f60=['sequelize','exports','INTEGER'];(function(_0x5cfc14,_0x37daf8){var _0xc05473=function(_0x41dc24){while(--_0x41dc24){_0x5cfc14['push'](_0x5cfc14['shift']());}};_0xc05473(++_0x37daf8);}(_0x5f60,0x15c));var _0x05f6=function(_0x967959,_0x53c5c1){_0x967959=_0x967959-0x0;var _0x5c4489=_0x5f60[_0x967959];return _0x5c4489;};'use strict';var Sequelize=require(_0x05f6('0x0'));module[_0x05f6('0x1')]={'penalty':{'type':Sequelize[_0x05f6('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6d03=['sequelize','INTEGER'];(function(_0x5ecd41,_0x3468c8){var _0x1dbf8d=function(_0x2b2eaf){while(--_0x2b2eaf){_0x5ecd41['push'](_0x5ecd41['shift']());}};_0x1dbf8d(++_0x3468c8);}(_0x6d03,0x174));var _0x36d0=function(_0x1c556e,_0x68b373){_0x1c556e=_0x1c556e-0x0;var _0x50e1b0=_0x6d03[_0x1c556e];return _0x50e1b0;};'use strict';var Sequelize=require(_0x36d0('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x36d0('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index dd8dce5..3e3cb8f 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 _0x2c9d=['bluebird','request-promise','path','exports','define','UserMailQueue','user_has_mail_queues','util','../../config/logger','api'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2c9d,0x1d3));var _0xd2c9=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x2c9d[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require('lodash');var util=require(_0xd2c9('0x0'));var logger=require(_0xd2c9('0x1'))(_0xd2c9('0x2'));var moment=require('moment');var BPromise=require(_0xd2c9('0x3'));var rp=require(_0xd2c9('0x4'));var fs=require('fs');var path=require(_0xd2c9('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userMailQueue.attributes');module[_0xd2c9('0x6')]=function(_0x2eb88b,_0x5966a8){return _0x2eb88b[_0xd2c9('0x7')](_0xd2c9('0x8'),attributes,{'tableName':_0xd2c9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea5a=['exports','define','UserMailQueue','user_has_mail_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xea5a,0x1e5));var _0xaea5=function(_0x4d77a4,_0x3be85a){_0x4d77a4=_0x4d77a4-0x0;var _0x15a00e=_0xea5a[_0x4d77a4];return _0x15a00e;};'use strict';var _=require('lodash');var util=require(_0xaea5('0x0'));var logger=require(_0xaea5('0x1'))(_0xaea5('0x2'));var moment=require(_0xaea5('0x3'));var BPromise=require(_0xaea5('0x4'));var rp=require(_0xaea5('0x5'));var fs=require('fs');var path=require(_0xaea5('0x6'));var rimraf=require(_0xaea5('0x7'));var config=require(_0xaea5('0x8'));var attributes=require('./userMailQueue.attributes');module[_0xaea5('0x9')]=function(_0xa430ba,_0xdfff38){return _0xa430ba[_0xaea5('0xa')](_0xaea5('0xb'),attributes,{'tableName':_0xaea5('0xc'),'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 3303dd7..825d325 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 _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(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x1cb9,0x14e));var _0x91cb=function(_0x15a6ee,_0xcdc694){_0x15a6ee=_0x15a6ee-0x0;var _0xa70903=_0x1cb9[_0x15a6ee];return _0xa70903;};'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 +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(_0x1be0a0,_0x40b5dc){var _0x3f1281=function(_0x365f90){while(--_0x365f90){_0x1be0a0['push'](_0x1be0a0['shift']());}};_0x3f1281(++_0x40b5dc);}(_0xe14b,0x93));var _0xbe14=function(_0x17f5e5,_0x4bc59c){_0x17f5e5=_0x17f5e5-0x0;var _0x2b4ea7=_0xe14b[_0x17f5e5];return _0x2b4ea7;};'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 diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 68b30b7..1f241e7 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 _0x6a83=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util','path','express'];(function(_0x388603,_0x56d558){var _0x29ef86=function(_0x3c56bc){while(--_0x3c56bc){_0x388603['push'](_0x388603['shift']());}};_0x29ef86(++_0x56d558);}(_0x6a83,0x1ea));var _0x36a8=function(_0x599cde,_0xcf15f2){_0x599cde=_0x599cde-0x0;var _0x572989=_0x6a83[_0x599cde];return _0x572989;};'use strict';var multer=require(_0x36a8('0x0'));var util=require(_0x36a8('0x1'));var path=require(_0x36a8('0x2'));var timeout=require('connect-timeout');var express=require(_0x36a8('0x3'));var router=express[_0x36a8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x36a8('0x5'));var interaction=require(_0x36a8('0x6'));var config=require(_0x36a8('0x7'));var controller=require(_0x36a8('0x8'));router[_0x36a8('0x9')]('/',auth[_0x36a8('0xa')](),controller[_0x36a8('0xb')]);module[_0x36a8('0xc')]=router; \ No newline at end of file +var _0x4c72=['../../components/interaction/service','../../config/environment','./userNotification.controller','isAuthenticated','sendUserNotification','multer','util','path','express','../../components/auth/service'];(function(_0x553c25,_0x40a8c9){var _0x5c1c6a=function(_0x455f56){while(--_0x455f56){_0x553c25['push'](_0x553c25['shift']());}};_0x5c1c6a(++_0x40a8c9);}(_0x4c72,0x113));var _0x24c7=function(_0x3386dc,_0x39a16e){_0x3386dc=_0x3386dc-0x0;var _0x478903=_0x4c72[_0x3386dc];return _0x478903;};'use strict';var multer=require(_0x24c7('0x0'));var util=require(_0x24c7('0x1'));var path=require(_0x24c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x24c7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x24c7('0x4'));var interaction=require(_0x24c7('0x5'));var config=require(_0x24c7('0x6'));var controller=require(_0x24c7('0x7'));router['post']('/',auth[_0x24c7('0x8')](),controller[_0x24c7('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index ccf5a32..ac9aafb 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 _0x91f7=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x1cf6ef,_0x3a4330){var _0x291a34=function(_0x173cf1){while(--_0x173cf1){_0x1cf6ef['push'](_0x1cf6ef['shift']());}};_0x291a34(++_0x3a4330);}(_0x91f7,0x1c2));var _0x791f=function(_0x419ddb,_0xb3bd1e){_0x419ddb=_0x419ddb-0x0;var _0x3c3450=_0x91f7[_0x419ddb];return _0x3c3450;};'use strict';var Sequelize=require(_0x791f('0x0'));module[_0x791f('0x1')]={'body':{'type':Sequelize[_0x791f('0x2')]},'senderName':{'type':Sequelize[_0x791f('0x3')]},'recipientsId':{'type':Sequelize[_0x791f('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x791f('0x4')]}}; \ No newline at end of file +var _0x8495=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x25ef04,_0xa61c49){var _0x54d745=function(_0x34d1cf){while(--_0x34d1cf){_0x25ef04['push'](_0x25ef04['shift']());}};_0x54d745(++_0xa61c49);}(_0x8495,0x163));var _0x5849=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x8495[_0x139a3c];return _0x2b375b;};'use strict';var Sequelize=require(_0x5849('0x0'));module[_0x5849('0x1')]={'body':{'type':Sequelize[_0x5849('0x2')]},'senderName':{'type':Sequelize[_0x5849('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x5849('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 8372805..fa958bd 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 _0x3f61=['socket.io-emitter','./userNotification.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','end','error','stack','name','send','sendUserNotification','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','emit','userNotification:send','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','User','union','queue','replace','Queue','push','flatten','getAgents','map','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost'];(function(_0x37affd,_0x53e54d){var _0x5c385a=function(_0x246e90){while(--_0x246e90){_0x37affd['push'](_0x37affd['shift']());}};_0x5c385a(++_0x53e54d);}(_0x3f61,0x1f2));var _0x13f6=function(_0x193b07,_0x33e453){_0x193b07=_0x193b07-0x0;var _0x345cab=_0x3f61[_0x193b07];return _0x345cab;};'use strict';var emlformat=require(_0x13f6('0x0'));var rimraf=require(_0x13f6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x13f6('0x2'));var rp=require(_0x13f6('0x3'));var moment=require('moment');var BPromise=require(_0x13f6('0x4'));var Mustache=require(_0x13f6('0x5'));var util=require('util');var path=require(_0x13f6('0x6'));var sox=require('sox');var csv=require(_0x13f6('0x7'));var ejs=require(_0x13f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x13f6('0x9'));var squel=require(_0x13f6('0xa'));var crypto=require(_0x13f6('0xb'));var jsforce=require(_0x13f6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x13f6('0x7'));var querystring=require(_0x13f6('0xd'));var Papa=require(_0x13f6('0xe'));var Redis=require(_0x13f6('0xf'));var authService=require(_0x13f6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x13f6('0x11'));var hardwareService=require(_0x13f6('0x12'));var logger=require(_0x13f6('0x13'))(_0x13f6('0x14'));var utils=require(_0x13f6('0x15'));var config=require(_0x13f6('0x16'));var licenseUtil=require(_0x13f6('0x17'));var db=require('../../mysqldb')['db'];config[_0x13f6('0x18')]=_[_0x13f6('0x19')](config[_0x13f6('0x18')],{'host':_0x13f6('0x1a'),'port':0x18eb});var socket=require(_0x13f6('0x1b'))(new Redis(config[_0x13f6('0x18')]));require(_0x13f6('0x1c'))[_0x13f6('0x1d')](socket);function respondWithStatusCode(_0x1c63a8,_0x3a5c5f){_0x3a5c5f=_0x3a5c5f||0xcc;return function(_0x111f38){if(_0x111f38){return _0x1c63a8[_0x13f6('0x1e')](_0x3a5c5f);}return _0x1c63a8[_0x13f6('0x1f')](_0x3a5c5f)['end']();};}function respondWithResult(_0x24ef01,_0x45b9bf){_0x45b9bf=_0x45b9bf||0xc8;return function(_0x346abb){if(_0x346abb){return _0x24ef01[_0x13f6('0x1f')](_0x45b9bf)[_0x13f6('0x20')](_0x346abb);}};}function respondWithFilteredResult(_0x5a7f03,_0x42f47e){return function(_0x9d37ed){if(_0x9d37ed){var _0x85cbdb=typeof _0x42f47e['offset']===_0x13f6('0x21')&&typeof _0x42f47e[_0x13f6('0x22')]===_0x13f6('0x21');var _0x344439=_0x9d37ed[_0x13f6('0x23')];var _0x16adb7=_0x85cbdb?0x0:_0x42f47e[_0x13f6('0x24')];var _0xd45be5=_0x85cbdb?_0x9d37ed[_0x13f6('0x23')]:_0x42f47e[_0x13f6('0x24')]+_0x42f47e[_0x13f6('0x22')];var _0x41289f;if(_0xd45be5>=_0x344439){_0xd45be5=_0x344439;_0x41289f=0xc8;}else{_0x41289f=0xce;}_0x5a7f03[_0x13f6('0x1f')](_0x41289f);return _0x5a7f03[_0x13f6('0x25')]('Content-Range',_0x16adb7+'-'+_0xd45be5+'/'+_0x344439)[_0x13f6('0x20')](_0x9d37ed);}return null;};}function patchUpdates(_0x1268a3){return function(_0x342bc5){try{jsonpatch[_0x13f6('0x26')](_0x342bc5,_0x1268a3,!![]);}catch(_0x3f70e8){return BPromise[_0x13f6('0x27')](_0x3f70e8);}return _0x342bc5['save']();};}function saveUpdates(_0x3f5bc8,_0x2ccfec){return function(_0xcb3f46){if(_0xcb3f46){return _0xcb3f46[_0x13f6('0x28')](_0x3f5bc8)[_0x13f6('0x29')](function(_0x444a86){return _0x444a86;});}return null;};}function removeEntity(_0x3d74f7,_0x43e6fb){return function(_0x9b9588){if(_0x9b9588){return _0x9b9588[_0x13f6('0x2a')]()['then'](function(){_0x3d74f7[_0x13f6('0x1f')](0xcc)[_0x13f6('0x2b')]();});}};}function handleEntityNotFound(_0x1bbb37,_0x126aa8){return function(_0x3dd6e3){if(!_0x3dd6e3){_0x1bbb37[_0x13f6('0x1e')](0x194);}return _0x3dd6e3;};}function handleError(_0x535a5e,_0x4abe4d){_0x4abe4d=_0x4abe4d||0x1f4;return function(_0x488608){logger[_0x13f6('0x2c')](_0x488608[_0x13f6('0x2d')]);if(_0x488608['name']){delete _0x488608[_0x13f6('0x2e')];}_0x535a5e[_0x13f6('0x1f')](_0x4abe4d)[_0x13f6('0x2f')](_0x488608);};}exports[_0x13f6('0x30')]=function(_0x4f866e,_0x25eab5,_0x2d1631){if(!_0x4f866e['body'][_0x13f6('0x31')](_0x13f6('0x32'))&&!_0x4f866e[_0x13f6('0x33')]['hasOwnProperty'](_0x13f6('0x34'))){throw new db[(_0x13f6('0x35'))][(_0x13f6('0x36'))](_0x13f6('0x37'));}else{if(_0x4f866e[_0x13f6('0x33')][_0x13f6('0x31')]('TemplateId')&&!_0x4f866e['body']['hasOwnProperty'](_0x13f6('0x38'))){throw new db[(_0x13f6('0x35'))][(_0x13f6('0x36'))](_0x13f6('0x39'));}if(!_0x4f866e[_0x13f6('0x33')][_0x13f6('0x31')](_0x13f6('0x3a'))){throw new db[(_0x13f6('0x35'))][(_0x13f6('0x36'))](_0x13f6('0x3b'));}else{try{var _0x3629c0=JSON['parse'](_0x4f866e[_0x13f6('0x33')][_0x13f6('0x3a')]);}catch(_0x2ddef6){logger['error'](_0x2ddef6);throw new db[(_0x13f6('0x35'))][(_0x13f6('0x36'))](_0x13f6('0x3c'));}var _0x251592=['chatqueue',_0x13f6('0x3d'),_0x13f6('0x3e'),_0x13f6('0x3f'),_0x13f6('0x40'),'voicequeue',_0x13f6('0x41'),_0x13f6('0x42'),_0x13f6('0x43')];if(_[_0x13f6('0x44')](_0x3629c0,function(_0x50335a){return!_[_0x13f6('0x45')](_0x251592,_0x50335a[_0x13f6('0x46')][_0x13f6('0x47')]());})){throw new db[(_0x13f6('0x35'))][(_0x13f6('0x36'))](_0x13f6('0x48'));}}}var _0x23a6b6={};_0x23a6b6[_0x13f6('0x49')]=_0x4f866e['body'][_0x13f6('0x31')]('senderName')?_0x4f866e[_0x13f6('0x33')]['senderName']:_0x4f866e[_0x13f6('0x43')][_0x13f6('0x4a')];_0x23a6b6[_0x13f6('0x4b')]=_[_0x13f6('0x4c')](_0x4f866e[_0x13f6('0x33')][_0x13f6('0x4b')])?null:_0x4f866e[_0x13f6('0x33')][_0x13f6('0x4b')];_0x23a6b6['beep']=_0x4f866e[_0x13f6('0x33')][_0x13f6('0x4d')]||![];_0x23a6b6[_0x13f6('0x4e')]=_0x4f866e['user']['id'];return getContent(_0x4f866e[_0x13f6('0x33')])[_0x13f6('0x29')](function(_0x2670d3){_0x23a6b6[_0x13f6('0x33')]=_0x2670d3;return getRecipients(_0x3629c0);})[_0x13f6('0x29')](function(_0x2f0cfd){_0x23a6b6[_0x13f6('0x4f')]=_[_0x13f6('0x50')](_0x2f0cfd)[_0x13f6('0x51')](',');return db[_0x13f6('0x52')][_0x13f6('0x53')](function(_0x67baf2){return db[_0x13f6('0x54')][_0x13f6('0x55')](_0x23a6b6,{'raw':!![],'transaction':_0x67baf2})[_0x13f6('0x29')](function(_0x40460b){var _0x259075={'sender':_0x23a6b6[_0x13f6('0x49')],'description':_0x23a6b6[_0x13f6('0x4b')],'content':_0x23a6b6[_0x13f6('0x33')],'beep':_0x23a6b6[_0x13f6('0x4d')]};_0x2f0cfd[_0x13f6('0x56')](function(_0x1032c2){_0x259075['recipient']=_0x1032c2;socket[_0x13f6('0x57')](_0x13f6('0x58'),_0x259075);});return _0x40460b;});});})['then'](respondWithResult(_0x25eab5,0xc9))[_0x13f6('0x59')](handleError(_0x25eab5,null));};function getContent(_0x1a476e){return new BPromise(function(_0x59a11c,_0x23c0b3){if(_0x1a476e['text']){_0x59a11c(_0x1a476e[_0x13f6('0x32')]);return;}return db[_0x13f6('0x5a')][_0x13f6('0x5b')]({'attributes':['html'],'where':{'id':_0x1a476e[_0x13f6('0x34')]},'raw':!![]})['then'](function(_0x4c76b6){if(!_0x4c76b6)throw new db[(_0x13f6('0x35'))][(_0x13f6('0x36'))](_0x13f6('0x5c'));var _0x49e4eb=Mustache[_0x13f6('0x5d')](_0x4c76b6[_0x13f6('0x5e')],_0x1a476e[_0x13f6('0x38')]);_0x59a11c(_0x49e4eb);})[_0x13f6('0x59')](function(_0x49bec7){_0x23c0b3(_0x49bec7);});});}function getRecipients(_0x545c06){return new BPromise(function(_0x42ba8e,_0x27fae8){var _0x1b70f1=[];var _0x33dfae=[];_0x545c06[_0x13f6('0x56')](function(_0xc8a287){var _0x2673a1=_[_0x13f6('0x5f')](_0xc8a287['model']['toLowerCase']());if(_0x2673a1===_0x13f6('0x60')){_0x1b70f1=_[_0x13f6('0x61')](_0x1b70f1,_0xc8a287['ids']);}else{if(_[_0x13f6('0x45')](_0x2673a1,_0x13f6('0x62')))_0x2673a1=_0x2673a1[_0x13f6('0x63')](_0x13f6('0x62'),_0x13f6('0x64'));_0xc8a287['ids'][_0x13f6('0x56')](function(_0xb9a9ca){_0x33dfae[_0x13f6('0x65')](getAgents(_0x2673a1,_0xb9a9ca));});}});return BPromise['all'](_0x33dfae)['then'](function(_0x324529){_0x1b70f1=_[_0x13f6('0x61')](_0x1b70f1,_[_0x13f6('0x66')](_0x324529));_0x42ba8e(_0x1b70f1);})['catch'](function(_0x1ae667){_0x27fae8(_0x1ae667);});});}function getAgents(_0x12f929,_0x171427){return new BPromise(function(_0xa689e1,_0x3a9fb5){return db[_0x12f929][_0x13f6('0x5b')]({'where':{'id':_0x171427}})[_0x13f6('0x29')](function(_0x27bf9a){return _0x27bf9a[_0x13f6('0x67')]({'attributes':['id'],'raw':!![]})['then'](function(_0xc5d620){var _0x2b519c=_[_0x13f6('0x68')](_0xc5d620,'id');_0xa689e1(_0x2b519c);});})[_0x13f6('0x59')](function(_0x3a6d2f){_0x3a9fb5(_0x3a6d2f);});});} \ No newline at end of file +var _0xd551=['Queue','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','create','forEach','recipient','emit','userNotification:send','text','Template','findOne','render','html','catch','User','union','ids','queue'];(function(_0x3cc751,_0x38b8ff){var _0x3956a2=function(_0x237cbc){while(--_0x237cbc){_0x3cc751['push'](_0x3cc751['shift']());}};_0x3956a2(++_0x38b8ff);}(_0xd551,0x6a));var _0x1d55=function(_0x50161b,_0x4b98eb){_0x50161b=_0x50161b-0x0;var _0x58c059=_0xd551[_0x50161b];return _0x58c059;};'use strict';var emlformat=require(_0x1d55('0x0'));var rimraf=require(_0x1d55('0x1'));var zipdir=require(_0x1d55('0x2'));var jsonpatch=require(_0x1d55('0x3'));var rp=require(_0x1d55('0x4'));var moment=require(_0x1d55('0x5'));var BPromise=require(_0x1d55('0x6'));var Mustache=require(_0x1d55('0x7'));var util=require(_0x1d55('0x8'));var path=require(_0x1d55('0x9'));var sox=require(_0x1d55('0xa'));var csv=require(_0x1d55('0xb'));var ejs=require(_0x1d55('0xc'));var fs=require('fs');var fs_extra=require(_0x1d55('0xd'));var _=require('lodash');var squel=require(_0x1d55('0xe'));var crypto=require(_0x1d55('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x1d55('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1d55('0x11'));var Papa=require(_0x1d55('0x12'));var Redis=require(_0x1d55('0x13'));var authService=require(_0x1d55('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1d55('0x15'))('api');var utils=require(_0x1d55('0x16'));var config=require(_0x1d55('0x17'));var licenseUtil=require(_0x1d55('0x18'));var db=require(_0x1d55('0x19'))['db'];config[_0x1d55('0x1a')]=_[_0x1d55('0x1b')](config['redis'],{'host':_0x1d55('0x1c'),'port':0x18eb});var socket=require(_0x1d55('0x1d'))(new Redis(config[_0x1d55('0x1a')]));require(_0x1d55('0x1e'))[_0x1d55('0x1f')](socket);function respondWithStatusCode(_0x441ced,_0x2c756f){_0x2c756f=_0x2c756f||0xcc;return function(_0x268f05){if(_0x268f05){return _0x441ced[_0x1d55('0x20')](_0x2c756f);}return _0x441ced['status'](_0x2c756f)[_0x1d55('0x21')]();};}function respondWithResult(_0x39a235,_0x2fa1fd){_0x2fa1fd=_0x2fa1fd||0xc8;return function(_0x59e708){if(_0x59e708){return _0x39a235[_0x1d55('0x22')](_0x2fa1fd)[_0x1d55('0x23')](_0x59e708);}};}function respondWithFilteredResult(_0xd8002f,_0x532ce4){return function(_0x2da09f){if(_0x2da09f){var _0x55520f=typeof _0x532ce4[_0x1d55('0x24')]===_0x1d55('0x25')&&typeof _0x532ce4[_0x1d55('0x26')]===_0x1d55('0x25');var _0x2a1bf0=_0x2da09f['count'];var _0x25e493=_0x55520f?0x0:_0x532ce4[_0x1d55('0x24')];var _0x5b6e85=_0x55520f?_0x2da09f[_0x1d55('0x27')]:_0x532ce4[_0x1d55('0x24')]+_0x532ce4[_0x1d55('0x26')];var _0x339364;if(_0x5b6e85>=_0x2a1bf0){_0x5b6e85=_0x2a1bf0;_0x339364=0xc8;}else{_0x339364=0xce;}_0xd8002f['status'](_0x339364);return _0xd8002f[_0x1d55('0x28')](_0x1d55('0x29'),_0x25e493+'-'+_0x5b6e85+'/'+_0x2a1bf0)['json'](_0x2da09f);}return null;};}function patchUpdates(_0x3a9330){return function(_0x2b6d6b){try{jsonpatch[_0x1d55('0x2a')](_0x2b6d6b,_0x3a9330,!![]);}catch(_0x45d0f3){return BPromise[_0x1d55('0x2b')](_0x45d0f3);}return _0x2b6d6b[_0x1d55('0x2c')]();};}function saveUpdates(_0x5da7e0,_0x47075d){return function(_0x334487){if(_0x334487){return _0x334487[_0x1d55('0x2d')](_0x5da7e0)[_0x1d55('0x2e')](function(_0x57b1c0){return _0x57b1c0;});}return null;};}function removeEntity(_0xdf052,_0x44939b){return function(_0x5e2be7){if(_0x5e2be7){return _0x5e2be7[_0x1d55('0x2f')]()[_0x1d55('0x2e')](function(){_0xdf052[_0x1d55('0x22')](0xcc)[_0x1d55('0x21')]();});}};}function handleEntityNotFound(_0x41530a,_0x18e53f){return function(_0x2fa3b1){if(!_0x2fa3b1){_0x41530a[_0x1d55('0x20')](0x194);}return _0x2fa3b1;};}function handleError(_0x87d93c,_0x512cf6){_0x512cf6=_0x512cf6||0x1f4;return function(_0x4659ae){logger[_0x1d55('0x30')](_0x4659ae[_0x1d55('0x31')]);if(_0x4659ae['name']){delete _0x4659ae[_0x1d55('0x32')];}_0x87d93c[_0x1d55('0x22')](_0x512cf6)[_0x1d55('0x33')](_0x4659ae);};}exports[_0x1d55('0x34')]=function(_0x6524bc,_0x1ed0ce,_0x5a2728){if(!_0x6524bc[_0x1d55('0x35')][_0x1d55('0x36')]('text')&&!_0x6524bc[_0x1d55('0x35')]['hasOwnProperty'](_0x1d55('0x37'))){throw new db[(_0x1d55('0x38'))]['ValidationError'](_0x1d55('0x39'));}else{if(_0x6524bc[_0x1d55('0x35')]['hasOwnProperty'](_0x1d55('0x37'))&&!_0x6524bc['body'][_0x1d55('0x36')](_0x1d55('0x3a'))){throw new db[(_0x1d55('0x38'))][(_0x1d55('0x3b'))](_0x1d55('0x3c'));}if(!_0x6524bc[_0x1d55('0x35')][_0x1d55('0x36')]('recipients')){throw new db['Sequelize'][(_0x1d55('0x3b'))](_0x1d55('0x3d'));}else{try{var _0x33234b=JSON['parse'](_0x6524bc[_0x1d55('0x35')][_0x1d55('0x3e')]);}catch(_0x380e01){logger['error'](_0x380e01);throw new db['Sequelize'][(_0x1d55('0x3b'))](_0x1d55('0x3f'));}var _0x107b5c=[_0x1d55('0x40'),'faxqueue',_0x1d55('0x41'),_0x1d55('0x42'),'smsqueue',_0x1d55('0x43'),_0x1d55('0x44'),_0x1d55('0x45'),_0x1d55('0x46')];if(_['some'](_0x33234b,function(_0x297c13){return!_[_0x1d55('0x47')](_0x107b5c,_0x297c13['model'][_0x1d55('0x48')]());})){throw new db[(_0x1d55('0x38'))]['ValidationError'](_0x1d55('0x49'));}}}var _0x4162b8={};_0x4162b8[_0x1d55('0x4a')]=_0x6524bc[_0x1d55('0x35')][_0x1d55('0x36')]('senderName')?_0x6524bc[_0x1d55('0x35')][_0x1d55('0x4a')]:_0x6524bc['user'][_0x1d55('0x4b')];_0x4162b8[_0x1d55('0x4c')]=_[_0x1d55('0x4d')](_0x6524bc[_0x1d55('0x35')][_0x1d55('0x4c')])?null:_0x6524bc[_0x1d55('0x35')]['recipientsDescription'];_0x4162b8[_0x1d55('0x4e')]=_0x6524bc[_0x1d55('0x35')]['beep']||![];_0x4162b8[_0x1d55('0x4f')]=_0x6524bc[_0x1d55('0x46')]['id'];return getContent(_0x6524bc['body'])['then'](function(_0x51752d){_0x4162b8[_0x1d55('0x35')]=_0x51752d;return getRecipients(_0x33234b);})['then'](function(_0x305851){_0x4162b8[_0x1d55('0x50')]=_[_0x1d55('0x51')](_0x305851)[_0x1d55('0x52')](',');return db[_0x1d55('0x53')][_0x1d55('0x54')](function(_0x10869f){return db['UserNotification'][_0x1d55('0x55')](_0x4162b8,{'raw':!![],'transaction':_0x10869f})[_0x1d55('0x2e')](function(_0x30cd48){var _0x578159={'sender':_0x4162b8['senderName'],'description':_0x4162b8[_0x1d55('0x4c')],'content':_0x4162b8[_0x1d55('0x35')],'beep':_0x4162b8[_0x1d55('0x4e')]};_0x305851[_0x1d55('0x56')](function(_0x5cb11c){_0x578159[_0x1d55('0x57')]=_0x5cb11c;socket[_0x1d55('0x58')](_0x1d55('0x59'),_0x578159);});return _0x30cd48;});});})[_0x1d55('0x2e')](respondWithResult(_0x1ed0ce,0xc9))['catch'](handleError(_0x1ed0ce,null));};function getContent(_0xdc49c4){return new BPromise(function(_0xd81a9f,_0x5cbba9){if(_0xdc49c4[_0x1d55('0x5a')]){_0xd81a9f(_0xdc49c4['text']);return;}return db[_0x1d55('0x5b')][_0x1d55('0x5c')]({'attributes':['html'],'where':{'id':_0xdc49c4[_0x1d55('0x37')]},'raw':!![]})[_0x1d55('0x2e')](function(_0x7855bf){if(!_0x7855bf)throw new db[(_0x1d55('0x38'))][(_0x1d55('0x3b'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x267e53=Mustache[_0x1d55('0x5d')](_0x7855bf[_0x1d55('0x5e')],_0xdc49c4['view']);_0xd81a9f(_0x267e53);})[_0x1d55('0x5f')](function(_0x948bb9){_0x5cbba9(_0x948bb9);});});}function getRecipients(_0x2e69de){return new BPromise(function(_0xd7ac66,_0xeba21a){var _0x127d36=[];var _0x40705c=[];_0x2e69de[_0x1d55('0x56')](function(_0x126428){var _0xf503db=_['startCase'](_0x126428['model']['toLowerCase']());if(_0xf503db===_0x1d55('0x60')){_0x127d36=_[_0x1d55('0x61')](_0x127d36,_0x126428[_0x1d55('0x62')]);}else{if(_[_0x1d55('0x47')](_0xf503db,_0x1d55('0x63')))_0xf503db=_0xf503db['replace']('queue',_0x1d55('0x64'));_0x126428[_0x1d55('0x62')][_0x1d55('0x56')](function(_0x18d7aa){_0x40705c['push'](getAgents(_0xf503db,_0x18d7aa));});}});return BPromise['all'](_0x40705c)['then'](function(_0x2e2196){_0x127d36=_['union'](_0x127d36,_['flatten'](_0x2e2196));_0xd7ac66(_0x127d36);})[_0x1d55('0x5f')](function(_0x8b218b){_0xeba21a(_0x8b218b);});});}function getAgents(_0x1a89db,_0x2f1e25){return new BPromise(function(_0x317565,_0x2a761c){return db[_0x1a89db][_0x1d55('0x5c')]({'where':{'id':_0x2f1e25}})[_0x1d55('0x2e')](function(_0x50812f){return _0x50812f[_0x1d55('0x65')]({'attributes':['id'],'raw':!![]})[_0x1d55('0x2e')](function(_0x1d7e68){var _0x1427bc=_[_0x1d55('0x66')](_0x1d7e68,'id');_0x317565(_0x1427bc);});})['catch'](function(_0x31ac64){_0x2a761c(_0x31ac64);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index af59a33..0ea56c1 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 _0xe277=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x269f41,_0x26703f){var _0x5c5d53=function(_0x566147){while(--_0x566147){_0x269f41['push'](_0x269f41['shift']());}};_0x5c5d53(++_0x26703f);}(_0xe277,0x98));var _0x7e27=function(_0x4ed372,_0x1976a9){_0x4ed372=_0x4ed372-0x0;var _0x55cb71=_0xe277[_0x4ed372];return _0x55cb71;};'use strict';var EventEmitter=require(_0x7e27('0x0'));var UserNotification=require(_0x7e27('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x7e27('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7e27('0x3'),'afterDestroy':_0x7e27('0x4')};function emitEvent(_0x1b32d3){return function(_0xed0d69,_0x56ee51,_0x181a6e){UserNotificationEvents[_0x7e27('0x5')](_0x1b32d3+':'+_0xed0d69['id'],_0xed0d69);UserNotificationEvents['emit'](_0x1b32d3,_0xed0d69);_0x181a6e(null);};}for(var e in events){if(events[_0x7e27('0x6')](e)){var event=events[e];UserNotification[_0x7e27('0x7')](e,emitEvent(event));}}module[_0x7e27('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xc70a=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove','emit'];(function(_0x2e7392,_0x2e2eca){var _0x315714=function(_0x13bd2f){while(--_0x13bd2f){_0x2e7392['push'](_0x2e7392['shift']());}};_0x315714(++_0x2e2eca);}(_0xc70a,0x78));var _0xac70=function(_0x222547,_0x1663fb){_0x222547=_0x222547-0x0;var _0x3f739b=_0xc70a[_0x222547];return _0x3f739b;};'use strict';var EventEmitter=require(_0xac70('0x0'));var UserNotification=require(_0xac70('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xac70('0x2'),'afterUpdate':_0xac70('0x3'),'afterDestroy':_0xac70('0x4')};function emitEvent(_0x49954e){return function(_0x245659,_0x268373,_0x141c66){UserNotificationEvents[_0xac70('0x5')](_0x49954e+':'+_0x245659['id'],_0x245659);UserNotificationEvents[_0xac70('0x5')](_0x49954e,_0x245659);_0x141c66(null);};}for(var e in events){if(events[_0xac70('0x6')](e)){var event=events[e];UserNotification[_0xac70('0x7')](e,emitEvent(event));}}module[_0xac70('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 29163f6..94eb075 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 _0xb59a=['utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','define','userNotifications','utf8mb4'];(function(_0x288e55,_0x49419b){var _0x4fd8b4=function(_0x4bce1d){while(--_0x4bce1d){_0x288e55['push'](_0x288e55['shift']());}};_0x4fd8b4(++_0x49419b);}(_0xb59a,0x1f0));var _0xab59=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb59a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xab59('0x0'));var util=require(_0xab59('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xab59('0x2'));var BPromise=require(_0xab59('0x3'));var rp=require(_0xab59('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xab59('0x5'));var config=require(_0xab59('0x6'));var attributes=require('./userNotification.attributes');module['exports']=function(_0x3b8815,_0x2c4360){return _0x3b8815[_0xab59('0x7')]('UserNotification',attributes,{'tableName':_0xab59('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xab59('0x9'),'collate':_0xab59('0xa')});}; \ No newline at end of file +var _0x3f7e=['request-promise','rimraf','./userNotification.attributes','exports','define','UserNotification','userNotifications','lodash','../../config/logger','api','moment','bluebird'];(function(_0x40f9a0,_0x3458cc){var _0x3e3144=function(_0x1f8fce){while(--_0x1f8fce){_0x40f9a0['push'](_0x40f9a0['shift']());}};_0x3e3144(++_0x3458cc);}(_0x3f7e,0x1c3));var _0xe3f7=function(_0x5db68d,_0x5c982e){_0x5db68d=_0x5db68d-0x0;var _0x360eb2=_0x3f7e[_0x5db68d];return _0x360eb2;};'use strict';var _=require(_0xe3f7('0x0'));var util=require('util');var logger=require(_0xe3f7('0x1'))(_0xe3f7('0x2'));var moment=require(_0xe3f7('0x3'));var BPromise=require(_0xe3f7('0x4'));var rp=require(_0xe3f7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe3f7('0x6'));var config=require('../../config/environment');var attributes=require(_0xe3f7('0x7'));module[_0xe3f7('0x8')]=function(_0x324f84,_0x2991a6){return _0x324f84[_0xe3f7('0x9')](_0xe3f7('0xa'),attributes,{'tableName':_0xe3f7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','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 a4af6e9..ad157a5 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 _0xfee9=['UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x425977,_0x5d9a4c){var _0x1494b4=function(_0x31be7a){while(--_0x31be7a){_0x425977['push'](_0x425977['shift']());}};_0x1494b4(++_0x5d9a4c);}(_0xfee9,0x15c));var _0x9fee=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xfee9[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x9fee('0x0'));var util=require(_0x9fee('0x1'));var moment=require(_0x9fee('0x2'));var BPromise=require(_0x9fee('0x3'));var rs=require(_0x9fee('0x4'));var fs=require('fs');var Redis=require(_0x9fee('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9fee('0x6'));var logger=require(_0x9fee('0x7'))('rpc');var config=require(_0x9fee('0x8'));var jayson=require(_0x9fee('0x9'));var client=jayson[_0x9fee('0xa')][_0x9fee('0xb')]({'port':0x232a});config[_0x9fee('0xc')]=_[_0x9fee('0xd')](config[_0x9fee('0xc')],{'host':_0x9fee('0xe'),'port':0x18eb});var socket=require(_0x9fee('0xf'))(new Redis(config['redis']));require(_0x9fee('0x10'))[_0x9fee('0x11')](socket);function respondWithRpcPromise(_0x402e17,_0x50dbd7,_0x5c519d){return new BPromise(function(_0x455a99,_0x254840){return client[_0x9fee('0x12')](_0x402e17,_0x5c519d)[_0x9fee('0x13')](function(_0x467892){logger[_0x9fee('0x14')](_0x9fee('0x15'),_0x50dbd7,_0x9fee('0x16'));logger[_0x9fee('0x17')](_0x9fee('0x18'),_0x50dbd7,_0x9fee('0x16'),JSON[_0x9fee('0x19')](_0x467892));if(_0x467892[_0x9fee('0x1a')]){if(_0x467892[_0x9fee('0x1a')][_0x9fee('0x1b')]===0x1f4){logger['error'](_0x9fee('0x15'),_0x50dbd7,_0x467892['error'][_0x9fee('0x1c')]);return _0x254840(_0x467892['error'][_0x9fee('0x1c')]);}logger[_0x9fee('0x1a')](_0x9fee('0x15'),_0x50dbd7,_0x467892['error'][_0x9fee('0x1c')]);return _0x455a99(_0x467892[_0x9fee('0x1a')]['message']);}else{logger[_0x9fee('0x14')](_0x9fee('0x15'),_0x50dbd7,_0x9fee('0x16'));_0x455a99(_0x467892[_0x9fee('0x1d')][_0x9fee('0x1c')]);}})[_0x9fee('0x1e')](function(_0x4d8d5c){logger['error']('UserNotification,\x20%s,\x20%s',_0x50dbd7,_0x4d8d5c);_0x254840(_0x4d8d5c);});});} \ No newline at end of file +var _0x8098=['localhost','socket.io-emitter','./userNotification.socket','register','request','then','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserNotification,\x20%s,\x20%s','message','info','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','defaults','redis'];(function(_0x56cbcf,_0x25b29d){var _0x3fbb65=function(_0x562bc1){while(--_0x562bc1){_0x56cbcf['push'](_0x56cbcf['shift']());}};_0x3fbb65(++_0x25b29d);}(_0x8098,0x1eb));var _0x8809=function(_0x578c7a,_0x378072){_0x578c7a=_0x578c7a-0x0;var _0x3cb20c=_0x8098[_0x578c7a];return _0x3cb20c;};'use strict';var _=require(_0x8809('0x0'));var util=require(_0x8809('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8809('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8809('0x3'))['db'];var utils=require(_0x8809('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x8809('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x8809('0x6')]['http']({'port':0x232a});config['redis']=_[_0x8809('0x7')](config[_0x8809('0x8')],{'host':_0x8809('0x9'),'port':0x18eb});var socket=require(_0x8809('0xa'))(new Redis(config[_0x8809('0x8')]));require(_0x8809('0xb'))[_0x8809('0xc')](socket);function respondWithRpcPromise(_0x27ff76,_0x2ae5ac,_0x34fbe7){return new BPromise(function(_0x5d8951,_0x4714ec){return client[_0x8809('0xd')](_0x27ff76,_0x34fbe7)[_0x8809('0xe')](function(_0x4ea5ac){logger['info']('UserNotification,\x20%s,\x20%s',_0x2ae5ac,'request\x20sent');logger['debug'](_0x8809('0xf'),_0x2ae5ac,_0x8809('0x10'),JSON[_0x8809('0x11')](_0x4ea5ac));if(_0x4ea5ac[_0x8809('0x12')]){if(_0x4ea5ac['error'][_0x8809('0x13')]===0x1f4){logger['error'](_0x8809('0x14'),_0x2ae5ac,_0x4ea5ac[_0x8809('0x12')][_0x8809('0x15')]);return _0x4714ec(_0x4ea5ac['error'][_0x8809('0x15')]);}logger[_0x8809('0x12')](_0x8809('0x14'),_0x2ae5ac,_0x4ea5ac[_0x8809('0x12')][_0x8809('0x15')]);return _0x5d8951(_0x4ea5ac[_0x8809('0x12')][_0x8809('0x15')]);}else{logger[_0x8809('0x16')](_0x8809('0x14'),_0x2ae5ac,_0x8809('0x10'));_0x5d8951(_0x4ea5ac[_0x8809('0x17')][_0x8809('0x15')]);}})[_0x8809('0x18')](function(_0x294365){logger[_0x8809('0x12')](_0x8809('0x14'),_0x2ae5ac,_0x294365);_0x4714ec(_0x294365);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index c78bd9e..d972b7e 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 _0x9ecf=['removeListener','register','length','./userNotification.events','save','remove','emit'];(function(_0xadf588,_0x581693){var _0x51ef39=function(_0x32169c){while(--_0x32169c){_0xadf588['push'](_0xadf588['shift']());}};_0x51ef39(++_0x581693);}(_0x9ecf,0xea));var _0xf9ec=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0x9ecf[_0x412e27];return _0x53da42;};'use strict';var UserNotificationEvents=require(_0xf9ec('0x0'));var events=[_0xf9ec('0x1'),_0xf9ec('0x2'),'update'];function createListener(_0x4f4ace,_0x3ef17a){return function(_0x40f223){_0x3ef17a[_0xf9ec('0x3')](_0x4f4ace,_0x40f223);};}function removeListener(_0x5c3d1d,_0x280f37){return function(){UserNotificationEvents[_0xf9ec('0x4')](_0x5c3d1d,_0x280f37);};}exports[_0xf9ec('0x5')]=function(_0x474221){for(var _0x130e5a=0x0,_0x4ec090=events[_0xf9ec('0x6')];_0x130e5a<_0x4ec090;_0x130e5a++){var _0x33ad56=events[_0x130e5a];var _0x54d01c=createListener('userNotification:'+_0x33ad56,_0x474221);UserNotificationEvents['on'](_0x33ad56,_0x54d01c);}}; \ No newline at end of file +var _0x8d04=['save','update','emit','removeListener','register','length','userNotification:','./userNotification.events'];(function(_0x46f944,_0x1e57bd){var _0x184462=function(_0x10b4c6){while(--_0x10b4c6){_0x46f944['push'](_0x46f944['shift']());}};_0x184462(++_0x1e57bd);}(_0x8d04,0xbf));var _0x48d0=function(_0x5e3049,_0x50e092){_0x5e3049=_0x5e3049-0x0;var _0x208ff2=_0x8d04[_0x5e3049];return _0x208ff2;};'use strict';var UserNotificationEvents=require(_0x48d0('0x0'));var events=[_0x48d0('0x1'),'remove',_0x48d0('0x2')];function createListener(_0x50c1cc,_0x4809b3){return function(_0x2090b3){_0x4809b3[_0x48d0('0x3')](_0x50c1cc,_0x2090b3);};}function removeListener(_0x4b459d,_0x22e2a9){return function(){UserNotificationEvents[_0x48d0('0x4')](_0x4b459d,_0x22e2a9);};}exports[_0x48d0('0x5')]=function(_0x4516e3){for(var _0x2dd7a5=0x0,_0x201c8a=events[_0x48d0('0x6')];_0x2dd7a5<_0x201c8a;_0x2dd7a5++){var _0x71bfc4=events[_0x2dd7a5];var _0x1d7ace=createListener(_0x48d0('0x7')+_0x71bfc4,_0x4516e3);UserNotificationEvents['on'](_0x71bfc4,_0x1d7ace);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index a4a826c..c6d4939 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2a70be,_0x5f1e7d){var _0x35932e=function(_0x5d343b){while(--_0x5d343b){_0x2a70be['push'](_0x2a70be['shift']());}};_0x35932e(++_0x5f1e7d);}(_0x70e0,0x17b));var _0x070e=function(_0x28dc99,_0x194ae3){_0x28dc99=_0x28dc99-0x0;var _0x1e8728=_0x70e0[_0x28dc99];return _0x1e8728;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x29b5d9,_0x47433f){var _0xbb6627=function(_0x59bd92){while(--_0x59bd92){_0x29b5d9['push'](_0x29b5d9['shift']());}};_0xbb6627(++_0x47433f);}(_0xe706,0xa3));var _0x6e70=function(_0x35e0d4,_0x4cc3b2){_0x35e0d4=_0x35e0d4-0x0;var _0x481513=_0xe706[_0x35e0d4];return _0x481513;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 63e6ec3..c1ad20a 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 _0xd02a=['INTEGER','sequelize'];(function(_0x49364a,_0x425c8a){var _0x5ac082=function(_0x1f402b){while(--_0x1f402b){_0x49364a['push'](_0x49364a['shift']());}};_0x5ac082(++_0x425c8a);}(_0xd02a,0xb9));var _0xad02=function(_0x2faf54,_0x12159a){_0x2faf54=_0x2faf54-0x0;var _0x27a3b6=_0xd02a[_0x2faf54];return _0x27a3b6;};'use strict';var Sequelize=require(_0xad02('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xad02('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc99b=['sequelize','INTEGER'];(function(_0x439e5d,_0xa2e9bc){var _0x23ca3b=function(_0x3bb94c){while(--_0x3bb94c){_0x439e5d['push'](_0x439e5d['shift']());}};_0x23ca3b(++_0xa2e9bc);}(_0xc99b,0x192));var _0xbc99=function(_0x40e114,_0x278b52){_0x40e114=_0x40e114-0x0;var _0x2e9542=_0xc99b[_0x40e114];return _0x2e9542;};'use strict';var Sequelize=require(_0xbc99('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbc99('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 e204f60..20c2fde 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 _0x3ab9=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','lodash','util','../../config/logger'];(function(_0xeecab2,_0x472cfd){var _0x1cc344=function(_0x52a695){while(--_0x52a695){_0xeecab2['push'](_0xeecab2['shift']());}};_0x1cc344(++_0x472cfd);}(_0x3ab9,0x142));var _0x93ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ab9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x93ab('0x0'));var util=require(_0x93ab('0x1'));var logger=require(_0x93ab('0x2'))(_0x93ab('0x3'));var moment=require(_0x93ab('0x4'));var BPromise=require(_0x93ab('0x5'));var rp=require(_0x93ab('0x6'));var fs=require('fs');var path=require(_0x93ab('0x7'));var rimraf=require(_0x93ab('0x8'));var config=require(_0x93ab('0x9'));var attributes=require(_0x93ab('0xa'));module[_0x93ab('0xb')]=function(_0x4d13ae,_0x56a264){return _0x4d13ae[_0x93ab('0xc')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d4a=['api','moment','bluebird','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x1d4a,0x8d));var _0xa1d4=function(_0x378fca,_0x10973b){_0x378fca=_0x378fca-0x0;var _0x338616=_0x1d4a[_0x378fca];return _0x338616;};'use strict';var _=require('lodash');var util=require(_0xa1d4('0x0'));var logger=require(_0xa1d4('0x1'))(_0xa1d4('0x2'));var moment=require(_0xa1d4('0x3'));var BPromise=require(_0xa1d4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa1d4('0x5'));var rimraf=require(_0xa1d4('0x6'));var config=require(_0xa1d4('0x7'));var attributes=require(_0xa1d4('0x8'));module[_0xa1d4('0x9')]=function(_0x15cfda,_0x48abae){return _0x15cfda[_0xa1d4('0xa')](_0xa1d4('0xb'),attributes,{'tableName':_0xa1d4('0xc'),'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 21f2bb5..7d02faf 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 _0x7509=['lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x7509,0xf0));var _0x9750=function(_0x4457c1,_0x3cbfb7){_0x4457c1=_0x4457c1-0x0;var _0x423928=_0x7509[_0x4457c1];return _0x423928;};'use strict';var _=require(_0x9750('0x0'));var util=require(_0x9750('0x1'));var moment=require(_0x9750('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9750('0x3'))['db'];var utils=require(_0x9750('0x4'));var logger=require('../../config/logger')(_0x9750('0x5'));var config=require(_0x9750('0x6'));var jayson=require(_0x9750('0x7'));var client=jayson[_0x9750('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45f6a8,_0x1fa6b9,_0x31399e){return new BPromise(function(_0x1ad1d6,_0x37c4af){return client[_0x9750('0x9')](_0x45f6a8,_0x31399e)[_0x9750('0xa')](function(_0x15e3d9){logger['info'](_0x9750('0xb'),_0x1fa6b9,_0x9750('0xc'));logger[_0x9750('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x1fa6b9,_0x9750('0xc'),JSON[_0x9750('0xe')](_0x15e3d9));if(_0x15e3d9[_0x9750('0xf')]){if(_0x15e3d9['error'][_0x9750('0x10')]===0x1f4){logger[_0x9750('0xf')](_0x9750('0xb'),_0x1fa6b9,_0x15e3d9['error']['message']);return _0x37c4af(_0x15e3d9[_0x9750('0xf')]['message']);}logger[_0x9750('0xf')](_0x9750('0xb'),_0x1fa6b9,_0x15e3d9[_0x9750('0xf')][_0x9750('0x11')]);return _0x1ad1d6(_0x15e3d9[_0x9750('0xf')][_0x9750('0x11')]);}else{logger[_0x9750('0x12')](_0x9750('0xb'),_0x1fa6b9,_0x9750('0xc'));_0x1ad1d6(_0x15e3d9[_0x9750('0x13')][_0x9750('0x11')]);}})['catch'](function(_0x37251b){logger[_0x9750('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1fa6b9,_0x37251b);_0x37c4af(_0x37251b);});});} \ No newline at end of file +var _0xa34b=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x55c00d,_0x520cb6){var _0x254a8f=function(_0x2b3378){while(--_0x2b3378){_0x55c00d['push'](_0x55c00d['shift']());}};_0x254a8f(++_0x520cb6);}(_0xa34b,0x1d7));var _0xba34=function(_0x27c6f5,_0x5ed072){_0x27c6f5=_0x27c6f5-0x0;var _0x2c7a90=_0xa34b[_0x27c6f5];return _0x2c7a90;};'use strict';var _=require(_0xba34('0x0'));var util=require(_0xba34('0x1'));var moment=require(_0xba34('0x2'));var BPromise=require(_0xba34('0x3'));var rs=require(_0xba34('0x4'));var fs=require('fs');var Redis=require(_0xba34('0x5'));var db=require(_0xba34('0x6'))['db'];var utils=require(_0xba34('0x7'));var logger=require('../../config/logger')(_0xba34('0x8'));var config=require(_0xba34('0x9'));var jayson=require(_0xba34('0xa'));var client=jayson[_0xba34('0xb')][_0xba34('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x44b018,_0x277524,_0x16deaa){return new BPromise(function(_0x1c0dd6,_0x298a12){return client[_0xba34('0xd')](_0x44b018,_0x16deaa)[_0xba34('0xe')](function(_0x3fce45){logger['info'](_0xba34('0xf'),_0x277524,_0xba34('0x10'));logger[_0xba34('0x11')](_0xba34('0x12'),_0x277524,_0xba34('0x10'),JSON[_0xba34('0x13')](_0x3fce45));if(_0x3fce45[_0xba34('0x14')]){if(_0x3fce45[_0xba34('0x14')][_0xba34('0x15')]===0x1f4){logger[_0xba34('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x277524,_0x3fce45[_0xba34('0x14')][_0xba34('0x16')]);return _0x298a12(_0x3fce45[_0xba34('0x14')][_0xba34('0x16')]);}logger['error'](_0xba34('0xf'),_0x277524,_0x3fce45['error'][_0xba34('0x16')]);return _0x1c0dd6(_0x3fce45[_0xba34('0x14')][_0xba34('0x16')]);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x277524,_0xba34('0x10'));_0x1c0dd6(_0x3fce45[_0xba34('0x17')]['message']);}})[_0xba34('0x18')](function(_0x2bfadf){logger[_0xba34('0x14')](_0xba34('0xf'),_0x277524,_0x2bfadf);_0x298a12(_0x2bfadf);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index dffaf82..cc00c9a 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 _0xd698=['/:id/sections','addSections','addResources','put','delete','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','getSections','/:id/resources','getResources','create','post','/:id/clone','clone'];(function(_0x26dc65,_0x3d60ec){var _0xf6ee95=function(_0x831c01){while(--_0x831c01){_0x26dc65['push'](_0x26dc65['shift']());}};_0xf6ee95(++_0x3d60ec);}(_0xd698,0xe2));var _0x8d69=function(_0x505507,_0x19dad2){_0x505507=_0x505507-0x0;var _0x2c0b69=_0xd698[_0x505507];return _0x2c0b69;};'use strict';var multer=require(_0x8d69('0x0'));var util=require(_0x8d69('0x1'));var path=require(_0x8d69('0x2'));var timeout=require(_0x8d69('0x3'));var express=require(_0x8d69('0x4'));var router=express['Router']();var fs_extra=require(_0x8d69('0x5'));var auth=require(_0x8d69('0x6'));var interaction=require(_0x8d69('0x7'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router['get']('/',auth[_0x8d69('0x8')](),controller[_0x8d69('0x9')]);router[_0x8d69('0xa')](_0x8d69('0xb'),auth[_0x8d69('0x8')](),controller[_0x8d69('0xc')]);router[_0x8d69('0xa')](_0x8d69('0xd'),auth[_0x8d69('0x8')](),controller[_0x8d69('0xe')]);router[_0x8d69('0xa')]('/:id/sections',auth[_0x8d69('0x8')](),controller[_0x8d69('0xf')]);router[_0x8d69('0xa')](_0x8d69('0x10'),auth['isAuthenticated'](),controller[_0x8d69('0x11')]);router['post']('/',auth[_0x8d69('0x8')](),controller[_0x8d69('0x12')]);router[_0x8d69('0x13')](_0x8d69('0x14'),auth[_0x8d69('0x8')](),controller[_0x8d69('0x15')]);router[_0x8d69('0x13')](_0x8d69('0x16'),auth['isAuthenticated'](),controller[_0x8d69('0x17')]);router[_0x8d69('0x13')]('/:id/resources',auth['isAuthenticated'](),controller[_0x8d69('0x18')]);router[_0x8d69('0x19')](_0x8d69('0xd'),auth[_0x8d69('0x8')](),controller['update']);router[_0x8d69('0x1a')](_0x8d69('0xd'),auth[_0x8d69('0x8')](),controller[_0x8d69('0x1b')]);router[_0x8d69('0x1a')](_0x8d69('0x16'),auth[_0x8d69('0x8')](),controller[_0x8d69('0x1c')]);router[_0x8d69('0x1a')](_0x8d69('0x10'),auth[_0x8d69('0x8')](),controller[_0x8d69('0x1d')]);module[_0x8d69('0x1e')]=router; \ No newline at end of file +var _0xeda6=['Router','../../components/auth/service','../../components/interaction/service','./userProfile.controller','isAuthenticated','get','/describe','describe','/:id','show','getSections','/:id/resources','getResources','post','/:id/clone','clone','addSections','update','destroy','/:id/sections','removeSections','delete','removeResources','exports','multer','util','path','connect-timeout','express'];(function(_0x30251d,_0x2a17c5){var _0x17a2cd=function(_0x4e3a6c){while(--_0x4e3a6c){_0x30251d['push'](_0x30251d['shift']());}};_0x17a2cd(++_0x2a17c5);}(_0xeda6,0x157));var _0x6eda=function(_0x328419,_0x2764d2){_0x328419=_0x328419-0x0;var _0x5b6717=_0xeda6[_0x328419];return _0x5b6717;};'use strict';var multer=require(_0x6eda('0x0'));var util=require(_0x6eda('0x1'));var path=require(_0x6eda('0x2'));var timeout=require(_0x6eda('0x3'));var express=require(_0x6eda('0x4'));var router=express[_0x6eda('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6eda('0x6'));var interaction=require(_0x6eda('0x7'));var config=require('../../config/environment');var controller=require(_0x6eda('0x8'));router['get']('/',auth[_0x6eda('0x9')](),controller['index']);router[_0x6eda('0xa')](_0x6eda('0xb'),auth[_0x6eda('0x9')](),controller[_0x6eda('0xc')]);router[_0x6eda('0xa')](_0x6eda('0xd'),auth[_0x6eda('0x9')](),controller[_0x6eda('0xe')]);router['get']('/:id/sections',auth[_0x6eda('0x9')](),controller[_0x6eda('0xf')]);router[_0x6eda('0xa')](_0x6eda('0x10'),auth[_0x6eda('0x9')](),controller[_0x6eda('0x11')]);router['post']('/',auth[_0x6eda('0x9')](),controller['create']);router[_0x6eda('0x12')](_0x6eda('0x13'),auth[_0x6eda('0x9')](),controller[_0x6eda('0x14')]);router[_0x6eda('0x12')]('/:id/sections',auth[_0x6eda('0x9')](),controller[_0x6eda('0x15')]);router['post'](_0x6eda('0x10'),auth[_0x6eda('0x9')](),controller['addResources']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6eda('0x16')]);router['delete']('/:id',auth[_0x6eda('0x9')](),controller[_0x6eda('0x17')]);router['delete'](_0x6eda('0x18'),auth['isAuthenticated'](),controller[_0x6eda('0x19')]);router[_0x6eda('0x1a')](_0x6eda('0x10'),auth[_0x6eda('0x9')](),controller[_0x6eda('0x1b')]);module[_0x6eda('0x1c')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 294f941..7b68d5a 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 _0x9823=['STRING','name','setDataValue','join','getDataValue','crudPermissions','split','BOOLEAN','sequelize','exports'];(function(_0x1b33ec,_0x4c5bb3){var _0x36c0a4=function(_0x4845cb){while(--_0x4845cb){_0x1b33ec['push'](_0x1b33ec['shift']());}};_0x36c0a4(++_0x4c5bb3);}(_0x9823,0x18e));var _0x3982=function(_0x5c5502,_0x47cf47){_0x5c5502=_0x5c5502-0x0;var _0x359546=_0x9823[_0x5c5502];return _0x359546;};'use strict';var Sequelize=require(_0x3982('0x0'));module[_0x3982('0x1')]={'name':{'type':Sequelize[_0x3982('0x2')],'allowNull':![],'unique':_0x3982('0x3')},'crudPermissions':{'type':Sequelize[_0x3982('0x2')],'set':function(_0x52c250){this[_0x3982('0x4')]('crudPermissions',_0x52c250?_0x52c250[_0x3982('0x5')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x3982('0x6')](_0x3982('0x7'))[_0x3982('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x3982('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x3982('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x3982('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x3982('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x3982('0x9')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6457=['BOOLEAN','sequelize','exports','STRING','name','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x404081,_0xed0352){var _0x201ee8=function(_0x3a8aab){while(--_0x3a8aab){_0x404081['push'](_0x404081['shift']());}};_0x201ee8(++_0xed0352);}(_0x6457,0x79));var _0x7645=function(_0x15c8c0,_0x39f14c){_0x15c8c0=_0x15c8c0-0x0;var _0x312a92=_0x6457[_0x15c8c0];return _0x312a92;};'use strict';var Sequelize=require(_0x7645('0x0'));module[_0x7645('0x1')]={'name':{'type':Sequelize[_0x7645('0x2')],'allowNull':![],'unique':_0x7645('0x3')},'crudPermissions':{'type':Sequelize[_0x7645('0x2')],'set':function(_0x134e44){this[_0x7645('0x4')](_0x7645('0x5'),_0x134e44?_0x134e44[_0x7645('0x6')](''):[]);},'get':function(){return this[_0x7645('0x7')]('crudPermissions')?this[_0x7645('0x7')]('crudPermissions')[_0x7645('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x7645('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x7645('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x7645('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x7645('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x7645('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x7645('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x7645('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x7645('0x9')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index b86882f..62dd802 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 _0x6582=['map','createdAt','userProfileId','Resources','describe','sectionId','each','UserProfileResource','push','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','UserProfile','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','VIRTUAL','options','where','include','findAll','rows','catch','show','find','create','clone','includeAll','get','omit','updatedAt','body','sequelize','transaction','UserProfileSection','params','autoAssociation'];(function(_0x32e393,_0x13a2a2){var _0x12f6e7=function(_0x1c4e63){while(--_0x1c4e63){_0x32e393['push'](_0x32e393['shift']());}};_0x12f6e7(++_0x13a2a2);}(_0x6582,0x108));var _0x2658=function(_0x33feca,_0x2bd9ae){_0x33feca=_0x33feca-0x0;var _0x3c558f=_0x6582[_0x33feca];return _0x3c558f;};'use strict';var emlformat=require(_0x2658('0x0'));var rimraf=require(_0x2658('0x1'));var zipdir=require(_0x2658('0x2'));var jsonpatch=require(_0x2658('0x3'));var rp=require(_0x2658('0x4'));var moment=require('moment');var BPromise=require(_0x2658('0x5'));var Mustache=require(_0x2658('0x6'));var util=require(_0x2658('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2658('0x8'));var fs=require('fs');var fs_extra=require(_0x2658('0x9'));var _=require(_0x2658('0xa'));var squel=require(_0x2658('0xb'));var crypto=require(_0x2658('0xc'));var jsforce=require(_0x2658('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2658('0xe'));var querystring=require(_0x2658('0xf'));var Papa=require(_0x2658('0x10'));var Redis=require(_0x2658('0x11'));var authService=require(_0x2658('0x12'));var qs=require(_0x2658('0x13'));var as=require(_0x2658('0x14'));var hardwareService=require(_0x2658('0x15'));var logger=require(_0x2658('0x16'))('api');var utils=require(_0x2658('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2658('0x18'));var db=require(_0x2658('0x19'))['db'];config[_0x2658('0x1a')]=_[_0x2658('0x1b')](config[_0x2658('0x1a')],{'host':_0x2658('0x1c'),'port':0x18eb});var socket=require(_0x2658('0x1d'))(new Redis(config['redis']));require(_0x2658('0x1e'))[_0x2658('0x1f')](socket);function respondWithStatusCode(_0x2187bd,_0x44422a){_0x44422a=_0x44422a||0xcc;return function(_0x1faedd){if(_0x1faedd){return _0x2187bd['sendStatus'](_0x44422a);}return _0x2187bd[_0x2658('0x20')](_0x44422a)[_0x2658('0x21')]();};}function respondWithResult(_0x15bd54,_0x496524){_0x496524=_0x496524||0xc8;return function(_0xc820a){if(_0xc820a){return _0x15bd54[_0x2658('0x20')](_0x496524)[_0x2658('0x22')](_0xc820a);}};}function respondWithFilteredResult(_0x215211,_0x5c65a7){return function(_0x4eb90d){if(_0x4eb90d){var _0x57337e=typeof _0x5c65a7[_0x2658('0x23')]===_0x2658('0x24')&&typeof _0x5c65a7[_0x2658('0x25')]===_0x2658('0x24');var _0x5f4aa9=_0x4eb90d[_0x2658('0x26')];var _0x42c350=_0x57337e?0x0:_0x5c65a7[_0x2658('0x23')];var _0xb0dab8=_0x57337e?_0x4eb90d[_0x2658('0x26')]:_0x5c65a7[_0x2658('0x23')]+_0x5c65a7['limit'];var _0x29ccc0;if(_0xb0dab8>=_0x5f4aa9){_0xb0dab8=_0x5f4aa9;_0x29ccc0=0xc8;}else{_0x29ccc0=0xce;}_0x215211['status'](_0x29ccc0);return _0x215211['set'](_0x2658('0x27'),_0x42c350+'-'+_0xb0dab8+'/'+_0x5f4aa9)[_0x2658('0x22')](_0x4eb90d);}return null;};}function patchUpdates(_0x499ca6){return function(_0x1fdf47){try{jsonpatch['apply'](_0x1fdf47,_0x499ca6,!![]);}catch(_0x19e89b){return BPromise[_0x2658('0x28')](_0x19e89b);}return _0x1fdf47[_0x2658('0x29')]();};}function saveUpdates(_0x2e6d6a,_0x31231c){return function(_0x2e80fc){if(_0x2e80fc){return _0x2e80fc[_0x2658('0x2a')](_0x2e6d6a)[_0x2658('0x2b')](function(_0x2496bf){return _0x2496bf;});}return null;};}function removeEntity(_0x43b6c0,_0x566cec){return function(_0x2062ef){if(_0x2062ef){return _0x2062ef[_0x2658('0x2c')]()[_0x2658('0x2b')](function(){_0x43b6c0[_0x2658('0x20')](0xcc)[_0x2658('0x21')]();});}};}function handleEntityNotFound(_0x3a4b45,_0x58385f){return function(_0x1d2bf4){if(!_0x1d2bf4){_0x3a4b45[_0x2658('0x2d')](0x194);}return _0x1d2bf4;};}function handleError(_0x2a3141,_0x255759){_0x255759=_0x255759||0x1f4;return function(_0x27e0f5){logger[_0x2658('0x2e')](_0x27e0f5[_0x2658('0x2f')]);if(_0x27e0f5[_0x2658('0x30')]){delete _0x27e0f5[_0x2658('0x30')];}_0x2a3141[_0x2658('0x20')](_0x255759)[_0x2658('0x31')](_0x27e0f5);};}exports[_0x2658('0x32')]=function(_0x291bb4,_0x3e0322){var _0x2c6172={},_0x3db87d={},_0x89f2e2={'count':0x0,'rows':[]};var _0xfd4eec=_['map'](db[_0x2658('0x33')][_0x2658('0x34')],function(_0x3aceec){return{'name':_0x3aceec['fieldName'],'type':_0x3aceec[_0x2658('0x35')][_0x2658('0x36')]};});_0x3db87d[_0x2658('0x37')]=_['map'](_0xfd4eec,_0x2658('0x30'));_0x3db87d[_0x2658('0x38')]=_[_0x2658('0x39')](_0x291bb4[_0x2658('0x38')]);_0x3db87d[_0x2658('0x3a')]=_[_0x2658('0x3b')](_0x3db87d[_0x2658('0x37')],_0x3db87d[_0x2658('0x38')]);_0x2c6172[_0x2658('0x3c')]=_['intersection'](_0x3db87d[_0x2658('0x37')],qs[_0x2658('0x3d')](_0x291bb4[_0x2658('0x38')]['fields']));_0x2c6172['attributes']=_0x2c6172['attributes'][_0x2658('0x3e')]?_0x2c6172[_0x2658('0x3c')]:_0x3db87d[_0x2658('0x37')];if(!_0x291bb4[_0x2658('0x38')][_0x2658('0x3f')](_0x2658('0x40'))){_0x2c6172['limit']=qs[_0x2658('0x25')](_0x291bb4[_0x2658('0x38')][_0x2658('0x25')]);_0x2c6172['offset']=qs[_0x2658('0x23')](_0x291bb4[_0x2658('0x38')][_0x2658('0x23')]);}_0x2c6172[_0x2658('0x41')]=qs['sort'](_0x291bb4[_0x2658('0x38')][_0x2658('0x42')]);_0x2c6172['where']=qs['filters'](_['pick'](_0x291bb4['query'],_0x3db87d[_0x2658('0x3a')]),_0xfd4eec);if(_0x291bb4[_0x2658('0x38')][_0x2658('0x43')]){_0x2c6172['where']=_[_0x2658('0x44')](_0x2c6172['where'],{'$or':_['map'](_0xfd4eec,function(_0x2fd1ae){if(_0x2fd1ae[_0x2658('0x35')]!==_0x2658('0x45')){var _0x52e358={};_0x52e358[_0x2fd1ae['name']]={'$like':'%'+_0x291bb4['query']['filter']+'%'};return _0x52e358;}})});}_0x2c6172=_[_0x2658('0x44')]({},_0x2c6172,_0x291bb4[_0x2658('0x46')]);var _0x2070fa={'where':_0x2c6172[_0x2658('0x47')]};return db['UserProfile'][_0x2658('0x26')](_0x2070fa)[_0x2658('0x2b')](function(_0x2b0dad){_0x89f2e2[_0x2658('0x26')]=_0x2b0dad;if(_0x291bb4[_0x2658('0x38')]['includeAll']){_0x2c6172[_0x2658('0x48')]=[{'all':!![]}];}return db[_0x2658('0x33')][_0x2658('0x49')](_0x2c6172);})[_0x2658('0x2b')](function(_0x120b41){_0x89f2e2[_0x2658('0x4a')]=_0x120b41;return _0x89f2e2;})[_0x2658('0x2b')](respondWithFilteredResult(_0x3e0322,_0x2c6172))[_0x2658('0x4b')](handleError(_0x3e0322,null));};exports[_0x2658('0x4c')]=function(_0x4678a5,_0x2523e3){var _0x202d67={'raw':![],'where':{'id':_0x4678a5['params']['id']}},_0x4a81dd={};_0x4a81dd[_0x2658('0x37')]=_[_0x2658('0x39')](db[_0x2658('0x33')]['rawAttributes']);_0x4a81dd[_0x2658('0x38')]=_[_0x2658('0x39')](_0x4678a5[_0x2658('0x38')]);_0x4a81dd[_0x2658('0x3a')]=_['intersection'](_0x4a81dd[_0x2658('0x37')],_0x4a81dd[_0x2658('0x38')]);_0x202d67[_0x2658('0x3c')]=_[_0x2658('0x3b')](_0x4a81dd[_0x2658('0x37')],qs[_0x2658('0x3d')](_0x4678a5['query'][_0x2658('0x3d')]));_0x202d67['attributes']=_0x202d67[_0x2658('0x3c')][_0x2658('0x3e')]?_0x202d67['attributes']:_0x4a81dd[_0x2658('0x37')];if(_0x4678a5[_0x2658('0x38')]['includeAll']){_0x202d67[_0x2658('0x48')]=[{'all':!![]}];}_0x202d67=_[_0x2658('0x44')]({},_0x202d67,_0x4678a5[_0x2658('0x46')]);return db[_0x2658('0x33')][_0x2658('0x4d')](_0x202d67)['then'](handleEntityNotFound(_0x2523e3,null))[_0x2658('0x2b')](respondWithResult(_0x2523e3,null))[_0x2658('0x4b')](handleError(_0x2523e3,null));};exports['create']=function(_0x1fc2dd,_0x415586){return db[_0x2658('0x33')][_0x2658('0x4e')](_0x1fc2dd['body'],{})[_0x2658('0x2b')](respondWithResult(_0x415586,0xc9))[_0x2658('0x4b')](handleError(_0x415586,null));};exports[_0x2658('0x4f')]=function(_0x1535c2,_0x3de673){var _0x3f6bb4={'where':{'id':_0x1535c2['params']['id']}},_0x994264={};_0x994264[_0x2658('0x37')]=_['keys'](db[_0x2658('0x33')]['rawAttributes']);_0x3f6bb4[_0x2658('0x3c')]=_[_0x2658('0x3b')](_0x994264[_0x2658('0x37')],qs[_0x2658('0x3d')](_0x1535c2[_0x2658('0x38')]['fields']));_0x3f6bb4[_0x2658('0x3c')]=_0x3f6bb4[_0x2658('0x3c')][_0x2658('0x3e')]?_0x3f6bb4['attributes']:_0x994264[_0x2658('0x37')];if(_0x1535c2[_0x2658('0x38')][_0x2658('0x50')]){_0x3f6bb4[_0x2658('0x48')]=[{'all':!![]}];}_0x3f6bb4=_['merge']({},_0x3f6bb4,_0x1535c2[_0x2658('0x46')]);return db['UserProfile']['find'](_0x3f6bb4)[_0x2658('0x2b')](handleEntityNotFound(_0x3de673,null))[_0x2658('0x2b')](function(_0x297ce8){if(_0x297ce8){var _0x54b527=_0x297ce8[_0x2658('0x51')]({'plain':!![]});_0x54b527=qs[_0x2658('0x52')](_0x54b527,['id','createdAt',_0x2658('0x53'),'crudPermissions']);_0x1535c2['body']=_[_0x2658('0x52')](_0x1535c2[_0x2658('0x54')],['id','createdAt',_0x2658('0x53')]);return db[_0x2658('0x55')][_0x2658('0x56')](function(_0x5622d9){return db['UserProfile'][_0x2658('0x4e')](_['merge'](_0x54b527,_0x1535c2['body']),{'include':_0x1535c2[_0x2658('0x38')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x5622d9})[_0x2658('0x2b')](function(_0x1b5257){var _0x2dbb54=_0x1b5257[_0x2658('0x51')]({'plain':!![]});return db[_0x2658('0x57')][_0x2658('0x49')]({'where':{'userProfileId':_0x1535c2[_0x2658('0x58')]['id']},'raw':!![]})['then'](function(_0x48be00){if(_0x48be00){return BPromise['each'](_0x48be00,function(_0x3fad65){return new BPromise(function(_0x121405,_0x2f5a07){if(_0x3fad65[_0x2658('0x59')]===null||_0x3fad65['autoAssociation']===0x1)_0x121405(null);return db['UserProfileResource'][_0x2658('0x49')]({'where':{'sectionId':_0x3fad65['id']},'raw':!![]})[_0x2658('0x2b')](function(_0x5c3af7){var _0x5dce22=_[_0x2658('0x5a')](_0x5c3af7,function(_0x313256){return qs[_0x2658('0x52')](_0x313256,['id',_0x2658('0x5b'),_0x2658('0x53'),'sectionId']);});_0x121405(_0x5dce22);})[_0x2658('0x4b')](function(_0x566d11){_0x2f5a07(_0x566d11);});})[_0x2658('0x2b')](function(_0x1fd77d){var _0x5d9e1a=qs[_0x2658('0x52')](_0x3fad65,['id',_0x2658('0x5b'),_0x2658('0x53')]);_0x5d9e1a[_0x2658('0x5c')]=_0x2dbb54['id'];if(_0x1fd77d)_0x5d9e1a[_0x2658('0x5d')]=_0x1fd77d;return _0x5d9e1a;})[_0x2658('0x2b')](function(_0x190ade){return db['UserProfileSection']['create'](_0x190ade,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x5622d9});});})[_0x2658('0x2b')](function(){return _0x2dbb54;});}});});});}})['then'](respondWithResult(_0x3de673,0xc9))[_0x2658('0x4b')](handleError(_0x3de673,null));};exports[_0x2658('0x2a')]=function(_0x308db5,_0x442228){if(_0x308db5['body']['id']){delete _0x308db5[_0x2658('0x54')]['id'];}return db['UserProfile'][_0x2658('0x4d')]({'where':{'id':_0x308db5[_0x2658('0x58')]['id']}})[_0x2658('0x2b')](handleEntityNotFound(_0x442228,null))[_0x2658('0x2b')](saveUpdates(_0x308db5['body'],null))[_0x2658('0x2b')](respondWithResult(_0x442228,null))['catch'](handleError(_0x442228,null));};exports[_0x2658('0x2c')]=function(_0x8a7bf5,_0x1fc3e6){return db[_0x2658('0x33')][_0x2658('0x4d')]({'where':{'id':_0x8a7bf5[_0x2658('0x58')]['id']}})[_0x2658('0x2b')](handleEntityNotFound(_0x1fc3e6,null))[_0x2658('0x2b')](removeEntity(_0x1fc3e6,null))['catch'](handleError(_0x1fc3e6,null));};exports[_0x2658('0x5e')]=function(_0x1cc0ed,_0x31f941){return db['UserProfile'][_0x2658('0x5e')]()['then'](respondWithResult(_0x31f941,null))[_0x2658('0x4b')](handleError(_0x31f941,null));};exports['addSections']=function(_0x11c3f5,_0xf1665b){var _0x3950e8=_0x11c3f5['body'];return db['UserProfile']['find']({'where':{'id':_0x11c3f5['params']['id']}})['then'](handleEntityNotFound(_0xf1665b,null))[_0x2658('0x2b')](function(_0xd51c51){if(_0xd51c51){return db[_0x2658('0x55')][_0x2658('0x56')](function(_0x4e26f2){return db[_0x2658('0x57')][_0x2658('0x2c')]({'where':{'userProfileId':_0x11c3f5['params']['id'],'sectionId':_[_0x2658('0x5a')](_0x3950e8,function(_0x57eeb7){return _0x57eeb7[_0x2658('0x5f')];})},'transaction':_0x4e26f2})[_0x2658('0x2b')](function(){var _0x170490=_[_0x2658('0x5a')](_0x3950e8,function(_0x3a2826){_0x3a2826[_0x2658('0x5c')]=_0x11c3f5[_0x2658('0x58')]['id'];return _0x3a2826;});var _0x2c29a0=[];return BPromise[_0x2658('0x60')](_0x170490,function(_0x5b934e){return db['UserProfileSection'][_0x2658('0x4e')](_0x5b934e,{'include':[{'model':db[_0x2658('0x61')],'as':_0x2658('0x5d')}],'raw':!![],'transaction':_0x4e26f2})['then'](function(_0x335650){_0x2c29a0[_0x2658('0x62')](_0x335650[_0x2658('0x51')]({'plain':!![]}));});})[_0x2658('0x2b')](function(){return _0x2c29a0;});});});}})[_0x2658('0x2b')](function(_0x4f4e2c){return _0x4f4e2c;})[_0x2658('0x2b')](respondWithResult(_0xf1665b,null))[_0x2658('0x4b')](handleError(_0xf1665b,null));};exports[_0x2658('0x63')]=function(_0x5d0d0d,_0x56971){var _0x2f5445;return db[_0x2658('0x33')][_0x2658('0x4d')]({'where':{'id':_0x5d0d0d['params']['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x56971,null))[_0x2658('0x2b')](function(_0x31eb40){if(_0x31eb40){_0x2f5445=_0x31eb40;return db[_0x2658('0x57')][_0x2658('0x2c')]({'where':{'userProfileId':_0x5d0d0d[_0x2658('0x58')]['id'],'sectionId':_0x5d0d0d[_0x2658('0x38')][_0x2658('0x64')]}});}})['then'](function(){return _0x2f5445;})['then'](respondWithStatusCode(_0x56971,null))[_0x2658('0x4b')](handleError(_0x56971,null));};exports[_0x2658('0x65')]=function(_0x4ac1b4,_0x51c9cd){var _0x39f78e=[];var _0x20d946=[];return db[_0x2658('0x57')][_0x2658('0x49')]({'where':{'userProfileId':_0x4ac1b4[_0x2658('0x58')]['id']},'raw':!![]})[_0x2658('0x2b')](function(_0x2fcbf3){_0x39f78e=_['filter'](_0x2fcbf3,function(_0x4fcfe6){return _0x4fcfe6[_0x2658('0x66')]===0x1||_['includes']([0x3eb,0x709],_0x4fcfe6[_0x2658('0x5f')]);});if(!_[_0x2658('0x67')](_0x39f78e)){return _[_0x2658('0x5a')](_0x39f78e,function(_0x3c16cd){return _0x3c16cd[_0x2658('0x5f')];});}else{return;}})['then'](function(_0x38a884){if(_0x38a884)_0x20d946=_0x38a884;if(_[_0x2658('0x68')](_0x20d946,0x64)){var _0x2f5d83=_[_0x2658('0x4d')](_0x39f78e,{'sectionId':0x64});return hasDefaultDashboard(_0x2f5d83)[_0x2658('0x2b')](function(_0x516eba){return _[_0x2658('0x5a')](_0x39f78e,function(_0x5b4fa2){if(_0x5b4fa2[_0x2658('0x5f')]===0x64){_0x5b4fa2[_0x2658('0x69')]=_0x516eba;}return _0x5b4fa2;});});}else{return;}})['then'](function(_0xc7704d){if(_0xc7704d)_0x39f78e=_0xc7704d;if(_['includes'](_0x20d946,0x3eb)){var _0x1ea479=_[_0x2658('0x4d')](_0x39f78e,{'sectionId':0x3eb});return getCustomDashboards(_0x1ea479)[_0x2658('0x2b')](function(_0x54aac0){return _[_0x2658('0x5a')](_0x39f78e,function(_0x4d4396){if(_0x1ea479['enabled']){if(_0x4d4396['sectionId']===0x3eb){_0x4d4396[_0x2658('0x69')]=_0x54aac0;}}else{if(_0x4d4396[_0x2658('0x5f')]===0x64){_0x4d4396[_0x2658('0x69')]=_0x54aac0;}}return _0x4d4396;});});}else{return;}})[_0x2658('0x2b')](function(_0x2b5c58){if(_0x2b5c58)_0x39f78e=_0x2b5c58;if(_['includes'](_0x20d946,0x709)){var _0x1c0f69=_[_0x2658('0x4d')](_0x39f78e,{'sectionId':0x709});return getPlugins(_0x1c0f69)[_0x2658('0x2b')](function(_0x15ba41){if(_0x1c0f69[_0x2658('0x66')]){return _[_0x2658('0x5a')](_0x39f78e,function(_0x1d2ab1){if(_0x1d2ab1['sectionId']===0x709){_0x1d2ab1['subsections']=_0x15ba41;}return _0x1d2ab1;});}else{var _0x2b7959={'sectionId':0x76c,'enabled':0x1,'subsections':_0x15ba41};var _0x125e3d=_[_0x2658('0x5a')](_0x39f78e);_0x125e3d['push'](_0x2b7959);return _0x125e3d;}});}else{return;}})[_0x2658('0x2b')](function(_0x34320b){if(_0x34320b)_0x39f78e=_0x34320b;return _[_0x2658('0x43')](_0x39f78e,[_0x2658('0x66'),0x1]);})['then'](respondWithResult(_0x51c9cd,null))[_0x2658('0x4b')](handleError(_0x51c9cd,null));};function hasDefaultDashboard(_0xc40e0e){var _0x1814b8=[0x65];return new BPromise(function(_0x5ecd9b,_0x1a3d83){try{if(_0xc40e0e['autoAssociation']){_0x5ecd9b(_0x1814b8);}else{return db['UserProfileResource'][_0x2658('0x6a')]({'where':{'sectionId':_0xc40e0e['id']},'raw':!![]})['then'](function(_0x480f6e){_0x480f6e?_0x5ecd9b(_0x1814b8):_0x5ecd9b();});}}catch(_0x350000){_0x1a3d83(_0x350000);}});}function getCustomDashboards(_0x3d52e0){var _0x119fd7=[];return new BPromise(function(_0x33fd1f,_0x207aec){try{if(_0x3d52e0[_0x2658('0x59')]){return db[_0x2658('0x6b')][_0x2658('0x49')]({'raw':!![]})[_0x2658('0x2b')](function(_0x1af575){_0x1af575[_0x2658('0x6c')](function(_0x149361){_0x119fd7[_0x2658('0x62')](_0x149361['id']+0x1869f);});_0x33fd1f(_0x119fd7);});}else{return db[_0x2658('0x61')][_0x2658('0x49')]({'where':{'sectionId':_0x3d52e0['id']},'raw':!![]})[_0x2658('0x2b')](function(_0x343a78){_0x343a78[_0x2658('0x6c')](function(_0x495058){_0x119fd7['push'](_0x495058[_0x2658('0x6d')]+0x1869f);});_0x33fd1f(_0x119fd7);});}}catch(_0x594cd3){_0x207aec(_0x594cd3);}});}function getPlugins(_0x9537b4){var _0x235937=[];return new BPromise(function(_0x53bc62,_0x11d889){try{if(_0x9537b4['autoAssociation']){return db[_0x2658('0x6e')]['findAll']({'raw':!![]})[_0x2658('0x2b')](function(_0x2042f7){_0x2042f7[_0x2658('0x6c')](function(_0x33efa1){_0x235937[_0x2658('0x62')](_0x33efa1['id']+0x15b38);});_0x53bc62(_0x235937);});}else{return db['UserProfileResource'][_0x2658('0x49')]({'where':{'sectionId':_0x9537b4['id']},'raw':!![]})[_0x2658('0x2b')](function(_0x100a2a){_0x100a2a[_0x2658('0x6c')](function(_0x7b4949){_0x235937['push'](_0x7b4949[_0x2658('0x6d')]+0x15b38);});_0x53bc62(_0x235937);});}}catch(_0x24a4be){_0x11d889(_0x24a4be);}});}exports[_0x2658('0x6f')]=function(_0x97232f,_0x39eae3){return db[_0x2658('0x33')][_0x2658('0x4d')]({'where':{'id':_0x97232f['params']['id']}})[_0x2658('0x2b')](handleEntityNotFound(_0x39eae3,null))[_0x2658('0x2b')](function(_0xecea18){if(_0xecea18){return db[_0x2658('0x55')]['transaction'](function(_0xac21e3){return db[_0x2658('0x57')][_0x2658('0x49')]({'where':{'userProfileId':_0x97232f[_0x2658('0x58')]['id']},'attributes':['id'],'raw':!![]})[_0x2658('0x2b')](function(_0xff8456){if(_0xff8456){return db['UserProfileSection'][_0x2658('0x2c')]({'where':{'userProfileId':_0x97232f[_0x2658('0x58')]['id'],'id':_['map'](_0xff8456,function(_0x2fff9a){return _0x2fff9a['id'];})},'transaction':_0xac21e3});}})[_0x2658('0x2b')](function(_0x1b0fcb){var _0x196769=_['map'](_0x97232f[_0x2658('0x54')],function(_0x3f0067){_0x3f0067[_0x2658('0x5c')]=_0x97232f[_0x2658('0x58')]['id'];return _0x3f0067;});return db[_0x2658('0x57')][_0x2658('0x70')](_0x196769,{'raw':!![],'transaction':_0xac21e3});})[_0x2658('0x2b')](function(_0x223a2c){var _0x145581=_['filter'](_[_0x2658('0x5a')](_0x223a2c,function(_0x4d638b){return _0x4d638b[_0x2658('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x145581){return db[_0x2658('0x57')]['findAll']({'where':{'userProfileId':_0x97232f[_0x2658('0x58')]['id'],'sectionId':_['map'](_0x145581,function(_0x43dc99){return _0x43dc99['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x5a16a8){var _0x119ecc=_[_0x2658('0x5a')](_0x97232f[_0x2658('0x54')],function(_0x5c41d3){_0x5c41d3[_0x2658('0x5c')]=_0x97232f['params']['id'];return _0x5c41d3;});return db[_0x2658('0x61')][_0x2658('0x70')](_0x119ecc,{'raw':!![],'transaction':_0xac21e3});});}})[_0x2658('0x4b')](handleError(_0x39eae3,null));});}})['then'](function(_0x1e089f){var _0x2fe806=_[_0x2658('0x5a')](_0x1e089f,function(_0x422d4b){return _0x422d4b[_0x2658('0x51')]({'plain':!![]});});})[_0x2658('0x2b')](respondWithResult(_0x39eae3,null))[_0x2658('0x4b')](handleError(_0x39eae3,null));};exports[_0x2658('0x71')]=function(_0x2c9293,_0xa4be8b,_0xa6f685){return db[_0x2658('0x33')][_0x2658('0x4d')]({'where':{'id':_0x2c9293[_0x2658('0x58')]['id']}})[_0x2658('0x2b')](handleEntityNotFound(_0xa4be8b,null))[_0x2658('0x2b')](function(_0x334df9){if(_0x334df9){return _0x334df9[_0x2658('0x71')](_0x2c9293[_0x2658('0x38')][_0x2658('0x64')]);}})[_0x2658('0x2b')](respondWithStatusCode(_0xa4be8b,null))[_0x2658('0x4b')](handleError(_0xa4be8b,null));};exports[_0x2658('0x72')]=function(_0x16a4fe,_0x519492){var _0x21e216={};if(!_0x16a4fe[_0x2658('0x38')][_0x2658('0x73')])throw new Error(_0x2658('0x74'));if(!_0x16a4fe['query'][_0x2658('0x3f')](_0x2658('0x40'))){_0x21e216[_0x2658('0x25')]=qs[_0x2658('0x25')](_0x16a4fe['query'][_0x2658('0x25')]);_0x21e216[_0x2658('0x23')]=qs[_0x2658('0x23')](_0x16a4fe[_0x2658('0x38')][_0x2658('0x23')]);}return db[_0x2658('0x33')]['find']({'where':{'id':_0x16a4fe[_0x2658('0x58')]['id']}})[_0x2658('0x2b')](function(_0x36d6b9){if(!_0x36d6b9)throw new Error(_0x2658('0x75')+_0x16a4fe['params']['id']);return db[_0x2658('0x33')][_0x2658('0x72')](_0x16a4fe);})[_0x2658('0x2b')](respondWithFilteredResult(_0x519492,_0x21e216))[_0x2658('0x4b')](handleError(_0x519492,null));}; \ No newline at end of file +var _0x6829=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','order','where','filters','pick','filter','merge','VIRTUAL','options','UserProfile','includeAll','include','findAll','rows','catch','show','params','create','body','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','find','describe','addSections','push','removeSections','getSections','enabled','isEmpty','includes','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','moment','bluebird','mustache','util','path'];(function(_0x16960e,_0x169c9f){var _0x1c24ce=function(_0x58c97){while(--_0x58c97){_0x16960e['push'](_0x16960e['shift']());}};_0x1c24ce(++_0x169c9f);}(_0x6829,0x14c));var _0x9682=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x6829[_0x122096];return _0x3d1966;};'use strict';var emlformat=require(_0x9682('0x0'));var rimraf=require(_0x9682('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9682('0x2'));var BPromise=require(_0x9682('0x3'));var Mustache=require(_0x9682('0x4'));var util=require(_0x9682('0x5'));var path=require(_0x9682('0x6'));var sox=require(_0x9682('0x7'));var csv=require(_0x9682('0x8'));var ejs=require(_0x9682('0x9'));var fs=require('fs');var fs_extra=require(_0x9682('0xa'));var _=require(_0x9682('0xb'));var squel=require(_0x9682('0xc'));var crypto=require(_0x9682('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9682('0xe'));var Papa=require(_0x9682('0xf'));var Redis=require('ioredis');var authService=require(_0x9682('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9682('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9682('0x12'))(_0x9682('0x13'));var utils=require(_0x9682('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9682('0x15'))['db'];config[_0x9682('0x16')]=_['defaults'](config[_0x9682('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x9682('0x17'))(new Redis(config[_0x9682('0x16')]));require(_0x9682('0x18'))[_0x9682('0x19')](socket);function respondWithStatusCode(_0x30bfd7,_0x161717){_0x161717=_0x161717||0xcc;return function(_0x73f6c6){if(_0x73f6c6){return _0x30bfd7[_0x9682('0x1a')](_0x161717);}return _0x30bfd7[_0x9682('0x1b')](_0x161717)[_0x9682('0x1c')]();};}function respondWithResult(_0x526391,_0x3935c2){_0x3935c2=_0x3935c2||0xc8;return function(_0x567127){if(_0x567127){return _0x526391[_0x9682('0x1b')](_0x3935c2)[_0x9682('0x1d')](_0x567127);}};}function respondWithFilteredResult(_0x1f4971,_0x5de0e0){return function(_0x1c73ee){if(_0x1c73ee){var _0x4e0dfb=typeof _0x5de0e0[_0x9682('0x1e')]==='undefined'&&typeof _0x5de0e0[_0x9682('0x1f')]===_0x9682('0x20');var _0x57d4cf=_0x1c73ee[_0x9682('0x21')];var _0x2202d9=_0x4e0dfb?0x0:_0x5de0e0['offset'];var _0x4805b7=_0x4e0dfb?_0x1c73ee['count']:_0x5de0e0[_0x9682('0x1e')]+_0x5de0e0['limit'];var _0x36230c;if(_0x4805b7>=_0x57d4cf){_0x4805b7=_0x57d4cf;_0x36230c=0xc8;}else{_0x36230c=0xce;}_0x1f4971[_0x9682('0x1b')](_0x36230c);return _0x1f4971['set'](_0x9682('0x22'),_0x2202d9+'-'+_0x4805b7+'/'+_0x57d4cf)[_0x9682('0x1d')](_0x1c73ee);}return null;};}function patchUpdates(_0x1aacb6){return function(_0xe3e8eb){try{jsonpatch[_0x9682('0x23')](_0xe3e8eb,_0x1aacb6,!![]);}catch(_0x1c2eaf){return BPromise[_0x9682('0x24')](_0x1c2eaf);}return _0xe3e8eb[_0x9682('0x25')]();};}function saveUpdates(_0x107352,_0x2bede7){return function(_0x5cb1dc){if(_0x5cb1dc){return _0x5cb1dc[_0x9682('0x26')](_0x107352)[_0x9682('0x27')](function(_0x88419f){return _0x88419f;});}return null;};}function removeEntity(_0x21a10b,_0x39291f){return function(_0x5319f2){if(_0x5319f2){return _0x5319f2[_0x9682('0x28')]()[_0x9682('0x27')](function(){_0x21a10b[_0x9682('0x1b')](0xcc)[_0x9682('0x1c')]();});}};}function handleEntityNotFound(_0x27bf94,_0x46bb89){return function(_0x48e821){if(!_0x48e821){_0x27bf94[_0x9682('0x1a')](0x194);}return _0x48e821;};}function handleError(_0x2ae6aa,_0x27dc9e){_0x27dc9e=_0x27dc9e||0x1f4;return function(_0x1d827e){logger[_0x9682('0x29')](_0x1d827e[_0x9682('0x2a')]);if(_0x1d827e[_0x9682('0x2b')]){delete _0x1d827e[_0x9682('0x2b')];}_0x2ae6aa['status'](_0x27dc9e)[_0x9682('0x2c')](_0x1d827e);};}exports['index']=function(_0x2a765c,_0x27d7f0){var _0x598248={},_0x54c860={},_0x4b4c5d={'count':0x0,'rows':[]};var _0x5a2ad3=_[_0x9682('0x2d')](db['UserProfile'][_0x9682('0x2e')],function(_0x30a2cd){return{'name':_0x30a2cd[_0x9682('0x2f')],'type':_0x30a2cd[_0x9682('0x30')]['key']};});_0x54c860['model']=_[_0x9682('0x2d')](_0x5a2ad3,_0x9682('0x2b'));_0x54c860[_0x9682('0x31')]=_[_0x9682('0x32')](_0x2a765c[_0x9682('0x31')]);_0x54c860['filters']=_['intersection'](_0x54c860[_0x9682('0x33')],_0x54c860[_0x9682('0x31')]);_0x598248[_0x9682('0x34')]=_[_0x9682('0x35')](_0x54c860[_0x9682('0x33')],qs[_0x9682('0x36')](_0x2a765c[_0x9682('0x31')]['fields']));_0x598248[_0x9682('0x34')]=_0x598248[_0x9682('0x34')][_0x9682('0x37')]?_0x598248[_0x9682('0x34')]:_0x54c860[_0x9682('0x33')];if(!_0x2a765c['query'][_0x9682('0x38')]('nolimit')){_0x598248[_0x9682('0x1f')]=qs[_0x9682('0x1f')](_0x2a765c[_0x9682('0x31')][_0x9682('0x1f')]);_0x598248[_0x9682('0x1e')]=qs[_0x9682('0x1e')](_0x2a765c[_0x9682('0x31')]['offset']);}_0x598248[_0x9682('0x39')]=qs['sort'](_0x2a765c[_0x9682('0x31')]['sort']);_0x598248[_0x9682('0x3a')]=qs[_0x9682('0x3b')](_[_0x9682('0x3c')](_0x2a765c[_0x9682('0x31')],_0x54c860[_0x9682('0x3b')]),_0x5a2ad3);if(_0x2a765c[_0x9682('0x31')][_0x9682('0x3d')]){_0x598248[_0x9682('0x3a')]=_[_0x9682('0x3e')](_0x598248[_0x9682('0x3a')],{'$or':_[_0x9682('0x2d')](_0x5a2ad3,function(_0x51e054){if(_0x51e054[_0x9682('0x30')]!==_0x9682('0x3f')){var _0xd4bc5b={};_0xd4bc5b[_0x51e054[_0x9682('0x2b')]]={'$like':'%'+_0x2a765c[_0x9682('0x31')]['filter']+'%'};return _0xd4bc5b;}})});}_0x598248=_[_0x9682('0x3e')]({},_0x598248,_0x2a765c[_0x9682('0x40')]);var _0x214e36={'where':_0x598248['where']};return db[_0x9682('0x41')][_0x9682('0x21')](_0x214e36)[_0x9682('0x27')](function(_0x240431){_0x4b4c5d[_0x9682('0x21')]=_0x240431;if(_0x2a765c[_0x9682('0x31')][_0x9682('0x42')]){_0x598248[_0x9682('0x43')]=[{'all':!![]}];}return db[_0x9682('0x41')][_0x9682('0x44')](_0x598248);})[_0x9682('0x27')](function(_0x3324b2){_0x4b4c5d[_0x9682('0x45')]=_0x3324b2;return _0x4b4c5d;})[_0x9682('0x27')](respondWithFilteredResult(_0x27d7f0,_0x598248))[_0x9682('0x46')](handleError(_0x27d7f0,null));};exports[_0x9682('0x47')]=function(_0x4dd3e1,_0x9eff90){var _0x5ac6ba={'raw':![],'where':{'id':_0x4dd3e1[_0x9682('0x48')]['id']}},_0xbb8fb5={};_0xbb8fb5[_0x9682('0x33')]=_['keys'](db['UserProfile'][_0x9682('0x2e')]);_0xbb8fb5[_0x9682('0x31')]=_[_0x9682('0x32')](_0x4dd3e1[_0x9682('0x31')]);_0xbb8fb5[_0x9682('0x3b')]=_[_0x9682('0x35')](_0xbb8fb5[_0x9682('0x33')],_0xbb8fb5['query']);_0x5ac6ba[_0x9682('0x34')]=_['intersection'](_0xbb8fb5[_0x9682('0x33')],qs[_0x9682('0x36')](_0x4dd3e1[_0x9682('0x31')][_0x9682('0x36')]));_0x5ac6ba[_0x9682('0x34')]=_0x5ac6ba[_0x9682('0x34')][_0x9682('0x37')]?_0x5ac6ba[_0x9682('0x34')]:_0xbb8fb5['model'];if(_0x4dd3e1[_0x9682('0x31')][_0x9682('0x42')]){_0x5ac6ba[_0x9682('0x43')]=[{'all':!![]}];}_0x5ac6ba=_[_0x9682('0x3e')]({},_0x5ac6ba,_0x4dd3e1[_0x9682('0x40')]);return db[_0x9682('0x41')]['find'](_0x5ac6ba)[_0x9682('0x27')](handleEntityNotFound(_0x9eff90,null))[_0x9682('0x27')](respondWithResult(_0x9eff90,null))[_0x9682('0x46')](handleError(_0x9eff90,null));};exports[_0x9682('0x49')]=function(_0x3c79ce,_0x2cc99b){return db[_0x9682('0x41')][_0x9682('0x49')](_0x3c79ce[_0x9682('0x4a')],{})[_0x9682('0x27')](respondWithResult(_0x2cc99b,0xc9))['catch'](handleError(_0x2cc99b,null));};exports['clone']=function(_0x47b5e5,_0x49d948){var _0x520538={'where':{'id':_0x47b5e5[_0x9682('0x48')]['id']}},_0x2a1d97={};_0x2a1d97[_0x9682('0x33')]=_['keys'](db[_0x9682('0x41')][_0x9682('0x2e')]);_0x520538[_0x9682('0x34')]=_['intersection'](_0x2a1d97[_0x9682('0x33')],qs[_0x9682('0x36')](_0x47b5e5[_0x9682('0x31')][_0x9682('0x36')]));_0x520538[_0x9682('0x34')]=_0x520538[_0x9682('0x34')][_0x9682('0x37')]?_0x520538['attributes']:_0x2a1d97[_0x9682('0x33')];if(_0x47b5e5[_0x9682('0x31')][_0x9682('0x42')]){_0x520538[_0x9682('0x43')]=[{'all':!![]}];}_0x520538=_[_0x9682('0x3e')]({},_0x520538,_0x47b5e5[_0x9682('0x40')]);return db[_0x9682('0x41')]['find'](_0x520538)['then'](handleEntityNotFound(_0x49d948,null))[_0x9682('0x27')](function(_0x10adbb){if(_0x10adbb){var _0x47a8d9=_0x10adbb[_0x9682('0x4b')]({'plain':!![]});_0x47a8d9=qs[_0x9682('0x4c')](_0x47a8d9,['id',_0x9682('0x4d'),_0x9682('0x4e'),_0x9682('0x4f')]);_0x47b5e5['body']=_[_0x9682('0x4c')](_0x47b5e5[_0x9682('0x4a')],['id',_0x9682('0x4d'),_0x9682('0x4e')]);return db[_0x9682('0x50')][_0x9682('0x51')](function(_0x57217d){return db[_0x9682('0x41')][_0x9682('0x49')](_[_0x9682('0x3e')](_0x47a8d9,_0x47b5e5[_0x9682('0x4a')]),{'include':_0x47b5e5[_0x9682('0x31')][_0x9682('0x42')]?[{'all':!![]}]:undefined,'transaction':_0x57217d})[_0x9682('0x27')](function(_0x632c5d){var _0x124ccb=_0x632c5d[_0x9682('0x4b')]({'plain':!![]});return db[_0x9682('0x52')][_0x9682('0x44')]({'where':{'userProfileId':_0x47b5e5['params']['id']},'raw':!![]})[_0x9682('0x27')](function(_0x4353bf){if(_0x4353bf){return BPromise[_0x9682('0x53')](_0x4353bf,function(_0x44ecc4){return new BPromise(function(_0x1a23ea,_0x4888e5){if(_0x44ecc4['autoAssociation']===null||_0x44ecc4[_0x9682('0x54')]===0x1)_0x1a23ea(null);return db[_0x9682('0x55')][_0x9682('0x44')]({'where':{'sectionId':_0x44ecc4['id']},'raw':!![]})[_0x9682('0x27')](function(_0x320057){var _0x528fa2=_[_0x9682('0x2d')](_0x320057,function(_0x54636e){return qs[_0x9682('0x4c')](_0x54636e,['id',_0x9682('0x4d'),'updatedAt',_0x9682('0x56')]);});_0x1a23ea(_0x528fa2);})[_0x9682('0x46')](function(_0x3d1fea){_0x4888e5(_0x3d1fea);});})[_0x9682('0x27')](function(_0x4ac365){var _0x648744=qs[_0x9682('0x4c')](_0x44ecc4,['id',_0x9682('0x4d'),_0x9682('0x4e')]);_0x648744[_0x9682('0x57')]=_0x124ccb['id'];if(_0x4ac365)_0x648744[_0x9682('0x58')]=_0x4ac365;return _0x648744;})['then'](function(_0x5d6ded){return db['UserProfileSection'][_0x9682('0x49')](_0x5d6ded,{'include':[{'model':db[_0x9682('0x55')],'as':'Resources'}],'raw':!![],'transaction':_0x57217d});});})[_0x9682('0x27')](function(){return _0x124ccb;});}});});});}})['then'](respondWithResult(_0x49d948,0xc9))[_0x9682('0x46')](handleError(_0x49d948,null));};exports[_0x9682('0x26')]=function(_0x256f30,_0x463139){if(_0x256f30[_0x9682('0x4a')]['id']){delete _0x256f30[_0x9682('0x4a')]['id'];}return db[_0x9682('0x41')][_0x9682('0x59')]({'where':{'id':_0x256f30[_0x9682('0x48')]['id']}})['then'](handleEntityNotFound(_0x463139,null))[_0x9682('0x27')](saveUpdates(_0x256f30[_0x9682('0x4a')],null))[_0x9682('0x27')](respondWithResult(_0x463139,null))[_0x9682('0x46')](handleError(_0x463139,null));};exports[_0x9682('0x28')]=function(_0x31239b,_0x563373){return db[_0x9682('0x41')][_0x9682('0x59')]({'where':{'id':_0x31239b[_0x9682('0x48')]['id']}})[_0x9682('0x27')](handleEntityNotFound(_0x563373,null))[_0x9682('0x27')](removeEntity(_0x563373,null))[_0x9682('0x46')](handleError(_0x563373,null));};exports[_0x9682('0x5a')]=function(_0x43a1b1,_0x5c2925){return db[_0x9682('0x41')]['describe']()[_0x9682('0x27')](respondWithResult(_0x5c2925,null))['catch'](handleError(_0x5c2925,null));};exports[_0x9682('0x5b')]=function(_0x3ceeac,_0x19bdf3){var _0x40eec5=_0x3ceeac[_0x9682('0x4a')];return db[_0x9682('0x41')]['find']({'where':{'id':_0x3ceeac[_0x9682('0x48')]['id']}})[_0x9682('0x27')](handleEntityNotFound(_0x19bdf3,null))[_0x9682('0x27')](function(_0x38ebb8){if(_0x38ebb8){return db[_0x9682('0x50')]['transaction'](function(_0x43762c){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x3ceeac['params']['id'],'sectionId':_['map'](_0x40eec5,function(_0x4687d9){return _0x4687d9[_0x9682('0x56')];})},'transaction':_0x43762c})[_0x9682('0x27')](function(){var _0x1892f6=_[_0x9682('0x2d')](_0x40eec5,function(_0x22041a){_0x22041a[_0x9682('0x57')]=_0x3ceeac[_0x9682('0x48')]['id'];return _0x22041a;});var _0x2e1b76=[];return BPromise[_0x9682('0x53')](_0x1892f6,function(_0x5db073){return db['UserProfileSection'][_0x9682('0x49')](_0x5db073,{'include':[{'model':db[_0x9682('0x55')],'as':'Resources'}],'raw':!![],'transaction':_0x43762c})['then'](function(_0x37a934){_0x2e1b76[_0x9682('0x5c')](_0x37a934[_0x9682('0x4b')]({'plain':!![]}));});})[_0x9682('0x27')](function(){return _0x2e1b76;});});});}})[_0x9682('0x27')](function(_0x8cae46){return _0x8cae46;})[_0x9682('0x27')](respondWithResult(_0x19bdf3,null))[_0x9682('0x46')](handleError(_0x19bdf3,null));};exports[_0x9682('0x5d')]=function(_0x198ea3,_0x210b22){var _0xc0416a;return db[_0x9682('0x41')][_0x9682('0x59')]({'where':{'id':_0x198ea3[_0x9682('0x48')]['id']},'attributes':['id',_0x9682('0x2b')]})[_0x9682('0x27')](handleEntityNotFound(_0x210b22,null))[_0x9682('0x27')](function(_0x55934e){if(_0x55934e){_0xc0416a=_0x55934e;return db[_0x9682('0x52')]['destroy']({'where':{'userProfileId':_0x198ea3[_0x9682('0x48')]['id'],'sectionId':_0x198ea3[_0x9682('0x31')]['ids']}});}})[_0x9682('0x27')](function(){return _0xc0416a;})[_0x9682('0x27')](respondWithStatusCode(_0x210b22,null))[_0x9682('0x46')](handleError(_0x210b22,null));};exports[_0x9682('0x5e')]=function(_0xffec8a,_0x1f9d9a){var _0x2c29f9=[];var _0x5ebc54=[];return db[_0x9682('0x52')][_0x9682('0x44')]({'where':{'userProfileId':_0xffec8a['params']['id']},'raw':!![]})[_0x9682('0x27')](function(_0x362c3c){_0x2c29f9=_[_0x9682('0x3d')](_0x362c3c,function(_0x337c48){return _0x337c48[_0x9682('0x5f')]===0x1||_['includes']([0x3eb,0x709],_0x337c48[_0x9682('0x56')]);});if(!_[_0x9682('0x60')](_0x2c29f9)){return _['map'](_0x2c29f9,function(_0x45bd63){return _0x45bd63[_0x9682('0x56')];});}else{return;}})[_0x9682('0x27')](function(_0x27df97){if(_0x27df97)_0x5ebc54=_0x27df97;if(_[_0x9682('0x61')](_0x5ebc54,0x64)){var _0x39583a=_['find'](_0x2c29f9,{'sectionId':0x64});return hasDefaultDashboard(_0x39583a)[_0x9682('0x27')](function(_0x1d2e46){return _[_0x9682('0x2d')](_0x2c29f9,function(_0x826ddf){if(_0x826ddf['sectionId']===0x64){_0x826ddf[_0x9682('0x62')]=_0x1d2e46;}return _0x826ddf;});});}else{return;}})[_0x9682('0x27')](function(_0x5240da){if(_0x5240da)_0x2c29f9=_0x5240da;if(_[_0x9682('0x61')](_0x5ebc54,0x3eb)){var _0x43bd07=_['find'](_0x2c29f9,{'sectionId':0x3eb});return getCustomDashboards(_0x43bd07)[_0x9682('0x27')](function(_0x54ef97){return _['map'](_0x2c29f9,function(_0x244c7f){if(_0x43bd07[_0x9682('0x5f')]){if(_0x244c7f[_0x9682('0x56')]===0x3eb){_0x244c7f[_0x9682('0x62')]=_0x54ef97;}}else{if(_0x244c7f['sectionId']===0x64){_0x244c7f[_0x9682('0x62')]=_0x54ef97;}}return _0x244c7f;});});}else{return;}})['then'](function(_0x5d8597){if(_0x5d8597)_0x2c29f9=_0x5d8597;if(_[_0x9682('0x61')](_0x5ebc54,0x709)){var _0x5dee71=_[_0x9682('0x59')](_0x2c29f9,{'sectionId':0x709});return getPlugins(_0x5dee71)[_0x9682('0x27')](function(_0x573921){if(_0x5dee71[_0x9682('0x5f')]){return _[_0x9682('0x2d')](_0x2c29f9,function(_0x2a47b3){if(_0x2a47b3[_0x9682('0x56')]===0x709){_0x2a47b3[_0x9682('0x62')]=_0x573921;}return _0x2a47b3;});}else{var _0x2a7bd5={'sectionId':0x76c,'enabled':0x1,'subsections':_0x573921};var _0x1cb3e0=_[_0x9682('0x2d')](_0x2c29f9);_0x1cb3e0[_0x9682('0x5c')](_0x2a7bd5);return _0x1cb3e0;}});}else{return;}})['then'](function(_0x4eca01){if(_0x4eca01)_0x2c29f9=_0x4eca01;return _[_0x9682('0x3d')](_0x2c29f9,[_0x9682('0x5f'),0x1]);})['then'](respondWithResult(_0x1f9d9a,null))[_0x9682('0x46')](handleError(_0x1f9d9a,null));};function hasDefaultDashboard(_0x43f8b7){var _0x5a22b0=[0x65];return new BPromise(function(_0x1d2562,_0xecdbd4){try{if(_0x43f8b7[_0x9682('0x54')]){_0x1d2562(_0x5a22b0);}else{return db['UserProfileResource'][_0x9682('0x63')]({'where':{'sectionId':_0x43f8b7['id']},'raw':!![]})[_0x9682('0x27')](function(_0x13f967){_0x13f967?_0x1d2562(_0x5a22b0):_0x1d2562();});}}catch(_0x3400d3){_0xecdbd4(_0x3400d3);}});}function getCustomDashboards(_0x457404){var _0x4c70d6=[];return new BPromise(function(_0x37d3db,_0x26592b){try{if(_0x457404[_0x9682('0x54')]){return db[_0x9682('0x64')][_0x9682('0x44')]({'raw':!![]})[_0x9682('0x27')](function(_0x4b7f96){_0x4b7f96[_0x9682('0x65')](function(_0xe13321){_0x4c70d6['push'](_0xe13321['id']+0x1869f);});_0x37d3db(_0x4c70d6);});}else{return db[_0x9682('0x55')][_0x9682('0x44')]({'where':{'sectionId':_0x457404['id']},'raw':!![]})[_0x9682('0x27')](function(_0x2a7020){_0x2a7020[_0x9682('0x65')](function(_0x206933){_0x4c70d6[_0x9682('0x5c')](_0x206933[_0x9682('0x66')]+0x1869f);});_0x37d3db(_0x4c70d6);});}}catch(_0x1dfce9){_0x26592b(_0x1dfce9);}});}function getPlugins(_0x3f4060){var _0x422848=[];return new BPromise(function(_0x2b7297,_0x68f4ee){try{if(_0x3f4060['autoAssociation']){return db[_0x9682('0x67')][_0x9682('0x44')]({'raw':!![]})[_0x9682('0x27')](function(_0x376111){_0x376111[_0x9682('0x65')](function(_0x2a2308){_0x422848[_0x9682('0x5c')](_0x2a2308['id']+0x15b38);});_0x2b7297(_0x422848);});}else{return db['UserProfileResource'][_0x9682('0x44')]({'where':{'sectionId':_0x3f4060['id']},'raw':!![]})[_0x9682('0x27')](function(_0x553e30){_0x553e30[_0x9682('0x65')](function(_0x185a49){_0x422848['push'](_0x185a49['resourceId']+0x15b38);});_0x2b7297(_0x422848);});}}catch(_0x4ffcf6){_0x68f4ee(_0x4ffcf6);}});}exports[_0x9682('0x68')]=function(_0x4988ec,_0x3f1b9d){return db['UserProfile']['find']({'where':{'id':_0x4988ec[_0x9682('0x48')]['id']}})[_0x9682('0x27')](handleEntityNotFound(_0x3f1b9d,null))[_0x9682('0x27')](function(_0x5c2454){if(_0x5c2454){return db['sequelize'][_0x9682('0x51')](function(_0x2a71d2){return db[_0x9682('0x52')][_0x9682('0x44')]({'where':{'userProfileId':_0x4988ec[_0x9682('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0x9682('0x27')](function(_0x436188){if(_0x436188){return db[_0x9682('0x52')]['destroy']({'where':{'userProfileId':_0x4988ec[_0x9682('0x48')]['id'],'id':_['map'](_0x436188,function(_0x548991){return _0x548991['id'];})},'transaction':_0x2a71d2});}})[_0x9682('0x27')](function(_0x4827db){var _0x117c65=_[_0x9682('0x2d')](_0x4988ec[_0x9682('0x4a')],function(_0x494154){_0x494154[_0x9682('0x57')]=_0x4988ec[_0x9682('0x48')]['id'];return _0x494154;});return db[_0x9682('0x52')]['bulkCreate'](_0x117c65,{'raw':!![],'transaction':_0x2a71d2});})[_0x9682('0x27')](function(_0x499be0){var _0x1a057c=_[_0x9682('0x3d')](_[_0x9682('0x2d')](_0x499be0,function(_0x240a2c){return _0x240a2c[_0x9682('0x4b')]({'plain':!![]});}),{'includeAll':![]});if(_0x1a057c){return db[_0x9682('0x52')]['findAll']({'where':{'userProfileId':_0x4988ec[_0x9682('0x48')]['id'],'sectionId':_[_0x9682('0x2d')](_0x1a057c,function(_0x44065f){return _0x44065f[_0x9682('0x56')];})},'attributes':['id',_0x9682('0x56')],'raw':!![]})[_0x9682('0x27')](function(_0x569fc4){var _0x3801e8=_[_0x9682('0x2d')](_0x4988ec[_0x9682('0x4a')],function(_0x4e139c){_0x4e139c[_0x9682('0x57')]=_0x4988ec[_0x9682('0x48')]['id'];return _0x4e139c;});return db[_0x9682('0x55')][_0x9682('0x69')](_0x3801e8,{'raw':!![],'transaction':_0x2a71d2});});}})[_0x9682('0x46')](handleError(_0x3f1b9d,null));});}})[_0x9682('0x27')](function(_0x32645d){var _0x185669=_[_0x9682('0x2d')](_0x32645d,function(_0x158a77){return _0x158a77[_0x9682('0x4b')]({'plain':!![]});});})[_0x9682('0x27')](respondWithResult(_0x3f1b9d,null))[_0x9682('0x46')](handleError(_0x3f1b9d,null));};exports[_0x9682('0x6a')]=function(_0x41bf57,_0x1af44a,_0x2ea681){return db[_0x9682('0x41')][_0x9682('0x59')]({'where':{'id':_0x41bf57[_0x9682('0x48')]['id']}})[_0x9682('0x27')](handleEntityNotFound(_0x1af44a,null))[_0x9682('0x27')](function(_0x357533){if(_0x357533){return _0x357533[_0x9682('0x6a')](_0x41bf57['query'][_0x9682('0x6b')]);}})['then'](respondWithStatusCode(_0x1af44a,null))[_0x9682('0x46')](handleError(_0x1af44a,null));};exports[_0x9682('0x6c')]=function(_0x3b5f59,_0x5968dc){var _0x22a70f={};if(!_0x3b5f59[_0x9682('0x31')][_0x9682('0x6d')])throw new Error(_0x9682('0x6e'));if(!_0x3b5f59[_0x9682('0x31')][_0x9682('0x38')](_0x9682('0x6f'))){_0x22a70f[_0x9682('0x1f')]=qs[_0x9682('0x1f')](_0x3b5f59[_0x9682('0x31')]['limit']);_0x22a70f[_0x9682('0x1e')]=qs['offset'](_0x3b5f59[_0x9682('0x31')]['offset']);}return db[_0x9682('0x41')][_0x9682('0x59')]({'where':{'id':_0x3b5f59[_0x9682('0x48')]['id']}})[_0x9682('0x27')](function(_0x2f0093){if(!_0x2f0093)throw new Error(_0x9682('0x70')+_0x3b5f59[_0x9682('0x48')]['id']);return db[_0x9682('0x41')][_0x9682('0x6c')](_0x3b5f59);})[_0x9682('0x27')](respondWithFilteredResult(_0x5968dc,_0x22a70f))[_0x9682('0x46')](handleError(_0x5968dc,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 1c03904..1447095 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 _0x13c5=['emit','hasOwnProperty','events'];(function(_0x9cf8c9,_0x5c7564){var _0x579a0a=function(_0x1532ed){while(--_0x1532ed){_0x9cf8c9['push'](_0x9cf8c9['shift']());}};_0x579a0a(++_0x5c7564);}(_0x13c5,0x7a));var _0x513c=function(_0x55433f,_0x224563){_0x55433f=_0x55433f-0x0;var _0xe6670e=_0x13c5[_0x55433f];return _0xe6670e;};'use strict';var EventEmitter=require(_0x513c('0x0'));var UserProfile=require('../../mysqldb')['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x432ab7){return function(_0x516e1a,_0x4d46c0,_0x477e2c){UserProfileEvents[_0x513c('0x1')](_0x432ab7+':'+_0x516e1a['id'],_0x516e1a);UserProfileEvents[_0x513c('0x1')](_0x432ab7,_0x516e1a);_0x477e2c(null);};}for(var e in events){if(events[_0x513c('0x2')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x8ed7=['UserProfile','setMaxListeners','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x78d9ed,_0x54c591){var _0x40254e=function(_0x1bb879){while(--_0x1bb879){_0x78d9ed['push'](_0x78d9ed['shift']());}};_0x40254e(++_0x54c591);}(_0x8ed7,0x8b));var _0x78ed=function(_0x2a20d2,_0x3f0f31){_0x2a20d2=_0x2a20d2-0x0;var _0x2775c5=_0x8ed7[_0x2a20d2];return _0x2775c5;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x78ed('0x0'))['db'][_0x78ed('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x78ed('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x78ed('0x3')};function emitEvent(_0x117e45){return function(_0x3b4895,_0x1301bc,_0x137b24){UserProfileEvents[_0x78ed('0x4')](_0x117e45+':'+_0x3b4895['id'],_0x3b4895);UserProfileEvents[_0x78ed('0x4')](_0x117e45,_0x3b4895);_0x137b24(null);};}for(var e in events){if(events[_0x78ed('0x5')](e)){var event=events[e];UserProfile[_0x78ed('0x6')](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 65942f6..476e850 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 _0x9582=['contexts','voicemails','VoiceMail','VoiceRecording','parentSections','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','voicequeues','users','agents','telephones','Users','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','customdashboards','Dashboard','Interval','pauses','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','plugins','Plugin','Reports','metrics','AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','push','UserProfileSection','find','params','ignore','isEmpty','length','autoAssociation','all','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','options','includeAll','include','forEach','DefaultReports','custom','reportId','CustomReports','count','rows','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','openchannel','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','findAll','map','value','model','associatedResources','name','catch','resolve','UserProfileResource','then','AnalyticExtractedReport','type','resourceId','toLowerCase','squareprojects','childModel','SquareProject','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x9582,0x95));var _0x2958=function(_0x493cd6,_0x3b8517){_0x493cd6=_0x493cd6-0x0;var _0x559c51=_0x9582[_0x493cd6];return _0x559c51;};'use strict';var _=require(_0x2958('0x0'));var attributes=require(_0x2958('0x1'));var qs=require(_0x2958('0x2'));var squel=require(_0x2958('0x3'));module[_0x2958('0x4')]=function(_0x176287){var _0x559a01=_0x176287[_0x2958('0x5')];function _0x3b907e(_0x136c77,_0x195138){return new Promise(function(_0x2f15c9,_0xbde128){if(!_0x195138)return _0x2f15c9(null);var _0x88ffaa=_0x195138[_0x2958('0x6')]?{[_0x195138[_0x2958('0x6')][_0x2958('0x7')]]:_0x195138['filter']['value']}:undefined;return _0x559a01[_0x136c77][_0x2958('0x8')]({'where':_0x88ffaa,'raw':!![]})['then'](function(_0x10db1e){_0x195138['associatedResources']=_[_0x2958('0x9')](_0x10db1e,'id');_0x2f15c9(_0x195138);})['catch'](function(_0x3aacfa){_0xbde128(_0x3aacfa);});});}function _0x29776c(_0x12f0b0,_0x117ff0){return new Promise(function(_0x11ec8d,_0x4f980c){var _0x4780a8=_0x12f0b0[_0x2958('0x6')]?{[_0x12f0b0[_0x2958('0x6')][_0x2958('0x7')]]:_0x12f0b0[_0x2958('0x6')][_0x2958('0xa')]}:undefined;return _0x559a01[_0x12f0b0[_0x2958('0xb')]][_0x2958('0x8')]({'where':_0x4780a8,'raw':!![]})['then'](function(_0x42e976){_0x117ff0[_0x2958('0xc')]=_['map'](_0x42e976,function(_0x4c762e){return _0x4c762e[_0x2958('0xd')];});_0x11ec8d(_0x117ff0);})[_0x2958('0xe')](function(_0x5f06b1){_0x4f980c(_0x5f06b1);});});}function _0x3bef50(_0x544563,_0x5c3ac3,_0x429d42){if(!_0x5c3ac3)return Promise[_0x2958('0xf')](null);return new Promise(function(_0x55e261,_0x54ef76){return _0x559a01[_0x2958('0x10')][_0x2958('0x8')]({'where':{'sectionId':_0x5c3ac3['id']},'raw':!![]})[_0x2958('0x11')](function(_0x42bb99){if(_0x544563[_0x2958('0x7')]&&_0x544563['field']!=='id'){_0x5c3ac3[_0x2958('0xc')]=_[_0x2958('0x9')](_0x42bb99,function(_0x1a12fa){return _0x1a12fa[_0x544563['field']];});}else{if(_0x429d42===_0x2958('0x12')){_0x5c3ac3['associatedResources']=_[_0x2958('0x9')](_0x42bb99,function(_0x52ea2f){return{'id':_0x52ea2f['resourceId'],'type':_0x52ea2f[_0x2958('0x13')]};});}else{_0x5c3ac3[_0x2958('0xc')]=_[_0x2958('0x9')](_0x42bb99,function(_0x26c5a5){return _0x26c5a5[_0x2958('0x14')];});}}_0x55e261(_0x5c3ac3);})[_0x2958('0xe')](function(_0x3f8641){_0x54ef76(_0x3f8641);});});}function _0x2b9818(_0x330763,_0x2aa514){var _0xaf5547={'parentSections':[]};switch(_0x330763[_0x2958('0x15')]()){case _0x2958('0x16'):_0xaf5547[_0x2958('0x17')]=_0x2958('0x18');break;case'odbc':_0xaf5547['childModel']=_0x2958('0x19');break;case _0x2958('0x1a'):_0xaf5547[_0x2958('0x17')]=_0x2958('0x1b');_0xaf5547['parentSections']=[{'name':_0x2958('0x1c'),'field':'name','foreignKey':_0x2958('0x1d')}];break;case _0x2958('0x1e'):_0xaf5547[_0x2958('0x17')]=_0x2958('0x1f');break;case _0x2958('0x20'):_0xaf5547[_0x2958('0x17')]=_0x2958('0x21');_0xaf5547['parentSections']=[{'name':_0x2958('0x22'),'field':'id','foreignKey':'ListId'}];break;case'lists':_0xaf5547[_0x2958('0x17')]=_0x2958('0x23');break;case _0x2958('0x24'):_0xaf5547[_0x2958('0x17')]=_0x2958('0x25');break;case _0x2958('0x26'):_0xaf5547[_0x2958('0x17')]=_0x2958('0x27');break;case'chatqueues':_0xaf5547[_0x2958('0x17')]=_0x2958('0x28');break;case'chatwebsites':_0xaf5547[_0x2958('0x17')]='ChatWebsite';break;case _0x2958('0x29'):_0xaf5547['childModel']=_0x2958('0x2a');break;case'faxaccounts':_0xaf5547[_0x2958('0x17')]=_0x2958('0x2b');break;case _0x2958('0x2c'):case _0x2958('0x2d'):case _0x2958('0x2e'):_0xaf5547[_0x2958('0x17')]=_0x2958('0x2f');break;case _0x2958('0x30'):_0xaf5547[_0x2958('0x17')]='VoiceContext';break;case _0x2958('0x31'):_0xaf5547['childModel']=_0x2958('0x32');break;case'voicerecordings':_0xaf5547[_0x2958('0x17')]=_0x2958('0x33');_0xaf5547[_0x2958('0x34')]=[{'name':_0x2958('0x35'),'field':_0x2958('0xd'),'foreignKey':_0x2958('0x36'),'model':_0x2958('0x37'),'filter':{'field':_0x2958('0x38'),'value':[_0x2958('0x39')]}},{'name':_0x2958('0x3a'),'field':_0x2958('0xd'),'foreignKey':_0x2958('0x36'),'model':_0x2958('0x37'),'filter':{'field':'role','value':[_0x2958('0x3b')]}},{'name':_0x2958('0x3c'),'field':_0x2958('0xd'),'foreignKey':_0x2958('0x3d'),'model':'VoiceQueue','filter':{'field':_0x2958('0x13'),'value':[_0x2958('0x3e')]}},{'name':_0x2958('0x3f'),'field':_0x2958('0xd'),'foreignKey':_0x2958('0x3d'),'model':_0x2958('0x40'),'filter':{'field':_0x2958('0x13'),'value':[_0x2958('0x41')]}}];break;case _0x2958('0x42'):_0xaf5547[_0x2958('0x17')]=_0x2958('0x43');break;case _0x2958('0x44'):_0xaf5547[_0x2958('0x17')]='VoiceChanSpy';break;case _0x2958('0x45'):_0xaf5547[_0x2958('0x17')]='VoicePrefix';break;case'ivrcampaigns':_0xaf5547[_0x2958('0x17')]=_0x2958('0x46');break;case _0x2958('0x47'):_0xaf5547[_0x2958('0x17')]=_0x2958('0x48');break;case _0x2958('0x49'):_0xaf5547[_0x2958('0x17')]=_0x2958('0x4a');break;case _0x2958('0x4b'):_0xaf5547[_0x2958('0x17')]=_0x2958('0x4c');break;case _0x2958('0x4d'):_0xaf5547[_0x2958('0x17')]='OpenchannelQueue';break;case _0x2958('0x4e'):_0xaf5547[_0x2958('0x17')]=_0x2958('0x4f');break;case _0x2958('0x50'):_0xaf5547['childModel']=_0x2958('0x51');break;case'smsaccounts':_0xaf5547['childModel']=_0x2958('0x52');break;case _0x2958('0x53'):_0xaf5547[_0x2958('0x17')]=_0x2958('0x54');break;case _0x2958('0x55'):_0xaf5547[_0x2958('0x17')]='WhatsappAccount';break;case _0x2958('0x56'):_0xaf5547['childModel']='Team';break;case _0x2958('0x57'):case'queuecampaigns':_0xaf5547[_0x2958('0x17')]=_0x2958('0x40');if(_0x2aa514){_0xaf5547[_0x2958('0x34')]=[{'name':_0x2958('0x3c')},{'name':_0x2958('0x3f')}];}break;case _0x2958('0x58'):case _0x2958('0x59'):case _0x2958('0x5a'):_0xaf5547['childModel']=_0x2958('0x37');if(_0x2aa514){_0xaf5547[_0x2958('0x34')]=[{'name':_0x2958('0x5b'),'filter':{'field':_0x2958('0x38'),'value':['admin',_0x2958('0x5c')]},'ignore':!![]},{'name':_0x2958('0x35')},{'name':'Telephones'}];}break;case _0x2958('0x5d'):_0xaf5547[_0x2958('0x17')]=_0x2958('0x5e');break;case _0x2958('0x5f'):_0xaf5547[_0x2958('0x17')]=_0x2958('0x60');break;case'freshdeskaccounts':_0xaf5547[_0x2958('0x17')]=_0x2958('0x61');break;case _0x2958('0x62'):_0xaf5547[_0x2958('0x17')]=_0x2958('0x63');break;case _0x2958('0x64'):_0xaf5547[_0x2958('0x17')]=_0x2958('0x65');break;case _0x2958('0x66'):_0xaf5547[_0x2958('0x17')]=_0x2958('0x67');break;case _0x2958('0x68'):_0xaf5547[_0x2958('0x17')]=_0x2958('0x37');break;case _0x2958('0x69'):_0xaf5547[_0x2958('0x17')]=_0x2958('0x6a');break;case'dispositions':_0xaf5547[_0x2958('0x17')]='Disposition';break;case _0x2958('0x6b'):_0xaf5547[_0x2958('0x17')]=_0x2958('0x6c');break;case'intervals':_0xaf5547['childModel']=_0x2958('0x6d');break;case _0x2958('0x6e'):_0xaf5547[_0x2958('0x17')]='Pause';break;case'scheduler':_0xaf5547[_0x2958('0x17')]=_0x2958('0x6f');break;case _0x2958('0x70'):_0xaf5547[_0x2958('0x17')]=_0x2958('0x71');break;case _0x2958('0x72'):_0xaf5547[_0x2958('0x17')]=_0x2958('0x73');break;case _0x2958('0x74'):_0xaf5547['childModel']=_0x2958('0x75');break;case _0x2958('0x76'):_0xaf5547['childModel']=_0x2958('0x77');break;case _0x2958('0x78'):_0xaf5547[_0x2958('0x17')]=_0x2958('0x79');break;case _0x2958('0x7a'):_0xaf5547[_0x2958('0x17')]='Variable';break;case _0x2958('0x7b'):_0xaf5547[_0x2958('0x17')]=_0x2958('0x7c');break;case'extractedreports':_0xaf5547['childModel']=_0x2958('0x12');_0xaf5547['parentSections']=[{'name':_0x2958('0x7d'),'field':'id','foreignKey':'reportId'}];break;case _0x2958('0x7e'):_0xaf5547[_0x2958('0x17')]=_0x2958('0x7f');break;}return _0xaf5547;}function _0x474f6b(_0x278700,_0x55cc49){var _0x58e7ae=_0x278700[_0x2958('0x80')](0x0)[_0x2958('0x81')]()+_0x278700[_0x2958('0x82')](0x1);var _0x51bf4c={'type':_0x559a01['Sequelize'][_0x2958('0x83')][_0x2958('0x84')],'raw':!![]};return new Promise(function(_0x10998e,_0x3212c5){var _0x2b373f=squel[_0x2958('0x85')]()[_0x2958('0x7')](_0x2958('0x86')+_0x58e7ae+_0x2958('0x87'),'id')[_0x2958('0x7')](_0x2958('0x88'))[_0x2958('0x89')](_0x2958('0x8a')+_0x278700+'_interactions','ui')[_0x2958('0x8b')](_0x2958('0x8c'),_0x55cc49['id']);return _0x559a01[_0x2958('0x8d')][_0x2958('0x8e')](_0x2b373f[_0x2958('0x8f')](),_0x51bf4c)[_0x2958('0x11')](function(_0x143b2a){_0x55cc49[_0x58e7ae+_0x2958('0x90')]=_0x143b2a;_0x10998e(_0x143b2a);})[_0x2958('0xe')](function(_0x4dd3de){_0x3212c5(_0x4dd3de);});});}return _0x176287[_0x2958('0x91')]('UserProfile',attributes,{'tableName':_0x2958('0x92'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x230139){var _0x31a596={'raw':![],'where':{}};var _0x4a86a5={};var _0x510672={'count':0x0,'rows':[]};var _0x49fed2=_0x230139[_0x2958('0x8e')][_0x2958('0x93')];var _0x4c1516=_0x230139[_0x2958('0x8e')][_0x2958('0x94')]||![];var _0xb2fe28=_0x2b9818(_0x49fed2,_0x4c1516);if(!_0xb2fe28[_0x2958('0x17')])throw new Error(_0x2958('0x95')+_0x49fed2+'\x27');var _0x538298=[{'name':_0x49fed2}];if(!_['isEmpty'](_0xb2fe28[_0x2958('0x34')]))_0x538298=_0xb2fe28[_0x2958('0x34')];var _0x2b6a4a=[];for(var _0x143550=0x0;_0x143550<_0x538298['length'];_0x143550++){_0x2b6a4a[_0x2958('0x96')](_0x559a01[_0x2958('0x97')][_0x2958('0x98')]({'where':{'userProfileId':_0x230139[_0x2958('0x99')]['id'],'name':_0x538298[_0x143550]['name']},'raw':!![]}));}return Promise['all'](_0x2b6a4a)['then'](function(_0x5703a5){var _0x7691c9=_[_0x2958('0x6')](_0x5703a5,function(_0x54f68a){return _0x54f68a?_0x54f68a:undefined;});var _0x7ef46d=_[_0x2958('0x6')](_0x538298,[_0x2958('0x9a'),!![]]);var _0x234d7f=_[_0x2958('0x9b')](_0x7691c9)&&_[_0x2958('0x9b')](_0x7ef46d)?null:_['union'](_0x7ef46d,_0x7691c9);if(!_0x234d7f)return null;var _0x2c182a=[];for(var _0x1a53d6=0x0;_0x1a53d6<_0x234d7f[_0x2958('0x9c')];_0x1a53d6++){var _0x48160b=_[_0x2958('0x98')](_0x538298,function(_0x566123){return _0x234d7f[_0x1a53d6]?_0x566123['name']===_0x234d7f[_0x1a53d6]['name']:null;});if(_0x48160b){if(_0x234d7f[_0x1a53d6]['ignore']){_0x2c182a[_0x2958('0x96')](_0x3b907e(_0xb2fe28['childModel'],_0x234d7f[_0x1a53d6]));}else{if(!_0x234d7f[_0x1a53d6][_0x2958('0x9d')]){_0x2c182a[_0x2958('0x96')](_0x3bef50(_0x48160b,_0x234d7f[_0x1a53d6],_0xb2fe28[_0x2958('0x17')]));}else{if(_0x48160b[_0x2958('0xb')]){_0x2c182a[_0x2958('0x96')](_0x29776c(_0x48160b,_0x234d7f[_0x1a53d6]));}}}}}return Promise[_0x2958('0x9e')](_0x2c182a);})['then'](function(_0x42e189){var _0x1478bc=_0x42e189;var _0x6b50ec=null;if(_0x1478bc){_0x6b50ec=_0x1478bc[_0x2958('0x9c')]===0x1?_0x1478bc[0x0]:null;}if(!_0x6b50ec&&!_0x1478bc)return _0x510672;var _0x37873f=_0x559a01[_0xb2fe28[_0x2958('0x17')]][_0x2958('0x9f')];_0x4a86a5[_0x2958('0xb')]=_[_0x2958('0xa0')](_0x37873f);_0x4a86a5[_0x2958('0x8e')]=_[_0x2958('0xa0')](_0x230139[_0x2958('0x8e')]);_0x4a86a5[_0x2958('0xa1')]=_[_0x2958('0xa2')](_0x4a86a5[_0x2958('0xb')],_0x4a86a5[_0x2958('0x8e')]);_0x31a596[_0x2958('0xa3')]=_[_0x2958('0xa2')](_0x4a86a5[_0x2958('0xb')],qs[_0x2958('0xa4')](_0x230139[_0x2958('0x8e')]['fields']));_0x31a596[_0x2958('0xa3')]=_0x31a596[_0x2958('0xa3')][_0x2958('0x9c')]?_0x31a596[_0x2958('0xa3')]:_0x4a86a5[_0x2958('0xb')];if(!_0x230139['query'][_0x2958('0xa5')](_0x2958('0xa6'))){_0x31a596[_0x2958('0xa7')]=qs[_0x2958('0xa7')](_0x230139[_0x2958('0x8e')][_0x2958('0xa7')]);_0x31a596[_0x2958('0xa8')]=qs[_0x2958('0xa8')](_0x230139[_0x2958('0x8e')][_0x2958('0xa8')]);}_0x31a596[_0x2958('0xa9')]=qs[_0x2958('0xaa')](_0x230139[_0x2958('0x8e')][_0x2958('0xaa')]);_0x31a596[_0x2958('0x8b')]=qs[_0x2958('0xa1')](_[_0x2958('0xab')](_0x230139[_0x2958('0x8e')],_0x4a86a5[_0x2958('0xa1')]));if(_0x230139[_0x2958('0x8e')][_0x2958('0x6')]){_0x31a596[_0x2958('0x8b')]=_[_0x2958('0xac')](_0x31a596[_0x2958('0x8b')],{'$or':_['map'](_0x37873f,function(_0x329a26){if(_0x329a26[_0x2958('0x13')][_0x2958('0xad')]!==_0x2958('0xae')){var _0x1f3894={};_0x1f3894[_0x329a26[_0x2958('0x7')]]={'$like':'%'+_0x230139[_0x2958('0x8e')][_0x2958('0x6')]+'%'};return _0x1f3894;}})});}var _0x2df937=[];var _0x23b1b7=null;var _0x19bd4f={};if(_0x6b50ec){_0x23b1b7=_[_0x2958('0x98')](_0x538298,['name',_0x6b50ec[_0x2958('0xd')]]);if(_0x23b1b7[_0x2958('0x7')]){_0x19bd4f={};if(_0xb2fe28[_0x2958('0x17')]===_0x2958('0x12')){_0x19bd4f[_0x23b1b7[_0x2958('0xaf')]]=_[_0x2958('0x9')](_0x6b50ec['associatedResources'],'id');}else{_0x19bd4f[_0x23b1b7[_0x2958('0xaf')]]=_0x6b50ec[_0x2958('0xc')];}_0x2df937[_0x2958('0x96')](_0x19bd4f);}else{_0x31a596[_0x2958('0x8b')]['id']=_0x6b50ec[_0x2958('0xc')];}}else{for(var _0x558b10=0x0;_0x558b10<_0x1478bc[_0x2958('0x9c')];_0x558b10++){_0x23b1b7=_[_0x2958('0x98')](_0x538298,[_0x2958('0xd'),_0x1478bc[_0x558b10][_0x2958('0xd')]]);if(_0x23b1b7[_0x2958('0x7')]){_0x19bd4f={};_0x19bd4f[_0x23b1b7[_0x2958('0xaf')]]=_0x1478bc[_0x558b10][_0x2958('0xc')];_0x2df937[_0x2958('0x96')](_0x19bd4f);}else{if(!_0x31a596[_0x2958('0x8b')]['id'])_0x31a596[_0x2958('0x8b')]['id']=[];_0x1478bc[_0x558b10][_0x2958('0xc')]['forEach'](function(_0x866db4){_0x31a596[_0x2958('0x8b')]['id']['push'](_0x866db4);});}}}if(!_['isEmpty'](_0x2df937)){_0x31a596[_0x2958('0x8b')]=_[_0x2958('0xac')](_0x31a596['where'],{'$and':{'$or':_0x2df937}});}_0x31a596=_[_0x2958('0xac')]({},_0x31a596,_0x230139[_0x2958('0xb0')]);if(_0x6b50ec&&!_0x6b50ec[_0x2958('0x9d')]&&_0xb2fe28['childModel']===_0x2958('0x12')){if(_0x230139[_0x2958('0x8e')][_0x2958('0xb1')]){_0x31a596[_0x2958('0xb2')]=[{'all':!![]}];}return _0x559a01[_0xb2fe28[_0x2958('0x17')]][_0x2958('0x8')](_0x31a596)['then'](function(_0x449e68){var _0x675842=[];_0x449e68[_0x2958('0xb3')](function(_0x14cf16){var _0x5bb046;switch(_0x14cf16['reportType']){case'default':_0x5bb046=_[_0x2958('0x98')](_0x6b50ec['associatedResources'],function(_0x2feb07){return _0x2feb07['id']===_0x14cf16['reportId']&&_0x2feb07['type']===_0x2958('0xb4');});break;case _0x2958('0xb5'):_0x5bb046=_['find'](_0x6b50ec[_0x2958('0xc')],function(_0xc7d9b1){return _0xc7d9b1['id']===_0x14cf16[_0x2958('0xb6')]&&_0xc7d9b1[_0x2958('0x13')]===_0x2958('0xb7');});break;}if(_0x5bb046)_0x675842['push'](_0x14cf16);});_0x510672[_0x2958('0xb8')]=_0x675842[_0x2958('0x9c')];_0x510672[_0x2958('0xb9')]=_0x675842;return _0x510672;});}else{return _0x559a01[_0xb2fe28[_0x2958('0x17')]][_0x2958('0xb8')]({'where':_0x31a596[_0x2958('0x8b')]})[_0x2958('0x11')](function(_0x1142e3){_0x510672[_0x2958('0xb8')]=_0x1142e3;if(_0x230139['query'][_0x2958('0xb1')]){if(_0xb2fe28[_0x2958('0x17')]===_0x2958('0x21')){_0x31a596['include']=[{'model':_0x559a01[_0x2958('0x73')],'as':_0x2958('0xba'),'attributes':['id',_0x2958('0xd'),_0x2958('0xbb')],'required':_0x230139[_0x2958('0x8e')][_0x2958('0xbc')]?!![]:![]},{'model':_0x559a01[_0x2958('0x73')],'as':_0x2958('0xbd'),'attributes':['id',_0x2958('0xd'),_0x2958('0xbb')],'through':_0x230139['query'][_0x2958('0xbc')]?{'attributes':[],'where':{'TagId':_0x230139['query']['tag']||undefined}}:{},'required':_0x230139[_0x2958('0x8e')][_0x2958('0xbc')]?!![]:![]}];}else{_0x31a596['include']=[{'all':!![]}];}}return _0x559a01[_0xb2fe28['childModel']]['findAll'](_0x31a596);})[_0x2958('0x11')](function(_0x8ca614){_0x510672['rows']=_0x8ca614;if(_0x49fed2===_0x2958('0x35')&&_0x230139[_0x2958('0x8e')][_0x2958('0xbe')]===_0x2958('0xbf')){var _0x1333ff=[];for(var _0x375bfc=0x0;_0x375bfc<_0x510672[_0x2958('0xb9')]['length'];_0x375bfc++){_0x1333ff[_0x2958('0x96')](_0x474f6b(_0x2958('0xc0'),_0x510672[_0x2958('0xb9')][_0x375bfc][_0x2958('0xc1')]));_0x1333ff[_0x2958('0x96')](_0x474f6b(_0x2958('0xc2'),_0x510672[_0x2958('0xb9')][_0x375bfc][_0x2958('0xc1')]));_0x1333ff[_0x2958('0x96')](_0x474f6b(_0x2958('0xc3'),_0x510672['rows'][_0x375bfc]['dataValues']));_0x1333ff[_0x2958('0x96')](_0x474f6b('mail',_0x510672[_0x2958('0xb9')][_0x375bfc][_0x2958('0xc1')]));_0x1333ff[_0x2958('0x96')](_0x474f6b(_0x2958('0xc4'),_0x510672[_0x2958('0xb9')][_0x375bfc][_0x2958('0xc1')]));_0x1333ff[_0x2958('0x96')](_0x474f6b('whatsapp',_0x510672[_0x2958('0xb9')][_0x375bfc][_0x2958('0xc1')]));}return Promise[_0x2958('0x9e')](_0x1333ff)[_0x2958('0x11')](function(){return _0x510672;});}return _0x510672;});}});}}});}; \ No newline at end of file +var _0x4137=['metrics','toUpperCase','slice','Sequelize','QueryTypes','select','ui.','InteractionId','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','define','user_profiles','query','section','mergeResources','isEmpty','length','push','UserProfileSection','params','ignore','find','all','rawAttributes','model','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','default','DefaultReports','custom','reportId','CustomReports','count','Tags','color','tag','Agents','openTabs','true','chat','rows','dataValues','sms','mail','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','associatedResources','catch','then','map','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','ListId','lists','CmList','companies','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','name','role','Telephones','membername','User','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','MailQueue','mailaccounts','MailAccount','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','salesforceaccounts','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','Disposition','customdashboards','Dashboard','Interval','Sound','tags','Tag','Template','triggers','Trigger','Trunk','variables','Variable','plugins','extractedreports','Reports'];(function(_0x55a20c,_0x1bdf8d){var _0x2e5e66=function(_0x57ea74){while(--_0x57ea74){_0x55a20c['push'](_0x55a20c['shift']());}};_0x2e5e66(++_0x1bdf8d);}(_0x4137,0xf8));var _0x7413=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4137[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x7413('0x0'));var attributes=require(_0x7413('0x1'));var qs=require(_0x7413('0x2'));var squel=require(_0x7413('0x3'));module[_0x7413('0x4')]=function(_0x410971){var _0x2e6df7=_0x410971[_0x7413('0x5')];function _0x258255(_0x3dc48a,_0x451a96){return new Promise(function(_0x3bb181,_0x4fbade){if(!_0x451a96)return _0x3bb181(null);var _0xc808cd=_0x451a96[_0x7413('0x6')]?{[_0x451a96[_0x7413('0x6')][_0x7413('0x7')]]:_0x451a96['filter'][_0x7413('0x8')]}:undefined;return _0x2e6df7[_0x3dc48a][_0x7413('0x9')]({'where':_0xc808cd,'raw':!![]})['then'](function(_0x422bf5){_0x451a96[_0x7413('0xa')]=_['map'](_0x422bf5,'id');_0x3bb181(_0x451a96);})[_0x7413('0xb')](function(_0x427b3b){_0x4fbade(_0x427b3b);});});}function _0x737ab4(_0x3e026b,_0x14212d){return new Promise(function(_0x5a1e62,_0xa25d72){var _0x32034c=_0x3e026b['filter']?{[_0x3e026b[_0x7413('0x6')][_0x7413('0x7')]]:_0x3e026b[_0x7413('0x6')]['value']}:undefined;return _0x2e6df7[_0x3e026b['model']]['findAll']({'where':_0x32034c,'raw':!![]})[_0x7413('0xc')](function(_0x336c4c){_0x14212d['associatedResources']=_[_0x7413('0xd')](_0x336c4c,function(_0x45bef0){return _0x45bef0['name'];});_0x5a1e62(_0x14212d);})[_0x7413('0xb')](function(_0x50f301){_0xa25d72(_0x50f301);});});}function _0x4b9a5b(_0x26501b,_0x568d1f,_0x195c72){if(!_0x568d1f)return Promise['resolve'](null);return new Promise(function(_0x2036b6,_0x3230d8){return _0x2e6df7[_0x7413('0xe')][_0x7413('0x9')]({'where':{'sectionId':_0x568d1f['id']},'raw':!![]})[_0x7413('0xc')](function(_0x26dafe){if(_0x26501b['field']&&_0x26501b[_0x7413('0x7')]!=='id'){_0x568d1f[_0x7413('0xa')]=_[_0x7413('0xd')](_0x26dafe,function(_0xfe5b8c){return _0xfe5b8c[_0x26501b['field']];});}else{if(_0x195c72===_0x7413('0xf')){_0x568d1f[_0x7413('0xa')]=_[_0x7413('0xd')](_0x26dafe,function(_0x20d3d2){return{'id':_0x20d3d2[_0x7413('0x10')],'type':_0x20d3d2[_0x7413('0x11')]};});}else{_0x568d1f[_0x7413('0xa')]=_[_0x7413('0xd')](_0x26dafe,function(_0x56a06a){return _0x56a06a['resourceId'];});}}_0x2036b6(_0x568d1f);})[_0x7413('0xb')](function(_0x599654){_0x3230d8(_0x599654);});});}function _0x1585ba(_0x372944,_0x3b0c81){var _0x2fc0f4={'parentSections':[]};switch(_0x372944[_0x7413('0x12')]()){case _0x7413('0x13'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x15');break;case _0x7413('0x16'):_0x2fc0f4['childModel']='SquareOdbc';break;case _0x7413('0x17'):_0x2fc0f4['childModel']=_0x7413('0x18');_0x2fc0f4[_0x7413('0x19')]=[{'name':_0x7413('0x1a'),'field':'name','foreignKey':_0x7413('0x1b')}];break;case _0x7413('0x1c'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x1d');break;case _0x7413('0x1e'):_0x2fc0f4[_0x7413('0x14')]='CmContact';_0x2fc0f4[_0x7413('0x19')]=[{'name':'Lists','field':'id','foreignKey':_0x7413('0x1f')}];break;case _0x7413('0x20'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x21');break;case _0x7413('0x22'):_0x2fc0f4[_0x7413('0x14')]='CmCompany';break;case _0x7413('0x23'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x24');break;case _0x7413('0x25'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x26');break;case _0x7413('0x27'):_0x2fc0f4['childModel']=_0x7413('0x28');break;case _0x7413('0x29'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x2a');break;case _0x7413('0x2b'):_0x2fc0f4['childModel']=_0x7413('0x2c');break;case'inboundroutes':case _0x7413('0x2d'):case _0x7413('0x2e'):_0x2fc0f4[_0x7413('0x14')]='VoiceExtension';break;case _0x7413('0x2f'):_0x2fc0f4['childModel']=_0x7413('0x30');break;case _0x7413('0x31'):_0x2fc0f4['childModel']='VoiceMail';break;case _0x7413('0x32'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x33');_0x2fc0f4['parentSections']=[{'name':'Agents','field':_0x7413('0x34'),'foreignKey':'membername','model':'User','filter':{'field':_0x7413('0x35'),'value':['agent']}},{'name':_0x7413('0x36'),'field':_0x7413('0x34'),'foreignKey':_0x7413('0x37'),'model':_0x7413('0x38'),'filter':{'field':_0x7413('0x35'),'value':['telephone']}},{'name':_0x7413('0x39'),'field':_0x7413('0x34'),'foreignKey':_0x7413('0x3a'),'model':_0x7413('0x3b'),'filter':{'field':_0x7413('0x11'),'value':[_0x7413('0x3c')]}},{'name':_0x7413('0x3d'),'field':_0x7413('0x34'),'foreignKey':_0x7413('0x3a'),'model':_0x7413('0x3b'),'filter':{'field':_0x7413('0x11'),'value':[_0x7413('0x3e')]}}];break;case'musiconholds':_0x2fc0f4[_0x7413('0x14')]='VoiceMusicOnHold';break;case'chanspies':_0x2fc0f4['childModel']='VoiceChanSpy';break;case'voiceprefixes':_0x2fc0f4[_0x7413('0x14')]='VoicePrefix';break;case'ivrcampaigns':_0x2fc0f4[_0x7413('0x14')]='Campaign';break;case'mailqueues':_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x3f');break;case _0x7413('0x40'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x41');break;case'mailsubstatuses':_0x2fc0f4[_0x7413('0x14')]='MailSubstatus';break;case _0x7413('0x42'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x43');break;case _0x7413('0x44'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x45');break;case _0x7413('0x46'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x47');break;case _0x7413('0x48'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x49');break;case _0x7413('0x4a'):_0x2fc0f4['childModel']=_0x7413('0x4b');break;case _0x7413('0x4c'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x4d');break;case _0x7413('0x4e'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x4f');break;case _0x7413('0x50'):case _0x7413('0x51'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x3b');if(_0x3b0c81){_0x2fc0f4['parentSections']=[{'name':_0x7413('0x39')},{'name':'QueueCampaigns'}];}break;case _0x7413('0x52'):case _0x7413('0x53'):case _0x7413('0x54'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x38');if(_0x3b0c81){_0x2fc0f4[_0x7413('0x19')]=[{'name':_0x7413('0x55'),'filter':{'field':_0x7413('0x35'),'value':[_0x7413('0x56'),_0x7413('0x57')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0x7413('0x58'):_0x2fc0f4['childModel']='ZendeskAccount';break;case _0x7413('0x59'):_0x2fc0f4[_0x7413('0x14')]='SalesforceAccount';break;case _0x7413('0x5a'):_0x2fc0f4['childModel']='FreshdeskAccount';break;case _0x7413('0x5b'):_0x2fc0f4['childModel']=_0x7413('0x5c');break;case _0x7413('0x5d'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x5e');break;case _0x7413('0x5f'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x60');break;case _0x7413('0x61'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x38');break;case'cannedanswers':_0x2fc0f4[_0x7413('0x14')]='CannedAnswer';break;case'dispositions':_0x2fc0f4['childModel']=_0x7413('0x62');break;case _0x7413('0x63'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x64');break;case'intervals':_0x2fc0f4['childModel']=_0x7413('0x65');break;case'pauses':_0x2fc0f4[_0x7413('0x14')]='Pause';break;case'scheduler':_0x2fc0f4['childModel']='Schedule';break;case'sounds':_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x66');break;case _0x7413('0x67'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x68');break;case'templates':_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x69');break;case _0x7413('0x6a'):_0x2fc0f4['childModel']=_0x7413('0x6b');break;case'trunks':_0x2fc0f4['childModel']=_0x7413('0x6c');break;case _0x7413('0x6d'):_0x2fc0f4[_0x7413('0x14')]=_0x7413('0x6e');break;case _0x7413('0x6f'):_0x2fc0f4[_0x7413('0x14')]='Plugin';break;case _0x7413('0x70'):_0x2fc0f4['childModel']=_0x7413('0xf');_0x2fc0f4['parentSections']=[{'name':_0x7413('0x71'),'field':'id','foreignKey':'reportId'}];break;case _0x7413('0x72'):_0x2fc0f4[_0x7413('0x14')]='AnalyticMetric';break;}return _0x2fc0f4;}function _0x269976(_0x549623,_0xf01452){var _0x2a5db6=_0x549623['charAt'](0x0)[_0x7413('0x73')]()+_0x549623[_0x7413('0x74')](0x1);var _0x59d639={'type':_0x2e6df7[_0x7413('0x75')][_0x7413('0x76')]['SELECT'],'raw':!![]};return new Promise(function(_0xf4641,_0x28eaf4){var _0x34211b=squel[_0x7413('0x77')]()[_0x7413('0x7')](_0x7413('0x78')+_0x2a5db6+_0x7413('0x79'),'id')[_0x7413('0x7')]('ui.createdAt')[_0x7413('0x7a')]('user_has_'+_0x549623+_0x7413('0x7b'),'ui')[_0x7413('0x7c')](_0x7413('0x7d'),_0xf01452['id']);return _0x2e6df7[_0x7413('0x7e')]['query'](_0x34211b['toString'](),_0x59d639)['then'](function(_0x56b090){_0xf01452[_0x2a5db6+'OpenTabs']=_0x56b090;_0xf4641(_0x56b090);})[_0x7413('0xb')](function(_0x1c00e6){_0x28eaf4(_0x1c00e6);});});}return _0x410971[_0x7413('0x7f')]('UserProfile',attributes,{'tableName':_0x7413('0x80'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xb7dd83){var _0x12544d={'raw':![],'where':{}};var _0x36a3ff={};var _0xecf96b={'count':0x0,'rows':[]};var _0x3db284=_0xb7dd83[_0x7413('0x81')][_0x7413('0x82')];var _0x1ec131=_0xb7dd83[_0x7413('0x81')][_0x7413('0x83')]||![];var _0x1264f3=_0x1585ba(_0x3db284,_0x1ec131);if(!_0x1264f3[_0x7413('0x14')])throw new Error('Invalid\x20section\x20\x27'+_0x3db284+'\x27');var _0x25eafd=[{'name':_0x3db284}];if(!_[_0x7413('0x84')](_0x1264f3['parentSections']))_0x25eafd=_0x1264f3[_0x7413('0x19')];var _0x1e76f1=[];for(var _0x521682=0x0;_0x521682<_0x25eafd[_0x7413('0x85')];_0x521682++){_0x1e76f1[_0x7413('0x86')](_0x2e6df7[_0x7413('0x87')]['find']({'where':{'userProfileId':_0xb7dd83[_0x7413('0x88')]['id'],'name':_0x25eafd[_0x521682][_0x7413('0x34')]},'raw':!![]}));}return Promise['all'](_0x1e76f1)[_0x7413('0xc')](function(_0x4ffcbc){var _0x537458=_[_0x7413('0x6')](_0x4ffcbc,function(_0xbd74d9){return _0xbd74d9?_0xbd74d9:undefined;});var _0x167c6b=_[_0x7413('0x6')](_0x25eafd,[_0x7413('0x89'),!![]]);var _0x10333e=_[_0x7413('0x84')](_0x537458)&&_[_0x7413('0x84')](_0x167c6b)?null:_['union'](_0x167c6b,_0x537458);if(!_0x10333e)return null;var _0x437b5d=[];for(var _0x595da6=0x0;_0x595da6<_0x10333e[_0x7413('0x85')];_0x595da6++){var _0x3deb37=_[_0x7413('0x8a')](_0x25eafd,function(_0x3054f5){return _0x10333e[_0x595da6]?_0x3054f5[_0x7413('0x34')]===_0x10333e[_0x595da6][_0x7413('0x34')]:null;});if(_0x3deb37){if(_0x10333e[_0x595da6][_0x7413('0x89')]){_0x437b5d[_0x7413('0x86')](_0x258255(_0x1264f3[_0x7413('0x14')],_0x10333e[_0x595da6]));}else{if(!_0x10333e[_0x595da6]['autoAssociation']){_0x437b5d[_0x7413('0x86')](_0x4b9a5b(_0x3deb37,_0x10333e[_0x595da6],_0x1264f3[_0x7413('0x14')]));}else{if(_0x3deb37['model']){_0x437b5d[_0x7413('0x86')](_0x737ab4(_0x3deb37,_0x10333e[_0x595da6]));}}}}}return Promise[_0x7413('0x8b')](_0x437b5d);})['then'](function(_0x2be9b1){var _0x4b676a=_0x2be9b1;var _0xcbc6e=null;if(_0x4b676a){_0xcbc6e=_0x4b676a[_0x7413('0x85')]===0x1?_0x4b676a[0x0]:null;}if(!_0xcbc6e&&!_0x4b676a)return _0xecf96b;var _0x54f03d=_0x2e6df7[_0x1264f3['childModel']][_0x7413('0x8c')];_0x36a3ff[_0x7413('0x8d')]=_[_0x7413('0x8e')](_0x54f03d);_0x36a3ff['query']=_[_0x7413('0x8e')](_0xb7dd83[_0x7413('0x81')]);_0x36a3ff[_0x7413('0x8f')]=_[_0x7413('0x90')](_0x36a3ff[_0x7413('0x8d')],_0x36a3ff[_0x7413('0x81')]);_0x12544d['attributes']=_[_0x7413('0x90')](_0x36a3ff[_0x7413('0x8d')],qs[_0x7413('0x91')](_0xb7dd83['query'][_0x7413('0x91')]));_0x12544d[_0x7413('0x92')]=_0x12544d[_0x7413('0x92')][_0x7413('0x85')]?_0x12544d[_0x7413('0x92')]:_0x36a3ff[_0x7413('0x8d')];if(!_0xb7dd83[_0x7413('0x81')][_0x7413('0x93')](_0x7413('0x94'))){_0x12544d['limit']=qs[_0x7413('0x95')](_0xb7dd83[_0x7413('0x81')][_0x7413('0x95')]);_0x12544d[_0x7413('0x96')]=qs[_0x7413('0x96')](_0xb7dd83[_0x7413('0x81')]['offset']);}_0x12544d[_0x7413('0x97')]=qs['sort'](_0xb7dd83['query'][_0x7413('0x98')]);_0x12544d[_0x7413('0x7c')]=qs['filters'](_[_0x7413('0x99')](_0xb7dd83[_0x7413('0x81')],_0x36a3ff[_0x7413('0x8f')]));if(_0xb7dd83[_0x7413('0x81')][_0x7413('0x6')]){_0x12544d[_0x7413('0x7c')]=_[_0x7413('0x9a')](_0x12544d[_0x7413('0x7c')],{'$or':_['map'](_0x54f03d,function(_0xe4b4a4){if(_0xe4b4a4['type'][_0x7413('0x9b')]!==_0x7413('0x9c')){var _0x516030={};_0x516030[_0xe4b4a4[_0x7413('0x7')]]={'$like':'%'+_0xb7dd83[_0x7413('0x81')][_0x7413('0x6')]+'%'};return _0x516030;}})});}var _0x300a17=[];var _0xdf132c=null;var _0x3920b5={};if(_0xcbc6e){_0xdf132c=_[_0x7413('0x8a')](_0x25eafd,[_0x7413('0x34'),_0xcbc6e[_0x7413('0x34')]]);if(_0xdf132c[_0x7413('0x7')]){_0x3920b5={};if(_0x1264f3['childModel']===_0x7413('0xf')){_0x3920b5[_0xdf132c[_0x7413('0x9d')]]=_['map'](_0xcbc6e['associatedResources'],'id');}else{_0x3920b5[_0xdf132c['foreignKey']]=_0xcbc6e[_0x7413('0xa')];}_0x300a17['push'](_0x3920b5);}else{_0x12544d[_0x7413('0x7c')]['id']=_0xcbc6e[_0x7413('0xa')];}}else{for(var _0x121b1a=0x0;_0x121b1a<_0x4b676a[_0x7413('0x85')];_0x121b1a++){_0xdf132c=_[_0x7413('0x8a')](_0x25eafd,[_0x7413('0x34'),_0x4b676a[_0x121b1a][_0x7413('0x34')]]);if(_0xdf132c[_0x7413('0x7')]){_0x3920b5={};_0x3920b5[_0xdf132c[_0x7413('0x9d')]]=_0x4b676a[_0x121b1a]['associatedResources'];_0x300a17[_0x7413('0x86')](_0x3920b5);}else{if(!_0x12544d[_0x7413('0x7c')]['id'])_0x12544d[_0x7413('0x7c')]['id']=[];_0x4b676a[_0x121b1a]['associatedResources'][_0x7413('0x9e')](function(_0x3c3676){_0x12544d[_0x7413('0x7c')]['id'][_0x7413('0x86')](_0x3c3676);});}}}if(!_[_0x7413('0x84')](_0x300a17)){_0x12544d[_0x7413('0x7c')]=_[_0x7413('0x9a')](_0x12544d[_0x7413('0x7c')],{'$and':{'$or':_0x300a17}});}_0x12544d=_[_0x7413('0x9a')]({},_0x12544d,_0xb7dd83[_0x7413('0x9f')]);if(_0xcbc6e&&!_0xcbc6e['autoAssociation']&&_0x1264f3[_0x7413('0x14')]===_0x7413('0xf')){if(_0xb7dd83['query'][_0x7413('0xa0')]){_0x12544d[_0x7413('0xa1')]=[{'all':!![]}];}return _0x2e6df7[_0x1264f3['childModel']][_0x7413('0x9')](_0x12544d)[_0x7413('0xc')](function(_0x230191){var _0x47fbf0=[];_0x230191[_0x7413('0x9e')](function(_0x5a44bd){var _0x466ec8;switch(_0x5a44bd[_0x7413('0xa2')]){case _0x7413('0xa3'):_0x466ec8=_[_0x7413('0x8a')](_0xcbc6e[_0x7413('0xa')],function(_0x371464){return _0x371464['id']===_0x5a44bd['reportId']&&_0x371464[_0x7413('0x11')]===_0x7413('0xa4');});break;case _0x7413('0xa5'):_0x466ec8=_[_0x7413('0x8a')](_0xcbc6e[_0x7413('0xa')],function(_0x55059e){return _0x55059e['id']===_0x5a44bd[_0x7413('0xa6')]&&_0x55059e[_0x7413('0x11')]===_0x7413('0xa7');});break;}if(_0x466ec8)_0x47fbf0[_0x7413('0x86')](_0x5a44bd);});_0xecf96b[_0x7413('0xa8')]=_0x47fbf0['length'];_0xecf96b['rows']=_0x47fbf0;return _0xecf96b;});}else{return _0x2e6df7[_0x1264f3[_0x7413('0x14')]][_0x7413('0xa8')]({'where':_0x12544d[_0x7413('0x7c')]})[_0x7413('0xc')](function(_0x4ec202){_0xecf96b['count']=_0x4ec202;if(_0xb7dd83[_0x7413('0x81')][_0x7413('0xa0')]){if(_0x1264f3[_0x7413('0x14')]==='CmContact'){_0x12544d['include']=[{'model':_0x2e6df7[_0x7413('0x68')],'as':_0x7413('0xa9'),'attributes':['id',_0x7413('0x34'),_0x7413('0xaa')],'required':_0xb7dd83[_0x7413('0x81')][_0x7413('0xab')]?!![]:![]},{'model':_0x2e6df7[_0x7413('0x68')],'as':'ThroughTags','attributes':['id','name',_0x7413('0xaa')],'through':_0xb7dd83[_0x7413('0x81')]['tag']?{'attributes':[],'where':{'TagId':_0xb7dd83[_0x7413('0x81')][_0x7413('0xab')]||undefined}}:{},'required':_0xb7dd83[_0x7413('0x81')][_0x7413('0xab')]?!![]:![]}];}else{_0x12544d[_0x7413('0xa1')]=[{'all':!![]}];}}return _0x2e6df7[_0x1264f3[_0x7413('0x14')]][_0x7413('0x9')](_0x12544d);})[_0x7413('0xc')](function(_0x3cffbb){_0xecf96b['rows']=_0x3cffbb;if(_0x3db284===_0x7413('0xac')&&_0xb7dd83[_0x7413('0x81')][_0x7413('0xad')]===_0x7413('0xae')){var _0xccd480=[];for(var _0x20ffaf=0x0;_0x20ffaf<_0xecf96b['rows']['length'];_0x20ffaf++){_0xccd480['push'](_0x269976(_0x7413('0xaf'),_0xecf96b[_0x7413('0xb0')][_0x20ffaf][_0x7413('0xb1')]));_0xccd480[_0x7413('0x86')](_0x269976(_0x7413('0xb2'),_0xecf96b[_0x7413('0xb0')][_0x20ffaf][_0x7413('0xb1')]));_0xccd480[_0x7413('0x86')](_0x269976('fax',_0xecf96b[_0x7413('0xb0')][_0x20ffaf]['dataValues']));_0xccd480[_0x7413('0x86')](_0x269976(_0x7413('0xb3'),_0xecf96b[_0x7413('0xb0')][_0x20ffaf][_0x7413('0xb1')]));_0xccd480[_0x7413('0x86')](_0x269976('openchannel',_0xecf96b[_0x7413('0xb0')][_0x20ffaf][_0x7413('0xb1')]));_0xccd480[_0x7413('0x86')](_0x269976(_0x7413('0xb4'),_0xecf96b[_0x7413('0xb0')][_0x20ffaf][_0x7413('0xb1')]));}return Promise[_0x7413('0x8b')](_0xccd480)[_0x7413('0xc')](function(){return _0xecf96b;});}return _0xecf96b;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 02d03dd..9abc02a 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 _0x9e2e=['info','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then'];(function(_0x3c4dad,_0x25ffd5){var _0x1a4f49=function(_0x6fe6c){while(--_0x6fe6c){_0x3c4dad['push'](_0x3c4dad['shift']());}};_0x1a4f49(++_0x25ffd5);}(_0x9e2e,0xd6));var _0xe9e2=function(_0x287537,_0x8e1eaf){_0x287537=_0x287537-0x0;var _0x390a32=_0x9e2e[_0x287537];return _0x390a32;};'use strict';var _=require(_0xe9e2('0x0'));var util=require(_0xe9e2('0x1'));var moment=require(_0xe9e2('0x2'));var BPromise=require('bluebird');var rs=require(_0xe9e2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9e2('0x4'));var logger=require(_0xe9e2('0x5'))(_0xe9e2('0x6'));var config=require(_0xe9e2('0x7'));var jayson=require(_0xe9e2('0x8'));var client=jayson[_0xe9e2('0x9')][_0xe9e2('0xa')]({'port':0x232a});config['redis']=_[_0xe9e2('0xb')](config['redis'],{'host':_0xe9e2('0xc'),'port':0x18eb});var socket=require(_0xe9e2('0xd'))(new Redis(config['redis']));require(_0xe9e2('0xe'))[_0xe9e2('0xf')](socket);function respondWithRpcPromise(_0x5d065f,_0x20a3e9,_0xe1c4d3){return new BPromise(function(_0x56264f,_0x53e3c5){return client[_0xe9e2('0x10')](_0x5d065f,_0xe1c4d3)[_0xe9e2('0x11')](function(_0x2e02c8){logger[_0xe9e2('0x12')]('UserProfile,\x20%s,\x20%s',_0x20a3e9,'request\x20sent');logger[_0xe9e2('0x13')](_0xe9e2('0x14'),_0x20a3e9,_0xe9e2('0x15'),JSON[_0xe9e2('0x16')](_0x2e02c8));if(_0x2e02c8[_0xe9e2('0x17')]){if(_0x2e02c8[_0xe9e2('0x17')][_0xe9e2('0x18')]===0x1f4){logger[_0xe9e2('0x17')](_0xe9e2('0x19'),_0x20a3e9,_0x2e02c8[_0xe9e2('0x17')]['message']);return _0x53e3c5(_0x2e02c8['error'][_0xe9e2('0x1a')]);}logger['error']('UserProfile,\x20%s,\x20%s',_0x20a3e9,_0x2e02c8[_0xe9e2('0x17')][_0xe9e2('0x1a')]);return _0x56264f(_0x2e02c8[_0xe9e2('0x17')][_0xe9e2('0x1a')]);}else{logger[_0xe9e2('0x12')](_0xe9e2('0x19'),_0x20a3e9,'request\x20sent');_0x56264f(_0x2e02c8[_0xe9e2('0x1b')][_0xe9e2('0x1a')]);}})[_0xe9e2('0x1c')](function(_0x5b804f){logger[_0xe9e2('0x17')](_0xe9e2('0x19'),_0x20a3e9,_0x5b804f);_0x53e3c5(_0x5b804f);});});} \ No newline at end of file +var _0x7af9=['rpc','http','redis','defaults','socket.io-emitter','./userProfile.socket','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x271d5f,_0x1a0b3f){var _0x113c3f=function(_0x270a04){while(--_0x270a04){_0x271d5f['push'](_0x271d5f['shift']());}};_0x113c3f(++_0x1a0b3f);}(_0x7af9,0x95));var _0x97af=function(_0x26828b,_0x4858a3){_0x26828b=_0x26828b-0x0;var _0x5a3122=_0x7af9[_0x26828b];return _0x5a3122;};'use strict';var _=require(_0x97af('0x0'));var util=require('util');var moment=require(_0x97af('0x1'));var BPromise=require(_0x97af('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x97af('0x3'));var db=require(_0x97af('0x4'))['db'];var utils=require(_0x97af('0x5'));var logger=require(_0x97af('0x6'))(_0x97af('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x97af('0x8')]({'port':0x232a});config[_0x97af('0x9')]=_[_0x97af('0xa')](config[_0x97af('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x97af('0xb'))(new Redis(config[_0x97af('0x9')]));require(_0x97af('0xc'))['register'](socket);function respondWithRpcPromise(_0x175bbc,_0x5cd1e0,_0x46ac08){return new BPromise(function(_0x19ad23,_0x18a9e5){return client[_0x97af('0xd')](_0x175bbc,_0x46ac08)[_0x97af('0xe')](function(_0x3cc156){logger[_0x97af('0xf')](_0x97af('0x10'),_0x5cd1e0,_0x97af('0x11'));logger[_0x97af('0x12')](_0x97af('0x13'),_0x5cd1e0,'request\x20sent',JSON[_0x97af('0x14')](_0x3cc156));if(_0x3cc156['error']){if(_0x3cc156['error'][_0x97af('0x15')]===0x1f4){logger[_0x97af('0x16')](_0x97af('0x10'),_0x5cd1e0,_0x3cc156[_0x97af('0x16')][_0x97af('0x17')]);return _0x18a9e5(_0x3cc156[_0x97af('0x16')][_0x97af('0x17')]);}logger['error'](_0x97af('0x10'),_0x5cd1e0,_0x3cc156['error'][_0x97af('0x17')]);return _0x19ad23(_0x3cc156['error'][_0x97af('0x17')]);}else{logger['info'](_0x97af('0x10'),_0x5cd1e0,_0x97af('0x11'));_0x19ad23(_0x3cc156[_0x97af('0x18')][_0x97af('0x17')]);}})[_0x97af('0x19')](function(_0x5ad2bc){logger[_0x97af('0x16')](_0x97af('0x10'),_0x5cd1e0,_0x5ad2bc);_0x18a9e5(_0x5ad2bc);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index d09a5b9..b7d2e60 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 _0x6673=['update','emit','removeListener','register','length','userProfile:'];(function(_0x1fb44c,_0x14eba9){var _0x5b6e22=function(_0x349de4){while(--_0x349de4){_0x1fb44c['push'](_0x1fb44c['shift']());}};_0x5b6e22(++_0x14eba9);}(_0x6673,0x13e));var _0x3667=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x6673[_0x58dc25];return _0x21b0a7;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save','remove',_0x3667('0x0')];function createListener(_0x3229c3,_0x4c2f43){return function(_0x1afbea){_0x4c2f43[_0x3667('0x1')](_0x3229c3,_0x1afbea);};}function removeListener(_0x1f25cd,_0x801808){return function(){UserProfileEvents[_0x3667('0x2')](_0x1f25cd,_0x801808);};}exports[_0x3667('0x3')]=function(_0x10da22){for(var _0x6934fb=0x0,_0x404fe9=events[_0x3667('0x4')];_0x6934fb<_0x404fe9;_0x6934fb++){var _0x565dfe=events[_0x6934fb];var _0x158c17=createListener(_0x3667('0x5')+_0x565dfe,_0x10da22);UserProfileEvents['on'](_0x565dfe,_0x158c17);}}; \ No newline at end of file +var _0x6cc4=['register','./userProfile.events','save','remove','update','removeListener'];(function(_0x358f5b,_0x3a104b){var _0x414052=function(_0x17e601){while(--_0x17e601){_0x358f5b['push'](_0x358f5b['shift']());}};_0x414052(++_0x3a104b);}(_0x6cc4,0x1e1));var _0x46cc=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x6cc4[_0x502c7d];return _0x30b7ed;};'use strict';var UserProfileEvents=require(_0x46cc('0x0'));var events=[_0x46cc('0x1'),_0x46cc('0x2'),_0x46cc('0x3')];function createListener(_0x3cd20b,_0x544359){return function(_0x336742){_0x544359['emit'](_0x3cd20b,_0x336742);};}function removeListener(_0x25fbd0,_0x59b2df){return function(){UserProfileEvents[_0x46cc('0x4')](_0x25fbd0,_0x59b2df);};}exports[_0x46cc('0x5')]=function(_0x376b7b){for(var _0x66418c=0x0,_0x448b13=events['length'];_0x66418c<_0x448b13;_0x66418c++){var _0x4a48c8=events[_0x66418c];var _0x2413de=createListener('userProfile:'+_0x4a48c8,_0x376b7b);UserProfileEvents['on'](_0x4a48c8,_0x2413de);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 7ed3d28..cefdb31 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 _0x46bf=['Router','../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x3ead90,_0x28fe97){var _0xa464f0=function(_0x4d91f3){while(--_0x4d91f3){_0x3ead90['push'](_0x3ead90['shift']());}};_0xa464f0(++_0x28fe97);}(_0x46bf,0xb0));var _0xf46b=function(_0x4d934b,_0x52f8e9){_0x4d934b=_0x4d934b-0x0;var _0xc0338b=_0x46bf[_0x4d934b];return _0xc0338b;};'use strict';var multer=require('multer');var util=require(_0xf46b('0x0'));var path=require(_0xf46b('0x1'));var timeout=require(_0xf46b('0x2'));var express=require(_0xf46b('0x3'));var router=express[_0xf46b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf46b('0x5'));var config=require(_0xf46b('0x6'));var controller=require(_0xf46b('0x7'));router['get']('/',auth[_0xf46b('0x8')](),controller['index']);router[_0xf46b('0x9')](_0xf46b('0xa'),auth[_0xf46b('0x8')](),controller[_0xf46b('0xb')]);router['get'](_0xf46b('0xc'),auth[_0xf46b('0x8')](),controller[_0xf46b('0xd')]);router[_0xf46b('0xe')]('/',auth['isAuthenticated'](),controller[_0xf46b('0xf')]);router[_0xf46b('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf46b('0x11')](_0xf46b('0xc'),auth[_0xf46b('0x8')](),controller[_0xf46b('0x12')]);module[_0xf46b('0x13')]=router; \ No newline at end of file +var _0x5d5b=['/describe','isAuthenticated','describe','post','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','index'];(function(_0x521037,_0x36876c){var _0x30cfd5=function(_0x9b3d83){while(--_0x9b3d83){_0x521037['push'](_0x521037['shift']());}};_0x30cfd5(++_0x36876c);}(_0x5d5b,0x194));var _0xb5d5=function(_0x1fe273,_0x29d3c8){_0x1fe273=_0x1fe273-0x0;var _0x6ddc7c=_0x5d5b[_0x1fe273];return _0x6ddc7c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb5d5('0x0'));var timeout=require('connect-timeout');var express=require(_0xb5d5('0x1'));var router=express[_0xb5d5('0x2')]();var fs_extra=require(_0xb5d5('0x3'));var auth=require(_0xb5d5('0x4'));var interaction=require(_0xb5d5('0x5'));var config=require(_0xb5d5('0x6'));var controller=require(_0xb5d5('0x7'));router[_0xb5d5('0x8')]('/',auth['isAuthenticated'](),controller[_0xb5d5('0x9')]);router['get'](_0xb5d5('0xa'),auth[_0xb5d5('0xb')](),controller[_0xb5d5('0xc')]);router[_0xb5d5('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb5d5('0xd')]('/',auth[_0xb5d5('0xb')](),controller['create']);router['put']('/:id',auth[_0xb5d5('0xb')](),controller[_0xb5d5('0xe')]);router[_0xb5d5('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xb5d5('0x10')]);module[_0xb5d5('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index a11b979..e18f1a4 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 _0xe8b7=['STRING','INTEGER','exports'];(function(_0xbad322,_0x3e6b0b){var _0x2101cb=function(_0x1c3c3b){while(--_0x1c3c3b){_0xbad322['push'](_0xbad322['shift']());}};_0x2101cb(++_0x3e6b0b);}(_0xe8b7,0x7d));var _0x7e8b=function(_0x366571,_0x363442){_0x366571=_0x366571-0x0;var _0x256047=_0xe8b7[_0x366571];return _0x256047;};'use strict';var Sequelize=require('sequelize');module[_0x7e8b('0x0')]={'name':{'type':Sequelize[_0x7e8b('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x7e8b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7e8b('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xc4f7=['STRING','INTEGER'];(function(_0x5222a7,_0x3475b3){var _0x45a3e8=function(_0x303e2a){while(--_0x303e2a){_0x5222a7['push'](_0x5222a7['shift']());}};_0x45a3e8(++_0x3475b3);}(_0xc4f7,0xda));var _0x7c4f=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xc4f7[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7c4f('0x0')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x7c4f('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x7c4f('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 8557168..01e0594 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 _0xc1c6=['filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','UserProfileResource','rawAttributes','type','key','model','query'];(function(_0x577f77,_0x38c76c){var _0x58d336=function(_0x268988){while(--_0x268988){_0x577f77['push'](_0x577f77['shift']());}};_0x58d336(++_0x38c76c);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x3aad56,_0x4cd3df){_0x3aad56=_0x3aad56-0x0;var _0x46ec38=_0xc1c6[_0x3aad56];return _0x46ec38;};'use strict';var emlformat=require(_0x6c1c('0x0'));var rimraf=require(_0x6c1c('0x1'));var zipdir=require(_0x6c1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c1c('0x3'));var moment=require('moment');var BPromise=require(_0x6c1c('0x4'));var Mustache=require(_0x6c1c('0x5'));var util=require(_0x6c1c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c1c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c1c('0x8'));var _=require('lodash');var squel=require(_0x6c1c('0x9'));var crypto=require(_0x6c1c('0xa'));var jsforce=require(_0x6c1c('0xb'));var deskjs=require(_0x6c1c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c1c('0xd'));var Papa=require(_0x6c1c('0xe'));var Redis=require('ioredis');var authService=require(_0x6c1c('0xf'));var qs=require(_0x6c1c('0x10'));var as=require(_0x6c1c('0x11'));var hardwareService=require(_0x6c1c('0x12'));var logger=require('../../config/logger')(_0x6c1c('0x13'));var utils=require(_0x6c1c('0x14'));var config=require(_0x6c1c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1c('0x16'))['db'];function respondWithStatusCode(_0x12a9e6,_0x2067bd){_0x2067bd=_0x2067bd||0xcc;return function(_0x49304f){if(_0x49304f){return _0x12a9e6[_0x6c1c('0x17')](_0x2067bd);}return _0x12a9e6['status'](_0x2067bd)[_0x6c1c('0x18')]();};}function respondWithResult(_0x15a1fc,_0x2d279e){_0x2d279e=_0x2d279e||0xc8;return function(_0x154107){if(_0x154107){return _0x15a1fc[_0x6c1c('0x19')](_0x2d279e)[_0x6c1c('0x1a')](_0x154107);}};}function respondWithFilteredResult(_0x297c33,_0x41aa74){return function(_0x448f35){if(_0x448f35){var _0x5f3758=typeof _0x41aa74[_0x6c1c('0x1b')]===_0x6c1c('0x1c')&&typeof _0x41aa74['limit']===_0x6c1c('0x1c');var _0x237cac=_0x448f35['count'];var _0x137770=_0x5f3758?0x0:_0x41aa74['offset'];var _0x338dc2=_0x5f3758?_0x448f35[_0x6c1c('0x1d')]:_0x41aa74['offset']+_0x41aa74[_0x6c1c('0x1e')];var _0x59ab38;if(_0x338dc2>=_0x237cac){_0x338dc2=_0x237cac;_0x59ab38=0xc8;}else{_0x59ab38=0xce;}_0x297c33[_0x6c1c('0x19')](_0x59ab38);return _0x297c33[_0x6c1c('0x1f')](_0x6c1c('0x20'),_0x137770+'-'+_0x338dc2+'/'+_0x237cac)[_0x6c1c('0x1a')](_0x448f35);}return null;};}function patchUpdates(_0x1acf7f){return function(_0x1efb19){try{jsonpatch[_0x6c1c('0x21')](_0x1efb19,_0x1acf7f,!![]);}catch(_0x2ed830){return BPromise[_0x6c1c('0x22')](_0x2ed830);}return _0x1efb19[_0x6c1c('0x23')]();};}function saveUpdates(_0x3d2bf3,_0x450b1f){return function(_0x2382c0){if(_0x2382c0){return _0x2382c0[_0x6c1c('0x24')](_0x3d2bf3)[_0x6c1c('0x25')](function(_0x19c269){return _0x19c269;});}return null;};}function removeEntity(_0x2319d3,_0x12c638){return function(_0x3a3f13){if(_0x3a3f13){return _0x3a3f13[_0x6c1c('0x26')]()[_0x6c1c('0x25')](function(){_0x2319d3[_0x6c1c('0x19')](0xcc)[_0x6c1c('0x18')]();});}};}function handleEntityNotFound(_0x7ff10d,_0x18452d){return function(_0x80bc05){if(!_0x80bc05){_0x7ff10d[_0x6c1c('0x17')](0x194);}return _0x80bc05;};}function handleError(_0x1b9d7d,_0x2feaf4){_0x2feaf4=_0x2feaf4||0x1f4;return function(_0x5f4568){logger[_0x6c1c('0x27')](_0x5f4568['stack']);if(_0x5f4568[_0x6c1c('0x28')]){delete _0x5f4568['name'];}_0x1b9d7d[_0x6c1c('0x19')](_0x2feaf4)['send'](_0x5f4568);};}exports[_0x6c1c('0x29')]=function(_0xf557ba,_0x504348){var _0x3b1a4f={},_0x24da4c={},_0x4e13e3={'count':0x0,'rows':[]};var _0x3b319a=_[_0x6c1c('0x2a')](db[_0x6c1c('0x2b')][_0x6c1c('0x2c')],function(_0x4fc279){return{'name':_0x4fc279['fieldName'],'type':_0x4fc279[_0x6c1c('0x2d')][_0x6c1c('0x2e')]};});_0x24da4c[_0x6c1c('0x2f')]=_[_0x6c1c('0x2a')](_0x3b319a,_0x6c1c('0x28'));_0x24da4c[_0x6c1c('0x30')]=_['keys'](_0xf557ba[_0x6c1c('0x30')]);_0x24da4c[_0x6c1c('0x31')]=_['intersection'](_0x24da4c[_0x6c1c('0x2f')],_0x24da4c[_0x6c1c('0x30')]);_0x3b1a4f[_0x6c1c('0x32')]=_[_0x6c1c('0x33')](_0x24da4c['model'],qs[_0x6c1c('0x34')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x3b1a4f['attributes']=_0x3b1a4f[_0x6c1c('0x32')]['length']?_0x3b1a4f[_0x6c1c('0x32')]:_0x24da4c['model'];if(!_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x35')](_0x6c1c('0x36'))){_0x3b1a4f['limit']=qs['limit'](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x1e')]);_0x3b1a4f[_0x6c1c('0x1b')]=qs['offset'](_0xf557ba[_0x6c1c('0x30')]['offset']);}_0x3b1a4f['order']=qs[_0x6c1c('0x37')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x37')]);_0x3b1a4f[_0x6c1c('0x38')]=qs['filters'](_[_0x6c1c('0x39')](_0xf557ba[_0x6c1c('0x30')],_0x24da4c[_0x6c1c('0x31')]),_0x3b319a);if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]){_0x3b1a4f[_0x6c1c('0x38')]=_[_0x6c1c('0x3b')](_0x3b1a4f[_0x6c1c('0x38')],{'$or':_[_0x6c1c('0x2a')](_0x3b319a,function(_0x232508){if(_0x232508['type']!==_0x6c1c('0x3c')){var _0x464549={};_0x464549[_0x232508[_0x6c1c('0x28')]]={'$like':'%'+_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]+'%'};return _0x464549;}})});}_0x3b1a4f=_['merge']({},_0x3b1a4f,_0xf557ba['options']);var _0x549db1={'where':_0x3b1a4f[_0x6c1c('0x38')]};return db['UserProfileResource']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['UserProfileResource'][_0x6c1c('0x3f')](_0x3b1a4f);})[_0x6c1c('0x25')](function(_0x502e75){_0x4e13e3[_0x6c1c('0x40')]=_0x502e75;return _0x4e13e3;})['then'](respondWithFilteredResult(_0x504348,_0x3b1a4f))[_0x6c1c('0x41')](handleError(_0x504348,null));};exports[_0x6c1c('0x42')]=function(_0x16a389,_0x174f2c){var _0x10764a={'raw':![],'where':{'id':_0x16a389[_0x6c1c('0x43')]['id']}},_0x595ba2={};_0x595ba2[_0x6c1c('0x2f')]=_[_0x6c1c('0x44')](db['UserProfileResource'][_0x6c1c('0x2c')]);_0x595ba2[_0x6c1c('0x30')]=_[_0x6c1c('0x44')](_0x16a389[_0x6c1c('0x30')]);_0x595ba2[_0x6c1c('0x31')]=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],_0x595ba2['query']);_0x10764a['attributes']=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],qs[_0x6c1c('0x34')](_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x10764a[_0x6c1c('0x32')]=_0x10764a[_0x6c1c('0x32')][_0x6c1c('0x45')]?_0x10764a[_0x6c1c('0x32')]:_0x595ba2['model'];if(_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x10764a['include']=[{'all':!![]}];}_0x10764a=_[_0x6c1c('0x3b')]({},_0x10764a,_0x16a389['options']);return db[_0x6c1c('0x2b')][_0x6c1c('0x46')](_0x10764a)[_0x6c1c('0x25')](handleEntityNotFound(_0x174f2c,null))[_0x6c1c('0x25')](respondWithResult(_0x174f2c,null))[_0x6c1c('0x41')](handleError(_0x174f2c,null));};exports['create']=function(_0x1fe6e8,_0x58d075){return db[_0x6c1c('0x2b')][_0x6c1c('0x47')](_0x1fe6e8[_0x6c1c('0x48')],{})[_0x6c1c('0x25')](respondWithResult(_0x58d075,0xc9))[_0x6c1c('0x41')](handleError(_0x58d075,null));};exports[_0x6c1c('0x24')]=function(_0x52c14d,_0xa9889a){if(_0x52c14d[_0x6c1c('0x48')]['id']){delete _0x52c14d['body']['id'];}return db[_0x6c1c('0x2b')][_0x6c1c('0x46')]({'where':{'id':_0x52c14d[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0xa9889a,null))['then'](saveUpdates(_0x52c14d[_0x6c1c('0x48')],null))[_0x6c1c('0x25')](respondWithResult(_0xa9889a,null))[_0x6c1c('0x41')](handleError(_0xa9889a,null));};exports['destroy']=function(_0x5b8d69,_0x56b367){return db['UserProfileResource']['find']({'where':{'id':_0x5b8d69[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0x56b367,null))['then'](removeEntity(_0x56b367,null))[_0x6c1c('0x41')](handleError(_0x56b367,null));};exports[_0x6c1c('0x49')]=function(_0x2450ab,_0x5489ac){return db['UserProfileResource'][_0x6c1c('0x49')]()[_0x6c1c('0x25')](respondWithResult(_0x5489ac,null))['catch'](handleError(_0x5489ac,null));}; \ No newline at end of file +var _0x9536=['rawAttributes','intersection','length','options','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','error','stack','name','index','map','UserProfileResource','fieldName','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','params'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9536,0x179));var _0x6953=function(_0x5c14f6,_0x2979d8){_0x5c14f6=_0x5c14f6-0x0;var _0x4949b3=_0x9536[_0x5c14f6];return _0x4949b3;};'use strict';var emlformat=require(_0x6953('0x0'));var rimraf=require(_0x6953('0x1'));var zipdir=require(_0x6953('0x2'));var jsonpatch=require(_0x6953('0x3'));var rp=require('request-promise');var moment=require(_0x6953('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6953('0x5'));var util=require(_0x6953('0x6'));var path=require(_0x6953('0x7'));var sox=require(_0x6953('0x8'));var csv=require(_0x6953('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6953('0xa'));var _=require(_0x6953('0xb'));var squel=require(_0x6953('0xc'));var crypto=require(_0x6953('0xd'));var jsforce=require(_0x6953('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6953('0x9'));var querystring=require(_0x6953('0xf'));var Papa=require(_0x6953('0x10'));var Redis=require('ioredis');var authService=require(_0x6953('0x11'));var qs=require(_0x6953('0x12'));var as=require(_0x6953('0x13'));var hardwareService=require(_0x6953('0x14'));var logger=require(_0x6953('0x15'))(_0x6953('0x16'));var utils=require(_0x6953('0x17'));var config=require(_0x6953('0x18'));var licenseUtil=require(_0x6953('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358388,_0x513dd0){_0x513dd0=_0x513dd0||0xcc;return function(_0x8de91e){if(_0x8de91e){return _0x358388[_0x6953('0x1a')](_0x513dd0);}return _0x358388[_0x6953('0x1b')](_0x513dd0)[_0x6953('0x1c')]();};}function respondWithResult(_0x1b5221,_0x244713){_0x244713=_0x244713||0xc8;return function(_0x175fa9){if(_0x175fa9){return _0x1b5221[_0x6953('0x1b')](_0x244713)[_0x6953('0x1d')](_0x175fa9);}};}function respondWithFilteredResult(_0x31d182,_0xae5515){return function(_0x548473){if(_0x548473){var _0x5f49db=typeof _0xae5515[_0x6953('0x1e')]===_0x6953('0x1f')&&typeof _0xae5515[_0x6953('0x20')]===_0x6953('0x1f');var _0x510d46=_0x548473[_0x6953('0x21')];var _0x2da771=_0x5f49db?0x0:_0xae5515['offset'];var _0x10858a=_0x5f49db?_0x548473[_0x6953('0x21')]:_0xae5515[_0x6953('0x1e')]+_0xae5515[_0x6953('0x20')];var _0xc714d3;if(_0x10858a>=_0x510d46){_0x10858a=_0x510d46;_0xc714d3=0xc8;}else{_0xc714d3=0xce;}_0x31d182['status'](_0xc714d3);return _0x31d182[_0x6953('0x22')](_0x6953('0x23'),_0x2da771+'-'+_0x10858a+'/'+_0x510d46)[_0x6953('0x1d')](_0x548473);}return null;};}function patchUpdates(_0x2ba433){return function(_0x41f021){try{jsonpatch['apply'](_0x41f021,_0x2ba433,!![]);}catch(_0xf96d07){return BPromise[_0x6953('0x24')](_0xf96d07);}return _0x41f021['save']();};}function saveUpdates(_0x317979,_0x40c9d1){return function(_0xb92529){if(_0xb92529){return _0xb92529[_0x6953('0x25')](_0x317979)['then'](function(_0x37f339){return _0x37f339;});}return null;};}function removeEntity(_0x231cb2,_0x2a7f6a){return function(_0x508ea7){if(_0x508ea7){return _0x508ea7['destroy']()['then'](function(){_0x231cb2[_0x6953('0x1b')](0xcc)[_0x6953('0x1c')]();});}};}function handleEntityNotFound(_0x550be4,_0x1a32f4){return function(_0x587df0){if(!_0x587df0){_0x550be4[_0x6953('0x1a')](0x194);}return _0x587df0;};}function handleError(_0x2bf39b,_0xcdbce8){_0xcdbce8=_0xcdbce8||0x1f4;return function(_0x2cc01e){logger[_0x6953('0x26')](_0x2cc01e[_0x6953('0x27')]);if(_0x2cc01e['name']){delete _0x2cc01e[_0x6953('0x28')];}_0x2bf39b[_0x6953('0x1b')](_0xcdbce8)['send'](_0x2cc01e);};}exports[_0x6953('0x29')]=function(_0x4af39d,_0x173b3c){var _0x3b1175={},_0x426c7c={},_0x4b0325={'count':0x0,'rows':[]};var _0x131992=_[_0x6953('0x2a')](db[_0x6953('0x2b')]['rawAttributes'],function(_0x4c49fc){return{'name':_0x4c49fc[_0x6953('0x2c')],'type':_0x4c49fc['type']['key']};});_0x426c7c[_0x6953('0x2d')]=_[_0x6953('0x2a')](_0x131992,_0x6953('0x28'));_0x426c7c[_0x6953('0x2e')]=_[_0x6953('0x2f')](_0x4af39d['query']);_0x426c7c[_0x6953('0x30')]=_['intersection'](_0x426c7c[_0x6953('0x2d')],_0x426c7c[_0x6953('0x2e')]);_0x3b1175['attributes']=_['intersection'](_0x426c7c[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x4af39d[_0x6953('0x2e')]['fields']));_0x3b1175[_0x6953('0x32')]=_0x3b1175['attributes']['length']?_0x3b1175['attributes']:_0x426c7c['model'];if(!_0x4af39d[_0x6953('0x2e')][_0x6953('0x33')](_0x6953('0x34'))){_0x3b1175[_0x6953('0x20')]=qs[_0x6953('0x20')](_0x4af39d[_0x6953('0x2e')]['limit']);_0x3b1175[_0x6953('0x1e')]=qs['offset'](_0x4af39d[_0x6953('0x2e')]['offset']);}_0x3b1175[_0x6953('0x35')]=qs[_0x6953('0x36')](_0x4af39d[_0x6953('0x2e')][_0x6953('0x36')]);_0x3b1175['where']=qs[_0x6953('0x30')](_[_0x6953('0x37')](_0x4af39d[_0x6953('0x2e')],_0x426c7c[_0x6953('0x30')]),_0x131992);if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x38')]){_0x3b1175[_0x6953('0x39')]=_[_0x6953('0x3a')](_0x3b1175[_0x6953('0x39')],{'$or':_[_0x6953('0x2a')](_0x131992,function(_0x2d9d81){if(_0x2d9d81['type']!==_0x6953('0x3b')){var _0x3c03ab={};_0x3c03ab[_0x2d9d81[_0x6953('0x28')]]={'$like':'%'+_0x4af39d['query']['filter']+'%'};return _0x3c03ab;}})});}_0x3b1175=_[_0x6953('0x3a')]({},_0x3b1175,_0x4af39d['options']);var _0x5abaf2={'where':_0x3b1175[_0x6953('0x39')]};return db[_0x6953('0x2b')]['count'](_0x5abaf2)[_0x6953('0x3c')](function(_0x263728){_0x4b0325[_0x6953('0x21')]=_0x263728;if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x3d')]){_0x3b1175[_0x6953('0x3e')]=[{'all':!![]}];}return db['UserProfileResource'][_0x6953('0x3f')](_0x3b1175);})[_0x6953('0x3c')](function(_0x30a27a){_0x4b0325[_0x6953('0x40')]=_0x30a27a;return _0x4b0325;})[_0x6953('0x3c')](respondWithFilteredResult(_0x173b3c,_0x3b1175))[_0x6953('0x41')](handleError(_0x173b3c,null));};exports['show']=function(_0x5a40de,_0xeef91a){var _0x54d7c2={'raw':![],'where':{'id':_0x5a40de[_0x6953('0x42')]['id']}},_0x588ff8={};_0x588ff8[_0x6953('0x2d')]=_[_0x6953('0x2f')](db[_0x6953('0x2b')][_0x6953('0x43')]);_0x588ff8['query']=_['keys'](_0x5a40de[_0x6953('0x2e')]);_0x588ff8[_0x6953('0x30')]=_['intersection'](_0x588ff8[_0x6953('0x2d')],_0x588ff8['query']);_0x54d7c2[_0x6953('0x32')]=_[_0x6953('0x44')](_0x588ff8[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x5a40de['query'][_0x6953('0x31')]));_0x54d7c2[_0x6953('0x32')]=_0x54d7c2['attributes'][_0x6953('0x45')]?_0x54d7c2[_0x6953('0x32')]:_0x588ff8[_0x6953('0x2d')];if(_0x5a40de[_0x6953('0x2e')][_0x6953('0x3d')]){_0x54d7c2[_0x6953('0x3e')]=[{'all':!![]}];}_0x54d7c2=_[_0x6953('0x3a')]({},_0x54d7c2,_0x5a40de[_0x6953('0x46')]);return db[_0x6953('0x2b')][_0x6953('0x47')](_0x54d7c2)[_0x6953('0x3c')](handleEntityNotFound(_0xeef91a,null))['then'](respondWithResult(_0xeef91a,null))[_0x6953('0x41')](handleError(_0xeef91a,null));};exports['create']=function(_0x15c142,_0x1d5979){return db[_0x6953('0x2b')]['create'](_0x15c142[_0x6953('0x48')],{})[_0x6953('0x3c')](respondWithResult(_0x1d5979,0xc9))['catch'](handleError(_0x1d5979,null));};exports['update']=function(_0xbf5b61,_0x265b44){if(_0xbf5b61[_0x6953('0x48')]['id']){delete _0xbf5b61[_0x6953('0x48')]['id'];}return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'id':_0xbf5b61[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x265b44,null))[_0x6953('0x3c')](saveUpdates(_0xbf5b61[_0x6953('0x48')],null))[_0x6953('0x3c')](respondWithResult(_0x265b44,null))['catch'](handleError(_0x265b44,null));};exports['destroy']=function(_0x14a7bf,_0x38e3e8){return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'id':_0x14a7bf[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x38e3e8,null))[_0x6953('0x3c')](removeEntity(_0x38e3e8,null))[_0x6953('0x41')](handleError(_0x38e3e8,null));};exports[_0x6953('0x49')]=function(_0x50b962,_0x5f15b0){return db['UserProfileResource']['describe']()[_0x6953('0x3c')](respondWithResult(_0x5f15b0,null))[_0x6953('0x41')](handleError(_0x5f15b0,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index c65814d..8fef883 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 _0x255c=['api','request-promise','exports','define','UserProfileResource','user_profile_has_resources','resourceId','lodash','util','../../config/logger'];(function(_0x41b369,_0x29e21f){var _0x2af633=function(_0x588c87){while(--_0x588c87){_0x41b369['push'](_0x41b369['shift']());}};_0x2af633(++_0x29e21f);}(_0x255c,0x129));var _0xc255=function(_0x5e6e79,_0x1d46ec){_0x5e6e79=_0x5e6e79-0x0;var _0x3ffc9d=_0x255c[_0x5e6e79];return _0x3ffc9d;};'use strict';var _=require(_0xc255('0x0'));var util=require(_0xc255('0x1'));var logger=require(_0xc255('0x2'))(_0xc255('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc255('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0xc255('0x5')]=function(_0x527363,_0x5e57f2){return _0x527363[_0xc255('0x6')](_0xc255('0x7'),attributes,{'tableName':_0xc255('0x8'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xc255('0x9'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0b24=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','compositeIndex','resourceId','lodash'];(function(_0x4c03ae,_0x5856b0){var _0x1acaab=function(_0x8c9f5f){while(--_0x8c9f5f){_0x4c03ae['push'](_0x4c03ae['shift']());}};_0x1acaab(++_0x5856b0);}(_0x0b24,0x149));var _0x40b2=function(_0x413483,_0x3cfcc2){_0x413483=_0x413483-0x0;var _0x3a1140=_0x0b24[_0x413483];return _0x3a1140;};'use strict';var _=require(_0x40b2('0x0'));var util=require(_0x40b2('0x1'));var logger=require(_0x40b2('0x2'))(_0x40b2('0x3'));var moment=require(_0x40b2('0x4'));var BPromise=require(_0x40b2('0x5'));var rp=require(_0x40b2('0x6'));var fs=require('fs');var path=require(_0x40b2('0x7'));var rimraf=require(_0x40b2('0x8'));var config=require(_0x40b2('0x9'));var attributes=require(_0x40b2('0xa'));module[_0x40b2('0xb')]=function(_0x50669d,_0x3c4eb1){return _0x50669d['define'](_0x40b2('0xc'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x40b2('0xd'),'fields':[_0x40b2('0xe'),'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 17058b6..dbd95c0 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 _0x2f2c=['http','request','then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x226c69,_0x1458a5){var _0x57eb37=function(_0x524e97){while(--_0x524e97){_0x226c69['push'](_0x226c69['shift']());}};_0x57eb37(++_0x1458a5);}(_0x2f2c,0x8a));var _0xc2f2=function(_0x2f4e8a,_0x114fd8){_0x2f4e8a=_0x2f4e8a-0x0;var _0x45eb5e=_0x2f2c[_0x2f4e8a];return _0x45eb5e;};'use strict';var _=require(_0xc2f2('0x0'));var util=require(_0xc2f2('0x1'));var moment=require('moment');var BPromise=require(_0xc2f2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc2f2('0x3'));var db=require(_0xc2f2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc2f2('0x5'))(_0xc2f2('0x6'));var config=require('../../config/environment');var jayson=require(_0xc2f2('0x7'));var client=jayson[_0xc2f2('0x8')][_0xc2f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5587c8,_0x3d12a6,_0x46cc44){return new BPromise(function(_0x4f031f,_0x538600){return client[_0xc2f2('0xa')](_0x5587c8,_0x46cc44)[_0xc2f2('0xb')](function(_0x596a7b){logger[_0xc2f2('0xc')](_0xc2f2('0xd'),_0x3d12a6,'request\x20sent');logger[_0xc2f2('0xe')](_0xc2f2('0xf'),_0x3d12a6,_0xc2f2('0x10'),JSON[_0xc2f2('0x11')](_0x596a7b));if(_0x596a7b[_0xc2f2('0x12')]){if(_0x596a7b[_0xc2f2('0x12')]['code']===0x1f4){logger[_0xc2f2('0x12')](_0xc2f2('0xd'),_0x3d12a6,_0x596a7b[_0xc2f2('0x12')][_0xc2f2('0x13')]);return _0x538600(_0x596a7b[_0xc2f2('0x12')][_0xc2f2('0x13')]);}logger[_0xc2f2('0x12')](_0xc2f2('0xd'),_0x3d12a6,_0x596a7b['error'][_0xc2f2('0x13')]);return _0x4f031f(_0x596a7b[_0xc2f2('0x12')][_0xc2f2('0x13')]);}else{logger[_0xc2f2('0xc')](_0xc2f2('0xd'),_0x3d12a6,_0xc2f2('0x10'));_0x4f031f(_0x596a7b[_0xc2f2('0x14')][_0xc2f2('0x13')]);}})['catch'](function(_0xcd64){logger[_0xc2f2('0x12')](_0xc2f2('0xd'),_0x3d12a6,_0xcd64);_0x538600(_0xcd64);});});} \ No newline at end of file +var _0xd673=['stringify','error','code','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s'];(function(_0x2ac9bb,_0x525657){var _0xdc2c16=function(_0x269d1b){while(--_0x269d1b){_0x2ac9bb['push'](_0x2ac9bb['shift']());}};_0xdc2c16(++_0x525657);}(_0xd673,0x1eb));var _0x3d67=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd673[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x3d67('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3d67('0x1'));var rs=require(_0x3d67('0x2'));var fs=require('fs');var Redis=require(_0x3d67('0x3'));var db=require(_0x3d67('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3d67('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3d67('0x6'));var client=jayson[_0x3d67('0x7')][_0x3d67('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4277c,_0x4edaa7,_0x3fde13){return new BPromise(function(_0x40460b,_0x5a00fe){return client[_0x3d67('0x9')](_0x4277c,_0x3fde13)[_0x3d67('0xa')](function(_0x4fa3b3){logger['info'](_0x3d67('0xb'),_0x4edaa7,_0x3d67('0xc'));logger[_0x3d67('0xd')](_0x3d67('0xe'),_0x4edaa7,_0x3d67('0xc'),JSON[_0x3d67('0xf')](_0x4fa3b3));if(_0x4fa3b3['error']){if(_0x4fa3b3[_0x3d67('0x10')][_0x3d67('0x11')]===0x1f4){logger['error'](_0x3d67('0xb'),_0x4edaa7,_0x4fa3b3[_0x3d67('0x10')][_0x3d67('0x12')]);return _0x5a00fe(_0x4fa3b3[_0x3d67('0x10')][_0x3d67('0x12')]);}logger[_0x3d67('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x4edaa7,_0x4fa3b3[_0x3d67('0x10')]['message']);return _0x40460b(_0x4fa3b3[_0x3d67('0x10')][_0x3d67('0x12')]);}else{logger[_0x3d67('0x13')](_0x3d67('0xb'),_0x4edaa7,_0x3d67('0xc'));_0x40460b(_0x4fa3b3[_0x3d67('0x14')]['message']);}})[_0x3d67('0x15')](function(_0x5bd995){logger['error'](_0x3d67('0xb'),_0x4edaa7,_0x5bd995);_0x5a00fe(_0x5bd995);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 16d0620..5a79067 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 _0xc8c6=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc8c6,0xad));var _0x6c8c=function(_0x1bf57f,_0x255df4){_0x1bf57f=_0x1bf57f-0x0;var _0x23a86b=_0xc8c6[_0x1bf57f];return _0x23a86b;};'use strict';var multer=require(_0x6c8c('0x0'));var util=require('util');var path=require(_0x6c8c('0x1'));var timeout=require(_0x6c8c('0x2'));var express=require(_0x6c8c('0x3'));var router=express[_0x6c8c('0x4')]();var fs_extra=require(_0x6c8c('0x5'));var auth=require(_0x6c8c('0x6'));var interaction=require(_0x6c8c('0x7'));var config=require(_0x6c8c('0x8'));var controller=require('./userProfileSection.controller');router[_0x6c8c('0x9')]('/',auth[_0x6c8c('0xa')](),controller[_0x6c8c('0xb')]);router['get'](_0x6c8c('0xc'),auth[_0x6c8c('0xa')](),controller[_0x6c8c('0xd')]);router[_0x6c8c('0x9')](_0x6c8c('0xe'),auth[_0x6c8c('0xa')](),controller[_0x6c8c('0xf')]);router[_0x6c8c('0x10')]('/',auth[_0x6c8c('0xa')](),controller[_0x6c8c('0x11')]);router[_0x6c8c('0x12')](_0x6c8c('0xe'),auth[_0x6c8c('0xa')](),controller[_0x6c8c('0x13')]);router[_0x6c8c('0x14')]('/:id',auth[_0x6c8c('0xa')](),controller['destroy']);module[_0x6c8c('0x15')]=router; \ No newline at end of file +var _0xb05c=['./userProfileSection.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xb05c,0x13d));var _0xcb05=function(_0xfbc3dc,_0x3a7830){_0xfbc3dc=_0xfbc3dc-0x0;var _0x48c818=_0xb05c[_0xfbc3dc];return _0x48c818;};'use strict';var multer=require(_0xcb05('0x0'));var util=require(_0xcb05('0x1'));var path=require(_0xcb05('0x2'));var timeout=require(_0xcb05('0x3'));var express=require(_0xcb05('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcb05('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcb05('0x6'));router[_0xcb05('0x7')]('/',auth[_0xcb05('0x8')](),controller['index']);router[_0xcb05('0x7')](_0xcb05('0x9'),auth[_0xcb05('0x8')](),controller[_0xcb05('0xa')]);router[_0xcb05('0x7')](_0xcb05('0xb'),auth[_0xcb05('0x8')](),controller[_0xcb05('0xc')]);router[_0xcb05('0xd')]('/',auth[_0xcb05('0x8')](),controller[_0xcb05('0xe')]);router[_0xcb05('0xf')](_0xcb05('0xb'),auth[_0xcb05('0x8')](),controller[_0xcb05('0x10')]);router[_0xcb05('0x11')](_0xcb05('0xb'),auth[_0xcb05('0x8')](),controller['destroy']);module[_0xcb05('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 68444d6..6a4a90e 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 _0x84a0=['STRING','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize','exports'];(function(_0x35485a,_0x91cdd4){var _0x5148e6=function(_0x27ed1d){while(--_0x27ed1d){_0x35485a['push'](_0x35485a['shift']());}};_0x5148e6(++_0x91cdd4);}(_0x84a0,0x66));var _0x084a=function(_0x5e95c,_0x5d0943){_0x5e95c=_0x5e95c-0x0;var _0x3ff5b8=_0x84a0[_0x5e95c];return _0x3ff5b8;};'use strict';var Sequelize=require(_0x084a('0x0'));module[_0x084a('0x1')]={'name':{'type':Sequelize[_0x084a('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x084a('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x084a('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x084a('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x58a814){this[_0x084a('0x4')](_0x084a('0x5'),_0x58a814?_0x58a814['join'](''):[]);},'get':function(){return this[_0x084a('0x6')](_0x084a('0x5'))?this[_0x084a('0x6')](_0x084a('0x5'))[_0x084a('0x7')](''):[];}}}; \ No newline at end of file +var _0x0abf=['sequelize','STRING','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x52db8d,_0x5a9ddb){var _0xb1229f=function(_0x54e405){while(--_0x54e405){_0x52db8d['push'](_0x52db8d['shift']());}};_0xb1229f(++_0x5a9ddb);}(_0x0abf,0xe8));var _0xf0ab=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0abf[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xf0ab('0x0'));module['exports']={'name':{'type':Sequelize[_0xf0ab('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xf0ab('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xf0ab('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x7ea4e0){this[_0xf0ab('0x3')](_0xf0ab('0x4'),_0x7ea4e0?_0x7ea4e0[_0xf0ab('0x5')](''):[]);},'get':function(){return this[_0xf0ab('0x6')](_0xf0ab('0x4'))?this[_0xf0ab('0x6')]('crudPermissions')[_0xf0ab('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 8edc8af..d7df1e2 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 _0x0137=['model','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','includeAll','findAll','catch','params','intersection','include','merge','options','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','crypto','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','json','limit','undefined','count','offset','status','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','UserProfileSection','rawAttributes','type','key','map','query','keys'];(function(_0x369893,_0x819abe){var _0x22c120=function(_0x4e98f4){while(--_0x4e98f4){_0x369893['push'](_0x369893['shift']());}};_0x22c120(++_0x819abe);}(_0x0137,0x105));var _0x7013=function(_0x34986b,_0x56fb4a){_0x34986b=_0x34986b-0x0;var _0x28a0d1=_0x0137[_0x34986b];return _0x28a0d1;};'use strict';var emlformat=require(_0x7013('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7013('0x1'));var jsonpatch=require(_0x7013('0x2'));var rp=require(_0x7013('0x3'));var moment=require(_0x7013('0x4'));var BPromise=require(_0x7013('0x5'));var Mustache=require(_0x7013('0x6'));var util=require(_0x7013('0x7'));var path=require(_0x7013('0x8'));var sox=require(_0x7013('0x9'));var csv=require(_0x7013('0xa'));var ejs=require(_0x7013('0xb'));var fs=require('fs');var fs_extra=require(_0x7013('0xc'));var _=require(_0x7013('0xd'));var squel=require('squel');var crypto=require(_0x7013('0xe'));var jsforce=require(_0x7013('0xf'));var deskjs=require(_0x7013('0x10'));var toCsv=require(_0x7013('0xa'));var querystring=require(_0x7013('0x11'));var Papa=require(_0x7013('0x12'));var Redis=require(_0x7013('0x13'));var authService=require(_0x7013('0x14'));var qs=require(_0x7013('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7013('0x16'));var logger=require(_0x7013('0x17'))(_0x7013('0x18'));var utils=require('../../config/utils');var config=require(_0x7013('0x19'));var licenseUtil=require(_0x7013('0x1a'));var db=require(_0x7013('0x1b'))['db'];function respondWithStatusCode(_0x41d32e,_0x4bcaf1){_0x4bcaf1=_0x4bcaf1||0xcc;return function(_0x524717){if(_0x524717){return _0x41d32e[_0x7013('0x1c')](_0x4bcaf1);}return _0x41d32e['status'](_0x4bcaf1)['end']();};}function respondWithResult(_0x175023,_0x15874b){_0x15874b=_0x15874b||0xc8;return function(_0x4a4890){if(_0x4a4890){return _0x175023['status'](_0x15874b)[_0x7013('0x1d')](_0x4a4890);}};}function respondWithFilteredResult(_0x45e310,_0x36105b){return function(_0x105e42){if(_0x105e42){var _0x18ee1f=typeof _0x36105b['offset']==='undefined'&&typeof _0x36105b[_0x7013('0x1e')]===_0x7013('0x1f');var _0x5c3097=_0x105e42[_0x7013('0x20')];var _0x2d5d43=_0x18ee1f?0x0:_0x36105b[_0x7013('0x21')];var _0x4f2e69=_0x18ee1f?_0x105e42[_0x7013('0x20')]:_0x36105b[_0x7013('0x21')]+_0x36105b[_0x7013('0x1e')];var _0x7d7b40;if(_0x4f2e69>=_0x5c3097){_0x4f2e69=_0x5c3097;_0x7d7b40=0xc8;}else{_0x7d7b40=0xce;}_0x45e310[_0x7013('0x22')](_0x7d7b40);return _0x45e310['set'](_0x7013('0x23'),_0x2d5d43+'-'+_0x4f2e69+'/'+_0x5c3097)[_0x7013('0x1d')](_0x105e42);}return null;};}function patchUpdates(_0x19b2b9){return function(_0x28c304){try{jsonpatch[_0x7013('0x24')](_0x28c304,_0x19b2b9,!![]);}catch(_0xb78623){return BPromise[_0x7013('0x25')](_0xb78623);}return _0x28c304[_0x7013('0x26')]();};}function saveUpdates(_0x5c4c4c,_0x572d7e){return function(_0x47341a){if(_0x47341a){return _0x47341a[_0x7013('0x27')](_0x5c4c4c)[_0x7013('0x28')](function(_0x33ce4b){return _0x33ce4b;});}return null;};}function removeEntity(_0x2a2af6,_0x37877b){return function(_0x58e0f3){if(_0x58e0f3){return _0x58e0f3[_0x7013('0x29')]()[_0x7013('0x28')](function(){_0x2a2af6[_0x7013('0x22')](0xcc)[_0x7013('0x2a')]();});}};}function handleEntityNotFound(_0x23b735,_0x15a24c){return function(_0x5f3e13){if(!_0x5f3e13){_0x23b735[_0x7013('0x1c')](0x194);}return _0x5f3e13;};}function handleError(_0x596e75,_0x523892){_0x523892=_0x523892||0x1f4;return function(_0x57425f){logger[_0x7013('0x2b')](_0x57425f[_0x7013('0x2c')]);if(_0x57425f['name']){delete _0x57425f[_0x7013('0x2d')];}_0x596e75[_0x7013('0x22')](_0x523892)[_0x7013('0x2e')](_0x57425f);};}exports[_0x7013('0x2f')]=function(_0x3b0969,_0x54c7b4){var _0x14c84={},_0x42130a={},_0x3344fb={'count':0x0,'rows':[]};var _0x2912ca=_['map'](db[_0x7013('0x30')][_0x7013('0x31')],function(_0x48fb2f){return{'name':_0x48fb2f['fieldName'],'type':_0x48fb2f[_0x7013('0x32')][_0x7013('0x33')]};});_0x42130a['model']=_[_0x7013('0x34')](_0x2912ca,_0x7013('0x2d'));_0x42130a[_0x7013('0x35')]=_[_0x7013('0x36')](_0x3b0969[_0x7013('0x35')]);_0x42130a['filters']=_['intersection'](_0x42130a[_0x7013('0x37')],_0x42130a['query']);_0x14c84[_0x7013('0x38')]=_['intersection'](_0x42130a[_0x7013('0x37')],qs[_0x7013('0x39')](_0x3b0969['query'][_0x7013('0x39')]));_0x14c84[_0x7013('0x38')]=_0x14c84[_0x7013('0x38')][_0x7013('0x3a')]?_0x14c84[_0x7013('0x38')]:_0x42130a['model'];if(!_0x3b0969[_0x7013('0x35')][_0x7013('0x3b')]('nolimit')){_0x14c84[_0x7013('0x1e')]=qs[_0x7013('0x1e')](_0x3b0969[_0x7013('0x35')]['limit']);_0x14c84[_0x7013('0x21')]=qs[_0x7013('0x21')](_0x3b0969['query'][_0x7013('0x21')]);}_0x14c84[_0x7013('0x3c')]=qs[_0x7013('0x3d')](_0x3b0969[_0x7013('0x35')]['sort']);_0x14c84['where']=qs[_0x7013('0x3e')](_[_0x7013('0x3f')](_0x3b0969[_0x7013('0x35')],_0x42130a['filters']),_0x2912ca);if(_0x3b0969[_0x7013('0x35')][_0x7013('0x40')]){_0x14c84[_0x7013('0x41')]=_['merge'](_0x14c84[_0x7013('0x41')],{'$or':_[_0x7013('0x34')](_0x2912ca,function(_0x3dad75){if(_0x3dad75[_0x7013('0x32')]!==_0x7013('0x42')){var _0x50b1f8={};_0x50b1f8[_0x3dad75[_0x7013('0x2d')]]={'$like':'%'+_0x3b0969[_0x7013('0x35')][_0x7013('0x40')]+'%'};return _0x50b1f8;}})});}_0x14c84=_['merge']({},_0x14c84,_0x3b0969['options']);var _0xaa70b={'where':_0x14c84[_0x7013('0x41')]};return db[_0x7013('0x30')]['count'](_0xaa70b)[_0x7013('0x28')](function(_0x2f39fb){_0x3344fb['count']=_0x2f39fb;if(_0x3b0969['query'][_0x7013('0x43')]){_0x14c84['include']=[{'all':!![]}];}return db[_0x7013('0x30')][_0x7013('0x44')](_0x14c84);})[_0x7013('0x28')](function(_0x6699dc){_0x3344fb['rows']=_0x6699dc;return _0x3344fb;})[_0x7013('0x28')](respondWithFilteredResult(_0x54c7b4,_0x14c84))[_0x7013('0x45')](handleError(_0x54c7b4,null));};exports['show']=function(_0x4e0a7d,_0x1674b0){var _0x421e45={'raw':![],'where':{'id':_0x4e0a7d[_0x7013('0x46')]['id']}},_0x345787={};_0x345787[_0x7013('0x37')]=_[_0x7013('0x36')](db['UserProfileSection'][_0x7013('0x31')]);_0x345787['query']=_[_0x7013('0x36')](_0x4e0a7d[_0x7013('0x35')]);_0x345787[_0x7013('0x3e')]=_[_0x7013('0x47')](_0x345787[_0x7013('0x37')],_0x345787[_0x7013('0x35')]);_0x421e45[_0x7013('0x38')]=_[_0x7013('0x47')](_0x345787[_0x7013('0x37')],qs[_0x7013('0x39')](_0x4e0a7d[_0x7013('0x35')][_0x7013('0x39')]));_0x421e45['attributes']=_0x421e45['attributes'][_0x7013('0x3a')]?_0x421e45['attributes']:_0x345787['model'];if(_0x4e0a7d[_0x7013('0x35')][_0x7013('0x43')]){_0x421e45[_0x7013('0x48')]=[{'all':!![]}];}_0x421e45=_[_0x7013('0x49')]({},_0x421e45,_0x4e0a7d[_0x7013('0x4a')]);return db['UserProfileSection'][_0x7013('0x4b')](_0x421e45)[_0x7013('0x28')](handleEntityNotFound(_0x1674b0,null))[_0x7013('0x28')](respondWithResult(_0x1674b0,null))[_0x7013('0x45')](handleError(_0x1674b0,null));};exports[_0x7013('0x4c')]=function(_0x518122,_0x3bf436){return db[_0x7013('0x30')][_0x7013('0x4c')](_0x518122[_0x7013('0x4d')],{})[_0x7013('0x28')](respondWithResult(_0x3bf436,0xc9))['catch'](handleError(_0x3bf436,null));};exports[_0x7013('0x27')]=function(_0x2dac3f,_0x1edf76){if(_0x2dac3f[_0x7013('0x4d')]['id']){delete _0x2dac3f[_0x7013('0x4d')]['id'];}return db[_0x7013('0x30')][_0x7013('0x4b')]({'where':{'id':_0x2dac3f[_0x7013('0x46')]['id']}})[_0x7013('0x28')](handleEntityNotFound(_0x1edf76,null))[_0x7013('0x28')](saveUpdates(_0x2dac3f[_0x7013('0x4d')],null))[_0x7013('0x28')](respondWithResult(_0x1edf76,null))[_0x7013('0x45')](handleError(_0x1edf76,null));};exports[_0x7013('0x29')]=function(_0x4fe6dd,_0x236540){return db[_0x7013('0x30')][_0x7013('0x4b')]({'where':{'id':_0x4fe6dd[_0x7013('0x46')]['id']}})['then'](handleEntityNotFound(_0x236540,null))[_0x7013('0x28')](removeEntity(_0x236540,null))[_0x7013('0x45')](handleError(_0x236540,null));};exports['describe']=function(_0x43bbb5,_0x9ef137){return db[_0x7013('0x30')][_0x7013('0x4e')]()['then'](respondWithResult(_0x9ef137,null))[_0x7013('0x45')](handleError(_0x9ef137,null));}; \ No newline at end of file +var _0x3b09=['query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','UserProfileSection','fieldName','model'];(function(_0x1465e2,_0x7e5150){var _0x38f758=function(_0x207dcc){while(--_0x207dcc){_0x1465e2['push'](_0x1465e2['shift']());}};_0x38f758(++_0x7e5150);}(_0x3b09,0x106));var _0x93b0=function(_0x1f27df,_0x4f1a64){_0x1f27df=_0x1f27df-0x0;var _0x286ee2=_0x3b09[_0x1f27df];return _0x286ee2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x93b0('0x0'));var zipdir=require(_0x93b0('0x1'));var jsonpatch=require(_0x93b0('0x2'));var rp=require(_0x93b0('0x3'));var moment=require(_0x93b0('0x4'));var BPromise=require(_0x93b0('0x5'));var Mustache=require(_0x93b0('0x6'));var util=require(_0x93b0('0x7'));var path=require(_0x93b0('0x8'));var sox=require(_0x93b0('0x9'));var csv=require(_0x93b0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x93b0('0xb'));var _=require('lodash');var squel=require(_0x93b0('0xc'));var crypto=require(_0x93b0('0xd'));var jsforce=require(_0x93b0('0xe'));var deskjs=require(_0x93b0('0xf'));var toCsv=require('to-csv');var querystring=require(_0x93b0('0x10'));var Papa=require('papaparse');var Redis=require(_0x93b0('0x11'));var authService=require(_0x93b0('0x12'));var qs=require(_0x93b0('0x13'));var as=require(_0x93b0('0x14'));var hardwareService=require(_0x93b0('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x93b0('0x16'));var config=require(_0x93b0('0x17'));var licenseUtil=require(_0x93b0('0x18'));var db=require(_0x93b0('0x19'))['db'];function respondWithStatusCode(_0x4e131f,_0x1b8d5e){_0x1b8d5e=_0x1b8d5e||0xcc;return function(_0x5cc078){if(_0x5cc078){return _0x4e131f[_0x93b0('0x1a')](_0x1b8d5e);}return _0x4e131f['status'](_0x1b8d5e)[_0x93b0('0x1b')]();};}function respondWithResult(_0x3e86b6,_0x5d7769){_0x5d7769=_0x5d7769||0xc8;return function(_0x3b0122){if(_0x3b0122){return _0x3e86b6[_0x93b0('0x1c')](_0x5d7769)[_0x93b0('0x1d')](_0x3b0122);}};}function respondWithFilteredResult(_0xa138ff,_0x1a074a){return function(_0x16cd61){if(_0x16cd61){var _0xc5177c=typeof _0x1a074a['offset']==='undefined'&&typeof _0x1a074a[_0x93b0('0x1e')]===_0x93b0('0x1f');var _0x569aec=_0x16cd61[_0x93b0('0x20')];var _0xa66717=_0xc5177c?0x0:_0x1a074a[_0x93b0('0x21')];var _0x2b82f0=_0xc5177c?_0x16cd61['count']:_0x1a074a[_0x93b0('0x21')]+_0x1a074a[_0x93b0('0x1e')];var _0x33fc07;if(_0x2b82f0>=_0x569aec){_0x2b82f0=_0x569aec;_0x33fc07=0xc8;}else{_0x33fc07=0xce;}_0xa138ff[_0x93b0('0x1c')](_0x33fc07);return _0xa138ff[_0x93b0('0x22')](_0x93b0('0x23'),_0xa66717+'-'+_0x2b82f0+'/'+_0x569aec)['json'](_0x16cd61);}return null;};}function patchUpdates(_0x4ac78b){return function(_0x13ecb4){try{jsonpatch[_0x93b0('0x24')](_0x13ecb4,_0x4ac78b,!![]);}catch(_0x4aa714){return BPromise['reject'](_0x4aa714);}return _0x13ecb4[_0x93b0('0x25')]();};}function saveUpdates(_0x1bdc8e,_0x3f2845){return function(_0x2be2f8){if(_0x2be2f8){return _0x2be2f8[_0x93b0('0x26')](_0x1bdc8e)[_0x93b0('0x27')](function(_0x489ea7){return _0x489ea7;});}return null;};}function removeEntity(_0x17a59c,_0x139170){return function(_0x4e41a){if(_0x4e41a){return _0x4e41a[_0x93b0('0x28')]()['then'](function(){_0x17a59c[_0x93b0('0x1c')](0xcc)[_0x93b0('0x1b')]();});}};}function handleEntityNotFound(_0x4baf07,_0x46d03f){return function(_0x59c753){if(!_0x59c753){_0x4baf07['sendStatus'](0x194);}return _0x59c753;};}function handleError(_0x1e9263,_0x5ecc01){_0x5ecc01=_0x5ecc01||0x1f4;return function(_0x285aea){logger[_0x93b0('0x29')](_0x285aea[_0x93b0('0x2a')]);if(_0x285aea[_0x93b0('0x2b')]){delete _0x285aea[_0x93b0('0x2b')];}_0x1e9263[_0x93b0('0x1c')](_0x5ecc01)[_0x93b0('0x2c')](_0x285aea);};}exports[_0x93b0('0x2d')]=function(_0x69ab9f,_0x280203){var _0x240541={},_0x4063b7={},_0x321867={'count':0x0,'rows':[]};var _0x2d3bff=_[_0x93b0('0x2e')](db[_0x93b0('0x2f')]['rawAttributes'],function(_0x2d6666){return{'name':_0x2d6666[_0x93b0('0x30')],'type':_0x2d6666['type']['key']};});_0x4063b7[_0x93b0('0x31')]=_['map'](_0x2d3bff,_0x93b0('0x2b'));_0x4063b7[_0x93b0('0x32')]=_[_0x93b0('0x33')](_0x69ab9f[_0x93b0('0x32')]);_0x4063b7[_0x93b0('0x34')]=_[_0x93b0('0x35')](_0x4063b7['model'],_0x4063b7[_0x93b0('0x32')]);_0x240541[_0x93b0('0x36')]=_[_0x93b0('0x35')](_0x4063b7[_0x93b0('0x31')],qs[_0x93b0('0x37')](_0x69ab9f['query']['fields']));_0x240541[_0x93b0('0x36')]=_0x240541[_0x93b0('0x36')][_0x93b0('0x38')]?_0x240541['attributes']:_0x4063b7['model'];if(!_0x69ab9f[_0x93b0('0x32')]['hasOwnProperty'](_0x93b0('0x39'))){_0x240541[_0x93b0('0x1e')]=qs[_0x93b0('0x1e')](_0x69ab9f[_0x93b0('0x32')][_0x93b0('0x1e')]);_0x240541[_0x93b0('0x21')]=qs[_0x93b0('0x21')](_0x69ab9f[_0x93b0('0x32')]['offset']);}_0x240541[_0x93b0('0x3a')]=qs['sort'](_0x69ab9f[_0x93b0('0x32')][_0x93b0('0x3b')]);_0x240541[_0x93b0('0x3c')]=qs[_0x93b0('0x34')](_['pick'](_0x69ab9f[_0x93b0('0x32')],_0x4063b7[_0x93b0('0x34')]),_0x2d3bff);if(_0x69ab9f[_0x93b0('0x32')]['filter']){_0x240541[_0x93b0('0x3c')]=_[_0x93b0('0x3d')](_0x240541[_0x93b0('0x3c')],{'$or':_['map'](_0x2d3bff,function(_0x202290){if(_0x202290[_0x93b0('0x3e')]!==_0x93b0('0x3f')){var _0x638ad3={};_0x638ad3[_0x202290['name']]={'$like':'%'+_0x69ab9f[_0x93b0('0x32')][_0x93b0('0x40')]+'%'};return _0x638ad3;}})});}_0x240541=_[_0x93b0('0x3d')]({},_0x240541,_0x69ab9f[_0x93b0('0x41')]);var _0x47cdcc={'where':_0x240541[_0x93b0('0x3c')]};return db[_0x93b0('0x2f')]['count'](_0x47cdcc)[_0x93b0('0x27')](function(_0x16f455){_0x321867[_0x93b0('0x20')]=_0x16f455;if(_0x69ab9f[_0x93b0('0x32')][_0x93b0('0x42')]){_0x240541[_0x93b0('0x43')]=[{'all':!![]}];}return db[_0x93b0('0x2f')][_0x93b0('0x44')](_0x240541);})[_0x93b0('0x27')](function(_0x58cc0e){_0x321867[_0x93b0('0x45')]=_0x58cc0e;return _0x321867;})[_0x93b0('0x27')](respondWithFilteredResult(_0x280203,_0x240541))[_0x93b0('0x46')](handleError(_0x280203,null));};exports[_0x93b0('0x47')]=function(_0x2ee1e8,_0x4a34d9){var _0xd8274a={'raw':![],'where':{'id':_0x2ee1e8[_0x93b0('0x48')]['id']}},_0x479040={};_0x479040[_0x93b0('0x31')]=_['keys'](db['UserProfileSection'][_0x93b0('0x49')]);_0x479040[_0x93b0('0x32')]=_[_0x93b0('0x33')](_0x2ee1e8['query']);_0x479040[_0x93b0('0x34')]=_[_0x93b0('0x35')](_0x479040[_0x93b0('0x31')],_0x479040[_0x93b0('0x32')]);_0xd8274a[_0x93b0('0x36')]=_['intersection'](_0x479040[_0x93b0('0x31')],qs[_0x93b0('0x37')](_0x2ee1e8[_0x93b0('0x32')][_0x93b0('0x37')]));_0xd8274a[_0x93b0('0x36')]=_0xd8274a[_0x93b0('0x36')]['length']?_0xd8274a['attributes']:_0x479040[_0x93b0('0x31')];if(_0x2ee1e8[_0x93b0('0x32')]['includeAll']){_0xd8274a[_0x93b0('0x43')]=[{'all':!![]}];}_0xd8274a=_[_0x93b0('0x3d')]({},_0xd8274a,_0x2ee1e8[_0x93b0('0x41')]);return db['UserProfileSection'][_0x93b0('0x4a')](_0xd8274a)[_0x93b0('0x27')](handleEntityNotFound(_0x4a34d9,null))[_0x93b0('0x27')](respondWithResult(_0x4a34d9,null))[_0x93b0('0x46')](handleError(_0x4a34d9,null));};exports[_0x93b0('0x4b')]=function(_0x4ffddb,_0x43d865){return db[_0x93b0('0x2f')][_0x93b0('0x4b')](_0x4ffddb['body'],{})[_0x93b0('0x27')](respondWithResult(_0x43d865,0xc9))[_0x93b0('0x46')](handleError(_0x43d865,null));};exports['update']=function(_0x8058de,_0x59c70d){if(_0x8058de[_0x93b0('0x4c')]['id']){delete _0x8058de[_0x93b0('0x4c')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x8058de[_0x93b0('0x48')]['id']}})['then'](handleEntityNotFound(_0x59c70d,null))[_0x93b0('0x27')](saveUpdates(_0x8058de[_0x93b0('0x4c')],null))[_0x93b0('0x27')](respondWithResult(_0x59c70d,null))['catch'](handleError(_0x59c70d,null));};exports[_0x93b0('0x28')]=function(_0x8ef6dc,_0x5738d3){return db[_0x93b0('0x2f')]['find']({'where':{'id':_0x8ef6dc['params']['id']}})[_0x93b0('0x27')](handleEntityNotFound(_0x5738d3,null))[_0x93b0('0x27')](removeEntity(_0x5738d3,null))[_0x93b0('0x46')](handleError(_0x5738d3,null));};exports[_0x93b0('0x4d')]=function(_0x20c7c8,_0x3fd3b4){return db['UserProfileSection'][_0x93b0('0x4d')]()[_0x93b0('0x27')](respondWithResult(_0x3fd3b4,null))[_0x93b0('0x46')](handleError(_0x3fd3b4,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 2aa6c95..e1efc78 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 _0xc47d=['path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x10192f,_0x59158c){var _0x215f99=function(_0x14dc22){while(--_0x14dc22){_0x10192f['push'](_0x10192f['shift']());}};_0x215f99(++_0x59158c);}(_0xc47d,0x14a));var _0xdc47=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xc47d[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0xdc47('0x0'));var util=require(_0xdc47('0x1'));var logger=require(_0xdc47('0x2'))('api');var moment=require(_0xdc47('0x3'));var BPromise=require(_0xdc47('0x4'));var rp=require(_0xdc47('0x5'));var fs=require('fs');var path=require(_0xdc47('0x6'));var rimraf=require(_0xdc47('0x7'));var config=require(_0xdc47('0x8'));var attributes=require(_0xdc47('0x9'));module[_0xdc47('0xa')]=function(_0x2a8f5e,_0x21fac5){return _0x2a8f5e[_0xdc47('0xb')](_0xdc47('0xc'),attributes,{'tableName':_0xdc47('0xd'),'paranoid':![],'indexes':[{'name':_0xdc47('0xe'),'fields':['sectionId',_0xdc47('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2061=['./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2061,0x148));var _0x1206=function(_0x41537e,_0x536663){_0x41537e=_0x41537e-0x0;var _0x3ec34e=_0x2061[_0x41537e];return _0x3ec34e;};'use strict';var _=require(_0x1206('0x0'));var util=require(_0x1206('0x1'));var logger=require(_0x1206('0x2'))(_0x1206('0x3'));var moment=require(_0x1206('0x4'));var BPromise=require('bluebird');var rp=require(_0x1206('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1206('0x6'));var config=require(_0x1206('0x7'));var attributes=require(_0x1206('0x8'));module[_0x1206('0x9')]=function(_0x3eabd1,_0x34e89c){return _0x3eabd1[_0x1206('0xa')](_0x1206('0xb'),attributes,{'tableName':_0x1206('0xc'),'paranoid':![],'indexes':[{'name':_0x1206('0xd'),'fields':[_0x1206('0xe'),_0x1206('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 38ba823..312aef3 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 _0x4ec8=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0x4ec8,0xc6));var _0x84ec=function(_0x4d12ea,_0x8a6003){_0x4d12ea=_0x4d12ea-0x0;var _0x2a415c=_0x4ec8[_0x4d12ea];return _0x2a415c;};'use strict';var _=require(_0x84ec('0x0'));var util=require(_0x84ec('0x1'));var moment=require(_0x84ec('0x2'));var BPromise=require(_0x84ec('0x3'));var rs=require(_0x84ec('0x4'));var fs=require('fs');var Redis=require(_0x84ec('0x5'));var db=require(_0x84ec('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x84ec('0x7'))(_0x84ec('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x84ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b86f1,_0x559247,_0x1786e3){return new BPromise(function(_0x25d04c,_0x418b07){return client[_0x84ec('0xa')](_0x2b86f1,_0x1786e3)[_0x84ec('0xb')](function(_0xbf2713){logger[_0x84ec('0xc')](_0x84ec('0xd'),_0x559247,_0x84ec('0xe'));logger[_0x84ec('0xf')](_0x84ec('0x10'),_0x559247,_0x84ec('0xe'),JSON[_0x84ec('0x11')](_0xbf2713));if(_0xbf2713[_0x84ec('0x12')]){if(_0xbf2713[_0x84ec('0x12')][_0x84ec('0x13')]===0x1f4){logger[_0x84ec('0x12')](_0x84ec('0xd'),_0x559247,_0xbf2713[_0x84ec('0x12')][_0x84ec('0x14')]);return _0x418b07(_0xbf2713[_0x84ec('0x12')]['message']);}logger[_0x84ec('0x12')](_0x84ec('0xd'),_0x559247,_0xbf2713['error'][_0x84ec('0x14')]);return _0x25d04c(_0xbf2713['error'][_0x84ec('0x14')]);}else{logger['info'](_0x84ec('0xd'),_0x559247,'request\x20sent');_0x25d04c(_0xbf2713[_0x84ec('0x15')][_0x84ec('0x14')]);}})['catch'](function(_0x8362c7){logger[_0x84ec('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x559247,_0x8362c7);_0x418b07(_0x8362c7);});});} \ No newline at end of file +var _0x2072=['UserProfileSection,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x10c4e8,_0x53d5fc){var _0x415c7c=function(_0x35fcd2){while(--_0x35fcd2){_0x10c4e8['push'](_0x10c4e8['shift']());}};_0x415c7c(++_0x53d5fc);}(_0x2072,0x1a6));var _0x2207=function(_0x5a8f50,_0x20f617){_0x5a8f50=_0x5a8f50-0x0;var _0x1433be=_0x2072[_0x5a8f50];return _0x1433be;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2207('0x0'));var BPromise=require(_0x2207('0x1'));var rs=require(_0x2207('0x2'));var fs=require('fs');var Redis=require(_0x2207('0x3'));var db=require(_0x2207('0x4'))['db'];var utils=require(_0x2207('0x5'));var logger=require(_0x2207('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2207('0x7')][_0x2207('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3fc481,_0xf3cc5a,_0x4797bb){return new BPromise(function(_0x1b6043,_0x38f3aa){return client[_0x2207('0x9')](_0x3fc481,_0x4797bb)[_0x2207('0xa')](function(_0x5c3088){logger[_0x2207('0xb')]('UserProfileSection,\x20%s,\x20%s',_0xf3cc5a,_0x2207('0xc'));logger[_0x2207('0xd')](_0x2207('0xe'),_0xf3cc5a,_0x2207('0xc'),JSON[_0x2207('0xf')](_0x5c3088));if(_0x5c3088[_0x2207('0x10')]){if(_0x5c3088[_0x2207('0x10')][_0x2207('0x11')]===0x1f4){logger[_0x2207('0x10')](_0x2207('0x12'),_0xf3cc5a,_0x5c3088[_0x2207('0x10')]['message']);return _0x38f3aa(_0x5c3088[_0x2207('0x10')][_0x2207('0x13')]);}logger[_0x2207('0x10')]('UserProfileSection,\x20%s,\x20%s',_0xf3cc5a,_0x5c3088[_0x2207('0x10')][_0x2207('0x13')]);return _0x1b6043(_0x5c3088['error'][_0x2207('0x13')]);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0xf3cc5a,_0x2207('0xc'));_0x1b6043(_0x5c3088[_0x2207('0x14')][_0x2207('0x13')]);}})[_0x2207('0x15')](function(_0x52cbfc){logger[_0x2207('0x10')]('UserProfileSection,\x20%s,\x20%s',_0xf3cc5a,_0x52cbfc);_0x38f3aa(_0x52cbfc);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 52ac4d9..35bbdfc 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x500ddf,_0x338588){var _0xffad58=function(_0x3c4509){while(--_0x3c4509){_0x500ddf['push'](_0x500ddf['shift']());}};_0xffad58(++_0x338588);}(_0x70e0,0x17b));var _0x070e=function(_0x259c94,_0x35b0dc){_0x259c94=_0x259c94-0x0;var _0x6d11d3=_0x70e0[_0x259c94];return _0x6d11d3;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x24e027,_0x1f16f2){var _0xf6ec3c=function(_0x146fe9){while(--_0x146fe9){_0x24e027['push'](_0x24e027['shift']());}};_0xf6ec3c(++_0x1f16f2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index e0fc35d..f4622f9 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 _0xcb6a=['INTEGER','sequelize','exports'];(function(_0x855e25,_0x5cc86d){var _0x4c2b86=function(_0x1ab233){while(--_0x1ab233){_0x855e25['push'](_0x855e25['shift']());}};_0x4c2b86(++_0x5cc86d);}(_0xcb6a,0x1b1));var _0xacb6=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0xcb6a[_0x38537f];return _0x141e23;};'use strict';var Sequelize=require(_0xacb6('0x0'));module[_0xacb6('0x1')]={'penalty':{'type':Sequelize[_0xacb6('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb90a=['INTEGER','sequelize','exports'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xb90a,0x88));var _0xab90=function(_0x460ea3,_0x42970b){_0x460ea3=_0x460ea3-0x0;var _0x1b6b53=_0xb90a[_0x460ea3];return _0x1b6b53;};'use strict';var Sequelize=require(_0xab90('0x0'));module[_0xab90('0x1')]={'penalty':{'type':Sequelize[_0xab90('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 a28bc0e..c8eed4a 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 _0x4888=['define','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x3ba0d0,_0x55ae51){var _0x54f641=function(_0x29f06f){while(--_0x29f06f){_0x3ba0d0['push'](_0x3ba0d0['shift']());}};_0x54f641(++_0x55ae51);}(_0x4888,0x198));var _0x8488=function(_0x1a4a49,_0xf73c87){_0x1a4a49=_0x1a4a49-0x0;var _0x3be8cd=_0x4888[_0x1a4a49];return _0x3be8cd;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var logger=require(_0x8488('0x1'))(_0x8488('0x2'));var moment=require(_0x8488('0x3'));var BPromise=require(_0x8488('0x4'));var rp=require(_0x8488('0x5'));var fs=require('fs');var path=require(_0x8488('0x6'));var rimraf=require('rimraf');var config=require(_0x8488('0x7'));var attributes=require(_0x8488('0x8'));module[_0x8488('0x9')]=function(_0x421292,_0x326887){return _0x421292[_0x8488('0xa')]('UserSmsQueue',attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c60=['define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','bluebird','./userSmsQueue.attributes','exports'];(function(_0x1f278f,_0xf6f601){var _0x43e9fa=function(_0x1a5335){while(--_0x1a5335){_0x1f278f['push'](_0x1f278f['shift']());}};_0x43e9fa(++_0xf6f601);}(_0x4c60,0xc1));var _0x04c6=function(_0x483b16,_0x156325){_0x483b16=_0x483b16-0x0;var _0x10e5e9=_0x4c60[_0x483b16];return _0x10e5e9;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var logger=require(_0x04c6('0x2'))(_0x04c6('0x3'));var moment=require('moment');var BPromise=require(_0x04c6('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(_0x04c6('0x5'));module[_0x04c6('0x6')]=function(_0x2054da,_0x12bd5d){return _0x2054da[_0x04c6('0x7')](_0x04c6('0x8'),attributes,{'tableName':_0x04c6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 22939ac..a936a06 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 _0xf151=['request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','UserSmsQueue,\x20%s,\x20%s'];(function(_0x20be36,_0x582452){var _0x2a02df=function(_0xe94922){while(--_0xe94922){_0x20be36['push'](_0x20be36['shift']());}};_0x2a02df(++_0x582452);}(_0xf151,0x152));var _0x1f15=function(_0x378f3c,_0x4f3522){_0x378f3c=_0x378f3c-0x0;var _0x2d2d0d=_0xf151[_0x378f3c];return _0x2d2d0d;};'use strict';var _=require(_0x1f15('0x0'));var util=require('util');var moment=require(_0x1f15('0x1'));var BPromise=require(_0x1f15('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f15('0x3'));var db=require(_0x1f15('0x4'))['db'];var utils=require(_0x1f15('0x5'));var logger=require(_0x1f15('0x6'))(_0x1f15('0x7'));var config=require(_0x1f15('0x8'));var jayson=require(_0x1f15('0x9'));var client=jayson[_0x1f15('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc32958,_0x1a16cf,_0x485781){return new BPromise(function(_0x410f18,_0x22f05d){return client['request'](_0xc32958,_0x485781)[_0x1f15('0xb')](function(_0x26e32f){logger[_0x1f15('0xc')](_0x1f15('0xd'),_0x1a16cf,_0x1f15('0xe'));logger[_0x1f15('0xf')](_0x1f15('0x10'),_0x1a16cf,'request\x20sent',JSON[_0x1f15('0x11')](_0x26e32f));if(_0x26e32f['error']){if(_0x26e32f[_0x1f15('0x12')][_0x1f15('0x13')]===0x1f4){logger[_0x1f15('0x12')](_0x1f15('0xd'),_0x1a16cf,_0x26e32f[_0x1f15('0x12')][_0x1f15('0x14')]);return _0x22f05d(_0x26e32f[_0x1f15('0x12')]['message']);}logger['error'](_0x1f15('0xd'),_0x1a16cf,_0x26e32f['error'][_0x1f15('0x14')]);return _0x410f18(_0x26e32f['error'][_0x1f15('0x14')]);}else{logger[_0x1f15('0xc')](_0x1f15('0xd'),_0x1a16cf,_0x1f15('0xe'));_0x410f18(_0x26e32f[_0x1f15('0x15')][_0x1f15('0x14')]);}})['catch'](function(_0x37d35b){logger[_0x1f15('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x1a16cf,_0x37d35b);_0x22f05d(_0x37d35b);});});} \ No newline at end of file +var _0x4278=['error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4278,0x168));var _0x8427=function(_0x35a072,_0x3a07cb){_0x35a072=_0x35a072-0x0;var _0x5071bb=_0x4278[_0x35a072];return _0x5071bb;};'use strict';var _=require(_0x8427('0x0'));var util=require(_0x8427('0x1'));var moment=require(_0x8427('0x2'));var BPromise=require(_0x8427('0x3'));var rs=require(_0x8427('0x4'));var fs=require('fs');var Redis=require(_0x8427('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8427('0x6'))(_0x8427('0x7'));var config=require('../../config/environment');var jayson=require(_0x8427('0x8'));var client=jayson[_0x8427('0x9')][_0x8427('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e8648,_0x18bacc,_0x1ae5ca){return new BPromise(function(_0x12d05a,_0x11fcb8){return client[_0x8427('0xb')](_0x1e8648,_0x1ae5ca)[_0x8427('0xc')](function(_0x563e76){logger[_0x8427('0xd')](_0x8427('0xe'),_0x18bacc,_0x8427('0xf'));logger['debug'](_0x8427('0x10'),_0x18bacc,_0x8427('0xf'),JSON[_0x8427('0x11')](_0x563e76));if(_0x563e76['error']){if(_0x563e76[_0x8427('0x12')][_0x8427('0x13')]===0x1f4){logger['error'](_0x8427('0xe'),_0x18bacc,_0x563e76['error'][_0x8427('0x14')]);return _0x11fcb8(_0x563e76[_0x8427('0x12')][_0x8427('0x14')]);}logger['error'](_0x8427('0xe'),_0x18bacc,_0x563e76[_0x8427('0x12')][_0x8427('0x14')]);return _0x12d05a(_0x563e76[_0x8427('0x12')][_0x8427('0x14')]);}else{logger[_0x8427('0xd')](_0x8427('0xe'),_0x18bacc,_0x8427('0xf'));_0x12d05a(_0x563e76['result'][_0x8427('0x14')]);}})['catch'](function(_0x29d1df){logger[_0x8427('0x12')](_0x8427('0xe'),_0x18bacc,_0x29d1df);_0x11fcb8(_0x29d1df);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index e03bfbb..f6e747c 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 _0x09d8=['exports','INTEGER','sequelize'];(function(_0x19cae9,_0xd6039b){var _0x163452=function(_0xee5d92){while(--_0xee5d92){_0x19cae9['push'](_0x19cae9['shift']());}};_0x163452(++_0xd6039b);}(_0x09d8,0x161));var _0x809d=function(_0x43af99,_0x4abfd3){_0x43af99=_0x43af99-0x0;var _0x590353=_0x09d8[_0x43af99];return _0x590353;};'use strict';var Sequelize=require(_0x809d('0x0'));module[_0x809d('0x1')]={'UserId':{'type':Sequelize[_0x809d('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x809d('0x2')]}}; \ No newline at end of file +var _0xd6af=['exports','INTEGER','sequelize'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd6af,0x1d3));var _0xfd6a=function(_0x3b0e76,_0x239221){_0x3b0e76=_0x3b0e76-0x0;var _0x1e4af4=_0xd6af[_0x3b0e76];return _0x1e4af4;};'use strict';var Sequelize=require(_0xfd6a('0x0'));module[_0xfd6a('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xfd6a('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index db9cf83..3d850ea 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(_0x23757a,_0x470fb3){var _0x5daa81=function(_0x1f42d9){while(--_0x1f42d9){_0x23757a['push'](_0x23757a['shift']());}};_0x5daa81(++_0x470fb3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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(_0x1825fd,_0x1a441a){var _0x5c3f61=function(_0x155461){while(--_0x155461){_0x1825fd['push'](_0x1825fd['shift']());}};_0x5c3f61(++_0x1a441a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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 54bb4df..577d920 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(_0x5caabb,_0x2b0cc1){var _0x2929d8=function(_0x389698){while(--_0x389698){_0x5caabb['push'](_0x5caabb['shift']());}};_0x2929d8(++_0x2b0cc1);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x323e07,_0x1fb729){var _0x1f95d8=function(_0x5948a3){while(--_0x5948a3){_0x323e07['push'](_0x323e07['shift']());}};_0x1f95d8(++_0x1fb729);}(_0xedd9,0xfc));var _0x9edd=function(_0x38e310,_0x429031){_0x38e310=_0x38e310-0x0;var _0x31865c=_0xedd9[_0x38e310];return _0x31865c;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 078a4b1..b306b2e 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 _0x62c0=['exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x62c0,0xef));var _0x062c=function(_0x2c6120,_0x1f3e60){_0x2c6120=_0x2c6120-0x0;var _0x5fb114=_0x62c0[_0x2c6120];return _0x5fb114;};'use strict';var Sequelize=require('sequelize');module[_0x062c('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb035=['INTEGER','sequelize'];(function(_0x3e5a06,_0x5a429a){var _0x520807=function(_0x104932){while(--_0x104932){_0x3e5a06['push'](_0x3e5a06['shift']());}};_0x520807(++_0x5a429a);}(_0xb035,0x87));var _0x5b03=function(_0x1e6eab,_0x216f5b){_0x1e6eab=_0x1e6eab-0x0;var _0x5f5517=_0xb035[_0x1e6eab];return _0x5f5517;};'use strict';var Sequelize=require(_0x5b03('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x5b03('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 8368908..6ae8b32 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 _0x040e=['bluebird','request-promise','../../config/environment','exports','define','UserVoiceQueue','user_has_voice_queues','util','moment'];(function(_0x5de214,_0x107e9d){var _0x4df627=function(_0x4199e1){while(--_0x4199e1){_0x5de214['push'](_0x5de214['shift']());}};_0x4df627(++_0x107e9d);}(_0x040e,0x130));var _0xe040=function(_0x227fda,_0x4f5ce6){_0x227fda=_0x227fda-0x0;var _0x40ba83=_0x040e[_0x227fda];return _0x40ba83;};'use strict';var _=require('lodash');var util=require(_0xe040('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xe040('0x1'));var BPromise=require(_0xe040('0x2'));var rp=require(_0xe040('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe040('0x4'));var attributes=require('./userVoiceQueue.attributes');module[_0xe040('0x5')]=function(_0x3dfda1,_0x53a746){return _0x3dfda1[_0xe040('0x6')](_0xe040('0x7'),attributes,{'tableName':_0xe040('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85e9=['define','UserVoiceQueue','user_has_voice_queues','../../config/logger','api','moment','bluebird','path','../../config/environment','./userVoiceQueue.attributes','exports'];(function(_0x2d1ff6,_0x182530){var _0x2f1298=function(_0x1af5b1){while(--_0x1af5b1){_0x2d1ff6['push'](_0x2d1ff6['shift']());}};_0x2f1298(++_0x182530);}(_0x85e9,0x121));var _0x985e=function(_0x4aa1b1,_0x56b523){_0x4aa1b1=_0x4aa1b1-0x0;var _0x1961c4=_0x85e9[_0x4aa1b1];return _0x1961c4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x985e('0x0'))(_0x985e('0x1'));var moment=require(_0x985e('0x2'));var BPromise=require(_0x985e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x985e('0x4'));var rimraf=require('rimraf');var config=require(_0x985e('0x5'));var attributes=require(_0x985e('0x6'));module[_0x985e('0x7')]=function(_0x3a00ab,_0xbf00ce){return _0x3a00ab[_0x985e('0x8')](_0x985e('0x9'),attributes,{'tableName':_0x985e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 0db1293..5b7f414 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 _0x29e4=['../../config/environment','jayson/promise','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x4c501c,_0x214551){var _0x2117eb=function(_0x52a205){while(--_0x52a205){_0x4c501c['push'](_0x4c501c['shift']());}};_0x2117eb(++_0x214551);}(_0x29e4,0x1f1));var _0x429e=function(_0x1b7b58,_0x262c48){_0x1b7b58=_0x1b7b58-0x0;var _0x2b4c93=_0x29e4[_0x1b7b58];return _0x2b4c93;};'use strict';var _=require('lodash');var util=require(_0x429e('0x0'));var moment=require(_0x429e('0x1'));var BPromise=require(_0x429e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x429e('0x3'));var db=require(_0x429e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x429e('0x5'))(_0x429e('0x6'));var config=require(_0x429e('0x7'));var jayson=require(_0x429e('0x8'));var client=jayson['client'][_0x429e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5378f1,_0x4faf7b,_0x542e3e){return new BPromise(function(_0x158f98,_0x46d7ed){return client[_0x429e('0xa')](_0x5378f1,_0x542e3e)[_0x429e('0xb')](function(_0x228126){logger[_0x429e('0xc')](_0x429e('0xd'),_0x4faf7b,_0x429e('0xe'));logger['debug'](_0x429e('0xf'),_0x4faf7b,_0x429e('0xe'),JSON['stringify'](_0x228126));if(_0x228126['error']){if(_0x228126[_0x429e('0x10')][_0x429e('0x11')]===0x1f4){logger[_0x429e('0x10')](_0x429e('0xd'),_0x4faf7b,_0x228126['error'][_0x429e('0x12')]);return _0x46d7ed(_0x228126[_0x429e('0x10')][_0x429e('0x12')]);}logger[_0x429e('0x10')](_0x429e('0xd'),_0x4faf7b,_0x228126['error']['message']);return _0x158f98(_0x228126[_0x429e('0x10')][_0x429e('0x12')]);}else{logger['info'](_0x429e('0xd'),_0x4faf7b,_0x429e('0xe'));_0x158f98(_0x228126[_0x429e('0x13')][_0x429e('0x12')]);}})[_0x429e('0x14')](function(_0x2c7470){logger[_0x429e('0x10')](_0x429e('0xd'),_0x4faf7b,_0x2c7470);_0x46d7ed(_0x2c7470);});});} \ No newline at end of file +var _0xaba7=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash'];(function(_0x531c31,_0x30804e){var _0x234a39=function(_0x38f39f){while(--_0x38f39f){_0x531c31['push'](_0x531c31['shift']());}};_0x234a39(++_0x30804e);}(_0xaba7,0x1e2));var _0x7aba=function(_0x35245d,_0x193583){_0x35245d=_0x35245d-0x0;var _0x184a83=_0xaba7[_0x35245d];return _0x184a83;};'use strict';var _=require(_0x7aba('0x0'));var util=require(_0x7aba('0x1'));var moment=require(_0x7aba('0x2'));var BPromise=require(_0x7aba('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7aba('0x4'));var db=require(_0x7aba('0x5'))['db'];var utils=require(_0x7aba('0x6'));var logger=require(_0x7aba('0x7'))(_0x7aba('0x8'));var config=require(_0x7aba('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7aba('0xa')][_0x7aba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x324fbc,_0x17baf3,_0x4e4250){return new BPromise(function(_0x3d209c,_0x512d3f){return client['request'](_0x324fbc,_0x4e4250)[_0x7aba('0xc')](function(_0x577b90){logger['info'](_0x7aba('0xd'),_0x17baf3,_0x7aba('0xe'));logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x17baf3,_0x7aba('0xe'),JSON[_0x7aba('0xf')](_0x577b90));if(_0x577b90[_0x7aba('0x10')]){if(_0x577b90['error']['code']===0x1f4){logger['error'](_0x7aba('0xd'),_0x17baf3,_0x577b90['error'][_0x7aba('0x11')]);return _0x512d3f(_0x577b90['error']['message']);}logger[_0x7aba('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x17baf3,_0x577b90[_0x7aba('0x10')][_0x7aba('0x11')]);return _0x3d209c(_0x577b90['error'][_0x7aba('0x11')]);}else{logger[_0x7aba('0x12')](_0x7aba('0xd'),_0x17baf3,_0x7aba('0xe'));_0x3d209c(_0x577b90[_0x7aba('0x13')][_0x7aba('0x11')]);}})[_0x7aba('0x14')](function(_0x1574d3){logger[_0x7aba('0x10')](_0x7aba('0xd'),_0x17baf3,_0x1574d3);_0x512d3f(_0x1574d3);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index dbdddf9..46d31be 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1a1fa7,_0x355fa4){var _0x263efe=function(_0x37a46c){while(--_0x37a46c){_0x1a1fa7['push'](_0x1a1fa7['shift']());}};_0x263efe(++_0x355fa4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x231a47,_0x46a963){var _0x48d7c9=function(_0x1e69b1){while(--_0x1e69b1){_0x231a47['push'](_0x231a47['shift']());}};_0x48d7c9(++_0x46a963);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index ec7f34e..f6c1837 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 _0x8784=['Required\x20by\x20Asterisk','STRING','INTEGER','queue_interface','sequelize','exports'];(function(_0x1efbd3,_0x6102b3){var _0x2a4623=function(_0x31ff3b){while(--_0x31ff3b){_0x1efbd3['push'](_0x1efbd3['shift']());}};_0x2a4623(++_0x6102b3);}(_0x8784,0x172));var _0x4878=function(_0xee3051,_0xbe4f18){_0xee3051=_0xee3051-0x0;var _0x139e81=_0x8784[_0xee3051];return _0x139e81;};'use strict';var Sequelize=require(_0x4878('0x0'));module[_0x4878('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x4878('0x2')},'membername':{'type':Sequelize[_0x4878('0x3')],'allowNull':![],'comment':_0x4878('0x2')},'UserId':{'type':Sequelize[_0x4878('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x4878('0x3')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x4878('0x4')],'allowNull':![]},'interface':{'type':Sequelize[_0x4878('0x3')],'allowNull':![],'unique':_0x4878('0x5'),'comment':_0x4878('0x2')},'penalty':{'type':Sequelize[_0x4878('0x4')](0xb),'defaultValue':0x0,'comment':_0x4878('0x2')},'paused':{'type':Sequelize[_0x4878('0x4')](0xb),'defaultValue':0x0,'comment':_0x4878('0x2')}}; \ No newline at end of file +var _0x0369=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0369,0x113));var _0x9036=function(_0x3ed1da,_0x3235fb){_0x3ed1da=_0x3ed1da-0x0;var _0x2135a6=_0x0369[_0x3ed1da];return _0x2135a6;};'use strict';var Sequelize=require(_0x9036('0x0'));module[_0x9036('0x1')]={'uniqueid':{'type':Sequelize[_0x9036('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x9036('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x9036('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x9036('0x4')],'allowNull':![],'unique':_0x9036('0x5'),'comment':_0x9036('0x3')},'VoiceQueueId':{'type':Sequelize[_0x9036('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x9036('0x4')],'allowNull':![],'unique':_0x9036('0x5'),'comment':_0x9036('0x3')},'penalty':{'type':Sequelize[_0x9036('0x2')](0xb),'defaultValue':0x0,'comment':_0x9036('0x3')},'paused':{'type':Sequelize[_0x9036('0x2')](0xb),'defaultValue':0x0,'comment':_0x9036('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 678b648..2db1632 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 _0x0081=['emit','hasOwnProperty','exports','events','UserVoiceQueueRt','save'];(function(_0x8c3bf6,_0x14bc65){var _0x588e27=function(_0x59587b){while(--_0x59587b){_0x8c3bf6['push'](_0x8c3bf6['shift']());}};_0x588e27(++_0x14bc65);}(_0x0081,0xe7));var _0x1008=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x0081[_0x13d07a];return _0x5ee0ee;};'use strict';var EventEmitter=require(_0x1008('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x1008('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1008('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xe246d5){return function(_0x31a45b,_0x4e9e67,_0x3d6ead){UserVoiceQueueRtEvents[_0x1008('0x3')](_0xe246d5+':'+_0x31a45b['id'],_0x31a45b);UserVoiceQueueRtEvents['emit'](_0xe246d5,_0x31a45b);_0x3d6ead(null);};}for(var e in events){if(events[_0x1008('0x4')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x1008('0x5')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xbecd=['setMaxListeners','update','remove','hook','exports','events','UserVoiceQueueRt'];(function(_0xf20f1b,_0x54dd56){var _0x52c8c9=function(_0xdd2183){while(--_0xdd2183){_0xf20f1b['push'](_0xf20f1b['shift']());}};_0x52c8c9(++_0x54dd56);}(_0xbecd,0xe5));var _0xdbec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbecd[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xdbec('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xdbec('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xdbec('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdbec('0x3'),'afterDestroy':_0xdbec('0x4')};function emitEvent(_0xe2bd15){return function(_0x4fe68a,_0x3df5eb,_0x64a98a){UserVoiceQueueRtEvents['emit'](_0xe2bd15+':'+_0x4fe68a['id'],_0x4fe68a);UserVoiceQueueRtEvents['emit'](_0xe2bd15,_0x4fe68a);_0x64a98a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xdbec('0x5')](e,emitEvent(event));}}module[_0xdbec('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 087af61..0c2380d 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 _0x39f2=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt','lodash'];(function(_0x1a0f01,_0x3a3e19){var _0x8ef98b=function(_0x539522){while(--_0x539522){_0x1a0f01['push'](_0x1a0f01['shift']());}};_0x8ef98b(++_0x3a3e19);}(_0x39f2,0xba));var _0x239f=function(_0x17906b,_0x2d6f8d){_0x17906b=_0x17906b-0x0;var _0x36eaf9=_0x39f2[_0x17906b];return _0x36eaf9;};'use strict';var _=require(_0x239f('0x0'));var util=require('util');var logger=require(_0x239f('0x1'))('api');var moment=require(_0x239f('0x2'));var BPromise=require(_0x239f('0x3'));var rp=require(_0x239f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x239f('0x5'));var config=require(_0x239f('0x6'));var attributes=require(_0x239f('0x7'));module[_0x239f('0x8')]=function(_0x1a91dd,_0x58ceb2){return _0x1a91dd['define'](_0x239f('0x9'),attributes,{'tableName':_0x239f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5ce=['exports','UserVoiceQueueRt','user_has_voice_queues_rt','../../config/logger','moment','bluebird','request-promise','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x271786,_0x1c924a){var _0x9bf927=function(_0x45b7c0){while(--_0x45b7c0){_0x271786['push'](_0x271786['shift']());}};_0x9bf927(++_0x1c924a);}(_0xb5ce,0x123));var _0xeb5c=function(_0x378395,_0x4ec398){_0x378395=_0x378395-0x0;var _0xdd23ca=_0xb5ce[_0x378395];return _0xdd23ca;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeb5c('0x0'))('api');var moment=require(_0xeb5c('0x1'));var BPromise=require(_0xeb5c('0x2'));var rp=require(_0xeb5c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xeb5c('0x4'));var attributes=require(_0xeb5c('0x5'));module[_0xeb5c('0x6')]=function(_0x1d0401,_0x2ca240){return _0x1d0401['define'](_0xeb5c('0x7'),attributes,{'tableName':_0xeb5c('0x8'),'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 ea94512..e4fcfcf 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 _0x8f93=['literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','then','info','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','sequelize','COUNT'];(function(_0x21cb7f,_0x48cd16){var _0x5a079a=function(_0x569a4f){while(--_0x569a4f){_0x21cb7f['push'](_0x21cb7f['shift']());}};_0x5a079a(++_0x48cd16);}(_0x8f93,0xbd));var _0x38f9=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x8f93[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x38f9('0x0'));var util=require(_0x38f9('0x1'));var moment=require(_0x38f9('0x2'));var BPromise=require('bluebird');var rs=require(_0x38f9('0x3'));var fs=require('fs');var Redis=require(_0x38f9('0x4'));var db=require(_0x38f9('0x5'))['db'];var utils=require(_0x38f9('0x6'));var logger=require(_0x38f9('0x7'))(_0x38f9('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x38f9('0x9')][_0x38f9('0xa')]({'port':0x232a});config[_0x38f9('0xb')]=_[_0x38f9('0xc')](config[_0x38f9('0xb')],{'host':_0x38f9('0xd'),'port':0x18eb});var socket=require(_0x38f9('0xe'))(new Redis(config[_0x38f9('0xb')]));require(_0x38f9('0xf'))[_0x38f9('0x10')](socket);function respondWithRpcPromise(_0x10a32d,_0xf42e92,_0x5bb9f5){return new BPromise(function(_0x714a00,_0x3efee2){return client['request'](_0x10a32d,_0x5bb9f5)[_0x38f9('0x11')](function(_0x1fdd91){logger[_0x38f9('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xf42e92,_0x38f9('0x13'));logger['debug'](_0x38f9('0x14'),_0xf42e92,_0x38f9('0x13'),JSON[_0x38f9('0x15')](_0x1fdd91));if(_0x1fdd91['error']){if(_0x1fdd91[_0x38f9('0x16')][_0x38f9('0x17')]===0x1f4){logger[_0x38f9('0x16')](_0x38f9('0x18'),_0xf42e92,_0x1fdd91['error'][_0x38f9('0x19')]);return _0x3efee2(_0x1fdd91['error'][_0x38f9('0x19')]);}logger[_0x38f9('0x16')](_0x38f9('0x18'),_0xf42e92,_0x1fdd91[_0x38f9('0x16')][_0x38f9('0x19')]);return _0x714a00(_0x1fdd91[_0x38f9('0x16')][_0x38f9('0x19')]);}else{logger[_0x38f9('0x12')](_0x38f9('0x18'),_0xf42e92,_0x38f9('0x13'));_0x714a00(_0x1fdd91[_0x38f9('0x1a')][_0x38f9('0x19')]);}})[_0x38f9('0x1b')](function(_0x4be0e2){logger[_0x38f9('0x16')](_0x38f9('0x18'),_0xf42e92,_0x4be0e2);_0x3efee2(_0x4be0e2);});});}exports[_0x38f9('0x1c')]=function(_0x29bedf){var _0x498a08=this;return new Promise(function(_0x653e67,_0x4a10f0){return db[_0x38f9('0x1d')]['findAll']({'raw':_0x29bedf[_0x38f9('0x1e')]?_0x29bedf[_0x38f9('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x29bedf[_0x38f9('0x1e')]?_0x29bedf[_0x38f9('0x1e')]['where']||null:null,'attributes':[[db[_0x38f9('0x1f')]['fn'](_0x38f9('0x20'),db[_0x38f9('0x1f')]['fn']('IF',db[_0x38f9('0x1f')][_0x38f9('0x21')](_0x38f9('0x22')))),_0x38f9('0x23')]]})['then'](function(_0xcc891e){logger['info']('GetVoiceQueueRtPauses',_0x29bedf);logger[_0x38f9('0x24')](_0x38f9('0x1c'),_0x29bedf,JSON[_0x38f9('0x15')](_0xcc891e));_0x653e67(_0xcc891e);})[_0x38f9('0x1b')](function(_0x43bb32){logger[_0x38f9('0x16')](_0x38f9('0x1c'),_0x43bb32['message'],_0x29bedf);_0x4a10f0(_0x498a08[_0x38f9('0x16')](0x1f4,_0x43bb32[_0x38f9('0x19')]));});});}; \ No newline at end of file +var _0x57f2=['options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','stringify','catch','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','error','code','GetVoiceQueueRtPauses','UserVoiceQueueRt'];(function(_0x42b671,_0x2a1428){var _0x3f5df0=function(_0x184102){while(--_0x184102){_0x42b671['push'](_0x42b671['shift']());}};_0x3f5df0(++_0x2a1428);}(_0x57f2,0xba));var _0x257f=function(_0x16971e,_0x387c80){_0x16971e=_0x16971e-0x0;var _0x3a6ba7=_0x57f2[_0x16971e];return _0x3a6ba7;};'use strict';var _=require(_0x257f('0x0'));var util=require('util');var moment=require(_0x257f('0x1'));var BPromise=require(_0x257f('0x2'));var rs=require(_0x257f('0x3'));var fs=require('fs');var Redis=require(_0x257f('0x4'));var db=require(_0x257f('0x5'))['db'];var utils=require(_0x257f('0x6'));var logger=require(_0x257f('0x7'))(_0x257f('0x8'));var config=require(_0x257f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x257f('0xa')][_0x257f('0xb')]({'port':0x232a});config['redis']=_[_0x257f('0xc')](config[_0x257f('0xd')],{'host':_0x257f('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x257f('0xd')]));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x500cee,_0x2e8269,_0x769270){return new BPromise(function(_0x454c55,_0x13166f){return client['request'](_0x500cee,_0x769270)[_0x257f('0xf')](function(_0x4509cf){logger[_0x257f('0x10')](_0x257f('0x11'),_0x2e8269,_0x257f('0x12'));logger[_0x257f('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x2e8269,'request\x20sent',JSON['stringify'](_0x4509cf));if(_0x4509cf[_0x257f('0x14')]){if(_0x4509cf['error'][_0x257f('0x15')]===0x1f4){logger[_0x257f('0x14')](_0x257f('0x11'),_0x2e8269,_0x4509cf['error']['message']);return _0x13166f(_0x4509cf[_0x257f('0x14')]['message']);}logger[_0x257f('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2e8269,_0x4509cf[_0x257f('0x14')]['message']);return _0x454c55(_0x4509cf[_0x257f('0x14')]['message']);}else{logger[_0x257f('0x10')](_0x257f('0x11'),_0x2e8269,_0x257f('0x12'));_0x454c55(_0x4509cf['result']['message']);}})['catch'](function(_0x3f9a67){logger[_0x257f('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2e8269,_0x3f9a67);_0x13166f(_0x3f9a67);});});}exports[_0x257f('0x16')]=function(_0x13153f){var _0xfb7dfc=this;return new Promise(function(_0x2cfc82,_0x2aa30c){return db[_0x257f('0x17')]['findAll']({'raw':_0x13153f[_0x257f('0x18')]?_0x13153f['options'][_0x257f('0x19')]===undefined?!![]:![]:!![],'where':_0x13153f['options']?_0x13153f[_0x257f('0x18')][_0x257f('0x1a')]||null:null,'attributes':[[db[_0x257f('0x1b')]['fn'](_0x257f('0x1c'),db[_0x257f('0x1b')]['fn']('IF',db[_0x257f('0x1b')][_0x257f('0x1d')](_0x257f('0x1e')))),_0x257f('0x1f')]]})['then'](function(_0x461d82){logger[_0x257f('0x10')](_0x257f('0x16'),_0x13153f);logger[_0x257f('0x13')](_0x257f('0x16'),_0x13153f,JSON[_0x257f('0x20')](_0x461d82));_0x2cfc82(_0x461d82);})[_0x257f('0x21')](function(_0x1041ad){logger['error']('GetVoiceQueueRtPauses',_0x1041ad[_0x257f('0x22')],_0x13153f);_0x2aa30c(_0xfb7dfc['error'](0x1f4,_0x1041ad[_0x257f('0x22')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 305a4ea..c0e5907 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 _0x4491=['remove','emit','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events'];(function(_0x443bdd,_0x517654){var _0x3a1e48=function(_0x3a7e26){while(--_0x3a7e26){_0x443bdd['push'](_0x443bdd['shift']());}};_0x3a1e48(++_0x517654);}(_0x4491,0x1bb));var _0x1449=function(_0x20961a,_0x1aa2ad){_0x20961a=_0x20961a-0x0;var _0x95ad96=_0x4491[_0x20961a];return _0x95ad96;};'use strict';var UserVoiceQueueRtEvents=require(_0x1449('0x0'));var events=['save',_0x1449('0x1'),'update'];function createListener(_0x4273ee,_0x176880){return function(_0x45474c){_0x176880[_0x1449('0x2')](_0x4273ee,_0x45474c);};}function removeListener(_0x1ff47f,_0x1b2870){return function(){UserVoiceQueueRtEvents['removeListener'](_0x1ff47f,_0x1b2870);};}exports[_0x1449('0x3')]=function(_0x557482){for(var _0x1d45eb=0x0,_0x5dfe4c=events[_0x1449('0x4')];_0x1d45eb<_0x5dfe4c;_0x1d45eb++){var _0x2f4189=events[_0x1d45eb];var _0x10e119=createListener(_0x1449('0x5')+_0x2f4189,_0x557482);UserVoiceQueueRtEvents['on'](_0x2f4189,_0x10e119);}}; \ No newline at end of file +var _0x0cfe=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','update','removeListener','register'];(function(_0x2af02e,_0x552bbb){var _0x5cde71=function(_0x2f6d92){while(--_0x2f6d92){_0x2af02e['push'](_0x2af02e['shift']());}};_0x5cde71(++_0x552bbb);}(_0x0cfe,0x9c));var _0xe0cf=function(_0x278cca,_0x4e2cc9){_0x278cca=_0x278cca-0x0;var _0x235a3e=_0x0cfe[_0x278cca];return _0x235a3e;};'use strict';var UserVoiceQueueRtEvents=require(_0xe0cf('0x0'));var events=['save',_0xe0cf('0x1'),_0xe0cf('0x2')];function createListener(_0x29c07f,_0x58f8e9){return function(_0x1b0629){_0x58f8e9['emit'](_0x29c07f,_0x1b0629);};}function removeListener(_0x37e782,_0x156fe0){return function(){UserVoiceQueueRtEvents[_0xe0cf('0x3')](_0x37e782,_0x156fe0);};}exports[_0xe0cf('0x4')]=function(_0x58a4f7){for(var _0x27c9ca=0x0,_0x2abd29=events[_0xe0cf('0x5')];_0x27c9ca<_0x2abd29;_0x27c9ca++){var _0x518995=events[_0x27c9ca];var _0x2c4c48=createListener(_0xe0cf('0x6')+_0x518995,_0x58a4f7);UserVoiceQueueRtEvents['on'](_0x518995,_0x2c4c48);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index d838bea..712dbc1 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x49c297,_0x5645ce){var _0x3d99ef=function(_0x436a80){while(--_0x436a80){_0x49c297['push'](_0x49c297['shift']());}};_0x3d99ef(++_0x5645ce);}(_0x70e0,0x17b));var _0x070e=function(_0x3a4a7c,_0x455e8a){_0x3a4a7c=_0x3a4a7c-0x0;var _0x54ab3e=_0x70e0[_0x3a4a7c];return _0x54ab3e;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x21a945,_0xd54544){var _0x519fc9=function(_0x314ef4){while(--_0x314ef4){_0x21a945['push'](_0x21a945['shift']());}};_0x519fc9(++_0xd54544);}(_0xe706,0xa3));var _0x6e70=function(_0x5751e6,_0x125e5e){_0x5751e6=_0x5751e6-0x0;var _0x4199e4=_0xe706[_0x5751e6];return _0x4199e4;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 2c5e685..9ff5c09 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 _0x5092=['sequelize','exports','INTEGER'];(function(_0x34eb7f,_0x59c028){var _0x441acb=function(_0x4f7acc){while(--_0x4f7acc){_0x34eb7f['push'](_0x34eb7f['shift']());}};_0x441acb(++_0x59c028);}(_0x5092,0x147));var _0x2509=function(_0x125e09,_0xe1fb10){_0x125e09=_0x125e09-0x0;var _0x2fd934=_0x5092[_0x125e09];return _0x2fd934;};'use strict';var Sequelize=require(_0x2509('0x0'));module[_0x2509('0x1')]={'penalty':{'type':Sequelize[_0x2509('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7a79=['exports','sequelize'];(function(_0x83d08e,_0x228942){var _0x404d4f=function(_0x161ce){while(--_0x161ce){_0x83d08e['push'](_0x83d08e['shift']());}};_0x404d4f(++_0x228942);}(_0x7a79,0x187));var _0x97a7=function(_0x26cc16,_0x4c174f){_0x26cc16=_0x26cc16-0x0;var _0x345e3e=_0x7a79[_0x26cc16];return _0x345e3e;};'use strict';var Sequelize=require(_0x97a7('0x0'));module[_0x97a7('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 a83f5f3..337b885 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 _0xc6b8=['UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger','api','bluebird','request-promise','path','./userWhatsappQueue.attributes','exports','define'];(function(_0x55e7d7,_0x4ddbc1){var _0x389730=function(_0x46ffbb){while(--_0x46ffbb){_0x55e7d7['push'](_0x55e7d7['shift']());}};_0x389730(++_0x4ddbc1);}(_0xc6b8,0x18e));var _0x8c6b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc6b8[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x8c6b('0x0'));var logger=require(_0x8c6b('0x1'))(_0x8c6b('0x2'));var moment=require('moment');var BPromise=require(_0x8c6b('0x3'));var rp=require(_0x8c6b('0x4'));var fs=require('fs');var path=require(_0x8c6b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8c6b('0x6'));module[_0x8c6b('0x7')]=function(_0x49f936,_0x2b85a0){return _0x49f936[_0x8c6b('0x8')](_0x8c6b('0x9'),attributes,{'tableName':_0x8c6b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2992=['user_has_whatsapp_queues','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./userWhatsappQueue.attributes','define','UserWhatsappQueue'];(function(_0x1816b1,_0x2e913a){var _0x207f7c=function(_0x2309e5){while(--_0x2309e5){_0x1816b1['push'](_0x1816b1['shift']());}};_0x207f7c(++_0x2e913a);}(_0x2992,0x175));var _0x2299=function(_0xe9f4a2,_0x50f0c4){_0xe9f4a2=_0xe9f4a2-0x0;var _0x25e066=_0x2992[_0xe9f4a2];return _0x25e066;};'use strict';var _=require(_0x2299('0x0'));var util=require(_0x2299('0x1'));var logger=require('../../config/logger')(_0x2299('0x2'));var moment=require(_0x2299('0x3'));var BPromise=require(_0x2299('0x4'));var rp=require(_0x2299('0x5'));var fs=require('fs');var path=require(_0x2299('0x6'));var rimraf=require('rimraf');var config=require(_0x2299('0x7'));var attributes=require(_0x2299('0x8'));module['exports']=function(_0x2ab624,_0x13d387){return _0x2ab624[_0x2299('0x9')](_0x2299('0xa'),attributes,{'tableName':_0x2299('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 9cecf3f..0be91bc 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 _0x45ec=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x3cb9b5,_0x5e86dd){var _0x3c4949=function(_0x512e37){while(--_0x512e37){_0x3cb9b5['push'](_0x3cb9b5['shift']());}};_0x3c4949(++_0x5e86dd);}(_0x45ec,0x65));var _0xc45e=function(_0x48fde1,_0x52b4c2){_0x48fde1=_0x48fde1-0x0;var _0x1d01dc=_0x45ec[_0x48fde1];return _0x1d01dc;};'use strict';var _=require(_0xc45e('0x0'));var util=require(_0xc45e('0x1'));var moment=require('moment');var BPromise=require(_0xc45e('0x2'));var rs=require(_0xc45e('0x3'));var fs=require('fs');var Redis=require(_0xc45e('0x4'));var db=require(_0xc45e('0x5'))['db'];var utils=require(_0xc45e('0x6'));var logger=require('../../config/logger')(_0xc45e('0x7'));var config=require(_0xc45e('0x8'));var jayson=require(_0xc45e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x22ced2,_0x10c5ba,_0x4dc7ef){return new BPromise(function(_0x484eac,_0x53c2ce){return client[_0xc45e('0xa')](_0x22ced2,_0x4dc7ef)['then'](function(_0x5b7745){logger[_0xc45e('0xb')](_0xc45e('0xc'),_0x10c5ba,_0xc45e('0xd'));logger['debug'](_0xc45e('0xe'),_0x10c5ba,_0xc45e('0xd'),JSON[_0xc45e('0xf')](_0x5b7745));if(_0x5b7745[_0xc45e('0x10')]){if(_0x5b7745[_0xc45e('0x10')][_0xc45e('0x11')]===0x1f4){logger[_0xc45e('0x10')](_0xc45e('0xc'),_0x10c5ba,_0x5b7745[_0xc45e('0x10')]['message']);return _0x53c2ce(_0x5b7745['error'][_0xc45e('0x12')]);}logger[_0xc45e('0x10')]('UserWhatsappQueue,\x20%s,\x20%s',_0x10c5ba,_0x5b7745[_0xc45e('0x10')][_0xc45e('0x12')]);return _0x484eac(_0x5b7745[_0xc45e('0x10')]['message']);}else{logger[_0xc45e('0xb')](_0xc45e('0xc'),_0x10c5ba,'request\x20sent');_0x484eac(_0x5b7745[_0xc45e('0x13')][_0xc45e('0x12')]);}})[_0xc45e('0x14')](function(_0x3318c3){logger[_0xc45e('0x10')](_0xc45e('0xc'),_0x10c5ba,_0x3318c3);_0x53c2ce(_0x3318c3);});});} \ No newline at end of file +var _0xde46=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x4e810a,_0x240265){var _0x4e49bb=function(_0x1fb31d){while(--_0x1fb31d){_0x4e810a['push'](_0x4e810a['shift']());}};_0x4e49bb(++_0x240265);}(_0xde46,0x1a8));var _0x6de4=function(_0x3d00cc,_0x1fb987){_0x3d00cc=_0x3d00cc-0x0;var _0x10601a=_0xde46[_0x3d00cc];return _0x10601a;};'use strict';var _=require(_0x6de4('0x0'));var util=require(_0x6de4('0x1'));var moment=require(_0x6de4('0x2'));var BPromise=require(_0x6de4('0x3'));var rs=require(_0x6de4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6de4('0x5'))['db'];var utils=require(_0x6de4('0x6'));var logger=require(_0x6de4('0x7'))(_0x6de4('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6de4('0x9')][_0x6de4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d97bd,_0x4749d9,_0x48a3bd){return new BPromise(function(_0xe78387,_0x2a6a0f){return client[_0x6de4('0xb')](_0x2d97bd,_0x48a3bd)['then'](function(_0x8692ff){logger['info'](_0x6de4('0xc'),_0x4749d9,_0x6de4('0xd'));logger['debug'](_0x6de4('0xe'),_0x4749d9,'request\x20sent',JSON['stringify'](_0x8692ff));if(_0x8692ff[_0x6de4('0xf')]){if(_0x8692ff[_0x6de4('0xf')][_0x6de4('0x10')]===0x1f4){logger[_0x6de4('0xf')](_0x6de4('0xc'),_0x4749d9,_0x8692ff['error'][_0x6de4('0x11')]);return _0x2a6a0f(_0x8692ff[_0x6de4('0xf')]['message']);}logger[_0x6de4('0xf')](_0x6de4('0xc'),_0x4749d9,_0x8692ff[_0x6de4('0xf')][_0x6de4('0x11')]);return _0xe78387(_0x8692ff['error'][_0x6de4('0x11')]);}else{logger[_0x6de4('0x12')](_0x6de4('0xc'),_0x4749d9,_0x6de4('0xd'));_0xe78387(_0x8692ff[_0x6de4('0x13')]['message']);}})[_0x6de4('0x14')](function(_0x263316){logger[_0x6de4('0xf')](_0x6de4('0xc'),_0x4749d9,_0x263316);_0x2a6a0f(_0x263316);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 3337a32..148262a 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 _0x8bdf=['update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','/:id','isAuthenticated','show','post','create','put'];(function(_0x20713e,_0x44f710){var _0x7d998b=function(_0x5d98ab){while(--_0x5d98ab){_0x20713e['push'](_0x20713e['shift']());}};_0x7d998b(++_0x44f710);}(_0x8bdf,0x1a7));var _0xf8bd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8bdf[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xf8bd('0x0'));var util=require(_0xf8bd('0x1'));var path=require(_0xf8bd('0x2'));var timeout=require(_0xf8bd('0x3'));var express=require(_0xf8bd('0x4'));var router=express['Router']();var fs_extra=require(_0xf8bd('0x5'));var auth=require(_0xf8bd('0x6'));var interaction=require(_0xf8bd('0x7'));var config=require(_0xf8bd('0x8'));var controller=require(_0xf8bd('0x9'));router[_0xf8bd('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf8bd('0xb'),auth[_0xf8bd('0xc')](),controller[_0xf8bd('0xd')]);router[_0xf8bd('0xe')]('/',auth['isAuthenticated'](),controller[_0xf8bd('0xf')]);router[_0xf8bd('0x10')]('/:id',auth[_0xf8bd('0xc')](),controller[_0xf8bd('0x11')]);router['delete'](_0xf8bd('0xb'),auth[_0xf8bd('0xc')](),controller[_0xf8bd('0x12')]);module[_0xf8bd('0x13')]=router; \ No newline at end of file +var _0xf6fb=['isAuthenticated','index','/:id','show','create','put','destroy','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./variable.controller','get'];(function(_0x1d8514,_0x506853){var _0x173564=function(_0x56d804){while(--_0x56d804){_0x1d8514['push'](_0x1d8514['shift']());}};_0x173564(++_0x506853);}(_0xf6fb,0x111));var _0xbf6f=function(_0x373e38,_0x170f16){_0x373e38=_0x373e38-0x0;var _0x15429f=_0xf6fb[_0x373e38];return _0x15429f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbf6f('0x0'));var timeout=require(_0xbf6f('0x1'));var express=require('express');var router=express[_0xbf6f('0x2')]();var fs_extra=require(_0xbf6f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xbf6f('0x4'));var config=require('../../config/environment');var controller=require(_0xbf6f('0x5'));router[_0xbf6f('0x6')]('/',auth[_0xbf6f('0x7')](),controller[_0xbf6f('0x8')]);router[_0xbf6f('0x6')](_0xbf6f('0x9'),auth[_0xbf6f('0x7')](),controller[_0xbf6f('0xa')]);router['post']('/',auth[_0xbf6f('0x7')](),controller[_0xbf6f('0xb')]);router[_0xbf6f('0xc')](_0xbf6f('0x9'),auth[_0xbf6f('0x7')](),controller['update']);router['delete'](_0xbf6f('0x9'),auth[_0xbf6f('0x7')](),controller[_0xbf6f('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 7c2584e..59abcd2 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 _0xa5a3=['sequelize','exports','STRING','name'];(function(_0x868522,_0x2e961a){var _0x15b20c=function(_0x417645){while(--_0x417645){_0x868522['push'](_0x868522['shift']());}};_0x15b20c(++_0x2e961a);}(_0xa5a3,0x7c));var _0x3a5a=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xa5a3[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require(_0x3a5a('0x0'));module[_0x3a5a('0x1')]={'name':{'type':Sequelize[_0x3a5a('0x2')],'unique':_0x3a5a('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3a5a('0x2')]}}; \ No newline at end of file +var _0x19dd=['name','sequelize','STRING'];(function(_0x1e72cc,_0x1dab88){var _0x4ea1fa=function(_0x23ff77){while(--_0x23ff77){_0x1e72cc['push'](_0x1e72cc['shift']());}};_0x4ea1fa(++_0x1dab88);}(_0x19dd,0x18a));var _0xd19d=function(_0x163464,_0x51e2d8){_0x163464=_0x163464-0x0;var _0x4c3a04=_0x19dd[_0x163464];return _0x4c3a04;};'use strict';var Sequelize=require(_0xd19d('0x0'));module['exports']={'name':{'type':Sequelize[_0xd19d('0x1')],'unique':_0xd19d('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd19d('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index bf4b79c..130543e 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 _0x4826=['hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length'];(function(_0x47df54,_0x1aeb61){var _0x261b87=function(_0x54bc77){while(--_0x54bc77){_0x47df54['push'](_0x47df54['shift']());}};_0x261b87(++_0x1aeb61);}(_0x4826,0x14e));var _0x6482=function(_0x59f5a2,_0x577938){_0x59f5a2=_0x59f5a2-0x0;var _0x28e41a=_0x4826[_0x59f5a2];return _0x28e41a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6482('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6482('0x1'));var rp=require('request-promise');var moment=require(_0x6482('0x2'));var BPromise=require(_0x6482('0x3'));var Mustache=require(_0x6482('0x4'));var util=require('util');var path=require('path');var sox=require(_0x6482('0x5'));var csv=require(_0x6482('0x6'));var ejs=require(_0x6482('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6482('0x8'));var squel=require('squel');var crypto=require(_0x6482('0x9'));var jsforce=require(_0x6482('0xa'));var deskjs=require(_0x6482('0xb'));var toCsv=require(_0x6482('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6482('0xc'));var qs=require(_0x6482('0xd'));var as=require(_0x6482('0xe'));var hardwareService=require(_0x6482('0xf'));var logger=require('../../config/logger')(_0x6482('0x10'));var utils=require('../../config/utils');var config=require(_0x6482('0x11'));var licenseUtil=require(_0x6482('0x12'));var db=require(_0x6482('0x13'))['db'];function respondWithStatusCode(_0x94ab88,_0xa43684){_0xa43684=_0xa43684||0xcc;return function(_0x193a31){if(_0x193a31){return _0x94ab88[_0x6482('0x14')](_0xa43684);}return _0x94ab88[_0x6482('0x15')](_0xa43684)[_0x6482('0x16')]();};}function respondWithResult(_0xfa5648,_0x3450eb){_0x3450eb=_0x3450eb||0xc8;return function(_0x355935){if(_0x355935){return _0xfa5648[_0x6482('0x15')](_0x3450eb)[_0x6482('0x17')](_0x355935);}};}function respondWithFilteredResult(_0x179440,_0x517e6c){return function(_0x4c15bc){if(_0x4c15bc){var _0x29168f=typeof _0x517e6c[_0x6482('0x18')]===_0x6482('0x19')&&typeof _0x517e6c[_0x6482('0x1a')]===_0x6482('0x19');var _0x40758c=_0x4c15bc[_0x6482('0x1b')];var _0x3d6ec2=_0x29168f?0x0:_0x517e6c[_0x6482('0x18')];var _0x13e4d8=_0x29168f?_0x4c15bc[_0x6482('0x1b')]:_0x517e6c[_0x6482('0x18')]+_0x517e6c[_0x6482('0x1a')];var _0x6a9dba;if(_0x13e4d8>=_0x40758c){_0x13e4d8=_0x40758c;_0x6a9dba=0xc8;}else{_0x6a9dba=0xce;}_0x179440[_0x6482('0x15')](_0x6a9dba);return _0x179440[_0x6482('0x1c')](_0x6482('0x1d'),_0x3d6ec2+'-'+_0x13e4d8+'/'+_0x40758c)['json'](_0x4c15bc);}return null;};}function patchUpdates(_0x1230a0){return function(_0x43ffbe){try{jsonpatch['apply'](_0x43ffbe,_0x1230a0,!![]);}catch(_0x21f47e){return BPromise['reject'](_0x21f47e);}return _0x43ffbe[_0x6482('0x1e')]();};}function saveUpdates(_0xb31edf,_0x2c61d6){return function(_0x28de43){if(_0x28de43){return _0x28de43[_0x6482('0x1f')](_0xb31edf)[_0x6482('0x20')](function(_0x511c38){return _0x511c38;});}return null;};}function removeEntity(_0x3e310a,_0x4f5a86){return function(_0xcf066b){if(_0xcf066b){return _0xcf066b[_0x6482('0x21')]()['then'](function(){var _0xb1364f=_0xcf066b[_0x6482('0x22')]({'plain':!![]});var _0x27915d=_0x6482('0x23');return db[_0x6482('0x24')][_0x6482('0x21')]({'where':{'type':_0x27915d,'resourceId':_0xb1364f['id']}})['then'](function(){return _0xcf066b;});})['then'](function(){_0x3e310a[_0x6482('0x15')](0xcc)[_0x6482('0x16')]();});}};}function handleEntityNotFound(_0xde0da,_0x42cf7a){return function(_0x3168fd){if(!_0x3168fd){_0xde0da[_0x6482('0x14')](0x194);}return _0x3168fd;};}function handleError(_0x183adb,_0x2a33d6){_0x2a33d6=_0x2a33d6||0x1f4;return function(_0xbf37e7){logger[_0x6482('0x25')](_0xbf37e7[_0x6482('0x26')]);if(_0xbf37e7['name']){delete _0xbf37e7[_0x6482('0x27')];}_0x183adb[_0x6482('0x15')](_0x2a33d6)[_0x6482('0x28')](_0xbf37e7);};}exports[_0x6482('0x29')]=function(_0x36a18f,_0x11cf93){var _0x6a19a9={},_0x463fdb={},_0x25fc43={'count':0x0,'rows':[]};var _0x25e64e=_[_0x6482('0x2a')](db[_0x6482('0x2b')][_0x6482('0x2c')],function(_0x300cdd){return{'name':_0x300cdd[_0x6482('0x2d')],'type':_0x300cdd[_0x6482('0x2e')][_0x6482('0x2f')]};});_0x463fdb[_0x6482('0x30')]=_[_0x6482('0x2a')](_0x25e64e,_0x6482('0x27'));_0x463fdb[_0x6482('0x31')]=_[_0x6482('0x32')](_0x36a18f['query']);_0x463fdb[_0x6482('0x33')]=_[_0x6482('0x34')](_0x463fdb['model'],_0x463fdb[_0x6482('0x31')]);_0x6a19a9['attributes']=_[_0x6482('0x34')](_0x463fdb[_0x6482('0x30')],qs[_0x6482('0x35')](_0x36a18f[_0x6482('0x31')][_0x6482('0x35')]));_0x6a19a9[_0x6482('0x36')]=_0x6a19a9[_0x6482('0x36')][_0x6482('0x37')]?_0x6a19a9[_0x6482('0x36')]:_0x463fdb[_0x6482('0x30')];if(!_0x36a18f[_0x6482('0x31')][_0x6482('0x38')](_0x6482('0x39'))){_0x6a19a9[_0x6482('0x1a')]=qs['limit'](_0x36a18f[_0x6482('0x31')]['limit']);_0x6a19a9['offset']=qs[_0x6482('0x18')](_0x36a18f[_0x6482('0x31')][_0x6482('0x18')]);}_0x6a19a9['order']=qs[_0x6482('0x3a')](_0x36a18f[_0x6482('0x31')][_0x6482('0x3a')]);_0x6a19a9['where']=qs[_0x6482('0x33')](_[_0x6482('0x3b')](_0x36a18f[_0x6482('0x31')],_0x463fdb[_0x6482('0x33')]),_0x25e64e);if(_0x36a18f[_0x6482('0x31')][_0x6482('0x3c')]){_0x6a19a9[_0x6482('0x3d')]=_[_0x6482('0x3e')](_0x6a19a9[_0x6482('0x3d')],{'$or':_[_0x6482('0x2a')](_0x25e64e,function(_0x7ae8a2){if(_0x7ae8a2[_0x6482('0x2e')]!==_0x6482('0x3f')){var _0x1c3d91={};_0x1c3d91[_0x7ae8a2['name']]={'$like':'%'+_0x36a18f[_0x6482('0x31')][_0x6482('0x3c')]+'%'};return _0x1c3d91;}})});}_0x6a19a9=_[_0x6482('0x3e')]({},_0x6a19a9,_0x36a18f[_0x6482('0x40')]);var _0x5d3273={'where':_0x6a19a9[_0x6482('0x3d')]};return db[_0x6482('0x2b')][_0x6482('0x1b')](_0x5d3273)[_0x6482('0x20')](function(_0x52f82){_0x25fc43['count']=_0x52f82;if(_0x36a18f[_0x6482('0x31')][_0x6482('0x41')]){_0x6a19a9[_0x6482('0x42')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x6a19a9);})[_0x6482('0x20')](function(_0x5b1732){_0x25fc43[_0x6482('0x43')]=_0x5b1732;return _0x25fc43;})[_0x6482('0x20')](respondWithFilteredResult(_0x11cf93,_0x6a19a9))[_0x6482('0x44')](handleError(_0x11cf93,null));};exports['show']=function(_0x234d3b,_0x1e5783){var _0x236910={'raw':!![],'where':{'id':_0x234d3b[_0x6482('0x45')]['id']}},_0x591b40={};_0x591b40['model']=_[_0x6482('0x32')](db[_0x6482('0x2b')][_0x6482('0x2c')]);_0x591b40[_0x6482('0x31')]=_[_0x6482('0x32')](_0x234d3b['query']);_0x591b40['filters']=_[_0x6482('0x34')](_0x591b40[_0x6482('0x30')],_0x591b40[_0x6482('0x31')]);_0x236910[_0x6482('0x36')]=_['intersection'](_0x591b40[_0x6482('0x30')],qs[_0x6482('0x35')](_0x234d3b['query'][_0x6482('0x35')]));_0x236910[_0x6482('0x36')]=_0x236910[_0x6482('0x36')][_0x6482('0x37')]?_0x236910[_0x6482('0x36')]:_0x591b40[_0x6482('0x30')];if(_0x234d3b['query'][_0x6482('0x41')]){_0x236910[_0x6482('0x42')]=[{'all':!![]}];}_0x236910=_[_0x6482('0x3e')]({},_0x236910,_0x234d3b[_0x6482('0x40')]);return db[_0x6482('0x2b')]['find'](_0x236910)[_0x6482('0x20')](handleEntityNotFound(_0x1e5783,null))[_0x6482('0x20')](respondWithResult(_0x1e5783,null))[_0x6482('0x44')](handleError(_0x1e5783,null));};exports[_0x6482('0x46')]=function(_0x390dad,_0xa04c0f){return db['Variable']['create'](_0x390dad['body'],{})[_0x6482('0x20')](function(_0x591194){var _0x115941=_0x390dad[_0x6482('0x47')][_0x6482('0x22')]({'plain':!![]});if(!_0x115941)throw new Error(_0x6482('0x48'));if(_0x115941[_0x6482('0x49')]===_0x6482('0x47')){var _0x1a25c6=_0x591194[_0x6482('0x22')]({'plain':!![]});var _0x2fdfc7=_0x6482('0x23');return db[_0x6482('0x4a')][_0x6482('0x4b')]({'where':{'name':_0x2fdfc7,'userProfileId':_0x115941['userProfileId']},'raw':!![]})[_0x6482('0x20')](function(_0x2ca397){if(_0x2ca397&&_0x2ca397['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x1a25c6[_0x6482('0x27')],'resourceId':_0x1a25c6['id'],'type':_0x2ca397['name'],'sectionId':_0x2ca397['id']},{})[_0x6482('0x20')](function(){return _0x591194;});}else{return _0x591194;}})[_0x6482('0x44')](function(_0x11d80f){logger[_0x6482('0x25')](_0x6482('0x4c'),_0x11d80f);throw _0x11d80f;});}return _0x591194;})[_0x6482('0x20')](respondWithResult(_0xa04c0f,0xc9))[_0x6482('0x44')](handleError(_0xa04c0f,null));};exports[_0x6482('0x1f')]=function(_0xbab0ef,_0x362bc1){if(_0xbab0ef[_0x6482('0x4d')]['id']){delete _0xbab0ef[_0x6482('0x4d')]['id'];}return db[_0x6482('0x2b')]['find']({'where':{'id':_0xbab0ef['params']['id']}})['then'](handleEntityNotFound(_0x362bc1,null))[_0x6482('0x20')](saveUpdates(_0xbab0ef['body'],null))['then'](respondWithResult(_0x362bc1,null))[_0x6482('0x44')](handleError(_0x362bc1,null));};exports['destroy']=function(_0x5df3bb,_0x1fdaed){return db[_0x6482('0x2b')][_0x6482('0x4b')]({'where':{'id':_0x5df3bb[_0x6482('0x45')]['id']}})[_0x6482('0x20')](handleEntityNotFound(_0x1fdaed,null))[_0x6482('0x20')](removeEntity(_0x1fdaed,null))[_0x6482('0x44')](handleError(_0x1fdaed,null));}; \ No newline at end of file +var _0x4d4c=['Variables','UserProfileResource','end','stack','name','send','index','map','Variable','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','get'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x4d4c,0x84));var _0xc4d4=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0x4d4c[_0x12b8ec];return _0x21af77;};'use strict';var emlformat=require(_0xc4d4('0x0'));var rimraf=require(_0xc4d4('0x1'));var zipdir=require(_0xc4d4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc4d4('0x3'));var moment=require('moment');var BPromise=require(_0xc4d4('0x4'));var Mustache=require(_0xc4d4('0x5'));var util=require(_0xc4d4('0x6'));var path=require('path');var sox=require(_0xc4d4('0x7'));var csv=require(_0xc4d4('0x8'));var ejs=require(_0xc4d4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc4d4('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc4d4('0x8'));var querystring=require(_0xc4d4('0xb'));var Papa=require(_0xc4d4('0xc'));var Redis=require('ioredis');var authService=require(_0xc4d4('0xd'));var qs=require(_0xc4d4('0xe'));var as=require(_0xc4d4('0xf'));var hardwareService=require(_0xc4d4('0x10'));var logger=require('../../config/logger')(_0xc4d4('0x11'));var utils=require(_0xc4d4('0x12'));var config=require(_0xc4d4('0x13'));var licenseUtil=require(_0xc4d4('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5864fd,_0x4f894f){_0x4f894f=_0x4f894f||0xcc;return function(_0x397f0c){if(_0x397f0c){return _0x5864fd[_0xc4d4('0x15')](_0x4f894f);}return _0x5864fd[_0xc4d4('0x16')](_0x4f894f)['end']();};}function respondWithResult(_0x58285b,_0x29a771){_0x29a771=_0x29a771||0xc8;return function(_0x9a5739){if(_0x9a5739){return _0x58285b['status'](_0x29a771)[_0xc4d4('0x17')](_0x9a5739);}};}function respondWithFilteredResult(_0x21cc47,_0xf8dae6){return function(_0x33c733){if(_0x33c733){var _0x467668=typeof _0xf8dae6['offset']===_0xc4d4('0x18')&&typeof _0xf8dae6[_0xc4d4('0x19')]===_0xc4d4('0x18');var _0x436989=_0x33c733[_0xc4d4('0x1a')];var _0x18bc75=_0x467668?0x0:_0xf8dae6[_0xc4d4('0x1b')];var _0x299467=_0x467668?_0x33c733[_0xc4d4('0x1a')]:_0xf8dae6[_0xc4d4('0x1b')]+_0xf8dae6[_0xc4d4('0x19')];var _0x13415c;if(_0x299467>=_0x436989){_0x299467=_0x436989;_0x13415c=0xc8;}else{_0x13415c=0xce;}_0x21cc47[_0xc4d4('0x16')](_0x13415c);return _0x21cc47[_0xc4d4('0x1c')](_0xc4d4('0x1d'),_0x18bc75+'-'+_0x299467+'/'+_0x436989)[_0xc4d4('0x17')](_0x33c733);}return null;};}function patchUpdates(_0x5795e7){return function(_0x5d466d){try{jsonpatch[_0xc4d4('0x1e')](_0x5d466d,_0x5795e7,!![]);}catch(_0x19fce4){return BPromise[_0xc4d4('0x1f')](_0x19fce4);}return _0x5d466d['save']();};}function saveUpdates(_0x19aa51,_0x1f4bff){return function(_0x323387){if(_0x323387){return _0x323387[_0xc4d4('0x20')](_0x19aa51)[_0xc4d4('0x21')](function(_0x4f3636){return _0x4f3636;});}return null;};}function removeEntity(_0x4f3306,_0x4521f8){return function(_0x1552fe){if(_0x1552fe){return _0x1552fe[_0xc4d4('0x22')]()[_0xc4d4('0x21')](function(){var _0x9222de=_0x1552fe[_0xc4d4('0x23')]({'plain':!![]});var _0x3c79ca=_0xc4d4('0x24');return db[_0xc4d4('0x25')][_0xc4d4('0x22')]({'where':{'type':_0x3c79ca,'resourceId':_0x9222de['id']}})[_0xc4d4('0x21')](function(){return _0x1552fe;});})[_0xc4d4('0x21')](function(){_0x4f3306[_0xc4d4('0x16')](0xcc)[_0xc4d4('0x26')]();});}};}function handleEntityNotFound(_0x258def,_0x419557){return function(_0x2dd958){if(!_0x2dd958){_0x258def[_0xc4d4('0x15')](0x194);}return _0x2dd958;};}function handleError(_0x19b7ca,_0x52bd46){_0x52bd46=_0x52bd46||0x1f4;return function(_0x1c03ff){logger['error'](_0x1c03ff[_0xc4d4('0x27')]);if(_0x1c03ff[_0xc4d4('0x28')]){delete _0x1c03ff[_0xc4d4('0x28')];}_0x19b7ca[_0xc4d4('0x16')](_0x52bd46)[_0xc4d4('0x29')](_0x1c03ff);};}exports[_0xc4d4('0x2a')]=function(_0x31f002,_0x3e1913){var _0x53ffae={},_0x1b5edd={},_0x20c680={'count':0x0,'rows':[]};var _0x25d34f=_[_0xc4d4('0x2b')](db[_0xc4d4('0x2c')]['rawAttributes'],function(_0x104290){return{'name':_0x104290[_0xc4d4('0x2d')],'type':_0x104290['type'][_0xc4d4('0x2e')]};});_0x1b5edd[_0xc4d4('0x2f')]=_['map'](_0x25d34f,_0xc4d4('0x28'));_0x1b5edd['query']=_[_0xc4d4('0x30')](_0x31f002[_0xc4d4('0x31')]);_0x1b5edd[_0xc4d4('0x32')]=_[_0xc4d4('0x33')](_0x1b5edd[_0xc4d4('0x2f')],_0x1b5edd['query']);_0x53ffae['attributes']=_[_0xc4d4('0x33')](_0x1b5edd[_0xc4d4('0x2f')],qs[_0xc4d4('0x34')](_0x31f002[_0xc4d4('0x31')][_0xc4d4('0x34')]));_0x53ffae[_0xc4d4('0x35')]=_0x53ffae[_0xc4d4('0x35')][_0xc4d4('0x36')]?_0x53ffae[_0xc4d4('0x35')]:_0x1b5edd[_0xc4d4('0x2f')];if(!_0x31f002[_0xc4d4('0x31')][_0xc4d4('0x37')](_0xc4d4('0x38'))){_0x53ffae['limit']=qs[_0xc4d4('0x19')](_0x31f002['query'][_0xc4d4('0x19')]);_0x53ffae[_0xc4d4('0x1b')]=qs['offset'](_0x31f002[_0xc4d4('0x31')][_0xc4d4('0x1b')]);}_0x53ffae[_0xc4d4('0x39')]=qs[_0xc4d4('0x3a')](_0x31f002[_0xc4d4('0x31')][_0xc4d4('0x3a')]);_0x53ffae[_0xc4d4('0x3b')]=qs[_0xc4d4('0x32')](_[_0xc4d4('0x3c')](_0x31f002['query'],_0x1b5edd[_0xc4d4('0x32')]),_0x25d34f);if(_0x31f002['query']['filter']){_0x53ffae[_0xc4d4('0x3b')]=_[_0xc4d4('0x3d')](_0x53ffae[_0xc4d4('0x3b')],{'$or':_['map'](_0x25d34f,function(_0x5bf004){if(_0x5bf004[_0xc4d4('0x3e')]!=='VIRTUAL'){var _0x28f6d0={};_0x28f6d0[_0x5bf004['name']]={'$like':'%'+_0x31f002[_0xc4d4('0x31')][_0xc4d4('0x3f')]+'%'};return _0x28f6d0;}})});}_0x53ffae=_[_0xc4d4('0x3d')]({},_0x53ffae,_0x31f002[_0xc4d4('0x40')]);var _0x5cf963={'where':_0x53ffae[_0xc4d4('0x3b')]};return db[_0xc4d4('0x2c')][_0xc4d4('0x1a')](_0x5cf963)[_0xc4d4('0x21')](function(_0x4249eb){_0x20c680[_0xc4d4('0x1a')]=_0x4249eb;if(_0x31f002[_0xc4d4('0x31')]['includeAll']){_0x53ffae[_0xc4d4('0x41')]=[{'all':!![]}];}return db['Variable'][_0xc4d4('0x42')](_0x53ffae);})['then'](function(_0x3afaee){_0x20c680[_0xc4d4('0x43')]=_0x3afaee;return _0x20c680;})[_0xc4d4('0x21')](respondWithFilteredResult(_0x3e1913,_0x53ffae))[_0xc4d4('0x44')](handleError(_0x3e1913,null));};exports[_0xc4d4('0x45')]=function(_0x5d27cc,_0x105170){var _0x4c0a31={'raw':!![],'where':{'id':_0x5d27cc[_0xc4d4('0x46')]['id']}},_0x16a5f7={};_0x16a5f7['model']=_[_0xc4d4('0x30')](db['Variable'][_0xc4d4('0x47')]);_0x16a5f7['query']=_['keys'](_0x5d27cc[_0xc4d4('0x31')]);_0x16a5f7[_0xc4d4('0x32')]=_[_0xc4d4('0x33')](_0x16a5f7['model'],_0x16a5f7[_0xc4d4('0x31')]);_0x4c0a31[_0xc4d4('0x35')]=_['intersection'](_0x16a5f7['model'],qs[_0xc4d4('0x34')](_0x5d27cc[_0xc4d4('0x31')][_0xc4d4('0x34')]));_0x4c0a31['attributes']=_0x4c0a31[_0xc4d4('0x35')][_0xc4d4('0x36')]?_0x4c0a31[_0xc4d4('0x35')]:_0x16a5f7['model'];if(_0x5d27cc[_0xc4d4('0x31')][_0xc4d4('0x48')]){_0x4c0a31[_0xc4d4('0x41')]=[{'all':!![]}];}_0x4c0a31=_[_0xc4d4('0x3d')]({},_0x4c0a31,_0x5d27cc['options']);return db[_0xc4d4('0x2c')][_0xc4d4('0x49')](_0x4c0a31)[_0xc4d4('0x21')](handleEntityNotFound(_0x105170,null))[_0xc4d4('0x21')](respondWithResult(_0x105170,null))[_0xc4d4('0x44')](handleError(_0x105170,null));};exports[_0xc4d4('0x4a')]=function(_0x3aea52,_0x1dac85){return db[_0xc4d4('0x2c')][_0xc4d4('0x4a')](_0x3aea52[_0xc4d4('0x4b')],{})[_0xc4d4('0x21')](function(_0x504c97){var _0x19123a=_0x3aea52[_0xc4d4('0x4c')][_0xc4d4('0x23')]({'plain':!![]});if(!_0x19123a)throw new Error(_0xc4d4('0x4d'));if(_0x19123a[_0xc4d4('0x4e')]===_0xc4d4('0x4c')){var _0xb6230b=_0x504c97[_0xc4d4('0x23')]({'plain':!![]});var _0x3ce0b9='Variables';return db[_0xc4d4('0x4f')][_0xc4d4('0x49')]({'where':{'name':_0x3ce0b9,'userProfileId':_0x19123a[_0xc4d4('0x50')]},'raw':!![]})['then'](function(_0x598898){if(_0x598898&&_0x598898[_0xc4d4('0x51')]===0x0){return db[_0xc4d4('0x25')]['create']({'name':_0xb6230b[_0xc4d4('0x28')],'resourceId':_0xb6230b['id'],'type':_0x598898[_0xc4d4('0x28')],'sectionId':_0x598898['id']},{})[_0xc4d4('0x21')](function(){return _0x504c97;});}else{return _0x504c97;}})[_0xc4d4('0x44')](function(_0x3a4a75){logger[_0xc4d4('0x52')](_0xc4d4('0x53'),_0x3a4a75);throw _0x3a4a75;});}return _0x504c97;})[_0xc4d4('0x21')](respondWithResult(_0x1dac85,0xc9))['catch'](handleError(_0x1dac85,null));};exports[_0xc4d4('0x20')]=function(_0x241531,_0x443d51){if(_0x241531[_0xc4d4('0x4b')]['id']){delete _0x241531[_0xc4d4('0x4b')]['id'];}return db['Variable'][_0xc4d4('0x49')]({'where':{'id':_0x241531[_0xc4d4('0x46')]['id']}})[_0xc4d4('0x21')](handleEntityNotFound(_0x443d51,null))[_0xc4d4('0x21')](saveUpdates(_0x241531[_0xc4d4('0x4b')],null))[_0xc4d4('0x21')](respondWithResult(_0x443d51,null))[_0xc4d4('0x44')](handleError(_0x443d51,null));};exports[_0xc4d4('0x22')]=function(_0x3278b7,_0x255817){return db['Variable']['find']({'where':{'id':_0x3278b7[_0xc4d4('0x46')]['id']}})[_0xc4d4('0x21')](handleEntityNotFound(_0x255817,null))[_0xc4d4('0x21')](removeEntity(_0x255817,null))[_0xc4d4('0x44')](handleError(_0x255817,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 6eec576..89005b7 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 _0x94ab=['Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./variable.attributes'];(function(_0x18ad15,_0x430c3d){var _0x1dfeaf=function(_0x3d4304){while(--_0x3d4304){_0x18ad15['push'](_0x18ad15['shift']());}};_0x1dfeaf(++_0x430c3d);}(_0x94ab,0x18e));var _0xb94a=function(_0x151612,_0x55e355){_0x151612=_0x151612-0x0;var _0x2ca199=_0x94ab[_0x151612];return _0x2ca199;};'use strict';var _=require(_0xb94a('0x0'));var util=require(_0xb94a('0x1'));var logger=require(_0xb94a('0x2'))(_0xb94a('0x3'));var moment=require(_0xb94a('0x4'));var BPromise=require(_0xb94a('0x5'));var rp=require(_0xb94a('0x6'));var fs=require('fs');var path=require(_0xb94a('0x7'));var rimraf=require(_0xb94a('0x8'));var config=require('../../config/environment');var attributes=require(_0xb94a('0x9'));module['exports']=function(_0xe8ba08,_0x21cf30){return _0xe8ba08['define'](_0xb94a('0xa'),attributes,{'tableName':_0xb94a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x355a=['api','moment','bluebird','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','../../config/logger'];(function(_0x558105,_0x4f84af){var _0x39cc0=function(_0x139060){while(--_0x139060){_0x558105['push'](_0x558105['shift']());}};_0x39cc0(++_0x4f84af);}(_0x355a,0x129));var _0xa355=function(_0xb6cfc3,_0x291141){_0xb6cfc3=_0xb6cfc3-0x0;var _0x16c56a=_0x355a[_0xb6cfc3];return _0x16c56a;};'use strict';var _=require(_0xa355('0x0'));var util=require(_0xa355('0x1'));var logger=require(_0xa355('0x2'))(_0xa355('0x3'));var moment=require(_0xa355('0x4'));var BPromise=require(_0xa355('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa355('0x6'));var attributes=require(_0xa355('0x7'));module[_0xa355('0x8')]=function(_0x3299e9,_0x44dfe4){return _0x3299e9[_0xa355('0x9')](_0xa355('0xa'),attributes,{'tableName':_0xa355('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 4aa3090..38bcbad 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 _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowVariable','Variable','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x5db0ef,_0x5a6459){var _0x514e1e=function(_0x3da188){while(--_0x3da188){_0x5db0ef['push'](_0x5db0ef['shift']());}};_0x514e1e(++_0x5a6459);}(_0xe14b,0x93));var _0xbe14=function(_0x3437bc,_0x24bcf8){_0x3437bc=_0x3437bc-0x0;var _0x23fa97=_0xe14b[_0x3437bc];return _0x23fa97;};'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);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file +var _0xabce=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','attributes','map','include','model','catch','lodash','util'];(function(_0x4584ef,_0x3c640a){var _0x258dbb=function(_0x1a9c54){while(--_0x1a9c54){_0x4584ef['push'](_0x4584ef['shift']());}};_0x258dbb(++_0x3c640a);}(_0xabce,0x103));var _0xeabc=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xabce[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Variable,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')]({'raw':_0x58a3c0['options']?_0x58a3c0[_0xeabc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['where']||null:null,'attributes':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x18')]||null:null,'include':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['include']?_[_0xeabc('0x19')](_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x1a')],function(_0x5bdd57){return{'model':db[_0x5bdd57[_0xeabc('0x1b')]],'as':_0x5bdd57['as'],'attributes':_0x5bdd57[_0xeabc('0x18')],'include':_0x5bdd57[_0xeabc('0x1a')]?_[_0xeabc('0x19')](_0x5bdd57['include'],function(_0x109e1d){return{'model':db[_0x109e1d['model']],'as':_0x109e1d['as'],'attributes':_0x109e1d[_0xeabc('0x18')],'include':_0x109e1d['include']?_[_0xeabc('0x19')](_0x109e1d[_0xeabc('0x1a')],function(_0x269621){return{'model':db[_0x269621[_0xeabc('0x1b')]],'as':_0x269621['as'],'attributes':_0x269621[_0xeabc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeabc('0x9')](function(_0x131722){logger['info']('ShowVariable',_0x58a3c0);logger[_0xeabc('0xd')]('ShowVariable',_0x58a3c0,JSON[_0xeabc('0xf')](_0x131722));_0x31dd53(_0x131722);})[_0xeabc('0x1c')](function(_0x48fb52){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0x48fb52[_0xeabc('0x12')],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0x48fb52[_0xeabc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index a1cd4ab..7241fac 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 _0x4f27=['/migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','reset','pull'];(function(_0x13f4c4,_0x17774e){var _0x128308=function(_0x38e0ca){while(--_0x38e0ca){_0x13f4c4['push'](_0x13f4c4['shift']());}};_0x128308(++_0x17774e);}(_0x4f27,0xfe));var _0x74f2=function(_0x2f7725,_0x4d913b){_0x2f7725=_0x2f7725-0x0;var _0x498fa9=_0x4f27[_0x2f7725];return _0x498fa9;};'use strict';var express=require(_0x74f2('0x0'));var router=express[_0x74f2('0x1')]();var auth=require(_0x74f2('0x2'));var controller=require(_0x74f2('0x3'));router[_0x74f2('0x4')]('/',controller[_0x74f2('0x5')]);router[_0x74f2('0x4')](_0x74f2('0x6'),auth[_0x74f2('0x7')](),auth[_0x74f2('0x8')](),controller[_0x74f2('0x9')]);router[_0x74f2('0x4')]('/reset',auth[_0x74f2('0x7')](),auth[_0x74f2('0x8')](),controller[_0x74f2('0xa')]);router[_0x74f2('0x4')]('/pull',auth[_0x74f2('0x7')](),auth['canUpdate'](),controller[_0x74f2('0xb')]);router['get']('/restart',auth[_0x74f2('0x7')](),controller['restart']);router[_0x74f2('0x4')](_0x74f2('0xc'),controller['migrations']);module[_0x74f2('0xd')]=router; \ No newline at end of file +var _0x68a4=['reset','/pull','pull','restart','/migrations','migrations','exports','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset'];(function(_0x1d7f40,_0x2e17c0){var _0x2287a9=function(_0x1114fb){while(--_0x1114fb){_0x1d7f40['push'](_0x1d7f40['shift']());}};_0x2287a9(++_0x2e17c0);}(_0x68a4,0x137));var _0x468a=function(_0x17259d,_0x476b3c){_0x17259d=_0x17259d-0x0;var _0xe5d139=_0x68a4[_0x17259d];return _0xe5d139;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x468a('0x0'));var controller=require(_0x468a('0x1'));router[_0x468a('0x2')]('/',controller[_0x468a('0x3')]);router[_0x468a('0x2')](_0x468a('0x4'),auth[_0x468a('0x5')](),auth[_0x468a('0x6')](),controller[_0x468a('0x7')]);router['get'](_0x468a('0x8'),auth[_0x468a('0x5')](),auth[_0x468a('0x6')](),controller[_0x468a('0x9')]);router[_0x468a('0x2')](_0x468a('0xa'),auth[_0x468a('0x5')](),auth['canUpdate'](),controller[_0x468a('0xb')]);router[_0x468a('0x2')]('/restart',auth[_0x468a('0x5')](),controller[_0x468a('0xc')]);router[_0x468a('0x2')](_0x468a('0xd'),controller[_0x468a('0xe')]);module[_0x468a('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index ba94510..59f8603 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 _0x458f=['push','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../config/pm2','../../config/logger','update','simple-git','index','exports','query','latest','fetch','tags','2.0.0','status','json','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','root','server','length','.js'];(function(_0x399bfc,_0x36d4b0){var _0x36846d=function(_0x1465bc){while(--_0x1465bc){_0x399bfc['push'](_0x399bfc['shift']());}};_0x36846d(++_0x36d4b0);}(_0x458f,0x148));var _0xf458=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x458f[_0x4565bf];return _0x5610ba;};'use strict';var Umzug=require(_0xf458('0x0'));var path=require(_0xf458('0x1'));var fs=require('fs');var _=require(_0xf458('0x2'));var pkginfo=require(_0xf458('0x3'))(module,_0xf458('0x4'));var compareVersions=require(_0xf458('0x5'));var exec=require(_0xf458('0x6'))[_0xf458('0x7')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0xf458('0x8'));var logger=require(_0xf458('0x9'))(_0xf458('0xa'));var git=require(_0xf458('0xb'))(config['root']);exports[_0xf458('0xc')]=function(_0x2369b2,_0x3cddf5){var _0x43c948={'current':module[_0xf458('0xd')][_0xf458('0x4')],'phonebar':0x2};if(_0x2369b2[_0xf458('0xe')]&&_0x2369b2[_0xf458('0xe')][_0xf458('0xf')]){return git[_0xf458('0x10')]()[_0xf458('0x11')](function(_0x569be4,_0x1e2826){_0x43c948[_0xf458('0xf')]=(_0x569be4?module['exports']['version']:_0x1e2826[_0xf458('0xf')])||_0xf458('0x12');return _0x3cddf5[_0xf458('0x13')](0xc8)[_0xf458('0x14')](_0x43c948);});}else{return _0x3cddf5[_0xf458('0x13')](0xc8)[_0xf458('0x14')](_0x43c948);}};exports[_0xf458('0x10')]=function(_0x54e276,_0x5edc07){return git[_0xf458('0x10')](['origin','master'],function(_0x5030a9){if(_0x5030a9){logger[_0xf458('0x15')](_0x5030a9);return _0x5edc07[_0xf458('0x13')](0x1f4)['json'](_0x5030a9);}logger[_0xf458('0x16')](_0xf458('0x17'));return _0x5edc07['status'](0xc8)[_0xf458('0x14')]({'output':_0xf458('0x18')});});};exports['reset']=function(_0x5baea4,_0x47d7e5){return git[_0xf458('0x19')]([_0xf458('0x1a'),_0xf458('0x1b')],function(_0x4c3021){if(_0x4c3021){logger[_0xf458('0x15')](_0x4c3021);return _0x47d7e5[_0xf458('0x13')](0x1f4)[_0xf458('0x14')](_0x4c3021);}logger[_0xf458('0x16')](_0xf458('0x1c'));return _0x47d7e5[_0xf458('0x13')](0xc8)['json']({'output':'git\x20reset\x20--hard'});});};exports[_0xf458('0x1d')]=function(_0x51446b,_0x330374){exec(_0xf458('0x1e'),function(_0x49f073,_0x4d5f09,_0x101e1f){logger[_0xf458('0x16')](_0x4d5f09);logger[_0xf458('0x16')](_0x101e1f);if(_0x49f073){logger[_0xf458('0x15')](_0x49f073);return _0x330374['status'](0x1f4)[_0xf458('0x14')](_0x49f073);}return _0x330374[_0xf458('0x13')](0xc8)[_0xf458('0x14')]({'output':_0x4d5f09});});};exports[_0xf458('0x1f')]=function(_0x4253e2,_0x40b2dc){return pm2[_0xf458('0x1f')](_0xf458('0x20'))[_0xf458('0x21')](function(_0x9f6ea4){logger['info'](_0xf458('0x22'),_0x9f6ea4);return _0x40b2dc[_0xf458('0x13')](0xc8)[_0xf458('0x14')]({'output':_0xf458('0x23')});})[_0xf458('0x24')](function(_0x3ca365){logger['error'](_0x3ca365);return _0x40b2dc['status'](0x1f4)[_0xf458('0x14')](_0x3ca365);});};exports[_0xf458('0x25')]=function(_0x201ab4,_0x59a4d5){var _0x1ab666=fs['readdirSync'](path[_0xf458('0x26')](config[_0xf458('0x27')],_0xf458('0x28'),_0xf458('0x25')));var _0x2a14b7=[];for(var _0xac3850=0x0;_0xac3850<_0x1ab666[_0xf458('0x29')];_0xac3850++){var _0x214cb7=_0x1ab666[_0xac3850]['replace'](_0xf458('0x2a'),'');if(compareVersions(module[_0xf458('0xd')][_0xf458('0x4')],_0x214cb7)===-0x1){_0x2a14b7[_0xf458('0x2b')](_0x214cb7);}}if(_0x2a14b7[_0xf458('0x29')]){var _0x31909a=_0x2a14b7[_0xf458('0x2c')](compareVersions);var _0x33772c=new Umzug({'storage':_0xf458('0x2d'),'storageOptions':{'model':db[_0xf458('0x2e')],'modelName':_0xf458('0x2e'),'columnName':'version'},'migrations':{'params':[db[_0xf458('0x2d')]['getQueryInterface'](),db['sequelize'][_0xf458('0x2f')],function(){throw new Error(_0xf458('0x30'));}],'path':path['join'](config[_0xf458('0x27')],_0xf458('0x28'),'migrations'),'pattern':/\.js$/}});_0x33772c['up']({'migrations':_['map'](_0x31909a,function(_0x517ebc){return _0x517ebc+_0xf458('0x2a');})})[_0xf458('0x21')](function(){return _0x59a4d5[_0xf458('0x13')](0xc8)[_0xf458('0x14')]({'output':_0xf458('0x31')+module[_0xf458('0xd')]['version']+_0xf458('0x32')+_['last'](_0x31909a),'migrations':_[_0xf458('0x26')](_0x31909a)});})[_0xf458('0x24')](function(_0x4790ed){if(_0x4790ed instanceof db[_0xf458('0x2d')][_0xf458('0x33')]){return _0x59a4d5['status'](0xc8)[_0xf458('0x14')]({'output':_0xf458('0x34')});}else{return _0x59a4d5[_0xf458('0x13')](0x1f4)[_0xf458('0x14')](_0x4790ed);}});}else{return _0x59a4d5['status'](0xc8)[_0xf458('0x14')]({'output':_0xf458('0x34')});}}; \ No newline at end of file +var _0x9b85=['../../config/logger','update','simple-git','root','index','exports','version','query','latest','fetch','tags','2.0.0','status','json','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','info','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','server','length','replace','.js','push','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','\x20to\x20','last','catch','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2'];(function(_0x2e2636,_0x58b3cd){var _0x5805a6=function(_0x4311bf){while(--_0x4311bf){_0x2e2636['push'](_0x2e2636['shift']());}};_0x5805a6(++_0x58b3cd);}(_0x9b85,0x10e));var _0x59b8=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x9b85[_0x432682];return _0x463d05;};'use strict';var Umzug=require(_0x59b8('0x0'));var path=require(_0x59b8('0x1'));var fs=require('fs');var _=require(_0x59b8('0x2'));var pkginfo=require(_0x59b8('0x3'))(module,'version');var compareVersions=require(_0x59b8('0x4'));var exec=require(_0x59b8('0x5'))[_0x59b8('0x6')];var db=require(_0x59b8('0x7'))['db'];var config=require(_0x59b8('0x8'));var pm2=require(_0x59b8('0x9'));var logger=require(_0x59b8('0xa'))(_0x59b8('0xb'));var git=require(_0x59b8('0xc'))(config[_0x59b8('0xd')]);exports[_0x59b8('0xe')]=function(_0x15d0f5,_0x28ae62){var _0x4bb5c2={'current':module[_0x59b8('0xf')][_0x59b8('0x10')],'phonebar':0x2};if(_0x15d0f5[_0x59b8('0x11')]&&_0x15d0f5[_0x59b8('0x11')][_0x59b8('0x12')]){return git[_0x59b8('0x13')]()[_0x59b8('0x14')](function(_0x1abda5,_0x4e9e1b){_0x4bb5c2[_0x59b8('0x12')]=(_0x1abda5?module[_0x59b8('0xf')][_0x59b8('0x10')]:_0x4e9e1b[_0x59b8('0x12')])||_0x59b8('0x15');return _0x28ae62[_0x59b8('0x16')](0xc8)['json'](_0x4bb5c2);});}else{return _0x28ae62['status'](0xc8)[_0x59b8('0x17')](_0x4bb5c2);}};exports[_0x59b8('0x13')]=function(_0xd57cc8,_0x43211c){return git[_0x59b8('0x13')]([_0x59b8('0x18'),_0x59b8('0x19')],function(_0x1541a6){if(_0x1541a6){logger[_0x59b8('0x1a')](_0x1541a6);return _0x43211c[_0x59b8('0x16')](0x1f4)[_0x59b8('0x17')](_0x1541a6);}logger['info'](_0x59b8('0x1b'));return _0x43211c['status'](0xc8)[_0x59b8('0x17')]({'output':_0x59b8('0x1c')});});};exports[_0x59b8('0x1d')]=function(_0x5c2cd0,_0xcaed94){return git[_0x59b8('0x1d')](['--hard','FETCH_HEAD'],function(_0xc0a573){if(_0xc0a573){logger[_0x59b8('0x1a')](_0xc0a573);return _0xcaed94[_0x59b8('0x16')](0x1f4)[_0x59b8('0x17')](_0xc0a573);}logger[_0x59b8('0x1e')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0xcaed94['status'](0xc8)[_0x59b8('0x17')]({'output':_0x59b8('0x1f')});});};exports[_0x59b8('0x20')]=function(_0x633b7b,_0x2b9f72){exec(_0x59b8('0x21'),function(_0x29eafb,_0x194d0c,_0x47738b){logger[_0x59b8('0x1e')](_0x194d0c);logger[_0x59b8('0x1e')](_0x47738b);if(_0x29eafb){logger[_0x59b8('0x1a')](_0x29eafb);return _0x2b9f72[_0x59b8('0x16')](0x1f4)[_0x59b8('0x17')](_0x29eafb);}return _0x2b9f72[_0x59b8('0x16')](0xc8)[_0x59b8('0x17')]({'output':_0x194d0c});});};exports[_0x59b8('0x22')]=function(_0x9037d6,_0x58a631){return pm2[_0x59b8('0x22')]('motion2')[_0x59b8('0x23')](function(_0x14828b){logger['info'](_0x59b8('0x24'),_0x14828b);return _0x58a631[_0x59b8('0x16')](0xc8)[_0x59b8('0x17')]({'output':_0x59b8('0x25')});})['catch'](function(_0x29490f){logger[_0x59b8('0x1a')](_0x29490f);return _0x58a631[_0x59b8('0x16')](0x1f4)['json'](_0x29490f);});};exports[_0x59b8('0x26')]=function(_0x216c95,_0x5b8b3e){var _0x4588b6=fs[_0x59b8('0x27')](path['join'](config[_0x59b8('0xd')],_0x59b8('0x28'),_0x59b8('0x26')));var _0x16da3e=[];for(var _0x2c3b3c=0x0;_0x2c3b3c<_0x4588b6[_0x59b8('0x29')];_0x2c3b3c++){var _0x233eaf=_0x4588b6[_0x2c3b3c][_0x59b8('0x2a')](_0x59b8('0x2b'),'');if(compareVersions(module[_0x59b8('0xf')][_0x59b8('0x10')],_0x233eaf)===-0x1){_0x16da3e[_0x59b8('0x2c')](_0x233eaf);}}if(_0x16da3e[_0x59b8('0x29')]){var _0x1aaf90=_0x16da3e[_0x59b8('0x2d')](compareVersions);var _0x24d30e=new Umzug({'storage':_0x59b8('0x2e'),'storageOptions':{'model':db[_0x59b8('0x2f')],'modelName':_0x59b8('0x2f'),'columnName':'version'},'migrations':{'params':[db[_0x59b8('0x2e')]['getQueryInterface'](),db[_0x59b8('0x2e')][_0x59b8('0x30')],function(){throw new Error(_0x59b8('0x31'));}],'path':path[_0x59b8('0x32')](config[_0x59b8('0xd')],_0x59b8('0x28'),_0x59b8('0x26')),'pattern':/\.js$/}});_0x24d30e['up']({'migrations':_[_0x59b8('0x33')](_0x1aaf90,function(_0x91ff66){return _0x91ff66+_0x59b8('0x2b');})})['then'](function(){return _0x5b8b3e[_0x59b8('0x16')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x59b8('0xf')][_0x59b8('0x10')]+_0x59b8('0x34')+_[_0x59b8('0x35')](_0x1aaf90),'migrations':_[_0x59b8('0x32')](_0x1aaf90)});})[_0x59b8('0x36')](function(_0xb9e8b9){if(_0xb9e8b9 instanceof db['sequelize']['UniqueConstraintError']){return _0x5b8b3e[_0x59b8('0x16')](0xc8)[_0x59b8('0x17')]({'output':_0x59b8('0x37')});}else{return _0x5b8b3e['status'](0x1f4)[_0x59b8('0x17')](_0xb9e8b9);}});}else{return _0x5b8b3e[_0x59b8('0x16')](0xc8)[_0x59b8('0x17')]({'output':_0x59b8('0x37')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 858957a..2c84f56 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 _0x8d23=['create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','/describe','isAuthenticated','describe','post'];(function(_0x2d4e66,_0x27cde7){var _0xe94b36=function(_0x5888d6){while(--_0x5888d6){_0x2d4e66['push'](_0x2d4e66['shift']());}};_0xe94b36(++_0x27cde7);}(_0x8d23,0x1ea));var _0x38d2=function(_0x474367,_0x538437){_0x474367=_0x474367-0x0;var _0x29842e=_0x8d23[_0x474367];return _0x29842e;};'use strict';var multer=require(_0x38d2('0x0'));var util=require(_0x38d2('0x1'));var path=require(_0x38d2('0x2'));var timeout=require(_0x38d2('0x3'));var express=require(_0x38d2('0x4'));var router=express['Router']();var fs_extra=require(_0x38d2('0x5'));var auth=require(_0x38d2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x38d2('0x7'));var controller=require(_0x38d2('0x8'));router[_0x38d2('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x38d2('0xa'),auth[_0x38d2('0xb')](),controller[_0x38d2('0xc')]);router[_0x38d2('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x38d2('0xd')]('/',auth[_0x38d2('0xb')](),controller[_0x38d2('0xe')]);router[_0x38d2('0xf')](_0x38d2('0x10'),auth['isAuthenticated'](),controller[_0x38d2('0x11')]);router[_0x38d2('0x12')](_0x38d2('0x10'),auth[_0x38d2('0xb')](),controller[_0x38d2('0x13')]);module[_0x38d2('0x14')]=router; \ No newline at end of file +var _0x1b5f=['../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/:id','show','put','update','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0x1b5f,0x1e4));var _0xf1b5=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x1b5f[_0x19950b];return _0x3c6b41;};'use strict';var multer=require('multer');var util=require(_0xf1b5('0x0'));var path=require(_0xf1b5('0x1'));var timeout=require(_0xf1b5('0x2'));var express=require(_0xf1b5('0x3'));var router=express[_0xf1b5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf1b5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf1b5('0x6'));var controller=require(_0xf1b5('0x7'));router[_0xf1b5('0x8')]('/',auth[_0xf1b5('0x9')](),controller['index']);router['get']('/describe',auth[_0xf1b5('0x9')](),controller['describe']);router['get'](_0xf1b5('0xa'),auth[_0xf1b5('0x9')](),controller[_0xf1b5('0xb')]);router['post']('/',auth[_0xf1b5('0x9')](),controller['create']);router[_0xf1b5('0xc')](_0xf1b5('0xa'),auth[_0xf1b5('0x9')](),controller[_0xf1b5('0xd')]);router['delete'](_0xf1b5('0xa'),auth[_0xf1b5('0x9')](),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 690a2e5..5790c0c 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 _0xd3f5=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x202ce2,_0x554e0b){var _0x132334=function(_0xc0bbfc){while(--_0xc0bbfc){_0x202ce2['push'](_0x202ce2['shift']());}};_0x132334(++_0x554e0b);}(_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')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5d3f('0x2')]},'calleridnum':{'type':Sequelize[_0x5d3f('0x2')]},'calleridname':{'type':Sequelize[_0x5d3f('0x2')]},'queue':{'type':Sequelize[_0x5d3f('0x2')]},'interface':{'type':Sequelize[_0x5d3f('0x2')]},'membername':{'type':Sequelize[_0x5d3f('0x2')]},'agentcalledAt':{'type':Sequelize[_0x5d3f('0x3')]},'agentconnectAt':{'type':Sequelize[_0x5d3f('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x5d3f('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x5d3f('0x4')]},'agentcomplete':{'type':Sequelize[_0x5d3f('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x5d3f('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x5d3f('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x5d3f('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5d3f('0x2')]},'channelstate':{'type':Sequelize[_0x5d3f('0x4')]},'channelstatedesc':{'type':Sequelize[_0x5d3f('0x2')]},'connectedlinenum':{'type':Sequelize[_0x5d3f('0x2')]},'connectedlinename':{'type':Sequelize[_0x5d3f('0x2')]},'language':{'type':Sequelize[_0x5d3f('0x2')]},'accountcode':{'type':Sequelize[_0x5d3f('0x2')]},'context':{'type':Sequelize[_0x5d3f('0x2')]},'exten':{'type':Sequelize[_0x5d3f('0x2')]},'priority':{'type':Sequelize[_0x5d3f('0x2')]},'destchannel':{'type':Sequelize[_0x5d3f('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x5d3f('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5d3f('0x2')]},'destcalleridname':{'type':Sequelize[_0x5d3f('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x5d3f('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x5d3f('0x2')]},'destaccountcode':{'type':Sequelize[_0x5d3f('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x5d3f('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x5d3f('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x5d3f('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x5d3f('0x2')]},'transfer':{'type':Sequelize[_0x5d3f('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5d3f('0x2')],'comment':_0x5d3f('0x6')},'transferexten':{'type':Sequelize[_0x5d3f('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x5d3f('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x79e2=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x10f376,_0x2604a8){var _0x38bf5d=function(_0x534991){while(--_0x534991){_0x10f376['push'](_0x10f376['shift']());}};_0x38bf5d(++_0x2604a8);}(_0x79e2,0x1c3));var _0x279e=function(_0x160790,_0x2c237f){_0x160790=_0x160790-0x0;var _0x149050=_0x79e2[_0x160790];return _0x149050;};'use strict';var Sequelize=require(_0x279e('0x0'));module['exports']={'type':{'type':Sequelize[_0x279e('0x1')]},'uniqueid':{'type':Sequelize[_0x279e('0x1')]},'calleridnum':{'type':Sequelize[_0x279e('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x279e('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x279e('0x1')]},'agentcalledAt':{'type':Sequelize[_0x279e('0x2')]},'agentconnectAt':{'type':Sequelize[_0x279e('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x279e('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x279e('0x3')]},'agentcomplete':{'type':Sequelize[_0x279e('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x279e('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x279e('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x279e('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x279e('0x3')]},'reason':{'type':Sequelize[_0x279e('0x1')]},'lastevent':{'type':Sequelize[_0x279e('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x279e('0x3')]},'channelstatedesc':{'type':Sequelize[_0x279e('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x279e('0x1')]},'language':{'type':Sequelize[_0x279e('0x1')]},'accountcode':{'type':Sequelize[_0x279e('0x1')]},'context':{'type':Sequelize[_0x279e('0x1')]},'exten':{'type':Sequelize[_0x279e('0x1')]},'priority':{'type':Sequelize[_0x279e('0x1')]},'destchannel':{'type':Sequelize[_0x279e('0x1')]},'destchannelstate':{'type':Sequelize[_0x279e('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x279e('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x279e('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x279e('0x1')]},'destlanguage':{'type':Sequelize[_0x279e('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x279e('0x1')]},'destexten':{'type':Sequelize[_0x279e('0x1')]},'destpriority':{'type':Sequelize[_0x279e('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x279e('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x279e('0x1')]},'transfer':{'type':Sequelize[_0x279e('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x279e('0x1')],'comment':_0x279e('0x5')},'transferexten':{'type':Sequelize[_0x279e('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x279e('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 7e83a10..c18dc77 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(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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 b824cb1..ee2f755 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 _0xed1f=['request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xed1f,0x6a));var _0xfed1=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xed1f[_0x346737];return _0x1ade2e;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var logger=require(_0xfed1('0x2'))(_0xfed1('0x3'));var moment=require(_0xfed1('0x4'));var BPromise=require(_0xfed1('0x5'));var rp=require(_0xfed1('0x6'));var fs=require('fs');var path=require(_0xfed1('0x7'));var rimraf=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var attributes=require(_0xfed1('0xa'));module[_0xfed1('0xb')]=function(_0x3d6706,_0x42751d){return _0x3d6706[_0xfed1('0xc')](_0xfed1('0xd'),attributes,{'tableName':_0xfed1('0xe'),'paranoid':![],'indexes':[{'fields':[_0xfed1('0xf'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2d17=['api','moment','request-promise','path','../../config/environment','exports','define','report_agent','uniqueid','destuniqueid','lodash','util'];(function(_0x42dddb,_0x25aa05){var _0x36fb66=function(_0x1ada7d){while(--_0x1ada7d){_0x42dddb['push'](_0x42dddb['shift']());}};_0x36fb66(++_0x25aa05);}(_0x2d17,0x17e));var _0x72d1=function(_0x31324f,_0x21655d){_0x31324f=_0x31324f-0x0;var _0x38d138=_0x2d17[_0x31324f];return _0x38d138;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var logger=require('../../config/logger')(_0x72d1('0x2'));var moment=require(_0x72d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x72d1('0x4'));var fs=require('fs');var path=require(_0x72d1('0x5'));var rimraf=require('rimraf');var config=require(_0x72d1('0x6'));var attributes=require('./voiceAgentReport.attributes');module[_0x72d1('0x7')]=function(_0x50f551,_0x139ba0){return _0x50f551[_0x72d1('0x8')]('VoiceAgentReport',attributes,{'tableName':_0x72d1('0x9'),'paranoid':![],'indexes':[{'fields':[_0x72d1('0xa'),_0x72d1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index a1b63d2..2d71d8c 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 _0xba7c=['stringify','error','code','message','result','catch','VoiceAgentReport','create','body','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xba7c,0x7d));var _0xcba7=function(_0x1e19c5,_0x3b3bfc){_0x1e19c5=_0x1e19c5-0x0;var _0x3cd6b2=_0xba7c[_0x1e19c5];return _0x3cd6b2;};'use strict';var _=require('lodash');var util=require(_0xcba7('0x0'));var moment=require(_0xcba7('0x1'));var BPromise=require(_0xcba7('0x2'));var rs=require(_0xcba7('0x3'));var fs=require('fs');var Redis=require(_0xcba7('0x4'));var db=require(_0xcba7('0x5'))['db'];var utils=require(_0xcba7('0x6'));var logger=require('../../config/logger')(_0xcba7('0x7'));var config=require(_0xcba7('0x8'));var jayson=require(_0xcba7('0x9'));var client=jayson[_0xcba7('0xa')][_0xcba7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a9807,_0x560cd7,_0x25c9a6){return new BPromise(function(_0x41cefb,_0x452826){return client[_0xcba7('0xc')](_0x2a9807,_0x25c9a6)[_0xcba7('0xd')](function(_0x357b6c){logger[_0xcba7('0xe')](_0xcba7('0xf'),_0x560cd7,_0xcba7('0x10'));logger[_0xcba7('0x11')](_0xcba7('0x12'),_0x560cd7,_0xcba7('0x10'),JSON[_0xcba7('0x13')](_0x357b6c));if(_0x357b6c[_0xcba7('0x14')]){if(_0x357b6c[_0xcba7('0x14')][_0xcba7('0x15')]===0x1f4){logger[_0xcba7('0x14')](_0xcba7('0xf'),_0x560cd7,_0x357b6c[_0xcba7('0x14')]['message']);return _0x452826(_0x357b6c[_0xcba7('0x14')][_0xcba7('0x16')]);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x560cd7,_0x357b6c[_0xcba7('0x14')][_0xcba7('0x16')]);return _0x41cefb(_0x357b6c[_0xcba7('0x14')][_0xcba7('0x16')]);}else{logger[_0xcba7('0xe')](_0xcba7('0xf'),_0x560cd7,'request\x20sent');_0x41cefb(_0x357b6c[_0xcba7('0x17')]['message']);}})[_0xcba7('0x18')](function(_0x425fd9){logger[_0xcba7('0x14')](_0xcba7('0xf'),_0x560cd7,_0x425fd9);_0x452826(_0x425fd9);});});}exports['CreateVoiceAgentReport']=function(_0x455038){var _0x3c169a=this;return new Promise(function(_0x68d373,_0x40db29){return db[_0xcba7('0x19')][_0xcba7('0x1a')](_0x455038[_0xcba7('0x1b')],{'raw':_0x455038[_0xcba7('0x1c')]?_0x455038[_0xcba7('0x1c')][_0xcba7('0x1d')]===undefined?!![]:![]:!![]})[_0xcba7('0xd')](function(_0x1bfcda){logger[_0xcba7('0xe')](_0xcba7('0x1e'),_0x455038);logger[_0xcba7('0x11')](_0xcba7('0x1e'),_0x455038,JSON[_0xcba7('0x13')](_0x1bfcda));_0x68d373(_0x1bfcda);})['catch'](function(_0x1866b5){logger[_0xcba7('0x14')](_0xcba7('0x1e'),_0x1866b5[_0xcba7('0x16')],_0x455038);_0x40db29(_0x3c169a[_0xcba7('0x14')](0x1f4,_0x1866b5[_0xcba7('0x16')]));});});};exports[_0xcba7('0x1f')]=function(_0x136a6f){var _0x268090=this;return new Promise(function(_0x3d4475,_0x36f333){return db[_0xcba7('0x19')][_0xcba7('0x20')](_0x136a6f[_0xcba7('0x1b')],{'raw':_0x136a6f[_0xcba7('0x1c')]?_0x136a6f[_0xcba7('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x136a6f[_0xcba7('0x1c')]?_0x136a6f['options'][_0xcba7('0x21')]||null:null,'attributes':_0x136a6f[_0xcba7('0x1c')]?_0x136a6f[_0xcba7('0x1c')][_0xcba7('0x22')]||null:null,'limit':_0x136a6f[_0xcba7('0x1c')]?_0x136a6f['options'][_0xcba7('0x23')]||null:null})['then'](function(_0x4f894a){logger['info'](_0xcba7('0x1f'),_0x136a6f);logger[_0xcba7('0x11')](_0xcba7('0x1f'),_0x136a6f,JSON[_0xcba7('0x13')](_0x4f894a));_0x3d4475(_0x4f894a);})[_0xcba7('0x18')](function(_0x2d0cf4){logger[_0xcba7('0x14')]('UpdateVoiceAgentReport',_0x2d0cf4[_0xcba7('0x16')],_0x136a6f);_0x36f333(_0x268090['error'](0x1f4,_0x2d0cf4[_0xcba7('0x16')]));});});}; \ No newline at end of file +var _0x450f=['debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','message','result','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw','stringify','catch','UpdateVoiceAgentReport','update','where','attributes','limit','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent'];(function(_0x6547ce,_0x36b02f){var _0x1190d4=function(_0x423610){while(--_0x423610){_0x6547ce['push'](_0x6547ce['shift']());}};_0x1190d4(++_0x36b02f);}(_0x450f,0x16d));var _0xf450=function(_0x58622a,_0x4ad356){_0x58622a=_0x58622a-0x0;var _0x2888db=_0x450f[_0x58622a];return _0x2888db;};'use strict';var _=require(_0xf450('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf450('0x1'));var rs=require(_0xf450('0x2'));var fs=require('fs');var Redis=require(_0xf450('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf450('0x4'))(_0xf450('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf450('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2412e6,_0x3a579a,_0x5dea9a){return new BPromise(function(_0x12c559,_0x2ab8a1){return client[_0xf450('0x7')](_0x2412e6,_0x5dea9a)[_0xf450('0x8')](function(_0x253876){logger[_0xf450('0x9')](_0xf450('0xa'),_0x3a579a,_0xf450('0xb'));logger[_0xf450('0xc')](_0xf450('0xd'),_0x3a579a,_0xf450('0xb'),JSON['stringify'](_0x253876));if(_0x253876[_0xf450('0xe')]){if(_0x253876[_0xf450('0xe')]['code']===0x1f4){logger[_0xf450('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x3a579a,_0x253876[_0xf450('0xe')][_0xf450('0xf')]);return _0x2ab8a1(_0x253876[_0xf450('0xe')]['message']);}logger[_0xf450('0xe')](_0xf450('0xa'),_0x3a579a,_0x253876[_0xf450('0xe')]['message']);return _0x12c559(_0x253876[_0xf450('0xe')]['message']);}else{logger[_0xf450('0x9')]('VoiceAgentReport,\x20%s,\x20%s',_0x3a579a,_0xf450('0xb'));_0x12c559(_0x253876[_0xf450('0x10')][_0xf450('0xf')]);}})['catch'](function(_0x4af551){logger['error'](_0xf450('0xa'),_0x3a579a,_0x4af551);_0x2ab8a1(_0x4af551);});});}exports[_0xf450('0x11')]=function(_0x1fa4d3){var _0x2c3b2f=this;return new Promise(function(_0x4f1664,_0x1d1288){return db[_0xf450('0x12')]['create'](_0x1fa4d3[_0xf450('0x13')],{'raw':_0x1fa4d3[_0xf450('0x14')]?_0x1fa4d3[_0xf450('0x14')][_0xf450('0x15')]===undefined?!![]:![]:!![]})[_0xf450('0x8')](function(_0x155280){logger[_0xf450('0x9')](_0xf450('0x11'),_0x1fa4d3);logger[_0xf450('0xc')](_0xf450('0x11'),_0x1fa4d3,JSON[_0xf450('0x16')](_0x155280));_0x4f1664(_0x155280);})[_0xf450('0x17')](function(_0x385513){logger['error'](_0xf450('0x11'),_0x385513[_0xf450('0xf')],_0x1fa4d3);_0x1d1288(_0x2c3b2f[_0xf450('0xe')](0x1f4,_0x385513[_0xf450('0xf')]));});});};exports[_0xf450('0x18')]=function(_0x569e2e){var _0x4a3890=this;return new Promise(function(_0x13d514,_0x498e4e){return db[_0xf450('0x12')][_0xf450('0x19')](_0x569e2e[_0xf450('0x13')],{'raw':_0x569e2e[_0xf450('0x14')]?_0x569e2e[_0xf450('0x14')][_0xf450('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x569e2e[_0xf450('0x14')]?_0x569e2e[_0xf450('0x14')][_0xf450('0x1a')]||null:null,'attributes':_0x569e2e[_0xf450('0x14')]?_0x569e2e['options'][_0xf450('0x1b')]||null:null,'limit':_0x569e2e[_0xf450('0x14')]?_0x569e2e['options'][_0xf450('0x1c')]||null:null})[_0xf450('0x8')](function(_0x4f8f1b){logger[_0xf450('0x9')](_0xf450('0x18'),_0x569e2e);logger['debug'](_0xf450('0x18'),_0x569e2e,JSON[_0xf450('0x16')](_0x4f8f1b));_0x13d514(_0x4f8f1b);})[_0xf450('0x17')](function(_0x371d46){logger[_0xf450('0xe')](_0xf450('0x18'),_0x371d46[_0xf450('0xf')],_0x569e2e);_0x498e4e(_0x4a3890[_0xf450('0xe')](0x1f4,_0x371d46[_0xf450('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index c5d0126..4289759 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 _0x84ab=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','/describe','describe','isAuthenticated','post','create','update','delete','/:id','destroy','multer'];(function(_0xa6b022,_0x1a5f5d){var _0x143909=function(_0xbb8e20){while(--_0xbb8e20){_0xa6b022['push'](_0xa6b022['shift']());}};_0x143909(++_0x1a5f5d);}(_0x84ab,0x12f));var _0xb84a=function(_0x234ae1,_0x42bdd6){_0x234ae1=_0x234ae1-0x0;var _0x227ba0=_0x84ab[_0x234ae1];return _0x227ba0;};'use strict';var multer=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var path=require(_0xb84a('0x2'));var timeout=require(_0xb84a('0x3'));var express=require(_0xb84a('0x4'));var router=express['Router']();var fs_extra=require(_0xb84a('0x5'));var auth=require(_0xb84a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb84a('0x7'));var controller=require(_0xb84a('0x8'));router[_0xb84a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb84a('0xa'),auth['isAuthenticated'](),controller[_0xb84a('0xb')]);router[_0xb84a('0x9')]('/:id',auth[_0xb84a('0xc')](),controller['show']);router[_0xb84a('0xd')]('/',auth[_0xb84a('0xc')](),controller[_0xb84a('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb84a('0xf')]);router[_0xb84a('0x10')](_0xb84a('0x11'),auth[_0xb84a('0xc')](),controller[_0xb84a('0x12')]);module['exports']=router; \ No newline at end of file +var _0x84ab=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','/describe','describe','isAuthenticated','post','create','update','delete','/:id','destroy','multer'];(function(_0x57e14f,_0x17f93c){var _0x39fce2=function(_0xea4aec){while(--_0xea4aec){_0x57e14f['push'](_0x57e14f['shift']());}};_0x39fce2(++_0x17f93c);}(_0x84ab,0x12f));var _0xb84a=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x84ab[_0x34bf97];return _0x292719;};'use strict';var multer=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var path=require(_0xb84a('0x2'));var timeout=require(_0xb84a('0x3'));var express=require(_0xb84a('0x4'));var router=express['Router']();var fs_extra=require(_0xb84a('0x5'));var auth=require(_0xb84a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb84a('0x7'));var controller=require(_0xb84a('0x8'));router[_0xb84a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb84a('0xa'),auth['isAuthenticated'](),controller[_0xb84a('0xb')]);router[_0xb84a('0x9')]('/:id',auth[_0xb84a('0xc')](),controller['show']);router[_0xb84a('0xd')]('/',auth[_0xb84a('0xc')](),controller[_0xb84a('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb84a('0xf')]);router[_0xb84a('0x10')](_0xb84a('0x11'),auth[_0xb84a('0xc')](),controller[_0xb84a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 1943c15..66e74b2 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 _0xa1f1=['internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xa1f1,0x1b5));var _0x1a1f=function(_0x27d8bc,_0x19e010){_0x27d8bc=_0x27d8bc-0x0;var _0x4b04cb=_0xa1f1[_0x27d8bc];return _0x4b04cb;};'use strict';var Sequelize=require(_0x1a1f('0x0'));module[_0x1a1f('0x1')]={'uniqueid':{'type':Sequelize[_0x1a1f('0x2')]},'type':{'type':Sequelize[_0x1a1f('0x3')](_0x1a1f('0x4'),_0x1a1f('0x5'),_0x1a1f('0x6'),_0x1a1f('0x7'),_0x1a1f('0x8'),_0x1a1f('0x9'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1a1f('0x2')]},'source':{'type':Sequelize[_0x1a1f('0x2')]},'destination':{'type':Sequelize[_0x1a1f('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x1a1f('0x2')]},'channel':{'type':Sequelize[_0x1a1f('0x2')]},'destinationchannel':{'type':Sequelize[_0x1a1f('0x2')]},'lastapplication':{'type':Sequelize[_0x1a1f('0x2')]},'lastdata':{'type':Sequelize[_0x1a1f('0xa')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x1a1f('0xb')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x1a1f('0xc')]},'billableseconds':{'type':Sequelize[_0x1a1f('0xc')]},'mohtime':{'type':Sequelize[_0x1a1f('0xc')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1a1f('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x1a1f('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x1a1f('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x1a1f('0x2')]},'note':{'type':Sequelize[_0x1a1f('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x1a1f('0x2')]}}; \ No newline at end of file +var _0xe82e=['dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal','inbound-fax'];(function(_0x1406ae,_0x292395){var _0x23a076=function(_0x5e147a){while(--_0x5e147a){_0x1406ae['push'](_0x1406ae['shift']());}};_0x23a076(++_0x292395);}(_0xe82e,0x101));var _0xee82=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xe82e[_0x2ec461];return _0x28603d;};'use strict';var Sequelize=require(_0xee82('0x0'));module[_0xee82('0x1')]={'uniqueid':{'type':Sequelize[_0xee82('0x2')]},'type':{'type':Sequelize[_0xee82('0x3')](_0xee82('0x4'),_0xee82('0x5'),'outbound',_0xee82('0x6'),'outbound-fax',_0xee82('0x7'))},'tag':{'type':Sequelize[_0xee82('0x2')]},'accountcode':{'type':Sequelize[_0xee82('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xee82('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xee82('0x2')]},'destinationchannel':{'type':Sequelize[_0xee82('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xee82('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xee82('0x9')]},'answertime':{'type':Sequelize[_0xee82('0x9')]},'endtime':{'type':Sequelize[_0xee82('0x9')]},'duration':{'type':Sequelize[_0xee82('0xa')]},'billableseconds':{'type':Sequelize[_0xee82('0xa')]},'mohtime':{'type':Sequelize[_0xee82('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xee82('0x2')]},'amaflags':{'type':Sequelize[_0xee82('0x2')]},'userfield':{'type':Sequelize[_0xee82('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xee82('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xee82('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xee82('0x2')]},'routeid':{'type':Sequelize[_0xee82('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 15d87eb..2ef4d22 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 _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','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','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x2ef3,0xba));var _0x32ef=function(_0x7a380,_0xc791dc){_0x7a380=_0x7a380-0x0;var _0x2d5221=_0x2ef3[_0x7a380];return _0x2d5221;};'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['VoiceCallReport'][_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')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file +var _0xb10b=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','VoiceCallReport','includeAll','include','alias','User','rows','show','find','create','body','catch','params','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0x3fc42f,_0x16130e){var _0x140221=function(_0x2828db){while(--_0x2828db){_0x3fc42f['push'](_0x3fc42f['shift']());}};_0x140221(++_0x16130e);}(_0xb10b,0x12a));var _0xbb10=function(_0x17044c,_0x208790){_0x17044c=_0x17044c-0x0;var _0x5e6db0=_0xb10b[_0x17044c];return _0x5e6db0;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['VoiceCallReport'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'attributes':['id',_0xbb10('0x28'),'fullname',_0xbb10('0x43')],'model':db[_0xbb10('0x44')],'as':_0xbb10('0x44')}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x331751){_0x2e0249[_0xbb10('0x45')]=_0x331751;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x46')]=function(_0x202c60,_0x54ac18){var _0x5d9a4f={'raw':!![],'where':{'id':_0x202c60['params']['id']}},_0x38d78f={};_0x38d78f[_0xbb10('0x2f')]=_[_0xbb10('0x30')](db['VoiceCallReport'][_0xbb10('0x2c')]);_0x38d78f[_0xbb10('0x31')]=_[_0xbb10('0x30')](_0x202c60['query']);_0x38d78f[_0xbb10('0x3a')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],_0x38d78f[_0xbb10('0x31')]);_0x5d9a4f[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x202c60[_0xbb10('0x31')][_0xbb10('0x34')]));_0x5d9a4f[_0xbb10('0x33')]=_0x5d9a4f[_0xbb10('0x33')]['length']?_0x5d9a4f[_0xbb10('0x33')]:_0x38d78f[_0xbb10('0x2f')];if(_0x202c60['query'][_0xbb10('0x41')]){_0x5d9a4f[_0xbb10('0x42')]=[{'all':!![]}];}_0x5d9a4f=_[_0xbb10('0x3e')]({},_0x5d9a4f,_0x202c60[_0xbb10('0x3f')]);return db[_0xbb10('0x40')][_0xbb10('0x47')](_0x5d9a4f)[_0xbb10('0x23')](handleEntityNotFound(_0x54ac18,null))['then'](respondWithResult(_0x54ac18,null))['catch'](handleError(_0x54ac18,null));};exports[_0xbb10('0x48')]=function(_0x76a208,_0x2b12bd){return db['VoiceCallReport']['create'](_0x76a208[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x2b12bd,0xc9))[_0xbb10('0x4a')](handleError(_0x2b12bd,null));};exports[_0xbb10('0x24')]=function(_0x10159b,_0x22b315){return db[_0xbb10('0x40')][_0xbb10('0x47')]({'where':{'id':_0x10159b[_0xbb10('0x4b')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x22b315,null))['then'](removeEntity(_0x22b315,null))['catch'](handleError(_0x22b315,null));};exports[_0xbb10('0x4c')]=function(_0x467dba,_0x36ab7d){return db[_0xbb10('0x40')][_0xbb10('0x4c')]()[_0xbb10('0x23')](respondWithResult(_0x36ab7d,null))[_0xbb10('0x4a')](handleError(_0x36ab7d,null));};exports[_0xbb10('0x22')]=function(_0x1c0d8f,_0x1214f7){if(_0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')]){delete _0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')];}return db[_0xbb10('0x40')]['find']({'where':{'uniqueid':_0x1c0d8f[_0xbb10('0x4b')]['id'],'UserId':{'$or':[null,_0x1c0d8f['user']['id']]}}})[_0xbb10('0x23')](handleEntityNotFound(_0x1214f7,null))[_0xbb10('0x23')](saveUpdates(_0x1c0d8f[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x1214f7,null))[_0xbb10('0x4a')](handleError(_0x1214f7,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 6dda826..0a7f6a4 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 _0xbb54=['moment','bluebird','rimraf','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','api'];(function(_0x15ca1a,_0x30fc82){var _0x507626=function(_0x14c9bc){while(--_0x14c9bc){_0x15ca1a['push'](_0x15ca1a['shift']());}};_0x507626(++_0x30fc82);}(_0xbb54,0x129));var _0x4bb5=function(_0x401676,_0x3f1436){_0x401676=_0x401676-0x0;var _0x4f13fe=_0xbb54[_0x401676];return _0x4f13fe;};'use strict';var _=require(_0x4bb5('0x0'));var util=require(_0x4bb5('0x1'));var logger=require('../../config/logger')(_0x4bb5('0x2'));var moment=require(_0x4bb5('0x3'));var BPromise=require(_0x4bb5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4bb5('0x5'));var config=require('../../config/environment');var attributes=require(_0x4bb5('0x6'));module[_0x4bb5('0x7')]=function(_0x342190,_0x2925c1){return _0x342190[_0x4bb5('0x8')](_0x4bb5('0x9'),attributes,{'tableName':_0x4bb5('0xa'),'paranoid':![],'indexes':[{'fields':[_0x4bb5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6755=['rimraf','../../config/environment','define','VoiceCallReport','report_call','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x6755,0x179));var _0x5675=function(_0x2eca21,_0x478d03){_0x2eca21=_0x2eca21-0x0;var _0x204797=_0x6755[_0x2eca21];return _0x204797;};'use strict';var _=require(_0x5675('0x0'));var util=require(_0x5675('0x1'));var logger=require(_0x5675('0x2'))(_0x5675('0x3'));var moment=require('moment');var BPromise=require(_0x5675('0x4'));var rp=require(_0x5675('0x5'));var fs=require('fs');var path=require(_0x5675('0x6'));var rimraf=require(_0x5675('0x7'));var config=require(_0x5675('0x8'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x4cd382,_0x25ef96){return _0x4cd382[_0x5675('0x9')](_0x5675('0xa'),attributes,{'tableName':_0x5675('0xb'),'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 946bef9..bfbd367 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 _0xb773=['map','GetVoiceCallReport','body','CreateVoiceCallReport','update','raw','UpdateVoiceCallReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','VoiceCallReport','findAll','options','where','attributes','limit','include','model'];(function(_0x343cb1,_0x327c8d){var _0x1473a2=function(_0x4e6bed){while(--_0x4e6bed){_0x343cb1['push'](_0x343cb1['shift']());}};_0x1473a2(++_0x327c8d);}(_0xb773,0x1c3));var _0x3b77=function(_0x3124f8,_0x1a8b23){_0x3124f8=_0x3124f8-0x0;var _0x5bab5f=_0xb773[_0x3124f8];return _0x5bab5f;};'use strict';var _=require(_0x3b77('0x0'));var util=require(_0x3b77('0x1'));var moment=require(_0x3b77('0x2'));var BPromise=require(_0x3b77('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b77('0x4'));var db=require(_0x3b77('0x5'))['db'];var utils=require(_0x3b77('0x6'));var logger=require(_0x3b77('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3b77('0x8'));var client=jayson[_0x3b77('0x9')][_0x3b77('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40101f,_0x41dec7,_0x402b57){return new BPromise(function(_0xbb6fbb,_0x1e113d){return client[_0x3b77('0xb')](_0x40101f,_0x402b57)[_0x3b77('0xc')](function(_0x6013e1){logger[_0x3b77('0xd')](_0x3b77('0xe'),_0x41dec7,_0x3b77('0xf'));logger[_0x3b77('0x10')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x41dec7,_0x3b77('0xf'),JSON[_0x3b77('0x11')](_0x6013e1));if(_0x6013e1[_0x3b77('0x12')]){if(_0x6013e1[_0x3b77('0x12')]['code']===0x1f4){logger[_0x3b77('0x12')](_0x3b77('0xe'),_0x41dec7,_0x6013e1[_0x3b77('0x12')][_0x3b77('0x13')]);return _0x1e113d(_0x6013e1['error'][_0x3b77('0x13')]);}logger[_0x3b77('0x12')](_0x3b77('0xe'),_0x41dec7,_0x6013e1[_0x3b77('0x12')][_0x3b77('0x13')]);return _0xbb6fbb(_0x6013e1[_0x3b77('0x12')]['message']);}else{logger[_0x3b77('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x41dec7,_0x3b77('0xf'));_0xbb6fbb(_0x6013e1[_0x3b77('0x14')][_0x3b77('0x13')]);}})[_0x3b77('0x15')](function(_0x3c99be){logger[_0x3b77('0x12')](_0x3b77('0xe'),_0x41dec7,_0x3c99be);_0x1e113d(_0x3c99be);});});}exports['GetVoiceCallReport']=function(_0x5cb915){var _0x51b3bc=this;return new Promise(function(_0x2ff22d,_0x59a60f){return db[_0x3b77('0x16')][_0x3b77('0x17')]({'raw':_0x5cb915['options']?_0x5cb915[_0x3b77('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5cb915['options']?_0x5cb915[_0x3b77('0x18')][_0x3b77('0x19')]||null:null,'attributes':_0x5cb915[_0x3b77('0x18')]?_0x5cb915[_0x3b77('0x18')][_0x3b77('0x1a')]||null:null,'limit':_0x5cb915[_0x3b77('0x18')]?_0x5cb915['options'][_0x3b77('0x1b')]||null:null,'include':_0x5cb915[_0x3b77('0x18')]?_0x5cb915[_0x3b77('0x18')][_0x3b77('0x1c')]?_['map'](_0x5cb915[_0x3b77('0x18')][_0x3b77('0x1c')],function(_0x57a2ca){return{'model':db[_0x57a2ca[_0x3b77('0x1d')]],'as':_0x57a2ca['as'],'attributes':_0x57a2ca[_0x3b77('0x1a')],'include':_0x57a2ca[_0x3b77('0x1c')]?_[_0x3b77('0x1e')](_0x57a2ca[_0x3b77('0x1c')],function(_0x3f481c){return{'model':db[_0x3f481c[_0x3b77('0x1d')]],'as':_0x3f481c['as'],'attributes':_0x3f481c[_0x3b77('0x1a')],'include':_0x3f481c[_0x3b77('0x1c')]?_[_0x3b77('0x1e')](_0x3f481c[_0x3b77('0x1c')],function(_0x5e0367){return{'model':db[_0x5e0367[_0x3b77('0x1d')]],'as':_0x5e0367['as'],'attributes':_0x5e0367[_0x3b77('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3b77('0xc')](function(_0x49b4fb){logger[_0x3b77('0xd')](_0x3b77('0x1f'),_0x5cb915);logger[_0x3b77('0x10')](_0x3b77('0x1f'),_0x5cb915,JSON[_0x3b77('0x11')](_0x49b4fb));_0x2ff22d(_0x49b4fb);})[_0x3b77('0x15')](function(_0x408d36){logger[_0x3b77('0x12')](_0x3b77('0x1f'),_0x408d36[_0x3b77('0x13')],_0x5cb915);_0x59a60f(_0x51b3bc['error'](0x1f4,_0x408d36[_0x3b77('0x13')]));});});};exports['CreateVoiceCallReport']=function(_0x1cf3b6){var _0xbf1580=this;return new Promise(function(_0x8730ed,_0x1a731d){return db['VoiceCallReport']['create'](_0x1cf3b6[_0x3b77('0x20')],{'raw':_0x1cf3b6[_0x3b77('0x18')]?_0x1cf3b6[_0x3b77('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x3b77('0xc')](function(_0x354c2d){logger[_0x3b77('0xd')](_0x3b77('0x21'),_0x1cf3b6);logger[_0x3b77('0x10')]('CreateVoiceCallReport',_0x1cf3b6,JSON[_0x3b77('0x11')](_0x354c2d));_0x8730ed(_0x354c2d);})[_0x3b77('0x15')](function(_0x338d7c){logger[_0x3b77('0x12')](_0x3b77('0x21'),_0x338d7c['message'],_0x1cf3b6);_0x1a731d(_0xbf1580[_0x3b77('0x12')](0x1f4,_0x338d7c[_0x3b77('0x13')]));});});};exports['UpdateVoiceCallReport']=function(_0x26615e){var _0x466302=this;return new Promise(function(_0x41d4f6,_0x4c6366){return db[_0x3b77('0x16')][_0x3b77('0x22')](_0x26615e[_0x3b77('0x20')],{'raw':_0x26615e['options']?_0x26615e[_0x3b77('0x18')][_0x3b77('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26615e['options']?_0x26615e[_0x3b77('0x18')][_0x3b77('0x19')]||null:null,'attributes':_0x26615e['options']?_0x26615e['options'][_0x3b77('0x1a')]||null:null,'limit':_0x26615e[_0x3b77('0x18')]?_0x26615e['options'][_0x3b77('0x1b')]||null:null})[_0x3b77('0xc')](function(_0x28bae9){logger['info'](_0x3b77('0x24'),_0x26615e);logger[_0x3b77('0x10')](_0x3b77('0x24'),_0x26615e,JSON[_0x3b77('0x11')](_0x28bae9));_0x41d4f6(_0x28bae9);})[_0x3b77('0x15')](function(_0x2d6c5a){logger[_0x3b77('0x12')](_0x3b77('0x24'),_0x2d6c5a[_0x3b77('0x13')],_0x26615e);_0x4c6366(_0x466302[_0x3b77('0x12')](0x1f4,_0x2d6c5a['message']));});});}; \ No newline at end of file +var _0x244d=['stringify','error','message','result','VoiceCallReport','findAll','options','raw','where','attributes','include','model','map','GetVoiceCallReport','catch','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x244d,0x1f4));var _0xd244=function(_0x3061e9,_0x277846){_0x3061e9=_0x3061e9-0x0;var _0x133f34=_0x244d[_0x3061e9];return _0x133f34;};'use strict';var _=require('lodash');var util=require(_0xd244('0x0'));var moment=require(_0xd244('0x1'));var BPromise=require(_0xd244('0x2'));var rs=require(_0xd244('0x3'));var fs=require('fs');var Redis=require(_0xd244('0x4'));var db=require(_0xd244('0x5'))['db'];var utils=require(_0xd244('0x6'));var logger=require(_0xd244('0x7'))('rpc');var config=require(_0xd244('0x8'));var jayson=require(_0xd244('0x9'));var client=jayson[_0xd244('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3240d8,_0x2bf2a2,_0x2118d5){return new BPromise(function(_0xa23560,_0x4903d1){return client[_0xd244('0xb')](_0x3240d8,_0x2118d5)[_0xd244('0xc')](function(_0xbd305e){logger[_0xd244('0xd')](_0xd244('0xe'),_0x2bf2a2,'request\x20sent');logger[_0xd244('0xf')](_0xd244('0x10'),_0x2bf2a2,_0xd244('0x11'),JSON[_0xd244('0x12')](_0xbd305e));if(_0xbd305e[_0xd244('0x13')]){if(_0xbd305e[_0xd244('0x13')]['code']===0x1f4){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x2bf2a2,_0xbd305e[_0xd244('0x13')][_0xd244('0x14')]);return _0x4903d1(_0xbd305e['error'][_0xd244('0x14')]);}logger['error'](_0xd244('0xe'),_0x2bf2a2,_0xbd305e['error'][_0xd244('0x14')]);return _0xa23560(_0xbd305e[_0xd244('0x13')][_0xd244('0x14')]);}else{logger[_0xd244('0xd')](_0xd244('0xe'),_0x2bf2a2,'request\x20sent');_0xa23560(_0xbd305e[_0xd244('0x15')][_0xd244('0x14')]);}})['catch'](function(_0x36d2ea){logger[_0xd244('0x13')](_0xd244('0xe'),_0x2bf2a2,_0x36d2ea);_0x4903d1(_0x36d2ea);});});}exports['GetVoiceCallReport']=function(_0x295a24){var _0xa53f2f=this;return new Promise(function(_0xe920c1,_0x4d2e17){return db[_0xd244('0x16')][_0xd244('0x17')]({'raw':_0x295a24[_0xd244('0x18')]?_0x295a24[_0xd244('0x18')][_0xd244('0x19')]===undefined?!![]:![]:!![],'where':_0x295a24[_0xd244('0x18')]?_0x295a24[_0xd244('0x18')][_0xd244('0x1a')]||null:null,'attributes':_0x295a24['options']?_0x295a24[_0xd244('0x18')][_0xd244('0x1b')]||null:null,'limit':_0x295a24[_0xd244('0x18')]?_0x295a24[_0xd244('0x18')]['limit']||null:null,'include':_0x295a24[_0xd244('0x18')]?_0x295a24[_0xd244('0x18')]['include']?_['map'](_0x295a24['options'][_0xd244('0x1c')],function(_0x4ae129){return{'model':db[_0x4ae129[_0xd244('0x1d')]],'as':_0x4ae129['as'],'attributes':_0x4ae129[_0xd244('0x1b')],'include':_0x4ae129['include']?_['map'](_0x4ae129[_0xd244('0x1c')],function(_0x1eae4c){return{'model':db[_0x1eae4c['model']],'as':_0x1eae4c['as'],'attributes':_0x1eae4c[_0xd244('0x1b')],'include':_0x1eae4c['include']?_[_0xd244('0x1e')](_0x1eae4c[_0xd244('0x1c')],function(_0x2476ef){return{'model':db[_0x2476ef['model']],'as':_0x2476ef['as'],'attributes':_0x2476ef[_0xd244('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd244('0xc')](function(_0x5d10a9){logger[_0xd244('0xd')](_0xd244('0x1f'),_0x295a24);logger[_0xd244('0xf')](_0xd244('0x1f'),_0x295a24,JSON[_0xd244('0x12')](_0x5d10a9));_0xe920c1(_0x5d10a9);})[_0xd244('0x20')](function(_0x280ede){logger[_0xd244('0x13')](_0xd244('0x1f'),_0x280ede[_0xd244('0x14')],_0x295a24);_0x4d2e17(_0xa53f2f[_0xd244('0x13')](0x1f4,_0x280ede['message']));});});};exports[_0xd244('0x21')]=function(_0x1b5917){var _0x1380c4=this;return new Promise(function(_0x528f31,_0x151453){return db[_0xd244('0x16')][_0xd244('0x22')](_0x1b5917['body'],{'raw':_0x1b5917[_0xd244('0x18')]?_0x1b5917[_0xd244('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xd244('0xc')](function(_0x49ac5c){logger[_0xd244('0xd')](_0xd244('0x21'),_0x1b5917);logger['debug'](_0xd244('0x21'),_0x1b5917,JSON['stringify'](_0x49ac5c));_0x528f31(_0x49ac5c);})['catch'](function(_0x3d30ff){logger[_0xd244('0x13')]('CreateVoiceCallReport',_0x3d30ff['message'],_0x1b5917);_0x151453(_0x1380c4[_0xd244('0x13')](0x1f4,_0x3d30ff[_0xd244('0x14')]));});});};exports['UpdateVoiceCallReport']=function(_0x8d2499){var _0x5c0782=this;return new Promise(function(_0x4548d3,_0x3ee0c9){return db[_0xd244('0x16')]['update'](_0x8d2499[_0xd244('0x23')],{'raw':_0x8d2499['options']?_0x8d2499[_0xd244('0x18')][_0xd244('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8d2499[_0xd244('0x18')]?_0x8d2499[_0xd244('0x18')][_0xd244('0x1a')]||null:null,'attributes':_0x8d2499[_0xd244('0x18')]?_0x8d2499[_0xd244('0x18')]['attributes']||null:null,'limit':_0x8d2499[_0xd244('0x18')]?_0x8d2499[_0xd244('0x18')]['limit']||null:null})['then'](function(_0x1c888f){logger[_0xd244('0xd')](_0xd244('0x24'),_0x8d2499);logger['debug'](_0xd244('0x24'),_0x8d2499,JSON['stringify'](_0x1c888f));_0x4548d3(_0x1c888f);})['catch'](function(_0x493594){logger[_0xd244('0x13')](_0xd244('0x24'),_0x493594[_0xd244('0x14')],_0x8d2499);_0x3ee0c9(_0x5c0782['error'](0x1f4,_0x493594[_0xd244('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 34b7df5..de11c68 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 _0x37fd=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','post','create','put','/:id','delete','destroy','exports','multer','util','path'];(function(_0x12adf9,_0x1331c5){var _0x1b14da=function(_0xe4d4c3){while(--_0xe4d4c3){_0x12adf9['push'](_0x12adf9['shift']());}};_0x1b14da(++_0x1331c5);}(_0x37fd,0x153));var _0xd37f=function(_0x25e4d7,_0x1f5dc6){_0x25e4d7=_0x25e4d7-0x0;var _0x4fc892=_0x37fd[_0x25e4d7];return _0x4fc892;};'use strict';var multer=require(_0xd37f('0x0'));var util=require(_0xd37f('0x1'));var path=require(_0xd37f('0x2'));var timeout=require(_0xd37f('0x3'));var express=require(_0xd37f('0x4'));var router=express[_0xd37f('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd37f('0x6'));var config=require(_0xd37f('0x7'));var controller=require(_0xd37f('0x8'));router[_0xd37f('0x9')]('/',auth[_0xd37f('0xa')](),controller[_0xd37f('0xb')]);router[_0xd37f('0x9')]('/:id',auth[_0xd37f('0xa')](),controller['show']);router[_0xd37f('0xc')]('/',auth[_0xd37f('0xa')](),controller[_0xd37f('0xd')]);router[_0xd37f('0xe')](_0xd37f('0xf'),auth[_0xd37f('0xa')](),controller['update']);router[_0xd37f('0x10')](_0xd37f('0xf'),auth['isAuthenticated'](),controller[_0xd37f('0x11')]);module[_0xd37f('0x12')]=router; \ No newline at end of file +var _0xc78b=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x9b2ba1,_0x16fd22){var _0x427bc7=function(_0x3e503e){while(--_0x3e503e){_0x9b2ba1['push'](_0x9b2ba1['shift']());}};_0x427bc7(++_0x16fd22);}(_0xc78b,0x109));var _0xbc78=function(_0x4e28a5,_0x50af46){_0x4e28a5=_0x4e28a5-0x0;var _0x400723=_0xc78b[_0x4e28a5];return _0x400723;};'use strict';var multer=require(_0xbc78('0x0'));var util=require(_0xbc78('0x1'));var path=require(_0xbc78('0x2'));var timeout=require(_0xbc78('0x3'));var express=require('express');var router=express[_0xbc78('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbc78('0x5'));var interaction=require(_0xbc78('0x6'));var config=require(_0xbc78('0x7'));var controller=require('./voiceChanSpy.controller');router['get']('/',auth[_0xbc78('0x8')](),controller[_0xbc78('0x9')]);router[_0xbc78('0xa')](_0xbc78('0xb'),auth[_0xbc78('0x8')](),controller[_0xbc78('0xc')]);router[_0xbc78('0xd')]('/',auth[_0xbc78('0x8')](),controller[_0xbc78('0xe')]);router[_0xbc78('0xf')](_0xbc78('0xb'),auth[_0xbc78('0x8')](),controller['update']);router['delete'](_0xbc78('0xb'),auth[_0xbc78('0x8')](),controller[_0xbc78('0x10')]);module[_0xbc78('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index b52edc1..a07d162 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 _0x6b44=['STRING','options','join','getDataValue','BOOLEAN'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x6b44,0xf5));var _0x46b4=function(_0x2f4c1c,_0x5a3dd4){_0x2f4c1c=_0x2f4c1c-0x0;var _0x25e0f2=_0x6b44[_0x2f4c1c];return _0x25e0f2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x46b4('0x0')]},'prefix':{'type':Sequelize[_0x46b4('0x0')],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x20aa61){this['setDataValue'](_0x46b4('0x1'),_0x20aa61?_0x20aa61[_0x46b4('0x2')](''):[]);},'get':function(){return this[_0x46b4('0x3')](_0x46b4('0x1'))?this['getDataValue'](_0x46b4('0x1'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x46b4('0x4')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x46b4('0x0')]}}; \ No newline at end of file +var _0xce71=['options','join','getDataValue','split','BOOLEAN','exports','STRING','setDataValue'];(function(_0x2a878e,_0x472358){var _0x3ff615=function(_0x34eb9c){while(--_0x34eb9c){_0x2a878e['push'](_0x2a878e['shift']());}};_0x3ff615(++_0x472358);}(_0xce71,0xad));var _0x1ce7=function(_0x35cf09,_0x5e86eb){_0x35cf09=_0x35cf09-0x0;var _0x3063f8=_0xce71[_0x35cf09];return _0x3063f8;};'use strict';var Sequelize=require('sequelize');module[_0x1ce7('0x0')]={'name':{'type':Sequelize[_0x1ce7('0x1')]},'prefix':{'type':Sequelize[_0x1ce7('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x1ce7('0x1')],'set':function(_0x3ec960){this[_0x1ce7('0x2')](_0x1ce7('0x3'),_0x3ec960?_0x3ec960[_0x1ce7('0x4')](''):[]);},'get':function(){return this['getDataValue']('options')?this[_0x1ce7('0x5')]('options')[_0x1ce7('0x6')](''):[];}},'auth':{'type':Sequelize[_0x1ce7('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x1ce7('0x1')]},'record':{'type':Sequelize[_0x1ce7('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x1ce7('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 104300a..4df6dfd 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 _0x502a=['api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','VoiceChanSpy','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','userProfileId','autoAssociation','error','catch','params','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x57a50d,_0x2871f8){var _0x1b25b3=function(_0x45691e){while(--_0x45691e){_0x57a50d['push'](_0x57a50d['shift']());}};_0x1b25b3(++_0x2871f8);}(_0x502a,0xd8));var _0xa502=function(_0x489af9,_0x4318ce){_0x489af9=_0x489af9-0x0;var _0x16b973=_0x502a[_0x489af9];return _0x16b973;};'use strict';var emlformat=require(_0xa502('0x0'));var rimraf=require(_0xa502('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa502('0x2'));var rp=require(_0xa502('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa502('0x4'));var util=require('util');var path=require(_0xa502('0x5'));var sox=require(_0xa502('0x6'));var csv=require(_0xa502('0x7'));var ejs=require(_0xa502('0x8'));var fs=require('fs');var fs_extra=require(_0xa502('0x9'));var _=require('lodash');var squel=require(_0xa502('0xa'));var crypto=require(_0xa502('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa502('0x7'));var querystring=require(_0xa502('0xc'));var Papa=require('papaparse');var Redis=require(_0xa502('0xd'));var authService=require(_0xa502('0xe'));var qs=require(_0xa502('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa502('0x10'));var logger=require(_0xa502('0x11'))(_0xa502('0x12'));var utils=require('../../config/utils');var config=require(_0xa502('0x13'));var licenseUtil=require(_0xa502('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a18ad,_0x186bda){_0x186bda=_0x186bda||0xcc;return function(_0x5e8a81){if(_0x5e8a81){return _0x3a18ad[_0xa502('0x15')](_0x186bda);}return _0x3a18ad[_0xa502('0x16')](_0x186bda)[_0xa502('0x17')]();};}function respondWithResult(_0x531dca,_0x10a43c){_0x10a43c=_0x10a43c||0xc8;return function(_0x1d1086){if(_0x1d1086){return _0x531dca[_0xa502('0x16')](_0x10a43c)['json'](_0x1d1086);}};}function respondWithFilteredResult(_0x2db786,_0x2b3b13){return function(_0x432922){if(_0x432922){var _0x2dcb5b=typeof _0x2b3b13[_0xa502('0x18')]===_0xa502('0x19')&&typeof _0x2b3b13[_0xa502('0x1a')]===_0xa502('0x19');var _0x2e76b8=_0x432922[_0xa502('0x1b')];var _0x1445ec=_0x2dcb5b?0x0:_0x2b3b13[_0xa502('0x18')];var _0x1d2f3d=_0x2dcb5b?_0x432922[_0xa502('0x1b')]:_0x2b3b13[_0xa502('0x18')]+_0x2b3b13[_0xa502('0x1a')];var _0x35ed38;if(_0x1d2f3d>=_0x2e76b8){_0x1d2f3d=_0x2e76b8;_0x35ed38=0xc8;}else{_0x35ed38=0xce;}_0x2db786[_0xa502('0x16')](_0x35ed38);return _0x2db786['set']('Content-Range',_0x1445ec+'-'+_0x1d2f3d+'/'+_0x2e76b8)[_0xa502('0x1c')](_0x432922);}return null;};}function patchUpdates(_0x331d55){return function(_0xb0d161){try{jsonpatch[_0xa502('0x1d')](_0xb0d161,_0x331d55,!![]);}catch(_0x3cd020){return BPromise[_0xa502('0x1e')](_0x3cd020);}return _0xb0d161[_0xa502('0x1f')]();};}function saveUpdates(_0x75c45c,_0x287f03){return function(_0x2dda13){if(_0x2dda13){return _0x2dda13[_0xa502('0x20')](_0x75c45c)[_0xa502('0x21')](function(_0x565564){return _0x565564;});}return null;};}function removeEntity(_0x3edc73,_0x1e6c5a){return function(_0x28bc20){if(_0x28bc20){return _0x28bc20[_0xa502('0x22')]()[_0xa502('0x21')](function(){var _0x10f7e8=_0x28bc20[_0xa502('0x23')]({'plain':!![]});var _0x55476d='ChanSpies';return db[_0xa502('0x24')]['destroy']({'where':{'type':_0x55476d,'resourceId':_0x10f7e8['id']}})[_0xa502('0x21')](function(){return _0x28bc20;});})[_0xa502('0x21')](function(){_0x3edc73['status'](0xcc)[_0xa502('0x17')]();});}};}function handleEntityNotFound(_0x1fa8ff,_0x576609){return function(_0xb2c9a0){if(!_0xb2c9a0){_0x1fa8ff[_0xa502('0x15')](0x194);}return _0xb2c9a0;};}function handleError(_0x167917,_0x563afc){_0x563afc=_0x563afc||0x1f4;return function(_0x522122){logger['error'](_0x522122[_0xa502('0x25')]);if(_0x522122[_0xa502('0x26')]){delete _0x522122['name'];}_0x167917['status'](_0x563afc)[_0xa502('0x27')](_0x522122);};}exports[_0xa502('0x28')]=function(_0x4fccea,_0x19e53c){var _0x1f56be={},_0x5e56b6={},_0xd1e939={'count':0x0,'rows':[]};var _0x3e4a98=_[_0xa502('0x29')](db[_0xa502('0x2a')]['rawAttributes'],function(_0x4f9d9c){return{'name':_0x4f9d9c[_0xa502('0x2b')],'type':_0x4f9d9c[_0xa502('0x2c')][_0xa502('0x2d')]};});_0x5e56b6[_0xa502('0x2e')]=_[_0xa502('0x29')](_0x3e4a98,_0xa502('0x26'));_0x5e56b6[_0xa502('0x2f')]=_['keys'](_0x4fccea['query']);_0x5e56b6[_0xa502('0x30')]=_['intersection'](_0x5e56b6[_0xa502('0x2e')],_0x5e56b6[_0xa502('0x2f')]);_0x1f56be[_0xa502('0x31')]=_[_0xa502('0x32')](_0x5e56b6['model'],qs[_0xa502('0x33')](_0x4fccea[_0xa502('0x2f')][_0xa502('0x33')]));_0x1f56be[_0xa502('0x31')]=_0x1f56be['attributes']['length']?_0x1f56be[_0xa502('0x31')]:_0x5e56b6[_0xa502('0x2e')];if(!_0x4fccea[_0xa502('0x2f')][_0xa502('0x34')]('nolimit')){_0x1f56be[_0xa502('0x1a')]=qs[_0xa502('0x1a')](_0x4fccea['query'][_0xa502('0x1a')]);_0x1f56be[_0xa502('0x18')]=qs['offset'](_0x4fccea[_0xa502('0x2f')][_0xa502('0x18')]);}_0x1f56be['order']=qs[_0xa502('0x35')](_0x4fccea['query']['sort']);_0x1f56be[_0xa502('0x36')]=qs[_0xa502('0x30')](_[_0xa502('0x37')](_0x4fccea[_0xa502('0x2f')],_0x5e56b6[_0xa502('0x30')]),_0x3e4a98);if(_0x4fccea['query'][_0xa502('0x38')]){_0x1f56be[_0xa502('0x36')]=_[_0xa502('0x39')](_0x1f56be[_0xa502('0x36')],{'$or':_['map'](_0x3e4a98,function(_0x3004ba){if(_0x3004ba[_0xa502('0x2c')]!==_0xa502('0x3a')){var _0x289cce={};_0x289cce[_0x3004ba['name']]={'$like':'%'+_0x4fccea['query'][_0xa502('0x38')]+'%'};return _0x289cce;}})});}_0x1f56be=_[_0xa502('0x39')]({},_0x1f56be,_0x4fccea[_0xa502('0x3b')]);var _0x5c916f={'where':_0x1f56be[_0xa502('0x36')]};return db['VoiceChanSpy']['count'](_0x5c916f)[_0xa502('0x21')](function(_0x3c7c73){_0xd1e939[_0xa502('0x1b')]=_0x3c7c73;if(_0x4fccea[_0xa502('0x2f')][_0xa502('0x3c')]){_0x1f56be[_0xa502('0x3d')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x1f56be);})[_0xa502('0x21')](function(_0x3f777c){_0xd1e939[_0xa502('0x3e')]=_0x3f777c;return _0xd1e939;})['then'](respondWithFilteredResult(_0x19e53c,_0x1f56be))['catch'](handleError(_0x19e53c,null));};exports[_0xa502('0x3f')]=function(_0x26f15d,_0x41a763){var _0x47388f={'raw':![],'where':{'id':_0x26f15d['params']['id']}},_0x25c7b4={};_0x25c7b4[_0xa502('0x2e')]=_['keys'](db[_0xa502('0x2a')]['rawAttributes']);_0x25c7b4[_0xa502('0x2f')]=_[_0xa502('0x40')](_0x26f15d[_0xa502('0x2f')]);_0x25c7b4[_0xa502('0x30')]=_['intersection'](_0x25c7b4['model'],_0x25c7b4[_0xa502('0x2f')]);_0x47388f[_0xa502('0x31')]=_['intersection'](_0x25c7b4['model'],qs[_0xa502('0x33')](_0x26f15d[_0xa502('0x2f')]['fields']));_0x47388f[_0xa502('0x31')]=_0x47388f[_0xa502('0x31')]['length']?_0x47388f[_0xa502('0x31')]:_0x25c7b4[_0xa502('0x2e')];if(_0x26f15d[_0xa502('0x2f')][_0xa502('0x3c')]){_0x47388f[_0xa502('0x3d')]=[{'all':!![]}];}_0x47388f=_['merge']({},_0x47388f,_0x26f15d[_0xa502('0x3b')]);return db[_0xa502('0x2a')][_0xa502('0x41')](_0x47388f)['then'](handleEntityNotFound(_0x41a763,null))['then'](respondWithResult(_0x41a763,null))['catch'](handleError(_0x41a763,null));};exports[_0xa502('0x42')]=function(_0x25ee48,_0x3ba272){return db[_0xa502('0x2a')]['create'](_0x25ee48[_0xa502('0x43')],{})[_0xa502('0x21')](function(_0x7105b3){var _0xfdd0f1=_0x25ee48[_0xa502('0x44')]['get']({'plain':!![]});if(!_0xfdd0f1)throw new Error(_0xa502('0x45'));if(_0xfdd0f1[_0xa502('0x46')]==='user'){var _0x1f7ffe=_0x7105b3['get']({'plain':!![]});var _0x35a8ff=_0xa502('0x47');return db[_0xa502('0x48')][_0xa502('0x41')]({'where':{'name':_0x35a8ff,'userProfileId':_0xfdd0f1[_0xa502('0x49')]},'raw':!![]})[_0xa502('0x21')](function(_0x1adb4e){if(_0x1adb4e&&_0x1adb4e[_0xa502('0x4a')]===0x0){return db[_0xa502('0x24')]['create']({'name':_0x1f7ffe['name'],'resourceId':_0x1f7ffe['id'],'type':_0x1adb4e['name'],'sectionId':_0x1adb4e['id']},{})[_0xa502('0x21')](function(){return _0x7105b3;});}else{return _0x7105b3;}})['catch'](function(_0x18df02){logger[_0xa502('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18df02);throw _0x18df02;});}return _0x7105b3;})[_0xa502('0x21')](respondWithResult(_0x3ba272,0xc9))[_0xa502('0x4c')](handleError(_0x3ba272,null));};exports[_0xa502('0x20')]=function(_0x378d3e,_0x108221){if(_0x378d3e[_0xa502('0x43')]['id']){delete _0x378d3e[_0xa502('0x43')]['id'];}return db[_0xa502('0x2a')][_0xa502('0x41')]({'where':{'id':_0x378d3e[_0xa502('0x4d')]['id']}})[_0xa502('0x21')](handleEntityNotFound(_0x108221,null))[_0xa502('0x21')](saveUpdates(_0x378d3e['body'],null))[_0xa502('0x21')](respondWithResult(_0x108221,null))['catch'](handleError(_0x108221,null));};exports[_0xa502('0x22')]=function(_0x32849e,_0x2e8d42){return db['VoiceChanSpy'][_0xa502('0x41')]({'where':{'id':_0x32849e[_0xa502('0x4d')]['id']}})[_0xa502('0x21')](handleEntityNotFound(_0x2e8d42,null))[_0xa502('0x21')](removeEntity(_0x2e8d42,null))[_0xa502('0x4c')](handleError(_0x2e8d42,null));}; \ No newline at end of file +var _0x3cfb=['role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','sendStatus','error','stack','name','send','index','map','VoiceChanSpy','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','rawAttributes','includeAll','find','create','user'];(function(_0x110d53,_0x59b52e){var _0x24c192=function(_0xb43ee3){while(--_0xb43ee3){_0x110d53['push'](_0x110d53['shift']());}};_0x24c192(++_0x59b52e);}(_0x3cfb,0x1b8));var _0xb3cf=function(_0x2b64d7,_0x2a1076){_0x2b64d7=_0x2b64d7-0x0;var _0x2cbe23=_0x3cfb[_0x2b64d7];return _0x2cbe23;};'use strict';var emlformat=require(_0xb3cf('0x0'));var rimraf=require(_0xb3cf('0x1'));var zipdir=require(_0xb3cf('0x2'));var jsonpatch=require(_0xb3cf('0x3'));var rp=require(_0xb3cf('0x4'));var moment=require(_0xb3cf('0x5'));var BPromise=require(_0xb3cf('0x6'));var Mustache=require(_0xb3cf('0x7'));var util=require('util');var path=require(_0xb3cf('0x8'));var sox=require(_0xb3cf('0x9'));var csv=require(_0xb3cf('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb3cf('0xb'));var _=require(_0xb3cf('0xc'));var squel=require(_0xb3cf('0xd'));var crypto=require('crypto');var jsforce=require(_0xb3cf('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb3cf('0xf'));var Papa=require(_0xb3cf('0x10'));var Redis=require(_0xb3cf('0x11'));var authService=require(_0xb3cf('0x12'));var qs=require(_0xb3cf('0x13'));var as=require(_0xb3cf('0x14'));var hardwareService=require(_0xb3cf('0x15'));var logger=require(_0xb3cf('0x16'))(_0xb3cf('0x17'));var utils=require(_0xb3cf('0x18'));var config=require(_0xb3cf('0x19'));var licenseUtil=require(_0xb3cf('0x1a'));var db=require(_0xb3cf('0x1b'))['db'];function respondWithStatusCode(_0x80af12,_0x16bb17){_0x16bb17=_0x16bb17||0xcc;return function(_0x530325){if(_0x530325){return _0x80af12['sendStatus'](_0x16bb17);}return _0x80af12[_0xb3cf('0x1c')](_0x16bb17)[_0xb3cf('0x1d')]();};}function respondWithResult(_0x5ec589,_0x21ce6c){_0x21ce6c=_0x21ce6c||0xc8;return function(_0x510bae){if(_0x510bae){return _0x5ec589['status'](_0x21ce6c)[_0xb3cf('0x1e')](_0x510bae);}};}function respondWithFilteredResult(_0x66ea06,_0x2eff5c){return function(_0x56f703){if(_0x56f703){var _0x17e8cd=typeof _0x2eff5c[_0xb3cf('0x1f')]===_0xb3cf('0x20')&&typeof _0x2eff5c[_0xb3cf('0x21')]===_0xb3cf('0x20');var _0x31ad79=_0x56f703[_0xb3cf('0x22')];var _0x2d0018=_0x17e8cd?0x0:_0x2eff5c[_0xb3cf('0x1f')];var _0x222c1d=_0x17e8cd?_0x56f703['count']:_0x2eff5c[_0xb3cf('0x1f')]+_0x2eff5c[_0xb3cf('0x21')];var _0x35fb62;if(_0x222c1d>=_0x31ad79){_0x222c1d=_0x31ad79;_0x35fb62=0xc8;}else{_0x35fb62=0xce;}_0x66ea06[_0xb3cf('0x1c')](_0x35fb62);return _0x66ea06['set'](_0xb3cf('0x23'),_0x2d0018+'-'+_0x222c1d+'/'+_0x31ad79)[_0xb3cf('0x1e')](_0x56f703);}return null;};}function patchUpdates(_0x2557db){return function(_0x1dfbc3){try{jsonpatch[_0xb3cf('0x24')](_0x1dfbc3,_0x2557db,!![]);}catch(_0x2ee4a0){return BPromise[_0xb3cf('0x25')](_0x2ee4a0);}return _0x1dfbc3[_0xb3cf('0x26')]();};}function saveUpdates(_0x33ed8f,_0x1bfe02){return function(_0x4c96fd){if(_0x4c96fd){return _0x4c96fd[_0xb3cf('0x27')](_0x33ed8f)[_0xb3cf('0x28')](function(_0x351196){return _0x351196;});}return null;};}function removeEntity(_0x203ce3,_0x1fb3ea){return function(_0x402d3e){if(_0x402d3e){return _0x402d3e[_0xb3cf('0x29')]()[_0xb3cf('0x28')](function(){var _0xce6336=_0x402d3e[_0xb3cf('0x2a')]({'plain':!![]});var _0x5d939e=_0xb3cf('0x2b');return db[_0xb3cf('0x2c')][_0xb3cf('0x29')]({'where':{'type':_0x5d939e,'resourceId':_0xce6336['id']}})['then'](function(){return _0x402d3e;});})['then'](function(){_0x203ce3[_0xb3cf('0x1c')](0xcc)[_0xb3cf('0x1d')]();});}};}function handleEntityNotFound(_0x5dfe51,_0x5ce23b){return function(_0xfc0f5b){if(!_0xfc0f5b){_0x5dfe51[_0xb3cf('0x2d')](0x194);}return _0xfc0f5b;};}function handleError(_0x49a4a8,_0x43269a){_0x43269a=_0x43269a||0x1f4;return function(_0x42b1fc){logger[_0xb3cf('0x2e')](_0x42b1fc[_0xb3cf('0x2f')]);if(_0x42b1fc[_0xb3cf('0x30')]){delete _0x42b1fc[_0xb3cf('0x30')];}_0x49a4a8[_0xb3cf('0x1c')](_0x43269a)[_0xb3cf('0x31')](_0x42b1fc);};}exports[_0xb3cf('0x32')]=function(_0x2fc46b,_0x4c71fe){var _0x46882a={},_0x58bb94={},_0x4dd278={'count':0x0,'rows':[]};var _0x52d78d=_[_0xb3cf('0x33')](db[_0xb3cf('0x34')]['rawAttributes'],function(_0x12ce25){return{'name':_0x12ce25[_0xb3cf('0x35')],'type':_0x12ce25[_0xb3cf('0x36')][_0xb3cf('0x37')]};});_0x58bb94[_0xb3cf('0x38')]=_[_0xb3cf('0x33')](_0x52d78d,'name');_0x58bb94[_0xb3cf('0x39')]=_['keys'](_0x2fc46b[_0xb3cf('0x39')]);_0x58bb94[_0xb3cf('0x3a')]=_[_0xb3cf('0x3b')](_0x58bb94[_0xb3cf('0x38')],_0x58bb94[_0xb3cf('0x39')]);_0x46882a[_0xb3cf('0x3c')]=_['intersection'](_0x58bb94['model'],qs[_0xb3cf('0x3d')](_0x2fc46b['query']['fields']));_0x46882a[_0xb3cf('0x3c')]=_0x46882a['attributes'][_0xb3cf('0x3e')]?_0x46882a[_0xb3cf('0x3c')]:_0x58bb94[_0xb3cf('0x38')];if(!_0x2fc46b[_0xb3cf('0x39')][_0xb3cf('0x3f')](_0xb3cf('0x40'))){_0x46882a['limit']=qs[_0xb3cf('0x21')](_0x2fc46b[_0xb3cf('0x39')][_0xb3cf('0x21')]);_0x46882a[_0xb3cf('0x1f')]=qs['offset'](_0x2fc46b[_0xb3cf('0x39')]['offset']);}_0x46882a[_0xb3cf('0x41')]=qs['sort'](_0x2fc46b[_0xb3cf('0x39')][_0xb3cf('0x42')]);_0x46882a[_0xb3cf('0x43')]=qs['filters'](_['pick'](_0x2fc46b[_0xb3cf('0x39')],_0x58bb94[_0xb3cf('0x3a')]),_0x52d78d);if(_0x2fc46b['query']['filter']){_0x46882a['where']=_[_0xb3cf('0x44')](_0x46882a[_0xb3cf('0x43')],{'$or':_['map'](_0x52d78d,function(_0x5b34fb){if(_0x5b34fb['type']!==_0xb3cf('0x45')){var _0x17f77a={};_0x17f77a[_0x5b34fb[_0xb3cf('0x30')]]={'$like':'%'+_0x2fc46b[_0xb3cf('0x39')]['filter']+'%'};return _0x17f77a;}})});}_0x46882a=_['merge']({},_0x46882a,_0x2fc46b[_0xb3cf('0x46')]);var _0x395628={'where':_0x46882a[_0xb3cf('0x43')]};return db[_0xb3cf('0x34')]['count'](_0x395628)[_0xb3cf('0x28')](function(_0x77abfc){_0x4dd278[_0xb3cf('0x22')]=_0x77abfc;if(_0x2fc46b[_0xb3cf('0x39')]['includeAll']){_0x46882a[_0xb3cf('0x47')]=[{'all':!![]}];}return db[_0xb3cf('0x34')][_0xb3cf('0x48')](_0x46882a);})['then'](function(_0x2486d1){_0x4dd278['rows']=_0x2486d1;return _0x4dd278;})['then'](respondWithFilteredResult(_0x4c71fe,_0x46882a))[_0xb3cf('0x49')](handleError(_0x4c71fe,null));};exports[_0xb3cf('0x4a')]=function(_0x4f199c,_0x4dd0ef){var _0x286052={'raw':![],'where':{'id':_0x4f199c[_0xb3cf('0x4b')]['id']}},_0xf671d0={};_0xf671d0['model']=_[_0xb3cf('0x4c')](db[_0xb3cf('0x34')][_0xb3cf('0x4d')]);_0xf671d0[_0xb3cf('0x39')]=_[_0xb3cf('0x4c')](_0x4f199c[_0xb3cf('0x39')]);_0xf671d0[_0xb3cf('0x3a')]=_[_0xb3cf('0x3b')](_0xf671d0['model'],_0xf671d0[_0xb3cf('0x39')]);_0x286052[_0xb3cf('0x3c')]=_[_0xb3cf('0x3b')](_0xf671d0[_0xb3cf('0x38')],qs[_0xb3cf('0x3d')](_0x4f199c[_0xb3cf('0x39')]['fields']));_0x286052[_0xb3cf('0x3c')]=_0x286052[_0xb3cf('0x3c')][_0xb3cf('0x3e')]?_0x286052[_0xb3cf('0x3c')]:_0xf671d0[_0xb3cf('0x38')];if(_0x4f199c[_0xb3cf('0x39')][_0xb3cf('0x4e')]){_0x286052[_0xb3cf('0x47')]=[{'all':!![]}];}_0x286052=_[_0xb3cf('0x44')]({},_0x286052,_0x4f199c[_0xb3cf('0x46')]);return db[_0xb3cf('0x34')][_0xb3cf('0x4f')](_0x286052)['then'](handleEntityNotFound(_0x4dd0ef,null))[_0xb3cf('0x28')](respondWithResult(_0x4dd0ef,null))['catch'](handleError(_0x4dd0ef,null));};exports[_0xb3cf('0x50')]=function(_0x590196,_0x2ef02b){return db['VoiceChanSpy'][_0xb3cf('0x50')](_0x590196['body'],{})[_0xb3cf('0x28')](function(_0x3678f7){var _0x4cff13=_0x590196[_0xb3cf('0x51')]['get']({'plain':!![]});if(!_0x4cff13)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4cff13[_0xb3cf('0x52')]===_0xb3cf('0x51')){var _0x2774aa=_0x3678f7[_0xb3cf('0x2a')]({'plain':!![]});var _0x27e1e3=_0xb3cf('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0x27e1e3,'userProfileId':_0x4cff13[_0xb3cf('0x53')]},'raw':!![]})[_0xb3cf('0x28')](function(_0x177ef9){if(_0x177ef9&&_0x177ef9[_0xb3cf('0x54')]===0x0){return db[_0xb3cf('0x2c')][_0xb3cf('0x50')]({'name':_0x2774aa[_0xb3cf('0x30')],'resourceId':_0x2774aa['id'],'type':_0x177ef9[_0xb3cf('0x30')],'sectionId':_0x177ef9['id']},{})[_0xb3cf('0x28')](function(){return _0x3678f7;});}else{return _0x3678f7;}})[_0xb3cf('0x49')](function(_0x57a1df){logger[_0xb3cf('0x2e')](_0xb3cf('0x55'),_0x57a1df);throw _0x57a1df;});}return _0x3678f7;})[_0xb3cf('0x28')](respondWithResult(_0x2ef02b,0xc9))['catch'](handleError(_0x2ef02b,null));};exports[_0xb3cf('0x27')]=function(_0x4bfff3,_0x56c362){if(_0x4bfff3[_0xb3cf('0x56')]['id']){delete _0x4bfff3['body']['id'];}return db[_0xb3cf('0x34')]['find']({'where':{'id':_0x4bfff3['params']['id']}})['then'](handleEntityNotFound(_0x56c362,null))['then'](saveUpdates(_0x4bfff3[_0xb3cf('0x56')],null))['then'](respondWithResult(_0x56c362,null))[_0xb3cf('0x49')](handleError(_0x56c362,null));};exports[_0xb3cf('0x29')]=function(_0x3f924d,_0x155642){return db[_0xb3cf('0x34')]['find']({'where':{'id':_0x3f924d[_0xb3cf('0x4b')]['id']}})[_0xb3cf('0x28')](handleEntityNotFound(_0x155642,null))['then'](removeEntity(_0x155642,null))[_0xb3cf('0x49')](handleError(_0x155642,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index d996688..98aeff3 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 _0x4e1e=['VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0x4e1e,0xa7));var _0xe4e1=function(_0x47568e,_0x5ccdaf){_0x47568e=_0x47568e-0x0;var _0x33815b=_0x4e1e[_0x47568e];return _0x33815b;};'use strict';var _=require(_0xe4e1('0x0'));var util=require(_0xe4e1('0x1'));var BPromise=require(_0xe4e1('0x2'));var attributes=require(_0xe4e1('0x3'));var getUserApplications=function(_0x386b10,_0x159450,_0x2b45fe){var _0x563ce4=0x1;var _0x5026ef=[];var _0x3fdf90={'context':_0x159450[_0xe4e1('0x4')]||_0xe4e1('0x5'),'exten':util[_0xe4e1('0x6')](_0xe4e1('0x7'),_0x386b10[_0xe4e1('0x8')],_0x2b45fe),'type':_0xe4e1('0x9'),'isApp':![],'ChanSpyId':_0x386b10['id'],'UserId':_0x159450['id']};_0x5026ef[_0xe4e1('0xa')](_[_0xe4e1('0xb')]({'app':_0xe4e1('0xc'),'appdata':util['format'](_0xe4e1('0xd'),_0xe4e1('0xe')),'priority':_0x563ce4++},_0x3fdf90));if(_0x386b10[_0xe4e1('0xf')]){_0x5026ef[_0xe4e1('0xa')](_['merge']({'app':_0xe4e1('0x10'),'appdata':util['format'](_0xe4e1('0x11'),_0x386b10[_0xe4e1('0x12')]),'priority':_0x563ce4++},_0x3fdf90));}if(_0x386b10['auth']){_0x5026ef['push'](_[_0xe4e1('0xb')]({'app':_0xe4e1('0x13'),'appdata':_0x386b10[_0xe4e1('0x14')],'priority':_0x563ce4++},_0x3fdf90));}_0x5026ef['push'](_[_0xe4e1('0xb')]({'app':'ChanSpy','appdata':util[_0xe4e1('0x6')]('SIP/%s,%s',_0x159450[_0xe4e1('0x15')],_0x386b10['options']?_0x386b10[_0xe4e1('0x16')][_0xe4e1('0x17')](''):''),'priority':_0x563ce4++},_0x3fdf90));if(_0x386b10[_0xe4e1('0xf')]){_0x5026ef[_0xe4e1('0xa')](_[_0xe4e1('0xb')]({'app':_0xe4e1('0x18'),'priority':_0x563ce4++},_0x3fdf90));}return _0x5026ef;};var getChanSpyApplications=function(_0x57603b,_0x24fd31){var _0x40da9b=[];for(var _0x18ecca=0x0,_0x313ba7=0x1;_0x18ecca<_0x24fd31[_0xe4e1('0x19')];_0x18ecca++,_0x313ba7=0x1){_0x40da9b=_0x40da9b[_0xe4e1('0x1a')](getUserApplications(_0x57603b,_0x24fd31[_0x18ecca],_0x24fd31[_0x18ecca][_0xe4e1('0x1b')]));if(_0x24fd31[_0x18ecca][_0xe4e1('0x1b')]!=_0x24fd31[_0x18ecca][_0xe4e1('0x15')]){_0x40da9b=_0x40da9b[_0xe4e1('0x1a')](getUserApplications(_0x57603b,_0x24fd31[_0x18ecca],_0x24fd31[_0x18ecca][_0xe4e1('0x15')]));}}return _0x40da9b;};var getChanSpyPromise=function(_0x52c564,_0x4525){return new BPromise(function(_0x424bd2,_0x20f201){return _0x52c564[_0xe4e1('0x1c')][_0xe4e1('0x1d')]({'attributes':['id',_0xe4e1('0x15'),_0xe4e1('0x1b')],'where':{'role':_0xe4e1('0x1e'),'chanspy':!![]},'raw':!![]})[_0xe4e1('0x1f')](function(_0x232417){if(_0x232417){return _0x424bd2(getChanSpyApplications(_0x4525,_0x232417));}return _0x424bd2([]);})[_0xe4e1('0x20')](function(_0x1b457b){_0x20f201(_0x1b457b);});});};module[_0xe4e1('0x21')]=function(_0xfc23aa,_0x23521d){var _0x4a8032=_0xfc23aa[_0xe4e1('0x22')];return _0xfc23aa[_0xe4e1('0x23')](_0xe4e1('0x24'),attributes,{'tableName':_0xe4e1('0x25'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x57443a,_0xd9feb7,_0x49a31f){return getChanSpyPromise(_0x4a8032,_0x57443a)[_0xe4e1('0x1f')](function(_0x1882bd){if(_0x1882bd&&_0x1882bd[_0xe4e1('0x19')]){return _0x4a8032[_0xe4e1('0x26')][_0xe4e1('0x27')](_0x1882bd);}})[_0xe4e1('0x1f')](function(){_0x49a31f();})[_0xe4e1('0x20')](function(_0x315aed){_0x49a31f(_0x315aed);});},'afterUpdate':function(_0x37f626,_0x22d4e5,_0x433d20){return _0x4a8032[_0xe4e1('0x26')][_0xe4e1('0x28')]({'where':{'ChanSpyId':_0x37f626['id']}})['then'](function(){return getChanSpyPromise(_0x4a8032,_0x37f626);})[_0xe4e1('0x1f')](function(_0x76126c){if(_0x76126c&&_0x76126c[_0xe4e1('0x19')]){return _0x4a8032[_0xe4e1('0x26')][_0xe4e1('0x27')](_0x76126c);}})[_0xe4e1('0x1f')](function(){_0x433d20();})[_0xe4e1('0x20')](function(_0x22f0cb){_0x433d20(_0x22f0cb);});},'afterDestroy':function(_0x41b4e0,_0x17e9f9,_0xf1b46b){return _0x4a8032['VoiceExtension'][_0xe4e1('0x28')]({'where':{'ChanSpyId':_0x41b4e0['id']}})['then'](function(){_0xf1b46b();})[_0xe4e1('0x20')](function(_0x35d7a8){_0xf1b46b(_0x35d7a8);});}}});}; \ No newline at end of file +var _0xbf48=['StopMixMonitor','length','internal','User','exports','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','catch','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','from-sip','format','prefix','system','push','merge','Set','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join'];(function(_0x230a61,_0x5f3286){var _0x2609a5=function(_0x1f9067){while(--_0x1f9067){_0x230a61['push'](_0x230a61['shift']());}};_0x2609a5(++_0x5f3286);}(_0xbf48,0x1e8));var _0x8bf4=function(_0x1183d0,_0x110dee){_0x1183d0=_0x1183d0-0x0;var _0x1af7f8=_0xbf48[_0x1183d0];return _0x1af7f8;};'use strict';var _=require(_0x8bf4('0x0'));var util=require(_0x8bf4('0x1'));var BPromise=require(_0x8bf4('0x2'));var attributes=require(_0x8bf4('0x3'));var getUserApplications=function(_0x525e56,_0x20f87f,_0x249c2d){var _0x5bbab3=0x1;var _0x4d99d8=[];var _0x1cf29c={'context':_0x20f87f['context']||_0x8bf4('0x4'),'exten':util[_0x8bf4('0x5')]('%s%s',_0x525e56[_0x8bf4('0x6')],_0x249c2d),'type':_0x8bf4('0x7'),'isApp':![],'ChanSpyId':_0x525e56['id'],'UserId':_0x20f87f['id']};_0x4d99d8[_0x8bf4('0x8')](_[_0x8bf4('0x9')]({'app':_0x8bf4('0xa'),'appdata':util[_0x8bf4('0x5')]('CDR(type)=%s','chanspy'),'priority':_0x5bbab3++},_0x1cf29c));if(_0x525e56[_0x8bf4('0xb')]){_0x4d99d8['push'](_[_0x8bf4('0x9')]({'app':_0x8bf4('0xc'),'appdata':util[_0x8bf4('0x5')](_0x8bf4('0xd'),_0x525e56[_0x8bf4('0xe')]),'priority':_0x5bbab3++},_0x1cf29c));}if(_0x525e56['auth']){_0x4d99d8['push'](_[_0x8bf4('0x9')]({'app':_0x8bf4('0xf'),'appdata':_0x525e56[_0x8bf4('0x10')],'priority':_0x5bbab3++},_0x1cf29c));}_0x4d99d8[_0x8bf4('0x8')](_[_0x8bf4('0x9')]({'app':_0x8bf4('0x11'),'appdata':util[_0x8bf4('0x5')](_0x8bf4('0x12'),_0x20f87f[_0x8bf4('0x13')],_0x525e56[_0x8bf4('0x14')]?_0x525e56[_0x8bf4('0x14')][_0x8bf4('0x15')](''):''),'priority':_0x5bbab3++},_0x1cf29c));if(_0x525e56[_0x8bf4('0xb')]){_0x4d99d8['push'](_[_0x8bf4('0x9')]({'app':_0x8bf4('0x16'),'priority':_0x5bbab3++},_0x1cf29c));}return _0x4d99d8;};var getChanSpyApplications=function(_0x32c66a,_0x5a8008){var _0x7443c7=[];for(var _0x1339fc=0x0,_0x1a7157=0x1;_0x1339fc<_0x5a8008[_0x8bf4('0x17')];_0x1339fc++,_0x1a7157=0x1){_0x7443c7=_0x7443c7['concat'](getUserApplications(_0x32c66a,_0x5a8008[_0x1339fc],_0x5a8008[_0x1339fc][_0x8bf4('0x18')]));if(_0x5a8008[_0x1339fc]['internal']!=_0x5a8008[_0x1339fc][_0x8bf4('0x13')]){_0x7443c7=_0x7443c7['concat'](getUserApplications(_0x32c66a,_0x5a8008[_0x1339fc],_0x5a8008[_0x1339fc][_0x8bf4('0x13')]));}}return _0x7443c7;};var getChanSpyPromise=function(_0x5be209,_0x48ade0){return new BPromise(function(_0x255764,_0x56ff3a){return _0x5be209[_0x8bf4('0x19')]['findAll']({'attributes':['id',_0x8bf4('0x13'),_0x8bf4('0x18')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x17270e){if(_0x17270e){return _0x255764(getChanSpyApplications(_0x48ade0,_0x17270e));}return _0x255764([]);})['catch'](function(_0x36f22c){_0x56ff3a(_0x36f22c);});});};module[_0x8bf4('0x1a')]=function(_0x435fb6,_0x46a07c){var _0x22a1a1=_0x435fb6['models'];return _0x435fb6['define'](_0x8bf4('0x1b'),attributes,{'tableName':_0x8bf4('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x58c940,_0xee99c7,_0x151d78){return getChanSpyPromise(_0x22a1a1,_0x58c940)[_0x8bf4('0x1d')](function(_0x20746a){if(_0x20746a&&_0x20746a['length']){return _0x22a1a1[_0x8bf4('0x1e')][_0x8bf4('0x1f')](_0x20746a);}})[_0x8bf4('0x1d')](function(){_0x151d78();})[_0x8bf4('0x20')](function(_0x28be72){_0x151d78(_0x28be72);});},'afterUpdate':function(_0x22bc53,_0x49ab9,_0x596fc0){return _0x22a1a1[_0x8bf4('0x1e')]['destroy']({'where':{'ChanSpyId':_0x22bc53['id']}})[_0x8bf4('0x1d')](function(){return getChanSpyPromise(_0x22a1a1,_0x22bc53);})['then'](function(_0x13801f){if(_0x13801f&&_0x13801f[_0x8bf4('0x17')]){return _0x22a1a1[_0x8bf4('0x1e')][_0x8bf4('0x1f')](_0x13801f);}})[_0x8bf4('0x1d')](function(){_0x596fc0();})[_0x8bf4('0x20')](function(_0x334c6e){_0x596fc0(_0x334c6e);});},'afterDestroy':function(_0x31137c,_0x186c07,_0x377499){return _0x22a1a1['VoiceExtension'][_0x8bf4('0x21')]({'where':{'ChanSpyId':_0x31137c['id']}})[_0x8bf4('0x1d')](function(){_0x377499();})[_0x8bf4('0x20')](function(_0x4c6787){_0x377499(_0x4c6787);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 4380ca9..0b3a215 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 _0x0fd9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x59bcb1,_0x5a4b6c){var _0x4a737f=function(_0x546a49){while(--_0x546a49){_0x59bcb1['push'](_0x59bcb1['shift']());}};_0x4a737f(++_0x5a4b6c);}(_0x0fd9,0xa3));var _0x90fd=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0x0fd9[_0x54b283];return _0x2462b3;};'use strict';var _=require('lodash');var util=require(_0x90fd('0x0'));var moment=require(_0x90fd('0x1'));var BPromise=require(_0x90fd('0x2'));var rs=require(_0x90fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x90fd('0x4'));var logger=require(_0x90fd('0x5'))(_0x90fd('0x6'));var config=require(_0x90fd('0x7'));var jayson=require(_0x90fd('0x8'));var client=jayson[_0x90fd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ff2d4,_0x128c17,_0x50c778){return new BPromise(function(_0x5a604a,_0x2acef7){return client[_0x90fd('0xa')](_0x4ff2d4,_0x50c778)['then'](function(_0x234ba9){logger[_0x90fd('0xb')](_0x90fd('0xc'),_0x128c17,_0x90fd('0xd'));logger[_0x90fd('0xe')](_0x90fd('0xf'),_0x128c17,_0x90fd('0xd'),JSON[_0x90fd('0x10')](_0x234ba9));if(_0x234ba9[_0x90fd('0x11')]){if(_0x234ba9['error'][_0x90fd('0x12')]===0x1f4){logger[_0x90fd('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x128c17,_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);return _0x2acef7(_0x234ba9[_0x90fd('0x11')]['message']);}logger[_0x90fd('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x128c17,_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);return _0x5a604a(_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);}else{logger[_0x90fd('0xb')](_0x90fd('0xc'),_0x128c17,_0x90fd('0xd'));_0x5a604a(_0x234ba9['result']['message']);}})[_0x90fd('0x14')](function(_0x43d804){logger['error'](_0x90fd('0xc'),_0x128c17,_0x43d804);_0x2acef7(_0x43d804);});});} \ No newline at end of file +var _0x9567=['info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','request','then'];(function(_0x3f4891,_0x4e6f62){var _0x54f2d8=function(_0x2b11ee){while(--_0x2b11ee){_0x3f4891['push'](_0x3f4891['shift']());}};_0x54f2d8(++_0x4e6f62);}(_0x9567,0xdc));var _0x7956=function(_0x46686f,_0xe24d01){_0x46686f=_0x46686f-0x0;var _0x467c86=_0x9567[_0x46686f];return _0x467c86;};'use strict';var _=require(_0x7956('0x0'));var util=require(_0x7956('0x1'));var moment=require(_0x7956('0x2'));var BPromise=require(_0x7956('0x3'));var rs=require(_0x7956('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7956('0x5'));var logger=require(_0x7956('0x6'))('rpc');var config=require(_0x7956('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7956('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1819b6,_0x31b50d,_0x48b2b3){return new BPromise(function(_0x3c213a,_0x50038a){return client[_0x7956('0x9')](_0x1819b6,_0x48b2b3)[_0x7956('0xa')](function(_0x53310c){logger[_0x7956('0xb')](_0x7956('0xc'),_0x31b50d,'request\x20sent');logger[_0x7956('0xd')](_0x7956('0xe'),_0x31b50d,_0x7956('0xf'),JSON['stringify'](_0x53310c));if(_0x53310c[_0x7956('0x10')]){if(_0x53310c[_0x7956('0x10')][_0x7956('0x11')]===0x1f4){logger[_0x7956('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x31b50d,_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);return _0x50038a(_0x53310c[_0x7956('0x10')]['message']);}logger[_0x7956('0x10')](_0x7956('0xc'),_0x31b50d,_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);return _0x3c213a(_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);}else{logger[_0x7956('0xb')](_0x7956('0xc'),_0x31b50d,_0x7956('0xf'));_0x3c213a(_0x53310c[_0x7956('0x13')][_0x7956('0x12')]);}})[_0x7956('0x14')](function(_0x18ae51){logger[_0x7956('0x10')](_0x7956('0xc'),_0x31b50d,_0x18ae51);_0x50038a(_0x18ae51);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 1e24a1f..baff270 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 _0xb9be=['create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0x91301b,_0xd1f357){var _0x2adbf7=function(_0x2366d5){while(--_0x2366d5){_0x91301b['push'](_0x91301b['shift']());}};_0x2adbf7(++_0xd1f357);}(_0xb9be,0x16a));var _0xeb9b=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0xb9be[_0x2aa0e7];return _0x1472c0;};'use strict';var multer=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var path=require(_0xeb9b('0x2'));var timeout=require(_0xeb9b('0x3'));var express=require(_0xeb9b('0x4'));var router=express[_0xeb9b('0x5')]();var fs_extra=require(_0xeb9b('0x6'));var auth=require(_0xeb9b('0x7'));var interaction=require(_0xeb9b('0x8'));var config=require(_0xeb9b('0x9'));var controller=require('./voiceContext.controller');router[_0xeb9b('0xa')]('/',auth[_0xeb9b('0xb')](),controller[_0xeb9b('0xc')]);router[_0xeb9b('0xa')](_0xeb9b('0xd'),auth[_0xeb9b('0xb')](),controller[_0xeb9b('0xe')]);router[_0xeb9b('0xf')]('/',auth[_0xeb9b('0xb')](),controller[_0xeb9b('0x10')]);router[_0xeb9b('0x11')](_0xeb9b('0xd'),auth['isAuthenticated'](),controller[_0xeb9b('0x12')]);router['delete'](_0xeb9b('0xd'),auth['isAuthenticated'](),controller[_0xeb9b('0x13')]);module[_0xeb9b('0x14')]=router; \ No newline at end of file +var _0xcbf4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','delete','destroy','multer','express','fs-extra'];(function(_0x269472,_0x15da39){var _0x38a68a=function(_0x3e4ff1){while(--_0x3e4ff1){_0x269472['push'](_0x269472['shift']());}};_0x38a68a(++_0x15da39);}(_0xcbf4,0x10b));var _0x4cbf=function(_0xcfcce8,_0xbe6e4){_0xcfcce8=_0xcfcce8-0x0;var _0x216cc4=_0xcbf4[_0xcfcce8];return _0x216cc4;};'use strict';var multer=require(_0x4cbf('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4cbf('0x1'));var router=express['Router']();var fs_extra=require(_0x4cbf('0x2'));var auth=require(_0x4cbf('0x3'));var interaction=require(_0x4cbf('0x4'));var config=require(_0x4cbf('0x5'));var controller=require(_0x4cbf('0x6'));router[_0x4cbf('0x7')]('/',auth[_0x4cbf('0x8')](),controller[_0x4cbf('0x9')]);router[_0x4cbf('0x7')](_0x4cbf('0xa'),auth['isAuthenticated'](),controller[_0x4cbf('0xb')]);router[_0x4cbf('0xc')]('/',auth[_0x4cbf('0x8')](),controller['create']);router['put']('/:id',auth[_0x4cbf('0x8')](),controller['update']);router[_0x4cbf('0xd')](_0x4cbf('0xa'),auth['isAuthenticated'](),controller[_0x4cbf('0xe')]);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 a32865e..9de1813 100644 --- a/server/api/voiceContext/voiceContext.attributes.js +++ b/server/api/voiceContext/voiceContext.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8671=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x41436e,_0x3c0ee3){var _0x42a220=function(_0x27b4df){while(--_0x27b4df){_0x41436e['push'](_0x41436e['shift']());}};_0x42a220(++_0x3c0ee3);}(_0x8671,0x131));var _0x1867=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x8671[_0x5b561d];return _0x431060;};'use strict';var Sequelize=require(_0x1867('0x0'));module[_0x1867('0x1')]={'name':{'type':Sequelize[_0x1867('0x2')],'unique':_0x1867('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x1867('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6bb3=['BOOLEAN','sequelize','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6bb3,0x1d9));var _0x36bb=function(_0x4c0abe,_0x4647a2){_0x4c0abe=_0x4c0abe-0x0;var _0x5dbe93=_0x6bb3[_0x4c0abe];return _0x5dbe93;};'use strict';var Sequelize=require(_0x36bb('0x0'));module[_0x36bb('0x1')]={'name':{'type':Sequelize[_0x36bb('0x2')],'unique':'name'},'description':{'type':Sequelize[_0x36bb('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x36bb('0x3')],'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 0f1775e..7161f57 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 _0x40c9=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','findAll','show','rawAttributes','includeAll','include','options','find','create','readFileSync','join','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','root','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','catch','VoiceContext,\x20%s,\x20%s','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','Contexts','UserProfileResource','stack','name','map','VoiceContext','type','key'];(function(_0x585fc7,_0x4a811e){var _0x5720cb=function(_0xe4a03a){while(--_0xe4a03a){_0x585fc7['push'](_0x585fc7['shift']());}};_0x5720cb(++_0x4a811e);}(_0x40c9,0x1bd));var _0x940c=function(_0x1c2640,_0x1aac0e){_0x1c2640=_0x1c2640-0x0;var _0x80cb6b=_0x40c9[_0x1c2640];return _0x80cb6b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x940c('0x0'));var jsonpatch=require(_0x940c('0x1'));var rp=require('request-promise');var moment=require(_0x940c('0x2'));var BPromise=require(_0x940c('0x3'));var Mustache=require(_0x940c('0x4'));var util=require('util');var path=require(_0x940c('0x5'));var sox=require(_0x940c('0x6'));var csv=require(_0x940c('0x7'));var ejs=require(_0x940c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x940c('0x9'));var squel=require('squel');var crypto=require(_0x940c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x940c('0xb'));var toCsv=require(_0x940c('0x7'));var querystring=require(_0x940c('0xc'));var Papa=require(_0x940c('0xd'));var Redis=require(_0x940c('0xe'));var authService=require(_0x940c('0xf'));var qs=require(_0x940c('0x10'));var as=require(_0x940c('0x11'));var hardwareService=require(_0x940c('0x12'));var logger=require(_0x940c('0x13'))(_0x940c('0x14'));var utils=require(_0x940c('0x15'));var config=require(_0x940c('0x16'));var licenseUtil=require(_0x940c('0x17'));var db=require(_0x940c('0x18'))['db'];var jayson=require(_0x940c('0x19'));var client=jayson['client'][_0x940c('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x328b8a,_0x5380ff,_0x1774bd,_0x57c722){return new BPromise(function(_0x3ba382,_0x1b9359){var _0x24a46b=_0x57c722||client;return _0x24a46b[_0x940c('0x1b')](_0x328b8a,_0x1774bd)[_0x940c('0x1c')](function(_0x10aa47){logger[_0x940c('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x5380ff,_0x940c('0x1e'));logger[_0x940c('0x1f')](_0x940c('0x20'),_0x5380ff,_0x940c('0x1e'),JSON['stringify'](_0x10aa47));if(_0x10aa47[_0x940c('0x21')]){if(_0x10aa47[_0x940c('0x21')][_0x940c('0x22')]===0x1f4){logger[_0x940c('0x21')]('VoiceContext,\x20%s,\x20%s',_0x5380ff,_0x10aa47[_0x940c('0x21')]['message']);return _0x1b9359(_0x10aa47[_0x940c('0x21')][_0x940c('0x23')]);}logger[_0x940c('0x21')]('VoiceContext,\x20%s,\x20%s',_0x5380ff,_0x10aa47[_0x940c('0x21')][_0x940c('0x23')]);return _0x3ba382(_0x10aa47[_0x940c('0x21')][_0x940c('0x23')]);}else{logger[_0x940c('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x5380ff,'request\x20sent');_0x3ba382(_0x10aa47['result']['message']);}})[_0x940c('0x24')](function(_0x794055){logger[_0x940c('0x21')](_0x940c('0x25'),_0x5380ff,_0x794055);_0x1b9359(_0x794055);});});}function respondWithStatusCode(_0x404ff0,_0x398870){_0x398870=_0x398870||0xcc;return function(_0x21e331){if(_0x21e331){return _0x404ff0[_0x940c('0x26')](_0x398870);}return _0x404ff0[_0x940c('0x27')](_0x398870)[_0x940c('0x28')]();};}function respondWithResult(_0xe6b5aa,_0xb86122){_0xb86122=_0xb86122||0xc8;return function(_0x4fe02e){if(_0x4fe02e){return _0xe6b5aa[_0x940c('0x27')](_0xb86122)['json'](_0x4fe02e);}};}function respondWithFilteredResult(_0xcda545,_0x3fdfeb){return function(_0x409dbc){if(_0x409dbc){var _0x3b98f6=typeof _0x3fdfeb[_0x940c('0x29')]===_0x940c('0x2a')&&typeof _0x3fdfeb[_0x940c('0x2b')]===_0x940c('0x2a');var _0x18d8a3=_0x409dbc[_0x940c('0x2c')];var _0x44a4f6=_0x3b98f6?0x0:_0x3fdfeb[_0x940c('0x29')];var _0x57ece5=_0x3b98f6?_0x409dbc[_0x940c('0x2c')]:_0x3fdfeb[_0x940c('0x29')]+_0x3fdfeb[_0x940c('0x2b')];var _0x5068f5;if(_0x57ece5>=_0x18d8a3){_0x57ece5=_0x18d8a3;_0x5068f5=0xc8;}else{_0x5068f5=0xce;}_0xcda545['status'](_0x5068f5);return _0xcda545[_0x940c('0x2d')](_0x940c('0x2e'),_0x44a4f6+'-'+_0x57ece5+'/'+_0x18d8a3)['json'](_0x409dbc);}return null;};}function patchUpdates(_0x168a5f){return function(_0x3c2f06){try{jsonpatch['apply'](_0x3c2f06,_0x168a5f,!![]);}catch(_0x2e15d0){return BPromise[_0x940c('0x2f')](_0x2e15d0);}return _0x3c2f06[_0x940c('0x30')]();};}function saveUpdates(_0x8733af,_0x35ca9d){return function(_0x293ceb){if(_0x293ceb){return _0x293ceb[_0x940c('0x31')](_0x8733af)[_0x940c('0x1c')](function(_0x2c103b){return _0x2c103b;});}return null;};}function removeEntity(_0x5bfe12,_0x45816b){return function(_0x2a7525){if(_0x2a7525){return _0x2a7525[_0x940c('0x32')]()[_0x940c('0x1c')](function(){var _0x2bfaa7=_0x2a7525[_0x940c('0x33')]({'plain':!![]});var _0x5707b2=_0x940c('0x34');return db[_0x940c('0x35')]['destroy']({'where':{'type':_0x5707b2,'resourceId':_0x2bfaa7['id']}})['then'](function(){return _0x2a7525;});})[_0x940c('0x1c')](function(){_0x5bfe12[_0x940c('0x27')](0xcc)[_0x940c('0x28')]();});}};}function handleEntityNotFound(_0x4836f4,_0x2238d9){return function(_0x54d1dd){if(!_0x54d1dd){_0x4836f4[_0x940c('0x26')](0x194);}return _0x54d1dd;};}function handleError(_0x3bdaa2,_0x3f7fe5){_0x3f7fe5=_0x3f7fe5||0x1f4;return function(_0x25537f){logger['error'](_0x25537f[_0x940c('0x36')]);if(_0x25537f[_0x940c('0x37')]){delete _0x25537f[_0x940c('0x37')];}_0x3bdaa2[_0x940c('0x27')](_0x3f7fe5)['send'](_0x25537f);};}exports['index']=function(_0x36f481,_0x299a5c){var _0x13a343={},_0x283a9e={},_0x33be5a={'count':0x0,'rows':[]};var _0x29909d=_[_0x940c('0x38')](db[_0x940c('0x39')]['rawAttributes'],function(_0x2341a1){return{'name':_0x2341a1['fieldName'],'type':_0x2341a1[_0x940c('0x3a')][_0x940c('0x3b')]};});_0x283a9e[_0x940c('0x3c')]=_[_0x940c('0x38')](_0x29909d,_0x940c('0x37'));_0x283a9e[_0x940c('0x3d')]=_[_0x940c('0x3e')](_0x36f481[_0x940c('0x3d')]);_0x283a9e[_0x940c('0x3f')]=_[_0x940c('0x40')](_0x283a9e[_0x940c('0x3c')],_0x283a9e[_0x940c('0x3d')]);_0x13a343[_0x940c('0x41')]=_[_0x940c('0x40')](_0x283a9e[_0x940c('0x3c')],qs[_0x940c('0x42')](_0x36f481['query']['fields']));_0x13a343[_0x940c('0x41')]=_0x13a343[_0x940c('0x41')][_0x940c('0x43')]?_0x13a343[_0x940c('0x41')]:_0x283a9e['model'];if(!_0x36f481['query'][_0x940c('0x44')](_0x940c('0x45'))){_0x13a343['limit']=qs[_0x940c('0x2b')](_0x36f481[_0x940c('0x3d')]['limit']);_0x13a343['offset']=qs[_0x940c('0x29')](_0x36f481[_0x940c('0x3d')][_0x940c('0x29')]);}_0x13a343[_0x940c('0x46')]=qs['sort'](_0x36f481[_0x940c('0x3d')][_0x940c('0x47')]);_0x13a343[_0x940c('0x48')]=qs[_0x940c('0x3f')](_[_0x940c('0x49')](_0x36f481['query'],_0x283a9e[_0x940c('0x3f')]),_0x29909d);if(_0x36f481[_0x940c('0x3d')]['filter']){_0x13a343[_0x940c('0x48')]=_['merge'](_0x13a343['where'],{'$or':_[_0x940c('0x38')](_0x29909d,function(_0xa7fb8d){if(_0xa7fb8d[_0x940c('0x3a')]!=='VIRTUAL'){var _0x4ff634={};_0x4ff634[_0xa7fb8d[_0x940c('0x37')]]={'$like':'%'+_0x36f481['query'][_0x940c('0x4a')]+'%'};return _0x4ff634;}})});}_0x13a343=_[_0x940c('0x4b')]({},_0x13a343,_0x36f481['options']);var _0x19e0cf={'where':_0x13a343[_0x940c('0x48')]};return db['VoiceContext']['count'](_0x19e0cf)[_0x940c('0x1c')](function(_0x5ae147){_0x33be5a[_0x940c('0x2c')]=_0x5ae147;if(_0x36f481[_0x940c('0x3d')]['includeAll']){_0x13a343['include']=[{'all':!![]}];}return db['VoiceContext'][_0x940c('0x4c')](_0x13a343);})[_0x940c('0x1c')](function(_0x1a36e2){_0x33be5a['rows']=_0x1a36e2;return _0x33be5a;})[_0x940c('0x1c')](respondWithFilteredResult(_0x299a5c,_0x13a343))['catch'](handleError(_0x299a5c,null));};exports[_0x940c('0x4d')]=function(_0x54a993,_0x179bce){var _0x5d788a={'raw':![],'where':{'id':_0x54a993['params']['id']}},_0x452dd6={};_0x452dd6[_0x940c('0x3c')]=_[_0x940c('0x3e')](db[_0x940c('0x39')][_0x940c('0x4e')]);_0x452dd6['query']=_[_0x940c('0x3e')](_0x54a993[_0x940c('0x3d')]);_0x452dd6['filters']=_[_0x940c('0x40')](_0x452dd6[_0x940c('0x3c')],_0x452dd6['query']);_0x5d788a[_0x940c('0x41')]=_[_0x940c('0x40')](_0x452dd6[_0x940c('0x3c')],qs['fields'](_0x54a993[_0x940c('0x3d')][_0x940c('0x42')]));_0x5d788a[_0x940c('0x41')]=_0x5d788a[_0x940c('0x41')][_0x940c('0x43')]?_0x5d788a[_0x940c('0x41')]:_0x452dd6[_0x940c('0x3c')];if(_0x54a993[_0x940c('0x3d')][_0x940c('0x4f')]){_0x5d788a[_0x940c('0x50')]=[{'all':!![]}];}_0x5d788a=_[_0x940c('0x4b')]({},_0x5d788a,_0x54a993[_0x940c('0x51')]);return db[_0x940c('0x39')][_0x940c('0x52')](_0x5d788a)[_0x940c('0x1c')](handleEntityNotFound(_0x179bce,null))[_0x940c('0x1c')](respondWithResult(_0x179bce,null))['catch'](handleError(_0x179bce,null));};exports[_0x940c('0x53')]=function(_0x236ddd,_0x515773,_0xf7f6a1){var _0x44f761;return db['VoiceContext'][_0x940c('0x53')](_0x236ddd['body'],{'raw':!![]})[_0x940c('0x1c')](function(_0x1dd8d9){_0x44f761=_0x1dd8d9;return db['VoiceContext'][_0x940c('0x4c')]({'raw':!![]});})[_0x940c('0x1c')](function(_0x550322){var _0x2f0e3c=fs[_0x940c('0x54')](path[_0x940c('0x55')](config['root'],_0x940c('0x56')),_0x940c('0x57'));var _0x1bd62c=ejs[_0x940c('0x58')](_0x2f0e3c,{'contexts':_0x550322||[]});fs[_0x940c('0x59')](_0x940c('0x5a'),_0x1bd62c);})[_0x940c('0x1c')](function(){return respondWithRpcPromise(_0x940c('0x5b'),'create',{'module':_0x940c('0x5c')});})['then'](function(){var _0x33df61=_0x236ddd[_0x940c('0x5d')][_0x940c('0x33')]({'plain':!![]});if(!_0x33df61)throw new Error(_0x940c('0x5e'));if(_0x33df61['role']===_0x940c('0x5d')){var _0x355a7e=_0x44f761[_0x940c('0x33')]({'plain':!![]});return db['UserProfileSection'][_0x940c('0x52')]({'where':{'name':_0x940c('0x34'),'userProfileId':_0x33df61[_0x940c('0x5f')]},'raw':!![]})['then'](function(_0x102527){if(_0x102527&&_0x102527[_0x940c('0x60')]===0x0){return db[_0x940c('0x35')][_0x940c('0x53')]({'name':_0x355a7e[_0x940c('0x37')],'resourceId':_0x355a7e['id'],'type':_0x102527[_0x940c('0x37')],'sectionId':_0x102527['id']},{})[_0x940c('0x1c')](function(){return _0x44f761;});}else{return _0x44f761;}})[_0x940c('0x24')](function(_0x28e9aa){logger['error'](_0x940c('0x61'),_0x28e9aa);throw _0x28e9aa;});}return _0x44f761;})['then'](respondWithResult(_0x515773,0xc9))[_0x940c('0x24')](handleError(_0x515773,null));};exports[_0x940c('0x31')]=function(_0x28344e,_0x4a6ccb,_0x5e0d62){var _0x1021dc;return db[_0x940c('0x39')][_0x940c('0x52')]({'where':{'id':_0x28344e[_0x940c('0x62')]['id']}})['then'](handleEntityNotFound(_0x4a6ccb,null))[_0x940c('0x1c')](saveUpdates(_0x28344e[_0x940c('0x63')],null))[_0x940c('0x1c')](function(_0x10b7d4){if(_0x10b7d4){_0x1021dc=_0x10b7d4;return db[_0x940c('0x39')][_0x940c('0x4c')]({'raw':!![]});}})[_0x940c('0x1c')](function(_0x4549c3){var _0xcd501e=fs[_0x940c('0x54')](path[_0x940c('0x55')](config[_0x940c('0x64')],_0x940c('0x56')),_0x940c('0x57'));var _0x3fff66=ejs[_0x940c('0x58')](_0xcd501e,{'contexts':_0x4549c3||[]});fs[_0x940c('0x59')](_0x940c('0x5a'),_0x3fff66);})[_0x940c('0x1c')](function(){return respondWithRpcPromise(_0x940c('0x5b'),'update',{'module':_0x940c('0x5c')});})[_0x940c('0x1c')](function(){return _0x1021dc;})[_0x940c('0x1c')](respondWithResult(_0x4a6ccb,null))[_0x940c('0x24')](handleError(_0x4a6ccb,null));};exports[_0x940c('0x32')]=function(_0x1ef679,_0x1791d1,_0x5ed936){var _0x1107fe;return db[_0x940c('0x39')]['find']({'where':{'id':_0x1ef679[_0x940c('0x62')]['id']}})[_0x940c('0x1c')](handleEntityNotFound(_0x1791d1,null))[_0x940c('0x1c')](removeEntity(_0x1791d1,null))[_0x940c('0x1c')](function(){return db[_0x940c('0x39')]['findAll']({'raw':!![]});})[_0x940c('0x1c')](function(_0x312cc3){var _0x1458b0=fs['readFileSync'](path[_0x940c('0x55')](config['root'],_0x940c('0x56')),'utf8');var _0x374da5=ejs[_0x940c('0x58')](_0x1458b0,{'contexts':_0x312cc3});fs[_0x940c('0x59')](_0x940c('0x5a'),_0x374da5);return respondWithRpcPromise(_0x940c('0x5b'),'destroy',{'module':_0x940c('0x5c')});})[_0x940c('0x24')](handleError(_0x1791d1,null));}; \ No newline at end of file +var _0x3358=['where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','show','params','include','options','body','join','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','create','chan_sip.so','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','utf8','readFileSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','Contexts','destroy','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x2930a0,_0x3e66f5){var _0x15ab7a=function(_0x858c9b){while(--_0x858c9b){_0x2930a0['push'](_0x2930a0['shift']());}};_0x15ab7a(++_0x3e66f5);}(_0x3358,0x156));var _0x8335=function(_0x1f5d1d,_0xb7c0b3){_0x1f5d1d=_0x1f5d1d-0x0;var _0x59208b=_0x3358[_0x1f5d1d];return _0x59208b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8335('0x0'));var zipdir=require(_0x8335('0x1'));var jsonpatch=require(_0x8335('0x2'));var rp=require(_0x8335('0x3'));var moment=require(_0x8335('0x4'));var BPromise=require(_0x8335('0x5'));var Mustache=require(_0x8335('0x6'));var util=require('util');var path=require(_0x8335('0x7'));var sox=require(_0x8335('0x8'));var csv=require(_0x8335('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8335('0xa'));var _=require(_0x8335('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8335('0xc'));var deskjs=require(_0x8335('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8335('0xe'));var Papa=require('papaparse');var Redis=require(_0x8335('0xf'));var authService=require(_0x8335('0x10'));var qs=require(_0x8335('0x11'));var as=require(_0x8335('0x12'));var hardwareService=require(_0x8335('0x13'));var logger=require(_0x8335('0x14'))(_0x8335('0x15'));var utils=require(_0x8335('0x16'));var config=require(_0x8335('0x17'));var licenseUtil=require(_0x8335('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x8335('0x19'));var client=jayson[_0x8335('0x1a')][_0x8335('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3ca720,_0x1853e4,_0x300048,_0x228cc2){return new BPromise(function(_0x202ec0,_0x5be829){var _0x2ef028=_0x228cc2||client;return _0x2ef028[_0x8335('0x1c')](_0x3ca720,_0x300048)[_0x8335('0x1d')](function(_0x32750d){logger[_0x8335('0x1e')](_0x8335('0x1f'),_0x1853e4,'request\x20sent');logger[_0x8335('0x20')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x1853e4,_0x8335('0x21'),JSON['stringify'](_0x32750d));if(_0x32750d[_0x8335('0x22')]){if(_0x32750d[_0x8335('0x22')][_0x8335('0x23')]===0x1f4){logger[_0x8335('0x22')](_0x8335('0x1f'),_0x1853e4,_0x32750d['error'][_0x8335('0x24')]);return _0x5be829(_0x32750d[_0x8335('0x22')]['message']);}logger[_0x8335('0x22')](_0x8335('0x1f'),_0x1853e4,_0x32750d[_0x8335('0x22')][_0x8335('0x24')]);return _0x202ec0(_0x32750d[_0x8335('0x22')]['message']);}else{logger[_0x8335('0x1e')](_0x8335('0x1f'),_0x1853e4,_0x8335('0x21'));_0x202ec0(_0x32750d['result'][_0x8335('0x24')]);}})[_0x8335('0x25')](function(_0x31e67a){logger[_0x8335('0x22')](_0x8335('0x1f'),_0x1853e4,_0x31e67a);_0x5be829(_0x31e67a);});});}function respondWithStatusCode(_0x1af64f,_0x28972f){_0x28972f=_0x28972f||0xcc;return function(_0x29c864){if(_0x29c864){return _0x1af64f[_0x8335('0x26')](_0x28972f);}return _0x1af64f[_0x8335('0x27')](_0x28972f)[_0x8335('0x28')]();};}function respondWithResult(_0x3a1d28,_0x12c56d){_0x12c56d=_0x12c56d||0xc8;return function(_0x4c9e45){if(_0x4c9e45){return _0x3a1d28[_0x8335('0x27')](_0x12c56d)[_0x8335('0x29')](_0x4c9e45);}};}function respondWithFilteredResult(_0x319431,_0xf9c7fa){return function(_0x499d04){if(_0x499d04){var _0x24a5bb=typeof _0xf9c7fa[_0x8335('0x2a')]===_0x8335('0x2b')&&typeof _0xf9c7fa[_0x8335('0x2c')]===_0x8335('0x2b');var _0x6130bf=_0x499d04[_0x8335('0x2d')];var _0x308689=_0x24a5bb?0x0:_0xf9c7fa['offset'];var _0x3311a8=_0x24a5bb?_0x499d04[_0x8335('0x2d')]:_0xf9c7fa[_0x8335('0x2a')]+_0xf9c7fa[_0x8335('0x2c')];var _0x4910a3;if(_0x3311a8>=_0x6130bf){_0x3311a8=_0x6130bf;_0x4910a3=0xc8;}else{_0x4910a3=0xce;}_0x319431['status'](_0x4910a3);return _0x319431[_0x8335('0x2e')](_0x8335('0x2f'),_0x308689+'-'+_0x3311a8+'/'+_0x6130bf)[_0x8335('0x29')](_0x499d04);}return null;};}function patchUpdates(_0x1afc90){return function(_0x48256a){try{jsonpatch['apply'](_0x48256a,_0x1afc90,!![]);}catch(_0x5817a2){return BPromise[_0x8335('0x30')](_0x5817a2);}return _0x48256a[_0x8335('0x31')]();};}function saveUpdates(_0xdf3fd9,_0x196f7b){return function(_0x5cd09b){if(_0x5cd09b){return _0x5cd09b[_0x8335('0x32')](_0xdf3fd9)['then'](function(_0x19d9e5){return _0x19d9e5;});}return null;};}function removeEntity(_0xd90111,_0x1d3259){return function(_0x5eda45){if(_0x5eda45){return _0x5eda45['destroy']()['then'](function(){var _0x22896f=_0x5eda45[_0x8335('0x33')]({'plain':!![]});var _0x515239=_0x8335('0x34');return db['UserProfileResource'][_0x8335('0x35')]({'where':{'type':_0x515239,'resourceId':_0x22896f['id']}})[_0x8335('0x1d')](function(){return _0x5eda45;});})[_0x8335('0x1d')](function(){_0xd90111[_0x8335('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30cf0c,_0x4c9480){return function(_0x370d43){if(!_0x370d43){_0x30cf0c[_0x8335('0x26')](0x194);}return _0x370d43;};}function handleError(_0x54f08a,_0x26181b){_0x26181b=_0x26181b||0x1f4;return function(_0x2f792e){logger[_0x8335('0x22')](_0x2f792e[_0x8335('0x36')]);if(_0x2f792e[_0x8335('0x37')]){delete _0x2f792e[_0x8335('0x37')];}_0x54f08a[_0x8335('0x27')](_0x26181b)[_0x8335('0x38')](_0x2f792e);};}exports[_0x8335('0x39')]=function(_0x382636,_0x19a0f3){var _0x36ba0f={},_0x515352={},_0x82b08f={'count':0x0,'rows':[]};var _0x50b402=_[_0x8335('0x3a')](db[_0x8335('0x3b')][_0x8335('0x3c')],function(_0x2436ee){return{'name':_0x2436ee[_0x8335('0x3d')],'type':_0x2436ee[_0x8335('0x3e')]['key']};});_0x515352[_0x8335('0x3f')]=_[_0x8335('0x3a')](_0x50b402,_0x8335('0x37'));_0x515352[_0x8335('0x40')]=_[_0x8335('0x41')](_0x382636[_0x8335('0x40')]);_0x515352[_0x8335('0x42')]=_[_0x8335('0x43')](_0x515352[_0x8335('0x3f')],_0x515352['query']);_0x36ba0f[_0x8335('0x44')]=_[_0x8335('0x43')](_0x515352[_0x8335('0x3f')],qs[_0x8335('0x45')](_0x382636[_0x8335('0x40')][_0x8335('0x45')]));_0x36ba0f['attributes']=_0x36ba0f[_0x8335('0x44')][_0x8335('0x46')]?_0x36ba0f['attributes']:_0x515352[_0x8335('0x3f')];if(!_0x382636['query'][_0x8335('0x47')](_0x8335('0x48'))){_0x36ba0f[_0x8335('0x2c')]=qs[_0x8335('0x2c')](_0x382636[_0x8335('0x40')][_0x8335('0x2c')]);_0x36ba0f[_0x8335('0x2a')]=qs['offset'](_0x382636[_0x8335('0x40')]['offset']);}_0x36ba0f['order']=qs[_0x8335('0x49')](_0x382636[_0x8335('0x40')][_0x8335('0x49')]);_0x36ba0f[_0x8335('0x4a')]=qs[_0x8335('0x42')](_[_0x8335('0x4b')](_0x382636[_0x8335('0x40')],_0x515352[_0x8335('0x42')]),_0x50b402);if(_0x382636[_0x8335('0x40')][_0x8335('0x4c')]){_0x36ba0f[_0x8335('0x4a')]=_['merge'](_0x36ba0f['where'],{'$or':_['map'](_0x50b402,function(_0x4b8287){if(_0x4b8287[_0x8335('0x3e')]!==_0x8335('0x4d')){var _0x15e26c={};_0x15e26c[_0x4b8287['name']]={'$like':'%'+_0x382636[_0x8335('0x40')][_0x8335('0x4c')]+'%'};return _0x15e26c;}})});}_0x36ba0f=_[_0x8335('0x4e')]({},_0x36ba0f,_0x382636['options']);var _0x1f0e3e={'where':_0x36ba0f['where']};return db[_0x8335('0x3b')]['count'](_0x1f0e3e)[_0x8335('0x1d')](function(_0x28bff4){_0x82b08f['count']=_0x28bff4;if(_0x382636['query'][_0x8335('0x4f')]){_0x36ba0f['include']=[{'all':!![]}];}return db['VoiceContext'][_0x8335('0x50')](_0x36ba0f);})[_0x8335('0x1d')](function(_0x2f7d45){_0x82b08f[_0x8335('0x51')]=_0x2f7d45;return _0x82b08f;})[_0x8335('0x1d')](respondWithFilteredResult(_0x19a0f3,_0x36ba0f))[_0x8335('0x25')](handleError(_0x19a0f3,null));};exports[_0x8335('0x52')]=function(_0xc44315,_0x26876b){var _0x144046={'raw':![],'where':{'id':_0xc44315[_0x8335('0x53')]['id']}},_0x3fd65d={};_0x3fd65d[_0x8335('0x3f')]=_['keys'](db[_0x8335('0x3b')][_0x8335('0x3c')]);_0x3fd65d[_0x8335('0x40')]=_[_0x8335('0x41')](_0xc44315[_0x8335('0x40')]);_0x3fd65d[_0x8335('0x42')]=_[_0x8335('0x43')](_0x3fd65d[_0x8335('0x3f')],_0x3fd65d[_0x8335('0x40')]);_0x144046['attributes']=_[_0x8335('0x43')](_0x3fd65d[_0x8335('0x3f')],qs[_0x8335('0x45')](_0xc44315[_0x8335('0x40')][_0x8335('0x45')]));_0x144046[_0x8335('0x44')]=_0x144046['attributes'][_0x8335('0x46')]?_0x144046[_0x8335('0x44')]:_0x3fd65d[_0x8335('0x3f')];if(_0xc44315[_0x8335('0x40')][_0x8335('0x4f')]){_0x144046[_0x8335('0x54')]=[{'all':!![]}];}_0x144046=_['merge']({},_0x144046,_0xc44315[_0x8335('0x55')]);return db[_0x8335('0x3b')]['find'](_0x144046)['then'](handleEntityNotFound(_0x26876b,null))[_0x8335('0x1d')](respondWithResult(_0x26876b,null))[_0x8335('0x25')](handleError(_0x26876b,null));};exports['create']=function(_0x4fac31,_0x28f279,_0x1418ed){var _0x5b09b1;return db[_0x8335('0x3b')]['create'](_0x4fac31[_0x8335('0x56')],{'raw':!![]})['then'](function(_0x27d9db){_0x5b09b1=_0x27d9db;return db[_0x8335('0x3b')][_0x8335('0x50')]({'raw':!![]});})[_0x8335('0x1d')](function(_0x5d5c20){var _0x5486b7=fs['readFileSync'](path[_0x8335('0x57')](config[_0x8335('0x58')],_0x8335('0x59')),'utf8');var _0x1a06e7=ejs[_0x8335('0x5a')](_0x5486b7,{'contexts':_0x5d5c20||[]});fs[_0x8335('0x5b')](_0x8335('0x5c'),_0x1a06e7);})[_0x8335('0x1d')](function(){return respondWithRpcPromise(_0x8335('0x5d'),_0x8335('0x5e'),{'module':_0x8335('0x5f')});})['then'](function(){var _0x4997ec=_0x4fac31[_0x8335('0x60')][_0x8335('0x33')]({'plain':!![]});if(!_0x4997ec)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4997ec['role']==='user'){var _0x19f6b5=_0x5b09b1[_0x8335('0x33')]({'plain':!![]});return db[_0x8335('0x61')][_0x8335('0x62')]({'where':{'name':_0x8335('0x34'),'userProfileId':_0x4997ec[_0x8335('0x63')]},'raw':!![]})[_0x8335('0x1d')](function(_0x4cbd26){if(_0x4cbd26&&_0x4cbd26[_0x8335('0x64')]===0x0){return db[_0x8335('0x65')][_0x8335('0x5e')]({'name':_0x19f6b5[_0x8335('0x37')],'resourceId':_0x19f6b5['id'],'type':_0x4cbd26[_0x8335('0x37')],'sectionId':_0x4cbd26['id']},{})[_0x8335('0x1d')](function(){return _0x5b09b1;});}else{return _0x5b09b1;}})['catch'](function(_0x410ae6){logger[_0x8335('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x410ae6);throw _0x410ae6;});}return _0x5b09b1;})[_0x8335('0x1d')](respondWithResult(_0x28f279,0xc9))[_0x8335('0x25')](handleError(_0x28f279,null));};exports[_0x8335('0x32')]=function(_0x15299d,_0x235779,_0x42e79c){var _0x3c1ee9;return db[_0x8335('0x3b')]['find']({'where':{'id':_0x15299d[_0x8335('0x53')]['id']}})[_0x8335('0x1d')](handleEntityNotFound(_0x235779,null))[_0x8335('0x1d')](saveUpdates(_0x15299d[_0x8335('0x56')],null))['then'](function(_0x5078db){if(_0x5078db){_0x3c1ee9=_0x5078db;return db[_0x8335('0x3b')][_0x8335('0x50')]({'raw':!![]});}})[_0x8335('0x1d')](function(_0x344641){var _0x2f1e30=fs['readFileSync'](path[_0x8335('0x57')](config[_0x8335('0x58')],'server/files/templates/context.ejs'),_0x8335('0x66'));var _0x4f4865=ejs[_0x8335('0x5a')](_0x2f1e30,{'contexts':_0x344641||[]});fs[_0x8335('0x5b')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x4f4865);})[_0x8335('0x1d')](function(){return respondWithRpcPromise('Reload',_0x8335('0x32'),{'module':_0x8335('0x5f')});})[_0x8335('0x1d')](function(){return _0x3c1ee9;})[_0x8335('0x1d')](respondWithResult(_0x235779,null))[_0x8335('0x25')](handleError(_0x235779,null));};exports[_0x8335('0x35')]=function(_0x348af2,_0x51dc72,_0x14f152){var _0x5c2eb7;return db['VoiceContext'][_0x8335('0x62')]({'where':{'id':_0x348af2[_0x8335('0x53')]['id']}})[_0x8335('0x1d')](handleEntityNotFound(_0x51dc72,null))[_0x8335('0x1d')](removeEntity(_0x51dc72,null))['then'](function(){return db[_0x8335('0x3b')]['findAll']({'raw':!![]});})[_0x8335('0x1d')](function(_0x438b71){var _0x140db7=fs[_0x8335('0x67')](path['join'](config[_0x8335('0x58')],_0x8335('0x59')),_0x8335('0x66'));var _0x5e5016=ejs[_0x8335('0x5a')](_0x140db7,{'contexts':_0x438b71});fs[_0x8335('0x5b')](_0x8335('0x5c'),_0x5e5016);return respondWithRpcPromise('Reload','destroy',{'module':_0x8335('0x5f')});})[_0x8335('0x25')](handleError(_0x51dc72,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index f1db0ce..66ab357 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 _0xa0aa=['moment','bluebird','request-promise','path','../../config/environment','./voiceContext.attributes','VoiceContext','voice_contexts','util','../../config/logger'];(function(_0x32e699,_0x340fc1){var _0x36833a=function(_0x196381){while(--_0x196381){_0x32e699['push'](_0x32e699['shift']());}};_0x36833a(++_0x340fc1);}(_0xa0aa,0xda));var _0xaa0a=function(_0x251a69,_0x3c8875){_0x251a69=_0x251a69-0x0;var _0x1a8c73=_0xa0aa[_0x251a69];return _0x1a8c73;};'use strict';var _=require('lodash');var util=require(_0xaa0a('0x0'));var logger=require(_0xaa0a('0x1'))('api');var moment=require(_0xaa0a('0x2'));var BPromise=require(_0xaa0a('0x3'));var rp=require(_0xaa0a('0x4'));var fs=require('fs');var path=require(_0xaa0a('0x5'));var rimraf=require('rimraf');var config=require(_0xaa0a('0x6'));var attributes=require(_0xaa0a('0x7'));module['exports']=function(_0x349198,_0x2749a9){return _0x349198['define'](_0xaa0a('0x8'),attributes,{'tableName':_0xaa0a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe506=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','voice_contexts','lodash'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0xe506,0x192));var _0x6e50=function(_0x4cf823,_0x3470cf){_0x4cf823=_0x4cf823-0x0;var _0x2adc5e=_0xe506[_0x4cf823];return _0x2adc5e;};'use strict';var _=require(_0x6e50('0x0'));var util=require(_0x6e50('0x1'));var logger=require(_0x6e50('0x2'))(_0x6e50('0x3'));var moment=require(_0x6e50('0x4'));var BPromise=require(_0x6e50('0x5'));var rp=require(_0x6e50('0x6'));var fs=require('fs');var path=require(_0x6e50('0x7'));var rimraf=require(_0x6e50('0x8'));var config=require(_0x6e50('0x9'));var attributes=require('./voiceContext.attributes');module[_0x6e50('0xa')]=function(_0x10dbcb,_0xde7c2c){return _0x10dbcb[_0x6e50('0xb')]('VoiceContext',attributes,{'tableName':_0x6e50('0xc'),'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 00b1d3a..f6ef493 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 _0x112f=['debug','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x112f,0x11e));var _0xf112=function(_0x402671,_0x5bb553){_0x402671=_0x402671-0x0;var _0x326991=_0x112f[_0x402671];return _0x326991;};'use strict';var _=require(_0xf112('0x0'));var util=require('util');var moment=require(_0xf112('0x1'));var BPromise=require('bluebird');var rs=require(_0xf112('0x2'));var fs=require('fs');var Redis=require(_0xf112('0x3'));var db=require(_0xf112('0x4'))['db'];var utils=require(_0xf112('0x5'));var logger=require('../../config/logger')(_0xf112('0x6'));var config=require('../../config/environment');var jayson=require(_0xf112('0x7'));var client=jayson[_0xf112('0x8')][_0xf112('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b62b4,_0x2fcbcb,_0x3f0411){return new BPromise(function(_0x48aaf0,_0x420e3c){return client['request'](_0x1b62b4,_0x3f0411)[_0xf112('0xa')](function(_0x167415){logger[_0xf112('0xb')](_0xf112('0xc'),_0x2fcbcb,_0xf112('0xd'));logger[_0xf112('0xe')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x2fcbcb,'request\x20sent',JSON['stringify'](_0x167415));if(_0x167415[_0xf112('0xf')]){if(_0x167415[_0xf112('0xf')][_0xf112('0x10')]===0x1f4){logger[_0xf112('0xf')](_0xf112('0xc'),_0x2fcbcb,_0x167415[_0xf112('0xf')][_0xf112('0x11')]);return _0x420e3c(_0x167415[_0xf112('0xf')][_0xf112('0x11')]);}logger['error'](_0xf112('0xc'),_0x2fcbcb,_0x167415['error'][_0xf112('0x11')]);return _0x48aaf0(_0x167415['error'][_0xf112('0x11')]);}else{logger['info'](_0xf112('0xc'),_0x2fcbcb,_0xf112('0xd'));_0x48aaf0(_0x167415[_0xf112('0x12')][_0xf112('0x11')]);}})[_0xf112('0x13')](function(_0x562487){logger[_0xf112('0xf')](_0xf112('0xc'),_0x2fcbcb,_0x562487);_0x420e3c(_0x562487);});});} \ No newline at end of file +var _0xdb2b=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1b1a3b,_0x52a88a){var _0x385347=function(_0x4ca60a){while(--_0x4ca60a){_0x1b1a3b['push'](_0x1b1a3b['shift']());}};_0x385347(++_0x52a88a);}(_0xdb2b,0xa2));var _0xbdb2=function(_0x11c0cb,_0x4476aa){_0x11c0cb=_0x11c0cb-0x0;var _0x3dbf20=_0xdb2b[_0x11c0cb];return _0x3dbf20;};'use strict';var _=require(_0xbdb2('0x0'));var util=require('util');var moment=require(_0xbdb2('0x1'));var BPromise=require(_0xbdb2('0x2'));var rs=require(_0xbdb2('0x3'));var fs=require('fs');var Redis=require(_0xbdb2('0x4'));var db=require(_0xbdb2('0x5'))['db'];var utils=require(_0xbdb2('0x6'));var logger=require(_0xbdb2('0x7'))(_0xbdb2('0x8'));var config=require(_0xbdb2('0x9'));var jayson=require(_0xbdb2('0xa'));var client=jayson[_0xbdb2('0xb')][_0xbdb2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a4c37,_0x51fc95,_0x762443){return new BPromise(function(_0x40717f,_0x29898c){return client[_0xbdb2('0xd')](_0x5a4c37,_0x762443)[_0xbdb2('0xe')](function(_0x19839f){logger['info'](_0xbdb2('0xf'),_0x51fc95,_0xbdb2('0x10'));logger['debug'](_0xbdb2('0x11'),_0x51fc95,_0xbdb2('0x10'),JSON['stringify'](_0x19839f));if(_0x19839f[_0xbdb2('0x12')]){if(_0x19839f[_0xbdb2('0x12')][_0xbdb2('0x13')]===0x1f4){logger['error'](_0xbdb2('0xf'),_0x51fc95,_0x19839f[_0xbdb2('0x12')][_0xbdb2('0x14')]);return _0x29898c(_0x19839f[_0xbdb2('0x12')]['message']);}logger[_0xbdb2('0x12')](_0xbdb2('0xf'),_0x51fc95,_0x19839f['error']['message']);return _0x40717f(_0x19839f[_0xbdb2('0x12')][_0xbdb2('0x14')]);}else{logger[_0xbdb2('0x15')](_0xbdb2('0xf'),_0x51fc95,_0xbdb2('0x10'));_0x40717f(_0x19839f[_0xbdb2('0x16')][_0xbdb2('0x14')]);}})[_0xbdb2('0x17')](function(_0x49f013){logger[_0xbdb2('0x12')]('VoiceContext,\x20%s,\x20%s',_0x51fc95,_0x49f013);_0x29898c(_0x49f013);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 541b73b..ceaac74 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 _0x1e46=['exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','post','create','update','delete','destroy'];(function(_0x4201de,_0x43ac07){var _0x3fef97=function(_0x92694c){while(--_0x92694c){_0x4201de['push'](_0x4201de['shift']());}};_0x3fef97(++_0x43ac07);}(_0x1e46,0x1bb));var _0x61e4=function(_0x50d588,_0x475c9e){_0x50d588=_0x50d588-0x0;var _0x343587=_0x1e46[_0x50d588];return _0x343587;};'use strict';var multer=require(_0x61e4('0x0'));var util=require(_0x61e4('0x1'));var path=require('path');var timeout=require(_0x61e4('0x2'));var express=require('express');var router=express[_0x61e4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x61e4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x61e4('0x5'));var controller=require('./voiceDialReport.controller');router[_0x61e4('0x6')]('/',auth[_0x61e4('0x7')](),controller['index']);router[_0x61e4('0x6')](_0x61e4('0x8'),auth[_0x61e4('0x7')](),controller['describe']);router[_0x61e4('0x6')](_0x61e4('0x9'),auth[_0x61e4('0x7')](),controller[_0x61e4('0xa')]);router[_0x61e4('0xb')]('/',auth['isAuthenticated'](),controller[_0x61e4('0xc')]);router['put']('/:id',auth[_0x61e4('0x7')](),controller[_0x61e4('0xd')]);router[_0x61e4('0xe')](_0x61e4('0x9'),auth['isAuthenticated'](),controller[_0x61e4('0xf')]);module[_0x61e4('0x10')]=router; \ No newline at end of file +var _0x11ab=['/:id','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x36e3ea,_0x11b2c6){var _0x5c2394=function(_0x2d63d2){while(--_0x2d63d2){_0x36e3ea['push'](_0x36e3ea['shift']());}};_0x5c2394(++_0x11b2c6);}(_0x11ab,0xf5));var _0xb11a=function(_0x3fa13c,_0x4ccf1a){_0x3fa13c=_0x3fa13c-0x0;var _0x3fc34c=_0x11ab[_0x3fa13c];return _0x3fc34c;};'use strict';var multer=require(_0xb11a('0x0'));var util=require(_0xb11a('0x1'));var path=require(_0xb11a('0x2'));var timeout=require(_0xb11a('0x3'));var express=require(_0xb11a('0x4'));var router=express[_0xb11a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb11a('0x6'));var interaction=require(_0xb11a('0x7'));var config=require(_0xb11a('0x8'));var controller=require(_0xb11a('0x9'));router[_0xb11a('0xa')]('/',auth[_0xb11a('0xb')](),controller[_0xb11a('0xc')]);router[_0xb11a('0xa')](_0xb11a('0xd'),auth[_0xb11a('0xb')](),controller[_0xb11a('0xe')]);router[_0xb11a('0xa')](_0xb11a('0xf'),auth[_0xb11a('0xb')](),controller['show']);router['post']('/',auth[_0xb11a('0xb')](),controller[_0xb11a('0x10')]);router['put'](_0xb11a('0xf'),auth[_0xb11a('0xb')](),controller[_0xb11a('0x11')]);router[_0xb11a('0x12')]('/:id',auth[_0xb11a('0xb')](),controller[_0xb11a('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 7d3cc58..c1c8dff 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 _0x8ef6=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0x126fb9,_0x122c59){var _0xc8a3b1=function(_0x355744){while(--_0x355744){_0x126fb9['push'](_0x126fb9['shift']());}};_0xc8a3b1(++_0x122c59);}(_0x8ef6,0xf2));var _0x68ef=function(_0x6bf42a,_0x500677){_0x6bf42a=_0x6bf42a-0x0;var _0x110795=_0x8ef6[_0x6bf42a];return _0x110795;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'privilege':{'type':Sequelize[_0x68ef('0x2')]},'channel':{'type':Sequelize[_0x68ef('0x2')]},'channelstate':{'type':Sequelize[_0x68ef('0x3')]},'channelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'calleridnum':{'type':Sequelize[_0x68ef('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'connectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'language':{'type':Sequelize[_0x68ef('0x2')]},'accountcode':{'type':Sequelize[_0x68ef('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x68ef('0x3')]},'uniqueid':{'type':Sequelize[_0x68ef('0x2')]},'linkedid':{'type':Sequelize[_0x68ef('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x68ef('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridnum':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridname':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'destlanguage':{'type':Sequelize[_0x68ef('0x2')]},'destaccountcode':{'type':Sequelize[_0x68ef('0x2')]},'destcontext':{'type':Sequelize[_0x68ef('0x2')]},'destexten':{'type':Sequelize[_0x68ef('0x2')]},'destpriority':{'type':Sequelize[_0x68ef('0x3')]},'destuniqueid':{'type':Sequelize[_0x68ef('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x68ef('0x2')]},'dialstatus':{'type':Sequelize[_0x68ef('0x2')]},'starttime':{'type':Sequelize[_0x68ef('0x4')]},'answertime':{'type':Sequelize[_0x68ef('0x4')]},'endtime':{'type':Sequelize[_0x68ef('0x4')]},'lastevent':{'type':Sequelize[_0x68ef('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x68ef('0x3')]},'duration':{'type':Sequelize[_0x68ef('0x3')]},'holdtime':{'type':Sequelize[_0x68ef('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x24ca=['STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x1f56d4,_0x4a07c6){var _0x3fe0ef=function(_0x44f01b){while(--_0x44f01b){_0x1f56d4['push'](_0x1f56d4['shift']());}};_0x3fe0ef(++_0x4a07c6);}(_0x24ca,0x1bc));var _0xa24c=function(_0xd4636c,_0x34dbf6){_0xd4636c=_0xd4636c-0x0;var _0x5ee17d=_0x24ca[_0xd4636c];return _0x5ee17d;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xa24c('0x1')]},'channel':{'type':Sequelize[_0xa24c('0x1')]},'channelstate':{'type':Sequelize[_0xa24c('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa24c('0x1')]},'calleridname':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'language':{'type':Sequelize[_0xa24c('0x1')]},'accountcode':{'type':Sequelize[_0xa24c('0x1')]},'context':{'type':Sequelize[_0xa24c('0x1')]},'exten':{'type':Sequelize[_0xa24c('0x1')]},'priority':{'type':Sequelize[_0xa24c('0x2')]},'uniqueid':{'type':Sequelize[_0xa24c('0x1')]},'linkedid':{'type':Sequelize[_0xa24c('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xa24c('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridnum':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'destlanguage':{'type':Sequelize[_0xa24c('0x1')]},'destaccountcode':{'type':Sequelize[_0xa24c('0x1')]},'destcontext':{'type':Sequelize[_0xa24c('0x1')]},'destexten':{'type':Sequelize[_0xa24c('0x1')]},'destpriority':{'type':Sequelize[_0xa24c('0x2')]},'destuniqueid':{'type':Sequelize[_0xa24c('0x1')]},'destlinkedid':{'type':Sequelize[_0xa24c('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xa24c('0x1')]},'starttime':{'type':Sequelize[_0xa24c('0x3')]},'answertime':{'type':Sequelize[_0xa24c('0x3')]},'endtime':{'type':Sequelize[_0xa24c('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xa24c('0x4')},'routeId':{'type':Sequelize[_0xa24c('0x2')]},'duration':{'type':Sequelize[_0xa24c('0x2')]},'holdtime':{'type':Sequelize[_0xa24c('0x2')]},'billableseconds':{'type':Sequelize[_0xa24c('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index c11e6ad..fe5dc44 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 _0x97e3=['destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','end','sendStatus','error','name','send','index','map','VoiceDialReport','fieldName','type','key','model','query','keys','filters','attributes','fields','length','sort','pick','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','intersection','find','create','body'];(function(_0xf83ddc,_0x3b10f0){var _0x3d9617=function(_0x3427df){while(--_0x3427df){_0xf83ddc['push'](_0xf83ddc['shift']());}};_0x3d9617(++_0x3b10f0);}(_0x97e3,0xda));var _0x397e=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x97e3[_0x2235bf];return _0x4c3a64;};'use strict';var emlformat=require(_0x397e('0x0'));var rimraf=require(_0x397e('0x1'));var zipdir=require(_0x397e('0x2'));var jsonpatch=require(_0x397e('0x3'));var rp=require(_0x397e('0x4'));var moment=require(_0x397e('0x5'));var BPromise=require(_0x397e('0x6'));var Mustache=require(_0x397e('0x7'));var util=require('util');var path=require('path');var sox=require(_0x397e('0x8'));var csv=require(_0x397e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x397e('0xa'));var _=require(_0x397e('0xb'));var squel=require(_0x397e('0xc'));var crypto=require(_0x397e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x397e('0xe'));var toCsv=require(_0x397e('0x9'));var querystring=require('querystring');var Papa=require(_0x397e('0xf'));var Redis=require('ioredis');var authService=require(_0x397e('0x10'));var qs=require(_0x397e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x397e('0x12'));var logger=require(_0x397e('0x13'))('api');var utils=require(_0x397e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x397e('0x15'));var db=require(_0x397e('0x16'))['db'];function respondWithStatusCode(_0x203451,_0x212383){_0x212383=_0x212383||0xcc;return function(_0x7a1521){if(_0x7a1521){return _0x203451['sendStatus'](_0x212383);}return _0x203451[_0x397e('0x17')](_0x212383)['end']();};}function respondWithResult(_0x4712f3,_0x4a36d1){_0x4a36d1=_0x4a36d1||0xc8;return function(_0x114cd6){if(_0x114cd6){return _0x4712f3[_0x397e('0x17')](_0x4a36d1)[_0x397e('0x18')](_0x114cd6);}};}function respondWithFilteredResult(_0x2fd2cc,_0x1e54da){return function(_0x1d87c1){if(_0x1d87c1){var _0x19ef19=typeof _0x1e54da[_0x397e('0x19')]===_0x397e('0x1a')&&typeof _0x1e54da[_0x397e('0x1b')]===_0x397e('0x1a');var _0x395cf3=_0x1d87c1[_0x397e('0x1c')];var _0x53a146=_0x19ef19?0x0:_0x1e54da[_0x397e('0x19')];var _0x356972=_0x19ef19?_0x1d87c1['count']:_0x1e54da[_0x397e('0x19')]+_0x1e54da[_0x397e('0x1b')];var _0x519e36;if(_0x356972>=_0x395cf3){_0x356972=_0x395cf3;_0x519e36=0xc8;}else{_0x519e36=0xce;}_0x2fd2cc[_0x397e('0x17')](_0x519e36);return _0x2fd2cc[_0x397e('0x1d')](_0x397e('0x1e'),_0x53a146+'-'+_0x356972+'/'+_0x395cf3)['json'](_0x1d87c1);}return null;};}function patchUpdates(_0x84f7f0){return function(_0x44b293){try{jsonpatch['apply'](_0x44b293,_0x84f7f0,!![]);}catch(_0x2e4dda){return BPromise[_0x397e('0x1f')](_0x2e4dda);}return _0x44b293[_0x397e('0x20')]();};}function saveUpdates(_0x3e736c,_0x595b5e){return function(_0xdb5eb2){if(_0xdb5eb2){return _0xdb5eb2[_0x397e('0x21')](_0x3e736c)[_0x397e('0x22')](function(_0x667c95){return _0x667c95;});}return null;};}function removeEntity(_0x5e19b2,_0xd3c1a7){return function(_0x5b74e5){if(_0x5b74e5){return _0x5b74e5['destroy']()['then'](function(){_0x5e19b2[_0x397e('0x17')](0xcc)[_0x397e('0x23')]();});}};}function handleEntityNotFound(_0x1acc06,_0x31ff83){return function(_0x2d8d70){if(!_0x2d8d70){_0x1acc06[_0x397e('0x24')](0x194);}return _0x2d8d70;};}function handleError(_0x4d46b7,_0x77423e){_0x77423e=_0x77423e||0x1f4;return function(_0x5bf752){logger[_0x397e('0x25')](_0x5bf752['stack']);if(_0x5bf752['name']){delete _0x5bf752[_0x397e('0x26')];}_0x4d46b7[_0x397e('0x17')](_0x77423e)[_0x397e('0x27')](_0x5bf752);};}exports[_0x397e('0x28')]=function(_0x59c64c,_0x317991){var _0xf2a29d={},_0x5482db={},_0x3c8d03={'count':0x0,'rows':[]};var _0x5d32b5=_[_0x397e('0x29')](db[_0x397e('0x2a')]['rawAttributes'],function(_0x5f269a){return{'name':_0x5f269a[_0x397e('0x2b')],'type':_0x5f269a[_0x397e('0x2c')][_0x397e('0x2d')]};});_0x5482db[_0x397e('0x2e')]=_['map'](_0x5d32b5,_0x397e('0x26'));_0x5482db[_0x397e('0x2f')]=_[_0x397e('0x30')](_0x59c64c[_0x397e('0x2f')]);_0x5482db[_0x397e('0x31')]=_['intersection'](_0x5482db[_0x397e('0x2e')],_0x5482db[_0x397e('0x2f')]);_0xf2a29d[_0x397e('0x32')]=_['intersection'](_0x5482db[_0x397e('0x2e')],qs[_0x397e('0x33')](_0x59c64c[_0x397e('0x2f')][_0x397e('0x33')]));_0xf2a29d[_0x397e('0x32')]=_0xf2a29d['attributes'][_0x397e('0x34')]?_0xf2a29d[_0x397e('0x32')]:_0x5482db[_0x397e('0x2e')];if(!_0x59c64c['query']['hasOwnProperty']('nolimit')){_0xf2a29d[_0x397e('0x1b')]=qs['limit'](_0x59c64c['query']['limit']);_0xf2a29d[_0x397e('0x19')]=qs['offset'](_0x59c64c[_0x397e('0x2f')][_0x397e('0x19')]);}_0xf2a29d['order']=qs[_0x397e('0x35')](_0x59c64c[_0x397e('0x2f')][_0x397e('0x35')]);_0xf2a29d['where']=qs['filters'](_[_0x397e('0x36')](_0x59c64c[_0x397e('0x2f')],_0x5482db[_0x397e('0x31')]),_0x5d32b5);if(_0x59c64c['query']['filter']){_0xf2a29d[_0x397e('0x37')]=_[_0x397e('0x38')](_0xf2a29d[_0x397e('0x37')],{'$or':_[_0x397e('0x29')](_0x5d32b5,function(_0x275f64){if(_0x275f64[_0x397e('0x2c')]!==_0x397e('0x39')){var _0x37ca1a={};_0x37ca1a[_0x275f64[_0x397e('0x26')]]={'$like':'%'+_0x59c64c[_0x397e('0x2f')]['filter']+'%'};return _0x37ca1a;}})});}_0xf2a29d=_[_0x397e('0x38')]({},_0xf2a29d,_0x59c64c[_0x397e('0x3a')]);var _0x25dd3f={'where':_0xf2a29d[_0x397e('0x37')]};return db[_0x397e('0x2a')]['count'](_0x25dd3f)[_0x397e('0x22')](function(_0x3e7a97){_0x3c8d03[_0x397e('0x1c')]=_0x3e7a97;if(_0x59c64c[_0x397e('0x2f')]['includeAll']){_0xf2a29d[_0x397e('0x3b')]=[{'all':!![]}];}return db[_0x397e('0x2a')][_0x397e('0x3c')](_0xf2a29d);})['then'](function(_0x5b6cb0){_0x3c8d03[_0x397e('0x3d')]=_0x5b6cb0;return _0x3c8d03;})['then'](respondWithFilteredResult(_0x317991,_0xf2a29d))[_0x397e('0x3e')](handleError(_0x317991,null));};exports[_0x397e('0x3f')]=function(_0xf9f46a,_0xc77d9b){var _0xbe7618={'raw':!![],'where':{'id':_0xf9f46a[_0x397e('0x40')]['id']}},_0x5e33e8={};_0x5e33e8[_0x397e('0x2e')]=_[_0x397e('0x30')](db['VoiceDialReport'][_0x397e('0x41')]);_0x5e33e8['query']=_['keys'](_0xf9f46a[_0x397e('0x2f')]);_0x5e33e8[_0x397e('0x31')]=_[_0x397e('0x42')](_0x5e33e8[_0x397e('0x2e')],_0x5e33e8['query']);_0xbe7618[_0x397e('0x32')]=_[_0x397e('0x42')](_0x5e33e8[_0x397e('0x2e')],qs['fields'](_0xf9f46a[_0x397e('0x2f')][_0x397e('0x33')]));_0xbe7618[_0x397e('0x32')]=_0xbe7618[_0x397e('0x32')]['length']?_0xbe7618[_0x397e('0x32')]:_0x5e33e8[_0x397e('0x2e')];if(_0xf9f46a[_0x397e('0x2f')]['includeAll']){_0xbe7618['include']=[{'all':!![]}];}_0xbe7618=_['merge']({},_0xbe7618,_0xf9f46a[_0x397e('0x3a')]);return db[_0x397e('0x2a')][_0x397e('0x43')](_0xbe7618)[_0x397e('0x22')](handleEntityNotFound(_0xc77d9b,null))[_0x397e('0x22')](respondWithResult(_0xc77d9b,null))[_0x397e('0x3e')](handleError(_0xc77d9b,null));};exports[_0x397e('0x44')]=function(_0x4d86ea,_0x53c36d){return db[_0x397e('0x2a')][_0x397e('0x44')](_0x4d86ea[_0x397e('0x45')],{})[_0x397e('0x22')](respondWithResult(_0x53c36d,0xc9))[_0x397e('0x3e')](handleError(_0x53c36d,null));};exports[_0x397e('0x21')]=function(_0x1925b9,_0x15671a){if(_0x1925b9[_0x397e('0x45')]['id']){delete _0x1925b9[_0x397e('0x45')]['id'];}return db['VoiceDialReport'][_0x397e('0x43')]({'where':{'id':_0x1925b9[_0x397e('0x40')]['id']}})[_0x397e('0x22')](handleEntityNotFound(_0x15671a,null))['then'](saveUpdates(_0x1925b9[_0x397e('0x45')],null))[_0x397e('0x22')](respondWithResult(_0x15671a,null))[_0x397e('0x3e')](handleError(_0x15671a,null));};exports[_0x397e('0x46')]=function(_0x198f1c,_0x3c2c3f){return db[_0x397e('0x2a')][_0x397e('0x43')]({'where':{'id':_0x198f1c[_0x397e('0x40')]['id']}})['then'](handleEntityNotFound(_0x3c2c3f,null))['then'](removeEntity(_0x3c2c3f,null))[_0x397e('0x3e')](handleError(_0x3c2c3f,null));};exports[_0x397e('0x47')]=function(_0x547478,_0x29c1c6){return db[_0x397e('0x2a')][_0x397e('0x47')]()['then'](respondWithResult(_0x29c1c6,null))[_0x397e('0x3e')](handleError(_0x29c1c6,null));}; \ No newline at end of file +var _0xc116=['fields','attributes','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','VoiceDialReport','fieldName','type','key','query','keys','filters','intersection','model'];(function(_0x3aac69,_0x81d09f){var _0x38d35b=function(_0x58ef90){while(--_0x58ef90){_0x3aac69['push'](_0x3aac69['shift']());}};_0x38d35b(++_0x81d09f);}(_0xc116,0x105));var _0x6c11=function(_0x3e462e,_0x1dafcd){_0x3e462e=_0x3e462e-0x0;var _0x50f7dd=_0xc116[_0x3e462e];return _0x50f7dd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6c11('0x0'));var jsonpatch=require(_0x6c11('0x1'));var rp=require(_0x6c11('0x2'));var moment=require(_0x6c11('0x3'));var BPromise=require(_0x6c11('0x4'));var Mustache=require(_0x6c11('0x5'));var util=require(_0x6c11('0x6'));var path=require('path');var sox=require(_0x6c11('0x7'));var csv=require(_0x6c11('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c11('0x9'));var _=require(_0x6c11('0xa'));var squel=require(_0x6c11('0xb'));var crypto=require('crypto');var jsforce=require(_0x6c11('0xc'));var deskjs=require(_0x6c11('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6c11('0xe'));var Papa=require(_0x6c11('0xf'));var Redis=require(_0x6c11('0x10'));var authService=require(_0x6c11('0x11'));var qs=require(_0x6c11('0x12'));var as=require(_0x6c11('0x13'));var hardwareService=require(_0x6c11('0x14'));var logger=require(_0x6c11('0x15'))('api');var utils=require(_0x6c11('0x16'));var config=require(_0x6c11('0x17'));var licenseUtil=require(_0x6c11('0x18'));var db=require(_0x6c11('0x19'))['db'];function respondWithStatusCode(_0x293967,_0x3e997b){_0x3e997b=_0x3e997b||0xcc;return function(_0xbd917){if(_0xbd917){return _0x293967['sendStatus'](_0x3e997b);}return _0x293967[_0x6c11('0x1a')](_0x3e997b)[_0x6c11('0x1b')]();};}function respondWithResult(_0xfe9eb7,_0x2044bb){_0x2044bb=_0x2044bb||0xc8;return function(_0xf4dcf9){if(_0xf4dcf9){return _0xfe9eb7[_0x6c11('0x1a')](_0x2044bb)[_0x6c11('0x1c')](_0xf4dcf9);}};}function respondWithFilteredResult(_0x507ec2,_0x4ed694){return function(_0x21822b){if(_0x21822b){var _0x8846b3=typeof _0x4ed694[_0x6c11('0x1d')]===_0x6c11('0x1e')&&typeof _0x4ed694[_0x6c11('0x1f')]==='undefined';var _0x618026=_0x21822b['count'];var _0x22bbac=_0x8846b3?0x0:_0x4ed694[_0x6c11('0x1d')];var _0x36e594=_0x8846b3?_0x21822b['count']:_0x4ed694[_0x6c11('0x1d')]+_0x4ed694[_0x6c11('0x1f')];var _0x1ace02;if(_0x36e594>=_0x618026){_0x36e594=_0x618026;_0x1ace02=0xc8;}else{_0x1ace02=0xce;}_0x507ec2[_0x6c11('0x1a')](_0x1ace02);return _0x507ec2[_0x6c11('0x20')](_0x6c11('0x21'),_0x22bbac+'-'+_0x36e594+'/'+_0x618026)[_0x6c11('0x1c')](_0x21822b);}return null;};}function patchUpdates(_0x433267){return function(_0x2455fa){try{jsonpatch[_0x6c11('0x22')](_0x2455fa,_0x433267,!![]);}catch(_0x3518ed){return BPromise[_0x6c11('0x23')](_0x3518ed);}return _0x2455fa[_0x6c11('0x24')]();};}function saveUpdates(_0x477e5a,_0xa8835b){return function(_0x44bb3f){if(_0x44bb3f){return _0x44bb3f[_0x6c11('0x25')](_0x477e5a)[_0x6c11('0x26')](function(_0x4aea54){return _0x4aea54;});}return null;};}function removeEntity(_0x2ed986,_0x2cbcb6){return function(_0x1cfcd3){if(_0x1cfcd3){return _0x1cfcd3['destroy']()[_0x6c11('0x26')](function(){_0x2ed986[_0x6c11('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb606ac,_0x4584a0){return function(_0x3089bb){if(!_0x3089bb){_0xb606ac[_0x6c11('0x27')](0x194);}return _0x3089bb;};}function handleError(_0x1987a0,_0x13dfed){_0x13dfed=_0x13dfed||0x1f4;return function(_0x2e9c57){logger[_0x6c11('0x28')](_0x2e9c57[_0x6c11('0x29')]);if(_0x2e9c57[_0x6c11('0x2a')]){delete _0x2e9c57['name'];}_0x1987a0[_0x6c11('0x1a')](_0x13dfed)[_0x6c11('0x2b')](_0x2e9c57);};}exports[_0x6c11('0x2c')]=function(_0x3ab028,_0x4f237e){var _0x550949={},_0x518f9a={},_0x1f2409={'count':0x0,'rows':[]};var _0x27ffb9=_[_0x6c11('0x2d')](db[_0x6c11('0x2e')]['rawAttributes'],function(_0x7b0d27){return{'name':_0x7b0d27[_0x6c11('0x2f')],'type':_0x7b0d27[_0x6c11('0x30')][_0x6c11('0x31')]};});_0x518f9a['model']=_[_0x6c11('0x2d')](_0x27ffb9,_0x6c11('0x2a'));_0x518f9a[_0x6c11('0x32')]=_[_0x6c11('0x33')](_0x3ab028[_0x6c11('0x32')]);_0x518f9a[_0x6c11('0x34')]=_[_0x6c11('0x35')](_0x518f9a[_0x6c11('0x36')],_0x518f9a[_0x6c11('0x32')]);_0x550949['attributes']=_[_0x6c11('0x35')](_0x518f9a[_0x6c11('0x36')],qs[_0x6c11('0x37')](_0x3ab028[_0x6c11('0x32')]['fields']));_0x550949['attributes']=_0x550949[_0x6c11('0x38')]['length']?_0x550949['attributes']:_0x518f9a[_0x6c11('0x36')];if(!_0x3ab028[_0x6c11('0x32')]['hasOwnProperty'](_0x6c11('0x39'))){_0x550949[_0x6c11('0x1f')]=qs[_0x6c11('0x1f')](_0x3ab028[_0x6c11('0x32')]['limit']);_0x550949['offset']=qs[_0x6c11('0x1d')](_0x3ab028['query'][_0x6c11('0x1d')]);}_0x550949[_0x6c11('0x3a')]=qs[_0x6c11('0x3b')](_0x3ab028['query']['sort']);_0x550949[_0x6c11('0x3c')]=qs[_0x6c11('0x34')](_[_0x6c11('0x3d')](_0x3ab028[_0x6c11('0x32')],_0x518f9a['filters']),_0x27ffb9);if(_0x3ab028[_0x6c11('0x32')]['filter']){_0x550949[_0x6c11('0x3c')]=_['merge'](_0x550949[_0x6c11('0x3c')],{'$or':_[_0x6c11('0x2d')](_0x27ffb9,function(_0x2b3411){if(_0x2b3411[_0x6c11('0x30')]!=='VIRTUAL'){var _0x1f41c5={};_0x1f41c5[_0x2b3411[_0x6c11('0x2a')]]={'$like':'%'+_0x3ab028[_0x6c11('0x32')][_0x6c11('0x3e')]+'%'};return _0x1f41c5;}})});}_0x550949=_[_0x6c11('0x3f')]({},_0x550949,_0x3ab028[_0x6c11('0x40')]);var _0x21ecf1={'where':_0x550949[_0x6c11('0x3c')]};return db[_0x6c11('0x2e')][_0x6c11('0x41')](_0x21ecf1)[_0x6c11('0x26')](function(_0x15a1d0){_0x1f2409[_0x6c11('0x41')]=_0x15a1d0;if(_0x3ab028['query'][_0x6c11('0x42')]){_0x550949[_0x6c11('0x43')]=[{'all':!![]}];}return db[_0x6c11('0x2e')][_0x6c11('0x44')](_0x550949);})[_0x6c11('0x26')](function(_0x3e4de5){_0x1f2409[_0x6c11('0x45')]=_0x3e4de5;return _0x1f2409;})['then'](respondWithFilteredResult(_0x4f237e,_0x550949))[_0x6c11('0x46')](handleError(_0x4f237e,null));};exports[_0x6c11('0x47')]=function(_0x3cbd5b,_0x11f68d){var _0x1def85={'raw':!![],'where':{'id':_0x3cbd5b[_0x6c11('0x48')]['id']}},_0xe1ce76={};_0xe1ce76[_0x6c11('0x36')]=_[_0x6c11('0x33')](db[_0x6c11('0x2e')][_0x6c11('0x49')]);_0xe1ce76[_0x6c11('0x32')]=_['keys'](_0x3cbd5b['query']);_0xe1ce76[_0x6c11('0x34')]=_['intersection'](_0xe1ce76[_0x6c11('0x36')],_0xe1ce76[_0x6c11('0x32')]);_0x1def85[_0x6c11('0x38')]=_['intersection'](_0xe1ce76['model'],qs[_0x6c11('0x37')](_0x3cbd5b[_0x6c11('0x32')][_0x6c11('0x37')]));_0x1def85[_0x6c11('0x38')]=_0x1def85['attributes']['length']?_0x1def85[_0x6c11('0x38')]:_0xe1ce76[_0x6c11('0x36')];if(_0x3cbd5b['query']['includeAll']){_0x1def85['include']=[{'all':!![]}];}_0x1def85=_[_0x6c11('0x3f')]({},_0x1def85,_0x3cbd5b[_0x6c11('0x40')]);return db[_0x6c11('0x2e')][_0x6c11('0x4a')](_0x1def85)['then'](handleEntityNotFound(_0x11f68d,null))[_0x6c11('0x26')](respondWithResult(_0x11f68d,null))[_0x6c11('0x46')](handleError(_0x11f68d,null));};exports['create']=function(_0x4db5bb,_0x5eabe7){return db[_0x6c11('0x2e')][_0x6c11('0x4b')](_0x4db5bb[_0x6c11('0x4c')],{})[_0x6c11('0x26')](respondWithResult(_0x5eabe7,0xc9))[_0x6c11('0x46')](handleError(_0x5eabe7,null));};exports[_0x6c11('0x25')]=function(_0x290996,_0x11ea91){if(_0x290996[_0x6c11('0x4c')]['id']){delete _0x290996['body']['id'];}return db[_0x6c11('0x2e')][_0x6c11('0x4a')]({'where':{'id':_0x290996['params']['id']}})[_0x6c11('0x26')](handleEntityNotFound(_0x11ea91,null))[_0x6c11('0x26')](saveUpdates(_0x290996['body'],null))[_0x6c11('0x26')](respondWithResult(_0x11ea91,null))[_0x6c11('0x46')](handleError(_0x11ea91,null));};exports[_0x6c11('0x4d')]=function(_0x1c9332,_0x90588f){return db['VoiceDialReport'][_0x6c11('0x4a')]({'where':{'id':_0x1c9332['params']['id']}})[_0x6c11('0x26')](handleEntityNotFound(_0x90588f,null))['then'](removeEntity(_0x90588f,null))[_0x6c11('0x46')](handleError(_0x90588f,null));};exports[_0x6c11('0x4e')]=function(_0xc4dc0c,_0x15debf){return db[_0x6c11('0x2e')][_0x6c11('0x4e')]()['then'](respondWithResult(_0x15debf,null))['catch'](handleError(_0x15debf,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index ec7e583..03faa6d 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 _0xe441=['request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','VoiceDialReport','report_dial','lodash','util','../../config/logger','api','moment'];(function(_0x5bde78,_0xef666d){var _0x587f12=function(_0x3b39a4){while(--_0x3b39a4){_0x5bde78['push'](_0x5bde78['shift']());}};_0x587f12(++_0xef666d);}(_0xe441,0xeb));var _0x1e44=function(_0x2972f0,_0x21b9ea){_0x2972f0=_0x2972f0-0x0;var _0x505ad8=_0xe441[_0x2972f0];return _0x505ad8;};'use strict';var _=require(_0x1e44('0x0'));var util=require(_0x1e44('0x1'));var logger=require(_0x1e44('0x2'))(_0x1e44('0x3'));var moment=require(_0x1e44('0x4'));var BPromise=require('bluebird');var rp=require(_0x1e44('0x5'));var fs=require('fs');var path=require(_0x1e44('0x6'));var rimraf=require(_0x1e44('0x7'));var config=require(_0x1e44('0x8'));var attributes=require(_0x1e44('0x9'));module['exports']=function(_0x388174,_0x243187){return _0x388174['define'](_0x1e44('0xa'),attributes,{'tableName':_0x1e44('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbf94=['report_dial','uniqueid','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport'];(function(_0x4a1353,_0x2fbe86){var _0x3805cc=function(_0x39a7ee){while(--_0x39a7ee){_0x4a1353['push'](_0x4a1353['shift']());}};_0x3805cc(++_0x2fbe86);}(_0xbf94,0x146));var _0x4bf9=function(_0x20ab11,_0x568809){_0x20ab11=_0x20ab11-0x0;var _0x1e95e2=_0xbf94[_0x20ab11];return _0x1e95e2;};'use strict';var _=require(_0x4bf9('0x0'));var util=require(_0x4bf9('0x1'));var logger=require(_0x4bf9('0x2'))(_0x4bf9('0x3'));var moment=require('moment');var BPromise=require(_0x4bf9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4bf9('0x5'));var rimraf=require('rimraf');var config=require(_0x4bf9('0x6'));var attributes=require(_0x4bf9('0x7'));module['exports']=function(_0x1ef7f1,_0x5a2932){return _0x1ef7f1[_0x4bf9('0x8')](_0x4bf9('0x9'),attributes,{'tableName':_0x4bf9('0xa'),'paranoid':![],'indexes':[{'fields':[_0x4bf9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index c692590..0ed6db2 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 _0x3b6f=['client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','VoiceDialReport','create','options','raw','CreateVoiceDialReport','catch','UpdateVoiceDialReport','update','body','where','attributes','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3b6f,0xa2));var _0xf3b6=function(_0x50acfc,_0x2d7b98){_0x50acfc=_0x50acfc-0x0;var _0x3f388d=_0x3b6f[_0x50acfc];return _0x3f388d;};'use strict';var _=require('lodash');var util=require(_0xf3b6('0x0'));var moment=require('moment');var BPromise=require(_0xf3b6('0x1'));var rs=require(_0xf3b6('0x2'));var fs=require('fs');var Redis=require(_0xf3b6('0x3'));var db=require(_0xf3b6('0x4'))['db'];var utils=require(_0xf3b6('0x5'));var logger=require(_0xf3b6('0x6'))(_0xf3b6('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf3b6('0x8')][_0xf3b6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e485e,_0x576462,_0x2f9932){return new BPromise(function(_0x1f28d1,_0x341695){return client[_0xf3b6('0xa')](_0x3e485e,_0x2f9932)[_0xf3b6('0xb')](function(_0x1b6a42){logger[_0xf3b6('0xc')](_0xf3b6('0xd'),_0x576462,'request\x20sent');logger[_0xf3b6('0xe')](_0xf3b6('0xf'),_0x576462,_0xf3b6('0x10'),JSON[_0xf3b6('0x11')](_0x1b6a42));if(_0x1b6a42[_0xf3b6('0x12')]){if(_0x1b6a42['error'][_0xf3b6('0x13')]===0x1f4){logger[_0xf3b6('0x12')](_0xf3b6('0xd'),_0x576462,_0x1b6a42[_0xf3b6('0x12')][_0xf3b6('0x14')]);return _0x341695(_0x1b6a42[_0xf3b6('0x12')][_0xf3b6('0x14')]);}logger[_0xf3b6('0x12')](_0xf3b6('0xd'),_0x576462,_0x1b6a42[_0xf3b6('0x12')][_0xf3b6('0x14')]);return _0x1f28d1(_0x1b6a42['error'][_0xf3b6('0x14')]);}else{logger[_0xf3b6('0xc')](_0xf3b6('0xd'),_0x576462,_0xf3b6('0x10'));_0x1f28d1(_0x1b6a42[_0xf3b6('0x15')][_0xf3b6('0x14')]);}})['catch'](function(_0xc54889){logger[_0xf3b6('0x12')](_0xf3b6('0xd'),_0x576462,_0xc54889);_0x341695(_0xc54889);});});}exports['CreateVoiceDialReport']=function(_0x482131){var _0x53546b=this;return new Promise(function(_0x157414,_0x99ae53){return db[_0xf3b6('0x16')][_0xf3b6('0x17')](_0x482131['body'],{'raw':_0x482131[_0xf3b6('0x18')]?_0x482131[_0xf3b6('0x18')][_0xf3b6('0x19')]===undefined?!![]:![]:!![]})[_0xf3b6('0xb')](function(_0x45c8ba){logger[_0xf3b6('0xc')](_0xf3b6('0x1a'),_0x482131);logger['debug'](_0xf3b6('0x1a'),_0x482131,JSON[_0xf3b6('0x11')](_0x45c8ba));_0x157414(_0x45c8ba);})[_0xf3b6('0x1b')](function(_0x3c553d){logger[_0xf3b6('0x12')]('CreateVoiceDialReport',_0x3c553d['message'],_0x482131);_0x99ae53(_0x53546b[_0xf3b6('0x12')](0x1f4,_0x3c553d[_0xf3b6('0x14')]));});});};exports[_0xf3b6('0x1c')]=function(_0x255165){var _0x3fc648=this;return new Promise(function(_0x418086,_0x375d03){return db[_0xf3b6('0x16')][_0xf3b6('0x1d')](_0x255165[_0xf3b6('0x1e')],{'raw':_0x255165[_0xf3b6('0x18')]?_0x255165[_0xf3b6('0x18')][_0xf3b6('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x255165[_0xf3b6('0x18')]?_0x255165[_0xf3b6('0x18')][_0xf3b6('0x1f')]||null:null,'attributes':_0x255165[_0xf3b6('0x18')]?_0x255165[_0xf3b6('0x18')][_0xf3b6('0x20')]||null:null,'limit':_0x255165['options']?_0x255165[_0xf3b6('0x18')][_0xf3b6('0x21')]||null:null})[_0xf3b6('0xb')](function(_0x3fb903){logger[_0xf3b6('0xc')](_0xf3b6('0x1c'),_0x255165);logger[_0xf3b6('0xe')]('UpdateVoiceDialReport',_0x255165,JSON[_0xf3b6('0x11')](_0x3fb903));_0x418086(_0x3fb903);})[_0xf3b6('0x1b')](function(_0x4696d6){logger[_0xf3b6('0x12')]('UpdateVoiceDialReport',_0x4696d6[_0xf3b6('0x14')],_0x255165);_0x375d03(_0x3fc648[_0xf3b6('0x12')](0x1f4,_0x4696d6[_0xf3b6('0x14')]));});});}; \ No newline at end of file +var _0x1e2b=['body','options','raw','then','UpdateVoiceDialReport','VoiceDialReport','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateVoiceDialReport','create'];(function(_0x104594,_0x4e4b9e){var _0x4683bf=function(_0x3fd10a){while(--_0x3fd10a){_0x104594['push'](_0x104594['shift']());}};_0x4683bf(++_0x4e4b9e);}(_0x1e2b,0xe8));var _0xb1e2=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x1e2b[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xb1e2('0x0'));var util=require(_0xb1e2('0x1'));var moment=require(_0xb1e2('0x2'));var BPromise=require('bluebird');var rs=require(_0xb1e2('0x3'));var fs=require('fs');var Redis=require(_0xb1e2('0x4'));var db=require(_0xb1e2('0x5'))['db'];var utils=require(_0xb1e2('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xb1e2('0x7'));var jayson=require(_0xb1e2('0x8'));var client=jayson[_0xb1e2('0x9')][_0xb1e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c8634,_0x279038,_0x158b35){return new BPromise(function(_0x5c6f3d,_0x12f9be){return client[_0xb1e2('0xb')](_0x2c8634,_0x158b35)['then'](function(_0x2ec9da){logger[_0xb1e2('0xc')](_0xb1e2('0xd'),_0x279038,_0xb1e2('0xe'));logger[_0xb1e2('0xf')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x279038,_0xb1e2('0xe'),JSON[_0xb1e2('0x10')](_0x2ec9da));if(_0x2ec9da[_0xb1e2('0x11')]){if(_0x2ec9da[_0xb1e2('0x11')][_0xb1e2('0x12')]===0x1f4){logger[_0xb1e2('0x11')](_0xb1e2('0xd'),_0x279038,_0x2ec9da[_0xb1e2('0x11')][_0xb1e2('0x13')]);return _0x12f9be(_0x2ec9da['error']['message']);}logger[_0xb1e2('0x11')](_0xb1e2('0xd'),_0x279038,_0x2ec9da['error'][_0xb1e2('0x13')]);return _0x5c6f3d(_0x2ec9da[_0xb1e2('0x11')][_0xb1e2('0x13')]);}else{logger[_0xb1e2('0xc')](_0xb1e2('0xd'),_0x279038,_0xb1e2('0xe'));_0x5c6f3d(_0x2ec9da[_0xb1e2('0x14')][_0xb1e2('0x13')]);}})[_0xb1e2('0x15')](function(_0xd939da){logger['error'](_0xb1e2('0xd'),_0x279038,_0xd939da);_0x12f9be(_0xd939da);});});}exports[_0xb1e2('0x16')]=function(_0x134309){var _0x310a24=this;return new Promise(function(_0x3507df,_0x2fd848){return db['VoiceDialReport'][_0xb1e2('0x17')](_0x134309[_0xb1e2('0x18')],{'raw':_0x134309[_0xb1e2('0x19')]?_0x134309[_0xb1e2('0x19')][_0xb1e2('0x1a')]===undefined?!![]:![]:!![]})[_0xb1e2('0x1b')](function(_0x12de16){logger[_0xb1e2('0xc')](_0xb1e2('0x16'),_0x134309);logger['debug'](_0xb1e2('0x16'),_0x134309,JSON[_0xb1e2('0x10')](_0x12de16));_0x3507df(_0x12de16);})['catch'](function(_0x5a761c){logger[_0xb1e2('0x11')]('CreateVoiceDialReport',_0x5a761c[_0xb1e2('0x13')],_0x134309);_0x2fd848(_0x310a24[_0xb1e2('0x11')](0x1f4,_0x5a761c['message']));});});};exports[_0xb1e2('0x1c')]=function(_0x2a24b0){var _0x199259=this;return new Promise(function(_0x49b4c3,_0x44a5bc){return db[_0xb1e2('0x1d')]['update'](_0x2a24b0[_0xb1e2('0x18')],{'raw':_0x2a24b0[_0xb1e2('0x19')]?_0x2a24b0['options'][_0xb1e2('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a24b0[_0xb1e2('0x19')]?_0x2a24b0[_0xb1e2('0x19')]['where']||null:null,'attributes':_0x2a24b0[_0xb1e2('0x19')]?_0x2a24b0[_0xb1e2('0x19')][_0xb1e2('0x1e')]||null:null,'limit':_0x2a24b0[_0xb1e2('0x19')]?_0x2a24b0[_0xb1e2('0x19')][_0xb1e2('0x1f')]||null:null})[_0xb1e2('0x1b')](function(_0x5a68cb){logger[_0xb1e2('0xc')]('UpdateVoiceDialReport',_0x2a24b0);logger[_0xb1e2('0xf')](_0xb1e2('0x1c'),_0x2a24b0,JSON[_0xb1e2('0x10')](_0x5a68cb));_0x49b4c3(_0x5a68cb);})[_0xb1e2('0x15')](function(_0x5e8d14){logger['error'](_0xb1e2('0x1c'),_0x5e8d14[_0xb1e2('0x13')],_0x2a24b0);_0x44a5bc(_0x199259['error'](0x1f4,_0x5e8d14[_0xb1e2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index e1d7d7e..b36abf8 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 _0x76b1=['destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','addApplications','put','update'];(function(_0x1d8a58,_0x431e66){var _0x505a8d=function(_0x45c91a){while(--_0x45c91a){_0x1d8a58['push'](_0x1d8a58['shift']());}};_0x505a8d(++_0x431e66);}(_0x76b1,0x13d));var _0x176b=function(_0x2b6130,_0x3a6bbd){_0x2b6130=_0x2b6130-0x0;var _0x413491=_0x76b1[_0x2b6130];return _0x413491;};'use strict';var multer=require(_0x176b('0x0'));var util=require(_0x176b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x176b('0x2'));var router=express[_0x176b('0x3')]();var fs_extra=require(_0x176b('0x4'));var auth=require(_0x176b('0x5'));var interaction=require(_0x176b('0x6'));var config=require(_0x176b('0x7'));var controller=require(_0x176b('0x8'));router[_0x176b('0x9')]('/',auth[_0x176b('0xa')](),controller[_0x176b('0xb')]);router[_0x176b('0x9')](_0x176b('0xc'),auth['isAuthenticated'](),controller[_0x176b('0xd')]);router[_0x176b('0xe')]('/',auth['isAuthenticated'](),controller[_0x176b('0xf')]);router[_0x176b('0xe')]('/:id/applications',auth[_0x176b('0xa')](),controller[_0x176b('0x10')]);router[_0x176b('0x11')](_0x176b('0xc'),auth[_0x176b('0xa')](),controller[_0x176b('0x12')]);router['delete'](_0x176b('0xc'),auth[_0x176b('0xa')](),controller[_0x176b('0x13')]);module[_0x176b('0x14')]=router; \ No newline at end of file +var _0x856f=['index','/:id','show','post','create','/:id/applications','addApplications','put','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x856f,0x1d7));var _0xf856=function(_0x229451,_0x3798fb){_0x229451=_0x229451-0x0;var _0x61a6b3=_0x856f[_0x229451];return _0x61a6b3;};'use strict';var multer=require(_0xf856('0x0'));var util=require(_0xf856('0x1'));var path=require(_0xf856('0x2'));var timeout=require(_0xf856('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf856('0x4'));var interaction=require(_0xf856('0x5'));var config=require(_0xf856('0x6'));var controller=require(_0xf856('0x7'));router['get']('/',auth[_0xf856('0x8')](),controller[_0xf856('0x9')]);router['get'](_0xf856('0xa'),auth[_0xf856('0x8')](),controller[_0xf856('0xb')]);router[_0xf856('0xc')]('/',auth[_0xf856('0x8')](),controller[_0xf856('0xd')]);router[_0xf856('0xc')](_0xf856('0xe'),auth[_0xf856('0x8')](),controller[_0xf856('0xf')]);router[_0xf856('0x10')](_0xf856('0xa'),auth[_0xf856('0x8')](),controller['update']);router[_0xf856('0x11')]('/:id',auth[_0xf856('0x8')](),controller[_0xf856('0x12')]);module[_0xf856('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index caf763f..16498d6 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 _0x5dfc=['inbound-fax','outbound-fax','any','*,*,*,*','BOOLEAN','INTEGER','wav','VIRTUAL','getDataValue','sequelize','exports','compositeIndex','STRING','NoOp','ENUM','inbound','outbound'];(function(_0x5d9a0a,_0xc0cc46){var _0x1b1634=function(_0x34c58a){while(--_0x34c58a){_0x5d9a0a['push'](_0x5d9a0a['shift']());}};_0x1b1634(++_0xc0cc46);}(_0x5dfc,0xf7));var _0xc5df=function(_0x282ccc,_0x5d66a1){_0x282ccc=_0x282ccc-0x0;var _0x27c2dd=_0x5dfc[_0x282ccc];return _0x27c2dd;};'use strict';var Sequelize=require(_0xc5df('0x0'));module[_0xc5df('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc5df('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xc5df('0x3')],'allowNull':![],'unique':_0xc5df('0x2')},'priority':{'type':Sequelize[_0xc5df('0x3')],'allowNull':![],'defaultValue':'1','unique':_0xc5df('0x2')},'tag':{'type':Sequelize[_0xc5df('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xc5df('0x3')],'allowNull':![],'defaultValue':_0xc5df('0x4')},'appdata':{'type':Sequelize[_0xc5df('0x3')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xc5df('0x5')](_0xc5df('0x6'),_0xc5df('0x7'),'internal',_0xc5df('0x8'),_0xc5df('0x9'),'system',_0xc5df('0xa')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xc5df('0x3')],'allowNull':![],'defaultValue':_0xc5df('0xb')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xc5df('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xc5df('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0xc5df('0x3')],'allowNull':!![]},'record':{'type':Sequelize[_0xc5df('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xc5df('0xd')]},'recordingFormat':{'type':Sequelize[_0xc5df('0x3')],'defaultValue':_0xc5df('0xe')},'answer':{'type':Sequelize[_0xc5df('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0xc5df('0xf')],'get':function(_0x15b00d){return this[_0xc5df('0x10')]('exten');}},'alias':{'type':Sequelize[_0xc5df('0x3')],'allowNull':!![]}}; \ No newline at end of file +var _0xa999=['exports','STRING','compositeIndex','ENUM','inbound-fax','any','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xa999,0xef));var _0x9a99=function(_0x1a1c63,_0x4eeea1){_0x1a1c63=_0x1a1c63-0x0;var _0x2e8ba8=_0xa999[_0x1a1c63];return _0x2e8ba8;};'use strict';var Sequelize=require(_0x9a99('0x0'));module[_0x9a99('0x1')]={'context':{'type':Sequelize[_0x9a99('0x2')],'allowNull':![],'unique':_0x9a99('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9a99('0x3')},'priority':{'type':Sequelize[_0x9a99('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x9a99('0x3')},'tag':{'type':Sequelize[_0x9a99('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x9a99('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x9a99('0x4')]('inbound','outbound','internal',_0x9a99('0x5'),'outbound-fax','system',_0x9a99('0x6')),'allowNull':![]},'description':{'type':Sequelize[_0x9a99('0x2')]},'interval':{'type':Sequelize[_0x9a99('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x9a99('0x7')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x9a99('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x9a99('0x7')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x9a99('0x2')],'defaultValue':_0x9a99('0x8')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x9a99('0x9')],'get':function(_0x5e34ea){return this[_0x9a99('0xa')](_0x9a99('0xb'));}},'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 3497d2d..6dc9735 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 _0xe4d3=['count','set','Content-Range','destroy','then','get','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','map','value','includes','find','type','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','key','model','keys','filters','attributes','intersection','fields','length','query','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','options','VoiceExtension','includeAll','include','rows','catch','show','params','create','body','outbound','startsWith','concat','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','context','description','recordingFormat','cutdigits','mandatoryDisposition','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','createRouting','bulkCreate','findAndCountAll','priority','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xe4d3,0x170));var _0x3e4d=function(_0x488a0d,_0x3b5878){_0x488a0d=_0x488a0d-0x0;var _0x467447=_0xe4d3[_0x488a0d];return _0x467447;};'use strict';var _=require(_0x3e4d('0x0'));var Redis=require(_0x3e4d('0x1'));var qs=require(_0x3e4d('0x2'));var logger=require(_0x3e4d('0x3'))(_0x3e4d('0x4'));var config=require(_0x3e4d('0x5'));var db=require(_0x3e4d('0x6'))['db'];config[_0x3e4d('0x7')]=_[_0x3e4d('0x8')](config[_0x3e4d('0x7')],{'host':_0x3e4d('0x9'),'port':0x18eb});var socket=require(_0x3e4d('0xa'))(new Redis(config[_0x3e4d('0x7')]));require(_0x3e4d('0xb'))[_0x3e4d('0xc')](socket);function respondWithStatusCode(_0x2cf66c,_0x9a5503){_0x9a5503=_0x9a5503||0xcc;return function(_0x1a0dce){if(_0x1a0dce){return _0x2cf66c[_0x3e4d('0xd')](_0x9a5503);}return _0x2cf66c[_0x3e4d('0xe')](_0x9a5503)[_0x3e4d('0xf')]();};}function respondWithResult(_0x4608ba,_0xe8ffe6){_0xe8ffe6=_0xe8ffe6||0xc8;return function(_0xc7798f){if(_0xc7798f){return _0x4608ba[_0x3e4d('0xe')](_0xe8ffe6)[_0x3e4d('0x10')](_0xc7798f);}};}function respondWithFilteredResult(_0x438536,_0x150672){return function(_0x4414db){if(_0x4414db){var _0x478802=typeof _0x150672[_0x3e4d('0x11')]===_0x3e4d('0x12')&&typeof _0x150672[_0x3e4d('0x13')]===_0x3e4d('0x12');var _0xcba24d=_0x4414db[_0x3e4d('0x14')];var _0x482aac=_0x478802?0x0:_0x150672[_0x3e4d('0x11')];var _0x451643=_0x478802?_0x4414db[_0x3e4d('0x14')]:_0x150672['offset']+_0x150672[_0x3e4d('0x13')];var _0x57b28c;if(_0x451643>=_0xcba24d){_0x451643=_0xcba24d;_0x57b28c=0xc8;}else{_0x57b28c=0xce;}_0x438536[_0x3e4d('0xe')](_0x57b28c);return _0x438536[_0x3e4d('0x15')](_0x3e4d('0x16'),_0x482aac+'-'+_0x451643+'/'+_0xcba24d)[_0x3e4d('0x10')](_0x4414db);}return null;};}function removeEntity(_0x96fd93){return function(_0x2d8332){if(_0x2d8332){return _0x2d8332[_0x3e4d('0x17')]()[_0x3e4d('0x18')](function(){var _0x4c92d2=_0x2d8332[_0x3e4d('0x19')]({'plain':!![]});var _0x5db8a5=[{'name':'InboundRoutes','value':_0x3e4d('0x1a'),'ignore':![]},{'name':_0x3e4d('0x1b'),'value':'outbound','ignore':![]},{'name':_0x3e4d('0x1c'),'value':_0x3e4d('0x1d'),'ignore':![]}];var _0x5cb095=_(_0x5db8a5)[_0x3e4d('0x1e')](_0x3e4d('0x1f'))[_0x3e4d('0x20')](_0x3e4d('0x21'))[_0x3e4d('0x21')]();if(_[_0x3e4d('0x22')](_0x5cb095,_0x4c92d2['type'])){return;}var _0x18d67a=_[_0x3e4d('0x23')](_0x5db8a5,[_0x3e4d('0x21'),_0x4c92d2[_0x3e4d('0x24')]])['name'];return db[_0x3e4d('0x25')][_0x3e4d('0x17')]({'where':{'type':_0x18d67a,'resourceId':_0x4c92d2['id']}})[_0x3e4d('0x18')](function(){return _0x2d8332;});})[_0x3e4d('0x18')](function(){_0x96fd93[_0x3e4d('0xe')](0xcc)[_0x3e4d('0xf')]();});}};}function handleEntityNotFound(_0x467e21){return function(_0x16d65a){if(!_0x16d65a){_0x467e21[_0x3e4d('0xd')](0x194);}return _0x16d65a;};}function handleError(_0x41f436,_0xf9ccd9){_0xf9ccd9=_0xf9ccd9||0x1f4;return function(_0x28c6ab){logger[_0x3e4d('0x26')](_0x28c6ab[_0x3e4d('0x27')]);if(_0x28c6ab[_0x3e4d('0x28')]){delete _0x28c6ab['name'];}_0x41f436[_0x3e4d('0xe')](_0xf9ccd9)[_0x3e4d('0x29')](_0x28c6ab);};}exports[_0x3e4d('0x2a')]=function(_0x32604d,_0x224e32){var _0x550648={},_0x1a36ff={},_0x1aece7={'count':0x0,'rows':[]};var _0x542777=_[_0x3e4d('0x20')](db['VoiceExtension'][_0x3e4d('0x2b')],function(_0x1992a2){return{'name':_0x1992a2[_0x3e4d('0x2c')],'type':_0x1992a2[_0x3e4d('0x24')][_0x3e4d('0x2d')]};});_0x1a36ff[_0x3e4d('0x2e')]=_[_0x3e4d('0x20')](_0x542777,_0x3e4d('0x28'));_0x1a36ff['query']=_[_0x3e4d('0x2f')](_0x32604d['query']);_0x1a36ff[_0x3e4d('0x30')]=_['intersection'](_0x1a36ff['model'],_0x1a36ff['query']);_0x550648[_0x3e4d('0x31')]=_[_0x3e4d('0x32')](_0x1a36ff[_0x3e4d('0x2e')],qs[_0x3e4d('0x33')](_0x32604d['query'][_0x3e4d('0x33')]));_0x550648[_0x3e4d('0x31')]=_0x550648['attributes'][_0x3e4d('0x34')]?_0x550648[_0x3e4d('0x31')]:_0x1a36ff['model'];if(!_0x32604d[_0x3e4d('0x35')][_0x3e4d('0x36')](_0x3e4d('0x37'))){_0x550648[_0x3e4d('0x13')]=qs[_0x3e4d('0x13')](_0x32604d[_0x3e4d('0x35')]['limit']);_0x550648[_0x3e4d('0x11')]=qs['offset'](_0x32604d['query']['offset']);}_0x550648['order']=qs[_0x3e4d('0x38')](_0x32604d['query'][_0x3e4d('0x38')]);_0x550648['where']=qs[_0x3e4d('0x30')](_[_0x3e4d('0x39')](_0x32604d[_0x3e4d('0x35')],_0x1a36ff['filters']),_0x542777);if(_0x32604d[_0x3e4d('0x35')][_0x3e4d('0x1e')]){_0x550648[_0x3e4d('0x3a')]=_[_0x3e4d('0x3b')](_0x550648[_0x3e4d('0x3a')],{'$or':_[_0x3e4d('0x20')](_0x542777,function(_0x127dec){if(_0x127dec[_0x3e4d('0x24')]!==_0x3e4d('0x3c')){var _0x1aac15={};_0x1aac15[_0x127dec['name']]={'$like':'%'+_0x32604d[_0x3e4d('0x35')][_0x3e4d('0x1e')]+'%'};return _0x1aac15;}})});}_0x550648=_[_0x3e4d('0x3b')]({},_0x550648,_0x32604d[_0x3e4d('0x3d')]);var _0x2a7989={'where':_0x550648['where']};return db[_0x3e4d('0x3e')][_0x3e4d('0x14')](_0x2a7989)[_0x3e4d('0x18')](function(_0x1f1457){_0x1aece7[_0x3e4d('0x14')]=_0x1f1457;if(_0x32604d['query'][_0x3e4d('0x3f')]){_0x550648[_0x3e4d('0x40')]=[{'all':!![]}];}return db[_0x3e4d('0x3e')]['findAll'](_0x550648);})[_0x3e4d('0x18')](function(_0x2f152c){_0x1aece7[_0x3e4d('0x41')]=_0x2f152c;return _0x1aece7;})['then'](respondWithFilteredResult(_0x224e32,_0x550648))[_0x3e4d('0x42')](handleError(_0x224e32,null));};exports[_0x3e4d('0x43')]=function(_0x40f090,_0x5d62b4){var _0x4900c7={'raw':![],'where':{'id':_0x40f090[_0x3e4d('0x44')]['id']}},_0x5924a0={};_0x5924a0[_0x3e4d('0x2e')]=_[_0x3e4d('0x2f')](db[_0x3e4d('0x3e')][_0x3e4d('0x2b')]);_0x5924a0[_0x3e4d('0x35')]=_[_0x3e4d('0x2f')](_0x40f090[_0x3e4d('0x35')]);_0x5924a0['filters']=_[_0x3e4d('0x32')](_0x5924a0[_0x3e4d('0x2e')],_0x5924a0[_0x3e4d('0x35')]);_0x4900c7['attributes']=_[_0x3e4d('0x32')](_0x5924a0[_0x3e4d('0x2e')],qs[_0x3e4d('0x33')](_0x40f090['query'][_0x3e4d('0x33')]));_0x4900c7['attributes']=_0x4900c7['attributes'][_0x3e4d('0x34')]?_0x4900c7[_0x3e4d('0x31')]:_0x5924a0['model'];if(_0x40f090[_0x3e4d('0x35')][_0x3e4d('0x3f')]){_0x4900c7[_0x3e4d('0x40')]=[{'all':!![]}];}_0x4900c7=_['merge']({},_0x4900c7,_0x40f090['options']);return db['VoiceExtension'][_0x3e4d('0x23')](_0x4900c7)['then'](handleEntityNotFound(_0x5d62b4,null))[_0x3e4d('0x18')](respondWithResult(_0x5d62b4,null))[_0x3e4d('0x42')](handleError(_0x5d62b4,null));};exports[_0x3e4d('0x17')]=function(_0x13f4a,_0xc82f9d){return db[_0x3e4d('0x3e')][_0x3e4d('0x23')]({'where':{'id':_0x13f4a['params']['id']}})['then'](handleEntityNotFound(_0xc82f9d,null))['then'](removeEntity(_0xc82f9d,null))['catch'](handleError(_0xc82f9d,null));};exports[_0x3e4d('0x45')]=function(_0x1ad7a8,_0x50a1e7){if(_0x1ad7a8[_0x3e4d('0x46')][_0x3e4d('0x24')]===_0x3e4d('0x47')&&!_[_0x3e4d('0x48')](_0x1ad7a8[_0x3e4d('0x46')]['exten'],'_')){_0x1ad7a8[_0x3e4d('0x46')]['exten']='_'[_0x3e4d('0x49')](_0x1ad7a8['body'][_0x3e4d('0x4a')]);}return db[_0x3e4d('0x3e')][_0x3e4d('0x45')](_0x1ad7a8[_0x3e4d('0x46')],{'raw':![]})[_0x3e4d('0x18')](function(_0x5f5d53){var _0x4c6e94=_0x1ad7a8[_0x3e4d('0x4b')][_0x3e4d('0x19')]({'plain':!![]});if(!_0x4c6e94)throw new Error(_0x3e4d('0x4c'));if(_0x4c6e94[_0x3e4d('0x4d')]===_0x3e4d('0x4b')){var _0x107dbe=_0x5f5d53[_0x3e4d('0x19')]({'plain':!![]});var _0x337f16=[{'name':'InboundRoutes','value':_0x3e4d('0x1a')},{'name':_0x3e4d('0x1b'),'value':_0x3e4d('0x47')},{'name':_0x3e4d('0x1c'),'value':_0x3e4d('0x1d')}];var _0x42b5bc=_[_0x3e4d('0x23')](_0x337f16,[_0x3e4d('0x21'),_0x107dbe[_0x3e4d('0x24')]])[_0x3e4d('0x28')];return db[_0x3e4d('0x4e')][_0x3e4d('0x23')]({'where':{'name':_0x42b5bc,'userProfileId':_0x4c6e94[_0x3e4d('0x4f')]},'raw':!![]})[_0x3e4d('0x18')](function(_0x271462){if(_0x271462&&_0x271462['autoAssociation']===0x0){return db['UserProfileResource'][_0x3e4d('0x45')]({'name':_0x107dbe[_0x3e4d('0x28')],'resourceId':_0x107dbe['id'],'type':_0x271462[_0x3e4d('0x28')],'sectionId':_0x271462['id']},{})[_0x3e4d('0x18')](function(){return _0x5f5d53;});}else{return _0x5f5d53;}})[_0x3e4d('0x42')](function(_0x3299df){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3299df);throw _0x3299df;});}return _0x5f5d53;})['then'](respondWithResult(_0x50a1e7,0xc9))[_0x3e4d('0x42')](handleError(_0x50a1e7,null));};exports['update']=function(_0x2e7297,_0x78580b){if(_0x2e7297[_0x3e4d('0x46')]['id']){delete _0x2e7297[_0x3e4d('0x46')]['id'];}return db[_0x3e4d('0x3e')][_0x3e4d('0x23')]({'where':{'id':_0x2e7297['params']['id']}})[_0x3e4d('0x18')](handleEntityNotFound(_0x78580b,null))[_0x3e4d('0x18')](function(_0xf54139){if(_0xf54139){return db[_0x3e4d('0x3e')]['update'](_['pick'](_0x2e7297[_0x3e4d('0x46')],[_0x3e4d('0x4a'),_0x3e4d('0x50'),_0x3e4d('0x51'),_0x3e4d('0x52'),_0x3e4d('0x53'),_0x3e4d('0x54'),'alias']),{'where':{'context':_0xf54139[_0x3e4d('0x50')],'exten':_0xf54139[_0x3e4d('0x4a')]},'individualHooks':!![]})['then'](function(_0x48c3c9){return _0x48c3c9;});}return null;})[_0x3e4d('0x18')](respondWithStatusCode(_0x78580b,null))['catch'](handleError(_0x78580b,null));};exports['addApplications']=function(_0x22af2d,_0x209580){var _0x42ce95=_0x22af2d[_0x3e4d('0x44')]['id'];var _0x2bb571=_0x22af2d[_0x3e4d('0x46')];var _0x3db272=0xc8;var _0x3a97a0=null;return db[_0x3e4d('0x55')][_0x3e4d('0x56')]({'isolationLevel':db[_0x3e4d('0x55')][_0x3e4d('0x57')][_0x3e4d('0x58')][_0x3e4d('0x59')]},function(_0x303758){return db[_0x3e4d('0x3e')][_0x3e4d('0x5a')]({'where':{'id':_0x42ce95},'transaction':_0x303758})[_0x3e4d('0x18')](function(_0x3c3e28){if(_0x3c3e28){return db[_0x3e4d('0x3e')][_0x3e4d('0x17')]({'where':{'VoiceExtensionId':_0x42ce95},'transaction':_0x303758})['then'](function(){var _0x4011ce=_['map'](_0x2bb571,function(_0x1242fe){_0x1242fe[_0x3e4d('0x5b')]=_0x42ce95;_0x1242fe['isApp']=!![];return _0x1242fe;});return _0x3c3e28[_0x3e4d('0x5c')](_0x4011ce);})[_0x3e4d('0x18')](function(_0x191286){return db[_0x3e4d('0x3e')][_0x3e4d('0x5d')](_0x191286,{'transaction':_0x303758});});}else{_0x3db272=0x194;_0x3a97a0=[];}});})[_0x3e4d('0x18')](function(){if(_0x3db272!==0x194){return db[_0x3e4d('0x3e')][_0x3e4d('0x5e')]({'where':{'isApp':!![],'VoiceExtensionId':_0x42ce95},'order':_0x3e4d('0x5f')})[_0x3e4d('0x18')](function(_0x259b2d){_0x3a97a0=_0x259b2d;});}})[_0x3e4d('0x42')](function(_0x524d9b){_0x3db272=0x1f4;logger[_0x3e4d('0x26')](_0x524d9b[_0x3e4d('0x27')]);if(_0x524d9b[_0x3e4d('0x28')]){delete _0x524d9b[_0x3e4d('0x28')];}_0x3a97a0=_0x524d9b;})[_0x3e4d('0x60')](function(){if(_0x3a97a0===null){_0x209580[_0x3e4d('0xd')](_0x3db272);}else{if(_0x3db272===0x1f4){_0x209580[_0x3e4d('0xe')](_0x3db272)[_0x3e4d('0x29')](_0x3a97a0);}else{_0x209580[_0x3e4d('0xe')](_0x3db272)[_0x3e4d('0x10')](_0x3a97a0);}}});}; \ No newline at end of file +var _0xd0b2=['description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','finally','json','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','status','end','offset','undefined','limit','count','set','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','internal','filter','ignore','map','value','includes','find','type','name','UserProfileResource','sendStatus','error','stack','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','VoiceExtension','includeAll','findAll','rows','catch','params','keys','body','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context'];(function(_0x1ed511,_0x5bd8f0){var _0x32ab7b=function(_0x46066e){while(--_0x46066e){_0x1ed511['push'](_0x1ed511['shift']());}};_0x32ab7b(++_0x5bd8f0);}(_0xd0b2,0x1dc));var _0x2d0b=function(_0x4635a8,_0x2ce802){_0x4635a8=_0x4635a8-0x0;var _0x5842f8=_0xd0b2[_0x4635a8];return _0x5842f8;};'use strict';var _=require('lodash');var Redis=require(_0x2d0b('0x0'));var qs=require(_0x2d0b('0x1'));var logger=require(_0x2d0b('0x2'))(_0x2d0b('0x3'));var config=require(_0x2d0b('0x4'));var db=require(_0x2d0b('0x5'))['db'];config[_0x2d0b('0x6')]=_[_0x2d0b('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2d0b('0x8'))(new Redis(config[_0x2d0b('0x6')]));require('./voiceExtension.socket')[_0x2d0b('0x9')](socket);function respondWithStatusCode(_0x489474,_0x1fa541){_0x1fa541=_0x1fa541||0xcc;return function(_0x5c0d3e){if(_0x5c0d3e){return _0x489474['sendStatus'](_0x1fa541);}return _0x489474[_0x2d0b('0xa')](_0x1fa541)[_0x2d0b('0xb')]();};}function respondWithResult(_0x490a80,_0x9ee85b){_0x9ee85b=_0x9ee85b||0xc8;return function(_0x34f432){if(_0x34f432){return _0x490a80[_0x2d0b('0xa')](_0x9ee85b)['json'](_0x34f432);}};}function respondWithFilteredResult(_0x3113bf,_0x342f1d){return function(_0x3647c4){if(_0x3647c4){var _0x39abc1=typeof _0x342f1d[_0x2d0b('0xc')]===_0x2d0b('0xd')&&typeof _0x342f1d[_0x2d0b('0xe')]===_0x2d0b('0xd');var _0x568cf4=_0x3647c4[_0x2d0b('0xf')];var _0x392531=_0x39abc1?0x0:_0x342f1d['offset'];var _0xff706b=_0x39abc1?_0x3647c4[_0x2d0b('0xf')]:_0x342f1d['offset']+_0x342f1d['limit'];var _0x526680;if(_0xff706b>=_0x568cf4){_0xff706b=_0x568cf4;_0x526680=0xc8;}else{_0x526680=0xce;}_0x3113bf[_0x2d0b('0xa')](_0x526680);return _0x3113bf[_0x2d0b('0x10')](_0x2d0b('0x11'),_0x392531+'-'+_0xff706b+'/'+_0x568cf4)['json'](_0x3647c4);}return null;};}function removeEntity(_0xa131db){return function(_0x475527){if(_0x475527){return _0x475527[_0x2d0b('0x12')]()[_0x2d0b('0x13')](function(){var _0x464028=_0x475527[_0x2d0b('0x14')]({'plain':!![]});var _0x1df616=[{'name':_0x2d0b('0x15'),'value':_0x2d0b('0x16'),'ignore':![]},{'name':_0x2d0b('0x17'),'value':_0x2d0b('0x18'),'ignore':![]},{'name':'InternalRoutes','value':_0x2d0b('0x19'),'ignore':![]}];var _0x1a298f=_(_0x1df616)[_0x2d0b('0x1a')](_0x2d0b('0x1b'))[_0x2d0b('0x1c')]('value')[_0x2d0b('0x1d')]();if(_[_0x2d0b('0x1e')](_0x1a298f,_0x464028['type'])){return;}var _0xe6a134=_[_0x2d0b('0x1f')](_0x1df616,[_0x2d0b('0x1d'),_0x464028[_0x2d0b('0x20')]])[_0x2d0b('0x21')];return db[_0x2d0b('0x22')][_0x2d0b('0x12')]({'where':{'type':_0xe6a134,'resourceId':_0x464028['id']}})[_0x2d0b('0x13')](function(){return _0x475527;});})['then'](function(){_0xa131db[_0x2d0b('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0xeb622d){return function(_0x1816d8){if(!_0x1816d8){_0xeb622d[_0x2d0b('0x23')](0x194);}return _0x1816d8;};}function handleError(_0x586b9b,_0x4a338d){_0x4a338d=_0x4a338d||0x1f4;return function(_0x292f7f){logger[_0x2d0b('0x24')](_0x292f7f[_0x2d0b('0x25')]);if(_0x292f7f[_0x2d0b('0x21')]){delete _0x292f7f[_0x2d0b('0x21')];}_0x586b9b[_0x2d0b('0xa')](_0x4a338d)[_0x2d0b('0x26')](_0x292f7f);};}exports[_0x2d0b('0x27')]=function(_0x28e9f2,_0x17493b){var _0x1a0e1b={},_0x51da92={},_0x5f29db={'count':0x0,'rows':[]};var _0xd7d1ed=_['map'](db['VoiceExtension'][_0x2d0b('0x28')],function(_0x1fddb6){return{'name':_0x1fddb6[_0x2d0b('0x29')],'type':_0x1fddb6[_0x2d0b('0x20')][_0x2d0b('0x2a')]};});_0x51da92[_0x2d0b('0x2b')]=_[_0x2d0b('0x1c')](_0xd7d1ed,'name');_0x51da92[_0x2d0b('0x2c')]=_['keys'](_0x28e9f2[_0x2d0b('0x2c')]);_0x51da92[_0x2d0b('0x2d')]=_[_0x2d0b('0x2e')](_0x51da92['model'],_0x51da92['query']);_0x1a0e1b[_0x2d0b('0x2f')]=_[_0x2d0b('0x2e')](_0x51da92[_0x2d0b('0x2b')],qs[_0x2d0b('0x30')](_0x28e9f2[_0x2d0b('0x2c')]['fields']));_0x1a0e1b[_0x2d0b('0x2f')]=_0x1a0e1b[_0x2d0b('0x2f')][_0x2d0b('0x31')]?_0x1a0e1b[_0x2d0b('0x2f')]:_0x51da92[_0x2d0b('0x2b')];if(!_0x28e9f2[_0x2d0b('0x2c')]['hasOwnProperty'](_0x2d0b('0x32'))){_0x1a0e1b[_0x2d0b('0xe')]=qs[_0x2d0b('0xe')](_0x28e9f2['query'][_0x2d0b('0xe')]);_0x1a0e1b['offset']=qs[_0x2d0b('0xc')](_0x28e9f2[_0x2d0b('0x2c')][_0x2d0b('0xc')]);}_0x1a0e1b['order']=qs['sort'](_0x28e9f2[_0x2d0b('0x2c')][_0x2d0b('0x33')]);_0x1a0e1b[_0x2d0b('0x34')]=qs['filters'](_[_0x2d0b('0x35')](_0x28e9f2[_0x2d0b('0x2c')],_0x51da92[_0x2d0b('0x2d')]),_0xd7d1ed);if(_0x28e9f2[_0x2d0b('0x2c')][_0x2d0b('0x1a')]){_0x1a0e1b[_0x2d0b('0x34')]=_[_0x2d0b('0x36')](_0x1a0e1b['where'],{'$or':_['map'](_0xd7d1ed,function(_0x46ac40){if(_0x46ac40[_0x2d0b('0x20')]!==_0x2d0b('0x37')){var _0xc7f1b7={};_0xc7f1b7[_0x46ac40['name']]={'$like':'%'+_0x28e9f2[_0x2d0b('0x2c')][_0x2d0b('0x1a')]+'%'};return _0xc7f1b7;}})});}_0x1a0e1b=_['merge']({},_0x1a0e1b,_0x28e9f2['options']);var _0x3e715f={'where':_0x1a0e1b[_0x2d0b('0x34')]};return db[_0x2d0b('0x38')][_0x2d0b('0xf')](_0x3e715f)[_0x2d0b('0x13')](function(_0x2024b7){_0x5f29db[_0x2d0b('0xf')]=_0x2024b7;if(_0x28e9f2['query'][_0x2d0b('0x39')]){_0x1a0e1b['include']=[{'all':!![]}];}return db[_0x2d0b('0x38')][_0x2d0b('0x3a')](_0x1a0e1b);})[_0x2d0b('0x13')](function(_0x400996){_0x5f29db[_0x2d0b('0x3b')]=_0x400996;return _0x5f29db;})[_0x2d0b('0x13')](respondWithFilteredResult(_0x17493b,_0x1a0e1b))[_0x2d0b('0x3c')](handleError(_0x17493b,null));};exports['show']=function(_0x2b1388,_0x51732c){var _0x27d5e0={'raw':![],'where':{'id':_0x2b1388[_0x2d0b('0x3d')]['id']}},_0x100319={};_0x100319[_0x2d0b('0x2b')]=_[_0x2d0b('0x3e')](db['VoiceExtension'][_0x2d0b('0x28')]);_0x100319['query']=_[_0x2d0b('0x3e')](_0x2b1388[_0x2d0b('0x2c')]);_0x100319[_0x2d0b('0x2d')]=_[_0x2d0b('0x2e')](_0x100319[_0x2d0b('0x2b')],_0x100319['query']);_0x27d5e0[_0x2d0b('0x2f')]=_[_0x2d0b('0x2e')](_0x100319['model'],qs[_0x2d0b('0x30')](_0x2b1388[_0x2d0b('0x2c')][_0x2d0b('0x30')]));_0x27d5e0['attributes']=_0x27d5e0[_0x2d0b('0x2f')][_0x2d0b('0x31')]?_0x27d5e0['attributes']:_0x100319[_0x2d0b('0x2b')];if(_0x2b1388[_0x2d0b('0x2c')][_0x2d0b('0x39')]){_0x27d5e0['include']=[{'all':!![]}];}_0x27d5e0=_[_0x2d0b('0x36')]({},_0x27d5e0,_0x2b1388['options']);return db[_0x2d0b('0x38')][_0x2d0b('0x1f')](_0x27d5e0)[_0x2d0b('0x13')](handleEntityNotFound(_0x51732c,null))[_0x2d0b('0x13')](respondWithResult(_0x51732c,null))[_0x2d0b('0x3c')](handleError(_0x51732c,null));};exports[_0x2d0b('0x12')]=function(_0xb349aa,_0x10273b){return db[_0x2d0b('0x38')][_0x2d0b('0x1f')]({'where':{'id':_0xb349aa[_0x2d0b('0x3d')]['id']}})[_0x2d0b('0x13')](handleEntityNotFound(_0x10273b,null))['then'](removeEntity(_0x10273b,null))[_0x2d0b('0x3c')](handleError(_0x10273b,null));};exports['create']=function(_0x345730,_0x1e9d87){if(_0x345730[_0x2d0b('0x3f')][_0x2d0b('0x20')]==='outbound'&&!_[_0x2d0b('0x40')](_0x345730[_0x2d0b('0x3f')][_0x2d0b('0x41')],'_')){_0x345730[_0x2d0b('0x3f')]['exten']='_'[_0x2d0b('0x42')](_0x345730[_0x2d0b('0x3f')][_0x2d0b('0x41')]);}return db[_0x2d0b('0x38')]['create'](_0x345730['body'],{'raw':![]})['then'](function(_0x2c6735){var _0xf8541d=_0x345730['user']['get']({'plain':!![]});if(!_0xf8541d)throw new Error(_0x2d0b('0x43'));if(_0xf8541d['role']===_0x2d0b('0x44')){var _0x55809a=_0x2c6735['get']({'plain':!![]});var _0x1ea101=[{'name':'InboundRoutes','value':_0x2d0b('0x16')},{'name':_0x2d0b('0x17'),'value':_0x2d0b('0x18')},{'name':'InternalRoutes','value':_0x2d0b('0x19')}];var _0x4da238=_[_0x2d0b('0x1f')](_0x1ea101,[_0x2d0b('0x1d'),_0x55809a[_0x2d0b('0x20')]])[_0x2d0b('0x21')];return db[_0x2d0b('0x45')][_0x2d0b('0x1f')]({'where':{'name':_0x4da238,'userProfileId':_0xf8541d[_0x2d0b('0x46')]},'raw':!![]})[_0x2d0b('0x13')](function(_0x50b1ac){if(_0x50b1ac&&_0x50b1ac[_0x2d0b('0x47')]===0x0){return db[_0x2d0b('0x22')][_0x2d0b('0x48')]({'name':_0x55809a[_0x2d0b('0x21')],'resourceId':_0x55809a['id'],'type':_0x50b1ac[_0x2d0b('0x21')],'sectionId':_0x50b1ac['id']},{})[_0x2d0b('0x13')](function(){return _0x2c6735;});}else{return _0x2c6735;}})['catch'](function(_0x3210c7){logger[_0x2d0b('0x24')](_0x2d0b('0x49'),_0x3210c7);throw _0x3210c7;});}return _0x2c6735;})['then'](respondWithResult(_0x1e9d87,0xc9))[_0x2d0b('0x3c')](handleError(_0x1e9d87,null));};exports[_0x2d0b('0x4a')]=function(_0x3fe6a4,_0x588e34){if(_0x3fe6a4[_0x2d0b('0x3f')]['id']){delete _0x3fe6a4[_0x2d0b('0x3f')]['id'];}return db[_0x2d0b('0x38')][_0x2d0b('0x1f')]({'where':{'id':_0x3fe6a4[_0x2d0b('0x3d')]['id']}})[_0x2d0b('0x13')](handleEntityNotFound(_0x588e34,null))[_0x2d0b('0x13')](function(_0x5403fc){if(_0x5403fc){return db[_0x2d0b('0x38')][_0x2d0b('0x4a')](_['pick'](_0x3fe6a4[_0x2d0b('0x3f')],[_0x2d0b('0x41'),_0x2d0b('0x4b'),_0x2d0b('0x4c'),_0x2d0b('0x4d'),_0x2d0b('0x4e'),_0x2d0b('0x4f'),_0x2d0b('0x50')]),{'where':{'context':_0x5403fc[_0x2d0b('0x4b')],'exten':_0x5403fc[_0x2d0b('0x41')]},'individualHooks':!![]})[_0x2d0b('0x13')](function(_0x527f29){return _0x527f29;});}return null;})[_0x2d0b('0x13')](respondWithStatusCode(_0x588e34,null))[_0x2d0b('0x3c')](handleError(_0x588e34,null));};exports[_0x2d0b('0x51')]=function(_0x2a60e4,_0x570047){var _0x4ba388=_0x2a60e4[_0x2d0b('0x3d')]['id'];var _0x5e7faa=_0x2a60e4[_0x2d0b('0x3f')];var _0x3e17f5=0xc8;var _0x4cd18b=null;return db[_0x2d0b('0x52')][_0x2d0b('0x53')]({'isolationLevel':db[_0x2d0b('0x52')][_0x2d0b('0x54')]['ISOLATION_LEVELS'][_0x2d0b('0x55')]},function(_0x5e0a9b){return db[_0x2d0b('0x38')]['findOne']({'where':{'id':_0x4ba388},'transaction':_0x5e0a9b})[_0x2d0b('0x13')](function(_0x4e3676){if(_0x4e3676){return db[_0x2d0b('0x38')]['destroy']({'where':{'VoiceExtensionId':_0x4ba388},'transaction':_0x5e0a9b})[_0x2d0b('0x13')](function(){var _0x580b61=_[_0x2d0b('0x1c')](_0x5e7faa,function(_0x17975f){_0x17975f[_0x2d0b('0x56')]=_0x4ba388;_0x17975f[_0x2d0b('0x57')]=!![];return _0x17975f;});return _0x4e3676['createRouting'](_0x580b61);})[_0x2d0b('0x13')](function(_0xc0d902){return db[_0x2d0b('0x38')][_0x2d0b('0x58')](_0xc0d902,{'transaction':_0x5e0a9b});});}else{_0x3e17f5=0x194;_0x4cd18b=[];}});})['then'](function(){if(_0x3e17f5!==0x194){return db[_0x2d0b('0x38')][_0x2d0b('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4ba388},'order':'priority'})[_0x2d0b('0x13')](function(_0x3a4940){_0x4cd18b=_0x3a4940;});}})[_0x2d0b('0x3c')](function(_0x1f7d42){_0x3e17f5=0x1f4;logger[_0x2d0b('0x24')](_0x1f7d42[_0x2d0b('0x25')]);if(_0x1f7d42[_0x2d0b('0x21')]){delete _0x1f7d42['name'];}_0x4cd18b=_0x1f7d42;})[_0x2d0b('0x5a')](function(){if(_0x4cd18b===null){_0x570047[_0x2d0b('0x23')](_0x3e17f5);}else{if(_0x3e17f5===0x1f4){_0x570047[_0x2d0b('0xa')](_0x3e17f5)[_0x2d0b('0x26')](_0x4cd18b);}else{_0x570047[_0x2d0b('0xa')](_0x3e17f5)[_0x2d0b('0x5b')](_0x4cd18b);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index fdd6da8..49eda3c 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 _0xea36=['../../mysqldb','VoiceExtension','setMaxListeners','save','remove','hasOwnProperty','hook','exports'];(function(_0x58175c,_0x2d9373){var _0x55b88f=function(_0x13ed84){while(--_0x13ed84){_0x58175c['push'](_0x58175c['shift']());}};_0x55b88f(++_0x2d9373);}(_0xea36,0x68));var _0x6ea3=function(_0x5bd50d,_0x4e4624){_0x5bd50d=_0x5bd50d-0x0;var _0x1508b6=_0xea36[_0x5bd50d];return _0x1508b6;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x6ea3('0x0'))['db'][_0x6ea3('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x6ea3('0x2')](0x0);var events={'afterCreate':_0x6ea3('0x3'),'afterUpdate':'update','afterDestroy':_0x6ea3('0x4')};function emitEvent(_0x55e886){return function(_0x26bd69,_0x4c6b70,_0x7d7dbf){VoiceExtensionEvents['emit'](_0x55e886+':'+_0x26bd69['id'],_0x26bd69);VoiceExtensionEvents['emit'](_0x55e886,_0x26bd69);_0x7d7dbf(null);};}for(var e in events){if(events[_0x6ea3('0x5')](e)){var event=events[e];VoiceExtension[_0x6ea3('0x6')](e,emitEvent(event));}}module[_0x6ea3('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x75df=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','save','update'];(function(_0x5864d2,_0x42a789){var _0x410a6f=function(_0x171e64){while(--_0x171e64){_0x5864d2['push'](_0x5864d2['shift']());}};_0x410a6f(++_0x42a789);}(_0x75df,0x69));var _0xf75d=function(_0x2316ac,_0xe72784){_0x2316ac=_0x2316ac-0x0;var _0x4409fb=_0x75df[_0x2316ac];return _0x4409fb;};'use strict';var EventEmitter=require(_0xf75d('0x0'));var VoiceExtension=require(_0xf75d('0x1'))['db'][_0xf75d('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf75d('0x3'),'afterUpdate':_0xf75d('0x4'),'afterDestroy':_0xf75d('0x5')};function emitEvent(_0x4c102d){return function(_0x9f092d,_0x4e8d22,_0x5328ba){VoiceExtensionEvents[_0xf75d('0x6')](_0x4c102d+':'+_0x9f092d['id'],_0x9f092d);VoiceExtensionEvents['emit'](_0x4c102d,_0x9f092d);_0x5328ba(null);};}for(var e in events){if(events[_0xf75d('0x7')](e)){var event=events[e];VoiceExtension[_0xf75d('0x8')](e,emitEvent(event));}}module[_0xf75d('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index b4c81de..80e5622 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 _0x9b69=['models','Set','type','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','url','split','name','trunk','param','phone','prefix','SIP','options','U(xcally-mixmonitor-context)','replace','join','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','tag','toLowerCase','CDR(tag)=','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','playback','includes','app','appType','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','GotoIfTime',',${EXTEN},','outboundDial','appdata','last','concat','priority','catch','get','Hangup','lodash','./voiceExtension.attributes','exports'];(function(_0x5235a7,_0x3a065b){var _0x463bbf=function(_0x5934bc){while(--_0x5934bc){_0x5235a7['push'](_0x5235a7['shift']());}};_0x463bbf(++_0x3a065b);}(_0x9b69,0xa3));var _0x99b6=function(_0x2eb177,_0x1aa1a9){_0x2eb177=_0x2eb177-0x0;var _0x3a135e=_0x9b69[_0x2eb177];return _0x3a135e;};'use strict';var _=require(_0x99b6('0x0'));var attributes=require(_0x99b6('0x1'));module[_0x99b6('0x2')]=function(_0x47c0a9){var _0x4d20c1=_0x47c0a9[_0x99b6('0x3')];function _0x5608e8(_0x2d5904){var _0x3a05b4=0x2;var _0x293e09=[{'type':_0x2d5904['type'],'app':_0x99b6('0x4'),'appdata':'CDR(type)='+_0x2d5904[_0x99b6('0x5')],'context':_0x2d5904[_0x99b6('0x6')],'exten':_0x2d5904[_0x99b6('0x7')],'priority':_0x3a05b4++,'VoiceExtensionId':_0x2d5904['id']},{'type':_0x2d5904[_0x99b6('0x5')],'app':_0x2d5904[_0x99b6('0x8')]?_0x99b6('0x4'):_0x99b6('0x9'),'appdata':_0x2d5904[_0x99b6('0x8')]?_0x99b6('0xa')+_0x2d5904[_0x99b6('0x8')]:_0x99b6('0xb'),'context':_0x2d5904[_0x99b6('0x6')],'exten':_0x2d5904[_0x99b6('0x7')],'priority':_0x3a05b4++,'VoiceExtensionId':_0x2d5904['id']}];if(_0x2d5904[_0x99b6('0x5')]===_0x99b6('0xc')){_0x293e09[_0x99b6('0xd')]({'type':_0x99b6('0xc'),'app':_0x99b6('0x4'),'appdata':_0x99b6('0xe')+_0x2d5904['id'],'context':_0x2d5904[_0x99b6('0x6')],'exten':_0x2d5904['exten'],'priority':_0x3a05b4++,'VoiceExtensionId':_0x2d5904['id']});}_0x293e09['push']({'type':_0x2d5904['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x2d5904['context'],'exten':_0x2d5904['exten'],'priority':_0x3a05b4++,'VoiceExtensionId':_0x2d5904['id']},{'type':_0x2d5904[_0x99b6('0x5')],'app':_0x99b6('0x4'),'appdata':_0x99b6('0xf'),'context':_0x2d5904['context'],'exten':_0x2d5904[_0x99b6('0x7')],'priority':_0x3a05b4++,'VoiceExtensionId':_0x2d5904['id']},{'type':_0x2d5904[_0x99b6('0x5')],'app':_0x99b6('0x4'),'appdata':_0x99b6('0x10'),'context':_0x2d5904['context'],'exten':_0x2d5904[_0x99b6('0x7')],'priority':_0x3a05b4++,'VoiceExtensionId':_0x2d5904['id']});return _0x293e09;}function _0x52a4da(_0x70650){var _0x2a2bf2=0x2;var _0x453735=[{'type':_0x99b6('0x11'),'app':_0x99b6('0x4'),'appdata':_0x99b6('0x12'),'context':_0x70650[_0x99b6('0x6')],'exten':_0x70650['exten'],'priority':_0x2a2bf2++,'VoiceExtensionId':_0x70650['id']},{'type':_0x99b6('0x11'),'app':_0x70650[_0x99b6('0x8')]?_0x99b6('0x4'):_0x99b6('0x9'),'appdata':_0x70650[_0x99b6('0x8')]?_0x99b6('0xa')+_0x70650[_0x99b6('0x8')]:'No\x20alias\x20set','context':_0x70650['context'],'exten':_0x70650[_0x99b6('0x7')],'priority':_0x2a2bf2++,'VoiceExtensionId':_0x70650['id']},{'type':_0x99b6('0x11'),'app':_0x99b6('0x4'),'appdata':_0x99b6('0x13')+(_0x70650['cutdigits']?_0x99b6('0x14')+_0x70650[_0x99b6('0x15')]+'}':_0x99b6('0x16')),'context':_0x70650[_0x99b6('0x6')],'exten':_0x70650[_0x99b6('0x7')],'priority':_0x2a2bf2++,'VoiceExtensionId':_0x70650['id']},{'type':_0x99b6('0x11'),'app':_0x99b6('0x4'),'appdata':_0x99b6('0xe')+_0x70650['id'],'context':_0x70650[_0x99b6('0x6')],'exten':_0x70650[_0x99b6('0x7')],'priority':_0x2a2bf2++,'VoiceExtensionId':_0x70650['id']},{'type':_0x99b6('0x11'),'app':_0x99b6('0x17'),'appdata':_0x99b6('0x18')+(_0x2a2bf2+0x2)+'):Goto('+(_0x2a2bf2+0x1)+')','context':_0x70650[_0x99b6('0x6')],'exten':_0x70650['exten'],'priority':_0x2a2bf2++,'VoiceExtensionId':_0x70650['id']},{'type':_0x99b6('0x11'),'app':'Set','appdata':_0x70650[_0x99b6('0x15')]?_0x99b6('0x19')+_0x70650['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x70650[_0x99b6('0x6')],'exten':_0x70650[_0x99b6('0x7')],'priority':_0x2a2bf2++,'VoiceExtensionId':_0x70650['id']},{'type':_0x99b6('0x11'),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x70650['context'],'exten':_0x70650['exten'],'priority':_0x2a2bf2++,'VoiceExtensionId':_0x70650['id']},{'type':_0x99b6('0x11'),'app':_0x99b6('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x70650[_0x99b6('0x6')],'exten':_0x70650[_0x99b6('0x7')],'priority':_0x2a2bf2++,'VoiceExtensionId':_0x70650['id']},{'type':_0x99b6('0x11'),'app':_0x99b6('0x4'),'appdata':_0x99b6('0x10'),'context':_0x70650['context'],'exten':_0x70650[_0x99b6('0x7')],'priority':_0x2a2bf2++,'VoiceExtensionId':_0x70650['id']},{'type':_0x99b6('0x11'),'app':_0x99b6('0x4'),'appdata':_0x99b6('0x1a')+_0x70650['id'],'context':_0x70650[_0x99b6('0x6')],'exten':_0x70650['exten'],'priority':_0x2a2bf2++,'VoiceExtensionId':_0x70650['id']}];if(_0x70650[_0x99b6('0x1b')](_0x99b6('0x1c'))&&_0x70650[_0x99b6('0x1c')]!==_0x99b6('0x1d')){_0x453735[_0x99b6('0xd')]({'type':_0x99b6('0x11'),'app':_0x99b6('0x4'),'appdata':_0x99b6('0x1e'),'context':_0x70650['context'],'exten':_0x70650[_0x99b6('0x7')],'priority':_0x2a2bf2++,'VoiceExtensionId':_0x70650['id']},{'type':_0x99b6('0x11'),'app':_0x99b6('0x4'),'appdata':_0x99b6('0x1f')+_0x70650[_0x99b6('0x1c')]||_0x99b6('0x20'),'context':_0x70650[_0x99b6('0x6')],'exten':_0x70650[_0x99b6('0x7')],'priority':_0x2a2bf2++,'VoiceExtensionId':_0x70650['id']});}return _0x453735;}function _0x33c47a(_0x489fee,_0x27c82e){var _0x166924=[{'name':'trunk','param':0x0},{'name':_0x99b6('0x21'),'param':0x1},{'name':'options','param':0x2},{'name':_0x99b6('0x22'),'param':0x3}];var _0x138d77={};var _0x95aad2=_0x27c82e[_0x99b6('0x23')](',');var _0x4e5fb5=[];for(var _0x38ab73=0x0;_0x38ab73<_0x166924['length'];_0x38ab73++){switch(_0x166924[_0x38ab73][_0x99b6('0x24')]){case _0x99b6('0x25'):_0x138d77[_0x99b6('0x25')]=_0x95aad2[_0x166924[_0x38ab73][_0x99b6('0x26')]][_0x99b6('0x23')]('/')[0x1];_0x138d77[_0x99b6('0x27')]=_0x95aad2[_0x166924[_0x38ab73][_0x99b6('0x26')]][_0x99b6('0x23')]('/')[0x2];_0x138d77[_0x99b6('0x28')]=_0x138d77[_0x99b6('0x27')]?_0x138d77[_0x99b6('0x27')][_0x99b6('0x23')]('$')[0x0]:undefined;_0x138d77['phone']=_0x489fee['cutdigits']?(_0x138d77[_0x99b6('0x28')]||'')+_0x99b6('0x14')+_0x489fee[_0x99b6('0x15')]+'}':(_0x138d77[_0x99b6('0x28')]||'')+'${EXTEN}';_0x4e5fb5[_0x166924[_0x38ab73][_0x99b6('0x26')]]=[_0x99b6('0x29'),_0x138d77['trunk'],_0x138d77[_0x99b6('0x27')]]['join']('/');break;case'options':_0x138d77['options']=_0x95aad2[_0x166924[_0x38ab73][_0x99b6('0x26')]];if(_0x489fee['recordingFormat']!==_0x99b6('0x1d')){if(_0x138d77[_0x99b6('0x2a')]['indexOf'](_0x99b6('0x2b'))<0x0){_0x138d77[_0x99b6('0x2a')]+=_0x99b6('0x2b');}}else{_0x138d77[_0x99b6('0x2a')]=_0x138d77[_0x99b6('0x2a')][_0x99b6('0x2c')](_0x99b6('0x2b'),'');}_0x4e5fb5[_0x166924[_0x38ab73][_0x99b6('0x26')]]=_0x138d77[_0x99b6('0x2a')];break;default:_0x4e5fb5[_0x166924[_0x38ab73]['param']]=_0x95aad2[_0x166924[_0x38ab73][_0x99b6('0x26')]];}}return _0x4e5fb5[_0x99b6('0x2d')](',');}function _0x53de34(_0x4a91f8,_0x3a68b8,_0x2f7c51){return new Promise(function(_0x7d48a0,_0xa2a0f4){var _0x305853=[];if(_[_0x99b6('0x2e')](_0x3a68b8))return _0x7d48a0(_0x305853);_0x4d20c1[_0x99b6('0x2f')][_0x99b6('0x30')]({'attributes':['id',_0x99b6('0x31'),_0x99b6('0x32')],'raw':!![]})[_0x99b6('0x33')](function(_0x1f6f8f){for(var _0x397c3b=0x0,_0x5562e8=0x0;_0x397c3b<_0x3a68b8['length'];_0x397c3b++,_0x5562e8=0x0){var _0x465b35=_0x3a68b8[_0x397c3b];var _0x506867=[];var _0x56fbb6=[];delete _0x465b35['id'];if(_0x465b35[_0x99b6('0x31')]!==_0x99b6('0x34')){_0x465b35[_0x99b6('0x35')]=[_0x465b35[_0x99b6('0x31')]];}else{_0x465b35[_0x99b6('0x35')]=_0x465b35[_0x99b6('0x32')]?_[_0x99b6('0x36')](_[_0x99b6('0x37')](_0x1f6f8f,{'IntervalId':_0x465b35['IntervalId']}),'interval'):[];}_0x465b35[_0x99b6('0x6')]=_0x4a91f8[_0x99b6('0x6')];_0x465b35[_0x99b6('0x7')]=_0x4a91f8['exten'];if(_0x465b35['type'])_0x465b35[_0x99b6('0x5')]=_0x465b35[_0x99b6('0x5')]['toLowerCase']();if(_0x4a91f8[_0x99b6('0x5')]==='outbound'){if(_0x465b35[_0x99b6('0x1b')](_0x99b6('0x38'))&&_0x465b35[_0x99b6('0x38')]&&_0x465b35[_0x99b6('0x38')]!=='--'){_0x506867[_0x99b6('0xd')]({'type':_0x465b35[_0x99b6('0x5')][_0x99b6('0x39')](),'app':_0x99b6('0x4'),'appdata':_0x99b6('0x3a')+_0x465b35[_0x99b6('0x38')],'context':_0x4a91f8[_0x99b6('0x6')],'exten':_0x4a91f8['exten'],'priority':_0x465b35[_0x99b6('0x35')][_0x99b6('0x3b')]+_0x2f7c51+_0x5562e8++,'VoiceExtensionId':_0x4a91f8['id']});}_0x506867[_0x99b6('0xd')]({'type':_0x465b35['type'][_0x99b6('0x39')](),'app':_0x99b6('0x17'),'appdata':_0x99b6('0x3c')+(_0x465b35[_0x99b6('0x3d')]?_0x99b6('0x3e')+_0x465b35[_0x99b6('0x3d')]+')':_0x99b6('0x3f')),'context':_0x4a91f8[_0x99b6('0x6')],'exten':_0x4a91f8['exten'],'priority':_0x465b35[_0x99b6('0x35')]['length']+_0x2f7c51+_0x5562e8++,'VoiceExtensionId':_0x4a91f8['id']});}else{if(_0x465b35[_0x99b6('0x1b')]('answer')){if([_0x99b6('0x40'),_0x99b6('0x41')][_0x99b6('0x42')](_0x465b35[_0x99b6('0x43')][_0x99b6('0x39')]())&&_0x465b35[_0x99b6('0x44')]!=='custom'){if(_0x465b35[_0x99b6('0x45')]){_0x506867[_0x99b6('0xd')]({'type':_0x465b35['type'][_0x99b6('0x39')](),'app':_0x99b6('0x17'),'appdata':_0x99b6('0x46'),'context':_0x4a91f8[_0x99b6('0x6')],'exten':_0x4a91f8[_0x99b6('0x7')],'priority':_0x465b35[_0x99b6('0x35')]['length']+_0x2f7c51+_0x5562e8++,'VoiceExtensionId':_0x4a91f8['id']});_0x506867[_0x99b6('0xd')]({'type':_0x465b35[_0x99b6('0x5')][_0x99b6('0x39')](),'app':_0x99b6('0x4'),'appdata':_0x99b6('0x47'),'context':_0x4a91f8[_0x99b6('0x6')],'exten':_0x4a91f8['exten'],'priority':_0x465b35[_0x99b6('0x35')][_0x99b6('0x3b')]+_0x2f7c51+_0x5562e8++,'VoiceExtensionId':_0x4a91f8['id']});}else{_0x506867['push']({'type':_0x465b35[_0x99b6('0x5')][_0x99b6('0x39')](),'app':_0x99b6('0x17'),'appdata':_0x99b6('0x48'),'context':_0x4a91f8[_0x99b6('0x6')],'exten':_0x4a91f8[_0x99b6('0x7')],'priority':_0x465b35[_0x99b6('0x35')]['length']+_0x2f7c51+_0x5562e8++,'VoiceExtensionId':_0x4a91f8['id']});_0x506867[_0x99b6('0xd')]({'type':_0x465b35[_0x99b6('0x5')][_0x99b6('0x39')](),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x4a91f8[_0x99b6('0x6')],'exten':_0x4a91f8[_0x99b6('0x7')],'priority':_0x465b35[_0x99b6('0x35')][_0x99b6('0x3b')]+_0x2f7c51+_0x5562e8++,'VoiceExtensionId':_0x4a91f8['id']});}}}}for(var _0x32946e=0x0;_0x32946e<_0x465b35[_0x99b6('0x35')][_0x99b6('0x3b')];_0x32946e++){var _0x4456cd=_0x2f7c51+_0x465b35['intervals'][_0x99b6('0x3b')];var _0x41d8b4=_0x32946e===_0x465b35[_0x99b6('0x35')]['length']-0x1?_0x2f7c51+_0x506867[_0x99b6('0x3b')]+_0x56fbb6[_0x99b6('0x3b')]+0x2:_0x2f7c51+_0x32946e+0x1;_0x506867['splice'](_0x32946e,0x0,{'type':_0x4a91f8['type'],'app':_0x99b6('0x49'),'appdata':_0x465b35[_0x99b6('0x35')][_0x32946e]+'?'+_0x4a91f8[_0x99b6('0x6')]+_0x99b6('0x4a')+_0x4456cd+':'+_0x4a91f8[_0x99b6('0x6')]+_0x99b6('0x4a')+_0x41d8b4,'exten':_0x4a91f8[_0x99b6('0x7')],'context':_0x4a91f8[_0x99b6('0x6')],'priority':_0x2f7c51+_0x32946e,'VoiceExtensionId':_0x4a91f8['id']});}if(_0x465b35[_0x99b6('0x44')]===_0x99b6('0x4b'))_0x465b35[_0x99b6('0x4c')]=_0x33c47a(_0x4a91f8,_0x465b35[_0x99b6('0x4c')]);_0x465b35['priority']=_0x506867[_0x99b6('0x3b')]?_[_0x99b6('0x4d')](_0x506867)['priority']+0x1:_0x2f7c51;_0x305853=_[_0x99b6('0x4e')](_0x305853,_0x506867,[_0x465b35],_0x56fbb6);_0x2f7c51=_['last'](_0x305853)[_0x99b6('0x4f')]+0x1;}return _0x7d48a0(_0x305853);})[_0x99b6('0x50')](function(_0x99967e){_0xa2a0f4(_0x99967e);});});}return _0x47c0a9['define']('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x454875){var _0x1b99c7=this[_0x99b6('0x51')]({'plain':!![]});var _0x13ad6a=_0x1b99c7[_0x99b6('0x5')]===_0x99b6('0x11')?_0x52a4da(_0x1b99c7):_0x5608e8(_0x1b99c7);return _0x53de34(_0x1b99c7,_0x454875,_[_0x99b6('0x4d')](_0x13ad6a)['priority']+0x1)[_0x99b6('0x33')](function(_0x56671b){var _0x4ff7a1=_[_0x99b6('0x4e')](_0x13ad6a,_0x56671b);_0x4ff7a1[_0x99b6('0xd')]({'type':_0x1b99c7[_0x99b6('0x5')],'app':_0x99b6('0x52'),'exten':_0x1b99c7[_0x99b6('0x7')],'context':_0x1b99c7[_0x99b6('0x6')],'priority':_[_0x99b6('0x4d')](_0x4ff7a1)[_0x99b6('0x4f')]+0x1,'VoiceExtensionId':_0x1b99c7['id']});return _0x4ff7a1;});}}});}; \ No newline at end of file +var _0xa049=['CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','length','param','phone','prefix','${EXTEN:','join','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval','then','IntervalId','map','filter','tag','toLowerCase','CDR(tag)=','intervals','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','queue','playback','includes','app','appType','custom','answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','last','priority','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','models','type','Set','context','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','):Goto('];(function(_0x4e62ed,_0x3ba0c0){var _0x528c21=function(_0x213b48){while(--_0x213b48){_0x4e62ed['push'](_0x4e62ed['shift']());}};_0x528c21(++_0x3ba0c0);}(_0xa049,0x1db));var _0x9a04=function(_0x4c378e,_0x286afb){_0x4c378e=_0x4c378e-0x0;var _0xf41ce7=_0xa049[_0x4c378e];return _0xf41ce7;};'use strict';var _=require(_0x9a04('0x0'));var attributes=require(_0x9a04('0x1'));module['exports']=function(_0x1eb6ef){var _0x2f791e=_0x1eb6ef[_0x9a04('0x2')];function _0x3c975d(_0x3d2f24){var _0x2ced45=0x2;var _0x369b20=[{'type':_0x3d2f24[_0x9a04('0x3')],'app':_0x9a04('0x4'),'appdata':'CDR(type)='+_0x3d2f24[_0x9a04('0x3')],'context':_0x3d2f24[_0x9a04('0x5')],'exten':_0x3d2f24['exten'],'priority':_0x2ced45++,'VoiceExtensionId':_0x3d2f24['id']},{'type':_0x3d2f24[_0x9a04('0x3')],'app':_0x3d2f24[_0x9a04('0x6')]?_0x9a04('0x4'):_0x9a04('0x7'),'appdata':_0x3d2f24[_0x9a04('0x6')]?_0x9a04('0x8')+_0x3d2f24['alias']:_0x9a04('0x9'),'context':_0x3d2f24[_0x9a04('0x5')],'exten':_0x3d2f24[_0x9a04('0xa')],'priority':_0x2ced45++,'VoiceExtensionId':_0x3d2f24['id']}];if(_0x3d2f24[_0x9a04('0x3')]===_0x9a04('0xb')){_0x369b20[_0x9a04('0xc')]({'type':'inbound','app':_0x9a04('0x4'),'appdata':_0x9a04('0xd')+_0x3d2f24['id'],'context':_0x3d2f24[_0x9a04('0x5')],'exten':_0x3d2f24['exten'],'priority':_0x2ced45++,'VoiceExtensionId':_0x3d2f24['id']});}_0x369b20[_0x9a04('0xc')]({'type':_0x3d2f24[_0x9a04('0x3')],'app':_0x9a04('0x4'),'appdata':_0x9a04('0xe'),'context':_0x3d2f24[_0x9a04('0x5')],'exten':_0x3d2f24['exten'],'priority':_0x2ced45++,'VoiceExtensionId':_0x3d2f24['id']},{'type':_0x3d2f24[_0x9a04('0x3')],'app':'Set','appdata':_0x9a04('0xf'),'context':_0x3d2f24[_0x9a04('0x5')],'exten':_0x3d2f24['exten'],'priority':_0x2ced45++,'VoiceExtensionId':_0x3d2f24['id']},{'type':_0x3d2f24[_0x9a04('0x3')],'app':_0x9a04('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x3d2f24[_0x9a04('0x5')],'exten':_0x3d2f24[_0x9a04('0xa')],'priority':_0x2ced45++,'VoiceExtensionId':_0x3d2f24['id']});return _0x369b20;}function _0x17f482(_0xe77b0){var _0xd86cdb=0x2;var _0x54d0c8=[{'type':_0x9a04('0x10'),'app':_0x9a04('0x4'),'appdata':_0x9a04('0x11'),'context':_0xe77b0[_0x9a04('0x5')],'exten':_0xe77b0[_0x9a04('0xa')],'priority':_0xd86cdb++,'VoiceExtensionId':_0xe77b0['id']},{'type':_0x9a04('0x10'),'app':_0xe77b0[_0x9a04('0x6')]?'Set':'NoOp','appdata':_0xe77b0[_0x9a04('0x6')]?_0x9a04('0x8')+_0xe77b0[_0x9a04('0x6')]:_0x9a04('0x9'),'context':_0xe77b0[_0x9a04('0x5')],'exten':_0xe77b0[_0x9a04('0xa')],'priority':_0xd86cdb++,'VoiceExtensionId':_0xe77b0['id']},{'type':_0x9a04('0x10'),'app':_0x9a04('0x4'),'appdata':_0x9a04('0x12')+(_0xe77b0[_0x9a04('0x13')]?'${EXTEN:'+_0xe77b0[_0x9a04('0x13')]+'}':_0x9a04('0x14')),'context':_0xe77b0['context'],'exten':_0xe77b0[_0x9a04('0xa')],'priority':_0xd86cdb++,'VoiceExtensionId':_0xe77b0['id']},{'type':_0x9a04('0x10'),'app':_0x9a04('0x4'),'appdata':'CDR(routeid)='+_0xe77b0['id'],'context':_0xe77b0[_0x9a04('0x5')],'exten':_0xe77b0['exten'],'priority':_0xd86cdb++,'VoiceExtensionId':_0xe77b0['id']},{'type':_0x9a04('0x10'),'app':_0x9a04('0x15'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0xd86cdb+0x2)+_0x9a04('0x16')+(_0xd86cdb+0x1)+')','context':_0xe77b0[_0x9a04('0x5')],'exten':_0xe77b0[_0x9a04('0xa')],'priority':_0xd86cdb++,'VoiceExtensionId':_0xe77b0['id']},{'type':_0x9a04('0x10'),'app':_0x9a04('0x4'),'appdata':_0xe77b0[_0x9a04('0x13')]?'CDR(prefix)=${EXTEN:0:'+_0xe77b0['cutdigits']+'}':_0x9a04('0x17'),'context':_0xe77b0[_0x9a04('0x5')],'exten':_0xe77b0[_0x9a04('0xa')],'priority':_0xd86cdb++,'VoiceExtensionId':_0xe77b0['id']},{'type':_0x9a04('0x10'),'app':_0x9a04('0x4'),'appdata':_0x9a04('0xe'),'context':_0xe77b0[_0x9a04('0x5')],'exten':_0xe77b0[_0x9a04('0xa')],'priority':_0xd86cdb++,'VoiceExtensionId':_0xe77b0['id']},{'type':_0x9a04('0x10'),'app':'Set','appdata':_0x9a04('0xf'),'context':_0xe77b0[_0x9a04('0x5')],'exten':_0xe77b0[_0x9a04('0xa')],'priority':_0xd86cdb++,'VoiceExtensionId':_0xe77b0['id']},{'type':_0x9a04('0x10'),'app':_0x9a04('0x4'),'appdata':_0x9a04('0x18'),'context':_0xe77b0[_0x9a04('0x5')],'exten':_0xe77b0[_0x9a04('0xa')],'priority':_0xd86cdb++,'VoiceExtensionId':_0xe77b0['id']},{'type':_0x9a04('0x10'),'app':_0x9a04('0x4'),'appdata':_0x9a04('0x19')+_0xe77b0['id'],'context':_0xe77b0[_0x9a04('0x5')],'exten':_0xe77b0[_0x9a04('0xa')],'priority':_0xd86cdb++,'VoiceExtensionId':_0xe77b0['id']}];if(_0xe77b0[_0x9a04('0x1a')](_0x9a04('0x1b'))&&_0xe77b0[_0x9a04('0x1b')]!==_0x9a04('0x1c')){_0x54d0c8[_0x9a04('0xc')]({'type':_0x9a04('0x10'),'app':_0x9a04('0x4'),'appdata':_0x9a04('0x1d'),'context':_0xe77b0[_0x9a04('0x5')],'exten':_0xe77b0['exten'],'priority':_0xd86cdb++,'VoiceExtensionId':_0xe77b0['id']},{'type':_0x9a04('0x10'),'app':_0x9a04('0x4'),'appdata':_0x9a04('0x1e')+_0xe77b0[_0x9a04('0x1b')]||_0x9a04('0x1f'),'context':_0xe77b0['context'],'exten':_0xe77b0['exten'],'priority':_0xd86cdb++,'VoiceExtensionId':_0xe77b0['id']});}return _0x54d0c8;}function _0x5d0170(_0x431d75,_0x213369){var _0x141a0d=[{'name':_0x9a04('0x20'),'param':0x0},{'name':_0x9a04('0x21'),'param':0x1},{'name':_0x9a04('0x22'),'param':0x2},{'name':_0x9a04('0x23'),'param':0x3}];var _0xf4ecca={};var _0x2f30e3=_0x213369[_0x9a04('0x24')](',');var _0x3fbe9e=[];for(var _0x111d59=0x0;_0x111d59<_0x141a0d[_0x9a04('0x25')];_0x111d59++){switch(_0x141a0d[_0x111d59]['name']){case _0x9a04('0x20'):_0xf4ecca[_0x9a04('0x20')]=_0x2f30e3[_0x141a0d[_0x111d59][_0x9a04('0x26')]][_0x9a04('0x24')]('/')[0x1];_0xf4ecca[_0x9a04('0x27')]=_0x2f30e3[_0x141a0d[_0x111d59][_0x9a04('0x26')]]['split']('/')[0x2];_0xf4ecca[_0x9a04('0x28')]=_0xf4ecca['phone']?_0xf4ecca[_0x9a04('0x27')][_0x9a04('0x24')]('$')[0x0]:undefined;_0xf4ecca['phone']=_0x431d75['cutdigits']?(_0xf4ecca['prefix']||'')+_0x9a04('0x29')+_0x431d75[_0x9a04('0x13')]+'}':(_0xf4ecca[_0x9a04('0x28')]||'')+'${EXTEN}';_0x3fbe9e[_0x141a0d[_0x111d59][_0x9a04('0x26')]]=['SIP',_0xf4ecca['trunk'],_0xf4ecca[_0x9a04('0x27')]][_0x9a04('0x2a')]('/');break;case _0x9a04('0x22'):_0xf4ecca['options']=_0x2f30e3[_0x141a0d[_0x111d59][_0x9a04('0x26')]];if(_0x431d75[_0x9a04('0x1b')]!==_0x9a04('0x1c')){if(_0xf4ecca[_0x9a04('0x22')][_0x9a04('0x2b')](_0x9a04('0x2c'))<0x0){_0xf4ecca[_0x9a04('0x22')]+=_0x9a04('0x2c');}}else{_0xf4ecca[_0x9a04('0x22')]=_0xf4ecca['options']['replace'](_0x9a04('0x2c'),'');}_0x3fbe9e[_0x141a0d[_0x111d59][_0x9a04('0x26')]]=_0xf4ecca['options'];break;default:_0x3fbe9e[_0x141a0d[_0x111d59][_0x9a04('0x26')]]=_0x2f30e3[_0x141a0d[_0x111d59][_0x9a04('0x26')]];}}return _0x3fbe9e[_0x9a04('0x2a')](',');}function _0x201fe9(_0x4f56e2,_0x500dcb,_0x1289cc){return new Promise(function(_0x8f8a5d,_0x215b9a){var _0x246556=[];if(_[_0x9a04('0x2d')](_0x500dcb))return _0x8f8a5d(_0x246556);_0x2f791e[_0x9a04('0x2e')][_0x9a04('0x2f')]({'attributes':['id',_0x9a04('0x30'),'IntervalId'],'raw':!![]})[_0x9a04('0x31')](function(_0x1f366f){for(var _0x111eab=0x0,_0x23d6f5=0x0;_0x111eab<_0x500dcb[_0x9a04('0x25')];_0x111eab++,_0x23d6f5=0x0){var _0x27f892=_0x500dcb[_0x111eab];var _0x55b32c=[];var _0x2c06f1=[];delete _0x27f892['id'];if(_0x27f892['interval']!=='*,*,*,*'){_0x27f892['intervals']=[_0x27f892[_0x9a04('0x30')]];}else{_0x27f892['intervals']=_0x27f892[_0x9a04('0x32')]?_[_0x9a04('0x33')](_[_0x9a04('0x34')](_0x1f366f,{'IntervalId':_0x27f892['IntervalId']}),_0x9a04('0x30')):[];}_0x27f892[_0x9a04('0x5')]=_0x4f56e2[_0x9a04('0x5')];_0x27f892[_0x9a04('0xa')]=_0x4f56e2[_0x9a04('0xa')];if(_0x27f892['type'])_0x27f892[_0x9a04('0x3')]=_0x27f892['type']['toLowerCase']();if(_0x4f56e2['type']==='outbound'){if(_0x27f892[_0x9a04('0x1a')](_0x9a04('0x35'))&&_0x27f892[_0x9a04('0x35')]&&_0x27f892[_0x9a04('0x35')]!=='--'){_0x55b32c['push']({'type':_0x27f892[_0x9a04('0x3')][_0x9a04('0x36')](),'app':_0x9a04('0x4'),'appdata':_0x9a04('0x37')+_0x27f892['tag'],'context':_0x4f56e2[_0x9a04('0x5')],'exten':_0x4f56e2[_0x9a04('0xa')],'priority':_0x27f892[_0x9a04('0x38')]['length']+_0x1289cc+_0x23d6f5++,'VoiceExtensionId':_0x4f56e2['id']});}_0x55b32c[_0x9a04('0xc')]({'type':_0x27f892[_0x9a04('0x3')][_0x9a04('0x36')](),'app':'ExecIf','appdata':_0x9a04('0x39')+(_0x27f892[_0x9a04('0x3a')]?_0x9a04('0x3b')+_0x27f892['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x4f56e2[_0x9a04('0x5')],'exten':_0x4f56e2[_0x9a04('0xa')],'priority':_0x27f892['intervals'][_0x9a04('0x25')]+_0x1289cc+_0x23d6f5++,'VoiceExtensionId':_0x4f56e2['id']});}else{if(_0x27f892[_0x9a04('0x1a')]('answer')){if([_0x9a04('0x3c'),_0x9a04('0x3d')][_0x9a04('0x3e')](_0x27f892[_0x9a04('0x3f')][_0x9a04('0x36')]())&&_0x27f892[_0x9a04('0x40')]!==_0x9a04('0x41')){if(_0x27f892[_0x9a04('0x42')]){_0x55b32c[_0x9a04('0xc')]({'type':_0x27f892[_0x9a04('0x3')][_0x9a04('0x36')](),'app':_0x9a04('0x15'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x4f56e2[_0x9a04('0x5')],'exten':_0x4f56e2[_0x9a04('0xa')],'priority':_0x27f892['intervals'][_0x9a04('0x25')]+_0x1289cc+_0x23d6f5++,'VoiceExtensionId':_0x4f56e2['id']});_0x55b32c[_0x9a04('0xc')]({'type':_0x27f892[_0x9a04('0x3')][_0x9a04('0x36')](),'app':_0x9a04('0x4'),'appdata':_0x9a04('0x43'),'context':_0x4f56e2['context'],'exten':_0x4f56e2[_0x9a04('0xa')],'priority':_0x27f892[_0x9a04('0x38')][_0x9a04('0x25')]+_0x1289cc+_0x23d6f5++,'VoiceExtensionId':_0x4f56e2['id']});}else{_0x55b32c[_0x9a04('0xc')]({'type':_0x27f892[_0x9a04('0x3')][_0x9a04('0x36')](),'app':_0x9a04('0x15'),'appdata':_0x9a04('0x44'),'context':_0x4f56e2[_0x9a04('0x5')],'exten':_0x4f56e2['exten'],'priority':_0x27f892[_0x9a04('0x38')]['length']+_0x1289cc+_0x23d6f5++,'VoiceExtensionId':_0x4f56e2['id']});_0x55b32c[_0x9a04('0xc')]({'type':_0x27f892[_0x9a04('0x3')][_0x9a04('0x36')](),'app':'Set','appdata':_0x9a04('0x45'),'context':_0x4f56e2['context'],'exten':_0x4f56e2[_0x9a04('0xa')],'priority':_0x27f892[_0x9a04('0x38')][_0x9a04('0x25')]+_0x1289cc+_0x23d6f5++,'VoiceExtensionId':_0x4f56e2['id']});}}}}for(var _0xc5d0b=0x0;_0xc5d0b<_0x27f892[_0x9a04('0x38')][_0x9a04('0x25')];_0xc5d0b++){var _0x4e525f=_0x1289cc+_0x27f892[_0x9a04('0x38')]['length'];var _0x5e31e8=_0xc5d0b===_0x27f892[_0x9a04('0x38')]['length']-0x1?_0x1289cc+_0x55b32c[_0x9a04('0x25')]+_0x2c06f1[_0x9a04('0x25')]+0x2:_0x1289cc+_0xc5d0b+0x1;_0x55b32c['splice'](_0xc5d0b,0x0,{'type':_0x4f56e2[_0x9a04('0x3')],'app':_0x9a04('0x46'),'appdata':_0x27f892[_0x9a04('0x38')][_0xc5d0b]+'?'+_0x4f56e2[_0x9a04('0x5')]+_0x9a04('0x47')+_0x4e525f+':'+_0x4f56e2[_0x9a04('0x5')]+',${EXTEN},'+_0x5e31e8,'exten':_0x4f56e2[_0x9a04('0xa')],'context':_0x4f56e2['context'],'priority':_0x1289cc+_0xc5d0b,'VoiceExtensionId':_0x4f56e2['id']});}if(_0x27f892['appType']===_0x9a04('0x48'))_0x27f892['appdata']=_0x5d0170(_0x4f56e2,_0x27f892[_0x9a04('0x49')]);_0x27f892['priority']=_0x55b32c[_0x9a04('0x25')]?_[_0x9a04('0x4a')](_0x55b32c)[_0x9a04('0x4b')]+0x1:_0x1289cc;_0x246556=_[_0x9a04('0x4c')](_0x246556,_0x55b32c,[_0x27f892],_0x2c06f1);_0x1289cc=_[_0x9a04('0x4a')](_0x246556)[_0x9a04('0x4b')]+0x1;}return _0x8f8a5d(_0x246556);})[_0x9a04('0x4d')](function(_0x14e950){_0x215b9a(_0x14e950);});});}return _0x1eb6ef[_0x9a04('0x4e')](_0x9a04('0x4f'),attributes,{'tableName':_0x9a04('0x50'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4f7c1c){var _0x5e1449=this[_0x9a04('0x51')]({'plain':!![]});var _0x4d7261=_0x5e1449[_0x9a04('0x3')]===_0x9a04('0x10')?_0x17f482(_0x5e1449):_0x3c975d(_0x5e1449);return _0x201fe9(_0x5e1449,_0x4f7c1c,_['last'](_0x4d7261)[_0x9a04('0x4b')]+0x1)[_0x9a04('0x31')](function(_0x804549){var _0x420696=_[_0x9a04('0x4c')](_0x4d7261,_0x804549);_0x420696[_0x9a04('0xc')]({'type':_0x5e1449['type'],'app':_0x9a04('0x52'),'exten':_0x5e1449[_0x9a04('0xa')],'context':_0x5e1449[_0x9a04('0x5')],'priority':_[_0x9a04('0x4a')](_0x420696)[_0x9a04('0x4b')]+0x1,'VoiceExtensionId':_0x5e1449['id']});return _0x420696;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 8dbed0f..ae00e20 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 _0x644f=['limit','include','map','model','info','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes'];(function(_0x5d6a36,_0xa0fa93){var _0x5a52c1=function(_0x129185){while(--_0x129185){_0x5d6a36['push'](_0x5d6a36['shift']());}};_0x5a52c1(++_0xa0fa93);}(_0x644f,0x177));var _0xf644=function(_0x5e4563,_0x3ff918){_0x5e4563=_0x5e4563-0x0;var _0x8d1bf5=_0x644f[_0x5e4563];return _0x8d1bf5;};'use strict';var _=require('lodash');var util=require(_0xf644('0x0'));var moment=require(_0xf644('0x1'));var BPromise=require(_0xf644('0x2'));var rs=require(_0xf644('0x3'));var fs=require('fs');var Redis=require(_0xf644('0x4'));var db=require(_0xf644('0x5'))['db'];var utils=require(_0xf644('0x6'));var logger=require(_0xf644('0x7'))(_0xf644('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf644('0x9')][_0xf644('0xa')]({'port':0x232a});config[_0xf644('0xb')]=_['defaults'](config[_0xf644('0xb')],{'host':_0xf644('0xc'),'port':0x18eb});var socket=require(_0xf644('0xd'))(new Redis(config[_0xf644('0xb')]));require(_0xf644('0xe'))['register'](socket);function respondWithRpcPromise(_0x35b8e5,_0x21e90a,_0x33a2c2){return new BPromise(function(_0xcd5688,_0x59d974){return client['request'](_0x35b8e5,_0x33a2c2)[_0xf644('0xf')](function(_0x517447){logger['info'](_0xf644('0x10'),_0x21e90a,_0xf644('0x11'));logger[_0xf644('0x12')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x21e90a,_0xf644('0x11'),JSON[_0xf644('0x13')](_0x517447));if(_0x517447[_0xf644('0x14')]){if(_0x517447[_0xf644('0x14')][_0xf644('0x15')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x21e90a,_0x517447['error']['message']);return _0x59d974(_0x517447['error'][_0xf644('0x16')]);}logger['error'](_0xf644('0x10'),_0x21e90a,_0x517447[_0xf644('0x14')][_0xf644('0x16')]);return _0xcd5688(_0x517447[_0xf644('0x14')][_0xf644('0x16')]);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x21e90a,_0xf644('0x11'));_0xcd5688(_0x517447[_0xf644('0x17')][_0xf644('0x16')]);}})[_0xf644('0x18')](function(_0x2b628d){logger[_0xf644('0x14')](_0xf644('0x10'),_0x21e90a,_0x2b628d);_0x59d974(_0x2b628d);});});}exports[_0xf644('0x19')]=function(_0x2c51ef){var _0x1c8c56=this;return new Promise(function(_0x1c5613,_0x567c1d){return db[_0xf644('0x1a')][_0xf644('0x1b')]({'raw':_0x2c51ef[_0xf644('0x1c')]?_0x2c51ef[_0xf644('0x1c')][_0xf644('0x1d')]===undefined?!![]:![]:!![],'where':_0x2c51ef['options']?_0x2c51ef[_0xf644('0x1c')][_0xf644('0x1e')]||null:null,'attributes':_0x2c51ef[_0xf644('0x1c')]?_0x2c51ef[_0xf644('0x1c')][_0xf644('0x1f')]||null:null,'limit':_0x2c51ef['options']?_0x2c51ef[_0xf644('0x1c')][_0xf644('0x20')]||null:null,'include':_0x2c51ef[_0xf644('0x1c')]?_0x2c51ef[_0xf644('0x1c')]['include']?_['map'](_0x2c51ef[_0xf644('0x1c')][_0xf644('0x21')],function(_0x372f30){return{'model':db[_0x372f30['model']],'as':_0x372f30['as'],'attributes':_0x372f30['attributes'],'include':_0x372f30[_0xf644('0x21')]?_[_0xf644('0x22')](_0x372f30[_0xf644('0x21')],function(_0x530a33){return{'model':db[_0x530a33[_0xf644('0x23')]],'as':_0x530a33['as'],'attributes':_0x530a33['attributes'],'include':_0x530a33[_0xf644('0x21')]?_[_0xf644('0x22')](_0x530a33[_0xf644('0x21')],function(_0x295c04){return{'model':db[_0x295c04[_0xf644('0x23')]],'as':_0x295c04['as'],'attributes':_0x295c04['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x44366a){logger[_0xf644('0x24')](_0xf644('0x19'),_0x2c51ef);logger['debug'](_0xf644('0x19'),_0x2c51ef,JSON[_0xf644('0x13')](_0x44366a));_0x1c5613(_0x44366a);})[_0xf644('0x18')](function(_0x42351e){logger[_0xf644('0x14')]('GetVoiceExtension',_0x42351e[_0xf644('0x16')],_0x2c51ef);_0x567c1d(_0x1c8c56[_0xf644('0x14')](0x1f4,_0x42351e[_0xf644('0x16')]));});});}; \ No newline at end of file +var _0xb3f9=['VoiceExtension','findAll','options','raw','where','limit','map','include','model','attributes','then','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','register','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetVoiceExtension'];(function(_0x1af8d2,_0x31bd21){var _0x2fa219=function(_0x117f6f){while(--_0x117f6f){_0x1af8d2['push'](_0x1af8d2['shift']());}};_0x2fa219(++_0x31bd21);}(_0xb3f9,0x7a));var _0x9b3f=function(_0x1c57a5,_0x3fc39c){_0x1c57a5=_0x1c57a5-0x0;var _0x4c3371=_0xb3f9[_0x1c57a5];return _0x4c3371;};'use strict';var _=require(_0x9b3f('0x0'));var util=require(_0x9b3f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9b3f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9b3f('0x3'))['db'];var utils=require(_0x9b3f('0x4'));var logger=require(_0x9b3f('0x5'))(_0x9b3f('0x6'));var config=require(_0x9b3f('0x7'));var jayson=require(_0x9b3f('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x9b3f('0x9')]=_[_0x9b3f('0xa')](config['redis'],{'host':_0x9b3f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceExtension.socket')[_0x9b3f('0xc')](socket);function respondWithRpcPromise(_0x55d187,_0x297ffa,_0x258f1e){return new BPromise(function(_0x2d905f,_0x230b57){return client[_0x9b3f('0xd')](_0x55d187,_0x258f1e)['then'](function(_0xa1f974){logger[_0x9b3f('0xe')](_0x9b3f('0xf'),_0x297ffa,_0x9b3f('0x10'));logger[_0x9b3f('0x11')](_0x9b3f('0x12'),_0x297ffa,_0x9b3f('0x10'),JSON[_0x9b3f('0x13')](_0xa1f974));if(_0xa1f974['error']){if(_0xa1f974['error'][_0x9b3f('0x14')]===0x1f4){logger[_0x9b3f('0x15')](_0x9b3f('0xf'),_0x297ffa,_0xa1f974[_0x9b3f('0x15')][_0x9b3f('0x16')]);return _0x230b57(_0xa1f974['error']['message']);}logger['error'](_0x9b3f('0xf'),_0x297ffa,_0xa1f974[_0x9b3f('0x15')][_0x9b3f('0x16')]);return _0x2d905f(_0xa1f974[_0x9b3f('0x15')][_0x9b3f('0x16')]);}else{logger[_0x9b3f('0xe')]('VoiceExtension,\x20%s,\x20%s',_0x297ffa,'request\x20sent');_0x2d905f(_0xa1f974[_0x9b3f('0x17')][_0x9b3f('0x16')]);}})[_0x9b3f('0x18')](function(_0x23d7c7){logger[_0x9b3f('0x15')](_0x9b3f('0xf'),_0x297ffa,_0x23d7c7);_0x230b57(_0x23d7c7);});});}exports[_0x9b3f('0x19')]=function(_0x17f2d3){var _0x3f16aa=this;return new Promise(function(_0x13e65b,_0xa4883e){return db[_0x9b3f('0x1a')][_0x9b3f('0x1b')]({'raw':_0x17f2d3[_0x9b3f('0x1c')]?_0x17f2d3[_0x9b3f('0x1c')][_0x9b3f('0x1d')]===undefined?!![]:![]:!![],'where':_0x17f2d3[_0x9b3f('0x1c')]?_0x17f2d3[_0x9b3f('0x1c')][_0x9b3f('0x1e')]||null:null,'attributes':_0x17f2d3['options']?_0x17f2d3[_0x9b3f('0x1c')]['attributes']||null:null,'limit':_0x17f2d3[_0x9b3f('0x1c')]?_0x17f2d3['options'][_0x9b3f('0x1f')]||null:null,'include':_0x17f2d3[_0x9b3f('0x1c')]?_0x17f2d3[_0x9b3f('0x1c')]['include']?_[_0x9b3f('0x20')](_0x17f2d3['options'][_0x9b3f('0x21')],function(_0x526355){return{'model':db[_0x526355[_0x9b3f('0x22')]],'as':_0x526355['as'],'attributes':_0x526355[_0x9b3f('0x23')],'include':_0x526355['include']?_[_0x9b3f('0x20')](_0x526355[_0x9b3f('0x21')],function(_0x2dfef4){return{'model':db[_0x2dfef4[_0x9b3f('0x22')]],'as':_0x2dfef4['as'],'attributes':_0x2dfef4['attributes'],'include':_0x2dfef4['include']?_[_0x9b3f('0x20')](_0x2dfef4['include'],function(_0x377d0e){return{'model':db[_0x377d0e['model']],'as':_0x377d0e['as'],'attributes':_0x377d0e[_0x9b3f('0x23')]};}):[]};}):[]};}):[]:[]})[_0x9b3f('0x24')](function(_0x35f2dd){logger[_0x9b3f('0xe')](_0x9b3f('0x19'),_0x17f2d3);logger['debug'](_0x9b3f('0x19'),_0x17f2d3,JSON[_0x9b3f('0x13')](_0x35f2dd));_0x13e65b(_0x35f2dd);})[_0x9b3f('0x18')](function(_0x2a0a0c){logger[_0x9b3f('0x15')](_0x9b3f('0x19'),_0x2a0a0c[_0x9b3f('0x16')],_0x17f2d3);_0xa4883e(_0x3f16aa['error'](0x1f4,_0x2a0a0c['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 8e531f1..fd66c27 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 _0x0295=['emit','removeListener','register','voiceExtension:','./voiceExtension.events','update'];(function(_0xdd8e5a,_0x3dec76){var _0x5d261d=function(_0x2c5121){while(--_0x2c5121){_0xdd8e5a['push'](_0xdd8e5a['shift']());}};_0x5d261d(++_0x3dec76);}(_0x0295,0x1f0));var _0x5029=function(_0x312d76,_0x1bc862){_0x312d76=_0x312d76-0x0;var _0xdc8d9d=_0x0295[_0x312d76];return _0xdc8d9d;};'use strict';var VoiceExtensionEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){VoiceExtensionEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);VoiceExtensionEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file +var _0x326f=['update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x5ae599,_0x522c4c){var _0x2f01ba=function(_0x5abccb){while(--_0x5abccb){_0x5ae599['push'](_0x5ae599['shift']());}};_0x2f01ba(++_0x522c4c);}(_0x326f,0xd1));var _0xf326=function(_0x40f3c3,_0x1ba653){_0x40f3c3=_0x40f3c3-0x0;var _0x1ab64b=_0x326f[_0x40f3c3];return _0x1ab64b;};'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 b229db9..69185ed 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 _0xadb5=['delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','update'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0xadb5,0xad));var _0x5adb=function(_0x425f88,_0x21ebea){_0x425f88=_0x425f88-0x0;var _0x3251ab=_0xadb5[_0x425f88];return _0x3251ab;};'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('./voiceMail.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0xf')]);router['put']('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller['destroy']);module[_0x5adb('0x12')]=router; \ No newline at end of file +var _0x4137=['getMessages','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','/:id','isAuthenticated','/:id/messages'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x4137,0xf8));var _0x7413=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x4137[_0x5d6456];return _0x4d66c1;};'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['show']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0x11')]('/',auth['isAuthenticated'](),controller[_0x7413('0x12')]);router[_0x7413('0x13')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller[_0x7413('0x14')]);router['delete'](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['destroy']);module[_0x7413('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 befafca..2fa7737 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 _0x21a9=['getDataValue','fullname','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER'];(function(_0x12d812,_0x496bb7){var _0x3711ab=function(_0x3259da){while(--_0x3259da){_0x12d812['push'](_0x12d812['shift']());}};_0x3711ab(++_0x496bb7);}(_0x21a9,0x1df));var _0x921a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x21a9[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x921a('0x0'));module[_0x921a('0x1')]={'customer_id':{'type':Sequelize[_0x921a('0x2')]},'context':{'type':Sequelize[_0x921a('0x2')],'defaultValue':_0x921a('0x3'),'unique':_0x921a('0x4')},'mailbox':{'type':Sequelize[_0x921a('0x2')],'defaultValue':'','allowNull':![],'unique':_0x921a('0x4')},'password':{'type':Sequelize[_0x921a('0x2')]},'fullname':{'type':Sequelize[_0x921a('0x2')]},'email':{'type':Sequelize[_0x921a('0x2')],'validate':{'isEmail':!![]},'set':function(_0x3ccf5f){this['setDataValue'](_0x921a('0x5'),typeof _0x3ccf5f===_0x921a('0x6')&&_0x3ccf5f[_0x921a('0x7')]()?_0x3ccf5f[_0x921a('0x7')]():null);}},'pager':{'type':Sequelize[_0x921a('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x921a('0x8')},'attach':{'type':Sequelize[_0x921a('0x9')](_0x921a('0xa'),'no'),'defaultValue':_0x921a('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x921a('0x9')]('yes','no'),'defaultValue':_0x921a('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x921a('0x2')]},'callback':{'type':Sequelize[_0x921a('0x2')]},'review':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x921a('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x921a('0x9')](_0x921a('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x921a('0x9')](_0x921a('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x921a('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x921a('0x9')](_0x921a('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x921a('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x921a('0x9')](_0x921a('0xa'),'no'),'defaultValue':_0x921a('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x921a('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x921a('0x9')](_0x921a('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x921a('0x9')](_0x921a('0xa'),'no'),'defaultValue':_0x921a('0xa'),'allowNull':![]},'stamp':{'type':_0x921a('0xc')},'emailsubject':{'type':Sequelize[_0x921a('0x2')]},'emailbody':{'type':Sequelize[_0x921a('0x2')]},'maxsecs':{'type':Sequelize[_0x921a('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x921a('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x921a('0xe')](_0x921a('0xf'))+'\x20-\x20'+this[_0x921a('0xe')](_0x921a('0x10'));}}}; \ No newline at end of file +var _0xba05=['central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','fullname','\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim'];(function(_0x3b8f2e,_0x5a99a8){var _0x1433d5=function(_0x5e0353){while(--_0x5e0353){_0x3b8f2e['push'](_0x3b8f2e['shift']());}};_0x1433d5(++_0x5a99a8);}(_0xba05,0x1d4));var _0x5ba0=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xba05[_0xc4001c];return _0x49f7bc;};'use strict';var Sequelize=require(_0x5ba0('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x5ba0('0x1')]},'context':{'type':Sequelize[_0x5ba0('0x1')],'defaultValue':_0x5ba0('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x5ba0('0x1')],'defaultValue':'','allowNull':![],'unique':_0x5ba0('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x5ba0('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x2700e8){this[_0x5ba0('0x4')](_0x5ba0('0x5'),typeof _0x2700e8===_0x5ba0('0x6')&&_0x2700e8[_0x5ba0('0x7')]()?_0x2700e8[_0x5ba0('0x7')]():null);}},'pager':{'type':Sequelize[_0x5ba0('0x1')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x5ba0('0x8')},'attach':{'type':Sequelize[_0x5ba0('0x9')](_0x5ba0('0xa'),'no'),'defaultValue':_0x5ba0('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x5ba0('0x9')](_0x5ba0('0xa'),'no'),'defaultValue':_0x5ba0('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x5ba0('0x1')]},'callback':{'type':Sequelize[_0x5ba0('0x1')]},'review':{'type':Sequelize[_0x5ba0('0x9')](_0x5ba0('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x5ba0('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x5ba0('0x9')](_0x5ba0('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x5ba0('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x5ba0('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x5ba0('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x5ba0('0x9')](_0x5ba0('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x5ba0('0x9')]('yes','no'),'defaultValue':_0x5ba0('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x5ba0('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x5ba0('0x9')](_0x5ba0('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x5ba0('0x9')](_0x5ba0('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x5ba0('0x1')]},'emailbody':{'type':Sequelize[_0x5ba0('0x1')]},'maxsecs':{'type':Sequelize[_0x5ba0('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x5ba0('0xd')],'get':function(){return this['getDataValue'](_0x5ba0('0xe'))+_0x5ba0('0xf')+this['getDataValue'](_0x5ba0('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index cc2ecf8..1e14918 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 _0x4cf8=['UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','VoiceMail','include','findAll','catch','find','create','body','user','UserProfileSection','userProfileId','params','getMessages','findOne','VoiceMailMessage','mailbox','options','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails'];(function(_0x53f37f,_0xfb0b18){var _0x2fe5f8=function(_0x76ef2d){while(--_0x76ef2d){_0x53f37f['push'](_0x53f37f['shift']());}};_0x2fe5f8(++_0xfb0b18);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x2183ca,_0x3778a9){_0x2183ca=_0x2183ca-0x0;var _0x21d00e=_0x4cf8[_0x2183ca];return _0x21d00e;};'use strict';var emlformat=require(_0x84cf('0x0'));var rimraf=require(_0x84cf('0x1'));var zipdir=require(_0x84cf('0x2'));var jsonpatch=require(_0x84cf('0x3'));var rp=require(_0x84cf('0x4'));var moment=require(_0x84cf('0x5'));var BPromise=require(_0x84cf('0x6'));var Mustache=require(_0x84cf('0x7'));var util=require(_0x84cf('0x8'));var path=require(_0x84cf('0x9'));var sox=require(_0x84cf('0xa'));var csv=require(_0x84cf('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x84cf('0xc'));var squel=require('squel');var crypto=require(_0x84cf('0xd'));var jsforce=require(_0x84cf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x84cf('0xb'));var querystring=require(_0x84cf('0xf'));var Papa=require('papaparse');var Redis=require(_0x84cf('0x10'));var authService=require(_0x84cf('0x11'));var qs=require(_0x84cf('0x12'));var as=require(_0x84cf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x84cf('0x14'))(_0x84cf('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x84cf('0x16'));var db=require(_0x84cf('0x17'))['db'];function respondWithStatusCode(_0x35f852,_0x33f83e){_0x33f83e=_0x33f83e||0xcc;return function(_0x172d04){if(_0x172d04){return _0x35f852[_0x84cf('0x18')](_0x33f83e);}return _0x35f852[_0x84cf('0x19')](_0x33f83e)[_0x84cf('0x1a')]();};}function respondWithResult(_0xced48,_0x250a19){_0x250a19=_0x250a19||0xc8;return function(_0x2fc41f){if(_0x2fc41f){return _0xced48[_0x84cf('0x19')](_0x250a19)[_0x84cf('0x1b')](_0x2fc41f);}};}function respondWithFilteredResult(_0x20e79c,_0x27261b){return function(_0x167c3e){if(_0x167c3e){var _0x464e70=typeof _0x27261b[_0x84cf('0x1c')]===_0x84cf('0x1d')&&typeof _0x27261b['limit']===_0x84cf('0x1d');var _0x5d6a93=_0x167c3e[_0x84cf('0x1e')];var _0x1abe2d=_0x464e70?0x0:_0x27261b[_0x84cf('0x1c')];var _0x13ba16=_0x464e70?_0x167c3e[_0x84cf('0x1e')]:_0x27261b['offset']+_0x27261b['limit'];var _0x42d6d4;if(_0x13ba16>=_0x5d6a93){_0x13ba16=_0x5d6a93;_0x42d6d4=0xc8;}else{_0x42d6d4=0xce;}_0x20e79c[_0x84cf('0x19')](_0x42d6d4);return _0x20e79c[_0x84cf('0x1f')](_0x84cf('0x20'),_0x1abe2d+'-'+_0x13ba16+'/'+_0x5d6a93)[_0x84cf('0x1b')](_0x167c3e);}return null;};}function patchUpdates(_0x5dda3f){return function(_0x39a37b){try{jsonpatch[_0x84cf('0x21')](_0x39a37b,_0x5dda3f,!![]);}catch(_0x3ca1be){return BPromise[_0x84cf('0x22')](_0x3ca1be);}return _0x39a37b[_0x84cf('0x23')]();};}function saveUpdates(_0x54405a,_0x42fa45){return function(_0x160f86){if(_0x160f86){return _0x160f86[_0x84cf('0x24')](_0x54405a)[_0x84cf('0x25')](function(_0x3e5e94){return _0x3e5e94;});}return null;};}function removeEntity(_0x29e9e1,_0x7feb4){return function(_0x4c9d1c){if(_0x4c9d1c){return _0x4c9d1c[_0x84cf('0x26')]()[_0x84cf('0x25')](function(){var _0x1c7747=_0x4c9d1c[_0x84cf('0x27')]({'plain':!![]});var _0x1d220a=_0x84cf('0x28');return db[_0x84cf('0x29')][_0x84cf('0x26')]({'where':{'type':_0x1d220a,'resourceId':_0x1c7747['id']}})[_0x84cf('0x25')](function(){return _0x4c9d1c;});})[_0x84cf('0x25')](function(){_0x29e9e1['status'](0xcc)[_0x84cf('0x1a')]();});}};}function handleEntityNotFound(_0x17bc92,_0x2a4973){return function(_0x41a5db){if(!_0x41a5db){_0x17bc92['sendStatus'](0x194);}return _0x41a5db;};}function handleError(_0x1595dd,_0x5a428c){_0x5a428c=_0x5a428c||0x1f4;return function(_0x29455e){logger[_0x84cf('0x2a')](_0x29455e[_0x84cf('0x2b')]);if(_0x29455e[_0x84cf('0x2c')]){delete _0x29455e[_0x84cf('0x2c')];}_0x1595dd[_0x84cf('0x19')](_0x5a428c)[_0x84cf('0x2d')](_0x29455e);};}exports[_0x84cf('0x2e')]=function(_0x1bfa56,_0xb4fc5a){var _0x31dbf5={},_0x308f8f={},_0x18243d={'count':0x0,'rows':[]};var _0x44f16e=_['map'](db['VoiceMail'][_0x84cf('0x2f')],function(_0x25de3a){return{'name':_0x25de3a[_0x84cf('0x30')],'type':_0x25de3a[_0x84cf('0x31')][_0x84cf('0x32')]};});_0x308f8f[_0x84cf('0x33')]=_[_0x84cf('0x34')](_0x44f16e,_0x84cf('0x2c'));_0x308f8f['query']=_[_0x84cf('0x35')](_0x1bfa56[_0x84cf('0x36')]);_0x308f8f['filters']=_[_0x84cf('0x37')](_0x308f8f['model'],_0x308f8f[_0x84cf('0x36')]);_0x31dbf5[_0x84cf('0x38')]=_[_0x84cf('0x37')](_0x308f8f[_0x84cf('0x33')],qs[_0x84cf('0x39')](_0x1bfa56['query'][_0x84cf('0x39')]));_0x31dbf5['attributes']=_0x31dbf5['attributes'][_0x84cf('0x3a')]?_0x31dbf5[_0x84cf('0x38')]:_0x308f8f['model'];if(!_0x1bfa56[_0x84cf('0x36')][_0x84cf('0x3b')](_0x84cf('0x3c'))){_0x31dbf5[_0x84cf('0x3d')]=qs[_0x84cf('0x3d')](_0x1bfa56[_0x84cf('0x36')]['limit']);_0x31dbf5[_0x84cf('0x1c')]=qs[_0x84cf('0x1c')](_0x1bfa56[_0x84cf('0x36')][_0x84cf('0x1c')]);}_0x31dbf5[_0x84cf('0x3e')]=qs[_0x84cf('0x3f')](_0x1bfa56['query'][_0x84cf('0x3f')]);_0x31dbf5['where']=qs[_0x84cf('0x40')](_[_0x84cf('0x41')](_0x1bfa56[_0x84cf('0x36')],_0x308f8f[_0x84cf('0x40')]),_0x44f16e);if(_0x1bfa56[_0x84cf('0x36')][_0x84cf('0x42')]){_0x31dbf5[_0x84cf('0x43')]=_[_0x84cf('0x44')](_0x31dbf5[_0x84cf('0x43')],{'$or':_['map'](_0x44f16e,function(_0x44e6f0){if(_0x44e6f0['type']!==_0x84cf('0x45')){var _0xc75386={};_0xc75386[_0x44e6f0['name']]={'$like':'%'+_0x1bfa56[_0x84cf('0x36')]['filter']+'%'};return _0xc75386;}})});}_0x31dbf5=_[_0x84cf('0x44')]({},_0x31dbf5,_0x1bfa56['options']);var _0x3fc160={'where':_0x31dbf5['where']};return db[_0x84cf('0x46')][_0x84cf('0x1e')](_0x3fc160)['then'](function(_0x847ce9){_0x18243d[_0x84cf('0x1e')]=_0x847ce9;if(_0x1bfa56[_0x84cf('0x36')]['includeAll']){_0x31dbf5[_0x84cf('0x47')]=[{'all':!![]}];}return db['VoiceMail'][_0x84cf('0x48')](_0x31dbf5);})['then'](function(_0x56b0e5){_0x18243d['rows']=_0x56b0e5;return _0x18243d;})[_0x84cf('0x25')](respondWithFilteredResult(_0xb4fc5a,_0x31dbf5))[_0x84cf('0x49')](handleError(_0xb4fc5a,null));};exports['show']=function(_0x2b737e,_0x56b623){var _0x191ad8={'raw':!![],'where':{'id':_0x2b737e['params']['id']}},_0x3fe8c1={};_0x3fe8c1[_0x84cf('0x33')]=_['keys'](db[_0x84cf('0x46')]['rawAttributes']);_0x3fe8c1['query']=_['keys'](_0x2b737e['query']);_0x3fe8c1['filters']=_['intersection'](_0x3fe8c1['model'],_0x3fe8c1[_0x84cf('0x36')]);_0x191ad8[_0x84cf('0x38')]=_[_0x84cf('0x37')](_0x3fe8c1[_0x84cf('0x33')],qs['fields'](_0x2b737e[_0x84cf('0x36')]['fields']));_0x191ad8[_0x84cf('0x38')]=_0x191ad8[_0x84cf('0x38')][_0x84cf('0x3a')]?_0x191ad8[_0x84cf('0x38')]:_0x3fe8c1[_0x84cf('0x33')];if(_0x2b737e[_0x84cf('0x36')]['includeAll']){_0x191ad8[_0x84cf('0x47')]=[{'all':!![]}];}_0x191ad8=_[_0x84cf('0x44')]({},_0x191ad8,_0x2b737e['options']);return db[_0x84cf('0x46')][_0x84cf('0x4a')](_0x191ad8)[_0x84cf('0x25')](handleEntityNotFound(_0x56b623,null))['then'](respondWithResult(_0x56b623,null))['catch'](handleError(_0x56b623,null));};exports['create']=function(_0x1cf3f6,_0x104421){return db[_0x84cf('0x46')][_0x84cf('0x4b')](_0x1cf3f6[_0x84cf('0x4c')],{})[_0x84cf('0x25')](function(_0x51d725){var _0x350985=_0x1cf3f6['user'][_0x84cf('0x27')]({'plain':!![]});if(!_0x350985)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x350985['role']===_0x84cf('0x4d')){var _0xb1c3a8=_0x51d725[_0x84cf('0x27')]({'plain':!![]});var _0x55e24e='Voicemails';return db[_0x84cf('0x4e')][_0x84cf('0x4a')]({'where':{'name':_0x55e24e,'userProfileId':_0x350985[_0x84cf('0x4f')]},'raw':!![]})[_0x84cf('0x25')](function(_0x401ced){if(_0x401ced&&_0x401ced['autoAssociation']===0x0){return db[_0x84cf('0x29')][_0x84cf('0x4b')]({'name':_0xb1c3a8['name'],'resourceId':_0xb1c3a8['id'],'type':_0x401ced[_0x84cf('0x2c')],'sectionId':_0x401ced['id']},{})['then'](function(){return _0x51d725;});}else{return _0x51d725;}})['catch'](function(_0x147194){logger[_0x84cf('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x147194);throw _0x147194;});}return _0x51d725;})['then'](respondWithResult(_0x104421,0xc9))[_0x84cf('0x49')](handleError(_0x104421,null));};exports[_0x84cf('0x24')]=function(_0x2f739a,_0x1e2676){if(_0x2f739a[_0x84cf('0x4c')]['id']){delete _0x2f739a[_0x84cf('0x4c')]['id'];}return db[_0x84cf('0x46')][_0x84cf('0x4a')]({'where':{'id':_0x2f739a['params']['id']}})[_0x84cf('0x25')](handleEntityNotFound(_0x1e2676,null))[_0x84cf('0x25')](saveUpdates(_0x2f739a['body'],null))['then'](respondWithResult(_0x1e2676,null))[_0x84cf('0x49')](handleError(_0x1e2676,null));};exports[_0x84cf('0x26')]=function(_0x3912cb,_0x2a4f20){return db[_0x84cf('0x46')][_0x84cf('0x4a')]({'where':{'id':_0x3912cb[_0x84cf('0x50')]['id']}})['then'](handleEntityNotFound(_0x2a4f20,null))[_0x84cf('0x25')](removeEntity(_0x2a4f20,null))['catch'](handleError(_0x2a4f20,null));};exports[_0x84cf('0x51')]=function(_0x5c0122,_0x2a60bc,_0x1c2f1b){return db['VoiceMail'][_0x84cf('0x52')]({'where':{'id':_0x5c0122[_0x84cf('0x50')]['id']}})['then'](handleEntityNotFound(_0x2a60bc,null))[_0x84cf('0x25')](function(_0x53bfb8){var _0x577d55;var _0x5cc371={},_0x50cde2={};_0x50cde2[_0x84cf('0x33')]=_[_0x84cf('0x35')](db[_0x84cf('0x53')][_0x84cf('0x2f')]);_0x50cde2['query']=_[_0x84cf('0x35')](_0x5c0122[_0x84cf('0x36')]);_0x50cde2['filters']=_[_0x84cf('0x37')](_0x50cde2[_0x84cf('0x33')],_0x50cde2[_0x84cf('0x36')]);_0x5cc371[_0x84cf('0x38')]=_[_0x84cf('0x37')](_0x50cde2[_0x84cf('0x33')],qs[_0x84cf('0x39')](_0x5c0122[_0x84cf('0x36')]['fields']));_0x5cc371[_0x84cf('0x38')]=_0x5cc371['attributes'][_0x84cf('0x3a')]?_0x5cc371[_0x84cf('0x38')]:_0x50cde2[_0x84cf('0x33')];if(!_0x5c0122[_0x84cf('0x36')][_0x84cf('0x3b')]('nolimit')){_0x5cc371[_0x84cf('0x3d')]=qs[_0x84cf('0x3d')](_0x5c0122[_0x84cf('0x36')]['limit']);_0x5cc371[_0x84cf('0x1c')]=qs[_0x84cf('0x1c')](_0x5c0122['query'][_0x84cf('0x1c')]);}_0x5cc371['order']=qs[_0x84cf('0x3f')](_0x5c0122[_0x84cf('0x36')]['sort']);_0x5cc371[_0x84cf('0x43')]=qs[_0x84cf('0x40')](_['pick'](_0x5c0122[_0x84cf('0x36')],_0x50cde2[_0x84cf('0x40')]));if(_0x5c0122[_0x84cf('0x36')][_0x84cf('0x42')]){_0x5cc371['where']=_[_0x84cf('0x44')](_0x5cc371[_0x84cf('0x43')],{'$or':_['map'](_0x5cc371['attributes'],function(_0x4d40e2){var _0x1b000c={};_0x1b000c[_0x4d40e2]={'$like':'%'+_0x5c0122[_0x84cf('0x36')][_0x84cf('0x42')]+'%'};return _0x1b000c;})});}_0x5cc371['where']=_['merge'](_0x5cc371[_0x84cf('0x43')],{'mailboxuser':_0x53bfb8[_0x84cf('0x54')]});_0x5cc371=_[_0x84cf('0x44')]({},_0x5cc371,_0x5c0122[_0x84cf('0x55')]);return db[_0x84cf('0x53')][_0x84cf('0x56')](_0x5cc371)[_0x84cf('0x25')](respondWithFilteredResult(_0x2a60bc,_0x5cc371));})[_0x84cf('0x49')](handleError(_0x2a60bc,null));}; \ No newline at end of file +var _0xb574=['filter','merge','VoiceMail','includeAll','findAll','rows','catch','show','params','intersection','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','body','length','pick','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','Voicemails','error','stack','name','send','map','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2002b3,_0x11e91c){var _0x2756f0=function(_0x4bf0b3){while(--_0x4bf0b3){_0x2002b3['push'](_0x2002b3['shift']());}};_0x2756f0(++_0x11e91c);}(_0xb574,0x106));var _0x4b57=function(_0x47d6b2,_0x13db91){_0x47d6b2=_0x47d6b2-0x0;var _0x28518c=_0xb574[_0x47d6b2];return _0x28518c;};'use strict';var emlformat=require(_0x4b57('0x0'));var rimraf=require(_0x4b57('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b57('0x2'));var rp=require(_0x4b57('0x3'));var moment=require('moment');var BPromise=require(_0x4b57('0x4'));var Mustache=require(_0x4b57('0x5'));var util=require(_0x4b57('0x6'));var path=require(_0x4b57('0x7'));var sox=require(_0x4b57('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b57('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4b57('0xa'));var toCsv=require(_0x4b57('0xb'));var querystring=require(_0x4b57('0xc'));var Papa=require(_0x4b57('0xd'));var Redis=require(_0x4b57('0xe'));var authService=require(_0x4b57('0xf'));var qs=require(_0x4b57('0x10'));var as=require(_0x4b57('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b57('0x12'))(_0x4b57('0x13'));var utils=require(_0x4b57('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4b57('0x15'))['db'];function respondWithStatusCode(_0x357c8b,_0x43d066){_0x43d066=_0x43d066||0xcc;return function(_0xf8a6fc){if(_0xf8a6fc){return _0x357c8b[_0x4b57('0x16')](_0x43d066);}return _0x357c8b[_0x4b57('0x17')](_0x43d066)[_0x4b57('0x18')]();};}function respondWithResult(_0xd5ee6d,_0x31cced){_0x31cced=_0x31cced||0xc8;return function(_0x4e15be){if(_0x4e15be){return _0xd5ee6d['status'](_0x31cced)[_0x4b57('0x19')](_0x4e15be);}};}function respondWithFilteredResult(_0x24f776,_0x10b9ff){return function(_0x58d6bd){if(_0x58d6bd){var _0x284640=typeof _0x10b9ff['offset']===_0x4b57('0x1a')&&typeof _0x10b9ff[_0x4b57('0x1b')]===_0x4b57('0x1a');var _0x10eda5=_0x58d6bd[_0x4b57('0x1c')];var _0xfb71cc=_0x284640?0x0:_0x10b9ff['offset'];var _0x1b35ff=_0x284640?_0x58d6bd[_0x4b57('0x1c')]:_0x10b9ff[_0x4b57('0x1d')]+_0x10b9ff[_0x4b57('0x1b')];var _0x4baaeb;if(_0x1b35ff>=_0x10eda5){_0x1b35ff=_0x10eda5;_0x4baaeb=0xc8;}else{_0x4baaeb=0xce;}_0x24f776[_0x4b57('0x17')](_0x4baaeb);return _0x24f776[_0x4b57('0x1e')](_0x4b57('0x1f'),_0xfb71cc+'-'+_0x1b35ff+'/'+_0x10eda5)[_0x4b57('0x19')](_0x58d6bd);}return null;};}function patchUpdates(_0xef1eae){return function(_0x4454c8){try{jsonpatch['apply'](_0x4454c8,_0xef1eae,!![]);}catch(_0x4b504b){return BPromise[_0x4b57('0x20')](_0x4b504b);}return _0x4454c8[_0x4b57('0x21')]();};}function saveUpdates(_0x567d8f,_0x380554){return function(_0x4a34b2){if(_0x4a34b2){return _0x4a34b2[_0x4b57('0x22')](_0x567d8f)[_0x4b57('0x23')](function(_0x56f017){return _0x56f017;});}return null;};}function removeEntity(_0x271361,_0x368c5f){return function(_0x4d07c9){if(_0x4d07c9){return _0x4d07c9[_0x4b57('0x24')]()[_0x4b57('0x23')](function(){var _0x25d190=_0x4d07c9[_0x4b57('0x25')]({'plain':!![]});var _0x540eff=_0x4b57('0x26');return db['UserProfileResource'][_0x4b57('0x24')]({'where':{'type':_0x540eff,'resourceId':_0x25d190['id']}})['then'](function(){return _0x4d07c9;});})[_0x4b57('0x23')](function(){_0x271361[_0x4b57('0x17')](0xcc)[_0x4b57('0x18')]();});}};}function handleEntityNotFound(_0x6584c4,_0x104f52){return function(_0x392e37){if(!_0x392e37){_0x6584c4['sendStatus'](0x194);}return _0x392e37;};}function handleError(_0x5c3c7a,_0x16d196){_0x16d196=_0x16d196||0x1f4;return function(_0x4c58e4){logger[_0x4b57('0x27')](_0x4c58e4[_0x4b57('0x28')]);if(_0x4c58e4[_0x4b57('0x29')]){delete _0x4c58e4[_0x4b57('0x29')];}_0x5c3c7a[_0x4b57('0x17')](_0x16d196)[_0x4b57('0x2a')](_0x4c58e4);};}exports['index']=function(_0xab365c,_0x2e9922){var _0x68be27={},_0x3cd331={},_0x4ccf89={'count':0x0,'rows':[]};var _0xa91ba=_[_0x4b57('0x2b')](db['VoiceMail'][_0x4b57('0x2c')],function(_0xa5b5dc){return{'name':_0xa5b5dc[_0x4b57('0x2d')],'type':_0xa5b5dc[_0x4b57('0x2e')]['key']};});_0x3cd331['model']=_['map'](_0xa91ba,_0x4b57('0x29'));_0x3cd331[_0x4b57('0x2f')]=_[_0x4b57('0x30')](_0xab365c[_0x4b57('0x2f')]);_0x3cd331[_0x4b57('0x31')]=_['intersection'](_0x3cd331[_0x4b57('0x32')],_0x3cd331[_0x4b57('0x2f')]);_0x68be27[_0x4b57('0x33')]=_['intersection'](_0x3cd331[_0x4b57('0x32')],qs[_0x4b57('0x34')](_0xab365c[_0x4b57('0x2f')]['fields']));_0x68be27[_0x4b57('0x33')]=_0x68be27[_0x4b57('0x33')]['length']?_0x68be27[_0x4b57('0x33')]:_0x3cd331[_0x4b57('0x32')];if(!_0xab365c[_0x4b57('0x2f')][_0x4b57('0x35')](_0x4b57('0x36'))){_0x68be27[_0x4b57('0x1b')]=qs['limit'](_0xab365c[_0x4b57('0x2f')][_0x4b57('0x1b')]);_0x68be27[_0x4b57('0x1d')]=qs[_0x4b57('0x1d')](_0xab365c[_0x4b57('0x2f')][_0x4b57('0x1d')]);}_0x68be27[_0x4b57('0x37')]=qs['sort'](_0xab365c['query'][_0x4b57('0x38')]);_0x68be27[_0x4b57('0x39')]=qs[_0x4b57('0x31')](_['pick'](_0xab365c[_0x4b57('0x2f')],_0x3cd331[_0x4b57('0x31')]),_0xa91ba);if(_0xab365c[_0x4b57('0x2f')][_0x4b57('0x3a')]){_0x68be27['where']=_[_0x4b57('0x3b')](_0x68be27[_0x4b57('0x39')],{'$or':_[_0x4b57('0x2b')](_0xa91ba,function(_0x2d24ab){if(_0x2d24ab['type']!=='VIRTUAL'){var _0x5d624c={};_0x5d624c[_0x2d24ab[_0x4b57('0x29')]]={'$like':'%'+_0xab365c[_0x4b57('0x2f')][_0x4b57('0x3a')]+'%'};return _0x5d624c;}})});}_0x68be27=_[_0x4b57('0x3b')]({},_0x68be27,_0xab365c['options']);var _0x445353={'where':_0x68be27[_0x4b57('0x39')]};return db[_0x4b57('0x3c')][_0x4b57('0x1c')](_0x445353)[_0x4b57('0x23')](function(_0x453129){_0x4ccf89[_0x4b57('0x1c')]=_0x453129;if(_0xab365c[_0x4b57('0x2f')][_0x4b57('0x3d')]){_0x68be27['include']=[{'all':!![]}];}return db[_0x4b57('0x3c')][_0x4b57('0x3e')](_0x68be27);})[_0x4b57('0x23')](function(_0x5b2f50){_0x4ccf89[_0x4b57('0x3f')]=_0x5b2f50;return _0x4ccf89;})['then'](respondWithFilteredResult(_0x2e9922,_0x68be27))[_0x4b57('0x40')](handleError(_0x2e9922,null));};exports[_0x4b57('0x41')]=function(_0x457273,_0x19ba66){var _0x189fd0={'raw':!![],'where':{'id':_0x457273[_0x4b57('0x42')]['id']}},_0x477352={};_0x477352[_0x4b57('0x32')]=_[_0x4b57('0x30')](db[_0x4b57('0x3c')][_0x4b57('0x2c')]);_0x477352[_0x4b57('0x2f')]=_[_0x4b57('0x30')](_0x457273['query']);_0x477352['filters']=_[_0x4b57('0x43')](_0x477352[_0x4b57('0x32')],_0x477352[_0x4b57('0x2f')]);_0x189fd0[_0x4b57('0x33')]=_['intersection'](_0x477352[_0x4b57('0x32')],qs[_0x4b57('0x34')](_0x457273['query'][_0x4b57('0x34')]));_0x189fd0['attributes']=_0x189fd0[_0x4b57('0x33')]['length']?_0x189fd0['attributes']:_0x477352[_0x4b57('0x32')];if(_0x457273[_0x4b57('0x2f')]['includeAll']){_0x189fd0[_0x4b57('0x44')]=[{'all':!![]}];}_0x189fd0=_[_0x4b57('0x3b')]({},_0x189fd0,_0x457273[_0x4b57('0x45')]);return db[_0x4b57('0x3c')][_0x4b57('0x46')](_0x189fd0)[_0x4b57('0x23')](handleEntityNotFound(_0x19ba66,null))['then'](respondWithResult(_0x19ba66,null))[_0x4b57('0x40')](handleError(_0x19ba66,null));};exports[_0x4b57('0x47')]=function(_0x4a632c,_0xd529fb){return db[_0x4b57('0x3c')][_0x4b57('0x47')](_0x4a632c['body'],{})[_0x4b57('0x23')](function(_0x5cba5f){var _0x213dca=_0x4a632c[_0x4b57('0x48')][_0x4b57('0x25')]({'plain':!![]});if(!_0x213dca)throw new Error(_0x4b57('0x49'));if(_0x213dca[_0x4b57('0x4a')]===_0x4b57('0x48')){var _0x3d1ecd=_0x5cba5f[_0x4b57('0x25')]({'plain':!![]});var _0x5ab120=_0x4b57('0x26');return db[_0x4b57('0x4b')][_0x4b57('0x46')]({'where':{'name':_0x5ab120,'userProfileId':_0x213dca['userProfileId']},'raw':!![]})[_0x4b57('0x23')](function(_0xcf72b6){if(_0xcf72b6&&_0xcf72b6[_0x4b57('0x4c')]===0x0){return db['UserProfileResource'][_0x4b57('0x47')]({'name':_0x3d1ecd[_0x4b57('0x29')],'resourceId':_0x3d1ecd['id'],'type':_0xcf72b6[_0x4b57('0x29')],'sectionId':_0xcf72b6['id']},{})[_0x4b57('0x23')](function(){return _0x5cba5f;});}else{return _0x5cba5f;}})[_0x4b57('0x40')](function(_0xb7c37c){logger[_0x4b57('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb7c37c);throw _0xb7c37c;});}return _0x5cba5f;})['then'](respondWithResult(_0xd529fb,0xc9))[_0x4b57('0x40')](handleError(_0xd529fb,null));};exports[_0x4b57('0x22')]=function(_0x3b4cbf,_0x2e64c2){if(_0x3b4cbf['body']['id']){delete _0x3b4cbf[_0x4b57('0x4d')]['id'];}return db[_0x4b57('0x3c')][_0x4b57('0x46')]({'where':{'id':_0x3b4cbf[_0x4b57('0x42')]['id']}})['then'](handleEntityNotFound(_0x2e64c2,null))['then'](saveUpdates(_0x3b4cbf[_0x4b57('0x4d')],null))[_0x4b57('0x23')](respondWithResult(_0x2e64c2,null))['catch'](handleError(_0x2e64c2,null));};exports['destroy']=function(_0x451737,_0x5c1082){return db[_0x4b57('0x3c')][_0x4b57('0x46')]({'where':{'id':_0x451737[_0x4b57('0x42')]['id']}})[_0x4b57('0x23')](handleEntityNotFound(_0x5c1082,null))[_0x4b57('0x23')](removeEntity(_0x5c1082,null))['catch'](handleError(_0x5c1082,null));};exports['getMessages']=function(_0x54ff9d,_0x4c241a,_0x179802){return db[_0x4b57('0x3c')]['findOne']({'where':{'id':_0x54ff9d[_0x4b57('0x42')]['id']}})[_0x4b57('0x23')](handleEntityNotFound(_0x4c241a,null))[_0x4b57('0x23')](function(_0x9ed750){var _0x64b0fd;var _0x1fcc10={},_0xf1bf63={};_0xf1bf63[_0x4b57('0x32')]=_[_0x4b57('0x30')](db['VoiceMailMessage'][_0x4b57('0x2c')]);_0xf1bf63['query']=_[_0x4b57('0x30')](_0x54ff9d[_0x4b57('0x2f')]);_0xf1bf63['filters']=_[_0x4b57('0x43')](_0xf1bf63[_0x4b57('0x32')],_0xf1bf63[_0x4b57('0x2f')]);_0x1fcc10[_0x4b57('0x33')]=_[_0x4b57('0x43')](_0xf1bf63[_0x4b57('0x32')],qs[_0x4b57('0x34')](_0x54ff9d[_0x4b57('0x2f')][_0x4b57('0x34')]));_0x1fcc10[_0x4b57('0x33')]=_0x1fcc10[_0x4b57('0x33')][_0x4b57('0x4e')]?_0x1fcc10['attributes']:_0xf1bf63[_0x4b57('0x32')];if(!_0x54ff9d[_0x4b57('0x2f')]['hasOwnProperty'](_0x4b57('0x36'))){_0x1fcc10['limit']=qs['limit'](_0x54ff9d['query'][_0x4b57('0x1b')]);_0x1fcc10['offset']=qs[_0x4b57('0x1d')](_0x54ff9d[_0x4b57('0x2f')]['offset']);}_0x1fcc10['order']=qs[_0x4b57('0x38')](_0x54ff9d[_0x4b57('0x2f')][_0x4b57('0x38')]);_0x1fcc10['where']=qs[_0x4b57('0x31')](_[_0x4b57('0x4f')](_0x54ff9d['query'],_0xf1bf63[_0x4b57('0x31')]));if(_0x54ff9d[_0x4b57('0x2f')]['filter']){_0x1fcc10[_0x4b57('0x39')]=_[_0x4b57('0x3b')](_0x1fcc10[_0x4b57('0x39')],{'$or':_[_0x4b57('0x2b')](_0x1fcc10[_0x4b57('0x33')],function(_0x5d9dd5){var _0x2112d5={};_0x2112d5[_0x5d9dd5]={'$like':'%'+_0x54ff9d['query']['filter']+'%'};return _0x2112d5;})});}_0x1fcc10[_0x4b57('0x39')]=_[_0x4b57('0x3b')](_0x1fcc10['where'],{'mailboxuser':_0x9ed750['mailbox']});_0x1fcc10=_[_0x4b57('0x3b')]({},_0x1fcc10,_0x54ff9d[_0x4b57('0x45')]);return db['VoiceMailMessage']['findAndCountAll'](_0x1fcc10)['then'](respondWithFilteredResult(_0x4c241a,_0x1fcc10));})[_0x4b57('0x40')](handleError(_0x4c241a,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 0ba6888..0024d5a 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 _0x468d=['exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','moment','bluebird','request-promise','path','rimraf','./voiceMail.attributes'];(function(_0x4f6bd5,_0x20b090){var _0x489d33=function(_0x52eccb){while(--_0x52eccb){_0x4f6bd5['push'](_0x4f6bd5['shift']());}};_0x489d33(++_0x20b090);}(_0x468d,0x11f));var _0xd468=function(_0x1908b0,_0x5b42ef){_0x1908b0=_0x1908b0-0x0;var _0x231cc2=_0x468d[_0x1908b0];return _0x231cc2;};'use strict';var _=require(_0xd468('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd468('0x1'));var BPromise=require(_0xd468('0x2'));var rp=require(_0xd468('0x3'));var fs=require('fs');var path=require(_0xd468('0x4'));var rimraf=require(_0xd468('0x5'));var config=require('../../config/environment');var attributes=require(_0xd468('0x6'));module[_0xd468('0x7')]=function(_0x1cc65a,_0x479f08){return _0x1cc65a[_0xd468('0x8')](_0xd468('0x9'),attributes,{'tableName':_0xd468('0xa'),'paranoid':![],'indexes':[{'name':_0xd468('0xb'),'fields':[_0xd468('0xc'),_0xd468('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc146=['context','util','../../config/logger','path','rimraf','../../config/environment','./voiceMail.attributes','define','voice_voicemail'];(function(_0x598b5d,_0x3f4d1e){var _0x54ab06=function(_0x1cf62e){while(--_0x1cf62e){_0x598b5d['push'](_0x598b5d['shift']());}};_0x54ab06(++_0x3f4d1e);}(_0xc146,0x1ba));var _0x6c14=function(_0x3f60e6,_0x1edc51){_0x3f60e6=_0x3f60e6-0x0;var _0xea8e08=_0xc146[_0x3f60e6];return _0xea8e08;};'use strict';var _=require('lodash');var util=require(_0x6c14('0x0'));var logger=require(_0x6c14('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c14('0x2'));var rimraf=require(_0x6c14('0x3'));var config=require(_0x6c14('0x4'));var attributes=require(_0x6c14('0x5'));module['exports']=function(_0x55c4a0,_0x42323d){return _0x55c4a0[_0x6c14('0x6')]('VoiceMail',attributes,{'tableName':_0x6c14('0x7'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0x6c14('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index fa6c84a..e4a137f 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 _0x6db1=['then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','request'];(function(_0x186d17,_0x9fa8ef){var _0x5d4b89=function(_0x57bd70){while(--_0x57bd70){_0x186d17['push'](_0x186d17['shift']());}};_0x5d4b89(++_0x9fa8ef);}(_0x6db1,0x96));var _0x16db=function(_0x424ffe,_0x309b0f){_0x424ffe=_0x424ffe-0x0;var _0x46b1f1=_0x6db1[_0x424ffe];return _0x46b1f1;};'use strict';var _=require(_0x16db('0x0'));var util=require(_0x16db('0x1'));var moment=require(_0x16db('0x2'));var BPromise=require(_0x16db('0x3'));var rs=require(_0x16db('0x4'));var fs=require('fs');var Redis=require(_0x16db('0x5'));var db=require(_0x16db('0x6'))['db'];var utils=require(_0x16db('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x16db('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x105d7f,_0x1d3a14,_0x1b92cd){return new BPromise(function(_0x2d35d6,_0x520e2f){return client[_0x16db('0x9')](_0x105d7f,_0x1b92cd)[_0x16db('0xa')](function(_0x47705e){logger[_0x16db('0xb')](_0x16db('0xc'),_0x1d3a14,_0x16db('0xd'));logger[_0x16db('0xe')](_0x16db('0xf'),_0x1d3a14,_0x16db('0xd'),JSON[_0x16db('0x10')](_0x47705e));if(_0x47705e[_0x16db('0x11')]){if(_0x47705e[_0x16db('0x11')]['code']===0x1f4){logger[_0x16db('0x11')]('VoiceMail,\x20%s,\x20%s',_0x1d3a14,_0x47705e[_0x16db('0x11')][_0x16db('0x12')]);return _0x520e2f(_0x47705e['error'][_0x16db('0x12')]);}logger[_0x16db('0x11')](_0x16db('0xc'),_0x1d3a14,_0x47705e[_0x16db('0x11')][_0x16db('0x12')]);return _0x2d35d6(_0x47705e['error'][_0x16db('0x12')]);}else{logger[_0x16db('0xb')](_0x16db('0xc'),_0x1d3a14,'request\x20sent');_0x2d35d6(_0x47705e[_0x16db('0x13')][_0x16db('0x12')]);}})['catch'](function(_0x483c85){logger[_0x16db('0x11')](_0x16db('0xc'),_0x1d3a14,_0x483c85);_0x520e2f(_0x483c85);});});} \ No newline at end of file +var _0x4454=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5bdfbf,_0x367bde){var _0x3b79f9=function(_0xf6400c){while(--_0xf6400c){_0x5bdfbf['push'](_0x5bdfbf['shift']());}};_0x3b79f9(++_0x367bde);}(_0x4454,0x150));var _0x4445=function(_0x299640,_0x4e525){_0x299640=_0x299640-0x0;var _0x4f2ac3=_0x4454[_0x299640];return _0x4f2ac3;};'use strict';var _=require(_0x4445('0x0'));var util=require(_0x4445('0x1'));var moment=require(_0x4445('0x2'));var BPromise=require(_0x4445('0x3'));var rs=require(_0x4445('0x4'));var fs=require('fs');var Redis=require(_0x4445('0x5'));var db=require(_0x4445('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4445('0x7'))(_0x4445('0x8'));var config=require('../../config/environment');var jayson=require(_0x4445('0x9'));var client=jayson['client'][_0x4445('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cad28,_0x3b29f9,_0x31a9fa){return new BPromise(function(_0x372958,_0x4ff19b){return client[_0x4445('0xb')](_0x3cad28,_0x31a9fa)[_0x4445('0xc')](function(_0x1c4304){logger[_0x4445('0xd')](_0x4445('0xe'),_0x3b29f9,_0x4445('0xf'));logger[_0x4445('0x10')](_0x4445('0x11'),_0x3b29f9,_0x4445('0xf'),JSON[_0x4445('0x12')](_0x1c4304));if(_0x1c4304[_0x4445('0x13')]){if(_0x1c4304[_0x4445('0x13')][_0x4445('0x14')]===0x1f4){logger[_0x4445('0x13')](_0x4445('0xe'),_0x3b29f9,_0x1c4304[_0x4445('0x13')]['message']);return _0x4ff19b(_0x1c4304[_0x4445('0x13')][_0x4445('0x15')]);}logger[_0x4445('0x13')](_0x4445('0xe'),_0x3b29f9,_0x1c4304[_0x4445('0x13')][_0x4445('0x15')]);return _0x372958(_0x1c4304['error'][_0x4445('0x15')]);}else{logger[_0x4445('0xd')](_0x4445('0xe'),_0x3b29f9,'request\x20sent');_0x372958(_0x1c4304[_0x4445('0x16')][_0x4445('0x15')]);}})[_0x4445('0x17')](function(_0x43aff9){logger[_0x4445('0x13')](_0x4445('0xe'),_0x3b29f9,_0x43aff9);_0x4ff19b(_0x43aff9);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index a9b6454..3a6f54c 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 _0xe38a=['/:id/download','download','create','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id'];(function(_0x468547,_0x2abb9e){var _0x1052bb=function(_0x507739){while(--_0x507739){_0x468547['push'](_0x468547['shift']());}};_0x1052bb(++_0x2abb9e);}(_0xe38a,0x1cf));var _0xae38=function(_0xd49fef,_0x23f01e){_0xd49fef=_0xd49fef-0x0;var _0x304be8=_0xe38a[_0xd49fef];return _0x304be8;};'use strict';var multer=require(_0xae38('0x0'));var util=require(_0xae38('0x1'));var path=require(_0xae38('0x2'));var timeout=require('connect-timeout');var express=require(_0xae38('0x3'));var router=express['Router']();var fs_extra=require(_0xae38('0x4'));var auth=require(_0xae38('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xae38('0x6'));var controller=require(_0xae38('0x7'));router[_0xae38('0x8')]('/',auth[_0xae38('0x9')](),controller[_0xae38('0xa')]);router[_0xae38('0x8')](_0xae38('0xb'),auth[_0xae38('0x9')](),controller['show']);router[_0xae38('0x8')](_0xae38('0xc'),auth[_0xae38('0x9')](),controller[_0xae38('0xd')]);router['post']('/',auth[_0xae38('0x9')](),controller[_0xae38('0xe')]);router['put'](_0xae38('0xb'),auth[_0xae38('0x9')](),controller[_0xae38('0xf')]);router[_0xae38('0x10')](_0xae38('0xb'),auth['isAuthenticated'](),controller[_0xae38('0x11')]);module[_0xae38('0x12')]=router; \ No newline at end of file +var _0x5b06=['get','isAuthenticated','index','/:id','show','download','post','put','update','delete','destroy','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller'];(function(_0x841f42,_0x45fc1d){var _0x85b2d7=function(_0x28fd42){while(--_0x28fd42){_0x841f42['push'](_0x841f42['shift']());}};_0x85b2d7(++_0x45fc1d);}(_0x5b06,0xe3));var _0x65b0=function(_0x4ee3a9,_0x575bcc){_0x4ee3a9=_0x4ee3a9-0x0;var _0xa3556c=_0x5b06[_0x4ee3a9];return _0xa3556c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x65b0('0x0'));var timeout=require('connect-timeout');var express=require(_0x65b0('0x1'));var router=express[_0x65b0('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x65b0('0x3'));var interaction=require(_0x65b0('0x4'));var config=require(_0x65b0('0x5'));var controller=require(_0x65b0('0x6'));router[_0x65b0('0x7')]('/',auth[_0x65b0('0x8')](),controller[_0x65b0('0x9')]);router['get'](_0x65b0('0xa'),auth[_0x65b0('0x8')](),controller[_0x65b0('0xb')]);router['get']('/:id/download',auth[_0x65b0('0x8')](),controller[_0x65b0('0xc')]);router[_0x65b0('0xd')]('/',auth[_0x65b0('0x8')](),controller['create']);router[_0x65b0('0xe')](_0x65b0('0xa'),auth['isAuthenticated'](),controller[_0x65b0('0xf')]);router[_0x65b0('0x10')](_0x65b0('0xa'),auth[_0x65b0('0x8')](),controller[_0x65b0('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 7289f83..add4e9c 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 _0xd47d=['sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x39f777,_0xd7ee44){var _0x3502d1=function(_0x89479d){while(--_0x89479d){_0x39f777['push'](_0x39f777['shift']());}};_0x3502d1(++_0xd7ee44);}(_0xd47d,0x136));var _0xdd47=function(_0x5e42a7,_0x3eba35){_0x5e42a7=_0x5e42a7-0x0;var _0x36d21b=_0xd47d[_0x5e42a7];return _0x36d21b;};'use strict';var Sequelize=require(_0xdd47('0x0'));module[_0xdd47('0x1')]={'name':{'type':Sequelize[_0xdd47('0x2')],'get':function(_0x39d15e){return this[_0xdd47('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xdd47('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xdd47('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xdd47('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xdd47('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xdd47('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xdd47('0x5')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xdd47('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xdd47('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xdd47('0x6')](_0xdd47('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0xdd47('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xdd47('0x8'),'defaultValue':Sequelize['literal'](_0xdd47('0x9'))}}; \ No newline at end of file +var _0xc22f=['TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','INTEGER','STRING','long'];(function(_0x13fc45,_0x27004d){var _0x257fe7=function(_0x18a35e){while(--_0x18a35e){_0x13fc45['push'](_0x13fc45['shift']());}};_0x257fe7(++_0x27004d);}(_0xc22f,0xdb));var _0xfc22=function(_0x58b26d,_0x273e24){_0x58b26d=_0x58b26d-0x0;var _0x45aea2=_0xc22f[_0x58b26d];return _0x45aea2;};'use strict';var Sequelize=require('sequelize');module[_0xfc22('0x0')]={'name':{'type':Sequelize[_0xfc22('0x1')],'get':function(_0x17b451){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xfc22('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xfc22('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xfc22('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xfc22('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xfc22('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xfc22('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xfc22('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xfc22('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xfc22('0x3')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xfc22('0x4')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xfc22('0x5'),'defaultValue':Sequelize['literal'](_0xfc22('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 503dd21..180c7ae 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 _0x7bd0=['destroy','end','sendStatus','error','stack','name','send','map','VoiceMailMessage','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','rows','catch','show','params','rawAttributes','create','body','find','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','set','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','save','update','then'];(function(_0x3b934f,_0x59dc45){var _0x136c82=function(_0x321a23){while(--_0x321a23){_0x3b934f['push'](_0x3b934f['shift']());}};_0x136c82(++_0x59dc45);}(_0x7bd0,0x182));var _0x07bd=function(_0x5c6244,_0x112ab8){_0x5c6244=_0x5c6244-0x0;var _0x5800ce=_0x7bd0[_0x5c6244];return _0x5800ce;};'use strict';var emlformat=require(_0x07bd('0x0'));var rimraf=require(_0x07bd('0x1'));var zipdir=require(_0x07bd('0x2'));var jsonpatch=require(_0x07bd('0x3'));var rp=require(_0x07bd('0x4'));var moment=require(_0x07bd('0x5'));var BPromise=require(_0x07bd('0x6'));var Mustache=require(_0x07bd('0x7'));var util=require(_0x07bd('0x8'));var path=require(_0x07bd('0x9'));var sox=require(_0x07bd('0xa'));var csv=require(_0x07bd('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x07bd('0xc'));var _=require(_0x07bd('0xd'));var squel=require('squel');var crypto=require(_0x07bd('0xe'));var jsforce=require(_0x07bd('0xf'));var deskjs=require(_0x07bd('0x10'));var toCsv=require(_0x07bd('0xb'));var querystring=require(_0x07bd('0x11'));var Papa=require('papaparse');var Redis=require(_0x07bd('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x07bd('0x13'));var as=require(_0x07bd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x07bd('0x15'))('api');var utils=require(_0x07bd('0x16'));var config=require(_0x07bd('0x17'));var licenseUtil=require(_0x07bd('0x18'));var db=require(_0x07bd('0x19'))['db'];function respondWithStatusCode(_0x1a58c6,_0x428127){_0x428127=_0x428127||0xcc;return function(_0x3c04ed){if(_0x3c04ed){return _0x1a58c6['sendStatus'](_0x428127);}return _0x1a58c6[_0x07bd('0x1a')](_0x428127)['end']();};}function respondWithResult(_0x11523d,_0x45b2e9){_0x45b2e9=_0x45b2e9||0xc8;return function(_0x2aa6d4){if(_0x2aa6d4){return _0x11523d[_0x07bd('0x1a')](_0x45b2e9)[_0x07bd('0x1b')](_0x2aa6d4);}};}function respondWithFilteredResult(_0x10c961,_0x594688){return function(_0x5a7841){if(_0x5a7841){var _0x5c1aff=typeof _0x594688[_0x07bd('0x1c')]==='undefined'&&typeof _0x594688['limit']===_0x07bd('0x1d');var _0x424b0e=_0x5a7841['count'];var _0x5650a3=_0x5c1aff?0x0:_0x594688['offset'];var _0x19d072=_0x5c1aff?_0x5a7841['count']:_0x594688[_0x07bd('0x1c')]+_0x594688[_0x07bd('0x1e')];var _0x3b124a;if(_0x19d072>=_0x424b0e){_0x19d072=_0x424b0e;_0x3b124a=0xc8;}else{_0x3b124a=0xce;}_0x10c961[_0x07bd('0x1a')](_0x3b124a);return _0x10c961['set']('Content-Range',_0x5650a3+'-'+_0x19d072+'/'+_0x424b0e)[_0x07bd('0x1b')](_0x5a7841);}return null;};}function patchUpdates(_0x141691){return function(_0x57d05c){try{jsonpatch['apply'](_0x57d05c,_0x141691,!![]);}catch(_0x2dcff7){return BPromise['reject'](_0x2dcff7);}return _0x57d05c[_0x07bd('0x1f')]();};}function saveUpdates(_0x30b386,_0x13302d){return function(_0x4236e6){if(_0x4236e6){return _0x4236e6[_0x07bd('0x20')](_0x30b386)[_0x07bd('0x21')](function(_0x51049d){return _0x51049d;});}return null;};}function removeEntity(_0xd6571e,_0x22a4bd){return function(_0x2b04f1){if(_0x2b04f1){return _0x2b04f1[_0x07bd('0x22')]()[_0x07bd('0x21')](function(){_0xd6571e[_0x07bd('0x1a')](0xcc)[_0x07bd('0x23')]();});}};}function handleEntityNotFound(_0x58f018,_0x371ef3){return function(_0x8cf9fb){if(!_0x8cf9fb){_0x58f018[_0x07bd('0x24')](0x194);}return _0x8cf9fb;};}function handleError(_0x50634f,_0x8bbf46){_0x8bbf46=_0x8bbf46||0x1f4;return function(_0x46816e){logger[_0x07bd('0x25')](_0x46816e[_0x07bd('0x26')]);if(_0x46816e[_0x07bd('0x27')]){delete _0x46816e['name'];}_0x50634f['status'](_0x8bbf46)[_0x07bd('0x28')](_0x46816e);};}exports['index']=function(_0x16a3f1,_0x438967){var _0x384de5={},_0x2df2a1={},_0x3a567f={'count':0x0,'rows':[]};var _0x51a8f8=_[_0x07bd('0x29')](db[_0x07bd('0x2a')]['rawAttributes'],function(_0x2ff5b2){return{'name':_0x2ff5b2[_0x07bd('0x2b')],'type':_0x2ff5b2[_0x07bd('0x2c')][_0x07bd('0x2d')]};});_0x2df2a1[_0x07bd('0x2e')]=_[_0x07bd('0x2f')](_['map'](_0x51a8f8,_0x07bd('0x27')),[_0x07bd('0x27')]);_0x2df2a1[_0x07bd('0x30')]=_[_0x07bd('0x31')](_0x16a3f1['query']);_0x2df2a1[_0x07bd('0x32')]=_[_0x07bd('0x33')](_0x2df2a1[_0x07bd('0x2e')],_0x2df2a1[_0x07bd('0x30')]);_0x384de5[_0x07bd('0x34')]=_[_0x07bd('0x33')](_0x2df2a1[_0x07bd('0x2e')],qs[_0x07bd('0x35')](_0x16a3f1[_0x07bd('0x30')][_0x07bd('0x35')]));_0x384de5[_0x07bd('0x34')]=_0x384de5[_0x07bd('0x34')][_0x07bd('0x36')]?_0x384de5['attributes']:_0x2df2a1[_0x07bd('0x2e')];if(!_0x16a3f1[_0x07bd('0x30')][_0x07bd('0x37')](_0x07bd('0x38'))){_0x384de5[_0x07bd('0x1e')]=qs['limit'](_0x16a3f1[_0x07bd('0x30')][_0x07bd('0x1e')]);_0x384de5[_0x07bd('0x1c')]=qs[_0x07bd('0x1c')](_0x16a3f1[_0x07bd('0x30')][_0x07bd('0x1c')]);}_0x384de5[_0x07bd('0x39')]=qs[_0x07bd('0x3a')](_0x16a3f1[_0x07bd('0x30')]['sort']);_0x384de5[_0x07bd('0x3b')]=qs[_0x07bd('0x32')](_[_0x07bd('0x3c')](_0x16a3f1[_0x07bd('0x30')],_0x2df2a1['filters']),_0x51a8f8);if(_0x16a3f1[_0x07bd('0x30')]['filter']){_0x384de5[_0x07bd('0x3b')]=_[_0x07bd('0x3d')](_0x384de5[_0x07bd('0x3b')],{'$or':_[_0x07bd('0x29')](_0x51a8f8,function(_0x296843){if(_0x296843[_0x07bd('0x2c')]!==_0x07bd('0x3e')){var _0x1c5eeb={};_0x1c5eeb[_0x296843[_0x07bd('0x27')]]={'$like':'%'+_0x16a3f1[_0x07bd('0x30')][_0x07bd('0x3f')]+'%'};return _0x1c5eeb;}})});}_0x384de5=_[_0x07bd('0x3d')]({},_0x384de5,_0x16a3f1[_0x07bd('0x40')]);var _0x548bbb={'where':_0x384de5[_0x07bd('0x3b')]};return db[_0x07bd('0x2a')]['count'](_0x548bbb)[_0x07bd('0x21')](function(_0x2c116f){_0x3a567f[_0x07bd('0x41')]=_0x2c116f;if(_0x16a3f1['query'][_0x07bd('0x42')]){_0x384de5[_0x07bd('0x43')]=[{'all':!![]}];}return db[_0x07bd('0x2a')]['findAll'](_0x384de5);})['then'](function(_0xfff75c){_0x3a567f[_0x07bd('0x44')]=_0xfff75c;return _0x3a567f;})[_0x07bd('0x21')](respondWithFilteredResult(_0x438967,_0x384de5))[_0x07bd('0x45')](handleError(_0x438967,null));};exports[_0x07bd('0x46')]=function(_0x238f0a,_0x1c235b){var _0x276987={'raw':!![],'where':{'id':_0x238f0a[_0x07bd('0x47')]['id']}},_0x1ffef8={};_0x1ffef8[_0x07bd('0x2e')]=_[_0x07bd('0x31')](db[_0x07bd('0x2a')][_0x07bd('0x48')]);_0x1ffef8[_0x07bd('0x30')]=_['keys'](_0x238f0a[_0x07bd('0x30')]);_0x1ffef8['filters']=_[_0x07bd('0x33')](_0x1ffef8[_0x07bd('0x2e')],_0x1ffef8[_0x07bd('0x30')]);_0x276987[_0x07bd('0x34')]=_[_0x07bd('0x33')](_0x1ffef8[_0x07bd('0x2e')],qs['fields'](_0x238f0a[_0x07bd('0x30')]['fields']));_0x276987['attributes']=_0x276987[_0x07bd('0x34')][_0x07bd('0x36')]?_0x276987[_0x07bd('0x34')]:_0x1ffef8[_0x07bd('0x2e')];if(_0x238f0a[_0x07bd('0x30')]['includeAll']){_0x276987['include']=[{'all':!![]}];}_0x276987=_[_0x07bd('0x3d')]({},_0x276987,_0x238f0a[_0x07bd('0x40')]);return db[_0x07bd('0x2a')]['find'](_0x276987)[_0x07bd('0x21')](handleEntityNotFound(_0x1c235b,null))[_0x07bd('0x21')](respondWithResult(_0x1c235b,null))[_0x07bd('0x45')](handleError(_0x1c235b,null));};exports[_0x07bd('0x49')]=function(_0xeb1623,_0x4b6817){return db[_0x07bd('0x2a')][_0x07bd('0x49')](_0xeb1623['body'],{})[_0x07bd('0x21')](respondWithResult(_0x4b6817,0xc9))[_0x07bd('0x45')](handleError(_0x4b6817,null));};exports[_0x07bd('0x20')]=function(_0x1282f2,_0x366f47){if(_0x1282f2[_0x07bd('0x4a')]['id']){delete _0x1282f2[_0x07bd('0x4a')]['id'];}return db[_0x07bd('0x2a')]['find']({'where':{'id':_0x1282f2['params']['id']}})[_0x07bd('0x21')](handleEntityNotFound(_0x366f47,null))[_0x07bd('0x21')](saveUpdates(_0x1282f2['body'],null))[_0x07bd('0x21')](respondWithResult(_0x366f47,null))[_0x07bd('0x45')](handleError(_0x366f47,null));};exports[_0x07bd('0x22')]=function(_0x3134e8,_0x3e40fe){return db[_0x07bd('0x2a')][_0x07bd('0x4b')]({'where':{'id':_0x3134e8[_0x07bd('0x47')]['id']}})[_0x07bd('0x21')](handleEntityNotFound(_0x3e40fe,null))['then'](removeEntity(_0x3e40fe,null))[_0x07bd('0x45')](handleError(_0x3e40fe,null));};exports['download']=function(_0x329612,_0x99f770,_0x4e4df6){return db['VoiceMailMessage'][_0x07bd('0x4b')]({'where':{'id':_0x329612[_0x07bd('0x47')]['id']},'attributes':['id',_0x07bd('0x4c'),_0x07bd('0x4d')]})[_0x07bd('0x21')](handleEntityNotFound(_0x99f770,null))[_0x07bd('0x21')](function(_0x5f1414){if(_0x5f1414){if(!_0x5f1414[_0x07bd('0x4c')]){throw new db[(_0x07bd('0x4e'))]['ValidationError'](_0x07bd('0x4f'));}var _0x181e42={'Content-Type':'audio/wav','Content-Disposition':_0x07bd('0x50')};if(_0x5f1414['msg_id']){_0x181e42[_0x07bd('0x51')]=_0x07bd('0x52')+_0x5f1414[_0x07bd('0x4d')]+'.wav\x22';}_0x99f770[_0x07bd('0x53')](_0x181e42);return _0x99f770['send'](new Buffer(_0x5f1414[_0x07bd('0x4c')]));}})[_0x07bd('0x45')](handleError(_0x99f770,null));}; \ No newline at end of file +var _0xad2c=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','VoiceMailMessage','fieldName','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','find','catch','create','update','body','params','download','msg_id','recording','Sequelize','VoiceMailMessage\x20not\x20found','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x55cc76,_0x17217e){var _0x57d4a9=function(_0x3b7076){while(--_0x3b7076){_0x55cc76['push'](_0x55cc76['shift']());}};_0x57d4a9(++_0x17217e);}(_0xad2c,0x179));var _0xcad2=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xad2c[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require(_0xcad2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcad2('0x1'));var jsonpatch=require(_0xcad2('0x2'));var rp=require(_0xcad2('0x3'));var moment=require(_0xcad2('0x4'));var BPromise=require(_0xcad2('0x5'));var Mustache=require(_0xcad2('0x6'));var util=require(_0xcad2('0x7'));var path=require(_0xcad2('0x8'));var sox=require('sox');var csv=require(_0xcad2('0x9'));var ejs=require(_0xcad2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcad2('0xb'));var squel=require('squel');var crypto=require(_0xcad2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xcad2('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcad2('0xe'));var Papa=require(_0xcad2('0xf'));var Redis=require(_0xcad2('0x10'));var authService=require(_0xcad2('0x11'));var qs=require(_0xcad2('0x12'));var as=require(_0xcad2('0x13'));var hardwareService=require(_0xcad2('0x14'));var logger=require(_0xcad2('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xcad2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcad2('0x17'))['db'];function respondWithStatusCode(_0x2841ba,_0x128b05){_0x128b05=_0x128b05||0xcc;return function(_0x1bcdce){if(_0x1bcdce){return _0x2841ba[_0xcad2('0x18')](_0x128b05);}return _0x2841ba[_0xcad2('0x19')](_0x128b05)[_0xcad2('0x1a')]();};}function respondWithResult(_0x4f26fc,_0x1ed0ce){_0x1ed0ce=_0x1ed0ce||0xc8;return function(_0x53db92){if(_0x53db92){return _0x4f26fc['status'](_0x1ed0ce)[_0xcad2('0x1b')](_0x53db92);}};}function respondWithFilteredResult(_0x134683,_0xc7994c){return function(_0x1c1c35){if(_0x1c1c35){var _0x5833b9=typeof _0xc7994c[_0xcad2('0x1c')]===_0xcad2('0x1d')&&typeof _0xc7994c[_0xcad2('0x1e')]==='undefined';var _0x2315db=_0x1c1c35['count'];var _0x528229=_0x5833b9?0x0:_0xc7994c[_0xcad2('0x1c')];var _0x4a0a41=_0x5833b9?_0x1c1c35[_0xcad2('0x1f')]:_0xc7994c[_0xcad2('0x1c')]+_0xc7994c[_0xcad2('0x1e')];var _0xf8ea32;if(_0x4a0a41>=_0x2315db){_0x4a0a41=_0x2315db;_0xf8ea32=0xc8;}else{_0xf8ea32=0xce;}_0x134683[_0xcad2('0x19')](_0xf8ea32);return _0x134683['set'](_0xcad2('0x20'),_0x528229+'-'+_0x4a0a41+'/'+_0x2315db)['json'](_0x1c1c35);}return null;};}function patchUpdates(_0x58d843){return function(_0x258fee){try{jsonpatch[_0xcad2('0x21')](_0x258fee,_0x58d843,!![]);}catch(_0x4343d4){return BPromise[_0xcad2('0x22')](_0x4343d4);}return _0x258fee['save']();};}function saveUpdates(_0x561785,_0x50841b){return function(_0x18d903){if(_0x18d903){return _0x18d903['update'](_0x561785)[_0xcad2('0x23')](function(_0x171daa){return _0x171daa;});}return null;};}function removeEntity(_0xfa7318,_0x459f1d){return function(_0xed9d3b){if(_0xed9d3b){return _0xed9d3b[_0xcad2('0x24')]()['then'](function(){_0xfa7318['status'](0xcc)[_0xcad2('0x1a')]();});}};}function handleEntityNotFound(_0x195071,_0x11fdf2){return function(_0x2bbdb1){if(!_0x2bbdb1){_0x195071[_0xcad2('0x18')](0x194);}return _0x2bbdb1;};}function handleError(_0x45034d,_0x23f93a){_0x23f93a=_0x23f93a||0x1f4;return function(_0xfe1628){logger[_0xcad2('0x25')](_0xfe1628[_0xcad2('0x26')]);if(_0xfe1628[_0xcad2('0x27')]){delete _0xfe1628['name'];}_0x45034d['status'](_0x23f93a)[_0xcad2('0x28')](_0xfe1628);};}exports[_0xcad2('0x29')]=function(_0x2e0ede,_0x128c34){var _0xab9ab3={},_0x19b65f={},_0x894207={'count':0x0,'rows':[]};var _0x52aeef=_['map'](db[_0xcad2('0x2a')]['rawAttributes'],function(_0x2771d6){return{'name':_0x2771d6[_0xcad2('0x2b')],'type':_0x2771d6[_0xcad2('0x2c')]['key']};});_0x19b65f[_0xcad2('0x2d')]=_[_0xcad2('0x2e')](_['map'](_0x52aeef,'name'),['name']);_0x19b65f[_0xcad2('0x2f')]=_[_0xcad2('0x30')](_0x2e0ede['query']);_0x19b65f[_0xcad2('0x31')]=_[_0xcad2('0x32')](_0x19b65f[_0xcad2('0x2d')],_0x19b65f[_0xcad2('0x2f')]);_0xab9ab3[_0xcad2('0x33')]=_[_0xcad2('0x32')](_0x19b65f['model'],qs[_0xcad2('0x34')](_0x2e0ede[_0xcad2('0x2f')]['fields']));_0xab9ab3[_0xcad2('0x33')]=_0xab9ab3[_0xcad2('0x33')][_0xcad2('0x35')]?_0xab9ab3[_0xcad2('0x33')]:_0x19b65f['model'];if(!_0x2e0ede[_0xcad2('0x2f')]['hasOwnProperty']('nolimit')){_0xab9ab3[_0xcad2('0x1e')]=qs[_0xcad2('0x1e')](_0x2e0ede['query'][_0xcad2('0x1e')]);_0xab9ab3[_0xcad2('0x1c')]=qs[_0xcad2('0x1c')](_0x2e0ede[_0xcad2('0x2f')][_0xcad2('0x1c')]);}_0xab9ab3[_0xcad2('0x36')]=qs[_0xcad2('0x37')](_0x2e0ede[_0xcad2('0x2f')]['sort']);_0xab9ab3[_0xcad2('0x38')]=qs['filters'](_['pick'](_0x2e0ede[_0xcad2('0x2f')],_0x19b65f[_0xcad2('0x31')]),_0x52aeef);if(_0x2e0ede[_0xcad2('0x2f')][_0xcad2('0x39')]){_0xab9ab3[_0xcad2('0x38')]=_[_0xcad2('0x3a')](_0xab9ab3[_0xcad2('0x38')],{'$or':_[_0xcad2('0x3b')](_0x52aeef,function(_0x48f11b){if(_0x48f11b['type']!==_0xcad2('0x3c')){var _0x37101e={};_0x37101e[_0x48f11b[_0xcad2('0x27')]]={'$like':'%'+_0x2e0ede[_0xcad2('0x2f')][_0xcad2('0x39')]+'%'};return _0x37101e;}})});}_0xab9ab3=_[_0xcad2('0x3a')]({},_0xab9ab3,_0x2e0ede[_0xcad2('0x3d')]);var _0x4d418d={'where':_0xab9ab3[_0xcad2('0x38')]};return db[_0xcad2('0x2a')]['count'](_0x4d418d)[_0xcad2('0x23')](function(_0x45a0a7){_0x894207[_0xcad2('0x1f')]=_0x45a0a7;if(_0x2e0ede[_0xcad2('0x2f')][_0xcad2('0x3e')]){_0xab9ab3[_0xcad2('0x3f')]=[{'all':!![]}];}return db[_0xcad2('0x2a')][_0xcad2('0x40')](_0xab9ab3);})[_0xcad2('0x23')](function(_0x4dbb7e){_0x894207['rows']=_0x4dbb7e;return _0x894207;})[_0xcad2('0x23')](respondWithFilteredResult(_0x128c34,_0xab9ab3))['catch'](handleError(_0x128c34,null));};exports['show']=function(_0x167a13,_0x5e9720){var _0x4fc3c5={'raw':!![],'where':{'id':_0x167a13['params']['id']}},_0x39d75b={};_0x39d75b[_0xcad2('0x2d')]=_['keys'](db[_0xcad2('0x2a')]['rawAttributes']);_0x39d75b['query']=_[_0xcad2('0x30')](_0x167a13[_0xcad2('0x2f')]);_0x39d75b['filters']=_[_0xcad2('0x32')](_0x39d75b['model'],_0x39d75b[_0xcad2('0x2f')]);_0x4fc3c5[_0xcad2('0x33')]=_['intersection'](_0x39d75b['model'],qs['fields'](_0x167a13[_0xcad2('0x2f')]['fields']));_0x4fc3c5[_0xcad2('0x33')]=_0x4fc3c5[_0xcad2('0x33')][_0xcad2('0x35')]?_0x4fc3c5[_0xcad2('0x33')]:_0x39d75b['model'];if(_0x167a13['query'][_0xcad2('0x3e')]){_0x4fc3c5[_0xcad2('0x3f')]=[{'all':!![]}];}_0x4fc3c5=_['merge']({},_0x4fc3c5,_0x167a13['options']);return db[_0xcad2('0x2a')][_0xcad2('0x41')](_0x4fc3c5)[_0xcad2('0x23')](handleEntityNotFound(_0x5e9720,null))['then'](respondWithResult(_0x5e9720,null))[_0xcad2('0x42')](handleError(_0x5e9720,null));};exports['create']=function(_0x18f360,_0x45455b){return db[_0xcad2('0x2a')][_0xcad2('0x43')](_0x18f360['body'],{})[_0xcad2('0x23')](respondWithResult(_0x45455b,0xc9))['catch'](handleError(_0x45455b,null));};exports[_0xcad2('0x44')]=function(_0xbc12f4,_0x3472d2){if(_0xbc12f4[_0xcad2('0x45')]['id']){delete _0xbc12f4[_0xcad2('0x45')]['id'];}return db[_0xcad2('0x2a')][_0xcad2('0x41')]({'where':{'id':_0xbc12f4[_0xcad2('0x46')]['id']}})[_0xcad2('0x23')](handleEntityNotFound(_0x3472d2,null))['then'](saveUpdates(_0xbc12f4[_0xcad2('0x45')],null))['then'](respondWithResult(_0x3472d2,null))['catch'](handleError(_0x3472d2,null));};exports[_0xcad2('0x24')]=function(_0x2c4aa2,_0x5aef24){return db[_0xcad2('0x2a')][_0xcad2('0x41')]({'where':{'id':_0x2c4aa2[_0xcad2('0x46')]['id']}})['then'](handleEntityNotFound(_0x5aef24,null))[_0xcad2('0x23')](removeEntity(_0x5aef24,null))[_0xcad2('0x42')](handleError(_0x5aef24,null));};exports[_0xcad2('0x47')]=function(_0x252ad3,_0xcc8100,_0x43f82f){return db[_0xcad2('0x2a')][_0xcad2('0x41')]({'where':{'id':_0x252ad3[_0xcad2('0x46')]['id']},'attributes':['id','recording',_0xcad2('0x48')]})['then'](handleEntityNotFound(_0xcc8100,null))[_0xcad2('0x23')](function(_0xda08c2){if(_0xda08c2){if(!_0xda08c2[_0xcad2('0x49')]){throw new db[(_0xcad2('0x4a'))]['ValidationError'](_0xcad2('0x4b'));}var _0x250093={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0xda08c2[_0xcad2('0x48')]){_0x250093[_0xcad2('0x4c')]=_0xcad2('0x4d')+_0xda08c2[_0xcad2('0x48')]+_0xcad2('0x4e');}_0xcc8100['set'](_0x250093);return _0xcc8100[_0xcad2('0x28')](new Buffer(_0xda08c2[_0xcad2('0x49')]));}})[_0xcad2('0x42')](handleError(_0xcc8100,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 2889f4c..1bbeeb9 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 _0x858a=['../../config/logger','api','./voiceMailMessage.attributes','exports','VoiceMailMessage','voice_voicemail_messages','dir','util'];(function(_0x5cf2e2,_0x3ba099){var _0x2abbe7=function(_0x269f34){while(--_0x269f34){_0x5cf2e2['push'](_0x5cf2e2['shift']());}};_0x2abbe7(++_0x3ba099);}(_0x858a,0x1d7));var _0xa858=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x858a[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0xa858('0x0'));var logger=require(_0xa858('0x1'))(_0xa858('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('../../config/environment');var attributes=require(_0xa858('0x3'));module[_0xa858('0x4')]=function(_0x4308f1,_0x108085){return _0x4308f1['define'](_0xa858('0x5'),attributes,{'tableName':_0xa858('0x6'),'paranoid':![],'indexes':[{'name':_0xa858('0x7'),'fields':[_0xa858('0x7')]}],'timestamps':![]});}; \ No newline at end of file +var _0x095d=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','VoiceMailMessage','voice_voicemail_messages','dir'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0x095d,0x174));var _0xd095=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0x095d[_0x158f01];return _0x5ef74e;};'use strict';var _=require(_0xd095('0x0'));var util=require(_0xd095('0x1'));var logger=require('../../config/logger')(_0xd095('0x2'));var moment=require(_0xd095('0x3'));var BPromise=require(_0xd095('0x4'));var rp=require(_0xd095('0x5'));var fs=require('fs');var path=require(_0xd095('0x6'));var rimraf=require('rimraf');var config=require(_0xd095('0x7'));var attributes=require('./voiceMailMessage.attributes');module[_0xd095('0x8')]=function(_0x63003a,_0x1e57e){return _0x63003a['define'](_0xd095('0x9'),attributes,{'tableName':_0xd095('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0xd095('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index d7adf47..77d1cbd 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 _0xcc02=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','catch','lodash'];(function(_0x575057,_0x14baf3){var _0x49dbc8=function(_0x23599a){while(--_0x23599a){_0x575057['push'](_0x575057['shift']());}};_0x49dbc8(++_0x14baf3);}(_0xcc02,0x197));var _0x2cc0=function(_0x24cc90,_0x31d669){_0x24cc90=_0x24cc90-0x0;var _0x2611b6=_0xcc02[_0x24cc90];return _0x2611b6;};'use strict';var _=require(_0x2cc0('0x0'));var util=require(_0x2cc0('0x1'));var moment=require(_0x2cc0('0x2'));var BPromise=require(_0x2cc0('0x3'));var rs=require(_0x2cc0('0x4'));var fs=require('fs');var Redis=require(_0x2cc0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2cc0('0x6'));var logger=require(_0x2cc0('0x7'))(_0x2cc0('0x8'));var config=require(_0x2cc0('0x9'));var jayson=require(_0x2cc0('0xa'));var client=jayson[_0x2cc0('0xb')][_0x2cc0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5b4214,_0x59850c,_0x48a680){return new BPromise(function(_0x2ae48d,_0x2cbe14){return client[_0x2cc0('0xd')](_0x5b4214,_0x48a680)[_0x2cc0('0xe')](function(_0x18cfcc){logger[_0x2cc0('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x59850c,'request\x20sent');logger['debug'](_0x2cc0('0x10'),_0x59850c,_0x2cc0('0x11'),JSON[_0x2cc0('0x12')](_0x18cfcc));if(_0x18cfcc[_0x2cc0('0x13')]){if(_0x18cfcc[_0x2cc0('0x13')][_0x2cc0('0x14')]===0x1f4){logger[_0x2cc0('0x13')](_0x2cc0('0x15'),_0x59850c,_0x18cfcc[_0x2cc0('0x13')][_0x2cc0('0x16')]);return _0x2cbe14(_0x18cfcc['error'][_0x2cc0('0x16')]);}logger[_0x2cc0('0x13')](_0x2cc0('0x15'),_0x59850c,_0x18cfcc['error'][_0x2cc0('0x16')]);return _0x2ae48d(_0x18cfcc['error'][_0x2cc0('0x16')]);}else{logger[_0x2cc0('0xf')](_0x2cc0('0x15'),_0x59850c,_0x2cc0('0x11'));_0x2ae48d(_0x18cfcc['result'][_0x2cc0('0x16')]);}})[_0x2cc0('0x17')](function(_0x55fd9c){logger[_0x2cc0('0x13')](_0x2cc0('0x15'),_0x59850c,_0x55fd9c);_0x2cbe14(_0x55fd9c);});});} \ No newline at end of file +var _0x170c=['client','http','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x421171,_0x1932c5){var _0x4cf8a2=function(_0x53e0ab){while(--_0x53e0ab){_0x421171['push'](_0x421171['shift']());}};_0x4cf8a2(++_0x1932c5);}(_0x170c,0x86));var _0xc170=function(_0x66fdfe,_0x4a2877){_0x66fdfe=_0x66fdfe-0x0;var _0x317586=_0x170c[_0x66fdfe];return _0x317586;};'use strict';var _=require(_0xc170('0x0'));var util=require(_0xc170('0x1'));var moment=require(_0xc170('0x2'));var BPromise=require(_0xc170('0x3'));var rs=require(_0xc170('0x4'));var fs=require('fs');var Redis=require(_0xc170('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc170('0x6'));var logger=require(_0xc170('0x7'))(_0xc170('0x8'));var config=require('../../config/environment');var jayson=require(_0xc170('0x9'));var client=jayson[_0xc170('0xa')][_0xc170('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53ff39,_0x199d3a,_0x327ee9){return new BPromise(function(_0x5f4315,_0x58da0f){return client[_0xc170('0xc')](_0x53ff39,_0x327ee9)[_0xc170('0xd')](function(_0xf1ecb5){logger['info'](_0xc170('0xe'),_0x199d3a,_0xc170('0xf'));logger['debug'](_0xc170('0x10'),_0x199d3a,_0xc170('0xf'),JSON[_0xc170('0x11')](_0xf1ecb5));if(_0xf1ecb5[_0xc170('0x12')]){if(_0xf1ecb5[_0xc170('0x12')][_0xc170('0x13')]===0x1f4){logger[_0xc170('0x12')](_0xc170('0xe'),_0x199d3a,_0xf1ecb5[_0xc170('0x12')][_0xc170('0x14')]);return _0x58da0f(_0xf1ecb5[_0xc170('0x12')][_0xc170('0x14')]);}logger[_0xc170('0x12')](_0xc170('0xe'),_0x199d3a,_0xf1ecb5['error'][_0xc170('0x14')]);return _0x5f4315(_0xf1ecb5['error'][_0xc170('0x14')]);}else{logger[_0xc170('0x15')](_0xc170('0xe'),_0x199d3a,_0xc170('0xf'));_0x5f4315(_0xf1ecb5[_0xc170('0x16')]['message']);}})[_0xc170('0x17')](function(_0x1464c9){logger[_0xc170('0x12')](_0xc170('0xe'),_0x199d3a,_0x1464c9);_0x58da0f(_0x1464c9);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 0f41ec2..ac27362 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 _0xc8b5=['destroy','/:id/sounds/:id2','removeSound','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index','/:id','isAuthenticated','show','getSounds','post','addSound','put','update','delete'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xc8b5,0x94));var _0x5c8b=function(_0x25bba7,_0x314727){_0x25bba7=_0x25bba7-0x0;var _0x2c13c4=_0xc8b5[_0x25bba7];return _0x2c13c4;};'use strict';var multer=require(_0x5c8b('0x0'));var util=require(_0x5c8b('0x1'));var path=require('path');var timeout=require(_0x5c8b('0x2'));var express=require(_0x5c8b('0x3'));var router=express[_0x5c8b('0x4')]();var fs_extra=require(_0x5c8b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5c8b('0x6'));var config=require(_0x5c8b('0x7'));var controller=require(_0x5c8b('0x8'));router[_0x5c8b('0x9')]('/',auth['isAuthenticated'](),controller[_0x5c8b('0xa')]);router['get'](_0x5c8b('0xb'),auth[_0x5c8b('0xc')](),controller[_0x5c8b('0xd')]);router[_0x5c8b('0x9')]('/:id/sounds',auth['isAuthenticated'](),controller[_0x5c8b('0xe')]);router[_0x5c8b('0xf')]('/',auth[_0x5c8b('0xc')](),controller['create']);router['post']('/:id/sounds',auth['isAuthenticated'](),controller[_0x5c8b('0x10')]);router[_0x5c8b('0x11')](_0x5c8b('0xb'),auth[_0x5c8b('0xc')](),controller[_0x5c8b('0x12')]);router[_0x5c8b('0x13')](_0x5c8b('0xb'),auth['isAuthenticated'](),controller[_0x5c8b('0x14')]);router['delete'](_0x5c8b('0x15'),auth['isAuthenticated'](),controller[_0x5c8b('0x16')]);module[_0x5c8b('0x17')]=router; \ No newline at end of file +var _0xa68b=['../../components/interaction/service','./voiceMusicOnHold.controller','isAuthenticated','get','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','update','delete','destroy','removeSound','exports','util','connect-timeout','Router'];(function(_0x3600a9,_0x4a3cbb){var _0x4532fd=function(_0x1e66aa){while(--_0x1e66aa){_0x3600a9['push'](_0x3600a9['shift']());}};_0x4532fd(++_0x4a3cbb);}(_0xa68b,0x1dd));var _0xba68=function(_0x102f97,_0x5bda2f){_0x102f97=_0x102f97-0x0;var _0xd22058=_0xa68b[_0x102f97];return _0xd22058;};'use strict';var multer=require('multer');var util=require(_0xba68('0x0'));var path=require('path');var timeout=require(_0xba68('0x1'));var express=require('express');var router=express[_0xba68('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xba68('0x3'));var config=require('../../config/environment');var controller=require(_0xba68('0x4'));router['get']('/',auth[_0xba68('0x5')](),controller['index']);router[_0xba68('0x6')](_0xba68('0x7'),auth[_0xba68('0x5')](),controller[_0xba68('0x8')]);router[_0xba68('0x6')](_0xba68('0x9'),auth[_0xba68('0x5')](),controller[_0xba68('0xa')]);router[_0xba68('0xb')]('/',auth[_0xba68('0x5')](),controller[_0xba68('0xc')]);router['post'](_0xba68('0x9'),auth[_0xba68('0x5')](),controller[_0xba68('0xd')]);router[_0xba68('0xe')](_0xba68('0x7'),auth[_0xba68('0x5')](),controller[_0xba68('0xf')]);router[_0xba68('0x10')](_0xba68('0x7'),auth[_0xba68('0x5')](),controller[_0xba68('0x11')]);router[_0xba68('0x10')]('/:id/sounds/:id2',auth[_0xba68('0x5')](),controller[_0xba68('0x12')]);module[_0xba68('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 690d0ee..6ad4464 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 _0xa007=['exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN'];(function(_0x37aed4,_0x254b7d){var _0x1ec4f3=function(_0x2fcefc){while(--_0x2fcefc){_0x37aed4['push'](_0x37aed4['shift']());}};_0x1ec4f3(++_0x254b7d);}(_0xa007,0xfc));var _0x7a00=function(_0x26fa43,_0x30a86c){_0x26fa43=_0x26fa43-0x0;var _0x81ca8d=_0xa007[_0x26fa43];return _0x81ca8d;};'use strict';var Sequelize=require('sequelize');module[_0x7a00('0x0')]={'name':{'type':Sequelize[_0x7a00('0x1')],'allowNull':![],'unique':_0x7a00('0x2')},'mode':{'type':Sequelize[_0x7a00('0x3')](_0x7a00('0x4'),_0x7a00('0x5'),_0x7a00('0x6'),'quietmp3nb',_0x7a00('0x7'),_0x7a00('0x8')),'allowNull':!![],'defaultValue':_0x7a00('0x5')},'directory':{'type':Sequelize[_0x7a00('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x7a00('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x7a00('0x1')],'allowNull':!![],'defaultValue':_0x7a00('0x9')},'format':{'type':Sequelize[_0x7a00('0x1')],'allowNull':!![]},'stamp':{'type':_0x7a00('0xa')},'defaultEntry':{'type':Sequelize[_0x7a00('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x460a=['alpha','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3'];(function(_0x54ba2b,_0x1a430b){var _0x549420=function(_0x39346d){while(--_0x39346d){_0x54ba2b['push'](_0x54ba2b['shift']());}};_0x549420(++_0x1a430b);}(_0x460a,0xf3));var _0xa460=function(_0xaaf2e2,_0x19d28a){_0xaaf2e2=_0xaaf2e2-0x0;var _0x28bc36=_0x460a[_0xaaf2e2];return _0x28bc36;};'use strict';var Sequelize=require('sequelize');module[_0xa460('0x0')]={'name':{'type':Sequelize[_0xa460('0x1')],'allowNull':![],'unique':_0xa460('0x2')},'mode':{'type':Sequelize[_0xa460('0x3')](_0xa460('0x4'),_0xa460('0x5'),_0xa460('0x6'),_0xa460('0x7'),_0xa460('0x8'),_0xa460('0x9')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xa460('0xa')},'format':{'type':Sequelize[_0xa460('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 936edec..849e388 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 _0xe829=['name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','nolimit','limit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','unlinkSync','rmdirSync','Sequelize','sequelize','transaction','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','symlinkSync','ValidationError','message','removeSound','id2','getSounds','fields','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','set','Content-Range','json','reject','then','destroy','get','UserProfileResource','stack'];(function(_0x1bda3f,_0x342262){var _0x1a5da1=function(_0x2a864f){while(--_0x2a864f){_0x1bda3f['push'](_0x1bda3f['shift']());}};_0x1a5da1(++_0x342262);}(_0xe829,0xc6));var _0x9e82=function(_0x534157,_0x5e0173){_0x534157=_0x534157-0x0;var _0x2bb356=_0xe829[_0x534157];return _0x2bb356;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9e82('0x0'));var zipdir=require(_0x9e82('0x1'));var jsonpatch=require(_0x9e82('0x2'));var rp=require(_0x9e82('0x3'));var moment=require('moment');var BPromise=require(_0x9e82('0x4'));var Mustache=require(_0x9e82('0x5'));var util=require(_0x9e82('0x6'));var path=require(_0x9e82('0x7'));var sox=require(_0x9e82('0x8'));var csv=require(_0x9e82('0x9'));var ejs=require(_0x9e82('0xa'));var fs=require('fs');var fs_extra=require(_0x9e82('0xb'));var _=require(_0x9e82('0xc'));var squel=require(_0x9e82('0xd'));var crypto=require(_0x9e82('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9e82('0xf'));var toCsv=require(_0x9e82('0x9'));var querystring=require(_0x9e82('0x10'));var Papa=require(_0x9e82('0x11'));var Redis=require(_0x9e82('0x12'));var authService=require(_0x9e82('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e82('0x14'));var logger=require(_0x9e82('0x15'))(_0x9e82('0x16'));var utils=require(_0x9e82('0x17'));var config=require(_0x9e82('0x18'));var licenseUtil=require(_0x9e82('0x19'));var db=require(_0x9e82('0x1a'))['db'];function respondWithStatusCode(_0x1e05e7,_0x487c3b){_0x487c3b=_0x487c3b||0xcc;return function(_0x400545){if(_0x400545){return _0x1e05e7[_0x9e82('0x1b')](_0x487c3b);}return _0x1e05e7[_0x9e82('0x1c')](_0x487c3b)[_0x9e82('0x1d')]();};}function respondWithResult(_0x18397b,_0x136460){_0x136460=_0x136460||0xc8;return function(_0x24279a){if(_0x24279a){return _0x18397b['status'](_0x136460)['json'](_0x24279a);}};}function respondWithFilteredResult(_0x48009f,_0x4c8ab7){return function(_0x5ba88a){if(_0x5ba88a){var _0x2e724b=typeof _0x4c8ab7['offset']===_0x9e82('0x1e')&&typeof _0x4c8ab7['limit']===_0x9e82('0x1e');var _0xe1a5a2=_0x5ba88a[_0x9e82('0x1f')];var _0x57b34a=_0x2e724b?0x0:_0x4c8ab7[_0x9e82('0x20')];var _0x1d5e68=_0x2e724b?_0x5ba88a[_0x9e82('0x1f')]:_0x4c8ab7[_0x9e82('0x20')]+_0x4c8ab7['limit'];var _0x411041;if(_0x1d5e68>=_0xe1a5a2){_0x1d5e68=_0xe1a5a2;_0x411041=0xc8;}else{_0x411041=0xce;}_0x48009f[_0x9e82('0x1c')](_0x411041);return _0x48009f[_0x9e82('0x21')](_0x9e82('0x22'),_0x57b34a+'-'+_0x1d5e68+'/'+_0xe1a5a2)[_0x9e82('0x23')](_0x5ba88a);}return null;};}function patchUpdates(_0x34b02a){return function(_0x13642a){try{jsonpatch['apply'](_0x13642a,_0x34b02a,!![]);}catch(_0x23e3ba){return BPromise[_0x9e82('0x24')](_0x23e3ba);}return _0x13642a['save']();};}function saveUpdates(_0x464a39,_0x25303b){return function(_0x2c9bc5){if(_0x2c9bc5){return _0x2c9bc5['update'](_0x464a39)[_0x9e82('0x25')](function(_0x346d22){return _0x346d22;});}return null;};}function removeEntity(_0x158b3b,_0x3403c1){return function(_0x595859){if(_0x595859){return _0x595859[_0x9e82('0x26')]()[_0x9e82('0x25')](function(){var _0x4c9f48=_0x595859[_0x9e82('0x27')]({'plain':!![]});var _0x4adf59='MusicOnHolds';return db[_0x9e82('0x28')][_0x9e82('0x26')]({'where':{'type':_0x4adf59,'resourceId':_0x4c9f48['id']}})[_0x9e82('0x25')](function(){return _0x595859;});})[_0x9e82('0x25')](function(){_0x158b3b[_0x9e82('0x1c')](0xcc)[_0x9e82('0x1d')]();});}};}function handleEntityNotFound(_0x4e044c,_0x1705c2){return function(_0x441212){if(!_0x441212){_0x4e044c[_0x9e82('0x1b')](0x194);}return _0x441212;};}function handleError(_0x31fe0f,_0x5509f2){_0x5509f2=_0x5509f2||0x1f4;return function(_0x2e2305){logger['error'](_0x2e2305[_0x9e82('0x29')]);if(_0x2e2305['name']){delete _0x2e2305[_0x9e82('0x2a')];}_0x31fe0f[_0x9e82('0x1c')](_0x5509f2)[_0x9e82('0x2b')](_0x2e2305);};}exports[_0x9e82('0x2c')]=function(_0x570782,_0x5d8545){var _0x410afc={},_0x2686b2={},_0x4e6d00={'count':0x0,'rows':[]};var _0x48e4d0=_[_0x9e82('0x2d')](db[_0x9e82('0x2e')][_0x9e82('0x2f')],function(_0x20dae7){return{'name':_0x20dae7[_0x9e82('0x30')],'type':_0x20dae7[_0x9e82('0x31')][_0x9e82('0x32')]};});_0x2686b2[_0x9e82('0x33')]=_[_0x9e82('0x2d')](_0x48e4d0,_0x9e82('0x2a'));_0x2686b2[_0x9e82('0x34')]=_[_0x9e82('0x35')](_0x570782[_0x9e82('0x34')]);_0x2686b2['filters']=_[_0x9e82('0x36')](_0x2686b2[_0x9e82('0x33')],_0x2686b2['query']);_0x410afc['attributes']=_[_0x9e82('0x36')](_0x2686b2['model'],qs['fields'](_0x570782[_0x9e82('0x34')]['fields']));_0x410afc[_0x9e82('0x37')]=_0x410afc[_0x9e82('0x37')][_0x9e82('0x38')]?_0x410afc['attributes']:_0x2686b2['model'];if(!_0x570782[_0x9e82('0x34')]['hasOwnProperty'](_0x9e82('0x39'))){_0x410afc[_0x9e82('0x3a')]=qs['limit'](_0x570782['query'][_0x9e82('0x3a')]);_0x410afc[_0x9e82('0x20')]=qs['offset'](_0x570782[_0x9e82('0x34')][_0x9e82('0x20')]);}_0x410afc[_0x9e82('0x3b')]=qs['sort'](_0x570782[_0x9e82('0x34')][_0x9e82('0x3c')]);delete _0x570782[_0x9e82('0x34')][_0x9e82('0x3c')];_0x410afc['where']=qs[_0x9e82('0x3d')](_[_0x9e82('0x3e')](_0x570782['query'],_0x2686b2[_0x9e82('0x3d')]),_0x48e4d0);if(_0x570782['query']['filter']){_0x410afc[_0x9e82('0x3f')]=_[_0x9e82('0x40')](_0x410afc[_0x9e82('0x3f')],{'$or':_['map'](_0x48e4d0,function(_0x232078){if(_0x232078[_0x9e82('0x31')]!==_0x9e82('0x41')){var _0x2c9b34={};_0x2c9b34[_0x232078['name']]={'$like':'%'+_0x570782[_0x9e82('0x34')][_0x9e82('0x42')]+'%'};return _0x2c9b34;}})});}_0x410afc=_[_0x9e82('0x40')]({},_0x410afc,_0x570782[_0x9e82('0x43')]);var _0x4e0196={'where':_0x410afc[_0x9e82('0x3f')]};return db[_0x9e82('0x2e')]['count'](_0x4e0196)[_0x9e82('0x25')](function(_0x2e49d6){_0x4e6d00['count']=_0x2e49d6;if(_0x570782[_0x9e82('0x34')][_0x9e82('0x44')]){_0x410afc[_0x9e82('0x45')]=[{'all':!![]}];}return db[_0x9e82('0x2e')][_0x9e82('0x46')](_0x410afc);})[_0x9e82('0x25')](function(_0x2e6b08){_0x4e6d00[_0x9e82('0x47')]=_0x2e6b08;return _0x4e6d00;})[_0x9e82('0x25')](respondWithFilteredResult(_0x5d8545,_0x410afc))[_0x9e82('0x48')](handleError(_0x5d8545,null));};exports[_0x9e82('0x49')]=function(_0x325e3a,_0x3d3b6e){var _0x3eaf5d={'raw':![],'where':{'id':_0x325e3a[_0x9e82('0x4a')]['id']}},_0x44f56a={};_0x44f56a['model']=_[_0x9e82('0x35')](db[_0x9e82('0x2e')][_0x9e82('0x2f')]);_0x44f56a[_0x9e82('0x34')]=_[_0x9e82('0x35')](_0x325e3a['query']);_0x44f56a['filters']=_[_0x9e82('0x36')](_0x44f56a[_0x9e82('0x33')],_0x44f56a[_0x9e82('0x34')]);_0x3eaf5d[_0x9e82('0x37')]=_['intersection'](_0x44f56a[_0x9e82('0x33')],qs['fields'](_0x325e3a[_0x9e82('0x34')]['fields']));_0x3eaf5d[_0x9e82('0x37')]=_0x3eaf5d[_0x9e82('0x37')][_0x9e82('0x38')]?_0x3eaf5d[_0x9e82('0x37')]:_0x44f56a['model'];if(_0x325e3a['query'][_0x9e82('0x44')]){_0x3eaf5d[_0x9e82('0x45')]=[{'all':!![]}];}_0x3eaf5d=_[_0x9e82('0x40')]({},_0x3eaf5d,_0x325e3a[_0x9e82('0x43')]);return db[_0x9e82('0x2e')][_0x9e82('0x4b')](_0x3eaf5d)[_0x9e82('0x25')](handleEntityNotFound(_0x3d3b6e,null))[_0x9e82('0x25')](respondWithResult(_0x3d3b6e,null))[_0x9e82('0x48')](handleError(_0x3d3b6e,null));};exports[_0x9e82('0x4c')]=function(_0x44a710,_0x2dca8c){if(_0x44a710[_0x9e82('0x4d')]['id']){delete _0x44a710['body']['id'];}return db[_0x9e82('0x2e')][_0x9e82('0x4b')]({'where':{'id':_0x44a710[_0x9e82('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2dca8c,null))['then'](saveUpdates(_0x44a710['body'],null))[_0x9e82('0x25')](respondWithResult(_0x2dca8c,null))[_0x9e82('0x48')](handleError(_0x2dca8c,null));};exports[_0x9e82('0x4e')]=function(_0x6640ea,_0xd49751,_0x24f853){return db['sequelize']['transaction'](function(_0x24dc3b){if(_0x6640ea[_0x9e82('0x4d')][_0x9e82('0x4f')]===_0x9e82('0x50')){_0x6640ea[_0x9e82('0x4d')][_0x9e82('0x51')]=path[_0x9e82('0x52')](config[_0x9e82('0x53')],_0x9e82('0x54'),_0x6640ea['body'][_0x9e82('0x2a')]);}return db['VoiceMusicOnHold'][_0x9e82('0x4e')](_0x6640ea[_0x9e82('0x4d')],{'transaction':_0x24dc3b})[_0x9e82('0x25')](function(_0x535a2e){if(_0x6640ea[_0x9e82('0x4d')]['mode']===_0x9e82('0x50')){fs[_0x9e82('0x55')](_0x535a2e[_0x9e82('0x51')],parseInt(_0x9e82('0x56'),0x8));}var _0x4fb765=_0x6640ea[_0x9e82('0x57')]['get']({'plain':!![]});if(!_0x4fb765)throw new Error(_0x9e82('0x58'));if(_0x4fb765[_0x9e82('0x59')]===_0x9e82('0x57')){var _0x479625=_0x535a2e[_0x9e82('0x27')]({'plain':!![]});return db[_0x9e82('0x5a')][_0x9e82('0x4b')]({'where':{'name':_0x9e82('0x5b'),'userProfileId':_0x4fb765[_0x9e82('0x5c')]},'raw':!![]})[_0x9e82('0x25')](function(_0x3700aa){if(_0x3700aa&&_0x3700aa[_0x9e82('0x5d')]===0x0){return db[_0x9e82('0x28')][_0x9e82('0x4e')]({'name':_0x479625[_0x9e82('0x2a')],'resourceId':_0x479625['id'],'type':_0x3700aa['name'],'sectionId':_0x3700aa['id']},{})[_0x9e82('0x25')](function(){return _0x535a2e;});}else{return _0x535a2e;}})[_0x9e82('0x48')](function(_0x191ca9){logger[_0x9e82('0x5e')](_0x9e82('0x5f'),_0x191ca9);});}return _0x535a2e;});})['then'](respondWithResult(_0xd49751,0xc9))[_0x9e82('0x48')](handleError(_0xd49751,null));};exports['destroy']=function(_0x19d10f,_0x5908e2,_0x5c6688){var _0x491b87;return db[_0x9e82('0x2e')]['find']({'where':{'id':_0x19d10f['params']['id']}})['then'](function(_0x4bbbbd){if(_0x4bbbbd){return db['sequelize']['transaction'](function(_0x489ffe){return _0x4bbbbd['destroy']({'transaction':_0x489ffe,'raw':!![]})[_0x9e82('0x25')](function(_0x566c75){if(_0x566c75[_0x9e82('0x51')]){fs[_0x9e82('0x60')](_0x566c75[_0x9e82('0x51')])['forEach'](function(_0x29ad35){fs[_0x9e82('0x61')](path[_0x9e82('0x52')](_0x566c75[_0x9e82('0x51')],_0x29ad35));});fs[_0x9e82('0x62')](_0x566c75['directory']);}return _0x566c75;});})[_0x9e82('0x48')](function(_0x16f4b9){throw new db[(_0x9e82('0x63'))]['ValidationError'](_0x16f4b9['message']);});}})[_0x9e82('0x25')](handleEntityNotFound(_0x5908e2,null))[_0x9e82('0x25')](removeEntity(_0x5908e2,null))[_0x9e82('0x48')](handleError(_0x5908e2,null));};exports['addSound']=function(_0x14b983,_0x5f1fd9,_0x3d83c7){return db[_0x9e82('0x64')][_0x9e82('0x65')](function(_0x10cb23){var _0x1be85d;return db[_0x9e82('0x2e')][_0x9e82('0x4b')]({'where':{'id':_0x14b983['params']['id']}})['then'](function(_0x286003){if(_0x286003){_0x1be85d=_0x286003;return _0x286003[_0x9e82('0x66')](_0x14b983['body']['id'],{'transaction':_0x10cb23});}})[_0x9e82('0x25')](function(_0x4d6f28){if(_0x4d6f28){return db[_0x9e82('0x67')][_0x9e82('0x68')]({'where':{'id':_0x14b983['body']['id']},'attributes':['id',_0x9e82('0x2a'),_0x9e82('0x69'),_0x9e82('0x6a'),_0x9e82('0x6b')],'raw':!![]});}})[_0x9e82('0x25')](function(_0x429258){if(_0x429258){var _0x12387f=path[_0x9e82('0x52')](config[_0x9e82('0x53')],_0x9e82('0x6c'),util[_0x9e82('0x6d')](_0x9e82('0x6e'),path[_0x9e82('0x6f')](_0x429258['save_name'],path['extname'](_0x429258[_0x9e82('0x69')])),_0x429258[_0x9e82('0x6a')]));var _0x3d75f3=path['join'](config[_0x9e82('0x53')],_0x9e82('0x54'),_0x1be85d[_0x9e82('0x2a')],util[_0x9e82('0x6d')]('%s.%s',_0x429258[_0x9e82('0x2a')],_0x429258[_0x9e82('0x6a')]));fs[_0x9e82('0x70')](_0x12387f,_0x3d75f3);return _0x429258;}})[_0x9e82('0x48')](function(_0xf7f668){throw new db[(_0x9e82('0x63'))][(_0x9e82('0x71'))](_0xf7f668[_0x9e82('0x72')]);});})[_0x9e82('0x25')](handleEntityNotFound(_0x5f1fd9,null))[_0x9e82('0x25')](respondWithResult(_0x5f1fd9,0xc9))[_0x9e82('0x48')](handleError(_0x5f1fd9,null));};exports[_0x9e82('0x73')]=function(_0x4ffbee,_0x17d83d,_0x45b8b3){return db['sequelize'][_0x9e82('0x65')](function(_0x79b25e){var _0x1399a5;return db['VoiceMusicOnHold'][_0x9e82('0x68')]({'where':{'id':_0x4ffbee[_0x9e82('0x4a')]['id']}})[_0x9e82('0x25')](handleEntityNotFound(_0x17d83d,null))[_0x9e82('0x25')](function(_0x270b48){if(_0x270b48){_0x1399a5=_0x270b48;return _0x270b48[_0x9e82('0x73')](_0x4ffbee['params'][_0x9e82('0x74')]);}})[_0x9e82('0x25')](function(_0x256a76){if(_0x256a76){return db[_0x9e82('0x67')][_0x9e82('0x68')]({'where':{'id':_0x4ffbee['params'][_0x9e82('0x74')]},'attributes':['id',_0x9e82('0x2a'),_0x9e82('0x69'),_0x9e82('0x6a'),_0x9e82('0x6b')],'raw':!![]});}})[_0x9e82('0x25')](function(_0x36cb3c){if(_0x36cb3c){fs[_0x9e82('0x61')](path[_0x9e82('0x52')](_0x1399a5[_0x9e82('0x51')],util[_0x9e82('0x6d')](_0x9e82('0x6e'),_0x36cb3c[_0x9e82('0x2a')],_0x36cb3c[_0x9e82('0x6a')])));return _0x36cb3c;}})[_0x9e82('0x48')](function(_0x236b1e){throw new db[(_0x9e82('0x63'))][(_0x9e82('0x71'))](_0x236b1e[_0x9e82('0x72')]);});})[_0x9e82('0x25')](handleEntityNotFound(_0x17d83d,null))[_0x9e82('0x25')](respondWithStatusCode(_0x17d83d,0xcc))[_0x9e82('0x48')](handleError(_0x17d83d,null));};exports[_0x9e82('0x75')]=function(_0xb0d742,_0x83e74e,_0x120513){var _0x3f7fa5={};var _0xa91392={};var _0x328c29;var _0x3cb7be;return db[_0x9e82('0x2e')][_0x9e82('0x68')]({'where':{'id':_0xb0d742['params']['id']}})['then'](handleEntityNotFound(_0x83e74e,null))[_0x9e82('0x25')](function(_0x16c954){if(_0x16c954){_0x328c29=_0x16c954;_0xa91392[_0x9e82('0x33')]=_[_0x9e82('0x35')](db[_0x9e82('0x67')][_0x9e82('0x2f')]);_0xa91392[_0x9e82('0x34')]=_[_0x9e82('0x35')](_0xb0d742[_0x9e82('0x34')]);_0xa91392['filters']=_['intersection'](_0xa91392['model'],_0xa91392[_0x9e82('0x34')]);_0x3f7fa5['attributes']=_[_0x9e82('0x36')](_0xa91392[_0x9e82('0x33')],qs[_0x9e82('0x76')](_0xb0d742[_0x9e82('0x34')][_0x9e82('0x76')]));_0x3f7fa5[_0x9e82('0x37')]=_0x3f7fa5[_0x9e82('0x37')][_0x9e82('0x38')]?_0x3f7fa5[_0x9e82('0x37')]:_0xa91392[_0x9e82('0x33')];_0x3f7fa5[_0x9e82('0x3b')]=qs['sort'](_0xb0d742[_0x9e82('0x34')][_0x9e82('0x3c')]);_0x3f7fa5[_0x9e82('0x3f')]=qs[_0x9e82('0x3d')](_[_0x9e82('0x3e')](_0xb0d742['query'],_0xa91392[_0x9e82('0x3d')]));if(_0xb0d742[_0x9e82('0x34')][_0x9e82('0x42')]){_0x3f7fa5[_0x9e82('0x3f')]=_['merge'](_0x3f7fa5['where'],{'$or':_[_0x9e82('0x2d')](_0x3f7fa5[_0x9e82('0x37')],function(_0x351f4f){var _0x3b09aa={};_0x3b09aa[_0x351f4f]={'$like':'%'+_0xb0d742[_0x9e82('0x34')][_0x9e82('0x42')]+'%'};return _0x3b09aa;})});}_0x3f7fa5=_[_0x9e82('0x40')]({},_0x3f7fa5,_0xb0d742[_0x9e82('0x43')]);return _0x328c29[_0x9e82('0x75')](_0x3f7fa5);}})['then'](function(_0x864347){if(_0x864347){_0x3cb7be=_0x864347[_0x9e82('0x38')];if(!_0xb0d742[_0x9e82('0x34')][_0x9e82('0x77')](_0x9e82('0x39'))){_0x3f7fa5['limit']=qs[_0x9e82('0x3a')](_0xb0d742[_0x9e82('0x34')][_0x9e82('0x3a')]);_0x3f7fa5[_0x9e82('0x20')]=qs[_0x9e82('0x20')](_0xb0d742[_0x9e82('0x34')][_0x9e82('0x20')]);}return _0x328c29['getSounds'](_0x3f7fa5);}})[_0x9e82('0x25')](function(_0x5a2ada){if(_0x5a2ada){return _0x5a2ada?{'count':_0x3cb7be,'rows':_0x5a2ada}:null;}})[_0x9e82('0x25')](respondWithResult(_0x83e74e,null))[_0x9e82('0x48')](handleError(_0x83e74e,null));}; \ No newline at end of file +var _0x5d20=['keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','update','body','create','transaction','mode','files','join','root','server/files/moh','mkdirSync','directory','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','removeSound','id2','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','count','set','Content-Range','json','apply','then','destroy','get','MusicOnHolds','UserProfileResource','end','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','key','query'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x5d20,0x18c));var _0x05d2=function(_0x10a78b,_0x289e96){_0x10a78b=_0x10a78b-0x0;var _0xbccfe=_0x5d20[_0x10a78b];return _0xbccfe;};'use strict';var emlformat=require(_0x05d2('0x0'));var rimraf=require(_0x05d2('0x1'));var zipdir=require(_0x05d2('0x2'));var jsonpatch=require(_0x05d2('0x3'));var rp=require(_0x05d2('0x4'));var moment=require(_0x05d2('0x5'));var BPromise=require(_0x05d2('0x6'));var Mustache=require(_0x05d2('0x7'));var util=require(_0x05d2('0x8'));var path=require(_0x05d2('0x9'));var sox=require(_0x05d2('0xa'));var csv=require(_0x05d2('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x05d2('0xc'));var squel=require(_0x05d2('0xd'));var crypto=require(_0x05d2('0xe'));var jsforce=require(_0x05d2('0xf'));var deskjs=require(_0x05d2('0x10'));var toCsv=require(_0x05d2('0xb'));var querystring=require(_0x05d2('0x11'));var Papa=require(_0x05d2('0x12'));var Redis=require(_0x05d2('0x13'));var authService=require(_0x05d2('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x05d2('0x15'));var logger=require(_0x05d2('0x16'))(_0x05d2('0x17'));var utils=require('../../config/utils');var config=require(_0x05d2('0x18'));var licenseUtil=require(_0x05d2('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53bedc,_0x4938ad){_0x4938ad=_0x4938ad||0xcc;return function(_0x2026e1){if(_0x2026e1){return _0x53bedc[_0x05d2('0x1a')](_0x4938ad);}return _0x53bedc['status'](_0x4938ad)['end']();};}function respondWithResult(_0x59a093,_0x19b8fa){_0x19b8fa=_0x19b8fa||0xc8;return function(_0x4ef779){if(_0x4ef779){return _0x59a093[_0x05d2('0x1b')](_0x19b8fa)['json'](_0x4ef779);}};}function respondWithFilteredResult(_0x1c899b,_0x3b08c5){return function(_0x53b8c8){if(_0x53b8c8){var _0x1141fa=typeof _0x3b08c5[_0x05d2('0x1c')]==='undefined'&&typeof _0x3b08c5[_0x05d2('0x1d')]==='undefined';var _0x4ce867=_0x53b8c8['count'];var _0xe14b66=_0x1141fa?0x0:_0x3b08c5[_0x05d2('0x1c')];var _0x2bece1=_0x1141fa?_0x53b8c8[_0x05d2('0x1e')]:_0x3b08c5['offset']+_0x3b08c5['limit'];var _0xcdcb3a;if(_0x2bece1>=_0x4ce867){_0x2bece1=_0x4ce867;_0xcdcb3a=0xc8;}else{_0xcdcb3a=0xce;}_0x1c899b['status'](_0xcdcb3a);return _0x1c899b[_0x05d2('0x1f')](_0x05d2('0x20'),_0xe14b66+'-'+_0x2bece1+'/'+_0x4ce867)[_0x05d2('0x21')](_0x53b8c8);}return null;};}function patchUpdates(_0x88e1ab){return function(_0x36d70b){try{jsonpatch[_0x05d2('0x22')](_0x36d70b,_0x88e1ab,!![]);}catch(_0x1e2b5b){return BPromise['reject'](_0x1e2b5b);}return _0x36d70b['save']();};}function saveUpdates(_0x53c4e9,_0x59b240){return function(_0x2a46c4){if(_0x2a46c4){return _0x2a46c4['update'](_0x53c4e9)[_0x05d2('0x23')](function(_0x2163fe){return _0x2163fe;});}return null;};}function removeEntity(_0x256916,_0x476990){return function(_0x4a2a67){if(_0x4a2a67){return _0x4a2a67[_0x05d2('0x24')]()[_0x05d2('0x23')](function(){var _0x34a214=_0x4a2a67[_0x05d2('0x25')]({'plain':!![]});var _0x1042bd=_0x05d2('0x26');return db[_0x05d2('0x27')][_0x05d2('0x24')]({'where':{'type':_0x1042bd,'resourceId':_0x34a214['id']}})[_0x05d2('0x23')](function(){return _0x4a2a67;});})['then'](function(){_0x256916[_0x05d2('0x1b')](0xcc)[_0x05d2('0x28')]();});}};}function handleEntityNotFound(_0x25c5ed,_0x2e4a67){return function(_0x2b9871){if(!_0x2b9871){_0x25c5ed[_0x05d2('0x1a')](0x194);}return _0x2b9871;};}function handleError(_0x51ea94,_0x37b72b){_0x37b72b=_0x37b72b||0x1f4;return function(_0x6a80f5){logger[_0x05d2('0x29')](_0x6a80f5[_0x05d2('0x2a')]);if(_0x6a80f5[_0x05d2('0x2b')]){delete _0x6a80f5[_0x05d2('0x2b')];}_0x51ea94['status'](_0x37b72b)[_0x05d2('0x2c')](_0x6a80f5);};}exports[_0x05d2('0x2d')]=function(_0x29af83,_0x299130){var _0x4922f9={},_0x4fb253={},_0x355931={'count':0x0,'rows':[]};var _0x31eda9=_[_0x05d2('0x2e')](db[_0x05d2('0x2f')][_0x05d2('0x30')],function(_0x55df50){return{'name':_0x55df50[_0x05d2('0x31')],'type':_0x55df50['type'][_0x05d2('0x32')]};});_0x4fb253['model']=_[_0x05d2('0x2e')](_0x31eda9,'name');_0x4fb253[_0x05d2('0x33')]=_[_0x05d2('0x34')](_0x29af83[_0x05d2('0x33')]);_0x4fb253[_0x05d2('0x35')]=_['intersection'](_0x4fb253[_0x05d2('0x36')],_0x4fb253[_0x05d2('0x33')]);_0x4922f9[_0x05d2('0x37')]=_[_0x05d2('0x38')](_0x4fb253[_0x05d2('0x36')],qs[_0x05d2('0x39')](_0x29af83[_0x05d2('0x33')]['fields']));_0x4922f9[_0x05d2('0x37')]=_0x4922f9[_0x05d2('0x37')][_0x05d2('0x3a')]?_0x4922f9['attributes']:_0x4fb253[_0x05d2('0x36')];if(!_0x29af83[_0x05d2('0x33')][_0x05d2('0x3b')](_0x05d2('0x3c'))){_0x4922f9[_0x05d2('0x1d')]=qs[_0x05d2('0x1d')](_0x29af83['query']['limit']);_0x4922f9[_0x05d2('0x1c')]=qs['offset'](_0x29af83[_0x05d2('0x33')]['offset']);}_0x4922f9[_0x05d2('0x3d')]=qs[_0x05d2('0x3e')](_0x29af83[_0x05d2('0x33')][_0x05d2('0x3e')]);delete _0x29af83[_0x05d2('0x33')][_0x05d2('0x3e')];_0x4922f9[_0x05d2('0x3f')]=qs[_0x05d2('0x35')](_[_0x05d2('0x40')](_0x29af83[_0x05d2('0x33')],_0x4fb253[_0x05d2('0x35')]),_0x31eda9);if(_0x29af83[_0x05d2('0x33')][_0x05d2('0x41')]){_0x4922f9[_0x05d2('0x3f')]=_[_0x05d2('0x42')](_0x4922f9[_0x05d2('0x3f')],{'$or':_[_0x05d2('0x2e')](_0x31eda9,function(_0x407b9f){if(_0x407b9f['type']!==_0x05d2('0x43')){var _0x273196={};_0x273196[_0x407b9f[_0x05d2('0x2b')]]={'$like':'%'+_0x29af83[_0x05d2('0x33')]['filter']+'%'};return _0x273196;}})});}_0x4922f9=_[_0x05d2('0x42')]({},_0x4922f9,_0x29af83[_0x05d2('0x44')]);var _0x518ac6={'where':_0x4922f9[_0x05d2('0x3f')]};return db['VoiceMusicOnHold'][_0x05d2('0x1e')](_0x518ac6)[_0x05d2('0x23')](function(_0x18a586){_0x355931[_0x05d2('0x1e')]=_0x18a586;if(_0x29af83[_0x05d2('0x33')][_0x05d2('0x45')]){_0x4922f9[_0x05d2('0x46')]=[{'all':!![]}];}return db[_0x05d2('0x2f')][_0x05d2('0x47')](_0x4922f9);})[_0x05d2('0x23')](function(_0x568224){_0x355931[_0x05d2('0x48')]=_0x568224;return _0x355931;})[_0x05d2('0x23')](respondWithFilteredResult(_0x299130,_0x4922f9))[_0x05d2('0x49')](handleError(_0x299130,null));};exports['show']=function(_0x4a0900,_0x4d327b){var _0x3169dd={'raw':![],'where':{'id':_0x4a0900[_0x05d2('0x4a')]['id']}},_0x2c3c1e={};_0x2c3c1e[_0x05d2('0x36')]=_['keys'](db[_0x05d2('0x2f')][_0x05d2('0x30')]);_0x2c3c1e['query']=_[_0x05d2('0x34')](_0x4a0900[_0x05d2('0x33')]);_0x2c3c1e['filters']=_[_0x05d2('0x38')](_0x2c3c1e[_0x05d2('0x36')],_0x2c3c1e[_0x05d2('0x33')]);_0x3169dd[_0x05d2('0x37')]=_['intersection'](_0x2c3c1e[_0x05d2('0x36')],qs[_0x05d2('0x39')](_0x4a0900[_0x05d2('0x33')][_0x05d2('0x39')]));_0x3169dd[_0x05d2('0x37')]=_0x3169dd[_0x05d2('0x37')][_0x05d2('0x3a')]?_0x3169dd[_0x05d2('0x37')]:_0x2c3c1e['model'];if(_0x4a0900[_0x05d2('0x33')][_0x05d2('0x45')]){_0x3169dd[_0x05d2('0x46')]=[{'all':!![]}];}_0x3169dd=_[_0x05d2('0x42')]({},_0x3169dd,_0x4a0900[_0x05d2('0x44')]);return db['VoiceMusicOnHold'][_0x05d2('0x4b')](_0x3169dd)[_0x05d2('0x23')](handleEntityNotFound(_0x4d327b,null))[_0x05d2('0x23')](respondWithResult(_0x4d327b,null))[_0x05d2('0x49')](handleError(_0x4d327b,null));};exports[_0x05d2('0x4c')]=function(_0x18a4e5,_0x31712d){if(_0x18a4e5['body']['id']){delete _0x18a4e5['body']['id'];}return db[_0x05d2('0x2f')][_0x05d2('0x4b')]({'where':{'id':_0x18a4e5[_0x05d2('0x4a')]['id']}})[_0x05d2('0x23')](handleEntityNotFound(_0x31712d,null))[_0x05d2('0x23')](saveUpdates(_0x18a4e5[_0x05d2('0x4d')],null))[_0x05d2('0x23')](respondWithResult(_0x31712d,null))[_0x05d2('0x49')](handleError(_0x31712d,null));};exports[_0x05d2('0x4e')]=function(_0x366e01,_0x51003a,_0x3e3247){return db['sequelize'][_0x05d2('0x4f')](function(_0x39fb13){if(_0x366e01[_0x05d2('0x4d')][_0x05d2('0x50')]===_0x05d2('0x51')){_0x366e01[_0x05d2('0x4d')]['directory']=path[_0x05d2('0x52')](config[_0x05d2('0x53')],_0x05d2('0x54'),_0x366e01[_0x05d2('0x4d')]['name']);}return db[_0x05d2('0x2f')]['create'](_0x366e01[_0x05d2('0x4d')],{'transaction':_0x39fb13})['then'](function(_0x60534f){if(_0x366e01[_0x05d2('0x4d')][_0x05d2('0x50')]===_0x05d2('0x51')){fs[_0x05d2('0x55')](_0x60534f[_0x05d2('0x56')],parseInt('0777',0x8));}var _0x57a5aa=_0x366e01[_0x05d2('0x57')]['get']({'plain':!![]});if(!_0x57a5aa)throw new Error(_0x05d2('0x58'));if(_0x57a5aa['role']===_0x05d2('0x57')){var _0x3f5585=_0x60534f[_0x05d2('0x25')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x05d2('0x26'),'userProfileId':_0x57a5aa[_0x05d2('0x59')]},'raw':!![]})[_0x05d2('0x23')](function(_0x5cd38d){if(_0x5cd38d&&_0x5cd38d[_0x05d2('0x5a')]===0x0){return db['UserProfileResource']['create']({'name':_0x3f5585['name'],'resourceId':_0x3f5585['id'],'type':_0x5cd38d[_0x05d2('0x2b')],'sectionId':_0x5cd38d['id']},{})[_0x05d2('0x23')](function(){return _0x60534f;});}else{return _0x60534f;}})[_0x05d2('0x49')](function(_0x3d6120){logger[_0x05d2('0x29')](_0x05d2('0x5b'),_0x3d6120);});}return _0x60534f;});})[_0x05d2('0x23')](respondWithResult(_0x51003a,0xc9))[_0x05d2('0x49')](handleError(_0x51003a,null));};exports['destroy']=function(_0x5b3b38,_0x21d717,_0x578f61){var _0x2f89bd;return db[_0x05d2('0x2f')][_0x05d2('0x4b')]({'where':{'id':_0x5b3b38[_0x05d2('0x4a')]['id']}})['then'](function(_0x35667a){if(_0x35667a){return db[_0x05d2('0x5c')][_0x05d2('0x4f')](function(_0x43d2fc){return _0x35667a[_0x05d2('0x24')]({'transaction':_0x43d2fc,'raw':!![]})['then'](function(_0x363e2d){if(_0x363e2d['directory']){fs['readdirSync'](_0x363e2d[_0x05d2('0x56')])['forEach'](function(_0x5a8a85){fs['unlinkSync'](path[_0x05d2('0x52')](_0x363e2d[_0x05d2('0x56')],_0x5a8a85));});fs[_0x05d2('0x5d')](_0x363e2d['directory']);}return _0x363e2d;});})[_0x05d2('0x49')](function(_0x2a75e6){throw new db[(_0x05d2('0x5e'))][(_0x05d2('0x5f'))](_0x2a75e6[_0x05d2('0x60')]);});}})[_0x05d2('0x23')](handleEntityNotFound(_0x21d717,null))[_0x05d2('0x23')](removeEntity(_0x21d717,null))[_0x05d2('0x49')](handleError(_0x21d717,null));};exports['addSound']=function(_0x229921,_0x1f21a7,_0x3bbdf0){return db[_0x05d2('0x5c')]['transaction'](function(_0x2ea82d){var _0xb1bfb5;return db['VoiceMusicOnHold'][_0x05d2('0x4b')]({'where':{'id':_0x229921[_0x05d2('0x4a')]['id']}})[_0x05d2('0x23')](function(_0x409ef3){if(_0x409ef3){_0xb1bfb5=_0x409ef3;return _0x409ef3[_0x05d2('0x61')](_0x229921[_0x05d2('0x4d')]['id'],{'transaction':_0x2ea82d});}})[_0x05d2('0x23')](function(_0x3f17ad){if(_0x3f17ad){return db[_0x05d2('0x62')][_0x05d2('0x63')]({'where':{'id':_0x229921[_0x05d2('0x4d')]['id']},'attributes':['id','name',_0x05d2('0x64'),_0x05d2('0x65'),_0x05d2('0x66')],'raw':!![]});}})['then'](function(_0x4334cd){if(_0x4334cd){var _0x35de68=path['join'](config['root'],_0x05d2('0x67'),util[_0x05d2('0x68')](_0x05d2('0x69'),path[_0x05d2('0x6a')](_0x4334cd['save_name'],path[_0x05d2('0x6b')](_0x4334cd[_0x05d2('0x64')])),_0x4334cd[_0x05d2('0x65')]));var _0x1e7773=path['join'](config['root'],_0x05d2('0x54'),_0xb1bfb5['name'],util[_0x05d2('0x68')](_0x05d2('0x69'),_0x4334cd[_0x05d2('0x2b')],_0x4334cd[_0x05d2('0x65')]));fs[_0x05d2('0x6c')](_0x35de68,_0x1e7773);return _0x4334cd;}})['catch'](function(_0x4b086c){throw new db[(_0x05d2('0x5e'))]['ValidationError'](_0x4b086c[_0x05d2('0x60')]);});})[_0x05d2('0x23')](handleEntityNotFound(_0x1f21a7,null))[_0x05d2('0x23')](respondWithResult(_0x1f21a7,0xc9))[_0x05d2('0x49')](handleError(_0x1f21a7,null));};exports[_0x05d2('0x6d')]=function(_0x30c828,_0x14c2f6,_0x307d5c){return db[_0x05d2('0x5c')][_0x05d2('0x4f')](function(_0x1c8447){var _0x498684;return db['VoiceMusicOnHold'][_0x05d2('0x63')]({'where':{'id':_0x30c828[_0x05d2('0x4a')]['id']}})[_0x05d2('0x23')](handleEntityNotFound(_0x14c2f6,null))[_0x05d2('0x23')](function(_0x36c555){if(_0x36c555){_0x498684=_0x36c555;return _0x36c555[_0x05d2('0x6d')](_0x30c828[_0x05d2('0x4a')][_0x05d2('0x6e')]);}})[_0x05d2('0x23')](function(_0x2d6ea5){if(_0x2d6ea5){return db[_0x05d2('0x62')][_0x05d2('0x63')]({'where':{'id':_0x30c828[_0x05d2('0x4a')]['id2']},'attributes':['id',_0x05d2('0x2b'),_0x05d2('0x64'),_0x05d2('0x65'),'createdAt'],'raw':!![]});}})[_0x05d2('0x23')](function(_0x22d583){if(_0x22d583){fs['unlinkSync'](path['join'](_0x498684[_0x05d2('0x56')],util[_0x05d2('0x68')](_0x05d2('0x69'),_0x22d583['name'],_0x22d583[_0x05d2('0x65')])));return _0x22d583;}})['catch'](function(_0x175e54){throw new db['Sequelize'][(_0x05d2('0x5f'))](_0x175e54['message']);});})[_0x05d2('0x23')](handleEntityNotFound(_0x14c2f6,null))['then'](respondWithStatusCode(_0x14c2f6,0xcc))[_0x05d2('0x49')](handleError(_0x14c2f6,null));};exports['getSounds']=function(_0x4922f3,_0x5ab004,_0x1bc715){var _0xe84de8={};var _0x370025={};var _0x30fc8b;var _0x58e70a;return db[_0x05d2('0x2f')][_0x05d2('0x63')]({'where':{'id':_0x4922f3[_0x05d2('0x4a')]['id']}})[_0x05d2('0x23')](handleEntityNotFound(_0x5ab004,null))[_0x05d2('0x23')](function(_0x320d38){if(_0x320d38){_0x30fc8b=_0x320d38;_0x370025[_0x05d2('0x36')]=_[_0x05d2('0x34')](db[_0x05d2('0x62')][_0x05d2('0x30')]);_0x370025[_0x05d2('0x33')]=_[_0x05d2('0x34')](_0x4922f3[_0x05d2('0x33')]);_0x370025['filters']=_['intersection'](_0x370025['model'],_0x370025['query']);_0xe84de8['attributes']=_[_0x05d2('0x38')](_0x370025[_0x05d2('0x36')],qs[_0x05d2('0x39')](_0x4922f3[_0x05d2('0x33')]['fields']));_0xe84de8['attributes']=_0xe84de8[_0x05d2('0x37')][_0x05d2('0x3a')]?_0xe84de8[_0x05d2('0x37')]:_0x370025[_0x05d2('0x36')];_0xe84de8['order']=qs[_0x05d2('0x3e')](_0x4922f3[_0x05d2('0x33')][_0x05d2('0x3e')]);_0xe84de8[_0x05d2('0x3f')]=qs[_0x05d2('0x35')](_[_0x05d2('0x40')](_0x4922f3[_0x05d2('0x33')],_0x370025[_0x05d2('0x35')]));if(_0x4922f3[_0x05d2('0x33')][_0x05d2('0x41')]){_0xe84de8[_0x05d2('0x3f')]=_[_0x05d2('0x42')](_0xe84de8['where'],{'$or':_[_0x05d2('0x2e')](_0xe84de8['attributes'],function(_0x159506){var _0x15a50a={};_0x15a50a[_0x159506]={'$like':'%'+_0x4922f3[_0x05d2('0x33')][_0x05d2('0x41')]+'%'};return _0x15a50a;})});}_0xe84de8=_[_0x05d2('0x42')]({},_0xe84de8,_0x4922f3[_0x05d2('0x44')]);return _0x30fc8b[_0x05d2('0x6f')](_0xe84de8);}})['then'](function(_0x468828){if(_0x468828){_0x58e70a=_0x468828[_0x05d2('0x3a')];if(!_0x4922f3[_0x05d2('0x33')][_0x05d2('0x3b')](_0x05d2('0x3c'))){_0xe84de8['limit']=qs['limit'](_0x4922f3['query']['limit']);_0xe84de8[_0x05d2('0x1c')]=qs[_0x05d2('0x1c')](_0x4922f3[_0x05d2('0x33')]['offset']);}return _0x30fc8b[_0x05d2('0x6f')](_0xe84de8);}})[_0x05d2('0x23')](function(_0x389d8d){if(_0x389d8d){return _0x389d8d?{'count':_0x58e70a,'rows':_0x389d8d}:null;}})[_0x05d2('0x23')](respondWithResult(_0x5ab004,null))['catch'](handleError(_0x5ab004,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 9605738..16b7ffe 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 _0x9786=['VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./voiceMusicOnHold.attributes','exports'];(function(_0x4f49af,_0x47e992){var _0x28ef1a=function(_0x3b3081){while(--_0x3b3081){_0x4f49af['push'](_0x4f49af['shift']());}};_0x28ef1a(++_0x47e992);}(_0x9786,0xf4));var _0x6978=function(_0x4bf7d3,_0x2117c2){_0x4bf7d3=_0x4bf7d3-0x0;var _0x5b73e8=_0x9786[_0x4bf7d3];return _0x5b73e8;};'use strict';var _=require(_0x6978('0x0'));var util=require(_0x6978('0x1'));var logger=require(_0x6978('0x2'))(_0x6978('0x3'));var moment=require('moment');var BPromise=require(_0x6978('0x4'));var rp=require(_0x6978('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6978('0x6'));var config=require('../../config/environment');var attributes=require(_0x6978('0x7'));module[_0x6978('0x8')]=function(_0x363c88,_0xe94d56){return _0x363c88['define'](_0x6978('0x9'),attributes,{'tableName':_0x6978('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7018=['define','VoiceMusicOnHold','voice_musiconhold','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes'];(function(_0x2667db,_0x5214ad){var _0x38b7e3=function(_0x573a0b){while(--_0x573a0b){_0x2667db['push'](_0x2667db['shift']());}};_0x38b7e3(++_0x5214ad);}(_0x7018,0x1c6));var _0x8701=function(_0x583e19,_0x2e8b7c){_0x583e19=_0x583e19-0x0;var _0x4ddcef=_0x7018[_0x583e19];return _0x4ddcef;};'use strict';var _=require(_0x8701('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8701('0x1'));var moment=require('moment');var BPromise=require(_0x8701('0x2'));var rp=require(_0x8701('0x3'));var fs=require('fs');var path=require(_0x8701('0x4'));var rimraf=require(_0x8701('0x5'));var config=require(_0x8701('0x6'));var attributes=require(_0x8701('0x7'));module['exports']=function(_0xb9f1f7,_0x417b3d){return _0xb9f1f7[_0x8701('0x8')](_0x8701('0x9'),attributes,{'tableName':_0x8701('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 5f169a9..95b755b 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0xa14dd8,_0x4de262){var _0x3e7032=function(_0x49f460){while(--_0x49f460){_0xa14dd8['push'](_0xa14dd8['shift']());}};_0x3e7032(++_0x4de262);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xcb91[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _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(_0x626c8e,_0x10155b){var _0x16f413=function(_0x43894d){while(--_0x43894d){_0x626c8e['push'](_0x626c8e['shift']());}};_0x16f413(++_0x10155b);}(_0x9c44,0x178));var _0x49c4=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9c44[_0x5608a3];return _0x1ed50a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index c212381..aa0cb1a 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 _0xfaec=['get','isAuthenticated','describe','show','/:id/users','getAgents','getTeams','post','addAgents','addTeams','put','/:id','delete','destroy','removeAgents','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','index'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xfaec,0x12f));var _0xcfae=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xfaec[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0xcfae('0x0'));var util=require(_0xcfae('0x1'));var path=require(_0xcfae('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xcfae('0x3'));var auth=require(_0xcfae('0x4'));var interaction=require(_0xcfae('0x5'));var config=require(_0xcfae('0x6'));var controller=require(_0xcfae('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xcfae('0x8')]);router[_0xcfae('0x9')]('/describe',auth[_0xcfae('0xa')](),controller[_0xcfae('0xb')]);router['get']('/:id',auth[_0xcfae('0xa')](),controller[_0xcfae('0xc')]);router[_0xcfae('0x9')](_0xcfae('0xd'),auth['isAuthenticated'](),controller[_0xcfae('0xe')]);router[_0xcfae('0x9')]('/:id/teams',auth[_0xcfae('0xa')](),controller[_0xcfae('0xf')]);router[_0xcfae('0x10')]('/',auth[_0xcfae('0xa')](),controller['create']);router[_0xcfae('0x10')]('/:id/users',auth[_0xcfae('0xa')](),controller[_0xcfae('0x11')]);router[_0xcfae('0x10')]('/:id/teams',auth[_0xcfae('0xa')](),controller[_0xcfae('0x12')]);router[_0xcfae('0x13')](_0xcfae('0x14'),auth[_0xcfae('0xa')](),controller['update']);router[_0xcfae('0x15')](_0xcfae('0x14'),auth[_0xcfae('0xa')](),controller[_0xcfae('0x16')]);router['delete'](_0xcfae('0xd'),auth[_0xcfae('0xa')](),controller[_0xcfae('0x17')]);router['delete']('/:id/teams',auth[_0xcfae('0xa')](),controller['removeTeams']);module['exports']=router; \ No newline at end of file +var _0x1952=['removeTeams','exports','util','path','express','fs-extra','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','update','delete','destroy','removeAgents'];(function(_0x5de278,_0x24e13d){var _0x446ca2=function(_0x4f49e6){while(--_0x4f49e6){_0x5de278['push'](_0x5de278['shift']());}};_0x446ca2(++_0x24e13d);}(_0x1952,0x92));var _0x2195=function(_0x33079d,_0x306be3){_0x33079d=_0x33079d-0x0;var _0x2aab4c=_0x1952[_0x33079d];return _0x2aab4c;};'use strict';var multer=require('multer');var util=require(_0x2195('0x0'));var path=require(_0x2195('0x1'));var timeout=require('connect-timeout');var express=require(_0x2195('0x2'));var router=express['Router']();var fs_extra=require(_0x2195('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2195('0x4'));var controller=require(_0x2195('0x5'));router['get']('/',auth[_0x2195('0x6')](),controller[_0x2195('0x7')]);router[_0x2195('0x8')](_0x2195('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x2195('0x8')](_0x2195('0xa'),auth[_0x2195('0x6')](),controller[_0x2195('0xb')]);router[_0x2195('0x8')](_0x2195('0xc'),auth[_0x2195('0x6')](),controller[_0x2195('0xd')]);router[_0x2195('0x8')](_0x2195('0xe'),auth[_0x2195('0x6')](),controller[_0x2195('0xf')]);router[_0x2195('0x10')]('/',auth[_0x2195('0x6')](),controller[_0x2195('0x11')]);router[_0x2195('0x10')](_0x2195('0xc'),auth[_0x2195('0x6')](),controller['addAgents']);router[_0x2195('0x10')](_0x2195('0xe'),auth['isAuthenticated'](),controller['addTeams']);router['put'](_0x2195('0xa'),auth[_0x2195('0x6')](),controller[_0x2195('0x12')]);router[_0x2195('0x13')](_0x2195('0xa'),auth['isAuthenticated'](),controller[_0x2195('0x14')]);router[_0x2195('0x13')](_0x2195('0xc'),auth[_0x2195('0x6')](),controller[_0x2195('0x15')]);router[_0x2195('0x13')](_0x2195('0xe'),auth[_0x2195('0x6')](),controller[_0x2195('0x16')]);module[_0x2195('0x17')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 498c935..9056fb7 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 _0xb1b6=['VIRTUAL','system-','getDataValue','STRING','sequelize','exports','name'];(function(_0xe6c898,_0x38c19e){var _0x15d096=function(_0x3a0586){while(--_0x3a0586){_0xe6c898['push'](_0xe6c898['shift']());}};_0x15d096(++_0x38c19e);}(_0xb1b6,0xba));var _0x6b1b=function(_0xe45179,_0x1c28ad){_0xe45179=_0xe45179-0x0;var _0x12d47f=_0xb1b6[_0xe45179];return _0x12d47f;};'use strict';var Sequelize=require(_0x6b1b('0x0'));module[_0x6b1b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6b1b('0x2')},'prefix':{'type':Sequelize[_0x6b1b('0x3')],'get':function(_0x168b09){return _0x6b1b('0x4')+this[_0x6b1b('0x5')](_0x6b1b('0x2'))+'-';}},'description':{'type':Sequelize[_0x6b1b('0x6')]},'callerIdAll':{'type':Sequelize[_0x6b1b('0x6')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xc018=['sequelize','system-','getDataValue','name'];(function(_0x7d261d,_0x4e1d2f){var _0x1a992a=function(_0x199824){while(--_0x199824){_0x7d261d['push'](_0x7d261d['shift']());}};_0x1a992a(++_0x4e1d2f);}(_0xc018,0x6c));var _0x8c01=function(_0x2bfd84,_0x1b455c){_0x2bfd84=_0x2bfd84-0x0;var _0x143f36=_0xc018[_0x2bfd84];return _0x143f36;};'use strict';var Sequelize=require(_0x8c01('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x45a328){return _0x8c01('0x1')+this[_0x8c01('0x2')](_0x8c01('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 130248d..9684b9a 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 _0x5c3c=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','UserProfileResource','error','name','send','index','map','VoicePrefix','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','include','options','find','create','sequelize','transaction','get','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','VoicePrefixes','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','body','system-','VoiceExtensionId','findById','addAgents','ids','omit','removeAgents','isArray','userVoicePrefix:remove','emit','getAgents','findOne','User','pick','getTeams','addTeams','Team','findAll','voicePause','interface','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','removeTeams','select','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','Agents','clone','ut.UserId\x20=\x20?','toString','QueryTypes','TeamId','union','compact','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x4d093a,_0x15d59c){var _0x5d7227=function(_0x4e2fee){while(--_0x4e2fee){_0x4d093a['push'](_0x4d093a['shift']());}};_0x5d7227(++_0x15d59c);}(_0x5c3c,0x132));var _0xc5c3=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x5c3c[_0xaa0309];return _0x5de7ce;};'use strict';var emlformat=require(_0xc5c3('0x0'));var rimraf=require(_0xc5c3('0x1'));var zipdir=require(_0xc5c3('0x2'));var jsonpatch=require(_0xc5c3('0x3'));var rp=require('request-promise');var moment=require(_0xc5c3('0x4'));var BPromise=require(_0xc5c3('0x5'));var Mustache=require(_0xc5c3('0x6'));var util=require(_0xc5c3('0x7'));var path=require(_0xc5c3('0x8'));var sox=require(_0xc5c3('0x9'));var csv=require(_0xc5c3('0xa'));var ejs=require(_0xc5c3('0xb'));var fs=require('fs');var fs_extra=require(_0xc5c3('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc5c3('0xd'));var deskjs=require(_0xc5c3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc5c3('0xf'));var Papa=require(_0xc5c3('0x10'));var Redis=require('ioredis');var authService=require(_0xc5c3('0x11'));var qs=require(_0xc5c3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc5c3('0x13'));var logger=require(_0xc5c3('0x14'))(_0xc5c3('0x15'));var utils=require('../../config/utils');var config=require(_0xc5c3('0x16'));var licenseUtil=require(_0xc5c3('0x17'));var db=require('../../mysqldb')['db'];config[_0xc5c3('0x18')]=_[_0xc5c3('0x19')](config[_0xc5c3('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xc5c3('0x1a'))(new Redis(config[_0xc5c3('0x18')]));require(_0xc5c3('0x1b'))[_0xc5c3('0x1c')](socket);function respondWithStatusCode(_0xc8a636,_0x5f34bb){_0x5f34bb=_0x5f34bb||0xcc;return function(_0x5c0341){if(_0x5c0341){return _0xc8a636[_0xc5c3('0x1d')](_0x5f34bb);}return _0xc8a636[_0xc5c3('0x1e')](_0x5f34bb)[_0xc5c3('0x1f')]();};}function respondWithResult(_0xef8b21,_0x5ecd4b){_0x5ecd4b=_0x5ecd4b||0xc8;return function(_0x4ff2de){if(_0x4ff2de){return _0xef8b21[_0xc5c3('0x1e')](_0x5ecd4b)['json'](_0x4ff2de);}};}function respondWithFilteredResult(_0xa9bc84,_0x17ec62){return function(_0x2ff158){if(_0x2ff158){var _0x13c867=typeof _0x17ec62[_0xc5c3('0x20')]==='undefined'&&typeof _0x17ec62[_0xc5c3('0x21')]===_0xc5c3('0x22');var _0x123dba=_0x2ff158[_0xc5c3('0x23')];var _0x4e570f=_0x13c867?0x0:_0x17ec62[_0xc5c3('0x20')];var _0x41578a=_0x13c867?_0x2ff158[_0xc5c3('0x23')]:_0x17ec62[_0xc5c3('0x20')]+_0x17ec62[_0xc5c3('0x21')];var _0x564815;if(_0x41578a>=_0x123dba){_0x41578a=_0x123dba;_0x564815=0xc8;}else{_0x564815=0xce;}_0xa9bc84[_0xc5c3('0x1e')](_0x564815);return _0xa9bc84[_0xc5c3('0x24')](_0xc5c3('0x25'),_0x4e570f+'-'+_0x41578a+'/'+_0x123dba)[_0xc5c3('0x26')](_0x2ff158);}return null;};}function patchUpdates(_0x1c5793){return function(_0x67445){try{jsonpatch[_0xc5c3('0x27')](_0x67445,_0x1c5793,!![]);}catch(_0x5996a0){return BPromise['reject'](_0x5996a0);}return _0x67445[_0xc5c3('0x28')]();};}function saveUpdates(_0x38dd9e,_0x53ab72){return function(_0x5c7329){if(_0x5c7329){return _0x5c7329[_0xc5c3('0x29')](_0x38dd9e)[_0xc5c3('0x2a')](function(_0x38a3df){return _0x38a3df;});}return null;};}function removeEntity(_0x52e54a,_0x4af067){return function(_0x2df06b){if(_0x2df06b){return _0x2df06b[_0xc5c3('0x2b')]()[_0xc5c3('0x2a')](function(){var _0x29791c=_0x2df06b['get']({'plain':!![]});var _0x21efd6='VoicePrefixes';return db[_0xc5c3('0x2c')]['destroy']({'where':{'type':_0x21efd6,'resourceId':_0x29791c['id']}})[_0xc5c3('0x2a')](function(){return _0x2df06b;});})[_0xc5c3('0x2a')](function(){_0x52e54a[_0xc5c3('0x1e')](0xcc)[_0xc5c3('0x1f')]();});}};}function handleEntityNotFound(_0x15361c,_0x2d07e1){return function(_0x35a397){if(!_0x35a397){_0x15361c['sendStatus'](0x194);}return _0x35a397;};}function handleError(_0xbcafd6,_0x4a3300){_0x4a3300=_0x4a3300||0x1f4;return function(_0xc4b134){logger[_0xc5c3('0x2d')](_0xc4b134['stack']);if(_0xc4b134['name']){delete _0xc4b134[_0xc5c3('0x2e')];}_0xbcafd6[_0xc5c3('0x1e')](_0x4a3300)[_0xc5c3('0x2f')](_0xc4b134);};}exports[_0xc5c3('0x30')]=function(_0x52adcf,_0x3f9591){var _0x24aa70={},_0x3ebcbc={},_0x303eab={'count':0x0,'rows':[]};var _0x1b4538=_[_0xc5c3('0x31')](db[_0xc5c3('0x32')][_0xc5c3('0x33')],function(_0x1d1e6d){return{'name':_0x1d1e6d['fieldName'],'type':_0x1d1e6d[_0xc5c3('0x34')][_0xc5c3('0x35')]};});_0x3ebcbc[_0xc5c3('0x36')]=_[_0xc5c3('0x31')](_0x1b4538,_0xc5c3('0x2e'));_0x3ebcbc[_0xc5c3('0x37')]=_[_0xc5c3('0x38')](_0x52adcf['query']);_0x3ebcbc['filters']=_[_0xc5c3('0x39')](_0x3ebcbc['model'],_0x3ebcbc[_0xc5c3('0x37')]);_0x24aa70[_0xc5c3('0x3a')]=_[_0xc5c3('0x39')](_0x3ebcbc[_0xc5c3('0x36')],qs[_0xc5c3('0x3b')](_0x52adcf['query'][_0xc5c3('0x3b')]));_0x24aa70[_0xc5c3('0x3a')]=_0x24aa70['attributes'][_0xc5c3('0x3c')]?_0x24aa70[_0xc5c3('0x3a')]:_0x3ebcbc[_0xc5c3('0x36')];if(!_0x52adcf[_0xc5c3('0x37')][_0xc5c3('0x3d')](_0xc5c3('0x3e'))){_0x24aa70[_0xc5c3('0x21')]=qs[_0xc5c3('0x21')](_0x52adcf[_0xc5c3('0x37')][_0xc5c3('0x21')]);_0x24aa70['offset']=qs[_0xc5c3('0x20')](_0x52adcf['query']['offset']);}_0x24aa70[_0xc5c3('0x3f')]=qs[_0xc5c3('0x40')](_0x52adcf[_0xc5c3('0x37')][_0xc5c3('0x40')]);_0x24aa70[_0xc5c3('0x41')]=qs['filters'](_['pick'](_0x52adcf[_0xc5c3('0x37')],_0x3ebcbc[_0xc5c3('0x42')]),_0x1b4538);if(_0x52adcf['query'][_0xc5c3('0x43')]){_0x24aa70['where']=_[_0xc5c3('0x44')](_0x24aa70[_0xc5c3('0x41')],{'$or':_[_0xc5c3('0x31')](_0x1b4538,function(_0x59c9cb){if(_0x59c9cb[_0xc5c3('0x34')]!==_0xc5c3('0x45')){var _0x525ef8={};_0x525ef8[_0x59c9cb[_0xc5c3('0x2e')]]={'$like':'%'+_0x52adcf['query'][_0xc5c3('0x43')]+'%'};return _0x525ef8;}})});}_0x24aa70=_[_0xc5c3('0x44')]({},_0x24aa70,_0x52adcf['options']);var _0x4d2056={'where':_0x24aa70['where']};return db[_0xc5c3('0x32')][_0xc5c3('0x23')](_0x4d2056)['then'](function(_0x1a8490){_0x303eab[_0xc5c3('0x23')]=_0x1a8490;if(_0x52adcf[_0xc5c3('0x37')][_0xc5c3('0x46')]){_0x24aa70['include']=[{'all':!![]}];}return db[_0xc5c3('0x32')]['findAll'](_0x24aa70);})['then'](function(_0x1363fa){_0x303eab[_0xc5c3('0x47')]=_0x1363fa;return _0x303eab;})['then'](respondWithFilteredResult(_0x3f9591,_0x24aa70))[_0xc5c3('0x48')](handleError(_0x3f9591,null));};exports[_0xc5c3('0x49')]=function(_0x590e65,_0x333c38){var _0x4ffc5a={'raw':![],'where':{'id':_0x590e65[_0xc5c3('0x4a')]['id']}},_0x122a6d={};_0x122a6d['model']=_[_0xc5c3('0x38')](db['VoicePrefix'][_0xc5c3('0x33')]);_0x122a6d[_0xc5c3('0x37')]=_['keys'](_0x590e65[_0xc5c3('0x37')]);_0x122a6d[_0xc5c3('0x42')]=_[_0xc5c3('0x39')](_0x122a6d[_0xc5c3('0x36')],_0x122a6d[_0xc5c3('0x37')]);_0x4ffc5a[_0xc5c3('0x3a')]=_['intersection'](_0x122a6d[_0xc5c3('0x36')],qs[_0xc5c3('0x3b')](_0x590e65[_0xc5c3('0x37')][_0xc5c3('0x3b')]));_0x4ffc5a[_0xc5c3('0x3a')]=_0x4ffc5a['attributes']['length']?_0x4ffc5a[_0xc5c3('0x3a')]:_0x122a6d[_0xc5c3('0x36')];if(_0x590e65[_0xc5c3('0x37')]['includeAll']){_0x4ffc5a[_0xc5c3('0x4b')]=[{'all':!![]}];}_0x4ffc5a=_[_0xc5c3('0x44')]({},_0x4ffc5a,_0x590e65[_0xc5c3('0x4c')]);return db[_0xc5c3('0x32')][_0xc5c3('0x4d')](_0x4ffc5a)[_0xc5c3('0x2a')](handleEntityNotFound(_0x333c38,null))[_0xc5c3('0x2a')](respondWithResult(_0x333c38,null))['catch'](handleError(_0x333c38,null));};exports[_0xc5c3('0x2b')]=function(_0x3ff21e,_0x4538ab){return db['VoicePrefix'][_0xc5c3('0x4d')]({'where':{'id':_0x3ff21e[_0xc5c3('0x4a')]['id']}})[_0xc5c3('0x2a')](handleEntityNotFound(_0x4538ab,null))[_0xc5c3('0x2a')](removeEntity(_0x4538ab,null))[_0xc5c3('0x48')](handleError(_0x4538ab,null));};exports['describe']=function(_0xd716e6,_0x58204c){return db[_0xc5c3('0x32')]['describe']()[_0xc5c3('0x2a')](respondWithResult(_0x58204c,null))[_0xc5c3('0x48')](handleError(_0x58204c,null));};exports[_0xc5c3('0x4e')]=function(_0x325643,_0x1311de){var _0x4be969;return db[_0xc5c3('0x4f')][_0xc5c3('0x50')](function(_0x348960){return db[_0xc5c3('0x32')][_0xc5c3('0x4e')](_0x325643['body'],{'transaction':_0x348960})[_0xc5c3('0x2a')](function(_0x34bf9c){_0x4be969=_0x34bf9c[_0xc5c3('0x51')]({'plain':!![]});return db['VoiceExtension'][_0xc5c3('0x4d')]({'where':{'id':_0x4be969['VoiceExtensionId']},'raw':!![]})['then'](function(_0x39f83a){return createVoicePrefixExtensions(_0x4be969,_0x39f83a,_0x348960);});});})[_0xc5c3('0x2a')](function(){var _0x110105=_0x325643[_0xc5c3('0x52')][_0xc5c3('0x51')]({'plain':!![]});if(!_0x110105)throw new Error(_0xc5c3('0x53'));if(_0x110105['role']===_0xc5c3('0x52')){var _0x1ad3aa=_0x4be969;return db[_0xc5c3('0x54')][_0xc5c3('0x4d')]({'where':{'name':_0xc5c3('0x55'),'userProfileId':_0x110105[_0xc5c3('0x56')]},'raw':!![]})[_0xc5c3('0x2a')](function(_0x524aff){if(_0x524aff&&_0x524aff['autoAssociation']===0x0){return db[_0xc5c3('0x2c')][_0xc5c3('0x4e')]({'name':_0x1ad3aa['name'],'resourceId':_0x1ad3aa['id'],'type':_0x524aff[_0xc5c3('0x2e')],'sectionId':_0x524aff['id']},{})[_0xc5c3('0x2a')](function(){return _0x4be969;});}else{return _0x4be969;}})[_0xc5c3('0x48')](function(_0x41bcf7){logger['error'](_0xc5c3('0x57'),_0x41bcf7);throw _0x41bcf7;});}return _0x4be969;})[_0xc5c3('0x2a')](respondWithResult(_0x1311de,null))[_0xc5c3('0x48')](handleError(_0x1311de,null));};function Extension(_0x314392,_0x1b66bf,_0x36420a,_0x90e30b){this[_0xc5c3('0x58')]=_0xc5c3('0x59');this['exten']=_0x314392;this[_0xc5c3('0x5a')]=_0x36420a;this[_0xc5c3('0x34')]=_0xc5c3('0x5b');this['description']=_0xc5c3('0x5c');this[_0xc5c3('0x5d')]=_0x1b66bf;this[_0xc5c3('0x5e')]=_0x90e30b;}function createVoicePrefixExtensions(_0x30226f,_0x32d5e2,_0x5067ed){return new BPromise(function(_0xf54924,_0xea569b){var _0xf40f27=new Extension(formatPrefixName(_0x30226f[_0xc5c3('0x5f')]),0x1,_0xc5c3('0x60'),_0xc5c3('0x61'));_0xf40f27[_0xc5c3('0x62')]=_0x30226f['id'];return db['VoiceExtension'][_0xc5c3('0x4e')](_0xf40f27,{'transaction':_0x5067ed})[_0xc5c3('0x2a')](function(_0x397fc8){var _0x13f6a1=_0x397fc8[_0xc5c3('0x51')]({'plain':!![]});var _0x3cd213=_[_0xc5c3('0x31')](addVoicePrefixExtensions(_0x30226f,_0x32d5e2),function(_0x5b9013){_0x5b9013['VoiceExtensionId']=_0x13f6a1['id'];_0x5b9013[_0xc5c3('0x62')]=_0x30226f['id'];return _0x5b9013;});return db[_0xc5c3('0x63')][_0xc5c3('0x64')](_0x3cd213,{'transaction':_0x5067ed})[_0xc5c3('0x2a')](function(_0x1ed757){if(!_0x1ed757){return _0xea569b(_0xc5c3('0x65'));}else{return _0xf54924(_0x1ed757);}})[_0xc5c3('0x48')](function(_0x2cdd7a){return _0xea569b(_0x2cdd7a);});});;});};function addVoicePrefixExtensions(_0x385b39,_0x4d3e6f){var _0x92c6cf=[];var _0x358b83=formatPrefixName(_0x385b39['prefix']);_0x92c6cf['push'](new Extension(_0x358b83,0x2,_0xc5c3('0x66'),_0xc5c3('0x67')+_0x385b39[_0xc5c3('0x2e')]));if(_0x385b39[_0xc5c3('0x68')]){_0x92c6cf[_0xc5c3('0x69')](new Extension(_0x358b83,0x3,_0xc5c3('0x66'),_0xc5c3('0x6a')+_0x385b39[_0xc5c3('0x68')]));}else{_0x92c6cf[_0xc5c3('0x69')](new Extension(_0x358b83,0x3,'NoOp',_0xc5c3('0x6b')));}_0x92c6cf[_0xc5c3('0x69')](new Extension(_0x358b83,0x4,_0xc5c3('0x6c'),_0x4d3e6f[_0xc5c3('0x58')]+','+_0xc5c3('0x6d')+(0x8+_0x385b39[_0xc5c3('0x2e')][_0xc5c3('0x3c')])+'}'+','+0x1));return _0x92c6cf;}function formatPrefixName(_0x114c90){var _0x22606a='_';for(var _0x31e280=0x0;_0x31e280<_0x114c90[_0xc5c3('0x3c')];_0x31e280++){if(_0x114c90['charAt'](_0x31e280)=='-'){_0x22606a+=_0x114c90['charAt'](_0x31e280);}else{_0x22606a+='['+_0x114c90[_0xc5c3('0x6e')](_0x31e280)+']';}}_0x22606a+='.';return _0x22606a;}exports[_0xc5c3('0x29')]=function(_0x6281e5,_0x1951a5,_0x5540c0){var _0x2da018=_0x6281e5[_0xc5c3('0x6f')];_0x2da018[_0xc5c3('0x5f')]=_0xc5c3('0x70')+_0x2da018[_0xc5c3('0x2e')]+'-';return db[_0xc5c3('0x4f')][_0xc5c3('0x50')](function(_0x4a3f71){return db[_0xc5c3('0x32')]['update'](_0x2da018,{'where':{'id':_0x2da018['id']},'transaction':_0x4a3f71})[_0xc5c3('0x2a')](function(){return db[_0xc5c3('0x63')][_0xc5c3('0x2b')]({'where':{'VoicePrefixId':_0x2da018['id']},'transaction':_0x4a3f71})[_0xc5c3('0x2a')](function(){return db[_0xc5c3('0x63')][_0xc5c3('0x4d')]({'where':{'id':_0x2da018[_0xc5c3('0x71')]},'raw':!![]})[_0xc5c3('0x2a')](function(_0x4813a0){return createVoicePrefixExtensions(_0x2da018,_0x4813a0,_0x4a3f71);});});});})[_0xc5c3('0x2a')](function(){return db[_0xc5c3('0x32')][_0xc5c3('0x72')](_0x2da018['id']);})['then'](respondWithResult(_0x1951a5,null))['catch'](handleError(_0x1951a5,null));};exports[_0xc5c3('0x73')]=function(_0x5d6b6b,_0x5bcbd3,_0x1f222f){return db[_0xc5c3('0x32')]['find']({'where':{'id':_0x5d6b6b[_0xc5c3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5bcbd3,null))['then'](function(_0x2dbe80){if(_0x2dbe80){return _0x2dbe80[_0xc5c3('0x73')](_0x5d6b6b[_0xc5c3('0x6f')][_0xc5c3('0x74')],_[_0xc5c3('0x75')](_0x5d6b6b['body'],[_0xc5c3('0x74'),'id'])||{})['spread'](function(_0x110167){for(var _0x109cfa=0x0;_0x109cfa<_0x5d6b6b[_0xc5c3('0x6f')][_0xc5c3('0x74')][_0xc5c3('0x3c')];_0x109cfa+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':Number(_0x5d6b6b['body'][_0xc5c3('0x74')][_0x109cfa]),'VoicePrefixId':Number(_0x5d6b6b[_0xc5c3('0x4a')]['id'])});}return _0x110167;});}})[_0xc5c3('0x2a')](respondWithResult(_0x5bcbd3,null))['catch'](handleError(_0x5bcbd3,null));};exports[_0xc5c3('0x76')]=function(_0x41222d,_0x5dcd4d,_0x3afa94){return db['VoicePrefix'][_0xc5c3('0x4d')]({'where':{'id':_0x41222d[_0xc5c3('0x4a')]['id']}})[_0xc5c3('0x2a')](handleEntityNotFound(_0x5dcd4d,null))[_0xc5c3('0x2a')](function(_0x4b0d02){if(_0x4b0d02){return _0x4b0d02[_0xc5c3('0x76')](_0x41222d[_0xc5c3('0x37')][_0xc5c3('0x74')])[_0xc5c3('0x2a')](function(){if(_[_0xc5c3('0x77')](_0x41222d[_0xc5c3('0x37')][_0xc5c3('0x74')])){for(var _0x1f36f8=0x0;_0x1f36f8<_0x41222d['query']['ids']['length'];_0x1f36f8+=0x1){socket['emit'](_0xc5c3('0x78'),{'UserId':Number(_0x41222d[_0xc5c3('0x37')][_0xc5c3('0x74')][_0x1f36f8]),'VoicePrefixId':Number(_0x41222d[_0xc5c3('0x4a')]['id'])});}}else{socket[_0xc5c3('0x79')](_0xc5c3('0x78'),{'UserId':Number(_0x41222d[_0xc5c3('0x37')][_0xc5c3('0x74')]),'VoicePrefixId':Number(_0x41222d[_0xc5c3('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x5dcd4d,null))[_0xc5c3('0x48')](handleError(_0x5dcd4d,null));};exports[_0xc5c3('0x7a')]=function(_0x3aa5e2,_0x1efa1d,_0x2fae6d){var _0x258e36={};var _0x2f1be8={};var _0x550966;var _0x5733a2;return db[_0xc5c3('0x32')][_0xc5c3('0x7b')]({'where':{'id':_0x3aa5e2[_0xc5c3('0x4a')]['id']}})[_0xc5c3('0x2a')](handleEntityNotFound(_0x1efa1d,null))[_0xc5c3('0x2a')](function(_0x306d22){if(_0x306d22){_0x550966=_0x306d22;_0x2f1be8[_0xc5c3('0x36')]=_[_0xc5c3('0x38')](db[_0xc5c3('0x7c')][_0xc5c3('0x33')]);_0x2f1be8[_0xc5c3('0x37')]=_['keys'](_0x3aa5e2[_0xc5c3('0x37')]);_0x2f1be8[_0xc5c3('0x42')]=_[_0xc5c3('0x39')](_0x2f1be8[_0xc5c3('0x36')],_0x2f1be8[_0xc5c3('0x37')]);_0x258e36['attributes']=_[_0xc5c3('0x39')](_0x2f1be8[_0xc5c3('0x36')],qs[_0xc5c3('0x3b')](_0x3aa5e2[_0xc5c3('0x37')]['fields']));_0x258e36[_0xc5c3('0x3a')]=_0x258e36[_0xc5c3('0x3a')][_0xc5c3('0x3c')]?_0x258e36['attributes']:_0x2f1be8[_0xc5c3('0x36')];_0x258e36[_0xc5c3('0x3f')]=qs[_0xc5c3('0x40')](_0x3aa5e2[_0xc5c3('0x37')][_0xc5c3('0x40')]);_0x258e36[_0xc5c3('0x41')]=qs[_0xc5c3('0x42')](_[_0xc5c3('0x7d')](_0x3aa5e2[_0xc5c3('0x37')],_0x2f1be8[_0xc5c3('0x42')]));if(_0x3aa5e2[_0xc5c3('0x37')][_0xc5c3('0x43')]){_0x258e36[_0xc5c3('0x41')]=_[_0xc5c3('0x44')](_0x258e36[_0xc5c3('0x41')],{'$or':_[_0xc5c3('0x31')](_0x258e36['attributes'],function(_0x2bf9d2){var _0x8aaa64={};_0x8aaa64[_0x2bf9d2]={'$like':'%'+_0x3aa5e2['query'][_0xc5c3('0x43')]+'%'};return _0x8aaa64;})});}_0x258e36=_['merge']({},_0x258e36,_0x3aa5e2[_0xc5c3('0x4c')]);return _0x550966[_0xc5c3('0x7a')](_0x258e36);}})[_0xc5c3('0x2a')](function(_0x1800a0){if(_0x1800a0){_0x5733a2=_0x1800a0[_0xc5c3('0x3c')];if(!_0x3aa5e2['query'][_0xc5c3('0x3d')](_0xc5c3('0x3e'))){_0x258e36[_0xc5c3('0x21')]=qs['limit'](_0x3aa5e2['query'][_0xc5c3('0x21')]);_0x258e36['offset']=qs[_0xc5c3('0x20')](_0x3aa5e2[_0xc5c3('0x37')][_0xc5c3('0x20')]);}return _0x550966['getAgents'](_0x258e36);}})[_0xc5c3('0x2a')](function(_0x3325b6){if(_0x3325b6){return _0x3325b6?{'count':_0x5733a2,'rows':_0x3325b6}:null;}})[_0xc5c3('0x2a')](respondWithResult(_0x1efa1d,null))[_0xc5c3('0x48')](handleError(_0x1efa1d,null));};exports[_0xc5c3('0x7e')]=function(_0x57070d,_0x2f5315,_0x37ef35){var _0x2dcae5={};var _0x5d5248={};var _0xd3091c;var _0x26292e;return db[_0xc5c3('0x32')][_0xc5c3('0x7b')]({'where':{'id':_0x57070d[_0xc5c3('0x4a')]['id']}})[_0xc5c3('0x2a')](handleEntityNotFound(_0x2f5315,null))[_0xc5c3('0x2a')](function(_0x12d800){if(_0x12d800){_0xd3091c=_0x12d800;_0x5d5248['model']=_[_0xc5c3('0x38')](db['Team'][_0xc5c3('0x33')]);_0x5d5248[_0xc5c3('0x37')]=_['keys'](_0x57070d[_0xc5c3('0x37')]);_0x5d5248[_0xc5c3('0x42')]=_['intersection'](_0x5d5248[_0xc5c3('0x36')],_0x5d5248[_0xc5c3('0x37')]);_0x2dcae5[_0xc5c3('0x3a')]=_[_0xc5c3('0x39')](_0x5d5248[_0xc5c3('0x36')],qs['fields'](_0x57070d[_0xc5c3('0x37')][_0xc5c3('0x3b')]));_0x2dcae5[_0xc5c3('0x3a')]=_0x2dcae5[_0xc5c3('0x3a')][_0xc5c3('0x3c')]?_0x2dcae5[_0xc5c3('0x3a')]:_0x5d5248['model'];_0x2dcae5[_0xc5c3('0x3f')]=qs[_0xc5c3('0x40')](_0x57070d['query']['sort']);_0x2dcae5[_0xc5c3('0x41')]=qs[_0xc5c3('0x42')](_['pick'](_0x57070d[_0xc5c3('0x37')],_0x5d5248[_0xc5c3('0x42')]));if(_0x57070d[_0xc5c3('0x37')]['filter']){_0x2dcae5[_0xc5c3('0x41')]=_[_0xc5c3('0x44')](_0x2dcae5[_0xc5c3('0x41')],{'$or':_[_0xc5c3('0x31')](_0x2dcae5[_0xc5c3('0x3a')],function(_0x86d21a){var _0x53f1d={};_0x53f1d[_0x86d21a]={'$like':'%'+_0x57070d[_0xc5c3('0x37')][_0xc5c3('0x43')]+'%'};return _0x53f1d;})});}_0x2dcae5=_[_0xc5c3('0x44')]({},_0x2dcae5,_0x57070d[_0xc5c3('0x4c')]);return _0xd3091c[_0xc5c3('0x7e')](_0x2dcae5);}})['then'](function(_0x48e3a2){if(_0x48e3a2){_0x26292e=_0x48e3a2[_0xc5c3('0x3c')];if(!_0x57070d['query']['hasOwnProperty'](_0xc5c3('0x3e'))){_0x2dcae5['limit']=qs[_0xc5c3('0x21')](_0x57070d[_0xc5c3('0x37')]['limit']);_0x2dcae5['offset']=qs[_0xc5c3('0x20')](_0x57070d['query']['offset']);}return _0xd3091c[_0xc5c3('0x7e')](_0x2dcae5);}})[_0xc5c3('0x2a')](function(_0x3ce0e9){if(_0x3ce0e9){return _0x3ce0e9?{'count':_0x26292e,'rows':_0x3ce0e9}:null;}})[_0xc5c3('0x2a')](respondWithResult(_0x2f5315,null))[_0xc5c3('0x48')](handleError(_0x2f5315,null));};exports[_0xc5c3('0x7f')]=function(_0x116965,_0xa4672a,_0x1aba09){var _0x557b8f=_0x116965['body'][_0xc5c3('0x74')];var _0x389c96;return db[_0xc5c3('0x80')][_0xc5c3('0x81')]({'where':{'id':_0x557b8f},'attributes':['id'],'include':[{'model':db[_0xc5c3('0x7c')],'as':'Agents','attributes':['id',_0xc5c3('0x2e'),'online',_0xc5c3('0x82'),_0xc5c3('0x83')],'raw':!![]}]})[_0xc5c3('0x2a')](function(_0x2c8937){if(_0x2c8937){_0x389c96=_0x2c8937;var _0x9e9372=_[_0xc5c3('0x84')](_0x2c8937,function(_0x1dcde5){var _0x2c8fdb=_0x1dcde5['get']({'plain':!![]});return _0x2c8fdb['Agents'];});return db['VoicePrefix'][_0xc5c3('0x4d')]({'where':{'id':_0x116965[_0xc5c3('0x4a')]['id']}})[_0xc5c3('0x2a')](function(_0x3cc60b){return db[_0xc5c3('0x4f')][_0xc5c3('0x50')](function(_0x2c5fd2){return _0x3cc60b[_0xc5c3('0x7f')](_0x557b8f,{'transaction':_0x2c5fd2})[_0xc5c3('0x2a')](function(){return BPromise[_0xc5c3('0x85')](_0x389c96,function(_0x554787){return db[_0xc5c3('0x86')][_0xc5c3('0x87')]({'TeamId':_0x554787['id'],'VoicePrefixId':_0x116965[_0xc5c3('0x4a')]['id']},{'transaction':_0x2c5fd2});});})[_0xc5c3('0x2a')](function(){return BPromise[_0xc5c3('0x85')](_0x9e9372,function(_0x589e28){return db[_0xc5c3('0x88')][_0xc5c3('0x89')]({'where':{'UserId':_0x589e28['id'],'VoicePrefixId':_0x116965[_0xc5c3('0x4a')]['id']},'transaction':_0x2c5fd2});});})['then'](function(){_0x9e9372[_0xc5c3('0x8a')](function(_0x2dd850){socket[_0xc5c3('0x79')](_0xc5c3('0x8b'),{'UserId':_0x2dd850['id'],'VoicePrefixId':_0x3cc60b['id']});});});});});}})[_0xc5c3('0x2a')](respondWithStatusCode(_0xa4672a,null))[_0xc5c3('0x48')](handleError(_0xa4672a,null));};exports[_0xc5c3('0x8c')]=function(_0x53a502,_0x762654,_0x37459f){return db['Team'][_0xc5c3('0x81')]({'where':{'id':_0x53a502[_0xc5c3('0x37')][_0xc5c3('0x74')]},'attributes':['id'],'include':[{'model':db[_0xc5c3('0x7c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc5c3('0x2a')](handleEntityNotFound(_0x762654,null))[_0xc5c3('0x2a')](function(_0x3aafa0){var _0xe80b2b=_[_0xc5c3('0x31')](_0x3aafa0,'id');var _0x2b49da=[];var _0x47bd08=[];var _0x314072=squel[_0xc5c3('0x8d')]();_0x314072['field'](_0xc5c3('0x8e'))['from'](_0xc5c3('0x8f'),'tq')[_0xc5c3('0x90')](_0xc5c3('0x91'),'ut',_0xc5c3('0x92'))['where']('VoicePrefixId\x20=\x20?',_0x53a502['params']['id']);for(var _0x3b5ca9=0x0;_0x3b5ca9<_0x3aafa0[_0xc5c3('0x3c')];_0x3b5ca9+=0x1){let _0x283935=_0x3aafa0[_0x3b5ca9];for(var _0x5cebbc=0x0;_0x5cebbc<_0x283935[_0xc5c3('0x93')]['length'];_0x5cebbc+=0x1){let _0x423b48=_0x283935[_0xc5c3('0x93')][_0x5cebbc];var _0x2a8dfc=_0x314072[_0xc5c3('0x94')]();_0x2a8dfc[_0xc5c3('0x41')](_0xc5c3('0x95'),_0x423b48['id']);_0x47bd08[_0xc5c3('0x69')](db[_0xc5c3('0x4f')][_0xc5c3('0x37')](_0x2a8dfc[_0xc5c3('0x96')](),{'type':db['sequelize'][_0xc5c3('0x97')]['SELECT']})[_0xc5c3('0x2a')](function(_0x397543){if(_0x397543[_0xc5c3('0x3c')]===0x1){return _0x423b48['id'];}else{var _0x21941a=_['every'](_[_0xc5c3('0x31')](_0x397543,_0xc5c3('0x98')),function(_0x1b7fc8){return _['includes'](_0xe80b2b,_0x1b7fc8);});if(_0x21941a){return _0x423b48['id'];}}}));}}return BPromise['all'](_0x47bd08)[_0xc5c3('0x2a')](function(_0x5731da){_0x2b49da=_(_0x2b49da)[_0xc5c3('0x99')](_0x5731da)[_0xc5c3('0x9a')]()['value']();return db[_0xc5c3('0x32')][_0xc5c3('0x4d')]({'where':{'id':_0x53a502['params']['id']}})['then'](function(_0x288b93){return db[_0xc5c3('0x4f')][_0xc5c3('0x50')](function(_0x187a7a){return _0x288b93['removeTeams'](_0x53a502[_0xc5c3('0x37')][_0xc5c3('0x74')],{'transaction':_0x187a7a})[_0xc5c3('0x2a')](function(){if(!_['isEmpty'](_0x2b49da)){return _0x288b93[_0xc5c3('0x76')](_0x2b49da,{'transaction':_0x187a7a});}})[_0xc5c3('0x2a')](function(){_0x2b49da['forEach'](function(_0x8ec6b6){socket[_0xc5c3('0x79')](_0xc5c3('0x78'),{'UserId':_0x8ec6b6,'VoicePrefixId':_0x288b93['id']});});});});});});})[_0xc5c3('0x2a')](respondWithStatusCode(_0x762654,null))[_0xc5c3('0x48')](handleError(_0x762654,null));}; \ No newline at end of file +var _0x2032=['sequelize','body','VoiceExtension','user','VoicePrefixes','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','goto','charAt','system-','transaction','findById','ids','omit','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','sort','nolimit','Team','getTeams','addTeams','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','upsert','findOrCreate','forEach','userVoicePrefix:save','removeTeams','User','select','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','QueryTypes','SELECT','TeamId','includes','all','union','compact','isEmpty','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','sendStatus','status','end','offset','limit','count','set','json','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','describe','create'];(function(_0x5cd7c1,_0x1d0b1f){var _0xfaf06e=function(_0x4b5549){while(--_0x4b5549){_0x5cd7c1['push'](_0x5cd7c1['shift']());}};_0xfaf06e(++_0x1d0b1f);}(_0x2032,0xd9));var _0x2203=function(_0x340d80,_0x241cc6){_0x340d80=_0x340d80-0x0;var _0x309e77=_0x2032[_0x340d80];return _0x309e77;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2203('0x18')]));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0x21a3af,_0x472265){_0x472265=_0x472265||0xcc;return function(_0x1c1ead){if(_0x1c1ead){return _0x21a3af[_0x2203('0x19')](_0x472265);}return _0x21a3af[_0x2203('0x1a')](_0x472265)[_0x2203('0x1b')]();};}function respondWithResult(_0x2c36e6,_0x2c085c){_0x2c085c=_0x2c085c||0xc8;return function(_0xdf9d0b){if(_0xdf9d0b){return _0x2c36e6[_0x2203('0x1a')](_0x2c085c)['json'](_0xdf9d0b);}};}function respondWithFilteredResult(_0x280eda,_0x2ee127){return function(_0x4893ff){if(_0x4893ff){var _0x3f9ef6=typeof _0x2ee127[_0x2203('0x1c')]==='undefined'&&typeof _0x2ee127[_0x2203('0x1d')]==='undefined';var _0x2904ba=_0x4893ff[_0x2203('0x1e')];var _0x3c8c34=_0x3f9ef6?0x0:_0x2ee127[_0x2203('0x1c')];var _0x15cb1a=_0x3f9ef6?_0x4893ff[_0x2203('0x1e')]:_0x2ee127['offset']+_0x2ee127[_0x2203('0x1d')];var _0x50822b;if(_0x15cb1a>=_0x2904ba){_0x15cb1a=_0x2904ba;_0x50822b=0xc8;}else{_0x50822b=0xce;}_0x280eda['status'](_0x50822b);return _0x280eda[_0x2203('0x1f')]('Content-Range',_0x3c8c34+'-'+_0x15cb1a+'/'+_0x2904ba)[_0x2203('0x20')](_0x4893ff);}return null;};}function patchUpdates(_0x5bfe61){return function(_0x5d4c4e){try{jsonpatch[_0x2203('0x21')](_0x5d4c4e,_0x5bfe61,!![]);}catch(_0x5e29cd){return BPromise['reject'](_0x5e29cd);}return _0x5d4c4e[_0x2203('0x22')]();};}function saveUpdates(_0x2718f5,_0x21f930){return function(_0xfd0970){if(_0xfd0970){return _0xfd0970[_0x2203('0x23')](_0x2718f5)[_0x2203('0x24')](function(_0x49c12){return _0x49c12;});}return null;};}function removeEntity(_0x250349,_0x576378){return function(_0x143f41){if(_0x143f41){return _0x143f41[_0x2203('0x25')]()[_0x2203('0x24')](function(){var _0x5f11bf=_0x143f41[_0x2203('0x26')]({'plain':!![]});var _0x1cec17='VoicePrefixes';return db[_0x2203('0x27')][_0x2203('0x25')]({'where':{'type':_0x1cec17,'resourceId':_0x5f11bf['id']}})[_0x2203('0x24')](function(){return _0x143f41;});})[_0x2203('0x24')](function(){_0x250349[_0x2203('0x1a')](0xcc)[_0x2203('0x1b')]();});}};}function handleEntityNotFound(_0x9c53f,_0x5a95c1){return function(_0x34b8ba){if(!_0x34b8ba){_0x9c53f[_0x2203('0x19')](0x194);}return _0x34b8ba;};}function handleError(_0x406ce9,_0x74f035){_0x74f035=_0x74f035||0x1f4;return function(_0x52a426){logger[_0x2203('0x28')](_0x52a426[_0x2203('0x29')]);if(_0x52a426[_0x2203('0x2a')]){delete _0x52a426[_0x2203('0x2a')];}_0x406ce9['status'](_0x74f035)[_0x2203('0x2b')](_0x52a426);};}exports[_0x2203('0x2c')]=function(_0x5e6560,_0x5c0157){var _0x1d5f74={},_0x52fafc={},_0x58b44d={'count':0x0,'rows':[]};var _0x125dfc=_[_0x2203('0x2d')](db[_0x2203('0x2e')][_0x2203('0x2f')],function(_0xf2801d){return{'name':_0xf2801d['fieldName'],'type':_0xf2801d[_0x2203('0x30')][_0x2203('0x31')]};});_0x52fafc['model']=_[_0x2203('0x2d')](_0x125dfc,_0x2203('0x2a'));_0x52fafc[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5e6560[_0x2203('0x32')]);_0x52fafc[_0x2203('0x34')]=_[_0x2203('0x35')](_0x52fafc[_0x2203('0x36')],_0x52fafc[_0x2203('0x32')]);_0x1d5f74['attributes']=_[_0x2203('0x35')](_0x52fafc[_0x2203('0x36')],qs['fields'](_0x5e6560['query'][_0x2203('0x37')]));_0x1d5f74['attributes']=_0x1d5f74[_0x2203('0x38')][_0x2203('0x39')]?_0x1d5f74[_0x2203('0x38')]:_0x52fafc['model'];if(!_0x5e6560['query'][_0x2203('0x3a')]('nolimit')){_0x1d5f74[_0x2203('0x1d')]=qs['limit'](_0x5e6560[_0x2203('0x32')]['limit']);_0x1d5f74[_0x2203('0x1c')]=qs[_0x2203('0x1c')](_0x5e6560[_0x2203('0x32')][_0x2203('0x1c')]);}_0x1d5f74[_0x2203('0x3b')]=qs['sort'](_0x5e6560['query']['sort']);_0x1d5f74[_0x2203('0x3c')]=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0x5e6560[_0x2203('0x32')],_0x52fafc[_0x2203('0x34')]),_0x125dfc);if(_0x5e6560[_0x2203('0x32')][_0x2203('0x3e')]){_0x1d5f74['where']=_[_0x2203('0x3f')](_0x1d5f74[_0x2203('0x3c')],{'$or':_[_0x2203('0x2d')](_0x125dfc,function(_0x26be74){if(_0x26be74['type']!=='VIRTUAL'){var _0x3ddfe0={};_0x3ddfe0[_0x26be74['name']]={'$like':'%'+_0x5e6560[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x3ddfe0;}})});}_0x1d5f74=_[_0x2203('0x3f')]({},_0x1d5f74,_0x5e6560['options']);var _0x5bba52={'where':_0x1d5f74[_0x2203('0x3c')]};return db[_0x2203('0x2e')][_0x2203('0x1e')](_0x5bba52)[_0x2203('0x24')](function(_0x372709){_0x58b44d[_0x2203('0x1e')]=_0x372709;if(_0x5e6560['query'][_0x2203('0x40')]){_0x1d5f74[_0x2203('0x41')]=[{'all':!![]}];}return db[_0x2203('0x2e')][_0x2203('0x42')](_0x1d5f74);})[_0x2203('0x24')](function(_0x36b99f){_0x58b44d[_0x2203('0x43')]=_0x36b99f;return _0x58b44d;})[_0x2203('0x24')](respondWithFilteredResult(_0x5c0157,_0x1d5f74))[_0x2203('0x44')](handleError(_0x5c0157,null));};exports[_0x2203('0x45')]=function(_0x595281,_0x2e2ca5){var _0x24e773={'raw':![],'where':{'id':_0x595281[_0x2203('0x46')]['id']}},_0x4aab80={};_0x4aab80['model']=_['keys'](db[_0x2203('0x2e')]['rawAttributes']);_0x4aab80[_0x2203('0x32')]=_[_0x2203('0x33')](_0x595281[_0x2203('0x32')]);_0x4aab80[_0x2203('0x34')]=_['intersection'](_0x4aab80[_0x2203('0x36')],_0x4aab80[_0x2203('0x32')]);_0x24e773['attributes']=_[_0x2203('0x35')](_0x4aab80[_0x2203('0x36')],qs[_0x2203('0x37')](_0x595281[_0x2203('0x32')]['fields']));_0x24e773['attributes']=_0x24e773[_0x2203('0x38')]['length']?_0x24e773['attributes']:_0x4aab80[_0x2203('0x36')];if(_0x595281[_0x2203('0x32')][_0x2203('0x40')]){_0x24e773['include']=[{'all':!![]}];}_0x24e773=_['merge']({},_0x24e773,_0x595281[_0x2203('0x47')]);return db[_0x2203('0x2e')][_0x2203('0x48')](_0x24e773)[_0x2203('0x24')](handleEntityNotFound(_0x2e2ca5,null))[_0x2203('0x24')](respondWithResult(_0x2e2ca5,null))[_0x2203('0x44')](handleError(_0x2e2ca5,null));};exports['destroy']=function(_0x747dce,_0x557659){return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x747dce[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x557659,null))['then'](removeEntity(_0x557659,null))['catch'](handleError(_0x557659,null));};exports[_0x2203('0x49')]=function(_0x1f772d,_0x126aad){return db[_0x2203('0x2e')]['describe']()['then'](respondWithResult(_0x126aad,null))['catch'](handleError(_0x126aad,null));};exports[_0x2203('0x4a')]=function(_0x1c2734,_0x57b891){var _0x7f61df;return db[_0x2203('0x4b')]['transaction'](function(_0x32b1db){return db[_0x2203('0x2e')][_0x2203('0x4a')](_0x1c2734[_0x2203('0x4c')],{'transaction':_0x32b1db})['then'](function(_0x120db1){_0x7f61df=_0x120db1['get']({'plain':!![]});return db[_0x2203('0x4d')][_0x2203('0x48')]({'where':{'id':_0x7f61df['VoiceExtensionId']},'raw':!![]})[_0x2203('0x24')](function(_0x8d089e){return createVoicePrefixExtensions(_0x7f61df,_0x8d089e,_0x32b1db);});});})[_0x2203('0x24')](function(){var _0x378132=_0x1c2734[_0x2203('0x4e')][_0x2203('0x26')]({'plain':!![]});if(!_0x378132)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x378132['role']===_0x2203('0x4e')){var _0x524356=_0x7f61df;return db['UserProfileSection'][_0x2203('0x48')]({'where':{'name':_0x2203('0x4f'),'userProfileId':_0x378132[_0x2203('0x50')]},'raw':!![]})['then'](function(_0x213c24){if(_0x213c24&&_0x213c24['autoAssociation']===0x0){return db['UserProfileResource'][_0x2203('0x4a')]({'name':_0x524356['name'],'resourceId':_0x524356['id'],'type':_0x213c24['name'],'sectionId':_0x213c24['id']},{})['then'](function(){return _0x7f61df;});}else{return _0x7f61df;}})[_0x2203('0x44')](function(_0x31256b){logger[_0x2203('0x28')](_0x2203('0x51'),_0x31256b);throw _0x31256b;});}return _0x7f61df;})[_0x2203('0x24')](respondWithResult(_0x57b891,null))[_0x2203('0x44')](handleError(_0x57b891,null));};function Extension(_0x2baea2,_0x91f70c,_0x36b5fb,_0x216641){this[_0x2203('0x52')]=_0x2203('0x53');this['exten']=_0x2baea2;this['app']=_0x36b5fb;this[_0x2203('0x30')]=_0x2203('0x54');this[_0x2203('0x55')]=_0x2203('0x56');this[_0x2203('0x57')]=_0x91f70c;this[_0x2203('0x58')]=_0x216641;}function createVoicePrefixExtensions(_0x4f8b8e,_0x5486f9,_0xb49120){return new BPromise(function(_0x34358e,_0x21ee59){var _0x1e6d21=new Extension(formatPrefixName(_0x4f8b8e[_0x2203('0x59')]),0x1,_0x2203('0x5a'),_0x2203('0x5b'));_0x1e6d21[_0x2203('0x5c')]=_0x4f8b8e['id'];return db[_0x2203('0x4d')][_0x2203('0x4a')](_0x1e6d21,{'transaction':_0xb49120})[_0x2203('0x24')](function(_0x48bed1){var _0x1ea97a=_0x48bed1[_0x2203('0x26')]({'plain':!![]});var _0x3ce9f5=_[_0x2203('0x2d')](addVoicePrefixExtensions(_0x4f8b8e,_0x5486f9),function(_0x41a938){_0x41a938[_0x2203('0x5d')]=_0x1ea97a['id'];_0x41a938[_0x2203('0x5c')]=_0x4f8b8e['id'];return _0x41a938;});return db[_0x2203('0x4d')][_0x2203('0x5e')](_0x3ce9f5,{'transaction':_0xb49120})[_0x2203('0x24')](function(_0x49e795){if(!_0x49e795){return _0x21ee59(_0x2203('0x5f'));}else{return _0x34358e(_0x49e795);}})[_0x2203('0x44')](function(_0x24179a){return _0x21ee59(_0x24179a);});});;});};function addVoicePrefixExtensions(_0xc193b7,_0x34e820){var _0x1e44c=[];var _0x1068bc=formatPrefixName(_0xc193b7[_0x2203('0x59')]);_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x2,'Set',_0x2203('0x61')+_0xc193b7[_0x2203('0x2a')]));if(_0xc193b7[_0x2203('0x62')]){_0x1e44c['push'](new Extension(_0x1068bc,0x3,_0x2203('0x63'),_0x2203('0x64')+_0xc193b7[_0x2203('0x62')]));}else{_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x3,_0x2203('0x5a'),'No\x20callerid\x20available'));}_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x4,_0x2203('0x65'),_0x34e820[_0x2203('0x52')]+','+'${EXTEN:'+(0x8+_0xc193b7['name']['length'])+'}'+','+0x1));return _0x1e44c;}function formatPrefixName(_0x485e5b){var _0x595814='_';for(var _0x418d48=0x0;_0x418d48<_0x485e5b[_0x2203('0x39')];_0x418d48++){if(_0x485e5b[_0x2203('0x66')](_0x418d48)=='-'){_0x595814+=_0x485e5b[_0x2203('0x66')](_0x418d48);}else{_0x595814+='['+_0x485e5b[_0x2203('0x66')](_0x418d48)+']';}}_0x595814+='.';return _0x595814;}exports[_0x2203('0x23')]=function(_0x3f7926,_0x44bea0,_0x56dcbe){var _0x500860=_0x3f7926[_0x2203('0x4c')];_0x500860[_0x2203('0x59')]=_0x2203('0x67')+_0x500860[_0x2203('0x2a')]+'-';return db[_0x2203('0x4b')][_0x2203('0x68')](function(_0x45cc3a){return db[_0x2203('0x2e')][_0x2203('0x23')](_0x500860,{'where':{'id':_0x500860['id']},'transaction':_0x45cc3a})[_0x2203('0x24')](function(){return db[_0x2203('0x4d')][_0x2203('0x25')]({'where':{'VoicePrefixId':_0x500860['id']},'transaction':_0x45cc3a})[_0x2203('0x24')](function(){return db[_0x2203('0x4d')][_0x2203('0x48')]({'where':{'id':_0x500860[_0x2203('0x5d')]},'raw':!![]})[_0x2203('0x24')](function(_0x173ac1){return createVoicePrefixExtensions(_0x500860,_0x173ac1,_0x45cc3a);});});});})[_0x2203('0x24')](function(){return db['VoicePrefix'][_0x2203('0x69')](_0x500860['id']);})['then'](respondWithResult(_0x44bea0,null))[_0x2203('0x44')](handleError(_0x44bea0,null));};exports['addAgents']=function(_0x5ba500,_0xf71e7e,_0x269649){return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x5ba500[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0xf71e7e,null))[_0x2203('0x24')](function(_0x4e9a01){if(_0x4e9a01){return _0x4e9a01['addAgents'](_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')],_[_0x2203('0x6b')](_0x5ba500['body'],['ids','id'])||{})['spread'](function(_0xdff006){for(var _0x2d26ba=0x0;_0x2d26ba<_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')]['length'];_0x2d26ba+=0x1){socket[_0x2203('0x6c')]('userVoicePrefix:save',{'UserId':Number(_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')][_0x2d26ba]),'VoicePrefixId':Number(_0x5ba500[_0x2203('0x46')]['id'])});}return _0xdff006;});}})[_0x2203('0x24')](respondWithResult(_0xf71e7e,null))[_0x2203('0x44')](handleError(_0xf71e7e,null));};exports['removeAgents']=function(_0x4592fa,_0x247f26,_0x18663f){return db['VoicePrefix'][_0x2203('0x48')]({'where':{'id':_0x4592fa[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x247f26,null))[_0x2203('0x24')](function(_0x1c65f9){if(_0x1c65f9){return _0x1c65f9[_0x2203('0x6d')](_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')])[_0x2203('0x24')](function(){if(_[_0x2203('0x6e')](_0x4592fa[_0x2203('0x32')]['ids'])){for(var _0x1adfa6=0x0;_0x1adfa6<_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')][_0x2203('0x39')];_0x1adfa6+=0x1){socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':Number(_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')][_0x1adfa6]),'VoicePrefixId':Number(_0x4592fa[_0x2203('0x46')]['id'])});}}else{socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':Number(_0x4592fa[_0x2203('0x32')]['ids']),'VoicePrefixId':Number(_0x4592fa['params']['id'])});}});}})[_0x2203('0x24')](respondWithStatusCode(_0x247f26,null))[_0x2203('0x44')](handleError(_0x247f26,null));};exports[_0x2203('0x70')]=function(_0xb6863b,_0x42dce6,_0x4fd029){var _0x16e518={};var _0x3cb792={};var _0x4e539b;var _0x511689;return db['VoicePrefix']['findOne']({'where':{'id':_0xb6863b['params']['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x42dce6,null))[_0x2203('0x24')](function(_0x437095){if(_0x437095){_0x4e539b=_0x437095;_0x3cb792['model']=_['keys'](db['User'][_0x2203('0x2f')]);_0x3cb792[_0x2203('0x32')]=_[_0x2203('0x33')](_0xb6863b[_0x2203('0x32')]);_0x3cb792[_0x2203('0x34')]=_[_0x2203('0x35')](_0x3cb792[_0x2203('0x36')],_0x3cb792['query']);_0x16e518[_0x2203('0x38')]=_[_0x2203('0x35')](_0x3cb792[_0x2203('0x36')],qs[_0x2203('0x37')](_0xb6863b[_0x2203('0x32')][_0x2203('0x37')]));_0x16e518[_0x2203('0x38')]=_0x16e518['attributes'][_0x2203('0x39')]?_0x16e518['attributes']:_0x3cb792['model'];_0x16e518[_0x2203('0x3b')]=qs['sort'](_0xb6863b[_0x2203('0x32')][_0x2203('0x71')]);_0x16e518['where']=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0xb6863b[_0x2203('0x32')],_0x3cb792[_0x2203('0x34')]));if(_0xb6863b[_0x2203('0x32')][_0x2203('0x3e')]){_0x16e518['where']=_[_0x2203('0x3f')](_0x16e518[_0x2203('0x3c')],{'$or':_['map'](_0x16e518['attributes'],function(_0x377176){var _0x3fe71b={};_0x3fe71b[_0x377176]={'$like':'%'+_0xb6863b[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x3fe71b;})});}_0x16e518=_[_0x2203('0x3f')]({},_0x16e518,_0xb6863b[_0x2203('0x47')]);return _0x4e539b[_0x2203('0x70')](_0x16e518);}})[_0x2203('0x24')](function(_0x4749df){if(_0x4749df){_0x511689=_0x4749df[_0x2203('0x39')];if(!_0xb6863b[_0x2203('0x32')][_0x2203('0x3a')](_0x2203('0x72'))){_0x16e518[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0xb6863b[_0x2203('0x32')]['limit']);_0x16e518['offset']=qs[_0x2203('0x1c')](_0xb6863b[_0x2203('0x32')]['offset']);}return _0x4e539b[_0x2203('0x70')](_0x16e518);}})[_0x2203('0x24')](function(_0x5b5e95){if(_0x5b5e95){return _0x5b5e95?{'count':_0x511689,'rows':_0x5b5e95}:null;}})[_0x2203('0x24')](respondWithResult(_0x42dce6,null))[_0x2203('0x44')](handleError(_0x42dce6,null));};exports['getTeams']=function(_0x21f357,_0x10c65a,_0x541639){var _0x318f3f={};var _0x1c4b57={};var _0x3cfe3f;var _0x1596f7;return db['VoicePrefix']['findOne']({'where':{'id':_0x21f357[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x10c65a,null))[_0x2203('0x24')](function(_0x4ff77f){if(_0x4ff77f){_0x3cfe3f=_0x4ff77f;_0x1c4b57['model']=_[_0x2203('0x33')](db[_0x2203('0x73')][_0x2203('0x2f')]);_0x1c4b57['query']=_['keys'](_0x21f357[_0x2203('0x32')]);_0x1c4b57[_0x2203('0x34')]=_['intersection'](_0x1c4b57[_0x2203('0x36')],_0x1c4b57[_0x2203('0x32')]);_0x318f3f['attributes']=_[_0x2203('0x35')](_0x1c4b57['model'],qs[_0x2203('0x37')](_0x21f357['query']['fields']));_0x318f3f['attributes']=_0x318f3f[_0x2203('0x38')][_0x2203('0x39')]?_0x318f3f['attributes']:_0x1c4b57[_0x2203('0x36')];_0x318f3f[_0x2203('0x3b')]=qs[_0x2203('0x71')](_0x21f357['query'][_0x2203('0x71')]);_0x318f3f['where']=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0x21f357['query'],_0x1c4b57[_0x2203('0x34')]));if(_0x21f357[_0x2203('0x32')]['filter']){_0x318f3f[_0x2203('0x3c')]=_[_0x2203('0x3f')](_0x318f3f[_0x2203('0x3c')],{'$or':_[_0x2203('0x2d')](_0x318f3f[_0x2203('0x38')],function(_0x5d73a7){var _0x2ba7d3={};_0x2ba7d3[_0x5d73a7]={'$like':'%'+_0x21f357[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x2ba7d3;})});}_0x318f3f=_[_0x2203('0x3f')]({},_0x318f3f,_0x21f357[_0x2203('0x47')]);return _0x3cfe3f[_0x2203('0x74')](_0x318f3f);}})['then'](function(_0x29b41b){if(_0x29b41b){_0x1596f7=_0x29b41b[_0x2203('0x39')];if(!_0x21f357['query'][_0x2203('0x3a')]('nolimit')){_0x318f3f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x21f357[_0x2203('0x32')]['limit']);_0x318f3f[_0x2203('0x1c')]=qs[_0x2203('0x1c')](_0x21f357[_0x2203('0x32')][_0x2203('0x1c')]);}return _0x3cfe3f[_0x2203('0x74')](_0x318f3f);}})[_0x2203('0x24')](function(_0x1ccf09){if(_0x1ccf09){return _0x1ccf09?{'count':_0x1596f7,'rows':_0x1ccf09}:null;}})['then'](respondWithResult(_0x10c65a,null))['catch'](handleError(_0x10c65a,null));};exports[_0x2203('0x75')]=function(_0x41eb4c,_0x25996c,_0x4e1f55){var _0x2188d4=_0x41eb4c[_0x2203('0x4c')][_0x2203('0x6a')];var _0x500604;return db[_0x2203('0x73')][_0x2203('0x42')]({'where':{'id':_0x2188d4},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2203('0x76'),'attributes':['id','name',_0x2203('0x77'),_0x2203('0x78'),'interface'],'raw':!![]}]})[_0x2203('0x24')](function(_0x9586e1){if(_0x9586e1){_0x500604=_0x9586e1;var _0x266d7e=_[_0x2203('0x79')](_0x9586e1,function(_0x34a160){var _0x36ab7f=_0x34a160[_0x2203('0x26')]({'plain':!![]});return _0x36ab7f[_0x2203('0x76')];});return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x41eb4c[_0x2203('0x46')]['id']}})[_0x2203('0x24')](function(_0x4e7ba1){return db[_0x2203('0x4b')]['transaction'](function(_0x114e07){return _0x4e7ba1[_0x2203('0x75')](_0x2188d4,{'transaction':_0x114e07})[_0x2203('0x24')](function(){return BPromise[_0x2203('0x7a')](_0x500604,function(_0x145a72){return db[_0x2203('0x7b')][_0x2203('0x7c')]({'TeamId':_0x145a72['id'],'VoicePrefixId':_0x41eb4c[_0x2203('0x46')]['id']},{'transaction':_0x114e07});});})[_0x2203('0x24')](function(){return BPromise[_0x2203('0x7a')](_0x266d7e,function(_0x62843c){return db['UserVoicePrefix'][_0x2203('0x7d')]({'where':{'UserId':_0x62843c['id'],'VoicePrefixId':_0x41eb4c['params']['id']},'transaction':_0x114e07});});})[_0x2203('0x24')](function(){_0x266d7e[_0x2203('0x7e')](function(_0x6b8ea4){socket['emit'](_0x2203('0x7f'),{'UserId':_0x6b8ea4['id'],'VoicePrefixId':_0x4e7ba1['id']});});});});});}})[_0x2203('0x24')](respondWithStatusCode(_0x25996c,null))[_0x2203('0x44')](handleError(_0x25996c,null));};exports[_0x2203('0x80')]=function(_0x4316ae,_0x5c1138,_0x389f7f){return db['Team'][_0x2203('0x42')]({'where':{'id':_0x4316ae[_0x2203('0x32')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2203('0x81')],'as':_0x2203('0x76'),'attributes':['id'],'raw':!![]}]})[_0x2203('0x24')](handleEntityNotFound(_0x5c1138,null))[_0x2203('0x24')](function(_0x56c2cb){var _0x12179d=_['map'](_0x56c2cb,'id');var _0x55e083=[];var _0x4055eb=[];var _0x95b45a=squel[_0x2203('0x82')]();_0x95b45a[_0x2203('0x83')](_0x2203('0x84'))[_0x2203('0x85')](_0x2203('0x86'),'tq')['join'](_0x2203('0x87'),'ut',_0x2203('0x88'))[_0x2203('0x3c')]('VoicePrefixId\x20=\x20?',_0x4316ae['params']['id']);for(var _0x4d6ece=0x0;_0x4d6ece<_0x56c2cb[_0x2203('0x39')];_0x4d6ece+=0x1){let _0x46b5e6=_0x56c2cb[_0x4d6ece];for(var _0x3dba31=0x0;_0x3dba31<_0x46b5e6[_0x2203('0x76')]['length'];_0x3dba31+=0x1){let _0x238e6f=_0x46b5e6[_0x2203('0x76')][_0x3dba31];var _0x46146e=_0x95b45a[_0x2203('0x89')]();_0x46146e['where']('ut.UserId\x20=\x20?',_0x238e6f['id']);_0x4055eb[_0x2203('0x60')](db[_0x2203('0x4b')][_0x2203('0x32')](_0x46146e['toString'](),{'type':db[_0x2203('0x4b')][_0x2203('0x8a')][_0x2203('0x8b')]})[_0x2203('0x24')](function(_0x263130){if(_0x263130[_0x2203('0x39')]===0x1){return _0x238e6f['id'];}else{var _0xbee79c=_['every'](_[_0x2203('0x2d')](_0x263130,_0x2203('0x8c')),function(_0x131332){return _[_0x2203('0x8d')](_0x12179d,_0x131332);});if(_0xbee79c){return _0x238e6f['id'];}}}));}}return BPromise[_0x2203('0x8e')](_0x4055eb)[_0x2203('0x24')](function(_0x2d9004){_0x55e083=_(_0x55e083)[_0x2203('0x8f')](_0x2d9004)[_0x2203('0x90')]()['value']();return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x4316ae[_0x2203('0x46')]['id']}})[_0x2203('0x24')](function(_0x547eb9){return db[_0x2203('0x4b')][_0x2203('0x68')](function(_0x1022ef){return _0x547eb9[_0x2203('0x80')](_0x4316ae[_0x2203('0x32')][_0x2203('0x6a')],{'transaction':_0x1022ef})[_0x2203('0x24')](function(){if(!_[_0x2203('0x91')](_0x55e083)){return _0x547eb9[_0x2203('0x6d')](_0x55e083,{'transaction':_0x1022ef});}})['then'](function(){_0x55e083['forEach'](function(_0x225ea1){socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':_0x225ea1,'VoicePrefixId':_0x547eb9['id']});});});});});});})[_0x2203('0x24')](respondWithStatusCode(_0x5c1138,null))['catch'](handleError(_0x5c1138,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 03ef37c..3105154 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 _0x0f8b=['hasOwnProperty','hook','exports','VoicePrefix','setMaxListeners','save','update','remove','emit'];(function(_0x4dd524,_0x2247e5){var _0x482629=function(_0x1fc3a0){while(--_0x1fc3a0){_0x4dd524['push'](_0x4dd524['shift']());}};_0x482629(++_0x2247e5);}(_0x0f8b,0x1d7));var _0xb0f8=function(_0x4c6d13,_0x4347f5){_0x4c6d13=_0x4c6d13-0x0;var _0x37c175=_0x0f8b[_0x4c6d13];return _0x37c175;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0xb0f8('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xb0f8('0x1')](0x0);var events={'afterCreate':_0xb0f8('0x2'),'afterUpdate':_0xb0f8('0x3'),'afterDestroy':_0xb0f8('0x4')};function emitEvent(_0xbabf78){return function(_0xc1f5a8,_0x475d9c,_0x280332){VoicePrefixEvents[_0xb0f8('0x5')](_0xbabf78+':'+_0xc1f5a8['id'],_0xc1f5a8);VoicePrefixEvents[_0xb0f8('0x5')](_0xbabf78,_0xc1f5a8);_0x280332(null);};}for(var e in events){if(events[_0xb0f8('0x6')](e)){var event=events[e];VoicePrefix[_0xb0f8('0x7')](e,emitEvent(event));}}module[_0xb0f8('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x750a=['exports','../../mysqldb','VoicePrefix','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x750a,0x160));var _0xa750=function(_0x19c819,_0x3fda4c){_0x19c819=_0x19c819-0x0;var _0x10d9cb=_0x750a[_0x19c819];return _0x10d9cb;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xa750('0x0'))['db'][_0xa750('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa750('0x2'),'afterUpdate':_0xa750('0x3'),'afterDestroy':_0xa750('0x4')};function emitEvent(_0x19218b){return function(_0x13b137,_0x5a0bee,_0x544a7e){VoicePrefixEvents[_0xa750('0x5')](_0x19218b+':'+_0x13b137['id'],_0x13b137);VoicePrefixEvents[_0xa750('0x5')](_0x19218b,_0x13b137);_0x544a7e(null);};}for(var e in events){if(events[_0xa750('0x6')](e)){var event=events[e];VoicePrefix[_0xa750('0x7')](e,emitEvent(event));}}module[_0xa750('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index eba5d41..b823592 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 _0x13a9=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voicePrefix.attributes','VoicePrefix','voice_prefixes','lodash'];(function(_0x1c8567,_0x5180c6){var _0x5309fd=function(_0x257c5f){while(--_0x257c5f){_0x1c8567['push'](_0x1c8567['shift']());}};_0x5309fd(++_0x5180c6);}(_0x13a9,0x1b7));var _0x913a=function(_0x2b400a,_0x4bf268){_0x2b400a=_0x2b400a-0x0;var _0x3a1ec7=_0x13a9[_0x2b400a];return _0x3a1ec7;};'use strict';var _=require(_0x913a('0x0'));var util=require('util');var logger=require(_0x913a('0x1'))('api');var moment=require(_0x913a('0x2'));var BPromise=require(_0x913a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x913a('0x4'));var rimraf=require(_0x913a('0x5'));var config=require(_0x913a('0x6'));var attributes=require(_0x913a('0x7'));module['exports']=function(_0x1cd115,_0x55711a){return _0x1cd115['define'](_0x913a('0x8'),attributes,{'tableName':_0x913a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7cf3=['path','rimraf','../../config/environment','./voicePrefix.attributes','VoicePrefix','voice_prefixes','util','../../config/logger','api','bluebird','request-promise'];(function(_0x573171,_0x1a2833){var _0x18662d=function(_0x255f0f){while(--_0x255f0f){_0x573171['push'](_0x573171['shift']());}};_0x18662d(++_0x1a2833);}(_0x7cf3,0x1d4));var _0x37cf=function(_0x5ac0f0,_0xee4d98){_0x5ac0f0=_0x5ac0f0-0x0;var _0x4aceec=_0x7cf3[_0x5ac0f0];return _0x4aceec;};'use strict';var _=require('lodash');var util=require(_0x37cf('0x0'));var logger=require(_0x37cf('0x1'))(_0x37cf('0x2'));var moment=require('moment');var BPromise=require(_0x37cf('0x3'));var rp=require(_0x37cf('0x4'));var fs=require('fs');var path=require(_0x37cf('0x5'));var rimraf=require(_0x37cf('0x6'));var config=require(_0x37cf('0x7'));var attributes=require(_0x37cf('0x8'));module['exports']=function(_0x6801ba,_0x1979f3){return _0x6801ba['define'](_0x37cf('0x9'),attributes,{'tableName':_0x37cf('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 c27728d..78c9ee4 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 _0xe0c1=['VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','request','then'];(function(_0x598960,_0x276147){var _0x34abda=function(_0x1cdb76){while(--_0x1cdb76){_0x598960['push'](_0x598960['shift']());}};_0x34abda(++_0x276147);}(_0xe0c1,0x10f));var _0x1e0c=function(_0x2386c2,_0x2c0631){_0x2386c2=_0x2386c2-0x0;var _0x5bc1f0=_0xe0c1[_0x2386c2];return _0x5bc1f0;};'use strict';var _=require(_0x1e0c('0x0'));var util=require(_0x1e0c('0x1'));var moment=require(_0x1e0c('0x2'));var BPromise=require(_0x1e0c('0x3'));var rs=require(_0x1e0c('0x4'));var fs=require('fs');var Redis=require(_0x1e0c('0x5'));var db=require(_0x1e0c('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1e0c('0x7')]({'port':0x232a});config[_0x1e0c('0x8')]=_[_0x1e0c('0x9')](config[_0x1e0c('0x8')],{'host':_0x1e0c('0xa'),'port':0x18eb});var socket=require(_0x1e0c('0xb'))(new Redis(config[_0x1e0c('0x8')]));require(_0x1e0c('0xc'))['register'](socket);function respondWithRpcPromise(_0x1c22b6,_0x4c1f8e,_0x43df40){return new BPromise(function(_0x276ec9,_0x489960){return client[_0x1e0c('0xd')](_0x1c22b6,_0x43df40)[_0x1e0c('0xe')](function(_0x2bd205){logger['info'](_0x1e0c('0xf'),_0x4c1f8e,'request\x20sent');logger[_0x1e0c('0x10')](_0x1e0c('0x11'),_0x4c1f8e,_0x1e0c('0x12'),JSON[_0x1e0c('0x13')](_0x2bd205));if(_0x2bd205[_0x1e0c('0x14')]){if(_0x2bd205[_0x1e0c('0x14')][_0x1e0c('0x15')]===0x1f4){logger[_0x1e0c('0x14')](_0x1e0c('0xf'),_0x4c1f8e,_0x2bd205[_0x1e0c('0x14')]['message']);return _0x489960(_0x2bd205[_0x1e0c('0x14')]['message']);}logger[_0x1e0c('0x14')](_0x1e0c('0xf'),_0x4c1f8e,_0x2bd205[_0x1e0c('0x14')][_0x1e0c('0x16')]);return _0x276ec9(_0x2bd205[_0x1e0c('0x14')][_0x1e0c('0x16')]);}else{logger[_0x1e0c('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x4c1f8e,_0x1e0c('0x12'));_0x276ec9(_0x2bd205[_0x1e0c('0x18')][_0x1e0c('0x16')]);}})[_0x1e0c('0x19')](function(_0x561d73){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x4c1f8e,_0x561d73);_0x489960(_0x561d73);});});} \ No newline at end of file +var _0x4e83=['bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','redis','defaults','socket.io-emitter','./voicePrefix.socket','request','then','info','request\x20sent','debug','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','moment'];(function(_0x5647f0,_0x3314de){var _0x5cced5=function(_0x51803e){while(--_0x51803e){_0x5647f0['push'](_0x5647f0['shift']());}};_0x5cced5(++_0x3314de);}(_0x4e83,0x1ae));var _0x34e8=function(_0x3e3d0a,_0x4745dd){_0x3e3d0a=_0x3e3d0a-0x0;var _0x3fc765=_0x4e83[_0x3e3d0a];return _0x3fc765;};'use strict';var _=require(_0x34e8('0x0'));var util=require('util');var moment=require(_0x34e8('0x1'));var BPromise=require(_0x34e8('0x2'));var rs=require(_0x34e8('0x3'));var fs=require('fs');var Redis=require(_0x34e8('0x4'));var db=require(_0x34e8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x34e8('0x6'));var client=jayson[_0x34e8('0x7')]['http']({'port':0x232a});config[_0x34e8('0x8')]=_[_0x34e8('0x9')](config[_0x34e8('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x34e8('0xa'))(new Redis(config[_0x34e8('0x8')]));require(_0x34e8('0xb'))['register'](socket);function respondWithRpcPromise(_0x8ad56d,_0x1e3038,_0x42bb8d){return new BPromise(function(_0x46fe66,_0x316e99){return client[_0x34e8('0xc')](_0x8ad56d,_0x42bb8d)[_0x34e8('0xd')](function(_0x6827a3){logger[_0x34e8('0xe')]('VoicePrefix,\x20%s,\x20%s',_0x1e3038,_0x34e8('0xf'));logger[_0x34e8('0x10')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x1e3038,_0x34e8('0xf'),JSON[_0x34e8('0x11')](_0x6827a3));if(_0x6827a3[_0x34e8('0x12')]){if(_0x6827a3[_0x34e8('0x12')][_0x34e8('0x13')]===0x1f4){logger[_0x34e8('0x12')](_0x34e8('0x14'),_0x1e3038,_0x6827a3[_0x34e8('0x12')][_0x34e8('0x15')]);return _0x316e99(_0x6827a3['error'][_0x34e8('0x15')]);}logger[_0x34e8('0x12')](_0x34e8('0x14'),_0x1e3038,_0x6827a3[_0x34e8('0x12')][_0x34e8('0x15')]);return _0x46fe66(_0x6827a3['error'][_0x34e8('0x15')]);}else{logger[_0x34e8('0xe')](_0x34e8('0x14'),_0x1e3038,_0x34e8('0xf'));_0x46fe66(_0x6827a3[_0x34e8('0x16')][_0x34e8('0x15')]);}})[_0x34e8('0x17')](function(_0x3eb461){logger[_0x34e8('0x12')](_0x34e8('0x14'),_0x1e3038,_0x3eb461);_0x316e99(_0x3eb461);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 142b358..a2a00f2 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 _0x4f6f=['remove','emit','removeListener','./voicePrefix.events','save'];(function(_0x7d69d6,_0x4e160e){var _0x3065b2=function(_0x3cc383){while(--_0x3cc383){_0x7d69d6['push'](_0x7d69d6['shift']());}};_0x3065b2(++_0x4e160e);}(_0x4f6f,0x157));var _0xf4f6=function(_0x3ebb69,_0x3e612e){_0x3ebb69=_0x3ebb69-0x0;var _0x421e59=_0x4f6f[_0x3ebb69];return _0x421e59;};'use strict';var VoicePrefixEvents=require(_0xf4f6('0x0'));var events=[_0xf4f6('0x1'),_0xf4f6('0x2'),'update'];function createListener(_0x217663,_0x5278e1){return function(_0x402053){_0x5278e1[_0xf4f6('0x3')](_0x217663,_0x402053);};}function removeListener(_0x5a5c07,_0x2e8c14){return function(){VoicePrefixEvents[_0xf4f6('0x4')](_0x5a5c07,_0x2e8c14);};}exports['register']=function(_0x31ecb6){for(var _0x1172a6=0x0,_0x2dc7b9=events['length'];_0x1172a6<_0x2dc7b9;_0x1172a6++){var _0x106455=events[_0x1172a6];var _0x592fa6=createListener('voicePrefix:'+_0x106455,_0x31ecb6);VoicePrefixEvents['on'](_0x106455,_0x592fa6);}}; \ No newline at end of file +var _0xf46a=['removeListener','register','length','voicePrefix:','./voicePrefix.events','remove','update','emit'];(function(_0x50e2a9,_0x38adc2){var _0x2fb1ea=function(_0x3dc687){while(--_0x3dc687){_0x50e2a9['push'](_0x50e2a9['shift']());}};_0x2fb1ea(++_0x38adc2);}(_0xf46a,0xa4));var _0xaf46=function(_0x3fedb6,_0x3f4afd){_0x3fedb6=_0x3fedb6-0x0;var _0x4a6ab1=_0xf46a[_0x3fedb6];return _0x4a6ab1;};'use strict';var VoicePrefixEvents=require(_0xaf46('0x0'));var events=['save',_0xaf46('0x1'),_0xaf46('0x2')];function createListener(_0x571132,_0xf4ff9e){return function(_0x3a7936){_0xf4ff9e[_0xaf46('0x3')](_0x571132,_0x3a7936);};}function removeListener(_0x14a6b6,_0x34c69d){return function(){VoicePrefixEvents[_0xaf46('0x4')](_0x14a6b6,_0x34c69d);};}exports[_0xaf46('0x5')]=function(_0x399251){for(var _0x3aef9c=0x0,_0x9e9887=events[_0xaf46('0x6')];_0x3aef9c<_0x9e9887;_0x3aef9c++){var _0xa4a618=events[_0x3aef9c];var _0x105943=createListener(_0xaf46('0x7')+_0xa4a618,_0x399251);VoicePrefixEvents['on'](_0xa4a618,_0x105943);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 593520a..64b11e7 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 _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x325bc4,_0x4df462){var _0x330091=function(_0x22db60){while(--_0x22db60){_0x325bc4['push'](_0x325bc4['shift']());}};_0x330091(++_0x4df462);}(_0xb10b,0x12a));var _0xbb10=function(_0x377b59,_0x1f167d){_0x377b59=_0x377b59-0x0;var _0x2cae54=_0xb10b[_0x377b59];return _0x2cae54;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x1a20f7,_0x18de4c){var _0x6f41ef=function(_0x109ef7){while(--_0x109ef7){_0x1a20f7['push'](_0x1a20f7['shift']());}};_0x6f41ef(++_0x18de4c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 25a2f10..1a378b9 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 _0x5a24=['periodic_announce','split','joinempty','join','leavewhenempty','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','progressive','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','ringall','fewestcalls','rrmemory','wrandom','setDataValue','strategy','getDataValue','type','dialMethod','booked','predictive','power','INTEGER','yes','all','once','TEXT'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0x5a24,0x1bb));var _0x45a2=function(_0x12bfe6,_0xc14c4b){_0x12bfe6=_0x12bfe6-0x0;var _0x59bb9f=_0x5a24[_0x12bfe6];return _0x59bb9f;};'use strict';var Sequelize=require(_0x45a2('0x0'));module[_0x45a2('0x1')]={'name':{'type':Sequelize[_0x45a2('0x2')],'allowNull':![],'unique':_0x45a2('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x45a2('0x4')](_0x45a2('0x5'),_0x45a2('0x6')),'allowNull':![],'defaultValue':_0x45a2('0x5')},'musiconhold':{'type':Sequelize[_0x45a2('0x2')],'defaultValue':_0x45a2('0x7')},'announce':{'type':Sequelize[_0x45a2('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x45a2('0x4')]('rr',_0x45a2('0x8'),'leastrecent',_0x45a2('0x9'),'random',_0x45a2('0xa'),'linear',_0x45a2('0xb'),'rrordered'),'allowNull':![],'defaultValue':_0x45a2('0x8'),'set':function(_0x4c359e){this[_0x45a2('0xc')](_0x45a2('0xd'),_0x4c359e?_0x4c359e:_0x45a2('0xa'));},'get':function(){var _0x295580=this[_0x45a2('0xe')](_0x45a2('0xf'));var _0x5e23bc=this['getDataValue'](_0x45a2('0x10'));var _0x14be47=this[_0x45a2('0xe')]('strategy');if(_0x295580==='inbound'){return _0x14be47;}if(_0x5e23bc===_0x45a2('0x11')&&_0x14be47===_0x45a2('0xa')||_0x5e23bc===_0x45a2('0x11')&&_0x14be47==='roundrobin'){return _0x14be47;}if(_0x5e23bc==='progressive'||_0x5e23bc===_0x45a2('0x12')||_0x5e23bc===_0x45a2('0x13')){return _0x14be47;}return null;}},'servicelevel':{'type':Sequelize[_0x45a2('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x45a2('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x45a2('0x14')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x45a2('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x45a2('0x2')]},'weight':{'type':Sequelize[_0x45a2('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x45a2('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x45a2('0x4')](_0x45a2('0x15'),'no'),'defaultValue':_0x45a2('0x15')},'autopause':{'type':Sequelize[_0x45a2('0x4')](_0x45a2('0x15'),'no',_0x45a2('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x45a2('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x45a2('0x4')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x45a2('0x4')](_0x45a2('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x45a2('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x45a2('0x4')](_0x45a2('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x45a2('0x4')](_0x45a2('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x45a2('0x4')](_0x45a2('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x45a2('0x4')](_0x45a2('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x45a2('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x45a2('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x45a2('0x4')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x45a2('0x15'),'no'),'defaultValue':_0x45a2('0x15')},'announce_holdtime':{'type':Sequelize[_0x45a2('0x4')](_0x45a2('0x15'),'no',_0x45a2('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x45a2('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize[_0x45a2('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x45a2('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x45a2('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x45a2('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x45a2('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x45a2('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x45a2('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x45a2('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x45a2('0x2')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x45a2('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x45a2('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x45a2('0x18')],'set':function(_0xa9b20e){this[_0x45a2('0xc')](_0x45a2('0x19'),_0xa9b20e?_0xa9b20e['join'](','):[]);},'get':function(){return this['getDataValue'](_0x45a2('0x19'))?this[_0x45a2('0xe')](_0x45a2('0x19'))[_0x45a2('0x1a')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x45a2('0x15'),'set':function(_0x2ee8c4){this[_0x45a2('0xc')](_0x45a2('0x1b'),_0x2ee8c4?_0x2ee8c4[_0x45a2('0x1c')](','):undefined);},'get':function(){return this[_0x45a2('0xe')](_0x45a2('0x1b'))?this[_0x45a2('0xe')](_0x45a2('0x1b'))[_0x45a2('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x135ba3){this['setDataValue'](_0x45a2('0x1d'),_0x135ba3?_0x135ba3[_0x45a2('0x1c')](','):undefined);},'get':function(){return this['getDataValue'](_0x45a2('0x1d'))?this['getDataValue'](_0x45a2('0x1d'))[_0x45a2('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x45a2('0x4')](_0x45a2('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x45a2('0x4')](_0x45a2('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x45a2('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x45a2('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x140fdd){this['setDataValue']('acw',_0x140fdd);if(_0x140fdd){if(this[_0x45a2('0xe')](_0x45a2('0x1e'))<0x2){this[_0x45a2('0xc')](_0x45a2('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x45a2('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x45a2('0x1f')],'defaultValue':0x0,'comment':_0x45a2('0x20')},'dialMethod':{'type':Sequelize[_0x45a2('0x4')](_0x45a2('0x21'),'progressive','power','predictive',_0x45a2('0x11')),'defaultValue':_0x45a2('0x22'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x45a2('0x14')](0x4)[_0x45a2('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x45a2('0x24')},'dialLimitQueue':{'type':Sequelize[_0x45a2('0x14')](0x4)[_0x45a2('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x45a2('0x25')},'dialPowerLevel':{'type':Sequelize[_0x45a2('0x26')](0x2)[_0x45a2('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x45a2('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x45a2('0x4')](_0x45a2('0x28'),_0x45a2('0x29')),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x45a2('0x26')](0x2)[_0x45a2('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x45a2('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x45a2('0x14')](0x3)[_0x45a2('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x45a2('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x45a2('0x14')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x45a2('0x2c')},'dialQueueOptions':{'type':Sequelize[_0x45a2('0x2')],'defaultValue':_0x45a2('0x2d'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x45a2('0x14')](0x3)[_0x45a2('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x45a2('0x2e')},'dialQueueProject':{'type':Sequelize[_0x45a2('0x2')],'comment':_0x45a2('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x45a2('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x45a2('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x45a2('0x30')},'dialBusyMaxRetry':{'type':Sequelize[_0x45a2('0x14')](0x3)[_0x45a2('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x45a2('0x31')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x45a2('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x45a2('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x45a2('0x14')](0x3)[_0x45a2('0x23')],'defaultValue':0x3,'comment':_0x45a2('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x45a2('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x45a2('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x45a2('0x14')](0x3)[_0x45a2('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x45a2('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x45a2('0x2')],'defaultValue':_0x45a2('0x35')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x45a2('0x4')](_0x45a2('0x36'),_0x45a2('0x37'),_0x45a2('0x38')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x45a2('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x45a2('0x14')](0x9)[_0x45a2('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x45a2('0x39')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x45a2('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x45a2('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x45a2('0x14')](0x9)[_0x45a2('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x45a2('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x45a2('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x45a2('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0x45a2('0x14')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x45a2('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x45a2('0x14')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x45a2('0x14')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x45a2('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x45a2('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x45a2('0x3e')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x45a2('0x3f')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x45a2('0x40')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x45a2('0x41')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x45a2('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x45a2('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x45a2('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x45a2('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x45a2('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x45a2('0x14')](0x3)[_0x45a2('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x45a2('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x45a2('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x45a2('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0x45a2('0x14')](0x3)[_0x45a2('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x45a2('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x45a2('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x45a2('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x45a2('0x14')](0x3)[_0x45a2('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x45a2('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x45a2('0x47')},'dialMachineMaxRetry':{'type':Sequelize[_0x45a2('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x45a2('0x48')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x45a2('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x45a2('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x45a2('0x14')](0x5)[_0x45a2('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x45a2('0x4a')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x45a2('0x4b')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x45a2('0x4c'),'set':function(_0x1bb207){if(!_0x1bb207)this[_0x45a2('0xc')](_0x45a2('0x4d'),null);this[_0x45a2('0xc')]('mandatoryDisposition',_0x1bb207);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x45a2('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x45a2('0x1f')],'defaultValue':!![]}}; \ No newline at end of file +var _0xce27=['#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\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','mandatoryDisposition','sequelize','STRING','name','ENUM','inbound','outbound','ringall','fewestcalls','rrmemory','wrandom','rrordered','setDataValue','strategy','type','getDataValue','dialMethod','booked','roundrobin','power','INTEGER','yes','once','TEXT','periodic_announce','split','joinempty','join','leavewhenempty','acw','wrapuptime','BOOLEAN','preview','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)'];(function(_0x3b0e74,_0x295ca1){var _0x2ebdc1=function(_0x4cd489){while(--_0x4cd489){_0x3b0e74['push'](_0x3b0e74['shift']());}};_0x2ebdc1(++_0x295ca1);}(_0xce27,0x68));var _0x7ce2=function(_0x36d7db,_0x14670b){_0x36d7db=_0x36d7db-0x0;var _0x237b39=_0xce27[_0x36d7db];return _0x237b39;};'use strict';var Sequelize=require(_0x7ce2('0x0'));module['exports']={'name':{'type':Sequelize[_0x7ce2('0x1')],'allowNull':![],'unique':_0x7ce2('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7ce2('0x3')](_0x7ce2('0x4'),_0x7ce2('0x5')),'allowNull':![],'defaultValue':_0x7ce2('0x4')},'musiconhold':{'type':Sequelize[_0x7ce2('0x1')],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x7ce2('0x3')]('rr',_0x7ce2('0x6'),'leastrecent',_0x7ce2('0x7'),'random',_0x7ce2('0x8'),'linear',_0x7ce2('0x9'),_0x7ce2('0xa')),'allowNull':![],'defaultValue':_0x7ce2('0x6'),'set':function(_0x2dcdf0){this[_0x7ce2('0xb')](_0x7ce2('0xc'),_0x2dcdf0?_0x2dcdf0:_0x7ce2('0x8'));},'get':function(){var _0x2dd917=this['getDataValue'](_0x7ce2('0xd'));var _0x39a3d2=this[_0x7ce2('0xe')](_0x7ce2('0xf'));var _0x17f840=this[_0x7ce2('0xe')]('strategy');if(_0x2dd917===_0x7ce2('0x4')){return _0x17f840;}if(_0x39a3d2===_0x7ce2('0x10')&&_0x17f840==='rrmemory'||_0x39a3d2===_0x7ce2('0x10')&&_0x17f840===_0x7ce2('0x11')){return _0x17f840;}if(_0x39a3d2==='progressive'||_0x39a3d2==='predictive'||_0x39a3d2===_0x7ce2('0x12')){return _0x17f840;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x7ce2('0x13')](0xb)},'timeout':{'type':Sequelize[_0x7ce2('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x7ce2('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x7ce2('0x1')]},'weight':{'type':Sequelize[_0x7ce2('0x13')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x7ce2('0x3')](_0x7ce2('0x14'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM'](_0x7ce2('0x14'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x7ce2('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x7ce2('0x3')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x7ce2('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x7ce2('0x3')](_0x7ce2('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x7ce2('0x3')](_0x7ce2('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x7ce2('0x3')](_0x7ce2('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x7ce2('0x14'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x7ce2('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x7ce2('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x7ce2('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x7ce2('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x7ce2('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x7ce2('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x7ce2('0x3')]('yes','no'),'defaultValue':_0x7ce2('0x14')},'announce_holdtime':{'type':Sequelize[_0x7ce2('0x3')]('yes','no',_0x7ce2('0x15')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x7ce2('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x7ce2('0x3')](_0x7ce2('0x14'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x7ce2('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x7ce2('0x1')]},'queue_youarenext':{'type':Sequelize[_0x7ce2('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x7ce2('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x7ce2('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x7ce2('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x7ce2('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x7ce2('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x7ce2('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x7ce2('0x1')]},'queue_less_than':{'type':Sequelize[_0x7ce2('0x1')]},'periodic_announce':{'type':Sequelize[_0x7ce2('0x16')],'set':function(_0x587216){this[_0x7ce2('0xb')](_0x7ce2('0x17'),_0x587216?_0x587216['join'](','):[]);},'get':function(){return this[_0x7ce2('0xe')](_0x7ce2('0x17'))?this['getDataValue'](_0x7ce2('0x17'))[_0x7ce2('0x18')](','):[];}},'joinempty':{'type':Sequelize[_0x7ce2('0x1')],'defaultValue':'yes','set':function(_0x411da5){this[_0x7ce2('0xb')](_0x7ce2('0x19'),_0x411da5?_0x411da5['join'](','):undefined);},'get':function(){return this[_0x7ce2('0xe')]('joinempty')?this[_0x7ce2('0xe')](_0x7ce2('0x19'))[_0x7ce2('0x18')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x3027e3){this[_0x7ce2('0xb')]('leavewhenempty',_0x3027e3?_0x3027e3[_0x7ce2('0x1a')](','):undefined);},'get':function(){return this[_0x7ce2('0xe')](_0x7ce2('0x1b'))?this[_0x7ce2('0xe')](_0x7ce2('0x1b'))[_0x7ce2('0x18')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x7ce2('0x3')](_0x7ce2('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x7ce2('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x7ce2('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x7ce2('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x7ce2('0x1')]},'description':{'type':Sequelize[_0x7ce2('0x1')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x3e77d2){this[_0x7ce2('0xb')](_0x7ce2('0x1c'),_0x3e77d2);if(_0x3e77d2){if(this['getDataValue'](_0x7ce2('0x1d'))<0x2){this[_0x7ce2('0xb')](_0x7ce2('0x1d'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x7ce2('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x7ce2('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x7ce2('0x3')](_0x7ce2('0x1f'),'progressive',_0x7ce2('0x12'),_0x7ce2('0x20'),_0x7ce2('0x10')),'defaultValue':'progressive','comment':_0x7ce2('0x21')},'dialLimitChannel':{'type':Sequelize[_0x7ce2('0x13')](0x4)[_0x7ce2('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x7ce2('0x23')},'dialLimitQueue':{'type':Sequelize[_0x7ce2('0x13')](0x4)[_0x7ce2('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x7ce2('0x24')](0x2)[_0x7ce2('0x22')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x7ce2('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x7ce2('0x3')](_0x7ce2('0x26'),'dropRate'),'defaultValue':_0x7ce2('0x27'),'comment':_0x7ce2('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x7ce2('0x24')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x7ce2('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x7ce2('0x29')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x7ce2('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x7ce2('0x13')](0x3)[_0x7ce2('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7ce2('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x7ce2('0x1')],'defaultValue':_0x7ce2('0x2b'),'comment':_0x7ce2('0x2c')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x7ce2('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7ce2('0x2d')},'dialQueueProject':{'type':Sequelize[_0x7ce2('0x1')],'comment':_0x7ce2('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x7ce2('0x13')](0x3)[_0x7ce2('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7ce2('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x7ce2('0x13')](0x5)[_0x7ce2('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7ce2('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7ce2('0x30')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7ce2('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7ce2('0x13')](0x3)[_0x7ce2('0x22')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x7ce2('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7ce2('0x32')},'dialGlobalMaxRetry':{'type':Sequelize[_0x7ce2('0x13')](0x3)[_0x7ce2('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7ce2('0x33')},'dialTimezone':{'type':Sequelize[_0x7ce2('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7ce2('0x1')],'defaultValue':_0x7ce2('0x34')},'dialPrefix':{'type':Sequelize[_0x7ce2('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x7ce2('0x3')]('always',_0x7ce2('0x35'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x7ce2('0x1e')],'defaultValue':0x0,'comment':_0x7ce2('0x36')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7ce2('0x37')},'dialAMDGreeting':{'type':Sequelize[_0x7ce2('0x13')](0x9)[_0x7ce2('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x7ce2('0x13')](0x9)[_0x7ce2('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x7ce2('0x13')](0x9)[_0x7ce2('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7ce2('0x38')},'dialAMDMinWordLength':{'type':Sequelize[_0x7ce2('0x13')](0x9)[_0x7ce2('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x7ce2('0x39')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x7ce2('0x13')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7ce2('0x3a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x7ce2('0x13')](0x9)[_0x7ce2('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7ce2('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x7ce2('0x13')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7ce2('0x3c')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x7ce2('0x22')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x7ce2('0x3d')},'dialRecallInQueue':{'type':Sequelize[_0x7ce2('0x1e')],'defaultValue':0x0,'comment':_0x7ce2('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize[_0x7ce2('0x3')](_0x7ce2('0x3f'),_0x7ce2('0x40')),'defaultValue':_0x7ce2('0x3f')},'dialQueueProject2':{'type':Sequelize[_0x7ce2('0x1')],'comment':_0x7ce2('0x2e')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x7ce2('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x7ce2('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7ce2('0x13')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7ce2('0x41')},'dialCutDigit':{'type':Sequelize[_0x7ce2('0x13')](0x3)[_0x7ce2('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7ce2('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x7ce2('0x13')](0x3)[_0x7ce2('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7ce2('0x13')](0x5)[_0x7ce2('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7ce2('0x43')},'dialDropMaxRetry':{'type':Sequelize[_0x7ce2('0x13')](0x3)[_0x7ce2('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x7ce2('0x13')](0x5)[_0x7ce2('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7ce2('0x44')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x7ce2('0x13')](0x3)[_0x7ce2('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7ce2('0x45')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x7ce2('0x13')](0x5)[_0x7ce2('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7ce2('0x46')},'dialMachineMaxRetry':{'type':Sequelize[_0x7ce2('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7ce2('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7ce2('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7ce2('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7ce2('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7ce2('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7ce2('0x13')],'allowNull':!![],'comment':_0x7ce2('0x4a')},'mandatoryDisposition':{'type':Sequelize[_0x7ce2('0x1e')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3af70a){if(!_0x3af70a)this[_0x7ce2('0xb')]('mandatoryDispositionPauseId',null);this[_0x7ce2('0xb')](_0x7ce2('0x4b'),_0x3af70a);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x7ce2('0x13')](0x3)[_0x7ce2('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x7ce2('0x22')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x7ce2('0x1e')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 68c3125..dce4c8f 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 _0x7d3c=['into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','updatedAt','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','select','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','status','end','offset','undefined','limit','count','set','json','reject','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','value','includes','find','type','name','UserProfileResource','sendStatus','error','send','VoiceQueue','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','merge','where','VIRTUAL','options','include','findAll','rows','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit','createdAt','UserProfileSection','autoAssociation','getHoppers','findOne','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','VoiceQueueId','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','online','voicePause','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','SIP/%s','emit','userVoiceQueue:save','ids','User','field','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','all','union','compact','removeAgents','userVoiceQueue:remove','addAgents','spread','isEmpty','format','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always'];(function(_0x262736,_0x1c6067){var _0x5e018a=function(_0x5e96fc){while(--_0x5e96fc){_0x262736['push'](_0x262736['shift']());}};_0x5e018a(++_0x1c6067);}(_0x7d3c,0xd4));var _0xc7d3=function(_0x259126,_0x5b2e92){_0x259126=_0x259126-0x0;var _0x12db5c=_0x7d3c[_0x259126];return _0x12db5c;};'use strict';var emlformat=require(_0xc7d3('0x0'));var rimraf=require(_0xc7d3('0x1'));var zipdir=require(_0xc7d3('0x2'));var jsonpatch=require(_0xc7d3('0x3'));var rp=require(_0xc7d3('0x4'));var moment=require(_0xc7d3('0x5'));var BPromise=require(_0xc7d3('0x6'));var Mustache=require(_0xc7d3('0x7'));var util=require(_0xc7d3('0x8'));var path=require(_0xc7d3('0x9'));var sox=require(_0xc7d3('0xa'));var csv=require(_0xc7d3('0xb'));var ejs=require(_0xc7d3('0xc'));var fs=require('fs');var fs_extra=require(_0xc7d3('0xd'));var _=require(_0xc7d3('0xe'));var squel=require('squel');var crypto=require(_0xc7d3('0xf'));var jsforce=require(_0xc7d3('0x10'));var deskjs=require(_0xc7d3('0x11'));var toCsv=require(_0xc7d3('0xb'));var querystring=require(_0xc7d3('0x12'));var Papa=require(_0xc7d3('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc7d3('0x14'));var as=require(_0xc7d3('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc7d3('0x16'))(_0xc7d3('0x17'));var utils=require('../../config/utils');var config=require(_0xc7d3('0x18'));var licenseUtil=require(_0xc7d3('0x19'));var db=require(_0xc7d3('0x1a'))['db'];config[_0xc7d3('0x1b')]=_[_0xc7d3('0x1c')](config[_0xc7d3('0x1b')],{'host':_0xc7d3('0x1d'),'port':0x18eb});var socket=require(_0xc7d3('0x1e'))(new Redis(config[_0xc7d3('0x1b')]));require(_0xc7d3('0x1f'))[_0xc7d3('0x20')](socket);function respondWithStatusCode(_0x316b28,_0x12a3bc){_0x12a3bc=_0x12a3bc||0xcc;return function(_0x33c319){if(_0x33c319){return _0x316b28['sendStatus'](_0x12a3bc);}return _0x316b28[_0xc7d3('0x21')](_0x12a3bc)[_0xc7d3('0x22')]();};}function respondWithResult(_0x1bae61,_0x33ea54){_0x33ea54=_0x33ea54||0xc8;return function(_0x569591){if(_0x569591){return _0x1bae61[_0xc7d3('0x21')](_0x33ea54)['json'](_0x569591);}};}function respondWithFilteredResult(_0x99b76b,_0x2e0ee9){return function(_0xa6acaa){if(_0xa6acaa){var _0x325abc=typeof _0x2e0ee9[_0xc7d3('0x23')]===_0xc7d3('0x24')&&typeof _0x2e0ee9[_0xc7d3('0x25')]===_0xc7d3('0x24');var _0x253345=_0xa6acaa[_0xc7d3('0x26')];var _0x308aa8=_0x325abc?0x0:_0x2e0ee9[_0xc7d3('0x23')];var _0x2f5e92=_0x325abc?_0xa6acaa[_0xc7d3('0x26')]:_0x2e0ee9[_0xc7d3('0x23')]+_0x2e0ee9[_0xc7d3('0x25')];var _0x5e4bed;if(_0x2f5e92>=_0x253345){_0x2f5e92=_0x253345;_0x5e4bed=0xc8;}else{_0x5e4bed=0xce;}_0x99b76b['status'](_0x5e4bed);return _0x99b76b[_0xc7d3('0x27')]('Content-Range',_0x308aa8+'-'+_0x2f5e92+'/'+_0x253345)[_0xc7d3('0x28')](_0xa6acaa);}return null;};}function patchUpdates(_0x56b178){return function(_0x209e41){try{jsonpatch['apply'](_0x209e41,_0x56b178,!![]);}catch(_0x1aefe5){return BPromise[_0xc7d3('0x29')](_0x1aefe5);}return _0x209e41['save']();};}function saveUpdates(_0x1c22d6,_0x271f0b){return function(_0x5568d1){if(_0x5568d1){return _0x5568d1[_0xc7d3('0x2a')](_0x1c22d6)[_0xc7d3('0x2b')](function(_0x42253b){return _0x42253b;});}return null;};}function removeEntity(_0x502e48,_0x29d3d0){return function(_0xc7c4a0){if(_0xc7c4a0){return _0xc7c4a0[_0xc7d3('0x2c')]()[_0xc7d3('0x2b')](function(){var _0x3b7402=_0xc7c4a0[_0xc7d3('0x2d')]({'plain':!![]});var _0x22a3bf=[{'name':_0xc7d3('0x2e'),'value':_0xc7d3('0x2f'),'ignore':![]},{'name':_0xc7d3('0x30'),'value':_0xc7d3('0x31'),'ignore':![]}];var _0x349793=_(_0x22a3bf)[_0xc7d3('0x32')](_0xc7d3('0x33'))['map'](_0xc7d3('0x34'))[_0xc7d3('0x34')]();if(_[_0xc7d3('0x35')](_0x349793,_0x3b7402['type'])){return;}var _0x287833=_[_0xc7d3('0x36')](_0x22a3bf,['value',_0x3b7402[_0xc7d3('0x37')]])[_0xc7d3('0x38')];return db[_0xc7d3('0x39')][_0xc7d3('0x2c')]({'where':{'type':_0x287833,'resourceId':_0x3b7402['id']}})[_0xc7d3('0x2b')](function(){return _0xc7c4a0;});})[_0xc7d3('0x2b')](function(){_0x502e48[_0xc7d3('0x21')](0xcc)[_0xc7d3('0x22')]();});}};}function handleEntityNotFound(_0x190274,_0x11ff09){return function(_0x24ca9e){if(!_0x24ca9e){_0x190274[_0xc7d3('0x3a')](0x194);}return _0x24ca9e;};}function handleError(_0x1c0229,_0x163a90){_0x163a90=_0x163a90||0x1f4;return function(_0x432ed4){logger[_0xc7d3('0x3b')](_0x432ed4['stack']);if(_0x432ed4[_0xc7d3('0x38')]){delete _0x432ed4[_0xc7d3('0x38')];}_0x1c0229['status'](_0x163a90)[_0xc7d3('0x3c')](_0x432ed4);};}exports['index']=function(_0x537922,_0x50044b){var _0x33b348={},_0x3c287f={},_0x3f4a60={'count':0x0,'rows':[]};var _0x365f2e=_['map'](db[_0xc7d3('0x3d')][_0xc7d3('0x3e')],function(_0xd5c6c9){return{'name':_0xd5c6c9[_0xc7d3('0x3f')],'type':_0xd5c6c9[_0xc7d3('0x37')][_0xc7d3('0x40')]};});_0x3c287f[_0xc7d3('0x41')]=_[_0xc7d3('0x42')](_0x365f2e,_0xc7d3('0x38'));_0x3c287f['query']=_[_0xc7d3('0x43')](_0x537922[_0xc7d3('0x44')]);_0x3c287f['filters']=_[_0xc7d3('0x45')](_0x3c287f[_0xc7d3('0x41')],_0x3c287f[_0xc7d3('0x44')]);_0x33b348[_0xc7d3('0x46')]=_['intersection'](_0x3c287f['model'],qs['fields'](_0x537922[_0xc7d3('0x44')][_0xc7d3('0x47')]));_0x33b348[_0xc7d3('0x46')]=_0x33b348[_0xc7d3('0x46')]['length']?_0x33b348['attributes']:_0x3c287f[_0xc7d3('0x41')];if(!_0x537922[_0xc7d3('0x44')][_0xc7d3('0x48')](_0xc7d3('0x49'))){_0x33b348['limit']=qs[_0xc7d3('0x25')](_0x537922[_0xc7d3('0x44')]['limit']);_0x33b348[_0xc7d3('0x23')]=qs[_0xc7d3('0x23')](_0x537922[_0xc7d3('0x44')]['offset']);}_0x33b348[_0xc7d3('0x4a')]=qs[_0xc7d3('0x4b')](_0x537922[_0xc7d3('0x44')]['sort']);_0x33b348['where']=qs[_0xc7d3('0x4c')](_[_0xc7d3('0x4d')](_0x537922[_0xc7d3('0x44')],_0x3c287f['filters']),_0x365f2e);if(_0x537922['query'][_0xc7d3('0x32')]){_0x33b348['where']=_[_0xc7d3('0x4e')](_0x33b348[_0xc7d3('0x4f')],{'$or':_[_0xc7d3('0x42')](_0x365f2e,function(_0x214107){if(_0x214107[_0xc7d3('0x37')]!==_0xc7d3('0x50')){var _0x5065c0={};_0x5065c0[_0x214107[_0xc7d3('0x38')]]={'$like':'%'+_0x537922[_0xc7d3('0x44')][_0xc7d3('0x32')]+'%'};return _0x5065c0;}})});}_0x33b348=_[_0xc7d3('0x4e')]({},_0x33b348,_0x537922[_0xc7d3('0x51')]);var _0x3ef28b={'where':_0x33b348[_0xc7d3('0x4f')]};return db[_0xc7d3('0x3d')][_0xc7d3('0x26')](_0x3ef28b)[_0xc7d3('0x2b')](function(_0x179e9f){_0x3f4a60[_0xc7d3('0x26')]=_0x179e9f;if(_0x537922[_0xc7d3('0x44')]['includeAll']){_0x33b348[_0xc7d3('0x52')]=[{'all':!![]}];}return db[_0xc7d3('0x3d')][_0xc7d3('0x53')](_0x33b348);})[_0xc7d3('0x2b')](function(_0x5750ff){_0x3f4a60[_0xc7d3('0x54')]=_0x5750ff;return _0x3f4a60;})[_0xc7d3('0x2b')](respondWithFilteredResult(_0x50044b,_0x33b348))[_0xc7d3('0x55')](handleError(_0x50044b,null));};exports[_0xc7d3('0x56')]=function(_0x21839c,_0xf82c36){var _0x405a8d={'raw':![],'where':{'id':_0x21839c[_0xc7d3('0x57')]['id']}},_0x59bb95={};_0x59bb95[_0xc7d3('0x41')]=_[_0xc7d3('0x43')](db['VoiceQueue'][_0xc7d3('0x3e')]);_0x59bb95[_0xc7d3('0x44')]=_[_0xc7d3('0x43')](_0x21839c[_0xc7d3('0x44')]);_0x59bb95[_0xc7d3('0x4c')]=_['intersection'](_0x59bb95[_0xc7d3('0x41')],_0x59bb95[_0xc7d3('0x44')]);_0x405a8d[_0xc7d3('0x46')]=_[_0xc7d3('0x45')](_0x59bb95[_0xc7d3('0x41')],qs[_0xc7d3('0x47')](_0x21839c[_0xc7d3('0x44')][_0xc7d3('0x47')]));_0x405a8d[_0xc7d3('0x46')]=_0x405a8d[_0xc7d3('0x46')][_0xc7d3('0x58')]?_0x405a8d[_0xc7d3('0x46')]:_0x59bb95[_0xc7d3('0x41')];if(_0x21839c['query']['includeAll']){_0x405a8d['include']=[{'all':!![]}];}_0x405a8d=_[_0xc7d3('0x4e')]({},_0x405a8d,_0x21839c['options']);return db['VoiceQueue']['find'](_0x405a8d)['then'](handleEntityNotFound(_0xf82c36,null))['then'](respondWithResult(_0xf82c36,null))[_0xc7d3('0x55')](handleError(_0xf82c36,null));};exports['create']=function(_0x5a21b9,_0x5702e6){return db[_0xc7d3('0x3d')][_0xc7d3('0x59')](_0x5a21b9[_0xc7d3('0x5a')],{})[_0xc7d3('0x2b')](function(_0xcac2b3){var _0x40fb3e=_0x5a21b9[_0xc7d3('0x5b')][_0xc7d3('0x2d')]({'plain':!![]});if(!_0x40fb3e)throw new Error(_0xc7d3('0x5c'));if(_0x40fb3e[_0xc7d3('0x5d')]===_0xc7d3('0x5b')){var _0x435a18=_0xcac2b3[_0xc7d3('0x2d')]({'plain':!![]});var _0x455df7=[{'name':'VoiceQueues','value':_0xc7d3('0x2f')},{'name':'QueueCampaigns','value':_0xc7d3('0x31')}];var _0xcf8f4b=_[_0xc7d3('0x36')](_0x455df7,[_0xc7d3('0x34'),_0x435a18[_0xc7d3('0x37')]])[_0xc7d3('0x38')];return db['UserProfileSection']['find']({'where':{'name':_0xcf8f4b,'userProfileId':_0x40fb3e['userProfileId']},'raw':!![]})['then'](function(_0x49de6b){if(_0x49de6b&&_0x49de6b['autoAssociation']===0x0){return db[_0xc7d3('0x39')]['create']({'name':_0x435a18[_0xc7d3('0x38')],'resourceId':_0x435a18['id'],'type':_0x49de6b[_0xc7d3('0x38')],'sectionId':_0x49de6b['id']},{})[_0xc7d3('0x2b')](function(){return _0xcac2b3;});}else{return _0xcac2b3;}})['catch'](function(_0x67c329){logger[_0xc7d3('0x3b')](_0xc7d3('0x5e'),_0x67c329);throw _0x67c329;});}return _0xcac2b3;})['then'](respondWithResult(_0x5702e6,0xc9))[_0xc7d3('0x55')](handleError(_0x5702e6,null));};exports[_0xc7d3('0x5f')]=function(_0x5d8de5,_0xc71e13){var _0xa161fd={'where':{'id':_0x5d8de5[_0xc7d3('0x57')]['id']}},_0x3fc08a={};_0x3fc08a[_0xc7d3('0x41')]=_[_0xc7d3('0x43')](db['VoiceQueue'][_0xc7d3('0x3e')]);_0xa161fd['attributes']=_['intersection'](_0x3fc08a[_0xc7d3('0x41')],qs[_0xc7d3('0x47')](_0x5d8de5['query'][_0xc7d3('0x47')]));_0xa161fd[_0xc7d3('0x46')]=_0xa161fd['attributes'][_0xc7d3('0x58')]?_0xa161fd[_0xc7d3('0x46')]:_0x3fc08a[_0xc7d3('0x41')];if(_0x5d8de5['query'][_0xc7d3('0x60')]){_0xa161fd[_0xc7d3('0x52')]=[{'all':!![]}];}_0xa161fd=_['merge']({},_0xa161fd,_0x5d8de5[_0xc7d3('0x51')]);return db[_0xc7d3('0x3d')]['find'](_0xa161fd)[_0xc7d3('0x2b')](handleEntityNotFound(_0xc71e13,null))[_0xc7d3('0x2b')](function(_0x4be633){if(_0x4be633){var _0x49b7b6=_0x4be633[_0xc7d3('0x2d')]({'plain':!![]});_0x49b7b6=qs[_0xc7d3('0x61')](_0x49b7b6,['id',_0xc7d3('0x62'),'updatedAt']);_0x5d8de5['body']=_[_0xc7d3('0x61')](_0x5d8de5[_0xc7d3('0x5a')],['id',_0xc7d3('0x62'),'updatedAt']);return db['VoiceQueue']['create'](_[_0xc7d3('0x4e')](_0x49b7b6,_0x5d8de5['body']),{'include':_0x5d8de5[_0xc7d3('0x44')]['includeAll']?[{'all':!![]}]:undefined})[_0xc7d3('0x2b')](function(_0xc74f21){var _0x5be9f5=_0x5d8de5[_0xc7d3('0x5b')][_0xc7d3('0x2d')]({'plain':!![]});if(!_0x5be9f5)throw new Error(_0xc7d3('0x5c'));if(_0x5be9f5['role']===_0xc7d3('0x5b')){var _0x499115=_0xc74f21[_0xc7d3('0x2d')]({'plain':!![]});var _0x192819=[{'name':_0xc7d3('0x2e'),'value':_0xc7d3('0x2f')},{'name':'QueueCampaigns','value':_0xc7d3('0x31')}];var _0x478d03=_[_0xc7d3('0x36')](_0x192819,['value',_0x499115['type']])[_0xc7d3('0x38')];return db[_0xc7d3('0x63')][_0xc7d3('0x36')]({'where':{'name':_0x478d03,'userProfileId':_0x5be9f5['userProfileId']},'raw':!![]})[_0xc7d3('0x2b')](function(_0x56adaa){if(_0x56adaa&&_0x56adaa[_0xc7d3('0x64')]===0x0){return db[_0xc7d3('0x39')]['create']({'name':_0x499115[_0xc7d3('0x38')],'resourceId':_0x499115['id'],'type':_0x56adaa[_0xc7d3('0x38')],'sectionId':_0x56adaa['id']},{})[_0xc7d3('0x2b')](function(){return _0xc74f21;});}else{return _0xc74f21;}})[_0xc7d3('0x55')](function(_0x478a14){logger[_0xc7d3('0x3b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x478a14);throw _0x478a14;});}return _0xc74f21;});}})[_0xc7d3('0x2b')](respondWithResult(_0xc71e13,0xc9))[_0xc7d3('0x55')](handleError(_0xc71e13,null));};exports[_0xc7d3('0x2a')]=function(_0x2ab7e6,_0x57f451){if(_0x2ab7e6['body']['id']){delete _0x2ab7e6[_0xc7d3('0x5a')]['id'];}return db[_0xc7d3('0x3d')][_0xc7d3('0x36')]({'where':{'id':_0x2ab7e6[_0xc7d3('0x57')]['id']}})[_0xc7d3('0x2b')](handleEntityNotFound(_0x57f451,null))[_0xc7d3('0x2b')](saveUpdates(_0x2ab7e6[_0xc7d3('0x5a')],null))[_0xc7d3('0x2b')](respondWithResult(_0x57f451,null))[_0xc7d3('0x55')](handleError(_0x57f451,null));};exports[_0xc7d3('0x2c')]=function(_0x1fd39e,_0x2b3a66){return db[_0xc7d3('0x3d')][_0xc7d3('0x36')]({'where':{'id':_0x1fd39e[_0xc7d3('0x57')]['id']}})[_0xc7d3('0x2b')](handleEntityNotFound(_0x2b3a66,null))[_0xc7d3('0x2b')](removeEntity(_0x2b3a66,null))[_0xc7d3('0x55')](handleError(_0x2b3a66,null));};exports[_0xc7d3('0x65')]=function(_0x4b1f5a,_0x5b7bcf,_0x4ff1b5){var _0x575204={'raw':![],'where':{}};var _0x2a5fbd={};var _0x5a5277={'count':0x0,'rows':[]};return db[_0xc7d3('0x3d')][_0xc7d3('0x66')]({'where':{'id':_0x4b1f5a[_0xc7d3('0x57')]['id']}})[_0xc7d3('0x2b')](handleEntityNotFound(_0x5b7bcf,null))['then'](function(_0x6100a6){if(_0x6100a6){_0x2a5fbd[_0xc7d3('0x41')]=_[_0xc7d3('0x43')](db['CmHopper'][_0xc7d3('0x3e')]);_0x2a5fbd[_0xc7d3('0x44')]=_[_0xc7d3('0x43')](_0x4b1f5a[_0xc7d3('0x44')]);_0x2a5fbd[_0xc7d3('0x4c')]=_[_0xc7d3('0x45')](_0x2a5fbd[_0xc7d3('0x41')],_0x2a5fbd[_0xc7d3('0x44')]);_0x575204[_0xc7d3('0x46')]=_['intersection'](_0x2a5fbd[_0xc7d3('0x41')],qs[_0xc7d3('0x47')](_0x4b1f5a[_0xc7d3('0x44')][_0xc7d3('0x47')]));_0x575204[_0xc7d3('0x46')]=_0x575204['attributes'][_0xc7d3('0x58')]?_0x575204[_0xc7d3('0x46')]:_0x2a5fbd[_0xc7d3('0x41')];if(!_0x4b1f5a['query'][_0xc7d3('0x48')](_0xc7d3('0x49'))){_0x575204[_0xc7d3('0x25')]=qs['limit'](_0x4b1f5a[_0xc7d3('0x44')][_0xc7d3('0x25')]);_0x575204[_0xc7d3('0x23')]=qs[_0xc7d3('0x23')](_0x4b1f5a['query']['offset']);}_0x575204[_0xc7d3('0x4a')]=qs['sort'](_0x4b1f5a[_0xc7d3('0x44')][_0xc7d3('0x4b')]);_0x575204[_0xc7d3('0x4f')]=qs[_0xc7d3('0x4c')](_['pick'](_0x4b1f5a[_0xc7d3('0x44')],_0x2a5fbd['filters']));_0x575204[_0xc7d3('0x4f')]['VoiceQueueId']=_0x6100a6['id'];if(_0x4b1f5a['query']['filter']){_0x575204[_0xc7d3('0x4f')]=_[_0xc7d3('0x4e')](_0x575204['where'],{'$or':_['map'](_0x575204['attributes'],function(_0x55efe3){var _0xcde1de={};_0xcde1de[_0x55efe3]={'$like':'%'+_0x4b1f5a[_0xc7d3('0x44')]['filter']+'%'};return _0xcde1de;})});}_0x575204=_['merge']({},_0x575204,_0x4b1f5a[_0xc7d3('0x51')]);return db['CmHopper'][_0xc7d3('0x26')]({'where':_0x575204['where']})[_0xc7d3('0x2b')](function(_0xca3e72){_0x5a5277[_0xc7d3('0x26')]=_0xca3e72;if(_0x4b1f5a[_0xc7d3('0x44')][_0xc7d3('0x60')]){_0x575204[_0xc7d3('0x52')]=[{'all':!![]}];}return db[_0xc7d3('0x67')][_0xc7d3('0x53')](_0x575204);})[_0xc7d3('0x2b')](function(_0x3ea52a){_0x5a5277[_0xc7d3('0x54')]=_0x3ea52a;return _0x5a5277;});}})['then'](respondWithFilteredResult(_0x5b7bcf,_0x575204))[_0xc7d3('0x55')](handleError(_0x5b7bcf,null));};exports[_0xc7d3('0x68')]=function(_0x2fc800,_0x16f6a5,_0x1ad90a){var _0x36d411={'raw':!![],'where':{}};var _0x353fe5={};var _0x3033a6={'count':0x0,'rows':[]};return db[_0xc7d3('0x3d')][_0xc7d3('0x66')]({'where':{'id':_0x2fc800['params']['id']}})[_0xc7d3('0x2b')](handleEntityNotFound(_0x16f6a5,null))[_0xc7d3('0x2b')](function(_0x1deeaf){if(_0x1deeaf){_0x353fe5[_0xc7d3('0x41')]=_[_0xc7d3('0x43')](db[_0xc7d3('0x69')][_0xc7d3('0x3e')]);_0x353fe5[_0xc7d3('0x44')]=_['keys'](_0x2fc800['query']);_0x353fe5[_0xc7d3('0x4c')]=_[_0xc7d3('0x45')](_0x353fe5[_0xc7d3('0x41')],_0x353fe5['query']);_0x36d411[_0xc7d3('0x46')]=_[_0xc7d3('0x45')](_0x353fe5[_0xc7d3('0x41')],qs['fields'](_0x2fc800[_0xc7d3('0x44')][_0xc7d3('0x47')]));_0x36d411['attributes']=_0x36d411['attributes'][_0xc7d3('0x58')]?_0x36d411['attributes']:_0x353fe5['model'];if(!_0x2fc800[_0xc7d3('0x44')][_0xc7d3('0x48')](_0xc7d3('0x49'))){_0x36d411['limit']=qs[_0xc7d3('0x25')](_0x2fc800[_0xc7d3('0x44')][_0xc7d3('0x25')]);_0x36d411['offset']=qs[_0xc7d3('0x23')](_0x2fc800['query']['offset']);}_0x36d411[_0xc7d3('0x4a')]=qs['sort'](_0x2fc800[_0xc7d3('0x44')][_0xc7d3('0x4b')]);_0x36d411[_0xc7d3('0x4f')]=qs[_0xc7d3('0x4c')](_[_0xc7d3('0x4d')](_0x2fc800[_0xc7d3('0x44')],_0x353fe5['filters']));_0x36d411[_0xc7d3('0x4f')]['VoiceQueueId']=_0x1deeaf['id'];if(_0x2fc800[_0xc7d3('0x44')][_0xc7d3('0x32')]){_0x36d411[_0xc7d3('0x4f')]=_[_0xc7d3('0x4e')](_0x36d411['where'],{'$or':_[_0xc7d3('0x42')](_0x36d411[_0xc7d3('0x46')],function(_0x27ee35){var _0x36174e={};_0x36174e[_0x27ee35]={'$like':'%'+_0x2fc800['query'][_0xc7d3('0x32')]+'%'};return _0x36174e;})});}_0x36d411=_[_0xc7d3('0x4e')]({},_0x36d411,_0x2fc800[_0xc7d3('0x51')]);return db[_0xc7d3('0x69')][_0xc7d3('0x26')]({'where':_0x36d411[_0xc7d3('0x4f')]})[_0xc7d3('0x2b')](function(_0x525d7e){_0x3033a6[_0xc7d3('0x26')]=_0x525d7e;if(_0x2fc800[_0xc7d3('0x44')][_0xc7d3('0x60')]){_0x36d411[_0xc7d3('0x52')]=[{'all':!![]}];}return db[_0xc7d3('0x69')][_0xc7d3('0x53')](_0x36d411);})[_0xc7d3('0x2b')](function(_0x4a7785){_0x3033a6[_0xc7d3('0x54')]=_0x4a7785;return _0x3033a6;});}})[_0xc7d3('0x2b')](respondWithFilteredResult(_0x16f6a5,_0x36d411))[_0xc7d3('0x55')](handleError(_0x16f6a5,null));};exports[_0xc7d3('0x6a')]=function(_0x3d935b,_0x8db938,_0x27b0cd){var _0x928856={'raw':!![],'where':{}};var _0x50d18d={};var _0xf19ea5={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xc7d3('0x66')]({'where':{'id':_0x3d935b['params']['id']}})[_0xc7d3('0x2b')](handleEntityNotFound(_0x8db938,null))[_0xc7d3('0x2b')](function(_0x2cb558){if(_0x2cb558){_0x50d18d[_0xc7d3('0x41')]=_[_0xc7d3('0x43')](db[_0xc7d3('0x6b')][_0xc7d3('0x3e')]);_0x50d18d[_0xc7d3('0x44')]=_[_0xc7d3('0x43')](_0x3d935b[_0xc7d3('0x44')]);_0x50d18d[_0xc7d3('0x4c')]=_[_0xc7d3('0x45')](_0x50d18d['model'],_0x50d18d[_0xc7d3('0x44')]);_0x928856[_0xc7d3('0x46')]=_['intersection'](_0x50d18d[_0xc7d3('0x41')],qs[_0xc7d3('0x47')](_0x3d935b[_0xc7d3('0x44')]['fields']));_0x928856['attributes']=_0x928856['attributes'][_0xc7d3('0x58')]?_0x928856['attributes']:_0x50d18d[_0xc7d3('0x41')];if(!_0x3d935b[_0xc7d3('0x44')]['hasOwnProperty'](_0xc7d3('0x49'))){_0x928856['limit']=qs[_0xc7d3('0x25')](_0x3d935b[_0xc7d3('0x44')]['limit']);_0x928856[_0xc7d3('0x23')]=qs['offset'](_0x3d935b[_0xc7d3('0x44')][_0xc7d3('0x23')]);}_0x928856[_0xc7d3('0x4a')]=qs[_0xc7d3('0x4b')](_0x3d935b[_0xc7d3('0x44')][_0xc7d3('0x4b')]);_0x928856['where']=qs[_0xc7d3('0x4c')](_['pick'](_0x3d935b['query'],_0x50d18d['filters']));_0x928856['where'][_0xc7d3('0x6c')]=_0x2cb558['id'];if(_0x3d935b[_0xc7d3('0x44')][_0xc7d3('0x32')]){_0x928856[_0xc7d3('0x4f')]=_[_0xc7d3('0x4e')](_0x928856['where'],{'$or':_[_0xc7d3('0x42')](_0x928856['attributes'],function(_0x4ad99d){var _0x59607e={};_0x59607e[_0x4ad99d]={'$like':'%'+_0x3d935b[_0xc7d3('0x44')][_0xc7d3('0x32')]+'%'};return _0x59607e;})});}_0x928856=_['merge']({},_0x928856,_0x3d935b[_0xc7d3('0x51')]);return db[_0xc7d3('0x6b')][_0xc7d3('0x26')]({'where':_0x928856['where']})[_0xc7d3('0x2b')](function(_0x2dcd5f){_0xf19ea5[_0xc7d3('0x26')]=_0x2dcd5f;if(_0x3d935b[_0xc7d3('0x44')][_0xc7d3('0x60')]){_0x928856[_0xc7d3('0x52')]=[{'all':!![]}];}return db[_0xc7d3('0x6b')][_0xc7d3('0x53')](_0x928856);})[_0xc7d3('0x2b')](function(_0x52b052){_0xf19ea5[_0xc7d3('0x54')]=_0x52b052;return _0xf19ea5;});}})[_0xc7d3('0x2b')](respondWithFilteredResult(_0x8db938,_0x928856))[_0xc7d3('0x55')](handleError(_0x8db938,null));};exports[_0xc7d3('0x6d')]=function(_0x4d0f42,_0x558a03,_0x47a2a5){var _0x19ef3c={'raw':!![],'where':{}};var _0x13e537={};var _0x3a2ef0={'count':0x0,'rows':[]};return db[_0xc7d3('0x3d')][_0xc7d3('0x66')]({'where':{'id':_0x4d0f42[_0xc7d3('0x57')]['id']}})[_0xc7d3('0x2b')](handleEntityNotFound(_0x558a03,null))[_0xc7d3('0x2b')](function(_0xbfd361){if(_0xbfd361){_0x13e537['model']=_['keys'](db[_0xc7d3('0x6e')][_0xc7d3('0x3e')]);_0x13e537[_0xc7d3('0x44')]=_[_0xc7d3('0x43')](_0x4d0f42[_0xc7d3('0x44')]);_0x13e537[_0xc7d3('0x4c')]=_[_0xc7d3('0x45')](_0x13e537[_0xc7d3('0x41')],_0x13e537['query']);_0x19ef3c[_0xc7d3('0x46')]=_['intersection'](_0x13e537[_0xc7d3('0x41')],qs[_0xc7d3('0x47')](_0x4d0f42[_0xc7d3('0x44')][_0xc7d3('0x47')]));_0x19ef3c[_0xc7d3('0x46')]=_0x19ef3c['attributes'][_0xc7d3('0x58')]?_0x19ef3c['attributes']:_0x13e537[_0xc7d3('0x41')];if(!_0x4d0f42[_0xc7d3('0x44')][_0xc7d3('0x48')](_0xc7d3('0x49'))){_0x19ef3c[_0xc7d3('0x25')]=qs[_0xc7d3('0x25')](_0x4d0f42[_0xc7d3('0x44')][_0xc7d3('0x25')]);_0x19ef3c['offset']=qs[_0xc7d3('0x23')](_0x4d0f42[_0xc7d3('0x44')][_0xc7d3('0x23')]);}_0x19ef3c[_0xc7d3('0x4a')]=qs['sort'](_0x4d0f42[_0xc7d3('0x44')][_0xc7d3('0x4b')]);_0x19ef3c[_0xc7d3('0x4f')]=qs[_0xc7d3('0x4c')](_[_0xc7d3('0x4d')](_0x4d0f42[_0xc7d3('0x44')],_0x13e537['filters']));_0x19ef3c[_0xc7d3('0x4f')][_0xc7d3('0x6c')]=_0xbfd361['id'];if(_0x4d0f42[_0xc7d3('0x44')][_0xc7d3('0x32')]){_0x19ef3c[_0xc7d3('0x4f')]=_['merge'](_0x19ef3c[_0xc7d3('0x4f')],{'$or':_[_0xc7d3('0x42')](_0x19ef3c[_0xc7d3('0x46')],function(_0x13e60b){var _0x220166={};_0x220166[_0x13e60b]={'$like':'%'+_0x4d0f42['query'][_0xc7d3('0x32')]+'%'};return _0x220166;})});}_0x19ef3c=_['merge']({},_0x19ef3c,_0x4d0f42['options']);return db['CmHopperBlack'][_0xc7d3('0x26')]({'where':_0x19ef3c[_0xc7d3('0x4f')]})[_0xc7d3('0x2b')](function(_0x74fa94){_0x3a2ef0[_0xc7d3('0x26')]=_0x74fa94;if(_0x4d0f42[_0xc7d3('0x44')][_0xc7d3('0x60')]){_0x19ef3c[_0xc7d3('0x52')]=[{'all':!![]}];}return db[_0xc7d3('0x6e')][_0xc7d3('0x53')](_0x19ef3c);})[_0xc7d3('0x2b')](function(_0x2fdaa1){_0x3a2ef0[_0xc7d3('0x54')]=_0x2fdaa1;return _0x3a2ef0;});}})['then'](respondWithFilteredResult(_0x558a03,_0x19ef3c))['catch'](handleError(_0x558a03,null));};exports[_0xc7d3('0x6f')]=function(_0x5ecac6,_0xdd07ac,_0x39358e){var _0x55e050={};var _0x1a62f3={};var _0x7eabd5;var _0x4bb665;return db[_0xc7d3('0x3d')][_0xc7d3('0x66')]({'where':{'id':_0x5ecac6['params']['id']}})[_0xc7d3('0x2b')](handleEntityNotFound(_0xdd07ac,null))[_0xc7d3('0x2b')](function(_0x5f5985){if(_0x5f5985){_0x7eabd5=_0x5f5985;_0x1a62f3['model']=_[_0xc7d3('0x43')](db[_0xc7d3('0x70')]['rawAttributes']);_0x1a62f3[_0xc7d3('0x44')]=_[_0xc7d3('0x43')](_0x5ecac6[_0xc7d3('0x44')]);_0x1a62f3[_0xc7d3('0x4c')]=_[_0xc7d3('0x45')](_0x1a62f3[_0xc7d3('0x41')],_0x1a62f3[_0xc7d3('0x44')]);_0x55e050['attributes']=_[_0xc7d3('0x45')](_0x1a62f3[_0xc7d3('0x41')],qs[_0xc7d3('0x47')](_0x5ecac6[_0xc7d3('0x44')]['fields']));_0x55e050['attributes']=_0x55e050['attributes']['length']?_0x55e050[_0xc7d3('0x46')]:_0x1a62f3['model'];_0x55e050[_0xc7d3('0x4a')]=qs['sort'](_0x5ecac6[_0xc7d3('0x44')][_0xc7d3('0x4b')]);_0x55e050[_0xc7d3('0x4f')]=qs[_0xc7d3('0x4c')](_[_0xc7d3('0x4d')](_0x5ecac6[_0xc7d3('0x44')],_0x1a62f3[_0xc7d3('0x4c')]));if(_0x5ecac6[_0xc7d3('0x44')][_0xc7d3('0x32')]){_0x55e050['where']=_[_0xc7d3('0x4e')](_0x55e050['where'],{'$or':_['map'](_0x55e050[_0xc7d3('0x46')],function(_0x2f07ad){var _0x305941={};_0x305941[_0x2f07ad]={'$like':'%'+_0x5ecac6[_0xc7d3('0x44')][_0xc7d3('0x32')]+'%'};return _0x305941;})});}_0x55e050=_[_0xc7d3('0x4e')]({},_0x55e050,_0x5ecac6['options']);return _0x7eabd5['getTeams'](_0x55e050);}})[_0xc7d3('0x2b')](function(_0x52cfc4){if(_0x52cfc4){_0x4bb665=_0x52cfc4['length'];if(!_0x5ecac6[_0xc7d3('0x44')]['hasOwnProperty'](_0xc7d3('0x49'))){_0x55e050[_0xc7d3('0x25')]=qs[_0xc7d3('0x25')](_0x5ecac6[_0xc7d3('0x44')]['limit']);_0x55e050[_0xc7d3('0x23')]=qs[_0xc7d3('0x23')](_0x5ecac6[_0xc7d3('0x44')][_0xc7d3('0x23')]);}return _0x7eabd5[_0xc7d3('0x6f')](_0x55e050);}})[_0xc7d3('0x2b')](function(_0x519029){if(_0x519029){return _0x519029?{'count':_0x4bb665,'rows':_0x519029}:null;}})['then'](respondWithResult(_0xdd07ac,null))['catch'](handleError(_0xdd07ac,null));};exports[_0xc7d3('0x71')]=function(_0x4a56ae,_0x4e18af,_0xfa5069){var _0x5aa5c7=_0x4a56ae[_0xc7d3('0x5a')]['teams'];var _0x1c90a8=_['map'](_0x5aa5c7,'id');return db['Team'][_0xc7d3('0x53')]({'where':{'id':_0x1c90a8},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xc7d3('0x38'),_0xc7d3('0x72'),_0xc7d3('0x73'),_0xc7d3('0x74')],'raw':!![]}]})[_0xc7d3('0x2b')](function(_0x300022){if(_0x300022){var _0x21c1c3=_[_0xc7d3('0x75')](_0x300022,function(_0x3e935d){var _0x1a5db5=_0x3e935d[_0xc7d3('0x2d')]({'plain':!![]});_0x1a5db5[_0xc7d3('0x76')][_0xc7d3('0x77')](function(_0x6ace86){_0x6ace86[_0xc7d3('0x78')]=_[_0xc7d3('0x36')](_0x5aa5c7,{'id':_0x1a5db5['id']})[_0xc7d3('0x78')];});return _0x1a5db5[_0xc7d3('0x76')];});return db[_0xc7d3('0x3d')][_0xc7d3('0x36')]({'where':{'id':_0x4a56ae[_0xc7d3('0x57')]['id']}})[_0xc7d3('0x2b')](function(_0x3b7991){return db[_0xc7d3('0x79')][_0xc7d3('0x7a')](function(_0x186318){return _0x3b7991[_0xc7d3('0x71')](_0x1c90a8,{'transaction':_0x186318})['then'](function(){return BPromise[_0xc7d3('0x7b')](_0x5aa5c7,function(_0x27c7c4){return db[_0xc7d3('0x7c')]['upsert']({'TeamId':_0x27c7c4['id'],'VoiceQueueId':_0x4a56ae[_0xc7d3('0x57')]['id'],'penalty':_0x27c7c4['penalty']},{'transaction':_0x186318});});})[_0xc7d3('0x2b')](function(){return BPromise[_0xc7d3('0x7b')](_0x21c1c3,function(_0x18ee06){return db[_0xc7d3('0x7d')][_0xc7d3('0x7e')]({'where':{'UserId':_0x18ee06['id'],'VoiceQueueId':_0x4a56ae[_0xc7d3('0x57')]['id']},'defaults':{'penalty':_0x18ee06[_0xc7d3('0x78')]},'transaction':_0x186318});});})[_0xc7d3('0x2b')](function(){return BPromise['each'](_[_0xc7d3('0x32')](_0x21c1c3,{'online':!![]}),function(_0x4e83f6){return db[_0xc7d3('0x7f')][_0xc7d3('0x80')]({'membername':_0x4e83f6[_0xc7d3('0x38')],'UserId':_0x4e83f6['id'],'queue_name':_0x3b7991[_0xc7d3('0x38')],'VoiceQueueId':_0x3b7991['id'],'interface':_['isNil'](_0x4e83f6[_0xc7d3('0x74')])?util['format'](_0xc7d3('0x81'),_0x4e83f6[_0xc7d3('0x38')]):_0x4e83f6[_0xc7d3('0x74')],'paused':_0x4e83f6[_0xc7d3('0x73')]||![],'penalty':_0x4e83f6['penalty']},{'transaction':_0x186318});});})['then'](function(){_0x21c1c3[_0xc7d3('0x77')](function(_0x46ae11){socket[_0xc7d3('0x82')](_0xc7d3('0x83'),{'UserId':_0x46ae11['id'],'VoiceQueueId':_0x3b7991['id']});});});});});}})[_0xc7d3('0x2b')](respondWithStatusCode(_0x4e18af,null))[_0xc7d3('0x55')](handleError(_0x4e18af,null));};exports['removeTeams']=function(_0x484e6f,_0x1b66d8,_0x1c16f6){return db[_0xc7d3('0x70')]['findAll']({'where':{'id':_0x484e6f[_0xc7d3('0x44')][_0xc7d3('0x84')]},'attributes':['id'],'include':[{'model':db[_0xc7d3('0x85')],'as':_0xc7d3('0x76'),'attributes':['id'],'raw':!![]}]})[_0xc7d3('0x2b')](handleEntityNotFound(_0x1b66d8,null))[_0xc7d3('0x2b')](function(_0x41eba4){var _0x59666f=_[_0xc7d3('0x42')](_0x41eba4,'id');var _0x1cb2ae=[];var _0x18ed19=[];var _0x5d8513=squel['select']();_0x5d8513[_0xc7d3('0x86')]('tq.TeamId')['from'](_0xc7d3('0x87'),'tq')['join'](_0xc7d3('0x88'),'ut',_0xc7d3('0x89'))[_0xc7d3('0x4f')](_0xc7d3('0x8a'),_0x484e6f[_0xc7d3('0x57')]['id']);for(var _0x375001=0x0;_0x375001<_0x41eba4[_0xc7d3('0x58')];_0x375001+=0x1){let _0x3e0d8a=_0x41eba4[_0x375001];for(var _0x4b224b=0x0;_0x4b224b<_0x3e0d8a[_0xc7d3('0x76')]['length'];_0x4b224b+=0x1){let _0x6247b9=_0x3e0d8a['Agents'][_0x4b224b];var _0x6f7d68=_0x5d8513[_0xc7d3('0x5f')]();_0x6f7d68[_0xc7d3('0x4f')]('ut.UserId\x20=\x20?',_0x6247b9['id']);_0x18ed19[_0xc7d3('0x8b')](db[_0xc7d3('0x79')]['query'](_0x6f7d68['toString'](),{'type':db[_0xc7d3('0x79')][_0xc7d3('0x8c')][_0xc7d3('0x8d')]})[_0xc7d3('0x2b')](function(_0x41ea6f){if(_0x41ea6f[_0xc7d3('0x58')]===0x1){return _0x6247b9['id'];}else{var _0x132468=_[_0xc7d3('0x8e')](_[_0xc7d3('0x42')](_0x41ea6f,_0xc7d3('0x8f')),function(_0x187ef8){return _[_0xc7d3('0x35')](_0x59666f,_0x187ef8);});if(_0x132468){return _0x6247b9['id'];}}}));}}return BPromise[_0xc7d3('0x90')](_0x18ed19)['then'](function(_0xcd264d){_0x1cb2ae=_(_0x1cb2ae)[_0xc7d3('0x91')](_0xcd264d)[_0xc7d3('0x92')]()['value']();return db['VoiceQueue'][_0xc7d3('0x36')]({'where':{'id':_0x484e6f[_0xc7d3('0x57')]['id']}})[_0xc7d3('0x2b')](function(_0x178330){return db['sequelize'][_0xc7d3('0x7a')](function(_0x63f773){return _0x178330['removeTeams'](_0x484e6f[_0xc7d3('0x44')][_0xc7d3('0x84')],{'transaction':_0x63f773})[_0xc7d3('0x2b')](function(){if(!_['isEmpty'](_0x1cb2ae)){return _0x178330[_0xc7d3('0x93')](_0x1cb2ae,{'transaction':_0x63f773})['then'](function(){return db['UserVoiceQueueRt'][_0xc7d3('0x2c')]({'where':{'VoiceQueueId':_0x484e6f[_0xc7d3('0x57')]['id'],'UserId':_0x1cb2ae},'transaction':_0x63f773});});}})[_0xc7d3('0x2b')](function(){_0x1cb2ae[_0xc7d3('0x77')](function(_0x61f76b){socket[_0xc7d3('0x82')](_0xc7d3('0x94'),{'UserId':_0x61f76b,'VoiceQueueId':_0x178330['id']});});});});});});})[_0xc7d3('0x2b')](respondWithStatusCode(_0x1b66d8,null))[_0xc7d3('0x55')](handleError(_0x1b66d8,null));};exports['addAgents']=function(_0x461b35,_0x132e24,_0x243f67){var _0xb35645,_0x1cb8f1;return db[_0xc7d3('0x3d')][_0xc7d3('0x36')]({'where':{'id':_0x461b35['params']['id']}})[_0xc7d3('0x2b')](handleEntityNotFound(_0x132e24,null))['then'](function(_0x3a6e7f){if(_0x3a6e7f){_0x1cb8f1=_0x3a6e7f;return _0x3a6e7f[_0xc7d3('0x95')](_0x461b35['body'][_0xc7d3('0x84')],_[_0xc7d3('0x61')](_0x461b35['body'],[_0xc7d3('0x84'),'id'])||{})[_0xc7d3('0x96')](function(_0x58f37a){for(var _0x2f436d=0x0;_0x2f436d<_0x461b35[_0xc7d3('0x5a')][_0xc7d3('0x84')][_0xc7d3('0x58')];_0x2f436d+=0x1){socket[_0xc7d3('0x82')](_0xc7d3('0x83'),{'UserId':Number(_0x461b35[_0xc7d3('0x5a')]['ids'][_0x2f436d]),'VoiceQueueId':Number(_0x461b35[_0xc7d3('0x57')]['id'])});}return _0x58f37a;});}})[_0xc7d3('0x2b')](function(_0x136c82){_0xb35645=_0x136c82||[];if(_0x1cb8f1){return db[_0xc7d3('0x85')][_0xc7d3('0x53')]({'where':{'id':_0x461b35[_0xc7d3('0x5a')]['ids']},'attributes':['id',_0xc7d3('0x38'),'online',_0xc7d3('0x73'),_0xc7d3('0x74')],'raw':!![]});}})['then'](function(_0x1820fc){if(!_[_0xc7d3('0x97')](_0x1820fc)){var _0x1acd83=[];for(var _0x6ffd19=0x0;_0x6ffd19<_0x1820fc[_0xc7d3('0x58')];_0x6ffd19++){if(_0x1820fc[_0x6ffd19]['online']){_0x1acd83[_0xc7d3('0x8b')](db['UserVoiceQueueRt']['upsert']({'membername':_0x1820fc[_0x6ffd19][_0xc7d3('0x38')],'UserId':_0x1820fc[_0x6ffd19]['id'],'queue_name':_0x1cb8f1[_0xc7d3('0x38')],'VoiceQueueId':_0x1cb8f1['id'],'interface':_['isNil'](_0x1820fc[_0x6ffd19][_0xc7d3('0x74')])?util[_0xc7d3('0x98')](_0xc7d3('0x81'),_0x1820fc[_0x6ffd19][_0xc7d3('0x38')]):_0x1820fc[_0x6ffd19][_0xc7d3('0x74')],'paused':_0x1820fc[_0x6ffd19][_0xc7d3('0x73')]||![],'penalty':_0x461b35[_0xc7d3('0x5a')][_0xc7d3('0x78')]||0x0}));}}return BPromise[_0xc7d3('0x90')](_0x1acd83);}})[_0xc7d3('0x2b')](function(){return _0xb35645;})['then'](respondWithResult(_0x132e24,null))['catch'](handleError(_0x132e24,null));};exports[_0xc7d3('0x93')]=function(_0x2f3fbf,_0x35ede4,_0x1d6756){return db[_0xc7d3('0x3d')][_0xc7d3('0x36')]({'where':{'id':_0x2f3fbf[_0xc7d3('0x57')]['id']}})['then'](handleEntityNotFound(_0x35ede4,null))[_0xc7d3('0x2b')](function(_0x44114a){if(_0x44114a){return _0x44114a[_0xc7d3('0x93')](_0x2f3fbf[_0xc7d3('0x44')][_0xc7d3('0x84')])[_0xc7d3('0x2b')](function(){if(_[_0xc7d3('0x99')](_0x2f3fbf[_0xc7d3('0x44')]['ids'])){for(var _0x21eea1=0x0;_0x21eea1<_0x2f3fbf[_0xc7d3('0x44')][_0xc7d3('0x84')][_0xc7d3('0x58')];_0x21eea1+=0x1){socket[_0xc7d3('0x82')](_0xc7d3('0x94'),{'UserId':Number(_0x2f3fbf[_0xc7d3('0x44')][_0xc7d3('0x84')][_0x21eea1]),'VoiceQueueId':Number(_0x2f3fbf['params']['id'])});}}else{socket[_0xc7d3('0x82')]('userVoiceQueue:remove',{'UserId':Number(_0x2f3fbf['query'][_0xc7d3('0x84')]),'VoiceQueueId':Number(_0x2f3fbf[_0xc7d3('0x57')]['id'])});}});}})['then'](function(_0x5ee63b){return db['UserVoiceQueueRt'][_0xc7d3('0x2c')]({'where':{'VoiceQueueId':_0x2f3fbf[_0xc7d3('0x57')]['id'],'UserId':_0x2f3fbf[_0xc7d3('0x44')][_0xc7d3('0x84')]}})[_0xc7d3('0x2b')](function(){return _0x5ee63b;});})[_0xc7d3('0x2b')](respondWithStatusCode(_0x35ede4,null))[_0xc7d3('0x55')](handleError(_0x35ede4,null));};exports[_0xc7d3('0x9a')]=function(_0x488f78,_0x439759,_0x5983ba){var _0x543dad={};var _0x2212dd={};var _0x40554c;var _0x4d6b2b;return db[_0xc7d3('0x3d')][_0xc7d3('0x66')]({'where':{'id':_0x488f78[_0xc7d3('0x57')]['id']}})[_0xc7d3('0x2b')](handleEntityNotFound(_0x439759,null))[_0xc7d3('0x2b')](function(_0x4aff34){if(_0x4aff34){_0x40554c=_0x4aff34;_0x2212dd[_0xc7d3('0x41')]=_[_0xc7d3('0x43')](db['User'][_0xc7d3('0x3e')]);_0x2212dd['query']=_[_0xc7d3('0x43')](_0x488f78['query']);_0x2212dd['filters']=_['intersection'](_0x2212dd[_0xc7d3('0x41')],_0x2212dd[_0xc7d3('0x44')]);_0x543dad['attributes']=_[_0xc7d3('0x45')](_0x2212dd['model'],qs[_0xc7d3('0x47')](_0x488f78[_0xc7d3('0x44')][_0xc7d3('0x47')]));_0x543dad['attributes']=_0x543dad[_0xc7d3('0x46')][_0xc7d3('0x58')]?_0x543dad[_0xc7d3('0x46')]:_0x2212dd['model'];_0x543dad['order']=qs['sort'](_0x488f78['query'][_0xc7d3('0x4b')]);_0x543dad[_0xc7d3('0x4f')]=qs['filters'](_[_0xc7d3('0x4d')](_0x488f78[_0xc7d3('0x44')],_0x2212dd[_0xc7d3('0x4c')]));if(_0x488f78[_0xc7d3('0x44')][_0xc7d3('0x32')]){_0x543dad['where']=_[_0xc7d3('0x4e')](_0x543dad[_0xc7d3('0x4f')],{'$or':_['map'](_0x543dad['attributes'],function(_0x486a1a){var _0x43c878={};_0x43c878[_0x486a1a]={'$like':'%'+_0x488f78[_0xc7d3('0x44')][_0xc7d3('0x32')]+'%'};return _0x43c878;})});}_0x543dad=_[_0xc7d3('0x4e')]({},_0x543dad,_0x488f78['options']);return _0x40554c[_0xc7d3('0x9a')](_0x543dad);}})[_0xc7d3('0x2b')](function(_0x56fd0f){if(_0x56fd0f){_0x4d6b2b=_0x56fd0f[_0xc7d3('0x58')];if(!_0x488f78['query'][_0xc7d3('0x48')](_0xc7d3('0x49'))){_0x543dad['limit']=qs['limit'](_0x488f78[_0xc7d3('0x44')][_0xc7d3('0x25')]);_0x543dad['offset']=qs[_0xc7d3('0x23')](_0x488f78[_0xc7d3('0x44')][_0xc7d3('0x23')]);}return _0x40554c[_0xc7d3('0x9a')](_0x543dad);}})['then'](function(_0x51528d){if(_0x51528d){return _0x51528d?{'count':_0x4d6b2b,'rows':_0x51528d}:null;}})[_0xc7d3('0x2b')](respondWithResult(_0x439759,null))['catch'](handleError(_0x439759,null));};exports[_0xc7d3('0x9b')]=function(_0x2348a8,_0x5e3b90,_0x5e5156){var _0x3418db={};var _0x997e70={};var _0x4f3649;var _0x5dc3cc;return db[_0xc7d3('0x3d')][_0xc7d3('0x66')]({'where':{'id':_0x2348a8[_0xc7d3('0x57')]['id']}})[_0xc7d3('0x2b')](handleEntityNotFound(_0x5e3b90,null))['then'](function(_0x3f6eff){if(_0x3f6eff){_0x4f3649=_0x3f6eff;_0x997e70['model']=_[_0xc7d3('0x43')](db[_0xc7d3('0x7f')][_0xc7d3('0x3e')]);_0x997e70[_0xc7d3('0x44')]=_[_0xc7d3('0x43')](_0x2348a8['query']);_0x997e70[_0xc7d3('0x4c')]=_[_0xc7d3('0x45')](_0x997e70[_0xc7d3('0x41')],_0x997e70[_0xc7d3('0x44')]);_0x3418db['attributes']=_['intersection'](_0x997e70['model'],qs['fields'](_0x2348a8['query'][_0xc7d3('0x47')]));_0x3418db[_0xc7d3('0x46')]=_0x3418db['attributes'][_0xc7d3('0x58')]?_0x3418db['attributes']:_0x997e70[_0xc7d3('0x41')];_0x3418db[_0xc7d3('0x4a')]=qs[_0xc7d3('0x4b')](_0x2348a8[_0xc7d3('0x44')][_0xc7d3('0x4b')]);_0x3418db[_0xc7d3('0x4f')]=qs[_0xc7d3('0x4c')](_['pick'](_0x2348a8[_0xc7d3('0x44')],_0x997e70[_0xc7d3('0x4c')]));if(_0x2348a8['query']['filter']){_0x3418db[_0xc7d3('0x4f')]=_['merge'](_0x3418db['where'],{'$or':_['map'](_0x3418db[_0xc7d3('0x46')],function(_0x21d73d){var _0x304ad3={};_0x304ad3[_0x21d73d]={'$like':'%'+_0x2348a8[_0xc7d3('0x44')][_0xc7d3('0x32')]+'%'};return _0x304ad3;})});}_0x3418db=_[_0xc7d3('0x4e')]({},_0x3418db,_0x2348a8[_0xc7d3('0x51')]);return _0x4f3649[_0xc7d3('0x9b')](_0x3418db);}})[_0xc7d3('0x2b')](function(_0x4ae094){if(_0x4ae094){_0x5dc3cc=_0x4ae094[_0xc7d3('0x58')];if(!_0x2348a8['query'][_0xc7d3('0x48')](_0xc7d3('0x49'))){_0x3418db[_0xc7d3('0x25')]=qs['limit'](_0x2348a8['query'][_0xc7d3('0x25')]);_0x3418db[_0xc7d3('0x23')]=qs[_0xc7d3('0x23')](_0x2348a8[_0xc7d3('0x44')][_0xc7d3('0x23')]);}return _0x4f3649[_0xc7d3('0x9b')](_0x3418db);}})[_0xc7d3('0x2b')](function(_0x5630b1){return _0x5630b1?{'count':_0x5dc3cc,'rows':_0x5630b1}:null;})[_0xc7d3('0x2b')](respondWithResult(_0x5e3b90,null))[_0xc7d3('0x55')](handleError(_0x5e3b90,null));};exports[_0xc7d3('0x9c')]=function(_0x21e027,_0x19e17e,_0x2ed4ae){var _0x2d3a4d={};var _0x38271d={};var _0x1d6139;var _0x3d8eeb;return db[_0xc7d3('0x3d')][_0xc7d3('0x66')]({'where':{'id':_0x21e027[_0xc7d3('0x57')]['id']}})[_0xc7d3('0x2b')](handleEntityNotFound(_0x19e17e,null))['then'](function(_0x48d1f9){if(_0x48d1f9){_0x1d6139=_0x48d1f9;_0x38271d['model']=_['keys'](db['CmList'][_0xc7d3('0x3e')]);_0x38271d[_0xc7d3('0x44')]=_[_0xc7d3('0x43')](_0x21e027[_0xc7d3('0x44')]);_0x38271d[_0xc7d3('0x4c')]=_[_0xc7d3('0x45')](_0x38271d['model'],_0x38271d[_0xc7d3('0x44')]);_0x2d3a4d[_0xc7d3('0x46')]=_[_0xc7d3('0x45')](_0x38271d[_0xc7d3('0x41')],qs[_0xc7d3('0x47')](_0x21e027['query']['fields']));_0x2d3a4d[_0xc7d3('0x46')]=_0x2d3a4d['attributes'][_0xc7d3('0x58')]?_0x2d3a4d[_0xc7d3('0x46')]:_0x38271d[_0xc7d3('0x41')];_0x2d3a4d[_0xc7d3('0x4a')]=qs[_0xc7d3('0x4b')](_0x21e027[_0xc7d3('0x44')][_0xc7d3('0x4b')]);_0x2d3a4d[_0xc7d3('0x4f')]=qs[_0xc7d3('0x4c')](_[_0xc7d3('0x4d')](_0x21e027['query'],_0x38271d[_0xc7d3('0x4c')]));if(_0x21e027[_0xc7d3('0x44')][_0xc7d3('0x32')]){_0x2d3a4d[_0xc7d3('0x4f')]=_[_0xc7d3('0x4e')](_0x2d3a4d[_0xc7d3('0x4f')],{'$or':_[_0xc7d3('0x42')](_0x2d3a4d[_0xc7d3('0x46')],function(_0x50163e){var _0x5db920={};_0x5db920[_0x50163e]={'$like':'%'+_0x21e027['query']['filter']+'%'};return _0x5db920;})});}_0x2d3a4d=_[_0xc7d3('0x4e')]({},_0x2d3a4d,_0x21e027[_0xc7d3('0x51')]);return _0x1d6139['getLists'](_0x2d3a4d);}})['then'](function(_0x22f2d8){if(_0x22f2d8){_0x3d8eeb=_0x22f2d8[_0xc7d3('0x58')];if(!_0x21e027[_0xc7d3('0x44')][_0xc7d3('0x48')]('nolimit')){_0x2d3a4d[_0xc7d3('0x25')]=qs[_0xc7d3('0x25')](_0x21e027['query'][_0xc7d3('0x25')]);_0x2d3a4d[_0xc7d3('0x23')]=qs[_0xc7d3('0x23')](_0x21e027[_0xc7d3('0x44')][_0xc7d3('0x23')]);}return _0x1d6139[_0xc7d3('0x9c')](_0x2d3a4d);}})['then'](function(_0x302050){if(_0x302050){return _0x302050?{'count':_0x3d8eeb,'rows':_0x302050}:null;}})['then'](respondWithResult(_0x19e17e,null))[_0xc7d3('0x55')](handleError(_0x19e17e,null));};exports[_0xc7d3('0x9d')]=function(_0x33997e,_0x15a47c,_0x413b9a){var _0x2be622,_0x4e47d0;return db[_0xc7d3('0x3d')]['find']({'where':{'id':_0x33997e[_0xc7d3('0x57')]['id']}})[_0xc7d3('0x2b')](handleEntityNotFound(_0x15a47c,null))[_0xc7d3('0x2b')](function(_0x2553bf){if(_0x2553bf){_0x4e47d0=_0x2553bf;return _0x2553bf[_0xc7d3('0x9d')](_0x33997e[_0xc7d3('0x5a')]['ids'],_[_0xc7d3('0x61')](_0x33997e['body'],[_0xc7d3('0x84'),'id'])||{});}return null;})[_0xc7d3('0x96')](function(_0x49d976){var _0x293108;_0x2be622=_0x49d976||[];var _0x2a1532=[];if(_0x49d976){for(var _0x17c54d=0x0;_0x17c54d<_0x49d976['length'];_0x17c54d+=0x1){var _0x3675e5=_0x49d976[_0x17c54d][_0xc7d3('0x2d')]({'plain':!![]});_0x4e47d0[_0xc7d3('0x9e')]=_0x33997e[_0xc7d3('0x5a')]['dialCheckDuplicateType']?_0x33997e['body'][_0xc7d3('0x9e')]:_0x4e47d0[_0xc7d3('0x9e')];switch(_0x4e47d0['dialCheckDuplicateType']){case _0xc7d3('0x9f'):_0x293108=squel['insert']()[_0xc7d3('0xa0')](_0xc7d3('0xa1'))[_0xc7d3('0xa2')]([_0xc7d3('0xa3'),_0xc7d3('0xa4'),_0xc7d3('0xa5'),_0xc7d3('0xa6'),'VoiceQueueId',_0xc7d3('0x62'),_0xc7d3('0xa7')],squel['select']()['field'](_0xc7d3('0xa3'),_0xc7d3('0xa3'))[_0xc7d3('0x86')](_0xc7d3('0xa8'),_0xc7d3('0xa4'))['field']('id','ContactId')[_0xc7d3('0x86')](_0x3675e5[_0xc7d3('0xa9')][_0xc7d3('0xaa')](),'ListId')[_0xc7d3('0x86')](_0x33997e[_0xc7d3('0x57')]['id'][_0xc7d3('0xaa')](),'VoiceQueueId')[_0xc7d3('0x86')](_0xc7d3('0xa8'),_0xc7d3('0x62'))[_0xc7d3('0x86')](_0xc7d3('0xa8'),_0xc7d3('0xa7'))[_0xc7d3('0xab')](_0xc7d3('0xac'))[_0xc7d3('0x4f')](_0xc7d3('0xad'))[_0xc7d3('0x4f')](_0xc7d3('0xae'),_0x3675e5[_0xc7d3('0xa9')][_0xc7d3('0xaa')]())['where'](_0xc7d3('0xaf'))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xc7d3('0x86')](_0xc7d3('0xb0'))[_0xc7d3('0xab')]('cm_hopper_final')['where'](_0xc7d3('0x8a'),_0x33997e[_0xc7d3('0x57')]['id']['toString']()))[_0xc7d3('0x4f')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xc7d3('0xb1'))['from'](_0xc7d3('0xa1'))[_0xc7d3('0x4f')]('VoiceQueueId\x20=\x20?',_0x33997e['params']['id']['toString']())))['toString']();break;case _0xc7d3('0xb2'):_0x293108=squel[_0xc7d3('0xb3')]()[_0xc7d3('0xa0')](_0xc7d3('0xa1'))['fromQuery'](['phone','scheduledAt',_0xc7d3('0xa5'),_0xc7d3('0xa6'),'VoiceQueueId',_0xc7d3('0x62'),_0xc7d3('0xa7')],squel[_0xc7d3('0xb4')]()[_0xc7d3('0x86')]('phone','phone')['field'](_0xc7d3('0xa8'),'scheduledAt')[_0xc7d3('0x86')]('id',_0xc7d3('0xa5'))[_0xc7d3('0x86')](_0x3675e5['CmListId'][_0xc7d3('0xaa')](),_0xc7d3('0xa6'))[_0xc7d3('0x86')](_0x33997e['params']['id'][_0xc7d3('0xaa')](),_0xc7d3('0x6c'))[_0xc7d3('0x86')](_0xc7d3('0xa8'),'createdAt')[_0xc7d3('0x86')](_0xc7d3('0xa8'),_0xc7d3('0xa7'))[_0xc7d3('0xab')](_0xc7d3('0xac'))[_0xc7d3('0x4f')](_0xc7d3('0xad'))[_0xc7d3('0x4f')](_0xc7d3('0xae'),_0x3675e5[_0xc7d3('0xa9')][_0xc7d3('0xaa')]())[_0xc7d3('0x4f')](_0xc7d3('0xaf'))[_0xc7d3('0x4f')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc7d3('0xb4')]()[_0xc7d3('0x86')](_0xc7d3('0xb1'))[_0xc7d3('0xab')](_0xc7d3('0xa1'))[_0xc7d3('0x4f')](_0xc7d3('0x8a'),_0x33997e[_0xc7d3('0x57')]['id']['toString']())))[_0xc7d3('0xaa')]();break;default:_0x293108=squel[_0xc7d3('0xb3')]()[_0xc7d3('0xa0')]('cm_hopper')[_0xc7d3('0xa2')]([_0xc7d3('0xa3'),'scheduledAt',_0xc7d3('0xa5'),_0xc7d3('0xa6'),_0xc7d3('0x6c'),_0xc7d3('0x62'),'updatedAt'],squel[_0xc7d3('0xb4')]()['field'](_0xc7d3('0xa3'),_0xc7d3('0xa3'))[_0xc7d3('0x86')](_0xc7d3('0xa8'),'scheduledAt')[_0xc7d3('0x86')]('id',_0xc7d3('0xa5'))[_0xc7d3('0x86')](_0x3675e5[_0xc7d3('0xa9')][_0xc7d3('0xaa')](),_0xc7d3('0xa6'))[_0xc7d3('0x86')](_0x33997e[_0xc7d3('0x57')]['id'][_0xc7d3('0xaa')](),'VoiceQueueId')[_0xc7d3('0x86')]('NOW()',_0xc7d3('0x62'))[_0xc7d3('0x86')](_0xc7d3('0xa8'),_0xc7d3('0xa7'))['from']('cm_contacts')['where'](_0xc7d3('0xad'))[_0xc7d3('0x4f')]('ListId\x20=\x20?',_0x3675e5[_0xc7d3('0xa9')][_0xc7d3('0xaa')]())[_0xc7d3('0x4f')]('phone\x20IS\x20NOT\x20NULL'))[_0xc7d3('0xaa')]();}_0x2a1532['push'](db[_0xc7d3('0x79')][_0xc7d3('0x44')](_0x293108));}return BPromise['all'](_0x2a1532);}})[_0xc7d3('0x2b')](function(){return _0x2be622;})[_0xc7d3('0x2b')](respondWithResult(_0x15a47c,null))[_0xc7d3('0x55')](handleError(_0x15a47c,null));};exports['removeLists']=function(_0x465a3f,_0x2f722e,_0x21c836){return db[_0xc7d3('0x3d')][_0xc7d3('0x36')]({'where':{'id':_0x465a3f[_0xc7d3('0x57')]['id']}})[_0xc7d3('0x2b')](handleEntityNotFound(_0x2f722e,null))[_0xc7d3('0x2b')](function(_0x1474bb){if(_0x1474bb){return _0x1474bb['removeLists'](_0x465a3f[_0xc7d3('0x44')]['ids']);}})[_0xc7d3('0x2b')](function(_0x5678ca){if(_0x5678ca){return db[_0xc7d3('0x67')][_0xc7d3('0x2c')]({'where':{'ListId':_0x465a3f[_0xc7d3('0x44')]['ids'],'VoiceQueueId':_0x465a3f[_0xc7d3('0x57')]['id']}})['then'](function(){return _0x5678ca;});}})[_0xc7d3('0x2b')](respondWithStatusCode(_0x2f722e,null))['catch'](handleError(_0x2f722e,null));};exports[_0xc7d3('0xb5')]=function(_0xf89ef5,_0x3186ef,_0x5eb34b){var _0x567d93={};var _0xe6359b={};var _0x5973be;var _0x2e1309;return db['VoiceQueue'][_0xc7d3('0x66')]({'where':{'id':_0xf89ef5[_0xc7d3('0x57')]['id']}})['then'](handleEntityNotFound(_0x3186ef,null))[_0xc7d3('0x2b')](function(_0x492ea4){if(_0x492ea4){_0x5973be=_0x492ea4;_0xe6359b[_0xc7d3('0x41')]=_['keys'](db[_0xc7d3('0xb6')][_0xc7d3('0x3e')]);_0xe6359b[_0xc7d3('0x44')]=_[_0xc7d3('0x43')](_0xf89ef5[_0xc7d3('0x44')]);_0xe6359b['filters']=_['intersection'](_0xe6359b['model'],_0xe6359b['query']);_0x567d93[_0xc7d3('0x46')]=_['intersection'](_0xe6359b[_0xc7d3('0x41')],qs['fields'](_0xf89ef5['query'][_0xc7d3('0x47')]));_0x567d93[_0xc7d3('0x46')]=_0x567d93[_0xc7d3('0x46')][_0xc7d3('0x58')]?_0x567d93[_0xc7d3('0x46')]:_0xe6359b[_0xc7d3('0x41')];_0x567d93['order']=qs[_0xc7d3('0x4b')](_0xf89ef5[_0xc7d3('0x44')][_0xc7d3('0x4b')]);_0x567d93['where']=qs['filters'](_[_0xc7d3('0x4d')](_0xf89ef5[_0xc7d3('0x44')],_0xe6359b[_0xc7d3('0x4c')]));if(_0xf89ef5[_0xc7d3('0x44')][_0xc7d3('0x32')]){_0x567d93[_0xc7d3('0x4f')]=_[_0xc7d3('0x4e')](_0x567d93[_0xc7d3('0x4f')],{'$or':_[_0xc7d3('0x42')](_0x567d93[_0xc7d3('0x46')],function(_0x1becd8){var _0x598fb8={};_0x598fb8[_0x1becd8]={'$like':'%'+_0xf89ef5[_0xc7d3('0x44')][_0xc7d3('0x32')]+'%'};return _0x598fb8;})});}_0x567d93=_['merge']({},_0x567d93,_0xf89ef5[_0xc7d3('0x51')]);return _0x5973be[_0xc7d3('0xb5')](_0x567d93);}})['then'](function(_0x2b2f6f){if(_0x2b2f6f){_0x2e1309=_0x2b2f6f['length'];if(!_0xf89ef5[_0xc7d3('0x44')][_0xc7d3('0x48')]('nolimit')){_0x567d93[_0xc7d3('0x25')]=qs['limit'](_0xf89ef5[_0xc7d3('0x44')][_0xc7d3('0x25')]);_0x567d93[_0xc7d3('0x23')]=qs[_0xc7d3('0x23')](_0xf89ef5[_0xc7d3('0x44')][_0xc7d3('0x23')]);}return _0x5973be[_0xc7d3('0xb5')](_0x567d93);}})[_0xc7d3('0x2b')](function(_0x195862){if(_0x195862){return _0x195862?{'count':_0x2e1309,'rows':_0x195862}:null;}})['then'](respondWithResult(_0x3186ef,null))[_0xc7d3('0x55')](handleError(_0x3186ef,null));};exports[_0xc7d3('0xb7')]=function(_0x510ea2,_0x1af0a7,_0x4812b2){var _0x1d4ce4,_0x312dd3;return db[_0xc7d3('0x3d')]['find']({'where':{'id':_0x510ea2['params']['id']}})[_0xc7d3('0x2b')](handleEntityNotFound(_0x1af0a7,null))[_0xc7d3('0x2b')](function(_0x44afa6){if(_0x44afa6){_0x312dd3=_0x44afa6;return _0x44afa6[_0xc7d3('0xb7')](_0x510ea2['body'][_0xc7d3('0x84')],_[_0xc7d3('0x61')](_0x510ea2[_0xc7d3('0x5a')],['ids','id'])||{});}return null;})[_0xc7d3('0x96')](function(_0x1d6af7){var _0x65fdc1;_0x1d4ce4=_0x1d6af7||[];var _0x326118=[];if(_0x1d6af7){for(var _0x108d41=0x0;_0x108d41<_0x1d6af7[_0xc7d3('0x58')];_0x108d41+=0x1){var _0x3df42b=_0x1d6af7[_0x108d41]['get']({'plain':!![]});_0x65fdc1=squel['insert']()[_0xc7d3('0xa0')](_0xc7d3('0xb8'))[_0xc7d3('0xa2')]([_0xc7d3('0xa3'),_0xc7d3('0xa5'),_0xc7d3('0xa6'),_0xc7d3('0x6c'),_0xc7d3('0x62'),_0xc7d3('0xa7')],squel[_0xc7d3('0xb4')]()[_0xc7d3('0x86')](_0xc7d3('0xa3'),_0xc7d3('0xa3'))['field']('id',_0xc7d3('0xa5'))[_0xc7d3('0x86')](_0x3df42b['CmListId']['toString'](),_0xc7d3('0xa6'))[_0xc7d3('0x86')](_0x510ea2[_0xc7d3('0x57')]['id'][_0xc7d3('0xaa')](),_0xc7d3('0x6c'))['field']('NOW()',_0xc7d3('0x62'))['field'](_0xc7d3('0xa8'),'updatedAt')[_0xc7d3('0xab')]('cm_contacts')['where'](_0xc7d3('0xad'))[_0xc7d3('0x4f')]('ListId\x20=\x20?',_0x3df42b[_0xc7d3('0xa9')]['toString']())['where'](_0xc7d3('0xaf')))[_0xc7d3('0xaa')]();_0x326118['push'](db[_0xc7d3('0x79')]['query'](_0x65fdc1));}return BPromise[_0xc7d3('0x90')](_0x326118);}})[_0xc7d3('0x2b')](function(){return _0x1d4ce4;})[_0xc7d3('0x2b')](respondWithResult(_0x1af0a7,null))[_0xc7d3('0x55')](handleError(_0x1af0a7,null));};exports[_0xc7d3('0xb9')]=function(_0x2fdbac,_0x4077af,_0x23eb48){return db[_0xc7d3('0x3d')][_0xc7d3('0x36')]({'where':{'id':_0x2fdbac[_0xc7d3('0x57')]['id']}})[_0xc7d3('0x2b')](handleEntityNotFound(_0x4077af,null))['then'](function(_0x513db7){if(_0x513db7){return _0x513db7[_0xc7d3('0xb9')](_0x2fdbac[_0xc7d3('0x44')][_0xc7d3('0x84')]);}})['then'](function(_0x3cc666){if(_0x3cc666){return db[_0xc7d3('0x6e')][_0xc7d3('0x2c')]({'where':{'ListId':_0x2fdbac[_0xc7d3('0x44')][_0xc7d3('0x84')],'VoiceQueueId':_0x2fdbac['params']['id']}})['then'](function(){return _0x3cc666;});}})[_0xc7d3('0x2b')](respondWithStatusCode(_0x4077af,null))[_0xc7d3('0x55')](handleError(_0x4077af,null));}; \ No newline at end of file +var _0x6244=['ids','User','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','isEmpty','removeAgents','emit','addAgents','spread','userVoiceQueue:save','push','userVoiceQueue:remove','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','ContactId','ListId','NOW()','scheduledAt','CmListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','removeLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./voiceQueue.socket','register','sendStatus','end','json','offset','undefined','count','limit','Content-Range','save','then','destroy','VoiceQueues','QueueCampaigns','outbound','filter','ignore','value','includes','find','UserProfileResource','status','error','stack','name','index','map','VoiceQueue','fieldName','type','keys','filters','intersection','query','attributes','model','fields','length','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','inbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','update','getHoppers','findOne','hasOwnProperty','nolimit','VoiceQueueId','CmHopper','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','Agents','online','voicePause','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','isNil','interface','SIP/%s','removeTeams'];(function(_0xd93b26,_0x12bbf2){var _0x25f668=function(_0x133ff7){while(--_0x133ff7){_0xd93b26['push'](_0xd93b26['shift']());}};_0x25f668(++_0x12bbf2);}(_0x6244,0x1a0));var _0x4624=function(_0x7a210e,_0x3ee88f){_0x7a210e=_0x7a210e-0x0;var _0x5179cf=_0x6244[_0x7a210e];return _0x5179cf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4624('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4624('0x1'));var rp=require(_0x4624('0x2'));var moment=require(_0x4624('0x3'));var BPromise=require(_0x4624('0x4'));var Mustache=require(_0x4624('0x5'));var util=require(_0x4624('0x6'));var path=require(_0x4624('0x7'));var sox=require(_0x4624('0x8'));var csv=require(_0x4624('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4624('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4624('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4624('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4624('0xd'));var Papa=require(_0x4624('0xe'));var Redis=require(_0x4624('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4624('0x10'));var hardwareService=require(_0x4624('0x11'));var logger=require(_0x4624('0x12'))('api');var utils=require(_0x4624('0x13'));var config=require(_0x4624('0x14'));var licenseUtil=require(_0x4624('0x15'));var db=require('../../mysqldb')['db'];config[_0x4624('0x16')]=_[_0x4624('0x17')](config[_0x4624('0x16')],{'host':_0x4624('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4624('0x19'))[_0x4624('0x1a')](socket);function respondWithStatusCode(_0x35fdb9,_0x1e51fc){_0x1e51fc=_0x1e51fc||0xcc;return function(_0x1a2e8a){if(_0x1a2e8a){return _0x35fdb9[_0x4624('0x1b')](_0x1e51fc);}return _0x35fdb9['status'](_0x1e51fc)[_0x4624('0x1c')]();};}function respondWithResult(_0xf7523f,_0x1b0085){_0x1b0085=_0x1b0085||0xc8;return function(_0x115200){if(_0x115200){return _0xf7523f['status'](_0x1b0085)[_0x4624('0x1d')](_0x115200);}};}function respondWithFilteredResult(_0x10bc5d,_0x173d41){return function(_0x126fe0){if(_0x126fe0){var _0x547c16=typeof _0x173d41[_0x4624('0x1e')]===_0x4624('0x1f')&&typeof _0x173d41['limit']==='undefined';var _0x3326a4=_0x126fe0[_0x4624('0x20')];var _0x5e41ce=_0x547c16?0x0:_0x173d41['offset'];var _0x57495f=_0x547c16?_0x126fe0[_0x4624('0x20')]:_0x173d41[_0x4624('0x1e')]+_0x173d41[_0x4624('0x21')];var _0x547e91;if(_0x57495f>=_0x3326a4){_0x57495f=_0x3326a4;_0x547e91=0xc8;}else{_0x547e91=0xce;}_0x10bc5d['status'](_0x547e91);return _0x10bc5d['set'](_0x4624('0x22'),_0x5e41ce+'-'+_0x57495f+'/'+_0x3326a4)[_0x4624('0x1d')](_0x126fe0);}return null;};}function patchUpdates(_0x36aeb1){return function(_0x310266){try{jsonpatch['apply'](_0x310266,_0x36aeb1,!![]);}catch(_0x4164af){return BPromise['reject'](_0x4164af);}return _0x310266[_0x4624('0x23')]();};}function saveUpdates(_0x46389b,_0x282b15){return function(_0x1e76ed){if(_0x1e76ed){return _0x1e76ed['update'](_0x46389b)[_0x4624('0x24')](function(_0x3a4e4e){return _0x3a4e4e;});}return null;};}function removeEntity(_0xd5c340,_0x185245){return function(_0x6ec165){if(_0x6ec165){return _0x6ec165[_0x4624('0x25')]()[_0x4624('0x24')](function(){var _0x1f9101=_0x6ec165['get']({'plain':!![]});var _0x215900=[{'name':_0x4624('0x26'),'value':'inbound','ignore':![]},{'name':_0x4624('0x27'),'value':_0x4624('0x28'),'ignore':![]}];var _0x425cb8=_(_0x215900)[_0x4624('0x29')](_0x4624('0x2a'))['map']('value')[_0x4624('0x2b')]();if(_[_0x4624('0x2c')](_0x425cb8,_0x1f9101['type'])){return;}var _0x58bbce=_[_0x4624('0x2d')](_0x215900,[_0x4624('0x2b'),_0x1f9101['type']])['name'];return db[_0x4624('0x2e')][_0x4624('0x25')]({'where':{'type':_0x58bbce,'resourceId':_0x1f9101['id']}})[_0x4624('0x24')](function(){return _0x6ec165;});})['then'](function(){_0xd5c340[_0x4624('0x2f')](0xcc)[_0x4624('0x1c')]();});}};}function handleEntityNotFound(_0x3697ba,_0x3efb96){return function(_0x24b320){if(!_0x24b320){_0x3697ba[_0x4624('0x1b')](0x194);}return _0x24b320;};}function handleError(_0x48a5f3,_0x5efe93){_0x5efe93=_0x5efe93||0x1f4;return function(_0x107003){logger[_0x4624('0x30')](_0x107003[_0x4624('0x31')]);if(_0x107003[_0x4624('0x32')]){delete _0x107003['name'];}_0x48a5f3[_0x4624('0x2f')](_0x5efe93)['send'](_0x107003);};}exports[_0x4624('0x33')]=function(_0x3ce311,_0x3451ee){var _0xefc7f={},_0x37752e={},_0xe40a2f={'count':0x0,'rows':[]};var _0x537e72=_[_0x4624('0x34')](db[_0x4624('0x35')]['rawAttributes'],function(_0xef2835){return{'name':_0xef2835[_0x4624('0x36')],'type':_0xef2835[_0x4624('0x37')]['key']};});_0x37752e['model']=_[_0x4624('0x34')](_0x537e72,_0x4624('0x32'));_0x37752e['query']=_[_0x4624('0x38')](_0x3ce311['query']);_0x37752e[_0x4624('0x39')]=_[_0x4624('0x3a')](_0x37752e['model'],_0x37752e[_0x4624('0x3b')]);_0xefc7f[_0x4624('0x3c')]=_['intersection'](_0x37752e[_0x4624('0x3d')],qs[_0x4624('0x3e')](_0x3ce311[_0x4624('0x3b')][_0x4624('0x3e')]));_0xefc7f[_0x4624('0x3c')]=_0xefc7f[_0x4624('0x3c')][_0x4624('0x3f')]?_0xefc7f['attributes']:_0x37752e[_0x4624('0x3d')];if(!_0x3ce311[_0x4624('0x3b')]['hasOwnProperty']('nolimit')){_0xefc7f['limit']=qs[_0x4624('0x21')](_0x3ce311[_0x4624('0x3b')]['limit']);_0xefc7f[_0x4624('0x1e')]=qs['offset'](_0x3ce311[_0x4624('0x3b')][_0x4624('0x1e')]);}_0xefc7f[_0x4624('0x40')]=qs[_0x4624('0x41')](_0x3ce311['query'][_0x4624('0x41')]);_0xefc7f[_0x4624('0x42')]=qs[_0x4624('0x39')](_[_0x4624('0x43')](_0x3ce311[_0x4624('0x3b')],_0x37752e[_0x4624('0x39')]),_0x537e72);if(_0x3ce311[_0x4624('0x3b')][_0x4624('0x29')]){_0xefc7f[_0x4624('0x42')]=_[_0x4624('0x44')](_0xefc7f['where'],{'$or':_[_0x4624('0x34')](_0x537e72,function(_0x5343aa){if(_0x5343aa[_0x4624('0x37')]!==_0x4624('0x45')){var _0x3ba245={};_0x3ba245[_0x5343aa[_0x4624('0x32')]]={'$like':'%'+_0x3ce311[_0x4624('0x3b')][_0x4624('0x29')]+'%'};return _0x3ba245;}})});}_0xefc7f=_[_0x4624('0x44')]({},_0xefc7f,_0x3ce311[_0x4624('0x46')]);var _0x1fd64a={'where':_0xefc7f['where']};return db['VoiceQueue']['count'](_0x1fd64a)['then'](function(_0x433bd9){_0xe40a2f[_0x4624('0x20')]=_0x433bd9;if(_0x3ce311['query'][_0x4624('0x47')]){_0xefc7f[_0x4624('0x48')]=[{'all':!![]}];}return db[_0x4624('0x35')][_0x4624('0x49')](_0xefc7f);})['then'](function(_0x21c7ab){_0xe40a2f['rows']=_0x21c7ab;return _0xe40a2f;})['then'](respondWithFilteredResult(_0x3451ee,_0xefc7f))[_0x4624('0x4a')](handleError(_0x3451ee,null));};exports[_0x4624('0x4b')]=function(_0x315307,_0x1af613){var _0x518733={'raw':![],'where':{'id':_0x315307[_0x4624('0x4c')]['id']}},_0x4dd5de={};_0x4dd5de['model']=_[_0x4624('0x38')](db[_0x4624('0x35')][_0x4624('0x4d')]);_0x4dd5de[_0x4624('0x3b')]=_['keys'](_0x315307[_0x4624('0x3b')]);_0x4dd5de['filters']=_['intersection'](_0x4dd5de['model'],_0x4dd5de['query']);_0x518733[_0x4624('0x3c')]=_['intersection'](_0x4dd5de[_0x4624('0x3d')],qs[_0x4624('0x3e')](_0x315307[_0x4624('0x3b')]['fields']));_0x518733[_0x4624('0x3c')]=_0x518733['attributes']['length']?_0x518733[_0x4624('0x3c')]:_0x4dd5de[_0x4624('0x3d')];if(_0x315307[_0x4624('0x3b')][_0x4624('0x47')]){_0x518733[_0x4624('0x48')]=[{'all':!![]}];}_0x518733=_[_0x4624('0x44')]({},_0x518733,_0x315307[_0x4624('0x46')]);return db[_0x4624('0x35')][_0x4624('0x2d')](_0x518733)['then'](handleEntityNotFound(_0x1af613,null))['then'](respondWithResult(_0x1af613,null))[_0x4624('0x4a')](handleError(_0x1af613,null));};exports[_0x4624('0x4e')]=function(_0x249093,_0x1e9bf9){return db[_0x4624('0x35')][_0x4624('0x4e')](_0x249093['body'],{})[_0x4624('0x24')](function(_0x119f76){var _0x52edfd=_0x249093[_0x4624('0x4f')]['get']({'plain':!![]});if(!_0x52edfd)throw new Error(_0x4624('0x50'));if(_0x52edfd[_0x4624('0x51')]==='user'){var _0x5230ec=_0x119f76[_0x4624('0x52')]({'plain':!![]});var _0x368e07=[{'name':_0x4624('0x26'),'value':_0x4624('0x53')},{'name':'QueueCampaigns','value':_0x4624('0x28')}];var _0xc18acf=_[_0x4624('0x2d')](_0x368e07,[_0x4624('0x2b'),_0x5230ec[_0x4624('0x37')]])[_0x4624('0x32')];return db[_0x4624('0x54')][_0x4624('0x2d')]({'where':{'name':_0xc18acf,'userProfileId':_0x52edfd[_0x4624('0x55')]},'raw':!![]})[_0x4624('0x24')](function(_0x235955){if(_0x235955&&_0x235955[_0x4624('0x56')]===0x0){return db[_0x4624('0x2e')][_0x4624('0x4e')]({'name':_0x5230ec[_0x4624('0x32')],'resourceId':_0x5230ec['id'],'type':_0x235955['name'],'sectionId':_0x235955['id']},{})['then'](function(){return _0x119f76;});}else{return _0x119f76;}})['catch'](function(_0x4c0087){logger['error'](_0x4624('0x57'),_0x4c0087);throw _0x4c0087;});}return _0x119f76;})[_0x4624('0x24')](respondWithResult(_0x1e9bf9,0xc9))['catch'](handleError(_0x1e9bf9,null));};exports[_0x4624('0x58')]=function(_0x32b920,_0x20b1e0){var _0x39b509={'where':{'id':_0x32b920[_0x4624('0x4c')]['id']}},_0x17c9b4={};_0x17c9b4['model']=_[_0x4624('0x38')](db[_0x4624('0x35')][_0x4624('0x4d')]);_0x39b509[_0x4624('0x3c')]=_['intersection'](_0x17c9b4[_0x4624('0x3d')],qs[_0x4624('0x3e')](_0x32b920['query']['fields']));_0x39b509[_0x4624('0x3c')]=_0x39b509[_0x4624('0x3c')][_0x4624('0x3f')]?_0x39b509['attributes']:_0x17c9b4[_0x4624('0x3d')];if(_0x32b920[_0x4624('0x3b')][_0x4624('0x47')]){_0x39b509[_0x4624('0x48')]=[{'all':!![]}];}_0x39b509=_[_0x4624('0x44')]({},_0x39b509,_0x32b920[_0x4624('0x46')]);return db[_0x4624('0x35')][_0x4624('0x2d')](_0x39b509)[_0x4624('0x24')](handleEntityNotFound(_0x20b1e0,null))['then'](function(_0x4910a4){if(_0x4910a4){var _0x1b42ab=_0x4910a4[_0x4624('0x52')]({'plain':!![]});_0x1b42ab=qs[_0x4624('0x59')](_0x1b42ab,['id',_0x4624('0x5a'),_0x4624('0x5b')]);_0x32b920['body']=_[_0x4624('0x59')](_0x32b920[_0x4624('0x5c')],['id',_0x4624('0x5a'),_0x4624('0x5b')]);return db[_0x4624('0x35')][_0x4624('0x4e')](_[_0x4624('0x44')](_0x1b42ab,_0x32b920['body']),{'include':_0x32b920['query']['includeAll']?[{'all':!![]}]:undefined})[_0x4624('0x24')](function(_0x464e22){var _0x42d3e8=_0x32b920['user'][_0x4624('0x52')]({'plain':!![]});if(!_0x42d3e8)throw new Error(_0x4624('0x50'));if(_0x42d3e8[_0x4624('0x51')]===_0x4624('0x4f')){var _0x359295=_0x464e22[_0x4624('0x52')]({'plain':!![]});var _0x124c50=[{'name':_0x4624('0x26'),'value':_0x4624('0x53')},{'name':_0x4624('0x27'),'value':'outbound'}];var _0x5e20ff=_['find'](_0x124c50,[_0x4624('0x2b'),_0x359295['type']])[_0x4624('0x32')];return db[_0x4624('0x54')][_0x4624('0x2d')]({'where':{'name':_0x5e20ff,'userProfileId':_0x42d3e8[_0x4624('0x55')]},'raw':!![]})[_0x4624('0x24')](function(_0x4fb192){if(_0x4fb192&&_0x4fb192[_0x4624('0x56')]===0x0){return db[_0x4624('0x2e')][_0x4624('0x4e')]({'name':_0x359295[_0x4624('0x32')],'resourceId':_0x359295['id'],'type':_0x4fb192['name'],'sectionId':_0x4fb192['id']},{})[_0x4624('0x24')](function(){return _0x464e22;});}else{return _0x464e22;}})[_0x4624('0x4a')](function(_0x409581){logger['error'](_0x4624('0x57'),_0x409581);throw _0x409581;});}return _0x464e22;});}})[_0x4624('0x24')](respondWithResult(_0x20b1e0,0xc9))[_0x4624('0x4a')](handleError(_0x20b1e0,null));};exports[_0x4624('0x5d')]=function(_0x4a015b,_0x3aaaf0){if(_0x4a015b[_0x4624('0x5c')]['id']){delete _0x4a015b[_0x4624('0x5c')]['id'];}return db[_0x4624('0x35')][_0x4624('0x2d')]({'where':{'id':_0x4a015b[_0x4624('0x4c')]['id']}})[_0x4624('0x24')](handleEntityNotFound(_0x3aaaf0,null))[_0x4624('0x24')](saveUpdates(_0x4a015b['body'],null))[_0x4624('0x24')](respondWithResult(_0x3aaaf0,null))[_0x4624('0x4a')](handleError(_0x3aaaf0,null));};exports[_0x4624('0x25')]=function(_0x109a79,_0x146faf){return db[_0x4624('0x35')]['find']({'where':{'id':_0x109a79[_0x4624('0x4c')]['id']}})[_0x4624('0x24')](handleEntityNotFound(_0x146faf,null))[_0x4624('0x24')](removeEntity(_0x146faf,null))[_0x4624('0x4a')](handleError(_0x146faf,null));};exports[_0x4624('0x5e')]=function(_0x25e5aa,_0x1b36a1,_0x138b54){var _0x433446={'raw':![],'where':{}};var _0x1b76f1={};var _0x17800a={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x4624('0x5f')]({'where':{'id':_0x25e5aa[_0x4624('0x4c')]['id']}})[_0x4624('0x24')](handleEntityNotFound(_0x1b36a1,null))[_0x4624('0x24')](function(_0x2f64f0){if(_0x2f64f0){_0x1b76f1['model']=_[_0x4624('0x38')](db['CmHopper'][_0x4624('0x4d')]);_0x1b76f1[_0x4624('0x3b')]=_[_0x4624('0x38')](_0x25e5aa[_0x4624('0x3b')]);_0x1b76f1[_0x4624('0x39')]=_[_0x4624('0x3a')](_0x1b76f1[_0x4624('0x3d')],_0x1b76f1['query']);_0x433446[_0x4624('0x3c')]=_[_0x4624('0x3a')](_0x1b76f1[_0x4624('0x3d')],qs[_0x4624('0x3e')](_0x25e5aa[_0x4624('0x3b')][_0x4624('0x3e')]));_0x433446['attributes']=_0x433446[_0x4624('0x3c')][_0x4624('0x3f')]?_0x433446[_0x4624('0x3c')]:_0x1b76f1['model'];if(!_0x25e5aa[_0x4624('0x3b')][_0x4624('0x60')](_0x4624('0x61'))){_0x433446[_0x4624('0x21')]=qs[_0x4624('0x21')](_0x25e5aa[_0x4624('0x3b')][_0x4624('0x21')]);_0x433446[_0x4624('0x1e')]=qs[_0x4624('0x1e')](_0x25e5aa['query'][_0x4624('0x1e')]);}_0x433446[_0x4624('0x40')]=qs['sort'](_0x25e5aa['query']['sort']);_0x433446[_0x4624('0x42')]=qs[_0x4624('0x39')](_['pick'](_0x25e5aa[_0x4624('0x3b')],_0x1b76f1[_0x4624('0x39')]));_0x433446['where'][_0x4624('0x62')]=_0x2f64f0['id'];if(_0x25e5aa[_0x4624('0x3b')][_0x4624('0x29')]){_0x433446[_0x4624('0x42')]=_[_0x4624('0x44')](_0x433446[_0x4624('0x42')],{'$or':_[_0x4624('0x34')](_0x433446[_0x4624('0x3c')],function(_0x342660){var _0x2b251e={};_0x2b251e[_0x342660]={'$like':'%'+_0x25e5aa[_0x4624('0x3b')][_0x4624('0x29')]+'%'};return _0x2b251e;})});}_0x433446=_[_0x4624('0x44')]({},_0x433446,_0x25e5aa[_0x4624('0x46')]);return db[_0x4624('0x63')][_0x4624('0x20')]({'where':_0x433446['where']})['then'](function(_0x204414){_0x17800a[_0x4624('0x20')]=_0x204414;if(_0x25e5aa[_0x4624('0x3b')][_0x4624('0x47')]){_0x433446['include']=[{'all':!![]}];}return db['CmHopper'][_0x4624('0x49')](_0x433446);})[_0x4624('0x24')](function(_0x7820ae){_0x17800a[_0x4624('0x64')]=_0x7820ae;return _0x17800a;});}})[_0x4624('0x24')](respondWithFilteredResult(_0x1b36a1,_0x433446))['catch'](handleError(_0x1b36a1,null));};exports[_0x4624('0x65')]=function(_0xb68911,_0x171ebd,_0x26f3bc){var _0x24d219={'raw':!![],'where':{}};var _0x3260c1={};var _0x381661={'count':0x0,'rows':[]};return db[_0x4624('0x35')][_0x4624('0x5f')]({'where':{'id':_0xb68911[_0x4624('0x4c')]['id']}})['then'](handleEntityNotFound(_0x171ebd,null))[_0x4624('0x24')](function(_0x54528e){if(_0x54528e){_0x3260c1[_0x4624('0x3d')]=_[_0x4624('0x38')](db[_0x4624('0x66')][_0x4624('0x4d')]);_0x3260c1[_0x4624('0x3b')]=_[_0x4624('0x38')](_0xb68911[_0x4624('0x3b')]);_0x3260c1[_0x4624('0x39')]=_[_0x4624('0x3a')](_0x3260c1[_0x4624('0x3d')],_0x3260c1['query']);_0x24d219[_0x4624('0x3c')]=_[_0x4624('0x3a')](_0x3260c1[_0x4624('0x3d')],qs[_0x4624('0x3e')](_0xb68911['query'][_0x4624('0x3e')]));_0x24d219[_0x4624('0x3c')]=_0x24d219[_0x4624('0x3c')][_0x4624('0x3f')]?_0x24d219[_0x4624('0x3c')]:_0x3260c1[_0x4624('0x3d')];if(!_0xb68911[_0x4624('0x3b')][_0x4624('0x60')](_0x4624('0x61'))){_0x24d219['limit']=qs['limit'](_0xb68911[_0x4624('0x3b')][_0x4624('0x21')]);_0x24d219[_0x4624('0x1e')]=qs[_0x4624('0x1e')](_0xb68911['query'][_0x4624('0x1e')]);}_0x24d219['order']=qs['sort'](_0xb68911[_0x4624('0x3b')]['sort']);_0x24d219[_0x4624('0x42')]=qs[_0x4624('0x39')](_[_0x4624('0x43')](_0xb68911[_0x4624('0x3b')],_0x3260c1['filters']));_0x24d219['where']['VoiceQueueId']=_0x54528e['id'];if(_0xb68911[_0x4624('0x3b')][_0x4624('0x29')]){_0x24d219[_0x4624('0x42')]=_[_0x4624('0x44')](_0x24d219['where'],{'$or':_[_0x4624('0x34')](_0x24d219[_0x4624('0x3c')],function(_0x2227c7){var _0x4cdb18={};_0x4cdb18[_0x2227c7]={'$like':'%'+_0xb68911[_0x4624('0x3b')][_0x4624('0x29')]+'%'};return _0x4cdb18;})});}_0x24d219=_[_0x4624('0x44')]({},_0x24d219,_0xb68911[_0x4624('0x46')]);return db[_0x4624('0x66')][_0x4624('0x20')]({'where':_0x24d219[_0x4624('0x42')]})[_0x4624('0x24')](function(_0x1293c4){_0x381661[_0x4624('0x20')]=_0x1293c4;if(_0xb68911[_0x4624('0x3b')]['includeAll']){_0x24d219[_0x4624('0x48')]=[{'all':!![]}];}return db[_0x4624('0x66')][_0x4624('0x49')](_0x24d219);})['then'](function(_0x40b92f){_0x381661['rows']=_0x40b92f;return _0x381661;});}})[_0x4624('0x24')](respondWithFilteredResult(_0x171ebd,_0x24d219))[_0x4624('0x4a')](handleError(_0x171ebd,null));};exports[_0x4624('0x67')]=function(_0xd52bc9,_0x32f1cc,_0x27e366){var _0x50dcf6={'raw':!![],'where':{}};var _0x4c428c={};var _0x336193={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0xd52bc9['params']['id']}})[_0x4624('0x24')](handleEntityNotFound(_0x32f1cc,null))[_0x4624('0x24')](function(_0x2df14a){if(_0x2df14a){_0x4c428c['model']=_[_0x4624('0x38')](db['CmHopperFinal'][_0x4624('0x4d')]);_0x4c428c[_0x4624('0x3b')]=_[_0x4624('0x38')](_0xd52bc9[_0x4624('0x3b')]);_0x4c428c['filters']=_[_0x4624('0x3a')](_0x4c428c[_0x4624('0x3d')],_0x4c428c[_0x4624('0x3b')]);_0x50dcf6['attributes']=_[_0x4624('0x3a')](_0x4c428c['model'],qs[_0x4624('0x3e')](_0xd52bc9[_0x4624('0x3b')][_0x4624('0x3e')]));_0x50dcf6[_0x4624('0x3c')]=_0x50dcf6[_0x4624('0x3c')][_0x4624('0x3f')]?_0x50dcf6[_0x4624('0x3c')]:_0x4c428c[_0x4624('0x3d')];if(!_0xd52bc9[_0x4624('0x3b')][_0x4624('0x60')](_0x4624('0x61'))){_0x50dcf6[_0x4624('0x21')]=qs[_0x4624('0x21')](_0xd52bc9[_0x4624('0x3b')][_0x4624('0x21')]);_0x50dcf6['offset']=qs[_0x4624('0x1e')](_0xd52bc9[_0x4624('0x3b')][_0x4624('0x1e')]);}_0x50dcf6[_0x4624('0x40')]=qs['sort'](_0xd52bc9[_0x4624('0x3b')][_0x4624('0x41')]);_0x50dcf6[_0x4624('0x42')]=qs[_0x4624('0x39')](_[_0x4624('0x43')](_0xd52bc9['query'],_0x4c428c['filters']));_0x50dcf6[_0x4624('0x42')][_0x4624('0x62')]=_0x2df14a['id'];if(_0xd52bc9[_0x4624('0x3b')]['filter']){_0x50dcf6['where']=_['merge'](_0x50dcf6[_0x4624('0x42')],{'$or':_[_0x4624('0x34')](_0x50dcf6[_0x4624('0x3c')],function(_0x5780ff){var _0x339e9d={};_0x339e9d[_0x5780ff]={'$like':'%'+_0xd52bc9[_0x4624('0x3b')][_0x4624('0x29')]+'%'};return _0x339e9d;})});}_0x50dcf6=_[_0x4624('0x44')]({},_0x50dcf6,_0xd52bc9[_0x4624('0x46')]);return db['CmHopperFinal']['count']({'where':_0x50dcf6[_0x4624('0x42')]})[_0x4624('0x24')](function(_0x5b7fb6){_0x336193[_0x4624('0x20')]=_0x5b7fb6;if(_0xd52bc9[_0x4624('0x3b')][_0x4624('0x47')]){_0x50dcf6['include']=[{'all':!![]}];}return db[_0x4624('0x68')][_0x4624('0x49')](_0x50dcf6);})[_0x4624('0x24')](function(_0x17e543){_0x336193['rows']=_0x17e543;return _0x336193;});}})[_0x4624('0x24')](respondWithFilteredResult(_0x32f1cc,_0x50dcf6))[_0x4624('0x4a')](handleError(_0x32f1cc,null));};exports[_0x4624('0x69')]=function(_0x402bc7,_0x1cf6f6,_0x4a9996){var _0x5f268a={'raw':!![],'where':{}};var _0x46ec7c={};var _0x3d6361={'count':0x0,'rows':[]};return db[_0x4624('0x35')][_0x4624('0x5f')]({'where':{'id':_0x402bc7[_0x4624('0x4c')]['id']}})[_0x4624('0x24')](handleEntityNotFound(_0x1cf6f6,null))[_0x4624('0x24')](function(_0x537314){if(_0x537314){_0x46ec7c[_0x4624('0x3d')]=_['keys'](db['CmHopperBlack'][_0x4624('0x4d')]);_0x46ec7c[_0x4624('0x3b')]=_[_0x4624('0x38')](_0x402bc7[_0x4624('0x3b')]);_0x46ec7c[_0x4624('0x39')]=_[_0x4624('0x3a')](_0x46ec7c[_0x4624('0x3d')],_0x46ec7c[_0x4624('0x3b')]);_0x5f268a[_0x4624('0x3c')]=_[_0x4624('0x3a')](_0x46ec7c[_0x4624('0x3d')],qs[_0x4624('0x3e')](_0x402bc7[_0x4624('0x3b')][_0x4624('0x3e')]));_0x5f268a[_0x4624('0x3c')]=_0x5f268a['attributes'][_0x4624('0x3f')]?_0x5f268a[_0x4624('0x3c')]:_0x46ec7c['model'];if(!_0x402bc7[_0x4624('0x3b')][_0x4624('0x60')](_0x4624('0x61'))){_0x5f268a['limit']=qs['limit'](_0x402bc7['query']['limit']);_0x5f268a['offset']=qs[_0x4624('0x1e')](_0x402bc7[_0x4624('0x3b')][_0x4624('0x1e')]);}_0x5f268a['order']=qs[_0x4624('0x41')](_0x402bc7[_0x4624('0x3b')][_0x4624('0x41')]);_0x5f268a[_0x4624('0x42')]=qs['filters'](_[_0x4624('0x43')](_0x402bc7[_0x4624('0x3b')],_0x46ec7c['filters']));_0x5f268a[_0x4624('0x42')][_0x4624('0x62')]=_0x537314['id'];if(_0x402bc7[_0x4624('0x3b')][_0x4624('0x29')]){_0x5f268a[_0x4624('0x42')]=_[_0x4624('0x44')](_0x5f268a[_0x4624('0x42')],{'$or':_['map'](_0x5f268a[_0x4624('0x3c')],function(_0x2a2e4e){var _0x42bc27={};_0x42bc27[_0x2a2e4e]={'$like':'%'+_0x402bc7[_0x4624('0x3b')][_0x4624('0x29')]+'%'};return _0x42bc27;})});}_0x5f268a=_[_0x4624('0x44')]({},_0x5f268a,_0x402bc7[_0x4624('0x46')]);return db[_0x4624('0x6a')][_0x4624('0x20')]({'where':_0x5f268a[_0x4624('0x42')]})[_0x4624('0x24')](function(_0x4bad26){_0x3d6361[_0x4624('0x20')]=_0x4bad26;if(_0x402bc7[_0x4624('0x3b')][_0x4624('0x47')]){_0x5f268a['include']=[{'all':!![]}];}return db[_0x4624('0x6a')][_0x4624('0x49')](_0x5f268a);})[_0x4624('0x24')](function(_0xab0539){_0x3d6361[_0x4624('0x64')]=_0xab0539;return _0x3d6361;});}})[_0x4624('0x24')](respondWithFilteredResult(_0x1cf6f6,_0x5f268a))[_0x4624('0x4a')](handleError(_0x1cf6f6,null));};exports[_0x4624('0x6b')]=function(_0xb5443e,_0x26f998,_0x4675e1){var _0x4293ec={};var _0x3b2f4d={};var _0x2ed28e;var _0x38e250;return db[_0x4624('0x35')][_0x4624('0x5f')]({'where':{'id':_0xb5443e[_0x4624('0x4c')]['id']}})[_0x4624('0x24')](handleEntityNotFound(_0x26f998,null))['then'](function(_0x44ce9a){if(_0x44ce9a){_0x2ed28e=_0x44ce9a;_0x3b2f4d[_0x4624('0x3d')]=_[_0x4624('0x38')](db['Team'][_0x4624('0x4d')]);_0x3b2f4d[_0x4624('0x3b')]=_[_0x4624('0x38')](_0xb5443e[_0x4624('0x3b')]);_0x3b2f4d[_0x4624('0x39')]=_[_0x4624('0x3a')](_0x3b2f4d[_0x4624('0x3d')],_0x3b2f4d[_0x4624('0x3b')]);_0x4293ec[_0x4624('0x3c')]=_[_0x4624('0x3a')](_0x3b2f4d['model'],qs[_0x4624('0x3e')](_0xb5443e[_0x4624('0x3b')]['fields']));_0x4293ec['attributes']=_0x4293ec[_0x4624('0x3c')][_0x4624('0x3f')]?_0x4293ec['attributes']:_0x3b2f4d[_0x4624('0x3d')];_0x4293ec['order']=qs[_0x4624('0x41')](_0xb5443e[_0x4624('0x3b')][_0x4624('0x41')]);_0x4293ec['where']=qs[_0x4624('0x39')](_['pick'](_0xb5443e[_0x4624('0x3b')],_0x3b2f4d[_0x4624('0x39')]));if(_0xb5443e['query'][_0x4624('0x29')]){_0x4293ec[_0x4624('0x42')]=_[_0x4624('0x44')](_0x4293ec[_0x4624('0x42')],{'$or':_[_0x4624('0x34')](_0x4293ec[_0x4624('0x3c')],function(_0x49b7d2){var _0x45cb66={};_0x45cb66[_0x49b7d2]={'$like':'%'+_0xb5443e[_0x4624('0x3b')][_0x4624('0x29')]+'%'};return _0x45cb66;})});}_0x4293ec=_['merge']({},_0x4293ec,_0xb5443e['options']);return _0x2ed28e[_0x4624('0x6b')](_0x4293ec);}})[_0x4624('0x24')](function(_0x2ad5f0){if(_0x2ad5f0){_0x38e250=_0x2ad5f0[_0x4624('0x3f')];if(!_0xb5443e[_0x4624('0x3b')][_0x4624('0x60')](_0x4624('0x61'))){_0x4293ec[_0x4624('0x21')]=qs[_0x4624('0x21')](_0xb5443e[_0x4624('0x3b')][_0x4624('0x21')]);_0x4293ec[_0x4624('0x1e')]=qs[_0x4624('0x1e')](_0xb5443e[_0x4624('0x3b')][_0x4624('0x1e')]);}return _0x2ed28e['getTeams'](_0x4293ec);}})[_0x4624('0x24')](function(_0x493675){if(_0x493675){return _0x493675?{'count':_0x38e250,'rows':_0x493675}:null;}})[_0x4624('0x24')](respondWithResult(_0x26f998,null))[_0x4624('0x4a')](handleError(_0x26f998,null));};exports[_0x4624('0x6c')]=function(_0x342322,_0x5ad2ea,_0x231191){var _0x469dc2=_0x342322['body'][_0x4624('0x6d')];var _0x144695=_[_0x4624('0x34')](_0x469dc2,'id');return db[_0x4624('0x6e')][_0x4624('0x49')]({'where':{'id':_0x144695},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4624('0x6f'),'attributes':['id',_0x4624('0x32'),_0x4624('0x70'),_0x4624('0x71'),'interface'],'raw':!![]}]})['then'](function(_0x25d1b6){if(_0x25d1b6){var _0x3bedc3=_['flatMap'](_0x25d1b6,function(_0x1b82d8){var _0x5081a6=_0x1b82d8[_0x4624('0x52')]({'plain':!![]});_0x5081a6[_0x4624('0x6f')][_0x4624('0x72')](function(_0x55c197){_0x55c197[_0x4624('0x73')]=_[_0x4624('0x2d')](_0x469dc2,{'id':_0x5081a6['id']})['penalty'];});return _0x5081a6['Agents'];});return db['VoiceQueue'][_0x4624('0x2d')]({'where':{'id':_0x342322[_0x4624('0x4c')]['id']}})[_0x4624('0x24')](function(_0x10f8a9){return db[_0x4624('0x74')][_0x4624('0x75')](function(_0x26b456){return _0x10f8a9[_0x4624('0x6c')](_0x144695,{'transaction':_0x26b456})['then'](function(){return BPromise[_0x4624('0x76')](_0x469dc2,function(_0x1aaeac){return db[_0x4624('0x77')][_0x4624('0x78')]({'TeamId':_0x1aaeac['id'],'VoiceQueueId':_0x342322[_0x4624('0x4c')]['id'],'penalty':_0x1aaeac[_0x4624('0x73')]},{'transaction':_0x26b456});});})['then'](function(){return BPromise['each'](_0x3bedc3,function(_0x234023){return db[_0x4624('0x79')]['findOrCreate']({'where':{'UserId':_0x234023['id'],'VoiceQueueId':_0x342322[_0x4624('0x4c')]['id']},'defaults':{'penalty':_0x234023[_0x4624('0x73')]},'transaction':_0x26b456});});})[_0x4624('0x24')](function(){return BPromise['each'](_['filter'](_0x3bedc3,{'online':!![]}),function(_0x4ecb7c){return db[_0x4624('0x7a')][_0x4624('0x78')]({'membername':_0x4ecb7c[_0x4624('0x32')],'UserId':_0x4ecb7c['id'],'queue_name':_0x10f8a9[_0x4624('0x32')],'VoiceQueueId':_0x10f8a9['id'],'interface':_[_0x4624('0x7b')](_0x4ecb7c[_0x4624('0x7c')])?util['format'](_0x4624('0x7d'),_0x4ecb7c['name']):_0x4ecb7c[_0x4624('0x7c')],'paused':_0x4ecb7c['voicePause']||![],'penalty':_0x4ecb7c[_0x4624('0x73')]},{'transaction':_0x26b456});});})['then'](function(){_0x3bedc3[_0x4624('0x72')](function(_0x4868d1){socket['emit']('userVoiceQueue:save',{'UserId':_0x4868d1['id'],'VoiceQueueId':_0x10f8a9['id']});});});});});}})[_0x4624('0x24')](respondWithStatusCode(_0x5ad2ea,null))[_0x4624('0x4a')](handleError(_0x5ad2ea,null));};exports[_0x4624('0x7e')]=function(_0x219122,_0x3b14e7,_0x36cee2){return db[_0x4624('0x6e')]['findAll']({'where':{'id':_0x219122['query'][_0x4624('0x7f')]},'attributes':['id'],'include':[{'model':db[_0x4624('0x80')],'as':_0x4624('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x4624('0x24')](handleEntityNotFound(_0x3b14e7,null))[_0x4624('0x24')](function(_0x1caef6){var _0x61a332=_[_0x4624('0x34')](_0x1caef6,'id');var _0x587547=[];var _0x15bc8b=[];var _0x5cff73=squel[_0x4624('0x81')]();_0x5cff73[_0x4624('0x82')](_0x4624('0x83'))[_0x4624('0x84')](_0x4624('0x85'),'tq')[_0x4624('0x86')](_0x4624('0x87'),'ut',_0x4624('0x88'))[_0x4624('0x42')](_0x4624('0x89'),_0x219122[_0x4624('0x4c')]['id']);for(var _0x5961be=0x0;_0x5961be<_0x1caef6[_0x4624('0x3f')];_0x5961be+=0x1){let _0x38d9dd=_0x1caef6[_0x5961be];for(var _0x589bc7=0x0;_0x589bc7<_0x38d9dd['Agents']['length'];_0x589bc7+=0x1){let _0x20b714=_0x38d9dd['Agents'][_0x589bc7];var _0x6367f5=_0x5cff73[_0x4624('0x58')]();_0x6367f5[_0x4624('0x42')](_0x4624('0x8a'),_0x20b714['id']);_0x15bc8b['push'](db[_0x4624('0x74')][_0x4624('0x3b')](_0x6367f5[_0x4624('0x8b')](),{'type':db[_0x4624('0x74')][_0x4624('0x8c')][_0x4624('0x8d')]})[_0x4624('0x24')](function(_0x2aede1){if(_0x2aede1[_0x4624('0x3f')]===0x1){return _0x20b714['id'];}else{var _0x11bb60=_[_0x4624('0x8e')](_[_0x4624('0x34')](_0x2aede1,_0x4624('0x8f')),function(_0x18deb0){return _[_0x4624('0x2c')](_0x61a332,_0x18deb0);});if(_0x11bb60){return _0x20b714['id'];}}}));}}return BPromise[_0x4624('0x90')](_0x15bc8b)['then'](function(_0x17c6e9){_0x587547=_(_0x587547)['union'](_0x17c6e9)['compact']()['value']();return db[_0x4624('0x35')]['find']({'where':{'id':_0x219122[_0x4624('0x4c')]['id']}})[_0x4624('0x24')](function(_0x45289f){return db[_0x4624('0x74')]['transaction'](function(_0x16f81e){return _0x45289f[_0x4624('0x7e')](_0x219122['query'][_0x4624('0x7f')],{'transaction':_0x16f81e})[_0x4624('0x24')](function(){if(!_[_0x4624('0x91')](_0x587547)){return _0x45289f[_0x4624('0x92')](_0x587547,{'transaction':_0x16f81e})[_0x4624('0x24')](function(){return db['UserVoiceQueueRt'][_0x4624('0x25')]({'where':{'VoiceQueueId':_0x219122[_0x4624('0x4c')]['id'],'UserId':_0x587547},'transaction':_0x16f81e});});}})['then'](function(){_0x587547[_0x4624('0x72')](function(_0xed30e4){socket[_0x4624('0x93')]('userVoiceQueue:remove',{'UserId':_0xed30e4,'VoiceQueueId':_0x45289f['id']});});});});});});})[_0x4624('0x24')](respondWithStatusCode(_0x3b14e7,null))[_0x4624('0x4a')](handleError(_0x3b14e7,null));};exports[_0x4624('0x94')]=function(_0x304bdf,_0x4bd6fa,_0x14171e){var _0x59dd9a,_0xd6e392;return db['VoiceQueue'][_0x4624('0x2d')]({'where':{'id':_0x304bdf['params']['id']}})[_0x4624('0x24')](handleEntityNotFound(_0x4bd6fa,null))[_0x4624('0x24')](function(_0x4de917){if(_0x4de917){_0xd6e392=_0x4de917;return _0x4de917['addAgents'](_0x304bdf[_0x4624('0x5c')][_0x4624('0x7f')],_[_0x4624('0x59')](_0x304bdf[_0x4624('0x5c')],[_0x4624('0x7f'),'id'])||{})[_0x4624('0x95')](function(_0x19e3a6){for(var _0x254421=0x0;_0x254421<_0x304bdf[_0x4624('0x5c')][_0x4624('0x7f')]['length'];_0x254421+=0x1){socket[_0x4624('0x93')](_0x4624('0x96'),{'UserId':Number(_0x304bdf[_0x4624('0x5c')][_0x4624('0x7f')][_0x254421]),'VoiceQueueId':Number(_0x304bdf['params']['id'])});}return _0x19e3a6;});}})[_0x4624('0x24')](function(_0x45fb){_0x59dd9a=_0x45fb||[];if(_0xd6e392){return db[_0x4624('0x80')][_0x4624('0x49')]({'where':{'id':_0x304bdf[_0x4624('0x5c')][_0x4624('0x7f')]},'attributes':['id',_0x4624('0x32'),_0x4624('0x70'),_0x4624('0x71'),_0x4624('0x7c')],'raw':!![]});}})['then'](function(_0x2acf8a){if(!_[_0x4624('0x91')](_0x2acf8a)){var _0x270646=[];for(var _0x36b125=0x0;_0x36b125<_0x2acf8a[_0x4624('0x3f')];_0x36b125++){if(_0x2acf8a[_0x36b125]['online']){_0x270646[_0x4624('0x97')](db[_0x4624('0x7a')][_0x4624('0x78')]({'membername':_0x2acf8a[_0x36b125]['name'],'UserId':_0x2acf8a[_0x36b125]['id'],'queue_name':_0xd6e392[_0x4624('0x32')],'VoiceQueueId':_0xd6e392['id'],'interface':_['isNil'](_0x2acf8a[_0x36b125]['interface'])?util['format'](_0x4624('0x7d'),_0x2acf8a[_0x36b125][_0x4624('0x32')]):_0x2acf8a[_0x36b125][_0x4624('0x7c')],'paused':_0x2acf8a[_0x36b125]['voicePause']||![],'penalty':_0x304bdf[_0x4624('0x5c')][_0x4624('0x73')]||0x0}));}}return BPromise[_0x4624('0x90')](_0x270646);}})['then'](function(){return _0x59dd9a;})[_0x4624('0x24')](respondWithResult(_0x4bd6fa,null))['catch'](handleError(_0x4bd6fa,null));};exports[_0x4624('0x92')]=function(_0x4653ff,_0x543362,_0x29d522){return db['VoiceQueue'][_0x4624('0x2d')]({'where':{'id':_0x4653ff[_0x4624('0x4c')]['id']}})[_0x4624('0x24')](handleEntityNotFound(_0x543362,null))[_0x4624('0x24')](function(_0x34c58a){if(_0x34c58a){return _0x34c58a['removeAgents'](_0x4653ff[_0x4624('0x3b')]['ids'])[_0x4624('0x24')](function(){if(_['isArray'](_0x4653ff[_0x4624('0x3b')][_0x4624('0x7f')])){for(var _0x1a01e5=0x0;_0x1a01e5<_0x4653ff[_0x4624('0x3b')][_0x4624('0x7f')]['length'];_0x1a01e5+=0x1){socket['emit'](_0x4624('0x98'),{'UserId':Number(_0x4653ff[_0x4624('0x3b')][_0x4624('0x7f')][_0x1a01e5]),'VoiceQueueId':Number(_0x4653ff['params']['id'])});}}else{socket[_0x4624('0x93')]('userVoiceQueue:remove',{'UserId':Number(_0x4653ff[_0x4624('0x3b')][_0x4624('0x7f')]),'VoiceQueueId':Number(_0x4653ff[_0x4624('0x4c')]['id'])});}});}})[_0x4624('0x24')](function(_0x3c80d6){return db[_0x4624('0x7a')][_0x4624('0x25')]({'where':{'VoiceQueueId':_0x4653ff[_0x4624('0x4c')]['id'],'UserId':_0x4653ff['query'][_0x4624('0x7f')]}})['then'](function(){return _0x3c80d6;});})[_0x4624('0x24')](respondWithStatusCode(_0x543362,null))[_0x4624('0x4a')](handleError(_0x543362,null));};exports[_0x4624('0x99')]=function(_0x3475d1,_0x471d98,_0x5b5373){var _0x349e81={};var _0x4f5c20={};var _0x4b42a8;var _0xf02962;return db['VoiceQueue'][_0x4624('0x5f')]({'where':{'id':_0x3475d1[_0x4624('0x4c')]['id']}})['then'](handleEntityNotFound(_0x471d98,null))[_0x4624('0x24')](function(_0x4ead80){if(_0x4ead80){_0x4b42a8=_0x4ead80;_0x4f5c20[_0x4624('0x3d')]=_['keys'](db[_0x4624('0x80')]['rawAttributes']);_0x4f5c20[_0x4624('0x3b')]=_['keys'](_0x3475d1['query']);_0x4f5c20[_0x4624('0x39')]=_[_0x4624('0x3a')](_0x4f5c20[_0x4624('0x3d')],_0x4f5c20[_0x4624('0x3b')]);_0x349e81[_0x4624('0x3c')]=_[_0x4624('0x3a')](_0x4f5c20[_0x4624('0x3d')],qs[_0x4624('0x3e')](_0x3475d1[_0x4624('0x3b')]['fields']));_0x349e81[_0x4624('0x3c')]=_0x349e81['attributes'][_0x4624('0x3f')]?_0x349e81[_0x4624('0x3c')]:_0x4f5c20[_0x4624('0x3d')];_0x349e81['order']=qs['sort'](_0x3475d1[_0x4624('0x3b')][_0x4624('0x41')]);_0x349e81['where']=qs[_0x4624('0x39')](_[_0x4624('0x43')](_0x3475d1['query'],_0x4f5c20[_0x4624('0x39')]));if(_0x3475d1['query'][_0x4624('0x29')]){_0x349e81[_0x4624('0x42')]=_['merge'](_0x349e81[_0x4624('0x42')],{'$or':_[_0x4624('0x34')](_0x349e81['attributes'],function(_0x56fdc1){var _0x222828={};_0x222828[_0x56fdc1]={'$like':'%'+_0x3475d1[_0x4624('0x3b')]['filter']+'%'};return _0x222828;})});}_0x349e81=_[_0x4624('0x44')]({},_0x349e81,_0x3475d1[_0x4624('0x46')]);return _0x4b42a8['getAgents'](_0x349e81);}})[_0x4624('0x24')](function(_0x3387cb){if(_0x3387cb){_0xf02962=_0x3387cb['length'];if(!_0x3475d1[_0x4624('0x3b')]['hasOwnProperty'](_0x4624('0x61'))){_0x349e81[_0x4624('0x21')]=qs[_0x4624('0x21')](_0x3475d1[_0x4624('0x3b')][_0x4624('0x21')]);_0x349e81[_0x4624('0x1e')]=qs[_0x4624('0x1e')](_0x3475d1[_0x4624('0x3b')][_0x4624('0x1e')]);}return _0x4b42a8[_0x4624('0x99')](_0x349e81);}})['then'](function(_0x14f5a7){if(_0x14f5a7){return _0x14f5a7?{'count':_0xf02962,'rows':_0x14f5a7}:null;}})[_0x4624('0x24')](respondWithResult(_0x471d98,null))[_0x4624('0x4a')](handleError(_0x471d98,null));};exports['getMembers']=function(_0x3e28a8,_0x4b636f,_0x4f1f3d){var _0x4e62b5={};var _0x50de83={};var _0x831fdc;var _0x73c630;return db[_0x4624('0x35')][_0x4624('0x5f')]({'where':{'id':_0x3e28a8['params']['id']}})[_0x4624('0x24')](handleEntityNotFound(_0x4b636f,null))['then'](function(_0x27f765){if(_0x27f765){_0x831fdc=_0x27f765;_0x50de83[_0x4624('0x3d')]=_['keys'](db[_0x4624('0x7a')][_0x4624('0x4d')]);_0x50de83['query']=_[_0x4624('0x38')](_0x3e28a8[_0x4624('0x3b')]);_0x50de83['filters']=_[_0x4624('0x3a')](_0x50de83[_0x4624('0x3d')],_0x50de83['query']);_0x4e62b5[_0x4624('0x3c')]=_[_0x4624('0x3a')](_0x50de83['model'],qs[_0x4624('0x3e')](_0x3e28a8[_0x4624('0x3b')][_0x4624('0x3e')]));_0x4e62b5['attributes']=_0x4e62b5[_0x4624('0x3c')][_0x4624('0x3f')]?_0x4e62b5[_0x4624('0x3c')]:_0x50de83[_0x4624('0x3d')];_0x4e62b5[_0x4624('0x40')]=qs[_0x4624('0x41')](_0x3e28a8[_0x4624('0x3b')][_0x4624('0x41')]);_0x4e62b5[_0x4624('0x42')]=qs[_0x4624('0x39')](_['pick'](_0x3e28a8[_0x4624('0x3b')],_0x50de83[_0x4624('0x39')]));if(_0x3e28a8[_0x4624('0x3b')][_0x4624('0x29')]){_0x4e62b5['where']=_[_0x4624('0x44')](_0x4e62b5[_0x4624('0x42')],{'$or':_[_0x4624('0x34')](_0x4e62b5[_0x4624('0x3c')],function(_0x31648b){var _0x284bba={};_0x284bba[_0x31648b]={'$like':'%'+_0x3e28a8[_0x4624('0x3b')][_0x4624('0x29')]+'%'};return _0x284bba;})});}_0x4e62b5=_['merge']({},_0x4e62b5,_0x3e28a8[_0x4624('0x46')]);return _0x831fdc[_0x4624('0x9a')](_0x4e62b5);}})[_0x4624('0x24')](function(_0x217501){if(_0x217501){_0x73c630=_0x217501[_0x4624('0x3f')];if(!_0x3e28a8[_0x4624('0x3b')][_0x4624('0x60')](_0x4624('0x61'))){_0x4e62b5[_0x4624('0x21')]=qs[_0x4624('0x21')](_0x3e28a8[_0x4624('0x3b')][_0x4624('0x21')]);_0x4e62b5[_0x4624('0x1e')]=qs[_0x4624('0x1e')](_0x3e28a8[_0x4624('0x3b')][_0x4624('0x1e')]);}return _0x831fdc[_0x4624('0x9a')](_0x4e62b5);}})[_0x4624('0x24')](function(_0x2d5892){return _0x2d5892?{'count':_0x73c630,'rows':_0x2d5892}:null;})['then'](respondWithResult(_0x4b636f,null))[_0x4624('0x4a')](handleError(_0x4b636f,null));};exports[_0x4624('0x9b')]=function(_0x248c51,_0x4371b0,_0x59f17c){var _0xa5ade4={};var _0x76c24d={};var _0x517b5d;var _0x2ece08;return db['VoiceQueue']['findOne']({'where':{'id':_0x248c51['params']['id']}})[_0x4624('0x24')](handleEntityNotFound(_0x4371b0,null))['then'](function(_0x598bcb){if(_0x598bcb){_0x517b5d=_0x598bcb;_0x76c24d[_0x4624('0x3d')]=_[_0x4624('0x38')](db['CmList'][_0x4624('0x4d')]);_0x76c24d[_0x4624('0x3b')]=_[_0x4624('0x38')](_0x248c51[_0x4624('0x3b')]);_0x76c24d[_0x4624('0x39')]=_[_0x4624('0x3a')](_0x76c24d[_0x4624('0x3d')],_0x76c24d[_0x4624('0x3b')]);_0xa5ade4[_0x4624('0x3c')]=_[_0x4624('0x3a')](_0x76c24d['model'],qs['fields'](_0x248c51[_0x4624('0x3b')][_0x4624('0x3e')]));_0xa5ade4[_0x4624('0x3c')]=_0xa5ade4[_0x4624('0x3c')]['length']?_0xa5ade4[_0x4624('0x3c')]:_0x76c24d[_0x4624('0x3d')];_0xa5ade4['order']=qs[_0x4624('0x41')](_0x248c51[_0x4624('0x3b')][_0x4624('0x41')]);_0xa5ade4[_0x4624('0x42')]=qs['filters'](_[_0x4624('0x43')](_0x248c51['query'],_0x76c24d[_0x4624('0x39')]));if(_0x248c51[_0x4624('0x3b')][_0x4624('0x29')]){_0xa5ade4['where']=_[_0x4624('0x44')](_0xa5ade4[_0x4624('0x42')],{'$or':_[_0x4624('0x34')](_0xa5ade4[_0x4624('0x3c')],function(_0x48cc6f){var _0x3a4a76={};_0x3a4a76[_0x48cc6f]={'$like':'%'+_0x248c51[_0x4624('0x3b')][_0x4624('0x29')]+'%'};return _0x3a4a76;})});}_0xa5ade4=_[_0x4624('0x44')]({},_0xa5ade4,_0x248c51[_0x4624('0x46')]);return _0x517b5d[_0x4624('0x9b')](_0xa5ade4);}})[_0x4624('0x24')](function(_0x2b4532){if(_0x2b4532){_0x2ece08=_0x2b4532[_0x4624('0x3f')];if(!_0x248c51[_0x4624('0x3b')]['hasOwnProperty'](_0x4624('0x61'))){_0xa5ade4[_0x4624('0x21')]=qs[_0x4624('0x21')](_0x248c51[_0x4624('0x3b')]['limit']);_0xa5ade4[_0x4624('0x1e')]=qs[_0x4624('0x1e')](_0x248c51['query'][_0x4624('0x1e')]);}return _0x517b5d[_0x4624('0x9b')](_0xa5ade4);}})['then'](function(_0x2047cc){if(_0x2047cc){return _0x2047cc?{'count':_0x2ece08,'rows':_0x2047cc}:null;}})[_0x4624('0x24')](respondWithResult(_0x4371b0,null))[_0x4624('0x4a')](handleError(_0x4371b0,null));};exports[_0x4624('0x9c')]=function(_0x49bed0,_0x2e8ab1,_0x131be1){var _0xe827b1,_0x176015;return db[_0x4624('0x35')]['find']({'where':{'id':_0x49bed0[_0x4624('0x4c')]['id']}})[_0x4624('0x24')](handleEntityNotFound(_0x2e8ab1,null))[_0x4624('0x24')](function(_0x5c8331){if(_0x5c8331){_0x176015=_0x5c8331;return _0x5c8331['addLists'](_0x49bed0[_0x4624('0x5c')][_0x4624('0x7f')],_[_0x4624('0x59')](_0x49bed0['body'],['ids','id'])||{});}return null;})['spread'](function(_0x20d06d){var _0x13781a;_0xe827b1=_0x20d06d||[];var _0x1f25ec=[];if(_0x20d06d){for(var _0x3495a7=0x0;_0x3495a7<_0x20d06d[_0x4624('0x3f')];_0x3495a7+=0x1){var _0x34b8ce=_0x20d06d[_0x3495a7][_0x4624('0x52')]({'plain':!![]});_0x176015[_0x4624('0x9d')]=_0x49bed0[_0x4624('0x5c')][_0x4624('0x9d')]?_0x49bed0[_0x4624('0x5c')]['dialCheckDuplicateType']:_0x176015['dialCheckDuplicateType'];switch(_0x176015[_0x4624('0x9d')]){case _0x4624('0x9e'):_0x13781a=squel[_0x4624('0x9f')]()[_0x4624('0xa0')](_0x4624('0xa1'))['fromQuery']([_0x4624('0xa2'),'scheduledAt',_0x4624('0xa3'),_0x4624('0xa4'),'VoiceQueueId',_0x4624('0x5a'),_0x4624('0x5b')],squel[_0x4624('0x81')]()[_0x4624('0x82')](_0x4624('0xa2'),_0x4624('0xa2'))[_0x4624('0x82')](_0x4624('0xa5'),_0x4624('0xa6'))[_0x4624('0x82')]('id',_0x4624('0xa3'))['field'](_0x34b8ce[_0x4624('0xa7')][_0x4624('0x8b')](),'ListId')[_0x4624('0x82')](_0x49bed0[_0x4624('0x4c')]['id'][_0x4624('0x8b')](),_0x4624('0x62'))['field']('NOW()',_0x4624('0x5a'))['field'](_0x4624('0xa5'),_0x4624('0x5b'))['from'](_0x4624('0xa8'))[_0x4624('0x42')]('deletedAt\x20IS\x20NULL')[_0x4624('0x42')](_0x4624('0xa9'),_0x34b8ce[_0x4624('0xa7')][_0x4624('0x8b')]())[_0x4624('0x42')](_0x4624('0xaa'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x4624('0x81')]()[_0x4624('0x82')]('COALESCE(calleridnum,\x27\x27)')[_0x4624('0x84')](_0x4624('0xab'))[_0x4624('0x42')]('VoiceQueueId\x20=\x20?',_0x49bed0[_0x4624('0x4c')]['id'][_0x4624('0x8b')]()))[_0x4624('0x42')](_0x4624('0xac'),squel[_0x4624('0x81')]()[_0x4624('0x82')](_0x4624('0xad'))[_0x4624('0x84')]('cm_hopper')[_0x4624('0x42')](_0x4624('0x89'),_0x49bed0[_0x4624('0x4c')]['id'][_0x4624('0x8b')]())))[_0x4624('0x8b')]();break;case _0x4624('0xae'):_0x13781a=squel[_0x4624('0x9f')]()[_0x4624('0xa0')](_0x4624('0xa1'))['fromQuery']([_0x4624('0xa2'),_0x4624('0xa6'),_0x4624('0xa3'),'ListId',_0x4624('0x62'),_0x4624('0x5a'),'updatedAt'],squel['select']()['field'](_0x4624('0xa2'),_0x4624('0xa2'))[_0x4624('0x82')]('NOW()',_0x4624('0xa6'))['field']('id',_0x4624('0xa3'))[_0x4624('0x82')](_0x34b8ce[_0x4624('0xa7')][_0x4624('0x8b')](),_0x4624('0xa4'))[_0x4624('0x82')](_0x49bed0['params']['id'][_0x4624('0x8b')](),_0x4624('0x62'))['field'](_0x4624('0xa5'),_0x4624('0x5a'))['field'](_0x4624('0xa5'),'updatedAt')['from']('cm_contacts')[_0x4624('0x42')](_0x4624('0xaf'))[_0x4624('0x42')](_0x4624('0xa9'),_0x34b8ce[_0x4624('0xa7')]['toString']())[_0x4624('0x42')]('phone\x20IS\x20NOT\x20NULL')[_0x4624('0x42')](_0x4624('0xac'),squel[_0x4624('0x81')]()[_0x4624('0x82')](_0x4624('0xad'))[_0x4624('0x84')](_0x4624('0xa1'))[_0x4624('0x42')](_0x4624('0x89'),_0x49bed0['params']['id'][_0x4624('0x8b')]())))['toString']();break;default:_0x13781a=squel[_0x4624('0x9f')]()[_0x4624('0xa0')](_0x4624('0xa1'))['fromQuery'](['phone',_0x4624('0xa6'),_0x4624('0xa3'),_0x4624('0xa4'),_0x4624('0x62'),'createdAt',_0x4624('0x5b')],squel[_0x4624('0x81')]()[_0x4624('0x82')](_0x4624('0xa2'),'phone')[_0x4624('0x82')](_0x4624('0xa5'),'scheduledAt')[_0x4624('0x82')]('id',_0x4624('0xa3'))[_0x4624('0x82')](_0x34b8ce[_0x4624('0xa7')][_0x4624('0x8b')](),_0x4624('0xa4'))[_0x4624('0x82')](_0x49bed0[_0x4624('0x4c')]['id'][_0x4624('0x8b')](),_0x4624('0x62'))[_0x4624('0x82')](_0x4624('0xa5'),_0x4624('0x5a'))['field'](_0x4624('0xa5'),_0x4624('0x5b'))[_0x4624('0x84')]('cm_contacts')[_0x4624('0x42')](_0x4624('0xaf'))['where']('ListId\x20=\x20?',_0x34b8ce[_0x4624('0xa7')][_0x4624('0x8b')]())[_0x4624('0x42')](_0x4624('0xaa')))[_0x4624('0x8b')]();}_0x1f25ec[_0x4624('0x97')](db['sequelize'][_0x4624('0x3b')](_0x13781a));}return BPromise['all'](_0x1f25ec);}})[_0x4624('0x24')](function(){return _0xe827b1;})['then'](respondWithResult(_0x2e8ab1,null))[_0x4624('0x4a')](handleError(_0x2e8ab1,null));};exports[_0x4624('0xb0')]=function(_0x2f40f0,_0x3e091f,_0x1fe50b){return db[_0x4624('0x35')][_0x4624('0x2d')]({'where':{'id':_0x2f40f0[_0x4624('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3e091f,null))[_0x4624('0x24')](function(_0x214ee6){if(_0x214ee6){return _0x214ee6[_0x4624('0xb0')](_0x2f40f0[_0x4624('0x3b')][_0x4624('0x7f')]);}})[_0x4624('0x24')](function(_0x30ac8d){if(_0x30ac8d){return db[_0x4624('0x63')][_0x4624('0x25')]({'where':{'ListId':_0x2f40f0[_0x4624('0x3b')][_0x4624('0x7f')],'VoiceQueueId':_0x2f40f0['params']['id']}})[_0x4624('0x24')](function(){return _0x30ac8d;});}})['then'](respondWithStatusCode(_0x3e091f,null))[_0x4624('0x4a')](handleError(_0x3e091f,null));};exports['getBlackLists']=function(_0x400214,_0x24136b,_0x4915e9){var _0x3a7c8b={};var _0x988cae={};var _0x82559;var _0xccabed;return db['VoiceQueue'][_0x4624('0x5f')]({'where':{'id':_0x400214['params']['id']}})[_0x4624('0x24')](handleEntityNotFound(_0x24136b,null))[_0x4624('0x24')](function(_0x56cddd){if(_0x56cddd){_0x82559=_0x56cddd;_0x988cae['model']=_[_0x4624('0x38')](db[_0x4624('0xb1')][_0x4624('0x4d')]);_0x988cae['query']=_[_0x4624('0x38')](_0x400214['query']);_0x988cae[_0x4624('0x39')]=_[_0x4624('0x3a')](_0x988cae[_0x4624('0x3d')],_0x988cae[_0x4624('0x3b')]);_0x3a7c8b['attributes']=_['intersection'](_0x988cae[_0x4624('0x3d')],qs[_0x4624('0x3e')](_0x400214[_0x4624('0x3b')]['fields']));_0x3a7c8b[_0x4624('0x3c')]=_0x3a7c8b[_0x4624('0x3c')]['length']?_0x3a7c8b[_0x4624('0x3c')]:_0x988cae[_0x4624('0x3d')];_0x3a7c8b[_0x4624('0x40')]=qs[_0x4624('0x41')](_0x400214[_0x4624('0x3b')][_0x4624('0x41')]);_0x3a7c8b[_0x4624('0x42')]=qs[_0x4624('0x39')](_['pick'](_0x400214[_0x4624('0x3b')],_0x988cae[_0x4624('0x39')]));if(_0x400214[_0x4624('0x3b')][_0x4624('0x29')]){_0x3a7c8b[_0x4624('0x42')]=_[_0x4624('0x44')](_0x3a7c8b[_0x4624('0x42')],{'$or':_[_0x4624('0x34')](_0x3a7c8b[_0x4624('0x3c')],function(_0x48a6c6){var _0x4954a9={};_0x4954a9[_0x48a6c6]={'$like':'%'+_0x400214['query'][_0x4624('0x29')]+'%'};return _0x4954a9;})});}_0x3a7c8b=_[_0x4624('0x44')]({},_0x3a7c8b,_0x400214['options']);return _0x82559['getBlackLists'](_0x3a7c8b);}})[_0x4624('0x24')](function(_0x691bc4){if(_0x691bc4){_0xccabed=_0x691bc4[_0x4624('0x3f')];if(!_0x400214['query']['hasOwnProperty'](_0x4624('0x61'))){_0x3a7c8b['limit']=qs[_0x4624('0x21')](_0x400214[_0x4624('0x3b')][_0x4624('0x21')]);_0x3a7c8b[_0x4624('0x1e')]=qs[_0x4624('0x1e')](_0x400214[_0x4624('0x3b')]['offset']);}return _0x82559['getBlackLists'](_0x3a7c8b);}})[_0x4624('0x24')](function(_0x36a857){if(_0x36a857){return _0x36a857?{'count':_0xccabed,'rows':_0x36a857}:null;}})[_0x4624('0x24')](respondWithResult(_0x24136b,null))[_0x4624('0x4a')](handleError(_0x24136b,null));};exports['addBlackLists']=function(_0x58cd91,_0x2ec6e0,_0x50a82c){var _0x1f434a,_0x290af7;return db[_0x4624('0x35')]['find']({'where':{'id':_0x58cd91[_0x4624('0x4c')]['id']}})[_0x4624('0x24')](handleEntityNotFound(_0x2ec6e0,null))[_0x4624('0x24')](function(_0x5da67b){if(_0x5da67b){_0x290af7=_0x5da67b;return _0x5da67b[_0x4624('0xb2')](_0x58cd91[_0x4624('0x5c')]['ids'],_[_0x4624('0x59')](_0x58cd91[_0x4624('0x5c')],[_0x4624('0x7f'),'id'])||{});}return null;})[_0x4624('0x95')](function(_0x4ec387){var _0x3b2611;_0x1f434a=_0x4ec387||[];var _0x407ab2=[];if(_0x4ec387){for(var _0x2e6352=0x0;_0x2e6352<_0x4ec387['length'];_0x2e6352+=0x1){var _0x5ca084=_0x4ec387[_0x2e6352][_0x4624('0x52')]({'plain':!![]});_0x3b2611=squel[_0x4624('0x9f')]()[_0x4624('0xa0')](_0x4624('0xb3'))['fromQuery']([_0x4624('0xa2'),_0x4624('0xa3'),'ListId',_0x4624('0x62'),'createdAt','updatedAt'],squel[_0x4624('0x81')]()[_0x4624('0x82')]('phone',_0x4624('0xa2'))[_0x4624('0x82')]('id',_0x4624('0xa3'))[_0x4624('0x82')](_0x5ca084['CmListId'][_0x4624('0x8b')](),_0x4624('0xa4'))[_0x4624('0x82')](_0x58cd91['params']['id'][_0x4624('0x8b')](),_0x4624('0x62'))[_0x4624('0x82')](_0x4624('0xa5'),_0x4624('0x5a'))[_0x4624('0x82')](_0x4624('0xa5'),_0x4624('0x5b'))[_0x4624('0x84')](_0x4624('0xa8'))[_0x4624('0x42')](_0x4624('0xaf'))[_0x4624('0x42')](_0x4624('0xa9'),_0x5ca084['CmListId'][_0x4624('0x8b')]())[_0x4624('0x42')](_0x4624('0xaa')))[_0x4624('0x8b')]();_0x407ab2[_0x4624('0x97')](db[_0x4624('0x74')]['query'](_0x3b2611));}return BPromise[_0x4624('0x90')](_0x407ab2);}})[_0x4624('0x24')](function(){return _0x1f434a;})[_0x4624('0x24')](respondWithResult(_0x2ec6e0,null))[_0x4624('0x4a')](handleError(_0x2ec6e0,null));};exports[_0x4624('0xb4')]=function(_0x4f4e0b,_0x11a2e0,_0x192c73){return db[_0x4624('0x35')][_0x4624('0x2d')]({'where':{'id':_0x4f4e0b[_0x4624('0x4c')]['id']}})[_0x4624('0x24')](handleEntityNotFound(_0x11a2e0,null))[_0x4624('0x24')](function(_0x2588e8){if(_0x2588e8){return _0x2588e8[_0x4624('0xb4')](_0x4f4e0b[_0x4624('0x3b')][_0x4624('0x7f')]);}})[_0x4624('0x24')](function(_0x593aaa){if(_0x593aaa){return db['CmHopperBlack'][_0x4624('0x25')]({'where':{'ListId':_0x4f4e0b[_0x4624('0x3b')][_0x4624('0x7f')],'VoiceQueueId':_0x4f4e0b[_0x4624('0x4c')]['id']}})[_0x4624('0x24')](function(){return _0x593aaa;});}})['then'](respondWithStatusCode(_0x11a2e0,null))['catch'](handleError(_0x11a2e0,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 09b846c..c4a20dc 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 _0x0583=['hook','exports','events','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x1245c1,_0x4d0f6e){var _0x140053=function(_0x246a8e){while(--_0x246a8e){_0x1245c1['push'](_0x1245c1['shift']());}};_0x140053(++_0x4d0f6e);}(_0x0583,0xd1));var _0x3058=function(_0x56c40f,_0x43d0b3){_0x56c40f=_0x56c40f-0x0;var _0x15f00c=_0x0583[_0x56c40f];return _0x15f00c;};'use strict';var EventEmitter=require(_0x3058('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x3058('0x1')](0x0);var events={'afterCreate':_0x3058('0x2'),'afterUpdate':_0x3058('0x3'),'afterDestroy':_0x3058('0x4')};function emitEvent(_0x5d360f){return function(_0x1ee5c1,_0x382cce,_0xcef51d){VoiceQueueEvents[_0x3058('0x5')](_0x5d360f+':'+_0x1ee5c1['id'],_0x1ee5c1);VoiceQueueEvents['emit'](_0x5d360f,_0x1ee5c1);_0xcef51d(null);};}for(var e in events){if(events[_0x3058('0x6')](e)){var event=events[e];VoiceQueue[_0x3058('0x7')](e,emitEvent(event));}}module[_0x3058('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x9862=['update','emit','hook','exports','events','setMaxListeners'];(function(_0x1460f6,_0x59051a){var _0x46ce94=function(_0x1c3ddf){while(--_0x1c3ddf){_0x1460f6['push'](_0x1460f6['shift']());}};_0x46ce94(++_0x59051a);}(_0x9862,0x1c0));var _0x2986=function(_0x5441c8,_0x3c7f77){_0x5441c8=_0x5441c8-0x0;var _0x159a87=_0x9862[_0x5441c8];return _0x159a87;};'use strict';var EventEmitter=require(_0x2986('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x2986('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2986('0x2'),'afterDestroy':'remove'};function emitEvent(_0xd1e3ef){return function(_0x438325,_0x47df73,_0x20054f){VoiceQueueEvents['emit'](_0xd1e3ef+':'+_0x438325['id'],_0x438325);VoiceQueueEvents[_0x2986('0x3')](_0xd1e3ef,_0x438325);_0x20054f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x2986('0x4')](e,emitEvent(event));}}module[_0x2986('0x5')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 0c2ed1c..ba14cca 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 _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x5e0ed9,_0x35194e){var _0x234c6a=function(_0x54f893){while(--_0x54f893){_0x5e0ed9['push'](_0x5e0ed9['shift']());}};_0x234c6a(++_0x35194e);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'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 _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x211f68,_0x47a58a){var _0x13604e=function(_0x23a402){while(--_0x23a402){_0x211f68['push'](_0x211f68['shift']());}};_0x13604e(++_0x47a58a);}(_0x008c,0x188));var _0xc008=function(_0x154f21,_0x3c7f37){_0x154f21=_0x154f21-0x0;var _0x5ae16f=_0x008c[_0x154f21];return _0x5ae16f;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index ecd63b2..f3d27a6 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 _0x14b0=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceQueue','ShowVoiceQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x17a647,_0x2bbe12){var _0x219a38=function(_0x131c5d){while(--_0x131c5d){_0x17a647['push'](_0x17a647['shift']());}};_0x219a38(++_0x2bbe12);}(_0x14b0,0x1f0));var _0x014b=function(_0x5e8a26,_0x2c6e29){_0x5e8a26=_0x5e8a26-0x0;var _0xd3c65f=_0x14b0[_0x5e8a26];return _0xd3c65f;};'use strict';var _=require(_0x014b('0x0'));var util=require(_0x014b('0x1'));var moment=require(_0x014b('0x2'));var BPromise=require(_0x014b('0x3'));var rs=require(_0x014b('0x4'));var fs=require('fs');var Redis=require(_0x014b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x014b('0x6'))(_0x014b('0x7'));var config=require(_0x014b('0x8'));var jayson=require(_0x014b('0x9'));var client=jayson[_0x014b('0xa')][_0x014b('0xb')]({'port':0x232a});config[_0x014b('0xc')]=_[_0x014b('0xd')](config[_0x014b('0xc')],{'host':_0x014b('0xe'),'port':0x18eb});var socket=require(_0x014b('0xf'))(new Redis(config[_0x014b('0xc')]));require(_0x014b('0x10'))['register'](socket);function respondWithRpcPromise(_0x1e7c5e,_0x5d0491,_0x474f92){return new BPromise(function(_0x42517a,_0x5b4c08){return client[_0x014b('0x11')](_0x1e7c5e,_0x474f92)[_0x014b('0x12')](function(_0x3a33e4){logger[_0x014b('0x13')](_0x014b('0x14'),_0x5d0491,_0x014b('0x15'));logger[_0x014b('0x16')](_0x014b('0x17'),_0x5d0491,_0x014b('0x15'),JSON[_0x014b('0x18')](_0x3a33e4));if(_0x3a33e4[_0x014b('0x19')]){if(_0x3a33e4[_0x014b('0x19')][_0x014b('0x1a')]===0x1f4){logger[_0x014b('0x19')](_0x014b('0x14'),_0x5d0491,_0x3a33e4['error'][_0x014b('0x1b')]);return _0x5b4c08(_0x3a33e4[_0x014b('0x19')][_0x014b('0x1b')]);}logger[_0x014b('0x19')](_0x014b('0x14'),_0x5d0491,_0x3a33e4[_0x014b('0x19')][_0x014b('0x1b')]);return _0x42517a(_0x3a33e4[_0x014b('0x19')][_0x014b('0x1b')]);}else{logger['info'](_0x014b('0x14'),_0x5d0491,_0x014b('0x15'));_0x42517a(_0x3a33e4[_0x014b('0x1c')]['message']);}})[_0x014b('0x1d')](function(_0x249414){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x5d0491,_0x249414);_0x5b4c08(_0x249414);});});}exports['GetVoiceQueue']=function(_0x184730){var _0x46c4bc=this;return new Promise(function(_0x1a4f76,_0x49edbf){return db['VoiceQueue'][_0x014b('0x1e')]({'raw':_0x184730[_0x014b('0x1f')]?_0x184730[_0x014b('0x1f')][_0x014b('0x20')]===undefined?!![]:![]:!![],'where':_0x184730[_0x014b('0x1f')]?_0x184730[_0x014b('0x1f')][_0x014b('0x21')]||null:null,'attributes':_0x184730['options']?_0x184730[_0x014b('0x1f')][_0x014b('0x22')]||null:null,'limit':_0x184730[_0x014b('0x1f')]?_0x184730[_0x014b('0x1f')][_0x014b('0x23')]||null:null,'include':_0x184730['options']?_0x184730['options'][_0x014b('0x24')]?_[_0x014b('0x25')](_0x184730['options'][_0x014b('0x24')],function(_0x58d07e){return{'model':db[_0x58d07e['model']],'as':_0x58d07e['as'],'attributes':_0x58d07e[_0x014b('0x22')],'include':_0x58d07e[_0x014b('0x24')]?_[_0x014b('0x25')](_0x58d07e[_0x014b('0x24')],function(_0x34afaf){return{'model':db[_0x34afaf[_0x014b('0x26')]],'as':_0x34afaf['as'],'attributes':_0x34afaf[_0x014b('0x22')],'include':_0x34afaf[_0x014b('0x24')]?_[_0x014b('0x25')](_0x34afaf[_0x014b('0x24')],function(_0xe3c810){return{'model':db[_0xe3c810['model']],'as':_0xe3c810['as'],'attributes':_0xe3c810['attributes']};}):[]};}):[]};}):[]:[]})[_0x014b('0x12')](function(_0x4eee3b){logger['info'](_0x014b('0x27'),_0x184730);logger[_0x014b('0x16')](_0x014b('0x27'),_0x184730,JSON['stringify'](_0x4eee3b));_0x1a4f76(_0x4eee3b);})[_0x014b('0x1d')](function(_0x5c511f){logger[_0x014b('0x19')](_0x014b('0x27'),_0x5c511f['message'],_0x184730);_0x49edbf(_0x46c4bc[_0x014b('0x19')](0x1f4,_0x5c511f['message']));});});};exports[_0x014b('0x28')]=function(_0x58050c){var _0x2ea3b6=this;return new Promise(function(_0x3058b3,_0x3723c4){return db['VoiceQueue'][_0x014b('0x29')]({'raw':_0x58050c[_0x014b('0x1f')]?_0x58050c[_0x014b('0x1f')][_0x014b('0x20')]===undefined?!![]:![]:!![],'where':_0x58050c[_0x014b('0x1f')]?_0x58050c['options']['where']||null:null,'attributes':_0x58050c[_0x014b('0x1f')]?_0x58050c[_0x014b('0x1f')][_0x014b('0x22')]||null:null,'include':_0x58050c[_0x014b('0x1f')]?_0x58050c['options'][_0x014b('0x24')]?_[_0x014b('0x25')](_0x58050c[_0x014b('0x1f')][_0x014b('0x24')],function(_0x35e753){return{'model':db[_0x35e753[_0x014b('0x26')]],'as':_0x35e753['as'],'attributes':_0x35e753['attributes'],'include':_0x35e753[_0x014b('0x24')]?_[_0x014b('0x25')](_0x35e753[_0x014b('0x24')],function(_0x5acf32){return{'model':db[_0x5acf32[_0x014b('0x26')]],'as':_0x5acf32['as'],'attributes':_0x5acf32[_0x014b('0x22')],'include':_0x5acf32[_0x014b('0x24')]?_[_0x014b('0x25')](_0x5acf32[_0x014b('0x24')],function(_0x48bab6){return{'model':db[_0x48bab6[_0x014b('0x26')]],'as':_0x48bab6['as'],'attributes':_0x48bab6[_0x014b('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49ed95){logger[_0x014b('0x13')](_0x014b('0x28'),_0x58050c);logger['debug']('ShowVoiceQueue',_0x58050c,JSON[_0x014b('0x18')](_0x49ed95));_0x3058b3(_0x49ed95);})[_0x014b('0x1d')](function(_0xb9c32d){logger[_0x014b('0x19')](_0x014b('0x28'),_0xb9c32d[_0x014b('0x1b')],_0x58050c);_0x3723c4(_0x2ea3b6[_0x014b('0x19')](0x1f4,_0xb9c32d['message']));});});}; \ No newline at end of file +var _0xc978=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowVoiceQueue','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xfa649,_0x5099bb){var _0xd30744=function(_0x5916c1){while(--_0x5916c1){_0xfa649['push'](_0xfa649['shift']());}};_0xd30744(++_0x5099bb);}(_0xc978,0x174));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x8c97('0x0'));var moment=require('moment');var BPromise=require(_0x8c97('0x1'));var rs=require(_0x8c97('0x2'));var fs=require('fs');var Redis=require(_0x8c97('0x3'));var db=require(_0x8c97('0x4'))['db'];var utils=require(_0x8c97('0x5'));var logger=require(_0x8c97('0x6'))(_0x8c97('0x7'));var config=require(_0x8c97('0x8'));var jayson=require(_0x8c97('0x9'));var client=jayson[_0x8c97('0xa')][_0x8c97('0xb')]({'port':0x232a});config[_0x8c97('0xc')]=_['defaults'](config[_0x8c97('0xc')],{'host':_0x8c97('0xd'),'port':0x18eb});var socket=require(_0x8c97('0xe'))(new Redis(config[_0x8c97('0xc')]));require(_0x8c97('0xf'))[_0x8c97('0x10')](socket);function respondWithRpcPromise(_0x1fb391,_0x3873e4,_0x189732){return new BPromise(function(_0x437865,_0x5c39fc){return client[_0x8c97('0x11')](_0x1fb391,_0x189732)[_0x8c97('0x12')](function(_0x304fdc){logger['info'](_0x8c97('0x13'),_0x3873e4,_0x8c97('0x14'));logger[_0x8c97('0x15')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x3873e4,_0x8c97('0x14'),JSON[_0x8c97('0x16')](_0x304fdc));if(_0x304fdc[_0x8c97('0x17')]){if(_0x304fdc[_0x8c97('0x17')][_0x8c97('0x18')]===0x1f4){logger[_0x8c97('0x17')](_0x8c97('0x13'),_0x3873e4,_0x304fdc[_0x8c97('0x17')]['message']);return _0x5c39fc(_0x304fdc[_0x8c97('0x17')][_0x8c97('0x19')]);}logger[_0x8c97('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x3873e4,_0x304fdc['error'][_0x8c97('0x19')]);return _0x437865(_0x304fdc[_0x8c97('0x17')]['message']);}else{logger[_0x8c97('0x1a')](_0x8c97('0x13'),_0x3873e4,_0x8c97('0x14'));_0x437865(_0x304fdc[_0x8c97('0x1b')][_0x8c97('0x19')]);}})[_0x8c97('0x1c')](function(_0x6cf919){logger[_0x8c97('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x3873e4,_0x6cf919);_0x5c39fc(_0x6cf919);});});}exports[_0x8c97('0x1d')]=function(_0x30e7e2){var _0x38772d=this;return new Promise(function(_0xc9ac01,_0x1978b9){return db[_0x8c97('0x1e')][_0x8c97('0x1f')]({'raw':_0x30e7e2['options']?_0x30e7e2[_0x8c97('0x20')][_0x8c97('0x21')]===undefined?!![]:![]:!![],'where':_0x30e7e2['options']?_0x30e7e2[_0x8c97('0x20')][_0x8c97('0x22')]||null:null,'attributes':_0x30e7e2[_0x8c97('0x20')]?_0x30e7e2[_0x8c97('0x20')][_0x8c97('0x23')]||null:null,'limit':_0x30e7e2[_0x8c97('0x20')]?_0x30e7e2[_0x8c97('0x20')][_0x8c97('0x24')]||null:null,'include':_0x30e7e2[_0x8c97('0x20')]?_0x30e7e2['options'][_0x8c97('0x25')]?_[_0x8c97('0x26')](_0x30e7e2['options']['include'],function(_0x390632){return{'model':db[_0x390632[_0x8c97('0x27')]],'as':_0x390632['as'],'attributes':_0x390632[_0x8c97('0x23')],'include':_0x390632[_0x8c97('0x25')]?_[_0x8c97('0x26')](_0x390632['include'],function(_0x153ec0){return{'model':db[_0x153ec0[_0x8c97('0x27')]],'as':_0x153ec0['as'],'attributes':_0x153ec0[_0x8c97('0x23')],'include':_0x153ec0['include']?_[_0x8c97('0x26')](_0x153ec0[_0x8c97('0x25')],function(_0x1bfebe){return{'model':db[_0x1bfebe[_0x8c97('0x27')]],'as':_0x1bfebe['as'],'attributes':_0x1bfebe[_0x8c97('0x23')]};}):[]};}):[]};}):[]:[]})[_0x8c97('0x12')](function(_0x3eff96){logger[_0x8c97('0x1a')](_0x8c97('0x1d'),_0x30e7e2);logger[_0x8c97('0x15')]('GetVoiceQueue',_0x30e7e2,JSON[_0x8c97('0x16')](_0x3eff96));_0xc9ac01(_0x3eff96);})[_0x8c97('0x1c')](function(_0xd3af6a){logger[_0x8c97('0x17')]('GetVoiceQueue',_0xd3af6a[_0x8c97('0x19')],_0x30e7e2);_0x1978b9(_0x38772d[_0x8c97('0x17')](0x1f4,_0xd3af6a[_0x8c97('0x19')]));});});};exports[_0x8c97('0x28')]=function(_0x2cb430){var _0xe35eba=this;return new Promise(function(_0x40d9ec,_0x2e22e1){return db['VoiceQueue'][_0x8c97('0x29')]({'raw':_0x2cb430[_0x8c97('0x20')]?_0x2cb430['options'][_0x8c97('0x21')]===undefined?!![]:![]:!![],'where':_0x2cb430['options']?_0x2cb430[_0x8c97('0x20')]['where']||null:null,'attributes':_0x2cb430[_0x8c97('0x20')]?_0x2cb430['options'][_0x8c97('0x23')]||null:null,'include':_0x2cb430['options']?_0x2cb430['options']['include']?_[_0x8c97('0x26')](_0x2cb430[_0x8c97('0x20')]['include'],function(_0x500dba){return{'model':db[_0x500dba['model']],'as':_0x500dba['as'],'attributes':_0x500dba[_0x8c97('0x23')],'include':_0x500dba[_0x8c97('0x25')]?_[_0x8c97('0x26')](_0x500dba['include'],function(_0x49bdf1){return{'model':db[_0x49bdf1[_0x8c97('0x27')]],'as':_0x49bdf1['as'],'attributes':_0x49bdf1['attributes'],'include':_0x49bdf1[_0x8c97('0x25')]?_[_0x8c97('0x26')](_0x49bdf1['include'],function(_0xc47828){return{'model':db[_0xc47828[_0x8c97('0x27')]],'as':_0xc47828['as'],'attributes':_0xc47828[_0x8c97('0x23')]};}):[]};}):[]};}):[]:[]})[_0x8c97('0x12')](function(_0x132212){logger['info']('ShowVoiceQueue',_0x2cb430);logger[_0x8c97('0x15')](_0x8c97('0x28'),_0x2cb430,JSON[_0x8c97('0x16')](_0x132212));_0x40d9ec(_0x132212);})['catch'](function(_0x363870){logger['error'](_0x8c97('0x28'),_0x363870[_0x8c97('0x19')],_0x2cb430);_0x2e22e1(_0xe35eba[_0x8c97('0x17')](0x1f4,_0x363870[_0x8c97('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 4d98633..d260b6a 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 _0xa061=['length','./voiceQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0xa061,0x109));var _0x1a06=function(_0x18e3e7,_0x39886c){_0x18e3e7=_0x18e3e7-0x0;var _0x211dee=_0xa061[_0x18e3e7];return _0x211dee;};'use strict';var VoiceQueueEvents=require(_0x1a06('0x0'));var events=[_0x1a06('0x1'),_0x1a06('0x2'),_0x1a06('0x3')];function createListener(_0x29ac04,_0x3a696c){return function(_0x538839){_0x3a696c[_0x1a06('0x4')](_0x29ac04,_0x538839);};}function removeListener(_0x411b28,_0x519947){return function(){VoiceQueueEvents[_0x1a06('0x5')](_0x411b28,_0x519947);};}exports[_0x1a06('0x6')]=function(_0x5957ef){for(var _0x3e90dc=0x0,_0x197918=events[_0x1a06('0x7')];_0x3e90dc<_0x197918;_0x3e90dc++){var _0x558f03=events[_0x3e90dc];var _0x21c837=createListener('voiceQueue:'+_0x558f03,_0x5957ef);VoiceQueueEvents['on'](_0x558f03,_0x21c837);}}; \ No newline at end of file +var _0xcd40=['length','./voiceQueue.events','remove','update','removeListener'];(function(_0x1eaf0c,_0x32a465){var _0x5baca8=function(_0x289c13){while(--_0x289c13){_0x1eaf0c['push'](_0x1eaf0c['shift']());}};_0x5baca8(++_0x32a465);}(_0xcd40,0x79));var _0x0cd4=function(_0x2631cb,_0x4f5593){_0x2631cb=_0x2631cb-0x0;var _0x13fad3=_0xcd40[_0x2631cb];return _0x13fad3;};'use strict';var VoiceQueueEvents=require(_0x0cd4('0x0'));var events=['save',_0x0cd4('0x1'),_0x0cd4('0x2')];function createListener(_0x455688,_0x102287){return function(_0x533d34){_0x102287['emit'](_0x455688,_0x533d34);};}function removeListener(_0x321cee,_0x56d101){return function(){VoiceQueueEvents[_0x0cd4('0x3')](_0x321cee,_0x56d101);};}exports['register']=function(_0x3b39c7){for(var _0x2ab148=0x0,_0x49f3f7=events[_0x0cd4('0x4')];_0x2ab148<_0x49f3f7;_0x2ab148++){var _0x23f41=events[_0x2ab148];var _0x5aca49=createListener('voiceQueue:'+_0x23f41,_0x3b39c7);VoiceQueueEvents['on'](_0x23f41,_0x5aca49);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 8526fcd..19ad515 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 _0x3fec=['../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x4467c0,_0x2e2083){var _0x2daed6=function(_0x1fab87){while(--_0x1fab87){_0x4467c0['push'](_0x4467c0['shift']());}};_0x2daed6(++_0x2e2083);}(_0x3fec,0x9b));var _0xc3fe=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3fec[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xc3fe('0x0'));var util=require(_0xc3fe('0x1'));var path=require(_0xc3fe('0x2'));var timeout=require(_0xc3fe('0x3'));var express=require('express');var router=express[_0xc3fe('0x4')]();var fs_extra=require(_0xc3fe('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc3fe('0x6'));var config=require(_0xc3fe('0x7'));var controller=require(_0xc3fe('0x8'));router[_0xc3fe('0x9')]('/',auth[_0xc3fe('0xa')](),controller[_0xc3fe('0xb')]);router[_0xc3fe('0x9')](_0xc3fe('0xc'),auth[_0xc3fe('0xa')](),controller[_0xc3fe('0xd')]);router[_0xc3fe('0x9')](_0xc3fe('0xe'),auth[_0xc3fe('0xa')](),controller[_0xc3fe('0xf')]);router['get'](_0xc3fe('0x10'),auth[_0xc3fe('0xa')](),controller[_0xc3fe('0x11')]);router[_0xc3fe('0x12')]('/',auth[_0xc3fe('0xa')](),controller['create']);router[_0xc3fe('0x13')](_0xc3fe('0x10'),auth[_0xc3fe('0xa')](),controller['update']);router[_0xc3fe('0x14')](_0xc3fe('0x10'),auth[_0xc3fe('0xa')](),controller[_0xc3fe('0x15')]);module[_0xc3fe('0x16')]=router; \ No newline at end of file +var _0xe385=['put','update','delete','destroy','exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','create'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xe385,0x1eb));var _0x5e38=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe385[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5e38('0x0'));var timeout=require('connect-timeout');var express=require(_0x5e38('0x1'));var router=express['Router']();var fs_extra=require(_0x5e38('0x2'));var auth=require(_0x5e38('0x3'));var interaction=require(_0x5e38('0x4'));var config=require(_0x5e38('0x5'));var controller=require('./voiceQueueReport.controller');router[_0x5e38('0x6')]('/',auth[_0x5e38('0x7')](),controller['index']);router[_0x5e38('0x6')]('/describe',auth[_0x5e38('0x7')](),controller[_0x5e38('0x8')]);router[_0x5e38('0x6')](_0x5e38('0x9'),auth[_0x5e38('0x7')](),controller[_0x5e38('0xa')]);router['get'](_0x5e38('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x5e38('0x7')](),controller[_0x5e38('0xc')]);router[_0x5e38('0xd')]('/:id',auth[_0x5e38('0x7')](),controller[_0x5e38('0xe')]);router[_0x5e38('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5e38('0x10')]);module[_0x5e38('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 2b670e9..7ace1c9 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 _0xc389=['format','diff','seconds','holdtime','INTEGER','BOOLEAN','sequelize','exports','STRING','DATE','queuecallerjoinAt'];(function(_0x5615b3,_0xde0ca5){var _0x31ce3f=function(_0x574c89){while(--_0x574c89){_0x5615b3['push'](_0x5615b3['shift']());}};_0x31ce3f(++_0xde0ca5);}(_0xc389,0x19d));var _0x9c38=function(_0x3706ff,_0x26a2d2){_0x3706ff=_0x3706ff-0x0;var _0x508724=_0xc389[_0x3706ff];return _0x508724;};'use strict';var Sequelize=require(_0x9c38('0x0'));var moment=require('moment');module[_0x9c38('0x1')]={'type':{'type':Sequelize[_0x9c38('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x9c38('0x2')]},'calleridname':{'type':Sequelize[_0x9c38('0x2')]},'queue':{'type':Sequelize[_0x9c38('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x9c38('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x9c38('0x3')],'set':function(_0xf00856){var _0x15ce30=moment(_0xf00856);var _0x1aa264=moment(this['getDataValue'](_0x9c38('0x4')))[_0x9c38('0x5')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3719cb=_0x15ce30[_0x9c38('0x6')](_0x1aa264,_0x9c38('0x7'));this['setDataValue']('queuecallerleaveAt',_0xf00856);this['setDataValue'](_0x9c38('0x8'),_0x3719cb||null);}},'position':{'type':Sequelize[_0x9c38('0x9')]},'count':{'type':Sequelize[_0x9c38('0x9')]},'queuecallerabandon':{'type':Sequelize[_0x9c38('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x9c38('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x9c38('0x3')]},'queuecallerexit':{'type':Sequelize[_0x9c38('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x9c38('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x9c38('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x9c38('0x9')]},'channel':{'type':Sequelize[_0x9c38('0x2')]},'connectedlinenum':{'type':Sequelize[_0x9c38('0x2')]},'connectedlinename':{'type':Sequelize[_0x9c38('0x2')]},'accountcode':{'type':Sequelize[_0x9c38('0x2')]},'context':{'type':Sequelize[_0x9c38('0x2')]},'exten':{'type':Sequelize[_0x9c38('0x2')]},'priority':{'type':Sequelize[_0x9c38('0x2')]},'holdtime':{'type':Sequelize[_0x9c38('0x9')]},'mohtime':{'type':Sequelize[_0x9c38('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9c38('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x9c38('0x2')]},'transfer':{'type':Sequelize[_0x9c38('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9c38('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x9c38('0x2')]},'transferuniqueid':{'type':Sequelize[_0x9c38('0x2')]},'disposition':{'type':Sequelize[_0x9c38('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x9c38('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8ec4=['holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt'];(function(_0x41741f,_0x37d4ee){var _0x4a0157=function(_0x1228fc){while(--_0x1228fc){_0x41741f['push'](_0x41741f['shift']());}};_0x4a0157(++_0x37d4ee);}(_0x8ec4,0x18b));var _0x48ec=function(_0x5ecf83,_0x35f63e){_0x5ecf83=_0x5ecf83-0x0;var _0x271de2=_0x8ec4[_0x5ecf83];return _0x271de2;};'use strict';var Sequelize=require(_0x48ec('0x0'));var moment=require(_0x48ec('0x1'));module[_0x48ec('0x2')]={'type':{'type':Sequelize[_0x48ec('0x3')]},'uniqueid':{'type':Sequelize[_0x48ec('0x3')]},'calleridnum':{'type':Sequelize[_0x48ec('0x3')]},'calleridname':{'type':Sequelize[_0x48ec('0x3')]},'queue':{'type':Sequelize[_0x48ec('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x48ec('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x1b01dd){var _0x4f4ebb=moment(_0x1b01dd);var _0xb70770=moment(this[_0x48ec('0x5')](_0x48ec('0x6')))[_0x48ec('0x7')](_0x48ec('0x8'));var _0x307b78=_0x4f4ebb[_0x48ec('0x9')](_0xb70770,_0x48ec('0xa'));this[_0x48ec('0xb')](_0x48ec('0xc'),_0x1b01dd);this[_0x48ec('0xb')](_0x48ec('0xd'),_0x307b78||null);}},'position':{'type':Sequelize[_0x48ec('0xe')]},'count':{'type':Sequelize[_0x48ec('0xe')]},'queuecallerabandon':{'type':Sequelize[_0x48ec('0xf')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x48ec('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x48ec('0xf')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x48ec('0x4')]},'queuecallerexit':{'type':Sequelize[_0x48ec('0xf')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x48ec('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x48ec('0x3')],'comment':_0x48ec('0x10')},'originalposition':{'type':Sequelize[_0x48ec('0xe')]},'channel':{'type':Sequelize[_0x48ec('0x3')]},'connectedlinenum':{'type':Sequelize[_0x48ec('0x3')]},'connectedlinename':{'type':Sequelize[_0x48ec('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x48ec('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x48ec('0x3')]},'holdtime':{'type':Sequelize[_0x48ec('0xe')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x48ec('0x3')]},'transfer':{'type':Sequelize[_0x48ec('0xf')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x48ec('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x48ec('0x3')]},'transferuniqueid':{'type':Sequelize[_0x48ec('0x3')]},'disposition':{'type':Sequelize[_0x48ec('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x48ec('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'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 ebd1b4b..31eb393 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 _0x0471=['undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','map','VoiceQueueReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','describe','getVoiceQueuesReport','sort','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','status','end','json','offset'];(function(_0x310a1b,_0x4c9129){var _0xdea206=function(_0x1f1e8d){while(--_0x1f1e8d){_0x310a1b['push'](_0x310a1b['shift']());}};_0xdea206(++_0x4c9129);}(_0x0471,0x85));var _0x1047=function(_0x213365,_0x45f299){_0x213365=_0x213365-0x0;var _0x1b0453=_0x0471[_0x213365];return _0x1b0453;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1047('0x0'));var zipdir=require(_0x1047('0x1'));var jsonpatch=require(_0x1047('0x2'));var rp=require(_0x1047('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1047('0x4'));var util=require(_0x1047('0x5'));var path=require(_0x1047('0x6'));var sox=require(_0x1047('0x7'));var csv=require(_0x1047('0x8'));var ejs=require(_0x1047('0x9'));var fs=require('fs');var fs_extra=require(_0x1047('0xa'));var _=require(_0x1047('0xb'));var squel=require(_0x1047('0xc'));var crypto=require(_0x1047('0xd'));var jsforce=require(_0x1047('0xe'));var deskjs=require(_0x1047('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1047('0x10'));var Papa=require(_0x1047('0x11'));var Redis=require(_0x1047('0x12'));var authService=require(_0x1047('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1047('0x14'));var logger=require(_0x1047('0x15'))(_0x1047('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1047('0x17'));var db=require(_0x1047('0x18'))['db'];config[_0x1047('0x19')]=_['defaults'](config[_0x1047('0x19')],{'host':_0x1047('0x1a'),'port':0x18eb});var socket=require(_0x1047('0x1b'))(new Redis(config['redis']));require(_0x1047('0x1c'))['register'](socket);function respondWithStatusCode(_0x3da9d9,_0x1c1c30){_0x1c1c30=_0x1c1c30||0xcc;return function(_0x29a31d){if(_0x29a31d){return _0x3da9d9['sendStatus'](_0x1c1c30);}return _0x3da9d9[_0x1047('0x1d')](_0x1c1c30)[_0x1047('0x1e')]();};}function respondWithResult(_0x498575,_0x5544df){_0x5544df=_0x5544df||0xc8;return function(_0x2cf7c8){if(_0x2cf7c8){return _0x498575[_0x1047('0x1d')](_0x5544df)[_0x1047('0x1f')](_0x2cf7c8);}};}function respondWithFilteredResult(_0xd3094b,_0x506ddf){return function(_0x1c90f9){if(_0x1c90f9){var _0x39f388=typeof _0x506ddf[_0x1047('0x20')]===_0x1047('0x21')&&typeof _0x506ddf[_0x1047('0x22')]===_0x1047('0x21');var _0x323ecb=_0x1c90f9[_0x1047('0x23')];var _0x500489=_0x39f388?0x0:_0x506ddf[_0x1047('0x20')];var _0x4a719c=_0x39f388?_0x1c90f9[_0x1047('0x23')]:_0x506ddf['offset']+_0x506ddf[_0x1047('0x22')];var _0x279c03;if(_0x4a719c>=_0x323ecb){_0x4a719c=_0x323ecb;_0x279c03=0xc8;}else{_0x279c03=0xce;}_0xd3094b[_0x1047('0x1d')](_0x279c03);return _0xd3094b[_0x1047('0x24')](_0x1047('0x25'),_0x500489+'-'+_0x4a719c+'/'+_0x323ecb)[_0x1047('0x1f')](_0x1c90f9);}return null;};}function patchUpdates(_0x19a9f9){return function(_0x2ea17c){try{jsonpatch[_0x1047('0x26')](_0x2ea17c,_0x19a9f9,!![]);}catch(_0x35b4bd){return BPromise[_0x1047('0x27')](_0x35b4bd);}return _0x2ea17c[_0x1047('0x28')]();};}function saveUpdates(_0xcaa8c1,_0x1f00b2){return function(_0x29ce8e){if(_0x29ce8e){return _0x29ce8e['update'](_0xcaa8c1)['then'](function(_0x3f4ff9){return _0x3f4ff9;});}return null;};}function removeEntity(_0x19eae1,_0x191286){return function(_0x163768){if(_0x163768){return _0x163768[_0x1047('0x29')]()[_0x1047('0x2a')](function(){_0x19eae1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c0a42,_0x3c70b9){return function(_0x521f23){if(!_0x521f23){_0x5c0a42['sendStatus'](0x194);}return _0x521f23;};}function handleError(_0x1dd3c4,_0x4f42c1){_0x4f42c1=_0x4f42c1||0x1f4;return function(_0x9afff3){logger['error'](_0x9afff3[_0x1047('0x2b')]);if(_0x9afff3[_0x1047('0x2c')]){delete _0x9afff3[_0x1047('0x2c')];}_0x1dd3c4[_0x1047('0x1d')](_0x4f42c1)[_0x1047('0x2d')](_0x9afff3);};}exports['index']=function(_0x5635a7,_0x14ec5e){var _0x5eda39={},_0x2738a9={},_0x465bcf={'count':0x0,'rows':[]};var _0x410e77=_[_0x1047('0x2e')](db[_0x1047('0x2f')][_0x1047('0x30')],function(_0x1b8e50){return{'name':_0x1b8e50[_0x1047('0x31')],'type':_0x1b8e50['type'][_0x1047('0x32')]};});_0x2738a9['model']=_['map'](_0x410e77,_0x1047('0x2c'));_0x2738a9[_0x1047('0x33')]=_[_0x1047('0x34')](_0x5635a7[_0x1047('0x33')]);_0x2738a9[_0x1047('0x35')]=_[_0x1047('0x36')](_0x2738a9[_0x1047('0x37')],_0x2738a9[_0x1047('0x33')]);_0x5eda39['attributes']=_['intersection'](_0x2738a9[_0x1047('0x37')],qs[_0x1047('0x38')](_0x5635a7['query'][_0x1047('0x38')]));_0x5eda39[_0x1047('0x39')]=_0x5eda39[_0x1047('0x39')][_0x1047('0x3a')]?_0x5eda39[_0x1047('0x39')]:_0x2738a9['model'];if(!_0x5635a7[_0x1047('0x33')][_0x1047('0x3b')](_0x1047('0x3c'))){_0x5eda39[_0x1047('0x22')]=qs[_0x1047('0x22')](_0x5635a7['query'][_0x1047('0x22')]);_0x5eda39[_0x1047('0x20')]=qs[_0x1047('0x20')](_0x5635a7['query']['offset']);}_0x5eda39[_0x1047('0x3d')]=qs['sort'](_0x5635a7[_0x1047('0x33')]['sort']);_0x5eda39[_0x1047('0x3e')]=qs[_0x1047('0x35')](_[_0x1047('0x3f')](_0x5635a7['query'],_0x2738a9['filters']),_0x410e77);if(_0x5635a7[_0x1047('0x33')][_0x1047('0x40')]){_0x5eda39['where']=_[_0x1047('0x41')](_0x5eda39[_0x1047('0x3e')],{'$or':_[_0x1047('0x2e')](_0x410e77,function(_0x837cb){if(_0x837cb[_0x1047('0x42')]!==_0x1047('0x43')){var _0x12c17b={};_0x12c17b[_0x837cb[_0x1047('0x2c')]]={'$like':'%'+_0x5635a7[_0x1047('0x33')][_0x1047('0x40')]+'%'};return _0x12c17b;}})});}_0x5eda39=_[_0x1047('0x41')]({},_0x5eda39,_0x5635a7[_0x1047('0x44')]);var _0x35c51c={'where':_0x5eda39['where']};return db[_0x1047('0x2f')][_0x1047('0x23')](_0x35c51c)[_0x1047('0x2a')](function(_0xf41cb1){_0x465bcf[_0x1047('0x23')]=_0xf41cb1;if(_0x5635a7[_0x1047('0x33')][_0x1047('0x45')]){_0x5eda39[_0x1047('0x46')]=[{'all':!![]}];}return db[_0x1047('0x2f')][_0x1047('0x47')](_0x5eda39);})[_0x1047('0x2a')](function(_0x22b4a1){_0x465bcf[_0x1047('0x48')]=_0x22b4a1;return _0x465bcf;})[_0x1047('0x2a')](respondWithFilteredResult(_0x14ec5e,_0x5eda39))[_0x1047('0x49')](handleError(_0x14ec5e,null));};exports[_0x1047('0x4a')]=function(_0x2f39a7,_0x3cdebf){var _0x91d1f5={'raw':![],'where':{'id':_0x2f39a7['params']['id']}},_0x54d5b1={};_0x54d5b1[_0x1047('0x37')]=_[_0x1047('0x34')](db[_0x1047('0x2f')][_0x1047('0x30')]);_0x54d5b1[_0x1047('0x33')]=_['keys'](_0x2f39a7[_0x1047('0x33')]);_0x54d5b1[_0x1047('0x35')]=_['intersection'](_0x54d5b1[_0x1047('0x37')],_0x54d5b1[_0x1047('0x33')]);_0x91d1f5[_0x1047('0x39')]=_[_0x1047('0x36')](_0x54d5b1[_0x1047('0x37')],qs['fields'](_0x2f39a7[_0x1047('0x33')][_0x1047('0x38')]));_0x91d1f5[_0x1047('0x39')]=_0x91d1f5[_0x1047('0x39')][_0x1047('0x3a')]?_0x91d1f5[_0x1047('0x39')]:_0x54d5b1[_0x1047('0x37')];if(_0x2f39a7[_0x1047('0x33')][_0x1047('0x45')]){_0x91d1f5[_0x1047('0x46')]=[{'all':!![]}];}_0x91d1f5=_['merge']({},_0x91d1f5,_0x2f39a7[_0x1047('0x44')]);return db[_0x1047('0x2f')][_0x1047('0x4b')](_0x91d1f5)[_0x1047('0x2a')](handleEntityNotFound(_0x3cdebf,null))['then'](respondWithResult(_0x3cdebf,null))['catch'](handleError(_0x3cdebf,null));};exports[_0x1047('0x4c')]=function(_0x43f56b,_0x4dbdbc){return db[_0x1047('0x2f')][_0x1047('0x4c')](_0x43f56b[_0x1047('0x4d')],{})['then'](respondWithResult(_0x4dbdbc,0xc9))[_0x1047('0x49')](handleError(_0x4dbdbc,null));};exports[_0x1047('0x4e')]=function(_0x1565b4,_0x2c9314){if(_0x1565b4[_0x1047('0x4d')]['id']){delete _0x1565b4[_0x1047('0x4d')]['id'];}return db[_0x1047('0x2f')][_0x1047('0x4b')]({'where':{'id':_0x1565b4['params']['id']}})['then'](handleEntityNotFound(_0x2c9314,null))[_0x1047('0x2a')](saveUpdates(_0x1565b4[_0x1047('0x4d')],null))[_0x1047('0x2a')](respondWithResult(_0x2c9314,null))[_0x1047('0x49')](handleError(_0x2c9314,null));};exports[_0x1047('0x29')]=function(_0x1b335e,_0x3ad91a){return db[_0x1047('0x2f')][_0x1047('0x4b')]({'where':{'id':_0x1b335e[_0x1047('0x4f')]['id']}})[_0x1047('0x2a')](handleEntityNotFound(_0x3ad91a,null))[_0x1047('0x2a')](removeEntity(_0x3ad91a,null))[_0x1047('0x49')](handleError(_0x3ad91a,null));};exports[_0x1047('0x50')]=function(_0x1c1e31,_0x103119){return db[_0x1047('0x2f')][_0x1047('0x50')]()[_0x1047('0x2a')](respondWithResult(_0x103119,null))[_0x1047('0x49')](handleError(_0x103119,null));};exports[_0x1047('0x51')]=function(_0x44abed,_0x5b49e2){var _0x4d7b25={},_0x1e51dd={},_0x429b49={'count':0x0,'rows':[]};_0x1e51dd[_0x1047('0x37')]=_['keys'](db[_0x1047('0x2f')][_0x1047('0x30')]);_0x1e51dd[_0x1047('0x33')]=_[_0x1047('0x34')](_0x44abed[_0x1047('0x33')]);_0x1e51dd[_0x1047('0x35')]=_['intersection'](_0x1e51dd['model'],_0x1e51dd[_0x1047('0x33')]);_0x4d7b25[_0x1047('0x39')]=_[_0x1047('0x36')](_0x1e51dd['model'],qs[_0x1047('0x38')](_0x44abed[_0x1047('0x33')]['fields']));_0x4d7b25[_0x1047('0x39')]=_0x4d7b25['attributes'][_0x1047('0x3a')]?_0x4d7b25[_0x1047('0x39')]:_0x1e51dd[_0x1047('0x37')];if(!_0x44abed['query'][_0x1047('0x3b')](_0x1047('0x3c'))){_0x4d7b25[_0x1047('0x22')]=qs[_0x1047('0x22')](_0x44abed[_0x1047('0x33')][_0x1047('0x22')]);_0x4d7b25[_0x1047('0x20')]=qs[_0x1047('0x20')](_0x44abed[_0x1047('0x33')]['offset']);}_0x4d7b25[_0x1047('0x3d')]=qs[_0x1047('0x52')](_0x44abed[_0x1047('0x33')][_0x1047('0x52')]);_0x4d7b25['where']=qs['filters'](_[_0x1047('0x3f')](_0x44abed[_0x1047('0x33')],_0x1e51dd[_0x1047('0x35')]));if(_0x44abed[_0x1047('0x33')][_0x1047('0x40')]){_0x4d7b25['where']=_[_0x1047('0x41')](_0x4d7b25[_0x1047('0x3e')],{'$or':_[_0x1047('0x2e')](_0x4d7b25[_0x1047('0x39')],function(_0x12cee5){var _0x43984f={};_0x43984f[_0x12cee5]={'$like':'%'+_0x44abed[_0x1047('0x33')][_0x1047('0x40')]+'%'};return _0x43984f;})});}_0x4d7b25=_[_0x1047('0x41')]({},_0x4d7b25,_0x44abed[_0x1047('0x44')]);var _0x8d827c={'where':_0x4d7b25[_0x1047('0x3e')]};return db[_0x1047('0x2f')][_0x1047('0x23')](_0x8d827c)['then'](function(_0x739c24){_0x429b49['count']=_0x739c24;if(_0x44abed[_0x1047('0x33')][_0x1047('0x45')]){_0x4d7b25['include']=[{'all':!![]}];}return db[_0x1047('0x2f')][_0x1047('0x47')](_0x4d7b25);})['then'](function(_0x4c8d4a){_0x429b49[_0x1047('0x48')]=_0x4c8d4a;return _0x429b49;})[_0x1047('0x2a')](respondWithFilteredResult(_0x5b49e2,_0x4d7b25,_0x1047('0x51')))[_0x1047('0x49')](handleError(_0x5b49e2,null,_0x1047('0x51')));}; \ No newline at end of file +var _0x406d=['rows','catch','show','length','includeAll','include','create','body','destroy','find','params','describe','getVoiceQueuesReport','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','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','redis','socket.io-emitter','./voiceQueueReport.socket','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','name','index','map','VoiceQueueReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll'];(function(_0x10b48a,_0x1a0a3f){var _0x2c4533=function(_0x5e4be6){while(--_0x5e4be6){_0x10b48a['push'](_0x10b48a['shift']());}};_0x2c4533(++_0x1a0a3f);}(_0x406d,0x1db));var _0xd406=function(_0x51595e,_0x59c5e8){_0x51595e=_0x51595e-0x0;var _0x3e1e66=_0x406d[_0x51595e];return _0x3e1e66;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd406('0x0'));var zipdir=require(_0xd406('0x1'));var jsonpatch=require(_0xd406('0x2'));var rp=require('request-promise');var moment=require(_0xd406('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd406('0x4'));var util=require(_0xd406('0x5'));var path=require(_0xd406('0x6'));var sox=require(_0xd406('0x7'));var csv=require(_0xd406('0x8'));var ejs=require(_0xd406('0x9'));var fs=require('fs');var fs_extra=require(_0xd406('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd406('0xb'));var deskjs=require(_0xd406('0xc'));var toCsv=require(_0xd406('0x8'));var querystring=require(_0xd406('0xd'));var Papa=require(_0xd406('0xe'));var Redis=require('ioredis');var authService=require(_0xd406('0xf'));var qs=require(_0xd406('0x10'));var as=require(_0xd406('0x11'));var hardwareService=require(_0xd406('0x12'));var logger=require(_0xd406('0x13'))(_0xd406('0x14'));var utils=require('../../config/utils');var config=require(_0xd406('0x15'));var licenseUtil=require(_0xd406('0x16'));var db=require(_0xd406('0x17'))['db'];config[_0xd406('0x18')]=_['defaults'](config[_0xd406('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xd406('0x19'))(new Redis(config[_0xd406('0x18')]));require(_0xd406('0x1a'))['register'](socket);function respondWithStatusCode(_0x293255,_0x5b1df1){_0x5b1df1=_0x5b1df1||0xcc;return function(_0x571288){if(_0x571288){return _0x293255[_0xd406('0x1b')](_0x5b1df1);}return _0x293255[_0xd406('0x1c')](_0x5b1df1)[_0xd406('0x1d')]();};}function respondWithResult(_0x478eff,_0x1a59c6){_0x1a59c6=_0x1a59c6||0xc8;return function(_0x19c85c){if(_0x19c85c){return _0x478eff[_0xd406('0x1c')](_0x1a59c6)[_0xd406('0x1e')](_0x19c85c);}};}function respondWithFilteredResult(_0x21b0e9,_0x36724e){return function(_0x3ae3bc){if(_0x3ae3bc){var _0x4567c8=typeof _0x36724e[_0xd406('0x1f')]===_0xd406('0x20')&&typeof _0x36724e[_0xd406('0x21')]===_0xd406('0x20');var _0x221380=_0x3ae3bc[_0xd406('0x22')];var _0x5e7f42=_0x4567c8?0x0:_0x36724e[_0xd406('0x1f')];var _0x18e992=_0x4567c8?_0x3ae3bc['count']:_0x36724e[_0xd406('0x1f')]+_0x36724e['limit'];var _0x10b3db;if(_0x18e992>=_0x221380){_0x18e992=_0x221380;_0x10b3db=0xc8;}else{_0x10b3db=0xce;}_0x21b0e9['status'](_0x10b3db);return _0x21b0e9['set'](_0xd406('0x23'),_0x5e7f42+'-'+_0x18e992+'/'+_0x221380)[_0xd406('0x1e')](_0x3ae3bc);}return null;};}function patchUpdates(_0x46e35){return function(_0x35f28c){try{jsonpatch[_0xd406('0x24')](_0x35f28c,_0x46e35,!![]);}catch(_0x3457be){return BPromise[_0xd406('0x25')](_0x3457be);}return _0x35f28c['save']();};}function saveUpdates(_0x57247a,_0x3ce819){return function(_0x3c2a19){if(_0x3c2a19){return _0x3c2a19[_0xd406('0x26')](_0x57247a)[_0xd406('0x27')](function(_0x126cda){return _0x126cda;});}return null;};}function removeEntity(_0x141251,_0x2d41f7){return function(_0x24b3b9){if(_0x24b3b9){return _0x24b3b9['destroy']()[_0xd406('0x27')](function(){_0x141251[_0xd406('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31d018,_0x1a72ba){return function(_0x3cf8de){if(!_0x3cf8de){_0x31d018[_0xd406('0x1b')](0x194);}return _0x3cf8de;};}function handleError(_0x330104,_0x1f00ea){_0x1f00ea=_0x1f00ea||0x1f4;return function(_0x415342){logger[_0xd406('0x28')](_0x415342['stack']);if(_0x415342[_0xd406('0x29')]){delete _0x415342[_0xd406('0x29')];}_0x330104['status'](_0x1f00ea)['send'](_0x415342);};}exports[_0xd406('0x2a')]=function(_0x2bf2cd,_0x495afc){var _0x445c4d={},_0x452d51={},_0x229cf0={'count':0x0,'rows':[]};var _0x221746=_[_0xd406('0x2b')](db[_0xd406('0x2c')][_0xd406('0x2d')],function(_0x247c5c){return{'name':_0x247c5c['fieldName'],'type':_0x247c5c['type'][_0xd406('0x2e')]};});_0x452d51[_0xd406('0x2f')]=_[_0xd406('0x2b')](_0x221746,_0xd406('0x29'));_0x452d51[_0xd406('0x30')]=_[_0xd406('0x31')](_0x2bf2cd['query']);_0x452d51[_0xd406('0x32')]=_[_0xd406('0x33')](_0x452d51[_0xd406('0x2f')],_0x452d51[_0xd406('0x30')]);_0x445c4d[_0xd406('0x34')]=_['intersection'](_0x452d51[_0xd406('0x2f')],qs[_0xd406('0x35')](_0x2bf2cd[_0xd406('0x30')][_0xd406('0x35')]));_0x445c4d[_0xd406('0x34')]=_0x445c4d[_0xd406('0x34')]['length']?_0x445c4d[_0xd406('0x34')]:_0x452d51[_0xd406('0x2f')];if(!_0x2bf2cd[_0xd406('0x30')]['hasOwnProperty'](_0xd406('0x36'))){_0x445c4d[_0xd406('0x21')]=qs['limit'](_0x2bf2cd[_0xd406('0x30')][_0xd406('0x21')]);_0x445c4d[_0xd406('0x1f')]=qs[_0xd406('0x1f')](_0x2bf2cd[_0xd406('0x30')][_0xd406('0x1f')]);}_0x445c4d['order']=qs[_0xd406('0x37')](_0x2bf2cd[_0xd406('0x30')][_0xd406('0x37')]);_0x445c4d[_0xd406('0x38')]=qs[_0xd406('0x32')](_[_0xd406('0x39')](_0x2bf2cd[_0xd406('0x30')],_0x452d51[_0xd406('0x32')]),_0x221746);if(_0x2bf2cd['query'][_0xd406('0x3a')]){_0x445c4d['where']=_[_0xd406('0x3b')](_0x445c4d['where'],{'$or':_[_0xd406('0x2b')](_0x221746,function(_0xf6cce){if(_0xf6cce[_0xd406('0x3c')]!==_0xd406('0x3d')){var _0x472710={};_0x472710[_0xf6cce[_0xd406('0x29')]]={'$like':'%'+_0x2bf2cd[_0xd406('0x30')]['filter']+'%'};return _0x472710;}})});}_0x445c4d=_[_0xd406('0x3b')]({},_0x445c4d,_0x2bf2cd[_0xd406('0x3e')]);var _0xf2b1ab={'where':_0x445c4d['where']};return db[_0xd406('0x2c')][_0xd406('0x22')](_0xf2b1ab)[_0xd406('0x27')](function(_0x1708d3){_0x229cf0[_0xd406('0x22')]=_0x1708d3;if(_0x2bf2cd[_0xd406('0x30')]['includeAll']){_0x445c4d['include']=[{'all':!![]}];}return db[_0xd406('0x2c')][_0xd406('0x3f')](_0x445c4d);})[_0xd406('0x27')](function(_0x24e6ae){_0x229cf0[_0xd406('0x40')]=_0x24e6ae;return _0x229cf0;})[_0xd406('0x27')](respondWithFilteredResult(_0x495afc,_0x445c4d))[_0xd406('0x41')](handleError(_0x495afc,null));};exports[_0xd406('0x42')]=function(_0x2120e0,_0x2777cf){var _0xfabd56={'raw':![],'where':{'id':_0x2120e0['params']['id']}},_0x3687b4={};_0x3687b4[_0xd406('0x2f')]=_['keys'](db['VoiceQueueReport']['rawAttributes']);_0x3687b4[_0xd406('0x30')]=_[_0xd406('0x31')](_0x2120e0[_0xd406('0x30')]);_0x3687b4[_0xd406('0x32')]=_['intersection'](_0x3687b4[_0xd406('0x2f')],_0x3687b4['query']);_0xfabd56[_0xd406('0x34')]=_[_0xd406('0x33')](_0x3687b4[_0xd406('0x2f')],qs['fields'](_0x2120e0[_0xd406('0x30')]['fields']));_0xfabd56[_0xd406('0x34')]=_0xfabd56[_0xd406('0x34')][_0xd406('0x43')]?_0xfabd56[_0xd406('0x34')]:_0x3687b4[_0xd406('0x2f')];if(_0x2120e0[_0xd406('0x30')][_0xd406('0x44')]){_0xfabd56[_0xd406('0x45')]=[{'all':!![]}];}_0xfabd56=_[_0xd406('0x3b')]({},_0xfabd56,_0x2120e0[_0xd406('0x3e')]);return db['VoiceQueueReport']['find'](_0xfabd56)[_0xd406('0x27')](handleEntityNotFound(_0x2777cf,null))[_0xd406('0x27')](respondWithResult(_0x2777cf,null))[_0xd406('0x41')](handleError(_0x2777cf,null));};exports['create']=function(_0x19f09d,_0x44f4d3){return db[_0xd406('0x2c')][_0xd406('0x46')](_0x19f09d[_0xd406('0x47')],{})['then'](respondWithResult(_0x44f4d3,0xc9))[_0xd406('0x41')](handleError(_0x44f4d3,null));};exports[_0xd406('0x26')]=function(_0x288225,_0x377f11){if(_0x288225[_0xd406('0x47')]['id']){delete _0x288225[_0xd406('0x47')]['id'];}return db[_0xd406('0x2c')]['find']({'where':{'id':_0x288225['params']['id']}})[_0xd406('0x27')](handleEntityNotFound(_0x377f11,null))[_0xd406('0x27')](saveUpdates(_0x288225[_0xd406('0x47')],null))[_0xd406('0x27')](respondWithResult(_0x377f11,null))['catch'](handleError(_0x377f11,null));};exports[_0xd406('0x48')]=function(_0x20e183,_0x5084f1){return db[_0xd406('0x2c')][_0xd406('0x49')]({'where':{'id':_0x20e183[_0xd406('0x4a')]['id']}})[_0xd406('0x27')](handleEntityNotFound(_0x5084f1,null))[_0xd406('0x27')](removeEntity(_0x5084f1,null))[_0xd406('0x41')](handleError(_0x5084f1,null));};exports[_0xd406('0x4b')]=function(_0x2f70ac,_0x1c1d8f){return db[_0xd406('0x2c')][_0xd406('0x4b')]()[_0xd406('0x27')](respondWithResult(_0x1c1d8f,null))[_0xd406('0x41')](handleError(_0x1c1d8f,null));};exports[_0xd406('0x4c')]=function(_0x5126e4,_0x3899f5){var _0x6155a6={},_0x1bcf0b={},_0x2be78b={'count':0x0,'rows':[]};_0x1bcf0b[_0xd406('0x2f')]=_[_0xd406('0x31')](db[_0xd406('0x2c')][_0xd406('0x2d')]);_0x1bcf0b[_0xd406('0x30')]=_[_0xd406('0x31')](_0x5126e4[_0xd406('0x30')]);_0x1bcf0b['filters']=_[_0xd406('0x33')](_0x1bcf0b['model'],_0x1bcf0b[_0xd406('0x30')]);_0x6155a6['attributes']=_[_0xd406('0x33')](_0x1bcf0b[_0xd406('0x2f')],qs[_0xd406('0x35')](_0x5126e4['query'][_0xd406('0x35')]));_0x6155a6[_0xd406('0x34')]=_0x6155a6[_0xd406('0x34')][_0xd406('0x43')]?_0x6155a6['attributes']:_0x1bcf0b[_0xd406('0x2f')];if(!_0x5126e4['query']['hasOwnProperty'](_0xd406('0x36'))){_0x6155a6['limit']=qs[_0xd406('0x21')](_0x5126e4[_0xd406('0x30')][_0xd406('0x21')]);_0x6155a6['offset']=qs[_0xd406('0x1f')](_0x5126e4[_0xd406('0x30')]['offset']);}_0x6155a6['order']=qs[_0xd406('0x37')](_0x5126e4[_0xd406('0x30')][_0xd406('0x37')]);_0x6155a6[_0xd406('0x38')]=qs['filters'](_[_0xd406('0x39')](_0x5126e4[_0xd406('0x30')],_0x1bcf0b['filters']));if(_0x5126e4[_0xd406('0x30')][_0xd406('0x3a')]){_0x6155a6[_0xd406('0x38')]=_[_0xd406('0x3b')](_0x6155a6[_0xd406('0x38')],{'$or':_[_0xd406('0x2b')](_0x6155a6['attributes'],function(_0x15f3f5){var _0x307c4a={};_0x307c4a[_0x15f3f5]={'$like':'%'+_0x5126e4[_0xd406('0x30')][_0xd406('0x3a')]+'%'};return _0x307c4a;})});}_0x6155a6=_[_0xd406('0x3b')]({},_0x6155a6,_0x5126e4[_0xd406('0x3e')]);var _0x3022e2={'where':_0x6155a6[_0xd406('0x38')]};return db[_0xd406('0x2c')][_0xd406('0x22')](_0x3022e2)[_0xd406('0x27')](function(_0x5dae0e){_0x2be78b[_0xd406('0x22')]=_0x5dae0e;if(_0x5126e4[_0xd406('0x30')][_0xd406('0x44')]){_0x6155a6['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0xd406('0x3f')](_0x6155a6);})[_0xd406('0x27')](function(_0x4b6f87){_0x2be78b[_0xd406('0x40')]=_0x4b6f87;return _0x2be78b;})[_0xd406('0x27')](respondWithFilteredResult(_0x3899f5,_0x6155a6,_0xd406('0x4c')))['catch'](handleError(_0x3899f5,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 0453891..a0293cc 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 _0x5df6=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x5a2113,_0x24d538){var _0x2dc3da=function(_0x372cfc){while(--_0x372cfc){_0x5a2113['push'](_0x5a2113['shift']());}};_0x2dc3da(++_0x24d538);}(_0x5df6,0x1ef));var _0x65df=function(_0x4ebc9c,_0x7d722e){_0x4ebc9c=_0x4ebc9c-0x0;var _0x213d23=_0x5df6[_0x4ebc9c];return _0x213d23;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x65df('0x0'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x65df('0x1'),'afterUpdate':_0x65df('0x2'),'afterDestroy':_0x65df('0x3')};function emitEvent(_0x533106){return function(_0x3b2108,_0x32b701,_0x57b98a){VoiceQueueReportEvents[_0x65df('0x4')](_0x533106+':'+_0x3b2108['id'],_0x3b2108);VoiceQueueReportEvents[_0x65df('0x4')](_0x533106,_0x3b2108);_0x57b98a(null);};}for(var e in events){if(events[_0x65df('0x5')](e)){var event=events[e];VoiceQueueReport[_0x65df('0x6')](e,emitEvent(event));}}module[_0x65df('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xc765=['VoiceQueueReport','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5e39d0,_0x15516e){var _0xfd2079=function(_0x4dfc9f){while(--_0x4dfc9f){_0x5e39d0['push'](_0x5e39d0['shift']());}};_0xfd2079(++_0x15516e);}(_0xc765,0x76));var _0x5c76=function(_0x21384d,_0xca16){_0x21384d=_0x21384d-0x0;var _0x118772=_0xc765[_0x21384d];return _0x118772;};'use strict';var EventEmitter=require(_0x5c76('0x0'));var VoiceQueueReport=require(_0x5c76('0x1'))['db'][_0x5c76('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x5c76('0x3')](0x0);var events={'afterCreate':_0x5c76('0x4'),'afterUpdate':_0x5c76('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1b5a8f){return function(_0xa0a26b,_0x51d3de,_0x2f687f){VoiceQueueReportEvents[_0x5c76('0x6')](_0x1b5a8f+':'+_0xa0a26b['id'],_0xa0a26b);VoiceQueueReportEvents[_0x5c76('0x6')](_0x1b5a8f,_0xa0a26b);_0x2f687f(null);};}for(var e in events){if(events[_0x5c76('0x7')](e)){var event=events[e];VoiceQueueReport[_0x5c76('0x8')](e,emitEvent(event));}}module[_0x5c76('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 ec74eef..338e5d7 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 _0xfab1=['report_queue','uniqueid','lodash','../../config/logger','moment','request-promise','path','rimraf','./voiceQueueReport.attributes','exports','define','VoiceQueueReport'];(function(_0x59ae8f,_0x148344){var _0x3900b5=function(_0x63af51){while(--_0x63af51){_0x59ae8f['push'](_0x59ae8f['shift']());}};_0x3900b5(++_0x148344);}(_0xfab1,0xc2));var _0x1fab=function(_0x167325,_0x33a663){_0x167325=_0x167325-0x0;var _0xc84b4b=_0xfab1[_0x167325];return _0xc84b4b;};'use strict';var _=require(_0x1fab('0x0'));var util=require('util');var logger=require(_0x1fab('0x1'))('api');var moment=require(_0x1fab('0x2'));var BPromise=require('bluebird');var rp=require(_0x1fab('0x3'));var fs=require('fs');var path=require(_0x1fab('0x4'));var rimraf=require(_0x1fab('0x5'));var config=require('../../config/environment');var attributes=require(_0x1fab('0x6'));module[_0x1fab('0x7')]=function(_0x473790,_0x2c74d8){return _0x473790[_0x1fab('0x8')](_0x1fab('0x9'),attributes,{'tableName':_0x1fab('0xa'),'paranoid':![],'indexes':[{'fields':[_0x1fab('0xb')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x681d=['moment','request-promise','path','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','calleridnum','util','../../config/logger','api'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x681d,0xf9));var _0xd681=function(_0x44b3bd,_0x44c97d){_0x44b3bd=_0x44b3bd-0x0;var _0x1efc4a=_0x681d[_0x44b3bd];return _0x1efc4a;};'use strict';var _=require('lodash');var util=require(_0xd681('0x0'));var logger=require(_0xd681('0x1'))(_0xd681('0x2'));var moment=require(_0xd681('0x3'));var BPromise=require('bluebird');var rp=require(_0xd681('0x4'));var fs=require('fs');var path=require(_0xd681('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd681('0x6'));module[_0xd681('0x7')]=function(_0xfd8d70,_0x54f4a2){return _0xfd8d70[_0xd681('0x8')](_0xd681('0x9'),attributes,{'tableName':_0xd681('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xd681('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 74e7f22..f9d1b06 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 _0x5f39=['UpdateVoiceQueueReport','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','findAll','raw','options','where','limit','include','map','model','attributes','CreateVoiceQueueReport','VoiceQueueReport','create','body'];(function(_0x1d287a,_0x39db7f){var _0x5e6efc=function(_0x1544d2){while(--_0x1544d2){_0x1d287a['push'](_0x1d287a['shift']());}};_0x5e6efc(++_0x39db7f);}(_0x5f39,0x1e5));var _0x95f3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5f39[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x95f3('0x0'));var util=require(_0x95f3('0x1'));var moment=require(_0x95f3('0x2'));var BPromise=require(_0x95f3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95f3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x95f3('0x5'));var logger=require(_0x95f3('0x6'))(_0x95f3('0x7'));var config=require(_0x95f3('0x8'));var jayson=require(_0x95f3('0x9'));var client=jayson[_0x95f3('0xa')][_0x95f3('0xb')]({'port':0x232a});config[_0x95f3('0xc')]=_['defaults'](config[_0x95f3('0xc')],{'host':_0x95f3('0xd'),'port':0x18eb});var socket=require(_0x95f3('0xe'))(new Redis(config[_0x95f3('0xc')]));require('./voiceQueueReport.socket')[_0x95f3('0xf')](socket);function respondWithRpcPromise(_0x294fa2,_0x28c0b6,_0x583733){return new BPromise(function(_0x151c1f,_0x282c5f){return client[_0x95f3('0x10')](_0x294fa2,_0x583733)[_0x95f3('0x11')](function(_0x389ef4){logger[_0x95f3('0x12')](_0x95f3('0x13'),_0x28c0b6,_0x95f3('0x14'));logger[_0x95f3('0x15')](_0x95f3('0x16'),_0x28c0b6,'request\x20sent',JSON[_0x95f3('0x17')](_0x389ef4));if(_0x389ef4[_0x95f3('0x18')]){if(_0x389ef4['error'][_0x95f3('0x19')]===0x1f4){logger[_0x95f3('0x18')](_0x95f3('0x13'),_0x28c0b6,_0x389ef4[_0x95f3('0x18')][_0x95f3('0x1a')]);return _0x282c5f(_0x389ef4[_0x95f3('0x18')]['message']);}logger['error'](_0x95f3('0x13'),_0x28c0b6,_0x389ef4[_0x95f3('0x18')][_0x95f3('0x1a')]);return _0x151c1f(_0x389ef4[_0x95f3('0x18')][_0x95f3('0x1a')]);}else{logger[_0x95f3('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x28c0b6,'request\x20sent');_0x151c1f(_0x389ef4[_0x95f3('0x1b')][_0x95f3('0x1a')]);}})[_0x95f3('0x1c')](function(_0x4bfa41){logger[_0x95f3('0x18')](_0x95f3('0x13'),_0x28c0b6,_0x4bfa41);_0x282c5f(_0x4bfa41);});});}exports[_0x95f3('0x1d')]=function(_0x3eede1){var _0x53a21a=this;return new Promise(function(_0x5519c5,_0x16dd63){return db['VoiceQueueReport'][_0x95f3('0x1e')]({'raw':_0x3eede1['options']?_0x3eede1['options'][_0x95f3('0x1f')]===undefined?!![]:![]:!![],'where':_0x3eede1[_0x95f3('0x20')]?_0x3eede1[_0x95f3('0x20')][_0x95f3('0x21')]||null:null,'attributes':_0x3eede1[_0x95f3('0x20')]?_0x3eede1[_0x95f3('0x20')]['attributes']||null:null,'limit':_0x3eede1[_0x95f3('0x20')]?_0x3eede1[_0x95f3('0x20')][_0x95f3('0x22')]||null:null,'include':_0x3eede1[_0x95f3('0x20')]?_0x3eede1[_0x95f3('0x20')][_0x95f3('0x23')]?_[_0x95f3('0x24')](_0x3eede1[_0x95f3('0x20')][_0x95f3('0x23')],function(_0x29210e){return{'model':db[_0x29210e[_0x95f3('0x25')]],'as':_0x29210e['as'],'attributes':_0x29210e[_0x95f3('0x26')],'include':_0x29210e[_0x95f3('0x23')]?_[_0x95f3('0x24')](_0x29210e[_0x95f3('0x23')],function(_0x477c44){return{'model':db[_0x477c44[_0x95f3('0x25')]],'as':_0x477c44['as'],'attributes':_0x477c44['attributes'],'include':_0x477c44[_0x95f3('0x23')]?_['map'](_0x477c44[_0x95f3('0x23')],function(_0x1abeb5){return{'model':db[_0x1abeb5[_0x95f3('0x25')]],'as':_0x1abeb5['as'],'attributes':_0x1abeb5[_0x95f3('0x26')]};}):[]};}):[]};}):[]:[]})[_0x95f3('0x11')](function(_0x1a6724){logger['info'](_0x95f3('0x1d'),_0x3eede1);logger['debug'](_0x95f3('0x1d'),_0x3eede1,JSON[_0x95f3('0x17')](_0x1a6724));_0x5519c5(_0x1a6724);})[_0x95f3('0x1c')](function(_0x2db732){logger[_0x95f3('0x18')](_0x95f3('0x1d'),_0x2db732[_0x95f3('0x1a')],_0x3eede1);_0x16dd63(_0x53a21a['error'](0x1f4,_0x2db732[_0x95f3('0x1a')]));});});};exports[_0x95f3('0x27')]=function(_0xbf9c71){var _0x46561b=this;return new Promise(function(_0xd8b7f2,_0x375ece){return db[_0x95f3('0x28')][_0x95f3('0x29')](_0xbf9c71[_0x95f3('0x2a')],{'raw':_0xbf9c71['options']?_0xbf9c71[_0x95f3('0x20')][_0x95f3('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x2b8472){logger[_0x95f3('0x12')](_0x95f3('0x27'),_0xbf9c71);logger[_0x95f3('0x15')](_0x95f3('0x27'),_0xbf9c71,JSON[_0x95f3('0x17')](_0x2b8472));_0xd8b7f2(_0x2b8472);})[_0x95f3('0x1c')](function(_0x46cd86){logger['error']('CreateVoiceQueueReport',_0x46cd86[_0x95f3('0x1a')],_0xbf9c71);_0x375ece(_0x46561b['error'](0x1f4,_0x46cd86['message']));});});};exports[_0x95f3('0x2b')]=function(_0xcecc87){var _0x4d39ac=this;return new Promise(function(_0x43a0e9,_0x3c26a8){return db[_0x95f3('0x28')]['update'](_0xcecc87[_0x95f3('0x2a')],{'raw':_0xcecc87[_0x95f3('0x20')]?_0xcecc87[_0x95f3('0x20')][_0x95f3('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcecc87[_0x95f3('0x20')]?_0xcecc87[_0x95f3('0x20')][_0x95f3('0x21')]||null:null,'attributes':_0xcecc87[_0x95f3('0x20')]?_0xcecc87[_0x95f3('0x20')][_0x95f3('0x26')]||null:null,'limit':_0xcecc87['options']?_0xcecc87['options']['limit']||null:null})[_0x95f3('0x11')](function(_0x5b9781){logger[_0x95f3('0x12')]('UpdateVoiceQueueReport',_0xcecc87);logger[_0x95f3('0x15')](_0x95f3('0x2b'),_0xcecc87,JSON[_0x95f3('0x17')](_0x5b9781));_0x43a0e9(_0x5b9781);})['catch'](function(_0x556eec){logger['error'](_0x95f3('0x2b'),_0x556eec['message'],_0xcecc87);_0x3c26a8(_0x4d39ac['error'](0x1f4,_0x556eec[_0x95f3('0x1a')]));});});}; \ No newline at end of file +var _0xb08a=['VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceQueueReport','findAll','options','raw','where','attributes','limit','map','include','model','stringify','catch','VoiceQueueReport','create','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./voiceQueueReport.socket','register','request','then','info'];(function(_0x1fc231,_0x47d37a){var _0x3b3f03=function(_0x32ada9){while(--_0x32ada9){_0x1fc231['push'](_0x1fc231['shift']());}};_0x3b3f03(++_0x47d37a);}(_0xb08a,0xa7));var _0xab08=function(_0x2e7f96,_0x2ffe43){_0x2e7f96=_0x2e7f96-0x0;var _0x315277=_0xb08a[_0x2e7f96];return _0x315277;};'use strict';var _=require(_0xab08('0x0'));var util=require(_0xab08('0x1'));var moment=require(_0xab08('0x2'));var BPromise=require(_0xab08('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab08('0x4'));var db=require(_0xab08('0x5'))['db'];var utils=require(_0xab08('0x6'));var logger=require(_0xab08('0x7'))('rpc');var config=require(_0xab08('0x8'));var jayson=require(_0xab08('0x9'));var client=jayson[_0xab08('0xa')][_0xab08('0xb')]({'port':0x232a});config['redis']=_[_0xab08('0xc')](config['redis'],{'host':_0xab08('0xd'),'port':0x18eb});var socket=require(_0xab08('0xe'))(new Redis(config[_0xab08('0xf')]));require(_0xab08('0x10'))[_0xab08('0x11')](socket);function respondWithRpcPromise(_0x4b7ebb,_0xb8174d,_0x3eda74){return new BPromise(function(_0x20cb0b,_0x3c0811){return client[_0xab08('0x12')](_0x4b7ebb,_0x3eda74)[_0xab08('0x13')](function(_0x3d3aa9){logger[_0xab08('0x14')](_0xab08('0x15'),_0xb8174d,_0xab08('0x16'));logger[_0xab08('0x17')](_0xab08('0x18'),_0xb8174d,_0xab08('0x16'),JSON['stringify'](_0x3d3aa9));if(_0x3d3aa9[_0xab08('0x19')]){if(_0x3d3aa9[_0xab08('0x19')][_0xab08('0x1a')]===0x1f4){logger['error'](_0xab08('0x15'),_0xb8174d,_0x3d3aa9['error'][_0xab08('0x1b')]);return _0x3c0811(_0x3d3aa9[_0xab08('0x19')][_0xab08('0x1b')]);}logger[_0xab08('0x19')](_0xab08('0x15'),_0xb8174d,_0x3d3aa9[_0xab08('0x19')][_0xab08('0x1b')]);return _0x20cb0b(_0x3d3aa9['error'][_0xab08('0x1b')]);}else{logger[_0xab08('0x14')](_0xab08('0x15'),_0xb8174d,_0xab08('0x16'));_0x20cb0b(_0x3d3aa9[_0xab08('0x1c')][_0xab08('0x1b')]);}})['catch'](function(_0x4122f0){logger['error'](_0xab08('0x15'),_0xb8174d,_0x4122f0);_0x3c0811(_0x4122f0);});});}exports[_0xab08('0x1d')]=function(_0x45bddb){var _0xab9375=this;return new Promise(function(_0x478aca,_0x171bcc){return db['VoiceQueueReport'][_0xab08('0x1e')]({'raw':_0x45bddb['options']?_0x45bddb[_0xab08('0x1f')][_0xab08('0x20')]===undefined?!![]:![]:!![],'where':_0x45bddb[_0xab08('0x1f')]?_0x45bddb[_0xab08('0x1f')][_0xab08('0x21')]||null:null,'attributes':_0x45bddb[_0xab08('0x1f')]?_0x45bddb[_0xab08('0x1f')][_0xab08('0x22')]||null:null,'limit':_0x45bddb['options']?_0x45bddb[_0xab08('0x1f')][_0xab08('0x23')]||null:null,'include':_0x45bddb['options']?_0x45bddb['options']['include']?_[_0xab08('0x24')](_0x45bddb[_0xab08('0x1f')][_0xab08('0x25')],function(_0x32dfd9){return{'model':db[_0x32dfd9[_0xab08('0x26')]],'as':_0x32dfd9['as'],'attributes':_0x32dfd9[_0xab08('0x22')],'include':_0x32dfd9[_0xab08('0x25')]?_[_0xab08('0x24')](_0x32dfd9['include'],function(_0x451257){return{'model':db[_0x451257[_0xab08('0x26')]],'as':_0x451257['as'],'attributes':_0x451257[_0xab08('0x22')],'include':_0x451257[_0xab08('0x25')]?_[_0xab08('0x24')](_0x451257[_0xab08('0x25')],function(_0xd5180b){return{'model':db[_0xd5180b[_0xab08('0x26')]],'as':_0xd5180b['as'],'attributes':_0xd5180b[_0xab08('0x22')]};}):[]};}):[]};}):[]:[]})[_0xab08('0x13')](function(_0x22286b){logger[_0xab08('0x14')](_0xab08('0x1d'),_0x45bddb);logger[_0xab08('0x17')](_0xab08('0x1d'),_0x45bddb,JSON[_0xab08('0x27')](_0x22286b));_0x478aca(_0x22286b);})[_0xab08('0x28')](function(_0x2b8a88){logger[_0xab08('0x19')]('GetVoiceQueueReport',_0x2b8a88[_0xab08('0x1b')],_0x45bddb);_0x171bcc(_0xab9375['error'](0x1f4,_0x2b8a88[_0xab08('0x1b')]));});});};exports['CreateVoiceQueueReport']=function(_0x4d41dc){var _0x5534ab=this;return new Promise(function(_0x1e8eec,_0x2089ca){return db[_0xab08('0x29')][_0xab08('0x2a')](_0x4d41dc[_0xab08('0x2b')],{'raw':_0x4d41dc[_0xab08('0x1f')]?_0x4d41dc['options'][_0xab08('0x20')]===undefined?!![]:![]:!![]})[_0xab08('0x13')](function(_0x70dbda){logger[_0xab08('0x14')](_0xab08('0x2c'),_0x4d41dc);logger[_0xab08('0x17')](_0xab08('0x2c'),_0x4d41dc,JSON[_0xab08('0x27')](_0x70dbda));_0x1e8eec(_0x70dbda);})[_0xab08('0x28')](function(_0x2d8754){logger[_0xab08('0x19')](_0xab08('0x2c'),_0x2d8754[_0xab08('0x1b')],_0x4d41dc);_0x2089ca(_0x5534ab[_0xab08('0x19')](0x1f4,_0x2d8754[_0xab08('0x1b')]));});});};exports[_0xab08('0x2d')]=function(_0x57819d){var _0x5ee615=this;return new Promise(function(_0x5dbc60,_0x4f9d38){return db[_0xab08('0x29')][_0xab08('0x2e')](_0x57819d[_0xab08('0x2b')],{'raw':_0x57819d['options']?_0x57819d['options'][_0xab08('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57819d['options']?_0x57819d['options'][_0xab08('0x21')]||null:null,'attributes':_0x57819d[_0xab08('0x1f')]?_0x57819d[_0xab08('0x1f')][_0xab08('0x22')]||null:null,'limit':_0x57819d['options']?_0x57819d[_0xab08('0x1f')]['limit']||null:null})[_0xab08('0x13')](function(_0x9d576a){logger[_0xab08('0x14')]('UpdateVoiceQueueReport',_0x57819d);logger[_0xab08('0x17')](_0xab08('0x2d'),_0x57819d,JSON[_0xab08('0x27')](_0x9d576a));_0x5dbc60(_0x9d576a);})[_0xab08('0x28')](function(_0x4cb91d){logger['error'](_0xab08('0x2d'),_0x4cb91d[_0xab08('0x1b')],_0x57819d);_0x4f9d38(_0x5ee615['error'](0x1f4,_0x4cb91d['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 7b2b958..02959d8 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 _0xd58c=['./voiceQueueReport.events','save','remove','update','emit','removeListener','register','voiceQueueReport:'];(function(_0x5357fe,_0x369701){var _0x30ce20=function(_0x148a80){while(--_0x148a80){_0x5357fe['push'](_0x5357fe['shift']());}};_0x30ce20(++_0x369701);}(_0xd58c,0x70));var _0xcd58=function(_0x396423,_0xc32ef8){_0x396423=_0x396423-0x0;var _0x275e89=_0xd58c[_0x396423];return _0x275e89;};'use strict';var VoiceQueueReportEvents=require(_0xcd58('0x0'));var events=[_0xcd58('0x1'),_0xcd58('0x2'),_0xcd58('0x3')];function createListener(_0x17dce0,_0x3b2de5){return function(_0x2ba709){_0x3b2de5[_0xcd58('0x4')](_0x17dce0,_0x2ba709);};}function removeListener(_0x2bf999,_0x1cfa71){return function(){VoiceQueueReportEvents[_0xcd58('0x5')](_0x2bf999,_0x1cfa71);};}exports[_0xcd58('0x6')]=function(_0x4368e7){for(var _0x3c1ead=0x0,_0x544809=events['length'];_0x3c1ead<_0x544809;_0x3c1ead++){var _0x3759b0=events[_0x3c1ead];var _0x2255c5=createListener(_0xcd58('0x7')+_0x3759b0,_0x4368e7);VoiceQueueReportEvents['on'](_0x3759b0,_0x2255c5);}}; \ No newline at end of file +var _0x793b=['length','voiceQueueReport:','./voiceQueueReport.events','remove','update','emit','register'];(function(_0x1ae4a9,_0x4c0ed9){var _0x54d0b0=function(_0x4fff20){while(--_0x4fff20){_0x1ae4a9['push'](_0x1ae4a9['shift']());}};_0x54d0b0(++_0x4c0ed9);}(_0x793b,0xf0));var _0xb793=function(_0x18eb27,_0xbe423){_0x18eb27=_0x18eb27-0x0;var _0x9468e4=_0x793b[_0x18eb27];return _0x9468e4;};'use strict';var VoiceQueueReportEvents=require(_0xb793('0x0'));var events=['save',_0xb793('0x1'),_0xb793('0x2')];function createListener(_0x48ff43,_0x50db49){return function(_0x1d1c0d){_0x50db49[_0xb793('0x3')](_0x48ff43,_0x1d1c0d);};}function removeListener(_0x27b213,_0x20c6a6){return function(){VoiceQueueReportEvents['removeListener'](_0x27b213,_0x20c6a6);};}exports[_0xb793('0x4')]=function(_0x2d420c){for(var _0x9dc651=0x0,_0x340f81=events[_0xb793('0x5')];_0x9dc651<_0x340f81;_0x9dc651++){var _0x279b5e=events[_0x9dc651];var _0x1d8c5e=createListener(_0xb793('0x6')+_0x279b5e,_0x2d420c);VoiceQueueReportEvents['on'](_0x279b5e,_0x1d8c5e);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 3fa7026..08023fe 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 _0x5ce6=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','post','create','put','destroy','exports'];(function(_0xb57c,_0x37d2a2){var _0x319bfa=function(_0x41428f){while(--_0x41428f){_0xb57c['push'](_0xb57c['shift']());}};_0x319bfa(++_0x37d2a2);}(_0x5ce6,0xee));var _0x65ce=function(_0x35d59c,_0x341ef9){_0x35d59c=_0x35d59c-0x0;var _0x18cd27=_0x5ce6[_0x35d59c];return _0x18cd27;};'use strict';var multer=require('multer');var util=require(_0x65ce('0x0'));var path=require(_0x65ce('0x1'));var timeout=require(_0x65ce('0x2'));var express=require(_0x65ce('0x3'));var router=express[_0x65ce('0x4')]();var fs_extra=require(_0x65ce('0x5'));var auth=require(_0x65ce('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x65ce('0x7'));var controller=require(_0x65ce('0x8'));router[_0x65ce('0x9')]('/',auth[_0x65ce('0xa')](),controller['index']);router[_0x65ce('0x9')](_0x65ce('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x65ce('0xc')]('/',auth['isAuthenticated'](),controller[_0x65ce('0xd')]);router[_0x65ce('0xe')]('/:id',auth[_0x65ce('0xa')](),controller['update']);router['delete']('/:id',auth[_0x65ce('0xa')](),controller[_0x65ce('0xf')]);module[_0x65ce('0x10')]=router; \ No newline at end of file +var _0xd594=['multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get','/:id','show','post','update','delete','destroy','exports'];(function(_0x3cfd16,_0xfadc7d){var _0x5184f1=function(_0x52e1e5){while(--_0x52e1e5){_0x3cfd16['push'](_0x3cfd16['shift']());}};_0x5184f1(++_0xfadc7d);}(_0xd594,0xab));var _0x4d59=function(_0x310d04,_0x28ae92){_0x310d04=_0x310d04-0x0;var _0x49a2f4=_0xd594[_0x310d04];return _0x49a2f4;};'use strict';var multer=require(_0x4d59('0x0'));var util=require(_0x4d59('0x1'));var path=require(_0x4d59('0x2'));var timeout=require('connect-timeout');var express=require(_0x4d59('0x3'));var router=express[_0x4d59('0x4')]();var fs_extra=require(_0x4d59('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4d59('0x6'));var config=require(_0x4d59('0x7'));var controller=require(_0x4d59('0x8'));router['get']('/',auth[_0x4d59('0x9')](),controller[_0x4d59('0xa')]);router[_0x4d59('0xb')](_0x4d59('0xc'),auth['isAuthenticated'](),controller[_0x4d59('0xd')]);router[_0x4d59('0xe')]('/',auth[_0x4d59('0x9')](),controller['create']);router['put'](_0x4d59('0xc'),auth[_0x4d59('0x9')](),controller[_0x4d59('0xf')]);router[_0x4d59('0x10')](_0x4d59('0xc'),auth[_0x4d59('0x9')](),controller[_0x4d59('0x11')]);module[_0x4d59('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 7df2752..7d0adac 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 _0x1ef4=['STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports'];(function(_0x24b00f,_0x5cb40c){var _0x2d816d=function(_0x59f49c){while(--_0x59f49c){_0x24b00f['push'](_0x24b00f['shift']());}};_0x2d816d(++_0x5cb40c);}(_0x1ef4,0x17d));var _0x41ef=function(_0x304284,_0x422e77){_0x304284=_0x304284-0x0;var _0x510212=_0x1ef4[_0x304284];return _0x510212;};'use strict';var Sequelize=require(_0x41ef('0x0'));var moment=require(_0x41ef('0x1'));module[_0x41ef('0x2')]={'time':{'type':Sequelize[_0x41ef('0x3')]},'callid':{'type':Sequelize[_0x41ef('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x41ef('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x41ef('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x41ef('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x41ef('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x41ef('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x41ef('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x41ef('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x41ef('0x4')],'allowNull':![],'defaultValue':moment()['format'](_0x41ef('0x5'))}}; \ No newline at end of file +var _0xe85c=['YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE'];(function(_0x2f0d1a,_0x363763){var _0x4a71ab=function(_0x51a8ab){while(--_0x51a8ab){_0x2f0d1a['push'](_0x2f0d1a['shift']());}};_0x4a71ab(++_0x363763);}(_0xe85c,0x103));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xce85('0x0'));var moment=require(_0xce85('0x1'));module[_0xce85('0x2')]={'time':{'type':Sequelize[_0xce85('0x3')]},'callid':{'type':Sequelize[_0xce85('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xce85('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xce85('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xce85('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xce85('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xce85('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xce85('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xce85('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xce85('0x4')],'allowNull':![],'defaultValue':moment()['format'](_0xce85('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 2795c36..8fb05ec 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 _0x571f=['VIRTUAL','options','VoiceQueuesLog','include','findAll','show','params','rawAttributes','includeAll','find','create','body','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','error','stack','name','send','index','fieldName','type','model','map','keys','intersection','attributes','fields','query','hasOwnProperty','nolimit','sort','where','pick','merge'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x571f,0x16b));var _0xf571=function(_0x2a453b,_0x479c50){_0x2a453b=_0x2a453b-0x0;var _0x132f79=_0x571f[_0x2a453b];return _0x132f79;};'use strict';var emlformat=require(_0xf571('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf571('0x1'));var jsonpatch=require(_0xf571('0x2'));var rp=require(_0xf571('0x3'));var moment=require(_0xf571('0x4'));var BPromise=require(_0xf571('0x5'));var Mustache=require('mustache');var util=require(_0xf571('0x6'));var path=require(_0xf571('0x7'));var sox=require(_0xf571('0x8'));var csv=require(_0xf571('0x9'));var ejs=require(_0xf571('0xa'));var fs=require('fs');var fs_extra=require(_0xf571('0xb'));var _=require(_0xf571('0xc'));var squel=require(_0xf571('0xd'));var crypto=require(_0xf571('0xe'));var jsforce=require(_0xf571('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf571('0x10'));var Papa=require('papaparse');var Redis=require(_0xf571('0x11'));var authService=require(_0xf571('0x12'));var qs=require(_0xf571('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf571('0x14'))('api');var utils=require(_0xf571('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf571('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf295f7,_0x22175b){_0x22175b=_0x22175b||0xcc;return function(_0x471ff7){if(_0x471ff7){return _0xf295f7[_0xf571('0x17')](_0x22175b);}return _0xf295f7[_0xf571('0x18')](_0x22175b)[_0xf571('0x19')]();};}function respondWithResult(_0x55974a,_0x143b44){_0x143b44=_0x143b44||0xc8;return function(_0x23d205){if(_0x23d205){return _0x55974a[_0xf571('0x18')](_0x143b44)[_0xf571('0x1a')](_0x23d205);}};}function respondWithFilteredResult(_0x160f77,_0x570103){return function(_0x23eb19){if(_0x23eb19){var _0xd6d2db=typeof _0x570103[_0xf571('0x1b')]===_0xf571('0x1c')&&typeof _0x570103[_0xf571('0x1d')]===_0xf571('0x1c');var _0xc8c418=_0x23eb19[_0xf571('0x1e')];var _0x576445=_0xd6d2db?0x0:_0x570103[_0xf571('0x1b')];var _0x325427=_0xd6d2db?_0x23eb19[_0xf571('0x1e')]:_0x570103['offset']+_0x570103['limit'];var _0x5db7a6;if(_0x325427>=_0xc8c418){_0x325427=_0xc8c418;_0x5db7a6=0xc8;}else{_0x5db7a6=0xce;}_0x160f77[_0xf571('0x18')](_0x5db7a6);return _0x160f77[_0xf571('0x1f')]('Content-Range',_0x576445+'-'+_0x325427+'/'+_0xc8c418)['json'](_0x23eb19);}return null;};}function patchUpdates(_0x99ecc0){return function(_0x2ea4f3){try{jsonpatch['apply'](_0x2ea4f3,_0x99ecc0,!![]);}catch(_0x518796){return BPromise[_0xf571('0x20')](_0x518796);}return _0x2ea4f3[_0xf571('0x21')]();};}function saveUpdates(_0x7aeee0,_0xaf56d6){return function(_0x4ac415){if(_0x4ac415){return _0x4ac415[_0xf571('0x22')](_0x7aeee0)['then'](function(_0x4dd49f){return _0x4dd49f;});}return null;};}function removeEntity(_0x1daac9,_0xdf6b61){return function(_0x1d0c66){if(_0x1d0c66){return _0x1d0c66[_0xf571('0x23')]()[_0xf571('0x24')](function(){_0x1daac9[_0xf571('0x18')](0xcc)[_0xf571('0x19')]();});}};}function handleEntityNotFound(_0x4b27d0,_0x3e5a01){return function(_0x1a88c1){if(!_0x1a88c1){_0x4b27d0[_0xf571('0x17')](0x194);}return _0x1a88c1;};}function handleError(_0x49eaa0,_0x3f0f1f){_0x3f0f1f=_0x3f0f1f||0x1f4;return function(_0x115fa8){logger[_0xf571('0x25')](_0x115fa8[_0xf571('0x26')]);if(_0x115fa8[_0xf571('0x27')]){delete _0x115fa8[_0xf571('0x27')];}_0x49eaa0['status'](_0x3f0f1f)[_0xf571('0x28')](_0x115fa8);};}exports[_0xf571('0x29')]=function(_0x3de28a,_0x141ae5){var _0x409dbb={},_0x1564d0={},_0x536d29={'count':0x0,'rows':[]};var _0x3dc569=_['map'](db['VoiceQueuesLog']['rawAttributes'],function(_0x59ee21){return{'name':_0x59ee21[_0xf571('0x2a')],'type':_0x59ee21[_0xf571('0x2b')]['key']};});_0x1564d0[_0xf571('0x2c')]=_[_0xf571('0x2d')](_0x3dc569,'name');_0x1564d0['query']=_[_0xf571('0x2e')](_0x3de28a['query']);_0x1564d0['filters']=_[_0xf571('0x2f')](_0x1564d0['model'],_0x1564d0['query']);_0x409dbb[_0xf571('0x30')]=_[_0xf571('0x2f')](_0x1564d0[_0xf571('0x2c')],qs[_0xf571('0x31')](_0x3de28a['query'][_0xf571('0x31')]));_0x409dbb[_0xf571('0x30')]=_0x409dbb[_0xf571('0x30')]['length']?_0x409dbb[_0xf571('0x30')]:_0x1564d0[_0xf571('0x2c')];if(!_0x3de28a[_0xf571('0x32')][_0xf571('0x33')](_0xf571('0x34'))){_0x409dbb[_0xf571('0x1d')]=qs[_0xf571('0x1d')](_0x3de28a[_0xf571('0x32')]['limit']);_0x409dbb['offset']=qs[_0xf571('0x1b')](_0x3de28a[_0xf571('0x32')][_0xf571('0x1b')]);}_0x409dbb['order']=qs[_0xf571('0x35')](_0x3de28a[_0xf571('0x32')]['sort']);_0x409dbb[_0xf571('0x36')]=qs['filters'](_[_0xf571('0x37')](_0x3de28a[_0xf571('0x32')],_0x1564d0['filters']),_0x3dc569);if(_0x3de28a[_0xf571('0x32')]['filter']){_0x409dbb[_0xf571('0x36')]=_[_0xf571('0x38')](_0x409dbb[_0xf571('0x36')],{'$or':_['map'](_0x3dc569,function(_0x4a239f){if(_0x4a239f[_0xf571('0x2b')]!==_0xf571('0x39')){var _0xab3c3d={};_0xab3c3d[_0x4a239f[_0xf571('0x27')]]={'$like':'%'+_0x3de28a['query']['filter']+'%'};return _0xab3c3d;}})});}_0x409dbb=_[_0xf571('0x38')]({},_0x409dbb,_0x3de28a[_0xf571('0x3a')]);var _0x52c3a9={'where':_0x409dbb[_0xf571('0x36')]};return db[_0xf571('0x3b')][_0xf571('0x1e')](_0x52c3a9)[_0xf571('0x24')](function(_0x45d949){_0x536d29[_0xf571('0x1e')]=_0x45d949;if(_0x3de28a[_0xf571('0x32')]['includeAll']){_0x409dbb[_0xf571('0x3c')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xf571('0x3d')](_0x409dbb);})[_0xf571('0x24')](function(_0x2565d8){_0x536d29['rows']=_0x2565d8;return _0x536d29;})['then'](respondWithFilteredResult(_0x141ae5,_0x409dbb))['catch'](handleError(_0x141ae5,null));};exports[_0xf571('0x3e')]=function(_0x48154d,_0x3efe16){var _0x51a87a={'raw':!![],'where':{'id':_0x48154d[_0xf571('0x3f')]['id']}},_0x5d0aef={};_0x5d0aef['model']=_[_0xf571('0x2e')](db[_0xf571('0x3b')][_0xf571('0x40')]);_0x5d0aef[_0xf571('0x32')]=_[_0xf571('0x2e')](_0x48154d[_0xf571('0x32')]);_0x5d0aef['filters']=_[_0xf571('0x2f')](_0x5d0aef[_0xf571('0x2c')],_0x5d0aef[_0xf571('0x32')]);_0x51a87a[_0xf571('0x30')]=_[_0xf571('0x2f')](_0x5d0aef[_0xf571('0x2c')],qs[_0xf571('0x31')](_0x48154d[_0xf571('0x32')][_0xf571('0x31')]));_0x51a87a[_0xf571('0x30')]=_0x51a87a['attributes']['length']?_0x51a87a[_0xf571('0x30')]:_0x5d0aef['model'];if(_0x48154d[_0xf571('0x32')][_0xf571('0x41')]){_0x51a87a['include']=[{'all':!![]}];}_0x51a87a=_[_0xf571('0x38')]({},_0x51a87a,_0x48154d[_0xf571('0x3a')]);return db['VoiceQueuesLog'][_0xf571('0x42')](_0x51a87a)[_0xf571('0x24')](handleEntityNotFound(_0x3efe16,null))['then'](respondWithResult(_0x3efe16,null))['catch'](handleError(_0x3efe16,null));};exports[_0xf571('0x43')]=function(_0x2072d6,_0x58de96){return db[_0xf571('0x3b')][_0xf571('0x43')](_0x2072d6[_0xf571('0x44')],{})[_0xf571('0x24')](respondWithResult(_0x58de96,0xc9))[_0xf571('0x45')](handleError(_0x58de96,null));};exports[_0xf571('0x22')]=function(_0x1835de,_0x10111a){if(_0x1835de['body']['id']){delete _0x1835de[_0xf571('0x44')]['id'];}return db[_0xf571('0x3b')][_0xf571('0x42')]({'where':{'id':_0x1835de[_0xf571('0x3f')]['id']}})['then'](handleEntityNotFound(_0x10111a,null))[_0xf571('0x24')](saveUpdates(_0x1835de[_0xf571('0x44')],null))[_0xf571('0x24')](respondWithResult(_0x10111a,null))[_0xf571('0x45')](handleError(_0x10111a,null));};exports[_0xf571('0x23')]=function(_0x1b85a7,_0x265f44){return db['VoiceQueuesLog'][_0xf571('0x42')]({'where':{'id':_0x1b85a7[_0xf571('0x3f')]['id']}})[_0xf571('0x24')](handleEntityNotFound(_0x265f44,null))[_0xf571('0x24')](removeEntity(_0x265f44,null))['catch'](handleError(_0x265f44,null));}; \ No newline at end of file +var _0x1e78=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','rows','show','includeAll','include','find','create','body','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','update','then','destroy','error','stack','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','key','model','query'];(function(_0x4ac85a,_0x644ea){var _0x585481=function(_0x4b428e){while(--_0x4b428e){_0x4ac85a['push'](_0x4ac85a['shift']());}};_0x585481(++_0x644ea);}(_0x1e78,0x1b2));var _0x81e7=function(_0x3ee467,_0x4974b8){_0x3ee467=_0x3ee467-0x0;var _0x3ca182=_0x1e78[_0x3ee467];return _0x3ca182;};'use strict';var emlformat=require(_0x81e7('0x0'));var rimraf=require(_0x81e7('0x1'));var zipdir=require(_0x81e7('0x2'));var jsonpatch=require(_0x81e7('0x3'));var rp=require(_0x81e7('0x4'));var moment=require(_0x81e7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x81e7('0x6'));var util=require(_0x81e7('0x7'));var path=require(_0x81e7('0x8'));var sox=require(_0x81e7('0x9'));var csv=require(_0x81e7('0xa'));var ejs=require(_0x81e7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x81e7('0xc'));var squel=require('squel');var crypto=require(_0x81e7('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x81e7('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x81e7('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x81e7('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x81e7('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x81e7('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b2fbc,_0x424541){_0x424541=_0x424541||0xcc;return function(_0x33f80a){if(_0x33f80a){return _0x5b2fbc[_0x81e7('0x12')](_0x424541);}return _0x5b2fbc[_0x81e7('0x13')](_0x424541)[_0x81e7('0x14')]();};}function respondWithResult(_0x401614,_0x3b94eb){_0x3b94eb=_0x3b94eb||0xc8;return function(_0x2f3d66){if(_0x2f3d66){return _0x401614[_0x81e7('0x13')](_0x3b94eb)[_0x81e7('0x15')](_0x2f3d66);}};}function respondWithFilteredResult(_0x3a84f5,_0x50bdd2){return function(_0x563f98){if(_0x563f98){var _0x3a9d2a=typeof _0x50bdd2['offset']===_0x81e7('0x16')&&typeof _0x50bdd2[_0x81e7('0x17')]===_0x81e7('0x16');var _0x451d2f=_0x563f98[_0x81e7('0x18')];var _0x52a919=_0x3a9d2a?0x0:_0x50bdd2[_0x81e7('0x19')];var _0x5c560d=_0x3a9d2a?_0x563f98[_0x81e7('0x18')]:_0x50bdd2['offset']+_0x50bdd2[_0x81e7('0x17')];var _0x16f05f;if(_0x5c560d>=_0x451d2f){_0x5c560d=_0x451d2f;_0x16f05f=0xc8;}else{_0x16f05f=0xce;}_0x3a84f5[_0x81e7('0x13')](_0x16f05f);return _0x3a84f5['set'](_0x81e7('0x1a'),_0x52a919+'-'+_0x5c560d+'/'+_0x451d2f)['json'](_0x563f98);}return null;};}function patchUpdates(_0x39fe10){return function(_0x563c60){try{jsonpatch[_0x81e7('0x1b')](_0x563c60,_0x39fe10,!![]);}catch(_0xd88872){return BPromise['reject'](_0xd88872);}return _0x563c60['save']();};}function saveUpdates(_0x27fff2,_0x2657fd){return function(_0x8394ee){if(_0x8394ee){return _0x8394ee[_0x81e7('0x1c')](_0x27fff2)[_0x81e7('0x1d')](function(_0x538eec){return _0x538eec;});}return null;};}function removeEntity(_0x59e08d,_0x35eeda){return function(_0x4f7949){if(_0x4f7949){return _0x4f7949[_0x81e7('0x1e')]()[_0x81e7('0x1d')](function(){_0x59e08d['status'](0xcc)[_0x81e7('0x14')]();});}};}function handleEntityNotFound(_0x462b5e,_0x57dd68){return function(_0x51a867){if(!_0x51a867){_0x462b5e['sendStatus'](0x194);}return _0x51a867;};}function handleError(_0x95cb35,_0x2ddc98){_0x2ddc98=_0x2ddc98||0x1f4;return function(_0x26c82f){logger[_0x81e7('0x1f')](_0x26c82f[_0x81e7('0x20')]);if(_0x26c82f[_0x81e7('0x21')]){delete _0x26c82f[_0x81e7('0x21')];}_0x95cb35[_0x81e7('0x13')](_0x2ddc98)[_0x81e7('0x22')](_0x26c82f);};}exports['index']=function(_0x407762,_0x2de15c){var _0x25f8c0={},_0x169291={},_0x2f95d7={'count':0x0,'rows':[]};var _0x3e6845=_[_0x81e7('0x23')](db[_0x81e7('0x24')][_0x81e7('0x25')],function(_0x529c2e){return{'name':_0x529c2e[_0x81e7('0x26')],'type':_0x529c2e['type'][_0x81e7('0x27')]};});_0x169291[_0x81e7('0x28')]=_['map'](_0x3e6845,_0x81e7('0x21'));_0x169291[_0x81e7('0x29')]=_[_0x81e7('0x2a')](_0x407762['query']);_0x169291[_0x81e7('0x2b')]=_[_0x81e7('0x2c')](_0x169291['model'],_0x169291[_0x81e7('0x29')]);_0x25f8c0[_0x81e7('0x2d')]=_[_0x81e7('0x2c')](_0x169291[_0x81e7('0x28')],qs[_0x81e7('0x2e')](_0x407762[_0x81e7('0x29')]['fields']));_0x25f8c0[_0x81e7('0x2d')]=_0x25f8c0[_0x81e7('0x2d')][_0x81e7('0x2f')]?_0x25f8c0[_0x81e7('0x2d')]:_0x169291[_0x81e7('0x28')];if(!_0x407762['query'][_0x81e7('0x30')](_0x81e7('0x31'))){_0x25f8c0['limit']=qs[_0x81e7('0x17')](_0x407762['query'][_0x81e7('0x17')]);_0x25f8c0[_0x81e7('0x19')]=qs[_0x81e7('0x19')](_0x407762[_0x81e7('0x29')]['offset']);}_0x25f8c0[_0x81e7('0x32')]=qs[_0x81e7('0x33')](_0x407762['query'][_0x81e7('0x33')]);_0x25f8c0[_0x81e7('0x34')]=qs[_0x81e7('0x2b')](_[_0x81e7('0x35')](_0x407762[_0x81e7('0x29')],_0x169291[_0x81e7('0x2b')]),_0x3e6845);if(_0x407762['query'][_0x81e7('0x36')]){_0x25f8c0[_0x81e7('0x34')]=_['merge'](_0x25f8c0[_0x81e7('0x34')],{'$or':_[_0x81e7('0x23')](_0x3e6845,function(_0xf13a29){if(_0xf13a29[_0x81e7('0x37')]!==_0x81e7('0x38')){var _0x12bf7a={};_0x12bf7a[_0xf13a29[_0x81e7('0x21')]]={'$like':'%'+_0x407762['query'][_0x81e7('0x36')]+'%'};return _0x12bf7a;}})});}_0x25f8c0=_[_0x81e7('0x39')]({},_0x25f8c0,_0x407762[_0x81e7('0x3a')]);var _0x39ed6d={'where':_0x25f8c0[_0x81e7('0x34')]};return db[_0x81e7('0x24')]['count'](_0x39ed6d)['then'](function(_0x55ea38){_0x2f95d7['count']=_0x55ea38;if(_0x407762[_0x81e7('0x29')]['includeAll']){_0x25f8c0['include']=[{'all':!![]}];}return db['VoiceQueuesLog']['findAll'](_0x25f8c0);})[_0x81e7('0x1d')](function(_0x326511){_0x2f95d7[_0x81e7('0x3b')]=_0x326511;return _0x2f95d7;})['then'](respondWithFilteredResult(_0x2de15c,_0x25f8c0))['catch'](handleError(_0x2de15c,null));};exports[_0x81e7('0x3c')]=function(_0x689a47,_0x53fdda){var _0x2cdd8a={'raw':!![],'where':{'id':_0x689a47['params']['id']}},_0x440a4e={};_0x440a4e[_0x81e7('0x28')]=_[_0x81e7('0x2a')](db[_0x81e7('0x24')][_0x81e7('0x25')]);_0x440a4e['query']=_[_0x81e7('0x2a')](_0x689a47[_0x81e7('0x29')]);_0x440a4e[_0x81e7('0x2b')]=_[_0x81e7('0x2c')](_0x440a4e[_0x81e7('0x28')],_0x440a4e[_0x81e7('0x29')]);_0x2cdd8a[_0x81e7('0x2d')]=_[_0x81e7('0x2c')](_0x440a4e['model'],qs['fields'](_0x689a47['query']['fields']));_0x2cdd8a['attributes']=_0x2cdd8a['attributes'][_0x81e7('0x2f')]?_0x2cdd8a[_0x81e7('0x2d')]:_0x440a4e[_0x81e7('0x28')];if(_0x689a47['query'][_0x81e7('0x3d')]){_0x2cdd8a[_0x81e7('0x3e')]=[{'all':!![]}];}_0x2cdd8a=_['merge']({},_0x2cdd8a,_0x689a47[_0x81e7('0x3a')]);return db['VoiceQueuesLog'][_0x81e7('0x3f')](_0x2cdd8a)[_0x81e7('0x1d')](handleEntityNotFound(_0x53fdda,null))[_0x81e7('0x1d')](respondWithResult(_0x53fdda,null))['catch'](handleError(_0x53fdda,null));};exports[_0x81e7('0x40')]=function(_0x17e221,_0x41e410){return db[_0x81e7('0x24')]['create'](_0x17e221[_0x81e7('0x41')],{})[_0x81e7('0x1d')](respondWithResult(_0x41e410,0xc9))[_0x81e7('0x42')](handleError(_0x41e410,null));};exports[_0x81e7('0x1c')]=function(_0x11a961,_0x322f6a){if(_0x11a961[_0x81e7('0x41')]['id']){delete _0x11a961[_0x81e7('0x41')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x11a961[_0x81e7('0x43')]['id']}})[_0x81e7('0x1d')](handleEntityNotFound(_0x322f6a,null))[_0x81e7('0x1d')](saveUpdates(_0x11a961[_0x81e7('0x41')],null))[_0x81e7('0x1d')](respondWithResult(_0x322f6a,null))[_0x81e7('0x42')](handleError(_0x322f6a,null));};exports[_0x81e7('0x1e')]=function(_0xd3357e,_0x1b6e9c){return db['VoiceQueuesLog']['find']({'where':{'id':_0xd3357e['params']['id']}})['then'](handleEntityNotFound(_0x1b6e9c,null))[_0x81e7('0x1d')](removeEntity(_0x1b6e9c,null))[_0x81e7('0x42')](handleError(_0x1b6e9c,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 14481d3..8d27fe9 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 _0xd086=['voice_queues_log','event_dtm','event','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceQueuesLog'];(function(_0x26692c,_0x1a53fb){var _0x39994c=function(_0x3d6f6c){while(--_0x3d6f6c){_0x26692c['push'](_0x26692c['shift']());}};_0x39994c(++_0x1a53fb);}(_0xd086,0x1df));var _0x6d08=function(_0x5f4c25,_0x2d6cdc){_0x5f4c25=_0x5f4c25-0x0;var _0x2bfecf=_0xd086[_0x5f4c25];return _0x2bfecf;};'use strict';var _=require('lodash');var util=require(_0x6d08('0x0'));var logger=require(_0x6d08('0x1'))(_0x6d08('0x2'));var moment=require(_0x6d08('0x3'));var BPromise=require(_0x6d08('0x4'));var rp=require(_0x6d08('0x5'));var fs=require('fs');var path=require(_0x6d08('0x6'));var rimraf=require(_0x6d08('0x7'));var config=require(_0x6d08('0x8'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x6fc0ca,_0x68232a){return _0x6fc0ca[_0x6d08('0x9')](_0x6d08('0xa'),attributes,{'tableName':_0x6d08('0xb'),'paranoid':![],'indexes':[{'name':_0x6d08('0xc'),'fields':[_0x6d08('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x9251=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','event','dtm','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9251,0x1e6));var _0x1925=function(_0x33975c,_0x50d085){_0x33975c=_0x33975c-0x0;var _0x1c15ab=_0x9251[_0x33975c];return _0x1c15ab;};'use strict';var _=require('lodash');var util=require(_0x1925('0x0'));var logger=require(_0x1925('0x1'))(_0x1925('0x2'));var moment=require(_0x1925('0x3'));var BPromise=require(_0x1925('0x4'));var rp=require(_0x1925('0x5'));var fs=require('fs');var path=require(_0x1925('0x6'));var rimraf=require(_0x1925('0x7'));var config=require(_0x1925('0x8'));var attributes=require(_0x1925('0x9'));module['exports']=function(_0x24af68,_0xe3c3a5){return _0x24af68[_0x1925('0xa')](_0x1925('0xb'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x1925('0xc'),_0x1925('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 2384b96..1399280 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 _0x5755=['http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1b5208,_0x589209){var _0x57f052=function(_0x8d7682){while(--_0x8d7682){_0x1b5208['push'](_0x1b5208['shift']());}};_0x57f052(++_0x589209);}(_0x5755,0x8f));var _0x5575=function(_0x43a84a,_0x6c500e){_0x43a84a=_0x43a84a-0x0;var _0x2ed43a=_0x5755[_0x43a84a];return _0x2ed43a;};'use strict';var _=require('lodash');var util=require(_0x5575('0x0'));var moment=require(_0x5575('0x1'));var BPromise=require(_0x5575('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5575('0x3'));var db=require(_0x5575('0x4'))['db'];var utils=require(_0x5575('0x5'));var logger=require(_0x5575('0x6'))(_0x5575('0x7'));var config=require(_0x5575('0x8'));var jayson=require(_0x5575('0x9'));var client=jayson[_0x5575('0xa')][_0x5575('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1919cf,_0x22e768,_0x418953){return new BPromise(function(_0x8d007e,_0x500805){return client['request'](_0x1919cf,_0x418953)[_0x5575('0xc')](function(_0x7aa9ca){logger[_0x5575('0xd')](_0x5575('0xe'),_0x22e768,_0x5575('0xf'));logger[_0x5575('0x10')](_0x5575('0x11'),_0x22e768,_0x5575('0xf'),JSON['stringify'](_0x7aa9ca));if(_0x7aa9ca[_0x5575('0x12')]){if(_0x7aa9ca[_0x5575('0x12')]['code']===0x1f4){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x22e768,_0x7aa9ca['error'][_0x5575('0x13')]);return _0x500805(_0x7aa9ca[_0x5575('0x12')][_0x5575('0x13')]);}logger[_0x5575('0x12')](_0x5575('0xe'),_0x22e768,_0x7aa9ca['error']['message']);return _0x8d007e(_0x7aa9ca[_0x5575('0x12')]['message']);}else{logger['info'](_0x5575('0xe'),_0x22e768,_0x5575('0xf'));_0x8d007e(_0x7aa9ca[_0x5575('0x14')][_0x5575('0x13')]);}})[_0x5575('0x15')](function(_0x55c668){logger['error'](_0x5575('0xe'),_0x22e768,_0x55c668);_0x500805(_0x55c668);});});} \ No newline at end of file +var _0xba78=['message','result','catch','lodash','moment','bluebird','ioredis','../../config/logger','rpc','client','http','request','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x4f1981,_0x502ed6){var _0x289889=function(_0x1dba22){while(--_0x1dba22){_0x4f1981['push'](_0x4f1981['shift']());}};_0x289889(++_0x502ed6);}(_0xba78,0x159));var _0x8ba7=function(_0x140521,_0x5295e2){_0x140521=_0x140521-0x0;var _0x257e78=_0xba78[_0x140521];return _0x257e78;};'use strict';var _=require(_0x8ba7('0x0'));var util=require('util');var moment=require(_0x8ba7('0x1'));var BPromise=require(_0x8ba7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8ba7('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8ba7('0x4'))(_0x8ba7('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8ba7('0x6')][_0x8ba7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5d310e,_0x2c0180,_0x1e33fb){return new BPromise(function(_0x276d74,_0x429d6b){return client[_0x8ba7('0x8')](_0x5d310e,_0x1e33fb)['then'](function(_0xdafa31){logger[_0x8ba7('0x9')](_0x8ba7('0xa'),_0x2c0180,_0x8ba7('0xb'));logger[_0x8ba7('0xc')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x2c0180,_0x8ba7('0xb'),JSON['stringify'](_0xdafa31));if(_0xdafa31[_0x8ba7('0xd')]){if(_0xdafa31[_0x8ba7('0xd')][_0x8ba7('0xe')]===0x1f4){logger[_0x8ba7('0xd')](_0x8ba7('0xa'),_0x2c0180,_0xdafa31[_0x8ba7('0xd')][_0x8ba7('0xf')]);return _0x429d6b(_0xdafa31['error'][_0x8ba7('0xf')]);}logger[_0x8ba7('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2c0180,_0xdafa31['error'][_0x8ba7('0xf')]);return _0x276d74(_0xdafa31[_0x8ba7('0xd')][_0x8ba7('0xf')]);}else{logger['info'](_0x8ba7('0xa'),_0x2c0180,_0x8ba7('0xb'));_0x276d74(_0xdafa31[_0x8ba7('0x10')][_0x8ba7('0xf')]);}})[_0x8ba7('0x11')](function(_0x554991){logger[_0x8ba7('0xd')](_0x8ba7('0xa'),_0x2c0180,_0x554991);_0x429d6b(_0x554991);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index a10018f..33ddfe6 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 _0x91bd=['/:id/transcribe','post','runTranscribe','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','downloads'];(function(_0x1d6394,_0x45c8b6){var _0x14fcdd=function(_0x302fee){while(--_0x302fee){_0x1d6394['push'](_0x1d6394['shift']());}};_0x14fcdd(++_0x45c8b6);}(_0x91bd,0x1c7));var _0xd91b=function(_0x53afa6,_0x59e786){_0x53afa6=_0x53afa6-0x0;var _0x51f86a=_0x91bd[_0x53afa6];return _0x51f86a;};'use strict';var multer=require(_0xd91b('0x0'));var util=require(_0xd91b('0x1'));var path=require(_0xd91b('0x2'));var timeout=require(_0xd91b('0x3'));var express=require('express');var router=express[_0xd91b('0x4')]();var fs_extra=require(_0xd91b('0x5'));var auth=require(_0xd91b('0x6'));var interaction=require(_0xd91b('0x7'));var config=require(_0xd91b('0x8'));var controller=require(_0xd91b('0x9'));router[_0xd91b('0xa')]('/',auth[_0xd91b('0xb')](),controller[_0xd91b('0xc')]);router[_0xd91b('0xa')](_0xd91b('0xd'),auth[_0xd91b('0xb')](),controller[_0xd91b('0xe')]);router[_0xd91b('0xa')](_0xd91b('0xf'),auth['isAuthenticated'](),controller[_0xd91b('0x10')]);router[_0xd91b('0xa')](_0xd91b('0x11'),auth['isAuthenticated'](),controller[_0xd91b('0x12')]);router[_0xd91b('0xa')](_0xd91b('0x13'),controller[_0xd91b('0x14')]);router[_0xd91b('0xa')](_0xd91b('0x15'),auth[_0xd91b('0xb')](),controller['downloadTranscribe']);router[_0xd91b('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd91b('0x16')](_0xd91b('0x15'),auth[_0xd91b('0xb')](),controller[_0xd91b('0x17')]);router['put'](_0xd91b('0xf'),auth['isAuthenticated'](),controller[_0xd91b('0x18')]);router[_0xd91b('0x19')](_0xd91b('0xf'),auth[_0xd91b('0xb')](),controller[_0xd91b('0x1a')]);module[_0xd91b('0x1b')]=router; \ No newline at end of file +var _0xc6d2=['get','/describe','describe','/:id','/:id/download','download','downloads','/:id/transcribe','downloadTranscribe','create','post','runTranscribe','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','isAuthenticated','index'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0xc6d2,0x17d));var _0x2c6d=function(_0x3f1541,_0x331819){_0x3f1541=_0x3f1541-0x0;var _0x2d9e19=_0xc6d2[_0x3f1541];return _0x2d9e19;};'use strict';var multer=require(_0x2c6d('0x0'));var util=require(_0x2c6d('0x1'));var path=require(_0x2c6d('0x2'));var timeout=require(_0x2c6d('0x3'));var express=require(_0x2c6d('0x4'));var router=express[_0x2c6d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2c6d('0x6'));var interaction=require(_0x2c6d('0x7'));var config=require('../../config/environment');var controller=require(_0x2c6d('0x8'));router['get']('/',auth[_0x2c6d('0x9')](),controller[_0x2c6d('0xa')]);router[_0x2c6d('0xb')](_0x2c6d('0xc'),auth[_0x2c6d('0x9')](),controller[_0x2c6d('0xd')]);router[_0x2c6d('0xb')](_0x2c6d('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x2c6d('0xb')](_0x2c6d('0xf'),auth['isAuthenticated'](),controller[_0x2c6d('0x10')]);router[_0x2c6d('0xb')]('/:id/downloads',controller[_0x2c6d('0x11')]);router['get'](_0x2c6d('0x12'),auth[_0x2c6d('0x9')](),controller[_0x2c6d('0x13')]);router['post']('/',auth[_0x2c6d('0x9')](),controller[_0x2c6d('0x14')]);router[_0x2c6d('0x15')](_0x2c6d('0x12'),auth[_0x2c6d('0x9')](),controller[_0x2c6d('0x16')]);router[_0x2c6d('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x2c6d('0x18')]);router[_0x2c6d('0x19')](_0x2c6d('0xe'),auth[_0x2c6d('0x9')](),controller[_0x2c6d('0x1a')]);module[_0x2c6d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index c48919e..87d213e 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(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 07e60a9..923acf7 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 _0x0b50=['end','json','undefined','limit','count','offset','set','apply','update','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','format','query','keys','attributes','fields','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','VoiceRecording','findAll','rows','catch','show','params','intersection','length','find','create','body','describe','download','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','extname','unlink','message','Not\x20found','../../components/encryptor','sequelize','MD5','token','$and','push','filename','destroy','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','transcribeName','TranscriptionJob','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','transcribe','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status'];(function(_0x55a46d,_0x996266){var _0x262e6f=function(_0x19881f){while(--_0x19881f){_0x55a46d['push'](_0x55a46d['shift']());}};_0x262e6f(++_0x996266);}(_0x0b50,0x116));var _0x00b5=function(_0x4907de,_0x5bbdc6){_0x4907de=_0x4907de-0x0;var _0x482054=_0x0b50[_0x4907de];return _0x482054;};'use strict';var emlformat=require(_0x00b5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x00b5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x00b5('0x2'));var BPromise=require(_0x00b5('0x3'));var Mustache=require(_0x00b5('0x4'));var util=require('util');var path=require(_0x00b5('0x5'));var sox=require('sox');var csv=require(_0x00b5('0x6'));var ejs=require(_0x00b5('0x7'));var fs=require('fs');var fs_extra=require(_0x00b5('0x8'));var _=require(_0x00b5('0x9'));var squel=require(_0x00b5('0xa'));var crypto=require(_0x00b5('0xb'));var jsforce=require(_0x00b5('0xc'));var deskjs=require(_0x00b5('0xd'));var toCsv=require(_0x00b5('0x6'));var querystring=require(_0x00b5('0xe'));var Papa=require(_0x00b5('0xf'));var AWS=require('aws-sdk');var uuidv4=require(_0x00b5('0x10'));var Redis=require(_0x00b5('0x11'));var authService=require(_0x00b5('0x12'));var qs=require(_0x00b5('0x13'));var as=require(_0x00b5('0x14'));var hardwareService=require(_0x00b5('0x15'));var logger=require(_0x00b5('0x16'))(_0x00b5('0x17'));var utils=require(_0x00b5('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x00b5('0x19'));var db=require(_0x00b5('0x1a'))['db'];function respondWithStatusCode(_0x2cde2e,_0x403928){_0x403928=_0x403928||0xcc;return function(_0x3fc731){if(_0x3fc731){return _0x2cde2e['sendStatus'](_0x403928);}return _0x2cde2e[_0x00b5('0x1b')](_0x403928)[_0x00b5('0x1c')]();};}function respondWithResult(_0x44784b,_0x2e6091){_0x2e6091=_0x2e6091||0xc8;return function(_0x541d82){if(_0x541d82){return _0x44784b[_0x00b5('0x1b')](_0x2e6091)[_0x00b5('0x1d')](_0x541d82);}};}function respondWithFilteredResult(_0x2218bb,_0x15b64a){return function(_0x447e09){if(_0x447e09){var _0x5504ae=typeof _0x15b64a['offset']===_0x00b5('0x1e')&&typeof _0x15b64a[_0x00b5('0x1f')]===_0x00b5('0x1e');var _0x1cf9f8=_0x447e09[_0x00b5('0x20')];var _0x41588c=_0x5504ae?0x0:_0x15b64a[_0x00b5('0x21')];var _0x565782=_0x5504ae?_0x447e09['count']:_0x15b64a[_0x00b5('0x21')]+_0x15b64a[_0x00b5('0x1f')];var _0x5a5d48;if(_0x565782>=_0x1cf9f8){_0x565782=_0x1cf9f8;_0x5a5d48=0xc8;}else{_0x5a5d48=0xce;}_0x2218bb['status'](_0x5a5d48);return _0x2218bb[_0x00b5('0x22')]('Content-Range',_0x41588c+'-'+_0x565782+'/'+_0x1cf9f8)['json'](_0x447e09);}return null;};}function patchUpdates(_0x1269f2){return function(_0x3747a4){try{jsonpatch[_0x00b5('0x23')](_0x3747a4,_0x1269f2,!![]);}catch(_0x7410a5){return BPromise['reject'](_0x7410a5);}return _0x3747a4['save']();};}function saveUpdates(_0xa7a1e8,_0x59d401){return function(_0x4518fa){if(_0x4518fa){return _0x4518fa[_0x00b5('0x24')](_0xa7a1e8)[_0x00b5('0x25')](function(_0xcf3e1e){return _0xcf3e1e;});}return null;};}function removeEntity(_0x53f7e6,_0x4827a3){return function(_0x258ef9){if(_0x258ef9){return _0x258ef9['destroy']()[_0x00b5('0x25')](function(){_0x53f7e6[_0x00b5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x418dce,_0x2245da){return function(_0x10dbd5){if(!_0x10dbd5){_0x418dce[_0x00b5('0x26')](0x194);}return _0x10dbd5;};}function handleError(_0x2fcd1e,_0x43edd6){_0x43edd6=_0x43edd6||0x1f4;return function(_0x2b7eca){logger[_0x00b5('0x27')](_0x2b7eca['stack']);if(_0x2b7eca[_0x00b5('0x28')]){delete _0x2b7eca[_0x00b5('0x28')];}_0x2fcd1e[_0x00b5('0x1b')](_0x43edd6)[_0x00b5('0x29')](_0x2b7eca);};}exports[_0x00b5('0x2a')]=function(_0x52283,_0x280ad9){var _0x37157a={},_0x3b7900={},_0x2fb1ee={'count':0x0,'rows':[]};var _0x1c6819=_[_0x00b5('0x2b')](db['VoiceRecording'][_0x00b5('0x2c')],function(_0x490d13){return{'name':_0x490d13[_0x00b5('0x2d')],'type':_0x490d13[_0x00b5('0x2e')][_0x00b5('0x2f')]};});_0x3b7900[_0x00b5('0x30')]=_['differenceBy'](_[_0x00b5('0x2b')](_0x1c6819,_0x00b5('0x28')),[_0x00b5('0x31')]);_0x3b7900[_0x00b5('0x32')]=_[_0x00b5('0x33')](_0x52283[_0x00b5('0x32')]);_0x3b7900['filters']=_['intersection'](_0x3b7900[_0x00b5('0x30')],_0x3b7900[_0x00b5('0x32')]);_0x37157a[_0x00b5('0x34')]=_['intersection'](_0x3b7900[_0x00b5('0x30')],qs[_0x00b5('0x35')](_0x52283[_0x00b5('0x32')]['fields']));_0x37157a['attributes']=_0x37157a['attributes']['length']?_0x37157a[_0x00b5('0x34')]:_0x3b7900['model'];if(!_0x52283[_0x00b5('0x32')]['hasOwnProperty'](_0x00b5('0x36'))){_0x37157a[_0x00b5('0x1f')]=qs[_0x00b5('0x1f')](_0x52283['query'][_0x00b5('0x1f')]);_0x37157a[_0x00b5('0x21')]=qs[_0x00b5('0x21')](_0x52283[_0x00b5('0x32')][_0x00b5('0x21')]);}_0x37157a[_0x00b5('0x37')]=qs[_0x00b5('0x38')](_0x52283['query'][_0x00b5('0x38')]);_0x37157a[_0x00b5('0x39')]=qs[_0x00b5('0x3a')](_[_0x00b5('0x3b')](_0x52283[_0x00b5('0x32')],_0x3b7900[_0x00b5('0x3a')]),_0x1c6819);if(_0x52283[_0x00b5('0x32')]['filter']){_0x37157a[_0x00b5('0x39')]=_['merge'](_0x37157a[_0x00b5('0x39')],{'$or':_[_0x00b5('0x2b')](_0x1c6819,function(_0x57204d){if(_0x57204d[_0x00b5('0x2e')]!==_0x00b5('0x3c')){var _0x439178={};_0x439178[_0x57204d[_0x00b5('0x28')]]={'$like':'%'+_0x52283[_0x00b5('0x32')]['filter']+'%'};return _0x439178;}})});}_0x37157a=_[_0x00b5('0x3d')]({},_0x37157a,_0x52283[_0x00b5('0x3e')]);var _0x1fcc5b={'where':_0x37157a[_0x00b5('0x39')]};return db['VoiceRecording']['count'](_0x1fcc5b)[_0x00b5('0x25')](function(_0x590037){_0x2fb1ee[_0x00b5('0x20')]=_0x590037;if(_0x52283[_0x00b5('0x32')][_0x00b5('0x3f')]){_0x37157a[_0x00b5('0x40')]=[{'all':!![]}];}return db[_0x00b5('0x41')][_0x00b5('0x42')](_0x37157a);})['then'](function(_0x49e29b){_0x2fb1ee[_0x00b5('0x43')]=_0x49e29b;return _0x2fb1ee;})[_0x00b5('0x25')](respondWithFilteredResult(_0x280ad9,_0x37157a))[_0x00b5('0x44')](handleError(_0x280ad9,null));};exports[_0x00b5('0x45')]=function(_0x36ea2d,_0x46e666){var _0x2adbf4={'raw':![],'where':{'id':_0x36ea2d[_0x00b5('0x46')]['id']}},_0x4d47b5={};_0x4d47b5[_0x00b5('0x30')]=_['keys'](db[_0x00b5('0x41')][_0x00b5('0x2c')]);_0x4d47b5[_0x00b5('0x32')]=_[_0x00b5('0x33')](_0x36ea2d[_0x00b5('0x32')]);_0x4d47b5[_0x00b5('0x3a')]=_[_0x00b5('0x47')](_0x4d47b5[_0x00b5('0x30')],_0x4d47b5[_0x00b5('0x32')]);_0x2adbf4[_0x00b5('0x34')]=_[_0x00b5('0x47')](_0x4d47b5[_0x00b5('0x30')],qs[_0x00b5('0x35')](_0x36ea2d['query'][_0x00b5('0x35')]));_0x2adbf4[_0x00b5('0x34')]=_0x2adbf4[_0x00b5('0x34')][_0x00b5('0x48')]?_0x2adbf4[_0x00b5('0x34')]:_0x4d47b5[_0x00b5('0x30')];if(_0x36ea2d['query'][_0x00b5('0x3f')]){_0x2adbf4['include']=[{'all':!![]}];}_0x2adbf4=_[_0x00b5('0x3d')]({},_0x2adbf4,_0x36ea2d[_0x00b5('0x3e')]);return db[_0x00b5('0x41')][_0x00b5('0x49')](_0x2adbf4)[_0x00b5('0x25')](handleEntityNotFound(_0x46e666,null))[_0x00b5('0x25')](respondWithResult(_0x46e666,null))[_0x00b5('0x44')](handleError(_0x46e666,null));};exports['create']=function(_0xdba963,_0x510b27){return db['VoiceRecording'][_0x00b5('0x4a')](_0xdba963[_0x00b5('0x4b')],{})[_0x00b5('0x25')](respondWithResult(_0x510b27,0xc9))[_0x00b5('0x44')](handleError(_0x510b27,null));};exports['update']=function(_0x2e0abc,_0x58c6f2){if(_0x2e0abc[_0x00b5('0x4b')]['id']){delete _0x2e0abc['body']['id'];}return db[_0x00b5('0x41')][_0x00b5('0x49')]({'where':{'id':_0x2e0abc['params']['id']}})[_0x00b5('0x25')](handleEntityNotFound(_0x58c6f2,null))[_0x00b5('0x25')](saveUpdates(_0x2e0abc[_0x00b5('0x4b')],null))[_0x00b5('0x25')](respondWithResult(_0x58c6f2,null))['catch'](handleError(_0x58c6f2,null));};exports[_0x00b5('0x4c')]=function(_0x51cde2,_0x9808b8){return db[_0x00b5('0x41')][_0x00b5('0x4c')]()[_0x00b5('0x25')](respondWithResult(_0x9808b8,null))['catch'](handleError(_0x9808b8,null));};exports[_0x00b5('0x4d')]=function(_0x15c1a9,_0x3ab968,_0x165b3b){var _0x4c2247=require('../../components/encryptor');var _0x362fe2=![];var _0xe59827={};if(_0x15c1a9[_0x00b5('0x32')][_0x00b5('0x2e')]&&_0x15c1a9['query'][_0x00b5('0x2e')]===_0x00b5('0x4e')){_0xe59827[_0x00b5('0x4e')]=_0x15c1a9[_0x00b5('0x46')]['id'];}else{_0xe59827['id']=_0x15c1a9[_0x00b5('0x46')]['id'];}return db['VoiceRecording']['find']({'where':_0xe59827,'attributes':['id',_0x00b5('0x4f')],'raw':!![]})[_0x00b5('0x25')](handleEntityNotFound(_0x3ab968,null))[_0x00b5('0x25')](function(_0x14449c){if(_0x14449c){var _0x45a281=_0x14449c[_0x00b5('0x4f')];var _0x2cdcd6=util[_0x00b5('0x31')](_0x00b5('0x50'),_0x45a281);if(fs[_0x00b5('0x51')](_0x2cdcd6)){_0x362fe2=!![];return _0x4c2247[_0x00b5('0x52')](_0x2cdcd6,_0x45a281,config[_0x00b5('0x53')][_0x00b5('0x54')])[_0x00b5('0x25')](function(){return _0x14449c;});}return _0x14449c;}})[_0x00b5('0x25')](function(_0x368205){if(_0x368205){var _0x58766d=_0x368205[_0x00b5('0x4f')];if(!fs['existsSync'](_0x58766d)){throw new db[(_0x00b5('0x55'))][(_0x00b5('0x56'))](_0x00b5('0x57'));}if(_0x368205['filename']){return _0x3ab968[_0x00b5('0x4d')](_0x58766d,_0x368205['filename']+path[_0x00b5('0x58')](_0x58766d),function(){if(_0x362fe2){fs[_0x00b5('0x59')](_0x58766d);}});}else{return _0x3ab968[_0x00b5('0x4d')](_0x58766d,function(_0x3a95fc){if(_0x362fe2){fs[_0x00b5('0x59')](_0x58766d);}});}}})[_0x00b5('0x44')](function(_0x9b22d1){if(_0x9b22d1[_0x00b5('0x5a')]===_0x00b5('0x57')){_0x3ab968['status'](0x194)[_0x00b5('0x29')](_0x00b5('0x5b'));}else{return handleError(_0x3ab968,null);}});};exports['downloads']=function(_0x5aacc3,_0x4663b3,_0x1734a9){var _0x32a891=require(_0x00b5('0x5c'));var _0x314104=![];var _0x214bc6={'$and':[db['sequelize'][_0x00b5('0x39')](db[_0x00b5('0x5d')]['fn'](_0x00b5('0x5e'),db['sequelize']['col'](_0x00b5('0x4e'))),_0x5aacc3[_0x00b5('0x32')][_0x00b5('0x5f')])]};if(_0x5aacc3[_0x00b5('0x32')]['type']&&_0x5aacc3[_0x00b5('0x32')][_0x00b5('0x2e')]===_0x00b5('0x4e')){_0x214bc6[_0x00b5('0x60')][_0x00b5('0x61')]({'uniqueid':_0x5aacc3['params']['id']});}else{_0x214bc6[_0x00b5('0x60')][_0x00b5('0x61')]({'id':_0x5aacc3[_0x00b5('0x46')]['id']});}return db[_0x00b5('0x41')][_0x00b5('0x49')]({'where':_0x214bc6,'attributes':['id',_0x00b5('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x4663b3,null))[_0x00b5('0x25')](function(_0xbd8c08){if(_0xbd8c08){var _0x4bbd22=util['format'](_0x00b5('0x50'),_0xbd8c08[_0x00b5('0x4f')]);if(fs[_0x00b5('0x51')](_0x4bbd22)){_0x314104=!![];return _0x32a891[_0x00b5('0x52')](_0x4bbd22,_0xbd8c08[_0x00b5('0x4f')],config[_0x00b5('0x53')][_0x00b5('0x54')])['then'](function(){return _0xbd8c08;});}return _0xbd8c08;}})[_0x00b5('0x25')](function(_0x3da327){if(_0x3da327){if(!fs['existsSync'](_0x3da327[_0x00b5('0x4f')])){throw new db[(_0x00b5('0x55'))][(_0x00b5('0x56'))](_0x00b5('0x57'));}if(_0x3da327[_0x00b5('0x62')]){return _0x4663b3[_0x00b5('0x4d')](_0x3da327['value'],_0x3da327[_0x00b5('0x62')]+path[_0x00b5('0x58')](_0x3da327[_0x00b5('0x4f')]),function(){if(_0x314104){fs[_0x00b5('0x59')](_0x3da327[_0x00b5('0x4f')]);}});}else{return _0x4663b3[_0x00b5('0x4d')](_0x3da327[_0x00b5('0x4f')],function(_0x18982a){if(_0x314104){fs[_0x00b5('0x59')](_0x3da327[_0x00b5('0x4f')]);}});}}})[_0x00b5('0x44')](handleError(_0x4663b3,null));};exports[_0x00b5('0x63')]=function(_0x2b71b5,_0x52eba8){return db[_0x00b5('0x41')][_0x00b5('0x49')]({'where':{'id':_0x2b71b5[_0x00b5('0x46')]['id']}})[_0x00b5('0x25')](function(_0x5d22bc){if(_[_0x00b5('0x64')](_0x5d22bc)){throw new ReferenceError(_0x00b5('0x65'));}return _0x5d22bc;})[_0x00b5('0x25')](function(_0x2764a7){var _0xc1b864=_0x2764a7[_0x00b5('0x4f')];logger['info'](_0x00b5('0x66'),_0xc1b864);if(!_[_0x00b5('0x64')](_0x2764a7[_0x00b5('0x4f')])&&fs[_0x00b5('0x51')](_0xc1b864)){logger['info'](_0x00b5('0x67')+_0xc1b864+_0x00b5('0x68'));fs[_0x00b5('0x69')](_0xc1b864);}_0xc1b864=_0xc1b864+_0x00b5('0x6a');if(!_[_0x00b5('0x64')](_0x2764a7[_0x00b5('0x4f')])&&fs[_0x00b5('0x51')](_0xc1b864)){logger[_0x00b5('0x6b')](_0x00b5('0x67')+_0xc1b864+_0x00b5('0x68'));fs['unlinkSync'](_0xc1b864);}return _0x2764a7;})[_0x00b5('0x25')](function(_0x704080){if(!_0x704080)throw new InternalError();return _0x704080['destroy']();})[_0x00b5('0x25')](function(){_0x52eba8[_0x00b5('0x1b')](0xcc)[_0x00b5('0x1c')]();})[_0x00b5('0x44')](handleError(_0x52eba8,null));};function getBucketslist(_0x243643,_0x5ddd0f,_0x30f7e0){return new Promise(function(_0xcf2ad8,_0x24e286){var _0x2aa30d=new AWS['S3']({'accessKeyId':_0x5ddd0f,'secretAccessKey':_0x243643,'region':_0x30f7e0});_0x2aa30d['listBuckets']({},function(_0x53057e,_0x5b65f0){if(_0x53057e){return _0x24e286(_0x53057e);}else{return _0xcf2ad8(_0x5b65f0);}});});}function createBucket(_0x49497d,_0x5430e0,_0x4941a4,_0x5e1bc7){return new Promise(function(_0x193e0a,_0x1c4eca){var _0x1cf003=new AWS['S3']({'accessKeyId':_0x5430e0,'secretAccessKey':_0x49497d,'region':_0x4941a4});_0x1cf003[_0x00b5('0x6c')]({'Bucket':_0x5e1bc7},function(_0x88d29c,_0x1b00c4){if(_0x88d29c){return _0x1c4eca(_0x88d29c);}else{return _0x193e0a(_0x1b00c4);}});});}function uploadFile(_0x1d6648,_0x1b8973,_0x53d15c,_0x457723,_0x3b1527,_0x2f4c39){return new Promise(function(_0x4e5a1c,_0x586acf){var _0x2daed1=new AWS['S3']({'accessKeyId':_0x1b8973,'secretAccessKey':_0x1d6648,'region':_0x53d15c});_0x2daed1['upload']({'Bucket':_0x457723,'Key':_0x3b1527,'Body':_0x2f4c39},function(_0xadbf95,_0x460c4e){if(_0xadbf95){return _0x586acf(_0xadbf95);}else{return _0x4e5a1c(_0x460c4e);}});});}function startTranscribe(_0x3c8cb4,_0x2d93ed,_0x1c3be0,_0x515add,_0x4d6bbd,_0x52af4b){return new Promise(function(_0x345193,_0x10a47c){var _0x1df7eb=new AWS[(_0x00b5('0x6d'))]({'accessKeyId':_0x2d93ed,'secretAccessKey':_0x3c8cb4,'region':_0x1c3be0});_0x1df7eb[_0x00b5('0x6e')]({'TranscriptionJobName':_0x515add,'LanguageCode':_0x4d6bbd,'Media':{'MediaFileUri':_0x52af4b}},function(_0x521f89,_0x1a2355){if(_0x521f89){return _0x10a47c(_0x521f89);}else{return _0x345193(_0x1a2355);}});});}function transcribe(_0x56e7b6,_0x1c4e51,_0x5cbf18,_0x137c37,_0x338450,_0x4f05aa,_0x3bf67f){return new Promise(function(_0x5e4aed,_0x377314){var _0x4b0f60={};logger['info'](util[_0x00b5('0x31')](_0x00b5('0x6f'),_0x56e7b6,_0x338450));return uploadFile(_0x1c4e51,_0x5cbf18,_0x137c37,_0x338450,path[_0x00b5('0x70')](_0x4f05aa),fs['readFileSync'](_0x4f05aa))['then'](function(_0x5ca6a6){logger[_0x00b5('0x6b')](util[_0x00b5('0x31')](_0x00b5('0x71'),_0x56e7b6,_0x338450,_0x5ca6a6[_0x00b5('0x72')]));_0x4b0f60[_0x00b5('0x73')]=_0x5ca6a6['Bucket'];_0x4b0f60[_0x00b5('0x74')]=_0x5ca6a6[_0x00b5('0x72')];logger[_0x00b5('0x6b')](util['format'](_0x00b5('0x75'),_0x56e7b6));return startTranscribe(_0x1c4e51,_0x5cbf18,_0x137c37,uuidv4(),_0x3bf67f,_0x5ca6a6['Location']);})['then'](function(_0x4fa29f){logger['info'](util['format'](_0x00b5('0x76'),_0x56e7b6,_0x4fa29f['TranscriptionJob']['TranscriptionJobName']));_0x4b0f60[_0x00b5('0x77')]=_0x4fa29f[_0x00b5('0x78')]['TranscriptionJobName'];_0x4b0f60['transcribeStatus']=_0x4fa29f[_0x00b5('0x78')][_0x00b5('0x79')];return _0x5e4aed(_0x4b0f60);})[_0x00b5('0x44')](function(_0x47fe3b){return _0x377314(_0x47fe3b);});});}exports['runTranscribe']=function(_0x56d363,_0xeaec8f,_0x4e4900){var _0x116193;var _0x181970;var _0x333510;var _0x2d81d9=require(_0x00b5('0x5c'));return db[_0x00b5('0x41')][_0x00b5('0x7a')]({'where':{'id':_0x56d363[_0x00b5('0x46')]['id']}})[_0x00b5('0x25')](function(_0x124a5b){if(_0x124a5b){var _0xccb2ff=util[_0x00b5('0x31')](_0x00b5('0x50'),_0x124a5b[_0x00b5('0x4f')]);if(fs['existsSync'](_0xccb2ff)){cypher=!![];return _0x2d81d9[_0x00b5('0x52')](_0xccb2ff,_0x124a5b[_0x00b5('0x4f')],config['secrets'][_0x00b5('0x54')])[_0x00b5('0x25')](function(){return _0x124a5b;});}return _0x124a5b;}})[_0x00b5('0x25')](function(_0x3af433){if(!_0x3af433){throw new db[(_0x00b5('0x55'))][(_0x00b5('0x56'))](_0x00b5('0x7b'));}_0x181970=_0x3af433;return db['Setting']['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0xeaec8f,null))[_0x00b5('0x25')](function(_0x2a5fa2){if(_0x2a5fa2){_0x116193=_0x2a5fa2;if(!_0x116193[_0x00b5('0x7c')]||!_0x116193['transcribeAccountId']||!_0x116193[_0x00b5('0x7d')]||!_0x116193[_0x00b5('0x7e')]||!_0x116193[_0x00b5('0x73')]){throw new db['Sequelize'][(_0x00b5('0x56'))](_0x00b5('0x7f'));}if(_0x56d363[_0x00b5('0x4b')][_0x00b5('0x80')]&&(!_0x116193['sentiment']||!_0x116193[_0x00b5('0x81')]||!_0x116193[_0x00b5('0x82')]||!_0x116193[_0x00b5('0x7e')]||!_0x116193[_0x00b5('0x73')])){throw new db[(_0x00b5('0x55'))][(_0x00b5('0x56'))](_0x00b5('0x83'));}return db[_0x00b5('0x84')]['findOne']({'where':{'id':_0x116193[_0x00b5('0x85')]}});}})['then'](function(_0x36e04a){if(!_0x36e04a){throw new db[(_0x00b5('0x55'))][(_0x00b5('0x56'))](_0x00b5('0x86'));}if(!_0x36e04a[_0x00b5('0x87')]||!_0x36e04a[_0x00b5('0x88')]){throw new db[(_0x00b5('0x55'))]['ValidationError'](_0x00b5('0x89'));}_0x333510=_0x36e04a;return getBucketslist(_0x333510['data1'],_0x333510[_0x00b5('0x88')],_0x116193['transcribeRegion']);})[_0x00b5('0x25')](function(_0x36ff59){if(_0x36ff59&&_0x36ff59['Buckets']){var _0x4cc573=_[_0x00b5('0x49')](_0x36ff59[_0x00b5('0x8a')],function(_0x55f669){return _0x55f669[_0x00b5('0x8b')]===_0x116193[_0x00b5('0x73')];});if(!_0x4cc573){logger[_0x00b5('0x6b')](util['format'](_0x00b5('0x8c'),_0x56d363[_0x00b5('0x46')]['id'],_0x116193[_0x00b5('0x73')]));return createBucket(_0x333510['data1'],_0x333510['data2'],_0x116193[_0x00b5('0x7d')],_0x116193[_0x00b5('0x73')]);}logger['info'](util[_0x00b5('0x31')](_0x00b5('0x8d'),_0x56d363[_0x00b5('0x46')]['id'],_0x116193[_0x00b5('0x73')]));return;}})[_0x00b5('0x25')](function(_0x85c25c){if(_0x181970[_0x00b5('0x8e')]===_0x00b5('0x8f')){return transcribe(_0x56d363[_0x00b5('0x46')]['id'],_0x333510[_0x00b5('0x87')],_0x333510[_0x00b5('0x88')],_0x116193[_0x00b5('0x7d')],_0x116193[_0x00b5('0x73')],_0x181970['value'],_0x116193[_0x00b5('0x7e')]);}else{logger['info'](util[_0x00b5('0x31')](_0x00b5('0x90'),_0x56d363[_0x00b5('0x46')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0x5c961b){if(_0x5c961b){_0x5c961b[_0x00b5('0x91')]=_0x56d363[_0x00b5('0x4b')][_0x00b5('0x80')];return _0x181970[_0x00b5('0x92')](_0x5c961b);}})[_0x00b5('0x25')](respondWithResult(_0xeaec8f,null))[_0x00b5('0x44')](handleError(_0xeaec8f,null));};function writeFile(_0x2841b9,_0x43209c){return new Promise(function(_0x2ca9a3,_0x358a4e){fs['writeFile'](_0x43209c,_0x2841b9,function(_0x98fe94,_0x12f273){if(_0x98fe94){return _0x358a4e(_0x98fe94);}else{return _0x2ca9a3(_0x12f273);}});});}exports[_0x00b5('0x93')]=function(_0x3a9815,_0x5d58a5,_0x1c3207){return db[_0x00b5('0x41')][_0x00b5('0x7a')]({'where':{'id':_0x3a9815[_0x00b5('0x46')]['id']}})[_0x00b5('0x25')](handleEntityNotFound(_0x5d58a5))[_0x00b5('0x25')](function(_0x1e0f8b){if(_0x1e0f8b&&_0x1e0f8b[_0x00b5('0x94')]){var _0x3a1bf7=_0x1e0f8b[_0x00b5('0x94')];var _0xdd9c77=config[_0x00b5('0x95')]+_0x00b5('0x96')+_0x1e0f8b['id']+_0x00b5('0x97');if(fs[_0x00b5('0x51')](_0xdd9c77)){return _0xdd9c77;}return writeFile(_0x3a1bf7,_0xdd9c77)[_0x00b5('0x25')](function(){return _0xdd9c77;});}else{throw new db[(_0x00b5('0x55'))][(_0x00b5('0x56'))](_0x00b5('0x98'));}})['then'](function(_0x33aee7){return _0x5d58a5[_0x00b5('0x4d')](_0x33aee7);})[_0x00b5('0x44')](handleError(_0x5d58a5));}; \ No newline at end of file +var _0x0b08=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','stack','name','send','index','VoiceRecording','rawAttributes','key','model','differenceBy','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','body','describe','download','../../components/encryptor','type','uniqueid','value','format','%s.cypher','existsSync','decryptFile','recording','ValidationError','extname','unlink','message','Not\x20found','sequelize','MD5','col','push','secrets','Sequelize','VoiceRecording\x20not\x20found','filename','destroy','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','createBucket','upload','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','info','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeStatus','TranscriptionJob','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','runSentiment','sentimentAccountId','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','aws-sdk','uuid/v4'];(function(_0x368470,_0x1041d6){var _0x43689c=function(_0x2f8b0a){while(--_0x2f8b0a){_0x368470['push'](_0x368470['shift']());}};_0x43689c(++_0x1041d6);}(_0x0b08,0x84));var _0x80b0=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0x0b08[_0x2300c7];return _0x23f720;};'use strict';var emlformat=require(_0x80b0('0x0'));var rimraf=require(_0x80b0('0x1'));var zipdir=require(_0x80b0('0x2'));var jsonpatch=require(_0x80b0('0x3'));var rp=require(_0x80b0('0x4'));var moment=require(_0x80b0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x80b0('0x6'));var util=require(_0x80b0('0x7'));var path=require(_0x80b0('0x8'));var sox=require(_0x80b0('0x9'));var csv=require(_0x80b0('0xa'));var ejs=require(_0x80b0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x80b0('0xc'));var squel=require(_0x80b0('0xd'));var crypto=require(_0x80b0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x80b0('0xf'));var toCsv=require(_0x80b0('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var AWS=require(_0x80b0('0x10'));var uuidv4=require(_0x80b0('0x11'));var Redis=require('ioredis');var authService=require(_0x80b0('0x12'));var qs=require(_0x80b0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x80b0('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x80b0('0x15'));var config=require(_0x80b0('0x16'));var licenseUtil=require(_0x80b0('0x17'));var db=require(_0x80b0('0x18'))['db'];function respondWithStatusCode(_0x404673,_0x58f2c4){_0x58f2c4=_0x58f2c4||0xcc;return function(_0x44c9c3){if(_0x44c9c3){return _0x404673[_0x80b0('0x19')](_0x58f2c4);}return _0x404673[_0x80b0('0x1a')](_0x58f2c4)[_0x80b0('0x1b')]();};}function respondWithResult(_0x28de26,_0xb189c2){_0xb189c2=_0xb189c2||0xc8;return function(_0x375af7){if(_0x375af7){return _0x28de26[_0x80b0('0x1a')](_0xb189c2)[_0x80b0('0x1c')](_0x375af7);}};}function respondWithFilteredResult(_0x4f502a,_0x2c5f54){return function(_0x5ec724){if(_0x5ec724){var _0x201990=typeof _0x2c5f54['offset']==='undefined'&&typeof _0x2c5f54[_0x80b0('0x1d')]===_0x80b0('0x1e');var _0x597360=_0x5ec724[_0x80b0('0x1f')];var _0x29d719=_0x201990?0x0:_0x2c5f54['offset'];var _0xd66072=_0x201990?_0x5ec724[_0x80b0('0x1f')]:_0x2c5f54[_0x80b0('0x20')]+_0x2c5f54[_0x80b0('0x1d')];var _0x55500d;if(_0xd66072>=_0x597360){_0xd66072=_0x597360;_0x55500d=0xc8;}else{_0x55500d=0xce;}_0x4f502a[_0x80b0('0x1a')](_0x55500d);return _0x4f502a[_0x80b0('0x21')](_0x80b0('0x22'),_0x29d719+'-'+_0xd66072+'/'+_0x597360)[_0x80b0('0x1c')](_0x5ec724);}return null;};}function patchUpdates(_0x13f6ca){return function(_0x3508a9){try{jsonpatch[_0x80b0('0x23')](_0x3508a9,_0x13f6ca,!![]);}catch(_0x5e6acd){return BPromise['reject'](_0x5e6acd);}return _0x3508a9[_0x80b0('0x24')]();};}function saveUpdates(_0x4b828b,_0x35debf){return function(_0x17a474){if(_0x17a474){return _0x17a474[_0x80b0('0x25')](_0x4b828b)[_0x80b0('0x26')](function(_0x15fc0a){return _0x15fc0a;});}return null;};}function removeEntity(_0xd3370,_0x33ca20){return function(_0x644ffc){if(_0x644ffc){return _0x644ffc['destroy']()[_0x80b0('0x26')](function(){_0xd3370['status'](0xcc)[_0x80b0('0x1b')]();});}};}function handleEntityNotFound(_0x52d299,_0xff29e0){return function(_0x2a8ea4){if(!_0x2a8ea4){_0x52d299[_0x80b0('0x19')](0x194);}return _0x2a8ea4;};}function handleError(_0x1be32d,_0x405309){_0x405309=_0x405309||0x1f4;return function(_0x396bf7){logger['error'](_0x396bf7[_0x80b0('0x27')]);if(_0x396bf7[_0x80b0('0x28')]){delete _0x396bf7[_0x80b0('0x28')];}_0x1be32d[_0x80b0('0x1a')](_0x405309)[_0x80b0('0x29')](_0x396bf7);};}exports[_0x80b0('0x2a')]=function(_0x3664da,_0x5a1105){var _0x58e4d4={},_0xf0bce3={},_0x4c564a={'count':0x0,'rows':[]};var _0x249c4f=_['map'](db[_0x80b0('0x2b')][_0x80b0('0x2c')],function(_0x32c387){return{'name':_0x32c387['fieldName'],'type':_0x32c387['type'][_0x80b0('0x2d')]};});_0xf0bce3[_0x80b0('0x2e')]=_[_0x80b0('0x2f')](_[_0x80b0('0x30')](_0x249c4f,'name'),['format']);_0xf0bce3[_0x80b0('0x31')]=_[_0x80b0('0x32')](_0x3664da['query']);_0xf0bce3['filters']=_['intersection'](_0xf0bce3[_0x80b0('0x2e')],_0xf0bce3[_0x80b0('0x31')]);_0x58e4d4[_0x80b0('0x33')]=_[_0x80b0('0x34')](_0xf0bce3['model'],qs[_0x80b0('0x35')](_0x3664da[_0x80b0('0x31')]['fields']));_0x58e4d4[_0x80b0('0x33')]=_0x58e4d4[_0x80b0('0x33')][_0x80b0('0x36')]?_0x58e4d4['attributes']:_0xf0bce3['model'];if(!_0x3664da[_0x80b0('0x31')][_0x80b0('0x37')](_0x80b0('0x38'))){_0x58e4d4[_0x80b0('0x1d')]=qs['limit'](_0x3664da[_0x80b0('0x31')][_0x80b0('0x1d')]);_0x58e4d4[_0x80b0('0x20')]=qs[_0x80b0('0x20')](_0x3664da['query']['offset']);}_0x58e4d4['order']=qs['sort'](_0x3664da[_0x80b0('0x31')][_0x80b0('0x39')]);_0x58e4d4[_0x80b0('0x3a')]=qs['filters'](_[_0x80b0('0x3b')](_0x3664da[_0x80b0('0x31')],_0xf0bce3[_0x80b0('0x3c')]),_0x249c4f);if(_0x3664da['query'][_0x80b0('0x3d')]){_0x58e4d4['where']=_[_0x80b0('0x3e')](_0x58e4d4[_0x80b0('0x3a')],{'$or':_['map'](_0x249c4f,function(_0x57cd51){if(_0x57cd51['type']!==_0x80b0('0x3f')){var _0x4dbc22={};_0x4dbc22[_0x57cd51[_0x80b0('0x28')]]={'$like':'%'+_0x3664da['query'][_0x80b0('0x3d')]+'%'};return _0x4dbc22;}})});}_0x58e4d4=_[_0x80b0('0x3e')]({},_0x58e4d4,_0x3664da[_0x80b0('0x40')]);var _0x201c3f={'where':_0x58e4d4['where']};return db['VoiceRecording'][_0x80b0('0x1f')](_0x201c3f)['then'](function(_0x34406a){_0x4c564a[_0x80b0('0x1f')]=_0x34406a;if(_0x3664da[_0x80b0('0x31')]['includeAll']){_0x58e4d4[_0x80b0('0x41')]=[{'all':!![]}];}return db[_0x80b0('0x2b')]['findAll'](_0x58e4d4);})[_0x80b0('0x26')](function(_0x359aab){_0x4c564a[_0x80b0('0x42')]=_0x359aab;return _0x4c564a;})[_0x80b0('0x26')](respondWithFilteredResult(_0x5a1105,_0x58e4d4))[_0x80b0('0x43')](handleError(_0x5a1105,null));};exports[_0x80b0('0x44')]=function(_0x5d82ad,_0x4897eb){var _0x73388b={'raw':![],'where':{'id':_0x5d82ad[_0x80b0('0x45')]['id']}},_0x1ddda0={};_0x1ddda0[_0x80b0('0x2e')]=_[_0x80b0('0x32')](db[_0x80b0('0x2b')][_0x80b0('0x2c')]);_0x1ddda0[_0x80b0('0x31')]=_['keys'](_0x5d82ad['query']);_0x1ddda0[_0x80b0('0x3c')]=_[_0x80b0('0x34')](_0x1ddda0[_0x80b0('0x2e')],_0x1ddda0[_0x80b0('0x31')]);_0x73388b[_0x80b0('0x33')]=_[_0x80b0('0x34')](_0x1ddda0[_0x80b0('0x2e')],qs[_0x80b0('0x35')](_0x5d82ad[_0x80b0('0x31')][_0x80b0('0x35')]));_0x73388b['attributes']=_0x73388b[_0x80b0('0x33')][_0x80b0('0x36')]?_0x73388b[_0x80b0('0x33')]:_0x1ddda0['model'];if(_0x5d82ad[_0x80b0('0x31')][_0x80b0('0x46')]){_0x73388b[_0x80b0('0x41')]=[{'all':!![]}];}_0x73388b=_['merge']({},_0x73388b,_0x5d82ad[_0x80b0('0x40')]);return db[_0x80b0('0x2b')][_0x80b0('0x47')](_0x73388b)[_0x80b0('0x26')](handleEntityNotFound(_0x4897eb,null))[_0x80b0('0x26')](respondWithResult(_0x4897eb,null))['catch'](handleError(_0x4897eb,null));};exports[_0x80b0('0x48')]=function(_0x1e0466,_0x1290de){return db['VoiceRecording'][_0x80b0('0x48')](_0x1e0466[_0x80b0('0x49')],{})[_0x80b0('0x26')](respondWithResult(_0x1290de,0xc9))[_0x80b0('0x43')](handleError(_0x1290de,null));};exports['update']=function(_0x38866a,_0x35bd0b){if(_0x38866a[_0x80b0('0x49')]['id']){delete _0x38866a['body']['id'];}return db[_0x80b0('0x2b')][_0x80b0('0x47')]({'where':{'id':_0x38866a[_0x80b0('0x45')]['id']}})[_0x80b0('0x26')](handleEntityNotFound(_0x35bd0b,null))[_0x80b0('0x26')](saveUpdates(_0x38866a['body'],null))['then'](respondWithResult(_0x35bd0b,null))[_0x80b0('0x43')](handleError(_0x35bd0b,null));};exports[_0x80b0('0x4a')]=function(_0x552de2,_0x13757e){return db['VoiceRecording'][_0x80b0('0x4a')]()[_0x80b0('0x26')](respondWithResult(_0x13757e,null))[_0x80b0('0x43')](handleError(_0x13757e,null));};exports[_0x80b0('0x4b')]=function(_0x4a87c1,_0xa4460b,_0x40a290){var _0x3ebdaf=require(_0x80b0('0x4c'));var _0x10c60a=![];var _0x36cf19={};if(_0x4a87c1['query']['type']&&_0x4a87c1[_0x80b0('0x31')][_0x80b0('0x4d')]==='uniqueid'){_0x36cf19[_0x80b0('0x4e')]=_0x4a87c1[_0x80b0('0x45')]['id'];}else{_0x36cf19['id']=_0x4a87c1[_0x80b0('0x45')]['id'];}return db[_0x80b0('0x2b')][_0x80b0('0x47')]({'where':_0x36cf19,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0xa4460b,null))['then'](function(_0x4ead52){if(_0x4ead52){var _0x4fa155=_0x4ead52[_0x80b0('0x4f')];var _0x215718=util[_0x80b0('0x50')](_0x80b0('0x51'),_0x4fa155);if(fs[_0x80b0('0x52')](_0x215718)){_0x10c60a=!![];return _0x3ebdaf[_0x80b0('0x53')](_0x215718,_0x4fa155,config['secrets'][_0x80b0('0x54')])[_0x80b0('0x26')](function(){return _0x4ead52;});}return _0x4ead52;}})['then'](function(_0x45e5a2){if(_0x45e5a2){var _0x293a3a=_0x45e5a2[_0x80b0('0x4f')];if(!fs[_0x80b0('0x52')](_0x293a3a)){throw new db['Sequelize'][(_0x80b0('0x55'))]('VoiceRecording\x20not\x20found');}if(_0x45e5a2['filename']){return _0xa4460b[_0x80b0('0x4b')](_0x293a3a,_0x45e5a2['filename']+path[_0x80b0('0x56')](_0x293a3a),function(){if(_0x10c60a){fs['unlink'](_0x293a3a);}});}else{return _0xa4460b[_0x80b0('0x4b')](_0x293a3a,function(_0x16d831){if(_0x10c60a){fs[_0x80b0('0x57')](_0x293a3a);}});}}})[_0x80b0('0x43')](function(_0x42d183){if(_0x42d183[_0x80b0('0x58')]==='VoiceRecording\x20not\x20found'){_0xa4460b[_0x80b0('0x1a')](0x194)[_0x80b0('0x29')](_0x80b0('0x59'));}else{return handleError(_0xa4460b,null);}});};exports['downloads']=function(_0x5df81b,_0x2bddbc,_0x54fb7b){var _0x448ae7=require('../../components/encryptor');var _0x4f764c=![];var _0x1877d4={'$and':[db[_0x80b0('0x5a')][_0x80b0('0x3a')](db[_0x80b0('0x5a')]['fn'](_0x80b0('0x5b'),db[_0x80b0('0x5a')][_0x80b0('0x5c')](_0x80b0('0x4e'))),_0x5df81b[_0x80b0('0x31')]['token'])]};if(_0x5df81b['query']['type']&&_0x5df81b[_0x80b0('0x31')][_0x80b0('0x4d')]===_0x80b0('0x4e')){_0x1877d4['$and'][_0x80b0('0x5d')]({'uniqueid':_0x5df81b['params']['id']});}else{_0x1877d4['$and'][_0x80b0('0x5d')]({'id':_0x5df81b['params']['id']});}return db[_0x80b0('0x2b')][_0x80b0('0x47')]({'where':_0x1877d4,'attributes':['id',_0x80b0('0x4f')],'raw':!![]})[_0x80b0('0x26')](handleEntityNotFound(_0x2bddbc,null))[_0x80b0('0x26')](function(_0x1ed311){if(_0x1ed311){var _0x4a9341=util[_0x80b0('0x50')](_0x80b0('0x51'),_0x1ed311[_0x80b0('0x4f')]);if(fs['existsSync'](_0x4a9341)){_0x4f764c=!![];return _0x448ae7['decryptFile'](_0x4a9341,_0x1ed311[_0x80b0('0x4f')],config[_0x80b0('0x5e')]['recording'])[_0x80b0('0x26')](function(){return _0x1ed311;});}return _0x1ed311;}})[_0x80b0('0x26')](function(_0x38fcce){if(_0x38fcce){if(!fs[_0x80b0('0x52')](_0x38fcce[_0x80b0('0x4f')])){throw new db[(_0x80b0('0x5f'))]['ValidationError'](_0x80b0('0x60'));}if(_0x38fcce[_0x80b0('0x61')]){return _0x2bddbc[_0x80b0('0x4b')](_0x38fcce[_0x80b0('0x4f')],_0x38fcce['filename']+path['extname'](_0x38fcce[_0x80b0('0x4f')]),function(){if(_0x4f764c){fs[_0x80b0('0x57')](_0x38fcce['value']);}});}else{return _0x2bddbc[_0x80b0('0x4b')](_0x38fcce[_0x80b0('0x4f')],function(_0x550734){if(_0x4f764c){fs[_0x80b0('0x57')](_0x38fcce[_0x80b0('0x4f')]);}});}}})[_0x80b0('0x43')](handleError(_0x2bddbc,null));};exports[_0x80b0('0x62')]=function(_0x5ad6a4,_0x1d967e){return db['VoiceRecording'][_0x80b0('0x47')]({'where':{'id':_0x5ad6a4[_0x80b0('0x45')]['id']}})['then'](function(_0x590761){if(_['isNil'](_0x590761)){throw new ReferenceError(_0x80b0('0x63'));}return _0x590761;})[_0x80b0('0x26')](function(_0x18d154){var _0x590d7c=_0x18d154['value'];logger['info'](_0x80b0('0x64'),_0x590d7c);if(!_['isNil'](_0x18d154['value'])&&fs[_0x80b0('0x52')](_0x590d7c)){logger['info'](_0x80b0('0x65')+_0x590d7c+_0x80b0('0x66'));fs[_0x80b0('0x67')](_0x590d7c);}_0x590d7c=_0x590d7c+_0x80b0('0x68');if(!_['isNil'](_0x18d154[_0x80b0('0x4f')])&&fs[_0x80b0('0x52')](_0x590d7c)){logger['info']('File:\x20\x22'+_0x590d7c+_0x80b0('0x66'));fs[_0x80b0('0x67')](_0x590d7c);}return _0x18d154;})[_0x80b0('0x26')](function(_0x34369e){if(!_0x34369e)throw new InternalError();return _0x34369e[_0x80b0('0x62')]();})[_0x80b0('0x26')](function(){_0x1d967e[_0x80b0('0x1a')](0xcc)[_0x80b0('0x1b')]();})[_0x80b0('0x43')](handleError(_0x1d967e,null));};function getBucketslist(_0x47ba66,_0x3e1b41,_0xabb342){return new Promise(function(_0x19db3c,_0x14d7a3){var _0x59ce8a=new AWS['S3']({'accessKeyId':_0x3e1b41,'secretAccessKey':_0x47ba66,'region':_0xabb342});_0x59ce8a['listBuckets']({},function(_0x1c5ba1,_0x2f62b5){if(_0x1c5ba1){return _0x14d7a3(_0x1c5ba1);}else{return _0x19db3c(_0x2f62b5);}});});}function createBucket(_0x5c3024,_0x242d02,_0x1dd1c8,_0x460d65){return new Promise(function(_0x2cf3ff,_0x27d264){var _0x2fc5b6=new AWS['S3']({'accessKeyId':_0x242d02,'secretAccessKey':_0x5c3024,'region':_0x1dd1c8});_0x2fc5b6[_0x80b0('0x69')]({'Bucket':_0x460d65},function(_0x242851,_0x1ffe8d){if(_0x242851){return _0x27d264(_0x242851);}else{return _0x2cf3ff(_0x1ffe8d);}});});}function uploadFile(_0x422f35,_0x6e6d6d,_0x39761a,_0x280932,_0x396e86,_0xa47992){return new Promise(function(_0xd21798,_0x5ed81b){var _0x2dad1a=new AWS['S3']({'accessKeyId':_0x6e6d6d,'secretAccessKey':_0x422f35,'region':_0x39761a});_0x2dad1a[_0x80b0('0x6a')]({'Bucket':_0x280932,'Key':_0x396e86,'Body':_0xa47992},function(_0x430e63,_0x13376a){if(_0x430e63){return _0x5ed81b(_0x430e63);}else{return _0xd21798(_0x13376a);}});});}function startTranscribe(_0x38645c,_0x5d4b17,_0x79e9f4,_0x41ba7c,_0x254b7d,_0x366b7c){return new Promise(function(_0xc42f21,_0x52a37f){var _0x17376e=new AWS['TranscribeService']({'accessKeyId':_0x5d4b17,'secretAccessKey':_0x38645c,'region':_0x79e9f4});_0x17376e['startTranscriptionJob']({'TranscriptionJobName':_0x41ba7c,'LanguageCode':_0x254b7d,'Media':{'MediaFileUri':_0x366b7c}},function(_0xc59d61,_0x11ed5a){if(_0xc59d61){return _0x52a37f(_0xc59d61);}else{return _0xc42f21(_0x11ed5a);}});});}function transcribe(_0x38b247,_0x593a39,_0x5c34f4,_0x4b1699,_0x4bf0af,_0x14ded5,_0x353fc3){return new Promise(function(_0x3f6e9a,_0x2efb0f){var _0x1e71a3={};logger['info'](util[_0x80b0('0x50')](_0x80b0('0x6b'),_0x38b247,_0x4bf0af));return uploadFile(_0x593a39,_0x5c34f4,_0x4b1699,_0x4bf0af,path[_0x80b0('0x6c')](_0x14ded5),fs[_0x80b0('0x6d')](_0x14ded5))[_0x80b0('0x26')](function(_0x432472){logger[_0x80b0('0x6e')](util['format'](_0x80b0('0x6f'),_0x38b247,_0x4bf0af,_0x432472[_0x80b0('0x70')]));_0x1e71a3[_0x80b0('0x71')]=_0x432472[_0x80b0('0x72')];_0x1e71a3['location']=_0x432472[_0x80b0('0x70')];logger[_0x80b0('0x6e')](util['format'](_0x80b0('0x73'),_0x38b247));return startTranscribe(_0x593a39,_0x5c34f4,_0x4b1699,uuidv4(),_0x353fc3,_0x432472[_0x80b0('0x70')]);})[_0x80b0('0x26')](function(_0x12ff68){logger[_0x80b0('0x6e')](util[_0x80b0('0x50')](_0x80b0('0x74'),_0x38b247,_0x12ff68['TranscriptionJob'][_0x80b0('0x75')]));_0x1e71a3['transcribeName']=_0x12ff68['TranscriptionJob']['TranscriptionJobName'];_0x1e71a3[_0x80b0('0x76')]=_0x12ff68[_0x80b0('0x77')][_0x80b0('0x78')];return _0x3f6e9a(_0x1e71a3);})[_0x80b0('0x43')](function(_0x42bf93){return _0x2efb0f(_0x42bf93);});});}exports[_0x80b0('0x79')]=function(_0x1ca42b,_0x402bd0,_0x8df94c){var _0xf5d986;var _0x261da7;var _0x287dde;var _0x2931e9=require(_0x80b0('0x4c'));return db[_0x80b0('0x2b')][_0x80b0('0x7a')]({'where':{'id':_0x1ca42b[_0x80b0('0x45')]['id']}})[_0x80b0('0x26')](function(_0x2c4d82){if(_0x2c4d82){var _0x4f3cc8=util[_0x80b0('0x50')]('%s.cypher',_0x2c4d82[_0x80b0('0x4f')]);if(fs[_0x80b0('0x52')](_0x4f3cc8)){cypher=!![];return _0x2931e9['decryptFile'](_0x4f3cc8,_0x2c4d82['value'],config[_0x80b0('0x5e')][_0x80b0('0x54')])['then'](function(){return _0x2c4d82;});}return _0x2c4d82;}})[_0x80b0('0x26')](function(_0x30f222){if(!_0x30f222){throw new db[(_0x80b0('0x5f'))][(_0x80b0('0x55'))](_0x80b0('0x7b'));}_0x261da7=_0x30f222;return db[_0x80b0('0x7c')][_0x80b0('0x7a')]({'where':{'id':0x1}});})[_0x80b0('0x26')](handleEntityNotFound(_0x402bd0,null))['then'](function(_0x32aa8e){if(_0x32aa8e){_0xf5d986=_0x32aa8e;if(!_0xf5d986[_0x80b0('0x7d')]||!_0xf5d986[_0x80b0('0x7e')]||!_0xf5d986[_0x80b0('0x7f')]||!_0xf5d986[_0x80b0('0x80')]||!_0xf5d986[_0x80b0('0x71')]){throw new db[(_0x80b0('0x5f'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0x1ca42b[_0x80b0('0x49')][_0x80b0('0x81')]&&(!_0xf5d986['sentiment']||!_0xf5d986[_0x80b0('0x82')]||!_0xf5d986['sentimentRegion']||!_0xf5d986['language']||!_0xf5d986[_0x80b0('0x71')])){throw new db[(_0x80b0('0x5f'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x80b0('0x83')][_0x80b0('0x7a')]({'where':{'id':_0xf5d986[_0x80b0('0x7e')]}});}})[_0x80b0('0x26')](function(_0x3c8232){if(!_0x3c8232){throw new db[(_0x80b0('0x5f'))]['ValidationError'](_0x80b0('0x84'));}if(!_0x3c8232[_0x80b0('0x85')]||!_0x3c8232[_0x80b0('0x86')]){throw new db['Sequelize']['ValidationError'](_0x80b0('0x87'));}_0x287dde=_0x3c8232;return getBucketslist(_0x287dde[_0x80b0('0x85')],_0x287dde[_0x80b0('0x86')],_0xf5d986[_0x80b0('0x7f')]);})[_0x80b0('0x26')](function(_0x5198eb){if(_0x5198eb&&_0x5198eb[_0x80b0('0x88')]){var _0xf0b10c=_[_0x80b0('0x47')](_0x5198eb[_0x80b0('0x88')],function(_0x207e3c){return _0x207e3c[_0x80b0('0x89')]===_0xf5d986[_0x80b0('0x71')];});if(!_0xf0b10c){logger[_0x80b0('0x6e')](util[_0x80b0('0x50')](_0x80b0('0x8a'),_0x1ca42b['params']['id'],_0xf5d986[_0x80b0('0x71')]));return createBucket(_0x287dde[_0x80b0('0x85')],_0x287dde['data2'],_0xf5d986[_0x80b0('0x7f')],_0xf5d986[_0x80b0('0x71')]);}logger[_0x80b0('0x6e')](util[_0x80b0('0x50')](_0x80b0('0x8b'),_0x1ca42b['params']['id'],_0xf5d986['bucket']));return;}})[_0x80b0('0x26')](function(_0x2834af){if(_0x261da7[_0x80b0('0x76')]==='NEW'){return transcribe(_0x1ca42b[_0x80b0('0x45')]['id'],_0x287dde[_0x80b0('0x85')],_0x287dde['data2'],_0xf5d986[_0x80b0('0x7f')],_0xf5d986['bucket'],_0x261da7[_0x80b0('0x4f')],_0xf5d986[_0x80b0('0x80')]);}else{logger[_0x80b0('0x6e')](util[_0x80b0('0x50')](_0x80b0('0x8c'),_0x1ca42b['params']['id']));return{'transcribeStatus':_0x80b0('0x8d')};}})[_0x80b0('0x26')](function(_0x51aa94){if(_0x51aa94){_0x51aa94[_0x80b0('0x8e')]=_0x1ca42b[_0x80b0('0x49')]['runSentiment'];return _0x261da7[_0x80b0('0x8f')](_0x51aa94);}})[_0x80b0('0x26')](respondWithResult(_0x402bd0,null))['catch'](handleError(_0x402bd0,null));};function writeFile(_0x3620b8,_0x562541){return new Promise(function(_0x1adb89,_0x30fde7){fs[_0x80b0('0x90')](_0x562541,_0x3620b8,function(_0x12eb22,_0x4d42ce){if(_0x12eb22){return _0x30fde7(_0x12eb22);}else{return _0x1adb89(_0x4d42ce);}});});}exports[_0x80b0('0x91')]=function(_0x2a3de0,_0x4e062c,_0x268ad9){return db['VoiceRecording'][_0x80b0('0x7a')]({'where':{'id':_0x2a3de0[_0x80b0('0x45')]['id']}})['then'](handleEntityNotFound(_0x4e062c))['then'](function(_0x173563){if(_0x173563&&_0x173563[_0x80b0('0x92')]){var _0x3a7ee5=_0x173563[_0x80b0('0x92')];var _0x35af4e=config[_0x80b0('0x93')]+_0x80b0('0x94')+_0x173563['id']+'.txt';if(fs[_0x80b0('0x52')](_0x35af4e)){return _0x35af4e;}return writeFile(_0x3a7ee5,_0x35af4e)[_0x80b0('0x26')](function(){return _0x35af4e;});}else{throw new db[(_0x80b0('0x5f'))][(_0x80b0('0x55'))](_0x80b0('0x95'));}})[_0x80b0('0x26')](function(_0x12f7f6){return _0x4e062c[_0x80b0('0x4b')](_0x12f7f6);})[_0x80b0('0x43')](handleError(_0x4e062c));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 56cc637..63bf8b9 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 _0x733f=['voice_recordings','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x733f,0x120));var _0xf733=function(_0x842063,_0x418163){_0x842063=_0x842063-0x0;var _0x3e5d72=_0x733f[_0x842063];return _0x3e5d72;};'use strict';var _=require(_0xf733('0x0'));var util=require('util');var logger=require(_0xf733('0x1'))(_0xf733('0x2'));var moment=require(_0xf733('0x3'));var BPromise=require('bluebird');var rp=require(_0xf733('0x4'));var fs=require('fs');var path=require(_0xf733('0x5'));var rimraf=require(_0xf733('0x6'));var config=require(_0xf733('0x7'));var attributes=require(_0xf733('0x8'));module[_0xf733('0x9')]=function(_0x286ff0,_0x2bc2ab){return _0x286ff0[_0xf733('0xa')]('VoiceRecording',attributes,{'tableName':_0xf733('0xb'),'paranoid':![],'indexes':[{'name':_0xf733('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x054f=['uniqueid','lodash','util','moment','bluebird','request-promise','path','rimraf','./voiceRecording.attributes','exports','define','VoiceRecording'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x054f,0x181));var _0xf054=function(_0xa39528,_0x1fe0f7){_0xa39528=_0xa39528-0x0;var _0x3ad010=_0x054f[_0xa39528];return _0x3ad010;};'use strict';var _=require(_0xf054('0x0'));var util=require(_0xf054('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf054('0x2'));var BPromise=require(_0xf054('0x3'));var rp=require(_0xf054('0x4'));var fs=require('fs');var path=require(_0xf054('0x5'));var rimraf=require(_0xf054('0x6'));var config=require('../../config/environment');var attributes=require(_0xf054('0x7'));module[_0xf054('0x8')]=function(_0x40392d,_0x3dccb4){return _0x40392d[_0xf054('0x9')](_0xf054('0xa'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xf054('0xb'),'fields':[_0xf054('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 4171321..dbdcf39 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(_0x151721,_0x20d5bc){var _0x2deaa7=function(_0x499812){while(--_0x499812){_0x151721['push'](_0x151721['shift']());}};_0x2deaa7(++_0x20d5bc);}(_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 _0xe2fe=['options','raw','where','attributes','limit','debug','catch','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','recording','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceRecording,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','UpdateVoiceRecording','VoiceRecording','update','body'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});}exports[_0xee2f('0x12')]=function(_0x502eb6){var _0x550da7=this;return new Promise(function(_0x40b5bc,_0x5a5078){return db[_0xee2f('0x13')][_0xee2f('0x14')](_0x502eb6[_0xee2f('0x15')],{'raw':_0x502eb6['options']?_0x502eb6[_0xee2f('0x16')][_0xee2f('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x502eb6[_0xee2f('0x16')]?_0x502eb6[_0xee2f('0x16')][_0xee2f('0x18')]||null:null,'attributes':_0x502eb6['options']?_0x502eb6['options'][_0xee2f('0x19')]||null:null,'limit':_0x502eb6[_0xee2f('0x16')]?_0x502eb6[_0xee2f('0x16')][_0xee2f('0x1a')]||null:null})[_0xee2f('0xa')](function(_0xf278cc){logger[_0xee2f('0xb')]('UpdateVoiceRecording',_0x502eb6);logger[_0xee2f('0x1b')](_0xee2f('0x12'),_0x502eb6,JSON[_0xee2f('0xd')](_0xf278cc));_0x40b5bc(_0xf278cc);})[_0xee2f('0x1c')](function(_0x820101){logger[_0xee2f('0xe')](_0xee2f('0x12'),_0x820101[_0xee2f('0xf')],_0x502eb6);_0x5a5078(_0x550da7[_0xee2f('0xe')](0x1f4,_0x820101[_0xee2f('0xf')]));});});};exports[_0xee2f('0x1d')]=function(_0x168adc){var _0x1c8454=this;return new Promise(function(_0x45c4a0,_0x53f6ed){var _0x4ef690=require('../../components/encryptor');var _0x18bdbb;return db[_0xee2f('0x1e')][_0xee2f('0x1f')]({'attributes':['id',_0xee2f('0x20')],'where':{'id':0x1},'raw':!![]})[_0xee2f('0xa')](function(_0x3737fd){_0x18bdbb=_0x3737fd;return db['VoiceRecording'][_0xee2f('0x21')](_0x168adc['body']);})[_0xee2f('0xa')](function(_0x180429){if(_0x18bdbb[_0xee2f('0x20')]&&fs[_0xee2f('0x22')](_0x180429[_0xee2f('0x23')])){var _0x47d5a6=util[_0xee2f('0x24')](_0xee2f('0x25'),_0x180429['value']);return _0x4ef690['encryptFile'](_0x180429[_0xee2f('0x23')],_0x47d5a6,config['secrets'][_0xee2f('0x26')])[_0xee2f('0xa')](function(){fs['unlink'](_0x180429[_0xee2f('0x23')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x180429;});}return _0x180429;})['then'](function(_0x3f1fe8){logger[_0xee2f('0xb')]('CreateVoiceRecording',_0x168adc);logger[_0xee2f('0x1b')](_0xee2f('0x1d'),_0x168adc,JSON[_0xee2f('0xd')](_0x3f1fe8));_0x45c4a0(_0x3f1fe8);})[_0xee2f('0x1c')](function(_0x1c3a01){logger['error'](_0xee2f('0x1d'),_0x1c3a01['message'],_0x168adc);_0x53f6ed(_0x1c8454[_0xee2f('0xe')](0x1f4,_0x1c3a01[_0xee2f('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 0cb0924..bc715b2 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 _0xfab8=['index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated'];(function(_0x453ed1,_0x3f7029){var _0x106504=function(_0x4268df){while(--_0x4268df){_0x453ed1['push'](_0x453ed1['shift']());}};_0x106504(++_0x3f7029);}(_0xfab8,0x1d9));var _0x8fab=function(_0x1b0cc4,_0x3cdc37){_0x1b0cc4=_0x1b0cc4-0x0;var _0x2b578e=_0xfab8[_0x1b0cc4];return _0x2b578e;};'use strict';var multer=require(_0x8fab('0x0'));var util=require(_0x8fab('0x1'));var path=require(_0x8fab('0x2'));var timeout=require(_0x8fab('0x3'));var express=require(_0x8fab('0x4'));var router=express[_0x8fab('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8fab('0x6'));var interaction=require(_0x8fab('0x7'));var config=require('../../config/environment');var controller=require(_0x8fab('0x8'));router[_0x8fab('0x9')]('/',auth[_0x8fab('0xa')](),controller[_0x8fab('0xb')]);router[_0x8fab('0x9')](_0x8fab('0xc'),auth[_0x8fab('0xa')](),controller[_0x8fab('0xd')]);router[_0x8fab('0x9')](_0x8fab('0xe'),auth[_0x8fab('0xa')](),controller[_0x8fab('0xf')]);router['post']('/',auth[_0x8fab('0xa')](),controller[_0x8fab('0x10')]);router[_0x8fab('0x11')](_0x8fab('0xe'),auth[_0x8fab('0xa')](),controller[_0x8fab('0x12')]);router[_0x8fab('0x13')](_0x8fab('0xe'),auth[_0x8fab('0xa')](),controller[_0x8fab('0x14')]);module[_0x8fab('0x15')]=router; \ No newline at end of file +var _0x3ea9=['destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','update','delete'];(function(_0x233740,_0x2521d2){var _0x5ed54f=function(_0x414251){while(--_0x414251){_0x233740['push'](_0x233740['shift']());}};_0x5ed54f(++_0x2521d2);}(_0x3ea9,0xa2));var _0x93ea=function(_0x1c2c01,_0x17059b){_0x1c2c01=_0x1c2c01-0x0;var _0x525afd=_0x3ea9[_0x1c2c01];return _0x525afd;};'use strict';var multer=require(_0x93ea('0x0'));var util=require('util');var path=require(_0x93ea('0x1'));var timeout=require(_0x93ea('0x2'));var express=require('express');var router=express[_0x93ea('0x3')]();var fs_extra=require(_0x93ea('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x93ea('0x5'));var config=require(_0x93ea('0x6'));var controller=require('./voiceTransferReport.controller');router[_0x93ea('0x7')]('/',auth['isAuthenticated'](),controller[_0x93ea('0x8')]);router['get'](_0x93ea('0x9'),auth[_0x93ea('0xa')](),controller[_0x93ea('0xb')]);router['get'](_0x93ea('0xc'),auth['isAuthenticated'](),controller[_0x93ea('0xd')]);router[_0x93ea('0xe')]('/',auth[_0x93ea('0xa')](),controller['create']);router[_0x93ea('0xf')](_0x93ea('0xc'),auth['isAuthenticated'](),controller[_0x93ea('0x10')]);router[_0x93ea('0x11')](_0x93ea('0xc'),auth[_0x93ea('0xa')](),controller[_0x93ea('0x12')]);module[_0x93ea('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 c6a8ef0..19f38a6 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 _0x305a=['attended','STRING','ENUM','Yes','sequelize','moment','exports'];(function(_0x118e16,_0x2a6f97){var _0x9f7b89=function(_0xd8909a){while(--_0xd8909a){_0x118e16['push'](_0x118e16['shift']());}};_0x9f7b89(++_0x2a6f97);}(_0x305a,0x1b6));var _0xa305=function(_0x23c6cc,_0x58976c){_0x23c6cc=_0x23c6cc-0x0;var _0x491790=_0x305a[_0x23c6cc];return _0x491790;};'use strict';var Sequelize=require(_0xa305('0x0'));var moment=require(_0xa305('0x1'));module[_0xa305('0x2')]={'type':{'type':Sequelize['ENUM']('blind',_0xa305('0x3'))},'result':{'type':Sequelize[_0xa305('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xa305('0x4')]},'transferercalleridname':{'type':Sequelize[_0xa305('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xa305('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xa305('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xa305('0x4')]},'transferercontext':{'type':Sequelize[_0xa305('0x4')]},'transfererexten':{'type':Sequelize[_0xa305('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xa305('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xa305('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xa305('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xa305('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0xa305('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xa305('0x4')]},'transfereecontext':{'type':Sequelize[_0xa305('0x4')]},'transfereeexten':{'type':Sequelize[_0xa305('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xa305('0x4')]},'isexternal':{'type':Sequelize[_0xa305('0x5')](_0xa305('0x6'),'No')},'context':{'type':Sequelize[_0xa305('0x4')]},'extension':{'type':Sequelize[_0xa305('0x4')]}}; \ No newline at end of file +var _0x466a=['exports','ENUM','blind','attended','STRING','sequelize','moment'];(function(_0x126acb,_0x55ddec){var _0x58853a=function(_0x2c8fe1){while(--_0x2c8fe1){_0x126acb['push'](_0x126acb['shift']());}};_0x58853a(++_0x55ddec);}(_0x466a,0x1da));var _0xa466=function(_0xa6985a,_0x48e4a8){_0xa6985a=_0xa6985a-0x0;var _0x14bc77=_0x466a[_0xa6985a];return _0x14bc77;};'use strict';var Sequelize=require(_0xa466('0x0'));var moment=require(_0xa466('0x1'));module[_0xa466('0x2')]={'type':{'type':Sequelize[_0xa466('0x3')](_0xa466('0x4'),_0xa466('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xa466('0x6')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xa466('0x6')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xa466('0x6')]},'transfereraccountcode':{'type':Sequelize[_0xa466('0x6')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xa466('0x6')]},'transfererlinkedid':{'type':Sequelize[_0xa466('0x6')]},'transfereechannel':{'type':Sequelize[_0xa466('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0xa466('0x6')]},'transfereecalleridname':{'type':Sequelize[_0xa466('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xa466('0x6')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xa466('0x6')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xa466('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index f92e757..9e82f1d 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 _0xb4f2=['bluebird','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/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','VoiceTransferReport','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','create','body','find','params','describe','rimraf','zip-dir'];(function(_0x2e8ba3,_0xc613d1){var _0x183100=function(_0x48a3ec){while(--_0x48a3ec){_0x2e8ba3['push'](_0x2e8ba3['shift']());}};_0x183100(++_0xc613d1);}(_0xb4f2,0x170));var _0x2b4f=function(_0x145570,_0x19f4af){_0x145570=_0x145570-0x0;var _0x5e69ff=_0xb4f2[_0x145570];return _0x5e69ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2b4f('0x0'));var zipdir=require(_0x2b4f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2b4f('0x2'));var Mustache=require('mustache');var util=require(_0x2b4f('0x3'));var path=require(_0x2b4f('0x4'));var sox=require(_0x2b4f('0x5'));var csv=require(_0x2b4f('0x6'));var ejs=require(_0x2b4f('0x7'));var fs=require('fs');var fs_extra=require(_0x2b4f('0x8'));var _=require('lodash');var squel=require(_0x2b4f('0x9'));var crypto=require('crypto');var jsforce=require(_0x2b4f('0xa'));var deskjs=require(_0x2b4f('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2b4f('0xc'));var Papa=require(_0x2b4f('0xd'));var Redis=require(_0x2b4f('0xe'));var authService=require(_0x2b4f('0xf'));var qs=require(_0x2b4f('0x10'));var as=require(_0x2b4f('0x11'));var hardwareService=require(_0x2b4f('0x12'));var logger=require(_0x2b4f('0x13'))(_0x2b4f('0x14'));var utils=require(_0x2b4f('0x15'));var config=require(_0x2b4f('0x16'));var licenseUtil=require(_0x2b4f('0x17'));var db=require(_0x2b4f('0x18'))['db'];function respondWithStatusCode(_0x1299d1,_0xda90b1){_0xda90b1=_0xda90b1||0xcc;return function(_0x12f3ec){if(_0x12f3ec){return _0x1299d1['sendStatus'](_0xda90b1);}return _0x1299d1[_0x2b4f('0x19')](_0xda90b1)[_0x2b4f('0x1a')]();};}function respondWithResult(_0x46e486,_0x103cf8){_0x103cf8=_0x103cf8||0xc8;return function(_0xc24009){if(_0xc24009){return _0x46e486[_0x2b4f('0x19')](_0x103cf8)[_0x2b4f('0x1b')](_0xc24009);}};}function respondWithFilteredResult(_0x52e7cc,_0x33c424){return function(_0xdb387c){if(_0xdb387c){var _0x211af9=typeof _0x33c424['offset']===_0x2b4f('0x1c')&&typeof _0x33c424[_0x2b4f('0x1d')]===_0x2b4f('0x1c');var _0x3e822d=_0xdb387c[_0x2b4f('0x1e')];var _0x23f86a=_0x211af9?0x0:_0x33c424[_0x2b4f('0x1f')];var _0x506162=_0x211af9?_0xdb387c[_0x2b4f('0x1e')]:_0x33c424[_0x2b4f('0x1f')]+_0x33c424['limit'];var _0x562f8a;if(_0x506162>=_0x3e822d){_0x506162=_0x3e822d;_0x562f8a=0xc8;}else{_0x562f8a=0xce;}_0x52e7cc[_0x2b4f('0x19')](_0x562f8a);return _0x52e7cc[_0x2b4f('0x20')](_0x2b4f('0x21'),_0x23f86a+'-'+_0x506162+'/'+_0x3e822d)['json'](_0xdb387c);}return null;};}function patchUpdates(_0x3c40a5){return function(_0x11384c){try{jsonpatch[_0x2b4f('0x22')](_0x11384c,_0x3c40a5,!![]);}catch(_0x3f8d4d){return BPromise['reject'](_0x3f8d4d);}return _0x11384c[_0x2b4f('0x23')]();};}function saveUpdates(_0x2fb7f5,_0x3fcb9e){return function(_0xd435cd){if(_0xd435cd){return _0xd435cd[_0x2b4f('0x24')](_0x2fb7f5)[_0x2b4f('0x25')](function(_0x36d1b6){return _0x36d1b6;});}return null;};}function removeEntity(_0x16b133,_0x3c89a6){return function(_0x87c441){if(_0x87c441){return _0x87c441[_0x2b4f('0x26')]()[_0x2b4f('0x25')](function(){_0x16b133[_0x2b4f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x87ed2d,_0x5a6142){return function(_0x2e499f){if(!_0x2e499f){_0x87ed2d[_0x2b4f('0x27')](0x194);}return _0x2e499f;};}function handleError(_0x5477df,_0x28f979){_0x28f979=_0x28f979||0x1f4;return function(_0x2e9801){logger['error'](_0x2e9801['stack']);if(_0x2e9801[_0x2b4f('0x28')]){delete _0x2e9801[_0x2b4f('0x28')];}_0x5477df[_0x2b4f('0x19')](_0x28f979)[_0x2b4f('0x29')](_0x2e9801);};}exports[_0x2b4f('0x2a')]=function(_0x187d35,_0x460de6){var _0x428f29={},_0x3184e0={},_0x1071a0={'count':0x0,'rows':[]};var _0x35e972=_[_0x2b4f('0x2b')](db[_0x2b4f('0x2c')]['rawAttributes'],function(_0x385b2a){return{'name':_0x385b2a[_0x2b4f('0x2d')],'type':_0x385b2a[_0x2b4f('0x2e')]['key']};});_0x3184e0[_0x2b4f('0x2f')]=_[_0x2b4f('0x2b')](_0x35e972,_0x2b4f('0x28'));_0x3184e0[_0x2b4f('0x30')]=_[_0x2b4f('0x31')](_0x187d35[_0x2b4f('0x30')]);_0x3184e0[_0x2b4f('0x32')]=_['intersection'](_0x3184e0[_0x2b4f('0x2f')],_0x3184e0[_0x2b4f('0x30')]);_0x428f29[_0x2b4f('0x33')]=_[_0x2b4f('0x34')](_0x3184e0['model'],qs[_0x2b4f('0x35')](_0x187d35['query'][_0x2b4f('0x35')]));_0x428f29[_0x2b4f('0x33')]=_0x428f29[_0x2b4f('0x33')][_0x2b4f('0x36')]?_0x428f29['attributes']:_0x3184e0['model'];if(!_0x187d35[_0x2b4f('0x30')][_0x2b4f('0x37')](_0x2b4f('0x38'))){_0x428f29[_0x2b4f('0x1d')]=qs[_0x2b4f('0x1d')](_0x187d35[_0x2b4f('0x30')][_0x2b4f('0x1d')]);_0x428f29[_0x2b4f('0x1f')]=qs[_0x2b4f('0x1f')](_0x187d35[_0x2b4f('0x30')][_0x2b4f('0x1f')]);}_0x428f29['order']=qs[_0x2b4f('0x39')](_0x187d35[_0x2b4f('0x30')][_0x2b4f('0x39')]);_0x428f29['where']=qs['filters'](_[_0x2b4f('0x3a')](_0x187d35['query'],_0x3184e0['filters']),_0x35e972);if(_0x187d35[_0x2b4f('0x30')][_0x2b4f('0x3b')]){_0x428f29[_0x2b4f('0x3c')]=_[_0x2b4f('0x3d')](_0x428f29['where'],{'$or':_[_0x2b4f('0x2b')](_0x35e972,function(_0x39e883){if(_0x39e883[_0x2b4f('0x2e')]!==_0x2b4f('0x3e')){var _0x376f4f={};_0x376f4f[_0x39e883['name']]={'$like':'%'+_0x187d35[_0x2b4f('0x30')][_0x2b4f('0x3b')]+'%'};return _0x376f4f;}})});}_0x428f29=_['merge']({},_0x428f29,_0x187d35[_0x2b4f('0x3f')]);var _0x325324={'where':_0x428f29['where']};return db[_0x2b4f('0x2c')][_0x2b4f('0x1e')](_0x325324)[_0x2b4f('0x25')](function(_0x484af3){_0x1071a0['count']=_0x484af3;if(_0x187d35[_0x2b4f('0x30')][_0x2b4f('0x40')]){_0x428f29[_0x2b4f('0x41')]=[{'all':!![]}];}return db[_0x2b4f('0x2c')]['findAll'](_0x428f29);})[_0x2b4f('0x25')](function(_0x3a9527){_0x1071a0[_0x2b4f('0x42')]=_0x3a9527;return _0x1071a0;})[_0x2b4f('0x25')](respondWithFilteredResult(_0x460de6,_0x428f29))[_0x2b4f('0x43')](handleError(_0x460de6,null));};exports[_0x2b4f('0x44')]=function(_0x4689e0,_0xd55611){var _0x3fb499={'raw':!![],'where':{'id':_0x4689e0['params']['id']}},_0x1f97ef={};_0x1f97ef[_0x2b4f('0x2f')]=_[_0x2b4f('0x31')](db['VoiceTransferReport']['rawAttributes']);_0x1f97ef[_0x2b4f('0x30')]=_[_0x2b4f('0x31')](_0x4689e0[_0x2b4f('0x30')]);_0x1f97ef['filters']=_[_0x2b4f('0x34')](_0x1f97ef['model'],_0x1f97ef['query']);_0x3fb499[_0x2b4f('0x33')]=_[_0x2b4f('0x34')](_0x1f97ef['model'],qs[_0x2b4f('0x35')](_0x4689e0[_0x2b4f('0x30')][_0x2b4f('0x35')]));_0x3fb499['attributes']=_0x3fb499[_0x2b4f('0x33')][_0x2b4f('0x36')]?_0x3fb499[_0x2b4f('0x33')]:_0x1f97ef[_0x2b4f('0x2f')];if(_0x4689e0[_0x2b4f('0x30')][_0x2b4f('0x40')]){_0x3fb499['include']=[{'all':!![]}];}_0x3fb499=_[_0x2b4f('0x3d')]({},_0x3fb499,_0x4689e0['options']);return db[_0x2b4f('0x2c')]['find'](_0x3fb499)[_0x2b4f('0x25')](handleEntityNotFound(_0xd55611,null))['then'](respondWithResult(_0xd55611,null))['catch'](handleError(_0xd55611,null));};exports[_0x2b4f('0x45')]=function(_0x530f7,_0x56ccb1){return db[_0x2b4f('0x2c')]['create'](_0x530f7[_0x2b4f('0x46')],{})['then'](respondWithResult(_0x56ccb1,0xc9))[_0x2b4f('0x43')](handleError(_0x56ccb1,null));};exports[_0x2b4f('0x24')]=function(_0x3690c8,_0x361877){if(_0x3690c8['body']['id']){delete _0x3690c8['body']['id'];}return db[_0x2b4f('0x2c')][_0x2b4f('0x47')]({'where':{'id':_0x3690c8[_0x2b4f('0x48')]['id']}})[_0x2b4f('0x25')](handleEntityNotFound(_0x361877,null))['then'](saveUpdates(_0x3690c8[_0x2b4f('0x46')],null))[_0x2b4f('0x25')](respondWithResult(_0x361877,null))[_0x2b4f('0x43')](handleError(_0x361877,null));};exports[_0x2b4f('0x26')]=function(_0x37cc43,_0x6f2384){return db[_0x2b4f('0x2c')][_0x2b4f('0x47')]({'where':{'id':_0x37cc43['params']['id']}})['then'](handleEntityNotFound(_0x6f2384,null))[_0x2b4f('0x25')](removeEntity(_0x6f2384,null))[_0x2b4f('0x43')](handleError(_0x6f2384,null));};exports[_0x2b4f('0x49')]=function(_0x55be06,_0x3401ce){return db[_0x2b4f('0x2c')][_0x2b4f('0x49')]()['then'](respondWithResult(_0x3401ce,null))[_0x2b4f('0x43')](handleError(_0x3401ce,null));}; \ No newline at end of file +var _0x19e2=['squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs'];(function(_0x418ca2,_0xbe143f){var _0x47ef22=function(_0xac5e53){while(--_0xac5e53){_0x418ca2['push'](_0x418ca2['shift']());}};_0x47ef22(++_0xbe143f);}(_0x19e2,0x11e));var _0x219e=function(_0x2f29d3,_0x4193e1){_0x2f29d3=_0x2f29d3-0x0;var _0x5a526e=_0x19e2[_0x2f29d3];return _0x5a526e;};'use strict';var emlformat=require(_0x219e('0x0'));var rimraf=require(_0x219e('0x1'));var zipdir=require(_0x219e('0x2'));var jsonpatch=require(_0x219e('0x3'));var rp=require(_0x219e('0x4'));var moment=require('moment');var BPromise=require(_0x219e('0x5'));var Mustache=require(_0x219e('0x6'));var util=require(_0x219e('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x219e('0x8'));var ejs=require(_0x219e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x219e('0xa'));var crypto=require(_0x219e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x219e('0xc'));var toCsv=require(_0x219e('0x8'));var querystring=require('querystring');var Papa=require(_0x219e('0xd'));var Redis=require(_0x219e('0xe'));var authService=require(_0x219e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x219e('0x10'));var hardwareService=require(_0x219e('0x11'));var logger=require(_0x219e('0x12'))(_0x219e('0x13'));var utils=require(_0x219e('0x14'));var config=require(_0x219e('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa67649,_0x120bcf){_0x120bcf=_0x120bcf||0xcc;return function(_0x53db4a){if(_0x53db4a){return _0xa67649[_0x219e('0x16')](_0x120bcf);}return _0xa67649[_0x219e('0x17')](_0x120bcf)[_0x219e('0x18')]();};}function respondWithResult(_0x1afceb,_0x451191){_0x451191=_0x451191||0xc8;return function(_0x5e519d){if(_0x5e519d){return _0x1afceb['status'](_0x451191)[_0x219e('0x19')](_0x5e519d);}};}function respondWithFilteredResult(_0x3b1a1c,_0x1c7adc){return function(_0x2e7777){if(_0x2e7777){var _0x576c4c=typeof _0x1c7adc[_0x219e('0x1a')]===_0x219e('0x1b')&&typeof _0x1c7adc['limit']===_0x219e('0x1b');var _0x4b0403=_0x2e7777[_0x219e('0x1c')];var _0x78ee9e=_0x576c4c?0x0:_0x1c7adc[_0x219e('0x1a')];var _0x3b74ff=_0x576c4c?_0x2e7777[_0x219e('0x1c')]:_0x1c7adc[_0x219e('0x1a')]+_0x1c7adc[_0x219e('0x1d')];var _0x52b98e;if(_0x3b74ff>=_0x4b0403){_0x3b74ff=_0x4b0403;_0x52b98e=0xc8;}else{_0x52b98e=0xce;}_0x3b1a1c[_0x219e('0x17')](_0x52b98e);return _0x3b1a1c[_0x219e('0x1e')](_0x219e('0x1f'),_0x78ee9e+'-'+_0x3b74ff+'/'+_0x4b0403)[_0x219e('0x19')](_0x2e7777);}return null;};}function patchUpdates(_0x2781e0){return function(_0x151b3c){try{jsonpatch[_0x219e('0x20')](_0x151b3c,_0x2781e0,!![]);}catch(_0xc5057f){return BPromise[_0x219e('0x21')](_0xc5057f);}return _0x151b3c['save']();};}function saveUpdates(_0x31581d,_0x21d51d){return function(_0x3ada27){if(_0x3ada27){return _0x3ada27[_0x219e('0x22')](_0x31581d)['then'](function(_0x3a636b){return _0x3a636b;});}return null;};}function removeEntity(_0x256b0d,_0xd5d9d9){return function(_0x4ea567){if(_0x4ea567){return _0x4ea567[_0x219e('0x23')]()[_0x219e('0x24')](function(){_0x256b0d['status'](0xcc)[_0x219e('0x18')]();});}};}function handleEntityNotFound(_0x2a98d3,_0x3f3c76){return function(_0x59e8ea){if(!_0x59e8ea){_0x2a98d3[_0x219e('0x16')](0x194);}return _0x59e8ea;};}function handleError(_0x5ca40a,_0x40bdbe){_0x40bdbe=_0x40bdbe||0x1f4;return function(_0x43bb4e){logger[_0x219e('0x25')](_0x43bb4e[_0x219e('0x26')]);if(_0x43bb4e[_0x219e('0x27')]){delete _0x43bb4e['name'];}_0x5ca40a[_0x219e('0x17')](_0x40bdbe)[_0x219e('0x28')](_0x43bb4e);};}exports[_0x219e('0x29')]=function(_0x57b44c,_0x37c17e){var _0x1d56c0={},_0x2b8da0={},_0x2a1e55={'count':0x0,'rows':[]};var _0x49452a=_['map'](db[_0x219e('0x2a')][_0x219e('0x2b')],function(_0x229eb4){return{'name':_0x229eb4[_0x219e('0x2c')],'type':_0x229eb4[_0x219e('0x2d')][_0x219e('0x2e')]};});_0x2b8da0[_0x219e('0x2f')]=_['map'](_0x49452a,'name');_0x2b8da0[_0x219e('0x30')]=_[_0x219e('0x31')](_0x57b44c[_0x219e('0x30')]);_0x2b8da0[_0x219e('0x32')]=_[_0x219e('0x33')](_0x2b8da0[_0x219e('0x2f')],_0x2b8da0['query']);_0x1d56c0['attributes']=_['intersection'](_0x2b8da0[_0x219e('0x2f')],qs[_0x219e('0x34')](_0x57b44c[_0x219e('0x30')][_0x219e('0x34')]));_0x1d56c0[_0x219e('0x35')]=_0x1d56c0['attributes'][_0x219e('0x36')]?_0x1d56c0['attributes']:_0x2b8da0[_0x219e('0x2f')];if(!_0x57b44c[_0x219e('0x30')]['hasOwnProperty']('nolimit')){_0x1d56c0['limit']=qs['limit'](_0x57b44c['query']['limit']);_0x1d56c0[_0x219e('0x1a')]=qs[_0x219e('0x1a')](_0x57b44c[_0x219e('0x30')][_0x219e('0x1a')]);}_0x1d56c0[_0x219e('0x37')]=qs[_0x219e('0x38')](_0x57b44c['query'][_0x219e('0x38')]);_0x1d56c0['where']=qs[_0x219e('0x32')](_[_0x219e('0x39')](_0x57b44c[_0x219e('0x30')],_0x2b8da0[_0x219e('0x32')]),_0x49452a);if(_0x57b44c['query'][_0x219e('0x3a')]){_0x1d56c0[_0x219e('0x3b')]=_[_0x219e('0x3c')](_0x1d56c0[_0x219e('0x3b')],{'$or':_[_0x219e('0x3d')](_0x49452a,function(_0x2cc251){if(_0x2cc251['type']!==_0x219e('0x3e')){var _0x30bd35={};_0x30bd35[_0x2cc251[_0x219e('0x27')]]={'$like':'%'+_0x57b44c[_0x219e('0x30')][_0x219e('0x3a')]+'%'};return _0x30bd35;}})});}_0x1d56c0=_[_0x219e('0x3c')]({},_0x1d56c0,_0x57b44c[_0x219e('0x3f')]);var _0x415595={'where':_0x1d56c0['where']};return db['VoiceTransferReport']['count'](_0x415595)[_0x219e('0x24')](function(_0x5f1826){_0x2a1e55[_0x219e('0x1c')]=_0x5f1826;if(_0x57b44c[_0x219e('0x30')][_0x219e('0x40')]){_0x1d56c0[_0x219e('0x41')]=[{'all':!![]}];}return db[_0x219e('0x2a')][_0x219e('0x42')](_0x1d56c0);})[_0x219e('0x24')](function(_0x19e782){_0x2a1e55[_0x219e('0x43')]=_0x19e782;return _0x2a1e55;})[_0x219e('0x24')](respondWithFilteredResult(_0x37c17e,_0x1d56c0))[_0x219e('0x44')](handleError(_0x37c17e,null));};exports['show']=function(_0x5715da,_0x593e06){var _0x58f280={'raw':!![],'where':{'id':_0x5715da['params']['id']}},_0x580743={};_0x580743[_0x219e('0x2f')]=_[_0x219e('0x31')](db[_0x219e('0x2a')][_0x219e('0x2b')]);_0x580743[_0x219e('0x30')]=_[_0x219e('0x31')](_0x5715da[_0x219e('0x30')]);_0x580743[_0x219e('0x32')]=_['intersection'](_0x580743[_0x219e('0x2f')],_0x580743[_0x219e('0x30')]);_0x58f280[_0x219e('0x35')]=_[_0x219e('0x33')](_0x580743[_0x219e('0x2f')],qs[_0x219e('0x34')](_0x5715da[_0x219e('0x30')][_0x219e('0x34')]));_0x58f280['attributes']=_0x58f280[_0x219e('0x35')][_0x219e('0x36')]?_0x58f280[_0x219e('0x35')]:_0x580743[_0x219e('0x2f')];if(_0x5715da[_0x219e('0x30')]['includeAll']){_0x58f280[_0x219e('0x41')]=[{'all':!![]}];}_0x58f280=_[_0x219e('0x3c')]({},_0x58f280,_0x5715da['options']);return db[_0x219e('0x2a')][_0x219e('0x45')](_0x58f280)[_0x219e('0x24')](handleEntityNotFound(_0x593e06,null))[_0x219e('0x24')](respondWithResult(_0x593e06,null))[_0x219e('0x44')](handleError(_0x593e06,null));};exports[_0x219e('0x46')]=function(_0x183946,_0x41f97f){return db[_0x219e('0x2a')][_0x219e('0x46')](_0x183946[_0x219e('0x47')],{})['then'](respondWithResult(_0x41f97f,0xc9))[_0x219e('0x44')](handleError(_0x41f97f,null));};exports['update']=function(_0x463874,_0x59100c){if(_0x463874[_0x219e('0x47')]['id']){delete _0x463874['body']['id'];}return db[_0x219e('0x2a')][_0x219e('0x45')]({'where':{'id':_0x463874['params']['id']}})[_0x219e('0x24')](handleEntityNotFound(_0x59100c,null))[_0x219e('0x24')](saveUpdates(_0x463874[_0x219e('0x47')],null))[_0x219e('0x24')](respondWithResult(_0x59100c,null))['catch'](handleError(_0x59100c,null));};exports[_0x219e('0x23')]=function(_0x6a81b1,_0x8c974a){return db[_0x219e('0x2a')]['find']({'where':{'id':_0x6a81b1[_0x219e('0x48')]['id']}})[_0x219e('0x24')](handleEntityNotFound(_0x8c974a,null))[_0x219e('0x24')](removeEntity(_0x8c974a,null))[_0x219e('0x44')](handleError(_0x8c974a,null));};exports[_0x219e('0x49')]=function(_0xa59fbb,_0x1562b6){return db[_0x219e('0x2a')][_0x219e('0x49')]()[_0x219e('0x24')](respondWithResult(_0x1562b6,null))['catch'](handleError(_0x1562b6,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index e462a39..75f206b 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 _0x404d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer'];(function(_0x58284a,_0x15dbf1){var _0x39fd61=function(_0x5bac09){while(--_0x5bac09){_0x58284a['push'](_0x58284a['shift']());}};_0x39fd61(++_0x15dbf1);}(_0x404d,0x9a));var _0xd404=function(_0x59f735,_0x388a22){_0x59f735=_0x59f735-0x0;var _0x1905c3=_0x404d[_0x59f735];return _0x1905c3;};'use strict';var _=require(_0xd404('0x0'));var util=require(_0xd404('0x1'));var logger=require(_0xd404('0x2'))(_0xd404('0x3'));var moment=require(_0xd404('0x4'));var BPromise=require(_0xd404('0x5'));var rp=require(_0xd404('0x6'));var fs=require('fs');var path=require(_0xd404('0x7'));var rimraf=require(_0xd404('0x8'));var config=require('../../config/environment');var attributes=require(_0xd404('0x9'));module[_0xd404('0xa')]=function(_0x3d1a0a,_0x3273da){return _0x3d1a0a[_0xd404('0xb')](_0xd404('0xc'),attributes,{'tableName':_0xd404('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6c8=['report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport'];(function(_0x24df4f,_0x5c6ee1){var _0x28c9f2=function(_0xf574bd){while(--_0xf574bd){_0x24df4f['push'](_0x24df4f['shift']());}};_0x28c9f2(++_0x5c6ee1);}(_0xf6c8,0xb7));var _0x8f6c=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xf6c8[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x8f6c('0x0'));var util=require(_0x8f6c('0x1'));var logger=require(_0x8f6c('0x2'))(_0x8f6c('0x3'));var moment=require(_0x8f6c('0x4'));var BPromise=require(_0x8f6c('0x5'));var rp=require(_0x8f6c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8f6c('0x7'));var attributes=require(_0x8f6c('0x8'));module[_0x8f6c('0x9')]=function(_0x1215b0,_0x2f3b8d){return _0x1215b0[_0x8f6c('0xa')](_0x8f6c('0xb'),attributes,{'tableName':_0x8f6c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 211ff9e..e81d3f8 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 _0xa073=['CreateVoiceTransferReport','VoiceTransferReport','create','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','client','then','info','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xa073,0xdd));var _0x3a07=function(_0x341fe4,_0x5901b9){_0x341fe4=_0x341fe4-0x0;var _0x3dbed7=_0xa073[_0x341fe4];return _0x3dbed7;};'use strict';var _=require(_0x3a07('0x0'));var util=require(_0x3a07('0x1'));var moment=require(_0x3a07('0x2'));var BPromise=require('bluebird');var rs=require(_0x3a07('0x3'));var fs=require('fs');var Redis=require(_0x3a07('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3a07('0x5'));var logger=require(_0x3a07('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3a07('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4370b9,_0x45bd15,_0x1dde05){return new BPromise(function(_0x58091e,_0x5bca45){return client['request'](_0x4370b9,_0x1dde05)[_0x3a07('0x8')](function(_0x1e45d5){logger[_0x3a07('0x9')]('VoiceTransferReport,\x20%s,\x20%s',_0x45bd15,_0x3a07('0xa'));logger['debug'](_0x3a07('0xb'),_0x45bd15,'request\x20sent',JSON[_0x3a07('0xc')](_0x1e45d5));if(_0x1e45d5[_0x3a07('0xd')]){if(_0x1e45d5[_0x3a07('0xd')][_0x3a07('0xe')]===0x1f4){logger[_0x3a07('0xd')](_0x3a07('0xf'),_0x45bd15,_0x1e45d5['error']['message']);return _0x5bca45(_0x1e45d5[_0x3a07('0xd')]['message']);}logger[_0x3a07('0xd')](_0x3a07('0xf'),_0x45bd15,_0x1e45d5[_0x3a07('0xd')][_0x3a07('0x10')]);return _0x58091e(_0x1e45d5[_0x3a07('0xd')][_0x3a07('0x10')]);}else{logger['info'](_0x3a07('0xf'),_0x45bd15,'request\x20sent');_0x58091e(_0x1e45d5[_0x3a07('0x11')][_0x3a07('0x10')]);}})[_0x3a07('0x12')](function(_0x3bdb9b){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x45bd15,_0x3bdb9b);_0x5bca45(_0x3bdb9b);});});}exports[_0x3a07('0x13')]=function(_0x1c3950){var _0x3a2fe6=this;return new Promise(function(_0x2f70bf,_0xc68519){return db[_0x3a07('0x14')][_0x3a07('0x15')](_0x1c3950[_0x3a07('0x16')],{'raw':_0x1c3950['options']?_0x1c3950[_0x3a07('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x3a07('0x8')](function(_0x106ed4){logger[_0x3a07('0x9')](_0x3a07('0x13'),_0x1c3950);logger['debug'](_0x3a07('0x13'),_0x1c3950,JSON[_0x3a07('0xc')](_0x106ed4));_0x2f70bf(_0x106ed4);})[_0x3a07('0x12')](function(_0x1fc032){logger[_0x3a07('0xd')]('CreateVoiceTransferReport',_0x1fc032[_0x3a07('0x10')],_0x1c3950);_0xc68519(_0x3a2fe6['error'](0x1f4,_0x1fc032[_0x3a07('0x10')]));});});}; \ No newline at end of file +var _0x2788=['then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateVoiceTransferReport','body','options','raw','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0x1fb377,_0x2812c1){var _0x17cd92=function(_0x4a8b38){while(--_0x4a8b38){_0x1fb377['push'](_0x1fb377['shift']());}};_0x17cd92(++_0x2812c1);}(_0x2788,0x13a));var _0x8278=function(_0x359d9c,_0x24dfd6){_0x359d9c=_0x359d9c-0x0;var _0x11935d=_0x2788[_0x359d9c];return _0x11935d;};'use strict';var _=require(_0x8278('0x0'));var util=require(_0x8278('0x1'));var moment=require(_0x8278('0x2'));var BPromise=require('bluebird');var rs=require(_0x8278('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8278('0x4'))['db'];var utils=require(_0x8278('0x5'));var logger=require(_0x8278('0x6'))('rpc');var config=require(_0x8278('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8278('0x8')][_0x8278('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59c87a,_0xc02624,_0x49b48d){return new BPromise(function(_0x126f49,_0x4075dc){return client[_0x8278('0xa')](_0x59c87a,_0x49b48d)[_0x8278('0xb')](function(_0x57b6ca){logger[_0x8278('0xc')](_0x8278('0xd'),_0xc02624,_0x8278('0xe'));logger[_0x8278('0xf')](_0x8278('0x10'),_0xc02624,_0x8278('0xe'),JSON[_0x8278('0x11')](_0x57b6ca));if(_0x57b6ca[_0x8278('0x12')]){if(_0x57b6ca[_0x8278('0x12')]['code']===0x1f4){logger[_0x8278('0x12')](_0x8278('0xd'),_0xc02624,_0x57b6ca['error'][_0x8278('0x13')]);return _0x4075dc(_0x57b6ca[_0x8278('0x12')][_0x8278('0x13')]);}logger[_0x8278('0x12')](_0x8278('0xd'),_0xc02624,_0x57b6ca[_0x8278('0x12')][_0x8278('0x13')]);return _0x126f49(_0x57b6ca[_0x8278('0x12')][_0x8278('0x13')]);}else{logger[_0x8278('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0xc02624,_0x8278('0xe'));_0x126f49(_0x57b6ca['result']['message']);}})[_0x8278('0x14')](function(_0x3ab826){logger[_0x8278('0x12')](_0x8278('0xd'),_0xc02624,_0x3ab826);_0x4075dc(_0x3ab826);});});}exports[_0x8278('0x15')]=function(_0x4dc7cc){var _0x2eaeff=this;return new Promise(function(_0x356592,_0x19804a){return db['VoiceTransferReport']['create'](_0x4dc7cc[_0x8278('0x16')],{'raw':_0x4dc7cc[_0x8278('0x17')]?_0x4dc7cc['options'][_0x8278('0x18')]===undefined?!![]:![]:!![]})[_0x8278('0xb')](function(_0x1a064d){logger[_0x8278('0xc')](_0x8278('0x15'),_0x4dc7cc);logger[_0x8278('0xf')](_0x8278('0x15'),_0x4dc7cc,JSON[_0x8278('0x11')](_0x1a064d));_0x356592(_0x1a064d);})[_0x8278('0x14')](function(_0x5ce483){logger[_0x8278('0x12')](_0x8278('0x15'),_0x5ce483[_0x8278('0x13')],_0x4dc7cc);_0x19804a(_0x2eaeff[_0x8278('0x12')](0x1f4,_0x5ce483[_0x8278('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index bd76c24..ccacd3b 100644 --- a/server/api/webbar/index.js +++ b/server/api/webbar/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x91a7=['/originate','isWebrtcLicence','/hangup','isAuthenticated','hangup','/answer','answer','post','/hold','/unhold','unhold','/calls','/transfer','transfer','exports','Router','../../components/auth/service','./webbar.controller'];(function(_0x49d19d,_0x245cf5){var _0x4ebef1=function(_0xf0a4e6){while(--_0xf0a4e6){_0x49d19d['push'](_0x49d19d['shift']());}};_0x4ebef1(++_0x245cf5);}(_0x91a7,0xe7));var _0x791a=function(_0x360fc4,_0x5a0690){_0x360fc4=_0x360fc4-0x0;var _0x1a18d7=_0x91a7[_0x360fc4];return _0x1a18d7;};'use strict';var express=require('express');var router=express[_0x791a('0x0')]();var auth=require(_0x791a('0x1'));var controller=require(_0x791a('0x2'));router['post'](_0x791a('0x3'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller['originate']);router['post'](_0x791a('0x5'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x7')]);router['post'](_0x791a('0x8'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x9')]);router[_0x791a('0xa')](_0x791a('0xb'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['hold']);router[_0x791a('0xa')](_0x791a('0xc'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller[_0x791a('0xd')]);router[_0x791a('0xa')](_0x791a('0xe'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['calls']);router['post'](_0x791a('0xf'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x10')]);module[_0x791a('0x11')]=router; \ No newline at end of file +var _0xbec5=['exports','express','Router','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','/hangup','hangup','/answer','answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer'];(function(_0x4b94bf,_0x3214e1){var _0x732131=function(_0x3ff0a3){while(--_0x3ff0a3){_0x4b94bf['push'](_0x4b94bf['shift']());}};_0x732131(++_0x3214e1);}(_0xbec5,0xe5));var _0x5bec=function(_0x413aac,_0x5e2430){_0x413aac=_0x413aac-0x0;var _0x569b11=_0xbec5[_0x413aac];return _0x569b11;};'use strict';var express=require(_0x5bec('0x0'));var router=express[_0x5bec('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x5bec('0x2'));router[_0x5bec('0x3')](_0x5bec('0x4'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller['originate']);router[_0x5bec('0x3')](_0x5bec('0x7'),auth[_0x5bec('0x5')](),auth['isWebrtcLicence'](),controller[_0x5bec('0x8')]);router[_0x5bec('0x3')](_0x5bec('0x9'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller[_0x5bec('0xa')]);router[_0x5bec('0x3')](_0x5bec('0xb'),auth['isAuthenticated'](),auth[_0x5bec('0x6')](),controller['hold']);router[_0x5bec('0x3')](_0x5bec('0xc'),auth[_0x5bec('0x5')](),auth['isWebrtcLicence'](),controller[_0x5bec('0xd')]);router[_0x5bec('0x3')](_0x5bec('0xe'),auth['isAuthenticated'](),auth[_0x5bec('0x6')](),controller[_0x5bec('0xf')]);router['post'](_0x5bec('0x10'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller[_0x5bec('0x11')]);module[_0x5bec('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index c47fb06..ee53abe 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 _0xb28a=['redis','defaults','localhost','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','log','handleError:','error','stack','name','send','status','NotFound','then','code','message','catch','User','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','originate\x20fired:','body','json','callNumber','callerId','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','hangup','info','userId','format','hangup\x20executed!','answer','answer\x20fired:','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','util','http','../../config/logger','webbarapi','ioredis'];(function(_0x11d860,_0x5c260b){var _0x2a5914=function(_0x43cf7b){while(--_0x43cf7b){_0x11d860['push'](_0x11d860['shift']());}};_0x2a5914(++_0x5c260b);}(_0xb28a,0x166));var _0xab28=function(_0x378edb,_0x125fa7){_0x378edb=_0x378edb-0x0;var _0x19605a=_0xb28a[_0x378edb];return _0x19605a;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xab28('0x0'));var db=require(_0xab28('0x1'))['db'];var config=require('../../config/environment');var util=require(_0xab28('0x2'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var amiClient=jayson['client'][_0xab28('0x3')]({'port':0x232a});var logger=require(_0xab28('0x4'))(_0xab28('0x5'));var Redis=require(_0xab28('0x6'));config[_0xab28('0x7')]=_[_0xab28('0x8')](config[_0xab28('0x7')],{'host':_0xab28('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0xab28('0xa'));var originateValidation=new Schema({'userId':{'type':_0xab28('0xb'),'required':[!![],_0xab28('0xc')]},'callNumber':{'type':_0xab28('0xd'),'required':[!![],_0xab28('0xe')]},'callerId':{'type':_0xab28('0xd')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xab28('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xab28('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xab28('0xb'),'required':[!![],_0xab28('0xc')]},'sessionId':{'type':_0xab28('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xab28('0xb'),'required':[!![],_0xab28('0xc')]},'sessionId':{'type':_0xab28('0xd'),'required':[!![],_0xab28('0xf')]},'transferNumber':{'type':'string','required':[!![],_0xab28('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0xab28('0xb'),'required':[!![],_0xab28('0xc')]},'sessionId':{'type':_0xab28('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xab28('0xb'),'required':[!![],_0xab28('0xc')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xab28('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0xab28('0xb'),'required':[!![],_0xab28('0xc')]}});function emit(_0xaaeb24,_0x53c5c7,_0x28ebe2){logger['info'](_0xaaeb24,_0x53c5c7,JSON[_0xab28('0x11')](_0x28ebe2));io['to'](_0xaaeb24)['emit'](_0x53c5c7,_0x28ebe2);}function handleError(_0x242bd4){return function(_0x2b0b5c){console[_0xab28('0x12')](_0xab28('0x13'),_0x2b0b5c,_0x2b0b5c instanceof RangeError);logger[_0xab28('0x14')](_0x2b0b5c[_0xab28('0x15')]);if(_0x2b0b5c instanceof RangeError){if(_0x2b0b5c[_0xab28('0x16')]){delete _0x2b0b5c[_0xab28('0x16')];}_0x242bd4['status'](0x194)[_0xab28('0x17')](_0x2b0b5c);}else{if(_0x2b0b5c[_0xab28('0x16')]){delete _0x2b0b5c[_0xab28('0x16')];}_0x242bd4[_0xab28('0x18')](0x1f4)[_0xab28('0x17')](_0x2b0b5c);}};}function checkError(){return function(_0x1d1690){if(!_0x1d1690){throw new RangeError(_0xab28('0x19'));}return _0x1d1690;};}function respondWithRpcPromise(_0x56d797,_0x116c2c){return new BPromise(function(_0x4ec564,_0x1db226){var _0x127e2b=amiClient;return _0x127e2b['request'](_0x56d797,_0x116c2c)[_0xab28('0x1a')](function(_0x1829bd){if(_0x1829bd[_0xab28('0x14')]){if(_0x1829bd[_0xab28('0x14')][_0xab28('0x1b')]===0x1f4){return _0x1db226(_0x1829bd[_0xab28('0x14')][_0xab28('0x1c')]);}return _0x4ec564(_0x1829bd['error'][_0xab28('0x1c')]);}else{_0x4ec564(_0x1829bd['result']);}})[_0xab28('0x1d')](function(_0x2e6359){_0x1db226(_0x2e6359);});});}function getAgent(_0x5069d0){return db[_0xab28('0x1e')]['findOne']({'where':{'id':_0x5069d0,'role':_0xab28('0x1f')}})[_0xab28('0x1a')](checkError());}function getAgentCheckSession(_0x3d8c60,_0x4e3b93){return new BPromise(function(_0x24a692,_0xdeef4e){var _0x4a6435=respondWithRpcPromise(_0xab28('0x20'));var _0x46b19b=getAgent(_0x3d8c60);Promise[_0xab28('0x21')]([_0x4a6435,_0x46b19b])[_0xab28('0x1a')](function(_0x537f64){var _0x163f1b=_0x537f64[0x0];var _0x299da7=_0x537f64[0x1];var _0x33e5ce=_[_0xab28('0x22')](_0x163f1b[_0xab28('0x23')],function(_0x4114fd){return _0x4114fd[_0xab28('0x24')]==_0x299da7['id']&&_0x4114fd[_0xab28('0x25')]==_0x4e3b93;});if(_0x33e5ce[_0xab28('0x26')]==0x1){_0x24a692(_0x299da7);}else{_0xdeef4e(new RangeError(_0xab28('0x27')+_0x4e3b93+'\x20not\x20found!'));}});});}exports['originate']=function(_0x41126b,_0x4cbc0b){logger['info'](_0xab28('0x28'),_0x41126b[_0xab28('0x29')]);var _0xcf5d05=originateValidation[_0xab28('0xa')](_0x41126b[_0xab28('0x29')]);if(_0xcf5d05[_0xab28('0x26')]>0x0){return _0x4cbc0b['status'](0x190)[_0xab28('0x2a')](_0xcf5d05);}var _0x1f3199=_0x41126b[_0xab28('0x29')]['userId'];var _0x9ab55=_0x41126b['body'][_0xab28('0x2b')];var _0x267aaa=_0x41126b['body'][_0xab28('0x2c')];var _0x12b5df=_0x41126b[_0xab28('0x29')][_0xab28('0x2d')];return getAgent(_0x1f3199)[_0xab28('0x1a')](function(_0x42c6ec){logger['info'](_0xab28('0x2e'),_0x42c6ec[_0xab28('0x16')]);emit(util['format'](_0xab28('0x2f'),_0x42c6ec[_0xab28('0x16')]),_0xab28('0x30'),{'callNumber':_0x9ab55,'callerId':_0x267aaa,'callbackUrl':_0x12b5df});return _0x4cbc0b[_0xab28('0x18')](0xc8)[_0xab28('0x2a')]({'error':![],'message':_0xab28('0x31')});})[_0xab28('0x1d')](handleError(_0x4cbc0b));};exports[_0xab28('0x32')]=function(_0x51aefa,_0x207ac3){logger[_0xab28('0x33')]('hangup\x20fired:',_0x51aefa[_0xab28('0x29')]);var _0x3a6588=hangupValidation['validate'](_0x51aefa[_0xab28('0x29')]);if(_0x3a6588[_0xab28('0x26')]>0x0){return _0x207ac3[_0xab28('0x18')](0x190)[_0xab28('0x2a')](_0x3a6588);}var _0x1fadc6=_0x51aefa[_0xab28('0x29')][_0xab28('0x34')];var _0x57bb8e=_0x51aefa[_0xab28('0x29')][_0xab28('0x25')];return getAgent(_0x1fadc6)['then'](function(_0x1e59b8){logger[_0xab28('0x33')](_0xab28('0x2e'),_0x1e59b8[_0xab28('0x16')]);emit(util[_0xab28('0x35')]('user:%s',_0x1e59b8[_0xab28('0x16')]),'webbar:hangup',{'sessionId':_0x57bb8e});return _0x207ac3['status'](0xc8)[_0xab28('0x2a')]({'error':![],'message':_0xab28('0x36')});})[_0xab28('0x1d')](handleError(_0x207ac3));};exports[_0xab28('0x37')]=function(_0x2c0b34,_0x538a9e){logger['info'](_0xab28('0x38'),_0x2c0b34['body']);var _0x2a8b57=answerValidation['validate'](_0x2c0b34['body']);if(_0x2a8b57[_0xab28('0x26')]>0x0){return _0x538a9e[_0xab28('0x18')](0x190)[_0xab28('0x2a')](_0x2a8b57);}var _0xb437c5=_0x2c0b34[_0xab28('0x29')][_0xab28('0x34')];var _0x53c232=_0x2c0b34['body'][_0xab28('0x25')];return getAgent(_0xb437c5)['then'](function(_0x406b8a){logger['info'](_0xab28('0x2e'),_0x406b8a['name']);emit(util['format'](_0xab28('0x2f'),_0x406b8a['name']),'webbar:answer',{'sessionId':_0x53c232});return _0x538a9e['status'](0xc8)[_0xab28('0x2a')]({'error':![],'message':'answer\x20executed!'});})[_0xab28('0x1d')](handleError(_0x538a9e));};exports[_0xab28('0x39')]=function(_0x3f1da9,_0x1016c3){logger['info'](_0xab28('0x3a'),_0x3f1da9[_0xab28('0x29')]);var _0x3c7e5b=holdValidation[_0xab28('0xa')](_0x3f1da9[_0xab28('0x29')]);if(_0x3c7e5b['length']>0x0){return _0x1016c3[_0xab28('0x18')](0x190)[_0xab28('0x2a')](_0x3c7e5b);}var _0x49bb4f=_0x3f1da9[_0xab28('0x29')]['userId'];var _0x47cd07=_0x3f1da9[_0xab28('0x29')][_0xab28('0x25')];return getAgent(_0x49bb4f)['then'](function(_0x39a4ef){logger['info'](_0xab28('0x2e'),_0x39a4ef[_0xab28('0x16')]);emit(util[_0xab28('0x35')](_0xab28('0x2f'),_0x39a4ef['name']),_0xab28('0x3b'),{'sessionId':_0x47cd07});return _0x1016c3['status'](0xc8)['json']({'error':![],'message':_0xab28('0x3c')});})['catch'](handleError(_0x1016c3));};exports[_0xab28('0x3d')]=function(_0x199734,_0x4ada8a){logger[_0xab28('0x33')](_0xab28('0x3e'),_0x199734[_0xab28('0x29')]);var _0x41dd3d=unholdValidation['validate'](_0x199734[_0xab28('0x29')]);if(_0x41dd3d[_0xab28('0x26')]>0x0){return _0x4ada8a[_0xab28('0x18')](0x190)[_0xab28('0x2a')](_0x41dd3d);}var _0x27fb7a=_0x199734[_0xab28('0x29')][_0xab28('0x34')];var _0x1da81c=_0x199734['body'][_0xab28('0x25')];return getAgent(_0x27fb7a)[_0xab28('0x1a')](function(_0x12ebde){logger[_0xab28('0x33')](_0xab28('0x2e'),_0x12ebde[_0xab28('0x16')]);emit(util[_0xab28('0x35')](_0xab28('0x2f'),_0x12ebde[_0xab28('0x16')]),_0xab28('0x3f'),{'sessionId':_0x1da81c});return _0x4ada8a[_0xab28('0x18')](0xc8)['json']({'error':![],'message':_0xab28('0x40')});})['catch'](handleError(_0x4ada8a));};exports['calls']=function(_0xfef4b9,_0x46352d){logger[_0xab28('0x33')]('calls\x20fired:',_0x46352d['body']);var _0x13265a=callsValidation[_0xab28('0xa')](_0xfef4b9[_0xab28('0x29')]);if(_0x13265a[_0xab28('0x26')]>0x0){return _0x46352d[_0xab28('0x18')](0x190)[_0xab28('0x2a')](_0x13265a);}var _0x335a50=_0xfef4b9[_0xab28('0x29')][_0xab28('0x34')];var _0x2c52e8=respondWithRpcPromise(_0xab28('0x20'));var _0x311261=getAgent(_0x335a50);return Promise[_0xab28('0x21')]([_0x2c52e8,_0x311261])[_0xab28('0x1a')](function(_0x1937cb){var _0x2d99b1=_0x1937cb[0x0];var _0x74479d=_0x1937cb[0x1];var _0x29d762=_[_0xab28('0x22')](_0x2d99b1[_0xab28('0x23')],function(_0x473c0b){return _0x473c0b[_0xab28('0x24')]==_0x74479d['id'];});return _0x46352d[_0xab28('0x18')](0xc8)[_0xab28('0x2a')]({'count':_0x29d762[_0xab28('0x26')],'rows':_0x29d762});})[_0xab28('0x1d')](handleError(_0x46352d));};exports[_0xab28('0x41')]=function(_0x537b9a,_0x2ad92b){logger[_0xab28('0x33')](_0xab28('0x42'),_0x537b9a['body']);var _0x195b48=conferenceValidation['validate'](_0x537b9a[_0xab28('0x29')]);if(_0x195b48[_0xab28('0x26')]>0x0){return _0x2ad92b['status'](0x190)['json'](_0x195b48);}var _0x41a109=_0x537b9a[_0xab28('0x29')]['userId'];return getAgent(_0x41a109)[_0xab28('0x1a')](function(_0x58ab41){logger['info'](_0xab28('0x2e'),_0x58ab41[_0xab28('0x16')]);emit(util[_0xab28('0x35')]('user:%s',_0x58ab41[_0xab28('0x16')]),_0xab28('0x43'));return _0x2ad92b[_0xab28('0x18')](0xc8)[_0xab28('0x2a')]({'error':![],'message':_0xab28('0x44')});})[_0xab28('0x1d')](handleError(_0x2ad92b));};exports[_0xab28('0x45')]=function(_0x4a622f,_0x124573){logger[_0xab28('0x33')](_0xab28('0x46'),_0x4a622f[_0xab28('0x29')]);var _0x21b1a6=transferValidation[_0xab28('0xa')](_0x4a622f[_0xab28('0x29')]);if(_0x21b1a6['length']>0x0){return _0x124573[_0xab28('0x18')](0x190)[_0xab28('0x2a')](_0x21b1a6);}var _0x4e1176=_0x4a622f[_0xab28('0x29')]['userId'];var _0x153894=_0x4a622f['body'][_0xab28('0x25')];var _0x283f1c=_0x4a622f[_0xab28('0x29')]['transferNumber'];return getAgent(_0x4e1176)[_0xab28('0x1a')](function(_0x11699a){logger[_0xab28('0x33')]('entityFound:',_0x11699a['name']);emit(util['format']('user:%s',_0x11699a['name']),_0xab28('0x47'),{'sessionId':_0x153894,'transferNumber':_0x283f1c});return _0x124573[_0xab28('0x18')](0xc8)[_0xab28('0x2a')]({'error':![],'message':_0xab28('0x48')});})[_0xab28('0x1d')](handleError(_0x124573));}; \ No newline at end of file +var _0x8d9b=['sessionId','length','sessionId\x20','\x20not\x20found!','info','body','userId','callNumber','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','json','user:%s','webbar:hangup','answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','all','conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','client','../../config/logger','webbarapi','redis','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','handleError:','stack','name','status','send','NotFound','request','then','error','code','message','User','findOne','agent','VoiceChannels','filter','rows','UserId'];(function(_0x86c3e9,_0x1a23ea){var _0x213045=function(_0xc0d62){while(--_0xc0d62){_0x86c3e9['push'](_0x86c3e9['shift']());}};_0x213045(++_0x1a23ea);}(_0x8d9b,0x104));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0xb8d9('0x0'));var fs=require('fs');var _=require(_0xb8d9('0x1'));var db=require(_0xb8d9('0x2'))['db'];var config=require(_0xb8d9('0x3'));var util=require(_0xb8d9('0x4'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var amiClient=jayson[_0xb8d9('0x5')]['http']({'port':0x232a});var logger=require(_0xb8d9('0x6'))(_0xb8d9('0x7'));var Redis=require('ioredis');config['redis']=_['defaults'](config[_0xb8d9('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0xb8d9('0x9'));var originateValidation=new Schema({'userId':{'type':_0xb8d9('0xa'),'required':[!![],_0xb8d9('0xb')]},'callNumber':{'type':_0xb8d9('0xc'),'required':[!![],_0xb8d9('0xd')]},'callerId':{'type':_0xb8d9('0xc')},'callbackUrl':{'type':_0xb8d9('0xc')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xb8d9('0xb')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xb8d9('0xa'),'required':[!![],_0xb8d9('0xb')]},'sessionId':{'type':_0xb8d9('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xb8d9('0xa'),'required':[!![],_0xb8d9('0xb')]},'sessionId':{'type':_0xb8d9('0xc'),'required':[!![],_0xb8d9('0xe')]},'transferNumber':{'type':_0xb8d9('0xc'),'required':[!![],_0xb8d9('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0xb8d9('0xa'),'required':[!![],_0xb8d9('0xb')]},'sessionId':{'type':_0xb8d9('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xb8d9('0xa'),'required':[!![],_0xb8d9('0xb')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xb8d9('0xa'),'required':[!![],_0xb8d9('0xb')]}});var conferenceValidation=new Schema({'userId':{'type':_0xb8d9('0xa'),'required':[!![],_0xb8d9('0xb')]}});function emit(_0x283780,_0x5081dc,_0x542141){logger['info'](_0x283780,_0x5081dc,JSON[_0xb8d9('0x10')](_0x542141));io['to'](_0x283780)[_0xb8d9('0x11')](_0x5081dc,_0x542141);}function handleError(_0x25e939){return function(_0x1183e4){console['log'](_0xb8d9('0x12'),_0x1183e4,_0x1183e4 instanceof RangeError);logger['error'](_0x1183e4[_0xb8d9('0x13')]);if(_0x1183e4 instanceof RangeError){if(_0x1183e4[_0xb8d9('0x14')]){delete _0x1183e4[_0xb8d9('0x14')];}_0x25e939[_0xb8d9('0x15')](0x194)[_0xb8d9('0x16')](_0x1183e4);}else{if(_0x1183e4['name']){delete _0x1183e4['name'];}_0x25e939['status'](0x1f4)[_0xb8d9('0x16')](_0x1183e4);}};}function checkError(){return function(_0x43071d){if(!_0x43071d){throw new RangeError(_0xb8d9('0x17'));}return _0x43071d;};}function respondWithRpcPromise(_0x32fd09,_0x3f4ea7){return new BPromise(function(_0x48c504,_0x963afa){var _0x430794=amiClient;return _0x430794[_0xb8d9('0x18')](_0x32fd09,_0x3f4ea7)[_0xb8d9('0x19')](function(_0x3cefe3){if(_0x3cefe3[_0xb8d9('0x1a')]){if(_0x3cefe3[_0xb8d9('0x1a')][_0xb8d9('0x1b')]===0x1f4){return _0x963afa(_0x3cefe3[_0xb8d9('0x1a')][_0xb8d9('0x1c')]);}return _0x48c504(_0x3cefe3['error'][_0xb8d9('0x1c')]);}else{_0x48c504(_0x3cefe3['result']);}})['catch'](function(_0x1eb6ee){_0x963afa(_0x1eb6ee);});});}function getAgent(_0x1b6e1e){return db[_0xb8d9('0x1d')][_0xb8d9('0x1e')]({'where':{'id':_0x1b6e1e,'role':_0xb8d9('0x1f')}})['then'](checkError());}function getAgentCheckSession(_0x241041,_0x282db6){return new BPromise(function(_0x3111aa,_0x4928c3){var _0x2d1439=respondWithRpcPromise(_0xb8d9('0x20'));var _0x336918=getAgent(_0x241041);Promise['all']([_0x2d1439,_0x336918])[_0xb8d9('0x19')](function(_0x12a043){var _0x523e6c=_0x12a043[0x0];var _0x344e27=_0x12a043[0x1];var _0x6cd7f6=_[_0xb8d9('0x21')](_0x523e6c[_0xb8d9('0x22')],function(_0x358e4d){return _0x358e4d[_0xb8d9('0x23')]==_0x344e27['id']&&_0x358e4d[_0xb8d9('0x24')]==_0x282db6;});if(_0x6cd7f6[_0xb8d9('0x25')]==0x1){_0x3111aa(_0x344e27);}else{_0x4928c3(new RangeError(_0xb8d9('0x26')+_0x282db6+_0xb8d9('0x27')));}});});}exports['originate']=function(_0x2097b0,_0x374def){logger[_0xb8d9('0x28')]('originate\x20fired:',_0x2097b0[_0xb8d9('0x29')]);var _0x79b29f=originateValidation[_0xb8d9('0x9')](_0x2097b0[_0xb8d9('0x29')]);if(_0x79b29f[_0xb8d9('0x25')]>0x0){return _0x374def[_0xb8d9('0x15')](0x190)['json'](_0x79b29f);}var _0x5a3c81=_0x2097b0[_0xb8d9('0x29')][_0xb8d9('0x2a')];var _0xaf13b=_0x2097b0[_0xb8d9('0x29')][_0xb8d9('0x2b')];var _0x32e83e=_0x2097b0['body']['callerId'];var _0x4425f3=_0x2097b0[_0xb8d9('0x29')][_0xb8d9('0x2c')];return getAgent(_0x5a3c81)['then'](function(_0x3866b2){logger['info'](_0xb8d9('0x2d'),_0x3866b2[_0xb8d9('0x14')]);emit(util[_0xb8d9('0x2e')]('user:%s',_0x3866b2[_0xb8d9('0x14')]),_0xb8d9('0x2f'),{'callNumber':_0xaf13b,'callerId':_0x32e83e,'callbackUrl':_0x4425f3});return _0x374def['status'](0xc8)['json']({'error':![],'message':_0xb8d9('0x30')});})[_0xb8d9('0x31')](handleError(_0x374def));};exports[_0xb8d9('0x32')]=function(_0x3b6f59,_0x43b0fb){logger[_0xb8d9('0x28')](_0xb8d9('0x33'),_0x3b6f59[_0xb8d9('0x29')]);var _0x926585=hangupValidation[_0xb8d9('0x9')](_0x3b6f59[_0xb8d9('0x29')]);if(_0x926585[_0xb8d9('0x25')]>0x0){return _0x43b0fb[_0xb8d9('0x15')](0x190)[_0xb8d9('0x34')](_0x926585);}var _0x593a22=_0x3b6f59['body'][_0xb8d9('0x2a')];var _0x2cba84=_0x3b6f59[_0xb8d9('0x29')][_0xb8d9('0x24')];return getAgent(_0x593a22)['then'](function(_0x4b1d71){logger[_0xb8d9('0x28')]('entityFound:',_0x4b1d71[_0xb8d9('0x14')]);emit(util['format'](_0xb8d9('0x35'),_0x4b1d71['name']),_0xb8d9('0x36'),{'sessionId':_0x2cba84});return _0x43b0fb[_0xb8d9('0x15')](0xc8)[_0xb8d9('0x34')]({'error':![],'message':'hangup\x20executed!'});})[_0xb8d9('0x31')](handleError(_0x43b0fb));};exports[_0xb8d9('0x37')]=function(_0x109d02,_0x5a07db){logger['info']('answer\x20fired:',_0x109d02['body']);var _0x4f7393=answerValidation[_0xb8d9('0x9')](_0x109d02[_0xb8d9('0x29')]);if(_0x4f7393[_0xb8d9('0x25')]>0x0){return _0x5a07db['status'](0x190)['json'](_0x4f7393);}var _0x142e54=_0x109d02['body'][_0xb8d9('0x2a')];var _0x25ae38=_0x109d02[_0xb8d9('0x29')][_0xb8d9('0x24')];return getAgent(_0x142e54)[_0xb8d9('0x19')](function(_0x573793){logger[_0xb8d9('0x28')](_0xb8d9('0x2d'),_0x573793['name']);emit(util[_0xb8d9('0x2e')](_0xb8d9('0x35'),_0x573793['name']),'webbar:answer',{'sessionId':_0x25ae38});return _0x5a07db[_0xb8d9('0x15')](0xc8)[_0xb8d9('0x34')]({'error':![],'message':_0xb8d9('0x38')});})[_0xb8d9('0x31')](handleError(_0x5a07db));};exports[_0xb8d9('0x39')]=function(_0x533ba7,_0x252570){logger[_0xb8d9('0x28')](_0xb8d9('0x3a'),_0x533ba7[_0xb8d9('0x29')]);var _0x2a0772=holdValidation[_0xb8d9('0x9')](_0x533ba7['body']);if(_0x2a0772[_0xb8d9('0x25')]>0x0){return _0x252570[_0xb8d9('0x15')](0x190)[_0xb8d9('0x34')](_0x2a0772);}var _0xc65f27=_0x533ba7[_0xb8d9('0x29')][_0xb8d9('0x2a')];var _0x59a26d=_0x533ba7[_0xb8d9('0x29')][_0xb8d9('0x24')];return getAgent(_0xc65f27)['then'](function(_0x212310){logger[_0xb8d9('0x28')]('entityFound:',_0x212310['name']);emit(util[_0xb8d9('0x2e')](_0xb8d9('0x35'),_0x212310[_0xb8d9('0x14')]),_0xb8d9('0x3b'),{'sessionId':_0x59a26d});return _0x252570[_0xb8d9('0x15')](0xc8)[_0xb8d9('0x34')]({'error':![],'message':_0xb8d9('0x3c')});})['catch'](handleError(_0x252570));};exports[_0xb8d9('0x3d')]=function(_0x431c21,_0x341d9d){logger['info'](_0xb8d9('0x3e'),_0x431c21[_0xb8d9('0x29')]);var _0x57a93a=unholdValidation['validate'](_0x431c21[_0xb8d9('0x29')]);if(_0x57a93a[_0xb8d9('0x25')]>0x0){return _0x341d9d['status'](0x190)[_0xb8d9('0x34')](_0x57a93a);}var _0x34fb98=_0x431c21[_0xb8d9('0x29')][_0xb8d9('0x2a')];var _0x58e40e=_0x431c21[_0xb8d9('0x29')][_0xb8d9('0x24')];return getAgent(_0x34fb98)[_0xb8d9('0x19')](function(_0x24b093){logger[_0xb8d9('0x28')](_0xb8d9('0x2d'),_0x24b093[_0xb8d9('0x14')]);emit(util['format'](_0xb8d9('0x35'),_0x24b093['name']),_0xb8d9('0x3f'),{'sessionId':_0x58e40e});return _0x341d9d[_0xb8d9('0x15')](0xc8)[_0xb8d9('0x34')]({'error':![],'message':'unhold\x20executed!'});})[_0xb8d9('0x31')](handleError(_0x341d9d));};exports[_0xb8d9('0x40')]=function(_0x9d42a1,_0x34afd3){logger[_0xb8d9('0x28')](_0xb8d9('0x41'),_0x34afd3[_0xb8d9('0x29')]);var _0x3480d1=callsValidation[_0xb8d9('0x9')](_0x9d42a1[_0xb8d9('0x29')]);if(_0x3480d1[_0xb8d9('0x25')]>0x0){return _0x34afd3['status'](0x190)[_0xb8d9('0x34')](_0x3480d1);}var _0x758b6d=_0x9d42a1[_0xb8d9('0x29')][_0xb8d9('0x2a')];var _0x5c1a14=respondWithRpcPromise(_0xb8d9('0x20'));var _0x20e625=getAgent(_0x758b6d);return Promise[_0xb8d9('0x42')]([_0x5c1a14,_0x20e625])[_0xb8d9('0x19')](function(_0x3bb503){var _0x52512d=_0x3bb503[0x0];var _0x11ccbc=_0x3bb503[0x1];var _0x4b80ab=_[_0xb8d9('0x21')](_0x52512d[_0xb8d9('0x22')],function(_0x1f6e31){return _0x1f6e31[_0xb8d9('0x23')]==_0x11ccbc['id'];});return _0x34afd3[_0xb8d9('0x15')](0xc8)[_0xb8d9('0x34')]({'count':_0x4b80ab[_0xb8d9('0x25')],'rows':_0x4b80ab});})['catch'](handleError(_0x34afd3));};exports[_0xb8d9('0x43')]=function(_0x1c6ad9,_0x5f008d){logger[_0xb8d9('0x28')]('conference\x20fired:',_0x1c6ad9[_0xb8d9('0x29')]);var _0x2ca703=conferenceValidation['validate'](_0x1c6ad9[_0xb8d9('0x29')]);if(_0x2ca703[_0xb8d9('0x25')]>0x0){return _0x5f008d['status'](0x190)[_0xb8d9('0x34')](_0x2ca703);}var _0x20ca5f=_0x1c6ad9['body'][_0xb8d9('0x2a')];return getAgent(_0x20ca5f)['then'](function(_0xffeec3){logger[_0xb8d9('0x28')](_0xb8d9('0x2d'),_0xffeec3[_0xb8d9('0x14')]);emit(util[_0xb8d9('0x2e')]('user:%s',_0xffeec3['name']),'webbar:conference');return _0x5f008d[_0xb8d9('0x15')](0xc8)[_0xb8d9('0x34')]({'error':![],'message':_0xb8d9('0x44')});})[_0xb8d9('0x31')](handleError(_0x5f008d));};exports[_0xb8d9('0x45')]=function(_0x182111,_0x15972e){logger[_0xb8d9('0x28')](_0xb8d9('0x46'),_0x182111[_0xb8d9('0x29')]);var _0x360b05=transferValidation[_0xb8d9('0x9')](_0x182111[_0xb8d9('0x29')]);if(_0x360b05[_0xb8d9('0x25')]>0x0){return _0x15972e['status'](0x190)[_0xb8d9('0x34')](_0x360b05);}var _0x7a813f=_0x182111[_0xb8d9('0x29')][_0xb8d9('0x2a')];var _0x2fd242=_0x182111['body'][_0xb8d9('0x24')];var _0x2fb1a9=_0x182111['body'][_0xb8d9('0x47')];return getAgent(_0x7a813f)[_0xb8d9('0x19')](function(_0xe18819){logger['info'](_0xb8d9('0x2d'),_0xe18819['name']);emit(util[_0xb8d9('0x2e')](_0xb8d9('0x35'),_0xe18819[_0xb8d9('0x14')]),_0xb8d9('0x48'),{'sessionId':_0x2fd242,'transferNumber':_0x2fb1a9});return _0x15972e['status'](0xc8)[_0xb8d9('0x34')]({'error':![],'message':_0xb8d9('0x49')});})[_0xb8d9('0x31')](handleError(_0x15972e));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 2dd055e..093e025 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 _0x430c=['Router','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/users','addAgents','send','put','delete','destroy','removeDispositions','/:id/canned_answers','removeAgents','multer','connect-timeout','express'];(function(_0x28c939,_0x110e29){var _0x527fe9=function(_0x1df2a6){while(--_0x1df2a6){_0x28c939['push'](_0x28c939['shift']());}};_0x527fe9(++_0x110e29);}(_0x430c,0x1a1));var _0xc430=function(_0x1b51ea,_0x394fd9){_0x1b51ea=_0x1b51ea-0x0;var _0x18bbdc=_0x430c[_0x1b51ea];return _0x18bbdc;};'use strict';var multer=require(_0xc430('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc430('0x1'));var express=require(_0xc430('0x2'));var router=express[_0xc430('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(_0xc430('0x4'));router[_0xc430('0x5')]('/',auth['isAuthenticated'](),controller[_0xc430('0x6')]);router['get'](_0xc430('0x7'),auth[_0xc430('0x8')](),controller[_0xc430('0x9')]);router[_0xc430('0x5')](_0xc430('0xa'),auth[_0xc430('0x8')](),controller[_0xc430('0xb')]);router[_0xc430('0x5')](_0xc430('0xc'),auth['isAuthenticated'](),controller[_0xc430('0xd')]);router[_0xc430('0x5')]('/:id/canned_answers',auth[_0xc430('0x8')](),controller['getAnswers']);router[_0xc430('0x5')]('/:id/users',auth[_0xc430('0x8')](),controller[_0xc430('0xe')]);router[_0xc430('0x5')](_0xc430('0xf'),auth[_0xc430('0x8')](),controller[_0xc430('0x10')]);router[_0xc430('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc430('0x11')](_0xc430('0xc'),auth[_0xc430('0x8')](),controller[_0xc430('0x12')]);router[_0xc430('0x11')]('/:id/canned_answers',auth[_0xc430('0x8')](),controller['addAnswer']);router['post'](_0xc430('0x13'),auth[_0xc430('0x8')](),controller[_0xc430('0x14')]);router['post']('/:id/applications',auth[_0xc430('0x8')](),controller['addApplications']);router[_0xc430('0x11')]('/:id/notify',controller['notify']);router[_0xc430('0x11')]('/:id/send',auth[_0xc430('0x8')](),controller[_0xc430('0x15')]);router[_0xc430('0x16')](_0xc430('0xa'),auth[_0xc430('0x8')](),controller['update']);router[_0xc430('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xc430('0x18')]);router[_0xc430('0x17')](_0xc430('0xc'),auth['isAuthenticated'](),controller[_0xc430('0x19')]);router['delete'](_0xc430('0x1a'),auth[_0xc430('0x8')](),controller['removeAnswers']);router[_0xc430('0x17')](_0xc430('0x13'),auth['isAuthenticated'](),controller[_0xc430('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xba34=['getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','/:id/canned_answers','addAnswer','addAgents','/:id/notify','notify','/:id/send','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions'];(function(_0x2a7e04,_0x1c8ee6){var _0x2e24bf=function(_0x220dc2){while(--_0x220dc2){_0x2a7e04['push'](_0x2a7e04['shift']());}};_0x2e24bf(++_0x1c8ee6);}(_0xba34,0x119));var _0x4ba3=function(_0xe0af05,_0xb1b77a){_0xe0af05=_0xe0af05-0x0;var _0x30a261=_0xba34[_0xe0af05];return _0x30a261;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0x8')](_0x4ba3('0xe'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x8')]('/:id/canned_answers',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x10')]);router['get'](_0x4ba3('0x11'),auth['isAuthenticated'](),controller[_0x4ba3('0x12')]);router['get'](_0x4ba3('0x13'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x14')]);router[_0x4ba3('0x15')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x16')]);router[_0x4ba3('0x15')](_0x4ba3('0xe'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x17')]);router[_0x4ba3('0x15')](_0x4ba3('0x18'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x19')]);router[_0x4ba3('0x15')](_0x4ba3('0x11'),auth['isAuthenticated'](),controller[_0x4ba3('0x1a')]);router[_0x4ba3('0x15')](_0x4ba3('0x13'),auth[_0x4ba3('0x9')](),controller['addApplications']);router[_0x4ba3('0x15')](_0x4ba3('0x1b'),controller[_0x4ba3('0x1c')]);router[_0x4ba3('0x15')](_0x4ba3('0x1d'),auth[_0x4ba3('0x9')](),controller['send']);router['put'](_0x4ba3('0xc'),auth['isAuthenticated'](),controller[_0x4ba3('0x1e')]);router[_0x4ba3('0x1f')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x20')]);router[_0x4ba3('0x1f')]('/:id/dispositions',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x21')]);router['delete'](_0x4ba3('0x18'),auth['isAuthenticated'](),controller[_0x4ba3('0x22')]);router[_0x4ba3('0x1f')](_0x4ba3('0x11'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x23')]);module[_0x4ba3('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 21eac73..cbecbe0 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 _0x8584=['randomstring','name','STRING','twilio','sinch','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x4b1eb,_0x58d8ad){var _0x6652b6=function(_0x3472a8){while(--_0x3472a8){_0x4b1eb['push'](_0x4b1eb['shift']());}};_0x6652b6(++_0x58d8ad);}(_0x8584,0x1c7));var _0x4858=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x8584[_0x278e3c];return _0x3e2d9b;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x4858('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x4858('0x1'),'allowNull':![]},'key':{'type':Sequelize[_0x4858('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x4858('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x4858('0x2')]},'type':{'type':Sequelize['ENUM'](_0x4858('0x3'),_0x4858('0x4'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x4858('0x2')]},'notificationTemplate':{'type':Sequelize[_0x4858('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x4858('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4858('0x7')],'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[_0x4858('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4858('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x4858('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x4858('0x6')],'defaultValue':![],'comment':_0x4858('0x9'),'set':function(_0x4db6ba){if(!_0x4db6ba){this[_0x4858('0xa')](_0x4858('0xb'),null);}this[_0x4858('0xa')](_0x4858('0xc'),_0x4db6ba);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2c62=['randomstring','exports','STRING','name','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x13dba3,_0x45103c){var _0x16cdda=function(_0x3c2448){while(--_0x3c2448){_0x13dba3['push'](_0x13dba3['shift']());}};_0x16cdda(++_0x45103c);}(_0x2c62,0xbf));var _0x22c6=function(_0x784654,_0x1e3d2d){_0x784654=_0x784654-0x0;var _0x11bd03=_0x2c62[_0x784654];return _0x11bd03;};'use strict';var Sequelize=require(_0x22c6('0x0'));var rs=require(_0x22c6('0x1'));module[_0x22c6('0x2')]={'name':{'type':Sequelize[_0x22c6('0x3')],'unique':_0x22c6('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x22c6('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x22c6('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x22c6('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x22c6('0x3')]},'type':{'type':Sequelize[_0x22c6('0x5')](_0x22c6('0x6'),'sinch')},'accountSid':{'type':Sequelize[_0x22c6('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x22c6('0x3')]},'notificationTemplate':{'type':Sequelize[_0x22c6('0x7')],'defaultValue':function(){return _0x22c6('0x8');}},'notificationSound':{'type':Sequelize[_0x22c6('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x22c6('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x22c6('0xa')],'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[_0x22c6('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x22c6('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x22c6('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x22c6('0x9')],'defaultValue':![],'comment':_0x22c6('0xc'),'set':function(_0x2175d7){if(!_0x2175d7){this[_0x22c6('0xd')](_0x22c6('0xe'),null);}this[_0x22c6('0xd')](_0x22c6('0xf'),_0x2175d7);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 15b25bf..4a035d1 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 _0xc475=['userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','finally','send','getApplications','notify','whatsapp','Applications','account','sinch','statuses','WhatsappMessage','timestamp','orderBy','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','whatsapp:','messageId','MessageSid','notifications','message_id','isNil','from\x20is\x20mandatory','ValidationError','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','omit','WhatsappInteraction','interaction','autoclose','applications','close','*,*,*,*','created','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','DESC','List','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','client','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','length','find','create','body','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','findOne','order','WhatsappAccountId','filter','ids','addAnswer','getAnswers','CannedAnswer','rows','removeAnswers','addAgents','spread','emit'];(function(_0xa6e89f,_0x265d79){var _0xbb69cc=function(_0x4dd9e4){while(--_0x4dd9e4){_0xa6e89f['push'](_0xa6e89f['shift']());}};_0xbb69cc(++_0x265d79);}(_0xc475,0x10b));var _0x5c47=function(_0x1847bd,_0x1a247b){_0x1847bd=_0x1847bd-0x0;var _0x150184=_0xc475[_0x1847bd];return _0x150184;};'use strict';var emlformat=require(_0x5c47('0x0'));var rimraf=require(_0x5c47('0x1'));var zipdir=require(_0x5c47('0x2'));var jsonpatch=require(_0x5c47('0x3'));var rp=require('request-promise');var moment=require(_0x5c47('0x4'));var BPromise=require(_0x5c47('0x5'));var Mustache=require(_0x5c47('0x6'));var util=require(_0x5c47('0x7'));var path=require(_0x5c47('0x8'));var sox=require('sox');var csv=require(_0x5c47('0x9'));var ejs=require(_0x5c47('0xa'));var fs=require('fs');var fs_extra=require(_0x5c47('0xb'));var _=require(_0x5c47('0xc'));var squel=require(_0x5c47('0xd'));var crypto=require(_0x5c47('0xe'));var jsforce=require(_0x5c47('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5c47('0x9'));var querystring=require(_0x5c47('0x10'));var Papa=require(_0x5c47('0x11'));var Redis=require(_0x5c47('0x12'));var authService=require(_0x5c47('0x13'));var qs=require(_0x5c47('0x14'));var as=require(_0x5c47('0x15'));var hardwareService=require(_0x5c47('0x16'));var logger=require(_0x5c47('0x17'))('api');var utils=require(_0x5c47('0x18'));var config=require(_0x5c47('0x19'));var licenseUtil=require(_0x5c47('0x1a'));var db=require(_0x5c47('0x1b'))['db'];config['redis']=_[_0x5c47('0x1c')](config[_0x5c47('0x1d')],{'host':_0x5c47('0x1e'),'port':0x18eb});var socket=require(_0x5c47('0x1f'))(new Redis(config['redis']));require('./whatsappAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x5c47('0x20')][_0x5c47('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x4fa5d0,_0x55c69f,_0x264556,_0x591b0d){return new BPromise(function(_0x661aa2,_0x4ed211){var _0x5c8afc=_0x591b0d||client;return _0x5c8afc['request'](_0x4fa5d0,_0x264556)[_0x5c47('0x22')](function(_0x4ac87b){logger[_0x5c47('0x23')](_0x5c47('0x24'),_0x55c69f,_0x5c47('0x25'));logger[_0x5c47('0x26')](_0x5c47('0x27'),_0x55c69f,_0x5c47('0x25'),JSON[_0x5c47('0x28')](_0x4ac87b));if(_0x4ac87b[_0x5c47('0x29')]){if(_0x4ac87b[_0x5c47('0x29')][_0x5c47('0x2a')]===0x1f4){logger['error'](_0x5c47('0x24'),_0x55c69f,_0x4ac87b[_0x5c47('0x29')]['message']);return _0x4ed211(_0x4ac87b['error']['message']);}logger[_0x5c47('0x29')]('WhatsappAccount,\x20%s,\x20%s',_0x55c69f,_0x4ac87b['error'][_0x5c47('0x2b')]);return _0x661aa2(_0x4ac87b[_0x5c47('0x29')][_0x5c47('0x2b')]);}else{logger[_0x5c47('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x55c69f,'request\x20sent');_0x661aa2(_0x4ac87b[_0x5c47('0x2c')][_0x5c47('0x2b')]);}})[_0x5c47('0x2d')](function(_0x284d24){logger[_0x5c47('0x29')]('WhatsappAccount,\x20%s,\x20%s',_0x55c69f,_0x284d24);_0x4ed211(_0x284d24);});});}function respondWithStatusCode(_0xca3ca2,_0x4e73f3){_0x4e73f3=_0x4e73f3||0xcc;return function(_0x70b74f){if(_0x70b74f){return _0xca3ca2[_0x5c47('0x2e')](_0x4e73f3);}return _0xca3ca2[_0x5c47('0x2f')](_0x4e73f3)[_0x5c47('0x30')]();};}function respondWithResult(_0x167cd7,_0x289459){_0x289459=_0x289459||0xc8;return function(_0x298130){if(_0x298130){return _0x167cd7[_0x5c47('0x2f')](_0x289459)[_0x5c47('0x31')](_0x298130);}};}function respondWithFilteredResult(_0x3bbd75,_0x400253){return function(_0x22e48c){if(_0x22e48c){var _0x309d2c=typeof _0x400253[_0x5c47('0x32')]===_0x5c47('0x33')&&typeof _0x400253[_0x5c47('0x34')]===_0x5c47('0x33');var _0x11c6c5=_0x22e48c[_0x5c47('0x35')];var _0x4696bd=_0x309d2c?0x0:_0x400253[_0x5c47('0x32')];var _0x1fd5be=_0x309d2c?_0x22e48c[_0x5c47('0x35')]:_0x400253[_0x5c47('0x32')]+_0x400253[_0x5c47('0x34')];var _0x5beafe;if(_0x1fd5be>=_0x11c6c5){_0x1fd5be=_0x11c6c5;_0x5beafe=0xc8;}else{_0x5beafe=0xce;}_0x3bbd75[_0x5c47('0x2f')](_0x5beafe);return _0x3bbd75[_0x5c47('0x36')]('Content-Range',_0x4696bd+'-'+_0x1fd5be+'/'+_0x11c6c5)[_0x5c47('0x31')](_0x22e48c);}return null;};}function patchUpdates(_0x5f006b){return function(_0x49c57f){try{jsonpatch[_0x5c47('0x37')](_0x49c57f,_0x5f006b,!![]);}catch(_0x52a5e0){return BPromise[_0x5c47('0x38')](_0x52a5e0);}return _0x49c57f[_0x5c47('0x39')]();};}function saveUpdates(_0x4d3488,_0x4e03e0){return function(_0x4d0e80){if(_0x4d0e80){return _0x4d0e80[_0x5c47('0x3a')](_0x4d3488)['then'](function(_0x351f56){return _0x351f56;});}return null;};}function removeEntity(_0x471fc7,_0x3978b6){return function(_0x573398){if(_0x573398){return _0x573398[_0x5c47('0x3b')]()[_0x5c47('0x22')](function(){var _0x5087b7=_0x573398[_0x5c47('0x3c')]({'plain':!![]});var _0x173943=_0x5c47('0x3d');return db[_0x5c47('0x3e')][_0x5c47('0x3b')]({'where':{'type':_0x173943,'resourceId':_0x5087b7['id']}})[_0x5c47('0x22')](function(){return _0x573398;});})[_0x5c47('0x22')](function(){_0x471fc7[_0x5c47('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3acac6,_0x4fb3aa){return function(_0x4f0f68){if(!_0x4f0f68){_0x3acac6[_0x5c47('0x2e')](0x194);}return _0x4f0f68;};}function handleError(_0xd047d6,_0x105cac){_0x105cac=_0x105cac||0x1f4;return function(_0x1754ac){logger[_0x5c47('0x29')](_0x1754ac[_0x5c47('0x3f')]);if(_0x1754ac[_0x5c47('0x40')]){delete _0x1754ac[_0x5c47('0x40')];}_0xd047d6[_0x5c47('0x2f')](_0x105cac)['send'](_0x1754ac);};}exports['index']=function(_0x18ab09,_0x4807a0){var _0x11291f={'include':[{'model':db[_0x5c47('0x41')],'as':_0x5c47('0x42')}]},_0x3c734b={},_0x1058ed={'count':0x0,'rows':[]};var _0x4b6a17=_[_0x5c47('0x43')](db[_0x5c47('0x44')]['rawAttributes'],function(_0x248d2c){return{'name':_0x248d2c[_0x5c47('0x45')],'type':_0x248d2c[_0x5c47('0x46')][_0x5c47('0x47')]};});_0x3c734b[_0x5c47('0x48')]=_[_0x5c47('0x43')](_0x4b6a17,_0x5c47('0x40'));_0x3c734b[_0x5c47('0x49')]=_[_0x5c47('0x4a')](_0x18ab09[_0x5c47('0x49')]);_0x3c734b['filters']=_[_0x5c47('0x4b')](_0x3c734b[_0x5c47('0x48')],_0x3c734b[_0x5c47('0x49')]);_0x11291f[_0x5c47('0x4c')]=_[_0x5c47('0x4b')](_0x3c734b[_0x5c47('0x48')],qs['fields'](_0x18ab09['query'][_0x5c47('0x4d')]));_0x11291f[_0x5c47('0x4c')]=_0x11291f[_0x5c47('0x4c')]['length']?_0x11291f[_0x5c47('0x4c')]:_0x3c734b['model'];if(!_0x18ab09[_0x5c47('0x49')][_0x5c47('0x4e')](_0x5c47('0x4f'))){_0x11291f[_0x5c47('0x34')]=qs['limit'](_0x18ab09['query'][_0x5c47('0x34')]);_0x11291f[_0x5c47('0x32')]=qs['offset'](_0x18ab09[_0x5c47('0x49')][_0x5c47('0x32')]);}_0x11291f['order']=qs[_0x5c47('0x50')](_0x18ab09[_0x5c47('0x49')][_0x5c47('0x50')]);_0x11291f[_0x5c47('0x51')]=qs[_0x5c47('0x52')](_[_0x5c47('0x53')](_0x18ab09[_0x5c47('0x49')],_0x3c734b[_0x5c47('0x52')]),_0x4b6a17);if(_0x18ab09[_0x5c47('0x49')]['filter']){_0x11291f[_0x5c47('0x51')]=_[_0x5c47('0x54')](_0x11291f[_0x5c47('0x51')],{'$or':_[_0x5c47('0x43')](_0x4b6a17,function(_0x58afb1){if(_0x58afb1[_0x5c47('0x46')]!==_0x5c47('0x55')){var _0x9779f1={};_0x9779f1[_0x58afb1['name']]={'$like':'%'+_0x18ab09[_0x5c47('0x49')]['filter']+'%'};return _0x9779f1;}})});}_0x11291f=_[_0x5c47('0x54')]({},_0x11291f,_0x18ab09[_0x5c47('0x56')]);var _0x573a6={'where':_0x11291f['where']};return db[_0x5c47('0x44')][_0x5c47('0x35')](_0x573a6)[_0x5c47('0x22')](function(_0x496a9d){_0x1058ed[_0x5c47('0x35')]=_0x496a9d;if(_0x18ab09[_0x5c47('0x49')][_0x5c47('0x57')]){_0x11291f[_0x5c47('0x58')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x5c47('0x59')](_0x11291f);})[_0x5c47('0x22')](function(_0x443956){_0x1058ed['rows']=_0x443956;return _0x1058ed;})[_0x5c47('0x22')](respondWithFilteredResult(_0x4807a0,_0x11291f))['catch'](handleError(_0x4807a0,null));};exports[_0x5c47('0x5a')]=function(_0x3708e9,_0x1266f3){var _0x29d354={'raw':![],'where':{'id':_0x3708e9[_0x5c47('0x5b')]['id']},'include':[{'model':db[_0x5c47('0x41')],'as':'mandatoryDispositionPause'}]},_0x40b2e2={};_0x40b2e2['model']=_[_0x5c47('0x4a')](db[_0x5c47('0x44')][_0x5c47('0x5c')]);_0x40b2e2[_0x5c47('0x49')]=_[_0x5c47('0x4a')](_0x3708e9['query']);_0x40b2e2[_0x5c47('0x52')]=_[_0x5c47('0x4b')](_0x40b2e2[_0x5c47('0x48')],_0x40b2e2[_0x5c47('0x49')]);_0x29d354[_0x5c47('0x4c')]=_[_0x5c47('0x4b')](_0x40b2e2['model'],qs[_0x5c47('0x4d')](_0x3708e9['query'][_0x5c47('0x4d')]));_0x29d354['attributes']=_0x29d354[_0x5c47('0x4c')][_0x5c47('0x5d')]?_0x29d354[_0x5c47('0x4c')]:_0x40b2e2[_0x5c47('0x48')];if(_0x3708e9['query'][_0x5c47('0x57')]){_0x29d354[_0x5c47('0x58')]=[{'all':!![]}];}_0x29d354=_[_0x5c47('0x54')]({},_0x29d354,_0x3708e9[_0x5c47('0x56')]);return db[_0x5c47('0x44')][_0x5c47('0x5e')](_0x29d354)[_0x5c47('0x22')](handleEntityNotFound(_0x1266f3,null))[_0x5c47('0x22')](respondWithResult(_0x1266f3,null))[_0x5c47('0x2d')](handleError(_0x1266f3,null));};exports[_0x5c47('0x5f')]=function(_0x1db723,_0x27d9ec){return db[_0x5c47('0x44')][_0x5c47('0x5f')](_0x1db723[_0x5c47('0x60')],{})[_0x5c47('0x22')](function(_0x1dfdeb){var _0x3194c0=_0x1db723[_0x5c47('0x61')][_0x5c47('0x3c')]({'plain':!![]});if(!_0x3194c0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3194c0['role']===_0x5c47('0x61')){var _0x12831f=_0x1dfdeb[_0x5c47('0x3c')]({'plain':!![]});var _0x4bb746=_0x5c47('0x3d');return db[_0x5c47('0x62')][_0x5c47('0x5e')]({'where':{'name':_0x4bb746,'userProfileId':_0x3194c0[_0x5c47('0x63')]},'raw':!![]})[_0x5c47('0x22')](function(_0x353c28){if(_0x353c28&&_0x353c28['autoAssociation']===0x0){return db[_0x5c47('0x3e')]['create']({'name':_0x12831f[_0x5c47('0x40')],'resourceId':_0x12831f['id'],'type':_0x353c28[_0x5c47('0x40')],'sectionId':_0x353c28['id']},{})['then'](function(){return _0x1dfdeb;});}else{return _0x1dfdeb;}})[_0x5c47('0x2d')](function(_0x46d15d){logger[_0x5c47('0x29')](_0x5c47('0x64'),_0x46d15d);throw _0x46d15d;});}return _0x1dfdeb;})[_0x5c47('0x22')](respondWithResult(_0x27d9ec,0xc9))[_0x5c47('0x2d')](handleError(_0x27d9ec,null));};exports['update']=function(_0x3cf419,_0x221a77){if(_0x3cf419[_0x5c47('0x60')]['id']){delete _0x3cf419['body']['id'];}return db[_0x5c47('0x44')][_0x5c47('0x5e')]({'where':{'id':_0x3cf419[_0x5c47('0x5b')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x5c47('0x22')](handleEntityNotFound(_0x221a77,null))[_0x5c47('0x22')](saveUpdates(_0x3cf419[_0x5c47('0x60')],null))[_0x5c47('0x22')](respondWithResult(_0x221a77,null))['catch'](handleError(_0x221a77,null));};exports[_0x5c47('0x3b')]=function(_0x2c2fb1,_0x44c319){return db[_0x5c47('0x44')][_0x5c47('0x5e')]({'where':{'id':_0x2c2fb1[_0x5c47('0x5b')]['id']}})[_0x5c47('0x22')](handleEntityNotFound(_0x44c319,null))['then'](removeEntity(_0x44c319,null))['catch'](handleError(_0x44c319,null));};exports[_0x5c47('0x65')]=function(_0x15deeb,_0x353477){return db['WhatsappAccount']['describe']()[_0x5c47('0x22')](respondWithResult(_0x353477,null))['catch'](handleError(_0x353477,null));};exports[_0x5c47('0x66')]=function(_0x48ac2b,_0x49d38a,_0x337bf8){if(_0x48ac2b[_0x5c47('0x60')]['id']){delete _0x48ac2b[_0x5c47('0x60')]['id'];}return db[_0x5c47('0x44')][_0x5c47('0x5e')]({'where':{'id':_0x48ac2b['params']['id']}})['then'](handleEntityNotFound(_0x49d38a,null))['then'](function(_0x572d3d){if(_0x572d3d){_0x48ac2b[_0x5c47('0x60')]['WhatsappAccountId']=_0x572d3d['id'];return db[_0x5c47('0x67')][_0x5c47('0x5f')](_0x48ac2b[_0x5c47('0x60')]);}})['then'](respondWithResult(_0x49d38a,null))[_0x5c47('0x2d')](handleError(_0x49d38a,null));};exports['getDispositions']=function(_0xbac3a8,_0x257cda,_0x5b5163){var _0x178ae6={'raw':![],'where':{}};var _0x2985a9={};var _0x5c1f13={'count':0x0,'rows':[]};return db[_0x5c47('0x44')][_0x5c47('0x68')]({'where':{'id':_0xbac3a8[_0x5c47('0x5b')]['id']}})[_0x5c47('0x22')](handleEntityNotFound(_0x257cda,null))[_0x5c47('0x22')](function(_0x514791){if(_0x514791){_0x2985a9[_0x5c47('0x48')]=_['keys'](db[_0x5c47('0x67')][_0x5c47('0x5c')]);_0x2985a9[_0x5c47('0x49')]=_[_0x5c47('0x4a')](_0xbac3a8['query']);_0x2985a9[_0x5c47('0x52')]=_[_0x5c47('0x4b')](_0x2985a9[_0x5c47('0x48')],_0x2985a9[_0x5c47('0x49')]);_0x178ae6[_0x5c47('0x4c')]=_[_0x5c47('0x4b')](_0x2985a9['model'],qs[_0x5c47('0x4d')](_0xbac3a8[_0x5c47('0x49')][_0x5c47('0x4d')]));_0x178ae6[_0x5c47('0x4c')]=_0x178ae6[_0x5c47('0x4c')][_0x5c47('0x5d')]?_0x178ae6[_0x5c47('0x4c')]:_0x2985a9[_0x5c47('0x48')];if(!_0xbac3a8[_0x5c47('0x49')][_0x5c47('0x4e')](_0x5c47('0x4f'))){_0x178ae6[_0x5c47('0x34')]=qs[_0x5c47('0x34')](_0xbac3a8[_0x5c47('0x49')]['limit']);_0x178ae6[_0x5c47('0x32')]=qs[_0x5c47('0x32')](_0xbac3a8['query'][_0x5c47('0x32')]);}_0x178ae6[_0x5c47('0x69')]=qs[_0x5c47('0x50')](_0xbac3a8[_0x5c47('0x49')][_0x5c47('0x50')]);_0x178ae6[_0x5c47('0x51')]=qs['filters'](_[_0x5c47('0x53')](_0xbac3a8[_0x5c47('0x49')],_0x2985a9[_0x5c47('0x52')]));_0x178ae6[_0x5c47('0x51')][_0x5c47('0x6a')]=_0x514791['id'];if(_0xbac3a8[_0x5c47('0x49')][_0x5c47('0x6b')]){_0x178ae6['where']=_[_0x5c47('0x54')](_0x178ae6[_0x5c47('0x51')],{'$or':_[_0x5c47('0x43')](_0x178ae6[_0x5c47('0x4c')],function(_0x5dc3b1){var _0x2a139e={};_0x2a139e[_0x5dc3b1]={'$like':'%'+_0xbac3a8['query']['filter']+'%'};return _0x2a139e;})});}_0x178ae6=_[_0x5c47('0x54')]({},_0x178ae6,_0xbac3a8[_0x5c47('0x56')]);return db[_0x5c47('0x67')][_0x5c47('0x35')]({'where':_0x178ae6[_0x5c47('0x51')]})[_0x5c47('0x22')](function(_0x27638d){_0x5c1f13[_0x5c47('0x35')]=_0x27638d;if(_0xbac3a8[_0x5c47('0x49')][_0x5c47('0x57')]){_0x178ae6['include']=[{'all':!![]}];}return db['Disposition'][_0x5c47('0x59')](_0x178ae6);})[_0x5c47('0x22')](function(_0x2b676a){_0x5c1f13['rows']=_0x2b676a;return _0x5c1f13;});}})[_0x5c47('0x22')](respondWithFilteredResult(_0x257cda,_0x178ae6))[_0x5c47('0x2d')](handleError(_0x257cda,null));};exports['removeDispositions']=function(_0x3bf165,_0x40e935,_0x572ddc){return db[_0x5c47('0x44')][_0x5c47('0x5e')]({'where':{'id':_0x3bf165['params']['id']}})['then'](handleEntityNotFound(_0x40e935,null))[_0x5c47('0x22')](function(_0x53c205){if(_0x53c205){return _0x53c205['removeDispositions'](_0x3bf165['query'][_0x5c47('0x6c')]);}})[_0x5c47('0x22')](respondWithStatusCode(_0x40e935,null))[_0x5c47('0x2d')](handleError(_0x40e935,null));};exports[_0x5c47('0x6d')]=function(_0x6b968a,_0x46e985,_0x44a808){if(_0x6b968a[_0x5c47('0x60')]['id']){delete _0x6b968a[_0x5c47('0x60')]['id'];}return db[_0x5c47('0x44')]['find']({'where':{'id':_0x6b968a[_0x5c47('0x5b')]['id']}})['then'](handleEntityNotFound(_0x46e985,null))[_0x5c47('0x22')](function(_0xc9ea7f){if(_0xc9ea7f){_0x6b968a['body'][_0x5c47('0x6a')]=_0xc9ea7f['id'];return db['CannedAnswer'][_0x5c47('0x5f')](_0x6b968a[_0x5c47('0x60')]);}})[_0x5c47('0x22')](respondWithResult(_0x46e985,null))[_0x5c47('0x2d')](handleError(_0x46e985,null));};exports[_0x5c47('0x6e')]=function(_0x2cc03e,_0x430209,_0x2df619){var _0x545615={'raw':![],'where':{}};var _0x213cf6={};var _0x2c637e={'count':0x0,'rows':[]};return db[_0x5c47('0x44')][_0x5c47('0x68')]({'where':{'id':_0x2cc03e[_0x5c47('0x5b')]['id']}})[_0x5c47('0x22')](handleEntityNotFound(_0x430209,null))['then'](function(_0x333ee3){if(_0x333ee3){_0x213cf6[_0x5c47('0x48')]=_[_0x5c47('0x4a')](db[_0x5c47('0x6f')][_0x5c47('0x5c')]);_0x213cf6[_0x5c47('0x49')]=_[_0x5c47('0x4a')](_0x2cc03e[_0x5c47('0x49')]);_0x213cf6[_0x5c47('0x52')]=_[_0x5c47('0x4b')](_0x213cf6['model'],_0x213cf6[_0x5c47('0x49')]);_0x545615['attributes']=_[_0x5c47('0x4b')](_0x213cf6['model'],qs[_0x5c47('0x4d')](_0x2cc03e[_0x5c47('0x49')]['fields']));_0x545615[_0x5c47('0x4c')]=_0x545615[_0x5c47('0x4c')][_0x5c47('0x5d')]?_0x545615[_0x5c47('0x4c')]:_0x213cf6[_0x5c47('0x48')];if(!_0x2cc03e[_0x5c47('0x49')][_0x5c47('0x4e')](_0x5c47('0x4f'))){_0x545615['limit']=qs[_0x5c47('0x34')](_0x2cc03e[_0x5c47('0x49')]['limit']);_0x545615[_0x5c47('0x32')]=qs['offset'](_0x2cc03e[_0x5c47('0x49')][_0x5c47('0x32')]);}_0x545615[_0x5c47('0x69')]=qs['sort'](_0x2cc03e[_0x5c47('0x49')][_0x5c47('0x50')]);_0x545615[_0x5c47('0x51')]=qs[_0x5c47('0x52')](_['pick'](_0x2cc03e[_0x5c47('0x49')],_0x213cf6[_0x5c47('0x52')]));_0x545615['where'][_0x5c47('0x6a')]=_0x333ee3['id'];if(_0x2cc03e[_0x5c47('0x49')][_0x5c47('0x6b')]){_0x545615[_0x5c47('0x51')]=_[_0x5c47('0x54')](_0x545615[_0x5c47('0x51')],{'$or':_[_0x5c47('0x43')](_0x545615[_0x5c47('0x4c')],function(_0x156de7){var _0x5d812b={};_0x5d812b[_0x156de7]={'$like':'%'+_0x2cc03e['query'][_0x5c47('0x6b')]+'%'};return _0x5d812b;})});}_0x545615=_[_0x5c47('0x54')]({},_0x545615,_0x2cc03e['options']);return db['CannedAnswer'][_0x5c47('0x35')]({'where':_0x545615[_0x5c47('0x51')]})[_0x5c47('0x22')](function(_0x402c9d){_0x2c637e[_0x5c47('0x35')]=_0x402c9d;if(_0x2cc03e[_0x5c47('0x49')][_0x5c47('0x57')]){_0x545615[_0x5c47('0x58')]=[{'all':!![]}];}return db[_0x5c47('0x6f')][_0x5c47('0x59')](_0x545615);})[_0x5c47('0x22')](function(_0x25aa2c){_0x2c637e[_0x5c47('0x70')]=_0x25aa2c;return _0x2c637e;});}})[_0x5c47('0x22')](respondWithFilteredResult(_0x430209,_0x545615))[_0x5c47('0x2d')](handleError(_0x430209,null));};exports[_0x5c47('0x71')]=function(_0x54ebb6,_0x5ed79e,_0x582b0d){return db[_0x5c47('0x44')][_0x5c47('0x5e')]({'where':{'id':_0x54ebb6[_0x5c47('0x5b')]['id']}})[_0x5c47('0x22')](handleEntityNotFound(_0x5ed79e,null))[_0x5c47('0x22')](function(_0x43a010){if(_0x43a010){return _0x43a010[_0x5c47('0x71')](_0x54ebb6[_0x5c47('0x49')][_0x5c47('0x6c')]);}})[_0x5c47('0x22')](respondWithStatusCode(_0x5ed79e,null))[_0x5c47('0x2d')](handleError(_0x5ed79e,null));};exports[_0x5c47('0x72')]=function(_0x5c191f,_0x5e892a,_0xfbb52){return db[_0x5c47('0x44')][_0x5c47('0x5e')]({'where':{'id':_0x5c191f[_0x5c47('0x5b')]['id']}})[_0x5c47('0x22')](handleEntityNotFound(_0x5e892a,null))[_0x5c47('0x22')](function(_0x402699){if(_0x402699){return _0x402699[_0x5c47('0x72')](_0x5c191f[_0x5c47('0x60')][_0x5c47('0x6c')],_['omit'](_0x5c191f[_0x5c47('0x60')],[_0x5c47('0x6c'),'id'])||{})[_0x5c47('0x73')](function(_0x3ef77a){for(var _0x33881b=0x0;_0x33881b<_0x5c191f[_0x5c47('0x60')][_0x5c47('0x6c')][_0x5c47('0x5d')];_0x33881b+=0x1){socket[_0x5c47('0x74')](_0x5c47('0x75'),{'UserId':Number(_0x5c191f[_0x5c47('0x60')][_0x5c47('0x6c')][_0x33881b]),'WhatsappAccountId':Number(_0x5c191f[_0x5c47('0x5b')]['id'])});}return _0x3ef77a;});}})[_0x5c47('0x22')](respondWithResult(_0x5e892a,null))[_0x5c47('0x2d')](handleError(_0x5e892a,null));};exports[_0x5c47('0x76')]=function(_0x30d94c,_0x4a5281,_0x4e918b){return db[_0x5c47('0x44')]['find']({'where':{'id':_0x30d94c['params']['id']}})['then'](handleEntityNotFound(_0x4a5281,null))[_0x5c47('0x22')](function(_0x5949d9){if(_0x5949d9){return _0x5949d9[_0x5c47('0x76')](_0x30d94c[_0x5c47('0x49')]['ids'])[_0x5c47('0x22')](function(){if(_[_0x5c47('0x77')](_0x30d94c[_0x5c47('0x49')][_0x5c47('0x6c')])){for(var _0x40a231=0x0;_0x40a231<_0x30d94c['query'][_0x5c47('0x6c')]['length'];_0x40a231+=0x1){socket['emit'](_0x5c47('0x78'),{'UserId':Number(_0x30d94c[_0x5c47('0x49')]['ids'][_0x40a231]),'WhatsappAccountId':Number(_0x30d94c['params']['id'])});}}else{socket[_0x5c47('0x74')]('userWhatsappAccount:remove',{'UserId':Number(_0x30d94c[_0x5c47('0x49')][_0x5c47('0x6c')]),'WhatsappAccountId':Number(_0x30d94c[_0x5c47('0x5b')]['id'])});}});}})[_0x5c47('0x22')](respondWithStatusCode(_0x4a5281,null))['catch'](handleError(_0x4a5281,null));};exports['getAgents']=function(_0x37cd74,_0x663c34,_0x16c5a2){var _0x55529f={};var _0x53cfd1={};var _0x319724;var _0x17a29e;return db['WhatsappAccount'][_0x5c47('0x68')]({'where':{'id':_0x37cd74[_0x5c47('0x5b')]['id']}})[_0x5c47('0x22')](handleEntityNotFound(_0x663c34,null))[_0x5c47('0x22')](function(_0xbee68){if(_0xbee68){_0x319724=_0xbee68;_0x53cfd1['model']=_[_0x5c47('0x4a')](db['User'][_0x5c47('0x5c')]);_0x53cfd1[_0x5c47('0x49')]=_[_0x5c47('0x4a')](_0x37cd74[_0x5c47('0x49')]);_0x53cfd1[_0x5c47('0x52')]=_[_0x5c47('0x4b')](_0x53cfd1[_0x5c47('0x48')],_0x53cfd1[_0x5c47('0x49')]);_0x55529f[_0x5c47('0x4c')]=_[_0x5c47('0x4b')](_0x53cfd1[_0x5c47('0x48')],qs[_0x5c47('0x4d')](_0x37cd74['query']['fields']));_0x55529f['attributes']=_0x55529f[_0x5c47('0x4c')][_0x5c47('0x5d')]?_0x55529f[_0x5c47('0x4c')]:_0x53cfd1[_0x5c47('0x48')];_0x55529f['order']=qs[_0x5c47('0x50')](_0x37cd74['query'][_0x5c47('0x50')]);_0x55529f['where']=qs[_0x5c47('0x52')](_[_0x5c47('0x53')](_0x37cd74[_0x5c47('0x49')],_0x53cfd1[_0x5c47('0x52')]));if(_0x37cd74[_0x5c47('0x49')][_0x5c47('0x6b')]){_0x55529f['where']=_[_0x5c47('0x54')](_0x55529f[_0x5c47('0x51')],{'$or':_[_0x5c47('0x43')](_0x55529f[_0x5c47('0x4c')],function(_0x3f1382){var _0x122d8d={};_0x122d8d[_0x3f1382]={'$like':'%'+_0x37cd74[_0x5c47('0x49')][_0x5c47('0x6b')]+'%'};return _0x122d8d;})});}_0x55529f=_['merge']({},_0x55529f,_0x37cd74['options']);return _0x319724[_0x5c47('0x79')](_0x55529f);}})[_0x5c47('0x22')](function(_0x19cbe9){if(_0x19cbe9){_0x17a29e=_0x19cbe9[_0x5c47('0x5d')];if(!_0x37cd74[_0x5c47('0x49')][_0x5c47('0x4e')](_0x5c47('0x4f'))){_0x55529f[_0x5c47('0x34')]=qs[_0x5c47('0x34')](_0x37cd74[_0x5c47('0x49')][_0x5c47('0x34')]);_0x55529f['offset']=qs[_0x5c47('0x32')](_0x37cd74[_0x5c47('0x49')][_0x5c47('0x32')]);}return _0x319724['getAgents'](_0x55529f);}})[_0x5c47('0x22')](function(_0x36f65d){if(_0x36f65d){return _0x36f65d?{'count':_0x17a29e,'rows':_0x36f65d}:null;}})[_0x5c47('0x22')](respondWithResult(_0x663c34,null))[_0x5c47('0x2d')](handleError(_0x663c34,null));};exports['addApplications']=function(_0x4b5e04,_0x5d9cbb){var _0x4ea59a=_0x4b5e04[_0x5c47('0x5b')]['id'];var _0x2f6bcf=_0x4b5e04[_0x5c47('0x60')];var _0x3b5609=0xc8;var _0x411992=null;return db[_0x5c47('0x7a')][_0x5c47('0x7b')]({'isolationLevel':db[_0x5c47('0x7a')]['Transaction'][_0x5c47('0x7c')][_0x5c47('0x7d')]},function(_0x536d9b){return db[_0x5c47('0x44')][_0x5c47('0x68')]({'where':{'id':_0x4ea59a},'transaction':_0x536d9b})[_0x5c47('0x22')](function(_0x196e85){if(_0x196e85){return db['WhatsappApplication'][_0x5c47('0x3b')]({'where':{'WhatsappAccountId':_0x4ea59a},'transaction':_0x536d9b})[_0x5c47('0x22')](function(){var _0x4cfbb8=_[_0x5c47('0x43')](_0x2f6bcf,function(_0x368116){_0x368116['WhatsappAccountId']=_0x4ea59a;return _0x368116;});return db['WhatsappApplication']['bulkCreate'](_0x4cfbb8,{'transaction':_0x536d9b});});}else{_0x3b5609=0x194;_0x411992=[];}});})[_0x5c47('0x22')](function(){if(_0x3b5609!==0x194){return db[_0x5c47('0x7e')][_0x5c47('0x7f')]({'where':{'WhatsappAccountId':_0x4ea59a},'order':_0x5c47('0x80')})[_0x5c47('0x22')](function(_0x2c4f7f){_0x411992=_0x2c4f7f;});}})[_0x5c47('0x2d')](function(_0x210529){_0x3b5609=0x1f4;logger[_0x5c47('0x29')](_0x210529[_0x5c47('0x3f')]);if(_0x210529[_0x5c47('0x40')]){delete _0x210529[_0x5c47('0x40')];}_0x411992=_0x210529;})[_0x5c47('0x81')](function(){if(_0x411992===null){_0x5d9cbb['sendStatus'](_0x3b5609);}else{if(_0x3b5609===0x1f4){_0x5d9cbb[_0x5c47('0x2f')](_0x3b5609)[_0x5c47('0x82')](_0x411992);}else{_0x5d9cbb[_0x5c47('0x2f')](_0x3b5609)[_0x5c47('0x31')](_0x411992);}}});};exports['getApplications']=function(_0xa8df3,_0x22bdbc,_0x40614d){var _0x5cec5b={};var _0xa31e1c={};var _0x3a7d65;var _0x542374;return db['WhatsappAccount'][_0x5c47('0x68')]({'where':{'id':_0xa8df3[_0x5c47('0x5b')]['id']}})['then'](handleEntityNotFound(_0x22bdbc,null))[_0x5c47('0x22')](function(_0x371d8c){if(_0x371d8c){_0x3a7d65=_0x371d8c;_0xa31e1c[_0x5c47('0x48')]=_['keys'](db['WhatsappApplication'][_0x5c47('0x5c')]);_0xa31e1c[_0x5c47('0x49')]=_['keys'](_0xa8df3['query']);_0xa31e1c['filters']=_[_0x5c47('0x4b')](_0xa31e1c['model'],_0xa31e1c['query']);_0x5cec5b[_0x5c47('0x4c')]=_[_0x5c47('0x4b')](_0xa31e1c[_0x5c47('0x48')],qs['fields'](_0xa8df3[_0x5c47('0x49')]['fields']));_0x5cec5b[_0x5c47('0x4c')]=_0x5cec5b[_0x5c47('0x4c')][_0x5c47('0x5d')]?_0x5cec5b[_0x5c47('0x4c')]:_0xa31e1c[_0x5c47('0x48')];_0x5cec5b[_0x5c47('0x69')]=qs[_0x5c47('0x50')](_0xa8df3[_0x5c47('0x49')][_0x5c47('0x50')]);_0x5cec5b[_0x5c47('0x51')]=qs[_0x5c47('0x52')](_[_0x5c47('0x53')](_0xa8df3[_0x5c47('0x49')],_0xa31e1c[_0x5c47('0x52')]));if(_0xa8df3[_0x5c47('0x49')][_0x5c47('0x6b')]){_0x5cec5b[_0x5c47('0x51')]=_[_0x5c47('0x54')](_0x5cec5b[_0x5c47('0x51')],{'$or':_[_0x5c47('0x43')](_0x5cec5b[_0x5c47('0x4c')],function(_0x4ba274){var _0x1c07d6={};_0x1c07d6[_0x4ba274]={'$like':'%'+_0xa8df3['query'][_0x5c47('0x6b')]+'%'};return _0x1c07d6;})});}_0x5cec5b=_[_0x5c47('0x54')]({},_0x5cec5b,_0xa8df3[_0x5c47('0x56')]);return _0x3a7d65['getApplications'](_0x5cec5b);}})[_0x5c47('0x22')](function(_0x5484ac){if(_0x5484ac){_0x542374=_0x5484ac[_0x5c47('0x5d')];if(!_0xa8df3[_0x5c47('0x49')][_0x5c47('0x4e')](_0x5c47('0x4f'))){_0x5cec5b[_0x5c47('0x34')]=qs[_0x5c47('0x34')](_0xa8df3[_0x5c47('0x49')][_0x5c47('0x34')]);_0x5cec5b[_0x5c47('0x32')]=qs['offset'](_0xa8df3[_0x5c47('0x49')][_0x5c47('0x32')]);}return _0x3a7d65[_0x5c47('0x83')](_0x5cec5b);}})[_0x5c47('0x22')](function(_0x37755a){if(_0x37755a){return _0x37755a?{'count':_0x542374,'rows':_0x37755a}:null;}})[_0x5c47('0x22')](respondWithResult(_0x22bdbc,null))[_0x5c47('0x2d')](handleError(_0x22bdbc,null));};exports[_0x5c47('0x84')]=function(_0x59d505,_0x3720b5,_0x51be1e){var _0x676bbe={'channel':_0x5c47('0x85')};var _0x43103a=[];var _0x7d780f=[];var _0x52df19={};return db[_0x5c47('0x44')][_0x5c47('0x5e')]({'where':{'id':_0x59d505['params']['id']},'include':[{'model':db[_0x5c47('0x7e')],'as':_0x5c47('0x86')}]})['then'](handleEntityNotFound(_0x3720b5,null))[_0x5c47('0x22')](function(_0x1ac5a4){_0x676bbe['account']=_0x1ac5a4;if(_0x676bbe[_0x5c47('0x87')]&&_0x676bbe[_0x5c47('0x87')][_0x5c47('0x46')]===_0x5c47('0x88')&&_0x59d505['body'][_0x5c47('0x89')]){if(_0x59d505[_0x5c47('0x60')][_0x5c47('0x89')][_0x5c47('0x5d')]===0x0)return;if(_0x59d505['body'][_0x5c47('0x89')][0x0]['state']!=='read')return;return db[_0x5c47('0x8a')][_0x5c47('0x3a')]({'read':!![],'readAt':_0x59d505[_0x5c47('0x60')][_0x5c47('0x89')][0x0][_0x5c47('0x8b')]},{'where':{'messageId':_0x59d505['body']['statuses'][0x0]['message_id']},'individualHooks':!![]})['then'](function(_0x5170bc){return _0x3720b5[_0x5c47('0x2f')](0xc8)[_0x5c47('0x31')](_0x5170bc);});}_0x676bbe['applications']=_[_0x5c47('0x8c')](_0x1ac5a4[_0x5c47('0x86')],[_0x5c47('0x80')],[_0x5c47('0x8d')]);if(_0x676bbe['account'][_0x5c47('0x86')]){delete _0x676bbe['account'][_0x5c47('0x86')];}return db[_0x5c47('0x8e')][_0x5c47('0x65')]()[_0x5c47('0x22')](function(_0x2f3429){if(!_0x2f3429){throw new db[(_0x5c47('0x8f'))]['ValidationError'](_0x5c47('0x90'));}_0x43103a=_[_0x5c47('0x91')](_[_0x5c47('0x4a')](_0x2f3429),[_0x5c47('0x92'),_0x5c47('0x93')]);_0x7d780f=_[_0x5c47('0x91')](_[_0x5c47('0x4a')](_0x2f3429),[_0x5c47('0x92'),_0x5c47('0x93'),_0x5c47('0x94'),_0x5c47('0x95')]);_0x676bbe[_0x5c47('0x60')]={'mapKey':_0x5c47('0x96')};if(_0x676bbe[_0x5c47('0x87')]&&_0x676bbe[_0x5c47('0x87')][_0x5c47('0x46')]==='twilio'){_0x676bbe['body'][_0x5c47('0x97')]=_0x59d505[_0x5c47('0x60')][_0x5c47('0x98')]['replace'](_0x5c47('0x99'),'');_0x676bbe[_0x5c47('0x60')][_0x5c47('0x60')]=_0x59d505['body']['Body'];_0x676bbe[_0x5c47('0x60')][_0x5c47('0x9a')]=_0x59d505[_0x5c47('0x60')][_0x5c47('0x9b')];}if(_0x676bbe['account']&&_0x676bbe[_0x5c47('0x87')]['type']===_0x5c47('0x88')){_0x676bbe['body'][_0x5c47('0x97')]=_0x59d505['body'][_0x5c47('0x9c')][0x0][_0x5c47('0x97')];_0x676bbe[_0x5c47('0x60')]['body']=_0x59d505[_0x5c47('0x60')][_0x5c47('0x9c')][0x0]['message'][_0x5c47('0x60')];_0x676bbe[_0x5c47('0x60')]['messageId']=_0x59d505['body'][_0x5c47('0x9c')][0x0][_0x5c47('0x9d')];}if(_0x676bbe[_0x5c47('0x60')]['id']){delete _0x676bbe[_0x5c47('0x60')]['id'];}if(_[_0x5c47('0x9e')](_0x676bbe['body'][_0x5c47('0x97')])){throw new db['Sequelize']['ValidationError'](_0x5c47('0x9f'));}if(_[_0x5c47('0x9e')](_0x676bbe['body'][_0x5c47('0x60')])||_0x676bbe[_0x5c47('0x60')][_0x5c47('0x60')]===''){throw new db[(_0x5c47('0x8f'))][(_0x5c47('0xa0'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5c47('0x9e')](_0x676bbe[_0x5c47('0x60')][_0x5c47('0xa1')])){throw new db['Sequelize'][(_0x5c47('0xa0'))](_0x5c47('0xa2')+_0x7d780f);}if(!_['includes'](_0x7d780f,_0x676bbe[_0x5c47('0x60')]['mapKey'])){throw new db[(_0x5c47('0x8f'))][(_0x5c47('0xa0'))](_0x5c47('0xa3')+_0x7d780f);}_0x52df19[_0x676bbe[_0x5c47('0x60')][_0x5c47('0xa1')]]=_0x676bbe[_0x5c47('0x60')][_0x5c47('0x97')];return db[_0x5c47('0xa4')][_0x5c47('0x5e')]({'where':{'id':_0x676bbe[_0x5c47('0x87')][_0x5c47('0x95')]},'include':[{'model':db[_0x5c47('0x8e')],'as':_0x5c47('0xa5'),'where':_0x52df19,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x5c47('0x22')](handleEntityNotFound(_0x3720b5,null))[_0x5c47('0x22')](function(_0xff302a){if(_0xff302a){_0x676bbe['list']=_[_0x5c47('0xa6')](_0xff302a,[_0x5c47('0xa5')]);if(_0xff302a[_0x5c47('0xa5')][_0x5c47('0x5d')]){return _0xff302a['Contacts'][0x0];}var _0x53f376=_[_0x5c47('0x1c')](_0x676bbe[_0x5c47('0x60')],{'firstName':_0x676bbe[_0x5c47('0x60')][_0x5c47('0x97')],'ListId':_0xff302a['id']});_0x53f376[_0x676bbe[_0x5c47('0x60')]['mapKey']]=_0x676bbe[_0x5c47('0x60')][_0x5c47('0x97')];return db['CmContact'][_0x5c47('0x5f')](_0x53f376,{'fields':_0x43103a,'raw':!![]});}})[_0x5c47('0x22')](handleEntityNotFound(_0x3720b5,null))[_0x5c47('0x22')](function(_0x3aef7d){if(_0x3aef7d){_0x676bbe['contact']=_0x3aef7d;var _0xbbffd7={'ContactId':_0x3aef7d['id'],'phone':_0x676bbe[_0x5c47('0x60')][_0x5c47('0x97')],'WhatsappAccountId':_0x59d505[_0x5c47('0x5b')]['id']};var _0x2fd594={'ContactId':_0x3aef7d['id'],'WhatsappAccountId':_0x59d505[_0x5c47('0x5b')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x5c47('0x5e')]({'where':_0x2fd594})[_0x5c47('0x22')](function(_0x1f7753){if(_0x1f7753){return[_0x1f7753,![]];}return db[_0x5c47('0xa7')][_0x5c47('0x5f')](_0xbbffd7)[_0x5c47('0x22')](function(_0x57d24c){return[_0x57d24c,!![]];});});}})[_0x5c47('0x73')](function(_0x3cc784,_0x46fc82){_0x676bbe[_0x5c47('0xa8')]=_0x3cc784[_0x5c47('0x3c')]({'plain':!![]});_0x676bbe['interaction']['created']=![];if(_0x46fc82){if(_0x676bbe[_0x5c47('0x87')][_0x5c47('0xa9')]){_0x676bbe[_0x5c47('0xaa')]['push']({'id':0x0,'priority':_0x676bbe['applications']['length']+0x1,'app':_0x5c47('0xab'),'appdata':'unmanaged','interval':_0x5c47('0xac')});}_0x676bbe[_0x5c47('0xa8')][_0x5c47('0xad')]=!![];}return db[_0x5c47('0x8a')]['create']({'phone':_0x676bbe['body']['from'],'messageId':_0x676bbe[_0x5c47('0x60')]['messageId'],'body':_0x676bbe[_0x5c47('0x60')][_0x5c47('0x60')],'WhatsappAccountId':_0x59d505['params']['id'],'WhatsappInteractionId':_0x3cc784['id'],'direction':'in','ContactId':_0x3cc784[_0x5c47('0xae')],'AttachmentId':_0x676bbe['body']['AttachmentId']});})['then'](function(_0x295515){_0x676bbe[_0x5c47('0x2b')]=_0x295515;if(_0x676bbe[_0x5c47('0xa8')]['UserId']){return db['User'][_0x5c47('0x5e')]({'attributes':['id',_0x5c47('0x40')],'where':{'id':_0x676bbe[_0x5c47('0xa8')][_0x5c47('0xaf')]}})[_0x5c47('0x22')](function(_0x23a15d){if(_0x23a15d){_0x676bbe[_0x5c47('0xaa')][_0x5c47('0xb0')]({'id':0x0,'priority':0x0,'app':_0x5c47('0xb1'),'appdata':_0x23a15d[_0x5c47('0x40')]+','+(_0x676bbe[_0x5c47('0x87')][_0x5c47('0xb2')]||0xa),'interval':_0x5c47('0xac')});}return respondWithRpcPromise(_0x5c47('0xb3'),_0x5c47('0xb4'),_0x676bbe);});}return respondWithRpcPromise('Start','startRouting',_0x676bbe);})[_0x5c47('0x22')](function(_0xdc5fda){if(_0xdc5fda){var _0x2cb77e=0xc8;var _0x47cff2=_0x5c47('0xb5');logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x47cff2,_0x2cb77e,_0x5c47('0xb6'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x47cff2,_0x2cb77e,_0x5c47('0xb6'),JSON[_0x5c47('0x28')](_0xdc5fda));if(_0x676bbe['account'][_0x5c47('0x46')]==='twilio'){return _0x3720b5['status'](_0x2cb77e)['set'](_0x5c47('0xb7'),_0x5c47('0xb8'))[_0x5c47('0x82')](_0x5c47('0xb9'));}else{return _0x3720b5['status'](_0x2cb77e)[_0x5c47('0x31')](_0xdc5fda);}}});})[_0x5c47('0x2d')](handleError(_0x3720b5,null));};exports[_0x5c47('0x82')]=function(_0x25862c,_0x254254,_0x574994){var _0x5139cd,_0x16fb7d,_0x531dbb;if(_[_0x5c47('0x9e')](_0x25862c[_0x5c47('0x60')][_0x5c47('0x60')])||_0x25862c[_0x5c47('0x60')][_0x5c47('0x60')]===''){throw new db[(_0x5c47('0x8f'))][(_0x5c47('0xa0'))](_0x5c47('0xba'));}if(_[_0x5c47('0x9e')](_0x25862c['body']['to'])){throw new db[(_0x5c47('0x8f'))][(_0x5c47('0xa0'))](_0x5c47('0xbb'));}_0x5139cd=_0x25862c['body']['to'];return db[_0x5c47('0x44')][_0x5c47('0x5e')]({'where':{'id':_0x25862c[_0x5c47('0x5b')]['id']},'include':[{'model':db[_0x5c47('0xa4')],'as':'List','include':[{'model':db['CmContact'],'as':_0x5c47('0xa5'),'where':{'mobile':_0x5139cd},'limit':0x1,'order':[['updatedAt',_0x5c47('0xbc')]]}]}]})[_0x5c47('0x22')](handleEntityNotFound(_0x254254,null))[_0x5c47('0x22')](function(_0x3e647d){if(_0x3e647d&&_0x3e647d[_0x5c47('0xbd')]){_0x16fb7d=_0x3e647d[_0x5c47('0x3c')]({'plain':!![]});if(_0x16fb7d['List']&&_0x16fb7d[_0x5c47('0xbd')]['Contacts'][_0x5c47('0x5d')]){return _0x16fb7d['List']['Contacts'][0x0];}return db[_0x5c47('0x8e')][_0x5c47('0x5f')](_[_0x5c47('0x1c')](_0x25862c['body'],{'firstName':_0x5139cd,'mobile':_0x5139cd,'phone':_0x5139cd,'ListId':_0x16fb7d['ListId']}));}})[_0x5c47('0x22')](handleEntityNotFound(_0x254254,null))[_0x5c47('0x22')](function(_0x51dc39){if(_0x51dc39){_0x531dbb=_0x51dc39;return db[_0x5c47('0xa7')]['find']({'where':{'ContactId':_0x531dbb['id'],'closed':![],'WhatsappAccountId':_0x16fb7d['id']}})[_0x5c47('0x22')](function(_0x3519c9){if(_0x3519c9){return[_0x3519c9,![]];}return db['WhatsappInteraction'][_0x5c47('0x5f')]({'UserId':_0x25862c[_0x5c47('0x61')]['id'],'ContactId':_0x531dbb['id'],'WhatsappAccountId':_0x16fb7d['id'],'phone':_0x5139cd,'firstMsgDirection':'out','Messages':[_[_0x5c47('0x54')](_0x25862c['body'],{'read':![],'body':_0x25862c[_0x5c47('0x60')]['body'],'phone':_0x5139cd,'WhatsappAccountId':_0x16fb7d['id'],'UserId':_0x25862c[_0x5c47('0x61')]['id'],'ContactId':_0x531dbb['id']})]},{'include':[{'model':db[_0x5c47('0x8a')],'as':'Messages'}]})[_0x5c47('0x22')](function(_0xb81cd7){return[_0xb81cd7,!![]];});});}})[_0x5c47('0x73')](function(_0x331cd8,_0x164156){if(_0x164156){return _0x331cd8;}return db[_0x5c47('0x8a')][_0x5c47('0x5f')](_[_0x5c47('0x54')](_0x25862c[_0x5c47('0x60')],{'read':![],'body':_0x25862c[_0x5c47('0x60')][_0x5c47('0x60')],'phone':_0x5139cd,'WhatsappAccountId':_0x16fb7d['id'],'WhatsappInteractionId':_0x331cd8['id'],'UserId':_0x25862c[_0x5c47('0x61')]['id'],'ContactId':_0x531dbb['id']}))[_0x5c47('0x22')](function(_0x53f923){_0x331cd8[_0x5c47('0xbe')][_0x5c47('0xbf')]=[];_0x331cd8['dataValues']['Messages']['push'](_0x53f923[_0x5c47('0xbe')]);return _0x331cd8;});})[_0x5c47('0x22')](respondWithResult(_0x254254,null))['catch'](handleError(_0x254254,null));}; \ No newline at end of file +var _0x2385=['Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','get','WhatsappAccounts','UserProfileResource','destroy','stack','name','send','Pause','mandatoryDispositionPause','WhatsappAccount','fieldName','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','map','type','filter','options','where','includeAll','include','findAll','rows','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','rawAttributes','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','WhatsappApplication','findAndCountAll','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','replace','Body','MessageSid','notifications','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','Contacts','DESC','list','omit','contact','WhatsappInteraction','interaction','created','autoclose','push','close','*,*,*,*','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio'];(function(_0x44472b,_0x112301){var _0x2f40cd=function(_0xbc5d29){while(--_0xbc5d29){_0x44472b['push'](_0x44472b['shift']());}};_0x2f40cd(++_0x112301);}(_0x2385,0xcb));var _0x5238=function(_0x104652,_0x5cf118){_0x104652=_0x104652-0x0;var _0x526fad=_0x2385[_0x104652];return _0x526fad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5238('0x0'));var zipdir=require(_0x5238('0x1'));var jsonpatch=require(_0x5238('0x2'));var rp=require(_0x5238('0x3'));var moment=require(_0x5238('0x4'));var BPromise=require(_0x5238('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5238('0x6'));var sox=require(_0x5238('0x7'));var csv=require('to-csv');var ejs=require(_0x5238('0x8'));var fs=require('fs');var fs_extra=require(_0x5238('0x9'));var _=require(_0x5238('0xa'));var squel=require(_0x5238('0xb'));var crypto=require(_0x5238('0xc'));var jsforce=require(_0x5238('0xd'));var deskjs=require(_0x5238('0xe'));var toCsv=require(_0x5238('0xf'));var querystring=require(_0x5238('0x10'));var Papa=require(_0x5238('0x11'));var Redis=require(_0x5238('0x12'));var authService=require(_0x5238('0x13'));var qs=require(_0x5238('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5238('0x15'))(_0x5238('0x16'));var utils=require('../../config/utils');var config=require(_0x5238('0x17'));var licenseUtil=require(_0x5238('0x18'));var db=require(_0x5238('0x19'))['db'];config[_0x5238('0x1a')]=_[_0x5238('0x1b')](config[_0x5238('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x5238('0x1c'))(new Redis(config[_0x5238('0x1a')]));require(_0x5238('0x1d'))[_0x5238('0x1e')](socket);var jayson=require(_0x5238('0x1f'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x4a6eb0,_0x5b8acd,_0x491d22,_0x669596){return new BPromise(function(_0x19dbac,_0x4b7f0b){var _0xfdf121=_0x669596||client;return _0xfdf121[_0x5238('0x20')](_0x4a6eb0,_0x491d22)[_0x5238('0x21')](function(_0x355c6a){logger[_0x5238('0x22')](_0x5238('0x23'),_0x5b8acd,_0x5238('0x24'));logger[_0x5238('0x25')](_0x5238('0x26'),_0x5b8acd,_0x5238('0x24'),JSON[_0x5238('0x27')](_0x355c6a));if(_0x355c6a[_0x5238('0x28')]){if(_0x355c6a[_0x5238('0x28')][_0x5238('0x29')]===0x1f4){logger['error'](_0x5238('0x23'),_0x5b8acd,_0x355c6a[_0x5238('0x28')]['message']);return _0x4b7f0b(_0x355c6a[_0x5238('0x28')][_0x5238('0x2a')]);}logger[_0x5238('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x5b8acd,_0x355c6a['error'][_0x5238('0x2a')]);return _0x19dbac(_0x355c6a['error'][_0x5238('0x2a')]);}else{logger['info'](_0x5238('0x23'),_0x5b8acd,_0x5238('0x24'));_0x19dbac(_0x355c6a[_0x5238('0x2b')][_0x5238('0x2a')]);}})[_0x5238('0x2c')](function(_0x52e770){logger[_0x5238('0x28')](_0x5238('0x23'),_0x5b8acd,_0x52e770);_0x4b7f0b(_0x52e770);});});}function respondWithStatusCode(_0x153051,_0x342fe6){_0x342fe6=_0x342fe6||0xcc;return function(_0x505b08){if(_0x505b08){return _0x153051[_0x5238('0x2d')](_0x342fe6);}return _0x153051[_0x5238('0x2e')](_0x342fe6)[_0x5238('0x2f')]();};}function respondWithResult(_0x14a647,_0x5f4876){_0x5f4876=_0x5f4876||0xc8;return function(_0x58e045){if(_0x58e045){return _0x14a647[_0x5238('0x2e')](_0x5f4876)[_0x5238('0x30')](_0x58e045);}};}function respondWithFilteredResult(_0x5292a9,_0x1bba20){return function(_0x2f525a){if(_0x2f525a){var _0x31f642=typeof _0x1bba20[_0x5238('0x31')]===_0x5238('0x32')&&typeof _0x1bba20[_0x5238('0x33')]==='undefined';var _0x16cc50=_0x2f525a[_0x5238('0x34')];var _0x36905e=_0x31f642?0x0:_0x1bba20[_0x5238('0x31')];var _0x3399f1=_0x31f642?_0x2f525a[_0x5238('0x34')]:_0x1bba20['offset']+_0x1bba20[_0x5238('0x33')];var _0x12a2f8;if(_0x3399f1>=_0x16cc50){_0x3399f1=_0x16cc50;_0x12a2f8=0xc8;}else{_0x12a2f8=0xce;}_0x5292a9[_0x5238('0x2e')](_0x12a2f8);return _0x5292a9[_0x5238('0x35')]('Content-Range',_0x36905e+'-'+_0x3399f1+'/'+_0x16cc50)[_0x5238('0x30')](_0x2f525a);}return null;};}function patchUpdates(_0x58d258){return function(_0x14fea3){try{jsonpatch[_0x5238('0x36')](_0x14fea3,_0x58d258,!![]);}catch(_0x46b53a){return BPromise[_0x5238('0x37')](_0x46b53a);}return _0x14fea3['save']();};}function saveUpdates(_0x53597b,_0x40f1dc){return function(_0x43ce81){if(_0x43ce81){return _0x43ce81[_0x5238('0x38')](_0x53597b)[_0x5238('0x21')](function(_0x474081){return _0x474081;});}return null;};}function removeEntity(_0x169cd1,_0x55020e){return function(_0x8e856d){if(_0x8e856d){return _0x8e856d['destroy']()[_0x5238('0x21')](function(){var _0x30071c=_0x8e856d[_0x5238('0x39')]({'plain':!![]});var _0x1945a4=_0x5238('0x3a');return db[_0x5238('0x3b')][_0x5238('0x3c')]({'where':{'type':_0x1945a4,'resourceId':_0x30071c['id']}})[_0x5238('0x21')](function(){return _0x8e856d;});})[_0x5238('0x21')](function(){_0x169cd1[_0x5238('0x2e')](0xcc)[_0x5238('0x2f')]();});}};}function handleEntityNotFound(_0x4ef540,_0x21f0b8){return function(_0x2e96f6){if(!_0x2e96f6){_0x4ef540[_0x5238('0x2d')](0x194);}return _0x2e96f6;};}function handleError(_0xdd3d8a,_0x31aa9f){_0x31aa9f=_0x31aa9f||0x1f4;return function(_0x27524f){logger[_0x5238('0x28')](_0x27524f[_0x5238('0x3d')]);if(_0x27524f[_0x5238('0x3e')]){delete _0x27524f[_0x5238('0x3e')];}_0xdd3d8a[_0x5238('0x2e')](_0x31aa9f)[_0x5238('0x3f')](_0x27524f);};}exports['index']=function(_0x4246ea,_0xcee466){var _0x1e4704={'include':[{'model':db[_0x5238('0x40')],'as':_0x5238('0x41')}]},_0x199a97={},_0x3e14ab={'count':0x0,'rows':[]};var _0x4bfd87=_['map'](db[_0x5238('0x42')]['rawAttributes'],function(_0x43f107){return{'name':_0x43f107[_0x5238('0x43')],'type':_0x43f107['type'][_0x5238('0x44')]};});_0x199a97['model']=_['map'](_0x4bfd87,_0x5238('0x3e'));_0x199a97['query']=_[_0x5238('0x45')](_0x4246ea[_0x5238('0x46')]);_0x199a97['filters']=_[_0x5238('0x47')](_0x199a97[_0x5238('0x48')],_0x199a97['query']);_0x1e4704['attributes']=_[_0x5238('0x47')](_0x199a97[_0x5238('0x48')],qs[_0x5238('0x49')](_0x4246ea[_0x5238('0x46')][_0x5238('0x49')]));_0x1e4704['attributes']=_0x1e4704[_0x5238('0x4a')][_0x5238('0x4b')]?_0x1e4704[_0x5238('0x4a')]:_0x199a97[_0x5238('0x48')];if(!_0x4246ea['query'][_0x5238('0x4c')](_0x5238('0x4d'))){_0x1e4704[_0x5238('0x33')]=qs[_0x5238('0x33')](_0x4246ea[_0x5238('0x46')][_0x5238('0x33')]);_0x1e4704[_0x5238('0x31')]=qs[_0x5238('0x31')](_0x4246ea[_0x5238('0x46')][_0x5238('0x31')]);}_0x1e4704[_0x5238('0x4e')]=qs[_0x5238('0x4f')](_0x4246ea[_0x5238('0x46')][_0x5238('0x4f')]);_0x1e4704['where']=qs[_0x5238('0x50')](_[_0x5238('0x51')](_0x4246ea[_0x5238('0x46')],_0x199a97[_0x5238('0x50')]),_0x4bfd87);if(_0x4246ea[_0x5238('0x46')]['filter']){_0x1e4704['where']=_[_0x5238('0x52')](_0x1e4704['where'],{'$or':_[_0x5238('0x53')](_0x4bfd87,function(_0x233410){if(_0x233410[_0x5238('0x54')]!=='VIRTUAL'){var _0x511690={};_0x511690[_0x233410['name']]={'$like':'%'+_0x4246ea[_0x5238('0x46')][_0x5238('0x55')]+'%'};return _0x511690;}})});}_0x1e4704=_[_0x5238('0x52')]({},_0x1e4704,_0x4246ea[_0x5238('0x56')]);var _0x1460c0={'where':_0x1e4704[_0x5238('0x57')]};return db[_0x5238('0x42')]['count'](_0x1460c0)['then'](function(_0x27c390){_0x3e14ab[_0x5238('0x34')]=_0x27c390;if(_0x4246ea[_0x5238('0x46')][_0x5238('0x58')]){_0x1e4704[_0x5238('0x59')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x5238('0x5a')](_0x1e4704);})[_0x5238('0x21')](function(_0x2d56d2){_0x3e14ab[_0x5238('0x5b')]=_0x2d56d2;return _0x3e14ab;})[_0x5238('0x21')](respondWithFilteredResult(_0xcee466,_0x1e4704))[_0x5238('0x2c')](handleError(_0xcee466,null));};exports['show']=function(_0x47fb1,_0x47460d){var _0x591922={'raw':![],'where':{'id':_0x47fb1[_0x5238('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x5238('0x41')}]},_0x4bf964={};_0x4bf964['model']=_[_0x5238('0x45')](db[_0x5238('0x42')]['rawAttributes']);_0x4bf964[_0x5238('0x46')]=_[_0x5238('0x45')](_0x47fb1[_0x5238('0x46')]);_0x4bf964[_0x5238('0x50')]=_[_0x5238('0x47')](_0x4bf964[_0x5238('0x48')],_0x4bf964['query']);_0x591922[_0x5238('0x4a')]=_['intersection'](_0x4bf964[_0x5238('0x48')],qs[_0x5238('0x49')](_0x47fb1['query'][_0x5238('0x49')]));_0x591922['attributes']=_0x591922[_0x5238('0x4a')][_0x5238('0x4b')]?_0x591922['attributes']:_0x4bf964[_0x5238('0x48')];if(_0x47fb1[_0x5238('0x46')][_0x5238('0x58')]){_0x591922[_0x5238('0x59')]=[{'all':!![]}];}_0x591922=_[_0x5238('0x52')]({},_0x591922,_0x47fb1[_0x5238('0x56')]);return db['WhatsappAccount'][_0x5238('0x5d')](_0x591922)[_0x5238('0x21')](handleEntityNotFound(_0x47460d,null))['then'](respondWithResult(_0x47460d,null))[_0x5238('0x2c')](handleError(_0x47460d,null));};exports[_0x5238('0x5e')]=function(_0x1e1f47,_0x3454f0){return db[_0x5238('0x42')][_0x5238('0x5e')](_0x1e1f47['body'],{})[_0x5238('0x21')](function(_0x23f541){var _0x482fd4=_0x1e1f47[_0x5238('0x5f')][_0x5238('0x39')]({'plain':!![]});if(!_0x482fd4)throw new Error(_0x5238('0x60'));if(_0x482fd4[_0x5238('0x61')]===_0x5238('0x5f')){var _0x2af3ef=_0x23f541[_0x5238('0x39')]({'plain':!![]});var _0x525de9=_0x5238('0x3a');return db[_0x5238('0x62')][_0x5238('0x5d')]({'where':{'name':_0x525de9,'userProfileId':_0x482fd4['userProfileId']},'raw':!![]})[_0x5238('0x21')](function(_0x3e069a){if(_0x3e069a&&_0x3e069a['autoAssociation']===0x0){return db[_0x5238('0x3b')][_0x5238('0x5e')]({'name':_0x2af3ef[_0x5238('0x3e')],'resourceId':_0x2af3ef['id'],'type':_0x3e069a[_0x5238('0x3e')],'sectionId':_0x3e069a['id']},{})[_0x5238('0x21')](function(){return _0x23f541;});}else{return _0x23f541;}})[_0x5238('0x2c')](function(_0x2fce35){logger[_0x5238('0x28')](_0x5238('0x63'),_0x2fce35);throw _0x2fce35;});}return _0x23f541;})['then'](respondWithResult(_0x3454f0,0xc9))[_0x5238('0x2c')](handleError(_0x3454f0,null));};exports['update']=function(_0x9f18ee,_0x29402e){if(_0x9f18ee['body']['id']){delete _0x9f18ee[_0x5238('0x64')]['id'];}return db[_0x5238('0x42')]['find']({'where':{'id':_0x9f18ee['params']['id']},'include':[{'model':db['Pause'],'as':_0x5238('0x41')}]})['then'](handleEntityNotFound(_0x29402e,null))['then'](saveUpdates(_0x9f18ee[_0x5238('0x64')],null))[_0x5238('0x21')](respondWithResult(_0x29402e,null))[_0x5238('0x2c')](handleError(_0x29402e,null));};exports[_0x5238('0x3c')]=function(_0xa80355,_0x145bb2){return db['WhatsappAccount'][_0x5238('0x5d')]({'where':{'id':_0xa80355[_0x5238('0x5c')]['id']}})[_0x5238('0x21')](handleEntityNotFound(_0x145bb2,null))[_0x5238('0x21')](removeEntity(_0x145bb2,null))[_0x5238('0x2c')](handleError(_0x145bb2,null));};exports[_0x5238('0x65')]=function(_0x43a831,_0xdb7bc8){return db['WhatsappAccount']['describe']()['then'](respondWithResult(_0xdb7bc8,null))[_0x5238('0x2c')](handleError(_0xdb7bc8,null));};exports[_0x5238('0x66')]=function(_0x217b03,_0x17da66,_0x106db9){if(_0x217b03[_0x5238('0x64')]['id']){delete _0x217b03[_0x5238('0x64')]['id'];}return db[_0x5238('0x42')]['find']({'where':{'id':_0x217b03[_0x5238('0x5c')]['id']}})[_0x5238('0x21')](handleEntityNotFound(_0x17da66,null))[_0x5238('0x21')](function(_0x4389fc){if(_0x4389fc){_0x217b03[_0x5238('0x64')][_0x5238('0x67')]=_0x4389fc['id'];return db[_0x5238('0x68')]['create'](_0x217b03[_0x5238('0x64')]);}})[_0x5238('0x21')](respondWithResult(_0x17da66,null))['catch'](handleError(_0x17da66,null));};exports['getDispositions']=function(_0x585487,_0x4abc00,_0x4f26de){var _0x388b8d={'raw':![],'where':{}};var _0x45bb6b={};var _0x5e6286={'count':0x0,'rows':[]};return db[_0x5238('0x42')]['findOne']({'where':{'id':_0x585487[_0x5238('0x5c')]['id']}})[_0x5238('0x21')](handleEntityNotFound(_0x4abc00,null))['then'](function(_0x2415ef){if(_0x2415ef){_0x45bb6b['model']=_[_0x5238('0x45')](db['Disposition']['rawAttributes']);_0x45bb6b[_0x5238('0x46')]=_['keys'](_0x585487[_0x5238('0x46')]);_0x45bb6b[_0x5238('0x50')]=_[_0x5238('0x47')](_0x45bb6b['model'],_0x45bb6b[_0x5238('0x46')]);_0x388b8d[_0x5238('0x4a')]=_[_0x5238('0x47')](_0x45bb6b[_0x5238('0x48')],qs[_0x5238('0x49')](_0x585487[_0x5238('0x46')][_0x5238('0x49')]));_0x388b8d[_0x5238('0x4a')]=_0x388b8d[_0x5238('0x4a')][_0x5238('0x4b')]?_0x388b8d[_0x5238('0x4a')]:_0x45bb6b[_0x5238('0x48')];if(!_0x585487['query'][_0x5238('0x4c')](_0x5238('0x4d'))){_0x388b8d['limit']=qs[_0x5238('0x33')](_0x585487[_0x5238('0x46')][_0x5238('0x33')]);_0x388b8d['offset']=qs[_0x5238('0x31')](_0x585487[_0x5238('0x46')][_0x5238('0x31')]);}_0x388b8d[_0x5238('0x4e')]=qs[_0x5238('0x4f')](_0x585487[_0x5238('0x46')][_0x5238('0x4f')]);_0x388b8d[_0x5238('0x57')]=qs[_0x5238('0x50')](_['pick'](_0x585487['query'],_0x45bb6b['filters']));_0x388b8d['where']['WhatsappAccountId']=_0x2415ef['id'];if(_0x585487[_0x5238('0x46')][_0x5238('0x55')]){_0x388b8d['where']=_[_0x5238('0x52')](_0x388b8d[_0x5238('0x57')],{'$or':_[_0x5238('0x53')](_0x388b8d['attributes'],function(_0x5d06df){var _0x56ef45={};_0x56ef45[_0x5d06df]={'$like':'%'+_0x585487[_0x5238('0x46')][_0x5238('0x55')]+'%'};return _0x56ef45;})});}_0x388b8d=_[_0x5238('0x52')]({},_0x388b8d,_0x585487[_0x5238('0x56')]);return db['Disposition'][_0x5238('0x34')]({'where':_0x388b8d['where']})[_0x5238('0x21')](function(_0x28a9c9){_0x5e6286[_0x5238('0x34')]=_0x28a9c9;if(_0x585487['query']['includeAll']){_0x388b8d[_0x5238('0x59')]=[{'all':!![]}];}return db[_0x5238('0x68')][_0x5238('0x5a')](_0x388b8d);})[_0x5238('0x21')](function(_0xf0d0f5){_0x5e6286['rows']=_0xf0d0f5;return _0x5e6286;});}})['then'](respondWithFilteredResult(_0x4abc00,_0x388b8d))['catch'](handleError(_0x4abc00,null));};exports[_0x5238('0x69')]=function(_0x30cf83,_0x170bc2,_0x30234f){return db['WhatsappAccount'][_0x5238('0x5d')]({'where':{'id':_0x30cf83['params']['id']}})[_0x5238('0x21')](handleEntityNotFound(_0x170bc2,null))[_0x5238('0x21')](function(_0x3b8875){if(_0x3b8875){return _0x3b8875[_0x5238('0x69')](_0x30cf83['query'][_0x5238('0x6a')]);}})['then'](respondWithStatusCode(_0x170bc2,null))[_0x5238('0x2c')](handleError(_0x170bc2,null));};exports[_0x5238('0x6b')]=function(_0x368cf2,_0x5dc5ed,_0x4d2aaf){if(_0x368cf2[_0x5238('0x64')]['id']){delete _0x368cf2[_0x5238('0x64')]['id'];}return db[_0x5238('0x42')][_0x5238('0x5d')]({'where':{'id':_0x368cf2[_0x5238('0x5c')]['id']}})[_0x5238('0x21')](handleEntityNotFound(_0x5dc5ed,null))[_0x5238('0x21')](function(_0x30c15f){if(_0x30c15f){_0x368cf2[_0x5238('0x64')][_0x5238('0x67')]=_0x30c15f['id'];return db[_0x5238('0x6c')][_0x5238('0x5e')](_0x368cf2[_0x5238('0x64')]);}})['then'](respondWithResult(_0x5dc5ed,null))[_0x5238('0x2c')](handleError(_0x5dc5ed,null));};exports[_0x5238('0x6d')]=function(_0x132ab6,_0x8f9209,_0x4d2528){var _0x28f502={'raw':![],'where':{}};var _0x54fee8={};var _0x60d2a7={'count':0x0,'rows':[]};return db[_0x5238('0x42')][_0x5238('0x6e')]({'where':{'id':_0x132ab6[_0x5238('0x5c')]['id']}})[_0x5238('0x21')](handleEntityNotFound(_0x8f9209,null))['then'](function(_0x1dd438){if(_0x1dd438){_0x54fee8[_0x5238('0x48')]=_[_0x5238('0x45')](db[_0x5238('0x6c')][_0x5238('0x6f')]);_0x54fee8[_0x5238('0x46')]=_[_0x5238('0x45')](_0x132ab6[_0x5238('0x46')]);_0x54fee8['filters']=_[_0x5238('0x47')](_0x54fee8[_0x5238('0x48')],_0x54fee8[_0x5238('0x46')]);_0x28f502[_0x5238('0x4a')]=_[_0x5238('0x47')](_0x54fee8['model'],qs[_0x5238('0x49')](_0x132ab6['query']['fields']));_0x28f502[_0x5238('0x4a')]=_0x28f502[_0x5238('0x4a')]['length']?_0x28f502['attributes']:_0x54fee8[_0x5238('0x48')];if(!_0x132ab6[_0x5238('0x46')][_0x5238('0x4c')]('nolimit')){_0x28f502['limit']=qs[_0x5238('0x33')](_0x132ab6['query'][_0x5238('0x33')]);_0x28f502['offset']=qs['offset'](_0x132ab6['query'][_0x5238('0x31')]);}_0x28f502[_0x5238('0x4e')]=qs[_0x5238('0x4f')](_0x132ab6[_0x5238('0x46')][_0x5238('0x4f')]);_0x28f502[_0x5238('0x57')]=qs[_0x5238('0x50')](_[_0x5238('0x51')](_0x132ab6[_0x5238('0x46')],_0x54fee8[_0x5238('0x50')]));_0x28f502[_0x5238('0x57')]['WhatsappAccountId']=_0x1dd438['id'];if(_0x132ab6[_0x5238('0x46')]['filter']){_0x28f502[_0x5238('0x57')]=_[_0x5238('0x52')](_0x28f502[_0x5238('0x57')],{'$or':_[_0x5238('0x53')](_0x28f502[_0x5238('0x4a')],function(_0x3c18b6){var _0x57b7c3={};_0x57b7c3[_0x3c18b6]={'$like':'%'+_0x132ab6['query'][_0x5238('0x55')]+'%'};return _0x57b7c3;})});}_0x28f502=_[_0x5238('0x52')]({},_0x28f502,_0x132ab6['options']);return db['CannedAnswer'][_0x5238('0x34')]({'where':_0x28f502['where']})['then'](function(_0x14d04b){_0x60d2a7[_0x5238('0x34')]=_0x14d04b;if(_0x132ab6['query'][_0x5238('0x58')]){_0x28f502[_0x5238('0x59')]=[{'all':!![]}];}return db[_0x5238('0x6c')][_0x5238('0x5a')](_0x28f502);})[_0x5238('0x21')](function(_0x273a8e){_0x60d2a7[_0x5238('0x5b')]=_0x273a8e;return _0x60d2a7;});}})[_0x5238('0x21')](respondWithFilteredResult(_0x8f9209,_0x28f502))['catch'](handleError(_0x8f9209,null));};exports[_0x5238('0x70')]=function(_0x5f2bee,_0x56bd08,_0x2ecc2b){return db[_0x5238('0x42')][_0x5238('0x5d')]({'where':{'id':_0x5f2bee[_0x5238('0x5c')]['id']}})[_0x5238('0x21')](handleEntityNotFound(_0x56bd08,null))[_0x5238('0x21')](function(_0x354b2f){if(_0x354b2f){return _0x354b2f['removeAnswers'](_0x5f2bee[_0x5238('0x46')][_0x5238('0x6a')]);}})[_0x5238('0x21')](respondWithStatusCode(_0x56bd08,null))[_0x5238('0x2c')](handleError(_0x56bd08,null));};exports[_0x5238('0x71')]=function(_0x4bc8cc,_0xa490bd,_0x534013){return db[_0x5238('0x42')][_0x5238('0x5d')]({'where':{'id':_0x4bc8cc[_0x5238('0x5c')]['id']}})['then'](handleEntityNotFound(_0xa490bd,null))[_0x5238('0x21')](function(_0x31a6b9){if(_0x31a6b9){return _0x31a6b9[_0x5238('0x71')](_0x4bc8cc[_0x5238('0x64')][_0x5238('0x6a')],_['omit'](_0x4bc8cc[_0x5238('0x64')],[_0x5238('0x6a'),'id'])||{})[_0x5238('0x72')](function(_0x2a2580){for(var _0x586b6=0x0;_0x586b6<_0x4bc8cc[_0x5238('0x64')][_0x5238('0x6a')][_0x5238('0x4b')];_0x586b6+=0x1){socket[_0x5238('0x73')](_0x5238('0x74'),{'UserId':Number(_0x4bc8cc['body'][_0x5238('0x6a')][_0x586b6]),'WhatsappAccountId':Number(_0x4bc8cc[_0x5238('0x5c')]['id'])});}return _0x2a2580;});}})[_0x5238('0x21')](respondWithResult(_0xa490bd,null))[_0x5238('0x2c')](handleError(_0xa490bd,null));};exports[_0x5238('0x75')]=function(_0x2dcbae,_0x5ba092,_0x53fcd8){return db[_0x5238('0x42')][_0x5238('0x5d')]({'where':{'id':_0x2dcbae[_0x5238('0x5c')]['id']}})[_0x5238('0x21')](handleEntityNotFound(_0x5ba092,null))[_0x5238('0x21')](function(_0x4840f5){if(_0x4840f5){return _0x4840f5['removeAgents'](_0x2dcbae[_0x5238('0x46')][_0x5238('0x6a')])['then'](function(){if(_['isArray'](_0x2dcbae[_0x5238('0x46')][_0x5238('0x6a')])){for(var _0x5586de=0x0;_0x5586de<_0x2dcbae[_0x5238('0x46')][_0x5238('0x6a')][_0x5238('0x4b')];_0x5586de+=0x1){socket[_0x5238('0x73')](_0x5238('0x76'),{'UserId':Number(_0x2dcbae[_0x5238('0x46')][_0x5238('0x6a')][_0x5586de]),'WhatsappAccountId':Number(_0x2dcbae[_0x5238('0x5c')]['id'])});}}else{socket[_0x5238('0x73')](_0x5238('0x76'),{'UserId':Number(_0x2dcbae[_0x5238('0x46')][_0x5238('0x6a')]),'WhatsappAccountId':Number(_0x2dcbae[_0x5238('0x5c')]['id'])});}});}})[_0x5238('0x21')](respondWithStatusCode(_0x5ba092,null))[_0x5238('0x2c')](handleError(_0x5ba092,null));};exports[_0x5238('0x77')]=function(_0x1a8759,_0xcfebcd,_0x3124cd){var _0x24840e={};var _0x3f67c2={};var _0x5eb22a;var _0x5346ec;return db['WhatsappAccount'][_0x5238('0x6e')]({'where':{'id':_0x1a8759[_0x5238('0x5c')]['id']}})['then'](handleEntityNotFound(_0xcfebcd,null))[_0x5238('0x21')](function(_0x162b82){if(_0x162b82){_0x5eb22a=_0x162b82;_0x3f67c2['model']=_[_0x5238('0x45')](db[_0x5238('0x78')][_0x5238('0x6f')]);_0x3f67c2['query']=_[_0x5238('0x45')](_0x1a8759[_0x5238('0x46')]);_0x3f67c2[_0x5238('0x50')]=_['intersection'](_0x3f67c2[_0x5238('0x48')],_0x3f67c2[_0x5238('0x46')]);_0x24840e[_0x5238('0x4a')]=_[_0x5238('0x47')](_0x3f67c2['model'],qs[_0x5238('0x49')](_0x1a8759[_0x5238('0x46')][_0x5238('0x49')]));_0x24840e[_0x5238('0x4a')]=_0x24840e[_0x5238('0x4a')]['length']?_0x24840e[_0x5238('0x4a')]:_0x3f67c2[_0x5238('0x48')];_0x24840e[_0x5238('0x4e')]=qs[_0x5238('0x4f')](_0x1a8759[_0x5238('0x46')][_0x5238('0x4f')]);_0x24840e[_0x5238('0x57')]=qs[_0x5238('0x50')](_[_0x5238('0x51')](_0x1a8759[_0x5238('0x46')],_0x3f67c2[_0x5238('0x50')]));if(_0x1a8759[_0x5238('0x46')]['filter']){_0x24840e[_0x5238('0x57')]=_[_0x5238('0x52')](_0x24840e['where'],{'$or':_[_0x5238('0x53')](_0x24840e[_0x5238('0x4a')],function(_0x13d43c){var _0x488950={};_0x488950[_0x13d43c]={'$like':'%'+_0x1a8759['query'][_0x5238('0x55')]+'%'};return _0x488950;})});}_0x24840e=_['merge']({},_0x24840e,_0x1a8759[_0x5238('0x56')]);return _0x5eb22a[_0x5238('0x77')](_0x24840e);}})['then'](function(_0x50ff41){if(_0x50ff41){_0x5346ec=_0x50ff41['length'];if(!_0x1a8759['query']['hasOwnProperty'](_0x5238('0x4d'))){_0x24840e[_0x5238('0x33')]=qs['limit'](_0x1a8759[_0x5238('0x46')][_0x5238('0x33')]);_0x24840e[_0x5238('0x31')]=qs[_0x5238('0x31')](_0x1a8759[_0x5238('0x46')]['offset']);}return _0x5eb22a[_0x5238('0x77')](_0x24840e);}})['then'](function(_0x162980){if(_0x162980){return _0x162980?{'count':_0x5346ec,'rows':_0x162980}:null;}})[_0x5238('0x21')](respondWithResult(_0xcfebcd,null))['catch'](handleError(_0xcfebcd,null));};exports[_0x5238('0x79')]=function(_0xa7ad8a,_0x338f68){var _0x5bea4b=_0xa7ad8a[_0x5238('0x5c')]['id'];var _0x56ea59=_0xa7ad8a[_0x5238('0x64')];var _0x3dc43a=0xc8;var _0x342003=null;return db['sequelize'][_0x5238('0x7a')]({'isolationLevel':db[_0x5238('0x7b')][_0x5238('0x7c')][_0x5238('0x7d')]['READ_COMMITTED']},function(_0x5e9c48){return db['WhatsappAccount'][_0x5238('0x6e')]({'where':{'id':_0x5bea4b},'transaction':_0x5e9c48})[_0x5238('0x21')](function(_0x5337aa){if(_0x5337aa){return db[_0x5238('0x7e')]['destroy']({'where':{'WhatsappAccountId':_0x5bea4b},'transaction':_0x5e9c48})[_0x5238('0x21')](function(){var _0xef12b4=_[_0x5238('0x53')](_0x56ea59,function(_0x479564){_0x479564['WhatsappAccountId']=_0x5bea4b;return _0x479564;});return db[_0x5238('0x7e')]['bulkCreate'](_0xef12b4,{'transaction':_0x5e9c48});});}else{_0x3dc43a=0x194;_0x342003=[];}});})[_0x5238('0x21')](function(){if(_0x3dc43a!==0x194){return db['WhatsappApplication'][_0x5238('0x7f')]({'where':{'WhatsappAccountId':_0x5bea4b},'order':'priority'})[_0x5238('0x21')](function(_0x430b53){_0x342003=_0x430b53;});}})['catch'](function(_0x53de98){_0x3dc43a=0x1f4;logger[_0x5238('0x28')](_0x53de98[_0x5238('0x3d')]);if(_0x53de98['name']){delete _0x53de98[_0x5238('0x3e')];}_0x342003=_0x53de98;})['finally'](function(){if(_0x342003===null){_0x338f68[_0x5238('0x2d')](_0x3dc43a);}else{if(_0x3dc43a===0x1f4){_0x338f68[_0x5238('0x2e')](_0x3dc43a)[_0x5238('0x3f')](_0x342003);}else{_0x338f68[_0x5238('0x2e')](_0x3dc43a)[_0x5238('0x30')](_0x342003);}}});};exports[_0x5238('0x80')]=function(_0x1732dd,_0xa41338,_0x53c60e){var _0x13b791={};var _0x2aa9a7={};var _0x595245;var _0x110630;return db[_0x5238('0x42')][_0x5238('0x6e')]({'where':{'id':_0x1732dd[_0x5238('0x5c')]['id']}})['then'](handleEntityNotFound(_0xa41338,null))[_0x5238('0x21')](function(_0x2604c4){if(_0x2604c4){_0x595245=_0x2604c4;_0x2aa9a7[_0x5238('0x48')]=_[_0x5238('0x45')](db[_0x5238('0x7e')][_0x5238('0x6f')]);_0x2aa9a7[_0x5238('0x46')]=_[_0x5238('0x45')](_0x1732dd[_0x5238('0x46')]);_0x2aa9a7['filters']=_['intersection'](_0x2aa9a7[_0x5238('0x48')],_0x2aa9a7['query']);_0x13b791[_0x5238('0x4a')]=_['intersection'](_0x2aa9a7[_0x5238('0x48')],qs[_0x5238('0x49')](_0x1732dd['query'][_0x5238('0x49')]));_0x13b791[_0x5238('0x4a')]=_0x13b791[_0x5238('0x4a')][_0x5238('0x4b')]?_0x13b791[_0x5238('0x4a')]:_0x2aa9a7[_0x5238('0x48')];_0x13b791[_0x5238('0x4e')]=qs['sort'](_0x1732dd[_0x5238('0x46')][_0x5238('0x4f')]);_0x13b791[_0x5238('0x57')]=qs[_0x5238('0x50')](_[_0x5238('0x51')](_0x1732dd[_0x5238('0x46')],_0x2aa9a7[_0x5238('0x50')]));if(_0x1732dd['query'][_0x5238('0x55')]){_0x13b791[_0x5238('0x57')]=_[_0x5238('0x52')](_0x13b791['where'],{'$or':_['map'](_0x13b791['attributes'],function(_0x1104f7){var _0x3aaabf={};_0x3aaabf[_0x1104f7]={'$like':'%'+_0x1732dd[_0x5238('0x46')][_0x5238('0x55')]+'%'};return _0x3aaabf;})});}_0x13b791=_[_0x5238('0x52')]({},_0x13b791,_0x1732dd[_0x5238('0x56')]);return _0x595245[_0x5238('0x80')](_0x13b791);}})[_0x5238('0x21')](function(_0x531b6b){if(_0x531b6b){_0x110630=_0x531b6b['length'];if(!_0x1732dd[_0x5238('0x46')][_0x5238('0x4c')]('nolimit')){_0x13b791['limit']=qs[_0x5238('0x33')](_0x1732dd[_0x5238('0x46')][_0x5238('0x33')]);_0x13b791[_0x5238('0x31')]=qs[_0x5238('0x31')](_0x1732dd[_0x5238('0x46')][_0x5238('0x31')]);}return _0x595245['getApplications'](_0x13b791);}})[_0x5238('0x21')](function(_0x4a06ed){if(_0x4a06ed){return _0x4a06ed?{'count':_0x110630,'rows':_0x4a06ed}:null;}})[_0x5238('0x21')](respondWithResult(_0xa41338,null))['catch'](handleError(_0xa41338,null));};exports[_0x5238('0x81')]=function(_0x2ec54e,_0x44f16e,_0x5ed40e){var _0x4bea0b={'channel':_0x5238('0x82')};var _0x98605f=[];var _0x355aa8=[];var _0x33e4eb={};return db['WhatsappAccount'][_0x5238('0x5d')]({'where':{'id':_0x2ec54e[_0x5238('0x5c')]['id']},'include':[{'model':db[_0x5238('0x7e')],'as':_0x5238('0x83')}]})[_0x5238('0x21')](handleEntityNotFound(_0x44f16e,null))[_0x5238('0x21')](function(_0xfd4afc){_0x4bea0b[_0x5238('0x84')]=_0xfd4afc;if(_0x4bea0b[_0x5238('0x84')]&&_0x4bea0b['account'][_0x5238('0x54')]===_0x5238('0x85')&&_0x2ec54e[_0x5238('0x64')][_0x5238('0x86')]){if(_0x2ec54e[_0x5238('0x64')][_0x5238('0x86')]['length']===0x0)return;if(_0x2ec54e[_0x5238('0x64')][_0x5238('0x86')][0x0][_0x5238('0x87')]!==_0x5238('0x88'))return;return db[_0x5238('0x89')][_0x5238('0x38')]({'read':!![],'readAt':_0x2ec54e['body'][_0x5238('0x86')][0x0][_0x5238('0x8a')]},{'where':{'messageId':_0x2ec54e[_0x5238('0x64')][_0x5238('0x86')][0x0][_0x5238('0x8b')]},'individualHooks':!![]})[_0x5238('0x21')](function(_0x16d780){return _0x44f16e['status'](0xc8)[_0x5238('0x30')](_0x16d780);});}_0x4bea0b[_0x5238('0x8c')]=_[_0x5238('0x8d')](_0xfd4afc['Applications'],['priority'],[_0x5238('0x8e')]);if(_0x4bea0b['account'][_0x5238('0x83')]){delete _0x4bea0b[_0x5238('0x84')][_0x5238('0x83')];}return db[_0x5238('0x8f')]['describe']()[_0x5238('0x21')](function(_0x1a2742){if(!_0x1a2742){throw new db[(_0x5238('0x90'))][(_0x5238('0x91'))]('no\x20available\x20attributes');}_0x98605f=_[_0x5238('0x92')](_[_0x5238('0x45')](_0x1a2742),[_0x5238('0x93'),_0x5238('0x94')]);_0x355aa8=_[_0x5238('0x92')](_[_0x5238('0x45')](_0x1a2742),[_0x5238('0x93'),_0x5238('0x94'),_0x5238('0x95'),_0x5238('0x96')]);_0x4bea0b[_0x5238('0x64')]={'mapKey':_0x5238('0x97')};if(_0x4bea0b[_0x5238('0x84')]&&_0x4bea0b[_0x5238('0x84')][_0x5238('0x54')]==='twilio'){_0x4bea0b['body'][_0x5238('0x98')]=_0x2ec54e['body'][_0x5238('0x99')][_0x5238('0x9a')]('whatsapp:','');_0x4bea0b[_0x5238('0x64')]['body']=_0x2ec54e[_0x5238('0x64')][_0x5238('0x9b')];_0x4bea0b[_0x5238('0x64')]['messageId']=_0x2ec54e[_0x5238('0x64')][_0x5238('0x9c')];}if(_0x4bea0b['account']&&_0x4bea0b['account'][_0x5238('0x54')]===_0x5238('0x85')){_0x4bea0b[_0x5238('0x64')][_0x5238('0x98')]=_0x2ec54e[_0x5238('0x64')]['notifications'][0x0][_0x5238('0x98')];_0x4bea0b[_0x5238('0x64')][_0x5238('0x64')]=_0x2ec54e[_0x5238('0x64')][_0x5238('0x9d')][0x0]['message'][_0x5238('0x64')];_0x4bea0b['body'][_0x5238('0x9e')]=_0x2ec54e[_0x5238('0x64')][_0x5238('0x9d')][0x0][_0x5238('0x8b')];}if(_0x4bea0b[_0x5238('0x64')]['id']){delete _0x4bea0b['body']['id'];}if(_[_0x5238('0x9f')](_0x4bea0b[_0x5238('0x64')][_0x5238('0x98')])){throw new db[(_0x5238('0x90'))][(_0x5238('0x91'))](_0x5238('0xa0'));}if(_['isNil'](_0x4bea0b[_0x5238('0x64')]['body'])||_0x4bea0b[_0x5238('0x64')][_0x5238('0x64')]===''){throw new db['Sequelize']['ValidationError'](_0x5238('0xa1'));}if(_[_0x5238('0x9f')](_0x4bea0b[_0x5238('0x64')][_0x5238('0xa2')])){throw new db[(_0x5238('0x90'))][(_0x5238('0x91'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x355aa8);}if(!_[_0x5238('0xa3')](_0x355aa8,_0x4bea0b[_0x5238('0x64')][_0x5238('0xa2')])){throw new db[(_0x5238('0x90'))][(_0x5238('0x91'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x355aa8);}_0x33e4eb[_0x4bea0b[_0x5238('0x64')]['mapKey']]=_0x4bea0b['body']['from'];return db[_0x5238('0xa4')][_0x5238('0x5d')]({'where':{'id':_0x4bea0b['account']['ListId']},'include':[{'model':db[_0x5238('0x8f')],'as':_0x5238('0xa5'),'where':_0x33e4eb,'limit':0x1,'order':[[_0x5238('0x94'),_0x5238('0xa6')]]}]});})[_0x5238('0x21')](handleEntityNotFound(_0x44f16e,null))['then'](function(_0x3b115d){if(_0x3b115d){_0x4bea0b[_0x5238('0xa7')]=_[_0x5238('0xa8')](_0x3b115d,[_0x5238('0xa5')]);if(_0x3b115d['Contacts']['length']){return _0x3b115d['Contacts'][0x0];}var _0x438f78=_[_0x5238('0x1b')](_0x4bea0b[_0x5238('0x64')],{'firstName':_0x4bea0b[_0x5238('0x64')][_0x5238('0x98')],'ListId':_0x3b115d['id']});_0x438f78[_0x4bea0b[_0x5238('0x64')]['mapKey']]=_0x4bea0b[_0x5238('0x64')][_0x5238('0x98')];return db['CmContact'][_0x5238('0x5e')](_0x438f78,{'fields':_0x98605f,'raw':!![]});}})['then'](handleEntityNotFound(_0x44f16e,null))[_0x5238('0x21')](function(_0x3c5f18){if(_0x3c5f18){_0x4bea0b[_0x5238('0xa9')]=_0x3c5f18;var _0x40c777={'ContactId':_0x3c5f18['id'],'phone':_0x4bea0b[_0x5238('0x64')][_0x5238('0x98')],'WhatsappAccountId':_0x2ec54e['params']['id']};var _0x433670={'ContactId':_0x3c5f18['id'],'WhatsappAccountId':_0x2ec54e[_0x5238('0x5c')]['id'],'closed':![]};return db[_0x5238('0xaa')]['find']({'where':_0x433670})[_0x5238('0x21')](function(_0x4bd371){if(_0x4bd371){return[_0x4bd371,![]];}return db[_0x5238('0xaa')][_0x5238('0x5e')](_0x40c777)[_0x5238('0x21')](function(_0x4375ba){return[_0x4375ba,!![]];});});}})[_0x5238('0x72')](function(_0x4325fb,_0x58f33a){_0x4bea0b[_0x5238('0xab')]=_0x4325fb[_0x5238('0x39')]({'plain':!![]});_0x4bea0b['interaction'][_0x5238('0xac')]=![];if(_0x58f33a){if(_0x4bea0b[_0x5238('0x84')][_0x5238('0xad')]){_0x4bea0b[_0x5238('0x8c')][_0x5238('0xae')]({'id':0x0,'priority':_0x4bea0b['applications'][_0x5238('0x4b')]+0x1,'app':_0x5238('0xaf'),'appdata':'unmanaged','interval':_0x5238('0xb0')});}_0x4bea0b['interaction'][_0x5238('0xac')]=!![];}return db[_0x5238('0x89')][_0x5238('0x5e')]({'phone':_0x4bea0b[_0x5238('0x64')]['from'],'messageId':_0x4bea0b[_0x5238('0x64')][_0x5238('0x9e')],'body':_0x4bea0b[_0x5238('0x64')][_0x5238('0x64')],'WhatsappAccountId':_0x2ec54e[_0x5238('0x5c')]['id'],'WhatsappInteractionId':_0x4325fb['id'],'direction':'in','ContactId':_0x4325fb['ContactId'],'AttachmentId':_0x4bea0b['body']['AttachmentId']});})[_0x5238('0x21')](function(_0x321c17){_0x4bea0b[_0x5238('0x2a')]=_0x321c17;if(_0x4bea0b['interaction'][_0x5238('0xb1')]){return db[_0x5238('0x78')][_0x5238('0x5d')]({'attributes':['id',_0x5238('0x3e')],'where':{'id':_0x4bea0b['interaction'][_0x5238('0xb1')]}})[_0x5238('0x21')](function(_0x5a6480){if(_0x5a6480){_0x4bea0b[_0x5238('0x8c')][_0x5238('0xb2')]({'id':0x0,'priority':0x0,'app':_0x5238('0xb3'),'appdata':_0x5a6480[_0x5238('0x3e')]+','+(_0x4bea0b[_0x5238('0x84')][_0x5238('0xb4')]||0xa),'interval':_0x5238('0xb0')});}return respondWithRpcPromise(_0x5238('0xb5'),_0x5238('0xb6'),_0x4bea0b);});}return respondWithRpcPromise(_0x5238('0xb5'),_0x5238('0xb6'),_0x4bea0b);})[_0x5238('0x21')](function(_0x53e962){if(_0x53e962){var _0x40b455=0xc8;var _0x954525=_0x5238('0xb7');logger[_0x5238('0x22')](_0x5238('0x26'),_0x954525,_0x40b455,_0x5238('0xb8'));logger[_0x5238('0x25')](_0x5238('0xb9'),_0x954525,_0x40b455,_0x5238('0xb8'),JSON[_0x5238('0x27')](_0x53e962));if(_0x4bea0b[_0x5238('0x84')]['type']===_0x5238('0xba')){return _0x44f16e[_0x5238('0x2e')](_0x40b455)[_0x5238('0x35')](_0x5238('0xbb'),_0x5238('0xbc'))[_0x5238('0x3f')](_0x5238('0xbd'));}else{return _0x44f16e[_0x5238('0x2e')](_0x40b455)[_0x5238('0x30')](_0x53e962);}}});})[_0x5238('0x2c')](handleError(_0x44f16e,null));};exports['send']=function(_0x5c4b5a,_0x21da8f,_0xb652a9){var _0x29ee51,_0x2235b8,_0x1e27c8;if(_['isNil'](_0x5c4b5a['body'][_0x5238('0x64')])||_0x5c4b5a['body']['body']===''){throw new db[(_0x5238('0x90'))]['ValidationError'](_0x5238('0xa1'));}if(_['isNil'](_0x5c4b5a[_0x5238('0x64')]['to'])){throw new db[(_0x5238('0x90'))]['ValidationError'](_0x5238('0xbe'));}_0x29ee51=_0x5c4b5a[_0x5238('0x64')]['to'];return db[_0x5238('0x42')][_0x5238('0x5d')]({'where':{'id':_0x5c4b5a['params']['id']},'include':[{'model':db[_0x5238('0xa4')],'as':_0x5238('0xbf'),'include':[{'model':db['CmContact'],'as':_0x5238('0xa5'),'where':{'mobile':_0x29ee51},'limit':0x1,'order':[[_0x5238('0x94'),_0x5238('0xa6')]]}]}]})[_0x5238('0x21')](handleEntityNotFound(_0x21da8f,null))[_0x5238('0x21')](function(_0x3668a0){if(_0x3668a0&&_0x3668a0['List']){_0x2235b8=_0x3668a0[_0x5238('0x39')]({'plain':!![]});if(_0x2235b8[_0x5238('0xbf')]&&_0x2235b8['List'][_0x5238('0xa5')][_0x5238('0x4b')]){return _0x2235b8[_0x5238('0xbf')]['Contacts'][0x0];}return db[_0x5238('0x8f')]['create'](_['defaults'](_0x5c4b5a[_0x5238('0x64')],{'firstName':_0x29ee51,'mobile':_0x29ee51,'phone':_0x29ee51,'ListId':_0x2235b8['ListId']}));}})[_0x5238('0x21')](handleEntityNotFound(_0x21da8f,null))[_0x5238('0x21')](function(_0x19aea2){if(_0x19aea2){_0x1e27c8=_0x19aea2;return db['WhatsappInteraction'][_0x5238('0x5d')]({'where':{'ContactId':_0x1e27c8['id'],'closed':![],'WhatsappAccountId':_0x2235b8['id']}})[_0x5238('0x21')](function(_0x19df96){if(_0x19df96){return[_0x19df96,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x5c4b5a['user']['id'],'ContactId':_0x1e27c8['id'],'WhatsappAccountId':_0x2235b8['id'],'phone':_0x29ee51,'firstMsgDirection':_0x5238('0xc0'),'Messages':[_['merge'](_0x5c4b5a[_0x5238('0x64')],{'read':![],'body':_0x5c4b5a['body'][_0x5238('0x64')],'phone':_0x29ee51,'WhatsappAccountId':_0x2235b8['id'],'UserId':_0x5c4b5a[_0x5238('0x5f')]['id'],'ContactId':_0x1e27c8['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})[_0x5238('0x21')](function(_0x1446ed){return[_0x1446ed,!![]];});});}})['spread'](function(_0x3d0101,_0x15a173){if(_0x15a173){return _0x3d0101;}return db['WhatsappMessage'][_0x5238('0x5e')](_[_0x5238('0x52')](_0x5c4b5a['body'],{'read':![],'body':_0x5c4b5a[_0x5238('0x64')]['body'],'phone':_0x29ee51,'WhatsappAccountId':_0x2235b8['id'],'WhatsappInteractionId':_0x3d0101['id'],'UserId':_0x5c4b5a[_0x5238('0x5f')]['id'],'ContactId':_0x1e27c8['id']}))[_0x5238('0x21')](function(_0x489bde){_0x3d0101['dataValues'][_0x5238('0xc1')]=[];_0x3d0101[_0x5238('0xc2')]['Messages'][_0x5238('0xae')](_0x489bde[_0x5238('0xc2')]);return _0x3d0101;});})[_0x5238('0x21')](respondWithResult(_0x21da8f,null))[_0x5238('0x2c')](handleError(_0x21da8f,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index a26acdd..402321f 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 _0x4c5a=['emit','hook','exports','../../mysqldb','WhatsappAccount','update'];(function(_0x447b00,_0x44800a){var _0x315e68=function(_0x2391ff){while(--_0x2391ff){_0x447b00['push'](_0x447b00['shift']());}};_0x315e68(++_0x44800a);}(_0x4c5a,0x105));var _0xa4c5=function(_0x457c96,_0x13785c){_0x457c96=_0x457c96-0x0;var _0x4e5ebc=_0x4c5a[_0x457c96];return _0x4e5ebc;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xa4c5('0x0'))['db'][_0xa4c5('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa4c5('0x2'),'afterDestroy':'remove'};function emitEvent(_0x14efbc){return function(_0x39be2a,_0x589a52,_0x4bc71f){WhatsappAccountEvents[_0xa4c5('0x3')](_0x14efbc+':'+_0x39be2a['id'],_0x39be2a);WhatsappAccountEvents[_0xa4c5('0x3')](_0x14efbc,_0x39be2a);_0x4bc71f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xa4c5('0x4')](e,emitEvent(event));}}module[_0xa4c5('0x5')]=WhatsappAccountEvents; \ No newline at end of file +var _0x3850=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove'];(function(_0x4f39fd,_0x36d85f){var _0x4ef809=function(_0x52ef4c){while(--_0x52ef4c){_0x4f39fd['push'](_0x4f39fd['shift']());}};_0x4ef809(++_0x36d85f);}(_0x3850,0xa9));var _0x0385=function(_0x1fecac,_0x250c59){_0x1fecac=_0x1fecac-0x0;var _0xc20399=_0x3850[_0x1fecac];return _0xc20399;};'use strict';var EventEmitter=require(_0x0385('0x0'));var WhatsappAccount=require(_0x0385('0x1'))['db'][_0x0385('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x0385('0x3')](0x0);var events={'afterCreate':_0x0385('0x4'),'afterUpdate':_0x0385('0x5'),'afterDestroy':_0x0385('0x6')};function emitEvent(_0x5474b2){return function(_0x2e5715,_0x44227b,_0x18c477){WhatsappAccountEvents[_0x0385('0x7')](_0x5474b2+':'+_0x2e5715['id'],_0x2e5715);WhatsappAccountEvents[_0x0385('0x7')](_0x5474b2,_0x2e5715);_0x18c477(null);};}for(var e in events){if(events[_0x0385('0x8')](e)){var event=events[e];WhatsappAccount[_0x0385('0x9')](e,emitEvent(event));}}module[_0x0385('0xa')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 69e3655..736105d 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 _0x9e90=['api','moment','request-promise','path','rimraf','../../config/environment','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e90,0x141));var _0x09e9=function(_0x380669,_0xe47724){_0x380669=_0x380669-0x0;var _0x4de1f5=_0x9e90[_0x380669];return _0x4de1f5;};'use strict';var _=require(_0x09e9('0x0'));var util=require(_0x09e9('0x1'));var logger=require(_0x09e9('0x2'))(_0x09e9('0x3'));var moment=require(_0x09e9('0x4'));var BPromise=require('bluebird');var rp=require(_0x09e9('0x5'));var fs=require('fs');var path=require(_0x09e9('0x6'));var rimraf=require(_0x09e9('0x7'));var config=require(_0x09e9('0x8'));var attributes=require('./whatsappAccount.attributes');module['exports']=function(_0x351c30,_0x42532e){return _0x351c30[_0x09e9('0x9')](_0x09e9('0xa'),attributes,{'tableName':_0x09e9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7289=['util','../../config/logger','api','moment','path','../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','lodash'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x7289,0x1b7));var _0x9728=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x7289[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x9728('0x0'));var util=require(_0x9728('0x1'));var logger=require(_0x9728('0x2'))(_0x9728('0x3'));var moment=require(_0x9728('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9728('0x5'));var rimraf=require('rimraf');var config=require(_0x9728('0x6'));var attributes=require(_0x9728('0x7'));module['exports']=function(_0x564591,_0x3ce2ce){return _0x564591[_0x9728('0x8')](_0x9728('0x9'),attributes,{'tableName':_0x9728('0xa'),'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 b314e9c..e76d44a 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 _0xc0b7=['redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','WhatsappAccount','options','where','attributes','include','map','model','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1cd71f,_0x2a9d19){var _0x33d362=function(_0x2ecb41){while(--_0x2ecb41){_0x1cd71f['push'](_0x1cd71f['shift']());}};_0x33d362(++_0x2a9d19);}(_0xc0b7,0x170));var _0x7c0b=function(_0x5ce5b0,_0x4f10d7){_0x5ce5b0=_0x5ce5b0-0x0;var _0x385cad=_0xc0b7[_0x5ce5b0];return _0x385cad;};'use strict';var _=require('lodash');var util=require(_0x7c0b('0x0'));var moment=require('moment');var BPromise=require(_0x7c0b('0x1'));var rs=require(_0x7c0b('0x2'));var fs=require('fs');var Redis=require(_0x7c0b('0x3'));var db=require(_0x7c0b('0x4'))['db'];var utils=require(_0x7c0b('0x5'));var logger=require(_0x7c0b('0x6'))(_0x7c0b('0x7'));var config=require(_0x7c0b('0x8'));var jayson=require(_0x7c0b('0x9'));var client=jayson[_0x7c0b('0xa')][_0x7c0b('0xb')]({'port':0x232a});config[_0x7c0b('0xc')]=_[_0x7c0b('0xd')](config[_0x7c0b('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7c0b('0xe'))(new Redis(config[_0x7c0b('0xc')]));require(_0x7c0b('0xf'))[_0x7c0b('0x10')](socket);function respondWithRpcPromise(_0x419d34,_0x5da13d,_0x574fa5){return new BPromise(function(_0x3f21ee,_0x1a1459){return client[_0x7c0b('0x11')](_0x419d34,_0x574fa5)[_0x7c0b('0x12')](function(_0x1d1b6b){logger[_0x7c0b('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x5da13d,_0x7c0b('0x14'));logger[_0x7c0b('0x15')](_0x7c0b('0x16'),_0x5da13d,_0x7c0b('0x14'),JSON[_0x7c0b('0x17')](_0x1d1b6b));if(_0x1d1b6b['error']){if(_0x1d1b6b[_0x7c0b('0x18')][_0x7c0b('0x19')]===0x1f4){logger['error'](_0x7c0b('0x1a'),_0x5da13d,_0x1d1b6b[_0x7c0b('0x18')][_0x7c0b('0x1b')]);return _0x1a1459(_0x1d1b6b[_0x7c0b('0x18')]['message']);}logger[_0x7c0b('0x18')](_0x7c0b('0x1a'),_0x5da13d,_0x1d1b6b[_0x7c0b('0x18')][_0x7c0b('0x1b')]);return _0x3f21ee(_0x1d1b6b['error']['message']);}else{logger[_0x7c0b('0x13')](_0x7c0b('0x1a'),_0x5da13d,_0x7c0b('0x14'));_0x3f21ee(_0x1d1b6b[_0x7c0b('0x1c')]['message']);}})[_0x7c0b('0x1d')](function(_0x586e6d){logger[_0x7c0b('0x18')](_0x7c0b('0x1a'),_0x5da13d,_0x586e6d);_0x1a1459(_0x586e6d);});});}exports[_0x7c0b('0x1e')]=function(_0x11ffb3){var _0x364f59=this;return new Promise(function(_0x47811b,_0x490d09){return db[_0x7c0b('0x1f')]['find']({'raw':_0x11ffb3['options']?_0x11ffb3[_0x7c0b('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x11ffb3['options']?_0x11ffb3['options'][_0x7c0b('0x21')]||null:null,'attributes':_0x11ffb3[_0x7c0b('0x20')]?_0x11ffb3['options'][_0x7c0b('0x22')]||null:null,'include':_0x11ffb3[_0x7c0b('0x20')]?_0x11ffb3[_0x7c0b('0x20')][_0x7c0b('0x23')]?_[_0x7c0b('0x24')](_0x11ffb3[_0x7c0b('0x20')][_0x7c0b('0x23')],function(_0x9a9ac8){return{'model':db[_0x9a9ac8[_0x7c0b('0x25')]],'as':_0x9a9ac8['as'],'attributes':_0x9a9ac8[_0x7c0b('0x22')],'include':_0x9a9ac8[_0x7c0b('0x23')]?_['map'](_0x9a9ac8[_0x7c0b('0x23')],function(_0x14fce7){return{'model':db[_0x14fce7['model']],'as':_0x14fce7['as'],'attributes':_0x14fce7['attributes'],'include':_0x14fce7[_0x7c0b('0x23')]?_[_0x7c0b('0x24')](_0x14fce7[_0x7c0b('0x23')],function(_0x13e8ff){return{'model':db[_0x13e8ff[_0x7c0b('0x25')]],'as':_0x13e8ff['as'],'attributes':_0x13e8ff[_0x7c0b('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x201ec5){logger['info'](_0x7c0b('0x1e'),_0x11ffb3);logger['debug'](_0x7c0b('0x1e'),_0x11ffb3,JSON[_0x7c0b('0x17')](_0x201ec5));_0x47811b(_0x201ec5);})[_0x7c0b('0x1d')](function(_0x70273b){logger[_0x7c0b('0x18')](_0x7c0b('0x1e'),_0x70273b['message'],_0x11ffb3);_0x490d09(_0x364f59['error'](0x1f4,_0x70273b[_0x7c0b('0x1b')]));});});}; \ No newline at end of file +var _0x5939=['./whatsappAccount.socket','register','request','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','include','map','model','attributes','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x1357f9,_0x4be68b){var _0xcc3728=function(_0x22fe77){while(--_0x22fe77){_0x1357f9['push'](_0x1357f9['shift']());}};_0xcc3728(++_0x4be68b);}(_0x5939,0x1dc));var _0x9593=function(_0x4904de,_0x25b560){_0x4904de=_0x4904de-0x0;var _0x716837=_0x5939[_0x4904de];return _0x716837;};'use strict';var _=require(_0x9593('0x0'));var util=require(_0x9593('0x1'));var moment=require(_0x9593('0x2'));var BPromise=require(_0x9593('0x3'));var rs=require(_0x9593('0x4'));var fs=require('fs');var Redis=require(_0x9593('0x5'));var db=require(_0x9593('0x6'))['db'];var utils=require(_0x9593('0x7'));var logger=require(_0x9593('0x8'))(_0x9593('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9593('0xa')][_0x9593('0xb')]({'port':0x232a});config[_0x9593('0xc')]=_[_0x9593('0xd')](config[_0x9593('0xc')],{'host':_0x9593('0xe'),'port':0x18eb});var socket=require(_0x9593('0xf'))(new Redis(config[_0x9593('0xc')]));require(_0x9593('0x10'))[_0x9593('0x11')](socket);function respondWithRpcPromise(_0x352b63,_0x5bea12,_0xcb6580){return new BPromise(function(_0x528339,_0x82acf9){return client[_0x9593('0x12')](_0x352b63,_0xcb6580)['then'](function(_0x4e1ae0){logger[_0x9593('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x5bea12,_0x9593('0x14'));logger[_0x9593('0x15')](_0x9593('0x16'),_0x5bea12,_0x9593('0x14'),JSON[_0x9593('0x17')](_0x4e1ae0));if(_0x4e1ae0[_0x9593('0x18')]){if(_0x4e1ae0[_0x9593('0x18')][_0x9593('0x19')]===0x1f4){logger[_0x9593('0x18')](_0x9593('0x1a'),_0x5bea12,_0x4e1ae0[_0x9593('0x18')][_0x9593('0x1b')]);return _0x82acf9(_0x4e1ae0['error'][_0x9593('0x1b')]);}logger['error'](_0x9593('0x1a'),_0x5bea12,_0x4e1ae0[_0x9593('0x18')][_0x9593('0x1b')]);return _0x528339(_0x4e1ae0['error'][_0x9593('0x1b')]);}else{logger[_0x9593('0x13')](_0x9593('0x1a'),_0x5bea12,_0x9593('0x14'));_0x528339(_0x4e1ae0[_0x9593('0x1c')]['message']);}})[_0x9593('0x1d')](function(_0x14e151){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x5bea12,_0x14e151);_0x82acf9(_0x14e151);});});}exports[_0x9593('0x1e')]=function(_0x52e3dc){var _0x5e67df=this;return new Promise(function(_0x5c7529,_0x29ddeb){return db[_0x9593('0x1f')][_0x9593('0x20')]({'raw':_0x52e3dc['options']?_0x52e3dc[_0x9593('0x21')][_0x9593('0x22')]===undefined?!![]:![]:!![],'where':_0x52e3dc[_0x9593('0x21')]?_0x52e3dc[_0x9593('0x21')][_0x9593('0x23')]||null:null,'attributes':_0x52e3dc[_0x9593('0x21')]?_0x52e3dc[_0x9593('0x21')]['attributes']||null:null,'include':_0x52e3dc[_0x9593('0x21')]?_0x52e3dc[_0x9593('0x21')][_0x9593('0x24')]?_[_0x9593('0x25')](_0x52e3dc['options']['include'],function(_0x20204d){return{'model':db[_0x20204d[_0x9593('0x26')]],'as':_0x20204d['as'],'attributes':_0x20204d[_0x9593('0x27')],'include':_0x20204d[_0x9593('0x24')]?_['map'](_0x20204d['include'],function(_0x11d403){return{'model':db[_0x11d403[_0x9593('0x26')]],'as':_0x11d403['as'],'attributes':_0x11d403[_0x9593('0x27')],'include':_0x11d403[_0x9593('0x24')]?_[_0x9593('0x25')](_0x11d403[_0x9593('0x24')],function(_0x37d243){return{'model':db[_0x37d243[_0x9593('0x26')]],'as':_0x37d243['as'],'attributes':_0x37d243[_0x9593('0x27')]};}):[]};}):[]};}):[]:[]})[_0x9593('0x28')](function(_0x2cfdb9){logger['info'](_0x9593('0x1e'),_0x52e3dc);logger[_0x9593('0x15')](_0x9593('0x1e'),_0x52e3dc,JSON[_0x9593('0x17')](_0x2cfdb9));_0x5c7529(_0x2cfdb9);})[_0x9593('0x1d')](function(_0x125c5e){logger[_0x9593('0x18')]('ShowWhatsappAccount',_0x125c5e['message'],_0x52e3dc);_0x29ddeb(_0x5e67df['error'](0x1f4,_0x125c5e[_0x9593('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 2f2d9a0..2f61a56 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 _0x5c2f=['update','emit','removeListener','register','length','./whatsappAccount.events','remove'];(function(_0x29fd0b,_0x4daeaa){var _0x4f7341=function(_0x2010b9){while(--_0x2010b9){_0x29fd0b['push'](_0x29fd0b['shift']());}};_0x4f7341(++_0x4daeaa);}(_0x5c2f,0x163));var _0xf5c2=function(_0x1d7791,_0x2a291f){_0x1d7791=_0x1d7791-0x0;var _0x2293f8=_0x5c2f[_0x1d7791];return _0x2293f8;};'use strict';var WhatsappAccountEvents=require(_0xf5c2('0x0'));var events=['save',_0xf5c2('0x1'),_0xf5c2('0x2')];function createListener(_0x20da82,_0x4ea210){return function(_0x3f446d){_0x4ea210[_0xf5c2('0x3')](_0x20da82,_0x3f446d);};}function removeListener(_0x29731f,_0xdd0c6f){return function(){WhatsappAccountEvents[_0xf5c2('0x4')](_0x29731f,_0xdd0c6f);};}exports[_0xf5c2('0x5')]=function(_0x388141){for(var _0x76789a=0x0,_0x544351=events[_0xf5c2('0x6')];_0x76789a<_0x544351;_0x76789a++){var _0x3e172b=events[_0x76789a];var _0x79e0f2=createListener('whatsappAccount:'+_0x3e172b,_0x388141);WhatsappAccountEvents['on'](_0x3e172b,_0x79e0f2);}}; \ No newline at end of file +var _0xa7a9=['removeListener','register','whatsappAccount:','save','update','emit'];(function(_0x2b6453,_0xbaeaf){var _0x3fa2dc=function(_0x5225a1){while(--_0x5225a1){_0x2b6453['push'](_0x2b6453['shift']());}};_0x3fa2dc(++_0xbaeaf);}(_0xa7a9,0x93));var _0x9a7a=function(_0x454f93,_0x2240e5){_0x454f93=_0x454f93-0x0;var _0x49a284=_0xa7a9[_0x454f93];return _0x49a284;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x9a7a('0x0'),'remove',_0x9a7a('0x1')];function createListener(_0x2bff98,_0x563bfe){return function(_0x1220aa){_0x563bfe[_0x9a7a('0x2')](_0x2bff98,_0x1220aa);};}function removeListener(_0x188420,_0x2ba89d){return function(){WhatsappAccountEvents[_0x9a7a('0x3')](_0x188420,_0x2ba89d);};}exports[_0x9a7a('0x4')]=function(_0x191d54){for(var _0x19c872=0x0,_0x3294ad=events['length'];_0x19c872<_0x3294ad;_0x19c872++){var _0x5061a1=events[_0x19c872];var _0xd08dc7=createListener(_0x9a7a('0x5')+_0x5061a1,_0x191d54);WhatsappAccountEvents['on'](_0x5061a1,_0xd08dc7);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index d7b4842..dbb30b9 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 _0x4bb3=['../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x1e0490,_0x4da27d){var _0x41e05f=function(_0x5d63aa){while(--_0x5d63aa){_0x1e0490['push'](_0x1e0490['shift']());}};_0x41e05f(++_0x4da27d);}(_0x4bb3,0x163));var _0x34bb=function(_0x38aeea,_0x57522a){_0x38aeea=_0x38aeea-0x0;var _0x5e8d2c=_0x4bb3[_0x38aeea];return _0x5e8d2c;};'use strict';var multer=require(_0x34bb('0x0'));var util=require(_0x34bb('0x1'));var path=require(_0x34bb('0x2'));var timeout=require('connect-timeout');var express=require(_0x34bb('0x3'));var router=express[_0x34bb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x34bb('0x5'));var interaction=require(_0x34bb('0x6'));var config=require(_0x34bb('0x7'));var controller=require(_0x34bb('0x8'));router[_0x34bb('0x9')]('/',auth[_0x34bb('0xa')](),controller['index']);router['get'](_0x34bb('0xb'),auth[_0x34bb('0xa')](),controller[_0x34bb('0xc')]);router[_0x34bb('0xd')]('/',auth[_0x34bb('0xa')](),controller[_0x34bb('0xe')]);router[_0x34bb('0xf')](_0x34bb('0xb'),auth[_0x34bb('0xa')](),controller[_0x34bb('0x10')]);router['delete'](_0x34bb('0xb'),auth[_0x34bb('0xa')](),controller[_0x34bb('0x11')]);module[_0x34bb('0x12')]=router; \ No newline at end of file +var _0xc5e3=['show','post','create','put','update','delete','destroy','multer','express','fs-extra','../../components/auth/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x882a6b,_0x3143fc){var _0x270031=function(_0x2e3718){while(--_0x2e3718){_0x882a6b['push'](_0x882a6b['shift']());}};_0x270031(++_0x3143fc);}(_0xc5e3,0xd3));var _0x3c5e=function(_0x18b206,_0x57e3ac){_0x18b206=_0x18b206-0x0;var _0x1bb1eb=_0xc5e3[_0x18b206];return _0x1bb1eb;};'use strict';var multer=require(_0x3c5e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3c5e('0x1'));var router=express['Router']();var fs_extra=require(_0x3c5e('0x2'));var auth=require(_0x3c5e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3c5e('0x4'));var controller=require(_0x3c5e('0x5'));router[_0x3c5e('0x6')]('/',auth[_0x3c5e('0x7')](),controller[_0x3c5e('0x8')]);router[_0x3c5e('0x6')](_0x3c5e('0x9'),auth[_0x3c5e('0x7')](),controller[_0x3c5e('0xa')]);router[_0x3c5e('0xb')]('/',auth[_0x3c5e('0x7')](),controller[_0x3c5e('0xc')]);router[_0x3c5e('0xd')](_0x3c5e('0x9'),auth[_0x3c5e('0x7')](),controller[_0x3c5e('0xe')]);router[_0x3c5e('0xf')](_0x3c5e('0x9'),auth[_0x3c5e('0x7')](),controller[_0x3c5e('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 1741ea0..42899bd 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 _0x65c0=['exports','noop','TEXT','STRING','sequelize'];(function(_0x1c7ab8,_0x121f48){var _0x31b775=function(_0x28be26){while(--_0x28be26){_0x1c7ab8['push'](_0x1c7ab8['shift']());}};_0x31b775(++_0x121f48);}(_0x65c0,0xf4));var _0x065c=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x65c0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x065c('0x0'));module[_0x065c('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x065c('0x2')},'appdata':{'type':Sequelize[_0x065c('0x3')]()},'description':{'type':Sequelize[_0x065c('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xb299=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x79b649,_0x2115b3){var _0x1af9b1=function(_0x153c9f){while(--_0x153c9f){_0x79b649['push'](_0x79b649['shift']());}};_0x1af9b1(++_0x2115b3);}(_0xb299,0xbc));var _0x9b29=function(_0x8943fb,_0x563019){_0x8943fb=_0x8943fb-0x0;var _0x2ee9a3=_0xb299[_0x8943fb];return _0x2ee9a3;};'use strict';var Sequelize=require(_0x9b29('0x0'));module[_0x9b29('0x1')]={'priority':{'type':Sequelize[_0x9b29('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9b29('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x9b29('0x4')]()},'description':{'type':Sequelize[_0x9b29('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9b29('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 2d6a908..f1b0d27 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 _0xf960=['sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','stack','name','send','map','WhatsappApplication','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','include','find','create','body','eml-format','zip-dir','request-promise','moment','mustache'];(function(_0x2e440b,_0x540f27){var _0x46e1a4=function(_0x953321){while(--_0x953321){_0x2e440b['push'](_0x2e440b['shift']());}};_0x46e1a4(++_0x540f27);}(_0xf960,0x193));var _0x0f96=function(_0x438912,_0x3f7f74){_0x438912=_0x438912-0x0;var _0x18112f=_0xf960[_0x438912];return _0x18112f;};'use strict';var emlformat=require(_0x0f96('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0f96('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f96('0x2'));var moment=require(_0x0f96('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0f96('0x4'));var util=require('util');var path=require('path');var sox=require(_0x0f96('0x5'));var csv=require(_0x0f96('0x6'));var ejs=require(_0x0f96('0x7'));var fs=require('fs');var fs_extra=require(_0x0f96('0x8'));var _=require(_0x0f96('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0f96('0xa'));var deskjs=require(_0x0f96('0xb'));var toCsv=require(_0x0f96('0x6'));var querystring=require(_0x0f96('0xc'));var Papa=require(_0x0f96('0xd'));var Redis=require(_0x0f96('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0f96('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f96('0x10'));var logger=require('../../config/logger')(_0x0f96('0x11'));var utils=require(_0x0f96('0x12'));var config=require(_0x0f96('0x13'));var licenseUtil=require(_0x0f96('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe8aee6,_0x23182a){_0x23182a=_0x23182a||0xcc;return function(_0x1c0283){if(_0x1c0283){return _0xe8aee6[_0x0f96('0x15')](_0x23182a);}return _0xe8aee6['status'](_0x23182a)[_0x0f96('0x16')]();};}function respondWithResult(_0x103185,_0x36d1ca){_0x36d1ca=_0x36d1ca||0xc8;return function(_0x386943){if(_0x386943){return _0x103185[_0x0f96('0x17')](_0x36d1ca)[_0x0f96('0x18')](_0x386943);}};}function respondWithFilteredResult(_0x5080c3,_0x232d94){return function(_0x47ba05){if(_0x47ba05){var _0x4f55cf=typeof _0x232d94[_0x0f96('0x19')]===_0x0f96('0x1a')&&typeof _0x232d94[_0x0f96('0x1b')]===_0x0f96('0x1a');var _0x3f1273=_0x47ba05[_0x0f96('0x1c')];var _0x2dc06c=_0x4f55cf?0x0:_0x232d94[_0x0f96('0x19')];var _0x36ded7=_0x4f55cf?_0x47ba05[_0x0f96('0x1c')]:_0x232d94[_0x0f96('0x19')]+_0x232d94[_0x0f96('0x1b')];var _0x173f3c;if(_0x36ded7>=_0x3f1273){_0x36ded7=_0x3f1273;_0x173f3c=0xc8;}else{_0x173f3c=0xce;}_0x5080c3[_0x0f96('0x17')](_0x173f3c);return _0x5080c3['set'](_0x0f96('0x1d'),_0x2dc06c+'-'+_0x36ded7+'/'+_0x3f1273)[_0x0f96('0x18')](_0x47ba05);}return null;};}function patchUpdates(_0x125b50){return function(_0xea96e0){try{jsonpatch['apply'](_0xea96e0,_0x125b50,!![]);}catch(_0x210a93){return BPromise[_0x0f96('0x1e')](_0x210a93);}return _0xea96e0[_0x0f96('0x1f')]();};}function saveUpdates(_0x47993c,_0x25494f){return function(_0x201226){if(_0x201226){return _0x201226['update'](_0x47993c)[_0x0f96('0x20')](function(_0x142de1){return _0x142de1;});}return null;};}function removeEntity(_0x366146,_0x21bd49){return function(_0x4b3d9f){if(_0x4b3d9f){return _0x4b3d9f[_0x0f96('0x21')]()[_0x0f96('0x20')](function(){_0x366146[_0x0f96('0x17')](0xcc)[_0x0f96('0x16')]();});}};}function handleEntityNotFound(_0x262353,_0x34676c){return function(_0x3cfca7){if(!_0x3cfca7){_0x262353['sendStatus'](0x194);}return _0x3cfca7;};}function handleError(_0x248b45,_0x3a7c7b){_0x3a7c7b=_0x3a7c7b||0x1f4;return function(_0x31e9e6){logger['error'](_0x31e9e6[_0x0f96('0x22')]);if(_0x31e9e6[_0x0f96('0x23')]){delete _0x31e9e6[_0x0f96('0x23')];}_0x248b45[_0x0f96('0x17')](_0x3a7c7b)[_0x0f96('0x24')](_0x31e9e6);};}exports['index']=function(_0x2961e1,_0x254683){var _0x3489bc={},_0x219757={},_0xcb71bd={'count':0x0,'rows':[]};var _0x1f9f2c=_[_0x0f96('0x25')](db[_0x0f96('0x26')][_0x0f96('0x27')],function(_0x163f5f){return{'name':_0x163f5f['fieldName'],'type':_0x163f5f[_0x0f96('0x28')][_0x0f96('0x29')]};});_0x219757['model']=_[_0x0f96('0x25')](_0x1f9f2c,_0x0f96('0x23'));_0x219757['query']=_[_0x0f96('0x2a')](_0x2961e1[_0x0f96('0x2b')]);_0x219757[_0x0f96('0x2c')]=_[_0x0f96('0x2d')](_0x219757[_0x0f96('0x2e')],_0x219757[_0x0f96('0x2b')]);_0x3489bc[_0x0f96('0x2f')]=_['intersection'](_0x219757['model'],qs[_0x0f96('0x30')](_0x2961e1['query']['fields']));_0x3489bc['attributes']=_0x3489bc[_0x0f96('0x2f')][_0x0f96('0x31')]?_0x3489bc[_0x0f96('0x2f')]:_0x219757['model'];if(!_0x2961e1[_0x0f96('0x2b')][_0x0f96('0x32')](_0x0f96('0x33'))){_0x3489bc[_0x0f96('0x1b')]=qs[_0x0f96('0x1b')](_0x2961e1[_0x0f96('0x2b')][_0x0f96('0x1b')]);_0x3489bc[_0x0f96('0x19')]=qs['offset'](_0x2961e1[_0x0f96('0x2b')]['offset']);}_0x3489bc[_0x0f96('0x34')]=qs[_0x0f96('0x35')](_0x2961e1[_0x0f96('0x2b')][_0x0f96('0x35')]);_0x3489bc[_0x0f96('0x36')]=qs[_0x0f96('0x2c')](_[_0x0f96('0x37')](_0x2961e1['query'],_0x219757['filters']),_0x1f9f2c);if(_0x2961e1[_0x0f96('0x2b')][_0x0f96('0x38')]){_0x3489bc[_0x0f96('0x36')]=_[_0x0f96('0x39')](_0x3489bc['where'],{'$or':_[_0x0f96('0x25')](_0x1f9f2c,function(_0x2c14af){if(_0x2c14af[_0x0f96('0x28')]!==_0x0f96('0x3a')){var _0x1a880e={};_0x1a880e[_0x2c14af[_0x0f96('0x23')]]={'$like':'%'+_0x2961e1[_0x0f96('0x2b')][_0x0f96('0x38')]+'%'};return _0x1a880e;}})});}_0x3489bc=_[_0x0f96('0x39')]({},_0x3489bc,_0x2961e1['options']);var _0xa58381={'where':_0x3489bc[_0x0f96('0x36')]};return db['WhatsappApplication'][_0x0f96('0x1c')](_0xa58381)[_0x0f96('0x20')](function(_0x35eb62){_0xcb71bd['count']=_0x35eb62;if(_0x2961e1[_0x0f96('0x2b')][_0x0f96('0x3b')]){_0x3489bc['include']=[{'all':!![]}];}return db[_0x0f96('0x26')][_0x0f96('0x3c')](_0x3489bc);})['then'](function(_0x24a4d9){_0xcb71bd['rows']=_0x24a4d9;return _0xcb71bd;})['then'](respondWithFilteredResult(_0x254683,_0x3489bc))[_0x0f96('0x3d')](handleError(_0x254683,null));};exports[_0x0f96('0x3e')]=function(_0x29de3d,_0x231be2){var _0x261452={'raw':!![],'where':{'id':_0x29de3d[_0x0f96('0x3f')]['id']}},_0x1e6b76={};_0x1e6b76[_0x0f96('0x2e')]=_['keys'](db['WhatsappApplication'][_0x0f96('0x27')]);_0x1e6b76['query']=_[_0x0f96('0x2a')](_0x29de3d[_0x0f96('0x2b')]);_0x1e6b76[_0x0f96('0x2c')]=_[_0x0f96('0x2d')](_0x1e6b76[_0x0f96('0x2e')],_0x1e6b76[_0x0f96('0x2b')]);_0x261452[_0x0f96('0x2f')]=_['intersection'](_0x1e6b76[_0x0f96('0x2e')],qs[_0x0f96('0x30')](_0x29de3d[_0x0f96('0x2b')][_0x0f96('0x30')]));_0x261452[_0x0f96('0x2f')]=_0x261452[_0x0f96('0x2f')][_0x0f96('0x31')]?_0x261452[_0x0f96('0x2f')]:_0x1e6b76[_0x0f96('0x2e')];if(_0x29de3d[_0x0f96('0x2b')][_0x0f96('0x3b')]){_0x261452[_0x0f96('0x40')]=[{'all':!![]}];}_0x261452=_['merge']({},_0x261452,_0x29de3d['options']);return db[_0x0f96('0x26')][_0x0f96('0x41')](_0x261452)[_0x0f96('0x20')](handleEntityNotFound(_0x231be2,null))['then'](respondWithResult(_0x231be2,null))[_0x0f96('0x3d')](handleError(_0x231be2,null));};exports[_0x0f96('0x42')]=function(_0x26ae06,_0x2d363b){return db[_0x0f96('0x26')]['create'](_0x26ae06[_0x0f96('0x43')],{})[_0x0f96('0x20')](respondWithResult(_0x2d363b,0xc9))['catch'](handleError(_0x2d363b,null));};exports['update']=function(_0x26a29a,_0x3fce0c){if(_0x26a29a[_0x0f96('0x43')]['id']){delete _0x26a29a[_0x0f96('0x43')]['id'];}return db[_0x0f96('0x26')]['find']({'where':{'id':_0x26a29a[_0x0f96('0x3f')]['id']}})[_0x0f96('0x20')](handleEntityNotFound(_0x3fce0c,null))[_0x0f96('0x20')](saveUpdates(_0x26a29a[_0x0f96('0x43')],null))[_0x0f96('0x20')](respondWithResult(_0x3fce0c,null))[_0x0f96('0x3d')](handleError(_0x3fce0c,null));};exports[_0x0f96('0x21')]=function(_0xc61a62,_0x52321e){return db[_0x0f96('0x26')]['find']({'where':{'id':_0xc61a62[_0x0f96('0x3f')]['id']}})[_0x0f96('0x20')](handleEntityNotFound(_0x52321e,null))[_0x0f96('0x20')](removeEntity(_0x52321e,null))[_0x0f96('0x3d')](handleError(_0x52321e,null));}; \ No newline at end of file +var _0xd663=['apply','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','create','body','find','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x743fd6,_0x41ddbf){var _0x49a5d9=function(_0x17267b){while(--_0x17267b){_0x743fd6['push'](_0x743fd6['shift']());}};_0x49a5d9(++_0x41ddbf);}(_0xd663,0x1ed));var _0x3d66=function(_0x5abd15,_0x14421b){_0x5abd15=_0x5abd15-0x0;var _0x2ccfe8=_0xd663[_0x5abd15];return _0x2ccfe8;};'use strict';var emlformat=require(_0x3d66('0x0'));var rimraf=require(_0x3d66('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3d66('0x2'));var rp=require(_0x3d66('0x3'));var moment=require(_0x3d66('0x4'));var BPromise=require(_0x3d66('0x5'));var Mustache=require(_0x3d66('0x6'));var util=require('util');var path=require(_0x3d66('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3d66('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3d66('0x9'));var deskjs=require(_0x3d66('0xa'));var toCsv=require(_0x3d66('0xb'));var querystring=require(_0x3d66('0xc'));var Papa=require(_0x3d66('0xd'));var Redis=require(_0x3d66('0xe'));var authService=require(_0x3d66('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3d66('0x10'));var hardwareService=require(_0x3d66('0x11'));var logger=require(_0x3d66('0x12'))('api');var utils=require(_0x3d66('0x13'));var config=require(_0x3d66('0x14'));var licenseUtil=require(_0x3d66('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x207712,_0x223de6){_0x223de6=_0x223de6||0xcc;return function(_0x288693){if(_0x288693){return _0x207712[_0x3d66('0x16')](_0x223de6);}return _0x207712['status'](_0x223de6)[_0x3d66('0x17')]();};}function respondWithResult(_0x5a940c,_0x15bba0){_0x15bba0=_0x15bba0||0xc8;return function(_0x290f29){if(_0x290f29){return _0x5a940c[_0x3d66('0x18')](_0x15bba0)[_0x3d66('0x19')](_0x290f29);}};}function respondWithFilteredResult(_0x30260d,_0x153b88){return function(_0x5628ae){if(_0x5628ae){var _0x5eba7e=typeof _0x153b88[_0x3d66('0x1a')]===_0x3d66('0x1b')&&typeof _0x153b88['limit']===_0x3d66('0x1b');var _0x24d137=_0x5628ae[_0x3d66('0x1c')];var _0x1dfd81=_0x5eba7e?0x0:_0x153b88[_0x3d66('0x1a')];var _0x239ffb=_0x5eba7e?_0x5628ae[_0x3d66('0x1c')]:_0x153b88[_0x3d66('0x1a')]+_0x153b88[_0x3d66('0x1d')];var _0x3902f1;if(_0x239ffb>=_0x24d137){_0x239ffb=_0x24d137;_0x3902f1=0xc8;}else{_0x3902f1=0xce;}_0x30260d[_0x3d66('0x18')](_0x3902f1);return _0x30260d[_0x3d66('0x1e')](_0x3d66('0x1f'),_0x1dfd81+'-'+_0x239ffb+'/'+_0x24d137)[_0x3d66('0x19')](_0x5628ae);}return null;};}function patchUpdates(_0x21cfd7){return function(_0x4c61ee){try{jsonpatch[_0x3d66('0x20')](_0x4c61ee,_0x21cfd7,!![]);}catch(_0x5e1516){return BPromise[_0x3d66('0x21')](_0x5e1516);}return _0x4c61ee[_0x3d66('0x22')]();};}function saveUpdates(_0x4486f5,_0x37ed73){return function(_0x11be7f){if(_0x11be7f){return _0x11be7f[_0x3d66('0x23')](_0x4486f5)[_0x3d66('0x24')](function(_0x1bfa81){return _0x1bfa81;});}return null;};}function removeEntity(_0x1eb922,_0x4e2c42){return function(_0x151364){if(_0x151364){return _0x151364[_0x3d66('0x25')]()[_0x3d66('0x24')](function(){_0x1eb922[_0x3d66('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59fe0a,_0x45628b){return function(_0x4302ad){if(!_0x4302ad){_0x59fe0a[_0x3d66('0x16')](0x194);}return _0x4302ad;};}function handleError(_0x4f0d9e,_0x402c4c){_0x402c4c=_0x402c4c||0x1f4;return function(_0x3e6712){logger[_0x3d66('0x26')](_0x3e6712[_0x3d66('0x27')]);if(_0x3e6712[_0x3d66('0x28')]){delete _0x3e6712[_0x3d66('0x28')];}_0x4f0d9e[_0x3d66('0x18')](_0x402c4c)[_0x3d66('0x29')](_0x3e6712);};}exports[_0x3d66('0x2a')]=function(_0x1271bf,_0x54ba13){var _0x28466b={},_0x1dff3b={},_0x197c5e={'count':0x0,'rows':[]};var _0xc128a7=_[_0x3d66('0x2b')](db[_0x3d66('0x2c')][_0x3d66('0x2d')],function(_0xabe382){return{'name':_0xabe382[_0x3d66('0x2e')],'type':_0xabe382[_0x3d66('0x2f')][_0x3d66('0x30')]};});_0x1dff3b['model']=_['map'](_0xc128a7,_0x3d66('0x28'));_0x1dff3b[_0x3d66('0x31')]=_[_0x3d66('0x32')](_0x1271bf[_0x3d66('0x31')]);_0x1dff3b[_0x3d66('0x33')]=_[_0x3d66('0x34')](_0x1dff3b[_0x3d66('0x35')],_0x1dff3b[_0x3d66('0x31')]);_0x28466b[_0x3d66('0x36')]=_[_0x3d66('0x34')](_0x1dff3b[_0x3d66('0x35')],qs[_0x3d66('0x37')](_0x1271bf[_0x3d66('0x31')][_0x3d66('0x37')]));_0x28466b[_0x3d66('0x36')]=_0x28466b[_0x3d66('0x36')][_0x3d66('0x38')]?_0x28466b[_0x3d66('0x36')]:_0x1dff3b[_0x3d66('0x35')];if(!_0x1271bf[_0x3d66('0x31')][_0x3d66('0x39')](_0x3d66('0x3a'))){_0x28466b[_0x3d66('0x1d')]=qs['limit'](_0x1271bf[_0x3d66('0x31')][_0x3d66('0x1d')]);_0x28466b[_0x3d66('0x1a')]=qs['offset'](_0x1271bf[_0x3d66('0x31')]['offset']);}_0x28466b[_0x3d66('0x3b')]=qs[_0x3d66('0x3c')](_0x1271bf['query'][_0x3d66('0x3c')]);_0x28466b[_0x3d66('0x3d')]=qs['filters'](_[_0x3d66('0x3e')](_0x1271bf[_0x3d66('0x31')],_0x1dff3b['filters']),_0xc128a7);if(_0x1271bf[_0x3d66('0x31')][_0x3d66('0x3f')]){_0x28466b[_0x3d66('0x3d')]=_[_0x3d66('0x40')](_0x28466b['where'],{'$or':_[_0x3d66('0x2b')](_0xc128a7,function(_0x58851d){if(_0x58851d[_0x3d66('0x2f')]!=='VIRTUAL'){var _0xc77eb5={};_0xc77eb5[_0x58851d[_0x3d66('0x28')]]={'$like':'%'+_0x1271bf[_0x3d66('0x31')]['filter']+'%'};return _0xc77eb5;}})});}_0x28466b=_[_0x3d66('0x40')]({},_0x28466b,_0x1271bf[_0x3d66('0x41')]);var _0x105726={'where':_0x28466b[_0x3d66('0x3d')]};return db[_0x3d66('0x2c')][_0x3d66('0x1c')](_0x105726)[_0x3d66('0x24')](function(_0x38633f){_0x197c5e[_0x3d66('0x1c')]=_0x38633f;if(_0x1271bf[_0x3d66('0x31')][_0x3d66('0x42')]){_0x28466b[_0x3d66('0x43')]=[{'all':!![]}];}return db[_0x3d66('0x2c')]['findAll'](_0x28466b);})[_0x3d66('0x24')](function(_0x4482a3){_0x197c5e[_0x3d66('0x44')]=_0x4482a3;return _0x197c5e;})['then'](respondWithFilteredResult(_0x54ba13,_0x28466b))['catch'](handleError(_0x54ba13,null));};exports[_0x3d66('0x45')]=function(_0x263e9f,_0x3deb7d){var _0x26350b={'raw':!![],'where':{'id':_0x263e9f[_0x3d66('0x46')]['id']}},_0x283395={};_0x283395[_0x3d66('0x35')]=_[_0x3d66('0x32')](db['WhatsappApplication'][_0x3d66('0x2d')]);_0x283395[_0x3d66('0x31')]=_[_0x3d66('0x32')](_0x263e9f['query']);_0x283395['filters']=_[_0x3d66('0x34')](_0x283395[_0x3d66('0x35')],_0x283395[_0x3d66('0x31')]);_0x26350b[_0x3d66('0x36')]=_[_0x3d66('0x34')](_0x283395[_0x3d66('0x35')],qs[_0x3d66('0x37')](_0x263e9f[_0x3d66('0x31')]['fields']));_0x26350b[_0x3d66('0x36')]=_0x26350b['attributes'][_0x3d66('0x38')]?_0x26350b[_0x3d66('0x36')]:_0x283395[_0x3d66('0x35')];if(_0x263e9f['query'][_0x3d66('0x42')]){_0x26350b[_0x3d66('0x43')]=[{'all':!![]}];}_0x26350b=_[_0x3d66('0x40')]({},_0x26350b,_0x263e9f[_0x3d66('0x41')]);return db['WhatsappApplication']['find'](_0x26350b)[_0x3d66('0x24')](handleEntityNotFound(_0x3deb7d,null))['then'](respondWithResult(_0x3deb7d,null))['catch'](handleError(_0x3deb7d,null));};exports[_0x3d66('0x47')]=function(_0x3c5b6d,_0x32edc2){return db[_0x3d66('0x2c')][_0x3d66('0x47')](_0x3c5b6d[_0x3d66('0x48')],{})[_0x3d66('0x24')](respondWithResult(_0x32edc2,0xc9))['catch'](handleError(_0x32edc2,null));};exports[_0x3d66('0x23')]=function(_0x2e05ce,_0x22c447){if(_0x2e05ce[_0x3d66('0x48')]['id']){delete _0x2e05ce[_0x3d66('0x48')]['id'];}return db['WhatsappApplication'][_0x3d66('0x49')]({'where':{'id':_0x2e05ce[_0x3d66('0x46')]['id']}})[_0x3d66('0x24')](handleEntityNotFound(_0x22c447,null))[_0x3d66('0x24')](saveUpdates(_0x2e05ce[_0x3d66('0x48')],null))[_0x3d66('0x24')](respondWithResult(_0x22c447,null))[_0x3d66('0x4a')](handleError(_0x22c447,null));};exports['destroy']=function(_0x4a6c1c,_0x505abb){return db[_0x3d66('0x2c')][_0x3d66('0x49')]({'where':{'id':_0x4a6c1c['params']['id']}})[_0x3d66('0x24')](handleEntityNotFound(_0x505abb,null))[_0x3d66('0x24')](removeEntity(_0x505abb,null))[_0x3d66('0x4a')](handleError(_0x505abb,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 00566ec..46ef7f5 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 _0xd6ce=['bluebird','request-promise','path','./whatsappApplication.attributes','exports','whatsapp_applications','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xd6ce,0x127));var _0xed6c=function(_0xd2480,_0x12fb87){_0xd2480=_0xd2480-0x0;var _0x40102c=_0xd6ce[_0xd2480];return _0x40102c;};'use strict';var _=require(_0xed6c('0x0'));var util=require(_0xed6c('0x1'));var logger=require(_0xed6c('0x2'))(_0xed6c('0x3'));var moment=require(_0xed6c('0x4'));var BPromise=require(_0xed6c('0x5'));var rp=require(_0xed6c('0x6'));var fs=require('fs');var path=require(_0xed6c('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xed6c('0x8'));module[_0xed6c('0x9')]=function(_0x1a6d96,_0x1d0912){return _0x1a6d96['define']('WhatsappApplication',attributes,{'tableName':_0xed6c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xed6c('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0207=['whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','define','WhatsappApplication'];(function(_0x56c75d,_0xe66b5e){var _0x3cbd1e=function(_0x2b150a){while(--_0x2b150a){_0x56c75d['push'](_0x56c75d['shift']());}};_0x3cbd1e(++_0xe66b5e);}(_0x0207,0x162));var _0x7020=function(_0x25594a,_0x186137){_0x25594a=_0x25594a-0x0;var _0x185b3a=_0x0207[_0x25594a];return _0x185b3a;};'use strict';var _=require('lodash');var util=require(_0x7020('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x7020('0x1'));var BPromise=require(_0x7020('0x2'));var rp=require(_0x7020('0x3'));var fs=require('fs');var path=require(_0x7020('0x4'));var rimraf=require(_0x7020('0x5'));var config=require(_0x7020('0x6'));var attributes=require(_0x7020('0x7'));module['exports']=function(_0x5074d7,_0x38c320){return _0x5074d7[_0x7020('0x8')](_0x7020('0x9'),attributes,{'tableName':_0x7020('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7020('0xb'),'collate':_0x7020('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index d5b2271..63518cf 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 _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x2ec20d,_0x1c633e){var _0x44adcd=function(_0x6ad618){while(--_0x6ad618){_0x2ec20d['push'](_0x2ec20d['shift']());}};_0x44adcd(++_0x1c633e);}(_0x54ef,0x112));var _0xf54e=function(_0x53156a,_0x39b23a){_0x53156a=_0x53156a-0x0;var _0x102f37=_0x54ef[_0x53156a];return _0x102f37;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});} \ No newline at end of file +var _0x9bde=['code','message','WhatsappApplication,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x534dcb,_0x487934){var _0x2c7fa0=function(_0x460d77){while(--_0x460d77){_0x534dcb['push'](_0x534dcb['shift']());}};_0x2c7fa0(++_0x487934);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4200d6,_0x59f3ae){_0x4200d6=_0x4200d6-0x0;var _0x4fce2d=_0x9bde[_0x4200d6];return _0x4fce2d;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index e09f905..3ba31e2 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 _0x723e=['../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','/:id/tags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5ac33d,_0x449a74){var _0x527871=function(_0x4c39a0){while(--_0x4c39a0){_0x5ac33d['push'](_0x5ac33d['shift']());}};_0x527871(++_0x449a74);}(_0x723e,0x179));var _0xe723=function(_0x4e7c1c,_0x56eafd){_0x4e7c1c=_0x4e7c1c-0x0;var _0x47adb2=_0x723e[_0x4e7c1c];return _0x47adb2;};'use strict';var multer=require('multer');var util=require(_0xe723('0x0'));var path=require(_0xe723('0x1'));var timeout=require(_0xe723('0x2'));var express=require(_0xe723('0x3'));var router=express[_0xe723('0x4')]();var fs_extra=require(_0xe723('0x5'));var auth=require(_0xe723('0x6'));var interaction=require(_0xe723('0x7'));var config=require(_0xe723('0x8'));var controller=require(_0xe723('0x9'));router['get']('/',auth[_0xe723('0xa')](),controller[_0xe723('0xb')]);router[_0xe723('0xc')](_0xe723('0xd'),auth[_0xe723('0xa')](),controller[_0xe723('0xe')]);router[_0xe723('0xc')](_0xe723('0xf'),auth['isAuthenticated'](),controller[_0xe723('0x10')]);router[_0xe723('0xc')](_0xe723('0x11'),auth['isAuthenticated'](),controller[_0xe723('0x12')]);router[_0xe723('0xc')](_0xe723('0x13'),auth['isAuthenticated'](),controller[_0xe723('0x14')]);router[_0xe723('0x15')]('/',auth[_0xe723('0xa')](),controller[_0xe723('0x16')]);router[_0xe723('0x15')]('/:id/messages',auth[_0xe723('0xa')](),controller['addMessage']);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0xe723('0x17')](_0xe723('0x18'),_0xe723('0x19')),controller[_0xe723('0x1a')]);router[_0xe723('0x1b')]('/:id',auth[_0xe723('0xa')](),interaction[_0xe723('0x17')](_0xe723('0x18'),_0xe723('0x1c')),controller[_0xe723('0x1d')]);router[_0xe723('0x1e')](_0xe723('0xf'),auth[_0xe723('0xa')](),interaction[_0xe723('0x17')](_0xe723('0x18'),_0xe723('0x1f')),controller[_0xe723('0x20')]);router[_0xe723('0x1e')](_0xe723('0x21'),auth['isAuthenticated'](),controller['removeTags']);module[_0xe723('0x22')]=router; \ No newline at end of file +var _0xa498=['put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','whatsapp','addTags'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xa498,0x1d6));var _0x8a49=function(_0x2caaef,_0x3c19ed){_0x2caaef=_0x2caaef-0x0;var _0xd011f8=_0xa498[_0x2caaef];return _0xd011f8;};'use strict';var multer=require('multer');var util=require(_0x8a49('0x0'));var path=require(_0x8a49('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8a49('0x2')]();var fs_extra=require(_0x8a49('0x3'));var auth=require(_0x8a49('0x4'));var interaction=require(_0x8a49('0x5'));var config=require(_0x8a49('0x6'));var controller=require('./whatsappInteraction.controller');router[_0x8a49('0x7')]('/',auth['isAuthenticated'](),controller[_0x8a49('0x8')]);router[_0x8a49('0x7')](_0x8a49('0x9'),auth['isAuthenticated'](),controller[_0x8a49('0xa')]);router[_0x8a49('0x7')](_0x8a49('0xb'),auth[_0x8a49('0xc')](),controller[_0x8a49('0xd')]);router[_0x8a49('0x7')]('/:id/messages',auth[_0x8a49('0xc')](),controller[_0x8a49('0xe')]);router[_0x8a49('0x7')](_0x8a49('0xf'),auth[_0x8a49('0xc')](),controller[_0x8a49('0x10')]);router[_0x8a49('0x11')]('/',auth[_0x8a49('0xc')](),controller[_0x8a49('0x12')]);router['post'](_0x8a49('0x13'),auth[_0x8a49('0xc')](),controller[_0x8a49('0x14')]);router['post'](_0x8a49('0x15'),auth['isAuthenticated'](),interaction[_0x8a49('0x16')](_0x8a49('0x17'),'whatsappinteraction:addtags'),controller[_0x8a49('0x18')]);router[_0x8a49('0x19')](_0x8a49('0xb'),auth[_0x8a49('0xc')](),interaction['tracked']('whatsapp',_0x8a49('0x1a')),controller[_0x8a49('0x1b')]);router[_0x8a49('0x1c')](_0x8a49('0xb'),auth['isAuthenticated'](),interaction[_0x8a49('0x16')](_0x8a49('0x17'),_0x8a49('0x1d')),controller[_0x8a49('0x1e')]);router[_0x8a49('0x1c')]('/:id/tags',auth['isAuthenticated'](),controller[_0x8a49('0x1f')]);module[_0x8a49('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 92bb2df..41cbc2f 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 _0x80c3=['BOOLEAN','STRING','ENUM','out','sequelize'];(function(_0x15e23b,_0x3e3ee1){var _0x18f6a3=function(_0x59fb71){while(--_0x59fb71){_0x15e23b['push'](_0x15e23b['shift']());}};_0x18f6a3(++_0x3e3ee1);}(_0x80c3,0x18f));var _0x380c=function(_0x148c09,_0x4fd39f){_0x148c09=_0x148c09-0x0;var _0x18e613=_0x80c3[_0x148c09];return _0x18e613;};'use strict';var Sequelize=require(_0x380c('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0x380c('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x380c('0x2')]},'secondDisposition':{'type':Sequelize[_0x380c('0x2')]},'thirdDisposition':{'type':Sequelize[_0x380c('0x2')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x380c('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x380c('0x3')]('in',_0x380c('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x380c('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x1b20=['DATE','ENUM','out','BOOLEAN','moment','exports','STRING'];(function(_0x4d2c22,_0x2038de){var _0x4a8b0d=function(_0x19d3ff){while(--_0x19d3ff){_0x4d2c22['push'](_0x4d2c22['shift']());}};_0x4a8b0d(++_0x2038de);}(_0x1b20,0x66));var _0x01b2=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1b20[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x01b2('0x0'));module[_0x01b2('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x01b2('0x2')]},'secondDisposition':{'type':Sequelize[_0x01b2('0x2')]},'thirdDisposition':{'type':Sequelize[_0x01b2('0x2')]},'note':{'type':Sequelize[_0x01b2('0x2')]},'phone':{'type':Sequelize[_0x01b2('0x2')]},'read1stAt':{'type':Sequelize[_0x01b2('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x01b2('0x4')]('in',_0x01b2('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x01b2('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x01b2('0x4')]('in',_0x01b2('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x01b2('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 87bdf2d..563b2a6 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 _0x72fa=['i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','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)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','agent','sequelize','keyBy','merge','Account.key','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.*','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','intersection','includeAll','include','options','create','params','describe','addMessage','omit','ids','getMessages','WhatsappMessage','hasOwnProperty','nolimit','pick','format','addTags','setTags','spread','findAll','emit','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','CmContact','firstName','Attachment','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','N.A.','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','basename','createReadStream','createWriteStream','out','System','lastName','renderFile','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappInteraction.socket','register','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','talking','answered','total','UserId','waiting','closed','index','WhatsappInteraction','rawAttributes','fieldName','type','key','keys','query','model','attributes','fields','length','sort','where','filters','select','field','color','from','tools_tags','u.fullname','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','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','end','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','compact','isEmpty','WhatsappAccountId','concat','createdAt','$gte','$lte'];(function(_0x323913,_0xe010e){var _0x59968c=function(_0x934293){while(--_0x934293){_0x323913['push'](_0x323913['shift']());}};_0x59968c(++_0xe010e);}(_0x72fa,0x78));var _0xa72f=function(_0x34f701,_0x37e407){_0x34f701=_0x34f701-0x0;var _0x3e2429=_0x72fa[_0x34f701];return _0x3e2429;};'use strict';var emlformat=require(_0xa72f('0x0'));var rimraf=require(_0xa72f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa72f('0x2'));var rp=require(_0xa72f('0x3'));var moment=require(_0xa72f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa72f('0x5'));var path=require(_0xa72f('0x6'));var sox=require(_0xa72f('0x7'));var csv=require(_0xa72f('0x8'));var ejs=require(_0xa72f('0x9'));var fs=require('fs');var fs_extra=require(_0xa72f('0xa'));var _=require(_0xa72f('0xb'));var squel=require(_0xa72f('0xc'));var crypto=require(_0xa72f('0xd'));var jsforce=require(_0xa72f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa72f('0x8'));var querystring=require(_0xa72f('0xf'));var Papa=require(_0xa72f('0x10'));var Redis=require('ioredis');var authService=require(_0xa72f('0x11'));var qs=require(_0xa72f('0x12'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xa72f('0x13'));var hardwareService=require(_0xa72f('0x14'));var logger=require(_0xa72f('0x15'))(_0xa72f('0x16'));var utils=require(_0xa72f('0x17'));var config=require(_0xa72f('0x18'));var licenseUtil=require(_0xa72f('0x19'));var db=require(_0xa72f('0x1a'))['db'];config[_0xa72f('0x1b')]=_[_0xa72f('0x1c')](config[_0xa72f('0x1b')],{'host':_0xa72f('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa72f('0x1b')]));require(_0xa72f('0x1e'))[_0xa72f('0x1f')](socket);function respondWithStatusCode(_0x50dc77,_0x28ce28){_0x28ce28=_0x28ce28||0xcc;return function(_0x5aeda8){if(_0x5aeda8){return _0x50dc77[_0xa72f('0x20')](_0x28ce28);}return _0x50dc77[_0xa72f('0x21')](_0x28ce28)['end']();};}function respondWithResult(_0x3a50cc,_0x23b1ec){_0x23b1ec=_0x23b1ec||0xc8;return function(_0x461119){if(_0x461119){return _0x3a50cc[_0xa72f('0x21')](_0x23b1ec)['json'](_0x461119);}};}function respondWithFilteredResult(_0x2e8d21,_0x79d7a){return function(_0x425e89){if(_0x425e89){var _0x303faa=typeof _0x79d7a['offset']===_0xa72f('0x22')&&typeof _0x79d7a[_0xa72f('0x23')]===_0xa72f('0x22');var _0x236a62=_0x425e89[_0xa72f('0x24')];var _0x29b16b=_0x303faa?0x0:_0x79d7a['offset'];var _0x2ec121=_0x303faa?_0x425e89['count']:_0x79d7a[_0xa72f('0x25')]+_0x79d7a[_0xa72f('0x23')];var _0x5c1270;if(_0x2ec121>=_0x236a62){_0x2ec121=_0x236a62;_0x5c1270=0xc8;}else{_0x5c1270=0xce;}_0x2e8d21[_0xa72f('0x21')](_0x5c1270);return _0x2e8d21[_0xa72f('0x26')](_0xa72f('0x27'),_0x29b16b+'-'+_0x2ec121+'/'+_0x236a62)[_0xa72f('0x28')](_0x425e89);}return null;};}function patchUpdates(_0x40d031){return function(_0x19f8f4){try{jsonpatch[_0xa72f('0x29')](_0x19f8f4,_0x40d031,!![]);}catch(_0x276123){return BPromise[_0xa72f('0x2a')](_0x276123);}return _0x19f8f4[_0xa72f('0x2b')]();};}function saveUpdates(_0x5bad19,_0x35aecd){return function(_0xf99de8){if(_0xf99de8){return _0xf99de8[_0xa72f('0x2c')](_0x5bad19)[_0xa72f('0x2d')](function(_0x2aee79){return _0x2aee79;});}return null;};}function removeEntity(_0x5a3685,_0x38d8f9){return function(_0x1974ea){if(_0x1974ea){return _0x1974ea[_0xa72f('0x2e')]()[_0xa72f('0x2d')](function(){_0x5a3685['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4596cb,_0x51e4e4){return function(_0x21f4d9){if(!_0x21f4d9){_0x4596cb[_0xa72f('0x20')](0x194);}return _0x21f4d9;};}function handleError(_0x3e03bc,_0x224d1a){_0x224d1a=_0x224d1a||0x1f4;return function(_0xc99fec){logger['error'](_0xc99fec[_0xa72f('0x2f')]);if(_0xc99fec[_0xa72f('0x30')]){delete _0xc99fec[_0xa72f('0x30')];}_0x3e03bc[_0xa72f('0x21')](_0x224d1a)['send'](_0xc99fec);};}function getInteractionUsers(_0x26aa28,_0x3843f6){return new BPromise(function(_0x4c1eff,_0x2cd213){try{if(_0x3843f6[_0x26aa28['id']]){_0x26aa28[_0xa72f('0x31')]=_[_0xa72f('0x32')](_0x3843f6[_0x26aa28['id']],function(_0x4e677f){return{'id':_0x4e677f['id'],'fullname':_0x4e677f[_0xa72f('0x33')]};});}}catch(_0x548c9a){_0x2cd213(_0x548c9a);}_0x4c1eff(_0x26aa28);});}function getInteractionTags(_0x1e2a12,_0x58e29b){return new BPromise(function(_0x142dfd,_0x4e4961){try{if(_0x1e2a12[_0xa72f('0x34')]){_0x1e2a12[_0xa72f('0x35')]=[];_0x1e2a12[_0xa72f('0x34')][_0xa72f('0x36')](',')[_0xa72f('0x37')](function(_0x56e327){_0x1e2a12[_0xa72f('0x35')][_0xa72f('0x38')](_0x58e29b[_0x56e327]);});}delete _0x1e2a12[_0xa72f('0x34')];}catch(_0x1613de){_0x4e4961(_0x1613de);}_0x142dfd(_0x1e2a12);});}function updateWhatsappInteraction(_0x216c49,_0xb360bc,_0x37b036){return new BPromise(function(_0x46f18c,_0x33ba2e){return getInteractionUsers(_0x216c49,_0x37b036)[_0xa72f('0x2d')](function(_0x316b10){return getInteractionTags(_0x316b10,_0xb360bc);})['then'](function(_0x5ef6a7){return getStateInteraction(_0x5ef6a7);})[_0xa72f('0x2d')](function(_0x465c81){_0x46f18c(_0x465c81);})[_0xa72f('0x39')](function(_0x6fb77e){_0x33ba2e(_0x6fb77e);});});}function getStateInteraction(_0x1bb9bc){return new BPromise(function(_0xeba90b){_0x1bb9bc['waiting']=0x0;_0x1bb9bc[_0xa72f('0x3a')]=0x0;_0x1bb9bc[_0xa72f('0x3b')]=0x0;_0x1bb9bc['unmanaged']=0x0;_0x1bb9bc[_0xa72f('0x3c')]=0x0;if(!_0x1bb9bc['closed']&&!_0x1bb9bc[_0xa72f('0x3d')]){_0x1bb9bc[_0xa72f('0x3e')]+=0x1;}if(!_0x1bb9bc[_0xa72f('0x3f')]&&_0x1bb9bc[_0xa72f('0x3d')]){_0x1bb9bc[_0xa72f('0x3a')]+=0x1;if(_0x1bb9bc[_0xa72f('0x3e')]){_0x1bb9bc['waiting']-=0x1;}}if(_0x1bb9bc[_0xa72f('0x3f')]&&_0x1bb9bc[_0xa72f('0x3d')]){_0x1bb9bc[_0xa72f('0x3b')]+=0x1;if(_0x1bb9bc[_0xa72f('0x3a')]){_0x1bb9bc[_0xa72f('0x3a')]-=0x1;}}if(_0x1bb9bc[_0xa72f('0x3f')]&&!_0x1bb9bc['UserId']){_0x1bb9bc['unmanaged']+=0x1;if(_0x1bb9bc[_0xa72f('0x3e')]){_0x1bb9bc[_0xa72f('0x3e')]-=0x1;}}_0x1bb9bc['total']+=0x1;_0xeba90b(_0x1bb9bc);});}exports[_0xa72f('0x40')]=function(_0x5d2ec0,_0x29e450){var _0x33c7af={},_0x2ea395={},_0x432c59={'count':0x0,'rows':[]};var _0x251ebc=_[_0xa72f('0x32')](db[_0xa72f('0x41')][_0xa72f('0x42')],function(_0x3ee922){return{'name':_0x3ee922[_0xa72f('0x43')],'type':_0x3ee922[_0xa72f('0x44')][_0xa72f('0x45')]};});_0x2ea395['model']=_['map'](_0x251ebc,_0xa72f('0x30'));_0x2ea395['query']=_[_0xa72f('0x46')](_0x5d2ec0[_0xa72f('0x47')]);_0x2ea395['filters']=_['intersection'](_0x2ea395[_0xa72f('0x48')],_0x2ea395['query']);_0x33c7af[_0xa72f('0x49')]=_['intersection'](_0x2ea395[_0xa72f('0x48')],qs[_0xa72f('0x4a')](_0x5d2ec0[_0xa72f('0x47')][_0xa72f('0x4a')]));_0x33c7af[_0xa72f('0x49')]=_0x33c7af[_0xa72f('0x49')][_0xa72f('0x4b')]?_0x33c7af[_0xa72f('0x49')]:_0x2ea395[_0xa72f('0x48')];if(!_0x5d2ec0[_0xa72f('0x47')]['hasOwnProperty']('nolimit')){_0x33c7af[_0xa72f('0x23')]=qs['limit'](_0x5d2ec0[_0xa72f('0x47')][_0xa72f('0x23')]);_0x33c7af['offset']=qs[_0xa72f('0x25')](_0x5d2ec0['query'][_0xa72f('0x25')]);}_0x33c7af['order']=qs[_0xa72f('0x4c')](_0x5d2ec0['query'][_0xa72f('0x4c')]);_0x33c7af[_0xa72f('0x4d')]=qs[_0xa72f('0x4e')](_['pick'](_0x5d2ec0[_0xa72f('0x47')],_0x2ea395[_0xa72f('0x4e')]),_0x251ebc);var _0x3b127f=[];var _0x197cc9=squel[_0xa72f('0x4f')]()[_0xa72f('0x50')]('id')[_0xa72f('0x50')](_0xa72f('0x30'))['field'](_0xa72f('0x51'))[_0xa72f('0x52')](_0xa72f('0x53'));var _0xa6bdd7=squel[_0xa72f('0x4f')]()[_0xa72f('0x50')]('u.id')['field'](_0xa72f('0x54'))[_0xa72f('0x50')]('ui.WhatsappInteractionId')[_0xa72f('0x52')](_0xa72f('0x55'),'ui')[_0xa72f('0x56')](_0xa72f('0x57'),'u',_0xa72f('0x58'));var _0x16bca6=squel[_0xa72f('0x4f')]()['from'](_0xa72f('0x59'),'i')['left_join'](_0xa72f('0x5a'),'c',_0xa72f('0x5b'))[_0xa72f('0x56')](_0xa72f('0x57'),'o','o.id\x20=\x20i.UserId')[_0xa72f('0x56')]('whatsapp_accounts','a',_0xa72f('0x5c'))[_0xa72f('0x56')](_0xa72f('0x5d'),'me',_0xa72f('0x5e'))[_0xa72f('0x56')]('whatsapp_interaction_has_tags','it',_0xa72f('0x5f'))[_0xa72f('0x56')](_0xa72f('0x53'),'t',_0xa72f('0x60'));var _0x1a85df=squel['expr']();var _0x4e8bf7=[];var _0x2d5b2e=squel[_0xa72f('0x61')]();var _0x6eccaa;if(_0x5d2ec0[_0xa72f('0x47')][_0xa72f('0x62')]){_0x6eccaa=as[_0xa72f('0x63')](_0x5d2ec0[_0xa72f('0x47')][_0xa72f('0x62')]);var _0xabdc4a=_0x6eccaa['sqlOperator'];for(var _0x394382=0x0;_0x394382<_0x6eccaa['conditions'][_0xa72f('0x4b')];_0x394382++){var _0x3e0c7d=_0x6eccaa['conditions'][_0x394382];var _0x39be76='i';var _0x3c9e81=_[_0xa72f('0x64')](_0x251ebc,[_0xa72f('0x30'),_0x3e0c7d['field']]);if(!_0x3c9e81){switch(_0x3e0c7d[_0xa72f('0x50')]){case _0xa72f('0x65'):if(_0x3e0c7d[_0xa72f('0x66')]==0x1){_0x16bca6['having']('`'+_0x3e0c7d[_0xa72f('0x50')]+_0xa72f('0x67'));}else{_0x16bca6['having']('`'+_0x3e0c7d[_0xa72f('0x50')]+_0xa72f('0x68'));}break;case _0xa72f('0x69'):if(_0x3e0c7d[_0xa72f('0x6a')]===_0xa72f('0x6b')){if(_0x3e0c7d['value']['split']('\x20')[_0xa72f('0x4b')]>0x1){_0x1a85df[_0xabdc4a](_0xa72f('0x6c'),qs[_0xa72f('0x6d')](_0x3e0c7d['value']),null);}else{var _0x1572ea='%'+_0x3e0c7d[_0xa72f('0x66')]+'%';_0x1a85df[_0xabdc4a](_0xa72f('0x6e'),_0x1572ea,_0x1572ea,_0x1572ea);}}else{_0x3c9e81=_[_0xa72f('0x64')](_0x251ebc,[_0xa72f('0x30'),_0xa72f('0x6f')]);_0x3e0c7d[_0xa72f('0x50')]=_0xa72f('0x6f');_0x55bfb9=as[_0xa72f('0x70')](_0x39be76,_0x3c9e81['type'],_0x3e0c7d);_0x1a85df[_0xabdc4a](_0x55bfb9[_0xa72f('0x71')],_0x55bfb9[_0xa72f('0x66')][_0xa72f('0x72')],_0x55bfb9[_0xa72f('0x66')][_0xa72f('0x73')]);}break;case _0xa72f('0x74'):var _0x104037=_0x3e0c7d[_0xa72f('0x66')][_0xa72f('0x36')](',')[_0xa72f('0x32')](function(_0x447eee){return Number(_0x447eee);});_0x104037[_0xa72f('0x37')](function(_0x128dac){_0x2d5b2e['or'](_0xa72f('0x75'),'%,'+_0x128dac+',%');});_0x4e8bf7=_[_0xa72f('0x76')](_0x4e8bf7,_0x104037);break;case _0xa72f('0x77'):if(_0x3e0c7d[_0xa72f('0x6a')]===_0xa72f('0x6b')){_0x1a85df[_0xabdc4a](_0xa72f('0x78'),'%'+_0x3e0c7d[_0xa72f('0x66')]+'%',null);}else{_0x3c9e81=_['find'](_0x251ebc,[_0xa72f('0x30'),_0xa72f('0x3d')]);_0x3e0c7d[_0xa72f('0x50')]=_0xa72f('0x3d');_0x55bfb9=as['buildExpression'](_0x39be76,_0x3c9e81[_0xa72f('0x44')],_0x3e0c7d);_0x1a85df[_0xabdc4a](_0x55bfb9[_0xa72f('0x71')],_0x55bfb9[_0xa72f('0x66')]['start'],_0x55bfb9[_0xa72f('0x66')][_0xa72f('0x73')]);}break;case _0xa72f('0x79'):_0x55bfb9=as[_0xa72f('0x70')]('me',null,_0x3e0c7d);_0x1a85df[_0xabdc4a](_0x55bfb9[_0xa72f('0x71')],_0x55bfb9[_0xa72f('0x66')][_0xa72f('0x72')],_0x55bfb9[_0xa72f('0x66')]['end']);break;}}else{var _0x55bfb9=as[_0xa72f('0x70')](_0x39be76,_0x3c9e81[_0xa72f('0x44')],_0x3e0c7d);_0x1a85df[_0xabdc4a](_0x55bfb9[_0xa72f('0x71')],_0x55bfb9[_0xa72f('0x66')][_0xa72f('0x72')],_0x55bfb9[_0xa72f('0x66')]['end']);}}}else{var _0x40a8e0=_(_0x5d2ec0[_0xa72f('0x47')])[_0xa72f('0x46')]()['map'](function(_0x27b858){return _['some'](_0x251ebc,[_0xa72f('0x30'),_0x27b858])?_0x27b858:undefined;})[_0xa72f('0x7a')]()[_0xa72f('0x66')]();if(!_[_0xa72f('0x7b')](_0x40a8e0)){_0x40a8e0[_0xa72f('0x37')](function(_0x1075a0){if(_0x1075a0===_0xa72f('0x7c')){_0x16bca6[_0xa72f('0x4d')]('i.WhatsappAccountId\x20IN\x20?',[][_0xa72f('0x7d')](_0x5d2ec0['query'][_0x1075a0]));}else if(_0x1075a0===_0xa72f('0x7e')){var _0x11a497=JSON['parse'](_0x5d2ec0[_0xa72f('0x47')][_0x1075a0])[_0xa72f('0x7f')];var _0x215fcf=JSON['parse'](_0x5d2ec0[_0xa72f('0x47')][_0x1075a0])[_0xa72f('0x80')];_0x16bca6[_0xa72f('0x4d')](_0xa72f('0x81'),_0x11a497,_0x215fcf);}else{if(_0x5d2ec0['query'][_0x1075a0]===_0xa72f('0x82')){_0x16bca6[_0xa72f('0x4d')]('i.'+_0x1075a0+'\x20IS\x20NULL');}else{_0x16bca6[_0xa72f('0x4d')]('i.'+_0x1075a0+_0xa72f('0x83'),_0x5d2ec0[_0xa72f('0x47')][_0x1075a0]);}}});}if(_0x5d2ec0['query'][_0xa72f('0x84')]){if(_0x5d2ec0[_0xa72f('0x47')][_0xa72f('0x84')]==0x1){_0x16bca6[_0xa72f('0x85')](_0xa72f('0x86'));}else{_0x16bca6['having'](_0xa72f('0x87'));}}if(_0x5d2ec0[_0xa72f('0x47')]['tag']){_0x4e8bf7=_[_0xa72f('0x88')](_0x5d2ec0['query']['tag'])?_0x5d2ec0[_0xa72f('0x47')]['tag']:new Array(_0x5d2ec0[_0xa72f('0x47')][_0xa72f('0x89')]);_0x4e8bf7[_0xa72f('0x37')](function(_0x327138){_0x2d5b2e['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x327138+',%');});}if(_0x5d2ec0[_0xa72f('0x47')][_0xa72f('0x8a')]){var _0x59bee9=_0x5d2ec0[_0xa72f('0x47')][_0xa72f('0x8a')][_0xa72f('0x8b')]('\x5c','\x5c\x5c')[_0xa72f('0x8b')](/'/g,'\x27\x27');if(qs[_0xa72f('0x8c')](_0x59bee9)){_0x1a85df['or'](_0xa72f('0x8d'),_0x59bee9+'%')['or'](_0xa72f('0x8e'),_0x59bee9+'%');}else{_0x1a85df['or'](_0xa72f('0x8f'),qs[_0xa72f('0x6d')](_0x59bee9))['or'](_0xa72f('0x90'),_0x59bee9+'%');}}}_0x16bca6[_0xa72f('0x4d')](_0x1a85df);_0x16bca6[_0xa72f('0x91')](_0xa72f('0x92'));var _0x3bc819={'type':db[_0xa72f('0x93')][_0xa72f('0x94')][_0xa72f('0x95')],'raw':!![]};var _0x49f1f1=_0x16bca6[_0xa72f('0x96')]();_0x49f1f1[_0xa72f('0x50')](_0xa72f('0x92'));_0x49f1f1['field'](_0xa72f('0x97'),_0xa72f('0x65'));if(_0x33c7af['order']){_0x33c7af[_0xa72f('0x98')][_0xa72f('0x37')](function(_0x5c5bad){var _0x472b81=_0x5c5bad[0x0]===_0xa72f('0x99')?_0x5c5bad[0x0]:'i.'+_0x5c5bad[0x0];_0x16bca6['order'](_0x472b81,_0x5c5bad[0x1]===_0xa72f('0x9a')?![]:!![]);});}if(!_['isEmpty'](_0x4e8bf7)){_0x16bca6[_0xa72f('0x85')](_0x2d5b2e);_0x49f1f1[_0xa72f('0x4d')](_0xa72f('0x9b'),_0x4e8bf7);}BPromise[_0xa72f('0x9c')]()[_0xa72f('0x2d')](function(){if(!_0x6eccaa){if(_0x5d2ec0[_0xa72f('0x47')][_0xa72f('0x7c')])return;_0x49f1f1['where'](_0xa72f('0x9d'));_0x16bca6[_0xa72f('0x4d')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5d2ec0[_0xa72f('0x9e')][_0xa72f('0x9f')]!=='agent')return;return _0x5d2ec0[_0xa72f('0x9e')][_0xa72f('0xa0')]({'attributes':['id'],'raw':!![]})[_0xa72f('0x2d')](function(_0x34db40){if(_[_0xa72f('0x7b')](_0x34db40)){_0x49f1f1[_0xa72f('0x4d')]('i.WhatsappAccountId\x20IS\x20NULL');_0x16bca6['where'](_0xa72f('0xa1'));}else{_0x49f1f1[_0xa72f('0x4d')](_0xa72f('0xa2'),_['map'](_0x34db40,'id'));_0x16bca6[_0xa72f('0x4d')]('i.WhatsappAccountId\x20IN\x20?',_[_0xa72f('0x32')](_0x34db40,'id'));}});})[_0xa72f('0x2d')](function(){if(_0x5d2ec0[_0xa72f('0x9e')][_0xa72f('0x9f')]===_0xa72f('0xa3')&&!_0x6eccaa&&!_0x5d2ec0['query'][_0xa72f('0x7c')])return[];return db['sequelize'][_0xa72f('0x47')](_0x49f1f1['toString'](),_0x3bc819);})[_0xa72f('0x2d')](function(_0x49fc89){_0x432c59['count']=_0x49fc89[_0xa72f('0x4b')];if(_0x432c59[_0xa72f('0x24')]===0x0)return[];return db[_0xa72f('0xa4')]['query'](_0x197cc9['toString'](),_0x3bc819)[_0xa72f('0x2d')](function(_0x143bc2){_0x3b127f=_[_0xa72f('0xa5')](_0x143bc2,'id');_0x3bc819=_[_0xa72f('0xa6')](_0x3bc819,{'model':db[_0xa72f('0x41')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5d2ec0['query'][_0xa72f('0x4a')]){_0x33c7af[_0xa72f('0x49')][_0xa72f('0x37')](function(_0x187a6a){_0x16bca6[_0xa72f('0x50')]('i.'+_0x187a6a);});}else{_0x16bca6[_0xa72f('0x50')](_0xa72f('0x97'),_0xa72f('0x65'));_0x16bca6['field']('a.key',_0xa72f('0xa7'));_0x16bca6['field']('a.mandatoryDisposition',_0xa72f('0xa8'));_0x16bca6[_0xa72f('0x50')](_0xa72f('0xa9'),_0xa72f('0x99'));_0x16bca6[_0xa72f('0x50')](_0xa72f('0xaa'));_0x16bca6[_0xa72f('0x50')]('c.firstName',_0xa72f('0xab'));_0x16bca6['field'](_0xa72f('0xac'),_0xa72f('0xad'));_0x16bca6[_0xa72f('0x50')]('c.email',_0xa72f('0xae'));_0x16bca6[_0xa72f('0x50')](_0xa72f('0xaf'),'Contact.phone');_0x16bca6[_0xa72f('0x50')](_0xa72f('0xb0'),_0xa72f('0xb1'));_0x16bca6[_0xa72f('0x50')]('c.fax',_0xa72f('0xb2'));_0x16bca6['field'](_0xa72f('0xb3'),_0xa72f('0xb4'));_0x16bca6[_0xa72f('0x50')](_0xa72f('0xb5'),'Owner.internal');_0x16bca6[_0xa72f('0x50')](_0xa72f('0xb6'),_0xa72f('0x34'));}if(_0x33c7af[_0xa72f('0x23')])_0x16bca6['limit'](_0x33c7af[_0xa72f('0x23')]);if(_0x33c7af[_0xa72f('0x25')])_0x16bca6[_0xa72f('0x25')](_0x33c7af[_0xa72f('0x25')]);return db['sequelize'][_0xa72f('0x47')](_0x16bca6['toString'](),_0x3bc819);})[_0xa72f('0x2d')](function(_0xac08e3){if(_0xac08e3[_0xa72f('0x4b')]>0x0)_0xa6bdd7[_0xa72f('0x4d')](_0xa72f('0xb7'),_[_0xa72f('0x32')](_0xac08e3,'id'));return db[_0xa72f('0xa4')][_0xa72f('0x47')](_0xa6bdd7['toString'](),_0x3bc819)[_0xa72f('0x2d')](function(_0x7cfcb8){var _0x559818=_[_0xa72f('0xb8')](_0x7cfcb8,_0xa72f('0xb9'));var _0x35fc7f=[];_0xac08e3['forEach'](function(_0x437bed){_0x35fc7f[_0xa72f('0x38')](updateWhatsappInteraction(_0x437bed,_0x3b127f,_0x559818));});return BPromise[_0xa72f('0xba')](_0x35fc7f);});});})[_0xa72f('0x2d')](function(_0x35f90f){_0x432c59[_0xa72f('0xbb')]=_0x35f90f;return _0x432c59;})[_0xa72f('0x2d')](respondWithFilteredResult(_0x29e450,_0x33c7af))[_0xa72f('0x39')](handleError(_0x29e450,null));};exports[_0xa72f('0xbc')]=function(_0x2807e0,_0x54e62f){var _0x20f35e={'raw':![],'where':{'id':_0x2807e0['params']['id']}},_0x5d3735={};_0x5d3735[_0xa72f('0x48')]=_[_0xa72f('0x46')](db[_0xa72f('0x41')][_0xa72f('0x42')]);_0x5d3735[_0xa72f('0x47')]=_[_0xa72f('0x46')](_0x2807e0[_0xa72f('0x47')]);_0x5d3735['filters']=_[_0xa72f('0xbd')](_0x5d3735[_0xa72f('0x48')],_0x5d3735[_0xa72f('0x47')]);_0x20f35e['attributes']=_[_0xa72f('0xbd')](_0x5d3735[_0xa72f('0x48')],qs[_0xa72f('0x4a')](_0x2807e0[_0xa72f('0x47')][_0xa72f('0x4a')]));_0x20f35e[_0xa72f('0x49')]=_0x20f35e[_0xa72f('0x49')][_0xa72f('0x4b')]?_0x20f35e[_0xa72f('0x49')]:_0x5d3735[_0xa72f('0x48')];if(_0x2807e0[_0xa72f('0x47')][_0xa72f('0xbe')]){_0x20f35e[_0xa72f('0xbf')]=[{'all':!![]}];}_0x20f35e=_[_0xa72f('0xa6')]({},_0x20f35e,_0x2807e0[_0xa72f('0xc0')]);return db[_0xa72f('0x41')]['find'](_0x20f35e)[_0xa72f('0x2d')](handleEntityNotFound(_0x54e62f,null))[_0xa72f('0x2d')](respondWithResult(_0x54e62f,null))[_0xa72f('0x39')](handleError(_0x54e62f,null));};exports[_0xa72f('0xc1')]=function(_0x4cab35,_0x225d21){return db[_0xa72f('0x41')][_0xa72f('0xc1')](_0x4cab35[_0xa72f('0x79')],{})[_0xa72f('0x2d')](respondWithResult(_0x225d21,0xc9))[_0xa72f('0x39')](handleError(_0x225d21,null));};exports['update']=function(_0x506ded,_0x4fc71d){if(_0x506ded[_0xa72f('0x79')]['id']){delete _0x506ded[_0xa72f('0x79')]['id'];}return db['WhatsappInteraction'][_0xa72f('0x64')]({'where':{'id':_0x506ded['params']['id']}})[_0xa72f('0x2d')](handleEntityNotFound(_0x4fc71d,null))[_0xa72f('0x2d')](saveUpdates(_0x506ded['body'],null))[_0xa72f('0x2d')](respondWithResult(_0x4fc71d,null))[_0xa72f('0x39')](handleError(_0x4fc71d,null));};exports[_0xa72f('0x2e')]=function(_0x4a9c43,_0x2e5a54){return db[_0xa72f('0x41')][_0xa72f('0x64')]({'where':{'id':_0x4a9c43[_0xa72f('0xc2')]['id']}})[_0xa72f('0x2d')](handleEntityNotFound(_0x2e5a54,null))[_0xa72f('0x2d')](removeEntity(_0x2e5a54,null))['catch'](handleError(_0x2e5a54,null));};exports['describe']=function(_0x1a6c42,_0x249cd2){return db[_0xa72f('0x41')][_0xa72f('0xc3')]()[_0xa72f('0x2d')](respondWithResult(_0x249cd2,null))[_0xa72f('0x39')](handleError(_0x249cd2,null));};exports[_0xa72f('0xc4')]=function(_0x1bc25d,_0x3972b3,_0x439f32){return db['WhatsappMessage']['find']({'where':{'id':_0x1bc25d['params']['id']}})[_0xa72f('0x2d')](handleEntityNotFound(_0x3972b3,null))[_0xa72f('0x2d')](function(_0x7f4f4){if(_0x7f4f4){return _0x7f4f4[_0xa72f('0xc4')](_0x1bc25d[_0xa72f('0x79')]['ids'],_[_0xa72f('0xc5')](_0x1bc25d[_0xa72f('0x79')],[_0xa72f('0xc6'),'id'])||{});}})['then'](respondWithResult(_0x3972b3,null))[_0xa72f('0x39')](handleError(_0x3972b3,null));};exports[_0xa72f('0xc7')]=function(_0x2c854e,_0x379b31,_0x19cf7e){var _0x56720e={'raw':![],'where':{}};var _0x2d9ce5={};var _0x547287={'count':0x0,'rows':[]};return db[_0xa72f('0x41')]['findOne']({'where':{'id':_0x2c854e[_0xa72f('0xc2')]['id']}})[_0xa72f('0x2d')](handleEntityNotFound(_0x379b31,null))[_0xa72f('0x2d')](function(_0x25e0a7){if(_0x25e0a7){_0x2d9ce5['model']=_[_0xa72f('0x46')](db[_0xa72f('0xc8')][_0xa72f('0x42')]);_0x2d9ce5[_0xa72f('0x47')]=_[_0xa72f('0x46')](_0x2c854e[_0xa72f('0x47')]);_0x2d9ce5[_0xa72f('0x4e')]=_[_0xa72f('0xbd')](_0x2d9ce5[_0xa72f('0x48')],_0x2d9ce5['query']);_0x56720e['attributes']=_['intersection'](_0x2d9ce5[_0xa72f('0x48')],qs[_0xa72f('0x4a')](_0x2c854e[_0xa72f('0x47')][_0xa72f('0x4a')]));_0x56720e[_0xa72f('0x49')]=_0x56720e['attributes'][_0xa72f('0x4b')]?_0x56720e[_0xa72f('0x49')]:_0x2d9ce5[_0xa72f('0x48')];if(!_0x2c854e[_0xa72f('0x47')][_0xa72f('0xc9')](_0xa72f('0xca'))){_0x56720e[_0xa72f('0x23')]=qs[_0xa72f('0x23')](_0x2c854e[_0xa72f('0x47')][_0xa72f('0x23')]);_0x56720e[_0xa72f('0x25')]=qs[_0xa72f('0x25')](_0x2c854e['query'][_0xa72f('0x25')]);}_0x56720e[_0xa72f('0x98')]=qs['sort'](_0x2c854e['query'][_0xa72f('0x4c')]);_0x56720e[_0xa72f('0x4d')]=qs[_0xa72f('0x4e')](_[_0xa72f('0xcb')](_0x2c854e[_0xa72f('0x47')],_0x2d9ce5['filters']));_0x56720e[_0xa72f('0x4d')][_0xa72f('0xb9')]=_0x25e0a7['id'];if(_0x2c854e['query'][_0xa72f('0x8a')]){_0x56720e[_0xa72f('0x4d')]=_[_0xa72f('0xa6')](_0x56720e[_0xa72f('0x4d')],{'$or':_[_0xa72f('0x32')](_0x56720e[_0xa72f('0x49')],function(_0x550a43){var _0x3132eb={};_0x3132eb[_0x550a43]={'$like':'%'+_0x2c854e[_0xa72f('0x47')][_0xa72f('0x8a')]+'%'};return _0x3132eb;})});}if(_0x2c854e[_0xa72f('0x47')]['$gte']){var _0x50e336=_0x2c854e[_0xa72f('0x47')]['$gte']['split'](',');var _0x11dad0={};_0x11dad0[_0x50e336[0x0]]={'$gte':moment(_0x50e336[0x1])[_0xa72f('0xcc')]('YYYY-MM-DD\x20HH:mm:ss')};_0x56720e[_0xa72f('0x4d')]=_[_0xa72f('0xa6')](_0x56720e['where'],_0x11dad0);}_0x56720e=_[_0xa72f('0xa6')]({},_0x56720e,_0x2c854e['options']);return db[_0xa72f('0xc8')][_0xa72f('0x24')]({'where':_0x56720e['where']})[_0xa72f('0x2d')](function(_0x299ba2){_0x547287[_0xa72f('0x24')]=_0x299ba2;if(_0x2c854e[_0xa72f('0x47')]['includeAll']){_0x56720e['include']=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x56720e);})[_0xa72f('0x2d')](function(_0x126701){_0x547287['rows']=_0x126701;return _0x547287;});}})[_0xa72f('0x2d')](respondWithFilteredResult(_0x379b31,_0x56720e))['catch'](handleError(_0x379b31,null));};exports[_0xa72f('0xcd')]=function(_0x56ec8d,_0x52ba80,_0xec35ea){return db[_0xa72f('0x41')]['find']({'where':{'id':_0x56ec8d[_0xa72f('0xc2')]['id']}})[_0xa72f('0x2d')](handleEntityNotFound(_0x52ba80,null))['then'](function(_0x38a3da){if(_0x38a3da){return _0x38a3da[_0xa72f('0xce')](_0x56ec8d[_0xa72f('0x79')]['ids'],_[_0xa72f('0xc5')](_0x56ec8d[_0xa72f('0x79')],['ids','id'])||{})[_0xa72f('0xcf')](function(){return db[_0xa72f('0x74')][_0xa72f('0xd0')]({'attributes':['id',_0xa72f('0x30'),'color'],'where':{'id':_0x56ec8d[_0xa72f('0x79')]['ids']}});})[_0xa72f('0x2d')](function(_0x49e664){socket[_0xa72f('0xd1')]('whatsappInteractionTags:save',{'id':Number(_0x56ec8d['params']['id']),'tags':_0x49e664||[]});return{'id':Number(_0x56ec8d[_0xa72f('0xc2')]['id']),'tags':_0x49e664||[]};});}})[_0xa72f('0x2d')](respondWithResult(_0x52ba80,null))[_0xa72f('0x39')](handleError(_0x52ba80,null));};exports[_0xa72f('0xd2')]=function(_0x5af18f,_0x524d80,_0x19250b){return db[_0xa72f('0x41')][_0xa72f('0x64')]({'where':{'id':_0x5af18f[_0xa72f('0xc2')]['id']}})[_0xa72f('0x2d')](handleEntityNotFound(_0x524d80,null))[_0xa72f('0x2d')](function(_0xb50223){if(_0xb50223){return _0xb50223[_0xa72f('0xd2')](_0x5af18f[_0xa72f('0x47')][_0xa72f('0xc6')]);}})['then'](respondWithStatusCode(_0x524d80,null))[_0xa72f('0x39')](handleError(_0x524d80,null));};exports[_0xa72f('0xd3')]=function(_0x4a25d9,_0x2b4b95){var _0xc77e13=moment()[_0xa72f('0xd4')]()[_0xa72f('0xd5')]();var _0x4fb96d=path[_0xa72f('0xd6')](config[_0xa72f('0xd7')],_0xa72f('0xd8'),_0xa72f('0xd9'),_0xa72f('0xda'));var _0x39b14a=path[_0xa72f('0xd6')](config[_0xa72f('0xd7')],_0xa72f('0xd8'),_0xa72f('0xd9'),_0xa72f('0xdb'));var _0x7cd761=path[_0xa72f('0xd6')](_0x4fb96d,_0xc77e13);var _0xbbea1c=util[_0xa72f('0xcc')]('transcript-%d-%s.zip',_0x4a25d9[_0xa72f('0xc2')]['id'],_0xc77e13);var _0x1175d8=path[_0xa72f('0xd6')](_0x4fb96d,_0xbbea1c);var _0x2ebc0a=[];_0x2ebc0a['push']({'model':db[_0xa72f('0x77')],'as':_0xa72f('0x77'),'attributes':['id',_0xa72f('0x33')],'raw':!![]});_0x2ebc0a[_0xa72f('0x38')]({'model':db[_0xa72f('0xdc')],'as':_0xa72f('0x69'),'attributes':['id',_0xa72f('0xdd'),'lastName'],'raw':!![]});if(_0x4a25d9['query']['attachments']){_0x2ebc0a[_0xa72f('0x38')]({'model':db[_0xa72f('0xde')],'as':_0xa72f('0xde'),'raw':!![]});}var _0x31597d=[{'model':db[_0xa72f('0xc8')],'as':'Messages','attributes':['id',_0xa72f('0x79'),_0xa72f('0x7e'),_0xa72f('0xdf'),_0xa72f('0xe0'),_0xa72f('0x84')],'include':_0x2ebc0a}];_0x31597d[_0xa72f('0x38')]({'model':db[_0xa72f('0xe1')],'as':_0xa72f('0xe2'),'attributes':['id',_0xa72f('0x30')]});_0x31597d['push']({'model':db[_0xa72f('0x77')],'as':_0xa72f('0xe3'),'attributes':['id','fullname']});return db[_0xa72f('0x41')][_0xa72f('0x64')]({'where':{'id':_0x4a25d9[_0xa72f('0xc2')]['id']},'include':_0x31597d})[_0xa72f('0x2d')](handleEntityNotFound(_0x2b4b95,null))[_0xa72f('0x2d')](function(_0x4982db){if(_0x4982db){var _0x296944=_0x4982db[_0xa72f('0xe4')]({'plain':!![]});fs[_0xa72f('0xe5')](_0x7cd761);var _0x3a5f8b={'channel':'Whatsapp','account':_0x296944['Account'][_0xa72f('0x30')],'agent':_0x296944['Owner']?_0x296944[_0xa72f('0xe3')][_0xa72f('0x33')]:_0xa72f('0xe6'),'createdAt':moment(_0x296944[_0xa72f('0x7e')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xa72f('0xd5')](),'closedAt':_0x296944['closed']?moment(_0x296944[_0xa72f('0xe7')])[_0xa72f('0xcc')](_0xa72f('0xe8'))[_0xa72f('0xd5')]():'','disposition':_0x296944[_0xa72f('0xe9')],'messages':_(_0x296944['Messages'])[_0xa72f('0x8a')]({'secret':![]})[_0xa72f('0x32')](function(_0x581120){if(_0x581120[_0xa72f('0xde')]){var _0x1f350d=path[_0xa72f('0xd6')](_0x39b14a,_0x581120['Attachment'][_0xa72f('0xea')]);if(fs['existsSync'](_0x1f350d)){fs[_0xa72f('0xeb')](_0x1f350d)['pipe'](fs[_0xa72f('0xec')](path[_0xa72f('0xd6')](_0x7cd761,_0x581120[_0xa72f('0xde')][_0xa72f('0xea')])));}}return{'date':moment(_0x581120[_0xa72f('0x7e')])[_0xa72f('0xcc')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa72f('0xd5')](),'sender':_0x581120[_0xa72f('0xdf')]===_0xa72f('0xed')?_0x581120[_0xa72f('0x77')]?_0x581120[_0xa72f('0x77')][_0xa72f('0x33')]:_0xa72f('0xee'):_0x581120['Contact'][_0xa72f('0xdd')]+(_0x581120[_0xa72f('0x69')]['lastName']?'\x20'+_0x581120['Contact'][_0xa72f('0xef')]:''),'body':_0x581120[_0xa72f('0xde')]?_0x581120[_0xa72f('0xde')][_0xa72f('0xea')]:_0x581120[_0xa72f('0x79')],'direction':_0x581120['direction']==='out'?'A':'C','secret':_0x581120[_0xa72f('0xe0')],'read':_0x581120[_0xa72f('0x84')],'attachment':_0x581120[_0xa72f('0xde')]};})[_0xa72f('0x66')]()};return ejs[_0xa72f('0xf0')](path[_0xa72f('0xd6')](config[_0xa72f('0xd7')],_0xa72f('0xd8'),'views',_0xa72f('0xf1')),{'interaction':_0x3a5f8b})[_0xa72f('0x2d')](function(_0xe203ae){var _0x1ff159=path[_0xa72f('0xd6')](_0x7cd761,_0xa72f('0xf2')+_0x296944['id']+'-'+_0xc77e13+_0xa72f('0xf3'));var _0x5ea2c4={'path':_0x1ff159,'channel':_0xa72f('0xf4'),'interactionId':_0x296944['id']};return pdf[_0xa72f('0xf5')](_0xe203ae,_0x5ea2c4);})['then'](function(){return new BPromise(function(_0x22dd01,_0x27d313){zipdir(_0x7cd761,{'saveTo':_0x1175d8},function(_0x3a2378,_0x56bde3){if(_0x3a2378)return _0x27d313(_0x3a2378);return _0x22dd01(_0x56bde3);});})['then'](function(){return new BPromise(function(_0x39a281,_0x5238e3){rimraf(_0x7cd761,function(_0x13e020){if(_0x13e020)_0x5238e3(_0x13e020);return _0x39a281();});});})[_0xa72f('0x2d')](function(){return _0x2b4b95[_0xa72f('0xd3')](_0x1175d8,_0xbbea1c,function(_0x1c4066){if(_0x1c4066){console[_0xa72f('0xf6')](_0xa72f('0xf7'),_0x1c4066);}else{fs[_0xa72f('0xf8')](_0x1175d8);}});});});}else{return _0x2b4b95[_0xa72f('0x20')](0xc8);}})[_0xa72f('0x39')](handleError(_0x2b4b95,null));}; \ No newline at end of file +var _0xfe39=['limit','set','Content-Range','reject','save','update','then','status','sendStatus','stack','name','send','map','fullname','TagIds','Tags','push','catch','waiting','talking','answered','total','closed','UserId','unmanaged','index','WhatsappInteraction','key','model','query','filters','intersection','attributes','fields','length','nolimit','where','pick','select','field','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','keys','some','compact','i.WhatsappAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','order','contactName','t.id\x20IN\x20?','resolve','user','role','getWhatsappAccounts','isEmpty','i.WhatsappAccountId\x20IS\x20NULL','agent','WhatsappAccountId','count','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','WhatsappInteractionId','all','rows','show','params','includeAll','merge','options','create','destroy','describe','WhatsappMessage','addMessage','ids','omit','getMessages','findOne','rawAttributes','sort','include','findAll','addTags','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','CmContact','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','N.A.','format','YYYY-MM-DD\x20HH:mm:ss','disposition','basename','pipe','createWriteStream','System','firstName','lastName','out','downloadInteraction.ejs','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./whatsappInteraction.socket','register','end','json','offset'];(function(_0x55f549,_0x4f90ac){var _0x589a78=function(_0x4b2cc3){while(--_0x4b2cc3){_0x55f549['push'](_0x55f549['shift']());}};_0x589a78(++_0x4f90ac);}(_0xfe39,0x1b3));var _0x9fe3=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xfe39[_0x4ae6ef];return _0x3cbb4e;};'use strict';var emlformat=require(_0x9fe3('0x0'));var rimraf=require(_0x9fe3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9fe3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9fe3('0x3'));var Mustache=require(_0x9fe3('0x4'));var util=require('util');var path=require('path');var sox=require(_0x9fe3('0x5'));var csv=require(_0x9fe3('0x6'));var ejs=require(_0x9fe3('0x7'));var fs=require('fs');var fs_extra=require(_0x9fe3('0x8'));var _=require(_0x9fe3('0x9'));var squel=require(_0x9fe3('0xa'));var crypto=require(_0x9fe3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9fe3('0xc'));var toCsv=require(_0x9fe3('0x6'));var querystring=require(_0x9fe3('0xd'));var Papa=require(_0x9fe3('0xe'));var Redis=require(_0x9fe3('0xf'));var authService=require(_0x9fe3('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x9fe3('0x11'));var hardwareService=require(_0x9fe3('0x12'));var logger=require('../../config/logger')(_0x9fe3('0x13'));var utils=require(_0x9fe3('0x14'));var config=require(_0x9fe3('0x15'));var licenseUtil=require(_0x9fe3('0x16'));var db=require('../../mysqldb')['db'];config[_0x9fe3('0x17')]=_[_0x9fe3('0x18')](config[_0x9fe3('0x17')],{'host':_0x9fe3('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9fe3('0x1a'))[_0x9fe3('0x1b')](socket);function respondWithStatusCode(_0x6ffc9c,_0x4730d6){_0x4730d6=_0x4730d6||0xcc;return function(_0x1b2057){if(_0x1b2057){return _0x6ffc9c['sendStatus'](_0x4730d6);}return _0x6ffc9c['status'](_0x4730d6)[_0x9fe3('0x1c')]();};}function respondWithResult(_0x2a4567,_0x1fe7bf){_0x1fe7bf=_0x1fe7bf||0xc8;return function(_0x2d28d4){if(_0x2d28d4){return _0x2a4567['status'](_0x1fe7bf)[_0x9fe3('0x1d')](_0x2d28d4);}};}function respondWithFilteredResult(_0x22b06c,_0x15fcaa){return function(_0x592b8b){if(_0x592b8b){var _0x35bbaf=typeof _0x15fcaa[_0x9fe3('0x1e')]==='undefined'&&typeof _0x15fcaa[_0x9fe3('0x1f')]==='undefined';var _0x42923c=_0x592b8b['count'];var _0x258c28=_0x35bbaf?0x0:_0x15fcaa[_0x9fe3('0x1e')];var _0x302d5c=_0x35bbaf?_0x592b8b['count']:_0x15fcaa['offset']+_0x15fcaa[_0x9fe3('0x1f')];var _0x41852f;if(_0x302d5c>=_0x42923c){_0x302d5c=_0x42923c;_0x41852f=0xc8;}else{_0x41852f=0xce;}_0x22b06c['status'](_0x41852f);return _0x22b06c[_0x9fe3('0x20')](_0x9fe3('0x21'),_0x258c28+'-'+_0x302d5c+'/'+_0x42923c)['json'](_0x592b8b);}return null;};}function patchUpdates(_0x105378){return function(_0x396de6){try{jsonpatch['apply'](_0x396de6,_0x105378,!![]);}catch(_0x3ec2e7){return BPromise[_0x9fe3('0x22')](_0x3ec2e7);}return _0x396de6[_0x9fe3('0x23')]();};}function saveUpdates(_0x3d80e9,_0x14f1a1){return function(_0x1c4665){if(_0x1c4665){return _0x1c4665[_0x9fe3('0x24')](_0x3d80e9)['then'](function(_0x1763c0){return _0x1763c0;});}return null;};}function removeEntity(_0x1304ff,_0x159a56){return function(_0x3b29dd){if(_0x3b29dd){return _0x3b29dd['destroy']()[_0x9fe3('0x25')](function(){_0x1304ff[_0x9fe3('0x26')](0xcc)[_0x9fe3('0x1c')]();});}};}function handleEntityNotFound(_0x559cc1,_0x14ee5b){return function(_0x8b85ea){if(!_0x8b85ea){_0x559cc1[_0x9fe3('0x27')](0x194);}return _0x8b85ea;};}function handleError(_0x45086e,_0x1d2da7){_0x1d2da7=_0x1d2da7||0x1f4;return function(_0x17f01f){logger['error'](_0x17f01f[_0x9fe3('0x28')]);if(_0x17f01f[_0x9fe3('0x29')]){delete _0x17f01f[_0x9fe3('0x29')];}_0x45086e[_0x9fe3('0x26')](_0x1d2da7)[_0x9fe3('0x2a')](_0x17f01f);};}function getInteractionUsers(_0x4557c5,_0x5a9af3){return new BPromise(function(_0x40a778,_0x298318){try{if(_0x5a9af3[_0x4557c5['id']]){_0x4557c5['Users']=_[_0x9fe3('0x2b')](_0x5a9af3[_0x4557c5['id']],function(_0x31b9d1){return{'id':_0x31b9d1['id'],'fullname':_0x31b9d1[_0x9fe3('0x2c')]};});}}catch(_0x44e26c){_0x298318(_0x44e26c);}_0x40a778(_0x4557c5);});}function getInteractionTags(_0xa9b5b3,_0x288e75){return new BPromise(function(_0x4a2e0a,_0x462b11){try{if(_0xa9b5b3[_0x9fe3('0x2d')]){_0xa9b5b3[_0x9fe3('0x2e')]=[];_0xa9b5b3['TagIds']['split'](',')['forEach'](function(_0x38a4db){_0xa9b5b3['Tags'][_0x9fe3('0x2f')](_0x288e75[_0x38a4db]);});}delete _0xa9b5b3[_0x9fe3('0x2d')];}catch(_0x2bda46){_0x462b11(_0x2bda46);}_0x4a2e0a(_0xa9b5b3);});}function updateWhatsappInteraction(_0xa3f363,_0x62a275,_0x3dc51d){return new BPromise(function(_0x31ed32,_0x2aadd5){return getInteractionUsers(_0xa3f363,_0x3dc51d)[_0x9fe3('0x25')](function(_0x49f95f){return getInteractionTags(_0x49f95f,_0x62a275);})[_0x9fe3('0x25')](function(_0x5d97f7){return getStateInteraction(_0x5d97f7);})['then'](function(_0x340845){_0x31ed32(_0x340845);})[_0x9fe3('0x30')](function(_0x12ae18){_0x2aadd5(_0x12ae18);});});}function getStateInteraction(_0x76734e){return new BPromise(function(_0x49c6f1){_0x76734e[_0x9fe3('0x31')]=0x0;_0x76734e[_0x9fe3('0x32')]=0x0;_0x76734e[_0x9fe3('0x33')]=0x0;_0x76734e['unmanaged']=0x0;_0x76734e[_0x9fe3('0x34')]=0x0;if(!_0x76734e[_0x9fe3('0x35')]&&!_0x76734e[_0x9fe3('0x36')]){_0x76734e[_0x9fe3('0x31')]+=0x1;}if(!_0x76734e['closed']&&_0x76734e[_0x9fe3('0x36')]){_0x76734e[_0x9fe3('0x32')]+=0x1;if(_0x76734e['waiting']){_0x76734e['waiting']-=0x1;}}if(_0x76734e[_0x9fe3('0x35')]&&_0x76734e['UserId']){_0x76734e[_0x9fe3('0x33')]+=0x1;if(_0x76734e[_0x9fe3('0x32')]){_0x76734e[_0x9fe3('0x32')]-=0x1;}}if(_0x76734e[_0x9fe3('0x35')]&&!_0x76734e[_0x9fe3('0x36')]){_0x76734e[_0x9fe3('0x37')]+=0x1;if(_0x76734e[_0x9fe3('0x31')]){_0x76734e[_0x9fe3('0x31')]-=0x1;}}_0x76734e['total']+=0x1;_0x49c6f1(_0x76734e);});}exports[_0x9fe3('0x38')]=function(_0x2f6e13,_0x43c7e2){var _0x86ef49={},_0x24f7bf={},_0x44ac38={'count':0x0,'rows':[]};var _0x154d98=_[_0x9fe3('0x2b')](db[_0x9fe3('0x39')]['rawAttributes'],function(_0x50c5eb){return{'name':_0x50c5eb['fieldName'],'type':_0x50c5eb['type'][_0x9fe3('0x3a')]};});_0x24f7bf[_0x9fe3('0x3b')]=_[_0x9fe3('0x2b')](_0x154d98,_0x9fe3('0x29'));_0x24f7bf[_0x9fe3('0x3c')]=_['keys'](_0x2f6e13[_0x9fe3('0x3c')]);_0x24f7bf[_0x9fe3('0x3d')]=_[_0x9fe3('0x3e')](_0x24f7bf['model'],_0x24f7bf[_0x9fe3('0x3c')]);_0x86ef49[_0x9fe3('0x3f')]=_[_0x9fe3('0x3e')](_0x24f7bf['model'],qs['fields'](_0x2f6e13['query'][_0x9fe3('0x40')]));_0x86ef49['attributes']=_0x86ef49[_0x9fe3('0x3f')][_0x9fe3('0x41')]?_0x86ef49['attributes']:_0x24f7bf['model'];if(!_0x2f6e13['query']['hasOwnProperty'](_0x9fe3('0x42'))){_0x86ef49[_0x9fe3('0x1f')]=qs[_0x9fe3('0x1f')](_0x2f6e13[_0x9fe3('0x3c')][_0x9fe3('0x1f')]);_0x86ef49[_0x9fe3('0x1e')]=qs[_0x9fe3('0x1e')](_0x2f6e13[_0x9fe3('0x3c')]['offset']);}_0x86ef49['order']=qs['sort'](_0x2f6e13[_0x9fe3('0x3c')]['sort']);_0x86ef49[_0x9fe3('0x43')]=qs[_0x9fe3('0x3d')](_[_0x9fe3('0x44')](_0x2f6e13[_0x9fe3('0x3c')],_0x24f7bf[_0x9fe3('0x3d')]),_0x154d98);var _0x501504=[];var _0x105373=squel[_0x9fe3('0x45')]()[_0x9fe3('0x46')]('id')[_0x9fe3('0x46')](_0x9fe3('0x29'))[_0x9fe3('0x46')]('color')['from']('tools_tags');var _0x193b08=squel['select']()[_0x9fe3('0x46')](_0x9fe3('0x47'))[_0x9fe3('0x46')](_0x9fe3('0x48'))[_0x9fe3('0x46')](_0x9fe3('0x49'))['from'](_0x9fe3('0x4a'),'ui')['left_join'](_0x9fe3('0x4b'),'u',_0x9fe3('0x4c'));var _0x49ef83=squel[_0x9fe3('0x45')]()['from'](_0x9fe3('0x4d'),'i')[_0x9fe3('0x4e')](_0x9fe3('0x4f'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x9fe3('0x4e')](_0x9fe3('0x4b'),'o','o.id\x20=\x20i.UserId')[_0x9fe3('0x4e')](_0x9fe3('0x50'),'a',_0x9fe3('0x51'))['left_join'](_0x9fe3('0x52'),'me',_0x9fe3('0x53'))['left_join'](_0x9fe3('0x54'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x9fe3('0x4e')](_0x9fe3('0x55'),'t',_0x9fe3('0x56'));var _0x519c08=squel[_0x9fe3('0x57')]();var _0x3dd9c8=[];var _0x39afad=squel[_0x9fe3('0x57')]();var _0x2a342e;if(_0x2f6e13[_0x9fe3('0x3c')][_0x9fe3('0x58')]){_0x2a342e=as[_0x9fe3('0x59')](_0x2f6e13[_0x9fe3('0x3c')]['search']);var _0x3206d5=_0x2a342e['sqlOperator'];for(var _0x3e60f7=0x0;_0x3e60f7<_0x2a342e[_0x9fe3('0x5a')][_0x9fe3('0x41')];_0x3e60f7++){var _0x520ad4=_0x2a342e['conditions'][_0x3e60f7];var _0x420cf0='i';var _0x1dd149=_[_0x9fe3('0x5b')](_0x154d98,[_0x9fe3('0x29'),_0x520ad4[_0x9fe3('0x46')]]);if(!_0x1dd149){switch(_0x520ad4[_0x9fe3('0x46')]){case _0x9fe3('0x5c'):if(_0x520ad4[_0x9fe3('0x5d')]==0x1){_0x49ef83[_0x9fe3('0x5e')]('`'+_0x520ad4['field']+'`\x20=\x200');}else{_0x49ef83['having']('`'+_0x520ad4['field']+_0x9fe3('0x5f'));}break;case _0x9fe3('0x60'):if(_0x520ad4[_0x9fe3('0x61')]===_0x9fe3('0x62')){if(_0x520ad4['value']['split']('\x20')[_0x9fe3('0x41')]>0x1){_0x519c08[_0x3206d5](_0x9fe3('0x63'),qs[_0x9fe3('0x64')](_0x520ad4[_0x9fe3('0x5d')]),null);}else{var _0xe06d3='%'+_0x520ad4[_0x9fe3('0x5d')]+'%';_0x519c08[_0x3206d5](_0x9fe3('0x65'),_0xe06d3,_0xe06d3,_0xe06d3);}}else{_0x1dd149=_[_0x9fe3('0x5b')](_0x154d98,[_0x9fe3('0x29'),_0x9fe3('0x66')]);_0x520ad4[_0x9fe3('0x46')]=_0x9fe3('0x66');_0x3e7f59=as[_0x9fe3('0x67')](_0x420cf0,_0x1dd149[_0x9fe3('0x68')],_0x520ad4);_0x519c08[_0x3206d5](_0x3e7f59[_0x9fe3('0x69')],_0x3e7f59[_0x9fe3('0x5d')][_0x9fe3('0x6a')],_0x3e7f59[_0x9fe3('0x5d')][_0x9fe3('0x1c')]);}break;case _0x9fe3('0x6b'):var _0x447fb9=_0x520ad4[_0x9fe3('0x5d')][_0x9fe3('0x6c')](',')[_0x9fe3('0x2b')](function(_0x4a5c5b){return Number(_0x4a5c5b);});_0x447fb9[_0x9fe3('0x6d')](function(_0x4b5775){_0x39afad['or'](_0x9fe3('0x6e'),'%,'+_0x4b5775+',%');});_0x3dd9c8=_[_0x9fe3('0x6f')](_0x3dd9c8,_0x447fb9);break;case _0x9fe3('0x70'):if(_0x520ad4[_0x9fe3('0x61')]===_0x9fe3('0x62')){_0x519c08[_0x3206d5](_0x9fe3('0x71'),'%'+_0x520ad4[_0x9fe3('0x5d')]+'%',null);}else{_0x1dd149=_['find'](_0x154d98,[_0x9fe3('0x29'),_0x9fe3('0x36')]);_0x520ad4[_0x9fe3('0x46')]='UserId';_0x3e7f59=as[_0x9fe3('0x67')](_0x420cf0,_0x1dd149['type'],_0x520ad4);_0x519c08[_0x3206d5](_0x3e7f59[_0x9fe3('0x69')],_0x3e7f59[_0x9fe3('0x5d')][_0x9fe3('0x6a')],_0x3e7f59['value'][_0x9fe3('0x1c')]);}break;case _0x9fe3('0x72'):_0x3e7f59=as[_0x9fe3('0x67')]('me',null,_0x520ad4);_0x519c08[_0x3206d5](_0x3e7f59[_0x9fe3('0x69')],_0x3e7f59[_0x9fe3('0x5d')]['start'],_0x3e7f59[_0x9fe3('0x5d')][_0x9fe3('0x1c')]);break;}}else{var _0x3e7f59=as[_0x9fe3('0x67')](_0x420cf0,_0x1dd149['type'],_0x520ad4);_0x519c08[_0x3206d5](_0x3e7f59[_0x9fe3('0x69')],_0x3e7f59[_0x9fe3('0x5d')]['start'],_0x3e7f59[_0x9fe3('0x5d')][_0x9fe3('0x1c')]);}}}else{var _0x47b8ec=_(_0x2f6e13['query'])[_0x9fe3('0x73')]()[_0x9fe3('0x2b')](function(_0x25ff46){return _[_0x9fe3('0x74')](_0x154d98,[_0x9fe3('0x29'),_0x25ff46])?_0x25ff46:undefined;})[_0x9fe3('0x75')]()['value']();if(!_['isEmpty'](_0x47b8ec)){_0x47b8ec['forEach'](function(_0x34498d){if(_0x34498d==='WhatsappAccountId'){_0x49ef83[_0x9fe3('0x43')](_0x9fe3('0x76'),[]['concat'](_0x2f6e13[_0x9fe3('0x3c')][_0x34498d]));}else if(_0x34498d===_0x9fe3('0x77')){var _0x446c29=JSON[_0x9fe3('0x78')](_0x2f6e13[_0x9fe3('0x3c')][_0x34498d])[_0x9fe3('0x79')];var _0x19cd24=JSON[_0x9fe3('0x78')](_0x2f6e13[_0x9fe3('0x3c')][_0x34498d])[_0x9fe3('0x7a')];_0x49ef83[_0x9fe3('0x43')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x446c29,_0x19cd24);}else{if(_0x2f6e13[_0x9fe3('0x3c')][_0x34498d]===_0x9fe3('0x7b')){_0x49ef83[_0x9fe3('0x43')]('i.'+_0x34498d+_0x9fe3('0x7c'));}else{_0x49ef83[_0x9fe3('0x43')]('i.'+_0x34498d+_0x9fe3('0x7d'),_0x2f6e13[_0x9fe3('0x3c')][_0x34498d]);}}});}if(_0x2f6e13[_0x9fe3('0x3c')][_0x9fe3('0x7e')]){if(_0x2f6e13[_0x9fe3('0x3c')][_0x9fe3('0x7e')]==0x1){_0x49ef83[_0x9fe3('0x5e')](_0x9fe3('0x7f'));}else{_0x49ef83['having'](_0x9fe3('0x80'));}}if(_0x2f6e13[_0x9fe3('0x3c')][_0x9fe3('0x81')]){_0x3dd9c8=_[_0x9fe3('0x82')](_0x2f6e13[_0x9fe3('0x3c')][_0x9fe3('0x81')])?_0x2f6e13[_0x9fe3('0x3c')][_0x9fe3('0x81')]:new Array(_0x2f6e13[_0x9fe3('0x3c')]['tag']);_0x3dd9c8[_0x9fe3('0x6d')](function(_0x80b5a8){_0x39afad['or'](_0x9fe3('0x6e'),'%,'+_0x80b5a8+',%');});}if(_0x2f6e13[_0x9fe3('0x3c')]['filter']){var _0x7d51b8=_0x2f6e13[_0x9fe3('0x3c')][_0x9fe3('0x83')][_0x9fe3('0x84')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x9fe3('0x85')](_0x7d51b8)){_0x519c08['or'](_0x9fe3('0x86'),_0x7d51b8+'%')['or'](_0x9fe3('0x87'),_0x7d51b8+'%');}else{_0x519c08['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x9fe3('0x64')](_0x7d51b8))['or'](_0x9fe3('0x88'),_0x7d51b8+'%');}}}_0x49ef83[_0x9fe3('0x43')](_0x519c08);_0x49ef83[_0x9fe3('0x89')](_0x9fe3('0x8a'));var _0x1ae921={'type':db[_0x9fe3('0x8b')][_0x9fe3('0x8c')][_0x9fe3('0x8d')],'raw':!![]};var _0x675585=_0x49ef83[_0x9fe3('0x8e')]();_0x675585['field'](_0x9fe3('0x8a'));_0x675585['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x9fe3('0x5c'));if(_0x86ef49['order']){_0x86ef49[_0x9fe3('0x8f')][_0x9fe3('0x6d')](function(_0x16b90b){var _0x1aac4b=_0x16b90b[0x0]===_0x9fe3('0x90')?_0x16b90b[0x0]:'i.'+_0x16b90b[0x0];_0x49ef83[_0x9fe3('0x8f')](_0x1aac4b,_0x16b90b[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x3dd9c8)){_0x49ef83['having'](_0x39afad);_0x675585[_0x9fe3('0x43')](_0x9fe3('0x91'),_0x3dd9c8);}BPromise[_0x9fe3('0x92')]()['then'](function(){if(!_0x2a342e){if(_0x2f6e13[_0x9fe3('0x3c')]['WhatsappAccountId'])return;_0x675585[_0x9fe3('0x43')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x49ef83[_0x9fe3('0x43')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x2f6e13[_0x9fe3('0x93')][_0x9fe3('0x94')]!=='agent')return;return _0x2f6e13[_0x9fe3('0x93')][_0x9fe3('0x95')]({'attributes':['id'],'raw':!![]})['then'](function(_0x9538b9){if(_[_0x9fe3('0x96')](_0x9538b9)){_0x675585[_0x9fe3('0x43')]('i.WhatsappAccountId\x20IS\x20NULL');_0x49ef83[_0x9fe3('0x43')](_0x9fe3('0x97'));}else{_0x675585[_0x9fe3('0x43')]('i.WhatsappAccountId\x20IN\x20?',_[_0x9fe3('0x2b')](_0x9538b9,'id'));_0x49ef83[_0x9fe3('0x43')](_0x9fe3('0x76'),_[_0x9fe3('0x2b')](_0x9538b9,'id'));}});})[_0x9fe3('0x25')](function(){if(_0x2f6e13['user'][_0x9fe3('0x94')]===_0x9fe3('0x98')&&!_0x2a342e&&!_0x2f6e13[_0x9fe3('0x3c')][_0x9fe3('0x99')])return[];return db['sequelize'][_0x9fe3('0x3c')](_0x675585['toString'](),_0x1ae921);})[_0x9fe3('0x25')](function(_0x34b938){_0x44ac38['count']=_0x34b938['length'];if(_0x44ac38[_0x9fe3('0x9a')]===0x0)return[];return db[_0x9fe3('0x9b')][_0x9fe3('0x3c')](_0x105373[_0x9fe3('0x9c')](),_0x1ae921)[_0x9fe3('0x25')](function(_0x30d3e8){_0x501504=_[_0x9fe3('0x9d')](_0x30d3e8,'id');_0x1ae921=_['merge'](_0x1ae921,{'model':db[_0x9fe3('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2f6e13[_0x9fe3('0x3c')][_0x9fe3('0x40')]){_0x86ef49[_0x9fe3('0x3f')][_0x9fe3('0x6d')](function(_0x657dc){_0x49ef83[_0x9fe3('0x46')]('i.'+_0x657dc);});}else{_0x49ef83[_0x9fe3('0x46')](_0x9fe3('0x9e'),_0x9fe3('0x5c'));_0x49ef83[_0x9fe3('0x46')](_0x9fe3('0x9f'),_0x9fe3('0xa0'));_0x49ef83[_0x9fe3('0x46')](_0x9fe3('0xa1'),_0x9fe3('0xa2'));_0x49ef83['field'](_0x9fe3('0xa3'),_0x9fe3('0x90'));_0x49ef83[_0x9fe3('0x46')]('i.*');_0x49ef83[_0x9fe3('0x46')](_0x9fe3('0xa4'),_0x9fe3('0xa5'));_0x49ef83[_0x9fe3('0x46')](_0x9fe3('0xa6'),_0x9fe3('0xa7'));_0x49ef83['field']('c.email','Contact.email');_0x49ef83[_0x9fe3('0x46')](_0x9fe3('0xa8'),'Contact.phone');_0x49ef83[_0x9fe3('0x46')](_0x9fe3('0xa9'),_0x9fe3('0xaa'));_0x49ef83[_0x9fe3('0x46')]('c.fax',_0x9fe3('0xab'));_0x49ef83[_0x9fe3('0x46')](_0x9fe3('0xac'),_0x9fe3('0xad'));_0x49ef83[_0x9fe3('0x46')]('o.internal',_0x9fe3('0xae'));_0x49ef83[_0x9fe3('0x46')](_0x9fe3('0xaf'),_0x9fe3('0x2d'));}if(_0x86ef49[_0x9fe3('0x1f')])_0x49ef83['limit'](_0x86ef49[_0x9fe3('0x1f')]);if(_0x86ef49[_0x9fe3('0x1e')])_0x49ef83[_0x9fe3('0x1e')](_0x86ef49[_0x9fe3('0x1e')]);return db[_0x9fe3('0x9b')][_0x9fe3('0x3c')](_0x49ef83[_0x9fe3('0x9c')](),_0x1ae921);})['then'](function(_0x1f70ad){if(_0x1f70ad['length']>0x0)_0x193b08[_0x9fe3('0x43')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0x9fe3('0x2b')](_0x1f70ad,'id'));return db[_0x9fe3('0x9b')][_0x9fe3('0x3c')](_0x193b08['toString'](),_0x1ae921)[_0x9fe3('0x25')](function(_0x1d2038){var _0x4252f6=_[_0x9fe3('0xb0')](_0x1d2038,_0x9fe3('0xb1'));var _0x51d3cc=[];_0x1f70ad['forEach'](function(_0x2ad084){_0x51d3cc[_0x9fe3('0x2f')](updateWhatsappInteraction(_0x2ad084,_0x501504,_0x4252f6));});return BPromise[_0x9fe3('0xb2')](_0x51d3cc);});});})[_0x9fe3('0x25')](function(_0x324cf9){_0x44ac38[_0x9fe3('0xb3')]=_0x324cf9;return _0x44ac38;})[_0x9fe3('0x25')](respondWithFilteredResult(_0x43c7e2,_0x86ef49))[_0x9fe3('0x30')](handleError(_0x43c7e2,null));};exports[_0x9fe3('0xb4')]=function(_0x5c4536,_0x17b5e4){var _0x28e4f8={'raw':![],'where':{'id':_0x5c4536[_0x9fe3('0xb5')]['id']}},_0x2034f3={};_0x2034f3[_0x9fe3('0x3b')]=_[_0x9fe3('0x73')](db[_0x9fe3('0x39')]['rawAttributes']);_0x2034f3[_0x9fe3('0x3c')]=_[_0x9fe3('0x73')](_0x5c4536[_0x9fe3('0x3c')]);_0x2034f3[_0x9fe3('0x3d')]=_['intersection'](_0x2034f3['model'],_0x2034f3[_0x9fe3('0x3c')]);_0x28e4f8[_0x9fe3('0x3f')]=_[_0x9fe3('0x3e')](_0x2034f3[_0x9fe3('0x3b')],qs[_0x9fe3('0x40')](_0x5c4536[_0x9fe3('0x3c')][_0x9fe3('0x40')]));_0x28e4f8[_0x9fe3('0x3f')]=_0x28e4f8['attributes'][_0x9fe3('0x41')]?_0x28e4f8[_0x9fe3('0x3f')]:_0x2034f3[_0x9fe3('0x3b')];if(_0x5c4536['query'][_0x9fe3('0xb6')]){_0x28e4f8['include']=[{'all':!![]}];}_0x28e4f8=_[_0x9fe3('0xb7')]({},_0x28e4f8,_0x5c4536[_0x9fe3('0xb8')]);return db[_0x9fe3('0x39')][_0x9fe3('0x5b')](_0x28e4f8)[_0x9fe3('0x25')](handleEntityNotFound(_0x17b5e4,null))[_0x9fe3('0x25')](respondWithResult(_0x17b5e4,null))[_0x9fe3('0x30')](handleError(_0x17b5e4,null));};exports[_0x9fe3('0xb9')]=function(_0x102529,_0xbe9fb9){return db['WhatsappInteraction'][_0x9fe3('0xb9')](_0x102529[_0x9fe3('0x72')],{})[_0x9fe3('0x25')](respondWithResult(_0xbe9fb9,0xc9))['catch'](handleError(_0xbe9fb9,null));};exports[_0x9fe3('0x24')]=function(_0x187abb,_0x446cab){if(_0x187abb[_0x9fe3('0x72')]['id']){delete _0x187abb[_0x9fe3('0x72')]['id'];}return db[_0x9fe3('0x39')][_0x9fe3('0x5b')]({'where':{'id':_0x187abb[_0x9fe3('0xb5')]['id']}})[_0x9fe3('0x25')](handleEntityNotFound(_0x446cab,null))[_0x9fe3('0x25')](saveUpdates(_0x187abb['body'],null))['then'](respondWithResult(_0x446cab,null))[_0x9fe3('0x30')](handleError(_0x446cab,null));};exports[_0x9fe3('0xba')]=function(_0x44b263,_0x13c9c5){return db[_0x9fe3('0x39')][_0x9fe3('0x5b')]({'where':{'id':_0x44b263[_0x9fe3('0xb5')]['id']}})[_0x9fe3('0x25')](handleEntityNotFound(_0x13c9c5,null))['then'](removeEntity(_0x13c9c5,null))['catch'](handleError(_0x13c9c5,null));};exports[_0x9fe3('0xbb')]=function(_0x554b8f,_0x173a6d){return db['WhatsappInteraction'][_0x9fe3('0xbb')]()[_0x9fe3('0x25')](respondWithResult(_0x173a6d,null))[_0x9fe3('0x30')](handleError(_0x173a6d,null));};exports['addMessage']=function(_0x3983dd,_0x4d39d9,_0x45027e){return db[_0x9fe3('0xbc')]['find']({'where':{'id':_0x3983dd['params']['id']}})[_0x9fe3('0x25')](handleEntityNotFound(_0x4d39d9,null))[_0x9fe3('0x25')](function(_0x506c53){if(_0x506c53){return _0x506c53[_0x9fe3('0xbd')](_0x3983dd[_0x9fe3('0x72')][_0x9fe3('0xbe')],_[_0x9fe3('0xbf')](_0x3983dd[_0x9fe3('0x72')],[_0x9fe3('0xbe'),'id'])||{});}})['then'](respondWithResult(_0x4d39d9,null))[_0x9fe3('0x30')](handleError(_0x4d39d9,null));};exports[_0x9fe3('0xc0')]=function(_0x3c4bed,_0x397c85,_0xb17c3e){var _0x48ffd6={'raw':![],'where':{}};var _0x4d2c58={};var _0x14ee48={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x9fe3('0xc1')]({'where':{'id':_0x3c4bed[_0x9fe3('0xb5')]['id']}})[_0x9fe3('0x25')](handleEntityNotFound(_0x397c85,null))[_0x9fe3('0x25')](function(_0x3453ca){if(_0x3453ca){_0x4d2c58[_0x9fe3('0x3b')]=_['keys'](db[_0x9fe3('0xbc')][_0x9fe3('0xc2')]);_0x4d2c58['query']=_['keys'](_0x3c4bed[_0x9fe3('0x3c')]);_0x4d2c58[_0x9fe3('0x3d')]=_['intersection'](_0x4d2c58[_0x9fe3('0x3b')],_0x4d2c58['query']);_0x48ffd6[_0x9fe3('0x3f')]=_[_0x9fe3('0x3e')](_0x4d2c58[_0x9fe3('0x3b')],qs['fields'](_0x3c4bed[_0x9fe3('0x3c')]['fields']));_0x48ffd6[_0x9fe3('0x3f')]=_0x48ffd6['attributes'][_0x9fe3('0x41')]?_0x48ffd6[_0x9fe3('0x3f')]:_0x4d2c58[_0x9fe3('0x3b')];if(!_0x3c4bed[_0x9fe3('0x3c')]['hasOwnProperty'](_0x9fe3('0x42'))){_0x48ffd6['limit']=qs['limit'](_0x3c4bed[_0x9fe3('0x3c')][_0x9fe3('0x1f')]);_0x48ffd6['offset']=qs['offset'](_0x3c4bed['query'][_0x9fe3('0x1e')]);}_0x48ffd6['order']=qs['sort'](_0x3c4bed['query'][_0x9fe3('0xc3')]);_0x48ffd6[_0x9fe3('0x43')]=qs[_0x9fe3('0x3d')](_[_0x9fe3('0x44')](_0x3c4bed[_0x9fe3('0x3c')],_0x4d2c58[_0x9fe3('0x3d')]));_0x48ffd6[_0x9fe3('0x43')]['WhatsappInteractionId']=_0x3453ca['id'];if(_0x3c4bed[_0x9fe3('0x3c')][_0x9fe3('0x83')]){_0x48ffd6[_0x9fe3('0x43')]=_[_0x9fe3('0xb7')](_0x48ffd6[_0x9fe3('0x43')],{'$or':_[_0x9fe3('0x2b')](_0x48ffd6[_0x9fe3('0x3f')],function(_0x106b59){var _0x41b6f8={};_0x41b6f8[_0x106b59]={'$like':'%'+_0x3c4bed['query']['filter']+'%'};return _0x41b6f8;})});}if(_0x3c4bed[_0x9fe3('0x3c')][_0x9fe3('0x79')]){var _0x52eeb4=_0x3c4bed[_0x9fe3('0x3c')][_0x9fe3('0x79')][_0x9fe3('0x6c')](',');var _0xe3a3={};_0xe3a3[_0x52eeb4[0x0]]={'$gte':moment(_0x52eeb4[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x48ffd6[_0x9fe3('0x43')]=_[_0x9fe3('0xb7')](_0x48ffd6[_0x9fe3('0x43')],_0xe3a3);}_0x48ffd6=_['merge']({},_0x48ffd6,_0x3c4bed[_0x9fe3('0xb8')]);return db[_0x9fe3('0xbc')][_0x9fe3('0x9a')]({'where':_0x48ffd6[_0x9fe3('0x43')]})[_0x9fe3('0x25')](function(_0x2ce397){_0x14ee48[_0x9fe3('0x9a')]=_0x2ce397;if(_0x3c4bed[_0x9fe3('0x3c')]['includeAll']){_0x48ffd6[_0x9fe3('0xc4')]=[{'all':!![]}];}return db[_0x9fe3('0xbc')][_0x9fe3('0xc5')](_0x48ffd6);})['then'](function(_0x303ce2){_0x14ee48[_0x9fe3('0xb3')]=_0x303ce2;return _0x14ee48;});}})['then'](respondWithFilteredResult(_0x397c85,_0x48ffd6))['catch'](handleError(_0x397c85,null));};exports[_0x9fe3('0xc6')]=function(_0x10163a,_0x2eb300,_0x41638c){return db['WhatsappInteraction'][_0x9fe3('0x5b')]({'where':{'id':_0x10163a[_0x9fe3('0xb5')]['id']}})[_0x9fe3('0x25')](handleEntityNotFound(_0x2eb300,null))[_0x9fe3('0x25')](function(_0x30756c){if(_0x30756c){return _0x30756c['setTags'](_0x10163a[_0x9fe3('0x72')][_0x9fe3('0xbe')],_['omit'](_0x10163a[_0x9fe3('0x72')],[_0x9fe3('0xbe'),'id'])||{})['spread'](function(){return db[_0x9fe3('0x6b')][_0x9fe3('0xc5')]({'attributes':['id','name','color'],'where':{'id':_0x10163a[_0x9fe3('0x72')][_0x9fe3('0xbe')]}});})[_0x9fe3('0x25')](function(_0x56edc3){socket['emit'](_0x9fe3('0xc7'),{'id':Number(_0x10163a[_0x9fe3('0xb5')]['id']),'tags':_0x56edc3||[]});return{'id':Number(_0x10163a[_0x9fe3('0xb5')]['id']),'tags':_0x56edc3||[]};});}})[_0x9fe3('0x25')](respondWithResult(_0x2eb300,null))[_0x9fe3('0x30')](handleError(_0x2eb300,null));};exports[_0x9fe3('0xc8')]=function(_0x3f8cbf,_0x3952d5,_0x125974){return db[_0x9fe3('0x39')][_0x9fe3('0x5b')]({'where':{'id':_0x3f8cbf['params']['id']}})[_0x9fe3('0x25')](handleEntityNotFound(_0x3952d5,null))[_0x9fe3('0x25')](function(_0x49a14b){if(_0x49a14b){return _0x49a14b['removeTags'](_0x3f8cbf['query'][_0x9fe3('0xbe')]);}})['then'](respondWithStatusCode(_0x3952d5,null))[_0x9fe3('0x30')](handleError(_0x3952d5,null));};exports[_0x9fe3('0xc9')]=function(_0x2541cf,_0x16dfb1){var _0x8b4bc4=moment()[_0x9fe3('0xca')]()['toString']();var _0x16f9e3=path[_0x9fe3('0xcb')](config[_0x9fe3('0xcc')],_0x9fe3('0xcd'),_0x9fe3('0xce'),'tmp');var _0x519f6f=path[_0x9fe3('0xcb')](config[_0x9fe3('0xcc')],_0x9fe3('0xcd'),_0x9fe3('0xce'),'attachments');var _0x2d637f=path[_0x9fe3('0xcb')](_0x16f9e3,_0x8b4bc4);var _0x5520ec=util['format']('transcript-%d-%s.zip',_0x2541cf[_0x9fe3('0xb5')]['id'],_0x8b4bc4);var _0x40d63d=path['join'](_0x16f9e3,_0x5520ec);var _0x4d0203=[];_0x4d0203[_0x9fe3('0x2f')]({'model':db['User'],'as':'User','attributes':['id',_0x9fe3('0x2c')],'raw':!![]});_0x4d0203[_0x9fe3('0x2f')]({'model':db[_0x9fe3('0xcf')],'as':_0x9fe3('0x60'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x2541cf[_0x9fe3('0x3c')]['attachments']){_0x4d0203[_0x9fe3('0x2f')]({'model':db[_0x9fe3('0xd0')],'as':_0x9fe3('0xd0'),'raw':!![]});}var _0x541405=[{'model':db[_0x9fe3('0xbc')],'as':_0x9fe3('0xd1'),'attributes':['id',_0x9fe3('0x72'),_0x9fe3('0x77'),_0x9fe3('0xd2'),_0x9fe3('0xd3'),'read'],'include':_0x4d0203}];_0x541405[_0x9fe3('0x2f')]({'model':db[_0x9fe3('0xd4')],'as':_0x9fe3('0xd5'),'attributes':['id','name']});_0x541405['push']({'model':db['User'],'as':_0x9fe3('0xd6'),'attributes':['id',_0x9fe3('0x2c')]});return db['WhatsappInteraction'][_0x9fe3('0x5b')]({'where':{'id':_0x2541cf['params']['id']},'include':_0x541405})[_0x9fe3('0x25')](handleEntityNotFound(_0x16dfb1,null))[_0x9fe3('0x25')](function(_0x7fa824){if(_0x7fa824){var _0x59b28e=_0x7fa824[_0x9fe3('0xd7')]({'plain':!![]});fs[_0x9fe3('0xd8')](_0x2d637f);var _0xcac513={'channel':'Whatsapp','account':_0x59b28e[_0x9fe3('0xd5')][_0x9fe3('0x29')],'agent':_0x59b28e[_0x9fe3('0xd6')]?_0x59b28e['Owner'][_0x9fe3('0x2c')]:_0x9fe3('0xd9'),'createdAt':moment(_0x59b28e[_0x9fe3('0x77')])[_0x9fe3('0xda')](_0x9fe3('0xdb'))[_0x9fe3('0x9c')](),'closedAt':_0x59b28e[_0x9fe3('0x35')]?moment(_0x59b28e['closedAt'])[_0x9fe3('0xda')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x59b28e[_0x9fe3('0xdc')],'messages':_(_0x59b28e['Messages'])[_0x9fe3('0x83')]({'secret':![]})[_0x9fe3('0x2b')](function(_0x30a726){if(_0x30a726[_0x9fe3('0xd0')]){var _0x2db20f=path[_0x9fe3('0xcb')](_0x519f6f,_0x30a726[_0x9fe3('0xd0')][_0x9fe3('0xdd')]);if(fs['existsSync'](_0x2db20f)){fs['createReadStream'](_0x2db20f)[_0x9fe3('0xde')](fs[_0x9fe3('0xdf')](path[_0x9fe3('0xcb')](_0x2d637f,_0x30a726[_0x9fe3('0xd0')][_0x9fe3('0xdd')])));}}return{'date':moment(_0x30a726[_0x9fe3('0x77')])[_0x9fe3('0xda')](_0x9fe3('0xdb'))[_0x9fe3('0x9c')](),'sender':_0x30a726[_0x9fe3('0xd2')]==='out'?_0x30a726[_0x9fe3('0x70')]?_0x30a726[_0x9fe3('0x70')][_0x9fe3('0x2c')]:_0x9fe3('0xe0'):_0x30a726['Contact'][_0x9fe3('0xe1')]+(_0x30a726['Contact'][_0x9fe3('0xe2')]?'\x20'+_0x30a726[_0x9fe3('0x60')][_0x9fe3('0xe2')]:''),'body':_0x30a726[_0x9fe3('0xd0')]?_0x30a726[_0x9fe3('0xd0')][_0x9fe3('0xdd')]:_0x30a726[_0x9fe3('0x72')],'direction':_0x30a726[_0x9fe3('0xd2')]===_0x9fe3('0xe3')?'A':'C','secret':_0x30a726[_0x9fe3('0xd3')],'read':_0x30a726[_0x9fe3('0x7e')],'attachment':_0x30a726['Attachment']};})[_0x9fe3('0x5d')]()};return ejs['renderFile'](path[_0x9fe3('0xcb')](config[_0x9fe3('0xcc')],_0x9fe3('0xcd'),'views',_0x9fe3('0xe4')),{'interaction':_0xcac513})[_0x9fe3('0x25')](function(_0x20da72){var _0x44d9af=path[_0x9fe3('0xcb')](_0x2d637f,'transcript-'+_0x59b28e['id']+'-'+_0x8b4bc4+'.pdf');var _0x3d98e1={'path':_0x44d9af,'channel':'Whatsapp','interactionId':_0x59b28e['id']};return pdf[_0x9fe3('0xe5')](_0x20da72,_0x3d98e1);})[_0x9fe3('0x25')](function(){return new BPromise(function(_0x136abd,_0x158689){zipdir(_0x2d637f,{'saveTo':_0x40d63d},function(_0x4fe79a,_0x53c36d){if(_0x4fe79a)return _0x158689(_0x4fe79a);return _0x136abd(_0x53c36d);});})[_0x9fe3('0x25')](function(){return new BPromise(function(_0x9a2a59,_0x295e3c){rimraf(_0x2d637f,function(_0x3ebec6){if(_0x3ebec6)_0x295e3c(_0x3ebec6);return _0x9a2a59();});});})['then'](function(){return _0x16dfb1[_0x9fe3('0xc9')](_0x40d63d,_0x5520ec,function(_0x14f80d){if(_0x14f80d){console[_0x9fe3('0xe6')](_0x9fe3('0xe7'),_0x14f80d);}else{fs[_0x9fe3('0xe8')](_0x40d63d);}});});});}else{return _0x16dfb1[_0x9fe3('0x27')](0xc8);}})[_0x9fe3('0x30')](handleError(_0x16dfb1,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 4887b70..51f987f 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 _0xd240=['update','remove','getUsers','then','Users','map','findAll','setDataValue','length','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappMessage','setMaxListeners','save'];(function(_0x44839b,_0x32136f){var _0x51d2ce=function(_0x17742f){while(--_0x17742f){_0x44839b['push'](_0x44839b['shift']());}};_0x51d2ce(++_0x32136f);}(_0xd240,0x1c7));var _0x0d24=function(_0x55d2dd,_0x139145){_0x55d2dd=_0x55d2dd-0x0;var _0x4195fd=_0xd240[_0x55d2dd];return _0x4195fd;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x0d24('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db'][_0x0d24('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x0d24('0x2')](0x0);var events={'afterCreate':_0x0d24('0x3'),'afterUpdate':_0x0d24('0x4'),'afterDestroy':_0x0d24('0x5')};function emitEvent(_0x3dc015){return function(_0x488599,_0x56c06e,_0x30fbee){_0x488599[_0x0d24('0x6')]({'attributes':['id'],'raw':!![]})[_0x0d24('0x7')](function(_0x250141){_0x488599['setDataValue'](_0x0d24('0x8'),_0x250141[_0x0d24('0x9')](function(_0x4345ae){return{'id':_0x4345ae['id']};}));return WhatsappMessage[_0x0d24('0xa')]({'where':{'WhatsappInteractionId':_0x488599['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0d24('0x7')](function(_0x29742e){_0x488599[_0x0d24('0xb')]('unreadMessages',_0x29742e[_0x0d24('0xc')]);WhatsappInteractionEvents['emit'](_0x3dc015+':'+_0x488599['id'],_0x488599);WhatsappInteractionEvents[_0x0d24('0xd')](_0x3dc015,_0x488599);_0x30fbee(null);})['catch'](_0x30fbee(null));};}for(var e in events){if(events[_0x0d24('0xe')](e)){var event=events[e];WhatsappInteraction[_0x0d24('0xf')](e,emitEvent(event));}}module[_0x0d24('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x028d=['map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x985e6c,_0x46291c){var _0x2717f9=function(_0x274a00){while(--_0x274a00){_0x985e6c['push'](_0x985e6c['shift']());}};_0x2717f9(++_0x46291c);}(_0x028d,0xff));var _0xd028=function(_0x4cebe6,_0x425af2){_0x4cebe6=_0x4cebe6-0x0;var _0x4113a3=_0x028d[_0x4cebe6];return _0x4113a3;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xd028('0x0'))['db'][_0xd028('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0xd028('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xd028('0x3')](0x0);var events={'afterCreate':_0xd028('0x4'),'afterUpdate':_0xd028('0x5'),'afterDestroy':_0xd028('0x6')};function emitEvent(_0x67d150){return function(_0x5094d8,_0x153af8,_0x4592fd){_0x5094d8[_0xd028('0x7')]({'attributes':['id'],'raw':!![]})[_0xd028('0x8')](function(_0x110b50){_0x5094d8[_0xd028('0x9')](_0xd028('0xa'),_0x110b50[_0xd028('0xb')](function(_0xadea4b){return{'id':_0xadea4b['id']};}));return WhatsappMessage[_0xd028('0xc')]({'where':{'WhatsappInteractionId':_0x5094d8['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd028('0x8')](function(_0x1211c6){_0x5094d8[_0xd028('0x9')](_0xd028('0xd'),_0x1211c6['length']);WhatsappInteractionEvents[_0xd028('0xe')](_0x67d150+':'+_0x5094d8['id'],_0x5094d8);WhatsappInteractionEvents[_0xd028('0xe')](_0x67d150,_0x5094d8);_0x4592fd(null);})[_0xd028('0xf')](_0x4592fd(null));};}for(var e in events){if(events[_0xd028('0x10')](e)){var event=events[e];WhatsappInteraction[_0xd028('0x11')](e,emitEvent(event));}}module[_0xd028('0x12')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index beea827..92b35b5 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 _0x04dc=['./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','moment','bluebird','rimraf','../../config/environment'];(function(_0x2e03ad,_0x2ef74e){var _0x1fdbcb=function(_0x3a1d03){while(--_0x3a1d03){_0x2e03ad['push'](_0x2e03ad['shift']());}};_0x1fdbcb(++_0x2ef74e);}(_0x04dc,0xa3));var _0xc04d=function(_0x24106c,_0x367a6f){_0x24106c=_0x24106c-0x0;var _0xbaeb73=_0x04dc[_0x24106c];return _0xbaeb73;};'use strict';var _=require('lodash');var util=require(_0xc04d('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc04d('0x1'));var BPromise=require(_0xc04d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc04d('0x3'));var config=require(_0xc04d('0x4'));var attributes=require(_0xc04d('0x5'));module['exports']=function(_0x70800c,_0x344d99){return _0x70800c[_0xc04d('0x6')](_0xc04d('0x7'),attributes,{'tableName':_0xc04d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3c38f5,_0x578799,_0x430acb){if(_0x3c38f5[_0xc04d('0x9')](_0xc04d('0xa'))){_0x3c38f5[_0xc04d('0xb')]=moment()[_0xc04d('0xc')](_0xc04d('0xd'));}_0x430acb(null,_0x3c38f5);}}});}; \ No newline at end of file +var _0x98b6=['rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x54ed16,_0x50670d){var _0x9f6748=function(_0x6a590a){while(--_0x6a590a){_0x54ed16['push'](_0x54ed16['shift']());}};_0x9f6748(++_0x50670d);}(_0x98b6,0x11a));var _0x698b=function(_0x246fff,_0x4df107){_0x246fff=_0x246fff-0x0;var _0x343bf1=_0x98b6[_0x246fff];return _0x343bf1;};'use strict';var _=require(_0x698b('0x0'));var util=require(_0x698b('0x1'));var logger=require(_0x698b('0x2'))('api');var moment=require(_0x698b('0x3'));var BPromise=require('bluebird');var rp=require(_0x698b('0x4'));var fs=require('fs');var path=require(_0x698b('0x5'));var rimraf=require(_0x698b('0x6'));var config=require(_0x698b('0x7'));var attributes=require(_0x698b('0x8'));module[_0x698b('0x9')]=function(_0x38db68,_0x8f6cc9){return _0x38db68[_0x698b('0xa')]('WhatsappInteraction',attributes,{'tableName':_0x698b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x14319b,_0x581cad,_0x19f4dd){if(_0x14319b[_0x698b('0xc')](_0x698b('0xd'))){_0x14319b[_0x698b('0xe')]=moment()['format'](_0x698b('0xf'));}_0x19f4dd(null,_0x14319b);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index cd61415..02cdd06 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 _0xcc63=['addTags','body','omit','ids','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','options','raw','where','attributes','limit','stringify','AddTagsToWhatsappInteraction'];(function(_0x50cd41,_0x4874a7){var _0x399475=function(_0x1946da){while(--_0x1946da){_0x50cd41['push'](_0x50cd41['shift']());}};_0x399475(++_0x4874a7);}(_0xcc63,0x181));var _0x3cc6=function(_0x572d1b,_0x588fdd){_0x572d1b=_0x572d1b-0x0;var _0x4f1b01=_0xcc63[_0x572d1b];return _0x4f1b01;};'use strict';var _=require(_0x3cc6('0x0'));var util=require(_0x3cc6('0x1'));var moment=require(_0x3cc6('0x2'));var BPromise=require('bluebird');var rs=require(_0x3cc6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3cc6('0x4'))['db'];var utils=require(_0x3cc6('0x5'));var logger=require('../../config/logger')(_0x3cc6('0x6'));var config=require('../../config/environment');var jayson=require(_0x3cc6('0x7'));var client=jayson[_0x3cc6('0x8')]['http']({'port':0x232a});config[_0x3cc6('0x9')]=_[_0x3cc6('0xa')](config[_0x3cc6('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3cc6('0x9')]));require(_0x3cc6('0xb'))[_0x3cc6('0xc')](socket);function respondWithRpcPromise(_0x525ef7,_0x2e2e49,_0x135c04){return new BPromise(function(_0x5b3d0a,_0x42c691){return client[_0x3cc6('0xd')](_0x525ef7,_0x135c04)[_0x3cc6('0xe')](function(_0xe3c035){logger[_0x3cc6('0xf')](_0x3cc6('0x10'),_0x2e2e49,_0x3cc6('0x11'));logger[_0x3cc6('0x12')](_0x3cc6('0x13'),_0x2e2e49,_0x3cc6('0x11'),JSON['stringify'](_0xe3c035));if(_0xe3c035[_0x3cc6('0x14')]){if(_0xe3c035['error']['code']===0x1f4){logger['error'](_0x3cc6('0x10'),_0x2e2e49,_0xe3c035['error']['message']);return _0x42c691(_0xe3c035[_0x3cc6('0x14')][_0x3cc6('0x15')]);}logger[_0x3cc6('0x14')](_0x3cc6('0x10'),_0x2e2e49,_0xe3c035[_0x3cc6('0x14')]['message']);return _0x5b3d0a(_0xe3c035[_0x3cc6('0x14')][_0x3cc6('0x15')]);}else{logger[_0x3cc6('0xf')](_0x3cc6('0x10'),_0x2e2e49,_0x3cc6('0x11'));_0x5b3d0a(_0xe3c035[_0x3cc6('0x16')]['message']);}})[_0x3cc6('0x17')](function(_0x425b71){logger[_0x3cc6('0x14')](_0x3cc6('0x10'),_0x2e2e49,_0x425b71);_0x42c691(_0x425b71);});});}exports[_0x3cc6('0x18')]=function(_0x5abe98){var _0x4016f6=this;return new Promise(function(_0x227046,_0x211a51){return db[_0x3cc6('0x19')]['update'](_0x5abe98['body'],{'raw':_0x5abe98[_0x3cc6('0x1a')]?_0x5abe98[_0x3cc6('0x1a')][_0x3cc6('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5abe98[_0x3cc6('0x1a')]?_0x5abe98[_0x3cc6('0x1a')][_0x3cc6('0x1c')]||null:null,'attributes':_0x5abe98[_0x3cc6('0x1a')]?_0x5abe98['options'][_0x3cc6('0x1d')]||null:null,'limit':_0x5abe98[_0x3cc6('0x1a')]?_0x5abe98['options'][_0x3cc6('0x1e')]||null:null})['then'](function(_0x392b06){logger[_0x3cc6('0xf')](_0x3cc6('0x18'),_0x5abe98);logger[_0x3cc6('0x12')](_0x3cc6('0x18'),_0x5abe98,JSON[_0x3cc6('0x1f')](_0x392b06));_0x227046(_0x392b06);})[_0x3cc6('0x17')](function(_0x2ddfb8){logger[_0x3cc6('0x14')](_0x3cc6('0x18'),_0x2ddfb8[_0x3cc6('0x15')],_0x5abe98);_0x211a51(_0x4016f6['error'](0x1f4,_0x2ddfb8[_0x3cc6('0x15')]));});});};exports[_0x3cc6('0x20')]=function(_0x475288){return new Promise(function(_0x25a233,_0x4062b3){return db[_0x3cc6('0x19')]['find']({'where':_0x475288[_0x3cc6('0x1a')]?_0x475288[_0x3cc6('0x1a')]['where']||null:null})['then'](function(_0x599a19){if(_0x599a19){return _0x599a19[_0x3cc6('0x21')](_0x475288[_0x3cc6('0x22')]['ids'],_[_0x3cc6('0x23')](_0x475288['body'],[_0x3cc6('0x24'),'id'])||{});}})['spread'](function(_0x2fa742){logger['info']('AddTags',_0x475288);logger[_0x3cc6('0x12')](_0x3cc6('0x25'),_0x475288,JSON[_0x3cc6('0x1f')](_0x2fa742));_0x25a233(_0x2fa742);})[_0x3cc6('0x17')](function(_0xfa7cd1){logger['error'](_0x3cc6('0x25'),_0xfa7cd1[_0x3cc6('0x15')],_0x475288);_0x4062b3(_this[_0x3cc6('0x14')](0x1f4,_0xfa7cd1[_0x3cc6('0x15')]));});});}; \ No newline at end of file +var _0x18eb=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','request\x20sent','debug','error','code','WhatsappInteraction,\x20%s,\x20%s','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','stringify','message','AddTagsToWhatsappInteraction','ids','omit','spread','AddTags','lodash','util','moment','bluebird'];(function(_0x1e2f72,_0x4ecd3d){var _0x2f00a8=function(_0xf1ee63){while(--_0xf1ee63){_0x1e2f72['push'](_0x1e2f72['shift']());}};_0x2f00a8(++_0x4ecd3d);}(_0x18eb,0x1aa));var _0xb18e=function(_0x233602,_0x346abe){_0x233602=_0x233602-0x0;var _0x1f761b=_0x18eb[_0x233602];return _0x1f761b;};'use strict';var _=require(_0xb18e('0x0'));var util=require(_0xb18e('0x1'));var moment=require(_0xb18e('0x2'));var BPromise=require(_0xb18e('0x3'));var rs=require(_0xb18e('0x4'));var fs=require('fs');var Redis=require(_0xb18e('0x5'));var db=require(_0xb18e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb18e('0x7'))(_0xb18e('0x8'));var config=require(_0xb18e('0x9'));var jayson=require(_0xb18e('0xa'));var client=jayson[_0xb18e('0xb')]['http']({'port':0x232a});config[_0xb18e('0xc')]=_[_0xb18e('0xd')](config['redis'],{'host':_0xb18e('0xe'),'port':0x18eb});var socket=require(_0xb18e('0xf'))(new Redis(config[_0xb18e('0xc')]));require(_0xb18e('0x10'))[_0xb18e('0x11')](socket);function respondWithRpcPromise(_0x20b83f,_0x466939,_0x4d36b3){return new BPromise(function(_0x5207ca,_0x4ffe5f){return client['request'](_0x20b83f,_0x4d36b3)[_0xb18e('0x12')](function(_0x209eb5){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x466939,_0xb18e('0x13'));logger[_0xb18e('0x14')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x466939,_0xb18e('0x13'),JSON['stringify'](_0x209eb5));if(_0x209eb5[_0xb18e('0x15')]){if(_0x209eb5[_0xb18e('0x15')][_0xb18e('0x16')]===0x1f4){logger[_0xb18e('0x15')](_0xb18e('0x17'),_0x466939,_0x209eb5[_0xb18e('0x15')]['message']);return _0x4ffe5f(_0x209eb5[_0xb18e('0x15')]['message']);}logger[_0xb18e('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x466939,_0x209eb5[_0xb18e('0x15')]['message']);return _0x5207ca(_0x209eb5[_0xb18e('0x15')]['message']);}else{logger[_0xb18e('0x18')](_0xb18e('0x17'),_0x466939,_0xb18e('0x13'));_0x5207ca(_0x209eb5[_0xb18e('0x19')]['message']);}})[_0xb18e('0x1a')](function(_0x235881){logger[_0xb18e('0x15')](_0xb18e('0x17'),_0x466939,_0x235881);_0x4ffe5f(_0x235881);});});}exports[_0xb18e('0x1b')]=function(_0x489d4a){var _0x364020=this;return new Promise(function(_0x4cfb38,_0x2930f0){return db[_0xb18e('0x1c')][_0xb18e('0x1d')](_0x489d4a[_0xb18e('0x1e')],{'raw':_0x489d4a[_0xb18e('0x1f')]?_0x489d4a[_0xb18e('0x1f')][_0xb18e('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x489d4a[_0xb18e('0x1f')]?_0x489d4a[_0xb18e('0x1f')][_0xb18e('0x21')]||null:null,'attributes':_0x489d4a[_0xb18e('0x1f')]?_0x489d4a[_0xb18e('0x1f')][_0xb18e('0x22')]||null:null,'limit':_0x489d4a[_0xb18e('0x1f')]?_0x489d4a[_0xb18e('0x1f')][_0xb18e('0x23')]||null:null})[_0xb18e('0x12')](function(_0x3ab279){logger['info']('UpdateWhatsappInteraction',_0x489d4a);logger[_0xb18e('0x14')]('UpdateWhatsappInteraction',_0x489d4a,JSON[_0xb18e('0x24')](_0x3ab279));_0x4cfb38(_0x3ab279);})[_0xb18e('0x1a')](function(_0xbb8161){logger['error'](_0xb18e('0x1b'),_0xbb8161[_0xb18e('0x25')],_0x489d4a);_0x2930f0(_0x364020[_0xb18e('0x15')](0x1f4,_0xbb8161['message']));});});};exports[_0xb18e('0x26')]=function(_0x135c29){return new Promise(function(_0x1cedfb,_0x41b576){return db[_0xb18e('0x1c')]['find']({'where':_0x135c29[_0xb18e('0x1f')]?_0x135c29[_0xb18e('0x1f')][_0xb18e('0x21')]||null:null})['then'](function(_0x3e8d72){if(_0x3e8d72){return _0x3e8d72['addTags'](_0x135c29[_0xb18e('0x1e')][_0xb18e('0x27')],_[_0xb18e('0x28')](_0x135c29['body'],[_0xb18e('0x27'),'id'])||{});}})[_0xb18e('0x29')](function(_0x334d34){logger[_0xb18e('0x18')]('AddTags',_0x135c29);logger['debug'](_0xb18e('0x2a'),_0x135c29,JSON['stringify'](_0x334d34));_0x1cedfb(_0x334d34);})['catch'](function(_0x508236){logger[_0xb18e('0x15')]('AddTags',_0x508236['message'],_0x135c29);_0x41b576(_this[_0xb18e('0x15')](0x1f4,_0x508236[_0xb18e('0x25')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index b9ac5aa..265318d 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 _0xae1b=['save','remove','update','emit','removeListener','register','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x51d1d7,_0x4fcbd8){var _0x1bdbdf=function(_0x506a29){while(--_0x506a29){_0x51d1d7['push'](_0x51d1d7['shift']());}};_0x1bdbdf(++_0x4fcbd8);}(_0xae1b,0xaf));var _0xbae1=function(_0x140b2f,_0x4109b1){_0x140b2f=_0x140b2f-0x0;var _0x196108=_0xae1b[_0x140b2f];return _0x196108;};'use strict';var WhatsappInteractionEvents=require(_0xbae1('0x0'));var events=[_0xbae1('0x1'),_0xbae1('0x2'),_0xbae1('0x3')];function createListener(_0xed711d,_0x902c11){return function(_0x3a3f1c){_0x902c11[_0xbae1('0x4')](_0xed711d,_0x3a3f1c);};}function removeListener(_0x16e2cb,_0x154d8f){return function(){WhatsappInteractionEvents[_0xbae1('0x5')](_0x16e2cb,_0x154d8f);};}exports[_0xbae1('0x6')]=function(_0x4cf8dc){for(var _0x25609a=0x0,_0x39d301=events['length'];_0x25609a<_0x39d301;_0x25609a++){var _0x1510c5=events[_0x25609a];var _0x220d7b=createListener(_0xbae1('0x7')+_0x1510c5,_0x4cf8dc);WhatsappInteractionEvents['on'](_0x1510c5,_0x220d7b);}}; \ No newline at end of file +var _0x0154=['length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update','register'];(function(_0x48933b,_0xe0b5c){var _0x25dc33=function(_0x24db54){while(--_0x24db54){_0x48933b['push'](_0x48933b['shift']());}};_0x25dc33(++_0xe0b5c);}(_0x0154,0xf7));var _0x4015=function(_0x323928,_0x4ada6c){_0x323928=_0x323928-0x0;var _0x430965=_0x0154[_0x323928];return _0x430965;};'use strict';var WhatsappInteractionEvents=require(_0x4015('0x0'));var events=[_0x4015('0x1'),_0x4015('0x2'),_0x4015('0x3')];function createListener(_0x259194,_0x5b212f){return function(_0x2966e8){_0x5b212f['emit'](_0x259194,_0x2966e8);};}function removeListener(_0x356b5f,_0x592004){return function(){WhatsappInteractionEvents['removeListener'](_0x356b5f,_0x592004);};}exports[_0x4015('0x4')]=function(_0x5bb83d){for(var _0x5e8ec0=0x0,_0x2829ca=events[_0x4015('0x5')];_0x5e8ec0<_0x2829ca;_0x5e8ec0++){var _0x5d1210=events[_0x5e8ec0];var _0x4a98e7=createListener(_0x4015('0x6')+_0x5d1210,_0x5bb83d);WhatsappInteractionEvents['on'](_0x5d1210,_0x4a98e7);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index b16337f..185328f 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 _0x6a8c=['delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','get','/describe','/:id','post','tracked','whatsappmessage:create','create','/:id/status','status','put','/:id/accept','reject'];(function(_0x33efc2,_0x43e4d4){var _0x1e3bfd=function(_0x545ece){while(--_0x545ece){_0x33efc2['push'](_0x33efc2['shift']());}};_0x1e3bfd(++_0x43e4d4);}(_0x6a8c,0xca));var _0xc6a8=function(_0x25e32c,_0x416d76){_0x25e32c=_0x25e32c-0x0;var _0x4318d3=_0x6a8c[_0x25e32c];return _0x4318d3;};'use strict';var multer=require(_0xc6a8('0x0'));var util=require(_0xc6a8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc6a8('0x2'));var router=express[_0xc6a8('0x3')]();var fs_extra=require(_0xc6a8('0x4'));var auth=require(_0xc6a8('0x5'));var interaction=require(_0xc6a8('0x6'));var config=require(_0xc6a8('0x7'));var controller=require(_0xc6a8('0x8'));router['get']('/',auth[_0xc6a8('0x9')](),controller[_0xc6a8('0xa')]);router[_0xc6a8('0xb')](_0xc6a8('0xc'),auth[_0xc6a8('0x9')](),controller['describe']);router[_0xc6a8('0xb')](_0xc6a8('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xc6a8('0xe')]('/',auth[_0xc6a8('0x9')](),interaction[_0xc6a8('0xf')]('whatsapp',_0xc6a8('0x10')),controller[_0xc6a8('0x11')]);router[_0xc6a8('0xe')](_0xc6a8('0x12'),controller[_0xc6a8('0x13')]);router[_0xc6a8('0x14')](_0xc6a8('0xd'),auth[_0xc6a8('0x9')](),controller['update']);router[_0xc6a8('0x14')](_0xc6a8('0x15'),auth[_0xc6a8('0x9')](),controller['accept']);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0xc6a8('0x16')]);router[_0xc6a8('0x17')](_0xc6a8('0xd'),auth[_0xc6a8('0x9')](),controller['destroy']);module[_0xc6a8('0x18')]=router; \ No newline at end of file +var _0xb2dc=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','index','describe','/:id','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','update','/:id/accept','accept','/:id/reject','delete','destroy','multer','path','connect-timeout','express'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb2dc,0x140));var _0xcb2d=function(_0x574de6,_0x558a28){_0x574de6=_0x574de6-0x0;var _0x4008d9=_0xb2dc[_0x574de6];return _0x4008d9;};'use strict';var multer=require(_0xcb2d('0x0'));var util=require('util');var path=require(_0xcb2d('0x1'));var timeout=require(_0xcb2d('0x2'));var express=require(_0xcb2d('0x3'));var router=express[_0xcb2d('0x4')]();var fs_extra=require(_0xcb2d('0x5'));var auth=require(_0xcb2d('0x6'));var interaction=require(_0xcb2d('0x7'));var config=require('../../config/environment');var controller=require(_0xcb2d('0x8'));router[_0xcb2d('0x9')]('/',auth[_0xcb2d('0xa')](),controller[_0xcb2d('0xb')]);router['get']('/describe',auth[_0xcb2d('0xa')](),controller[_0xcb2d('0xc')]);router[_0xcb2d('0x9')](_0xcb2d('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xcb2d('0xe')]('/',auth[_0xcb2d('0xa')](),interaction[_0xcb2d('0xf')](_0xcb2d('0x10'),_0xcb2d('0x11')),controller[_0xcb2d('0x12')]);router[_0xcb2d('0xe')](_0xcb2d('0x13'),controller['status']);router[_0xcb2d('0x14')](_0xcb2d('0xd'),auth[_0xcb2d('0xa')](),controller[_0xcb2d('0x15')]);router['put'](_0xcb2d('0x16'),auth['isAuthenticated'](),controller[_0xcb2d('0x17')]);router[_0xcb2d('0x14')](_0xcb2d('0x18'),auth[_0xcb2d('0xa')](),controller['reject']);router[_0xcb2d('0x19')](_0xcb2d('0xd'),auth[_0xcb2d('0xa')](),controller[_0xcb2d('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 42d158c..c0cfdca 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 _0x59a8=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x59a8,0x100));var _0x859a=function(_0x399787,_0x12a685){_0x399787=_0x399787-0x0;var _0x494fde=_0x59a8[_0x399787];return _0x494fde;};'use strict';var Sequelize=require(_0x859a('0x0'));module[_0x859a('0x1')]={'body':{'type':Sequelize[_0x859a('0x2')](_0x859a('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x859a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x859a('0x5')]('in',_0x859a('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x859a('0x7')](0xbe)},'phone':{'type':Sequelize[_0x859a('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x859a('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3cb7=['medium','BOOLEAN','ENUM','out','STRING','DATE','TEXT','sequelize','exports'];(function(_0x497e96,_0x35e67b){var _0x5db0a6=function(_0x1635cc){while(--_0x1635cc){_0x497e96['push'](_0x497e96['shift']());}};_0x5db0a6(++_0x35e67b);}(_0x3cb7,0x1ae));var _0x73cb=function(_0x51539c,_0x25f587){_0x51539c=_0x51539c-0x0;var _0x4f7914=_0x3cb7[_0x51539c];return _0x4f7914;};'use strict';var Sequelize=require(_0x73cb('0x0'));module[_0x73cb('0x1')]={'body':{'type':Sequelize['TEXT'](_0x73cb('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x73cb('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x73cb('0x4')]('in',_0x73cb('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x73cb('0x6')](0xbe)},'phone':{'type':Sequelize[_0x73cb('0x6')]},'readAt':{'type':Sequelize[_0x73cb('0x7')]},'secret':{'type':Sequelize[_0x73cb('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x73cb('0x6')]},'providerResponse':{'type':Sequelize[_0x73cb('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 24e145a..e6f9b99 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 _0x8e63=['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','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','stack','name','send','map','WhatsappMessage','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','filter','options','include','catch','show','params','includeAll','find','create','body','destroy','describe','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','format','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','fullname','internal','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8e63,0x1a1));var _0x38e6=function(_0xdd7d9e,_0x1c23c1){_0xdd7d9e=_0xdd7d9e-0x0;var _0x19f3d8=_0x8e63[_0xdd7d9e];return _0x19f3d8;};'use strict';var emlformat=require(_0x38e6('0x0'));var rimraf=require(_0x38e6('0x1'));var zipdir=require(_0x38e6('0x2'));var jsonpatch=require(_0x38e6('0x3'));var rp=require(_0x38e6('0x4'));var moment=require(_0x38e6('0x5'));var BPromise=require(_0x38e6('0x6'));var Mustache=require(_0x38e6('0x7'));var util=require(_0x38e6('0x8'));var path=require(_0x38e6('0x9'));var sox=require('sox');var csv=require(_0x38e6('0xa'));var ejs=require(_0x38e6('0xb'));var fs=require('fs');var fs_extra=require(_0x38e6('0xc'));var _=require(_0x38e6('0xd'));var squel=require(_0x38e6('0xe'));var crypto=require(_0x38e6('0xf'));var jsforce=require(_0x38e6('0x10'));var deskjs=require(_0x38e6('0x11'));var toCsv=require(_0x38e6('0xa'));var querystring=require(_0x38e6('0x12'));var Papa=require(_0x38e6('0x13'));var Redis=require(_0x38e6('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x38e6('0x15'));var as=require(_0x38e6('0x16'));var hardwareService=require(_0x38e6('0x17'));var logger=require(_0x38e6('0x18'))(_0x38e6('0x19'));var utils=require(_0x38e6('0x1a'));var config=require(_0x38e6('0x1b'));var licenseUtil=require(_0x38e6('0x1c'));var db=require(_0x38e6('0x1d'))['db'];config[_0x38e6('0x1e')]=_[_0x38e6('0x1f')](config[_0x38e6('0x1e')],{'host':'localhost','port':0x18eb});var socket=require(_0x38e6('0x20'))(new Redis(config['redis']));require(_0x38e6('0x21'))[_0x38e6('0x22')](socket);var jayson=require(_0x38e6('0x23'));var client=jayson[_0x38e6('0x24')][_0x38e6('0x25')]({'port':0x232c});var client9002=jayson['client'][_0x38e6('0x25')]({'port':0x232a});function respondWithRpcPromise(_0x278370,_0xb218da,_0x4c66ff,_0x1d59f6){return new BPromise(function(_0x710bc1,_0x4dea3c){var _0x5b1800=_0x1d59f6||client;return _0x5b1800[_0x38e6('0x26')](_0x278370,_0x4c66ff)[_0x38e6('0x27')](function(_0x52ae47){logger[_0x38e6('0x28')](_0x38e6('0x29'),_0xb218da,_0x38e6('0x2a'));logger[_0x38e6('0x2b')](_0x38e6('0x2c'),_0xb218da,_0x38e6('0x2a'),JSON[_0x38e6('0x2d')](_0x52ae47));if(_0x52ae47[_0x38e6('0x2e')]){if(_0x52ae47[_0x38e6('0x2e')]['code']===0x1f4){logger[_0x38e6('0x2e')](_0x38e6('0x29'),_0xb218da,_0x52ae47[_0x38e6('0x2e')][_0x38e6('0x2f')]);return _0x4dea3c(_0x52ae47[_0x38e6('0x2e')][_0x38e6('0x2f')]);}logger[_0x38e6('0x2e')]('WhatsappMessage,\x20%s,\x20%s',_0xb218da,_0x52ae47[_0x38e6('0x2e')][_0x38e6('0x2f')]);return _0x710bc1(_0x52ae47['error']['message']);}else{logger[_0x38e6('0x28')](_0x38e6('0x29'),_0xb218da,_0x38e6('0x2a'));_0x710bc1(_0x52ae47['result']['message']);}})['catch'](function(_0x464d03){logger[_0x38e6('0x2e')](_0x38e6('0x29'),_0xb218da,_0x464d03);_0x4dea3c(_0x464d03);});});}function respondWithStatusCode(_0x26b678,_0x1b2c52){_0x1b2c52=_0x1b2c52||0xcc;return function(_0x450a02){if(_0x450a02){return _0x26b678[_0x38e6('0x30')](_0x1b2c52);}return _0x26b678[_0x38e6('0x31')](_0x1b2c52)[_0x38e6('0x32')]();};}function respondWithResult(_0x9f60c,_0x287b0d){_0x287b0d=_0x287b0d||0xc8;return function(_0x152b6c){if(_0x152b6c){return _0x9f60c[_0x38e6('0x31')](_0x287b0d)[_0x38e6('0x33')](_0x152b6c);}};}function respondWithFilteredResult(_0x59c91a,_0x38f36c){return function(_0x2a90b3){if(_0x2a90b3){var _0x14549e=typeof _0x38f36c[_0x38e6('0x34')]===_0x38e6('0x35')&&typeof _0x38f36c[_0x38e6('0x36')]===_0x38e6('0x35');var _0x19d469=_0x2a90b3[_0x38e6('0x37')];var _0x5950d5=_0x14549e?0x0:_0x38f36c['offset'];var _0x2555d9=_0x14549e?_0x2a90b3[_0x38e6('0x37')]:_0x38f36c['offset']+_0x38f36c['limit'];var _0x4937e7;if(_0x2555d9>=_0x19d469){_0x2555d9=_0x19d469;_0x4937e7=0xc8;}else{_0x4937e7=0xce;}_0x59c91a[_0x38e6('0x31')](_0x4937e7);return _0x59c91a[_0x38e6('0x38')](_0x38e6('0x39'),_0x5950d5+'-'+_0x2555d9+'/'+_0x19d469)[_0x38e6('0x33')](_0x2a90b3);}return null;};}function patchUpdates(_0xba137){return function(_0x405851){try{jsonpatch[_0x38e6('0x3a')](_0x405851,_0xba137,!![]);}catch(_0x3a53f6){return BPromise['reject'](_0x3a53f6);}return _0x405851[_0x38e6('0x3b')]();};}function saveUpdates(_0x5dc671,_0x12d488){return function(_0x6c3e6e){if(_0x6c3e6e){return _0x6c3e6e[_0x38e6('0x3c')](_0x5dc671)[_0x38e6('0x27')](function(_0x2eca21){return _0x2eca21;});}return null;};}function removeEntity(_0x183441,_0x51f544){return function(_0x559c5b){if(_0x559c5b){return _0x559c5b['destroy']()[_0x38e6('0x27')](function(){_0x183441['status'](0xcc)[_0x38e6('0x32')]();});}};}function handleEntityNotFound(_0x31f159,_0x51a0a8){return function(_0x475d72){if(!_0x475d72){_0x31f159[_0x38e6('0x30')](0x194);}return _0x475d72;};}function handleError(_0xb54e86,_0x30bcb8){_0x30bcb8=_0x30bcb8||0x1f4;return function(_0xf136da){logger['error'](_0xf136da[_0x38e6('0x3d')]);if(_0xf136da[_0x38e6('0x3e')]){delete _0xf136da[_0x38e6('0x3e')];}_0xb54e86[_0x38e6('0x31')](_0x30bcb8)[_0x38e6('0x3f')](_0xf136da);};}exports['index']=function(_0x39b14c,_0x1c0f9a){var _0xa9b168={},_0x245f40={},_0x569780={'count':0x0,'rows':[]};var _0x267c3f=_[_0x38e6('0x40')](db[_0x38e6('0x41')][_0x38e6('0x42')],function(_0x32a46d){return{'name':_0x32a46d[_0x38e6('0x43')],'type':_0x32a46d['type'][_0x38e6('0x44')]};});_0x245f40[_0x38e6('0x45')]=_[_0x38e6('0x40')](_0x267c3f,_0x38e6('0x3e'));_0x245f40['query']=_[_0x38e6('0x46')](_0x39b14c[_0x38e6('0x47')]);_0x245f40[_0x38e6('0x48')]=_['intersection'](_0x245f40[_0x38e6('0x45')],_0x245f40['query']);_0xa9b168[_0x38e6('0x49')]=_[_0x38e6('0x4a')](_0x245f40['model'],qs[_0x38e6('0x4b')](_0x39b14c[_0x38e6('0x47')][_0x38e6('0x4b')]));_0xa9b168[_0x38e6('0x49')]=_0xa9b168['attributes'][_0x38e6('0x4c')]?_0xa9b168[_0x38e6('0x49')]:_0x245f40[_0x38e6('0x45')];if(!_0x39b14c[_0x38e6('0x47')][_0x38e6('0x4d')](_0x38e6('0x4e'))){_0xa9b168[_0x38e6('0x36')]=qs[_0x38e6('0x36')](_0x39b14c[_0x38e6('0x47')][_0x38e6('0x36')]);_0xa9b168['offset']=qs[_0x38e6('0x34')](_0x39b14c['query'][_0x38e6('0x34')]);}_0xa9b168[_0x38e6('0x4f')]=qs['sort'](_0x39b14c['query'][_0x38e6('0x50')]);_0xa9b168[_0x38e6('0x51')]=qs['filters'](_['pick'](_0x39b14c[_0x38e6('0x47')],_0x245f40[_0x38e6('0x48')]),_0x267c3f);if(_0x39b14c[_0x38e6('0x47')]['filter']){_0xa9b168[_0x38e6('0x51')]=_[_0x38e6('0x52')](_0xa9b168['where'],{'$or':_[_0x38e6('0x40')](_0x267c3f,function(_0x6dd5e2){if(_0x6dd5e2[_0x38e6('0x53')]!=='VIRTUAL'){var _0x1cc0c3={};_0x1cc0c3[_0x6dd5e2['name']]={'$like':'%'+_0x39b14c[_0x38e6('0x47')][_0x38e6('0x54')]+'%'};return _0x1cc0c3;}})});}_0xa9b168=_[_0x38e6('0x52')]({},_0xa9b168,_0x39b14c[_0x38e6('0x55')]);var _0x1e99cc={'where':_0xa9b168['where']};return db[_0x38e6('0x41')][_0x38e6('0x37')](_0x1e99cc)[_0x38e6('0x27')](function(_0x5d2e7a){_0x569780['count']=_0x5d2e7a;if(_0x39b14c['query']['includeAll']){_0xa9b168[_0x38e6('0x56')]=[{'all':!![]}];}return db[_0x38e6('0x41')]['findAll'](_0xa9b168);})['then'](function(_0x39c620){_0x569780['rows']=_0x39c620;return _0x569780;})[_0x38e6('0x27')](respondWithFilteredResult(_0x1c0f9a,_0xa9b168))[_0x38e6('0x57')](handleError(_0x1c0f9a,null));};exports[_0x38e6('0x58')]=function(_0x106bfb,_0x4aeed8){var _0x1ed839={'raw':!![],'where':{'id':_0x106bfb[_0x38e6('0x59')]['id']}},_0x531891={};_0x531891['model']=_[_0x38e6('0x46')](db[_0x38e6('0x41')]['rawAttributes']);_0x531891[_0x38e6('0x47')]=_[_0x38e6('0x46')](_0x106bfb[_0x38e6('0x47')]);_0x531891[_0x38e6('0x48')]=_[_0x38e6('0x4a')](_0x531891[_0x38e6('0x45')],_0x531891[_0x38e6('0x47')]);_0x1ed839[_0x38e6('0x49')]=_[_0x38e6('0x4a')](_0x531891[_0x38e6('0x45')],qs[_0x38e6('0x4b')](_0x106bfb[_0x38e6('0x47')][_0x38e6('0x4b')]));_0x1ed839[_0x38e6('0x49')]=_0x1ed839[_0x38e6('0x49')]['length']?_0x1ed839['attributes']:_0x531891[_0x38e6('0x45')];if(_0x106bfb[_0x38e6('0x47')][_0x38e6('0x5a')]){_0x1ed839['include']=[{'all':!![]}];}_0x1ed839=_['merge']({},_0x1ed839,_0x106bfb['options']);return db[_0x38e6('0x41')][_0x38e6('0x5b')](_0x1ed839)[_0x38e6('0x27')](handleEntityNotFound(_0x4aeed8,null))[_0x38e6('0x27')](respondWithResult(_0x4aeed8,null))[_0x38e6('0x57')](handleError(_0x4aeed8,null));};exports[_0x38e6('0x5c')]=function(_0xda47e0,_0xa45536){return db[_0x38e6('0x41')]['create'](_0xda47e0['body'],{})['then'](respondWithResult(_0xa45536,0xc9))[_0x38e6('0x57')](handleError(_0xa45536,null));};exports[_0x38e6('0x3c')]=function(_0x5ac8b0,_0x215651){if(_0x5ac8b0[_0x38e6('0x5d')]['id']){delete _0x5ac8b0[_0x38e6('0x5d')]['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x5ac8b0[_0x38e6('0x59')]['id']}})[_0x38e6('0x27')](handleEntityNotFound(_0x215651,null))['then'](saveUpdates(_0x5ac8b0[_0x38e6('0x5d')],null))['then'](respondWithResult(_0x215651,null))['catch'](handleError(_0x215651,null));};exports[_0x38e6('0x5e')]=function(_0x5a7ae4,_0x1142e5){return db[_0x38e6('0x41')][_0x38e6('0x5b')]({'where':{'id':_0x5a7ae4[_0x38e6('0x59')]['id']}})['then'](handleEntityNotFound(_0x1142e5,null))['then'](removeEntity(_0x1142e5,null))[_0x38e6('0x57')](handleError(_0x1142e5,null));};exports[_0x38e6('0x5f')]=function(_0x2beefa,_0x290f04){return db[_0x38e6('0x41')][_0x38e6('0x5f')]()['then'](respondWithResult(_0x290f04,null))['catch'](handleError(_0x290f04,null));};var interaction_log=require(_0x38e6('0x18'))('whatsapp-interactions');exports['accept']=function(_0x173e1d,_0x16f39e,_0xb5fc86){var _0x36ac7f={'agent':{},'channel':'whatsapp'};if(_0x173e1d[_0x38e6('0x5d')]['id']){delete _0x173e1d[_0x38e6('0x5d')]['id'];}_0x173e1d['body'][_0x38e6('0x60')]=!![];_0x173e1d[_0x38e6('0x5d')][_0x38e6('0x61')]=moment()['format'](_0x38e6('0x62'));_0x173e1d['body'][_0x38e6('0x63')]=_0x173e1d[_0x38e6('0x5d')][_0x38e6('0x63')]||_0x173e1d[_0x38e6('0x64')]['id'];_0x36ac7f[_0x38e6('0x65')]['id']=_0x173e1d[_0x38e6('0x5d')][_0x38e6('0x63')];return db['WhatsappMessage'][_0x38e6('0x5b')]({'where':{'id':_0x173e1d[_0x38e6('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x16f39e,null))['then'](saveUpdates(_0x173e1d[_0x38e6('0x5d')],null))['then'](function(_0x17cb31){if(_0x17cb31){_0x36ac7f[_0x38e6('0x2f')]=_0x17cb31[_0x38e6('0x66')]({'plain':!![]});return db[_0x38e6('0x67')][_0x38e6('0x5b')]({'where':{'id':_0x17cb31[_0x38e6('0x68')]}});}return null;})[_0x38e6('0x27')](handleEntityNotFound(_0x16f39e,null))[_0x38e6('0x27')](function(_0xbc9bb9){if(_0xbc9bb9){return _0xbc9bb9['update']({'UserId':_0x173e1d[_0x38e6('0x5d')][_0x38e6('0x63')],'read1stAt':_[_0x38e6('0x69')](_0xbc9bb9[_0x38e6('0x6a')])?moment()[_0x38e6('0x6b')](_0x38e6('0x62')):undefined});}return null;})[_0x38e6('0x27')](function(_0x760764){if(_0x760764){_0x36ac7f[_0x38e6('0x6c')]=_0x760764[_0x38e6('0x66')]({'plain':!![]});interaction_log[_0x38e6('0x28')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x173e1d[_0x38e6('0x64')]['id'],_0x173e1d[_0x38e6('0x64')]['name'],_0x173e1d[_0x38e6('0x64')][_0x38e6('0x6d')],_0x36ac7f['interaction']['id'],_0x173e1d[_0x38e6('0x5d')]?JSON[_0x38e6('0x2d')](_0x173e1d[_0x38e6('0x5d')]):_0x38e6('0x6e'));return respondWithRpcPromise(_0x38e6('0x6f'),_0x38e6('0x70'),_0x36ac7f);}return null;})['then'](function(_0x3dcff4){var _0x10118f=_0x38e6('0x71')+_0x3dcff4['message'][_0x38e6('0x72')];return db[_0x38e6('0x73')][_0x38e6('0x47')](_0x10118f,{'type':db[_0x38e6('0x74')][_0x38e6('0x75')][_0x38e6('0x76')],'raw':!![]})[_0x38e6('0x27')](function(_0x22fa1b){return _0x22fa1b;});})[_0x38e6('0x27')](function(_0x29438b){if(_0x29438b){_0x36ac7f[_0x38e6('0x2f')][_0x38e6('0x77')]=_0x29438b[0x0];if(!_0x173e1d[_0x38e6('0x5d')][_0x38e6('0x63')])return;return db[_0x38e6('0x78')]['find']({'where':{'id':_0x173e1d[_0x38e6('0x5d')][_0x38e6('0x63')],'role':_0x38e6('0x65')},'attributes':['id',_0x38e6('0x3e'),'fullname',_0x38e6('0x79'),'internal'],'raw':!![]});}return null;})['then'](function(_0x4ba3e7){if(!_0x4ba3e7)return null;_0x36ac7f[_0x38e6('0x2f')][_0x38e6('0x65')]=_0x4ba3e7;return _0x36ac7f;})[_0x38e6('0x27')](function(_0x526ab3){if(_0x526ab3){if(_0x173e1d[_0x38e6('0x5d')][_0x38e6('0x7a')]){_0x36ac7f[_0x38e6('0x2f')][_0x38e6('0x7b')]=util['format'](_0x38e6('0x7c'),_0x173e1d['user'][_0x38e6('0x3e')]);_0x36ac7f['message'][_0x38e6('0x7d')]=_0x36ac7f['channel'];_0x36ac7f[_0x38e6('0x2f')][_0x38e6('0x7e')]=_0x36ac7f[_0x38e6('0x7d')];_0x36ac7f[_0x38e6('0x2f')][_0x38e6('0x7f')]=_0x38e6('0x80');return respondWithRpcPromise(_0x38e6('0x81'),_0x38e6('0x81'),{'event':'acceptmessage','message':_0x36ac7f[_0x38e6('0x2f')]},client9002)[_0x38e6('0x27')](function(){return _0x36ac7f;});}return _0x36ac7f;}return null;})['then'](respondWithResult(_0x16f39e,null))[_0x38e6('0x57')](handleError(_0x16f39e,null));};var interaction_log=require(_0x38e6('0x18'))('whatsapp-interactions');exports[_0x38e6('0x82')]=function(_0x5eb394,_0x4ffed7,_0x24bec6){var _0x392807={'agent':{},'channel':'whatsapp'};if(_0x5eb394[_0x38e6('0x5d')]['id']){delete _0x5eb394[_0x38e6('0x5d')]['id'];}_0x5eb394[_0x38e6('0x5d')]['UserId']=_0x5eb394[_0x38e6('0x5d')][_0x38e6('0x63')]||_0x5eb394[_0x38e6('0x64')]['id'];_0x392807[_0x38e6('0x65')]['id']=_0x5eb394[_0x38e6('0x5d')]['UserId'];return db[_0x38e6('0x41')][_0x38e6('0x5b')]({'where':{'id':_0x5eb394[_0x38e6('0x59')]['id'],'UserId':null}})[_0x38e6('0x27')](handleEntityNotFound(_0x4ffed7,null))[_0x38e6('0x27')](function(_0x54a34a){if(_0x54a34a){_0x392807['message']=_0x54a34a[_0x38e6('0x66')]({'plain':!![]});return db[_0x38e6('0x67')][_0x38e6('0x5b')]({'where':{'id':_0x54a34a[_0x38e6('0x68')]}});}return null;})[_0x38e6('0x27')](handleEntityNotFound(_0x4ffed7,null))[_0x38e6('0x27')](function(_0x241ad6){if(_0x241ad6){_0x392807['interaction']=_0x241ad6[_0x38e6('0x66')]({'plain':!![]});interaction_log[_0x38e6('0x28')](_0x38e6('0x83'),_0x5eb394[_0x38e6('0x64')]['id'],_0x5eb394[_0x38e6('0x64')][_0x38e6('0x3e')],_0x5eb394['user']['role'],_0x392807[_0x38e6('0x6c')]['id'],_0x5eb394['body']?JSON[_0x38e6('0x2d')](_0x5eb394[_0x38e6('0x5d')]):'null');return respondWithRpcPromise(_0x38e6('0x84'),'rejectMessage',_0x392807);}return null;})['then'](function(_0x3cbb40){var _0x16c917=_0x38e6('0x71')+_0x3cbb40['message'][_0x38e6('0x72')];return db[_0x38e6('0x73')][_0x38e6('0x47')](_0x16c917,{'type':db[_0x38e6('0x74')][_0x38e6('0x75')][_0x38e6('0x76')],'raw':!![]})[_0x38e6('0x27')](function(_0x1420e8){return _0x1420e8;});})[_0x38e6('0x27')](function(_0x3e5a0e){if(_0x3e5a0e){_0x392807[_0x38e6('0x2f')]['contact']=_0x3e5a0e[0x0];if(!_0x5eb394[_0x38e6('0x5d')][_0x38e6('0x63')])return;return db[_0x38e6('0x78')][_0x38e6('0x5b')]({'where':{'id':_0x5eb394[_0x38e6('0x5d')][_0x38e6('0x63')],'role':_0x38e6('0x65')},'attributes':['id',_0x38e6('0x3e'),_0x38e6('0x85'),_0x38e6('0x79'),_0x38e6('0x86')],'raw':!![]});}return null;})[_0x38e6('0x27')](function(_0x128471){if(!_0x128471)return null;_0x392807[_0x38e6('0x2f')]['agent']=_0x128471;return _0x392807;})[_0x38e6('0x27')](function(_0x3c8aae){if(_0x3c8aae){_0x3c8aae[_0x38e6('0x2f')][_0x38e6('0x7b')]=util[_0x38e6('0x6b')]('SIP/%s',_0x5eb394[_0x38e6('0x64')][_0x38e6('0x3e')]);_0x3c8aae[_0x38e6('0x2f')][_0x38e6('0x7d')]=_0x392807[_0x38e6('0x7d')];_0x3c8aae[_0x38e6('0x2f')][_0x38e6('0x7e')]=_0x392807[_0x38e6('0x7d')];_0x3c8aae['message'][_0x38e6('0x7f')]=_0x38e6('0x82');respondWithRpcPromise('EventManager',_0x38e6('0x81'),{'event':_0x38e6('0x87'),'message':_0x3c8aae['message']},client9002);return _0x392807;}return null;})['then'](respondWithResult(_0x4ffed7,null))['catch'](handleError(_0x4ffed7,null));};exports[_0x38e6('0x31')]=function(_0x14d8e8,_0x191c30,_0x497650){if(_0x14d8e8['body']['id']){delete _0x14d8e8['body']['id'];}var _0x40f7b0;return db['WhatsappMessage'][_0x38e6('0x5b')]({'where':{'id':_0x14d8e8[_0x38e6('0x59')]['id']}})[_0x38e6('0x27')](handleEntityNotFound(_0x191c30,null))[_0x38e6('0x27')](function(_0x2d61da){if(_0x2d61da){_0x40f7b0=_0x2d61da;return db[_0x38e6('0x88')][_0x38e6('0x5b')]({'where':{'id':_0x2d61da[_0x38e6('0x89')]}});}})[_0x38e6('0x27')](handleEntityNotFound(_0x191c30,null))[_0x38e6('0x27')](function(_0x112527){if(_0x112527){logger[_0x38e6('0x2b')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x38e6('0x31'),_0x38e6('0x8a'),_0x112527['type'],util[_0x38e6('0x8b')](_0x14d8e8['body'],{'showHidden':![],'depth':null}));switch(_0x112527['type']){case _0x38e6('0x8c'):if(_0x14d8e8[_0x38e6('0x5d')]['MessageSid']&&_0x14d8e8[_0x38e6('0x5d')][_0x38e6('0x8d')]===_0x40f7b0['messageId']&&_0x14d8e8[_0x38e6('0x5d')][_0x38e6('0x8e')]&&_0x14d8e8[_0x38e6('0x5d')][_0x38e6('0x8e')]===_0x38e6('0x60')){return _0x40f7b0[_0x38e6('0x3c')]({'read':!![]});}else{logger['error'](_0x38e6('0x8f'),_0x38e6('0x31'),_0x38e6('0x8c'),util['inspect'](_0x14d8e8[_0x38e6('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x40f7b0;}})['then'](respondWithResult(_0x191c30,null))[_0x38e6('0x57')](handleError(_0x191c30,null));}; \ No newline at end of file +var _0xca6b=['redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','create','body','describe','whatsapp-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','WhatsappInteraction','isNil','read1stAt','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT','User','fullname','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x44e1c5,_0x10bbaa){var _0x2e91e0=function(_0x4400f7){while(--_0x4400f7){_0x44e1c5['push'](_0x44e1c5['shift']());}};_0x2e91e0(++_0x10bbaa);}(_0xca6b,0x1a1));var _0xbca6=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xca6b[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0xbca6('0x0'));var rimraf=require(_0xbca6('0x1'));var zipdir=require(_0xbca6('0x2'));var jsonpatch=require(_0xbca6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbca6('0x4'));var Mustache=require('mustache');var util=require(_0xbca6('0x5'));var path=require(_0xbca6('0x6'));var sox=require(_0xbca6('0x7'));var csv=require(_0xbca6('0x8'));var ejs=require(_0xbca6('0x9'));var fs=require('fs');var fs_extra=require(_0xbca6('0xa'));var _=require(_0xbca6('0xb'));var squel=require('squel');var crypto=require(_0xbca6('0xc'));var jsforce=require(_0xbca6('0xd'));var deskjs=require(_0xbca6('0xe'));var toCsv=require(_0xbca6('0x8'));var querystring=require(_0xbca6('0xf'));var Papa=require(_0xbca6('0x10'));var Redis=require(_0xbca6('0x11'));var authService=require(_0xbca6('0x12'));var qs=require(_0xbca6('0x13'));var as=require(_0xbca6('0x14'));var hardwareService=require(_0xbca6('0x15'));var logger=require(_0xbca6('0x16'))(_0xbca6('0x17'));var utils=require(_0xbca6('0x18'));var config=require(_0xbca6('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xbca6('0x1a'))['db'];config[_0xbca6('0x1b')]=_[_0xbca6('0x1c')](config[_0xbca6('0x1b')],{'host':_0xbca6('0x1d'),'port':0x18eb});var socket=require(_0xbca6('0x1e'))(new Redis(config[_0xbca6('0x1b')]));require(_0xbca6('0x1f'))[_0xbca6('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0xbca6('0x21')]['http']({'port':0x232c});var client9002=jayson[_0xbca6('0x21')][_0xbca6('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x18b269,_0x4888ae,_0x4b0e8c,_0x33ff08){return new BPromise(function(_0x559a7e,_0x112064){var _0xc4f303=_0x33ff08||client;return _0xc4f303[_0xbca6('0x23')](_0x18b269,_0x4b0e8c)[_0xbca6('0x24')](function(_0x186b68){logger[_0xbca6('0x25')](_0xbca6('0x26'),_0x4888ae,'request\x20sent');logger[_0xbca6('0x27')](_0xbca6('0x28'),_0x4888ae,'request\x20sent',JSON[_0xbca6('0x29')](_0x186b68));if(_0x186b68[_0xbca6('0x2a')]){if(_0x186b68[_0xbca6('0x2a')][_0xbca6('0x2b')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x4888ae,_0x186b68[_0xbca6('0x2a')]['message']);return _0x112064(_0x186b68[_0xbca6('0x2a')]['message']);}logger[_0xbca6('0x2a')](_0xbca6('0x26'),_0x4888ae,_0x186b68[_0xbca6('0x2a')][_0xbca6('0x2c')]);return _0x559a7e(_0x186b68[_0xbca6('0x2a')][_0xbca6('0x2c')]);}else{logger[_0xbca6('0x25')](_0xbca6('0x26'),_0x4888ae,'request\x20sent');_0x559a7e(_0x186b68[_0xbca6('0x2d')][_0xbca6('0x2c')]);}})[_0xbca6('0x2e')](function(_0x298c6e){logger['error'](_0xbca6('0x26'),_0x4888ae,_0x298c6e);_0x112064(_0x298c6e);});});}function respondWithStatusCode(_0x32b38c,_0x48197a){_0x48197a=_0x48197a||0xcc;return function(_0x28b3a2){if(_0x28b3a2){return _0x32b38c[_0xbca6('0x2f')](_0x48197a);}return _0x32b38c[_0xbca6('0x30')](_0x48197a)[_0xbca6('0x31')]();};}function respondWithResult(_0x206e32,_0x5c36e4){_0x5c36e4=_0x5c36e4||0xc8;return function(_0x3dc78b){if(_0x3dc78b){return _0x206e32[_0xbca6('0x30')](_0x5c36e4)[_0xbca6('0x32')](_0x3dc78b);}};}function respondWithFilteredResult(_0x180ff4,_0xcb44c){return function(_0x5a12e5){if(_0x5a12e5){var _0x60fbe2=typeof _0xcb44c[_0xbca6('0x33')]===_0xbca6('0x34')&&typeof _0xcb44c['limit']===_0xbca6('0x34');var _0x16f678=_0x5a12e5['count'];var _0x1a79fb=_0x60fbe2?0x0:_0xcb44c['offset'];var _0x1a739b=_0x60fbe2?_0x5a12e5[_0xbca6('0x35')]:_0xcb44c[_0xbca6('0x33')]+_0xcb44c[_0xbca6('0x36')];var _0x337f3c;if(_0x1a739b>=_0x16f678){_0x1a739b=_0x16f678;_0x337f3c=0xc8;}else{_0x337f3c=0xce;}_0x180ff4[_0xbca6('0x30')](_0x337f3c);return _0x180ff4['set'](_0xbca6('0x37'),_0x1a79fb+'-'+_0x1a739b+'/'+_0x16f678)[_0xbca6('0x32')](_0x5a12e5);}return null;};}function patchUpdates(_0x33dda8){return function(_0x1c8df0){try{jsonpatch[_0xbca6('0x38')](_0x1c8df0,_0x33dda8,!![]);}catch(_0x439075){return BPromise[_0xbca6('0x39')](_0x439075);}return _0x1c8df0[_0xbca6('0x3a')]();};}function saveUpdates(_0xbc08c0,_0x27531f){return function(_0x2fcbb9){if(_0x2fcbb9){return _0x2fcbb9[_0xbca6('0x3b')](_0xbc08c0)[_0xbca6('0x24')](function(_0x3908ce){return _0x3908ce;});}return null;};}function removeEntity(_0x4c7ebb,_0x153ac5){return function(_0x52b818){if(_0x52b818){return _0x52b818[_0xbca6('0x3c')]()['then'](function(){_0x4c7ebb[_0xbca6('0x30')](0xcc)[_0xbca6('0x31')]();});}};}function handleEntityNotFound(_0x5a1d85,_0x36e4ed){return function(_0x181d14){if(!_0x181d14){_0x5a1d85[_0xbca6('0x2f')](0x194);}return _0x181d14;};}function handleError(_0x5c9ec8,_0x43c3c9){_0x43c3c9=_0x43c3c9||0x1f4;return function(_0x4fc27f){logger[_0xbca6('0x2a')](_0x4fc27f[_0xbca6('0x3d')]);if(_0x4fc27f[_0xbca6('0x3e')]){delete _0x4fc27f[_0xbca6('0x3e')];}_0x5c9ec8['status'](_0x43c3c9)[_0xbca6('0x3f')](_0x4fc27f);};}exports[_0xbca6('0x40')]=function(_0x531ab0,_0x40f85e){var _0x169dd3={},_0x19048f={},_0x317a5e={'count':0x0,'rows':[]};var _0x1a4b20=_[_0xbca6('0x41')](db[_0xbca6('0x42')][_0xbca6('0x43')],function(_0x3460b2){return{'name':_0x3460b2[_0xbca6('0x44')],'type':_0x3460b2[_0xbca6('0x45')]['key']};});_0x19048f[_0xbca6('0x46')]=_[_0xbca6('0x41')](_0x1a4b20,'name');_0x19048f[_0xbca6('0x47')]=_[_0xbca6('0x48')](_0x531ab0[_0xbca6('0x47')]);_0x19048f['filters']=_[_0xbca6('0x49')](_0x19048f['model'],_0x19048f['query']);_0x169dd3[_0xbca6('0x4a')]=_[_0xbca6('0x49')](_0x19048f[_0xbca6('0x46')],qs[_0xbca6('0x4b')](_0x531ab0['query'][_0xbca6('0x4b')]));_0x169dd3[_0xbca6('0x4a')]=_0x169dd3[_0xbca6('0x4a')][_0xbca6('0x4c')]?_0x169dd3[_0xbca6('0x4a')]:_0x19048f[_0xbca6('0x46')];if(!_0x531ab0[_0xbca6('0x47')][_0xbca6('0x4d')](_0xbca6('0x4e'))){_0x169dd3[_0xbca6('0x36')]=qs[_0xbca6('0x36')](_0x531ab0['query'][_0xbca6('0x36')]);_0x169dd3[_0xbca6('0x33')]=qs[_0xbca6('0x33')](_0x531ab0['query']['offset']);}_0x169dd3[_0xbca6('0x4f')]=qs['sort'](_0x531ab0[_0xbca6('0x47')][_0xbca6('0x50')]);_0x169dd3[_0xbca6('0x51')]=qs[_0xbca6('0x52')](_[_0xbca6('0x53')](_0x531ab0['query'],_0x19048f[_0xbca6('0x52')]),_0x1a4b20);if(_0x531ab0['query']['filter']){_0x169dd3['where']=_[_0xbca6('0x54')](_0x169dd3[_0xbca6('0x51')],{'$or':_['map'](_0x1a4b20,function(_0x1bf68b){if(_0x1bf68b[_0xbca6('0x45')]!==_0xbca6('0x55')){var _0x3c116c={};_0x3c116c[_0x1bf68b['name']]={'$like':'%'+_0x531ab0[_0xbca6('0x47')][_0xbca6('0x56')]+'%'};return _0x3c116c;}})});}_0x169dd3=_[_0xbca6('0x54')]({},_0x169dd3,_0x531ab0[_0xbca6('0x57')]);var _0x2c313c={'where':_0x169dd3[_0xbca6('0x51')]};return db[_0xbca6('0x42')]['count'](_0x2c313c)[_0xbca6('0x24')](function(_0x4ba91c){_0x317a5e[_0xbca6('0x35')]=_0x4ba91c;if(_0x531ab0[_0xbca6('0x47')][_0xbca6('0x58')]){_0x169dd3[_0xbca6('0x59')]=[{'all':!![]}];}return db[_0xbca6('0x42')][_0xbca6('0x5a')](_0x169dd3);})['then'](function(_0x1f5b1c){_0x317a5e[_0xbca6('0x5b')]=_0x1f5b1c;return _0x317a5e;})[_0xbca6('0x24')](respondWithFilteredResult(_0x40f85e,_0x169dd3))[_0xbca6('0x2e')](handleError(_0x40f85e,null));};exports['show']=function(_0x2a9153,_0x13e9c7){var _0x81a303={'raw':!![],'where':{'id':_0x2a9153[_0xbca6('0x5c')]['id']}},_0x5d31d6={};_0x5d31d6[_0xbca6('0x46')]=_['keys'](db[_0xbca6('0x42')]['rawAttributes']);_0x5d31d6[_0xbca6('0x47')]=_['keys'](_0x2a9153[_0xbca6('0x47')]);_0x5d31d6[_0xbca6('0x52')]=_['intersection'](_0x5d31d6['model'],_0x5d31d6[_0xbca6('0x47')]);_0x81a303[_0xbca6('0x4a')]=_[_0xbca6('0x49')](_0x5d31d6[_0xbca6('0x46')],qs[_0xbca6('0x4b')](_0x2a9153['query'][_0xbca6('0x4b')]));_0x81a303[_0xbca6('0x4a')]=_0x81a303[_0xbca6('0x4a')][_0xbca6('0x4c')]?_0x81a303[_0xbca6('0x4a')]:_0x5d31d6[_0xbca6('0x46')];if(_0x2a9153[_0xbca6('0x47')][_0xbca6('0x58')]){_0x81a303['include']=[{'all':!![]}];}_0x81a303=_['merge']({},_0x81a303,_0x2a9153['options']);return db[_0xbca6('0x42')][_0xbca6('0x5d')](_0x81a303)[_0xbca6('0x24')](handleEntityNotFound(_0x13e9c7,null))[_0xbca6('0x24')](respondWithResult(_0x13e9c7,null))['catch'](handleError(_0x13e9c7,null));};exports[_0xbca6('0x5e')]=function(_0x199e98,_0x38a3a7){return db[_0xbca6('0x42')][_0xbca6('0x5e')](_0x199e98[_0xbca6('0x5f')],{})['then'](respondWithResult(_0x38a3a7,0xc9))[_0xbca6('0x2e')](handleError(_0x38a3a7,null));};exports[_0xbca6('0x3b')]=function(_0x5d34fd,_0x486d2c){if(_0x5d34fd[_0xbca6('0x5f')]['id']){delete _0x5d34fd[_0xbca6('0x5f')]['id'];}return db[_0xbca6('0x42')]['find']({'where':{'id':_0x5d34fd['params']['id']}})['then'](handleEntityNotFound(_0x486d2c,null))[_0xbca6('0x24')](saveUpdates(_0x5d34fd[_0xbca6('0x5f')],null))['then'](respondWithResult(_0x486d2c,null))['catch'](handleError(_0x486d2c,null));};exports['destroy']=function(_0x2132b6,_0x37f4ca){return db[_0xbca6('0x42')][_0xbca6('0x5d')]({'where':{'id':_0x2132b6[_0xbca6('0x5c')]['id']}})[_0xbca6('0x24')](handleEntityNotFound(_0x37f4ca,null))['then'](removeEntity(_0x37f4ca,null))[_0xbca6('0x2e')](handleError(_0x37f4ca,null));};exports[_0xbca6('0x60')]=function(_0x47a3cf,_0x3ccb39){return db[_0xbca6('0x42')][_0xbca6('0x60')]()['then'](respondWithResult(_0x3ccb39,null))[_0xbca6('0x2e')](handleError(_0x3ccb39,null));};var interaction_log=require('../../config/logger')(_0xbca6('0x61'));exports[_0xbca6('0x62')]=function(_0x28baa9,_0xdcdf0c,_0x25858d){var _0x45b199={'agent':{},'channel':'whatsapp'};if(_0x28baa9[_0xbca6('0x5f')]['id']){delete _0x28baa9[_0xbca6('0x5f')]['id'];}_0x28baa9[_0xbca6('0x5f')][_0xbca6('0x63')]=!![];_0x28baa9['body'][_0xbca6('0x64')]=moment()[_0xbca6('0x65')](_0xbca6('0x66'));_0x28baa9[_0xbca6('0x5f')][_0xbca6('0x67')]=_0x28baa9[_0xbca6('0x5f')][_0xbca6('0x67')]||_0x28baa9['user']['id'];_0x45b199[_0xbca6('0x68')]['id']=_0x28baa9[_0xbca6('0x5f')][_0xbca6('0x67')];return db[_0xbca6('0x42')][_0xbca6('0x5d')]({'where':{'id':_0x28baa9[_0xbca6('0x5c')]['id'],'UserId':null}})[_0xbca6('0x24')](handleEntityNotFound(_0xdcdf0c,null))[_0xbca6('0x24')](saveUpdates(_0x28baa9[_0xbca6('0x5f')],null))['then'](function(_0xa0c22f){if(_0xa0c22f){_0x45b199['message']=_0xa0c22f['get']({'plain':!![]});return db[_0xbca6('0x69')][_0xbca6('0x5d')]({'where':{'id':_0xa0c22f['WhatsappInteractionId']}});}return null;})[_0xbca6('0x24')](handleEntityNotFound(_0xdcdf0c,null))[_0xbca6('0x24')](function(_0x26f5c9){if(_0x26f5c9){return _0x26f5c9['update']({'UserId':_0x28baa9['body']['UserId'],'read1stAt':_[_0xbca6('0x6a')](_0x26f5c9[_0xbca6('0x6b')])?moment()['format'](_0xbca6('0x66')):undefined});}return null;})[_0xbca6('0x24')](function(_0x178541){if(_0x178541){_0x45b199['interaction']=_0x178541[_0xbca6('0x6c')]({'plain':!![]});interaction_log[_0xbca6('0x25')](_0xbca6('0x6d'),_0x28baa9[_0xbca6('0x6e')]['id'],_0x28baa9[_0xbca6('0x6e')][_0xbca6('0x3e')],_0x28baa9[_0xbca6('0x6e')]['role'],_0x45b199[_0xbca6('0x6f')]['id'],_0x28baa9[_0xbca6('0x5f')]?JSON[_0xbca6('0x29')](_0x28baa9[_0xbca6('0x5f')]):_0xbca6('0x70'));return respondWithRpcPromise('AcceptMessage',_0xbca6('0x71'),_0x45b199);}return null;})[_0xbca6('0x24')](function(_0x3d79c1){var _0x191c78=_0xbca6('0x72')+_0x3d79c1[_0xbca6('0x2c')][_0xbca6('0x73')];return db[_0xbca6('0x74')][_0xbca6('0x47')](_0x191c78,{'type':db[_0xbca6('0x75')][_0xbca6('0x76')]['SELECT'],'raw':!![]})['then'](function(_0x11a269){return _0x11a269;});})['then'](function(_0x2a047f){if(_0x2a047f){_0x45b199['message'][_0xbca6('0x77')]=_0x2a047f[0x0];if(!_0x28baa9[_0xbca6('0x5f')][_0xbca6('0x67')])return;return db['User'][_0xbca6('0x5d')]({'where':{'id':_0x28baa9[_0xbca6('0x5f')]['UserId'],'role':_0xbca6('0x68')},'attributes':['id',_0xbca6('0x3e'),'fullname',_0xbca6('0x78'),_0xbca6('0x79')],'raw':!![]});}return null;})['then'](function(_0x17bcf2){if(!_0x17bcf2)return null;_0x45b199[_0xbca6('0x2c')]['agent']=_0x17bcf2;return _0x45b199;})[_0xbca6('0x24')](function(_0x3831fc){if(_0x3831fc){if(_0x28baa9[_0xbca6('0x5f')][_0xbca6('0x7a')]){_0x45b199[_0xbca6('0x2c')][_0xbca6('0x7b')]=util['format'](_0xbca6('0x7c'),_0x28baa9[_0xbca6('0x6e')][_0xbca6('0x3e')]);_0x45b199['message'][_0xbca6('0x7d')]=_0x45b199[_0xbca6('0x7d')];_0x45b199['message'][_0xbca6('0x7e')]=_0x45b199[_0xbca6('0x7d')];_0x45b199[_0xbca6('0x2c')][_0xbca6('0x7f')]=_0xbca6('0x62');return respondWithRpcPromise(_0xbca6('0x80'),_0xbca6('0x80'),{'event':'acceptmessage','message':_0x45b199['message']},client9002)[_0xbca6('0x24')](function(){return _0x45b199;});}return _0x45b199;}return null;})[_0xbca6('0x24')](respondWithResult(_0xdcdf0c,null))[_0xbca6('0x2e')](handleError(_0xdcdf0c,null));};var interaction_log=require(_0xbca6('0x16'))('whatsapp-interactions');exports['reject']=function(_0x3c0755,_0x1638f4,_0x5d3645){var _0x59393e={'agent':{},'channel':'whatsapp'};if(_0x3c0755[_0xbca6('0x5f')]['id']){delete _0x3c0755[_0xbca6('0x5f')]['id'];}_0x3c0755['body'][_0xbca6('0x67')]=_0x3c0755[_0xbca6('0x5f')][_0xbca6('0x67')]||_0x3c0755['user']['id'];_0x59393e[_0xbca6('0x68')]['id']=_0x3c0755[_0xbca6('0x5f')]['UserId'];return db[_0xbca6('0x42')][_0xbca6('0x5d')]({'where':{'id':_0x3c0755[_0xbca6('0x5c')]['id'],'UserId':null}})[_0xbca6('0x24')](handleEntityNotFound(_0x1638f4,null))['then'](function(_0xb869ff){if(_0xb869ff){_0x59393e[_0xbca6('0x2c')]=_0xb869ff[_0xbca6('0x6c')]({'plain':!![]});return db[_0xbca6('0x69')]['find']({'where':{'id':_0xb869ff[_0xbca6('0x81')]}});}return null;})[_0xbca6('0x24')](handleEntityNotFound(_0x1638f4,null))[_0xbca6('0x24')](function(_0x5e75bb){if(_0x5e75bb){_0x59393e[_0xbca6('0x6f')]=_0x5e75bb[_0xbca6('0x6c')]({'plain':!![]});interaction_log[_0xbca6('0x25')](_0xbca6('0x82'),_0x3c0755[_0xbca6('0x6e')]['id'],_0x3c0755[_0xbca6('0x6e')]['name'],_0x3c0755[_0xbca6('0x6e')][_0xbca6('0x83')],_0x59393e[_0xbca6('0x6f')]['id'],_0x3c0755[_0xbca6('0x5f')]?JSON['stringify'](_0x3c0755[_0xbca6('0x5f')]):_0xbca6('0x70'));return respondWithRpcPromise(_0xbca6('0x84'),_0xbca6('0x85'),_0x59393e);}return null;})[_0xbca6('0x24')](function(_0x172d0a){var _0x1e5757=_0xbca6('0x72')+_0x172d0a[_0xbca6('0x2c')][_0xbca6('0x73')];return db['sequelize'][_0xbca6('0x47')](_0x1e5757,{'type':db['Sequelize'][_0xbca6('0x76')][_0xbca6('0x86')],'raw':!![]})['then'](function(_0x1cfd92){return _0x1cfd92;});})[_0xbca6('0x24')](function(_0x4fff18){if(_0x4fff18){_0x59393e[_0xbca6('0x2c')][_0xbca6('0x77')]=_0x4fff18[0x0];if(!_0x3c0755[_0xbca6('0x5f')]['UserId'])return;return db[_0xbca6('0x87')][_0xbca6('0x5d')]({'where':{'id':_0x3c0755[_0xbca6('0x5f')][_0xbca6('0x67')],'role':'agent'},'attributes':['id',_0xbca6('0x3e'),_0xbca6('0x88'),'email','internal'],'raw':!![]});}return null;})[_0xbca6('0x24')](function(_0x52a156){if(!_0x52a156)return null;_0x59393e['message'][_0xbca6('0x68')]=_0x52a156;return _0x59393e;})[_0xbca6('0x24')](function(_0x2f9690){if(_0x2f9690){_0x2f9690[_0xbca6('0x2c')]['interface']=util['format']('SIP/%s',_0x3c0755[_0xbca6('0x6e')]['name']);_0x2f9690[_0xbca6('0x2c')][_0xbca6('0x7d')]=_0x59393e[_0xbca6('0x7d')];_0x2f9690[_0xbca6('0x2c')][_0xbca6('0x7e')]=_0x59393e[_0xbca6('0x7d')];_0x2f9690[_0xbca6('0x2c')][_0xbca6('0x7f')]=_0xbca6('0x39');respondWithRpcPromise(_0xbca6('0x80'),'EventManager',{'event':_0xbca6('0x89'),'message':_0x2f9690[_0xbca6('0x2c')]},client9002);return _0x59393e;}return null;})[_0xbca6('0x24')](respondWithResult(_0x1638f4,null))[_0xbca6('0x2e')](handleError(_0x1638f4,null));};exports['status']=function(_0x22fdf4,_0x3fc444,_0x442730){if(_0x22fdf4['body']['id']){delete _0x22fdf4[_0xbca6('0x5f')]['id'];}var _0x10a491;return db[_0xbca6('0x42')][_0xbca6('0x5d')]({'where':{'id':_0x22fdf4['params']['id']}})[_0xbca6('0x24')](handleEntityNotFound(_0x3fc444,null))[_0xbca6('0x24')](function(_0x4269fa){if(_0x4269fa){_0x10a491=_0x4269fa;return db[_0xbca6('0x8a')][_0xbca6('0x5d')]({'where':{'id':_0x4269fa[_0xbca6('0x8b')]}});}})[_0xbca6('0x24')](handleEntityNotFound(_0x3fc444,null))['then'](function(_0x369bea){if(_0x369bea){logger[_0xbca6('0x27')](_0xbca6('0x8c'),_0xbca6('0x30'),_0xbca6('0x8d'),_0x369bea[_0xbca6('0x45')],util[_0xbca6('0x8e')](_0x22fdf4[_0xbca6('0x5f')],{'showHidden':![],'depth':null}));switch(_0x369bea[_0xbca6('0x45')]){case _0xbca6('0x8f'):if(_0x22fdf4[_0xbca6('0x5f')][_0xbca6('0x90')]&&_0x22fdf4[_0xbca6('0x5f')][_0xbca6('0x90')]===_0x10a491[_0xbca6('0x91')]&&_0x22fdf4[_0xbca6('0x5f')][_0xbca6('0x92')]&&_0x22fdf4[_0xbca6('0x5f')][_0xbca6('0x92')]==='read'){return _0x10a491['update']({'read':!![]});}else{logger[_0xbca6('0x2a')](_0xbca6('0x93'),'status',_0xbca6('0x8f'),util[_0xbca6('0x8e')](_0x22fdf4[_0xbca6('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x10a491;}})[_0xbca6('0x24')](respondWithResult(_0x3fc444,null))[_0xbca6('0x2e')](handleError(_0x3fc444,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index a6a532b..fcf745e 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 _0xed3c=['WhatsappMessage','setMaxListeners','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x35c0d9,_0x41bf02){var _0x4be46a=function(_0x1ff430){while(--_0x1ff430){_0x35c0d9['push'](_0x35c0d9['shift']());}};_0x4be46a(++_0x41bf02);}(_0xed3c,0x1a6));var _0xced3=function(_0x424501,_0x42096d){_0x424501=_0x424501-0x0;var _0xb719af=_0xed3c[_0x424501];return _0xb719af;};'use strict';var EventEmitter=require(_0xced3('0x0'));var WhatsappMessage=require(_0xced3('0x1'))['db'][_0xced3('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xced3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xced3('0x4'),'afterDestroy':_0xced3('0x5')};function emitEvent(_0x14488e){return function(_0x5f03e0,_0x51e500,_0x3d3aa0){WhatsappMessageEvents[_0xced3('0x6')](_0x14488e+':'+_0x5f03e0['id'],_0x5f03e0);WhatsappMessageEvents[_0xced3('0x6')](_0x14488e,_0x5f03e0);_0x3d3aa0(null);};}for(var e in events){if(events[_0xced3('0x7')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x236c=['WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x22ccc0,_0x914457){var _0xe2af6a=function(_0x55aa01){while(--_0x55aa01){_0x22ccc0['push'](_0x22ccc0['shift']());}};_0xe2af6a(++_0x914457);}(_0x236c,0x155));var _0xc236=function(_0x11981f,_0x20679e){_0x11981f=_0x11981f-0x0;var _0x216824=_0x236c[_0x11981f];return _0x216824;};'use strict';var EventEmitter=require(_0xc236('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xc236('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xc236('0x2')](0x0);var events={'afterCreate':_0xc236('0x3'),'afterUpdate':_0xc236('0x4'),'afterDestroy':_0xc236('0x5')};function emitEvent(_0x518d6a){return function(_0x3adce9,_0x36e87d,_0x33bc57){WhatsappMessageEvents[_0xc236('0x6')](_0x518d6a+':'+_0x3adce9['id'],_0x3adce9);WhatsappMessageEvents[_0xc236('0x6')](_0x518d6a,_0x3adce9);_0x33bc57(null);};}for(var e in events){if(events[_0xc236('0x7')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xc236('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 85c592f..2afec5e 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 _0xde69=['./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','then','createdAt','catch','error','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','authToken','messages','whatsapp:','phone','remote','/api/whatsapp/messages/','token','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','update','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xde69,0x160));var _0x9de6=function(_0x563129,_0x26d5f9){_0x563129=_0x563129-0x0;var _0x28d1a3=_0xde69[_0x563129];return _0x28d1a3;};'use strict';var _=require('lodash');var util=require(_0x9de6('0x0'));var logger=require('../../config/logger')(_0x9de6('0x1'));var moment=require(_0x9de6('0x2'));var BPromise=require(_0x9de6('0x3'));var rp=require(_0x9de6('0x4'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x9de6('0x5'));var rimraf=require(_0x9de6('0x6'));var config=require(_0x9de6('0x7'));var attributes=require(_0x9de6('0x8'));module[_0x9de6('0x9')]=function(_0x374bcd,_0x5ad25d){return _0x374bcd['define'](_0x9de6('0xa'),attributes,{'tableName':_0x9de6('0xb'),'paranoid':![],'indexes':[{'name':_0x9de6('0xc'),'fields':[_0x9de6('0xc')]},{'name':_0x9de6('0xd'),'fields':[_0x9de6('0xe')],'type':_0x9de6('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x73dd9c,_0x1d6e98,_0x377d78){var _0x125751=_0x374bcd[_0x9de6('0x10')];var _0x51f05e=_0x73dd9c[_0x9de6('0x11')]({'plain':!![]});if(_0x51f05e[_0x9de6('0x12')][_0x9de6('0x13')]()==='in'||_0x51f05e['direction']['toLowerCase']()===_0x9de6('0x14')&&!_0x51f05e[_0x9de6('0x15')]&&!_[_0x9de6('0x16')](_0x51f05e[_0x9de6('0x17')])){_0x125751[_0x9de6('0x18')][_0x9de6('0x19')]({'where':{'id':_0x51f05e['WhatsappInteractionId']}})[_0x9de6('0x1a')](function(_0x56a9b6){if(_0x56a9b6){_0x56a9b6['update']({'lastMsgAt':_0x51f05e[_0x9de6('0x1b')],'lastMsgDirection':_0x51f05e[_0x9de6('0x12')][_0x9de6('0x13')]()});}})[_0x9de6('0x1c')](function(_0x897fda){console[_0x9de6('0x1d')](_0x897fda);});}if(_0x51f05e[_0x9de6('0x12')]===_0x9de6('0x14')&&!_0x51f05e[_0x9de6('0x15')]){var _0x26e921;_0x125751[_0x9de6('0x1e')]['find']({'where':{'id':_0x51f05e[_0x9de6('0x1f')]},'raw':!![]})[_0x9de6('0x1a')](function(_0x74ccdd){_0x26e921=_0x74ccdd;if(_0x26e921&&_0x26e921[_0x9de6('0x20')]){switch(_0x26e921['type']){case _0x9de6('0x21'):var _0x44f633=require(_0x9de6('0x21'));if(_0x26e921[_0x9de6('0x22')]&&_0x26e921[_0x9de6('0x23')]&&_0x26e921['phone']){var _0xeeee8b=new _0x44f633(_0x26e921[_0x9de6('0x22')],_0x26e921['authToken']);_0xeeee8b[_0x9de6('0x24')]['create']({'body':_0x51f05e[_0x9de6('0xe')],'to':_0x9de6('0x25')+_0x51f05e[_0x9de6('0x26')],'from':_0x9de6('0x25')+_0x26e921['phone'],'statusCallback':_0x26e921[_0x9de6('0x27')]+_0x9de6('0x28')+_0x51f05e['id']+'/status?token='+_0x26e921[_0x9de6('0x29')]})[_0x9de6('0x1a')](function(_0x3cbd7a){if(_0x3cbd7a['sid']){return _0x73dd9c['update']({'messageId':_0x3cbd7a['sid']});}})[_0x9de6('0x1c')](function(_0x21cd9d){logger[_0x9de6('0x1d')](_0x9de6('0x2a'),_0x9de6('0x2b'),'twilio',util['inspect'](_0x21cd9d,{'showHidden':![],'depth':null}));});}else{logger[_0x9de6('0x1d')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x9de6('0x2b'),_0x9de6('0x21'),_0x9de6('0x2c'));}break;case _0x9de6('0x2d'):var _0x2ce5f7=_0x26e921[_0x9de6('0x22')];var _0x6ad46f=_0x26e921[_0x9de6('0x23')];var _0x2c581c=_0x26e921[_0x9de6('0x2e')]+_0x9de6('0x2f')+_0x2ce5f7+_0x9de6('0x30');var _0xd2bfb1={'to':[_0x51f05e[_0x9de6('0x26')]],'message':{'type':_0x9de6('0x31'),'text':_0x51f05e[_0x9de6('0xe')]}};var _0x4fc08a={'method':_0x9de6('0x32'),'uri':_0x2c581c,'headers':{'Authorization':_0x9de6('0x33')+_0x6ad46f,'Content-Type':_0x9de6('0x34')},'body':_0xd2bfb1,'json':!![]};rp(_0x4fc08a)[_0x9de6('0x1a')](function(_0x9d8c7a){if(_0x9d8c7a[_0x9de6('0x35')][0x0][_0x9de6('0x36')]){return _0x73dd9c[_0x9de6('0x37')]({'messageId':_0x9d8c7a[_0x9de6('0x35')][0x0][_0x9de6('0x36')]});}})['catch'](function(_0xee3209){logger[_0x9de6('0x38')](_0x9de6('0x39'),_0xee3209);});break;}}})[_0x9de6('0x3a')](function(){_0x377d78();});}else{_0x377d78();}}},'charset':'utf8mb4','collate':_0x9de6('0x3b')});}; \ No newline at end of file +var _0xcbb3=['whatsapp_messages','messageId','body','FULLTEXT','models','direction','toLowerCase','isNil','UserId','WhatsappInteraction','findOne','update','catch','error','secret','WhatsappAccount','WhatsappAccountId','then','type','accountSid','authToken','messages','whatsapp:','phone','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','text','POST','Bearer\x20','application/json','statuses','message_id','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','./whatsappMessage.attributes','exports','define','WhatsappMessage'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0xcbb3,0x66));var _0x3cbb=function(_0x209f90,_0x3d6f2f){_0x209f90=_0x209f90-0x0;var _0x3db0cb=_0xcbb3[_0x209f90];return _0x3db0cb;};'use strict';var _=require(_0x3cbb('0x0'));var util=require(_0x3cbb('0x1'));var logger=require(_0x3cbb('0x2'))(_0x3cbb('0x3'));var moment=require(_0x3cbb('0x4'));var BPromise=require(_0x3cbb('0x5'));var rp=require(_0x3cbb('0x6'));var fetch=require(_0x3cbb('0x7'));var fs=require('fs');var path=require(_0x3cbb('0x8'));var rimraf=require(_0x3cbb('0x9'));var config=require('../../config/environment');var attributes=require(_0x3cbb('0xa'));module[_0x3cbb('0xb')]=function(_0x17b286,_0x2668c4){return _0x17b286[_0x3cbb('0xc')](_0x3cbb('0xd'),attributes,{'tableName':_0x3cbb('0xe'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x3cbb('0xf')]},{'name':'fti_whatsapp_messages','fields':[_0x3cbb('0x10')],'type':_0x3cbb('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3e3924,_0x5b65d3,_0x204522){var _0x2a4f0c=_0x17b286[_0x3cbb('0x12')];var _0xa05475=_0x3e3924['get']({'plain':!![]});if(_0xa05475[_0x3cbb('0x13')][_0x3cbb('0x14')]()==='in'||_0xa05475[_0x3cbb('0x13')][_0x3cbb('0x14')]()==='out'&&!_0xa05475['secret']&&!_[_0x3cbb('0x15')](_0xa05475[_0x3cbb('0x16')])){_0x2a4f0c[_0x3cbb('0x17')][_0x3cbb('0x18')]({'where':{'id':_0xa05475['WhatsappInteractionId']}})['then'](function(_0x18f34e){if(_0x18f34e){_0x18f34e[_0x3cbb('0x19')]({'lastMsgAt':_0xa05475['createdAt'],'lastMsgDirection':_0xa05475['direction'][_0x3cbb('0x14')]()});}})[_0x3cbb('0x1a')](function(_0x25bf0b){console[_0x3cbb('0x1b')](_0x25bf0b);});}if(_0xa05475[_0x3cbb('0x13')]==='out'&&!_0xa05475[_0x3cbb('0x1c')]){var _0x24988d;_0x2a4f0c[_0x3cbb('0x1d')]['find']({'where':{'id':_0xa05475[_0x3cbb('0x1e')]},'raw':!![]})[_0x3cbb('0x1f')](function(_0x4f891a){_0x24988d=_0x4f891a;if(_0x24988d&&_0x24988d[_0x3cbb('0x20')]){switch(_0x24988d['type']){case'twilio':var _0x9bcfa9=require('twilio');if(_0x24988d[_0x3cbb('0x21')]&&_0x24988d[_0x3cbb('0x22')]&&_0x24988d['phone']){var _0x447085=new _0x9bcfa9(_0x24988d[_0x3cbb('0x21')],_0x24988d[_0x3cbb('0x22')]);_0x447085[_0x3cbb('0x23')]['create']({'body':_0xa05475[_0x3cbb('0x10')],'to':_0x3cbb('0x24')+_0xa05475[_0x3cbb('0x25')],'from':_0x3cbb('0x24')+_0x24988d[_0x3cbb('0x25')],'statusCallback':_0x24988d['remote']+_0x3cbb('0x26')+_0xa05475['id']+_0x3cbb('0x27')+_0x24988d[_0x3cbb('0x28')]})[_0x3cbb('0x1f')](function(_0xe1b212){if(_0xe1b212[_0x3cbb('0x29')]){return _0x3e3924[_0x3cbb('0x19')]({'messageId':_0xe1b212['sid']});}})[_0x3cbb('0x1a')](function(_0x45a9e9){logger[_0x3cbb('0x1b')](_0x3cbb('0x2a'),_0x3cbb('0x2b'),'twilio',util[_0x3cbb('0x2c')](_0x45a9e9,{'showHidden':![],'depth':null}));});}else{logger[_0x3cbb('0x1b')](_0x3cbb('0x2a'),_0x3cbb('0x2b'),_0x3cbb('0x2d'),_0x3cbb('0x2e'));}break;case _0x3cbb('0x2f'):var _0x17531a=_0x24988d[_0x3cbb('0x21')];var _0x1fa2b5=_0x24988d[_0x3cbb('0x22')];var _0x5dc7ea=_0x24988d[_0x3cbb('0x30')]+'/whatsapp/v1/'+_0x17531a+'/messages/';var _0x5d205d={'to':[_0xa05475[_0x3cbb('0x25')]],'message':{'type':_0x3cbb('0x31'),'text':_0xa05475[_0x3cbb('0x10')]}};var _0x220f3f={'method':_0x3cbb('0x32'),'uri':_0x5dc7ea,'headers':{'Authorization':_0x3cbb('0x33')+_0x1fa2b5,'Content-Type':_0x3cbb('0x34')},'body':_0x5d205d,'json':!![]};rp(_0x220f3f)[_0x3cbb('0x1f')](function(_0x29afab){if(_0x29afab[_0x3cbb('0x35')][0x0][_0x3cbb('0x36')]){return _0x3e3924[_0x3cbb('0x19')]({'messageId':_0x29afab[_0x3cbb('0x35')][0x0][_0x3cbb('0x36')]});}})[_0x3cbb('0x1a')](function(_0x18476c){logger['err'](_0x3cbb('0x37'),_0x18476c);});break;}}})['finally'](function(){_0x204522();});}else{_0x204522();}}},'charset':_0x3cbb('0x38'),'collate':_0x3cbb('0x39')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 4afefd9..a24560e 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 _0xc20d=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateWhatsappMessage','create','body','options','raw','catch'];(function(_0x297bb3,_0x1f0c0f){var _0x5b0cd8=function(_0x150661){while(--_0x150661){_0x297bb3['push'](_0x297bb3['shift']());}};_0x5b0cd8(++_0x1f0c0f);}(_0xc20d,0xa0));var _0xdc20=function(_0x4664db,_0x1de672){_0x4664db=_0x4664db-0x0;var _0x5615b4=_0xc20d[_0x4664db];return _0x5615b4;};'use strict';var _=require(_0xdc20('0x0'));var util=require(_0xdc20('0x1'));var moment=require('moment');var BPromise=require(_0xdc20('0x2'));var rs=require(_0xdc20('0x3'));var fs=require('fs');var Redis=require(_0xdc20('0x4'));var db=require(_0xdc20('0x5'))['db'];var utils=require(_0xdc20('0x6'));var logger=require('../../config/logger')(_0xdc20('0x7'));var config=require('../../config/environment');var jayson=require(_0xdc20('0x8'));var client=jayson[_0xdc20('0x9')][_0xdc20('0xa')]({'port':0x232a});config[_0xdc20('0xb')]=_[_0xdc20('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdc20('0xb')]));require(_0xdc20('0xd'))[_0xdc20('0xe')](socket);function respondWithRpcPromise(_0x4764b0,_0x4423d1,_0x37043f){return new BPromise(function(_0x2248f0,_0x49268a){return client[_0xdc20('0xf')](_0x4764b0,_0x37043f)[_0xdc20('0x10')](function(_0x7f1d05){logger[_0xdc20('0x11')](_0xdc20('0x12'),_0x4423d1,_0xdc20('0x13'));logger[_0xdc20('0x14')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4423d1,_0xdc20('0x13'),JSON[_0xdc20('0x15')](_0x7f1d05));if(_0x7f1d05[_0xdc20('0x16')]){if(_0x7f1d05[_0xdc20('0x16')][_0xdc20('0x17')]===0x1f4){logger[_0xdc20('0x16')](_0xdc20('0x12'),_0x4423d1,_0x7f1d05[_0xdc20('0x16')]['message']);return _0x49268a(_0x7f1d05[_0xdc20('0x16')][_0xdc20('0x18')]);}logger[_0xdc20('0x16')](_0xdc20('0x12'),_0x4423d1,_0x7f1d05[_0xdc20('0x16')]['message']);return _0x2248f0(_0x7f1d05[_0xdc20('0x16')]['message']);}else{logger[_0xdc20('0x11')](_0xdc20('0x12'),_0x4423d1,_0xdc20('0x13'));_0x2248f0(_0x7f1d05[_0xdc20('0x19')][_0xdc20('0x18')]);}})['catch'](function(_0x2c6083){logger['error'](_0xdc20('0x12'),_0x4423d1,_0x2c6083);_0x49268a(_0x2c6083);});});}exports[_0xdc20('0x1a')]=function(_0x4a26d7){var _0x269eee=this;return new Promise(function(_0x40f4e4,_0x4f362e){return db['WhatsappMessage'][_0xdc20('0x1b')](_0x4a26d7[_0xdc20('0x1c')],{'raw':_0x4a26d7[_0xdc20('0x1d')]?_0x4a26d7['options'][_0xdc20('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x37854d){logger[_0xdc20('0x11')](_0xdc20('0x1a'),_0x4a26d7);logger[_0xdc20('0x14')](_0xdc20('0x1a'),_0x4a26d7,JSON[_0xdc20('0x15')](_0x37854d));_0x40f4e4(_0x37854d);})[_0xdc20('0x1f')](function(_0x2091e9){logger[_0xdc20('0x16')](_0xdc20('0x1a'),_0x2091e9[_0xdc20('0x18')],_0x4a26d7);_0x4f362e(_0x269eee['error'](0x1f4,_0x2091e9[_0xdc20('0x18')]));});});}; \ No newline at end of file +var _0x028a=['then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','WhatsappMessage','create','body','raw','CreateWhatsappMessage','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./whatsappMessage.socket','request'];(function(_0xb0b64,_0x2f3682){var _0x5288fe=function(_0x7592e8){while(--_0x7592e8){_0xb0b64['push'](_0xb0b64['shift']());}};_0x5288fe(++_0x2f3682);}(_0x028a,0xf7));var _0xa028=function(_0x6dcaa5,_0x1e4d24){_0x6dcaa5=_0x6dcaa5-0x0;var _0x4a2424=_0x028a[_0x6dcaa5];return _0x4a2424;};'use strict';var _=require(_0xa028('0x0'));var util=require(_0xa028('0x1'));var moment=require(_0xa028('0x2'));var BPromise=require(_0xa028('0x3'));var rs=require(_0xa028('0x4'));var fs=require('fs');var Redis=require(_0xa028('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa028('0x6'));var logger=require(_0xa028('0x7'))(_0xa028('0x8'));var config=require(_0xa028('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa028('0xa')][_0xa028('0xb')]({'port':0x232a});config[_0xa028('0xc')]=_[_0xa028('0xd')](config[_0xa028('0xc')],{'host':_0xa028('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa028('0xc')]));require(_0xa028('0xf'))['register'](socket);function respondWithRpcPromise(_0x4a130d,_0x5219c7,_0x3c0585){return new BPromise(function(_0x53918a,_0x59384a){return client[_0xa028('0x10')](_0x4a130d,_0x3c0585)[_0xa028('0x11')](function(_0xf51cbe){logger[_0xa028('0x12')](_0xa028('0x13'),_0x5219c7,_0xa028('0x14'));logger['debug'](_0xa028('0x15'),_0x5219c7,_0xa028('0x14'),JSON[_0xa028('0x16')](_0xf51cbe));if(_0xf51cbe['error']){if(_0xf51cbe[_0xa028('0x17')][_0xa028('0x18')]===0x1f4){logger[_0xa028('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x5219c7,_0xf51cbe[_0xa028('0x17')]['message']);return _0x59384a(_0xf51cbe['error'][_0xa028('0x19')]);}logger[_0xa028('0x17')](_0xa028('0x13'),_0x5219c7,_0xf51cbe[_0xa028('0x17')]['message']);return _0x53918a(_0xf51cbe[_0xa028('0x17')][_0xa028('0x19')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x5219c7,'request\x20sent');_0x53918a(_0xf51cbe[_0xa028('0x1a')][_0xa028('0x19')]);}})['catch'](function(_0xdc8628){logger['error'](_0xa028('0x13'),_0x5219c7,_0xdc8628);_0x59384a(_0xdc8628);});});}exports['CreateWhatsappMessage']=function(_0x3af352){var _0x18af0c=this;return new Promise(function(_0x299b77,_0xb80b2e){return db[_0xa028('0x1b')][_0xa028('0x1c')](_0x3af352[_0xa028('0x1d')],{'raw':_0x3af352['options']?_0x3af352['options'][_0xa028('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x37a166){logger['info'](_0xa028('0x1f'),_0x3af352);logger['debug'](_0xa028('0x1f'),_0x3af352,JSON['stringify'](_0x37a166));_0x299b77(_0x37a166);})[_0xa028('0x20')](function(_0x448e73){logger[_0xa028('0x17')]('CreateWhatsappMessage',_0x448e73[_0xa028('0x19')],_0x3af352);_0xb80b2e(_0x18af0c[_0xa028('0x17')](0x1f4,_0x448e73[_0xa028('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index ab42050..d798b1b 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 _0x33e8=['register','whatsappMessage:','save','remove','emit','removeListener'];(function(_0x1540cf,_0x532500){var _0x3a3a3a=function(_0x426c4a){while(--_0x426c4a){_0x1540cf['push'](_0x1540cf['shift']());}};_0x3a3a3a(++_0x532500);}(_0x33e8,0x170));var _0x833e=function(_0x36eece,_0x38461a){_0x36eece=_0x36eece-0x0;var _0x21dfc0=_0x33e8[_0x36eece];return _0x21dfc0;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x833e('0x0'),_0x833e('0x1'),'update'];function createListener(_0x137824,_0x2d3545){return function(_0x549819){_0x2d3545[_0x833e('0x2')](_0x137824,_0x549819);};}function removeListener(_0x4685d6,_0x13a95a){return function(){WhatsappMessageEvents[_0x833e('0x3')](_0x4685d6,_0x13a95a);};}exports[_0x833e('0x4')]=function(_0x3141c7){for(var _0x23b55e=0x0,_0xf6b33d=events['length'];_0x23b55e<_0xf6b33d;_0x23b55e++){var _0x16d7ad=events[_0x23b55e];var _0x1f7c10=createListener(_0x833e('0x5')+_0x16d7ad,_0x3141c7);WhatsappMessageEvents['on'](_0x16d7ad,_0x1f7c10);}}; \ No newline at end of file +var _0x5b76=['removeListener','length','whatsappMessage:','remove','update'];(function(_0x58a02b,_0xf2225f){var _0x35ef8b=function(_0x3a546f){while(--_0x3a546f){_0x58a02b['push'](_0x58a02b['shift']());}};_0x35ef8b(++_0xf2225f);}(_0x5b76,0x148));var _0x65b7=function(_0x3a1c9f,_0x1083ae){_0x3a1c9f=_0x3a1c9f-0x0;var _0x136d9b=_0x5b76[_0x3a1c9f];return _0x136d9b;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save',_0x65b7('0x0'),_0x65b7('0x1')];function createListener(_0xb2b079,_0x3fd07e){return function(_0x17faaf){_0x3fd07e['emit'](_0xb2b079,_0x17faaf);};}function removeListener(_0x4ffc31,_0x484263){return function(){WhatsappMessageEvents[_0x65b7('0x2')](_0x4ffc31,_0x484263);};}exports['register']=function(_0x21eb5f){for(var _0x1ff518=0x0,_0x57d193=events[_0x65b7('0x3')];_0x1ff518<_0x57d193;_0x1ff518++){var _0x4e4ab8=events[_0x1ff518];var _0x2f0dce=createListener(_0x65b7('0x4')+_0x4e4ab8,_0x21eb5f);WhatsappMessageEvents['on'](_0x4e4ab8,_0x2f0dce);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index c878ef8..0d54e41 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 _0xf87c=['index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated'];(function(_0x41878d,_0x1b2b86){var _0x13d242=function(_0x59345e){while(--_0x59345e){_0x41878d['push'](_0x41878d['shift']());}};_0x13d242(++_0x1b2b86);}(_0xf87c,0x1a2));var _0xcf87=function(_0x427352,_0x1bce61){_0x427352=_0x427352-0x0;var _0x23e0e6=_0xf87c[_0x427352];return _0x23e0e6;};'use strict';var multer=require(_0xcf87('0x0'));var util=require(_0xcf87('0x1'));var path=require(_0xcf87('0x2'));var timeout=require(_0xcf87('0x3'));var express=require(_0xcf87('0x4'));var router=express[_0xcf87('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xcf87('0x6'));var interaction=require(_0xcf87('0x7'));var config=require('../../config/environment');var controller=require(_0xcf87('0x8'));router[_0xcf87('0x9')]('/',auth[_0xcf87('0xa')](),controller[_0xcf87('0xb')]);router['get'](_0xcf87('0xc'),auth[_0xcf87('0xa')](),controller[_0xcf87('0xd')]);router[_0xcf87('0x9')](_0xcf87('0xe'),auth[_0xcf87('0xa')](),controller[_0xcf87('0xf')]);router[_0xcf87('0x9')](_0xcf87('0x10'),auth['isAuthenticated'](),controller[_0xcf87('0x11')]);router[_0xcf87('0x9')]('/:id/teams',auth[_0xcf87('0xa')](),controller[_0xcf87('0x12')]);router[_0xcf87('0x9')](_0xcf87('0x13'),auth[_0xcf87('0xa')](),controller[_0xcf87('0x14')]);router[_0xcf87('0x15')]('/',auth['isAuthenticated'](),controller[_0xcf87('0x16')]);router[_0xcf87('0x15')](_0xcf87('0x17'),auth['isAuthenticated'](),controller[_0xcf87('0x18')]);router[_0xcf87('0x15')](_0xcf87('0x13'),auth[_0xcf87('0xa')](),controller[_0xcf87('0x19')]);router[_0xcf87('0x1a')]('/:id',auth[_0xcf87('0xa')](),controller[_0xcf87('0x1b')]);router[_0xcf87('0x1c')](_0xcf87('0xe'),auth['isAuthenticated'](),controller[_0xcf87('0x1d')]);router['delete']('/:id/teams',auth[_0xcf87('0xa')](),controller[_0xcf87('0x1e')]);router['delete'](_0xcf87('0x13'),auth[_0xcf87('0xa')](),controller[_0xcf87('0x1f')]);module[_0xcf87('0x20')]=router; \ No newline at end of file +var _0x4f73=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','index','get','/describe','isAuthenticated','describe','show','/:id/members','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','addAgents','/:id','update','destroy','delete','removeAgents'];(function(_0x966a3c,_0x263646){var _0x3a1ef1=function(_0xfad69f){while(--_0xfad69f){_0x966a3c['push'](_0x966a3c['shift']());}};_0x3a1ef1(++_0x263646);}(_0x4f73,0x134));var _0x34f7=function(_0x834bb6,_0x1c5e35){_0x834bb6=_0x834bb6-0x0;var _0xa35d00=_0x4f73[_0x834bb6];return _0xa35d00;};'use strict';var multer=require(_0x34f7('0x0'));var util=require(_0x34f7('0x1'));var path=require('path');var timeout=require(_0x34f7('0x2'));var express=require(_0x34f7('0x3'));var router=express[_0x34f7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x34f7('0x5'));var interaction=require(_0x34f7('0x6'));var config=require(_0x34f7('0x7'));var controller=require(_0x34f7('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x34f7('0x9')]);router[_0x34f7('0xa')](_0x34f7('0xb'),auth[_0x34f7('0xc')](),controller[_0x34f7('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x34f7('0xe')]);router[_0x34f7('0xa')](_0x34f7('0xf'),auth['isAuthenticated'](),controller['getMembers']);router[_0x34f7('0xa')](_0x34f7('0x10'),auth[_0x34f7('0xc')](),controller[_0x34f7('0x11')]);router[_0x34f7('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0x34f7('0x12')]);router[_0x34f7('0x13')]('/',auth[_0x34f7('0xc')](),controller['create']);router[_0x34f7('0x13')](_0x34f7('0x10'),auth[_0x34f7('0xc')](),controller[_0x34f7('0x14')]);router[_0x34f7('0x13')](_0x34f7('0x15'),auth['isAuthenticated'](),controller[_0x34f7('0x16')]);router['put'](_0x34f7('0x17'),auth[_0x34f7('0xc')](),controller[_0x34f7('0x18')]);router['delete'](_0x34f7('0x17'),auth[_0x34f7('0xc')](),controller[_0x34f7('0x19')]);router[_0x34f7('0x1a')](_0x34f7('0x10'),auth[_0x34f7('0xc')](),controller['removeTeams']);router[_0x34f7('0x1a')](_0x34f7('0x15'),auth['isAuthenticated'](),controller[_0x34f7('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index a34ac13..e7b795e 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 _0x48ea=['beepall','sequelize','STRING','name','INTEGER'];(function(_0x17b673,_0x39cb4a){var _0x164351=function(_0x20b821){while(--_0x20b821){_0x17b673['push'](_0x17b673['shift']());}};_0x164351(++_0x39cb4a);}(_0x48ea,0x9c));var _0xa48e=function(_0x1f404e,_0x15311d){_0x1f404e=_0x1f404e-0x0;var _0x513ca3=_0x48ea[_0x1f404e];return _0x513ca3;};'use strict';var Sequelize=require(_0xa48e('0x0'));module['exports']={'name':{'type':Sequelize[_0xa48e('0x1')],'unique':_0xa48e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xa48e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xa48e('0x4'),'roundrobin')},'description':{'type':Sequelize[_0xa48e('0x1')]}}; \ No newline at end of file +var _0x167e=['ENUM','rrmemory','beepall','sequelize','exports','STRING','name','INTEGER'];(function(_0x10afad,_0x30da9d){var _0x588d7e=function(_0x25e897){while(--_0x25e897){_0x10afad['push'](_0x10afad['shift']());}};_0x588d7e(++_0x30da9d);}(_0x167e,0xa3));var _0xe167=function(_0x2ea009,_0x475be8){_0x2ea009=_0x2ea009-0x0;var _0x500f98=_0x167e[_0x2ea009];return _0x500f98;};'use strict';var Sequelize=require(_0xe167('0x0'));module[_0xe167('0x1')]={'name':{'type':Sequelize[_0xe167('0x2')],'unique':_0xe167('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xe167('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe167('0x5')](_0xe167('0x6'),_0xe167('0x7'),'roundrobin')},'description':{'type':Sequelize[_0xe167('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index c26a3e8..943c273 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 _0x5fed=['to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','./whatsappQueue.socket','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','WhatsappQueues','UserProfileResource','sendStatus','error','stack','name','send','map','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','WhatsappQueue','includeAll','include','findAll','rows','show','params','rawAttributes','length','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne','UserWhatsappQueue','nolimit','pick','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','SIP','getTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','ids','omit','spread','isArray','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','desk.js'];(function(_0x2c6f7f,_0x37d8da){var _0x79a104=function(_0x1775d9){while(--_0x1775d9){_0x2c6f7f['push'](_0x2c6f7f['shift']());}};_0x79a104(++_0x37d8da);}(_0x5fed,0x10b));var _0xd5fe=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x5fed[_0x50aa2e];return _0x5e07f0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd5fe('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd5fe('0x1'));var rp=require(_0xd5fe('0x2'));var moment=require(_0xd5fe('0x3'));var BPromise=require(_0xd5fe('0x4'));var Mustache=require(_0xd5fe('0x5'));var util=require(_0xd5fe('0x6'));var path=require(_0xd5fe('0x7'));var sox=require(_0xd5fe('0x8'));var csv=require('to-csv');var ejs=require(_0xd5fe('0x9'));var fs=require('fs');var fs_extra=require(_0xd5fe('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd5fe('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd5fe('0xc'));var toCsv=require(_0xd5fe('0xd'));var querystring=require(_0xd5fe('0xe'));var Papa=require('papaparse');var Redis=require(_0xd5fe('0xf'));var authService=require(_0xd5fe('0x10'));var qs=require(_0xd5fe('0x11'));var as=require(_0xd5fe('0x12'));var hardwareService=require(_0xd5fe('0x13'));var logger=require(_0xd5fe('0x14'))('api');var utils=require(_0xd5fe('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd5fe('0x16'));var db=require('../../mysqldb')['db'];config[_0xd5fe('0x17')]=_[_0xd5fe('0x18')](config[_0xd5fe('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd5fe('0x17')]));require(_0xd5fe('0x19'))['register'](socket);function respondWithStatusCode(_0x4357f5,_0x28114f){_0x28114f=_0x28114f||0xcc;return function(_0x2bd713){if(_0x2bd713){return _0x4357f5['sendStatus'](_0x28114f);}return _0x4357f5[_0xd5fe('0x1a')](_0x28114f)[_0xd5fe('0x1b')]();};}function respondWithResult(_0x58b734,_0x31c332){_0x31c332=_0x31c332||0xc8;return function(_0x6e5400){if(_0x6e5400){return _0x58b734[_0xd5fe('0x1a')](_0x31c332)[_0xd5fe('0x1c')](_0x6e5400);}};}function respondWithFilteredResult(_0x347225,_0x419bfa){return function(_0x55ac35){if(_0x55ac35){var _0x8a7378=typeof _0x419bfa['offset']===_0xd5fe('0x1d')&&typeof _0x419bfa['limit']===_0xd5fe('0x1d');var _0x2fe0bd=_0x55ac35[_0xd5fe('0x1e')];var _0x111e7d=_0x8a7378?0x0:_0x419bfa[_0xd5fe('0x1f')];var _0x44d073=_0x8a7378?_0x55ac35['count']:_0x419bfa[_0xd5fe('0x1f')]+_0x419bfa[_0xd5fe('0x20')];var _0x1f9a32;if(_0x44d073>=_0x2fe0bd){_0x44d073=_0x2fe0bd;_0x1f9a32=0xc8;}else{_0x1f9a32=0xce;}_0x347225[_0xd5fe('0x1a')](_0x1f9a32);return _0x347225[_0xd5fe('0x21')](_0xd5fe('0x22'),_0x111e7d+'-'+_0x44d073+'/'+_0x2fe0bd)[_0xd5fe('0x1c')](_0x55ac35);}return null;};}function patchUpdates(_0x243ceb){return function(_0x199eed){try{jsonpatch[_0xd5fe('0x23')](_0x199eed,_0x243ceb,!![]);}catch(_0x5bb7c1){return BPromise[_0xd5fe('0x24')](_0x5bb7c1);}return _0x199eed[_0xd5fe('0x25')]();};}function saveUpdates(_0x261903,_0x110ef2){return function(_0x33cca4){if(_0x33cca4){return _0x33cca4[_0xd5fe('0x26')](_0x261903)['then'](function(_0x3563a1){return _0x3563a1;});}return null;};}function removeEntity(_0x13677b,_0x1b96f6){return function(_0x3bbddf){if(_0x3bbddf){return _0x3bbddf[_0xd5fe('0x27')]()[_0xd5fe('0x28')](function(){var _0x19ee34=_0x3bbddf[_0xd5fe('0x29')]({'plain':!![]});var _0x4ccf31=_0xd5fe('0x2a');return db[_0xd5fe('0x2b')][_0xd5fe('0x27')]({'where':{'type':_0x4ccf31,'resourceId':_0x19ee34['id']}})[_0xd5fe('0x28')](function(){return _0x3bbddf;});})[_0xd5fe('0x28')](function(){_0x13677b[_0xd5fe('0x1a')](0xcc)[_0xd5fe('0x1b')]();});}};}function handleEntityNotFound(_0x15f2d3,_0x431f18){return function(_0x3e18b0){if(!_0x3e18b0){_0x15f2d3[_0xd5fe('0x2c')](0x194);}return _0x3e18b0;};}function handleError(_0x244031,_0x4e2a5f){_0x4e2a5f=_0x4e2a5f||0x1f4;return function(_0x284347){logger[_0xd5fe('0x2d')](_0x284347[_0xd5fe('0x2e')]);if(_0x284347[_0xd5fe('0x2f')]){delete _0x284347[_0xd5fe('0x2f')];}_0x244031[_0xd5fe('0x1a')](_0x4e2a5f)[_0xd5fe('0x30')](_0x284347);};}exports['index']=function(_0x1b980d,_0x93c078){var _0x52766b={},_0x532347={},_0x1e0ab3={'count':0x0,'rows':[]};var _0xf61c28=_[_0xd5fe('0x31')](db['WhatsappQueue']['rawAttributes'],function(_0x4ca90a){return{'name':_0x4ca90a['fieldName'],'type':_0x4ca90a[_0xd5fe('0x32')][_0xd5fe('0x33')]};});_0x532347[_0xd5fe('0x34')]=_[_0xd5fe('0x31')](_0xf61c28,_0xd5fe('0x2f'));_0x532347['query']=_[_0xd5fe('0x35')](_0x1b980d['query']);_0x532347[_0xd5fe('0x36')]=_[_0xd5fe('0x37')](_0x532347[_0xd5fe('0x34')],_0x532347[_0xd5fe('0x38')]);_0x52766b[_0xd5fe('0x39')]=_[_0xd5fe('0x37')](_0x532347[_0xd5fe('0x34')],qs['fields'](_0x1b980d[_0xd5fe('0x38')][_0xd5fe('0x3a')]));_0x52766b[_0xd5fe('0x39')]=_0x52766b['attributes']['length']?_0x52766b[_0xd5fe('0x39')]:_0x532347['model'];if(!_0x1b980d[_0xd5fe('0x38')][_0xd5fe('0x3b')]('nolimit')){_0x52766b[_0xd5fe('0x20')]=qs[_0xd5fe('0x20')](_0x1b980d[_0xd5fe('0x38')][_0xd5fe('0x20')]);_0x52766b[_0xd5fe('0x1f')]=qs['offset'](_0x1b980d[_0xd5fe('0x38')][_0xd5fe('0x1f')]);}_0x52766b[_0xd5fe('0x3c')]=qs[_0xd5fe('0x3d')](_0x1b980d[_0xd5fe('0x38')][_0xd5fe('0x3d')]);_0x52766b[_0xd5fe('0x3e')]=qs[_0xd5fe('0x36')](_['pick'](_0x1b980d[_0xd5fe('0x38')],_0x532347['filters']),_0xf61c28);if(_0x1b980d[_0xd5fe('0x38')]['filter']){_0x52766b[_0xd5fe('0x3e')]=_[_0xd5fe('0x3f')](_0x52766b['where'],{'$or':_[_0xd5fe('0x31')](_0xf61c28,function(_0x4669e8){if(_0x4669e8['type']!==_0xd5fe('0x40')){var _0x1a020b={};_0x1a020b[_0x4669e8[_0xd5fe('0x2f')]]={'$like':'%'+_0x1b980d[_0xd5fe('0x38')][_0xd5fe('0x41')]+'%'};return _0x1a020b;}})});}_0x52766b=_[_0xd5fe('0x3f')]({},_0x52766b,_0x1b980d[_0xd5fe('0x42')]);var _0x474165={'where':_0x52766b[_0xd5fe('0x3e')]};return db[_0xd5fe('0x43')][_0xd5fe('0x1e')](_0x474165)['then'](function(_0x514d6f){_0x1e0ab3[_0xd5fe('0x1e')]=_0x514d6f;if(_0x1b980d[_0xd5fe('0x38')][_0xd5fe('0x44')]){_0x52766b[_0xd5fe('0x45')]=[{'all':!![]}];}return db[_0xd5fe('0x43')][_0xd5fe('0x46')](_0x52766b);})['then'](function(_0x41c6a2){_0x1e0ab3[_0xd5fe('0x47')]=_0x41c6a2;return _0x1e0ab3;})[_0xd5fe('0x28')](respondWithFilteredResult(_0x93c078,_0x52766b))['catch'](handleError(_0x93c078,null));};exports[_0xd5fe('0x48')]=function(_0x133ff3,_0x33ffe0){var _0x4f7540={'raw':!![],'where':{'id':_0x133ff3[_0xd5fe('0x49')]['id']}},_0x2c1748={};_0x2c1748[_0xd5fe('0x34')]=_['keys'](db[_0xd5fe('0x43')][_0xd5fe('0x4a')]);_0x2c1748[_0xd5fe('0x38')]=_[_0xd5fe('0x35')](_0x133ff3[_0xd5fe('0x38')]);_0x2c1748['filters']=_['intersection'](_0x2c1748[_0xd5fe('0x34')],_0x2c1748[_0xd5fe('0x38')]);_0x4f7540[_0xd5fe('0x39')]=_['intersection'](_0x2c1748['model'],qs['fields'](_0x133ff3['query'][_0xd5fe('0x3a')]));_0x4f7540[_0xd5fe('0x39')]=_0x4f7540['attributes'][_0xd5fe('0x4b')]?_0x4f7540[_0xd5fe('0x39')]:_0x2c1748[_0xd5fe('0x34')];if(_0x133ff3[_0xd5fe('0x38')]['includeAll']){_0x4f7540[_0xd5fe('0x45')]=[{'all':!![]}];}_0x4f7540=_['merge']({},_0x4f7540,_0x133ff3['options']);return db[_0xd5fe('0x43')]['find'](_0x4f7540)[_0xd5fe('0x28')](handleEntityNotFound(_0x33ffe0,null))[_0xd5fe('0x28')](respondWithResult(_0x33ffe0,null))[_0xd5fe('0x4c')](handleError(_0x33ffe0,null));};exports[_0xd5fe('0x4d')]=function(_0x2adfe4,_0x5d3382){return db['WhatsappQueue'][_0xd5fe('0x4d')](_0x2adfe4[_0xd5fe('0x4e')],{})[_0xd5fe('0x28')](function(_0x54436f){var _0x50494b=_0x2adfe4[_0xd5fe('0x4f')]['get']({'plain':!![]});if(!_0x50494b)throw new Error(_0xd5fe('0x50'));if(_0x50494b['role']===_0xd5fe('0x4f')){var _0x43caba=_0x54436f[_0xd5fe('0x29')]({'plain':!![]});var _0x3f0544=_0xd5fe('0x2a');return db['UserProfileSection'][_0xd5fe('0x51')]({'where':{'name':_0x3f0544,'userProfileId':_0x50494b['userProfileId']},'raw':!![]})[_0xd5fe('0x28')](function(_0x83e558){if(_0x83e558&&_0x83e558[_0xd5fe('0x52')]===0x0){return db[_0xd5fe('0x2b')][_0xd5fe('0x4d')]({'name':_0x43caba['name'],'resourceId':_0x43caba['id'],'type':_0x83e558[_0xd5fe('0x2f')],'sectionId':_0x83e558['id']},{})['then'](function(){return _0x54436f;});}else{return _0x54436f;}})[_0xd5fe('0x4c')](function(_0x231c4c){logger[_0xd5fe('0x2d')](_0xd5fe('0x53'),_0x231c4c);throw _0x231c4c;});}return _0x54436f;})[_0xd5fe('0x28')](respondWithResult(_0x5d3382,0xc9))[_0xd5fe('0x4c')](handleError(_0x5d3382,null));};exports[_0xd5fe('0x26')]=function(_0x448f67,_0x3c240e){if(_0x448f67[_0xd5fe('0x4e')]['id']){delete _0x448f67[_0xd5fe('0x4e')]['id'];}return db[_0xd5fe('0x43')][_0xd5fe('0x51')]({'where':{'id':_0x448f67[_0xd5fe('0x49')]['id']}})['then'](handleEntityNotFound(_0x3c240e,null))['then'](saveUpdates(_0x448f67[_0xd5fe('0x4e')],null))[_0xd5fe('0x28')](respondWithResult(_0x3c240e,null))['catch'](handleError(_0x3c240e,null));};exports['destroy']=function(_0x5b1259,_0x1fbfb3){return db[_0xd5fe('0x43')][_0xd5fe('0x51')]({'where':{'id':_0x5b1259['params']['id']}})['then'](handleEntityNotFound(_0x1fbfb3,null))[_0xd5fe('0x28')](removeEntity(_0x1fbfb3,null))[_0xd5fe('0x4c')](handleError(_0x1fbfb3,null));};exports['describe']=function(_0x18967e,_0x3de161){return db[_0xd5fe('0x43')]['describe']()[_0xd5fe('0x28')](respondWithResult(_0x3de161,null))[_0xd5fe('0x4c')](handleError(_0x3de161,null));};exports[_0xd5fe('0x54')]=function(_0x4ad66d,_0x115c0b,_0x239910){var _0x4311cd={'raw':!![],'where':{}},_0x2f5b1b={},_0xfd37bd;return db[_0xd5fe('0x43')][_0xd5fe('0x55')]({'where':{'id':_0x4ad66d[_0xd5fe('0x49')]['id']}})['then'](handleEntityNotFound(_0x115c0b,null))[_0xd5fe('0x28')](function(_0xae1e47){if(_0xae1e47){_0xfd37bd=_0xae1e47[_0xd5fe('0x29')]({'plain':!![]});_0x2f5b1b[_0xd5fe('0x34')]=_[_0xd5fe('0x35')](db[_0xd5fe('0x56')][_0xd5fe('0x4a')]);_0x2f5b1b[_0xd5fe('0x38')]=_['keys'](_0x4ad66d[_0xd5fe('0x38')]);_0x2f5b1b[_0xd5fe('0x36')]=_[_0xd5fe('0x37')](_0x2f5b1b[_0xd5fe('0x34')],_0x2f5b1b[_0xd5fe('0x38')]);_0x4311cd[_0xd5fe('0x39')]=_[_0xd5fe('0x37')](_0x2f5b1b[_0xd5fe('0x34')],qs[_0xd5fe('0x3a')](_0x4ad66d[_0xd5fe('0x38')][_0xd5fe('0x3a')]));_0x4311cd[_0xd5fe('0x39')]=_0x4311cd[_0xd5fe('0x39')][_0xd5fe('0x4b')]?_0x4311cd[_0xd5fe('0x39')]:_0x2f5b1b['model'];if(!_0x4ad66d[_0xd5fe('0x38')][_0xd5fe('0x3b')](_0xd5fe('0x57'))){_0x4311cd[_0xd5fe('0x20')]=qs['limit'](_0x4ad66d[_0xd5fe('0x38')][_0xd5fe('0x20')]);_0x4311cd[_0xd5fe('0x1f')]=qs[_0xd5fe('0x1f')](_0x4ad66d[_0xd5fe('0x38')]['offset']);}_0x4311cd[_0xd5fe('0x3c')]=qs[_0xd5fe('0x3d')](_0x4ad66d[_0xd5fe('0x38')]['sort']);_0x4311cd[_0xd5fe('0x3e')]=qs['filters'](_[_0xd5fe('0x58')](_0x4ad66d['query'],_0x2f5b1b[_0xd5fe('0x36')]));_0x4311cd['where'][_0xd5fe('0x59')]=_0xae1e47['id'];if(_0x4ad66d[_0xd5fe('0x38')][_0xd5fe('0x41')]){_0x4311cd[_0xd5fe('0x3e')]=_[_0xd5fe('0x3f')](_0x4311cd[_0xd5fe('0x3e')],{'$or':_[_0xd5fe('0x31')](_0x4311cd[_0xd5fe('0x39')],function(_0x578522){var _0x177f78={};_0x177f78[_0x578522]={'$like':'%'+_0x4ad66d[_0xd5fe('0x38')][_0xd5fe('0x41')]+'%'};return _0x177f78;})});}_0x4311cd=_[_0xd5fe('0x3f')]({},_0x4311cd,_0x4ad66d[_0xd5fe('0x42')]);return db['UserWhatsappQueue'][_0xd5fe('0x46')](_0x4311cd);}})[_0xd5fe('0x28')](function(_0x45f450){if(_0x45f450){return db[_0xd5fe('0x5a')][_0xd5fe('0x5b')]({'where':{'id':_['map'](_0x45f450,_0xd5fe('0x5c')),'role':_0xd5fe('0x5d')},'attributes':['id',_0xd5fe('0x2f'),_0xd5fe('0x5e'),_0xd5fe('0x5f'),_0xd5fe('0x60')]});}})[_0xd5fe('0x28')](function(_0x20243d){if(_0x20243d){return{'count':_0x20243d[_0xd5fe('0x1e')],'rows':_['map'](_0x20243d['rows'],function(_0x50dc25){return{'membername':_0x50dc25[_0xd5fe('0x2f')],'UserId':_0x50dc25['id'],'queue_name':_0xfd37bd['name'],'WhatsappQueueId':_0xfd37bd['id'],'interface':util[_0xd5fe('0x61')]('%s/%s',_0xd5fe('0x62'),_0x50dc25[_0xd5fe('0x2f')]),'penalty':0x0,'paused':_0x50dc25[_0xd5fe('0x5e')],'createdAt':_0x50dc25['createdAt'],'updatedAt':_0x50dc25[_0xd5fe('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd5fe('0x28')](respondWithFilteredResult(_0x115c0b,_0x4311cd))[_0xd5fe('0x4c')](handleError(_0x115c0b,null));};exports[_0xd5fe('0x63')]=function(_0x5cc684,_0x509566,_0x4f6369){var _0x37cd7e={};var _0x564e8e={};var _0x559a67;var _0x4492bf;return db[_0xd5fe('0x43')][_0xd5fe('0x55')]({'where':{'id':_0x5cc684[_0xd5fe('0x49')]['id']}})['then'](handleEntityNotFound(_0x509566,null))[_0xd5fe('0x28')](function(_0x182f0d){if(_0x182f0d){_0x559a67=_0x182f0d;_0x564e8e['model']=_[_0xd5fe('0x35')](db[_0xd5fe('0x64')]['rawAttributes']);_0x564e8e[_0xd5fe('0x38')]=_[_0xd5fe('0x35')](_0x5cc684[_0xd5fe('0x38')]);_0x564e8e[_0xd5fe('0x36')]=_[_0xd5fe('0x37')](_0x564e8e[_0xd5fe('0x34')],_0x564e8e[_0xd5fe('0x38')]);_0x37cd7e[_0xd5fe('0x39')]=_[_0xd5fe('0x37')](_0x564e8e[_0xd5fe('0x34')],qs[_0xd5fe('0x3a')](_0x5cc684[_0xd5fe('0x38')][_0xd5fe('0x3a')]));_0x37cd7e[_0xd5fe('0x39')]=_0x37cd7e[_0xd5fe('0x39')][_0xd5fe('0x4b')]?_0x37cd7e[_0xd5fe('0x39')]:_0x564e8e[_0xd5fe('0x34')];_0x37cd7e[_0xd5fe('0x3c')]=qs[_0xd5fe('0x3d')](_0x5cc684[_0xd5fe('0x38')]['sort']);_0x37cd7e[_0xd5fe('0x3e')]=qs[_0xd5fe('0x36')](_[_0xd5fe('0x58')](_0x5cc684[_0xd5fe('0x38')],_0x564e8e[_0xd5fe('0x36')]));if(_0x5cc684['query'][_0xd5fe('0x41')]){_0x37cd7e[_0xd5fe('0x3e')]=_[_0xd5fe('0x3f')](_0x37cd7e[_0xd5fe('0x3e')],{'$or':_[_0xd5fe('0x31')](_0x37cd7e['attributes'],function(_0x3436d3){var _0x33c6b8={};_0x33c6b8[_0x3436d3]={'$like':'%'+_0x5cc684['query'][_0xd5fe('0x41')]+'%'};return _0x33c6b8;})});}_0x37cd7e=_['merge']({},_0x37cd7e,_0x5cc684[_0xd5fe('0x42')]);return _0x559a67[_0xd5fe('0x63')](_0x37cd7e);}})[_0xd5fe('0x28')](function(_0x5db368){if(_0x5db368){_0x4492bf=_0x5db368['length'];if(!_0x5cc684[_0xd5fe('0x38')][_0xd5fe('0x3b')](_0xd5fe('0x57'))){_0x37cd7e[_0xd5fe('0x20')]=qs['limit'](_0x5cc684[_0xd5fe('0x38')][_0xd5fe('0x20')]);_0x37cd7e['offset']=qs[_0xd5fe('0x1f')](_0x5cc684['query'][_0xd5fe('0x1f')]);}return _0x559a67[_0xd5fe('0x63')](_0x37cd7e);}})['then'](function(_0x2115cf){if(_0x2115cf){return _0x2115cf?{'count':_0x4492bf,'rows':_0x2115cf}:null;}})[_0xd5fe('0x28')](respondWithResult(_0x509566,null))['catch'](handleError(_0x509566,null));};exports['addTeams']=function(_0x2a164c,_0x5dee81,_0x5dd32c){var _0x53e413=_0x2a164c[_0xd5fe('0x4e')]['ids'];return db['Team'][_0xd5fe('0x46')]({'where':{'id':_0x53e413},'attributes':['id'],'include':[{'model':db[_0xd5fe('0x5a')],'as':_0xd5fe('0x65'),'attributes':['id',_0xd5fe('0x2f'),_0xd5fe('0x66'),_0xd5fe('0x67'),_0xd5fe('0x68')],'raw':!![]}]})[_0xd5fe('0x28')](function(_0xa7ec29){if(_0xa7ec29){var _0x111ee6=_[_0xd5fe('0x69')](_0xa7ec29,function(_0x4ef767){var _0x41c7ec=_0x4ef767['get']({'plain':!![]});return _0x41c7ec[_0xd5fe('0x65')];});return db[_0xd5fe('0x43')][_0xd5fe('0x51')]({'where':{'id':_0x2a164c[_0xd5fe('0x49')]['id']}})[_0xd5fe('0x28')](function(_0x3f8be8){return db[_0xd5fe('0x6a')]['transaction'](function(_0x48a4e4){return _0x3f8be8['addTeams'](_0x53e413,{'transaction':_0x48a4e4})[_0xd5fe('0x28')](function(){return BPromise[_0xd5fe('0x6b')](_0x111ee6,function(_0x19610f){return db['UserWhatsappQueue'][_0xd5fe('0x6c')]({'where':{'UserId':_0x19610f['id'],'WhatsappQueueId':_0x2a164c[_0xd5fe('0x49')]['id']},'transaction':_0x48a4e4});});})[_0xd5fe('0x28')](function(){_0x111ee6[_0xd5fe('0x6d')](function(_0x199709){socket[_0xd5fe('0x6e')](_0xd5fe('0x6f'),{'UserId':_0x199709['id'],'WhatsappQueueId':_0x3f8be8['id']});});});});});}})['then'](respondWithStatusCode(_0x5dee81,null))['catch'](handleError(_0x5dee81,null));};exports[_0xd5fe('0x70')]=function(_0x438104,_0x2789f2,_0x23bda9){return db[_0xd5fe('0x64')][_0xd5fe('0x46')]({'where':{'id':_0x438104[_0xd5fe('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd5fe('0x5a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xd5fe('0x28')](handleEntityNotFound(_0x2789f2,null))['then'](function(_0x10c831){var _0x176d41=_[_0xd5fe('0x31')](_0x10c831,'id');var _0x54f1f6=[];var _0x31adce=[];var _0xce5cd1=squel[_0xd5fe('0x71')]();_0xce5cd1[_0xd5fe('0x72')]('tq.TeamId')['from'](_0xd5fe('0x73'),'tq')[_0xd5fe('0x74')](_0xd5fe('0x75'),'ut',_0xd5fe('0x76'))[_0xd5fe('0x3e')](_0xd5fe('0x77'),_0x438104[_0xd5fe('0x49')]['id']);for(var _0x1776e4=0x0;_0x1776e4<_0x10c831[_0xd5fe('0x4b')];_0x1776e4+=0x1){let _0x31fe6c=_0x10c831[_0x1776e4];for(var _0x4c9268=0x0;_0x4c9268<_0x31fe6c[_0xd5fe('0x65')][_0xd5fe('0x4b')];_0x4c9268+=0x1){let _0x4e9f00=_0x31fe6c['Agents'][_0x4c9268];var _0x5f5819=_0xce5cd1[_0xd5fe('0x78')]();_0x5f5819[_0xd5fe('0x3e')](_0xd5fe('0x79'),_0x4e9f00['id']);_0x31adce[_0xd5fe('0x7a')](db['sequelize'][_0xd5fe('0x38')](_0x5f5819['toString'](),{'type':db[_0xd5fe('0x6a')][_0xd5fe('0x7b')]['SELECT']})[_0xd5fe('0x28')](function(_0x5125d2){if(_0x5125d2[_0xd5fe('0x4b')]===0x1){return _0x4e9f00['id'];}else{var _0x467dd3=_[_0xd5fe('0x7c')](_[_0xd5fe('0x31')](_0x5125d2,_0xd5fe('0x7d')),function(_0x222176){return _[_0xd5fe('0x7e')](_0x176d41,_0x222176);});if(_0x467dd3){return _0x4e9f00['id'];}}}));}}return BPromise[_0xd5fe('0x7f')](_0x31adce)[_0xd5fe('0x28')](function(_0x2c3b42){_0x54f1f6=_(_0x54f1f6)[_0xd5fe('0x80')](_0x2c3b42)[_0xd5fe('0x81')]()[_0xd5fe('0x82')]();return db[_0xd5fe('0x43')][_0xd5fe('0x51')]({'where':{'id':_0x438104[_0xd5fe('0x49')]['id']}})[_0xd5fe('0x28')](function(_0x328515){return db[_0xd5fe('0x6a')]['transaction'](function(_0x37be2d){return _0x328515['removeTeams'](_0x438104['query']['ids'],{'transaction':_0x37be2d})[_0xd5fe('0x28')](function(){if(!_[_0xd5fe('0x83')](_0x54f1f6)){return _0x328515[_0xd5fe('0x84')](_0x54f1f6,{'transaction':_0x37be2d});}})['then'](function(){_0x54f1f6['forEach'](function(_0x42406c){socket[_0xd5fe('0x6e')](_0xd5fe('0x85'),{'UserId':_0x42406c,'WhatsappQueueId':_0x328515['id']});});});});});});})[_0xd5fe('0x28')](respondWithStatusCode(_0x2789f2,null))[_0xd5fe('0x4c')](handleError(_0x2789f2,null));};exports['addAgents']=function(_0xfacfa2,_0x1a6d1b,_0x4416dd){return db['WhatsappQueue'][_0xd5fe('0x51')]({'where':{'id':_0xfacfa2['params']['id']}})[_0xd5fe('0x28')](handleEntityNotFound(_0x1a6d1b,null))[_0xd5fe('0x28')](function(_0x115d9c){if(_0x115d9c){return _0x115d9c[_0xd5fe('0x86')](_0xfacfa2['body'][_0xd5fe('0x87')],_[_0xd5fe('0x88')](_0xfacfa2[_0xd5fe('0x4e')],[_0xd5fe('0x87'),'id'])||{})[_0xd5fe('0x89')](function(_0x407812){for(var _0x106786=0x0;_0x106786<_0xfacfa2['body'][_0xd5fe('0x87')][_0xd5fe('0x4b')];_0x106786+=0x1){socket[_0xd5fe('0x6e')](_0xd5fe('0x6f'),{'UserId':Number(_0xfacfa2[_0xd5fe('0x4e')]['ids'][_0x106786]),'WhatsappQueueId':Number(_0xfacfa2[_0xd5fe('0x49')]['id'])});}return _0x407812;});}})['then'](respondWithResult(_0x1a6d1b,null))[_0xd5fe('0x4c')](handleError(_0x1a6d1b,null));};exports[_0xd5fe('0x84')]=function(_0xc57330,_0x333ae8,_0x2617e8){return db[_0xd5fe('0x43')][_0xd5fe('0x51')]({'where':{'id':_0xc57330[_0xd5fe('0x49')]['id']}})[_0xd5fe('0x28')](handleEntityNotFound(_0x333ae8,null))[_0xd5fe('0x28')](function(_0x5dcd07){if(_0x5dcd07){return _0x5dcd07[_0xd5fe('0x84')](_0xc57330['query'][_0xd5fe('0x87')])['then'](function(){if(_[_0xd5fe('0x8a')](_0xc57330[_0xd5fe('0x38')][_0xd5fe('0x87')])){for(var _0x12caa6=0x0;_0x12caa6<_0xc57330[_0xd5fe('0x38')][_0xd5fe('0x87')][_0xd5fe('0x4b')];_0x12caa6+=0x1){socket[_0xd5fe('0x6e')](_0xd5fe('0x85'),{'UserId':Number(_0xc57330['query']['ids'][_0x12caa6]),'WhatsappQueueId':Number(_0xc57330[_0xd5fe('0x49')]['id'])});}}else{socket[_0xd5fe('0x6e')](_0xd5fe('0x85'),{'UserId':Number(_0xc57330[_0xd5fe('0x38')][_0xd5fe('0x87')]),'WhatsappQueueId':Number(_0xc57330['params']['id'])});}});}})[_0xd5fe('0x28')](respondWithStatusCode(_0x333ae8,null))['catch'](handleError(_0x333ae8,null));};exports[_0xd5fe('0x8b')]=function(_0xe1fa46,_0x154038,_0x581a39){var _0x221993={};var _0x28d713={};var _0x4f28ea;var _0x397e34;return db['WhatsappQueue'][_0xd5fe('0x55')]({'where':{'id':_0xe1fa46[_0xd5fe('0x49')]['id']}})['then'](handleEntityNotFound(_0x154038,null))['then'](function(_0x4f90fe){if(_0x4f90fe){_0x4f28ea=_0x4f90fe;_0x28d713['model']=_[_0xd5fe('0x35')](db[_0xd5fe('0x5a')][_0xd5fe('0x4a')]);_0x28d713[_0xd5fe('0x38')]=_[_0xd5fe('0x35')](_0xe1fa46[_0xd5fe('0x38')]);_0x28d713[_0xd5fe('0x36')]=_[_0xd5fe('0x37')](_0x28d713[_0xd5fe('0x34')],_0x28d713[_0xd5fe('0x38')]);_0x221993[_0xd5fe('0x39')]=_['intersection'](_0x28d713[_0xd5fe('0x34')],qs[_0xd5fe('0x3a')](_0xe1fa46[_0xd5fe('0x38')][_0xd5fe('0x3a')]));_0x221993['attributes']=_0x221993['attributes']['length']?_0x221993[_0xd5fe('0x39')]:_0x28d713[_0xd5fe('0x34')];_0x221993['order']=qs['sort'](_0xe1fa46[_0xd5fe('0x38')][_0xd5fe('0x3d')]);_0x221993['where']=qs['filters'](_[_0xd5fe('0x58')](_0xe1fa46[_0xd5fe('0x38')],_0x28d713['filters']));if(_0xe1fa46[_0xd5fe('0x38')][_0xd5fe('0x41')]){_0x221993[_0xd5fe('0x3e')]=_[_0xd5fe('0x3f')](_0x221993[_0xd5fe('0x3e')],{'$or':_[_0xd5fe('0x31')](_0x221993[_0xd5fe('0x39')],function(_0x1792bf){var _0x7bd346={};_0x7bd346[_0x1792bf]={'$like':'%'+_0xe1fa46[_0xd5fe('0x38')][_0xd5fe('0x41')]+'%'};return _0x7bd346;})});}_0x221993=_[_0xd5fe('0x3f')]({},_0x221993,_0xe1fa46[_0xd5fe('0x42')]);return _0x4f28ea[_0xd5fe('0x8b')](_0x221993);}})[_0xd5fe('0x28')](function(_0x331369){if(_0x331369){_0x397e34=_0x331369[_0xd5fe('0x4b')];if(!_0xe1fa46[_0xd5fe('0x38')][_0xd5fe('0x3b')](_0xd5fe('0x57'))){_0x221993[_0xd5fe('0x20')]=qs[_0xd5fe('0x20')](_0xe1fa46['query'][_0xd5fe('0x20')]);_0x221993[_0xd5fe('0x1f')]=qs[_0xd5fe('0x1f')](_0xe1fa46['query'][_0xd5fe('0x1f')]);}return _0x4f28ea['getAgents'](_0x221993);}})[_0xd5fe('0x28')](function(_0x4272e0){if(_0x4272e0){return _0x4272e0?{'count':_0x397e34,'rows':_0x4272e0}:null;}})[_0xd5fe('0x28')](respondWithResult(_0x154038,null))[_0xd5fe('0x4c')](handleError(_0x154038,null));}; \ No newline at end of file +var _0x48cb=['transaction','each','forEach','emit','userWhatsappQueue:save','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','union','value','removeTeams','isEmpty','addAgents','omit','spread','isArray','userWhatsappQueue:remove','getAgents','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./whatsappQueue.socket','sendStatus','status','json','limit','count','offset','set','apply','save','then','get','WhatsappQueues','UserProfileResource','destroy','error','stack','name','send','index','WhatsappQueue','rawAttributes','type','key','model','map','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserWhatsappQueue','findAndCountAll','UserId','agent','createdAt','format','SIP','whatsappPause','updatedAt','getTeams','findOne','addTeams','ids','Team','User','online','voicePause','interface','flatMap','Agents','sequelize'];(function(_0x4be3ec,_0x218441){var _0x44b79f=function(_0x56d3c1){while(--_0x56d3c1){_0x4be3ec['push'](_0x4be3ec['shift']());}};_0x44b79f(++_0x218441);}(_0x48cb,0x1c7));var _0xb48c=function(_0x39b148,_0x37726e){_0x39b148=_0x39b148-0x0;var _0x17a5ef=_0x48cb[_0x39b148];return _0x17a5ef;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb48c('0x0'));var jsonpatch=require(_0xb48c('0x1'));var rp=require(_0xb48c('0x2'));var moment=require(_0xb48c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb48c('0x4'));var util=require('util');var path=require(_0xb48c('0x5'));var sox=require(_0xb48c('0x6'));var csv=require('to-csv');var ejs=require(_0xb48c('0x7'));var fs=require('fs');var fs_extra=require(_0xb48c('0x8'));var _=require(_0xb48c('0x9'));var squel=require(_0xb48c('0xa'));var crypto=require(_0xb48c('0xb'));var jsforce=require(_0xb48c('0xc'));var deskjs=require(_0xb48c('0xd'));var toCsv=require(_0xb48c('0xe'));var querystring=require(_0xb48c('0xf'));var Papa=require('papaparse');var Redis=require(_0xb48c('0x10'));var authService=require(_0xb48c('0x11'));var qs=require(_0xb48c('0x12'));var as=require(_0xb48c('0x13'));var hardwareService=require(_0xb48c('0x14'));var logger=require(_0xb48c('0x15'))(_0xb48c('0x16'));var utils=require(_0xb48c('0x17'));var config=require(_0xb48c('0x18'));var licenseUtil=require(_0xb48c('0x19'));var db=require(_0xb48c('0x1a'))['db'];config['redis']=_[_0xb48c('0x1b')](config[_0xb48c('0x1c')],{'host':_0xb48c('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb48c('0x1c')]));require(_0xb48c('0x1e'))['register'](socket);function respondWithStatusCode(_0x448454,_0x208c2d){_0x208c2d=_0x208c2d||0xcc;return function(_0x45fbe){if(_0x45fbe){return _0x448454[_0xb48c('0x1f')](_0x208c2d);}return _0x448454[_0xb48c('0x20')](_0x208c2d)['end']();};}function respondWithResult(_0x518504,_0x1b631d){_0x1b631d=_0x1b631d||0xc8;return function(_0x1b7edb){if(_0x1b7edb){return _0x518504[_0xb48c('0x20')](_0x1b631d)[_0xb48c('0x21')](_0x1b7edb);}};}function respondWithFilteredResult(_0x3649e5,_0xc50edf){return function(_0x29409d){if(_0x29409d){var _0x71c8d4=typeof _0xc50edf['offset']==='undefined'&&typeof _0xc50edf[_0xb48c('0x22')]==='undefined';var _0x351eec=_0x29409d[_0xb48c('0x23')];var _0x598335=_0x71c8d4?0x0:_0xc50edf[_0xb48c('0x24')];var _0x5335d9=_0x71c8d4?_0x29409d[_0xb48c('0x23')]:_0xc50edf[_0xb48c('0x24')]+_0xc50edf[_0xb48c('0x22')];var _0x23cdc0;if(_0x5335d9>=_0x351eec){_0x5335d9=_0x351eec;_0x23cdc0=0xc8;}else{_0x23cdc0=0xce;}_0x3649e5[_0xb48c('0x20')](_0x23cdc0);return _0x3649e5[_0xb48c('0x25')]('Content-Range',_0x598335+'-'+_0x5335d9+'/'+_0x351eec)[_0xb48c('0x21')](_0x29409d);}return null;};}function patchUpdates(_0x34b060){return function(_0x590e31){try{jsonpatch[_0xb48c('0x26')](_0x590e31,_0x34b060,!![]);}catch(_0x4cd1bd){return BPromise['reject'](_0x4cd1bd);}return _0x590e31[_0xb48c('0x27')]();};}function saveUpdates(_0x2ca642,_0xb59f9c){return function(_0x5afc10){if(_0x5afc10){return _0x5afc10['update'](_0x2ca642)[_0xb48c('0x28')](function(_0x459068){return _0x459068;});}return null;};}function removeEntity(_0x5e1716,_0x41967f){return function(_0x18c657){if(_0x18c657){return _0x18c657['destroy']()[_0xb48c('0x28')](function(){var _0x48462e=_0x18c657[_0xb48c('0x29')]({'plain':!![]});var _0x22d10f=_0xb48c('0x2a');return db[_0xb48c('0x2b')][_0xb48c('0x2c')]({'where':{'type':_0x22d10f,'resourceId':_0x48462e['id']}})['then'](function(){return _0x18c657;});})[_0xb48c('0x28')](function(){_0x5e1716[_0xb48c('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x563392,_0x4fac4b){return function(_0x5ade4c){if(!_0x5ade4c){_0x563392['sendStatus'](0x194);}return _0x5ade4c;};}function handleError(_0x5b9ad7,_0x4a9a1e){_0x4a9a1e=_0x4a9a1e||0x1f4;return function(_0x5566b6){logger[_0xb48c('0x2d')](_0x5566b6[_0xb48c('0x2e')]);if(_0x5566b6['name']){delete _0x5566b6[_0xb48c('0x2f')];}_0x5b9ad7[_0xb48c('0x20')](_0x4a9a1e)[_0xb48c('0x30')](_0x5566b6);};}exports[_0xb48c('0x31')]=function(_0x4bb7e1,_0x25d51b){var _0x43e2d2={},_0x32e2dc={},_0x33db57={'count':0x0,'rows':[]};var _0x49685d=_['map'](db[_0xb48c('0x32')][_0xb48c('0x33')],function(_0x5e14ad){return{'name':_0x5e14ad['fieldName'],'type':_0x5e14ad[_0xb48c('0x34')][_0xb48c('0x35')]};});_0x32e2dc[_0xb48c('0x36')]=_[_0xb48c('0x37')](_0x49685d,'name');_0x32e2dc['query']=_[_0xb48c('0x38')](_0x4bb7e1['query']);_0x32e2dc[_0xb48c('0x39')]=_[_0xb48c('0x3a')](_0x32e2dc['model'],_0x32e2dc[_0xb48c('0x3b')]);_0x43e2d2[_0xb48c('0x3c')]=_[_0xb48c('0x3a')](_0x32e2dc['model'],qs[_0xb48c('0x3d')](_0x4bb7e1[_0xb48c('0x3b')][_0xb48c('0x3d')]));_0x43e2d2[_0xb48c('0x3c')]=_0x43e2d2['attributes']['length']?_0x43e2d2[_0xb48c('0x3c')]:_0x32e2dc['model'];if(!_0x4bb7e1[_0xb48c('0x3b')][_0xb48c('0x3e')](_0xb48c('0x3f'))){_0x43e2d2['limit']=qs[_0xb48c('0x22')](_0x4bb7e1[_0xb48c('0x3b')]['limit']);_0x43e2d2[_0xb48c('0x24')]=qs[_0xb48c('0x24')](_0x4bb7e1['query'][_0xb48c('0x24')]);}_0x43e2d2['order']=qs[_0xb48c('0x40')](_0x4bb7e1['query'][_0xb48c('0x40')]);_0x43e2d2['where']=qs[_0xb48c('0x39')](_[_0xb48c('0x41')](_0x4bb7e1['query'],_0x32e2dc['filters']),_0x49685d);if(_0x4bb7e1[_0xb48c('0x3b')]['filter']){_0x43e2d2[_0xb48c('0x42')]=_[_0xb48c('0x43')](_0x43e2d2[_0xb48c('0x42')],{'$or':_[_0xb48c('0x37')](_0x49685d,function(_0x2e48eb){if(_0x2e48eb['type']!==_0xb48c('0x44')){var _0x4848c3={};_0x4848c3[_0x2e48eb[_0xb48c('0x2f')]]={'$like':'%'+_0x4bb7e1[_0xb48c('0x3b')][_0xb48c('0x45')]+'%'};return _0x4848c3;}})});}_0x43e2d2=_[_0xb48c('0x43')]({},_0x43e2d2,_0x4bb7e1[_0xb48c('0x46')]);var _0xa80ae4={'where':_0x43e2d2[_0xb48c('0x42')]};return db['WhatsappQueue'][_0xb48c('0x23')](_0xa80ae4)[_0xb48c('0x28')](function(_0x1aaa21){_0x33db57['count']=_0x1aaa21;if(_0x4bb7e1[_0xb48c('0x3b')][_0xb48c('0x47')]){_0x43e2d2['include']=[{'all':!![]}];}return db[_0xb48c('0x32')][_0xb48c('0x48')](_0x43e2d2);})['then'](function(_0x538a74){_0x33db57[_0xb48c('0x49')]=_0x538a74;return _0x33db57;})['then'](respondWithFilteredResult(_0x25d51b,_0x43e2d2))[_0xb48c('0x4a')](handleError(_0x25d51b,null));};exports[_0xb48c('0x4b')]=function(_0x45783f,_0x539fe4){var _0xbc7c01={'raw':!![],'where':{'id':_0x45783f[_0xb48c('0x4c')]['id']}},_0xc384f0={};_0xc384f0['model']=_[_0xb48c('0x38')](db[_0xb48c('0x32')][_0xb48c('0x33')]);_0xc384f0[_0xb48c('0x3b')]=_[_0xb48c('0x38')](_0x45783f['query']);_0xc384f0[_0xb48c('0x39')]=_[_0xb48c('0x3a')](_0xc384f0[_0xb48c('0x36')],_0xc384f0[_0xb48c('0x3b')]);_0xbc7c01[_0xb48c('0x3c')]=_[_0xb48c('0x3a')](_0xc384f0[_0xb48c('0x36')],qs['fields'](_0x45783f[_0xb48c('0x3b')]['fields']));_0xbc7c01['attributes']=_0xbc7c01['attributes'][_0xb48c('0x4d')]?_0xbc7c01[_0xb48c('0x3c')]:_0xc384f0[_0xb48c('0x36')];if(_0x45783f['query'][_0xb48c('0x47')]){_0xbc7c01[_0xb48c('0x4e')]=[{'all':!![]}];}_0xbc7c01=_[_0xb48c('0x43')]({},_0xbc7c01,_0x45783f[_0xb48c('0x46')]);return db[_0xb48c('0x32')][_0xb48c('0x4f')](_0xbc7c01)[_0xb48c('0x28')](handleEntityNotFound(_0x539fe4,null))[_0xb48c('0x28')](respondWithResult(_0x539fe4,null))['catch'](handleError(_0x539fe4,null));};exports[_0xb48c('0x50')]=function(_0x4e8a63,_0x5ecb87){return db[_0xb48c('0x32')]['create'](_0x4e8a63[_0xb48c('0x51')],{})[_0xb48c('0x28')](function(_0x2f976c){var _0x5bb2dc=_0x4e8a63[_0xb48c('0x52')][_0xb48c('0x29')]({'plain':!![]});if(!_0x5bb2dc)throw new Error(_0xb48c('0x53'));if(_0x5bb2dc[_0xb48c('0x54')]==='user'){var _0x34818d=_0x2f976c[_0xb48c('0x29')]({'plain':!![]});var _0x130141=_0xb48c('0x2a');return db[_0xb48c('0x55')][_0xb48c('0x4f')]({'where':{'name':_0x130141,'userProfileId':_0x5bb2dc[_0xb48c('0x56')]},'raw':!![]})[_0xb48c('0x28')](function(_0x3e8b38){if(_0x3e8b38&&_0x3e8b38[_0xb48c('0x57')]===0x0){return db[_0xb48c('0x2b')][_0xb48c('0x50')]({'name':_0x34818d[_0xb48c('0x2f')],'resourceId':_0x34818d['id'],'type':_0x3e8b38[_0xb48c('0x2f')],'sectionId':_0x3e8b38['id']},{})[_0xb48c('0x28')](function(){return _0x2f976c;});}else{return _0x2f976c;}})[_0xb48c('0x4a')](function(_0x3d3177){logger['error'](_0xb48c('0x58'),_0x3d3177);throw _0x3d3177;});}return _0x2f976c;})[_0xb48c('0x28')](respondWithResult(_0x5ecb87,0xc9))['catch'](handleError(_0x5ecb87,null));};exports[_0xb48c('0x59')]=function(_0x2b0ee8,_0x4e8434){if(_0x2b0ee8['body']['id']){delete _0x2b0ee8[_0xb48c('0x51')]['id'];}return db[_0xb48c('0x32')][_0xb48c('0x4f')]({'where':{'id':_0x2b0ee8[_0xb48c('0x4c')]['id']}})[_0xb48c('0x28')](handleEntityNotFound(_0x4e8434,null))['then'](saveUpdates(_0x2b0ee8[_0xb48c('0x51')],null))[_0xb48c('0x28')](respondWithResult(_0x4e8434,null))['catch'](handleError(_0x4e8434,null));};exports[_0xb48c('0x2c')]=function(_0xa422aa,_0x11bb22){return db[_0xb48c('0x32')][_0xb48c('0x4f')]({'where':{'id':_0xa422aa[_0xb48c('0x4c')]['id']}})[_0xb48c('0x28')](handleEntityNotFound(_0x11bb22,null))[_0xb48c('0x28')](removeEntity(_0x11bb22,null))[_0xb48c('0x4a')](handleError(_0x11bb22,null));};exports[_0xb48c('0x5a')]=function(_0x55040f,_0xc49300){return db[_0xb48c('0x32')][_0xb48c('0x5a')]()[_0xb48c('0x28')](respondWithResult(_0xc49300,null))[_0xb48c('0x4a')](handleError(_0xc49300,null));};exports[_0xb48c('0x5b')]=function(_0x221963,_0x3259f8,_0x1c9dbe){var _0xca9c15={'raw':!![],'where':{}},_0x2eced4={},_0x4e25dc;return db[_0xb48c('0x32')]['findOne']({'where':{'id':_0x221963[_0xb48c('0x4c')]['id']}})[_0xb48c('0x28')](handleEntityNotFound(_0x3259f8,null))[_0xb48c('0x28')](function(_0x5c92a6){if(_0x5c92a6){_0x4e25dc=_0x5c92a6[_0xb48c('0x29')]({'plain':!![]});_0x2eced4[_0xb48c('0x36')]=_[_0xb48c('0x38')](db[_0xb48c('0x5c')]['rawAttributes']);_0x2eced4[_0xb48c('0x3b')]=_['keys'](_0x221963[_0xb48c('0x3b')]);_0x2eced4[_0xb48c('0x39')]=_[_0xb48c('0x3a')](_0x2eced4[_0xb48c('0x36')],_0x2eced4[_0xb48c('0x3b')]);_0xca9c15[_0xb48c('0x3c')]=_['intersection'](_0x2eced4[_0xb48c('0x36')],qs[_0xb48c('0x3d')](_0x221963[_0xb48c('0x3b')][_0xb48c('0x3d')]));_0xca9c15[_0xb48c('0x3c')]=_0xca9c15[_0xb48c('0x3c')][_0xb48c('0x4d')]?_0xca9c15[_0xb48c('0x3c')]:_0x2eced4['model'];if(!_0x221963['query'][_0xb48c('0x3e')](_0xb48c('0x3f'))){_0xca9c15['limit']=qs[_0xb48c('0x22')](_0x221963[_0xb48c('0x3b')][_0xb48c('0x22')]);_0xca9c15[_0xb48c('0x24')]=qs['offset'](_0x221963[_0xb48c('0x3b')][_0xb48c('0x24')]);}_0xca9c15['order']=qs[_0xb48c('0x40')](_0x221963['query'][_0xb48c('0x40')]);_0xca9c15[_0xb48c('0x42')]=qs['filters'](_['pick'](_0x221963['query'],_0x2eced4[_0xb48c('0x39')]));_0xca9c15['where']['WhatsappQueueId']=_0x5c92a6['id'];if(_0x221963['query'][_0xb48c('0x45')]){_0xca9c15[_0xb48c('0x42')]=_[_0xb48c('0x43')](_0xca9c15['where'],{'$or':_[_0xb48c('0x37')](_0xca9c15[_0xb48c('0x3c')],function(_0x1de17f){var _0x5cc8ef={};_0x5cc8ef[_0x1de17f]={'$like':'%'+_0x221963[_0xb48c('0x3b')][_0xb48c('0x45')]+'%'};return _0x5cc8ef;})});}_0xca9c15=_[_0xb48c('0x43')]({},_0xca9c15,_0x221963[_0xb48c('0x46')]);return db[_0xb48c('0x5c')]['findAll'](_0xca9c15);}})['then'](function(_0x50d464){if(_0x50d464){return db['User'][_0xb48c('0x5d')]({'where':{'id':_[_0xb48c('0x37')](_0x50d464,_0xb48c('0x5e')),'role':_0xb48c('0x5f')},'attributes':['id',_0xb48c('0x2f'),'whatsappPause','updatedAt',_0xb48c('0x60')]});}})[_0xb48c('0x28')](function(_0x2f0030){if(_0x2f0030){return{'count':_0x2f0030[_0xb48c('0x23')],'rows':_[_0xb48c('0x37')](_0x2f0030[_0xb48c('0x49')],function(_0x44c181){return{'membername':_0x44c181[_0xb48c('0x2f')],'UserId':_0x44c181['id'],'queue_name':_0x4e25dc[_0xb48c('0x2f')],'WhatsappQueueId':_0x4e25dc['id'],'interface':util[_0xb48c('0x61')]('%s/%s',_0xb48c('0x62'),_0x44c181['name']),'penalty':0x0,'paused':_0x44c181[_0xb48c('0x63')],'createdAt':_0x44c181[_0xb48c('0x60')],'updatedAt':_0x44c181[_0xb48c('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb48c('0x28')](respondWithFilteredResult(_0x3259f8,_0xca9c15))['catch'](handleError(_0x3259f8,null));};exports[_0xb48c('0x65')]=function(_0x653938,_0x39f883,_0x484d45){var _0xf45df3={};var _0x20e0cf={};var _0x4a5600;var _0x58e1b3;return db[_0xb48c('0x32')][_0xb48c('0x66')]({'where':{'id':_0x653938[_0xb48c('0x4c')]['id']}})[_0xb48c('0x28')](handleEntityNotFound(_0x39f883,null))[_0xb48c('0x28')](function(_0x5a1bb5){if(_0x5a1bb5){_0x4a5600=_0x5a1bb5;_0x20e0cf[_0xb48c('0x36')]=_['keys'](db['Team'][_0xb48c('0x33')]);_0x20e0cf[_0xb48c('0x3b')]=_['keys'](_0x653938['query']);_0x20e0cf[_0xb48c('0x39')]=_[_0xb48c('0x3a')](_0x20e0cf[_0xb48c('0x36')],_0x20e0cf[_0xb48c('0x3b')]);_0xf45df3[_0xb48c('0x3c')]=_[_0xb48c('0x3a')](_0x20e0cf[_0xb48c('0x36')],qs[_0xb48c('0x3d')](_0x653938[_0xb48c('0x3b')][_0xb48c('0x3d')]));_0xf45df3[_0xb48c('0x3c')]=_0xf45df3['attributes'][_0xb48c('0x4d')]?_0xf45df3[_0xb48c('0x3c')]:_0x20e0cf[_0xb48c('0x36')];_0xf45df3['order']=qs[_0xb48c('0x40')](_0x653938[_0xb48c('0x3b')][_0xb48c('0x40')]);_0xf45df3['where']=qs[_0xb48c('0x39')](_[_0xb48c('0x41')](_0x653938[_0xb48c('0x3b')],_0x20e0cf['filters']));if(_0x653938['query'][_0xb48c('0x45')]){_0xf45df3[_0xb48c('0x42')]=_[_0xb48c('0x43')](_0xf45df3[_0xb48c('0x42')],{'$or':_[_0xb48c('0x37')](_0xf45df3[_0xb48c('0x3c')],function(_0x327b66){var _0x292c11={};_0x292c11[_0x327b66]={'$like':'%'+_0x653938[_0xb48c('0x3b')]['filter']+'%'};return _0x292c11;})});}_0xf45df3=_[_0xb48c('0x43')]({},_0xf45df3,_0x653938[_0xb48c('0x46')]);return _0x4a5600[_0xb48c('0x65')](_0xf45df3);}})[_0xb48c('0x28')](function(_0x51182f){if(_0x51182f){_0x58e1b3=_0x51182f['length'];if(!_0x653938[_0xb48c('0x3b')]['hasOwnProperty'](_0xb48c('0x3f'))){_0xf45df3['limit']=qs['limit'](_0x653938[_0xb48c('0x3b')]['limit']);_0xf45df3[_0xb48c('0x24')]=qs['offset'](_0x653938[_0xb48c('0x3b')][_0xb48c('0x24')]);}return _0x4a5600['getTeams'](_0xf45df3);}})[_0xb48c('0x28')](function(_0x1635eb){if(_0x1635eb){return _0x1635eb?{'count':_0x58e1b3,'rows':_0x1635eb}:null;}})[_0xb48c('0x28')](respondWithResult(_0x39f883,null))[_0xb48c('0x4a')](handleError(_0x39f883,null));};exports[_0xb48c('0x67')]=function(_0x36f410,_0x467003,_0x152b54){var _0x43c995=_0x36f410[_0xb48c('0x51')][_0xb48c('0x68')];return db[_0xb48c('0x69')][_0xb48c('0x48')]({'where':{'id':_0x43c995},'attributes':['id'],'include':[{'model':db[_0xb48c('0x6a')],'as':'Agents','attributes':['id',_0xb48c('0x2f'),_0xb48c('0x6b'),_0xb48c('0x6c'),_0xb48c('0x6d')],'raw':!![]}]})[_0xb48c('0x28')](function(_0xeacad3){if(_0xeacad3){var _0x549eb7=_[_0xb48c('0x6e')](_0xeacad3,function(_0x1131c8){var _0x3510e8=_0x1131c8[_0xb48c('0x29')]({'plain':!![]});return _0x3510e8[_0xb48c('0x6f')];});return db[_0xb48c('0x32')][_0xb48c('0x4f')]({'where':{'id':_0x36f410[_0xb48c('0x4c')]['id']}})['then'](function(_0x2ebdb3){return db[_0xb48c('0x70')][_0xb48c('0x71')](function(_0x38afd8){return _0x2ebdb3['addTeams'](_0x43c995,{'transaction':_0x38afd8})[_0xb48c('0x28')](function(){return BPromise[_0xb48c('0x72')](_0x549eb7,function(_0x133db9){return db[_0xb48c('0x5c')]['findOrCreate']({'where':{'UserId':_0x133db9['id'],'WhatsappQueueId':_0x36f410[_0xb48c('0x4c')]['id']},'transaction':_0x38afd8});});})['then'](function(){_0x549eb7[_0xb48c('0x73')](function(_0x25dc81){socket[_0xb48c('0x74')](_0xb48c('0x75'),{'UserId':_0x25dc81['id'],'WhatsappQueueId':_0x2ebdb3['id']});});});});});}})[_0xb48c('0x28')](respondWithStatusCode(_0x467003,null))[_0xb48c('0x4a')](handleError(_0x467003,null));};exports['removeTeams']=function(_0x195a6f,_0x256100,_0x22b8e7){return db[_0xb48c('0x69')][_0xb48c('0x48')]({'where':{'id':_0x195a6f[_0xb48c('0x3b')][_0xb48c('0x68')]},'attributes':['id'],'include':[{'model':db[_0xb48c('0x6a')],'as':_0xb48c('0x6f'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x256100,null))[_0xb48c('0x28')](function(_0x5dbfcf){var _0x3c7b07=_[_0xb48c('0x37')](_0x5dbfcf,'id');var _0x3b332e=[];var _0x17ff79=[];var _0x394def=squel[_0xb48c('0x76')]();_0x394def[_0xb48c('0x77')](_0xb48c('0x78'))[_0xb48c('0x79')](_0xb48c('0x7a'),'tq')[_0xb48c('0x7b')](_0xb48c('0x7c'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('WhatsappQueueId\x20=\x20?',_0x195a6f['params']['id']);for(var _0x2832da=0x0;_0x2832da<_0x5dbfcf[_0xb48c('0x4d')];_0x2832da+=0x1){let _0x144be2=_0x5dbfcf[_0x2832da];for(var _0x3ce0de=0x0;_0x3ce0de<_0x144be2['Agents']['length'];_0x3ce0de+=0x1){let _0x4b2092=_0x144be2[_0xb48c('0x6f')][_0x3ce0de];var _0x27425=_0x394def['clone']();_0x27425[_0xb48c('0x42')](_0xb48c('0x7d'),_0x4b2092['id']);_0x17ff79[_0xb48c('0x7e')](db[_0xb48c('0x70')][_0xb48c('0x3b')](_0x27425[_0xb48c('0x7f')](),{'type':db['sequelize'][_0xb48c('0x80')][_0xb48c('0x81')]})[_0xb48c('0x28')](function(_0x1b07ad){if(_0x1b07ad[_0xb48c('0x4d')]===0x1){return _0x4b2092['id'];}else{var _0x482c69=_['every'](_[_0xb48c('0x37')](_0x1b07ad,_0xb48c('0x82')),function(_0x1dfcac){return _['includes'](_0x3c7b07,_0x1dfcac);});if(_0x482c69){return _0x4b2092['id'];}}}));}}return BPromise[_0xb48c('0x83')](_0x17ff79)[_0xb48c('0x28')](function(_0x1f740e){_0x3b332e=_(_0x3b332e)[_0xb48c('0x84')](_0x1f740e)['compact']()[_0xb48c('0x85')]();return db[_0xb48c('0x32')][_0xb48c('0x4f')]({'where':{'id':_0x195a6f[_0xb48c('0x4c')]['id']}})[_0xb48c('0x28')](function(_0x171c42){return db['sequelize'][_0xb48c('0x71')](function(_0x3fcc2f){return _0x171c42[_0xb48c('0x86')](_0x195a6f[_0xb48c('0x3b')][_0xb48c('0x68')],{'transaction':_0x3fcc2f})['then'](function(){if(!_[_0xb48c('0x87')](_0x3b332e)){return _0x171c42['removeAgents'](_0x3b332e,{'transaction':_0x3fcc2f});}})['then'](function(){_0x3b332e[_0xb48c('0x73')](function(_0x4a0ed4){socket[_0xb48c('0x74')]('userWhatsappQueue:remove',{'UserId':_0x4a0ed4,'WhatsappQueueId':_0x171c42['id']});});});});});});})[_0xb48c('0x28')](respondWithStatusCode(_0x256100,null))['catch'](handleError(_0x256100,null));};exports[_0xb48c('0x88')]=function(_0x4030c9,_0x59fa14,_0x2022f1){return db[_0xb48c('0x32')][_0xb48c('0x4f')]({'where':{'id':_0x4030c9[_0xb48c('0x4c')]['id']}})[_0xb48c('0x28')](handleEntityNotFound(_0x59fa14,null))[_0xb48c('0x28')](function(_0x136769){if(_0x136769){return _0x136769[_0xb48c('0x88')](_0x4030c9[_0xb48c('0x51')]['ids'],_[_0xb48c('0x89')](_0x4030c9[_0xb48c('0x51')],[_0xb48c('0x68'),'id'])||{})[_0xb48c('0x8a')](function(_0x408b0e){for(var _0x2da35c=0x0;_0x2da35c<_0x4030c9[_0xb48c('0x51')]['ids']['length'];_0x2da35c+=0x1){socket[_0xb48c('0x74')](_0xb48c('0x75'),{'UserId':Number(_0x4030c9[_0xb48c('0x51')][_0xb48c('0x68')][_0x2da35c]),'WhatsappQueueId':Number(_0x4030c9['params']['id'])});}return _0x408b0e;});}})[_0xb48c('0x28')](respondWithResult(_0x59fa14,null))[_0xb48c('0x4a')](handleError(_0x59fa14,null));};exports['removeAgents']=function(_0x41cad8,_0x511957,_0x2e9b5e){return db[_0xb48c('0x32')][_0xb48c('0x4f')]({'where':{'id':_0x41cad8['params']['id']}})[_0xb48c('0x28')](handleEntityNotFound(_0x511957,null))[_0xb48c('0x28')](function(_0x2dc1a1){if(_0x2dc1a1){return _0x2dc1a1['removeAgents'](_0x41cad8[_0xb48c('0x3b')][_0xb48c('0x68')])[_0xb48c('0x28')](function(){if(_[_0xb48c('0x8b')](_0x41cad8[_0xb48c('0x3b')][_0xb48c('0x68')])){for(var _0x1c0bcd=0x0;_0x1c0bcd<_0x41cad8[_0xb48c('0x3b')][_0xb48c('0x68')]['length'];_0x1c0bcd+=0x1){socket[_0xb48c('0x74')](_0xb48c('0x8c'),{'UserId':Number(_0x41cad8[_0xb48c('0x3b')]['ids'][_0x1c0bcd]),'WhatsappQueueId':Number(_0x41cad8['params']['id'])});}}else{socket[_0xb48c('0x74')](_0xb48c('0x8c'),{'UserId':Number(_0x41cad8[_0xb48c('0x3b')][_0xb48c('0x68')]),'WhatsappQueueId':Number(_0x41cad8[_0xb48c('0x4c')]['id'])});}});}})[_0xb48c('0x28')](respondWithStatusCode(_0x511957,null))[_0xb48c('0x4a')](handleError(_0x511957,null));};exports[_0xb48c('0x8d')]=function(_0x32b8ac,_0x1a339e,_0x5c28fa){var _0x521a03={};var _0x501685={};var _0x227675;var _0x21a95d;return db[_0xb48c('0x32')]['findOne']({'where':{'id':_0x32b8ac[_0xb48c('0x4c')]['id']}})[_0xb48c('0x28')](handleEntityNotFound(_0x1a339e,null))['then'](function(_0x34363c){if(_0x34363c){_0x227675=_0x34363c;_0x501685[_0xb48c('0x36')]=_['keys'](db[_0xb48c('0x6a')][_0xb48c('0x33')]);_0x501685[_0xb48c('0x3b')]=_[_0xb48c('0x38')](_0x32b8ac[_0xb48c('0x3b')]);_0x501685['filters']=_[_0xb48c('0x3a')](_0x501685[_0xb48c('0x36')],_0x501685[_0xb48c('0x3b')]);_0x521a03['attributes']=_[_0xb48c('0x3a')](_0x501685[_0xb48c('0x36')],qs['fields'](_0x32b8ac[_0xb48c('0x3b')][_0xb48c('0x3d')]));_0x521a03[_0xb48c('0x3c')]=_0x521a03[_0xb48c('0x3c')][_0xb48c('0x4d')]?_0x521a03[_0xb48c('0x3c')]:_0x501685[_0xb48c('0x36')];_0x521a03['order']=qs[_0xb48c('0x40')](_0x32b8ac[_0xb48c('0x3b')]['sort']);_0x521a03['where']=qs[_0xb48c('0x39')](_[_0xb48c('0x41')](_0x32b8ac['query'],_0x501685[_0xb48c('0x39')]));if(_0x32b8ac[_0xb48c('0x3b')][_0xb48c('0x45')]){_0x521a03[_0xb48c('0x42')]=_[_0xb48c('0x43')](_0x521a03[_0xb48c('0x42')],{'$or':_['map'](_0x521a03[_0xb48c('0x3c')],function(_0x1f692d){var _0x2bbd62={};_0x2bbd62[_0x1f692d]={'$like':'%'+_0x32b8ac['query'][_0xb48c('0x45')]+'%'};return _0x2bbd62;})});}_0x521a03=_[_0xb48c('0x43')]({},_0x521a03,_0x32b8ac[_0xb48c('0x46')]);return _0x227675[_0xb48c('0x8d')](_0x521a03);}})[_0xb48c('0x28')](function(_0x1e55d8){if(_0x1e55d8){_0x21a95d=_0x1e55d8['length'];if(!_0x32b8ac['query'][_0xb48c('0x3e')](_0xb48c('0x3f'))){_0x521a03[_0xb48c('0x22')]=qs[_0xb48c('0x22')](_0x32b8ac[_0xb48c('0x3b')][_0xb48c('0x22')]);_0x521a03['offset']=qs['offset'](_0x32b8ac[_0xb48c('0x3b')][_0xb48c('0x24')]);}return _0x227675[_0xb48c('0x8d')](_0x521a03);}})[_0xb48c('0x28')](function(_0x406e74){if(_0x406e74){return _0x406e74?{'count':_0x21a95d,'rows':_0x406e74}:null;}})[_0xb48c('0x28')](respondWithResult(_0x1a339e,null))['catch'](handleError(_0x1a339e,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 6ba0d0e..b0e246c 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 _0xa46d=['update','emit','hasOwnProperty','hook','exports','WhatsappQueue'];(function(_0x4301c7,_0x34373b){var _0x167782=function(_0x5e9ede){while(--_0x5e9ede){_0x4301c7['push'](_0x4301c7['shift']());}};_0x167782(++_0x34373b);}(_0xa46d,0x101));var _0xda46=function(_0x1047e0,_0x24f932){_0x1047e0=_0x1047e0-0x0;var _0x3417a3=_0xa46d[_0x1047e0];return _0x3417a3;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0xda46('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xda46('0x1'),'afterDestroy':'remove'};function emitEvent(_0x110e30){return function(_0x302a67,_0x3c4729,_0x47d6c5){WhatsappQueueEvents[_0xda46('0x2')](_0x110e30+':'+_0x302a67['id'],_0x302a67);WhatsappQueueEvents[_0xda46('0x2')](_0x110e30,_0x302a67);_0x47d6c5(null);};}for(var e in events){if(events[_0xda46('0x3')](e)){var event=events[e];WhatsappQueue[_0xda46('0x4')](e,emitEvent(event));}}module[_0xda46('0x5')]=WhatsappQueueEvents; \ No newline at end of file +var _0x8309=['events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x45a099,_0x20ea5c){var _0x557e01=function(_0x548418){while(--_0x548418){_0x45a099['push'](_0x45a099['shift']());}};_0x557e01(++_0x20ea5c);}(_0x8309,0x190));var _0x9830=function(_0xdeb131,_0x30847f){_0xdeb131=_0xdeb131-0x0;var _0x84051b=_0x8309[_0xdeb131];return _0x84051b;};'use strict';var EventEmitter=require(_0x9830('0x0'));var WhatsappQueue=require(_0x9830('0x1'))['db'][_0x9830('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x9830('0x3')](0x0);var events={'afterCreate':_0x9830('0x4'),'afterUpdate':_0x9830('0x5'),'afterDestroy':_0x9830('0x6')};function emitEvent(_0x2e523a){return function(_0x310520,_0xbd6d40,_0x421002){WhatsappQueueEvents[_0x9830('0x7')](_0x2e523a+':'+_0x310520['id'],_0x310520);WhatsappQueueEvents[_0x9830('0x7')](_0x2e523a,_0x310520);_0x421002(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x9830('0x8')](e,emitEvent(event));}}module[_0x9830('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index fc186bd..2847ae3 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 _0xde28=['api','moment','bluebird','request-promise','path','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util'];(function(_0x324e86,_0x81b1cb){var _0x592846=function(_0x33439c){while(--_0x33439c){_0x324e86['push'](_0x324e86['shift']());}};_0x592846(++_0x81b1cb);}(_0xde28,0x1b8));var _0x8de2=function(_0x1f4d75,_0x14871e){_0x1f4d75=_0x1f4d75-0x0;var _0xb8f974=_0xde28[_0x1f4d75];return _0xb8f974;};'use strict';var _=require(_0x8de2('0x0'));var util=require(_0x8de2('0x1'));var logger=require('../../config/logger')(_0x8de2('0x2'));var moment=require(_0x8de2('0x3'));var BPromise=require(_0x8de2('0x4'));var rp=require(_0x8de2('0x5'));var fs=require('fs');var path=require(_0x8de2('0x6'));var rimraf=require('rimraf');var config=require(_0x8de2('0x7'));var attributes=require(_0x8de2('0x8'));module[_0x8de2('0x9')]=function(_0xbada04,_0x2eaa78){return _0xbada04[_0x8de2('0xa')](_0x8de2('0xb'),attributes,{'tableName':_0x8de2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1952=['rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x291035,_0x4a1b10){var _0x504410=function(_0x169568){while(--_0x169568){_0x291035['push'](_0x291035['shift']());}};_0x504410(++_0x4a1b10);}(_0x1952,0x1a7));var _0x2195=function(_0x5f1eab,_0x2e0759){_0x5f1eab=_0x5f1eab-0x0;var _0x5bcf86=_0x1952[_0x5f1eab];return _0x5bcf86;};'use strict';var _=require(_0x2195('0x0'));var util=require('util');var logger=require(_0x2195('0x1'))(_0x2195('0x2'));var moment=require(_0x2195('0x3'));var BPromise=require(_0x2195('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2195('0x5'));var rimraf=require(_0x2195('0x6'));var config=require(_0x2195('0x7'));var attributes=require(_0x2195('0x8'));module[_0x2195('0x9')]=function(_0x2f725b,_0x20ca7d){return _0x2f725b[_0x2195('0xa')](_0x2195('0xb'),attributes,{'tableName':_0x2195('0xc'),'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 391b806..fb8047c 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 _0x5474=['ShowWhatsappQueue','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','./whatsappQueue.socket','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','findAll','options','raw','where','attributes','include','model','map','GetWhatsappQueue','find'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x5474,0x129));var _0x4547=function(_0x40ded9,_0x4c9e4a){_0x40ded9=_0x40ded9-0x0;var _0x413b82=_0x5474[_0x40ded9];return _0x413b82;};'use strict';var _=require('lodash');var util=require(_0x4547('0x0'));var moment=require(_0x4547('0x1'));var BPromise=require(_0x4547('0x2'));var rs=require(_0x4547('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4547('0x4'))['db'];var utils=require(_0x4547('0x5'));var logger=require('../../config/logger')(_0x4547('0x6'));var config=require(_0x4547('0x7'));var jayson=require(_0x4547('0x8'));var client=jayson[_0x4547('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x4547('0xa')],{'host':_0x4547('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4547('0xc'))['register'](socket);function respondWithRpcPromise(_0xc318a2,_0xcc568c,_0x3bd244){return new BPromise(function(_0x27f616,_0x56edca){return client[_0x4547('0xd')](_0xc318a2,_0x3bd244)[_0x4547('0xe')](function(_0x1cd3c6){logger['info'](_0x4547('0xf'),_0xcc568c,_0x4547('0x10'));logger[_0x4547('0x11')](_0x4547('0x12'),_0xcc568c,'request\x20sent',JSON[_0x4547('0x13')](_0x1cd3c6));if(_0x1cd3c6['error']){if(_0x1cd3c6[_0x4547('0x14')][_0x4547('0x15')]===0x1f4){logger[_0x4547('0x14')](_0x4547('0xf'),_0xcc568c,_0x1cd3c6[_0x4547('0x14')][_0x4547('0x16')]);return _0x56edca(_0x1cd3c6['error'][_0x4547('0x16')]);}logger[_0x4547('0x14')](_0x4547('0xf'),_0xcc568c,_0x1cd3c6[_0x4547('0x14')]['message']);return _0x27f616(_0x1cd3c6[_0x4547('0x14')][_0x4547('0x16')]);}else{logger[_0x4547('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0xcc568c,_0x4547('0x10'));_0x27f616(_0x1cd3c6[_0x4547('0x18')][_0x4547('0x16')]);}})[_0x4547('0x19')](function(_0x12221e){logger[_0x4547('0x14')](_0x4547('0xf'),_0xcc568c,_0x12221e);_0x56edca(_0x12221e);});});}exports['GetWhatsappQueue']=function(_0x5cc855){var _0x5ba47c=this;return new Promise(function(_0x5a631b,_0x52e03a){return db['WhatsappQueue'][_0x4547('0x1a')]({'raw':_0x5cc855[_0x4547('0x1b')]?_0x5cc855['options'][_0x4547('0x1c')]===undefined?!![]:![]:!![],'where':_0x5cc855[_0x4547('0x1b')]?_0x5cc855[_0x4547('0x1b')][_0x4547('0x1d')]||null:null,'attributes':_0x5cc855['options']?_0x5cc855['options'][_0x4547('0x1e')]||null:null,'limit':_0x5cc855[_0x4547('0x1b')]?_0x5cc855['options']['limit']||null:null,'include':_0x5cc855[_0x4547('0x1b')]?_0x5cc855['options'][_0x4547('0x1f')]?_['map'](_0x5cc855['options'][_0x4547('0x1f')],function(_0x233892){return{'model':db[_0x233892[_0x4547('0x20')]],'as':_0x233892['as'],'attributes':_0x233892[_0x4547('0x1e')],'include':_0x233892[_0x4547('0x1f')]?_[_0x4547('0x21')](_0x233892['include'],function(_0x97ce92){return{'model':db[_0x97ce92['model']],'as':_0x97ce92['as'],'attributes':_0x97ce92[_0x4547('0x1e')],'include':_0x97ce92[_0x4547('0x1f')]?_['map'](_0x97ce92['include'],function(_0x24a25a){return{'model':db[_0x24a25a[_0x4547('0x20')]],'as':_0x24a25a['as'],'attributes':_0x24a25a[_0x4547('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4547('0xe')](function(_0x2c1d73){logger['info'](_0x4547('0x22'),_0x5cc855);logger['debug'](_0x4547('0x22'),_0x5cc855,JSON[_0x4547('0x13')](_0x2c1d73));_0x5a631b(_0x2c1d73);})['catch'](function(_0x37059a){logger['error'](_0x4547('0x22'),_0x37059a[_0x4547('0x16')],_0x5cc855);_0x52e03a(_0x5ba47c['error'](0x1f4,_0x37059a[_0x4547('0x16')]));});});};exports['ShowWhatsappQueue']=function(_0x1772f8){var _0x15d14a=this;return new Promise(function(_0x7a52f,_0x5dde05){return db['WhatsappQueue'][_0x4547('0x23')]({'raw':_0x1772f8[_0x4547('0x1b')]?_0x1772f8['options'][_0x4547('0x1c')]===undefined?!![]:![]:!![],'where':_0x1772f8[_0x4547('0x1b')]?_0x1772f8['options']['where']||null:null,'attributes':_0x1772f8[_0x4547('0x1b')]?_0x1772f8[_0x4547('0x1b')][_0x4547('0x1e')]||null:null,'include':_0x1772f8['options']?_0x1772f8[_0x4547('0x1b')]['include']?_[_0x4547('0x21')](_0x1772f8[_0x4547('0x1b')][_0x4547('0x1f')],function(_0x59ff73){return{'model':db[_0x59ff73[_0x4547('0x20')]],'as':_0x59ff73['as'],'attributes':_0x59ff73['attributes'],'include':_0x59ff73[_0x4547('0x1f')]?_[_0x4547('0x21')](_0x59ff73[_0x4547('0x1f')],function(_0x17a1fc){return{'model':db[_0x17a1fc['model']],'as':_0x17a1fc['as'],'attributes':_0x17a1fc['attributes'],'include':_0x17a1fc[_0x4547('0x1f')]?_[_0x4547('0x21')](_0x17a1fc['include'],function(_0x549d07){return{'model':db[_0x549d07['model']],'as':_0x549d07['as'],'attributes':_0x549d07[_0x4547('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4547('0xe')](function(_0x2b6971){logger[_0x4547('0x17')](_0x4547('0x24'),_0x1772f8);logger[_0x4547('0x11')](_0x4547('0x24'),_0x1772f8,JSON[_0x4547('0x13')](_0x2b6971));_0x7a52f(_0x2b6971);})['catch'](function(_0x1fafb2){logger['error'](_0x4547('0x24'),_0x1fafb2[_0x4547('0x16')],_0x1772f8);_0x5dde05(_0x15d14a['error'](0x1f4,_0x1fafb2[_0x4547('0x16')]));});});}; \ No newline at end of file +var _0x8137=['options','raw','where','attributes','include','map','debug','find','model','ShowWhatsappQueue','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','request\x20sent','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','GetWhatsappQueue'];(function(_0x193137,_0x3c6011){var _0xf34e4f=function(_0x288166){while(--_0x288166){_0x193137['push'](_0x193137['shift']());}};_0xf34e4f(++_0x3c6011);}(_0x8137,0x1ad));var _0x7813=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x8137[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x7813('0x0'));var util=require(_0x7813('0x1'));var moment=require(_0x7813('0x2'));var BPromise=require(_0x7813('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7813('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7813('0x5'));var logger=require(_0x7813('0x6'))(_0x7813('0x7'));var config=require(_0x7813('0x8'));var jayson=require(_0x7813('0x9'));var client=jayson[_0x7813('0xa')]['http']({'port':0x232a});config['redis']=_[_0x7813('0xb')](config[_0x7813('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7813('0xd'))(new Redis(config[_0x7813('0xc')]));require(_0x7813('0xe'))[_0x7813('0xf')](socket);function respondWithRpcPromise(_0x8ab7c3,_0x1e9685,_0x5e119d){return new BPromise(function(_0x2d7adc,_0x584324){return client[_0x7813('0x10')](_0x8ab7c3,_0x5e119d)[_0x7813('0x11')](function(_0x42f898){logger[_0x7813('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x1e9685,_0x7813('0x13'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x1e9685,_0x7813('0x13'),JSON[_0x7813('0x14')](_0x42f898));if(_0x42f898[_0x7813('0x15')]){if(_0x42f898['error'][_0x7813('0x16')]===0x1f4){logger[_0x7813('0x15')](_0x7813('0x17'),_0x1e9685,_0x42f898[_0x7813('0x15')][_0x7813('0x18')]);return _0x584324(_0x42f898[_0x7813('0x15')][_0x7813('0x18')]);}logger[_0x7813('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x1e9685,_0x42f898[_0x7813('0x15')][_0x7813('0x18')]);return _0x2d7adc(_0x42f898[_0x7813('0x15')][_0x7813('0x18')]);}else{logger[_0x7813('0x12')](_0x7813('0x17'),_0x1e9685,'request\x20sent');_0x2d7adc(_0x42f898[_0x7813('0x19')][_0x7813('0x18')]);}})['catch'](function(_0x5d35e3){logger[_0x7813('0x15')](_0x7813('0x17'),_0x1e9685,_0x5d35e3);_0x584324(_0x5d35e3);});});}exports[_0x7813('0x1a')]=function(_0xefe8ef){var _0x35444d=this;return new Promise(function(_0x5318f6,_0x2fba23){return db['WhatsappQueue']['findAll']({'raw':_0xefe8ef[_0x7813('0x1b')]?_0xefe8ef[_0x7813('0x1b')][_0x7813('0x1c')]===undefined?!![]:![]:!![],'where':_0xefe8ef[_0x7813('0x1b')]?_0xefe8ef['options'][_0x7813('0x1d')]||null:null,'attributes':_0xefe8ef[_0x7813('0x1b')]?_0xefe8ef[_0x7813('0x1b')][_0x7813('0x1e')]||null:null,'limit':_0xefe8ef['options']?_0xefe8ef[_0x7813('0x1b')]['limit']||null:null,'include':_0xefe8ef[_0x7813('0x1b')]?_0xefe8ef['options'][_0x7813('0x1f')]?_[_0x7813('0x20')](_0xefe8ef[_0x7813('0x1b')]['include'],function(_0x298a51){return{'model':db[_0x298a51['model']],'as':_0x298a51['as'],'attributes':_0x298a51[_0x7813('0x1e')],'include':_0x298a51[_0x7813('0x1f')]?_[_0x7813('0x20')](_0x298a51['include'],function(_0x5b9c86){return{'model':db[_0x5b9c86['model']],'as':_0x5b9c86['as'],'attributes':_0x5b9c86[_0x7813('0x1e')],'include':_0x5b9c86['include']?_['map'](_0x5b9c86[_0x7813('0x1f')],function(_0x1dc412){return{'model':db[_0x1dc412['model']],'as':_0x1dc412['as'],'attributes':_0x1dc412[_0x7813('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7813('0x11')](function(_0x4ca2ad){logger[_0x7813('0x12')](_0x7813('0x1a'),_0xefe8ef);logger[_0x7813('0x21')](_0x7813('0x1a'),_0xefe8ef,JSON[_0x7813('0x14')](_0x4ca2ad));_0x5318f6(_0x4ca2ad);})['catch'](function(_0x35ce7a){logger[_0x7813('0x15')](_0x7813('0x1a'),_0x35ce7a[_0x7813('0x18')],_0xefe8ef);_0x2fba23(_0x35444d[_0x7813('0x15')](0x1f4,_0x35ce7a[_0x7813('0x18')]));});});};exports['ShowWhatsappQueue']=function(_0x9d6862){var _0x240f70=this;return new Promise(function(_0x1a8ad0,_0x58944e){return db['WhatsappQueue'][_0x7813('0x22')]({'raw':_0x9d6862[_0x7813('0x1b')]?_0x9d6862[_0x7813('0x1b')][_0x7813('0x1c')]===undefined?!![]:![]:!![],'where':_0x9d6862['options']?_0x9d6862[_0x7813('0x1b')][_0x7813('0x1d')]||null:null,'attributes':_0x9d6862[_0x7813('0x1b')]?_0x9d6862['options'][_0x7813('0x1e')]||null:null,'include':_0x9d6862['options']?_0x9d6862[_0x7813('0x1b')][_0x7813('0x1f')]?_[_0x7813('0x20')](_0x9d6862[_0x7813('0x1b')][_0x7813('0x1f')],function(_0x31ee78){return{'model':db[_0x31ee78[_0x7813('0x23')]],'as':_0x31ee78['as'],'attributes':_0x31ee78[_0x7813('0x1e')],'include':_0x31ee78[_0x7813('0x1f')]?_[_0x7813('0x20')](_0x31ee78[_0x7813('0x1f')],function(_0x210eee){return{'model':db[_0x210eee[_0x7813('0x23')]],'as':_0x210eee['as'],'attributes':_0x210eee[_0x7813('0x1e')],'include':_0x210eee[_0x7813('0x1f')]?_[_0x7813('0x20')](_0x210eee[_0x7813('0x1f')],function(_0x1ce81e){return{'model':db[_0x1ce81e[_0x7813('0x23')]],'as':_0x1ce81e['as'],'attributes':_0x1ce81e['attributes']};}):[]};}):[]};}):[]:[]})[_0x7813('0x11')](function(_0x292130){logger[_0x7813('0x12')]('ShowWhatsappQueue',_0x9d6862);logger[_0x7813('0x21')](_0x7813('0x24'),_0x9d6862,JSON['stringify'](_0x292130));_0x1a8ad0(_0x292130);})[_0x7813('0x25')](function(_0x582ef5){logger[_0x7813('0x15')](_0x7813('0x24'),_0x582ef5[_0x7813('0x18')],_0x9d6862);_0x58944e(_0x240f70[_0x7813('0x15')](0x1f4,_0x582ef5['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 4db80f2..6e488f0 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 _0x82cc=['length','whatsappQueue:','./whatsappQueue.events','update','emit','removeListener','register'];(function(_0x5e88a0,_0x4956da){var _0xb67619=function(_0x3f2dbb){while(--_0x3f2dbb){_0x5e88a0['push'](_0x5e88a0['shift']());}};_0xb67619(++_0x4956da);}(_0x82cc,0x72));var _0xc82c=function(_0x517bae,_0x4cd1e7){_0x517bae=_0x517bae-0x0;var _0x31c58b=_0x82cc[_0x517bae];return _0x31c58b;};'use strict';var WhatsappQueueEvents=require(_0xc82c('0x0'));var events=['save','remove',_0xc82c('0x1')];function createListener(_0x324a55,_0x4c223c){return function(_0x55dad2){_0x4c223c[_0xc82c('0x2')](_0x324a55,_0x55dad2);};}function removeListener(_0x522cb1,_0x507565){return function(){WhatsappQueueEvents[_0xc82c('0x3')](_0x522cb1,_0x507565);};}exports[_0xc82c('0x4')]=function(_0x19a6c6){for(var _0x383944=0x0,_0x3fdb68=events[_0xc82c('0x5')];_0x383944<_0x3fdb68;_0x383944++){var _0x592c04=events[_0x383944];var _0xa643d=createListener(_0xc82c('0x6')+_0x592c04,_0x19a6c6);WhatsappQueueEvents['on'](_0x592c04,_0xa643d);}}; \ No newline at end of file +var _0xf9ea=['removeListener','whatsappQueue:','save','remove','update','emit'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0xf9ea,0x176));var _0xaf9e=function(_0x48b5e0,_0xb3826){_0x48b5e0=_0x48b5e0-0x0;var _0x4287ea=_0xf9ea[_0x48b5e0];return _0x4287ea;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0xaf9e('0x0'),_0xaf9e('0x1'),_0xaf9e('0x2')];function createListener(_0x47c064,_0x241cfe){return function(_0x111dc5){_0x241cfe[_0xaf9e('0x3')](_0x47c064,_0x111dc5);};}function removeListener(_0x3e8aef,_0x2bc6f1){return function(){WhatsappQueueEvents[_0xaf9e('0x4')](_0x3e8aef,_0x2bc6f1);};}exports['register']=function(_0x52b1f3){for(var _0x12a70d=0x0,_0x5997af=events['length'];_0x12a70d<_0x5997af;_0x12a70d++){var _0x2392f0=events[_0x12a70d];var _0x2268e8=createListener(_0xaf9e('0x5')+_0x2392f0,_0x52b1f3);WhatsappQueueEvents['on'](_0x2392f0,_0x2268e8);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 7325d24..2092c8a 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 _0x56ef=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x345539,_0x33c35b){var _0x4a58f8=function(_0x1638f7){while(--_0x1638f7){_0x345539['push'](_0x345539['shift']());}};_0x4a58f8(++_0x33c35b);}(_0x56ef,0x6b));var _0xf56e=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0x56ef[_0x56f7e2];return _0x36240b;};'use strict';var multer=require(_0xf56e('0x0'));var util=require(_0xf56e('0x1'));var path=require(_0xf56e('0x2'));var timeout=require('connect-timeout');var express=require(_0xf56e('0x3'));var router=express['Router']();var fs_extra=require(_0xf56e('0x4'));var auth=require(_0xf56e('0x5'));var interaction=require(_0xf56e('0x6'));var config=require(_0xf56e('0x7'));var controller=require(_0xf56e('0x8'));router['get']('/',auth[_0xf56e('0x9')](),controller['index']);router[_0xf56e('0xa')](_0xf56e('0xb'),auth[_0xf56e('0x9')](),controller[_0xf56e('0xc')]);router[_0xf56e('0xa')](_0xf56e('0xd'),auth[_0xf56e('0x9')](),controller[_0xf56e('0xe')]);router[_0xf56e('0xf')]('/',auth[_0xf56e('0x9')](),controller[_0xf56e('0x10')]);router[_0xf56e('0x11')](_0xf56e('0xd'),auth['isAuthenticated'](),controller[_0xf56e('0x12')]);router[_0xf56e('0x13')](_0xf56e('0xd'),auth[_0xf56e('0x9')](),controller[_0xf56e('0x14')]);module[_0xf56e('0x15')]=router; \ No newline at end of file +var _0x82e9=['create','put','delete','exports','util','path','connect-timeout','fs-extra','./whatsappQueueReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post'];(function(_0x5a8594,_0x236096){var _0x24c6b0=function(_0x11a1e6){while(--_0x11a1e6){_0x5a8594['push'](_0x5a8594['shift']());}};_0x24c6b0(++_0x236096);}(_0x82e9,0x1be));var _0x982e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x82e9[_0x4ea69d];return _0x5318e0;};'use strict';var multer=require('multer');var util=require(_0x982e('0x0'));var path=require(_0x982e('0x1'));var timeout=require(_0x982e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x982e('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x982e('0x4'));router[_0x982e('0x5')]('/',auth['isAuthenticated'](),controller[_0x982e('0x6')]);router[_0x982e('0x5')](_0x982e('0x7'),auth['isAuthenticated'](),controller[_0x982e('0x8')]);router[_0x982e('0x5')](_0x982e('0x9'),auth[_0x982e('0xa')](),controller[_0x982e('0xb')]);router[_0x982e('0xc')]('/',auth[_0x982e('0xa')](),controller[_0x982e('0xd')]);router[_0x982e('0xe')]('/:id',auth[_0x982e('0xa')](),controller['update']);router[_0x982e('0xf')](_0x982e('0x9'),auth[_0x982e('0xa')](),controller['destroy']);module[_0x982e('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 2c13754..2545936 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(_0x19cafe,_0x3e8577){var _0x16a7d4=function(_0x5b0327){while(--_0x5b0327){_0x19cafe['push'](_0x19cafe['shift']());}};_0x16a7d4(++_0x3e8577);}(_0x7a54,0x106));var _0x47a5=function(_0xcbb67a,_0x18f206){_0xcbb67a=_0xcbb67a-0x0;var _0xde37e=_0x7a54[_0xcbb67a];return _0xde37e;};'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(_0x1cca1c,_0x55db39){var _0x2352eb=function(_0x36d8e0){while(--_0x36d8e0){_0x1cca1c['push'](_0x1cca1c['shift']());}};_0x2352eb(++_0x55db39);}(_0x7a54,0x106));var _0x47a5=function(_0x421275,_0x311836){_0x421275=_0x421275-0x0;var _0x3a65a9=_0x7a54[_0x421275];return _0x3a65a9;};'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 f317a02..01b239f 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 _0x2e54=['catch','show','params','find','create','body','update','destroy','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','error','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x50ba9b,_0x2ce5aa){var _0x1e628d=function(_0x3bb363){while(--_0x3bb363){_0x50ba9b['push'](_0x50ba9b['shift']());}};_0x1e628d(++_0x2ce5aa);}(_0x2e54,0x1dd));var _0x42e5=function(_0x4832cd,_0x5b7673){_0x4832cd=_0x4832cd-0x0;var _0x24fe1d=_0x2e54[_0x4832cd];return _0x24fe1d;};'use strict';var emlformat=require(_0x42e5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x42e5('0x1'));var rp=require(_0x42e5('0x2'));var moment=require(_0x42e5('0x3'));var BPromise=require(_0x42e5('0x4'));var Mustache=require(_0x42e5('0x5'));var util=require(_0x42e5('0x6'));var path=require(_0x42e5('0x7'));var sox=require('sox');var csv=require(_0x42e5('0x8'));var ejs=require(_0x42e5('0x9'));var fs=require('fs');var fs_extra=require(_0x42e5('0xa'));var _=require('lodash');var squel=require(_0x42e5('0xb'));var crypto=require('crypto');var jsforce=require(_0x42e5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x42e5('0x8'));var querystring=require(_0x42e5('0xd'));var Papa=require(_0x42e5('0xe'));var Redis=require(_0x42e5('0xf'));var authService=require(_0x42e5('0x10'));var qs=require(_0x42e5('0x11'));var as=require(_0x42e5('0x12'));var hardwareService=require(_0x42e5('0x13'));var logger=require(_0x42e5('0x14'))('api');var utils=require(_0x42e5('0x15'));var config=require(_0x42e5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x42e5('0x17'))['db'];function respondWithStatusCode(_0x12385d,_0x4530ba){_0x4530ba=_0x4530ba||0xcc;return function(_0x41598d){if(_0x41598d){return _0x12385d[_0x42e5('0x18')](_0x4530ba);}return _0x12385d[_0x42e5('0x19')](_0x4530ba)[_0x42e5('0x1a')]();};}function respondWithResult(_0x96fae2,_0x447648){_0x447648=_0x447648||0xc8;return function(_0x23957f){if(_0x23957f){return _0x96fae2['status'](_0x447648)[_0x42e5('0x1b')](_0x23957f);}};}function respondWithFilteredResult(_0x1d8e52,_0x4034bd){return function(_0x388300){if(_0x388300){var _0x2f4999=typeof _0x4034bd[_0x42e5('0x1c')]===_0x42e5('0x1d')&&typeof _0x4034bd[_0x42e5('0x1e')]===_0x42e5('0x1d');var _0x3c7b79=_0x388300[_0x42e5('0x1f')];var _0x38282d=_0x2f4999?0x0:_0x4034bd[_0x42e5('0x1c')];var _0x23fe09=_0x2f4999?_0x388300['count']:_0x4034bd[_0x42e5('0x1c')]+_0x4034bd['limit'];var _0x5f4428;if(_0x23fe09>=_0x3c7b79){_0x23fe09=_0x3c7b79;_0x5f4428=0xc8;}else{_0x5f4428=0xce;}_0x1d8e52[_0x42e5('0x19')](_0x5f4428);return _0x1d8e52[_0x42e5('0x20')]('Content-Range',_0x38282d+'-'+_0x23fe09+'/'+_0x3c7b79)[_0x42e5('0x1b')](_0x388300);}return null;};}function patchUpdates(_0x39a3e2){return function(_0x1c2169){try{jsonpatch[_0x42e5('0x21')](_0x1c2169,_0x39a3e2,!![]);}catch(_0x1150f4){return BPromise[_0x42e5('0x22')](_0x1150f4);}return _0x1c2169[_0x42e5('0x23')]();};}function saveUpdates(_0x58eee5,_0x4da508){return function(_0x283d44){if(_0x283d44){return _0x283d44['update'](_0x58eee5)[_0x42e5('0x24')](function(_0x2e9574){return _0x2e9574;});}return null;};}function removeEntity(_0x37d10e,_0x49490f){return function(_0x32380f){if(_0x32380f){return _0x32380f['destroy']()[_0x42e5('0x24')](function(){_0x37d10e[_0x42e5('0x19')](0xcc)[_0x42e5('0x1a')]();});}};}function handleEntityNotFound(_0x275c80,_0x4638bc){return function(_0x4f52b2){if(!_0x4f52b2){_0x275c80['sendStatus'](0x194);}return _0x4f52b2;};}function handleError(_0x3115e4,_0x534a26){_0x534a26=_0x534a26||0x1f4;return function(_0x56f812){logger[_0x42e5('0x25')](_0x56f812['stack']);if(_0x56f812[_0x42e5('0x26')]){delete _0x56f812[_0x42e5('0x26')];}_0x3115e4[_0x42e5('0x19')](_0x534a26)[_0x42e5('0x27')](_0x56f812);};}exports[_0x42e5('0x28')]=function(_0x2f1edc,_0x59a46b){var _0x3e2ea5={},_0x201d9e={},_0x39f763={'count':0x0,'rows':[]};var _0x2c53d4=_[_0x42e5('0x29')](db[_0x42e5('0x2a')][_0x42e5('0x2b')],function(_0x282cbf){return{'name':_0x282cbf[_0x42e5('0x2c')],'type':_0x282cbf[_0x42e5('0x2d')][_0x42e5('0x2e')]};});_0x201d9e[_0x42e5('0x2f')]=_[_0x42e5('0x29')](_0x2c53d4,'name');_0x201d9e[_0x42e5('0x30')]=_[_0x42e5('0x31')](_0x2f1edc[_0x42e5('0x30')]);_0x201d9e[_0x42e5('0x32')]=_['intersection'](_0x201d9e['model'],_0x201d9e[_0x42e5('0x30')]);_0x3e2ea5['attributes']=_[_0x42e5('0x33')](_0x201d9e['model'],qs[_0x42e5('0x34')](_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x34')]));_0x3e2ea5['attributes']=_0x3e2ea5[_0x42e5('0x35')][_0x42e5('0x36')]?_0x3e2ea5['attributes']:_0x201d9e[_0x42e5('0x2f')];if(!_0x2f1edc['query'][_0x42e5('0x37')](_0x42e5('0x38'))){_0x3e2ea5[_0x42e5('0x1e')]=qs[_0x42e5('0x1e')](_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x1e')]);_0x3e2ea5[_0x42e5('0x1c')]=qs['offset'](_0x2f1edc['query'][_0x42e5('0x1c')]);}_0x3e2ea5[_0x42e5('0x39')]=qs[_0x42e5('0x3a')](_0x2f1edc['query']['sort']);_0x3e2ea5['where']=qs['filters'](_[_0x42e5('0x3b')](_0x2f1edc[_0x42e5('0x30')],_0x201d9e[_0x42e5('0x32')]),_0x2c53d4);if(_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x3c')]){_0x3e2ea5[_0x42e5('0x3d')]=_[_0x42e5('0x3e')](_0x3e2ea5[_0x42e5('0x3d')],{'$or':_['map'](_0x2c53d4,function(_0x260413){if(_0x260413['type']!==_0x42e5('0x3f')){var _0x343363={};_0x343363[_0x260413[_0x42e5('0x26')]]={'$like':'%'+_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x3c')]+'%'};return _0x343363;}})});}_0x3e2ea5=_[_0x42e5('0x3e')]({},_0x3e2ea5,_0x2f1edc[_0x42e5('0x40')]);var _0x5ab9b8={'where':_0x3e2ea5[_0x42e5('0x3d')]};return db[_0x42e5('0x2a')]['count'](_0x5ab9b8)[_0x42e5('0x24')](function(_0x5e8f96){_0x39f763['count']=_0x5e8f96;if(_0x2f1edc['query'][_0x42e5('0x41')]){_0x3e2ea5[_0x42e5('0x42')]=[{'all':!![]}];}return db[_0x42e5('0x2a')][_0x42e5('0x43')](_0x3e2ea5);})[_0x42e5('0x24')](function(_0x77aa22){_0x39f763[_0x42e5('0x44')]=_0x77aa22;return _0x39f763;})['then'](respondWithFilteredResult(_0x59a46b,_0x3e2ea5))[_0x42e5('0x45')](handleError(_0x59a46b,null));};exports[_0x42e5('0x46')]=function(_0x5bec97,_0x398b73){var _0x1c697a={'raw':!![],'where':{'id':_0x5bec97[_0x42e5('0x47')]['id']}},_0x5db771={};_0x5db771[_0x42e5('0x2f')]=_[_0x42e5('0x31')](db[_0x42e5('0x2a')][_0x42e5('0x2b')]);_0x5db771['query']=_[_0x42e5('0x31')](_0x5bec97[_0x42e5('0x30')]);_0x5db771[_0x42e5('0x32')]=_[_0x42e5('0x33')](_0x5db771['model'],_0x5db771[_0x42e5('0x30')]);_0x1c697a[_0x42e5('0x35')]=_[_0x42e5('0x33')](_0x5db771[_0x42e5('0x2f')],qs[_0x42e5('0x34')](_0x5bec97[_0x42e5('0x30')][_0x42e5('0x34')]));_0x1c697a[_0x42e5('0x35')]=_0x1c697a['attributes'][_0x42e5('0x36')]?_0x1c697a['attributes']:_0x5db771['model'];if(_0x5bec97[_0x42e5('0x30')][_0x42e5('0x41')]){_0x1c697a[_0x42e5('0x42')]=[{'all':!![]}];}_0x1c697a=_[_0x42e5('0x3e')]({},_0x1c697a,_0x5bec97[_0x42e5('0x40')]);return db[_0x42e5('0x2a')][_0x42e5('0x48')](_0x1c697a)['then'](handleEntityNotFound(_0x398b73,null))[_0x42e5('0x24')](respondWithResult(_0x398b73,null))[_0x42e5('0x45')](handleError(_0x398b73,null));};exports[_0x42e5('0x49')]=function(_0x21a047,_0x1086b2){return db[_0x42e5('0x2a')][_0x42e5('0x49')](_0x21a047[_0x42e5('0x4a')],{})['then'](respondWithResult(_0x1086b2,0xc9))[_0x42e5('0x45')](handleError(_0x1086b2,null));};exports[_0x42e5('0x4b')]=function(_0x3616f4,_0x48757e){if(_0x3616f4[_0x42e5('0x4a')]['id']){delete _0x3616f4[_0x42e5('0x4a')]['id'];}return db[_0x42e5('0x2a')][_0x42e5('0x48')]({'where':{'id':_0x3616f4[_0x42e5('0x47')]['id']}})['then'](handleEntityNotFound(_0x48757e,null))[_0x42e5('0x24')](saveUpdates(_0x3616f4['body'],null))[_0x42e5('0x24')](respondWithResult(_0x48757e,null))[_0x42e5('0x45')](handleError(_0x48757e,null));};exports[_0x42e5('0x4c')]=function(_0x48b63b,_0x50f59c){return db['WhatsappQueueReport'][_0x42e5('0x48')]({'where':{'id':_0x48b63b[_0x42e5('0x47')]['id']}})[_0x42e5('0x24')](handleEntityNotFound(_0x50f59c,null))[_0x42e5('0x24')](removeEntity(_0x50f59c,null))['catch'](handleError(_0x50f59c,null));};exports[_0x42e5('0x4d')]=function(_0x26782e,_0x18cedc){return db['WhatsappQueueReport'][_0x42e5('0x4d')]()['then'](respondWithResult(_0x18cedc,null))[_0x42e5('0x45')](handleError(_0x18cedc,null));}; \ No newline at end of file +var _0x2e54=['catch','show','params','find','create','body','update','destroy','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','error','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x4db56b,_0x2a8ad3){var _0x345bd6=function(_0x59a994){while(--_0x59a994){_0x4db56b['push'](_0x4db56b['shift']());}};_0x345bd6(++_0x2a8ad3);}(_0x2e54,0x1dd));var _0x42e5=function(_0x7f8cc4,_0x48b02e){_0x7f8cc4=_0x7f8cc4-0x0;var _0x215087=_0x2e54[_0x7f8cc4];return _0x215087;};'use strict';var emlformat=require(_0x42e5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x42e5('0x1'));var rp=require(_0x42e5('0x2'));var moment=require(_0x42e5('0x3'));var BPromise=require(_0x42e5('0x4'));var Mustache=require(_0x42e5('0x5'));var util=require(_0x42e5('0x6'));var path=require(_0x42e5('0x7'));var sox=require('sox');var csv=require(_0x42e5('0x8'));var ejs=require(_0x42e5('0x9'));var fs=require('fs');var fs_extra=require(_0x42e5('0xa'));var _=require('lodash');var squel=require(_0x42e5('0xb'));var crypto=require('crypto');var jsforce=require(_0x42e5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x42e5('0x8'));var querystring=require(_0x42e5('0xd'));var Papa=require(_0x42e5('0xe'));var Redis=require(_0x42e5('0xf'));var authService=require(_0x42e5('0x10'));var qs=require(_0x42e5('0x11'));var as=require(_0x42e5('0x12'));var hardwareService=require(_0x42e5('0x13'));var logger=require(_0x42e5('0x14'))('api');var utils=require(_0x42e5('0x15'));var config=require(_0x42e5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x42e5('0x17'))['db'];function respondWithStatusCode(_0x12385d,_0x4530ba){_0x4530ba=_0x4530ba||0xcc;return function(_0x41598d){if(_0x41598d){return _0x12385d[_0x42e5('0x18')](_0x4530ba);}return _0x12385d[_0x42e5('0x19')](_0x4530ba)[_0x42e5('0x1a')]();};}function respondWithResult(_0x96fae2,_0x447648){_0x447648=_0x447648||0xc8;return function(_0x23957f){if(_0x23957f){return _0x96fae2['status'](_0x447648)[_0x42e5('0x1b')](_0x23957f);}};}function respondWithFilteredResult(_0x1d8e52,_0x4034bd){return function(_0x388300){if(_0x388300){var _0x2f4999=typeof _0x4034bd[_0x42e5('0x1c')]===_0x42e5('0x1d')&&typeof _0x4034bd[_0x42e5('0x1e')]===_0x42e5('0x1d');var _0x3c7b79=_0x388300[_0x42e5('0x1f')];var _0x38282d=_0x2f4999?0x0:_0x4034bd[_0x42e5('0x1c')];var _0x23fe09=_0x2f4999?_0x388300['count']:_0x4034bd[_0x42e5('0x1c')]+_0x4034bd['limit'];var _0x5f4428;if(_0x23fe09>=_0x3c7b79){_0x23fe09=_0x3c7b79;_0x5f4428=0xc8;}else{_0x5f4428=0xce;}_0x1d8e52[_0x42e5('0x19')](_0x5f4428);return _0x1d8e52[_0x42e5('0x20')]('Content-Range',_0x38282d+'-'+_0x23fe09+'/'+_0x3c7b79)[_0x42e5('0x1b')](_0x388300);}return null;};}function patchUpdates(_0x39a3e2){return function(_0x1c2169){try{jsonpatch[_0x42e5('0x21')](_0x1c2169,_0x39a3e2,!![]);}catch(_0x1150f4){return BPromise[_0x42e5('0x22')](_0x1150f4);}return _0x1c2169[_0x42e5('0x23')]();};}function saveUpdates(_0x58eee5,_0x4da508){return function(_0x283d44){if(_0x283d44){return _0x283d44['update'](_0x58eee5)[_0x42e5('0x24')](function(_0x2e9574){return _0x2e9574;});}return null;};}function removeEntity(_0x37d10e,_0x49490f){return function(_0x32380f){if(_0x32380f){return _0x32380f['destroy']()[_0x42e5('0x24')](function(){_0x37d10e[_0x42e5('0x19')](0xcc)[_0x42e5('0x1a')]();});}};}function handleEntityNotFound(_0x275c80,_0x4638bc){return function(_0x4f52b2){if(!_0x4f52b2){_0x275c80['sendStatus'](0x194);}return _0x4f52b2;};}function handleError(_0x3115e4,_0x534a26){_0x534a26=_0x534a26||0x1f4;return function(_0x56f812){logger[_0x42e5('0x25')](_0x56f812['stack']);if(_0x56f812[_0x42e5('0x26')]){delete _0x56f812[_0x42e5('0x26')];}_0x3115e4[_0x42e5('0x19')](_0x534a26)[_0x42e5('0x27')](_0x56f812);};}exports[_0x42e5('0x28')]=function(_0x2f1edc,_0x59a46b){var _0x3e2ea5={},_0x201d9e={},_0x39f763={'count':0x0,'rows':[]};var _0x2c53d4=_[_0x42e5('0x29')](db[_0x42e5('0x2a')][_0x42e5('0x2b')],function(_0x282cbf){return{'name':_0x282cbf[_0x42e5('0x2c')],'type':_0x282cbf[_0x42e5('0x2d')][_0x42e5('0x2e')]};});_0x201d9e[_0x42e5('0x2f')]=_[_0x42e5('0x29')](_0x2c53d4,'name');_0x201d9e[_0x42e5('0x30')]=_[_0x42e5('0x31')](_0x2f1edc[_0x42e5('0x30')]);_0x201d9e[_0x42e5('0x32')]=_['intersection'](_0x201d9e['model'],_0x201d9e[_0x42e5('0x30')]);_0x3e2ea5['attributes']=_[_0x42e5('0x33')](_0x201d9e['model'],qs[_0x42e5('0x34')](_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x34')]));_0x3e2ea5['attributes']=_0x3e2ea5[_0x42e5('0x35')][_0x42e5('0x36')]?_0x3e2ea5['attributes']:_0x201d9e[_0x42e5('0x2f')];if(!_0x2f1edc['query'][_0x42e5('0x37')](_0x42e5('0x38'))){_0x3e2ea5[_0x42e5('0x1e')]=qs[_0x42e5('0x1e')](_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x1e')]);_0x3e2ea5[_0x42e5('0x1c')]=qs['offset'](_0x2f1edc['query'][_0x42e5('0x1c')]);}_0x3e2ea5[_0x42e5('0x39')]=qs[_0x42e5('0x3a')](_0x2f1edc['query']['sort']);_0x3e2ea5['where']=qs['filters'](_[_0x42e5('0x3b')](_0x2f1edc[_0x42e5('0x30')],_0x201d9e[_0x42e5('0x32')]),_0x2c53d4);if(_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x3c')]){_0x3e2ea5[_0x42e5('0x3d')]=_[_0x42e5('0x3e')](_0x3e2ea5[_0x42e5('0x3d')],{'$or':_['map'](_0x2c53d4,function(_0x260413){if(_0x260413['type']!==_0x42e5('0x3f')){var _0x343363={};_0x343363[_0x260413[_0x42e5('0x26')]]={'$like':'%'+_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x3c')]+'%'};return _0x343363;}})});}_0x3e2ea5=_[_0x42e5('0x3e')]({},_0x3e2ea5,_0x2f1edc[_0x42e5('0x40')]);var _0x5ab9b8={'where':_0x3e2ea5[_0x42e5('0x3d')]};return db[_0x42e5('0x2a')]['count'](_0x5ab9b8)[_0x42e5('0x24')](function(_0x5e8f96){_0x39f763['count']=_0x5e8f96;if(_0x2f1edc['query'][_0x42e5('0x41')]){_0x3e2ea5[_0x42e5('0x42')]=[{'all':!![]}];}return db[_0x42e5('0x2a')][_0x42e5('0x43')](_0x3e2ea5);})[_0x42e5('0x24')](function(_0x77aa22){_0x39f763[_0x42e5('0x44')]=_0x77aa22;return _0x39f763;})['then'](respondWithFilteredResult(_0x59a46b,_0x3e2ea5))[_0x42e5('0x45')](handleError(_0x59a46b,null));};exports[_0x42e5('0x46')]=function(_0x5bec97,_0x398b73){var _0x1c697a={'raw':!![],'where':{'id':_0x5bec97[_0x42e5('0x47')]['id']}},_0x5db771={};_0x5db771[_0x42e5('0x2f')]=_[_0x42e5('0x31')](db[_0x42e5('0x2a')][_0x42e5('0x2b')]);_0x5db771['query']=_[_0x42e5('0x31')](_0x5bec97[_0x42e5('0x30')]);_0x5db771[_0x42e5('0x32')]=_[_0x42e5('0x33')](_0x5db771['model'],_0x5db771[_0x42e5('0x30')]);_0x1c697a[_0x42e5('0x35')]=_[_0x42e5('0x33')](_0x5db771[_0x42e5('0x2f')],qs[_0x42e5('0x34')](_0x5bec97[_0x42e5('0x30')][_0x42e5('0x34')]));_0x1c697a[_0x42e5('0x35')]=_0x1c697a['attributes'][_0x42e5('0x36')]?_0x1c697a['attributes']:_0x5db771['model'];if(_0x5bec97[_0x42e5('0x30')][_0x42e5('0x41')]){_0x1c697a[_0x42e5('0x42')]=[{'all':!![]}];}_0x1c697a=_[_0x42e5('0x3e')]({},_0x1c697a,_0x5bec97[_0x42e5('0x40')]);return db[_0x42e5('0x2a')][_0x42e5('0x48')](_0x1c697a)['then'](handleEntityNotFound(_0x398b73,null))[_0x42e5('0x24')](respondWithResult(_0x398b73,null))[_0x42e5('0x45')](handleError(_0x398b73,null));};exports[_0x42e5('0x49')]=function(_0x21a047,_0x1086b2){return db[_0x42e5('0x2a')][_0x42e5('0x49')](_0x21a047[_0x42e5('0x4a')],{})['then'](respondWithResult(_0x1086b2,0xc9))[_0x42e5('0x45')](handleError(_0x1086b2,null));};exports[_0x42e5('0x4b')]=function(_0x3616f4,_0x48757e){if(_0x3616f4[_0x42e5('0x4a')]['id']){delete _0x3616f4[_0x42e5('0x4a')]['id'];}return db[_0x42e5('0x2a')][_0x42e5('0x48')]({'where':{'id':_0x3616f4[_0x42e5('0x47')]['id']}})['then'](handleEntityNotFound(_0x48757e,null))[_0x42e5('0x24')](saveUpdates(_0x3616f4['body'],null))[_0x42e5('0x24')](respondWithResult(_0x48757e,null))[_0x42e5('0x45')](handleError(_0x48757e,null));};exports[_0x42e5('0x4c')]=function(_0x48b63b,_0x50f59c){return db['WhatsappQueueReport'][_0x42e5('0x48')]({'where':{'id':_0x48b63b[_0x42e5('0x47')]['id']}})[_0x42e5('0x24')](handleEntityNotFound(_0x50f59c,null))[_0x42e5('0x24')](removeEntity(_0x50f59c,null))['catch'](handleError(_0x50f59c,null));};exports[_0x42e5('0x4d')]=function(_0x26782e,_0x18cedc){return db['WhatsappQueueReport'][_0x42e5('0x4d')]()['then'](respondWithResult(_0x18cedc,null))[_0x42e5('0x45')](handleError(_0x18cedc,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index cd35f32..b50e32f 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 _0x159d=['rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','uniqueid','lodash','util','../../config/logger','api'];(function(_0x5ae64f,_0x5b0c7c){var _0x296ee4=function(_0x3c515d){while(--_0x3c515d){_0x5ae64f['push'](_0x5ae64f['shift']());}};_0x296ee4(++_0x5b0c7c);}(_0x159d,0x7e));var _0xd159=function(_0x4ff481,_0x27a565){_0x4ff481=_0x4ff481-0x0;var _0x301900=_0x159d[_0x4ff481];return _0x301900;};'use strict';var _=require(_0xd159('0x0'));var util=require(_0xd159('0x1'));var logger=require(_0xd159('0x2'))(_0xd159('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd159('0x4'));var config=require(_0xd159('0x5'));var attributes=require(_0xd159('0x6'));module['exports']=function(_0x1ef3c6,_0xb52de8){return _0x1ef3c6[_0xd159('0x7')](_0xd159('0x8'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd159('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2056=['moment','bluebird','request-promise','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','../../config/logger','api'];(function(_0x3d0439,_0x4710bc){var _0xb3874c=function(_0x163229){while(--_0x163229){_0x3d0439['push'](_0x3d0439['shift']());}};_0xb3874c(++_0x4710bc);}(_0x2056,0xae));var _0x6205=function(_0x8550ba,_0x57c10d){_0x8550ba=_0x8550ba-0x0;var _0x432399=_0x2056[_0x8550ba];return _0x432399;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6205('0x0'))(_0x6205('0x1'));var moment=require(_0x6205('0x2'));var BPromise=require(_0x6205('0x3'));var rp=require(_0x6205('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6205('0x5'));var attributes=require(_0x6205('0x6'));module[_0x6205('0x7')]=function(_0x48a5c3,_0x5cd4af){return _0x48a5c3[_0x6205('0x8')]('WhatsappQueueReport',attributes,{'tableName':_0x6205('0x9'),'paranoid':![],'indexes':[{'name':_0x6205('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index d46a6df..917a3fb 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 _0xcaab=['update','where','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','info','UpdateWhatsappQueueReport'];(function(_0x1f6e2b,_0x1157d3){var _0x4e7e68=function(_0x4e763c){while(--_0x4e763c){_0x1f6e2b['push'](_0x1f6e2b['shift']());}};_0x4e7e68(++_0x1157d3);}(_0xcaab,0x115));var _0xbcaa=function(_0x453b79,_0x2686e6){_0x453b79=_0x453b79-0x0;var _0x2f2c9e=_0xcaab[_0x453b79];return _0x2f2c9e;};'use strict';var _=require(_0xbcaa('0x0'));var util=require(_0xbcaa('0x1'));var moment=require(_0xbcaa('0x2'));var BPromise=require(_0xbcaa('0x3'));var rs=require(_0xbcaa('0x4'));var fs=require('fs');var Redis=require(_0xbcaa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbcaa('0x6'));var logger=require(_0xbcaa('0x7'))(_0xbcaa('0x8'));var config=require(_0xbcaa('0x9'));var jayson=require(_0xbcaa('0xa'));var client=jayson['client'][_0xbcaa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22f570,_0x1ee03a,_0x2b59d1){return new BPromise(function(_0x82c356,_0x2010b1){return client['request'](_0x22f570,_0x2b59d1)[_0xbcaa('0xc')](function(_0x3ac0e2){logger['info'](_0xbcaa('0xd'),_0x1ee03a,_0xbcaa('0xe'));logger[_0xbcaa('0xf')](_0xbcaa('0x10'),_0x1ee03a,_0xbcaa('0xe'),JSON['stringify'](_0x3ac0e2));if(_0x3ac0e2[_0xbcaa('0x11')]){if(_0x3ac0e2['error'][_0xbcaa('0x12')]===0x1f4){logger[_0xbcaa('0x11')](_0xbcaa('0xd'),_0x1ee03a,_0x3ac0e2[_0xbcaa('0x11')][_0xbcaa('0x13')]);return _0x2010b1(_0x3ac0e2[_0xbcaa('0x11')][_0xbcaa('0x13')]);}logger[_0xbcaa('0x11')](_0xbcaa('0xd'),_0x1ee03a,_0x3ac0e2[_0xbcaa('0x11')][_0xbcaa('0x13')]);return _0x82c356(_0x3ac0e2[_0xbcaa('0x11')][_0xbcaa('0x13')]);}else{logger['info'](_0xbcaa('0xd'),_0x1ee03a,_0xbcaa('0xe'));_0x82c356(_0x3ac0e2[_0xbcaa('0x14')]['message']);}})[_0xbcaa('0x15')](function(_0x1f310b){logger[_0xbcaa('0x11')](_0xbcaa('0xd'),_0x1ee03a,_0x1f310b);_0x2010b1(_0x1f310b);});});}exports[_0xbcaa('0x16')]=function(_0x59660f){var _0x3715c8=this;return new Promise(function(_0x5cb1d0,_0x3301e9){return db[_0xbcaa('0x17')]['create'](_0x59660f[_0xbcaa('0x18')],{'raw':_0x59660f[_0xbcaa('0x19')]?_0x59660f['options'][_0xbcaa('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1c02fa){logger[_0xbcaa('0x1b')](_0xbcaa('0x16'),_0x59660f);logger[_0xbcaa('0xf')]('CreateWhatsappQueueReport',_0x59660f,JSON['stringify'](_0x1c02fa));_0x5cb1d0(_0x1c02fa);})[_0xbcaa('0x15')](function(_0x13ed36){logger[_0xbcaa('0x11')](_0xbcaa('0x16'),_0x13ed36[_0xbcaa('0x13')],_0x59660f);_0x3301e9(_0x3715c8[_0xbcaa('0x11')](0x1f4,_0x13ed36['message']));});});};exports[_0xbcaa('0x1c')]=function(_0x3e9a2f){var _0x7a7d74=this;return new Promise(function(_0x5e0bba,_0x253647){return db[_0xbcaa('0x17')][_0xbcaa('0x1d')](_0x3e9a2f[_0xbcaa('0x18')],{'raw':_0x3e9a2f['options']?_0x3e9a2f[_0xbcaa('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e9a2f[_0xbcaa('0x19')]?_0x3e9a2f['options'][_0xbcaa('0x1e')]||null:null,'attributes':_0x3e9a2f['options']?_0x3e9a2f[_0xbcaa('0x19')][_0xbcaa('0x1f')]||null:null,'limit':_0x3e9a2f[_0xbcaa('0x19')]?_0x3e9a2f[_0xbcaa('0x19')][_0xbcaa('0x20')]||null:null})[_0xbcaa('0xc')](function(_0x4d0ce2){logger[_0xbcaa('0x1b')](_0xbcaa('0x1c'),_0x3e9a2f);logger[_0xbcaa('0xf')](_0xbcaa('0x1c'),_0x3e9a2f,JSON[_0xbcaa('0x21')](_0x4d0ce2));_0x5e0bba(_0x4d0ce2);})['catch'](function(_0x12e1da){logger[_0xbcaa('0x11')](_0xbcaa('0x1c'),_0x12e1da[_0xbcaa('0x13')],_0x3e9a2f);_0x253647(_0x7a7d74[_0xbcaa('0x11')](0x1f4,_0x12e1da['message']));});});}; \ No newline at end of file +var _0x5d6f=['client','request','then','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','create','options','raw','UpdateWhatsappQueueReport','WhatsappQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x1c7ad0,_0x448315){var _0x27314b=function(_0x49bd56){while(--_0x49bd56){_0x1c7ad0['push'](_0x1c7ad0['shift']());}};_0x27314b(++_0x448315);}(_0x5d6f,0x1c4));var _0xf5d6=function(_0x5ecbe8,_0x42522f){_0x5ecbe8=_0x5ecbe8-0x0;var _0x1c6e21=_0x5d6f[_0x5ecbe8];return _0x1c6e21;};'use strict';var _=require(_0xf5d6('0x0'));var util=require(_0xf5d6('0x1'));var moment=require(_0xf5d6('0x2'));var BPromise=require(_0xf5d6('0x3'));var rs=require(_0xf5d6('0x4'));var fs=require('fs');var Redis=require(_0xf5d6('0x5'));var db=require(_0xf5d6('0x6'))['db'];var utils=require(_0xf5d6('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5d6('0x8'));var jayson=require(_0xf5d6('0x9'));var client=jayson[_0xf5d6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41603a,_0x432b75,_0x3cac63){return new BPromise(function(_0x1ea77f,_0x1495b6){return client[_0xf5d6('0xb')](_0x41603a,_0x3cac63)[_0xf5d6('0xc')](function(_0x42655b){logger[_0xf5d6('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x432b75,_0xf5d6('0xe'));logger[_0xf5d6('0xf')](_0xf5d6('0x10'),_0x432b75,'request\x20sent',JSON[_0xf5d6('0x11')](_0x42655b));if(_0x42655b[_0xf5d6('0x12')]){if(_0x42655b[_0xf5d6('0x12')][_0xf5d6('0x13')]===0x1f4){logger[_0xf5d6('0x12')](_0xf5d6('0x14'),_0x432b75,_0x42655b[_0xf5d6('0x12')][_0xf5d6('0x15')]);return _0x1495b6(_0x42655b[_0xf5d6('0x12')]['message']);}logger[_0xf5d6('0x12')](_0xf5d6('0x14'),_0x432b75,_0x42655b['error'][_0xf5d6('0x15')]);return _0x1ea77f(_0x42655b['error'][_0xf5d6('0x15')]);}else{logger[_0xf5d6('0xd')](_0xf5d6('0x14'),_0x432b75,'request\x20sent');_0x1ea77f(_0x42655b[_0xf5d6('0x16')][_0xf5d6('0x15')]);}})[_0xf5d6('0x17')](function(_0x309ca9){logger[_0xf5d6('0x12')](_0xf5d6('0x14'),_0x432b75,_0x309ca9);_0x1495b6(_0x309ca9);});});}exports[_0xf5d6('0x18')]=function(_0x22f6c0){var _0x27d61a=this;return new Promise(function(_0x755664,_0xa69206){return db['WhatsappQueueReport'][_0xf5d6('0x19')](_0x22f6c0['body'],{'raw':_0x22f6c0[_0xf5d6('0x1a')]?_0x22f6c0['options'][_0xf5d6('0x1b')]===undefined?!![]:![]:!![]})[_0xf5d6('0xc')](function(_0x13ffe1){logger[_0xf5d6('0xd')](_0xf5d6('0x18'),_0x22f6c0);logger[_0xf5d6('0xf')](_0xf5d6('0x18'),_0x22f6c0,JSON[_0xf5d6('0x11')](_0x13ffe1));_0x755664(_0x13ffe1);})['catch'](function(_0x7f660d){logger[_0xf5d6('0x12')](_0xf5d6('0x18'),_0x7f660d[_0xf5d6('0x15')],_0x22f6c0);_0xa69206(_0x27d61a[_0xf5d6('0x12')](0x1f4,_0x7f660d['message']));});});};exports[_0xf5d6('0x1c')]=function(_0x359ca3){var _0x3624e1=this;return new Promise(function(_0x30a3c6,_0x5bba9f){return db[_0xf5d6('0x1d')][_0xf5d6('0x1e')](_0x359ca3['body'],{'raw':_0x359ca3['options']?_0x359ca3['options'][_0xf5d6('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x359ca3[_0xf5d6('0x1a')]?_0x359ca3['options']['where']||null:null,'attributes':_0x359ca3['options']?_0x359ca3[_0xf5d6('0x1a')][_0xf5d6('0x1f')]||null:null,'limit':_0x359ca3[_0xf5d6('0x1a')]?_0x359ca3['options'][_0xf5d6('0x20')]||null:null})[_0xf5d6('0xc')](function(_0x357c6c){logger[_0xf5d6('0xd')](_0xf5d6('0x1c'),_0x359ca3);logger[_0xf5d6('0xf')](_0xf5d6('0x1c'),_0x359ca3,JSON[_0xf5d6('0x11')](_0x357c6c));_0x30a3c6(_0x357c6c);})[_0xf5d6('0x17')](function(_0x3ab959){logger[_0xf5d6('0x12')](_0xf5d6('0x1c'),_0x3ab959[_0xf5d6('0x15')],_0x359ca3);_0x5bba9f(_0x3624e1[_0xf5d6('0x12')](0x1f4,_0x3ab959[_0xf5d6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 1d9040f..192c0cd 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 _0x139f=['update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put'];(function(_0x44a3cd,_0x256e13){var _0x3eede8=function(_0x396e2d){while(--_0x396e2d){_0x44a3cd['push'](_0x44a3cd['shift']());}};_0x3eede8(++_0x256e13);}(_0x139f,0xf4));var _0xf139=function(_0x4ef58a,_0x122e9d){_0x4ef58a=_0x4ef58a-0x0;var _0x4e5968=_0x139f[_0x4ef58a];return _0x4e5968;};'use strict';var multer=require(_0xf139('0x0'));var util=require(_0xf139('0x1'));var path=require(_0xf139('0x2'));var timeout=require('connect-timeout');var express=require(_0xf139('0x3'));var router=express[_0xf139('0x4')]();var fs_extra=require(_0xf139('0x5'));var auth=require(_0xf139('0x6'));var interaction=require(_0xf139('0x7'));var config=require(_0xf139('0x8'));var controller=require(_0xf139('0x9'));router['get']('/',auth[_0xf139('0xa')](),controller[_0xf139('0xb')]);router[_0xf139('0xc')](_0xf139('0xd'),auth[_0xf139('0xa')](),controller[_0xf139('0xe')]);router[_0xf139('0xc')](_0xf139('0xf'),auth[_0xf139('0xa')](),controller[_0xf139('0x10')]);router[_0xf139('0x11')]('/',auth[_0xf139('0xa')](),controller[_0xf139('0x12')]);router[_0xf139('0x13')]('/:id',auth[_0xf139('0xa')](),controller[_0xf139('0x14')]);router[_0xf139('0x15')]('/:id',auth[_0xf139('0xa')](),controller[_0xf139('0x16')]);module[_0xf139('0x17')]=router; \ No newline at end of file +var _0xe702=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','multer','path','connect-timeout'];(function(_0x365b01,_0x4d1cb4){var _0x4235f5=function(_0x5927db){while(--_0x5927db){_0x365b01['push'](_0x365b01['shift']());}};_0x4235f5(++_0x4d1cb4);}(_0xe702,0x1e1));var _0x2e70=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xe702[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x2e70('0x0'));var util=require('util');var path=require(_0x2e70('0x1'));var timeout=require(_0x2e70('0x2'));var express=require(_0x2e70('0x3'));var router=express[_0x2e70('0x4')]();var fs_extra=require(_0x2e70('0x5'));var auth=require(_0x2e70('0x6'));var interaction=require(_0x2e70('0x7'));var config=require('../../config/environment');var controller=require(_0x2e70('0x8'));router[_0x2e70('0x9')]('/',auth['isAuthenticated'](),controller[_0x2e70('0xa')]);router[_0x2e70('0x9')](_0x2e70('0xb'),auth[_0x2e70('0xc')](),controller[_0x2e70('0xd')]);router['get'](_0x2e70('0xe'),auth['isAuthenticated'](),controller[_0x2e70('0xf')]);router[_0x2e70('0x10')]('/',auth[_0x2e70('0xc')](),controller[_0x2e70('0x11')]);router[_0x2e70('0x12')](_0x2e70('0xe'),auth[_0x2e70('0xc')](),controller[_0x2e70('0x13')]);router[_0x2e70('0x14')](_0x2e70('0xe'),auth[_0x2e70('0xc')](),controller[_0x2e70('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 5a101d9..b3d9f2d 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 _0xae8e=['agent','queue','DATE','sequelize','exports','STRING','ENUM','account'];(function(_0xf63e72,_0x1d02eb){var _0x3ee008=function(_0x40317c){while(--_0x40317c){_0xf63e72['push'](_0xf63e72['shift']());}};_0x3ee008(++_0x1d02eb);}(_0xae8e,0xc3));var _0xeae8=function(_0x3f56f9,_0x58d9e4){_0x3f56f9=_0x3f56f9-0x0;var _0x2c3c55=_0xae8e[_0x3f56f9];return _0x2c3c55;};'use strict';var Sequelize=require(_0xeae8('0x0'));module[_0xeae8('0x1')]={'uniqueid':{'type':Sequelize[_0xeae8('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xeae8('0x3')](_0xeae8('0x4'),_0xeae8('0x5'),_0xeae8('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xeae8('0x7')]}}; \ No newline at end of file +var _0x110f=['agent','DATE','sequelize','exports'];(function(_0x5a579b,_0x2fdb08){var _0x88d43b=function(_0x156634){while(--_0x156634){_0x5a579b['push'](_0x5a579b['shift']());}};_0x88d43b(++_0x2fdb08);}(_0x110f,0x1e6));var _0xf110=function(_0x2a9578,_0x5951df){_0x2a9578=_0x2a9578-0x0;var _0x32c32f=_0x110f[_0x2a9578];return _0x32c32f;};'use strict';var Sequelize=require(_0xf110('0x0'));module[_0xf110('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0xf110('0x2'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf110('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index bf48527..118d0b8 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 _0x78c9=['key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','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','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','type'];(function(_0x1395f7,_0xbf1708){var _0x5a82d7=function(_0x27961a){while(--_0x27961a){_0x1395f7['push'](_0x1395f7['shift']());}};_0x5a82d7(++_0xbf1708);}(_0x78c9,0x68));var _0x978c=function(_0x346dc2,_0xb0f77d){_0x346dc2=_0x346dc2-0x0;var _0x22c3c8=_0x78c9[_0x346dc2];return _0x22c3c8;};'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'];function respondWithStatusCode(_0x17e2df,_0x22c208){_0x22c208=_0x22c208||0xcc;return function(_0x3d0f69){if(_0x3d0f69){return _0x17e2df[_0x978c('0x16')](_0x22c208);}return _0x17e2df[_0x978c('0x17')](_0x22c208)[_0x978c('0x18')]();};}function respondWithResult(_0x4a06b1,_0x5485e3){_0x5485e3=_0x5485e3||0xc8;return function(_0x2ca64b){if(_0x2ca64b){return _0x4a06b1[_0x978c('0x17')](_0x5485e3)['json'](_0x2ca64b);}};}function respondWithFilteredResult(_0x3d01f4,_0x3355ca){return function(_0x1d9942){if(_0x1d9942){var _0x2f6bf3=typeof _0x3355ca[_0x978c('0x19')]===_0x978c('0x1a')&&typeof _0x3355ca[_0x978c('0x1b')]==='undefined';var _0x3193e9=_0x1d9942[_0x978c('0x1c')];var _0x5c9a11=_0x2f6bf3?0x0:_0x3355ca[_0x978c('0x19')];var _0x746ba=_0x2f6bf3?_0x1d9942[_0x978c('0x1c')]:_0x3355ca[_0x978c('0x19')]+_0x3355ca[_0x978c('0x1b')];var _0x1a452e;if(_0x746ba>=_0x3193e9){_0x746ba=_0x3193e9;_0x1a452e=0xc8;}else{_0x1a452e=0xce;}_0x3d01f4[_0x978c('0x17')](_0x1a452e);return _0x3d01f4[_0x978c('0x1d')](_0x978c('0x1e'),_0x5c9a11+'-'+_0x746ba+'/'+_0x3193e9)[_0x978c('0x1f')](_0x1d9942);}return null;};}function patchUpdates(_0x3d303d){return function(_0xa9f7b8){try{jsonpatch[_0x978c('0x20')](_0xa9f7b8,_0x3d303d,!![]);}catch(_0x56ca1a){return BPromise[_0x978c('0x21')](_0x56ca1a);}return _0xa9f7b8[_0x978c('0x22')]();};}function saveUpdates(_0x559a76,_0x4c11fa){return function(_0x5f5a50){if(_0x5f5a50){return _0x5f5a50[_0x978c('0x23')](_0x559a76)[_0x978c('0x24')](function(_0x296ca2){return _0x296ca2;});}return null;};}function removeEntity(_0x564b33,_0x558eba){return function(_0x1b5250){if(_0x1b5250){return _0x1b5250[_0x978c('0x25')]()[_0x978c('0x24')](function(){_0x564b33[_0x978c('0x17')](0xcc)[_0x978c('0x18')]();});}};}function handleEntityNotFound(_0x5cf006,_0x2964dd){return function(_0x5b6d94){if(!_0x5b6d94){_0x5cf006['sendStatus'](0x194);}return _0x5b6d94;};}function handleError(_0x512412,_0x11a3f5){_0x11a3f5=_0x11a3f5||0x1f4;return function(_0x30608b){logger[_0x978c('0x26')](_0x30608b[_0x978c('0x27')]);if(_0x30608b['name']){delete _0x30608b[_0x978c('0x28')];}_0x512412['status'](_0x11a3f5)['send'](_0x30608b);};}exports[_0x978c('0x29')]=function(_0x12e742,_0x216947){var _0x5e7f9b={},_0x2f499c={},_0x36e481={'count':0x0,'rows':[]};var _0x5be127=_[_0x978c('0x2a')](db[_0x978c('0x2b')][_0x978c('0x2c')],function(_0xd70956){return{'name':_0xd70956['fieldName'],'type':_0xd70956[_0x978c('0x2d')][_0x978c('0x2e')]};});_0x2f499c[_0x978c('0x2f')]=_[_0x978c('0x2a')](_0x5be127,_0x978c('0x28'));_0x2f499c['query']=_[_0x978c('0x30')](_0x12e742['query']);_0x2f499c[_0x978c('0x31')]=_[_0x978c('0x32')](_0x2f499c[_0x978c('0x2f')],_0x2f499c['query']);_0x5e7f9b[_0x978c('0x33')]=_[_0x978c('0x32')](_0x2f499c['model'],qs[_0x978c('0x34')](_0x12e742[_0x978c('0x35')][_0x978c('0x34')]));_0x5e7f9b[_0x978c('0x33')]=_0x5e7f9b[_0x978c('0x33')][_0x978c('0x36')]?_0x5e7f9b[_0x978c('0x33')]:_0x2f499c[_0x978c('0x2f')];if(!_0x12e742[_0x978c('0x35')][_0x978c('0x37')]('nolimit')){_0x5e7f9b[_0x978c('0x1b')]=qs['limit'](_0x12e742[_0x978c('0x35')][_0x978c('0x1b')]);_0x5e7f9b[_0x978c('0x19')]=qs[_0x978c('0x19')](_0x12e742[_0x978c('0x35')][_0x978c('0x19')]);}_0x5e7f9b[_0x978c('0x38')]=qs[_0x978c('0x39')](_0x12e742[_0x978c('0x35')][_0x978c('0x39')]);_0x5e7f9b[_0x978c('0x3a')]=qs[_0x978c('0x31')](_[_0x978c('0x3b')](_0x12e742[_0x978c('0x35')],_0x2f499c[_0x978c('0x31')]),_0x5be127);if(_0x12e742['query'][_0x978c('0x3c')]){_0x5e7f9b['where']=_[_0x978c('0x3d')](_0x5e7f9b[_0x978c('0x3a')],{'$or':_[_0x978c('0x2a')](_0x5be127,function(_0x23947c){if(_0x23947c['type']!==_0x978c('0x3e')){var _0x13d110={};_0x13d110[_0x23947c[_0x978c('0x28')]]={'$like':'%'+_0x12e742[_0x978c('0x35')]['filter']+'%'};return _0x13d110;}})});}_0x5e7f9b=_[_0x978c('0x3d')]({},_0x5e7f9b,_0x12e742[_0x978c('0x3f')]);var _0x5cbd1b={'where':_0x5e7f9b['where']};return db[_0x978c('0x2b')][_0x978c('0x1c')](_0x5cbd1b)[_0x978c('0x24')](function(_0x102c78){_0x36e481[_0x978c('0x1c')]=_0x102c78;if(_0x12e742['query'][_0x978c('0x40')]){_0x5e7f9b[_0x978c('0x41')]=[{'all':!![]}];}return db[_0x978c('0x2b')][_0x978c('0x42')](_0x5e7f9b);})[_0x978c('0x24')](function(_0x2fece2){_0x36e481[_0x978c('0x43')]=_0x2fece2;return _0x36e481;})[_0x978c('0x24')](respondWithFilteredResult(_0x216947,_0x5e7f9b))[_0x978c('0x44')](handleError(_0x216947,null));};exports[_0x978c('0x45')]=function(_0x468535,_0x4de5f9){var _0x406ce7={'raw':!![],'where':{'id':_0x468535['params']['id']}},_0x7af7e4={};_0x7af7e4['model']=_[_0x978c('0x30')](db[_0x978c('0x2b')][_0x978c('0x2c')]);_0x7af7e4['query']=_[_0x978c('0x30')](_0x468535[_0x978c('0x35')]);_0x7af7e4[_0x978c('0x31')]=_['intersection'](_0x7af7e4[_0x978c('0x2f')],_0x7af7e4[_0x978c('0x35')]);_0x406ce7[_0x978c('0x33')]=_[_0x978c('0x32')](_0x7af7e4['model'],qs[_0x978c('0x34')](_0x468535[_0x978c('0x35')][_0x978c('0x34')]));_0x406ce7['attributes']=_0x406ce7[_0x978c('0x33')]['length']?_0x406ce7[_0x978c('0x33')]:_0x7af7e4[_0x978c('0x2f')];if(_0x468535[_0x978c('0x35')][_0x978c('0x40')]){_0x406ce7['include']=[{'all':!![]}];}_0x406ce7=_[_0x978c('0x3d')]({},_0x406ce7,_0x468535[_0x978c('0x3f')]);return db[_0x978c('0x2b')][_0x978c('0x46')](_0x406ce7)[_0x978c('0x24')](handleEntityNotFound(_0x4de5f9,null))['then'](respondWithResult(_0x4de5f9,null))[_0x978c('0x44')](handleError(_0x4de5f9,null));};exports[_0x978c('0x47')]=function(_0x72abf5,_0x67b9d1){return db[_0x978c('0x2b')]['create'](_0x72abf5[_0x978c('0x48')],{})[_0x978c('0x24')](respondWithResult(_0x67b9d1,0xc9))[_0x978c('0x44')](handleError(_0x67b9d1,null));};exports['update']=function(_0x574a38,_0x3bd068){if(_0x574a38[_0x978c('0x48')]['id']){delete _0x574a38[_0x978c('0x48')]['id'];}return db[_0x978c('0x2b')][_0x978c('0x46')]({'where':{'id':_0x574a38[_0x978c('0x49')]['id']}})[_0x978c('0x24')](handleEntityNotFound(_0x3bd068,null))[_0x978c('0x24')](saveUpdates(_0x574a38[_0x978c('0x48')],null))[_0x978c('0x24')](respondWithResult(_0x3bd068,null))[_0x978c('0x44')](handleError(_0x3bd068,null));};exports[_0x978c('0x25')]=function(_0x4e668b,_0x1d13d0){return db[_0x978c('0x2b')][_0x978c('0x46')]({'where':{'id':_0x4e668b[_0x978c('0x49')]['id']}})[_0x978c('0x24')](handleEntityNotFound(_0x1d13d0,null))['then'](removeEntity(_0x1d13d0,null))[_0x978c('0x44')](handleError(_0x1d13d0,null));};exports[_0x978c('0x4a')]=function(_0x43ebde,_0x5f9995){return db[_0x978c('0x2b')][_0x978c('0x4a')]()[_0x978c('0x24')](respondWithResult(_0x5f9995,null))[_0x978c('0x44')](handleError(_0x5f9995,null));}; \ No newline at end of file +var _0x32c0=['create','body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','type','merge','options','includeAll','include','findAll','rows','catch','show','params','keys'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x32c0,0x1bb));var _0x032c=function(_0x5b1610,_0x12694d){_0x5b1610=_0x5b1610-0x0;var _0x58cb89=_0x32c0[_0x5b1610];return _0x58cb89;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x032c('0x0'));var zipdir=require(_0x032c('0x1'));var jsonpatch=require(_0x032c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x032c('0x3'));var Mustache=require('mustache');var util=require(_0x032c('0x4'));var path=require('path');var sox=require(_0x032c('0x5'));var csv=require(_0x032c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x032c('0x7'));var squel=require(_0x032c('0x8'));var crypto=require(_0x032c('0x9'));var jsforce=require(_0x032c('0xa'));var deskjs=require(_0x032c('0xb'));var toCsv=require(_0x032c('0x6'));var querystring=require(_0x032c('0xc'));var Papa=require(_0x032c('0xd'));var Redis=require(_0x032c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x032c('0xf'));var as=require(_0x032c('0x10'));var hardwareService=require(_0x032c('0x11'));var logger=require('../../config/logger')(_0x032c('0x12'));var utils=require('../../config/utils');var config=require(_0x032c('0x13'));var licenseUtil=require(_0x032c('0x14'));var db=require(_0x032c('0x15'))['db'];function respondWithStatusCode(_0x49874d,_0xb91a3f){_0xb91a3f=_0xb91a3f||0xcc;return function(_0x1fae8d){if(_0x1fae8d){return _0x49874d[_0x032c('0x16')](_0xb91a3f);}return _0x49874d[_0x032c('0x17')](_0xb91a3f)['end']();};}function respondWithResult(_0x3cc6e0,_0x45337f){_0x45337f=_0x45337f||0xc8;return function(_0x2f0aeb){if(_0x2f0aeb){return _0x3cc6e0[_0x032c('0x17')](_0x45337f)[_0x032c('0x18')](_0x2f0aeb);}};}function respondWithFilteredResult(_0x7ecf7e,_0x2eb211){return function(_0x2f0271){if(_0x2f0271){var _0x3d1439=typeof _0x2eb211[_0x032c('0x19')]===_0x032c('0x1a')&&typeof _0x2eb211[_0x032c('0x1b')]===_0x032c('0x1a');var _0x108ae7=_0x2f0271['count'];var _0xb6249c=_0x3d1439?0x0:_0x2eb211[_0x032c('0x19')];var _0x442995=_0x3d1439?_0x2f0271[_0x032c('0x1c')]:_0x2eb211['offset']+_0x2eb211[_0x032c('0x1b')];var _0x3f636b;if(_0x442995>=_0x108ae7){_0x442995=_0x108ae7;_0x3f636b=0xc8;}else{_0x3f636b=0xce;}_0x7ecf7e['status'](_0x3f636b);return _0x7ecf7e[_0x032c('0x1d')](_0x032c('0x1e'),_0xb6249c+'-'+_0x442995+'/'+_0x108ae7)[_0x032c('0x18')](_0x2f0271);}return null;};}function patchUpdates(_0x5be5a6){return function(_0x1e80ea){try{jsonpatch[_0x032c('0x1f')](_0x1e80ea,_0x5be5a6,!![]);}catch(_0x397756){return BPromise[_0x032c('0x20')](_0x397756);}return _0x1e80ea['save']();};}function saveUpdates(_0x4f7c4b,_0x227e79){return function(_0x3f2f20){if(_0x3f2f20){return _0x3f2f20[_0x032c('0x21')](_0x4f7c4b)[_0x032c('0x22')](function(_0x6c4183){return _0x6c4183;});}return null;};}function removeEntity(_0x2075d2,_0x36025a){return function(_0x2b1bb4){if(_0x2b1bb4){return _0x2b1bb4['destroy']()[_0x032c('0x22')](function(){_0x2075d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4163fd,_0x5d1fda){return function(_0x205b16){if(!_0x205b16){_0x4163fd['sendStatus'](0x194);}return _0x205b16;};}function handleError(_0x35ca92,_0x4121ba){_0x4121ba=_0x4121ba||0x1f4;return function(_0x3ba47a){logger[_0x032c('0x23')](_0x3ba47a['stack']);if(_0x3ba47a[_0x032c('0x24')]){delete _0x3ba47a['name'];}_0x35ca92['status'](_0x4121ba)[_0x032c('0x25')](_0x3ba47a);};}exports[_0x032c('0x26')]=function(_0x419baf,_0x27b4d0){var _0x3044ae={},_0x3f6655={},_0x41d8c2={'count':0x0,'rows':[]};var _0x51c82a=_[_0x032c('0x27')](db[_0x032c('0x28')][_0x032c('0x29')],function(_0x1d1496){return{'name':_0x1d1496[_0x032c('0x2a')],'type':_0x1d1496['type'][_0x032c('0x2b')]};});_0x3f6655['model']=_[_0x032c('0x27')](_0x51c82a,_0x032c('0x24'));_0x3f6655[_0x032c('0x2c')]=_['keys'](_0x419baf[_0x032c('0x2c')]);_0x3f6655['filters']=_[_0x032c('0x2d')](_0x3f6655[_0x032c('0x2e')],_0x3f6655[_0x032c('0x2c')]);_0x3044ae[_0x032c('0x2f')]=_[_0x032c('0x2d')](_0x3f6655[_0x032c('0x2e')],qs[_0x032c('0x30')](_0x419baf[_0x032c('0x2c')][_0x032c('0x30')]));_0x3044ae[_0x032c('0x2f')]=_0x3044ae[_0x032c('0x2f')][_0x032c('0x31')]?_0x3044ae[_0x032c('0x2f')]:_0x3f6655[_0x032c('0x2e')];if(!_0x419baf['query'][_0x032c('0x32')](_0x032c('0x33'))){_0x3044ae[_0x032c('0x1b')]=qs[_0x032c('0x1b')](_0x419baf[_0x032c('0x2c')][_0x032c('0x1b')]);_0x3044ae[_0x032c('0x19')]=qs[_0x032c('0x19')](_0x419baf[_0x032c('0x2c')][_0x032c('0x19')]);}_0x3044ae[_0x032c('0x34')]=qs['sort'](_0x419baf[_0x032c('0x2c')][_0x032c('0x35')]);_0x3044ae[_0x032c('0x36')]=qs[_0x032c('0x37')](_['pick'](_0x419baf[_0x032c('0x2c')],_0x3f6655['filters']),_0x51c82a);if(_0x419baf[_0x032c('0x2c')][_0x032c('0x38')]){_0x3044ae[_0x032c('0x36')]=_['merge'](_0x3044ae[_0x032c('0x36')],{'$or':_[_0x032c('0x27')](_0x51c82a,function(_0x31be78){if(_0x31be78[_0x032c('0x39')]!=='VIRTUAL'){var _0x5212c2={};_0x5212c2[_0x31be78['name']]={'$like':'%'+_0x419baf['query'][_0x032c('0x38')]+'%'};return _0x5212c2;}})});}_0x3044ae=_[_0x032c('0x3a')]({},_0x3044ae,_0x419baf[_0x032c('0x3b')]);var _0xdeb7ed={'where':_0x3044ae[_0x032c('0x36')]};return db[_0x032c('0x28')][_0x032c('0x1c')](_0xdeb7ed)[_0x032c('0x22')](function(_0x212164){_0x41d8c2[_0x032c('0x1c')]=_0x212164;if(_0x419baf[_0x032c('0x2c')][_0x032c('0x3c')]){_0x3044ae[_0x032c('0x3d')]=[{'all':!![]}];}return db[_0x032c('0x28')][_0x032c('0x3e')](_0x3044ae);})[_0x032c('0x22')](function(_0x4ac298){_0x41d8c2[_0x032c('0x3f')]=_0x4ac298;return _0x41d8c2;})[_0x032c('0x22')](respondWithFilteredResult(_0x27b4d0,_0x3044ae))[_0x032c('0x40')](handleError(_0x27b4d0,null));};exports[_0x032c('0x41')]=function(_0x48d925,_0x539a24){var _0xebbc01={'raw':!![],'where':{'id':_0x48d925[_0x032c('0x42')]['id']}},_0x135397={};_0x135397[_0x032c('0x2e')]=_[_0x032c('0x43')](db[_0x032c('0x28')][_0x032c('0x29')]);_0x135397[_0x032c('0x2c')]=_[_0x032c('0x43')](_0x48d925['query']);_0x135397[_0x032c('0x37')]=_[_0x032c('0x2d')](_0x135397[_0x032c('0x2e')],_0x135397[_0x032c('0x2c')]);_0xebbc01['attributes']=_[_0x032c('0x2d')](_0x135397[_0x032c('0x2e')],qs[_0x032c('0x30')](_0x48d925[_0x032c('0x2c')]['fields']));_0xebbc01['attributes']=_0xebbc01[_0x032c('0x2f')][_0x032c('0x31')]?_0xebbc01[_0x032c('0x2f')]:_0x135397[_0x032c('0x2e')];if(_0x48d925[_0x032c('0x2c')][_0x032c('0x3c')]){_0xebbc01[_0x032c('0x3d')]=[{'all':!![]}];}_0xebbc01=_[_0x032c('0x3a')]({},_0xebbc01,_0x48d925[_0x032c('0x3b')]);return db[_0x032c('0x28')]['find'](_0xebbc01)[_0x032c('0x22')](handleEntityNotFound(_0x539a24,null))[_0x032c('0x22')](respondWithResult(_0x539a24,null))['catch'](handleError(_0x539a24,null));};exports[_0x032c('0x44')]=function(_0x1c893d,_0x2a093b){return db[_0x032c('0x28')]['create'](_0x1c893d[_0x032c('0x45')],{})['then'](respondWithResult(_0x2a093b,0xc9))['catch'](handleError(_0x2a093b,null));};exports['update']=function(_0x12f3b0,_0x238858){if(_0x12f3b0[_0x032c('0x45')]['id']){delete _0x12f3b0[_0x032c('0x45')]['id'];}return db[_0x032c('0x28')][_0x032c('0x46')]({'where':{'id':_0x12f3b0[_0x032c('0x42')]['id']}})[_0x032c('0x22')](handleEntityNotFound(_0x238858,null))[_0x032c('0x22')](saveUpdates(_0x12f3b0[_0x032c('0x45')],null))[_0x032c('0x22')](respondWithResult(_0x238858,null))[_0x032c('0x40')](handleError(_0x238858,null));};exports[_0x032c('0x47')]=function(_0x3b32cd,_0x2a7a80){return db[_0x032c('0x28')][_0x032c('0x46')]({'where':{'id':_0x3b32cd[_0x032c('0x42')]['id']}})[_0x032c('0x22')](handleEntityNotFound(_0x2a7a80,null))[_0x032c('0x22')](removeEntity(_0x2a7a80,null))[_0x032c('0x40')](handleError(_0x2a7a80,null));};exports[_0x032c('0x48')]=function(_0x49735a,_0x4179c9){return db['WhatsappTransferReport'][_0x032c('0x48')]()[_0x032c('0x22')](respondWithResult(_0x4179c9,null))[_0x032c('0x40')](handleError(_0x4179c9,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 21762d3..fde4011 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 _0xc3c0=['uniqueid','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x5f38db,_0x2dcbc2){var _0xaa7b96=function(_0x52682c){while(--_0x52682c){_0x5f38db['push'](_0x5f38db['shift']());}};_0xaa7b96(++_0x2dcbc2);}(_0xc3c0,0xde));var _0x0c3c=function(_0x4fdaa6,_0x41cd0e){_0x4fdaa6=_0x4fdaa6-0x0;var _0x47f8da=_0xc3c0[_0x4fdaa6];return _0x47f8da;};'use strict';var _=require('lodash');var util=require(_0x0c3c('0x0'));var logger=require('../../config/logger')(_0x0c3c('0x1'));var moment=require(_0x0c3c('0x2'));var BPromise=require(_0x0c3c('0x3'));var rp=require(_0x0c3c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c3c('0x5'));var config=require(_0x0c3c('0x6'));var attributes=require(_0x0c3c('0x7'));module[_0x0c3c('0x8')]=function(_0x30fd45,_0x1c6994){return _0x30fd45[_0x0c3c('0x9')](_0x0c3c('0xa'),attributes,{'tableName':_0x0c3c('0xb'),'paranoid':![],'indexes':[{'name':_0x0c3c('0xc'),'fields':[_0x0c3c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xde94=['../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x443f02,_0x291639){var _0x1f4f12=function(_0x55723d){while(--_0x55723d){_0x443f02['push'](_0x443f02['shift']());}};_0x1f4f12(++_0x291639);}(_0xde94,0x1c7));var _0x4de9=function(_0x32f9b9,_0x2ffa05){_0x32f9b9=_0x32f9b9-0x0;var _0x2c27d5=_0xde94[_0x32f9b9];return _0x2c27d5;};'use strict';var _=require(_0x4de9('0x0'));var util=require(_0x4de9('0x1'));var logger=require(_0x4de9('0x2'))(_0x4de9('0x3'));var moment=require(_0x4de9('0x4'));var BPromise=require(_0x4de9('0x5'));var rp=require(_0x4de9('0x6'));var fs=require('fs');var path=require(_0x4de9('0x7'));var rimraf=require(_0x4de9('0x8'));var config=require(_0x4de9('0x9'));var attributes=require(_0x4de9('0xa'));module[_0x4de9('0xb')]=function(_0x5bf7c3,_0xf191a4){return _0x5bf7c3[_0x4de9('0xc')](_0x4de9('0xd'),attributes,{'tableName':_0x4de9('0xe'),'paranoid':![],'indexes':[{'name':_0x4de9('0xf'),'fields':[_0x4de9('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index d03f72e..ab4ecec 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 _0xeb2a=['WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xeb2a,0x106));var _0xaeb2=function(_0x1ecc49,_0x1c12c0){_0x1ecc49=_0x1ecc49-0x0;var _0x2645e1=_0xeb2a[_0x1ecc49];return _0x2645e1;};'use strict';var _=require(_0xaeb2('0x0'));var util=require(_0xaeb2('0x1'));var moment=require(_0xaeb2('0x2'));var BPromise=require(_0xaeb2('0x3'));var rs=require(_0xaeb2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaeb2('0x5'))['db'];var utils=require(_0xaeb2('0x6'));var logger=require(_0xaeb2('0x7'))('rpc');var config=require(_0xaeb2('0x8'));var jayson=require(_0xaeb2('0x9'));var client=jayson[_0xaeb2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x475219,_0x22cc93,_0x25b932){return new BPromise(function(_0x597392,_0x28d6dd){return client[_0xaeb2('0xb')](_0x475219,_0x25b932)[_0xaeb2('0xc')](function(_0xd26c4a){logger[_0xaeb2('0xd')](_0xaeb2('0xe'),_0x22cc93,_0xaeb2('0xf'));logger[_0xaeb2('0x10')](_0xaeb2('0x11'),_0x22cc93,_0xaeb2('0xf'),JSON['stringify'](_0xd26c4a));if(_0xd26c4a[_0xaeb2('0x12')]){if(_0xd26c4a['error'][_0xaeb2('0x13')]===0x1f4){logger[_0xaeb2('0x12')](_0xaeb2('0xe'),_0x22cc93,_0xd26c4a[_0xaeb2('0x12')][_0xaeb2('0x14')]);return _0x28d6dd(_0xd26c4a[_0xaeb2('0x12')]['message']);}logger[_0xaeb2('0x12')](_0xaeb2('0xe'),_0x22cc93,_0xd26c4a[_0xaeb2('0x12')][_0xaeb2('0x14')]);return _0x597392(_0xd26c4a[_0xaeb2('0x12')][_0xaeb2('0x14')]);}else{logger[_0xaeb2('0xd')](_0xaeb2('0xe'),_0x22cc93,_0xaeb2('0xf'));_0x597392(_0xd26c4a[_0xaeb2('0x15')]['message']);}})[_0xaeb2('0x16')](function(_0x5ca132){logger['error'](_0xaeb2('0xe'),_0x22cc93,_0x5ca132);_0x28d6dd(_0x5ca132);});});} \ No newline at end of file +var _0xeb63=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x52b7b9,_0x43ed4b){var _0x5b5d30=function(_0x4a5b9c){while(--_0x4a5b9c){_0x52b7b9['push'](_0x52b7b9['shift']());}};_0x5b5d30(++_0x43ed4b);}(_0xeb63,0x77));var _0x3eb6=function(_0x290781,_0x53d542){_0x290781=_0x290781-0x0;var _0x1ef41f=_0xeb63[_0x290781];return _0x1ef41f;};'use strict';var _=require(_0x3eb6('0x0'));var util=require(_0x3eb6('0x1'));var moment=require(_0x3eb6('0x2'));var BPromise=require(_0x3eb6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3eb6('0x4'));var db=require(_0x3eb6('0x5'))['db'];var utils=require(_0x3eb6('0x6'));var logger=require('../../config/logger')(_0x3eb6('0x7'));var config=require(_0x3eb6('0x8'));var jayson=require(_0x3eb6('0x9'));var client=jayson[_0x3eb6('0xa')][_0x3eb6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49b46e,_0x4347e3,_0x3c89ed){return new BPromise(function(_0xd32b81,_0x33c4fe){return client[_0x3eb6('0xc')](_0x49b46e,_0x3c89ed)[_0x3eb6('0xd')](function(_0x49dff2){logger['info'](_0x3eb6('0xe'),_0x4347e3,_0x3eb6('0xf'));logger['debug'](_0x3eb6('0x10'),_0x4347e3,_0x3eb6('0xf'),JSON[_0x3eb6('0x11')](_0x49dff2));if(_0x49dff2[_0x3eb6('0x12')]){if(_0x49dff2[_0x3eb6('0x12')][_0x3eb6('0x13')]===0x1f4){logger[_0x3eb6('0x12')](_0x3eb6('0xe'),_0x4347e3,_0x49dff2[_0x3eb6('0x12')][_0x3eb6('0x14')]);return _0x33c4fe(_0x49dff2[_0x3eb6('0x12')][_0x3eb6('0x14')]);}logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x4347e3,_0x49dff2[_0x3eb6('0x12')][_0x3eb6('0x14')]);return _0xd32b81(_0x49dff2[_0x3eb6('0x12')][_0x3eb6('0x14')]);}else{logger[_0x3eb6('0x15')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4347e3,_0x3eb6('0xf'));_0xd32b81(_0x49dff2[_0x3eb6('0x16')][_0x3eb6('0x14')]);}})[_0x3eb6('0x17')](function(_0x547943){logger[_0x3eb6('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4347e3,_0x547943);_0x33c4fe(_0x547943);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 523644e..d75add9 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf8dd=['map','online','join','name','None','seedDB','./config/seedDB','./config/license','default','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sequelize','sync','then','listen','info','start','Online\x20apps:'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xf8dd,0x1e8));var _0xdf8d=function(_0x184294,_0x23319b){_0x184294=_0x184294-0x0;var _0x347029=_0xf8dd[_0x184294];return _0x347029;};'use strict';var _=require(_0xdf8d('0x0'));var mysqldb=require(_0xdf8d('0x1'));var rpc=require('./rpc');var config=require('./config/environment');var logger=require(_0xdf8d('0x2'))(_0xdf8d('0x3'));var pm2=require(_0xdf8d('0x4'));var pm2Config=require(_0xdf8d('0x5'));var schedule=require(_0xdf8d('0x6'));var chat=require(_0xdf8d('0x7'));var whatsapp=require(_0xdf8d('0x8'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0xdf8d('0x9')][_0xdf8d('0xa')]()[_0xdf8d('0xb')](function(){return rpc[_0xdf8d('0xc')]();})['then'](function(_0x29f243){logger[_0xdf8d('0xd')](_0x29f243);return chat[_0xdf8d('0xe')]();})[_0xdf8d('0xb')](function(){return whatsapp['start']();})[_0xdf8d('0xb')](function(){return schedule['start']();})[_0xdf8d('0xb')](function(){return transcribe['start']();})[_0xdf8d('0xb')](function(_0x1e3623){logger[_0xdf8d('0xd')](_0x1e3623);return pm2[_0xdf8d('0xe')](pm2Config);})[_0xdf8d('0xb')](function(_0x56c44e){logger[_0xdf8d('0xd')](_0xdf8d('0xf'),_[_0xdf8d('0x10')](_['filter'](_0x56c44e,{'status':_0xdf8d('0x11')}),'name')[_0xdf8d('0x12')]());logger[_0xdf8d('0xd')]('Offline\x20apps:',_[_0xdf8d('0x10')](_['filter'](_0x56c44e,function(_0x6bdf05){return _0x6bdf05['status']!==_0xdf8d('0x11');}),_0xdf8d('0x13'))[_0xdf8d('0x12')]()||_0xdf8d('0x14'));config[_0xdf8d('0x15')]&&require(_0xdf8d('0x16'))['default']();require(_0xdf8d('0x17'))[_0xdf8d('0x18')]();})[_0xdf8d('0x19')](function(_0x148114){logger['error'](_0xdf8d('0x1a'),_0x148114);process[_0xdf8d('0x1b')](0x1);});}main(); \ No newline at end of file +var _0xf7c2=['./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','then','listen','info','start','Online\x20apps:','map','filter','online','name','Offline\x20apps:','status','join','None','seedDB','./config/seedDB','default','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./rpc'];(function(_0x4d5210,_0x107a5d){var _0xaf46d6=function(_0x5a7ea1){while(--_0x5a7ea1){_0x4d5210['push'](_0x4d5210['shift']());}};_0xaf46d6(++_0x107a5d);}(_0xf7c2,0xee));var _0x2f7c=function(_0x375d74,_0x192737){_0x375d74=_0x375d74-0x0;var _0xee960b=_0xf7c2[_0x375d74];return _0xee960b;};'use strict';var _=require('lodash');var mysqldb=require(_0x2f7c('0x0'));var rpc=require(_0x2f7c('0x1'));var config=require(_0x2f7c('0x2'));var logger=require(_0x2f7c('0x3'))(_0x2f7c('0x4'));var pm2=require('./config/pm2');var pm2Config=require(_0x2f7c('0x5'));var schedule=require(_0x2f7c('0x6'));var chat=require(_0x2f7c('0x7'));var whatsapp=require(_0x2f7c('0x8'));var transcribe=require(_0x2f7c('0x9'));function main(){return mysqldb['db']['sequelize']['sync']()[_0x2f7c('0xa')](function(){return rpc[_0x2f7c('0xb')]();})[_0x2f7c('0xa')](function(_0x13c279){logger[_0x2f7c('0xc')](_0x13c279);return chat[_0x2f7c('0xd')]();})['then'](function(){return whatsapp[_0x2f7c('0xd')]();})[_0x2f7c('0xa')](function(){return schedule[_0x2f7c('0xd')]();})['then'](function(){return transcribe[_0x2f7c('0xd')]();})[_0x2f7c('0xa')](function(_0x1dd16f){logger[_0x2f7c('0xc')](_0x1dd16f);return pm2[_0x2f7c('0xd')](pm2Config);})[_0x2f7c('0xa')](function(_0x73e221){logger['info'](_0x2f7c('0xe'),_[_0x2f7c('0xf')](_[_0x2f7c('0x10')](_0x73e221,{'status':_0x2f7c('0x11')}),_0x2f7c('0x12'))['join']());logger[_0x2f7c('0xc')](_0x2f7c('0x13'),_[_0x2f7c('0xf')](_[_0x2f7c('0x10')](_0x73e221,function(_0x5bb17d){return _0x5bb17d[_0x2f7c('0x14')]!==_0x2f7c('0x11');}),_0x2f7c('0x12'))[_0x2f7c('0x15')]()||_0x2f7c('0x16'));config[_0x2f7c('0x17')]&&require(_0x2f7c('0x18'))[_0x2f7c('0x19')]();require('./config/license')[_0x2f7c('0x19')]();})[_0x2f7c('0x1a')](function(_0x523acd){logger[_0x2f7c('0x1b')](_0x2f7c('0x1c'),_0x523acd);process[_0x2f7c('0x1d')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 0275e8f..3fe450e 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 _0xe5ca=['options','promisify','verify','randomBytes','toString','hex','now','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','basic-auth','crypto','util','moment','secrets','session','name','internal','email','userpic','permissions','chatPause','mailPause','openchannelPause','showWebBar','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','interface','userProfileId','settingsEnabled','downloadVoiceRecordings','ignorePauseForPreviewCalls','isChatInteractionAuthorized','use','user','findOne','params','closed','then','disposition','unmanaged','json','Unmanaged.','Forbidden.','catch','authorization','startsWith','headers','User','find','authenticate','pass','Wrong\x20credentials.','Bearer','status','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','test','Sequelize','validatePasswordHistory','decryptString','toLowerCase','format','ValidationError','updatePasswordsHistory','split','length','splice','unshift','join','sign','secret','payload'];(function(_0x423280,_0x4fddfd){var _0xff8c89=function(_0x14dbab){while(--_0x14dbab){_0x423280['push'](_0x423280['shift']());}};_0xff8c89(++_0x4fddfd);}(_0xe5ca,0x7d));var _0xae5c=function(_0x543c51,_0xff0084){_0x543c51=_0x543c51-0x0;var _0x360555=_0xe5ca[_0x543c51];return _0x360555;};'use strict';var db=require(_0xae5c('0x0'))['db'];var config=require(_0xae5c('0x1'));var hardwareConf=require(_0xae5c('0x2'));var licenseUtil=require(_0xae5c('0x3'));var encryptor=require(_0xae5c('0x4'));var _=require(_0xae5c('0x5'));var jwt=require(_0xae5c('0x6'));var expressJwt=require(_0xae5c('0x7'));var compose=require('composable-middleware');var basicAuth=require(_0xae5c('0x8'));var crypto=require(_0xae5c('0x9'));var BPromise=require('bluebird');var util=require(_0xae5c('0xa'));var moment=require(_0xae5c('0xb'));var validateJwt=expressJwt({'secret':config[_0xae5c('0xc')][_0xae5c('0xd')]});var userAttributes=['id','role','fullname',_0xae5c('0xe'),_0xae5c('0xf'),_0xae5c('0x10'),_0xae5c('0x11'),_0xae5c('0x12'),'md5secret','voicePause',_0xae5c('0x13'),_0xae5c('0x14'),'faxPause','smsPause',_0xae5c('0x15'),'pauseType',_0xae5c('0x16'),'lastLoginAt','lastPauseAt',_0xae5c('0x17'),_0xae5c('0x18'),_0xae5c('0x19'),_0xae5c('0x1a'),_0xae5c('0x1b'),'phoneBarAutoAnswerDelay',_0xae5c('0x1c'),'phoneBarEnableRecording',_0xae5c('0x1d'),_0xae5c('0x1e'),_0xae5c('0x1f'),'phoneBarPrefixRequired',_0xae5c('0x20'),'phoneBarRemoteControlPort','hotdesk',_0xae5c('0x21'),_0xae5c('0x22'),'privacyEnabled',_0xae5c('0x23'),'wssPort',_0xae5c('0x24'),'downloadOmnichannelInteractions','downloadAttachments',_0xae5c('0x25'),'selectRecallMeCampaign'];exports[_0xae5c('0x26')]=function(){return this['isAuthenticated'](!![])[_0xae5c('0x27')](function(_0x54e87f,_0x1b77fe,_0x77d5b6){if(_0x54e87f[_0xae5c('0x28')]){_0x77d5b6();}else{return db['ChatInteraction'][_0xae5c('0x29')]({'where':{'id':_0x54e87f[_0xae5c('0x2a')]['id']},'attributes':['id',_0xae5c('0x2b'),'disposition'],'raw':!![]})[_0xae5c('0x2c')](function(_0x421ea3){if(_0x421ea3&&_0x421ea3['closed']){return _0x1b77fe['status'](_0x421ea3[_0xae5c('0x2d')]===_0xae5c('0x2e')?0x195:0x193)[_0xae5c('0x2f')]({'message':_0x421ea3[_0xae5c('0x2d')]==='unmanaged'?_0xae5c('0x30'):_0xae5c('0x31')});}else{_0x77d5b6();}})[_0xae5c('0x32')](function(_0x5ec7ed){_0x77d5b6(_0x5ec7ed);});}});};exports['isAuthenticated']=function isAuthenticated(_0x2d10ad){return compose()[_0xae5c('0x27')](function(_0x3fd9d8,_0x1523c7,_0x4e27dd){var _0x3c6a4d;if(_0x3fd9d8['headers'][_0xae5c('0x33')]){if(_[_0xae5c('0x34')](_0x3fd9d8[_0xae5c('0x35')][_0xae5c('0x33')],'Basic')){var _0x23e394=basicAuth(_0x3fd9d8);db[_0xae5c('0x36')][_0xae5c('0x37')]({'where':{'name':_0x23e394[_0xae5c('0xe')]}})[_0xae5c('0x2c')](function(_0x13196f){if(!_0x13196f||!_0x13196f[_0xae5c('0x38')](_0x23e394[_0xae5c('0x39')])){return _0x1523c7['status'](0x191)[_0xae5c('0x2f')]({'message':_0xae5c('0x3a')});}_0x3fd9d8[_0xae5c('0x28')]={'id':_0x13196f['id']};_0x4e27dd();})[_0xae5c('0x32')](function(_0x374c20){_0x4e27dd(_0x374c20);});}else if(_['startsWith'](_0x3fd9d8['headers'][_0xae5c('0x33')],_0xae5c('0x3b'))){validateJwt(_0x3fd9d8,_0x1523c7,_0x4e27dd);}else{if(_0x2d10ad){_0x4e27dd();}else{return _0x1523c7[_0xae5c('0x3c')](0x193)[_0xae5c('0x2f')]({'message':_0xae5c('0x3d')});}}}else if(_0x3fd9d8[_0xae5c('0x3e')][_0xae5c('0x3f')]){try{var _0x14dd44={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xae5c('0x40')]()};verifyJwt(_0x3fd9d8['query']['apikey'],_0x14dd44)[_0xae5c('0x2c')](function(_0x349a48){return db[_0xae5c('0x36')][_0xae5c('0x37')]({'where':{'id':_0x349a48[_0xae5c('0x41')]}})[_0xae5c('0x2c')](function(_0x788dd6){_0x3c6a4d=_0x788dd6;return db['Setting'][_0xae5c('0x29')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})[_0xae5c('0x2c')](function(_0x173d78){if(!_0x3c6a4d||!_['isEqual'](_0x3c6a4d[_0xae5c('0x42')],_0x349a48[_0xae5c('0x43')])){return _0x1523c7[_0xae5c('0x3c')](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x3c6a4d[_0xae5c('0x44')]){return _0x1523c7['status'](0x191)['json']({'message':_0xae5c('0x45')});}if(_0x3c6a4d[_0xae5c('0x46')]){if(_0x173d78[_0xae5c('0x47')]>0x0){if(moment(_0x3c6a4d[_0xae5c('0x48')])[_0xae5c('0x49')](_0x173d78[_0xae5c('0x47')],_0xae5c('0x4a'))>moment()){return _0x1523c7[_0xae5c('0x3c')](0x191)[_0xae5c('0x2f')]({'message':_0xae5c('0x45')});}}else{return _0x1523c7[_0xae5c('0x3c')](0x191)[_0xae5c('0x2f')]({'message':_0xae5c('0x45')});}}_0x3fd9d8[_0xae5c('0x28')]={'id':_0x3c6a4d['id']};_0x4e27dd();});})[_0xae5c('0x32')](function(){return _0x1523c7[_0xae5c('0x3c')](0x191)[_0xae5c('0x2f')]({'message':_0xae5c('0x45')});});}catch(_0x498109){_0x4e27dd(_0x498109);}}else if(_0x2d10ad){_0x4e27dd();}else{return _0x1523c7[_0xae5c('0x3c')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})['use'](function(_0x4803a6,_0x1d861d,_0xb1c062){if(_0x4803a6[_0xae5c('0x28')]){db[_0xae5c('0x36')][_0xae5c('0x37')]({'where':{'id':_0x4803a6[_0xae5c('0x28')]['id']},'attributes':userAttributes})[_0xae5c('0x2c')](function(_0x188181){if(!_0x188181){return _0x1d861d[_0xae5c('0x3c')](0x194)['json']({'message':_0xae5c('0x4b')});}_0x4803a6[_0xae5c('0x28')]=_0x188181;_0xb1c062();})['catch'](function(_0x27828c){_0xb1c062(_0x27828c);});}else if(_0x2d10ad){_0xb1c062();}else{return _0x1d861d[_0xae5c('0x3c')](0x194)[_0xae5c('0x2f')]({'message':_0xae5c('0x4c')});}});};exports[_0xae5c('0x4d')]=function canUpdate(){return compose()[_0xae5c('0x27')](function(_0x4c26ad,_0x2243ef,_0x2c6fbb){return licenseUtil[_0xae5c('0x4e')]()[_0xae5c('0x2c')](function(_0x1a025e){if(_0x1a025e[_0xae5c('0x4f')]){_0x2c6fbb();}else{return _0x2243ef[_0xae5c('0x3c')](0x193)[_0xae5c('0x2f')]({'message':'Forbidden'});}})['catch'](function(_0x3db221){_0x2c6fbb(_0x3db221);});});};exports[_0xae5c('0x50')]=function isWebrtcLicence(){return compose()[_0xae5c('0x27')](function(_0x2d9c53,_0x8cb1bd,_0x4b6c44){return licenseUtil[_0xae5c('0x4e')]()[_0xae5c('0x2c')](function(_0x4d8acf){if(_0x4d8acf[_0xae5c('0x51')]){_0x4b6c44();}else{return _0x8cb1bd['status'](0x193)[_0xae5c('0x2f')]({'message':'Forbidden'});}})[_0xae5c('0x32')](function(_0x1eab80){_0x4b6c44(_0x1eab80);});});};exports['isMiddleware']=function(_0x19d41,_0x48892d,_0x44ea44){_0x19d41[_0xae5c('0x52')]=!![];return _0x44ea44();};exports[_0xae5c('0x53')]=function signToken(_0x1026ea){return signJwt(_0x1026ea);};exports[_0xae5c('0x54')]=function(_0x2c50b7,_0xd4ef3e){if(!_0x2c50b7[_0xae5c('0x28')]){return _0xd4ef3e[_0xae5c('0x3c')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x161d95={'payload':{'id':_0x2c50b7['user']['id'],'role':_0x2c50b7['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x161d95)[_0xae5c('0x2c')](function(_0x583d26){_0xd4ef3e[_0xae5c('0x55')](_0xae5c('0x56'),_0x583d26);_0xd4ef3e[_0xae5c('0x57')](_0xae5c('0x58'));})[_0xae5c('0x32')](function(_0x4d6a06){return _0xd4ef3e['status'](0x1f4)[_0xae5c('0x59')](_0x4d6a06);});};exports[_0xae5c('0x5a')]=function(_0x136dc1){if(_[_0xae5c('0x5b')](_0x136dc1[_0xae5c('0x42')])||_['isNil'](_0x136dc1['apiKeyIat'])){return null;}else{return createJwt(_0x136dc1);}};exports[_0xae5c('0x5c')]=function(_0x4d6ba0){_0x4d6ba0[_0xae5c('0x42')]=generateNonce();_0x4d6ba0[_0xae5c('0x5d')]=generateIssuedAt();return createJwt(_0x4d6ba0);};exports[_0xae5c('0x5e')]=function(_0x6bfd18,_0x45437e){var _0x148dc4=_0x6bfd18[_0xae5c('0x3e')][_0xae5c('0x3f')];if(_0x148dc4){var _0x4bf8c0={'nonce':_0x45437e[_0xae5c('0x42')],'iat':_0x45437e['apiKeyIat'],'audience':hardwareConf[_0xae5c('0x40')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x148dc4,_0x4bf8c0)['then'](function(){return generateApiKey(_0x45437e);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0x339e4c){var _0xaddcb3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xaddcb3[_0xae5c('0x5f')](_0x339e4c))throw new db[(_0xae5c('0x60'))]['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~!@#$%^&-_=+[{]}.');return;};exports[_0xae5c('0x61')]=function(_0x5c11ab,_0x150d79,_0xb1bf63){var _0x5eaab5=encryptor[_0xae5c('0x62')](_0x150d79)['split'](',');for(var _0x56aaaa=0x0;_0x56aaaa<_0xb1bf63;_0x56aaaa++){if(!_0x5eaab5[_0x56aaaa])break;if(_0x5c11ab[_0xae5c('0x63')]()===_0x5eaab5[_0x56aaaa][_0xae5c('0x63')]()){var _0x51bbdf=util[_0xae5c('0x64')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0xb1bf63);if(_0xb1bf63===0x1){_0x51bbdf='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xae5c('0x60'))][(_0xae5c('0x65'))](_0x51bbdf);}}return;};exports[_0xae5c('0x66')]=function(_0xc4ff6d,_0x44b514){var _0x38997f=_0x44b514?encryptor[_0xae5c('0x62')](_0x44b514)[_0xae5c('0x67')](','):[];if(_0x38997f[_0xae5c('0x68')]===0x5){_0x38997f[_0xae5c('0x69')](-0x1,0x1);}_0x38997f[_0xae5c('0x6a')](_0xc4ff6d);return encryptor['encryptString'](_0x38997f[_0xae5c('0x6b')](','));};function signJwt(_0x579ecd){var _0x5aef70=BPromise['promisify'](jwt[_0xae5c('0x6c')],{'context':jwt});var _0x454142=_0x579ecd[_0xae5c('0x6d')]||config[_0xae5c('0xc')]['session'];return new BPromise(function(_0x51fa48,_0x30ca68){_0x5aef70(_0x579ecd[_0xae5c('0x6e')],_0x454142,_0x579ecd[_0xae5c('0x6f')])[_0xae5c('0x2c')](function(_0x2676f4){_0x51fa48(_0x2676f4);})['catch'](function(_0x1ce7b0){_0x30ca68(_0x1ce7b0);});});}function verifyJwt(_0x46d20f,_0x3c580d,_0x4688df){var _0x50039d=BPromise[_0xae5c('0x70')](jwt[_0xae5c('0x71')],{'context':jwt});var _0x78daa=_0x4688df||config[_0xae5c('0xc')][_0xae5c('0xd')];return new BPromise(function(_0x3587aa,_0x1f36e9){_0x50039d(_0x46d20f,_0x78daa,_0x3c580d)[_0xae5c('0x2c')](function(_0x2785ca){_0x3587aa(_0x2785ca);})[_0xae5c('0x32')](function(_0x3ed43c){_0x1f36e9(_0x3ed43c);});});}function generateNonce(){return crypto[_0xae5c('0x72')](0x10)[_0xae5c('0x73')](_0xae5c('0x74'));}function generateIssuedAt(){return Math['floor'](Date[_0xae5c('0x75')]()/0x3e8)[_0xae5c('0x73')]();}function createJwt(_0x3bed8a){var _0x495bd2={'payload':{'iat':_0x3bed8a['apiKeyIat'],'nonce':_0x3bed8a[_0xae5c('0x42')]},'options':{'algorithm':'HS512','subject':_0x3bed8a['id'][_0xae5c('0x73')](),'issuer':hardwareConf[_0xae5c('0x40')](),'audience':hardwareConf[_0xae5c('0x40')]()}};return signJwt(_0x495bd2)[_0xae5c('0x2c')](function(_0x5f56df){return{'iat':_0x3bed8a[_0xae5c('0x5d')],'nonce':_0x3bed8a['apiKeyNonce'],'token':_0x5f56df};});} \ No newline at end of file +var _0x62f4=['secrets','payload','verify','randomBytes','hex','floor','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','moment','session','role','fullname','name','internal','email','permissions','chatPause','mailPause','faxPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','isChatInteractionAuthorized','isAuthenticated','user','params','closed','disposition','then','status','unmanaged','json','Forbidden.','use','headers','authorization','Basic','find','pass','Wrong\x20credentials.','catch','startsWith','getUuid','query','apikey','sub','Setting','findOne','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','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.','length','unshift','join','promisify','sign','secret'];(function(_0x41ed33,_0x38ddff){var _0x444b=function(_0x46b441){while(--_0x46b441){_0x41ed33['push'](_0x41ed33['shift']());}};_0x444b(++_0x38ddff);}(_0x62f4,0x109));var _0x462f=function(_0x4d0f2d,_0x875cd8){_0x4d0f2d=_0x4d0f2d-0x0;var _0x28a4a6=_0x62f4[_0x4d0f2d];return _0x28a4a6;};'use strict';var db=require(_0x462f('0x0'))['db'];var config=require(_0x462f('0x1'));var hardwareConf=require(_0x462f('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0x462f('0x3'));var jwt=require(_0x462f('0x4'));var expressJwt=require('express-jwt');var compose=require(_0x462f('0x5'));var basicAuth=require(_0x462f('0x6'));var crypto=require(_0x462f('0x7'));var BPromise=require(_0x462f('0x8'));var util=require('util');var moment=require(_0x462f('0x9'));var validateJwt=expressJwt({'secret':config['secrets'][_0x462f('0xa')]});var userAttributes=['id',_0x462f('0xb'),_0x462f('0xc'),_0x462f('0xd'),_0x462f('0xe'),_0x462f('0xf'),'userpic',_0x462f('0x10'),'md5secret','voicePause',_0x462f('0x11'),_0x462f('0x12'),_0x462f('0x13'),'smsPause',_0x462f('0x14'),_0x462f('0x15'),'showWebBar',_0x462f('0x16'),_0x462f('0x17'),_0x462f('0x18'),_0x462f('0x19'),_0x462f('0x1a'),_0x462f('0x1b'),_0x462f('0x1c'),_0x462f('0x1d'),'phoneBarDnd','phoneBarEnableRecording',_0x462f('0x1e'),_0x462f('0x1f'),_0x462f('0x20'),_0x462f('0x21'),_0x462f('0x22'),_0x462f('0x23'),_0x462f('0x24'),_0x462f('0x25'),_0x462f('0x26'),_0x462f('0x27'),'settingsEnabled',_0x462f('0x28'),_0x462f('0x29'),_0x462f('0x2a'),_0x462f('0x2b'),_0x462f('0x2c'),_0x462f('0x2d')];exports[_0x462f('0x2e')]=function(){return this[_0x462f('0x2f')](!![])['use'](function(_0x219bc1,_0x3ba99c,_0x300328){if(_0x219bc1[_0x462f('0x30')]){_0x300328();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x219bc1[_0x462f('0x31')]['id']},'attributes':['id',_0x462f('0x32'),_0x462f('0x33')],'raw':!![]})[_0x462f('0x34')](function(_0x4fa356){if(_0x4fa356&&_0x4fa356[_0x462f('0x32')]){return _0x3ba99c[_0x462f('0x35')](_0x4fa356[_0x462f('0x33')]===_0x462f('0x36')?0x195:0x193)[_0x462f('0x37')]({'message':_0x4fa356[_0x462f('0x33')]===_0x462f('0x36')?'Unmanaged.':_0x462f('0x38')});}else{_0x300328();}})['catch'](function(_0x1bde5d){_0x300328(_0x1bde5d);});}});};exports[_0x462f('0x2f')]=function isAuthenticated(_0x550129){return compose()[_0x462f('0x39')](function(_0x982473,_0x475635,_0x4c6016){var _0x1b7d6d;if(_0x982473[_0x462f('0x3a')]['authorization']){if(_['startsWith'](_0x982473[_0x462f('0x3a')][_0x462f('0x3b')],_0x462f('0x3c'))){var _0x4c2f1d=basicAuth(_0x982473);db['User'][_0x462f('0x3d')]({'where':{'name':_0x4c2f1d[_0x462f('0xd')]}})[_0x462f('0x34')](function(_0x4c7208){if(!_0x4c7208||!_0x4c7208['authenticate'](_0x4c2f1d[_0x462f('0x3e')])){return _0x475635[_0x462f('0x35')](0x191)[_0x462f('0x37')]({'message':_0x462f('0x3f')});}_0x982473[_0x462f('0x30')]={'id':_0x4c7208['id']};_0x4c6016();})[_0x462f('0x40')](function(_0x1584db){_0x4c6016(_0x1584db);});}else if(_[_0x462f('0x41')](_0x982473[_0x462f('0x3a')][_0x462f('0x3b')],'Bearer')){validateJwt(_0x982473,_0x475635,_0x4c6016);}else{if(_0x550129){_0x4c6016();}else{return _0x475635[_0x462f('0x35')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x982473['query']['apikey']){try{var _0x1e0426={'audience':hardwareConf[_0x462f('0x42')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x982473[_0x462f('0x43')][_0x462f('0x44')],_0x1e0426)[_0x462f('0x34')](function(_0x51937d){return db['User'][_0x462f('0x3d')]({'where':{'id':_0x51937d[_0x462f('0x45')]}})[_0x462f('0x34')](function(_0x12b4ac){_0x1b7d6d=_0x12b4ac;return db[_0x462f('0x46')][_0x462f('0x47')]({'where':{'id':0x1},'attributes':[_0x462f('0x48'),_0x462f('0x49')],'raw':!![]});})['then'](function(_0x1b74d8){if(!_0x1b7d6d||!_[_0x462f('0x4a')](_0x1b7d6d[_0x462f('0x4b')],_0x51937d[_0x462f('0x4c')])){return _0x475635[_0x462f('0x35')](0x191)[_0x462f('0x37')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x1b7d6d['disabled']){return _0x475635[_0x462f('0x35')](0x191)['json']({'message':_0x462f('0x4d')});}if(_0x1b7d6d[_0x462f('0x4e')]){if(_0x1b74d8[_0x462f('0x49')]>0x0){if(moment(_0x1b7d6d[_0x462f('0x4f')])['add'](_0x1b74d8[_0x462f('0x49')],_0x462f('0x50'))>moment()){return _0x475635[_0x462f('0x35')](0x191)[_0x462f('0x37')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x475635['status'](0x191)[_0x462f('0x37')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x982473[_0x462f('0x30')]={'id':_0x1b7d6d['id']};_0x4c6016();});})[_0x462f('0x40')](function(){return _0x475635[_0x462f('0x35')](0x191)['json']({'message':_0x462f('0x4d')});});}catch(_0x4a97c7){_0x4c6016(_0x4a97c7);}}else if(_0x550129){_0x4c6016();}else{return _0x475635[_0x462f('0x35')](0x193)[_0x462f('0x37')]({'message':_0x462f('0x51')});}})[_0x462f('0x39')](function(_0x467033,_0x2e359c,_0x4b3d0f){if(_0x467033[_0x462f('0x30')]){db['User'][_0x462f('0x3d')]({'where':{'id':_0x467033['user']['id']},'attributes':userAttributes})[_0x462f('0x34')](function(_0x29b3cc){if(!_0x29b3cc){return _0x2e359c[_0x462f('0x35')](0x194)[_0x462f('0x37')]({'message':_0x462f('0x52')});}_0x467033[_0x462f('0x30')]=_0x29b3cc;_0x4b3d0f();})[_0x462f('0x40')](function(_0xd01682){_0x4b3d0f(_0xd01682);});}else if(_0x550129){_0x4b3d0f();}else{return _0x2e359c[_0x462f('0x35')](0x194)[_0x462f('0x37')]({'message':_0x462f('0x53')});}});};exports[_0x462f('0x54')]=function canUpdate(){return compose()[_0x462f('0x39')](function(_0x517bb1,_0x1bf4a9,_0x1e5908){return licenseUtil[_0x462f('0x55')]()[_0x462f('0x34')](function(_0x5af67c){if(_0x5af67c[_0x462f('0x56')]){_0x1e5908();}else{return _0x1bf4a9[_0x462f('0x35')](0x193)['json']({'message':_0x462f('0x57')});}})[_0x462f('0x40')](function(_0x2b07f1){_0x1e5908(_0x2b07f1);});});};exports[_0x462f('0x58')]=function isWebrtcLicence(){return compose()[_0x462f('0x39')](function(_0x6927fc,_0x43f9cd,_0xb5adf){return licenseUtil[_0x462f('0x55')]()[_0x462f('0x34')](function(_0x8902f4){if(_0x8902f4[_0x462f('0x59')]){_0xb5adf();}else{return _0x43f9cd['status'](0x193)['json']({'message':_0x462f('0x57')});}})[_0x462f('0x40')](function(_0x4edac2){_0xb5adf(_0x4edac2);});});};exports[_0x462f('0x5a')]=function(_0x3983bd,_0x178932,_0x128532){_0x3983bd[_0x462f('0x5a')]=!![];return _0x128532();};exports['signToken']=function signToken(_0x491a14){return signJwt(_0x491a14);};exports['setTokenCookie']=function(_0x3378c4,_0x275c29){if(!_0x3378c4[_0x462f('0x30')]){return _0x275c29[_0x462f('0x35')](0x194)[_0x462f('0x37')]({'message':_0x462f('0x5b')});}var _0x2cb698={'payload':{'id':_0x3378c4[_0x462f('0x30')]['id'],'role':_0x3378c4[_0x462f('0x30')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x2cb698)[_0x462f('0x34')](function(_0x6359d7){_0x275c29[_0x462f('0x5c')]('motion.token',_0x6359d7);_0x275c29[_0x462f('0x5d')](_0x462f('0x5e'));})[_0x462f('0x40')](function(_0x3a9c94){return _0x275c29[_0x462f('0x35')](0x1f4)[_0x462f('0x5f')](_0x3a9c94);});};exports[_0x462f('0x60')]=function(_0x254b1a){if(_[_0x462f('0x61')](_0x254b1a[_0x462f('0x4b')])||_['isNil'](_0x254b1a[_0x462f('0x62')])){return null;}else{return createJwt(_0x254b1a);}};exports[_0x462f('0x63')]=function(_0x10aa6a){_0x10aa6a['apiKeyNonce']=generateNonce();_0x10aa6a['apiKeyIat']=generateIssuedAt();return createJwt(_0x10aa6a);};exports[_0x462f('0x64')]=function(_0x171c4d,_0x3e563e){var _0x113e47=_0x171c4d[_0x462f('0x43')][_0x462f('0x44')];if(_0x113e47){var _0xcbf696={'nonce':_0x3e563e['apiKeyNonce'],'iat':_0x3e563e[_0x462f('0x62')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x462f('0x42')]()};return verifyJwt(_0x113e47,_0xcbf696)[_0x462f('0x34')](function(){return generateApiKey(_0x3e563e);});}else{throw{'message':_0x462f('0x65')};}};exports[_0x462f('0x66')]=function(_0x4e4530){var _0x2dd7c0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2dd7c0['test'](_0x4e4530))throw new db[(_0x462f('0x67'))][(_0x462f('0x68'))](_0x462f('0x69'));return;};exports[_0x462f('0x6a')]=function(_0x7045de,_0x2b2340,_0x286ea7){var _0x3fa740=encryptor[_0x462f('0x6b')](_0x2b2340)[_0x462f('0x6c')](',');for(var _0x1462c4=0x0;_0x1462c4<_0x286ea7;_0x1462c4++){if(!_0x3fa740[_0x1462c4])break;if(_0x7045de['toLowerCase']()===_0x3fa740[_0x1462c4][_0x462f('0x6d')]()){var _0x54e6c1=util[_0x462f('0x6e')](_0x462f('0x6f'),_0x286ea7);if(_0x286ea7===0x1){_0x54e6c1=_0x462f('0x70');}throw new db[(_0x462f('0x67'))]['ValidationError'](_0x54e6c1);}}return;};exports['updatePasswordsHistory']=function(_0x71f987,_0x52cf4e){var _0x1a5fbc=_0x52cf4e?encryptor[_0x462f('0x6b')](_0x52cf4e)[_0x462f('0x6c')](','):[];if(_0x1a5fbc[_0x462f('0x71')]===0x5){_0x1a5fbc['splice'](-0x1,0x1);}_0x1a5fbc[_0x462f('0x72')](_0x71f987);return encryptor['encryptString'](_0x1a5fbc[_0x462f('0x73')](','));};function signJwt(_0x22c6c8){var _0x240330=BPromise[_0x462f('0x74')](jwt[_0x462f('0x75')],{'context':jwt});var _0x2f9039=_0x22c6c8[_0x462f('0x76')]||config[_0x462f('0x77')][_0x462f('0xa')];return new BPromise(function(_0x5d0b8e,_0x15d274){_0x240330(_0x22c6c8[_0x462f('0x78')],_0x2f9039,_0x22c6c8['options'])[_0x462f('0x34')](function(_0x466ab8){_0x5d0b8e(_0x466ab8);})[_0x462f('0x40')](function(_0x2147fb){_0x15d274(_0x2147fb);});});}function verifyJwt(_0x32185c,_0x5db6c1,_0x2ea873){var _0x1b6658=BPromise[_0x462f('0x74')](jwt[_0x462f('0x79')],{'context':jwt});var _0x302b33=_0x2ea873||config[_0x462f('0x77')][_0x462f('0xa')];return new BPromise(function(_0x3c0ea2,_0x3c1370){_0x1b6658(_0x32185c,_0x302b33,_0x5db6c1)[_0x462f('0x34')](function(_0x2fee9b){_0x3c0ea2(_0x2fee9b);})[_0x462f('0x40')](function(_0x1c1c62){_0x3c1370(_0x1c1c62);});});}function generateNonce(){return crypto[_0x462f('0x7a')](0x10)['toString'](_0x462f('0x7b'));}function generateIssuedAt(){return Math[_0x462f('0x7c')](Date[_0x462f('0x7d')]()/0x3e8)[_0x462f('0x7e')]();}function createJwt(_0x5ae3c5){var _0xdab247={'payload':{'iat':_0x5ae3c5['apiKeyIat'],'nonce':_0x5ae3c5[_0x462f('0x4b')]},'options':{'algorithm':_0x462f('0x7f'),'subject':_0x5ae3c5['id'][_0x462f('0x7e')](),'issuer':hardwareConf[_0x462f('0x42')](),'audience':hardwareConf[_0x462f('0x42')]()}};return signJwt(_0xdab247)[_0x462f('0x34')](function(_0x342a2c){return{'iat':_0x5ae3c5[_0x462f('0x62')],'nonce':_0x5ae3c5[_0x462f('0x4b')],'token':_0x342a2c};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 461bd02..20ba13c 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 _0xc92b=['secrets','session','aes-256-ctr','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','binary','write','end','final','close','unlink','createDecipher','update','encryptString','secret','base64','utf8','crypto','bluebird','lodash','../../config/environment','../../config/logger'];(function(_0x301148,_0x25b884){var _0x42ce24=function(_0x44ba51){while(--_0x44ba51){_0x301148['push'](_0x301148['shift']());}};_0x42ce24(++_0x25b884);}(_0xc92b,0xaa));var _0xbc92=function(_0x211e89,_0x5c9c62){_0x211e89=_0x211e89-0x0;var _0x1d40aa=_0xc92b[_0x211e89];return _0x1d40aa;};'use strict';var crypto=require(_0xbc92('0x0'));var fs=require('fs');var BPromise=require(_0xbc92('0x1'));var _=require(_0xbc92('0x2'));var config=require(_0xbc92('0x3'));var logger=require(_0xbc92('0x4'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xbc92('0x5')][_0xbc92('0x6')],'algorithm':_0xbc92('0x7')};const fileOptions={'algorithm':'aes192'};if(config[_0xbc92('0x8')]&&config[_0xbc92('0x8')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xbc92('0x8')]['algorithm']);if(isSupported){fileOptions[_0xbc92('0x9')]=config[_0xbc92('0x8')][_0xbc92('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xbc92('0xa')](',\x20');logger[_0xbc92('0xb')](config[_0xbc92('0x8')][_0xbc92('0x9')],_0xbc92('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x54bce2){return AES_SUPPORTED_RX[_0xbc92('0xd')](_0x54bce2);}function getSupportedCiphers(){return crypto[_0xbc92('0xe')]()[_0xbc92('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x3ff17a){return getSupportedCiphers()[_0xbc92('0x10')](_0x3ff17a)>-0x1;}function combineOptions(_0x4f5a23){var _0x5cd41={};for(var _0x8e2b4 in fileOptions){if(fileOptions[_0xbc92('0x11')](_0x8e2b4)){_0x5cd41[_0x8e2b4]=fileOptions[_0x8e2b4];}}if(_0x4f5a23){for(var _0x599f3f in _0x4f5a23){if(_0x4f5a23[_0xbc92('0x11')](_0x599f3f)){_0x5cd41[_0x599f3f]=_0x4f5a23[_0x599f3f];}}}return _0x5cd41;}exports[_0xbc92('0x12')]=function(_0x3cdbf3,_0x3ee0ca,_0x327142,_0x1cf1cc){return new BPromise(function(_0x4624fb,_0x26e36b){_0x1cf1cc=combineOptions(_0x1cf1cc);var _0x293b39=new Buffer(_0x327142);var _0x355c9d=fs[_0xbc92('0x13')](_0x3cdbf3);var _0x1f7d8b=fs[_0xbc92('0x14')](_0x3ee0ca);var _0x3b7cde=crypto[_0xbc92('0x15')](_0x1cf1cc[_0xbc92('0x9')],_0x293b39);_0x355c9d['on'](_0xbc92('0x16'),function(_0x34aec5){var _0x1838fb=new Buffer(_0x3b7cde['update'](_0x34aec5),_0xbc92('0x17'));_0x1f7d8b[_0xbc92('0x18')](_0x1838fb);});_0x355c9d['on'](_0xbc92('0x19'),function(){try{var _0x2498cf=new Buffer(_0x3b7cde[_0xbc92('0x1a')](_0xbc92('0x17')),'binary');_0x1f7d8b[_0xbc92('0x18')](_0x2498cf);_0x1f7d8b[_0xbc92('0x19')]();_0x1f7d8b['on'](_0xbc92('0x1b'),function(){return _0x4624fb(_0x3ee0ca);});}catch(_0x502c1e){fs[_0xbc92('0x1c')](_0x3ee0ca);return _0x26e36b(_0x502c1e);}});});};exports['decryptFile']=function(_0x5a7f13,_0x43c15b,_0x59a5e4,_0x477d7a){return new BPromise(function(_0x54354c,_0x1b24c0){_0x477d7a=combineOptions(_0x477d7a);var _0x3d8cf6=new Buffer(_0x59a5e4);var _0x112fd0=fs[_0xbc92('0x13')](_0x5a7f13);var _0x4e6d15=fs[_0xbc92('0x14')](_0x43c15b);var _0x8d7598=crypto[_0xbc92('0x1d')](_0x477d7a[_0xbc92('0x9')],_0x3d8cf6);_0x112fd0['on']('data',function(_0x5f4eb5){var _0x4763ac=new Buffer(_0x8d7598[_0xbc92('0x1e')](_0x5f4eb5),'binary');_0x4e6d15[_0xbc92('0x18')](_0x4763ac);});_0x112fd0['on'](_0xbc92('0x19'),function(){try{var _0x2a4cc0=new Buffer(_0x8d7598[_0xbc92('0x1a')](_0xbc92('0x17')),'binary');_0x4e6d15['write'](_0x2a4cc0);_0x4e6d15[_0xbc92('0x19')]();_0x4e6d15['on']('close',function(){return _0x54354c(_0x43c15b);});}catch(_0x5d681f){fs[_0xbc92('0x1c')](_0x43c15b);return _0x1b24c0(_0x5d681f);}});});};exports[_0xbc92('0x1f')]=function(_0x1de17d,_0x11b7b3,_0x3a4bf4){var _0x278835=_0x3a4bf4||stringOptions[_0xbc92('0x9')];var _0x3ed66f=_0x11b7b3||stringOptions[_0xbc92('0x20')];var _0x3e35cb=crypto['createCipher'](_0x278835,_0x3ed66f);var _0x3eca89=_0x3e35cb[_0xbc92('0x1e')](_0x1de17d,'utf8',_0xbc92('0x21'));_0x3eca89+=_0x3e35cb[_0xbc92('0x1a')](_0xbc92('0x21'));return _0x3eca89;};exports['decryptString']=function(_0x2d816d,_0x82dddf,_0x2557c5){var _0x4783a2=_0x2557c5||stringOptions[_0xbc92('0x9')];var _0x5b5d95=_0x82dddf||stringOptions[_0xbc92('0x20')];var _0x4c3089=crypto[_0xbc92('0x1d')](_0x4783a2,_0x5b5d95);var _0x39616e=_0x4c3089[_0xbc92('0x1e')](_0x2d816d,_0xbc92('0x21'),_0xbc92('0x22'));_0x39616e+=_0x4c3089[_0xbc92('0x1a')](_0xbc92('0x22'));return _0x39616e;}; \ No newline at end of file +var _0x8401=['binary','write','close','unlink','decryptFile','end','secret','update','utf8','base64','final','decryptString','createDecipher','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','test','getCiphers','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','createCipher','data'];(function(_0x4dd6c0,_0xb3a7bf){var _0x1a073d=function(_0x2fe01c){while(--_0x2fe01c){_0x4dd6c0['push'](_0x4dd6c0['shift']());}};_0x1a073d(++_0xb3a7bf);}(_0x8401,0xcd));var _0x1840=function(_0xe6ab04,_0x28f80f){_0xe6ab04=_0xe6ab04-0x0;var _0x1fa234=_0x8401[_0xe6ab04];return _0x1fa234;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x1840('0x0'));var config=require(_0x1840('0x1'));var logger=require(_0x1840('0x2'))(_0x1840('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x1840('0x4')][_0x1840('0x5')],'algorithm':_0x1840('0x6')};const fileOptions={'algorithm':_0x1840('0x7')};if(config[_0x1840('0x8')]&&config[_0x1840('0x8')][_0x1840('0x9')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x1840('0x9')]);if(isSupported){fileOptions['algorithm']=config[_0x1840('0x8')][_0x1840('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0x1840('0x8')]['algorithm'],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x4d07ff){return AES_SUPPORTED_RX[_0x1840('0xa')](_0x4d07ff);}function getSupportedCiphers(){return crypto[_0x1840('0xb')]()[_0x1840('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x2435b9){return getSupportedCiphers()[_0x1840('0xd')](_0x2435b9)>-0x1;}function combineOptions(_0xef6cb2){var _0x3df638={};for(var _0x221cee in fileOptions){if(fileOptions['hasOwnProperty'](_0x221cee)){_0x3df638[_0x221cee]=fileOptions[_0x221cee];}}if(_0xef6cb2){for(var _0x23a1ae in _0xef6cb2){if(_0xef6cb2[_0x1840('0xe')](_0x23a1ae)){_0x3df638[_0x23a1ae]=_0xef6cb2[_0x23a1ae];}}}return _0x3df638;}exports['encryptFile']=function(_0x282af5,_0x1fb173,_0x140d9d,_0x1e30b4){return new BPromise(function(_0x2fc608,_0x1bb212){_0x1e30b4=combineOptions(_0x1e30b4);var _0x5e0b9a=new Buffer(_0x140d9d);var _0x32bf40=fs[_0x1840('0xf')](_0x282af5);var _0x20810b=fs[_0x1840('0x10')](_0x1fb173);var _0x4a27be=crypto[_0x1840('0x11')](_0x1e30b4['algorithm'],_0x5e0b9a);_0x32bf40['on'](_0x1840('0x12'),function(_0x5215f7){var _0x184bb0=new Buffer(_0x4a27be['update'](_0x5215f7),_0x1840('0x13'));_0x20810b[_0x1840('0x14')](_0x184bb0);});_0x32bf40['on']('end',function(){try{var _0x5c92ce=new Buffer(_0x4a27be['final']('binary'),_0x1840('0x13'));_0x20810b[_0x1840('0x14')](_0x5c92ce);_0x20810b['end']();_0x20810b['on'](_0x1840('0x15'),function(){return _0x2fc608(_0x1fb173);});}catch(_0x3c9698){fs[_0x1840('0x16')](_0x1fb173);return _0x1bb212(_0x3c9698);}});});};exports[_0x1840('0x17')]=function(_0x7034be,_0x21f8cc,_0x183ad1,_0x29be8a){return new BPromise(function(_0x5acd19,_0x20383f){_0x29be8a=combineOptions(_0x29be8a);var _0x432ed2=new Buffer(_0x183ad1);var _0x472df3=fs[_0x1840('0xf')](_0x7034be);var _0x198bf6=fs[_0x1840('0x10')](_0x21f8cc);var _0x391149=crypto['createDecipher'](_0x29be8a[_0x1840('0x9')],_0x432ed2);_0x472df3['on'](_0x1840('0x12'),function(_0xed1ff1){var _0x41523c=new Buffer(_0x391149['update'](_0xed1ff1),'binary');_0x198bf6['write'](_0x41523c);});_0x472df3['on'](_0x1840('0x18'),function(){try{var _0x4aa66e=new Buffer(_0x391149['final'](_0x1840('0x13')),_0x1840('0x13'));_0x198bf6[_0x1840('0x14')](_0x4aa66e);_0x198bf6[_0x1840('0x18')]();_0x198bf6['on'](_0x1840('0x15'),function(){return _0x5acd19(_0x21f8cc);});}catch(_0x199cb4){fs[_0x1840('0x16')](_0x21f8cc);return _0x20383f(_0x199cb4);}});});};exports['encryptString']=function(_0x487ad4,_0x576ded,_0x40f9f7){var _0x1eed2f=_0x40f9f7||stringOptions[_0x1840('0x9')];var _0x4e5060=_0x576ded||stringOptions[_0x1840('0x19')];var _0x4663d3=crypto[_0x1840('0x11')](_0x1eed2f,_0x4e5060);var _0x2f2274=_0x4663d3[_0x1840('0x1a')](_0x487ad4,_0x1840('0x1b'),_0x1840('0x1c'));_0x2f2274+=_0x4663d3[_0x1840('0x1d')](_0x1840('0x1c'));return _0x2f2274;};exports[_0x1840('0x1e')]=function(_0x2ccd35,_0xf300bd,_0x3cb28e){var _0x45ab45=_0x3cb28e||stringOptions[_0x1840('0x9')];var _0x93c86a=_0xf300bd||stringOptions[_0x1840('0x19')];var _0x595e96=crypto[_0x1840('0x1f')](_0x45ab45,_0x93c86a);var _0x1d9dd8=_0x595e96['update'](_0x2ccd35,_0x1840('0x1c'),_0x1840('0x1b'));_0x1d9dd8+=_0x595e96[_0x1840('0x1d')](_0x1840('0x1b'));return _0x1d9dd8;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 61f3f82..f81a560 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 _0x9224=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','mkdirSync','each','csv','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','split','splitSizeCsv','then','sequelize','query'];(function(_0x122a3e,_0x40328c){var _0x19879e=function(_0x2d7452){while(--_0x2d7452){_0x122a3e['push'](_0x122a3e['shift']());}};_0x19879e(++_0x40328c);}(_0x9224,0x77));var _0x4922=function(_0x2f80ac,_0x1ded41){_0x2f80ac=_0x2f80ac-0x0;var _0x556fc4=_0x9224[_0x2f80ac];return _0x556fc4;};'use strict';var util=require(_0x4922('0x0'));var path=require(_0x4922('0x1'));var _=require(_0x4922('0x2'));var csv=require(_0x4922('0x3'));var fs=require('fs');var BPromise=require(_0x4922('0x4'));var zipdir=require(_0x4922('0x5'));var rimraf=require('rimraf');var db=require(_0x4922('0x6'))['db'];var dbH=require(_0x4922('0x6'))[_0x4922('0x7')];var logger=require(_0x4922('0x8'))(_0x4922('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x4922('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xd30d7,_0xcda37f){var _0x7090a2={'status':_0xd30d7};var _0x2a7696={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xcda37f){_0x7090a2[_0x4922('0xb')]=_0xcda37f;}return db[_0x4922('0xc')]['update'](_0x7090a2,_0x2a7696);}function main(){var _0x5d8dd6=0x1388;var _0x5dbf65;logger[_0x4922('0xd')](util[_0x4922('0xe')](_0x4922('0xf'),EXTRACTED_REPORT_ID,_0x4922('0x10')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4922('0x11'),'splitSizeCsv']})['then'](function(_0x119bd6){if(_0x119bd6){_0x5dbf65=_0x119bd6;_0x5d8dd6=_0x5dbf65[_0x4922('0x12')]||0x1388;}})[_0x4922('0x13')](function(){return dbH[_0x4922('0x14')][_0x4922('0x15')](util['format'](_0x4922('0x16'),QUERY),{'type':dbH[_0x4922('0x14')][_0x4922('0x17')][_0x4922('0x18')]});})[_0x4922('0x13')](function(_0x3de184){if(!_0x3de184[0x0]['num']){return analyticExtractedReport(_0x4922('0x19'));}var _0x2a63bc=[];var _0xf67594=0x0;if(_0x5dbf65[_0x4922('0x11')]){if(_0x3de184&&_0x3de184[_0x4922('0x1a')]){var _0x4370fc=_[_0x4922('0x1b')](_0x3de184[0x0]['num']/_0x5d8dd6);var _0x4dd72b=Number[_0x4922('0x1c')](_0x3de184[0x0]['num']/_0x5d8dd6)?_0x3de184[0x0]['num']%_0x5d8dd6:0x0;_0x4370fc['forEach'](function(_0x199d1f){if(_0x199d1f>0x0){_0xf67594+=_0x5d8dd6;}_0x2a63bc[_0x4922('0x1d')](dbH[_0x4922('0x14')][_0x4922('0x15')](util[_0x4922('0xe')](_0x4922('0x1e'),QUERY,_0x5d8dd6,_0xf67594),{'type':dbH['sequelize'][_0x4922('0x17')][_0x4922('0x18')]}));});if(_0x4dd72b>0x0){_0xf67594+=_0x5d8dd6;_0x2a63bc['push'](dbH[_0x4922('0x14')]['query'](util[_0x4922('0xe')](_0x4922('0x1e'),QUERY,_0x4dd72b,_0xf67594),{'type':dbH[_0x4922('0x14')][_0x4922('0x17')]['SELECT']}));}}}else{_0x2a63bc[_0x4922('0x1d')](dbH[_0x4922('0x14')][_0x4922('0x15')](QUERY,{'type':dbH[_0x4922('0x14')]['QueryTypes'][_0x4922('0x18')]}));}var _0x27651c=path[_0x4922('0x1f')](PATH);var _0x18e49d=path[_0x4922('0x20')](PATH,_0x4922('0x21'));var _0x335ab9=_0x5dbf65[_0x4922('0x11')]&&_0x2a63bc['length']>0x1;var _0x4770cc=[];if(!fs[_0x4922('0x22')](path[_0x4922('0x23')](_0x27651c,_0x18e49d))&&_0x335ab9){fs[_0x4922('0x24')](path['join'](_0x27651c,_0x18e49d));}return BPromise[_0x4922('0x25')](_0x2a63bc,function(_0x124b46){_0x4770cc[_0x4922('0x1d')](_0x124b46);})[_0x4922('0x13')](function(){for(var _0x245870=0x0;_0x245870<_0x4770cc[_0x4922('0x1a')];_0x245870+=0x1){var _0x2bc533;var _0x397f18=_0x4770cc[_0x245870];if(_0x335ab9){_0x2bc533=path[_0x4922('0x23')](_0x27651c,_0x18e49d,util[_0x4922('0xe')]('%s%d.%s',_0x18e49d,_0x245870,_0x4922('0x26')));}else{_0x2bc533=path[_0x4922('0x23')](_0x27651c,util[_0x4922('0xe')](_0x4922('0x27'),_0x18e49d,_0x4922('0x26')));}fs[_0x4922('0x28')](_0x2bc533,csv(_0x397f18));}})[_0x4922('0x13')](function(){if(_0x335ab9){return new Promise(function(_0x515766){zipdir(path['join'](_0x27651c,_0x18e49d),{'saveTo':path[_0x4922('0x23')](_0x27651c,util[_0x4922('0xe')](_0x4922('0x27'),_0x18e49d,'zip'))},function(_0x572cde,_0x3bc3b3){rimraf(path[_0x4922('0x23')](_0x27651c,_0x18e49d),function(){});_0x515766('zip\x20finished');});});}})[_0x4922('0x13')](function(){logger['info'](util[_0x4922('0xe')](_0x4922('0x29'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x335ab9?util[_0x4922('0xe')](_0x4922('0x27'),_0x18e49d,_0x335ab9?_0x4922('0x2a'):'csv'):null);});})[_0x4922('0x2b')](function(_0x5ebcec){logger[_0x4922('0xd')](util[_0x4922('0xe')](_0x4922('0x2c'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x5ebcec,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x4922('0x2d')](function(){process[_0x4922('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xf248=['each','csv','%s.%s','writeFileSync','zip','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','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv','then','query','sequelize','SELECT','num','Empty','split','isInteger','forEach','push','QueryTypes','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','length','existsSync','join','mkdirSync'];(function(_0x169509,_0x3154e3){var _0x1ea9ad=function(_0x56ae55){while(--_0x56ae55){_0x169509['push'](_0x169509['shift']());}};_0x1ea9ad(++_0x3154e3);}(_0xf248,0x180));var _0x8f24=function(_0x20c73b,_0x2513a5){_0x20c73b=_0x20c73b-0x0;var _0x56c952=_0xf248[_0x20c73b];return _0x56c952;};'use strict';var util=require(_0x8f24('0x0'));var path=require(_0x8f24('0x1'));var _=require(_0x8f24('0x2'));var csv=require(_0x8f24('0x3'));var fs=require('fs');var BPromise=require(_0x8f24('0x4'));var zipdir=require(_0x8f24('0x5'));var rimraf=require(_0x8f24('0x6'));var db=require(_0x8f24('0x7'))['db'];var dbH=require(_0x8f24('0x7'))[_0x8f24('0x8')];var logger=require(_0x8f24('0x9'))(_0x8f24('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x8f24('0xb')][0x2]);var QUERY=process[_0x8f24('0xb')][0x3];var PATH=process[_0x8f24('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3029c9,_0x33a760){var _0x3bbf6c={'status':_0x3029c9};var _0x190703={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x33a760){_0x3bbf6c[_0x8f24('0xc')]=_0x33a760;}return db[_0x8f24('0xd')]['update'](_0x3bbf6c,_0x190703);}function main(){var _0x42650d=0x1388;var _0x374f40;logger[_0x8f24('0xe')](util[_0x8f24('0xf')](_0x8f24('0x10'),EXTRACTED_REPORT_ID,_0x8f24('0x11')));return db[_0x8f24('0x12')][_0x8f24('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x8f24('0x14')]})[_0x8f24('0x15')](function(_0x47a29b){if(_0x47a29b){_0x374f40=_0x47a29b;_0x42650d=_0x374f40[_0x8f24('0x14')]||0x1388;}})[_0x8f24('0x15')](function(){return dbH['sequelize'][_0x8f24('0x16')](util[_0x8f24('0xf')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x8f24('0x17')]['QueryTypes'][_0x8f24('0x18')]});})['then'](function(_0x55542b){if(!_0x55542b[0x0][_0x8f24('0x19')]){return analyticExtractedReport(_0x8f24('0x1a'));}var _0x4c70e8=[];var _0x44f40b=0x0;if(_0x374f40[_0x8f24('0x1b')]){if(_0x55542b&&_0x55542b['length']){var _0x56ea41=_['range'](_0x55542b[0x0][_0x8f24('0x19')]/_0x42650d);var _0x557801=Number[_0x8f24('0x1c')](_0x55542b[0x0][_0x8f24('0x19')]/_0x42650d)?_0x55542b[0x0][_0x8f24('0x19')]%_0x42650d:0x0;_0x56ea41[_0x8f24('0x1d')](function(_0x2dea4c){if(_0x2dea4c>0x0){_0x44f40b+=_0x42650d;}_0x4c70e8[_0x8f24('0x1e')](dbH['sequelize']['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x42650d,_0x44f40b),{'type':dbH['sequelize'][_0x8f24('0x1f')][_0x8f24('0x18')]}));});if(_0x557801>0x0){_0x44f40b+=_0x42650d;_0x4c70e8[_0x8f24('0x1e')](dbH[_0x8f24('0x17')][_0x8f24('0x16')](util['format'](_0x8f24('0x20'),QUERY,_0x557801,_0x44f40b),{'type':dbH[_0x8f24('0x17')][_0x8f24('0x1f')]['SELECT']}));}}}else{_0x4c70e8['push'](dbH[_0x8f24('0x17')][_0x8f24('0x16')](QUERY,{'type':dbH['sequelize'][_0x8f24('0x1f')][_0x8f24('0x18')]}));}var _0xec18d1=path[_0x8f24('0x21')](PATH);var _0x145c25=path[_0x8f24('0x22')](PATH,_0x8f24('0x23'));var _0x405f02=_0x374f40[_0x8f24('0x1b')]&&_0x4c70e8[_0x8f24('0x24')]>0x1;var _0x261e02=[];if(!fs[_0x8f24('0x25')](path[_0x8f24('0x26')](_0xec18d1,_0x145c25))&&_0x405f02){fs[_0x8f24('0x27')](path[_0x8f24('0x26')](_0xec18d1,_0x145c25));}return BPromise[_0x8f24('0x28')](_0x4c70e8,function(_0x30d6b0){_0x261e02[_0x8f24('0x1e')](_0x30d6b0);})['then'](function(){for(var _0x328dc4=0x0;_0x328dc4<_0x261e02[_0x8f24('0x24')];_0x328dc4+=0x1){var _0x7f48ac;var _0xd08c87=_0x261e02[_0x328dc4];if(_0x405f02){_0x7f48ac=path[_0x8f24('0x26')](_0xec18d1,_0x145c25,util[_0x8f24('0xf')]('%s%d.%s',_0x145c25,_0x328dc4,_0x8f24('0x29')));}else{_0x7f48ac=path[_0x8f24('0x26')](_0xec18d1,util['format'](_0x8f24('0x2a'),_0x145c25,'csv'));}fs[_0x8f24('0x2b')](_0x7f48ac,csv(_0xd08c87));}})[_0x8f24('0x15')](function(){if(_0x405f02){return new Promise(function(_0x5e6f4f){zipdir(path[_0x8f24('0x26')](_0xec18d1,_0x145c25),{'saveTo':path['join'](_0xec18d1,util[_0x8f24('0xf')](_0x8f24('0x2a'),_0x145c25,_0x8f24('0x2c')))},function(_0x1b825f,_0x3caaf7){rimraf(path['join'](_0xec18d1,_0x145c25),function(){});_0x5e6f4f('zip\x20finished');});});}})[_0x8f24('0x15')](function(){logger[_0x8f24('0xe')](util[_0x8f24('0xf')](_0x8f24('0x2d'),EXTRACTED_REPORT_ID,_0x8f24('0x11')));return analyticExtractedReport(_0x8f24('0x2e'),_0x405f02?util[_0x8f24('0xf')]('%s.%s',_0x145c25,_0x405f02?'zip':_0x8f24('0x29')):null);});})[_0x8f24('0x2f')](function(_0x472503){logger[_0x8f24('0xe')](util[_0x8f24('0xf')](_0x8f24('0x30'),EXTRACTED_REPORT_ID,_0x8f24('0x11')),util[_0x8f24('0x31')](_0x472503,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8f24('0x32'));})[_0x8f24('0x33')](function(){process[_0x8f24('0x34')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index e7c34ad..a49a25a 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 _0x25ba=['query','QueryTypes','dirname','basename','.pdf','existsSync','join','flatten','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','info','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','createPdfFromHTML','lodash','path','moment','html-to-pdfmake','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','length','auto','body','push','concat','chunk','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','format','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','right','num','Setting','find','split','then','range','isInteger','sequelize'];(function(_0x5699b5,_0x4ae716){var _0x58b156=function(_0x3f8067){while(--_0x3f8067){_0x5699b5['push'](_0x5699b5['shift']());}};_0x58b156(++_0x4ae716);}(_0x25ba,0x87));var _0xa25b=function(_0x4da0d8,_0x2d50b6){_0x4da0d8=_0x4da0d8-0x0;var _0x399db1=_0x25ba[_0x4da0d8];return _0x399db1;};'use strict';var _=require(_0xa25b('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xa25b('0x1'));var moment=require(_0xa25b('0x2'));var htmlToPdfmake=require(_0xa25b('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xa25b('0x4'));var rimraf=require(_0xa25b('0x5'));var JSDOM=require(_0xa25b('0x6'))[_0xa25b('0x7')];var window=new JSDOM('')[_0xa25b('0x8')];var BPromise=require(_0xa25b('0x9'));var db=require(_0xa25b('0xa'))['db'];var dbH=require(_0xa25b('0xa'))[_0xa25b('0xb')];var logger=require(_0xa25b('0xc'))(_0xa25b('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0xa25b('0xe')][0x2]);var QUERY=process[_0xa25b('0xe')][0x3];var PATH=process[_0xa25b('0xe')][0x4];var NAME=process[_0xa25b('0xe')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x380653,_0x2b470f){var _0x2b9a8a={'status':_0x380653};var _0x23d744={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2b470f){_0x2b9a8a[_0xa25b('0xf')]=_0x2b470f;}return db[_0xa25b('0x10')][_0xa25b('0x11')](_0x2b9a8a,_0x23d744);}function getHeaders(_0xf5361){return _[_0xa25b('0x12')](_0xf5361,function(_0x63959f){return{'text':_0x63959f,'style':_0xa25b('0x13')};});}function getRows(_0x1cd10b,_0x327d85){return _[_0xa25b('0x12')](_0x327d85,function(_0x3cddfc){return _(_0x3cddfc)[_0xa25b('0x14')](_0x1cd10b)['map'](function(_0x531743){return _0x531743?_[_0xa25b('0x15')](_0x531743):'';})[_0xa25b('0x16')]();});}function createTable(_0x4ed53e,_0x3d744a){var _0x5265fc={'widths':_[_0xa25b('0x17')](Array(_0x4ed53e[_0xa25b('0x18')]),0x91),'heights':function(_0x17cdc4){return _0x17cdc4===0x0?_0xa25b('0x19'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1c32a4=getHeaders(_0x4ed53e);_0x5265fc[_0xa25b('0x1a')][_0xa25b('0x1b')](_0x1c32a4);var _0x5824bc=getRows(_0x4ed53e,_0x3d744a);_0x5265fc[_0xa25b('0x1a')]=_0x5265fc[_0xa25b('0x1a')][_0xa25b('0x1c')](_0x5824bc);return _0x5265fc;}function createTables(_0x51b4af){var _0x474dac=[];var _0x3d8bd7=_[_0xa25b('0x1d')](Object[_0xa25b('0x1e')](_0x51b4af[0x0]),0x5);_0x3d8bd7[_0xa25b('0x1f')](function(_0x491c6f){_0x474dac['push'](createTable(_0x491c6f,_0x51b4af));});return _0x474dac;}function getPDFDocDefinition(_0x430b33){var _0x319516=util['format'](_0xa25b('0x20'),NAME,EXTRACTED_REPORT[_0xa25b('0x21')],moment(EXTRACTED_REPORT[_0xa25b('0x22')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0xa25b('0x23')])[_0xa25b('0x24')](FORMAT));var _0x4f3ece=[];for(var _0x4f533a=0x0;_0x4f533a<_0x430b33[_0xa25b('0x18')];_0x4f533a++){var _0x4dfc7c=[];if(_0x4f533a===0x0){_0x4dfc7c[_0xa25b('0x1b')]({'text':_0x319516,'style':'header'});}var _0x30ea7c={'table':_0x430b33[_0x4f533a]};if(_0x4f533a>0x0){_0x30ea7c[_0xa25b('0x25')]=_0xa25b('0x26');_0x30ea7c[_0xa25b('0x27')]=[0x0,0x46,0x0,0x0];}_0x4dfc7c[_0xa25b('0x1b')](_0x30ea7c);_0x4f3ece[_0xa25b('0x1b')](_0x4dfc7c);}return{'pageSize':'A4','pageOrientation':_0xa25b('0x28'),'content':_0x4f3ece,'footer':function(_0x1bdeac,_0xa2833a){return{'text':_0x1bdeac[_0xa25b('0x15')]()+_0xa25b('0x29')+_0xa2833a,'style':_0xa25b('0x2a')};},'defaultStyle':{'font':_0xa25b('0x2b')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0xa25b('0x2c'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1ee949){var _0x1af8bb=0x1388;var _0x19dec9;if(!_0x1ee949[0x0][_0xa25b('0x2d')]){return analyticExtractedReport('Empty');}return db[_0xa25b('0x2e')][_0xa25b('0x2f')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa25b('0x30'),'splitSizePdf']})[_0xa25b('0x31')](function(_0x294192){if(_0x294192){_0x19dec9=_0x294192;_0x1af8bb=_0x19dec9['splitSizePdf']||0x3e8;}})[_0xa25b('0x31')](function(){var _0x169849=[];var _0x518f05=0x0;if(_0x19dec9['split']){if(_0x1ee949&&_0x1ee949[_0xa25b('0x18')]){var _0x2729f5=_[_0xa25b('0x32')](_0x1ee949[0x0][_0xa25b('0x2d')]/_0x1af8bb);var _0x3f4f2f=Number[_0xa25b('0x33')](_0x1ee949[0x0][_0xa25b('0x2d')]/_0x1af8bb)?_0x1ee949[0x0][_0xa25b('0x2d')]%_0x1af8bb:0x0;_0x2729f5[_0xa25b('0x1f')](function(_0x2728c9){if(_0x2728c9>0x0){_0x518f05+=_0x1af8bb;}_0x169849[_0xa25b('0x1b')](dbH[_0xa25b('0x34')][_0xa25b('0x35')](util[_0xa25b('0x24')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1af8bb,_0x518f05),{'type':dbH[_0xa25b('0x34')][_0xa25b('0x36')]['SELECT']}));});if(_0x3f4f2f>0x0){_0x518f05+=_0x1af8bb;_0x169849[_0xa25b('0x1b')](dbH['sequelize']['query'](util[_0xa25b('0x24')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3f4f2f,_0x518f05),{'type':dbH[_0xa25b('0x34')]['QueryTypes']['SELECT']}));}}}else{_0x169849[_0xa25b('0x1b')](dbH[_0xa25b('0x34')][_0xa25b('0x35')](QUERY,{'type':dbH[_0xa25b('0x34')][_0xa25b('0x36')]['SELECT']}));}var _0x45eeda=path[_0xa25b('0x37')](PATH);var _0x41e559=path[_0xa25b('0x38')](PATH,_0xa25b('0x39'));var _0x423d4d=_0x19dec9[_0xa25b('0x30')]&&_0x169849[_0xa25b('0x18')]>0x1;var _0x10bf19=[];if(!fs[_0xa25b('0x3a')](path[_0xa25b('0x3b')](_0x45eeda,_0x41e559))&&_0x423d4d){fs['mkdirSync'](path[_0xa25b('0x3b')](_0x45eeda,_0x41e559));}return BPromise['each'](_0x169849,function(_0x2f188c){_0x10bf19[_0xa25b('0x1b')](_0x2f188c);})[_0xa25b('0x31')](function(){var _0x59026f=[];for(var _0x3f7097=0x0;_0x3f7097<_0x10bf19[_0xa25b('0x18')];_0x3f7097+=0x1){var _0x58f3ab=_0x10bf19[_0x3f7097];var _0x406634=createTables(_[_0xa25b('0x3c')](_0x58f3ab));var _0x1d0ed6;var _0x270967=getPDFDocDefinition(_0x406634);var _0x333a00=getPDFPrinter();var _0x43e777=_0x333a00[_0xa25b('0x3d')](_0x270967);if(_0x423d4d){_0x1d0ed6=path[_0xa25b('0x3b')](_0x45eeda,_0x41e559,util[_0xa25b('0x24')](_0xa25b('0x3e'),_0x41e559,_0x3f7097,_0xa25b('0x3f')));}else{_0x1d0ed6=path[_0xa25b('0x3b')](_0x45eeda,util[_0xa25b('0x24')]('%s.%s',_0x41e559,'pdf'));}_0x59026f[_0xa25b('0x1b')](writePDFDocument(_0x43e777,_0x1d0ed6));}return Promise[_0xa25b('0x40')](_0x59026f);})['then'](function(){if(_0x423d4d){return new Promise(function(_0x34484d){zipdir(path['join'](_0x45eeda,_0x41e559),{'saveTo':path[_0xa25b('0x3b')](_0x45eeda,util[_0xa25b('0x24')](_0xa25b('0x41'),_0x41e559,_0xa25b('0x42')))},function(){rimraf(path['join'](_0x45eeda,_0x41e559),function(){});_0x34484d('zip\x20finished');});});}})['then'](function(){if(!_0x423d4d)return;rimraf(path[_0xa25b('0x3b')](_0x45eeda,_0x41e559),function(){});})['then'](function(){logger['info'](util[_0xa25b('0x24')](_0xa25b('0x43'),EXTRACTED_REPORT_ID,_0xa25b('0x44')));return analyticExtractedReport(_0xa25b('0x45'),_0x423d4d?util[_0xa25b('0x24')]('%s.%s',_0x41e559,_0x423d4d?_0xa25b('0x42'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xa25b('0x46')](util[_0xa25b('0x24')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa25b('0x44')));return db[_0xa25b('0x10')][_0xa25b('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xa25b('0x31')](function(_0x54e5a8){EXTRACTED_REPORT=_0x54e5a8;return dbH['sequelize'][_0xa25b('0x35')](util[_0xa25b('0x24')](_0xa25b('0x48'),QUERY),{'type':dbH[_0xa25b('0x34')][_0xa25b('0x36')][_0xa25b('0x49')]});})[_0xa25b('0x31')](extractReport)[_0xa25b('0x4a')](function(_0x4c8d05){logger['info'](util[_0xa25b('0x24')](_0xa25b('0x4b'),EXTRACTED_REPORT_ID,_0xa25b('0x44')),util[_0xa25b('0x4c')](_0x4c8d05,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa25b('0x4d'));})[_0xa25b('0x4e')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3e5578=new PdfPrinter({'Arial':{'normal':__dirname+_0xa25b('0x4f'),'bold':__dirname+_0xa25b('0x50'),'italics':__dirname+_0xa25b('0x51'),'bolditalics':__dirname+_0xa25b('0x52')}});return _0x3e5578;}function getPDFDocDefinitionFromHTML(_0x45085a,_0x4c9a44){var _0x5c971d=util['format'](_0xa25b('0x53'),_0x4c9a44[_0xa25b('0x54')],_0x4c9a44['interactionId']);var _0x2b0417=moment()['format'](_0xa25b('0x55'))[_0xa25b('0x15')]();var _0x2d8123=htmlToPdfmake(_0x45085a,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2d8123],'defaultStyle':{'font':_0xa25b('0x2b')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','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':_0xa25b('0x56')}},'header':function(){return[{'text':_0xa25b('0x57'),'style':_0xa25b('0x58')}];},'footer':function(_0x24fc75,_0x2d4a27){return[{'text':util[_0xa25b('0x24')](_0xa25b('0x59'),_0x5c971d,_0x24fc75,_0x2d4a27,_0x2b0417),'style':_0xa25b('0x2a')}];}};}function writePDFDocument(_0x2a58b7,_0x141d32){return new Promise(function(_0x1ee505,_0x14c706){var _0x5a9433=_0x2a58b7['pipe'](fs[_0xa25b('0x5a')](_0x141d32));_0x5a9433['on'](_0xa25b('0x5b'),function(){_0x1ee505(_0xa25b('0x5b'));});_0x5a9433['on'](_0xa25b('0x5c'),function(_0x286935){_0x14c706(_0x286935);});_0x2a58b7['end']();});}exports[_0xa25b('0x5d')]=function(_0x1e8803,_0x2b3509){var _0x1221ee=getPDFPrinter();var _0x20847c=getPDFDocDefinitionFromHTML(_0x1e8803,_0x2b3509);var _0x6cb026=_0x1221ee[_0xa25b('0x3d')](_0x20847c);return writePDFDocument(_0x6cb026,_0x2b3509[_0xa25b('0x1')])[_0xa25b('0x4a')](function(_0xe76b4){throw _0xe76b4;});}; \ No newline at end of file +var _0x711d=['Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','pick','toString','fill','length','auto','body','push','concat','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','right','Empty','Setting','split','splitSizePdf','then','range','num','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','%s\x20#%d','channel','YYYY-MM-DD','center'];(function(_0x5b34c0,_0x3ad403){var _0x242bd3=function(_0x51d0ce){while(--_0x51d0ce){_0x5b34c0['push'](_0x5b34c0['shift']());}};_0x242bd3(++_0x3ad403);}(_0x711d,0x1d1));var _0xd711=function(_0x273182,_0x2222c6){_0x273182=_0x273182-0x0;var _0x4ecd20=_0x711d[_0x273182];return _0x4ecd20;};'use strict';var _=require(_0xd711('0x0'));var fs=require('fs');var util=require(_0xd711('0x1'));var path=require(_0xd711('0x2'));var moment=require(_0xd711('0x3'));var htmlToPdfmake=require(_0xd711('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xd711('0x5'));var rimraf=require(_0xd711('0x6'));var JSDOM=require(_0xd711('0x7'))[_0xd711('0x8')];var window=new JSDOM('')[_0xd711('0x9')];var BPromise=require(_0xd711('0xa'));var db=require(_0xd711('0xb'))['db'];var dbH=require('../../mysqldb')[_0xd711('0xc')];var logger=require(_0xd711('0xd'))(_0xd711('0xe'));var EXTRACTED_REPORT_ID=Number(process[_0xd711('0xf')][0x2]);var QUERY=process[_0xd711('0xf')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xd711('0xf')][0x5];var FORMAT=_0xd711('0x10');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x519086,_0x1bd9c0){var _0x573bec={'status':_0x519086};var _0x4f9497={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1bd9c0){_0x573bec[_0xd711('0x11')]=_0x1bd9c0;}return db[_0xd711('0x12')][_0xd711('0x13')](_0x573bec,_0x4f9497);}function getHeaders(_0x540967){return _[_0xd711('0x14')](_0x540967,function(_0x4cad6d){return{'text':_0x4cad6d,'style':'tableHeader'};});}function getRows(_0x5db713,_0x3c6e78){return _[_0xd711('0x14')](_0x3c6e78,function(_0x569ef6){return _(_0x569ef6)[_0xd711('0x15')](_0x5db713)['map'](function(_0x5e1d40){return _0x5e1d40?_[_0xd711('0x16')](_0x5e1d40):'';})['value']();});}function createTable(_0x1a4cb6,_0x4f850d){var _0x24e8c9={'widths':_[_0xd711('0x17')](Array(_0x1a4cb6[_0xd711('0x18')]),0x91),'heights':function(_0x378625){return _0x378625===0x0?_0xd711('0x19'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x517c28=getHeaders(_0x1a4cb6);_0x24e8c9[_0xd711('0x1a')][_0xd711('0x1b')](_0x517c28);var _0x5e8bb2=getRows(_0x1a4cb6,_0x4f850d);_0x24e8c9[_0xd711('0x1a')]=_0x24e8c9[_0xd711('0x1a')][_0xd711('0x1c')](_0x5e8bb2);return _0x24e8c9;}function createTables(_0xa15d12){var _0x569f20=[];var _0xd50af=_[_0xd711('0x1d')](Object['keys'](_0xa15d12[0x0]),0x5);_0xd50af[_0xd711('0x1e')](function(_0x2be987){_0x569f20['push'](createTable(_0x2be987,_0xa15d12));});return _0x569f20;}function getPDFDocDefinition(_0x4c9a46){var _0x35f62e=util[_0xd711('0x1f')](_0xd711('0x20'),NAME,EXTRACTED_REPORT[_0xd711('0x21')],moment(EXTRACTED_REPORT['startDate'])['format'](FORMAT),moment(EXTRACTED_REPORT[_0xd711('0x22')])[_0xd711('0x1f')](FORMAT));var _0x45e505=[];for(var _0x417c4b=0x0;_0x417c4b<_0x4c9a46[_0xd711('0x18')];_0x417c4b++){var _0x5d77ca=[];if(_0x417c4b===0x0){_0x5d77ca[_0xd711('0x1b')]({'text':_0x35f62e,'style':_0xd711('0x23')});}var _0xfa50a7={'table':_0x4c9a46[_0x417c4b]};if(_0x417c4b>0x0){_0xfa50a7[_0xd711('0x24')]=_0xd711('0x25');_0xfa50a7[_0xd711('0x26')]=[0x0,0x46,0x0,0x0];}_0x5d77ca[_0xd711('0x1b')](_0xfa50a7);_0x45e505[_0xd711('0x1b')](_0x5d77ca);}return{'pageSize':'A4','pageOrientation':_0xd711('0x27'),'content':_0x45e505,'footer':function(_0xa50a27,_0x4008a4){return{'text':_0xa50a27[_0xd711('0x16')]()+_0xd711('0x28')+_0x4008a4,'style':_0xd711('0x29')};},'defaultStyle':{'font':_0xd711('0x2a')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xd711('0x2b')},'footer':{'alignment':_0xd711('0x2c'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x296869){var _0x12306a=0x1388;var _0x5815fb;if(!_0x296869[0x0]['num']){return analyticExtractedReport(_0xd711('0x2d'));}return db[_0xd711('0x2e')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd711('0x2f'),_0xd711('0x30')]})[_0xd711('0x31')](function(_0x2b6909){if(_0x2b6909){_0x5815fb=_0x2b6909;_0x12306a=_0x5815fb['splitSizePdf']||0x3e8;}})[_0xd711('0x31')](function(){var _0x295a95=[];var _0x4cfbbe=0x0;if(_0x5815fb[_0xd711('0x2f')]){if(_0x296869&&_0x296869['length']){var _0x4c6016=_[_0xd711('0x32')](_0x296869[0x0][_0xd711('0x33')]/_0x12306a);var _0x374feb=Number['isInteger'](_0x296869[0x0][_0xd711('0x33')]/_0x12306a)?_0x296869[0x0]['num']%_0x12306a:0x0;_0x4c6016[_0xd711('0x1e')](function(_0x252849){if(_0x252849>0x0){_0x4cfbbe+=_0x12306a;}_0x295a95['push'](dbH[_0xd711('0x34')][_0xd711('0x35')](util[_0xd711('0x1f')](_0xd711('0x36'),QUERY,_0x12306a,_0x4cfbbe),{'type':dbH[_0xd711('0x34')][_0xd711('0x37')][_0xd711('0x38')]}));});if(_0x374feb>0x0){_0x4cfbbe+=_0x12306a;_0x295a95[_0xd711('0x1b')](dbH[_0xd711('0x34')][_0xd711('0x35')](util[_0xd711('0x1f')](_0xd711('0x36'),QUERY,_0x374feb,_0x4cfbbe),{'type':dbH[_0xd711('0x34')][_0xd711('0x37')][_0xd711('0x38')]}));}}}else{_0x295a95['push'](dbH[_0xd711('0x34')]['query'](QUERY,{'type':dbH[_0xd711('0x34')][_0xd711('0x37')][_0xd711('0x38')]}));}var _0x265bf9=path[_0xd711('0x39')](PATH);var _0x1fd1ed=path[_0xd711('0x3a')](PATH,_0xd711('0x3b'));var _0x5e8406=_0x5815fb['split']&&_0x295a95[_0xd711('0x18')]>0x1;var _0x2b6f0f=[];if(!fs['existsSync'](path[_0xd711('0x3c')](_0x265bf9,_0x1fd1ed))&&_0x5e8406){fs[_0xd711('0x3d')](path[_0xd711('0x3c')](_0x265bf9,_0x1fd1ed));}return BPromise[_0xd711('0x3e')](_0x295a95,function(_0x3e8f44){_0x2b6f0f[_0xd711('0x1b')](_0x3e8f44);})[_0xd711('0x31')](function(){var _0x576db6=[];for(var _0x12381c=0x0;_0x12381c<_0x2b6f0f['length'];_0x12381c+=0x1){var _0x4dce47=_0x2b6f0f[_0x12381c];var _0x725d73=createTables(_[_0xd711('0x3f')](_0x4dce47));var _0x51f667;var _0x2dfa82=getPDFDocDefinition(_0x725d73);var _0x2703b3=getPDFPrinter();var _0x289b1e=_0x2703b3[_0xd711('0x40')](_0x2dfa82);if(_0x5e8406){_0x51f667=path[_0xd711('0x3c')](_0x265bf9,_0x1fd1ed,util[_0xd711('0x1f')](_0xd711('0x41'),_0x1fd1ed,_0x12381c,_0xd711('0x42')));}else{_0x51f667=path[_0xd711('0x3c')](_0x265bf9,util[_0xd711('0x1f')](_0xd711('0x43'),_0x1fd1ed,'pdf'));}_0x576db6[_0xd711('0x1b')](writePDFDocument(_0x289b1e,_0x51f667));}return Promise[_0xd711('0x44')](_0x576db6);})['then'](function(){if(_0x5e8406){return new Promise(function(_0x400361){zipdir(path[_0xd711('0x3c')](_0x265bf9,_0x1fd1ed),{'saveTo':path[_0xd711('0x3c')](_0x265bf9,util[_0xd711('0x1f')]('%s.%s',_0x1fd1ed,_0xd711('0x45')))},function(){rimraf(path[_0xd711('0x3c')](_0x265bf9,_0x1fd1ed),function(){});_0x400361('zip\x20finished');});});}})[_0xd711('0x31')](function(){if(!_0x5e8406)return;rimraf(path['join'](_0x265bf9,_0x1fd1ed),function(){});})[_0xd711('0x31')](function(){logger['info'](util[_0xd711('0x1f')](_0xd711('0x46'),EXTRACTED_REPORT_ID,_0xd711('0x47')));return analyticExtractedReport(_0xd711('0x48'),_0x5e8406?util['format'](_0xd711('0x43'),_0x1fd1ed,_0x5e8406?_0xd711('0x45'):_0xd711('0x42')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xd711('0x49')](util[_0xd711('0x1f')](_0xd711('0x4a'),EXTRACTED_REPORT_ID,'PDF'));return db['AnalyticExtractedReport'][_0xd711('0x4b')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xd711('0x31')](function(_0x1c40ff){EXTRACTED_REPORT=_0x1c40ff;return dbH[_0xd711('0x34')][_0xd711('0x35')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xd711('0x34')]['QueryTypes']['SELECT']});})[_0xd711('0x31')](extractReport)[_0xd711('0x4c')](function(_0x5746c4){logger[_0xd711('0x49')](util[_0xd711('0x1f')](_0xd711('0x4d'),EXTRACTED_REPORT_ID,_0xd711('0x47')),util[_0xd711('0x4e')](_0x5746c4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd711('0x4f'));})['finally'](function(){process[_0xd711('0x50')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x4ca74c=new PdfPrinter({'Arial':{'normal':__dirname+_0xd711('0x51'),'bold':__dirname+_0xd711('0x52'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x4ca74c;}function getPDFDocDefinitionFromHTML(_0x577b1b,_0x235428){var _0x2e98e0=util[_0xd711('0x1f')](_0xd711('0x53'),_0x235428[_0xd711('0x54')],_0x235428['interactionId']);var _0x42059d=moment()[_0xd711('0x1f')](_0xd711('0x55'))[_0xd711('0x16')]();var _0x3cb8b8=htmlToPdfmake(_0x577b1b,{'window':window,'tableAutoSize':!![]});return{'content':[_0x3cb8b8],'defaultStyle':{'font':_0xd711('0x2a')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xd711('0x56'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xd711('0x56'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xd711('0x56')}},'header':function(){return[{'text':_0xd711('0x57'),'style':_0xd711('0x23')}];},'footer':function(_0x69ae6d,_0x3421d8){return[{'text':util[_0xd711('0x1f')](_0xd711('0x58'),_0x2e98e0,_0x69ae6d,_0x3421d8,_0x42059d),'style':'footer'}];}};}function writePDFDocument(_0xd1a8a9,_0x39d3aa){return new Promise(function(_0x10c107,_0x1ec45c){var _0x4f8a78=_0xd1a8a9[_0xd711('0x59')](fs['createWriteStream'](_0x39d3aa));_0x4f8a78['on'](_0xd711('0x5a'),function(){_0x10c107('finish');});_0x4f8a78['on']('error',function(_0xcb3cf5){_0x1ec45c(_0xcb3cf5);});_0xd1a8a9['end']();});}exports[_0xd711('0x5b')]=function(_0x4892f2,_0x8c60ce){var _0x2073fd=getPDFPrinter();var _0x8ed1be=getPDFDocDefinitionFromHTML(_0x4892f2,_0x8c60ce);var _0x2a69bf=_0x2073fd['createPdfKitDocument'](_0x8ed1be);return writePDFDocument(_0x2a69bf,_0x8c60ce[_0xd711('0x2')])[_0xd711('0x4c')](function(_0x1e6ba6){throw _0x1e6ba6;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index ad548fc..b293ac1 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 _0xf480=['../../mysqldb','dbH','../../config/logger','analytics','argv','savename','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','format','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','existsSync','join','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','path','lodash','json2xls','bluebird','zip-dir'];(function(_0x41882b,_0x39a1e8){var _0x35287=function(_0x39db15){while(--_0x39db15){_0x41882b['push'](_0x41882b['shift']());}};_0x35287(++_0x39a1e8);}(_0xf480,0xe6));var _0x0f48=function(_0x312ac7,_0x336bc5){_0x312ac7=_0x312ac7-0x0;var _0x370f6c=_0xf480[_0x312ac7];return _0x370f6c;};'use strict';var util=require('util');var path=require(_0x0f48('0x0'));var _=require(_0x0f48('0x1'));var fs=require('fs');var json2xls=require(_0x0f48('0x2'));var BPromise=require(_0x0f48('0x3'));var zipdir=require(_0x0f48('0x4'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x0f48('0x5'))[_0x0f48('0x6')];var logger=require(_0x0f48('0x7'))(_0x0f48('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x0f48('0x9')][0x2]);var QUERY=process[_0x0f48('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x458add,_0x3cf0f7){var _0x48eefa={'status':_0x458add};var _0x55061e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3cf0f7){_0x48eefa[_0x0f48('0xa')]=_0x3cf0f7;}return db['AnalyticExtractedReport']['update'](_0x48eefa,_0x55061e);}function main(){var _0x4e3c3c=0x1388;var _0x5dd443;logger[_0x0f48('0xb')](util['format'](_0x0f48('0xc'),EXTRACTED_REPORT_ID,_0x0f48('0xd')));return db[_0x0f48('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0f48('0xf'),_0x0f48('0x10')]})[_0x0f48('0x11')](function(_0x228f83){if(_0x228f83){_0x5dd443=_0x228f83;_0x4e3c3c=_0x5dd443[_0x0f48('0x10')]||0x1388;}})['then'](function(){return dbH[_0x0f48('0x12')][_0x0f48('0x13')](util['format'](_0x0f48('0x14'),QUERY),{'type':dbH['sequelize'][_0x0f48('0x15')][_0x0f48('0x16')]});})[_0x0f48('0x11')](function(_0x5df80f){if(!_0x5df80f[0x0][_0x0f48('0x17')]){return analyticExtractedReport(_0x0f48('0x18'));}var _0x2fd584=[];var _0xba354=0x0;if(_0x5dd443[_0x0f48('0xf')]){if(_0x5df80f&&_0x5df80f[_0x0f48('0x19')]){var _0x5f27b8=_[_0x0f48('0x1a')](_0x5df80f[0x0][_0x0f48('0x17')]/_0x4e3c3c);var _0x15eeae=Number[_0x0f48('0x1b')](_0x5df80f[0x0][_0x0f48('0x17')]/_0x4e3c3c)?_0x5df80f[0x0][_0x0f48('0x17')]%_0x4e3c3c:0x0;_0x5f27b8[_0x0f48('0x1c')](function(_0x327756){if(_0x327756>0x0){_0xba354+=_0x4e3c3c;}_0x2fd584[_0x0f48('0x1d')](dbH[_0x0f48('0x12')][_0x0f48('0x13')](util[_0x0f48('0x1e')](_0x0f48('0x1f'),QUERY,_0x4e3c3c,_0xba354),{'type':dbH[_0x0f48('0x12')][_0x0f48('0x15')]['SELECT']}));});if(_0x15eeae>0x0){_0xba354+=_0x4e3c3c;_0x2fd584['push'](dbH[_0x0f48('0x12')][_0x0f48('0x13')](util[_0x0f48('0x1e')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x15eeae,_0xba354),{'type':dbH[_0x0f48('0x12')]['QueryTypes'][_0x0f48('0x16')]}));}}}else{_0x2fd584[_0x0f48('0x1d')](dbH[_0x0f48('0x12')][_0x0f48('0x13')](QUERY,{'type':dbH['sequelize'][_0x0f48('0x15')][_0x0f48('0x16')]}));}var _0x340bb0=path['dirname'](PATH);var _0x58fed7=path[_0x0f48('0x20')](PATH,_0x0f48('0x21'));var _0x2f6dca=_0x5dd443[_0x0f48('0xf')]&&_0x2fd584['length']>0x1;var _0x41d299=[];if(!fs[_0x0f48('0x22')](path['join'](_0x340bb0,_0x58fed7))&&_0x2f6dca){fs['mkdirSync'](path[_0x0f48('0x23')](_0x340bb0,_0x58fed7));}return BPromise['each'](_0x2fd584,function(_0x3fc3de){_0x41d299[_0x0f48('0x1d')](_0x3fc3de);})['then'](function(){for(var _0x16930a=0x0;_0x16930a<_0x41d299[_0x0f48('0x19')];_0x16930a+=0x1){var _0x55d4af;var _0xfc42bf=_0x41d299[_0x16930a];if(_0x2f6dca){_0x55d4af=path[_0x0f48('0x23')](_0x340bb0,_0x58fed7,util[_0x0f48('0x1e')]('%s%d.%s',_0x58fed7,_0x16930a,_0x0f48('0x24')));}else{_0x55d4af=path[_0x0f48('0x23')](_0x340bb0,util[_0x0f48('0x1e')](_0x0f48('0x25'),_0x58fed7,_0x0f48('0x24')));}fs[_0x0f48('0x26')](_0x55d4af,json2xls(_0xfc42bf),_0x0f48('0x27'));}})[_0x0f48('0x11')](function(){if(_0x2f6dca){return new Promise(function(_0x3d4fa9){zipdir(path[_0x0f48('0x23')](_0x340bb0,_0x58fed7),{'saveTo':path['join'](_0x340bb0,util[_0x0f48('0x1e')](_0x0f48('0x25'),_0x58fed7,_0x0f48('0x28')))},function(_0x2d4b05,_0x554f98){rimraf(path[_0x0f48('0x23')](_0x340bb0,_0x58fed7),function(){});_0x3d4fa9(_0x0f48('0x29'));});});}})[_0x0f48('0x11')](function(){logger[_0x0f48('0xb')](util[_0x0f48('0x1e')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x0f48('0xd')));return analyticExtractedReport('Completed',_0x2f6dca?util[_0x0f48('0x1e')](_0x0f48('0x25'),_0x58fed7,_0x2f6dca?_0x0f48('0x28'):_0x0f48('0x24')):null);});})[_0x0f48('0x2a')](function(_0x3de77c){logger[_0x0f48('0xb')](util['format'](_0x0f48('0x2b'),EXTRACTED_REPORT_ID,_0x0f48('0xd')),util[_0x0f48('0x2c')](_0x3de77c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x0f48('0x2d')](function(){process[_0x0f48('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x5b9e=['query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize'];(function(_0x434543,_0x2fd498){var _0x3e6749=function(_0x5956f7){while(--_0x5956f7){_0x434543['push'](_0x434543['shift']());}};_0x3e6749(++_0x2fd498);}(_0x5b9e,0xe4));var _0xe5b9=function(_0x2bc409,_0x5355ac){_0x2bc409=_0x2bc409-0x0;var _0x294aa3=_0x5b9e[_0x2bc409];return _0x294aa3;};'use strict';var util=require(_0xe5b9('0x0'));var path=require(_0xe5b9('0x1'));var _=require(_0xe5b9('0x2'));var fs=require('fs');var json2xls=require(_0xe5b9('0x3'));var BPromise=require(_0xe5b9('0x4'));var zipdir=require(_0xe5b9('0x5'));var rimraf=require(_0xe5b9('0x6'));var db=require(_0xe5b9('0x7'))['db'];var dbH=require(_0xe5b9('0x7'))['dbH'];var logger=require(_0xe5b9('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xe5b9('0x9')][0x2]);var QUERY=process[_0xe5b9('0x9')][0x3];var PATH=process[_0xe5b9('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1a5498,_0x139c45){var _0x3f3b90={'status':_0x1a5498};var _0x2167c7={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x139c45){_0x3f3b90[_0xe5b9('0xa')]=_0x139c45;}return db[_0xe5b9('0xb')][_0xe5b9('0xc')](_0x3f3b90,_0x2167c7);}function main(){var _0x5d6d7c=0x1388;var _0x381b98;logger[_0xe5b9('0xd')](util['format'](_0xe5b9('0xe'),EXTRACTED_REPORT_ID,_0xe5b9('0xf')));return db[_0xe5b9('0x10')][_0xe5b9('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe5b9('0x12'),_0xe5b9('0x13')]})['then'](function(_0x149269){if(_0x149269){_0x381b98=_0x149269;_0x5d6d7c=_0x381b98['splitSizeXlsx']||0x1388;}})[_0xe5b9('0x14')](function(){return dbH[_0xe5b9('0x15')][_0xe5b9('0x16')](util[_0xe5b9('0x17')](_0xe5b9('0x18'),QUERY),{'type':dbH[_0xe5b9('0x15')][_0xe5b9('0x19')][_0xe5b9('0x1a')]});})[_0xe5b9('0x14')](function(_0x3c9c2d){if(!_0x3c9c2d[0x0][_0xe5b9('0x1b')]){return analyticExtractedReport(_0xe5b9('0x1c'));}var _0x1d315b=[];var _0x40324a=0x0;if(_0x381b98['split']){if(_0x3c9c2d&&_0x3c9c2d[_0xe5b9('0x1d')]){var _0x26e3ac=_[_0xe5b9('0x1e')](_0x3c9c2d[0x0][_0xe5b9('0x1b')]/_0x5d6d7c);var _0x421407=Number['isInteger'](_0x3c9c2d[0x0]['num']/_0x5d6d7c)?_0x3c9c2d[0x0][_0xe5b9('0x1b')]%_0x5d6d7c:0x0;_0x26e3ac[_0xe5b9('0x1f')](function(_0xa3bc63){if(_0xa3bc63>0x0){_0x40324a+=_0x5d6d7c;}_0x1d315b[_0xe5b9('0x20')](dbH[_0xe5b9('0x15')][_0xe5b9('0x16')](util[_0xe5b9('0x17')](_0xe5b9('0x21'),QUERY,_0x5d6d7c,_0x40324a),{'type':dbH[_0xe5b9('0x15')][_0xe5b9('0x19')][_0xe5b9('0x1a')]}));});if(_0x421407>0x0){_0x40324a+=_0x5d6d7c;_0x1d315b[_0xe5b9('0x20')](dbH[_0xe5b9('0x15')][_0xe5b9('0x16')](util[_0xe5b9('0x17')](_0xe5b9('0x21'),QUERY,_0x421407,_0x40324a),{'type':dbH[_0xe5b9('0x15')]['QueryTypes'][_0xe5b9('0x1a')]}));}}}else{_0x1d315b[_0xe5b9('0x20')](dbH[_0xe5b9('0x15')]['query'](QUERY,{'type':dbH[_0xe5b9('0x15')][_0xe5b9('0x19')][_0xe5b9('0x1a')]}));}var _0x5bd531=path[_0xe5b9('0x22')](PATH);var _0x4c6c17=path['basename'](PATH,_0xe5b9('0x23'));var _0x28a208=_0x381b98['split']&&_0x1d315b['length']>0x1;var _0x16f1d4=[];if(!fs[_0xe5b9('0x24')](path[_0xe5b9('0x25')](_0x5bd531,_0x4c6c17))&&_0x28a208){fs[_0xe5b9('0x26')](path['join'](_0x5bd531,_0x4c6c17));}return BPromise[_0xe5b9('0x27')](_0x1d315b,function(_0x181b38){_0x16f1d4['push'](_0x181b38);})[_0xe5b9('0x14')](function(){for(var _0x5bb79e=0x0;_0x5bb79e<_0x16f1d4[_0xe5b9('0x1d')];_0x5bb79e+=0x1){var _0x41bc08;var _0x38a81a=_0x16f1d4[_0x5bb79e];if(_0x28a208){_0x41bc08=path[_0xe5b9('0x25')](_0x5bd531,_0x4c6c17,util[_0xe5b9('0x17')](_0xe5b9('0x28'),_0x4c6c17,_0x5bb79e,_0xe5b9('0x29')));}else{_0x41bc08=path[_0xe5b9('0x25')](_0x5bd531,util[_0xe5b9('0x17')](_0xe5b9('0x2a'),_0x4c6c17,_0xe5b9('0x29')));}fs[_0xe5b9('0x2b')](_0x41bc08,json2xls(_0x38a81a),_0xe5b9('0x2c'));}})[_0xe5b9('0x14')](function(){if(_0x28a208){return new Promise(function(_0x35e37d){zipdir(path[_0xe5b9('0x25')](_0x5bd531,_0x4c6c17),{'saveTo':path[_0xe5b9('0x25')](_0x5bd531,util[_0xe5b9('0x17')](_0xe5b9('0x2a'),_0x4c6c17,_0xe5b9('0x2d')))},function(_0x2f611e,_0x229788){rimraf(path[_0xe5b9('0x25')](_0x5bd531,_0x4c6c17),function(){});_0x35e37d('zip\x20finished');});});}})[_0xe5b9('0x14')](function(){logger[_0xe5b9('0xd')](util['format'](_0xe5b9('0x2e'),EXTRACTED_REPORT_ID,_0xe5b9('0xf')));return analyticExtractedReport(_0xe5b9('0x2f'),_0x28a208?util[_0xe5b9('0x17')](_0xe5b9('0x2a'),_0x4c6c17,_0x28a208?_0xe5b9('0x2d'):_0xe5b9('0x29')):null);});})['catch'](function(_0x1be23c){logger[_0xe5b9('0xd')](util[_0xe5b9('0x17')](_0xe5b9('0x30'),EXTRACTED_REPORT_ID,_0xe5b9('0xf')),util['inspect'](_0x1be23c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe5b9('0x31'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 2aff965..352ef80 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 _0xa75a=['outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','interval','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','catch','error','rewrite','lodash','util','models','findAll','intervals','VoiceExtension','IntervalId','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','playback','extensions','extension','find','type','Set','format','context','priority','VoiceExtensionId','inbound','push','outbound','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix'];(function(_0x1699e9,_0x1f2652){var _0x14b104=function(_0x319079){while(--_0x319079){_0x1699e9['push'](_0x1699e9['shift']());}};_0x14b104(++_0x1f2652);}(_0xa75a,0x131));var _0xaa75=function(_0x5b077b,_0x50b707){_0x5b077b=_0x5b077b-0x0;var _0x16faf7=_0xa75a[_0x5b077b];return _0x16faf7;};'use strict';var _=require(_0xaa75('0x0'));var util=require(_0xaa75('0x1'));function rewrite(_0x55f5d6,_0x2dba49){var _0x300512=this;return _0x55f5d6[_0xaa75('0x2')]['Interval'][_0xaa75('0x3')]({'raw':!![]})['then'](function(_0x59615c){_0x300512[_0xaa75('0x4')]=_0x59615c;return _0x55f5d6[_0xaa75('0x2')][_0xaa75('0x5')][_0xaa75('0x3')]({'where':{'IntervalId':_0x2dba49[_0xaa75('0x6')]},'raw':!![]});})[_0xaa75('0x7')](function(_0x38d438){return _0x55f5d6['models'][_0xaa75('0x5')][_0xaa75('0x3')]({'where':{'exten':{'$in':_[_0xaa75('0x8')](_[_0xaa75('0x9')](_0x38d438,_0xaa75('0xa')))}},'order':[{'raw':_0xaa75('0xb')}],'raw':!![]});})[_0xaa75('0x7')](function(_0x4c9bf6){var _0x58d2dd=_['filter'](_0x4c9bf6,{'priority':'1'});var _0x1d5115=_[_0xaa75('0xc')](_0x4c9bf6,{'isApp':0x1});var _0x4f9d1f=_['groupBy'](_0x1d5115,_0xaa75('0xa'));var _0x418b6f=[_0xaa75('0xd'),_0xaa75('0xe')];var _0x1f7a4d=[];var _0x1d03b9=[];for(var _0x4190b0 in _0x4f9d1f){if(_0x4f9d1f['hasOwnProperty'](_0x4190b0)){_0x300512['priority']=0x2;_0x300512[_0xaa75('0xf')]=[];_0x300512[_0xaa75('0x10')]=_[_0xaa75('0x11')](_0x58d2dd,{'exten':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0xa')]});_0x300512['extensions']['push']({'type':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x12')],'app':_0xaa75('0x13'),'appdata':util[_0xaa75('0x14')]('CDR(type)=%s',_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x12')]),'context':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x15')],'exten':_0x4f9d1f[_0x4190b0][0x0]['exten'],'priority':_0x300512[_0xaa75('0x16')]++,'VoiceExtensionId':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x17')]});if(_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x12')]===_0xaa75('0x18')){_0x300512[_0xaa75('0xf')][_0xaa75('0x19')]({'type':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x12')],'app':_0xaa75('0x13'),'appdata':'CDR(routeid)='+_0x4f9d1f[_0x4190b0][0x0]['VoiceExtensionId'],'context':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x15')],'exten':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0xa')],'priority':_0x300512[_0xaa75('0x16')]++,'VoiceExtensionId':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x17')]});}else if(_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x12')]===_0xaa75('0x1a')){if(_0x300512['extension']){_0x300512['extensions'][_0xaa75('0x19')]({'type':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x12')],'app':_0xaa75('0x13'),'appdata':'CDR(destination)='+(_0x300512[_0xaa75('0x10')][_0xaa75('0x1b')]?_0xaa75('0x1c')+_0x300512[_0xaa75('0x10')][_0xaa75('0x1b')]+'}':_0xaa75('0x1d')),'context':_0x4f9d1f[_0x4190b0][0x0]['context'],'exten':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0xa')],'priority':_0x300512[_0xaa75('0x16')]++,'VoiceExtensionId':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x17')]});}_0x300512[_0xaa75('0xf')]['push']({'type':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x12')],'app':_0xaa75('0x13'),'appdata':_0xaa75('0x1e')+_0x4f9d1f[_0x4190b0][0x0]['VoiceExtensionId'],'context':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x15')],'exten':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0xa')],'priority':_0x300512[_0xaa75('0x16')]++,'VoiceExtensionId':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x17')]});var _0x14a52d=_0x300512[_0xaa75('0x16')]++;_0x300512[_0xaa75('0xf')][_0xaa75('0x19')]({'type':_0x4f9d1f[_0x4190b0][0x0]['type'],'app':_0xaa75('0x1f'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x14a52d+0x2)+_0xaa75('0x20')+(_0x14a52d+0x1)+')','context':_0x4f9d1f[_0x4190b0][0x0]['context'],'exten':_0x4f9d1f[_0x4190b0][0x0]['exten'],'priority':_0x14a52d,'VoiceExtensionId':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x17')]});if(_0x300512[_0xaa75('0x10')]){_0x300512[_0xaa75('0xf')]['push']({'type':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x12')],'app':_0xaa75('0x13'),'appdata':_0x300512[_0xaa75('0x10')]['cutdigits']?_0xaa75('0x21')+_0x300512['extension'][_0xaa75('0x1b')]+'}':_0xaa75('0x22'),'context':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x15')],'exten':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0xa')],'priority':_0x300512[_0xaa75('0x16')]++,'VoiceExtensionId':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x17')]});}_0x300512[_0xaa75('0xf')]['push']({'type':_0x4f9d1f[_0x4190b0][0x0]['type'],'app':'Set','appdata':_0xaa75('0x23')+_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x17')],'context':_0x4f9d1f[_0x4190b0][0x0]['context'],'exten':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0xa')],'priority':_0x300512[_0xaa75('0x16')]++,'VoiceExtensionId':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x17')]});if(_0x300512[_0xaa75('0x10')]&&_0x300512[_0xaa75('0x10')][_0xaa75('0x24')](_0xaa75('0x25'))&&_0x300512[_0xaa75('0x10')][_0xaa75('0x25')]!=='none'){_0x300512[_0xaa75('0xf')][_0xaa75('0x19')]({'type':_0x4f9d1f[_0x4190b0][0x0]['type'],'app':_0xaa75('0x13'),'appdata':_0xaa75('0x26'),'context':_0x4f9d1f[_0x4190b0][0x0]['context'],'exten':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0xa')],'priority':_0x300512['priority']++,'VoiceExtensionId':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x17')]});_0x300512[_0xaa75('0xf')]['push']({'type':_0x4f9d1f[_0x4190b0][0x0]['type'],'app':'Set','appdata':_0xaa75('0x27')+_0x300512[_0xaa75('0x10')]['recordingFormat']||'wav','context':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x15')],'exten':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0xa')],'priority':_0x300512[_0xaa75('0x16')]++,'VoiceExtensionId':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x17')]});}}_0x300512[_0xaa75('0xf')]['push']({'type':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x12')],'app':'Set','appdata':_0xaa75('0x28'),'context':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x15')],'exten':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0xa')],'priority':_0x300512[_0xaa75('0x16')]++,'VoiceExtensionId':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x17')]});_0x300512[_0xaa75('0xf')]['push']({'type':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x12')],'app':_0xaa75('0x13'),'appdata':_0xaa75('0x29'),'context':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x15')],'exten':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0xa')],'priority':_0x300512[_0xaa75('0x16')]++,'VoiceExtensionId':_0x4f9d1f[_0x4190b0][0x0]['VoiceExtensionId']});_0x300512['extensions'][_0xaa75('0x19')]({'type':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x12')],'app':_0xaa75('0x13'),'appdata':'MONITOR_OPTIONS=ab','context':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x15')],'exten':_0x4f9d1f[_0x4190b0][0x0]['exten'],'priority':_0x300512[_0xaa75('0x16')]++,'VoiceExtensionId':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x17')]});for(var _0x5ebb91=0x0,_0x31a283=0x0;_0x5ebb91<_0x4f9d1f[_0x4190b0][_0xaa75('0x2a')];_0x5ebb91+=0x1,_0x31a283=0x0){var _0x242d2e=_0x4f9d1f[_0x4190b0][_0x5ebb91];if(_0x242d2e[_0xaa75('0x12')]){_0x242d2e['type']=_0x242d2e[_0xaa75('0x12')][_0xaa75('0x2b')]();}var _0xe2e294=[];var _0x1810d5=[];delete _0x242d2e['id'];delete _0x242d2e['createdAt'];delete _0x242d2e['updatedAt'];var _0x113ef8=_0x242d2e[_0xaa75('0x2c')]!=='*,*,*,*'?[_0x242d2e['interval']]:_0x242d2e[_0xaa75('0x6')]?_[_0xaa75('0x9')](_[_0xaa75('0xc')](_0x300512[_0xaa75('0x4')],{'IntervalId':_0x242d2e[_0xaa75('0x6')]}),_0xaa75('0x2c')):[];if(_0x242d2e[_0xaa75('0x24')](_0xaa75('0x2d'))){if(_0x242d2e[_0xaa75('0x2d')]&&_0x242d2e[_0xaa75('0x2d')]!=='--'){_0xe2e294[_0xaa75('0x19')]({'type':_0x242d2e[_0xaa75('0x12')],'app':_0xaa75('0x13'),'appdata':_0xaa75('0x2e')+_0x242d2e[_0xaa75('0x2d')],'context':_0x242d2e['context'],'exten':_0x242d2e['exten'],'priority':_0x113ef8[_0xaa75('0x2a')]+_0x300512[_0xaa75('0x16')]+_0x31a283++,'VoiceExtensionId':_0x242d2e['VoiceExtensionId']});}}if(_0x242d2e[_0xaa75('0x12')]===_0xaa75('0x1a')&&_0x242d2e[_0xaa75('0x24')](_0xaa75('0x2f'))){if(_0x242d2e[_0xaa75('0x2f')]){_0xe2e294[_0xaa75('0x19')]({'type':_0x242d2e[_0xaa75('0x12')],'app':_0xaa75('0x1f'),'appdata':_0xaa75('0x30')+_0x242d2e[_0xaa75('0x2f')]+')','context':_0x242d2e[_0xaa75('0x15')],'exten':_0x242d2e[_0xaa75('0xa')],'priority':_0x113ef8[_0xaa75('0x2a')]+_0x300512[_0xaa75('0x16')]+_0x31a283++,'VoiceExtensionId':_0x242d2e['VoiceExtensionId']});}else{_0xe2e294[_0xaa75('0x19')]({'type':_0x242d2e[_0xaa75('0x12')],'app':_0xaa75('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x242d2e['context'],'exten':_0x242d2e[_0xaa75('0xa')],'priority':_0x113ef8[_0xaa75('0x2a')]+_0x300512[_0xaa75('0x16')]+_0x31a283++,'VoiceExtensionId':_0x242d2e[_0xaa75('0x17')]});}}if(_0x242d2e[_0xaa75('0x24')](_0xaa75('0x31'))){if(_0x418b6f[_0xaa75('0x32')](_0x242d2e[_0xaa75('0x33')]['toLowerCase']())>=0x0&&_0x242d2e[_0xaa75('0x34')]!==_0xaa75('0x35')){if(_0x242d2e[_0xaa75('0x31')]){_0xe2e294['push']({'type':_0x242d2e[_0xaa75('0x12')],'app':_0xaa75('0x1f'),'appdata':_0xaa75('0x36'),'context':_0x242d2e['context'],'exten':_0x242d2e[_0xaa75('0xa')],'priority':_0x113ef8['length']+_0x300512[_0xaa75('0x16')]+_0x31a283++,'VoiceExtensionId':_0x242d2e[_0xaa75('0x17')]});_0xe2e294[_0xaa75('0x19')]({'type':_0x242d2e['type'],'app':_0xaa75('0x13'),'appdata':_0xaa75('0x37'),'context':_0x242d2e[_0xaa75('0x15')],'exten':_0x242d2e[_0xaa75('0xa')],'priority':_0x113ef8['length']+_0x300512[_0xaa75('0x16')]+_0x31a283++,'VoiceExtensionId':_0x242d2e[_0xaa75('0x17')]});}else{_0xe2e294[_0xaa75('0x19')]({'type':_0x242d2e[_0xaa75('0x12')],'app':_0xaa75('0x1f'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x242d2e[_0xaa75('0x15')],'exten':_0x242d2e[_0xaa75('0xa')],'priority':_0x113ef8[_0xaa75('0x2a')]+_0x300512[_0xaa75('0x16')]+_0x31a283++,'VoiceExtensionId':_0x242d2e[_0xaa75('0x17')]});_0xe2e294[_0xaa75('0x19')]({'type':_0x242d2e[_0xaa75('0x12')],'app':_0xaa75('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x242d2e[_0xaa75('0x15')],'exten':_0x242d2e[_0xaa75('0xa')],'priority':_0x113ef8['length']+_0x300512[_0xaa75('0x16')]+_0x31a283++,'VoiceExtensionId':_0x242d2e[_0xaa75('0x17')]});}}}for(var _0x6ded07=0x0;_0x6ded07<_0x113ef8['length'];_0x6ded07+=0x1){var _0x3d74ff=_0x300512['priority']+_0x113ef8[_0xaa75('0x2a')];var _0x1432ed=_0x6ded07===_0x113ef8[_0xaa75('0x2a')]-0x1?_0x300512[_0xaa75('0x16')]+_0xe2e294['length']+_0x1810d5['length']+0x2:_0x300512[_0xaa75('0x16')]+_0x6ded07+0x1;_0xe2e294[_0xaa75('0x38')](_0x6ded07,0x0,{'type':_0x242d2e[_0xaa75('0x12')],'app':_0xaa75('0x39'),'appdata':_0x113ef8[_0x6ded07]+'?'+_0x242d2e[_0xaa75('0x15')]+',${EXTEN},'+_0x3d74ff+':'+_0x242d2e[_0xaa75('0x15')]+_0xaa75('0x3a')+_0x1432ed,'exten':_0x242d2e[_0xaa75('0xa')],'context':_0x242d2e[_0xaa75('0x15')],'priority':_0x300512['priority']+_0x6ded07,'VoiceExtensionId':_0x4f9d1f[_0x4190b0][0x0]['VoiceExtensionId']});}_0x242d2e[_0xaa75('0x16')]=_0xe2e294[_0xaa75('0x2a')]?_[_0xaa75('0x3b')](_0xe2e294)[_0xaa75('0x16')]+0x1:_0x300512[_0xaa75('0x16')];_0x300512['priority']=(_0x1810d5[_0xaa75('0x2a')]?_[_0xaa75('0x3b')](_0x1810d5)[_0xaa75('0x16')]:_0x242d2e['priority'])+0x1;_0x300512[_0xaa75('0xf')]=_[_0xaa75('0x3c')](_0x300512['extensions'],_0xe2e294,[_0x242d2e],_0x1810d5);}_0x300512[_0xaa75('0xf')][_0xaa75('0x19')]({'type':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x12')],'app':_0xaa75('0x3d'),'exten':_0x4f9d1f[_0x4190b0][0x0]['exten'],'context':_0x4f9d1f[_0x4190b0][0x0]['context'],'priority':_0x300512['priority'],'VoiceExtensionId':_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x17')]});_0x1f7a4d[_0xaa75('0x19')](_0x4f9d1f[_0x4190b0][0x0][_0xaa75('0x17')]);_0x1d03b9=_[_0xaa75('0x3c')](_0x1d03b9,_0x300512[_0xaa75('0xf')]);}}return _0x55f5d6[_0xaa75('0x3e')](function(_0x26a589){return _0x55f5d6[_0xaa75('0x2')][_0xaa75('0x5')][_0xaa75('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x1f7a4d}},'transaction':_0x26a589})[_0xaa75('0x7')](function(_0x5e057f){return _0x55f5d6[_0xaa75('0x2')]['VoiceExtension']['bulkCreate'](_[_0xaa75('0x40')](_0x1d03b9,_0xaa75('0x16')),{'transaction':_0x26a589});});});})[_0xaa75('0x41')](function(_0x5cab89){console[_0xaa75('0x42')](_0x5cab89);});}exports[_0xaa75('0x43')]=rewrite; \ No newline at end of file +var _0xeda9=['bulkCreate','sortBy','catch','rewrite','lodash','util','Interval','findAll','intervals','IntervalId','then','VoiceExtension','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','CDR(routeid)=','VoiceExtensionId','context','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','recordingFormat','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','createdAt','updatedAt','map','interval','length','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','concat','Hangup','transaction','models','destroy'];(function(_0x300c89,_0x25fcad){var _0x41762e=function(_0x5b852f){while(--_0x5b852f){_0x300c89['push'](_0x300c89['shift']());}};_0x41762e(++_0x25fcad);}(_0xeda9,0x8e));var _0x9eda=function(_0xe51596,_0x314d5b){_0xe51596=_0xe51596-0x0;var _0x22c705=_0xeda9[_0xe51596];return _0x22c705;};'use strict';var _=require(_0x9eda('0x0'));var util=require(_0x9eda('0x1'));function rewrite(_0x38abb6,_0x459a2c){var _0x376995=this;return _0x38abb6['models'][_0x9eda('0x2')][_0x9eda('0x3')]({'raw':!![]})['then'](function(_0x5ede60){_0x376995[_0x9eda('0x4')]=_0x5ede60;return _0x38abb6['models']['VoiceExtension'][_0x9eda('0x3')]({'where':{'IntervalId':_0x459a2c[_0x9eda('0x5')]},'raw':!![]});})[_0x9eda('0x6')](function(_0x345f71){return _0x38abb6['models'][_0x9eda('0x7')][_0x9eda('0x3')]({'where':{'exten':{'$in':_[_0x9eda('0x8')](_['map'](_0x345f71,_0x9eda('0x9')))}},'order':[{'raw':_0x9eda('0xa')}],'raw':!![]});})['then'](function(_0x2d1d7a){var _0x106014=_[_0x9eda('0xb')](_0x2d1d7a,{'priority':'1'});var _0x754480=_[_0x9eda('0xb')](_0x2d1d7a,{'isApp':0x1});var _0x317db3=_['groupBy'](_0x754480,_0x9eda('0x9'));var _0x46675f=['queue',_0x9eda('0xc')];var _0x2800b6=[];var _0x40cf60=[];for(var _0x23d964 in _0x317db3){if(_0x317db3[_0x9eda('0xd')](_0x23d964)){_0x376995[_0x9eda('0xe')]=0x2;_0x376995[_0x9eda('0xf')]=[];_0x376995[_0x9eda('0x10')]=_[_0x9eda('0x11')](_0x106014,{'exten':_0x317db3[_0x23d964][0x0][_0x9eda('0x9')]});_0x376995[_0x9eda('0xf')][_0x9eda('0x12')]({'type':_0x317db3[_0x23d964][0x0][_0x9eda('0x13')],'app':_0x9eda('0x14'),'appdata':util[_0x9eda('0x15')]('CDR(type)=%s',_0x317db3[_0x23d964][0x0][_0x9eda('0x13')]),'context':_0x317db3[_0x23d964][0x0]['context'],'exten':_0x317db3[_0x23d964][0x0][_0x9eda('0x9')],'priority':_0x376995[_0x9eda('0xe')]++,'VoiceExtensionId':_0x317db3[_0x23d964][0x0]['VoiceExtensionId']});if(_0x317db3[_0x23d964][0x0][_0x9eda('0x13')]==='inbound'){_0x376995[_0x9eda('0xf')][_0x9eda('0x12')]({'type':_0x317db3[_0x23d964][0x0][_0x9eda('0x13')],'app':_0x9eda('0x14'),'appdata':_0x9eda('0x16')+_0x317db3[_0x23d964][0x0][_0x9eda('0x17')],'context':_0x317db3[_0x23d964][0x0][_0x9eda('0x18')],'exten':_0x317db3[_0x23d964][0x0][_0x9eda('0x9')],'priority':_0x376995[_0x9eda('0xe')]++,'VoiceExtensionId':_0x317db3[_0x23d964][0x0]['VoiceExtensionId']});}else if(_0x317db3[_0x23d964][0x0][_0x9eda('0x13')]===_0x9eda('0x19')){if(_0x376995[_0x9eda('0x10')]){_0x376995[_0x9eda('0xf')][_0x9eda('0x12')]({'type':_0x317db3[_0x23d964][0x0]['type'],'app':'Set','appdata':_0x9eda('0x1a')+(_0x376995['extension'][_0x9eda('0x1b')]?_0x9eda('0x1c')+_0x376995[_0x9eda('0x10')][_0x9eda('0x1b')]+'}':_0x9eda('0x1d')),'context':_0x317db3[_0x23d964][0x0][_0x9eda('0x18')],'exten':_0x317db3[_0x23d964][0x0][_0x9eda('0x9')],'priority':_0x376995[_0x9eda('0xe')]++,'VoiceExtensionId':_0x317db3[_0x23d964][0x0][_0x9eda('0x17')]});}_0x376995['extensions'][_0x9eda('0x12')]({'type':_0x317db3[_0x23d964][0x0]['type'],'app':'Set','appdata':_0x9eda('0x16')+_0x317db3[_0x23d964][0x0][_0x9eda('0x17')],'context':_0x317db3[_0x23d964][0x0]['context'],'exten':_0x317db3[_0x23d964][0x0][_0x9eda('0x9')],'priority':_0x376995[_0x9eda('0xe')]++,'VoiceExtensionId':_0x317db3[_0x23d964][0x0][_0x9eda('0x17')]});var _0x2392d0=_0x376995[_0x9eda('0xe')]++;_0x376995[_0x9eda('0xf')][_0x9eda('0x12')]({'type':_0x317db3[_0x23d964][0x0][_0x9eda('0x13')],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x2392d0+0x2)+_0x9eda('0x1e')+(_0x2392d0+0x1)+')','context':_0x317db3[_0x23d964][0x0][_0x9eda('0x18')],'exten':_0x317db3[_0x23d964][0x0][_0x9eda('0x9')],'priority':_0x2392d0,'VoiceExtensionId':_0x317db3[_0x23d964][0x0]['VoiceExtensionId']});if(_0x376995[_0x9eda('0x10')]){_0x376995[_0x9eda('0xf')][_0x9eda('0x12')]({'type':_0x317db3[_0x23d964][0x0][_0x9eda('0x13')],'app':_0x9eda('0x14'),'appdata':_0x376995[_0x9eda('0x10')][_0x9eda('0x1b')]?_0x9eda('0x1f')+_0x376995[_0x9eda('0x10')][_0x9eda('0x1b')]+'}':_0x9eda('0x20'),'context':_0x317db3[_0x23d964][0x0][_0x9eda('0x18')],'exten':_0x317db3[_0x23d964][0x0][_0x9eda('0x9')],'priority':_0x376995['priority']++,'VoiceExtensionId':_0x317db3[_0x23d964][0x0][_0x9eda('0x17')]});}_0x376995[_0x9eda('0xf')]['push']({'type':_0x317db3[_0x23d964][0x0][_0x9eda('0x13')],'app':_0x9eda('0x14'),'appdata':_0x9eda('0x21')+_0x317db3[_0x23d964][0x0][_0x9eda('0x17')],'context':_0x317db3[_0x23d964][0x0][_0x9eda('0x18')],'exten':_0x317db3[_0x23d964][0x0][_0x9eda('0x9')],'priority':_0x376995[_0x9eda('0xe')]++,'VoiceExtensionId':_0x317db3[_0x23d964][0x0]['VoiceExtensionId']});if(_0x376995[_0x9eda('0x10')]&&_0x376995['extension'][_0x9eda('0xd')]('recordingFormat')&&_0x376995[_0x9eda('0x10')]['recordingFormat']!=='none'){_0x376995[_0x9eda('0xf')][_0x9eda('0x12')]({'type':_0x317db3[_0x23d964][0x0][_0x9eda('0x13')],'app':'Set','appdata':_0x9eda('0x22'),'context':_0x317db3[_0x23d964][0x0]['context'],'exten':_0x317db3[_0x23d964][0x0][_0x9eda('0x9')],'priority':_0x376995[_0x9eda('0xe')]++,'VoiceExtensionId':_0x317db3[_0x23d964][0x0]['VoiceExtensionId']});_0x376995[_0x9eda('0xf')][_0x9eda('0x12')]({'type':_0x317db3[_0x23d964][0x0]['type'],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x376995[_0x9eda('0x10')][_0x9eda('0x23')]||'wav','context':_0x317db3[_0x23d964][0x0][_0x9eda('0x18')],'exten':_0x317db3[_0x23d964][0x0][_0x9eda('0x9')],'priority':_0x376995[_0x9eda('0xe')]++,'VoiceExtensionId':_0x317db3[_0x23d964][0x0][_0x9eda('0x17')]});}}_0x376995[_0x9eda('0xf')]['push']({'type':_0x317db3[_0x23d964][0x0][_0x9eda('0x13')],'app':_0x9eda('0x14'),'appdata':_0x9eda('0x24'),'context':_0x317db3[_0x23d964][0x0][_0x9eda('0x18')],'exten':_0x317db3[_0x23d964][0x0]['exten'],'priority':_0x376995[_0x9eda('0xe')]++,'VoiceExtensionId':_0x317db3[_0x23d964][0x0][_0x9eda('0x17')]});_0x376995[_0x9eda('0xf')]['push']({'type':_0x317db3[_0x23d964][0x0][_0x9eda('0x13')],'app':_0x9eda('0x14'),'appdata':_0x9eda('0x25'),'context':_0x317db3[_0x23d964][0x0][_0x9eda('0x18')],'exten':_0x317db3[_0x23d964][0x0]['exten'],'priority':_0x376995[_0x9eda('0xe')]++,'VoiceExtensionId':_0x317db3[_0x23d964][0x0][_0x9eda('0x17')]});_0x376995[_0x9eda('0xf')]['push']({'type':_0x317db3[_0x23d964][0x0][_0x9eda('0x13')],'app':'Set','appdata':_0x9eda('0x26'),'context':_0x317db3[_0x23d964][0x0][_0x9eda('0x18')],'exten':_0x317db3[_0x23d964][0x0][_0x9eda('0x9')],'priority':_0x376995['priority']++,'VoiceExtensionId':_0x317db3[_0x23d964][0x0][_0x9eda('0x17')]});for(var _0x24a69b=0x0,_0x1701de=0x0;_0x24a69b<_0x317db3[_0x23d964]['length'];_0x24a69b+=0x1,_0x1701de=0x0){var _0x478820=_0x317db3[_0x23d964][_0x24a69b];if(_0x478820[_0x9eda('0x13')]){_0x478820['type']=_0x478820['type']['toLowerCase']();}var _0x4a69a4=[];var _0x45db71=[];delete _0x478820['id'];delete _0x478820[_0x9eda('0x27')];delete _0x478820[_0x9eda('0x28')];var _0x40388d=_0x478820['interval']!=='*,*,*,*'?[_0x478820['interval']]:_0x478820[_0x9eda('0x5')]?_[_0x9eda('0x29')](_[_0x9eda('0xb')](_0x376995[_0x9eda('0x4')],{'IntervalId':_0x478820['IntervalId']}),_0x9eda('0x2a')):[];if(_0x478820[_0x9eda('0xd')]('tag')){if(_0x478820['tag']&&_0x478820['tag']!=='--'){_0x4a69a4[_0x9eda('0x12')]({'type':_0x478820[_0x9eda('0x13')],'app':_0x9eda('0x14'),'appdata':'CDR(tag)='+_0x478820['tag'],'context':_0x478820['context'],'exten':_0x478820[_0x9eda('0x9')],'priority':_0x40388d[_0x9eda('0x2b')]+_0x376995[_0x9eda('0xe')]+_0x1701de++,'VoiceExtensionId':_0x478820[_0x9eda('0x17')]});}}if(_0x478820['type']===_0x9eda('0x19')&&_0x478820[_0x9eda('0xd')](_0x9eda('0x2c'))){if(_0x478820[_0x9eda('0x2c')]){_0x4a69a4['push']({'type':_0x478820[_0x9eda('0x13')],'app':_0x9eda('0x2d'),'appdata':_0x9eda('0x2e')+_0x478820[_0x9eda('0x2c')]+')','context':_0x478820['context'],'exten':_0x478820['exten'],'priority':_0x40388d[_0x9eda('0x2b')]+_0x376995[_0x9eda('0xe')]+_0x1701de++,'VoiceExtensionId':_0x478820['VoiceExtensionId']});}else{_0x4a69a4[_0x9eda('0x12')]({'type':_0x478820[_0x9eda('0x13')],'app':_0x9eda('0x2d'),'appdata':_0x9eda('0x2f'),'context':_0x478820['context'],'exten':_0x478820[_0x9eda('0x9')],'priority':_0x40388d[_0x9eda('0x2b')]+_0x376995[_0x9eda('0xe')]+_0x1701de++,'VoiceExtensionId':_0x478820[_0x9eda('0x17')]});}}if(_0x478820[_0x9eda('0xd')](_0x9eda('0x30'))){if(_0x46675f[_0x9eda('0x31')](_0x478820[_0x9eda('0x32')]['toLowerCase']())>=0x0&&_0x478820[_0x9eda('0x33')]!==_0x9eda('0x34')){if(_0x478820['answer']){_0x4a69a4['push']({'type':_0x478820[_0x9eda('0x13')],'app':_0x9eda('0x2d'),'appdata':_0x9eda('0x35'),'context':_0x478820[_0x9eda('0x18')],'exten':_0x478820[_0x9eda('0x9')],'priority':_0x40388d[_0x9eda('0x2b')]+_0x376995[_0x9eda('0xe')]+_0x1701de++,'VoiceExtensionId':_0x478820[_0x9eda('0x17')]});_0x4a69a4['push']({'type':_0x478820[_0x9eda('0x13')],'app':_0x9eda('0x14'),'appdata':_0x9eda('0x36'),'context':_0x478820[_0x9eda('0x18')],'exten':_0x478820[_0x9eda('0x9')],'priority':_0x40388d[_0x9eda('0x2b')]+_0x376995['priority']+_0x1701de++,'VoiceExtensionId':_0x478820['VoiceExtensionId']});}else{_0x4a69a4[_0x9eda('0x12')]({'type':_0x478820['type'],'app':_0x9eda('0x2d'),'appdata':_0x9eda('0x37'),'context':_0x478820[_0x9eda('0x18')],'exten':_0x478820[_0x9eda('0x9')],'priority':_0x40388d['length']+_0x376995['priority']+_0x1701de++,'VoiceExtensionId':_0x478820[_0x9eda('0x17')]});_0x4a69a4[_0x9eda('0x12')]({'type':_0x478820['type'],'app':_0x9eda('0x14'),'appdata':_0x9eda('0x38'),'context':_0x478820['context'],'exten':_0x478820[_0x9eda('0x9')],'priority':_0x40388d[_0x9eda('0x2b')]+_0x376995[_0x9eda('0xe')]+_0x1701de++,'VoiceExtensionId':_0x478820['VoiceExtensionId']});}}}for(var _0x13ff10=0x0;_0x13ff10<_0x40388d[_0x9eda('0x2b')];_0x13ff10+=0x1){var _0xea7fb=_0x376995['priority']+_0x40388d['length'];var _0x41fd6d=_0x13ff10===_0x40388d[_0x9eda('0x2b')]-0x1?_0x376995[_0x9eda('0xe')]+_0x4a69a4[_0x9eda('0x2b')]+_0x45db71[_0x9eda('0x2b')]+0x2:_0x376995['priority']+_0x13ff10+0x1;_0x4a69a4[_0x9eda('0x39')](_0x13ff10,0x0,{'type':_0x478820[_0x9eda('0x13')],'app':_0x9eda('0x3a'),'appdata':_0x40388d[_0x13ff10]+'?'+_0x478820[_0x9eda('0x18')]+',${EXTEN},'+_0xea7fb+':'+_0x478820[_0x9eda('0x18')]+_0x9eda('0x3b')+_0x41fd6d,'exten':_0x478820['exten'],'context':_0x478820[_0x9eda('0x18')],'priority':_0x376995['priority']+_0x13ff10,'VoiceExtensionId':_0x317db3[_0x23d964][0x0][_0x9eda('0x17')]});}_0x478820['priority']=_0x4a69a4[_0x9eda('0x2b')]?_['last'](_0x4a69a4)[_0x9eda('0xe')]+0x1:_0x376995[_0x9eda('0xe')];_0x376995[_0x9eda('0xe')]=(_0x45db71[_0x9eda('0x2b')]?_['last'](_0x45db71)[_0x9eda('0xe')]:_0x478820['priority'])+0x1;_0x376995['extensions']=_[_0x9eda('0x3c')](_0x376995[_0x9eda('0xf')],_0x4a69a4,[_0x478820],_0x45db71);}_0x376995[_0x9eda('0xf')]['push']({'type':_0x317db3[_0x23d964][0x0][_0x9eda('0x13')],'app':_0x9eda('0x3d'),'exten':_0x317db3[_0x23d964][0x0][_0x9eda('0x9')],'context':_0x317db3[_0x23d964][0x0][_0x9eda('0x18')],'priority':_0x376995[_0x9eda('0xe')],'VoiceExtensionId':_0x317db3[_0x23d964][0x0]['VoiceExtensionId']});_0x2800b6['push'](_0x317db3[_0x23d964][0x0][_0x9eda('0x17')]);_0x40cf60=_['concat'](_0x40cf60,_0x376995['extensions']);}}return _0x38abb6[_0x9eda('0x3e')](function(_0x403050){return _0x38abb6[_0x9eda('0x3f')][_0x9eda('0x7')][_0x9eda('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x2800b6}},'transaction':_0x403050})['then'](function(_0x5c190f){return _0x38abb6['models']['VoiceExtension'][_0x9eda('0x41')](_[_0x9eda('0x42')](_0x40cf60,_0x9eda('0xe')),{'transaction':_0x403050});});});})[_0x9eda('0x43')](function(_0x898adf){console['error'](_0x898adf);});}exports[_0x9eda('0x44')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index d74b032..ad561ff 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 _0x493c=['The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','message','join','data','firstName','phone','birthDate','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','length','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','into','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','then','get','always','query','onlyIfOpen','push','sequelize','all','BlackLists','VoiceQueueId','Campaign','CampaignId','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','pause','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','papaparse','ioredis','../../../mysqldb','../../../config/logger','api','defaults','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil'];(function(_0x5091c9,_0x2972f3){var _0xef1ca0=function(_0x2a9739){while(--_0x2a9739){_0x5091c9['push'](_0x5091c9['shift']());}};_0xef1ca0(++_0x2972f3);}(_0x493c,0x1ef));var _0xc493=function(_0xb344a9,_0x2996a4){_0xb344a9=_0xb344a9-0x0;var _0x473205=_0x493c[_0xb344a9];return _0x473205;};'use strict';var BPromise=require(_0xc493('0x0'));var util=require(_0xc493('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require(_0xc493('0x2'));var Redis=require(_0xc493('0x3'));var db=require(_0xc493('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0xc493('0x5'))(_0xc493('0x6'));config['redis']=_[_0xc493('0x7')](config[_0xc493('0x8')],{'host':_0xc493('0x9'),'port':0x18eb});var socket=require(_0xc493('0xa'))(new Redis(config[_0xc493('0x8')]));require(_0xc493('0xb'))['register'](socket);try{if(!process[_0xc493('0xc')][0x2]||process['argv'][0x2]===_0xc493('0xd')||process[_0xc493('0xc')][0x2]===_0xc493('0xe')){throw new Error(_0xc493('0xf'));}var FILEPATH=process[_0xc493('0xc')][0x2];if(!process['argv'][0x3]||process[_0xc493('0xc')][0x3]===_0xc493('0xd')||process[_0xc493('0xc')][0x3]==='null'||!process[_0xc493('0xc')][0x4]||process[_0xc493('0xc')][0x4]===_0xc493('0xd')||process[_0xc493('0xc')][0x4]==='null'){throw new Error(_0xc493('0x10'));}var FIELDS=_[_0xc493('0x11')](process[_0xc493('0xc')][0x3][_0xc493('0x12')](','),process[_0xc493('0xc')][0x4][_0xc493('0x12')](','));if(!process[_0xc493('0xc')][0x5]||process[_0xc493('0xc')][0x5]===_0xc493('0xd')||process['argv'][0x5]===_0xc493('0xe')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xc493('0xc')][0x5];var COMPANYID=process[_0xc493('0xc')][0x6]&&process['argv'][0x6]!==_0xc493('0xd')&&process[_0xc493('0xc')][0x6]!==_0xc493('0xe')?process[_0xc493('0xc')][0x6]:null;var DUPLICATES=process[_0xc493('0xc')][0x7]&&process[_0xc493('0xc')][0x7]!=='undefined'&&process[_0xc493('0xc')][0x7]!==_0xc493('0xe')?process['argv'][0x7]:null;if(!process['argv'][0x8]||process[_0xc493('0xc')][0x8]===_0xc493('0xd')||process['argv'][0x8]==='null'){throw new Error(_0xc493('0x13'));}var SOCKET_TIMESTAMP=process[_0xc493('0xc')][0x8];}catch(_0x2cac0a){logger[_0xc493('0x14')](_0x2cac0a);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(_0x453b80,_0xd2ed3f,_0x594d60,_0x44e22c){var _0x521df5={'message':_0xd2ed3f};_0x521df5[_0x453b80]=!![];if(_0x594d60){_0x521df5[_0xc493('0x15')]=_0x594d60;}if(_0x44e22c){_0x521df5[_0xc493('0x16')]=_0x44e22c;}return _0x521df5;}function isEmail(_0x4c7ad7){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))*$/[_0xc493('0x17')](_0x4c7ad7);}function checkRow(_0x504f79,_0x2894d1,_0x348e1e){return new BPromise(function(_0x3d766f,_0x49e870){if(_[_0xc493('0x18')](_0x504f79)){return _0x49e870(handleCheckRowError(_0xc493('0x14'),_0xc493('0x19'),null,_0x348e1e));}if(_0x504f79[_0xc493('0x1a')]&&_0x504f79['errors']['length']){var _0xa2c3be=_['map'](_0x504f79[_0xc493('0x1a')],_0xc493('0x1b'))[_0xc493('0x1c')](';');return _0x49e870(handleCheckRowError(_0xc493('0x14'),_0xa2c3be,null,_0x348e1e));}var _0x41445c={};for(var _0x1778fd in FIELDS){if(FIELDS['hasOwnProperty'](_0x1778fd)&&FIELDS[_0x1778fd]){_0x41445c[_0x1778fd]=_0x504f79[_0xc493('0x1d')][0x0][FIELDS[_0x1778fd]]||_0x504f79[_0xc493('0x1d')][0x0]['\ufeff'+FIELDS[_0x1778fd]];}}if(!_0x41445c[_0xc493('0x1e')]){return _0x49e870(handleCheckRowError('error','firstName\x20not\x20specified!',null,_0x348e1e));}if(!_0x41445c[_0xc493('0x1f')]){return _0x49e870(handleCheckRowError(_0xc493('0x14'),'phone\x20not\x20specified!',null,_0x348e1e));}if(_0x41445c[_0xc493('0x20')]){var _0x99963c=moment(_0x41445c[_0xc493('0x20')],'YYYY-MM-DD');if(!_0x99963c['isValid']()){return _0x49e870(handleCheckRowError(_0xc493('0x14'),_0xc493('0x21'),null,_0x348e1e));}}if(_0x41445c[_0xc493('0x22')]){if(!isEmail(_0x41445c[_0xc493('0x22')])){return _0x49e870(handleCheckRowError(_0xc493('0x14'),_0xc493('0x23'),null,_0x348e1e));}}_0x41445c[_0xc493('0x24')]=LISTID;_0x41445c['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xc493('0x25')]&&_0x2894d1){var _0xe52669={};for(var _0x4ec240=0x0,_0x19472a=DUPLICATES[_0xc493('0x25')];_0x4ec240<_0x19472a;_0x4ec240+=0x1){_0xe52669[DUPLICATES[_0x4ec240]]=_0x41445c[DUPLICATES[_0x4ec240]];}var _0x3ab460=_[_0xc493('0x26')](_0x2894d1,_0xe52669);if(_0x3ab460){return _0x49e870(handleCheckRowError(_0xc493('0x27'),_0xc493('0x28'),_0x3ab460,_0x348e1e));}}return db[_0xc493('0x29')][_0xc493('0x2a')](_0x41445c,{'raw':!![],'hooks':![],'fields':_[_0xc493('0x2b')](_0x41445c)})['then'](function(_0x2763d3){if(DUPLICATES&&DUPLICATES['length']&&_0x2894d1){_0x2894d1['push'](_['pick'](_0x41445c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2763d3['id'];return _0x3d766f();})[_0xc493('0x2c')](function(_0x5000d3){return _0x49e870(handleCheckRowError('error',_0xc493('0x2d')+(_0x5000d3[_0xc493('0x1b')]||JSON[_0xc493('0x2e')](_0x5000d3)),null,_0x348e1e));});});}function checkHopper(){function _0x5921cb(){return function(_0x14224d){logger['error'](_0xc493('0x2f'),_0xc493('0x30'),util[_0xc493('0x31')](_0x14224d,{'showHidden':![],'depth':null}));};}var _0x3287f4=function(_0x486c8b,_0x5d08f5){var _0x45f36e=squel['insert']()['into'](_0xc493('0x32'))[_0xc493('0x33')]([_0xc493('0x1f'),_0xc493('0x34'),_0xc493('0x35'),_0xc493('0x24'),_0x5d08f5,_0xc493('0x36'),_0xc493('0x37')],squel[_0xc493('0x38')]()[_0xc493('0x39')](_0xc493('0x1f'),_0xc493('0x1f'))[_0xc493('0x39')](_0xc493('0x3a'),_0xc493('0x34'))[_0xc493('0x39')]('id',_0xc493('0x35'))['field'](LISTID[_0xc493('0x3b')](),'ListId')[_0xc493('0x39')](_0x486c8b['id']['toString'](),_0x5d08f5)[_0xc493('0x39')](_0xc493('0x3a'),_0xc493('0x36'))[_0xc493('0x39')]('NOW()',_0xc493('0x37'))[_0xc493('0x3c')](_0xc493('0x3d'))[_0xc493('0x3e')]('deletedAt\x20IS\x20NULL')[_0xc493('0x3e')](_0xc493('0x3f'),LISTID[_0xc493('0x3b')]())[_0xc493('0x3e')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xc493('0x40'),squel[_0xc493('0x38')]()['field'](_0xc493('0x1f'))[_0xc493('0x3c')](_0xc493('0x32'))[_0xc493('0x3e')](_0x5d08f5+_0xc493('0x41'),_0x486c8b['id'][_0xc493('0x3b')]())))['toString']();return _0x45f36e;};var _0xb903d2=function(_0x48dfa3,_0x1a40ce){var _0x54e850=squel[_0xc493('0x42')]()['into'](_0xc493('0x32'))[_0xc493('0x33')]([_0xc493('0x1f'),_0xc493('0x34'),_0xc493('0x35'),_0xc493('0x24'),_0x1a40ce,'createdAt','updatedAt'],squel['select']()[_0xc493('0x39')](_0xc493('0x1f'),'phone')[_0xc493('0x39')](_0xc493('0x3a'),_0xc493('0x34'))['field']('id',_0xc493('0x35'))['field'](LISTID[_0xc493('0x3b')](),'ListId')[_0xc493('0x39')](_0x48dfa3['id'][_0xc493('0x3b')](),_0x1a40ce)['field'](_0xc493('0x3a'),'createdAt')['field'](_0xc493('0x3a'),_0xc493('0x37'))[_0xc493('0x3c')]('cm_contacts')[_0xc493('0x3e')](_0xc493('0x43'))[_0xc493('0x3e')](_0xc493('0x3f'),LISTID[_0xc493('0x3b')]())[_0xc493('0x3e')](_0xc493('0x44'),squel[_0xc493('0x45')](hopperContacts))[_0xc493('0x3e')](_0xc493('0x46'))[_0xc493('0x3e')](_0xc493('0x40'),squel['select']()[_0xc493('0x39')](_0xc493('0x47'))[_0xc493('0x3c')](_0xc493('0x48'))[_0xc493('0x3e')](_0x1a40ce+_0xc493('0x41'),_0x48dfa3['id']['toString']()))['where'](_0xc493('0x40'),squel[_0xc493('0x38')]()[_0xc493('0x39')](_0xc493('0x1f'))[_0xc493('0x3c')](_0xc493('0x32'))['where'](_0x1a40ce+_0xc493('0x41'),_0x48dfa3['id']['toString']())))[_0xc493('0x3b')]();return _0x54e850;};function _0x25df02(_0x5720ab,_0x3683ab){var _0x5d9998=squel['insert']()[_0xc493('0x49')](_0xc493('0x32'))[_0xc493('0x33')](['phone','scheduledAt',_0xc493('0x35'),_0xc493('0x24'),_0x3683ab,'createdAt','updatedAt'],squel[_0xc493('0x38')]()[_0xc493('0x39')](_0xc493('0x1f'),'phone')[_0xc493('0x39')](_0xc493('0x3a'),'scheduledAt')[_0xc493('0x39')]('id',_0xc493('0x35'))['field'](LISTID[_0xc493('0x3b')](),_0xc493('0x24'))['field'](_0x5720ab['id'][_0xc493('0x3b')](),_0x3683ab)['field'](_0xc493('0x3a'),'createdAt')[_0xc493('0x39')]('NOW()',_0xc493('0x37'))[_0xc493('0x3c')](_0xc493('0x3d'))['where'](_0xc493('0x43'))[_0xc493('0x3e')](_0xc493('0x3f'),LISTID[_0xc493('0x3b')]())[_0xc493('0x3e')](_0xc493('0x44'),squel['str'](hopperContacts))[_0xc493('0x3e')]('phone\x20IS\x20NOT\x20NULL'))[_0xc493('0x3b')]();return _0x5d9998;}function _0x2be181(_0x30aae9,_0xdbe481){var _0x28f291=squel['insert']()[_0xc493('0x49')](_0xc493('0x4a'))[_0xc493('0x33')]([_0xc493('0x1f'),'ContactId',_0xc493('0x24'),_0xdbe481,_0xc493('0x36'),'updatedAt'],squel[_0xc493('0x38')]()['field'](_0xc493('0x1f'),_0xc493('0x1f'))[_0xc493('0x39')]('id',_0xc493('0x35'))['field'](LISTID[_0xc493('0x3b')](),'ListId')[_0xc493('0x39')](_0x30aae9['id'][_0xc493('0x3b')](),_0xdbe481)['field'](_0xc493('0x3a'),_0xc493('0x36'))[_0xc493('0x39')](_0xc493('0x3a'),'updatedAt')[_0xc493('0x3c')](_0xc493('0x3d'))[_0xc493('0x3e')](_0xc493('0x43'))['where'](_0xc493('0x3f'),LISTID[_0xc493('0x3b')]())[_0xc493('0x3e')]('id\x20IN\x20?',squel[_0xc493('0x45')](hopperContacts))[_0xc493('0x3e')](_0xc493('0x46')))[_0xc493('0x3b')]();return _0x28f291;}return db[_0xc493('0x4b')][_0xc493('0x4c')]({'where':{'type':_0xc493('0x4d')},'attributes':['id',_0xc493('0x4e')],'include':[{'model':db[_0xc493('0x4f')],'as':_0xc493('0x50'),'where':{'id':LISTID}}]})[_0xc493('0x51')](function(_0x5e59b9){var _0xb70cc1=[];if(_0x5e59b9){var _0x141747;for(var _0x256f4a=0x0,_0x2e3006;_0x256f4a<_0x5e59b9[_0xc493('0x25')];_0x256f4a+=0x1){_0x2e3006=_0x5e59b9[_0x256f4a][_0xc493('0x52')]({'plain':!![]});switch(_0x2e3006[_0xc493('0x4e')]){case _0xc493('0x53'):_0xb70cc1['push'](db['sequelize'][_0xc493('0x54')](_0xb903d2(_0x2e3006,'VoiceQueueId'))[_0xc493('0x51')](function(){})[_0xc493('0x2c')](_0x5921cb()));break;case _0xc493('0x55'):_0xb70cc1[_0xc493('0x56')](db['sequelize'][_0xc493('0x54')](_0x3287f4(_0x2e3006,'VoiceQueueId'))[_0xc493('0x51')](function(){})['catch'](_0x5921cb()));break;default:_0xb70cc1['push'](db[_0xc493('0x57')][_0xc493('0x54')](_0x25df02(_0x2e3006,'VoiceQueueId'))[_0xc493('0x51')](function(){})['catch'](_0x5921cb()));}}}return _0xb70cc1;})[_0xc493('0x58')]()['then'](function(){return db[_0xc493('0x4b')][_0xc493('0x4c')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xc493('0x59'),'where':{'id':LISTID}}]})[_0xc493('0x51')](function(_0x5a20e7){var _0x262870=[];if(_0x5a20e7){var _0x13fb42;for(var _0x15b269=0x0,_0x4a30ab;_0x15b269<_0x5a20e7[_0xc493('0x25')];_0x15b269+=0x1){_0x4a30ab=_0x5a20e7[_0x15b269][_0xc493('0x52')]({'plain':!![]});_0x262870[_0xc493('0x56')](db[_0xc493('0x57')][_0xc493('0x54')](_0x2be181(_0x4a30ab,_0xc493('0x5a')))[_0xc493('0x51')](function(){})[_0xc493('0x2c')](_0x5921cb()));}}return _0x262870;})[_0xc493('0x58')]();})[_0xc493('0x51')](function(){return db[_0xc493('0x5b')][_0xc493('0x4c')]({'attributes':['id',_0xc493('0x4e')],'include':[{'model':db[_0xc493('0x4f')],'as':'Lists','where':{'id':LISTID}}]})[_0xc493('0x51')](function(_0x2f6166){var _0x262b3e=[];if(_0x2f6166){for(var _0x14a177=0x0,_0x1f1b31;_0x14a177<_0x2f6166[_0xc493('0x25')];_0x14a177+=0x1){_0x1f1b31=_0x2f6166[_0x14a177][_0xc493('0x52')]({'plain':!![]});switch(_0x1f1b31[_0xc493('0x4e')]){case _0xc493('0x53'):_0x262b3e[_0xc493('0x56')](db['sequelize'][_0xc493('0x54')](_0xb903d2(_0x1f1b31,'CampaignId'))[_0xc493('0x51')](function(){})[_0xc493('0x2c')](_0x5921cb()));break;case _0xc493('0x55'):_0x262b3e[_0xc493('0x56')](db['sequelize'][_0xc493('0x54')](_0x3287f4(_0x1f1b31,_0xc493('0x5c')))[_0xc493('0x51')](function(){})[_0xc493('0x2c')](_0x5921cb()));break;default:_0x262b3e['push'](db[_0xc493('0x57')][_0xc493('0x54')](_0x25df02(_0x1f1b31,_0xc493('0x5c')))[_0xc493('0x51')](function(){})[_0xc493('0x2c')](_0x5921cb()));}}}return _0x262b3e;})[_0xc493('0x58')]();})[_0xc493('0x51')](function(){return db[_0xc493('0x5b')][_0xc493('0x4c')]({'attributes':['id'],'include':[{'model':db[_0xc493('0x4f')],'as':_0xc493('0x59'),'where':{'id':LISTID}}]})[_0xc493('0x51')](function(_0x3122cb){var _0x21b2a6=[];if(_0x3122cb){for(var _0x4dc5ee=0x0,_0xce91f4;_0x4dc5ee<_0x3122cb[_0xc493('0x25')];_0x4dc5ee+=0x1){_0xce91f4=_0x3122cb[_0x4dc5ee][_0xc493('0x52')]({'plain':!![]});_0x21b2a6[_0xc493('0x56')](db['sequelize'][_0xc493('0x54')](_0x2be181(_0xce91f4,_0xc493('0x5c')))[_0xc493('0x51')](function(){})[_0xc493('0x2c')](_0x5921cb()));}}return _0x21b2a6;})[_0xc493('0x58')]();})[_0xc493('0x2c')](function(_0x4c63b2){logger[_0xc493('0x14')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x4c63b2[_0xc493('0x1b')]);});}var processPromises=function(_0x3cf82e){return BPromise[_0xc493('0x58')](promises)['then'](function(_0x3bbe63){})[_0xc493('0x2c')](function(_0x106c1e){logger[_0xc493('0x14')](_0xc493('0x5d'),JSON[_0xc493('0x2e')](_0x106c1e));})[_0xc493('0x5e')](function(){socket['emit'](_0xc493('0x5f')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3cf82e){return _0x3cf82e['resume']();}});};var endCsv=function(){return BPromise[_0xc493('0x60')]()[_0xc493('0x51')](function(){if(hopperContacts){return checkHopper();}})[_0xc493('0x51')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xc493('0x61')](FILEPATH);}catch(_0x126e38){logger[_0xc493('0x14')](_0xc493('0x62'),JSON[_0xc493('0x2e')](_0x126e38));}finally{process[_0xc493('0x63')](0x0);}});};process['on']('SIGINT',function(){logger[_0xc493('0x64')](_0xc493('0x65'));endCsv();});function main(){return BPromise[_0xc493('0x60')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db['CmContact'][_0xc493('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xc493('0x51')](function(_0x3886b2){var _0x4a2a20=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x4a2a20,{'header':!![],'skipEmptyLines':!![],'step':function(_0x598919,_0x59a473){total+=0x1;var _0x4cf113=total;promises['push'](checkRow(_0x598919,_0x3886b2,_0x4cf113)[_0xc493('0x51')](function(){success+=0x1;})[_0xc493('0x2c')](function(_0x229ad7){if(_0x229ad7[_0xc493('0x14')]){errors+=0x1;delete _0x229ad7[_0xc493('0x14')];}else if(_0x229ad7[_0xc493('0x27')]){duplicates+=0x1;delete _0x229ad7['duplicate'];}rows['push'](_0x229ad7);}));if(total%0xc8===0x0){_0x59a473[_0xc493('0x66')]();return processPromises(_0x59a473);}},'complete':function(){return processPromises()[_0xc493('0x51')](function(){logger[_0xc493('0x64')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x504c01,_0x1e466b){logger[_0xc493('0x64')]('CSV\x20parse\x20error',JSON[_0xc493('0x2e')](_0x504c01));endCsv();}});})[_0xc493('0x2c')](function(_0x5bac07){logger[_0xc493('0x14')](_0xc493('0x67'),JSON[_0xc493('0x2e')](_0x5bac07));});}main(); \ No newline at end of file +var _0xc8c3=['cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','calleridnum','cm_hopper_final','str','phone\x20IS\x20NOT\x20NULL','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','resolve','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','hasOwnProperty','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','insert','into'];(function(_0x58ab75,_0x31fffb){var _0x18693d=function(_0x79e6e){while(--_0x79e6e){_0x58ab75['push'](_0x58ab75['shift']());}};_0x18693d(++_0x31fffb);}(_0xc8c3,0xa5));var _0x3c8c=function(_0x49f67f,_0x4113a4){_0x49f67f=_0x49f67f-0x0;var _0x4779a1=_0xc8c3[_0x49f67f];return _0x4779a1;};'use strict';var BPromise=require('bluebird');var util=require(_0x3c8c('0x0'));var _=require(_0x3c8c('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x3c8c('0x2'));var db=require('../../../mysqldb')['db'];var config=require(_0x3c8c('0x3'));var logger=require(_0x3c8c('0x4'))(_0x3c8c('0x5'));config[_0x3c8c('0x6')]=_[_0x3c8c('0x7')](config['redis'],{'host':_0x3c8c('0x8'),'port':0x18eb});var socket=require(_0x3c8c('0x9'))(new Redis(config[_0x3c8c('0x6')]));require(_0x3c8c('0xa'))[_0x3c8c('0xb')](socket);try{if(!process[_0x3c8c('0xc')][0x2]||process['argv'][0x2]===_0x3c8c('0xd')||process[_0x3c8c('0xc')][0x2]==='null'){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process[_0x3c8c('0xc')][0x3]||process['argv'][0x3]===_0x3c8c('0xd')||process[_0x3c8c('0xc')][0x3]===_0x3c8c('0xe')||!process[_0x3c8c('0xc')][0x4]||process[_0x3c8c('0xc')][0x4]===_0x3c8c('0xd')||process[_0x3c8c('0xc')][0x4]===_0x3c8c('0xe')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x3c8c('0xf')](process['argv'][0x3][_0x3c8c('0x10')](','),process[_0x3c8c('0xc')][0x4][_0x3c8c('0x10')](','));if(!process[_0x3c8c('0xc')][0x5]||process[_0x3c8c('0xc')][0x5]===_0x3c8c('0xd')||process[_0x3c8c('0xc')][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x3c8c('0xc')][0x6]&&process[_0x3c8c('0xc')][0x6]!==_0x3c8c('0xd')&&process[_0x3c8c('0xc')][0x6]!=='null'?process[_0x3c8c('0xc')][0x6]:null;var DUPLICATES=process[_0x3c8c('0xc')][0x7]&&process[_0x3c8c('0xc')][0x7]!=='undefined'&&process['argv'][0x7]!==_0x3c8c('0xe')?process[_0x3c8c('0xc')][0x7]:null;if(!process[_0x3c8c('0xc')][0x8]||process[_0x3c8c('0xc')][0x8]===_0x3c8c('0xd')||process[_0x3c8c('0xc')][0x8]==='null'){throw new Error(_0x3c8c('0x11'));}var SOCKET_TIMESTAMP=process[_0x3c8c('0xc')][0x8];}catch(_0x189656){logger[_0x3c8c('0x12')](_0x189656);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(_0x4f1d32,_0x15c7b4,_0x4c8b6c,_0x4fc38c){var _0x1e9166={'message':_0x15c7b4};_0x1e9166[_0x4f1d32]=!![];if(_0x4c8b6c){_0x1e9166[_0x3c8c('0x13')]=_0x4c8b6c;}if(_0x4fc38c){_0x1e9166[_0x3c8c('0x14')]=_0x4fc38c;}return _0x1e9166;}function isEmail(_0x1d9a62){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))*$/[_0x3c8c('0x15')](_0x1d9a62);}function checkRow(_0x58a08e,_0x1c4f5f,_0x3ec5bb){return new BPromise(function(_0x48456c,_0x5714dc){if(_[_0x3c8c('0x16')](_0x58a08e)){return _0x5714dc(handleCheckRowError('error',_0x3c8c('0x17'),null,_0x3ec5bb));}if(_0x58a08e['errors']&&_0x58a08e[_0x3c8c('0x18')][_0x3c8c('0x19')]){var _0x3fb7a4=_[_0x3c8c('0x1a')](_0x58a08e['errors'],_0x3c8c('0x1b'))['join'](';');return _0x5714dc(handleCheckRowError(_0x3c8c('0x12'),_0x3fb7a4,null,_0x3ec5bb));}var _0x2edd97={};for(var _0x8db11c in FIELDS){if(FIELDS[_0x3c8c('0x1c')](_0x8db11c)&&FIELDS[_0x8db11c]){_0x2edd97[_0x8db11c]=_0x58a08e['data'][0x0][FIELDS[_0x8db11c]]||_0x58a08e['data'][0x0]['\ufeff'+FIELDS[_0x8db11c]];}}if(!_0x2edd97[_0x3c8c('0x1d')]){return _0x5714dc(handleCheckRowError('error',_0x3c8c('0x1e'),null,_0x3ec5bb));}if(!_0x2edd97[_0x3c8c('0x1f')]){return _0x5714dc(handleCheckRowError('error',_0x3c8c('0x20'),null,_0x3ec5bb));}if(_0x2edd97[_0x3c8c('0x21')]){var _0x509072=moment(_0x2edd97[_0x3c8c('0x21')],_0x3c8c('0x22'));if(!_0x509072[_0x3c8c('0x23')]()){return _0x5714dc(handleCheckRowError(_0x3c8c('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x3ec5bb));}}if(_0x2edd97['email']){if(!isEmail(_0x2edd97[_0x3c8c('0x24')])){return _0x5714dc(handleCheckRowError(_0x3c8c('0x12'),_0x3c8c('0x25'),null,_0x3ec5bb));}}_0x2edd97[_0x3c8c('0x26')]=LISTID;_0x2edd97[_0x3c8c('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x1c4f5f){var _0x6a0492={};for(var _0x39cb13=0x0,_0x2cddd0=DUPLICATES[_0x3c8c('0x19')];_0x39cb13<_0x2cddd0;_0x39cb13+=0x1){_0x6a0492[DUPLICATES[_0x39cb13]]=_0x2edd97[DUPLICATES[_0x39cb13]];}var _0x460637=_[_0x3c8c('0x28')](_0x1c4f5f,_0x6a0492);if(_0x460637){return _0x5714dc(handleCheckRowError(_0x3c8c('0x29'),'Duplicate\x20Contact',_0x460637,_0x3ec5bb));}}return db[_0x3c8c('0x2a')][_0x3c8c('0x2b')](_0x2edd97,{'raw':!![],'hooks':![],'fields':_[_0x3c8c('0x2c')](_0x2edd97)})[_0x3c8c('0x2d')](function(_0x6d2e68){if(DUPLICATES&&DUPLICATES[_0x3c8c('0x19')]&&_0x1c4f5f){_0x1c4f5f[_0x3c8c('0x2e')](_[_0x3c8c('0x2f')](_0x2edd97,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x6d2e68['id'];return _0x48456c();})[_0x3c8c('0x30')](function(_0x561881){return _0x5714dc(handleCheckRowError(_0x3c8c('0x12'),_0x3c8c('0x31')+(_0x561881[_0x3c8c('0x1b')]||JSON[_0x3c8c('0x32')](_0x561881)),null,_0x3ec5bb));});});}function checkHopper(){function _0x216a27(){return function(_0x36fd00){logger[_0x3c8c('0x12')](_0x3c8c('0x33'),_0x3c8c('0x34'),util['inspect'](_0x36fd00,{'showHidden':![],'depth':null}));};}var _0x3643c7=function(_0x559663,_0xde997b){var _0x4061ea=squel[_0x3c8c('0x35')]()[_0x3c8c('0x36')](_0x3c8c('0x37'))[_0x3c8c('0x38')](['phone',_0x3c8c('0x39'),_0x3c8c('0x3a'),'ListId',_0xde997b,_0x3c8c('0x3b'),_0x3c8c('0x3c')],squel[_0x3c8c('0x3d')]()['field'](_0x3c8c('0x1f'),_0x3c8c('0x1f'))[_0x3c8c('0x3e')](_0x3c8c('0x3f'),_0x3c8c('0x39'))['field']('id',_0x3c8c('0x3a'))[_0x3c8c('0x3e')](LISTID[_0x3c8c('0x40')](),_0x3c8c('0x26'))['field'](_0x559663['id'][_0x3c8c('0x40')](),_0xde997b)['field'](_0x3c8c('0x3f'),_0x3c8c('0x3b'))[_0x3c8c('0x3e')](_0x3c8c('0x3f'),_0x3c8c('0x3c'))[_0x3c8c('0x41')](_0x3c8c('0x42'))[_0x3c8c('0x43')](_0x3c8c('0x44'))[_0x3c8c('0x43')]('ListId\x20=\x20?',LISTID['toString']())[_0x3c8c('0x43')]('phone\x20IS\x20NOT\x20NULL')[_0x3c8c('0x43')](_0x3c8c('0x45'),squel['select']()[_0x3c8c('0x3e')]('phone')[_0x3c8c('0x41')](_0x3c8c('0x37'))[_0x3c8c('0x43')](_0xde997b+_0x3c8c('0x46'),_0x559663['id'][_0x3c8c('0x40')]())))[_0x3c8c('0x40')]();return _0x4061ea;};var _0x1e7ed5=function(_0x3627e3,_0x508fd8){var _0x5b224c=squel[_0x3c8c('0x35')]()[_0x3c8c('0x36')](_0x3c8c('0x37'))['fromQuery']([_0x3c8c('0x1f'),_0x3c8c('0x39'),_0x3c8c('0x3a'),_0x3c8c('0x26'),_0x508fd8,_0x3c8c('0x3b'),'updatedAt'],squel['select']()[_0x3c8c('0x3e')](_0x3c8c('0x1f'),_0x3c8c('0x1f'))[_0x3c8c('0x3e')](_0x3c8c('0x3f'),_0x3c8c('0x39'))['field']('id',_0x3c8c('0x3a'))['field'](LISTID[_0x3c8c('0x40')](),_0x3c8c('0x26'))[_0x3c8c('0x3e')](_0x3627e3['id']['toString'](),_0x508fd8)[_0x3c8c('0x3e')](_0x3c8c('0x3f'),_0x3c8c('0x3b'))[_0x3c8c('0x3e')](_0x3c8c('0x3f'),'updatedAt')[_0x3c8c('0x41')](_0x3c8c('0x42'))[_0x3c8c('0x43')]('deletedAt\x20IS\x20NULL')[_0x3c8c('0x43')](_0x3c8c('0x47'),LISTID[_0x3c8c('0x40')]())['where'](_0x3c8c('0x48'),squel['str'](hopperContacts))[_0x3c8c('0x43')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x3c8c('0x45'),squel[_0x3c8c('0x3d')]()[_0x3c8c('0x3e')](_0x3c8c('0x49'))[_0x3c8c('0x41')](_0x3c8c('0x4a'))[_0x3c8c('0x43')](_0x508fd8+'\x20=\x20?',_0x3627e3['id'][_0x3c8c('0x40')]()))['where'](_0x3c8c('0x45'),squel[_0x3c8c('0x3d')]()[_0x3c8c('0x3e')](_0x3c8c('0x1f'))[_0x3c8c('0x41')](_0x3c8c('0x37'))['where'](_0x508fd8+_0x3c8c('0x46'),_0x3627e3['id'][_0x3c8c('0x40')]())))['toString']();return _0x5b224c;};function _0x24826a(_0x26b8c0,_0xb47477){var _0x365c85=squel[_0x3c8c('0x35')]()[_0x3c8c('0x36')]('cm_hopper')[_0x3c8c('0x38')]([_0x3c8c('0x1f'),'scheduledAt',_0x3c8c('0x3a'),_0x3c8c('0x26'),_0xb47477,_0x3c8c('0x3b'),_0x3c8c('0x3c')],squel[_0x3c8c('0x3d')]()[_0x3c8c('0x3e')](_0x3c8c('0x1f'),_0x3c8c('0x1f'))[_0x3c8c('0x3e')]('NOW()',_0x3c8c('0x39'))['field']('id','ContactId')[_0x3c8c('0x3e')](LISTID[_0x3c8c('0x40')](),'ListId')[_0x3c8c('0x3e')](_0x26b8c0['id']['toString'](),_0xb47477)[_0x3c8c('0x3e')](_0x3c8c('0x3f'),'createdAt')[_0x3c8c('0x3e')](_0x3c8c('0x3f'),_0x3c8c('0x3c'))[_0x3c8c('0x41')](_0x3c8c('0x42'))['where'](_0x3c8c('0x44'))[_0x3c8c('0x43')]('ListId\x20=\x20?',LISTID['toString']())['where'](_0x3c8c('0x48'),squel[_0x3c8c('0x4b')](hopperContacts))[_0x3c8c('0x43')](_0x3c8c('0x4c')))[_0x3c8c('0x40')]();return _0x365c85;}function _0x25da0d(_0x128b1a,_0x3d0dd6){var _0x1e3251=squel['insert']()[_0x3c8c('0x36')](_0x3c8c('0x4d'))['fromQuery'](['phone',_0x3c8c('0x3a'),_0x3c8c('0x26'),_0x3d0dd6,'createdAt',_0x3c8c('0x3c')],squel[_0x3c8c('0x3d')]()[_0x3c8c('0x3e')](_0x3c8c('0x1f'),_0x3c8c('0x1f'))[_0x3c8c('0x3e')]('id',_0x3c8c('0x3a'))[_0x3c8c('0x3e')](LISTID[_0x3c8c('0x40')](),_0x3c8c('0x26'))[_0x3c8c('0x3e')](_0x128b1a['id'][_0x3c8c('0x40')](),_0x3d0dd6)['field'](_0x3c8c('0x3f'),_0x3c8c('0x3b'))[_0x3c8c('0x3e')](_0x3c8c('0x3f'),'updatedAt')[_0x3c8c('0x41')](_0x3c8c('0x42'))[_0x3c8c('0x43')]('deletedAt\x20IS\x20NULL')[_0x3c8c('0x43')]('ListId\x20=\x20?',LISTID[_0x3c8c('0x40')]())['where'](_0x3c8c('0x48'),squel[_0x3c8c('0x4b')](hopperContacts))[_0x3c8c('0x43')](_0x3c8c('0x4c')))[_0x3c8c('0x40')]();return _0x1e3251;}return db[_0x3c8c('0x4e')][_0x3c8c('0x4f')]({'where':{'type':_0x3c8c('0x50')},'attributes':['id',_0x3c8c('0x51')],'include':[{'model':db[_0x3c8c('0x52')],'as':_0x3c8c('0x53'),'where':{'id':LISTID}}]})['then'](function(_0x37e2ac){var _0x3670a0=[];if(_0x37e2ac){var _0x2cc087;for(var _0x2b21a2=0x0,_0xe38254;_0x2b21a2<_0x37e2ac[_0x3c8c('0x19')];_0x2b21a2+=0x1){_0xe38254=_0x37e2ac[_0x2b21a2][_0x3c8c('0x54')]({'plain':!![]});switch(_0xe38254[_0x3c8c('0x51')]){case _0x3c8c('0x55'):_0x3670a0['push'](db[_0x3c8c('0x56')][_0x3c8c('0x57')](_0x1e7ed5(_0xe38254,_0x3c8c('0x58')))[_0x3c8c('0x2d')](function(){})[_0x3c8c('0x30')](_0x216a27()));break;case _0x3c8c('0x59'):_0x3670a0[_0x3c8c('0x2e')](db['sequelize']['query'](_0x3643c7(_0xe38254,_0x3c8c('0x58')))[_0x3c8c('0x2d')](function(){})[_0x3c8c('0x30')](_0x216a27()));break;default:_0x3670a0[_0x3c8c('0x2e')](db[_0x3c8c('0x56')][_0x3c8c('0x57')](_0x24826a(_0xe38254,'VoiceQueueId'))[_0x3c8c('0x2d')](function(){})['catch'](_0x216a27()));}}}return _0x3670a0;})[_0x3c8c('0x5a')]()['then'](function(){return db[_0x3c8c('0x4e')][_0x3c8c('0x4f')]({'where':{'type':_0x3c8c('0x50')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x3c8c('0x2d')](function(_0x58ae2d){var _0x1363ef=[];if(_0x58ae2d){var _0x4de993;for(var _0x58ae4c=0x0,_0x2e7dea;_0x58ae4c<_0x58ae2d['length'];_0x58ae4c+=0x1){_0x2e7dea=_0x58ae2d[_0x58ae4c][_0x3c8c('0x54')]({'plain':!![]});_0x1363ef[_0x3c8c('0x2e')](db[_0x3c8c('0x56')][_0x3c8c('0x57')](_0x25da0d(_0x2e7dea,_0x3c8c('0x58')))[_0x3c8c('0x2d')](function(){})[_0x3c8c('0x30')](_0x216a27()));}}return _0x1363ef;})[_0x3c8c('0x5a')]();})[_0x3c8c('0x2d')](function(){return db[_0x3c8c('0x5b')][_0x3c8c('0x4f')]({'attributes':['id',_0x3c8c('0x51')],'include':[{'model':db[_0x3c8c('0x52')],'as':'Lists','where':{'id':LISTID}}]})[_0x3c8c('0x2d')](function(_0x30ec00){var _0x303e1b=[];if(_0x30ec00){for(var _0x522d5e=0x0,_0x2238b4;_0x522d5e<_0x30ec00[_0x3c8c('0x19')];_0x522d5e+=0x1){_0x2238b4=_0x30ec00[_0x522d5e][_0x3c8c('0x54')]({'plain':!![]});switch(_0x2238b4[_0x3c8c('0x51')]){case _0x3c8c('0x55'):_0x303e1b[_0x3c8c('0x2e')](db[_0x3c8c('0x56')][_0x3c8c('0x57')](_0x1e7ed5(_0x2238b4,_0x3c8c('0x5c')))[_0x3c8c('0x2d')](function(){})['catch'](_0x216a27()));break;case _0x3c8c('0x59'):_0x303e1b[_0x3c8c('0x2e')](db['sequelize'][_0x3c8c('0x57')](_0x3643c7(_0x2238b4,_0x3c8c('0x5c')))[_0x3c8c('0x2d')](function(){})[_0x3c8c('0x30')](_0x216a27()));break;default:_0x303e1b[_0x3c8c('0x2e')](db[_0x3c8c('0x56')][_0x3c8c('0x57')](_0x24826a(_0x2238b4,'CampaignId'))[_0x3c8c('0x2d')](function(){})[_0x3c8c('0x30')](_0x216a27()));}}}return _0x303e1b;})['all']();})['then'](function(){return db[_0x3c8c('0x5b')][_0x3c8c('0x4f')]({'attributes':['id'],'include':[{'model':db[_0x3c8c('0x52')],'as':_0x3c8c('0x5d'),'where':{'id':LISTID}}]})[_0x3c8c('0x2d')](function(_0x179017){var _0x27d708=[];if(_0x179017){for(var _0x38f375=0x0,_0x325244;_0x38f375<_0x179017['length'];_0x38f375+=0x1){_0x325244=_0x179017[_0x38f375][_0x3c8c('0x54')]({'plain':!![]});_0x27d708[_0x3c8c('0x2e')](db[_0x3c8c('0x56')][_0x3c8c('0x57')](_0x25da0d(_0x325244,_0x3c8c('0x5c')))['then'](function(){})[_0x3c8c('0x30')](_0x216a27()));}}return _0x27d708;})['all']();})[_0x3c8c('0x30')](function(_0x4b809b){logger['error'](_0x3c8c('0x5e'),'generalCheckHopper',_0x4b809b[_0x3c8c('0x1b')]);});}var processPromises=function(_0x46757b){return BPromise[_0x3c8c('0x5a')](promises)[_0x3c8c('0x2d')](function(_0x382873){})[_0x3c8c('0x30')](function(_0x4a2e4b){logger[_0x3c8c('0x12')](_0x3c8c('0x5f'),JSON['stringify'](_0x4a2e4b));})[_0x3c8c('0x60')](function(){socket[_0x3c8c('0x61')](_0x3c8c('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x46757b){return _0x46757b['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x3c8c('0x2d')](function(){socket[_0x3c8c('0x61')](_0x3c8c('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3c8c('0x63')](FILEPATH);}catch(_0x3d48ff){logger[_0x3c8c('0x12')](_0x3c8c('0x64'),JSON[_0x3c8c('0x32')](_0x3d48ff));}finally{process[_0x3c8c('0x65')](0x0);}});};process['on'](_0x3c8c('0x66'),function(){logger['info'](_0x3c8c('0x67'));endCsv();});function main(){return BPromise[_0x3c8c('0x68')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x3c8c('0x10')](',');return db[_0x3c8c('0x2a')][_0x3c8c('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3c8c('0x2d')](function(_0x154785){var _0x33a5fa=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x33a5fa,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2cbb8c,_0x5427d8){total+=0x1;var _0x4dfc42=total;promises[_0x3c8c('0x2e')](checkRow(_0x2cbb8c,_0x154785,_0x4dfc42)['then'](function(){success+=0x1;})['catch'](function(_0x72f849){if(_0x72f849['error']){errors+=0x1;delete _0x72f849[_0x3c8c('0x12')];}else if(_0x72f849[_0x3c8c('0x29')]){duplicates+=0x1;delete _0x72f849[_0x3c8c('0x29')];}rows['push'](_0x72f849);}));if(total%0xc8===0x0){_0x5427d8[_0x3c8c('0x69')]();return processPromises(_0x5427d8);}},'complete':function(){return processPromises()[_0x3c8c('0x2d')](function(){logger[_0x3c8c('0x6a')](_0x3c8c('0x6b'));endCsv();});},'error':function(_0x5ddbfd,_0x469603){logger[_0x3c8c('0x6a')](_0x3c8c('0x6c'),JSON[_0x3c8c('0x32')](_0x5ddbfd));endCsv();}});})[_0x3c8c('0x30')](function(_0x32abe4){logger['error'](_0x3c8c('0x6d'),JSON['stringify'](_0x32abe4));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index b8eb77e..c96f124 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 _0x90c7=['No\x20agent\x20available','SIGINT','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','from','join','.id\x20=\x20','where','\x20=\x20','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','insert','fromQuery','phone','ContactId','createdAt','updatedAt','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22onlyIfOpen\x22','\x22always\x22','toString','into','cm_hopper_black','ListId','cm_contacts','.CmListId','cm_contacts.createdAt\x20=\x20?','field','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','spread','catch','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','header','writeFileSync','createReadStream','data','rows','hasOwnProperty','trim','scheduledat','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','length','SystemRow','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','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','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_lists','campaigns','campaigns_has_cm_blacklists','CampaignId','each','then','finish','affectedRows','emit','unlink','complete','argv','existsSync','parse','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory'];(function(_0x387020,_0x4ff0b8){var _0x5b6afa=function(_0x53122f){while(--_0x53122f){_0x387020['push'](_0x387020['shift']());}};_0x5b6afa(++_0x4ff0b8);}(_0x90c7,0x10c));var _0x790c=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x90c7[_0xbb091];return _0x467a04;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x790c('0x0'));var Papa=require(_0x790c('0x1'));var util=require(_0x790c('0x2'));var BPromise=require(_0x790c('0x3'));var moment=require(_0x790c('0x4'));var squel=require(_0x790c('0x5'));var Redis=require(_0x790c('0x6'));var db=require(_0x790c('0x7'))['db'];var config=require('../../../config/environment');var logger=require(_0x790c('0x8'))(_0x790c('0x9'));config['redis']=_[_0x790c('0xa')](config[_0x790c('0xb')],{'host':_0x790c('0xc'),'port':0x18eb});var socket=require(_0x790c('0xd'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x790c('0xe')](_0x790c('0xf'));function isEmail(_0x237ab7){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x237ab7);}function selectNotIn(_0x15c4a1,_0x467adf,_0x3fe531,_0x423dc8,_0x1dae46){return squel[_0x790c('0x10')]()['field']('phone')[_0x790c('0x11')](_0x423dc8)[_0x790c('0x12')](_0x467adf,null,_0x467adf+_0x790c('0x13')+_0x423dc8+'.'+_0x3fe531)[_0x790c('0x14')](_0x423dc8+'.'+_0x3fe531+_0x790c('0x15')+_0x15c4a1+'.'+_0x3fe531)[_0x790c('0x14')](_0x467adf+'.dialCheckDuplicateType\x20IN\x20('+_0x1dae46['join']()+')');}function insertCmHopper(_0x1eda35,_0x29a650,_0x319147,_0x331ff4,_0x3ab001){var _0x13c47b=[_0x790c('0x16'),_0x790c('0x17'),'cm_contacts.id',_0x790c('0x18'),_0x29a650+'.'+_0x331ff4,_0x790c('0x19'),_0x790c('0x1a'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x3ab001+'\x22'];return squel[_0x790c('0x1b')]()['into']('cm_hopper')[_0x790c('0x1c')]([_0x790c('0x1d'),'scheduledat',_0x790c('0x1e'),'ListId',_0x331ff4,_0x790c('0x1f'),_0x790c('0x20'),'priority',_0x790c('0x21'),_0x790c('0x22')],squel[_0x790c('0x10')]()[_0x790c('0x23')](_0x13c47b)[_0x790c('0x11')](_0x29a650)[_0x790c('0x12')]('cm_contacts',null,_0x790c('0x24')+_0x29a650+'.CmListId')[_0x790c('0x12')](_0x319147,null,_0x319147+'.id\x20=\x20'+_0x29a650+'.'+_0x331ff4)['where'](_0x29a650+_0x790c('0x25'),_0x1eda35)[_0x790c('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x790c('0x14')](_0x790c('0x26'),selectNotIn(_0x29a650,_0x319147,_0x331ff4,_0x790c('0x27'),['\x22always\x22',_0x790c('0x28')]))[_0x790c('0x14')](_0x790c('0x26'),selectNotIn(_0x29a650,_0x319147,_0x331ff4,'cm_hopper',[_0x790c('0x29')])))[_0x790c('0x2a')]();}function insertCmHopperBlack(_0x59fff6,_0xd0cbf7,_0xab93f5,_0x18fe14){var _0x2a17cc=[_0x790c('0x16'),'cm_contacts.id',_0x790c('0x18'),_0xd0cbf7+'.'+_0x18fe14,_0x790c('0x19'),_0x790c('0x1a')];return squel[_0x790c('0x1b')]()[_0x790c('0x2b')](_0x790c('0x2c'))[_0x790c('0x1c')]([_0x790c('0x1d'),_0x790c('0x1e'),_0x790c('0x2d'),_0x18fe14,_0x790c('0x1f'),'updatedAt'],squel[_0x790c('0x10')]()[_0x790c('0x23')](_0x2a17cc)[_0x790c('0x11')](_0xd0cbf7)[_0x790c('0x12')](_0x790c('0x2e'),null,_0x790c('0x24')+_0xd0cbf7+_0x790c('0x2f'))[_0x790c('0x12')](_0xab93f5,null,_0xab93f5+_0x790c('0x13')+_0xd0cbf7+'.'+_0x18fe14)[_0x790c('0x14')](_0xd0cbf7+_0x790c('0x25'),_0x59fff6)[_0x790c('0x14')](_0x790c('0x30'),NOW)[_0x790c('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x790c('0x31')]('phone')['from']('cm_hopper_black')[_0x790c('0x14')](_0x790c('0x32'),_0x59fff6)['where'](_0x18fe14+_0x790c('0x33'),_0xd0cbf7+'.'+_0x18fe14)))['toString']();}function insertCmContact(_0x185345,_0x131747,_0x4dfe53,_0x5f10a7){var _0x369b66=_[_0x790c('0x34')](_[_0x790c('0x35')](_0x5f10a7),[_0x790c('0x2d'),_0x790c('0x36'),_0x790c('0x1f'),_0x790c('0x20')]);return squel[_0x790c('0x1b')]()[_0x790c('0x2b')]('cm_contacts')[_0x790c('0x1c')](_0x369b66,squel[_0x790c('0x10')]()['fields'](_0x369b66)[_0x790c('0x11')](_0x131747)[_0x790c('0x14')]('('+_0x4dfe53[_0x790c('0x12')](',')+')\x20NOT\x20IN\x20?',squel[_0x790c('0x10')]()[_0x790c('0x23')](_0x4dfe53)[_0x790c('0x11')]('cm_contacts')[_0x790c('0x14')](_0x790c('0x32'),_0x185345)[_0x790c('0x14')](_0x790c('0x37')))['where'](_0x790c('0x38'),squel[_0x790c('0x10')]()[_0x790c('0x31')]('MIN(id)',_0x790c('0x39'))[_0x790c('0x11')](_0x131747)['group'](_0x4dfe53[_0x790c('0x12')](','))))[_0x790c('0x2a')]();}function handleStop(){logger[_0x790c('0x3a')](_0x790c('0x3b'));stopped=!![];}function handleUncaughtException(_0x3a5171){logger[_0x790c('0x3c')](_0x3a5171[_0x790c('0x3d')]);process[_0x790c('0x3e')](0x1);}function handleError(_0x44dbaa,_0x250c0a){stats[_0x790c('0x3f')][_0x790c('0x40')]({'name':_0x250c0a[_0x790c('0x41')],'message':_0x250c0a['message'],'row':_0x44dbaa});}function handleQuery(_0x10e96f){logger[_0x790c('0x3a')](_0x10e96f);return db[_0x790c('0x42')][_0x790c('0x43')](_0x10e96f)[_0x790c('0x44')](function(_0x5cabd8){results[_0x790c('0x40')](_0x5cabd8);})[_0x790c('0x45')](function(_0x34bd19){logger['error'](_0x34bd19[_0x790c('0x3d')]);});}function main(_0x2c3696,_0x8cbdc0,_0x12d440,_0x2fdd78){logger['info']('main',_0x2c3696,JSON[_0x790c('0x46')](_0x8cbdc0));process[_0x790c('0x47')](_0x790c('0x48'));var _0x6759ee=_0x8cbdc0[_0x790c('0x49')];var _0x18adb4=_0x8cbdc0[_0x790c('0x4a')];var _0x3f5754=path['join'](config[_0x790c('0x4b')],_0x790c('0x4c'),_0x18adb4+'.csv');var _0x9827e9=_[_0x790c('0x35')](_0x6759ee)[_0x790c('0x12')]();logger[_0x790c('0x3a')](_0x790c('0x4d'),_0x9827e9);fs[_0x790c('0x4e')](_0x3f5754,_0x9827e9+'\x0a');Papa['parse'](fs[_0x790c('0x4f')](_0x2c3696),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2601d6,_0x14d641){try{for(var _0x3c9281=0x0,_0x14271d=[];_0x3c9281<_0x2601d6[_0x790c('0x50')]['length'];_0x3c9281++){stats[_0x790c('0x51')]+=0x1;if(_0x2601d6[_0x790c('0x3f')][_0x3c9281]){handleError(_0x2601d6['data'][_0x3c9281],_0x2601d6[_0x790c('0x3f')][_0x3c9281]);}else{var _0xde8125=[];for(var _0x50f92e in _0x6759ee){if(_0x6759ee[_0x790c('0x52')](_0x50f92e)){if(_0x2601d6[_0x790c('0x50')][_0x3c9281][_0x6759ee[_0x50f92e]]){var _0x38f3ce=_[_0x790c('0x53')](_0x2601d6[_0x790c('0x50')][_0x3c9281][_0x6759ee[_0x50f92e]]['replace'](/"/g,'\x27'));switch(_0x50f92e){case _0x790c('0x54'):var _0x59e374=moment(_0x38f3ce,_0x790c('0xf'),!![]);if(_0x59e374['isValid']()){_0x14271d['push']('\x22'+_0x38f3ce+'\x22');}else{_0xde8125[_0x790c('0x40')](_0x790c('0x55'));}break;case _0x790c('0x56'):var _0x36755f=parseInt(_0x38f3ce);_0x38f3ce=_[_0x790c('0x57')](_0x36755f)||_0x36755f<0x0||_0x36755f>0x4?_0x2fdd78?0x3:0x2:_0x36755f;_0x14271d['push']('\x22'+_0x38f3ce+'\x22');break;case _0x790c('0x21'):var _0x173a63=parseInt(_0x38f3ce);if(_[_0x790c('0x58')](_0x173a63)&&_[_0x790c('0x59')](_0x12d440,_0x173a63)){_0x14271d[_0x790c('0x40')]('\x22'+_0x173a63+'\x22');}else{_0xde8125[_0x790c('0x40')](_0x790c('0x5a'));}break;case _0x790c('0x5b'):if(isEmail(_0x38f3ce)){_0x14271d[_0x790c('0x40')]('\x22'+_0x38f3ce+'\x22');}else{_0xde8125[_0x790c('0x40')](_0x790c('0x5c'));}break;case'dateOfBirth':var _0x2d4334=moment(_0x38f3ce,_0x790c('0x5d'),!![]);if(_0x2d4334['isValid']()){_0x14271d[_0x790c('0x40')]('\x22'+_0x38f3ce+'\x22');}else{_0xde8125[_0x790c('0x40')](_0x790c('0x5e'));}break;default:_0x14271d['push']('\x22'+_0x38f3ce+'\x22');}}else{switch(_0x50f92e){case _0x790c('0x5f'):case _0x790c('0x1d'):_0xde8125[_0x790c('0x40')](_0x50f92e+_0x790c('0x60'));break;default:_0x14271d['push']('\x22\x22');}}}}if(_0xde8125[_0x790c('0x61')]){handleError(_0x2601d6[_0x790c('0x50')][_0x3c9281],{'code':_0x790c('0x62'),'message':_0xde8125[_0x790c('0x12')]()});}else{fs['appendFileSync'](_0x3f5754,_0x14271d[_0x790c('0x12')]()+'\x0a');}_0x14271d=[];}if(!(stats[_0x790c('0x51')]%0xc8)){socket['emit'](_0x790c('0x63')+_0x18adb4,stats);stats['errors']=[];}}if(stopped){logger[_0x790c('0x3a')](_0x790c('0x64'));_0x14d641[_0x790c('0x65')]();}}catch(_0x453e0b){handleError(_0x2601d6[_0x790c('0x50')][_0x3c9281],{'code':_0x790c('0x66'),'message':_0x453e0b[_0x790c('0x3d')]});logger[_0x790c('0x3c')](_0x790c('0x67'),_0x453e0b[_0x790c('0x3d')]);}},'complete':function(){try{var _0x16de9f=[];var _0x396114=_0x790c('0x2e');if(_0x8cbdc0[_0x790c('0x68')]&&_0x8cbdc0['duplicates'][_0x790c('0x61')]){_0x396114='cm_contacts_'+_0x18adb4;_0x16de9f[_0x790c('0x40')](_0x790c('0x69')+_0x396114+'\x20LIKE\x20cm_contacts;');}var _0x4f5f2e=util[_0x790c('0xe')](_0x790c('0x6a'),_0x3f5754,_0x396114,_0x9827e9,_0x8cbdc0[_0x790c('0x2d')],_0x8cbdc0['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x6759ee[_0x790c('0x54')])){_0x4f5f2e+=_0x790c('0x6b');}_0x16de9f[_0x790c('0x40')](_0x4f5f2e);if(_0x8cbdc0[_0x790c('0x68')]&&_0x8cbdc0['duplicates'][_0x790c('0x61')]){_0x16de9f[_0x790c('0x40')](insertCmContact(_0x8cbdc0['ListId'],_0x396114,_0x8cbdc0[_0x790c('0x68')],_0x6759ee));_0x16de9f[_0x790c('0x40')](_0x790c('0x6c')+_0x396114+';');}_0x16de9f[_0x790c('0x40')](insertCmHopper(_0x8cbdc0['ListId'],_0x790c('0x6d'),_0x790c('0x6e'),'VoiceQueueId',_0x2fdd78));_0x16de9f['push'](insertCmHopperBlack(_0x8cbdc0[_0x790c('0x2d')],_0x790c('0x6f'),_0x790c('0x6e'),_0x790c('0x70')));_0x16de9f[_0x790c('0x40')](insertCmHopper(_0x8cbdc0[_0x790c('0x2d')],_0x790c('0x71'),_0x790c('0x72'),'CampaignId',_0x2fdd78));_0x16de9f[_0x790c('0x40')](insertCmHopperBlack(_0x8cbdc0[_0x790c('0x2d')],_0x790c('0x73'),_0x790c('0x72'),_0x790c('0x74')));BPromise[_0x790c('0x75')](_0x16de9f,handleQuery)[_0x790c('0x76')](function(_0x380cd8){stats[_0x790c('0x77')]=!![];stats[_0x790c('0x78')]=_0x8cbdc0['duplicates']&&_0x8cbdc0[_0x790c('0x68')][_0x790c('0x61')]?results[0x2]['affectedRows']:results[0x0]['affectedRows'];socket[_0x790c('0x79')]('contact:import:'+_0x18adb4,stats);fs[_0x790c('0x7a')](_0x2c3696);fs[_0x790c('0x7a')](_0x3f5754);process['exit'](0x0);})[_0x790c('0x45')](function(_0x111c71){logger['error'](_0x111c71[_0x790c('0x3d')]);process[_0x790c('0x3e')](0x1);});}catch(_0x3cf1b1){logger[_0x790c('0x3c')](_0x790c('0x7b'),_0x3cf1b1[_0x790c('0x3d')]);process[_0x790c('0x3e')](0x1);}},'error':function(_0x4684bc,_0x1ded62,_0x24784b,_0xd379){throw new Error(_0xd379);}});}function validate(){if(process[_0x790c('0x7c')]&&process[_0x790c('0x7c')][_0x790c('0x61')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x32ee4f=path[_0x790c('0x12')](config[_0x790c('0x4b')],_0x790c('0x4c'),process[_0x790c('0x7c')][0x2]);if(!fs[_0x790c('0x7d')](_0x32ee4f)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x1aaf37={};try{_0x1aaf37=JSON[_0x790c('0x7e')](process['argv'][0x3]);if(!_0x1aaf37[_0x790c('0x49')]){throw new Error(_0x790c('0x7f'));}if(!_0x1aaf37[_0x790c('0x49')][_0x790c('0x1d')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x1aaf37[_0x790c('0x49')]['firstName']){throw new Error(_0x790c('0x80'));}var _0x2de78=0x0;if(_0x1aaf37[_0x790c('0x49')]['UserId']){_0x2de78=0x1;}if(!_0x1aaf37['ListId']){throw new Error(_0x790c('0x81'));}}catch(_0x43fedf){throw new Error(_0x790c('0x82'));}var _0x21dc5f=[];try{_0x21dc5f=_['map'](JSON[_0x790c('0x7e')](process[_0x790c('0x7c')][0x4]),'id');}catch(_0x29e7dd){logger[_0x790c('0x3a')](_0x790c('0x83'));}main(_0x32ee4f,_0x1aaf37,_0x21dc5f,_0x2de78);}validate();process['on'](_0x790c('0x84'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0xa281=['id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','error','message','errors','push','code','sequelize','query','spread','main','stringify','send','binding','root','header','writeFileSync','createReadStream','data','length','trim','scheduledat','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','email','email\x20wrong\x20format','YYYY-MM-DD','isValid','firstName','\x20not\x20specified','SystemRow','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','voice_queues','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','affectedRows','unlink','exit','catch','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','parse','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','join','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','priority','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.updatedAt','insert','cm_hopper_black','field','ListId\x20=\x20?','\x20=\x20?','keys','CompanyId','fields',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa281,0x1e9));var _0x1a28=function(_0x3ac985,_0x1b6581){_0x3ac985=_0x3ac985-0x0;var _0x325d61=_0xa281[_0x3ac985];return _0x325d61;};'use strict';var fs=require('fs');var path=require(_0x1a28('0x0'));var _=require(_0x1a28('0x1'));var Papa=require(_0x1a28('0x2'));var util=require('util');var BPromise=require(_0x1a28('0x3'));var moment=require(_0x1a28('0x4'));var squel=require(_0x1a28('0x5'));var Redis=require(_0x1a28('0x6'));var db=require(_0x1a28('0x7'))['db'];var config=require(_0x1a28('0x8'));var logger=require(_0x1a28('0x9'))(_0x1a28('0xa'));config[_0x1a28('0xb')]=_[_0x1a28('0xc')](config['redis'],{'host':_0x1a28('0xd'),'port':0x18eb});var socket=require(_0x1a28('0xe'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x1a28('0xf')](_0x1a28('0x10'));function isEmail(_0x454c60){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))*$/[_0x1a28('0x11')](_0x454c60);}function selectNotIn(_0x5b4a8b,_0x8b8d44,_0x2378bb,_0x133011,_0x4247fc){return squel[_0x1a28('0x12')]()['field'](_0x1a28('0x13'))[_0x1a28('0x14')](_0x133011)[_0x1a28('0x15')](_0x8b8d44,null,_0x8b8d44+'.id\x20=\x20'+_0x133011+'.'+_0x2378bb)['where'](_0x133011+'.'+_0x2378bb+_0x1a28('0x16')+_0x5b4a8b+'.'+_0x2378bb)[_0x1a28('0x17')](_0x8b8d44+_0x1a28('0x18')+_0x4247fc[_0x1a28('0x15')]()+')');}function insertCmHopper(_0x2bf83b,_0x3420c4,_0x1870f7,_0x1a4263,_0x190c5c){var _0xc63244=[_0x1a28('0x19'),'cm_contacts.scheduledat',_0x1a28('0x1a'),_0x1a28('0x1b'),_0x3420c4+'.'+_0x1a4263,_0x1a28('0x1c'),'cm_contacts.updatedAt',_0x1a28('0x1d'),_0x1a28('0x1e'),'\x22'+_0x190c5c+'\x22'];return squel['insert']()[_0x1a28('0x1f')](_0x1a28('0x20'))[_0x1a28('0x21')](['phone','scheduledat',_0x1a28('0x22'),_0x1a28('0x23'),_0x1a4263,_0x1a28('0x24'),_0x1a28('0x25'),_0x1a28('0x26'),'UserId',_0x1a28('0x27')],squel[_0x1a28('0x12')]()['fields'](_0xc63244)[_0x1a28('0x14')](_0x3420c4)[_0x1a28('0x15')](_0x1a28('0x28'),null,_0x1a28('0x29')+_0x3420c4+_0x1a28('0x2a'))[_0x1a28('0x15')](_0x1870f7,null,_0x1870f7+_0x1a28('0x2b')+_0x3420c4+'.'+_0x1a4263)[_0x1a28('0x17')](_0x3420c4+'.CmListId\x20=\x20?',_0x2bf83b)[_0x1a28('0x17')](_0x1a28('0x2c'),NOW)[_0x1a28('0x17')](_0x1a28('0x2d'),selectNotIn(_0x3420c4,_0x1870f7,_0x1a4263,_0x1a28('0x20'),[_0x1a28('0x2e'),'\x22onlyIfOpen\x22']))[_0x1a28('0x17')](_0x1a28('0x2d'),selectNotIn(_0x3420c4,_0x1870f7,_0x1a4263,_0x1a28('0x20'),['\x22always\x22'])))[_0x1a28('0x2f')]();}function insertCmHopperBlack(_0x437d00,_0xf1a284,_0x3aa75f,_0x2d14cc){var _0x1c8f20=[_0x1a28('0x19'),'cm_contacts.id',_0x1a28('0x1b'),_0xf1a284+'.'+_0x2d14cc,_0x1a28('0x1c'),_0x1a28('0x30')];return squel[_0x1a28('0x31')]()[_0x1a28('0x1f')](_0x1a28('0x32'))[_0x1a28('0x21')](['phone','ContactId',_0x1a28('0x23'),_0x2d14cc,_0x1a28('0x24'),_0x1a28('0x25')],squel[_0x1a28('0x12')]()['fields'](_0x1c8f20)[_0x1a28('0x14')](_0xf1a284)[_0x1a28('0x15')](_0x1a28('0x28'),null,_0x1a28('0x29')+_0xf1a284+_0x1a28('0x2a'))[_0x1a28('0x15')](_0x3aa75f,null,_0x3aa75f+_0x1a28('0x2b')+_0xf1a284+'.'+_0x2d14cc)[_0x1a28('0x17')](_0xf1a284+'.CmListId\x20=\x20?',_0x437d00)[_0x1a28('0x17')](_0x1a28('0x2c'),NOW)[_0x1a28('0x17')](_0x1a28('0x2d'),squel[_0x1a28('0x12')]()[_0x1a28('0x33')](_0x1a28('0x13'))[_0x1a28('0x14')](_0x1a28('0x32'))[_0x1a28('0x17')](_0x1a28('0x34'),_0x437d00)[_0x1a28('0x17')](_0x2d14cc+_0x1a28('0x35'),_0xf1a284+'.'+_0x2d14cc)))[_0x1a28('0x2f')]();}function insertCmContact(_0x5222f2,_0x438869,_0x3b01ec,_0x4e0110){var _0x2cf11d=_['concat'](_[_0x1a28('0x36')](_0x4e0110),[_0x1a28('0x23'),_0x1a28('0x37'),_0x1a28('0x24'),_0x1a28('0x25')]);return squel[_0x1a28('0x31')]()[_0x1a28('0x1f')](_0x1a28('0x28'))[_0x1a28('0x21')](_0x2cf11d,squel[_0x1a28('0x12')]()[_0x1a28('0x38')](_0x2cf11d)[_0x1a28('0x14')](_0x438869)[_0x1a28('0x17')]('('+_0x3b01ec[_0x1a28('0x15')](',')+_0x1a28('0x39'),squel[_0x1a28('0x12')]()[_0x1a28('0x38')](_0x3b01ec)[_0x1a28('0x14')]('cm_contacts')[_0x1a28('0x17')](_0x1a28('0x34'),_0x5222f2)['where'](_0x1a28('0x3a')))['where'](_0x1a28('0x3b'),squel[_0x1a28('0x12')]()[_0x1a28('0x33')]('MIN(id)',_0x1a28('0x3c'))[_0x1a28('0x14')](_0x438869)[_0x1a28('0x3d')](_0x3b01ec['join'](','))))[_0x1a28('0x2f')]();}function handleStop(){logger[_0x1a28('0x3e')](_0x1a28('0x3f'));stopped=!![];}function handleUncaughtException(_0x21680e){logger[_0x1a28('0x40')](_0x21680e[_0x1a28('0x41')]);process['exit'](0x1);}function handleError(_0x5a83f6,_0x48e4d1){stats[_0x1a28('0x42')][_0x1a28('0x43')]({'name':_0x48e4d1[_0x1a28('0x44')],'message':_0x48e4d1[_0x1a28('0x41')],'row':_0x5a83f6});}function handleQuery(_0x48dc1e){logger['info'](_0x48dc1e);return db[_0x1a28('0x45')][_0x1a28('0x46')](_0x48dc1e)[_0x1a28('0x47')](function(_0x1e8aab){results[_0x1a28('0x43')](_0x1e8aab);})['catch'](function(_0x1531b8){logger[_0x1a28('0x40')](_0x1531b8[_0x1a28('0x41')]);});}function main(_0x18f68a,_0x39b617,_0x4d8eed,_0x418dfd){logger['info'](_0x1a28('0x48'),_0x18f68a,JSON[_0x1a28('0x49')](_0x39b617));process[_0x1a28('0x4a')]('start');var _0xdaf39c=_0x39b617[_0x1a28('0x4b')];var _0x259c12=_0x39b617['socket_timestamp'];var _0x2fb844=path['join'](config[_0x1a28('0x4c')],'server/files/tmp',_0x259c12+'.csv');var _0x4c4c84=_['keys'](_0xdaf39c)['join']();logger['info'](_0x1a28('0x4d'),_0x4c4c84);fs[_0x1a28('0x4e')](_0x2fb844,_0x4c4c84+'\x0a');Papa['parse'](fs[_0x1a28('0x4f')](_0x18f68a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1f35ca,_0x12c49a){try{for(var _0xb27f3f=0x0,_0x21886a=[];_0xb27f3f<_0x1f35ca[_0x1a28('0x50')][_0x1a28('0x51')];_0xb27f3f++){stats['rows']+=0x1;if(_0x1f35ca[_0x1a28('0x42')][_0xb27f3f]){handleError(_0x1f35ca[_0x1a28('0x50')][_0xb27f3f],_0x1f35ca[_0x1a28('0x42')][_0xb27f3f]);}else{var _0x2793c4=[];for(var _0x2126ab in _0xdaf39c){if(_0xdaf39c['hasOwnProperty'](_0x2126ab)){if(_0x1f35ca[_0x1a28('0x50')][_0xb27f3f][_0xdaf39c[_0x2126ab]]){var _0x5c0c00=_[_0x1a28('0x52')](_0x1f35ca['data'][_0xb27f3f][_0xdaf39c[_0x2126ab]]['replace'](/"/g,'\x27'));switch(_0x2126ab){case _0x1a28('0x53'):var _0x3f8833=moment(_0x5c0c00,_0x1a28('0x10'),!![]);if(_0x3f8833['isValid']()){_0x21886a['push']('\x22'+_0x5c0c00+'\x22');}else{_0x2793c4[_0x1a28('0x43')](_0x1a28('0x54'));}break;case'priority':var _0x427dae=parseInt(_0x5c0c00);_0x5c0c00=_[_0x1a28('0x55')](_0x427dae)||_0x427dae<0x0||_0x427dae>0x4?_0x418dfd?0x3:0x2:_0x427dae;_0x21886a[_0x1a28('0x43')]('\x22'+_0x5c0c00+'\x22');break;case'UserId':var _0x355c5d=parseInt(_0x5c0c00);if(_[_0x1a28('0x56')](_0x355c5d)&&_[_0x1a28('0x57')](_0x4d8eed,_0x355c5d)){_0x21886a['push']('\x22'+_0x355c5d+'\x22');}else{_0x2793c4[_0x1a28('0x43')]('agent\x20not\x20exists');}break;case _0x1a28('0x58'):if(isEmail(_0x5c0c00)){_0x21886a['push']('\x22'+_0x5c0c00+'\x22');}else{_0x2793c4[_0x1a28('0x43')](_0x1a28('0x59'));}break;case'dateOfBirth':var _0x27f413=moment(_0x5c0c00,_0x1a28('0x5a'),!![]);if(_0x27f413[_0x1a28('0x5b')]()){_0x21886a[_0x1a28('0x43')]('\x22'+_0x5c0c00+'\x22');}else{_0x2793c4[_0x1a28('0x43')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x21886a['push']('\x22'+_0x5c0c00+'\x22');}}else{switch(_0x2126ab){case _0x1a28('0x5c'):case _0x1a28('0x13'):_0x2793c4[_0x1a28('0x43')](_0x2126ab+_0x1a28('0x5d'));break;default:_0x21886a[_0x1a28('0x43')]('\x22\x22');}}}}if(_0x2793c4[_0x1a28('0x51')]){handleError(_0x1f35ca[_0x1a28('0x50')][_0xb27f3f],{'code':_0x1a28('0x5e'),'message':_0x2793c4[_0x1a28('0x15')]()});}else{fs[_0x1a28('0x5f')](_0x2fb844,_0x21886a[_0x1a28('0x15')]()+'\x0a');}_0x21886a=[];}if(!(stats[_0x1a28('0x60')]%0xc8)){socket[_0x1a28('0x61')](_0x1a28('0x62')+_0x259c12,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x1a28('0x63'));_0x12c49a[_0x1a28('0x64')]();}}catch(_0x2e64c8){handleError(_0x1f35ca[_0x1a28('0x50')][_0xb27f3f],{'code':_0x1a28('0x65'),'message':_0x2e64c8[_0x1a28('0x41')]});logger['error']('step',_0x2e64c8[_0x1a28('0x41')]);}},'complete':function(){try{var _0x24f77a=[];var _0x580196=_0x1a28('0x28');if(_0x39b617[_0x1a28('0x66')]&&_0x39b617[_0x1a28('0x66')][_0x1a28('0x51')]){_0x580196=_0x1a28('0x67')+_0x259c12;_0x24f77a[_0x1a28('0x43')]('CREATE\x20TABLE\x20'+_0x580196+_0x1a28('0x68'));}var _0x2f666f=util[_0x1a28('0xf')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x2fb844,_0x580196,_0x4c4c84,_0x39b617['ListId'],_0x39b617[_0x1a28('0x37')]||null,NOW,NOW);if(_[_0x1a28('0x69')](_0xdaf39c[_0x1a28('0x53')])){_0x2f666f+=_0x1a28('0x6a');}_0x24f77a[_0x1a28('0x43')](_0x2f666f);if(_0x39b617['duplicates']&&_0x39b617[_0x1a28('0x66')][_0x1a28('0x51')]){_0x24f77a[_0x1a28('0x43')](insertCmContact(_0x39b617[_0x1a28('0x23')],_0x580196,_0x39b617['duplicates'],_0xdaf39c));_0x24f77a[_0x1a28('0x43')](_0x1a28('0x6b')+_0x580196+';');}_0x24f77a['push'](insertCmHopper(_0x39b617[_0x1a28('0x23')],_0x1a28('0x6c'),'voice_queues',_0x1a28('0x6d'),_0x418dfd));_0x24f77a[_0x1a28('0x43')](insertCmHopperBlack(_0x39b617['ListId'],_0x1a28('0x6e'),_0x1a28('0x6f'),_0x1a28('0x6d')));_0x24f77a[_0x1a28('0x43')](insertCmHopper(_0x39b617[_0x1a28('0x23')],_0x1a28('0x70'),_0x1a28('0x71'),_0x1a28('0x72'),_0x418dfd));_0x24f77a[_0x1a28('0x43')](insertCmHopperBlack(_0x39b617[_0x1a28('0x23')],_0x1a28('0x73'),_0x1a28('0x71'),_0x1a28('0x72')));BPromise[_0x1a28('0x74')](_0x24f77a,handleQuery)[_0x1a28('0x75')](function(_0x1b2452){stats['finish']=!![];stats[_0x1a28('0x76')]=_0x39b617[_0x1a28('0x66')]&&_0x39b617[_0x1a28('0x66')]['length']?results[0x2][_0x1a28('0x76')]:results[0x0][_0x1a28('0x76')];socket[_0x1a28('0x61')](_0x1a28('0x62')+_0x259c12,stats);fs[_0x1a28('0x77')](_0x18f68a);fs[_0x1a28('0x77')](_0x2fb844);process[_0x1a28('0x78')](0x0);})[_0x1a28('0x79')](function(_0x527ff7){logger['error'](_0x527ff7[_0x1a28('0x41')]);process['exit'](0x1);});}catch(_0x356dad){logger[_0x1a28('0x40')](_0x1a28('0x7a'),_0x356dad[_0x1a28('0x41')]);process['exit'](0x1);}},'error':function(_0xb5725f,_0x41348b,_0x117ba4,_0x5eede8){throw new Error(_0x5eede8);}});}function validate(){if(process['argv']&&process[_0x1a28('0x7b')][_0x1a28('0x51')]<0x4){throw new Error(_0x1a28('0x7c'));}var _0x1abfbd=path[_0x1a28('0x15')](config['root'],_0x1a28('0x7d'),process['argv'][0x2]);if(!fs[_0x1a28('0x7e')](_0x1abfbd)){throw new Error(_0x1a28('0x7f'));}var _0x46db98={};try{_0x46db98=JSON[_0x1a28('0x80')](process[_0x1a28('0x7b')][0x3]);if(!_0x46db98[_0x1a28('0x4b')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x46db98[_0x1a28('0x4b')]['phone']){throw new Error(_0x1a28('0x81'));}if(!_0x46db98[_0x1a28('0x4b')][_0x1a28('0x5c')]){throw new Error(_0x1a28('0x82'));}var _0x398772=0x0;if(_0x46db98[_0x1a28('0x4b')]['UserId']){_0x398772=0x1;}if(!_0x46db98['ListId']){throw new Error(_0x1a28('0x83'));}}catch(_0x244b5e){throw new Error(_0x1a28('0x84'));}var _0x1f4dec=[];try{_0x1f4dec=_[_0x1a28('0x85')](JSON[_0x1a28('0x80')](process[_0x1a28('0x7b')][0x4]),'id');}catch(_0x348a39){logger[_0x1a28('0x3e')](_0x1a28('0x86'));}main(_0x1abfbd,_0x46db98,_0x1f4dec,_0x398772);}validate();process['on'](_0x1a28('0x87'),handleStop);process['on'](_0x1a28('0x88'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 327160b..bcea082 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 _0xec0e=['Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','membername','UniqueId','uniqueid','answertime','Complete\x20Time','Duration','duration','Billable\x20Time','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','calleridnum','outbound','Outbound\x20Call','destcalleridnum','string','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','calleridname','Call\x20To','destexten','Queue','Date','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','agentcalledAt','agentconnectAt'];(function(_0x255a99,_0x13476a){var _0x1a2ac7=function(_0x4b9b7c){while(--_0x4b9b7c){_0x255a99['push'](_0x255a99['shift']());}};_0x1a2ac7(++_0x13476a);}(_0xec0e,0x10b));var _0xeec0=function(_0x5a2d95,_0xb362e5){_0x5a2d95=_0x5a2d95-0x0;var _0x2c3986=_0xec0e[_0x5a2d95];return _0x2c3986;};'use strict';exports[_0xeec0('0x0')]=function(_0x519865,_0x23dbf9){var _0x45058b=[{'type':'string','content':_0xeec0('0x1'),'variableName':null}];switch(_0x519865[_0xeec0('0x2')]()){case _0xeec0('0x3'):switch(_0x23dbf9[_0xeec0('0x2')]()){case _0xeec0('0x4'):_0x45058b[_0xeec0('0x5')]({'type':_0xeec0('0x6'),'content':'','variableName':_0xeec0('0x7')});_0x45058b['push']({'type':'variable','content':'','variableName':_0xeec0('0x8')});break;case _0xeec0('0x9'):_0x45058b[_0xeec0('0x5')]({'type':'string','content':_0xeec0('0xa'),'variableName':null});_0x45058b['push']({'type':_0xeec0('0x6'),'content':'','variableName':_0xeec0('0xb')});break;}}return _0x45058b;};exports['getDescriptions']=function(_0x520c72,_0x530d3b){var _0x29e72a=[];switch(_0x520c72[_0xeec0('0x2')]()){case _0xeec0('0x3'):switch(_0x530d3b[_0xeec0('0x2')]()){case _0xeec0('0x4'):_0x29e72a=[{'type':_0xeec0('0xc'),'content':_0xeec0('0xd'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xeec0('0xe'),'keyType':_0xeec0('0x6'),'variableName':_0xeec0('0x8')},{'type':_0xeec0('0xf'),'content':'','key':'Caller\x20Name','keyType':_0xeec0('0x6'),'variableName':_0xeec0('0x10')},{'type':'keyValue','content':'','key':_0xeec0('0x11'),'keyType':_0xeec0('0x6'),'variableName':_0xeec0('0x12')},{'type':'keyValue','content':'','key':_0xeec0('0x13'),'keyType':'variable','variableName':_0xeec0('0x7')},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0xeec0('0x6'),'variableName':'uniqueid'},{'type':_0xeec0('0xf'),'content':'','key':_0xeec0('0x14'),'keyType':'variable','variableName':'agentcalledAt'},{'type':_0xeec0('0xc'),'content':_0xeec0('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0xeec0('0xf'),'content':'','key':'Agent\x20Name','keyType':_0xeec0('0x6'),'variableName':_0xeec0('0x16')},{'type':_0xeec0('0xf'),'content':'','key':_0xeec0('0x17'),'keyType':_0xeec0('0x6'),'variableName':_0xeec0('0xb')},{'type':_0xeec0('0xc'),'content':_0xeec0('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0xeec0('0xf'),'content':'','key':'Agent\x20Ring','keyType':_0xeec0('0x6'),'variableName':_0xeec0('0x19')},{'type':_0xeec0('0xf'),'content':'','key':'Agent\x20Connect','keyType':_0xeec0('0x6'),'variableName':_0xeec0('0x1a')},{'type':'keyValue','content':'','key':_0xeec0('0x1b'),'keyType':_0xeec0('0x6'),'variableName':_0xeec0('0x1c')},{'type':'keyValue','content':'','key':_0xeec0('0x1d'),'keyType':_0xeec0('0x6'),'variableName':_0xeec0('0x1e')},{'type':_0xeec0('0xf'),'content':'','key':_0xeec0('0x1f'),'keyType':'variable','variableName':_0xeec0('0x20')}];break;case _0xeec0('0x9'):_0x29e72a=[{'type':'string','content':_0xeec0('0xd'),'variableName':null},{'type':_0xeec0('0xf'),'content':'','key':'Called\x20Number','keyType':_0xeec0('0x6'),'keyContent':'','variableName':_0xeec0('0xb')},{'type':_0xeec0('0xf'),'content':'','key':'Member\x20Name','keyType':_0xeec0('0x6'),'keyContent':'','variableName':_0xeec0('0x21')},{'type':_0xeec0('0xf'),'content':'','key':_0xeec0('0x22'),'keyType':_0xeec0('0x6'),'keyContent':'','variableName':_0xeec0('0x23')},{'type':_0xeec0('0xf'),'content':'','key':_0xeec0('0x14'),'keyType':_0xeec0('0x6'),'keyContent':'','variableName':'starttime'},{'type':_0xeec0('0xc'),'content':_0xeec0('0x18')},{'type':_0xeec0('0xf'),'content':'','key':'Answer\x20Time','keyType':_0xeec0('0x6'),'keyContent':'','variableName':_0xeec0('0x24')},{'type':_0xeec0('0xf'),'content':'','key':_0xeec0('0x25'),'keyType':_0xeec0('0x6'),'keyContent':'','variableName':'endtime'},{'type':_0xeec0('0xf'),'content':'','key':_0xeec0('0x26'),'keyType':'variable','keyContent':'','variableName':_0xeec0('0x27')},{'type':_0xeec0('0xf'),'content':'','key':_0xeec0('0x28'),'keyType':_0xeec0('0x6'),'keyContent':'','variableName':_0xeec0('0x29')}];break;}}return _0x29e72a;}; \ No newline at end of file +var _0x1111=['Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','starttime','answertime','Complete\x20Time','endtime','Duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','calleridnum','outbound','Outbound\x20Call','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number'];(function(_0x237304,_0x3eb771){var _0x1c5dc5=function(_0x4cebb2){while(--_0x4cebb2){_0x237304['push'](_0x237304['shift']());}};_0x1c5dc5(++_0x3eb771);}(_0x1111,0xad));var _0x1111=function(_0x2599dd,_0x1587ab){_0x2599dd=_0x2599dd-0x0;var _0x577677=_0x1111[_0x2599dd];return _0x577677;};'use strict';exports[_0x1111('0x0')]=function(_0x59cb53,_0x476fd1){var _0x1b756a=[{'type':_0x1111('0x1'),'content':_0x1111('0x2'),'variableName':null}];switch(_0x59cb53[_0x1111('0x3')]()){case _0x1111('0x4'):switch(_0x476fd1[_0x1111('0x3')]()){case _0x1111('0x5'):_0x1b756a[_0x1111('0x6')]({'type':_0x1111('0x7'),'content':'','variableName':_0x1111('0x8')});_0x1b756a[_0x1111('0x6')]({'type':'variable','content':'','variableName':_0x1111('0x9')});break;case _0x1111('0xa'):_0x1b756a[_0x1111('0x6')]({'type':'string','content':_0x1111('0xb'),'variableName':null});_0x1b756a[_0x1111('0x6')]({'type':'variable','content':'','variableName':'destcalleridnum'});break;}}return _0x1b756a;};exports['getDescriptions']=function(_0x5f4b3b,_0x414c6f){var _0x129da9=[];switch(_0x5f4b3b[_0x1111('0x3')]()){case'voice':switch(_0x414c6f[_0x1111('0x3')]()){case _0x1111('0x5'):_0x129da9=[{'type':_0x1111('0x1'),'content':_0x1111('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x1111('0xd'),'content':'','key':_0x1111('0xe'),'keyType':_0x1111('0x7'),'variableName':_0x1111('0x9')},{'type':'keyValue','content':'','key':_0x1111('0xf'),'keyType':'variable','variableName':_0x1111('0x10')},{'type':_0x1111('0xd'),'content':'','key':_0x1111('0x11'),'keyType':_0x1111('0x7'),'variableName':_0x1111('0x12')},{'type':_0x1111('0xd'),'content':'','key':_0x1111('0x13'),'keyType':_0x1111('0x7'),'variableName':_0x1111('0x8')},{'type':_0x1111('0xd'),'content':'','key':_0x1111('0x14'),'keyType':_0x1111('0x7'),'variableName':_0x1111('0x15')},{'type':_0x1111('0xd'),'content':'','key':_0x1111('0x16'),'keyType':_0x1111('0x7'),'variableName':_0x1111('0x17')},{'type':_0x1111('0x1'),'content':_0x1111('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x1111('0xd'),'content':'','key':_0x1111('0x19'),'keyType':_0x1111('0x7'),'variableName':_0x1111('0x1a')},{'type':_0x1111('0xd'),'content':'','key':_0x1111('0x1b'),'keyType':_0x1111('0x7'),'variableName':_0x1111('0x1c')},{'type':_0x1111('0x1'),'content':_0x1111('0x1d'),'key':null,'keyType':null,'variableName':null},{'type':_0x1111('0xd'),'content':'','key':_0x1111('0x1e'),'keyType':_0x1111('0x7'),'variableName':'agentcalledAt'},{'type':_0x1111('0xd'),'content':'','key':_0x1111('0x1f'),'keyType':_0x1111('0x7'),'variableName':_0x1111('0x20')},{'type':'keyValue','content':'','key':'Agent\x20Complete','keyType':'variable','variableName':'agentcompleteAt'},{'type':_0x1111('0xd'),'content':'','key':_0x1111('0x21'),'keyType':_0x1111('0x7'),'variableName':_0x1111('0x22')},{'type':'keyValue','content':'','key':_0x1111('0x23'),'keyType':'variable','variableName':_0x1111('0x24')}];break;case'outbound':_0x129da9=[{'type':_0x1111('0x1'),'content':_0x1111('0xc'),'variableName':null},{'type':_0x1111('0xd'),'content':'','key':_0x1111('0x25'),'keyType':'variable','keyContent':'','variableName':_0x1111('0x1c')},{'type':'keyValue','content':'','key':_0x1111('0x26'),'keyType':_0x1111('0x7'),'keyContent':'','variableName':_0x1111('0x27')},{'type':_0x1111('0xd'),'content':'','key':'UniqueId','keyType':_0x1111('0x7'),'keyContent':'','variableName':_0x1111('0x15')},{'type':_0x1111('0xd'),'content':'','key':'Date','keyType':_0x1111('0x7'),'keyContent':'','variableName':_0x1111('0x28')},{'type':_0x1111('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x1111('0xd'),'content':'','key':'Answer\x20Time','keyType':_0x1111('0x7'),'keyContent':'','variableName':_0x1111('0x29')},{'type':_0x1111('0xd'),'content':'','key':_0x1111('0x2a'),'keyType':_0x1111('0x7'),'keyContent':'','variableName':_0x1111('0x2b')},{'type':_0x1111('0xd'),'content':'','key':_0x1111('0x2c'),'keyType':_0x1111('0x7'),'keyContent':'','variableName':'duration'},{'type':_0x1111('0xd'),'content':'','key':_0x1111('0x2d'),'keyType':_0x1111('0x7'),'keyContent':'','variableName':_0x1111('0x2e')}];break;}}return _0x129da9;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index f415862..fd58eef 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 _0xb5b1=['toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','findOne','then','update','info','catch','error','tracked','user','clone','body','omit','html','phone','fax','mobile','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown'];(function(_0x2d4310,_0x2c4294){var _0x52099f=function(_0x42c4ff){while(--_0x42c4ff){_0x2d4310['push'](_0x2d4310['shift']());}};_0x52099f(++_0x2c4294);}(_0xb5b1,0x17d));var _0x1b5b=function(_0x90e1,_0x4b378a){_0x90e1=_0x90e1-0x0;var _0x494a7e=_0xb5b1[_0x90e1];return _0x494a7e;};'use strict';var _=require('lodash');var db=require(_0x1b5b('0x0'))['db'];var loggers={'openchannel':require(_0x1b5b('0x1'))(_0x1b5b('0x2')),'mail':require('../../config/logger')(_0x1b5b('0x3')),'fax':require('../../config/logger')('fax-interactions'),'sms':require(_0x1b5b('0x1'))('sms-interactions'),'chat':require(_0x1b5b('0x1'))(_0x1b5b('0x4')),'whatsapp':require(_0x1b5b('0x1'))(_0x1b5b('0x5'))};function getInteractionId(_0x29483f,_0x2aa3cc,_0xfc728e){if(_0x29483f&&_0x29483f[_[_0x1b5b('0x6')](_0xfc728e)+_0x1b5b('0x7')]){return _0x29483f[_[_0x1b5b('0x6')](_0xfc728e)+'InteractionId'];}else if(_0x29483f&&_0x29483f['id']){return _0x29483f['id'];}else if(_0x2aa3cc&&_0x2aa3cc['id']){return _0x2aa3cc['id'];}else{return _0x1b5b('0x8');}}function log(_0x52e8ec,_0x5e0417,_0x4b43f4,_0x46fef3,_0x2e2159,_0x52bb07){loggers[_0x2e2159[_0x1b5b('0x9')]()][_0x52e8ec](_0x1b5b('0xa'),_0x52bb07[_0x1b5b('0xb')](),_0x5e0417?_0x5e0417['id']:null,_0x5e0417?_0x5e0417[_0x1b5b('0xc')]:null,_0x5e0417?_0x5e0417[_0x1b5b('0xd')]:null,getInteractionId(_0x4b43f4,_0x46fef3,_0x2e2159),_0x4b43f4?JSON[_0x1b5b('0xe')](_0x4b43f4):'null');}function updateUser(_0x329020,_0x467240,_0x51daf9,_0x2edf08,_0x146ce7){db[_[_0x1b5b('0x6')](_0x2edf08)+'Interaction'][_0x1b5b('0xf')]({'where':{'id':getInteractionId(_0x467240,_0x51daf9,_0x2edf08)}})[_0x1b5b('0x10')](function(_0x4c0625){if(_0x4c0625){return _0x4c0625[_0x1b5b('0x11')]({'UserId':_0x329020?_0x329020['id']:null});}})[_0x1b5b('0x10')](function(_0x5dce07){if(_0x5dce07){log(_0x1b5b('0x12'),_0x329020,_0x467240,_0x51daf9,_0x2edf08,_0x146ce7);}})[_0x1b5b('0x13')](function(){log(_0x1b5b('0x14'),_0x329020,_0x467240,_0x51daf9,_0x2edf08,_0x146ce7);});}exports[_0x1b5b('0x15')]=function(_0x55dd60,_0x2e3816){return function(_0x2eb6b7,_0x5c2d98,_0x2a5a10){var _0x20c535=_0x2eb6b7[_0x1b5b('0x16')];var _0x781bf0={};var _0x56e6a2=_0x2eb6b7['query'];if(_0x781bf0){_0x781bf0=_[_0x1b5b('0x17')](_0x2eb6b7[_0x1b5b('0x18')]);_0x781bf0=_[_0x1b5b('0x19')](_0x781bf0,['body',_0x1b5b('0x1a'),_0x1b5b('0x1b'),_0x1b5b('0x1c'),_0x1b5b('0x1d')]);}updateUser(_0x20c535,_0x781bf0,_0x56e6a2,_0x55dd60,_0x2e3816);_0x2a5a10(null);};}; \ No newline at end of file +var _0x1ccb=['[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','Interaction','findOne','then','info','catch','error','tracked','query','clone','body','omit','html','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','InteractionId','upperFirst','unknown'];(function(_0x3dd896,_0x1d5179){var _0x5adf93=function(_0x39618a){while(--_0x39618a){_0x3dd896['push'](_0x3dd896['shift']());}};_0x5adf93(++_0x1d5179);}(_0x1ccb,0xae));var _0xb1cc=function(_0x53050a,_0x2f477e){_0x53050a=_0x53050a-0x0;var _0x3c2ccb=_0x1ccb[_0x53050a];return _0x3c2ccb;};'use strict';var _=require(_0xb1cc('0x0'));var db=require(_0xb1cc('0x1'))['db'];var loggers={'openchannel':require(_0xb1cc('0x2'))(_0xb1cc('0x3')),'mail':require(_0xb1cc('0x2'))(_0xb1cc('0x4')),'fax':require(_0xb1cc('0x2'))(_0xb1cc('0x5')),'sms':require(_0xb1cc('0x2'))(_0xb1cc('0x6')),'chat':require(_0xb1cc('0x2'))(_0xb1cc('0x7')),'whatsapp':require(_0xb1cc('0x2'))(_0xb1cc('0x8'))};function getInteractionId(_0x3a51e,_0x594655,_0x3f10cc){if(_0x3a51e&&_0x3a51e[_['upperFirst'](_0x3f10cc)+_0xb1cc('0x9')]){return _0x3a51e[_[_0xb1cc('0xa')](_0x3f10cc)+_0xb1cc('0x9')];}else if(_0x3a51e&&_0x3a51e['id']){return _0x3a51e['id'];}else if(_0x594655&&_0x594655['id']){return _0x594655['id'];}else{return _0xb1cc('0xb');}}function log(_0x5c3b42,_0x4db132,_0x507aa1,_0x4ac681,_0x3f65d8,_0x376c95){loggers[_0x3f65d8['toLowerCase']()][_0x5c3b42](_0xb1cc('0xc'),_0x376c95[_0xb1cc('0xd')](),_0x4db132?_0x4db132['id']:null,_0x4db132?_0x4db132[_0xb1cc('0xe')]:null,_0x4db132?_0x4db132[_0xb1cc('0xf')]:null,getInteractionId(_0x507aa1,_0x4ac681,_0x3f65d8),_0x507aa1?JSON[_0xb1cc('0x10')](_0x507aa1):'null');}function updateUser(_0x17ddf9,_0x1ca57d,_0x2e26fb,_0x495cff,_0x2292f4){db[_[_0xb1cc('0xa')](_0x495cff)+_0xb1cc('0x11')][_0xb1cc('0x12')]({'where':{'id':getInteractionId(_0x1ca57d,_0x2e26fb,_0x495cff)}})['then'](function(_0x2f7149){if(_0x2f7149){return _0x2f7149['update']({'UserId':_0x17ddf9?_0x17ddf9['id']:null});}})[_0xb1cc('0x13')](function(_0x109d3c){if(_0x109d3c){log(_0xb1cc('0x14'),_0x17ddf9,_0x1ca57d,_0x2e26fb,_0x495cff,_0x2292f4);}})[_0xb1cc('0x15')](function(){log(_0xb1cc('0x16'),_0x17ddf9,_0x1ca57d,_0x2e26fb,_0x495cff,_0x2292f4);});}exports[_0xb1cc('0x17')]=function(_0xb7541a,_0x110dea){return function(_0x34a75e,_0x112cf7,_0x1b93c2){var _0x4a9c4b=_0x34a75e['user'];var _0x1f515d={};var _0xe5c180=_0x34a75e[_0xb1cc('0x18')];if(_0x1f515d){_0x1f515d=_[_0xb1cc('0x19')](_0x34a75e[_0xb1cc('0x1a')]);_0x1f515d=_[_0xb1cc('0x1b')](_0x1f515d,[_0xb1cc('0x1a'),_0xb1cc('0x1c'),'phone',_0xb1cc('0x1d'),_0xb1cc('0x1e')]);}updateUser(_0x4a9c4b,_0x1f515d,_0xe5c180,_0xb7541a,_0x110dea);_0x1b93c2(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index f6bda4b..618682c 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 _0xa22b=['split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','hasOwnProperty','License','findOne','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','user','isUserLimit','crypto','util','../../mysqldb','data1','license'];(function(_0x1c389c,_0x20d10b){var _0x3621d2=function(_0x2c83a1){while(--_0x2c83a1){_0x1c389c['push'](_0x1c389c['shift']());}};_0x3621d2(++_0x20d10b);}(_0xa22b,0x103));var _0xba22=function(_0x95381d,_0x11c0bd){_0x95381d=_0x95381d-0x0;var _0x44682b=_0xa22b[_0x95381d];return _0x44682b;};'use strict';var crypto=require(_0xba22('0x0'));var util=require(_0xba22('0x1'));var compose=require('composable-middleware');var db=require(_0xba22('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x5b322b,_0x1b411b){if(_0x5b322b&&_0x1b411b){if(_0x1b411b[_0xba22('0x3')]&&_0x1b411b[_0xba22('0x4')]){var _0x4f0eeb=_0x1b411b[_0xba22('0x3')];var _0xe88037=_0x1b411b[_0xba22('0x4')];var _0x56973c=_0x4f0eeb[_0xba22('0x5')]('-')[0x4];var _0x4ff127=_0x4f0eeb[_0xba22('0x5')]('-')[0x0];var _0x1597bf=crypto[_0xba22('0x6')](_0xba22('0x7'),util[_0xba22('0x8')](_0xba22('0x9'),_0x56973c,_0x4f0eeb,_0x4ff127));var _0x2e55f0=_0x1597bf[_0xba22('0xa')](_0xe88037,_0xba22('0xb'),_0xba22('0xc'));_0x2e55f0+=_0x1597bf['final'](_0xba22('0xc'));var _0x14e687=JSON['parse'](_0x2e55f0);return _0x14e687[_0xba22('0xd')](_0x5b322b)?_0x14e687[_0x5b322b]:null;}}return null;}function isLimit(_0x3371f7,_0x8d1f0,_0x50c6ae,_0x43b0cd){var _0x1bfb59=_0x8d1f0;return compose()['use'](function(_0x42e9ed,_0x287b8b,_0x454252){return db[_0xba22('0xe')][_0xba22('0xf')]({'where':{'id':0x1},'raw':!![]})[_0xba22('0x10')](function(_0x7d81af){var _0x2efc94=getValueFromLicense(_0x3371f7,_0x7d81af);return _0x2efc94?_0x2efc94:_0x1bfb59;})['then'](function(_0x50f798){_0x1bfb59=_0x50f798;return _0x50c6ae[_0xba22('0x11')](_0x43b0cd);})[_0xba22('0x10')](function(_0x3dc45b){if(_0x3dc45b>=_0x1bfb59){return _0x287b8b[_0xba22('0x12')](0x193)['json']({'message':util[_0xba22('0x8')](_0xba22('0x13'),_0x3371f7)});}_0x454252();})['catch'](function(_0x4bc2f9){_0x454252(_0x4bc2f9);});});}function isUserLimit(){return isLimit(_0xba22('0x14'),0x1,db[_0xba22('0x15')],{'where':{'$or':[{'role':'admin'},{'role':_0xba22('0x16')}]}});}exports[_0xba22('0x17')]=isUserLimit; \ No newline at end of file +var _0x9622=['split','createDecipher','aes-256-ctr','format','update','base64','utf8','final','parse','hasOwnProperty','License','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','license'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9622,0x14d));var _0x2962=function(_0x1d4c92,_0x1a3da1){_0x1d4c92=_0x1d4c92-0x0;var _0x5b7189=_0x9622[_0x1d4c92];return _0x5b7189;};'use strict';var crypto=require(_0x2962('0x0'));var util=require(_0x2962('0x1'));var compose=require(_0x2962('0x2'));var db=require(_0x2962('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0xa6fb4d,_0x2157aa){if(_0xa6fb4d&&_0x2157aa){if(_0x2157aa['data1']&&_0x2157aa[_0x2962('0x4')]){var _0x46da97=_0x2157aa['data1'];var _0x851ef1=_0x2157aa[_0x2962('0x4')];var _0x559d58=_0x46da97[_0x2962('0x5')]('-')[0x4];var _0x2b938f=_0x46da97['split']('-')[0x0];var _0x44601e=crypto[_0x2962('0x6')](_0x2962('0x7'),util[_0x2962('0x8')]('%s:%s:%s',_0x559d58,_0x46da97,_0x2b938f));var _0x3be73b=_0x44601e[_0x2962('0x9')](_0x851ef1,_0x2962('0xa'),_0x2962('0xb'));_0x3be73b+=_0x44601e[_0x2962('0xc')](_0x2962('0xb'));var _0x1f892b=JSON[_0x2962('0xd')](_0x3be73b);return _0x1f892b[_0x2962('0xe')](_0xa6fb4d)?_0x1f892b[_0xa6fb4d]:null;}}return null;}function isLimit(_0xef4a0a,_0x328de1,_0x3ccae6,_0x11b0e7){var _0xa43a46=_0x328de1;return compose()['use'](function(_0x3d7238,_0x23bc32,_0xd46f1e){return db[_0x2962('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x2962('0x10')](function(_0x11e877){var _0x565d08=getValueFromLicense(_0xef4a0a,_0x11e877);return _0x565d08?_0x565d08:_0xa43a46;})['then'](function(_0x427df1){_0xa43a46=_0x427df1;return _0x3ccae6[_0x2962('0x11')](_0x11b0e7);})[_0x2962('0x10')](function(_0x59d80b){if(_0x59d80b>=_0xa43a46){return _0x23bc32[_0x2962('0x12')](0x193)[_0x2962('0x13')]({'message':util['format'](_0x2962('0x14'),_0xef4a0a)});}_0xd46f1e();})[_0x2962('0x15')](function(_0x2536b5){_0xd46f1e(_0x2536b5);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x2962('0x16')],{'where':{'$or':[{'role':_0x2962('0x17')},{'role':_0x2962('0x18')}]}});}exports[_0x2962('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index c7386cb..1cba01a 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 _0xc311=['shift','indexOf','map','push','$eq','operator','value','includes','$gt','$lte','days','format','castTo','text','CAST(','\x20AS\x20','field','$ne','$notIn','$in','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','$between','BETWEEN\x20?\x20AND\x20?','start','pop','DATE','utcOffset','add','hours','minutes','seconds','lodash','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach'];(function(_0x468541,_0x16f066){var _0x4bb5e4=function(_0x540734){while(--_0x540734){_0x468541['push'](_0x468541['shift']());}};_0x4bb5e4(++_0x16f066);}(_0xc311,0x12c));var _0x1c31=function(_0x2cc656,_0x4f500e){_0x2cc656=_0x2cc656-0x0;var _0x297ef9=_0xc311[_0x2cc656];return _0x297ef9;};'use strict';var _=require(_0x1c31('0x0'));var moment=require('moment');exports[_0x1c31('0x1')]=function(_0x3e6857){var _0x2f6199={'conditions':[]};_0x2f6199[_0x1c31('0x2')]=_[_0x1c31('0x3')](_0x3e6857,_0x1c31('0x4'))?'or':_0x1c31('0x5');var _0x38061b=_0x3e6857[_0x1c31('0x6')](_0x1c31('0x7'),'')[_0x1c31('0x6')](_0x1c31('0x4'),'')[_0x1c31('0x8')]('||');for(var _0x341ef8=0x0;_0x341ef8<_0x38061b[_0x1c31('0x9')];_0x341ef8++){var _0x3c4fa4=_0x38061b[_0x341ef8]['split'](':=');var _0x3679ec=_0x3c4fa4[0x0];var _0x57d377=_0x3c4fa4[_0x1c31('0xa')](0x1);_0x57d377[_0x1c31('0xb')](function(_0x78d127){var _0x4b8f47=_0x78d127[_0x1c31('0x8')]('[')[_0x1c31('0xc')]();var _0x5e7593=_0x78d127['match'](/\[(.*?)\]/g);_0x5e7593[_0x1c31('0xb')](function(_0x461190){var _0x3d9e70=_0x461190[_0x1c31('0x8')]('[')['filter'](function(_0x384e4b){return _0x384e4b[_0x1c31('0xd')](']')>-0x1;})[_0x1c31('0xe')](function(_0x3115f7){return _0x3115f7['split'](']')[0x0];})[0x0];_0x2f6199['conditions'][_0x1c31('0xf')]({'field':_0x3679ec,'operator':_0x4b8f47,'value':_0x3d9e70});});});}return _0x2f6199;};exports['buildExpression']=function(_0x453bcf,_0x5d5144,_0x294ec3){var _0x636f53={};if(_0x5d5144==='DATE'){if(_0x294ec3['operator']===_0x1c31('0x10')){_0x294ec3[_0x1c31('0x11')]='$between';_0x294ec3[_0x1c31('0x12')]+=','+_0x294ec3[_0x1c31('0x12')];}else if(_[_0x1c31('0x13')]([_0x1c31('0x14'),_0x1c31('0x15')],_0x294ec3[_0x1c31('0x11')])){_0x294ec3[_0x1c31('0x12')]=moment(_0x294ec3[_0x1c31('0x12')])['add'](0x1,_0x1c31('0x16'))[_0x1c31('0x17')]('YYYY-MM-DD');}}if(_0x294ec3[_0x1c31('0x18')]){_0x5d5144=_0x294ec3[_0x1c31('0x18')];_0x636f53[_0x1c31('0x19')]=_0x1c31('0x1a')+_0x453bcf+'.'+_0x294ec3['field']+_0x1c31('0x1b')+_0x294ec3[_0x1c31('0x18')]+')\x20'+parseOperator(_0x294ec3[_0x1c31('0x11')]);}else{_0x636f53['text']=_0x453bcf+'.'+_0x294ec3[_0x1c31('0x1c')]+'\x20'+parseOperator(_0x294ec3[_0x1c31('0x11')]);}if(_[_0x1c31('0x13')]([_0x1c31('0x1d'),_0x1c31('0x1e')],_0x294ec3[_0x1c31('0x11')]))_0x636f53[_0x1c31('0x19')]='('+_0x636f53[_0x1c31('0x19')]+'\x20OR\x20'+_0x453bcf+'.'+_0x294ec3[_0x1c31('0x1c')]+'\x20IS\x20NULL)';_0x636f53[_0x1c31('0x12')]=parseValue(_0x5d5144,_0x294ec3[_0x1c31('0x11')],_0x294ec3['value']);return _0x636f53;};function parseOperator(_0x515e4f){var _0x2bdb70;switch(_0x515e4f){case _0x1c31('0x1f'):_0x2bdb70='IN\x20?';break;case _0x1c31('0x1e'):_0x2bdb70='NOT\x20IN\x20?';break;case _0x1c31('0x10'):_0x2bdb70=_0x1c31('0x20');break;case _0x1c31('0x1d'):_0x2bdb70=_0x1c31('0x21');break;case _0x1c31('0x22'):case _0x1c31('0x23'):case _0x1c31('0x24'):_0x2bdb70=_0x1c31('0x25');break;case _0x1c31('0x26'):_0x2bdb70=_0x1c31('0x27');break;case'$gt':_0x2bdb70=_0x1c31('0x28');break;case _0x1c31('0x15'):_0x2bdb70='<=\x20?';break;case _0x1c31('0x29'):_0x2bdb70='>=\x20?';break;case _0x1c31('0x2a'):_0x2bdb70=_0x1c31('0x2b');break;}return _0x2bdb70;}function parseValue(_0x9a657c,_0x220dd7,_0x448af6){var _0x3cd191={'start':undefined,'end':undefined};switch(_0x220dd7){case _0x1c31('0x1f'):case _0x1c31('0x1e'):_0x3cd191[_0x1c31('0x2c')]=_0x448af6['split'](',');break;case _0x1c31('0x22'):_0x3cd191[_0x1c31('0x2c')]='%'+_0x448af6+'%';break;case _0x1c31('0x23'):_0x3cd191[_0x1c31('0x2c')]=_0x448af6+'%';break;case _0x1c31('0x24'):_0x3cd191[_0x1c31('0x2c')]='%'+_0x448af6;break;case _0x1c31('0x2a'):var _0x16b704=_0x448af6[_0x1c31('0x8')](',');var _0x448af6=_0x16b704['shift']();var _0x5a0f98=_0x16b704[_0x1c31('0x2d')]();if(_0x9a657c===_0x1c31('0x2e')){_0x448af6=moment(_0x448af6)[_0x1c31('0x2f')](0x0,!![])['format']();_0x5a0f98=moment(_0x5a0f98)['utcOffset'](0x0,!![])[_0x1c31('0x30')](0x17,_0x1c31('0x31'))[_0x1c31('0x30')](0x3b,_0x1c31('0x32'))['add'](0x3b,_0x1c31('0x33'))[_0x1c31('0x17')]();}_0x3cd191={'start':_0x448af6,'end':_0x5a0f98};break;default:_0x3cd191[_0x1c31('0x2c')]=_0x448af6;break;}return _0x3cd191;} \ No newline at end of file +var _0x1b28=['format','YYYY-MM-DD','castTo','CAST(','text','field','$ne','$notIn','$in','NOT\x20IN\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','minutes','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','forEach','shift','match','filter','map','conditions','buildExpression','operator','$eq','$between','value','$gt','$lte','add','days'];(function(_0x3b3f4f,_0x403216){var _0x174dbe=function(_0x30e333){while(--_0x30e333){_0x3b3f4f['push'](_0x3b3f4f['shift']());}};_0x174dbe(++_0x403216);}(_0x1b28,0x1e5));var _0x81b2=function(_0x23c827,_0x50c7de){_0x23c827=_0x23c827-0x0;var _0x4cd351=_0x1b28[_0x23c827];return _0x4cd351;};'use strict';var _=require('lodash');var moment=require(_0x81b2('0x0'));exports[_0x81b2('0x1')]=function(_0x2dd7d1){var _0x2caa26={'conditions':[]};_0x2caa26[_0x81b2('0x2')]=_[_0x81b2('0x3')](_0x2dd7d1,_0x81b2('0x4'))?'or':_0x81b2('0x5');var _0x460ce0=_0x2dd7d1[_0x81b2('0x6')](_0x81b2('0x7'),'')[_0x81b2('0x6')](_0x81b2('0x4'),'')[_0x81b2('0x8')]('||');for(var _0x269ee6=0x0;_0x269ee6<_0x460ce0[_0x81b2('0x9')];_0x269ee6++){var _0x2c2e74=_0x460ce0[_0x269ee6]['split'](':=');var _0x55704c=_0x2c2e74[0x0];var _0x49836=_0x2c2e74['slice'](0x1);_0x49836[_0x81b2('0xa')](function(_0x39422d){var _0x166d27=_0x39422d[_0x81b2('0x8')]('[')[_0x81b2('0xb')]();var _0x448e7e=_0x39422d[_0x81b2('0xc')](/\[(.*?)\]/g);_0x448e7e[_0x81b2('0xa')](function(_0x2ac1b2){var _0x5dc22f=_0x2ac1b2['split']('[')[_0x81b2('0xd')](function(_0x5ece0a){return _0x5ece0a['indexOf'](']')>-0x1;})[_0x81b2('0xe')](function(_0x39c08b){return _0x39c08b['split'](']')[0x0];})[0x0];_0x2caa26[_0x81b2('0xf')]['push']({'field':_0x55704c,'operator':_0x166d27,'value':_0x5dc22f});});});}return _0x2caa26;};exports[_0x81b2('0x10')]=function(_0x4334b4,_0x3ed399,_0x23576b){var _0x57bb5b={};if(_0x3ed399==='DATE'){if(_0x23576b[_0x81b2('0x11')]===_0x81b2('0x12')){_0x23576b[_0x81b2('0x11')]=_0x81b2('0x13');_0x23576b[_0x81b2('0x14')]+=','+_0x23576b['value'];}else if(_['includes']([_0x81b2('0x15'),_0x81b2('0x16')],_0x23576b[_0x81b2('0x11')])){_0x23576b['value']=moment(_0x23576b[_0x81b2('0x14')])[_0x81b2('0x17')](0x1,_0x81b2('0x18'))[_0x81b2('0x19')](_0x81b2('0x1a'));}}if(_0x23576b[_0x81b2('0x1b')]){_0x3ed399=_0x23576b['castTo'];_0x57bb5b['text']=_0x81b2('0x1c')+_0x4334b4+'.'+_0x23576b['field']+'\x20AS\x20'+_0x23576b[_0x81b2('0x1b')]+')\x20'+parseOperator(_0x23576b[_0x81b2('0x11')]);}else{_0x57bb5b[_0x81b2('0x1d')]=_0x4334b4+'.'+_0x23576b[_0x81b2('0x1e')]+'\x20'+parseOperator(_0x23576b[_0x81b2('0x11')]);}if(_['includes']([_0x81b2('0x1f'),_0x81b2('0x20')],_0x23576b[_0x81b2('0x11')]))_0x57bb5b[_0x81b2('0x1d')]='('+_0x57bb5b['text']+'\x20OR\x20'+_0x4334b4+'.'+_0x23576b[_0x81b2('0x1e')]+'\x20IS\x20NULL)';_0x57bb5b[_0x81b2('0x14')]=parseValue(_0x3ed399,_0x23576b['operator'],_0x23576b[_0x81b2('0x14')]);return _0x57bb5b;};function parseOperator(_0x180769){var _0x55e608;switch(_0x180769){case _0x81b2('0x21'):_0x55e608='IN\x20?';break;case'$notIn':_0x55e608=_0x81b2('0x22');break;case'$eq':_0x55e608='=\x20?';break;case'$ne':_0x55e608='<>\x20?';break;case _0x81b2('0x23'):case _0x81b2('0x24'):case _0x81b2('0x25'):_0x55e608=_0x81b2('0x26');break;case _0x81b2('0x27'):_0x55e608=_0x81b2('0x28');break;case'$gt':_0x55e608=_0x81b2('0x29');break;case _0x81b2('0x16'):_0x55e608=_0x81b2('0x2a');break;case _0x81b2('0x2b'):_0x55e608=_0x81b2('0x2c');break;case _0x81b2('0x13'):_0x55e608=_0x81b2('0x2d');break;}return _0x55e608;}function parseValue(_0x167396,_0x1bba97,_0xd03f29){var _0x189cae={'start':undefined,'end':undefined};switch(_0x1bba97){case _0x81b2('0x21'):case _0x81b2('0x20'):_0x189cae['start']=_0xd03f29[_0x81b2('0x8')](',');break;case _0x81b2('0x23'):_0x189cae[_0x81b2('0x2e')]='%'+_0xd03f29+'%';break;case _0x81b2('0x24'):_0x189cae[_0x81b2('0x2e')]=_0xd03f29+'%';break;case _0x81b2('0x25'):_0x189cae[_0x81b2('0x2e')]='%'+_0xd03f29;break;case'$between':var _0x38a76e=_0xd03f29[_0x81b2('0x8')](',');var _0xd03f29=_0x38a76e[_0x81b2('0xb')]();var _0x20204a=_0x38a76e[_0x81b2('0x2f')]();if(_0x167396==='DATE'){_0xd03f29=moment(_0xd03f29)[_0x81b2('0x30')](0x0,!![])[_0x81b2('0x19')]();_0x20204a=moment(_0x20204a)['utcOffset'](0x0,!![])[_0x81b2('0x17')](0x17,_0x81b2('0x31'))[_0x81b2('0x17')](0x3b,_0x81b2('0x32'))[_0x81b2('0x17')](0x3b,'seconds')[_0x81b2('0x19')]();}_0x189cae={'start':_0xd03f29,'end':_0x20204a};break;default:_0x189cae[_0x81b2('0x2e')]=_0xd03f29;break;}return _0x189cae;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index e8a9963..e6d8d30 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 _0x00e9=['intersection','attributes','fields','nolimit','offset','order','where','pick','filter','columns','merge','VIRTUAL','lower','lodash','moment','parse','keys','includes','filters','isEmpty','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','uniqueid','isArray','split','limit','sort','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','length','isObject','isString','hasOwnProperty','isNumeric','^[+]?[0-9]*$','isEmail','match','getFullTextValue','replace','push','join','getOptions','$id','query','model','map','name'];(function(_0x44b106,_0x267891){var _0x94cb5b=function(_0x1c1561){while(--_0x1c1561){_0x44b106['push'](_0x44b106['shift']());}};_0x94cb5b(++_0x267891);}(_0x00e9,0x139));var _0x900e=function(_0x53d884,_0x485ad7){_0x53d884=_0x53d884-0x0;var _0x39320d=_0x00e9[_0x53d884];return _0x39320d;};'use strict';var _=require(_0x900e('0x0'));var sequelize=require('sequelize');var moment=require(_0x900e('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0xacff04){var _0x144420=['ne'];try{var _0xaaf7ef=JSON[_0x900e('0x2')](_0xacff04);var _0x2e5a43=Object[_0x900e('0x3')](_0xaaf7ef)[0x0];return _0x144420[_0x900e('0x4')](_0x2e5a43);}catch(_0x5bce11){return![];}}function getOperatorValue(_0x2a1eef){var _0x4f3ca7=JSON[_0x900e('0x2')](_0x2a1eef);var _0x55f947=Object[_0x900e('0x3')](_0x4f3ca7)[0x0];var _0x2ed709=_0x4f3ca7[_0x55f947];return{['$'+_0x55f947]:_0x2ed709};}exports['fields']=function(_0x1a692d){var _0x4eeeed=null;if(_0x1a692d){_0x4eeeed=_0x1a692d['split'](',');}return _0x4eeeed;};exports[_0x900e('0x5')]=function(_0x2afacf,_0xb41cc2){var _0x1c8dfe={};if(!_[_0x900e('0x6')](_0x2afacf)){_['forOwn'](_0x2afacf,function(_0x5817db,_0x57aca1){try{if(_0xb41cc2){var _0x44ecda=_['find'](_0xb41cc2,{'name':_0x57aca1})||{};if(hasSequelizeOperator(_0x5817db)){_0x1c8dfe[_0x57aca1]=getOperatorValue(_0x5817db);}else if(_0x44ecda[_0x900e('0x7')]===_0x900e('0x8')&&_[_0x900e('0x9')](_0x5817db)){var _0x35165e=JSON[_0x900e('0x2')](_0x5817db);var _0x1884f7={'$gte':moment(moment(_0x35165e[_0x900e('0xa')])[_0x900e('0xb')](_0x900e('0xc')))[_0x900e('0xd')]()[_0x900e('0xb')](),'$lte':moment(moment(_0x35165e[_0x900e('0xe')])[_0x900e('0xb')](_0x900e('0xc')))[_0x900e('0xd')]()['subtract'](0x1,'s')[_0x900e('0xb')]()};_0x1c8dfe[_0x57aca1]=_0x1884f7;}else if(_0x44ecda['name']===_0x900e('0xf')){_0x1c8dfe[_0x57aca1]=_0x5817db;}else{_0x1c8dfe[_0x57aca1]=_[_0x900e('0x10')](_0x5817db)?_0x5817db:JSON[_0x900e('0x2')](_0x5817db);}}else{_0x1c8dfe[_0x57aca1]=_[_0x900e('0x10')](_0x5817db)?_0x5817db:JSON[_0x900e('0x2')](_0x5817db);}}catch(_0x409c35){_0x1c8dfe[_0x57aca1]=_0x5817db[_0x900e('0x11')](',');}});}return _0x1c8dfe;};exports[_0x900e('0x12')]=function(_0x1f9118){_0x1f9118=parseInt(_0x1f9118,0xa);if(!_0x1f9118||_0x1f9118<0x0){_0x1f9118=LIMIT_VALUE;}return _0x1f9118;};exports['offset']=function(_0x24fcfb){_0x24fcfb=parseInt(_0x24fcfb,0xa);if(!_0x24fcfb||_0x24fcfb<0x0){_0x24fcfb=0x0;}return _0x24fcfb;};exports[_0x900e('0x13')]=function(_0x3869e8){var _0x67156,_0x5b2db8=null;if(_0x3869e8){_0x67156=_0x3869e8[_0x900e('0x11')](',');_0x5b2db8=_['map'](_0x67156,function(_0x5b0e02){if(_0x5b0e02[_0x900e('0x14')]('-')===0x0){return[_0x5b0e02===_0x900e('0x15')?sequelize[_0x900e('0x16')](sequelize[_0x900e('0x17')](_0x900e('0x15')),_0x900e('0x18')):_0x5b0e02[_0x900e('0x19')](0x1),_0x900e('0x1a')];}else{return[_0x5b0e02==='priority'?sequelize[_0x900e('0x16')](sequelize[_0x900e('0x17')](_0x900e('0x15')),_0x900e('0x18')):_0x5b0e02,_0x900e('0x1b')];}});}return _0x5b2db8;};exports[_0x900e('0x1c')]=function(_0x199dd1,_0x2787f2){if(_[_0x900e('0x6')](_0x199dd1)){return _0x199dd1;}if(_[_0x900e('0x10')](_0x199dd1)){for(var _0x1e4eb7=0x0;_0x1e4eb7<_0x199dd1[_0x900e('0x1d')];_0x1e4eb7+=0x1){_0x199dd1[_0x1e4eb7]=this[_0x900e('0x1c')](_0x199dd1[_0x1e4eb7],_0x2787f2);}return _0x199dd1;}if(!_[_0x900e('0x1e')](_0x199dd1)){return _0x199dd1;}if(_[_0x900e('0x1f')](_0x2787f2)){_0x2787f2=[_0x2787f2];}if(!_[_0x900e('0x10')](_0x2787f2)){return _0x199dd1;}for(var _0x2626dc=0x0;_0x2626dc<_0x2787f2[_0x900e('0x1d')];_0x2626dc+=0x1){_['unset'](_0x199dd1,_0x2787f2[_0x2626dc]);}for(var _0x3801b2 in _0x199dd1){if(_0x199dd1[_0x900e('0x20')](_0x3801b2)){_0x199dd1[_0x3801b2]=this[_0x900e('0x1c')](_0x199dd1[_0x3801b2],_0x2787f2);}}return _0x199dd1;};exports[_0x900e('0x21')]=function(_0x5a9b00){return _0x5a9b00['match'](RegExp(_0x900e('0x22')))?!![]:![];};exports[_0x900e('0x23')]=function(_0x50b1d8){return _0x50b1d8[_0x900e('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0x900e('0x25')]=function(_0x3a1ded){var _0x20c811=[];_0x3a1ded[_0x900e('0x11')](/[ ,]+/)['forEach'](function(_0x18927a){_0x18927a=_0x18927a[_0x900e('0x26')](/([^:]")"+/g,'$1');_0x18927a='+'+_0x18927a+'*';var _0x205ac2=/[ `!@#$%^&*()_\-?~]/;if(_0x18927a[_0x900e('0x24')](_0x205ac2))_0x18927a='\x22'+_0x18927a+'\x22';_0x20c811[_0x900e('0x27')](_0x18927a);});return _0x20c811[_0x900e('0x28')]('\x20');};exports[_0x900e('0x29')]=function(_0x263755,_0x257247,_0x1e22b6){var _0x21cbcf={},_0x2e5aea={};if(_0x257247['query'][_0x900e('0x2a')]){_0x257247['query']['id']=_0x257247[_0x900e('0x2b')][_0x900e('0x2a')];delete _0x257247[_0x900e('0x2b')][_0x900e('0x2a')];}_0x21cbcf[_0x900e('0x2c')]=_[_0x900e('0x2d')](_0x263755,_0x900e('0x2e'));_0x21cbcf['query']=_[_0x900e('0x3')](_0x257247['query']);_0x21cbcf['filters']=_[_0x900e('0x2f')](_0x21cbcf[_0x900e('0x2c')],_0x21cbcf[_0x900e('0x2b')]);_0x2e5aea[_0x900e('0x30')]=_[_0x900e('0x2f')](_0x21cbcf[_0x900e('0x2c')],this[_0x900e('0x31')](_0x257247['query']['fields']));_0x2e5aea['attributes']=_0x2e5aea[_0x900e('0x30')][_0x900e('0x1d')]?_0x2e5aea[_0x900e('0x30')]:_0x21cbcf[_0x900e('0x2c')];if(!_0x257247[_0x900e('0x2b')][_0x900e('0x20')](_0x900e('0x32'))){_0x2e5aea[_0x900e('0x12')]=this['limit'](_0x257247['query'][_0x900e('0x12')]);_0x2e5aea[_0x900e('0x33')]=this[_0x900e('0x33')](_0x257247['query'][_0x900e('0x33')]);}_0x2e5aea[_0x900e('0x34')]=this[_0x900e('0x13')](_0x257247['query'][_0x900e('0x13')]);_0x2e5aea[_0x900e('0x35')]=this['filters'](_[_0x900e('0x36')](_0x257247[_0x900e('0x2b')],_0x21cbcf[_0x900e('0x5')]),_0x263755);if(_0x257247[_0x900e('0x2b')][_0x900e('0x37')]){var _0x15b6db=_0x263755;var _0x596221=_0x257247[_0x900e('0x2b')][_0x900e('0x37')];if(typeof _0x596221==='object'){_0x15b6db=_[_0x900e('0x37')](_0x263755,function(_0x1b916b){return _[_0x900e('0x4')](_0x596221[_0x900e('0x38')],_0x1b916b[_0x900e('0x2e')]);});_0x596221=_0x596221['value'];}_0x2e5aea['where']=_[_0x900e('0x39')](_0x2e5aea['where'],{'$or':_[_0x900e('0x2d')](_0x15b6db,function(_0x518202){if(_0x518202[_0x900e('0x7')]!==_0x900e('0x3a')){if(_0x1e22b6){return sequelize[_0x900e('0x35')](sequelize['fn']('lower',sequelize[_0x900e('0x17')](_0x518202['name'])),{'$like':sequelize['fn'](_0x900e('0x3b'),'%'+_0x257247[_0x900e('0x2b')][_0x900e('0x37')]+'%')});}else{var _0x5f1368={};_0x5f1368[_0x518202['name']]={'$like':'%'+_0x257247[_0x900e('0x2b')][_0x900e('0x37')]+'%'};return _0x5f1368;}}})});}_0x2e5aea=_['merge']({},_0x2e5aea,_0x257247['options']);return _0x2e5aea;}; \ No newline at end of file +var _0xb3dc=['utc','$lte','name','uniqueid','isArray','limit','offset','sort','map','indexOf','cast','col','priority','substr','DESC','unsigned','ASC','omit','isObject','isString','length','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','replace','push','join','getOptions','$id','query','intersection','model','attributes','hasOwnProperty','nolimit','order','pick','filter','object','columns','merge','where','VIRTUAL','lower','options','lodash','moment','keys','parse','fields','split','filters','isEmpty','forOwn','find','type','DATE','$gte','format','YYYY-MM-DD'];(function(_0x43744e,_0x2b19b0){var _0x9aa043=function(_0x3292b7){while(--_0x3292b7){_0x43744e['push'](_0x43744e['shift']());}};_0x9aa043(++_0x2b19b0);}(_0xb3dc,0xae));var _0xcb3d=function(_0xeacc66,_0x30e466){_0xeacc66=_0xeacc66-0x0;var _0x3db71b=_0xb3dc[_0xeacc66];return _0x3db71b;};'use strict';var _=require(_0xcb3d('0x0'));var sequelize=require('sequelize');var moment=require(_0xcb3d('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x42b6b1){var _0x320747=['ne'];try{var _0x1f275c=JSON['parse'](_0x42b6b1);var _0x5e2e92=Object[_0xcb3d('0x2')](_0x1f275c)[0x0];return _0x320747['includes'](_0x5e2e92);}catch(_0x1fe8e5){return![];}}function getOperatorValue(_0x510db4){var _0x5385d6=JSON[_0xcb3d('0x3')](_0x510db4);var _0x3b4786=Object[_0xcb3d('0x2')](_0x5385d6)[0x0];var _0x31367d=_0x5385d6[_0x3b4786];return{['$'+_0x3b4786]:_0x31367d};}exports[_0xcb3d('0x4')]=function(_0xbe35b1){var _0x44cd50=null;if(_0xbe35b1){_0x44cd50=_0xbe35b1[_0xcb3d('0x5')](',');}return _0x44cd50;};exports[_0xcb3d('0x6')]=function(_0x2d92e1,_0x43df04){var _0x12b2c6={};if(!_[_0xcb3d('0x7')](_0x2d92e1)){_[_0xcb3d('0x8')](_0x2d92e1,function(_0x466780,_0x35f671){try{if(_0x43df04){var _0x4699d2=_[_0xcb3d('0x9')](_0x43df04,{'name':_0x35f671})||{};if(hasSequelizeOperator(_0x466780)){_0x12b2c6[_0x35f671]=getOperatorValue(_0x466780);}else if(_0x4699d2[_0xcb3d('0xa')]===_0xcb3d('0xb')&&_['isPlainObject'](_0x466780)){var _0x545925=JSON['parse'](_0x466780);var _0x22af8c={'$gte':moment(moment(_0x545925[_0xcb3d('0xc')])[_0xcb3d('0xd')](_0xcb3d('0xe')))[_0xcb3d('0xf')]()[_0xcb3d('0xd')](),'$lte':moment(moment(_0x545925[_0xcb3d('0x10')])['format'](_0xcb3d('0xe')))[_0xcb3d('0xf')]()['subtract'](0x1,'s')[_0xcb3d('0xd')]()};_0x12b2c6[_0x35f671]=_0x22af8c;}else if(_0x4699d2[_0xcb3d('0x11')]===_0xcb3d('0x12')){_0x12b2c6[_0x35f671]=_0x466780;}else{_0x12b2c6[_0x35f671]=_[_0xcb3d('0x13')](_0x466780)?_0x466780:JSON['parse'](_0x466780);}}else{_0x12b2c6[_0x35f671]=_['isArray'](_0x466780)?_0x466780:JSON[_0xcb3d('0x3')](_0x466780);}}catch(_0x83d586){_0x12b2c6[_0x35f671]=_0x466780[_0xcb3d('0x5')](',');}});}return _0x12b2c6;};exports[_0xcb3d('0x14')]=function(_0x5a391d){_0x5a391d=parseInt(_0x5a391d,0xa);if(!_0x5a391d||_0x5a391d<0x0){_0x5a391d=LIMIT_VALUE;}return _0x5a391d;};exports[_0xcb3d('0x15')]=function(_0x343741){_0x343741=parseInt(_0x343741,0xa);if(!_0x343741||_0x343741<0x0){_0x343741=0x0;}return _0x343741;};exports[_0xcb3d('0x16')]=function(_0x42d249){var _0xdfdb60,_0x1af15f=null;if(_0x42d249){_0xdfdb60=_0x42d249[_0xcb3d('0x5')](',');_0x1af15f=_[_0xcb3d('0x17')](_0xdfdb60,function(_0x127506){if(_0x127506[_0xcb3d('0x18')]('-')===0x0){return[_0x127506==='priority'?sequelize[_0xcb3d('0x19')](sequelize[_0xcb3d('0x1a')](_0xcb3d('0x1b')),'unsigned'):_0x127506[_0xcb3d('0x1c')](0x1),_0xcb3d('0x1d')];}else{return[_0x127506===_0xcb3d('0x1b')?sequelize[_0xcb3d('0x19')](sequelize[_0xcb3d('0x1a')]('priority'),_0xcb3d('0x1e')):_0x127506,_0xcb3d('0x1f')];}});}return _0x1af15f;};exports[_0xcb3d('0x20')]=function(_0x2f5e02,_0x39f6b6){if(_['isEmpty'](_0x2f5e02)){return _0x2f5e02;}if(_['isArray'](_0x2f5e02)){for(var _0x2deffc=0x0;_0x2deffc<_0x2f5e02['length'];_0x2deffc+=0x1){_0x2f5e02[_0x2deffc]=this['omit'](_0x2f5e02[_0x2deffc],_0x39f6b6);}return _0x2f5e02;}if(!_[_0xcb3d('0x21')](_0x2f5e02)){return _0x2f5e02;}if(_[_0xcb3d('0x22')](_0x39f6b6)){_0x39f6b6=[_0x39f6b6];}if(!_[_0xcb3d('0x13')](_0x39f6b6)){return _0x2f5e02;}for(var _0x3a316a=0x0;_0x3a316a<_0x39f6b6[_0xcb3d('0x23')];_0x3a316a+=0x1){_[_0xcb3d('0x24')](_0x2f5e02,_0x39f6b6[_0x3a316a]);}for(var _0x411051 in _0x2f5e02){if(_0x2f5e02['hasOwnProperty'](_0x411051)){_0x2f5e02[_0x411051]=this[_0xcb3d('0x20')](_0x2f5e02[_0x411051],_0x39f6b6);}}return _0x2f5e02;};exports[_0xcb3d('0x25')]=function(_0xc8b288){return _0xc8b288[_0xcb3d('0x26')](RegExp(_0xcb3d('0x27')))?!![]:![];};exports[_0xcb3d('0x28')]=function(_0x3d8cd6){return _0x3d8cd6[_0xcb3d('0x26')](/^\S+@\S+$/)?!![]:![];};exports[_0xcb3d('0x29')]=function(_0x33404f){var _0x571f46=[];_0x33404f['split'](/[ ,]+/)['forEach'](function(_0x1342a5){_0x1342a5=_0x1342a5[_0xcb3d('0x2a')](/([^:]")"+/g,'$1');_0x1342a5='+'+_0x1342a5+'*';var _0x77b41d=/[ `!@#$%^&*()_\-?~]/;if(_0x1342a5[_0xcb3d('0x26')](_0x77b41d))_0x1342a5='\x22'+_0x1342a5+'\x22';_0x571f46[_0xcb3d('0x2b')](_0x1342a5);});return _0x571f46[_0xcb3d('0x2c')]('\x20');};exports[_0xcb3d('0x2d')]=function(_0x5ca48d,_0x507788,_0x592f42){var _0x1514db={},_0x4ae9b7={};if(_0x507788['query'][_0xcb3d('0x2e')]){_0x507788[_0xcb3d('0x2f')]['id']=_0x507788[_0xcb3d('0x2f')][_0xcb3d('0x2e')];delete _0x507788[_0xcb3d('0x2f')][_0xcb3d('0x2e')];}_0x1514db['model']=_[_0xcb3d('0x17')](_0x5ca48d,_0xcb3d('0x11'));_0x1514db[_0xcb3d('0x2f')]=_[_0xcb3d('0x2')](_0x507788['query']);_0x1514db['filters']=_[_0xcb3d('0x30')](_0x1514db[_0xcb3d('0x31')],_0x1514db[_0xcb3d('0x2f')]);_0x4ae9b7[_0xcb3d('0x32')]=_[_0xcb3d('0x30')](_0x1514db['model'],this['fields'](_0x507788[_0xcb3d('0x2f')][_0xcb3d('0x4')]));_0x4ae9b7[_0xcb3d('0x32')]=_0x4ae9b7[_0xcb3d('0x32')][_0xcb3d('0x23')]?_0x4ae9b7[_0xcb3d('0x32')]:_0x1514db[_0xcb3d('0x31')];if(!_0x507788[_0xcb3d('0x2f')][_0xcb3d('0x33')](_0xcb3d('0x34'))){_0x4ae9b7[_0xcb3d('0x14')]=this['limit'](_0x507788[_0xcb3d('0x2f')][_0xcb3d('0x14')]);_0x4ae9b7[_0xcb3d('0x15')]=this[_0xcb3d('0x15')](_0x507788[_0xcb3d('0x2f')]['offset']);}_0x4ae9b7[_0xcb3d('0x35')]=this[_0xcb3d('0x16')](_0x507788['query'][_0xcb3d('0x16')]);_0x4ae9b7['where']=this[_0xcb3d('0x6')](_[_0xcb3d('0x36')](_0x507788[_0xcb3d('0x2f')],_0x1514db['filters']),_0x5ca48d);if(_0x507788[_0xcb3d('0x2f')][_0xcb3d('0x37')]){var _0x1cf84f=_0x5ca48d;var _0x55d0e3=_0x507788[_0xcb3d('0x2f')][_0xcb3d('0x37')];if(typeof _0x55d0e3===_0xcb3d('0x38')){_0x1cf84f=_[_0xcb3d('0x37')](_0x5ca48d,function(_0x4a7b37){return _['includes'](_0x55d0e3[_0xcb3d('0x39')],_0x4a7b37[_0xcb3d('0x11')]);});_0x55d0e3=_0x55d0e3['value'];}_0x4ae9b7['where']=_[_0xcb3d('0x3a')](_0x4ae9b7[_0xcb3d('0x3b')],{'$or':_[_0xcb3d('0x17')](_0x1cf84f,function(_0x355a8a){if(_0x355a8a[_0xcb3d('0xa')]!==_0xcb3d('0x3c')){if(_0x592f42){return sequelize[_0xcb3d('0x3b')](sequelize['fn'](_0xcb3d('0x3d'),sequelize[_0xcb3d('0x1a')](_0x355a8a[_0xcb3d('0x11')])),{'$like':sequelize['fn'](_0xcb3d('0x3d'),'%'+_0x507788[_0xcb3d('0x2f')][_0xcb3d('0x37')]+'%')});}else{var _0x13834e={};_0x13834e[_0x355a8a[_0xcb3d('0x11')]]={'$like':'%'+_0x507788[_0xcb3d('0x2f')][_0xcb3d('0x37')]+'%'};return _0x13834e;}}})});}_0x4ae9b7=_[_0xcb3d('0x3a')]({},_0x4ae9b7,_0x507788[_0xcb3d('0x3e')]);return _0x4ae9b7;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 2939ced..2538c3e 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8328=['public','development','test','client','use','set','json\x20replacer','toISOString','split','static','views','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','json','initialize','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path','passport','default','get','env','appPath','join','root'];(function(_0x175102,_0x4ead13){var _0x5dce66=function(_0x315357){while(--_0x315357){_0x175102['push'](_0x175102['shift']());}};_0x5dce66(++_0x4ead13);}(_0x8328,0x168));var _0x8832=function(_0x48b297,_0x50f86f){_0x48b297=_0x48b297-0x0;var _0x111111=_0x8328[_0x48b297];return _0x111111;};'use strict';var express=require(_0x8832('0x0'));var favicon=require(_0x8832('0x1'));var bodyParser=require(_0x8832('0x2'));var methodOverride=require(_0x8832('0x3'));var cookieParser=require(_0x8832('0x4'));var errorHandler=require(_0x8832('0x5'));var path=require(_0x8832('0x6'));var passport=require(_0x8832('0x7'));var cors=require('cors');var moment=require('moment');var config=require('./environment');var db=require('../mysqldb')['db'];exports[_0x8832('0x8')]=function(_0x56ac56){var _0x5c8879=_0x56ac56[_0x8832('0x9')](_0x8832('0xa'));if(_0x5c8879==='production'){_0x56ac56['set'](_0x8832('0xb'),path[_0x8832('0xc')](config[_0x8832('0xd')],_0x8832('0xe')));}if(_0x5c8879===_0x8832('0xf')||_0x5c8879===_0x8832('0x10')){_0x56ac56['set'](_0x8832('0xb'),path[_0x8832('0xc')](config[_0x8832('0xd')],_0x8832('0x11')));_0x56ac56[_0x8832('0x12')](errorHandler());}_0x56ac56[_0x8832('0x13')](_0x8832('0x14'),function(_0x471be0,_0x1b1d2d){if(this[_0x471be0]instanceof Date){_0x1b1d2d=this[_0x471be0][_0x8832('0x15')]()[_0x8832('0x16')]('.')[0x0]+'Z';}return _0x1b1d2d;});_0x56ac56[_0x8832('0x12')](express[_0x8832('0x17')](_0x56ac56[_0x8832('0x9')](_0x8832('0xb'))));_0x56ac56[_0x8832('0x13')](_0x8832('0x18'),config['root']+'/server/views');_0x56ac56[_0x8832('0x19')](_0x8832('0x1a'),require(_0x8832('0x1b'))[_0x8832('0x1c')]);_0x56ac56[_0x8832('0x13')](_0x8832('0x1d'),'html');_0x56ac56[_0x8832('0x12')](bodyParser[_0x8832('0x1e')]({'limit':_0x8832('0x1f'),'extended':!![]}));_0x56ac56['use'](bodyParser[_0x8832('0x20')]({'limit':'50mb'}));_0x56ac56[_0x8832('0x12')](cors());_0x56ac56[_0x8832('0x12')](methodOverride());_0x56ac56[_0x8832('0x12')](cookieParser());_0x56ac56[_0x8832('0x12')](passport[_0x8832('0x21')]());}; \ No newline at end of file +var _0x9c0c=['express','body-parser','cookie-parser','errorhandler','path','passport','cors','../mysqldb','default','get','env','production','set','appPath','root','public','development','test','join','toISOString','use','views','engine','view\x20engine','html','urlencoded','50mb','initialize'];(function(_0x1497d4,_0x2030ed){var _0x1a586a=function(_0x547ce3){while(--_0x547ce3){_0x1497d4['push'](_0x1497d4['shift']());}};_0x1a586a(++_0x2030ed);}(_0x9c0c,0x8c));var _0xc9c0=function(_0x1d6a82,_0x37c315){_0x1d6a82=_0x1d6a82-0x0;var _0x5834ac=_0x9c0c[_0x1d6a82];return _0x5834ac;};'use strict';var express=require(_0xc9c0('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0xc9c0('0x1'));var methodOverride=require('method-override');var cookieParser=require(_0xc9c0('0x2'));var errorHandler=require(_0xc9c0('0x3'));var path=require(_0xc9c0('0x4'));var passport=require(_0xc9c0('0x5'));var cors=require(_0xc9c0('0x6'));var moment=require('moment');var config=require('./environment');var db=require(_0xc9c0('0x7'))['db'];exports[_0xc9c0('0x8')]=function(_0x4fce40){var _0x5b15c7=_0x4fce40[_0xc9c0('0x9')](_0xc9c0('0xa'));if(_0x5b15c7===_0xc9c0('0xb')){_0x4fce40[_0xc9c0('0xc')](_0xc9c0('0xd'),path['join'](config[_0xc9c0('0xe')],_0xc9c0('0xf')));}if(_0x5b15c7===_0xc9c0('0x10')||_0x5b15c7===_0xc9c0('0x11')){_0x4fce40[_0xc9c0('0xc')](_0xc9c0('0xd'),path[_0xc9c0('0x12')](config[_0xc9c0('0xe')],'client'));_0x4fce40['use'](errorHandler());}_0x4fce40[_0xc9c0('0xc')]('json\x20replacer',function(_0x35e8e1,_0x70d3ef){if(this[_0x35e8e1]instanceof Date){_0x70d3ef=this[_0x35e8e1][_0xc9c0('0x13')]()['split']('.')[0x0]+'Z';}return _0x70d3ef;});_0x4fce40[_0xc9c0('0x14')](express['static'](_0x4fce40[_0xc9c0('0x9')](_0xc9c0('0xd'))));_0x4fce40[_0xc9c0('0xc')](_0xc9c0('0x15'),config[_0xc9c0('0xe')]+'/server/views');_0x4fce40[_0xc9c0('0x16')]('html',require('ejs')['renderFile']);_0x4fce40['set'](_0xc9c0('0x17'),_0xc9c0('0x18'));_0x4fce40[_0xc9c0('0x14')](bodyParser[_0xc9c0('0x19')]({'limit':'50mb','extended':!![]}));_0x4fce40[_0xc9c0('0x14')](bodyParser['json']({'limit':_0xc9c0('0x1a')}));_0x4fce40[_0xc9c0('0x14')](cors());_0x4fce40[_0xc9c0('0x14')](methodOverride());_0x4fce40[_0xc9c0('0x14')](cookieParser());_0x4fce40['use'](passport[_0xc9c0('0x1b')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 49e4d51..d4375ff 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 _0xe62f=['hex','platform','licenseToken','test','win32','replace','macAddress','ipAddress','substring','lodash','crypto','execSync','../environment','networkInterfaces','orderBy','keys','length','family','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','update','digest'];(function(_0x1a4559,_0x3fe791){var _0x38338a=function(_0x36a1c8){while(--_0x36a1c8){_0x1a4559['push'](_0x1a4559['shift']());}};_0x38338a(++_0x3fe791);}(_0xe62f,0xb3));var _0xfe62=function(_0x397cf1,_0xe713f1){_0x397cf1=_0x397cf1-0x0;var _0x608ef9=_0xe62f[_0x397cf1];return _0x608ef9;};'use strict';var _=require(_0xfe62('0x0'));var os=require('os');var crypto=require(_0xfe62('0x1'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0xfe62('0x2')];var config=require(_0xfe62('0x3'));function getInterfaces(){var _0x12d356=[];var _0x46e7a6=os[_0xfe62('0x4')]();var _0x10d499=_[_0xfe62('0x5')](_[_0xfe62('0x6')](_0x46e7a6));for(var _0x3fee97=0x0;_0x3fee97<_0x10d499[_0xfe62('0x7')];_0x3fee97++){var _0x119bcd=_0x46e7a6[_0x10d499[_0x3fee97]]['filter'](function(_0x57550f){return _0x57550f[_0xfe62('0x8')]==='IPv4'&&_0x57550f[_0xfe62('0x9')]===![];});_0x12d356=_0x12d356[_0xfe62('0xa')](_0x119bcd);}return _0x12d356;}function getFirstInterface(){var _0x1e72d9=_[_0xfe62('0xb')](getInterfaces());return{'macAddress':_0x1e72d9&&_0x1e72d9[_0xfe62('0xc')]?_0x1e72d9[_0xfe62('0xc')]:_0xfe62('0xd'),'ipAddress':_0x1e72d9&&_0x1e72d9[_0xfe62('0xe')]?_0x1e72d9['address']:_0xfe62('0xf')};}exports[_0xfe62('0x10')]=getFirstInterface;function getCPUhash(){var _0x5f699f=_[_0xfe62('0x5')](os[_0xfe62('0x11')]()[_0xfe62('0x12')](function(_0xe4d0bf){return _0xe4d0bf[_0xfe62('0x13')];}))[_0xfe62('0x14')](':');return crypto[_0xfe62('0x15')](_0xfe62('0x16'))[_0xfe62('0x17')](_0x5f699f)[_0xfe62('0x18')](_0xfe62('0x19'));}exports['getUuid']=function(){var _0x4c7610=os[_0xfe62('0x1a')]();var _0x5be41d=/[0-9a-f-]{36}/;if(config[_0xfe62('0x1b')]&&_0x5be41d[_0xfe62('0x1c')](config[_0xfe62('0x1b')])){return config['licenseToken'];}else if(_0x4c7610===_0xfe62('0x1d')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0xfe62('0x1e')]('\x0d\x0a','');}else{var _0x200e2b=getFirstInterface();var _0x2b7248=getCPUhash();var _0x1eadaa=_0x2b7248+'|'+os['hostname']()+'|'+_0x200e2b[_0xfe62('0x1f')]+'|'+_0x200e2b[_0xfe62('0x20')];var _0x488a11=crypto[_0xfe62('0x15')](_0xfe62('0x16'))[_0xfe62('0x17')](_0x1eadaa)[_0xfe62('0x18')]('hex');return _0x488a11[_0xfe62('0x21')](0x0,0x8)+'-'+_0x488a11[_0xfe62('0x21')](0x8,0xc)+'-'+_0x488a11[_0xfe62('0x21')](0xc,0x10)+'-'+_0x488a11['substring'](0x10,0x14)+'-'+_0x488a11[_0xfe62('0x21')](0x14);}}; \ No newline at end of file +var _0x42b9=['mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','map','model','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','execSync','networkInterfaces','orderBy','keys','length','filter','family','internal','concat','head'];(function(_0x47a0a0,_0x2afa3f){var _0x365b5b=function(_0x2fd99d){while(--_0x2fd99d){_0x47a0a0['push'](_0x47a0a0['shift']());}};_0x365b5b(++_0x2afa3f);}(_0x42b9,0x18a));var _0x942b=function(_0x208034,_0x4ef198){_0x208034=_0x208034-0x0;var _0x3b24b1=_0x42b9[_0x208034];return _0x3b24b1;};'use strict';var _=require(_0x942b('0x0'));var os=require('os');var crypto=require(_0x942b('0x1'));var machine=require(_0x942b('0x2'));var exec=require('child_process')[_0x942b('0x3')];var config=require('../environment');function getInterfaces(){var _0x4f2c3e=[];var _0x3e9dee=os[_0x942b('0x4')]();var _0x45952c=_[_0x942b('0x5')](_[_0x942b('0x6')](_0x3e9dee));for(var _0x1410f5=0x0;_0x1410f5<_0x45952c[_0x942b('0x7')];_0x1410f5++){var _0x18e2ed=_0x3e9dee[_0x45952c[_0x1410f5]][_0x942b('0x8')](function(_0x1efa8c){return _0x1efa8c[_0x942b('0x9')]==='IPv4'&&_0x1efa8c[_0x942b('0xa')]===![];});_0x4f2c3e=_0x4f2c3e[_0x942b('0xb')](_0x18e2ed);}return _0x4f2c3e;}function getFirstInterface(){var _0x112550=_[_0x942b('0xc')](getInterfaces());return{'macAddress':_0x112550&&_0x112550[_0x942b('0xd')]?_0x112550[_0x942b('0xd')]:_0x942b('0xe'),'ipAddress':_0x112550&&_0x112550[_0x942b('0xf')]?_0x112550[_0x942b('0xf')]:_0x942b('0x10')};}exports[_0x942b('0x11')]=getFirstInterface;function getCPUhash(){var _0x19a31d=_['orderBy'](os['cpus']()[_0x942b('0x12')](function(_0xa98ed){return _0xa98ed[_0x942b('0x13')];}))[_0x942b('0x14')](':');return crypto[_0x942b('0x15')](_0x942b('0x16'))[_0x942b('0x17')](_0x19a31d)[_0x942b('0x18')](_0x942b('0x19'));}exports[_0x942b('0x1a')]=function(){var _0x2bf5ff=os[_0x942b('0x1b')]();var _0x3a85b8=/[0-9a-f-]{36}/;if(config[_0x942b('0x1c')]&&_0x3a85b8['test'](config['licenseToken'])){return config[_0x942b('0x1c')];}else if(_0x2bf5ff===_0x942b('0x1d')){return exec(_0x942b('0x1e'),{'encoding':_0x942b('0x1f')})[_0x942b('0x20')]('\x0d\x0a','');}else{var _0x18cce9=getFirstInterface();var _0x11490d=getCPUhash();var _0x143ae3=_0x11490d+'|'+os[_0x942b('0x21')]()+'|'+_0x18cce9[_0x942b('0x22')]+'|'+_0x18cce9[_0x942b('0x23')];var _0x2a9e11=crypto['createHash'](_0x942b('0x16'))[_0x942b('0x17')](_0x143ae3)['digest'](_0x942b('0x19'));return _0x2a9e11[_0x942b('0x24')](0x0,0x8)+'-'+_0x2a9e11[_0x942b('0x24')](0x8,0xc)+'-'+_0x2a9e11[_0x942b('0x24')](0xc,0x10)+'-'+_0x2a9e11[_0x942b('0x24')](0x10,0x14)+'-'+_0x2a9e11[_0x942b('0x24')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 8a6681e..1cb119b 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 _0x26db=['data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','then','error','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','moment','request-promise','bluebird','version','../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','get','data1'];(function(_0x3ecf87,_0x120030){var _0x51d01a=function(_0x29da5d){while(--_0x29da5d){_0x3ecf87['push'](_0x3ecf87['shift']());}};_0x51d01a(++_0x120030);}(_0x26db,0x18b));var _0xb26d=function(_0x5f2dd0,_0x19288e){_0x5f2dd0=_0x5f2dd0-0x0;var _0x5d8c63=_0x26db[_0x5f2dd0];return _0x5d8c63;};'use strict';var util=require('util');var moment=require(_0xb26d('0x0'));var rp=require(_0xb26d('0x1'));var BPromise=require(_0xb26d('0x2'));var pkginfo=require('pkginfo')(module,_0xb26d('0x3'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require(_0xb26d('0x4'))(_0xb26d('0x5'));var HOST=_0xb26d('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x46df0d){return new BPromise(function(_0x42ea1a,_0x5a1490){var _0x4fa917=util[_0xb26d('0x7')](_0xb26d('0x8'),HOST,_0x46df0d,module[_0xb26d('0x9')][_0xb26d('0x3')]);if(oldToken){_0x4fa917=util[_0xb26d('0x7')](_0xb26d('0xa'),HOST,_0x46df0d,module[_0xb26d('0x9')][_0xb26d('0x3')],oldToken);}var _0x521641={'uri':_0x4fa917,'method':_0xb26d('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x521641)['then'](function(_0x3002e2){_0x42ea1a(_0x3002e2);})[_0xb26d('0xc')](function(_0x570c3c){_0x5a1490(_0x570c3c);});});}function manageLicense(_0x2d6b2a,_0x2a31c8){var _0x2675d8=_0x2a31c8[_0xb26d('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x2675d8[_0xb26d('0xe')]!==_0x2d6b2a&&!_0x2675d8[_0xb26d('0xf')]){oldToken=_0x2675d8[_0xb26d('0xe')];}httpRequest(_0x2d6b2a)['then'](function(_0xa2d6fe){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0xa2d6fe[_0xb26d('0x10')]){isOldTokenSent=![];if(!_0x2675d8[_0xb26d('0x5')]&&_0x2675d8['license']!=_0xa2d6fe['license']||_0x2675d8[_0xb26d('0x5')]&&_0x2675d8[_0xb26d('0xf')]){logger[_0xb26d('0x11')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x2675d8[_0xb26d('0x5')]&&!_0x2675d8[_0xb26d('0xf')]&&_0x2675d8[_0xb26d('0x5')]!=_0xa2d6fe[_0xb26d('0x5')]){logger[_0xb26d('0x11')](_0xb26d('0x12'));}if(_0x2675d8[_0xb26d('0x5')]&&!_0x2675d8[_0xb26d('0xf')]&&_0x2675d8[_0xb26d('0x5')]==_0xa2d6fe[_0xb26d('0x5')]){return _0x2a31c8;}return _0x2a31c8[_0xb26d('0x13')]({'data1':_0x2d6b2a,'data2':null,'license':_0xa2d6fe['license']});}else{if(_0xa2d6fe[_0xb26d('0x5')]||_0x2675d8['license']){if(!_0x2675d8['data2']){if(_0x2675d8[_0xb26d('0xe')]==_0x2d6b2a){GRAY_PERIOD_REASON=_0xb26d('0x14');logger[_0xb26d('0x11')](_0xb26d('0x15'));}else{GRAY_PERIOD_REASON=_0xb26d('0x16');logger[_0xb26d('0x11')](_0xb26d('0x17'),_0x2675d8['data1'],_0x2d6b2a);}logger['info'](_0xb26d('0x18'),GRAY_PERIOD_REASON[_0xb26d('0x19')](),moment()[_0xb26d('0x7')](_0xb26d('0x1a')));return _0x2a31c8[_0xb26d('0x13')]({'data2':encryptor[_0xb26d('0x1b')](moment()[_0xb26d('0x7')](_0xb26d('0x1a')))});}else{if(moment()[_0xb26d('0x1c')](encryptor['decryptString'](_0x2675d8[_0xb26d('0xf')]),_0xb26d('0x1d'))>DAYS){logger[_0xb26d('0x11')](_0xb26d('0x1e'),moment()[_0xb26d('0x7')](_0xb26d('0x1a')));isOldTokenSent=![];return _0x2a31c8['update']({'data1':_0x2d6b2a,'data2':null,'license':null});}}}else{if(_0x2675d8['data1']!=_0x2d6b2a){logger['info'](_0xb26d('0x17'),_0x2675d8[_0xb26d('0xe')],_0x2d6b2a);return _0x2a31c8[_0xb26d('0x13')]({'data1':_0x2d6b2a,'data2':null,'license':null});}}}return _0x2a31c8;})[_0xb26d('0x1f')](function(_0x21f0d1){_0x2a31c8=_0x21f0d1;})[_0xb26d('0xc')](function(_0x1ba5ff){logger[_0xb26d('0x20')](_0x1ba5ff['message']);})[_0xb26d('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0xb26d('0x22')](),_0x2a31c8);},TIME);});}function defaultLicense(){var _0x5990cd=hardware[_0xb26d('0x22')]();if(_0x5990cd){return db[_0xb26d('0x23')][_0xb26d('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x5990cd}})[_0xb26d('0x25')](function(_0x3971a7,_0x506d77){logger[_0xb26d('0x11')](_0xb26d('0x26'),_0x5990cd);manageLicense(_0x5990cd,_0x3971a7);})[_0xb26d('0xc')](function(_0x3c7f71){logger['error'](_0x3c7f71[_0xb26d('0x27')]);});}}exports[_0xb26d('0x28')]=defaultLicense; \ No newline at end of file +var _0x6af5=['error','message','finally','getUuid','License','spread','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','data1','data2','active','info','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days'];(function(_0x1f75d4,_0x183581){var _0x72f2ca=function(_0x5aafee){while(--_0x5aafee){_0x1f75d4['push'](_0x1f75d4['shift']());}};_0x72f2ca(++_0x183581);}(_0x6af5,0x15d));var _0x56af=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x6af5[_0x42bdad];return _0x122626;};'use strict';var util=require(_0x56af('0x0'));var moment=require(_0x56af('0x1'));var rp=require(_0x56af('0x2'));var BPromise=require(_0x56af('0x3'));var pkginfo=require(_0x56af('0x4'))(module,_0x56af('0x5'));var db=require(_0x56af('0x6'))['db'];var encryptor=require(_0x56af('0x7'));var hardware=require('./hardware');var logger=require('../logger')(_0x56af('0x8'));var HOST=_0x56af('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x57a7a8){return new BPromise(function(_0x328236,_0x3dc7ce){var _0x44cd6b=util[_0x56af('0xa')](_0x56af('0xb'),HOST,_0x57a7a8,module[_0x56af('0xc')][_0x56af('0x5')]);if(oldToken){_0x44cd6b=util[_0x56af('0xa')](_0x56af('0xd'),HOST,_0x57a7a8,module[_0x56af('0xc')]['version'],oldToken);}var _0x55e6a4={'uri':_0x44cd6b,'method':_0x56af('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x55e6a4)[_0x56af('0xf')](function(_0xcdba67){_0x328236(_0xcdba67);})[_0x56af('0x10')](function(_0x12819b){_0x3dc7ce(_0x12819b);});});}function manageLicense(_0x79a657,_0x39bc7e){var _0x7a7e5f=_0x39bc7e['get']({'plain':!![]});if(!isOldTokenSent&&_0x7a7e5f[_0x56af('0x11')]!==_0x79a657&&!_0x7a7e5f[_0x56af('0x12')]){oldToken=_0x7a7e5f['data1'];}httpRequest(_0x79a657)[_0x56af('0xf')](function(_0x4cdc5e){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4cdc5e[_0x56af('0x13')]){isOldTokenSent=![];if(!_0x7a7e5f[_0x56af('0x8')]&&_0x7a7e5f['license']!=_0x4cdc5e['license']||_0x7a7e5f[_0x56af('0x8')]&&_0x7a7e5f[_0x56af('0x12')]){logger[_0x56af('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x7a7e5f[_0x56af('0x8')]&&!_0x7a7e5f[_0x56af('0x12')]&&_0x7a7e5f[_0x56af('0x8')]!=_0x4cdc5e[_0x56af('0x8')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x7a7e5f[_0x56af('0x8')]&&!_0x7a7e5f[_0x56af('0x12')]&&_0x7a7e5f['license']==_0x4cdc5e['license']){return _0x39bc7e;}return _0x39bc7e[_0x56af('0x15')]({'data1':_0x79a657,'data2':null,'license':_0x4cdc5e['license']});}else{if(_0x4cdc5e[_0x56af('0x8')]||_0x7a7e5f[_0x56af('0x8')]){if(!_0x7a7e5f[_0x56af('0x12')]){if(_0x7a7e5f[_0x56af('0x11')]==_0x79a657){GRAY_PERIOD_REASON='Disabled';logger[_0x56af('0x14')](_0x56af('0x16'));}else{GRAY_PERIOD_REASON='Changed';logger['info'](_0x56af('0x17'),_0x7a7e5f[_0x56af('0x11')],_0x79a657);}logger[_0x56af('0x14')](_0x56af('0x18'),GRAY_PERIOD_REASON[_0x56af('0x19')](),moment()['format'](_0x56af('0x1a')));return _0x39bc7e[_0x56af('0x15')]({'data2':encryptor[_0x56af('0x1b')](moment()['format'](_0x56af('0x1a')))});}else{if(moment()[_0x56af('0x1c')](encryptor[_0x56af('0x1d')](_0x7a7e5f['data2']),_0x56af('0x1e'))>DAYS){logger[_0x56af('0x14')]('DEMO\x20START\x20AT\x20%s',moment()['format'](_0x56af('0x1a')));isOldTokenSent=![];return _0x39bc7e[_0x56af('0x15')]({'data1':_0x79a657,'data2':null,'license':null});}}}else{if(_0x7a7e5f[_0x56af('0x11')]!=_0x79a657){logger['info'](_0x56af('0x17'),_0x7a7e5f['data1'],_0x79a657);return _0x39bc7e[_0x56af('0x15')]({'data1':_0x79a657,'data2':null,'license':null});}}}return _0x39bc7e;})['then'](function(_0x1de5ca){_0x39bc7e=_0x1de5ca;})[_0x56af('0x10')](function(_0x267f18){logger[_0x56af('0x1f')](_0x267f18[_0x56af('0x20')]);})[_0x56af('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0x56af('0x22')](),_0x39bc7e);},TIME);});}function defaultLicense(){var _0x124387=hardware[_0x56af('0x22')]();if(_0x124387){return db[_0x56af('0x23')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x124387}})[_0x56af('0x24')](function(_0x443f3b,_0x164783){logger[_0x56af('0x14')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x124387);manageLicense(_0x124387,_0x443f3b);})[_0x56af('0x10')](function(_0x36d0a8){logger[_0x56af('0x1f')](_0x36d0a8['message']);});}}exports[_0x56af('0x25')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index f66187c..edcb015 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 _0x528c=['deadline','add','days','format','grayReason','machineUuid','changed','disabled','message','User','findAll','role','sequelize','col','admin','user','telephone','users','telephones','forEach','count','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','find','defaults','then','catch','uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','parse','demo'];(function(_0x27d569,_0x128ff7){var _0x1cb38e=function(_0x414e9d){while(--_0x414e9d){_0x27d569['push'](_0x27d569['shift']());}};_0x1cb38e(++_0x128ff7);}(_0x528c,0x80));var _0xc528=function(_0x32594a,_0x4a0c11){_0x32594a=_0x32594a-0x0;var _0x2f9c7a=_0x528c[_0x32594a];return _0x2f9c7a;};'use strict';var util=require(_0xc528('0x0'));var _=require(_0xc528('0x1'));var moment=require(_0xc528('0x2'));var BPromise=require(_0xc528('0x3'));var hardware=require(_0xc528('0x4'));var encryptor=require(_0xc528('0x5'));var db=require(_0xc528('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc528('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xc528('0x8'),'machineUuid':hardware[_0xc528('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc528('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xc528('0xa'),'machineUuid':hardware[_0xc528('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x40c110){return new BPromise(function(_0x1cf044,_0xf3fc15){return db['License'][_0xc528('0xb')](_[_0xc528('0xc')](_0x40c110,{'raw':!![],'where':{'id':0x1}}))[_0xc528('0xd')](function(_0xc212c7){return checkLicense(_0xc212c7,null);})['then'](function(_0x3d803e){_0x1cf044(_0x3d803e);return;})[_0xc528('0xe')](function(_0x1e172b){_0xf3fc15(_0x1e172b);});});}function checkLicense(_0x789fc,_0x2c1525){if(!_0x789fc){demoLicense[_0xc528('0xf')]=_0x789fc[_0xc528('0x10')];return demoLicense;}try{var _0x1ec016=_0x2c1525||_0x789fc['license'];if(_[_0xc528('0x11')](_0x1ec016)){throw new Error(_0xc528('0x12'));}var _0x1e052c=_0x789fc[_0xc528('0x10')];var _0x1b795d=_0x789fc[_0xc528('0x13')];var _0x5c4265=_0x1e052c[_0xc528('0x14')]('-')[0x4];var _0x3974d7=_0x1e052c['split']('-')[0x0];var _0x1fdb9f=encryptor[_0xc528('0x15')](_0x1ec016,util['format'](_0xc528('0x16'),_0x5c4265,_0x1e052c,_0x3974d7));var _0x2d90b4=JSON[_0xc528('0x17')](_0x1fdb9f);_0x2d90b4[_0xc528('0x18')]=![];_0x2d90b4[_0xc528('0xf')]=_0x1e052c;_0x2d90b4['machineUuid']=hardware[_0xc528('0x9')]();if(_0x1b795d){var _0x96b168=encryptor[_0xc528('0x15')](_0x1b795d);_0x2d90b4['gray']=_0x96b168;_0x2d90b4[_0xc528('0x19')]=moment(_0x96b168)[_0xc528('0x1a')](0x7,_0xc528('0x1b'))[_0xc528('0x1c')]();_0x2d90b4[_0xc528('0x1d')]=_0x2d90b4[_0xc528('0xf')]!=_0x2d90b4[_0xc528('0x1e')]?_0xc528('0x1f'):_0xc528('0x20');}return _0x2d90b4;}catch(_0x5ccc8b){breakingLicense[_0xc528('0xf')]=_0x789fc[_0xc528('0x10')];breakingLicense['message']=_0x5ccc8b[_0xc528('0x21')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2c58d2,_0x2d0519){getLicense()[_0xc528('0xd')](function(_0x38279b){return db[_0xc528('0x22')][_0xc528('0x23')]({'attributes':[_0xc528('0x24'),[db[_0xc528('0x25')]['fn']('COUNT',db[_0xc528('0x25')][_0xc528('0x26')](_0xc528('0x24'))),'count']],'group':_0xc528('0x24'),'where':{'role':{'$or':[_0xc528('0x27'),_0xc528('0x28'),_0xc528('0x29')]}},'raw':!![]})[_0xc528('0xd')](function(_0x4bd4c5){var _0x3f9b59={'user':_0x38279b[_0xc528('0x2a')]||0x0,'telephone':_0x38279b[_0xc528('0x2b')]||0x0};_0x4bd4c5[_0xc528('0x2c')](function(_0x13a854){var _0x326016=_0x13a854[_0xc528('0x24')]===_0xc528('0x27')?_0xc528('0x28'):_0x13a854[_0xc528('0x24')];_0x3f9b59[_0x326016]-=_0x13a854[_0xc528('0x2d')];if(_0x3f9b59[_0x326016]<0x0)_0x3f9b59[_0x326016]=0x0;});_0x2c58d2(_0x3f9b59);return;});})[_0xc528('0xe')](function(_0x1a810d){_0x2d0519(_0x1a810d);});});}function checkUserLimits(_0x50dd0b){return new BPromise(function(_0x1805c4,_0x843082){getLimits()[_0xc528('0xd')](function(_0x2df820){var _0x309ade=_[_0xc528('0x2e')](_[_0xc528('0x2f')](_0x50dd0b,'role'),[_0xc528('0x27'),_0xc528('0x28'),_0xc528('0x29')]);var _0x40a085=(_0x309ade[_0xc528('0x27')]||0x0)+(_0x309ade[_0xc528('0x28')]||0x0);var _0x3c36c1=_0x309ade[_0xc528('0x29')]||0x0;if(_0x40a085>_0x2df820['user'])return _0x843082(_0xc528('0x30'));if(_0x3c36c1>_0x2df820[_0xc528('0x29')])return _0x843082(_0xc528('0x31'));return _0x1805c4();})[_0xc528('0xe')](function(_0x162bec){_0x843082(_0x162bec);});});}module[_0xc528('0x32')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x536d=['uuid','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','parse','demo','machineUuid','gray','deadline','add','grayReason','changed','data1','message','findAll','role','COUNT','col','count','admin','user','telephone','telephones','forEach','countBy','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','defaults','then','catch'];(function(_0x2f6f50,_0x1d21a7){var _0x2cf365=function(_0x1c40a7){while(--_0x1c40a7){_0x2f6f50['push'](_0x2f6f50['shift']());}};_0x2cf365(++_0x1d21a7);}(_0x536d,0x1b7));var _0xd536=function(_0x46251b,_0x12840c){_0x46251b=_0x46251b-0x0;var _0x46da3d=_0x536d[_0x46251b];return _0x46da3d;};'use strict';var util=require('util');var _=require(_0xd536('0x0'));var moment=require(_0xd536('0x1'));var BPromise=require('bluebird');var hardware=require('./hardware');var encryptor=require(_0xd536('0x2'));var db=require(_0xd536('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd536('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xd536('0x5'),'machineUuid':hardware[_0xd536('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd536('0x4'),'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(_0x1bd195){return new BPromise(function(_0x18597c,_0x576b8f){return db[_0xd536('0x7')][_0xd536('0x8')](_[_0xd536('0x9')](_0x1bd195,{'raw':!![],'where':{'id':0x1}}))[_0xd536('0xa')](function(_0x3027e3){return checkLicense(_0x3027e3,null);})[_0xd536('0xa')](function(_0xbb87bf){_0x18597c(_0xbb87bf);return;})[_0xd536('0xb')](function(_0x47f87d){_0x576b8f(_0x47f87d);});});}function checkLicense(_0x3a7d7d,_0x317e8a){if(!_0x3a7d7d){demoLicense[_0xd536('0xc')]=_0x3a7d7d['data1'];return demoLicense;}try{var _0x387447=_0x317e8a||_0x3a7d7d['license'];if(_[_0xd536('0xd')](_0x387447)){throw new Error(_0xd536('0xe'));}var _0x500983=_0x3a7d7d['data1'];var _0x186b9b=_0x3a7d7d[_0xd536('0xf')];var _0x5b98b8=_0x500983['split']('-')[0x4];var _0x345d1d=_0x500983[_0xd536('0x10')]('-')[0x0];var _0x4477b8=encryptor[_0xd536('0x11')](_0x387447,util['format']('%s:%s:%s',_0x5b98b8,_0x500983,_0x345d1d));var _0x3bf1ae=JSON[_0xd536('0x12')](_0x4477b8);_0x3bf1ae[_0xd536('0x13')]=![];_0x3bf1ae[_0xd536('0xc')]=_0x500983;_0x3bf1ae[_0xd536('0x14')]=hardware[_0xd536('0x6')]();if(_0x186b9b){var _0x4907fa=encryptor[_0xd536('0x11')](_0x186b9b);_0x3bf1ae[_0xd536('0x15')]=_0x4907fa;_0x3bf1ae[_0xd536('0x16')]=moment(_0x4907fa)[_0xd536('0x17')](0x7,'days')['format']();_0x3bf1ae[_0xd536('0x18')]=_0x3bf1ae[_0xd536('0xc')]!=_0x3bf1ae[_0xd536('0x14')]?_0xd536('0x19'):'disabled';}return _0x3bf1ae;}catch(_0x12e9e3){breakingLicense[_0xd536('0xc')]=_0x3a7d7d[_0xd536('0x1a')];breakingLicense[_0xd536('0x1b')]=_0x12e9e3[_0xd536('0x1b')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4a31b8,_0x1f9d71){getLicense()[_0xd536('0xa')](function(_0x1dd6af){return db['User'][_0xd536('0x1c')]({'attributes':[_0xd536('0x1d'),[db['sequelize']['fn'](_0xd536('0x1e'),db['sequelize'][_0xd536('0x1f')](_0xd536('0x1d'))),_0xd536('0x20')]],'group':_0xd536('0x1d'),'where':{'role':{'$or':[_0xd536('0x21'),_0xd536('0x22'),_0xd536('0x23')]}},'raw':!![]})['then'](function(_0xd14ec0){var _0x1d2ce0={'user':_0x1dd6af['users']||0x0,'telephone':_0x1dd6af[_0xd536('0x24')]||0x0};_0xd14ec0[_0xd536('0x25')](function(_0x21567c){var _0x48225c=_0x21567c[_0xd536('0x1d')]===_0xd536('0x21')?_0xd536('0x22'):_0x21567c[_0xd536('0x1d')];_0x1d2ce0[_0x48225c]-=_0x21567c[_0xd536('0x20')];if(_0x1d2ce0[_0x48225c]<0x0)_0x1d2ce0[_0x48225c]=0x0;});_0x4a31b8(_0x1d2ce0);return;});})[_0xd536('0xb')](function(_0x4fdcd4){_0x1f9d71(_0x4fdcd4);});});}function checkUserLimits(_0x19721e){return new BPromise(function(_0x501421,_0x107560){getLimits()[_0xd536('0xa')](function(_0x238faa){var _0x37d930=_['pick'](_[_0xd536('0x26')](_0x19721e,'role'),[_0xd536('0x21'),_0xd536('0x22'),_0xd536('0x23')]);var _0x343cbd=(_0x37d930[_0xd536('0x21')]||0x0)+(_0x37d930[_0xd536('0x22')]||0x0);var _0x41ceec=_0x37d930['telephone']||0x0;if(_0x343cbd>_0x238faa[_0xd536('0x22')])return _0x107560('License\x20limit\x20reached\x20for\x20users');if(_0x41ceec>_0x238faa[_0xd536('0x23')])return _0x107560(_0xd536('0x27'));return _0x501421();})[_0xd536('0xb')](function(_0x18c733){_0x107560(_0x18c733);});});}module[_0xd536('0x28')]={'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 91afb68..4730437 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 _0x5f66=['app-id','secret','http://localhost:9000'];(function(_0x323df7,_0x5e4b78){var _0x5132bf=function(_0x20821c){while(--_0x20821c){_0x323df7['push'](_0x323df7['shift']());}};_0x5132bf(++_0x5e4b78);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'use strict';module['exports']={'DOMAIN':_0x65f6('0x0'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x65f6('0x1'),'GOOGLE_SECRET':_0x65f6('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x5204=['http://localhost:9000','app-id','secret','exports'];(function(_0x1e4f2d,_0x22e2bb){var _0xd05ce5=function(_0x4c7b43){while(--_0x4c7b43){_0x1e4f2d['push'](_0x1e4f2d['shift']());}};_0xd05ce5(++_0x22e2bb);}(_0x5204,0xdf));var _0x4520=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0x5204[_0x29db36];return _0x234e87;};'use strict';module[_0x4520('0x0')]={'DOMAIN':_0x4520('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x4520('0x2'),'GOOGLE_SECRET':_0x4520('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index e160d3a..de7c4fe 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0faf=['log','xcally','%s-%s.log','message','{{{','replace','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','transports','%s-%s','error','File','info','env','debugLevel','moment','util','path','INFO','join','/var'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0faf,0x132));var _0xf0fa=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x0faf[_0x1477ef];return _0x164acd;};'use strict';var moment=require(_0xf0fa('0x0'));var winston=require('winston');var util=require(_0xf0fa('0x1'));var path=require(_0xf0fa('0x2'));var debugLevel=_0xf0fa('0x3');function filename(_0x35a260,_0xccb93e){return path[_0xf0fa('0x4')](_0xf0fa('0x5'),_0xf0fa('0x6'),_0xf0fa('0x7'),util['format'](_0xf0fa('0x8'),_0x35a260,_0xccb93e));}function formatter(_0x44ffa0,_0x25b5c4){_0x25b5c4[_0xf0fa('0x9')]=_0x25b5c4[_0xf0fa('0x9')]['replace'](/@@{/g,_0xf0fa('0xa'))[_0xf0fa('0xb')](/}@@/g,'}}}')['replace'](/@{/g,'{{')[_0xf0fa('0xb')](/}@/g,'}}');return util[_0xf0fa('0xc')](_0xf0fa('0xd'),moment()[_0xf0fa('0xc')](_0xf0fa('0xe')),_0x25b5c4[_0xf0fa('0xf')][_0xf0fa('0x10')](),_0x44ffa0,_0x25b5c4[_0xf0fa('0x9')]);}module['exports']=function(_0x2b88c1){return new winston['Logger']({'transports':[new winston[(_0xf0fa('0x11'))]['File']({'name':util[_0xf0fa('0xc')](_0xf0fa('0x12'),_0x2b88c1,_0xf0fa('0x13')),'filename':filename(_0x2b88c1,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x42591b){return formatter(_0x2b88c1,_0x42591b);}}),new winston['transports'][(_0xf0fa('0x14'))]({'name':util[_0xf0fa('0xc')](_0xf0fa('0x12'),_0x2b88c1,_0xf0fa('0x15')),'filename':filename(_0x2b88c1,_0xf0fa('0x15')),'level':_0xf0fa('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x28bab8){return formatter(_0x2b88c1,_0x28bab8);}}),new winston[(_0xf0fa('0x11'))]['Console']({'level':process[_0xf0fa('0x16')][_0xf0fa('0x17')]||debugLevel,'json':![],'formatter':function(_0x30ce17){return formatter(_0x2b88c1,_0x30ce17);}})]});}; \ No newline at end of file +var _0x0f42=['Logger','transports','File','%s-%s','error','info','Console','env','debugLevel','moment','winston','util','path','join','/var','log','xcally','format','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level'];(function(_0xa7163a,_0x25b4df){var _0x2b68b7=function(_0xa5995c){while(--_0xa5995c){_0xa7163a['push'](_0xa7163a['shift']());}};_0x2b68b7(++_0x25b4df);}(_0x0f42,0xc9));var _0x20f4=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x0f42[_0x465028];return _0xb783d4;};'use strict';var moment=require(_0x20f4('0x0'));var winston=require(_0x20f4('0x1'));var util=require(_0x20f4('0x2'));var path=require(_0x20f4('0x3'));var debugLevel='INFO';function filename(_0x143d1d,_0x57b9dc){return path[_0x20f4('0x4')](_0x20f4('0x5'),_0x20f4('0x6'),_0x20f4('0x7'),util[_0x20f4('0x8')]('%s-%s.log',_0x143d1d,_0x57b9dc));}function formatter(_0x4eae4d,_0xb16012){_0xb16012['message']=_0xb16012[_0x20f4('0x9')][_0x20f4('0xa')](/@@{/g,_0x20f4('0xb'))[_0x20f4('0xa')](/}@@/g,_0x20f4('0xc'))[_0x20f4('0xa')](/@{/g,'{{')[_0x20f4('0xa')](/}@/g,'}}');return util[_0x20f4('0x8')](_0x20f4('0xd'),moment()[_0x20f4('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),_0xb16012[_0x20f4('0xe')]['toUpperCase'](),_0x4eae4d,_0xb16012[_0x20f4('0x9')]);}module['exports']=function(_0x1fa02a){return new winston[(_0x20f4('0xf'))]({'transports':[new winston[(_0x20f4('0x10'))][(_0x20f4('0x11'))]({'name':util[_0x20f4('0x8')](_0x20f4('0x12'),_0x1fa02a,'error'),'filename':filename(_0x1fa02a,_0x20f4('0x13')),'level':_0x20f4('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5c0203){return formatter(_0x1fa02a,_0x5c0203);}}),new winston[(_0x20f4('0x10'))][(_0x20f4('0x11'))]({'name':util[_0x20f4('0x8')](_0x20f4('0x12'),_0x1fa02a,'info'),'filename':filename(_0x1fa02a,_0x20f4('0x14')),'level':_0x20f4('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x594b90){return formatter(_0x1fa02a,_0x594b90);}}),new winston[(_0x20f4('0x10'))][(_0x20f4('0x15'))]({'level':process[_0x20f4('0x16')][_0x20f4('0x17')]||debugLevel,'json':![],'formatter':function(_0x18ae61){return formatter(_0x1fa02a,_0x18ae61);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index b54da0b..28f9a6d 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 _0x69c7=['../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','express','../../services/express/index.js','ami','join','agi','../../services/agi/index.js','email','../../services/email/index.js','routing'];(function(_0x3f9584,_0x5ab12c){var _0x9d54c=function(_0x2882df){while(--_0x2882df){_0x3f9584['push'](_0x3f9584['shift']());}};_0x9d54c(++_0x5ab12c);}(_0x69c7,0x1a4));var _0x769c=function(_0x3eff95,_0x2b3ffd){_0x3eff95=_0x3eff95-0x0;var _0x29d453=_0x69c7[_0x3eff95];return _0x29d453;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x769c('0x0'),'script':path['join'](__dirname,_0x769c('0x1'))},{'name':_0x769c('0x2'),'script':path[_0x769c('0x3')](__dirname,'../../services/ami/index.js')},{'name':_0x769c('0x4'),'script':path['join'](__dirname,_0x769c('0x5'))},{'name':_0x769c('0x6'),'script':path[_0x769c('0x3')](__dirname,_0x769c('0x7'))},{'name':_0x769c('0x8'),'script':path[_0x769c('0x3')](__dirname,_0x769c('0x9'))},{'name':_0x769c('0xa'),'script':path[_0x769c('0x3')](__dirname,_0x769c('0xb'))}]};module[_0x769c('0xc')]=config; \ No newline at end of file +var _0xe399=['routing','../../services/xdr/index.js','path','join','ami','agi'];(function(_0x3aaa66,_0x57eea2){var _0x31d478=function(_0x4b8fa2){while(--_0x4b8fa2){_0x3aaa66['push'](_0x3aaa66['shift']());}};_0x31d478(++_0x57eea2);}(_0xe399,0x11c));var _0x9e39=function(_0x5154ea,_0x9bf047){_0x5154ea=_0x5154ea-0x0;var _0x4284b3=_0xe399[_0x5154ea];return _0x4284b3;};'use strict';var path=require(_0x9e39('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0x9e39('0x1')](__dirname,'../../services/express/index.js')},{'name':_0x9e39('0x2'),'script':path[_0x9e39('0x1')](__dirname,'../../services/ami/index.js')},{'name':_0x9e39('0x3'),'script':path[_0x9e39('0x1')](__dirname,'../../services/agi/index.js')},{'name':'email','script':path[_0x9e39('0x1')](__dirname,'../../services/email/index.js')},{'name':_0x9e39('0x4'),'script':path[_0x9e39('0x1')](__dirname,'../../services/routing/index.js')},{'name':'xdr','script':path[_0x9e39('0x1')](__dirname,_0x9e39('0x5'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 91220f8..f8dce5a 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 _0x554f=['connected','then','start','disconnect','stop','restart','list','describe','saved','bluebird','./config'];(function(_0x152bf1,_0x21aef3){var _0x33d955=function(_0x327076){while(--_0x327076){_0x152bf1['push'](_0x152bf1['shift']());}};_0x33d955(++_0x21aef3);}(_0x554f,0x1e2));var _0xf554=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x554f[_0xe73080];return _0x12cbc4;};'use strict';var pm2=require('pm2');var BPromise=require(_0xf554('0x0'));var config=require(_0xf554('0x1'));function connect(){return new BPromise(function(_0x21a2bd,_0x842317){return pm2['connect'](function(_0x406ba3){if(_0x406ba3){return _0x842317(_0x406ba3);}return _0x21a2bd(_0xf554('0x2'));});});};exports['start']=function(_0x54a8f8){return connect()[_0xf554('0x3')](function(){return new BPromise(function(_0x130194,_0x42655d){return pm2[_0xf554('0x4')](_0x54a8f8,function(_0x407707,_0xb9ffa9){if(_0x407707){return _0x42655d(_0x407707);}pm2[_0xf554('0x5')]();return _0x130194(_0xb9ffa9);});});});};exports[_0xf554('0x6')]=function(_0x5ed121){return connect()[_0xf554('0x3')](function(){return new BPromise(function(_0x1dd5a5,_0x2e4829){return pm2[_0xf554('0x6')](_0x5ed121,function(_0x27dae6,_0x29f001){if(_0x27dae6){return _0x2e4829(_0x27dae6);}pm2[_0xf554('0x5')]();return _0x1dd5a5(_0x29f001);});});});};exports[_0xf554('0x7')]=function(_0x12d31b){return connect()[_0xf554('0x3')](function(){return new BPromise(function(_0x231ca0,_0x23c357){return pm2[_0xf554('0x7')](_0x12d31b,function(_0x4065be,_0x44335c){if(_0x4065be){return _0x23c357(_0x4065be);}pm2['disconnect']();return _0x231ca0(_0x44335c);});});});};exports[_0xf554('0x8')]=function(){return connect()[_0xf554('0x3')](function(){return new BPromise(function(_0x440c9f,_0x34f897){return pm2[_0xf554('0x8')](function(_0x584848,_0x2ec2d1){if(_0x584848){return _0x34f897(_0x584848);}pm2[_0xf554('0x5')]();return _0x440c9f(_0x2ec2d1);});});});};exports[_0xf554('0x9')]=function(_0x3fe721){return connect()[_0xf554('0x3')](function(){return new BPromise(function(_0x2e50d2,_0x2a6928){return pm2[_0xf554('0x9')](_0x3fe721,function(_0x2bce2d,_0x34b18a){if(_0x2bce2d){return _0x2a6928(_0x2bce2d);}pm2[_0xf554('0x5')]();return _0x2e50d2(_0x34b18a);});});});};exports['delete']=function(_0xf92e9d){return connect()[_0xf554('0x3')](function(){return new BPromise(function(_0x5d227d,_0x5f41b8){return pm2['delete'](_0xf92e9d,function(_0x1450b1,_0x2c10f3){if(_0x1450b1){return _0x5f41b8(_0x1450b1);}pm2[_0xf554('0x5')]();return _0x5d227d(_0x2c10f3);});});});};exports['dump']=function(){return connect()[_0xf554('0x3')](function(){return new BPromise(function(_0x4705ee,_0x19e3c0){return pm2['dump'](function(_0x4a0a86){if(_0x4a0a86){return _0x19e3c0(_0x4a0a86);}return _0x4705ee(_0xf554('0xa'));});});});}; \ No newline at end of file +var _0x3d68=['list','describe','dump','saved','pm2','bluebird','./config','connected','start','disconnect','then','stop'];(function(_0x27177f,_0x467b26){var _0x341c6b=function(_0x38c0ad){while(--_0x38c0ad){_0x27177f['push'](_0x27177f['shift']());}};_0x341c6b(++_0x467b26);}(_0x3d68,0x19c));var _0x83d6=function(_0x56e277,_0x11ad47){_0x56e277=_0x56e277-0x0;var _0x378923=_0x3d68[_0x56e277];return _0x378923;};'use strict';var pm2=require(_0x83d6('0x0'));var BPromise=require(_0x83d6('0x1'));var config=require(_0x83d6('0x2'));function connect(){return new BPromise(function(_0x18c077,_0x2477f2){return pm2['connect'](function(_0x3d27c3){if(_0x3d27c3){return _0x2477f2(_0x3d27c3);}return _0x18c077(_0x83d6('0x3'));});});};exports[_0x83d6('0x4')]=function(_0x278e39){return connect()['then'](function(){return new BPromise(function(_0x1df807,_0x3eaa9b){return pm2[_0x83d6('0x4')](_0x278e39,function(_0x47bbc0,_0x16722e){if(_0x47bbc0){return _0x3eaa9b(_0x47bbc0);}pm2[_0x83d6('0x5')]();return _0x1df807(_0x16722e);});});});};exports['stop']=function(_0x5d0b4d){return connect()[_0x83d6('0x6')](function(){return new BPromise(function(_0x1b09d3,_0x271518){return pm2[_0x83d6('0x7')](_0x5d0b4d,function(_0x3202f1,_0x57f650){if(_0x3202f1){return _0x271518(_0x3202f1);}pm2[_0x83d6('0x5')]();return _0x1b09d3(_0x57f650);});});});};exports['restart']=function(_0x355540){return connect()[_0x83d6('0x6')](function(){return new BPromise(function(_0x2c11fa,_0x1e1a29){return pm2['restart'](_0x355540,function(_0x2f48b9,_0x46d4b1){if(_0x2f48b9){return _0x1e1a29(_0x2f48b9);}pm2['disconnect']();return _0x2c11fa(_0x46d4b1);});});});};exports[_0x83d6('0x8')]=function(){return connect()[_0x83d6('0x6')](function(){return new BPromise(function(_0x1c63be,_0x32c48f){return pm2[_0x83d6('0x8')](function(_0x5e2635,_0x213cfa){if(_0x5e2635){return _0x32c48f(_0x5e2635);}pm2[_0x83d6('0x5')]();return _0x1c63be(_0x213cfa);});});});};exports[_0x83d6('0x9')]=function(_0x41bf37){return connect()['then'](function(){return new BPromise(function(_0x2e331e,_0x1a4e75){return pm2[_0x83d6('0x9')](_0x41bf37,function(_0x4688e1,_0x22ab2f){if(_0x4688e1){return _0x1a4e75(_0x4688e1);}pm2[_0x83d6('0x5')]();return _0x2e331e(_0x22ab2f);});});});};exports['delete']=function(_0x2b95c9){return connect()['then'](function(){return new BPromise(function(_0x1cc5fc,_0x3e4607){return pm2['delete'](_0x2b95c9,function(_0x2f2299,_0x5d3da4){if(_0x2f2299){return _0x3e4607(_0x2f2299);}pm2[_0x83d6('0x5')]();return _0x1cc5fc(_0x5d3da4);});});});};exports[_0x83d6('0xa')]=function(){return connect()[_0x83d6('0x6')](function(){return new BPromise(function(_0x697485,_0x1d4503){return pm2[_0x83d6('0xa')](function(_0x2fcbe3){if(_0x2fcbe3){return _0x1d4503(_0x2fcbe3);}return _0x697485(_0x83d6('0xb'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 4cfdbda..abf2d60 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 _0x469d=['../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','map','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','emit','chatInteraction:update','catch','error','inspect','start','lodash','moment','ioredis'];(function(_0x463e3e,_0x58c4ca){var _0x27a114=function(_0x3340b0){while(--_0x3340b0){_0x463e3e['push'](_0x463e3e['shift']());}};_0x27a114(++_0x58c4ca);}(_0x469d,0xa2));var _0xd469=function(_0x38ad27,_0x4d9489){_0x38ad27=_0x38ad27-0x0;var _0x6fdb66=_0x469d[_0x38ad27];return _0x6fdb66;};'use strict';var _=require(_0xd469('0x0'));var moment=require(_0xd469('0x1'));var Redis=require(_0xd469('0x2'));var util=require('util');var config=require('../../config/environment');var db=require(_0xd469('0x3'))['db'];var logger=require(_0xd469('0x4'))(_0xd469('0x5'));config[_0xd469('0x6')]=_[_0xd469('0x7')](config['redis'],{'host':_0xd469('0x8'),'port':0x18eb});var io=require(_0xd469('0x9'))(new Redis(config[_0xd469('0x6')]));function closeInteractions(){var _0x4e37a1=0x0;var _0x205be8=[];return db['Setting'][_0xd469('0xa')]({'raw':!![],'attributes':['id',_0xd469('0xb')],'where':{'id':0x1}})[_0xd469('0xc')](function(_0x2e4338){_0x4e37a1=_0x2e4338[_0xd469('0xb')];if(_0x4e37a1){return db[_0xd469('0xd')][_0xd469('0xe')]({'raw':!![],'attributes':['id',_0xd469('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xd469('0x10')](_0x2e4338[_0xd469('0xb')],_0xd469('0x11'))}}});}else{return[];}})[_0xd469('0xc')](function(_0x25f28c){if(_0x25f28c&&_0x25f28c['length']){_0x205be8=_[_0xd469('0x12')](_0x25f28c||[],'id');logger[_0xd469('0x13')]('[CHAT]\x20Interactions\x20to\x20close:',_0x205be8[_0xd469('0x14')]());return db[_0xd469('0xd')][_0xd469('0x15')]({'closeReason':_0xd469('0x16'),'disposition':_0xd469('0x17'),'closed':!![],'closedAt':moment()[_0xd469('0x18')](_0xd469('0x19'))},{'where':{'id':_0x205be8}});}})[_0xd469('0xc')](function(){if(_0x205be8&&_0x205be8[_0xd469('0x1a')]){logger[_0xd469('0x13')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x205be8[_0xd469('0x14')]());for(var _0x3b8d8b=0x0;_0x3b8d8b<_0x205be8[_0xd469('0x1a')];_0x3b8d8b++){io[_0xd469('0x1b')](_0xd469('0x1c'),{'id':_0x205be8[_0x3b8d8b],'closed':!![]});}}})[_0xd469('0x1d')](function(_0x371a11){logger[_0xd469('0x1e')]('[CHAT]\x20Error\x20closing\x20interactions',_0x371a11?util[_0xd469('0x1f')](_0x371a11,{'showHidden':![],'depth':null}):'');});}exports[_0xd469('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x8ec0=['../logger','redis','localhost','Setting','chatTimeout','then','ChatInteraction','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb'];(function(_0x3ecd61,_0x26a3de){var _0xdbc5e=function(_0x26347c){while(--_0x26347c){_0x3ecd61['push'](_0x3ecd61['shift']());}};_0xdbc5e(++_0x26a3de);}(_0x8ec0,0x1da));var _0x08ec=function(_0x210c16,_0x4c19ec){_0x210c16=_0x210c16-0x0;var _0x3ebc9a=_0x8ec0[_0x210c16];return _0x3ebc9a;};'use strict';var _=require(_0x08ec('0x0'));var moment=require(_0x08ec('0x1'));var Redis=require(_0x08ec('0x2'));var util=require(_0x08ec('0x3'));var config=require(_0x08ec('0x4'));var db=require(_0x08ec('0x5'))['db'];var logger=require(_0x08ec('0x6'))('schedule');config[_0x08ec('0x7')]=_['defaults'](config[_0x08ec('0x7')],{'host':_0x08ec('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x517970=0x0;var _0x26eb5d=[];return db[_0x08ec('0x9')]['find']({'raw':!![],'attributes':['id',_0x08ec('0xa')],'where':{'id':0x1}})[_0x08ec('0xb')](function(_0x22a379){_0x517970=_0x22a379[_0x08ec('0xa')];if(_0x517970){return db[_0x08ec('0xc')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x22a379['chatTimeout'],_0x08ec('0xd'))}}});}else{return[];}})[_0x08ec('0xb')](function(_0x23f585){if(_0x23f585&&_0x23f585[_0x08ec('0xe')]){_0x26eb5d=_[_0x08ec('0xf')](_0x23f585||[],'id');logger[_0x08ec('0x10')](_0x08ec('0x11'),_0x26eb5d[_0x08ec('0x12')]());return db[_0x08ec('0xc')][_0x08ec('0x13')]({'closeReason':_0x08ec('0x14'),'disposition':_0x08ec('0x15'),'closed':!![],'closedAt':moment()[_0x08ec('0x16')](_0x08ec('0x17'))},{'where':{'id':_0x26eb5d}});}})[_0x08ec('0xb')](function(){if(_0x26eb5d&&_0x26eb5d[_0x08ec('0xe')]){logger[_0x08ec('0x10')](_0x08ec('0x18'),_0x26eb5d[_0x08ec('0x12')]());for(var _0x4e70e5=0x0;_0x4e70e5<_0x26eb5d[_0x08ec('0xe')];_0x4e70e5++){io['emit'](_0x08ec('0x19'),{'id':_0x26eb5d[_0x4e70e5],'closed':!![]});}}})[_0x08ec('0x1a')](function(_0x140201){logger['error'](_0x08ec('0x1b'),_0x140201?util[_0x08ec('0x1c')](_0x140201,{'showHidden':![],'depth':null}):'');});}exports[_0x08ec('0x1d')]=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 bad1f29..a7d0e74 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 _0x106b=['../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Smtp','service','MailAccount','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','email','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','basename','extname','zip','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','attachments','sendIfEmpty','request','SendMail','then','error','error\x20mail','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','MailServerOut','keys','map','toString','difference','length','exists','stop','deleteJob','delete\x20cron','toRun','my\x20id','resolve','run\x20job','active','startAt','endAt','cron','start','add\x20cron','stop\x20cron','isBetween','update\x20cron','run','path','lodash','moment','jayson/promise','bluebird','../logger','../../mysqldb'];(function(_0x395e83,_0x3663a4){var _0x2a25d8=function(_0x1e8b2c){while(--_0x1e8b2c){_0x395e83['push'](_0x395e83['shift']());}};_0x2a25d8(++_0x3663a4);}(_0x106b,0x1a2));var _0xb106=function(_0x596f6e,_0x3f8857){_0x596f6e=_0x596f6e-0x0;var _0x1e0803=_0x106b[_0x596f6e];return _0x1e0803;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xb106('0x0'));var _=require(_0xb106('0x1'));var moment=require(_0xb106('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xb106('0x3'));var BPromise=require(_0xb106('0x4'));var logger=require(_0xb106('0x5'))('schedule');var db=require(_0xb106('0x6'))['db'];var analyticCustomReportController=require(_0xb106('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xb106('0x8')][_0xb106('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x405295,_0x396b26){return function(){logger[_0xb106('0xa')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x405295['email']);var _0x3786b7=!![];var _0x174993={'tls':{'rejectUnauthorized':![]}};if(_0x405295['MailAccount'][_0xb106('0xb')][_0xb106('0xc')]){_0x174993['service']=_0x405295[_0xb106('0xd')][_0xb106('0xb')][_0xb106('0xc')];}else{_0x174993['host']=_0x405295['MailAccount'][_0xb106('0xb')]['host'];_0x174993['port']=_0x405295[_0xb106('0xd')][_0xb106('0xb')][_0xb106('0xe')];_0x174993[_0xb106('0xf')]=_0x405295[_0xb106('0xd')][_0xb106('0xb')][_0xb106('0xf')];}if(_0x405295[_0xb106('0xd')][_0xb106('0xb')][_0xb106('0x10')]){_0x174993[_0xb106('0x11')]={'user':_0x405295['MailAccount']['Smtp'][_0xb106('0x12')],'pass':_0x405295[_0xb106('0xd')]['Smtp'][_0xb106('0x13')]};}var _0x12d827={'account':_0x174993,'message':{'from':util[_0xb106('0x14')](_0xb106('0x15'),_0x405295[_0xb106('0xd')][_0xb106('0x16')],_0x405295[_0xb106('0xd')][_0xb106('0x17')]||_0x405295[_0xb106('0xd')][_0xb106('0xb')][_0xb106('0x12')]),'to':_0x405295[_0xb106('0x17')],'cc':_0x405295['cc'],'bcc':_0x405295[_0xb106('0x18')],'subject':util[_0xb106('0x14')](_0xb106('0x19'),_0x396b26['name'],_0x405295[_0xb106('0x1a')],_0x405295[_0xb106('0x1b')])}};var _0x566758=path[_0xb106('0x1c')](__dirname,_0xb106('0x1d'));var _0x34eb39=_0x396b26[_0xb106('0x1e')];var _0x3abbfc=util[_0xb106('0x14')]('%s.%s',path[_0xb106('0x1f')](_0x396b26[_0xb106('0x1e')],path[_0xb106('0x20')](_0x396b26[_0xb106('0x1e')])),_0xb106('0x21'));var _0x3f3228=path[_0xb106('0x1c')](_0x566758,_0x34eb39);var _0x495ac5=path[_0xb106('0x1c')](_0x566758,_0x3abbfc);if(fs['existsSync'](_0x3f3228)){_0x396b26['status']=_0xb106('0x22');_0x12d827[_0xb106('0x23')]['attachments']=[{'filename':_0x34eb39,'path':_0x3f3228}];_0x12d827[_0xb106('0x23')][_0xb106('0x24')]=util[_0xb106('0x14')](_0xb106('0x25'),JSON[_0xb106('0x26')](_0x396b26,null,0x2));}else if(fs['existsSync'](_0x495ac5)){_0x396b26[_0xb106('0x27')]='Sent';_0x12d827[_0xb106('0x23')][_0xb106('0x28')]=[{'filename':_0x3abbfc,'path':_0x495ac5}];}else{_0x12d827[_0xb106('0x23')][_0xb106('0x24')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x405295[_0xb106('0x29')]){_0x3786b7=![];logger[_0xb106('0xa')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x3786b7){return client[_0xb106('0x2a')](_0xb106('0x2b'),_0x12d827)[_0xb106('0x2c')](function(_0x4e70cf){if(_0x4e70cf[_0xb106('0x2d')]){return logger[_0xb106('0x2d')](_0xb106('0x2e'),JSON[_0xb106('0x26')](_0x4e70cf));}return logger['info']('email\x20sent');})[_0xb106('0x2f')](function(_0x5b9989){return logger[_0xb106('0x2d')]('error\x20mail',JSON[_0xb106('0x26')](_0x5b9989));});}};}function handleError(){return function(_0x240b7c){return logger['error'](JSON[_0xb106('0x26')](_0x240b7c));};}function handleResult(_0x39f16b){return function(_0x302495){logger['info']('data',JSON['stringify'](_0x302495));if(_0x39f16b[_0xb106('0xd')]&&_0x39f16b['MailAccount'][_0xb106('0xb')]&&!_[_0xb106('0x30')](_0x39f16b[_0xb106('0x17')])){setTimeout(handleSendEmail(_0x39f16b,_0x302495),0x3c*0x3e8);}};}function handleJob(_0x31b4ac){return function(){try{if(_[_0xb106('0x30')](_0x31b4ac[_0xb106('0x1a')])){return logger[_0xb106('0xa')](_0xb106('0x31'));}if(_[_0xb106('0x30')](_0x31b4ac[_0xb106('0x1b')])){return logger['info'](_0xb106('0x32'));}var _0x3e921e={'startDate':moment()[_0xb106('0x33')](_0x31b4ac['subtractNumber'],_0x31b4ac[_0xb106('0x1b')])[_0xb106('0x14')](_0xb106('0x34')),'endDate':moment()[_0xb106('0x14')](_0xb106('0x34')),'type':_0xb106('0x35'),'output':_0x31b4ac[_0xb106('0x36')],'name':_0x31b4ac[_0xb106('0x16')]};if(!_[_0xb106('0x30')](_0x31b4ac[_0xb106('0x37')])){logger[_0xb106('0xa')]('exec\x20defaul\x20report\x20id:%s',_0x31b4ac[_0xb106('0x37')]);return analyticDefaultReportController[_0xb106('0x38')]({'id':_0x31b4ac[_0xb106('0x37')]},_0x3e921e)['then'](handleResult(_0x31b4ac))[_0xb106('0x2f')](handleError());}if(!_['isNil'](_0x31b4ac[_0xb106('0x39')])){logger[_0xb106('0xa')](_0xb106('0x3a'),_0x31b4ac[_0xb106('0x39')]);return analyticCustomReportController[_0xb106('0x38')]({'id':_0x31b4ac[_0xb106('0x39')]},_0x3e921e)[_0xb106('0x2c')](handleResult(_0x31b4ac))[_0xb106('0x2f')](handleError());}}catch(_0x4cd0be){logger[_0xb106('0x2d')](JSON['stringify'](_0x4cd0be));}return logger[_0xb106('0xa')](_0xb106('0x3b'));};}function getJobs(_0x5b6f87){var _0x46f559={};if(_0x5b6f87){_0x46f559['id']=_0x5b6f87;}return db[_0xb106('0x3c')]['findAll']({'where':_0x46f559,'include':[{'model':db[_0xb106('0xd')],'attributes':['id',_0xb106('0x16'),'email'],'include':[{'model':db[_0xb106('0x3d')],'as':_0xb106('0xb')}]}]})['then'](function(_0x59dd4f){var _0x5591a9=_[_0xb106('0x3e')](manager['jobs']);var _0x4ae463=_[_0xb106('0x3f')](_0x59dd4f,function(_0x2be4c1){return _0x2be4c1['id'][_0xb106('0x40')]();});var _0x1da172=_['keyBy'](_0x59dd4f,function(_0x511784){return _0x511784['id'][_0xb106('0x40')]();});var _0x317d17=_0x5b6f87?_0x4ae463:_[_0xb106('0x41')](_0x4ae463,_0x5591a9);var _0x5af4b8=_['intersection'](_0x4ae463,_0x5591a9);var _0x2c16ba=_['difference'](_0x5591a9,_0x4ae463);var _0x3e3ce9;var _0x2aaafc;for(_0x3e3ce9=0x0;_0x3e3ce9<_0x2c16ba[_0xb106('0x42')]&&!_0x5b6f87;_0x3e3ce9+=0x1){_0x2aaafc=_0x2c16ba[_0x3e3ce9]['toString']();if(manager[_0xb106('0x43')](_0x2aaafc)){manager[_0xb106('0x44')](_0x2aaafc);manager[_0xb106('0x45')](_0x2aaafc);logger[_0xb106('0xa')](_0xb106('0x46'),_0x2aaafc);}}logger[_0xb106('0xa')](_0xb106('0x47'),JSON[_0xb106('0x26')](_0x317d17));for(_0x3e3ce9=0x0;_0x3e3ce9<_0x317d17['length'];_0x3e3ce9+=0x1){_0x2aaafc=_0x317d17[_0x3e3ce9]['toString']();logger['info']('index',_0x2aaafc);if(_0x5b6f87){logger[_0xb106('0xa')](_0xb106('0x48'),_0x5b6f87);logger[_0xb106('0xa')](JSON[_0xb106('0x26')](_0x1da172[_0x2aaafc]));BPromise[_0xb106('0x49')]()[_0xb106('0x2c')](handleJob(_0x1da172[_0x2aaafc]));logger[_0xb106('0xa')](_0xb106('0x4a'),_0x1da172[_0x2aaafc]['name'],_0x1da172[_0x2aaafc]['cron']);}else if(_0x1da172[_0x2aaafc]['cron']&&_0x1da172[_0x2aaafc][_0xb106('0x4b')]&&moment()['isBetween'](_0x1da172[_0x2aaafc][_0xb106('0x4c')],_0x1da172[_0x2aaafc][_0xb106('0x4d')])){manager['add'](_0x2aaafc,_0x1da172[_0x2aaafc][_0xb106('0x4e')],handleJob(_0x1da172[_0x2aaafc]));manager[_0xb106('0x4f')](_0x2aaafc);logger[_0xb106('0xa')](_0xb106('0x50'),_0x1da172[_0x2aaafc][_0xb106('0x16')],_0x1da172[_0x2aaafc]['cron']);}else if(manager['exists'](_0x2aaafc)){manager[_0xb106('0x44')](_0x2aaafc);manager[_0xb106('0x45')](_0x2aaafc);logger[_0xb106('0xa')](_0xb106('0x51'),_0x1da172[_0x2aaafc][_0xb106('0x16')],_0x1da172[_0x2aaafc][_0xb106('0x4e')]);}}for(_0x3e3ce9=0x0,_0x2aaafc;_0x3e3ce9<_0x5af4b8[_0xb106('0x42')]&&!_0x5b6f87;_0x3e3ce9+=0x1){_0x2aaafc=_0x5af4b8[_0x3e3ce9][_0xb106('0x40')]();if(manager[_0xb106('0x43')](_0x2aaafc)){if(_0x1da172[_0x2aaafc][_0xb106('0x4e')]&&_0x1da172[_0x2aaafc][_0xb106('0x4b')]&&moment()[_0xb106('0x52')](_0x1da172[_0x2aaafc][_0xb106('0x4c')],_0x1da172[_0x2aaafc][_0xb106('0x4d')])){manager['update'](_0x2aaafc,_0x1da172[_0x2aaafc][_0xb106('0x4e')],handleJob(_0x1da172[_0x2aaafc]));logger[_0xb106('0xa')](_0xb106('0x53'),_0x1da172[_0x2aaafc]['name'],_0x1da172[_0x2aaafc]['cron']);}else{manager['stop'](_0x2aaafc);manager[_0xb106('0x45')](_0x2aaafc);logger[_0xb106('0xa')](_0xb106('0x51'),_0x1da172[_0x2aaafc][_0xb106('0x16')],_0x1da172[_0x2aaafc][_0xb106('0x4e')]);}}}})[_0xb106('0x2f')](function(_0x3296f1){logger[_0xb106('0x2d')](JSON[_0xb106('0x26')](_0x3296f1));});}exports[_0xb106('0x54')]=function(_0x5201c6){return getJobs(_0x5201c6);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x30d0=['bcc','format','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','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','status','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','email\x20sent','catch','error\x20mail','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','subtractNumber','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','CustomReportId','Schedule','findAll','MailServerOut','jobs','map','toString','keyBy','difference','intersection','exists','stop','deleteJob','delete\x20cron','toRun','length','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','start','add\x20cron','stop\x20cron','update','update\x20cron','run','util','moment','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','host','port','secure','auth','user','pass','\x22%s\x22\x20<%s>','name','email'];(function(_0x29cb2a,_0x4648db){var _0x694178=function(_0x49e4e8){while(--_0x49e4e8){_0x29cb2a['push'](_0x29cb2a['shift']());}};_0x694178(++_0x4648db);}(_0x30d0,0x1b9));var _0x030d=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x30d0[_0x176329];return _0x31997c;};'use strict';var fs=require('fs');var util=require(_0x030d('0x0'));var path=require('path');var _=require('lodash');var moment=require(_0x030d('0x1'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x030d('0x2'));var BPromise=require(_0x030d('0x3'));var logger=require(_0x030d('0x4'))(_0x030d('0x5'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x030d('0x6'));var analyticDefaultReportController=require(_0x030d('0x7'));var client=jayson[_0x030d('0x8')][_0x030d('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3194ae,_0x5c2a13){return function(){logger[_0x030d('0xa')](_0x030d('0xb'),_0x3194ae['email']);var _0x1a3e1f=!![];var _0x432da5={'tls':{'rejectUnauthorized':![]}};if(_0x3194ae[_0x030d('0xc')][_0x030d('0xd')][_0x030d('0xe')]){_0x432da5['service']=_0x3194ae[_0x030d('0xc')]['Smtp'][_0x030d('0xe')];}else{_0x432da5['host']=_0x3194ae[_0x030d('0xc')][_0x030d('0xd')][_0x030d('0xf')];_0x432da5[_0x030d('0x10')]=_0x3194ae[_0x030d('0xc')][_0x030d('0xd')][_0x030d('0x10')];_0x432da5['secure']=_0x3194ae[_0x030d('0xc')][_0x030d('0xd')][_0x030d('0x11')];}if(_0x3194ae['MailAccount']['Smtp']['authentication']){_0x432da5[_0x030d('0x12')]={'user':_0x3194ae[_0x030d('0xc')][_0x030d('0xd')][_0x030d('0x13')],'pass':_0x3194ae[_0x030d('0xc')]['Smtp'][_0x030d('0x14')]};}var _0x453b55={'account':_0x432da5,'message':{'from':util['format'](_0x030d('0x15'),_0x3194ae[_0x030d('0xc')][_0x030d('0x16')],_0x3194ae[_0x030d('0xc')][_0x030d('0x17')]||_0x3194ae['MailAccount'][_0x030d('0xd')][_0x030d('0x13')]),'to':_0x3194ae[_0x030d('0x17')],'cc':_0x3194ae['cc'],'bcc':_0x3194ae[_0x030d('0x18')],'subject':util[_0x030d('0x19')]('Report\x20%s\x20last\x20%s\x20%s',_0x5c2a13[_0x030d('0x16')],_0x3194ae['subtractNumber'],_0x3194ae[_0x030d('0x1a')])}};var _0x1d80b6=path[_0x030d('0x1b')](__dirname,_0x030d('0x1c'));var _0x37b1b9=_0x5c2a13[_0x030d('0x1d')];var _0x425efe=util[_0x030d('0x19')](_0x030d('0x1e'),path[_0x030d('0x1f')](_0x5c2a13['savename'],path[_0x030d('0x20')](_0x5c2a13[_0x030d('0x1d')])),_0x030d('0x21'));var _0x1b3571=path[_0x030d('0x1b')](_0x1d80b6,_0x37b1b9);var _0x2161ea=path[_0x030d('0x1b')](_0x1d80b6,_0x425efe);if(fs[_0x030d('0x22')](_0x1b3571)){_0x5c2a13['status']=_0x030d('0x23');_0x453b55[_0x030d('0x24')][_0x030d('0x25')]=[{'filename':_0x37b1b9,'path':_0x1b3571}];_0x453b55['message']['text']=util['format'](_0x030d('0x26'),JSON[_0x030d('0x27')](_0x5c2a13,null,0x2));}else if(fs[_0x030d('0x22')](_0x2161ea)){_0x5c2a13[_0x030d('0x28')]=_0x030d('0x23');_0x453b55[_0x030d('0x24')][_0x030d('0x25')]=[{'filename':_0x425efe,'path':_0x2161ea}];}else{_0x453b55[_0x030d('0x24')][_0x030d('0x29')]=_0x030d('0x2a');if(!_0x3194ae[_0x030d('0x2b')]){_0x1a3e1f=![];logger['info'](_0x030d('0x2c'));}}if(_0x1a3e1f){return client[_0x030d('0x2d')](_0x030d('0x2e'),_0x453b55)[_0x030d('0x2f')](function(_0x15f239){if(_0x15f239[_0x030d('0x30')]){return logger[_0x030d('0x30')]('error\x20mail',JSON['stringify'](_0x15f239));}return logger['info'](_0x030d('0x31'));})[_0x030d('0x32')](function(_0x1a789f){return logger[_0x030d('0x30')](_0x030d('0x33'),JSON[_0x030d('0x27')](_0x1a789f));});}};}function handleError(){return function(_0x411f89){return logger[_0x030d('0x30')](JSON['stringify'](_0x411f89));};}function handleResult(_0x59542c){return function(_0x4c8b12){logger[_0x030d('0xa')]('data',JSON[_0x030d('0x27')](_0x4c8b12));if(_0x59542c[_0x030d('0xc')]&&_0x59542c[_0x030d('0xc')]['Smtp']&&!_[_0x030d('0x34')](_0x59542c[_0x030d('0x17')])){setTimeout(handleSendEmail(_0x59542c,_0x4c8b12),0x3c*0x3e8);}};}function handleJob(_0xed65f2){return function(){try{if(_[_0x030d('0x34')](_0xed65f2['subtractNumber'])){return logger['info'](_0x030d('0x35'));}if(_[_0x030d('0x34')](_0xed65f2[_0x030d('0x1a')])){return logger['info'](_0x030d('0x36'));}var _0x363ce6={'startDate':moment()[_0x030d('0x37')](_0xed65f2[_0x030d('0x38')],_0xed65f2[_0x030d('0x1a')])[_0x030d('0x19')](_0x030d('0x39')),'endDate':moment()[_0x030d('0x19')](_0x030d('0x39')),'type':_0x030d('0x3a'),'output':_0xed65f2[_0x030d('0x3b')],'name':_0xed65f2[_0x030d('0x16')]};if(!_[_0x030d('0x34')](_0xed65f2[_0x030d('0x3c')])){logger[_0x030d('0xa')]('exec\x20defaul\x20report\x20id:%s',_0xed65f2['DefaultReportId']);return analyticDefaultReportController[_0x030d('0x3d')]({'id':_0xed65f2['DefaultReportId']},_0x363ce6)['then'](handleResult(_0xed65f2))[_0x030d('0x32')](handleError());}if(!_[_0x030d('0x34')](_0xed65f2[_0x030d('0x3e')])){logger[_0x030d('0xa')]('exec\x20custom\x20report\x20id:%s',_0xed65f2[_0x030d('0x3e')]);return analyticCustomReportController['runReport']({'id':_0xed65f2[_0x030d('0x3e')]},_0x363ce6)['then'](handleResult(_0xed65f2))['catch'](handleError());}}catch(_0x327f74){logger[_0x030d('0x30')](JSON[_0x030d('0x27')](_0x327f74));}return logger[_0x030d('0xa')]('no\x20report\x20id');};}function getJobs(_0x603b0b){var _0xb96532={};if(_0x603b0b){_0xb96532['id']=_0x603b0b;}return db[_0x030d('0x3f')][_0x030d('0x40')]({'where':_0xb96532,'include':[{'model':db[_0x030d('0xc')],'attributes':['id',_0x030d('0x16'),_0x030d('0x17')],'include':[{'model':db[_0x030d('0x41')],'as':_0x030d('0xd')}]}]})[_0x030d('0x2f')](function(_0x369c9a){var _0x3c294e=_['keys'](manager[_0x030d('0x42')]);var _0x52bad1=_[_0x030d('0x43')](_0x369c9a,function(_0x37c30d){return _0x37c30d['id'][_0x030d('0x44')]();});var _0x33906c=_[_0x030d('0x45')](_0x369c9a,function(_0x238d72){return _0x238d72['id'][_0x030d('0x44')]();});var _0x317d86=_0x603b0b?_0x52bad1:_[_0x030d('0x46')](_0x52bad1,_0x3c294e);var _0x336b23=_[_0x030d('0x47')](_0x52bad1,_0x3c294e);var _0x2119a2=_[_0x030d('0x46')](_0x3c294e,_0x52bad1);var _0x2079d1;var _0x20a049;for(_0x2079d1=0x0;_0x2079d1<_0x2119a2['length']&&!_0x603b0b;_0x2079d1+=0x1){_0x20a049=_0x2119a2[_0x2079d1][_0x030d('0x44')]();if(manager[_0x030d('0x48')](_0x20a049)){manager[_0x030d('0x49')](_0x20a049);manager[_0x030d('0x4a')](_0x20a049);logger['info'](_0x030d('0x4b'),_0x20a049);}}logger[_0x030d('0xa')](_0x030d('0x4c'),JSON[_0x030d('0x27')](_0x317d86));for(_0x2079d1=0x0;_0x2079d1<_0x317d86[_0x030d('0x4d')];_0x2079d1+=0x1){_0x20a049=_0x317d86[_0x2079d1][_0x030d('0x44')]();logger['info'](_0x030d('0x4e'),_0x20a049);if(_0x603b0b){logger['info'](_0x030d('0x4f'),_0x603b0b);logger['info'](JSON['stringify'](_0x33906c[_0x20a049]));BPromise[_0x030d('0x50')]()['then'](handleJob(_0x33906c[_0x20a049]));logger[_0x030d('0xa')](_0x030d('0x51'),_0x33906c[_0x20a049][_0x030d('0x16')],_0x33906c[_0x20a049]['cron']);}else if(_0x33906c[_0x20a049][_0x030d('0x52')]&&_0x33906c[_0x20a049][_0x030d('0x53')]&&moment()[_0x030d('0x54')](_0x33906c[_0x20a049][_0x030d('0x55')],_0x33906c[_0x20a049][_0x030d('0x56')])){manager['add'](_0x20a049,_0x33906c[_0x20a049][_0x030d('0x52')],handleJob(_0x33906c[_0x20a049]));manager[_0x030d('0x57')](_0x20a049);logger[_0x030d('0xa')](_0x030d('0x58'),_0x33906c[_0x20a049]['name'],_0x33906c[_0x20a049][_0x030d('0x52')]);}else if(manager[_0x030d('0x48')](_0x20a049)){manager[_0x030d('0x49')](_0x20a049);manager['deleteJob'](_0x20a049);logger[_0x030d('0xa')](_0x030d('0x59'),_0x33906c[_0x20a049][_0x030d('0x16')],_0x33906c[_0x20a049]['cron']);}}for(_0x2079d1=0x0,_0x20a049;_0x2079d1<_0x336b23[_0x030d('0x4d')]&&!_0x603b0b;_0x2079d1+=0x1){_0x20a049=_0x336b23[_0x2079d1][_0x030d('0x44')]();if(manager['exists'](_0x20a049)){if(_0x33906c[_0x20a049][_0x030d('0x52')]&&_0x33906c[_0x20a049]['active']&&moment()['isBetween'](_0x33906c[_0x20a049][_0x030d('0x55')],_0x33906c[_0x20a049][_0x030d('0x56')])){manager[_0x030d('0x5a')](_0x20a049,_0x33906c[_0x20a049]['cron'],handleJob(_0x33906c[_0x20a049]));logger[_0x030d('0xa')](_0x030d('0x5b'),_0x33906c[_0x20a049]['name'],_0x33906c[_0x20a049][_0x030d('0x52')]);}else{manager['stop'](_0x20a049);manager[_0x030d('0x4a')](_0x20a049);logger[_0x030d('0xa')](_0x030d('0x59'),_0x33906c[_0x20a049]['name'],_0x33906c[_0x20a049][_0x030d('0x52')]);}}}})['catch'](function(_0x505192){logger[_0x030d('0x30')](JSON[_0x030d('0x27')](_0x505192));});}exports[_0x030d('0x5c')]=function(_0x5bed28){return getJobs(_0x5bed28);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 2e1fe5a..9ac6f1e 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 _0xbe99=['sentiment','sentimentRegion','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','Positive','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','Cloud\x20Provider\x20not\x20available','forEach','all','catch','start','lodash','aws-sdk','request-promise','util','bluebird','../../config/logger','Comprehend','detectSentiment','substring','info','format','transcribeName','data1','data2','then','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','fileText','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested'];(function(_0x480f6e,_0x2b03cc){var _0x3712d0=function(_0x3078ec){while(--_0x3078ec){_0x480f6e['push'](_0x480f6e['shift']());}};_0x3712d0(++_0x2b03cc);}(_0xbe99,0x196));var _0x9be9=function(_0x353856,_0x5ce89d){_0x353856=_0x353856-0x0;var _0xa58048=_0xbe99[_0x353856];return _0xa58048;};var _=require(_0x9be9('0x0'));var AWS=require(_0x9be9('0x1'));var rp=require(_0x9be9('0x2'));var util=require(_0x9be9('0x3'));var BPromise=require(_0x9be9('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x9be9('0x5'))('transcribe');function getTranscriptionJob(_0x3bc6d5,_0x3cfcaa,_0x3445f5,_0x7758db){return new Promise(function(_0x52da35,_0x2134e7){var _0x1eccd7=new AWS['TranscribeService']({'accessKeyId':_0x3cfcaa,'secretAccessKey':_0x3bc6d5,'region':_0x3445f5});_0x1eccd7['getTranscriptionJob']({'TranscriptionJobName':_0x7758db},function(_0x7e0cd,_0x33f952){if(_0x7e0cd){return _0x2134e7(_0x7e0cd);}else{return _0x52da35(_0x33f952);}});});}function sentiment(_0x141bc7,_0x234cfc,_0x178a02,_0x40a766,_0xc91d1c){return new Promise(function(_0x8e9f81,_0x3f0d05){var _0x385a13=new AWS[(_0x9be9('0x6'))]({'accessKeyId':_0x234cfc,'secretAccessKey':_0x141bc7,'region':_0x178a02});_0x385a13[_0x9be9('0x7')]({'Text':_0x40a766,'LanguageCode':_0xc91d1c[_0x9be9('0x8')](0x0,0x2)},function(_0x1bb9ad,_0x1ca383){if(_0x1bb9ad){return _0x3f0d05(_0x1bb9ad);}else{return _0x8e9f81(_0x1ca383);}});});}function checkTranscribeJob(_0x3ead74,_0x33c2cd,_0x4b6d99){var _0x1251e4;return new BPromise(function(_0x12ede7,_0x31a72c){logger[_0x9be9('0x9')](util[_0x9be9('0xa')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x3ead74['id'],_0x3ead74[_0x9be9('0xb')]));return getTranscriptionJob(_0x4b6d99[_0x9be9('0xc')],_0x4b6d99[_0x9be9('0xd')],_0x33c2cd['transcribeRegion'],_0x3ead74[_0x9be9('0xb')])[_0x9be9('0xe')](function(_0x3c92cc){logger[_0x9be9('0x9')](util[_0x9be9('0xa')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x3ead74['id'],_0x3ead74[_0x9be9('0xb')],_0x3c92cc[_0x9be9('0xf')][_0x9be9('0x10')]));if(!_0x3ead74['fileText']){switch(_0x3c92cc['TranscriptionJob'][_0x9be9('0x10')]){case _0x9be9('0x11'):var _0x18a92a={'transcribeStatus':_0x3c92cc['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x3c92cc[_0x9be9('0xf')][_0x9be9('0x12')][_0x9be9('0x13')]};logger[_0x9be9('0x9')](util[_0x9be9('0xa')](_0x9be9('0x14'),_0x3ead74['id']));return rp({'uri':_0x3c92cc[_0x9be9('0xf')][_0x9be9('0x12')][_0x9be9('0x13')],'json':!![]})[_0x9be9('0xe')](function(_0xd700ff){logger[_0x9be9('0x9')](util['format'](_0x9be9('0x15'),_0x3ead74['id']));if(_0xd700ff&&_0xd700ff['results']&&_0xd700ff[_0x9be9('0x16')][_0x9be9('0x17')]&&_0xd700ff[_0x9be9('0x16')][_0x9be9('0x17')]['length']){_0x18a92a[_0x9be9('0x18')]='';for(var _0xfb4266=0x0;_0xfb4266<_0xd700ff[_0x9be9('0x16')][_0x9be9('0x17')][_0x9be9('0x19')];_0xfb4266++){_0x18a92a[_0x9be9('0x18')]+=_0xd700ff[_0x9be9('0x16')][_0x9be9('0x17')][_0xfb4266][_0x9be9('0x1a')]+'';}}return _0x3ead74[_0x9be9('0x1b')](_0x18a92a);})['then'](function(){logger[_0x9be9('0x9')](util[_0x9be9('0xa')](_0x9be9('0x1c'),_0x3ead74['id']));if(!_0x3ead74[_0x9be9('0x1d')]){throw new db[(_0x9be9('0x1e'))]['ValidationError'](_0x9be9('0x1f'));}if(!_0x33c2cd[_0x9be9('0x20')]||!_0x33c2cd['sentimentAccountId']||!_0x33c2cd[_0x9be9('0x21')]||!_0x33c2cd['language']||!_0x33c2cd[_0x9be9('0x22')]){throw new db[(_0x9be9('0x1e'))][(_0x9be9('0x23'))](_0x9be9('0x24'));}if(!_0x18a92a['fileText']){throw new Error(_0x9be9('0x25'));}if(_0x33c2cd[_0x9be9('0x26')]===_0x4b6d99['id']){return _0x4b6d99;}else{return db[_0x9be9('0x27')][_0x9be9('0x28')]({'where':{'id':_settings[_0x9be9('0x26')]}});}})[_0x9be9('0xe')](function(_0x359755){if(!_0x359755){throw new db[(_0x9be9('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x359755[_0x9be9('0xc')]||!_0x359755['data2']){throw new db[(_0x9be9('0x1e'))][(_0x9be9('0x23'))](_0x9be9('0x29'));}_0x1251e4=_0x359755;logger[_0x9be9('0x9')](util['format'](_0x9be9('0x2a'),_0x3ead74['id']));return sentiment(_0x1251e4[_0x9be9('0xc')],_0x1251e4[_0x9be9('0xd')],_0x33c2cd[_0x9be9('0x21')],_0x18a92a[_0x9be9('0x18')],_0x33c2cd['language']);})[_0x9be9('0xe')](function(_0x577ea5){logger['info'](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x3ead74['id']));return _0x3ead74[_0x9be9('0x1b')]({'sentiment':_0x577ea5[_0x9be9('0x2b')],'sPositive':_0x577ea5['SentimentScore'][_0x9be9('0x2c')],'sNegative':_0x577ea5[_0x9be9('0x2d')][_0x9be9('0x2e')],'sMixed':_0x577ea5[_0x9be9('0x2d')][_0x9be9('0x2f')],'sNeutral':_0x577ea5['SentimentScore'][_0x9be9('0x30')]});})[_0x9be9('0xe')](function(){logger[_0x9be9('0x9')](util[_0x9be9('0xa')](_0x9be9('0x1c'),_0x3ead74['id']));_0x12ede7();});case _0x9be9('0x31'):return _0x3ead74[_0x9be9('0x1b')]({'transcribeStatus':_0x9be9('0x31'),'failureReason':_0x3c92cc[_0x9be9('0xf')][_0x9be9('0x32')]})[_0x9be9('0xe')](function(){logger[_0x9be9('0x9')](util[_0x9be9('0xa')](_0x9be9('0x1c'),_0x3ead74['id']));_0x12ede7();});default:logger[_0x9be9('0x9')](util[_0x9be9('0xa')](_0x9be9('0x33'),_0x3ead74['id']));break;}}else{return BPromise[_0x9be9('0x34')]()[_0x9be9('0xe')](function(){if(!_0x3ead74[_0x9be9('0x1d')]){throw new db[(_0x9be9('0x1e'))][(_0x9be9('0x23'))](_0x9be9('0x1f'));}if(!_0x33c2cd[_0x9be9('0x20')]||!_0x33c2cd['sentimentAccountId']||!_0x33c2cd[_0x9be9('0x21')]||!_0x33c2cd[_0x9be9('0x35')]||!_0x33c2cd[_0x9be9('0x22')]){throw new db[(_0x9be9('0x1e'))][(_0x9be9('0x23'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x3ead74[_0x9be9('0x18')]){throw new Error(_0x9be9('0x25'));}if(_0x33c2cd[_0x9be9('0x26')]===_0x4b6d99['id']){return _0x4b6d99;}else{return db[_0x9be9('0x27')][_0x9be9('0x28')]({'where':{'id':_settings[_0x9be9('0x26')]}});}})[_0x9be9('0xe')](function(_0x15763c){if(!_0x15763c){throw new db[(_0x9be9('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x15763c[_0x9be9('0xc')]||!_0x15763c['data2']){throw new db['Sequelize'][(_0x9be9('0x23'))](_0x9be9('0x29'));}_0x1251e4=_0x15763c;logger[_0x9be9('0x9')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x3ead74['id']));return sentiment(_0x1251e4[_0x9be9('0xc')],_0x1251e4['data2'],_0x33c2cd[_0x9be9('0x21')],_0x3ead74[_0x9be9('0x18')],_0x33c2cd['language']);})[_0x9be9('0xe')](function(_0x1e1675){logger[_0x9be9('0x9')](util[_0x9be9('0xa')](_0x9be9('0x36'),_0x3ead74['id']));return _0x3ead74['update']({'sentiment':_0x1e1675[_0x9be9('0x2b')],'sPositive':_0x1e1675[_0x9be9('0x2d')][_0x9be9('0x2c')],'sNegative':_0x1e1675['SentimentScore'][_0x9be9('0x2e')],'sMixed':_0x1e1675['SentimentScore'][_0x9be9('0x2f')],'sNeutral':_0x1e1675[_0x9be9('0x2d')][_0x9be9('0x30')],'transcribeStatus':_0x9be9('0x11')});})['then'](function(){logger['info'](util[_0x9be9('0xa')](_0x9be9('0x1c'),_0x3ead74['id']));_0x12ede7();});}})['catch'](function(_0x18c9b9){if(_0x18c9b9){if(!_0x18c9b9[_0x9be9('0x37')]||_0x18c9b9[_0x9be9('0x37')]!==_0x9be9('0x38')){logger[_0x9be9('0x39')](util[_0x9be9('0xa')](_0x9be9('0x3a'),_0x3ead74['id']),util[_0x9be9('0x3b')](_0x18c9b9,{'showHidden':![],'depth':null}));}}_0x12ede7();});});}function checkTranscribe(){var _0x167a38;var _0x36962e;var _0x1385ac;return db[_0x9be9('0x3c')]['findAll']({'where':{'transcribeStatus':_0x9be9('0x3d')}})[_0x9be9('0xe')](function(_0x42e8ed){if(!_0x42e8ed||!_0x42e8ed[_0x9be9('0x19')]){throw new db['Sequelize']['ValidationError'](_0x9be9('0x3e'));}_0x167a38=_0x42e8ed;return db[_0x9be9('0x3f')][_0x9be9('0x28')]({'where':{'id':0x1}});})[_0x9be9('0xe')](function(_0x18450a){if(!_0x18450a){throw new db['Sequelize'][(_0x9be9('0x23'))](_0x9be9('0x40'));}_0x36962e=_0x18450a;if(!_0x36962e['transcribe']||!_0x36962e[_0x9be9('0x41')]||!_0x36962e[_0x9be9('0x42')]||!_0x36962e['language']||!_0x36962e[_0x9be9('0x22')]){throw new db[(_0x9be9('0x1e'))][(_0x9be9('0x23'))](_0x9be9('0x43'));}return db['CloudProvider'][_0x9be9('0x28')]({'where':{'id':_0x36962e[_0x9be9('0x41')]}});})[_0x9be9('0xe')](function(_0x46a7d2){if(!_0x46a7d2){throw new db[(_0x9be9('0x1e'))][(_0x9be9('0x23'))](_0x9be9('0x44'));}if(!_0x46a7d2[_0x9be9('0xc')]||!_0x46a7d2[_0x9be9('0xd')]){throw new db[(_0x9be9('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x1385ac=_0x46a7d2;var _0x5862ef=[];_0x167a38[_0x9be9('0x45')](function(_0x191e1c){_0x5862ef['push'](checkTranscribeJob(_0x191e1c,_0x36962e,_0x1385ac));});return BPromise[_0x9be9('0x46')](_0x5862ef);})[_0x9be9('0x47')](function(_0x3e83ec){if(_0x3e83ec){if(!_0x3e83ec[_0x9be9('0x37')]||_0x3e83ec[_0x9be9('0x37')]!==_0x9be9('0x38')){logger[_0x9be9('0x39')](util['inspect'](_0x3e83ec,{'showHidden':![],'depth':null}));}}});}exports[_0x9be9('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xede3=['substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data2','transcribeName','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','[RECORDING:%d]\x20Get\x20transcript','Transcript','TranscriptFileUri','then','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','ValidationError','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','data1','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','Neutral','FAILED','FailureReason','Sentiment\x20Analysis\x20not\x20configured','Mixed','catch','name','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','start','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment'];(function(_0xcb3602,_0xcd1d58){var _0x17ecab=function(_0x1fbe6a){while(--_0x1fbe6a){_0xcb3602['push'](_0xcb3602['shift']());}};_0x17ecab(++_0xcd1d58);}(_0xede3,0xc0));var _0x3ede=function(_0x3dfe68,_0x16cf06){_0x3dfe68=_0x3dfe68-0x0;var _0x215ce4=_0xede3[_0x3dfe68];return _0x215ce4;};var _=require('lodash');var AWS=require(_0x3ede('0x0'));var rp=require('request-promise');var util=require(_0x3ede('0x1'));var BPromise=require(_0x3ede('0x2'));var db=require(_0x3ede('0x3'))['db'];var logger=require(_0x3ede('0x4'))(_0x3ede('0x5'));function getTranscriptionJob(_0x1e463b,_0x10dbc8,_0x450f99,_0xf6f567){return new Promise(function(_0x365db9,_0x328085){var _0x150182=new AWS[(_0x3ede('0x6'))]({'accessKeyId':_0x10dbc8,'secretAccessKey':_0x1e463b,'region':_0x450f99});_0x150182[_0x3ede('0x7')]({'TranscriptionJobName':_0xf6f567},function(_0x583272,_0x428a4b){if(_0x583272){return _0x328085(_0x583272);}else{return _0x365db9(_0x428a4b);}});});}function sentiment(_0x3d308f,_0x4168b5,_0x58ceae,_0x35cea4,_0x555bd){return new Promise(function(_0x177db,_0x377182){var _0x1e5240=new AWS['Comprehend']({'accessKeyId':_0x4168b5,'secretAccessKey':_0x3d308f,'region':_0x58ceae});_0x1e5240[_0x3ede('0x8')]({'Text':_0x35cea4,'LanguageCode':_0x555bd[_0x3ede('0x9')](0x0,0x2)},function(_0x3a22b8,_0xdeba4e){if(_0x3a22b8){return _0x377182(_0x3a22b8);}else{return _0x177db(_0xdeba4e);}});});}function checkTranscribeJob(_0x4a9c49,_0x35c8d4,_0x3b2697){var _0xf1a93b;return new BPromise(function(_0x449111,_0x3875f0){logger[_0x3ede('0xa')](util[_0x3ede('0xb')](_0x3ede('0xc'),_0x4a9c49['id'],_0x4a9c49['transcribeName']));return getTranscriptionJob(_0x3b2697['data1'],_0x3b2697[_0x3ede('0xd')],_0x35c8d4['transcribeRegion'],_0x4a9c49[_0x3ede('0xe')])['then'](function(_0x54ae57){logger[_0x3ede('0xa')](util[_0x3ede('0xb')](_0x3ede('0xf'),_0x4a9c49['id'],_0x4a9c49['transcribeName'],_0x54ae57[_0x3ede('0x10')]['TranscriptionJobStatus']));if(!_0x4a9c49['fileText']){switch(_0x54ae57[_0x3ede('0x10')][_0x3ede('0x11')]){case _0x3ede('0x12'):var _0x54aeb9={'transcribeStatus':_0x54ae57[_0x3ede('0x10')][_0x3ede('0x11')],'fileUri':_0x54ae57[_0x3ede('0x10')]['Transcript']['TranscriptFileUri']};logger[_0x3ede('0xa')](util['format'](_0x3ede('0x13'),_0x4a9c49['id']));return rp({'uri':_0x54ae57['TranscriptionJob'][_0x3ede('0x14')][_0x3ede('0x15')],'json':!![]})[_0x3ede('0x16')](function(_0xf821d9){logger[_0x3ede('0xa')](util[_0x3ede('0xb')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x4a9c49['id']));if(_0xf821d9&&_0xf821d9[_0x3ede('0x17')]&&_0xf821d9[_0x3ede('0x17')][_0x3ede('0x18')]&&_0xf821d9[_0x3ede('0x17')][_0x3ede('0x18')][_0x3ede('0x19')]){_0x54aeb9[_0x3ede('0x1a')]='';for(var _0x44713b=0x0;_0x44713b<_0xf821d9[_0x3ede('0x17')][_0x3ede('0x18')]['length'];_0x44713b++){_0x54aeb9['fileText']+=_0xf821d9[_0x3ede('0x17')][_0x3ede('0x18')][_0x44713b][_0x3ede('0x1b')]+'';}}return _0x4a9c49[_0x3ede('0x1c')](_0x54aeb9);})[_0x3ede('0x16')](function(){logger[_0x3ede('0xa')](util['format'](_0x3ede('0x1d'),_0x4a9c49['id']));if(!_0x4a9c49[_0x3ede('0x1e')]){throw new db[(_0x3ede('0x1f'))]['ValidationError'](_0x3ede('0x20'));}if(!_0x35c8d4[_0x3ede('0x21')]||!_0x35c8d4[_0x3ede('0x22')]||!_0x35c8d4['sentimentRegion']||!_0x35c8d4[_0x3ede('0x23')]||!_0x35c8d4['bucket']){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x54aeb9['fileText']){throw new Error(_0x3ede('0x25'));}if(_0x35c8d4[_0x3ede('0x22')]===_0x3b2697['id']){return _0x3b2697;}else{return db[_0x3ede('0x26')][_0x3ede('0x27')]({'where':{'id':_settings[_0x3ede('0x22')]}});}})[_0x3ede('0x16')](function(_0x41c790){if(!_0x41c790){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x28'));}if(!_0x41c790['data1']||!_0x41c790[_0x3ede('0xd')]){throw new db[(_0x3ede('0x1f'))]['ValidationError'](_0x3ede('0x29'));}_0xf1a93b=_0x41c790;logger[_0x3ede('0xa')](util[_0x3ede('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4a9c49['id']));return sentiment(_0xf1a93b[_0x3ede('0x2a')],_0xf1a93b['data2'],_0x35c8d4[_0x3ede('0x2b')],_0x54aeb9[_0x3ede('0x1a')],_0x35c8d4[_0x3ede('0x23')]);})['then'](function(_0x518543){logger[_0x3ede('0xa')](util[_0x3ede('0xb')](_0x3ede('0x2c'),_0x4a9c49['id']));return _0x4a9c49[_0x3ede('0x1c')]({'sentiment':_0x518543[_0x3ede('0x2d')],'sPositive':_0x518543['SentimentScore'][_0x3ede('0x2e')],'sNegative':_0x518543[_0x3ede('0x2f')][_0x3ede('0x30')],'sMixed':_0x518543[_0x3ede('0x2f')]['Mixed'],'sNeutral':_0x518543[_0x3ede('0x2f')][_0x3ede('0x31')]});})[_0x3ede('0x16')](function(){logger['info'](util['format'](_0x3ede('0x1d'),_0x4a9c49['id']));_0x449111();});case _0x3ede('0x32'):return _0x4a9c49[_0x3ede('0x1c')]({'transcribeStatus':_0x3ede('0x32'),'failureReason':_0x54ae57[_0x3ede('0x10')][_0x3ede('0x33')]})[_0x3ede('0x16')](function(){logger['info'](util[_0x3ede('0xb')](_0x3ede('0x1d'),_0x4a9c49['id']));_0x449111();});default:logger[_0x3ede('0xa')](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x4a9c49['id']));break;}}else{return BPromise['resolve']()[_0x3ede('0x16')](function(){if(!_0x4a9c49[_0x3ede('0x1e')]){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x20'));}if(!_0x35c8d4[_0x3ede('0x21')]||!_0x35c8d4[_0x3ede('0x22')]||!_0x35c8d4[_0x3ede('0x2b')]||!_0x35c8d4[_0x3ede('0x23')]||!_0x35c8d4['bucket']){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x34'));}if(!_0x4a9c49['fileText']){throw new Error(_0x3ede('0x25'));}if(_0x35c8d4[_0x3ede('0x22')]===_0x3b2697['id']){return _0x3b2697;}else{return db[_0x3ede('0x26')][_0x3ede('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x222a85){if(!_0x222a85){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x28'));}if(!_0x222a85['data1']||!_0x222a85[_0x3ede('0xd')]){throw new db[(_0x3ede('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0xf1a93b=_0x222a85;logger['info'](util[_0x3ede('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4a9c49['id']));return sentiment(_0xf1a93b['data1'],_0xf1a93b['data2'],_0x35c8d4[_0x3ede('0x2b')],_0x4a9c49[_0x3ede('0x1a')],_0x35c8d4[_0x3ede('0x23')]);})[_0x3ede('0x16')](function(_0x22ae1a){logger[_0x3ede('0xa')](util['format'](_0x3ede('0x2c'),_0x4a9c49['id']));return _0x4a9c49['update']({'sentiment':_0x22ae1a['Sentiment'],'sPositive':_0x22ae1a[_0x3ede('0x2f')][_0x3ede('0x2e')],'sNegative':_0x22ae1a[_0x3ede('0x2f')]['Negative'],'sMixed':_0x22ae1a['SentimentScore'][_0x3ede('0x35')],'sNeutral':_0x22ae1a[_0x3ede('0x2f')][_0x3ede('0x31')],'transcribeStatus':'COMPLETED'});})[_0x3ede('0x16')](function(){logger[_0x3ede('0xa')](util[_0x3ede('0xb')](_0x3ede('0x1d'),_0x4a9c49['id']));_0x449111();});}})[_0x3ede('0x36')](function(_0x34f94a){if(_0x34f94a){if(!_0x34f94a[_0x3ede('0x37')]||_0x34f94a['name']!=='SequelizeValidationError'){logger['error'](util['format']('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x4a9c49['id']),util[_0x3ede('0x38')](_0x34f94a,{'showHidden':![],'depth':null}));}}_0x449111();});});}function checkTranscribe(){var _0x44ba2a;var _0x13b7a0;var _0x29f801;return db[_0x3ede('0x39')][_0x3ede('0x3a')]({'where':{'transcribeStatus':_0x3ede('0x3b')}})['then'](function(_0x52d97e){if(!_0x52d97e||!_0x52d97e[_0x3ede('0x19')]){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x3c'));}_0x44ba2a=_0x52d97e;return db[_0x3ede('0x3d')][_0x3ede('0x27')]({'where':{'id':0x1}});})['then'](function(_0x3dc3a5){if(!_0x3dc3a5){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x3e'));}_0x13b7a0=_0x3dc3a5;if(!_0x13b7a0[_0x3ede('0x5')]||!_0x13b7a0[_0x3ede('0x3f')]||!_0x13b7a0[_0x3ede('0x40')]||!_0x13b7a0[_0x3ede('0x23')]||!_0x13b7a0['bucket']){throw new db['Sequelize']['ValidationError'](_0x3ede('0x41'));}return db[_0x3ede('0x26')][_0x3ede('0x27')]({'where':{'id':_0x13b7a0[_0x3ede('0x3f')]}});})['then'](function(_0x253773){if(!_0x253773){throw new db[(_0x3ede('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x253773[_0x3ede('0x2a')]||!_0x253773['data2']){throw new db['Sequelize'][(_0x3ede('0x24'))](_0x3ede('0x29'));}_0x29f801=_0x253773;var _0x148c96=[];_0x44ba2a['forEach'](function(_0x2c6981){_0x148c96['push'](checkTranscribeJob(_0x2c6981,_0x13b7a0,_0x29f801));});return BPromise['all'](_0x148c96);})[_0x3ede('0x36')](function(_0x37fbbb){if(_0x37fbbb){if(!_0x37fbbb[_0x3ede('0x37')]||_0x37fbbb['name']!=='SequelizeValidationError'){logger['error'](util[_0x3ede('0x38')](_0x37fbbb,{'showHidden':![],'depth':null}));}}});}exports[_0x3ede('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 10feb9a..6e03ba9 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 _0x2484=['moment','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','subtract','hours','then','length','map','info','join','update','system','timeout','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash'];(function(_0x2106ac,_0xf8f9d3){var _0x423aa6=function(_0x60ec25){while(--_0x60ec25){_0x2106ac['push'](_0x2106ac['shift']());}};_0x423aa6(++_0xf8f9d3);}(_0x2484,0x178));var _0x4248=function(_0x254abd,_0x1ab7f0){_0x254abd=_0x254abd-0x0;var _0x31bf1b=_0x2484[_0x254abd];return _0x31bf1b;};'use strict';var _=require(_0x4248('0x0'));var moment=require(_0x4248('0x1'));var Redis=require('ioredis');var util=require(_0x4248('0x2'));var config=require(_0x4248('0x3'));var db=require(_0x4248('0x4'))['db'];var logger=require(_0x4248('0x5'))(_0x4248('0x6'));config[_0x4248('0x7')]=_[_0x4248('0x8')](config['redis'],{'host':_0x4248('0x9'),'port':0x18eb});var io=require(_0x4248('0xa'))(new Redis(config[_0x4248('0x7')]));function closeInteractions(){var _0x189f42=[];return db[_0x4248('0xb')][_0x4248('0xc')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x4248('0xd')](0x18,_0x4248('0xe'))}}})[_0x4248('0xf')](function(_0xbe710c){if(_0xbe710c&&_0xbe710c[_0x4248('0x10')]){_0x189f42=_[_0x4248('0x11')](_0xbe710c||[],'id');logger[_0x4248('0x12')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x189f42[_0x4248('0x13')]());return db['WhatsappInteraction'][_0x4248('0x14')]({'closeReason':_0x4248('0x15'),'disposition':_0x4248('0x16'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x189f42}});}})[_0x4248('0xf')](function(){if(_0x189f42&&_0x189f42['length']){logger[_0x4248('0x12')](_0x4248('0x17'),_0x189f42[_0x4248('0x13')]());for(var _0x3a8be9=0x0;_0x3a8be9<_0x189f42[_0x4248('0x10')];_0x3a8be9++){io['emit'](_0x4248('0x18'),{'id':_0x189f42[_0x3a8be9],'closed':!![]});}}})[_0x4248('0x19')](function(_0x1ae491){logger[_0x4248('0x1a')](_0x4248('0x1b'),_0x1ae491?util['inspect'](_0x1ae491,{'showHidden':![],'depth':null}):'');});}exports[_0x4248('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xec01=['redis','WhatsappInteraction','findAll','lastMsgAt','subtract','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','defaults','localhost','socket.io-emitter'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0xec01,0xe7));var _0x1ec0=function(_0x4b9bd4,_0x541267){_0x4b9bd4=_0x4b9bd4-0x0;var _0x233413=_0xec01[_0x4b9bd4];return _0x233413;};'use strict';var _=require('lodash');var moment=require(_0x1ec0('0x0'));var Redis=require(_0x1ec0('0x1'));var util=require('util');var config=require(_0x1ec0('0x2'));var db=require(_0x1ec0('0x3'))['db'];var logger=require(_0x1ec0('0x4'))(_0x1ec0('0x5'));config['redis']=_[_0x1ec0('0x6')](config['redis'],{'host':_0x1ec0('0x7'),'port':0x18eb});var io=require(_0x1ec0('0x8'))(new Redis(config[_0x1ec0('0x9')]));function closeInteractions(){var _0x3741d5=[];return db[_0x1ec0('0xa')][_0x1ec0('0xb')]({'raw':!![],'attributes':['id',_0x1ec0('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x1ec0('0xd')](0x18,'hours')}}})['then'](function(_0x2aee4e){if(_0x2aee4e&&_0x2aee4e[_0x1ec0('0xe')]){_0x3741d5=_[_0x1ec0('0xf')](_0x2aee4e||[],'id');logger[_0x1ec0('0x10')](_0x1ec0('0x11'),_0x3741d5[_0x1ec0('0x12')]());return db[_0x1ec0('0xa')][_0x1ec0('0x13')]({'closeReason':_0x1ec0('0x14'),'disposition':_0x1ec0('0x15'),'closed':!![],'closedAt':moment()[_0x1ec0('0x16')](_0x1ec0('0x17'))},{'where':{'id':_0x3741d5}});}})[_0x1ec0('0x18')](function(){if(_0x3741d5&&_0x3741d5[_0x1ec0('0xe')]){logger[_0x1ec0('0x10')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x3741d5['join']());for(var _0x51491c=0x0;_0x51491c<_0x3741d5[_0x1ec0('0xe')];_0x51491c++){io[_0x1ec0('0x19')](_0x1ec0('0x1a'),{'id':_0x3741d5[_0x51491c],'closed':!![]});}}})['catch'](function(_0xb6fa91){logger[_0x1ec0('0x1b')](_0x1ec0('0x1c'),_0xb6fa91?util[_0x1ec0('0x1d')](_0xb6fa91,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 6d7abbb..1301025 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9287=['../mysqldb','push','Innocenzo','@xcally.com','now','Biondo','innocenzo.biondo','CmContact','destroy','bulkCreate','then','log','finished\x20populating','contacts1','CmHopper','contacts2','hopper2','catch'];(function(_0x1b1b4f,_0x10e06e){var _0xe62050=function(_0x1cb6cd){while(--_0x1cb6cd){_0x1b1b4f['push'](_0x1b1b4f['shift']());}};_0xe62050(++_0x10e06e);}(_0x9287,0x6c));var _0x7928=function(_0x1ed1d8,_0x384889){_0x1ed1d8=_0x1ed1d8-0x0;var _0x4f145d=_0x9287[_0x1ed1d8];return _0x4f145d;};'use strict';var util=require('util');var db=require(_0x7928('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x7928('0x1')]({'id':i,'firstName':_0x7928('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x7928('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x7928('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7928('0x4')](),'updatedAt':Date[_0x7928('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x7928('0x2')+i,'lastName':_0x7928('0x5')+i,'phone':0xf879fb460+i,'email':_0x7928('0x6')+i+_0x7928('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x7928('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x7928('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7928('0x4')](),'updatedAt':Date[_0x7928('0x4')]()});}db[_0x7928('0x7')][_0x7928('0x8')]({'where':{}})['then'](function(){return db[_0x7928('0x7')][_0x7928('0x9')](contacts);})[_0x7928('0xa')](function(){console[_0x7928('0xb')](_0x7928('0xc'),_0x7928('0xd'));return db[_0x7928('0xe')][_0x7928('0x8')]({'where':{}});})['then'](function(){return db[_0x7928('0xe')][_0x7928('0x9')](hopper);})['then'](function(){console[_0x7928('0xb')](_0x7928('0xc'),'hopper1');return db[_0x7928('0x7')]['bulkCreate'](contacts2);})[_0x7928('0xa')](function(){console[_0x7928('0xb')]('finished\x20populating',_0x7928('0xf'));return db[_0x7928('0xe')]['bulkCreate'](hopper2);})[_0x7928('0xa')](function(){console['log'](_0x7928('0xc'),_0x7928('0x10'));})[_0x7928('0x11')](function(_0x1a8ed6){console[_0x7928('0xb')](_0x1a8ed6);}); \ No newline at end of file +var _0x5a58=['hopper1','log','contacts2','hopper2','catch','../mysqldb','push','Innocenzo','Biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','finished\x20populating','contacts1','CmHopper'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5a58,0xcb));var _0x85a5=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x5a58[_0x55abd9];return _0x3e5669;};'use strict';var util=require('util');var db=require(_0x85a5('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x85a5('0x1')]({'id':i,'firstName':_0x85a5('0x2')+i,'lastName':_0x85a5('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x85a5('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x85a5('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x85a5('0x5')](),'updatedAt':Date[_0x85a5('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x85a5('0x1')]({'id':i,'firstName':_0x85a5('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x85a5('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x85a5('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x85a5('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x85a5('0x5')]()});}db[_0x85a5('0x6')][_0x85a5('0x7')]({'where':{}})[_0x85a5('0x8')](function(){return db['CmContact'][_0x85a5('0x9')](contacts);})[_0x85a5('0x8')](function(){console['log'](_0x85a5('0xa'),_0x85a5('0xb'));return db[_0x85a5('0xc')]['destroy']({'where':{}});})[_0x85a5('0x8')](function(){return db[_0x85a5('0xc')]['bulkCreate'](hopper);})['then'](function(){console['log']('finished\x20populating',_0x85a5('0xd'));return db[_0x85a5('0x6')]['bulkCreate'](contacts2);})[_0x85a5('0x8')](function(){console[_0x85a5('0xe')](_0x85a5('0xa'),_0x85a5('0xf'));return db[_0x85a5('0xc')][_0x85a5('0x9')](hopper2);})[_0x85a5('0x8')](function(){console[_0x85a5('0xe')](_0x85a5('0xa'),_0x85a5('0x10'));})[_0x85a5('0x11')](function(_0x11c78d){console[_0x85a5('0xe')](_0x11c78d);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index e44b7f4..846b025 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6434=['../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch'];(function(_0x13446d,_0x554388){var _0xf045b0=function(_0x539c84){while(--_0x539c84){_0x13446d['push'](_0x13446d['shift']());}};_0xf045b0(++_0x554388);}(_0x6434,0x154));var _0x4643=function(_0x45a7ac,_0x2b3b52){_0x45a7ac=_0x45a7ac-0x0;var _0x341ef6=_0x6434[_0x45a7ac];return _0x341ef6;};'use strict';var util=require('util');var db=require(_0x4643('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x4643('0x1')]({'name':util[_0x4643('0x2')](_0x4643('0x3'),_0x4643('0x4'),i),'fullname':util[_0x4643('0x2')](_0x4643('0x3'),_0x4643('0x4'),i),'email':util['format'](_0x4643('0x5'),_0x4643('0x4'),i),'role':'agent','password':_0x4643('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0x4643('0x7'),'ws',_0x4643('0x8')],'disallow':[_0x4643('0x9')],'allow':[_0x4643('0xa')],'defaultuser':util[_0x4643('0x2')](_0x4643('0x3'),'agent',i),'encryption':_0x4643('0xb'),'avpf':_0x4643('0xb'),'force_avp':_0x4643('0xb'),'icesupport':'yes','dtlsenable':_0x4643('0xb'),'dtlsverify':'no','dtlscertfile':_0x4643('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x4643('0xd'),'callerid':util['format'](_0x4643('0xe'),util[_0x4643('0x2')]('%s%s','agent',i),0xfa0+i)});}db[_0x4643('0xf')]['bulkCreate'](users)[_0x4643('0x10')](function(){console[_0x4643('0x11')](_0x4643('0x12'));})[_0x4643('0x13')](function(_0x472803){console[_0x4643('0x11')](_0x472803);}); \ No newline at end of file +var _0x905d=['/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','catch','log','../mysqldb','push','%s%s','agent','format','%s%s@xcally.com','password','friend','udp','wss','all','yes'];(function(_0x553457,_0x428a2c){var _0x3a49b1=function(_0x3d4302){while(--_0x3d4302){_0x553457['push'](_0x553457['shift']());}};_0x3a49b1(++_0x428a2c);}(_0x905d,0xd0));var _0xd905=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x905d[_0x2dafbe];return _0x58a45a;};'use strict';var util=require('util');var db=require(_0xd905('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xd905('0x1')]({'name':util['format'](_0xd905('0x2'),_0xd905('0x3'),i),'fullname':util[_0xd905('0x4')]('%s%s',_0xd905('0x3'),i),'email':util[_0xd905('0x4')](_0xd905('0x5'),_0xd905('0x3'),i),'role':_0xd905('0x3'),'password':_0xd905('0x6'),'internal':0xfa0+i,'type':_0xd905('0x7'),'transport':[_0xd905('0x8'),'ws',_0xd905('0x9')],'disallow':[_0xd905('0xa')],'allow':['ulaw'],'defaultuser':util[_0xd905('0x4')](_0xd905('0x2'),_0xd905('0x3'),i),'encryption':_0xd905('0xb'),'avpf':_0xd905('0xb'),'force_avp':_0xd905('0xb'),'icesupport':_0xd905('0xb'),'dtlsenable':_0xd905('0xb'),'dtlsverify':'no','dtlscertfile':_0xd905('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xd905('0xd'),'callerid':util[_0xd905('0x4')](_0xd905('0xe'),util[_0xd905('0x4')](_0xd905('0x2'),_0xd905('0x3'),i),0xfa0+i)});}db[_0xd905('0xf')][_0xd905('0x10')](users)[_0xd905('0x11')](function(){console['log']('add\x20user');})[_0xd905('0x12')](function(_0x55aecb){console[_0xd905('0x13')](_0x55aecb);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 7e59092..07d147d 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1fa9=['user_has_mail_interactions:remove','removeFaxInteractions','SmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','default','setMaxListeners','address','request','remoteAddress','connection','remotePort','connectedAt','nsp','DISCONNECTED','CONNECTED','lodash','bluebird','./environment','name','Agents','role','agent','telephone','ivr','UserProfileSection','findOne','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Trunks','IvrCampaigns','findAll','UserProfileResource','map','resourceId','User','Campaign','where','type','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','user','OpenchannelQueue','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','voice','chat','fax','sms','openchannel','whatsapp','trunk:%s','campaign:%s:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','removeMailInteractions'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1fa9,0x136));var _0x91fa=function(_0x5acfb0,_0x552144){_0x5acfb0=_0x5acfb0-0x0;var _0x498df3=_0x1fa9[_0x5acfb0];return _0x498df3;};'use strict';var _=require(_0x91fa('0x0'));var util=require('util');var BPromise=require(_0x91fa('0x1'));var db=require('../mysqldb')['db'];var config=require(_0x91fa('0x2'));var queryQueues={'attributes':['id',_0x91fa('0x3')],'include':[{'as':_0x91fa('0x4'),'model':db['User'],'attributes':['id',_0x91fa('0x3'),_0x91fa('0x5')],'raw':!![],'where':{'role':_0x91fa('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x91fa('0x3')],'where':{'role':_0x91fa('0x7')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x91fa('0x3')],'where':{'role':_0x91fa('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id','name','type'],'where':{'type':_0x91fa('0x8')}};function getAssociatedResources(_0x7ad4dd,_0xc87cf7,_0x34472a){return db[_0x91fa('0x9')][_0x91fa('0xa')]({'where':{'name':_0x7ad4dd,'userProfileId':_0xc87cf7},'raw':!![]})[_0x91fa('0xb')](function(_0x595295){if(_0x595295){if(_0x595295['autoAssociation']){switch(_0x7ad4dd){case _0x91fa('0xc'):case _0x91fa('0xd'):case _0x91fa('0xe'):case _0x91fa('0xf'):case _0x91fa('0x10'):case _0x91fa('0x11'):case _0x91fa('0x12'):return db[_0x34472a]['findAll'](queryQueues);case'Telephones':return db[_0x34472a]['findAll'](queryTelephones);case _0x91fa('0x13'):return db[_0x34472a]['findAll'](queryTrunks);case _0x91fa('0x14'):return db[_0x34472a][_0x91fa('0x15')](queryCampaigns);}}else{return db[_0x91fa('0x16')][_0x91fa('0x15')]({'attributes':['resourceId'],'where':{'sectionId':_0x595295['id']},'raw':!![]})[_0x91fa('0xb')](function(_0x252ec7){if(_0x252ec7){var _0x74c75d={'where':{'id':_[_0x91fa('0x17')](_0x252ec7,_0x91fa('0x18'))},'raw':!![]};switch(_0x34472a){case _0x91fa('0x19'):_0x74c75d['where'][_0x91fa('0x5')]=_0x91fa('0x7');break;case _0x91fa('0x1a'):_0x74c75d[_0x91fa('0x1b')][_0x91fa('0x1c')]='ivr';break;}return db[_0x34472a][_0x91fa('0x15')](_0x74c75d);}else{return[];}});}}else{return[];}})[_0x91fa('0xb')](function(_0x185fec){return _0x185fec;});}function joinOrLeaveQueues(_0x1e3d6f,_0xaaf2eb,_0x19b3a1,_0xb5109c){_0x1e3d6f[_0xaaf2eb](util[_0x91fa('0x1d')](_0x91fa('0x1e'),_0x19b3a1,_0xb5109c[_0x91fa('0x3')]));if(_0xb5109c[_0x91fa('0x4')]){for(var _0x4a8f08=0x0;_0x4a8f08<_0xb5109c[_0x91fa('0x4')][_0x91fa('0x1f')];_0x4a8f08+=0x1){_0x1e3d6f[_0xaaf2eb](util['format'](_0x91fa('0x20'),_0xb5109c['Agents'][_0x4a8f08][_0x91fa('0x3')]));}}}function joinOrLeave(_0x4c5ce3,_0x4e619c,_0x5d89f9){var _0x2ed86d;if(_0x4c5ce3[_0x91fa('0x21')][_0x91fa('0x22')]['id']){db[_0x91fa('0x19')][_0x91fa('0x23')]({'attributes':['id','name',_0x91fa('0x5'),_0x91fa('0x24')],'where':{'id':_0x4c5ce3[_0x91fa('0x21')][_0x91fa('0x22')]['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x91fa('0x25')],'as':_0x91fa('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x91fa('0x27')],'as':_0x91fa('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x91fa('0x29')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x91fa('0x2a')],'as':_0x91fa('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x91fa('0x2c')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x342670){if(_0x342670){_0x2ed86d=_0x342670;_0x4c5ce3[_0x4e619c](util[_0x91fa('0x1d')](_0x91fa('0x20'),_0x342670[_0x91fa('0x3')]));var _0xe18cbb=[];switch(_0x342670[_0x91fa('0x5')]){case _0x91fa('0x2d'):_0x4c5ce3[_0x4e619c](_0x91fa('0x2e'));_0x4c5ce3[_0x4e619c](_0x91fa('0x2f'));if(queryQueues[_0x91fa('0x30')](_0x91fa('0x31'))){delete queryQueues['include'];}_0xe18cbb['push'](db[_0x91fa('0x32')][_0x91fa('0x15')](queryQueues));_0xe18cbb[_0x91fa('0x33')](db[_0x91fa('0x34')][_0x91fa('0x15')](queryQueues));_0xe18cbb[_0x91fa('0x33')](db['FaxQueue'][_0x91fa('0x15')](queryQueues));_0xe18cbb[_0x91fa('0x33')](db[_0x91fa('0x35')][_0x91fa('0x15')](queryQueues));_0xe18cbb[_0x91fa('0x33')](db[_0x91fa('0x36')][_0x91fa('0x15')](queryQueues));_0xe18cbb[_0x91fa('0x33')](db['OpenchannelQueue']['findAll'](queryQueues));_0xe18cbb[_0x91fa('0x33')](db[_0x91fa('0x37')]['findAll'](queryQueues));_0xe18cbb[_0x91fa('0x33')](db['User']['findAll'](queryTelephones));_0xe18cbb[_0x91fa('0x33')](db[_0x91fa('0x38')][_0x91fa('0x15')](queryTrunks));_0xe18cbb['push'](db[_0x91fa('0x1a')][_0x91fa('0x15')](queryCampaigns));_0xe18cbb[_0x91fa('0x33')](db[_0x91fa('0x19')][_0x91fa('0x15')](queryAgents));break;case _0x91fa('0x39'):_0x4c5ce3[_0x4e619c](_0x91fa('0x2e'));_0x4c5ce3[_0x4e619c]('voice:outbound');_0xe18cbb[_0x91fa('0x33')](getAssociatedResources(_0x91fa('0xc'),_0x342670['userProfileId'],'VoiceQueue'));_0xe18cbb[_0x91fa('0x33')](getAssociatedResources(_0x91fa('0xd'),_0x342670['userProfileId'],_0x91fa('0x34')));_0xe18cbb[_0x91fa('0x33')](getAssociatedResources('FaxQueues',_0x342670[_0x91fa('0x24')],'FaxQueue'));_0xe18cbb['push'](getAssociatedResources(_0x91fa('0xf'),_0x342670[_0x91fa('0x24')],'SmsQueue'));_0xe18cbb[_0x91fa('0x33')](getAssociatedResources(_0x91fa('0x10'),_0x342670['userProfileId'],_0x91fa('0x36')));_0xe18cbb['push'](getAssociatedResources(_0x91fa('0x11'),_0x342670['userProfileId'],_0x91fa('0x3a')));_0xe18cbb['push'](getAssociatedResources(_0x91fa('0x12'),_0x342670[_0x91fa('0x24')],_0x91fa('0x37')));_0xe18cbb[_0x91fa('0x33')](getAssociatedResources('Telephones',_0x342670[_0x91fa('0x24')],_0x91fa('0x19')));_0xe18cbb[_0x91fa('0x33')](getAssociatedResources(_0x91fa('0x13'),_0x342670[_0x91fa('0x24')],_0x91fa('0x38')));_0xe18cbb['push'](getAssociatedResources(_0x91fa('0x14'),_0x342670['userProfileId'],_0x91fa('0x1a')));_0xe18cbb[_0x91fa('0x33')](db[_0x91fa('0x19')][_0x91fa('0x15')](queryAgents));break;case _0x91fa('0x6'):_0x4c5ce3[_0x4e619c](_0x91fa('0x2e'));_0x4c5ce3[_0x4e619c](_0x91fa('0x2f'));_0xe18cbb[_0x91fa('0x33')](_0x342670['getVoiceQueues']({'attributes':['id',_0x91fa('0x3')]}));_0xe18cbb['push'](_0x342670[_0x91fa('0x3b')]({'attributes':['id',_0x91fa('0x3')]}));_0xe18cbb[_0x91fa('0x33')](_0x342670[_0x91fa('0x3c')]({'attributes':['id',_0x91fa('0x3')]}));_0xe18cbb[_0x91fa('0x33')](_0x342670[_0x91fa('0x3d')]({'attributes':['id',_0x91fa('0x3')]}));_0xe18cbb[_0x91fa('0x33')](_0x342670[_0x91fa('0x3e')]({'attributes':['id',_0x91fa('0x3')]}));_0xe18cbb[_0x91fa('0x33')](_0x342670[_0x91fa('0x3f')]({'attributes':['id',_0x91fa('0x3')]}));_0xe18cbb[_0x91fa('0x33')](_0x342670['getWhatsappQueues']({'attributes':['id',_0x91fa('0x3')]}));break;}return BPromise[_0x91fa('0x40')](_0xe18cbb);}})[_0x91fa('0xb')](function(_0x2b9ba9){if(_0x2b9ba9&&_0x2b9ba9[_0x91fa('0x1f')]){for(var _0x3b4d60=0x0;_0x3b4d60<_0x2b9ba9[_0x91fa('0x1f')];_0x3b4d60+=0x1){for(var _0x364957=0x0;_0x364957<_0x2b9ba9[_0x3b4d60][_0x91fa('0x1f')];_0x364957+=0x1){switch(_0x3b4d60){case 0x0:joinOrLeaveQueues(_0x4c5ce3,_0x4e619c,_0x91fa('0x41'),_0x2b9ba9[_0x3b4d60][_0x364957]);break;case 0x1:joinOrLeaveQueues(_0x4c5ce3,_0x4e619c,_0x91fa('0x42'),_0x2b9ba9[_0x3b4d60][_0x364957]);break;case 0x2:joinOrLeaveQueues(_0x4c5ce3,_0x4e619c,_0x91fa('0x43'),_0x2b9ba9[_0x3b4d60][_0x364957]);break;case 0x3:joinOrLeaveQueues(_0x4c5ce3,_0x4e619c,_0x91fa('0x44'),_0x2b9ba9[_0x3b4d60][_0x364957]);break;case 0x4:joinOrLeaveQueues(_0x4c5ce3,_0x4e619c,'mail',_0x2b9ba9[_0x3b4d60][_0x364957]);break;case 0x5:joinOrLeaveQueues(_0x4c5ce3,_0x4e619c,_0x91fa('0x45'),_0x2b9ba9[_0x3b4d60][_0x364957]);break;case 0x6:joinOrLeaveQueues(_0x4c5ce3,_0x4e619c,_0x91fa('0x46'),_0x2b9ba9[_0x3b4d60][_0x364957]);break;case 0x7:if(_0x2ed86d[_0x91fa('0x5')]!==_0x91fa('0x6'))_0x4c5ce3[_0x4e619c](util[_0x91fa('0x1d')]('telephone:%s',_0x2b9ba9[_0x3b4d60][_0x364957][_0x91fa('0x3')]));break;case 0x8:if(_0x2ed86d['role']!==_0x91fa('0x6'))_0x4c5ce3[_0x4e619c](util[_0x91fa('0x1d')](_0x91fa('0x47'),_0x2b9ba9[_0x3b4d60][_0x364957][_0x91fa('0x3')]));break;case 0x9:if(_0x2ed86d[_0x91fa('0x5')]!==_0x91fa('0x6'))_0x4c5ce3[_0x4e619c](util[_0x91fa('0x1d')](_0x91fa('0x48'),_0x2b9ba9[_0x3b4d60][_0x364957][_0x91fa('0x1c')],_0x2b9ba9[_0x3b4d60][_0x364957][_0x91fa('0x3')]));break;case 0xa:_0x4c5ce3[_0x4e619c](util[_0x91fa('0x1d')]('user:%s',_0x2b9ba9[_0x3b4d60][_0x364957][_0x91fa('0x3')]));break;}}}}})['then'](function(){if(_0x4e619c==='leave'){var _0x5c9949=_['map'](_0x2ed86d['ChatInteractions'],'id');return _0x2ed86d[_0x91fa('0x49')](_0x5c9949)[_0x91fa('0xb')](function(){for(var _0x15b9e0=0x0;_0x15b9e0<_0x5c9949[_0x91fa('0x1f')];_0x15b9e0+=0x1){_0x5d89f9[_0x91fa('0x4a')](_0x91fa('0x4b'),{'ChatInteractionId':Number(_0x5c9949[_0x15b9e0]),'UserId':Number(_0x2ed86d['id'])});}});}})[_0x91fa('0xb')](function(){if(_0x4e619c===_0x91fa('0x4c')){var _0x4e3251=_['map'](_0x2ed86d['MailInteractions'],'id');return _0x2ed86d[_0x91fa('0x4d')](_0x4e3251)[_0x91fa('0xb')](function(){for(var _0x5966e0=0x0;_0x5966e0<_0x4e3251[_0x91fa('0x1f')];_0x5966e0+=0x1){_0x5d89f9[_0x91fa('0x4a')](_0x91fa('0x4e'),{'MailInteractionId':Number(_0x4e3251[_0x5966e0]),'UserId':Number(_0x2ed86d['id'])});}});}})['then'](function(){if(_0x4e619c===_0x91fa('0x4c')){var _0x5b5992=_[_0x91fa('0x17')](_0x2ed86d[_0x91fa('0x28')],'id');return _0x2ed86d[_0x91fa('0x4f')](_0x5b5992)[_0x91fa('0xb')](function(){for(var _0x439b4b=0x0;_0x439b4b<_0x5b5992[_0x91fa('0x1f')];_0x439b4b+=0x1){_0x5d89f9['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x5b5992[_0x439b4b]),'UserId':Number(_0x2ed86d['id'])});}});}})[_0x91fa('0xb')](function(){if(_0x4e619c===_0x91fa('0x4c')){var _0x344418=_[_0x91fa('0x17')](_0x2ed86d[_0x91fa('0x50')],'id');return _0x2ed86d['removeSmsInteractions'](_0x344418)[_0x91fa('0xb')](function(){for(var _0x4358e5=0x0;_0x4358e5<_0x344418[_0x91fa('0x1f')];_0x4358e5+=0x1){_0x5d89f9[_0x91fa('0x4a')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x344418[_0x4358e5]),'UserId':Number(_0x2ed86d['id'])});}});}})[_0x91fa('0xb')](function(){if(_0x4e619c===_0x91fa('0x4c')){var _0x12cadd=_[_0x91fa('0x17')](_0x2ed86d[_0x91fa('0x2b')],'id');return _0x2ed86d[_0x91fa('0x51')](_0x12cadd)[_0x91fa('0xb')](function(){for(var _0x17e613=0x0;_0x17e613<_0x12cadd['length'];_0x17e613+=0x1){_0x5d89f9['emit'](_0x91fa('0x52'),{'OpenchannelInteractionId':Number(_0x12cadd[_0x17e613]),'UserId':Number(_0x2ed86d['id'])});}});}})['then'](function(){if(_0x4e619c===_0x91fa('0x4c')){var _0x3db7d5=_[_0x91fa('0x17')](_0x2ed86d['WhatsappInteractions'],'id');return _0x2ed86d[_0x91fa('0x53')](_0x3db7d5)[_0x91fa('0xb')](function(){for(var _0x24340b=0x0;_0x24340b<_0x3db7d5[_0x91fa('0x1f')];_0x24340b+=0x1){_0x5d89f9[_0x91fa('0x4a')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x3db7d5[_0x24340b]),'UserId':Number(_0x2ed86d['id'])});}});}})[_0x91fa('0x54')](function(_0x54178f){_0x4c5ce3[_0x91fa('0x55')](_0x54178f);});}}function onDisconnect(_0x6ed013,_0x5052cc){joinOrLeave(_0x6ed013,'leave',_0x5052cc);}function onConnect(_0x4c9c94){joinOrLeave(_0x4c9c94,'join');}exports[_0x91fa('0x56')]=function(_0x4c204c){_0x4c204c['on']('connection',function(_0x18ec08){_0x18ec08[_0x91fa('0x57')](0x0);_0x18ec08[_0x91fa('0x58')]=_0x18ec08[_0x91fa('0x59')]['connection'][_0x91fa('0x5a')]+':'+_0x18ec08[_0x91fa('0x59')][_0x91fa('0x5b')][_0x91fa('0x5c')];_0x18ec08[_0x91fa('0x5d')]=new Date();_0x18ec08[_0x91fa('0x55')]=function(_0x491f58){console[_0x91fa('0x55')]('SocketIO\x20'+_0x18ec08[_0x91fa('0x5e')][_0x91fa('0x3')]+'['+_0x18ec08[_0x91fa('0x58')]+']',_0x491f58);};_0x18ec08['on']('disconnect',function(){onDisconnect(_0x18ec08,_0x4c204c);_0x18ec08['log'](_0x91fa('0x5f'));});onConnect(_0x18ec08);_0x18ec08[_0x91fa('0x55')](_0x91fa('0x60'));});}; \ No newline at end of file +var _0x7939=['query','User','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','user','voice:inbound','OpenchannelQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','telephone:%s','trunk:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','emit','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','join','default','connection','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','address','disconnect','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','./environment','name','role','agent','telephone','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','format','%s:queue:%s','Agents','length','handshake'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x7939,0x11c));var _0x9793=function(_0x2b2376,_0x5e8f2f){_0x2b2376=_0x2b2376-0x0;var _0x5d04ea=_0x7939[_0x2b2376];return _0x5d04ea;};'use strict';var _=require('lodash');var util=require(_0x9793('0x0'));var BPromise=require(_0x9793('0x1'));var db=require(_0x9793('0x2'))['db'];var config=require(_0x9793('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db['User'],'attributes':['id',_0x9793('0x4'),_0x9793('0x5')],'raw':!![],'where':{'role':_0x9793('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x9793('0x4')],'where':{'role':_0x9793('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x9793('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x9793('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x9793('0x4'),_0x9793('0x8')],'where':{'type':_0x9793('0x9')}};function getAssociatedResources(_0x2a9b7c,_0x4e5923,_0x3901f3){return db['UserProfileSection'][_0x9793('0xa')]({'where':{'name':_0x2a9b7c,'userProfileId':_0x4e5923},'raw':!![]})[_0x9793('0xb')](function(_0x5ea2e2){if(_0x5ea2e2){if(_0x5ea2e2[_0x9793('0xc')]){switch(_0x2a9b7c){case _0x9793('0xd'):case _0x9793('0xe'):case _0x9793('0xf'):case _0x9793('0x10'):case'MailQueues':case'OpenchannelQueues':case _0x9793('0x11'):return db[_0x3901f3][_0x9793('0x12')](queryQueues);case _0x9793('0x13'):return db[_0x3901f3][_0x9793('0x12')](queryTelephones);case _0x9793('0x14'):return db[_0x3901f3][_0x9793('0x12')](queryTrunks);case _0x9793('0x15'):return db[_0x3901f3][_0x9793('0x12')](queryCampaigns);}}else{return db[_0x9793('0x16')][_0x9793('0x12')]({'attributes':[_0x9793('0x17')],'where':{'sectionId':_0x5ea2e2['id']},'raw':!![]})[_0x9793('0xb')](function(_0x4f0d68){if(_0x4f0d68){var _0x277e9b={'where':{'id':_[_0x9793('0x18')](_0x4f0d68,'resourceId')},'raw':!![]};switch(_0x3901f3){case'User':_0x277e9b[_0x9793('0x19')]['role']=_0x9793('0x7');break;case'Campaign':_0x277e9b[_0x9793('0x19')][_0x9793('0x8')]=_0x9793('0x9');break;}return db[_0x3901f3]['findAll'](_0x277e9b);}else{return[];}});}}else{return[];}})['then'](function(_0x2d6656){return _0x2d6656;});}function joinOrLeaveQueues(_0x53aa43,_0x5407c5,_0x369f5e,_0x4d1769){_0x53aa43[_0x5407c5](util[_0x9793('0x1a')](_0x9793('0x1b'),_0x369f5e,_0x4d1769[_0x9793('0x4')]));if(_0x4d1769[_0x9793('0x1c')]){for(var _0x23b51e=0x0;_0x23b51e<_0x4d1769['Agents'][_0x9793('0x1d')];_0x23b51e+=0x1){_0x53aa43[_0x5407c5](util[_0x9793('0x1a')]('user:%s',_0x4d1769[_0x9793('0x1c')][_0x23b51e]['name']));}}}function joinOrLeave(_0x3054ec,_0x1f079d,_0x566c92){var _0x4eacb2;if(_0x3054ec[_0x9793('0x1e')][_0x9793('0x1f')]['id']){db[_0x9793('0x20')]['find']({'attributes':['id',_0x9793('0x4'),_0x9793('0x5'),_0x9793('0x21')],'where':{'id':_0x3054ec[_0x9793('0x1e')][_0x9793('0x1f')]['id']},'include':[{'model':db[_0x9793('0x22')],'as':_0x9793('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x9793('0x24')],'as':_0x9793('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x9793('0x26')],'as':_0x9793('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x9793('0x28')],'as':_0x9793('0x29'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x9793('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x9793('0x2b')],'as':_0x9793('0x2c'),'attributes':['id'],'raw':!![]}]})[_0x9793('0xb')](function(_0x481e8a){if(_0x481e8a){_0x4eacb2=_0x481e8a;_0x3054ec[_0x1f079d](util[_0x9793('0x1a')](_0x9793('0x2d'),_0x481e8a['name']));var _0x3048d8=[];switch(_0x481e8a[_0x9793('0x5')]){case _0x9793('0x2e'):_0x3054ec[_0x1f079d]('voice:inbound');_0x3054ec[_0x1f079d](_0x9793('0x2f'));if(queryQueues[_0x9793('0x30')](_0x9793('0x31'))){delete queryQueues['include'];}_0x3048d8[_0x9793('0x32')](db[_0x9793('0x33')]['findAll'](queryQueues));_0x3048d8[_0x9793('0x32')](db[_0x9793('0x34')]['findAll'](queryQueues));_0x3048d8[_0x9793('0x32')](db[_0x9793('0x35')][_0x9793('0x12')](queryQueues));_0x3048d8[_0x9793('0x32')](db[_0x9793('0x36')][_0x9793('0x12')](queryQueues));_0x3048d8[_0x9793('0x32')](db[_0x9793('0x37')][_0x9793('0x12')](queryQueues));_0x3048d8[_0x9793('0x32')](db[_0x9793('0x38')][_0x9793('0x12')](queryQueues));_0x3048d8['push'](db[_0x9793('0x39')][_0x9793('0x12')](queryQueues));_0x3048d8[_0x9793('0x32')](db['User']['findAll'](queryTelephones));_0x3048d8['push'](db[_0x9793('0x3a')]['findAll'](queryTrunks));_0x3048d8[_0x9793('0x32')](db[_0x9793('0x3b')][_0x9793('0x12')](queryCampaigns));_0x3048d8[_0x9793('0x32')](db[_0x9793('0x20')][_0x9793('0x12')](queryAgents));break;case _0x9793('0x3c'):_0x3054ec[_0x1f079d](_0x9793('0x3d'));_0x3054ec[_0x1f079d]('voice:outbound');_0x3048d8[_0x9793('0x32')](getAssociatedResources(_0x9793('0xd'),_0x481e8a[_0x9793('0x21')],_0x9793('0x33')));_0x3048d8[_0x9793('0x32')](getAssociatedResources('ChatQueues',_0x481e8a['userProfileId'],_0x9793('0x34')));_0x3048d8[_0x9793('0x32')](getAssociatedResources(_0x9793('0xf'),_0x481e8a[_0x9793('0x21')],_0x9793('0x35')));_0x3048d8[_0x9793('0x32')](getAssociatedResources('SmsQueues',_0x481e8a[_0x9793('0x21')],_0x9793('0x36')));_0x3048d8[_0x9793('0x32')](getAssociatedResources('MailQueues',_0x481e8a[_0x9793('0x21')],'MailQueue'));_0x3048d8[_0x9793('0x32')](getAssociatedResources(_0x9793('0x3e'),_0x481e8a['userProfileId'],'OpenchannelQueue'));_0x3048d8[_0x9793('0x32')](getAssociatedResources(_0x9793('0x11'),_0x481e8a[_0x9793('0x21')],_0x9793('0x39')));_0x3048d8['push'](getAssociatedResources(_0x9793('0x13'),_0x481e8a['userProfileId'],'User'));_0x3048d8[_0x9793('0x32')](getAssociatedResources(_0x9793('0x14'),_0x481e8a['userProfileId'],'Trunk'));_0x3048d8[_0x9793('0x32')](getAssociatedResources(_0x9793('0x15'),_0x481e8a[_0x9793('0x21')],_0x9793('0x3b')));_0x3048d8['push'](db[_0x9793('0x20')]['findAll'](queryAgents));break;case _0x9793('0x6'):_0x3054ec[_0x1f079d](_0x9793('0x3d'));_0x3054ec[_0x1f079d](_0x9793('0x2f'));_0x3048d8[_0x9793('0x32')](_0x481e8a[_0x9793('0x3f')]({'attributes':['id',_0x9793('0x4')]}));_0x3048d8[_0x9793('0x32')](_0x481e8a[_0x9793('0x40')]({'attributes':['id',_0x9793('0x4')]}));_0x3048d8[_0x9793('0x32')](_0x481e8a[_0x9793('0x41')]({'attributes':['id','name']}));_0x3048d8[_0x9793('0x32')](_0x481e8a[_0x9793('0x42')]({'attributes':['id',_0x9793('0x4')]}));_0x3048d8['push'](_0x481e8a[_0x9793('0x43')]({'attributes':['id',_0x9793('0x4')]}));_0x3048d8[_0x9793('0x32')](_0x481e8a[_0x9793('0x44')]({'attributes':['id','name']}));_0x3048d8[_0x9793('0x32')](_0x481e8a[_0x9793('0x45')]({'attributes':['id','name']}));break;}return BPromise[_0x9793('0x46')](_0x3048d8);}})['then'](function(_0xe4171c){if(_0xe4171c&&_0xe4171c['length']){for(var _0x6c8092=0x0;_0x6c8092<_0xe4171c[_0x9793('0x1d')];_0x6c8092+=0x1){for(var _0x1c9d48=0x0;_0x1c9d48<_0xe4171c[_0x6c8092][_0x9793('0x1d')];_0x1c9d48+=0x1){switch(_0x6c8092){case 0x0:joinOrLeaveQueues(_0x3054ec,_0x1f079d,_0x9793('0x47'),_0xe4171c[_0x6c8092][_0x1c9d48]);break;case 0x1:joinOrLeaveQueues(_0x3054ec,_0x1f079d,_0x9793('0x48'),_0xe4171c[_0x6c8092][_0x1c9d48]);break;case 0x2:joinOrLeaveQueues(_0x3054ec,_0x1f079d,_0x9793('0x49'),_0xe4171c[_0x6c8092][_0x1c9d48]);break;case 0x3:joinOrLeaveQueues(_0x3054ec,_0x1f079d,_0x9793('0x4a'),_0xe4171c[_0x6c8092][_0x1c9d48]);break;case 0x4:joinOrLeaveQueues(_0x3054ec,_0x1f079d,_0x9793('0x4b'),_0xe4171c[_0x6c8092][_0x1c9d48]);break;case 0x5:joinOrLeaveQueues(_0x3054ec,_0x1f079d,'openchannel',_0xe4171c[_0x6c8092][_0x1c9d48]);break;case 0x6:joinOrLeaveQueues(_0x3054ec,_0x1f079d,'whatsapp',_0xe4171c[_0x6c8092][_0x1c9d48]);break;case 0x7:if(_0x4eacb2['role']!=='agent')_0x3054ec[_0x1f079d](util[_0x9793('0x1a')](_0x9793('0x4c'),_0xe4171c[_0x6c8092][_0x1c9d48]['name']));break;case 0x8:if(_0x4eacb2[_0x9793('0x5')]!==_0x9793('0x6'))_0x3054ec[_0x1f079d](util[_0x9793('0x1a')](_0x9793('0x4d'),_0xe4171c[_0x6c8092][_0x1c9d48][_0x9793('0x4')]));break;case 0x9:if(_0x4eacb2['role']!=='agent')_0x3054ec[_0x1f079d](util[_0x9793('0x1a')]('campaign:%s:%s',_0xe4171c[_0x6c8092][_0x1c9d48]['type'],_0xe4171c[_0x6c8092][_0x1c9d48][_0x9793('0x4')]));break;case 0xa:_0x3054ec[_0x1f079d](util[_0x9793('0x1a')]('user:%s',_0xe4171c[_0x6c8092][_0x1c9d48][_0x9793('0x4')]));break;}}}}})[_0x9793('0xb')](function(){if(_0x1f079d===_0x9793('0x4e')){var _0x2445fa=_['map'](_0x4eacb2[_0x9793('0x23')],'id');return _0x4eacb2[_0x9793('0x4f')](_0x2445fa)[_0x9793('0xb')](function(){for(var _0x3ca143=0x0;_0x3ca143<_0x2445fa[_0x9793('0x1d')];_0x3ca143+=0x1){_0x566c92['emit'](_0x9793('0x50'),{'ChatInteractionId':Number(_0x2445fa[_0x3ca143]),'UserId':Number(_0x4eacb2['id'])});}});}})[_0x9793('0xb')](function(){if(_0x1f079d===_0x9793('0x4e')){var _0xed9987=_['map'](_0x4eacb2['MailInteractions'],'id');return _0x4eacb2[_0x9793('0x51')](_0xed9987)[_0x9793('0xb')](function(){for(var _0xb15e63=0x0;_0xb15e63<_0xed9987['length'];_0xb15e63+=0x1){_0x566c92['emit'](_0x9793('0x52'),{'MailInteractionId':Number(_0xed9987[_0xb15e63]),'UserId':Number(_0x4eacb2['id'])});}});}})[_0x9793('0xb')](function(){if(_0x1f079d===_0x9793('0x4e')){var _0x3dbf43=_['map'](_0x4eacb2[_0x9793('0x27')],'id');return _0x4eacb2[_0x9793('0x53')](_0x3dbf43)[_0x9793('0xb')](function(){for(var _0x2298c6=0x0;_0x2298c6<_0x3dbf43['length'];_0x2298c6+=0x1){_0x566c92['emit'](_0x9793('0x54'),{'FaxInteractionId':Number(_0x3dbf43[_0x2298c6]),'UserId':Number(_0x4eacb2['id'])});}});}})[_0x9793('0xb')](function(){if(_0x1f079d===_0x9793('0x4e')){var _0x40c043=_['map'](_0x4eacb2['SmsInteractions'],'id');return _0x4eacb2[_0x9793('0x55')](_0x40c043)[_0x9793('0xb')](function(){for(var _0x1ffe3d=0x0;_0x1ffe3d<_0x40c043[_0x9793('0x1d')];_0x1ffe3d+=0x1){_0x566c92[_0x9793('0x56')](_0x9793('0x57'),{'SmsInteractionId':Number(_0x40c043[_0x1ffe3d]),'UserId':Number(_0x4eacb2['id'])});}});}})[_0x9793('0xb')](function(){if(_0x1f079d==='leave'){var _0x1d6f8b=_[_0x9793('0x18')](_0x4eacb2['OpenchannelInteractions'],'id');return _0x4eacb2[_0x9793('0x58')](_0x1d6f8b)[_0x9793('0xb')](function(){for(var _0x43e872=0x0;_0x43e872<_0x1d6f8b[_0x9793('0x1d')];_0x43e872+=0x1){_0x566c92[_0x9793('0x56')](_0x9793('0x59'),{'OpenchannelInteractionId':Number(_0x1d6f8b[_0x43e872]),'UserId':Number(_0x4eacb2['id'])});}});}})['then'](function(){if(_0x1f079d===_0x9793('0x4e')){var _0x3572db=_[_0x9793('0x18')](_0x4eacb2[_0x9793('0x2c')],'id');return _0x4eacb2[_0x9793('0x5a')](_0x3572db)[_0x9793('0xb')](function(){for(var _0x4fd474=0x0;_0x4fd474<_0x3572db[_0x9793('0x1d')];_0x4fd474+=0x1){_0x566c92[_0x9793('0x56')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x3572db[_0x4fd474]),'UserId':Number(_0x4eacb2['id'])});}});}})['catch'](function(_0x31fad5){_0x3054ec['log'](_0x31fad5);});}}function onDisconnect(_0x3cccfa,_0x14bcba){joinOrLeave(_0x3cccfa,_0x9793('0x4e'),_0x14bcba);}function onConnect(_0x37e70b){joinOrLeave(_0x37e70b,_0x9793('0x5b'));}exports[_0x9793('0x5c')]=function(_0x643d8){_0x643d8['on'](_0x9793('0x5d'),function(_0x1f5b60){_0x1f5b60['setMaxListeners'](0x0);_0x1f5b60['address']=_0x1f5b60[_0x9793('0x5e')]['connection'][_0x9793('0x5f')]+':'+_0x1f5b60[_0x9793('0x5e')][_0x9793('0x5d')][_0x9793('0x60')];_0x1f5b60[_0x9793('0x61')]=new Date();_0x1f5b60['log']=function(_0x23dccc){console[_0x9793('0x62')](_0x9793('0x63')+_0x1f5b60[_0x9793('0x64')][_0x9793('0x4')]+'['+_0x1f5b60[_0x9793('0x65')]+']',_0x23dccc);};_0x1f5b60['on'](_0x9793('0x66'),function(){onDisconnect(_0x1f5b60,_0x643d8);_0x1f5b60[_0x9793('0x62')](_0x9793('0x67'));});onConnect(_0x1f5b60);_0x1f5b60[_0x9793('0x62')](_0x9793('0x68'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 79ce9b8..307a8d3 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 _0xff47=['resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','UserId','interface','format','SIP/%s','name','agent','incomingmessage','outgoingmessage','event','opened','changed','closed','substatus','query','contact','AfterUpdate','fullname','email','internal','length','hasOwnProperty','model','callback','toLowerCase','util','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','SmsInteraction','Sms','closedinteraction','SmsMessage','newmessage','Whatsapp','WhatsappInteraction','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','Trigger,\x20%s','error','code','catch','get','channel','motionChannel'];(function(_0x4b9652,_0x2de633){var _0x539f82=function(_0x53d7c3){while(--_0x53d7c3){_0x4b9652['push'](_0x4b9652['shift']());}};_0x539f82(++_0x2de633);}(_0xff47,0x174));var _0x7ff4=function(_0x108c5b,_0x52c0fb){_0x108c5b=_0x108c5b-0x0;var _0x2afb52=_0xff47[_0x108c5b];return _0x2afb52;};'use strict';var util=require(_0x7ff4('0x0'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var logger=require(_0x7ff4('0x1'))(_0x7ff4('0x2'));var client=jayson[_0x7ff4('0x3')][_0x7ff4('0x4')]({'port':0x232a});var triggers=[{'channel':_0x7ff4('0x5'),'model':_0x7ff4('0x6'),'event':_0x7ff4('0x7'),'condition':_0x7ff4('0x8'),'callback':afterCreate},{'channel':_0x7ff4('0x5'),'model':_0x7ff4('0x6'),'event':_0x7ff4('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x7ff4('0x5'),'model':'ChatMessage','event':_0x7ff4('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Sms','model':_0x7ff4('0xa'),'event':_0x7ff4('0x7'),'condition':_0x7ff4('0x8'),'callback':afterCreate},{'channel':_0x7ff4('0xb'),'model':_0x7ff4('0xa'),'event':_0x7ff4('0x9'),'condition':_0x7ff4('0xc'),'callback':afterUpdate},{'channel':_0x7ff4('0xb'),'model':_0x7ff4('0xd'),'event':_0x7ff4('0x7'),'condition':_0x7ff4('0xe'),'callback':afterCreateMessage},{'channel':_0x7ff4('0xf'),'model':_0x7ff4('0x10'),'event':_0x7ff4('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x7ff4('0xf'),'model':'WhatsappInteraction','event':'afterUpdate','condition':_0x7ff4('0xc'),'callback':afterUpdate},{'channel':_0x7ff4('0xf'),'model':'WhatsappMessage','event':_0x7ff4('0x7'),'condition':_0x7ff4('0xe'),'callback':afterCreateMessage},{'channel':_0x7ff4('0x11'),'model':'FaxInteraction','event':_0x7ff4('0x7'),'condition':_0x7ff4('0x8'),'callback':afterCreate},{'channel':_0x7ff4('0x11'),'model':_0x7ff4('0x12'),'event':'afterUpdate','condition':_0x7ff4('0xc'),'callback':afterUpdate},{'channel':_0x7ff4('0x11'),'model':_0x7ff4('0x13'),'event':_0x7ff4('0x7'),'condition':_0x7ff4('0xe'),'callback':afterCreateMessage},{'channel':_0x7ff4('0x14'),'model':_0x7ff4('0x15'),'event':'afterCreate','condition':_0x7ff4('0x8'),'callback':afterCreate},{'channel':_0x7ff4('0x14'),'model':_0x7ff4('0x15'),'event':_0x7ff4('0x9'),'condition':_0x7ff4('0xc'),'callback':afterUpdate},{'channel':_0x7ff4('0x14'),'model':_0x7ff4('0x16'),'event':_0x7ff4('0x7'),'condition':_0x7ff4('0xe'),'callback':afterCreateMessage},{'channel':_0x7ff4('0x17'),'model':_0x7ff4('0x18'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x7ff4('0x17'),'model':'OpenchannelInteraction','event':_0x7ff4('0x9'),'condition':_0x7ff4('0xc'),'callback':afterUpdate},{'channel':'Openchannel','model':_0x7ff4('0x19'),'event':_0x7ff4('0x7'),'condition':_0x7ff4('0xe'),'callback':afterCreateMessage}];function request(_0x34b5c8){return client[_0x7ff4('0x1a')](_0x7ff4('0x1b'),_0x34b5c8)[_0x7ff4('0x1c')](function(_0x5e4582){logger['info'](_0x7ff4('0x1d'),_0x7ff4('0x1b'),_0x5e4582);if(_0x5e4582[_0x7ff4('0x1e')]){if(_0x5e4582[_0x7ff4('0x1e')][_0x7ff4('0x1f')]===0x1f4){logger[_0x7ff4('0x1e')](_0x7ff4('0x1d'),_0x7ff4('0x1b'),_0x5e4582['error']);}}})[_0x7ff4('0x20')](function(_0x161f04){logger[_0x7ff4('0x1e')](_0x7ff4('0x1d'),'EventManager',_0x161f04);});}function afterCreateMessage(_0x3ac480){return function(_0x237f80){_0x237f80=_0x237f80[_0x7ff4('0x21')]({'plain':!![]});_0x237f80[_0x7ff4('0x22')]=_0x3ac480;_0x237f80[_0x7ff4('0x23')]=_0x3ac480;_0x237f80['event']=_0x237f80['direction'];Promise[_0x7ff4('0x24')]()['then'](function(){if(typeof _0x237f80[_0x7ff4('0x25')]===_0x7ff4('0x26'))return null;var _0x36471d=_0x7ff4('0x27')+_0x237f80[_0x7ff4('0x25')];return db[_0x7ff4('0x28')]['query'](_0x36471d,{'type':db[_0x7ff4('0x29')][_0x7ff4('0x2a')][_0x7ff4('0x2b')],'raw':!![]});})[_0x7ff4('0x1c')](function(_0x2ea31b){if(_0x2ea31b){_0x237f80['contact']=_0x2ea31b[0x0];}if(typeof _0x237f80[_0x7ff4('0x2c')]===_0x7ff4('0x26'))return;return getAgent(_0x237f80[_0x7ff4('0x2c')]);})[_0x7ff4('0x1c')](function(_0xbe3df4){if(_0xbe3df4){_0x237f80[_0x7ff4('0x2d')]=util[_0x7ff4('0x2e')](_0x7ff4('0x2f'),_0xbe3df4[_0x7ff4('0x30')]);_0x237f80[_0x7ff4('0x31')]=_0xbe3df4;_0x237f80[_0x7ff4('0x22')]=_0x3ac480;return request({'event':_0x7ff4('0x32'),'message':_0x237f80});}else{return request({'event':_0x7ff4('0x33'),'message':_0x237f80});}})[_0x7ff4('0x20')](function(_0x19072e){logger[_0x7ff4('0x1e')](_0x7ff4('0x1d'),'AfterCreateMessage',_0x19072e);});};}function afterCreate(_0x523f06,_0x4957a3){return function(_0x9a6e18){_0x9a6e18=_0x9a6e18[_0x7ff4('0x21')]({'plain':!![]});_0x9a6e18[_0x7ff4('0x22')]=_0x523f06;_0x9a6e18['motionChannel']=_0x523f06;_0x9a6e18[_0x7ff4('0x34')]=_0x7ff4('0x35');Promise[_0x7ff4('0x24')]()[_0x7ff4('0x1c')](function(){var _0x1e0608=_0x7ff4('0x27')+_0x9a6e18['ContactId'];return db['sequelize']['query'](_0x1e0608,{'type':db[_0x7ff4('0x29')]['QueryTypes']['SELECT'],'raw':!![]});})[_0x7ff4('0x1c')](function(_0x51ab91){if(_0x51ab91){_0x9a6e18['contact']=_0x51ab91[0x0];}if(typeof _0x9a6e18[_0x7ff4('0x2c')]===_0x7ff4('0x26'))return;return getAgent(_0x9a6e18[_0x7ff4('0x2c')]);})[_0x7ff4('0x1c')](function(_0x2cdbf4){if(_0x2cdbf4){_0x9a6e18['interface']=util['format'](_0x7ff4('0x2f'),_0x2cdbf4[_0x7ff4('0x30')]);_0x9a6e18[_0x7ff4('0x31')]=_0x2cdbf4;}return request({'event':_0x4957a3,'message':_0x9a6e18});})[_0x7ff4('0x20')](function(_0x3dbdc5){logger[_0x7ff4('0x1e')](_0x7ff4('0x1d'),'AfterCreate',_0x3dbdc5);});};}function afterUpdate(_0x5ab6ce){return function(_0x49b50d){var _0x62bd85=_0x49b50d[_0x7ff4('0x36')](_0x7ff4('0x37'))&&_0x49b50d[_0x7ff4('0x37')];var _0x2cb060=_0x49b50d[_0x7ff4('0x36')](_0x7ff4('0x38'));if(_0x62bd85||_0x2cb060){var _0x359d23=_0x62bd85?'closedinteraction':_0x7ff4('0x38');var _0x272ff6=_0x49b50d['get']({'plain':!![]});_0x272ff6[_0x7ff4('0x22')]=_0x5ab6ce;_0x272ff6[_0x7ff4('0x23')]=_0x5ab6ce;_0x272ff6[_0x7ff4('0x34')]=_0x62bd85?_0x7ff4('0x37'):_0x7ff4('0x38');var _0x1158a6=_0x7ff4('0x27')+_0x272ff6[_0x7ff4('0x25')];return db[_0x7ff4('0x28')][_0x7ff4('0x39')](_0x1158a6,{'type':db[_0x7ff4('0x29')][_0x7ff4('0x2a')][_0x7ff4('0x2b')],'raw':!![]})['then'](function(_0x2be324){if(_0x2be324){_0x272ff6[_0x7ff4('0x3a')]=_0x2be324[0x0];}if(typeof _0x272ff6[_0x7ff4('0x2c')]===_0x7ff4('0x26'))return;return getAgent(_0x272ff6['UserId']);})[_0x7ff4('0x1c')](function(_0x5eedcc){if(_0x5eedcc){_0x272ff6[_0x7ff4('0x2d')]=util['format'](_0x7ff4('0x2f'),_0x5eedcc['name']);_0x272ff6[_0x7ff4('0x31')]=_0x5eedcc;}return request({'event':_0x359d23,'message':_0x272ff6});})[_0x7ff4('0x20')](function(_0x403d32){logger['error'](_0x7ff4('0x1d'),_0x7ff4('0x3b'),_0x403d32);});}};}function getAgent(_0x41ff20){return db['User']['find']({'where':{'id':_0x41ff20},'attributes':['id',_0x7ff4('0x30'),_0x7ff4('0x3c'),_0x7ff4('0x3d'),_0x7ff4('0x3e')],'raw':!![]})[_0x7ff4('0x1c')](function(_0x511ea6){return _0x511ea6;});}exports['default']=function(){for(var _0x5c6e73=0x0;_0x5c6e73=_0xd4aeab[_0xe418('0x11')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x343ecc(_0x2a9ec5);})[_0xe418('0x12')](function(_0x45acce){_0x3fea22(_0x45acce);});});}; \ No newline at end of file +var _0x9a6e=['isUndefined','getLicense','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','./license/util','voice','mail','chat','fax','sms','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser'];(function(_0x296809,_0x1c9665){var _0x18c0d3=function(_0x249156){while(--_0x249156){_0x296809['push'](_0x296809['shift']());}};_0x18c0d3(++_0x1c9665);}(_0x9a6e,0x106));var _0xe9a6=function(_0x1c97c8,_0x28d564){_0x1c97c8=_0x1c97c8-0x0;var _0x2c096d=_0x9a6e[_0x1c97c8];return _0x2c096d;};'use strict';var _=require(_0xe9a6('0x0'));var BPromise=require(_0xe9a6('0x1'));var db=require('../mysqldb')['db'];var util=require(_0xe9a6('0x2'));var channels=[_0xe9a6('0x3'),_0xe9a6('0x4'),_0xe9a6('0x5'),_0xe9a6('0x6'),_0xe9a6('0x7'),'whatsapp',_0xe9a6('0x8')];exports[_0xe9a6('0x9')]=function(){return channels;};exports[_0xe9a6('0xa')]=function(_0x3e7176){_0x3e7176=_0x3e7176[_0xe9a6('0xb')]();return _[_0xe9a6('0xc')](channels,_0x3e7176);};exports[_0xe9a6('0xd')]=function(_0x5b11a5,_0x3a5b88,_0x42792a,_0x2ab9e9){var _0x4c2075={'loginAttempts':_0x3a5b88,'blocked':_0x42792a};if(!_[_0xe9a6('0xe')](_0x2ab9e9)){_0x4c2075['blockedAt']=_0x2ab9e9;}return _0x5b11a5['updateAttributes'](_0x4c2075);};exports[_0xe9a6('0xf')]=function(_0x5e0d75){return new BPromise(function(_0x282aa8,_0x1e2d4f){var _0x3f223f=0x0;if(_0x5e0d75['role']!==_0xe9a6('0x10')){_0x282aa8(_0x5e0d75);}db[_0xe9a6('0x11')][_0xe9a6('0x12')]({'where':{'role':_0xe9a6('0x10'),'online':!![],'id':{'$ne':_0x5e0d75['id']}}})[_0xe9a6('0x13')](function(_0x1727b3){_0x3f223f=_0x1727b3;return util[_0xe9a6('0xf')]();})['then'](function(_0x5e1b12){if(_0x5e1b12&&_0x5e1b12[_0xe9a6('0x14')]&&_0x3f223f>=_0x5e1b12['agents']){throw Error(_0xe9a6('0x15'));}_0x282aa8(_0x5e0d75);})[_0xe9a6('0x16')](function(_0x4e64bc){_0x1e2d4f(_0x4e64bc);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 93483f4..a8d206e 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x92aa=['render','json','send','exports','404'];(function(_0x3d1cd7,_0x233452){var _0x5521ab=function(_0x4d273c){while(--_0x4d273c){_0x3d1cd7['push'](_0x3d1cd7['shift']());}};_0x5521ab(++_0x233452);}(_0x92aa,0xf3));var _0xa92a=function(_0x15dd0b,_0xf1f6ef){_0x15dd0b=_0x15dd0b-0x0;var _0x31de05=_0x92aa[_0x15dd0b];return _0x31de05;};'use strict';module[_0xa92a('0x0')][0x194]=function pageNotFound(_0x34d570,_0x131b53){var _0xc90dbd=_0xa92a('0x1');var _0x47e03a=0x194;var _0x9fc7ff={'status':_0x47e03a};_0x131b53['status'](_0x9fc7ff['status']);_0x131b53[_0xa92a('0x2')](_0xc90dbd,{},function(_0x56bfb5,_0x4dd2b5){if(_0x56bfb5){return _0x131b53['status'](_0x9fc7ff['status'])[_0xa92a('0x3')](_0x9fc7ff);}_0x131b53[_0xa92a('0x4')](_0x4dd2b5);});}; \ No newline at end of file +var _0xb9dd=['send','exports','status','render','json'];(function(_0x539698,_0x1f61cc){var _0x2ddbf9=function(_0x4d93a9){while(--_0x4d93a9){_0x539698['push'](_0x539698['shift']());}};_0x2ddbf9(++_0x1f61cc);}(_0xb9dd,0x74));var _0xdb9d=function(_0x3cc8f5,_0x3b5b2f){_0x3cc8f5=_0x3cc8f5-0x0;var _0x2c2778=_0xb9dd[_0x3cc8f5];return _0x2c2778;};'use strict';module[_0xdb9d('0x0')][0x194]=function pageNotFound(_0x303a4a,_0x2b3ab9){var _0x2dbdd8='404';var _0x5bc06a=0x194;var _0x1bc0f8={'status':_0x5bc06a};_0x2b3ab9[_0xdb9d('0x1')](_0x1bc0f8['status']);_0x2b3ab9[_0xdb9d('0x2')](_0x2dbdd8,{},function(_0x53d7a6,_0x2f1b67){if(_0x53d7a6){return _0x2b3ab9[_0xdb9d('0x1')](_0x1bc0f8[_0xdb9d('0x1')])[_0xdb9d('0x3')](_0x1bc0f8);}_0x2b3ab9[_0xdb9d('0x4')](_0x2f1b67);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index a5f6162..60606f7 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x17ba=['TrunkId','TrunkBackup','TrunkBackupId','IntervalId','voice_queues_has_cm_lists','Agents','Teams','voice_queues_has_cm_blacklists','Messages','mailbox','VoiceMailMessage','mailboxuser','QueueCalls','VoiceAgentReport','AgentReports','uniqueid','Contact','ContactId','MailAccount','CloudProviderId','MailServerOut','Imap','Smtp','Dispositions','MailAccountId','Answers','Interactions','List','ListId','TemplateId','mandatoryDispositionPause','mandatoryDispositionPauseId','user_has_mail_accounts','team_has_mail_queues','MailInteractionId','mail_interaction_has_tags','Tags','Users','Attachments','Interaction','Account','ChatOfflineMessageId','restrict','TagId','Items','Exntensions','FaxInteractionId','Owner','fax_interaction_has_tags','ThroughTags','AttachmentId','FaxAccountId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsiteId','ChatProactiveAction','ProactiveActions','ChatApplication','Agent','ChatQueue','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Website','CompanyId','JscriptySessions','Company','cm_contact_has_tags','Queue','All','AutomationAllId','Any','Action','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','SmsApplications','AnalyticDefaultReport','CustomReportId','Sound','Mohs','whatsapp_interaction_has_tags','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Fields','AnalyticMetric','MetricId','AccountId','Subjects','SubjectId','DescriptionId','FieldId','Subject','VariableId','Descriptions','Description','Field','Configurations','int_desk_configuration_has_tags','ZohoConfiguration','ZendeskField','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','ServicenowConfiguration','Dynamics365Account','FreshsalesConfiguration','FreshsalesAccount','FromId','JscriptyQuestionReport','SessionId','SmsQueueReport','ProjectId','user_has_teams','ChatQueues','team_has_whatsapp_queues','WhatsappQueues','TeamVoicePrefix','VoicePrefixes','CampaignId','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','MailTransferReport','FromAccount','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToAccount','FromChatWebsiteId','ToUserId','ToChatQueueId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','UserProfileSection','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappMessage','FromWhatsappAccountId','ToWhatsappAccountId','exports','../config/environment','sequelize','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','username','options','database','password','User','import','../api/user/user.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','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','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','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','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatQueue/chatQueue.model','ChatGroup','CmCompany','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','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','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','SalesforceConfiguration','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','../api/intZohoAccount/intZohoAccount.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','License','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','cascade','UserId','Recordings','VoiceQueuesRt','hasMany','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','WhatsappInteractions','UserNotifications','SenderId','belongsTo','UserProfile','userProfileId','Groups','chat_group_has_users','belongsToMany','Contacts','cm_user_has_contacts','Lists','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueue','MailQueues','FaxQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','UserOpenchannelQueue','cm_user_has_lists','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','OpenchannelAccount','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','moh_has_sounds','Members','VoiceQueueId','Hoppers','CmHopperHistory','HopperHistories','HopperBlacks'];(function(_0x4e8a03,_0x3143f3){var _0x2dae58=function(_0x8cec49){while(--_0x8cec49){_0x4e8a03['push'](_0x4e8a03['shift']());}};_0x2dae58(++_0x3143f3);}(_0x17ba,0xab));var _0xa17b=function(_0x3063ca,_0x2cf770){_0x3063ca=_0x3063ca-0x0;var _0x1cad2c=_0x17ba[_0x3063ca];return _0x1cad2c;};'use strict';var config=require(_0xa17b('0x0'));var Sequelize=require(_0xa17b('0x1'));var _=require('lodash');var jstz=require(_0xa17b('0x2'));var timezone=jstz[_0xa17b('0x3')]();config[_0xa17b('0x1')]=_[_0xa17b('0x4')](config[_0xa17b('0x1')],{'database':_0xa17b('0x5'),'username':_0xa17b('0x6'),'password':_0xa17b('0x7'),'options':{'host':_0xa17b('0x8'),'port':0xcea,'dialect':_0xa17b('0x9'),'dialectOptions':{'charset':_0xa17b('0xa')},'logging':![],'timezone':timezone[_0xa17b('0xb')](),'define':{'charset':_0xa17b('0xc'),'collate':_0xa17b('0xd')}}});config[_0xa17b('0xe')]=_[_0xa17b('0x4')](config[_0xa17b('0xe')],{'database':_0xa17b('0x5'),'username':_0xa17b('0x6'),'password':'xC@LL1234','options':{'host':_0xa17b('0x8'),'port':0xcea,'dialect':_0xa17b('0x9'),'dialectOptions':{'charset':_0xa17b('0xa')},'logging':![],'timezone':timezone[_0xa17b('0xb')](),'define':{'charset':_0xa17b('0xc'),'collate':_0xa17b('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xa17b('0x1')]['database'],config[_0xa17b('0x1')][_0xa17b('0xf')],config[_0xa17b('0x1')]['password'],config[_0xa17b('0x1')][_0xa17b('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xa17b('0xe')][_0xa17b('0x11')],config['sequelizeHistory'][_0xa17b('0xf')],config['sequelizeHistory'][_0xa17b('0x12')],config[_0xa17b('0xe')]['options'])};db[_0xa17b('0x13')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x15'));db['VoiceChanSpy']=db[_0xa17b('0x1')]['import']('../api/voiceChanSpy/voiceChanSpy.model');db['VoiceContext']=db[_0xa17b('0x1')][_0xa17b('0x14')]('../api/voiceContext/voiceContext.model');db[_0xa17b('0x16')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x17'));db[_0xa17b('0x18')]=db[_0xa17b('0x1')][_0xa17b('0x14')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xa17b('0x19')]=db[_0xa17b('0x1')][_0xa17b('0x14')]('../api/voiceQueue/voiceQueue.model');db[_0xa17b('0x1a')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x1b'));db[_0xa17b('0x1c')]=db[_0xa17b('0x1')]['import'](_0xa17b('0x1d'));db['VoiceMail']=db[_0xa17b('0x1')][_0xa17b('0x14')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x1e'));db[_0xa17b('0x1f')]=db[_0xa17b('0x1')][_0xa17b('0x14')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db['sequelize']['import'](_0xa17b('0x20'));db['VoiceAgentReport']=db[_0xa17b('0x1')]['import'](_0xa17b('0x21'));db[_0xa17b('0x22')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x23'));db[_0xa17b('0x24')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x25'));db[_0xa17b('0x26')]=db[_0xa17b('0x1')]['import']('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x27'));db[_0xa17b('0x28')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x29'));db[_0xa17b('0x2a')]=db['sequelize'][_0xa17b('0x14')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0xa17b('0x2b')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x2c'));db[_0xa17b('0x2d')]=db[_0xa17b('0x1')]['import'](_0xa17b('0x2e'));db[_0xa17b('0x2f')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x30'));db['UserSmsQueue']=db[_0xa17b('0x1')]['import'](_0xa17b('0x31'));db['UserOpenchannelQueue']=db[_0xa17b('0x1')][_0xa17b('0x14')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xa17b('0x32')]=db[_0xa17b('0x1')]['import'](_0xa17b('0x33'));db[_0xa17b('0x34')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x35'));db['MailServerOut']=db[_0xa17b('0x1')]['import'](_0xa17b('0x36'));db['MailAccount']=db[_0xa17b('0x1')]['import'](_0xa17b('0x37'));db['MailQueue']=db[_0xa17b('0x1')]['import'](_0xa17b('0x38'));db[_0xa17b('0x39')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x3a'));db[_0xa17b('0x3b')]=db[_0xa17b('0x1')][_0xa17b('0x14')]('../api/mailInteraction/mailInteraction.model');db[_0xa17b('0x3c')]=db[_0xa17b('0x1')]['import'](_0xa17b('0x3d'));db[_0xa17b('0x3e')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x3f'));db[_0xa17b('0x40')]=db['sequelize'][_0xa17b('0x14')](_0xa17b('0x41'));db[_0xa17b('0x42')]=db['sequelize']['import']('../api/dashboard/dashboard.model');db[_0xa17b('0x43')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x44'));db[_0xa17b('0x45')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x46'));db[_0xa17b('0x47')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x48'));db['FaxInteraction']=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x49'));db[_0xa17b('0x4a')]=db[_0xa17b('0x1')][_0xa17b('0x14')]('../api/faxMessage/faxMessage.model');db[_0xa17b('0x4b')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x4c'));db[_0xa17b('0x4d')]=db['sequelize'][_0xa17b('0x14')](_0xa17b('0x4e'));db[_0xa17b('0x4f')]=db[_0xa17b('0x1')]['import'](_0xa17b('0x50'));db[_0xa17b('0x51')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x52'));db[_0xa17b('0x53')]=db[_0xa17b('0x1')]['import'](_0xa17b('0x54'));db[_0xa17b('0x55')]=db['sequelize'][_0xa17b('0x14')](_0xa17b('0x56'));db[_0xa17b('0x57')]=db['sequelize'][_0xa17b('0x14')](_0xa17b('0x58'));db['OpenchannelAccount']=db[_0xa17b('0x1')][_0xa17b('0x14')]('../api/openchannelAccount/openchannelAccount.model');db[_0xa17b('0x59')]=db[_0xa17b('0x1')]['import'](_0xa17b('0x5a'));db[_0xa17b('0x5b')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x5c'));db[_0xa17b('0x5d')]=db[_0xa17b('0x1')]['import'](_0xa17b('0x5e'));db[_0xa17b('0x5f')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x60'));db[_0xa17b('0x61')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x62'));db[_0xa17b('0x63')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x64'));db['ChatApplication']=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x65'));db[_0xa17b('0x66')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x67'));db[_0xa17b('0x68')]=db[_0xa17b('0x1')]['import']('../api/chatMessage/chatMessage.model');db[_0xa17b('0x69')]=db[_0xa17b('0x1')]['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x6a'));db[_0xa17b('0x6b')]=db[_0xa17b('0x1')][_0xa17b('0x14')]('../api/chatGroup/chatGroup.model');db['ChatProactiveAction']=db['sequelize']['import']('../api/chatProactiveAction/chatProactiveAction.model');db[_0xa17b('0x6c')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x6d'));db[_0xa17b('0x6e')]=db[_0xa17b('0x1')][_0xa17b('0x14')]('../api/cmContact/cmContact.model');db[_0xa17b('0x6f')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x70'));db[_0xa17b('0x71')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x72'));db[_0xa17b('0x73')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x74'));db['CmHopperHistory']=db[_0xa17b('0x1')]['import'](_0xa17b('0x75'));db[_0xa17b('0x76')]=db[_0xa17b('0x1')][_0xa17b('0x14')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0xa17b('0x77')]=db['sequelize'][_0xa17b('0x14')]('../api/cmCustomField/cmCustomField.model');db['Action']=db[_0xa17b('0x1')][_0xa17b('0x14')]('../api/action/action.model');db[_0xa17b('0x78')]=db[_0xa17b('0x1')]['import']('../api/automation/automation.model');db[_0xa17b('0x79')]=db[_0xa17b('0x1')]['import'](_0xa17b('0x7a'));db[_0xa17b('0x7b')]=db['sequelize'][_0xa17b('0x14')](_0xa17b('0x7c'));db[_0xa17b('0x7d')]=db[_0xa17b('0x1')][_0xa17b('0x14')]('../api/condition/condition.model');db[_0xa17b('0x7e')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x7f'));db[_0xa17b('0x80')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x81'));db[_0xa17b('0x82')]=db[_0xa17b('0x1')]['import'](_0xa17b('0x83'));db[_0xa17b('0x84')]=db['sequelize']['import'](_0xa17b('0x85'));db[_0xa17b('0x86')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x87'));db['Sound']=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x88'));db[_0xa17b('0x89')]=db['sequelize'][_0xa17b('0x14')]('../api/tag/tag.model');db[_0xa17b('0x8a')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x8b'));db[_0xa17b('0x8c')]=db['sequelize'][_0xa17b('0x14')](_0xa17b('0x8d'));db[_0xa17b('0x8e')]=db[_0xa17b('0x1')][_0xa17b('0x14')]('../api/variable/variable.model');db[_0xa17b('0x8f')]=db[_0xa17b('0x1')]['import'](_0xa17b('0x90'));db[_0xa17b('0x91')]=db['sequelize']['import'](_0xa17b('0x92'));db[_0xa17b('0x93')]=db[_0xa17b('0x1')]['import']('../api/analyticCustomReport/analyticCustomReport.model');db['AnalyticDefaultReport']=db[_0xa17b('0x1')]['import'](_0xa17b('0x94'));db[_0xa17b('0x95')]=db[_0xa17b('0x1')][_0xa17b('0x14')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db['sequelize'][_0xa17b('0x14')](_0xa17b('0x96'));db[_0xa17b('0x97')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x98'));db[_0xa17b('0x99')]=db[_0xa17b('0x1')][_0xa17b('0x14')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xa17b('0x9a')]=db['sequelize'][_0xa17b('0x14')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xa17b('0x9b')]=db[_0xa17b('0x1')][_0xa17b('0x14')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xa17b('0x9c')]=db['sequelize'][_0xa17b('0x14')](_0xa17b('0x9d'));db[_0xa17b('0x9e')]=db['sequelize'][_0xa17b('0x14')](_0xa17b('0x9f'));db[_0xa17b('0xa0')]=db[_0xa17b('0x1')][_0xa17b('0x14')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0xa17b('0xa1')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xa2'));db[_0xa17b('0xa3')]=db['sequelize'][_0xa17b('0x14')](_0xa17b('0xa4'));db[_0xa17b('0xa5')]=db['sequelize'][_0xa17b('0x14')](_0xa17b('0xa6'));db[_0xa17b('0xa7')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xa8'));db[_0xa17b('0xa9')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xaa'));db['ZohoConfiguration']=db[_0xa17b('0x1')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xa17b('0xab')]=db[_0xa17b('0x1')][_0xa17b('0x14')]('../api/intZohoField/intZohoField.model');db[_0xa17b('0xac')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xad'));db[_0xa17b('0xae')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xaf'));db['ZendeskField']=db['sequelize'][_0xa17b('0x14')]('../api/intZendeskField/intZendeskField.model');db[_0xa17b('0xb0')]=db['sequelize']['import'](_0xa17b('0xb1'));db['FreshdeskConfiguration']=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xb2'));db[_0xa17b('0xb3')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xb4'));db[_0xa17b('0xb5')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xb6'));db[_0xa17b('0xb7')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xb8'));db[_0xa17b('0xb9')]=db['sequelize']['import']('../api/intVtigerField/intVtigerField.model');db[_0xa17b('0xba')]=db['sequelize'][_0xa17b('0x14')](_0xa17b('0xbb'));db['ServicenowConfiguration']=db[_0xa17b('0x1')]['import'](_0xa17b('0xbc'));db[_0xa17b('0xbd')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xbe'));db['Dynamics365Account']=db['sequelize'][_0xa17b('0x14')](_0xa17b('0xbf'));db[_0xa17b('0xc0')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xc1'));db[_0xa17b('0xc2')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xc3'));db['FreshsalesAccount']=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xc4'));db['FreshsalesConfiguration']=db[_0xa17b('0x1')][_0xa17b('0x14')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0xa17b('0xc5')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xc6'));db[_0xa17b('0x8f')]=db[_0xa17b('0x1')]['import'](_0xa17b('0x90'));db[_0xa17b('0xc7')]=db['sequelize'][_0xa17b('0x14')](_0xa17b('0xc8'));db[_0xa17b('0xc9')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xca'));db[_0xa17b('0xcb')]=db['sequelize'][_0xa17b('0x14')](_0xa17b('0xcc'));db[_0xa17b('0xcd')]=db['sequelize']['import'](_0xa17b('0xce'));db['JscriptyQuestionReport']=db['sequelize']['import'](_0xa17b('0xcf'));db[_0xa17b('0xd0')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xd1'));db['SmsQueueReport']=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xd2'));db[_0xa17b('0xd3')]=db['sequelize'][_0xa17b('0x14')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db['sequelize'][_0xa17b('0x14')]('../api/squareReportDetail/squareReportDetail.model');db[_0xa17b('0xd4')]=db[_0xa17b('0x1')]['import'](_0xa17b('0xd5'));db[_0xa17b('0xd6')]=db['sequelize'][_0xa17b('0x14')]('../api/setting/setting.model');db[_0xa17b('0xd7')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xd8'));db['SquareProject']=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xd9'));db[_0xa17b('0xda')]=db['sequelize'][_0xa17b('0x14')](_0xa17b('0xdb'));db['SquareMessage']=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xdc'));db[_0xa17b('0xdd')]=db['sequelize'][_0xa17b('0x14')]('../api/team/team.model');db[_0xa17b('0xde')]=db[_0xa17b('0x1')][_0xa17b('0x14')]('../api/license/license.model');db[_0xa17b('0xdf')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xe0'));db[_0xa17b('0xe1')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xe2'));db[_0xa17b('0xe3')]=db['sequelize'][_0xa17b('0x14')](_0xa17b('0xe4'));db[_0xa17b('0xe5')]=db[_0xa17b('0x1')]['import']('../api/plugin/plugin.model');db['MailTransferReport']=db[_0xa17b('0x1')]['import'](_0xa17b('0xe6'));db[_0xa17b('0xe7')]=db['sequelize'][_0xa17b('0x14')](_0xa17b('0xe8'));db[_0xa17b('0xe9')]=db['sequelize'][_0xa17b('0x14')]('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xea'));db['SmsTransferReport']=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xeb'));db[_0xa17b('0xec')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xed'));db[_0xa17b('0xee')]=db['sequelize']['import']('../api/voicePrefix/voicePrefix.model');db['UserProfile']=db['sequelize'][_0xa17b('0x14')](_0xa17b('0xef'));db['UserProfileSection']=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xf0'));db[_0xa17b('0xf1')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xf2'));db[_0xa17b('0xf3')]=db[_0xa17b('0x1')]['import']('../api/userNotification/userNotification.model');db[_0xa17b('0xf4')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xf5'));db[_0xa17b('0xf6')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xf7'));db[_0xa17b('0xf8')]=db[_0xa17b('0x1')][_0xa17b('0x14')]('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db['sequelize'][_0xa17b('0x14')](_0xa17b('0xf9'));db[_0xa17b('0xfa')]=db[_0xa17b('0x1')]['import'](_0xa17b('0xfb'));db[_0xa17b('0xfc')]=db['sequelize'][_0xa17b('0x14')](_0xa17b('0xfd'));db[_0xa17b('0xfe')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0xff'));db[_0xa17b('0x100')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x101'));db[_0xa17b('0x102')]=db[_0xa17b('0x1')][_0xa17b('0x14')]('../api/teamVoiceQueue/teamVoiceQueue.model');db['TeamVoicePrefix']=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x103'));db[_0xa17b('0x104')]=db[_0xa17b('0x1')][_0xa17b('0x14')](_0xa17b('0x105'));db[_0xa17b('0x13')][_0xa17b('0x106')](db[_0xa17b('0x107')],{'as':'VoiceMail','onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x109')});db['User']['hasMany'](db[_0xa17b('0x1a')],{'as':_0xa17b('0x10a'),'foreignKey':'UserId'});db[_0xa17b('0x13')]['hasMany'](db[_0xa17b('0x28')],{'as':_0xa17b('0x10b'),'foreignKey':_0xa17b('0x109')});db['User'][_0xa17b('0x10c')](db[_0xa17b('0x16')],{'as':_0xa17b('0x10d'),'onDelete':_0xa17b('0x108'),'hooks':!![]});db['User'][_0xa17b('0x10c')](db[_0xa17b('0x73')],{'as':_0xa17b('0x10e'),'foreignKey':_0xa17b('0x109')});db[_0xa17b('0x13')]['hasMany'](db['CmHopperHistory'],{'as':_0xa17b('0x10f'),'foreignKey':_0xa17b('0x109')});db[_0xa17b('0x13')]['hasMany'](db[_0xa17b('0x76')],{'as':'ReportAgentPreview','foreignKey':'UserId'});db[_0xa17b('0x13')][_0xa17b('0x10c')](db[_0xa17b('0x5b')],{'as':_0xa17b('0x110'),'foreignKey':_0xa17b('0x109')});db['User'][_0xa17b('0x10c')](db['ChatInteraction'],{'as':_0xa17b('0x111'),'foreignKey':_0xa17b('0x109')});db['User']['hasMany'](db[_0xa17b('0x53')],{'as':_0xa17b('0x112'),'foreignKey':'UserId'});db[_0xa17b('0x13')][_0xa17b('0x10c')](db[_0xa17b('0x113')],{'as':'FaxInteractions','foreignKey':_0xa17b('0x109')});db[_0xa17b('0x13')][_0xa17b('0x10c')](db[_0xa17b('0x3b')],{'as':'MailInteractions','foreignKey':_0xa17b('0x109')});db['User'][_0xa17b('0x10c')](db[_0xa17b('0xf8')],{'as':_0xa17b('0x114'),'foreignKey':_0xa17b('0x109')});db[_0xa17b('0x13')][_0xa17b('0x10c')](db['UserNotification'],{'as':_0xa17b('0x115'),'foreignKey':_0xa17b('0x116')});db[_0xa17b('0x13')][_0xa17b('0x117')](db[_0xa17b('0x118')],{'as':_0xa17b('0x118'),'foreignKey':_0xa17b('0x119')});db[_0xa17b('0x13')]['belongsToMany'](db[_0xa17b('0x6b')],{'as':_0xa17b('0x11a'),'through':_0xa17b('0x11b')});db[_0xa17b('0x13')][_0xa17b('0x11c')](db[_0xa17b('0x6e')],{'as':_0xa17b('0x11d'),'through':_0xa17b('0x11e')});db['User'][_0xa17b('0x11c')](db[_0xa17b('0xec')],{'as':_0xa17b('0x11f'),'through':'cm_user_has_lists'});db[_0xa17b('0x13')][_0xa17b('0x11c')](db[_0xa17b('0xdd')],{'through':'user_has_teams'});db[_0xa17b('0x13')][_0xa17b('0x11c')](db[_0xa17b('0x3b')],{'as':_0xa17b('0x120'),'through':_0xa17b('0x121')});db[_0xa17b('0x13')]['belongsToMany'](db[_0xa17b('0x66')],{'as':'ChatInteractions','through':_0xa17b('0x122')});db['User'][_0xa17b('0x11c')](db[_0xa17b('0x113')],{'as':_0xa17b('0x123'),'through':_0xa17b('0x124')});db[_0xa17b('0x13')][_0xa17b('0x11c')](db['SmsInteraction'],{'as':_0xa17b('0x112'),'through':'user_has_sms_interactions'});db[_0xa17b('0x13')][_0xa17b('0x11c')](db[_0xa17b('0x5b')],{'as':_0xa17b('0x110'),'through':_0xa17b('0x125')});db[_0xa17b('0x13')][_0xa17b('0x11c')](db[_0xa17b('0xf8')],{'as':_0xa17b('0x114'),'through':_0xa17b('0x126')});db[_0xa17b('0x13')][_0xa17b('0x11c')](db['VoiceQueue'],{'as':_0xa17b('0x127'),'through':_0xa17b('0x2a'),'required':![]});db[_0xa17b('0x13')][_0xa17b('0x11c')](db[_0xa17b('0xee')],{'as':'VoicePrefixes','through':_0xa17b('0x104'),'required':![]});db[_0xa17b('0x13')][_0xa17b('0x11c')](db[_0xa17b('0x128')],{'as':_0xa17b('0x129'),'through':_0xa17b('0x2d'),'required':![]});db[_0xa17b('0x13')]['belongsToMany'](db['ChatQueue'],{'as':'ChatQueues','through':'UserChatQueue','required':![],'hooks':!![]});db[_0xa17b('0x13')]['belongsToMany'](db[_0xa17b('0x4b')],{'as':_0xa17b('0x12a'),'through':_0xa17b('0x2f'),'required':![]});db[_0xa17b('0x13')][_0xa17b('0x11c')](db[_0xa17b('0x57')],{'as':_0xa17b('0x12b'),'through':_0xa17b('0x12c'),'required':![]});db[_0xa17b('0x13')]['belongsToMany'](db[_0xa17b('0x5f')],{'as':_0xa17b('0x12d'),'through':_0xa17b('0x12e'),'required':![]});db[_0xa17b('0x13')][_0xa17b('0x11c')](db[_0xa17b('0xfe')],{'as':'WhatsappQueues','through':_0xa17b('0x32'),'required':![]});db['User'][_0xa17b('0x11c')](db[_0xa17b('0xec')],{'through':_0xa17b('0x12f')});db[_0xa17b('0x13')][_0xa17b('0x11c')](db['ChatWebsite'],{'as':_0xa17b('0x130'),'through':_0xa17b('0x131')});db[_0xa17b('0x13')][_0xa17b('0x11c')](db[_0xa17b('0x45')],{'as':_0xa17b('0x132'),'through':_0xa17b('0x133')});db[_0xa17b('0x13')][_0xa17b('0x11c')](db['MailAccount'],{'as':_0xa17b('0x134'),'through':'user_has_mail_accounts'});db[_0xa17b('0x13')][_0xa17b('0x11c')](db[_0xa17b('0x135')],{'as':'OpenchannelAccounts','through':_0xa17b('0x136')});db[_0xa17b('0x13')][_0xa17b('0x11c')](db[_0xa17b('0x4f')],{'as':_0xa17b('0x137'),'through':_0xa17b('0x138')});db[_0xa17b('0x13')][_0xa17b('0x11c')](db[_0xa17b('0xf4')],{'as':'WhatsappAccounts','through':_0xa17b('0x139')});db['User'][_0xa17b('0x11c')](db[_0xa17b('0x13a')],{'as':_0xa17b('0x13b'),'through':_0xa17b('0x13c')});db[_0xa17b('0x13d')][_0xa17b('0x10c')](db[_0xa17b('0x16')],{'as':_0xa17b('0x13e'),'onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x13f')});db['VoiceContext'][_0xa17b('0x10c')](db['VoiceExtension'],{'onDelete':'cascade'});db[_0xa17b('0x16')][_0xa17b('0x10c')](db[_0xa17b('0x16')],{'as':_0xa17b('0x140'),'onDelete':_0xa17b('0x108')});db[_0xa17b('0x18')]['belongsToMany'](db['Sound'],{'as':'Sounds','through':_0xa17b('0x141')});db['VoiceQueue'][_0xa17b('0x10c')](db[_0xa17b('0x28')],{'as':_0xa17b('0x142'),'foreignKey':_0xa17b('0x143')});db[_0xa17b('0x19')][_0xa17b('0x10c')](db[_0xa17b('0x6f')],{'as':_0xa17b('0x144'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xa17b('0x10c')](db['CmHopperFinal'],{'as':_0xa17b('0x10e'),'foreignKey':_0xa17b('0x143')});db[_0xa17b('0x19')][_0xa17b('0x10c')](db[_0xa17b('0x145')],{'as':_0xa17b('0x146'),'foreignKey':'VoiceQueueId'});db[_0xa17b('0x19')][_0xa17b('0x10c')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xa17b('0x143')});db[_0xa17b('0x19')][_0xa17b('0x10c')](db[_0xa17b('0x71')],{'as':_0xa17b('0x147'),'foreignKey':_0xa17b('0x143')});db[_0xa17b('0x19')]['hasMany'](db[_0xa17b('0xd0')],{'as':'JscriptySessions','foreignKey':'VoiceQueueId'});db[_0xa17b('0x19')][_0xa17b('0x117')](db[_0xa17b('0x26')],{'as':_0xa17b('0x26'),'foreignKey':_0xa17b('0x148')});db[_0xa17b('0x19')]['belongsTo'](db[_0xa17b('0x26')],{'as':_0xa17b('0x149'),'foreignKey':_0xa17b('0x14a')});db[_0xa17b('0x19')]['belongsTo'](db['Interval'],{'as':'Interval','foreignKey':_0xa17b('0x14b')});db['VoiceQueue']['belongsTo'](db[_0xa17b('0x80')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xa17b('0x19')][_0xa17b('0x11c')](db[_0xa17b('0xec')],{'as':_0xa17b('0x11f'),'through':_0xa17b('0x14c')});db['VoiceQueue'][_0xa17b('0x11c')](db[_0xa17b('0x13')],{'as':_0xa17b('0x14d'),'through':_0xa17b('0x2a')});db[_0xa17b('0x19')][_0xa17b('0x11c')](db[_0xa17b('0xdd')],{'as':_0xa17b('0x14e'),'through':_0xa17b('0x102')});db[_0xa17b('0x19')][_0xa17b('0x11c')](db[_0xa17b('0xec')],{'as':'BlackLists','through':_0xa17b('0x14f')});db['VoiceRecording']['belongsTo'](db[_0xa17b('0x13')],{'as':_0xa17b('0x13'),'foreignKey':_0xa17b('0x109')});db[_0xa17b('0x1c')][_0xa17b('0x117')](db[_0xa17b('0x13')],{'as':_0xa17b('0x13'),'foreignKey':_0xa17b('0x109')});db[_0xa17b('0x107')]['hasMany'](db['VoiceMailMessage'],{'as':_0xa17b('0x150'),'onDelete':_0xa17b('0x108'),'foreignKey':'mailboxuser','sourceKey':_0xa17b('0x151')});db[_0xa17b('0x152')][_0xa17b('0x117')](db[_0xa17b('0x107')],{'foreignKey':_0xa17b('0x153'),'targetKey':_0xa17b('0x151')});db[_0xa17b('0x1f')][_0xa17b('0x10c')](db[_0xa17b('0x22')],{'as':_0xa17b('0x154'),'foreignKey':'uniqueid','constraints':![]});db[_0xa17b('0x1f')][_0xa17b('0x10c')](db[_0xa17b('0x155')],{'as':_0xa17b('0x156'),'foreignKey':_0xa17b('0x157'),'constraints':![]});db['VoiceCallReport'][_0xa17b('0x117')](db[_0xa17b('0x13')],{'as':_0xa17b('0x13'),'foreignKey':_0xa17b('0x109')});db[_0xa17b('0x1f')][_0xa17b('0x117')](db[_0xa17b('0x6e')],{'as':_0xa17b('0x158'),'foreignKey':_0xa17b('0x159')});db[_0xa17b('0x34')][_0xa17b('0x117')](db[_0xa17b('0x15a')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0xa17b('0x34')]['belongsTo'](db[_0xa17b('0x100')],{'as':_0xa17b('0x100'),'foreignKey':_0xa17b('0x15b'),'onDelete':'restrict'});db[_0xa17b('0x15c')]['belongsTo'](db[_0xa17b('0x15a')],{'as':_0xa17b('0x15a'),'foreignKey':'MailAccountId'});db[_0xa17b('0x15c')]['belongsTo'](db[_0xa17b('0x100')],{'as':_0xa17b('0x100'),'foreignKey':_0xa17b('0x15b'),'onDelete':'restrict'});db['MailAccount'][_0xa17b('0x106')](db[_0xa17b('0x34')],{'as':_0xa17b('0x15d'),'onDelete':_0xa17b('0x108')});db[_0xa17b('0x15a')]['hasOne'](db[_0xa17b('0x15c')],{'as':_0xa17b('0x15e'),'onDelete':_0xa17b('0x108')});db['MailAccount']['hasMany'](db[_0xa17b('0x7b')],{'as':_0xa17b('0x15f'),'foreignKey':_0xa17b('0x160'),'onDelete':_0xa17b('0x108')});db[_0xa17b('0x15a')]['hasMany'](db[_0xa17b('0x79')],{'as':_0xa17b('0x161'),'foreignKey':_0xa17b('0x160')});db[_0xa17b('0x15a')][_0xa17b('0x10c')](db[_0xa17b('0x3c')],{'as':'Messages','foreignKey':'MailAccountId'});db[_0xa17b('0x15a')]['hasMany'](db[_0xa17b('0x3b')],{'as':_0xa17b('0x162')});db['MailAccount'][_0xa17b('0x10c')](db['MailApplication'],{'as':_0xa17b('0x140')});db[_0xa17b('0x15a')][_0xa17b('0x117')](db[_0xa17b('0xec')],{'as':_0xa17b('0x163'),'foreignKey':_0xa17b('0x164')});db[_0xa17b('0x15a')][_0xa17b('0x117')](db[_0xa17b('0x8a')],{'as':_0xa17b('0x8a'),'foreignKey':_0xa17b('0x165')});db[_0xa17b('0x15a')][_0xa17b('0x117')](db['Pause'],{'as':_0xa17b('0x166'),'foreignKey':_0xa17b('0x167')});db[_0xa17b('0x15a')][_0xa17b('0x11c')](db[_0xa17b('0x13')],{'as':'Agents','through':_0xa17b('0x168')});db['MailQueue'][_0xa17b('0x11c')](db[_0xa17b('0x13')],{'as':_0xa17b('0x14d'),'through':_0xa17b('0x2d')});db[_0xa17b('0x128')][_0xa17b('0x11c')](db[_0xa17b('0xdd')],{'through':_0xa17b('0x169'),'as':_0xa17b('0x14e')});db[_0xa17b('0x3b')][_0xa17b('0x10c')](db[_0xa17b('0x3c')],{'as':_0xa17b('0x150'),'onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x16a')});db[_0xa17b('0x3b')][_0xa17b('0x117')](db[_0xa17b('0x15a')],{'as':'Account','foreignKey':_0xa17b('0x160')});db['MailInteraction']['belongsTo'](db[_0xa17b('0x6e')],{'as':'Contact','foreignKey':_0xa17b('0x159')});db[_0xa17b('0x3b')][_0xa17b('0x117')](db[_0xa17b('0x13')],{'as':'Owner','foreignKey':'UserId'});db['MailInteraction'][_0xa17b('0x11c')](db[_0xa17b('0x89')],{'through':_0xa17b('0x16b'),'as':_0xa17b('0x16c')});db['MailInteraction'][_0xa17b('0x11c')](db[_0xa17b('0x89')],{'through':_0xa17b('0x16b'),'as':'ThroughTags'});db[_0xa17b('0x3b')][_0xa17b('0x11c')](db['User'],{'as':_0xa17b('0x16d'),'through':_0xa17b('0x121'),'foreignKey':_0xa17b('0x16a')});db['MailMessage']['hasMany'](db['Attachment'],{'as':_0xa17b('0x16e'),'onDelete':'cascade'});db['MailMessage'][_0xa17b('0x117')](db[_0xa17b('0x13')],{'as':_0xa17b('0x13')});db[_0xa17b('0x3c')][_0xa17b('0x117')](db['CmContact'],{'onDelete':_0xa17b('0x108'),'as':_0xa17b('0x158')});db[_0xa17b('0x3c')]['belongsTo'](db['MailInteraction'],{'as':_0xa17b('0x16f'),'foreignKey':_0xa17b('0x16a')});db[_0xa17b('0x3c')][_0xa17b('0x117')](db[_0xa17b('0x15a')],{'as':_0xa17b('0x170'),'foreignKey':'MailAccountId'});db[_0xa17b('0x3c')]['belongsTo'](db['ChatWebsite'],{'as':_0xa17b('0x61'),'foreignKey':'ChatWebsiteId'});db[_0xa17b('0x3c')]['belongsTo'](db[_0xa17b('0x69')],{'as':_0xa17b('0x69'),'foreignKey':_0xa17b('0x171')});db[_0xa17b('0x3e')][_0xa17b('0x117')](db[_0xa17b('0x13')],{'onDelete':_0xa17b('0x172')});db[_0xa17b('0x3e')][_0xa17b('0x117')](db['MailQueue'],{'onDelete':_0xa17b('0x172')});db['MailApplication'][_0xa17b('0x117')](db['MailAccount'],{'onDelete':'restrict'});db[_0xa17b('0x3e')][_0xa17b('0x117')](db[_0xa17b('0x7e')],{'onDelete':_0xa17b('0x172'),'foreignKey':_0xa17b('0x14b')});db[_0xa17b('0x3e')][_0xa17b('0x117')](db[_0xa17b('0x89')],{'onDelete':_0xa17b('0x172'),'foreignKey':_0xa17b('0x173')});db[_0xa17b('0x40')][_0xa17b('0x117')](db[_0xa17b('0x15a')],{});db[_0xa17b('0x40')]['belongsTo'](db['CmList'],{'as':_0xa17b('0x163'),'foreignKey':_0xa17b('0x164')});db[_0xa17b('0x40')][_0xa17b('0x117')](db[_0xa17b('0x6e')],{'as':_0xa17b('0x158'),'foreignKey':_0xa17b('0x159')});db[_0xa17b('0x40')]['belongsTo'](db[_0xa17b('0x3b')],{});db['MailQueueReport']['belongsTo'](db[_0xa17b('0x3c')],{});db['MailQueueReport'][_0xa17b('0x117')](db[_0xa17b('0x13')],{});db[_0xa17b('0x40')][_0xa17b('0x117')](db[_0xa17b('0x128')],{});db[_0xa17b('0x42')][_0xa17b('0x10c')](db[_0xa17b('0x43')],{'as':_0xa17b('0x174'),'onDelete':_0xa17b('0x108')});db['FaxAccount'][_0xa17b('0x10c')](db[_0xa17b('0x7b')],{'as':'Dispositions','foreignKey':'FaxAccountId','onDelete':_0xa17b('0x108')});db[_0xa17b('0x45')][_0xa17b('0x10c')](db[_0xa17b('0x79')],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0xa17b('0x45')][_0xa17b('0x10c')](db['FaxInteraction'],{'as':_0xa17b('0x162')});db[_0xa17b('0x45')]['hasMany'](db[_0xa17b('0x47')],{'as':_0xa17b('0x140')});db['FaxAccount'][_0xa17b('0x10c')](db[_0xa17b('0x16')],{'as':_0xa17b('0x175'),'onDelete':_0xa17b('0x108')});db['FaxAccount'][_0xa17b('0x10c')](db['FaxMessage'],{'as':'Messages'});db['FaxAccount']['belongsTo'](db['Trunk'],{'as':_0xa17b('0x26')});db[_0xa17b('0x45')]['belongsTo'](db[_0xa17b('0xec')],{'as':_0xa17b('0x163'),'foreignKey':'ListId'});db[_0xa17b('0x45')][_0xa17b('0x117')](db[_0xa17b('0x80')],{'as':'mandatoryDispositionPause','foreignKey':_0xa17b('0x167')});db[_0xa17b('0x45')][_0xa17b('0x11c')](db[_0xa17b('0x13')],{'as':'Agents','through':_0xa17b('0x133')});db[_0xa17b('0x47')][_0xa17b('0x117')](db[_0xa17b('0x13')],{'onDelete':_0xa17b('0x172')});db[_0xa17b('0x47')][_0xa17b('0x117')](db[_0xa17b('0x4b')],{'onDelete':'restrict'});db['FaxApplication']['belongsTo'](db[_0xa17b('0x45')],{'onDelete':_0xa17b('0x172')});db[_0xa17b('0x47')][_0xa17b('0x117')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xa17b('0x173')});db[_0xa17b('0x113')][_0xa17b('0x10c')](db[_0xa17b('0x4a')],{'as':'Messages','onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x176')});db[_0xa17b('0x113')]['belongsTo'](db['FaxAccount'],{'as':_0xa17b('0x170'),'foreignKey':'FaxAccountId'});db[_0xa17b('0x113')][_0xa17b('0x117')](db[_0xa17b('0x6e')],{'as':'Contact','foreignKey':'ContactId'});db[_0xa17b('0x113')][_0xa17b('0x117')](db[_0xa17b('0x13')],{'as':_0xa17b('0x177'),'foreignKey':'UserId'});db[_0xa17b('0x113')][_0xa17b('0x11c')](db[_0xa17b('0x89')],{'through':'fax_interaction_has_tags','as':_0xa17b('0x16c')});db[_0xa17b('0x113')]['belongsToMany'](db['Tag'],{'through':_0xa17b('0x178'),'as':_0xa17b('0x179')});db['FaxInteraction'][_0xa17b('0x11c')](db[_0xa17b('0x13')],{'as':_0xa17b('0x16d'),'through':_0xa17b('0x124'),'foreignKey':'FaxInteractionId'});db[_0xa17b('0x4a')][_0xa17b('0x117')](db[_0xa17b('0x13')],{'onDelete':_0xa17b('0x108'),'as':_0xa17b('0x13')});db['FaxMessage'][_0xa17b('0x117')](db['FaxInteraction'],{'as':_0xa17b('0x16f'),'foreignKey':_0xa17b('0x176')});db[_0xa17b('0x4a')][_0xa17b('0x117')](db[_0xa17b('0x6e')],{'onDelete':'cascade','as':'Contact'});db['FaxMessage'][_0xa17b('0x117')](db[_0xa17b('0xe3')],{'as':'Attachment','foreignKey':_0xa17b('0x17a')});db[_0xa17b('0x4a')][_0xa17b('0x117')](db['FaxAccount'],{'as':_0xa17b('0x170'),'foreignKey':_0xa17b('0x17b')});db[_0xa17b('0x4b')]['belongsToMany'](db[_0xa17b('0x13')],{'as':_0xa17b('0x14d'),'through':_0xa17b('0x2f')});db[_0xa17b('0x4b')][_0xa17b('0x11c')](db[_0xa17b('0xdd')],{'through':_0xa17b('0x17c'),'as':_0xa17b('0x14e')});db[_0xa17b('0x4d')][_0xa17b('0x117')](db[_0xa17b('0x45')],{});db[_0xa17b('0x4d')][_0xa17b('0x117')](db[_0xa17b('0xec')],{'as':_0xa17b('0x163'),'foreignKey':_0xa17b('0x164')});db[_0xa17b('0x4d')]['belongsTo'](db[_0xa17b('0x6e')],{'as':_0xa17b('0x158'),'foreignKey':_0xa17b('0x159')});db['FaxQueueReport'][_0xa17b('0x117')](db[_0xa17b('0x113')],{});db[_0xa17b('0x4d')]['belongsTo'](db['FaxMessage'],{});db[_0xa17b('0x4d')][_0xa17b('0x117')](db['User'],{});db[_0xa17b('0x4d')][_0xa17b('0x117')](db[_0xa17b('0x4b')],{});db[_0xa17b('0x4f')][_0xa17b('0x10c')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xa17b('0x17d'),'onDelete':'cascade'});db['SmsAccount'][_0xa17b('0x10c')](db[_0xa17b('0x79')],{'as':_0xa17b('0x161'),'foreignKey':_0xa17b('0x17d')});db[_0xa17b('0x4f')][_0xa17b('0x10c')](db[_0xa17b('0x55')],{'as':_0xa17b('0x150'),'foreignKey':_0xa17b('0x17d')});db[_0xa17b('0x4f')][_0xa17b('0x10c')](db[_0xa17b('0x53')],{'as':'Interactions'});db[_0xa17b('0x4f')][_0xa17b('0x10c')](db[_0xa17b('0x51')],{'as':'Applications'});db[_0xa17b('0x4f')][_0xa17b('0x117')](db[_0xa17b('0xec')],{'as':_0xa17b('0x163'),'foreignKey':_0xa17b('0x164')});db['SmsAccount']['belongsTo'](db[_0xa17b('0x80')],{'as':'mandatoryDispositionPause','foreignKey':_0xa17b('0x167')});db[_0xa17b('0x4f')][_0xa17b('0x11c')](db[_0xa17b('0x13')],{'as':_0xa17b('0x14d'),'through':'user_has_sms_accounts'});db[_0xa17b('0x51')][_0xa17b('0x117')](db[_0xa17b('0x13')],{'onDelete':_0xa17b('0x172')});db['SmsApplication']['belongsTo'](db[_0xa17b('0x57')],{'onDelete':'restrict'});db[_0xa17b('0x51')][_0xa17b('0x117')](db[_0xa17b('0x4f')],{'onDelete':_0xa17b('0x172')});db[_0xa17b('0x51')][_0xa17b('0x117')](db[_0xa17b('0x7e')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xa17b('0x51')][_0xa17b('0x117')](db[_0xa17b('0x89')],{'onDelete':_0xa17b('0x172'),'foreignKey':_0xa17b('0x173')});db[_0xa17b('0x53')][_0xa17b('0x10c')](db[_0xa17b('0x55')],{'as':_0xa17b('0x150'),'onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x17e')});db[_0xa17b('0x53')][_0xa17b('0x117')](db[_0xa17b('0x4f')],{'as':_0xa17b('0x170'),'foreignKey':'SmsAccountId'});db[_0xa17b('0x53')][_0xa17b('0x117')](db[_0xa17b('0x6e')],{'as':_0xa17b('0x158'),'foreignKey':_0xa17b('0x159')});db[_0xa17b('0x53')][_0xa17b('0x117')](db[_0xa17b('0x13')],{'as':_0xa17b('0x177'),'foreignKey':_0xa17b('0x109')});db[_0xa17b('0x53')][_0xa17b('0x11c')](db[_0xa17b('0x89')],{'through':_0xa17b('0x17f'),'as':'Tags'});db['SmsInteraction']['belongsToMany'](db['Tag'],{'through':'sms_interaction_has_tags','as':_0xa17b('0x179')});db[_0xa17b('0x53')][_0xa17b('0x11c')](db[_0xa17b('0x13')],{'as':_0xa17b('0x16d'),'through':'user_has_sms_interactions','foreignKey':_0xa17b('0x17e')});db[_0xa17b('0x55')][_0xa17b('0x117')](db[_0xa17b('0x13')],{'as':'User'});db[_0xa17b('0x55')][_0xa17b('0x117')](db[_0xa17b('0x6e')],{'onDelete':_0xa17b('0x108'),'as':_0xa17b('0x158')});db[_0xa17b('0x55')][_0xa17b('0x117')](db[_0xa17b('0x53')],{'onDelete':_0xa17b('0x108'),'as':_0xa17b('0x16f'),'foreignKey':_0xa17b('0x17e')});db[_0xa17b('0x55')][_0xa17b('0x117')](db[_0xa17b('0x4f')],{'as':_0xa17b('0x170'),'foreignKey':_0xa17b('0x17d')});db[_0xa17b('0x57')][_0xa17b('0x11c')](db['User'],{'as':_0xa17b('0x14d'),'through':_0xa17b('0x12c'),'foreignKey':_0xa17b('0x180')});db[_0xa17b('0x57')][_0xa17b('0x11c')](db[_0xa17b('0xdd')],{'through':_0xa17b('0x181'),'as':_0xa17b('0x14e')});db[_0xa17b('0x135')][_0xa17b('0x10c')](db['Disposition'],{'as':_0xa17b('0x15f'),'foreignKey':_0xa17b('0x182'),'onDelete':_0xa17b('0x108')});db[_0xa17b('0x135')][_0xa17b('0x10c')](db[_0xa17b('0x79')],{'as':'Answers','foreignKey':_0xa17b('0x182')});db[_0xa17b('0x135')]['hasMany'](db[_0xa17b('0x5b')],{'as':_0xa17b('0x162'),'foreignKey':_0xa17b('0x182')});db[_0xa17b('0x135')]['hasMany'](db[_0xa17b('0x5d')],{'as':_0xa17b('0x150'),'foreignKey':_0xa17b('0x182')});db[_0xa17b('0x135')][_0xa17b('0x10c')](db[_0xa17b('0x59')],{'as':_0xa17b('0x140'),'foreignKey':_0xa17b('0x182')});db[_0xa17b('0x135')][_0xa17b('0x117')](db['CmList'],{'as':_0xa17b('0x163'),'foreignKey':'ListId'});db['OpenchannelAccount'][_0xa17b('0x117')](db[_0xa17b('0x80')],{'as':'mandatoryDispositionPause','foreignKey':_0xa17b('0x167')});db['OpenchannelAccount']['belongsToMany'](db[_0xa17b('0x13')],{'as':_0xa17b('0x14d'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0xa17b('0x117')](db[_0xa17b('0x13')],{'onDelete':_0xa17b('0x172')});db[_0xa17b('0x59')][_0xa17b('0x117')](db['OpenchannelQueue'],{'onDelete':_0xa17b('0x172'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelApplication'][_0xa17b('0x117')](db[_0xa17b('0x135')],{'onDelete':_0xa17b('0x172'),'foreignKey':_0xa17b('0x182')});db[_0xa17b('0x59')][_0xa17b('0x117')](db[_0xa17b('0x7e')],{'onDelete':_0xa17b('0x172'),'foreignKey':_0xa17b('0x14b')});db[_0xa17b('0x59')]['belongsTo'](db[_0xa17b('0x89')],{'onDelete':'restrict','foreignKey':_0xa17b('0x173')});db[_0xa17b('0x5b')][_0xa17b('0x10c')](db[_0xa17b('0x5d')],{'as':'Messages','onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x183')});db[_0xa17b('0x5b')][_0xa17b('0x117')](db[_0xa17b('0x135')],{'as':_0xa17b('0x170'),'foreignKey':_0xa17b('0x182')});db['OpenchannelInteraction'][_0xa17b('0x117')](db[_0xa17b('0x6e')],{'as':_0xa17b('0x158'),'foreignKey':'ContactId'});db[_0xa17b('0x5b')][_0xa17b('0x117')](db[_0xa17b('0x13')],{'as':_0xa17b('0x177'),'foreignKey':'UserId'});db[_0xa17b('0x5b')][_0xa17b('0x11c')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':'Tags'});db[_0xa17b('0x5b')][_0xa17b('0x11c')](db[_0xa17b('0x89')],{'through':_0xa17b('0x184'),'as':_0xa17b('0x179')});db[_0xa17b('0x5b')][_0xa17b('0x11c')](db['User'],{'as':'Users','through':_0xa17b('0x125'),'foreignKey':_0xa17b('0x183')});db[_0xa17b('0x5d')][_0xa17b('0x117')](db['User'],{'onDelete':_0xa17b('0x108'),'as':'User'});db[_0xa17b('0x5d')][_0xa17b('0x117')](db[_0xa17b('0x6e')],{'onDelete':_0xa17b('0x108'),'as':_0xa17b('0x158')});db[_0xa17b('0x5d')][_0xa17b('0x117')](db['OpenchannelInteraction'],{'onDelete':_0xa17b('0x108'),'as':'Interaction','foreignKey':_0xa17b('0x183')});db['OpenchannelMessage']['belongsTo'](db['Attachment'],{'as':_0xa17b('0xe3'),'foreignKey':_0xa17b('0x17a')});db[_0xa17b('0x5d')][_0xa17b('0x117')](db[_0xa17b('0x135')],{'as':'Account','foreignKey':_0xa17b('0x182')});db[_0xa17b('0x5f')][_0xa17b('0x11c')](db[_0xa17b('0x13')],{'as':_0xa17b('0x14d'),'through':_0xa17b('0x12e'),'foreignKey':_0xa17b('0x185')});db['OpenchannelQueue'][_0xa17b('0x11c')](db[_0xa17b('0xdd')],{'through':_0xa17b('0x186'),'as':_0xa17b('0x14e')});db[_0xa17b('0x61')][_0xa17b('0x10c')](db['Disposition'],{'as':_0xa17b('0x15f'),'foreignKey':_0xa17b('0x187'),'onDelete':_0xa17b('0x108')});db['ChatWebsite']['hasMany'](db[_0xa17b('0x79')],{'as':'Answers','foreignKey':_0xa17b('0x187')});db[_0xa17b('0x61')][_0xa17b('0x10c')](db[_0xa17b('0x188')],{'as':_0xa17b('0x189')});db[_0xa17b('0x61')][_0xa17b('0x10c')](db[_0xa17b('0x66')],{'as':'Interactions'});db[_0xa17b('0x61')][_0xa17b('0x10c')](db[_0xa17b('0x18a')],{'as':_0xa17b('0x140')});db[_0xa17b('0x61')][_0xa17b('0x10c')](db[_0xa17b('0x68')],{'as':_0xa17b('0x150')});db[_0xa17b('0x61')]['belongsTo'](db[_0xa17b('0xec')],{'as':'List','foreignKey':_0xa17b('0x164')});db[_0xa17b('0x61')][_0xa17b('0x117')](db['Interval'],{'as':_0xa17b('0x7e'),'foreignKey':_0xa17b('0x14b')});db['ChatWebsite']['belongsTo'](db['MailAccount'],{'as':_0xa17b('0x15a'),'foreignKey':_0xa17b('0x160')});db['ChatWebsite'][_0xa17b('0x117')](db[_0xa17b('0x80')],{'as':_0xa17b('0x166'),'foreignKey':_0xa17b('0x167')});db[_0xa17b('0x61')][_0xa17b('0x11c')](db[_0xa17b('0x13')],{'as':_0xa17b('0x14d'),'through':_0xa17b('0x131')});db['OpenchannelQueueReport'][_0xa17b('0x117')](db[_0xa17b('0x135')],{});db[_0xa17b('0x63')][_0xa17b('0x117')](db[_0xa17b('0xec')],{'as':_0xa17b('0x163'),'foreignKey':_0xa17b('0x164')});db[_0xa17b('0x63')][_0xa17b('0x117')](db[_0xa17b('0x6e')],{'as':'Contact','foreignKey':'ContactId'});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0xa17b('0x63')][_0xa17b('0x117')](db[_0xa17b('0x5d')],{});db['OpenchannelQueueReport'][_0xa17b('0x117')](db['User'],{});db[_0xa17b('0x63')][_0xa17b('0x117')](db[_0xa17b('0x5f')],{});db[_0xa17b('0x18a')]['belongsTo'](db[_0xa17b('0x13')],{'as':_0xa17b('0x18b'),'foreignKey':_0xa17b('0x109'),'onDelete':_0xa17b('0x172')});db[_0xa17b('0x18a')]['belongsTo'](db[_0xa17b('0x18c')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':'restrict'});db['ChatApplication']['belongsTo'](db[_0xa17b('0x61')],{'as':'Website','foreignKey':_0xa17b('0x187'),'onDelete':_0xa17b('0x172')});db[_0xa17b('0x18a')][_0xa17b('0x117')](db[_0xa17b('0x89')],{'onDelete':_0xa17b('0x172'),'foreignKey':_0xa17b('0x173')});db[_0xa17b('0x66')][_0xa17b('0x10c')](db[_0xa17b('0x68')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xa17b('0x18d')});db[_0xa17b('0x66')]['belongsTo'](db[_0xa17b('0x61')],{'as':_0xa17b('0x170'),'foreignKey':_0xa17b('0x187')});db[_0xa17b('0x66')][_0xa17b('0x117')](db[_0xa17b('0x6e')],{'as':_0xa17b('0x158'),'foreignKey':_0xa17b('0x159')});db[_0xa17b('0x66')][_0xa17b('0x117')](db[_0xa17b('0x13')],{'as':_0xa17b('0x177'),'foreignKey':_0xa17b('0x109')});db[_0xa17b('0x66')][_0xa17b('0x11c')](db[_0xa17b('0x89')],{'through':'chat_interaction_has_tags','as':_0xa17b('0x16c')});db[_0xa17b('0x66')][_0xa17b('0x11c')](db[_0xa17b('0x89')],{'through':_0xa17b('0x18e'),'as':'ThroughTags'});db[_0xa17b('0x66')][_0xa17b('0x11c')](db[_0xa17b('0x13')],{'as':_0xa17b('0x16d'),'through':_0xa17b('0x122'),'foreignKey':_0xa17b('0x18d')});db[_0xa17b('0x68')]['belongsTo'](db[_0xa17b('0x13')],{'onDelete':_0xa17b('0x108'),'as':_0xa17b('0x13')});db[_0xa17b('0x68')][_0xa17b('0x117')](db[_0xa17b('0x6e')],{'onDelete':'cascade','as':_0xa17b('0x158'),'foreignKey':'ContactId'});db[_0xa17b('0x68')][_0xa17b('0x117')](db[_0xa17b('0x66')],{'onDelete':_0xa17b('0x108'),'as':'Interaction','foreignKey':_0xa17b('0x18d')});db[_0xa17b('0x68')][_0xa17b('0x117')](db['Attachment'],{'as':'Attachment','foreignKey':_0xa17b('0x17a')});db[_0xa17b('0x68')]['belongsTo'](db[_0xa17b('0x61')],{'as':_0xa17b('0x170'),'foreignKey':_0xa17b('0x187')});db[_0xa17b('0x69')]['hasMany'](db['Attachment'],{'as':_0xa17b('0x16e'),'foreignKey':_0xa17b('0x171'),'onDelete':_0xa17b('0x108'),'hooks':!![]});db[_0xa17b('0x69')][_0xa17b('0x117')](db[_0xa17b('0x6e')],{'onDelete':_0xa17b('0x108'),'as':_0xa17b('0x158'),'foreignKey':_0xa17b('0x159')});db[_0xa17b('0x69')][_0xa17b('0x117')](db['ChatWebsite'],{'as':'Account','foreignKey':_0xa17b('0x187')});db[_0xa17b('0x18c')]['belongsToMany'](db[_0xa17b('0x13')],{'as':_0xa17b('0x14d'),'through':'UserChatQueue','hooks':!![]});db[_0xa17b('0x18c')][_0xa17b('0x11c')](db[_0xa17b('0xdd')],{'through':_0xa17b('0x18f'),'as':_0xa17b('0x14e')});db[_0xa17b('0x6b')][_0xa17b('0x10c')](db[_0xa17b('0xcb')],{'as':_0xa17b('0x150'),'foreignKey':_0xa17b('0x190'),'onDelete':'cascade'});db[_0xa17b('0x6b')]['belongsToMany'](db[_0xa17b('0x13')],{'as':_0xa17b('0x142'),'through':_0xa17b('0x11b')});db[_0xa17b('0x188')]['belongsTo'](db[_0xa17b('0x61')],{'as':_0xa17b('0x191'),'foreignKey':'ChatWebsiteId'});db[_0xa17b('0x6c')][_0xa17b('0x10c')](db['CmContact'],{'as':_0xa17b('0x11d'),'foreignKey':_0xa17b('0x192')});db['CmContact']['hasMany'](db[_0xa17b('0x6f')],{'as':_0xa17b('0x144'),'foreignKey':_0xa17b('0x159')});db['CmContact'][_0xa17b('0x10c')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xa17b('0x159')});db[_0xa17b('0x6e')][_0xa17b('0x10c')](db['CmHopperHistory'],{'as':_0xa17b('0x146'),'foreignKey':_0xa17b('0x159')});db[_0xa17b('0x6e')][_0xa17b('0x10c')](db[_0xa17b('0x76')],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db[_0xa17b('0x6e')][_0xa17b('0x10c')](db[_0xa17b('0xd0')],{'as':_0xa17b('0x193'),'foreignKey':_0xa17b('0x159')});db[_0xa17b('0x6e')][_0xa17b('0x10c')](db[_0xa17b('0x5b')],{'as':'OpenchannelInteractions','foreignKey':_0xa17b('0x159'),'onDelete':_0xa17b('0x172')});db[_0xa17b('0x6e')]['hasMany'](db['ChatInteraction'],{'as':_0xa17b('0x111'),'foreignKey':_0xa17b('0x159'),'onDelete':_0xa17b('0x172')});db['CmContact']['hasMany'](db[_0xa17b('0x53')],{'as':_0xa17b('0x112'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xa17b('0x6e')][_0xa17b('0x10c')](db[_0xa17b('0x113')],{'as':_0xa17b('0x123'),'foreignKey':_0xa17b('0x159'),'onDelete':'restrict'});db[_0xa17b('0x6e')][_0xa17b('0x10c')](db['MailInteraction'],{'as':_0xa17b('0x120'),'foreignKey':_0xa17b('0x159'),'onDelete':_0xa17b('0x172')});db[_0xa17b('0x6e')][_0xa17b('0x117')](db[_0xa17b('0x6c')],{'as':_0xa17b('0x194'),'foreignKey':_0xa17b('0x192')});db[_0xa17b('0x6e')][_0xa17b('0x117')](db[_0xa17b('0xec')],{'as':'List','foreignKey':_0xa17b('0x164'),'onDelete':'cascade'});db['CmContact'][_0xa17b('0x11c')](db[_0xa17b('0x13')],{'as':_0xa17b('0x16d'),'through':'cm_user_has_contacts'});db['CmContact'][_0xa17b('0x11c')](db[_0xa17b('0x89')],{'as':_0xa17b('0x16c'),'through':_0xa17b('0x195')});db[_0xa17b('0x6e')][_0xa17b('0x11c')](db['Tag'],{'through':_0xa17b('0x195'),'as':_0xa17b('0x179')});db[_0xa17b('0x6f')][_0xa17b('0x117')](db[_0xa17b('0x6e')],{'as':_0xa17b('0x158'),'foreignKey':_0xa17b('0x159'),'onDelete':_0xa17b('0x108')});db[_0xa17b('0x6f')][_0xa17b('0x117')](db[_0xa17b('0xec')],{'as':_0xa17b('0x163'),'foreignKey':_0xa17b('0x164'),'onDelete':_0xa17b('0x108')});db[_0xa17b('0x6f')][_0xa17b('0x117')](db[_0xa17b('0x13')],{'as':_0xa17b('0x18b'),'foreignKey':'UserId'});db[_0xa17b('0x6f')]['belongsTo'](db[_0xa17b('0x19')],{'as':_0xa17b('0x196'),'foreignKey':_0xa17b('0x143'),'onDelete':'cascade'});db[_0xa17b('0x6f')]['belongsTo'](db['Campaign'],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0xa17b('0x108')});db['CmHopper'][_0xa17b('0x117')](db[_0xa17b('0x13')],{'as':_0xa17b('0x177'),'foreignKey':'OwnerId'});db['CmHopperBlack']['belongsTo'](db[_0xa17b('0x6e')],{'as':_0xa17b('0x158'),'foreignKey':_0xa17b('0x159'),'onDelete':'cascade'});db[_0xa17b('0x71')][_0xa17b('0x117')](db[_0xa17b('0xec')],{'as':_0xa17b('0x163'),'foreignKey':_0xa17b('0x164'),'onDelete':'cascade'});db['CmHopperBlack'][_0xa17b('0x117')](db[_0xa17b('0x19')],{'as':_0xa17b('0x196'),'foreignKey':_0xa17b('0x143'),'onDelete':_0xa17b('0x108')});db[_0xa17b('0x71')][_0xa17b('0x117')](db[_0xa17b('0xdf')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':'cascade'});db[_0xa17b('0x78')]['hasMany'](db[_0xa17b('0x7d')],{'as':{'plural':_0xa17b('0x197'),'singular':'OneAll'},'foreignKey':_0xa17b('0x198'),'onDelete':_0xa17b('0x108'),'hooks':!![]});db[_0xa17b('0x78')][_0xa17b('0x10c')](db[_0xa17b('0x7d')],{'as':{'plural':_0xa17b('0x199'),'singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0xa17b('0x108'),'hooks':!![]});db[_0xa17b('0x78')][_0xa17b('0x10c')](db[_0xa17b('0x19a')],{'as':_0xa17b('0x19b'),'foreignKey':_0xa17b('0x19c'),'onDelete':_0xa17b('0x108'),'hooks':!![]});db[_0xa17b('0x7b')][_0xa17b('0x10c')](db[_0xa17b('0x7b')],{'as':_0xa17b('0x15f'),'foreignKey':_0xa17b('0x19d'),'onDelete':'cascade'});db['Interval']['hasMany'](db[_0xa17b('0x7e')],{'as':_0xa17b('0x19e'),'foreignKey':_0xa17b('0x14b'),'onDelete':_0xa17b('0x108'),'hooks':!![],'required':![]});db[_0xa17b('0x7e')][_0xa17b('0x10c')](db[_0xa17b('0x16')],{'as':_0xa17b('0x10d'),'foreignKey':_0xa17b('0x14b'),'onDelete':_0xa17b('0x172')});db[_0xa17b('0x7e')][_0xa17b('0x10c')](db[_0xa17b('0x3e')],{'as':_0xa17b('0x19f'),'foreignKey':_0xa17b('0x14b')});db[_0xa17b('0x7e')][_0xa17b('0x10c')](db[_0xa17b('0x18a')],{'as':_0xa17b('0x1a0'),'foreignKey':_0xa17b('0x14b')});db['Interval'][_0xa17b('0x10c')](db[_0xa17b('0x47')],{'as':'FaxApplications','foreignKey':_0xa17b('0x14b')});db[_0xa17b('0x7e')]['hasMany'](db[_0xa17b('0x51')],{'as':_0xa17b('0x1a1'),'foreignKey':_0xa17b('0x14b')});db[_0xa17b('0x86')]['belongsTo'](db[_0xa17b('0x15a')],{});db['Schedule'][_0xa17b('0x117')](db[_0xa17b('0x1a2')],{'foreignKey':'DefaultReportId'});db[_0xa17b('0x86')][_0xa17b('0x117')](db[_0xa17b('0x93')],{'foreignKey':_0xa17b('0x1a3')});db[_0xa17b('0x1a4')][_0xa17b('0x11c')](db[_0xa17b('0x18')],{'as':_0xa17b('0x1a5'),'through':'moh_has_sounds','onDelete':'restrict'});db[_0xa17b('0x89')][_0xa17b('0x11c')](db[_0xa17b('0x6e')],{'through':_0xa17b('0x195')});db[_0xa17b('0x89')][_0xa17b('0x11c')](db[_0xa17b('0x66')],{'through':_0xa17b('0x18e')});db[_0xa17b('0x89')][_0xa17b('0x11c')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0xa17b('0x89')]['belongsToMany'](db[_0xa17b('0x53')],{'through':'sms_interaction_has_tags'});db[_0xa17b('0x89')]['belongsToMany'](db[_0xa17b('0x113')],{'through':_0xa17b('0x178')});db[_0xa17b('0x89')][_0xa17b('0x11c')](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db[_0xa17b('0x89')]['belongsToMany'](db[_0xa17b('0xf8')],{'through':_0xa17b('0x1a6')});db[_0xa17b('0x8c')][_0xa17b('0x10c')](db['Condition'],{'as':{'plural':_0xa17b('0x1a7'),'singular':'AllCondition'},'foreignKey':_0xa17b('0x1a8'),'onDelete':_0xa17b('0x108'),'hooks':!![]});db[_0xa17b('0x8c')][_0xa17b('0x10c')](db[_0xa17b('0x7d')],{'as':{'plural':_0xa17b('0x1a9'),'singular':_0xa17b('0x1aa')},'foreignKey':_0xa17b('0x1ab'),'onDelete':_0xa17b('0x108'),'hooks':!![]});db[_0xa17b('0x8c')]['hasMany'](db[_0xa17b('0x19a')],{'as':_0xa17b('0x19b'),'foreignKey':'TriggerId','onDelete':_0xa17b('0x108'),'hooks':!![]});db[_0xa17b('0x93')][_0xa17b('0x10c')](db[_0xa17b('0x97')],{'as':_0xa17b('0x1ac'),'onDelete':_0xa17b('0x108'),'foreignKey':'CustomReportId','hooks':!![]});db[_0xa17b('0x1a2')][_0xa17b('0x10c')](db['AnalyticFieldReport'],{'as':_0xa17b('0x1ac'),'onDelete':_0xa17b('0x108'),'foreignKey':'DefaultReportId'});db[_0xa17b('0x1ad')][_0xa17b('0x10c')](db[_0xa17b('0x97')],{'as':_0xa17b('0x1ac'),'onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x1ae')});db[_0xa17b('0x97')][_0xa17b('0x117')](db[_0xa17b('0x1ad')],{'foreignKey':_0xa17b('0x1ae')});db[_0xa17b('0x9a')][_0xa17b('0x10c')](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x1af')});db[_0xa17b('0x9b')][_0xa17b('0x10c')](db[_0xa17b('0x9c')],{'as':_0xa17b('0x1b0'),'onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x1b1')});db['SalesforceConfiguration']['hasMany'](db[_0xa17b('0x9c')],{'as':'Descriptions','onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x1b2')});db['SalesforceConfiguration'][_0xa17b('0x10c')](db['SalesforceField'],{'as':_0xa17b('0x1ac'),'onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x1b3')});db['SalesforceConfiguration']['belongsTo'](db['SalesforceAccount'],{'as':_0xa17b('0x170'),'foreignKey':'AccountId'});db[_0xa17b('0x9c')]['hasMany'](db['SalesforceField'],{'as':_0xa17b('0x1b4'),'foreignKey':_0xa17b('0x1b1')});db[_0xa17b('0x9c')][_0xa17b('0x10c')](db[_0xa17b('0x9c')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xa17b('0x9c')][_0xa17b('0x10c')](db['SalesforceField'],{'as':'Field','foreignKey':'FieldId'});db[_0xa17b('0x9c')][_0xa17b('0x117')](db[_0xa17b('0x8e')],{'as':_0xa17b('0x8e'),'foreignKey':_0xa17b('0x1b5')});db[_0xa17b('0x9e')][_0xa17b('0x10c')](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x1af')});db[_0xa17b('0xa0')][_0xa17b('0x10c')](db[_0xa17b('0xa1')],{'as':'Subjects','onDelete':_0xa17b('0x108'),'foreignKey':'SubjectId'});db[_0xa17b('0xa0')]['hasMany'](db[_0xa17b('0xa1')],{'as':_0xa17b('0x1b6'),'onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x1b2')});db['SugarcrmConfiguration'][_0xa17b('0x10c')](db[_0xa17b('0xa1')],{'as':_0xa17b('0x1ac'),'onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x1b3')});db[_0xa17b('0xa0')][_0xa17b('0x117')](db[_0xa17b('0x9e')],{'as':_0xa17b('0x170'),'foreignKey':_0xa17b('0x1af')});db['SugarcrmField']['hasMany'](db[_0xa17b('0xa1')],{'as':_0xa17b('0x1b4'),'foreignKey':_0xa17b('0x1b1')});db[_0xa17b('0xa1')][_0xa17b('0x10c')](db[_0xa17b('0xa1')],{'as':_0xa17b('0x1b7'),'foreignKey':'DescriptionId'});db['SugarcrmField'][_0xa17b('0x10c')](db[_0xa17b('0xa1')],{'as':_0xa17b('0x1b8'),'foreignKey':_0xa17b('0x1b3')});db[_0xa17b('0xa1')][_0xa17b('0x117')](db[_0xa17b('0x8e')],{'as':_0xa17b('0x8e'),'foreignKey':_0xa17b('0x1b5')});db['DeskAccount'][_0xa17b('0x10c')](db[_0xa17b('0xa5')],{'as':_0xa17b('0x1b9'),'onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x1af')});db[_0xa17b('0xa5')][_0xa17b('0x10c')](db[_0xa17b('0xa7')],{'as':_0xa17b('0x1b0'),'onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x1b1')});db[_0xa17b('0xa5')][_0xa17b('0x10c')](db[_0xa17b('0xa7')],{'as':_0xa17b('0x1b6'),'onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x1b2')});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':_0xa17b('0x1ac'),'onDelete':'cascade','foreignKey':_0xa17b('0x1b3')});db['DeskConfiguration'][_0xa17b('0x117')](db[_0xa17b('0xa3')],{'as':_0xa17b('0x170'),'foreignKey':_0xa17b('0x1af')});db[_0xa17b('0xa5')]['belongsToMany'](db['Tag'],{'through':_0xa17b('0x1ba')});db[_0xa17b('0xa7')][_0xa17b('0x10c')](db[_0xa17b('0xa7')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xa17b('0xa7')][_0xa17b('0x10c')](db[_0xa17b('0xa7')],{'as':_0xa17b('0x1b7'),'foreignKey':'DescriptionId'});db[_0xa17b('0xa7')][_0xa17b('0x10c')](db[_0xa17b('0xa7')],{'as':_0xa17b('0x1b8'),'foreignKey':_0xa17b('0x1b3')});db['DeskField']['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0xa17b('0x1b5')});db['ZohoAccount'][_0xa17b('0x10c')](db['ZohoConfiguration'],{'as':_0xa17b('0x1b9'),'onDelete':_0xa17b('0x108'),'foreignKey':'AccountId'});db[_0xa17b('0x1bb')][_0xa17b('0x10c')](db[_0xa17b('0xab')],{'as':_0xa17b('0x1b0'),'onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x1b1')});db[_0xa17b('0x1bb')][_0xa17b('0x10c')](db['ZohoField'],{'as':'Descriptions','onDelete':_0xa17b('0x108'),'foreignKey':'DescriptionId'});db[_0xa17b('0x1bb')][_0xa17b('0x10c')](db[_0xa17b('0xab')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xa17b('0x1b3')});db[_0xa17b('0x1bb')][_0xa17b('0x117')](db[_0xa17b('0xa9')],{'as':_0xa17b('0x170'),'foreignKey':_0xa17b('0x1af')});db[_0xa17b('0xab')][_0xa17b('0x10c')](db['ZohoField'],{'as':_0xa17b('0x1b4'),'foreignKey':'SubjectId'});db['ZohoField'][_0xa17b('0x10c')](db['ZohoField'],{'as':_0xa17b('0x1b7'),'foreignKey':'DescriptionId'});db[_0xa17b('0xab')][_0xa17b('0x10c')](db['ZohoField'],{'as':_0xa17b('0x1b8'),'foreignKey':_0xa17b('0x1b3')});db[_0xa17b('0xab')][_0xa17b('0x117')](db[_0xa17b('0x8e')],{'as':_0xa17b('0x8e'),'foreignKey':_0xa17b('0x1b5')});db[_0xa17b('0xac')][_0xa17b('0x10c')](db[_0xa17b('0xae')],{'as':'Configurations','onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x1af')});db['ZendeskConfiguration'][_0xa17b('0x10c')](db[_0xa17b('0x1bc')],{'as':_0xa17b('0x1b0'),'foreignKey':_0xa17b('0x1b1')});db[_0xa17b('0xae')][_0xa17b('0x10c')](db[_0xa17b('0x1bc')],{'as':_0xa17b('0x1b6'),'foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0xa17b('0x10c')](db['ZendeskField'],{'as':_0xa17b('0x1ac'),'foreignKey':_0xa17b('0x1b3')});db[_0xa17b('0xae')]['belongsTo'](db[_0xa17b('0xac')],{'as':_0xa17b('0x170'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0xa17b('0x11c')](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db[_0xa17b('0x1bc')][_0xa17b('0x10c')](db[_0xa17b('0x1bc')],{'as':'Subject','foreignKey':_0xa17b('0x1b1')});db['ZendeskField'][_0xa17b('0x10c')](db[_0xa17b('0x1bc')],{'as':_0xa17b('0x1b7'),'foreignKey':'DescriptionId'});db[_0xa17b('0x1bc')]['hasMany'](db['ZendeskField'],{'as':_0xa17b('0x1b8'),'foreignKey':_0xa17b('0x1b3')});db[_0xa17b('0x1bc')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0xa17b('0x1b5')});db['FreshdeskAccount'][_0xa17b('0x10c')](db['FreshdeskConfiguration'],{'as':_0xa17b('0x1b9'),'onDelete':_0xa17b('0x108'),'foreignKey':'AccountId'});db[_0xa17b('0x1bd')]['hasMany'](db[_0xa17b('0xb3')],{'as':_0xa17b('0x1b0'),'onDelete':_0xa17b('0x108'),'foreignKey':'SubjectId'});db[_0xa17b('0x1bd')]['hasMany'](db[_0xa17b('0xb3')],{'as':'Descriptions','onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x1b2')});db['FreshdeskConfiguration'][_0xa17b('0x10c')](db[_0xa17b('0xb3')],{'as':_0xa17b('0x1ac'),'onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x1b3')});db[_0xa17b('0x1bd')][_0xa17b('0x117')](db[_0xa17b('0xb0')],{'as':_0xa17b('0x170'),'foreignKey':_0xa17b('0x1af')});db[_0xa17b('0x1bd')]['belongsToMany'](db[_0xa17b('0x89')],{'through':_0xa17b('0x1be')});db[_0xa17b('0xb3')]['hasMany'](db[_0xa17b('0xb3')],{'as':_0xa17b('0x1b4'),'foreignKey':'SubjectId'});db['FreshdeskField'][_0xa17b('0x10c')](db[_0xa17b('0xb3')],{'as':_0xa17b('0x1b7'),'foreignKey':'DescriptionId'});db[_0xa17b('0xb3')][_0xa17b('0x10c')](db[_0xa17b('0xb3')],{'as':_0xa17b('0x1b8'),'foreignKey':_0xa17b('0x1b3')});db[_0xa17b('0xb3')][_0xa17b('0x117')](db[_0xa17b('0x8e')],{'as':'Variable','foreignKey':_0xa17b('0x1b5')});db[_0xa17b('0xb5')]['hasMany'](db[_0xa17b('0xb7')],{'as':_0xa17b('0x1b9'),'onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x1af')});db[_0xa17b('0xb7')][_0xa17b('0x10c')](db[_0xa17b('0xb9')],{'as':'Subjects','foreignKey':_0xa17b('0x1b1')});db[_0xa17b('0xb7')][_0xa17b('0x10c')](db[_0xa17b('0xb9')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0xa17b('0xb7')][_0xa17b('0x10c')](db['VtigerField'],{'as':_0xa17b('0x1ac'),'foreignKey':_0xa17b('0x1b3')});db[_0xa17b('0xb7')][_0xa17b('0x117')](db[_0xa17b('0xb5')],{'as':_0xa17b('0x170'),'foreignKey':_0xa17b('0x1af')});db[_0xa17b('0xb9')]['hasMany'](db[_0xa17b('0xb9')],{'as':_0xa17b('0x1b4'),'foreignKey':_0xa17b('0x1b1')});db[_0xa17b('0xb9')][_0xa17b('0x10c')](db[_0xa17b('0xb9')],{'as':'Description','foreignKey':_0xa17b('0x1b2')});db[_0xa17b('0xb9')][_0xa17b('0x10c')](db[_0xa17b('0xb9')],{'as':_0xa17b('0x1b8'),'foreignKey':_0xa17b('0x1b3')});db['VtigerField'][_0xa17b('0x117')](db[_0xa17b('0x8e')],{'as':_0xa17b('0x8e'),'foreignKey':_0xa17b('0x1b5')});db['ServicenowAccount'][_0xa17b('0x10c')](db[_0xa17b('0x1bf')],{'as':_0xa17b('0x1b9'),'onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x1af')});db[_0xa17b('0x1bf')][_0xa17b('0x10c')](db[_0xa17b('0xbd')],{'as':_0xa17b('0x1b0'),'foreignKey':_0xa17b('0x1b1')});db[_0xa17b('0x1bf')][_0xa17b('0x10c')](db['ServicenowField'],{'as':_0xa17b('0x1b6'),'foreignKey':_0xa17b('0x1b2')});db[_0xa17b('0x1bf')][_0xa17b('0x10c')](db[_0xa17b('0xbd')],{'as':'Fields','foreignKey':_0xa17b('0x1b3')});db[_0xa17b('0x1bf')][_0xa17b('0x117')](db[_0xa17b('0xba')],{'as':_0xa17b('0x170'),'foreignKey':_0xa17b('0x1af')});db['ServicenowField'][_0xa17b('0x10c')](db['ServicenowField'],{'as':_0xa17b('0x1b4'),'foreignKey':_0xa17b('0x1b1')});db[_0xa17b('0xbd')]['hasMany'](db[_0xa17b('0xbd')],{'as':_0xa17b('0x1b7'),'foreignKey':_0xa17b('0x1b2')});db[_0xa17b('0xbd')][_0xa17b('0x10c')](db[_0xa17b('0xbd')],{'as':_0xa17b('0x1b8'),'foreignKey':_0xa17b('0x1b3')});db[_0xa17b('0xbd')][_0xa17b('0x117')](db['Variable'],{'as':_0xa17b('0x8e'),'foreignKey':_0xa17b('0x1b5')});db[_0xa17b('0x1c0')][_0xa17b('0x10c')](db[_0xa17b('0xc0')],{'as':_0xa17b('0x1b9'),'onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x1af')});db[_0xa17b('0xc0')][_0xa17b('0x10c')](db[_0xa17b('0xc2')],{'as':_0xa17b('0x1b0'),'onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x1b1')});db['Dynamics365Configuration'][_0xa17b('0x10c')](db[_0xa17b('0xc2')],{'as':_0xa17b('0x1b6'),'onDelete':_0xa17b('0x108'),'foreignKey':'DescriptionId'});db['Dynamics365Configuration'][_0xa17b('0x10c')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x1b3')});db[_0xa17b('0xc0')][_0xa17b('0x117')](db[_0xa17b('0x1c0')],{'as':_0xa17b('0x170'),'foreignKey':_0xa17b('0x1af')});db[_0xa17b('0xc2')][_0xa17b('0x10c')](db['Dynamics365Field'],{'as':_0xa17b('0x1b4'),'foreignKey':_0xa17b('0x1b1')});db[_0xa17b('0xc2')][_0xa17b('0x10c')](db[_0xa17b('0xc2')],{'as':_0xa17b('0x1b7'),'foreignKey':'DescriptionId'});db[_0xa17b('0xc2')][_0xa17b('0x10c')](db['Dynamics365Field'],{'as':_0xa17b('0x1b8'),'foreignKey':_0xa17b('0x1b3')});db['Dynamics365Field']['belongsTo'](db[_0xa17b('0x8e')],{'as':_0xa17b('0x8e'),'foreignKey':_0xa17b('0x1b5')});db['FreshsalesAccount']['hasMany'](db[_0xa17b('0x1c1')],{'as':'Configurations','onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x1af')});db['FreshsalesConfiguration'][_0xa17b('0x10c')](db[_0xa17b('0xc5')],{'as':_0xa17b('0x1b0'),'foreignKey':_0xa17b('0x1b1')});db[_0xa17b('0x1c1')]['hasMany'](db[_0xa17b('0xc5')],{'as':_0xa17b('0x1b6'),'foreignKey':_0xa17b('0x1b2')});db[_0xa17b('0x1c1')][_0xa17b('0x10c')](db[_0xa17b('0xc5')],{'as':_0xa17b('0x1ac'),'foreignKey':'FieldId'});db[_0xa17b('0x1c1')][_0xa17b('0x117')](db[_0xa17b('0x1c2')],{'as':_0xa17b('0x170'),'foreignKey':_0xa17b('0x1af')});db['FreshsalesField'][_0xa17b('0x10c')](db[_0xa17b('0xc5')],{'as':_0xa17b('0x1b4'),'foreignKey':'SubjectId'});db[_0xa17b('0xc5')]['hasMany'](db[_0xa17b('0xc5')],{'as':_0xa17b('0x1b7'),'foreignKey':_0xa17b('0x1b2')});db['FreshsalesField'][_0xa17b('0x10c')](db['FreshsalesField'],{'as':_0xa17b('0x1b8'),'foreignKey':_0xa17b('0x1b3')});db[_0xa17b('0xc5')][_0xa17b('0x117')](db[_0xa17b('0x8e')],{'as':'Variable','foreignKey':'VariableId'});db[_0xa17b('0xc9')][_0xa17b('0x117')](db[_0xa17b('0x61')],{});db[_0xa17b('0xc9')][_0xa17b('0x117')](db[_0xa17b('0xec')],{'as':_0xa17b('0x163'),'foreignKey':_0xa17b('0x164')});db['ChatQueueReport']['belongsTo'](db[_0xa17b('0x6e')],{'as':_0xa17b('0x158'),'foreignKey':'ContactId'});db[_0xa17b('0xc9')][_0xa17b('0x117')](db[_0xa17b('0x66')],{});db[_0xa17b('0xc9')][_0xa17b('0x117')](db[_0xa17b('0x68')],{});db[_0xa17b('0xc9')][_0xa17b('0x117')](db[_0xa17b('0x13')],{});db['ChatQueueReport'][_0xa17b('0x117')](db[_0xa17b('0x18c')],{});db['ChatInternalMessage']['belongsTo'](db[_0xa17b('0x13')],{'onDelete':'cascade','foreignKey':_0xa17b('0x1c3')});db[_0xa17b('0xcb')]['belongsTo'](db['User'],{'onDelete':'cascade','foreignKey':'ToId'});db[_0xa17b('0xd0')][_0xa17b('0x10c')](db[_0xa17b('0x1c4')],{'foreignKey':'SessionId','onDelete':_0xa17b('0x108')});db[_0xa17b('0xd0')][_0xa17b('0x10c')](db['JscriptyAnswerReport'],{'foreignKey':_0xa17b('0x1c5'),'onDelete':'cascade'});db[_0xa17b('0x1c6')]['belongsTo'](db[_0xa17b('0x4f')],{});db[_0xa17b('0x1c6')]['belongsTo'](db['CmList'],{'as':_0xa17b('0x163'),'foreignKey':_0xa17b('0x164')});db[_0xa17b('0x1c6')][_0xa17b('0x117')](db[_0xa17b('0x6e')],{'as':'Contact','foreignKey':_0xa17b('0x159')});db[_0xa17b('0x1c6')][_0xa17b('0x117')](db['SmsInteraction'],{});db[_0xa17b('0x1c6')][_0xa17b('0x117')](db[_0xa17b('0x55')],{});db['SmsQueueReport'][_0xa17b('0x117')](db['User'],{});db[_0xa17b('0x1c6')]['belongsTo'](db[_0xa17b('0x57')],{});db['JscriptyProject'][_0xa17b('0x10c')](db[_0xa17b('0xd0')],{'foreignKey':_0xa17b('0x1c7')});db[_0xa17b('0xd4')][_0xa17b('0x10c')](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db[_0xa17b('0xd4')][_0xa17b('0x10c')](db['JscriptyAnswerReport'],{'foreignKey':_0xa17b('0x1c7')});db['SquareProject'][_0xa17b('0x11c')](db['User'],{'as':'Users','through':_0xa17b('0x13c')});db[_0xa17b('0xdd')]['belongsToMany'](db[_0xa17b('0x13')],{'as':_0xa17b('0x14d'),'through':_0xa17b('0x1c8')});db[_0xa17b('0xdd')][_0xa17b('0x11c')](db[_0xa17b('0x19')],{'through':_0xa17b('0x102'),'as':_0xa17b('0x127')});db[_0xa17b('0xdd')][_0xa17b('0x11c')](db[_0xa17b('0x128')],{'through':_0xa17b('0x169'),'as':_0xa17b('0x129')});db[_0xa17b('0xdd')]['belongsToMany'](db[_0xa17b('0x18c')],{'through':'team_has_chat_queues','as':_0xa17b('0x1c9')});db[_0xa17b('0xdd')][_0xa17b('0x11c')](db[_0xa17b('0x4b')],{'through':_0xa17b('0x17c'),'as':'FaxQueues'});db['Team'][_0xa17b('0x11c')](db[_0xa17b('0x57')],{'through':_0xa17b('0x181'),'as':'SmsQueues'});db[_0xa17b('0xdd')]['belongsToMany'](db['OpenchannelQueue'],{'through':_0xa17b('0x186'),'as':_0xa17b('0x12d')});db[_0xa17b('0xdd')]['belongsToMany'](db[_0xa17b('0xfe')],{'through':_0xa17b('0x1ca'),'as':_0xa17b('0x1cb')});db[_0xa17b('0xdd')][_0xa17b('0x11c')](db[_0xa17b('0xee')],{'through':_0xa17b('0x1cc'),'as':_0xa17b('0x1cd')});db[_0xa17b('0xdf')]['hasMany'](db[_0xa17b('0x6f')],{'as':_0xa17b('0x144'),'foreignKey':_0xa17b('0x1ce')});db[_0xa17b('0xdf')][_0xa17b('0x10c')](db['CmHopperFinal'],{'as':_0xa17b('0x10e'),'foreignKey':'CampaignId'});db[_0xa17b('0xdf')][_0xa17b('0x10c')](db[_0xa17b('0x145')],{'as':'HopperHistories','foreignKey':_0xa17b('0x1ce')});db['Campaign'][_0xa17b('0x10c')](db[_0xa17b('0x71')],{'as':_0xa17b('0x147'),'foreignKey':_0xa17b('0x1ce')});db[_0xa17b('0xdf')][_0xa17b('0x117')](db[_0xa17b('0x26')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0xa17b('0xdf')][_0xa17b('0x117')](db[_0xa17b('0x26')],{'as':_0xa17b('0x149'),'foreignKey':_0xa17b('0x14a')});db[_0xa17b('0xdf')][_0xa17b('0x117')](db[_0xa17b('0x7e')],{'as':_0xa17b('0x7e'),'foreignKey':_0xa17b('0x14b')});db['Campaign'][_0xa17b('0x117')](db['SquareProject'],{'as':'SquareProject','foreignKey':_0xa17b('0x1cf')});db[_0xa17b('0xdf')][_0xa17b('0x11c')](db[_0xa17b('0xec')],{'as':_0xa17b('0x11f'),'through':_0xa17b('0x1d0')});db[_0xa17b('0xdf')]['belongsToMany'](db[_0xa17b('0xec')],{'as':_0xa17b('0x1d1'),'through':_0xa17b('0x1d2')});db['Attachment']['belongsTo'](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0xa17b('0x171')});db[_0xa17b('0x1d3')][_0xa17b('0x117')](db['MailMessage'],{});db[_0xa17b('0x1d3')][_0xa17b('0x117')](db[_0xa17b('0x3b')],{});db['MailTransferReport']['belongsTo'](db[_0xa17b('0x15a')],{'foreignKey':'FromMailAccountId','as':_0xa17b('0x1d4')});db[_0xa17b('0x1d3')][_0xa17b('0x117')](db[_0xa17b('0x13')],{'foreignKey':_0xa17b('0x1d5'),'as':_0xa17b('0x1d6')});db['MailTransferReport']['belongsTo'](db[_0xa17b('0x13')],{'foreignKey':'ToUserId','as':_0xa17b('0x1d7')});db['MailTransferReport']['belongsTo'](db[_0xa17b('0x128')],{'foreignKey':_0xa17b('0x1d8'),'as':_0xa17b('0x1d9')});db['MailTransferReport']['belongsTo'](db[_0xa17b('0x15a')],{'foreignKey':'ToMailAccountId','as':_0xa17b('0x1da')});db[_0xa17b('0xe7')]['belongsTo'](db[_0xa17b('0x68')],{});db[_0xa17b('0xe7')][_0xa17b('0x117')](db[_0xa17b('0x66')],{});db[_0xa17b('0xe7')]['belongsTo'](db[_0xa17b('0x61')],{'foreignKey':_0xa17b('0x1db'),'as':'FromAccount'});db[_0xa17b('0xe7')][_0xa17b('0x117')](db[_0xa17b('0x13')],{'foreignKey':'FromUserId','as':_0xa17b('0x1d6')});db[_0xa17b('0xe7')][_0xa17b('0x117')](db['User'],{'foreignKey':_0xa17b('0x1dc'),'as':'ToAgent'});db[_0xa17b('0xe7')][_0xa17b('0x117')](db['ChatQueue'],{'foreignKey':_0xa17b('0x1dd'),'as':_0xa17b('0x1d9')});db[_0xa17b('0xe7')][_0xa17b('0x117')](db[_0xa17b('0x61')],{'foreignKey':'ToChatWebsiteId','as':_0xa17b('0x1da')});db['FaxTransferReport'][_0xa17b('0x117')](db[_0xa17b('0x4a')],{});db[_0xa17b('0xe9')][_0xa17b('0x117')](db['FaxInteraction'],{});db[_0xa17b('0xe9')][_0xa17b('0x117')](db[_0xa17b('0x45')],{'foreignKey':_0xa17b('0x1de'),'as':_0xa17b('0x1d4')});db[_0xa17b('0xe9')][_0xa17b('0x117')](db['User'],{'foreignKey':_0xa17b('0x1d5'),'as':_0xa17b('0x1d6')});db[_0xa17b('0xe9')][_0xa17b('0x117')](db[_0xa17b('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xa17b('0xe9')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0xa17b('0x1df'),'as':_0xa17b('0x1d9')});db[_0xa17b('0xe9')]['belongsTo'](db[_0xa17b('0x45')],{'foreignKey':_0xa17b('0x1e0'),'as':_0xa17b('0x1da')});db[_0xa17b('0x1e1')][_0xa17b('0x117')](db[_0xa17b('0x5d')],{});db[_0xa17b('0x1e1')][_0xa17b('0x117')](db[_0xa17b('0x5b')],{});db[_0xa17b('0x1e1')][_0xa17b('0x117')](db[_0xa17b('0x135')],{'foreignKey':_0xa17b('0x1e2'),'as':_0xa17b('0x1d4')});db[_0xa17b('0x1e1')][_0xa17b('0x117')](db[_0xa17b('0x13')],{'foreignKey':_0xa17b('0x1d5'),'as':_0xa17b('0x1d6')});db['OpenchannelTransferReport'][_0xa17b('0x117')](db[_0xa17b('0x13')],{'foreignKey':_0xa17b('0x1dc'),'as':_0xa17b('0x1d7')});db['OpenchannelTransferReport']['belongsTo'](db[_0xa17b('0x5f')],{'foreignKey':_0xa17b('0x1e3'),'as':'ToQueue'});db[_0xa17b('0x1e1')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':'ToOpenchannelAccountId','as':_0xa17b('0x1da')});db['SmsTransferReport'][_0xa17b('0x117')](db['SmsMessage'],{});db[_0xa17b('0x1e4')][_0xa17b('0x117')](db[_0xa17b('0x53')],{});db[_0xa17b('0x1e4')][_0xa17b('0x117')](db[_0xa17b('0x4f')],{'foreignKey':_0xa17b('0x1e5'),'as':'FromAccount'});db['SmsTransferReport'][_0xa17b('0x117')](db[_0xa17b('0x13')],{'foreignKey':_0xa17b('0x1d5'),'as':_0xa17b('0x1d6')});db[_0xa17b('0x1e4')][_0xa17b('0x117')](db[_0xa17b('0x13')],{'foreignKey':_0xa17b('0x1dc'),'as':'ToAgent'});db[_0xa17b('0x1e4')]['belongsTo'](db[_0xa17b('0x57')],{'foreignKey':_0xa17b('0x1e6'),'as':_0xa17b('0x1d9')});db[_0xa17b('0x1e4')][_0xa17b('0x117')](db['SmsAccount'],{'foreignKey':_0xa17b('0x1e7'),'as':_0xa17b('0x1da')});db['CmList'][_0xa17b('0x10c')](db['Disposition'],{'as':_0xa17b('0x15f'),'foreignKey':_0xa17b('0x164'),'onDelete':'cascade'});db[_0xa17b('0xec')][_0xa17b('0x10c')](db[_0xa17b('0x77')],{'as':_0xa17b('0x1e8'),'foreignKey':'ListId'});db[_0xa17b('0xec')][_0xa17b('0x10c')](db[_0xa17b('0x6e')],{'as':'Contacts','onDelete':_0xa17b('0x108'),'foreignKey':'ListId'});db[_0xa17b('0xec')][_0xa17b('0x10c')](db[_0xa17b('0x73')],{'as':_0xa17b('0x10e'),'foreignKey':_0xa17b('0x164')});db['CmList'][_0xa17b('0x10c')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0xa17b('0x164')});db['CmList'][_0xa17b('0x10c')](db[_0xa17b('0x76')],{'as':_0xa17b('0x76'),'foreignKey':_0xa17b('0x164')});db['CmList'][_0xa17b('0x11c')](db[_0xa17b('0x19')],{'as':_0xa17b('0x1e9'),'through':_0xa17b('0x14c')});db['CmList']['belongsToMany'](db['User'],{'as':_0xa17b('0x14d'),'through':_0xa17b('0x12f')});db[_0xa17b('0xee')][_0xa17b('0x10c')](db[_0xa17b('0x16')],{'as':_0xa17b('0x10d'),'onDelete':_0xa17b('0x108')});db['VoicePrefix'][_0xa17b('0x11c')](db['User'],{'as':_0xa17b('0x14d'),'through':_0xa17b('0x104')});db['VoicePrefix']['belongsToMany'](db[_0xa17b('0xdd')],{'through':_0xa17b('0x1cc'),'as':_0xa17b('0x14e')});db[_0xa17b('0x118')]['hasMany'](db['User'],{'as':'Users','foreignKey':_0xa17b('0x119')});db[_0xa17b('0x118')][_0xa17b('0x10c')](db[_0xa17b('0x1ea')],{'as':'UserProfileSections','foreignKey':_0xa17b('0x119'),'onDelete':_0xa17b('0x108')});db['UserProfileSection'][_0xa17b('0x10c')](db[_0xa17b('0xf1')],{'as':_0xa17b('0x1eb'),'foreignKey':_0xa17b('0x1ec'),'onDelete':_0xa17b('0x108')});db[_0xa17b('0xf4')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0xa17b('0x1ed'),'onDelete':'cascade'});db[_0xa17b('0xf4')][_0xa17b('0x10c')](db[_0xa17b('0x79')],{'as':_0xa17b('0x161'),'foreignKey':_0xa17b('0x1ed')});db[_0xa17b('0xf4')][_0xa17b('0x10c')](db['WhatsappMessage'],{'as':_0xa17b('0x150'),'foreignKey':'WhatsappAccountId'});db[_0xa17b('0xf4')][_0xa17b('0x10c')](db['WhatsappInteraction'],{'as':_0xa17b('0x162')});db[_0xa17b('0xf4')][_0xa17b('0x10c')](db[_0xa17b('0xf6')],{'as':_0xa17b('0x140')});db[_0xa17b('0xf4')][_0xa17b('0x117')](db[_0xa17b('0xec')],{'as':_0xa17b('0x163'),'foreignKey':_0xa17b('0x164')});db[_0xa17b('0xf4')][_0xa17b('0x117')](db['Pause'],{'as':_0xa17b('0x166'),'foreignKey':_0xa17b('0x167')});db[_0xa17b('0xf4')][_0xa17b('0x11c')](db['User'],{'as':'Agents','through':_0xa17b('0x139')});db[_0xa17b('0xf6')][_0xa17b('0x117')](db[_0xa17b('0x13')],{'onDelete':_0xa17b('0x172')});db[_0xa17b('0xf6')][_0xa17b('0x117')](db[_0xa17b('0xfe')],{'onDelete':_0xa17b('0x172')});db[_0xa17b('0xf6')][_0xa17b('0x117')](db[_0xa17b('0xf4')],{'onDelete':'restrict'});db['WhatsappApplication'][_0xa17b('0x117')](db['Interval'],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xa17b('0xf6')][_0xa17b('0x117')](db[_0xa17b('0x89')],{'onDelete':_0xa17b('0x172'),'foreignKey':_0xa17b('0x173')});db[_0xa17b('0xf8')][_0xa17b('0x10c')](db['WhatsappMessage'],{'as':_0xa17b('0x150'),'onDelete':_0xa17b('0x108'),'foreignKey':_0xa17b('0x1ee')});db[_0xa17b('0xf8')][_0xa17b('0x117')](db['WhatsappAccount'],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0xa17b('0xf8')][_0xa17b('0x117')](db[_0xa17b('0x6e')],{'as':_0xa17b('0x158'),'foreignKey':_0xa17b('0x159')});db[_0xa17b('0xf8')]['belongsTo'](db[_0xa17b('0x13')],{'as':_0xa17b('0x177'),'foreignKey':_0xa17b('0x109')});db[_0xa17b('0xf8')][_0xa17b('0x11c')](db[_0xa17b('0x89')],{'through':_0xa17b('0x1a6'),'as':_0xa17b('0x16c')});db[_0xa17b('0xf8')][_0xa17b('0x11c')](db['Tag'],{'through':_0xa17b('0x1a6'),'as':_0xa17b('0x179')});db[_0xa17b('0xf8')]['belongsToMany'](db[_0xa17b('0x13')],{'as':_0xa17b('0x16d'),'through':'user_has_whatsapp_interactions','foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0xa17b('0x117')](db['User'],{'as':_0xa17b('0x13')});db['WhatsappMessage'][_0xa17b('0x117')](db[_0xa17b('0x6e')],{'onDelete':_0xa17b('0x108'),'as':'Contact'});db[_0xa17b('0x1ef')][_0xa17b('0x117')](db[_0xa17b('0xf8')],{'onDelete':'cascade','as':_0xa17b('0x16f'),'foreignKey':_0xa17b('0x1ee')});db[_0xa17b('0x1ef')][_0xa17b('0x117')](db[_0xa17b('0xf4')],{'as':_0xa17b('0x170'),'foreignKey':_0xa17b('0x1ed')});db[_0xa17b('0xfa')][_0xa17b('0x117')](db[_0xa17b('0xf4')],{});db['WhatsappQueueReport'][_0xa17b('0x117')](db[_0xa17b('0xec')],{'as':_0xa17b('0x163'),'foreignKey':_0xa17b('0x164')});db['WhatsappQueueReport'][_0xa17b('0x117')](db[_0xa17b('0x6e')],{'as':_0xa17b('0x158'),'foreignKey':_0xa17b('0x159')});db[_0xa17b('0xfa')][_0xa17b('0x117')](db[_0xa17b('0xf8')],{});db[_0xa17b('0xfa')][_0xa17b('0x117')](db['WhatsappQueue'],{});db[_0xa17b('0xfa')][_0xa17b('0x117')](db['WhatsappMessage'],{});db[_0xa17b('0xfa')][_0xa17b('0x117')](db[_0xa17b('0x13')],{});db['WhatsappTransferReport'][_0xa17b('0x117')](db[_0xa17b('0x1ef')],{});db[_0xa17b('0xfc')]['belongsTo'](db[_0xa17b('0xf8')],{});db[_0xa17b('0xfc')][_0xa17b('0x117')](db[_0xa17b('0xf4')],{'foreignKey':_0xa17b('0x1f0'),'as':_0xa17b('0x1d4')});db[_0xa17b('0xfc')]['belongsTo'](db[_0xa17b('0xf4')],{'foreignKey':_0xa17b('0x1f1'),'as':_0xa17b('0x1da')});db[_0xa17b('0xfc')]['belongsTo'](db[_0xa17b('0xfe')],{'foreignKey':'ToQueueId','as':_0xa17b('0x1d9')});db[_0xa17b('0xfc')]['belongsTo'](db[_0xa17b('0x13')],{'foreignKey':_0xa17b('0x1d5'),'as':_0xa17b('0x1d6')});db[_0xa17b('0xfc')][_0xa17b('0x117')](db[_0xa17b('0x13')],{'foreignKey':_0xa17b('0x1dc'),'as':'ToAgent'});db[_0xa17b('0xfe')][_0xa17b('0x11c')](db[_0xa17b('0x13')],{'as':'Agents','through':_0xa17b('0x32'),'foreignKey':'WhatsappQueueId'});db[_0xa17b('0xfe')][_0xa17b('0x11c')](db[_0xa17b('0xdd')],{'through':_0xa17b('0x1ca'),'as':_0xa17b('0x14e')});db[_0xa17b('0x100')][_0xa17b('0x106')](db[_0xa17b('0x34')],{'as':_0xa17b('0x15d'),'onDelete':_0xa17b('0x172')});db[_0xa17b('0x100')][_0xa17b('0x106')](db[_0xa17b('0x15c')],{'as':_0xa17b('0x15e'),'onDelete':_0xa17b('0x172')});module[_0xa17b('0x1f2')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x9f94=['../config/environment','sequelize','lodash','defaultsDeep','motion2','xcall','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','database','username','options','password','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.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','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopper/cmHopper.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','Tag','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SquareReport','../api/squareReport/squareReport.model','JscriptyProject','Setting','SquareProject','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','User','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','cascade','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','FaxQueue','UserFaxQueue','SmsQueues','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','SquareProjects','user_has_square_projects','moh_has_sounds','Members','VoiceQueueId','VoiceQueue','Hoppers','HopperHistories','CmHopperBlack','HopperBlacks','JscriptySessions','Trunk','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','BlackLists','ScreenRecording','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','restrict','MailServerOut','MailServerIn','Imap','hasOne','Interactions','Applications','List','ListId','TemplateId','mandatoryDispositionPauseId','team_has_mail_queues','MailInteractionId','Account','Tags','mail_interaction_has_tags','ThroughTags','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','TagId','Dashboard','Items','Dispositions','FaxAccountId','Answers','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','Users','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','Owner','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ProactiveActions','ChatApplication','Agent','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Website','FaxInteractions','Company','CompanyId','cm_contact_has_tags','Queue','OwnerId','CampaignId','Automation','All','AutomationAllId','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Fields','MetricId','AnalyticMetric','SalesforceAccount','Configurations','Subjects','SubjectId','Descriptions','DescriptionId','Subject','Description','Field','VariableId','SugarcrmAccount','SugarcrmConfiguration','AccountId','FieldId','DeskConfiguration','int_desk_configuration_has_tags','ZendeskConfiguration','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowField','Dynamics365Configuration','Dynamics365Field','FreshsalesField','FromId','SessionId','SmsQueueReport','ProjectId','JscriptyAnswerReport','ChatQueues','TrunkId','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAccount','FromAgent','ToUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','UserProfileSections','userProfileId','UserProfileResource','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9f94,0x1e7));var _0x49f9=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x9f94[_0x2be8c2];return _0x97f531;};'use strict';var config=require(_0x49f9('0x0'));var Sequelize=require(_0x49f9('0x1'));var _=require(_0x49f9('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x49f9('0x1')]=_[_0x49f9('0x3')](config[_0x49f9('0x1')],{'database':_0x49f9('0x4'),'username':_0x49f9('0x5'),'password':'xC@LL1234','options':{'host':_0x49f9('0x6'),'port':0xcea,'dialect':_0x49f9('0x7'),'dialectOptions':{'charset':_0x49f9('0x8')},'logging':![],'timezone':timezone[_0x49f9('0x9')](),'define':{'charset':_0x49f9('0xa'),'collate':_0x49f9('0xb')}}});config[_0x49f9('0xc')]=_[_0x49f9('0x3')](config['sequelizeHistory'],{'database':'motion2','username':_0x49f9('0x5'),'password':'xC@LL1234','options':{'host':_0x49f9('0x6'),'port':0xcea,'dialect':_0x49f9('0x7'),'dialectOptions':{'charset':_0x49f9('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x49f9('0xa'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x49f9('0x1')][_0x49f9('0xd')],config[_0x49f9('0x1')][_0x49f9('0xe')],config['sequelize']['password'],config[_0x49f9('0x1')][_0x49f9('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x49f9('0xc')][_0x49f9('0xd')],config['sequelizeHistory']['username'],config['sequelizeHistory'][_0x49f9('0x10')],config['sequelizeHistory'][_0x49f9('0xf')])};db['User']=db[_0x49f9('0x1')][_0x49f9('0x11')]('../api/user/user.model');db[_0x49f9('0x12')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x13'));db[_0x49f9('0x14')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x15'));db[_0x49f9('0x16')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x17'));db[_0x49f9('0x18')]=db[_0x49f9('0x1')][_0x49f9('0x11')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db['VoiceQueue']=db[_0x49f9('0x1')]['import'](_0x49f9('0x19'));db['VoiceRecording']=db['sequelize'][_0x49f9('0x11')](_0x49f9('0x1a'));db['ScreenRecording']=db[_0x49f9('0x1')]['import']('../api/screenRecording/screenRecording.model');db[_0x49f9('0x1b')]=db[_0x49f9('0x1')]['import'](_0x49f9('0x1c'));db[_0x49f9('0x1d')]=db['sequelize'][_0x49f9('0x11')](_0x49f9('0x1e'));db[_0x49f9('0x1f')]=db[_0x49f9('0x1')]['import'](_0x49f9('0x20'));db[_0x49f9('0x21')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x22'));db[_0x49f9('0x23')]=db[_0x49f9('0x1')]['import']('../api/voiceAgentReport/voiceAgentReport.model');db[_0x49f9('0x24')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x25'));db[_0x49f9('0x26')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x27'));db['Trunk']=db[_0x49f9('0x1')]['import'](_0x49f9('0x28'));db[_0x49f9('0x29')]=db[_0x49f9('0x1')]['import'](_0x49f9('0x2a'));db[_0x49f9('0x2b')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x2c'));db[_0x49f9('0x2d')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x2e'));db[_0x49f9('0x2f')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x30'));db[_0x49f9('0x31')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x32'));db['UserFaxQueue']=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x33'));db[_0x49f9('0x34')]=db['sequelize']['import'](_0x49f9('0x35'));db['UserOpenchannelQueue']=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x36'));db[_0x49f9('0x37')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x38'));db['MailServerIn']=db[_0x49f9('0x1')][_0x49f9('0x11')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db['sequelize'][_0x49f9('0x11')]('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x39'));db[_0x49f9('0x3a')]=db['sequelize'][_0x49f9('0x11')]('../api/mailQueue/mailQueue.model');db[_0x49f9('0x3b')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x3c'));db[_0x49f9('0x3d')]=db[_0x49f9('0x1')]['import']('../api/mailInteraction/mailInteraction.model');db[_0x49f9('0x3e')]=db[_0x49f9('0x1')][_0x49f9('0x11')]('../api/mailMessage/mailMessage.model');db[_0x49f9('0x3f')]=db[_0x49f9('0x1')]['import']('../api/mailApplication/mailApplication.model');db[_0x49f9('0x40')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x41'));db['Dashboard']=db[_0x49f9('0x1')]['import'](_0x49f9('0x42'));db[_0x49f9('0x43')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x44'));db[_0x49f9('0x45')]=db[_0x49f9('0x1')][_0x49f9('0x11')]('../api/faxAccount/faxAccount.model');db[_0x49f9('0x46')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x47'));db[_0x49f9('0x48')]=db[_0x49f9('0x1')][_0x49f9('0x11')]('../api/faxInteraction/faxInteraction.model');db[_0x49f9('0x49')]=db['sequelize'][_0x49f9('0x11')](_0x49f9('0x4a'));db['FaxQueue']=db[_0x49f9('0x1')][_0x49f9('0x11')]('../api/faxQueue/faxQueue.model');db[_0x49f9('0x4b')]=db[_0x49f9('0x1')]['import'](_0x49f9('0x4c'));db[_0x49f9('0x4d')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x4e'));db[_0x49f9('0x4f')]=db['sequelize'][_0x49f9('0x11')]('../api/smsApplication/smsApplication.model');db[_0x49f9('0x50')]=db[_0x49f9('0x1')]['import'](_0x49f9('0x51'));db[_0x49f9('0x52')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x53'));db[_0x49f9('0x54')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x55'));db[_0x49f9('0x56')]=db[_0x49f9('0x1')]['import']('../api/openchannelAccount/openchannelAccount.model');db[_0x49f9('0x57')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x58'));db[_0x49f9('0x59')]=db[_0x49f9('0x1')][_0x49f9('0x11')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x49f9('0x5a')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x5b'));db[_0x49f9('0x5c')]=db['sequelize']['import']('../api/openchannelQueue/openchannelQueue.model');db[_0x49f9('0x5d')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x5e'));db[_0x49f9('0x5f')]=db[_0x49f9('0x1')]['import'](_0x49f9('0x60'));db['ChatApplication']=db[_0x49f9('0x1')]['import']('../api/chatApplication/chatApplication.model');db[_0x49f9('0x61')]=db['sequelize'][_0x49f9('0x11')](_0x49f9('0x62'));db[_0x49f9('0x63')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x64'));db['ChatOfflineMessage']=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x65'));db[_0x49f9('0x66')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x67'));db[_0x49f9('0x68')]=db['sequelize'][_0x49f9('0x11')]('../api/chatGroup/chatGroup.model');db[_0x49f9('0x69')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x6a'));db[_0x49f9('0x6b')]=db['sequelize'][_0x49f9('0x11')](_0x49f9('0x6c'));db[_0x49f9('0x6d')]=db['sequelize'][_0x49f9('0x11')]('../api/cmContact/cmContact.model');db[_0x49f9('0x6e')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x6f'));db['CmHopperBlack']=db[_0x49f9('0x1')]['import']('../api/cmHopperBlack/cmHopperBlack.model');db[_0x49f9('0x70')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x71'));db[_0x49f9('0x72')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x73'));db[_0x49f9('0x74')]=db[_0x49f9('0x1')]['import'](_0x49f9('0x75'));db[_0x49f9('0x76')]=db['sequelize'][_0x49f9('0x11')](_0x49f9('0x77'));db[_0x49f9('0x78')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x79'));db['Automation']=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x7a'));db[_0x49f9('0x7b')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x7c'));db[_0x49f9('0x7d')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x7e'));db[_0x49f9('0x7f')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x80'));db[_0x49f9('0x81')]=db[_0x49f9('0x1')]['import'](_0x49f9('0x82'));db['Pause']=db['sequelize'][_0x49f9('0x11')](_0x49f9('0x83'));db[_0x49f9('0x84')]=db['sequelize']['import'](_0x49f9('0x85'));db[_0x49f9('0x86')]=db[_0x49f9('0x1')]['import'](_0x49f9('0x87'));db[_0x49f9('0x88')]=db[_0x49f9('0x1')][_0x49f9('0x11')]('../api/schedule/schedule.model');db[_0x49f9('0x89')]=db['sequelize'][_0x49f9('0x11')](_0x49f9('0x8a'));db[_0x49f9('0x8b')]=db[_0x49f9('0x1')][_0x49f9('0x11')]('../api/tag/tag.model');db[_0x49f9('0x8c')]=db[_0x49f9('0x1')]['import'](_0x49f9('0x8d'));db[_0x49f9('0x8e')]=db[_0x49f9('0x1')][_0x49f9('0x11')]('../api/trigger/trigger.model');db[_0x49f9('0x8f')]=db['sequelize'][_0x49f9('0x11')](_0x49f9('0x90'));db[_0x49f9('0x91')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0x92'));db[_0x49f9('0x93')]=db[_0x49f9('0x1')]['import'](_0x49f9('0x94'));db[_0x49f9('0x95')]=db['sequelize'][_0x49f9('0x11')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x49f9('0x96')]=db[_0x49f9('0x1')]['import']('../api/analyticDefaultReport/analyticDefaultReport.model');db['AnalyticExtractedReport']=db['sequelize'][_0x49f9('0x11')](_0x49f9('0x97'));db['AnalyticMetric']=db[_0x49f9('0x1')]['import']('../api/analyticMetric/analyticMetric.model');db[_0x49f9('0x98')]=db['sequelize'][_0x49f9('0x11')](_0x49f9('0x99'));db['AnalyticTreeReport']=db['sequelize']['import']('../api/analyticTreeReport/analyticTreeReport.model');db['SalesforceAccount']=db[_0x49f9('0x1')][_0x49f9('0x11')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x49f9('0x9a')]=db['sequelize'][_0x49f9('0x11')](_0x49f9('0x9b'));db[_0x49f9('0x9c')]=db['sequelize']['import'](_0x49f9('0x9d'));db['SugarcrmAccount']=db[_0x49f9('0x1')][_0x49f9('0x11')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db['SugarcrmConfiguration']=db[_0x49f9('0x1')]['import'](_0x49f9('0x9e'));db[_0x49f9('0x9f')]=db[_0x49f9('0x1')][_0x49f9('0x11')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x49f9('0xa0')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0xa1'));db['DeskConfiguration']=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0xa2'));db[_0x49f9('0xa3')]=db[_0x49f9('0x1')]['import']('../api/intDeskField/intDeskField.model');db[_0x49f9('0xa4')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0xa5'));db[_0x49f9('0xa6')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0xa7'));db[_0x49f9('0xa8')]=db['sequelize']['import']('../api/intZohoField/intZohoField.model');db[_0x49f9('0xa9')]=db[_0x49f9('0x1')]['import'](_0x49f9('0xaa'));db['ZendeskConfiguration']=db['sequelize'][_0x49f9('0x11')](_0x49f9('0xab'));db[_0x49f9('0xac')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0xad'));db[_0x49f9('0xae')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0xaf'));db[_0x49f9('0xb0')]=db[_0x49f9('0x1')][_0x49f9('0x11')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x49f9('0xb1')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0xb2'));db[_0x49f9('0xb3')]=db['sequelize'][_0x49f9('0x11')](_0x49f9('0xb4'));db['VtigerConfiguration']=db['sequelize']['import'](_0x49f9('0xb5'));db[_0x49f9('0xb6')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0xb7'));db[_0x49f9('0xb8')]=db[_0x49f9('0x1')][_0x49f9('0x11')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x49f9('0xb9')]=db['sequelize'][_0x49f9('0x11')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db['ServicenowField']=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0xba'));db[_0x49f9('0xbb')]=db['sequelize'][_0x49f9('0x11')](_0x49f9('0xbc'));db['Dynamics365Configuration']=db['sequelize']['import']('../api/intDynamics365Configuration/intDynamics365Configuration.model');db['Dynamics365Field']=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0xbd'));db[_0x49f9('0xbe')]=db[_0x49f9('0x1')]['import'](_0x49f9('0xbf'));db[_0x49f9('0xc0')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0xc1'));db['FreshsalesField']=db['sequelize'][_0x49f9('0x11')]('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db[_0x49f9('0x1')][_0x49f9('0x11')]('../api/integration/integration.model');db['Network']=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0xc2'));db[_0x49f9('0xc3')]=db[_0x49f9('0x1')][_0x49f9('0x11')]('../api/chatQueueReport/chatQueueReport.model');db[_0x49f9('0xc4')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0xc5'));db['JscriptyAnswerReport']=db[_0x49f9('0x1')][_0x49f9('0x11')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x49f9('0xc6')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0xc7'));db[_0x49f9('0xc8')]=db['sequelize'][_0x49f9('0x11')](_0x49f9('0xc9'));db['SmsQueueReport']=db[_0x49f9('0x1')]['import']('../api/smsQueueReport/smsQueueReport.model');db[_0x49f9('0xca')]=db[_0x49f9('0x1')]['import'](_0x49f9('0xcb'));db['SquareDetailsReport']=db[_0x49f9('0x1')][_0x49f9('0x11')]('../api/squareReportDetail/squareReportDetail.model');db[_0x49f9('0xcc')]=db[_0x49f9('0x1')][_0x49f9('0x11')]('../api/jscriptyProject/jscriptyProject.model');db[_0x49f9('0xcd')]=db[_0x49f9('0x1')]['import']('../api/setting/setting.model');db['SquareOdbc']=db[_0x49f9('0x1')]['import']('../api/squareOdbc/squareOdbc.model');db[_0x49f9('0xce')]=db['sequelize'][_0x49f9('0x11')]('../api/squareProject/squareProject.model');db['SquareRecording']=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0xcf'));db[_0x49f9('0xd0')]=db['sequelize'][_0x49f9('0x11')](_0x49f9('0xd1'));db[_0x49f9('0xd2')]=db[_0x49f9('0x1')][_0x49f9('0x11')]('../api/team/team.model');db[_0x49f9('0xd3')]=db['sequelize'][_0x49f9('0x11')]('../api/license/license.model');db[_0x49f9('0xd4')]=db['sequelize'][_0x49f9('0x11')](_0x49f9('0xd5'));db[_0x49f9('0xd6')]=db['sequelize'][_0x49f9('0x11')](_0x49f9('0xd7'));db[_0x49f9('0xd8')]=db[_0x49f9('0x1')]['import'](_0x49f9('0xd9'));db['Plugin']=db[_0x49f9('0x1')]['import'](_0x49f9('0xda'));db[_0x49f9('0xdb')]=db[_0x49f9('0x1')]['import'](_0x49f9('0xdc'));db[_0x49f9('0xdd')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0xde'));db[_0x49f9('0xdf')]=db[_0x49f9('0x1')]['import'](_0x49f9('0xe0'));db[_0x49f9('0xe1')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0xe2'));db['SmsTransferReport']=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0xe3'));db[_0x49f9('0xe4')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0xe5'));db[_0x49f9('0xe6')]=db['sequelize'][_0x49f9('0x11')]('../api/voicePrefix/voicePrefix.model');db[_0x49f9('0xe7')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0xe8'));db[_0x49f9('0xe9')]=db['sequelize'][_0x49f9('0x11')]('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db[_0x49f9('0x1')][_0x49f9('0x11')]('../api/userProfileResource/userProfileResource.model');db['UserNotification']=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0xea'));db['WhatsappAccount']=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0xeb'));db[_0x49f9('0xec')]=db[_0x49f9('0x1')]['import']('../api/whatsappApplication/whatsappApplication.model');db[_0x49f9('0xed')]=db[_0x49f9('0x1')]['import'](_0x49f9('0xee'));db[_0x49f9('0xef')]=db[_0x49f9('0x1')][_0x49f9('0x11')]('../api/whatsappMessage/whatsappMessage.model');db[_0x49f9('0xf0')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0xf1'));db[_0x49f9('0xf2')]=db[_0x49f9('0x1')]['import'](_0x49f9('0xf3'));db[_0x49f9('0xf4')]=db[_0x49f9('0x1')][_0x49f9('0x11')]('../api/whatsappQueue/whatsappQueue.model');db[_0x49f9('0xf5')]=db[_0x49f9('0x1')][_0x49f9('0x11')](_0x49f9('0xf6'));db['TeamVoiceQueue']=db['sequelize'][_0x49f9('0x11')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x49f9('0xf7')]=db['sequelize'][_0x49f9('0x11')](_0x49f9('0xf8'));db[_0x49f9('0xf9')]=db[_0x49f9('0x1')]['import']('../api/userVoicePrefix/userVoicePrefix.model');db[_0x49f9('0xfa')]['hasOne'](db['VoiceMail'],{'as':_0x49f9('0x1b'),'onDelete':'cascade','foreignKey':_0x49f9('0xfb')});db[_0x49f9('0xfa')][_0x49f9('0xfc')](db[_0x49f9('0xfd')],{'as':_0x49f9('0xfe'),'foreignKey':_0x49f9('0xfb')});db[_0x49f9('0xfa')][_0x49f9('0xfc')](db[_0x49f9('0x2b')],{'as':_0x49f9('0xff'),'foreignKey':_0x49f9('0xfb')});db['User'][_0x49f9('0xfc')](db[_0x49f9('0x16')],{'as':_0x49f9('0x100'),'onDelete':_0x49f9('0x101'),'hooks':!![]});db[_0x49f9('0xfa')][_0x49f9('0xfc')](db['CmHopperFinal'],{'as':_0x49f9('0x102'),'foreignKey':_0x49f9('0xfb')});db[_0x49f9('0xfa')][_0x49f9('0xfc')](db[_0x49f9('0x72')],{'as':_0x49f9('0x103'),'foreignKey':'UserId'});db[_0x49f9('0xfa')][_0x49f9('0xfc')](db[_0x49f9('0x74')],{'as':_0x49f9('0x74'),'foreignKey':'UserId'});db[_0x49f9('0xfa')]['hasMany'](db[_0x49f9('0x59')],{'as':_0x49f9('0x104'),'foreignKey':_0x49f9('0xfb')});db[_0x49f9('0xfa')][_0x49f9('0xfc')](db['ChatInteraction'],{'as':_0x49f9('0x105'),'foreignKey':_0x49f9('0xfb')});db[_0x49f9('0xfa')][_0x49f9('0xfc')](db[_0x49f9('0x50')],{'as':'SmsInteractions','foreignKey':_0x49f9('0xfb')});db[_0x49f9('0xfa')][_0x49f9('0xfc')](db[_0x49f9('0x48')],{'as':'FaxInteractions','foreignKey':'UserId'});db[_0x49f9('0xfa')][_0x49f9('0xfc')](db[_0x49f9('0x3d')],{'as':_0x49f9('0x106'),'foreignKey':'UserId'});db[_0x49f9('0xfa')]['hasMany'](db[_0x49f9('0xed')],{'as':_0x49f9('0x107'),'foreignKey':_0x49f9('0xfb')});db[_0x49f9('0xfa')][_0x49f9('0xfc')](db['UserNotification'],{'as':_0x49f9('0x108'),'foreignKey':_0x49f9('0x109')});db[_0x49f9('0xfa')][_0x49f9('0x10a')](db['UserProfile'],{'as':_0x49f9('0xe7'),'foreignKey':'userProfileId'});db['User'][_0x49f9('0x10b')](db[_0x49f9('0x68')],{'as':_0x49f9('0x10c'),'through':_0x49f9('0x10d')});db[_0x49f9('0xfa')]['belongsToMany'](db['CmContact'],{'as':_0x49f9('0x10e'),'through':_0x49f9('0x10f')});db[_0x49f9('0xfa')][_0x49f9('0x10b')](db[_0x49f9('0xe4')],{'as':_0x49f9('0x110'),'through':_0x49f9('0x111')});db['User'][_0x49f9('0x10b')](db[_0x49f9('0xd2')],{'through':_0x49f9('0x112')});db[_0x49f9('0xfa')][_0x49f9('0x10b')](db['MailInteraction'],{'as':_0x49f9('0x106'),'through':_0x49f9('0x113')});db[_0x49f9('0xfa')][_0x49f9('0x10b')](db['ChatInteraction'],{'as':_0x49f9('0x105'),'through':_0x49f9('0x114')});db[_0x49f9('0xfa')]['belongsToMany'](db[_0x49f9('0x48')],{'as':'FaxInteractions','through':_0x49f9('0x115')});db['User'][_0x49f9('0x10b')](db[_0x49f9('0x50')],{'as':_0x49f9('0x116'),'through':_0x49f9('0x117')});db[_0x49f9('0xfa')][_0x49f9('0x10b')](db[_0x49f9('0x59')],{'as':'OpenchannelInteractions','through':_0x49f9('0x118')});db['User'][_0x49f9('0x10b')](db[_0x49f9('0xed')],{'as':'WhatsappInteractions','through':_0x49f9('0x119')});db['User']['belongsToMany'](db['VoiceQueue'],{'as':_0x49f9('0x11a'),'through':_0x49f9('0x2d'),'required':![]});db[_0x49f9('0xfa')]['belongsToMany'](db[_0x49f9('0xe6')],{'as':_0x49f9('0x11b'),'through':'UserVoicePrefix','required':![]});db[_0x49f9('0xfa')][_0x49f9('0x10b')](db[_0x49f9('0x3a')],{'as':'MailQueues','through':_0x49f9('0x31'),'required':![]});db[_0x49f9('0xfa')][_0x49f9('0x10b')](db[_0x49f9('0x66')],{'as':'ChatQueues','through':_0x49f9('0x2f'),'required':![],'hooks':!![]});db['User']['belongsToMany'](db[_0x49f9('0x11c')],{'as':'FaxQueues','through':_0x49f9('0x11d'),'required':![]});db[_0x49f9('0xfa')][_0x49f9('0x10b')](db[_0x49f9('0x54')],{'as':_0x49f9('0x11e'),'through':_0x49f9('0x34'),'required':![]});db['User'][_0x49f9('0x10b')](db[_0x49f9('0x5c')],{'as':_0x49f9('0x11f'),'through':_0x49f9('0x120'),'required':![]});db['User'][_0x49f9('0x10b')](db[_0x49f9('0xf4')],{'as':_0x49f9('0x121'),'through':'UserWhatsappQueue','required':![]});db['User'][_0x49f9('0x10b')](db[_0x49f9('0xe4')],{'through':_0x49f9('0x111')});db[_0x49f9('0xfa')][_0x49f9('0x10b')](db['ChatWebsite'],{'as':_0x49f9('0x122'),'through':_0x49f9('0x123')});db[_0x49f9('0xfa')][_0x49f9('0x10b')](db[_0x49f9('0x45')],{'as':_0x49f9('0x124'),'through':'user_has_fax_accounts'});db['User'][_0x49f9('0x10b')](db[_0x49f9('0x125')],{'as':_0x49f9('0x126'),'through':_0x49f9('0x127')});db['User'][_0x49f9('0x10b')](db[_0x49f9('0x56')],{'as':_0x49f9('0x128'),'through':_0x49f9('0x129')});db[_0x49f9('0xfa')]['belongsToMany'](db[_0x49f9('0x4d')],{'as':_0x49f9('0x12a'),'through':_0x49f9('0x12b')});db['User'][_0x49f9('0x10b')](db[_0x49f9('0x12c')],{'as':_0x49f9('0x12d'),'through':'user_has_whatsapp_accounts'});db[_0x49f9('0xfa')][_0x49f9('0x10b')](db[_0x49f9('0xce')],{'as':_0x49f9('0x12e'),'through':_0x49f9('0x12f')});db[_0x49f9('0x12')][_0x49f9('0xfc')](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':_0x49f9('0x101'),'foreignKey':'ChanSpyId'});db['VoiceContext']['hasMany'](db[_0x49f9('0x16')],{'onDelete':'cascade'});db[_0x49f9('0x16')][_0x49f9('0xfc')](db[_0x49f9('0x16')],{'as':'Applications','onDelete':'cascade'});db[_0x49f9('0x18')][_0x49f9('0x10b')](db[_0x49f9('0x89')],{'as':'Sounds','through':_0x49f9('0x130')});db['VoiceQueue'][_0x49f9('0xfc')](db['UserVoiceQueueRt'],{'as':_0x49f9('0x131'),'foreignKey':_0x49f9('0x132')});db[_0x49f9('0x133')]['hasMany'](db['CmHopper'],{'as':_0x49f9('0x134'),'foreignKey':_0x49f9('0x132')});db[_0x49f9('0x133')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x49f9('0x132')});db[_0x49f9('0x133')][_0x49f9('0xfc')](db[_0x49f9('0x72')],{'as':_0x49f9('0x135'),'foreignKey':_0x49f9('0x132')});db[_0x49f9('0x133')][_0x49f9('0xfc')](db['ReportAgentPreview'],{'as':_0x49f9('0x74'),'foreignKey':_0x49f9('0x132')});db['VoiceQueue'][_0x49f9('0xfc')](db[_0x49f9('0x136')],{'as':_0x49f9('0x137'),'foreignKey':_0x49f9('0x132')});db[_0x49f9('0x133')][_0x49f9('0xfc')](db['JscriptySessionReport'],{'as':_0x49f9('0x138'),'foreignKey':_0x49f9('0x132')});db['VoiceQueue'][_0x49f9('0x10a')](db[_0x49f9('0x139')],{'as':_0x49f9('0x139'),'foreignKey':'TrunkId'});db['VoiceQueue'][_0x49f9('0x10a')](db[_0x49f9('0x139')],{'as':'TrunkBackup','foreignKey':_0x49f9('0x13a')});db[_0x49f9('0x133')]['belongsTo'](db[_0x49f9('0x81')],{'as':_0x49f9('0x81'),'foreignKey':_0x49f9('0x13b')});db[_0x49f9('0x133')][_0x49f9('0x10a')](db[_0x49f9('0x13c')],{'as':_0x49f9('0x13d'),'foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue'][_0x49f9('0x10b')](db['CmList'],{'as':_0x49f9('0x110'),'through':_0x49f9('0x13e')});db[_0x49f9('0x133')]['belongsToMany'](db['User'],{'as':_0x49f9('0x13f'),'through':_0x49f9('0x2d')});db[_0x49f9('0x133')][_0x49f9('0x10b')](db[_0x49f9('0xd2')],{'as':_0x49f9('0x140'),'through':_0x49f9('0x141')});db[_0x49f9('0x133')][_0x49f9('0x10b')](db['CmList'],{'as':_0x49f9('0x142'),'through':'voice_queues_has_cm_blacklists'});db[_0x49f9('0xfd')]['belongsTo'](db[_0x49f9('0xfa')],{'as':'User','foreignKey':_0x49f9('0xfb')});db[_0x49f9('0x143')][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'as':'User','foreignKey':'UserId'});db[_0x49f9('0x1b')][_0x49f9('0xfc')](db[_0x49f9('0x1d')],{'as':_0x49f9('0x144'),'onDelete':_0x49f9('0x101'),'foreignKey':_0x49f9('0x145'),'sourceKey':_0x49f9('0x146')});db[_0x49f9('0x1d')]['belongsTo'](db[_0x49f9('0x1b')],{'foreignKey':'mailboxuser','targetKey':_0x49f9('0x146')});db[_0x49f9('0x1f')][_0x49f9('0xfc')](db['VoiceQueueReport'],{'as':_0x49f9('0x147'),'foreignKey':_0x49f9('0x148'),'constraints':![]});db[_0x49f9('0x1f')][_0x49f9('0xfc')](db['VoiceAgentReport'],{'as':_0x49f9('0x149'),'foreignKey':_0x49f9('0x148'),'constraints':![]});db[_0x49f9('0x1f')][_0x49f9('0x10a')](db['User'],{'as':_0x49f9('0xfa'),'foreignKey':_0x49f9('0xfb')});db[_0x49f9('0x1f')][_0x49f9('0x10a')](db[_0x49f9('0x6d')],{'as':_0x49f9('0x14a'),'foreignKey':_0x49f9('0x14b')});db['MailServerIn'][_0x49f9('0x10a')](db[_0x49f9('0x125')],{'as':'MailAccount','foreignKey':_0x49f9('0x14c')});db['MailServerIn'][_0x49f9('0x10a')](db['CloudProvider'],{'as':'CloudProvider','foreignKey':'CloudProviderId','onDelete':_0x49f9('0x14d')});db['MailServerOut']['belongsTo'](db['MailAccount'],{'as':_0x49f9('0x125'),'foreignKey':_0x49f9('0x14c')});db[_0x49f9('0x14e')][_0x49f9('0x10a')](db['CloudProvider'],{'as':_0x49f9('0xf5'),'foreignKey':'CloudProviderId','onDelete':'restrict'});db[_0x49f9('0x125')]['hasOne'](db[_0x49f9('0x14f')],{'as':_0x49f9('0x150'),'onDelete':_0x49f9('0x101')});db[_0x49f9('0x125')][_0x49f9('0x151')](db[_0x49f9('0x14e')],{'as':'Smtp','onDelete':_0x49f9('0x101')});db[_0x49f9('0x125')][_0x49f9('0xfc')](db[_0x49f9('0x7d')],{'as':'Dispositions','foreignKey':_0x49f9('0x14c'),'onDelete':_0x49f9('0x101')});db['MailAccount']['hasMany'](db[_0x49f9('0x7b')],{'as':'Answers','foreignKey':_0x49f9('0x14c')});db['MailAccount']['hasMany'](db[_0x49f9('0x3e')],{'as':_0x49f9('0x144'),'foreignKey':_0x49f9('0x14c')});db[_0x49f9('0x125')][_0x49f9('0xfc')](db[_0x49f9('0x3d')],{'as':_0x49f9('0x152')});db[_0x49f9('0x125')][_0x49f9('0xfc')](db[_0x49f9('0x3f')],{'as':_0x49f9('0x153')});db[_0x49f9('0x125')][_0x49f9('0x10a')](db[_0x49f9('0xe4')],{'as':_0x49f9('0x154'),'foreignKey':_0x49f9('0x155')});db[_0x49f9('0x125')][_0x49f9('0x10a')](db[_0x49f9('0x8c')],{'as':_0x49f9('0x8c'),'foreignKey':_0x49f9('0x156')});db[_0x49f9('0x125')]['belongsTo'](db['Pause'],{'as':_0x49f9('0x13d'),'foreignKey':_0x49f9('0x157')});db[_0x49f9('0x125')][_0x49f9('0x10b')](db[_0x49f9('0xfa')],{'as':'Agents','through':_0x49f9('0x127')});db['MailQueue']['belongsToMany'](db['User'],{'as':_0x49f9('0x13f'),'through':'UserMailQueue'});db['MailQueue'][_0x49f9('0x10b')](db['Team'],{'through':_0x49f9('0x158'),'as':_0x49f9('0x140')});db[_0x49f9('0x3d')][_0x49f9('0xfc')](db[_0x49f9('0x3e')],{'as':_0x49f9('0x144'),'onDelete':_0x49f9('0x101'),'foreignKey':_0x49f9('0x159')});db[_0x49f9('0x3d')]['belongsTo'](db[_0x49f9('0x125')],{'as':_0x49f9('0x15a'),'foreignKey':'MailAccountId'});db[_0x49f9('0x3d')][_0x49f9('0x10a')](db['CmContact'],{'as':'Contact','foreignKey':_0x49f9('0x14b')});db[_0x49f9('0x3d')][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'as':'Owner','foreignKey':'UserId'});db['MailInteraction'][_0x49f9('0x10b')](db[_0x49f9('0x8b')],{'through':'mail_interaction_has_tags','as':_0x49f9('0x15b')});db[_0x49f9('0x3d')]['belongsToMany'](db[_0x49f9('0x8b')],{'through':_0x49f9('0x15c'),'as':_0x49f9('0x15d')});db['MailInteraction']['belongsToMany'](db[_0x49f9('0xfa')],{'as':'Users','through':_0x49f9('0x113'),'foreignKey':'MailInteractionId'});db[_0x49f9('0x3e')]['hasMany'](db[_0x49f9('0xd8')],{'as':_0x49f9('0x15e'),'onDelete':'cascade'});db['MailMessage'][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'as':_0x49f9('0xfa')});db['MailMessage'][_0x49f9('0x10a')](db[_0x49f9('0x6d')],{'onDelete':_0x49f9('0x101'),'as':_0x49f9('0x14a')});db['MailMessage'][_0x49f9('0x10a')](db['MailInteraction'],{'as':_0x49f9('0x15f'),'foreignKey':_0x49f9('0x159')});db[_0x49f9('0x3e')][_0x49f9('0x10a')](db['MailAccount'],{'as':'Account','foreignKey':_0x49f9('0x14c')});db[_0x49f9('0x3e')]['belongsTo'](db[_0x49f9('0x5d')],{'as':_0x49f9('0x5d'),'foreignKey':_0x49f9('0x160')});db[_0x49f9('0x3e')]['belongsTo'](db['ChatOfflineMessage'],{'as':_0x49f9('0x161'),'foreignKey':_0x49f9('0x162')});db[_0x49f9('0x3f')][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'onDelete':_0x49f9('0x14d')});db['MailApplication'][_0x49f9('0x10a')](db[_0x49f9('0x3a')],{'onDelete':_0x49f9('0x14d')});db[_0x49f9('0x3f')][_0x49f9('0x10a')](db[_0x49f9('0x125')],{'onDelete':_0x49f9('0x14d')});db['MailApplication'][_0x49f9('0x10a')](db[_0x49f9('0x81')],{'onDelete':_0x49f9('0x14d'),'foreignKey':_0x49f9('0x13b')});db[_0x49f9('0x3f')][_0x49f9('0x10a')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x49f9('0x163')});db[_0x49f9('0x40')][_0x49f9('0x10a')](db[_0x49f9('0x125')],{});db[_0x49f9('0x40')][_0x49f9('0x10a')](db[_0x49f9('0xe4')],{'as':_0x49f9('0x154'),'foreignKey':_0x49f9('0x155')});db[_0x49f9('0x40')][_0x49f9('0x10a')](db[_0x49f9('0x6d')],{'as':'Contact','foreignKey':_0x49f9('0x14b')});db[_0x49f9('0x40')]['belongsTo'](db[_0x49f9('0x3d')],{});db[_0x49f9('0x40')]['belongsTo'](db['MailMessage'],{});db['MailQueueReport']['belongsTo'](db[_0x49f9('0xfa')],{});db[_0x49f9('0x40')][_0x49f9('0x10a')](db[_0x49f9('0x3a')],{});db[_0x49f9('0x164')][_0x49f9('0xfc')](db['DashboardItem'],{'as':_0x49f9('0x165'),'onDelete':'cascade'});db[_0x49f9('0x45')]['hasMany'](db[_0x49f9('0x7d')],{'as':_0x49f9('0x166'),'foreignKey':_0x49f9('0x167'),'onDelete':_0x49f9('0x101')});db[_0x49f9('0x45')][_0x49f9('0xfc')](db[_0x49f9('0x7b')],{'as':_0x49f9('0x168'),'foreignKey':_0x49f9('0x167')});db['FaxAccount'][_0x49f9('0xfc')](db[_0x49f9('0x48')],{'as':_0x49f9('0x152')});db[_0x49f9('0x45')][_0x49f9('0xfc')](db[_0x49f9('0x46')],{'as':_0x49f9('0x153')});db[_0x49f9('0x45')][_0x49f9('0xfc')](db[_0x49f9('0x16')],{'as':'Exntensions','onDelete':_0x49f9('0x101')});db[_0x49f9('0x45')][_0x49f9('0xfc')](db[_0x49f9('0x49')],{'as':_0x49f9('0x144')});db['FaxAccount']['belongsTo'](db[_0x49f9('0x139')],{'as':_0x49f9('0x139')});db[_0x49f9('0x45')]['belongsTo'](db[_0x49f9('0xe4')],{'as':_0x49f9('0x154'),'foreignKey':_0x49f9('0x155')});db[_0x49f9('0x45')][_0x49f9('0x10a')](db[_0x49f9('0x13c')],{'as':_0x49f9('0x13d'),'foreignKey':_0x49f9('0x157')});db[_0x49f9('0x45')][_0x49f9('0x10b')](db[_0x49f9('0xfa')],{'as':'Agents','through':_0x49f9('0x169')});db[_0x49f9('0x46')][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'onDelete':'restrict'});db[_0x49f9('0x46')]['belongsTo'](db[_0x49f9('0x11c')],{'onDelete':_0x49f9('0x14d')});db[_0x49f9('0x46')][_0x49f9('0x10a')](db['FaxAccount'],{'onDelete':_0x49f9('0x14d')});db[_0x49f9('0x46')][_0x49f9('0x10a')](db[_0x49f9('0x8b')],{'onDelete':_0x49f9('0x14d'),'foreignKey':_0x49f9('0x163')});db[_0x49f9('0x48')][_0x49f9('0xfc')](db[_0x49f9('0x49')],{'as':'Messages','onDelete':_0x49f9('0x101'),'foreignKey':_0x49f9('0x16a')});db['FaxInteraction']['belongsTo'](db['FaxAccount'],{'as':_0x49f9('0x15a'),'foreignKey':_0x49f9('0x167')});db[_0x49f9('0x48')][_0x49f9('0x10a')](db['CmContact'],{'as':_0x49f9('0x14a'),'foreignKey':'ContactId'});db[_0x49f9('0x48')][_0x49f9('0x10a')](db['User'],{'as':'Owner','foreignKey':_0x49f9('0xfb')});db[_0x49f9('0x48')][_0x49f9('0x10b')](db[_0x49f9('0x8b')],{'through':_0x49f9('0x16b'),'as':_0x49f9('0x15b')});db[_0x49f9('0x48')][_0x49f9('0x10b')](db[_0x49f9('0x8b')],{'through':_0x49f9('0x16b'),'as':_0x49f9('0x15d')});db[_0x49f9('0x48')][_0x49f9('0x10b')](db[_0x49f9('0xfa')],{'as':_0x49f9('0x16c'),'through':_0x49f9('0x115'),'foreignKey':_0x49f9('0x16a')});db['FaxMessage'][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'onDelete':'cascade','as':_0x49f9('0xfa')});db[_0x49f9('0x49')][_0x49f9('0x10a')](db[_0x49f9('0x48')],{'as':_0x49f9('0x15f'),'foreignKey':_0x49f9('0x16a')});db['FaxMessage'][_0x49f9('0x10a')](db[_0x49f9('0x6d')],{'onDelete':_0x49f9('0x101'),'as':_0x49f9('0x14a')});db[_0x49f9('0x49')][_0x49f9('0x10a')](db[_0x49f9('0xd8')],{'as':_0x49f9('0xd8'),'foreignKey':_0x49f9('0x16d')});db['FaxMessage']['belongsTo'](db[_0x49f9('0x45')],{'as':_0x49f9('0x15a'),'foreignKey':_0x49f9('0x167')});db['FaxQueue']['belongsToMany'](db[_0x49f9('0xfa')],{'as':_0x49f9('0x13f'),'through':_0x49f9('0x11d')});db[_0x49f9('0x11c')][_0x49f9('0x10b')](db[_0x49f9('0xd2')],{'through':_0x49f9('0x16e'),'as':_0x49f9('0x140')});db[_0x49f9('0x4b')]['belongsTo'](db[_0x49f9('0x45')],{});db[_0x49f9('0x4b')][_0x49f9('0x10a')](db[_0x49f9('0xe4')],{'as':_0x49f9('0x154'),'foreignKey':_0x49f9('0x155')});db[_0x49f9('0x4b')]['belongsTo'](db[_0x49f9('0x6d')],{'as':_0x49f9('0x14a'),'foreignKey':_0x49f9('0x14b')});db['FaxQueueReport'][_0x49f9('0x10a')](db[_0x49f9('0x48')],{});db['FaxQueueReport']['belongsTo'](db[_0x49f9('0x49')],{});db[_0x49f9('0x4b')][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{});db[_0x49f9('0x4b')]['belongsTo'](db[_0x49f9('0x11c')],{});db['SmsAccount'][_0x49f9('0xfc')](db[_0x49f9('0x7d')],{'as':_0x49f9('0x166'),'foreignKey':_0x49f9('0x16f'),'onDelete':_0x49f9('0x101')});db[_0x49f9('0x4d')][_0x49f9('0xfc')](db['CannedAnswer'],{'as':_0x49f9('0x168'),'foreignKey':_0x49f9('0x16f')});db[_0x49f9('0x4d')]['hasMany'](db['SmsMessage'],{'as':'Messages','foreignKey':'SmsAccountId'});db[_0x49f9('0x4d')]['hasMany'](db[_0x49f9('0x50')],{'as':_0x49f9('0x152')});db[_0x49f9('0x4d')][_0x49f9('0xfc')](db[_0x49f9('0x4f')],{'as':'Applications'});db[_0x49f9('0x4d')]['belongsTo'](db[_0x49f9('0xe4')],{'as':_0x49f9('0x154'),'foreignKey':_0x49f9('0x155')});db[_0x49f9('0x4d')][_0x49f9('0x10a')](db[_0x49f9('0x13c')],{'as':_0x49f9('0x13d'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x49f9('0x4d')][_0x49f9('0x10b')](db['User'],{'as':_0x49f9('0x13f'),'through':_0x49f9('0x12b')});db['SmsApplication'][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'onDelete':_0x49f9('0x14d')});db['SmsApplication'][_0x49f9('0x10a')](db[_0x49f9('0x54')],{'onDelete':'restrict'});db[_0x49f9('0x4f')]['belongsTo'](db['SmsAccount'],{'onDelete':_0x49f9('0x14d')});db['SmsApplication'][_0x49f9('0x10a')](db[_0x49f9('0x81')],{'onDelete':_0x49f9('0x14d'),'foreignKey':_0x49f9('0x13b')});db['SmsApplication']['belongsTo'](db[_0x49f9('0x8b')],{'onDelete':_0x49f9('0x14d'),'foreignKey':_0x49f9('0x163')});db[_0x49f9('0x50')][_0x49f9('0xfc')](db[_0x49f9('0x52')],{'as':_0x49f9('0x144'),'onDelete':_0x49f9('0x101'),'foreignKey':_0x49f9('0x170')});db['SmsInteraction'][_0x49f9('0x10a')](db[_0x49f9('0x4d')],{'as':_0x49f9('0x15a'),'foreignKey':_0x49f9('0x16f')});db[_0x49f9('0x50')]['belongsTo'](db[_0x49f9('0x6d')],{'as':_0x49f9('0x14a'),'foreignKey':'ContactId'});db[_0x49f9('0x50')][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'as':_0x49f9('0x171'),'foreignKey':'UserId'});db[_0x49f9('0x50')][_0x49f9('0x10b')](db[_0x49f9('0x8b')],{'through':_0x49f9('0x172'),'as':_0x49f9('0x15b')});db['SmsInteraction'][_0x49f9('0x10b')](db[_0x49f9('0x8b')],{'through':_0x49f9('0x172'),'as':'ThroughTags'});db[_0x49f9('0x50')][_0x49f9('0x10b')](db[_0x49f9('0xfa')],{'as':_0x49f9('0x16c'),'through':_0x49f9('0x117'),'foreignKey':_0x49f9('0x170')});db[_0x49f9('0x52')][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'as':'User'});db['SmsMessage'][_0x49f9('0x10a')](db['CmContact'],{'onDelete':_0x49f9('0x101'),'as':_0x49f9('0x14a')});db[_0x49f9('0x52')][_0x49f9('0x10a')](db[_0x49f9('0x50')],{'onDelete':_0x49f9('0x101'),'as':_0x49f9('0x15f'),'foreignKey':_0x49f9('0x170')});db[_0x49f9('0x52')][_0x49f9('0x10a')](db['SmsAccount'],{'as':_0x49f9('0x15a'),'foreignKey':_0x49f9('0x16f')});db['SmsQueue'][_0x49f9('0x10b')](db['User'],{'as':_0x49f9('0x13f'),'through':'UserSmsQueue','foreignKey':_0x49f9('0x173')});db[_0x49f9('0x54')][_0x49f9('0x10b')](db['Team'],{'through':_0x49f9('0x174'),'as':'Teams'});db['OpenchannelAccount'][_0x49f9('0xfc')](db[_0x49f9('0x7d')],{'as':_0x49f9('0x166'),'foreignKey':_0x49f9('0x175'),'onDelete':'cascade'});db[_0x49f9('0x56')]['hasMany'](db[_0x49f9('0x7b')],{'as':_0x49f9('0x168'),'foreignKey':_0x49f9('0x175')});db[_0x49f9('0x56')][_0x49f9('0xfc')](db[_0x49f9('0x59')],{'as':_0x49f9('0x152'),'foreignKey':'OpenchannelAccountId'});db[_0x49f9('0x56')][_0x49f9('0xfc')](db[_0x49f9('0x5a')],{'as':_0x49f9('0x144'),'foreignKey':_0x49f9('0x175')});db[_0x49f9('0x56')]['hasMany'](db[_0x49f9('0x57')],{'as':_0x49f9('0x153'),'foreignKey':_0x49f9('0x175')});db[_0x49f9('0x56')][_0x49f9('0x10a')](db[_0x49f9('0xe4')],{'as':_0x49f9('0x154'),'foreignKey':_0x49f9('0x155')});db[_0x49f9('0x56')][_0x49f9('0x10a')](db[_0x49f9('0x13c')],{'as':'mandatoryDispositionPause','foreignKey':_0x49f9('0x157')});db[_0x49f9('0x56')]['belongsToMany'](db[_0x49f9('0xfa')],{'as':'Agents','through':'user_has_openchannel_accounts'});db[_0x49f9('0x57')][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'onDelete':_0x49f9('0x14d')});db[_0x49f9('0x57')][_0x49f9('0x10a')](db[_0x49f9('0x5c')],{'onDelete':_0x49f9('0x14d'),'foreignKey':_0x49f9('0x176')});db[_0x49f9('0x57')][_0x49f9('0x10a')](db[_0x49f9('0x56')],{'onDelete':_0x49f9('0x14d'),'foreignKey':'OpenchannelAccountId'});db[_0x49f9('0x57')][_0x49f9('0x10a')](db[_0x49f9('0x81')],{'onDelete':_0x49f9('0x14d'),'foreignKey':_0x49f9('0x13b')});db[_0x49f9('0x57')][_0x49f9('0x10a')](db[_0x49f9('0x8b')],{'onDelete':_0x49f9('0x14d'),'foreignKey':_0x49f9('0x163')});db['OpenchannelInteraction'][_0x49f9('0xfc')](db[_0x49f9('0x5a')],{'as':_0x49f9('0x144'),'onDelete':_0x49f9('0x101'),'foreignKey':'OpenchannelInteractionId'});db[_0x49f9('0x59')]['belongsTo'](db['OpenchannelAccount'],{'as':_0x49f9('0x15a'),'foreignKey':'OpenchannelAccountId'});db[_0x49f9('0x59')]['belongsTo'](db[_0x49f9('0x6d')],{'as':_0x49f9('0x14a'),'foreignKey':_0x49f9('0x14b')});db[_0x49f9('0x59')][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'as':_0x49f9('0x171'),'foreignKey':_0x49f9('0xfb')});db['OpenchannelInteraction'][_0x49f9('0x10b')](db[_0x49f9('0x8b')],{'through':_0x49f9('0x177'),'as':_0x49f9('0x15b')});db[_0x49f9('0x59')][_0x49f9('0x10b')](db['Tag'],{'through':_0x49f9('0x177'),'as':_0x49f9('0x15d')});db[_0x49f9('0x59')]['belongsToMany'](db[_0x49f9('0xfa')],{'as':'Users','through':_0x49f9('0x118'),'foreignKey':_0x49f9('0x178')});db['OpenchannelMessage'][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'onDelete':_0x49f9('0x101'),'as':_0x49f9('0xfa')});db[_0x49f9('0x5a')][_0x49f9('0x10a')](db[_0x49f9('0x6d')],{'onDelete':'cascade','as':_0x49f9('0x14a')});db[_0x49f9('0x5a')]['belongsTo'](db['OpenchannelInteraction'],{'onDelete':_0x49f9('0x101'),'as':'Interaction','foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0x49f9('0x10a')](db[_0x49f9('0xd8')],{'as':_0x49f9('0xd8'),'foreignKey':_0x49f9('0x16d')});db['OpenchannelMessage'][_0x49f9('0x10a')](db[_0x49f9('0x56')],{'as':_0x49f9('0x15a'),'foreignKey':'OpenchannelAccountId'});db[_0x49f9('0x5c')][_0x49f9('0x10b')](db[_0x49f9('0xfa')],{'as':_0x49f9('0x13f'),'through':_0x49f9('0x120'),'foreignKey':_0x49f9('0x176')});db['OpenchannelQueue'][_0x49f9('0x10b')](db['Team'],{'through':_0x49f9('0x179'),'as':_0x49f9('0x140')});db[_0x49f9('0x5d')][_0x49f9('0xfc')](db[_0x49f9('0x7d')],{'as':_0x49f9('0x166'),'foreignKey':_0x49f9('0x160'),'onDelete':_0x49f9('0x101')});db[_0x49f9('0x5d')][_0x49f9('0xfc')](db[_0x49f9('0x7b')],{'as':_0x49f9('0x168'),'foreignKey':_0x49f9('0x160')});db[_0x49f9('0x5d')]['hasMany'](db[_0x49f9('0x69')],{'as':_0x49f9('0x17a')});db[_0x49f9('0x5d')][_0x49f9('0xfc')](db['ChatInteraction'],{'as':_0x49f9('0x152')});db[_0x49f9('0x5d')][_0x49f9('0xfc')](db[_0x49f9('0x17b')],{'as':'Applications'});db['ChatWebsite'][_0x49f9('0xfc')](db['ChatMessage'],{'as':_0x49f9('0x144')});db[_0x49f9('0x5d')][_0x49f9('0x10a')](db[_0x49f9('0xe4')],{'as':_0x49f9('0x154'),'foreignKey':'ListId'});db['ChatWebsite'][_0x49f9('0x10a')](db['Interval'],{'as':'Interval','foreignKey':'IntervalId'});db[_0x49f9('0x5d')][_0x49f9('0x10a')](db[_0x49f9('0x125')],{'as':_0x49f9('0x125'),'foreignKey':_0x49f9('0x14c')});db[_0x49f9('0x5d')][_0x49f9('0x10a')](db[_0x49f9('0x13c')],{'as':_0x49f9('0x13d'),'foreignKey':_0x49f9('0x157')});db[_0x49f9('0x5d')]['belongsToMany'](db[_0x49f9('0xfa')],{'as':_0x49f9('0x13f'),'through':_0x49f9('0x123')});db[_0x49f9('0x5f')][_0x49f9('0x10a')](db[_0x49f9('0x56')],{});db[_0x49f9('0x5f')][_0x49f9('0x10a')](db[_0x49f9('0xe4')],{'as':_0x49f9('0x154'),'foreignKey':_0x49f9('0x155')});db['OpenchannelQueueReport'][_0x49f9('0x10a')](db['CmContact'],{'as':_0x49f9('0x14a'),'foreignKey':_0x49f9('0x14b')});db['OpenchannelQueueReport']['belongsTo'](db[_0x49f9('0x59')],{});db[_0x49f9('0x5f')]['belongsTo'](db['OpenchannelMessage'],{});db[_0x49f9('0x5f')][_0x49f9('0x10a')](db['User'],{});db['OpenchannelQueueReport'][_0x49f9('0x10a')](db[_0x49f9('0x5c')],{});db[_0x49f9('0x17b')][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'as':_0x49f9('0x17c'),'foreignKey':'UserId','onDelete':_0x49f9('0x14d')});db[_0x49f9('0x17b')][_0x49f9('0x10a')](db['ChatQueue'],{'as':'Queue','foreignKey':_0x49f9('0x17d'),'onDelete':_0x49f9('0x14d')});db['ChatApplication'][_0x49f9('0x10a')](db[_0x49f9('0x5d')],{'as':'Website','foreignKey':'ChatWebsiteId','onDelete':_0x49f9('0x14d')});db[_0x49f9('0x17b')][_0x49f9('0x10a')](db['Tag'],{'onDelete':_0x49f9('0x14d'),'foreignKey':_0x49f9('0x163')});db[_0x49f9('0x61')][_0x49f9('0xfc')](db[_0x49f9('0x63')],{'as':_0x49f9('0x144'),'onDelete':'cascade','foreignKey':_0x49f9('0x17e')});db[_0x49f9('0x61')][_0x49f9('0x10a')](db[_0x49f9('0x5d')],{'as':_0x49f9('0x15a'),'foreignKey':'ChatWebsiteId'});db[_0x49f9('0x61')][_0x49f9('0x10a')](db[_0x49f9('0x6d')],{'as':_0x49f9('0x14a'),'foreignKey':_0x49f9('0x14b')});db[_0x49f9('0x61')][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'as':_0x49f9('0x171'),'foreignKey':_0x49f9('0xfb')});db[_0x49f9('0x61')][_0x49f9('0x10b')](db[_0x49f9('0x8b')],{'through':_0x49f9('0x17f'),'as':_0x49f9('0x15b')});db[_0x49f9('0x61')][_0x49f9('0x10b')](db[_0x49f9('0x8b')],{'through':_0x49f9('0x17f'),'as':_0x49f9('0x15d')});db['ChatInteraction'][_0x49f9('0x10b')](db[_0x49f9('0xfa')],{'as':_0x49f9('0x16c'),'through':_0x49f9('0x114'),'foreignKey':_0x49f9('0x17e')});db[_0x49f9('0x63')][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'onDelete':'cascade','as':_0x49f9('0xfa')});db[_0x49f9('0x63')][_0x49f9('0x10a')](db['CmContact'],{'onDelete':_0x49f9('0x101'),'as':_0x49f9('0x14a'),'foreignKey':_0x49f9('0x14b')});db[_0x49f9('0x63')][_0x49f9('0x10a')](db[_0x49f9('0x61')],{'onDelete':_0x49f9('0x101'),'as':_0x49f9('0x15f'),'foreignKey':_0x49f9('0x17e')});db[_0x49f9('0x63')][_0x49f9('0x10a')](db[_0x49f9('0xd8')],{'as':'Attachment','foreignKey':'AttachmentId'});db['ChatMessage'][_0x49f9('0x10a')](db[_0x49f9('0x5d')],{'as':_0x49f9('0x15a'),'foreignKey':_0x49f9('0x160')});db[_0x49f9('0x161')][_0x49f9('0xfc')](db[_0x49f9('0xd8')],{'as':_0x49f9('0x15e'),'foreignKey':_0x49f9('0x162'),'onDelete':_0x49f9('0x101'),'hooks':!![]});db[_0x49f9('0x161')]['belongsTo'](db[_0x49f9('0x6d')],{'onDelete':_0x49f9('0x101'),'as':_0x49f9('0x14a'),'foreignKey':'ContactId'});db[_0x49f9('0x161')][_0x49f9('0x10a')](db['ChatWebsite'],{'as':_0x49f9('0x15a'),'foreignKey':'ChatWebsiteId'});db[_0x49f9('0x66')][_0x49f9('0x10b')](db[_0x49f9('0xfa')],{'as':_0x49f9('0x13f'),'through':'UserChatQueue','hooks':!![]});db[_0x49f9('0x66')][_0x49f9('0x10b')](db[_0x49f9('0xd2')],{'through':_0x49f9('0x180'),'as':'Teams'});db[_0x49f9('0x68')][_0x49f9('0xfc')](db[_0x49f9('0xc4')],{'as':'Messages','foreignKey':_0x49f9('0x181'),'onDelete':_0x49f9('0x101')});db['ChatGroup'][_0x49f9('0x10b')](db[_0x49f9('0xfa')],{'as':_0x49f9('0x131'),'through':'chat_group_has_users'});db[_0x49f9('0x69')]['belongsTo'](db['ChatWebsite'],{'as':_0x49f9('0x182'),'foreignKey':'ChatWebsiteId'});db['CmCompany']['hasMany'](db[_0x49f9('0x6d')],{'as':_0x49f9('0x10e'),'foreignKey':'CompanyId'});db['CmContact'][_0x49f9('0xfc')](db[_0x49f9('0x6e')],{'as':_0x49f9('0x134'),'foreignKey':_0x49f9('0x14b')});db[_0x49f9('0x6d')]['hasMany'](db[_0x49f9('0x70')],{'as':'HopperFinals','foreignKey':_0x49f9('0x14b')});db['CmContact'][_0x49f9('0xfc')](db['CmHopperHistory'],{'as':_0x49f9('0x135'),'foreignKey':_0x49f9('0x14b')});db[_0x49f9('0x6d')][_0x49f9('0xfc')](db[_0x49f9('0x74')],{'as':'ReportAgentPreview','foreignKey':_0x49f9('0x14b')});db[_0x49f9('0x6d')]['hasMany'](db[_0x49f9('0xc8')],{'as':_0x49f9('0x138'),'foreignKey':_0x49f9('0x14b')});db[_0x49f9('0x6d')][_0x49f9('0xfc')](db[_0x49f9('0x59')],{'as':'OpenchannelInteractions','foreignKey':_0x49f9('0x14b'),'onDelete':_0x49f9('0x14d')});db[_0x49f9('0x6d')][_0x49f9('0xfc')](db[_0x49f9('0x61')],{'as':_0x49f9('0x105'),'foreignKey':_0x49f9('0x14b'),'onDelete':'restrict'});db['CmContact'][_0x49f9('0xfc')](db[_0x49f9('0x50')],{'as':_0x49f9('0x116'),'foreignKey':_0x49f9('0x14b'),'onDelete':_0x49f9('0x14d')});db[_0x49f9('0x6d')][_0x49f9('0xfc')](db[_0x49f9('0x48')],{'as':_0x49f9('0x183'),'foreignKey':_0x49f9('0x14b'),'onDelete':_0x49f9('0x14d')});db['CmContact']['hasMany'](db[_0x49f9('0x3d')],{'as':_0x49f9('0x106'),'foreignKey':_0x49f9('0x14b'),'onDelete':_0x49f9('0x14d')});db[_0x49f9('0x6d')][_0x49f9('0x10a')](db[_0x49f9('0x6b')],{'as':_0x49f9('0x184'),'foreignKey':_0x49f9('0x185')});db[_0x49f9('0x6d')][_0x49f9('0x10a')](db[_0x49f9('0xe4')],{'as':_0x49f9('0x154'),'foreignKey':'ListId','onDelete':_0x49f9('0x101')});db[_0x49f9('0x6d')][_0x49f9('0x10b')](db['User'],{'as':'Users','through':_0x49f9('0x10f')});db[_0x49f9('0x6d')][_0x49f9('0x10b')](db['Tag'],{'as':_0x49f9('0x15b'),'through':_0x49f9('0x186')});db[_0x49f9('0x6d')][_0x49f9('0x10b')](db[_0x49f9('0x8b')],{'through':_0x49f9('0x186'),'as':_0x49f9('0x15d')});db[_0x49f9('0x6e')][_0x49f9('0x10a')](db[_0x49f9('0x6d')],{'as':_0x49f9('0x14a'),'foreignKey':_0x49f9('0x14b'),'onDelete':_0x49f9('0x101')});db[_0x49f9('0x6e')][_0x49f9('0x10a')](db[_0x49f9('0xe4')],{'as':_0x49f9('0x154'),'foreignKey':_0x49f9('0x155'),'onDelete':_0x49f9('0x101')});db[_0x49f9('0x6e')][_0x49f9('0x10a')](db['User'],{'as':_0x49f9('0x17c'),'foreignKey':'UserId'});db[_0x49f9('0x6e')][_0x49f9('0x10a')](db[_0x49f9('0x133')],{'as':_0x49f9('0x187'),'foreignKey':'VoiceQueueId','onDelete':_0x49f9('0x101')});db[_0x49f9('0x6e')]['belongsTo'](db[_0x49f9('0xd4')],{'as':_0x49f9('0xd4'),'foreignKey':'CampaignId','onDelete':_0x49f9('0x101')});db[_0x49f9('0x6e')]['belongsTo'](db[_0x49f9('0xfa')],{'as':'Owner','foreignKey':_0x49f9('0x188')});db[_0x49f9('0x136')]['belongsTo'](db[_0x49f9('0x6d')],{'as':_0x49f9('0x14a'),'foreignKey':_0x49f9('0x14b'),'onDelete':_0x49f9('0x101')});db[_0x49f9('0x136')][_0x49f9('0x10a')](db[_0x49f9('0xe4')],{'as':_0x49f9('0x154'),'foreignKey':'ListId','onDelete':_0x49f9('0x101')});db[_0x49f9('0x136')][_0x49f9('0x10a')](db[_0x49f9('0x133')],{'as':_0x49f9('0x187'),'foreignKey':_0x49f9('0x132'),'onDelete':'cascade'});db[_0x49f9('0x136')]['belongsTo'](db[_0x49f9('0xd4')],{'as':_0x49f9('0xd4'),'foreignKey':_0x49f9('0x189'),'onDelete':_0x49f9('0x101')});db[_0x49f9('0x18a')][_0x49f9('0xfc')](db[_0x49f9('0x7f')],{'as':{'plural':_0x49f9('0x18b'),'singular':'OneAll'},'foreignKey':_0x49f9('0x18c'),'onDelete':_0x49f9('0x101'),'hooks':!![]});db[_0x49f9('0x18a')][_0x49f9('0xfc')](db['Condition'],{'as':{'plural':'Any','singular':_0x49f9('0x18d')},'foreignKey':_0x49f9('0x18e'),'onDelete':'cascade','hooks':!![]});db[_0x49f9('0x18a')][_0x49f9('0xfc')](db['Action'],{'as':_0x49f9('0x18f'),'foreignKey':_0x49f9('0x190'),'onDelete':_0x49f9('0x101'),'hooks':!![]});db['Disposition'][_0x49f9('0xfc')](db[_0x49f9('0x7d')],{'as':_0x49f9('0x166'),'foreignKey':_0x49f9('0x191'),'onDelete':'cascade'});db['Interval'][_0x49f9('0xfc')](db[_0x49f9('0x81')],{'as':_0x49f9('0x192'),'foreignKey':'IntervalId','onDelete':_0x49f9('0x101'),'hooks':!![],'required':![]});db[_0x49f9('0x81')][_0x49f9('0xfc')](db[_0x49f9('0x16')],{'as':'Extensions','foreignKey':_0x49f9('0x13b'),'onDelete':_0x49f9('0x14d')});db[_0x49f9('0x81')]['hasMany'](db['MailApplication'],{'as':_0x49f9('0x193'),'foreignKey':'IntervalId'});db[_0x49f9('0x81')][_0x49f9('0xfc')](db['ChatApplication'],{'as':_0x49f9('0x194'),'foreignKey':_0x49f9('0x13b')});db[_0x49f9('0x81')][_0x49f9('0xfc')](db[_0x49f9('0x46')],{'as':_0x49f9('0x195'),'foreignKey':_0x49f9('0x13b')});db['Interval'][_0x49f9('0xfc')](db[_0x49f9('0x4f')],{'as':_0x49f9('0x196'),'foreignKey':_0x49f9('0x13b')});db[_0x49f9('0x88')]['belongsTo'](db[_0x49f9('0x125')],{});db[_0x49f9('0x88')][_0x49f9('0x10a')](db[_0x49f9('0x96')],{'foreignKey':_0x49f9('0x197')});db[_0x49f9('0x88')]['belongsTo'](db[_0x49f9('0x95')],{'foreignKey':_0x49f9('0x198')});db[_0x49f9('0x89')]['belongsToMany'](db[_0x49f9('0x18')],{'as':_0x49f9('0x199'),'through':_0x49f9('0x130'),'onDelete':_0x49f9('0x14d')});db[_0x49f9('0x8b')][_0x49f9('0x10b')](db[_0x49f9('0x6d')],{'through':_0x49f9('0x186')});db[_0x49f9('0x8b')][_0x49f9('0x10b')](db[_0x49f9('0x61')],{'through':_0x49f9('0x17f')});db['Tag'][_0x49f9('0x10b')](db[_0x49f9('0x3d')],{'through':_0x49f9('0x15c')});db[_0x49f9('0x8b')][_0x49f9('0x10b')](db['SmsInteraction'],{'through':_0x49f9('0x172')});db[_0x49f9('0x8b')][_0x49f9('0x10b')](db['FaxInteraction'],{'through':_0x49f9('0x16b')});db[_0x49f9('0x8b')][_0x49f9('0x10b')](db['OpenchannelInteraction'],{'through':_0x49f9('0x177')});db[_0x49f9('0x8b')][_0x49f9('0x10b')](db[_0x49f9('0xed')],{'through':_0x49f9('0x19a')});db[_0x49f9('0x8e')]['hasMany'](db[_0x49f9('0x7f')],{'as':{'plural':_0x49f9('0x19b'),'singular':_0x49f9('0x19c')},'foreignKey':_0x49f9('0x19d'),'onDelete':_0x49f9('0x101'),'hooks':!![]});db[_0x49f9('0x8e')]['hasMany'](db[_0x49f9('0x7f')],{'as':{'plural':_0x49f9('0x19e'),'singular':_0x49f9('0x19f')},'foreignKey':_0x49f9('0x1a0'),'onDelete':_0x49f9('0x101'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x49f9('0x78')],{'as':_0x49f9('0x18f'),'foreignKey':'TriggerId','onDelete':_0x49f9('0x101'),'hooks':!![]});db[_0x49f9('0x95')][_0x49f9('0xfc')](db[_0x49f9('0x98')],{'as':_0x49f9('0x1a1'),'onDelete':_0x49f9('0x101'),'foreignKey':_0x49f9('0x198'),'hooks':!![]});db['AnalyticDefaultReport'][_0x49f9('0xfc')](db[_0x49f9('0x98')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x49f9('0x197')});db['AnalyticMetric'][_0x49f9('0xfc')](db['AnalyticFieldReport'],{'as':_0x49f9('0x1a1'),'onDelete':_0x49f9('0x101'),'foreignKey':_0x49f9('0x1a2')});db[_0x49f9('0x98')][_0x49f9('0x10a')](db[_0x49f9('0x1a3')],{'foreignKey':_0x49f9('0x1a2')});db[_0x49f9('0x1a4')][_0x49f9('0xfc')](db[_0x49f9('0x9a')],{'as':_0x49f9('0x1a5'),'onDelete':_0x49f9('0x101'),'foreignKey':'AccountId'});db[_0x49f9('0x9a')][_0x49f9('0xfc')](db[_0x49f9('0x9c')],{'as':_0x49f9('0x1a6'),'onDelete':_0x49f9('0x101'),'foreignKey':_0x49f9('0x1a7')});db['SalesforceConfiguration'][_0x49f9('0xfc')](db[_0x49f9('0x9c')],{'as':_0x49f9('0x1a8'),'onDelete':'cascade','foreignKey':_0x49f9('0x1a9')});db[_0x49f9('0x9a')]['hasMany'](db[_0x49f9('0x9c')],{'as':_0x49f9('0x1a1'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x49f9('0x9a')][_0x49f9('0x10a')](db[_0x49f9('0x1a4')],{'as':_0x49f9('0x15a'),'foreignKey':'AccountId'});db['SalesforceField'][_0x49f9('0xfc')](db[_0x49f9('0x9c')],{'as':_0x49f9('0x1aa'),'foreignKey':_0x49f9('0x1a7')});db[_0x49f9('0x9c')][_0x49f9('0xfc')](db[_0x49f9('0x9c')],{'as':_0x49f9('0x1ab'),'foreignKey':'DescriptionId'});db[_0x49f9('0x9c')][_0x49f9('0xfc')](db['SalesforceField'],{'as':_0x49f9('0x1ac'),'foreignKey':'FieldId'});db[_0x49f9('0x9c')][_0x49f9('0x10a')](db[_0x49f9('0x8f')],{'as':_0x49f9('0x8f'),'foreignKey':_0x49f9('0x1ad')});db[_0x49f9('0x1ae')][_0x49f9('0xfc')](db[_0x49f9('0x1af')],{'as':_0x49f9('0x1a5'),'onDelete':'cascade','foreignKey':_0x49f9('0x1b0')});db[_0x49f9('0x1af')][_0x49f9('0xfc')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0x49f9('0x101'),'foreignKey':_0x49f9('0x1a7')});db['SugarcrmConfiguration']['hasMany'](db[_0x49f9('0x9f')],{'as':_0x49f9('0x1a8'),'onDelete':_0x49f9('0x101'),'foreignKey':_0x49f9('0x1a9')});db[_0x49f9('0x1af')]['hasMany'](db[_0x49f9('0x9f')],{'as':_0x49f9('0x1a1'),'onDelete':_0x49f9('0x101'),'foreignKey':'FieldId'});db[_0x49f9('0x1af')][_0x49f9('0x10a')](db[_0x49f9('0x1ae')],{'as':'Account','foreignKey':_0x49f9('0x1b0')});db[_0x49f9('0x9f')][_0x49f9('0xfc')](db['SugarcrmField'],{'as':_0x49f9('0x1aa'),'foreignKey':_0x49f9('0x1a7')});db[_0x49f9('0x9f')][_0x49f9('0xfc')](db['SugarcrmField'],{'as':_0x49f9('0x1ab'),'foreignKey':_0x49f9('0x1a9')});db[_0x49f9('0x9f')][_0x49f9('0xfc')](db[_0x49f9('0x9f')],{'as':_0x49f9('0x1ac'),'foreignKey':_0x49f9('0x1b1')});db[_0x49f9('0x9f')]['belongsTo'](db[_0x49f9('0x8f')],{'as':_0x49f9('0x8f'),'foreignKey':_0x49f9('0x1ad')});db[_0x49f9('0xa0')][_0x49f9('0xfc')](db[_0x49f9('0x1b2')],{'as':_0x49f9('0x1a5'),'onDelete':_0x49f9('0x101'),'foreignKey':_0x49f9('0x1b0')});db[_0x49f9('0x1b2')][_0x49f9('0xfc')](db[_0x49f9('0xa3')],{'as':_0x49f9('0x1a6'),'onDelete':_0x49f9('0x101'),'foreignKey':_0x49f9('0x1a7')});db['DeskConfiguration'][_0x49f9('0xfc')](db[_0x49f9('0xa3')],{'as':_0x49f9('0x1a8'),'onDelete':_0x49f9('0x101'),'foreignKey':'DescriptionId'});db[_0x49f9('0x1b2')]['hasMany'](db[_0x49f9('0xa3')],{'as':'Fields','onDelete':_0x49f9('0x101'),'foreignKey':_0x49f9('0x1b1')});db[_0x49f9('0x1b2')][_0x49f9('0x10a')](db[_0x49f9('0xa0')],{'as':_0x49f9('0x15a'),'foreignKey':'AccountId'});db[_0x49f9('0x1b2')][_0x49f9('0x10b')](db['Tag'],{'through':_0x49f9('0x1b3')});db[_0x49f9('0xa3')][_0x49f9('0xfc')](db['DeskField'],{'as':_0x49f9('0x1aa'),'foreignKey':_0x49f9('0x1a7')});db[_0x49f9('0xa3')][_0x49f9('0xfc')](db['DeskField'],{'as':'Description','foreignKey':_0x49f9('0x1a9')});db[_0x49f9('0xa3')]['hasMany'](db[_0x49f9('0xa3')],{'as':_0x49f9('0x1ac'),'foreignKey':'FieldId'});db['DeskField'][_0x49f9('0x10a')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db['ZohoAccount'][_0x49f9('0xfc')](db['ZohoConfiguration'],{'as':_0x49f9('0x1a5'),'onDelete':_0x49f9('0x101'),'foreignKey':_0x49f9('0x1b0')});db[_0x49f9('0xa6')][_0x49f9('0xfc')](db[_0x49f9('0xa8')],{'as':_0x49f9('0x1a6'),'onDelete':'cascade','foreignKey':_0x49f9('0x1a7')});db['ZohoConfiguration'][_0x49f9('0xfc')](db[_0x49f9('0xa8')],{'as':_0x49f9('0x1a8'),'onDelete':_0x49f9('0x101'),'foreignKey':'DescriptionId'});db[_0x49f9('0xa6')][_0x49f9('0xfc')](db['ZohoField'],{'as':_0x49f9('0x1a1'),'onDelete':_0x49f9('0x101'),'foreignKey':_0x49f9('0x1b1')});db[_0x49f9('0xa6')][_0x49f9('0x10a')](db['ZohoAccount'],{'as':_0x49f9('0x15a'),'foreignKey':_0x49f9('0x1b0')});db[_0x49f9('0xa8')]['hasMany'](db['ZohoField'],{'as':_0x49f9('0x1aa'),'foreignKey':_0x49f9('0x1a7')});db['ZohoField'][_0x49f9('0xfc')](db[_0x49f9('0xa8')],{'as':_0x49f9('0x1ab'),'foreignKey':_0x49f9('0x1a9')});db[_0x49f9('0xa8')]['hasMany'](db[_0x49f9('0xa8')],{'as':'Field','foreignKey':'FieldId'});db[_0x49f9('0xa8')][_0x49f9('0x10a')](db['Variable'],{'as':_0x49f9('0x8f'),'foreignKey':_0x49f9('0x1ad')});db[_0x49f9('0xa9')][_0x49f9('0xfc')](db[_0x49f9('0x1b4')],{'as':_0x49f9('0x1a5'),'onDelete':_0x49f9('0x101'),'foreignKey':_0x49f9('0x1b0')});db[_0x49f9('0x1b4')][_0x49f9('0xfc')](db['ZendeskField'],{'as':_0x49f9('0x1a6'),'foreignKey':'SubjectId'});db[_0x49f9('0x1b4')]['hasMany'](db['ZendeskField'],{'as':_0x49f9('0x1a8'),'foreignKey':'DescriptionId'});db[_0x49f9('0x1b4')][_0x49f9('0xfc')](db['ZendeskField'],{'as':_0x49f9('0x1a1'),'foreignKey':_0x49f9('0x1b1')});db[_0x49f9('0x1b4')][_0x49f9('0x10a')](db[_0x49f9('0xa9')],{'as':'Account','foreignKey':_0x49f9('0x1b0')});db[_0x49f9('0x1b4')][_0x49f9('0x10b')](db[_0x49f9('0x8b')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField']['hasMany'](db[_0x49f9('0xac')],{'as':_0x49f9('0x1aa'),'foreignKey':_0x49f9('0x1a7')});db[_0x49f9('0xac')]['hasMany'](db[_0x49f9('0xac')],{'as':_0x49f9('0x1ab'),'foreignKey':_0x49f9('0x1a9')});db['ZendeskField']['hasMany'](db[_0x49f9('0xac')],{'as':_0x49f9('0x1ac'),'foreignKey':_0x49f9('0x1b1')});db[_0x49f9('0xac')][_0x49f9('0x10a')](db[_0x49f9('0x8f')],{'as':_0x49f9('0x8f'),'foreignKey':_0x49f9('0x1ad')});db['FreshdeskAccount'][_0x49f9('0xfc')](db[_0x49f9('0xb0')],{'as':_0x49f9('0x1a5'),'onDelete':_0x49f9('0x101'),'foreignKey':_0x49f9('0x1b0')});db[_0x49f9('0xb0')][_0x49f9('0xfc')](db['FreshdeskField'],{'as':_0x49f9('0x1a6'),'onDelete':_0x49f9('0x101'),'foreignKey':'SubjectId'});db[_0x49f9('0xb0')][_0x49f9('0xfc')](db[_0x49f9('0xb1')],{'as':'Descriptions','onDelete':_0x49f9('0x101'),'foreignKey':_0x49f9('0x1a9')});db[_0x49f9('0xb0')][_0x49f9('0xfc')](db['FreshdeskField'],{'as':_0x49f9('0x1a1'),'onDelete':_0x49f9('0x101'),'foreignKey':_0x49f9('0x1b1')});db[_0x49f9('0xb0')][_0x49f9('0x10a')](db[_0x49f9('0xae')],{'as':_0x49f9('0x15a'),'foreignKey':'AccountId'});db[_0x49f9('0xb0')]['belongsToMany'](db[_0x49f9('0x8b')],{'through':_0x49f9('0x1b5')});db[_0x49f9('0xb1')]['hasMany'](db['FreshdeskField'],{'as':_0x49f9('0x1aa'),'foreignKey':_0x49f9('0x1a7')});db[_0x49f9('0xb1')][_0x49f9('0xfc')](db[_0x49f9('0xb1')],{'as':_0x49f9('0x1ab'),'foreignKey':_0x49f9('0x1a9')});db[_0x49f9('0xb1')][_0x49f9('0xfc')](db[_0x49f9('0xb1')],{'as':_0x49f9('0x1ac'),'foreignKey':_0x49f9('0x1b1')});db[_0x49f9('0xb1')][_0x49f9('0x10a')](db['Variable'],{'as':_0x49f9('0x8f'),'foreignKey':_0x49f9('0x1ad')});db['VtigerAccount']['hasMany'](db[_0x49f9('0x1b6')],{'as':_0x49f9('0x1a5'),'onDelete':_0x49f9('0x101'),'foreignKey':'AccountId'});db[_0x49f9('0x1b6')][_0x49f9('0xfc')](db[_0x49f9('0xb6')],{'as':_0x49f9('0x1a6'),'foreignKey':_0x49f9('0x1a7')});db[_0x49f9('0x1b6')][_0x49f9('0xfc')](db['VtigerField'],{'as':_0x49f9('0x1a8'),'foreignKey':_0x49f9('0x1a9')});db['VtigerConfiguration']['hasMany'](db[_0x49f9('0xb6')],{'as':_0x49f9('0x1a1'),'foreignKey':_0x49f9('0x1b1')});db['VtigerConfiguration']['belongsTo'](db['VtigerAccount'],{'as':_0x49f9('0x15a'),'foreignKey':_0x49f9('0x1b0')});db[_0x49f9('0xb6')][_0x49f9('0xfc')](db[_0x49f9('0xb6')],{'as':_0x49f9('0x1aa'),'foreignKey':'SubjectId'});db['VtigerField']['hasMany'](db[_0x49f9('0xb6')],{'as':_0x49f9('0x1ab'),'foreignKey':_0x49f9('0x1a9')});db[_0x49f9('0xb6')][_0x49f9('0xfc')](db[_0x49f9('0xb6')],{'as':_0x49f9('0x1ac'),'foreignKey':'FieldId'});db[_0x49f9('0xb6')][_0x49f9('0x10a')](db['Variable'],{'as':_0x49f9('0x8f'),'foreignKey':_0x49f9('0x1ad')});db['ServicenowAccount']['hasMany'](db[_0x49f9('0xb9')],{'as':_0x49f9('0x1a5'),'onDelete':_0x49f9('0x101'),'foreignKey':'AccountId'});db[_0x49f9('0xb9')]['hasMany'](db[_0x49f9('0x1b7')],{'as':_0x49f9('0x1a6'),'foreignKey':_0x49f9('0x1a7')});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':_0x49f9('0x1a8'),'foreignKey':'DescriptionId'});db[_0x49f9('0xb9')][_0x49f9('0xfc')](db[_0x49f9('0x1b7')],{'as':_0x49f9('0x1a1'),'foreignKey':_0x49f9('0x1b1')});db[_0x49f9('0xb9')][_0x49f9('0x10a')](db['ServicenowAccount'],{'as':_0x49f9('0x15a'),'foreignKey':_0x49f9('0x1b0')});db[_0x49f9('0x1b7')]['hasMany'](db[_0x49f9('0x1b7')],{'as':_0x49f9('0x1aa'),'foreignKey':_0x49f9('0x1a7')});db[_0x49f9('0x1b7')][_0x49f9('0xfc')](db['ServicenowField'],{'as':_0x49f9('0x1ab'),'foreignKey':_0x49f9('0x1a9')});db['ServicenowField'][_0x49f9('0xfc')](db[_0x49f9('0x1b7')],{'as':_0x49f9('0x1ac'),'foreignKey':'FieldId'});db['ServicenowField'][_0x49f9('0x10a')](db[_0x49f9('0x8f')],{'as':_0x49f9('0x8f'),'foreignKey':'VariableId'});db[_0x49f9('0xbb')][_0x49f9('0xfc')](db[_0x49f9('0x1b8')],{'as':_0x49f9('0x1a5'),'onDelete':_0x49f9('0x101'),'foreignKey':'AccountId'});db['Dynamics365Configuration'][_0x49f9('0xfc')](db[_0x49f9('0x1b9')],{'as':_0x49f9('0x1a6'),'onDelete':_0x49f9('0x101'),'foreignKey':_0x49f9('0x1a7')});db[_0x49f9('0x1b8')]['hasMany'](db[_0x49f9('0x1b9')],{'as':_0x49f9('0x1a8'),'onDelete':_0x49f9('0x101'),'foreignKey':_0x49f9('0x1a9')});db[_0x49f9('0x1b8')][_0x49f9('0xfc')](db[_0x49f9('0x1b9')],{'as':_0x49f9('0x1a1'),'onDelete':_0x49f9('0x101'),'foreignKey':_0x49f9('0x1b1')});db[_0x49f9('0x1b8')][_0x49f9('0x10a')](db[_0x49f9('0xbb')],{'as':_0x49f9('0x15a'),'foreignKey':_0x49f9('0x1b0')});db['Dynamics365Field']['hasMany'](db[_0x49f9('0x1b9')],{'as':_0x49f9('0x1aa'),'foreignKey':_0x49f9('0x1a7')});db[_0x49f9('0x1b9')]['hasMany'](db[_0x49f9('0x1b9')],{'as':_0x49f9('0x1ab'),'foreignKey':_0x49f9('0x1a9')});db[_0x49f9('0x1b9')][_0x49f9('0xfc')](db[_0x49f9('0x1b9')],{'as':'Field','foreignKey':_0x49f9('0x1b1')});db[_0x49f9('0x1b9')][_0x49f9('0x10a')](db[_0x49f9('0x8f')],{'as':_0x49f9('0x8f'),'foreignKey':_0x49f9('0x1ad')});db[_0x49f9('0xbe')]['hasMany'](db['FreshsalesConfiguration'],{'as':_0x49f9('0x1a5'),'onDelete':_0x49f9('0x101'),'foreignKey':_0x49f9('0x1b0')});db[_0x49f9('0xc0')][_0x49f9('0xfc')](db[_0x49f9('0x1ba')],{'as':_0x49f9('0x1a6'),'foreignKey':_0x49f9('0x1a7')});db[_0x49f9('0xc0')][_0x49f9('0xfc')](db['FreshsalesField'],{'as':_0x49f9('0x1a8'),'foreignKey':_0x49f9('0x1a9')});db['FreshsalesConfiguration'][_0x49f9('0xfc')](db[_0x49f9('0x1ba')],{'as':_0x49f9('0x1a1'),'foreignKey':_0x49f9('0x1b1')});db[_0x49f9('0xc0')]['belongsTo'](db[_0x49f9('0xbe')],{'as':_0x49f9('0x15a'),'foreignKey':_0x49f9('0x1b0')});db[_0x49f9('0x1ba')][_0x49f9('0xfc')](db['FreshsalesField'],{'as':_0x49f9('0x1aa'),'foreignKey':_0x49f9('0x1a7')});db[_0x49f9('0x1ba')][_0x49f9('0xfc')](db[_0x49f9('0x1ba')],{'as':_0x49f9('0x1ab'),'foreignKey':_0x49f9('0x1a9')});db[_0x49f9('0x1ba')]['hasMany'](db[_0x49f9('0x1ba')],{'as':_0x49f9('0x1ac'),'foreignKey':_0x49f9('0x1b1')});db[_0x49f9('0x1ba')][_0x49f9('0x10a')](db[_0x49f9('0x8f')],{'as':_0x49f9('0x8f'),'foreignKey':_0x49f9('0x1ad')});db[_0x49f9('0xc3')]['belongsTo'](db['ChatWebsite'],{});db[_0x49f9('0xc3')][_0x49f9('0x10a')](db['CmList'],{'as':_0x49f9('0x154'),'foreignKey':'ListId'});db[_0x49f9('0xc3')][_0x49f9('0x10a')](db[_0x49f9('0x6d')],{'as':_0x49f9('0x14a'),'foreignKey':_0x49f9('0x14b')});db['ChatQueueReport'][_0x49f9('0x10a')](db[_0x49f9('0x61')],{});db[_0x49f9('0xc3')][_0x49f9('0x10a')](db[_0x49f9('0x63')],{});db[_0x49f9('0xc3')]['belongsTo'](db[_0x49f9('0xfa')],{});db[_0x49f9('0xc3')][_0x49f9('0x10a')](db[_0x49f9('0x66')],{});db[_0x49f9('0xc4')][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'onDelete':_0x49f9('0x101'),'foreignKey':_0x49f9('0x1bb')});db[_0x49f9('0xc4')][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'onDelete':'cascade','foreignKey':'ToId'});db[_0x49f9('0xc8')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':_0x49f9('0x101')});db[_0x49f9('0xc8')][_0x49f9('0xfc')](db['JscriptyAnswerReport'],{'foreignKey':_0x49f9('0x1bc'),'onDelete':'cascade'});db[_0x49f9('0x1bd')]['belongsTo'](db[_0x49f9('0x4d')],{});db[_0x49f9('0x1bd')]['belongsTo'](db[_0x49f9('0xe4')],{'as':_0x49f9('0x154'),'foreignKey':_0x49f9('0x155')});db[_0x49f9('0x1bd')]['belongsTo'](db[_0x49f9('0x6d')],{'as':_0x49f9('0x14a'),'foreignKey':_0x49f9('0x14b')});db[_0x49f9('0x1bd')][_0x49f9('0x10a')](db[_0x49f9('0x50')],{});db[_0x49f9('0x1bd')][_0x49f9('0x10a')](db[_0x49f9('0x52')],{});db['SmsQueueReport'][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{});db[_0x49f9('0x1bd')][_0x49f9('0x10a')](db['SmsQueue'],{});db['JscriptyProject'][_0x49f9('0xfc')](db[_0x49f9('0xc8')],{'foreignKey':_0x49f9('0x1be')});db[_0x49f9('0xcc')][_0x49f9('0xfc')](db[_0x49f9('0xc6')],{'foreignKey':_0x49f9('0x1be')});db[_0x49f9('0xcc')]['hasMany'](db[_0x49f9('0x1bf')],{'foreignKey':_0x49f9('0x1be')});db['SquareProject']['belongsToMany'](db[_0x49f9('0xfa')],{'as':'Users','through':_0x49f9('0x12f')});db[_0x49f9('0xd2')][_0x49f9('0x10b')](db[_0x49f9('0xfa')],{'as':'Agents','through':_0x49f9('0x112')});db[_0x49f9('0xd2')][_0x49f9('0x10b')](db['VoiceQueue'],{'through':_0x49f9('0x141'),'as':'VoiceQueues'});db[_0x49f9('0xd2')][_0x49f9('0x10b')](db[_0x49f9('0x3a')],{'through':_0x49f9('0x158'),'as':'MailQueues'});db[_0x49f9('0xd2')][_0x49f9('0x10b')](db[_0x49f9('0x66')],{'through':'team_has_chat_queues','as':_0x49f9('0x1c0')});db[_0x49f9('0xd2')][_0x49f9('0x10b')](db[_0x49f9('0x11c')],{'through':_0x49f9('0x16e'),'as':'FaxQueues'});db[_0x49f9('0xd2')]['belongsToMany'](db[_0x49f9('0x54')],{'through':_0x49f9('0x174'),'as':_0x49f9('0x11e')});db[_0x49f9('0xd2')]['belongsToMany'](db['OpenchannelQueue'],{'through':_0x49f9('0x179'),'as':_0x49f9('0x11f')});db[_0x49f9('0xd2')][_0x49f9('0x10b')](db[_0x49f9('0xf4')],{'through':'team_has_whatsapp_queues','as':_0x49f9('0x121')});db[_0x49f9('0xd2')]['belongsToMany'](db[_0x49f9('0xe6')],{'through':_0x49f9('0xf7'),'as':_0x49f9('0x11b')});db['Campaign']['hasMany'](db[_0x49f9('0x6e')],{'as':'Hoppers','foreignKey':_0x49f9('0x189')});db[_0x49f9('0xd4')][_0x49f9('0xfc')](db[_0x49f9('0x70')],{'as':_0x49f9('0x102'),'foreignKey':_0x49f9('0x189')});db[_0x49f9('0xd4')][_0x49f9('0xfc')](db[_0x49f9('0x72')],{'as':_0x49f9('0x135'),'foreignKey':'CampaignId'});db[_0x49f9('0xd4')][_0x49f9('0xfc')](db[_0x49f9('0x136')],{'as':_0x49f9('0x137'),'foreignKey':_0x49f9('0x189')});db[_0x49f9('0xd4')][_0x49f9('0x10a')](db[_0x49f9('0x139')],{'as':'Trunk','foreignKey':_0x49f9('0x1c1')});db['Campaign'][_0x49f9('0x10a')](db[_0x49f9('0x139')],{'as':_0x49f9('0x1c2'),'foreignKey':'TrunkBackupId'});db[_0x49f9('0xd4')][_0x49f9('0x10a')](db[_0x49f9('0x81')],{'as':_0x49f9('0x81'),'foreignKey':_0x49f9('0x13b')});db[_0x49f9('0xd4')]['belongsTo'](db['SquareProject'],{'as':'SquareProject','foreignKey':_0x49f9('0x1c3')});db[_0x49f9('0xd4')][_0x49f9('0x10b')](db[_0x49f9('0xe4')],{'as':'Lists','through':_0x49f9('0x1c4')});db['Campaign'][_0x49f9('0x10b')](db['CmList'],{'as':_0x49f9('0x142'),'through':_0x49f9('0x1c5')});db[_0x49f9('0xd8')][_0x49f9('0x10a')](db[_0x49f9('0x161')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0x49f9('0xdb')][_0x49f9('0x10a')](db[_0x49f9('0x3e')],{});db[_0x49f9('0xdb')]['belongsTo'](db['MailInteraction'],{});db[_0x49f9('0xdb')][_0x49f9('0x10a')](db[_0x49f9('0x125')],{'foreignKey':'FromMailAccountId','as':'FromAccount'});db['MailTransferReport'][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'foreignKey':_0x49f9('0x1c6'),'as':'FromAgent'});db['MailTransferReport'][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'foreignKey':'ToUserId','as':_0x49f9('0x1c7')});db[_0x49f9('0xdb')][_0x49f9('0x10a')](db[_0x49f9('0x3a')],{'foreignKey':_0x49f9('0x1c8'),'as':_0x49f9('0x1c9')});db['MailTransferReport'][_0x49f9('0x10a')](db['MailAccount'],{'foreignKey':_0x49f9('0x1ca'),'as':_0x49f9('0x1cb')});db[_0x49f9('0xdd')][_0x49f9('0x10a')](db[_0x49f9('0x63')],{});db[_0x49f9('0xdd')][_0x49f9('0x10a')](db[_0x49f9('0x61')],{});db[_0x49f9('0xdd')][_0x49f9('0x10a')](db[_0x49f9('0x5d')],{'foreignKey':_0x49f9('0x1cc'),'as':_0x49f9('0x1cd')});db['ChatTransferReport'][_0x49f9('0x10a')](db['User'],{'foreignKey':'FromUserId','as':_0x49f9('0x1ce')});db[_0x49f9('0xdd')][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'foreignKey':_0x49f9('0x1cf'),'as':_0x49f9('0x1c7')});db['ChatTransferReport'][_0x49f9('0x10a')](db[_0x49f9('0x66')],{'foreignKey':_0x49f9('0x1d0'),'as':_0x49f9('0x1c9')});db[_0x49f9('0xdd')][_0x49f9('0x10a')](db[_0x49f9('0x5d')],{'foreignKey':_0x49f9('0x1d1'),'as':_0x49f9('0x1cb')});db[_0x49f9('0xdf')][_0x49f9('0x10a')](db[_0x49f9('0x49')],{});db[_0x49f9('0xdf')][_0x49f9('0x10a')](db[_0x49f9('0x48')],{});db[_0x49f9('0xdf')][_0x49f9('0x10a')](db[_0x49f9('0x45')],{'foreignKey':_0x49f9('0x1d2'),'as':_0x49f9('0x1cd')});db[_0x49f9('0xdf')][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'foreignKey':_0x49f9('0x1c6'),'as':_0x49f9('0x1ce')});db['FaxTransferReport'][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'foreignKey':_0x49f9('0x1cf'),'as':_0x49f9('0x1c7')});db[_0x49f9('0xdf')][_0x49f9('0x10a')](db[_0x49f9('0x11c')],{'foreignKey':_0x49f9('0x1d3'),'as':_0x49f9('0x1c9')});db[_0x49f9('0xdf')][_0x49f9('0x10a')](db[_0x49f9('0x45')],{'foreignKey':_0x49f9('0x1d4'),'as':'ToAccount'});db[_0x49f9('0xe1')]['belongsTo'](db[_0x49f9('0x5a')],{});db['OpenchannelTransferReport'][_0x49f9('0x10a')](db['OpenchannelInteraction'],{});db[_0x49f9('0xe1')][_0x49f9('0x10a')](db[_0x49f9('0x56')],{'foreignKey':_0x49f9('0x1d5'),'as':_0x49f9('0x1cd')});db[_0x49f9('0xe1')]['belongsTo'](db[_0x49f9('0xfa')],{'foreignKey':_0x49f9('0x1c6'),'as':_0x49f9('0x1ce')});db[_0x49f9('0xe1')][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'foreignKey':_0x49f9('0x1cf'),'as':_0x49f9('0x1c7')});db[_0x49f9('0xe1')][_0x49f9('0x10a')](db[_0x49f9('0x5c')],{'foreignKey':_0x49f9('0x1d6'),'as':_0x49f9('0x1c9')});db[_0x49f9('0xe1')][_0x49f9('0x10a')](db[_0x49f9('0x56')],{'foreignKey':'ToOpenchannelAccountId','as':_0x49f9('0x1cb')});db[_0x49f9('0x1d7')][_0x49f9('0x10a')](db[_0x49f9('0x52')],{});db['SmsTransferReport'][_0x49f9('0x10a')](db['SmsInteraction'],{});db[_0x49f9('0x1d7')][_0x49f9('0x10a')](db[_0x49f9('0x4d')],{'foreignKey':_0x49f9('0x1d8'),'as':_0x49f9('0x1cd')});db[_0x49f9('0x1d7')][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'foreignKey':_0x49f9('0x1c6'),'as':_0x49f9('0x1ce')});db[_0x49f9('0x1d7')][_0x49f9('0x10a')](db['User'],{'foreignKey':_0x49f9('0x1cf'),'as':_0x49f9('0x1c7')});db['SmsTransferReport'][_0x49f9('0x10a')](db['SmsQueue'],{'foreignKey':_0x49f9('0x1d9'),'as':'ToQueue'});db[_0x49f9('0x1d7')][_0x49f9('0x10a')](db[_0x49f9('0x4d')],{'foreignKey':_0x49f9('0x1da'),'as':'ToAccount'});db[_0x49f9('0xe4')][_0x49f9('0xfc')](db['Disposition'],{'as':_0x49f9('0x166'),'foreignKey':_0x49f9('0x155'),'onDelete':_0x49f9('0x101')});db[_0x49f9('0xe4')][_0x49f9('0xfc')](db['CmCustomField'],{'as':_0x49f9('0x1db'),'foreignKey':_0x49f9('0x155')});db['CmList'][_0x49f9('0xfc')](db[_0x49f9('0x6d')],{'as':'Contacts','onDelete':'cascade','foreignKey':'ListId'});db[_0x49f9('0xe4')][_0x49f9('0xfc')](db['CmHopperFinal'],{'as':_0x49f9('0x102'),'foreignKey':_0x49f9('0x155')});db[_0x49f9('0xe4')][_0x49f9('0xfc')](db['CmHopperHistory'],{'as':_0x49f9('0x103'),'foreignKey':_0x49f9('0x155')});db[_0x49f9('0xe4')]['hasMany'](db[_0x49f9('0x74')],{'as':_0x49f9('0x74'),'foreignKey':_0x49f9('0x155')});db[_0x49f9('0xe4')][_0x49f9('0x10b')](db[_0x49f9('0x133')],{'as':'Queues','through':_0x49f9('0x13e')});db[_0x49f9('0xe4')]['belongsToMany'](db['User'],{'as':_0x49f9('0x13f'),'through':_0x49f9('0x111')});db['VoicePrefix']['hasMany'](db[_0x49f9('0x16')],{'as':'Extensions','onDelete':_0x49f9('0x101')});db['VoicePrefix'][_0x49f9('0x10b')](db[_0x49f9('0xfa')],{'as':'Agents','through':_0x49f9('0xf9')});db[_0x49f9('0xe6')][_0x49f9('0x10b')](db[_0x49f9('0xd2')],{'through':_0x49f9('0xf7'),'as':_0x49f9('0x140')});db['UserProfile'][_0x49f9('0xfc')](db[_0x49f9('0xfa')],{'as':_0x49f9('0x16c'),'foreignKey':'userProfileId'});db[_0x49f9('0xe7')][_0x49f9('0xfc')](db[_0x49f9('0xe9')],{'as':_0x49f9('0x1dc'),'foreignKey':_0x49f9('0x1dd'),'onDelete':_0x49f9('0x101')});db['UserProfileSection'][_0x49f9('0xfc')](db[_0x49f9('0x1de')],{'as':'Resources','foreignKey':'sectionId','onDelete':_0x49f9('0x101')});db[_0x49f9('0x12c')]['hasMany'](db[_0x49f9('0x7d')],{'as':'Dispositions','foreignKey':_0x49f9('0x1df'),'onDelete':_0x49f9('0x101')});db[_0x49f9('0x12c')][_0x49f9('0xfc')](db[_0x49f9('0x7b')],{'as':'Answers','foreignKey':_0x49f9('0x1df')});db['WhatsappAccount'][_0x49f9('0xfc')](db['WhatsappMessage'],{'as':'Messages','foreignKey':'WhatsappAccountId'});db[_0x49f9('0x12c')][_0x49f9('0xfc')](db[_0x49f9('0xed')],{'as':_0x49f9('0x152')});db[_0x49f9('0x12c')][_0x49f9('0xfc')](db[_0x49f9('0xec')],{'as':_0x49f9('0x153')});db['WhatsappAccount'][_0x49f9('0x10a')](db['CmList'],{'as':'List','foreignKey':'ListId'});db['WhatsappAccount'][_0x49f9('0x10a')](db[_0x49f9('0x13c')],{'as':_0x49f9('0x13d'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x49f9('0x12c')][_0x49f9('0x10b')](db[_0x49f9('0xfa')],{'as':_0x49f9('0x13f'),'through':_0x49f9('0x1e0')});db[_0x49f9('0xec')][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'onDelete':_0x49f9('0x14d')});db['WhatsappApplication'][_0x49f9('0x10a')](db['WhatsappQueue'],{'onDelete':'restrict'});db[_0x49f9('0xec')][_0x49f9('0x10a')](db[_0x49f9('0x12c')],{'onDelete':'restrict'});db[_0x49f9('0xec')][_0x49f9('0x10a')](db[_0x49f9('0x81')],{'onDelete':_0x49f9('0x14d'),'foreignKey':_0x49f9('0x13b')});db['WhatsappApplication'][_0x49f9('0x10a')](db[_0x49f9('0x8b')],{'onDelete':_0x49f9('0x14d'),'foreignKey':_0x49f9('0x163')});db[_0x49f9('0xed')]['hasMany'](db[_0x49f9('0xef')],{'as':_0x49f9('0x144'),'onDelete':_0x49f9('0x101'),'foreignKey':_0x49f9('0x1e1')});db[_0x49f9('0xed')][_0x49f9('0x10a')](db[_0x49f9('0x12c')],{'as':'Account','foreignKey':_0x49f9('0x1df')});db['WhatsappInteraction'][_0x49f9('0x10a')](db['CmContact'],{'as':_0x49f9('0x14a'),'foreignKey':_0x49f9('0x14b')});db['WhatsappInteraction'][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'as':_0x49f9('0x171'),'foreignKey':_0x49f9('0xfb')});db['WhatsappInteraction'][_0x49f9('0x10b')](db[_0x49f9('0x8b')],{'through':'whatsapp_interaction_has_tags','as':_0x49f9('0x15b')});db['WhatsappInteraction'][_0x49f9('0x10b')](db['Tag'],{'through':_0x49f9('0x19a'),'as':_0x49f9('0x15d')});db[_0x49f9('0xed')][_0x49f9('0x10b')](db[_0x49f9('0xfa')],{'as':_0x49f9('0x16c'),'through':_0x49f9('0x119'),'foreignKey':_0x49f9('0x1e1')});db[_0x49f9('0xef')][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'as':_0x49f9('0xfa')});db[_0x49f9('0xef')][_0x49f9('0x10a')](db[_0x49f9('0x6d')],{'onDelete':_0x49f9('0x101'),'as':_0x49f9('0x14a')});db[_0x49f9('0xef')]['belongsTo'](db[_0x49f9('0xed')],{'onDelete':_0x49f9('0x101'),'as':_0x49f9('0x15f'),'foreignKey':_0x49f9('0x1e1')});db['WhatsappMessage']['belongsTo'](db[_0x49f9('0x12c')],{'as':_0x49f9('0x15a'),'foreignKey':_0x49f9('0x1df')});db[_0x49f9('0xf0')]['belongsTo'](db['WhatsappAccount'],{});db[_0x49f9('0xf0')]['belongsTo'](db[_0x49f9('0xe4')],{'as':_0x49f9('0x154'),'foreignKey':_0x49f9('0x155')});db[_0x49f9('0xf0')]['belongsTo'](db[_0x49f9('0x6d')],{'as':_0x49f9('0x14a'),'foreignKey':_0x49f9('0x14b')});db[_0x49f9('0xf0')]['belongsTo'](db[_0x49f9('0xed')],{});db[_0x49f9('0xf0')]['belongsTo'](db[_0x49f9('0xf4')],{});db[_0x49f9('0xf0')]['belongsTo'](db[_0x49f9('0xef')],{});db[_0x49f9('0xf0')]['belongsTo'](db['User'],{});db[_0x49f9('0xf2')]['belongsTo'](db[_0x49f9('0xef')],{});db[_0x49f9('0xf2')][_0x49f9('0x10a')](db[_0x49f9('0xed')],{});db['WhatsappTransferReport']['belongsTo'](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':_0x49f9('0x1cd')});db['WhatsappTransferReport'][_0x49f9('0x10a')](db[_0x49f9('0x12c')],{'foreignKey':_0x49f9('0x1e2'),'as':_0x49f9('0x1cb')});db[_0x49f9('0xf2')][_0x49f9('0x10a')](db['WhatsappQueue'],{'foreignKey':_0x49f9('0x1e3'),'as':_0x49f9('0x1c9')});db['WhatsappTransferReport'][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'foreignKey':_0x49f9('0x1c6'),'as':'FromAgent'});db[_0x49f9('0xf2')][_0x49f9('0x10a')](db[_0x49f9('0xfa')],{'foreignKey':_0x49f9('0x1cf'),'as':'ToAgent'});db[_0x49f9('0xf4')][_0x49f9('0x10b')](db[_0x49f9('0xfa')],{'as':'Agents','through':'UserWhatsappQueue','foreignKey':_0x49f9('0x1e4')});db[_0x49f9('0xf4')][_0x49f9('0x10b')](db['Team'],{'through':_0x49f9('0x1e5'),'as':_0x49f9('0x140')});db[_0x49f9('0xf5')]['hasOne'](db[_0x49f9('0x14f')],{'as':_0x49f9('0x150'),'onDelete':_0x49f9('0x14d')});db[_0x49f9('0xf5')][_0x49f9('0x151')](db[_0x49f9('0x14e')],{'as':'Smtp','onDelete':_0x49f9('0x14d')});module[_0x49f9('0x1e6')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 735e3fd..8caaf7c 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','./api/team','./api/license','/api/campaigns','./api/campaign','./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/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','static','/apidoc','/www','join','root','/demo','/snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','username','password','newPassword','apiKey','firstName','lastName','phone','fax','email','clientId','clientSecret','code','accessKey','tenantId','token','channelSecret','accessToken','authToken','consumerSecret','membername','calleridnum','exten','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','accountSid','localstationid','dsn','secret','isPlainObject','isArray','length','isString','replace','@@{','includes','lodash','express-winston','util','./errors','./config/logger','default','use','body','format','headers','x-forwarded-for','connection','url','statusCode','responseTime','user','role','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','method','other','agent_name','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','./api/mailMessage','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc'];(function(_0x3e82ec,_0x441216){var _0x3a2a09=function(_0x2b0fe2){while(--_0x2b0fe2){_0x3e82ec['push'](_0x3e82ec['shift']());}};_0x3a2a09(++_0x441216);}(_0x00bb,0x1bc));var _0xb00b=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x00bb[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0xb00b('0x0'));var path=require('path');var express=require('express');var ewinston=require(_0xb00b('0x1'));var util=require(_0xb00b('0x2'));var errors=require(_0xb00b('0x3'));var config=require('./config/environment');var logger=require(_0xb00b('0x4'))('api');var authLogger=require(_0xb00b('0x4'))('auth');var safeTemplate=require('./safe-template')['safeTemplate'];exports[_0xb00b('0x5')]=function(_0xe8b50e){_0xe8b50e[_0xb00b('0x6')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x19a449,_0x2dafe6){var _0x3d7f0c='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_['isEmpty'](_0x19a449[_0xb00b('0x7')])){_0x3d7f0c+='\x20body=%s';var _0x3b2bfd=_0x19a449[_0xb00b('0x7')];maskSensitiveData(_0x3b2bfd);}return safeTemplate(util[_0xb00b('0x8')](_0x3d7f0c,_0x19a449['method'],_0x19a449[_0xb00b('0x9')][_0xb00b('0xa')]?_0x19a449['headers'][_0xb00b('0xa')]:_0x19a449[_0xb00b('0xb')]['remoteAddress']||_0x19a449['ip'],_0x19a449[_0xb00b('0xc')],_0x2dafe6[_0xb00b('0xd')],_0x2dafe6[_0xb00b('0xe')],_0x19a449['user']?_0x19a449[_0xb00b('0xf')]['id']:null,_0x19a449['user']?_0x19a449['user']['name']:null,_0x19a449['user']?_0x19a449[_0xb00b('0xf')][_0xb00b('0x10')]:null,_0x3b2bfd?util['inspect'](_0x3b2bfd,![],null):''));}}));_0xe8b50e[_0xb00b('0x6')](ewinston[_0xb00b('0x11')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x4e97f6,_0x44aa67){var _0x1aabcd=_0xb00b('0x12');if(_0x4e97f6[_0xb00b('0x7')]&&_0x4e97f6[_0xb00b('0x7')][_0xb00b('0x13')]&&_0x4e97f6['body'][_0xb00b('0x14')]){_0x1aabcd='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util['format'](_0x1aabcd,_0x4e97f6[_0xb00b('0x15')],_0x4e97f6['headers'][_0xb00b('0xa')]?_0x4e97f6[_0xb00b('0x9')][_0xb00b('0xa')]:_0x4e97f6[_0xb00b('0xb')]['remoteAddress']||_0x4e97f6['ip'],_0x4e97f6['url'],_0x44aa67[_0xb00b('0xd')],_0x44aa67[_0xb00b('0xe')],_0x4e97f6[_0xb00b('0xf')]?_0x4e97f6['user']['id']:null,_0x4e97f6['user']?_0x4e97f6['user']['name']:null,_0x4e97f6[_0xb00b('0xf')]?_0x4e97f6[_0xb00b('0xf')][_0xb00b('0x10')]:null,_0x4e97f6[_0xb00b('0x7')]&&_0x4e97f6[_0xb00b('0x7')][_0xb00b('0x13')]?_0x4e97f6['body']['device']:_0xb00b('0x16'),_0x4e97f6[_0xb00b('0x7')]&&_0x4e97f6['body']['agent_id']?_0x4e97f6['body'][_0xb00b('0x14')]:'',_0x4e97f6['body']&&_0x4e97f6['body'][_0xb00b('0x17')]?_0x4e97f6['body'][_0xb00b('0x17')]:'');},'ignoreRoute':function(_0x850021){var _0x267bcb=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x267bcb['test'](_0x850021['url']);}}));_0xe8b50e['use'](_0xb00b('0x18'),require(_0xb00b('0x19')));_0xe8b50e[_0xb00b('0x6')]('/api/voice/chanspy',require(_0xb00b('0x1a')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x1b'),require(_0xb00b('0x1c')));_0xe8b50e[_0xb00b('0x6')]('/api/voice/extensions',require(_0xb00b('0x1d')));_0xe8b50e[_0xb00b('0x6')]('/api/voice/mohs',require(_0xb00b('0x1e')));_0xe8b50e['use'](_0xb00b('0x1f'),require(_0xb00b('0x20')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x21'),require(_0xb00b('0x22')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x23'),require('./api/screenRecording'));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x24'),require(_0xb00b('0x25')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x26'),require(_0xb00b('0x27')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x28'),require(_0xb00b('0x29')));_0xe8b50e['use']('/api/voice/dials/reports',require(_0xb00b('0x2a')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x2b'),require(_0xb00b('0x2c')));_0xe8b50e[_0xb00b('0x6')]('/api/voice/queues/reports',require(_0xb00b('0x2d')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x2e'),require('./api/memberReport'));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x2f'),require(_0xb00b('0x30')));_0xe8b50e['use'](_0xb00b('0x31'),require(_0xb00b('0x32')));_0xe8b50e[_0xb00b('0x6')]('/api/mail/out_servers',require('./api/mailServerOut'));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x33'),require(_0xb00b('0x34')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x35'),require(_0xb00b('0x36')));_0xe8b50e['use'](_0xb00b('0x37'),require(_0xb00b('0x38')));_0xe8b50e['use']('/api/mail/interactions',require(_0xb00b('0x39')));_0xe8b50e[_0xb00b('0x6')]('/api/mail/messages',require(_0xb00b('0x3a')));_0xe8b50e['use']('/api/mail/applications',require('./api/mailApplication'));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x3b'),require(_0xb00b('0x3c')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x3d'),require(_0xb00b('0x3e')));_0xe8b50e['use'](_0xb00b('0x3f'),require(_0xb00b('0x40')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x41'),require('./api/faxAccount'));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x42'),require('./api/faxApplication'));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x43'),require(_0xb00b('0x44')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x45'),require('./api/faxMessage'));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x46'),require(_0xb00b('0x47')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x48'),require(_0xb00b('0x49')));_0xe8b50e['use'](_0xb00b('0x4a'),require('./api/smsAccount'));_0xe8b50e['use'](_0xb00b('0x4b'),require(_0xb00b('0x4c')));_0xe8b50e['use'](_0xb00b('0x4d'),require('./api/smsInteraction'));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x4e'),require(_0xb00b('0x4f')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x50'),require(_0xb00b('0x51')));_0xe8b50e['use'](_0xb00b('0x52'),require(_0xb00b('0x53')));_0xe8b50e[_0xb00b('0x6')]('/api/openchannel/applications',require(_0xb00b('0x54')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x55'),require('./api/openchannelInteraction'));_0xe8b50e['use'](_0xb00b('0x56'),require(_0xb00b('0x57')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x58'),require(_0xb00b('0x59')));_0xe8b50e[_0xb00b('0x6')]('/api/chat/websites',require(_0xb00b('0x5a')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x5b'),require('./api/openchannelQueueReport'));_0xe8b50e[_0xb00b('0x6')]('/api/chat/applications',require(_0xb00b('0x5c')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x5d'),require(_0xb00b('0x5e')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x5f'),require('./api/chatMessage'));_0xe8b50e['use']('/api/chat/offline_messages',require(_0xb00b('0x60')));_0xe8b50e['use'](_0xb00b('0x61'),require(_0xb00b('0x62')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x63'),require(_0xb00b('0x64')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x65'),require('./api/chatProactiveAction'));_0xe8b50e['use'](_0xb00b('0x66'),require(_0xb00b('0x67')));_0xe8b50e['use'](_0xb00b('0x68'),require(_0xb00b('0x69')));_0xe8b50e[_0xb00b('0x6')]('/api/cm/hopper',require(_0xb00b('0x6a')));_0xe8b50e['use'](_0xb00b('0x6b'),require('./api/cmHopperBlack'));_0xe8b50e['use']('/api/cm/hopper_final',require(_0xb00b('0x6c')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x6d'),require(_0xb00b('0x6e')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x6f'),require('./api/cmCustomField'));_0xe8b50e['use']('/api/actions',require(_0xb00b('0x70')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x71'),require('./api/automation'));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x72'),require(_0xb00b('0x73')));_0xe8b50e['use'](_0xb00b('0x74'),require('./api/disposition'));_0xe8b50e['use'](_0xb00b('0x75'),require(_0xb00b('0x76')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x77'),require(_0xb00b('0x78')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x79'),require(_0xb00b('0x7a')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x7b'),require(_0xb00b('0x7c')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x7d'),require(_0xb00b('0x7e')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x7f'),require('./api/schedule'));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x80'),require(_0xb00b('0x81')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x82'),require(_0xb00b('0x83')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x84'),require(_0xb00b('0x85')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x86'),require('./api/trigger'));_0xe8b50e['use']('/api/variables',require(_0xb00b('0x87')));_0xe8b50e['use'](_0xb00b('0x88'),require(_0xb00b('0x89')));_0xe8b50e['use'](_0xb00b('0x8a'),require(_0xb00b('0x8b')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x8c'),require(_0xb00b('0x8d')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x8e'),require(_0xb00b('0x8f')));_0xe8b50e['use'](_0xb00b('0x90'),require(_0xb00b('0x91')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x92'),require(_0xb00b('0x93')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x94'),require(_0xb00b('0x95')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x96'),require(_0xb00b('0x97')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x98'),require('./api/intSalesforceAccount'));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x99'),require('./api/intSalesforceConfiguration'));_0xe8b50e['use'](_0xb00b('0x9a'),require(_0xb00b('0x9b')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x9c'),require(_0xb00b('0x9d')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x9e'),require(_0xb00b('0x9f')));_0xe8b50e['use'](_0xb00b('0xa0'),require(_0xb00b('0xa1')));_0xe8b50e[_0xb00b('0x6')]('/api/integrations/desk/accounts',require(_0xb00b('0xa2')));_0xe8b50e[_0xb00b('0x6')]('/api/integrations/desk/configurations',require(_0xb00b('0xa3')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xa4'),require(_0xb00b('0xa5')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xa6'),require(_0xb00b('0xa7')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xa8'),require(_0xb00b('0xa9')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xaa'),require(_0xb00b('0xab')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xac'),require('./api/intZendeskAccount'));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xad'),require(_0xb00b('0xae')));_0xe8b50e['use'](_0xb00b('0xaf'),require(_0xb00b('0xb0')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xb1'),require(_0xb00b('0xb2')));_0xe8b50e[_0xb00b('0x6')]('/api/integrations/freshdesk/configurations',require(_0xb00b('0xb3')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xb4'),require(_0xb00b('0xb5')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xb6'),require(_0xb00b('0xb7')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xb8'),require(_0xb00b('0xb9')));_0xe8b50e[_0xb00b('0x6')]('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xba'),require(_0xb00b('0xbb')));_0xe8b50e[_0xb00b('0x6')]('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0xe8b50e[_0xb00b('0x6')]('/api/integrations/servicenow/fields',require(_0xb00b('0xbc')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xbd'),require(_0xb00b('0xbe')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xbf'),require('./api/intDynamics365Configuration'));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xc0'),require(_0xb00b('0xc1')));_0xe8b50e[_0xb00b('0x6')]('/api/integrations/freshsales/accounts',require(_0xb00b('0xc2')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xc3'),require('./api/intFreshsalesConfiguration'));_0xe8b50e[_0xb00b('0x6')]('/api/integrations/freshsales/fields',require(_0xb00b('0xc4')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xc5'),require(_0xb00b('0xc6')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xc7'),require(_0xb00b('0xc8')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xc9'),require(_0xb00b('0xca')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xcb'),require('./api/jscriptyAnswerReport'));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xcc'),require(_0xb00b('0xcd')));_0xe8b50e[_0xb00b('0x6')]('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0xe8b50e[_0xb00b('0x6')]('/api/sms/reports/queue',require(_0xb00b('0xce')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xcf'),require(_0xb00b('0xd0')));_0xe8b50e['use'](_0xb00b('0xd1'),require(_0xb00b('0xd2')));_0xe8b50e[_0xb00b('0x6')]('/api/jscripty/projects',require(_0xb00b('0xd3')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xd4'),require(_0xb00b('0xd5')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xd6'),require(_0xb00b('0xd7')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xd8'),require(_0xb00b('0xd9')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xda'),require('./api/squareRecording'));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xdb'),require(_0xb00b('0xdc')));_0xe8b50e[_0xb00b('0x6')]('/api/teams',require(_0xb00b('0xdd')));_0xe8b50e[_0xb00b('0x6')]('/api/license',require(_0xb00b('0xde')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xdf'),require(_0xb00b('0xe0')));_0xe8b50e['use']('/api/migrations',require(_0xb00b('0xe1')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xe2'),require(_0xb00b('0xe3')));_0xe8b50e['use'](_0xb00b('0xe4'),require(_0xb00b('0xe5')));_0xe8b50e['use'](_0xb00b('0xe6'),require(_0xb00b('0xe7')));_0xe8b50e['use'](_0xb00b('0xe8'),require(_0xb00b('0xe9')));_0xe8b50e['use'](_0xb00b('0xea'),require('./api/faxTransferReport'));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xeb'),require(_0xb00b('0xec')));_0xe8b50e['use'](_0xb00b('0xed'),require(_0xb00b('0xee')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xef'),require('./api/cmList'));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xf0'),require(_0xb00b('0xf1')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xf2'),require(_0xb00b('0xf3')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xf4'),require(_0xb00b('0xf5')));_0xe8b50e['use'](_0xb00b('0xf6'),require(_0xb00b('0xf7')));_0xe8b50e['use'](_0xb00b('0xf8'),require(_0xb00b('0xf9')));_0xe8b50e['use']('/api/whatsapp/accounts',require(_0xb00b('0xfa')));_0xe8b50e[_0xb00b('0x6')]('/api/whatsapp/applications',require(_0xb00b('0xfb')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xfc'),require('./api/whatsappInteraction'));_0xe8b50e['use'](_0xb00b('0xfd'),require(_0xb00b('0xfe')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0xff'),require(_0xb00b('0x100')));_0xe8b50e[_0xb00b('0x6')]('/api/whatsapp/reports/transfer',require(_0xb00b('0x101')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x102'),require(_0xb00b('0x103')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x104'),require('./api/cloudProvider'));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x105'),require(_0xb00b('0x106')));_0xe8b50e['use']('/api/auth/local',require('./api/authLocal'));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x107'),require(_0xb00b('0x108')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x109'),require('./api/authActiveDirectory'));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x10a'),require(_0xb00b('0x10b')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x10c'),require(_0xb00b('0x10d')));_0xe8b50e[_0xb00b('0x6')]('/api/version',require(_0xb00b('0x10e')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x10f'),require(_0xb00b('0x110')));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x111'),require('./api/pm2'));_0xe8b50e['use'](_0xb00b('0x112'),require(_0xb00b('0x113')));_0xe8b50e['use']('/apidoc',express[_0xb00b('0x114')](path['join'](config['root'],_0xb00b('0x115'))));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x116'),express['static'](path[_0xb00b('0x117')](config[_0xb00b('0x118')],_0xb00b('0x116'))));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x119'),express[_0xb00b('0x114')](path[_0xb00b('0x117')](config[_0xb00b('0x118')],_0xb00b('0x119'))));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x11a'),express['static'](path[_0xb00b('0x117')](config[_0xb00b('0x118')],'snippet',_0xb00b('0x11b'))));_0xe8b50e[_0xb00b('0x6')](_0xb00b('0x11c'),express['static'](path[_0xb00b('0x117')](config[_0xb00b('0x118')],_0xb00b('0x11d'))));_0xe8b50e[_0xb00b('0x11e')](_0xb00b('0x11f'))[_0xb00b('0x120')](errors[0x194]);_0xe8b50e[_0xb00b('0x11e')]('/*')['get'](function(_0x4ec046,_0x16d0f9){_0x16d0f9[_0xb00b('0x121')](path[_0xb00b('0x122')](_0xe8b50e['get']('appPath')+_0xb00b('0x123')));});};var sensitiveFields=[_0xb00b('0x124'),_0xb00b('0x125'),_0xb00b('0x126'),_0xb00b('0x127'),_0xb00b('0x128'),_0xb00b('0x129'),'street',_0xb00b('0x12a'),'mobile',_0xb00b('0x12b'),_0xb00b('0x12c'),_0xb00b('0x12d'),_0xb00b('0x12e'),'securityToken',_0xb00b('0x12f'),_0xb00b('0x130'),_0xb00b('0x131'),_0xb00b('0x132'),_0xb00b('0x133'),_0xb00b('0x134'),'accessTokenSecret',_0xb00b('0x135'),'consumerKey',_0xb00b('0x136'),_0xb00b('0x137'),'calleridname',_0xb00b('0x138'),_0xb00b('0x139'),_0xb00b('0x13a'),'clientEmail',_0xb00b('0x13b'),_0xb00b('0x13c'),_0xb00b('0x13d'),_0xb00b('0x13e'),'user','pass',_0xb00b('0x13f'),_0xb00b('0x140'),_0xb00b('0x141'),_0xb00b('0x142'),'registry','oldPassword'];function maskSensitiveData(_0x39785d){var _0x45a1bc=/(?!^)[\s\S](?!$)/g;if(!_[_0xb00b('0x143')](_0x39785d))return;for(var _0xd2c5bd in _0x39785d){if(_[_0xb00b('0x144')](_0x39785d[_0xd2c5bd])){for(var _0x159e2d=0x0;_0x159e2d<_0x39785d[_0xd2c5bd][_0xb00b('0x145')];_0x159e2d++){maskSensitiveData(_0x39785d[_0xd2c5bd][_0x159e2d]);}}else if(_['isPlainObject'](_0x39785d[_0xd2c5bd])){maskSensitiveData(_0x39785d[_0xd2c5bd]);}else if(_[_0xb00b('0x146')](_0x39785d[_0xd2c5bd])){_0x39785d[_0xd2c5bd]=_0x39785d[_0xd2c5bd][_0xb00b('0x147')](/{{{/g,_0xb00b('0x148'))[_0xb00b('0x147')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xb00b('0x147')](/}}/g,'}@');if(_[_0xb00b('0x149')](sensitiveFields,_0xd2c5bd)){_0x39785d[_0xd2c5bd]=_0x39785d[_0xd2c5bd][_0xb00b('0x147')](_0x45a1bc,'*');}}}} \ No newline at end of file +var _0x1fa9=['%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','url','statusCode','other','agent_id','agent_name','/api/users','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','./api/mailQueue','./api/mailSubstatus','./api/mailInteraction','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/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/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/sound','/api/tags','/api/templates','./api/template','/api/triggers','./api/variable','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskConfiguration','./api/intDeskField','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/chatQueueReport','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./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/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappQueueReport','./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/authActiveDirectory','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','resolve','appPath','/index.html','password','newPassword','apiKey','firstName','lastName','phone','mobile','email','clientSecret','code','accessKey','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','clientEmail','accesskeyid','key','pass','localstationid','dsn','secret','oldPassword','isPlainObject','length','replace','@@{','}@@','lodash','express','util','./errors','./config/environment','api','./config/logger','auth','./safe-template','safeTemplate','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','method','headers','x-forwarded-for','connection','remoteAddress','user','name','role','inspect','logger'];(function(_0x53f6b5,_0xde4d9a){var _0x8f970c=function(_0x200f14){while(--_0x200f14){_0x53f6b5['push'](_0x53f6b5['shift']());}};_0x8f970c(++_0xde4d9a);}(_0x1fa9,0x136));var _0x91fa=function(_0x18d17a,_0x52e6ee){_0x18d17a=_0x18d17a-0x0;var _0x44e65c=_0x1fa9[_0x18d17a];return _0x44e65c;};'use strict';var _=require(_0x91fa('0x0'));var path=require('path');var express=require(_0x91fa('0x1'));var ewinston=require('express-winston');var util=require(_0x91fa('0x2'));var errors=require(_0x91fa('0x3'));var config=require(_0x91fa('0x4'));var logger=require('./config/logger')(_0x91fa('0x5'));var authLogger=require(_0x91fa('0x6'))(_0x91fa('0x7'));var safeTemplate=require(_0x91fa('0x8'))[_0x91fa('0x9')];exports['default']=function(_0x261d51){_0x261d51[_0x91fa('0xa')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x5e30a6,_0xb4a51f){var _0x7ad4dd=_0x91fa('0xb');if(!_[_0x91fa('0xc')](_0x5e30a6[_0x91fa('0xd')])){_0x7ad4dd+=_0x91fa('0xe');var _0x132eb2=_0x5e30a6['body'];maskSensitiveData(_0x132eb2);}return safeTemplate(util['format'](_0x7ad4dd,_0x5e30a6[_0x91fa('0xf')],_0x5e30a6[_0x91fa('0x10')][_0x91fa('0x11')]?_0x5e30a6[_0x91fa('0x10')][_0x91fa('0x11')]:_0x5e30a6[_0x91fa('0x12')][_0x91fa('0x13')]||_0x5e30a6['ip'],_0x5e30a6['url'],_0xb4a51f['statusCode'],_0xb4a51f['responseTime'],_0x5e30a6[_0x91fa('0x14')]?_0x5e30a6['user']['id']:null,_0x5e30a6[_0x91fa('0x14')]?_0x5e30a6[_0x91fa('0x14')][_0x91fa('0x15')]:null,_0x5e30a6[_0x91fa('0x14')]?_0x5e30a6['user'][_0x91fa('0x16')]:null,_0x132eb2?util[_0x91fa('0x17')](_0x132eb2,![],null):''));}}));_0x261d51[_0x91fa('0xa')](ewinston[_0x91fa('0x18')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0xe9e249,_0x1f43fa){var _0x5172d8=_0x91fa('0x19');if(_0xe9e249[_0x91fa('0xd')]&&_0xe9e249[_0x91fa('0xd')][_0x91fa('0x1a')]&&_0xe9e249[_0x91fa('0xd')]['agent_id']){_0x5172d8=_0x91fa('0x1b');}return util[_0x91fa('0x1c')](_0x5172d8,_0xe9e249[_0x91fa('0xf')],_0xe9e249[_0x91fa('0x10')][_0x91fa('0x11')]?_0xe9e249[_0x91fa('0x10')][_0x91fa('0x11')]:_0xe9e249[_0x91fa('0x12')][_0x91fa('0x13')]||_0xe9e249['ip'],_0xe9e249[_0x91fa('0x1d')],_0x1f43fa[_0x91fa('0x1e')],_0x1f43fa['responseTime'],_0xe9e249[_0x91fa('0x14')]?_0xe9e249[_0x91fa('0x14')]['id']:null,_0xe9e249['user']?_0xe9e249[_0x91fa('0x14')]['name']:null,_0xe9e249[_0x91fa('0x14')]?_0xe9e249['user']['role']:null,_0xe9e249['body']&&_0xe9e249[_0x91fa('0xd')][_0x91fa('0x1a')]?_0xe9e249[_0x91fa('0xd')][_0x91fa('0x1a')]:_0x91fa('0x1f'),_0xe9e249['body']&&_0xe9e249[_0x91fa('0xd')][_0x91fa('0x20')]?_0xe9e249[_0x91fa('0xd')][_0x91fa('0x20')]:'',_0xe9e249['body']&&_0xe9e249['body'][_0x91fa('0x21')]?_0xe9e249[_0x91fa('0xd')][_0x91fa('0x21')]:'');},'ignoreRoute':function(_0x44af0b){var _0x1224ef=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1224ef['test'](_0x44af0b[_0x91fa('0x1d')]);}}));_0x261d51[_0x91fa('0xa')](_0x91fa('0x22'),require('./api/user'));_0x261d51['use'](_0x91fa('0x23'),require(_0x91fa('0x24')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x25'),require(_0x91fa('0x26')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x27'),require(_0x91fa('0x28')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x29'),require(_0x91fa('0x2a')));_0x261d51['use']('/api/voice/queues',require(_0x91fa('0x2b')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x2c'),require(_0x91fa('0x2d')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x2e'),require('./api/screenRecording'));_0x261d51[_0x91fa('0xa')](_0x91fa('0x2f'),require(_0x91fa('0x30')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x31'),require(_0x91fa('0x32')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x33'),require('./api/voiceCallReport'));_0x261d51['use'](_0x91fa('0x34'),require(_0x91fa('0x35')));_0x261d51['use'](_0x91fa('0x36'),require('./api/voiceAgentReport'));_0x261d51['use'](_0x91fa('0x37'),require(_0x91fa('0x38')));_0x261d51[_0x91fa('0xa')]('/api/members/reports',require(_0x91fa('0x39')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x3a'),require(_0x91fa('0x3b')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x3c'),require(_0x91fa('0x3d')));_0x261d51['use'](_0x91fa('0x3e'),require(_0x91fa('0x3f')));_0x261d51['use']('/api/mail/accounts',require(_0x91fa('0x40')));_0x261d51[_0x91fa('0xa')]('/api/mail/queues',require(_0x91fa('0x41')));_0x261d51[_0x91fa('0xa')]('/api/mail/substatuses',require(_0x91fa('0x42')));_0x261d51['use']('/api/mail/interactions',require(_0x91fa('0x43')));_0x261d51[_0x91fa('0xa')]('/api/mail/messages',require(_0x91fa('0x44')));_0x261d51[_0x91fa('0xa')]('/api/mail/applications',require(_0x91fa('0x45')));_0x261d51['use'](_0x91fa('0x46'),require('./api/mailQueueReport'));_0x261d51[_0x91fa('0xa')]('/api/dashboards',require(_0x91fa('0x47')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x48'),require(_0x91fa('0x49')));_0x261d51['use'](_0x91fa('0x4a'),require(_0x91fa('0x4b')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x4c'),require(_0x91fa('0x4d')));_0x261d51[_0x91fa('0xa')]('/api/fax/interactions',require(_0x91fa('0x4e')));_0x261d51['use'](_0x91fa('0x4f'),require(_0x91fa('0x50')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x51'),require(_0x91fa('0x52')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x53'),require(_0x91fa('0x54')));_0x261d51['use'](_0x91fa('0x55'),require('./api/smsAccount'));_0x261d51[_0x91fa('0xa')](_0x91fa('0x56'),require(_0x91fa('0x57')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x58'),require(_0x91fa('0x59')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x5a'),require(_0x91fa('0x5b')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x5c'),require(_0x91fa('0x5d')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x5e'),require(_0x91fa('0x5f')));_0x261d51['use'](_0x91fa('0x60'),require(_0x91fa('0x61')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x62'),require(_0x91fa('0x63')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x64'),require(_0x91fa('0x65')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x66'),require(_0x91fa('0x67')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x68'),require('./api/chatWebsite'));_0x261d51[_0x91fa('0xa')](_0x91fa('0x69'),require(_0x91fa('0x6a')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x6b'),require('./api/chatApplication'));_0x261d51[_0x91fa('0xa')]('/api/chat/interactions',require(_0x91fa('0x6c')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x6d'),require(_0x91fa('0x6e')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x6f'),require(_0x91fa('0x70')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x71'),require(_0x91fa('0x72')));_0x261d51[_0x91fa('0xa')]('/api/chat/groups',require(_0x91fa('0x73')));_0x261d51['use']('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0x261d51['use']('/api/cm/companies',require(_0x91fa('0x74')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x75'),require(_0x91fa('0x76')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x77'),require(_0x91fa('0x78')));_0x261d51[_0x91fa('0xa')]('/api/cm/hopper_black',require('./api/cmHopperBlack'));_0x261d51['use'](_0x91fa('0x79'),require(_0x91fa('0x7a')));_0x261d51['use'](_0x91fa('0x7b'),require(_0x91fa('0x7c')));_0x261d51[_0x91fa('0xa')]('/api/cm/custom_fields',require(_0x91fa('0x7d')));_0x261d51['use'](_0x91fa('0x7e'),require(_0x91fa('0x7f')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x80'),require(_0x91fa('0x81')));_0x261d51[_0x91fa('0xa')]('/api/canned_answers',require('./api/cannedAnswer'));_0x261d51[_0x91fa('0xa')](_0x91fa('0x82'),require(_0x91fa('0x83')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x84'),require('./api/condition'));_0x261d51[_0x91fa('0xa')](_0x91fa('0x85'),require(_0x91fa('0x86')));_0x261d51[_0x91fa('0xa')]('/api/pauses',require(_0x91fa('0x87')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x88'),require(_0x91fa('0x89')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x8a'),require(_0x91fa('0x8b')));_0x261d51[_0x91fa('0xa')]('/api/schedules',require('./api/schedule'));_0x261d51[_0x91fa('0xa')]('/api/sounds',require(_0x91fa('0x8c')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x8d'),require('./api/tag'));_0x261d51[_0x91fa('0xa')](_0x91fa('0x8e'),require(_0x91fa('0x8f')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x90'),require('./api/trigger'));_0x261d51[_0x91fa('0xa')]('/api/variables',require(_0x91fa('0x91')));_0x261d51[_0x91fa('0xa')]('/api/integrations',require('./api/integration'));_0x261d51['use']('/api/integrations/reports',require(_0x91fa('0x92')));_0x261d51['use']('/api/analytics/custom_reports',require(_0x91fa('0x93')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x94'),require(_0x91fa('0x95')));_0x261d51['use'](_0x91fa('0x96'),require(_0x91fa('0x97')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x98'),require(_0x91fa('0x99')));_0x261d51[_0x91fa('0xa')]('/api/analytics/field_reports',require(_0x91fa('0x9a')));_0x261d51['use'](_0x91fa('0x9b'),require(_0x91fa('0x9c')));_0x261d51[_0x91fa('0xa')]('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0x261d51[_0x91fa('0xa')](_0x91fa('0x9d'),require(_0x91fa('0x9e')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x9f'),require(_0x91fa('0xa0')));_0x261d51[_0x91fa('0xa')](_0x91fa('0xa1'),require(_0x91fa('0xa2')));_0x261d51['use'](_0x91fa('0xa3'),require(_0x91fa('0xa4')));_0x261d51[_0x91fa('0xa')](_0x91fa('0xa5'),require(_0x91fa('0xa6')));_0x261d51[_0x91fa('0xa')](_0x91fa('0xa7'),require('./api/intDeskAccount'));_0x261d51[_0x91fa('0xa')]('/api/integrations/desk/configurations',require(_0x91fa('0xa8')));_0x261d51[_0x91fa('0xa')]('/api/integrations/desk/fields',require(_0x91fa('0xa9')));_0x261d51[_0x91fa('0xa')]('/api/integrations/zoho/accounts',require(_0x91fa('0xaa')));_0x261d51[_0x91fa('0xa')]('/api/integrations/zoho/configurations',require(_0x91fa('0xab')));_0x261d51['use'](_0x91fa('0xac'),require(_0x91fa('0xad')));_0x261d51['use'](_0x91fa('0xae'),require(_0x91fa('0xaf')));_0x261d51[_0x91fa('0xa')](_0x91fa('0xb0'),require('./api/intZendeskConfiguration'));_0x261d51[_0x91fa('0xa')](_0x91fa('0xb1'),require(_0x91fa('0xb2')));_0x261d51['use'](_0x91fa('0xb3'),require(_0x91fa('0xb4')));_0x261d51[_0x91fa('0xa')](_0x91fa('0xb5'),require(_0x91fa('0xb6')));_0x261d51[_0x91fa('0xa')](_0x91fa('0xb7'),require(_0x91fa('0xb8')));_0x261d51[_0x91fa('0xa')](_0x91fa('0xb9'),require('./api/intVtigerAccount'));_0x261d51['use'](_0x91fa('0xba'),require(_0x91fa('0xbb')));_0x261d51[_0x91fa('0xa')](_0x91fa('0xbc'),require(_0x91fa('0xbd')));_0x261d51[_0x91fa('0xa')](_0x91fa('0xbe'),require(_0x91fa('0xbf')));_0x261d51[_0x91fa('0xa')](_0x91fa('0xc0'),require(_0x91fa('0xc1')));_0x261d51[_0x91fa('0xa')](_0x91fa('0xc2'),require(_0x91fa('0xc3')));_0x261d51[_0x91fa('0xa')](_0x91fa('0xc4'),require('./api/intDynamics365Account'));_0x261d51[_0x91fa('0xa')](_0x91fa('0xc5'),require(_0x91fa('0xc6')));_0x261d51['use'](_0x91fa('0xc7'),require(_0x91fa('0xc8')));_0x261d51['use'](_0x91fa('0xc9'),require(_0x91fa('0xca')));_0x261d51[_0x91fa('0xa')]('/api/integrations/freshsales/configurations',require(_0x91fa('0xcb')));_0x261d51[_0x91fa('0xa')]('/api/integrations/freshsales/fields',require(_0x91fa('0xcc')));_0x261d51[_0x91fa('0xa')](_0x91fa('0xcd'),require('./api/network'));_0x261d51['use']('/api/chat/reports/queue',require(_0x91fa('0xce')));_0x261d51['use']('/api/chat/internal/messages',require('./api/chatInternalMessage'));_0x261d51['use'](_0x91fa('0xcf'),require(_0x91fa('0xd0')));_0x261d51[_0x91fa('0xa')](_0x91fa('0xd1'),require(_0x91fa('0xd2')));_0x261d51[_0x91fa('0xa')](_0x91fa('0xd3'),require(_0x91fa('0xd4')));_0x261d51['use'](_0x91fa('0xd5'),require(_0x91fa('0xd6')));_0x261d51['use'](_0x91fa('0xd7'),require(_0x91fa('0xd8')));_0x261d51[_0x91fa('0xa')](_0x91fa('0xd9'),require(_0x91fa('0xda')));_0x261d51['use'](_0x91fa('0xdb'),require(_0x91fa('0xdc')));_0x261d51[_0x91fa('0xa')](_0x91fa('0xdd'),require(_0x91fa('0xde')));_0x261d51[_0x91fa('0xa')](_0x91fa('0xdf'),require('./api/squareOdbc'));_0x261d51[_0x91fa('0xa')]('/api/square/projects',require(_0x91fa('0xe0')));_0x261d51[_0x91fa('0xa')](_0x91fa('0xe1'),require(_0x91fa('0xe2')));_0x261d51[_0x91fa('0xa')](_0x91fa('0xe3'),require(_0x91fa('0xe4')));_0x261d51[_0x91fa('0xa')](_0x91fa('0xe5'),require(_0x91fa('0xe6')));_0x261d51['use'](_0x91fa('0xe7'),require('./api/license'));_0x261d51[_0x91fa('0xa')](_0x91fa('0xe8'),require(_0x91fa('0xe9')));_0x261d51[_0x91fa('0xa')](_0x91fa('0xea'),require(_0x91fa('0xeb')));_0x261d51[_0x91fa('0xa')](_0x91fa('0xec'),require(_0x91fa('0xed')));_0x261d51['use'](_0x91fa('0xee'),require(_0x91fa('0xef')));_0x261d51['use'](_0x91fa('0xf0'),require(_0x91fa('0xf1')));_0x261d51['use'](_0x91fa('0xf2'),require(_0x91fa('0xf3')));_0x261d51[_0x91fa('0xa')](_0x91fa('0xf4'),require(_0x91fa('0xf5')));_0x261d51[_0x91fa('0xa')](_0x91fa('0xf6'),require(_0x91fa('0xf7')));_0x261d51[_0x91fa('0xa')](_0x91fa('0xf8'),require(_0x91fa('0xf9')));_0x261d51[_0x91fa('0xa')]('/api/cm/lists',require(_0x91fa('0xfa')));_0x261d51['use'](_0x91fa('0xfb'),require('./api/voicePrefix'));_0x261d51['use']('/api/userProfiles',require('./api/userProfile'));_0x261d51[_0x91fa('0xa')](_0x91fa('0xfc'),require(_0x91fa('0xfd')));_0x261d51['use'](_0x91fa('0xfe'),require(_0x91fa('0xff')));_0x261d51['use'](_0x91fa('0x100'),require(_0x91fa('0x101')));_0x261d51[_0x91fa('0xa')]('/api/whatsapp/accounts',require(_0x91fa('0x102')));_0x261d51[_0x91fa('0xa')]('/api/whatsapp/applications',require(_0x91fa('0x103')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x104'),require('./api/whatsappInteraction'));_0x261d51[_0x91fa('0xa')](_0x91fa('0x105'),require('./api/whatsappMessage'));_0x261d51[_0x91fa('0xa')]('/api/whatsapp/reports/queue',require(_0x91fa('0x106')));_0x261d51[_0x91fa('0xa')]('/api/whatsapp/reports/transfer',require(_0x91fa('0x107')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x108'),require(_0x91fa('0x109')));_0x261d51['use'](_0x91fa('0x10a'),require(_0x91fa('0x10b')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x10c'),require(_0x91fa('0x10d')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x10e'),require(_0x91fa('0x10f')));_0x261d51['use'](_0x91fa('0x110'),require(_0x91fa('0x111')));_0x261d51['use']('/api/auth/activedirectory',require(_0x91fa('0x112')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x113'),require('./api/jira'));_0x261d51[_0x91fa('0xa')](_0x91fa('0x114'),require(_0x91fa('0x115')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x116'),require(_0x91fa('0x117')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x118'),require(_0x91fa('0x119')));_0x261d51['use']('/api/pm2',require(_0x91fa('0x11a')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x11b'),require(_0x91fa('0x11c')));_0x261d51[_0x91fa('0xa')](_0x91fa('0x11d'),express[_0x91fa('0x11e')](path[_0x91fa('0x11f')](config[_0x91fa('0x120')],_0x91fa('0x11d'))));_0x261d51[_0x91fa('0xa')](_0x91fa('0x121'),express[_0x91fa('0x11e')](path[_0x91fa('0x11f')](config[_0x91fa('0x120')],_0x91fa('0x121'))));_0x261d51[_0x91fa('0xa')](_0x91fa('0x122'),express['static'](path[_0x91fa('0x11f')](config[_0x91fa('0x120')],'/demo')));_0x261d51['use'](_0x91fa('0x123'),express[_0x91fa('0x11e')](path['join'](config['root'],_0x91fa('0x124'),'3.0.0')));_0x261d51[_0x91fa('0xa')]('/plugins',express[_0x91fa('0x11e')](path['join'](config[_0x91fa('0x120')],_0x91fa('0x125'))));_0x261d51['route'](_0x91fa('0x126'))[_0x91fa('0x127')](errors[0x194]);_0x261d51[_0x91fa('0x128')]('/*')[_0x91fa('0x127')](function(_0x2c5e75,_0x32952e){_0x32952e['sendFile'](path[_0x91fa('0x129')](_0x261d51[_0x91fa('0x127')](_0x91fa('0x12a'))+_0x91fa('0x12b')));});};var sensitiveFields=['username',_0x91fa('0x12c'),_0x91fa('0x12d'),_0x91fa('0x12e'),_0x91fa('0x12f'),_0x91fa('0x130'),'street',_0x91fa('0x131'),_0x91fa('0x132'),'fax',_0x91fa('0x133'),'clientId',_0x91fa('0x134'),'securityToken',_0x91fa('0x135'),_0x91fa('0x136'),_0x91fa('0x137'),'token',_0x91fa('0x138'),_0x91fa('0x139'),_0x91fa('0x13a'),_0x91fa('0x13b'),_0x91fa('0x13c'),_0x91fa('0x13d'),_0x91fa('0x13e'),_0x91fa('0x13f'),_0x91fa('0x140'),_0x91fa('0x141'),'vidaooApiKey',_0x91fa('0x142'),'privateKey',_0x91fa('0x143'),'secretaccesskey',_0x91fa('0x144'),_0x91fa('0x14'),_0x91fa('0x145'),'accountSid',_0x91fa('0x146'),_0x91fa('0x147'),_0x91fa('0x148'),'registry',_0x91fa('0x149')];function maskSensitiveData(_0x4178a5){var _0x156f1e=/(?!^)[\s\S](?!$)/g;if(!_[_0x91fa('0x14a')](_0x4178a5))return;for(var _0x333faa in _0x4178a5){if(_['isArray'](_0x4178a5[_0x333faa])){for(var _0x435ec2=0x0;_0x435ec2<_0x4178a5[_0x333faa][_0x91fa('0x14b')];_0x435ec2++){maskSensitiveData(_0x4178a5[_0x333faa][_0x435ec2]);}}else if(_[_0x91fa('0x14a')](_0x4178a5[_0x333faa])){maskSensitiveData(_0x4178a5[_0x333faa]);}else if(_['isString'](_0x4178a5[_0x333faa])){_0x4178a5[_0x333faa]=_0x4178a5[_0x333faa][_0x91fa('0x14c')](/{{{/g,_0x91fa('0x14d'))[_0x91fa('0x14c')](/}}}/g,_0x91fa('0x14e'))[_0x91fa('0x14c')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x333faa)){_0x4178a5[_0x333faa]=_0x4178a5[_0x333faa][_0x91fa('0x14c')](_0x156f1e,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 824df23..e17116b 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe0bf=['http','rpc','port','localhost','../config/triggers','default','jayson/promise','bluebird','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.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/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server'];(function(_0x23579f,_0x2fafeb){var _0x41f128=function(_0x15f1c0){while(--_0x15f1c0){_0x23579f['push'](_0x23579f['shift']());}};_0x41f128(++_0x2fafeb);}(_0xe0bf,0x198));var _0xfe0b=function(_0x39c798,_0x19ebc5){_0x39c798=_0x39c798-0x0;var _0x2eabc3=_0xe0bf[_0x39c798];return _0x2eabc3;};'use strict';var jayson=require(_0xfe0b('0x0'));var BPromise=require(_0xfe0b('0x1'));var _=require('lodash');var config=require(_0xfe0b('0x2'));exports[_0xfe0b('0x3')]=function(){return new BPromise(function(_0x2dd9a5,_0x3fa0e5){var _0x381a26={};_0x381a26=_['merge'](_0x381a26,require('../api/user/user.rpc'));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x5')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require('../api/voiceQueue/voiceQueue.rpc'));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x6')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x7')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x8')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x9')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0xa')));_0x381a26=_['merge'](_0x381a26,require(_0xfe0b('0xb')));_0x381a26=_['merge'](_0x381a26,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x381a26=_['merge'](_0x381a26,require(_0xfe0b('0xc')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0xd')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0xe')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0xf')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x10')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x11')));_0x381a26=_['merge'](_0x381a26,require(_0xfe0b('0x12')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x13')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x14')));_0x381a26=_['merge'](_0x381a26,require(_0xfe0b('0x15')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x16')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x17')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x18')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x19')));_0x381a26=_['merge'](_0x381a26,require(_0xfe0b('0x1a')));_0x381a26=_['merge'](_0x381a26,require(_0xfe0b('0x1b')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require('../api/smsMessage/smsMessage.rpc'));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x1c')));_0x381a26=_['merge'](_0x381a26,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x1d')));_0x381a26=_['merge'](_0x381a26,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x1e')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x1f')));_0x381a26=_['merge'](_0x381a26,require('../api/chatInteraction/chatInteraction.rpc'));_0x381a26=_['merge'](_0x381a26,require('../api/chatMessage/chatMessage.rpc'));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x20')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x21')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require('../api/cmHopper/cmHopper.rpc'));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x22')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x23')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x24')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x25')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require('../api/pause/pause.rpc'));_0x381a26=_['merge'](_0x381a26,require(_0xfe0b('0x26')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x27')));_0x381a26=_['merge'](_0x381a26,require('../api/trigger/trigger.rpc'));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require('../api/variable/variable.rpc'));_0x381a26=_['merge'](_0x381a26,require(_0xfe0b('0x28')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x29')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x2a')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x2b')));_0x381a26=_['merge'](_0x381a26,require(_0xfe0b('0x2c')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x2d')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x2e')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x2f')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x30')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x31')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x32')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x33')));_0x381a26=_['merge'](_0x381a26,require(_0xfe0b('0x34')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x35')));_0x381a26=_['merge'](_0x381a26,require(_0xfe0b('0x36')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require('../api/squareProject/squareProject.rpc'));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x37')));_0x381a26=_['merge'](_0x381a26,require('../api/squareMessage/squareMessage.rpc'));_0x381a26=_['merge'](_0x381a26,require(_0xfe0b('0x38')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require('../api/attachment/attachment.rpc'));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require('../api/plugin/plugin.rpc'));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x39')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x3a')));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x381a26=_[_0xfe0b('0x4')](_0x381a26,require(_0xfe0b('0x3b')));var _0x719337=jayson[_0xfe0b('0x3c')](_0x381a26)[_0xfe0b('0x3d')]();var _0x2b94d8=config[_0xfe0b('0x3e')][_0xfe0b('0x3f')]||config[_0xfe0b('0x3f')]+0x1;var _0x25f33f=config['rpc']['ip']||_0xfe0b('0x40');_0x719337['on']('error',function(_0x1387b7){return _0x3fa0e5(_0x1387b7);});_0x719337[_0xfe0b('0x3')](_0x2b94d8,_0x25f33f,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x25f33f,_0x2b94d8);require(_0xfe0b('0x41'))[_0xfe0b('0x42')]();return _0x2dd9a5('RPC\x20listening\x20on\x20'+_0x25f33f+':'+_0x2b94d8);});});}; \ No newline at end of file +var _0x1771=['http','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','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/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.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/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.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/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server'];(function(_0x2378e5,_0x3a3505){var _0x3d73c4=function(_0x1fb2d1){while(--_0x1fb2d1){_0x2378e5['push'](_0x2378e5['shift']());}};_0x3d73c4(++_0x3a3505);}(_0x1771,0x161));var _0x1177=function(_0x22d779,_0x53dfff){_0x22d779=_0x22d779-0x0;var _0x553325=_0x1771[_0x22d779];return _0x553325;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x1177('0x0'));var _=require(_0x1177('0x1'));var config=require(_0x1177('0x2'));exports[_0x1177('0x3')]=function(){return new BPromise(function(_0x273e27,_0x263817){var _0x7276e8={};_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x5')));_0x7276e8=_['merge'](_0x7276e8,require(_0x1177('0x6')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x7')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x8')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x9')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0xa')));_0x7276e8=_['merge'](_0x7276e8,require(_0x1177('0xb')));_0x7276e8=_['merge'](_0x7276e8,require('../api/memberReport/memberReport.rpc'));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0xc')));_0x7276e8=_['merge'](_0x7276e8,require(_0x1177('0xd')));_0x7276e8=_['merge'](_0x7276e8,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0xe')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require('../api/mailAccount/mailAccount.rpc'));_0x7276e8=_['merge'](_0x7276e8,require(_0x1177('0xf')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x10')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require('../api/mailMessage/mailMessage.rpc'));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x11')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x12')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x13')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x14')));_0x7276e8=_['merge'](_0x7276e8,require(_0x1177('0x15')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x16')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x17')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x18')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x19')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x1a')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x1b')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x1c')));_0x7276e8=_['merge'](_0x7276e8,require(_0x1177('0x1d')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x1e')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x1f')));_0x7276e8=_['merge'](_0x7276e8,require('../api/chatInteraction/chatInteraction.rpc'));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x20')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x21')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x22')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require('../api/cmHopper/cmHopper.rpc'));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x23')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x24')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x25')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x26')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x27')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x28')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x29')));_0x7276e8=_['merge'](_0x7276e8,require(_0x1177('0x2a')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require('../api/trigger/trigger.rpc'));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x2b')));_0x7276e8=_['merge'](_0x7276e8,require(_0x1177('0x2c')));_0x7276e8=_['merge'](_0x7276e8,require(_0x1177('0x2d')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x2e')));_0x7276e8=_['merge'](_0x7276e8,require(_0x1177('0x2f')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x30')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x31')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x32')));_0x7276e8=_['merge'](_0x7276e8,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require('../api/squareReport/squareReport.rpc'));_0x7276e8=_['merge'](_0x7276e8,require(_0x1177('0x33')));_0x7276e8=_['merge'](_0x7276e8,require('../api/setting/setting.rpc'));_0x7276e8=_['merge'](_0x7276e8,require('../api/squareOdbc/squareOdbc.rpc'));_0x7276e8=_['merge'](_0x7276e8,require(_0x1177('0x34')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x35')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x36')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x37')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x38')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require('../api/plugin/plugin.rpc'));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x39')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x7276e8=_['merge'](_0x7276e8,require(_0x1177('0x3a')));_0x7276e8=_[_0x1177('0x4')](_0x7276e8,require(_0x1177('0x3b')));var _0xbe3742=jayson[_0x1177('0x3c')](_0x7276e8)[_0x1177('0x3d')]();var _0x2b1e99=config[_0x1177('0x3e')][_0x1177('0x3f')]||config['port']+0x1;var _0x42d598=config[_0x1177('0x3e')]['ip']||'localhost';_0xbe3742['on'](_0x1177('0x40'),function(_0x4048b9){return _0x263817(_0x4048b9);});_0xbe3742[_0x1177('0x3')](_0x2b1e99,_0x42d598,function(){console[_0x1177('0x41')](_0x1177('0x42'),_0x42d598,_0x2b1e99);require(_0x1177('0x43'))['default']();return _0x273e27(_0x1177('0x44')+_0x42d598+':'+_0x2b1e99);});});}; \ No newline at end of file diff --git a/server/safe-template.js b/server/safe-template.js index 2f12fd4..09454cf 100644 --- a/server/safe-template.js +++ b/server/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x13f6=['isArray','map','keys','reduce','lodash','string'];(function(_0x31382e,_0x455ad1){var _0x1ee2f0=function(_0x5afad8){while(--_0x5afad8){_0x31382e['push'](_0x31382e['shift']());}};_0x1ee2f0(++_0x455ad1);}(_0x13f6,0x124));var _0x613f=function(_0x5ce5cc,_0x14f791){_0x5ce5cc=_0x5ce5cc-0x0;var _0x5b006d=_0x13f6[_0x5ce5cc];return _0x5b006d;};var _=require(_0x613f('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x1844a4){return _0x1844a4==='{{'?'{\x20{\x20':'\x20}\x20}';}function safeTemplate(_0xd04cfd){var _0x13b50a=_0xd04cfd;if(typeof _0xd04cfd===_0x613f('0x1')){_0x13b50a=_0xd04cfd['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x613f('0x2')](_0xd04cfd)){_0x13b50a=_0xd04cfd[_0x613f('0x3')](function(_0x20af2f){return safeTemplate(_0x20af2f);});}else if(_['isPlainObject'](_0xd04cfd)){_0x13b50a=Object[_0x613f('0x4')](_0xd04cfd)[_0x613f('0x5')](function(_0x5618fa,_0x4b546b){_0x5618fa[_0x4b546b]=safeTemplate(_0xd04cfd[_0x4b546b]);return _0x5618fa;},{});}return _0x13b50a;}module['exports']['safeTemplate']=safeTemplate; \ No newline at end of file +var _0xa571=['reduce','exports','lodash','{\x20{\x20','\x20}\x20}','string','map','isPlainObject','keys'];(function(_0x4672cf,_0x131098){var _0x16b962=function(_0x5d938f){while(--_0x5d938f){_0x4672cf['push'](_0x4672cf['shift']());}};_0x16b962(++_0x131098);}(_0xa571,0x107));var _0x1a57=function(_0x528b6b,_0x453ae4){_0x528b6b=_0x528b6b-0x0;var _0x59f3ba=_0xa571[_0x528b6b];return _0x59f3ba;};var _=require(_0x1a57('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x289e99){return _0x289e99==='{{'?_0x1a57('0x1'):_0x1a57('0x2');}function safeTemplate(_0x48485e){var _0x1a071f=_0x48485e;if(typeof _0x48485e===_0x1a57('0x3')){_0x1a071f=_0x48485e['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x48485e)){_0x1a071f=_0x48485e[_0x1a57('0x4')](function(_0x5067fa){return safeTemplate(_0x5067fa);});}else if(_[_0x1a57('0x5')](_0x48485e)){_0x1a071f=Object[_0x1a57('0x6')](_0x48485e)[_0x1a57('0x7')](function(_0x3c5352,_0x2492f5){_0x3c5352[_0x2492f5]=safeTemplate(_0x48485e[_0x2492f5]);return _0x3c5352;},{});}return _0x1a071f;}module[_0x1a57('0x8')]['safeTemplate']=safeTemplate; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 3e742db..5c6e7c3 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 _0x3ecb=['error','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','close','inherits','sync','prototype','sendRequest','ANSWER','getData','beep','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\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','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','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','EventEmitter','./reply','./error','call','setTimeout','setEncoding','utf8','headers','emit','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','split','length','match'];(function(_0x21044a,_0x55502e){var _0x46244c=function(_0xdedf79){while(--_0xdedf79){_0x21044a['push'](_0x21044a['shift']());}};_0x46244c(++_0x55502e);}(_0x3ecb,0x181));var _0xb3ec=function(_0x34a7b5,_0x15c8fe){_0x34a7b5=_0x34a7b5-0x0;var _0x28dcf4=_0x3ecb[_0x34a7b5];return _0x28dcf4;};'use strict';var util=require(_0xb3ec('0x0'));var _=require('lodash');var EventEmitter=require('events')[_0xb3ec('0x1')];var AGIReply=require(_0xb3ec('0x2'));var AGIError=require(_0xb3ec('0x3'));function AGIChannel(_0x192729){var _0x477cc0=this,_0x516b18=new AGIReply(),_0x566a97=![],_0x17575a={};EventEmitter[_0xb3ec('0x4')](_0x477cc0);_0x192729['setEncoding']('utf8');_0x192729[_0xb3ec('0x5')](0x8*0x3c*0x3c*0x3e8);_0x516b18[_0xb3ec('0x6')](_0xb3ec('0x7'));_0x516b18['on'](_0xb3ec('0x8'),function(_0x33d6ae){for(var _0x308c58 in _0x33d6ae){_0x477cc0[_0x308c58]=_0x33d6ae[_0x308c58];}_0x477cc0[_0xb3ec('0x9')]('ready');});_0x516b18['on']('line',function(_0x283878){if(_0x283878[_0xb3ec('0xa')]()==_0xb3ec('0xb')){_0x477cc0[_0xb3ec('0x9')]('hangup');return;}if(_0x283878[_0xb3ec('0xc')](0x0,0xb)==_0xb3ec('0xd')){_0x566a97=!![];}if(_0x566a97){_0x17575a['rx']+=_0x283878+'\x0a';if(_0x283878[_0xb3ec('0xe')](_0xb3ec('0xf'))!=-0x1){_0x566a97=![];}}else{_0x17575a['rx']=_0x283878;}if(_0x566a97){return;}if(typeof _0x17575a['cb']==_0xb3ec('0x10')){var _0x4f052c=_0x17575a['rx'][_0xb3ec('0xc')](0x0,0x3),_0x5c0482=null,_0x4733bb=null;_0x4f052c=parseInt(_0x4f052c);if(isNaN(_0x4f052c)){_0x17575a['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xb3ec('0x11')});return;}if(_0x4f052c!=0xc8){_0x17575a['cb'](null,{'code':_0x4f052c,'result':-0x1,'extra':'KO'});return;}_0x5c0482=_0x17575a['rx'][_0xb3ec('0xc')](0x4)[_0xb3ec('0x12')](_0xb3ec('0x13'),'');if(_0x5c0482[_0xb3ec('0x14')]('\x20')!=-0x1){_0x5c0482=_0x5c0482[_0xb3ec('0x15')](0x0,_0x5c0482['indexOf']('\x20'));}if(_['startsWith'](_0x5c0482,'-1')){_0x5c0482=parseInt(_0x5c0482);}_0x4733bb=_0x17575a['rx'][_0xb3ec('0x16')]('\x20');if(_0x4733bb[_0xb3ec('0x17')]==0x3){_0x4733bb=_0x4733bb[0x2][_0xb3ec('0xc')](0x1,_0x4733bb[0x2][_0xb3ec('0x17')]-0x1);}else if(_0x4733bb[_0xb3ec('0x17')]>0x3){var _0x134a2a=/\((.+)\)/;var _0x98f28=_0x17575a['rx'][_0xb3ec('0x18')](_0x134a2a);if(_0x98f28){_0x4733bb=_0x98f28[0x1];}else{_0x4733bb=null;}}else{_0x4733bb=null;}_0x17575a['cb'](null,{'code':_0x4f052c,'result':_0x5c0482,'extra':_0x4733bb});}});_0x192729['on'](_0xb3ec('0x19'),function(_0x3e4b4b){_0x477cc0[_0xb3ec('0x9')](_0xb3ec('0x19'),new AGIError('E_AGI_SOCKET_ERROR',_0x3e4b4b[_0xb3ec('0x1a')]));});_0x192729['on']('close',function(){_0x477cc0[_0xb3ec('0x9')]('close',new AGIError(_0xb3ec('0x1b')));});_0x192729['on']('timeout',function(){_0x477cc0['emit'](_0xb3ec('0x1c'),new AGIError(_0xb3ec('0x1d')));_0x192729[_0xb3ec('0x1e')]();});_0x192729['pipe'](_0x516b18);this[_0xb3ec('0x1f')]=function(_0x3f63d0,_0x29e6dd){var _0x3f63d0=_0x3f63d0||'',_0x29e6dd=typeof _0x29e6dd==_0xb3ec('0x10')?_0x29e6dd:new Function();_0x17575a={'tx':_0x3f63d0,'rx':'','cb':_0x29e6dd};_0x192729['write'](_0x3f63d0+'\x0a');},this[_0xb3ec('0x20')]=function(){_0x192729[_0xb3ec('0x1e')]();};}util[_0xb3ec('0x21')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x414cb0){return this[_0xb3ec('0x1f')][_0xb3ec('0x22')](this,_0x414cb0);};AGIChannel[_0xb3ec('0x23')]['answer']=function(){return this[_0xb3ec('0x24')](_0xb3ec('0x25'));};AGIChannel[_0xb3ec('0x23')][_0xb3ec('0x26')]=function(_0x271f5d,_0xc15d48,_0xb9abb8){_0x271f5d=_0x271f5d===undefined?_0xb3ec('0x27'):_0x271f5d;_0xc15d48=_0xc15d48===undefined?'5':_0xc15d48;_0xb9abb8=_0xb9abb8===undefined?'1':_0xb9abb8;return this[_0xb3ec('0x24')](util[_0xb3ec('0x28')](_0xb3ec('0x29'),_0x271f5d,_0xc15d48*0x3e8,_0xb9abb8));};AGIChannel[_0xb3ec('0x23')]['noop']=function(_0x559291){_0x559291=_0x559291||_0xb3ec('0x2a');return this[_0xb3ec('0x24')](util[_0xb3ec('0x28')](_0xb3ec('0x2b'),_0x559291));};AGIChannel['prototype'][_0xb3ec('0x2c')]=function(_0x2c1cd3,_0x480bfd){if(_[_0xb3ec('0x2d')](_0x480bfd)){return this['sendRequest'](util[_0xb3ec('0x28')](_0xb3ec('0x2e'),_0x2c1cd3,_0x480bfd[_0xb3ec('0x2f')](',')));}return this[_0xb3ec('0x24')](util[_0xb3ec('0x28')](_0xb3ec('0x2e'),_0x2c1cd3,_0x480bfd));};AGIChannel[_0xb3ec('0x23')][_0xb3ec('0x30')]=function(_0x392a74){return this[_0xb3ec('0x24')](util[_0xb3ec('0x28')](_0xb3ec('0x31'),_0x392a74));};AGIChannel[_0xb3ec('0x23')][_0xb3ec('0x32')]=function(_0x8c1fcd){return this['sendRequest'](util['format'](_0xb3ec('0x33'),_0x8c1fcd));};AGIChannel[_0xb3ec('0x23')][_0xb3ec('0x34')]=function(_0x3822dd){return this[_0xb3ec('0x24')](util[_0xb3ec('0x28')](_0xb3ec('0x35'),_0x3822dd));};AGIChannel['prototype'][_0xb3ec('0xb')]=function(){return this['sendRequest'](_0xb3ec('0x36'));};AGIChannel[_0xb3ec('0x23')][_0xb3ec('0x37')]=function(_0x33ba81,_0xf50f67){var _0x361be2=_[_0xb3ec('0x38')](_0xf50f67)||_['isNumber'](_0xf50f67)?_0xf50f67[_0xb3ec('0x39')]():_0xf50f67;return this[_0xb3ec('0x24')](util[_0xb3ec('0x28')](_0xb3ec('0x3a'),_0x33ba81,_0x361be2?_0x361be2['toString']()[_0xb3ec('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xb3ec('0x23')][_0xb3ec('0x3b')]=function(_0x7af7cd,_0x5e29c7){return this['sendRequest'](util[_0xb3ec('0x28')](_0xb3ec('0x3c'),_0x7af7cd,_0x5e29c7));};AGIChannel['prototype']['sayDigits']=function(_0x2b6d36,_0x33ec35){return this[_0xb3ec('0x24')](util[_0xb3ec('0x28')](_0xb3ec('0x3d'),_0x2b6d36,_0x33ec35));};AGIChannel[_0xb3ec('0x23')][_0xb3ec('0x3e')]=function(_0x5c0049,_0x2f4b29){return this[_0xb3ec('0x24')](util[_0xb3ec('0x28')](_0xb3ec('0x3f'),_0x5c0049,_0x2f4b29));};AGIChannel['prototype'][_0xb3ec('0x40')]=function(_0x36fafb,_0x13641f,_0x2a1c6c){_0x13641f=_0x13641f||this[_0xb3ec('0x41')];_0x2a1c6c=_0x2a1c6c||0x1;this[_0xb3ec('0x30')](_0x36fafb);this[_0xb3ec('0x32')](_0x13641f);this[_0xb3ec('0x34')](_0x2a1c6c);return this[_0xb3ec('0x42')](util['format'](_0xb3ec('0x43'),_0x36fafb,_0x13641f,_0x2a1c6c));};AGIChannel[_0xb3ec('0x23')][_0xb3ec('0x44')]=function(_0x17ef2c){return this['sendRequest'](util[_0xb3ec('0x28')](_0xb3ec('0x45'),_0x17ef2c));};AGIChannel[_0xb3ec('0x23')][_0xb3ec('0x46')]=function(_0x39f034,_0x363969,_0x88df5e,_0x6ec675,_0x5465cb,_0x352944){_0x363969=_0x363969||_0xb3ec('0x47');_0x88df5e=_0x88df5e||'';_0x6ec675=_0x6ec675===undefined?-0x1:_0x6ec675==='-1'?-0x1:_0x6ec675*0x3e8;_0x5465cb=_0x5465cb===undefined?'':'s='+_0x5465cb;_0x352944=_0x352944?'BEEP':'';return this[_0xb3ec('0x24')](util[_0xb3ec('0x28')](_0xb3ec('0x48'),_0x39f034,_0x363969,_0x88df5e,_0x6ec675,_0x352944,_0x5465cb));};AGIChannel[_0xb3ec('0x23')][_0xb3ec('0x49')]=function(_0x3adb9f,_0x509085){_0x509085=_0x509085||'';return this[_0xb3ec('0x24')](util[_0xb3ec('0x28')](_0xb3ec('0x4a'),_0x3adb9f,_0x509085));};AGIChannel[_0xb3ec('0x23')][_0xb3ec('0x4b')]=function(_0x5c1223){return this['exec'](_0xb3ec('0x4c'),_0x5c1223);};AGIChannel[_0xb3ec('0x23')][_0xb3ec('0x4d')]=function(_0x58c1ed){return this[_0xb3ec('0x2c')](_0xb3ec('0x4e'),_0x58c1ed);};AGIChannel[_0xb3ec('0x23')][_0xb3ec('0x19')]=function(_0x551c4d,_0x6fe211){this['noop'](util['format'](_0xb3ec('0x4f'),_0x551c4d['id'],_0x551c4d[_0xb3ec('0x50')],_0x6fe211));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xb3ec('0x51')]=AGIChannel; \ No newline at end of file +var _0x1e20=['recordFile','wav','BEEP','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','AGI','wait','exec','WAIT','label','exports','lodash','./reply','./error','call','setEncoding','setTimeout','utf8','headers','emit','ready','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','inherits','sendRequest','sync','prototype','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22'];(function(_0x199960,_0x439820){var _0x48f1d4=function(_0x35d731){while(--_0x35d731){_0x199960['push'](_0x199960['shift']());}};_0x48f1d4(++_0x439820);}(_0x1e20,0x1ac));var _0x01e2=function(_0x71fd62,_0x36a6fb){_0x71fd62=_0x71fd62-0x0;var _0x161325=_0x1e20[_0x71fd62];return _0x161325;};'use strict';var util=require('util');var _=require(_0x01e2('0x0'));var EventEmitter=require('events')['EventEmitter'];var AGIReply=require(_0x01e2('0x1'));var AGIError=require(_0x01e2('0x2'));function AGIChannel(_0x14a4bf){var _0x1225ad=this,_0x47b2e6=new AGIReply(),_0x7a5157=![],_0x4f5b5d={};EventEmitter[_0x01e2('0x3')](_0x1225ad);_0x14a4bf[_0x01e2('0x4')]('utf8');_0x14a4bf[_0x01e2('0x5')](0x8*0x3c*0x3c*0x3e8);_0x47b2e6['setEncoding'](_0x01e2('0x6'));_0x47b2e6['on'](_0x01e2('0x7'),function(_0x3291f0){for(var _0x356e07 in _0x3291f0){_0x1225ad[_0x356e07]=_0x3291f0[_0x356e07];}_0x1225ad[_0x01e2('0x8')](_0x01e2('0x9'));});_0x47b2e6['on']('line',function(_0x316f8e){if(_0x316f8e[_0x01e2('0xa')]()==_0x01e2('0xb')){_0x1225ad[_0x01e2('0x8')](_0x01e2('0xb'));return;}if(_0x316f8e[_0x01e2('0xc')](0x0,0xb)==_0x01e2('0xd')){_0x7a5157=!![];}if(_0x7a5157){_0x4f5b5d['rx']+=_0x316f8e+'\x0a';if(_0x316f8e[_0x01e2('0xe')](_0x01e2('0xf'))!=-0x1){_0x7a5157=![];}}else{_0x4f5b5d['rx']=_0x316f8e;}if(_0x7a5157){return;}if(typeof _0x4f5b5d['cb']==_0x01e2('0x10')){var _0x242e74=_0x4f5b5d['rx'][_0x01e2('0xc')](0x0,0x3),_0x30fc72=null,_0x18e894=null;_0x242e74=parseInt(_0x242e74);if(isNaN(_0x242e74)){_0x4f5b5d['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x01e2('0x11')});return;}if(_0x242e74!=0xc8){_0x4f5b5d['cb'](null,{'code':_0x242e74,'result':-0x1,'extra':'KO'});return;}_0x30fc72=_0x4f5b5d['rx'][_0x01e2('0xc')](0x4)[_0x01e2('0x12')](_0x01e2('0x13'),'');if(_0x30fc72['indexOf']('\x20')!=-0x1){_0x30fc72=_0x30fc72[_0x01e2('0x14')](0x0,_0x30fc72['indexOf']('\x20'));}if(_[_0x01e2('0x15')](_0x30fc72,'-1')){_0x30fc72=parseInt(_0x30fc72);}_0x18e894=_0x4f5b5d['rx'][_0x01e2('0x16')]('\x20');if(_0x18e894[_0x01e2('0x17')]==0x3){_0x18e894=_0x18e894[0x2][_0x01e2('0xc')](0x1,_0x18e894[0x2][_0x01e2('0x17')]-0x1);}else if(_0x18e894[_0x01e2('0x17')]>0x3){var _0x30d1ad=/\((.+)\)/;var _0x2af5db=_0x4f5b5d['rx'][_0x01e2('0x18')](_0x30d1ad);if(_0x2af5db){_0x18e894=_0x2af5db[0x1];}else{_0x18e894=null;}}else{_0x18e894=null;}_0x4f5b5d['cb'](null,{'code':_0x242e74,'result':_0x30fc72,'extra':_0x18e894});}});_0x14a4bf['on'](_0x01e2('0x19'),function(_0x57f294){_0x1225ad[_0x01e2('0x8')]('error',new AGIError(_0x01e2('0x1a'),_0x57f294[_0x01e2('0x1b')]));});_0x14a4bf['on'](_0x01e2('0x1c'),function(){_0x1225ad[_0x01e2('0x8')](_0x01e2('0x1c'),new AGIError(_0x01e2('0x1d')));});_0x14a4bf['on'](_0x01e2('0x1e'),function(){_0x1225ad[_0x01e2('0x8')](_0x01e2('0x1e'),new AGIError(_0x01e2('0x1f')));_0x14a4bf['destroy']();});_0x14a4bf[_0x01e2('0x20')](_0x47b2e6);this[_0x01e2('0x21')]=function(_0x479ed2,_0x56ced6){var _0x479ed2=_0x479ed2||'',_0x56ced6=typeof _0x56ced6==_0x01e2('0x10')?_0x56ced6:new Function();_0x4f5b5d={'tx':_0x479ed2,'rx':'','cb':_0x56ced6};_0x14a4bf[_0x01e2('0x22')](_0x479ed2+'\x0a');},this[_0x01e2('0x1c')]=function(){_0x14a4bf['destroy']();};}util[_0x01e2('0x23')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x01e2('0x24')]=function(_0x5912ae){return this[_0x01e2('0x21')][_0x01e2('0x25')](this,_0x5912ae);};AGIChannel[_0x01e2('0x26')][_0x01e2('0x27')]=function(){return this['sendRequest'](_0x01e2('0x28'));};AGIChannel[_0x01e2('0x26')][_0x01e2('0x29')]=function(_0x549b95,_0x5093d6,_0x4fd582){_0x549b95=_0x549b95===undefined?_0x01e2('0x2a'):_0x549b95;_0x5093d6=_0x5093d6===undefined?'5':_0x5093d6;_0x4fd582=_0x4fd582===undefined?'1':_0x4fd582;return this[_0x01e2('0x24')](util[_0x01e2('0x2b')](_0x01e2('0x2c'),_0x549b95,_0x5093d6*0x3e8,_0x4fd582));};AGIChannel[_0x01e2('0x26')][_0x01e2('0x2d')]=function(_0x39b1f5){_0x39b1f5=_0x39b1f5||_0x01e2('0x2e');return this['sendRequest'](util[_0x01e2('0x2b')](_0x01e2('0x2f'),_0x39b1f5));};AGIChannel[_0x01e2('0x26')]['exec']=function(_0x10fff6,_0x462b40){if(_[_0x01e2('0x30')](_0x462b40)){return this['sendRequest'](util['format'](_0x01e2('0x31'),_0x10fff6,_0x462b40[_0x01e2('0x32')](',')));}return this[_0x01e2('0x24')](util[_0x01e2('0x2b')]('EXEC\x20%s\x20%s',_0x10fff6,_0x462b40));};AGIChannel[_0x01e2('0x26')][_0x01e2('0x33')]=function(_0xd5f1a0){return this[_0x01e2('0x24')](util[_0x01e2('0x2b')](_0x01e2('0x34'),_0xd5f1a0));};AGIChannel['prototype'][_0x01e2('0x35')]=function(_0xcb0bf9){return this[_0x01e2('0x24')](util[_0x01e2('0x2b')](_0x01e2('0x36'),_0xcb0bf9));};AGIChannel[_0x01e2('0x26')][_0x01e2('0x37')]=function(_0x58caae){return this[_0x01e2('0x24')](util[_0x01e2('0x2b')](_0x01e2('0x38'),_0x58caae));};AGIChannel[_0x01e2('0x26')][_0x01e2('0xb')]=function(){return this[_0x01e2('0x24')](_0x01e2('0x39'));};AGIChannel[_0x01e2('0x26')][_0x01e2('0x3a')]=function(_0x3aba70,_0xe19545){var _0x177584=_[_0x01e2('0x3b')](_0xe19545)||_['isNumber'](_0xe19545)?_0xe19545['toString']():_0xe19545;return this[_0x01e2('0x24')](util[_0x01e2('0x2b')](_0x01e2('0x3c'),_0x3aba70,_0x177584?_0x177584['toString']()[_0x01e2('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x01e2('0x26')][_0x01e2('0x3d')]=function(_0xcde33d,_0x4819f7){return this[_0x01e2('0x24')](util['format'](_0x01e2('0x3e'),_0xcde33d,_0x4819f7));};AGIChannel[_0x01e2('0x26')][_0x01e2('0x3f')]=function(_0x5d8887,_0xed180a){return this[_0x01e2('0x24')](util[_0x01e2('0x2b')](_0x01e2('0x40'),_0x5d8887,_0xed180a));};AGIChannel['prototype']['sayPhonetic']=function(_0x28f243,_0x2abc11){return this[_0x01e2('0x24')](util[_0x01e2('0x2b')](_0x01e2('0x41'),_0x28f243,_0x2abc11));};AGIChannel[_0x01e2('0x26')]['continueAt']=function(_0x185676,_0x211305,_0x1f18c3){_0x211305=_0x211305||this[_0x01e2('0x42')];_0x1f18c3=_0x1f18c3||0x1;this[_0x01e2('0x33')](_0x185676);this['setExtension'](_0x211305);this[_0x01e2('0x37')](_0x1f18c3);return this['noop'](util[_0x01e2('0x2b')](_0x01e2('0x43'),_0x185676,_0x211305,_0x1f18c3));};AGIChannel[_0x01e2('0x26')][_0x01e2('0x44')]=function(_0x14b271){return this[_0x01e2('0x24')](util[_0x01e2('0x2b')](_0x01e2('0x45'),_0x14b271));};AGIChannel[_0x01e2('0x26')][_0x01e2('0x46')]=function(_0x50af44,_0x5a0943,_0x57cf72,_0xdaa25,_0x729c3a,_0x3dc2f6){_0x5a0943=_0x5a0943||_0x01e2('0x47');_0x57cf72=_0x57cf72||'';_0xdaa25=_0xdaa25===undefined?-0x1:_0xdaa25==='-1'?-0x1:_0xdaa25*0x3e8;_0x729c3a=_0x729c3a===undefined?'':'s='+_0x729c3a;_0x3dc2f6=_0x3dc2f6?_0x01e2('0x48'):'';return this[_0x01e2('0x24')](util[_0x01e2('0x2b')](_0x01e2('0x49'),_0x50af44,_0x5a0943,_0x57cf72,_0xdaa25,_0x3dc2f6,_0x729c3a));};AGIChannel[_0x01e2('0x26')][_0x01e2('0x4a')]=function(_0x5389fd,_0x49c8e6){_0x49c8e6=_0x49c8e6||'';return this['sendRequest'](util[_0x01e2('0x2b')](_0x01e2('0x4b'),_0x5389fd,_0x49c8e6));};AGIChannel[_0x01e2('0x26')][_0x01e2('0x4c')]=function(_0x140c60){return this['exec'](_0x01e2('0x4d'),_0x140c60);};AGIChannel[_0x01e2('0x26')][_0x01e2('0x4e')]=function(_0x5426bc){return this[_0x01e2('0x4f')](_0x01e2('0x50'),_0x5426bc);};AGIChannel[_0x01e2('0x26')][_0x01e2('0x19')]=function(_0x447585,_0x55076e){this[_0x01e2('0x2d')](util[_0x01e2('0x2b')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x447585['id'],_0x447585[_0x01e2('0x51')],_0x55076e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x01e2('0x52')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 25d5a8f..b259b35 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 _0x96d3=['util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message','name','exports'];(function(_0x10f5ea,_0xeb348a){var _0x5c4f0f=function(_0x3644db){while(--_0x3644db){_0x10f5ea['push'](_0x10f5ea['shift']());}};_0x5c4f0f(++_0xeb348a);}(_0x96d3,0xb0));var _0x396d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x96d3[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x396d('0x0'));var error={'E_AGI_UNDEFINED':_0x396d('0x1'),'E_AGI_ARGUMENT_PORT':_0x396d('0x2'),'E_AGI_SERVER_ERROR':_0x396d('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x396d('0x4'),'E_AGI_SOCKET_ERROR':_0x396d('0x5'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x396d('0x6'),'E_AGI_COMMAND_EMPTY':_0x396d('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x396d('0x8'),'E_AGI_IVR_ENTRY':_0x396d('0x9')};function AGIError(_0x55ba3e){var _0x55ba3e=_0x55ba3e||null,_0x3817de=_0x3817de||[],_0x4c4c16=0x1,_0x4dd4b7='';if(!error[_0x55ba3e]){_0x55ba3e=_0x396d('0xa');}_0x3817de[_0x396d('0xb')](error[_0x55ba3e]);while(arguments[_0x4c4c16]){_0x3817de[_0x396d('0xb')](arguments[_0x4c4c16]);_0x4c4c16++;}_0x4dd4b7=util[_0x396d('0xc')]['apply'](util,_0x3817de);this[_0x396d('0xd')]=_0x4dd4b7;this[_0x396d('0xe')]=_0x55ba3e;}module[_0x396d('0xf')]=AGIError; \ No newline at end of file +var _0xc51f=['format','apply','message','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push'];(function(_0x74c1ee,_0x533e4f){var _0x43f6dc=function(_0x16a0b2){while(--_0x16a0b2){_0x74c1ee['push'](_0x74c1ee['shift']());}};_0x43f6dc(++_0x533e4f);}(_0xc51f,0x1a4));var _0xfc51=function(_0x3de01a,_0xcc1fd4){_0x3de01a=_0x3de01a-0x0;var _0x43f31e=_0xc51f[_0x3de01a];return _0x43f31e;};'use strict';var util=require(_0xfc51('0x0'));var error={'E_AGI_UNDEFINED':_0xfc51('0x1'),'E_AGI_ARGUMENT_PORT':_0xfc51('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0xfc51('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xfc51('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xfc51('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xfc51('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xfc51('0x7'),'E_AGI_COMMAND_EMPTY':_0xfc51('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xfc51('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x4c6c8f){var _0x4c6c8f=_0x4c6c8f||null,_0xb28cc5=_0xb28cc5||[],_0xdc8a5e=0x1,_0x4c184c='';if(!error[_0x4c6c8f]){_0x4c6c8f=_0xfc51('0xa');}_0xb28cc5[_0xfc51('0xb')](error[_0x4c6c8f]);while(arguments[_0xdc8a5e]){_0xb28cc5[_0xfc51('0xb')](arguments[_0xdc8a5e]);_0xdc8a5e++;}_0x4c184c=util[_0xfc51('0xc')][_0xfc51('0xd')](util,_0xb28cc5);this[_0xfc51('0xe')]=_0x4c184c;this[_0xfc51('0xf')]=_0x4c6c8f;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 8b694b5..477a784 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 _0x4f37=['default','target','invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','vertices','numberOfEdges','prototype','addVertex','edges','addEdge','push','size','relations','no\x20vertex\x20found','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','agicommand','vswitch'];(function(_0x3d3124,_0x539942){var _0x255e22=function(_0x467ddd){while(--_0x467ddd){_0x3d3124['push'](_0x3d3124['shift']());}};_0x255e22(++_0x539942);}(_0x4f37,0xa4));var _0x74f3=function(_0x4cc89c,_0x4d2e23){_0x4cc89c=_0x4cc89c-0x0;var _0x5852a2=_0x4f37[_0x4cc89c];return _0x5852a2;};'use strict';var _=require(_0x74f3('0x0'));var logger=require(_0x74f3('0x1'))(_0x74f3('0x2'));var verticesWithRetry=[_0x74f3('0x3'),_0x74f3('0x4'),'getsecretdigits'];var Graph=function(){this[_0x74f3('0x5')]={};this['edges']={};this[_0x74f3('0x6')]=0x0;};Graph[_0x74f3('0x7')][_0x74f3('0x8')]=function(_0x3ce17b){this['vertices'][_0x3ce17b['id']]=_0x3ce17b;this[_0x74f3('0x9')][_0x3ce17b['id']]=[];};Graph[_0x74f3('0x7')][_0x74f3('0xa')]=function(_0x1a566a,_0x4c025a,_0x40f01b){this[_0x74f3('0x9')][_0x1a566a][_0x74f3('0xb')]({'target':_0x4c025a,'condition':_0x40f01b});this[_0x74f3('0x6')]+=0x1;};Graph[_0x74f3('0x7')][_0x74f3('0xc')]=function(){return _[_0x74f3('0xc')](this[_0x74f3('0x5')]);};Graph['prototype'][_0x74f3('0xd')]=function(){return this['numberOfEdges'];};Graph[_0x74f3('0x7')]['getVertex']=function(_0x5aee5a){return this[_0x74f3('0x5')][_0x5aee5a];};Graph[_0x74f3('0x7')]['traverseBFS']=function(_0x46d50f,_0x3508ab){if(!this[_0x74f3('0x5')][_0x46d50f]){return logger['info'](_0x74f3('0xe'));}var _0x50ccf1=_0x3508ab(this['vertices'][_0x46d50f]);if(!_0x50ccf1){return logger[_0x74f3('0xf')](_0x74f3('0x10'));}if(this[_0x74f3('0x9')][_0x46d50f][_0x74f3('0x11')]===0x0){return logger[_0x74f3('0xf')](_0x74f3('0x12'));}for(var _0x209886=0x0,_0x3bf9d3=[],_0x9553ee=![];_0x209886\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','mxGraphModel','root','agicommand','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','getSquareProject','then','catch','createSquareReport','hasOwnProperty','indexOf','agi_','substring','variables','close','timeout','evtHangup','hangup','production','start','debug','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','stringify','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','[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:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','xml2json','lodash','syncho','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices'];(function(_0x9ff15c,_0x3375a6){var _0x3c167d=function(_0x43abc6){while(--_0x43abc6){_0x9ff15c['push'](_0x9ff15c['shift']());}};_0x3c167d(++_0x3375a6);}(_0xb605,0x1c1));var _0x5b60=function(_0x108d5f,_0x33f82d){_0x108d5f=_0x108d5f-0x0;var _0x456ea3=_0xb605[_0x108d5f];return _0x456ea3;};'use strict';var parser=require(_0x5b60('0x0'));var _=require(_0x5b60('0x1'));var syncho=require(_0x5b60('0x2'));var util=require('util');var moment=require('moment');var config=require(_0x5b60('0x3'));var logger=require(_0x5b60('0x4'))(_0x5b60('0x5'));var utilLicense=require(_0x5b60('0x6'));var rpc=require(_0x5b60('0x7'));var mailRpc=require(_0x5b60('0x8'));var Graph=require(_0x5b60('0x9'));var Vertices=require(_0x5b60('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x5b60('0x5')]=_[_0x5b60('0xb')](config[_0x5b60('0x5')],{'ip':_0x5b60('0xc'),'port':0x11dd});function connectionHandler(_0x52fa1c){process[_0x5b60('0xd')](function(){syncho(function(){try{setChannelVariables(_0x52fa1c);agiHandler(_0x52fa1c);}catch(_0xe43cf2){logger[_0x5b60('0xe')](_0xe43cf2[_0x5b60('0xf')]);}});});}function listeningHandler(){console[_0x5b60('0x10')](_0x5b60('0x11'),config[_0x5b60('0x5')][_0x5b60('0x12')]);logger[_0x5b60('0x13')](util[_0x5b60('0x14')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x5b60('0x5')]['ip'],config[_0x5b60('0x5')][_0x5b60('0x12')]));}function errorHandler(_0x4f03b3){if(_0x4f03b3&&_0x4f03b3[_0x5b60('0x15')]&&_0x4f03b3[_0x5b60('0x16')]){logger[_0x5b60('0xe')](util[_0x5b60('0x14')]('[%s]\x20%s',_0x4f03b3['name'],_0x4f03b3['message']));}else{logger[_0x5b60('0xe')](util[_0x5b60('0x14')](_0x5b60('0x17'),_0x4f03b3['stack']));}}function closeHandler(){logger[_0x5b60('0x13')](util[_0x5b60('0x14')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x5b60('0x18')],this['calleridname'],this[_0x5b60('0x19')],this[_0x5b60('0x1a')],this[_0x5b60('0x1b')]));try{createSquareReport(this);}catch(_0x54dc42){logger[_0x5b60('0xe')](_0x54dc42[_0x5b60('0xf')]);}}function timeoutHandler(){logger['info'](util[_0x5b60('0x14')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x5b60('0x18')],this[_0x5b60('0x1c')],this[_0x5b60('0x19')],this[_0x5b60('0x1a')],this[_0x5b60('0x1b')]));}function hangupHandler(){logger[_0x5b60('0x13')](util[_0x5b60('0x14')](_0x5b60('0x1d'),this['arg_1'],this['calleridname'],this['callerid'],this[_0x5b60('0x1a')],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x2e590c){return parser[_0x5b60('0x1e')](_0x2e590c,{'object':!![]})[_0x5b60('0x1f')][_0x5b60('0x20')];}function addVertex(_0x168290,_0x32aee1,_0x503be3){_0x32aee1[_0x5b60('0x21')]=_0x503be3;if(_0x32aee1['hasOwnProperty'](_0x5b60('0x22'))){_0x32aee1[_0x5b60('0x23')]=parseInt(_0x32aee1[_0x5b60('0x22')],0xa);}_0x168290[_0x5b60('0x24')](_[_0x5b60('0x25')](_0x32aee1,_0x5b60('0x26')));}function initGraph(_0x493ac6,_0xd61804){var _0x32e2fe=new Graph();for(var _0x29310c in _0x493ac6){if(_0x493ac6['hasOwnProperty'](_0x29310c)){if(_[_0x5b60('0x27')](_0x493ac6[_0x29310c])){for(var _0x3693e3=0x0;_0x3693e3<_0x493ac6[_0x29310c][_0x5b60('0x28')];_0x3693e3+=0x1){addVertex(_0x32e2fe,_0x493ac6[_0x29310c][_0x3693e3],_0x29310c);}}else{addVertex(_0x32e2fe,_0x493ac6[_0x29310c],_0x29310c);}}}for(var _0x23d08a=0x0;_0x23d08a<_0xd61804['length'];_0x23d08a+=0x1){if(_0xd61804[_0x23d08a][_0x5b60('0x29')]&&_0xd61804[_0x23d08a][_0x5b60('0x2a')]){_0x32e2fe[_0x5b60('0x2b')](_0xd61804[_0x23d08a][_0x5b60('0x29')],_0xd61804[_0x23d08a][_0x5b60('0x2a')],_0xd61804[_0x23d08a]['value']);}}return _0x32e2fe;}function getSquareProject(_0x24c145,_0x647a26){rpc[_0x5b60('0x2c')](_0x24c145)[_0x5b60('0x2d')](function(_0x31acc3){_0x647a26(null,_0x31acc3);})[_0x5b60('0x2e')](function(_0x23d205){_0x647a26(null,_0x23d205);});}function createSquareReport(_0x3959e4,_0x19d80f){rpc[_0x5b60('0x2f')](_0x3959e4)[_0x5b60('0x2d')](function(_0x29263a){if(_0x19d80f){_0x19d80f(null,_0x29263a);}})[_0x5b60('0x2e')](function(_0x3b347e){if(_0x19d80f){_0x19d80f(null,_0x3b347e);}});}function setChannelVariables(_0xbe41d7){for(var _0x3609ca in _0xbe41d7){if(_0xbe41d7[_0x5b60('0x30')](_0x3609ca)){if(_0x3609ca[_0x5b60('0x31')](_0x5b60('0x32'))===0x0){_0xbe41d7[_0x3609ca[_0x5b60('0x33')](0x4)]=_0xbe41d7[_0x3609ca];delete _0xbe41d7[_0x3609ca];}}}}function getLogFromObject(_0x3d8364){return util['inspect'](_0x3d8364,{'showHidden':![],'depth':null});}function agiHandler(_0x4b0428){var _0x55e6bb,_0x21ed05,_0xa94a77,_0x3aae88,_0x222371;logger['debug'](_0x5b60('0x34'),JSON['stringify'](_0x4b0428,null,0x2));logger[_0x5b60('0x13')](util[_0x5b60('0x14')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4b0428[_0x5b60('0x18')],_0x4b0428[_0x5b60('0x1c')],_0x4b0428[_0x5b60('0x19')],_0x4b0428[_0x5b60('0x1a')],_0x4b0428[_0x5b60('0x1b')]));_0x4b0428['on'](_0x5b60('0xe'),errorHandler);_0x4b0428['on'](_0x5b60('0x35'),closeHandler);_0x4b0428['on'](_0x5b60('0x36'),timeoutHandler);_0x4b0428[_0x5b60('0x37')]=![];_0x4b0428['on'](_0x5b60('0x38'),hangupHandler);var _0x483137=getSquareProject['sync'](null,_0x4b0428[_0x5b60('0x18')]);if(_0x483137){if(_0x483137['production']){_0x55e6bb=getRoot(_0x483137[_0x5b60('0x39')]);if(_0x55e6bb&&_0x55e6bb[_0x5b60('0x3a')]){logger[_0x5b60('0x3b')](_0x5b60('0x20'),JSON['stringify'](_0x55e6bb,null,0x2));_0x4b0428[_0x5b60('0x3c')]=moment()[_0x5b60('0x14')](_0x5b60('0x3d'));_0x21ed05=initGraph(_[_0x5b60('0x25')](_0x55e6bb,_0x5b60('0x26')),_0x55e6bb[_0x5b60('0x26')]);_0xa94a77=new Vertices(_0x4b0428,rpc,mailRpc);logger[_0x5b60('0x13')](util[_0x5b60('0x14')](_0x5b60('0x3e'),_0x4b0428[_0x5b60('0x18')],_0x4b0428[_0x5b60('0x1c')],_0x4b0428[_0x5b60('0x19')],_0x4b0428['dnid'],_0x4b0428['uniqueid']));_0x21ed05[_0x5b60('0x3f')](_0x55e6bb[_0x5b60('0x3a')]['id'],function(_0x49f234){try{_0x49f234=_0xa94a77[_0x5b60('0x40')](_0x49f234);logger[_0x5b60('0x3b')]('vertex',JSON[_0x5b60('0x41')](_0x49f234,null,0x2));if(_0x49f234[_0x5b60('0x21')]===_0x5b60('0x42')){logger[_0x5b60('0x13')](_0x5b60('0x43'));_0x4b0428[_0x5b60('0x44')]=_0x49f234['context']||_0x4b0428[_0x5b60('0x44')];_0x4b0428['extension']=_0x49f234[_0x5b60('0x45')];_0x4b0428[_0x5b60('0x46')]=_0x49f234[_0x5b60('0x46')]?_0x49f234[_0x5b60('0x46')]-0x1:0x1;return null;}else if(_0x49f234&&_0xa94a77[_0x49f234[_0x5b60('0x21')]]){_0x222371=_0xa94a77[_0x49f234[_0x5b60('0x21')]](_0x49f234);logger[_0x5b60('0x13')](_0x5b60('0x47'),JSON[_0x5b60('0x41')](_0x222371,null,0x2));if(_0x222371&&_0x222371[_0x5b60('0x48')]===AGI_CODE_SUCCESS&&_0x222371['result']!==AGI_RESULT_ERROR&&!_0x4b0428['evtHangup']){logger[_0x5b60('0x3b')](_0x5b60('0x47'),getLogFromObject(_0x222371));return _[_0x5b60('0x49')](_0x222371['result'])?null:_0x222371[_0x5b60('0x4a')][_0x5b60('0x4b')]();}else{logger['error']('response',getLogFromObject(_0x222371));return null;}}else{logger[_0x5b60('0xe')](_0x5b60('0x4c'));return null;}}catch(_0xbadcd4){logger[_0x5b60('0xe')](_0xbadcd4[_0x5b60('0xf')]);return null;}});if(_0x55e6bb[_0x5b60('0x4d')]){logger[_0x5b60('0x13')](util[_0x5b60('0x14')](_0x5b60('0x4e'),_0x4b0428[_0x5b60('0x18')],_0x4b0428[_0x5b60('0x1c')],_0x4b0428['callerid'],_0x4b0428[_0x5b60('0x1a')],_0x4b0428[_0x5b60('0x1b')]));_0x21ed05[_0x5b60('0x3f')](_0x55e6bb[_0x5b60('0x4d')]['id'],function(_0x4590e9){try{_0x4590e9=_0xa94a77[_0x5b60('0x40')](_0x4590e9);logger[_0x5b60('0x3b')](_0x5b60('0x4f'),JSON[_0x5b60('0x41')](_0x4590e9,null,0x2));if(_0x4590e9&&_0xa94a77[_0x4590e9[_0x5b60('0x21')]]){_0x222371=_0xa94a77[_0x4590e9[_0x5b60('0x21')]](_0x4590e9);if(_0x222371){logger[_0x5b60('0x3b')](_0x5b60('0x47'),getLogFromObject(_0x222371));return _[_0x5b60('0x49')](_0x222371[_0x5b60('0x4a')])?null:_0x222371[_0x5b60('0x4a')][_0x5b60('0x4b')]();}else{logger[_0x5b60('0xe')](_0x5b60('0x47'),getLogFromObject(_0x222371));return null;}}else{logger[_0x5b60('0xe')]('agicommand\x20not\x20found');return null;}}catch(_0x17855c){logger[_0x5b60('0xe')](_0x17855c['stack']);return null;}});}logger[_0x5b60('0x13')](util[_0x5b60('0x14')](_0x5b60('0x50'),_0x4b0428[_0x5b60('0x18')],_0x4b0428['calleridname'],_0x4b0428[_0x5b60('0x19')],_0x4b0428[_0x5b60('0x1a')],_0x4b0428[_0x5b60('0x1b')]));logger[_0x5b60('0x13')](util[_0x5b60('0x14')](_0x5b60('0x51'),_0x4b0428['context'],_0x4b0428[_0x5b60('0x45')],parseInt(_0x4b0428[_0x5b60('0x46')],0xa)+0x1));_0x4b0428[_0x5b60('0x52')](_0x4b0428[_0x5b60('0x44')],_0x4b0428[_0x5b60('0x45')],parseInt(_0x4b0428['priority'],0xa)+0x1);_0x4b0428[_0x5b60('0x35')]();}}else{logger[_0x5b60('0xe')](util['format'](_0x5b60('0x53'),_0x4b0428['arg_1']));_0x4b0428[_0x5b60('0x52')](_0x4b0428['context'],_0x4b0428[_0x5b60('0x45')],parseInt(_0x4b0428['priority'],0xa)+0x1);_0x4b0428[_0x5b60('0x35')]();}}else{logger[_0x5b60('0xe')](util['format'](_0x5b60('0x54'),_0x4b0428['arg_1']));_0x4b0428['continueAt'](_0x4b0428[_0x5b60('0x44')],_0x4b0428[_0x5b60('0x45')],parseInt(_0x4b0428['priority'],0xa)+0x1);_0x4b0428['close']();}}function main(){var _0x292c9f;return utilLicense[_0x5b60('0x55')]()[_0x5b60('0x2d')](function(_0x2b616e){if(_0x2b616e){if(_0x2b616e[_0x5b60('0x56')]){if(_0x2b616e[_0x5b60('0x57')]&&_0x2b616e['callysquare']>0x0){logger[_0x5b60('0x13')](util[_0x5b60('0x14')]('[LICENSE]\x20CHANNELS:\x20%s',_0x2b616e[_0x5b60('0x57')]));_0x292c9f=_0x2b616e['callysquare'];}else{logger[_0x5b60('0x13')](_0x5b60('0x58'));}}else{logger[_0x5b60('0x13')](_0x5b60('0x59'));_0x292c9f=-0x1;}}})[_0x5b60('0x2e')](function(_0x14d44d){logger['error'](_0x5b60('0x5a'),_0x14d44d['stack']);})[_0x5b60('0x4d')](function(){var _0xa9f463=require('./server')(config[_0x5b60('0x5')][_0x5b60('0x12')],config['agi']['ip'],_0x292c9f);_0xa9f463['on'](_0x5b60('0xe'),errorHandler);_0xa9f463['on'](_0x5b60('0x5b'),listeningHandler);_0xa9f463['on']('connection',connectionHandler);_0xa9f463['on'](_0x5b60('0x35'),closeHandler);});}main(); \ No newline at end of file +var _0xed5d=['maxRetry','addVertex','mxCell','isArray','source','target','addEdge','value','getSquareProject','then','catch','createSquareReport','agi_','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','debug','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','traverseBFS','clear','vertex','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toString','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','moment','../../config/environment','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','name','[%s]\x20%s','message','[ERROR]\x20%s','stack','arg_1','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','root','hasOwnProperty'];(function(_0x5b7755,_0x44681c){var _0x1a9c39=function(_0x56ceec){while(--_0x56ceec){_0x5b7755['push'](_0x5b7755['shift']());}};_0x1a9c39(++_0x44681c);}(_0xed5d,0xef));var _0xded5=function(_0x4e3ea9,_0x5b84e9){_0x4e3ea9=_0x4e3ea9-0x0;var _0x5c1d6c=_0xed5d[_0x4e3ea9];return _0x5c1d6c;};'use strict';var parser=require(_0xded5('0x0'));var _=require(_0xded5('0x1'));var syncho=require('syncho');var util=require('util');var moment=require(_0xded5('0x2'));var config=require(_0xded5('0x3'));var logger=require('../../config/logger')(_0xded5('0x4'));var utilLicense=require(_0xded5('0x5'));var rpc=require(_0xded5('0x6'));var mailRpc=require(_0xded5('0x7'));var Graph=require(_0xded5('0x8'));var Vertices=require(_0xded5('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xded5('0x4')]=_[_0xded5('0xa')](config['agi'],{'ip':_0xded5('0xb'),'port':0x11dd});function connectionHandler(_0x5e70e0){process[_0xded5('0xc')](function(){syncho(function(){try{setChannelVariables(_0x5e70e0);agiHandler(_0x5e70e0);}catch(_0x22b2c6){logger[_0xded5('0xd')](_0x22b2c6['stack']);}});});}function listeningHandler(){console[_0xded5('0xe')](_0xded5('0xf'),config[_0xded5('0x4')][_0xded5('0x10')]);logger[_0xded5('0x11')](util[_0xded5('0x12')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xded5('0x4')]['ip'],config[_0xded5('0x4')][_0xded5('0x10')]));}function errorHandler(_0x414bba){if(_0x414bba&&_0x414bba[_0xded5('0x13')]&&_0x414bba['message']){logger['error'](util[_0xded5('0x12')](_0xded5('0x14'),_0x414bba[_0xded5('0x13')],_0x414bba[_0xded5('0x15')]));}else{logger[_0xded5('0xd')](util[_0xded5('0x12')](_0xded5('0x16'),_0x414bba[_0xded5('0x17')]));}}function closeHandler(){logger[_0xded5('0x11')](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xded5('0x18')],this['calleridname'],this[_0xded5('0x19')],this[_0xded5('0x1a')],this[_0xded5('0x1b')]));try{createSquareReport(this);}catch(_0x40d8d9){logger['error'](_0x40d8d9[_0xded5('0x17')]);}}function timeoutHandler(){logger[_0xded5('0x11')](util[_0xded5('0x12')](_0xded5('0x1c'),this[_0xded5('0x18')],this[_0xded5('0x1d')],this['callerid'],this[_0xded5('0x1a')],this[_0xded5('0x1b')]));}function hangupHandler(){logger[_0xded5('0x11')](util[_0xded5('0x12')](_0xded5('0x1e'),this[_0xded5('0x18')],this[_0xded5('0x1d')],this[_0xded5('0x19')],this[_0xded5('0x1a')],this[_0xded5('0x1b')]));this['evtHangup']=!![];}function getRoot(_0x1d9818){return parser[_0xded5('0x1f')](_0x1d9818,{'object':!![]})['mxGraphModel'][_0xded5('0x20')];}function addVertex(_0x4fed5d,_0x4575e0,_0x2e1239){_0x4575e0['agicommand']=_0x2e1239;if(_0x4575e0[_0xded5('0x21')]('retry')){_0x4575e0[_0xded5('0x22')]=parseInt(_0x4575e0['retry'],0xa);}_0x4fed5d[_0xded5('0x23')](_['omit'](_0x4575e0,_0xded5('0x24')));}function initGraph(_0x1176af,_0x15ad09){var _0x9dbcf7=new Graph();for(var _0x445b3c in _0x1176af){if(_0x1176af[_0xded5('0x21')](_0x445b3c)){if(_[_0xded5('0x25')](_0x1176af[_0x445b3c])){for(var _0x21efd8=0x0;_0x21efd8<_0x1176af[_0x445b3c]['length'];_0x21efd8+=0x1){addVertex(_0x9dbcf7,_0x1176af[_0x445b3c][_0x21efd8],_0x445b3c);}}else{addVertex(_0x9dbcf7,_0x1176af[_0x445b3c],_0x445b3c);}}}for(var _0x1c7910=0x0;_0x1c7910<_0x15ad09['length'];_0x1c7910+=0x1){if(_0x15ad09[_0x1c7910][_0xded5('0x26')]&&_0x15ad09[_0x1c7910][_0xded5('0x27')]){_0x9dbcf7[_0xded5('0x28')](_0x15ad09[_0x1c7910]['source'],_0x15ad09[_0x1c7910][_0xded5('0x27')],_0x15ad09[_0x1c7910][_0xded5('0x29')]);}}return _0x9dbcf7;}function getSquareProject(_0x18a413,_0x31e3ca){rpc[_0xded5('0x2a')](_0x18a413)[_0xded5('0x2b')](function(_0x390289){_0x31e3ca(null,_0x390289);})[_0xded5('0x2c')](function(_0x2d3de3){_0x31e3ca(null,_0x2d3de3);});}function createSquareReport(_0x36d059,_0xe5d938){rpc[_0xded5('0x2d')](_0x36d059)[_0xded5('0x2b')](function(_0x942c83){if(_0xe5d938){_0xe5d938(null,_0x942c83);}})[_0xded5('0x2c')](function(_0x418907){if(_0xe5d938){_0xe5d938(null,_0x418907);}});}function setChannelVariables(_0x28de5a){for(var _0x27ce4c in _0x28de5a){if(_0x28de5a[_0xded5('0x21')](_0x27ce4c)){if(_0x27ce4c['indexOf'](_0xded5('0x2e'))===0x0){_0x28de5a[_0x27ce4c['substring'](0x4)]=_0x28de5a[_0x27ce4c];delete _0x28de5a[_0x27ce4c];}}}}function getLogFromObject(_0x2b5c44){return util['inspect'](_0x2b5c44,{'showHidden':![],'depth':null});}function agiHandler(_0x56be22){var _0x58a70f,_0x3d7593,_0x1b77db,_0x1777c5,_0x2cbfeb;logger['debug'](_0xded5('0x2f'),JSON[_0xded5('0x30')](_0x56be22,null,0x2));logger[_0xded5('0x11')](util['format'](_0xded5('0x31'),_0x56be22['arg_1'],_0x56be22[_0xded5('0x1d')],_0x56be22['callerid'],_0x56be22[_0xded5('0x1a')],_0x56be22[_0xded5('0x1b')]));_0x56be22['on'](_0xded5('0xd'),errorHandler);_0x56be22['on'](_0xded5('0x32'),closeHandler);_0x56be22['on'](_0xded5('0x33'),timeoutHandler);_0x56be22['evtHangup']=![];_0x56be22['on'](_0xded5('0x34'),hangupHandler);var _0x151f38=getSquareProject[_0xded5('0x35')](null,_0x56be22[_0xded5('0x18')]);if(_0x151f38){if(_0x151f38['production']){_0x58a70f=getRoot(_0x151f38[_0xded5('0x36')]);if(_0x58a70f&&_0x58a70f[_0xded5('0x37')]){logger[_0xded5('0x38')](_0xded5('0x20'),JSON['stringify'](_0x58a70f,null,0x2));_0x56be22[_0xded5('0x39')]=moment()[_0xded5('0x12')](_0xded5('0x3a'));_0x3d7593=initGraph(_[_0xded5('0x3b')](_0x58a70f,_0xded5('0x24')),_0x58a70f[_0xded5('0x24')]);_0x1b77db=new Vertices(_0x56be22,rpc,mailRpc);logger[_0xded5('0x11')](util[_0xded5('0x12')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x56be22[_0xded5('0x18')],_0x56be22[_0xded5('0x1d')],_0x56be22[_0xded5('0x19')],_0x56be22[_0xded5('0x1a')],_0x56be22[_0xded5('0x1b')]));_0x3d7593[_0xded5('0x3c')](_0x58a70f[_0xded5('0x37')]['id'],function(_0x21f918){try{_0x21f918=_0x1b77db[_0xded5('0x3d')](_0x21f918);logger['debug'](_0xded5('0x3e'),JSON[_0xded5('0x30')](_0x21f918,null,0x2));if(_0x21f918[_0xded5('0x3f')]===_0xded5('0x40')){logger[_0xded5('0x11')](_0xded5('0x41'));_0x56be22[_0xded5('0x42')]=_0x21f918[_0xded5('0x42')]||_0x56be22[_0xded5('0x42')];_0x56be22[_0xded5('0x43')]=_0x21f918[_0xded5('0x43')];_0x56be22[_0xded5('0x44')]=_0x21f918[_0xded5('0x44')]?_0x21f918[_0xded5('0x44')]-0x1:0x1;return null;}else if(_0x21f918&&_0x1b77db[_0x21f918[_0xded5('0x3f')]]){_0x2cbfeb=_0x1b77db[_0x21f918[_0xded5('0x3f')]](_0x21f918);logger[_0xded5('0x11')](_0xded5('0x45'),JSON[_0xded5('0x30')](_0x2cbfeb,null,0x2));if(_0x2cbfeb&&_0x2cbfeb[_0xded5('0x46')]===AGI_CODE_SUCCESS&&_0x2cbfeb[_0xded5('0x47')]!==AGI_RESULT_ERROR&&!_0x56be22[_0xded5('0x48')]){logger['debug']('response',getLogFromObject(_0x2cbfeb));return _[_0xded5('0x49')](_0x2cbfeb['result'])?null:_0x2cbfeb[_0xded5('0x47')]['toString']();}else{logger['error']('response',getLogFromObject(_0x2cbfeb));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x1d91e3){logger[_0xded5('0xd')](_0x1d91e3[_0xded5('0x17')]);return null;}});if(_0x58a70f[_0xded5('0x4a')]){logger[_0xded5('0x11')](util[_0xded5('0x12')](_0xded5('0x4b'),_0x56be22[_0xded5('0x18')],_0x56be22[_0xded5('0x1d')],_0x56be22[_0xded5('0x19')],_0x56be22[_0xded5('0x1a')],_0x56be22['uniqueid']));_0x3d7593['traverseBFS'](_0x58a70f[_0xded5('0x4a')]['id'],function(_0x101e65){try{_0x101e65=_0x1b77db['clear'](_0x101e65);logger[_0xded5('0x38')](_0xded5('0x3e'),JSON[_0xded5('0x30')](_0x101e65,null,0x2));if(_0x101e65&&_0x1b77db[_0x101e65[_0xded5('0x3f')]]){_0x2cbfeb=_0x1b77db[_0x101e65[_0xded5('0x3f')]](_0x101e65);if(_0x2cbfeb){logger[_0xded5('0x38')](_0xded5('0x45'),getLogFromObject(_0x2cbfeb));return _[_0xded5('0x49')](_0x2cbfeb[_0xded5('0x47')])?null:_0x2cbfeb['result'][_0xded5('0x4c')]();}else{logger[_0xded5('0xd')](_0xded5('0x45'),getLogFromObject(_0x2cbfeb));return null;}}else{logger[_0xded5('0xd')](_0xded5('0x4d'));return null;}}catch(_0x4faa02){logger[_0xded5('0xd')](_0x4faa02[_0xded5('0x17')]);return null;}});}logger[_0xded5('0x11')](util[_0xded5('0x12')](_0xded5('0x4e'),_0x56be22[_0xded5('0x18')],_0x56be22[_0xded5('0x1d')],_0x56be22[_0xded5('0x19')],_0x56be22[_0xded5('0x1a')],_0x56be22[_0xded5('0x1b')]));logger['info'](util[_0xded5('0x12')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x56be22['context'],_0x56be22[_0xded5('0x43')],parseInt(_0x56be22[_0xded5('0x44')],0xa)+0x1));_0x56be22[_0xded5('0x4f')](_0x56be22[_0xded5('0x42')],_0x56be22[_0xded5('0x43')],parseInt(_0x56be22[_0xded5('0x44')],0xa)+0x1);_0x56be22['close']();}}else{logger['error'](util['format']('Project\x20%s\x20not\x20published',_0x56be22['arg_1']));_0x56be22[_0xded5('0x4f')](_0x56be22[_0xded5('0x42')],_0x56be22[_0xded5('0x43')],parseInt(_0x56be22[_0xded5('0x44')],0xa)+0x1);_0x56be22['close']();}}else{logger[_0xded5('0xd')](util[_0xded5('0x12')](_0xded5('0x50'),_0x56be22[_0xded5('0x18')]));_0x56be22[_0xded5('0x4f')](_0x56be22[_0xded5('0x42')],_0x56be22[_0xded5('0x43')],parseInt(_0x56be22[_0xded5('0x44')],0xa)+0x1);_0x56be22[_0xded5('0x32')]();}}function main(){var _0x4ddacb;return utilLicense[_0xded5('0x51')]()['then'](function(_0x3c715b){if(_0x3c715b){if(_0x3c715b[_0xded5('0x52')]){if(_0x3c715b[_0xded5('0x53')]&&_0x3c715b[_0xded5('0x53')]>0x0){logger[_0xded5('0x11')](util[_0xded5('0x12')](_0xded5('0x54'),_0x3c715b[_0xded5('0x53')]));_0x4ddacb=_0x3c715b[_0xded5('0x53')];}else{logger['info'](_0xded5('0x55'));}}else{logger['info'](_0xded5('0x56'));_0x4ddacb=-0x1;}}})[_0xded5('0x2c')](function(_0x2a897a){logger[_0xded5('0xd')](_0xded5('0x57'),_0x2a897a[_0xded5('0x17')]);})[_0xded5('0x4a')](function(){var _0x14bd2c=require(_0xded5('0x58'))(config[_0xded5('0x4')][_0xded5('0x10')],config['agi']['ip'],_0x4ddacb);_0x14bd2c['on'](_0xded5('0xd'),errorHandler);_0x14bd2c['on'](_0xded5('0x59'),listeningHandler);_0x14bd2c['on'](_0xded5('0x5a'),connectionHandler);_0x14bd2c['on'](_0xded5('0x32'),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 328271e..57c0f21 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 _0xfd45=['catch','sendMailMessage','bluebird','jayson/promise','http','request','then','error','message','result'];(function(_0x4929ff,_0x4132a7){var _0x38aa4e=function(_0xc63ac1){while(--_0xc63ac1){_0x4929ff['push'](_0x4929ff['shift']());}};_0x38aa4e(++_0x4132a7);}(_0xfd45,0xb6));var _0x5fd4=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xfd45[_0x17d9e3];return _0x14192d;};'use strict';var BPromise=require(_0x5fd4('0x0'));var jayson=require(_0x5fd4('0x1'));var client=jayson['client'][_0x5fd4('0x2')]({'port':0x232b});function request(_0x44017b,_0x105316){return new BPromise(function(_0x156272,_0x56b9c2){return client[_0x5fd4('0x3')](_0x44017b,_0x105316)[_0x5fd4('0x4')](function(_0x4f4579){if(_0x4f4579[_0x5fd4('0x5')]){return _0x56b9c2(_0x4f4579[_0x5fd4('0x5')][_0x5fd4('0x6')]);}else{return _0x156272(_0x4f4579[_0x5fd4('0x7')]);}})[_0x5fd4('0x8')](function(_0x41ecb0){return _0x56b9c2(_0x41ecb0);});});}exports[_0x5fd4('0x9')]=function(_0x10bfee,_0x401e03){return request('SendMail',{'account':_0x10bfee,'message':_0x401e03});}; \ No newline at end of file +var _0x1d57=['sendMailMessage','bluebird','jayson/promise','client','http','request','then','error','message','result','catch'];(function(_0x31d894,_0x1e7c6f){var _0x1bb77f=function(_0x3ba5c6){while(--_0x3ba5c6){_0x31d894['push'](_0x31d894['shift']());}};_0x1bb77f(++_0x1e7c6f);}(_0x1d57,0xb1));var _0x71d5=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x1d57[_0x5037ab];return _0x512adb;};'use strict';var BPromise=require(_0x71d5('0x0'));var jayson=require(_0x71d5('0x1'));var client=jayson[_0x71d5('0x2')][_0x71d5('0x3')]({'port':0x232b});function request(_0x72aa5b,_0x4b4b4f){return new BPromise(function(_0x556477,_0x396beb){return client[_0x71d5('0x4')](_0x72aa5b,_0x4b4b4f)[_0x71d5('0x5')](function(_0x1d17df){if(_0x1d17df[_0x71d5('0x6')]){return _0x396beb(_0x1d17df[_0x71d5('0x6')][_0x71d5('0x7')]);}else{return _0x556477(_0x1d17df[_0x71d5('0x8')]);}})[_0x71d5('0x9')](function(_0x32bb72){return _0x396beb(_0x32bb72);});});}exports[_0x71d5('0xa')]=function(_0x26aae9,_0x485512){return request('SendMail',{'account':_0x26aae9,'message':_0x485512});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index da3da73..c456383 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 _0xb139=['indexOf','substring','length','split','slice','trim','headers','emit','line','exports','util','stream','call','_localBuffer','_transform','\x0d\x0a\x0d\x0a','toString','_inBody'];(function(_0x1120f0,_0x3d9999){var _0xf1be61=function(_0x3b3efe){while(--_0x3b3efe){_0x1120f0['push'](_0x1120f0['shift']());}};_0xf1be61(++_0x3d9999);}(_0xb139,0x1ba));var _0x9b13=function(_0x43fc38,_0x1d6d46){_0x43fc38=_0x43fc38-0x0;var _0x592358=_0xb139[_0x43fc38];return _0x592358;};'use strict';var util=require(_0x9b13('0x0'));var Transform=require(_0x9b13('0x1'))['Transform'];function AGIReply(_0x33b533){Transform[_0x9b13('0x2')](this,_0x33b533);this[_0x9b13('0x3')]='';this['_inBody']=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype'][_0x9b13('0x4')]=function(_0x2eb67a,_0x297458,_0x57c7a5){var _0x3cb126='\x0a',_0xb8e3dc=['\x0a\x0a',_0x9b13('0x5')],_0xc1541c=-0x1,_0x448fbe=-0x1,_0xacf7de='',_0x98acc=0x0,_0x358f87='',_0x5c980f='';this[_0x9b13('0x3')]+=_0x2eb67a[_0x9b13('0x6')]();_0x358f87=this[_0x9b13('0x3')];if(!this[_0x9b13('0x7')]){_0x98acc=0x0;while(_0xb8e3dc[_0x98acc]){while((_0x448fbe=_0x358f87[_0x9b13('0x8')](_0xb8e3dc[_0x98acc]))!=-0x1){_0xacf7de=_0xb8e3dc[_0x98acc];_0x5c980f=_0x358f87[_0x9b13('0x9')](0x0,_0x448fbe);_0x358f87=_0x358f87[_0x9b13('0x9')](_0x448fbe+_0xacf7de[_0x9b13('0xa')]);var _0x25b901=_0x5c980f[_0x9b13('0xb')](_0x3cb126),_0x13ce83=0x0,_0x27e2c8={},_0x57c6bb='',_0x2acc39='',_0xf73b78=-0x1;while(_0x25b901[_0x13ce83]){_0xf73b78=_0x25b901[_0x13ce83][_0x9b13('0x8')](':');if(_0xf73b78!=-0x1){_0x57c6bb=_0x25b901[_0x13ce83][_0x9b13('0xc')](0x0,_0xf73b78)[_0x9b13('0xd')]();_0x2acc39=_0x25b901[_0x13ce83][_0x9b13('0xc')](_0xf73b78+0x1)[_0x9b13('0xd')]();if(_0x57c6bb[_0x9b13('0xa')]>0x0){_0x27e2c8[_0x57c6bb]=_0x2acc39;}}else{}_0x13ce83++;}this['emit'](_0x9b13('0xe'),_0x27e2c8);this['_inBody']=!![];}_0x98acc++;}this[_0x9b13('0x3')]=_0x358f87;}else{while((_0xc1541c=_0x358f87[_0x9b13('0x8')](_0x3cb126))!=-0x1){_0x5c980f=_0x358f87[_0x9b13('0x9')](0x0,_0xc1541c);this[_0x9b13('0xf')](_0x9b13('0x10'),_0x5c980f);_0x358f87=_0x358f87[_0x9b13('0x9')](_0xc1541c+_0x3cb126['length']);}this[_0x9b13('0x3')]=_0x358f87;}_0x57c7a5();};module[_0x9b13('0x11')]=AGIReply; \ No newline at end of file +var _0x4e37=['headers','substring','line','exports','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody','indexOf','length','split','slice','trim','emit'];(function(_0x484195,_0x25a4d2){var _0xd057ff=function(_0x4a1b2b){while(--_0x4a1b2b){_0x484195['push'](_0x484195['shift']());}};_0xd057ff(++_0x25a4d2);}(_0x4e37,0x1a8));var _0x74e3=function(_0x37cd56,_0x49d747){_0x37cd56=_0x37cd56-0x0;var _0x497e08=_0x4e37[_0x37cd56];return _0x497e08;};'use strict';var util=require(_0x74e3('0x0'));var Transform=require(_0x74e3('0x1'))[_0x74e3('0x2')];function AGIReply(_0xdcbb69){Transform[_0x74e3('0x3')](this,_0xdcbb69);this[_0x74e3('0x4')]='';this['_inBody']=![];}util[_0x74e3('0x5')](AGIReply,Transform);AGIReply[_0x74e3('0x6')][_0x74e3('0x7')]=function(_0x5097f7,_0x5778aa,_0x2207f1){var _0x2740a4='\x0a',_0x4aba44=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x5b67f8=-0x1,_0x558202=-0x1,_0xcf8d6b='',_0x5f3f53=0x0,_0x34f3f8='',_0x1ad4b8='';this[_0x74e3('0x4')]+=_0x5097f7[_0x74e3('0x8')]();_0x34f3f8=this[_0x74e3('0x4')];if(!this[_0x74e3('0x9')]){_0x5f3f53=0x0;while(_0x4aba44[_0x5f3f53]){while((_0x558202=_0x34f3f8[_0x74e3('0xa')](_0x4aba44[_0x5f3f53]))!=-0x1){_0xcf8d6b=_0x4aba44[_0x5f3f53];_0x1ad4b8=_0x34f3f8['substring'](0x0,_0x558202);_0x34f3f8=_0x34f3f8['substring'](_0x558202+_0xcf8d6b[_0x74e3('0xb')]);var _0x59b92c=_0x1ad4b8[_0x74e3('0xc')](_0x2740a4),_0x430958=0x0,_0x12bc51={},_0x4ff1ce='',_0x187ad9='',_0x5488dd=-0x1;while(_0x59b92c[_0x430958]){_0x5488dd=_0x59b92c[_0x430958][_0x74e3('0xa')](':');if(_0x5488dd!=-0x1){_0x4ff1ce=_0x59b92c[_0x430958][_0x74e3('0xd')](0x0,_0x5488dd)[_0x74e3('0xe')]();_0x187ad9=_0x59b92c[_0x430958][_0x74e3('0xd')](_0x5488dd+0x1)[_0x74e3('0xe')]();if(_0x4ff1ce[_0x74e3('0xb')]>0x0){_0x12bc51[_0x4ff1ce]=_0x187ad9;}}else{}_0x430958++;}this[_0x74e3('0xf')](_0x74e3('0x10'),_0x12bc51);this['_inBody']=!![];}_0x5f3f53++;}this[_0x74e3('0x4')]=_0x34f3f8;}else{while((_0x5b67f8=_0x34f3f8[_0x74e3('0xa')](_0x2740a4))!=-0x1){_0x1ad4b8=_0x34f3f8[_0x74e3('0x11')](0x0,_0x5b67f8);this[_0x74e3('0xf')](_0x74e3('0x12'),_0x1ad4b8);_0x34f3f8=_0x34f3f8['substring'](_0x5b67f8+_0x2740a4[_0x74e3('0xb')]);}this[_0x74e3('0x4')]=_0x34f3f8;}_0x2207f1();};module[_0x74e3('0x13')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index c6c544b..ab2f214 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 _0x685c=['getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable'];(function(_0x28dd93,_0x535fa1){var _0x4731a0=function(_0x55a80b){while(--_0x55a80b){_0x28dd93['push'](_0x28dd93['shift']());}};_0x4731a0(++_0x535fa1);}(_0x685c,0x1ae));var _0xc685=function(_0x56fdf9,_0x296eb7){_0x56fdf9=_0x56fdf9-0x0;var _0x33fa2b=_0x685c[_0x56fdf9];return _0x33fa2b;};'use strict';var BPromise=require(_0xc685('0x0'));var moment=require(_0xc685('0x1'));var _=require(_0xc685('0x2'));var util=require(_0xc685('0x3'));var jayson=require(_0xc685('0x4'));var client=jayson['client']['http']({'port':0x2329});function request(_0x1b7a1e,_0x4716bc){return new BPromise(function(_0x1f9ee2,_0x5e81c7){return client[_0xc685('0x5')](_0x1b7a1e,_0x4716bc)[_0xc685('0x6')](function(_0x3f83b2){if(_0x3f83b2['error']){return _0x5e81c7(_0x3f83b2[_0xc685('0x7')][_0xc685('0x8')]);}else{return _0x1f9ee2(_0x3f83b2[_0xc685('0x9')]);}})[_0xc685('0xa')](function(_0x36a451){return _0x5e81c7(_0x36a451);});});}exports[_0xc685('0xb')]=function(_0x534e48){return request(_0xc685('0xc'),{'options':{'raw':![],'where':{'name':_0x534e48},'attributes':[_0xc685('0xd')]}});};exports[_0xc685('0xe')]=function(_0x428271){return request(_0xc685('0xf'),{'options':{'raw':![],'where':{'id':_0x428271},'include':[{'model':_0xc685('0x10'),'as':_0xc685('0x11')}],'attributes':['id',_0xc685('0x12'),_0xc685('0x13')]}});};exports[_0xc685('0x14')]=function(_0xa5fc69){return request(_0xc685('0xc'),{'options':{'where':{'id':_0xa5fc69},'attributes':[_0xc685('0x12')]}});};exports[_0xc685('0x15')]=function(_0x200501){return request(_0xc685('0x16'),{'options':{'where':{'id':_0x200501},'attributes':[_0xc685('0x12')]}});};exports[_0xc685('0x17')]=function(_0x37bc94){return request(_0xc685('0x18'),{'options':{'where':{'id':_0x37bc94},'attributes':[_0xc685('0x12')]}});};exports[_0xc685('0x19')]=function(_0x2576a9){return request(_0xc685('0x1a'),{'options':{'where':{'id':_0x2576a9},'attributes':[_0xc685('0x1b')]}});};exports[_0xc685('0x1c')]=function(_0x44e250){return request(_0xc685('0x1d'),{'options':{'where':{'id':_0x44e250},'attributes':[_0xc685('0x12')]}});};exports[_0xc685('0x1e')]=function(_0x217b3e){return request('ShowTrunk',{'options':{'where':{'id':_0x217b3e},'attributes':[_0xc685('0x12')]}});};exports[_0xc685('0x1f')]=function(_0x16cf46){return request(_0xc685('0x20'),{'options':{'where':{'id':_0x16cf46},'attributes':[_0xc685('0x21')]}});};exports[_0xc685('0x22')]=function(_0x2876e2){return request(_0xc685('0x23'),{'options':{'raw':![],'where':{'id':_0x2876e2},'include':[{'model':_0xc685('0x24'),'as':_0xc685('0x25')}]}});};exports[_0xc685('0x26')]=function(_0x2c8e18){return request('ShowSmsAccount',{'options':{'where':{'id':_0x2c8e18},'attributes':['id',_0xc685('0x12')]}});};exports[_0xc685('0x27')]=function(_0x331ce4){return request('CreateSmsMessage',{'body':_0x331ce4});};exports[_0xc685('0x28')]=function(_0x5079f1){return request(_0xc685('0x29'),{'body':_0x5079f1});};exports['createSquareReport']=function(_0x4264e7){return request(_0xc685('0x2a'),{'body':_[_0xc685('0x2b')](_0x4264e7,{'project_name':_0x4264e7[_0xc685('0x2c')],'prev_project_name':_0x4264e7['arg_2']||'','is_subproject':_0x4264e7[_0xc685('0x2d')]?!![]:![],'leaveAt':moment()[_0xc685('0x2e')](_0xc685('0x2f'))})});};exports[_0xc685('0x30')]=function(_0x475fe3){return request(_0xc685('0x31'),{'body':_0x475fe3});};exports[_0xc685('0x32')]=function(_0x56d006){return request(_0xc685('0x33'),{'body':_0x56d006});};exports[_0xc685('0x34')]=function(_0x1f01b0){return request(_0xc685('0x35'),{'options':{'raw':![],'where':{'phone':_0x1f01b0[_0xc685('0x36')],'ListId':_0x1f01b0[_0xc685('0x37')]}}})['then'](function(_0x3b8ba6){if(_0x3b8ba6){return _0x3b8ba6;}return request(_0xc685('0x38'),{'body':_0x1f01b0});});};exports[_0xc685('0x39')]=function(_0x16d22f){return request(_0xc685('0x3a'),{'options':{'where':{'id':_0x16d22f},'attributes':[_0xc685('0x12')]}});};exports[_0xc685('0x3b')]=function(_0x1e1a01,_0x1b2032){return request('LoginUser',{'body':{'interface':_0x1b2032},'options':{'where':_0x1e1a01}});};exports[_0xc685('0x3c')]=function(_0x20e510,_0x802c97,_0x285ea9){return request(_0xc685('0x3d'),{'body':{'type':_0x802c97,'uniqueid':_0x285ea9},'options':{'where':_0x20e510}});};exports['agentUnpause']=function(_0x1f0e83){return request(_0xc685('0x3e'),{'body':{},'options':{'where':_0x1f0e83}});};exports[_0xc685('0x3f')]=function(_0x11dcd1){return request(_0xc685('0x40'),{'body':{},'options':{'where':_0x11dcd1}});}; \ No newline at end of file +var _0x0ad7=['createCmContact','ShowCmHopper','phone','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','moment','util','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','CreateSquareReport','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x0ad7,0x101));var _0x70ad=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0ad7[_0xfae23b];return _0x200640;};'use strict';var BPromise=require('bluebird');var moment=require(_0x70ad('0x0'));var _=require('lodash');var util=require(_0x70ad('0x1'));var jayson=require(_0x70ad('0x2'));var client=jayson[_0x70ad('0x3')][_0x70ad('0x4')]({'port':0x2329});function request(_0x5f60d8,_0x2ce5a7){return new BPromise(function(_0x5ba024,_0x27ac10){return client[_0x70ad('0x5')](_0x5f60d8,_0x2ce5a7)[_0x70ad('0x6')](function(_0x18a30c){if(_0x18a30c[_0x70ad('0x7')]){return _0x27ac10(_0x18a30c[_0x70ad('0x7')][_0x70ad('0x8')]);}else{return _0x5ba024(_0x18a30c[_0x70ad('0x9')]);}})[_0x70ad('0xa')](function(_0x26b6fe){return _0x27ac10(_0x26b6fe);});});}exports[_0x70ad('0xb')]=function(_0x5bf061){return request(_0x70ad('0xc'),{'options':{'raw':![],'where':{'name':_0x5bf061},'attributes':[_0x70ad('0xd')]}});};exports[_0x70ad('0xe')]=function(_0x19b75f){return request(_0x70ad('0xf'),{'options':{'raw':![],'where':{'id':_0x19b75f},'include':[{'model':_0x70ad('0x10'),'as':_0x70ad('0x11')}],'attributes':['id',_0x70ad('0x12'),_0x70ad('0x13')]}});};exports[_0x70ad('0x14')]=function(_0x2e67ff){return request(_0x70ad('0xc'),{'options':{'where':{'id':_0x2e67ff},'attributes':['name']}});};exports[_0x70ad('0x15')]=function(_0xee896f){return request('ShowVoiceQueue',{'options':{'where':{'id':_0xee896f},'attributes':[_0x70ad('0x12')]}});};exports['getVariableById']=function(_0x1a2b48){return request('ShowVariable',{'options':{'where':{'id':_0x1a2b48},'attributes':['name']}});};exports[_0x70ad('0x16')]=function(_0x4f01bd){return request(_0x70ad('0x17'),{'options':{'where':{'id':_0x4f01bd},'attributes':[_0x70ad('0x18')]}});};exports[_0x70ad('0x19')]=function(_0x132661){return request(_0x70ad('0x1a'),{'options':{'where':{'id':_0x132661},'attributes':[_0x70ad('0x12')]}});};exports[_0x70ad('0x1b')]=function(_0x5a4671){return request(_0x70ad('0x1c'),{'options':{'where':{'id':_0x5a4671},'attributes':['name']}});};exports[_0x70ad('0x1d')]=function(_0x568e53){return request(_0x70ad('0x1e'),{'options':{'where':{'id':_0x568e53},'attributes':[_0x70ad('0x1f')]}});};exports[_0x70ad('0x20')]=function(_0x31d346){return request(_0x70ad('0x21'),{'options':{'raw':![],'where':{'id':_0x31d346},'include':[{'model':_0x70ad('0x22'),'as':_0x70ad('0x23')}]}});};exports[_0x70ad('0x24')]=function(_0x57918a){return request(_0x70ad('0x25'),{'options':{'where':{'id':_0x57918a},'attributes':['id',_0x70ad('0x12')]}});};exports[_0x70ad('0x26')]=function(_0xce407e){return request(_0x70ad('0x27'),{'body':_0xce407e});};exports['createSquareDetailsReport']=function(_0x2e3edc){return request(_0x70ad('0x28'),{'body':_0x2e3edc});};exports['createSquareReport']=function(_0xbf5026){return request(_0x70ad('0x29'),{'body':_['merge'](_0xbf5026,{'project_name':_0xbf5026[_0x70ad('0x2a')],'prev_project_name':_0xbf5026[_0x70ad('0x2b')]||'','is_subproject':_0xbf5026['arg_2']?!![]:![],'leaveAt':moment()['format'](_0x70ad('0x2c'))})});};exports['createSquareRecording']=function(_0x2f37dd){return request(_0x70ad('0x2d'),{'body':_0x2f37dd});};exports[_0x70ad('0x2e')]=function(_0x3fed71){return request(_0x70ad('0x2f'),{'body':_0x3fed71});};exports[_0x70ad('0x30')]=function(_0x6ec2b9){return request(_0x70ad('0x31'),{'options':{'raw':![],'where':{'phone':_0x6ec2b9[_0x70ad('0x32')],'ListId':_0x6ec2b9['ListId']}}})['then'](function(_0x3dbbdf){if(_0x3dbbdf){return _0x3dbbdf;}return request(_0x70ad('0x33'),{'body':_0x6ec2b9});});};exports[_0x70ad('0x34')]=function(_0x174e23){return request(_0x70ad('0x35'),{'options':{'where':{'id':_0x174e23},'attributes':[_0x70ad('0x12')]}});};exports[_0x70ad('0x36')]=function(_0x3edf18,_0x1c5779){return request(_0x70ad('0x37'),{'body':{'interface':_0x1c5779},'options':{'where':_0x3edf18}});};exports[_0x70ad('0x38')]=function(_0x39932c,_0x29ac1f,_0x54d6e2){return request(_0x70ad('0x39'),{'body':{'type':_0x29ac1f,'uniqueid':_0x54d6e2},'options':{'where':_0x39932c}});};exports[_0x70ad('0x3a')]=function(_0x59c612){return request(_0x70ad('0x3b'),{'body':{},'options':{'where':_0x59c612}});};exports['agentLogout']=function(_0x308831){return request(_0x70ad('0x3c'),{'body':{},'options':{'where':_0x308831}});}; \ 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 e0e881e..e579e64 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 _0xbe3b=['./lex','exports'];(function(_0x357fca,_0x26e179){var _0x58897e=function(_0x2e2a0f){while(--_0x2e2a0f){_0x357fca['push'](_0x357fca['shift']());}};_0x58897e(++_0x26e179);}(_0xbe3b,0x19c));var _0xbbe3=function(_0x25a136,_0x57320e){_0x25a136=_0x25a136-0x0;var _0x5b7159=_0xbe3b[_0x25a136];return _0x5b7159;};var polly=require('./polly');var lex=require(_0xbbe3('0x0'));module[_0xbbe3('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xbd18=['./polly','./lex','exports'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xbd18,0x195));var _0x8bd1=function(_0x113b89,_0x45132f){_0x113b89=_0x113b89-0x0;var _0x468e5d=_0xbd18[_0x113b89];return _0x468e5d;};var polly=require(_0x8bd1('0x0'));var lex=require(_0x8bd1('0x1'));module[_0x8bd1('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 0479c96..739bba3 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 _0x878f=['exports'];(function(_0x5ba879,_0x35afe8){var _0x471c60=function(_0x57984e){while(--_0x57984e){_0x5ba879['push'](_0x5ba879['shift']());}};_0x471c60(++_0x35afe8);}(_0x878f,0x173));var _0xf878=function(_0x2fe369,_0x4c9abb){_0x2fe369=_0x2fe369-0x0;var _0x175185=_0x878f[_0x2fe369];return _0x175185;};'use strict';var lex=require('./lib/api');module[_0xf878('0x0')]=function(_0x658976,_0x2e1d23,_0x12df2b,_0x1b3d0b,_0x3d74cf,_0x9e6783){return lex(_0x658976,_0x2e1d23,_0x12df2b,_0x1b3d0b,_0x3d74cf,_0x9e6783);}; \ No newline at end of file +var _0xb688=['exports'];(function(_0x456973,_0x366bc5){var _0x5d47c9=function(_0x218994){while(--_0x218994){_0x456973['push'](_0x456973['shift']());}};_0x5d47c9(++_0x366bc5);}(_0xb688,0xcf));var _0x8b68=function(_0x2b57d7,_0x5d2f86){_0x2b57d7=_0x2b57d7-0x0;var _0x347134=_0xb688[_0x2b57d7];return _0x347134;};'use strict';var lex=require('./lib/api');module[_0x8b68('0x0')]=function(_0x196cec,_0x266285,_0x1080e8,_0x23bbaa,_0x446b17,_0x4e281c){return lex(_0x196cec,_0x266285,_0x1080e8,_0x23bbaa,_0x446b17,_0x4e281c);}; \ 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 7125e9c..ffe5451 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(_0x23dad9,_0x1046f2){var _0x9d0a74=function(_0xc7b388){while(--_0xc7b388){_0x23dad9['push'](_0x23dad9['shift']());}};_0x9d0a74(++_0x1046f2);}(_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 +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0xc6b8cb,_0xfc920){var _0x5defbe=function(_0x141a79){while(--_0x141a79){_0xc6b8cb['push'](_0xc6b8cb['shift']());}};_0x5defbe(++_0xfc920);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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 92210b9..5192d39 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 _0xec2d=['exports','./lib/api'];(function(_0x58e9b6,_0x4aa6cd){var _0x308a2b=function(_0x17a3db){while(--_0x17a3db){_0x58e9b6['push'](_0x58e9b6['shift']());}};_0x308a2b(++_0x4aa6cd);}(_0xec2d,0x175));var _0xdec2=function(_0x15dafa,_0x3bd9b2){_0x15dafa=_0x15dafa-0x0;var _0x390812=_0xec2d[_0x15dafa];return _0x390812;};'use strict';var polly=require(_0xdec2('0x0'));module[_0xdec2('0x1')]=function(_0x218add,_0x15c5f7,_0x22c8b5,_0xb7da77,_0x1c5942,_0x313e44,_0x3eb035){return polly(_0x218add,_0x15c5f7,_0x22c8b5,_0xb7da77,_0x1c5942,_0x313e44,_0x3eb035);}; \ No newline at end of file +var _0x3462=['./lib/api','exports'];(function(_0x48fd1a,_0xd7764c){var _0x561d03=function(_0x13d57a){while(--_0x13d57a){_0x48fd1a['push'](_0x48fd1a['shift']());}};_0x561d03(++_0xd7764c);}(_0x3462,0x16c));var _0x2346=function(_0x30c41d,_0x1fe426){_0x30c41d=_0x30c41d-0x0;var _0x46f6a6=_0x3462[_0x30c41d];return _0x46f6a6;};'use strict';var polly=require(_0x2346('0x0'));module[_0x2346('0x1')]=function(_0x26b044,_0x21d0aa,_0x4a439b,_0x23cc7e,_0x3a9b55,_0x5f1769,_0x46e0d1){return polly(_0x26b044,_0x21d0aa,_0x4a439b,_0x23cc7e,_0x3a9b55,_0x5f1769,_0x46e0d1);}; \ 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 77dffb8..5a7e372 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 _0x8f9d=['exports','Polly','text','mp3','path','bluebird','randomstring','synthesizeSpeech','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x18553e,_0x2c1c2b){var _0x5e7d1e=function(_0x307d47){while(--_0x307d47){_0x18553e['push'](_0x18553e['shift']());}};_0x5e7d1e(++_0x2c1c2b);}(_0x8f9d,0xea));var _0xd8f9=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8f9d[_0x40a045];return _0x1a687c;};'use strict';var fs=require('fs');var path=require(_0xd8f9('0x0'));var BPromise=require(_0xd8f9('0x1'));var rs=require(_0xd8f9('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x4ef7ea,_0x3580f0,_0x18ce41){return new BPromise(function(_0x1d170d,_0x3f94a9){_0x4ef7ea[_0xd8f9('0x3')](_0x3580f0,function(_0x29b5fa,_0x47301e){if(_0x29b5fa){_0x3f94a9(_0x29b5fa);}else if(_0x47301e){if(_0x47301e['AudioStream']instanceof Buffer){fs['writeFile'](_0x18ce41,_0x47301e[_0xd8f9('0x4')],function(_0x27f436){if(_0x27f436){_0x3f94a9(_0x27f436);}else{_0x1d170d();}});}else{_0x3f94a9(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x3f94a9(new Error(_0xd8f9('0x5')));}});});}module[_0xd8f9('0x6')]=function(_0x13290a,_0x3535a3,_0x20d1a3,_0xa7a5c0,_0x47fa3f,_0x4c4868,_0x251f20){var _0x1806cf=new AWS[(_0xd8f9('0x7'))]({'accessKeyId':_0x13290a,'secretAccessKey':_0x3535a3,'region':_0x20d1a3});var _0x4de203={'Text':_0x47fa3f,'TextType':_0x4c4868||_0xd8f9('0x8'),'OutputFormat':_0xd8f9('0x9'),'VoiceId':_0xa7a5c0};return pollyResult(_0x1806cf,_0x4de203,_0x251f20);}; \ No newline at end of file +var _0xa705=['Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x12d496,_0x2bd7d6){var _0x5acaef=function(_0x2cc874){while(--_0x2cc874){_0x12d496['push'](_0x12d496['shift']());}};_0x5acaef(++_0x2bd7d6);}(_0xa705,0xd5));var _0x5a70=function(_0x153540,_0x46dc44){_0x153540=_0x153540-0x0;var _0x555555=_0xa705[_0x153540];return _0x555555;};'use strict';var fs=require('fs');var path=require(_0x5a70('0x0'));var BPromise=require(_0x5a70('0x1'));var rs=require(_0x5a70('0x2'));var AWS=require(_0x5a70('0x3'));function pollyResult(_0x4a1cb7,_0x25a803,_0x4407e5){return new BPromise(function(_0x1b2d10,_0x1e8957){_0x4a1cb7[_0x5a70('0x4')](_0x25a803,function(_0x32106e,_0xfc22ff){if(_0x32106e){_0x1e8957(_0x32106e);}else if(_0xfc22ff){if(_0xfc22ff[_0x5a70('0x5')]instanceof Buffer){fs['writeFile'](_0x4407e5,_0xfc22ff[_0x5a70('0x5')],function(_0x3059c9){if(_0x3059c9){_0x1e8957(_0x3059c9);}else{_0x1b2d10();}});}else{_0x1e8957(new Error(_0x5a70('0x6')));}}else{_0x1e8957(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x39b56a,_0x7aaa0e,_0x362136,_0x11e647,_0x3df148,_0x36cd04,_0x45dc0a){var _0x2a1cc4=new AWS[(_0x5a70('0x7'))]({'accessKeyId':_0x39b56a,'secretAccessKey':_0x7aaa0e,'region':_0x362136});var _0x3755e8={'Text':_0x3df148,'TextType':_0x36cd04||_0x5a70('0x8'),'OutputFormat':_0x5a70('0x9'),'VoiceId':_0x11e647};return pollyResult(_0x2a1cc4,_0x3755e8,_0x45dc0a);}; \ 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 5d520cd..ae24e95 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 _0xf77e=['exports','./lib/api'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xf77e,0x189));var _0xef77=function(_0x1e9c8b,_0x3fd2d6){_0x1e9c8b=_0x1e9c8b-0x0;var _0x1c2a1e=_0xf77e[_0x1e9c8b];return _0x1c2a1e;};'use strict';var asr=require(_0xef77('0x0'));module[_0xef77('0x1')]=function(_0x2cfc00,_0x3040c0,_0x7c2dfc,_0x170c42){return asr(_0x2cfc00,_0x3040c0,_0x7c2dfc);}; \ No newline at end of file +var _0x279c=['./lib/api','exports'];(function(_0x38f189,_0x9def62){var _0x165df9=function(_0x5ee204){while(--_0x5ee204){_0x38f189['push'](_0x38f189['shift']());}};_0x165df9(++_0x9def62);}(_0x279c,0x100));var _0xc279=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x279c[_0x166d93];return _0xba708;};'use strict';var asr=require(_0xc279('0x0'));module[_0xc279('0x1')]=function(_0x18808e,_0x47b930,_0x4d72f7,_0x11a9d3){return asr(_0x18808e,_0x47b930,_0x4d72f7);}; \ 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 c8c660c..7133470 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 _0x34b2=['POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','base64'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x34b2,0x11c));var _0x234b=function(_0x70c97a,_0xd4d263){_0x70c97a=_0x70c97a-0x0;var _0x5cb362=_0x34b2[_0x70c97a];return _0x5cb362;};'use strict';var url=require(_0x234b('0x0'));var BPromise=require(_0x234b('0x1'));var fs=require('fs');var host=_0x234b('0x2');module[_0x234b('0x3')]=function(_0x373af7,_0x15fe02,_0x1f63a5){return new BPromise(function(_0x224eb0,_0x43cd81){var _0x55819c;if(typeof _0x373af7!==_0x234b('0x4')||_0x373af7[_0x234b('0x5')]===0x0){return _0x43cd81(_0x234b('0x6'));}if(typeof _0x15fe02!=='string'||_0x15fe02['length']===0x0){return _0x43cd81('key\x20should\x20be\x20a\x20string');}if(typeof _0x1f63a5!==_0x234b('0x7')&&(typeof _0x1f63a5!==_0x234b('0x4')||_0x1f63a5[_0x234b('0x5')]===0x0)){return _0x43cd81(_0x234b('0x8'));}try{_0x55819c=fs['readFileSync'](_0x373af7)['toString'](_0x234b('0x9'));}catch(_0x3a900b){return _0x43cd81(_0x3a900b);}return _0x224eb0({'method':_0x234b('0xa'),'uri':host+_0x234b('0xb')+_0x15fe02,'body':{'config':{'encoding':_0x234b('0xc'),'sampleRateHertz':_0x234b('0xd'),'languageCode':_0x1f63a5},'audio':{'content':_0x55819c}},'json':!![]});});}; \ No newline at end of file +var _0x8f37=['base64','POST','/v1/speech:recognize?key=','8000','url','bluebird','https://speech.googleapis.com','length','string','undefined','lang\x20should\x20be\x20a\x20string','toString'];(function(_0x59079e,_0x8a7ae5){var _0x12decf=function(_0x4dce90){while(--_0x4dce90){_0x59079e['push'](_0x59079e['shift']());}};_0x12decf(++_0x8a7ae5);}(_0x8f37,0x190));var _0x78f3=function(_0x31a0c0,_0x48407a){_0x31a0c0=_0x31a0c0-0x0;var _0x3d6a7e=_0x8f37[_0x31a0c0];return _0x3d6a7e;};'use strict';var url=require(_0x78f3('0x0'));var BPromise=require(_0x78f3('0x1'));var fs=require('fs');var host=_0x78f3('0x2');module['exports']=function(_0x542bc0,_0x2a7d93,_0x3c1fa6){return new BPromise(function(_0x3b0667,_0x539794){var _0x1d59a5;if(typeof _0x542bc0!=='string'||_0x542bc0[_0x78f3('0x3')]===0x0){return _0x539794('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x2a7d93!==_0x78f3('0x4')||_0x2a7d93[_0x78f3('0x3')]===0x0){return _0x539794('key\x20should\x20be\x20a\x20string');}if(typeof _0x3c1fa6!==_0x78f3('0x5')&&(typeof _0x3c1fa6!=='string'||_0x3c1fa6[_0x78f3('0x3')]===0x0)){return _0x539794(_0x78f3('0x6'));}try{_0x1d59a5=fs['readFileSync'](_0x542bc0)[_0x78f3('0x7')](_0x78f3('0x8'));}catch(_0x268525){return _0x539794(_0x268525);}return _0x3b0667({'method':_0x78f3('0x9'),'uri':host+_0x78f3('0xa')+_0x2a7d93,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x78f3('0xb'),'languageCode':_0x3c1fa6},'audio':{'content':_0x1d59a5}},'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 72d0040..a8bedaa 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 _0x16f1=['./asr'];(function(_0x5545c1,_0x51ea94){var _0x37b6f9=function(_0x44e2de){while(--_0x44e2de){_0x5545c1['push'](_0x5545c1['shift']());}};_0x37b6f9(++_0x51ea94);}(_0x16f1,0x1ac));var _0x116f=function(_0x527978,_0x846d1b){_0x527978=_0x527978-0x0;var _0x31285a=_0x16f1[_0x527978];return _0x31285a;};var asr=require(_0x116f('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x1e31=['exports','./asr'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1e31,0xe9));var _0x11e3=function(_0x543f28,_0x216cab){_0x543f28=_0x543f28-0x0;var _0x951f97=_0x1e31[_0x543f28];return _0x951f97;};var asr=require(_0x11e3('0x0'));module[_0x11e3('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 4941d61..ac751bc 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 _0x8494=['parse\x20response\x20failed:\x0a','.wav','goggleTTS\x20path','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','textRequest','source','result','resolvedQuery','actionIncomplete','speech','score','status','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','sessionPath','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','intent','displayName','languageCode','queryText','fulfillmentText','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','model=%s','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','querystring','request-promise','sox','google-tts-api','url','parse','util','./aws','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','get','statusCode','error','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','finish\x20download\x20file','end','transcode','wav','error\x20convert','info','finish\x20to\x20convert','start','resolve','writeFileSync','base64','unlink','chmodSync','777','split','readFileSync','toString','googleCloudTTS','ssml','input','voice','audioConfig','text:synthesize','then','tmp','.mp3','audioContent','generate','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','data','length','text\x20length\x20limit\x20reached','lang\x20\x22'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0x8494,0x1d2));var _0x4849=function(_0x4abc45,_0x268519){_0x4abc45=_0x4abc45-0x0;var _0x52d718=_0x8494[_0x4abc45];return _0x52d718;};'use strict';var apiai=require(_0x4849('0x0'));var BPromise=require(_0x4849('0x1'));var dialogflow=require(_0x4849('0x2'));var fs=require('fs');var http=require(_0x4849('0x3'));var https=require(_0x4849('0x4'));var md5=require(_0x4849('0x5'));var path=require('path');var querystring=require(_0x4849('0x6'));var rp=require(_0x4849('0x7'));var rs=require('randomstring');var sox=require(_0x4849('0x8'));var tts=require(_0x4849('0x9'));var urlParse=require(_0x4849('0xa'))[_0x4849('0xb')];var util=require(_0x4849('0xc'));var aws=require(_0x4849('0xd'));var google=require('./google');var sestek=require(_0x4849('0xe'));var tilde=require('./tilde');var logger=require(_0x4849('0xf'))(_0x4849('0x10'));var ISPEECH_API=_0x4849('0x11');function downloadFile(_0xb45908,_0x4418bb){return new BPromise(function(_0x9c386e,_0x305916){var _0x1d71f8=urlParse(_0xb45908);var _0x38d47f=_0x1d71f8[_0x4849('0x12')]===_0x4849('0x13')?https:http;var _0x283bba={'host':_0x1d71f8[_0x4849('0x14')],'path':_0x1d71f8[_0x4849('0x15')],'headers':{'user-agent':_0x4849('0x16')}};_0x38d47f[_0x4849('0x17')](_0x283bba,function(_0x3f053c){if(_0x3f053c[_0x4849('0x18')]!==0xc8){logger[_0x4849('0x19')](_0x4849('0x1a')+_0xb45908+'\x20failed,\x20status\x20code\x20=\x20'+_0x3f053c[_0x4849('0x18')]+'\x20('+_0x3f053c[_0x4849('0x1b')]+')');_0x305916(new Error('request\x20to\x20'+_0xb45908+_0x4849('0x1c')+_0x3f053c[_0x4849('0x18')]+'\x20('+_0x3f053c[_0x4849('0x1b')]+')'));return;}var _0x14af68=fs[_0x4849('0x1d')](_0x4418bb);_0x14af68['on'](_0x4849('0x1e'),function(){logger['info'](_0x4849('0x1f'));_0x14af68['close'](_0x9c386e);});_0x14af68['on']('error',function(_0x5238d4){fs['unlink'](_0x4418bb);logger['error']('download\x20error',_0x5238d4);_0x305916(_0x5238d4);});_0x3f053c['pipe'](_0x14af68);})['on'](_0x4849('0x19'),function(_0x3655f5){logger['error'](_0x3655f5);_0x305916(_0x3655f5);})[_0x4849('0x20')]();});}function uploadFile(_0x4ef447){return new BPromise(function(_0x5b9756,_0x642f0e){var _0xac039c=urlParse(_0x4ef447);var _0x3c5b28=_0xac039c['protocol']===_0x4849('0x13')?https:http;var _0x5b0d03={'host':_0xac039c[_0x4849('0x14')],'path':_0xac039c['path'],'headers':{'user-agent':_0x4849('0x16')}};_0x3c5b28[_0x4849('0x17')](_0x5b0d03,function(_0x322d66){if(_0x322d66['statusCode']!==0xc8){_0x642f0e(new Error(_0x4849('0x1a')+_0x4ef447+_0x4849('0x1c')+_0x322d66[_0x4849('0x18')]+'\x20('+_0x322d66[_0x4849('0x1b')]+')'));return;}var _0x3e041a='';_0x322d66['on']('data',function(_0x16646a){_0x3e041a+=_0x16646a;});_0x322d66['on'](_0x4849('0x20'),function(){_0x5b9756(_0x3e041a);});})['on'](_0x4849('0x19'),function(_0x1bc7d8){_0x642f0e(_0x1bc7d8);})[_0x4849('0x20')]();});}function convertFile(_0x41279f,_0x24e74a){return new BPromise(function(_0x41d863,_0x366645){var _0x18427e=sox[_0x4849('0x21')](_0x41279f,_0x24e74a,{'sampleRate':0x1f40,'format':_0x4849('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x18427e['on'](_0x4849('0x19'),function(_0x4728b3){logger[_0x4849('0x19')](_0x4849('0x23'),_0x4728b3);_0x366645(_0x4728b3);});_0x18427e['on'](_0x4849('0x20'),function(){logger[_0x4849('0x24')](_0x4849('0x25'));_0x41d863();});_0x18427e[_0x4849('0x26')]();});}function base64Decode(_0x420d6e,_0x1fb73a){var _0x482fc8=path[_0x4849('0x27')](__dirname,'tmp',rs['generate'](0x4)+'.wav');fs[_0x4849('0x28')](_0x482fc8,_0x420d6e,_0x4849('0x29'));return convertFile(_0x482fc8,_0x1fb73a)['then'](function(){try{fs[_0x4849('0x2a')](_0x482fc8);fs[_0x4849('0x2b')](_0x1fb73a,_0x4849('0x2c'));}catch(_0x3f7caa){logger[_0x4849('0x19')](_0x3f7caa);}return _0x1fb73a[_0x4849('0x2d')]('.')[0x0];});}function base64Encode(_0x4deea9){var _0x5ecc2b=fs[_0x4849('0x2e')](_0x4deea9);return new Buffer(_0x5ecc2b)[_0x4849('0x2f')]('base64');}exports[_0x4849('0x30')]=function(_0x4e4333,_0x414bb8,_0x4142cb,_0x5c4b73,_0xb013e5,_0x51b57f){var _0x28c46f,_0x5ec4e6;var _0x45e15f='https://texttospeech.googleapis.com/v1/';var _0x135d65='?key='+_0x4e4333;var _0x3d2f1f={};if(_0x414bb8===_0x4849('0x31')){_0x3d2f1f[_0x4849('0x32')]={'ssml':_0x4142cb};}else{_0x3d2f1f[_0x4849('0x32')]={'text':_0x4142cb};};_0x3d2f1f[_0x4849('0x33')]={'languageCode':_0x5c4b73,'ssmlGender':_0xb013e5};_0x3d2f1f[_0x4849('0x34')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0xae82f6={'url':_0x45e15f+_0x4849('0x35')+_0x135d65,'method':'POST','json':!![],'body':_0x3d2f1f};return rp(_0xae82f6)[_0x4849('0x36')](function(_0x34aac1){return new BPromise(function(_0x49428e,_0x9a93ba){_0x28c46f=path[_0x4849('0x27')](__dirname,_0x4849('0x37'),rs['generate'](0x4)+_0x4849('0x38'));var _0x23ed3f=Buffer['from'](_0x34aac1[_0x4849('0x39')],_0x4849('0x29'));return fs['writeFile'](_0x28c46f,_0x23ed3f,function(_0x500515){_0x9a93ba(_0x500515);},function(_0x563cc2){fs[_0x4849('0x2b')](_0x28c46f,_0x4849('0x2c'));_0x49428e(_0x563cc2);});});})[_0x4849('0x36')](function(_0x4c065f){_0x5ec4e6=path[_0x4849('0x27')](__dirname,'tmp',rs[_0x4849('0x3a')](0x4)+'.wav');return convertFile(_0x28c46f,_0x5ec4e6);})[_0x4849('0x36')](function(){try{fs[_0x4849('0x2a')](_0x28c46f);fs['chmodSync'](_0x5ec4e6,_0x4849('0x2c'));}catch(_0x386ba9){logger[_0x4849('0x19')](_0x386ba9);}logger['info'](_0x4849('0x3b'),_0x5ec4e6[_0x4849('0x2d')]('.')[0x0]);return _0x5ec4e6[_0x4849('0x2d')]('.')[0x0];});};exports[_0x4849('0x3c')]=function(_0x1ddf0b,_0x29f2d0){var _0x41af27=_0x4849('0x3d');var _0x29f51a,_0x5b7b67;var _0x8891e5;var _0x2a9134={'encoding':_0x4849('0x3e'),'method':_0x4849('0x3f'),'timeout':0x2710,'url':_0x41af27,'headers':{'Content-Type':_0x4849('0x40')},'body':_0x4849('0x41')+encodeURIComponent(JSON[_0x4849('0x42')]([[[_0x4849('0x43'),JSON[_0x4849('0x42')]([_0x1ddf0b,_0x29f2d0||'en',![],_0x4849('0x44')]),null,_0x4849('0x45')]]]))};return rp(_0x2a9134)[_0x4849('0x36')](function(_0x42edae){try{_0x8891e5=eval(_0x42edae['slice'](0x5))[0x0][0x2];}catch(_0x5f3e72){throw new Error('parse\x20response\x20failed:\x0a'+_0x42edae[_0x4849('0x46')]);}if(!_0x8891e5){if(_0x1ddf0b[_0x4849('0x47')]>0xc8){throw new Error(_0x4849('0x48'));}else{throw new Error(_0x4849('0x49')+_0x29f2d0+'\x22\x20might\x20not\x20exist');}}try{_0x8891e5=eval(_0x8891e5)[0x0];}catch(_0x278456){throw new Error(_0x4849('0x4a')+res['data']);}const _0x22fa21=_0x8891e5;_0x29f51a=path[_0x4849('0x27')](__dirname,_0x4849('0x37'),rs[_0x4849('0x3a')](0x4)+_0x4849('0x38'));fs[_0x4849('0x28')](_0x29f51a,_0x8891e5,{'encoding':_0x4849('0x29')});_0x5b7b67=path[_0x4849('0x27')](__dirname,_0x4849('0x37'),rs[_0x4849('0x3a')](0x4)+_0x4849('0x4b'));return convertFile(_0x29f51a,_0x5b7b67);})[_0x4849('0x36')](function(){try{fs[_0x4849('0x2a')](_0x29f51a);fs[_0x4849('0x2b')](_0x5b7b67,_0x4849('0x2c'));}catch(_0x38db97){logger[_0x4849('0x19')](_0x38db97);}logger[_0x4849('0x24')](_0x4849('0x4c'),_0x5b7b67[_0x4849('0x2d')]('.')[0x0]);return _0x5b7b67[_0x4849('0x2d')]('.')[0x0];});};exports[_0x4849('0x4d')]=function(_0x527a16,_0x3ea1e3,_0x116443){return google['asr'](_0x527a16,_0x3ea1e3,_0x116443)['then'](function(_0xcc7119){logger[_0x4849('0x24')](_0xcc7119[_0x4849('0x4e')]);return rp(_0xcc7119);})['then'](function(_0x12e3be){var _0x200b74='';var _0x1b6b03=0x0;try{fs[_0x4849('0x2a')](_0x527a16);}catch(_0x4a5bcb){logger[_0x4849('0x19')](_0x4a5bcb);}if(_0x12e3be&&_0x12e3be[_0x4849('0x4f')]){_0x200b74=_0x12e3be[_0x4849('0x4f')][_0x4849('0x50')](function(_0x83e2d1){return _0x83e2d1&&_0x83e2d1[_0x4849('0x51')][0x0]&&_0x83e2d1[_0x4849('0x51')][0x0][_0x4849('0x52')]?_0x83e2d1[_0x4849('0x51')][0x0]['transcript']:'';})[_0x4849('0x53')]('\x0a');_0x1b6b03=_0x12e3be[_0x4849('0x4f')][_0x4849('0x50')](function(_0x4a5894){return _0x4a5894&&_0x4a5894['alternatives'][0x0]&&_0x4a5894['alternatives'][0x0][_0x4849('0x54')]?_0x4a5894[_0x4849('0x51')][0x0][_0x4849('0x54')]:0x0;})[_0x4849('0x53')]('\x0a');}logger[_0x4849('0x24')](_0x4849('0x55'),_0x200b74);logger[_0x4849('0x24')]('googleASR\x20confidence',_0x1b6b03);return{'transcript':_0x200b74,'confidence':_0x1b6b03};})[_0x4849('0x56')](function(_0x54553f){logger[_0x4849('0x19')](_0x4849('0x57'),_0x54553f[_0x4849('0x18')],_0x54553f[_0x4849('0x58')],_0x54553f[_0x4849('0x59')]);});};exports['googleDialogflow']=function(_0x5048df,_0x23c7a3,_0x434aba,_0x3290b8){var _0x1b3b26=apiai(_0x23c7a3,{'language':_0x3290b8||'en'});return _0x1b3b26[_0x4849('0x5a')](_0x434aba,{'sessionId':md5(_0x5048df)})[_0x4849('0x36')](function(_0xf512cf){logger[_0x4849('0x24')](JSON[_0x4849('0x42')](_0xf512cf));return{'source':_0xf512cf['result'][_0x4849('0x5b')],'resolvedQuery':_0xf512cf[_0x4849('0x5c')][_0x4849('0x5d')],'action':_0xf512cf['result']['action'],'actionIncomplete':_0xf512cf[_0x4849('0x5c')][_0x4849('0x5e')],'speech':_0xf512cf[_0x4849('0x5c')]['fulfillment'][_0x4849('0x5f')],'score':_0xf512cf[_0x4849('0x5c')][_0x4849('0x60')],'statusCode':_0xf512cf[_0x4849('0x61')][_0x4849('0x62')],'endConversation':_0xf512cf['result']['metadata'][_0x4849('0x63')]||![],'isFallbackIntent':_0xf512cf[_0x4849('0x5c')][_0x4849('0x64')][_0x4849('0x65')]};});};exports[_0x4849('0x66')]=function(_0x17f861,_0x2a8d3d,_0x535324,_0x2b7fb2,_0x5c74a6,_0x10d6c7){var _0x17cd15=_0x2b7fb2[_0x4849('0x67')](/\\n/g,'\x0a');var _0x57ad44={'credentials':{'private_key':_0x17cd15,'client_email':_0x535324}};var _0x3d13b1=new dialogflow['SessionsClient'](_0x57ad44);var _0x919795=_0x3d13b1[_0x4849('0x68')](_0x2a8d3d,md5(_0x17f861));var _0x37946a={'session':_0x919795,'queryInput':{'text':{'text':_0x5c74a6,'languageCode':_0x10d6c7}}};return _0x3d13b1['detectIntent'](_0x37946a)['then'](function(_0x93238c){if(_0x93238c&&_0x93238c['length']){logger['info']('Dialogflow\x20V2\x20response:',JSON[_0x4849('0x42')](_0x93238c));var _0x27b811=_0x93238c[0x0];if(_0x27b811){var _0x441f02={'action':_0x27b811[_0x4849('0x69')][_0x4849('0x6a')],'allRequiredParamsPresent':_0x27b811['queryResult'][_0x4849('0x6b')],'endConversation':_0x27b811[_0x4849('0x69')][_0x4849('0x6c')]&&_0x27b811[_0x4849('0x69')][_0x4849('0x6c')][_0x4849('0x6d')]?_0x27b811[_0x4849('0x69')][_0x4849('0x6c')][_0x4849('0x6d')]['end_conversation'][_0x4849('0x6e')]:![],'fulfillmentText':_0x27b811[_0x4849('0x69')]['fulfillmentText'],'intentName':_0x27b811[_0x4849('0x69')][_0x4849('0x6f')][_0x4849('0x58')],'intentDisplayName':_0x27b811[_0x4849('0x69')][_0x4849('0x6f')][_0x4849('0x70')],'isFallbackIntent':_0x27b811[_0x4849('0x69')][_0x4849('0x6f')]['isFallback'],'languageCode':_0x27b811['queryResult'][_0x4849('0x71')],'queryText':_0x27b811[_0x4849('0x69')][_0x4849('0x72')],'responseId':_0x27b811['responseId'],'score':_0x27b811[_0x4849('0x69')]['intentDetectionConfidence'],'speech':_0x27b811[_0x4849('0x69')][_0x4849('0x73')],'providerResponse':JSON[_0x4849('0x42')](_0x93238c)};return _0x441f02;}}});};exports[_0x4849('0x74')]=function(_0x5f121b,_0x4fc34d,_0x2f49e4,_0x199e67){return tilde['asr'](_0x5f121b,_0x4fc34d,_0x2f49e4,_0x199e67)[_0x4849('0x36')](function(_0x6e8d8b){try{fs[_0x4849('0x2a')](_0x5f121b);}catch(_0x38ae3c){logger[_0x4849('0x19')](_0x38ae3c);}logger[_0x4849('0x24')]('Tilde\x20ASR\x20transcription',_0x6e8d8b[_0x4849('0x52')]);logger['info'](_0x4849('0x75'),_0x6e8d8b[_0x4849('0x54')]);return _0x6e8d8b;});};exports[_0x4849('0x76')]=function(_0x4ea9cd,_0x21e5e5,_0x236923,_0x397cdc,_0x302d01,_0xa47cc0){var _0x20907a=path[_0x4849('0x27')](__dirname,_0x4849('0x37'),rs['generate'](0x4)+_0x4849('0x38'));var _0x2f85a0;return aws[_0x4849('0x77')](_0x4ea9cd,_0x21e5e5,_0x236923,_0x397cdc,_0x302d01,_0xa47cc0,_0x20907a)['then'](function(){_0x2f85a0=path['resolve'](__dirname,'tmp',rs[_0x4849('0x3a')](0x4)+_0x4849('0x4b'));return convertFile(_0x20907a,_0x2f85a0);})[_0x4849('0x36')](function(){try{fs['unlink'](_0x20907a);fs['chmodSync'](_0x2f85a0,_0x4849('0x2c'));}catch(_0x260e8f){logger[_0x4849('0x19')](_0x260e8f);}return _0x2f85a0['split']('.')[0x0];});};exports[_0x4849('0x78')]=function(_0x3ed5a0,_0x38375a,_0x554b43,_0xb796a5,_0x9fb79c,_0x255c84){return aws[_0x4849('0x79')](_0x3ed5a0,_0x38375a,_0x554b43,_0xb796a5,_0x9fb79c,_0x255c84)[_0x4849('0x36')](function(_0x5e06fb){logger[_0x4849('0x24')](JSON['stringify'](_0x5e06fb));return _0x5e06fb;});};exports[_0x4849('0x7a')]=function(_0x4392ac,_0x35cf45,_0x5b12b1,_0x5c6901){var _0x1de4ae=util[_0x4849('0x7b')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x4392ac,encodeURIComponent(_0x35cf45),_0x5b12b1,_0x5c6901);var _0x4c8f1f=path['resolve'](__dirname,_0x4849('0x37'),rs[_0x4849('0x3a')](0x4)+_0x4849('0x38'));var _0x448a8c;return downloadFile(_0x1de4ae,_0x4c8f1f)['then'](function(){_0x448a8c=path[_0x4849('0x27')](__dirname,_0x4849('0x37'),rs[_0x4849('0x3a')](0x4)+'.wav');return convertFile(_0x4c8f1f,_0x448a8c);})[_0x4849('0x36')](function(){try{fs[_0x4849('0x2a')](_0x4c8f1f);fs[_0x4849('0x2b')](_0x448a8c,_0x4849('0x2c'));}catch(_0x5017a2){logger['error'](_0x5017a2);}return _0x448a8c[_0x4849('0x2d')]('.')[0x0];});};exports['ispeechASR']=function(_0xd8d3f9,_0x68b065,_0x1d2ab4,_0xdf2fa){var _0x5e99b6=util[_0x4849('0x7b')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x68b065,_0x1d2ab4,base64Encode(_0xd8d3f9),_0xdf2fa?util[_0x4849('0x7b')](_0x4849('0x7c'),encodeURIComponent(_0xdf2fa)):'freeform=3');return uploadFile(_0x5e99b6)[_0x4849('0x36')](function(_0x129fec){return querystring['parse'](_0x129fec);});};exports[_0x4849('0x7d')]=function(_0x106632,_0x3a08f2){return sestek[_0x4849('0x7e')](_0x106632,_0x3a08f2)[_0x4849('0x36')](function(_0xfdb07e){logger[_0x4849('0x24')](JSON[_0x4849('0x42')](_0xfdb07e));var _0x57538f={'speech':_0xfdb07e[_0x4849('0x7f')],'action':_0xfdb07e[_0x4849('0x80')]?_0xfdb07e[_0x4849('0x80')][_0x4849('0x81')]:undefined,'actiondata':_0xfdb07e[_0x4849('0x80')]?_0xfdb07e['channelData'][_0x4849('0x82')]:undefined};if(_0xfdb07e[_0x4849('0x80')]&&_0xfdb07e['channelData'][_0x4849('0x83')]){return base64Decode(_0xfdb07e[_0x4849('0x80')]['AudioFromTts'][_0x4849('0x84')],path['resolve'](__dirname,_0x4849('0x37'),rs[_0x4849('0x3a')](0x4)+_0x4849('0x4b')))['then'](function(_0x345103){_0x57538f[_0x4849('0x85')]=_0x345103;return _0x57538f;});}return _0x57538f;});};exports[_0x4849('0x86')]=function(){return __dirname;}; \ No newline at end of file +var _0xa535=['SessionsClient','sessionPath','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','tildeASR','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','http','md5','path','querystring','randomstring','sox','google-tts-api','url','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','close','download\x20error','pipe','end','protocol','https:','host','data','transcode','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','unlink','chmodSync','777','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','then','.mp3','from','audioContent','writeFile','utf8','application/x-www-form-urlencoded','f.req=','stringify','generic','parse\x20response\x20failed:\x0a','lang\x20\x22','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0xa535,0x13a));var _0x5a53=function(_0x118579,_0x569145){_0x118579=_0x118579-0x0;var _0x56cfa9=_0xa535[_0x118579];return _0x56cfa9;};'use strict';var apiai=require(_0x5a53('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x5a53('0x1'));var fs=require('fs');var http=require(_0x5a53('0x2'));var https=require('https');var md5=require(_0x5a53('0x3'));var path=require(_0x5a53('0x4'));var querystring=require(_0x5a53('0x5'));var rp=require('request-promise');var rs=require(_0x5a53('0x6'));var sox=require(_0x5a53('0x7'));var tts=require(_0x5a53('0x8'));var urlParse=require(_0x5a53('0x9'))['parse'];var util=require('util');var aws=require('./aws');var google=require('./google');var sestek=require('./sestek');var tilde=require(_0x5a53('0xa'));var logger=require(_0x5a53('0xb'))(_0x5a53('0xc'));var ISPEECH_API=_0x5a53('0xd');function downloadFile(_0x58980e,_0x3922b3){return new BPromise(function(_0xfad2f6,_0x355853){var _0x16b894=urlParse(_0x58980e);var _0x569142=_0x16b894['protocol']==='https:'?https:http;var _0x4ceb48={'host':_0x16b894['host'],'path':_0x16b894[_0x5a53('0x4')],'headers':{'user-agent':_0x5a53('0xe')}};_0x569142[_0x5a53('0xf')](_0x4ceb48,function(_0x257844){if(_0x257844[_0x5a53('0x10')]!==0xc8){logger[_0x5a53('0x11')](_0x5a53('0x12')+_0x58980e+_0x5a53('0x13')+_0x257844['statusCode']+'\x20('+_0x257844['statusMessage']+')');_0x355853(new Error('request\x20to\x20'+_0x58980e+_0x5a53('0x13')+_0x257844[_0x5a53('0x10')]+'\x20('+_0x257844[_0x5a53('0x14')]+')'));return;}var _0x5906db=fs['createWriteStream'](_0x3922b3);_0x5906db['on'](_0x5a53('0x15'),function(){logger[_0x5a53('0x16')](_0x5a53('0x17'));_0x5906db[_0x5a53('0x18')](_0xfad2f6);});_0x5906db['on']('error',function(_0x1bf4af){fs['unlink'](_0x3922b3);logger[_0x5a53('0x11')](_0x5a53('0x19'),_0x1bf4af);_0x355853(_0x1bf4af);});_0x257844[_0x5a53('0x1a')](_0x5906db);})['on'](_0x5a53('0x11'),function(_0x39f8a0){logger[_0x5a53('0x11')](_0x39f8a0);_0x355853(_0x39f8a0);})[_0x5a53('0x1b')]();});}function uploadFile(_0x125c23){return new BPromise(function(_0x1c794d,_0x292104){var _0x5133cd=urlParse(_0x125c23);var _0x159d6e=_0x5133cd[_0x5a53('0x1c')]===_0x5a53('0x1d')?https:http;var _0x4e667f={'host':_0x5133cd[_0x5a53('0x1e')],'path':_0x5133cd['path'],'headers':{'user-agent':_0x5a53('0xe')}};_0x159d6e[_0x5a53('0xf')](_0x4e667f,function(_0x38dfd1){if(_0x38dfd1[_0x5a53('0x10')]!==0xc8){_0x292104(new Error(_0x5a53('0x12')+_0x125c23+_0x5a53('0x13')+_0x38dfd1[_0x5a53('0x10')]+'\x20('+_0x38dfd1['statusMessage']+')'));return;}var _0x4ab349='';_0x38dfd1['on'](_0x5a53('0x1f'),function(_0x4f9922){_0x4ab349+=_0x4f9922;});_0x38dfd1['on']('end',function(){_0x1c794d(_0x4ab349);});})['on'](_0x5a53('0x11'),function(_0x49cb87){_0x292104(_0x49cb87);})[_0x5a53('0x1b')]();});}function convertFile(_0x2fef8f,_0x251ada){return new BPromise(function(_0x3c93a1,_0x274c22){var _0x2a316d=sox[_0x5a53('0x20')](_0x2fef8f,_0x251ada,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2a316d['on'](_0x5a53('0x11'),function(_0x5bd7df){logger[_0x5a53('0x11')]('error\x20convert',_0x5bd7df);_0x274c22(_0x5bd7df);});_0x2a316d['on'](_0x5a53('0x1b'),function(){logger[_0x5a53('0x16')](_0x5a53('0x21'));_0x3c93a1();});_0x2a316d[_0x5a53('0x22')]();});}function base64Decode(_0x24e5fc,_0x14131d){var _0x4175cf=path[_0x5a53('0x23')](__dirname,_0x5a53('0x24'),rs[_0x5a53('0x25')](0x4)+_0x5a53('0x26'));fs[_0x5a53('0x27')](_0x4175cf,_0x24e5fc,_0x5a53('0x28'));return convertFile(_0x4175cf,_0x14131d)['then'](function(){try{fs[_0x5a53('0x29')](_0x4175cf);fs[_0x5a53('0x2a')](_0x14131d,_0x5a53('0x2b'));}catch(_0x1827da){logger[_0x5a53('0x11')](_0x1827da);}return _0x14131d[_0x5a53('0x2c')]('.')[0x0];});}function base64Encode(_0x44ef){var _0x519b76=fs['readFileSync'](_0x44ef);return new Buffer(_0x519b76)[_0x5a53('0x2d')](_0x5a53('0x28'));}exports[_0x5a53('0x2e')]=function(_0x439f63,_0xbbf022,_0x1d5722,_0x3ca870,_0x17eacf,_0x3a2821){var _0x1b864d,_0xad34fa;var _0x63d8f5=_0x5a53('0x2f');var _0x5beac5=_0x5a53('0x30')+_0x439f63;var _0x585b89={};if(_0xbbf022===_0x5a53('0x31')){_0x585b89['input']={'ssml':_0x1d5722};}else{_0x585b89[_0x5a53('0x32')]={'text':_0x1d5722};};_0x585b89[_0x5a53('0x33')]={'languageCode':_0x3ca870,'ssmlGender':_0x17eacf};_0x585b89[_0x5a53('0x34')]={'audioEncoding':_0x5a53('0x35'),'sampleRateHertz':0x1f40};var _0x5cd71a={'url':_0x63d8f5+_0x5a53('0x36')+_0x5beac5,'method':_0x5a53('0x37'),'json':!![],'body':_0x585b89};return rp(_0x5cd71a)[_0x5a53('0x38')](function(_0x4460f5){return new BPromise(function(_0xf39fdc,_0x4d84e7){_0x1b864d=path['resolve'](__dirname,_0x5a53('0x24'),rs['generate'](0x4)+_0x5a53('0x39'));var _0x254744=Buffer[_0x5a53('0x3a')](_0x4460f5[_0x5a53('0x3b')],'base64');return fs[_0x5a53('0x3c')](_0x1b864d,_0x254744,function(_0xd7aa71){_0x4d84e7(_0xd7aa71);},function(_0xf1dece){fs['chmodSync'](_0x1b864d,_0x5a53('0x2b'));_0xf39fdc(_0xf1dece);});});})['then'](function(_0x9ccc11){_0xad34fa=path[_0x5a53('0x23')](__dirname,'tmp',rs['generate'](0x4)+_0x5a53('0x26'));return convertFile(_0x1b864d,_0xad34fa);})[_0x5a53('0x38')](function(){try{fs['unlink'](_0x1b864d);fs['chmodSync'](_0xad34fa,_0x5a53('0x2b'));}catch(_0x1ae649){logger[_0x5a53('0x11')](_0x1ae649);}logger[_0x5a53('0x16')]('googleCloudTTS\x20path',_0xad34fa['split']('.')[0x0]);return _0xad34fa[_0x5a53('0x2c')]('.')[0x0];});};exports['googleTTS']=function(_0x2c6ef7,_0x237042){var _0x5d9d03='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x1f1489,_0x3e2bbe;var _0x266164;var _0x512c36={'encoding':_0x5a53('0x3d'),'method':_0x5a53('0x37'),'timeout':0x2710,'url':_0x5d9d03,'headers':{'Content-Type':_0x5a53('0x3e')},'body':_0x5a53('0x3f')+encodeURIComponent(JSON[_0x5a53('0x40')]([[['jQ1olc',JSON[_0x5a53('0x40')]([_0x2c6ef7,_0x237042||'en',![],'null']),null,_0x5a53('0x41')]]]))};return rp(_0x512c36)[_0x5a53('0x38')](function(_0x46b22d){try{_0x266164=eval(_0x46b22d['slice'](0x5))[0x0][0x2];}catch(_0x295b33){throw new Error(_0x5a53('0x42')+_0x46b22d[_0x5a53('0x1f')]);}if(!_0x266164){if(_0x2c6ef7['length']>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x5a53('0x43')+_0x237042+'\x22\x20might\x20not\x20exist');}}try{_0x266164=eval(_0x266164)[0x0];}catch(_0x3a6785){throw new Error(_0x5a53('0x42')+res['data']);}const _0x52414b=_0x266164;_0x1f1489=path[_0x5a53('0x23')](__dirname,_0x5a53('0x24'),rs['generate'](0x4)+'.mp3');fs['writeFileSync'](_0x1f1489,_0x266164,{'encoding':_0x5a53('0x28')});_0x3e2bbe=path[_0x5a53('0x23')](__dirname,_0x5a53('0x24'),rs[_0x5a53('0x25')](0x4)+'.wav');return convertFile(_0x1f1489,_0x3e2bbe);})[_0x5a53('0x38')](function(){try{fs[_0x5a53('0x29')](_0x1f1489);fs[_0x5a53('0x2a')](_0x3e2bbe,_0x5a53('0x2b'));}catch(_0x39acaf){logger[_0x5a53('0x11')](_0x39acaf);}logger[_0x5a53('0x16')]('goggleTTS\x20path',_0x3e2bbe[_0x5a53('0x2c')]('.')[0x0]);return _0x3e2bbe[_0x5a53('0x2c')]('.')[0x0];});};exports[_0x5a53('0x44')]=function(_0x2b2fdf,_0xa21d93,_0x8c6f22){return google['asr'](_0x2b2fdf,_0xa21d93,_0x8c6f22)['then'](function(_0x178a1e){logger[_0x5a53('0x16')](_0x178a1e[_0x5a53('0x45')]);return rp(_0x178a1e);})['then'](function(_0x520932){var _0x34b133='';var _0x16327b=0x0;try{fs[_0x5a53('0x29')](_0x2b2fdf);}catch(_0xfbd8e){logger[_0x5a53('0x11')](_0xfbd8e);}if(_0x520932&&_0x520932[_0x5a53('0x46')]){_0x34b133=_0x520932['results'][_0x5a53('0x47')](function(_0x1baca7){return _0x1baca7&&_0x1baca7[_0x5a53('0x48')][0x0]&&_0x1baca7[_0x5a53('0x48')][0x0][_0x5a53('0x49')]?_0x1baca7['alternatives'][0x0][_0x5a53('0x49')]:'';})[_0x5a53('0x4a')]('\x0a');_0x16327b=_0x520932[_0x5a53('0x46')]['map'](function(_0x19a01a){return _0x19a01a&&_0x19a01a[_0x5a53('0x48')][0x0]&&_0x19a01a[_0x5a53('0x48')][0x0][_0x5a53('0x4b')]?_0x19a01a[_0x5a53('0x48')][0x0][_0x5a53('0x4b')]:0x0;})['join']('\x0a');}logger[_0x5a53('0x16')](_0x5a53('0x4c'),_0x34b133);logger['info'](_0x5a53('0x4d'),_0x16327b);return{'transcript':_0x34b133,'confidence':_0x16327b};})[_0x5a53('0x4e')](function(_0x3a5536){logger['error'](_0x5a53('0x4f'),_0x3a5536[_0x5a53('0x10')],_0x3a5536[_0x5a53('0x50')],_0x3a5536[_0x5a53('0x51')]);});};exports[_0x5a53('0x52')]=function(_0x599780,_0x54b1fe,_0x104dd8,_0x2e7cb9){var _0x1fcc2e=apiai(_0x54b1fe,{'language':_0x2e7cb9||'en'});return _0x1fcc2e[_0x5a53('0x53')](_0x104dd8,{'sessionId':md5(_0x599780)})[_0x5a53('0x38')](function(_0x864c73){logger[_0x5a53('0x16')](JSON[_0x5a53('0x40')](_0x864c73));return{'source':_0x864c73[_0x5a53('0x54')][_0x5a53('0x55')],'resolvedQuery':_0x864c73[_0x5a53('0x54')]['resolvedQuery'],'action':_0x864c73[_0x5a53('0x54')]['action'],'actionIncomplete':_0x864c73[_0x5a53('0x54')][_0x5a53('0x56')],'speech':_0x864c73['result'][_0x5a53('0x57')][_0x5a53('0x58')],'score':_0x864c73['result'][_0x5a53('0x59')],'statusCode':_0x864c73[_0x5a53('0x5a')][_0x5a53('0x5b')],'endConversation':_0x864c73[_0x5a53('0x54')][_0x5a53('0x5c')][_0x5a53('0x5d')]||![],'isFallbackIntent':_0x864c73['result'][_0x5a53('0x5c')][_0x5a53('0x5e')]};});};exports[_0x5a53('0x5f')]=function(_0x23b739,_0x5dc16f,_0x570542,_0x3b4167,_0x5c1391,_0x47ebeb){var _0x575dcb=_0x3b4167[_0x5a53('0x60')](/\\n/g,'\x0a');var _0xdba044={'credentials':{'private_key':_0x575dcb,'client_email':_0x570542}};var _0x375cc4=new dialogflow[(_0x5a53('0x61'))](_0xdba044);var _0x5183ea=_0x375cc4[_0x5a53('0x62')](_0x5dc16f,md5(_0x23b739));var _0x23f9f2={'session':_0x5183ea,'queryInput':{'text':{'text':_0x5c1391,'languageCode':_0x47ebeb}}};return _0x375cc4[_0x5a53('0x63')](_0x23f9f2)[_0x5a53('0x38')](function(_0x2d5baf){if(_0x2d5baf&&_0x2d5baf[_0x5a53('0x64')]){logger['info'](_0x5a53('0x65'),JSON['stringify'](_0x2d5baf));var _0x2275e2=_0x2d5baf[0x0];if(_0x2275e2){var _0x34a790={'action':_0x2275e2[_0x5a53('0x66')]['action'],'allRequiredParamsPresent':_0x2275e2[_0x5a53('0x66')][_0x5a53('0x67')],'endConversation':_0x2275e2[_0x5a53('0x66')][_0x5a53('0x68')]&&_0x2275e2[_0x5a53('0x66')][_0x5a53('0x68')][_0x5a53('0x69')]?_0x2275e2[_0x5a53('0x66')]['diagnosticInfo'][_0x5a53('0x69')]['end_conversation'][_0x5a53('0x6a')]:![],'fulfillmentText':_0x2275e2[_0x5a53('0x66')][_0x5a53('0x6b')],'intentName':_0x2275e2['queryResult'][_0x5a53('0x6c')]['name'],'intentDisplayName':_0x2275e2[_0x5a53('0x66')][_0x5a53('0x6c')][_0x5a53('0x6d')],'isFallbackIntent':_0x2275e2[_0x5a53('0x66')][_0x5a53('0x6c')][_0x5a53('0x6e')],'languageCode':_0x2275e2[_0x5a53('0x66')][_0x5a53('0x6f')],'queryText':_0x2275e2[_0x5a53('0x66')]['queryText'],'responseId':_0x2275e2[_0x5a53('0x70')],'score':_0x2275e2['queryResult'][_0x5a53('0x71')],'speech':_0x2275e2[_0x5a53('0x66')][_0x5a53('0x6b')],'providerResponse':JSON[_0x5a53('0x40')](_0x2d5baf)};return _0x34a790;}}});};exports[_0x5a53('0x72')]=function(_0x45576e,_0x1f2f52,_0x21195f,_0x56c816){return tilde[_0x5a53('0x73')](_0x45576e,_0x1f2f52,_0x21195f,_0x56c816)[_0x5a53('0x38')](function(_0x3b1752){try{fs['unlink'](_0x45576e);}catch(_0x29d580){logger[_0x5a53('0x11')](_0x29d580);}logger[_0x5a53('0x16')](_0x5a53('0x74'),_0x3b1752[_0x5a53('0x49')]);logger[_0x5a53('0x16')](_0x5a53('0x75'),_0x3b1752[_0x5a53('0x4b')]);return _0x3b1752;});};exports[_0x5a53('0x76')]=function(_0x48a73a,_0x2e6a44,_0x3baf8c,_0x3db86f,_0x5a0be7,_0x28738e){var _0x1e221f=path[_0x5a53('0x23')](__dirname,'tmp',rs[_0x5a53('0x25')](0x4)+_0x5a53('0x39'));var _0x390dad;return aws[_0x5a53('0x77')](_0x48a73a,_0x2e6a44,_0x3baf8c,_0x3db86f,_0x5a0be7,_0x28738e,_0x1e221f)['then'](function(){_0x390dad=path['resolve'](__dirname,_0x5a53('0x24'),rs[_0x5a53('0x25')](0x4)+_0x5a53('0x26'));return convertFile(_0x1e221f,_0x390dad);})[_0x5a53('0x38')](function(){try{fs[_0x5a53('0x29')](_0x1e221f);fs[_0x5a53('0x2a')](_0x390dad,_0x5a53('0x2b'));}catch(_0x465b0d){logger[_0x5a53('0x11')](_0x465b0d);}return _0x390dad[_0x5a53('0x2c')]('.')[0x0];});};exports[_0x5a53('0x78')]=function(_0x88a322,_0x1287db,_0x35d382,_0x21cc0d,_0x3270cf,_0x5b6ff8){return aws['lex'](_0x88a322,_0x1287db,_0x35d382,_0x21cc0d,_0x3270cf,_0x5b6ff8)[_0x5a53('0x38')](function(_0x17db65){logger[_0x5a53('0x16')](JSON[_0x5a53('0x40')](_0x17db65));return _0x17db65;});};exports[_0x5a53('0x79')]=function(_0x3cdb3a,_0x599566,_0x4c34a3,_0x26eaec){var _0x11f98f=util['format'](_0x5a53('0x7a'),ISPEECH_API,_0x3cdb3a,encodeURIComponent(_0x599566),_0x4c34a3,_0x26eaec);var _0x373b0e=path[_0x5a53('0x23')](__dirname,_0x5a53('0x24'),rs[_0x5a53('0x25')](0x4)+_0x5a53('0x39'));var _0x4989f7;return downloadFile(_0x11f98f,_0x373b0e)['then'](function(){_0x4989f7=path[_0x5a53('0x23')](__dirname,'tmp',rs[_0x5a53('0x25')](0x4)+_0x5a53('0x26'));return convertFile(_0x373b0e,_0x4989f7);})[_0x5a53('0x38')](function(){try{fs[_0x5a53('0x29')](_0x373b0e);fs['chmodSync'](_0x4989f7,'777');}catch(_0x438fcb){logger['error'](_0x438fcb);}return _0x4989f7[_0x5a53('0x2c')]('.')[0x0];});};exports[_0x5a53('0x7b')]=function(_0xa4aeb8,_0x2ae1e5,_0x210703,_0x40e9e6){var _0x1ee35e=util[_0x5a53('0x7c')](_0x5a53('0x7d'),ISPEECH_API,_0x2ae1e5,_0x210703,base64Encode(_0xa4aeb8),_0x40e9e6?util[_0x5a53('0x7c')](_0x5a53('0x7e'),encodeURIComponent(_0x40e9e6)):_0x5a53('0x7f'));return uploadFile(_0x1ee35e)[_0x5a53('0x38')](function(_0x3a41bb){return querystring['parse'](_0x3a41bb);});};exports[_0x5a53('0x80')]=function(_0x2073a4,_0xe4baa1){return sestek['nda'](_0x2073a4,_0xe4baa1)['then'](function(_0x5af6ee){logger[_0x5a53('0x16')](JSON[_0x5a53('0x40')](_0x5af6ee));var _0x3d33f1={'speech':_0x5af6ee[_0x5a53('0x81')],'action':_0x5af6ee['channelData']?_0x5af6ee[_0x5a53('0x82')][_0x5a53('0x83')]:undefined,'actiondata':_0x5af6ee[_0x5a53('0x82')]?_0x5af6ee['channelData'][_0x5a53('0x84')]:undefined};if(_0x5af6ee['channelData']&&_0x5af6ee[_0x5a53('0x82')][_0x5a53('0x85')]){return base64Decode(_0x5af6ee[_0x5a53('0x82')][_0x5a53('0x85')][_0x5a53('0x86')],path[_0x5a53('0x23')](__dirname,_0x5a53('0x24'),rs[_0x5a53('0x25')](0x4)+_0x5a53('0x26')))[_0x5a53('0x38')](function(_0x10da03){_0x3d33f1[_0x5a53('0x87')]=_0x10da03;return _0x3d33f1;});}return _0x3d33f1;});};exports[_0x5a53('0x88')]=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 b63ea4b..1667433 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 _0x0c3f=['exports'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x0c3f,0x97));var _0xf0c3=function(_0x4b2d56,_0x588d38){_0x4b2d56=_0x4b2d56-0x0;var _0x95a3ab=_0x0c3f[_0x4b2d56];return _0x95a3ab;};var nda=require('./nda');module[_0xf0c3('0x0')]={'nda':nda}; \ No newline at end of file +var _0x94f5=['./nda','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x94f5,0x12e));var _0x594f=function(_0x28b80d,_0x139ce7){_0x28b80d=_0x28b80d-0x0;var _0x565065=_0x94f5[_0x28b80d];return _0x565065;};var nda=require(_0x594f('0x0'));module[_0x594f('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 2765316..b537c63 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 _0x9063=['../../../../../config/logger','agi','exports','resolve','ndauth_url','/token','password','username','POST','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid','dnid','extension','Bearer\x20','body','channelData','ndagenerate_audio','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','request-promise','url'];(function(_0x2dc96f,_0x459058){var _0xd012da=function(_0x38d032){while(--_0x38d032){_0x2dc96f['push'](_0x2dc96f['shift']());}};_0xd012da(++_0x459058);}(_0x9063,0x1a2));var _0x3906=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9063[_0x4cf98e];return _0x1623ac;};'use strict';var rp=require(_0x3906('0x0'));var url=require(_0x3906('0x1'));var logger=require(_0x3906('0x2'))(_0x3906('0x3'));module[_0x3906('0x4')]=function(_0x203f56,_0x30ced4){var _0x219544={'method':'POST','uri':url[_0x3906('0x5')](_0x30ced4[_0x3906('0x6')],_0x3906('0x7')),'form':{'grant_type':_0x3906('0x8'),'username':_0x30ced4[_0x3906('0x9')],'password':_0x30ced4['password']},'json':!![]};return rp(_0x219544)['then'](function(_0x4a8864){var _0x331b42={'method':_0x3906('0xa'),'uri':url[_0x3906('0x5')](_0x30ced4['ndassistant_url'],_0x3906('0xb')),'body':{'type':_0x30ced4[_0x3906('0xc')]||'message','channelId':_0x3906('0xd'),'conversation':{'id':_0x203f56[_0x3906('0xe')]},'from':{'id':_0x203f56[_0x3906('0xf')],'name':_0x203f56['calleridname']},'recipient':{'id':_0x203f56[_0x3906('0x10')],'name':_0x203f56[_0x3906('0x11')]},'text':_0x30ced4['text'],'channelData':{}},'headers':{'Authorization':_0x3906('0x12')+_0x4a8864['access_token']},'json':!![]};if(_0x30ced4['project']){_0x331b42[_0x3906('0x13')][_0x3906('0x14')]['ProjectName']=_0x30ced4['project'];}if(_0x30ced4[_0x3906('0x15')]=='1'){_0x331b42[_0x3906('0x13')]['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x3906('0x16')};}if(_0x30ced4[_0x3906('0x17')]){_0x331b42[_0x3906('0x13')][_0x3906('0x14')][_0x3906('0x18')]=_0x30ced4[_0x3906('0x17')];if(_0x30ced4[_0x3906('0x19')]){_0x331b42[_0x3906('0x13')][_0x3906('0x14')][_0x3906('0x1a')]=_0x30ced4['custom_action_data'];}}logger[_0x3906('0x1b')](JSON['stringify'](_0x331b42));return rp(_0x331b42);});}; \ No newline at end of file +var _0x630e=['Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','../../../../../config/logger','resolve','ndauth_url','/token','password','username','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','uniqueid','callerid','calleridname','dnid','text'];(function(_0x214266,_0x1f6f52){var _0x568f75=function(_0x541904){while(--_0x541904){_0x214266['push'](_0x214266['shift']());}};_0x568f75(++_0x1f6f52);}(_0x630e,0x1af));var _0xe630=function(_0x3d0c12,_0x50770a){_0x3d0c12=_0x3d0c12-0x0;var _0x183edf=_0x630e[_0x3d0c12];return _0x183edf;};'use strict';var rp=require(_0xe630('0x0'));var url=require('url');var logger=require(_0xe630('0x1'))('agi');module['exports']=function(_0x36902e,_0x143cb6){var _0x12449c={'method':'POST','uri':url[_0xe630('0x2')](_0x143cb6[_0xe630('0x3')],_0xe630('0x4')),'form':{'grant_type':_0xe630('0x5'),'username':_0x143cb6[_0xe630('0x6')],'password':_0x143cb6['password']},'json':!![]};return rp(_0x12449c)[_0xe630('0x7')](function(_0x34bad4){var _0x5a73ad={'method':_0xe630('0x8'),'uri':url['resolve'](_0x143cb6[_0xe630('0x9')],_0xe630('0xa')),'body':{'type':_0x143cb6[_0xe630('0xb')]||'message','channelId':'Nda','conversation':{'id':_0x36902e[_0xe630('0xc')]},'from':{'id':_0x36902e[_0xe630('0xd')],'name':_0x36902e[_0xe630('0xe')]},'recipient':{'id':_0x36902e[_0xe630('0xf')],'name':_0x36902e['extension']},'text':_0x143cb6[_0xe630('0x10')],'channelData':{}},'headers':{'Authorization':_0xe630('0x11')+_0x34bad4[_0xe630('0x12')]},'json':!![]};if(_0x143cb6[_0xe630('0x13')]){_0x5a73ad[_0xe630('0x14')][_0xe630('0x15')][_0xe630('0x16')]=_0x143cb6[_0xe630('0x13')];}if(_0x143cb6[_0xe630('0x17')]=='1'){_0x5a73ad[_0xe630('0x14')][_0xe630('0x15')][_0xe630('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xe630('0x19')};}if(_0x143cb6['custom_action']){_0x5a73ad[_0xe630('0x14')][_0xe630('0x15')][_0xe630('0x1a')]=_0x143cb6[_0xe630('0x1b')];if(_0x143cb6[_0xe630('0x1c')]){_0x5a73ad[_0xe630('0x14')][_0xe630('0x15')][_0xe630('0x1d')]=_0x143cb6[_0xe630('0x1c')];}}logger[_0xe630('0x1e')](JSON[_0xe630('0x1f')](_0x5a73ad));return rp(_0x5a73ad);});}; \ 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 e5783f1..da025fc 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 _0x43fb=['./lib/api','exports'];(function(_0x421c17,_0x3211b0){var _0x4202ad=function(_0x49d642){while(--_0x49d642){_0x421c17['push'](_0x421c17['shift']());}};_0x4202ad(++_0x3211b0);}(_0x43fb,0x170));var _0xb43f=function(_0x2aeeb3,_0x16d752){_0x2aeeb3=_0x2aeeb3-0x0;var _0x24891e=_0x43fb[_0x2aeeb3];return _0x24891e;};'use strict';var asr=require(_0xb43f('0x0'));module[_0xb43f('0x1')]=function(_0x28ecfb,_0x1220f4,_0x215a20,_0x35231c){return asr(_0x28ecfb,_0x1220f4,_0x215a20,_0x35231c);}; \ No newline at end of file +var _0x890f=['exports'];(function(_0x380d16,_0xdf0d31){var _0x5d5253=function(_0x7a25bc){while(--_0x7a25bc){_0x380d16['push'](_0x380d16['shift']());}};_0x5d5253(++_0xdf0d31);}(_0x890f,0x175));var _0xf890=function(_0x346045,_0x3ce566){_0x346045=_0x346045-0x0;var _0x3d1573=_0x890f[_0x346045];return _0x3d1573;};'use strict';var asr=require('./lib/api');module[_0xf890('0x0')]=function(_0x5bbba0,_0x192215,_0x113c51,_0x545370){return asr(_0x5bbba0,_0x192215,_0x113c51,_0x545370);}; \ 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 14ef470..30b28ef 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 _0x9620=['isNil','isObject','open','message','bluebird','lodash','moment','crypto','agi','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','stringify','createReadStream','data','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x9620,0xe8));var _0x0962=function(_0x42a4a2,_0x4ead3e){_0x42a4a2=_0x42a4a2-0x0;var _0x10547c=_0x9620[_0x42a4a2];return _0x10547c;};'use strict';var BPromise=require(_0x0962('0x0'));var _=require(_0x0962('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x0962('0x2'));var crypto=require(_0x0962('0x3'));var logger=require('../../../../../../config/logger')(_0x0962('0x4'));module['exports']=function(_0x3c0657,_0x3f1f3e,_0x17e93a,_0x1ae272){return new BPromise(function(_0x571c17,_0x3f0fb7){logger[_0x0962('0x5')]('Tilde\x20URI',_0x1ae272||_0x0962('0x6'));var _0x4cb778=new WebSocket(_0x1ae272||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x1e13f5='';var _0x1641cd='0';var _0x39ec61='1';var _0x18abc5='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x50bc1a(_0x41905f){var _0x2f886b=crypto[_0x0962('0x7')](_0x0962('0x8'));_0x2f886b[_0x0962('0x9')](_0x41905f);return _0x2f886b['digest'](_0x0962('0xa'));}function _0x2ea162(){try{logger[_0x0962('0x5')](_0x0962('0xb'));var _0x1fbbe7=moment()[_0x0962('0xc')]();var _0x2844da=_0x50bc1a(_0x1fbbe7+_0x3f1f3e+_0x17e93a);_0x4cb778['send'](JSON[_0x0962('0xd')]({'appID':_0x3f1f3e,'timestamp':_0x1fbbe7,'appKey':_0x2844da}));var _0x2d609b=fs[_0x0962('0xe')](_0x3c0657);_0x2d609b['on'](_0x0962('0xf'),function(_0x4c70ff){_0x4cb778[_0x0962('0x10')](_0x4c70ff);});_0x2d609b['on'](_0x0962('0x11'),function(){_0x4cb778[_0x0962('0x10')](_0x0962('0x12'));});}catch(_0x18df46){logger[_0x0962('0x13')](_0x0962('0x14'),JSON[_0x0962('0xd')](_0x18df46));_0x4cb778[_0x0962('0x15')]();}}function _0x4604ec(_0x2734d2){try{if(_0x2734d2){var _0x572b5f=JSON['parse'](_0x2734d2);switch(_0x572b5f[_0x0962('0x16')]){case 0x0:if(_0x572b5f[_0x0962('0x17')]){if(_0x572b5f[_0x0962('0x17')][_0x0962('0x18')]){logger[_0x0962('0x5')](_0x0962('0x19'),JSON[_0x0962('0xd')](_0x572b5f[_0x0962('0x17')][_0x0962('0x1a')]));_0x1e13f5=_0x572b5f[_0x0962('0x17')][_0x0962('0x1a')][0x0]['transcript'];_0x1641cd=_0x572b5f[_0x0962('0x17')][_0x0962('0x1a')][0x0]['likelihood'];_0x39ec61='0';_0x18abc5='Success.';_0x4cb778['terminate']();}}break;case 0x1:logger[_0x0962('0x5')](_0x0962('0x1b'));_0x39ec61='1';_0x18abc5=_0x0962('0x1b');break;case 0x2:logger['info'](_0x0962('0x1c'));_0x39ec61='2';_0x18abc5=_0x0962('0x1c');break;case 0x9:logger[_0x0962('0x5')](_0x0962('0x1d'));_0x39ec61='9';_0x18abc5=_0x0962('0x1d');break;case 0xa:logger[_0x0962('0x5')](_0x0962('0x1e'));_0x39ec61='10';_0x18abc5=_0x0962('0x1e');break;case 0xb:logger[_0x0962('0x5')](_0x0962('0x1f'));_0x39ec61='11';_0x18abc5=_0x0962('0x1f');}}}catch(_0x2e65d7){logger[_0x0962('0x13')](_0x0962('0x20'),JSON['stringify'](_0x2e65d7));_0x4cb778['terminate']();}}function _0x1b1abb(){logger[_0x0962('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x571c17({'transcript':_0x1e13f5,'confidence':_0x1641cd,'status':_0x39ec61,'status_message':_0x18abc5});}function _0x23c261(_0x28b59f){logger['error'](_0x0962('0x21'));if(!_[_0x0962('0x22')](_0x28b59f)){logger[_0x0962('0x13')](_[_0x0962('0x23')](_0x28b59f)?JSON[_0x0962('0xd')](_0x28b59f):_0x28b59f);}}_0x4cb778['on'](_0x0962('0x24'),_0x2ea162);_0x4cb778['on'](_0x0962('0x25'),_0x4604ec);_0x4cb778['on'](_0x0962('0x11'),_0x1b1abb);_0x4cb778['on'](_0x0962('0x13'),_0x23c261);});}; \ No newline at end of file +var _0xe0ce=['data','close','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','crypto','agi','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','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream'];(function(_0x1c0270,_0x4438e1){var _0x32a16c=function(_0x2620a0){while(--_0x2620a0){_0x1c0270['push'](_0x1c0270['shift']());}};_0x32a16c(++_0x4438e1);}(_0xe0ce,0x117));var _0xee0c=function(_0x25446b,_0x5d05aa){_0x25446b=_0x25446b-0x0;var _0x11409e=_0xe0ce[_0x25446b];return _0x11409e;};'use strict';var BPromise=require(_0xee0c('0x0'));var _=require(_0xee0c('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xee0c('0x2'));var logger=require('../../../../../../config/logger')(_0xee0c('0x3'));module['exports']=function(_0x140d7d,_0x14a27e,_0x5d862e,_0x194ce8){return new BPromise(function(_0x40c62f,_0x5e35b8){logger[_0xee0c('0x4')](_0xee0c('0x5'),_0x194ce8||_0xee0c('0x6'));var _0x428ad3=new WebSocket(_0x194ce8||_0xee0c('0x6'),{'perMessageDeflate':![]});var _0x56c0b3='';var _0x231f16='0';var _0x2746a2='1';var _0x5db6e9=_0xee0c('0x7');function _0x39a29c(_0x15ab18){var _0x4da3a0=crypto[_0xee0c('0x8')]('sha1');_0x4da3a0[_0xee0c('0x9')](_0x15ab18);return _0x4da3a0[_0xee0c('0xa')](_0xee0c('0xb'));}function _0x4667ea(){try{logger['info'](_0xee0c('0xc'));var _0x2dd190=moment()[_0xee0c('0xd')]();var _0x1675e1=_0x39a29c(_0x2dd190+_0x14a27e+_0x5d862e);_0x428ad3[_0xee0c('0xe')](JSON[_0xee0c('0xf')]({'appID':_0x14a27e,'timestamp':_0x2dd190,'appKey':_0x1675e1}));var _0x3d1e58=fs[_0xee0c('0x10')](_0x140d7d);_0x3d1e58['on'](_0xee0c('0x11'),function(_0x194e3c){_0x428ad3[_0xee0c('0xe')](_0x194e3c);});_0x3d1e58['on'](_0xee0c('0x12'),function(){_0x428ad3[_0xee0c('0xe')]('EOS');});}catch(_0x229c58){logger[_0xee0c('0x13')](_0xee0c('0x14'),JSON[_0xee0c('0xf')](_0x229c58));_0x428ad3[_0xee0c('0x15')]();}}function _0x34c0c2(_0xc33e2f){try{if(_0xc33e2f){var _0x1191b9=JSON[_0xee0c('0x16')](_0xc33e2f);switch(_0x1191b9[_0xee0c('0x17')]){case 0x0:if(_0x1191b9[_0xee0c('0x18')]){if(_0x1191b9[_0xee0c('0x18')]['final']){logger[_0xee0c('0x4')](_0xee0c('0x19'),JSON[_0xee0c('0xf')](_0x1191b9['result'][_0xee0c('0x1a')]));_0x56c0b3=_0x1191b9[_0xee0c('0x18')][_0xee0c('0x1a')][0x0]['transcript'];_0x231f16=_0x1191b9['result']['hypotheses'][0x0]['likelihood'];_0x2746a2='0';_0x5db6e9=_0xee0c('0x1b');_0x428ad3[_0xee0c('0x15')]();}}break;case 0x1:logger['info'](_0xee0c('0x7'));_0x2746a2='1';_0x5db6e9='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xee0c('0x4')](_0xee0c('0x1c'));_0x2746a2='2';_0x5db6e9=_0xee0c('0x1c');break;case 0x9:logger[_0xee0c('0x4')](_0xee0c('0x1d'));_0x2746a2='9';_0x5db6e9='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xee0c('0x4')](_0xee0c('0x1e'));_0x2746a2='10';_0x5db6e9=_0xee0c('0x1e');break;case 0xb:logger[_0xee0c('0x4')](_0xee0c('0x1f'));_0x2746a2='11';_0x5db6e9='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x58ec49){logger[_0xee0c('0x13')]('Tilde\x20ASR\x20parse\x20error',JSON[_0xee0c('0xf')](_0x58ec49));_0x428ad3[_0xee0c('0x15')]();}}function _0x3cb40f(){logger['info']('Close\x20Tilde\x20ASR\x20socket');_0x40c62f({'transcript':_0x56c0b3,'confidence':_0x231f16,'status':_0x2746a2,'status_message':_0x5db6e9});}function _0x30707e(_0x35ef5a){logger['error'](_0xee0c('0x20'));if(!_[_0xee0c('0x21')](_0x35ef5a)){logger['error'](_[_0xee0c('0x22')](_0x35ef5a)?JSON[_0xee0c('0xf')](_0x35ef5a):_0x35ef5a);}}_0x428ad3['on'](_0xee0c('0x23'),_0x4667ea);_0x428ad3['on'](_0xee0c('0x24'),_0x34c0c2);_0x428ad3['on'](_0xee0c('0x12'),_0x3cb40f);_0x428ad3['on'](_0xee0c('0x13'),_0x30707e);});}; \ 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 30f3a7b..3207c59 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 _0x561d=['exports'];(function(_0xd0579c,_0x1960d9){var _0x9f29db=function(_0x11da57){while(--_0x11da57){_0xd0579c['push'](_0xd0579c['shift']());}};_0x9f29db(++_0x1960d9);}(_0x561d,0xb8));var _0xd561=function(_0x13a693,_0x3dc4c6){_0x13a693=_0x13a693-0x0;var _0x5805e3=_0x561d[_0x13a693];return _0x5805e3;};var asr=require('./asr');module[_0xd561('0x0')]={'asr':asr}; \ No newline at end of file +var _0x9818=['exports','./asr'];(function(_0x1a6399,_0x437d38){var _0x3a42d1=function(_0xeacda1){while(--_0xeacda1){_0x1a6399['push'](_0x1a6399['shift']());}};_0x3a42d1(++_0x437d38);}(_0x9818,0x12b));var _0x8981=function(_0x413011,_0x1deae3){_0x413011=_0x413011-0x0;var _0x178e45=_0x9818[_0x413011];return _0x178e45;};var asr=require(_0x8981('0x0'));module[_0x8981('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 71ae0a8..f09683c 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 _0xaa2b=['destroy','E_AGI_SERVER_MAXCONNECTION','ready','close','E_AGI_SERVER_CLOSE','nextTick','util','net','events','EventEmitter','./error','./channel','127.0.0.1','call','emit','createServer','listen','connection','error','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED'];(function(_0x8eb835,_0x25295a){var _0x326488=function(_0x3d16cb){while(--_0x3d16cb){_0x8eb835['push'](_0x8eb835['shift']());}};_0x326488(++_0x25295a);}(_0xaa2b,0xd8));var _0xbaa2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa2b[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xbaa2('0x0'));var net=require(_0xbaa2('0x1'));var EventEmitter=require(_0xbaa2('0x2'))[_0xbaa2('0x3')];var AGIError=require(_0xbaa2('0x4'));var AGIChannel=require(_0xbaa2('0x5'));var AGIServer=function(_0x3d9dc6,_0x90d9fc,_0x4f6ee3){var _0x3efe26=this,_0x3d9dc6=_0x3d9dc6||0x11dd,_0x90d9fc=_0x90d9fc||_0xbaa2('0x6'),_0xb0cbf4=null,_0x235f3c=0x0;EventEmitter[_0xbaa2('0x7')](_0x3efe26);function _0x3bc9d1(){if(!_0x3d9dc6){_0x3efe26[_0xbaa2('0x8')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0xb0cbf4=net[_0xbaa2('0x9')]();_0xb0cbf4[_0xbaa2('0xa')](_0x3d9dc6,_0x90d9fc);_0xb0cbf4['on']('listening',function(){_0x3efe26['emit']('listening');});_0xb0cbf4['on'](_0xbaa2('0xb'),function(_0xc660dd){_0xb0cbf4['getConnections'](function(_0x326725,_0xcd908){if(_0x326725){_0x3efe26[_0xbaa2('0x8')](_0xbaa2('0xc'),new AGIError(_0xbaa2('0xd'),_0x326725));}else if(_0x4f6ee3&&_0x4f6ee3<0x0){_0x3efe26[_0xbaa2('0x8')]('error',new AGIError(_0xbaa2('0xe')));_0xc660dd[_0xbaa2('0xf')]();}else if(_0x4f6ee3&&_0x4f6ee3>0x0&&_0x4f6ee3<_0xcd908){_0x235f3c+=0x1;_0x3efe26['emit'](_0xbaa2('0xc'),new AGIError(_0xbaa2('0x10'),_0x235f3c));_0xc660dd[_0xbaa2('0xf')]();}else{var _0x4f2115=new AGIChannel(_0xc660dd);_0x4f2115['on'](_0xbaa2('0x11'),function(){_0x3efe26[_0xbaa2('0x8')]('connection',_0x4f2115);});}});});_0xb0cbf4['on'](_0xbaa2('0xc'),function(_0x1285a7){_0x3efe26[_0xbaa2('0x8')]('error',new AGIError(_0xbaa2('0xd'),_0x1285a7['code']));});_0xb0cbf4['on'](_0xbaa2('0x12'),function(){_0x3efe26['emit']('close',new AGIError(_0xbaa2('0x13')));});}process[_0xbaa2('0x14')](function(){_0x3bc9d1();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x4e5392,_0x3cf5f4,_0x42e06a){return new AGIServer(_0x4e5392,_0x3cf5f4,_0x42e06a);}; \ No newline at end of file +var _0xb67b=['close','E_AGI_SERVER_CLOSE','nextTick','inherits','net','events','EventEmitter','./error','./channel','call','error','E_AGI_ARGUMENT_PORT','listen','listening','emit','connection','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','code'];(function(_0x414325,_0x32bff0){var _0x21b046=function(_0x4019a5){while(--_0x4019a5){_0x414325['push'](_0x414325['shift']());}};_0x21b046(++_0x32bff0);}(_0xb67b,0x193));var _0xbb67=function(_0x1e1fe9,_0x216dd9){_0x1e1fe9=_0x1e1fe9-0x0;var _0x4eeb06=_0xb67b[_0x1e1fe9];return _0x4eeb06;};'use strict';var util=require('util');var net=require(_0xbb67('0x0'));var EventEmitter=require(_0xbb67('0x1'))[_0xbb67('0x2')];var AGIError=require(_0xbb67('0x3'));var AGIChannel=require(_0xbb67('0x4'));var AGIServer=function(_0x2627a4,_0x32fabc,_0x23b48c){var _0xd241c0=this,_0x2627a4=_0x2627a4||0x11dd,_0x32fabc=_0x32fabc||'127.0.0.1',_0x33f75a=null,_0x551134=0x0;EventEmitter[_0xbb67('0x5')](_0xd241c0);function _0xee2154(){if(!_0x2627a4){_0xd241c0['emit'](_0xbb67('0x6'),new AGIError(_0xbb67('0x7')));return![];}_0x33f75a=net['createServer']();_0x33f75a[_0xbb67('0x8')](_0x2627a4,_0x32fabc);_0x33f75a['on'](_0xbb67('0x9'),function(){_0xd241c0[_0xbb67('0xa')](_0xbb67('0x9'));});_0x33f75a['on'](_0xbb67('0xb'),function(_0x6e849f){_0x33f75a['getConnections'](function(_0x7a1ffc,_0x4fce84){if(_0x7a1ffc){_0xd241c0[_0xbb67('0xa')](_0xbb67('0x6'),new AGIError(_0xbb67('0xc'),_0x7a1ffc));}else if(_0x23b48c&&_0x23b48c<0x0){_0xd241c0[_0xbb67('0xa')](_0xbb67('0x6'),new AGIError(_0xbb67('0xd')));_0x6e849f['destroy']();}else if(_0x23b48c&&_0x23b48c>0x0&&_0x23b48c<_0x4fce84){_0x551134+=0x1;_0xd241c0[_0xbb67('0xa')]('error',new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x551134));_0x6e849f[_0xbb67('0xe')]();}else{var _0x51b6d1=new AGIChannel(_0x6e849f);_0x51b6d1['on'](_0xbb67('0xf'),function(){_0xd241c0[_0xbb67('0xa')]('connection',_0x51b6d1);});}});});_0x33f75a['on']('error',function(_0xc8a0ba){_0xd241c0['emit'](_0xbb67('0x6'),new AGIError(_0xbb67('0xc'),_0xc8a0ba[_0xbb67('0x10')]));});_0x33f75a['on'](_0xbb67('0x11'),function(){_0xd241c0[_0xbb67('0xa')](_0xbb67('0x11'),new AGIError(_0xbb67('0x12')));});}process[_0xbb67('0x13')](function(){_0xee2154();});};util[_0xbb67('0x14')](AGIServer,EventEmitter);module['exports']=function(_0x3a1428,_0x171875,_0x3f9b30){return new AGIServer(_0x3a1428,_0x171875,_0x3f9b30);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 3e823e9..a0a50c3 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 _0xf4af=['Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','getSound','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayphonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','subject','service','host','port','secure','auth','template_id','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','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','debug','sendSMS\x20message','createSmsMessage','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','AGI','system','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','moment','mustache','request-promise','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','getVariableById','then','name','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','map','Intervals','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','info','Error\x20executing\x20query\x20%s','close','getSmsAccount','getSmsAccountById','label','agicommand','arg_1','callerid','createSquareRecording','uniqueid','calleridname','context','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','includes','POST','method','toUpperCase','body','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','toString','getAndSetVariable','extra','maxRetry','createSquareDetailsReport','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','result','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','RECOG_INSTANCE()','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','query','replace','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','getData','response','mindigit','maxdigit','no\x20variable\x20found','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','%s/recordings/%s','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','Trying\x20ispeech\x20TTS\x20%s'];(function(_0x405385,_0x56f573){var _0x43837b=function(_0x30e20e){while(--_0x30e20e){_0x405385['push'](_0x405385['shift']());}};_0x43837b(++_0x56f573);}(_0xf4af,0x7a));var _0xff4a=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0xf4af[_0x1a7550];return _0x426e22;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xff4a('0x0'));var _=require(_0xff4a('0x1'));var sh=require(_0xff4a('0x2'));var odbc=require(_0xff4a('0x3'))();var rs=require('randomstring');var moment=require(_0xff4a('0x4'));var Mustache=require(_0xff4a('0x5'));var rp=require(_0xff4a('0x6'));var logger=require(_0xff4a('0x7'))('agi');var config=require(_0xff4a('0x8'));var scripts=require(_0xff4a('0x9'));var FILES_PATH=_0xff4a('0xa');var recursiveMapAttributes=['rawHeaders','rawBody'];var verticesWithRetry=[_0xff4a('0xb'),_0xff4a('0xc'),_0xff4a('0xd')];var AGIVertices=function(_0x3aa4a4,_0x40a90d,_0xc09740){this[_0xff4a('0xe')]=_0x3aa4a4;this[_0xff4a('0xf')]=_0x40a90d;this[_0xff4a('0x10')]=_0xc09740;};AGIVertices['prototype'][_0xff4a('0x11')]=function(_0x19bb75,_0xefa53e){this[_0xff4a('0xf')][_0xff4a('0x12')](_0x19bb75)[_0xff4a('0x13')](function(_0x4b284c){_0xefa53e(null,_0x4b284c?_0x4b284c[_0xff4a('0x14')]:![]);})[_0xff4a('0x15')](function(_0x5a9c0b){_0xefa53e(_0x5a9c0b);});};AGIVertices[_0xff4a('0x16')][_0xff4a('0x17')]=function(_0x9efffe,_0xedbd14){this[_0xff4a('0xf')][_0xff4a('0x18')](_0x9efffe)[_0xff4a('0x13')](function(_0x5dc34e){_0xedbd14(null,_0x5dc34e?_0x5dc34e[_0xff4a('0x14')]:![]);})['catch'](function(_0xc65735){_0xedbd14(_0xc65735);});};AGIVertices[_0xff4a('0x16')][_0xff4a('0x19')]=function(_0x365518,_0x43e3e9){this[_0xff4a('0xf')][_0xff4a('0x1a')](_0x365518)[_0xff4a('0x13')](function(_0x6f6858){_0x43e3e9(null,_0x6f6858?_0x6f6858[_0xff4a('0x14')]:![]);})[_0xff4a('0x15')](function(_0x3c99f6){_0x43e3e9(_0x3c99f6);});};AGIVertices[_0xff4a('0x16')][_0xff4a('0x1b')]=function(_0x1a3e1a,_0xf3b485){this[_0xff4a('0xf')]['getSquareOdbcById'](_0x1a3e1a)[_0xff4a('0x13')](function(_0x8d87fd){_0xf3b485(null,_0x8d87fd?_0x8d87fd['dsn']:![]);})[_0xff4a('0x15')](function(_0x4a3711){_0xf3b485(_0x4a3711);});};AGIVertices[_0xff4a('0x16')]['getUser']=function(_0x1e817c,_0x42f06d){this[_0xff4a('0xf')]['getUserById'](_0x1e817c)[_0xff4a('0x13')](function(_0x3fc2d9){_0x42f06d(null,_0x3fc2d9?_0x3fc2d9[_0xff4a('0x14')]:![]);})[_0xff4a('0x15')](function(_0x1a1832){_0x42f06d(_0x1a1832);});};AGIVertices[_0xff4a('0x16')][_0xff4a('0x1c')]=function(_0x3bf1c0,_0x1544c2){this[_0xff4a('0xf')][_0xff4a('0x1d')](_0x3bf1c0)[_0xff4a('0x13')](function(_0x46af57){_0x1544c2(null,_0x46af57?_0x46af57[_0xff4a('0x14')]:![]);})[_0xff4a('0x15')](function(_0x4bae34){_0x1544c2(_0x4bae34);});};AGIVertices['prototype']['getSound']=function(_0x4eb30e,_0x420ac2){var _0x5d4d56=this;this[_0xff4a('0xf')][_0xff4a('0x1e')](_0x4eb30e)['then'](function(_0x4889b6){_0x420ac2(null,_0x4889b6?_0x5d4d56[_0xff4a('0x1f')](_0x4889b6[_0xff4a('0x20')]):![]);})[_0xff4a('0x15')](function(_0x526884){_0x420ac2(_0x526884);});};AGIVertices['prototype'][_0xff4a('0x21')]=function(_0x192a74,_0x3ef4cf){this[_0xff4a('0xf')][_0xff4a('0x22')](_0x192a74)['then'](function(_0x30a379){_0x3ef4cf(null,_0x30a379?_0x30a379:![]);})['catch'](function(_0xf4c17f){_0x3ef4cf(_0xf4c17f);});};AGIVertices[_0xff4a('0x16')][_0xff4a('0x23')]=function(_0x29b5c1,_0x2f4b56,_0x38c9dc){this[_0xff4a('0x10')][_0xff4a('0x23')](_0x29b5c1,_0x2f4b56)[_0xff4a('0x13')](function(){_0x38c9dc(null);})['catch'](function(_0x33998a){_0x38c9dc(_0x33998a);});};AGIVertices[_0xff4a('0x16')][_0xff4a('0x24')]=function(_0x565630,_0x51ecd0){this[_0xff4a('0xf')][_0xff4a('0x25')](_0x565630)['then'](function(_0x3b466d){if(_0x3b466d){if(_0x3b466d['IntervalId']){_0x51ecd0(null,[_0x3b466d[_0xff4a('0x26')]]);}else{_0x51ecd0(null,_[_0xff4a('0x27')](_0x3b466d[_0xff4a('0x28')],'interval'));}}else{_0x51ecd0(null,![]);}})['catch'](function(_0x1f8258){_0x51ecd0(_0x1f8258);});};AGIVertices['prototype'][_0xff4a('0x1f')]=function(_0x42c7e7){return util['format'](_0xff4a('0x29'),FILES_PATH,_0x42c7e7);};AGIVertices[_0xff4a('0x16')]['getQueryOdbc']=function(_0x163465,_0x5638a8,_0x482c3b){odbc[_0xff4a('0x2a')](_0x163465,function(_0x847df1){if(_0x847df1){logger[_0xff4a('0x2b')](_0xff4a('0x2c'),_0x847df1);_0x482c3b(_0x847df1);}else{logger['info'](_0xff4a('0x2d'));odbc['query'](_0x5638a8,function(_0x36c217,_0x5cbe5e){if(_0x36c217){logger[_0xff4a('0x2e')](_0xff4a('0x2f'),_0x5638a8);_0x482c3b(_0x36c217);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x5638a8);odbc[_0xff4a('0x30')](function(_0x415c9e){if(_0x415c9e){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x415c9e);}_0x482c3b(null,_0x5cbe5e);});}});}});};AGIVertices[_0xff4a('0x16')][_0xff4a('0x31')]=function(_0xbc8766,_0x4fbd04){this[_0xff4a('0xf')][_0xff4a('0x32')](_0xbc8766)['then'](function(_0x43a121){_0x4fbd04(null,_0x43a121?_0x43a121:![]);})[_0xff4a('0x15')](function(_0x19aa4c){_0x4fbd04(_0x19aa4c);});};AGIVertices[_0xff4a('0x16')]['createSmsMessage']=function(_0x53bfff,_0x328ff6){this[_0xff4a('0xf')]['createSmsMessage'](_0x53bfff)[_0xff4a('0x13')](function(_0x235b1c){_0x328ff6(null,_0x235b1c);})['catch'](function(_0x1f66b9){_0x328ff6(_0x1f66b9);});};AGIVertices[_0xff4a('0x16')]['createSquareDetailsReport']=function(_0x29f7fa,_0x43a1ed,_0x48dcb2){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0xff4a('0xe')]['uniqueid'],'node':_0x29f7fa[_0xff4a('0x33')],'application':_0x29f7fa[_0xff4a('0x34')],'data':_0x43a1ed||null,'project_name':this[_0xff4a('0xe')][_0xff4a('0x35')],'callerid':this['channel'][_0xff4a('0x36')]})['then'](function(_0x33c8bc){if(_0x48dcb2){_0x48dcb2(null,_0x33c8bc);}})[_0xff4a('0x15')](function(_0x91e386){if(_0x48dcb2){_0x48dcb2(_0x91e386);}});};AGIVertices[_0xff4a('0x16')][_0xff4a('0x37')]=function(_0x3cf325,_0x567998,_0x381bfb,_0x1bfcef){this[_0xff4a('0xf')][_0xff4a('0x37')]({'uniqueid':this[_0xff4a('0xe')][_0xff4a('0x38')],'callerid':this['channel']['callerid'],'calleridname':this[_0xff4a('0xe')][_0xff4a('0x39')],'context':this[_0xff4a('0xe')][_0xff4a('0x3a')],'extension':this[_0xff4a('0xe')][_0xff4a('0x3b')],'priority':this[_0xff4a('0xe')][_0xff4a('0x3c')],'accountcode':this[_0xff4a('0xe')]['accountcode'],'dnid':this[_0xff4a('0xe')][_0xff4a('0x3d')],'projectName':this[_0xff4a('0xe')][_0xff4a('0x35')],'saveName':_0x567998,'filename':_0x3cf325[_0xff4a('0x3e')]||_0x567998,'savePath':_0x381bfb})[_0xff4a('0x13')](function(_0x1abff1){_0x1bfcef(null,_0x1abff1);})['catch'](function(_0x474b7f){_0x1bfcef(_0x474b7f);});};AGIVertices[_0xff4a('0x16')][_0xff4a('0x3f')]=function(_0x179033,_0x33c672,_0x29d9e7,_0x3726f7,_0x49899f){this[_0xff4a('0xf')][_0xff4a('0x3f')]({'uniqueid':this['channel']['uniqueid'],'body':_0x179033,'direction':_0x33c672,'providerName':_0x29d9e7,'providerResponse':_0x3726f7})[_0xff4a('0x13')](function(_0xc0c716){if(_0x49899f){_0x49899f(null,_0xc0c716);}})['catch'](function(_0x17b612){if(_0x49899f){_0x49899f(_0x17b612);}});};AGIVertices[_0xff4a('0x16')][_0xff4a('0x40')]=function(_0x4ba203,_0x56fcf6){this['rpc']['createCmContact']({'firstName':_[_0xff4a('0x41')](_0x4ba203[_0xff4a('0x14')])||_[_0xff4a('0x42')](_0x4ba203[_0xff4a('0x14')])?_0xff4a('0x43')+Math[_0xff4a('0x44')]():_0x4ba203[_0xff4a('0x14')],'lastName':_[_0xff4a('0x41')](_0x4ba203[_0xff4a('0x45')])||_[_0xff4a('0x42')](_0x4ba203[_0xff4a('0x45')])?null:_0x4ba203['lastName'],'phone':_0x4ba203[_0xff4a('0x46')],'ListId':_0x4ba203[_0xff4a('0x47')],'scheduledat':_0x4ba203[_0xff4a('0x48')],'callbackUniqueid':this['channel']['uniqueid'],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x4ba203[_0xff4a('0x48')]['toString'](),'priority':_0x4ba203['callback_priority']})[_0xff4a('0x13')](function(_0x5b555d){_0x56fcf6(null,_0x5b555d);})[_0xff4a('0x15')](function(_0x3924a5){_0x56fcf6(_0x3924a5);});};AGIVertices[_0xff4a('0x16')]['getPause']=function(_0x50ab61,_0x9a5d13){this[_0xff4a('0xf')][_0xff4a('0x49')](_0x50ab61)[_0xff4a('0x13')](function(_0x53414d){_0x9a5d13(null,_0x53414d?_0x53414d[_0xff4a('0x14')]:![]);})[_0xff4a('0x15')](function(_0x13ed45){_0x9a5d13(_0x13ed45);});};AGIVertices[_0xff4a('0x16')][_0xff4a('0x4a')]=function(_0x51d84e,_0x43cdbb,_0x380318){var _0x547f03={'role':_0xff4a('0x4b')};_0x547f03[_0x51d84e]=this[_0xff4a('0xe')]['callerid'];this[_0xff4a('0xf')][_0xff4a('0x4a')](_0x547f03,_0x43cdbb,this[_0xff4a('0xe')]['uniqueid'])[_0xff4a('0x13')](function(_0xbb6b86){_0x380318(null,_['isNil'](_0xbb6b86)?![]:!![]);})[_0xff4a('0x15')](function(_0x2a7e07){logger[_0xff4a('0x2b')](_0x2a7e07);_0x380318(null,![]);});};AGIVertices[_0xff4a('0x16')][_0xff4a('0x4c')]=function(_0x36a2cc,_0x11e695){var _0x139188={'role':'agent'};_0x139188[_0x36a2cc]=this[_0xff4a('0xe')][_0xff4a('0x36')];this['rpc']['agentUnpause'](_0x139188)[_0xff4a('0x13')](function(_0xa7df6){_0x11e695(null,_[_0xff4a('0x42')](_0xa7df6)?![]:!![]);})[_0xff4a('0x15')](function(_0x33c0f8){logger['error'](_0x33c0f8);_0x11e695(null,![]);});};AGIVertices[_0xff4a('0x16')][_0xff4a('0x4d')]=function(_0x3ddf7c,_0x40c575){var _0x14ec79={'role':_0xff4a('0x4b')};_0x14ec79[_0x3ddf7c]=this[_0xff4a('0xe')]['callerid'];this[_0xff4a('0xf')][_0xff4a('0x4d')](_0x14ec79)[_0xff4a('0x13')](function(_0x55fefa){_0x40c575(null,_['isNil'](_0x55fefa)?![]:!![]);})[_0xff4a('0x15')](function(_0x10594f){logger[_0xff4a('0x2b')](_0x10594f);_0x40c575(null,![]);});};AGIVertices[_0xff4a('0x16')][_0xff4a('0x4e')]=function(_0x507a8d,_0x3c7248){var _0x37e5b8={'role':_0xff4a('0x4b')};_0x37e5b8[_0x507a8d]=this[_0xff4a('0xe')]['callerid'];var _0xfe7aba=_0x507a8d!=_0xff4a('0x4f')?util[_0xff4a('0x50')](_0xff4a('0x51'),'LOCAL',this[_0xff4a('0xe')][_0xff4a('0x36')]):undefined;this[_0xff4a('0xf')][_0xff4a('0x4e')](_0x37e5b8,_0xfe7aba)[_0xff4a('0x13')](function(_0x34b266){_0x3c7248(null,_[_0xff4a('0x42')](_0x34b266)?![]:!![]);})['catch'](function(_0x1eca6f){logger[_0xff4a('0x2b')](_0x1eca6f);_0x3c7248(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x256de9,_0x3ad9af){sh[_0xff4a('0x52')](_[_0xff4a('0x53')](_0x256de9),function(_0x3b2faf,_0x4cda3a){var _0x488148=_0x4cda3a['replace'](/(\r\n|\n|\r)/gm,'');_0x3ad9af(null,_0x488148);});};AGIVertices[_0xff4a('0x16')][_0xff4a('0x54')]=function(_0x1a9aa7,_0x19daa7){scripts['googleCloudTTS'](_0x1a9aa7[_0xff4a('0x55')],_0x1a9aa7[_0xff4a('0x56')]||_0xff4a('0x57'),_0x1a9aa7[_0xff4a('0x57')],_0x1a9aa7[_0xff4a('0x58')]||'en-US',_0x1a9aa7[_0xff4a('0x59')]||_0xff4a('0x5a'),_0x1a9aa7[_0xff4a('0x5b')]||_0xff4a('0x5c'))[_0xff4a('0x13')](function(_0x4196c9){_0x19daa7(null,_0x4196c9);})[_0xff4a('0x15')](function(_0x29d95a){_0x19daa7(_0x29d95a);});};AGIVertices['prototype'][_0xff4a('0x5d')]=function(_0x1014ce,_0x327c49){scripts[_0xff4a('0x5d')](_0x1014ce[_0xff4a('0x57')],_0x1014ce[_0xff4a('0x5e')]||'en',0x1)[_0xff4a('0x13')](function(_0xf1cb00){_0x327c49(null,_0xf1cb00);})[_0xff4a('0x15')](function(_0x4f09fd){_0x327c49(_0x4f09fd);});};AGIVertices[_0xff4a('0x16')][_0xff4a('0x5f')]=function(_0x3374cb,_0x3dafe3){var _0x2e6aa5={'uri':_0x3374cb[_0xff4a('0x60')],'method':_0x3374cb['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3374cb['timeout'])==='number'&&parseInt(_0x3374cb[_0xff4a('0x61')])>=0x1?parseInt(_0x3374cb[_0xff4a('0x61')])*0x3e8:0x5*0x3e8};if(_[_0xff4a('0x62')]([_0xff4a('0x63'),'PUT'],_0x2e6aa5[_0xff4a('0x64')][_0xff4a('0x65')]())){try{_0x2e6aa5[_0xff4a('0x66')]=_0x3374cb[_0xff4a('0x67')]?JSON['parse'](_0x3374cb[_0xff4a('0x67')]):{};}catch(_0x4a10a1){logger['error'](_0xff4a('0x68'),_0x4a10a1);}}try{_0x2e6aa5[_0xff4a('0x69')]=_0x3374cb['rawHeaders']?JSON[_0xff4a('0x6a')](_0x3374cb[_0xff4a('0x6b')]):{};}catch(_0x5ae70c){logger[_0xff4a('0x2b')](_0xff4a('0x6c'),_0x5ae70c);}if(_0x3374cb['computedVariables']){try{var _0x2d3a81=require(_0x3374cb[_0xff4a('0x6d')])['sync'](this,_0x2e6aa5);_0x2e6aa5[_0xff4a('0x6e')]=Mustache[_0xff4a('0x6f')](_0x3374cb[_0xff4a('0x60')],_0x2d3a81,{},['$$','$$']);if(_0x2e6aa5['headers']){_0x2e6aa5[_0xff4a('0x69')]=JSON['parse'](Mustache['render'](JSON[_0xff4a('0x70')](_0x2e6aa5[_0xff4a('0x69')]),_0x2d3a81,{},['$$','$$']));}if(_0x2e6aa5[_0xff4a('0x66')]){_0x2e6aa5['body']=JSON[_0xff4a('0x6a')](Mustache[_0xff4a('0x6f')](JSON['stringify'](_0x2e6aa5['body']),_0x2d3a81,{},['$$','$$']));}}catch(_0x49bca3){logger[_0xff4a('0x2b')](_0xff4a('0x71'),_0x49bca3);}}rp(_0x2e6aa5)[_0xff4a('0x13')](function(_0x535f89){var _0x1c3231={'statusCode':_0x535f89[_0xff4a('0x72')]||0xc8,'statusMessage':_0x535f89[_0xff4a('0x73')]||'OK','headers':_0x535f89[_0xff4a('0x69')]||{},'body':_0x535f89['body']||{}};_0x3dafe3(null,_0x1c3231);})['catch'](function(_0x15d586){var _0xd0d9f5={'statusCode':_0x15d586[_0xff4a('0x72')]||0x1f4,'statusMessage':_0x15d586[_0xff4a('0x74')]||_0xff4a('0x75'),'headers':_0x15d586['options']['headers']||{},'body':_0x15d586[_0xff4a('0x76')][_0xff4a('0x66')]||{}};_0x3dafe3(null,_0xd0d9f5);});};AGIVertices['prototype'][_0xff4a('0x77')]=function(_0x2890a7,_0x34cef4){scripts[_0xff4a('0x77')](this[_0xff4a('0xe')]['uniqueid'],_0x2890a7[_0xff4a('0x78')],_0x2890a7[_0xff4a('0x57')],_0x2890a7[_0xff4a('0x79')]||'en')['then'](function(_0x5ca4ac){_0x34cef4(null,_0x5ca4ac);})[_0xff4a('0x15')](function(_0x2c6861){_0x34cef4(_0x2c6861);});};AGIVertices[_0xff4a('0x16')]['googleDialogflowV2']=function(_0x68c760,_0x2a52ed){scripts[_0xff4a('0x7a')](this[_0xff4a('0xe')][_0xff4a('0x38')],_0x68c760[_0xff4a('0x7b')],_0x68c760[_0xff4a('0x7c')],_0x68c760[_0xff4a('0x7d')],_0x68c760[_0xff4a('0x57')],_0x68c760[_0xff4a('0x7e')]||'en')[_0xff4a('0x13')](function(_0x31334b){_0x2a52ed(null,_0x31334b);})[_0xff4a('0x15')](function(_0x158f3a){_0x2a52ed(_0x158f3a);});};AGIVertices[_0xff4a('0x16')][_0xff4a('0x7f')]=function(_0x37da12,_0x353361){scripts[_0xff4a('0x7f')](this[_0xff4a('0xe')],_0x37da12)['then'](function(_0x35975c){_0x353361(null,_0x35975c);})[_0xff4a('0x15')](function(_0x1c71bc){_0x353361(_0x1c71bc);});};AGIVertices['prototype'][_0xff4a('0x80')]=function(_0xf2836e,_0x4d8b45){scripts[_0xff4a('0x80')](_0xf2836e[_0xff4a('0x78')],_0xf2836e[_0xff4a('0x57')],_0xf2836e[_0xff4a('0x81')]||_0xff4a('0x82'),_0xf2836e[_0xff4a('0x83')])[_0xff4a('0x13')](function(_0xa86182){_0x4d8b45(null,_0xa86182);})['catch'](function(_0x2d9a7c){_0x4d8b45(_0x2d9a7c);});};AGIVertices[_0xff4a('0x16')]['ispeechASR']=function(_0x55455c,_0xcee094,_0x11e2a2){scripts[_0xff4a('0x84')](_0xcee094,_0x55455c['key'],_0x55455c[_0xff4a('0x85')]||'en-US',this[_0xff4a('0x86')](_0x55455c[_0xff4a('0x87')])?_0x55455c[_0xff4a('0x87')]:undefined)[_0xff4a('0x13')](function(_0x19089c){_0x11e2a2(null,_0x19089c);})['catch'](function(_0x40c431){_0x11e2a2(_0x40c431);});};AGIVertices['prototype'][_0xff4a('0x88')]=function(_0x3862ec,_0x1a4184){scripts[_0xff4a('0x88')](_0x3862ec[_0xff4a('0x89')],_0x3862ec[_0xff4a('0x8a')],_0x3862ec['aws_polly_region'],_0x3862ec[_0xff4a('0x8b')]||_0xff4a('0x8c'),_0x3862ec['text'],_0x3862ec[_0xff4a('0x8d')]||_0xff4a('0x57'))[_0xff4a('0x13')](function(_0x1a0711){_0x1a4184(null,_0x1a0711);})[_0xff4a('0x15')](function(_0x280b9c){_0x1a4184(_0x280b9c);});};AGIVertices[_0xff4a('0x16')][_0xff4a('0x8e')]=function(_0x40fc40,_0x29f5e2){scripts[_0xff4a('0x8e')](this['channel']['uniqueid'],_0x40fc40[_0xff4a('0x89')],_0x40fc40['aws_secret_access_key'],_0x40fc40[_0xff4a('0x8f')],_0x40fc40[_0xff4a('0x57')],_0x40fc40[_0xff4a('0x90')])[_0xff4a('0x13')](function(_0x49dd6f){_0x29f5e2(null,_0x49dd6f);})[_0xff4a('0x15')](function(_0x209d74){_0x29f5e2(_0x209d74);});};AGIVertices[_0xff4a('0x16')][_0xff4a('0x91')]=function(_0x276432,_0x1c04d1,_0x3b7a0f){scripts[_0xff4a('0x91')](_0x1c04d1,_0x276432[_0xff4a('0x78')],_0x276432[_0xff4a('0x92')]||_0xff4a('0x82'))[_0xff4a('0x13')](function(_0x32f502){_0x3b7a0f(null,_0x32f502);})[_0xff4a('0x15')](function(_0x5e2f9c){_0x3b7a0f(_0x5e2f9c);});};AGIVertices[_0xff4a('0x16')][_0xff4a('0x93')]=function(_0x23147d,_0x36feac,_0xdee2c2){scripts['tildeASR'](_0x36feac,_0x23147d[_0xff4a('0x94')],_0x23147d[_0xff4a('0x95')],_0x23147d['uri'])['then'](function(_0x43e74b){_0xdee2c2(null,_0x43e74b);})[_0xff4a('0x15')](function(_0x3e6470){_0xdee2c2(_0x3e6470);});};AGIVertices[_0xff4a('0x16')]['clear']=function(_0x1fd185){var _0x30fb0c=_[_0xff4a('0x62')](verticesWithRetry,_0x1fd185['agicommand'])?_0x1fd185:_[_0xff4a('0x96')](_0x1fd185);for(var _0x19f502 in _0x30fb0c){if(_0x30fb0c[_0xff4a('0x97')](_0x19f502)){if(_0x30fb0c[_0x19f502]&&_[_0xff4a('0x98')](_0x30fb0c[_0x19f502])){if(_[_0xff4a('0x62')](recursiveMapAttributes,_0x19f502)){_0x30fb0c[_0x19f502]=this[_0xff4a('0x99')](_0x30fb0c[_0x19f502]);}else{_0x30fb0c[_0x19f502]=this[_0xff4a('0x9a')](_0x30fb0c[_0x19f502]);}}}}return _0x30fb0c;};AGIVertices[_0xff4a('0x16')][_0xff4a('0x9b')]=function(_0xdb920d){for(var _0x4ca469 in _0xdb920d){if(_0xdb920d[_0xff4a('0x97')](_0x4ca469)){if(_[_0xff4a('0x9c')](_0xdb920d[_0x4ca469])){this['recursiveNodeIndex'](_0xdb920d[_0x4ca469]);}else if(_[_0xff4a('0x9d')](_0xdb920d[_0x4ca469])){for(var _0x9917e3=0x0;_0x9917e3<_0xdb920d[_0x4ca469][_0xff4a('0x9e')];_0x9917e3++){this[_0xff4a('0x9b')](_0xdb920d[_0x4ca469][_0x9917e3]);}}else if(_[_0xff4a('0x98')](_0xdb920d[_0x4ca469])){_0xdb920d[_0x4ca469]=this['replaceAllVariables'](_0xdb920d[_0x4ca469]);}}}};AGIVertices[_0xff4a('0x16')][_0xff4a('0x9f')]=function(_0x2ef753,_0x4462cb){for(var _0x2bccde in _0x2ef753){if(_0x2ef753[_0xff4a('0x97')](_0x2bccde)){if(_['isPlainObject'](_0x2ef753[_0x2bccde])){if(!_['isEmpty'](_0x2ef753[_0x2bccde])){this[_0xff4a('0x9f')](_0x2ef753[_0x2bccde],util['format'](_0xff4a('0xa0'),_0x4462cb,_0x2bccde));}}else if(_['isArray'](_0x2ef753[_0x2bccde])){for(var _0x2c85c7=0x0;_0x2c85c7<_0x2ef753[_0x2bccde]['length'];_0x2c85c7++){this['saveRestApiResult'](_0x2ef753[_0x2bccde][_0x2c85c7],util[_0xff4a('0x50')](_0xff4a('0xa0'),_0x4462cb,_0x2bccde+'['+_0x2c85c7+']'));}}else{if(!_[_0xff4a('0x42')](_0x2ef753[_0x2bccde])){this['channel'][_0xff4a('0xa1')](util['format'](_0xff4a('0xa0'),_0x4462cb,_0x2bccde),_0x2ef753[_0x2bccde]);}}}}};AGIVertices[_0xff4a('0x16')][_0xff4a('0x99')]=function(_0x48ea85){try{var _0x31f921=JSON[_0xff4a('0x6a')](_0x48ea85);this[_0xff4a('0x9b')](_0x31f921);return JSON[_0xff4a('0x70')](_0x31f921);}catch(_0x4e3a8b){return this[_0xff4a('0x9a')](_0x48ea85);}};AGIVertices[_0xff4a('0x16')][_0xff4a('0x9a')]=function(_0x7eafff){var _0x91103f=_0x7eafff[_0xff4a('0xa2')]('{');for(var _0x5f0891=0x1;_0x5f0891<_0x91103f[_0xff4a('0x9e')];_0x5f0891+=0x1){var _0x4d0bb7=_0x91103f[_0x5f0891][_0xff4a('0xa2')]('}');if(_0x4d0bb7[_0xff4a('0x9e')]>0x1){_0x7eafff=_0x7eafff[_0xff4a('0xa3')]('{'+_0x4d0bb7[0x0]+'}',this[_0xff4a('0xe')][_0xff4a('0x11')](_0x4d0bb7[0x0])['extra']||_0x4d0bb7[0x0]);}}if(_0x91103f[_0xff4a('0x9e')]===0x1){return _0x7eafff[_0xff4a('0xa4')]();}return this[_0xff4a('0x9a')](_0x7eafff);};AGIVertices[_0xff4a('0x16')][_0xff4a('0xa5')]=function(_0x481893,_0x42ea6){var _0x1e675b=this['channel'][_0xff4a('0x11')](_0x481893);if(_0x1e675b['result']===-0x1){return _0x1e675b;}logger[_0xff4a('0x2e')](util[_0xff4a('0x50')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x42ea6,_0x1e675b[_0xff4a('0xa6')]));return this[_0xff4a('0xe')][_0xff4a('0xa1')](_0x42ea6,_0x1e675b[_0xff4a('0xa6')]);};AGIVertices[_0xff4a('0x16')][_0xff4a('0x86')]=function(_0x754348){return _0x754348&&_0x754348!=='0'&&_0x754348!=='-1'&&_0x754348!=='';};AGIVertices['prototype'][_0xff4a('0xa7')]=function(_0x295d97){this[_0xff4a('0xa8')][_0xff4a('0xa9')](this,_0x295d97,'-');_0x295d97[_0xff4a('0xaa')]=_0x295d97[_0xff4a('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xff4a('0x16')][_0xff4a('0xab')]=function(_0x3dab3f){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0xac'),_0x3dab3f[_0xff4a('0x33')]));if(!this[_0xff4a('0x86')](_0x3dab3f[_0xff4a('0x57')])){return this[_0xff4a('0xe')]['noop'](_0xff4a('0xad'));}var _0x57bc89='\x22'+_0x3dab3f[_0xff4a('0x57')]+'\x22';if(this[_0xff4a('0x86')](_0x3dab3f[_0xff4a('0x76')])){_0x57bc89+=','+_0x3dab3f[_0xff4a('0x76')];}var _0x3d6f5d=this[_0xff4a('0xe')][_0xff4a('0x52')](_0xff4a('0xae'),_0x57bc89);if(_0x3d6f5d[_0xff4a('0xaf')]===-0x1){return _0x3d6f5d;}return this[_0xff4a('0xe')][_0xff4a('0xb0')](util['format'](_0xff4a('0xb1'),_0x57bc89));};AGIVertices[_0xff4a('0x16')][_0xff4a('0xb2')]=function(_0x39e349){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0xb3'),_0x39e349[_0xff4a('0x33')]));if(!this[_0xff4a('0x86')](_0x39e349[_0xff4a('0xb4')])){return this[_0xff4a('0xe')][_0xff4a('0xb0')](_0xff4a('0xb5'));}var _0x5498a8=_0x39e349['grammar'];if(this[_0xff4a('0x86')](_0x39e349[_0xff4a('0x76')])){_0x5498a8+=','+_0x39e349[_0xff4a('0x76')];}var _0x2eb13a=this['channel'][_0xff4a('0x52')](_0xff4a('0xb6'),_0x5498a8);if(_0x2eb13a[_0xff4a('0xaf')]===-0x1){return _0x2eb13a;}var _0x5dd0e2=this['getAndSetVariable'](_0xff4a('0xb7'),_0xff4a('0xb8'));if(_0x5dd0e2[_0xff4a('0xaf')]===-0x1){return _0x5dd0e2;}var _0x310329=this[_0xff4a('0xa5')](_0xff4a('0xb9'),_0xff4a('0xba'));if(_0x310329[_0xff4a('0xaf')]===-0x1){return _0x310329;}var _0x93cabd=this[_0xff4a('0xa5')]('RECOG_INSTANCE()',_0xff4a('0xbb'));if(_0x93cabd[_0xff4a('0xaf')]===-0x1){return _0x93cabd;}return this[_0xff4a('0xe')][_0xff4a('0xb0')](util['format'](_0xff4a('0xbc'),_0x5498a8));};AGIVertices[_0xff4a('0x16')][_0xff4a('0xbd')]=function(_0x574b8b){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0xbe'),_0x574b8b[_0xff4a('0x33')]));return this[_0xff4a('0xe')][_0xff4a('0xbd')]([_0x574b8b[_0xff4a('0xbf')],_0x574b8b['args']]);};AGIVertices[_0xff4a('0x16')][_0xff4a('0xc0')]=function(_0x153577){logger[_0xff4a('0x2e')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x153577[_0xff4a('0x33')]));if(this[_0xff4a('0x86')](_0x153577[_0xff4a('0x61')])){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x153577[_0xff4a('0x61')]));var _0x4a4730=this[_0xff4a('0xe')][_0xff4a('0xc1')](_0x153577[_0xff4a('0x61')]);if(_0x4a4730['result']===-0x1){return _0x4a4730;}}return this[_0xff4a('0xe')][_0xff4a('0xc0')]();};AGIVertices[_0xff4a('0x16')]['callback']=function(_0x34aee6){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0xc2'),_0x34aee6[_0xff4a('0x33')]));if(!this[_0xff4a('0x86')](_0x34aee6['list_id'])){return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0x34aee6,'no\x20list\x20selected');}_0x34aee6[_0xff4a('0x48')]=moment();if(this[_0xff4a('0x86')](_0x34aee6[_0xff4a('0xc3')])){_0x34aee6[_0xff4a('0x48')]=moment()[_0xff4a('0xc4')](_0x34aee6['delay'],_0xff4a('0xc5'));}if(!this[_0xff4a('0x86')](_0x34aee6['callback_priority'])){_0x34aee6[_0xff4a('0xc6')]=0x2;}this[_0xff4a('0x40')]['sync'](this,_0x34aee6);return this[_0xff4a('0xe')][_0xff4a('0xb0')](util[_0xff4a('0x50')](_0xff4a('0xc7'),_0x34aee6['phone'],_0x34aee6['list_id'],_0x34aee6[_0xff4a('0x48')]));};AGIVertices[_0xff4a('0x16')]['custom_app']=function(_0x457772){logger[_0xff4a('0x2e')](util['format'](_0xff4a('0xc8'),_0x457772['label']));var _0x308e10=this[_0xff4a('0xe')][_0xff4a('0x52')](_0x457772[_0xff4a('0xc9')],_0x457772['options']);if(_0x308e10[_0xff4a('0xaf')]===-0x1){return _0x308e10;}return this['channel'][_0xff4a('0xb0')](util['format']('Executed\x20command\x20%s\x20%s',_0x457772[_0xff4a('0xc9')],_0x457772[_0xff4a('0x76')]));};AGIVertices[_0xff4a('0x16')][_0xff4a('0xca')]=function(_0x1d208c){logger[_0xff4a('0x2e')](util['format'](_0xff4a('0xcb'),_0x1d208c[_0xff4a('0x33')]));if(!this[_0xff4a('0x86')](_0x1d208c[_0xff4a('0x57')])){return this[_0xff4a('0xe')][_0xff4a('0xb0')]('no\x20text\x20configured');}var _0x1f0d23='\x22'+_0x1d208c[_0xff4a('0x57')]+'\x22';if(this[_0xff4a('0x86')](_0x1d208c[_0xff4a('0x76')])){_0x1f0d23+=','+_0x1d208c[_0xff4a('0x76')];}var _0x3d110f=this['channel'][_0xff4a('0x52')](_0xff4a('0xae'),_0x1f0d23);if(_0x3d110f[_0xff4a('0xaf')]===-0x1){return _0x3d110f;}return this[_0xff4a('0xe')][_0xff4a('0xb0')](util['format'](_0xff4a('0xb1'),_0x1f0d23));};AGIVertices[_0xff4a('0x16')]['sestektts']=function(_0x29c612){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0xcc'),_0x29c612[_0xff4a('0x33')]));if(!this[_0xff4a('0x86')](_0x29c612[_0xff4a('0x57')])){return this[_0xff4a('0xe')][_0xff4a('0xb0')](_0xff4a('0xad'));}var _0x125ab4='\x22'+_0x29c612[_0xff4a('0x57')]+'\x22';if(this[_0xff4a('0x86')](_0x29c612['options'])){_0x125ab4+=','+_0x29c612[_0xff4a('0x76')];}var _0x5ccbc2=this['channel'][_0xff4a('0x52')](_0xff4a('0xae'),_0x125ab4);if(_0x5ccbc2['result']===-0x1){return _0x5ccbc2;}return this[_0xff4a('0xe')][_0xff4a('0xb0')](util[_0xff4a('0x50')]('Executed\x20command\x20MRCPSynth\x20%s',_0x125ab4));};AGIVertices['prototype'][_0xff4a('0xcd')]=function(_0x32e974){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0xce'),_0x32e974[_0xff4a('0x33')]));if(!this[_0xff4a('0x86')](_0x32e974[_0xff4a('0xb4')])){return this[_0xff4a('0xe')][_0xff4a('0xb0')](_0xff4a('0xb5'));}var _0x34ec80=_0x32e974[_0xff4a('0xb4')];if(this['isConfigured'](_0x32e974[_0xff4a('0x76')])){_0x34ec80+=','+_0x32e974['options'];}var _0x5b38ee=this[_0xff4a('0xe')][_0xff4a('0x52')]('MRCPRecog',_0x34ec80);if(_0x5b38ee[_0xff4a('0xaf')]===-0x1){return _0x5b38ee;}var _0x23ec09=this[_0xff4a('0xa5')](_0xff4a('0xb7'),_0xff4a('0xcf'));if(_0x23ec09[_0xff4a('0xaf')]===-0x1){return _0x23ec09;}var _0x180f6e=this[_0xff4a('0xa5')](_0xff4a('0xb9'),_0xff4a('0xd0'));if(_0x180f6e[_0xff4a('0xaf')]===-0x1){return _0x180f6e;}var _0x532792=this[_0xff4a('0xa5')]('RECOG_INSTANCE()',_0xff4a('0xd1'));if(_0x532792[_0xff4a('0xaf')]===-0x1){return _0x532792;}return this[_0xff4a('0xe')][_0xff4a('0xb0')](util[_0xff4a('0x50')](_0xff4a('0xbc'),_0x34ec80));};AGIVertices['prototype'][_0xff4a('0xd2')]=function(_0x1e5111){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0xd3'),_0x1e5111[_0xff4a('0x33')]));if(!this[_0xff4a('0x86')](_0x1e5111[_0xff4a('0xb4')])){return this[_0xff4a('0xe')][_0xff4a('0xb0')](_0xff4a('0xb5'));}var _0x4f1334=_0x1e5111[_0xff4a('0xb4')];if(this[_0xff4a('0x86')](_0x1e5111[_0xff4a('0x76')])){_0x4f1334+=','+_0x1e5111[_0xff4a('0x76')];}var _0xa431e2=this[_0xff4a('0xe')][_0xff4a('0x52')](_0xff4a('0xb6'),_0x4f1334);if(_0xa431e2[_0xff4a('0xaf')]===-0x1){return _0xa431e2;}var _0xba8507=this['getAndSetVariable'](_0xff4a('0xb7'),'SESTEK_ASR_CONFIDENCE');if(_0xba8507[_0xff4a('0xaf')]===-0x1){return _0xba8507;}var _0x5287f1=this[_0xff4a('0xa5')](_0xff4a('0xb9'),_0xff4a('0xd4'));if(_0x5287f1['result']===-0x1){return _0x5287f1;}var _0x38c798=this[_0xff4a('0xa5')](_0xff4a('0xd5'),'SESTEK_ASR_INSTANCE');if(_0x38c798[_0xff4a('0xaf')]===-0x1){return _0x38c798;}return this[_0xff4a('0xe')]['noop'](util[_0xff4a('0x50')]('Executed\x20command\x20MRCPRecog\x20%s',_0x4f1334));};AGIVertices[_0xff4a('0x16')][_0xff4a('0xd6')]=function(_0x4bb77b){logger['info'](util[_0xff4a('0x50')](_0xff4a('0xd7'),_0x4bb77b[_0xff4a('0x33')]));if(!this[_0xff4a('0x86')](_0x4bb77b['odbc_id'])){return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0x4bb77b,'no\x20database\x20selected');}var _0xb1b1b5=this['getSquareOdbc']['sync'](this,_0x4bb77b[_0xff4a('0xd8')]);if(!_0xb1b1b5){return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0x4bb77b,'no\x20odbc\x20database\x20found');}if(!this[_0xff4a('0x86')](_0x4bb77b[_0xff4a('0xd9')])){return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0x4bb77b,'no\x20query\x20configured');}var _0xcef0ff=_0x4bb77b[_0xff4a('0xd9')][_0xff4a('0xda')](/(\r\n|\n|\r)/gm,'\x20');this[_0xff4a('0xe')][_0xff4a('0xb0')](util['format']('query:\x20%s',_0xcef0ff));var _0x1ad06e=this[_0xff4a('0xdb')]['sync'](this,_0xb1b1b5,_0xcef0ff);this[_0xff4a('0xa8')][_0xff4a('0xa9')](this,_0x4bb77b,_0xcef0ff);if(!this[_0xff4a('0x86')](_0x4bb77b[_0xff4a('0xdc')])){return this[_0xff4a('0xe')][_0xff4a('0xb0')](_0xff4a('0xdd'));}var _0x1436a3=this['getVariable']['sync'](this,_0x4bb77b['variable_id']);if(!_0x1436a3){return this['channel'][_0xff4a('0x2b')](_0x4bb77b,'no\x20variable\x20found');}var _0x37e781=this;_0x1ad06e[_0xff4a('0xde')](function(_0x3c60a5,_0x5d0443){Object['keys'](_0x3c60a5)[_0xff4a('0xde')](function(_0x42281a){_0x37e781['channel'][_0xff4a('0xa1')](util[_0xff4a('0x50')]('%s[%s][%s]',_0x1436a3,_0x5d0443,_0x42281a),_0x3c60a5[_0x42281a]);});});this[_0xff4a('0xe')][_0xff4a('0xa1')](util[_0xff4a('0x50')](_0xff4a('0xdf'),_0x1436a3),_0x1ad06e[_0xff4a('0x9e')]);return this[_0xff4a('0xe')][_0xff4a('0xb0')](util[_0xff4a('0x50')](_0xff4a('0xe0'),_0x1436a3));};AGIVertices[_0xff4a('0x16')][_0xff4a('0xe1')]=function(_0x4bb458){logger['debug'](util[_0xff4a('0x50')](_0xff4a('0xe2'),_0x4bb458[_0xff4a('0x33')]));if(!this[_0xff4a('0x86')](_0x4bb458['sip_id'])){return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0x4bb458,_0xff4a('0xe3'));}var _0x1de7c4=this['getUser']['sync'](this,_0x4bb458[_0xff4a('0xe4')]);if(!_0x1de7c4){return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0x4bb458,_0xff4a('0xe5'));}var _0x31ad49=this[_0xff4a('0xe')][_0xff4a('0x52')](_0xff4a('0xe6'),[util[_0xff4a('0x50')](_0xff4a('0xe7'),_0x1de7c4),_0x4bb458[_0xff4a('0x61')],_0x4bb458[_0xff4a('0xe8')],_0x4bb458[_0xff4a('0x60')]]);if(_0x31ad49[_0xff4a('0xaf')]===-0x1){return _0x31ad49;}return this['channel'][_0xff4a('0xb0')](util[_0xff4a('0x50')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0xff4a('0x16')][_0xff4a('0xe9')]=function(_0x94d265){logger['info'](util[_0xff4a('0x50')](_0xff4a('0xea'),_0x94d265[_0xff4a('0x33')]));if(!this[_0xff4a('0x86')](_0x94d265[_0xff4a('0x78')])){return this[_0xff4a('0xe')][_0xff4a('0xb0')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x94d265[_0xff4a('0x57')])){return this['channel'][_0xff4a('0xb0')](_0xff4a('0xad'));}this[_0xff4a('0xe')][_0xff4a('0xeb')]=!![];this['createSquareDetailsReport'](_0x94d265);this[_0xff4a('0x3f')](_0x94d265[_0xff4a('0x57')],'in','','');this[_0xff4a('0xe')][_0xff4a('0xb0')](util[_0xff4a('0x50')](_0xff4a('0xec'),_0x94d265[_0xff4a('0x57')]));var _0x3380bf=this[_0xff4a('0x77')][_0xff4a('0xa9')](this,_0x94d265);if(_0x3380bf){for(var _0x59a52e in _0x3380bf){if(_0x3380bf[_0xff4a('0x97')](_0x59a52e)){this[_0xff4a('0xe')][_0xff4a('0xa1')](util['format'](_0xff4a('0xed'),_0x59a52e['toUpperCase']()),_0x3380bf[_0x59a52e]);}}this[_0xff4a('0x3f')](_0x3380bf['speech'],_0xff4a('0xee'),_0xff4a('0xe9'),'');return this[_0xff4a('0xe')][_0xff4a('0xb0')](util[_0xff4a('0x50')](_0xff4a('0xef'),_0x3380bf[_0xff4a('0xf0')]));}return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0x94d265,_0xff4a('0xf1'));};AGIVertices[_0xff4a('0x16')]['dialogflowV2']=function(_0xf3535a){logger[_0xff4a('0x2e')](util['format'](_0xff4a('0xf2'),_0xf3535a[_0xff4a('0x33')]));if(!this['isConfigured'](_0xf3535a[_0xff4a('0x7b')])){return this['channel'][_0xff4a('0xb0')](_0xff4a('0xf3'));}if(!this['isConfigured'](_0xf3535a['client_email'])){return this[_0xff4a('0xe')][_0xff4a('0xb0')](_0xff4a('0xf4'));}if(!this[_0xff4a('0x86')](_0xf3535a[_0xff4a('0x7d')])){return this[_0xff4a('0xe')][_0xff4a('0xb0')](_0xff4a('0xf5'));}if(!this[_0xff4a('0x86')](_0xf3535a[_0xff4a('0x7e')])){return this['channel'][_0xff4a('0xb0')](_0xff4a('0xf6'));}if(!this['isConfigured'](_0xf3535a['text'])){return this['channel'][_0xff4a('0xb0')](_0xff4a('0xad'));}this[_0xff4a('0xe')][_0xff4a('0xeb')]=!![];this[_0xff4a('0xa8')](_0xf3535a);this[_0xff4a('0x3f')](_0xf3535a[_0xff4a('0x57')],'in','','');this[_0xff4a('0xe')][_0xff4a('0xb0')](util['format'](_0xff4a('0xf7'),_0xf3535a['text']));var _0x216d65=this[_0xff4a('0x7a')][_0xff4a('0xa9')](this,_0xf3535a);if(_0x216d65){for(var _0x5b24ab in _0x216d65){if(_0x216d65[_0xff4a('0x97')](_0x5b24ab)){if(_0x5b24ab!==_0xff4a('0xf8')){this['channel'][_0xff4a('0xa1')](util[_0xff4a('0x50')](_0xff4a('0xed'),_0x5b24ab[_0xff4a('0x65')]()),_0x216d65[_0x5b24ab]);}}}this[_0xff4a('0x3f')](_0x216d65['speech'],_0xff4a('0xee'),_0xff4a('0xf9'),_0x216d65[_0xff4a('0xf8')]);return this['channel'][_0xff4a('0xb0')](util['format'](_0xff4a('0xfa'),_0x216d65[_0xff4a('0xf0')]));}return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0xf3535a,_0xff4a('0xfb'));};AGIVertices[_0xff4a('0x16')][_0xff4a('0xfc')]=function(_0x147641){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x147641[_0xff4a('0x33')]));if(!this[_0xff4a('0x86')](_0x147641['ndauth_url'])){return this[_0xff4a('0xe')]['noop'](_0xff4a('0xfd'));}if(!this['isConfigured'](_0x147641[_0xff4a('0xfe')])){return this[_0xff4a('0xe')][_0xff4a('0xb0')](_0xff4a('0xff'));}if(!this[_0xff4a('0x86')](_0x147641[_0xff4a('0x100')])){return this['channel'][_0xff4a('0xb0')](_0xff4a('0x101'));}if(!this[_0xff4a('0x86')](_0x147641[_0xff4a('0x102')])){return this['channel'][_0xff4a('0xb0')]('no\x20text\x20configured');}this['channel'][_0xff4a('0xeb')]=!![];this[_0xff4a('0xa8')](_0x147641);this['createSquareMessage'](_0x147641['text'],'in','','');this['channel']['noop'](util[_0xff4a('0x50')]('Trying\x20SestekNDA:\x20%s',_0x147641[_0xff4a('0x57')]));var _0x3cc2cd=this[_0xff4a('0x7f')][_0xff4a('0xa9')](this,_0x147641);if(_0x3cc2cd){for(var _0xc5347c in _0x3cc2cd){if(_0x3cc2cd[_0xff4a('0x97')](_0xc5347c)){this[_0xff4a('0xe')][_0xff4a('0xa1')](util[_0xff4a('0x50')](_0xff4a('0x103'),_0xc5347c[_0xff4a('0x65')]()),_0x3cc2cd[_0xc5347c]);}}this[_0xff4a('0x3f')](_0x3cc2cd['speech'],_0xff4a('0xee'),_0xff4a('0xfc'),'');if(_0x3cc2cd[_0xff4a('0x104')]){this[_0xff4a('0xe')][_0xff4a('0xb0')](util['format'](_0xff4a('0x105'),_0x3cc2cd[_0xff4a('0x104')]));var _0x10f27b=this[_0xff4a('0xe')][_0xff4a('0x106')](_0x3cc2cd[_0xff4a('0x104')]);try{fs[_0xff4a('0x107')](_0x3cc2cd[_0xff4a('0x104')]+'.wav');}catch(_0x36b1fa){logger[_0xff4a('0x2b')](_0x36b1fa);}return _0x10f27b;}else{return this[_0xff4a('0xe')][_0xff4a('0xb0')](util[_0xff4a('0x50')]('SestekNDA\x20Result\x20%s',_0x3cc2cd[_0xff4a('0xf0')]));}}return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0x147641,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xff4a('0x16')][_0xff4a('0x108')]=function(_0xa97f09){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0x109'),_0xa97f09['label']));return this[_0xff4a('0xe')][_0xff4a('0xb0')](_0xff4a('0x108'));};AGIVertices[_0xff4a('0x16')]['ext_dial']=function(_0xfd5dda){logger[_0xff4a('0x2e')](util['format'](_0xff4a('0x10a'),_0xfd5dda[_0xff4a('0x33')]));var _0x480729='';if(_0xfd5dda['trunk_id']){if(!this['isConfigured'](_0xfd5dda['trunk_id'])){return this['channel'][_0xff4a('0x2b')](_0xfd5dda,'no\x20trunk\x20selected');}else{var _0x2071ae=parseInt(_0xfd5dda[_0xff4a('0x10b')],0xa);if(isNaN(_0x2071ae)){_0x480729=_0xfd5dda[_0xff4a('0x10b')];}else{_0x480729=this[_0xff4a('0x1c')][_0xff4a('0xa9')](this,_0xfd5dda[_0xff4a('0x10b')]);if(!_0x480729){return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0xfd5dda,_0xff4a('0x10c'));}}}}else if(_0xfd5dda[_0xff4a('0x10d')]){_0x480729=_0xfd5dda[_0xff4a('0x10d')];}else{return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0xfd5dda,_0xff4a('0x10e'));}var _0x35da99=this['channel'][_0xff4a('0x52')](_0xff4a('0xe6'),[util[_0xff4a('0x50')](_0xff4a('0x10f'),_0x480729,_0xfd5dda[_0xff4a('0x46')]),_0xfd5dda[_0xff4a('0x61')],_0xfd5dda[_0xff4a('0xe8')],_0xfd5dda[_0xff4a('0x60')]]);if(_0x35da99[_0xff4a('0xaf')]===-0x1){return _0x35da99;}return this['channel'][_0xff4a('0xb0')](util[_0xff4a('0x50')]('Executed\x20command\x20%s',_0xff4a('0xe6')));};AGIVertices[_0xff4a('0x16')][_0xff4a('0x110')]=function(_0x13721c){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0x111'),_0x13721c[_0xff4a('0x33')]));return this[_0xff4a('0xe')][_0xff4a('0xb0')](_0xff4a('0x110'));};AGIVertices[_0xff4a('0x16')][_0xff4a('0xc')]=function(_0xd39e94){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0x112'),_0xd39e94[_0xff4a('0x33')]));if(_0xd39e94[_0xff4a('0xaa')]===0x0){return this[_0xff4a('0xa7')](_0xd39e94);}_0xd39e94[_0xff4a('0xaa')]-=0x1;if(!this[_0xff4a('0x86')](_0xd39e94[_0xff4a('0x113')])){return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0xd39e94,'no\x20file\x20audio\x20selected');}var _0x3f7b9b=this['getSound'][_0xff4a('0xa9')](this,_0xd39e94['file_id']);if(!_0x3f7b9b){return this['channel'][_0xff4a('0x2b')](_0xd39e94,_0xff4a('0x114'));}if(!this[_0xff4a('0x86')](_0xd39e94[_0xff4a('0xdc')])){return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0xff4a('0xdd'));}var _0x411120=this[_0xff4a('0xe')][_0xff4a('0x115')](_0x3f7b9b,_0xd39e94[_0xff4a('0x116')],_0xd39e94['maxdigit']);var _0x61bf2f=_0x411120[_0xff4a('0xaf')]?_0x411120[_0xff4a('0xaf')][_0xff4a('0xa4')]():'';logger[_0xff4a('0x2e')]('test',JSON[_0xff4a('0x70')](_0x411120));if(_0x411120['result']===-0x1){this['createSquareDetailsReport'][_0xff4a('0xa9')](this,_0xd39e94,_0x61bf2f);return _0x411120;}else if(_0x411120[_0xff4a('0xa6')]==='timeout'){_0x411120[_0xff4a('0xaf')]=_0x61bf2f['length']>=parseInt(_0xd39e94[_0xff4a('0x117')])?'x':'i';}else{_0x411120[_0xff4a('0xaf')]=_0x61bf2f[_0xff4a('0x9e')]>=parseInt(_0xd39e94['mindigit'])&&_0x61bf2f['length']<=parseInt(_0xd39e94[_0xff4a('0x118')])?'x':'i';}var _0x250075=this['getVariable'][_0xff4a('0xa9')](this,_0xd39e94['variable_id']);if(!_0x250075){return this['channel']['error'](_0xd39e94,_0xff4a('0x119'));}this[_0xff4a('0xe')][_0xff4a('0xa1')](_0x250075,_0x61bf2f);if(this[_0xff4a('0x86')](_0xd39e94[_0xff4a('0x11a')])){var _0x1b373f=parseInt(_0xd39e94[_0xff4a('0x11a')],0xa);var _0x2faefb=rs[_0xff4a('0x11b')]({'charset':'*','length':_0x1b373f});var _0x5d602c=_0x61bf2f[_0xff4a('0x9e')];if(_0x5d602c>0x0){if(_0x5d602c>_0x1b373f){this['createSquareDetailsReport']['sync'](this,_0xd39e94,_0xd39e94['hiddendigitspos']===_0xff4a('0x11c')?_0x2faefb+_0x61bf2f['substr'](_0x1b373f):_0x61bf2f[_0xff4a('0x11d')](0x0,_0x5d602c-_0x1b373f)+_0x2faefb);}else{this['createSquareDetailsReport'][_0xff4a('0xa9')](this,_0xd39e94,rs[_0xff4a('0x11b')]({'charset':'*','length':_0x5d602c}));}}else{this[_0xff4a('0xa8')][_0xff4a('0xa9')](this,_0xd39e94,'');}}else{this['createSquareDetailsReport'][_0xff4a('0xa9')](this,_0xd39e94,_0x61bf2f);}return _0x411120;};AGIVertices[_0xff4a('0x16')][_0xff4a('0xd')]=function(_0x75002d){logger[_0xff4a('0x2e')](util['format'](_0xff4a('0x11e'),_0x75002d[_0xff4a('0x33')]));return this[_0xff4a('0xc')](_0x75002d);};AGIVertices['prototype'][_0xff4a('0x11f')]=function(_0x52f37f){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0x120'),_0x52f37f['label']));this[_0xff4a('0xa8')][_0xff4a('0xa9')](this,_0x52f37f,_0x52f37f[_0xff4a('0x121')]);return this[_0xff4a('0xe')][_0xff4a('0xb0')](util[_0xff4a('0x50')](_0xff4a('0x122'),_0x52f37f[_0xff4a('0x121')]));};AGIVertices['prototype'][_0xff4a('0x123')]=function(_0x3c8984){logger['info'](util['format'](_0xff4a('0x124'),_0x3c8984['label']));if(!this[_0xff4a('0x86')](_0x3c8984['aws_access_key_id'])||!this['isConfigured'](_0x3c8984[_0xff4a('0x8a')])){return this[_0xff4a('0xe')][_0xff4a('0xb0')](_0xff4a('0x125'));}if(!this[_0xff4a('0x86')](_0x3c8984['text'])){return this[_0xff4a('0xe')][_0xff4a('0xb0')](_0xff4a('0xad'));}this[_0xff4a('0xe')][_0xff4a('0xb0')](util[_0xff4a('0x50')](_0xff4a('0x126'),_0x3c8984[_0xff4a('0x57')]));var _0x50efe2=this[_0xff4a('0x88')][_0xff4a('0xa9')](this,_0x3c8984);if(_0x50efe2){this['channel'][_0xff4a('0xb0')](util['format'](_0xff4a('0x127'),_0x50efe2));var _0x55d538=this['channel'][_0xff4a('0x106')](_0x50efe2);try{fs['unlink'](_0x50efe2+_0xff4a('0x128'));}catch(_0x370302){logger[_0xff4a('0x2b')](_0x370302);}return _0x55d538;}return this[_0xff4a('0xe')]['error'](_0x3c8984,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0xff4a('0x129')]=function(_0x5cd3ef){logger[_0xff4a('0x2e')](util['format'](_0xff4a('0x12a'),_0x5cd3ef[_0xff4a('0x33')]));if(!this[_0xff4a('0x86')](_0x5cd3ef['aws_access_key_id'])||!this['isConfigured'](_0x5cd3ef[_0xff4a('0x8a')])){return this[_0xff4a('0xe')][_0xff4a('0xb0')](_0xff4a('0x125'));}if(!this['isConfigured'](_0x5cd3ef[_0xff4a('0x90')])){return this[_0xff4a('0xe')][_0xff4a('0xb0')]('no\x20bot\x20name\x20configured');}if(!this[_0xff4a('0x86')](_0x5cd3ef[_0xff4a('0x57')])){return this[_0xff4a('0xe')][_0xff4a('0xb0')]('no\x20text\x20configured');}this[_0xff4a('0xe')][_0xff4a('0xeb')]=!![];this[_0xff4a('0xa8')](_0x5cd3ef);this[_0xff4a('0x3f')](_0x5cd3ef['text'],'in','','');this[_0xff4a('0xe')][_0xff4a('0xb0')](util['format'](_0xff4a('0x12b'),_0x5cd3ef[_0xff4a('0x57')]));var _0x3fee20=this[_0xff4a('0x8e')][_0xff4a('0xa9')](this,_0x5cd3ef);if(_0x3fee20){for(var _0x418cdc in _0x3fee20){if(_0x3fee20[_0xff4a('0x97')](_0x418cdc)&&_[_0xff4a('0x98')](_0x3fee20[_0x418cdc])){this[_0xff4a('0xe')][_0xff4a('0xa1')](util[_0xff4a('0x50')](_0xff4a('0x12c'),_0x418cdc[_0xff4a('0x65')]()),_0x3fee20[_0x418cdc]);}}if(_[_0xff4a('0x42')](_0x3fee20[_0xff4a('0x74')])){return this['channel'][_0xff4a('0xb0')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x3fee20[_0xff4a('0x74')],_0xff4a('0xee'),_0xff4a('0x12d'),'');return this[_0xff4a('0xe')]['noop'](util['format'](_0xff4a('0x12e'),_0x3fee20[_0xff4a('0x74')]));}}return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0x5cd3ef,_0xff4a('0x12f'));};AGIVertices[_0xff4a('0x16')]['googleasr']=function(_0xd11b5b){logger['info'](util[_0xff4a('0x50')](_0xff4a('0x130'),_0xd11b5b[_0xff4a('0x33')],_0xd11b5b['timeout']));if(!this[_0xff4a('0x86')](_0xd11b5b[_0xff4a('0x78')])){return this[_0xff4a('0xe')][_0xff4a('0xb0')](_0xff4a('0x131'));}var _0xc2aafd='wav';var _0x48ce89=util[_0xff4a('0x50')]('%s/recordings/%s',FILES_PATH,rs[_0xff4a('0x11b')](0x4));var _0x2acf31=util[_0xff4a('0x50')](_0xff4a('0xa0'),_0x48ce89,_0xc2aafd);var _0x27422d=!![];if(_0xd11b5b[_0xff4a('0x132')]===_0xff4a('0x133')){_0x27422d=![];}var _0x4fd356=this['channel'][_0xff4a('0x134')](_0x48ce89,_0xc2aafd,_0xd11b5b[_0xff4a('0x135')],_0xd11b5b[_0xff4a('0x61')],undefined,_0x27422d);if(_0x4fd356[_0xff4a('0xaf')]!==-0x1){this[_0xff4a('0xe')][_0xff4a('0xb0')](util[_0xff4a('0x50')](_0xff4a('0x136'),_0x2acf31));var _0x329dcc=this[_0xff4a('0x91')][_0xff4a('0xa9')](this,_0xd11b5b,_0x2acf31);if(_0x329dcc){for(var _0x2bac73 in _0x329dcc){if(_0x329dcc[_0xff4a('0x97')](_0x2bac73)){this[_0xff4a('0xe')][_0xff4a('0xa1')](util['format'](_0xff4a('0x137'),_0x2bac73[_0xff4a('0x65')]()),_0x329dcc[_0x2bac73]);}}return this[_0xff4a('0xe')][_0xff4a('0xb0')](util['format'](_0xff4a('0x138'),JSON['stringify'](_0x329dcc)));}}return _0x4fd356;};AGIVertices[_0xff4a('0x16')][_0xff4a('0x139')]=function(_0x401785){logger['info'](util['format'](_0xff4a('0x13a'),_0x401785[_0xff4a('0x33')]));if(!this['isConfigured'](_0x401785['appid'])){return this[_0xff4a('0xe')]['noop'](_0xff4a('0x13b'));}if(!this[_0xff4a('0x86')](_0x401785[_0xff4a('0x95')])){return this[_0xff4a('0xe')][_0xff4a('0xb0')](_0xff4a('0x13c'));}var _0x50acfa=_0xff4a('0x13d');var _0x4dfbba=util[_0xff4a('0x50')](_0xff4a('0x13e'),FILES_PATH,rs[_0xff4a('0x11b')](0x4));var _0x29c8a7=util['format'](_0xff4a('0xa0'),_0x4dfbba,_0x50acfa);var _0x5bf4aa=!![];if(_0x401785['beep']===_0xff4a('0x133')){_0x5bf4aa=![];}var _0x3a7723=this[_0xff4a('0xe')][_0xff4a('0x134')](_0x4dfbba,_0x50acfa,_0x401785[_0xff4a('0x135')],_0x401785[_0xff4a('0x61')],undefined,_0x5bf4aa);if(_0x3a7723[_0xff4a('0xaf')]!==-0x1){this[_0xff4a('0xe')][_0xff4a('0xb0')](util[_0xff4a('0x50')](_0xff4a('0x13f'),_0x29c8a7));var _0x158f21=this[_0xff4a('0x93')]['sync'](this,_0x401785,_0x29c8a7);if(_0x158f21){for(var _0x1f52e3 in _0x158f21){if(_0x158f21['hasOwnProperty'](_0x1f52e3)){this[_0xff4a('0xe')][_0xff4a('0xa1')](util[_0xff4a('0x50')](_0xff4a('0x140'),_0x1f52e3[_0xff4a('0x65')]()),_0x158f21[_0x1f52e3]);}}return this[_0xff4a('0xe')][_0xff4a('0xb0')](util['format']('TildeASR\x20Result\x20%s',JSON[_0xff4a('0x70')](_0x158f21)));}}return _0x3a7723;};AGIVertices[_0xff4a('0x16')][_0xff4a('0x141')]=function(_0x26ae96){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0x142'),_0x26ae96['label']));return this[_0xff4a('0xe')][_0xff4a('0x143')](_0x26ae96[_0xff4a('0x3a')],_0x26ae96['extension'],_0x26ae96['priority']);};AGIVertices['prototype'][_0xff4a('0x144')]=function(_0x378561){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0x145'),_0x378561[_0xff4a('0x33')]));if(!this['isConfigured'](_0x378561['condition'])){return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0x378561,_0xff4a('0x146'));}try{var _0x5b8bcc=eval(_0x378561[_0xff4a('0x147')])?_0xff4a('0x148'):_0xff4a('0x149');this[_0xff4a('0xe')][_0xff4a('0xb0')](util[_0xff4a('0x50')](_0xff4a('0x14a'),_0x378561[_0xff4a('0x147')],_0x5b8bcc));return{'code':0xc8,'result':_0x5b8bcc};}catch(_0x2f9344){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xff4a('0x16')][_0xff4a('0x14b')]=function(_0x553e4d){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0x14c'),_0x553e4d[_0xff4a('0x33')]));if(!this[_0xff4a('0x86')](_0x553e4d[_0xff4a('0x14d')])){return this['channel'][_0xff4a('0x2b')](_0x553e4d,'no\x20interval\x20configured');}var _0x4d1764=this[_0xff4a('0x24')][_0xff4a('0xa9')](this,_0x553e4d[_0xff4a('0x14d')]);if(!_0x4d1764){return this[_0xff4a('0xe')]['error'](_0x553e4d,_0xff4a('0x14e'));}for(var _0x24cb8f=0x0;_0x24cb8f<_0x4d1764[_0xff4a('0x9e')];_0x24cb8f+=0x1){var _0xf3860b=this[_0xff4a('0xe')][_0xff4a('0x11')](util[_0xff4a('0x50')](_0xff4a('0x14f'),_0x4d1764[_0x24cb8f]));if(_0xf3860b[_0xff4a('0xaf')]===-0x1){return _0xf3860b;}logger[_0xff4a('0x2e')](util['format'](_0xff4a('0x150'),_0x4d1764[_0x24cb8f],_0xf3860b[_0xff4a('0xa6')]));if(_0xf3860b[_0xff4a('0xa6')]==='true'){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0x150'),_0x4d1764[_0x24cb8f],'true'));this[_0xff4a('0xe')][_0xff4a('0xb0')](util[_0xff4a('0x50')](_0xff4a('0x150'),_0x4d1764[_0x24cb8f],_0xff4a('0x148')));return{'code':0xc8,'result':_0xff4a('0x148')};}else{logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0x150'),_0x4d1764[_0x24cb8f],'false'));this[_0xff4a('0xe')][_0xff4a('0xb0')](util[_0xff4a('0x50')]('IFTIME\x20%s\x20%s',_0x4d1764[_0x24cb8f],_0xff4a('0x149')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xff4a('0x16')][_0xff4a('0x151')]=function(_0xeb4d1e){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0xeb4d1e[_0xff4a('0x33')]));return this[_0xff4a('0xe')][_0xff4a('0x151')]();};AGIVertices['prototype'][_0xff4a('0x152')]=function(_0x4c5d00){logger[_0xff4a('0x2e')](util['format'](_0xff4a('0x153'),_0x4c5d00[_0xff4a('0x33')]));if(!this[_0xff4a('0x86')](_0x4c5d00[_0xff4a('0x78')])){return this[_0xff4a('0xe')][_0xff4a('0xb0')](_0xff4a('0x131'));}var _0x121217=_0xff4a('0x13d');var _0x57c2fa=util[_0xff4a('0x50')](_0xff4a('0x13e'),FILES_PATH,rs[_0xff4a('0x11b')](0x4));var _0x4d3e91=util[_0xff4a('0x50')](_0xff4a('0xa0'),_0x57c2fa,_0x121217);var _0x3c5f92=!![];if(_0x4c5d00[_0xff4a('0x132')]===_0xff4a('0x133')){_0x3c5f92=![];}var _0x16466a=this[_0xff4a('0xe')][_0xff4a('0x134')](_0x57c2fa,_0x121217,_0x4c5d00[_0xff4a('0x135')],_0x4c5d00[_0xff4a('0x61')],undefined,_0x3c5f92);if(_0x16466a['result']!==-0x1){this[_0xff4a('0xe')][_0xff4a('0xb0')](util['format'](_0xff4a('0x154'),_0x4d3e91));var _0x48351e=this['ispeechASR'][_0xff4a('0xa9')](this,_0x4c5d00,_0x4d3e91);if(_0x48351e){for(var _0x36f43f in _0x48351e){if(_0x48351e[_0xff4a('0x97')](_0x36f43f)){this[_0xff4a('0xe')][_0xff4a('0xa1')](util[_0xff4a('0x50')]('ISPEECH_ASR_%s',_0x36f43f[_0xff4a('0x65')]()),_0x48351e[_0x36f43f]);}}return this[_0xff4a('0xe')][_0xff4a('0xb0')](util[_0xff4a('0x50')](_0xff4a('0x155'),JSON[_0xff4a('0x70')](_0x48351e)));}}return _0x16466a;};AGIVertices[_0xff4a('0x16')]['ispeechtts']=function(_0x32bed2){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x32bed2[_0xff4a('0x33')]));if(!this[_0xff4a('0x86')](_0x32bed2[_0xff4a('0x78')])){return this[_0xff4a('0xe')][_0xff4a('0xb0')](_0xff4a('0x131'));}if(!this[_0xff4a('0x86')](_0x32bed2['text'])){return this[_0xff4a('0xe')]['noop'](_0xff4a('0xad'));}this[_0xff4a('0xe')]['noop'](util[_0xff4a('0x50')](_0xff4a('0x156'),_0x32bed2[_0xff4a('0x57')]));var _0x3843b5=this[_0xff4a('0x80')][_0xff4a('0xa9')](this,_0x32bed2);if(_0x3843b5){this['channel'][_0xff4a('0xb0')](util[_0xff4a('0x50')](_0xff4a('0x154'),_0x3843b5));var _0x48bcbf=this[_0xff4a('0xe')]['streamFile'](_0x3843b5,_0x32bed2[_0xff4a('0x135')]);try{fs[_0xff4a('0x107')](_0x3843b5+_0xff4a('0x128'));}catch(_0x37f9c0){logger['error'](_0x37f9c0);}return _0x48bcbf;}return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0x32bed2,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xff4a('0x16')]['login']=function(_0x10c112){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0x157'),_0x10c112['label']));if(!this[_0xff4a('0x86')](_0x10c112[_0xff4a('0x158')])){return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0x10c112,_0xff4a('0x159'));}logger[_0xff4a('0x2e')](util['format'](_0xff4a('0x15a'),this[_0xff4a('0xe')]['callerid'],_0x10c112['findBy']));var _0x5b5dd9=this[_0xff4a('0x4e')][_0xff4a('0xa9')](this,_0x10c112['findBy']);if(_0x5b5dd9){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0x15b'),this['channel'][_0xff4a('0x36')],_0x10c112[_0xff4a('0x158')]));this[_0xff4a('0xe')]['noop'](util[_0xff4a('0x50')](_0xff4a('0x15b'),this[_0xff4a('0xe')][_0xff4a('0x36')],_0x10c112[_0xff4a('0x158')]));return{'code':0xc8,'result':_0xff4a('0x15c')};}else{logger['info'](util[_0xff4a('0x50')](_0xff4a('0x15d'),this[_0xff4a('0xe')]['callerid'],_0x10c112[_0xff4a('0x158')]));this[_0xff4a('0xe')][_0xff4a('0xb0')](util[_0xff4a('0x50')](_0xff4a('0x15d'),this[_0xff4a('0xe')][_0xff4a('0x36')],_0x10c112[_0xff4a('0x158')]));return{'code':0xc8,'result':_0xff4a('0x15e')};}};AGIVertices[_0xff4a('0x16')][_0xff4a('0x15f')]=function(_0x16fe44){logger['info'](util[_0xff4a('0x50')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x16fe44[_0xff4a('0x33')]));if(!this[_0xff4a('0x86')](_0x16fe44[_0xff4a('0x158')])){return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0x16fe44,_0xff4a('0x159'));}logger['info'](util[_0xff4a('0x50')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xff4a('0xe')][_0xff4a('0x36')],_0x16fe44[_0xff4a('0x158')]));var _0x4e2f38=this[_0xff4a('0x4d')][_0xff4a('0xa9')](this,_0x16fe44['findBy']);if(_0x4e2f38){logger[_0xff4a('0x2e')](util['format'](_0xff4a('0x15b'),this[_0xff4a('0xe')][_0xff4a('0x36')],_0x16fe44['findBy']));this[_0xff4a('0xe')][_0xff4a('0xb0')](util[_0xff4a('0x50')](_0xff4a('0x15b'),this[_0xff4a('0xe')]['callerid'],_0x16fe44[_0xff4a('0x158')]));return{'code':0xc8,'result':'success'};}else{logger[_0xff4a('0x2e')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xff4a('0xe')]['callerid'],_0x16fe44['findBy']));this[_0xff4a('0xe')][_0xff4a('0xb0')](util[_0xff4a('0x50')](_0xff4a('0x15d'),this[_0xff4a('0xe')][_0xff4a('0x36')],_0x16fe44['findBy']));return{'code':0xc8,'result':_0xff4a('0x15e')};}};AGIVertices[_0xff4a('0x16')][_0xff4a('0x160')]=function(_0x15dc3b){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0x161'),_0x15dc3b[_0xff4a('0x33')]));if(!this[_0xff4a('0x86')](_0x15dc3b[_0xff4a('0x162')])){return this['channel'][_0xff4a('0x2b')](_0x15dc3b,'no\x20operation\x20configured');}this[_0xff4a('0xe')]['noop'](util['format'](_0xff4a('0x163'),_0x15dc3b['operation']));var _0x56c35d=eval(_0x15dc3b[_0xff4a('0x162')]);if(!this['isConfigured'](_0x15dc3b[_0xff4a('0xdc')])){return this[_0xff4a('0xe')]['noop'](_0xff4a('0xdd'));}var _0x256063=this[_0xff4a('0x11')]['sync'](this,_0x15dc3b['variable_id']);if(!_0x256063){return this[_0xff4a('0xe')]['error'](_0x15dc3b,_0xff4a('0x119'));}if(_[_0xff4a('0x9d')](_0x56c35d)){var _0x490bfa=this;_0x56c35d['forEach'](function(_0x9f8aaa,_0x14b17a){_0x490bfa['channel'][_0xff4a('0xa1')](util[_0xff4a('0x50')](_0xff4a('0x164'),_0x256063,_0x14b17a),_0x9f8aaa);});return this[_0xff4a('0xe')]['noop'](util[_0xff4a('0x50')]('variable\x20%s[key]\x20set',_0x256063));}else{return this[_0xff4a('0xe')]['setVariable'](_0x256063,_0x56c35d);}};AGIVertices[_0xff4a('0x16')][_0xff4a('0xb')]=function(_0x11c347){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0x165'),_0x11c347[_0xff4a('0x33')]));if(_0x11c347['retry']===0x0){return this[_0xff4a('0xa7')](_0x11c347);}_0x11c347['retry']-=0x1;if(!this['isConfigured'](_0x11c347['file_id'])){return this[_0xff4a('0xe')]['error'](_0x11c347,_0xff4a('0x166'));}var _0x1a8370=this[_0xff4a('0x167')]['sync'](this,_0x11c347[_0xff4a('0x113')]);if(!_0x1a8370){return this['channel'][_0xff4a('0x2b')](_0x11c347,_0xff4a('0x114'));}var _0x18c250=this[_0xff4a('0xe')][_0xff4a('0x115')](_0x1a8370,_0x11c347[_0xff4a('0x116')],_0x11c347[_0xff4a('0x168')]);var _0x3efa86=_0x18c250[_0xff4a('0xaf')];if(_0x18c250[_0xff4a('0xaf')]===-0x1){this[_0xff4a('0xa8')][_0xff4a('0xa9')](this,_0x11c347,'-1');return _0x18c250;}else if(_0x18c250[_0xff4a('0xa6')]==='timeout'){_0x18c250[_0xff4a('0xaf')]=_0x18c250[_0xff4a('0xaf')][_0xff4a('0x9e')]>0x0?_0x18c250[_0xff4a('0xaf')]:'t';}else if(_['isEmpty'](_0x18c250[_0xff4a('0xaf')])){_0x18c250[_0xff4a('0xaf')]='#';_0x3efa86='#';}if(!this[_0xff4a('0x86')](_0x11c347[_0xff4a('0xdc')])){this[_0xff4a('0xe')]['noop'](_0xff4a('0xdd'));}else{var _0x3bdc5f=this[_0xff4a('0x11')][_0xff4a('0xa9')](this,_0x11c347[_0xff4a('0xdc')]);if(!_0x3bdc5f){return this['channel'][_0xff4a('0x2b')](_0x11c347,_0xff4a('0x119'));}this['channel'][_0xff4a('0xa1')](_0x3bdc5f,_0x3efa86);}this[_0xff4a('0xa8')]['sync'](this,_0x11c347,_0x3efa86);return _0x18c250;};AGIVertices[_0xff4a('0x16')][_0xff4a('0xb0')]=function(_0x2eda1b){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x2eda1b[_0xff4a('0x33')]));return this[_0xff4a('0xe')][_0xff4a('0xb0')](_0x2eda1b[_0xff4a('0x169')]||_0x2eda1b[_0xff4a('0x33')]);};AGIVertices[_0xff4a('0x16')][_0xff4a('0x16a')]=function(_0x4d4982){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0x16b'),_0x4d4982[_0xff4a('0x33')]));if(!this[_0xff4a('0x86')](_0x4d4982['findBy'])){return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0x4d4982,_0xff4a('0x159'));}logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0x15a'),this[_0xff4a('0xe')][_0xff4a('0x36')],_0x4d4982[_0xff4a('0x158')]));var _0x3fa1e7=this['getPause']['sync'](this,_0x4d4982[_0xff4a('0x16c')]);var _0x2bcbe8=this[_0xff4a('0x4a')][_0xff4a('0xa9')](this,_0x4d4982[_0xff4a('0x158')],_0x3fa1e7);if(_0x2bcbe8){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xff4a('0xe')][_0xff4a('0x36')],_0x4d4982[_0xff4a('0x158')]));this['channel'][_0xff4a('0xb0')](util['format'](_0xff4a('0x15b'),this[_0xff4a('0xe')][_0xff4a('0x36')],_0x4d4982[_0xff4a('0x158')]));return{'code':0xc8,'result':_0xff4a('0x15c')};}else{logger[_0xff4a('0x2e')](util[_0xff4a('0x50')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xff4a('0xe')][_0xff4a('0x36')],_0x4d4982[_0xff4a('0x158')]));this['channel']['noop'](util[_0xff4a('0x50')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xff4a('0x36')],_0x4d4982[_0xff4a('0x158')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xff4a('0x16')][_0xff4a('0x16d')]=function(_0x52f3d4){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0x16e'),_0x52f3d4[_0xff4a('0x33')]));if(!this[_0xff4a('0x86')](_0x52f3d4['file_id'])){return this['channel']['error'](_0x52f3d4,_0xff4a('0x166'));}var _0xcf83f9=this[_0xff4a('0x167')][_0xff4a('0xa9')](this,_0x52f3d4[_0xff4a('0x113')]);if(!_0xcf83f9){return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0x52f3d4,_0xff4a('0x114'));}var _0x1797f2=this[_0xff4a('0xe')][_0xff4a('0x52')](_0xff4a('0x16f'),[_0xcf83f9,_0x52f3d4[_0xff4a('0xe8')]]);if(_0x1797f2[_0xff4a('0xaf')]===-0x1){return _0x1797f2;}return this[_0xff4a('0xe')][_0xff4a('0xb0')](util[_0xff4a('0x50')](_0xff4a('0x170'),_0xff4a('0x16f'),_0xcf83f9));};AGIVertices[_0xff4a('0x16')][_0xff4a('0x171')]=function(_0xe13c2c){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0x172'),_0xe13c2c[_0xff4a('0x33')]));if(!this['isConfigured'](_0xe13c2c[_0xff4a('0x173')])){return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0xe13c2c,_0xff4a('0x174'));}var _0x3128db='';var _0x4ac1a0=parseInt(_0xe13c2c['queue_id'],0xa);if(isNaN(_0x4ac1a0)){_0x3128db=_0xe13c2c[_0xff4a('0x173')];}else{_0x3128db=this[_0xff4a('0x17')][_0xff4a('0xa9')](this,_0xe13c2c[_0xff4a('0x173')]);if(!_0x3128db){return this[_0xff4a('0xe')]['error'](_0xe13c2c,_0xff4a('0x175'));}}var _0x2f95d9='';if(this[_0xff4a('0x86')](_0xe13c2c['file_id'])){var _0x48ede6=this[_0xff4a('0x167')]['sync'](this,_0xe13c2c[_0xff4a('0x113')]);if(_0x48ede6){_0x2f95d9=_0x48ede6;}}this[_0xff4a('0xa8')][_0xff4a('0xa9')](this,_0xe13c2c,_0x3128db);if(_0xe13c2c[_0xff4a('0xe8')]['indexOf']('x')<0x0){_0xe13c2c[_0xff4a('0xe8')]+='x';}if(_0xe13c2c['opts'][_0xff4a('0x176')]('X')<0x0){_0xe13c2c['opts']+='X';}this['channel'][_0xff4a('0xa1')](_0xff4a('0x177'),_0x3128db?_0x3128db['toLowerCase']():'');var _0x226c9d=this[_0xff4a('0xe')]['exec'](_0xff4a('0x178'),[_0x3128db,_0xe13c2c['opts'],_0xe13c2c[_0xff4a('0x60')],_0x2f95d9,_0xe13c2c['timeout'],_0xe13c2c[_0xff4a('0xbd')],_0xe13c2c['macro'],_0xe13c2c[_0xff4a('0x179')],'',_0xe13c2c[_0xff4a('0x17a')]]);if(_0x226c9d[_0xff4a('0xaf')]===-0x1){return _0x226c9d;}return this['channel'][_0xff4a('0xb0')](util[_0xff4a('0x50')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x3128db));};AGIVertices['prototype'][_0xff4a('0x17b')]=function(_0x278c78){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0x17c'),_0x278c78[_0xff4a('0x33')]));var _0x1bb819=_0x278c78[_0xff4a('0x17d')]||_0xff4a('0x13d');var _0x44b911=util[_0xff4a('0x50')]('%s_%s',this['channel'][_0xff4a('0x38')],rs[_0xff4a('0x11b')](0x5));var _0x5b8bcb=util['format'](_0xff4a('0x17e'),FILES_PATH,_0x44b911,_0x1bb819);var _0x3d5d10=util['format'](_0xff4a('0x13e'),FILES_PATH,_0x44b911);this[_0xff4a('0x37')][_0xff4a('0xa9')](this,_0x278c78,_0x44b911,_0x5b8bcb);this['channel']['setVariable'](_0xff4a('0x17f'),_0x44b911);logger[_0xff4a('0x2e')](_0xff4a('0x180'),_0x3d5d10,_0x1bb819,_0x278c78[_0xff4a('0x181')],_0x278c78['timeout']);return this[_0xff4a('0xe')][_0xff4a('0x134')](_0x3d5d10,_0x1bb819,_0x278c78[_0xff4a('0x181')],_0x278c78['timeout'],undefined,!![]);};AGIVertices['prototype'][_0xff4a('0x182')]=function(_0x17fb7b){logger[_0xff4a('0x2e')](util['format'](_0xff4a('0x183'),_0x17fb7b['label']));if(!this[_0xff4a('0x86')](_0x17fb7b['url'])){return this[_0xff4a('0xe')][_0xff4a('0xb0')]('no\x20url\x20configured');}var _0x441ce4=this['restAPI'][_0xff4a('0xa9')](this,_0x17fb7b);logger['info'](util[_0xff4a('0x50')]('Response:',util['inspect'](_0x441ce4,{'showHidden':![],'depth':null})));if(!this[_0xff4a('0x86')](_0x17fb7b[_0xff4a('0xdc')])){return this[_0xff4a('0xe')][_0xff4a('0xb0')](_0xff4a('0x184'));}var _0x747970=this[_0xff4a('0x11')][_0xff4a('0xa9')](this,_0x17fb7b[_0xff4a('0xdc')]);if(!_0x747970){return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0x17fb7b,_0xff4a('0x119'));}this[_0xff4a('0xe')][_0xff4a('0xa1')](util[_0xff4a('0x50')](_0xff4a('0x185'),_0x747970),_0x441ce4[_0xff4a('0x72')]?_0x441ce4[_0xff4a('0x72')]:_0xff4a('0x186'));this['channel'][_0xff4a('0xa1')](util[_0xff4a('0x50')](_0xff4a('0x187'),_0x747970),_0x441ce4[_0xff4a('0x73')]?_0x441ce4[_0xff4a('0x73')]:'OK');if(_0x441ce4[_0xff4a('0x66')]){try{this[_0xff4a('0x9f')](_0x441ce4[_0xff4a('0x66')],_0x747970);}catch(_0x306410){logger[_0xff4a('0x2b')](util['format'](_0xff4a('0x188'),_0x747970));}}return this[_0xff4a('0xe')][_0xff4a('0xb0')](util[_0xff4a('0x50')]('variable\x20%s\x20set',_0x747970));};AGIVertices['prototype'][_0xff4a('0x189')]=function(_0x2c8fb9){logger[_0xff4a('0x2e')](util['format'](_0xff4a('0x18a'),_0x2c8fb9['label']));return this[_0xff4a('0xe')][_0xff4a('0x18b')](_0x2c8fb9[_0xff4a('0x18c')][_0xff4a('0xda')](/\s+/g,''),_0x2c8fb9[_0xff4a('0x181')]);};AGIVertices[_0xff4a('0x16')][_0xff4a('0x18d')]=function(_0xb59adf){logger[_0xff4a('0x2e')](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0xb59adf['label']));return this[_0xff4a('0xe')]['sayNumber'](_0xb59adf['number']['replace'](/\s+/g,''),_0xb59adf['escape_digits']);};AGIVertices[_0xff4a('0x16')][_0xff4a('0x18e')]=function(_0x1f5275){logger['info'](util[_0xff4a('0x50')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x1f5275[_0xff4a('0x33')]));return this['channel']['sayPhonetic'](_0x1f5275[_0xff4a('0x57')],_0x1f5275['escape_digits']);};AGIVertices['prototype'][_0xff4a('0x18f')]=function(_0x2593fb){logger['info'](util[_0xff4a('0x50')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x2593fb['label']));if(!this['isConfigured'](_0x2593fb[_0xff4a('0x190')])){return this['channel'][_0xff4a('0xb0')](_0xff4a('0x191'));}var _0x15faf4=this[_0xff4a('0x21')][_0xff4a('0xa9')](this,_0x2593fb[_0xff4a('0x190')]);if(!_0x15faf4||!_0x15faf4[_0xff4a('0x192')]){return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0x2593fb,_0xff4a('0x193'));}var _0x1b2d64={'from':util['format'](_0xff4a('0x194'),_0x15faf4[_0xff4a('0x14')],_0x15faf4['email']||_0x15faf4[_0xff4a('0x192')][_0xff4a('0x195')]),'to':_0x2593fb['to']||'','cc':_0x2593fb['cc']||'','bcc':_0x2593fb[_0xff4a('0x196')]||'','subject':_0x2593fb[_0xff4a('0x197')],'html':_0x2593fb[_0xff4a('0x57')],'text':_0x2593fb['text']};var _0x14f13a={'tls':{'rejectUnauthorized':![]}};if(_0x15faf4[_0xff4a('0x192')][_0xff4a('0x198')]){_0x14f13a['service']=_0x15faf4[_0xff4a('0x192')][_0xff4a('0x198')];}else{_0x14f13a[_0xff4a('0x199')]=_0x15faf4[_0xff4a('0x192')]['host'];_0x14f13a[_0xff4a('0x19a')]=_0x15faf4[_0xff4a('0x192')][_0xff4a('0x19a')];_0x14f13a[_0xff4a('0x19b')]=_0x15faf4[_0xff4a('0x192')][_0xff4a('0x19b')];}if(_0x15faf4[_0xff4a('0x192')]['authentication']){_0x14f13a[_0xff4a('0x19c')]={'user':_0x15faf4[_0xff4a('0x192')][_0xff4a('0x195')],'pass':_0x15faf4['Smtp']['pass']};}if(this[_0xff4a('0x86')](_0x2593fb[_0xff4a('0x19d')])){}logger['debug'](_0xff4a('0x19e'),JSON[_0xff4a('0x70')](_0x1b2d64));this[_0xff4a('0xa8')][_0xff4a('0xa9')](this,_0x2593fb,_0x2593fb[_0xff4a('0x190')]);this[_0xff4a('0xe')][_0xff4a('0xb0')](util[_0xff4a('0x50')](_0xff4a('0x19f'),_0x15faf4[_0xff4a('0x14')]));this[_0xff4a('0x23')][_0xff4a('0xa9')](this,_0x14f13a,_0x1b2d64);return this[_0xff4a('0xe')][_0xff4a('0xb0')](_0xff4a('0x1a0'));};AGIVertices[_0xff4a('0x16')][_0xff4a('0x1a1')]=function(_0x115c71){logger[_0xff4a('0x2e')](util['format'](_0xff4a('0x1a2'),_0x115c71[_0xff4a('0x33')]));return this[_0xff4a('0xe')]['noop'](_0xff4a('0x1a3'));};AGIVertices[_0xff4a('0x16')]['sendSMS']=function(_0x5c9ba9){logger[_0xff4a('0x2e')](util['format'](_0xff4a('0x1a4'),_0x5c9ba9[_0xff4a('0x33')]));if(!this[_0xff4a('0x86')](_0x5c9ba9['sms_account_id'])){return this['channel'][_0xff4a('0xb0')]('no\x20sms\x20account\x20configured');}var _0x36695c=this[_0xff4a('0x31')][_0xff4a('0xa9')](this,_0x5c9ba9[_0xff4a('0x1a5')]);if(!_0x36695c){return this[_0xff4a('0xe')]['error'](_0x5c9ba9,_0xff4a('0x1a6'));}var _0x2a58e7={'body':_0x5c9ba9[_0xff4a('0x1a7')],'phone':_0x5c9ba9['to']||'','SmsAccountId':_0x36695c['id']};logger[_0xff4a('0x1a8')](_0xff4a('0x1a9'),JSON[_0xff4a('0x70')](_0x2a58e7));this['createSquareDetailsReport'][_0xff4a('0xa9')](this,_0x5c9ba9,_0x5c9ba9[_0xff4a('0x1a5')]);this[_0xff4a('0xe')][_0xff4a('0xb0')](util[_0xff4a('0x50')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x36695c[_0xff4a('0x14')]));this[_0xff4a('0x1aa')][_0xff4a('0xa9')](this,_0x2a58e7);return this[_0xff4a('0xe')][_0xff4a('0xb0')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xff4a('0x16')][_0xff4a('0x1ab')]=function(_0x145673){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0x1ac'),_0x145673['label']));if(!this[_0xff4a('0x86')](_0x145673[_0xff4a('0xdc')])){return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0x145673,_0xff4a('0x1ad'));}var _0x5052a3=this[_0xff4a('0x11')][_0xff4a('0xa9')](this,_0x145673[_0xff4a('0xdc')]);if(!_0x5052a3){return this[_0xff4a('0xe')]['error'](_0x145673,_0xff4a('0x119'));}return this['channel'][_0xff4a('0xa1')](_0x5052a3,_0x145673[_0xff4a('0x1ae')]);};AGIVertices[_0xff4a('0x16')][_0xff4a('0x1af')]=function(_0x13853f){logger[_0xff4a('0x2e')](util['format'](_0xff4a('0x1b0'),_0x13853f[_0xff4a('0x33')]));this[_0xff4a('0xe')][_0xff4a('0xb0')](_0xff4a('0x1b1'));if(_0x13853f[_0xff4a('0xc0')]===_0xff4a('0x1b2')){this[_0xff4a('0xe')][_0xff4a('0xb0')](_0xff4a('0x1b3'));return this[_0xff4a('0xe')][_0xff4a('0xc0')]();}return this[_0xff4a('0xe')][_0xff4a('0xb0')](_0xff4a('0x1b4'));};AGIVertices[_0xff4a('0x16')]['subproject']=function(_0x34ce50){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0x1b5'),_0x34ce50[_0xff4a('0x33')]));if(!this[_0xff4a('0x86')](_0x34ce50[_0xff4a('0x1b6')])){return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0x34ce50,_0xff4a('0x1b7'));}var _0x503af4=this[_0xff4a('0x19')]['sync'](this,_0x34ce50[_0xff4a('0x1b6')]);if(!this[_0xff4a('0x86')](_0x503af4)){return this[_0xff4a('0xe')]['error'](_0x34ce50,util[_0xff4a('0x50')](_0xff4a('0x1b8'),_0x34ce50[_0xff4a('0x1b6')]));}if(_0x503af4===this[_0xff4a('0xe')]['arg_1']){return this[_0xff4a('0xe')]['error'](_0x34ce50,_0xff4a('0x1b9'));}this['createSquareDetailsReport']['sync'](this,_0x34ce50,_0x503af4);var _0x15f7ee=this[_0xff4a('0xe')][_0xff4a('0x52')]('AGI',util[_0xff4a('0x50')](_0xff4a('0x1ba'),config[_0xff4a('0xbd')][_0xff4a('0x199')]||_0xff4a('0x1bb'),_0x503af4,this[_0xff4a('0xe')]['arg_1']));if(_0x15f7ee['result']===-0x1){return _0x15f7ee;}return this['channel']['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0xff4a('0x1bc'),_0x503af4));};AGIVertices[_0xff4a('0x16')][_0xff4a('0x1bd')]=function(_0x54cd58){logger[_0xff4a('0x2e')](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x54cd58[_0xff4a('0x33')]));var _0x211b29=this[_0xff4a('0x1be')][_0xff4a('0xa9')](this,_0x54cd58[_0xff4a('0xbf')]);this[_0xff4a('0xa8')]['sync'](this,_0x54cd58,_0x54cd58[_0xff4a('0xbf')]);if(this['isConfigured'](_0x54cd58[_0xff4a('0xdc')])){var _0x5c1653=this[_0xff4a('0x11')][_0xff4a('0xa9')](this,_0x54cd58[_0xff4a('0xdc')]);if(_0x5c1653){this['channel'][_0xff4a('0xa1')](_0x5c1653,_0x211b29);return this[_0xff4a('0xe')][_0xff4a('0xb0')](util['format'](_0xff4a('0x1bf'),_0x54cd58[_0xff4a('0xbf')],_0x5c1653));}}return this[_0xff4a('0xe')][_0xff4a('0xb0')](util[_0xff4a('0x50')](_0xff4a('0x1c0'),_0x54cd58[_0xff4a('0xbf')]));};AGIVertices[_0xff4a('0x16')]['google_cloud_tts']=function(_0x29fc48){logger['info'](util['format'](_0xff4a('0x1c1'),_0x29fc48[_0xff4a('0x33')]));_0x29fc48[_0xff4a('0x57')]=_0x29fc48[_0xff4a('0x57')][_0xff4a('0xda')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xff4a('0x86')](_0x29fc48[_0xff4a('0x55')])){return this['channel'][_0xff4a('0xb0')](_0xff4a('0x1c2'));}if(!this[_0xff4a('0x86')](_0x29fc48[_0xff4a('0x57')])){return this['channel'][_0xff4a('0xb0')](_0xff4a('0xad'));}this[_0xff4a('0xe')][_0xff4a('0xb0')](util[_0xff4a('0x50')](_0xff4a('0x1c3'),_0x29fc48['text']));var _0x18358f=this['googleCloudTTS'][_0xff4a('0xa9')](this,_0x29fc48);if(_0x18358f){this[_0xff4a('0xe')][_0xff4a('0xb0')](util[_0xff4a('0x50')](_0xff4a('0x1c4'),_0x18358f));var _0x4e27c3=this[_0xff4a('0xe')][_0xff4a('0x106')](_0x18358f);try{fs[_0xff4a('0x107')](_0x18358f+_0xff4a('0x128'));}catch(_0x2000bd){logger[_0xff4a('0x2b')](_0x2000bd);}return _0x4e27c3;}return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0x29fc48,_0xff4a('0x1c5'));};AGIVertices[_0xff4a('0x16')][_0xff4a('0x1c6')]=function(_0x7fe361){logger['info'](util['format'](_0xff4a('0x1c7'),_0x7fe361['label']));_0x7fe361[_0xff4a('0x57')]=_0x7fe361[_0xff4a('0x57')][_0xff4a('0xda')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x7fe361[_0xff4a('0x57')])){return this[_0xff4a('0xe')][_0xff4a('0xb0')](_0xff4a('0xad'));}this[_0xff4a('0xe')]['noop'](util[_0xff4a('0x50')](_0xff4a('0x1c8'),_0x7fe361[_0xff4a('0x57')]));var _0x17d73c=this[_0xff4a('0x5d')][_0xff4a('0xa9')](this,_0x7fe361);if(_0x17d73c){this['channel'][_0xff4a('0xb0')](util[_0xff4a('0x50')](_0xff4a('0x1c9'),_0x17d73c));var _0xbb1716=this['channel'][_0xff4a('0x106')](_0x17d73c);try{fs[_0xff4a('0x107')](_0x17d73c+_0xff4a('0x128'));}catch(_0x5585d4){logger['error'](_0x5585d4);}return _0xbb1716;}return this[_0xff4a('0xe')]['error'](_0x7fe361,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xff4a('0x16')][_0xff4a('0x1ca')]=function(_0x50d000){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0x1cb'),_0x50d000[_0xff4a('0x33')]));if(!this[_0xff4a('0x86')](_0x50d000[_0xff4a('0x158')])){return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0x50d000,_0xff4a('0x159'));}logger[_0xff4a('0x2e')](util[_0xff4a('0x50')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xff4a('0x36')],_0x50d000[_0xff4a('0x158')]));var _0x10fffa=this[_0xff4a('0x4c')][_0xff4a('0xa9')](this,_0x50d000[_0xff4a('0x158')]);if(_0x10fffa){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')](_0xff4a('0x15b'),this[_0xff4a('0xe')]['callerid'],_0x50d000['findBy']));this[_0xff4a('0xe')][_0xff4a('0xb0')](util[_0xff4a('0x50')](_0xff4a('0x15b'),this[_0xff4a('0xe')][_0xff4a('0x36')],_0x50d000[_0xff4a('0x158')]));return{'code':0xc8,'result':_0xff4a('0x15c')};}else{logger['info'](util[_0xff4a('0x50')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x50d000[_0xff4a('0x158')]));this[_0xff4a('0xe')][_0xff4a('0xb0')](util[_0xff4a('0x50')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xff4a('0x36')],_0x50d000[_0xff4a('0x158')]));return{'code':0xc8,'result':_0xff4a('0x15e')};}};AGIVertices['prototype']['voicemail']=function(_0x3f6694){logger[_0xff4a('0x2e')](util[_0xff4a('0x50')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x3f6694['label']));var _0x5b5851=this[_0xff4a('0xe')][_0xff4a('0x52')](_0xff4a('0x1cc'),[_0x3f6694[_0xff4a('0x1cd')],_0x3f6694[_0xff4a('0x76')]]);if(_0x5b5851[_0xff4a('0xaf')]===-0x1){return _0x5b5851;}return this[_0xff4a('0xe')][_0xff4a('0xb0')](util['format'](_0xff4a('0x170'),_0xff4a('0x1cc'),_0x3f6694[_0xff4a('0x1cd')]));};AGIVertices[_0xff4a('0x16')]['vswitch']=function(_0x1c2c22){logger['info'](util[_0xff4a('0x50')](_0xff4a('0x1ce'),_0x1c2c22[_0xff4a('0x33')]));if(!this[_0xff4a('0x86')](_0x1c2c22['variable_id'])){return this['channel'][_0xff4a('0x2b')](_0x1c2c22,_0xff4a('0x1ad'));}var _0x3d77f7=this[_0xff4a('0x11')]['sync'](this,_0x1c2c22['variable_id']);if(!_0x3d77f7){return this[_0xff4a('0xe')][_0xff4a('0x2b')](_0x1c2c22,_0xff4a('0x119'));}var _0x51a20f=this['channel'][_0xff4a('0x11')](_0x3d77f7);return{'code':0xc8,'result':_0x51a20f['extra']?_0x51a20f['extra']:'-'};};String[_0xff4a('0x16')][_0xff4a('0xa3')]=function(_0x888f64,_0x4846e0){return this['split'](_0x888f64)[_0xff4a('0x1cf')](_0x4846e0);};module[_0xff4a('0x1d0')]=AGIVertices; \ No newline at end of file +var _0x296e=['no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','false','condition','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','getPause','pause_id','failure','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','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','createSmsMessage','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','AGI','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','exports','path','util','lodash','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','rawHeaders','menu','getdigits','getsecretdigits','channel','prototype','getVariable','rpc','getVariableById','name','catch','getVoiceQueue','getVoiceQueueById','then','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','mailRpc','getIntervals','getIntervalById','IntervalId','interval','map','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','agentPause','agentUnpause','agent','isNil','agentLogout','agentLogin','internal','format','shellCommand','trim','replace','apiKey','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','body','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','en-US','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','clear','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','query','createSquareDetailsReport','variable_id','keys','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','speech','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','out','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block'];(function(_0x1302be,_0xedbf96){var _0x5d0eec=function(_0x25ee43){while(--_0x25ee43){_0x1302be['push'](_0x1302be['shift']());}};_0x5d0eec(++_0xedbf96);}(_0x296e,0x9e));var _0xe296=function(_0x5189b9,_0x4e51ed){_0x5189b9=_0x5189b9-0x0;var _0x15ddb7=_0x296e[_0x5189b9];return _0x15ddb7;};'use strict';var fs=require('fs');var path=require(_0xe296('0x0'));var util=require(_0xe296('0x1'));var _=require(_0xe296('0x2'));var sh=require('shelljs');var odbc=require('odbc')();var rs=require(_0xe296('0x3'));var moment=require(_0xe296('0x4'));var Mustache=require(_0xe296('0x5'));var rp=require(_0xe296('0x6'));var logger=require(_0xe296('0x7'))(_0xe296('0x8'));var config=require(_0xe296('0x9'));var scripts=require(_0xe296('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xe296('0xb'),'rawBody'];var verticesWithRetry=[_0xe296('0xc'),_0xe296('0xd'),_0xe296('0xe')];var AGIVertices=function(_0x28654c,_0x19652a,_0x4a76a8){this[_0xe296('0xf')]=_0x28654c;this['rpc']=_0x19652a;this['mailRpc']=_0x4a76a8;};AGIVertices[_0xe296('0x10')][_0xe296('0x11')]=function(_0x44d782,_0x47d285){this[_0xe296('0x12')][_0xe296('0x13')](_0x44d782)['then'](function(_0x301de3){_0x47d285(null,_0x301de3?_0x301de3[_0xe296('0x14')]:![]);})[_0xe296('0x15')](function(_0x2e3685){_0x47d285(_0x2e3685);});};AGIVertices[_0xe296('0x10')][_0xe296('0x16')]=function(_0x2c1125,_0x28a76a){this[_0xe296('0x12')][_0xe296('0x17')](_0x2c1125)[_0xe296('0x18')](function(_0x11057d){_0x28a76a(null,_0x11057d?_0x11057d[_0xe296('0x14')]:![]);})['catch'](function(_0xc0256f){_0x28a76a(_0xc0256f);});};AGIVertices[_0xe296('0x10')][_0xe296('0x19')]=function(_0x1e9a9b,_0x5e32a8){this['rpc'][_0xe296('0x1a')](_0x1e9a9b)[_0xe296('0x18')](function(_0x10bff4){_0x5e32a8(null,_0x10bff4?_0x10bff4[_0xe296('0x14')]:![]);})[_0xe296('0x15')](function(_0xb4f479){_0x5e32a8(_0xb4f479);});};AGIVertices[_0xe296('0x10')][_0xe296('0x1b')]=function(_0x3c68cf,_0x501cc6){this[_0xe296('0x12')]['getSquareOdbcById'](_0x3c68cf)['then'](function(_0x30ca49){_0x501cc6(null,_0x30ca49?_0x30ca49[_0xe296('0x1c')]:![]);})[_0xe296('0x15')](function(_0x116351){_0x501cc6(_0x116351);});};AGIVertices[_0xe296('0x10')]['getUser']=function(_0x4ab72d,_0x18a372){this[_0xe296('0x12')][_0xe296('0x1d')](_0x4ab72d)[_0xe296('0x18')](function(_0x5ce89d){_0x18a372(null,_0x5ce89d?_0x5ce89d[_0xe296('0x14')]:![]);})[_0xe296('0x15')](function(_0x15cc8f){_0x18a372(_0x15cc8f);});};AGIVertices[_0xe296('0x10')][_0xe296('0x1e')]=function(_0x3033d2,_0x31ab31){this['rpc'][_0xe296('0x1f')](_0x3033d2)[_0xe296('0x18')](function(_0x4a7665){_0x31ab31(null,_0x4a7665?_0x4a7665['name']:![]);})[_0xe296('0x15')](function(_0x38ffcd){_0x31ab31(_0x38ffcd);});};AGIVertices[_0xe296('0x10')][_0xe296('0x20')]=function(_0x263a80,_0x3072ff){var _0x175b5b=this;this[_0xe296('0x12')][_0xe296('0x21')](_0x263a80)[_0xe296('0x18')](function(_0x1542ec){_0x3072ff(null,_0x1542ec?_0x175b5b[_0xe296('0x22')](_0x1542ec[_0xe296('0x23')]):![]);})[_0xe296('0x15')](function(_0x3defb2){_0x3072ff(_0x3defb2);});};AGIVertices['prototype'][_0xe296('0x24')]=function(_0x1b68d2,_0xcb1376){this['rpc']['getMailAccountById'](_0x1b68d2)[_0xe296('0x18')](function(_0xa18a6d){_0xcb1376(null,_0xa18a6d?_0xa18a6d:![]);})[_0xe296('0x15')](function(_0x12e17b){_0xcb1376(_0x12e17b);});};AGIVertices[_0xe296('0x10')][_0xe296('0x25')]=function(_0x4da8d9,_0x4ecf85,_0x1a83ee){this[_0xe296('0x26')][_0xe296('0x25')](_0x4da8d9,_0x4ecf85)[_0xe296('0x18')](function(){_0x1a83ee(null);})['catch'](function(_0x3df771){_0x1a83ee(_0x3df771);});};AGIVertices[_0xe296('0x10')][_0xe296('0x27')]=function(_0x43d809,_0x28606c){this[_0xe296('0x12')][_0xe296('0x28')](_0x43d809)['then'](function(_0x29ce08){if(_0x29ce08){if(_0x29ce08[_0xe296('0x29')]){_0x28606c(null,[_0x29ce08[_0xe296('0x2a')]]);}else{_0x28606c(null,_[_0xe296('0x2b')](_0x29ce08['Intervals'],_0xe296('0x2a')));}}else{_0x28606c(null,![]);}})[_0xe296('0x15')](function(_0x1d1fbd){_0x28606c(_0x1d1fbd);});};AGIVertices['prototype']['getSoundPath']=function(_0x2654ff){return util['format'](_0xe296('0x2c'),FILES_PATH,_0x2654ff);};AGIVertices[_0xe296('0x10')][_0xe296('0x2d')]=function(_0x31f42,_0x1c4b61,_0x3f2b2a){odbc[_0xe296('0x2e')](_0x31f42,function(_0x5cdccb){if(_0x5cdccb){logger[_0xe296('0x2f')](_0xe296('0x30'),_0x5cdccb);_0x3f2b2a(_0x5cdccb);}else{logger[_0xe296('0x31')]('ODBC\x20connection\x20successfully');odbc['query'](_0x1c4b61,function(_0x3ac374,_0x278e1b){if(_0x3ac374){logger[_0xe296('0x31')](_0xe296('0x32'),_0x1c4b61);_0x3f2b2a(_0x3ac374);}else{logger[_0xe296('0x31')](_0xe296('0x33'),_0x1c4b61);odbc[_0xe296('0x34')](function(_0x30ada2){if(_0x30ada2){logger[_0xe296('0x2f')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x30ada2);}_0x3f2b2a(null,_0x278e1b);});}});}});};AGIVertices['prototype'][_0xe296('0x35')]=function(_0x1756c9,_0x3661e2){this[_0xe296('0x12')][_0xe296('0x36')](_0x1756c9)[_0xe296('0x18')](function(_0x41b62d){_0x3661e2(null,_0x41b62d?_0x41b62d:![]);})['catch'](function(_0xc15676){_0x3661e2(_0xc15676);});};AGIVertices[_0xe296('0x10')]['createSmsMessage']=function(_0x5c5cec,_0x5ba99c){this[_0xe296('0x12')]['createSmsMessage'](_0x5c5cec)['then'](function(_0xdefc45){_0x5ba99c(null,_0xdefc45);})[_0xe296('0x15')](function(_0x127337){_0x5ba99c(_0x127337);});};AGIVertices[_0xe296('0x10')]['createSquareDetailsReport']=function(_0x4f4716,_0x2c0b7f,_0x15a12a){this[_0xe296('0x12')]['createSquareDetailsReport']({'uniqueid':this['channel'][_0xe296('0x37')],'node':_0x4f4716[_0xe296('0x38')],'application':_0x4f4716[_0xe296('0x39')],'data':_0x2c0b7f||null,'project_name':this[_0xe296('0xf')][_0xe296('0x3a')],'callerid':this['channel'][_0xe296('0x3b')]})[_0xe296('0x18')](function(_0xf2ea29){if(_0x15a12a){_0x15a12a(null,_0xf2ea29);}})[_0xe296('0x15')](function(_0x543ebe){if(_0x15a12a){_0x15a12a(_0x543ebe);}});};AGIVertices[_0xe296('0x10')]['createSquareRecording']=function(_0x30d555,_0x4ccd65,_0x46da81,_0x21d80a){this['rpc'][_0xe296('0x3c')]({'uniqueid':this['channel'][_0xe296('0x37')],'callerid':this['channel'][_0xe296('0x3b')],'calleridname':this[_0xe296('0xf')][_0xe296('0x3d')],'context':this[_0xe296('0xf')][_0xe296('0x3e')],'extension':this[_0xe296('0xf')][_0xe296('0x3f')],'priority':this['channel'][_0xe296('0x40')],'accountcode':this[_0xe296('0xf')]['accountcode'],'dnid':this[_0xe296('0xf')][_0xe296('0x41')],'projectName':this[_0xe296('0xf')][_0xe296('0x3a')],'saveName':_0x4ccd65,'filename':_0x30d555['file']||_0x4ccd65,'savePath':_0x46da81})[_0xe296('0x18')](function(_0x4dfa60){_0x21d80a(null,_0x4dfa60);})[_0xe296('0x15')](function(_0x49c029){_0x21d80a(_0x49c029);});};AGIVertices[_0xe296('0x10')][_0xe296('0x42')]=function(_0x2b8cf1,_0x5499a4,_0x1059e1,_0x5c1da3,_0x3705b9){this[_0xe296('0x12')][_0xe296('0x42')]({'uniqueid':this[_0xe296('0xf')][_0xe296('0x37')],'body':_0x2b8cf1,'direction':_0x5499a4,'providerName':_0x1059e1,'providerResponse':_0x5c1da3})[_0xe296('0x18')](function(_0x177167){if(_0x3705b9){_0x3705b9(null,_0x177167);}})[_0xe296('0x15')](function(_0x35b9b7){if(_0x3705b9){_0x3705b9(_0x35b9b7);}});};AGIVertices['prototype'][_0xe296('0x43')]=function(_0xf329d0,_0x2f9684){this[_0xe296('0x12')][_0xe296('0x43')]({'firstName':_[_0xe296('0x44')](_0xf329d0[_0xe296('0x14')])||_['isNil'](_0xf329d0[_0xe296('0x14')])?_0xe296('0x45')+Math[_0xe296('0x46')]():_0xf329d0[_0xe296('0x14')],'lastName':_['isEmpty'](_0xf329d0[_0xe296('0x47')])||_['isNil'](_0xf329d0[_0xe296('0x47')])?null:_0xf329d0['lastName'],'phone':_0xf329d0[_0xe296('0x48')],'ListId':_0xf329d0[_0xe296('0x49')],'scheduledat':_0xf329d0[_0xe296('0x4a')],'callbackUniqueid':this[_0xe296('0xf')][_0xe296('0x37')],'tags':'callback','description':_0xe296('0x4b')+_0xf329d0[_0xe296('0x4a')][_0xe296('0x4c')](),'priority':_0xf329d0[_0xe296('0x4d')]})[_0xe296('0x18')](function(_0x4f2eed){_0x2f9684(null,_0x4f2eed);})[_0xe296('0x15')](function(_0xf7d49){_0x2f9684(_0xf7d49);});};AGIVertices[_0xe296('0x10')]['getPause']=function(_0x503e68,_0x26f3ec){this[_0xe296('0x12')]['getPauseById'](_0x503e68)['then'](function(_0x34fa25){_0x26f3ec(null,_0x34fa25?_0x34fa25[_0xe296('0x14')]:![]);})[_0xe296('0x15')](function(_0xda856e){_0x26f3ec(_0xda856e);});};AGIVertices['prototype'][_0xe296('0x4e')]=function(_0x13a21a,_0x133892,_0x2fc3f6){var _0x40a056={'role':'agent'};_0x40a056[_0x13a21a]=this['channel'][_0xe296('0x3b')];this[_0xe296('0x12')][_0xe296('0x4e')](_0x40a056,_0x133892,this[_0xe296('0xf')][_0xe296('0x37')])[_0xe296('0x18')](function(_0x24346e){_0x2fc3f6(null,_['isNil'](_0x24346e)?![]:!![]);})[_0xe296('0x15')](function(_0x4e8b99){logger[_0xe296('0x2f')](_0x4e8b99);_0x2fc3f6(null,![]);});};AGIVertices[_0xe296('0x10')][_0xe296('0x4f')]=function(_0xcf0ed4,_0x2780a8){var _0x5e2609={'role':_0xe296('0x50')};_0x5e2609[_0xcf0ed4]=this[_0xe296('0xf')][_0xe296('0x3b')];this['rpc']['agentUnpause'](_0x5e2609)[_0xe296('0x18')](function(_0x5e363a){_0x2780a8(null,_[_0xe296('0x51')](_0x5e363a)?![]:!![]);})[_0xe296('0x15')](function(_0x2cc04e){logger['error'](_0x2cc04e);_0x2780a8(null,![]);});};AGIVertices['prototype'][_0xe296('0x52')]=function(_0x586b7c,_0x3e2d5a){var _0x25a8ab={'role':_0xe296('0x50')};_0x25a8ab[_0x586b7c]=this['channel']['callerid'];this['rpc'][_0xe296('0x52')](_0x25a8ab)[_0xe296('0x18')](function(_0x16bc27){_0x3e2d5a(null,_[_0xe296('0x51')](_0x16bc27)?![]:!![]);})[_0xe296('0x15')](function(_0x3ba581){logger[_0xe296('0x2f')](_0x3ba581);_0x3e2d5a(null,![]);});};AGIVertices[_0xe296('0x10')][_0xe296('0x53')]=function(_0x7987a5,_0x2ef811){var _0x9bafd1={'role':_0xe296('0x50')};_0x9bafd1[_0x7987a5]=this[_0xe296('0xf')][_0xe296('0x3b')];var _0x124ce8=_0x7987a5!=_0xe296('0x54')?util[_0xe296('0x55')]('%s/%s@from-sip/n','LOCAL',this[_0xe296('0xf')][_0xe296('0x3b')]):undefined;this[_0xe296('0x12')][_0xe296('0x53')](_0x9bafd1,_0x124ce8)['then'](function(_0x339f3c){_0x2ef811(null,_[_0xe296('0x51')](_0x339f3c)?![]:!![]);})[_0xe296('0x15')](function(_0x4b9f11){logger[_0xe296('0x2f')](_0x4b9f11);_0x2ef811(null,![]);});};AGIVertices['prototype'][_0xe296('0x56')]=function(_0x44bfab,_0x3ed4a7){sh['exec'](_[_0xe296('0x57')](_0x44bfab),function(_0x34593f,_0xd45827){var _0x21244b=_0xd45827[_0xe296('0x58')](/(\r\n|\n|\r)/gm,'');_0x3ed4a7(null,_0x21244b);});};AGIVertices[_0xe296('0x10')]['googleCloudTTS']=function(_0x2b7390,_0x2512e1){scripts['googleCloudTTS'](_0x2b7390[_0xe296('0x59')],_0x2b7390['google_cloud_tts_text_type']||_0xe296('0x5a'),_0x2b7390[_0xe296('0x5a')],_0x2b7390[_0xe296('0x5b')]||'en-US',_0x2b7390[_0xe296('0x5c')]||_0xe296('0x5d'),_0x2b7390[_0xe296('0x5e')]||_0xe296('0x5f'))[_0xe296('0x18')](function(_0x16e7e5){_0x2512e1(null,_0x16e7e5);})[_0xe296('0x15')](function(_0x27681d){_0x2512e1(_0x27681d);});};AGIVertices['prototype'][_0xe296('0x60')]=function(_0x46b35e,_0xdff2ec){scripts[_0xe296('0x60')](_0x46b35e['text'],_0x46b35e[_0xe296('0x61')]||'en',0x1)[_0xe296('0x18')](function(_0x4dc9a2){_0xdff2ec(null,_0x4dc9a2);})[_0xe296('0x15')](function(_0x247ce8){_0xdff2ec(_0x247ce8);});};AGIVertices['prototype'][_0xe296('0x62')]=function(_0x111aa1,_0x1a8347){var _0x4ee4a9={'uri':_0x111aa1[_0xe296('0x63')],'method':_0x111aa1[_0xe296('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x111aa1[_0xe296('0x65')])===_0xe296('0x66')&&parseInt(_0x111aa1[_0xe296('0x65')])>=0x1?parseInt(_0x111aa1[_0xe296('0x65')])*0x3e8:0x5*0x3e8};if(_[_0xe296('0x67')]([_0xe296('0x68'),_0xe296('0x69')],_0x4ee4a9[_0xe296('0x64')][_0xe296('0x6a')]())){try{_0x4ee4a9['body']=_0x111aa1[_0xe296('0x6b')]?JSON[_0xe296('0x6c')](_0x111aa1['rawBody']):{};}catch(_0x463073){logger['error'](_0xe296('0x6d'),_0x463073);}}try{_0x4ee4a9[_0xe296('0x6e')]=_0x111aa1[_0xe296('0xb')]?JSON[_0xe296('0x6c')](_0x111aa1[_0xe296('0xb')]):{};}catch(_0x2903f8){logger[_0xe296('0x2f')](_0xe296('0x6f'),_0x2903f8);}if(_0x111aa1[_0xe296('0x70')]){try{var _0x4a0669=require(_0x111aa1[_0xe296('0x70')])[_0xe296('0x71')](this,_0x4ee4a9);_0x4ee4a9['uri']=Mustache[_0xe296('0x72')](_0x111aa1[_0xe296('0x63')],_0x4a0669,{},['$$','$$']);if(_0x4ee4a9['headers']){_0x4ee4a9[_0xe296('0x6e')]=JSON[_0xe296('0x6c')](Mustache[_0xe296('0x72')](JSON['stringify'](_0x4ee4a9[_0xe296('0x6e')]),_0x4a0669,{},['$$','$$']));}if(_0x4ee4a9[_0xe296('0x73')]){_0x4ee4a9['body']=JSON['parse'](Mustache[_0xe296('0x72')](JSON[_0xe296('0x74')](_0x4ee4a9[_0xe296('0x73')]),_0x4a0669,{},['$$','$$']));}}catch(_0x57598c){logger['error'](_0xe296('0x75'),_0x57598c);}}rp(_0x4ee4a9)[_0xe296('0x18')](function(_0x735b7c){var _0x46fa2f={'statusCode':_0x735b7c[_0xe296('0x76')]||0xc8,'statusMessage':_0x735b7c['statusMessage']||'OK','headers':_0x735b7c[_0xe296('0x6e')]||{},'body':_0x735b7c[_0xe296('0x73')]||{}};_0x1a8347(null,_0x46fa2f);})[_0xe296('0x15')](function(_0x5f59eb){var _0x2fdea1={'statusCode':_0x5f59eb[_0xe296('0x76')]||0x1f4,'statusMessage':_0x5f59eb[_0xe296('0x77')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x5f59eb[_0xe296('0x78')][_0xe296('0x6e')]||{},'body':_0x5f59eb[_0xe296('0x78')]['body']||{}};_0x1a8347(null,_0x2fdea1);});};AGIVertices[_0xe296('0x10')][_0xe296('0x79')]=function(_0x435b16,_0x3c8254){scripts[_0xe296('0x79')](this[_0xe296('0xf')][_0xe296('0x37')],_0x435b16[_0xe296('0x7a')],_0x435b16['text'],_0x435b16[_0xe296('0x7b')]||'en')['then'](function(_0x452d72){_0x3c8254(null,_0x452d72);})['catch'](function(_0x42390f){_0x3c8254(_0x42390f);});};AGIVertices[_0xe296('0x10')][_0xe296('0x7c')]=function(_0x3b1898,_0xc0a9dc){scripts[_0xe296('0x7c')](this[_0xe296('0xf')]['uniqueid'],_0x3b1898[_0xe296('0x7d')],_0x3b1898[_0xe296('0x7e')],_0x3b1898[_0xe296('0x7f')],_0x3b1898[_0xe296('0x5a')],_0x3b1898['dialogflowV2_language']||'en')[_0xe296('0x18')](function(_0x3ede76){_0xc0a9dc(null,_0x3ede76);})[_0xe296('0x15')](function(_0x5430f8){_0xc0a9dc(_0x5430f8);});};AGIVertices[_0xe296('0x10')][_0xe296('0x80')]=function(_0x3d2100,_0x28b55e){scripts[_0xe296('0x80')](this[_0xe296('0xf')],_0x3d2100)[_0xe296('0x18')](function(_0x42625d){_0x28b55e(null,_0x42625d);})[_0xe296('0x15')](function(_0x28cd13){_0x28b55e(_0x28cd13);});};AGIVertices[_0xe296('0x10')][_0xe296('0x81')]=function(_0x406fe9,_0x3feb4a){scripts[_0xe296('0x81')](_0x406fe9[_0xe296('0x7a')],_0x406fe9[_0xe296('0x5a')],_0x406fe9[_0xe296('0x82')]||'en-US',_0x406fe9[_0xe296('0x83')])[_0xe296('0x18')](function(_0x2b894d){_0x3feb4a(null,_0x2b894d);})[_0xe296('0x15')](function(_0x248c59){_0x3feb4a(_0x248c59);});};AGIVertices[_0xe296('0x10')][_0xe296('0x84')]=function(_0x42126e,_0x167a54,_0x3fee7d){scripts['ispeechASR'](_0x167a54,_0x42126e['key'],_0x42126e[_0xe296('0x85')]||_0xe296('0x86'),this[_0xe296('0x87')](_0x42126e[_0xe296('0x88')])?_0x42126e[_0xe296('0x88')]:undefined)[_0xe296('0x18')](function(_0x16d5a){_0x3fee7d(null,_0x16d5a);})[_0xe296('0x15')](function(_0x375c9c){_0x3fee7d(_0x375c9c);});};AGIVertices[_0xe296('0x10')][_0xe296('0x89')]=function(_0x3f37d3,_0x1b5f40){scripts[_0xe296('0x89')](_0x3f37d3[_0xe296('0x8a')],_0x3f37d3[_0xe296('0x8b')],_0x3f37d3[_0xe296('0x8c')],_0x3f37d3[_0xe296('0x8d')]||_0xe296('0x8e'),_0x3f37d3[_0xe296('0x5a')],_0x3f37d3[_0xe296('0x8f')]||'text')['then'](function(_0x180f01){_0x1b5f40(null,_0x180f01);})[_0xe296('0x15')](function(_0x540750){_0x1b5f40(_0x540750);});};AGIVertices['prototype']['awsLex']=function(_0x55a509,_0x4497a8){scripts['awsLex'](this[_0xe296('0xf')][_0xe296('0x37')],_0x55a509[_0xe296('0x8a')],_0x55a509[_0xe296('0x8b')],_0x55a509[_0xe296('0x90')],_0x55a509['text'],_0x55a509[_0xe296('0x91')])[_0xe296('0x18')](function(_0x48ed89){_0x4497a8(null,_0x48ed89);})[_0xe296('0x15')](function(_0x37c3bd){_0x4497a8(_0x37c3bd);});};AGIVertices[_0xe296('0x10')][_0xe296('0x92')]=function(_0x1740e9,_0x2fbe4b,_0x4c12f5){scripts[_0xe296('0x92')](_0x2fbe4b,_0x1740e9[_0xe296('0x7a')],_0x1740e9[_0xe296('0x93')]||_0xe296('0x86'))[_0xe296('0x18')](function(_0x153a86){_0x4c12f5(null,_0x153a86);})[_0xe296('0x15')](function(_0x42b1e3){_0x4c12f5(_0x42b1e3);});};AGIVertices[_0xe296('0x10')][_0xe296('0x94')]=function(_0x38318d,_0x432914,_0x214336){scripts[_0xe296('0x94')](_0x432914,_0x38318d[_0xe296('0x95')],_0x38318d[_0xe296('0x96')],_0x38318d[_0xe296('0x97')])[_0xe296('0x18')](function(_0x28ca0c){_0x214336(null,_0x28ca0c);})[_0xe296('0x15')](function(_0x2a4af6){_0x214336(_0x2a4af6);});};AGIVertices[_0xe296('0x10')][_0xe296('0x98')]=function(_0x11d1e4){var _0x4d87f3=_[_0xe296('0x67')](verticesWithRetry,_0x11d1e4[_0xe296('0x39')])?_0x11d1e4:_['clone'](_0x11d1e4);for(var _0xeab2ec in _0x4d87f3){if(_0x4d87f3[_0xe296('0x99')](_0xeab2ec)){if(_0x4d87f3[_0xeab2ec]&&_[_0xe296('0x9a')](_0x4d87f3[_0xeab2ec])){if(_[_0xe296('0x67')](recursiveMapAttributes,_0xeab2ec)){_0x4d87f3[_0xeab2ec]=this[_0xe296('0x9b')](_0x4d87f3[_0xeab2ec]);}else{_0x4d87f3[_0xeab2ec]=this[_0xe296('0x9c')](_0x4d87f3[_0xeab2ec]);}}}}return _0x4d87f3;};AGIVertices[_0xe296('0x10')][_0xe296('0x9d')]=function(_0x39ffe3){for(var _0x5e4bf2 in _0x39ffe3){if(_0x39ffe3['hasOwnProperty'](_0x5e4bf2)){if(_[_0xe296('0x9e')](_0x39ffe3[_0x5e4bf2])){this[_0xe296('0x9d')](_0x39ffe3[_0x5e4bf2]);}else if(_[_0xe296('0x9f')](_0x39ffe3[_0x5e4bf2])){for(var _0x92e1d2=0x0;_0x92e1d2<_0x39ffe3[_0x5e4bf2][_0xe296('0xa0')];_0x92e1d2++){this[_0xe296('0x9d')](_0x39ffe3[_0x5e4bf2][_0x92e1d2]);}}else if(_[_0xe296('0x9a')](_0x39ffe3[_0x5e4bf2])){_0x39ffe3[_0x5e4bf2]=this[_0xe296('0x9c')](_0x39ffe3[_0x5e4bf2]);}}}};AGIVertices[_0xe296('0x10')][_0xe296('0xa1')]=function(_0x33b69d,_0x571dca){for(var _0x1fbae9 in _0x33b69d){if(_0x33b69d[_0xe296('0x99')](_0x1fbae9)){if(_['isPlainObject'](_0x33b69d[_0x1fbae9])){if(!_['isEmpty'](_0x33b69d[_0x1fbae9])){this[_0xe296('0xa1')](_0x33b69d[_0x1fbae9],util[_0xe296('0x55')]('%s.%s',_0x571dca,_0x1fbae9));}}else if(_['isArray'](_0x33b69d[_0x1fbae9])){for(var _0xc0d1d3=0x0;_0xc0d1d3<_0x33b69d[_0x1fbae9][_0xe296('0xa0')];_0xc0d1d3++){this[_0xe296('0xa1')](_0x33b69d[_0x1fbae9][_0xc0d1d3],util['format'](_0xe296('0xa2'),_0x571dca,_0x1fbae9+'['+_0xc0d1d3+']'));}}else{if(!_[_0xe296('0x51')](_0x33b69d[_0x1fbae9])){this[_0xe296('0xf')][_0xe296('0xa3')](util[_0xe296('0x55')](_0xe296('0xa2'),_0x571dca,_0x1fbae9),_0x33b69d[_0x1fbae9]);}}}}};AGIVertices[_0xe296('0x10')][_0xe296('0x9b')]=function(_0x513787){try{var _0x47b206=JSON[_0xe296('0x6c')](_0x513787);this['recursiveNodeIndex'](_0x47b206);return JSON['stringify'](_0x47b206);}catch(_0x5d7f38){return this['replaceAllVariables'](_0x513787);}};AGIVertices[_0xe296('0x10')][_0xe296('0x9c')]=function(_0x5089f2){var _0xfe14bf=_0x5089f2['split']('{');for(var _0x368cca=0x1;_0x368cca<_0xfe14bf[_0xe296('0xa0')];_0x368cca+=0x1){var _0x122a5a=_0xfe14bf[_0x368cca][_0xe296('0xa4')]('}');if(_0x122a5a[_0xe296('0xa0')]>0x1){_0x5089f2=_0x5089f2['replaceAll']('{'+_0x122a5a[0x0]+'}',this['channel'][_0xe296('0x11')](_0x122a5a[0x0])[_0xe296('0xa5')]||_0x122a5a[0x0]);}}if(_0xfe14bf[_0xe296('0xa0')]===0x1){return _0x5089f2['toString']();}return this['replaceAllVariables'](_0x5089f2);};AGIVertices[_0xe296('0x10')][_0xe296('0xa6')]=function(_0x4108f2,_0x4f6b18){var _0xf6dda2=this[_0xe296('0xf')][_0xe296('0x11')](_0x4108f2);if(_0xf6dda2[_0xe296('0xa7')]===-0x1){return _0xf6dda2;}logger['info'](util[_0xe296('0x55')](_0xe296('0xa8'),_0x4f6b18,_0xf6dda2['extra']));return this['channel'][_0xe296('0xa3')](_0x4f6b18,_0xf6dda2[_0xe296('0xa5')]);};AGIVertices[_0xe296('0x10')][_0xe296('0x87')]=function(_0x5c5a9b){return _0x5c5a9b&&_0x5c5a9b!=='0'&&_0x5c5a9b!=='-1'&&_0x5c5a9b!=='';};AGIVertices[_0xe296('0x10')][_0xe296('0xa9')]=function(_0x566246){this['createSquareDetailsReport'][_0xe296('0x71')](this,_0x566246,'-');_0x566246['retry']=_0x566246['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xe296('0x10')][_0xe296('0xaa')]=function(_0x558d10){logger[_0xe296('0x31')](util[_0xe296('0x55')](_0xe296('0xab'),_0x558d10[_0xe296('0x38')]));if(!this['isConfigured'](_0x558d10[_0xe296('0x5a')])){return this[_0xe296('0xf')][_0xe296('0xac')](_0xe296('0xad'));}var _0x124e44='\x22'+_0x558d10[_0xe296('0x5a')]+'\x22';if(this[_0xe296('0x87')](_0x558d10[_0xe296('0x78')])){_0x124e44+=','+_0x558d10[_0xe296('0x78')];}var _0xcdd79b=this[_0xe296('0xf')][_0xe296('0xae')](_0xe296('0xaf'),_0x124e44);if(_0xcdd79b[_0xe296('0xa7')]===-0x1){return _0xcdd79b;}return this[_0xe296('0xf')][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0xb0'),_0x124e44));};AGIVertices[_0xe296('0x10')][_0xe296('0xb1')]=function(_0x2d0d5e){logger[_0xe296('0x31')](util[_0xe296('0x55')](_0xe296('0xb2'),_0x2d0d5e['label']));if(!this[_0xe296('0x87')](_0x2d0d5e[_0xe296('0xb3')])){return this[_0xe296('0xf')][_0xe296('0xac')](_0xe296('0xb4'));}var _0x3efcfe=_0x2d0d5e['grammar'];if(this['isConfigured'](_0x2d0d5e[_0xe296('0x78')])){_0x3efcfe+=','+_0x2d0d5e[_0xe296('0x78')];}var _0x193ca1=this[_0xe296('0xf')]['exec'](_0xe296('0xb5'),_0x3efcfe);if(_0x193ca1['result']===-0x1){return _0x193ca1;}var _0xa00a6d=this['getAndSetVariable'](_0xe296('0xb6'),_0xe296('0xb7'));if(_0xa00a6d[_0xe296('0xa7')]===-0x1){return _0xa00a6d;}var _0x17dbcd=this[_0xe296('0xa6')](_0xe296('0xb8'),_0xe296('0xb9'));if(_0x17dbcd[_0xe296('0xa7')]===-0x1){return _0x17dbcd;}var _0x3ac201=this[_0xe296('0xa6')](_0xe296('0xba'),_0xe296('0xbb'));if(_0x3ac201[_0xe296('0xa7')]===-0x1){return _0x3ac201;}return this[_0xe296('0xf')][_0xe296('0xac')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x3efcfe));};AGIVertices[_0xe296('0x10')]['agi']=function(_0x10863f){logger[_0xe296('0x31')](util[_0xe296('0x55')](_0xe296('0xbc'),_0x10863f[_0xe296('0x38')]));return this[_0xe296('0xf')][_0xe296('0x8')]([_0x10863f[_0xe296('0xbd')],_0x10863f[_0xe296('0xbe')]]);};AGIVertices[_0xe296('0x10')][_0xe296('0xbf')]=function(_0x77ea39){logger[_0xe296('0x31')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x77ea39[_0xe296('0x38')]));if(this[_0xe296('0x87')](_0x77ea39[_0xe296('0x65')])){logger[_0xe296('0x31')](util[_0xe296('0x55')](_0xe296('0xc0'),_0x77ea39[_0xe296('0x65')]));var _0x524a9f=this['channel']['wait'](_0x77ea39[_0xe296('0x65')]);if(_0x524a9f[_0xe296('0xa7')]===-0x1){return _0x524a9f;}}return this[_0xe296('0xf')][_0xe296('0xbf')]();};AGIVertices['prototype'][_0xe296('0xc1')]=function(_0x1c1586){logger['info'](util[_0xe296('0x55')](_0xe296('0xc2'),_0x1c1586['label']));if(!this[_0xe296('0x87')](_0x1c1586[_0xe296('0x49')])){return this['channel'][_0xe296('0x2f')](_0x1c1586,_0xe296('0xc3'));}_0x1c1586[_0xe296('0x4a')]=moment();if(this[_0xe296('0x87')](_0x1c1586[_0xe296('0xc4')])){_0x1c1586['scheduledAt']=moment()[_0xe296('0xc5')](_0x1c1586[_0xe296('0xc4')],_0xe296('0xc6'));}if(!this['isConfigured'](_0x1c1586[_0xe296('0x4d')])){_0x1c1586[_0xe296('0x4d')]=0x2;}this[_0xe296('0x43')][_0xe296('0x71')](this,_0x1c1586);return this[_0xe296('0xf')]['noop'](util[_0xe296('0x55')](_0xe296('0xc7'),_0x1c1586['phone'],_0x1c1586[_0xe296('0x49')],_0x1c1586[_0xe296('0x4a')]));};AGIVertices[_0xe296('0x10')][_0xe296('0xc8')]=function(_0x27e2f2){logger[_0xe296('0x31')](util[_0xe296('0x55')](_0xe296('0xc9'),_0x27e2f2[_0xe296('0x38')]));var _0x3533d7=this[_0xe296('0xf')]['exec'](_0x27e2f2['application'],_0x27e2f2['options']);if(_0x3533d7[_0xe296('0xa7')]===-0x1){return _0x3533d7;}return this['channel']['noop'](util['format'](_0xe296('0xca'),_0x27e2f2[_0xe296('0xcb')],_0x27e2f2[_0xe296('0x78')]));};AGIVertices[_0xe296('0x10')]['lumenvoxtts']=function(_0x40df23){logger[_0xe296('0x31')](util[_0xe296('0x55')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x40df23['label']));if(!this['isConfigured'](_0x40df23[_0xe296('0x5a')])){return this[_0xe296('0xf')][_0xe296('0xac')](_0xe296('0xad'));}var _0x5d20fd='\x22'+_0x40df23[_0xe296('0x5a')]+'\x22';if(this[_0xe296('0x87')](_0x40df23['options'])){_0x5d20fd+=','+_0x40df23['options'];}var _0x3692d2=this[_0xe296('0xf')][_0xe296('0xae')]('MRCPSynth',_0x5d20fd);if(_0x3692d2['result']===-0x1){return _0x3692d2;}return this[_0xe296('0xf')][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0xb0'),_0x5d20fd));};AGIVertices[_0xe296('0x10')][_0xe296('0xcc')]=function(_0x5c9df1){logger[_0xe296('0x31')](util[_0xe296('0x55')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x5c9df1[_0xe296('0x38')]));if(!this[_0xe296('0x87')](_0x5c9df1[_0xe296('0x5a')])){return this['channel']['noop']('no\x20text\x20configured');}var _0x404b07='\x22'+_0x5c9df1[_0xe296('0x5a')]+'\x22';if(this[_0xe296('0x87')](_0x5c9df1[_0xe296('0x78')])){_0x404b07+=','+_0x5c9df1['options'];}var _0x2c05c5=this[_0xe296('0xf')][_0xe296('0xae')](_0xe296('0xaf'),_0x404b07);if(_0x2c05c5[_0xe296('0xa7')]===-0x1){return _0x2c05c5;}return this[_0xe296('0xf')][_0xe296('0xac')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x404b07));};AGIVertices[_0xe296('0x10')][_0xe296('0xcd')]=function(_0x586ecd){logger[_0xe296('0x31')](util[_0xe296('0x55')](_0xe296('0xce'),_0x586ecd[_0xe296('0x38')]));if(!this[_0xe296('0x87')](_0x586ecd[_0xe296('0xb3')])){return this[_0xe296('0xf')][_0xe296('0xac')]('no\x20grammar\x20configured');}var _0x29bf99=_0x586ecd['grammar'];if(this[_0xe296('0x87')](_0x586ecd[_0xe296('0x78')])){_0x29bf99+=','+_0x586ecd['options'];}var _0x12eb45=this['channel'][_0xe296('0xae')](_0xe296('0xb5'),_0x29bf99);if(_0x12eb45[_0xe296('0xa7')]===-0x1){return _0x12eb45;}var _0xd55f5f=this['getAndSetVariable'](_0xe296('0xb6'),'LUMENVOX_ASR_CONFIDENCE');if(_0xd55f5f[_0xe296('0xa7')]===-0x1){return _0xd55f5f;}var _0x235d15=this[_0xe296('0xa6')]('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x235d15[_0xe296('0xa7')]===-0x1){return _0x235d15;}var _0xc4ea96=this[_0xe296('0xa6')](_0xe296('0xba'),_0xe296('0xcf'));if(_0xc4ea96['result']===-0x1){return _0xc4ea96;}return this[_0xe296('0xf')][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0xd0'),_0x29bf99));};AGIVertices[_0xe296('0x10')][_0xe296('0xd1')]=function(_0x47f453){logger['info'](util[_0xe296('0x55')](_0xe296('0xd2'),_0x47f453['label']));if(!this[_0xe296('0x87')](_0x47f453[_0xe296('0xb3')])){return this[_0xe296('0xf')][_0xe296('0xac')](_0xe296('0xb4'));}var _0x11283c=_0x47f453[_0xe296('0xb3')];if(this['isConfigured'](_0x47f453[_0xe296('0x78')])){_0x11283c+=','+_0x47f453[_0xe296('0x78')];}var _0x231660=this[_0xe296('0xf')][_0xe296('0xae')]('MRCPRecog',_0x11283c);if(_0x231660[_0xe296('0xa7')]===-0x1){return _0x231660;}var _0x4fcd05=this[_0xe296('0xa6')]('RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE');if(_0x4fcd05['result']===-0x1){return _0x4fcd05;}var _0x2b2a4a=this['getAndSetVariable'](_0xe296('0xb8'),_0xe296('0xd3'));if(_0x2b2a4a['result']===-0x1){return _0x2b2a4a;}var _0x2011a9=this[_0xe296('0xa6')](_0xe296('0xba'),_0xe296('0xd4'));if(_0x2011a9[_0xe296('0xa7')]===-0x1){return _0x2011a9;}return this[_0xe296('0xf')][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0xd0'),_0x11283c));};AGIVertices[_0xe296('0x10')][_0xe296('0xd5')]=function(_0x29945a){logger['info'](util['format'](_0xe296('0xd6'),_0x29945a['label']));if(!this[_0xe296('0x87')](_0x29945a[_0xe296('0xd7')])){return this[_0xe296('0xf')][_0xe296('0x2f')](_0x29945a,_0xe296('0xd8'));}var _0x5193a9=this[_0xe296('0x1b')][_0xe296('0x71')](this,_0x29945a[_0xe296('0xd7')]);if(!_0x5193a9){return this['channel']['error'](_0x29945a,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x29945a[_0xe296('0xd9')])){return this[_0xe296('0xf')][_0xe296('0x2f')](_0x29945a,'no\x20query\x20configured');}var _0x33f3a5=_0x29945a['query'][_0xe296('0x58')](/(\r\n|\n|\r)/gm,'\x20');this[_0xe296('0xf')]['noop'](util[_0xe296('0x55')]('query:\x20%s',_0x33f3a5));var _0x35135a=this[_0xe296('0x2d')]['sync'](this,_0x5193a9,_0x33f3a5);this[_0xe296('0xda')]['sync'](this,_0x29945a,_0x33f3a5);if(!this['isConfigured'](_0x29945a[_0xe296('0xdb')])){return this[_0xe296('0xf')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2a55ee=this[_0xe296('0x11')][_0xe296('0x71')](this,_0x29945a[_0xe296('0xdb')]);if(!_0x2a55ee){return this['channel'][_0xe296('0x2f')](_0x29945a,'no\x20variable\x20found');}var _0x139fc3=this;_0x35135a['forEach'](function(_0x4db711,_0x458492){Object[_0xe296('0xdc')](_0x4db711)[_0xe296('0xdd')](function(_0xbdd6a7){_0x139fc3[_0xe296('0xf')]['setVariable'](util[_0xe296('0x55')]('%s[%s][%s]',_0x2a55ee,_0x458492,_0xbdd6a7),_0x4db711[_0xbdd6a7]);});});this[_0xe296('0xf')]['setVariable'](util[_0xe296('0x55')](_0xe296('0xde'),_0x2a55ee),_0x35135a[_0xe296('0xa0')]);return this[_0xe296('0xf')]['noop'](util['format'](_0xe296('0xdf'),_0x2a55ee));};AGIVertices[_0xe296('0x10')][_0xe296('0xe0')]=function(_0x1704c1){logger[_0xe296('0xe1')](util['format'](_0xe296('0xe2'),_0x1704c1['label']));if(!this[_0xe296('0x87')](_0x1704c1[_0xe296('0xe3')])){return this[_0xe296('0xf')][_0xe296('0x2f')](_0x1704c1,'no\x20user\x20selected');}var _0x16a573=this[_0xe296('0xe4')][_0xe296('0x71')](this,_0x1704c1[_0xe296('0xe3')]);if(!_0x16a573){return this[_0xe296('0xf')][_0xe296('0x2f')](_0x1704c1,_0xe296('0xe5'));}var _0x6f3e43=this[_0xe296('0xf')][_0xe296('0xae')](_0xe296('0xe6'),[util[_0xe296('0x55')](_0xe296('0xe7'),_0x16a573),_0x1704c1[_0xe296('0x65')],_0x1704c1[_0xe296('0xe8')],_0x1704c1[_0xe296('0x63')]]);if(_0x6f3e43['result']===-0x1){return _0x6f3e43;}return this[_0xe296('0xf')][_0xe296('0xac')](util['format'](_0xe296('0xe9'),_0xe296('0xe6')));};AGIVertices[_0xe296('0x10')][_0xe296('0xea')]=function(_0x118b57){logger[_0xe296('0x31')](util[_0xe296('0x55')](_0xe296('0xeb'),_0x118b57[_0xe296('0x38')]));if(!this[_0xe296('0x87')](_0x118b57['key'])){return this[_0xe296('0xf')][_0xe296('0xac')](_0xe296('0xec'));}if(!this[_0xe296('0x87')](_0x118b57[_0xe296('0x5a')])){return this['channel'][_0xe296('0xac')](_0xe296('0xad'));}this[_0xe296('0xf')][_0xe296('0xed')]=!![];this[_0xe296('0xda')](_0x118b57);this[_0xe296('0x42')](_0x118b57[_0xe296('0x5a')],'in','','');this[_0xe296('0xf')][_0xe296('0xac')](util['format'](_0xe296('0xee'),_0x118b57[_0xe296('0x5a')]));var _0x32e3df=this[_0xe296('0x79')][_0xe296('0x71')](this,_0x118b57);if(_0x32e3df){for(var _0x38dc96 in _0x32e3df){if(_0x32e3df['hasOwnProperty'](_0x38dc96)){this[_0xe296('0xf')][_0xe296('0xa3')](util[_0xe296('0x55')](_0xe296('0xef'),_0x38dc96[_0xe296('0x6a')]()),_0x32e3df[_0x38dc96]);}}this[_0xe296('0x42')](_0x32e3df['speech'],'out',_0xe296('0xea'),'');return this[_0xe296('0xf')][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0xf0'),_0x32e3df['speech']));}return this[_0xe296('0xf')][_0xe296('0x2f')](_0x118b57,_0xe296('0xf1'));};AGIVertices[_0xe296('0x10')][_0xe296('0xf2')]=function(_0x33d617){logger['info'](util['format'](_0xe296('0xf3'),_0x33d617['label']));if(!this[_0xe296('0x87')](_0x33d617[_0xe296('0x7d')])){return this['channel'][_0xe296('0xac')](_0xe296('0xf4'));}if(!this[_0xe296('0x87')](_0x33d617[_0xe296('0x7e')])){return this[_0xe296('0xf')][_0xe296('0xac')](_0xe296('0xf5'));}if(!this[_0xe296('0x87')](_0x33d617[_0xe296('0x7f')])){return this[_0xe296('0xf')][_0xe296('0xac')](_0xe296('0xf6'));}if(!this['isConfigured'](_0x33d617['dialogflowV2_language'])){return this['channel']['noop'](_0xe296('0xf7'));}if(!this[_0xe296('0x87')](_0x33d617[_0xe296('0x5a')])){return this[_0xe296('0xf')][_0xe296('0xac')](_0xe296('0xad'));}this[_0xe296('0xf')][_0xe296('0xed')]=!![];this[_0xe296('0xda')](_0x33d617);this[_0xe296('0x42')](_0x33d617[_0xe296('0x5a')],'in','','');this[_0xe296('0xf')][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0xf8'),_0x33d617['text']));var _0x2d6752=this[_0xe296('0x7c')][_0xe296('0x71')](this,_0x33d617);if(_0x2d6752){for(var _0x56a1c1 in _0x2d6752){if(_0x2d6752[_0xe296('0x99')](_0x56a1c1)){if(_0x56a1c1!==_0xe296('0xf9')){this[_0xe296('0xf')][_0xe296('0xa3')](util[_0xe296('0x55')]('DIALOGFLOW_%s',_0x56a1c1[_0xe296('0x6a')]()),_0x2d6752[_0x56a1c1]);}}}this[_0xe296('0x42')](_0x2d6752[_0xe296('0xfa')],'out',_0xe296('0xf2'),_0x2d6752[_0xe296('0xf9')]);return this[_0xe296('0xf')][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0xfb'),_0x2d6752['speech']));}return this[_0xe296('0xf')][_0xe296('0x2f')](_0x33d617,_0xe296('0xfc'));};AGIVertices[_0xe296('0x10')][_0xe296('0xfd')]=function(_0x4f99c5){logger['info'](util['format'](_0xe296('0xfe'),_0x4f99c5[_0xe296('0x38')]));if(!this[_0xe296('0x87')](_0x4f99c5['ndauth_url'])){return this['channel'][_0xe296('0xac')](_0xe296('0xff'));}if(!this[_0xe296('0x87')](_0x4f99c5[_0xe296('0x100')])){return this['channel'][_0xe296('0xac')](_0xe296('0x101'));}if(!this[_0xe296('0x87')](_0x4f99c5[_0xe296('0x102')])){return this[_0xe296('0xf')]['noop'](_0xe296('0x103'));}if(!this[_0xe296('0x87')](_0x4f99c5[_0xe296('0x104')])){return this['channel'][_0xe296('0xac')]('no\x20text\x20configured');}this['channel'][_0xe296('0xed')]=!![];this['createSquareDetailsReport'](_0x4f99c5);this[_0xe296('0x42')](_0x4f99c5[_0xe296('0x5a')],'in','','');this[_0xe296('0xf')][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0x105'),_0x4f99c5[_0xe296('0x5a')]));var _0x23a5cc=this[_0xe296('0x80')]['sync'](this,_0x4f99c5);if(_0x23a5cc){for(var _0x2ab209 in _0x23a5cc){if(_0x23a5cc[_0xe296('0x99')](_0x2ab209)){this[_0xe296('0xf')][_0xe296('0xa3')](util[_0xe296('0x55')](_0xe296('0x106'),_0x2ab209['toUpperCase']()),_0x23a5cc[_0x2ab209]);}}this[_0xe296('0x42')](_0x23a5cc[_0xe296('0xfa')],_0xe296('0x107'),'sesteknda','');if(_0x23a5cc[_0xe296('0x108')]){this[_0xe296('0xf')][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0x109'),_0x23a5cc[_0xe296('0x108')]));var _0x23278c=this[_0xe296('0xf')][_0xe296('0x10a')](_0x23a5cc['audiofile']);try{fs[_0xe296('0x10b')](_0x23a5cc[_0xe296('0x108')]+'.wav');}catch(_0x42ceda){logger[_0xe296('0x2f')](_0x42ceda);}return _0x23278c;}else{return this[_0xe296('0xf')][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0x10c'),_0x23a5cc[_0xe296('0xfa')]));}}return this['channel']['error'](_0x4f99c5,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xe296('0x10')][_0xe296('0x10d')]=function(_0x12ad1c){logger[_0xe296('0x31')](util['format'](_0xe296('0x10e'),_0x12ad1c[_0xe296('0x38')]));return this['channel'][_0xe296('0xac')](_0xe296('0x10d'));};AGIVertices['prototype'][_0xe296('0x10f')]=function(_0x1172b7){logger[_0xe296('0x31')](util[_0xe296('0x55')](_0xe296('0x110'),_0x1172b7[_0xe296('0x38')]));var _0x2f98af='';if(_0x1172b7[_0xe296('0x111')]){if(!this[_0xe296('0x87')](_0x1172b7[_0xe296('0x111')])){return this[_0xe296('0xf')][_0xe296('0x2f')](_0x1172b7,_0xe296('0x112'));}else{var _0x222c2d=parseInt(_0x1172b7[_0xe296('0x111')],0xa);if(isNaN(_0x222c2d)){_0x2f98af=_0x1172b7[_0xe296('0x111')];}else{_0x2f98af=this[_0xe296('0x1e')][_0xe296('0x71')](this,_0x1172b7['trunk_id']);if(!_0x2f98af){return this[_0xe296('0xf')]['error'](_0x1172b7,'no\x20trunk\x20found');}}}}else if(_0x1172b7[_0xe296('0x113')]){_0x2f98af=_0x1172b7[_0xe296('0x113')];}else{return this[_0xe296('0xf')][_0xe296('0x2f')](_0x1172b7,_0xe296('0x112'));}var _0xcb850b=this[_0xe296('0xf')][_0xe296('0xae')]('DIAL',[util[_0xe296('0x55')]('SIP/%s/%s',_0x2f98af,_0x1172b7[_0xe296('0x48')]),_0x1172b7[_0xe296('0x65')],_0x1172b7[_0xe296('0xe8')],_0x1172b7['url']]);if(_0xcb850b['result']===-0x1){return _0xcb850b;}return this['channel'][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0xe9'),_0xe296('0xe6')));};AGIVertices['prototype'][_0xe296('0x114')]=function(_0x11be6f){logger[_0xe296('0x31')](util[_0xe296('0x55')](_0xe296('0x115'),_0x11be6f['label']));return this['channel']['noop'](_0xe296('0x114'));};AGIVertices['prototype']['getdigits']=function(_0x22dca3){logger['info'](util[_0xe296('0x55')](_0xe296('0x116'),_0x22dca3[_0xe296('0x38')]));if(_0x22dca3[_0xe296('0x117')]===0x0){return this[_0xe296('0xa9')](_0x22dca3);}_0x22dca3[_0xe296('0x117')]-=0x1;if(!this[_0xe296('0x87')](_0x22dca3['file_id'])){return this['channel'][_0xe296('0x2f')](_0x22dca3,_0xe296('0x118'));}var _0x15eac5=this['getSound'][_0xe296('0x71')](this,_0x22dca3[_0xe296('0x119')]);if(!_0x15eac5){return this[_0xe296('0xf')][_0xe296('0x2f')](_0x22dca3,_0xe296('0x11a'));}if(!this['isConfigured'](_0x22dca3[_0xe296('0xdb')])){return this['channel'][_0xe296('0x2f')](_0xe296('0x11b'));}var _0x1ef409=this[_0xe296('0xf')]['getData'](_0x15eac5,_0x22dca3[_0xe296('0x11c')],_0x22dca3[_0xe296('0x11d')]);var _0xf06e29=_0x1ef409['result']?_0x1ef409[_0xe296('0xa7')][_0xe296('0x4c')]():'';logger[_0xe296('0x31')](_0xe296('0x11e'),JSON[_0xe296('0x74')](_0x1ef409));if(_0x1ef409['result']===-0x1){this[_0xe296('0xda')][_0xe296('0x71')](this,_0x22dca3,_0xf06e29);return _0x1ef409;}else if(_0x1ef409[_0xe296('0xa5')]===_0xe296('0x65')){_0x1ef409[_0xe296('0xa7')]=_0xf06e29[_0xe296('0xa0')]>=parseInt(_0x22dca3[_0xe296('0x11f')])?'x':'i';}else{_0x1ef409[_0xe296('0xa7')]=_0xf06e29[_0xe296('0xa0')]>=parseInt(_0x22dca3[_0xe296('0x11f')])&&_0xf06e29['length']<=parseInt(_0x22dca3['maxdigit'])?'x':'i';}var _0x7108e8=this[_0xe296('0x11')][_0xe296('0x71')](this,_0x22dca3[_0xe296('0xdb')]);if(!_0x7108e8){return this[_0xe296('0xf')][_0xe296('0x2f')](_0x22dca3,_0xe296('0x120'));}this[_0xe296('0xf')][_0xe296('0xa3')](_0x7108e8,_0xf06e29);if(this[_0xe296('0x87')](_0x22dca3['hiddendigitsnum'])){var _0xa019ab=parseInt(_0x22dca3[_0xe296('0x121')],0xa);var _0xb6379a=rs[_0xe296('0x122')]({'charset':'*','length':_0xa019ab});var _0x46f1fd=_0xf06e29[_0xe296('0xa0')];if(_0x46f1fd>0x0){if(_0x46f1fd>_0xa019ab){this['createSquareDetailsReport'][_0xe296('0x71')](this,_0x22dca3,_0x22dca3[_0xe296('0x123')]===_0xe296('0x124')?_0xb6379a+_0xf06e29[_0xe296('0x125')](_0xa019ab):_0xf06e29['substr'](0x0,_0x46f1fd-_0xa019ab)+_0xb6379a);}else{this[_0xe296('0xda')][_0xe296('0x71')](this,_0x22dca3,rs['generate']({'charset':'*','length':_0x46f1fd}));}}else{this['createSquareDetailsReport'][_0xe296('0x71')](this,_0x22dca3,'');}}else{this[_0xe296('0xda')][_0xe296('0x71')](this,_0x22dca3,_0xf06e29);}return _0x1ef409;};AGIVertices[_0xe296('0x10')][_0xe296('0xe')]=function(_0x1bfc2b){logger[_0xe296('0x31')](util[_0xe296('0x55')](_0xe296('0x126'),_0x1bfc2b[_0xe296('0x38')]));return this['getdigits'](_0x1bfc2b);};AGIVertices[_0xe296('0x10')][_0xe296('0x127')]=function(_0x4fa723){logger[_0xe296('0x31')](util[_0xe296('0x55')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x4fa723[_0xe296('0x38')]));this[_0xe296('0xda')][_0xe296('0x71')](this,_0x4fa723,_0x4fa723[_0xe296('0x128')]);return this[_0xe296('0xf')][_0xe296('0xac')](util['format'](_0xe296('0x129'),_0x4fa723[_0xe296('0x128')]));};AGIVertices['prototype'][_0xe296('0x12a')]=function(_0x2f9467){logger[_0xe296('0x31')](util[_0xe296('0x55')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x2f9467['label']));if(!this[_0xe296('0x87')](_0x2f9467['aws_access_key_id'])||!this[_0xe296('0x87')](_0x2f9467['aws_secret_access_key'])){return this[_0xe296('0xf')]['noop'](_0xe296('0x12b'));}if(!this[_0xe296('0x87')](_0x2f9467[_0xe296('0x5a')])){return this[_0xe296('0xf')][_0xe296('0xac')](_0xe296('0xad'));}this[_0xe296('0xf')][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0x12c'),_0x2f9467[_0xe296('0x5a')]));var _0x2eaee8=this[_0xe296('0x89')][_0xe296('0x71')](this,_0x2f9467);if(_0x2eaee8){this[_0xe296('0xf')]['noop'](util[_0xe296('0x55')](_0xe296('0x12d'),_0x2eaee8));var _0x5beffe=this[_0xe296('0xf')][_0xe296('0x10a')](_0x2eaee8);try{fs['unlink'](_0x2eaee8+_0xe296('0x12e'));}catch(_0x17675f){logger[_0xe296('0x2f')](_0x17675f);}return _0x5beffe;}return this[_0xe296('0xf')]['error'](_0x2f9467,_0xe296('0x12f'));};AGIVertices[_0xe296('0x10')][_0xe296('0x130')]=function(_0x274da6){logger[_0xe296('0x31')](util[_0xe296('0x55')](_0xe296('0x131'),_0x274da6['label']));if(!this[_0xe296('0x87')](_0x274da6['aws_access_key_id'])||!this[_0xe296('0x87')](_0x274da6[_0xe296('0x8b')])){return this['channel'][_0xe296('0xac')](_0xe296('0x12b'));}if(!this[_0xe296('0x87')](_0x274da6[_0xe296('0x91')])){return this[_0xe296('0xf')][_0xe296('0xac')](_0xe296('0x132'));}if(!this[_0xe296('0x87')](_0x274da6[_0xe296('0x5a')])){return this[_0xe296('0xf')][_0xe296('0xac')]('no\x20text\x20configured');}this[_0xe296('0xf')][_0xe296('0xed')]=!![];this[_0xe296('0xda')](_0x274da6);this[_0xe296('0x42')](_0x274da6[_0xe296('0x5a')],'in','','');this[_0xe296('0xf')][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0x133'),_0x274da6['text']));var _0x3483c8=this['awsLex'][_0xe296('0x71')](this,_0x274da6);if(_0x3483c8){for(var _0x3ffe8c in _0x3483c8){if(_0x3483c8['hasOwnProperty'](_0x3ffe8c)&&_[_0xe296('0x9a')](_0x3483c8[_0x3ffe8c])){this[_0xe296('0xf')][_0xe296('0xa3')](util[_0xe296('0x55')](_0xe296('0x134'),_0x3ffe8c[_0xe296('0x6a')]()),_0x3483c8[_0x3ffe8c]);}}if(_[_0xe296('0x51')](_0x3483c8[_0xe296('0x77')])){return this['channel'][_0xe296('0xac')](_0xe296('0x135'));}else{this[_0xe296('0x42')](_0x3483c8[_0xe296('0x77')],_0xe296('0x107'),_0xe296('0x136'),'');return this['channel'][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0x137'),_0x3483c8[_0xe296('0x77')]));}}return this[_0xe296('0xf')][_0xe296('0x2f')](_0x274da6,_0xe296('0x138'));};AGIVertices[_0xe296('0x10')][_0xe296('0x139')]=function(_0x486757){logger[_0xe296('0x31')](util[_0xe296('0x55')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x486757['label'],_0x486757['timeout']));if(!this[_0xe296('0x87')](_0x486757[_0xe296('0x7a')])){return this[_0xe296('0xf')][_0xe296('0xac')](_0xe296('0xec'));}var _0x4adbde=_0xe296('0x13a');var _0x1b6b32=util[_0xe296('0x55')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x33a959=util['format'](_0xe296('0xa2'),_0x1b6b32,_0x4adbde);var _0x5739b2=!![];if(_0x486757[_0xe296('0x13b')]===_0xe296('0x13c')){_0x5739b2=![];}var _0x2269ea=this[_0xe296('0xf')]['recordFile'](_0x1b6b32,_0x4adbde,_0x486757[_0xe296('0x13d')],_0x486757[_0xe296('0x65')],undefined,_0x5739b2);if(_0x2269ea[_0xe296('0xa7')]!==-0x1){this[_0xe296('0xf')][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0x13e'),_0x33a959));var _0x50e5a9=this[_0xe296('0x92')][_0xe296('0x71')](this,_0x486757,_0x33a959);if(_0x50e5a9){for(var _0x2537e in _0x50e5a9){if(_0x50e5a9[_0xe296('0x99')](_0x2537e)){this[_0xe296('0xf')][_0xe296('0xa3')](util[_0xe296('0x55')](_0xe296('0x13f'),_0x2537e['toUpperCase']()),_0x50e5a9[_0x2537e]);}}return this[_0xe296('0xf')][_0xe296('0xac')](util[_0xe296('0x55')]('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x50e5a9)));}}return _0x2269ea;};AGIVertices['prototype'][_0xe296('0x140')]=function(_0x5d3dc3){logger[_0xe296('0x31')](util['format']('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x5d3dc3[_0xe296('0x38')]));if(!this[_0xe296('0x87')](_0x5d3dc3[_0xe296('0x95')])){return this[_0xe296('0xf')][_0xe296('0xac')](_0xe296('0x141'));}if(!this[_0xe296('0x87')](_0x5d3dc3[_0xe296('0x96')])){return this['channel'][_0xe296('0xac')](_0xe296('0x142'));}var _0x235e54=_0xe296('0x13a');var _0x2205a2=util[_0xe296('0x55')](_0xe296('0x143'),FILES_PATH,rs[_0xe296('0x122')](0x4));var _0x2b7c14=util[_0xe296('0x55')](_0xe296('0xa2'),_0x2205a2,_0x235e54);var _0x14327c=!![];if(_0x5d3dc3[_0xe296('0x13b')]===_0xe296('0x13c')){_0x14327c=![];}var _0x1b15b8=this[_0xe296('0xf')][_0xe296('0x144')](_0x2205a2,_0x235e54,_0x5d3dc3[_0xe296('0x13d')],_0x5d3dc3[_0xe296('0x65')],undefined,_0x14327c);if(_0x1b15b8['result']!==-0x1){this[_0xe296('0xf')][_0xe296('0xac')](util['format'](_0xe296('0x145'),_0x2b7c14));var _0x42ba74=this[_0xe296('0x94')][_0xe296('0x71')](this,_0x5d3dc3,_0x2b7c14);if(_0x42ba74){for(var _0x578490 in _0x42ba74){if(_0x42ba74[_0xe296('0x99')](_0x578490)){this[_0xe296('0xf')]['setVariable'](util[_0xe296('0x55')](_0xe296('0x146'),_0x578490[_0xe296('0x6a')]()),_0x42ba74[_0x578490]);}}return this['channel'][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0x147'),JSON['stringify'](_0x42ba74)));}}return _0x1b15b8;};AGIVertices['prototype'][_0xe296('0x148')]=function(_0x4b0dcc){logger[_0xe296('0x31')](util[_0xe296('0x55')](_0xe296('0x149'),_0x4b0dcc[_0xe296('0x38')]));return this[_0xe296('0xf')][_0xe296('0x14a')](_0x4b0dcc['context'],_0x4b0dcc[_0xe296('0x3f')],_0x4b0dcc[_0xe296('0x40')]);};AGIVertices[_0xe296('0x10')]['gotoif']=function(_0x32fa99){logger[_0xe296('0x31')](util[_0xe296('0x55')](_0xe296('0x14b'),_0x32fa99[_0xe296('0x38')]));if(!this[_0xe296('0x87')](_0x32fa99['condition'])){return this[_0xe296('0xf')][_0xe296('0x2f')](_0x32fa99,'no\x20condition\x20configured');}try{var _0x526197=eval(_0x32fa99['condition'])?'true':_0xe296('0x14c');this[_0xe296('0xf')][_0xe296('0xac')](util[_0xe296('0x55')]('EVAL\x20CONDITION\x20%s\x20%s',_0x32fa99[_0xe296('0x14d')],_0x526197));return{'code':0xc8,'result':_0x526197};}catch(_0x11a874){return{'code':0xc8,'result':_0xe296('0x14c')};}};AGIVertices[_0xe296('0x10')][_0xe296('0x14e')]=function(_0x3a25c7){logger[_0xe296('0x31')](util[_0xe296('0x55')](_0xe296('0x14f'),_0x3a25c7[_0xe296('0x38')]));if(!this[_0xe296('0x87')](_0x3a25c7['interval_id'])){return this[_0xe296('0xf')][_0xe296('0x2f')](_0x3a25c7,'no\x20interval\x20configured');}var _0x234c95=this[_0xe296('0x27')]['sync'](this,_0x3a25c7[_0xe296('0x150')]);if(!_0x234c95){return this[_0xe296('0xf')][_0xe296('0x2f')](_0x3a25c7,_0xe296('0x151'));}for(var _0x3a3612=0x0;_0x3a3612<_0x234c95[_0xe296('0xa0')];_0x3a3612+=0x1){var _0xcc2e89=this[_0xe296('0xf')][_0xe296('0x11')](util['format'](_0xe296('0x152'),_0x234c95[_0x3a3612]));if(_0xcc2e89[_0xe296('0xa7')]===-0x1){return _0xcc2e89;}logger[_0xe296('0x31')](util[_0xe296('0x55')]('IFTIME\x20%s\x20%s',_0x234c95[_0x3a3612],_0xcc2e89[_0xe296('0xa5')]));if(_0xcc2e89[_0xe296('0xa5')]==='true'){logger[_0xe296('0x31')](util[_0xe296('0x55')](_0xe296('0x153'),_0x234c95[_0x3a3612],_0xe296('0x154')));this[_0xe296('0xf')][_0xe296('0xac')](util['format'](_0xe296('0x153'),_0x234c95[_0x3a3612],_0xe296('0x154')));return{'code':0xc8,'result':_0xe296('0x154')};}else{logger[_0xe296('0x31')](util[_0xe296('0x55')]('IFTIME\x20%s\x20%s',_0x234c95[_0x3a3612],_0xe296('0x14c')));this['channel'][_0xe296('0xac')](util['format'](_0xe296('0x153'),_0x234c95[_0x3a3612],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xe296('0x10')][_0xe296('0x155')]=function(_0x375907){logger[_0xe296('0x31')](util[_0xe296('0x55')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x375907[_0xe296('0x38')]));return this[_0xe296('0xf')][_0xe296('0x155')]();};AGIVertices['prototype'][_0xe296('0x156')]=function(_0x4b5eb8){logger[_0xe296('0x31')](util[_0xe296('0x55')](_0xe296('0x157'),_0x4b5eb8[_0xe296('0x38')]));if(!this['isConfigured'](_0x4b5eb8[_0xe296('0x7a')])){return this[_0xe296('0xf')]['noop'](_0xe296('0xec'));}var _0xc85bdc=_0xe296('0x13a');var _0x2345a=util[_0xe296('0x55')](_0xe296('0x143'),FILES_PATH,rs[_0xe296('0x122')](0x4));var _0x597e06=util['format']('%s.%s',_0x2345a,_0xc85bdc);var _0x394e39=!![];if(_0x4b5eb8[_0xe296('0x13b')]===_0xe296('0x13c')){_0x394e39=![];}var _0xb17f4a=this[_0xe296('0xf')][_0xe296('0x144')](_0x2345a,_0xc85bdc,_0x4b5eb8[_0xe296('0x13d')],_0x4b5eb8[_0xe296('0x65')],undefined,_0x394e39);if(_0xb17f4a[_0xe296('0xa7')]!==-0x1){this['channel'][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0x158'),_0x597e06));var _0x417b34=this[_0xe296('0x84')]['sync'](this,_0x4b5eb8,_0x597e06);if(_0x417b34){for(var _0x588c75 in _0x417b34){if(_0x417b34['hasOwnProperty'](_0x588c75)){this[_0xe296('0xf')]['setVariable'](util[_0xe296('0x55')](_0xe296('0x159'),_0x588c75['toUpperCase']()),_0x417b34[_0x588c75]);}}return this[_0xe296('0xf')][_0xe296('0xac')](util['format'](_0xe296('0x15a'),JSON[_0xe296('0x74')](_0x417b34)));}}return _0xb17f4a;};AGIVertices[_0xe296('0x10')][_0xe296('0x15b')]=function(_0x3c7b76){logger[_0xe296('0x31')](util['format'](_0xe296('0x15c'),_0x3c7b76[_0xe296('0x38')]));if(!this['isConfigured'](_0x3c7b76[_0xe296('0x7a')])){return this['channel'][_0xe296('0xac')]('no\x20key\x20configured');}if(!this[_0xe296('0x87')](_0x3c7b76[_0xe296('0x5a')])){return this[_0xe296('0xf')][_0xe296('0xac')](_0xe296('0xad'));}this['channel'][_0xe296('0xac')](util[_0xe296('0x55')]('Trying\x20ispeech\x20TTS\x20%s',_0x3c7b76[_0xe296('0x5a')]));var _0x4702a9=this[_0xe296('0x81')][_0xe296('0x71')](this,_0x3c7b76);if(_0x4702a9){this[_0xe296('0xf')][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0x158'),_0x4702a9));var _0x112d1c=this['channel'][_0xe296('0x10a')](_0x4702a9,_0x3c7b76['intKey']);try{fs[_0xe296('0x10b')](_0x4702a9+_0xe296('0x12e'));}catch(_0x6da83b){logger[_0xe296('0x2f')](_0x6da83b);}return _0x112d1c;}return this[_0xe296('0xf')][_0xe296('0x2f')](_0x3c7b76,_0xe296('0x15d'));};AGIVertices[_0xe296('0x10')]['login']=function(_0x52d690){logger[_0xe296('0x31')](util['format'](_0xe296('0x15e'),_0x52d690[_0xe296('0x38')]));if(!this[_0xe296('0x87')](_0x52d690['findBy'])){return this[_0xe296('0xf')]['error'](_0x52d690,_0xe296('0x15f'));}logger['info'](util[_0xe296('0x55')](_0xe296('0x160'),this[_0xe296('0xf')][_0xe296('0x3b')],_0x52d690[_0xe296('0x161')]));var _0x440f87=this[_0xe296('0x53')][_0xe296('0x71')](this,_0x52d690[_0xe296('0x161')]);if(_0x440f87){logger[_0xe296('0x31')](util[_0xe296('0x55')](_0xe296('0x162'),this['channel'][_0xe296('0x3b')],_0x52d690[_0xe296('0x161')]));this[_0xe296('0xf')]['noop'](util[_0xe296('0x55')](_0xe296('0x162'),this[_0xe296('0xf')][_0xe296('0x3b')],_0x52d690['findBy']));return{'code':0xc8,'result':_0xe296('0x163')};}else{logger[_0xe296('0x31')](util[_0xe296('0x55')](_0xe296('0x164'),this[_0xe296('0xf')][_0xe296('0x3b')],_0x52d690['findBy']));this[_0xe296('0xf')][_0xe296('0xac')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xe296('0x3b')],_0x52d690[_0xe296('0x161')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xe296('0x10')][_0xe296('0x165')]=function(_0x19c076){logger[_0xe296('0x31')](util[_0xe296('0x55')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x19c076[_0xe296('0x38')]));if(!this['isConfigured'](_0x19c076[_0xe296('0x161')])){return this[_0xe296('0xf')]['error'](_0x19c076,_0xe296('0x15f'));}logger['info'](util[_0xe296('0x55')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xe296('0xf')]['callerid'],_0x19c076[_0xe296('0x161')]));var _0x3ac391=this[_0xe296('0x52')][_0xe296('0x71')](this,_0x19c076['findBy']);if(_0x3ac391){logger['info'](util[_0xe296('0x55')](_0xe296('0x162'),this[_0xe296('0xf')][_0xe296('0x3b')],_0x19c076['findBy']));this[_0xe296('0xf')][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0x162'),this[_0xe296('0xf')]['callerid'],_0x19c076[_0xe296('0x161')]));return{'code':0xc8,'result':_0xe296('0x163')};}else{logger[_0xe296('0x31')](util[_0xe296('0x55')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe296('0xf')]['callerid'],_0x19c076[_0xe296('0x161')]));this[_0xe296('0xf')][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0x164'),this[_0xe296('0xf')][_0xe296('0x3b')],_0x19c076[_0xe296('0x161')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xe296('0x10')]['math']=function(_0x1d56fe){logger[_0xe296('0x31')](util['format'](_0xe296('0x166'),_0x1d56fe[_0xe296('0x38')]));if(!this['isConfigured'](_0x1d56fe[_0xe296('0x167')])){return this[_0xe296('0xf')]['error'](_0x1d56fe,_0xe296('0x168'));}this[_0xe296('0xf')]['noop'](util['format'](_0xe296('0x169'),_0x1d56fe[_0xe296('0x167')]));var _0x41a548=eval(_0x1d56fe['operation']);if(!this[_0xe296('0x87')](_0x1d56fe['variable_id'])){return this[_0xe296('0xf')][_0xe296('0xac')](_0xe296('0x11b'));}var _0x5083d4=this[_0xe296('0x11')][_0xe296('0x71')](this,_0x1d56fe[_0xe296('0xdb')]);if(!_0x5083d4){return this['channel'][_0xe296('0x2f')](_0x1d56fe,_0xe296('0x120'));}if(_['isArray'](_0x41a548)){var _0x10f775=this;_0x41a548[_0xe296('0xdd')](function(_0x12f7d3,_0x183fa6){_0x10f775['channel'][_0xe296('0xa3')](util['format'](_0xe296('0x16a'),_0x5083d4,_0x183fa6),_0x12f7d3);});return this[_0xe296('0xf')][_0xe296('0xac')](util['format'](_0xe296('0x16b'),_0x5083d4));}else{return this['channel'][_0xe296('0xa3')](_0x5083d4,_0x41a548);}};AGIVertices['prototype'][_0xe296('0xc')]=function(_0x2e1072){logger['info'](util[_0xe296('0x55')](_0xe296('0x16c'),_0x2e1072[_0xe296('0x38')]));if(_0x2e1072['retry']===0x0){return this['maxRetry'](_0x2e1072);}_0x2e1072[_0xe296('0x117')]-=0x1;if(!this['isConfigured'](_0x2e1072[_0xe296('0x119')])){return this['channel'][_0xe296('0x2f')](_0x2e1072,_0xe296('0x118'));}var _0x4c183d=this[_0xe296('0x20')][_0xe296('0x71')](this,_0x2e1072[_0xe296('0x119')]);if(!_0x4c183d){return this[_0xe296('0xf')][_0xe296('0x2f')](_0x2e1072,_0xe296('0x11a'));}var _0x5107ea=this['channel']['getData'](_0x4c183d,_0x2e1072[_0xe296('0x11c')],_0x2e1072[_0xe296('0x16d')]);var _0x21a46e=_0x5107ea[_0xe296('0xa7')];if(_0x5107ea[_0xe296('0xa7')]===-0x1){this['createSquareDetailsReport'][_0xe296('0x71')](this,_0x2e1072,'-1');return _0x5107ea;}else if(_0x5107ea['extra']==='timeout'){_0x5107ea[_0xe296('0xa7')]=_0x5107ea['result'][_0xe296('0xa0')]>0x0?_0x5107ea[_0xe296('0xa7')]:'t';}else if(_[_0xe296('0x44')](_0x5107ea['result'])){_0x5107ea[_0xe296('0xa7')]='#';_0x21a46e='#';}if(!this[_0xe296('0x87')](_0x2e1072[_0xe296('0xdb')])){this[_0xe296('0xf')][_0xe296('0xac')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x56e581=this[_0xe296('0x11')][_0xe296('0x71')](this,_0x2e1072[_0xe296('0xdb')]);if(!_0x56e581){return this['channel'][_0xe296('0x2f')](_0x2e1072,_0xe296('0x120'));}this[_0xe296('0xf')][_0xe296('0xa3')](_0x56e581,_0x21a46e);}this[_0xe296('0xda')][_0xe296('0x71')](this,_0x2e1072,_0x21a46e);return _0x5107ea;};AGIVertices[_0xe296('0x10')]['noop']=function(_0x1eb69c){logger[_0xe296('0x31')](util[_0xe296('0x55')](_0xe296('0x16e'),_0x1eb69c[_0xe296('0x38')]));return this[_0xe296('0xf')][_0xe296('0xac')](_0x1eb69c['output']||_0x1eb69c['label']);};AGIVertices['prototype'][_0xe296('0x16f')]=function(_0x97d5d0){logger[_0xe296('0x31')](util[_0xe296('0x55')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x97d5d0[_0xe296('0x38')]));if(!this['isConfigured'](_0x97d5d0[_0xe296('0x161')])){return this[_0xe296('0xf')]['error'](_0x97d5d0,_0xe296('0x15f'));}logger[_0xe296('0x31')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xe296('0xf')][_0xe296('0x3b')],_0x97d5d0[_0xe296('0x161')]));var _0x48e8f9=this[_0xe296('0x170')]['sync'](this,_0x97d5d0[_0xe296('0x171')]);var _0x24f7fc=this[_0xe296('0x4e')][_0xe296('0x71')](this,_0x97d5d0[_0xe296('0x161')],_0x48e8f9);if(_0x24f7fc){logger[_0xe296('0x31')](util[_0xe296('0x55')](_0xe296('0x162'),this['channel'][_0xe296('0x3b')],_0x97d5d0['findBy']));this[_0xe296('0xf')][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0x162'),this[_0xe296('0xf')]['callerid'],_0x97d5d0[_0xe296('0x161')]));return{'code':0xc8,'result':_0xe296('0x163')};}else{logger['info'](util[_0xe296('0x55')](_0xe296('0x164'),this['channel'][_0xe296('0x3b')],_0x97d5d0[_0xe296('0x161')]));this[_0xe296('0xf')][_0xe296('0xac')](util[_0xe296('0x55')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe296('0xf')][_0xe296('0x3b')],_0x97d5d0['findBy']));return{'code':0xc8,'result':_0xe296('0x172')};}};AGIVertices['prototype']['playback']=function(_0x2176a2){logger['info'](util[_0xe296('0x55')](_0xe296('0x173'),_0x2176a2[_0xe296('0x38')]));if(!this['isConfigured'](_0x2176a2['file_id'])){return this[_0xe296('0xf')][_0xe296('0x2f')](_0x2176a2,_0xe296('0x118'));}var _0x1667d5=this[_0xe296('0x20')]['sync'](this,_0x2176a2[_0xe296('0x119')]);if(!_0x1667d5){return this[_0xe296('0xf')][_0xe296('0x2f')](_0x2176a2,_0xe296('0x11a'));}var _0x41675d=this[_0xe296('0xf')][_0xe296('0xae')](_0xe296('0x174'),[_0x1667d5,_0x2176a2['opts']]);if(_0x41675d[_0xe296('0xa7')]===-0x1){return _0x41675d;}return this['channel'][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0xca'),_0xe296('0x174'),_0x1667d5));};AGIVertices[_0xe296('0x10')]['queue']=function(_0x5f52d8){logger[_0xe296('0x31')](util[_0xe296('0x55')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x5f52d8[_0xe296('0x38')]));if(!this[_0xe296('0x87')](_0x5f52d8[_0xe296('0x175')])){return this[_0xe296('0xf')]['error'](_0x5f52d8,_0xe296('0x176'));}var _0x5628d2='';var _0x34ed3d=parseInt(_0x5f52d8['queue_id'],0xa);if(isNaN(_0x34ed3d)){_0x5628d2=_0x5f52d8['queue_id'];}else{_0x5628d2=this[_0xe296('0x16')][_0xe296('0x71')](this,_0x5f52d8[_0xe296('0x175')]);if(!_0x5628d2){return this[_0xe296('0xf')][_0xe296('0x2f')](_0x5f52d8,_0xe296('0x177'));}}var _0x255e9e='';if(this[_0xe296('0x87')](_0x5f52d8[_0xe296('0x119')])){var _0x50bc06=this[_0xe296('0x20')][_0xe296('0x71')](this,_0x5f52d8[_0xe296('0x119')]);if(_0x50bc06){_0x255e9e=_0x50bc06;}}this[_0xe296('0xda')][_0xe296('0x71')](this,_0x5f52d8,_0x5628d2);if(_0x5f52d8[_0xe296('0xe8')]['indexOf']('x')<0x0){_0x5f52d8[_0xe296('0xe8')]+='x';}if(_0x5f52d8[_0xe296('0xe8')][_0xe296('0x178')]('X')<0x0){_0x5f52d8[_0xe296('0xe8')]+='X';}this['channel'][_0xe296('0xa3')](_0xe296('0x179'),_0x5628d2?_0x5628d2['toLowerCase']():'');var _0x2bc6aa=this[_0xe296('0xf')][_0xe296('0xae')](_0xe296('0x17a'),[_0x5628d2,_0x5f52d8[_0xe296('0xe8')],_0x5f52d8['url'],_0x255e9e,_0x5f52d8['timeout'],_0x5f52d8[_0xe296('0x8')],_0x5f52d8[_0xe296('0x17b')],_0x5f52d8[_0xe296('0x17c')],'',_0x5f52d8['position']]);if(_0x2bc6aa[_0xe296('0xa7')]===-0x1){return _0x2bc6aa;}return this['channel'][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0xca'),_0xe296('0x17a'),_0x5628d2));};AGIVertices['prototype'][_0xe296('0x17d')]=function(_0x379b0c){logger['info'](util[_0xe296('0x55')](_0xe296('0x17e'),_0x379b0c[_0xe296('0x38')]));var _0x260e9a=_0x379b0c['recordingFormat']||_0xe296('0x13a');var _0x2f1074=util[_0xe296('0x55')](_0xe296('0x17f'),this['channel'][_0xe296('0x37')],rs[_0xe296('0x122')](0x5));var _0x3e846f=util['format'](_0xe296('0x180'),FILES_PATH,_0x2f1074,_0x260e9a);var _0x54b68d=util[_0xe296('0x55')](_0xe296('0x143'),FILES_PATH,_0x2f1074);this[_0xe296('0x3c')]['sync'](this,_0x379b0c,_0x2f1074,_0x3e846f);this[_0xe296('0xf')][_0xe296('0xa3')]('RECORDING_SAVENAME',_0x2f1074);logger[_0xe296('0x31')](_0xe296('0x181'),_0x54b68d,_0x260e9a,_0x379b0c[_0xe296('0x182')],_0x379b0c['timeout']);return this['channel'][_0xe296('0x144')](_0x54b68d,_0x260e9a,_0x379b0c['escape_digits'],_0x379b0c['timeout'],undefined,!![]);};AGIVertices[_0xe296('0x10')]['restapi']=function(_0xa9646e){logger['info'](util[_0xe296('0x55')](_0xe296('0x183'),_0xa9646e[_0xe296('0x38')]));if(!this[_0xe296('0x87')](_0xa9646e['url'])){return this[_0xe296('0xf')]['noop'](_0xe296('0x184'));}var _0x28e7ee=this['restAPI']['sync'](this,_0xa9646e);logger[_0xe296('0x31')](util[_0xe296('0x55')](_0xe296('0x185'),util['inspect'](_0x28e7ee,{'showHidden':![],'depth':null})));if(!this[_0xe296('0x87')](_0xa9646e['variable_id'])){return this[_0xe296('0xf')][_0xe296('0xac')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x4835f6=this[_0xe296('0x11')]['sync'](this,_0xa9646e[_0xe296('0xdb')]);if(!_0x4835f6){return this[_0xe296('0xf')][_0xe296('0x2f')](_0xa9646e,_0xe296('0x120'));}this[_0xe296('0xf')][_0xe296('0xa3')](util[_0xe296('0x55')](_0xe296('0x186'),_0x4835f6),_0x28e7ee['statusCode']?_0x28e7ee['statusCode']:_0xe296('0x187'));this[_0xe296('0xf')][_0xe296('0xa3')](util['format'](_0xe296('0x188'),_0x4835f6),_0x28e7ee[_0xe296('0x189')]?_0x28e7ee[_0xe296('0x189')]:'OK');if(_0x28e7ee[_0xe296('0x73')]){try{this['saveRestApiResult'](_0x28e7ee[_0xe296('0x73')],_0x4835f6);}catch(_0x34866d){logger['error'](util['format'](_0xe296('0x18a'),_0x4835f6));}}return this[_0xe296('0xf')][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0xdf'),_0x4835f6));};AGIVertices[_0xe296('0x10')][_0xe296('0x18b')]=function(_0x5c4fd5){logger[_0xe296('0x31')](util[_0xe296('0x55')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x5c4fd5[_0xe296('0x38')]));return this[_0xe296('0xf')]['sayDigits'](_0x5c4fd5['digits']['replace'](/\s+/g,''),_0x5c4fd5[_0xe296('0x182')]);};AGIVertices[_0xe296('0x10')][_0xe296('0x18c')]=function(_0x14d4b6){logger[_0xe296('0x31')](util[_0xe296('0x55')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x14d4b6[_0xe296('0x38')]));return this[_0xe296('0xf')][_0xe296('0x18d')](_0x14d4b6['number'][_0xe296('0x58')](/\s+/g,''),_0x14d4b6['escape_digits']);};AGIVertices[_0xe296('0x10')][_0xe296('0x18e')]=function(_0x3f3696){logger[_0xe296('0x31')](util['format'](_0xe296('0x18f'),_0x3f3696[_0xe296('0x38')]));return this[_0xe296('0xf')][_0xe296('0x190')](_0x3f3696[_0xe296('0x5a')],_0x3f3696['escape_digits']);};AGIVertices[_0xe296('0x10')]['sendMail']=function(_0x179d97){logger[_0xe296('0x31')](util['format'](_0xe296('0x191'),_0x179d97[_0xe296('0x38')]));if(!this[_0xe296('0x87')](_0x179d97['account_id'])){return this[_0xe296('0xf')][_0xe296('0xac')](_0xe296('0x192'));}var _0x1b2e54=this[_0xe296('0x24')]['sync'](this,_0x179d97['account_id']);if(!_0x1b2e54||!_0x1b2e54[_0xe296('0x193')]){return this[_0xe296('0xf')][_0xe296('0x2f')](_0x179d97,_0xe296('0x194'));}var _0x49ad42={'from':util[_0xe296('0x55')](_0xe296('0x195'),_0x1b2e54[_0xe296('0x14')],_0x1b2e54[_0xe296('0x196')]||_0x1b2e54[_0xe296('0x193')][_0xe296('0x197')]),'to':_0x179d97['to']||'','cc':_0x179d97['cc']||'','bcc':_0x179d97[_0xe296('0x198')]||'','subject':_0x179d97[_0xe296('0x199')],'html':_0x179d97[_0xe296('0x5a')],'text':_0x179d97[_0xe296('0x5a')]};var _0x3b5009={'tls':{'rejectUnauthorized':![]}};if(_0x1b2e54[_0xe296('0x193')][_0xe296('0x19a')]){_0x3b5009['service']=_0x1b2e54['Smtp'][_0xe296('0x19a')];}else{_0x3b5009[_0xe296('0x19b')]=_0x1b2e54['Smtp']['host'];_0x3b5009[_0xe296('0x19c')]=_0x1b2e54[_0xe296('0x193')][_0xe296('0x19c')];_0x3b5009[_0xe296('0x19d')]=_0x1b2e54[_0xe296('0x193')][_0xe296('0x19d')];}if(_0x1b2e54[_0xe296('0x193')][_0xe296('0x19e')]){_0x3b5009[_0xe296('0x19f')]={'user':_0x1b2e54[_0xe296('0x193')][_0xe296('0x197')],'pass':_0x1b2e54[_0xe296('0x193')][_0xe296('0x1a0')]};}if(this['isConfigured'](_0x179d97[_0xe296('0x1a1')])){}logger['debug']('sendMail\x20message',JSON[_0xe296('0x74')](_0x49ad42));this[_0xe296('0xda')][_0xe296('0x71')](this,_0x179d97,_0x179d97['account_id']);this[_0xe296('0xf')][_0xe296('0xac')](util[_0xe296('0x55')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x1b2e54[_0xe296('0x14')]));this[_0xe296('0x25')][_0xe296('0x71')](this,_0x3b5009,_0x49ad42);return this[_0xe296('0xf')][_0xe296('0xac')](_0xe296('0x1a2'));};AGIVertices[_0xe296('0x10')][_0xe296('0x1a3')]=function(_0xcd67a7){logger[_0xe296('0x31')](util[_0xe296('0x55')](_0xe296('0x1a4'),_0xcd67a7['label']));return this[_0xe296('0xf')][_0xe296('0xac')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices['prototype'][_0xe296('0x1a5')]=function(_0x170202){logger['info'](util[_0xe296('0x55')](_0xe296('0x1a6'),_0x170202[_0xe296('0x38')]));if(!this[_0xe296('0x87')](_0x170202[_0xe296('0x1a7')])){return this[_0xe296('0xf')]['noop'](_0xe296('0x1a8'));}var _0x1028b5=this[_0xe296('0x35')]['sync'](this,_0x170202[_0xe296('0x1a7')]);if(!_0x1028b5){return this[_0xe296('0xf')]['error'](_0x170202,'no\x20sms\x20account\x20found');}var _0x2ad062={'body':_0x170202[_0xe296('0x1a9')],'phone':_0x170202['to']||'','SmsAccountId':_0x1028b5['id']};logger[_0xe296('0xe1')](_0xe296('0x1aa'),JSON[_0xe296('0x74')](_0x2ad062));this[_0xe296('0xda')][_0xe296('0x71')](this,_0x170202,_0x170202[_0xe296('0x1a7')]);this[_0xe296('0xf')][_0xe296('0xac')](util['format'](_0xe296('0x1ab'),_0x1028b5['name']));this[_0xe296('0x1ac')][_0xe296('0x71')](this,_0x2ad062);return this[_0xe296('0xf')]['noop'](_0xe296('0x1ad'));};AGIVertices[_0xe296('0x10')]['set']=function(_0x1948e9){logger['info'](util[_0xe296('0x55')](_0xe296('0x1ae'),_0x1948e9['label']));if(!this[_0xe296('0x87')](_0x1948e9[_0xe296('0xdb')])){return this[_0xe296('0xf')][_0xe296('0x2f')](_0x1948e9,_0xe296('0x1af'));}var _0x5f4cb3=this[_0xe296('0x11')][_0xe296('0x71')](this,_0x1948e9[_0xe296('0xdb')]);if(!_0x5f4cb3){return this[_0xe296('0xf')][_0xe296('0x2f')](_0x1948e9,'no\x20variable\x20found');}return this[_0xe296('0xf')][_0xe296('0xa3')](_0x5f4cb3,_0x1948e9['variable_value']);};AGIVertices[_0xe296('0x10')][_0xe296('0x1b0')]=function(_0x472a0a){logger[_0xe296('0x31')](util['format'](_0xe296('0x1b1'),_0x472a0a['label']));this[_0xe296('0xf')][_0xe296('0xac')](_0xe296('0x1b2'));if(_0x472a0a[_0xe296('0xbf')]===_0xe296('0x1b3')){this['channel'][_0xe296('0xac')](_0xe296('0x1b4'));return this[_0xe296('0xf')][_0xe296('0xbf')]();}return this[_0xe296('0xf')][_0xe296('0xac')](_0xe296('0x1b5'));};AGIVertices['prototype'][_0xe296('0x1b6')]=function(_0x36a4bf){logger[_0xe296('0x31')](util[_0xe296('0x55')](_0xe296('0x1b7'),_0x36a4bf[_0xe296('0x38')]));if(!this[_0xe296('0x87')](_0x36a4bf['project_id'])){return this[_0xe296('0xf')][_0xe296('0x2f')](_0x36a4bf,_0xe296('0x1b8'));}var _0x39502a=this[_0xe296('0x19')][_0xe296('0x71')](this,_0x36a4bf[_0xe296('0x1b9')]);if(!this[_0xe296('0x87')](_0x39502a)){return this[_0xe296('0xf')][_0xe296('0x2f')](_0x36a4bf,util[_0xe296('0x55')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x36a4bf[_0xe296('0x1b9')]));}if(_0x39502a===this[_0xe296('0xf')]['arg_1']){return this['channel']['error'](_0x36a4bf,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport'][_0xe296('0x71')](this,_0x36a4bf,_0x39502a);var _0x288582=this[_0xe296('0xf')]['exec'](_0xe296('0x1ba'),util[_0xe296('0x55')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0xe296('0x19b')]||_0xe296('0x1bb'),_0x39502a,this[_0xe296('0xf')][_0xe296('0x3a')]));if(_0x288582[_0xe296('0xa7')]===-0x1){return _0x288582;}return this[_0xe296('0xf')][_0xe296('0xac')](util['format'](_0xe296('0xca'),'AGI',_0x39502a));};AGIVertices['prototype'][_0xe296('0x1bc')]=function(_0x6fb1ff){logger[_0xe296('0x31')](util[_0xe296('0x55')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x6fb1ff[_0xe296('0x38')]));var _0x58baa3=this['shellCommand'][_0xe296('0x71')](this,_0x6fb1ff['command']);this[_0xe296('0xda')][_0xe296('0x71')](this,_0x6fb1ff,_0x6fb1ff['command']);if(this[_0xe296('0x87')](_0x6fb1ff['variable_id'])){var _0x47d2a9=this['getVariable'][_0xe296('0x71')](this,_0x6fb1ff[_0xe296('0xdb')]);if(_0x47d2a9){this['channel'][_0xe296('0xa3')](_0x47d2a9,_0x58baa3);return this['channel'][_0xe296('0xac')](util[_0xe296('0x55')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x6fb1ff[_0xe296('0xbd')],_0x47d2a9));}}return this[_0xe296('0xf')][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0x1bd'),_0x6fb1ff[_0xe296('0xbd')]));};AGIVertices[_0xe296('0x10')]['google_cloud_tts']=function(_0xc370a8){logger[_0xe296('0x31')](util[_0xe296('0x55')](_0xe296('0x1be'),_0xc370a8[_0xe296('0x38')]));_0xc370a8['text']=_0xc370a8[_0xe296('0x5a')][_0xe296('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xe296('0x87')](_0xc370a8[_0xe296('0x59')])){return this[_0xe296('0xf')][_0xe296('0xac')](_0xe296('0x1bf'));}if(!this[_0xe296('0x87')](_0xc370a8[_0xe296('0x5a')])){return this['channel'][_0xe296('0xac')](_0xe296('0xad'));}this[_0xe296('0xf')][_0xe296('0xac')](util['format'](_0xe296('0x1c0'),_0xc370a8[_0xe296('0x5a')]));var _0xf8f29b=this['googleCloudTTS']['sync'](this,_0xc370a8);if(_0xf8f29b){this[_0xe296('0xf')][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0x1c1'),_0xf8f29b));var _0xbc28f2=this['channel'][_0xe296('0x10a')](_0xf8f29b);try{fs['unlink'](_0xf8f29b+'.wav');}catch(_0xfa8751){logger[_0xe296('0x2f')](_0xfa8751);}return _0xbc28f2;}return this[_0xe296('0xf')][_0xe296('0x2f')](_0xc370a8,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0xe296('0x1c2')]=function(_0x2fecd2){logger[_0xe296('0x31')](util[_0xe296('0x55')](_0xe296('0x1c3'),_0x2fecd2[_0xe296('0x38')]));_0x2fecd2[_0xe296('0x5a')]=_0x2fecd2[_0xe296('0x5a')][_0xe296('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xe296('0x87')](_0x2fecd2[_0xe296('0x5a')])){return this[_0xe296('0xf')][_0xe296('0xac')]('no\x20text\x20configured');}this[_0xe296('0xf')][_0xe296('0xac')](util[_0xe296('0x55')]('Trying\x20Google\x20TTS\x20%s',_0x2fecd2[_0xe296('0x5a')]));var _0x5c8611=this['googleTTS']['sync'](this,_0x2fecd2);if(_0x5c8611){this[_0xe296('0xf')][_0xe296('0xac')](util['format'](_0xe296('0x1c4'),_0x5c8611));var _0x3ee1c7=this[_0xe296('0xf')][_0xe296('0x10a')](_0x5c8611);try{fs[_0xe296('0x10b')](_0x5c8611+_0xe296('0x12e'));}catch(_0x3e5c73){logger[_0xe296('0x2f')](_0x3e5c73);}return _0x3ee1c7;}return this[_0xe296('0xf')][_0xe296('0x2f')](_0x2fecd2,_0xe296('0x1c5'));};AGIVertices['prototype'][_0xe296('0x1c6')]=function(_0x229c6a){logger[_0xe296('0x31')](util['format'](_0xe296('0x1c7'),_0x229c6a[_0xe296('0x38')]));if(!this['isConfigured'](_0x229c6a[_0xe296('0x161')])){return this['channel'][_0xe296('0x2f')](_0x229c6a,_0xe296('0x15f'));}logger[_0xe296('0x31')](util[_0xe296('0x55')](_0xe296('0x160'),this[_0xe296('0xf')][_0xe296('0x3b')],_0x229c6a[_0xe296('0x161')]));var _0x1b53e6=this[_0xe296('0x4f')]['sync'](this,_0x229c6a['findBy']);if(_0x1b53e6){logger[_0xe296('0x31')](util[_0xe296('0x55')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe296('0xf')]['callerid'],_0x229c6a[_0xe296('0x161')]));this[_0xe296('0xf')][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0x162'),this[_0xe296('0xf')][_0xe296('0x3b')],_0x229c6a['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xe296('0x31')](util[_0xe296('0x55')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe296('0xf')][_0xe296('0x3b')],_0x229c6a[_0xe296('0x161')]));this['channel'][_0xe296('0xac')](util[_0xe296('0x55')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe296('0xf')][_0xe296('0x3b')],_0x229c6a['findBy']));return{'code':0xc8,'result':_0xe296('0x172')};}};AGIVertices[_0xe296('0x10')][_0xe296('0x1c8')]=function(_0x309832){logger[_0xe296('0x31')](util['format'](_0xe296('0x1c9'),_0x309832[_0xe296('0x38')]));var _0x4ea016=this[_0xe296('0xf')][_0xe296('0xae')]('VOICEMAIL',[_0x309832[_0xe296('0x1ca')],_0x309832[_0xe296('0x78')]]);if(_0x4ea016[_0xe296('0xa7')]===-0x1){return _0x4ea016;}return this[_0xe296('0xf')][_0xe296('0xac')](util[_0xe296('0x55')](_0xe296('0xca'),_0xe296('0x1cb'),_0x309832[_0xe296('0x1ca')]));};AGIVertices[_0xe296('0x10')][_0xe296('0x1cc')]=function(_0x558bf0){logger['info'](util['format'](_0xe296('0x1cd'),_0x558bf0[_0xe296('0x38')]));if(!this['isConfigured'](_0x558bf0['variable_id'])){return this[_0xe296('0xf')][_0xe296('0x2f')](_0x558bf0,_0xe296('0x1af'));}var _0x4e3df9=this[_0xe296('0x11')][_0xe296('0x71')](this,_0x558bf0[_0xe296('0xdb')]);if(!_0x4e3df9){return this[_0xe296('0xf')][_0xe296('0x2f')](_0x558bf0,_0xe296('0x120'));}var _0x2434f3=this[_0xe296('0xf')]['getVariable'](_0x4e3df9);return{'code':0xc8,'result':_0x2434f3['extra']?_0x2434f3['extra']:'-'};};String[_0xe296('0x10')][_0xe296('0x1ce')]=function(_0x2f0c86,_0x23d1bf){return this[_0xe296('0xa4')](_0x2f0c86)['join'](_0x23d1bf);};module[_0xe296('0x1cf')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 13b6ebc..af96129 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 _0x5ce9=['autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','moment','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','catch','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','isUndefined','attended','[%s][HANGUP:LINKEDID]','linkedid','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s'];(function(_0x225421,_0x499400){var _0x40d3ea=function(_0x4ec740){while(--_0x4ec740){_0x225421['push'](_0x225421['shift']());}};_0x40d3ea(++_0x499400);}(_0x5ce9,0x1b2));var _0x95ce=function(_0x32811e,_0x2b7c90){_0x32811e=_0x32811e-0x0;var _0x6fca0a=_0x5ce9[_0x32811e];return _0x6fca0a;};'use strict';var util=require(_0x95ce('0x0'));var _=require('lodash');var moment=require(_0x95ce('0x1'));var ami=require('../ami');var logger=require('../../../config/logger')('acw');var RpcUser=require(_0x95ce('0x2'));var RpcVoiceAgentReport=require(_0x95ce('0x3'));function Acw(_0x54a6de){this[_0x95ce('0x4')]=_0x54a6de[_0x95ce('0x4')];this[_0x95ce('0x5')]=_0x54a6de[_0x95ce('0x5')];this[_0x95ce('0x6')]=_0x54a6de[_0x95ce('0x6')];this[_0x95ce('0x7')]={};ami['on'](_0x95ce('0x8'),this[_0x95ce('0x9')][_0x95ce('0xa')](this));ami['on'](_0x95ce('0xb'),this[_0x95ce('0xc')]['bind'](this));ami['on'](_0x95ce('0xd'),this[_0x95ce('0xe')][_0x95ce('0xa')](this));ami['on'](_0x95ce('0xf'),this[_0x95ce('0x10')][_0x95ce('0xa')](this));ami['on']('attendedtransfer',this[_0x95ce('0x11')]['bind'](this));ami['on'](_0x95ce('0x12'),this['syncBlindTransfer']['bind'](this));ami['on'](_0x95ce('0x13'),this[_0x95ce('0x14')][_0x95ce('0xa')](this));}function getDiff(_0x42160c){var _0x49c9f4=moment()[_0x95ce('0x15')](0x0);var _0x3cd39e=moment(_0x42160c)[_0x95ce('0x15')](0x0);return _0x49c9f4[_0x95ce('0x16')](_0x3cd39e,'seconds');}Acw[_0x95ce('0x17')][_0x95ce('0x18')]=function(_0x15c2d2){try{var _0x366713=this;var _0x494068=this['channels'][_0x15c2d2][_0x95ce('0x19')];var _0x226064=this[_0x95ce('0x7')][_0x15c2d2][_0x95ce('0x1a')];var _0x3e6413=this[_0x95ce('0x4')][_0x226064];var _0x4af2c9=![];var _0x42f189=_0x95ce('0x1b');if(_0x3e6413[_0x95ce('0x1c')]){if(_0x3e6413[_0x95ce('0x1d')][_0x95ce('0x1e')]){_0x4af2c9=!![];_0x42f189=_0x3e6413[_0x95ce('0x1d')][_0x95ce('0x1e')];}}ami[_0x95ce('0x1f')]({'action':_0x95ce('0x20'),'interface':_0x494068,'paused':!![],'reason':_0x42f189})['then'](function(_0x57581a){if(_0x366713[_0x95ce('0x5')][_0x494068]){return RpcUser[_0x95ce('0x21')](_0x366713[_0x95ce('0x5')][_0x494068]['id'])[_0x95ce('0x22')](function(_0xb25fc3){if(_0xb25fc3&&!_0xb25fc3[_0x95ce('0x23')]){logger[_0x95ce('0x24')](_0x95ce('0x25'),_0x15c2d2,_0x494068,_0x226064);var _0x46cc6c=_0x366713[_0x95ce('0x7')][_0x15c2d2]['attended']&&_0x366713[_0x95ce('0x7')][_0x15c2d2][_0x95ce('0x26')]?_0x366713[_0x95ce('0x7')][_0x15c2d2][_0x95ce('0x26')]:_0x15c2d2;return RpcUser[_0x95ce('0x27')](_0x366713['agents'][_0x494068],_0x42f189,_0x46cc6c)[_0x95ce('0x22')](function(_0x2cda8d){if(!_0x4af2c9){_0x366713[_0x95ce('0x6')][_0x494068]={};logger[_0x95ce('0x24')](_0x95ce('0x28'),_0x15c2d2,_0x366713['voiceQueues'][_0x226064]['acwTimeout'],_0x494068,_0x226064);_0x366713[_0x95ce('0x6')][_0x494068][_0x95ce('0x29')]=setTimeout(_0x366713['stopAcw'][_0x95ce('0xa')](_0x366713,_0x494068),_0x366713[_0x95ce('0x4')][_0x226064][_0x95ce('0x2a')]*0x3e8);_0x366713[_0x95ce('0x6')][_0x494068][_0x95ce('0x2b')]=moment()[_0x95ce('0x2c')](_0x95ce('0x2d'));_0x366713['timers'][_0x494068][_0x95ce('0x2e')]=_0x15c2d2;_0x366713[_0x95ce('0x6')][_0x494068][_0x95ce('0x1a')]=_0x226064;_0x366713[_0x95ce('0x6')][_0x494068][_0x95ce('0x2f')]=function(){var _0x29086e=getDiff(_0x366713[_0x95ce('0x6')][_0x494068][_0x95ce('0x2b')]);clearTimeout(_0x366713[_0x95ce('0x6')][_0x494068][_0x95ce('0x29')]);_0x366713[_0x95ce('0x6')][_0x494068][_0x95ce('0x29')]=![];RpcVoiceAgentReport[_0x95ce('0x30')]({'acwtime':_0x29086e},_0x366713[_0x95ce('0x6')][_0x494068][_0x95ce('0x2e')],_0x494068)[_0x95ce('0x22')](function(_0x298805){logger[_0x95ce('0x24')](_0x95ce('0x31'),_0x15c2d2,_0x29086e,_0x298805);})['catch'](function(_0x485048){logger[_0x95ce('0x32')]('[%s][UPDATE][ERRORS:%s]',_0x15c2d2,_0x485048);});delete _0x366713[_0x95ce('0x6')][_0x494068];};}});}else{logger[_0x95ce('0x24')](_0x95ce('0x33'),_0x15c2d2,_0x494068,_0x226064);}});}})['catch'](function(_0x30ccd7){logger[_0x95ce('0x32')](_0x95ce('0x28'),_0x15c2d2,_0x366713['voiceQueues'][_0x226064][_0x95ce('0x2a')],_0x494068,_0x226064);})[_0x95ce('0x34')](function(){delete _0x366713[_0x95ce('0x7')][_0x15c2d2];});}catch(_0x119a18){logger[_0x95ce('0x32')](_0x95ce('0x35'),_0x119a18[_0x95ce('0x36')]);}};Acw[_0x95ce('0x17')]['stopAcw']=function(_0x576f09){try{var _0x2881c0=this;if(_0x2881c0[_0x95ce('0x6')][_0x576f09]){_0x2881c0[_0x95ce('0x6')][_0x576f09][_0x95ce('0x29')]=![];var _0xd40a80=_0x2881c0[_0x95ce('0x6')][_0x576f09][_0x95ce('0x2e')];var _0x1492df=_0x2881c0[_0x95ce('0x6')][_0x576f09][_0x95ce('0x1a')];var _0x5c05a9=_0x2881c0['voiceQueues'][_0x1492df]['acwTimeout'];logger[_0x95ce('0x24')](_0x95ce('0x37'),_0xd40a80,_0x576f09);RpcUser[_0x95ce('0x38')](this[_0x95ce('0x5')][_0x576f09]);RpcVoiceAgentReport[_0x95ce('0x30')]({'acwtime':_0x5c05a9,'agentacw':!![]},_0xd40a80,_0x576f09)['then'](function(_0x7e0ac2){logger['info'](_0x95ce('0x31'),_0xd40a80,_0x5c05a9,_0x7e0ac2);})[_0x95ce('0x39')](function(_0x37376f){logger[_0x95ce('0x32')]('[%s][UPDATE][ERRORS:%s]',_0xd40a80,_0x37376f);});}else{logger[_0x95ce('0x32')](_0x95ce('0x3a'),_0x576f09);if(_0x2881c0[_0x95ce('0x6')]){logger[_0x95ce('0x24')](_0x95ce('0x3b'),JSON[_0x95ce('0x3c')](_0x2881c0[_0x95ce('0x6')]));}}}catch(_0xd73b85){logger[_0x95ce('0x32')]('[ACW][STOP]\x20%s',_0xd73b85[_0x95ce('0x36')]);}};Acw[_0x95ce('0x17')][_0x95ce('0x9')]=function(_0x53f874){try{if(this[_0x95ce('0x4')][_0x53f874[_0x95ce('0x1a')]]&&(this['voiceQueues'][_0x53f874[_0x95ce('0x1a')]][_0x95ce('0x3d')]||this[_0x95ce('0x4')][_0x53f874[_0x95ce('0x1a')]][_0x95ce('0x1c')])){if(this[_0x95ce('0x5')][_0x53f874[_0x95ce('0x19')]]){this[_0x95ce('0x7')][_0x53f874[_0x95ce('0x2e')]]={'queue':_0x53f874['queue'],'interface':_0x53f874[_0x95ce('0x19')],'destlinkedid':_0x53f874[_0x95ce('0x26')]};}}}catch(_0x1861f1){logger[_0x95ce('0x32')](_0x95ce('0x3e'),_0x1861f1[_0x95ce('0x36')]);}};Acw[_0x95ce('0x17')][_0x95ce('0x14')]=function(_0x11bec1){try{if(this[_0x95ce('0x4')][_0x11bec1['queue']]&&(this[_0x95ce('0x4')][_0x11bec1[_0x95ce('0x1a')]][_0x95ce('0x3d')]||this[_0x95ce('0x4')][_0x11bec1[_0x95ce('0x1a')]][_0x95ce('0x1c')])){if(this[_0x95ce('0x5')][_0x11bec1[_0x95ce('0x19')]]){this[_0x95ce('0x7')][_0x11bec1[_0x95ce('0x2e')]]={'queue':_0x11bec1['queue'],'interface':_0x11bec1[_0x95ce('0x19')]};}}}catch(_0x468092){logger['error'](_0x95ce('0x3f'),_0x468092[_0x95ce('0x36')]);}};Acw['prototype'][_0x95ce('0xc')]=function(_0x402404){try{if(this[_0x95ce('0x7')][_0x402404[_0x95ce('0x2e')]]&&_['isUndefined'](this[_0x95ce('0x7')][_0x402404[_0x95ce('0x2e')]]['attended'])){logger['info'](_0x95ce('0x40'),_0x402404[_0x95ce('0x2e')]);this['startAcw'](_0x402404[_0x95ce('0x2e')]);}else if(this['channels'][_0x402404['linkedid']]&&_[_0x95ce('0x41')](this[_0x95ce('0x7')][_0x402404['linkedid']][_0x95ce('0x42')])){logger[_0x95ce('0x24')](_0x95ce('0x43'),_0x402404[_0x95ce('0x44')]);this['startAcw'](_0x402404[_0x95ce('0x44')]);}}catch(_0x554a9e){logger[_0x95ce('0x32')]('[ACW][syncHangupRequest]\x20%s',_0x554a9e[_0x95ce('0x36')]);}};Acw[_0x95ce('0x17')][_0x95ce('0xe')]=function(_0x715c09){try{if(this[_0x95ce('0x7')][_0x715c09[_0x95ce('0x2e')]]&&this[_0x95ce('0x7')][_0x715c09[_0x95ce('0x2e')]][_0x95ce('0x42')]){logger[_0x95ce('0x24')](_0x95ce('0x45'),_0x715c09['uniqueid']);this[_0x95ce('0x18')](_0x715c09['uniqueid']);}else if(this[_0x95ce('0x7')][_0x715c09[_0x95ce('0x44')]]&&this['channels'][_0x715c09[_0x95ce('0x44')]][_0x95ce('0x42')]){logger[_0x95ce('0x24')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x715c09[_0x95ce('0x44')]);this[_0x95ce('0x18')](_0x715c09['linkedid']);}}catch(_0x34c745){logger[_0x95ce('0x32')](_0x95ce('0x46'),_0x34c745['message']);}};Acw['prototype'][_0x95ce('0x11')]=function(_0x8963fe){try{if(!_[_0x95ce('0x47')](this[_0x95ce('0x7')][_0x8963fe[_0x95ce('0x48')]])){this[_0x95ce('0x18')](_0x8963fe['transfereeuniqueid']);if(this[_0x95ce('0x7')][_0x8963fe[_0x95ce('0x49')]]){this['channels'][_0x8963fe[_0x95ce('0x49')]][_0x95ce('0x42')]=!![];this[_0x95ce('0x7')][_0x8963fe['transfertargetuniqueid']]=this[_0x95ce('0x7')][_0x8963fe['secondtransfereruniqueid']];delete this[_0x95ce('0x7')][_0x8963fe[_0x95ce('0x49')]];}}else if(!_['isNil'](this[_0x95ce('0x7')][_0x8963fe[_0x95ce('0x4a')]])){this[_0x95ce('0x18')](_0x8963fe['transfertargetuniqueid']);if(this['channels'][_0x8963fe['origtransfereruniqueid']]){this['channels'][_0x8963fe[_0x95ce('0x4b')]][_0x95ce('0x42')]=!![];this[_0x95ce('0x7')][_0x8963fe['transfereeuniqueid']]=this['channels'][_0x8963fe[_0x95ce('0x4b')]];delete this[_0x95ce('0x7')][_0x8963fe[_0x95ce('0x4b')]];}}}catch(_0x530c67){logger[_0x95ce('0x32')](_0x95ce('0x4c'),_0x530c67[_0x95ce('0x36')]);}};Acw['prototype']['syncBlindTransfer']=function(_0x906a38){try{if(this['channels'][_0x906a38[_0x95ce('0x4d')]]){logger[_0x95ce('0x24')](_0x95ce('0x4e'),JSON[_0x95ce('0x3c')](_0x906a38[_0x95ce('0x4d')]));this[_0x95ce('0x18')](_0x906a38['transfereruniqueid']);}else if(this[_0x95ce('0x7')][_0x906a38[_0x95ce('0x4f')]]){logger[_0x95ce('0x24')](_0x95ce('0x50'),JSON['stringify'](_0x906a38['transfererlinkedid']));this[_0x95ce('0x18')](_0x906a38['transfererlinkedid']);}}catch(_0x11cc08){logger[_0x95ce('0x32')](_0x95ce('0x51'),_0x11cc08[_0x95ce('0x36')]);}};Acw[_0x95ce('0x17')][_0x95ce('0x10')]=function(_0x298a5f){try{if(this['voiceQueues'][_0x298a5f['queue']]&&this[_0x95ce('0x4')][_0x298a5f['queue']][_0x95ce('0x52')]==='all'){if(this[_0x95ce('0x5')][_0x298a5f['interface']]){logger[_0x95ce('0x24')](_0x95ce('0x53'),_0x298a5f['uniqueid'],_0x298a5f['interface'],_0x298a5f[_0x95ce('0x1a')]);return RpcUser[_0x95ce('0x27')](this[_0x95ce('0x5')][_0x298a5f[_0x95ce('0x19')]],'Auto-Pause',_0x298a5f['uniqueid']);}}}catch(_0x5683de){logger[_0x95ce('0x32')](_0x95ce('0x54'),_0x5683de[_0x95ce('0x36')]);}};module[_0x95ce('0x55')]=Acw; \ No newline at end of file +var _0x308b=['stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../rpc/user','../rpc/voiceAgentReport','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','interface','queue','voiceQueues','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','uniqueid','update','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','then','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','prototype','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]'];(function(_0x1dbbba,_0x10d7f9){var _0x419cbd=function(_0x51823d){while(--_0x51823d){_0x1dbbba['push'](_0x1dbbba['shift']());}};_0x419cbd(++_0x10d7f9);}(_0x308b,0xbb));var _0xb308=function(_0x4d39b8,_0x8ef9ea){_0x4d39b8=_0x4d39b8-0x0;var _0x3942f2=_0x308b[_0x4d39b8];return _0x3942f2;};'use strict';var util=require(_0xb308('0x0'));var _=require(_0xb308('0x1'));var moment=require(_0xb308('0x2'));var ami=require('../ami');var logger=require('../../../config/logger')('acw');var RpcUser=require(_0xb308('0x3'));var RpcVoiceAgentReport=require(_0xb308('0x4'));function Acw(_0x502abe){this['voiceQueues']=_0x502abe['voiceQueues'];this[_0xb308('0x5')]=_0x502abe[_0xb308('0x5')];this['timers']=_0x502abe[_0xb308('0x6')];this[_0xb308('0x7')]={};ami['on'](_0xb308('0x8'),this[_0xb308('0x9')][_0xb308('0xa')](this));ami['on'](_0xb308('0xb'),this[_0xb308('0xc')][_0xb308('0xa')](this));ami['on'](_0xb308('0xd'),this[_0xb308('0xe')][_0xb308('0xa')](this));ami['on'](_0xb308('0xf'),this[_0xb308('0x10')][_0xb308('0xa')](this));ami['on'](_0xb308('0x11'),this[_0xb308('0x12')][_0xb308('0xa')](this));ami['on'](_0xb308('0x13'),this[_0xb308('0x14')][_0xb308('0xa')](this));ami['on'](_0xb308('0x15'),this[_0xb308('0x16')][_0xb308('0xa')](this));}function getDiff(_0x56b415){var _0x711670=moment()[_0xb308('0x17')](0x0);var _0xa435d5=moment(_0x56b415)['milliseconds'](0x0);return _0x711670[_0xb308('0x18')](_0xa435d5,_0xb308('0x19'));}Acw['prototype']['startAcw']=function(_0x5ac222){try{var _0x136b23=this;var _0x55d7a2=this[_0xb308('0x7')][_0x5ac222][_0xb308('0x1a')];var _0x47da4f=this[_0xb308('0x7')][_0x5ac222][_0xb308('0x1b')];var _0xff4012=this[_0xb308('0x1c')][_0x47da4f];var _0xcbb905=![];var _0xbde65f=_0xb308('0x1d');if(_0xff4012[_0xb308('0x1e')]){if(_0xff4012[_0xb308('0x1f')][_0xb308('0x20')]){_0xcbb905=!![];_0xbde65f=_0xff4012[_0xb308('0x1f')]['name'];}}ami[_0xb308('0x21')]({'action':_0xb308('0x22'),'interface':_0x55d7a2,'paused':!![],'reason':_0xbde65f})['then'](function(_0x31ac3a){if(_0x136b23[_0xb308('0x5')][_0x55d7a2]){return RpcUser[_0xb308('0x23')](_0x136b23['agents'][_0x55d7a2]['id'])['then'](function(_0x1a9160){if(_0x1a9160&&!_0x1a9160[_0xb308('0x24')]){logger[_0xb308('0x25')](_0xb308('0x26'),_0x5ac222,_0x55d7a2,_0x47da4f);var _0x34ad24=_0x136b23['channels'][_0x5ac222][_0xb308('0x27')]&&_0x136b23[_0xb308('0x7')][_0x5ac222][_0xb308('0x28')]?_0x136b23[_0xb308('0x7')][_0x5ac222][_0xb308('0x28')]:_0x5ac222;return RpcUser[_0xb308('0x29')](_0x136b23[_0xb308('0x5')][_0x55d7a2],_0xbde65f,_0x34ad24)['then'](function(_0x2ff0e1){if(!_0xcbb905){_0x136b23[_0xb308('0x6')][_0x55d7a2]={};logger['info'](_0xb308('0x2a'),_0x5ac222,_0x136b23['voiceQueues'][_0x47da4f][_0xb308('0x2b')],_0x55d7a2,_0x47da4f);_0x136b23[_0xb308('0x6')][_0x55d7a2][_0xb308('0x2c')]=setTimeout(_0x136b23[_0xb308('0x2d')][_0xb308('0xa')](_0x136b23,_0x55d7a2),_0x136b23['voiceQueues'][_0x47da4f]['acwTimeout']*0x3e8);_0x136b23[_0xb308('0x6')][_0x55d7a2][_0xb308('0x2e')]=moment()[_0xb308('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');_0x136b23[_0xb308('0x6')][_0x55d7a2][_0xb308('0x30')]=_0x5ac222;_0x136b23[_0xb308('0x6')][_0x55d7a2][_0xb308('0x1b')]=_0x47da4f;_0x136b23[_0xb308('0x6')][_0x55d7a2]['updateAcw']=function(){var _0x2b0cae=getDiff(_0x136b23['timers'][_0x55d7a2][_0xb308('0x2e')]);clearTimeout(_0x136b23['timers'][_0x55d7a2][_0xb308('0x2c')]);_0x136b23['timers'][_0x55d7a2][_0xb308('0x2c')]=![];RpcVoiceAgentReport[_0xb308('0x31')]({'acwtime':_0x2b0cae},_0x136b23[_0xb308('0x6')][_0x55d7a2]['uniqueid'],_0x55d7a2)['then'](function(_0x479137){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x5ac222,_0x2b0cae,_0x479137);})[_0xb308('0x32')](function(_0x117807){logger[_0xb308('0x33')](_0xb308('0x34'),_0x5ac222,_0x117807);});delete _0x136b23[_0xb308('0x6')][_0x55d7a2];};}});}else{logger[_0xb308('0x25')](_0xb308('0x35'),_0x5ac222,_0x55d7a2,_0x47da4f);}});}})[_0xb308('0x32')](function(_0x2c4ca7){logger[_0xb308('0x33')](_0xb308('0x2a'),_0x5ac222,_0x136b23[_0xb308('0x1c')][_0x47da4f]['acwTimeout'],_0x55d7a2,_0x47da4f);})[_0xb308('0x36')](function(){delete _0x136b23['channels'][_0x5ac222];});}catch(_0x4ff181){logger[_0xb308('0x33')](_0xb308('0x37'),_0x4ff181[_0xb308('0x38')]);}};Acw['prototype']['stopAcw']=function(_0x356a3c){try{var _0xdc2df1=this;if(_0xdc2df1[_0xb308('0x6')][_0x356a3c]){_0xdc2df1[_0xb308('0x6')][_0x356a3c][_0xb308('0x2c')]=![];var _0x197414=_0xdc2df1['timers'][_0x356a3c]['uniqueid'];var _0x474276=_0xdc2df1[_0xb308('0x6')][_0x356a3c][_0xb308('0x1b')];var _0x6f8cfd=_0xdc2df1['voiceQueues'][_0x474276][_0xb308('0x2b')];logger[_0xb308('0x25')](_0xb308('0x39'),_0x197414,_0x356a3c);RpcUser[_0xb308('0x3a')](this['agents'][_0x356a3c]);RpcVoiceAgentReport[_0xb308('0x31')]({'acwtime':_0x6f8cfd,'agentacw':!![]},_0x197414,_0x356a3c)[_0xb308('0x3b')](function(_0x47e988){logger[_0xb308('0x25')]('[%s][UPDATE][ACWTIME:%s]',_0x197414,_0x6f8cfd,_0x47e988);})[_0xb308('0x32')](function(_0xfafb23){logger[_0xb308('0x33')](_0xb308('0x34'),_0x197414,_0xfafb23);});}else{logger[_0xb308('0x33')](_0xb308('0x3c'),_0x356a3c);if(_0xdc2df1['timers']){logger[_0xb308('0x25')]('[ACW][TIMERS]',JSON['stringify'](_0xdc2df1[_0xb308('0x6')]));}}}catch(_0x1e7753){logger[_0xb308('0x33')](_0xb308('0x3d'),_0x1e7753['message']);}};Acw['prototype'][_0xb308('0x9')]=function(_0x43a061){try{if(this[_0xb308('0x1c')][_0x43a061['queue']]&&(this[_0xb308('0x1c')][_0x43a061[_0xb308('0x1b')]][_0xb308('0x3e')]||this[_0xb308('0x1c')][_0x43a061[_0xb308('0x1b')]]['mandatoryDisposition'])){if(this[_0xb308('0x5')][_0x43a061['interface']]){this[_0xb308('0x7')][_0x43a061['uniqueid']]={'queue':_0x43a061['queue'],'interface':_0x43a061[_0xb308('0x1a')],'destlinkedid':_0x43a061[_0xb308('0x28')]};}}}catch(_0x2133eb){logger[_0xb308('0x33')](_0xb308('0x3f'),_0x2133eb[_0xb308('0x38')]);}};Acw[_0xb308('0x40')][_0xb308('0x16')]=function(_0x323599){try{if(this['voiceQueues'][_0x323599[_0xb308('0x1b')]]&&(this[_0xb308('0x1c')][_0x323599[_0xb308('0x1b')]]['acw']||this[_0xb308('0x1c')][_0x323599[_0xb308('0x1b')]][_0xb308('0x1e')])){if(this['agents'][_0x323599[_0xb308('0x1a')]]){this[_0xb308('0x7')][_0x323599[_0xb308('0x30')]]={'queue':_0x323599['queue'],'interface':_0x323599['interface']};}}}catch(_0x494cdb){logger[_0xb308('0x33')](_0xb308('0x41'),_0x494cdb[_0xb308('0x38')]);}};Acw['prototype']['syncHangupRequest']=function(_0x161c4b){try{if(this['channels'][_0x161c4b['uniqueid']]&&_[_0xb308('0x42')](this[_0xb308('0x7')][_0x161c4b['uniqueid']][_0xb308('0x27')])){logger[_0xb308('0x25')]('[%s][HANGUP:UNIQUEID]',_0x161c4b[_0xb308('0x30')]);this[_0xb308('0x43')](_0x161c4b[_0xb308('0x30')]);}else if(this[_0xb308('0x7')][_0x161c4b[_0xb308('0x44')]]&&_[_0xb308('0x42')](this['channels'][_0x161c4b[_0xb308('0x44')]][_0xb308('0x27')])){logger[_0xb308('0x25')](_0xb308('0x45'),_0x161c4b['linkedid']);this['startAcw'](_0x161c4b['linkedid']);}}catch(_0x4bcf91){logger[_0xb308('0x33')]('[ACW][syncHangupRequest]\x20%s',_0x4bcf91[_0xb308('0x38')]);}};Acw[_0xb308('0x40')]['syncHangup']=function(_0x3a03b1){try{if(this[_0xb308('0x7')][_0x3a03b1[_0xb308('0x30')]]&&this[_0xb308('0x7')][_0x3a03b1[_0xb308('0x30')]][_0xb308('0x27')]){logger[_0xb308('0x25')](_0xb308('0x46'),_0x3a03b1[_0xb308('0x30')]);this['startAcw'](_0x3a03b1[_0xb308('0x30')]);}else if(this['channels'][_0x3a03b1[_0xb308('0x44')]]&&this[_0xb308('0x7')][_0x3a03b1[_0xb308('0x44')]][_0xb308('0x27')]){logger[_0xb308('0x25')](_0xb308('0x47'),_0x3a03b1['linkedid']);this['startAcw'](_0x3a03b1['linkedid']);}}catch(_0x5e4656){logger[_0xb308('0x33')]('[ACW][syncHangup]\x20%s',_0x5e4656[_0xb308('0x38')]);}};Acw['prototype'][_0xb308('0x12')]=function(_0x5199b9){try{if(!_[_0xb308('0x48')](this['channels'][_0x5199b9[_0xb308('0x49')]])){this[_0xb308('0x43')](_0x5199b9[_0xb308('0x49')]);if(this[_0xb308('0x7')][_0x5199b9[_0xb308('0x4a')]]){this[_0xb308('0x7')][_0x5199b9['secondtransfereruniqueid']][_0xb308('0x27')]=!![];this['channels'][_0x5199b9[_0xb308('0x4b')]]=this[_0xb308('0x7')][_0x5199b9[_0xb308('0x4a')]];delete this[_0xb308('0x7')][_0x5199b9[_0xb308('0x4a')]];}}else if(!_[_0xb308('0x48')](this['channels'][_0x5199b9[_0xb308('0x4b')]])){this[_0xb308('0x43')](_0x5199b9['transfertargetuniqueid']);if(this['channels'][_0x5199b9[_0xb308('0x4c')]]){this['channels'][_0x5199b9['origtransfereruniqueid']][_0xb308('0x27')]=!![];this[_0xb308('0x7')][_0x5199b9['transfereeuniqueid']]=this['channels'][_0x5199b9['origtransfereruniqueid']];delete this[_0xb308('0x7')][_0x5199b9[_0xb308('0x4c')]];}}}catch(_0x9dcc7d){logger[_0xb308('0x33')](_0xb308('0x4d'),_0x9dcc7d[_0xb308('0x38')]);}};Acw[_0xb308('0x40')][_0xb308('0x14')]=function(_0x2d3254){try{if(this[_0xb308('0x7')][_0x2d3254[_0xb308('0x4e')]]){logger[_0xb308('0x25')](_0xb308('0x4f'),JSON[_0xb308('0x50')](_0x2d3254[_0xb308('0x4e')]));this['startAcw'](_0x2d3254[_0xb308('0x4e')]);}else if(this['channels'][_0x2d3254[_0xb308('0x51')]]){logger[_0xb308('0x25')](_0xb308('0x52'),JSON[_0xb308('0x50')](_0x2d3254[_0xb308('0x51')]));this[_0xb308('0x43')](_0x2d3254['transfererlinkedid']);}}catch(_0x7af181){logger[_0xb308('0x33')](_0xb308('0x53'),_0x7af181[_0xb308('0x38')]);}};Acw[_0xb308('0x40')][_0xb308('0x10')]=function(_0x598793){try{if(this[_0xb308('0x1c')][_0x598793[_0xb308('0x1b')]]&&this[_0xb308('0x1c')][_0x598793[_0xb308('0x1b')]][_0xb308('0x54')]===_0xb308('0x55')){if(this['agents'][_0x598793[_0xb308('0x1a')]]){logger['info'](_0xb308('0x56'),_0x598793['uniqueid'],_0x598793[_0xb308('0x1a')],_0x598793[_0xb308('0x1b')]);return RpcUser[_0xb308('0x29')](this[_0xb308('0x5')][_0x598793[_0xb308('0x1a')]],'Auto-Pause',_0x598793[_0xb308('0x30')]);}}}catch(_0xaf23bb){logger[_0xb308('0x33')](_0xb308('0x57'),_0xaf23bb[_0xb308('0x38')]);}};module[_0xb308('0x58')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index de2ea22..7a6a09c 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 _0x2032=['exports','bluebird','moment','util','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','format','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','inspect'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2032,0xd9));var _0x2203=function(_0x24b8d7,_0x366eff){_0x24b8d7=_0x24b8d7-0x0;var _0x5c41f9=_0x2032[_0x24b8d7];return _0x5c41f9;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var util=require(_0x2203('0x2'));var _=require('lodash');var logger=require(_0x2203('0x3'))(_0x2203('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x2203('0x5')][_0x2203('0x6')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')][_0x2203('0x8')],!![]);ami[_0x2203('0x9')]();ami[_0x2203('0xa')]=BPromise[_0x2203('0xb')](ami[_0x2203('0xc')]);function error(_0x5ecf9e){logger['error'](util[_0x2203('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x5ecf9e,![],null)));}function close(){logger[_0x2203('0xe')](util['format'](_0x2203('0xf'),config[_0x2203('0x5')]['username'],config['asterisk']['ip'],config['asterisk']['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x2203('0xa')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x10')});};};ami[_0x2203('0x11')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x12')});};};ami[_0x2203('0x13')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x14')});};};ami[_0x2203('0x15')]=function(){return function(){return ami[_0x2203('0xa')]({'action':'coreshowchannels'});};};function connect(_0x280eda){logger[_0x2203('0x16')](util['format'](_0x2203('0x17'),config[_0x2203('0x5')]['username'],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')]));ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')](_0x2203('0x19'),close);}ami['on'](_0x2203('0x1a'),connect);ami['on']('shutdown',function(_0x13d3f7){logger['info'](util['format'](_0x2203('0x1b'),config['asterisk'][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x13d3f7,![],null)));});ami['on']('fullybooted',function(_0x226374){logger[_0x2203('0x16')](util[_0x2203('0xd')](_0x2203('0x1c'),config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')]['port']));return BPromise[_0x2203('0x1d')]()[_0x2203('0x1e')](ami[_0x2203('0x1f')]())['then'](ami[_0x2203('0x20')]())[_0x2203('0x1e')](ami['actionSipPeerStatus']())[_0x2203('0x1e')](ami[_0x2203('0x13')]())[_0x2203('0x1e')](ami[_0x2203('0x15')]())[_0x2203('0x21')](function(_0x1df508){logger[_0x2203('0xe')]('[ami.js][fullybooted]',util[_0x2203('0x22')](_0x1df508,{'showHidden':![],'depth':null}));});});ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')]('close',close);module[_0x2203('0x23')]=ami; \ No newline at end of file +var _0xb7e7=['username','Action','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','[ami.js][fullybooted]','exports','asterisk-manager','moment','lodash','ami','asterisk','port','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s'];(function(_0x113961,_0x5b32de){var _0x8eae00=function(_0x3869d2){while(--_0x3869d2){_0x113961['push'](_0x113961['shift']());}};_0x8eae00(++_0x5b32de);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xb7e7[_0x4ea69d];return _0x5318e0;};'use strict';var Manager=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var moment=require(_0x7b7e('0x1'));var util=require('util');var _=require(_0x7b7e('0x2'));var logger=require('../../config/logger')(_0x7b7e('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0x7b7e('0x4')][_0x7b7e('0x5')],config[_0x7b7e('0x4')]['ip'],config['asterisk']['username'],config[_0x7b7e('0x4')][_0x7b7e('0x6')],!![]);ami[_0x7b7e('0x7')]();ami['Action']=BPromise[_0x7b7e('0x8')](ami[_0x7b7e('0x9')]);function error(_0x2917f9){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xc'),config[_0x7b7e('0x4')]['username'],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x2917f9,![],null)));}function close(){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xe'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x11')});};};ami[_0x7b7e('0x12')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x7b7e('0x14')});};};ami[_0x7b7e('0x15')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x16')});};};function connect(_0x2cc400){logger[_0x7b7e('0x17')](util[_0x7b7e('0xb')](_0x7b7e('0x18'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')](_0x7b7e('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0x7b7e('0x1b'),function(_0x43db4f){logger[_0x7b7e('0x17')](util['format'](_0x7b7e('0x1c'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x43db4f,![],null)));});ami['on'](_0x7b7e('0x1d'),function(_0x53bbb3){logger['info'](util['format'](_0x7b7e('0x1e'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0x7b7e('0x1f')]()[_0x7b7e('0x20')](ami[_0x7b7e('0x21')]())[_0x7b7e('0x20')](ami[_0x7b7e('0x22')]())['then'](ami[_0x7b7e('0x12')]())[_0x7b7e('0x20')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())[_0x7b7e('0x23')](function(_0x423832){logger['error'](_0x7b7e('0x24'),util['inspect'](_0x423832,{'showHidden':![],'depth':null}));});});ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')]('close',close);module[_0x7b7e('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 557a563..068e6c2 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 _0xe706=['result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','memberReport','error','message'];(function(_0x38c699,_0x56fea7){var _0x3b1ded=function(_0x100851){while(--_0x100851){_0x38c699['push'](_0x38c699['shift']());}};_0x3b1ded(++_0x56fea7);}(_0xe706,0xa3));var _0x6e70=function(_0xcd2975,_0x27d718){_0xcd2975=_0xcd2975-0x0;var _0x284074=_0xe706[_0xcd2975];return _0x284074;};'use strict';var jayson=require(_0x6e70('0x0'));var BPromise=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('ami');var client=jayson[_0x6e70('0x3')][_0x6e70('0x4')]({'port':0x2329});client[_0x6e70('0x5')]=function(_0x7dfbc3,_0x142c27){return new BPromise(function(_0x2164a4,_0x376a8d){return client[_0x6e70('0x6')](_0x7dfbc3,_0x142c27)[_0x6e70('0x7')](function(_0x4381d1){logger[_0x6e70('0x8')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x142c27,_0x4381d1);if(_0x4381d1[_0x6e70('0xb')]){logger[_0x6e70('0xb')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')],_0x142c27);return _0x376a8d(_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')]);}else{return _0x2164a4(_0x4381d1[_0x6e70('0xd')]);}})[_0x6e70('0xe')](function(_0x4600f9){logger['error']('rpc',_0x6e70('0xa'),_0x7dfbc3,_0x4600f9,_0x142c27);return _0x376a8d(_0x4600f9);});});};module[_0x6e70('0xf')]=client; \ No newline at end of file +var _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x515afd,_0x1a1e91){var _0x536d53=function(_0x1d3a89){while(--_0x1d3a89){_0x515afd['push'](_0x515afd['shift']());}};_0x536d53(++_0x1a1e91);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3a8dc1,_0x2f03b8){_0x3a8dc1=_0x3a8dc1-0x0;var _0x4b3595=_0xcb91[_0x3a8dc1];return _0x4b3595;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 26b501d..3ae85b9 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 _0x9f21=['substring','dialCutDigit','getQueue','exports','util','lodash','isNil','string','voiceQueue','name','Contact','lastName','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>'];(function(_0x560d2a,_0x4a9f54){var _0x3df62d=function(_0x1ce1ec){while(--_0x1ce1ec){_0x560d2a['push'](_0x560d2a['shift']());}};_0x3df62d(++_0x4a9f54);}(_0x9f21,0x10c));var _0x19f2=function(_0x4990d5,_0xe2c486){_0x4990d5=_0x4990d5-0x0;var _0x275e25=_0x9f21[_0x4990d5];return _0x275e25;};'use strict';var util=require(_0x19f2('0x0'));var _=require(_0x19f2('0x1'));var moment=require('moment');function checkNameSurname(_0x2a98d5,_0x3dbba8,_0x3e18b7){var _0x495f5c='';if(!_[_0x19f2('0x2')](_0x3dbba8)&&_0x19f2('0x3')===typeof _0x3dbba8){_0x495f5c+=_0x3dbba8;}if(!_[_0x19f2('0x2')](_0x3e18b7)&&_0x19f2('0x3')===typeof _0x3e18b7){_0x495f5c+='\x20'+_0x3e18b7;}if(_0x495f5c!==''){return _0x495f5c;}return _0x2a98d5;}function Action(_0x4b1507,_0x5e63c1,_0x5f23bd){this[_0x19f2('0x4')]=_0x4b1507;this['uniqueid']=_0x5f23bd||undefined;this[_0x19f2('0x5')]=checkNameSurname(_0x5e63c1[_0x19f2('0x6')]['phone'],_0x5e63c1['Contact']['firstName'],_0x5e63c1['Contact'][_0x19f2('0x7')]);this[_0x19f2('0x8')]=_0x5e63c1[_0x19f2('0x6')][_0x19f2('0x9')];this[_0x19f2('0xa')]=_0x4b1507[_0x19f2('0x5')];this[_0x19f2('0xb')]=_0x5e63c1[_0x19f2('0xb')]||![];this[_0x19f2('0xc')]=_0x4b1507[_0x19f2('0xc')];this[_0x19f2('0xd')]=_0x4b1507['dialQueueTimeout']||0x3;this[_0x19f2('0xe')]=_0x5e63c1['scheduledat'];this['countbusyretry']=_0x5e63c1[_0x19f2('0xf')];this[_0x19f2('0x10')]=_0x5e63c1[_0x19f2('0x10')];this['countnoanswerretry']=_0x5e63c1[_0x19f2('0x11')];this[_0x19f2('0x12')]=_0x5e63c1[_0x19f2('0x12')];this[_0x19f2('0x13')]=_0x5e63c1[_0x19f2('0x13')];this[_0x19f2('0x14')]=_0x5e63c1[_0x19f2('0x14')];this[_0x19f2('0x15')]=_0x5e63c1['countmachineretry'];this['countagentrejectretry']=_0x5e63c1[_0x19f2('0x16')];this[_0x19f2('0x17')]=_0x5e63c1['ContactId'];this[_0x19f2('0x18')]=_0x5e63c1[_0x19f2('0x18')];this['UserId']=_0x5e63c1[_0x19f2('0x19')];this[_0x19f2('0x1a')]=_0x5e63c1[_0x19f2('0x1a')];this[_0x19f2('0x1b')]=_0x5e63c1[_0x19f2('0x1b')];this['idHopper']=_0x5e63c1['id'];this[_0x19f2('0x1c')]=_0x5e63c1[_0x19f2('0x6')]['firstName']||'';this[_0x19f2('0x1d')]=moment()[_0x19f2('0x1e')](_0x19f2('0x1f'));this['callback']=_0x5e63c1[_0x19f2('0x20')];this['callbackuniqueid']=_0x5e63c1[_0x19f2('0x21')];this['callbackat']=_0x5e63c1['callbackat'];this[_0x19f2('0x22')]=_0x5e63c1[_0x19f2('0x22')];this[_0x19f2('0x23')]='';this[_0x19f2('0x24')]='';}Action[_0x19f2('0x25')][_0x19f2('0x26')]=function(){return util[_0x19f2('0x1e')](_0x19f2('0x27'),this[_0x19f2('0x5')],this[_0x19f2('0x4')]['dialCutDigit']>0x0?this[_0x19f2('0x8')][_0x19f2('0x28')](this[_0x19f2('0x4')][_0x19f2('0x29')]):this[_0x19f2('0x8')]);};Action[_0x19f2('0x25')][_0x19f2('0x2a')]=function(){return this[_0x19f2('0xa')];};module[_0x19f2('0x2b')]=Action; \ No newline at end of file +var _0x42bb=['CampaignId','starttime','format','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','dialCutDigit','substring','getQueue','exports','util','lodash','moment','string','voiceQueue','uniqueid','name','Contact','firstName','lastName','number','phone','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x345618,_0x44658d){var _0xc4f333=function(_0x2b3596){while(--_0x2b3596){_0x345618['push'](_0x345618['shift']());}};_0xc4f333(++_0x44658d);}(_0x42bb,0x8c));var _0xb42b=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x42bb[_0x13ea00];return _0x1f7347;};'use strict';var util=require(_0xb42b('0x0'));var _=require(_0xb42b('0x1'));var moment=require(_0xb42b('0x2'));function checkNameSurname(_0x543a3a,_0x3c8369,_0x392b0c){var _0x231bba='';if(!_['isNil'](_0x3c8369)&&_0xb42b('0x3')===typeof _0x3c8369){_0x231bba+=_0x3c8369;}if(!_['isNil'](_0x392b0c)&&_0xb42b('0x3')===typeof _0x392b0c){_0x231bba+='\x20'+_0x392b0c;}if(_0x231bba!==''){return _0x231bba;}return _0x543a3a;}function Action(_0x73e6fb,_0x132e23,_0x2778a6){this[_0xb42b('0x4')]=_0x73e6fb;this[_0xb42b('0x5')]=_0x2778a6||undefined;this[_0xb42b('0x6')]=checkNameSurname(_0x132e23[_0xb42b('0x7')]['phone'],_0x132e23[_0xb42b('0x7')][_0xb42b('0x8')],_0x132e23[_0xb42b('0x7')][_0xb42b('0x9')]);this[_0xb42b('0xa')]=_0x132e23[_0xb42b('0x7')][_0xb42b('0xb')];this['queue']=_0x73e6fb[_0xb42b('0x6')];this[_0xb42b('0xc')]=_0x132e23[_0xb42b('0xc')]||![];this[_0xb42b('0xd')]=_0x73e6fb['type'];this[_0xb42b('0xe')]=_0x73e6fb[_0xb42b('0xe')]||0x3;this[_0xb42b('0xf')]=_0x132e23[_0xb42b('0xf')];this[_0xb42b('0x10')]=_0x132e23[_0xb42b('0x10')];this[_0xb42b('0x11')]=_0x132e23[_0xb42b('0x11')];this[_0xb42b('0x12')]=_0x132e23[_0xb42b('0x12')];this['countnosuchnumberretry']=_0x132e23[_0xb42b('0x13')];this[_0xb42b('0x14')]=_0x132e23[_0xb42b('0x14')];this[_0xb42b('0x15')]=_0x132e23[_0xb42b('0x15')];this[_0xb42b('0x16')]=_0x132e23[_0xb42b('0x16')];this['countagentrejectretry']=_0x132e23[_0xb42b('0x17')];this['ContactId']=_0x132e23[_0xb42b('0x18')];this[_0xb42b('0x19')]=_0x132e23[_0xb42b('0x19')];this[_0xb42b('0x1a')]=_0x132e23[_0xb42b('0x1a')];this[_0xb42b('0x1b')]=_0x132e23[_0xb42b('0x1b')];this[_0xb42b('0x1c')]=_0x132e23['CampaignId'];this['idHopper']=_0x132e23['id'];this['ContactFirstName']=_0x132e23[_0xb42b('0x7')][_0xb42b('0x8')]||'';this[_0xb42b('0x1d')]=moment()[_0xb42b('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x132e23['callback'];this['callbackuniqueid']=_0x132e23[_0xb42b('0x1f')];this[_0xb42b('0x20')]=_0x132e23[_0xb42b('0x20')];this['recallme']=_0x132e23[_0xb42b('0x21')];this[_0xb42b('0x22')]='';this[_0xb42b('0x23')]='';}Action[_0xb42b('0x24')][_0xb42b('0x25')]=function(){return util[_0xb42b('0x1e')]('\x22%s\x22\x20<%s>',this[_0xb42b('0x6')],this['voiceQueue'][_0xb42b('0x26')]>0x0?this[_0xb42b('0xa')][_0xb42b('0x27')](this['voiceQueue'][_0xb42b('0x26')]):this[_0xb42b('0xa')]);};Action['prototype'][_0xb42b('0x28')]=function(){return this['queue'];};module[_0xb42b('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 3925994..3de5a16 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 _0xdb24=['talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime'];(function(_0x193ab8,_0x38bd82){var _0xdfe5a3=function(_0x4aac4c){while(--_0x4aac4c){_0x193ab8['push'](_0x193ab8['shift']());}};_0xdfe5a3(++_0x38bd82);}(_0xdb24,0x123));var _0x4db2=function(_0x50df48,_0x1966b9){_0x50df48=_0x50df48-0x0;var _0x5a86c6=_0xdb24[_0x50df48];return _0x5a86c6;};'use strict';var util=require(_0x4db2('0x0'));var _=require(_0x4db2('0x1'));var moment=require('moment');function getSeconds(_0x39ae19,_0x5968f2){var _0x3a913a=moment(_0x39ae19)[_0x4db2('0x2')](0x0);var _0xb28dca=moment(_0x5968f2)[_0x4db2('0x2')](0x0);return _0x3a913a[_0x4db2('0x3')](_0xb28dca,_0x4db2('0x4'));}function AgentComplete(_0x3ebb74,_0x38f940){this['state']=0x4;this['statedesc']=_0x4db2('0x5');this['scheduledat']=_0x3ebb74[_0x4db2('0x6')];this['type']=_0x3ebb74[_0x4db2('0x7')];this[_0x4db2('0x8')]=_0x3ebb74['type']===_0x4db2('0x9')?_0x4db2('0xa'):_0x3ebb74['type'];this[_0x4db2('0xb')]=_0x3ebb74[_0x4db2('0xb')];this['countcongestionretry']=_0x3ebb74['countcongestionretry'];this[_0x4db2('0xc')]=_0x3ebb74['countnoanswerretry'];this['countglobal']=_0x3ebb74[_0x4db2('0xb')]+_0x3ebb74[_0x4db2('0xd')]+_0x3ebb74[_0x4db2('0xc')]+_0x3ebb74[_0x4db2('0xe')]+_0x3ebb74[_0x4db2('0xf')]+_0x3ebb74[_0x4db2('0x10')]+_0x3ebb74['countmachineretry']+_0x3ebb74[_0x4db2('0x11')];this['countnosuchnumberretry']=_0x3ebb74['countnosuchnumberretry'];this[_0x4db2('0xf')]=_0x3ebb74[_0x4db2('0xf')];this[_0x4db2('0x10')]=_0x3ebb74['countabandonedretry'];this[_0x4db2('0x12')]=_0x3ebb74[_0x4db2('0x12')];this[_0x4db2('0x11')]=_0x3ebb74[_0x4db2('0x11')];this['uniqueid']=_0x38f940[_0x4db2('0x13')];this[_0x4db2('0x14')]=_0x3ebb74[_0x4db2('0x15')];this[_0x4db2('0x16')]=_0x3ebb74['number'];this['starttime']=_0x3ebb74[_0x4db2('0x17')];this[_0x4db2('0x18')]=_0x3ebb74[_0x4db2('0x18')];this[_0x4db2('0x19')]=_0x3ebb74[_0x4db2('0x19')];this[_0x4db2('0x1a')]=moment()[_0x4db2('0x1b')](_0x4db2('0x1c'));this[_0x4db2('0x1d')]=getSeconds(_0x3ebb74['responsetime'],_0x3ebb74[_0x4db2('0x17')]);this[_0x4db2('0x1e')]=getSeconds(_0x3ebb74[_0x4db2('0x19')],_0x3ebb74[_0x4db2('0x18')]);this[_0x4db2('0x1f')]=getSeconds(this[_0x4db2('0x1a')],_0x3ebb74[_0x4db2('0x19')]);this[_0x4db2('0xa')]=_0x38f940[_0x4db2('0xa')];this[_0x4db2('0x20')]=_0x38f940['membername'];this['reason']=_0x38f940[_0x4db2('0x21')];this[_0x4db2('0x22')]=_0x3ebb74[_0x4db2('0x22')];this[_0x4db2('0x23')]=_0x3ebb74[_0x4db2('0x23')];this[_0x4db2('0x24')]=_0x3ebb74[_0x4db2('0x24')];this[_0x4db2('0x25')]=_0x3ebb74[_0x4db2('0x25')];this[_0x4db2('0x26')]=_0x3ebb74[_0x4db2('0x26')];this[_0x4db2('0x27')]=_0x3ebb74[_0x4db2('0x27')];this[_0x4db2('0x28')]=_0x3ebb74[_0x4db2('0x28')];this[_0x4db2('0x29')]=_0x3ebb74[_0x4db2('0x29')];this[_0x4db2('0x2a')]=_0x3ebb74['CampaignId'];this[_0x4db2('0x2b')]=_0x3ebb74[_0x4db2('0x2b')]||'';this['originatecalleridname']=_0x3ebb74[_0x4db2('0x2c')]||'';}module[_0x4db2('0x2d')]=AgentComplete; \ No newline at end of file +var _0xd98a=['util','milliseconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','number','starttime','responsetime','answertime','endtime','ringtime','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xd98a,0xfc));var _0xad98=function(_0x47f530,_0x29de5d){_0x47f530=_0x47f530-0x0;var _0x291857=_0xd98a[_0x47f530];return _0x291857;};'use strict';var util=require(_0xad98('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x615dd0,_0x10b24d){var _0x189f8b=moment(_0x615dd0)[_0xad98('0x1')](0x0);var _0x245d98=moment(_0x10b24d)[_0xad98('0x1')](0x0);return _0x189f8b['diff'](_0x245d98,'seconds');}function AgentComplete(_0x1f165f,_0x38f547){this[_0xad98('0x2')]=0x4;this[_0xad98('0x3')]=_0xad98('0x4');this['scheduledat']=_0x1f165f[_0xad98('0x5')];this[_0xad98('0x6')]=_0x1f165f['type'];this[_0xad98('0x7')]=_0x1f165f['type']===_0xad98('0x8')?'queue':_0x1f165f['type'];this['countbusyretry']=_0x1f165f[_0xad98('0x9')];this[_0xad98('0xa')]=_0x1f165f[_0xad98('0xa')];this[_0xad98('0xb')]=_0x1f165f['countnoanswerretry'];this['countglobal']=_0x1f165f[_0xad98('0x9')]+_0x1f165f[_0xad98('0xa')]+_0x1f165f[_0xad98('0xb')]+_0x1f165f[_0xad98('0xc')]+_0x1f165f[_0xad98('0xd')]+_0x1f165f[_0xad98('0xe')]+_0x1f165f[_0xad98('0xf')]+_0x1f165f[_0xad98('0x10')];this[_0xad98('0xc')]=_0x1f165f['countnosuchnumberretry'];this[_0xad98('0xd')]=_0x1f165f[_0xad98('0xd')];this[_0xad98('0xe')]=_0x1f165f[_0xad98('0xe')];this[_0xad98('0xf')]=_0x1f165f[_0xad98('0xf')];this[_0xad98('0x10')]=_0x1f165f[_0xad98('0x10')];this[_0xad98('0x11')]=_0x38f547['uniqueid'];this['calleridname']=_0x1f165f[_0xad98('0x12')];this['calleridnum']=_0x1f165f[_0xad98('0x13')];this[_0xad98('0x14')]=_0x1f165f[_0xad98('0x14')];this[_0xad98('0x15')]=_0x1f165f[_0xad98('0x15')];this[_0xad98('0x16')]=_0x1f165f[_0xad98('0x16')];this[_0xad98('0x17')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xad98('0x18')]=getSeconds(_0x1f165f['responsetime'],_0x1f165f[_0xad98('0x14')]);this[_0xad98('0x19')]=getSeconds(_0x1f165f[_0xad98('0x16')],_0x1f165f[_0xad98('0x15')]);this[_0xad98('0x1a')]=getSeconds(this[_0xad98('0x17')],_0x1f165f[_0xad98('0x16')]);this[_0xad98('0x1b')]=_0x38f547[_0xad98('0x1b')];this[_0xad98('0x1c')]=_0x38f547[_0xad98('0x1c')];this[_0xad98('0x1d')]=_0x38f547[_0xad98('0x1d')];this['callback']=_0x1f165f[_0xad98('0x1e')];this[_0xad98('0x1f')]=_0x1f165f[_0xad98('0x1f')];this[_0xad98('0x20')]=_0x1f165f['callbackat'];this[_0xad98('0x21')]=_0x1f165f[_0xad98('0x21')];this[_0xad98('0x22')]=_0x1f165f[_0xad98('0x22')];this[_0xad98('0x23')]=_0x1f165f[_0xad98('0x23')];this[_0xad98('0x24')]=_0x1f165f[_0xad98('0x24')];this['VoiceQueueId']=_0x1f165f[_0xad98('0x25')];this[_0xad98('0x26')]=_0x1f165f[_0xad98('0x26')];this[_0xad98('0x27')]=_0x1f165f[_0xad98('0x27')]||'';this[_0xad98('0x28')]=_0x1f165f[_0xad98('0x28')]||'';}module[_0xad98('0x29')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 0e421e8..2d9c1a2 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 _0x1c9a=['type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','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','milliseconds','diff','uniqueid','scheduledat'];(function(_0x5b174b,_0x404869){var _0x47ee37=function(_0x467947){while(--_0x467947){_0x5b174b['push'](_0x5b174b['shift']());}};_0x47ee37(++_0x404869);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x31a631,_0xbb94ff){_0x31a631=_0x31a631-0x0;var _0x4739e7=_0x1c9a[_0x31a631];return _0x4739e7;};'use strict';var util=require(_0xa1c9('0x0'));var _=require(_0xa1c9('0x1'));var moment=require('moment');function getSeconds(_0x6084bf,_0x867bbb){var _0x38c48f=moment(_0x6084bf)[_0xa1c9('0x2')](0x0);var _0x3d8576=moment(_0x867bbb)['milliseconds'](0x0);return _0x38c48f[_0xa1c9('0x3')](_0x3d8576,'seconds');}function Final(_0x1716cb){this[_0xa1c9('0x4')]=_0x1716cb[_0xa1c9('0x4')];this[_0xa1c9('0x5')]=_0x1716cb[_0xa1c9('0x5')];this[_0xa1c9('0x6')]=_0x1716cb[_0xa1c9('0x6')];this[_0xa1c9('0x7')]=_0x1716cb[_0xa1c9('0x6')]===_0xa1c9('0x8')?_0xa1c9('0x9'):_0x1716cb[_0xa1c9('0x6')];this['countbusyretry']=_0x1716cb['countbusyretry'];this[_0xa1c9('0xa')]=_0x1716cb['countcongestionretry'];this[_0xa1c9('0xb')]=_0x1716cb[_0xa1c9('0xb')];this[_0xa1c9('0xc')]=_0x1716cb[_0xa1c9('0xd')]+_0x1716cb[_0xa1c9('0xa')]+_0x1716cb[_0xa1c9('0xb')]+_0x1716cb[_0xa1c9('0xe')]+_0x1716cb[_0xa1c9('0xf')]+_0x1716cb[_0xa1c9('0x10')]+_0x1716cb[_0xa1c9('0x11')]+_0x1716cb[_0xa1c9('0x12')];this[_0xa1c9('0xe')]=_0x1716cb[_0xa1c9('0xe')];this[_0xa1c9('0xf')]=_0x1716cb[_0xa1c9('0xf')];this[_0xa1c9('0x10')]=_0x1716cb[_0xa1c9('0x10')];this[_0xa1c9('0x11')]=_0x1716cb[_0xa1c9('0x11')];this[_0xa1c9('0x12')]=_0x1716cb['countagentrejectretry'];this[_0xa1c9('0x9')]=_0x1716cb['queue'];this[_0xa1c9('0x13')]=_0x1716cb[_0xa1c9('0x13')];this[_0xa1c9('0x14')]=_0x1716cb[_0xa1c9('0x14')];this[_0xa1c9('0x15')]=_0x1716cb[_0xa1c9('0x15')];this[_0xa1c9('0x16')]=_0x1716cb[_0xa1c9('0x16')];this[_0xa1c9('0x17')]=_0x1716cb[_0xa1c9('0x16')];this[_0xa1c9('0x18')]=_0x1716cb[_0xa1c9('0x18')]||0x0;this['holdtime']=_0x1716cb[_0xa1c9('0x19')]||0x0;this[_0xa1c9('0x1a')]=_0x1716cb[_0xa1c9('0x1a')]||0x0;this[_0xa1c9('0x1b')]=_0x1716cb[_0xa1c9('0x1b')];this[_0xa1c9('0x1c')]=_0x1716cb[_0xa1c9('0x1c')];this[_0xa1c9('0x1d')]=_0x1716cb['callbackat'];this[_0xa1c9('0x1e')]=_0x1716cb[_0xa1c9('0x1e')];this['ContactId']=_0x1716cb[_0xa1c9('0x1f')];this[_0xa1c9('0x20')]=_0x1716cb[_0xa1c9('0x20')];this[_0xa1c9('0x21')]=_0x1716cb[_0xa1c9('0x21')];this['VoiceQueueId']=_0x1716cb[_0xa1c9('0x22')];this[_0xa1c9('0x23')]=_0x1716cb[_0xa1c9('0x23')];this['originatecalleridnum']=_0x1716cb[_0xa1c9('0x24')]||'';this[_0xa1c9('0x25')]=_0x1716cb[_0xa1c9('0x25')]||'';}module[_0xa1c9('0x26')]=Final; \ No newline at end of file +var _0x5089=['originatecalleridname','util','lodash','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x5089,0x1bb));var _0x9508=function(_0x4e7abc,_0x2aeca1){_0x4e7abc=_0x4e7abc-0x0;var _0x428796=_0x5089[_0x4e7abc];return _0x428796;};'use strict';var util=require(_0x9508('0x0'));var _=require(_0x9508('0x1'));var moment=require('moment');function getSeconds(_0x2d60c7,_0x35878a){var _0x7dd13d=moment(_0x2d60c7)[_0x9508('0x2')](0x0);var _0x172549=moment(_0x35878a)['milliseconds'](0x0);return _0x7dd13d[_0x9508('0x3')](_0x172549,'seconds');}function Final(_0x3d6516){this[_0x9508('0x4')]=_0x3d6516[_0x9508('0x4')];this['scheduledat']=_0x3d6516[_0x9508('0x5')];this[_0x9508('0x6')]=_0x3d6516['type'];this[_0x9508('0x7')]=_0x3d6516[_0x9508('0x6')]==='outbound'?_0x9508('0x8'):_0x3d6516['type'];this[_0x9508('0x9')]=_0x3d6516[_0x9508('0x9')];this[_0x9508('0xa')]=_0x3d6516[_0x9508('0xa')];this[_0x9508('0xb')]=_0x3d6516[_0x9508('0xb')];this['countglobal']=_0x3d6516[_0x9508('0x9')]+_0x3d6516['countcongestionretry']+_0x3d6516[_0x9508('0xb')]+_0x3d6516[_0x9508('0xc')]+_0x3d6516['countdropretry']+_0x3d6516[_0x9508('0xd')]+_0x3d6516[_0x9508('0xe')]+_0x3d6516[_0x9508('0xf')];this[_0x9508('0xc')]=_0x3d6516['countnosuchnumberretry'];this[_0x9508('0x10')]=_0x3d6516[_0x9508('0x10')];this['countabandonedretry']=_0x3d6516[_0x9508('0xd')];this['countmachineretry']=_0x3d6516[_0x9508('0xe')];this[_0x9508('0xf')]=_0x3d6516[_0x9508('0xf')];this[_0x9508('0x8')]=_0x3d6516[_0x9508('0x8')];this[_0x9508('0x11')]=_0x3d6516[_0x9508('0x11')];this[_0x9508('0x12')]=_0x3d6516['calleridnum'];this[_0x9508('0x13')]=_0x3d6516[_0x9508('0x13')];this[_0x9508('0x14')]=_0x3d6516[_0x9508('0x14')];this[_0x9508('0x15')]=_0x3d6516[_0x9508('0x14')];this['ringtime']=_0x3d6516['ringtime']||0x0;this[_0x9508('0x16')]=_0x3d6516['holdtime']||0x0;this[_0x9508('0x17')]=_0x3d6516['talktime']||0x0;this[_0x9508('0x18')]=_0x3d6516[_0x9508('0x18')];this[_0x9508('0x19')]=_0x3d6516[_0x9508('0x19')];this[_0x9508('0x1a')]=_0x3d6516[_0x9508('0x1a')];this[_0x9508('0x1b')]=_0x3d6516['recallme'];this['ContactId']=_0x3d6516[_0x9508('0x1c')];this[_0x9508('0x1d')]=_0x3d6516[_0x9508('0x1d')];this[_0x9508('0x1e')]=_0x3d6516[_0x9508('0x1e')];this[_0x9508('0x1f')]=_0x3d6516['VoiceQueueId'];this['CampaignId']=_0x3d6516[_0x9508('0x20')];this['originatecalleridnum']=_0x3d6516['originatecalleridnum']||'';this[_0x9508('0x21')]=_0x3d6516['originatecalleridname']||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index b88ed6c..63dd873 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 _0x56dc=['reason','cause-txt','callback','callbackat','ContactId','ListId','UserId','exports','util','moment','milliseconds','diff','seconds','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','format','ringtime','holdtime','talktime','membername'];(function(_0x3a6d71,_0x4fc24d){var _0x4cc46b=function(_0x57f8f4){while(--_0x57f8f4){_0x3a6d71['push'](_0x3a6d71['shift']());}};_0x4cc46b(++_0x4fc24d);}(_0x56dc,0x1cb));var _0xc56d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56dc[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xc56d('0x0'));var _=require('lodash');var moment=require(_0xc56d('0x1'));function getSeconds(_0x119808,_0x5c8b76){var _0x27cf27=moment(_0x119808)[_0xc56d('0x2')](0x0);var _0x350bc2=moment(_0x5c8b76)[_0xc56d('0x2')](0x0);return _0x27cf27[_0xc56d('0x3')](_0x350bc2,_0xc56d('0x4'));}function Hangup(_0x5e1675,_0x1d57f7){this[_0xc56d('0x5')]=0x4;this['statedesc']=_0xc56d('0x6');this[_0xc56d('0x7')]=_0x5e1675['scheduledat'];this[_0xc56d('0x8')]=_0x5e1675[_0xc56d('0x8')];this[_0xc56d('0x9')]=_0x5e1675['type']===_0xc56d('0xa')?_0xc56d('0xb'):_0x5e1675['type'];this[_0xc56d('0xc')]=_0x5e1675[_0xc56d('0xc')];this[_0xc56d('0xd')]=_0x5e1675[_0xc56d('0xd')];this[_0xc56d('0xe')]=_0x5e1675[_0xc56d('0xe')];this[_0xc56d('0xf')]=_0x5e1675['countbusyretry']+_0x5e1675['countcongestionretry']+_0x5e1675[_0xc56d('0xe')]+_0x5e1675[_0xc56d('0x10')]+_0x5e1675[_0xc56d('0x11')]+_0x5e1675[_0xc56d('0x12')]+_0x5e1675['countmachineretry']+_0x5e1675[_0xc56d('0x13')];this['countnosuchnumberretry']=_0x5e1675[_0xc56d('0x10')];this['countdropretry']=_0x5e1675[_0xc56d('0x11')];this[_0xc56d('0x12')]=_0x5e1675['countabandonedretry'];this['countmachineretry']=_0x5e1675[_0xc56d('0x14')];this['countagentrejectretry']=_0x5e1675[_0xc56d('0x13')];this['uniqueid']=_0x1d57f7[_0xc56d('0x15')];this[_0xc56d('0x16')]=_0x5e1675[_0xc56d('0x17')];this[_0xc56d('0x18')]=_0x5e1675[_0xc56d('0x19')];this[_0xc56d('0x1a')]=_0x5e1675['starttime'];this[_0xc56d('0x1b')]=_0x5e1675[_0xc56d('0x1b')];this['endtime']=moment()[_0xc56d('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xc56d('0x1d')]=getSeconds(_0x5e1675[_0xc56d('0x1b')],_0x5e1675[_0xc56d('0x1a')]);this[_0xc56d('0x1e')]=0x0;this[_0xc56d('0x1f')]=getSeconds(this['endtime'],_0x5e1675['responsetime']);this[_0xc56d('0xb')]=_0x5e1675[_0xc56d('0xb')];this[_0xc56d('0x20')]='IVR';this[_0xc56d('0x21')]=_0x1d57f7[_0xc56d('0x22')];this[_0xc56d('0x23')]=_0x5e1675[_0xc56d('0x23')];this['callbackuniqueid']=_0x5e1675['callbackuniqueid'];this[_0xc56d('0x24')]=_0x5e1675['callbackat'];this['recallme']=_0x5e1675['recallme'];this[_0xc56d('0x25')]=_0x5e1675[_0xc56d('0x25')];this[_0xc56d('0x26')]=_0x5e1675[_0xc56d('0x26')];this[_0xc56d('0x27')]=_0x5e1675[_0xc56d('0x27')];this['VoiceQueueId']=_0x5e1675['VoiceQueueId'];this['CampaignId']=_0x5e1675['CampaignId'];}module[_0xc56d('0x28')]=Hangup; \ No newline at end of file +var _0xe603=['lodash','moment','state','Answer','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','ringtime','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports'];(function(_0x342ca3,_0x31db47){var _0x580f2d=function(_0x25bd81){while(--_0x25bd81){_0x342ca3['push'](_0x342ca3['shift']());}};_0x580f2d(++_0x31db47);}(_0xe603,0xfc));var _0x3e60=function(_0x257a29,_0xeec14c){_0x257a29=_0x257a29-0x0;var _0x589761=_0xe603[_0x257a29];return _0x589761;};'use strict';var util=require('util');var _=require(_0x3e60('0x0'));var moment=require(_0x3e60('0x1'));function getSeconds(_0x15d1f1,_0x175cca){var _0x1cd380=moment(_0x15d1f1)['milliseconds'](0x0);var _0x1540c9=moment(_0x175cca)['milliseconds'](0x0);return _0x1cd380['diff'](_0x1540c9,'seconds');}function Hangup(_0x47bedb,_0x38aa4d){this[_0x3e60('0x2')]=0x4;this['statedesc']=_0x3e60('0x3');this['scheduledat']=_0x47bedb['scheduledat'];this['type']=_0x47bedb[_0x3e60('0x4')];this[_0x3e60('0x5')]=_0x47bedb[_0x3e60('0x4')]===_0x3e60('0x6')?_0x3e60('0x7'):_0x47bedb['type'];this[_0x3e60('0x8')]=_0x47bedb[_0x3e60('0x8')];this['countcongestionretry']=_0x47bedb[_0x3e60('0x9')];this[_0x3e60('0xa')]=_0x47bedb[_0x3e60('0xa')];this[_0x3e60('0xb')]=_0x47bedb[_0x3e60('0x8')]+_0x47bedb['countcongestionretry']+_0x47bedb[_0x3e60('0xa')]+_0x47bedb['countnosuchnumberretry']+_0x47bedb[_0x3e60('0xc')]+_0x47bedb[_0x3e60('0xd')]+_0x47bedb['countmachineretry']+_0x47bedb[_0x3e60('0xe')];this[_0x3e60('0xf')]=_0x47bedb[_0x3e60('0xf')];this[_0x3e60('0xc')]=_0x47bedb[_0x3e60('0xc')];this[_0x3e60('0xd')]=_0x47bedb[_0x3e60('0xd')];this[_0x3e60('0x10')]=_0x47bedb[_0x3e60('0x10')];this[_0x3e60('0xe')]=_0x47bedb['countagentrejectretry'];this[_0x3e60('0x11')]=_0x38aa4d['uniqueid'];this[_0x3e60('0x12')]=_0x47bedb[_0x3e60('0x13')];this['calleridnum']=_0x47bedb[_0x3e60('0x14')];this[_0x3e60('0x15')]=_0x47bedb[_0x3e60('0x15')];this[_0x3e60('0x16')]=_0x47bedb[_0x3e60('0x16')];this[_0x3e60('0x17')]=moment()[_0x3e60('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x3e60('0x19')]=getSeconds(_0x47bedb['responsetime'],_0x47bedb[_0x3e60('0x15')]);this[_0x3e60('0x1a')]=0x0;this[_0x3e60('0x1b')]=getSeconds(this[_0x3e60('0x17')],_0x47bedb[_0x3e60('0x16')]);this[_0x3e60('0x7')]=_0x47bedb[_0x3e60('0x7')];this[_0x3e60('0x1c')]=_0x3e60('0x1d');this[_0x3e60('0x1e')]=_0x38aa4d[_0x3e60('0x1f')];this['callback']=_0x47bedb[_0x3e60('0x20')];this[_0x3e60('0x21')]=_0x47bedb[_0x3e60('0x21')];this[_0x3e60('0x22')]=_0x47bedb[_0x3e60('0x22')];this[_0x3e60('0x23')]=_0x47bedb['recallme'];this[_0x3e60('0x24')]=_0x47bedb[_0x3e60('0x24')];this[_0x3e60('0x25')]=_0x47bedb[_0x3e60('0x25')];this[_0x3e60('0x26')]=_0x47bedb['UserId'];this[_0x3e60('0x27')]=_0x47bedb[_0x3e60('0x27')];this[_0x3e60('0x28')]=_0x47bedb[_0x3e60('0x28')];}module[_0x3e60('0x29')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index a812545..e4592f3 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 _0x69dc=['countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','calleridname','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x69dc,0x148));var _0xc69d=function(_0x5a64f4,_0x237024){_0x5a64f4=_0x5a64f4-0x0;var _0x57ed21=_0x69dc[_0x5a64f4];return _0x57ed21;};'use strict';var util=require(_0xc69d('0x0'));var _=require('lodash');var moment=require(_0xc69d('0x1'));function getSeconds(_0x5be3e3,_0x15123e){var _0xfe3f07=moment(_0x5be3e3)['milliseconds'](0x0);var _0x3691ec=moment(_0x15123e)[_0xc69d('0x2')](0x0);return _0xfe3f07['diff'](_0x3691ec,'seconds');}function History(_0x299d0b){this['uniqueid']=_0x299d0b[_0xc69d('0x3')];this[_0xc69d('0x4')]=_0x299d0b[_0xc69d('0x4')]||undefined;this[_0xc69d('0x5')]=_0x299d0b[_0xc69d('0x5')];this[_0xc69d('0x6')]=_0x299d0b[_0xc69d('0x5')]===_0xc69d('0x7')?_0xc69d('0x8'):_0x299d0b[_0xc69d('0x5')];this[_0xc69d('0x9')]=_0x299d0b[_0xc69d('0x9')];this['countcongestionretry']=_0x299d0b[_0xc69d('0xa')];this['countnoanswerretry']=_0x299d0b['countnoanswerretry'];this['countglobal']=_0x299d0b[_0xc69d('0x9')]+_0x299d0b[_0xc69d('0xa')]+_0x299d0b[_0xc69d('0xb')]+_0x299d0b[_0xc69d('0xc')]+_0x299d0b['countdropretry']+_0x299d0b['countabandonedretry']+_0x299d0b[_0xc69d('0xd')]+_0x299d0b[_0xc69d('0xe')];this['countnosuchnumberretry']=_0x299d0b[_0xc69d('0xc')];this[_0xc69d('0xf')]=_0x299d0b[_0xc69d('0xf')];this[_0xc69d('0x10')]=_0x299d0b[_0xc69d('0x10')];this[_0xc69d('0xd')]=_0x299d0b[_0xc69d('0xd')];this[_0xc69d('0xe')]=_0x299d0b['countagentrejectretry'];this[_0xc69d('0x8')]=_0x299d0b[_0xc69d('0x8')];this[_0xc69d('0x11')]=_0x299d0b['name'];this['calleridnum']=_0x299d0b['number'];this[_0xc69d('0x12')]=_0x299d0b['starttime'];this[_0xc69d('0x13')]=_0x299d0b[_0xc69d('0x13')];this[_0xc69d('0x14')]=_0x299d0b['responsetime'];this['ringtime']=getSeconds(_0x299d0b[_0xc69d('0x13')],_0x299d0b[_0xc69d('0x12')]);this[_0xc69d('0x15')]=0x0;this[_0xc69d('0x16')]=0x0;this['callback']=_0x299d0b[_0xc69d('0x17')];this[_0xc69d('0x18')]=_0x299d0b[_0xc69d('0x18')];this[_0xc69d('0x19')]=_0x299d0b[_0xc69d('0x19')];this['recallme']=_0x299d0b[_0xc69d('0x1a')];this[_0xc69d('0x1b')]=_0x299d0b[_0xc69d('0x1b')];this[_0xc69d('0x1c')]=_0x299d0b[_0xc69d('0x1c')];this['UserId']=_0x299d0b['UserId'];this[_0xc69d('0x1d')]=_0x299d0b['VoiceQueueId'];this[_0xc69d('0x1e')]=_0x299d0b[_0xc69d('0x1e')];this[_0xc69d('0x1f')]=_0x299d0b[_0xc69d('0x1f')]||'';this[_0xc69d('0x20')]=_0x299d0b[_0xc69d('0x20')]||'';}module[_0xc69d('0x21')]=History; \ No newline at end of file +var _0x4f9c=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x4f9c,0x117));var _0xc4f9=function(_0x2c96f6,_0x877207){_0x2c96f6=_0x2c96f6-0x0;var _0x6d4808=_0x4f9c[_0x2c96f6];return _0x6d4808;};'use strict';var util=require(_0xc4f9('0x0'));var _=require(_0xc4f9('0x1'));var moment=require(_0xc4f9('0x2'));function getSeconds(_0x2fe253,_0x36b63b){var _0x2ffcb4=moment(_0x2fe253)[_0xc4f9('0x3')](0x0);var _0x1fe305=moment(_0x36b63b)[_0xc4f9('0x3')](0x0);return _0x2ffcb4[_0xc4f9('0x4')](_0x1fe305,_0xc4f9('0x5'));}function History(_0x1c2325){this['uniqueid']=_0x1c2325['uniqueid'];this[_0xc4f9('0x6')]=_0x1c2325[_0xc4f9('0x6')]||undefined;this[_0xc4f9('0x7')]=_0x1c2325[_0xc4f9('0x7')];this[_0xc4f9('0x8')]=_0x1c2325[_0xc4f9('0x7')]===_0xc4f9('0x9')?_0xc4f9('0xa'):_0x1c2325[_0xc4f9('0x7')];this[_0xc4f9('0xb')]=_0x1c2325['countbusyretry'];this[_0xc4f9('0xc')]=_0x1c2325[_0xc4f9('0xc')];this[_0xc4f9('0xd')]=_0x1c2325[_0xc4f9('0xd')];this[_0xc4f9('0xe')]=_0x1c2325['countbusyretry']+_0x1c2325['countcongestionretry']+_0x1c2325[_0xc4f9('0xd')]+_0x1c2325[_0xc4f9('0xf')]+_0x1c2325[_0xc4f9('0x10')]+_0x1c2325['countabandonedretry']+_0x1c2325[_0xc4f9('0x11')]+_0x1c2325[_0xc4f9('0x12')];this[_0xc4f9('0xf')]=_0x1c2325[_0xc4f9('0xf')];this[_0xc4f9('0x10')]=_0x1c2325['countdropretry'];this[_0xc4f9('0x13')]=_0x1c2325[_0xc4f9('0x13')];this[_0xc4f9('0x11')]=_0x1c2325['countmachineretry'];this['countagentrejectretry']=_0x1c2325[_0xc4f9('0x12')];this[_0xc4f9('0xa')]=_0x1c2325['queue'];this[_0xc4f9('0x14')]=_0x1c2325[_0xc4f9('0x15')];this[_0xc4f9('0x16')]=_0x1c2325[_0xc4f9('0x17')];this[_0xc4f9('0x18')]=_0x1c2325[_0xc4f9('0x18')];this[_0xc4f9('0x19')]=_0x1c2325['responsetime'];this[_0xc4f9('0x1a')]=_0x1c2325[_0xc4f9('0x19')];this[_0xc4f9('0x1b')]=getSeconds(_0x1c2325[_0xc4f9('0x19')],_0x1c2325['starttime']);this[_0xc4f9('0x1c')]=0x0;this[_0xc4f9('0x1d')]=0x0;this[_0xc4f9('0x1e')]=_0x1c2325[_0xc4f9('0x1e')];this[_0xc4f9('0x1f')]=_0x1c2325[_0xc4f9('0x1f')];this['callbackat']=_0x1c2325[_0xc4f9('0x20')];this[_0xc4f9('0x21')]=_0x1c2325[_0xc4f9('0x21')];this['ContactId']=_0x1c2325[_0xc4f9('0x22')];this[_0xc4f9('0x23')]=_0x1c2325[_0xc4f9('0x23')];this['UserId']=_0x1c2325[_0xc4f9('0x24')];this['VoiceQueueId']=_0x1c2325['VoiceQueueId'];this[_0xc4f9('0x25')]=_0x1c2325[_0xc4f9('0x25')];this['originatecalleridnum']=_0x1c2325[_0xc4f9('0x26')]||'';this['originatecalleridname']=_0x1c2325[_0xc4f9('0x27')]||'';}module[_0xc4f9('0x28')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 507237d..605a744 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 _0x2d29=['[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','reason\x200\x20no\x20such\x20number....','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','checkRetriveMax','reason\x205\x20busy','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','AgentReject','agentreject','[syncAgentComplete][createHistory][?]','Success','contact\x20not\x20moved','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','floor','one\x20call\x20every:','[handlePredictive]','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','checkContactBlack','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','emptyContact','loggerHandler','[getContactDialer2]','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','[busyFactor]','Umin\x20=\x20','exports','lodash','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','booked','predictive','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./queueCallerAbandon','env','XCALLY_IP_AGI','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBookedRR','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','syncQueueSummary','hangup','syncHangup','syncNewExten','varset','syncVarSet','queuemember','syncQueueStatusComplete','loopCampaigns','isUndefined','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','Intervals','INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','stringify','milliseconds','seconds','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','voice:queue:%s','voice_queue:save','format','campaign:ivr:%s','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','loopClearZombieChannels','clearZombieChannels','[uniqueid]','actions','[actions]','Action','status','channel','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','resolve','then','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','reachable','uniqueid','isNil','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','membername','AMD','emit','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','outboundAnswerCallsDay','Machine','countmachineretry','countglobal','countcongestionretry','countdropretry','countabandonedretry','countagentrejectretry','dialMachineMaxRetry','createStateFinal','add','dialMachineRetryFrequency','minutes','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','MACHINE','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','stateGlobal','reason19\x20machine....','reason\x2019\x20machine....','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','outboundUnknownCallsDay','Unknow','reason','agent','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','syncAgentConnect','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','dialQueueProject2','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','syncQueueMember','actionid','locked','paused','stateinterface','queueBooked','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','rrmemory','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','isArray','command','iftime\x20%s,%s','interval','indexOf','content','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','handlePower','power','Queue','method\x20not\x20recognized','handleIvr','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','syncCampaigns','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','object','Contact','phone','originate','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','tags','updatedAt','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridnum','SIP/%s/%s%s','dialPrefix','substring','dialCutDigit','OriginateError','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','dialGlobalMaxRetry','dialNoAnswerMaxRetry'];(function(_0x401cde,_0x1cd759){var _0x2650a8=function(_0x10979b){while(--_0x10979b){_0x401cde['push'](_0x401cde['shift']());}};_0x2650a8(++_0x1cd759);}(_0x2d29,0x70));var _0x92d2=function(_0x3304b4,_0x5b1551){_0x3304b4=_0x3304b4-0x0;var _0x5271c5=_0x2d29[_0x3304b4];return _0x5271c5;};'use strict';var util=require('util');var _=require(_0x92d2('0x0'));var BPromise=require('bluebird');var uuid=require(_0x92d2('0x1'));var moment=require(_0x92d2('0x2'));var rr=require('rr');var md5=require(_0x92d2('0x3'));var Redis=require(_0x92d2('0x4'));var ut=require(_0x92d2('0x5'));var config=require(_0x92d2('0x6'));var logger=require('../../../config/logger')('dialer');var loggerBooked=require('../../../config/logger')(_0x92d2('0x7'));var loggerPredictive=require('../../../config/logger')(_0x92d2('0x8'));var loggerPredictiveCalls=require(_0x92d2('0x9'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x92d2('0x9'))('syncQueueSummary');var ami=require('../ami');config[_0x92d2('0xa')]=_[_0x92d2('0xb')](config[_0x92d2('0xa')],{'host':_0x92d2('0xc'),'port':0x18eb});var io=require(_0x92d2('0xd'))(new Redis(config[_0x92d2('0xa')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x92d2('0xe'));var cmHopperBlack=require(_0x92d2('0xf'));var voiceQueueRt=require(_0x92d2('0x10'));var Action=require(_0x92d2('0x11'));var History=require(_0x92d2('0x12'));var Final=require(_0x92d2('0x13'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x92d2('0x14'));var Hangup=require('./hangup');var ipAgi=process[_0x92d2('0x15')][_0x92d2('0x16')]||'127.0.0.1';var strategy={'rrmemory':'rrmemory','roundrobin':_0x92d2('0x17')};var Sequence=function(){};Sequence[_0x92d2('0x18')][_0x92d2('0x19')]=function(_0x4f660b){this['tail']=this[_0x92d2('0x1a')]?this[_0x92d2('0x1a')][_0x92d2('0x1b')](_0x4f660b):_0x4f660b();};function Dialer(_0x248fa9,_0x3a663e){this[_0x92d2('0x1c')]=new Sequence();this[_0x92d2('0x1d')]=_0x3a663e;this[_0x92d2('0x1e')]=_0x248fa9['voiceQueues'];this['campaigns']=_0x248fa9[_0x92d2('0x1f')];this[_0x92d2('0x20')]=_0x248fa9[_0x92d2('0x20')];this[_0x92d2('0x21')]=_0x248fa9[_0x92d2('0x21')];this['maxNumberOriginate']=config[_0x92d2('0x22')]||0x2;this[_0x92d2('0x23')]={};this['actions']={};this[_0x92d2('0x24')]={};this[_0x92d2('0x25')]={};this[_0x92d2('0x26')]={};this[_0x92d2('0x27')]={};this[_0x92d2('0x28')]={};this[_0x92d2('0x29')]={};this['queueBooked']={};this[_0x92d2('0x2a')]={};ami['on'](_0x92d2('0x2b'),this['syncAgentConnect'][_0x92d2('0x2c')](this));ami['on'](_0x92d2('0x2d'),this[_0x92d2('0x2e')][_0x92d2('0x2c')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x92d2('0x2c')](this));ami['on'](_0x92d2('0x2f'),this[_0x92d2('0x30')]['bind'](this));ami['on']('custom:queuesummary',this[_0x92d2('0x31')][_0x92d2('0x2c')](this));ami['on'](_0x92d2('0x32'),this[_0x92d2('0x33')][_0x92d2('0x2c')](this));ami['on']('newexten',this[_0x92d2('0x34')][_0x92d2('0x2c')](this));ami['on'](_0x92d2('0x35'),this[_0x92d2('0x36')]['bind'](this));ami['on'](_0x92d2('0x37'),this['syncQueueMember'][_0x92d2('0x2c')](this));ami['on']('queuestatuscomplete',this[_0x92d2('0x38')][_0x92d2('0x2c')](this));this[_0x92d2('0x39')]();this['loopClearZombieChannels']();}function isNotNull(_0x1f5fb9){return _0x1f5fb9!==null&&!_[_0x92d2('0x3a')](_0x1f5fb9);}function checkIsLoggedIn(_0x2ce44a,_0x21390d){return function(){if(_0x21390d<=0x0){_0x2ce44a['message']=_0x92d2('0x3b');throw _0x2ce44a[_0x92d2('0x3c')]+_0x92d2('0x3d');}};}function isActive(_0x4a4bad){return _0x4a4bad;}function checkIsActive(_0x28bbbe,_0x30f268){return function(){if(!isActive(_0x30f268)){_0x28bbbe[_0x92d2('0x3e')]=_0x92d2('0x3f');throw _0x28bbbe[_0x92d2('0x3c')]+_0x92d2('0x40');}};}function checkInterval(_0x49f725){return function(){if(!isNotNull(_0x49f725[_0x92d2('0x41')])){_0x49f725[_0x92d2('0x3e')]='INTERVAL_IS_NULL';throw _0x49f725[_0x92d2('0x3c')]+_0x92d2('0x42');}if(!isNotNull(_0x49f725[_0x92d2('0x41')][_0x92d2('0x43')])){_0x49f725['message']=_0x92d2('0x44');throw _0x49f725['name']+_0x92d2('0x42');}if(!isNotNull(_[_0x92d2('0x45')](_0x49f725[_0x92d2('0x41')][_0x92d2('0x43')]))){_0x49f725[_0x92d2('0x3e')]=_0x92d2('0x44');throw _0x49f725['name']+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x31953f,_0x5ec1df,_0xb57467){return{'action':_0x31953f,'response':_0x5ec1df,'message':_0xb57467,'stack':_0xb57467};}function myreject(_0x322eea){return function(_0x34eada){return _0x322eea(msgResponse(_0x92d2('0x46'),'Error',JSON[_0x92d2('0x47')](_0x34eada)));};}function getSeconds(_0x2939db,_0x25073b){var _0x41be16=moment(_0x2939db)['milliseconds'](0x0);var _0x238e24=moment(_0x25073b)[_0x92d2('0x48')](0x0);return _0x41be16['diff'](_0x238e24,_0x92d2('0x49'));}function emit(_0x7d212e,_0x27f7af,_0x2c7f5f){io['to'](_0x7d212e)['emit'](_0x27f7af,_0x2c7f5f);}function emitVoiceQueueSummary(_0x155825){if(_0x155825[_0x92d2('0x4a')]===_0x92d2('0x4b')){var _0x2494da={'id':_0x155825['id'],'name':_0x155825[_0x92d2('0x3c')],'strategy':_0x155825[_0x92d2('0x4c')],'answered':_0x155825[_0x92d2('0x4d')],'available':_0x155825[_0x92d2('0x4e')],'loggedIn':_0x155825[_0x92d2('0x4f')],'pTalking':_0x155825[_0x92d2('0x50')],'sumBillable':_0x155825[_0x92d2('0x51')],'sumDuration':_0x155825['sumDuration'],'sumHoldTime':_0x155825['sumHoldTime']||0x0,'talking':_0x155825['talking'],'total':_0x155825['total'],'type':_0x155825[_0x92d2('0x4a')],'unmanaged':_0x155825[_0x92d2('0x52')],'abandoned':_0x155825[_0x92d2('0x53')],'waiting':_0x155825[_0x92d2('0x54')],'loggedInDb':_0x155825[_0x92d2('0x55')],'dialActive':_0x155825[_0x92d2('0x56')],'dialMethod':_0x155825[_0x92d2('0x57')],'dialOriginateCallerIdName':_0x155825[_0x92d2('0x58')],'dialOriginateCallerIdNumber':_0x155825['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x155825[_0x92d2('0x59')],'dialPrefix':_0x155825['dialPrefix'],'outboundAnswerAgiCallsDay':_0x155825['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x155825['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x155825[_0x92d2('0x5a')],'outboundBusyCallsDay':_0x155825[_0x92d2('0x5b')],'outboundCongestionCallsDay':_0x155825[_0x92d2('0x5c')],'outboundDropCallsDayACS':_0x155825[_0x92d2('0x5d')],'outboundDropCallsDayCallersExit':_0x155825[_0x92d2('0x5e')],'outboundDropCallsDayTimeout':_0x155825['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x155825[_0x92d2('0x5f')],'outboundNoSuchCallsDay':_0x155825[_0x92d2('0x60')],'outboundOriginateFailureCallsDay':_0x155825[_0x92d2('0x61')],'outboundReCallsDay':_0x155825[_0x92d2('0x62')],'outboundRejectCallsDay':_0x155825[_0x92d2('0x63')],'outboundUnknownCallsDay':_0x155825['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x155825[_0x92d2('0x64')],'predictiveIntervalAvgHoldtime':_0x155825[_0x92d2('0x65')],'predictiveIntervalAvgTalktime':_0x155825[_0x92d2('0x66')],'predictiveIntervalDroppedCallsCallersExit':_0x155825[_0x92d2('0x67')],'predictiveIntervalDroppedCallsTimeout':_0x155825['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x155825[_0x92d2('0x68')],'predictiveIntervalErlangCallsDroppedCalls':_0x155825[_0x92d2('0x69')],'predictiveIntervalHitRate':_0x155825[_0x92d2('0x6a')],'predictiveIntervalMultiplicativeFactor':_0x155825[_0x92d2('0x6b')],'predictiveIntervalPauses':_0x155825[_0x92d2('0x6c')],'predictiveIntervalAvailable':_0x155825['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x155825['predictiveIntervalTotalCalls'],'message':_0x155825[_0x92d2('0x3e')],'originated':_0x155825['originated'],'erlangCalls':_0x155825[_0x92d2('0x6d')],'erlangCallToSecond':_0x155825[_0x92d2('0x6e')],'erlangAbandonmentRate':_0x155825[_0x92d2('0x6f')],'erlangBusyFactor':_0x155825[_0x92d2('0x70')],'startPredictive':_0x155825['startPredictive'],'startProgressive':_0x155825[_0x92d2('0x28')]};if(_0x155825[_0x92d2('0x71')]){_0x2494da[_0x92d2('0x71')]={'id':_0x155825['Trunk']['id'],'name':_0x155825[_0x92d2('0x71')][_0x92d2('0x3c')],'active':_0x155825[_0x92d2('0x71')][_0x92d2('0x72')],'callerid':_0x155825['Trunk'][_0x92d2('0x73')]};}if(_0x155825[_0x92d2('0x41')]){_0x2494da['Interval']={'id':_0x155825[_0x92d2('0x41')]['id'],'name':_0x155825[_0x92d2('0x41')]['name']};}var _0xbf8b83=md5(JSON['stringify'](_0x2494da));if(_0x155825['md5']!==_0xbf8b83){_0x155825['md5']=_0xbf8b83;emit(util['format'](_0x92d2('0x74'),_0x2494da[_0x92d2('0x3c')]),_0x92d2('0x75'),_0x2494da);}}}function emitCampaignSummary(_0x58f031){if(_0x58f031[_0x92d2('0x4a')]==='ivr'){emit(util[_0x92d2('0x76')](_0x92d2('0x77'),_0x58f031[_0x92d2('0x3c')]),'campaign:save',_0x58f031);}}function checkGetDataPredictive(_0x58a8db){if(isNotNull(_0x58a8db)&&!_['isEmpty'](_0x58a8db)){loggerPredictive[_0x92d2('0x78')](_0x92d2('0x79'));loggerPredictive[_0x92d2('0x78')](_0x92d2('0x7a'),_0x58a8db[_0x92d2('0x7b')]);loggerPredictive['info'](_0x92d2('0x7c'),_0x58a8db[_0x92d2('0x64')]);loggerPredictive[_0x92d2('0x78')](_0x92d2('0x7d'),_0x58a8db[_0x92d2('0x7e')]);loggerPredictive['info'](_0x92d2('0x7f'),_0x58a8db[_0x92d2('0x67')]);loggerPredictive['info'](_0x92d2('0x80'),_0x58a8db[_0x92d2('0x65')]);loggerPredictive[_0x92d2('0x78')](_0x92d2('0x81'),_0x58a8db[_0x92d2('0x66')]);loggerPredictive[_0x92d2('0x78')](_0x92d2('0x82'));if(_0x58a8db['predictiveIntervalTotalCalls']>0x0){if(!_[_0x92d2('0x3a')](_0x58a8db[_0x92d2('0x66')])&&_0x58a8db[_0x92d2('0x66')]>0x0){return!![];}loggerPredictive[_0x92d2('0x78')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x92d2('0x3a')](_0x58a8db['predictiveIntervalAvgHoldtime'])&&_0x58a8db[_0x92d2('0x65')]>0x0){return!![];}loggerPredictive[_0x92d2('0x78')](_0x92d2('0x83'));}else{loggerPredictive[_0x92d2('0x78')](_0x92d2('0x84'));}}else{loggerPredictive[_0x92d2('0x78')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x509250){return function(_0x54403b){loggerPredictive[_0x92d2('0x78')](_0x92d2('0x85'));loggerPredictive[_0x92d2('0x78')](_0x92d2('0x86'),_0x54403b[_0x92d2('0x6d')]);loggerPredictive[_0x92d2('0x78')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x54403b[_0x92d2('0x6e')]);loggerPredictive[_0x92d2('0x78')](_0x92d2('0x87'),_0x54403b[_0x92d2('0x6f')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x54403b[_0x92d2('0x70')]);loggerPredictive[_0x92d2('0x78')](_0x92d2('0x87'),_0x54403b[_0x92d2('0x6f')]);loggerPredictive[_0x92d2('0x78')](_0x92d2('0x82'));_[_0x92d2('0x88')](_0x509250,_0x54403b);};}function getDiff(_0x1c63d8){var _0x5c8206=moment()[_0x92d2('0x48')](0x0);var _0x3e5f3c=moment(_0x1c63d8)[_0x92d2('0x48')](0x0);return _0x5c8206['diff'](_0x3e5f3c,_0x92d2('0x49'));}function ifInterval(_0x3567ef,_0x412a9c){if(_['isUndefined'](_0x412a9c)){return![];}return getDiff(_0x412a9c)<_0x3567ef*0x3c;}function freeVariablesPredictive(_0x8a8794){if(isNotNull(_0x8a8794)){if(!_['isUndefined'](_0x8a8794[_0x92d2('0x28')])){_0x8a8794[_0x92d2('0x28')]=undefined;loggerPredictive[_0x92d2('0x78')](_0x8a8794[_0x92d2('0x3c')],_0x92d2('0x89'));}if(!_[_0x92d2('0x3a')](_0x8a8794[_0x92d2('0x27')])){_0x8a8794['startPredictive']=undefined;loggerPredictive[_0x92d2('0x78')](_0x8a8794['name'],_0x92d2('0x8a'));}if(!_[_0x92d2('0x3a')](_0x8a8794['handlePredictive'])){clearInterval(_0x8a8794['handlePredictive']);_0x8a8794[_0x92d2('0x8b')]=undefined;loggerPredictive[_0x92d2('0x78')](_0x8a8794[_0x92d2('0x3c')],_0x92d2('0x8c'));}}}function erlangb(_0x3fa643,_0x19582a){if(_0x19582a===0x0){return 0x0;}var _0x5054ca=0x1;for(var _0xd782ab=0x1;_0xd782ab<=_0x19582a;_0xd782ab+=0x1){_0x5054ca=0x1+_0x5054ca*_0xd782ab/_0x3fa643;}return 0x1/_0x5054ca;}function isVoiceQueueOutbound(_0x2abdea){return _0x2abdea==='outbound';}function isNotPreview(_0x1be536){return _0x1be536!==_0x92d2('0x1d');}function isCampaignIvr(_0x32f7fb){return _0x32f7fb===_0x92d2('0x8d');}function getCallerId(_0x3c3515,_0x3b3969,_0x119c02){if(!_['isUndefined'](_0x119c02)&&typeof _0x119c02===_0x92d2('0x8e')&&!_[_0x92d2('0x45')](_0x119c02)){if(!_['isUndefined'](_0x3b3969)&&typeof _0x3b3969===_0x92d2('0x8e')&&!_[_0x92d2('0x45')](_0x3b3969)){return util[_0x92d2('0x76')](_0x92d2('0x8f'),_0x3b3969,_0x119c02);}return util[_0x92d2('0x76')](_0x92d2('0x8f'),_0x119c02,_0x119c02);}if(!_[_0x92d2('0x3a')](_0x3c3515)&&typeof _0x3c3515===_0x92d2('0x8e')&&!_[_0x92d2('0x45')](_0x3c3515)){return _0x3c3515;}return _0x92d2('0x90');}function loggerCatchQueueSummary(_0x2a47e6,_0x409b78){return function(_0x3b653e){freeVariablesPredictive(_0x409b78);emitVoiceQueueSummary(_0x409b78);emitCampaignSummary(_0x409b78);loggerSyncQueueSummary[_0x92d2('0x91')](_0x2a47e6,util[_0x92d2('0x92')](_0x3b653e,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x4c3fce,_0xb10499){return function(_0x1e61be){loggerPredictive[_0x92d2('0x91')](_0xb10499[_0x92d2('0x3c')],_0x4c3fce);loggerPredictive[_0x92d2('0x91')](_0x1e61be[_0x92d2('0x93')]);freeVariablesPredictive(_0xb10499);};}function loggerCatch(_0x223430){return function(_0x2b1bae){logger[_0x92d2('0x91')](_0x223430,util[_0x92d2('0x92')](_0x2b1bae,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0xf11ffc){return _0xf11ffc&&!_[_0x92d2('0x3a')](_0xf11ffc)&&_0xf11ffc[_0x92d2('0x94')]>0x0;}function decremetOriginate(_0x5bd5e1){if(!_[_0x92d2('0x3a')](_0x5bd5e1)&&_0x5bd5e1!==null){if(typeof _0x5bd5e1[_0x92d2('0x95')]!==_0x92d2('0x96')){if(_0x5bd5e1[_0x92d2('0x95')]>0x0){_0x5bd5e1[_0x92d2('0x95')]-=0x1;}else{logger['error'](_0x92d2('0x97'));}}}else{logger[_0x92d2('0x91')](_0x92d2('0x98'));}}function checkContactLowerLimitOriginate(_0x3560c3,_0x5b2de1,_0x603ffc){if(_0x5b2de1>_0x603ffc){for(var _0x190451=0x0;_0x190451<_0x5b2de1-_0x603ffc;_0x190451+=0x1){decremetOriginate(_0x3560c3);}}}function loggerGetContactDialer(_0x4dbf14,_0x2d2b12,_0x271484){return function(_0x21ea17){checkContactLowerLimitOriginate(_0x2d2b12,_0x271484,0x0);logger['error'](_0x4dbf14,util[_0x92d2('0x92')](_0x21ea17,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2b37c2){return function(_0x31a1ee){if(isNotNull(_0x31a1ee)&&isNotNull(_0x31a1ee[0x0])){if(_0x31a1ee[0x0]['contactsRescheduled']>0x0){_0x2b37c2[_0x92d2('0x3e')]=_0x92d2('0x99');logger['info'](_0x92d2('0x9a')+_0x2b37c2[_0x92d2('0x3c')],_0x31a1ee[0x0][_0x92d2('0x9b')],'contacts');}else{_0x2b37c2[_0x92d2('0x3e')]=_0x92d2('0x9c');logger['info'](_0x92d2('0x9d')+_0x2b37c2['name']);}}};}function notSendMessagesQueue(_0x5308e6){if(_0x5308e6[_0x92d2('0x9e')]){freeVariablesPredictive(_0x5308e6);if(_0x5308e6[_0x92d2('0x95')]===0x0&&_0x5308e6[_0x92d2('0x9f')]===0x0&&_0x5308e6[_0x92d2('0x54')]===0x0&&(_0x5308e6[_0x92d2('0x50')]||0x0)===0x0){_0x5308e6['sendMessageOneNotActive']=![];_0x5308e6[_0x92d2('0x4e')]=0x0;_0x5308e6[_0x92d2('0x3e')]=_0x92d2('0x3f');loggerSyncQueueSummary[_0x92d2('0x91')](_0x92d2('0xa0'),_0x5308e6[_0x92d2('0x3c')],'is\x20not\x20active');}else{_0x5308e6['message']=_0x92d2('0xa1');loggerSyncQueueSummary['error'](_0x92d2('0xa0'),_0x5308e6['name'],_0x92d2('0xa2'));}emitVoiceQueueSummary(_0x5308e6);}}function notSendMessagesCampaign(_0x5c5c50){if(_0x5c5c50[_0x92d2('0x9e')]){if(_0x5c5c50[_0x92d2('0x95')]===0x0){_0x5c5c50['sendMessageOneNotActive']=![];_0x5c5c50[_0x92d2('0x3e')]=_0x92d2('0x3f');loggerSyncQueueSummary[_0x92d2('0x91')](_0x92d2('0xa3'),_0x5c5c50[_0x92d2('0x3c')],'is\x20not\x20active');}else{_0x5c5c50[_0x92d2('0x3e')]=_0x92d2('0xa1');loggerSyncQueueSummary[_0x92d2('0x91')](_0x92d2('0xa3'),_0x5c5c50['name'],_0x92d2('0xa2'));}emitCampaignSummary(_0x5c5c50);}}function createObjHistory(_0x5778fa,_0x179c54,_0x1806a1,_0x436bab,_0xcfabc9){_0x5778fa['message']=_0x1806a1;var _0x5ac969=new Action(_0x5778fa,_0x179c54);var _0x449bb8=new History(_0x5ac969);_0x449bb8[_0x92d2('0xa4')]=_0x436bab;_0x449bb8[_0x92d2('0xa5')]=_0xcfabc9;_0x449bb8[_0x92d2('0xa6')]=_0x5ac969[_0x92d2('0xa7')];return _0x449bb8;}Dialer[_0x92d2('0x18')][_0x92d2('0xa8')]=function(){var _0x257ffd=this;setInterval(function(){_0x257ffd[_0x92d2('0xa9')](_0x257ffd['uniqueId'],_0x92d2('0xaa'));_0x257ffd[_0x92d2('0xa9')](_0x257ffd[_0x92d2('0xab')],_0x92d2('0xac'));},0x32c8);};Dialer[_0x92d2('0x18')]['clearZombieChannels']=function(_0x36b2fb,_0x36f36e){var _0x397952=this;for(var _0x91d1d in _0x36b2fb){if(typeof _0x36b2fb[_0x91d1d]!==_0x92d2('0x96')){this[_0x92d2('0x1c')][_0x92d2('0x19')](function(){if(!_['isNil'](_0x36b2fb[_0x91d1d])){return ami[_0x92d2('0xad')]({'action':_0x92d2('0xae'),'channel':_0x36b2fb[_0x91d1d][_0x92d2('0xaf')]})[_0x92d2('0xb0')](function(_0x38ed75){if(_0x38ed75['message']===_0x92d2('0xb1')){setTimeout(function(){if(_0x36b2fb[_0x91d1d]&&_0x36b2fb[_0x91d1d][_0x92d2('0x4a')]!==_0x92d2('0x8d')){_0x397952['updateOriginated'](_0x397952[_0x92d2('0x1e')][_0x36b2fb[_0x91d1d][_0x92d2('0xb2')]]);logger[_0x92d2('0x91')](_0x92d2('0xb3'),_0x36f36e,_0x91d1d,_0x36b2fb[_0x91d1d]['queue']);delete _0x36b2fb[_0x91d1d];}if(_0x36b2fb[_0x91d1d]&&_0x36b2fb[_0x91d1d][_0x92d2('0x4a')]===_0x92d2('0x8d')){_0x397952[_0x92d2('0xb4')](_0x397952[_0x92d2('0x1f')][_0x36b2fb[_0x91d1d][_0x92d2('0xb2')]]);logger[_0x92d2('0x91')](_0x92d2('0xb5'),_0x36f36e,_0x91d1d,_0x36b2fb[_0x91d1d][_0x92d2('0xb2')]);delete _0x36b2fb[_0x91d1d];}},0x2328);}});}});}}};Dialer[_0x92d2('0x18')]['countReScheduled']=function(_0x36286d){return BPromise[_0x92d2('0xb6')]()[_0x92d2('0xb7')](cmHopper[_0x92d2('0xb8')](_0x36286d))[_0x92d2('0xb0')](loggerCatch(_0x92d2('0xb9')));};Dialer[_0x92d2('0x18')][_0x92d2('0xba')]=function(_0x26dd81){return BPromise[_0x92d2('0xb6')]()['then'](cmHopperBlack['checkIsBlackList'](_0x26dd81))[_0x92d2('0xb0')](loggerCatch(_0x92d2('0xbb')));};Dialer[_0x92d2('0x18')][_0x92d2('0xbc')]=function(_0x5b6675){return BPromise[_0x92d2('0xb6')]()[_0x92d2('0xb7')](cmHopperBlack['checkIsBlackListIvr'](_0x5b6675))[_0x92d2('0xb0')](loggerCatch(_0x92d2('0xbd')));};Dialer[_0x92d2('0x18')][_0x92d2('0xbe')]=function(_0x48814f){return BPromise['resolve']()[_0x92d2('0xb7')](cmHopperHistory['avgHandleTime'](_0x48814f))[_0x92d2('0xb0')](loggerCatch(_0x92d2('0xbf')));};Dialer[_0x92d2('0x18')]['rescheduleContact']=function(_0x57e054){return BPromise[_0x92d2('0xb6')]()[_0x92d2('0xb7')](cmHopper[_0x92d2('0xc0')](_0x57e054))[_0x92d2('0xb0')](loggerCatch(_0x92d2('0xc1')));};Dialer[_0x92d2('0x18')][_0x92d2('0xc2')]=function(_0x1c5395,_0xe0c9c6,_0x22321e){return BPromise['resolve']()['then'](cmHopper['unlockContact'](_0x1c5395,_0xe0c9c6,_0x22321e))[_0x92d2('0xb0')](loggerCatch(_0x92d2('0xc3')));};Dialer[_0x92d2('0x18')]['getContactDialer']=function(_0x4aa772,_0x25cb06,_0xdc5294,_0x5293bf,_0x225c07){return BPromise['resolve']()['then'](cmHopper[_0x92d2('0xc4')](_0x4aa772,_0x25cb06,_0xdc5294,_0x5293bf))[_0x92d2('0xb0')](function(_0x3f7f2e){_0x225c07[_0x92d2('0xc5')]-=_0xdc5294;_0x225c07['temp']=_0x225c07[_0x92d2('0xc5')]>0x0?_0x225c07[_0x92d2('0xc5')]:0x0;loggerCatch(_0x92d2('0xc6'))(_0x3f7f2e);});};Dialer[_0x92d2('0x18')][_0x92d2('0xc7')]=function(_0x57d264,_0x4dc639,_0x52590b,_0x2b4748){return BPromise[_0x92d2('0xb6')]()[_0x92d2('0xb7')](cmHopper[_0x92d2('0xc7')](_0x57d264,_0x4dc639,_0x52590b))[_0x92d2('0xb0')](function(_0x20f1fc){_0x2b4748[_0x92d2('0xc5')]-=_0x4dc639;_0x2b4748[_0x92d2('0xc5')]=_0x2b4748[_0x92d2('0xc5')]>0x0?_0x2b4748['temp']:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x20f1fc);});};Dialer['prototype'][_0x92d2('0xc8')]=function(_0x127a90){return BPromise[_0x92d2('0xb6')]()['then'](voiceQueueRt[_0x92d2('0xc8')](_0x127a90))[_0x92d2('0xb0')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x92d2('0x18')][_0x92d2('0xc9')]=function(_0x3ec1d3){return BPromise[_0x92d2('0xb6')]()[_0x92d2('0xb7')](cmHopper[_0x92d2('0xc9')](_0x3ec1d3))[_0x92d2('0xb0')](loggerCatch(_0x92d2('0xca')));};Dialer[_0x92d2('0x18')][_0x92d2('0xcb')]=function(_0x3a0548){return BPromise[_0x92d2('0xb6')]()[_0x92d2('0xb7')](cmHopperHistory[_0x92d2('0xcb')](_0x3a0548))[_0x92d2('0xb0')](loggerCatch(_0x92d2('0xcc')));};Dialer[_0x92d2('0x18')][_0x92d2('0xb4')]=function(_0x4bd1c2){if(!_[_0x92d2('0x3a')](_0x4bd1c2)&&_0x4bd1c2!==null){if(typeof _0x4bd1c2[_0x92d2('0x95')]!==_0x92d2('0x96')){if(_0x4bd1c2['originated']>0x0){_0x4bd1c2[_0x92d2('0x95')]-=0x1;}else{logger['error'](_0x92d2('0xcd'));}}}else{logger[_0x92d2('0x91')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x92d2('0x18')]['loggerHandler']=function(_0x2019da,_0x576362){var _0x250d7a=this;return function(_0x3ac932){_0x250d7a[_0x92d2('0xb4')](_0x576362);logger[_0x92d2('0x91')](_0x2019da,util[_0x92d2('0x92')](_0x3ac932,{'showHidden':![],'depth':null}));};};Dialer[_0x92d2('0x18')]['emptyContact']=function(_0x521961,_0x40490a,_0x5bfb2f){var _0x367e88={'state':0x19,'statedesc':_0x92d2('0xce')};this[_0x92d2('0xb4')](_0x40490a);this[_0x92d2('0xcf')](_[_0x92d2('0x88')](_0x367e88,_[_0x92d2('0xd0')](_0x5bfb2f,[_0x92d2('0xd1'),_0x92d2('0xd2'),_0x92d2('0xd3'),_0x92d2('0xd4'),_0x92d2('0xd5')])),_0x92d2('0xd6'),_0x92d2('0xd7'));logger[_0x92d2('0x91')](_0x521961);};Dialer[_0x92d2('0x18')][_0x92d2('0xd8')]=function(_0x2e9ab9){return _0x2e9ab9==='Success';};Dialer[_0x92d2('0x18')][_0x92d2('0xd9')]=function(_0x449931){return!_[_0x92d2('0x3a')](_0x449931)&&_0x449931&&!_['isUndefined'](_0x449931['name'])&&!_['isUndefined'](_0x449931[_0x92d2('0x72')])&&_0x449931['active']&&(this[_0x92d2('0x21')][util[_0x92d2('0x76')]('SIP/%s',_0x449931['name'])][_0x92d2('0xae')]===_0x92d2('0xda')||this[_0x92d2('0x21')][util['format']('SIP/%s',_0x449931['name'])][_0x92d2('0xae')]==='unmonitored');};Dialer[_0x92d2('0x18')][_0x92d2('0xcf')]=function(_0x8dbc91,_0x584017,_0x45b57c){this[_0x92d2('0xcb')](_0x8dbc91)[_0x92d2('0xb0')](loggerCatch(_0x584017));this['moveContactManagedDialer'](_0x8dbc91)[_0x92d2('0xb0')](loggerCatch(_0x45b57c));};Dialer[_0x92d2('0x18')][_0x92d2('0x36')]=function(_0x3f7e69){var _0x20c475=this[_0x92d2('0x25')][_0x3f7e69[_0x92d2('0xdb')]];var _0x4e5af6;if(!_['isNil'](_0x3f7e69)&&!_[_0x92d2('0xdc')](_0x3f7e69[_0x92d2('0xdd')])&&!_[_0x92d2('0xdc')](_0x3f7e69[_0x92d2('0xdd')][_0x92d2('0xde')])&&_0x3f7e69[_0x92d2('0xdf')]===_0x92d2('0xe0')&&_0x20c475){if(_0x20c475['type']!==_0x92d2('0x8d')&&this[_0x92d2('0x1e')][_0x20c475['queue']][_0x92d2('0xe1')]&&_0x3f7e69[_0x92d2('0xe2')]===_0x92d2('0xe3')){delete this['uniqueId'][_0x3f7e69[_0x92d2('0xdb')]];this[_0x92d2('0xb4')](this[_0x92d2('0x1e')][_0x20c475['queue']]);this[_0x92d2('0x1e')][_0x20c475[_0x92d2('0xb2')]]['outboundAnswerCallsDay']+=0x1;this[_0x92d2('0x1e')][_0x20c475[_0x92d2('0xb2')]][_0x92d2('0xe4')]+=0x1;_0x4e5af6=new Hangup(_0x20c475,_0x3f7e69);_0x4e5af6[_0x92d2('0xa4')]=0x12;_0x4e5af6[_0x92d2('0xa5')]='HangupInAMD';_0x4e5af6[_0x92d2('0xe5')]=_0x92d2('0xe6');ami[_0x92d2('0xe7')](_0x92d2('0xe8'),ut[_0x92d2('0xe9')](_0x4e5af6,_0x92d2('0xea')));this['saveInDb'](_0x4e5af6,_0x92d2('0xeb'),_0x92d2('0xec'));}if(_0x20c475[_0x92d2('0x4a')]!==_0x92d2('0x8d')&&this[_0x92d2('0x1e')][_0x20c475[_0x92d2('0xb2')]]['dialAMDActive']&&_0x3f7e69['value']==='MACHINE'){var _0x5f038e=this;return new BPromise(function(_0x8f3847,_0x6e4c0b){delete _0x5f038e[_0x92d2('0x25')][_0x3f7e69[_0x92d2('0xdb')]];_0x5f038e[_0x92d2('0xb4')](_0x5f038e['voiceQueues'][_0x20c475['queue']]);_0x5f038e[_0x92d2('0x1e')][_0x20c475['queue']][_0x92d2('0xed')]+=0x1;_0x5f038e['voiceQueues'][_0x20c475['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x2c979a=_0x5f038e[_0x92d2('0x1e')][_0x20c475[_0x92d2('0xb2')]];var _0x13ff94=new Hangup(_0x20c475,_0x3f7e69);_0x13ff94[_0x92d2('0xa4')]=0x13;_0x13ff94['statedesc']=_0x92d2('0xee');_0x13ff94[_0x92d2('0xe5')]=_0x92d2('0xe6');_0x13ff94[_0x92d2('0xef')]+=0x1;_0x13ff94[_0x92d2('0xf0')]+=0x1;_0x13ff94[_0x92d2('0xea')]=!![];ami['emit']('custom:amd',ut[_0x92d2('0xe9')](_0x13ff94,'amd'));_0x5f038e[_0x92d2('0xcb')](_0x13ff94)[_0x92d2('0xb0')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x13ff94['countbusyretry']+_0x13ff94[_0x92d2('0xf1')]+_0x13ff94['countnoanswerretry']+_0x13ff94['countnosuchnumberretry']+_0x13ff94[_0x92d2('0xf2')]+_0x13ff94[_0x92d2('0xf3')]+_0x13ff94[_0x92d2('0xef')]+_0x13ff94[_0x92d2('0xf4')]>=_0x2c979a['dialGlobalMaxRetry']){_0x5f038e['stateGlobal'](_0x13ff94,_0x8f3847,_0x6e4c0b,'reason19\x20machine....');}else{if(_0x13ff94[_0x92d2('0xef')]>=_0x2c979a[_0x92d2('0xf5')]){_0x5f038e[_0x92d2('0xf6')](_0x13ff94,_0x8f3847,_0x6e4c0b,'reason\x2019\x20machine....');}else{_0x5f038e['rescheduleContact']({'active':![],'countmachineretry':_0x13ff94[_0x92d2('0xef')],'scheduledat':moment()[_0x92d2('0xf7')](_0x2c979a[_0x92d2('0xf8')],_0x92d2('0xf9'))[_0x92d2('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x13ff94[_0x92d2('0xd1')],'ListId':_0x13ff94[_0x92d2('0xd2')],'VoiceQueueId':_0x13ff94[_0x92d2('0xd4')]||undefined,'CampaignId':_0x13ff94[_0x92d2('0xd5')]||undefined})[_0x92d2('0xb0')](loggerCatch(_0x92d2('0xfa')));_0x8f3847({'reschedule':0x1});}}});}if(_0x20c475['type']===_0x92d2('0x8d')&&this[_0x92d2('0x1f')][_0x20c475['queue']][_0x92d2('0xe1')]&&_0x3f7e69[_0x92d2('0xe2')]===_0x92d2('0xe3')){delete this['uniqueId'][_0x3f7e69[_0x92d2('0xdb')]];this[_0x92d2('0xb4')](this[_0x92d2('0x1f')][_0x20c475[_0x92d2('0xb2')]]);_0x4e5af6=new Hangup(_0x20c475,_0x3f7e69);_0x4e5af6['state']=0x12;_0x4e5af6['statedesc']='HangupInAMD';_0x4e5af6[_0x92d2('0xe5')]=_0x92d2('0xe6');ami[_0x92d2('0xe7')](_0x92d2('0xe8'),ut['buildObj'](_0x4e5af6,_0x92d2('0xea')));this[_0x92d2('0xcf')](_0x4e5af6,'[syncHangupInAMDIvr][createHistory]',_0x92d2('0xfb'));}if(_0x20c475[_0x92d2('0x4a')]===_0x92d2('0x8d')&&this[_0x92d2('0x1f')][_0x20c475[_0x92d2('0xb2')]][_0x92d2('0xe1')]&&_0x3f7e69[_0x92d2('0xe2')]===_0x92d2('0xfc')){var _0x5f038e=this;return new BPromise(function(_0x327c3f,_0x3174f1){delete _0x5f038e['uniqueId'][_0x3f7e69[_0x92d2('0xdb')]];_0x5f038e['updateOriginated'](_0x5f038e[_0x92d2('0x1f')][_0x20c475['queue']]);_0x5f038e[_0x92d2('0x1f')][_0x20c475[_0x92d2('0xb2')]][_0x92d2('0xed')]+=0x1;_0x5f038e[_0x92d2('0x1f')][_0x20c475[_0x92d2('0xb2')]][_0x92d2('0xe4')]+=0x1;var _0x4077a4=_0x5f038e[_0x92d2('0x1f')][_0x20c475[_0x92d2('0xb2')]];var _0x39f798=new Hangup(_0x20c475,_0x3f7e69);_0x39f798[_0x92d2('0xa4')]=0x13;_0x39f798[_0x92d2('0xa5')]=_0x92d2('0xee');_0x39f798[_0x92d2('0xe5')]=_0x92d2('0xe6');_0x39f798[_0x92d2('0xef')]+=0x1;_0x39f798[_0x92d2('0xf0')]+=0x1;_0x39f798[_0x92d2('0xea')]=!![];ami['emit'](_0x92d2('0xe8'),ut[_0x92d2('0xe9')](_0x39f798,_0x92d2('0xea')));_0x5f038e[_0x92d2('0xcb')](_0x39f798)[_0x92d2('0xb0')](loggerCatch(_0x92d2('0xfd')));if(_0x39f798[_0x92d2('0xfe')]+_0x39f798[_0x92d2('0xf1')]+_0x39f798[_0x92d2('0xff')]+_0x39f798[_0x92d2('0x100')]+_0x39f798['countdropretry']+_0x39f798[_0x92d2('0xf3')]+_0x39f798[_0x92d2('0xef')]+_0x39f798[_0x92d2('0xf4')]>=_0x4077a4['dialGlobalMaxRetry']){_0x5f038e[_0x92d2('0x101')](_0x39f798,_0x327c3f,_0x3174f1,_0x92d2('0x102'));}else{if(_0x39f798[_0x92d2('0xef')]>=_0x4077a4[_0x92d2('0xf5')]){_0x5f038e[_0x92d2('0xf6')](_0x39f798,_0x327c3f,_0x3174f1,_0x92d2('0x103'));}else{_0x5f038e[_0x92d2('0xc0')]({'active':![],'countmachineretry':_0x39f798[_0x92d2('0xef')],'scheduledat':moment()[_0x92d2('0xf7')](_0x4077a4[_0x92d2('0xf8')],_0x92d2('0xf9'))[_0x92d2('0x76')](_0x92d2('0x104')),'ContactId':_0x39f798[_0x92d2('0xd1')],'ListId':_0x39f798['ListId'],'VoiceQueueId':_0x39f798[_0x92d2('0xd4')]||undefined,'CampaignId':_0x39f798['CampaignId']||undefined})[_0x92d2('0xb0')](loggerCatch(_0x92d2('0xfa')));_0x327c3f({'reschedule':0x1});}}});}}};Dialer[_0x92d2('0x18')][_0x92d2('0x33')]=function(_0x5effde){var _0x1a03e4=this[_0x92d2('0x25')][_0x5effde[_0x92d2('0xdb')]];var _0x10acf0=this;var _0x3f62df;if(_0x1a03e4&&_0x1a03e4[_0x92d2('0x4a')]==='ivr'){delete this[_0x92d2('0x25')][_0x5effde[_0x92d2('0xdb')]];this['updateOriginated'](this[_0x92d2('0x1f')][_0x1a03e4[_0x92d2('0xb2')]]);this['campaigns'][_0x1a03e4[_0x92d2('0xb2')]][_0x92d2('0x105')]+=0x1;_0x3f62df=new Hangup(_0x1a03e4,_0x5effde);this[_0x92d2('0xcb')](_0x3f62df)[_0x92d2('0xb0')](loggerCatch(_0x92d2('0x106')));this['moveContactManagedDialer'](_0x3f62df)['catch'](loggerCatch(_0x92d2('0x107')));}if(_0x1a03e4&&_0x1a03e4[_0x92d2('0x4a')]!=='ivr'&&isNotNull(this[_0x92d2('0x1e')][_0x1a03e4[_0x92d2('0xb2')]][_0x92d2('0x108')])){delete this[_0x92d2('0x25')][_0x5effde[_0x92d2('0xdb')]];this[_0x92d2('0xb4')](this[_0x92d2('0x1e')][_0x1a03e4['queue']]);this[_0x92d2('0x1e')][_0x1a03e4['queue']][_0x92d2('0xed')]+=0x1;this[_0x92d2('0x1e')][_0x1a03e4[_0x92d2('0xb2')]][_0x92d2('0xe4')]+=0x1;_0x3f62df=new Hangup(_0x1a03e4,_0x5effde);_0x3f62df['state']=0x10;_0x3f62df[_0x92d2('0xa5')]=_0x92d2('0x109');_0x3f62df['membername']='AGI';this[_0x92d2('0xcb')](_0x3f62df)['catch'](loggerCatch(_0x92d2('0x106')));this['moveContactManagedDialer'](_0x3f62df)[_0x92d2('0xb0')](loggerCatch(_0x92d2('0x107')));}if(_0x1a03e4&&_0x1a03e4[_0x92d2('0x4a')]!==_0x92d2('0x8d')&&!isNotNull(this[_0x92d2('0x1e')][_0x1a03e4[_0x92d2('0xb2')]][_0x92d2('0x108')])){delete this[_0x92d2('0x25')][_0x5effde[_0x92d2('0xdb')]];this[_0x92d2('0xb4')](this[_0x92d2('0x1e')][_0x1a03e4[_0x92d2('0xb2')]]);this[_0x92d2('0x1e')][_0x1a03e4['queue']][_0x92d2('0x10a')]+=0x1;_0x3f62df=new Hangup(_0x1a03e4,_0x5effde);_0x3f62df[_0x92d2('0xa4')]=0xc;_0x3f62df[_0x92d2('0xa5')]=_0x5effde['cause-txt'];_0x3f62df[_0x92d2('0xe5')]=_0x92d2('0x10b');this[_0x92d2('0xcb')](_0x3f62df)[_0x92d2('0xb0')](loggerCatch(_0x92d2('0x106')));this[_0x92d2('0xc9')](_0x3f62df)[_0x92d2('0xb0')](loggerCatch(_0x92d2('0x107')));}};Dialer[_0x92d2('0x18')][_0x92d2('0x30')]=function(_0x35fd25){var _0x259c82=this[_0x92d2('0x25')][_0x35fd25[_0x92d2('0xdb')]];var _0x8d7c72=this;if(this[_0x92d2('0x1e')][_0x35fd25['queue']]){if(_0x259c82&&_0x259c82[_0x92d2('0x4a')]!==_0x92d2('0x8d')){delete this[_0x92d2('0x25')][_0x35fd25['uniqueid']];this[_0x92d2('0x1e')][_0x35fd25['queue']][_0x92d2('0xed')]+=0x1;var _0xf50cea=new AgentComplete(_0x259c82,_0x35fd25);if(_0x35fd25[_0x92d2('0x10c')]===_0x92d2('0x10d')){_0xf50cea[_0x92d2('0x10e')]=this[_0x92d2('0x1e')][_0x35fd25[_0x92d2('0xb2')]]['dialQueueProject2']&&this[_0x92d2('0x1e')][_0x35fd25[_0x92d2('0xb2')]][_0x92d2('0x10f')]?moment()[_0x92d2('0x76')](_0x92d2('0x104')):undefined;}this[_0x92d2('0xcb')](_0xf50cea)[_0x92d2('0xb0')](loggerCatch(_0x92d2('0x110')));this[_0x92d2('0xc9')](_0xf50cea)[_0x92d2('0xb0')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x92d2('0x18')][_0x92d2('0x111')]=function(_0x417a5a){if(this[_0x92d2('0x1e')][_0x417a5a[_0x92d2('0xb2')]]){if(this[_0x92d2('0x25')][_0x417a5a[_0x92d2('0xdb')]]&&this[_0x92d2('0x25')][_0x417a5a[_0x92d2('0xdb')]][_0x92d2('0x4a')]!==_0x92d2('0x8d')){this[_0x92d2('0xb4')](this[_0x92d2('0x1e')][_0x417a5a['queue']]);this[_0x92d2('0x25')][_0x417a5a[_0x92d2('0xdb')]]['answertime']=moment()[_0x92d2('0x76')](_0x92d2('0x104'));}}};Dialer[_0x92d2('0x18')][_0x92d2('0x112')]=function(_0xe60e9c){this[_0x92d2('0xcb')](_0xe60e9c)[_0x92d2('0xb0')](loggerCatch(_0x92d2('0x110')));this[_0x92d2('0xc9')](_0xe60e9c)[_0x92d2('0xb0')](loggerCatch(_0x92d2('0x113')));};Dialer[_0x92d2('0x18')][_0x92d2('0x2e')]=function(_0x21a3f7){var _0x107d8e=this[_0x92d2('0x25')][_0x21a3f7[_0x92d2('0xdb')]];var _0x2cf25f=this;if(this[_0x92d2('0x1e')][_0x21a3f7['queue']]){if(_0x107d8e&&_0x107d8e['type']!==_0x92d2('0x8d')){delete this[_0x92d2('0x25')][_0x21a3f7[_0x92d2('0xdb')]];this[_0x92d2('0xb4')](this[_0x92d2('0x1e')][_0x21a3f7['queue']]);_0x107d8e['droptime']=moment()['format'](_0x92d2('0x104'));var _0x2eea55=new QueueCallerAbandon(_0x107d8e,_0x21a3f7);if(getSeconds(_0x107d8e[_0x92d2('0x114')],_0x107d8e[_0x92d2('0x115')])>=_0x107d8e['dialQueueTimeout']){this[_0x92d2('0x1e')][_0x21a3f7[_0x92d2('0xb2')]][_0x92d2('0x7e')]+=0x1;this[_0x92d2('0x1e')][_0x21a3f7[_0x92d2('0xb2')]][_0x92d2('0x116')]+=0x1;this[_0x92d2('0x1e')][_0x21a3f7['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x2eea55[_0x92d2('0xa4')]=0xa;_0x2eea55['statedesc']=_0x92d2('0x117');_0x2eea55[_0x92d2('0x118')]=_0x92d2('0x119');_0x2eea55[_0x92d2('0x10e')]=this[_0x92d2('0x1e')][_0x21a3f7[_0x92d2('0xb2')]][_0x92d2('0x11a')]?moment()['format'](_0x92d2('0x104')):undefined;_0x2eea55[_0x92d2('0xf2')]+=0x1;_0x2eea55[_0x92d2('0xf0')]+=0x1;if(_0x2eea55[_0x92d2('0xf2')]>=this[_0x92d2('0x1e')][_0x21a3f7['queue']][_0x92d2('0x11b')]){this[_0x92d2('0x112')](_0x2eea55);}else{this[_0x92d2('0xc0')]({'active':![],'countdropretry':_0x2eea55[_0x92d2('0xf2')],'scheduledat':moment()[_0x92d2('0xf7')](this['voiceQueues'][_0x21a3f7[_0x92d2('0xb2')]][_0x92d2('0x11c')],_0x92d2('0xf9'))[_0x92d2('0x76')](_0x92d2('0x104')),'ContactId':_0x107d8e[_0x92d2('0xd1')],'ListId':_0x107d8e[_0x92d2('0xd2')],'VoiceQueueId':_0x107d8e[_0x92d2('0xd4')]||undefined,'CampaignId':_0x107d8e[_0x92d2('0xd5')]||undefined})[_0x92d2('0xb0')](loggerCatch(_0x92d2('0x11d')));var _0x3d8469=new History(_0x2eea55);_0x3d8469[_0x92d2('0xa4')]=0xa;_0x3d8469[_0x92d2('0xa5')]=_0x92d2('0x117');_0x3d8469[_0x92d2('0xa7')]=moment()[_0x92d2('0x76')](_0x92d2('0x104'));_0x3d8469[_0x92d2('0xa6')]=_0x3d8469[_0x92d2('0xa7')];_0x3d8469[_0x92d2('0x11e')]=_0x2eea55[_0x92d2('0x11e')];_0x3d8469[_0x92d2('0x11f')]=_0x2eea55['calleridnum'];this[_0x92d2('0xcb')](_0x3d8469)[_0x92d2('0xb0')](loggerCatch(_0x92d2('0x120')));}}else{this[_0x92d2('0x1e')][_0x21a3f7[_0x92d2('0xb2')]][_0x92d2('0x67')]+=0x1;this[_0x92d2('0x1e')][_0x21a3f7[_0x92d2('0xb2')]][_0x92d2('0x5e')]+=0x1;_0x2eea55[_0x92d2('0xa4')]=0xb;_0x2eea55[_0x92d2('0xa5')]=_0x92d2('0x121');_0x2eea55['dropreason']=_0x92d2('0x122');_0x2eea55[_0x92d2('0xf3')]+=0x1;_0x2eea55[_0x92d2('0xf0')]+=0x1;if(_0x2eea55[_0x92d2('0xf3')]>=this[_0x92d2('0x1e')][_0x21a3f7['queue']][_0x92d2('0x123')]){this['queueCallerAbandonCreateState'](_0x2eea55);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x2eea55['countabandonedretry'],'scheduledat':moment()[_0x92d2('0xf7')](this[_0x92d2('0x1e')][_0x21a3f7[_0x92d2('0xb2')]][_0x92d2('0x124')],_0x92d2('0xf9'))['format'](_0x92d2('0x104')),'ContactId':_0x107d8e['ContactId'],'ListId':_0x107d8e[_0x92d2('0xd2')],'VoiceQueueId':_0x107d8e[_0x92d2('0xd4')]||undefined,'CampaignId':_0x107d8e[_0x92d2('0xd5')]||undefined})[_0x92d2('0xb0')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x3d8469=new History(_0x2eea55);_0x3d8469[_0x92d2('0xa4')]=0xb;_0x3d8469[_0x92d2('0xa5')]=_0x92d2('0x121');_0x3d8469['starttime']=moment()[_0x92d2('0x76')]('YYYY-MM-DD\x20HH:mm:ss');_0x3d8469[_0x92d2('0xa6')]=_0x3d8469[_0x92d2('0xa7')];_0x3d8469[_0x92d2('0x11e')]=_0x2eea55[_0x92d2('0x11e')];_0x3d8469[_0x92d2('0x11f')]=_0x2eea55['calleridnum'];this[_0x92d2('0xcb')](_0x3d8469)[_0x92d2('0xb0')](loggerCatch(_0x92d2('0x125')));}}}}};Dialer[_0x92d2('0x18')]['syncNewExten']=function(_0x36b6a5){if(this[_0x92d2('0xab')][_0x36b6a5[_0x92d2('0xdb')]]){this[_0x92d2('0xab')][_0x36b6a5['uniqueid']][_0x92d2('0xaf')]=_0x36b6a5[_0x92d2('0xaf')];}if(this[_0x92d2('0x25')][_0x36b6a5[_0x92d2('0xdb')]]){this[_0x92d2('0x25')][_0x36b6a5[_0x92d2('0xdb')]][_0x92d2('0xaf')]=_0x36b6a5['channel'];}};Dialer[_0x92d2('0x18')][_0x92d2('0x126')]=function(_0x531e59){if(strategy[this[_0x92d2('0x1e')][this[_0x92d2('0xab')][_0x531e59[_0x92d2('0x127')]][_0x92d2('0xb2')]][_0x92d2('0x4c')]]===_0x92d2('0x17')){if(this[_0x92d2('0xab')][_0x531e59[_0x92d2('0x127')]]&&_[_0x92d2('0xdc')](this[_0x92d2('0xab')][_0x531e59[_0x92d2('0x127')]][_0x92d2('0x128')])&&_0x531e59['status']==='1'&&_0x531e59[_0x92d2('0x129')]==='0'){if(this['agents'][_0x531e59[_0x92d2('0x12a')]]){if(!this[_0x92d2('0x20')][_0x531e59['stateinterface']][_0x92d2('0x128')]){this[_0x92d2('0x20')][_0x531e59[_0x92d2('0x12a')]]['locked']=!![];this[_0x92d2('0xab')][_0x531e59[_0x92d2('0x127')]]['locked']=!![];this[_0x92d2('0xab')][_0x531e59[_0x92d2('0x127')]]['stateinterface']=_0x531e59[_0x92d2('0x12a')];}}}}else if((strategy[this[_0x92d2('0x1e')][this['actions'][_0x531e59[_0x92d2('0x127')]]['queue']]['strategy']]||'rrmemory')==='rrmemory'){if(this[_0x92d2('0xab')][_0x531e59['actionid']]){if(this[_0x92d2('0x20')][_0x531e59[_0x92d2('0x12a')]]){this[_0x92d2('0xab')][_0x531e59[_0x92d2('0x127')]][_0x92d2('0x12a')]=_0x531e59[_0x92d2('0x12a')];if(_[_0x92d2('0xdc')](this['queueBooked'][this['actions'][_0x531e59[_0x92d2('0x127')]][_0x92d2('0xb2')]])){this[_0x92d2('0x12b')][this[_0x92d2('0xab')][_0x531e59['actionid']][_0x92d2('0xb2')]]=[];}this[_0x92d2('0x12b')][this['actions'][_0x531e59[_0x92d2('0x127')]][_0x92d2('0xb2')]][_0x92d2('0x12c')](_['merge'](_[_0x92d2('0xd0')](this[_0x92d2('0xab')][_0x531e59[_0x92d2('0x127')]],[_0x92d2('0x12d'),_0x92d2('0x12a')]),{'status':_0x531e59[_0x92d2('0xae')],'paused':_0x531e59['paused']}));}}}};function unlockQueueStatus(_0x4d9d3b,_0x2cc6cb){setTimeout(function(){if(_[_0x92d2('0x3a')](_0x4d9d3b[_0x92d2('0x12e')])){loggerBooked[_0x92d2('0x91')]('[unlockQueueStatus][undefined]',_0x2cc6cb);}_0x4d9d3b[_0x92d2('0x12e')]=!![];loggerBooked[_0x92d2('0x78')](_0x92d2('0x12f'),_0x2cc6cb,JSON['stringify'](_[_0x92d2('0xd0')](_0x4d9d3b,[_0x92d2('0x3c'),_0x92d2('0x12e')])));},0x1f3);}Dialer['prototype'][_0x92d2('0x38')]=function(_0xa81566){var _0x28eda5=this;var _0x2ced7a=_0x28eda5[_0x92d2('0x1e')][_0x28eda5[_0x92d2('0xab')][_0xa81566['actionid']][_0x92d2('0xb2')]];if(strategy[this['voiceQueues'][this[_0x92d2('0xab')][_0xa81566[_0x92d2('0x127')]][_0x92d2('0xb2')]]['strategy']]===_0x92d2('0x17')){if(this[_0x92d2('0xab')][_0xa81566['actionid']]&&this['actions'][_0xa81566[_0x92d2('0x127')]]['stateinterface']){this[_0x92d2('0x1d')][_0x92d2('0x130')](this[_0x92d2('0xab')][_0xa81566[_0x92d2('0x127')]][_0x92d2('0x12d')],this[_0x92d2('0xab')][_0xa81566[_0x92d2('0x127')]]['stateinterface'])[_0x92d2('0xb0')](function(_0xa216b9){logger[_0x92d2('0x91')](_0x92d2('0x131'),util[_0x92d2('0x92')](_0xa216b9,{'showHidden':![],'depth':null}));})[_0x92d2('0x1b')](function(){_0x28eda5[_0x92d2('0xb4')](_0x28eda5[_0x92d2('0x1e')][_0x28eda5['actions'][_0xa81566[_0x92d2('0x127')]][_0x92d2('0xb2')]]);_0x28eda5[_0x92d2('0x20')][_0x28eda5['actions'][_0xa81566[_0x92d2('0x127')]][_0x92d2('0x12a')]]['locked']=![];delete _0x28eda5[_0x92d2('0xab')][_0xa81566['actionid']];unlockQueueStatus(_0x2ced7a);});}else{this[_0x92d2('0xb4')](this[_0x92d2('0x1e')][this['actions'][_0xa81566[_0x92d2('0x127')]][_0x92d2('0xb2')]]);this[_0x92d2('0xc0')]({'active':![],'ContactId':this[_0x92d2('0xab')][_0xa81566[_0x92d2('0x127')]]['ContactId'],'ListId':this[_0x92d2('0xab')][_0xa81566[_0x92d2('0x127')]]['ListId'],'VoiceQueueId':this[_0x92d2('0xab')][_0xa81566[_0x92d2('0x127')]][_0x92d2('0xd4')]||undefined,'CampaignId':this[_0x92d2('0xab')][_0xa81566[_0x92d2('0x127')]]['CampaignId']||undefined})[_0x92d2('0xb0')](loggerCatch(_0x92d2('0x132')));delete this[_0x92d2('0xab')][_0xa81566['actionid']];unlockQueueStatus(_0x2ced7a);}}else if((strategy[this[_0x92d2('0x1e')][this[_0x92d2('0xab')][_0xa81566[_0x92d2('0x127')]][_0x92d2('0xb2')]]['strategy']]||'rrmemory')===_0x92d2('0x133')){var _0x21f1d5;if(this['actions'][_0xa81566['actionid']]&&!_['isEmpty'](this[_0x92d2('0x12b')][this[_0x92d2('0xab')][_0xa81566['actionid']][_0x92d2('0xb2')]])){if(this[_0x92d2('0x2a')][_0x28eda5[_0x92d2('0xab')][_0xa81566['actionid']][_0x92d2('0xb2')]]){this[_0x92d2('0x2a')][_0x28eda5[_0x92d2('0xab')][_0xa81566[_0x92d2('0x127')]][_0x92d2('0xb2')]]=this[_0x92d2('0x2a')][this[_0x92d2('0xab')][_0xa81566['actionid']][_0x92d2('0xb2')]]?this[_0x92d2('0x2a')][this['actions'][_0xa81566[_0x92d2('0x127')]][_0x92d2('0xb2')]]:this[_0x92d2('0x12b')][this[_0x92d2('0xab')][_0xa81566[_0x92d2('0x127')]][_0x92d2('0xb2')]]?this[_0x92d2('0x12b')][this['actions'][_0xa81566[_0x92d2('0x127')]][_0x92d2('0xb2')]]['_rr']||0x0:0x0;}this[_0x92d2('0x12b')][this[_0x92d2('0xab')][_0xa81566[_0x92d2('0x127')]][_0x92d2('0xb2')]][_0x92d2('0x134')]=this[_0x92d2('0x2a')][this['actions'][_0xa81566[_0x92d2('0x127')]]['queue']];for(var _0x905d05=0x0;_0x905d05=0x0;})[_0x92d2('0xb0')](myreject(_0x14d878)));}}else{_0x484635[_0x92d2('0x12c')](ami[_0x92d2('0xad')]({'action':'command','command':util[_0x92d2('0x76')](_0x92d2('0x14d'),_0x37087a,!_[_0x92d2('0x3a')](config[_0x92d2('0x149')][_0x554044])?_0x554044:'')})[_0x92d2('0xb7')](function(_0x54ef7a){return _0x54ef7a[_0x92d2('0x150')][_0x92d2('0x14f')](_0x92d2('0x151'))>=0x0;})['catch'](myreject(_0x14d878)));}BPromise[_0x92d2('0x152')](_0x484635)[_0x92d2('0xb7')](function(_0x3c3f53){var _0x4b350b=_[_0x92d2('0x153')](_0x3c3f53);if(_0x4b350b){return _0x4fd61a(_0x4b350b);}else{_0x8487e6[_0x92d2('0x3e')]=_0x4c3f9e?_0x92d2('0x154'):'INTERVAL_IS_OVERTIME';return _0x14d878(msgResponse(_0x92d2('0x155'),_0x92d2('0x146'),_0x92d2('0x156')+_0x4c3f9e+'\x20'+_0x36340b+_0x92d2('0x157')+util[_0x92d2('0x92')](_0x37087a,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x554044));}})[_0x92d2('0xb0')](function(_0x547b95){return _0x14d878(msgResponse(_0x92d2('0x144'),'Failure',JSON[_0x92d2('0x47')](_0x547b95)));});});};Dialer[_0x92d2('0x18')]['checkDialMethod']=function(_0x38e8ad){var _0x340205=this;return function(){switch(_0x38e8ad['dialMethod']){case'progressive':freeVariablesPredictive(_0x38e8ad);_0x340205[_0x92d2('0x158')](_0x38e8ad,0x1);break;case _0x92d2('0x159'):freeVariablesPredictive(_0x38e8ad);_0x340205[_0x92d2('0x158')](_0x38e8ad,_0x38e8ad['dialPowerLevel']);break;case'predictive':_0x340205[_0x92d2('0x8')](_0x38e8ad);break;case _0x92d2('0x7'):freeVariablesPredictive(_0x38e8ad);_0x340205['handlePower'](_0x38e8ad,0x1);break;default:freeVariablesPredictive(_0x38e8ad);logger[_0x92d2('0x91')](_0x92d2('0x15a'),_0x38e8ad[_0x92d2('0x3c')],_0x92d2('0x15b'));}};};Dialer[_0x92d2('0x18')]['launchHandleIvr']=function(_0x3f51fb){var _0x34536c=this;return function(){_0x34536c[_0x92d2('0x15c')](_0x3f51fb);};};Dialer[_0x92d2('0x18')][_0x92d2('0x31')]=function(_0x3b990d){var _0x357fee=this;if(isNotPreview(_0x3b990d[_0x92d2('0x57')])){if(isVoiceQueueOutbound(_0x3b990d['type'])&&isActive(_0x3b990d['dialActive'])){_0x3b990d[_0x92d2('0x9e')]=!![];BPromise['resolve']()[_0x92d2('0xb7')](checkIsLoggedIn(_0x3b990d,_0x3b990d[_0x92d2('0x4f')]))['then'](checkIsActive(_0x3b990d,_0x3b990d[_0x92d2('0x56')]))[_0x92d2('0xb7')](checkInterval(_0x3b990d))[_0x92d2('0xb7')](_0x357fee['checkIsTrunkReachable'](_0x3b990d))[_0x92d2('0xb7')](_0x357fee[_0x92d2('0x143')](_0x3b990d[_0x92d2('0x15d')],_0x3b990d['dialTimezone'],_0x3b990d[_0x92d2('0x3c')],_0x3b990d))[_0x92d2('0xb7')](_0x357fee['checkIfTimeIntervals'](_0x3b990d[_0x92d2('0x41')],_0x3b990d[_0x92d2('0x15e')],_0x3b990d[_0x92d2('0x3c')],_0x3b990d))['then'](_0x357fee[_0x92d2('0x15f')](_0x3b990d))['catch'](loggerCatchQueueSummary(_0x92d2('0x160'),_0x3b990d));}else{notSendMessagesQueue(_0x3b990d);}}else{freeVariablesPredictive(_0x3b990d);}};Dialer[_0x92d2('0x18')][_0x92d2('0x161')]=function(){var _0x417f84=this;var _0x23b1f9;for(var _0x28f246 in this['campaigns']){if(typeof this[_0x92d2('0x1f')][_0x28f246]!==_0x92d2('0x96')){_0x23b1f9=this[_0x92d2('0x1f')][_0x28f246];if(isCampaignIvr(_0x23b1f9['type'])&&isActive(_0x23b1f9['active'])){_0x23b1f9[_0x92d2('0x9e')]=!![];BPromise[_0x92d2('0xb6')]()[_0x92d2('0xb7')](checkIsActive(_0x23b1f9,_0x23b1f9[_0x92d2('0x72')]))['then'](checkInterval(_0x23b1f9))['then'](_0x417f84['checkIsTrunkReachable'](_0x23b1f9))[_0x92d2('0xb7')](_0x417f84['checkIfTime'](_0x23b1f9[_0x92d2('0x15d')],_0x23b1f9[_0x92d2('0x15e')],_0x23b1f9[_0x92d2('0x3c')],_0x23b1f9))[_0x92d2('0xb7')](_0x417f84[_0x92d2('0x145')](_0x23b1f9['Interval'],_0x23b1f9[_0x92d2('0x15e')],_0x23b1f9[_0x92d2('0x3c')],_0x23b1f9))[_0x92d2('0xb7')](_0x417f84['launchHandleIvr'](_0x23b1f9))[_0x92d2('0xb0')](loggerCatchQueueSummary(_0x92d2('0x162'),_0x23b1f9));}else{notSendMessagesCampaign(_0x23b1f9);}}}};function getCallerIdRandom(_0x8d1e77,_0x357c85){var _0x3ee422;var _0x4150ab;var _0x2642bb;if(_0x357c85<=0x0){_0x357c85=0x1;}_0x3ee422=new RegExp(_0x92d2('0x163')+_0x357c85+'}$');_0x4150ab=Math[_0x92d2('0x164')](0xa,_0x357c85-0x1);_0x2642bb=Math['pow'](0xa,_0x357c85)-0x1;return util[_0x92d2('0x76')]('%s',_['replace'](_0x8d1e77,_0x3ee422,_[_0x92d2('0x165')](_0x4150ab,_0x2642bb)));}function extractCalleridName(_0x263a02){var _0x2d7aae=_0x263a02['match'](/"(.*?)"/);return _0x2d7aae?_0x2d7aae[0x1]:_0x263a02;}function extractCalleridNumber(_0x44f530){var _0x12df96=_0x44f530[_0x92d2('0x166')](/<(.*?)>/);return _0x12df96?_0x12df96[0x1]:_0x44f530;}Dialer[_0x92d2('0x18')][_0x92d2('0x167')]=function(_0x26b804,_0x184425){var _0xf4b713=this;var _0x56ac97=uuid['v4']();this[_0x92d2('0xab')][_0x56ac97]=new Action(_0x26b804,_0x184425,_0x56ac97);return new BPromise(function(_0x3ae711,_0xc44188){if(_[_0x92d2('0x3a')](_0x26b804)&&typeof _0x26b804!==_0x92d2('0x168')){return _0xc44188(msgResponse('originate',_0x92d2('0x146'),'voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x184425[_0x92d2('0x169')]['phone'])||_0x184425[_0x92d2('0x169')][_0x92d2('0x16a')]===null){return _0xc44188(msgResponse(_0x92d2('0x16b'),_0x92d2('0x146'),_0x92d2('0x16c')));}var _0xde9e2d={'XMD-CALLERID':_0xf4b713[_0x92d2('0xab')][_0x56ac97]['getCaller'](),'XMD-AGI':_0x26b804[_0x92d2('0x108')]?util['format'](_0x92d2('0x16d'),ipAgi,_0x26b804['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x26b804[_0x92d2('0x11a')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x26b804[_0x92d2('0x11a')]):_0x92d2('0x16e'),'XMD-QUEUE':_0x26b804[_0x92d2('0x4a')]===_0x92d2('0x4b')?util['format'](_0x92d2('0x16f'),_0x26b804[_0x92d2('0x3c')],_0x26b804[_0x92d2('0x170')]||'',_0x26b804[_0x92d2('0x10f')]?'c':'',_0x26b804['dialQueueTimeout']||0x3):_0x92d2('0x16e'),'XMD-CONTACTID':_0x184425['ContactId'],'XMD-CDRTYPE':_0x92d2('0x171'),'CALLERID(all)':_0xf4b713[_0x92d2('0xab')][_0x56ac97]['getCaller'](),'XMD-AMD':_0x26b804[_0x92d2('0xe1')]?_0x92d2('0x172'):_0x92d2('0x16e'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x26b804[_0x92d2('0xe1')]){_0xde9e2d[_0x92d2('0x173')]=_0x26b804['dialAMDInitialSilence']||0x9c4;_0xde9e2d[_0x92d2('0x174')]=_0x26b804[_0x92d2('0x175')]||0x5dc;_0xde9e2d['XMD-AMDAFTERGREETINGSILENCE']=_0x26b804[_0x92d2('0x176')]||0x320;_0xde9e2d['XMD-AMDTOTALANALYSISTIME']=_0x26b804['dialAMDTotalAnalysisTime']||0x1388;_0xde9e2d['XMD-AMDMINWORDLENGTH']=_0x26b804[_0x92d2('0x177')]||0x64;_0xde9e2d['XMD-AMDBETWEENWORDSSILENCE']=_0x26b804[_0x92d2('0x178')]||0x32;_0xde9e2d[_0x92d2('0x179')]=_0x26b804[_0x92d2('0x17a')]||0x3;_0xde9e2d['XMD-AMDSILENCETHRESHOLD']=_0x26b804[_0x92d2('0x17b')]||0x100;_0xde9e2d[_0x92d2('0x17c')]=_0x26b804[_0x92d2('0x17d')]||0x1388;}if(_0x26b804[_0x92d2('0x4a')]===_0x92d2('0x4b')){_0xde9e2d['XMD-VOICEQUEUEID']=_0x184425['VoiceQueueId'];}else{_0xde9e2d[_0x92d2('0x17e')]=_0x184425[_0x92d2('0xd5')];}for(var _0x5daa65 in _0x184425['Contact']){if(typeof _0x184425[_0x92d2('0x169')][_0x5daa65]!==_0x92d2('0x96')){if(isNotNull(_0x184425[_0x92d2('0x169')][_0x5daa65])&&_0x5daa65!=='id'&&_0x5daa65!==_0x92d2('0x17f')&&_0x5daa65!=='createdAt'&&_0x5daa65!==_0x92d2('0x180')){_0xde9e2d[util[_0x92d2('0x76')](_0x92d2('0x181'),'XMD-',_[_0x92d2('0x182')](_0x5daa65))]=_0x184425['Contact'][_0x5daa65];}}}var _0x3de960=_0xf4b713[_0x92d2('0xd9')](_0x26b804[_0x92d2('0x71')])?getCallerId(_0x26b804['Trunk'][_0x92d2('0x73')],_0x26b804[_0x92d2('0x58')],_0x26b804[_0x92d2('0x183')]>0x0?getCallerIdRandom(_0x26b804['dialOriginateCallerIdNumber'],_0x26b804['dialRandomLastDigitCallerIdNumber']):_0x26b804[_0x92d2('0x184')]):getCallerId(_[_0x92d2('0xdc')](_0x26b804['TrunkBackup'])?_0x26b804[_0x92d2('0x71')][_0x92d2('0x73')]:_0x26b804[_0x92d2('0x140')]['callerid'],_0x26b804[_0x92d2('0x58')],_0x26b804[_0x92d2('0x183')]>0x0?getCallerIdRandom(_0x26b804['dialOriginateCallerIdNumber'],_0x26b804[_0x92d2('0x183')]):_0x26b804[_0x92d2('0x184')]);if(_0x3de960){_0xde9e2d[_0x92d2('0x185')]=_0xf4b713[_0x92d2('0xab')][_0x56ac97]['originatecalleridname']=extractCalleridName(_0x3de960);_0xde9e2d['XMD-ORIGINATECALLERIDNUM']=_0xf4b713[_0x92d2('0xab')][_0x56ac97][_0x92d2('0x186')]=extractCalleridNumber(_0x3de960);}return ami[_0x92d2('0xad')]({'actionid':_0x56ac97,'action':_0x92d2('0x16b'),'channel':_0xf4b713['isTrunkReachable'](_0x26b804[_0x92d2('0x71')])?util[_0x92d2('0x76')](_0x92d2('0x187'),_0x26b804[_0x92d2('0x71')]['name'],isNotNull(_0x26b804[_0x92d2('0x188')])?_0x26b804[_0x92d2('0x188')]['trim']()||'':'',_0x26b804['dialCutDigit']>0x0?_0x184425[_0x92d2('0x169')]['phone'][_0x92d2('0x189')](_0x26b804[_0x92d2('0x18a')]):_0x184425['Contact'][_0x92d2('0x16a')]):util[_0x92d2('0x76')]('SIP/%s/%s%s',_[_0x92d2('0xdc')](_0x26b804[_0x92d2('0x140')])?_0x26b804[_0x92d2('0x71')]['name']:_0x26b804['TrunkBackup'][_0x92d2('0x3c')],isNotNull(_0x26b804['dialPrefix'])?_0x26b804['dialPrefix']['trim']()||'':'',_0x26b804['dialCutDigit']>0x0?_0x184425[_0x92d2('0x169')][_0x92d2('0x16a')]['substring'](_0x26b804[_0x92d2('0x18a')]):_0x184425['Contact'][_0x92d2('0x16a')]),'callerid':_0x3de960,'Exten':_0x92d2('0xe0'),'Context':'from-sip','Priority':'1','variable':_0xde9e2d,'timeout':(_0x26b804[_0x92d2('0x59')]||0x1e)*0x3e8,'async':!![],'channelid':_0x56ac97})['then'](function(_0x5095a2){return _0x3ae711(_0x5095a2);})[_0x92d2('0xb0')](function(_0x2fd04a){_0x26b804[_0x92d2('0x61')]+=0x1;var _0x5c2b49=new History(_0xf4b713[_0x92d2('0xab')][_0x56ac97]);logger[_0x92d2('0x91')](util[_0x92d2('0x76')]('[originateError]:\x20%s',JSON['stringify'](_0x2fd04a)));_0x5c2b49[_0x92d2('0xa4')]=0xe;_0x5c2b49[_0x92d2('0xa5')]=_0x92d2('0x18b');_0x5c2b49[_0x92d2('0xa7')]=moment()[_0x92d2('0x76')]('YYYY-MM-DD\x20HH:mm:ss');_0x5c2b49[_0x92d2('0xa6')]=_0x5c2b49[_0x92d2('0xa7')];_0xf4b713[_0x92d2('0xcb')](_0x5c2b49)[_0x92d2('0xb0')](loggerCatch(_0x92d2('0x18c')));_0xf4b713[_0x92d2('0xc9')](_0x5c2b49)['catch'](loggerCatch(_0x92d2('0x18c')))['finally'](function(){delete _0xf4b713[_0x92d2('0xab')][_0x56ac97];return _0xc44188(msgResponse('originate',_0x92d2('0x18d'),_0x92d2('0x18e')));});});});};Dialer[_0x92d2('0x18')]['syncOriginateResponse']=function(_0x161ad4){var _0x787da0=this['actions'][_0x161ad4[_0x92d2('0x127')]];if(_0x787da0){delete this[_0x92d2('0xab')][_0x161ad4['actionid']];_0x787da0[_0x92d2('0x115')]=moment()['format'](_0x92d2('0x104'));var _0x3e01d0=_0x787da0[_0x92d2('0x4a')]===_0x92d2('0x8d')?this[_0x92d2('0x1f')][_0x787da0[_0x92d2('0xb2')]]:this[_0x92d2('0x1e')][_0x787da0[_0x92d2('0x18f')]()];if(!this[_0x92d2('0xd8')](_0x161ad4[_0x92d2('0x190')])){this[_0x92d2('0xb4')](_0x3e01d0);return this[_0x92d2('0x191')](_0x787da0,_0x3e01d0,_0x161ad4)['catch'](loggerCatch(_0x92d2('0x192')));}this['uniqueId'][_0x161ad4[_0x92d2('0xdb')]]=_0x787da0;}};Dialer['prototype']['checkRetriveMax']=function(_0x27bbb5,_0x313caf,_0x42eb5b){var _0x16fe25=new History(_0x313caf);if(_0x16fe25[_0x92d2('0xfe')]+_0x16fe25[_0x92d2('0xf1')]+_0x16fe25[_0x92d2('0xff')]+_0x16fe25[_0x92d2('0x100')]+_0x16fe25[_0x92d2('0xf2')]+_0x16fe25['countabandonedretry']+_0x16fe25['countmachineretry']+_0x16fe25[_0x92d2('0xf4')]>=_0x42eb5b[_0x92d2('0x193')]-0x1){return!![];}switch(_0x27bbb5){case 0x3:if(_0x16fe25['countnoanswerretry']>=_0x42eb5b[_0x92d2('0x194')]-0x1){return!![];}this[_0x92d2('0xc0')]({'active':![],'countnoanswerretry':_0x16fe25[_0x92d2('0xff')]+=0x1,'scheduledat':moment()[_0x92d2('0xf7')](_0x42eb5b['dialNoAnswerRetryFrequency'],_0x92d2('0xf9'))[_0x92d2('0x76')](_0x92d2('0x104')),'ContactId':_0x16fe25[_0x92d2('0xd1')],'ListId':_0x16fe25['ListId'],'VoiceQueueId':_0x16fe25[_0x92d2('0xd4')]||undefined,'CampaignId':_0x16fe25[_0x92d2('0xd5')]||undefined})[_0x92d2('0xb0')](loggerCatch(_0x92d2('0x195')));break;case 0x5:if(_0x16fe25[_0x92d2('0xfe')]>=_0x42eb5b[_0x92d2('0x196')]-0x1){return!![];}this[_0x92d2('0xc0')]({'active':![],'countbusyretry':_0x16fe25[_0x92d2('0xfe')]+=0x1,'scheduledat':moment()[_0x92d2('0xf7')](_0x42eb5b[_0x92d2('0x197')],_0x92d2('0xf9'))[_0x92d2('0x76')](_0x92d2('0x104')),'ContactId':_0x16fe25[_0x92d2('0xd1')],'ListId':_0x16fe25[_0x92d2('0xd2')],'VoiceQueueId':_0x16fe25[_0x92d2('0xd4')]||undefined,'CampaignId':_0x16fe25[_0x92d2('0xd5')]||undefined})[_0x92d2('0xb0')](loggerCatch(_0x92d2('0x198')));break;case 0x8:if(_0x16fe25[_0x92d2('0xf1')]>=_0x42eb5b[_0x92d2('0x199')]-0x1){return!![];}this[_0x92d2('0xc0')]({'active':![],'countcongestionretry':_0x16fe25[_0x92d2('0xf1')]+=0x1,'scheduledat':moment()[_0x92d2('0xf7')](_0x42eb5b[_0x92d2('0x19a')],_0x92d2('0xf9'))['format'](_0x92d2('0x104')),'ContactId':_0x16fe25[_0x92d2('0xd1')],'ListId':_0x16fe25[_0x92d2('0xd2')],'VoiceQueueId':_0x16fe25[_0x92d2('0xd4')]||undefined,'CampaignId':_0x16fe25[_0x92d2('0xd5')]||undefined})[_0x92d2('0xb0')](loggerCatch(_0x92d2('0x19b')));break;case 0x0:if(_0x16fe25['countnosuchnumberretry']>=_0x42eb5b['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x92d2('0xc0')]({'active':![],'countnosuchnumberretry':_0x16fe25[_0x92d2('0x100')]+=0x1,'scheduledat':moment()['add'](_0x42eb5b['dialNoSuchNumberRetryFrequency'],'minutes')[_0x92d2('0x76')](_0x92d2('0x104')),'ContactId':_0x16fe25[_0x92d2('0xd1')],'ListId':_0x16fe25[_0x92d2('0xd2')],'VoiceQueueId':_0x16fe25[_0x92d2('0xd4')]||undefined,'CampaignId':_0x16fe25[_0x92d2('0xd5')]||undefined})[_0x92d2('0xb0')](loggerCatch(_0x92d2('0x19c')));}break;case 0xa:if(_0x16fe25[_0x92d2('0xf2')]>=_0x42eb5b[_0x92d2('0x11b')]-0x1){return!![];}this[_0x92d2('0xc0')]({'active':![],'countdropretry':_0x16fe25[_0x92d2('0xf2')]+=0x1,'scheduledat':moment()[_0x92d2('0xf7')](_0x42eb5b[_0x92d2('0x11c')],_0x92d2('0xf9'))[_0x92d2('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x16fe25[_0x92d2('0xd1')],'ListId':_0x16fe25[_0x92d2('0xd2')],'VoiceQueueId':_0x16fe25[_0x92d2('0xd4')]||undefined,'CampaignId':_0x16fe25[_0x92d2('0xd5')]||undefined})[_0x92d2('0xb0')](loggerCatch(_0x92d2('0x11d')));break;case 0xb:if(_0x16fe25[_0x92d2('0xf3')]>=_0x42eb5b[_0x92d2('0x123')]-0x1){return!![];}this[_0x92d2('0xc0')]({'active':![],'countabandonedretry':_0x16fe25['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x42eb5b[_0x92d2('0x124')],_0x92d2('0xf9'))[_0x92d2('0x76')](_0x92d2('0x104')),'ContactId':_0x16fe25[_0x92d2('0xd1')],'ListId':_0x16fe25[_0x92d2('0xd2')],'VoiceQueueId':_0x16fe25[_0x92d2('0xd4')]||undefined,'CampaignId':_0x16fe25[_0x92d2('0xd5')]||undefined})['catch'](loggerCatch(_0x92d2('0x19d')));break;case 0x13:if(_0x16fe25[_0x92d2('0xef')]>=_0x42eb5b[_0x92d2('0xf5')]-0x1){return!![];}this[_0x92d2('0xc0')]({'active':![],'countmachineretry':_0x16fe25[_0x92d2('0xef')]+=0x1,'scheduledat':moment()[_0x92d2('0xf7')](_0x42eb5b[_0x92d2('0xf8')],_0x92d2('0xf9'))[_0x92d2('0x76')](_0x92d2('0x104')),'ContactId':_0x16fe25[_0x92d2('0xd1')],'ListId':_0x16fe25[_0x92d2('0xd2')],'VoiceQueueId':_0x16fe25[_0x92d2('0xd4')]||undefined,'CampaignId':_0x16fe25[_0x92d2('0xd5')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x16fe25[_0x92d2('0xf4')]>=_0x42eb5b[_0x92d2('0x19e')]-0x1){return!![];}this[_0x92d2('0xc0')]({'active':![],'countagentrejectretry':_0x16fe25['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0x42eb5b[_0x92d2('0x19f')],_0x92d2('0xf9'))[_0x92d2('0x76')](_0x92d2('0x104')),'ContactId':_0x16fe25[_0x92d2('0xd1')],'ListId':_0x16fe25[_0x92d2('0xd2')],'VoiceQueueId':_0x16fe25[_0x92d2('0xd4')]||undefined,'CampaignId':_0x16fe25[_0x92d2('0xd5')]||undefined})[_0x92d2('0xb0')](loggerCatch(_0x92d2('0x1a0')));break;default:return!![];}};Dialer[_0x92d2('0x18')][_0x92d2('0x191')]=function(_0x178247,_0x49a38d,_0x414d03){var _0x2a4d22=this;var _0x1c2719=new History(_0x178247);return new BPromise(function(_0x3844fe,_0x25afbb){if(_[_0x92d2('0x3a')](_0x49a38d)&&typeof _0x49a38d!==_0x92d2('0x168')){return _0x25afbb(msgResponse(_0x92d2('0x1a1'),_0x92d2('0x146'),_0x92d2('0x1a2')));}if(_[_0x92d2('0x3a')](_0x414d03)&&typeof _0x414d03!=='object'){return _0x25afbb(msgResponse(_0x92d2('0x1a1'),'Failure',_0x92d2('0x1a3')));}switch(_0x414d03['reason']){case'0':_0x49a38d['outboundNoSuchCallsDay']+=0x1;_0x1c2719['state']=0x0;_0x1c2719[_0x92d2('0xa5')]=_0x92d2('0x1a4');_0x1c2719[_0x92d2('0x100')]+=0x1;_0x1c2719['countglobal']+=0x1;ami[_0x92d2('0xe7')]('custom:agentnosuchnumber',ut['buildObj'](_0x178247,'nosuchnumber'));_0x2a4d22[_0x92d2('0xcb')](_0x1c2719)[_0x92d2('0xb0')](loggerCatch(_0x92d2('0xfd')));if(_0x2a4d22['checkRetriveMax'](0x0,_0x178247,_0x49a38d)){if(_0x1c2719[_0x92d2('0x100')]>=_0x49a38d['dialNoSuchNumberMaxRetry']){_0x2a4d22[_0x92d2('0xf6')](_0x1c2719,_0x3844fe,_0x25afbb,_0x92d2('0x1a5'));}else{_0x2a4d22[_0x92d2('0x101')](_0x1c2719,_0x3844fe,_0x25afbb,_0x92d2('0x1a5'));}}break;case'3':_0x49a38d[_0x92d2('0x5f')]+=0x1;_0x1c2719[_0x92d2('0xa4')]=0x3;_0x1c2719[_0x92d2('0xa5')]='NoAnswer';_0x1c2719[_0x92d2('0xff')]+=0x1;_0x1c2719[_0x92d2('0xf0')]+=0x1;ami[_0x92d2('0xe7')]('custom:agentnoanswer',ut[_0x92d2('0xe9')](_0x178247,'noanswer'));_0x2a4d22['createHistory'](_0x1c2719)[_0x92d2('0xb0')](loggerCatch(_0x92d2('0x1a6')));if(_0x2a4d22['checkRetriveMax'](0x3,_0x178247,_0x49a38d)){if(_0x1c2719[_0x92d2('0xff')]>=_0x49a38d['dialNoAnswerMaxRetry']){_0x2a4d22[_0x92d2('0xf6')](_0x1c2719,_0x3844fe,_0x25afbb,_0x92d2('0x1a7'));}else{_0x2a4d22['stateGlobal'](_0x1c2719,_0x3844fe,_0x25afbb,_0x92d2('0x1a7'));}}break;case'5':_0x49a38d[_0x92d2('0x5b')]+=0x1;_0x1c2719['state']=0x5;_0x1c2719[_0x92d2('0xa5')]=_0x92d2('0x1a8');_0x1c2719[_0x92d2('0xfe')]+=0x1;_0x1c2719[_0x92d2('0xf0')]+=0x1;ami[_0x92d2('0xe7')](_0x92d2('0x1a9'),ut['buildObj'](_0x178247,'busy'));_0x2a4d22['createHistory'](_0x1c2719)[_0x92d2('0xb0')](loggerCatch(_0x92d2('0x1aa')));if(_0x2a4d22[_0x92d2('0x1ab')](0x5,_0x178247,_0x49a38d)){if(_0x1c2719[_0x92d2('0xfe')]>=_0x49a38d[_0x92d2('0x196')]){_0x2a4d22[_0x92d2('0xf6')](_0x1c2719,_0x3844fe,_0x25afbb,'reason\x205\x20busy');}else{_0x2a4d22['stateGlobal'](_0x1c2719,_0x3844fe,_0x25afbb,_0x92d2('0x1ac'));}}break;case'8':_0x49a38d[_0x92d2('0x5c')]+=0x1;_0x1c2719[_0x92d2('0xa4')]=0x8;_0x1c2719['statedesc']='Congestion';_0x1c2719[_0x92d2('0xf1')]+=0x1;_0x1c2719[_0x92d2('0xf0')]+=0x1;ami['emit'](_0x92d2('0x1ad'),ut[_0x92d2('0xe9')](_0x178247,'congestion'));_0x2a4d22[_0x92d2('0xcb')](_0x1c2719)[_0x92d2('0xb0')](loggerCatch(_0x92d2('0x1ae')));if(_0x2a4d22[_0x92d2('0x1ab')](0x8,_0x178247,_0x49a38d)){if(_0x1c2719['countcongestionretry']>=_0x49a38d[_0x92d2('0x199')]){_0x2a4d22['createStateFinal'](_0x1c2719,_0x3844fe,_0x25afbb,_0x92d2('0x1af'));}else{_0x2a4d22['stateGlobal'](_0x1c2719,_0x3844fe,_0x25afbb,'reason\x208\x20congestion');}}break;case'11':_0x49a38d['outboundAbandonedCallsDay']+=0x1;_0x1c2719[_0x92d2('0xa4')]=0xb;_0x1c2719[_0x92d2('0xa5')]='Abandoned';_0x1c2719['countabandonedretry']+=0x1;_0x1c2719['countglobal']+=0x1;_0x2a4d22['createHistory'](_0x1c2719)[_0x92d2('0xb0')](loggerCatch(_0x92d2('0x125')));if(_0x2a4d22[_0x92d2('0x1ab')](0xb,_0x178247,_0x49a38d)){if(_0x1c2719['countabandonedretry']>=_0x49a38d['dialAbandonedMaxRetry']){_0x2a4d22[_0x92d2('0xf6')](_0x1c2719,_0x3844fe,_0x25afbb,'reason\x2011\x20abandoned');}else{_0x2a4d22['stateGlobal'](_0x1c2719,_0x3844fe,_0x25afbb,'reason\x2011\x20abandoned');}}break;case'20':_0x49a38d['outboundRejectCallsDay']+=0x1;_0x1c2719[_0x92d2('0xa4')]=0x14;_0x1c2719[_0x92d2('0xa5')]=_0x92d2('0x1b0');_0x1c2719['countagentrejectretry']+=0x1;_0x1c2719[_0x92d2('0xf0')]+=0x1;ami[_0x92d2('0xe7')]('custom:agentreject',ut[_0x92d2('0xe9')](_0x178247,_0x92d2('0x1b1')));_0x2a4d22[_0x92d2('0xcb')](_0x1c2719)[_0x92d2('0xb0')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x2a4d22[_0x92d2('0x1ab')](0x14,_0x178247,_0x49a38d)){if(_0x1c2719['countagentrejectretry']>=_0x49a38d[_0x92d2('0x19e')]){_0x2a4d22['createStateFinal'](_0x1c2719,_0x3844fe,_0x25afbb,'reason\x2020\x20agentreject');}else{_0x2a4d22[_0x92d2('0x101')](_0x1c2719,_0x3844fe,_0x25afbb,'reason\x2020\x20agentreject');}}break;default:_0x49a38d['outboundUnknownCallsDay']+=0x1;_0x1c2719['state']=0xc;_0x1c2719[_0x92d2('0xa5')]=_0x414d03['reason'];_0x2a4d22[_0x92d2('0xcb')](_0x1c2719)[_0x92d2('0xb0')](loggerCatch(_0x92d2('0x1b2')));if(_0x2a4d22[_0x92d2('0x1ab')](_0x414d03[_0x92d2('0x10c')],_0x178247,_0x49a38d)){if(_0x1c2719[_0x92d2('0xfe')]+_0x1c2719['countcongestionretry']+_0x1c2719['countnoanswerretry']+_0x1c2719[_0x92d2('0x100')]+_0x1c2719[_0x92d2('0xf2')]+_0x1c2719[_0x92d2('0xf3')]+_0x1c2719['countmachineretry']+_0x1c2719[_0x92d2('0xf4')]>=_0x49a38d[_0x92d2('0x193')]){_0x2a4d22[_0x92d2('0x101')](_0x1c2719,_0x3844fe,_0x25afbb,_0x414d03[_0x92d2('0x10c')]);}else{_0x2a4d22[_0x92d2('0xf6')](_0x1c2719,_0x3844fe,_0x25afbb,_0x414d03[_0x92d2('0x10c')]);}}}});};Dialer[_0x92d2('0x18')][_0x92d2('0x101')]=function(_0x40139f,_0x3991ae,_0x206dee,_0x83b5a1){var _0x511238=new Final(_0x40139f);_0x511238['state']=0xf;_0x511238[_0x92d2('0xa5')]='Global';this[_0x92d2('0xf6')](_0x511238,_0x3991ae,_0x206dee,_0x83b5a1);};Dialer[_0x92d2('0x18')][_0x92d2('0xf6')]=function(_0x4a5e8f,_0x7d9ab,_0x36df6b,_0x5efe02){this[_0x92d2('0xc9')](_0x4a5e8f)[_0x92d2('0xb7')](function(){return _0x7d9ab(msgResponse('[callProgressDetecting]',_0x92d2('0x1b3'),_0x5efe02));})[_0x92d2('0xb0')](function(){return _0x36df6b(msgResponse('[moveContactManagedDialer][0]',_0x92d2('0x146'),_0x92d2('0x1b4')));});};Dialer[_0x92d2('0x18')]['predictive']=function(_0x49c3f1){var _0x2fd40d=_0x49c3f1['dialPredictiveOptimizationPercentage']/0x64;var _0x4ee76d=_0x49c3f1['outboundDropCallsDayTimeout']/(_0x49c3f1[_0x92d2('0x116')]+_0x49c3f1[_0x92d2('0xed')]);var _0x40f24f=Math[_0x92d2('0x1b5')](_0x49c3f1[_0x92d2('0x1b6')]*(_0x49c3f1[_0x92d2('0x1b7')]/0x64));var _0x4505d3=Math[_0x92d2('0x1b5')](_0x49c3f1['predictiveIntervalAvailable']*(_0x49c3f1[_0x92d2('0x1b8')]/0x64));var _0xfecda0=_0x49c3f1[_0x92d2('0x4e')]+_0x49c3f1[_0x92d2('0x9f')];var _0x4674f0=Math['floor'](_0x49c3f1[_0x92d2('0x6d')]*_0x49c3f1['erlangAbandonmentRate']*_0x49c3f1[_0x92d2('0x6a')]*_0x49c3f1[_0x92d2('0x6b')]);if(_[_0x92d2('0x3a')](_0x49c3f1[_0x92d2('0x28')])){if(!_[_0x92d2('0x3a')](_0x49c3f1[_0x92d2('0x27')])){_0x49c3f1['startPredictive']=undefined;loggerPredictive[_0x92d2('0x91')](_0x92d2('0x1b9'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x92d2('0x3a')](_0x49c3f1['handlePredictive'])){loggerPredictive[_0x92d2('0x91')](_0x92d2('0x1b9'),_0x92d2('0x1ba'));clearInterval(_0x49c3f1[_0x92d2('0x8b')]);_0x49c3f1[_0x92d2('0x8b')]=undefined;}_0x49c3f1[_0x92d2('0x28')]=moment()[_0x92d2('0x76')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x92d2('0x78')](_0x49c3f1[_0x92d2('0x3c')],_0x92d2('0x1bb'),_0x49c3f1['startProgressive']);this[_0x92d2('0x158')](_0x49c3f1,0x1);}else if(ifInterval(_0x49c3f1[_0x92d2('0x1bc')],_0x49c3f1[_0x92d2('0x28')])){this[_0x92d2('0x158')](_0x49c3f1,0x1);loggerPredictiveCalls[_0x92d2('0x78')]('[startMethodPredictive][StartProgressive][Loop]',_0x49c3f1[_0x92d2('0x28')],_0x49c3f1[_0x92d2('0x3c')]);_0x49c3f1[_0x92d2('0x6d')]=0x0;_0x49c3f1[_0x92d2('0x69')]=0x0;}else if(_0x2fd40d<_0x4ee76d&&_0x49c3f1['dialPredictiveOptimization']===_0x92d2('0x1bd')){freeVariablesPredictive(_0x49c3f1);loggerPredictive[_0x92d2('0x78')](_0x92d2('0x1be'),_0x92d2('0x1bf'),_0x4ee76d,_0x92d2('0x28'),_0x49c3f1['name']);}else if(_0x4674f0<_0x49c3f1[_0x92d2('0x69')]&&_0x49c3f1['dialPredictiveOptimization']===_0x92d2('0x1bd')){freeVariablesPredictive(_0x49c3f1);loggerPredictive[_0x92d2('0x78')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x4674f0,_0x92d2('0x1c0'),_0x49c3f1[_0x92d2('0x69')],_0x92d2('0x28'),_0x49c3f1[_0x92d2('0x3c')]);}else if(!ifInterval(_0x49c3f1[_0x92d2('0x1bc')],_0x49c3f1[_0x92d2('0x28')])&&_[_0x92d2('0x3a')](_0x49c3f1[_0x92d2('0x27')])&&!_['isUndefined'](_0x49c3f1[_0x92d2('0x28')])){_0x49c3f1['startPredictive']=moment()[_0x92d2('0x76')](_0x92d2('0x104'));loggerPredictive[_0x92d2('0x78')](_0x49c3f1['name'],_0x92d2('0x1c1'),_0x49c3f1[_0x92d2('0x27')]);this[_0x92d2('0xbe')](_0x49c3f1[_0x92d2('0x1bc')])[_0x92d2('0xb7')](this[_0x92d2('0x1c2')](_0x49c3f1))[_0x92d2('0xb7')](mergeDataErlangB(_0x49c3f1))[_0x92d2('0xb7')](this[_0x92d2('0x1c3')](_0x49c3f1))[_0x92d2('0xb0')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x49c3f1));}else if(!ifInterval(_0x49c3f1[_0x92d2('0x1bc')],_0x49c3f1[_0x92d2('0x27')])){_0x49c3f1[_0x92d2('0x69')]=0x0;_0x49c3f1['startPredictive']=moment()[_0x92d2('0x76')](_0x92d2('0x104'));loggerPredictive[_0x92d2('0x78')](_0x49c3f1[_0x92d2('0x3c')],_0x92d2('0x1c4'),_0x49c3f1['startPredictive']);clearInterval(_0x49c3f1[_0x92d2('0x8b')]);_0x49c3f1[_0x92d2('0x8b')]=undefined;this[_0x92d2('0xbe')](_0x49c3f1['dialPredictiveInterval'])['then'](this['getDataPredictive'](_0x49c3f1))[_0x92d2('0xb7')](mergeDataErlangB(_0x49c3f1))[_0x92d2('0xb7')](this[_0x92d2('0x1c3')](_0x49c3f1))[_0x92d2('0xb0')](loggerCatchPredictive(_0x92d2('0x1c5'),_0x49c3f1));}else if(_0x49c3f1[_0x92d2('0x1b6')]&&_0xfecda0<_0x49c3f1[_0x92d2('0x1b6')]-_0x4505d3){freeVariablesPredictive(_0x49c3f1);loggerPredictive[_0x92d2('0x78')](_0x49c3f1[_0x92d2('0x3c')],_0x92d2('0x1c6'),_0xfecda0,')\x20are\x20less\x20than\x20threshold\x20(',_0x49c3f1['predictiveIntervalAvailable'],'-',_0x4505d3,'=',_0x49c3f1[_0x92d2('0x1b6')]-_0x4505d3,')');}else if(_0x49c3f1['predictiveIntervalAvailable']&&_0xfecda0>_0x49c3f1['predictiveIntervalAvailable']+_0x40f24f){freeVariablesPredictive(_0x49c3f1);loggerPredictive['info'](_0x49c3f1['name'],_0x92d2('0x1c6'),_0xfecda0,')\x20are\x20more\x20than\x20threshold\x20(',_0x49c3f1[_0x92d2('0x1b6')],'+',_0x40f24f,'=',_0x49c3f1[_0x92d2('0x1b6')]+_0x40f24f,')');}};Dialer[_0x92d2('0x18')][_0x92d2('0x1c2')]=function(_0x5882a4){var _0x1b16b7=this;return function(_0x51568d){return new BPromise(function(_0x43cb04,_0x13b5af){_[_0x92d2('0x88')](_0x5882a4,_0x51568d[0x0]);if(checkGetDataPredictive(_0x51568d[0x0])){var _0x2ff3e1=_0x5882a4[_0x92d2('0x1b6')]=_0x5882a4[_0x92d2('0x9f')]+_0x5882a4[_0x92d2('0x4e')];var _0x3f716c=_0x5882a4[_0x92d2('0x1bc')]*0x3c;var _0x1d0cbd=_0x51568d[0x0][_0x92d2('0x66')]+_0x51568d[0x0][_0x92d2('0x65')];var _0x335981=(_0x51568d[0x0][_0x92d2('0x64')]+_0x51568d[0x0][_0x92d2('0x7e')]+_0x51568d[0x0][_0x92d2('0x67')])/_0x51568d[0x0]['predictiveIntervalTotalCalls'];_0x5882a4[_0x92d2('0x6a')]=_0x335981>0x0?_0x335981:0x1;switch(_0x5882a4[_0x92d2('0x1c7')]){case'dropRate':var _0x4ee0f1=_0x5882a4[_0x92d2('0x1c8')]/0x64;return _0x1b16b7[_0x92d2('0x1c9')](_0x2ff3e1,_0x3f716c,_0x1d0cbd,_0x335981,_0x4ee0f1)[_0x92d2('0xb7')](function(_0x505de0){return _0x43cb04(_0x505de0);});case _0x92d2('0x1ca'):var _0x47a60b=_0x5882a4[_0x92d2('0x1c8')]/0x64;return _0x1b16b7[_0x92d2('0x1cb')](_0x2ff3e1,_0x3f716c,_0x1d0cbd,_0x335981,_0x47a60b)[_0x92d2('0xb7')](function(_0x17b170){return _0x43cb04(_0x17b170);});default:return _0x13b5af(msgResponse(_0x92d2('0x1cc'),_0x92d2('0x146'),_0x92d2('0x1cd')));}}else{return _0x13b5af(msgResponse(_0x92d2('0x1cc'),_0x92d2('0x146'),_0x92d2('0x1ce')));}});};};Dialer[_0x92d2('0x18')][_0x92d2('0x1cf')]=function(_0x584ff6){var _0x27dcfe=this;return function(_0x23353f){return new BPromise(function(_0x5ebcf8,_0x36b6d9){_[_0x92d2('0x88')](_0x584ff6,_0x23353f[0x0]);if(checkGetDataPredictive(_0x23353f[0x0])){loggerPredictive['info'](JSON[_0x92d2('0x47')](_0x23353f[0x0]));if(_0x584ff6['dialPredictiveOptimization']===_0x92d2('0x1bd')){return _0x27dcfe[_0x92d2('0xc8')](_0x584ff6['id'])[_0x92d2('0xb7')](function(_0x5e164f){var _0x4d87fb=_0x584ff6[_0x92d2('0x4f')]-_0x5e164f[0x0][_0x92d2('0x1d0')];var _0x4086c4=_0x584ff6[_0x92d2('0x1bc')]*0x3c;var _0x374074=_0x23353f[0x0][_0x92d2('0x66')]+_0x23353f[0x0]['predictiveIntervalAvgHoldtime'];var _0x209538=(_0x23353f[0x0][_0x92d2('0x64')]+_0x23353f[0x0][_0x92d2('0x7e')]+_0x23353f[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x23353f[0x0]['predictiveIntervalTotalCalls'];var _0x1d2f6f=_0x584ff6[_0x92d2('0x1c8')]/0x64;_0x584ff6[_0x92d2('0x6c')]=_0x5e164f[0x0][_0x92d2('0x1d0')]||0x0;_0x584ff6['predictiveIntervalHitRate']=_0x209538>0x0?_0x209538:0x1;return _0x27dcfe[_0x92d2('0x1c9')](_0x4d87fb,_0x4086c4,_0x374074,_0x209538,_0x1d2f6f);})['then'](function(_0x25821f){return _0x5ebcf8(_0x25821f);})[_0x92d2('0xb0')](function(_0x9a63ef){return _0x36b6d9(msgResponse(_0x92d2('0x1d1'),_0x92d2('0x146'),JSON[_0x92d2('0x47')](_0x9a63ef)));});}if(_0x584ff6[_0x92d2('0x1c7')]==='agentBusyFactor'){return _0x27dcfe[_0x92d2('0xc8')](_0x584ff6['id'])[_0x92d2('0xb7')](function(_0x56a551){var _0x311a97=_0x584ff6['loggedIn']-_0x56a551[0x0][_0x92d2('0x1d0')];var _0x5d2957=_0x584ff6[_0x92d2('0x1bc')]*0x3c;var _0x128894=_0x23353f[0x0]['predictiveIntervalAvgTalktime']+_0x23353f[0x0][_0x92d2('0x65')];var _0xc41422=(_0x23353f[0x0]['predictiveIntervalAnsweredCalls']+_0x23353f[0x0][_0x92d2('0x7e')]+_0x23353f[0x0][_0x92d2('0x67')])/_0x23353f[0x0][_0x92d2('0x7b')];var _0x3cda7d=_0x584ff6[_0x92d2('0x1c8')]/0x64;_0x584ff6['predictiveIntervalPauses']=_0x56a551[0x0]['outboundQueuePauses']||0x0;_0x584ff6[_0x92d2('0x6a')]=_0xc41422>0x0?_0xc41422:0x1;return _0x27dcfe[_0x92d2('0x1cb')](_0x311a97,_0x5d2957,_0x128894,_0xc41422,_0x3cda7d);})[_0x92d2('0xb7')](function(_0x304dcc){return _0x5ebcf8(_0x304dcc);})[_0x92d2('0xb0')](function(_0x5275f9){return _0x36b6d9(msgResponse(_0x92d2('0x1d1'),'Failure',JSON['stringify'](_0x5275f9)));});}}else{return _0x36b6d9(msgResponse(_0x92d2('0x1cc'),_0x92d2('0x146'),_0x92d2('0x1ce')));}});};};Dialer[_0x92d2('0x18')]['startMethodPredictive']=function(_0xd685ce){var _0xe77b71=this;return function(){var _0x302793=0x0;var _0x41133f=Math[_0x92d2('0x1d2')](_0xd685ce[_0x92d2('0x6e')]*0x3e8);if(_0x41133f>0x0){_0x41133f=_0x41133f<0x64?0x64:_0x41133f;loggerPredictive[_0x92d2('0x78')](_0xd685ce[_0x92d2('0x3c')],_0x92d2('0x1d3'),_0x41133f,_0x92d2('0x48'));_0xd685ce[_0x92d2('0x8b')]=setInterval(function(){_0xe77b71['handlePredictive'](_0xd685ce);loggerPredictiveCalls[_0x92d2('0x78')](_0x92d2('0x1d4'),_0x302793+=0x1);},_0x41133f);}else{loggerPredictive[_0x92d2('0x78')](_0xd685ce[_0x92d2('0x3c')],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype']['checkContactBlack']=function(_0x1ca1ce,_0x2f3305){var _0x164e2a=this;return function(_0x48e69a){if(_['isEmpty'](_0x48e69a)){if(_[_0x92d2('0xdc')](_0x2f3305[_0x92d2('0xd3')])||!_0x2f3305['recallme']){if(_0x1ca1ce['dialMethod']===_0x92d2('0x7')){_0x1ca1ce[_0x92d2('0x12e')]=_[_0x92d2('0x3a')](_0x1ca1ce[_0x92d2('0x12e')])?!![]:_0x1ca1ce[_0x92d2('0x12e')];var _0x1579d5=uuid['v4']();_0x164e2a[_0x92d2('0xab')][_0x1579d5]=new Action(_0x1ca1ce,_0x2f3305,_0x1579d5);loggerBooked[_0x92d2('0x78')](_0x92d2('0x1d5'),_0x1579d5,_0x92d2('0x1d6'),JSON[_0x92d2('0x47')](_0x1ca1ce[_0x92d2('0x12e')]),_0x92d2('0x1d7'),_0x1ca1ce['name']);if(_0x1ca1ce[_0x92d2('0x12e')]){_0x1ca1ce['queueStatusComplete']=![];_0x164e2a[_0x92d2('0x12b')][_0x164e2a['actions'][_0x1579d5][_0x92d2('0xb2')]]=[];ami[_0x92d2('0xad')]({'actionid':_0x1579d5,'action':_0x92d2('0x1d8'),'queue':_0x1ca1ce[_0x92d2('0x3c')]})[_0x92d2('0xb0')](function(){_0x164e2a['updateOriginated'](_0x1ca1ce);_0x164e2a[_0x92d2('0xc0')]({'active':![],'ContactId':_0x164e2a[_0x92d2('0xab')][_0x1579d5][_0x92d2('0xd1')],'ListId':_0x164e2a[_0x92d2('0xab')][_0x1579d5][_0x92d2('0xd2')],'VoiceQueueId':_0x164e2a['actions'][_0x1579d5][_0x92d2('0xd4')]||undefined,'CampaignId':_0x164e2a[_0x92d2('0xab')][_0x1579d5][_0x92d2('0xd5')]||undefined})[_0x92d2('0xb0')](loggerCatch(_0x92d2('0x1d9')));delete _0x164e2a[_0x92d2('0xab')][_0x1579d5];});}else{loggerBooked[_0x92d2('0x78')](_0x92d2('0x1da'),JSON[_0x92d2('0x47')](_0x1ca1ce[_0x92d2('0x12e')]),_0x92d2('0x1d7'),_0x1ca1ce[_0x92d2('0x3c')]);_0x164e2a[_0x92d2('0xb4')](_0x1ca1ce);_0x164e2a[_0x92d2('0xc0')]({'active':![],'ContactId':_0x164e2a['actions'][_0x1579d5][_0x92d2('0xd1')],'ListId':_0x164e2a[_0x92d2('0xab')][_0x1579d5]['ListId'],'VoiceQueueId':_0x164e2a[_0x92d2('0xab')][_0x1579d5][_0x92d2('0xd4')]||undefined,'CampaignId':_0x164e2a[_0x92d2('0xab')][_0x1579d5][_0x92d2('0xd5')]||undefined})[_0x92d2('0xb0')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x164e2a[_0x92d2('0xab')][_0x1579d5];}}else{return _0x164e2a[_0x92d2('0x167')](_0x1ca1ce,_0x2f3305);}}else{if(getDiff(_0x2f3305['scheduledat'])<_0x1ca1ce['dialRecallMeTimeout']*0x3c){if(_0x2f3305[_0x92d2('0x1db')]&&!_0x2f3305[_0x92d2('0x1db')][_0x92d2('0x1dc')]){_0x164e2a[_0x92d2('0x1d')][_0x92d2('0x130')](_0x2f3305['id'])['finally'](function(){_0x164e2a[_0x92d2('0xb4')](_0x1ca1ce);});}else{_0x164e2a[_0x92d2('0xc2')]({'active':![]},_0x2f3305['id'],0x1)['finally'](function(){_0x164e2a['updateOriginated'](_0x1ca1ce);});}}else{_0x1ca1ce[_0x92d2('0x62')]+=0x1;_0x164e2a[_0x92d2('0xb4')](_0x1ca1ce);if(_0x1ca1ce[_0x92d2('0x1dd')]){_0x164e2a[_0x92d2('0xc0')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2f3305[_0x92d2('0xd1')],'ListId':_0x2f3305[_0x92d2('0xd2')],'VoiceQueueId':_0x2f3305[_0x92d2('0xd4')]||undefined,'CampaignId':_0x2f3305['CampaignId']||undefined})[_0x92d2('0xb0')](loggerCatch(_0x92d2('0x1de')));_0x164e2a[_0x92d2('0xcb')](createObjHistory(_0x1ca1ce,_0x2f3305,'RECALLINQUEUE',0x17,_0x92d2('0x1df')))[_0x92d2('0xb0')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x164e2a[_0x92d2('0xcf')](createObjHistory(_0x1ca1ce,_0x2f3305,_0x92d2('0x1e0'),0x16,_0x92d2('0x1e1')),_0x92d2('0x1e2'),'[Originate][HistoryRecallClose]');}}}}else{_0x1ca1ce['outboundBlacklistCallsDay']+=0x1;_0x164e2a['saveInDb'](createObjHistory(_0x1ca1ce,_0x2f3305,_0x92d2('0x1e3'),0xd,_0x92d2('0x1e4')),_0x92d2('0x1e5'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer['prototype'][_0x92d2('0x15c')]=function(_0x3a9a46){var _0x5196b4=this;var _0x18408d=_0x3a9a46['limitCalls']-_0x3a9a46[_0x92d2('0x95')]-_0x3a9a46[_0x92d2('0xc5')];emitCampaignSummary(_0x3a9a46);if(_0x18408d>0x0){if(_0x18408d>this[_0x92d2('0x22')]){_0x18408d=this[_0x92d2('0x22')];}_0x3a9a46['temp']+=_0x18408d;this[_0x92d2('0xc7')](_0x3a9a46['id'],_0x18408d,_0x3a9a46[_0x92d2('0x1e6')],_0x3a9a46)[_0x92d2('0xb7')](function(_0x3143f0){_0x3a9a46['temp']-=_0x18408d;_0x3a9a46[_0x92d2('0xc5')]=_0x3a9a46[_0x92d2('0xc5')]>0x0?_0x3a9a46[_0x92d2('0xc5')]:0x0;if(!checkContactEmpty(_0x3143f0)){_0x3a9a46['message']=_0x92d2('0x9c');logger[_0x92d2('0x78')](_0x92d2('0x1e7')+_0x3a9a46[_0x92d2('0x3c')]);}else{_0x3a9a46[_0x92d2('0x95')]+=_0x3143f0[_0x92d2('0x94')];_0x3a9a46[_0x92d2('0x3e')]=_0x92d2('0x1e8');for(var _0x1c7b5e=0x0;_0x1c7b5e<_0x3143f0[_0x92d2('0x94')];_0x1c7b5e+=0x1){_0x3a9a46[_0x92d2('0x1e9')]+=0x1;if(_[_0x92d2('0xdc')](_0x3143f0[_0x1c7b5e])||_[_0x92d2('0xdc')](_0x3143f0[_0x1c7b5e][_0x92d2('0x169')])||_[_0x92d2('0xdc')](_0x3143f0[_0x1c7b5e][_0x92d2('0x169')][_0x92d2('0x16a')])){_0x5196b4['emptyContact'](_0x92d2('0x1ea'),_0x3a9a46,_0x3143f0[_0x1c7b5e]);}else{_0x5196b4['checkIsBlackListIvr'](_[_0x92d2('0xd0')](_0x3143f0[_0x1c7b5e],[_0x92d2('0xd5'),_0x92d2('0x1eb')]))[_0x92d2('0xb7')](_0x5196b4[_0x92d2('0x1ec')](_0x3a9a46,_0x3143f0[_0x1c7b5e]))[_0x92d2('0xb0')](_0x5196b4['loggerHandler'](_0x92d2('0x1ed'),_0x3a9a46));}}}})['catch'](loggerGetContactDialer('[getContactCampaign2]',_0x3a9a46,_0x18408d));}};Dialer[_0x92d2('0x18')][_0x92d2('0x158')]=function(_0x430093,_0x2ca8f4){var _0x39f6a2=this;var _0x8299ab=[];var _0x1d3437=_0x2ca8f4>=0x1?_0x2ca8f4:0x1;if(_0x430093['dialMethod']===_0x92d2('0x7')){_0x1d3437=0x1;}var _0x25d607=Math['floor'](_0x430093['available']*_0x1d3437)-_0x430093[_0x92d2('0x95')]-_0x430093[_0x92d2('0xc5')];emitVoiceQueueSummary(_0x430093);if(_0x430093[_0x92d2('0x1ee')]>0x0){var _0x55f87f=_0x430093[_0x92d2('0x1ee')]-_0x430093[_0x92d2('0x95')]-_0x430093['talking']-_0x430093[_0x92d2('0xc5')]-_0x430093[_0x92d2('0x50')];if(_0x25d607>_0x55f87f){_0x25d607=_0x55f87f;}}if(_0x25d607>0x0){if(_0x430093[_0x92d2('0x57')]===_0x92d2('0x7')){_0x25d607=0x1;}if(_0x25d607>this['maxNumberOriginate']){_0x25d607=this['maxNumberOriginate'];}_0x430093['temp']+=_0x25d607;for(var _0x553400 in this[_0x92d2('0x20')]){if(typeof this[_0x92d2('0x20')][_0x553400]!==_0x92d2('0x96')){if(this[_0x92d2('0x20')][_0x553400][_0x92d2('0xa4')]===_0x92d2('0x1ef')&&this[_0x92d2('0x20')][_0x553400][_0x92d2('0xae')]===_0x92d2('0xda')){_0x8299ab[_0x92d2('0x12c')](this[_0x92d2('0x20')][_0x553400]['id']);}}}this['getContactDialer'](_0x430093['id'],_0x8299ab,_0x25d607,_0x430093[_0x92d2('0x1e6')],_0x430093)[_0x92d2('0xb7')](function(_0x176144){_0x430093[_0x92d2('0xc5')]-=_0x25d607;_0x430093[_0x92d2('0xc5')]=_0x430093['temp']>0x0?_0x430093[_0x92d2('0xc5')]:0x0;if(!checkContactEmpty(_0x176144)){_0x39f6a2[_0x92d2('0xb8')](_0x430093)[_0x92d2('0xb7')](sendMessageReschedule(_0x430093))['catch'](loggerCatch(_0x92d2('0xb9')));}else{_0x430093[_0x92d2('0x95')]+=_0x176144['length'];_0x430093[_0x92d2('0x3e')]=_0x430093[_0x92d2('0x57')]===_0x92d2('0x7')?_0x92d2('0x172'):'RUNNING';for(var _0x10de01=0x0;_0x10de01<_0x176144['length'];_0x10de01+=0x1){if(_[_0x92d2('0xdc')](_0x176144[_0x10de01])||_[_0x92d2('0xdc')](_0x176144[_0x10de01][_0x92d2('0x169')])||_['isNil'](_0x176144[_0x10de01][_0x92d2('0x169')][_0x92d2('0x16a')])){_0x39f6a2[_0x92d2('0x1f0')](_0x92d2('0x1ea'),_0x430093,_0x176144[_0x10de01]);}else{_0x39f6a2[_0x92d2('0xba')](_[_0x92d2('0xd0')](_0x176144[_0x10de01],[_0x92d2('0xd4'),'Contact.phone']))['then'](_0x39f6a2[_0x92d2('0x1ec')](_0x430093,_0x176144[_0x10de01]))['catch'](_0x39f6a2[_0x92d2('0x1f1')](_0x92d2('0x1ea'),_0x430093));}}}})['catch'](loggerGetContactDialer(_0x92d2('0x1f2'),_0x430093,_0x25d607));}};Dialer[_0x92d2('0x18')][_0x92d2('0x8b')]=function(_0x2fbcd5){if(_0x2fbcd5[_0x92d2('0x1ee')]>0x0){var _0xa53b2c=_0x2fbcd5[_0x92d2('0x1ee')]-_0x2fbcd5[_0x92d2('0x95')]-_0x2fbcd5[_0x92d2('0x9f')];if(_0xa53b2c>0x0){this[_0x92d2('0x1f3')](_0x2fbcd5);}else{loggerPredictiveCalls[_0x92d2('0x78')](_0x92d2('0x1f4'));}}else{this[_0x92d2('0x1f3')](_0x2fbcd5);}};Dialer[_0x92d2('0x18')][_0x92d2('0x1f3')]=function(_0x4152a2){var _0x135125=this;var _0xb55a02=[];_0x4152a2['originated']+=0x1;for(var _0x61c436 in this['agents']){if(typeof this['agents'][_0x61c436]!==_0x92d2('0x96')){if(this['agents'][_0x61c436]['state']===_0x92d2('0x1ef')&&this[_0x92d2('0x20')][_0x61c436][_0x92d2('0xae')]===_0x92d2('0xda')){_0xb55a02[_0x92d2('0x12c')](this[_0x92d2('0x20')][_0x61c436]['id']);}}}this[_0x92d2('0xc4')](_0x4152a2['id'],_0xb55a02,0x1,_0x4152a2[_0x92d2('0x1e6')],_0x4152a2)[_0x92d2('0xb7')](function(_0x5ce315){if(!checkContactEmpty(_0x5ce315)){checkContactLowerLimitOriginate(_0x4152a2,0x1,0x0);_0x135125[_0x92d2('0xb8')](_0x4152a2)[_0x92d2('0xb7')](sendMessageReschedule(_0x4152a2))[_0x92d2('0xb0')](loggerCatch(_0x92d2('0xb9')));}else{_0x4152a2['message']='RUNNING';if(_[_0x92d2('0xdc')](_0x5ce315[0x0])||_['isNil'](_0x5ce315[0x0][_0x92d2('0x169')])||_[_0x92d2('0xdc')](_0x5ce315[0x0][_0x92d2('0x169')][_0x92d2('0x16a')])){_0x135125[_0x92d2('0x1f0')](_0x92d2('0x1ea'),_0x4152a2,_0x5ce315[0x0]);}else{_0x135125[_0x92d2('0xba')](_[_0x92d2('0xd0')](_0x5ce315[0x0],[_0x92d2('0xd4'),_0x92d2('0x1eb')]))[_0x92d2('0xb7')](_0x135125[_0x92d2('0x1ec')](_0x4152a2,_0x5ce315[0x0]))[_0x92d2('0xb0')](_0x135125[_0x92d2('0x1f1')](_0x92d2('0x1f5'),_0x4152a2));}}})[_0x92d2('0xb0')](loggerGetContactDialer(_0x92d2('0x1f6'),_0x4152a2,0x1));emitVoiceQueueSummary(_0x4152a2);};Dialer['prototype'][_0x92d2('0x1c9')]=function(_0x2eafcf,_0x606ced,_0x111174,_0x52271c,_0x3a748c,_0x2e15a3){loggerPredictive[_0x92d2('0x78')](_0x92d2('0x1f7'));loggerPredictive[_0x92d2('0x78')](_0x92d2('0x1f8'),_0x2eafcf);loggerPredictive[_0x92d2('0x78')](_0x92d2('0x1f9'),_0x606ced);loggerPredictive[_0x92d2('0x78')](_0x92d2('0x1fa'),_0x111174);loggerPredictive[_0x92d2('0x78')](_0x92d2('0x1fb'),_0x52271c);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a748c);loggerPredictive[_0x92d2('0x78')](_0x92d2('0x82'));return new BPromise(function(_0xf2fe68,_0x5b9fc3){if(_0x2eafcf<=0x0||isNaN(_0x2eafcf)){return _0x5b9fc3(msgResponse(_0x92d2('0x1fc'),_0x92d2('0x18d'),_0x92d2('0x1fd')+_0x2eafcf));}if(_0x111174<=0x0||isNaN(_0x111174)){return _0x5b9fc3(msgResponse(_0x92d2('0x1fc'),'Error',_0x92d2('0x1fe')+_0x111174));}if(_0x52271c<=0x0||isNaN(_0x52271c)){return _0x5b9fc3(msgResponse(_0x92d2('0x1fc'),_0x92d2('0x18d'),_0x92d2('0x1ff')+_0x52271c));}if(_0x606ced<=0x0||isNaN(_0x606ced)){return _0x5b9fc3(msgResponse(_0x92d2('0x1fc'),'Error',_0x92d2('0x200')+_0x606ced));}if(_0x3a748c<=0x0||isNaN(_0x3a748c)){return _0x5b9fc3(msgResponse(_0x92d2('0x1fc'),'Error',_0x92d2('0x201')+_0x3a748c));}_0x2e15a3=_0x2e15a3||0x0;var _0x211460=0x1/_0x111174;var _0x6f0179=0x0;var _0x54f751=0x0;var _0x553fb5=0x0;var _0x300d88=0x0;for(var _0x5ad3d2=0x0;_0x553fb5<_0x3a748c;_0x5ad3d2+=0x1){_0x54f751=_0x5ad3d2/_0x606ced;_0x6f0179=(_0x52271c*_0x54f751+_0x2e15a3)/_0x211460;_0x553fb5=erlangb(_0x6f0179,_0x2eafcf);_0x300d88=_0x6f0179/_0x2eafcf*(0x1-erlangb(_0x6f0179,_0x2eafcf));}return _0xf2fe68({'erlangCalls':_0x5ad3d2,'erlangCallToSecond':_0x606ced/_0x5ad3d2,'erlangAbandonmentRate':_0x553fb5,'erlangBusyFactor':_0x300d88});});};Dialer[_0x92d2('0x18')]['busyFactor']=function(_0x2d5769,_0x2e1652,_0x1b8869,_0x2bce71,_0x38c925,_0x12db43){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x92d2('0x78')]('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',_0x2d5769);loggerPredictive[_0x92d2('0x78')](_0x92d2('0x1f9'),_0x2e1652);loggerPredictive[_0x92d2('0x78')]('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',_0x1b8869);loggerPredictive[_0x92d2('0x78')](_0x92d2('0x1fb'),_0x2bce71);loggerPredictive[_0x92d2('0x78')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x38c925);loggerPredictive[_0x92d2('0x78')](_0x92d2('0x82'));return new BPromise(function(_0x5d0689,_0x4164eb){if(_0x2d5769<=0x0||isNaN(_0x2d5769)){return _0x4164eb(msgResponse(_0x92d2('0x202'),_0x92d2('0x18d'),_0x92d2('0x1fd')+_0x2d5769));}if(_0x1b8869<=0x0||isNaN(_0x1b8869)){return _0x4164eb(msgResponse(_0x92d2('0x202'),_0x92d2('0x18d'),_0x92d2('0x1fe')+_0x1b8869));}if(_0x2bce71<=0x0||isNaN(_0x2bce71)){return _0x4164eb(msgResponse(_0x92d2('0x202'),_0x92d2('0x18d'),'p\x20=\x20'+_0x2bce71));}if(_0x2e1652<=0x0||isNaN(_0x2e1652)){return _0x4164eb(msgResponse('[busyFactor]',_0x92d2('0x18d'),'interval\x20=\x20'+_0x2e1652));}if(_0x38c925<=0x0||isNaN(_0x38c925)){return _0x4164eb(msgResponse(_0x92d2('0x202'),_0x92d2('0x18d'),_0x92d2('0x203')+_0x38c925));}_0x12db43=_0x12db43||0x0;var _0x4c788f=0x1/_0x1b8869;var _0x311854=0x0;var _0x105903=0x0;var _0x260efb=0x0;var _0x3c513b=0x0;for(var _0x5455ea=0x0;_0x3c513b<_0x38c925;_0x5455ea+=0x1){_0x105903=_0x5455ea/_0x2e1652;_0x311854=(_0x2bce71*_0x105903+_0x12db43)/_0x4c788f;_0x260efb=erlangb(_0x311854,_0x2d5769);_0x3c513b=_0x311854/_0x2d5769*(0x1-erlangb(_0x311854,_0x2d5769));}return _0x5d0689({'erlangCalls':_0x5455ea,'erlangCallToSecond':_0x2e1652/_0x5455ea,'erlangAbandonmentRate':_0x260efb,'erlangBusyFactor':_0x3c513b});});};module[_0x92d2('0x204')]=Dialer; \ No newline at end of file +var _0x4cc4=['checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','ContactId','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','status','reachable','SIP/%s','unmonitored','saveInDb','variable','exten','xcally-motion-dialer','HANGUP','uniqueid','state','membername','AMD','custom:amd','amd','dialAMDActive','value','Machine','countglobal','buildObj','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countdropretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','minutes','YYYY-MM-DD\x20HH:mm:ss','CampaignId','HangupInAMD','[syncHangupInAMDIvr][createHistory]','MACHINE','countbusyretry','countnosuchnumberretry','countabandonedretry','add','dialMachineRetryFrequency','ivrAnswerCallsDay','dialQueueProject','AGI','[syncHangupIvr]','cause-txt','Unknow','[syncHangupIvr][createHistory]','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','actionid','strategy','paused','stateinterface','locked','rrmemory','push','pick','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','indexOf','true','content','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','progressive','handlePower','power','booked','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','ACTIVE','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','phone','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','response','callProgressDetecting','checkRetriveMax','dialNoAnswerMaxRetry','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedRetryFrequency','[rescheduleContact][Machine]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','evt\x20is\x20undefine','NoSuchNumber','nosuchnumber','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','floor','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','dialPredictiveInterval','started\x20in\x20predictive\x20at','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','getDataPredictive','dialPredictiveOptimization','abandonmentRate','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','loggerHandler','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','exports','util','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./action','./history','./final','./queueCallerAbandon','env','roundrobin','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','syncNewExten','varset','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','name','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','isEmpty','Intervals','INTERVAL_IS_NULL','Error','milliseconds','seconds','emit','type','answered','loggedIn','sumBillable','talking','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','ivr','campaign:ivr:%s','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','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','erlangCallToSecond','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','erlangAbandonmentRate','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','outbound','string','\x22%s\x22\x20<%s>','error','inspect','stack','length','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','[getContactDialer2][Empty]','sendMessageOneNotActive','waiting','pTalking','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','endtime','starttime','prototype','clearZombieChannels','actions','[actions]','isNil','Action','channel','catch','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','queue','resolve','then','countReScheduled','[countReScheduled]\x20'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0x4cc4,0x154));var _0x44cc=function(_0x4e7417,_0x387beb){_0x4e7417=_0x4e7417-0x0;var _0xe5496=_0x4cc4[_0x4e7417];return _0xe5496;};'use strict';var util=require(_0x44cc('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x44cc('0x1'));var moment=require(_0x44cc('0x2'));var rr=require('rr');var md5=require(_0x44cc('0x3'));var Redis=require(_0x44cc('0x4'));var ut=require(_0x44cc('0x5'));var config=require(_0x44cc('0x6'));var logger=require('../../../config/logger')(_0x44cc('0x7'));var loggerBooked=require(_0x44cc('0x8'))('booked');var loggerPredictive=require('../../../config/logger')(_0x44cc('0x9'));var loggerPredictiveCalls=require(_0x44cc('0x8'))(_0x44cc('0xa'));var loggerSyncQueueSummary=require(_0x44cc('0x8'))(_0x44cc('0xb'));var ami=require(_0x44cc('0xc'));config[_0x44cc('0xd')]=_[_0x44cc('0xe')](config[_0x44cc('0xd')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x44cc('0xd')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x44cc('0xf'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x44cc('0x10'));var Action=require(_0x44cc('0x11'));var History=require(_0x44cc('0x12'));var Final=require(_0x44cc('0x13'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x44cc('0x14'));var Hangup=require('./hangup');var ipAgi=process[_0x44cc('0x15')]['XCALLY_IP_AGI']||'127.0.0.1';var strategy={'rrmemory':'rrmemory','roundrobin':_0x44cc('0x16')};var Sequence=function(){};Sequence['prototype'][_0x44cc('0x17')]=function(_0x419387){this[_0x44cc('0x18')]=this[_0x44cc('0x18')]?this[_0x44cc('0x18')][_0x44cc('0x19')](_0x419387):_0x419387();};function Dialer(_0x14a443,_0x4e51ee){this[_0x44cc('0x1a')]=new Sequence();this[_0x44cc('0x1b')]=_0x4e51ee;this[_0x44cc('0x1c')]=_0x14a443[_0x44cc('0x1c')];this[_0x44cc('0x1d')]=_0x14a443['campaigns'];this[_0x44cc('0x1e')]=_0x14a443[_0x44cc('0x1e')];this['trunks']=_0x14a443[_0x44cc('0x1f')];this[_0x44cc('0x20')]=config[_0x44cc('0x20')]||0x2;this[_0x44cc('0x21')]={};this['actions']={};this[_0x44cc('0x22')]={};this[_0x44cc('0x23')]={};this[_0x44cc('0x24')]={};this[_0x44cc('0x25')]={};this[_0x44cc('0x26')]={};this[_0x44cc('0x27')]={};this[_0x44cc('0x28')]={};this['queueBookedRR']={};ami['on']('agentconnect',this[_0x44cc('0x29')][_0x44cc('0x2a')](this));ami['on'](_0x44cc('0x2b'),this[_0x44cc('0x2c')][_0x44cc('0x2a')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x44cc('0x2a')](this));ami['on'](_0x44cc('0x2d'),this[_0x44cc('0x2e')][_0x44cc('0x2a')](this));ami['on'](_0x44cc('0x2f'),this['syncQueueSummary']['bind'](this));ami['on'](_0x44cc('0x30'),this[_0x44cc('0x31')][_0x44cc('0x2a')](this));ami['on']('newexten',this[_0x44cc('0x32')][_0x44cc('0x2a')](this));ami['on'](_0x44cc('0x33'),this['syncVarSet'][_0x44cc('0x2a')](this));ami['on'](_0x44cc('0x34'),this[_0x44cc('0x35')]['bind'](this));ami['on'](_0x44cc('0x36'),this[_0x44cc('0x37')][_0x44cc('0x2a')](this));this[_0x44cc('0x38')]();this[_0x44cc('0x39')]();}function isNotNull(_0x435310){return _0x435310!==null&&!_[_0x44cc('0x3a')](_0x435310);}function checkIsLoggedIn(_0x129133,_0x2c37b2){return function(){if(_0x2c37b2<=0x0){_0x129133['message']=_0x44cc('0x3b');throw _0x129133['name']+_0x44cc('0x3c');}};}function isActive(_0x47090d){return _0x47090d;}function checkIsActive(_0x2dc80b,_0x34eab3){return function(){if(!isActive(_0x34eab3)){_0x2dc80b[_0x44cc('0x3d')]=_0x44cc('0x3e');throw _0x2dc80b[_0x44cc('0x3f')]+_0x44cc('0x40');}};}function checkInterval(_0x5eedeb){return function(){if(!isNotNull(_0x5eedeb[_0x44cc('0x41')])){_0x5eedeb[_0x44cc('0x3d')]='INTERVAL_IS_NULL';throw _0x5eedeb[_0x44cc('0x3f')]+_0x44cc('0x42');}if(!isNotNull(_0x5eedeb[_0x44cc('0x41')]['Intervals'])){_0x5eedeb[_0x44cc('0x3d')]='INTERVAL_IS_NULL';throw _0x5eedeb[_0x44cc('0x3f')]+_0x44cc('0x42');}if(!isNotNull(_[_0x44cc('0x43')](_0x5eedeb[_0x44cc('0x41')][_0x44cc('0x44')]))){_0x5eedeb[_0x44cc('0x3d')]=_0x44cc('0x45');throw _0x5eedeb['name']+_0x44cc('0x42');}};}function msgResponse(_0xb658ef,_0x750baf,_0x4e1a43){return{'action':_0xb658ef,'response':_0x750baf,'message':_0x4e1a43,'stack':_0x4e1a43};}function myreject(_0x2b067f){return function(_0x4b4ddf){return _0x2b067f(msgResponse('[ifTime][Action]',_0x44cc('0x46'),JSON['stringify'](_0x4b4ddf)));};}function getSeconds(_0x4a6a9b,_0x32a856){var _0x14d9b4=moment(_0x4a6a9b)[_0x44cc('0x47')](0x0);var _0x3be929=moment(_0x32a856)['milliseconds'](0x0);return _0x14d9b4['diff'](_0x3be929,_0x44cc('0x48'));}function emit(_0x1b9a61,_0x347130,_0x1c3cfa){io['to'](_0x1b9a61)[_0x44cc('0x49')](_0x347130,_0x1c3cfa);}function emitVoiceQueueSummary(_0x133371){if(_0x133371[_0x44cc('0x4a')]==='outbound'){var _0x288d45={'id':_0x133371['id'],'name':_0x133371[_0x44cc('0x3f')],'strategy':_0x133371['strategy'],'answered':_0x133371[_0x44cc('0x4b')],'available':_0x133371['available'],'loggedIn':_0x133371[_0x44cc('0x4c')],'pTalking':_0x133371['pTalking'],'sumBillable':_0x133371[_0x44cc('0x4d')],'sumDuration':_0x133371['sumDuration'],'sumHoldTime':_0x133371['sumHoldTime']||0x0,'talking':_0x133371[_0x44cc('0x4e')],'total':_0x133371['total'],'type':_0x133371[_0x44cc('0x4a')],'unmanaged':_0x133371[_0x44cc('0x4f')],'abandoned':_0x133371['abandoned'],'waiting':_0x133371['waiting'],'loggedInDb':_0x133371['loggedInDb'],'dialActive':_0x133371[_0x44cc('0x50')],'dialMethod':_0x133371[_0x44cc('0x51')],'dialOriginateCallerIdName':_0x133371[_0x44cc('0x52')],'dialOriginateCallerIdNumber':_0x133371[_0x44cc('0x53')],'dialOriginateTimeout':_0x133371[_0x44cc('0x54')],'dialPrefix':_0x133371[_0x44cc('0x55')],'outboundAnswerAgiCallsDay':_0x133371[_0x44cc('0x56')],'outboundAnswerCallsDay':_0x133371[_0x44cc('0x57')],'outboundBlacklistCallsDay':_0x133371['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x133371[_0x44cc('0x58')],'outboundCongestionCallsDay':_0x133371[_0x44cc('0x59')],'outboundDropCallsDayACS':_0x133371[_0x44cc('0x5a')],'outboundDropCallsDayCallersExit':_0x133371[_0x44cc('0x5b')],'outboundDropCallsDayTimeout':_0x133371[_0x44cc('0x5c')],'outboundNoAnswerCallsDay':_0x133371['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x133371[_0x44cc('0x5d')],'outboundOriginateFailureCallsDay':_0x133371[_0x44cc('0x5e')],'outboundReCallsDay':_0x133371['outboundReCallsDay'],'outboundRejectCallsDay':_0x133371[_0x44cc('0x5f')],'outboundUnknownCallsDay':_0x133371[_0x44cc('0x60')],'predictiveIntervalAnsweredCalls':_0x133371['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x133371[_0x44cc('0x61')],'predictiveIntervalAvgTalktime':_0x133371[_0x44cc('0x62')],'predictiveIntervalDroppedCallsCallersExit':_0x133371[_0x44cc('0x63')],'predictiveIntervalDroppedCallsTimeout':_0x133371[_0x44cc('0x64')],'predictiveIntervalErlangCalls':_0x133371[_0x44cc('0x65')],'predictiveIntervalErlangCallsDroppedCalls':_0x133371[_0x44cc('0x66')],'predictiveIntervalHitRate':_0x133371[_0x44cc('0x67')],'predictiveIntervalMultiplicativeFactor':_0x133371['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x133371[_0x44cc('0x68')],'predictiveIntervalAvailable':_0x133371[_0x44cc('0x69')],'predictiveIntervalTotalCalls':_0x133371[_0x44cc('0x6a')],'message':_0x133371[_0x44cc('0x3d')],'originated':_0x133371['originated'],'erlangCalls':_0x133371[_0x44cc('0x6b')],'erlangCallToSecond':_0x133371['erlangCallToSecond'],'erlangAbandonmentRate':_0x133371['erlangAbandonmentRate'],'erlangBusyFactor':_0x133371[_0x44cc('0x6c')],'startPredictive':_0x133371[_0x44cc('0x25')],'startProgressive':_0x133371[_0x44cc('0x26')]};if(_0x133371[_0x44cc('0x6d')]){_0x288d45['Trunk']={'id':_0x133371[_0x44cc('0x6d')]['id'],'name':_0x133371[_0x44cc('0x6d')]['name'],'active':_0x133371[_0x44cc('0x6d')][_0x44cc('0x6e')],'callerid':_0x133371[_0x44cc('0x6d')][_0x44cc('0x6f')]};}if(_0x133371[_0x44cc('0x41')]){_0x288d45[_0x44cc('0x41')]={'id':_0x133371[_0x44cc('0x41')]['id'],'name':_0x133371[_0x44cc('0x41')][_0x44cc('0x3f')]};}var _0x3a99f0=md5(JSON['stringify'](_0x288d45));if(_0x133371[_0x44cc('0x3')]!==_0x3a99f0){_0x133371[_0x44cc('0x3')]=_0x3a99f0;emit(util[_0x44cc('0x70')](_0x44cc('0x71'),_0x288d45[_0x44cc('0x3f')]),'voice_queue:save',_0x288d45);}}}function emitCampaignSummary(_0xd9662a){if(_0xd9662a[_0x44cc('0x4a')]===_0x44cc('0x72')){emit(util['format'](_0x44cc('0x73'),_0xd9662a[_0x44cc('0x3f')]),'campaign:save',_0xd9662a);}}function checkGetDataPredictive(_0x50c0c1){if(isNotNull(_0x50c0c1)&&!_[_0x44cc('0x43')](_0x50c0c1)){loggerPredictive[_0x44cc('0x74')](_0x44cc('0x75'));loggerPredictive[_0x44cc('0x74')](_0x44cc('0x76'),_0x50c0c1[_0x44cc('0x6a')]);loggerPredictive['info'](_0x44cc('0x77'),_0x50c0c1[_0x44cc('0x78')]);loggerPredictive[_0x44cc('0x74')](_0x44cc('0x79'),_0x50c0c1[_0x44cc('0x64')]);loggerPredictive['info'](_0x44cc('0x7a'),_0x50c0c1[_0x44cc('0x63')]);loggerPredictive[_0x44cc('0x74')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x50c0c1['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0x44cc('0x7b'),_0x50c0c1['predictiveIntervalAvgTalktime']);loggerPredictive[_0x44cc('0x74')](_0x44cc('0x7c'));if(_0x50c0c1[_0x44cc('0x6a')]>0x0){if(!_[_0x44cc('0x3a')](_0x50c0c1[_0x44cc('0x62')])&&_0x50c0c1[_0x44cc('0x62')]>0x0){return!![];}loggerPredictive[_0x44cc('0x74')](_0x44cc('0x7d'));if(!_[_0x44cc('0x3a')](_0x50c0c1[_0x44cc('0x61')])&&_0x50c0c1[_0x44cc('0x61')]>0x0){return!![];}loggerPredictive[_0x44cc('0x74')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x44cc('0x74')](_0x44cc('0x7e'));}}else{loggerPredictive[_0x44cc('0x74')](_0x44cc('0x7f'));}return![];}function mergeDataErlangB(_0x3a04aa){return function(_0xe998f1){loggerPredictive[_0x44cc('0x74')](_0x44cc('0x80'));loggerPredictive[_0x44cc('0x74')](_0x44cc('0x81'),_0xe998f1[_0x44cc('0x6b')]);loggerPredictive[_0x44cc('0x74')](_0x44cc('0x82'),_0xe998f1[_0x44cc('0x83')]);loggerPredictive[_0x44cc('0x74')](_0x44cc('0x84'),_0xe998f1['erlangAbandonmentRate']);loggerPredictive[_0x44cc('0x74')](_0x44cc('0x85'),_0xe998f1['erlangBusyFactor']);loggerPredictive[_0x44cc('0x74')](_0x44cc('0x84'),_0xe998f1[_0x44cc('0x86')]);loggerPredictive['info'](_0x44cc('0x7c'));_[_0x44cc('0x87')](_0x3a04aa,_0xe998f1);};}function getDiff(_0x362c06){var _0x1f7de8=moment()['milliseconds'](0x0);var _0x3566f0=moment(_0x362c06)[_0x44cc('0x47')](0x0);return _0x1f7de8['diff'](_0x3566f0,'seconds');}function ifInterval(_0x47fa03,_0x551312){if(_[_0x44cc('0x3a')](_0x551312)){return![];}return getDiff(_0x551312)<_0x47fa03*0x3c;}function freeVariablesPredictive(_0x154c9c){if(isNotNull(_0x154c9c)){if(!_[_0x44cc('0x3a')](_0x154c9c[_0x44cc('0x26')])){_0x154c9c['startProgressive']=undefined;loggerPredictive[_0x44cc('0x74')](_0x154c9c[_0x44cc('0x3f')],_0x44cc('0x88'));}if(!_[_0x44cc('0x3a')](_0x154c9c[_0x44cc('0x25')])){_0x154c9c['startPredictive']=undefined;loggerPredictive[_0x44cc('0x74')](_0x154c9c[_0x44cc('0x3f')],_0x44cc('0x89'));}if(!_[_0x44cc('0x3a')](_0x154c9c[_0x44cc('0x8a')])){clearInterval(_0x154c9c[_0x44cc('0x8a')]);_0x154c9c[_0x44cc('0x8a')]=undefined;loggerPredictive[_0x44cc('0x74')](_0x154c9c['name'],_0x44cc('0x8b'));}}}function erlangb(_0x25e8a5,_0x5914e4){if(_0x5914e4===0x0){return 0x0;}var _0x48333b=0x1;for(var _0x587223=0x1;_0x587223<=_0x5914e4;_0x587223+=0x1){_0x48333b=0x1+_0x48333b*_0x587223/_0x25e8a5;}return 0x1/_0x48333b;}function isVoiceQueueOutbound(_0x31400b){return _0x31400b===_0x44cc('0x8c');}function isNotPreview(_0xcaae0f){return _0xcaae0f!==_0x44cc('0x1b');}function isCampaignIvr(_0x5d42a4){return _0x5d42a4===_0x44cc('0x72');}function getCallerId(_0x18c423,_0x2903ee,_0x43452c){if(!_[_0x44cc('0x3a')](_0x43452c)&&typeof _0x43452c===_0x44cc('0x8d')&&!_[_0x44cc('0x43')](_0x43452c)){if(!_['isUndefined'](_0x2903ee)&&typeof _0x2903ee===_0x44cc('0x8d')&&!_[_0x44cc('0x43')](_0x2903ee)){return util[_0x44cc('0x70')](_0x44cc('0x8e'),_0x2903ee,_0x43452c);}return util['format'](_0x44cc('0x8e'),_0x43452c,_0x43452c);}if(!_[_0x44cc('0x3a')](_0x18c423)&&typeof _0x18c423===_0x44cc('0x8d')&&!_[_0x44cc('0x43')](_0x18c423)){return _0x18c423;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x410cd3,_0x50cc3d){return function(_0x1108df){freeVariablesPredictive(_0x50cc3d);emitVoiceQueueSummary(_0x50cc3d);emitCampaignSummary(_0x50cc3d);loggerSyncQueueSummary[_0x44cc('0x8f')](_0x410cd3,util[_0x44cc('0x90')](_0x1108df,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x5b0aa6,_0x4f6b0b){return function(_0x8fd7ff){loggerPredictive[_0x44cc('0x8f')](_0x4f6b0b[_0x44cc('0x3f')],_0x5b0aa6);loggerPredictive[_0x44cc('0x8f')](_0x8fd7ff[_0x44cc('0x91')]);freeVariablesPredictive(_0x4f6b0b);};}function loggerCatch(_0x2583f8){return function(_0x50a4a1){logger['error'](_0x2583f8,util[_0x44cc('0x90')](_0x50a4a1,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x205fda){return _0x205fda&&!_[_0x44cc('0x3a')](_0x205fda)&&_0x205fda[_0x44cc('0x92')]>0x0;}function decremetOriginate(_0x18fb5a){if(!_['isUndefined'](_0x18fb5a)&&_0x18fb5a!==null){if(typeof _0x18fb5a[_0x44cc('0x93')]!==_0x44cc('0x94')){if(_0x18fb5a[_0x44cc('0x93')]>0x0){_0x18fb5a[_0x44cc('0x93')]-=0x1;}else{logger[_0x44cc('0x8f')](_0x44cc('0x95'));}}}else{logger[_0x44cc('0x8f')](_0x44cc('0x96'));}}function checkContactLowerLimitOriginate(_0x35a3c3,_0x2bda28,_0x2d81ac){if(_0x2bda28>_0x2d81ac){for(var _0x15f1e3=0x0;_0x15f1e3<_0x2bda28-_0x2d81ac;_0x15f1e3+=0x1){decremetOriginate(_0x35a3c3);}}}function loggerGetContactDialer(_0x3801b6,_0x1c3e41,_0xc18bec){return function(_0x4efc85){checkContactLowerLimitOriginate(_0x1c3e41,_0xc18bec,0x0);logger[_0x44cc('0x8f')](_0x3801b6,util[_0x44cc('0x90')](_0x4efc85,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5852e4){return function(_0x32dddd){if(isNotNull(_0x32dddd)&&isNotNull(_0x32dddd[0x0])){if(_0x32dddd[0x0][_0x44cc('0x97')]>0x0){_0x5852e4[_0x44cc('0x3d')]=_0x44cc('0x98');logger[_0x44cc('0x74')](_0x44cc('0x99')+_0x5852e4[_0x44cc('0x3f')],_0x32dddd[0x0][_0x44cc('0x97')],'contacts');}else{_0x5852e4[_0x44cc('0x3d')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x44cc('0x74')](_0x44cc('0x9a')+_0x5852e4[_0x44cc('0x3f')]);}}};}function notSendMessagesQueue(_0xdbf51){if(_0xdbf51[_0x44cc('0x9b')]){freeVariablesPredictive(_0xdbf51);if(_0xdbf51[_0x44cc('0x93')]===0x0&&_0xdbf51[_0x44cc('0x4e')]===0x0&&_0xdbf51[_0x44cc('0x9c')]===0x0&&(_0xdbf51[_0x44cc('0x9d')]||0x0)===0x0){_0xdbf51[_0x44cc('0x9b')]=![];_0xdbf51[_0x44cc('0x9e')]=0x0;_0xdbf51[_0x44cc('0x3d')]=_0x44cc('0x3e');loggerSyncQueueSummary[_0x44cc('0x8f')](_0x44cc('0x9f'),_0xdbf51[_0x44cc('0x3f')],_0x44cc('0xa0'));}else{_0xdbf51[_0x44cc('0x3d')]=_0x44cc('0xa1');loggerSyncQueueSummary[_0x44cc('0x8f')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0xdbf51[_0x44cc('0x3f')],_0x44cc('0xa2'));}emitVoiceQueueSummary(_0xdbf51);}}function notSendMessagesCampaign(_0xd41647){if(_0xd41647[_0x44cc('0x9b')]){if(_0xd41647[_0x44cc('0x93')]===0x0){_0xd41647[_0x44cc('0x9b')]=![];_0xd41647[_0x44cc('0x3d')]=_0x44cc('0x3e');loggerSyncQueueSummary[_0x44cc('0x8f')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0xd41647[_0x44cc('0x3f')],_0x44cc('0xa0'));}else{_0xd41647[_0x44cc('0x3d')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x44cc('0x8f')](_0x44cc('0xa3'),_0xd41647[_0x44cc('0x3f')],_0x44cc('0xa2'));}emitCampaignSummary(_0xd41647);}}function createObjHistory(_0x2f2ec5,_0x5b02fa,_0x25d6c7,_0xc1c76a,_0x41323d){_0x2f2ec5[_0x44cc('0x3d')]=_0x25d6c7;var _0x1ca3cd=new Action(_0x2f2ec5,_0x5b02fa);var _0x8fb601=new History(_0x1ca3cd);_0x8fb601['state']=_0xc1c76a;_0x8fb601[_0x44cc('0xa4')]=_0x41323d;_0x8fb601[_0x44cc('0xa5')]=_0x1ca3cd[_0x44cc('0xa6')];return _0x8fb601;}Dialer[_0x44cc('0xa7')]['loopClearZombieChannels']=function(){var _0x49e6b2=this;setInterval(function(){_0x49e6b2[_0x44cc('0xa8')](_0x49e6b2[_0x44cc('0x23')],'[uniqueid]');_0x49e6b2[_0x44cc('0xa8')](_0x49e6b2[_0x44cc('0xa9')],_0x44cc('0xaa'));},0x32c8);};Dialer[_0x44cc('0xa7')][_0x44cc('0xa8')]=function(_0x4cde2e,_0x738b6){var _0x235992=this;for(var _0x101427 in _0x4cde2e){if(typeof _0x4cde2e[_0x101427]!==_0x44cc('0x94')){this[_0x44cc('0x1a')][_0x44cc('0x17')](function(){if(!_[_0x44cc('0xab')](_0x4cde2e[_0x101427])){return ami[_0x44cc('0xac')]({'action':'status','channel':_0x4cde2e[_0x101427][_0x44cc('0xad')]})[_0x44cc('0xae')](function(_0x46b408){if(_0x46b408[_0x44cc('0x3d')]===_0x44cc('0xaf')){setTimeout(function(){if(_0x4cde2e[_0x101427]&&_0x4cde2e[_0x101427]['type']!==_0x44cc('0x72')){_0x235992[_0x44cc('0xb0')](_0x235992[_0x44cc('0x1c')][_0x4cde2e[_0x101427]['queue']]);logger[_0x44cc('0x8f')](_0x44cc('0xb1'),_0x738b6,_0x101427,_0x4cde2e[_0x101427]['queue']);delete _0x4cde2e[_0x101427];}if(_0x4cde2e[_0x101427]&&_0x4cde2e[_0x101427][_0x44cc('0x4a')]===_0x44cc('0x72')){_0x235992[_0x44cc('0xb0')](_0x235992[_0x44cc('0x1d')][_0x4cde2e[_0x101427]['queue']]);logger[_0x44cc('0x8f')](_0x44cc('0xb2'),_0x738b6,_0x101427,_0x4cde2e[_0x101427][_0x44cc('0xb3')]);delete _0x4cde2e[_0x101427];}},0x2328);}});}});}}};Dialer[_0x44cc('0xa7')]['countReScheduled']=function(_0x358f87){return BPromise[_0x44cc('0xb4')]()[_0x44cc('0xb5')](cmHopper[_0x44cc('0xb6')](_0x358f87))['catch'](loggerCatch(_0x44cc('0xb7')));};Dialer[_0x44cc('0xa7')][_0x44cc('0xb8')]=function(_0x301e28){return BPromise[_0x44cc('0xb4')]()[_0x44cc('0xb5')](cmHopperBlack[_0x44cc('0xb8')](_0x301e28))[_0x44cc('0xae')](loggerCatch(_0x44cc('0xb9')));};Dialer[_0x44cc('0xa7')][_0x44cc('0xba')]=function(_0x3b3d7f){return BPromise[_0x44cc('0xb4')]()['then'](cmHopperBlack[_0x44cc('0xba')](_0x3b3d7f))[_0x44cc('0xae')](loggerCatch(_0x44cc('0xbb')));};Dialer[_0x44cc('0xa7')][_0x44cc('0xbc')]=function(_0x1bb44d){return BPromise[_0x44cc('0xb4')]()[_0x44cc('0xb5')](cmHopperHistory['avgHandleTime'](_0x1bb44d))[_0x44cc('0xae')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0x44cc('0xa7')][_0x44cc('0xbd')]=function(_0x1d5fa5){return BPromise[_0x44cc('0xb4')]()[_0x44cc('0xb5')](cmHopper[_0x44cc('0xbd')](_0x1d5fa5))[_0x44cc('0xae')](loggerCatch(_0x44cc('0xbe')));};Dialer[_0x44cc('0xa7')][_0x44cc('0xbf')]=function(_0x1af6ae,_0x5b42b0,_0x465733){return BPromise['resolve']()[_0x44cc('0xb5')](cmHopper[_0x44cc('0xbf')](_0x1af6ae,_0x5b42b0,_0x465733))[_0x44cc('0xae')](loggerCatch(_0x44cc('0xc0')));};Dialer[_0x44cc('0xa7')][_0x44cc('0xc1')]=function(_0x58111c,_0x4da7a1,_0x39d90f,_0x2870ee,_0x1c8699){return BPromise['resolve']()[_0x44cc('0xb5')](cmHopper['getContactDialer'](_0x58111c,_0x4da7a1,_0x39d90f,_0x2870ee))[_0x44cc('0xae')](function(_0x410c63){_0x1c8699[_0x44cc('0xc2')]-=_0x39d90f;_0x1c8699[_0x44cc('0xc2')]=_0x1c8699['temp']>0x0?_0x1c8699['temp']:0x0;loggerCatch(_0x44cc('0xc3'))(_0x410c63);});};Dialer['prototype']['getContactDialerIvr']=function(_0x795fee,_0x242b15,_0x5a5c2a,_0x1710ce){return BPromise[_0x44cc('0xb4')]()[_0x44cc('0xb5')](cmHopper[_0x44cc('0xc4')](_0x795fee,_0x242b15,_0x5a5c2a))[_0x44cc('0xae')](function(_0x3150f3){_0x1710ce[_0x44cc('0xc2')]-=_0x242b15;_0x1710ce['temp']=_0x1710ce[_0x44cc('0xc2')]>0x0?_0x1710ce[_0x44cc('0xc2')]:0x0;loggerCatch(_0x44cc('0xc5'))(_0x3150f3);});};Dialer[_0x44cc('0xa7')]['getVoiceQueueRtPauses']=function(_0xe514a){return BPromise[_0x44cc('0xb4')]()[_0x44cc('0xb5')](voiceQueueRt[_0x44cc('0xc6')](_0xe514a))[_0x44cc('0xae')](loggerCatch(_0x44cc('0xc7')));};Dialer[_0x44cc('0xa7')]['moveContactManagedDialer']=function(_0x3be8a7){return BPromise[_0x44cc('0xb4')]()[_0x44cc('0xb5')](cmHopper[_0x44cc('0xc8')](_0x3be8a7))[_0x44cc('0xae')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x44cc('0xa7')]['createHistory']=function(_0x8f38e0){return BPromise[_0x44cc('0xb4')]()[_0x44cc('0xb5')](cmHopperHistory[_0x44cc('0xc9')](_0x8f38e0))['catch'](loggerCatch(_0x44cc('0xca')));};Dialer[_0x44cc('0xa7')][_0x44cc('0xb0')]=function(_0x3b7edf){if(!_[_0x44cc('0x3a')](_0x3b7edf)&&_0x3b7edf!==null){if(typeof _0x3b7edf['originated']!==_0x44cc('0x94')){if(_0x3b7edf['originated']>0x0){_0x3b7edf[_0x44cc('0x93')]-=0x1;}else{logger[_0x44cc('0x8f')](_0x44cc('0xcb'));}}}else{logger[_0x44cc('0x8f')](_0x44cc('0xcc'));}};Dialer[_0x44cc('0xa7')]['loggerHandler']=function(_0xd8f0f1,_0x53f330){var _0x1fb8ca=this;return function(_0x21cea9){_0x1fb8ca['updateOriginated'](_0x53f330);logger['error'](_0xd8f0f1,util['inspect'](_0x21cea9,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x44cc('0xcd')]=function(_0x3cce6c,_0x294d06,_0x57a096){var _0x363b40={'state':0x19,'statedesc':_0x44cc('0xce')};this[_0x44cc('0xb0')](_0x294d06);this['saveInDb'](_[_0x44cc('0x87')](_0x363b40,_['pick'](_0x57a096,[_0x44cc('0xcf'),_0x44cc('0xd0'),_0x44cc('0xd1'),_0x44cc('0xd2'),'CampaignId'])),_0x44cc('0xd3'),_0x44cc('0xd4'));logger['error'](_0x3cce6c);};Dialer[_0x44cc('0xa7')][_0x44cc('0xd5')]=function(_0x20968c){return _0x20968c==='Success';};Dialer[_0x44cc('0xa7')][_0x44cc('0xd6')]=function(_0x353f0d){return!_[_0x44cc('0x3a')](_0x353f0d)&&_0x353f0d&&!_[_0x44cc('0x3a')](_0x353f0d[_0x44cc('0x3f')])&&!_[_0x44cc('0x3a')](_0x353f0d[_0x44cc('0x6e')])&&_0x353f0d[_0x44cc('0x6e')]&&(this[_0x44cc('0x1f')][util[_0x44cc('0x70')]('SIP/%s',_0x353f0d[_0x44cc('0x3f')])][_0x44cc('0xd7')]===_0x44cc('0xd8')||this[_0x44cc('0x1f')][util[_0x44cc('0x70')](_0x44cc('0xd9'),_0x353f0d[_0x44cc('0x3f')])][_0x44cc('0xd7')]===_0x44cc('0xda'));};Dialer[_0x44cc('0xa7')][_0x44cc('0xdb')]=function(_0x3d0378,_0x52dab9,_0x4611f3){this[_0x44cc('0xc9')](_0x3d0378)['catch'](loggerCatch(_0x52dab9));this['moveContactManagedDialer'](_0x3d0378)['catch'](loggerCatch(_0x4611f3));};Dialer[_0x44cc('0xa7')]['syncVarSet']=function(_0xb21a63){var _0x46439f=this[_0x44cc('0x23')][_0xb21a63['uniqueid']];var _0x3fac62;if(!_[_0x44cc('0xab')](_0xb21a63)&&!_[_0x44cc('0xab')](_0xb21a63[_0x44cc('0xdc')])&&!_[_0x44cc('0xab')](_0xb21a63['variable']['amdstatus'])&&_0xb21a63[_0x44cc('0xdd')]===_0x44cc('0xde')&&_0x46439f){if(_0x46439f['type']!==_0x44cc('0x72')&&this['voiceQueues'][_0x46439f['queue']]['dialAMDActive']&&_0xb21a63['value']===_0x44cc('0xdf')){delete this[_0x44cc('0x23')][_0xb21a63[_0x44cc('0xe0')]];this[_0x44cc('0xb0')](this[_0x44cc('0x1c')][_0x46439f[_0x44cc('0xb3')]]);this[_0x44cc('0x1c')][_0x46439f[_0x44cc('0xb3')]][_0x44cc('0x57')]+=0x1;this[_0x44cc('0x1c')][_0x46439f[_0x44cc('0xb3')]]['outboundAnswerAgiCallsDay']+=0x1;_0x3fac62=new Hangup(_0x46439f,_0xb21a63);_0x3fac62[_0x44cc('0xe1')]=0x12;_0x3fac62[_0x44cc('0xa4')]='HangupInAMD';_0x3fac62[_0x44cc('0xe2')]=_0x44cc('0xe3');ami['emit'](_0x44cc('0xe4'),ut['buildObj'](_0x3fac62,_0x44cc('0xe5')));this[_0x44cc('0xdb')](_0x3fac62,'[syncHangupInAMD][createHistory]','[syncHangupInAMD]');}if(_0x46439f[_0x44cc('0x4a')]!==_0x44cc('0x72')&&this[_0x44cc('0x1c')][_0x46439f[_0x44cc('0xb3')]][_0x44cc('0xe6')]&&_0xb21a63[_0x44cc('0xe7')]==='MACHINE'){var _0x12eac6=this;return new BPromise(function(_0x4fb843,_0x2308e0){delete _0x12eac6[_0x44cc('0x23')][_0xb21a63[_0x44cc('0xe0')]];_0x12eac6[_0x44cc('0xb0')](_0x12eac6[_0x44cc('0x1c')][_0x46439f[_0x44cc('0xb3')]]);_0x12eac6['voiceQueues'][_0x46439f[_0x44cc('0xb3')]][_0x44cc('0x57')]+=0x1;_0x12eac6[_0x44cc('0x1c')][_0x46439f[_0x44cc('0xb3')]][_0x44cc('0x56')]+=0x1;var _0x5f27ae=_0x12eac6[_0x44cc('0x1c')][_0x46439f[_0x44cc('0xb3')]];var _0x4b1b03=new Hangup(_0x46439f,_0xb21a63);_0x4b1b03[_0x44cc('0xe1')]=0x13;_0x4b1b03[_0x44cc('0xa4')]=_0x44cc('0xe8');_0x4b1b03[_0x44cc('0xe2')]=_0x44cc('0xe3');_0x4b1b03['countmachineretry']+=0x1;_0x4b1b03[_0x44cc('0xe9')]+=0x1;_0x4b1b03[_0x44cc('0xe5')]=!![];ami[_0x44cc('0x49')](_0x44cc('0xe4'),ut[_0x44cc('0xea')](_0x4b1b03,'amd'));_0x12eac6['createHistory'](_0x4b1b03)[_0x44cc('0xae')](loggerCatch(_0x44cc('0xeb')));if(_0x4b1b03['countbusyretry']+_0x4b1b03[_0x44cc('0xec')]+_0x4b1b03[_0x44cc('0xed')]+_0x4b1b03['countnosuchnumberretry']+_0x4b1b03[_0x44cc('0xee')]+_0x4b1b03['countabandonedretry']+_0x4b1b03[_0x44cc('0xef')]+_0x4b1b03[_0x44cc('0xf0')]>=_0x5f27ae[_0x44cc('0xf1')]){_0x12eac6[_0x44cc('0xf2')](_0x4b1b03,_0x4fb843,_0x2308e0,_0x44cc('0xf3'));}else{if(_0x4b1b03[_0x44cc('0xef')]>=_0x5f27ae[_0x44cc('0xf4')]){_0x12eac6[_0x44cc('0xf5')](_0x4b1b03,_0x4fb843,_0x2308e0,_0x44cc('0xf6'));}else{_0x12eac6[_0x44cc('0xbd')]({'active':![],'countmachineretry':_0x4b1b03[_0x44cc('0xef')],'scheduledat':moment()['add'](_0x5f27ae['dialMachineRetryFrequency'],_0x44cc('0xf7'))[_0x44cc('0x70')](_0x44cc('0xf8')),'ContactId':_0x4b1b03['ContactId'],'ListId':_0x4b1b03[_0x44cc('0xd0')],'VoiceQueueId':_0x4b1b03['VoiceQueueId']||undefined,'CampaignId':_0x4b1b03[_0x44cc('0xf9')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x4fb843({'reschedule':0x1});}}});}if(_0x46439f[_0x44cc('0x4a')]==='ivr'&&this[_0x44cc('0x1d')][_0x46439f[_0x44cc('0xb3')]][_0x44cc('0xe6')]&&_0xb21a63['value']===_0x44cc('0xdf')){delete this[_0x44cc('0x23')][_0xb21a63[_0x44cc('0xe0')]];this['updateOriginated'](this[_0x44cc('0x1d')][_0x46439f[_0x44cc('0xb3')]]);_0x3fac62=new Hangup(_0x46439f,_0xb21a63);_0x3fac62['state']=0x12;_0x3fac62[_0x44cc('0xa4')]=_0x44cc('0xfa');_0x3fac62[_0x44cc('0xe2')]=_0x44cc('0xe3');ami[_0x44cc('0x49')](_0x44cc('0xe4'),ut[_0x44cc('0xea')](_0x3fac62,'amd'));this[_0x44cc('0xdb')](_0x3fac62,_0x44cc('0xfb'),'[syncHangupInAMDIvr]');}if(_0x46439f[_0x44cc('0x4a')]==='ivr'&&this[_0x44cc('0x1d')][_0x46439f[_0x44cc('0xb3')]][_0x44cc('0xe6')]&&_0xb21a63[_0x44cc('0xe7')]===_0x44cc('0xfc')){var _0x12eac6=this;return new BPromise(function(_0x43023f,_0x3c2ba2){delete _0x12eac6[_0x44cc('0x23')][_0xb21a63['uniqueid']];_0x12eac6[_0x44cc('0xb0')](_0x12eac6[_0x44cc('0x1d')][_0x46439f[_0x44cc('0xb3')]]);_0x12eac6['campaigns'][_0x46439f[_0x44cc('0xb3')]]['outboundAnswerCallsDay']+=0x1;_0x12eac6[_0x44cc('0x1d')][_0x46439f[_0x44cc('0xb3')]][_0x44cc('0x56')]+=0x1;var _0x3e2694=_0x12eac6[_0x44cc('0x1d')][_0x46439f[_0x44cc('0xb3')]];var _0x27cbad=new Hangup(_0x46439f,_0xb21a63);_0x27cbad[_0x44cc('0xe1')]=0x13;_0x27cbad['statedesc']=_0x44cc('0xe8');_0x27cbad[_0x44cc('0xe2')]=_0x44cc('0xe3');_0x27cbad[_0x44cc('0xef')]+=0x1;_0x27cbad[_0x44cc('0xe9')]+=0x1;_0x27cbad[_0x44cc('0xe5')]=!![];ami[_0x44cc('0x49')](_0x44cc('0xe4'),ut[_0x44cc('0xea')](_0x27cbad,'amd'));_0x12eac6[_0x44cc('0xc9')](_0x27cbad)[_0x44cc('0xae')](loggerCatch(_0x44cc('0xeb')));if(_0x27cbad[_0x44cc('0xfd')]+_0x27cbad['countcongestionretry']+_0x27cbad[_0x44cc('0xed')]+_0x27cbad[_0x44cc('0xfe')]+_0x27cbad['countdropretry']+_0x27cbad[_0x44cc('0xff')]+_0x27cbad['countmachineretry']+_0x27cbad[_0x44cc('0xf0')]>=_0x3e2694[_0x44cc('0xf1')]){_0x12eac6[_0x44cc('0xf2')](_0x27cbad,_0x43023f,_0x3c2ba2,'reason19\x20machine....');}else{if(_0x27cbad[_0x44cc('0xef')]>=_0x3e2694[_0x44cc('0xf4')]){_0x12eac6[_0x44cc('0xf5')](_0x27cbad,_0x43023f,_0x3c2ba2,_0x44cc('0xf6'));}else{_0x12eac6[_0x44cc('0xbd')]({'active':![],'countmachineretry':_0x27cbad[_0x44cc('0xef')],'scheduledat':moment()[_0x44cc('0x100')](_0x3e2694[_0x44cc('0x101')],_0x44cc('0xf7'))[_0x44cc('0x70')](_0x44cc('0xf8')),'ContactId':_0x27cbad[_0x44cc('0xcf')],'ListId':_0x27cbad[_0x44cc('0xd0')],'VoiceQueueId':_0x27cbad[_0x44cc('0xd2')]||undefined,'CampaignId':_0x27cbad['CampaignId']||undefined})[_0x44cc('0xae')](loggerCatch('[rescheduleContact][Machine]'));_0x43023f({'reschedule':0x1});}}});}}};Dialer[_0x44cc('0xa7')][_0x44cc('0x31')]=function(_0x58c0fa){var _0x326a5c=this[_0x44cc('0x23')][_0x58c0fa[_0x44cc('0xe0')]];var _0x320f05=this;var _0x3cfe5f;if(_0x326a5c&&_0x326a5c[_0x44cc('0x4a')]===_0x44cc('0x72')){delete this['uniqueId'][_0x58c0fa[_0x44cc('0xe0')]];this['updateOriginated'](this[_0x44cc('0x1d')][_0x326a5c['queue']]);this[_0x44cc('0x1d')][_0x326a5c[_0x44cc('0xb3')]][_0x44cc('0x102')]+=0x1;_0x3cfe5f=new Hangup(_0x326a5c,_0x58c0fa);this['createHistory'](_0x3cfe5f)[_0x44cc('0xae')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x44cc('0xc8')](_0x3cfe5f)[_0x44cc('0xae')](loggerCatch('[syncHangupIvr]'));}if(_0x326a5c&&_0x326a5c[_0x44cc('0x4a')]!==_0x44cc('0x72')&&isNotNull(this[_0x44cc('0x1c')][_0x326a5c[_0x44cc('0xb3')]][_0x44cc('0x103')])){delete this[_0x44cc('0x23')][_0x58c0fa['uniqueid']];this[_0x44cc('0xb0')](this[_0x44cc('0x1c')][_0x326a5c[_0x44cc('0xb3')]]);this[_0x44cc('0x1c')][_0x326a5c[_0x44cc('0xb3')]]['outboundAnswerCallsDay']+=0x1;this[_0x44cc('0x1c')][_0x326a5c[_0x44cc('0xb3')]][_0x44cc('0x56')]+=0x1;_0x3cfe5f=new Hangup(_0x326a5c,_0x58c0fa);_0x3cfe5f[_0x44cc('0xe1')]=0x10;_0x3cfe5f['statedesc']='AnswerAGI';_0x3cfe5f[_0x44cc('0xe2')]=_0x44cc('0x104');this['createHistory'](_0x3cfe5f)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x44cc('0xc8')](_0x3cfe5f)[_0x44cc('0xae')](loggerCatch(_0x44cc('0x105')));}if(_0x326a5c&&_0x326a5c['type']!==_0x44cc('0x72')&&!isNotNull(this[_0x44cc('0x1c')][_0x326a5c[_0x44cc('0xb3')]][_0x44cc('0x103')])){delete this[_0x44cc('0x23')][_0x58c0fa['uniqueid']];this[_0x44cc('0xb0')](this[_0x44cc('0x1c')][_0x326a5c['queue']]);this[_0x44cc('0x1c')][_0x326a5c[_0x44cc('0xb3')]][_0x44cc('0x60')]+=0x1;_0x3cfe5f=new Hangup(_0x326a5c,_0x58c0fa);_0x3cfe5f[_0x44cc('0xe1')]=0xc;_0x3cfe5f['statedesc']=_0x58c0fa[_0x44cc('0x106')];_0x3cfe5f[_0x44cc('0xe2')]=_0x44cc('0x107');this[_0x44cc('0xc9')](_0x3cfe5f)[_0x44cc('0xae')](loggerCatch(_0x44cc('0x108')));this['moveContactManagedDialer'](_0x3cfe5f)['catch'](loggerCatch(_0x44cc('0x105')));}};Dialer[_0x44cc('0xa7')][_0x44cc('0x2e')]=function(_0x3a767f){var _0xdcf723=this['uniqueId'][_0x3a767f[_0x44cc('0xe0')]];var _0x55eef3=this;if(this['voiceQueues'][_0x3a767f[_0x44cc('0xb3')]]){if(_0xdcf723&&_0xdcf723[_0x44cc('0x4a')]!==_0x44cc('0x72')){delete this[_0x44cc('0x23')][_0x3a767f[_0x44cc('0xe0')]];this['voiceQueues'][_0x3a767f[_0x44cc('0xb3')]]['outboundAnswerCallsDay']+=0x1;var _0x524cdc=new AgentComplete(_0xdcf723,_0x3a767f);if(_0x3a767f[_0x44cc('0x109')]==='agent'){_0x524cdc[_0x44cc('0x10a')]=this[_0x44cc('0x1c')][_0x3a767f['queue']][_0x44cc('0x10b')]&&this[_0x44cc('0x1c')][_0x3a767f['queue']][_0x44cc('0x10c')]?moment()[_0x44cc('0x70')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x44cc('0xc9')](_0x524cdc)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x524cdc)[_0x44cc('0xae')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x44cc('0xa7')][_0x44cc('0x29')]=function(_0x58acdd){if(this['voiceQueues'][_0x58acdd[_0x44cc('0xb3')]]){if(this[_0x44cc('0x23')][_0x58acdd['uniqueid']]&&this[_0x44cc('0x23')][_0x58acdd['uniqueid']][_0x44cc('0x4a')]!==_0x44cc('0x72')){this[_0x44cc('0xb0')](this['voiceQueues'][_0x58acdd[_0x44cc('0xb3')]]);this['uniqueId'][_0x58acdd['uniqueid']][_0x44cc('0x10d')]=moment()[_0x44cc('0x70')](_0x44cc('0xf8'));}}};Dialer[_0x44cc('0xa7')][_0x44cc('0x10e')]=function(_0x40c948){this[_0x44cc('0xc9')](_0x40c948)[_0x44cc('0xae')](loggerCatch(_0x44cc('0x10f')));this[_0x44cc('0xc8')](_0x40c948)[_0x44cc('0xae')](loggerCatch(_0x44cc('0x110')));};Dialer[_0x44cc('0xa7')][_0x44cc('0x2c')]=function(_0x1279c6){var _0x21f669=this['uniqueId'][_0x1279c6['uniqueid']];var _0x32d017=this;if(this[_0x44cc('0x1c')][_0x1279c6[_0x44cc('0xb3')]]){if(_0x21f669&&_0x21f669[_0x44cc('0x4a')]!==_0x44cc('0x72')){delete this['uniqueId'][_0x1279c6['uniqueid']];this[_0x44cc('0xb0')](this[_0x44cc('0x1c')][_0x1279c6[_0x44cc('0xb3')]]);_0x21f669[_0x44cc('0x111')]=moment()[_0x44cc('0x70')]('YYYY-MM-DD\x20HH:mm:ss');var _0x408a2f=new QueueCallerAbandon(_0x21f669,_0x1279c6);if(getSeconds(_0x21f669[_0x44cc('0x111')],_0x21f669['responsetime'])>=_0x21f669[_0x44cc('0x112')]){this[_0x44cc('0x1c')][_0x1279c6['queue']][_0x44cc('0x64')]+=0x1;this['voiceQueues'][_0x1279c6['queue']]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x1279c6['queue']][_0x44cc('0x66')]+=0x1;_0x408a2f[_0x44cc('0xe1')]=0xa;_0x408a2f[_0x44cc('0xa4')]=_0x44cc('0x113');_0x408a2f[_0x44cc('0x114')]=_0x44cc('0x115');_0x408a2f['agiafterat']=this['voiceQueues'][_0x1279c6[_0x44cc('0xb3')]]['dialQueueProject2']?moment()[_0x44cc('0x70')](_0x44cc('0xf8')):undefined;_0x408a2f[_0x44cc('0xee')]+=0x1;_0x408a2f[_0x44cc('0xe9')]+=0x1;if(_0x408a2f[_0x44cc('0xee')]>=this['voiceQueues'][_0x1279c6[_0x44cc('0xb3')]][_0x44cc('0x116')]){this['queueCallerAbandonCreateState'](_0x408a2f);}else{this[_0x44cc('0xbd')]({'active':![],'countdropretry':_0x408a2f[_0x44cc('0xee')],'scheduledat':moment()[_0x44cc('0x100')](this['voiceQueues'][_0x1279c6[_0x44cc('0xb3')]][_0x44cc('0x117')],_0x44cc('0xf7'))[_0x44cc('0x70')](_0x44cc('0xf8')),'ContactId':_0x21f669['ContactId'],'ListId':_0x21f669[_0x44cc('0xd0')],'VoiceQueueId':_0x21f669[_0x44cc('0xd2')]||undefined,'CampaignId':_0x21f669[_0x44cc('0xf9')]||undefined})[_0x44cc('0xae')](loggerCatch(_0x44cc('0x118')));var _0x3bf444=new History(_0x408a2f);_0x3bf444['state']=0xa;_0x3bf444[_0x44cc('0xa4')]=_0x44cc('0x113');_0x3bf444[_0x44cc('0xa6')]=moment()['format'](_0x44cc('0xf8'));_0x3bf444['endtime']=_0x3bf444['starttime'];_0x3bf444[_0x44cc('0x119')]=_0x408a2f[_0x44cc('0x119')];_0x3bf444['calleridnum']=_0x408a2f[_0x44cc('0x11a')];this[_0x44cc('0xc9')](_0x3bf444)[_0x44cc('0xae')](loggerCatch(_0x44cc('0x11b')));}}else{this[_0x44cc('0x1c')][_0x1279c6[_0x44cc('0xb3')]][_0x44cc('0x63')]+=0x1;this['voiceQueues'][_0x1279c6[_0x44cc('0xb3')]][_0x44cc('0x5b')]+=0x1;_0x408a2f[_0x44cc('0xe1')]=0xb;_0x408a2f['statedesc']=_0x44cc('0x11c');_0x408a2f['dropreason']=_0x44cc('0x11d');_0x408a2f[_0x44cc('0xff')]+=0x1;_0x408a2f['countglobal']+=0x1;if(_0x408a2f['countabandonedretry']>=this[_0x44cc('0x1c')][_0x1279c6[_0x44cc('0xb3')]][_0x44cc('0x11e')]){this[_0x44cc('0x10e')](_0x408a2f);}else{this[_0x44cc('0xbd')]({'active':![],'countabandonedretry':_0x408a2f[_0x44cc('0xff')],'scheduledat':moment()[_0x44cc('0x100')](this[_0x44cc('0x1c')][_0x1279c6['queue']]['dialAbandonedRetryFrequency'],'minutes')[_0x44cc('0x70')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x21f669['ContactId'],'ListId':_0x21f669[_0x44cc('0xd0')],'VoiceQueueId':_0x21f669[_0x44cc('0xd2')]||undefined,'CampaignId':_0x21f669[_0x44cc('0xf9')]||undefined})[_0x44cc('0xae')](loggerCatch(_0x44cc('0x11f')));var _0x3bf444=new History(_0x408a2f);_0x3bf444[_0x44cc('0xe1')]=0xb;_0x3bf444[_0x44cc('0xa4')]=_0x44cc('0x11c');_0x3bf444['starttime']=moment()[_0x44cc('0x70')](_0x44cc('0xf8'));_0x3bf444[_0x44cc('0xa5')]=_0x3bf444['starttime'];_0x3bf444['calleridname']=_0x408a2f[_0x44cc('0x119')];_0x3bf444[_0x44cc('0x11a')]=_0x408a2f[_0x44cc('0x11a')];this['createHistory'](_0x3bf444)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x44cc('0xa7')]['syncNewExten']=function(_0x21b8d5){if(this[_0x44cc('0xa9')][_0x21b8d5[_0x44cc('0xe0')]]){this[_0x44cc('0xa9')][_0x21b8d5[_0x44cc('0xe0')]][_0x44cc('0xad')]=_0x21b8d5[_0x44cc('0xad')];}if(this[_0x44cc('0x23')][_0x21b8d5[_0x44cc('0xe0')]]){this[_0x44cc('0x23')][_0x21b8d5[_0x44cc('0xe0')]][_0x44cc('0xad')]=_0x21b8d5[_0x44cc('0xad')];}};Dialer[_0x44cc('0xa7')][_0x44cc('0x35')]=function(_0x4dd61a){if(strategy[this[_0x44cc('0x1c')][this[_0x44cc('0xa9')][_0x4dd61a[_0x44cc('0x120')]]['queue']][_0x44cc('0x121')]]===_0x44cc('0x16')){if(this[_0x44cc('0xa9')][_0x4dd61a[_0x44cc('0x120')]]&&_['isNil'](this['actions'][_0x4dd61a['actionid']]['locked'])&&_0x4dd61a[_0x44cc('0xd7')]==='1'&&_0x4dd61a[_0x44cc('0x122')]==='0'){if(this[_0x44cc('0x1e')][_0x4dd61a[_0x44cc('0x123')]]){if(!this['agents'][_0x4dd61a[_0x44cc('0x123')]]['locked']){this[_0x44cc('0x1e')][_0x4dd61a['stateinterface']][_0x44cc('0x124')]=!![];this[_0x44cc('0xa9')][_0x4dd61a[_0x44cc('0x120')]][_0x44cc('0x124')]=!![];this['actions'][_0x4dd61a['actionid']][_0x44cc('0x123')]=_0x4dd61a[_0x44cc('0x123')];}}}}else if((strategy[this[_0x44cc('0x1c')][this[_0x44cc('0xa9')][_0x4dd61a[_0x44cc('0x120')]][_0x44cc('0xb3')]][_0x44cc('0x121')]]||_0x44cc('0x125'))===_0x44cc('0x125')){if(this[_0x44cc('0xa9')][_0x4dd61a[_0x44cc('0x120')]]){if(this[_0x44cc('0x1e')][_0x4dd61a[_0x44cc('0x123')]]){this[_0x44cc('0xa9')][_0x4dd61a[_0x44cc('0x120')]]['stateinterface']=_0x4dd61a[_0x44cc('0x123')];if(_[_0x44cc('0xab')](this['queueBooked'][this['actions'][_0x4dd61a[_0x44cc('0x120')]]['queue']])){this[_0x44cc('0x28')][this['actions'][_0x4dd61a[_0x44cc('0x120')]]['queue']]=[];}this[_0x44cc('0x28')][this['actions'][_0x4dd61a['actionid']][_0x44cc('0xb3')]][_0x44cc('0x126')](_['merge'](_[_0x44cc('0x127')](this[_0x44cc('0xa9')][_0x4dd61a[_0x44cc('0x120')]],[_0x44cc('0x128'),_0x44cc('0x123')]),{'status':_0x4dd61a[_0x44cc('0xd7')],'paused':_0x4dd61a[_0x44cc('0x122')]}));}}}};function unlockQueueStatus(_0x9d53d,_0x374329){setTimeout(function(){if(_[_0x44cc('0x3a')](_0x9d53d[_0x44cc('0x129')])){loggerBooked[_0x44cc('0x8f')](_0x44cc('0x12a'),_0x374329);}_0x9d53d[_0x44cc('0x129')]=!![];loggerBooked[_0x44cc('0x74')](_0x44cc('0x12b'),_0x374329,JSON[_0x44cc('0x12c')](_['pick'](_0x9d53d,['name',_0x44cc('0x129')])));},0x1f3);}Dialer[_0x44cc('0xa7')][_0x44cc('0x37')]=function(_0x35d872){var _0x13cccd=this;var _0x147ca4=_0x13cccd[_0x44cc('0x1c')][_0x13cccd['actions'][_0x35d872[_0x44cc('0x120')]][_0x44cc('0xb3')]];if(strategy[this[_0x44cc('0x1c')][this[_0x44cc('0xa9')][_0x35d872['actionid']][_0x44cc('0xb3')]][_0x44cc('0x121')]]===_0x44cc('0x16')){if(this['actions'][_0x35d872[_0x44cc('0x120')]]&&this['actions'][_0x35d872[_0x44cc('0x120')]]['stateinterface']){this['preview'][_0x44cc('0x12d')](this[_0x44cc('0xa9')][_0x35d872[_0x44cc('0x120')]][_0x44cc('0x128')],this[_0x44cc('0xa9')][_0x35d872['actionid']][_0x44cc('0x123')])['catch'](function(_0x1aa8e4){logger[_0x44cc('0x8f')](_0x44cc('0x12e'),util[_0x44cc('0x90')](_0x1aa8e4,{'showHidden':![],'depth':null}));})[_0x44cc('0x19')](function(){_0x13cccd[_0x44cc('0xb0')](_0x13cccd[_0x44cc('0x1c')][_0x13cccd[_0x44cc('0xa9')][_0x35d872['actionid']]['queue']]);_0x13cccd[_0x44cc('0x1e')][_0x13cccd[_0x44cc('0xa9')][_0x35d872[_0x44cc('0x120')]]['stateinterface']][_0x44cc('0x124')]=![];delete _0x13cccd['actions'][_0x35d872[_0x44cc('0x120')]];unlockQueueStatus(_0x147ca4);});}else{this['updateOriginated'](this[_0x44cc('0x1c')][this[_0x44cc('0xa9')][_0x35d872[_0x44cc('0x120')]][_0x44cc('0xb3')]]);this[_0x44cc('0xbd')]({'active':![],'ContactId':this[_0x44cc('0xa9')][_0x35d872[_0x44cc('0x120')]][_0x44cc('0xcf')],'ListId':this[_0x44cc('0xa9')][_0x35d872[_0x44cc('0x120')]][_0x44cc('0xd0')],'VoiceQueueId':this[_0x44cc('0xa9')][_0x35d872[_0x44cc('0x120')]][_0x44cc('0xd2')]||undefined,'CampaignId':this['actions'][_0x35d872['actionid']][_0x44cc('0xf9')]||undefined})[_0x44cc('0xae')](loggerCatch(_0x44cc('0x12f')));delete this[_0x44cc('0xa9')][_0x35d872['actionid']];unlockQueueStatus(_0x147ca4);}}else if((strategy[this[_0x44cc('0x1c')][this[_0x44cc('0xa9')][_0x35d872[_0x44cc('0x120')]]['queue']][_0x44cc('0x121')]]||'rrmemory')===_0x44cc('0x125')){var _0x4af55c;if(this[_0x44cc('0xa9')][_0x35d872['actionid']]&&!_['isEmpty'](this[_0x44cc('0x28')][this[_0x44cc('0xa9')][_0x35d872[_0x44cc('0x120')]][_0x44cc('0xb3')]])){if(this[_0x44cc('0x130')][_0x13cccd[_0x44cc('0xa9')][_0x35d872['actionid']][_0x44cc('0xb3')]]){this[_0x44cc('0x130')][_0x13cccd[_0x44cc('0xa9')][_0x35d872[_0x44cc('0x120')]][_0x44cc('0xb3')]]=this[_0x44cc('0x130')][this[_0x44cc('0xa9')][_0x35d872['actionid']][_0x44cc('0xb3')]]?this['queueBookedRR'][this['actions'][_0x35d872[_0x44cc('0x120')]][_0x44cc('0xb3')]]:this[_0x44cc('0x28')][this['actions'][_0x35d872[_0x44cc('0x120')]][_0x44cc('0xb3')]]?this['queueBooked'][this[_0x44cc('0xa9')][_0x35d872['actionid']][_0x44cc('0xb3')]][_0x44cc('0x131')]||0x0:0x0;}this[_0x44cc('0x28')][this[_0x44cc('0xa9')][_0x35d872['actionid']][_0x44cc('0xb3')]]['_rr']=this[_0x44cc('0x130')][this[_0x44cc('0xa9')][_0x35d872[_0x44cc('0x120')]]['queue']];for(var _0x53b506=0x0;_0x53b506=0x0;})[_0x44cc('0xae')](myreject(_0x156895)));}}else{_0x360492[_0x44cc('0x126')](ami[_0x44cc('0xac')]({'action':'command','command':util['format']('iftime\x20%s,%s',_0xc83c4e,!_[_0x44cc('0x3a')](config[_0x44cc('0x145')][_0x33423d])?_0x33423d:'')})[_0x44cc('0xb5')](function(_0x2b1b37){return _0x2b1b37[_0x44cc('0x14e')][_0x44cc('0x14c')](_0x44cc('0x14d'))>=0x0;})[_0x44cc('0xae')](myreject(_0x156895)));}BPromise['all'](_0x360492)[_0x44cc('0xb5')](function(_0x3c8222){var _0x254d17=_[_0x44cc('0x14f')](_0x3c8222);if(_0x254d17){return _0xc734b2(_0x254d17);}else{_0x34c188[_0x44cc('0x3d')]=_0x507024?_0x44cc('0x150'):_0x44cc('0x151');return _0x156895(msgResponse(_0x44cc('0x152'),_0x44cc('0x141'),_0x44cc('0x153')+_0x507024+'\x20'+_0x4b9af6+'\x20Interval\x20is\x20overtime:\x20'+util[_0x44cc('0x90')](_0xc83c4e,{'showHidden':![],'depth':null})+_0x44cc('0x154')+_0x33423d));}})[_0x44cc('0xae')](function(_0x19b254){return _0x156895(msgResponse(_0x44cc('0x13f'),_0x44cc('0x141'),JSON[_0x44cc('0x12c')](_0x19b254)));});});};Dialer[_0x44cc('0xa7')]['checkDialMethod']=function(_0x577cc1){var _0x124204=this;return function(){switch(_0x577cc1[_0x44cc('0x51')]){case _0x44cc('0x155'):freeVariablesPredictive(_0x577cc1);_0x124204[_0x44cc('0x156')](_0x577cc1,0x1);break;case _0x44cc('0x157'):freeVariablesPredictive(_0x577cc1);_0x124204['handlePower'](_0x577cc1,_0x577cc1['dialPowerLevel']);break;case'predictive':_0x124204[_0x44cc('0x9')](_0x577cc1);break;case _0x44cc('0x158'):freeVariablesPredictive(_0x577cc1);_0x124204[_0x44cc('0x156')](_0x577cc1,0x1);break;default:freeVariablesPredictive(_0x577cc1);logger['error']('Queue',_0x577cc1[_0x44cc('0x3f')],_0x44cc('0x159'));}};};Dialer['prototype'][_0x44cc('0x15a')]=function(_0x3d6078){var _0x2ef117=this;return function(){_0x2ef117[_0x44cc('0x15b')](_0x3d6078);};};Dialer[_0x44cc('0xa7')]['syncQueueSummary']=function(_0x34ef80){var _0x18ab60=this;if(isNotPreview(_0x34ef80[_0x44cc('0x51')])){if(isVoiceQueueOutbound(_0x34ef80[_0x44cc('0x4a')])&&isActive(_0x34ef80[_0x44cc('0x50')])){_0x34ef80[_0x44cc('0x9b')]=!![];BPromise['resolve']()[_0x44cc('0xb5')](checkIsLoggedIn(_0x34ef80,_0x34ef80['loggedIn']))[_0x44cc('0xb5')](checkIsActive(_0x34ef80,_0x34ef80[_0x44cc('0x50')]))[_0x44cc('0xb5')](checkInterval(_0x34ef80))[_0x44cc('0xb5')](_0x18ab60['checkIsTrunkReachable'](_0x34ef80))['then'](_0x18ab60[_0x44cc('0x13e')](_0x34ef80[_0x44cc('0x15c')],_0x34ef80[_0x44cc('0x15d')],_0x34ef80[_0x44cc('0x3f')],_0x34ef80))['then'](_0x18ab60[_0x44cc('0x140')](_0x34ef80['Interval'],_0x34ef80[_0x44cc('0x15d')],_0x34ef80[_0x44cc('0x3f')],_0x34ef80))['then'](_0x18ab60['checkDialMethod'](_0x34ef80))[_0x44cc('0xae')](loggerCatchQueueSummary(_0x44cc('0x15e'),_0x34ef80));}else{notSendMessagesQueue(_0x34ef80);}}else{freeVariablesPredictive(_0x34ef80);}};Dialer[_0x44cc('0xa7')][_0x44cc('0x13b')]=function(){var _0x5eaa0c=this;var _0x3e3424;for(var _0x515093 in this[_0x44cc('0x1d')]){if(typeof this[_0x44cc('0x1d')][_0x515093]!=='undefined'){_0x3e3424=this[_0x44cc('0x1d')][_0x515093];if(isCampaignIvr(_0x3e3424[_0x44cc('0x4a')])&&isActive(_0x3e3424[_0x44cc('0x6e')])){_0x3e3424[_0x44cc('0x9b')]=!![];BPromise['resolve']()[_0x44cc('0xb5')](checkIsActive(_0x3e3424,_0x3e3424[_0x44cc('0x6e')]))[_0x44cc('0xb5')](checkInterval(_0x3e3424))[_0x44cc('0xb5')](_0x5eaa0c[_0x44cc('0x13c')](_0x3e3424))[_0x44cc('0xb5')](_0x5eaa0c['checkIfTime'](_0x3e3424[_0x44cc('0x15c')],_0x3e3424[_0x44cc('0x15d')],_0x3e3424['name'],_0x3e3424))[_0x44cc('0xb5')](_0x5eaa0c[_0x44cc('0x140')](_0x3e3424[_0x44cc('0x41')],_0x3e3424[_0x44cc('0x15d')],_0x3e3424[_0x44cc('0x3f')],_0x3e3424))['then'](_0x5eaa0c[_0x44cc('0x15a')](_0x3e3424))[_0x44cc('0xae')](loggerCatchQueueSummary('[syncCampaigns]',_0x3e3424));}else{notSendMessagesCampaign(_0x3e3424);}}}};function getCallerIdRandom(_0x465cce,_0x250ccf){var _0x44654a;var _0x579af8;var _0x5685e1;if(_0x250ccf<=0x0){_0x250ccf=0x1;}_0x44654a=new RegExp(_0x44cc('0x15f')+_0x250ccf+'}$');_0x579af8=Math[_0x44cc('0x160')](0xa,_0x250ccf-0x1);_0x5685e1=Math[_0x44cc('0x160')](0xa,_0x250ccf)-0x1;return util[_0x44cc('0x70')]('%s',_[_0x44cc('0x161')](_0x465cce,_0x44654a,_[_0x44cc('0x162')](_0x579af8,_0x5685e1)));}function extractCalleridName(_0x319cd9){var _0x1010d9=_0x319cd9[_0x44cc('0x163')](/"(.*?)"/);return _0x1010d9?_0x1010d9[0x1]:_0x319cd9;}function extractCalleridNumber(_0x5990b7){var _0x1640b5=_0x5990b7[_0x44cc('0x163')](/<(.*?)>/);return _0x1640b5?_0x1640b5[0x1]:_0x5990b7;}Dialer['prototype'][_0x44cc('0x164')]=function(_0x101c37,_0x2f25ed){var _0x13e1de=this;var _0x4db6a0=uuid['v4']();this['actions'][_0x4db6a0]=new Action(_0x101c37,_0x2f25ed,_0x4db6a0);return new BPromise(function(_0x3328a9,_0x5c4858){if(_[_0x44cc('0x3a')](_0x101c37)&&typeof _0x101c37!==_0x44cc('0x165')){return _0x5c4858(msgResponse(_0x44cc('0x166'),_0x44cc('0x141'),_0x44cc('0x167')));}if(_[_0x44cc('0x3a')](_0x2f25ed[_0x44cc('0x168')]['phone'])||_0x2f25ed[_0x44cc('0x168')]['phone']===null){return _0x5c4858(msgResponse('originate',_0x44cc('0x141'),_0x44cc('0x169')));}var _0x217e9e={'XMD-CALLERID':_0x13e1de[_0x44cc('0xa9')][_0x4db6a0][_0x44cc('0x16a')](),'XMD-AGI':_0x101c37[_0x44cc('0x103')]?util[_0x44cc('0x70')](_0x44cc('0x16b'),ipAgi,_0x101c37['dialQueueProject']):_0x44cc('0x16c'),'XMD-AGIAFTER':_0x101c37[_0x44cc('0x10b')]?util[_0x44cc('0x70')](_0x44cc('0x16b'),ipAgi,_0x101c37['dialQueueProject2']):_0x44cc('0x16c'),'XMD-QUEUE':_0x101c37[_0x44cc('0x4a')]===_0x44cc('0x8c')?util[_0x44cc('0x70')]('\x22%s,%s%s,,,%s\x22',_0x101c37[_0x44cc('0x3f')],_0x101c37[_0x44cc('0x16d')]||'',_0x101c37[_0x44cc('0x10c')]?'c':'',_0x101c37[_0x44cc('0x112')]||0x3):_0x44cc('0x16c'),'XMD-CONTACTID':_0x2f25ed['ContactId'],'XMD-CDRTYPE':_0x44cc('0x7'),'CALLERID(all)':_0x13e1de['actions'][_0x4db6a0][_0x44cc('0x16a')](),'XMD-AMD':_0x101c37[_0x44cc('0xe6')]?_0x44cc('0x16e'):_0x44cc('0x16c'),'XMD-DESTINATION':_0x44cc('0xde')};if(_0x101c37[_0x44cc('0xe6')]){_0x217e9e['XMD-AMDINITIALSILENCE']=_0x101c37['dialAMDInitialSilence']||0x9c4;_0x217e9e['XMD-AMDGREETING']=_0x101c37[_0x44cc('0x16f')]||0x5dc;_0x217e9e['XMD-AMDAFTERGREETINGSILENCE']=_0x101c37[_0x44cc('0x170')]||0x320;_0x217e9e[_0x44cc('0x171')]=_0x101c37['dialAMDTotalAnalysisTime']||0x1388;_0x217e9e[_0x44cc('0x172')]=_0x101c37[_0x44cc('0x173')]||0x64;_0x217e9e[_0x44cc('0x174')]=_0x101c37['dialAMDBetweenWordsSilence']||0x32;_0x217e9e[_0x44cc('0x175')]=_0x101c37[_0x44cc('0x176')]||0x3;_0x217e9e['XMD-AMDSILENCETHRESHOLD']=_0x101c37[_0x44cc('0x177')]||0x100;_0x217e9e[_0x44cc('0x178')]=_0x101c37['dialAMDMaximumWordLength']||0x1388;}if(_0x101c37[_0x44cc('0x4a')]==='outbound'){_0x217e9e[_0x44cc('0x179')]=_0x2f25ed['VoiceQueueId'];}else{_0x217e9e['XMD-CAMPAIGNID']=_0x2f25ed[_0x44cc('0xf9')];}for(var _0x188e2f in _0x2f25ed['Contact']){if(typeof _0x2f25ed['Contact'][_0x188e2f]!==_0x44cc('0x94')){if(isNotNull(_0x2f25ed[_0x44cc('0x168')][_0x188e2f])&&_0x188e2f!=='id'&&_0x188e2f!=='tags'&&_0x188e2f!==_0x44cc('0x17a')&&_0x188e2f!==_0x44cc('0x17b')){_0x217e9e[util[_0x44cc('0x70')](_0x44cc('0x17c'),_0x44cc('0x17d'),_[_0x44cc('0x17e')](_0x188e2f))]=_0x2f25ed['Contact'][_0x188e2f];}}}var _0x1a1fe0=_0x13e1de['isTrunkReachable'](_0x101c37[_0x44cc('0x6d')])?getCallerId(_0x101c37[_0x44cc('0x6d')][_0x44cc('0x6f')],_0x101c37[_0x44cc('0x52')],_0x101c37['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x101c37[_0x44cc('0x53')],_0x101c37[_0x44cc('0x17f')]):_0x101c37[_0x44cc('0x53')]):getCallerId(_[_0x44cc('0xab')](_0x101c37['TrunkBackup'])?_0x101c37['Trunk'][_0x44cc('0x6f')]:_0x101c37[_0x44cc('0x13d')][_0x44cc('0x6f')],_0x101c37[_0x44cc('0x52')],_0x101c37[_0x44cc('0x17f')]>0x0?getCallerIdRandom(_0x101c37[_0x44cc('0x53')],_0x101c37[_0x44cc('0x17f')]):_0x101c37[_0x44cc('0x53')]);if(_0x1a1fe0){_0x217e9e[_0x44cc('0x180')]=_0x13e1de[_0x44cc('0xa9')][_0x4db6a0][_0x44cc('0x181')]=extractCalleridName(_0x1a1fe0);_0x217e9e[_0x44cc('0x182')]=_0x13e1de['actions'][_0x4db6a0][_0x44cc('0x183')]=extractCalleridNumber(_0x1a1fe0);}return ami[_0x44cc('0xac')]({'actionid':_0x4db6a0,'action':'originate','channel':_0x13e1de[_0x44cc('0xd6')](_0x101c37[_0x44cc('0x6d')])?util[_0x44cc('0x70')](_0x44cc('0x184'),_0x101c37[_0x44cc('0x6d')][_0x44cc('0x3f')],isNotNull(_0x101c37['dialPrefix'])?_0x101c37['dialPrefix'][_0x44cc('0x185')]()||'':'',_0x101c37[_0x44cc('0x186')]>0x0?_0x2f25ed['Contact']['phone'][_0x44cc('0x187')](_0x101c37['dialCutDigit']):_0x2f25ed[_0x44cc('0x168')][_0x44cc('0x188')]):util[_0x44cc('0x70')](_0x44cc('0x184'),_[_0x44cc('0xab')](_0x101c37[_0x44cc('0x13d')])?_0x101c37['Trunk'][_0x44cc('0x3f')]:_0x101c37['TrunkBackup'][_0x44cc('0x3f')],isNotNull(_0x101c37[_0x44cc('0x55')])?_0x101c37[_0x44cc('0x55')][_0x44cc('0x185')]()||'':'',_0x101c37[_0x44cc('0x186')]>0x0?_0x2f25ed['Contact'][_0x44cc('0x188')][_0x44cc('0x187')](_0x101c37[_0x44cc('0x186')]):_0x2f25ed[_0x44cc('0x168')][_0x44cc('0x188')]),'callerid':_0x1a1fe0,'Exten':_0x44cc('0xde'),'Context':_0x44cc('0x189'),'Priority':'1','variable':_0x217e9e,'timeout':(_0x101c37[_0x44cc('0x54')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4db6a0})[_0x44cc('0xb5')](function(_0x423da7){return _0x3328a9(_0x423da7);})[_0x44cc('0xae')](function(_0x14d8a7){_0x101c37[_0x44cc('0x5e')]+=0x1;var _0x5c4c92=new History(_0x13e1de[_0x44cc('0xa9')][_0x4db6a0]);logger[_0x44cc('0x8f')](util['format'](_0x44cc('0x18a'),JSON[_0x44cc('0x12c')](_0x14d8a7)));_0x5c4c92[_0x44cc('0xe1')]=0xe;_0x5c4c92[_0x44cc('0xa4')]=_0x44cc('0x18b');_0x5c4c92['starttime']=moment()['format'](_0x44cc('0xf8'));_0x5c4c92[_0x44cc('0xa5')]=_0x5c4c92[_0x44cc('0xa6')];_0x13e1de[_0x44cc('0xc9')](_0x5c4c92)[_0x44cc('0xae')](loggerCatch(_0x44cc('0x18c')));_0x13e1de[_0x44cc('0xc8')](_0x5c4c92)['catch'](loggerCatch(_0x44cc('0x18c')))[_0x44cc('0x19')](function(){delete _0x13e1de[_0x44cc('0xa9')][_0x4db6a0];return _0x5c4858(msgResponse(_0x44cc('0x166'),_0x44cc('0x46'),_0x44cc('0x18d')));});});});};Dialer[_0x44cc('0xa7')]['syncOriginateResponse']=function(_0x1788cb){var _0x4110ba=this['actions'][_0x1788cb[_0x44cc('0x120')]];if(_0x4110ba){delete this[_0x44cc('0xa9')][_0x1788cb[_0x44cc('0x120')]];_0x4110ba['responsetime']=moment()['format'](_0x44cc('0xf8'));var _0x3ddeea=_0x4110ba[_0x44cc('0x4a')]===_0x44cc('0x72')?this[_0x44cc('0x1d')][_0x4110ba[_0x44cc('0xb3')]]:this[_0x44cc('0x1c')][_0x4110ba['getQueue']()];if(!this['isSuccess'](_0x1788cb[_0x44cc('0x18e')])){this[_0x44cc('0xb0')](_0x3ddeea);return this[_0x44cc('0x18f')](_0x4110ba,_0x3ddeea,_0x1788cb)['catch'](loggerCatch('[callProgressDetecting]\x20'));}this[_0x44cc('0x23')][_0x1788cb[_0x44cc('0xe0')]]=_0x4110ba;}};Dialer['prototype'][_0x44cc('0x190')]=function(_0x3f8987,_0x12570e,_0x2cce25){var _0x1ec6e8=new History(_0x12570e);if(_0x1ec6e8[_0x44cc('0xfd')]+_0x1ec6e8[_0x44cc('0xec')]+_0x1ec6e8[_0x44cc('0xed')]+_0x1ec6e8['countnosuchnumberretry']+_0x1ec6e8['countdropretry']+_0x1ec6e8[_0x44cc('0xff')]+_0x1ec6e8[_0x44cc('0xef')]+_0x1ec6e8[_0x44cc('0xf0')]>=_0x2cce25[_0x44cc('0xf1')]-0x1){return!![];}switch(_0x3f8987){case 0x3:if(_0x1ec6e8[_0x44cc('0xed')]>=_0x2cce25[_0x44cc('0x191')]-0x1){return!![];}this[_0x44cc('0xbd')]({'active':![],'countnoanswerretry':_0x1ec6e8[_0x44cc('0xed')]+=0x1,'scheduledat':moment()[_0x44cc('0x100')](_0x2cce25['dialNoAnswerRetryFrequency'],_0x44cc('0xf7'))[_0x44cc('0x70')](_0x44cc('0xf8')),'ContactId':_0x1ec6e8[_0x44cc('0xcf')],'ListId':_0x1ec6e8[_0x44cc('0xd0')],'VoiceQueueId':_0x1ec6e8['VoiceQueueId']||undefined,'CampaignId':_0x1ec6e8[_0x44cc('0xf9')]||undefined})[_0x44cc('0xae')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x1ec6e8['countbusyretry']>=_0x2cce25[_0x44cc('0x192')]-0x1){return!![];}this[_0x44cc('0xbd')]({'active':![],'countbusyretry':_0x1ec6e8[_0x44cc('0xfd')]+=0x1,'scheduledat':moment()[_0x44cc('0x100')](_0x2cce25['dialBusyRetryFrequency'],_0x44cc('0xf7'))[_0x44cc('0x70')](_0x44cc('0xf8')),'ContactId':_0x1ec6e8[_0x44cc('0xcf')],'ListId':_0x1ec6e8[_0x44cc('0xd0')],'VoiceQueueId':_0x1ec6e8[_0x44cc('0xd2')]||undefined,'CampaignId':_0x1ec6e8[_0x44cc('0xf9')]||undefined})[_0x44cc('0xae')](loggerCatch(_0x44cc('0x193')));break;case 0x8:if(_0x1ec6e8[_0x44cc('0xec')]>=_0x2cce25['dialCongestionMaxRetry']-0x1){return!![];}this[_0x44cc('0xbd')]({'active':![],'countcongestionretry':_0x1ec6e8[_0x44cc('0xec')]+=0x1,'scheduledat':moment()[_0x44cc('0x100')](_0x2cce25[_0x44cc('0x194')],_0x44cc('0xf7'))[_0x44cc('0x70')](_0x44cc('0xf8')),'ContactId':_0x1ec6e8['ContactId'],'ListId':_0x1ec6e8[_0x44cc('0xd0')],'VoiceQueueId':_0x1ec6e8[_0x44cc('0xd2')]||undefined,'CampaignId':_0x1ec6e8[_0x44cc('0xf9')]||undefined})[_0x44cc('0xae')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x1ec6e8[_0x44cc('0xfe')]>=_0x2cce25[_0x44cc('0x195')]-0x1){return!![];}else{this[_0x44cc('0xbd')]({'active':![],'countnosuchnumberretry':_0x1ec6e8[_0x44cc('0xfe')]+=0x1,'scheduledat':moment()['add'](_0x2cce25[_0x44cc('0x196')],_0x44cc('0xf7'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1ec6e8[_0x44cc('0xcf')],'ListId':_0x1ec6e8[_0x44cc('0xd0')],'VoiceQueueId':_0x1ec6e8[_0x44cc('0xd2')]||undefined,'CampaignId':_0x1ec6e8['CampaignId']||undefined})[_0x44cc('0xae')](loggerCatch(_0x44cc('0x197')));}break;case 0xa:if(_0x1ec6e8[_0x44cc('0xee')]>=_0x2cce25[_0x44cc('0x116')]-0x1){return!![];}this[_0x44cc('0xbd')]({'active':![],'countdropretry':_0x1ec6e8[_0x44cc('0xee')]+=0x1,'scheduledat':moment()[_0x44cc('0x100')](_0x2cce25[_0x44cc('0x117')],_0x44cc('0xf7'))[_0x44cc('0x70')](_0x44cc('0xf8')),'ContactId':_0x1ec6e8['ContactId'],'ListId':_0x1ec6e8[_0x44cc('0xd0')],'VoiceQueueId':_0x1ec6e8[_0x44cc('0xd2')]||undefined,'CampaignId':_0x1ec6e8[_0x44cc('0xf9')]||undefined})[_0x44cc('0xae')](loggerCatch(_0x44cc('0x118')));break;case 0xb:if(_0x1ec6e8[_0x44cc('0xff')]>=_0x2cce25['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x44cc('0xbd')]({'active':![],'countabandonedretry':_0x1ec6e8[_0x44cc('0xff')]+=0x1,'scheduledat':moment()['add'](_0x2cce25[_0x44cc('0x198')],_0x44cc('0xf7'))[_0x44cc('0x70')](_0x44cc('0xf8')),'ContactId':_0x1ec6e8['ContactId'],'ListId':_0x1ec6e8['ListId'],'VoiceQueueId':_0x1ec6e8[_0x44cc('0xd2')]||undefined,'CampaignId':_0x1ec6e8[_0x44cc('0xf9')]||undefined})[_0x44cc('0xae')](loggerCatch(_0x44cc('0x11f')));break;case 0x13:if(_0x1ec6e8[_0x44cc('0xef')]>=_0x2cce25[_0x44cc('0xf4')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x1ec6e8['countmachineretry']+=0x1,'scheduledat':moment()[_0x44cc('0x100')](_0x2cce25[_0x44cc('0x101')],_0x44cc('0xf7'))[_0x44cc('0x70')](_0x44cc('0xf8')),'ContactId':_0x1ec6e8[_0x44cc('0xcf')],'ListId':_0x1ec6e8[_0x44cc('0xd0')],'VoiceQueueId':_0x1ec6e8[_0x44cc('0xd2')]||undefined,'CampaignId':_0x1ec6e8[_0x44cc('0xf9')]||undefined})[_0x44cc('0xae')](loggerCatch(_0x44cc('0x199')));break;case 0x14:if(_0x1ec6e8[_0x44cc('0xf0')]>=_0x2cce25[_0x44cc('0x19a')]-0x1){return!![];}this[_0x44cc('0xbd')]({'active':![],'countagentrejectretry':_0x1ec6e8['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x44cc('0x100')](_0x2cce25[_0x44cc('0x19b')],_0x44cc('0xf7'))[_0x44cc('0x70')](_0x44cc('0xf8')),'ContactId':_0x1ec6e8[_0x44cc('0xcf')],'ListId':_0x1ec6e8[_0x44cc('0xd0')],'VoiceQueueId':_0x1ec6e8[_0x44cc('0xd2')]||undefined,'CampaignId':_0x1ec6e8[_0x44cc('0xf9')]||undefined})[_0x44cc('0xae')](loggerCatch(_0x44cc('0x19c')));break;default:return!![];}};Dialer[_0x44cc('0xa7')][_0x44cc('0x18f')]=function(_0x2d6e79,_0x3b2b43,_0x4029cb){var _0x7f87d6=this;var _0x2c5a93=new History(_0x2d6e79);return new BPromise(function(_0x4b50ea,_0x4caf3b){if(_[_0x44cc('0x3a')](_0x3b2b43)&&typeof _0x3b2b43!==_0x44cc('0x165')){return _0x4caf3b(msgResponse('[callProgressDetecting]',_0x44cc('0x141'),'entity\x20is\x20undefine'));}if(_[_0x44cc('0x3a')](_0x4029cb)&&typeof _0x4029cb!=='object'){return _0x4caf3b(msgResponse('[callProgressDetecting]',_0x44cc('0x141'),_0x44cc('0x19d')));}switch(_0x4029cb[_0x44cc('0x109')]){case'0':_0x3b2b43[_0x44cc('0x5d')]+=0x1;_0x2c5a93[_0x44cc('0xe1')]=0x0;_0x2c5a93['statedesc']=_0x44cc('0x19e');_0x2c5a93[_0x44cc('0xfe')]+=0x1;_0x2c5a93[_0x44cc('0xe9')]+=0x1;ami[_0x44cc('0x49')]('custom:agentnosuchnumber',ut[_0x44cc('0xea')](_0x2d6e79,_0x44cc('0x19f')));_0x7f87d6['createHistory'](_0x2c5a93)[_0x44cc('0xae')](loggerCatch(_0x44cc('0xeb')));if(_0x7f87d6[_0x44cc('0x190')](0x0,_0x2d6e79,_0x3b2b43)){if(_0x2c5a93[_0x44cc('0xfe')]>=_0x3b2b43['dialNoSuchNumberMaxRetry']){_0x7f87d6[_0x44cc('0xf5')](_0x2c5a93,_0x4b50ea,_0x4caf3b,'reason\x200\x20no\x20such\x20number....');}else{_0x7f87d6[_0x44cc('0xf2')](_0x2c5a93,_0x4b50ea,_0x4caf3b,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x3b2b43[_0x44cc('0x1a0')]+=0x1;_0x2c5a93[_0x44cc('0xe1')]=0x3;_0x2c5a93[_0x44cc('0xa4')]=_0x44cc('0x1a1');_0x2c5a93[_0x44cc('0xed')]+=0x1;_0x2c5a93[_0x44cc('0xe9')]+=0x1;ami['emit'](_0x44cc('0x1a2'),ut[_0x44cc('0xea')](_0x2d6e79,_0x44cc('0x1a3')));_0x7f87d6['createHistory'](_0x2c5a93)[_0x44cc('0xae')](loggerCatch(_0x44cc('0x1a4')));if(_0x7f87d6[_0x44cc('0x190')](0x3,_0x2d6e79,_0x3b2b43)){if(_0x2c5a93[_0x44cc('0xed')]>=_0x3b2b43['dialNoAnswerMaxRetry']){_0x7f87d6[_0x44cc('0xf5')](_0x2c5a93,_0x4b50ea,_0x4caf3b,_0x44cc('0x1a5'));}else{_0x7f87d6[_0x44cc('0xf2')](_0x2c5a93,_0x4b50ea,_0x4caf3b,_0x44cc('0x1a5'));}}break;case'5':_0x3b2b43[_0x44cc('0x58')]+=0x1;_0x2c5a93[_0x44cc('0xe1')]=0x5;_0x2c5a93['statedesc']=_0x44cc('0x1a6');_0x2c5a93[_0x44cc('0xfd')]+=0x1;_0x2c5a93['countglobal']+=0x1;ami[_0x44cc('0x49')]('custom:agentbusy',ut[_0x44cc('0xea')](_0x2d6e79,_0x44cc('0x1a7')));_0x7f87d6[_0x44cc('0xc9')](_0x2c5a93)['catch'](loggerCatch(_0x44cc('0x1a8')));if(_0x7f87d6[_0x44cc('0x190')](0x5,_0x2d6e79,_0x3b2b43)){if(_0x2c5a93[_0x44cc('0xfd')]>=_0x3b2b43[_0x44cc('0x192')]){_0x7f87d6[_0x44cc('0xf5')](_0x2c5a93,_0x4b50ea,_0x4caf3b,'reason\x205\x20busy');}else{_0x7f87d6[_0x44cc('0xf2')](_0x2c5a93,_0x4b50ea,_0x4caf3b,_0x44cc('0x1a9'));}}break;case'8':_0x3b2b43[_0x44cc('0x59')]+=0x1;_0x2c5a93[_0x44cc('0xe1')]=0x8;_0x2c5a93[_0x44cc('0xa4')]=_0x44cc('0x1aa');_0x2c5a93[_0x44cc('0xec')]+=0x1;_0x2c5a93[_0x44cc('0xe9')]+=0x1;ami['emit']('custom:agentcongestion',ut[_0x44cc('0xea')](_0x2d6e79,_0x44cc('0x1ab')));_0x7f87d6[_0x44cc('0xc9')](_0x2c5a93)[_0x44cc('0xae')](loggerCatch(_0x44cc('0x1ac')));if(_0x7f87d6[_0x44cc('0x190')](0x8,_0x2d6e79,_0x3b2b43)){if(_0x2c5a93[_0x44cc('0xec')]>=_0x3b2b43[_0x44cc('0x1ad')]){_0x7f87d6[_0x44cc('0xf5')](_0x2c5a93,_0x4b50ea,_0x4caf3b,_0x44cc('0x1ae'));}else{_0x7f87d6[_0x44cc('0xf2')](_0x2c5a93,_0x4b50ea,_0x4caf3b,'reason\x208\x20congestion');}}break;case'11':_0x3b2b43[_0x44cc('0x1af')]+=0x1;_0x2c5a93['state']=0xb;_0x2c5a93[_0x44cc('0xa4')]=_0x44cc('0x11c');_0x2c5a93[_0x44cc('0xff')]+=0x1;_0x2c5a93['countglobal']+=0x1;_0x7f87d6['createHistory'](_0x2c5a93)[_0x44cc('0xae')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x7f87d6['checkRetriveMax'](0xb,_0x2d6e79,_0x3b2b43)){if(_0x2c5a93[_0x44cc('0xff')]>=_0x3b2b43[_0x44cc('0x11e')]){_0x7f87d6[_0x44cc('0xf5')](_0x2c5a93,_0x4b50ea,_0x4caf3b,_0x44cc('0x1b0'));}else{_0x7f87d6[_0x44cc('0xf2')](_0x2c5a93,_0x4b50ea,_0x4caf3b,_0x44cc('0x1b0'));}}break;case'20':_0x3b2b43['outboundRejectCallsDay']+=0x1;_0x2c5a93[_0x44cc('0xe1')]=0x14;_0x2c5a93['statedesc']=_0x44cc('0x1b1');_0x2c5a93[_0x44cc('0xf0')]+=0x1;_0x2c5a93['countglobal']+=0x1;ami[_0x44cc('0x49')](_0x44cc('0x1b2'),ut['buildObj'](_0x2d6e79,_0x44cc('0x1b3')));_0x7f87d6[_0x44cc('0xc9')](_0x2c5a93)[_0x44cc('0xae')](loggerCatch(_0x44cc('0x1b4')));if(_0x7f87d6[_0x44cc('0x190')](0x14,_0x2d6e79,_0x3b2b43)){if(_0x2c5a93['countagentrejectretry']>=_0x3b2b43[_0x44cc('0x19a')]){_0x7f87d6[_0x44cc('0xf5')](_0x2c5a93,_0x4b50ea,_0x4caf3b,_0x44cc('0x1b5'));}else{_0x7f87d6[_0x44cc('0xf2')](_0x2c5a93,_0x4b50ea,_0x4caf3b,_0x44cc('0x1b5'));}}break;default:_0x3b2b43[_0x44cc('0x60')]+=0x1;_0x2c5a93[_0x44cc('0xe1')]=0xc;_0x2c5a93[_0x44cc('0xa4')]=_0x4029cb[_0x44cc('0x109')];_0x7f87d6['createHistory'](_0x2c5a93)[_0x44cc('0xae')](loggerCatch(_0x44cc('0x1b6')));if(_0x7f87d6[_0x44cc('0x190')](_0x4029cb[_0x44cc('0x109')],_0x2d6e79,_0x3b2b43)){if(_0x2c5a93[_0x44cc('0xfd')]+_0x2c5a93[_0x44cc('0xec')]+_0x2c5a93[_0x44cc('0xed')]+_0x2c5a93['countnosuchnumberretry']+_0x2c5a93[_0x44cc('0xee')]+_0x2c5a93[_0x44cc('0xff')]+_0x2c5a93[_0x44cc('0xef')]+_0x2c5a93[_0x44cc('0xf0')]>=_0x3b2b43[_0x44cc('0xf1')]){_0x7f87d6[_0x44cc('0xf2')](_0x2c5a93,_0x4b50ea,_0x4caf3b,_0x4029cb['reason']);}else{_0x7f87d6[_0x44cc('0xf5')](_0x2c5a93,_0x4b50ea,_0x4caf3b,_0x4029cb[_0x44cc('0x109')]);}}}});};Dialer[_0x44cc('0xa7')][_0x44cc('0xf2')]=function(_0x3f0d1f,_0x55787f,_0x167c65,_0x2d5fe2){var _0x1f52d1=new Final(_0x3f0d1f);_0x1f52d1['state']=0xf;_0x1f52d1[_0x44cc('0xa4')]=_0x44cc('0x1b7');this[_0x44cc('0xf5')](_0x1f52d1,_0x55787f,_0x167c65,_0x2d5fe2);};Dialer[_0x44cc('0xa7')]['createStateFinal']=function(_0x204d65,_0xec0240,_0x21c34c,_0x5216cf){this[_0x44cc('0xc8')](_0x204d65)['then'](function(){return _0xec0240(msgResponse('[callProgressDetecting]',_0x44cc('0x1b8'),_0x5216cf));})[_0x44cc('0xae')](function(){return _0x21c34c(msgResponse(_0x44cc('0x1b9'),_0x44cc('0x141'),'contact\x20not\x20moved'));});};Dialer[_0x44cc('0xa7')][_0x44cc('0x9')]=function(_0x4d498b){var _0x37783c=_0x4d498b[_0x44cc('0x1ba')]/0x64;var _0x1258c4=_0x4d498b['outboundDropCallsDayTimeout']/(_0x4d498b['outboundDropCallsDayTimeout']+_0x4d498b[_0x44cc('0x57')]);var _0x5ef30d=Math[_0x44cc('0x1bb')](_0x4d498b[_0x44cc('0x69')]*(_0x4d498b[_0x44cc('0x1bc')]/0x64));var _0x4a1ac0=Math[_0x44cc('0x1bb')](_0x4d498b[_0x44cc('0x69')]*(_0x4d498b['predictiveIntervalMinThreshold']/0x64));var _0xfeedbf=_0x4d498b[_0x44cc('0x9e')]+_0x4d498b[_0x44cc('0x4e')];var _0x3928f8=Math[_0x44cc('0x1bd')](_0x4d498b[_0x44cc('0x6b')]*_0x4d498b['erlangAbandonmentRate']*_0x4d498b[_0x44cc('0x67')]*_0x4d498b[_0x44cc('0x1be')]);if(_[_0x44cc('0x3a')](_0x4d498b['startProgressive'])){if(!_[_0x44cc('0x3a')](_0x4d498b[_0x44cc('0x25')])){_0x4d498b['startPredictive']=undefined;loggerPredictive[_0x44cc('0x8f')]('[startMethodPredictive][StartProgressive]',_0x44cc('0x1bf'));}if(!_[_0x44cc('0x3a')](_0x4d498b[_0x44cc('0x8a')])){loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x44cc('0x1c0'));clearInterval(_0x4d498b['handlePredictive']);_0x4d498b[_0x44cc('0x8a')]=undefined;}_0x4d498b[_0x44cc('0x26')]=moment()[_0x44cc('0x70')](_0x44cc('0xf8'));loggerPredictive[_0x44cc('0x74')](_0x4d498b[_0x44cc('0x3f')],'collection\x20data\x20in\x20progressive\x20at',_0x4d498b[_0x44cc('0x26')]);this[_0x44cc('0x156')](_0x4d498b,0x1);}else if(ifInterval(_0x4d498b['dialPredictiveInterval'],_0x4d498b[_0x44cc('0x26')])){this[_0x44cc('0x156')](_0x4d498b,0x1);loggerPredictiveCalls[_0x44cc('0x74')](_0x44cc('0x1c1'),_0x4d498b[_0x44cc('0x26')],_0x4d498b[_0x44cc('0x3f')]);_0x4d498b['erlangCalls']=0x0;_0x4d498b['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x37783c<_0x1258c4&&_0x4d498b['dialPredictiveOptimization']===_0x44cc('0x1c2')){freeVariablesPredictive(_0x4d498b);loggerPredictive['info'](_0x44cc('0x1c3'),_0x44cc('0x1c4'),_0x1258c4,_0x44cc('0x26'),_0x4d498b[_0x44cc('0x3f')]);}else if(_0x3928f8<_0x4d498b[_0x44cc('0x66')]&&_0x4d498b['dialPredictiveOptimization']===_0x44cc('0x1c2')){freeVariablesPredictive(_0x4d498b);loggerPredictive[_0x44cc('0x74')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x44cc('0x1c5'),_0x3928f8,'Drop\x20in\x20this\x20interval',_0x4d498b[_0x44cc('0x66')],_0x44cc('0x26'),_0x4d498b[_0x44cc('0x3f')]);}else if(!ifInterval(_0x4d498b[_0x44cc('0x1c6')],_0x4d498b[_0x44cc('0x26')])&&_[_0x44cc('0x3a')](_0x4d498b[_0x44cc('0x25')])&&!_[_0x44cc('0x3a')](_0x4d498b[_0x44cc('0x26')])){_0x4d498b['startPredictive']=moment()[_0x44cc('0x70')](_0x44cc('0xf8'));loggerPredictive[_0x44cc('0x74')](_0x4d498b[_0x44cc('0x3f')],_0x44cc('0x1c7'),_0x4d498b['startPredictive']);this['averageHandleTime'](_0x4d498b[_0x44cc('0x1c6')])[_0x44cc('0xb5')](this['getDataPredictive'](_0x4d498b))[_0x44cc('0xb5')](mergeDataErlangB(_0x4d498b))[_0x44cc('0xb5')](this[_0x44cc('0x1c8')](_0x4d498b))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x4d498b));}else if(!ifInterval(_0x4d498b[_0x44cc('0x1c6')],_0x4d498b['startPredictive'])){_0x4d498b[_0x44cc('0x66')]=0x0;_0x4d498b['startPredictive']=moment()[_0x44cc('0x70')](_0x44cc('0xf8'));loggerPredictive['info'](_0x4d498b['name'],_0x44cc('0x1c9'),_0x4d498b[_0x44cc('0x25')]);clearInterval(_0x4d498b['handlePredictive']);_0x4d498b[_0x44cc('0x8a')]=undefined;this[_0x44cc('0xbc')](_0x4d498b['dialPredictiveInterval'])['then'](this['getDataPredictive'](_0x4d498b))[_0x44cc('0xb5')](mergeDataErlangB(_0x4d498b))['then'](this[_0x44cc('0x1c8')](_0x4d498b))[_0x44cc('0xae')](loggerCatchPredictive(_0x44cc('0x1ca'),_0x4d498b));}else if(_0x4d498b['predictiveIntervalAvailable']&&_0xfeedbf<_0x4d498b[_0x44cc('0x69')]-_0x4a1ac0){freeVariablesPredictive(_0x4d498b);loggerPredictive[_0x44cc('0x74')](_0x4d498b[_0x44cc('0x3f')],_0x44cc('0x1cb'),_0xfeedbf,_0x44cc('0x1cc'),_0x4d498b[_0x44cc('0x69')],'-',_0x4a1ac0,'=',_0x4d498b[_0x44cc('0x69')]-_0x4a1ac0,')');}else if(_0x4d498b[_0x44cc('0x69')]&&_0xfeedbf>_0x4d498b[_0x44cc('0x69')]+_0x5ef30d){freeVariablesPredictive(_0x4d498b);loggerPredictive[_0x44cc('0x74')](_0x4d498b[_0x44cc('0x3f')],_0x44cc('0x1cb'),_0xfeedbf,_0x44cc('0x1cd'),_0x4d498b[_0x44cc('0x69')],'+',_0x5ef30d,'=',_0x4d498b['predictiveIntervalAvailable']+_0x5ef30d,')');}};Dialer[_0x44cc('0xa7')][_0x44cc('0x1ce')]=function(_0x2236e4){var _0x315241=this;return function(_0x1a2fea){return new BPromise(function(_0x913b39,_0x1d89c9){_[_0x44cc('0x87')](_0x2236e4,_0x1a2fea[0x0]);if(checkGetDataPredictive(_0x1a2fea[0x0])){var _0x10d0cc=_0x2236e4[_0x44cc('0x69')]=_0x2236e4[_0x44cc('0x4e')]+_0x2236e4[_0x44cc('0x9e')];var _0x9d03f3=_0x2236e4[_0x44cc('0x1c6')]*0x3c;var _0x580de4=_0x1a2fea[0x0][_0x44cc('0x62')]+_0x1a2fea[0x0][_0x44cc('0x61')];var _0x18dd3d=(_0x1a2fea[0x0][_0x44cc('0x78')]+_0x1a2fea[0x0][_0x44cc('0x64')]+_0x1a2fea[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1a2fea[0x0][_0x44cc('0x6a')];_0x2236e4[_0x44cc('0x67')]=_0x18dd3d>0x0?_0x18dd3d:0x1;switch(_0x2236e4[_0x44cc('0x1cf')]){case _0x44cc('0x1c2'):var _0x3e0cde=_0x2236e4[_0x44cc('0x1ba')]/0x64;return _0x315241[_0x44cc('0x1d0')](_0x10d0cc,_0x9d03f3,_0x580de4,_0x18dd3d,_0x3e0cde)[_0x44cc('0xb5')](function(_0x1161e2){return _0x913b39(_0x1161e2);});case'agentBusyFactor':var _0x177d30=_0x2236e4[_0x44cc('0x1ba')]/0x64;return _0x315241[_0x44cc('0x1d1')](_0x10d0cc,_0x9d03f3,_0x580de4,_0x18dd3d,_0x177d30)[_0x44cc('0xb5')](function(_0x3a85e4){return _0x913b39(_0x3a85e4);});default:return _0x1d89c9(msgResponse(_0x44cc('0x1d2'),'Failure','Unknown\x20Predictive'));}}else{return _0x1d89c9(msgResponse('[getDataPredictive]','Failure',_0x44cc('0x1d3')));}});};};Dialer[_0x44cc('0xa7')][_0x44cc('0x1d4')]=function(_0x39b491){var _0x3e6e1a=this;return function(_0xb3e685){return new BPromise(function(_0x593c96,_0x47c392){_[_0x44cc('0x87')](_0x39b491,_0xb3e685[0x0]);if(checkGetDataPredictive(_0xb3e685[0x0])){loggerPredictive[_0x44cc('0x74')](JSON[_0x44cc('0x12c')](_0xb3e685[0x0]));if(_0x39b491[_0x44cc('0x1cf')]===_0x44cc('0x1c2')){return _0x3e6e1a[_0x44cc('0xc6')](_0x39b491['id'])[_0x44cc('0xb5')](function(_0x119e3e){var _0x6779c4=_0x39b491[_0x44cc('0x4c')]-_0x119e3e[0x0][_0x44cc('0x1d5')];var _0x4089cf=_0x39b491[_0x44cc('0x1c6')]*0x3c;var _0x5ed3d9=_0xb3e685[0x0][_0x44cc('0x62')]+_0xb3e685[0x0][_0x44cc('0x61')];var _0x2f8e20=(_0xb3e685[0x0][_0x44cc('0x78')]+_0xb3e685[0x0][_0x44cc('0x64')]+_0xb3e685[0x0][_0x44cc('0x63')])/_0xb3e685[0x0][_0x44cc('0x6a')];var _0x4073f7=_0x39b491['dialPredictiveOptimizationPercentage']/0x64;_0x39b491['predictiveIntervalPauses']=_0x119e3e[0x0][_0x44cc('0x1d5')]||0x0;_0x39b491['predictiveIntervalHitRate']=_0x2f8e20>0x0?_0x2f8e20:0x1;return _0x3e6e1a[_0x44cc('0x1d0')](_0x6779c4,_0x4089cf,_0x5ed3d9,_0x2f8e20,_0x4073f7);})[_0x44cc('0xb5')](function(_0x55f71f){return _0x593c96(_0x55f71f);})[_0x44cc('0xae')](function(_0x50d1f2){return _0x47c392(msgResponse(_0x44cc('0x1d6'),_0x44cc('0x141'),JSON[_0x44cc('0x12c')](_0x50d1f2)));});}if(_0x39b491[_0x44cc('0x1cf')]==='agentBusyFactor'){return _0x3e6e1a[_0x44cc('0xc6')](_0x39b491['id'])[_0x44cc('0xb5')](function(_0x169f27){var _0x547d58=_0x39b491[_0x44cc('0x4c')]-_0x169f27[0x0][_0x44cc('0x1d5')];var _0x5c957b=_0x39b491['dialPredictiveInterval']*0x3c;var _0x3f53fd=_0xb3e685[0x0][_0x44cc('0x62')]+_0xb3e685[0x0][_0x44cc('0x61')];var _0x1531cd=(_0xb3e685[0x0][_0x44cc('0x78')]+_0xb3e685[0x0][_0x44cc('0x64')]+_0xb3e685[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xb3e685[0x0]['predictiveIntervalTotalCalls'];var _0x1cecce=_0x39b491[_0x44cc('0x1ba')]/0x64;_0x39b491[_0x44cc('0x68')]=_0x169f27[0x0]['outboundQueuePauses']||0x0;_0x39b491[_0x44cc('0x67')]=_0x1531cd>0x0?_0x1531cd:0x1;return _0x3e6e1a[_0x44cc('0x1d1')](_0x547d58,_0x5c957b,_0x3f53fd,_0x1531cd,_0x1cecce);})['then'](function(_0x5c06d4){return _0x593c96(_0x5c06d4);})[_0x44cc('0xae')](function(_0x3ccae2){return _0x47c392(msgResponse(_0x44cc('0x1d6'),_0x44cc('0x141'),JSON[_0x44cc('0x12c')](_0x3ccae2)));});}}else{return _0x47c392(msgResponse('[getDataPredictive]','Failure',_0x44cc('0x1d3')));}});};};Dialer[_0x44cc('0xa7')][_0x44cc('0x1c8')]=function(_0x1549b1){var _0x44a202=this;return function(){var _0x3cc918=0x0;var _0x31af41=Math['floor'](_0x1549b1[_0x44cc('0x83')]*0x3e8);if(_0x31af41>0x0){_0x31af41=_0x31af41<0x64?0x64:_0x31af41;loggerPredictive[_0x44cc('0x74')](_0x1549b1[_0x44cc('0x3f')],_0x44cc('0x1d7'),_0x31af41,_0x44cc('0x47'));_0x1549b1[_0x44cc('0x8a')]=setInterval(function(){_0x44a202[_0x44cc('0x8a')](_0x1549b1);loggerPredictiveCalls[_0x44cc('0x74')]('[handlePredictive]',_0x3cc918+=0x1);},_0x31af41);}else{loggerPredictive[_0x44cc('0x74')](_0x1549b1[_0x44cc('0x3f')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x44cc('0xa7')][_0x44cc('0x1d8')]=function(_0x390c4c,_0x1e4fa6){var _0x5977c6=this;return function(_0x5348a4){if(_[_0x44cc('0x43')](_0x5348a4)){if(_[_0x44cc('0xab')](_0x1e4fa6[_0x44cc('0xd1')])||!_0x1e4fa6[_0x44cc('0x1d9')]){if(_0x390c4c[_0x44cc('0x51')]==='booked'){_0x390c4c[_0x44cc('0x129')]=_['isUndefined'](_0x390c4c[_0x44cc('0x129')])?!![]:_0x390c4c[_0x44cc('0x129')];var _0x49850e=uuid['v4']();_0x5977c6[_0x44cc('0xa9')][_0x49850e]=new Action(_0x390c4c,_0x1e4fa6,_0x49850e);loggerBooked['info']('[booked][checkContactBlack]',_0x49850e,_0x44cc('0x1da'),JSON[_0x44cc('0x12c')](_0x390c4c[_0x44cc('0x129')]),_0x44cc('0x1db'),_0x390c4c['name']);if(_0x390c4c[_0x44cc('0x129')]){_0x390c4c['queueStatusComplete']=![];_0x5977c6[_0x44cc('0x28')][_0x5977c6[_0x44cc('0xa9')][_0x49850e][_0x44cc('0xb3')]]=[];ami[_0x44cc('0xac')]({'actionid':_0x49850e,'action':_0x44cc('0x1dc'),'queue':_0x390c4c['name']})['catch'](function(){_0x5977c6[_0x44cc('0xb0')](_0x390c4c);_0x5977c6[_0x44cc('0xbd')]({'active':![],'ContactId':_0x5977c6[_0x44cc('0xa9')][_0x49850e][_0x44cc('0xcf')],'ListId':_0x5977c6['actions'][_0x49850e]['ListId'],'VoiceQueueId':_0x5977c6[_0x44cc('0xa9')][_0x49850e][_0x44cc('0xd2')]||undefined,'CampaignId':_0x5977c6['actions'][_0x49850e][_0x44cc('0xf9')]||undefined})[_0x44cc('0xae')](loggerCatch(_0x44cc('0x1dd')));delete _0x5977c6['actions'][_0x49850e];});}else{loggerBooked[_0x44cc('0x74')](_0x44cc('0x1de'),JSON[_0x44cc('0x12c')](_0x390c4c[_0x44cc('0x129')]),_0x44cc('0x1db'),_0x390c4c[_0x44cc('0x3f')]);_0x5977c6[_0x44cc('0xb0')](_0x390c4c);_0x5977c6['rescheduleContact']({'active':![],'ContactId':_0x5977c6[_0x44cc('0xa9')][_0x49850e][_0x44cc('0xcf')],'ListId':_0x5977c6[_0x44cc('0xa9')][_0x49850e][_0x44cc('0xd0')],'VoiceQueueId':_0x5977c6[_0x44cc('0xa9')][_0x49850e]['VoiceQueueId']||undefined,'CampaignId':_0x5977c6['actions'][_0x49850e][_0x44cc('0xf9')]||undefined})['catch'](loggerCatch(_0x44cc('0x1dd')));delete _0x5977c6[_0x44cc('0xa9')][_0x49850e];}}else{return _0x5977c6[_0x44cc('0x164')](_0x390c4c,_0x1e4fa6);}}else{if(getDiff(_0x1e4fa6[_0x44cc('0x1df')])<_0x390c4c[_0x44cc('0x1e0')]*0x3c){if(_0x1e4fa6[_0x44cc('0x1e1')]&&!_0x1e4fa6[_0x44cc('0x1e1')]['voicePause']){_0x5977c6[_0x44cc('0x1b')][_0x44cc('0x12d')](_0x1e4fa6['id'])['finally'](function(){_0x5977c6[_0x44cc('0xb0')](_0x390c4c);});}else{_0x5977c6[_0x44cc('0xbf')]({'active':![]},_0x1e4fa6['id'],0x1)[_0x44cc('0x19')](function(){_0x5977c6[_0x44cc('0xb0')](_0x390c4c);});}}else{_0x390c4c['outboundReCallsDay']+=0x1;_0x5977c6[_0x44cc('0xb0')](_0x390c4c);if(_0x390c4c[_0x44cc('0x1e2')]){_0x5977c6['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1e4fa6['ContactId'],'ListId':_0x1e4fa6[_0x44cc('0xd0')],'VoiceQueueId':_0x1e4fa6[_0x44cc('0xd2')]||undefined,'CampaignId':_0x1e4fa6['CampaignId']||undefined})[_0x44cc('0xae')](loggerCatch(_0x44cc('0x1e3')));_0x5977c6[_0x44cc('0xc9')](createObjHistory(_0x390c4c,_0x1e4fa6,_0x44cc('0x1e4'),0x17,_0x44cc('0x1e5')))[_0x44cc('0xae')](loggerCatch(_0x44cc('0x1e6')));}else{_0x5977c6[_0x44cc('0xdb')](createObjHistory(_0x390c4c,_0x1e4fa6,_0x44cc('0x1e7'),0x16,_0x44cc('0x1e8')),_0x44cc('0x1e9'),_0x44cc('0x1ea'));}}}}else{_0x390c4c['outboundBlacklistCallsDay']+=0x1;_0x5977c6[_0x44cc('0xdb')](createObjHistory(_0x390c4c,_0x1e4fa6,_0x44cc('0x1eb'),0xd,_0x44cc('0x1ec')),_0x44cc('0x1ed'),_0x44cc('0x1ee'));throw _0x44cc('0x1ef');}};};Dialer[_0x44cc('0xa7')][_0x44cc('0x15b')]=function(_0x3ccb06){var _0x277381=this;var _0x58eab1=_0x3ccb06[_0x44cc('0x1f0')]-_0x3ccb06[_0x44cc('0x93')]-_0x3ccb06[_0x44cc('0xc2')];emitCampaignSummary(_0x3ccb06);if(_0x58eab1>0x0){if(_0x58eab1>this[_0x44cc('0x20')]){_0x58eab1=this[_0x44cc('0x20')];}_0x3ccb06[_0x44cc('0xc2')]+=_0x58eab1;this[_0x44cc('0xc4')](_0x3ccb06['id'],_0x58eab1,_0x3ccb06[_0x44cc('0x1f1')],_0x3ccb06)[_0x44cc('0xb5')](function(_0x305abb){_0x3ccb06[_0x44cc('0xc2')]-=_0x58eab1;_0x3ccb06[_0x44cc('0xc2')]=_0x3ccb06[_0x44cc('0xc2')]>0x0?_0x3ccb06[_0x44cc('0xc2')]:0x0;if(!checkContactEmpty(_0x305abb)){_0x3ccb06['message']=_0x44cc('0x1f2');logger[_0x44cc('0x74')](_0x44cc('0x1f3')+_0x3ccb06[_0x44cc('0x3f')]);}else{_0x3ccb06[_0x44cc('0x93')]+=_0x305abb[_0x44cc('0x92')];_0x3ccb06[_0x44cc('0x3d')]=_0x44cc('0x1f4');for(var _0x567af9=0x0;_0x567af9<_0x305abb[_0x44cc('0x92')];_0x567af9+=0x1){_0x3ccb06[_0x44cc('0x1f5')]+=0x1;if(_[_0x44cc('0xab')](_0x305abb[_0x567af9])||_['isNil'](_0x305abb[_0x567af9][_0x44cc('0x168')])||_[_0x44cc('0xab')](_0x305abb[_0x567af9]['Contact'][_0x44cc('0x188')])){_0x277381['emptyContact'](_0x44cc('0x1f6'),_0x3ccb06,_0x305abb[_0x567af9]);}else{_0x277381[_0x44cc('0xba')](_[_0x44cc('0x127')](_0x305abb[_0x567af9],[_0x44cc('0xf9'),_0x44cc('0x1f7')]))['then'](_0x277381[_0x44cc('0x1d8')](_0x3ccb06,_0x305abb[_0x567af9]))[_0x44cc('0xae')](_0x277381['loggerHandler'](_0x44cc('0x1f8'),_0x3ccb06));}}}})[_0x44cc('0xae')](loggerGetContactDialer('[getContactCampaign2]',_0x3ccb06,_0x58eab1));}};Dialer['prototype']['handlePower']=function(_0x48aa32,_0x4370e1){var _0x4fea73=this;var _0x4bb29a=[];var _0x2fdada=_0x4370e1>=0x1?_0x4370e1:0x1;if(_0x48aa32[_0x44cc('0x51')]===_0x44cc('0x158')){_0x2fdada=0x1;}var _0x467e3e=Math[_0x44cc('0x1bd')](_0x48aa32[_0x44cc('0x9e')]*_0x2fdada)-_0x48aa32[_0x44cc('0x93')]-_0x48aa32[_0x44cc('0xc2')];emitVoiceQueueSummary(_0x48aa32);if(_0x48aa32[_0x44cc('0x1f9')]>0x0){var _0x512557=_0x48aa32[_0x44cc('0x1f9')]-_0x48aa32['originated']-_0x48aa32[_0x44cc('0x4e')]-_0x48aa32['temp']-_0x48aa32[_0x44cc('0x9d')];if(_0x467e3e>_0x512557){_0x467e3e=_0x512557;}}if(_0x467e3e>0x0){if(_0x48aa32['dialMethod']===_0x44cc('0x158')){_0x467e3e=0x1;}if(_0x467e3e>this[_0x44cc('0x20')]){_0x467e3e=this[_0x44cc('0x20')];}_0x48aa32['temp']+=_0x467e3e;for(var _0x394414 in this['agents']){if(typeof this['agents'][_0x394414]!==_0x44cc('0x94')){if(this[_0x44cc('0x1e')][_0x394414][_0x44cc('0xe1')]===_0x44cc('0x1fa')&&this[_0x44cc('0x1e')][_0x394414][_0x44cc('0xd7')]===_0x44cc('0xd8')){_0x4bb29a[_0x44cc('0x126')](this[_0x44cc('0x1e')][_0x394414]['id']);}}}this[_0x44cc('0xc1')](_0x48aa32['id'],_0x4bb29a,_0x467e3e,_0x48aa32[_0x44cc('0x1f1')],_0x48aa32)[_0x44cc('0xb5')](function(_0x54e2f6){_0x48aa32[_0x44cc('0xc2')]-=_0x467e3e;_0x48aa32[_0x44cc('0xc2')]=_0x48aa32['temp']>0x0?_0x48aa32[_0x44cc('0xc2')]:0x0;if(!checkContactEmpty(_0x54e2f6)){_0x4fea73[_0x44cc('0xb6')](_0x48aa32)[_0x44cc('0xb5')](sendMessageReschedule(_0x48aa32))[_0x44cc('0xae')](loggerCatch(_0x44cc('0xb7')));}else{_0x48aa32['originated']+=_0x54e2f6[_0x44cc('0x92')];_0x48aa32[_0x44cc('0x3d')]=_0x48aa32[_0x44cc('0x51')]==='booked'?_0x44cc('0x16e'):_0x44cc('0x1f4');for(var _0x21a28c=0x0;_0x21a28c<_0x54e2f6[_0x44cc('0x92')];_0x21a28c+=0x1){if(_[_0x44cc('0xab')](_0x54e2f6[_0x21a28c])||_[_0x44cc('0xab')](_0x54e2f6[_0x21a28c][_0x44cc('0x168')])||_[_0x44cc('0xab')](_0x54e2f6[_0x21a28c][_0x44cc('0x168')]['phone'])){_0x4fea73['emptyContact'](_0x44cc('0x1f6'),_0x48aa32,_0x54e2f6[_0x21a28c]);}else{_0x4fea73[_0x44cc('0xb8')](_[_0x44cc('0x127')](_0x54e2f6[_0x21a28c],[_0x44cc('0xd2'),_0x44cc('0x1f7')]))[_0x44cc('0xb5')](_0x4fea73[_0x44cc('0x1d8')](_0x48aa32,_0x54e2f6[_0x21a28c]))[_0x44cc('0xae')](_0x4fea73[_0x44cc('0x1fb')](_0x44cc('0x1f6'),_0x48aa32));}}}})['catch'](loggerGetContactDialer(_0x44cc('0x1fc'),_0x48aa32,_0x467e3e));}};Dialer[_0x44cc('0xa7')]['handlePredictive']=function(_0x98e72e){if(_0x98e72e[_0x44cc('0x1f9')]>0x0){var _0x2c5b3e=_0x98e72e['dialLimitQueue']-_0x98e72e[_0x44cc('0x93')]-_0x98e72e[_0x44cc('0x4e')];if(_0x2c5b3e>0x0){this[_0x44cc('0x1fd')](_0x98e72e);}else{loggerPredictiveCalls[_0x44cc('0x74')](_0x44cc('0x1fe'));}}else{this[_0x44cc('0x1fd')](_0x98e72e);}};Dialer[_0x44cc('0xa7')][_0x44cc('0x1fd')]=function(_0x4051a2){var _0x2eb285=this;var _0x3dad96=[];_0x4051a2[_0x44cc('0x93')]+=0x1;for(var _0x25b27d in this[_0x44cc('0x1e')]){if(typeof this[_0x44cc('0x1e')][_0x25b27d]!==_0x44cc('0x94')){if(this[_0x44cc('0x1e')][_0x25b27d][_0x44cc('0xe1')]==='not_inuse'&&this[_0x44cc('0x1e')][_0x25b27d][_0x44cc('0xd7')]==='reachable'){_0x3dad96[_0x44cc('0x126')](this[_0x44cc('0x1e')][_0x25b27d]['id']);}}}this['getContactDialer'](_0x4051a2['id'],_0x3dad96,0x1,_0x4051a2[_0x44cc('0x1f1')],_0x4051a2)[_0x44cc('0xb5')](function(_0xa8962c){if(!checkContactEmpty(_0xa8962c)){checkContactLowerLimitOriginate(_0x4051a2,0x1,0x0);_0x2eb285[_0x44cc('0xb6')](_0x4051a2)[_0x44cc('0xb5')](sendMessageReschedule(_0x4051a2))[_0x44cc('0xae')](loggerCatch(_0x44cc('0xb7')));}else{_0x4051a2['message']=_0x44cc('0x1f4');if(_[_0x44cc('0xab')](_0xa8962c[0x0])||_[_0x44cc('0xab')](_0xa8962c[0x0][_0x44cc('0x168')])||_[_0x44cc('0xab')](_0xa8962c[0x0]['Contact']['phone'])){_0x2eb285['emptyContact'](_0x44cc('0x1f6'),_0x4051a2,_0xa8962c[0x0]);}else{_0x2eb285['checkIsBlackList'](_[_0x44cc('0x127')](_0xa8962c[0x0],[_0x44cc('0xd2'),_0x44cc('0x1f7')]))['then'](_0x2eb285['checkContactBlack'](_0x4051a2,_0xa8962c[0x0]))[_0x44cc('0xae')](_0x2eb285[_0x44cc('0x1fb')]('[actionOriginatePredictive]\x20',_0x4051a2));}}})[_0x44cc('0xae')](loggerGetContactDialer('[getContactDialerPredictive]',_0x4051a2,0x1));emitVoiceQueueSummary(_0x4051a2);};Dialer[_0x44cc('0xa7')]['abandonmentRate']=function(_0x162586,_0x11aa19,_0x3e4865,_0x55130c,_0x384fcc,_0x52a4fa){loggerPredictive[_0x44cc('0x74')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x44cc('0x74')](_0x44cc('0x1ff'),_0x162586);loggerPredictive[_0x44cc('0x74')](_0x44cc('0x200'),_0x11aa19);loggerPredictive['info']('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3e4865);loggerPredictive[_0x44cc('0x74')](_0x44cc('0x201'),_0x55130c);loggerPredictive[_0x44cc('0x74')](_0x44cc('0x202'),_0x384fcc);loggerPredictive['info'](_0x44cc('0x7c'));return new BPromise(function(_0x9bfad,_0x229a5c){if(_0x162586<=0x0||isNaN(_0x162586)){return _0x229a5c(msgResponse(_0x44cc('0x203'),_0x44cc('0x46'),_0x44cc('0x204')+_0x162586));}if(_0x3e4865<=0x0||isNaN(_0x3e4865)){return _0x229a5c(msgResponse(_0x44cc('0x203'),'Error',_0x44cc('0x205')+_0x3e4865));}if(_0x55130c<=0x0||isNaN(_0x55130c)){return _0x229a5c(msgResponse(_0x44cc('0x203'),_0x44cc('0x46'),_0x44cc('0x206')+_0x55130c));}if(_0x11aa19<=0x0||isNaN(_0x11aa19)){return _0x229a5c(msgResponse(_0x44cc('0x203'),'Error',_0x44cc('0x207')+_0x11aa19));}if(_0x384fcc<=0x0||isNaN(_0x384fcc)){return _0x229a5c(msgResponse(_0x44cc('0x203'),_0x44cc('0x46'),_0x44cc('0x208')+_0x384fcc));}_0x52a4fa=_0x52a4fa||0x0;var _0x1b0971=0x1/_0x3e4865;var _0x18e263=0x0;var _0x443d50=0x0;var _0x19f283=0x0;var _0x4f47c8=0x0;for(var _0x21762e=0x0;_0x19f283<_0x384fcc;_0x21762e+=0x1){_0x443d50=_0x21762e/_0x11aa19;_0x18e263=(_0x55130c*_0x443d50+_0x52a4fa)/_0x1b0971;_0x19f283=erlangb(_0x18e263,_0x162586);_0x4f47c8=_0x18e263/_0x162586*(0x1-erlangb(_0x18e263,_0x162586));}return _0x9bfad({'erlangCalls':_0x21762e,'erlangCallToSecond':_0x11aa19/_0x21762e,'erlangAbandonmentRate':_0x19f283,'erlangBusyFactor':_0x4f47c8});});};Dialer[_0x44cc('0xa7')][_0x44cc('0x1d1')]=function(_0x467265,_0x46f60e,_0x54ba3e,_0x5884e0,_0x2fd04a,_0xda235d){loggerPredictive[_0x44cc('0x74')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x44cc('0x74')](_0x44cc('0x1ff'),_0x467265);loggerPredictive[_0x44cc('0x74')](_0x44cc('0x200'),_0x46f60e);loggerPredictive[_0x44cc('0x74')]('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',_0x54ba3e);loggerPredictive[_0x44cc('0x74')](_0x44cc('0x201'),_0x5884e0);loggerPredictive['info'](_0x44cc('0x209'),_0x2fd04a);loggerPredictive['info'](_0x44cc('0x7c'));return new BPromise(function(_0x4cc401,_0x23e461){if(_0x467265<=0x0||isNaN(_0x467265)){return _0x23e461(msgResponse(_0x44cc('0x20a'),'Error',_0x44cc('0x204')+_0x467265));}if(_0x54ba3e<=0x0||isNaN(_0x54ba3e)){return _0x23e461(msgResponse(_0x44cc('0x20a'),_0x44cc('0x46'),'Ts\x20=\x20'+_0x54ba3e));}if(_0x5884e0<=0x0||isNaN(_0x5884e0)){return _0x23e461(msgResponse(_0x44cc('0x20a'),_0x44cc('0x46'),_0x44cc('0x206')+_0x5884e0));}if(_0x46f60e<=0x0||isNaN(_0x46f60e)){return _0x23e461(msgResponse(_0x44cc('0x20a'),_0x44cc('0x46'),_0x44cc('0x207')+_0x46f60e));}if(_0x2fd04a<=0x0||isNaN(_0x2fd04a)){return _0x23e461(msgResponse(_0x44cc('0x20a'),_0x44cc('0x46'),'Umin\x20=\x20'+_0x2fd04a));}_0xda235d=_0xda235d||0x0;var _0x319721=0x1/_0x54ba3e;var _0x425ebb=0x0;var _0x342b27=0x0;var _0x142220=0x0;var _0x2b692c=0x0;for(var _0x5cfa5c=0x0;_0x2b692c<_0x2fd04a;_0x5cfa5c+=0x1){_0x342b27=_0x5cfa5c/_0x46f60e;_0x425ebb=(_0x5884e0*_0x342b27+_0xda235d)/_0x319721;_0x142220=erlangb(_0x425ebb,_0x467265);_0x2b692c=_0x425ebb/_0x467265*(0x1-erlangb(_0x425ebb,_0x467265));}return _0x4cc401({'erlangCalls':_0x5cfa5c,'erlangCallToSecond':_0x46f60e/_0x5cfa5c,'erlangAbandonmentRate':_0x142220,'erlangBusyFactor':_0x2b692c});});};module[_0x44cc('0x20b')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index a83e61b..7769069 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 _0x231c=['connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','responsetime','droptime','endtime','starttime','membername'];(function(_0x1bb8ee,_0x584899){var _0x578c78=function(_0xcf2a25){while(--_0xcf2a25){_0x1bb8ee['push'](_0x1bb8ee['shift']());}};_0x578c78(++_0x584899);}(_0x231c,0x134));var _0xc231=function(_0x279c3b,_0x5f368f){_0x279c3b=_0x279c3b-0x0;var _0x680c33=_0x231c[_0x279c3b];return _0x680c33;};'use strict';var util=require(_0xc231('0x0'));var _=require(_0xc231('0x1'));var moment=require(_0xc231('0x2'));function getSeconds(_0x3a6fcc,_0x1f1f67){var _0x4a291a=moment(_0x3a6fcc)['milliseconds'](0x0);var _0x303d10=moment(_0x1f1f67)[_0xc231('0x3')](0x0);return _0x4a291a['diff'](_0x303d10,'seconds');}function QueueCallerAbandon(_0x4b9289,_0x444b16){this[_0xc231('0x4')]=_0x4b9289[_0xc231('0x4')];this[_0xc231('0x5')]=_0x4b9289[_0xc231('0x5')];this['campaigntype']=_0x4b9289['type']==='outbound'?_0xc231('0x6'):_0x4b9289[_0xc231('0x5')];this[_0xc231('0x7')]=_0x4b9289[_0xc231('0x7')];this['countcongestionretry']=_0x4b9289[_0xc231('0x8')];this[_0xc231('0x9')]=_0x4b9289[_0xc231('0x9')];this[_0xc231('0xa')]=_0x4b9289[_0xc231('0x7')]+_0x4b9289[_0xc231('0x8')]+_0x4b9289[_0xc231('0x9')]+_0x4b9289[_0xc231('0xb')]+_0x4b9289[_0xc231('0xc')]+_0x4b9289[_0xc231('0xd')]+_0x4b9289['countmachineretry']+_0x4b9289[_0xc231('0xe')];this[_0xc231('0xb')]=_0x4b9289[_0xc231('0xb')];this[_0xc231('0xc')]=_0x4b9289['countdropretry'];this[_0xc231('0xd')]=_0x4b9289['countabandonedretry'];this['countmachineretry']=_0x4b9289[_0xc231('0xf')];this[_0xc231('0xe')]=_0x4b9289[_0xc231('0xe')];this[_0xc231('0x10')]=_0x444b16[_0xc231('0x10')];this[_0xc231('0x11')]=_0x4b9289[_0xc231('0x12')];this[_0xc231('0x13')]=_0x4b9289['number'];this['starttime']=_0x4b9289['starttime'];this[_0xc231('0x14')]=_0x4b9289['responsetime'];this[_0xc231('0x15')]=_0x4b9289[_0xc231('0x15')];this[_0xc231('0x16')]=this['droptime'];this['ringtime']=getSeconds(_0x4b9289[_0xc231('0x14')],_0x4b9289[_0xc231('0x17')]);this['holdtime']=getSeconds(this[_0xc231('0x15')],_0x4b9289[_0xc231('0x14')]);this['talktime']=0x0;this[_0xc231('0x6')]=_0x444b16['queue'];this[_0xc231('0x18')]=_0x444b16[_0xc231('0x19')];this[_0xc231('0x1a')]=_0x444b16['reason'];this['callback']=_0x4b9289[_0xc231('0x1b')];this[_0xc231('0x1c')]=_0x4b9289[_0xc231('0x1c')];this[_0xc231('0x1d')]=_0x4b9289['callbackat'];this[_0xc231('0x1e')]=_0x4b9289[_0xc231('0x1e')];this['ContactId']=_0x4b9289['ContactId'];this[_0xc231('0x1f')]=_0x4b9289['ListId'];this['UserId']=_0x4b9289[_0xc231('0x20')];this[_0xc231('0x21')]=_0x4b9289[_0xc231('0x21')];this[_0xc231('0x22')]=_0x4b9289[_0xc231('0x22')];this[_0xc231('0x23')]=_0x4b9289[_0xc231('0x23')]||'';this[_0xc231('0x24')]=_0x4b9289['originatecalleridname']||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x3def=['diff','seconds','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','name','number','starttime','responsetime','droptime','endtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds'];(function(_0x1c650c,_0x1cb456){var _0xea260c=function(_0x227d87){while(--_0x227d87){_0x1c650c['push'](_0x1c650c['shift']());}};_0xea260c(++_0x1cb456);}(_0x3def,0xe0));var _0xf3de=function(_0x443dc8,_0x55c6b6){_0x443dc8=_0x443dc8-0x0;var _0x43fc2e=_0x3def[_0x443dc8];return _0x43fc2e;};'use strict';var util=require(_0xf3de('0x0'));var _=require(_0xf3de('0x1'));var moment=require(_0xf3de('0x2'));function getSeconds(_0x3c8b99,_0x96e517){var _0x4650ce=moment(_0x3c8b99)['milliseconds'](0x0);var _0x49375c=moment(_0x96e517)[_0xf3de('0x3')](0x0);return _0x4650ce[_0xf3de('0x4')](_0x49375c,_0xf3de('0x5'));}function QueueCallerAbandon(_0x29aeea,_0x55eb8b){this[_0xf3de('0x6')]=_0x29aeea[_0xf3de('0x6')];this[_0xf3de('0x7')]=_0x29aeea[_0xf3de('0x7')];this['campaigntype']=_0x29aeea['type']==='outbound'?_0xf3de('0x8'):_0x29aeea['type'];this['countbusyretry']=_0x29aeea[_0xf3de('0x9')];this[_0xf3de('0xa')]=_0x29aeea[_0xf3de('0xa')];this[_0xf3de('0xb')]=_0x29aeea['countnoanswerretry'];this[_0xf3de('0xc')]=_0x29aeea[_0xf3de('0x9')]+_0x29aeea[_0xf3de('0xa')]+_0x29aeea[_0xf3de('0xb')]+_0x29aeea[_0xf3de('0xd')]+_0x29aeea['countdropretry']+_0x29aeea[_0xf3de('0xe')]+_0x29aeea[_0xf3de('0xf')]+_0x29aeea[_0xf3de('0x10')];this[_0xf3de('0xd')]=_0x29aeea[_0xf3de('0xd')];this[_0xf3de('0x11')]=_0x29aeea[_0xf3de('0x11')];this['countabandonedretry']=_0x29aeea['countabandonedretry'];this[_0xf3de('0xf')]=_0x29aeea['countmachineretry'];this['countagentrejectretry']=_0x29aeea[_0xf3de('0x10')];this['uniqueid']=_0x55eb8b['uniqueid'];this[_0xf3de('0x12')]=_0x29aeea[_0xf3de('0x13')];this['calleridnum']=_0x29aeea[_0xf3de('0x14')];this['starttime']=_0x29aeea[_0xf3de('0x15')];this[_0xf3de('0x16')]=_0x29aeea[_0xf3de('0x16')];this[_0xf3de('0x17')]=_0x29aeea['droptime'];this[_0xf3de('0x18')]=this[_0xf3de('0x17')];this['ringtime']=getSeconds(_0x29aeea['responsetime'],_0x29aeea[_0xf3de('0x15')]);this['holdtime']=getSeconds(this[_0xf3de('0x17')],_0x29aeea['responsetime']);this[_0xf3de('0x19')]=0x0;this[_0xf3de('0x8')]=_0x55eb8b[_0xf3de('0x8')];this[_0xf3de('0x1a')]=_0x55eb8b[_0xf3de('0x1b')];this['reason']=_0x55eb8b[_0xf3de('0x1c')];this[_0xf3de('0x1d')]=_0x29aeea[_0xf3de('0x1d')];this[_0xf3de('0x1e')]=_0x29aeea[_0xf3de('0x1e')];this[_0xf3de('0x1f')]=_0x29aeea[_0xf3de('0x1f')];this['recallme']=_0x29aeea[_0xf3de('0x20')];this['ContactId']=_0x29aeea['ContactId'];this['ListId']=_0x29aeea['ListId'];this[_0xf3de('0x21')]=_0x29aeea[_0xf3de('0x21')];this[_0xf3de('0x22')]=_0x29aeea['VoiceQueueId'];this[_0xf3de('0x23')]=_0x29aeea['CampaignId'];this[_0xf3de('0x24')]=_0x29aeea[_0xf3de('0x24')]||'';this[_0xf3de('0x25')]=_0x29aeea[_0xf3de('0x25')]||'';}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 b549c44..df38615 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(_0x44ad3c,_0x625608){var _0x433843=function(_0x1e4c6b){while(--_0x1e4c6b){_0x44ad3c['push'](_0x44ad3c['shift']());}};_0x433843(++_0x625608);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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(_0x7f6dc5,_0x35098f){var _0x2be5b0=function(_0x3e2d05){while(--_0x3e2d05){_0x7f6dc5['push'](_0x7f6dc5['shift']());}};_0x2be5b0(++_0x35098f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 7ddb252..b586b46 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 _0x3c81=['checkTrunk','isValid','Trunk\x20Reachable','format','path','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','hangup','originateresponse','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','prototype','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend'];(function(_0x42e473,_0x3a4d41){var _0x414196=function(_0x1db5ce){while(--_0x1db5ce){_0x42e473['push'](_0x42e473['shift']());}};_0x414196(++_0x3a4d41);}(_0x3c81,0x102));var _0x13c8=function(_0x56763f,_0x17d4b7){_0x56763f=_0x56763f-0x0;var _0x1afb21=_0x3c81[_0x56763f];return _0x1afb21;};'use strict';var util=require(_0x13c8('0x0'));var _=require(_0x13c8('0x1'));var BPromise=require('bluebird');var uuid=require(_0x13c8('0x2'));var moment=require(_0x13c8('0x3'));var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require('../../../config/logger')(_0x13c8('0x4'));var ami=require(_0x13c8('0x5'));var rpcDb=require(_0x13c8('0x6'));var Channel=require(_0x13c8('0x7'));var ut=require(_0x13c8('0x8'));var Action=require(_0x13c8('0x9'));var faxAccount=require(_0x13c8('0xa'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x13c8('0xb'));function Fax(_0x4905c3){this[_0x13c8('0xc')]={};this[_0x13c8('0xd')]=_0x4905c3[_0x13c8('0xd')];this[_0x13c8('0xe')]=_0x4905c3[_0x13c8('0xe')];this[_0x13c8('0xf')]={};ami['on'](_0x13c8('0x10'),this[_0x13c8('0x11')][_0x13c8('0x12')](this));ami['on'](_0x13c8('0x13'),this[_0x13c8('0x14')][_0x13c8('0x12')](this));ami['on'](_0x13c8('0x15'),this[_0x13c8('0x16')]['bind'](this));ami['on'](_0x13c8('0x17'),this[_0x13c8('0x18')][_0x13c8('0x12')](this));ami['on'](_0x13c8('0x19'),this['syncFaxStatus'][_0x13c8('0x12')](this));ami['on']('receivefax',this['syncReceiveFax']['bind'](this));ami['on'](_0x13c8('0x1a'),this['syncHangup'][_0x13c8('0x12')](this));ami['on'](_0x13c8('0x1b'),this[_0x13c8('0x1c')][_0x13c8('0x12')](this));}Fax['prototype'][_0x13c8('0x11')]=function(_0x408abc){if(_0x408abc[_0x13c8('0x1d')]===_0x13c8('0x1e')){for(var _0xce1ad2 in this[_0x13c8('0xd')]){if(this[_0x13c8('0xd')][_0x13c8('0x1f')](_0xce1ad2)){if(_0x408abc[_0x13c8('0x20')]===this[_0x13c8('0xd')][_0xce1ad2][_0x13c8('0x21')]){this['channels'][_0x408abc[_0x13c8('0x22')]]={};this[_0x13c8('0xc')][_0x408abc[_0x13c8('0x22')]][_0x13c8('0x23')]=_0x408abc['channel'];this[_0x13c8('0xc')][_0x408abc[_0x13c8('0x22')]]['id']=this[_0x13c8('0xd')][_0xce1ad2]['id'];this[_0x13c8('0xc')][_0x408abc[_0x13c8('0x22')]][_0x13c8('0x24')]=this['faxAccounts'][_0xce1ad2][_0x13c8('0x24')];logger[_0x13c8('0x25')](_0x408abc[_0x13c8('0x22')],_0x13c8('0x26'));}}}}if(this['actions'][_0x408abc[_0x13c8('0x22')]]){this[_0x13c8('0xc')][_0x408abc['uniqueid']]={};this['channels'][_0x408abc[_0x13c8('0x22')]][_0x13c8('0x23')]=_0x408abc['channel'];logger['info'](_0x408abc[_0x13c8('0x22')],_0x13c8('0x26'));}};Fax['prototype']['syncVarSet']=function(_0x196983){if(this['channels'][_0x196983['uniqueid']]){for(var _0x1c7dc4 in _0x196983[_0x13c8('0x27')]){if(_0x196983[_0x13c8('0x27')]['hasOwnProperty'](_0x1c7dc4)){this['channels'][_0x196983[_0x13c8('0x22')]][_0x1c7dc4]=_0x196983[_0x13c8('0x28')];}}}};Fax[_0x13c8('0x29')][_0x13c8('0x16')]=function(_0x138017){if(this[_0x13c8('0xc')][_0x138017[_0x13c8('0x22')]]){this['channels'][_0x138017[_0x13c8('0x22')]][_0x13c8('0x2a')]=_0x138017['channelstate'];this['channels'][_0x138017[_0x13c8('0x22')]][_0x13c8('0x2b')]=_0x138017['channelstatedesc'];}};Fax[_0x13c8('0x29')][_0x13c8('0x18')]=function(_0x47e0f8){if(this[_0x13c8('0xc')][_0x47e0f8[_0x13c8('0x22')]]){for(var _0xc4ae3a in _0x47e0f8[_0x13c8('0x27')]){if(_0x47e0f8[_0x13c8('0x27')][_0x13c8('0x1f')](_0xc4ae3a)){this[_0x13c8('0xc')][_0x47e0f8[_0x13c8('0x22')]][_0xc4ae3a]=_0x47e0f8['value'];}}}};Fax['prototype'][_0x13c8('0x2c')]=function(_0x37eaec){if(this['channels'][_0x37eaec[_0x13c8('0x22')]]){this['channels'][_0x37eaec[_0x13c8('0x22')]]['operation']=_0x37eaec[_0x13c8('0x2d')];this[_0x13c8('0xc')][_0x37eaec[_0x13c8('0x22')]][_0x13c8('0x2e')]=_0x37eaec[_0x13c8('0x2e')];this[_0x13c8('0xc')][_0x37eaec[_0x13c8('0x22')]]['localstationid']=_0x37eaec[_0x13c8('0x21')];this[_0x13c8('0xc')][_0x37eaec['uniqueid']][_0x13c8('0x2f')]=_0x37eaec[_0x13c8('0x2f')];logger[_0x13c8('0x25')](_0x37eaec['uniqueid'],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0x13c8('0x30')]=function(_0x2c8218){var _0x21671a=this;if(this[_0x13c8('0xc')][_0x2c8218[_0x13c8('0x22')]]){var _0x412428=this[_0x13c8('0xc')][_0x2c8218[_0x13c8('0x22')]]['id'];this[_0x13c8('0xc')][_0x2c8218['uniqueid']]['remotestationid']=_0x2c8218[_0x13c8('0x31')];this[_0x13c8('0xc')][_0x2c8218[_0x13c8('0x22')]][_0x13c8('0x32')]=_0x2c8218['pagestransferred'];this[_0x13c8('0xc')][_0x2c8218['uniqueid']][_0x13c8('0x21')]=_0x2c8218[_0x13c8('0x21')];this[_0x13c8('0xc')][_0x2c8218[_0x13c8('0x22')]][_0x13c8('0x33')]=_0x2c8218[_0x13c8('0x33')];this[_0x13c8('0xc')][_0x2c8218[_0x13c8('0x22')]][_0x13c8('0x34')]=_0x2c8218[_0x13c8('0x34')];this[_0x13c8('0xc')][_0x2c8218[_0x13c8('0x22')]][_0x13c8('0x2f')]=_0x2c8218[_0x13c8('0x2f')];this[_0x13c8('0xc')][_0x2c8218[_0x13c8('0x22')]][_0x13c8('0x35')]=_0x2c8218[_0x13c8('0x35')];if(this[_0x13c8('0xc')][_0x2c8218[_0x13c8('0x22')]][_0x13c8('0x32')]>0x0){tiff2pdf(_0x2c8218[_0x13c8('0x2f')],_0x13c8('0x36'),function(_0x4030ca){logger[_0x13c8('0x25')](_0x2c8218['uniqueid'],_0x13c8('0x37'),_0x4030ca[_0x13c8('0x38')]);attachment[_0x13c8('0x39')]({'name':path[_0x13c8('0x3a')](_0x2c8218[_0x13c8('0x2f')])['name'],'basename':path['parse'](_0x2c8218[_0x13c8('0x2f')])[_0x13c8('0x24')]+_0x13c8('0x3b'),'type':'application/pdf'})['then'](function(_0x4d783c){faxAccount[_0x13c8('0x3c')](_0x412428,{'from':_0x2c8218['calleridnum'],'mapKey':_0x13c8('0x4'),'body':path['parse'](_0x2c8218[_0x13c8('0x2f')])[_0x13c8('0x24')]+_0x13c8('0x3b'),'AttachmentId':_0x4d783c['id']})[_0x13c8('0x3d')](function(_0x3fcc4d){logger[_0x13c8('0x3e')](_0x2c8218['uniqueid'],_0x13c8('0x3f'),JSON[_0x13c8('0x40')](_0x3fcc4d));});})['catch'](function(_0x2b4e45){logger[_0x13c8('0x3e')](_0x2c8218[_0x13c8('0x22')],_0x13c8('0x41'),JSON[_0x13c8('0x40')](_0x2b4e45));});});}logger['info'](_0x2c8218[_0x13c8('0x22')],_0x13c8('0x41'));}};Fax[_0x13c8('0x29')][_0x13c8('0x1c')]=function(_0x185d18){if(this['actions'][_0x185d18[_0x13c8('0x22')]]){_[_0x13c8('0x42')](this[_0x13c8('0xc')][_0x185d18[_0x13c8('0x22')]],_[_0x13c8('0x43')](_0x185d18,[_0x13c8('0x44'),_0x13c8('0x45')]));}};function updateStatus(_0xa1596b){if(_0xa1596b[_0x13c8('0x46')]){faxMessage[_0x13c8('0x47')](_0xa1596b[_0x13c8('0x46')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x13c8('0x48')](function(_0x3b90e4){ut[_0x13c8('0x49')](_0x13c8('0x4a'),_0x3b90e4);})[_0x13c8('0x3d')](function(_0x11aa65){ut['logger'](_0x13c8('0x4b'),_0x11aa65);});}else{ut[_0x13c8('0x49')](_0x13c8('0x4c'));}}Fax['prototype']['updateStatus']=function(_0x3d4863,_0x14a738,_0x55d353){var _0x199782=this;var _0x302fad={};if(_0x14a738){_0x302fad={'read':_0x14a738};}else{_0x302fad={'failMessage':_0x55d353};}if(this['actions'][_0x3d4863][_0x13c8('0x46')]){faxMessage['update'](this[_0x13c8('0xf')][_0x3d4863][_0x13c8('0x46')],_0x302fad)[_0x13c8('0x48')](function(_0x49b2f2){ut[_0x13c8('0x49')](_0x13c8('0x4d'),_0x49b2f2);})['catch'](function(_0x1c47ef){ut['logger'](_0x13c8('0x4e'),_0x1c47ef);})[_0x13c8('0x4f')](function(){delete _0x199782[_0x13c8('0xc')][_0x3d4863];delete _0x199782[_0x13c8('0xf')][_0x3d4863];});}else{ut[_0x13c8('0x49')]('[Fax][Message][NoUpdate2]');delete this[_0x13c8('0xc')][_0x3d4863];delete this['actions'][_0x3d4863];}};Fax['prototype']['syncHangup']=function(_0x53c8f5){var _0x539c84=this;if(this[_0x13c8('0xc')][_0x53c8f5[_0x13c8('0x22')]]){if(this[_0x13c8('0xf')][_0x53c8f5[_0x13c8('0x22')]]){this[_0x13c8('0xc')][_0x53c8f5[_0x13c8('0x22')]]['id']=this[_0x13c8('0xf')][_0x53c8f5['uniqueid']]['id'];this['channels'][_0x53c8f5[_0x13c8('0x22')]][_0x13c8('0x24')]=this[_0x13c8('0xf')][_0x53c8f5[_0x13c8('0x22')]][_0x13c8('0x24')];}logger[_0x13c8('0x25')](_0x53c8f5[_0x13c8('0x22')],this[_0x13c8('0xf')][_0x53c8f5['uniqueid']]?_0x13c8('0x50'):_0x13c8('0x51'),JSON['stringify'](this[_0x13c8('0xc')][_0x53c8f5[_0x13c8('0x22')]]));if(this[_0x13c8('0xf')][_0x53c8f5[_0x13c8('0x22')]]){if(this[_0x13c8('0xc')][_0x53c8f5[_0x13c8('0x22')]][_0x13c8('0x52')]>0x0&&this[_0x13c8('0xc')][_0x53c8f5[_0x13c8('0x22')]][_0x13c8('0x19')]===_0x13c8('0x53')){this[_0x13c8('0x54')](_0x53c8f5[_0x13c8('0x22')],!![]);}else{this[_0x13c8('0x54')](_0x53c8f5[_0x13c8('0x22')],![],this[_0x13c8('0xc')][_0x53c8f5['uniqueid']][_0x13c8('0x55')]?'SENDING\x20FAILED:\x20'+this[_0x13c8('0xc')][_0x53c8f5[_0x13c8('0x22')]]['faxstatusstring']:_0x13c8('0x56'));}}}};Fax[_0x13c8('0x29')]['send']=function(_0x38fd82){var _0x19330c=this;return new BPromise(function(_0x44c16d,_0x4c04dc){_0x19330c[_0x13c8('0x57')](_0x38fd82,_0x19330c[_0x13c8('0xd')][_0x38fd82[_0x13c8('0x58')]])[_0x13c8('0x48')](function(_0x179d56){ut[_0x13c8('0x49')](_0x13c8('0x59'),_0x179d56);_0x44c16d(ut['message'](_0x13c8('0x5a')));})[_0x13c8('0x3d')](function(_0x223cfd){ut[_0x13c8('0x49')](_0x13c8('0x5b'),_0x223cfd);updateStatus(_0x38fd82);_0x4c04dc(ut[_0x13c8('0x38')]('Fax\x20failed'));});});};Fax[_0x13c8('0x29')][_0x13c8('0x5c')]=function(_0x165ed0){var _0x541f00=this;return new BPromise(function(_0x54241e,_0x916946){var _0x34a690=_0x541f00[_0x13c8('0x5d')](_0x541f00[_0x13c8('0xd')][_0x165ed0[_0x13c8('0x58')]]['Trunk'],_0x165ed0);if(_0x34a690[_0x13c8('0x5e')]){_0x54241e(ut[_0x13c8('0x38')](_0x13c8('0x5f')));}else{_0x916946(ut[_0x13c8('0x38')](_0x34a690['message']));}});};function originate(_0x16b409,_0x2d552d,_0x258447){return new BPromise(function(_0x308482,_0x179a86){if(_0x258447){var _0x251cbb=util[_0x13c8('0x60')]('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[_0x13c8('0x3a')](_0x16b409[_0x13c8('0x61')])[_0x13c8('0x24')],_0x16b409['path']);gs[_0x13c8('0x62')](_0x251cbb)[_0x13c8('0x48')](function(){_0x16b409['path']=util['format'](_0x13c8('0x63'),path['parse'](_0x16b409[_0x13c8('0x61')])['dir'],path[_0x13c8('0x3a')](_0x16b409[_0x13c8('0x61')])[_0x13c8('0x24')]);_0x2d552d[_0x13c8('0x64')]=_0x16b409[_0x13c8('0x61')];ut['logger'](_0x13c8('0x65'),'');ami[_0x13c8('0x66')](ut['variablesAction'](_0x16b409,_0x2d552d))[_0x13c8('0x48')](function(_0x7dbff0){_0x308482(_0x7dbff0);})[_0x13c8('0x3d')](function(_0x34e21a){_0x179a86(_0x34e21a);});})[_0x13c8('0x3d')](function(_0x2a4315){_0x179a86(_0x2a4315);});}else{ami[_0x13c8('0x66')](ut[_0x13c8('0x67')](_0x16b409,_0x2d552d))[_0x13c8('0x48')](function(_0x155b93){_0x308482(_0x155b93);})['catch'](function(_0xe58f91){_0x179a86(_0xe58f91);});}});}Fax[_0x13c8('0x29')]['execOriginate']=function(_0x58d5b2,_0x363406){var _0x1e119c=this;return new BPromise(function(_0xa70841,_0x19ce22){var _0x13df22=uuid['v4']();var _0x1a92d6=ut['addVariables'](_0x58d5b2,_0x363406);_0x1e119c[_0x13c8('0xf')][_0x13df22]=new Action(_0x13df22,_0x363406,_0x58d5b2);var _0x368f45=_0x1e119c[_0x13c8('0xf')][_0x13df22];if(path[_0x13c8('0x3a')](_0x58d5b2[_0x13c8('0x61')])['ext']===_0x13c8('0x3b')){originate(_0x368f45,_0x1a92d6,!![])[_0x13c8('0x48')](function(_0x564cc9){_0xa70841(_0x564cc9);})[_0x13c8('0x3d')](function(_0xdea3e6){_0x19ce22(_0xdea3e6);});}else{originate(_0x368f45,_0x1a92d6,![])['then'](function(_0xd4b67a){_0xa70841(_0xd4b67a);})['catch'](function(_0x461169){_0x19ce22(_0x461169);});}});};Fax['prototype'][_0x13c8('0x68')]=function(_0x260139){return!_[_0x13c8('0x69')](_0x260139)&&!_['isNil'](_0x260139[_0x13c8('0x24')])&&!_['isNil'](_0x260139['active'])&&_0x260139[_0x13c8('0x6a')]&&!_[_0x13c8('0x69')](this[_0x13c8('0xe')][util[_0x13c8('0x60')]('SIP/%s',_0x260139['name'])])&&!_[_0x13c8('0x69')](this['trunks'][util['format'](_0x13c8('0x6b'),_0x260139[_0x13c8('0x24')])][_0x13c8('0x2e')])&&(this[_0x13c8('0xe')][util['format'](_0x13c8('0x6b'),_0x260139['name'])]['status']===_0x13c8('0x6c')||this[_0x13c8('0xe')][util[_0x13c8('0x60')](_0x13c8('0x6b'),_0x260139[_0x13c8('0x24')])]['status']===_0x13c8('0x6d'));};Fax['prototype'][_0x13c8('0x5d')]=function(_0x4f56ef,_0x5277a2){if(!this[_0x13c8('0x68')](_0x4f56ef)){ut['logger'](_0x13c8('0x6e'),_[_0x13c8('0x69')](_0x4f56ef)?'':_0x4f56ef['name']+_0x13c8('0x6f'));return{'isValid':![],'message':_0x13c8('0x70')};}if(_[_0x13c8('0x69')](_0x5277a2[_0x13c8('0x4')])){ut[_0x13c8('0x49')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x13c8('0x40')](_0x5277a2));return{'isValid':![],'message':_0x13c8('0x71')};}if(_[_0x13c8('0x69')](_0x5277a2[_0x13c8('0x61')])){ut[_0x13c8('0x49')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x5277a2));return{'isValid':![],'message':_0x13c8('0x72')};}return{'isValid':!![],'message':_0x13c8('0x73')};};module[_0x13c8('0x74')]=Fax; \ No newline at end of file +var _0x0fd9=['update','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','then','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxstatus','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','message','checkAfterSend','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','format','%s/%s.tif','dir','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','lodash','bluebird','uuid','moment','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','../rpc/faxAccount','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','value','channelstatedesc','variable','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','parse','.pdf','notify','catch','stringify','error','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','AttachmentId'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0fd9,0xa3));var _0x90fd=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0fd9[_0x19950b];return _0x3c6b41;};'use strict';var util=require('util');var _=require(_0x90fd('0x0'));var BPromise=require(_0x90fd('0x1'));var uuid=require(_0x90fd('0x2'));var moment=require(_0x90fd('0x3'));var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require(_0x90fd('0x4'));var logger=require(_0x90fd('0x5'))(_0x90fd('0x6'));var ami=require(_0x90fd('0x7'));var rpcDb=require(_0x90fd('0x8'));var Channel=require(_0x90fd('0x9'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0x90fd('0xa'));var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0x2acef7){this[_0x90fd('0xb')]={};this['faxAccounts']=_0x2acef7[_0x90fd('0xc')];this[_0x90fd('0xd')]=_0x2acef7[_0x90fd('0xd')];this[_0x90fd('0xe')]={};ami['on'](_0x90fd('0xf'),this[_0x90fd('0x10')][_0x90fd('0x11')](this));ami['on'](_0x90fd('0x12'),this[_0x90fd('0x13')]['bind'](this));ami['on'](_0x90fd('0x14'),this[_0x90fd('0x15')]['bind'](this));ami['on'](_0x90fd('0x16'),this[_0x90fd('0x17')][_0x90fd('0x11')](this));ami['on']('faxstatus',this[_0x90fd('0x18')]['bind'](this));ami['on'](_0x90fd('0x19'),this[_0x90fd('0x1a')][_0x90fd('0x11')](this));ami['on'](_0x90fd('0x1b'),this[_0x90fd('0x1c')][_0x90fd('0x11')](this));ami['on'](_0x90fd('0x1d'),this['syncOriginateResponse']['bind'](this));}Fax[_0x90fd('0x1e')][_0x90fd('0x10')]=function(_0x4baa2c){if(_0x4baa2c[_0x90fd('0x1f')]===_0x90fd('0x20')){for(var _0x1fcc87 in this['faxAccounts']){if(this[_0x90fd('0xc')][_0x90fd('0x21')](_0x1fcc87)){if(_0x4baa2c[_0x90fd('0x22')]===this[_0x90fd('0xc')][_0x1fcc87][_0x90fd('0x23')]){this[_0x90fd('0xb')][_0x4baa2c[_0x90fd('0x24')]]={};this[_0x90fd('0xb')][_0x4baa2c[_0x90fd('0x24')]][_0x90fd('0x25')]=_0x4baa2c[_0x90fd('0x25')];this[_0x90fd('0xb')][_0x4baa2c[_0x90fd('0x24')]]['id']=this[_0x90fd('0xc')][_0x1fcc87]['id'];this[_0x90fd('0xb')][_0x4baa2c['uniqueid']][_0x90fd('0x26')]=this[_0x90fd('0xc')][_0x1fcc87][_0x90fd('0x26')];logger[_0x90fd('0x27')](_0x4baa2c[_0x90fd('0x24')],_0x90fd('0x28'));}}}}if(this[_0x90fd('0xe')][_0x4baa2c[_0x90fd('0x24')]]){this['channels'][_0x4baa2c[_0x90fd('0x24')]]={};this['channels'][_0x4baa2c[_0x90fd('0x24')]][_0x90fd('0x25')]=_0x4baa2c[_0x90fd('0x25')];logger[_0x90fd('0x27')](_0x4baa2c[_0x90fd('0x24')],'\x20syncNewchannel\x20');}};Fax[_0x90fd('0x1e')][_0x90fd('0x13')]=function(_0x2fffe6){if(this[_0x90fd('0xb')][_0x2fffe6[_0x90fd('0x24')]]){for(var _0x428bc2 in _0x2fffe6['variable']){if(_0x2fffe6['variable'][_0x90fd('0x21')](_0x428bc2)){this[_0x90fd('0xb')][_0x2fffe6[_0x90fd('0x24')]][_0x428bc2]=_0x2fffe6[_0x90fd('0x29')];}}}};Fax[_0x90fd('0x1e')]['syncNewState']=function(_0x4f69e7){if(this[_0x90fd('0xb')][_0x4f69e7[_0x90fd('0x24')]]){this[_0x90fd('0xb')][_0x4f69e7[_0x90fd('0x24')]]['channelstate']=_0x4f69e7['channelstate'];this[_0x90fd('0xb')][_0x4f69e7[_0x90fd('0x24')]][_0x90fd('0x2a')]=_0x4f69e7[_0x90fd('0x2a')];}};Fax['prototype'][_0x90fd('0x17')]=function(_0x1127ef){if(this[_0x90fd('0xb')][_0x1127ef[_0x90fd('0x24')]]){for(var _0x181b63 in _0x1127ef[_0x90fd('0x2b')]){if(_0x1127ef[_0x90fd('0x2b')][_0x90fd('0x21')](_0x181b63)){this[_0x90fd('0xb')][_0x1127ef[_0x90fd('0x24')]][_0x181b63]=_0x1127ef[_0x90fd('0x29')];}}}};Fax[_0x90fd('0x1e')][_0x90fd('0x18')]=function(_0x41f789){if(this[_0x90fd('0xb')][_0x41f789[_0x90fd('0x24')]]){this['channels'][_0x41f789[_0x90fd('0x24')]][_0x90fd('0x2c')]=_0x41f789[_0x90fd('0x2c')];this[_0x90fd('0xb')][_0x41f789[_0x90fd('0x24')]][_0x90fd('0x2d')]=_0x41f789[_0x90fd('0x2d')];this[_0x90fd('0xb')][_0x41f789[_0x90fd('0x24')]][_0x90fd('0x23')]=_0x41f789[_0x90fd('0x23')];this[_0x90fd('0xb')][_0x41f789[_0x90fd('0x24')]]['filename']=_0x41f789[_0x90fd('0x2e')];logger[_0x90fd('0x27')](_0x41f789[_0x90fd('0x24')],_0x90fd('0x2f'));}};Fax['prototype'][_0x90fd('0x1a')]=function(_0x2c4f37){var _0xb37e41=this;if(this['channels'][_0x2c4f37['uniqueid']]){var _0x421177=this[_0x90fd('0xb')][_0x2c4f37[_0x90fd('0x24')]]['id'];this[_0x90fd('0xb')][_0x2c4f37[_0x90fd('0x24')]][_0x90fd('0x30')]=_0x2c4f37[_0x90fd('0x30')];this[_0x90fd('0xb')][_0x2c4f37[_0x90fd('0x24')]][_0x90fd('0x31')]=_0x2c4f37[_0x90fd('0x31')];this[_0x90fd('0xb')][_0x2c4f37[_0x90fd('0x24')]][_0x90fd('0x23')]=_0x2c4f37[_0x90fd('0x23')];this[_0x90fd('0xb')][_0x2c4f37[_0x90fd('0x24')]][_0x90fd('0x32')]=_0x2c4f37['resolution'];this[_0x90fd('0xb')][_0x2c4f37[_0x90fd('0x24')]][_0x90fd('0x33')]=_0x2c4f37['transferrate'];this['channels'][_0x2c4f37['uniqueid']][_0x90fd('0x2e')]=_0x2c4f37[_0x90fd('0x2e')];this[_0x90fd('0xb')][_0x2c4f37[_0x90fd('0x24')]][_0x90fd('0x34')]=_0x2c4f37[_0x90fd('0x34')];if(this[_0x90fd('0xb')][_0x2c4f37[_0x90fd('0x24')]][_0x90fd('0x31')]>0x0){tiff2pdf(_0x2c4f37[_0x90fd('0x2e')],_0x90fd('0x35'),function(_0x12928b){logger[_0x90fd('0x27')](_0x2c4f37[_0x90fd('0x24')],_0x90fd('0x36'),_0x12928b['message']);attachment['create']({'name':path[_0x90fd('0x37')](_0x2c4f37[_0x90fd('0x2e')])[_0x90fd('0x26')],'basename':path['parse'](_0x2c4f37['filename'])[_0x90fd('0x26')]+_0x90fd('0x38'),'type':'application/pdf'})['then'](function(_0x3f2769){faxAccount[_0x90fd('0x39')](_0x421177,{'from':_0x2c4f37['calleridnum'],'mapKey':'fax','body':path[_0x90fd('0x37')](_0x2c4f37[_0x90fd('0x2e')])[_0x90fd('0x26')]+'.pdf','AttachmentId':_0x3f2769['id']})[_0x90fd('0x3a')](function(_0x2abcad){logger['error'](_0x2c4f37['uniqueid'],'\x20notify\x20',JSON[_0x90fd('0x3b')](_0x2abcad));});})[_0x90fd('0x3a')](function(_0x4c46c0){logger[_0x90fd('0x3c')](_0x2c4f37[_0x90fd('0x24')],_0x90fd('0x3d'),JSON[_0x90fd('0x3b')](_0x4c46c0));});});}logger[_0x90fd('0x27')](_0x2c4f37['uniqueid'],'\x20receiveFax\x20');}};Fax[_0x90fd('0x1e')][_0x90fd('0x3e')]=function(_0x125874){if(this[_0x90fd('0xe')][_0x125874[_0x90fd('0x24')]]){_[_0x90fd('0x3f')](this[_0x90fd('0xb')][_0x125874[_0x90fd('0x24')]],_[_0x90fd('0x40')](_0x125874,[_0x90fd('0x41'),'reason']));}};function updateStatus(_0x436ad4){if(_0x436ad4[_0x90fd('0x42')]){faxMessage[_0x90fd('0x43')](_0x436ad4[_0x90fd('0x42')],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x1cce5b){ut['logger']('[Fax][Message][Error][Updated]',_0x1cce5b);})[_0x90fd('0x3a')](function(_0xf9eb2d){ut[_0x90fd('0x44')](_0x90fd('0x45'),_0xf9eb2d);});}else{ut[_0x90fd('0x44')](_0x90fd('0x46'));}}Fax[_0x90fd('0x1e')]['updateStatus']=function(_0x55653c,_0x1b81dc,_0x43d076){var _0x1f016e=this;var _0x4c66e1={};if(_0x1b81dc){_0x4c66e1={'read':_0x1b81dc};}else{_0x4c66e1={'failMessage':_0x43d076};}if(this[_0x90fd('0xe')][_0x55653c][_0x90fd('0x42')]){faxMessage[_0x90fd('0x43')](this[_0x90fd('0xe')][_0x55653c][_0x90fd('0x42')],_0x4c66e1)[_0x90fd('0x47')](function(_0x12d9f3){ut[_0x90fd('0x44')]('[Fax][Message][Updated]',_0x12d9f3);})['catch'](function(_0x2d910e){ut[_0x90fd('0x44')](_0x90fd('0x48'),_0x2d910e);})['finally'](function(){delete _0x1f016e[_0x90fd('0xb')][_0x55653c];delete _0x1f016e[_0x90fd('0xe')][_0x55653c];});}else{ut[_0x90fd('0x44')](_0x90fd('0x49'));delete this[_0x90fd('0xb')][_0x55653c];delete this[_0x90fd('0xe')][_0x55653c];}};Fax['prototype'][_0x90fd('0x1c')]=function(_0x4cd8b9){var _0x33e017=this;if(this['channels'][_0x4cd8b9[_0x90fd('0x24')]]){if(this[_0x90fd('0xe')][_0x4cd8b9[_0x90fd('0x24')]]){this[_0x90fd('0xb')][_0x4cd8b9['uniqueid']]['id']=this[_0x90fd('0xe')][_0x4cd8b9[_0x90fd('0x24')]]['id'];this[_0x90fd('0xb')][_0x4cd8b9[_0x90fd('0x24')]][_0x90fd('0x26')]=this[_0x90fd('0xe')][_0x4cd8b9['uniqueid']]['name'];}logger['info'](_0x4cd8b9['uniqueid'],this['actions'][_0x4cd8b9[_0x90fd('0x24')]]?_0x90fd('0x4a'):_0x90fd('0x4b'),JSON[_0x90fd('0x3b')](this[_0x90fd('0xb')][_0x4cd8b9['uniqueid']]));if(this['actions'][_0x4cd8b9['uniqueid']]){if(this[_0x90fd('0xb')][_0x4cd8b9[_0x90fd('0x24')]]['faxpages']>0x0&&this[_0x90fd('0xb')][_0x4cd8b9[_0x90fd('0x24')]][_0x90fd('0x4c')]===_0x90fd('0x4d')){this[_0x90fd('0x4e')](_0x4cd8b9[_0x90fd('0x24')],!![]);}else{this[_0x90fd('0x4e')](_0x4cd8b9[_0x90fd('0x24')],![],this[_0x90fd('0xb')][_0x4cd8b9['uniqueid']][_0x90fd('0x4f')]?_0x90fd('0x50')+this[_0x90fd('0xb')][_0x4cd8b9['uniqueid']]['faxstatusstring']:_0x90fd('0x51'));}}}};Fax[_0x90fd('0x1e')]['send']=function(_0x5f4645){var _0x4d761c=this;return new BPromise(function(_0x49533a,_0x249331){_0x4d761c[_0x90fd('0x52')](_0x5f4645,_0x4d761c[_0x90fd('0xc')][_0x5f4645[_0x90fd('0x53')]])[_0x90fd('0x47')](function(_0x44e599){ut[_0x90fd('0x44')](_0x90fd('0x54'),_0x44e599);_0x49533a(ut['message'](_0x90fd('0x55')));})[_0x90fd('0x3a')](function(_0x9b03d2){ut['logger'](_0x90fd('0x56'),_0x9b03d2);updateStatus(_0x5f4645);_0x249331(ut[_0x90fd('0x57')]('Fax\x20failed'));});});};Fax['prototype'][_0x90fd('0x58')]=function(_0x333c8d){var _0x122794=this;return new BPromise(function(_0x4f1777,_0x13f727){var _0x497953=_0x122794['checkTrunk'](_0x122794[_0x90fd('0xc')][_0x333c8d['FaxAccountId']][_0x90fd('0x59')],_0x333c8d);if(_0x497953[_0x90fd('0x5a')]){_0x4f1777(ut['message'](_0x90fd('0x5b')));}else{_0x13f727(ut[_0x90fd('0x57')](_0x497953[_0x90fd('0x57')]));}});};function originate(_0x454201,_0x6a7a62,_0xd1ecc){return new BPromise(function(_0x4d2436,_0x4c5fd3){if(_0xd1ecc){var _0x4cc539=util['format'](_0x90fd('0x5c'),path[_0x90fd('0x37')](_0x454201[_0x90fd('0x5d')])['name'],_0x454201[_0x90fd('0x5d')]);gs[_0x90fd('0x5e')](_0x4cc539)['then'](function(){_0x454201[_0x90fd('0x5d')]=util[_0x90fd('0x5f')](_0x90fd('0x60'),path[_0x90fd('0x37')](_0x454201['path'])[_0x90fd('0x61')],path[_0x90fd('0x37')](_0x454201['path'])['name']);_0x6a7a62['XMF-PATH']=_0x454201[_0x90fd('0x5d')];ut['logger']('Convert\x20pdf\x20to\x20tif','');ami[_0x90fd('0x62')](ut['variablesAction'](_0x454201,_0x6a7a62))[_0x90fd('0x47')](function(_0x4aed6d){_0x4d2436(_0x4aed6d);})[_0x90fd('0x3a')](function(_0x1662fc){_0x4c5fd3(_0x1662fc);});})[_0x90fd('0x3a')](function(_0x8b947d){_0x4c5fd3(_0x8b947d);});}else{ami['Action'](ut[_0x90fd('0x63')](_0x454201,_0x6a7a62))[_0x90fd('0x47')](function(_0x41a6fe){_0x4d2436(_0x41a6fe);})['catch'](function(_0x5b16a5){_0x4c5fd3(_0x5b16a5);});}});}Fax[_0x90fd('0x1e')][_0x90fd('0x52')]=function(_0xd944ea,_0x2789d1){var _0x1eeb5b=this;return new BPromise(function(_0x278bcf,_0x394a8c){var _0x201a92=uuid['v4']();var _0x3538b2=ut[_0x90fd('0x64')](_0xd944ea,_0x2789d1);_0x1eeb5b[_0x90fd('0xe')][_0x201a92]=new Action(_0x201a92,_0x2789d1,_0xd944ea);var _0x1547d5=_0x1eeb5b[_0x90fd('0xe')][_0x201a92];if(path[_0x90fd('0x37')](_0xd944ea[_0x90fd('0x5d')])[_0x90fd('0x65')]===_0x90fd('0x38')){originate(_0x1547d5,_0x3538b2,!![])['then'](function(_0x2b61ea){_0x278bcf(_0x2b61ea);})[_0x90fd('0x3a')](function(_0x1e309e){_0x394a8c(_0x1e309e);});}else{originate(_0x1547d5,_0x3538b2,![])[_0x90fd('0x47')](function(_0x25e539){_0x278bcf(_0x25e539);})[_0x90fd('0x3a')](function(_0x19d0bf){_0x394a8c(_0x19d0bf);});}});};Fax['prototype'][_0x90fd('0x66')]=function(_0x3b59a1){return!_[_0x90fd('0x67')](_0x3b59a1)&&!_[_0x90fd('0x67')](_0x3b59a1['name'])&&!_[_0x90fd('0x67')](_0x3b59a1[_0x90fd('0x68')])&&_0x3b59a1[_0x90fd('0x68')]&&!_[_0x90fd('0x67')](this[_0x90fd('0xd')][util['format']('SIP/%s',_0x3b59a1[_0x90fd('0x26')])])&&!_[_0x90fd('0x67')](this[_0x90fd('0xd')][util[_0x90fd('0x5f')](_0x90fd('0x69'),_0x3b59a1[_0x90fd('0x26')])]['status'])&&(this[_0x90fd('0xd')][util[_0x90fd('0x5f')](_0x90fd('0x69'),_0x3b59a1[_0x90fd('0x26')])][_0x90fd('0x2d')]===_0x90fd('0x6a')||this[_0x90fd('0xd')][util[_0x90fd('0x5f')](_0x90fd('0x69'),_0x3b59a1['name'])][_0x90fd('0x2d')]===_0x90fd('0x6b'));};Fax[_0x90fd('0x1e')][_0x90fd('0x6c')]=function(_0x65459c,_0x43e37f){if(!this['isTrunkReachable'](_0x65459c)){ut[_0x90fd('0x44')](_0x90fd('0x6d'),_[_0x90fd('0x67')](_0x65459c)?'':_0x65459c[_0x90fd('0x26')]+_0x90fd('0x6e'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x90fd('0x67')](_0x43e37f[_0x90fd('0x6')])){ut[_0x90fd('0x44')](_0x90fd('0x6f'),JSON[_0x90fd('0x3b')](_0x43e37f));return{'isValid':![],'message':_0x90fd('0x70')};}if(_[_0x90fd('0x67')](_0x43e37f[_0x90fd('0x5d')])){ut[_0x90fd('0x44')](_0x90fd('0x71'),JSON['stringify'](_0x43e37f));return{'isValid':![],'message':_0x90fd('0x72')};}return{'isValid':!![],'message':'Is\x20Valid'};};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 9acc8be..d426df8 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 _0x3662=['catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','then'];(function(_0x56205d,_0x4977a7){var _0x28163a=function(_0x4b9580){while(--_0x4b9580){_0x56205d['push'](_0x56205d['shift']());}};_0x28163a(++_0x4977a7);}(_0x3662,0x195));var _0x2366=function(_0x3064cb,_0x1ba4a6){_0x3064cb=_0x3064cb-0x0;var _0x1b7a0a=_0x3662[_0x3064cb];return _0x1b7a0a;};'use strict';var util=require(_0x2366('0x0'));var BPromise=require(_0x2366('0x1'));var logger=require(_0x2366('0x2'))(_0x2366('0x3'));var _=require(_0x2366('0x4'));var faxAccount=require(_0x2366('0x5'));function loggerCatch(_0x3b1361){return function(_0x27bf97){logger[_0x2366('0x6')](_0x3b1361,util[_0x2366('0x7')](_0x27bf97,{'showHidden':![],'depth':null}));};}exports[_0x2366('0x8')]=function(_0x3c0c4,_0x2310f5){return BPromise[_0x2366('0x9')]()[_0x2366('0xa')](faxAccount[_0x2366('0x8')](_0x3c0c4,_0x2310f5))[_0x2366('0xb')](loggerCatch(_0x2366('0xc')));}; \ No newline at end of file +var _0x076c=['inspect','notify','resolve','catch','preview','lodash','../rpc/faxAccount','error'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x076c,0x1b4));var _0xc076=function(_0xadde88,_0x58ad47){_0xadde88=_0xadde88-0x0;var _0x3b8eb6=_0x076c[_0xadde88];return _0x3b8eb6;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0xc076('0x0'));var _=require(_0xc076('0x1'));var faxAccount=require(_0xc076('0x2'));function loggerCatch(_0x13444f){return function(_0x4fa485){logger[_0xc076('0x3')](_0x13444f,util[_0xc076('0x4')](_0x4fa485,{'showHidden':![],'depth':null}));};}exports[_0xc076('0x5')]=function(_0x247771,_0x418d1c){return BPromise[_0xc076('0x6')]()['then'](faxAccount[_0xc076('0x5')](_0x247771,_0x418d1c))[_0xc076('0x7')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 73309c6..ad85849 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 _0x8949=['exec','execute','info','\x20Error\x20:','bluebird'];(function(_0x5f52d6,_0x3cfce5){var _0x850007=function(_0x57be5e){while(--_0x57be5e){_0x5f52d6['push'](_0x5f52d6['shift']());}};_0x850007(++_0x3cfce5);}(_0x8949,0x16c));var _0x9894=function(_0x3bb859,_0x589816){_0x3bb859=_0x3bb859-0x0;var _0x3bf534=_0x8949[_0x3bb859];return _0x3bf534;};'use strict';var util=require('util');var logger=require('../../../../config/logger')('fax');var BPromise=require(_0x9894('0x0'));var exec=require('child_process')[_0x9894('0x1')];exports[_0x9894('0x2')]=function(_0x4bc768){return new BPromise(function(_0x5bcb01,_0x17ced2){exec(_0x4bc768,function(_0x446d5c,_0x3843fa,_0x2717c8){logger['info']('Exec\x20gs',_0x3843fa);if(_0x446d5c){logger[_0x9894('0x3')]('Exec\x20gs',_0x9894('0x4'),util['inspect'](_0x446d5c,{'showHidden':![],'depth':null}),_0x3843fa,_0x2717c8);_0x17ced2(_0x446d5c);}_0x5bcb01(_0x3843fa);});});}; \ No newline at end of file +var _0x3b81=['inspect','../../../../config/logger','fax','bluebird','child_process','exec','info','Exec\x20gs','\x20Error\x20:'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x3b81,0x145));var _0x13b8=function(_0x3a80bd,_0x1fab47){_0x3a80bd=_0x3a80bd-0x0;var _0x1956b3=_0x3b81[_0x3a80bd];return _0x1956b3;};'use strict';var util=require('util');var logger=require(_0x13b8('0x0'))(_0x13b8('0x1'));var BPromise=require(_0x13b8('0x2'));var exec=require(_0x13b8('0x3'))[_0x13b8('0x4')];exports['execute']=function(_0x3096bf){return new BPromise(function(_0x445061,_0x182868){exec(_0x3096bf,function(_0x15db7c,_0x6491ee,_0x2e676c){logger[_0x13b8('0x5')](_0x13b8('0x6'),_0x6491ee);if(_0x15db7c){logger[_0x13b8('0x5')](_0x13b8('0x6'),_0x13b8('0x7'),util[_0x13b8('0x8')](_0x15db7c,{'showHidden':![],'depth':null}),_0x6491ee,_0x2e676c);_0x182868(_0x15db7c);}_0x445061(_0x6491ee);});});}; \ 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 f3c6d0d..08ecbc7 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 _0xbc3e=['\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','ecm','headerinfo','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip'];(function(_0x4856f5,_0x4f6b93){var _0x53f2d2=function(_0x1581b5){while(--_0x1581b5){_0x4856f5['push'](_0x4856f5['shift']());}};_0x53f2d2(++_0x4f6b93);}(_0xbc3e,0xbe));var _0xebc3=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xbc3e[_0x1d1779];return _0x2377e9;};'use strict';var util=require(_0xebc3('0x0'));var _=require(_0xebc3('0x1'));var moment=require(_0xebc3('0x2'));var logger=require(_0xebc3('0x3'))(_0xebc3('0x4'));exports[_0xebc3('0x5')]=function(_0x1357e6){return{'message':_0x1357e6};};exports[_0xebc3('0x6')]=function(_0x3655f5,_0x3549d4){logger[_0xebc3('0x7')](_0x3655f5,util[_0xebc3('0x8')](_0x3549d4,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x22654c,_0x5e4892){var _0x35dcde={'XMF-ECM':_0x5e4892[_0xebc3('0x9')],'XMF-HEADERINFO':_0x5e4892[_0xebc3('0xa')],'XMF-MINRATE':_0x5e4892['minrate'],'XMF-MAXRATE':_0x5e4892[_0xebc3('0xb')],'XMF-MODEM':util[_0xebc3('0xc')](_0xebc3('0xd'),_0x5e4892[_0xebc3('0xe')]),'XMF-GATEWAY':_0x5e4892[_0xebc3('0xf')],'XMF-FAXDETECT':_0x5e4892[_0xebc3('0x10')],'XMF-T38TIMEOUT':_0x5e4892[_0xebc3('0x11')],'XMF-LOCALSTATIONID':_0x5e4892[_0xebc3('0x12')],'XMF-PATH':_0x22654c[_0xebc3('0x13')]};return _0x35dcde;};exports[_0xebc3('0x14')]=function(_0x42f049,_0x10ba95){return{'actionid':_0x42f049[_0xebc3('0x15')],'action':_0xebc3('0x16'),'channel':_0x42f049[_0xebc3('0x17')],'Exten':_0xebc3('0x18'),'Context':_0xebc3('0x19'),'Priority':'1','callerid':util[_0xebc3('0xc')](_0xebc3('0x1a'),_0x42f049['headerinfo']?_0x42f049[_0xebc3('0xa')]:'',_0x42f049[_0xebc3('0x12')]),'variable':_0x10ba95,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x42f049[_0xebc3('0x15')]};}; \ No newline at end of file +var _0xf5b7=['localstationid','path','uniqueid','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','lodash','moment','../../../../config/logger','fax','message','info','inspect','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout'];(function(_0x23b2ea,_0x593eec){var _0x3c8567=function(_0x48e6bc){while(--_0x48e6bc){_0x23b2ea['push'](_0x23b2ea['shift']());}};_0x3c8567(++_0x593eec);}(_0xf5b7,0xf7));var _0x7f5b=function(_0x5d25fe,_0x3190c0){_0x5d25fe=_0x5d25fe-0x0;var _0x5f3a2=_0xf5b7[_0x5d25fe];return _0x5f3a2;};'use strict';var util=require('util');var _=require(_0x7f5b('0x0'));var moment=require(_0x7f5b('0x1'));var logger=require(_0x7f5b('0x2'))(_0x7f5b('0x3'));exports[_0x7f5b('0x4')]=function(_0x2d9117){return{'message':_0x2d9117};};exports['logger']=function(_0x30569b,_0x566b54){logger[_0x7f5b('0x5')](_0x30569b,util[_0x7f5b('0x6')](_0x566b54,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x295885,_0x1fcd6b){var _0x185c7c={'XMF-ECM':_0x1fcd6b[_0x7f5b('0x7')],'XMF-HEADERINFO':_0x1fcd6b[_0x7f5b('0x8')],'XMF-MINRATE':_0x1fcd6b[_0x7f5b('0x9')],'XMF-MAXRATE':_0x1fcd6b[_0x7f5b('0xa')],'XMF-MODEM':util[_0x7f5b('0xb')](_0x7f5b('0xc'),_0x1fcd6b[_0x7f5b('0xd')]),'XMF-GATEWAY':_0x1fcd6b[_0x7f5b('0xe')],'XMF-FAXDETECT':_0x1fcd6b[_0x7f5b('0xf')],'XMF-T38TIMEOUT':_0x1fcd6b[_0x7f5b('0x10')],'XMF-LOCALSTATIONID':_0x1fcd6b[_0x7f5b('0x11')],'XMF-PATH':_0x295885[_0x7f5b('0x12')]};return _0x185c7c;};exports['variablesAction']=function(_0xf5e37,_0xd60829){return{'actionid':_0xf5e37[_0x7f5b('0x13')],'action':_0x7f5b('0x14'),'channel':_0xf5e37[_0x7f5b('0x15')],'Exten':_0x7f5b('0x16'),'Context':'from-sip','Priority':'1','callerid':util[_0x7f5b('0xb')](_0x7f5b('0x17'),_0xf5e37[_0x7f5b('0x8')]?_0xf5e37[_0x7f5b('0x8')]:'',_0xf5e37[_0x7f5b('0x11')]),'variable':_0xd60829,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xf5e37[_0x7f5b('0x13')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index bb951f2..65fc854 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 _0x1ab0=['getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','bluebird','util','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','getAgents','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','getSalesforceAccounts','initSalesforceAccounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ab0,0x1a2));var _0x01ab=function(_0x57abbe,_0x4eedda){_0x57abbe=_0x57abbe-0x0;var _0x3ace4c=_0x1ab0[_0x57abbe];return _0x3ace4c;};'use strict';var BPromise=require(_0x01ab('0x0'));var util=require(_0x01ab('0x1'));var moment=require('moment');var server=require('./server');var Realtime=require(_0x01ab('0x2'));var Report=require(_0x01ab('0x3'));var Acw=require(_0x01ab('0x4'));var Trigger=require('./trigger');var Dialer=require(_0x01ab('0x5'));var Preview=require(_0x01ab('0x6'));var Fax=require(_0x01ab('0x7'));var user=require(_0x01ab('0x8'));var voiceQueue=require(_0x01ab('0x9'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x01ab('0xa'));var trunk=require(_0x01ab('0xb'));var trigger=require(_0x01ab('0xc'));var template=require(_0x01ab('0xd'));var cmHopperHistory=require(_0x01ab('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x01ab('0xf'));var faxAccount=require(_0x01ab('0x10'));var zendesk=require(_0x01ab('0x11'));var salesforce=require(_0x01ab('0x12'));var sugarcrm=require(_0x01ab('0x13'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x01ab('0x14'));var zoho=require(_0x01ab('0x15'));var vtiger=require(_0x01ab('0x16'));var freshsales=require(_0x01ab('0x17'));var servicenow=require(_0x01ab('0x18'));var dynamics365=require(_0x01ab('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 logger=require(_0x01ab('0x1a'))(_0x01ab('0x1b'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x01ab('0x1c')](_0x01ab('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x01ab('0x1c')](_0x01ab('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x01ab('0x1e')]()['then'](user[_0x01ab('0x1f')]())[_0x01ab('0x20')](realtime[_0x01ab('0x21')]())[_0x01ab('0x20')](user[_0x01ab('0x22')]())[_0x01ab('0x20')](realtime[_0x01ab('0x23')]())['then'](trunk[_0x01ab('0x24')]())[_0x01ab('0x20')](realtime[_0x01ab('0x25')]())[_0x01ab('0x20')](voiceQueue[_0x01ab('0x26')]())[_0x01ab('0x20')](realtime[_0x01ab('0x27')]())[_0x01ab('0x20')](trigger['getTriggers']())[_0x01ab('0x20')](realtime[_0x01ab('0x28')]())[_0x01ab('0x20')](template[_0x01ab('0x29')]())[_0x01ab('0x20')](realtime['initTemplates']())[_0x01ab('0x20')](zendesk['getZendeskAccounts']())[_0x01ab('0x20')](realtime['initZendeskAccounts']())[_0x01ab('0x20')](salesforce[_0x01ab('0x2a')]())[_0x01ab('0x20')](realtime[_0x01ab('0x2b')]())[_0x01ab('0x20')](sugarcrm[_0x01ab('0x2c')]())[_0x01ab('0x20')](realtime[_0x01ab('0x2d')]())[_0x01ab('0x20')](freshdesk[_0x01ab('0x2e')]())[_0x01ab('0x20')](realtime[_0x01ab('0x2f')]())[_0x01ab('0x20')](desk['getDeskAccounts']())[_0x01ab('0x20')](realtime[_0x01ab('0x30')]())[_0x01ab('0x20')](zoho[_0x01ab('0x31')]())['then'](realtime[_0x01ab('0x32')]())[_0x01ab('0x20')](vtiger[_0x01ab('0x33')]())['then'](realtime[_0x01ab('0x34')]())[_0x01ab('0x20')](freshsales[_0x01ab('0x35')]())['then'](realtime[_0x01ab('0x36')]())[_0x01ab('0x20')](servicenow[_0x01ab('0x37')]())['then'](realtime[_0x01ab('0x38')]())[_0x01ab('0x20')](dynamics365[_0x01ab('0x39')]())[_0x01ab('0x20')](realtime[_0x01ab('0x3a')]())[_0x01ab('0x20')](campaign[_0x01ab('0x3b')]())[_0x01ab('0x20')](realtime[_0x01ab('0x3c')]())[_0x01ab('0x20')](voiceExtension[_0x01ab('0x3d')]())[_0x01ab('0x20')](realtime['initVoiceExtensions']())['then'](faxAccount[_0x01ab('0x3e')]())[_0x01ab('0x20')](realtime[_0x01ab('0x3f')]())[_0x01ab('0x20')](function(){return realtime;});}function initParams(){return BPromise[_0x01ab('0x1e')]()['then'](voiceQueueReport[_0x01ab('0x40')]())[_0x01ab('0x20')](realtime['initVoiceQueueReports']())[_0x01ab('0x20')](cmHopperHistory[_0x01ab('0x41')]())[_0x01ab('0x20')](realtime[_0x01ab('0x42')]())[_0x01ab('0x20')](cmHopperHistory['getCampaignHopperHistory']())[_0x01ab('0x20')](realtime[_0x01ab('0x43')]())['then'](voiceCallReport[_0x01ab('0x44')]())[_0x01ab('0x20')](realtime[_0x01ab('0x45')]())[_0x01ab('0x46')](function(_0x555a42){logger[_0x01ab('0x47')](_0x01ab('0x48'),util[_0x01ab('0x49')](_0x555a42,{'showHidden':![],'depth':null}));});}function main(){return server[_0x01ab('0x4a')](realtime,preview,fax)[_0x01ab('0x20')](function(_0x285748){return initRealtime();})[_0x01ab('0x20')](function(){return initParams();})['then'](function(){report[_0x01ab('0x4b')]();setInterval(initRealtime,0x1388);})[_0x01ab('0x46')](function(_0x3007fa){logger[_0x01ab('0x47')](_0x01ab('0x4c'),util[_0x01ab('0x49')](_0x3007fa,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x9622=['initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initCampaignHopperHistory','error','[index.js][initParams]','sync','[index.js][main]','inspect','bluebird','util','./server','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','ami','get','hour','resolve','then','getAgents'];(function(_0x4eca6c,_0x234e6e){var _0x40959b=function(_0x591b2b){while(--_0x591b2b){_0x4eca6c['push'](_0x4eca6c['shift']());}};_0x40959b(++_0x234e6e);}(_0x9622,0xad));var _0x2962=function(_0x2d719c,_0x59b346){_0x2d719c=_0x2d719c-0x0;var _0x16c7e8=_0x9622[_0x2d719c];return _0x16c7e8;};'use strict';var BPromise=require(_0x2962('0x0'));var util=require(_0x2962('0x1'));var moment=require('moment');var server=require(_0x2962('0x2'));var Realtime=require(_0x2962('0x3'));var Report=require(_0x2962('0x4'));var Acw=require(_0x2962('0x5'));var Trigger=require(_0x2962('0x6'));var Dialer=require('./dialer');var Preview=require(_0x2962('0x7'));var Fax=require(_0x2962('0x8'));var user=require(_0x2962('0x9'));var voiceQueue=require(_0x2962('0xa'));var voiceQueueReport=require(_0x2962('0xb'));var voiceCallReport=require(_0x2962('0xc'));var trunk=require(_0x2962('0xd'));var trigger=require(_0x2962('0xe'));var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x2962('0xf'));var voiceExtension=require(_0x2962('0x10'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x2962('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x2962('0x12'));var freshdesk=require(_0x2962('0x13'));var desk=require(_0x2962('0x14'));var zoho=require(_0x2962('0x15'));var vtiger=require(_0x2962('0x16'));var freshsales=require(_0x2962('0x17'));var servicenow=require(_0x2962('0x18'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x2962('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x2962('0x1a')](_0x2962('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x2962('0x1a')](_0x2962('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x2962('0x1c')]()[_0x2962('0x1d')](user[_0x2962('0x1e')]())[_0x2962('0x1d')](realtime[_0x2962('0x1f')]())['then'](user[_0x2962('0x20')]())[_0x2962('0x1d')](realtime[_0x2962('0x21')]())[_0x2962('0x1d')](trunk[_0x2962('0x22')]())[_0x2962('0x1d')](realtime[_0x2962('0x23')]())[_0x2962('0x1d')](voiceQueue[_0x2962('0x24')]())[_0x2962('0x1d')](realtime[_0x2962('0x25')]())['then'](trigger['getTriggers']())['then'](realtime[_0x2962('0x26')]())[_0x2962('0x1d')](template[_0x2962('0x27')]())[_0x2962('0x1d')](realtime[_0x2962('0x28')]())[_0x2962('0x1d')](zendesk[_0x2962('0x29')]())[_0x2962('0x1d')](realtime['initZendeskAccounts']())[_0x2962('0x1d')](salesforce['getSalesforceAccounts']())['then'](realtime['initSalesforceAccounts']())[_0x2962('0x1d')](sugarcrm['getSugarcrmAccounts']())[_0x2962('0x1d')](realtime[_0x2962('0x2a')]())[_0x2962('0x1d')](freshdesk['getFreshdeskAccounts']())[_0x2962('0x1d')](realtime[_0x2962('0x2b')]())['then'](desk[_0x2962('0x2c')]())[_0x2962('0x1d')](realtime[_0x2962('0x2d')]())[_0x2962('0x1d')](zoho[_0x2962('0x2e')]())[_0x2962('0x1d')](realtime['initZohoAccounts']())[_0x2962('0x1d')](vtiger[_0x2962('0x2f')]())[_0x2962('0x1d')](realtime[_0x2962('0x30')]())['then'](freshsales[_0x2962('0x31')]())[_0x2962('0x1d')](realtime[_0x2962('0x32')]())[_0x2962('0x1d')](servicenow[_0x2962('0x33')]())['then'](realtime[_0x2962('0x34')]())['then'](dynamics365[_0x2962('0x35')]())['then'](realtime[_0x2962('0x36')]())[_0x2962('0x1d')](campaign[_0x2962('0x37')]())[_0x2962('0x1d')](realtime[_0x2962('0x38')]())['then'](voiceExtension[_0x2962('0x39')]())[_0x2962('0x1d')](realtime['initVoiceExtensions']())['then'](faxAccount[_0x2962('0x3a')]())['then'](realtime[_0x2962('0x3b')]())[_0x2962('0x1d')](function(){return realtime;});}function initParams(){return BPromise[_0x2962('0x1c')]()[_0x2962('0x1d')](voiceQueueReport[_0x2962('0x3c')]())['then'](realtime['initVoiceQueueReports']())[_0x2962('0x1d')](cmHopperHistory[_0x2962('0x3d')]())[_0x2962('0x1d')](realtime['initVoiceQueueHopperHistory']())[_0x2962('0x1d')](cmHopperHistory['getCampaignHopperHistory']())[_0x2962('0x1d')](realtime[_0x2962('0x3e')]())['then'](voiceCallReport['getVoiceCallReports']())[_0x2962('0x1d')](realtime['initVoiceCallReports']())['catch'](function(_0x4977f3){logger[_0x2962('0x3f')](_0x2962('0x40'),util['inspect'](_0x4977f3,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x2962('0x1d')](function(_0x5e6305){return initRealtime();})['then'](function(){return initParams();})[_0x2962('0x1d')](function(){report[_0x2962('0x41')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x4ed284){logger[_0x2962('0x3f')](_0x2962('0x42'),util[_0x2962('0x43')](_0x4ed284,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 7bf4cad..b3a64b5 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 _0x70e0=['name','voiceStatusQueue','onhold','stringify','md5','user:%s','user:save','emit','user:presence','lodash','util','moment','../../../config/environment','redis','defaults','socket.io-emitter','email','accountcode','fullname','state','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','local','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','format'];(function(_0x12b54c,_0x25f8d3){var _0x4039f3=function(_0x1697e1){while(--_0x1697e1){_0x12b54c['push'](_0x12b54c['shift']());}};_0x4039f3(++_0x25f8d3);}(_0x70e0,0x17b));var _0x070e=function(_0x117335,_0x4867a3){_0x117335=_0x117335-0x0;var _0x2e7632=_0x70e0[_0x117335];return _0x2e7632;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x070e('0x3'));config[_0x070e('0x4')]=_[_0x070e('0x5')](config[_0x070e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x070e('0x6'))(new Redis(config['redis']));function Agent(_0x46fe68){this['id']=_0x46fe68['id']||0x0;this['name']=_0x46fe68['name']||'';this['email']=_0x46fe68[_0x070e('0x7')]||'';this[_0x070e('0x8')]=_0x46fe68[_0x070e('0x8')]||'';this[_0x070e('0x9')]=_0x46fe68[_0x070e('0x9')]||'';this[_0x070e('0xa')]=_0x070e('0xb');this['stateTime']=0x0;this['status']=_0x070e('0xb');this[_0x070e('0xc')]='';this[_0x070e('0xd')]='';this[_0x070e('0xe')]='';this[_0x070e('0xf')]='';this[_0x070e('0x10')]=_0x46fe68[_0x070e('0x10')]||![];this[_0x070e('0x11')]=_0x070e('0xb');this[_0x070e('0x12')]=0x0;this[_0x070e('0x13')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0x070e('0x14')]=![];this['md5']='';}Agent['prototype']['updateStatusRealtime']=function(_0x11d2ce){var _0x14c3fd;if(_0x11d2ce&&_0x11d2ce['state']){_0x14c3fd=_0x11d2ce['state'][_0x070e('0x15')]();switch(_0x14c3fd){case _0x070e('0x16'):_0x14c3fd=_0x070e('0x17');break;case _0x070e('0x18'):_0x14c3fd='talking';break;}}if(_0x14c3fd&&this['voiceStatus']!==_0x14c3fd||_0x11d2ce[_0x070e('0x19')]){this[_0x070e('0x12')]=_[_0x070e('0x1a')](moment()[_0x070e('0x1b')]('x'));}if(_0x14c3fd){this[_0x070e('0x11')]=_0x14c3fd;}var _0x5037eb={'id':this['id'],'name':this[_0x070e('0x1c')],'email':this[_0x070e('0x7')],'accountcode':this[_0x070e('0x8')],'fullname':this[_0x070e('0x9')],'state':this[_0x070e('0xa')],'stateTime':this['stateTime'],'status':this['status'],'address':this['address'],'online':this[_0x070e('0x10')],'voiceStatus':this[_0x070e('0x11')],'voiceStatusTime':this[_0x070e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x070e('0x1d')],'interface':this['interface'],'onhold':this[_0x070e('0x1e')]};var _0x3f6985=md5(JSON[_0x070e('0x1f')](_0x5037eb));if(this[_0x070e('0x20')]!==_0x3f6985){this[_0x070e('0x20')]=_0x3f6985;io['to'](util[_0x070e('0x1b')](_0x070e('0x21'),_0x5037eb[_0x070e('0x1c')]))['emit'](_0x070e('0x22'),_0x5037eb);io[_0x070e('0x23')](_0x070e('0x24'),_0x5037eb);}};module['exports']=Agent; \ No newline at end of file +var _0xedd9=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','state','toLowerCase','idle','inuse','talking','statePause','toNumber','interface','format','user:%s','user:save','emit','user:presence','exports','util','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','unknown','status'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xedd9,0xfc));var _0x9edd=function(_0x5e0691,_0x551f13){_0x5e0691=_0x5e0691-0x0;var _0x393981=_0xedd9[_0x5e0691];return _0x393981;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var md5=require(_0x9edd('0x2'));var Redis=require(_0x9edd('0x3'));var config=require(_0x9edd('0x4'));config[_0x9edd('0x5')]=_[_0x9edd('0x6')](config[_0x9edd('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9edd('0x7'))(new Redis(config[_0x9edd('0x5')]));function Agent(_0x268f9e){this['id']=_0x268f9e['id']||0x0;this[_0x9edd('0x8')]=_0x268f9e['name']||'';this[_0x9edd('0x9')]=_0x268f9e['email']||'';this[_0x9edd('0xa')]=_0x268f9e[_0x9edd('0xa')]||'';this[_0x9edd('0xb')]=_0x268f9e[_0x9edd('0xb')]||'';this['state']=_0x9edd('0xc');this['stateTime']=0x0;this[_0x9edd('0xd')]=_0x9edd('0xc');this['address']='';this[_0x9edd('0xe')]='';this[_0x9edd('0xf')]='';this['interface']='';this[_0x9edd('0x10')]=_0x268f9e[_0x9edd('0x10')]||![];this[_0x9edd('0x11')]=_0x9edd('0xc');this[_0x9edd('0x12')]=0x0;this[_0x9edd('0x13')]='';this[_0x9edd('0x14')]='';this[_0x9edd('0x15')]=![];this['local']=![];this[_0x9edd('0x2')]='';}Agent[_0x9edd('0x16')][_0x9edd('0x17')]=function(_0x4d9a7){var _0x13b6b6;if(_0x4d9a7&&_0x4d9a7[_0x9edd('0x18')]){_0x13b6b6=_0x4d9a7[_0x9edd('0x18')][_0x9edd('0x19')]();switch(_0x13b6b6){case'not_inuse':_0x13b6b6=_0x9edd('0x1a');break;case _0x9edd('0x1b'):_0x13b6b6=_0x9edd('0x1c');break;}}if(_0x13b6b6&&this['voiceStatus']!==_0x13b6b6||_0x4d9a7[_0x9edd('0x1d')]){this[_0x9edd('0x12')]=_[_0x9edd('0x1e')](moment()['format']('x'));}if(_0x13b6b6){this[_0x9edd('0x11')]=_0x13b6b6;}var _0x5d879c={'id':this['id'],'name':this[_0x9edd('0x8')],'email':this[_0x9edd('0x9')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x9edd('0x18')],'stateTime':this['stateTime'],'status':this[_0x9edd('0xd')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0x9edd('0x11')],'voiceStatusTime':this[_0x9edd('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x9edd('0x1f')],'onhold':this[_0x9edd('0x15')]};var _0x477878=md5(JSON['stringify'](_0x5d879c));if(this[_0x9edd('0x2')]!==_0x477878){this[_0x9edd('0x2')]=_0x477878;io['to'](util[_0x9edd('0x20')](_0x9edd('0x21'),_0x5d879c[_0x9edd('0x8')]))['emit'](_0x9edd('0x22'),_0x5d879c);io[_0x9edd('0x23')](_0x9edd('0x24'),_0x5d879c);}};module[_0x9edd('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index c48e807..fe23d80 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 _0x1d2b=['dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence'];(function(_0x28f34f,_0x1a52da){var _0x492b24=function(_0x57e343){while(--_0x57e343){_0x28f34f['push'](_0x28f34f['shift']());}};_0x492b24(++_0x1a52da);}(_0x1d2b,0x6e));var _0xb1d2=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x1d2b[_0x501510];return _0x1e6ee5;};'use strict';function Campaign(_0x5c4230){this['id']=_0x5c4230['id']||0x0;this[_0xb1d2('0x0')]=_0x5c4230[_0xb1d2('0x0')]||'';this[_0xb1d2('0x1')]=_0x5c4230[_0xb1d2('0x1')]||_0xb1d2('0x2');this[_0xb1d2('0x3')]=0x0;this[_0xb1d2('0x4')]=0x0;this[_0xb1d2('0x5')]=0x0;this[_0xb1d2('0x6')]=0x0;this[_0xb1d2('0x7')]='';this[_0xb1d2('0x8')]=!![];this[_0xb1d2('0x9')]=_0x5c4230[_0xb1d2('0x9')];this[_0xb1d2('0xa')]=_0x5c4230[_0xb1d2('0xa')];this['dialTimezone']=_0x5c4230[_0xb1d2('0xb')]||null;this[_0xb1d2('0xc')]=_0x5c4230[_0xb1d2('0xc')]?_0x5c4230['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x5c4230[_0xb1d2('0xd')];this[_0xb1d2('0xe')]=_0x5c4230[_0xb1d2('0xe')];this[_0xb1d2('0xf')]=_0x5c4230['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x5c4230[_0xb1d2('0x10')];this[_0xb1d2('0x11')]=_0x5c4230['dialCongestionRetryFrequency'];this[_0xb1d2('0x12')]=_0x5c4230['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x5c4230[_0xb1d2('0x13')];this[_0xb1d2('0x14')]=_0x5c4230[_0xb1d2('0x14')];this['dialNoAnswerRetryFrequency']=_0x5c4230[_0xb1d2('0x15')];this[_0xb1d2('0x16')]=_0x5c4230[_0xb1d2('0x16')];this[_0xb1d2('0x17')]=_0x5c4230['dialNoSuchNumberMaxRetry']||0x3;this[_0xb1d2('0x18')]=_0x5c4230[_0xb1d2('0x18')]||0x96;this[_0xb1d2('0x19')]=_0x5c4230[_0xb1d2('0x19')]||0x3;this[_0xb1d2('0x1a')]=_0x5c4230[_0xb1d2('0x1a')]||0x96;this['dialAbandonedMaxRetry']=_0x5c4230[_0xb1d2('0x1b')]||0x3;this[_0xb1d2('0x1c')]=_0x5c4230[_0xb1d2('0x1c')]||0x96;this[_0xb1d2('0x1d')]=_0x5c4230[_0xb1d2('0x1d')]||0x3;this['dialMachineRetryFrequency']=_0x5c4230[_0xb1d2('0x1e')]||0x96;this[_0xb1d2('0x1f')]=_0x5c4230['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x5c4230[_0xb1d2('0x20')]||0x96;this[_0xb1d2('0x21')]=_0x5c4230[_0xb1d2('0x21')]||_0xb1d2('0x22');this[_0xb1d2('0x23')]=_0x5c4230[_0xb1d2('0x23')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x5c4230['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xb1d2('0x24')]=_0x5c4230[_0xb1d2('0x24')]||undefined;this['TrunkBackup']=_0x5c4230[_0xb1d2('0x25')]?_0x5c4230[_0xb1d2('0x25')]:undefined;this[_0xb1d2('0x26')]=_0x5c4230[_0xb1d2('0x26')]?_0x5c4230[_0xb1d2('0x26')]:undefined;this['Interval']=_0x5c4230[_0xb1d2('0x27')]?_0x5c4230[_0xb1d2('0x27')]:undefined;this['SquareProject']=_0x5c4230[_0xb1d2('0x28')]?_0x5c4230[_0xb1d2('0x28')]:undefined;this[_0xb1d2('0x29')]=_0x5c4230[_0xb1d2('0x28')]?_0x5c4230[_0xb1d2('0x28')]['name']:undefined;this['dialAMDActive']=_0x5c4230[_0xb1d2('0x2a')]||![];this[_0xb1d2('0x2b')]=_0x5c4230[_0xb1d2('0x2b')];this[_0xb1d2('0x2c')]=_0x5c4230[_0xb1d2('0x2c')];this[_0xb1d2('0x2d')]=_0x5c4230[_0xb1d2('0x2d')];this[_0xb1d2('0x2e')]=_0x5c4230['dialAMDTotalAnalysisTime'];this[_0xb1d2('0x2f')]=_0x5c4230['dialAMDMinWordLength'];this[_0xb1d2('0x30')]=_0x5c4230[_0xb1d2('0x30')];this[_0xb1d2('0x31')]=_0x5c4230[_0xb1d2('0x31')];this[_0xb1d2('0x32')]=_0x5c4230[_0xb1d2('0x32')];this[_0xb1d2('0x33')]=_0x5c4230[_0xb1d2('0x33')];}module[_0xb1d2('0x34')]=Campaign; \ No newline at end of file +var _0x3bd2=['dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry'];(function(_0x3c7e8d,_0x5cc184){var _0x1b8a25=function(_0x18be6e){while(--_0x18be6e){_0x3c7e8d['push'](_0x3c7e8d['shift']());}};_0x1b8a25(++_0x5cc184);}(_0x3bd2,0x18b));var _0x23bd=function(_0x162a12,_0x1e8640){_0x162a12=_0x162a12-0x0;var _0xc42e16=_0x3bd2[_0x162a12];return _0xc42e16;};'use strict';function Campaign(_0x43e351){this['id']=_0x43e351['id']||0x0;this[_0x23bd('0x0')]=_0x43e351[_0x23bd('0x0')]||'';this['type']=_0x43e351[_0x23bd('0x1')]||_0x23bd('0x2');this[_0x23bd('0x3')]=0x0;this['temp']=0x0;this[_0x23bd('0x4')]=0x0;this[_0x23bd('0x5')]=0x0;this[_0x23bd('0x6')]='';this[_0x23bd('0x7')]=!![];this[_0x23bd('0x8')]=_0x43e351[_0x23bd('0x8')];this[_0x23bd('0x9')]=_0x43e351[_0x23bd('0x9')];this['dialTimezone']=_0x43e351[_0x23bd('0xa')]||null;this['dialGlobalInterval']=_0x43e351[_0x23bd('0xb')]?_0x43e351[_0x23bd('0xb')]:null;this['dialOriginateCallerIdName']=_0x43e351['dialOriginateCallerIdName'];this[_0x23bd('0xc')]=_0x43e351[_0x23bd('0xc')];this[_0x23bd('0xd')]=_0x43e351[_0x23bd('0xd')]||0x1e;this[_0x23bd('0xe')]=_0x43e351['dialCongestionMaxRetry'];this[_0x23bd('0xf')]=_0x43e351[_0x23bd('0xf')];this['dialBusyMaxRetry']=_0x43e351['dialBusyMaxRetry'];this[_0x23bd('0x10')]=_0x43e351['dialBusyRetryFrequency'];this[_0x23bd('0x11')]=_0x43e351[_0x23bd('0x11')];this['dialNoAnswerRetryFrequency']=_0x43e351['dialNoAnswerRetryFrequency'];this[_0x23bd('0x12')]=_0x43e351[_0x23bd('0x12')];this[_0x23bd('0x13')]=_0x43e351[_0x23bd('0x13')]||0x3;this[_0x23bd('0x14')]=_0x43e351[_0x23bd('0x14')]||0x96;this['dialDropMaxRetry']=_0x43e351[_0x23bd('0x15')]||0x3;this['dialDropRetryFrequency']=_0x43e351[_0x23bd('0x16')]||0x96;this[_0x23bd('0x17')]=_0x43e351['dialAbandonedMaxRetry']||0x3;this[_0x23bd('0x18')]=_0x43e351[_0x23bd('0x18')]||0x96;this[_0x23bd('0x19')]=_0x43e351['dialMachineMaxRetry']||0x3;this[_0x23bd('0x1a')]=_0x43e351['dialMachineRetryFrequency']||0x96;this[_0x23bd('0x1b')]=_0x43e351[_0x23bd('0x1b')]||0x3;this[_0x23bd('0x1c')]=_0x43e351[_0x23bd('0x1c')]||0x96;this[_0x23bd('0x1d')]=_0x43e351[_0x23bd('0x1d')]||_0x23bd('0x1e');this[_0x23bd('0x1f')]=_0x43e351[_0x23bd('0x1f')]||undefined;this[_0x23bd('0x20')]=_0x43e351[_0x23bd('0x20')]||undefined;this[_0x23bd('0x21')]=_0x43e351[_0x23bd('0x21')]||undefined;this['TrunkBackup']=_0x43e351['TrunkBackup']?_0x43e351['TrunkBackup']:undefined;this['Trunk']=_0x43e351[_0x23bd('0x22')]?_0x43e351[_0x23bd('0x22')]:undefined;this[_0x23bd('0x23')]=_0x43e351[_0x23bd('0x23')]?_0x43e351[_0x23bd('0x23')]:undefined;this[_0x23bd('0x24')]=_0x43e351[_0x23bd('0x24')]?_0x43e351[_0x23bd('0x24')]:undefined;this['dialQueueProject']=_0x43e351['SquareProject']?_0x43e351[_0x23bd('0x24')]['name']:undefined;this[_0x23bd('0x25')]=_0x43e351[_0x23bd('0x25')]||![];this['dialAMDInitialSilence']=_0x43e351[_0x23bd('0x26')];this['dialAMDGreeting']=_0x43e351['dialAMDGreeting'];this[_0x23bd('0x27')]=_0x43e351[_0x23bd('0x27')];this['dialAMDTotalAnalysisTime']=_0x43e351['dialAMDTotalAnalysisTime'];this[_0x23bd('0x28')]=_0x43e351[_0x23bd('0x28')];this[_0x23bd('0x29')]=_0x43e351[_0x23bd('0x29')];this['dialAMDMaximumNumberOfWords']=_0x43e351[_0x23bd('0x2a')];this[_0x23bd('0x2b')]=_0x43e351[_0x23bd('0x2b')];this[_0x23bd('0x2c')]=_0x43e351['dialAMDMaximumWordLength'];}module[_0x23bd('0x2d')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 4112474..425af3b 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 _0x2fc9=['lastdata','duration','billableseconds','holdtime','tag','disposition','monitor','queue','monitors','transfercalleridnum','mohtime','exports','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','unmanaged','abandoned','lastapplication'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2fc9,0xc2));var _0x92fc=function(_0x15b380,_0x1a3c5f){_0x15b380=_0x15b380-0x0;var _0x232c5c=_0x2fc9[_0x15b380];return _0x232c5c;};'use strict';function Channel(){this['starttime']=null;this[_0x92fc('0x0')]='';this[_0x92fc('0x1')]='';this[_0x92fc('0x2')]=0x0;this[_0x92fc('0x3')]='';this[_0x92fc('0x4')]=undefined;this[_0x92fc('0x5')]=undefined;this[_0x92fc('0x6')]=0x0;this[_0x92fc('0x7')]='';this[_0x92fc('0x8')]=0x0;this[_0x92fc('0x9')]=0x0;this[_0x92fc('0xa')]=0x0;this['answered']=![];this['answertime']=null;this['endtime']=null;this[_0x92fc('0xb')]=![];this[_0x92fc('0xc')]=![];this[_0x92fc('0xd')]='';this[_0x92fc('0xe')]='';this[_0x92fc('0xf')]=0x0;this[_0x92fc('0x10')]=0x0;this[_0x92fc('0x11')]=0x0;this['type']=null;this[_0x92fc('0x12')]=null;this[_0x92fc('0x13')]=null;this[_0x92fc('0x14')]=![];this['monitorFilename']=null;this[_0x92fc('0x15')]=null;this[_0x92fc('0x16')]=[];this[_0x92fc('0x17')]=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this[_0x92fc('0x18')]=0x0;}module[_0x92fc('0x19')]=Channel; \ No newline at end of file +var _0xc177=['mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode','context','uniqueid','exten','answered','answertime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitors','transfercalleridnum','transferconnectedlinenum'];(function(_0x867b0a,_0x587ccf){var _0x137438=function(_0xbeafa6){while(--_0xbeafa6){_0x867b0a['push'](_0x867b0a['shift']());}};_0x137438(++_0x587ccf);}(_0xc177,0x1b2));var _0x7c17=function(_0x14557a,_0x5f0a18){_0x14557a=_0x14557a-0x0;var _0x255594=_0xc177[_0x14557a];return _0x255594;};'use strict';function Channel(){this[_0x7c17('0x0')]=null;this[_0x7c17('0x1')]='';this[_0x7c17('0x2')]='';this[_0x7c17('0x3')]=0x0;this[_0x7c17('0x4')]='';this['connectedlinenum']=undefined;this[_0x7c17('0x5')]=undefined;this[_0x7c17('0x6')]=0x0;this[_0x7c17('0x7')]='';this[_0x7c17('0x8')]=0x0;this['linkedid']=0x0;this[_0x7c17('0x9')]=0x0;this[_0x7c17('0xa')]=![];this[_0x7c17('0xb')]=null;this['endtime']=null;this[_0x7c17('0xc')]=![];this[_0x7c17('0xd')]=![];this[_0x7c17('0xe')]='';this[_0x7c17('0xf')]='';this[_0x7c17('0x10')]=0x0;this[_0x7c17('0x11')]=0x0;this[_0x7c17('0x12')]=0x0;this[_0x7c17('0x13')]=null;this[_0x7c17('0x14')]=null;this[_0x7c17('0x15')]=null;this['monitor']=![];this['monitorFilename']=null;this['queue']=null;this[_0x7c17('0x16')]=[];this[_0x7c17('0x17')]=undefined;this[_0x7c17('0x18')]=undefined;this['transferType']=undefined;this[_0x7c17('0x19')]=0x0;}module[_0x7c17('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 c0d1d85..ee2d2b2 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 _0xe383=['name','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xe383,0x1e0));var _0x3e38=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe383[_0xa464c9];return _0x3d73c4;};'use strict';function DeskAccount(_0x5a16fd){this['id']=_0x5a16fd['id']||0x0;this[_0x3e38('0x0')]=_0x5a16fd[_0x3e38('0x0')]||'';this['username']=_0x5a16fd['username']||'';this['remoteUri']=_0x5a16fd[_0x3e38('0x1')]||'';this['authType']=_0x5a16fd[_0x3e38('0x2')]||'';this[_0x3e38('0x3')]=_0x5a16fd['password']||'';this[_0x3e38('0x4')]=_0x5a16fd[_0x3e38('0x4')]||'';this['consumerSecret']=_0x5a16fd[_0x3e38('0x5')]||'';this[_0x3e38('0x6')]=_0x5a16fd['token']||'';this[_0x3e38('0x7')]=_0x5a16fd['tokenSecret']||'';this[_0x3e38('0x8')]=_0x5a16fd[_0x3e38('0x8')]||'';this[_0x3e38('0x9')]=_0x5a16fd['serverUrl']||'';this[_0x3e38('0xa')]=_0x5a16fd[_0x3e38('0xa')]||{};}module[_0x3e38('0xb')]=DeskAccount; \ No newline at end of file +var _0x77da=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','remoteUri','authType'];(function(_0x53abe5,_0x33a9e5){var _0xc1c37e=function(_0xd53c6e){while(--_0xd53c6e){_0x53abe5['push'](_0x53abe5['shift']());}};_0xc1c37e(++_0x33a9e5);}(_0x77da,0x97));var _0xa77d=function(_0x3a2c69,_0x48b0b1){_0x3a2c69=_0x3a2c69-0x0;var _0x4d5f37=_0x77da[_0x3a2c69];return _0x4d5f37;};'use strict';function DeskAccount(_0x1fe7c2){this['id']=_0x1fe7c2['id']||0x0;this['name']=_0x1fe7c2[_0xa77d('0x0')]||'';this['username']=_0x1fe7c2['username']||'';this[_0xa77d('0x1')]=_0x1fe7c2[_0xa77d('0x1')]||'';this[_0xa77d('0x2')]=_0x1fe7c2['authType']||'';this[_0xa77d('0x3')]=_0x1fe7c2[_0xa77d('0x3')]||'';this[_0xa77d('0x4')]=_0x1fe7c2['consumerKey']||'';this[_0xa77d('0x5')]=_0x1fe7c2['consumerSecret']||'';this[_0xa77d('0x6')]=_0x1fe7c2[_0xa77d('0x6')]||'';this[_0xa77d('0x7')]=_0x1fe7c2[_0xa77d('0x7')]||'';this['type']=_0x1fe7c2[_0xa77d('0x8')]||'';this['serverUrl']=_0x1fe7c2[_0xa77d('0x9')]||'';this[_0xa77d('0xa')]=_0x1fe7c2[_0xa77d('0xa')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index e9a0892..735e8e2 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 _0xcb91=['clientId','clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId'];(function(_0x1a043b,_0x4d540a){var _0x105ff5=function(_0x49532e){while(--_0x49532e){_0x1a043b['push'](_0x1a043b['shift']());}};_0x105ff5(++_0x4d540a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3fe042,_0x1106f7){_0x3fe042=_0x3fe042-0x0;var _0x7d4a1f=_0xcb91[_0x3fe042];return _0x7d4a1f;};'use strict';function Dynamics365Account(_0x181cac){this['id']=_0x181cac['id']||0x0;this['name']=_0x181cac[_0x1cb9('0x0')]||'';this[_0x1cb9('0x1')]=_0x181cac[_0x1cb9('0x1')]||'';this[_0x1cb9('0x2')]=_0x181cac['password']||'';this[_0x1cb9('0x3')]=_0x181cac[_0x1cb9('0x3')]||'';this['tenantId']=_0x181cac[_0x1cb9('0x4')]||'';this[_0x1cb9('0x5')]=_0x181cac['clientId']||'';this[_0x1cb9('0x6')]=_0x181cac[_0x1cb9('0x6')]||{};this['serverUrl']=_0x181cac[_0x1cb9('0x7')]||'';this[_0x1cb9('0x8')]=_0x181cac['Configurations']||{};}module[_0x1cb9('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x91a7=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations'];(function(_0x54faff,_0x9a3b5e){var _0x5a784c=function(_0x3d1147){while(--_0x3d1147){_0x54faff['push'](_0x54faff['shift']());}};_0x5a784c(++_0x9a3b5e);}(_0x91a7,0xe7));var _0x791a=function(_0x27669b,_0x306a2c){_0x27669b=_0x27669b-0x0;var _0x31ed6e=_0x91a7[_0x27669b];return _0x31ed6e;};'use strict';function Dynamics365Account(_0x27c92e){this['id']=_0x27c92e['id']||0x0;this[_0x791a('0x0')]=_0x27c92e[_0x791a('0x0')]||'';this[_0x791a('0x1')]=_0x27c92e['username']||'';this[_0x791a('0x2')]=_0x27c92e['password']||'';this[_0x791a('0x3')]=_0x27c92e['remoteUri']||'';this['tenantId']=_0x27c92e[_0x791a('0x4')]||'';this[_0x791a('0x5')]=_0x27c92e['clientId']||'';this[_0x791a('0x6')]=_0x27c92e['clientSecret']||{};this[_0x791a('0x7')]=_0x27c92e[_0x791a('0x7')]||'';this['Configurations']=_0x27c92e[_0x791a('0x8')]||{};}module[_0x791a('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 c24f80f..0901238 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 _0x26a9=['gateway','faxdetect','t38timeout','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29'];(function(_0x5af966,_0x1520a4){var _0x4f9dbc=function(_0x284580){while(--_0x284580){_0x5af966['push'](_0x5af966['shift']());}};_0x4f9dbc(++_0x1520a4);}(_0x26a9,0x13a));var _0x926a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x26a9[_0x3dd15e];return _0x231fd0;};'use strict';function FaxAccount(_0xd530f2){this['id']=_0xd530f2['id']||0x0;this[_0x926a('0x0')]=_0xd530f2['name']||'';this[_0x926a('0x1')]=_0xd530f2[_0x926a('0x1')];this[_0x926a('0x2')]=_0xd530f2[_0x926a('0x2')];this[_0x926a('0x3')]=_0xd530f2[_0x926a('0x3')];this[_0x926a('0x4')]=_0xd530f2['localstationid'];this[_0x926a('0x5')]=_0xd530f2[_0x926a('0x5')]||0x960;this[_0x926a('0x6')]=_0xd530f2['maxrate']||0x3840;this[_0x926a('0x7')]=_0xd530f2[_0x926a('0x7')]||_0x926a('0x8');this[_0x926a('0x9')]=_0xd530f2[_0x926a('0x9')]||'no';this[_0x926a('0xa')]=_0xd530f2[_0x926a('0xa')]||'no';this[_0x926a('0xb')]=_0xd530f2[_0x926a('0xb')]||0x1388;this['tech']=_0xd530f2['tech']||_0x926a('0xc');this[_0x926a('0xd')]=_0xd530f2[_0x926a('0xd')]?_0xd530f2[_0x926a('0xd')]:undefined;this[_0x926a('0xe')]=_0xd530f2['ListId'];this[_0x926a('0xf')]=_0xd530f2[_0x926a('0xf')];}module[_0x926a('0x10')]=FaxAccount; \ No newline at end of file +var _0x83b4=['key','name','description','headerinfo','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId'];(function(_0xe1254e,_0x3073ed){var _0x331fd7=function(_0x1fa61c){while(--_0x1fa61c){_0xe1254e['push'](_0xe1254e['shift']());}};_0x331fd7(++_0x3073ed);}(_0x83b4,0xc4));var _0x483b=function(_0x4b2e22,_0x301727){_0x4b2e22=_0x4b2e22-0x0;var _0x2c6a8b=_0x83b4[_0x4b2e22];return _0x2c6a8b;};'use strict';function FaxAccount(_0x279b6a){this['id']=_0x279b6a['id']||0x0;this[_0x483b('0x0')]=_0x279b6a[_0x483b('0x0')]||'';this[_0x483b('0x1')]=_0x279b6a[_0x483b('0x1')];this['ecm']=_0x279b6a['ecm'];this['headerinfo']=_0x279b6a[_0x483b('0x2')];this['localstationid']=_0x279b6a['localstationid'];this[_0x483b('0x3')]=_0x279b6a['minrate']||0x960;this[_0x483b('0x4')]=_0x279b6a[_0x483b('0x4')]||0x3840;this[_0x483b('0x5')]=_0x279b6a[_0x483b('0x5')]||_0x483b('0x6');this[_0x483b('0x7')]=_0x279b6a[_0x483b('0x7')]||'no';this[_0x483b('0x8')]=_0x279b6a[_0x483b('0x8')]||'no';this[_0x483b('0x9')]=_0x279b6a['t38timeout']||0x1388;this['tech']=_0x279b6a[_0x483b('0xa')]||_0x483b('0xb');this[_0x483b('0xc')]=_0x279b6a[_0x483b('0xc')]?_0x279b6a[_0x483b('0xc')]:undefined;this[_0x483b('0xd')]=_0x279b6a['ListId'];this[_0x483b('0xe')]=_0x279b6a[_0x483b('0xe')];}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 ba24883..1cdb548 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 _0x6eba=['token','remoteUri','serverUrl','Configurations','name','username','apiKey'];(function(_0x5b96a4,_0x660479){var _0x25151c=function(_0x357f17){while(--_0x357f17){_0x5b96a4['push'](_0x5b96a4['shift']());}};_0x25151c(++_0x660479);}(_0x6eba,0x12a));var _0xa6eb=function(_0x2101e2,_0x1a89d3){_0x2101e2=_0x2101e2-0x0;var _0x5f1a33=_0x6eba[_0x2101e2];return _0x5f1a33;};'use strict';function FreshdeskAccount(_0x2e0e7e){this['id']=_0x2e0e7e['id']||0x0;this[_0xa6eb('0x0')]=_0x2e0e7e['name']||'';this[_0xa6eb('0x1')]=_0x2e0e7e[_0xa6eb('0x1')]||'';this[_0xa6eb('0x2')]=_0x2e0e7e[_0xa6eb('0x3')]||'';this['remoteUri']=_0x2e0e7e[_0xa6eb('0x4')]||'';this[_0xa6eb('0x5')]=_0x2e0e7e[_0xa6eb('0x5')]||'';this[_0xa6eb('0x6')]=_0x2e0e7e[_0xa6eb('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0xce24=['Configurations','exports','name','username','token','remoteUri','serverUrl'];(function(_0x5174e4,_0x360a1d){var _0x1cc480=function(_0x31cfdd){while(--_0x31cfdd){_0x5174e4['push'](_0x5174e4['shift']());}};_0x1cc480(++_0x360a1d);}(_0xce24,0x8e));var _0x4ce2=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xce24[_0x1facfa];return _0x9ec701;};'use strict';function FreshdeskAccount(_0x135fcd){this['id']=_0x135fcd['id']||0x0;this[_0x4ce2('0x0')]=_0x135fcd[_0x4ce2('0x0')]||'';this[_0x4ce2('0x1')]=_0x135fcd[_0x4ce2('0x1')]||'';this['apiKey']=_0x135fcd[_0x4ce2('0x2')]||'';this[_0x4ce2('0x3')]=_0x135fcd[_0x4ce2('0x3')]||'';this['serverUrl']=_0x135fcd[_0x4ce2('0x4')]||'';this['Configurations']=_0x135fcd[_0x4ce2('0x5')]||{};}module[_0x4ce2('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 5f1efbe..4a5a848 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 _0x4fd7=['username','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x2dfb01,_0x11aeff){var _0x10d942=function(_0x79f49b){while(--_0x79f49b){_0x2dfb01['push'](_0x2dfb01['shift']());}};_0x10d942(++_0x11aeff);}(_0x4fd7,0xe6));var _0x74fd=function(_0x175c88,_0x446891){_0x175c88=_0x175c88-0x0;var _0x1fbc71=_0x4fd7[_0x175c88];return _0x1fbc71;};'use strict';function FreshsalesAccount(_0x249808){this['id']=_0x249808['id']||0x0;this[_0x74fd('0x0')]=_0x249808[_0x74fd('0x0')]||'';this[_0x74fd('0x1')]=_0x249808['username']||'';this['apiKey']=_0x249808[_0x74fd('0x2')]||'';this[_0x74fd('0x3')]=_0x249808['remoteUri']||'';this[_0x74fd('0x4')]=_0x249808['serverUrl']||'';this[_0x74fd('0x5')]=_0x249808['Configurations']||{};}module[_0x74fd('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xa1db=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x505abd,_0x32d6ea){var _0x25b4de=function(_0x1e4b37){while(--_0x1e4b37){_0x505abd['push'](_0x505abd['shift']());}};_0x25b4de(++_0x32d6ea);}(_0xa1db,0xb0));var _0xba1d=function(_0x44a3b0,_0x352810){_0x44a3b0=_0x44a3b0-0x0;var _0x39e6f6=_0xa1db[_0x44a3b0];return _0x39e6f6;};'use strict';function FreshsalesAccount(_0x586d7a){this['id']=_0x586d7a['id']||0x0;this[_0xba1d('0x0')]=_0x586d7a[_0xba1d('0x0')]||'';this[_0xba1d('0x1')]=_0x586d7a['username']||'';this['apiKey']=_0x586d7a[_0xba1d('0x2')]||'';this[_0xba1d('0x3')]=_0x586d7a['remoteUri']||'';this[_0xba1d('0x4')]=_0x586d7a[_0xba1d('0x4')]||'';this[_0xba1d('0x5')]=_0x586d7a[_0xba1d('0x5')]||{};}module[_0xba1d('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 9151793..34214f1 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 _0xa871=['accountcode','context','exten','holdtime','lastAssignedTo','mohtime','variables','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename'];(function(_0xa5ec6,_0x199bfe){var _0x122718=function(_0x40bcf3){while(--_0x40bcf3){_0xa5ec6['push'](_0xa5ec6['shift']());}};_0x122718(++_0x199bfe);}(_0xa871,0x103));var _0x1a87=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0xa871[_0x9e0cb3];return _0x5926b7;};'use strict';function QueueReport(){this['type']='inbound';this[_0x1a87('0x0')]='';this[_0x1a87('0x1')]='';this[_0x1a87('0x2')]='';this[_0x1a87('0x3')]='';this['queuecallerjoinAt']=null;this[_0x1a87('0x4')]=null;this['position']=0x1;this['count']=0x1;this[_0x1a87('0x5')]=![];this[_0x1a87('0x6')]=null;this[_0x1a87('0x7')]=![];this[_0x1a87('0x8')]=null;this['queuecallerexit']=![];this[_0x1a87('0x9')]=null;this[_0x1a87('0xa')]=0x1;this[_0x1a87('0xb')]='';this[_0x1a87('0xc')]='';this[_0x1a87('0xd')]='';this[_0x1a87('0xe')]='';this[_0x1a87('0xf')]='';this[_0x1a87('0x10')]='';this['priority']='';this[_0x1a87('0x11')]=0x0;this['assigned']=![];this[_0x1a87('0x12')]='';this['motionChannel']='voice';this[_0x1a87('0x13')]=0x0;this[_0x1a87('0x14')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0xaa16=['motionChannel','variables','exports','uniqueid','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','context','exten','holdtime'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaa16,0x111));var _0x6aa1=function(_0xb9ddf0,_0x14f53a){_0xb9ddf0=_0xb9ddf0-0x0;var _0xbc767a=_0xaa16[_0xb9ddf0];return _0xbc767a;};'use strict';function QueueReport(){this['type']='inbound';this[_0x6aa1('0x0')]='';this['calleridnum']='';this['calleridname']='';this['queue']='';this['queuecallerjoinAt']=null;this[_0x6aa1('0x1')]=null;this[_0x6aa1('0x2')]=0x1;this[_0x6aa1('0x3')]=0x1;this['queuecallerabandon']=![];this[_0x6aa1('0x4')]=null;this[_0x6aa1('0x5')]=![];this['queuecallercompleteAt']=null;this[_0x6aa1('0x6')]=![];this[_0x6aa1('0x7')]=null;this[_0x6aa1('0x8')]=0x1;this[_0x6aa1('0x9')]='';this[_0x6aa1('0xa')]='';this[_0x6aa1('0xb')]='';this['accountcode']='';this[_0x6aa1('0xc')]='';this[_0x6aa1('0xd')]='';this['priority']='';this[_0x6aa1('0xe')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this[_0x6aa1('0xf')]='voice';this['mohtime']=0x0;this[_0x6aa1('0x10')]={};}module[_0x6aa1('0x11')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 553e9ef..5f3eb93 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 _0x2469=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId'];(function(_0x2ef5a6,_0x5a450d){var _0x5250da=function(_0x1b1b4e){while(--_0x1b1b4e){_0x2ef5a6['push'](_0x2ef5a6['shift']());}};_0x5250da(++_0x5a450d);}(_0x2469,0xaf));var _0x9246=function(_0x12038f,_0x37b4ca){_0x12038f=_0x12038f-0x0;var _0x5793ed=_0x2469[_0x12038f];return _0x5793ed;};'use strict';function SalesforceAccount(_0x550526){this['id']=_0x550526['id']||0x0;this[_0x9246('0x0')]=_0x550526[_0x9246('0x0')]||'';this[_0x9246('0x1')]=_0x550526[_0x9246('0x1')]||'';this[_0x9246('0x2')]=_0x550526['remoteUri']||'';this[_0x9246('0x3')]=_0x550526[_0x9246('0x3')]||'';this[_0x9246('0x4')]=_0x550526[_0x9246('0x4')]||'';this[_0x9246('0x5')]=_0x550526['clientSecret']||'';this[_0x9246('0x6')]=_0x550526[_0x9246('0x6')]||'';this[_0x9246('0x7')]=_0x550526[_0x9246('0x7')]||_0x9246('0x8');this[_0x9246('0x9')]=_0x550526[_0x9246('0x9')]||'';this[_0x9246('0xa')]=_0x550526[_0x9246('0xa')]||{};}module[_0x9246('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x30cc=['password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x30cc,0x81));var _0xc30c=function(_0x12a2a6,_0x374ff1){_0x12a2a6=_0x12a2a6-0x0;var _0x1754ae=_0x30cc[_0x12a2a6];return _0x1754ae;};'use strict';function SalesforceAccount(_0x483ee5){this['id']=_0x483ee5['id']||0x0;this[_0xc30c('0x0')]=_0x483ee5['name']||'';this['username']=_0x483ee5[_0xc30c('0x1')]||'';this[_0xc30c('0x2')]=_0x483ee5[_0xc30c('0x2')]||'';this[_0xc30c('0x3')]=_0x483ee5['password']||'';this[_0xc30c('0x4')]=_0x483ee5[_0xc30c('0x4')]||'';this['clientSecret']=_0x483ee5[_0xc30c('0x5')]||'';this[_0xc30c('0x6')]=_0x483ee5['securityToken']||'';this[_0xc30c('0x7')]=_0x483ee5['type']||_0xc30c('0x8');this[_0xc30c('0x9')]=_0x483ee5['serverUrl']||'';this[_0xc30c('0xa')]=_0x483ee5['Configurations']||{};}module[_0xc30c('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index ad539a8..3c820c8 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 _0x0b47=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0x2137a6,_0x3acbca){var _0x1621bc=function(_0x1b6041){while(--_0x1b6041){_0x2137a6['push'](_0x2137a6['shift']());}};_0x1621bc(++_0x3acbca);}(_0x0b47,0xbf));var _0x70b4=function(_0x1c409d,_0x35756f){_0x1c409d=_0x1c409d-0x0;var _0x3469aa=_0x0b47[_0x1c409d];return _0x3469aa;};'use strict';function ServicenowAccount(_0x57bac9){this['id']=_0x57bac9['id']||0x0;this[_0x70b4('0x0')]=_0x57bac9[_0x70b4('0x0')]||'';this[_0x70b4('0x1')]=_0x57bac9[_0x70b4('0x1')]||'';this['password']=_0x57bac9[_0x70b4('0x2')]||'';this[_0x70b4('0x3')]=_0x57bac9[_0x70b4('0x3')]||'';this['serverUrl']=_0x57bac9[_0x70b4('0x4')]||'';this[_0x70b4('0x5')]=_0x57bac9[_0x70b4('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x865e=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x45ee03,_0x2f5319){var _0x13d535=function(_0x391904){while(--_0x391904){_0x45ee03['push'](_0x45ee03['shift']());}};_0x13d535(++_0x2f5319);}(_0x865e,0xbb));var _0xe865=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x865e[_0x21a9d9];return _0x46adce;};'use strict';function ServicenowAccount(_0x9f42d0){this['id']=_0x9f42d0['id']||0x0;this[_0xe865('0x0')]=_0x9f42d0[_0xe865('0x0')]||'';this['username']=_0x9f42d0[_0xe865('0x1')]||'';this[_0xe865('0x2')]=_0x9f42d0['password']||'';this[_0xe865('0x3')]=_0x9f42d0[_0xe865('0x3')]||'';this['serverUrl']=_0x9f42d0[_0xe865('0x4')]||'';this['Configurations']=_0x9f42d0[_0xe865('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 747b534..1b1eeb4 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 _0x7e38=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x66d7b4,_0x829c80){var _0x135367=function(_0x3d65ed){while(--_0x3d65ed){_0x66d7b4['push'](_0x66d7b4['shift']());}};_0x135367(++_0x829c80);}(_0x7e38,0x150));var _0x87e3=function(_0x318fea,_0x1a14d5){_0x318fea=_0x318fea-0x0;var _0x3c2bb8=_0x7e38[_0x318fea];return _0x3c2bb8;};'use strict';function SugarcrmAccount(_0x7e00b6){this['id']=_0x7e00b6['id']||0x0;this[_0x87e3('0x0')]=_0x7e00b6['name']||'';this['username']=_0x7e00b6[_0x87e3('0x1')]||'';this[_0x87e3('0x2')]=_0x7e00b6['password']||'';this[_0x87e3('0x3')]=_0x7e00b6['remoteUri']||'';this[_0x87e3('0x4')]=_0x7e00b6[_0x87e3('0x4')]||'';this[_0x87e3('0x5')]=_0x7e00b6[_0x87e3('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0xb253=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x1b2255,_0x3de34f){var _0x33e57d=function(_0x2f9cce){while(--_0x2f9cce){_0x1b2255['push'](_0x1b2255['shift']());}};_0x33e57d(++_0x3de34f);}(_0xb253,0x1c2));var _0x3b25=function(_0x2c94af,_0x179897){_0x2c94af=_0x2c94af-0x0;var _0x9d1bf6=_0xb253[_0x2c94af];return _0x9d1bf6;};'use strict';function SugarcrmAccount(_0x29aafd){this['id']=_0x29aafd['id']||0x0;this[_0x3b25('0x0')]=_0x29aafd[_0x3b25('0x0')]||'';this[_0x3b25('0x1')]=_0x29aafd[_0x3b25('0x1')]||'';this[_0x3b25('0x2')]=_0x29aafd['password']||'';this[_0x3b25('0x3')]=_0x29aafd[_0x3b25('0x3')]||'';this[_0x3b25('0x4')]=_0x29aafd[_0x3b25('0x4')]||'';this[_0x3b25('0x5')]=_0x29aafd[_0x3b25('0x5')]||{};}module[_0x3b25('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 09b2b09..4c78a2c 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 _0x7916=['status','address','name','accountcode','state','unknown','stateTime'];(function(_0x536a51,_0x2bf510){var _0x4a4d9e=function(_0x20deef){while(--_0x20deef){_0x536a51['push'](_0x536a51['shift']());}};_0x4a4d9e(++_0x2bf510);}(_0x7916,0x128));var _0x6791=function(_0x559f21,_0x288db8){_0x559f21=_0x559f21-0x0;var _0x5f3168=_0x7916[_0x559f21];return _0x5f3168;};'use strict';function Telephone(_0x4482d8){this['id']=_0x4482d8['id']||0x0;this['name']=_0x4482d8[_0x6791('0x0')]||'';this[_0x6791('0x1')]=_0x4482d8['accountcode']||'';this[_0x6791('0x2')]=_0x6791('0x3');this[_0x6791('0x4')]=0x0;this[_0x6791('0x5')]='unknown';this[_0x6791('0x6')]='';}module['exports']=Telephone; \ No newline at end of file +var _0xe423=['name','unknown','stateTime','exports'];(function(_0x4b5650,_0x355515){var _0x906327=function(_0x53316d){while(--_0x53316d){_0x4b5650['push'](_0x4b5650['shift']());}};_0x906327(++_0x355515);}(_0xe423,0xf4));var _0x3e42=function(_0x5b7ba9,_0x4d437d){_0x5b7ba9=_0x5b7ba9-0x0;var _0xd17602=_0xe423[_0x5b7ba9];return _0xd17602;};'use strict';function Telephone(_0x2af525){this['id']=_0x2af525['id']||0x0;this[_0x3e42('0x0')]=_0x2af525[_0x3e42('0x0')]||'';this['accountcode']=_0x2af525['accountcode']||'';this['state']=_0x3e42('0x1');this[_0x3e42('0x2')]=0x0;this['status']='unknown';this['address']='';}module[_0x3e42('0x3')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 460ffed..8632b6d 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(_0x1e1058,_0x54dc80){var _0x47a7a8=function(_0x2d1db4){while(--_0x2d1db4){_0x1e1058['push'](_0x1e1058['shift']());}};_0x47a7a8(++_0x54dc80);}(_0xb10b,0x12a));var _0xbb10=function(_0x2b10b5,_0x5c1f2e){_0x2b10b5=_0x2b10b5-0x0;var _0x545669=_0xb10b[_0x2b10b5];return _0x545669;};'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(_0x233463,_0x433f49){var _0xe84bd3=function(_0x2ef933){while(--_0x2ef933){_0x233463['push'](_0x233463['shift']());}};_0xe84bd3(++_0x433f49);}(_0xb10b,0x12a));var _0xbb10=function(_0x3f1861,_0x7b4285){_0x3f1861=_0x3f1861-0x0;var _0x7ca70a=_0xb10b[_0x3f1861];return _0x7ca70a;};'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 07c14ef..c50d076 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 _0x4fc2=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x13bd9d,_0xcc43eb){var _0x361653=function(_0x290dfe){while(--_0x290dfe){_0x13bd9d['push'](_0x13bd9d['shift']());}};_0x361653(++_0xcc43eb);}(_0x4fc2,0x111));var _0x24fc=function(_0x2ac096,_0x2ff644){_0x2ac096=_0x2ac096-0x0;var _0x5de0bc=_0x4fc2[_0x2ac096];return _0x5de0bc;};'use strict';function Trigger(_0x5ea3ab){this['id']=_0x5ea3ab['id']||0x0;this[_0x24fc('0x0')]=_0x5ea3ab[_0x24fc('0x0')]||'';this[_0x24fc('0x1')]=_0x5ea3ab['channel']||_0x24fc('0x2');this[_0x24fc('0x3')]=_0x5ea3ab[_0x24fc('0x3')]||![];this['AllConditions']=_0x5ea3ab[_0x24fc('0x4')]||[];this[_0x24fc('0x5')]=_0x5ea3ab['AnyConditions']||[];this[_0x24fc('0x6')]=_0x5ea3ab[_0x24fc('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x2032=['exports','name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x3a6af2,_0x3b2f5c){var _0x3d9166=function(_0x1a6350){while(--_0x1a6350){_0x3a6af2['push'](_0x3a6af2['shift']());}};_0x3d9166(++_0x3b2f5c);}(_0x2032,0xd9));var _0x2203=function(_0x2940ee,_0x5127a9){_0x2940ee=_0x2940ee-0x0;var _0x151a3a=_0x2032[_0x2940ee];return _0x151a3a;};'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 diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 0fb14ee..a47f32e 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 _0x32c9=['exports','active','name','state','unknown','status','registry','indexOf','split','port','refresh','stateRegistry','registrationtime','address','defaultuser'];(function(_0x5a8e3a,_0x4cab78){var _0x3112fa=function(_0x467186){while(--_0x467186){_0x5a8e3a['push'](_0x5a8e3a['shift']());}};_0x3112fa(++_0x4cab78);}(_0x32c9,0x15a));var _0x932c=function(_0x69cbf8,_0x312d1e){_0x69cbf8=_0x69cbf8-0x0;var _0x481586=_0x32c9[_0x69cbf8];return _0x481586;};'use strict';function Trunk(_0x15c787){this['id']=_0x15c787['id']||0x0;this[_0x932c('0x0')]=_0x15c787[_0x932c('0x0')]||![];this[_0x932c('0x1')]=_0x15c787['name']||'';this[_0x932c('0x2')]=_0x932c('0x3');this['stateTime']=0x0;this[_0x932c('0x4')]=_0x932c('0x3');this['registry']=_0x15c787[_0x932c('0x5')]&&_0x15c787[_0x932c('0x5')][_0x932c('0x6')](':')?_0x15c787[_0x932c('0x5')][_0x932c('0x7')](':')[0x0]:'';this['host']='';this[_0x932c('0x8')]='';this['domain']='';this['domainport']='';this[_0x932c('0x9')]='';this[_0x932c('0xa')]='unknown';this[_0x932c('0xb')]='';this[_0x932c('0xc')]='';this[_0x932c('0xd')]=_0x15c787[_0x932c('0xd')]||'';}module[_0x932c('0xe')]=Trunk; \ No newline at end of file +var _0xb6a1=['stateRegistry','defaultuser','exports','active','name','unknown','stateTime','status','registry','indexOf','split','host','domainport','refresh'];(function(_0x1b9ce6,_0x5ecb4c){var _0xdd0e06=function(_0x1f17cd){while(--_0x1f17cd){_0x1b9ce6['push'](_0x1b9ce6['shift']());}};_0xdd0e06(++_0x5ecb4c);}(_0xb6a1,0x17d));var _0x1b6a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb6a1[_0x20a584];return _0x4b41a8;};'use strict';function Trunk(_0x45cc56){this['id']=_0x45cc56['id']||0x0;this['active']=_0x45cc56[_0x1b6a('0x0')]||![];this['name']=_0x45cc56[_0x1b6a('0x1')]||'';this['state']=_0x1b6a('0x2');this[_0x1b6a('0x3')]=0x0;this[_0x1b6a('0x4')]='unknown';this[_0x1b6a('0x5')]=_0x45cc56['registry']&&_0x45cc56[_0x1b6a('0x5')][_0x1b6a('0x6')](':')?_0x45cc56['registry'][_0x1b6a('0x7')](':')[0x0]:'';this[_0x1b6a('0x8')]='';this['port']='';this['domain']='';this[_0x1b6a('0x9')]='';this[_0x1b6a('0xa')]='';this[_0x1b6a('0xb')]=_0x1b6a('0x2');this['registrationtime']='';this['address']='';this[_0x1b6a('0xc')]=_0x45cc56['defaultuser']||'';}module[_0x1b6a('0xd')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index c6c6129..dad91a0 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 _0xcc35=['mandatoryDisposition','exports','exten','none'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0xcc35,0xaa));var _0x5cc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc35[_0x3dd15e];return _0x231fd0;};'use strict';function voiceExtension(_0x22bcad){this['id']=_0x22bcad['id']||0x0;this['exten']=_0x22bcad[_0x5cc3('0x0')]||'';this['recordingFormat']=_0x22bcad['recordingFormat']||_0x5cc3('0x1');this['mandatoryDisposition']=_0x22bcad[_0x5cc3('0x2')]||![];}module[_0x5cc3('0x3')]=voiceExtension; \ No newline at end of file +var _0xfcd4=['recordingFormat','mandatoryDisposition','exports','exten'];(function(_0x3bbded,_0x1fa413){var _0x1f48cf=function(_0x555648){while(--_0x555648){_0x3bbded['push'](_0x3bbded['shift']());}};_0x1f48cf(++_0x1fa413);}(_0xfcd4,0xfb));var _0x4fcd=function(_0x4e566c,_0x16e04c){_0x4e566c=_0x4e566c-0x0;var _0x31947e=_0xfcd4[_0x4e566c];return _0x31947e;};'use strict';function voiceExtension(_0x2880d3){this['id']=_0x2880d3['id']||0x0;this[_0x4fcd('0x0')]=_0x2880d3[_0x4fcd('0x0')]||'';this[_0x4fcd('0x1')]=_0x2880d3['recordingFormat']||'none';this[_0x4fcd('0x2')]=_0x2880d3[_0x4fcd('0x2')]||![];}module[_0x4fcd('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 36b2c93..a29af86 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 _0xd5dc=['gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','talking','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','loggedIn','available','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','DESC','dialRandomLastDigitCallerIdNumber','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallInQueue','dialPreviewAutoRecallMe','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','ringing','wav'];(function(_0x2a1899,_0x5873e1){var _0x42fbbb=function(_0x343a76){while(--_0x343a76){_0x2a1899['push'](_0x2a1899['shift']());}};_0x42fbbb(++_0x5873e1);}(_0xd5dc,0x6b));var _0xcd5d=function(_0x53841e,_0x2a2977){_0x53841e=_0x53841e-0x0;var _0x23bdde=_0xd5dc[_0x53841e];return _0x23bdde;};'use strict';var statusDesc=[_0xcd5d('0x0'),_0xcd5d('0x1'),_0xcd5d('0x2'),_0xcd5d('0x3'),'invalid','unavailable',_0xcd5d('0x4'),'ringinuse','onhold'];var monitorFormat={'wav':_0xcd5d('0x5'),'wav49':'wav49','gsm':_0xcd5d('0x6')};var strategy={'rrmemory':_0xcd5d('0x7'),'roundrobin':_0xcd5d('0x8')};function VoiceQueue(_0xeb2975){this['id']=_0xeb2975['id']||0x0;this[_0xcd5d('0x9')]=_0xeb2975[_0xcd5d('0x9')]||'';this['monitor_format']=_0xeb2975[_0xcd5d('0xa')]||'';this[_0xcd5d('0xb')]=_0xeb2975[_0xcd5d('0xb')]||_0xcd5d('0xc');this['waiting']=0x0;this[_0xcd5d('0xd')]=0x0;this['total']=0x0;this[_0xcd5d('0xe')]=0x0;this[_0xcd5d('0xf')]=0x0;this[_0xcd5d('0x10')]=0x0;this[_0xcd5d('0x11')]=0x0;this[_0xcd5d('0x12')]=0x0;this['abandoned']=0x0;this[_0xcd5d('0x13')]=0x0;this[_0xcd5d('0x14')]=0x0;this['acw']=_0xeb2975['acw']||![];this[_0xcd5d('0x15')]=_0xeb2975[_0xcd5d('0x15')]||0xa;this[_0xcd5d('0x16')]=_0xeb2975[_0xcd5d('0x16')]||'no';this[_0xcd5d('0x17')]=!![];this[_0xcd5d('0x18')]='';this[_0xcd5d('0x19')]=0x0;this['temp']=0x0;this[_0xcd5d('0x1a')]=_0xeb2975[_0xcd5d('0x1a')]||null;this[_0xcd5d('0x1b')]=_0xeb2975[_0xcd5d('0x1b')]?_0xeb2975[_0xcd5d('0x1b')]:null;this[_0xcd5d('0x1c')]=_0xeb2975[_0xcd5d('0x1c')];this['dialMethod']=_0xeb2975[_0xcd5d('0x1d')]||_0xcd5d('0x1e');this[_0xcd5d('0x1f')]=_0xeb2975[_0xcd5d('0x1f')]||0x0;this[_0xcd5d('0x20')]=_0xeb2975['dialLimitQueue']||0x0;this[_0xcd5d('0x21')]=_0xeb2975[_0xcd5d('0x21')]||0x1;this[_0xcd5d('0x22')]=_0xeb2975[_0xcd5d('0x22')]||_0xcd5d('0x23');this[_0xcd5d('0x24')]=_0xeb2975[_0xcd5d('0x24')]||0.03;this[_0xcd5d('0x25')]=_0xeb2975[_0xcd5d('0x25')]||0x258;this[_0xcd5d('0x26')]=_0xeb2975[_0xcd5d('0x26')]||'anonymous';this['dialOriginateCallerIdNumber']=_0xeb2975[_0xcd5d('0x27')]||'anonymous';this[_0xcd5d('0x28')]=_0xeb2975[_0xcd5d('0x28')]||0x1e;this['dialQueueOptions']=_0xeb2975[_0xcd5d('0x29')]||_0xcd5d('0x2a');this[_0xcd5d('0x2b')]=_0xeb2975['dialQueueTimeout']||0x3;this[_0xcd5d('0x2c')]=_0xeb2975['dialQueueProject']||undefined;this[_0xcd5d('0x2d')]=_0xeb2975[_0xcd5d('0x2d')]||0x3;this['dialCongestionRetryFrequency']=_0xeb2975[_0xcd5d('0x2e')]||0x96;this[_0xcd5d('0x2f')]=_0xeb2975[_0xcd5d('0x2f')]||0x3;this[_0xcd5d('0x30')]=_0xeb2975[_0xcd5d('0x30')]||0x96;this[_0xcd5d('0x31')]=_0xeb2975['dialNoAnswerMaxRetry']||0x3;this[_0xcd5d('0x32')]=_0xeb2975[_0xcd5d('0x32')]||0x96;this[_0xcd5d('0x33')]=_0xeb2975[_0xcd5d('0x33')]||0x3;this[_0xcd5d('0x34')]=_0xeb2975[_0xcd5d('0x34')]||0x96;this[_0xcd5d('0x35')]=_0xeb2975[_0xcd5d('0x35')]||0x3;this[_0xcd5d('0x36')]=_0xeb2975[_0xcd5d('0x36')]||0x96;this[_0xcd5d('0x37')]=_0xeb2975[_0xcd5d('0x37')]||0x3;this['dialAbandonedRetryFrequency']=_0xeb2975[_0xcd5d('0x38')]||0x96;this['dialMachineMaxRetry']=_0xeb2975['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0xeb2975[_0xcd5d('0x39')]||0x96;this['dialAgentRejectMaxRetry']=_0xeb2975[_0xcd5d('0x3a')]||0x3;this[_0xcd5d('0x3b')]=_0xeb2975[_0xcd5d('0x3b')]||0x96;this[_0xcd5d('0x3c')]=_0xeb2975['dialGlobalMaxRetry']||0x4;this[_0xcd5d('0x3d')]=_0xeb2975['Trunk']?_0xeb2975[_0xcd5d('0x3d')]:undefined;this[_0xcd5d('0x3e')]=_0xeb2975[_0xcd5d('0x3e')]?_0xeb2975[_0xcd5d('0x3e')]:undefined;this[_0xcd5d('0x3f')]=_0xeb2975['dialPrefix']||undefined;this[_0xcd5d('0x40')]=_0xeb2975['Interval']?_0xeb2975[_0xcd5d('0x40')]:undefined;this['dialOrderByScheduledAt']=_0xeb2975['dialOrderByScheduledAt']||_0xcd5d('0x41');this[_0xcd5d('0x42')]=_0xeb2975['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0xeb2975['dialCutDigit']||undefined;this[_0xcd5d('0x43')]=strategy[_0xeb2975[_0xcd5d('0x43')]]||_0xcd5d('0x7');this['queueStatusComplete']=!![];this[_0xcd5d('0x44')]=_0xeb2975['dialAMDActive']||![];this[_0xcd5d('0x45')]=_0xeb2975[_0xcd5d('0x45')];this['dialAMDGreeting']=_0xeb2975[_0xcd5d('0x46')];this[_0xcd5d('0x47')]=_0xeb2975[_0xcd5d('0x47')];this[_0xcd5d('0x48')]=_0xeb2975['dialAMDTotalAnalysisTime'];this[_0xcd5d('0x49')]=_0xeb2975['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0xeb2975[_0xcd5d('0x4a')];this['dialAMDMaximumNumberOfWords']=_0xeb2975['dialAMDMaximumNumberOfWords'];this[_0xcd5d('0x4b')]=_0xeb2975[_0xcd5d('0x4b')];this[_0xcd5d('0x4c')]=_0xeb2975['dialAMDMaximumWordLength'];this[_0xcd5d('0x4d')]=0x0;this[_0xcd5d('0x4e')]=0x0;this[_0xcd5d('0x4f')]=_0xeb2975[_0xcd5d('0x4f')];this[_0xcd5d('0x50')]=0x0;this[_0xcd5d('0x51')]=0x0;this[_0xcd5d('0x52')]=0x0;this[_0xcd5d('0x53')]=0x0;this[_0xcd5d('0x54')]=0x0;this[_0xcd5d('0x55')]=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xcd5d('0x56')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xcd5d('0x57')]=0x0;this[_0xcd5d('0x58')]=0x0;this[_0xcd5d('0x59')]=0x0;this[_0xcd5d('0x5a')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xcd5d('0x5b')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xcd5d('0x5c')]=0x0;this[_0xcd5d('0x5d')]=0x0;this[_0xcd5d('0x5e')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xcd5d('0x5f')]=0x0;this[_0xcd5d('0x60')]=0x0;this[_0xcd5d('0x61')]=_0xeb2975[_0xcd5d('0x62')]||0x14;this[_0xcd5d('0x63')]=_0xeb2975[_0xcd5d('0x62')]||0xa;this[_0xcd5d('0x64')]=0x0;this[_0xcd5d('0x65')]=0x0;this[_0xcd5d('0x66')]=0x1;this[_0xcd5d('0x67')]=0x0;this[_0xcd5d('0x68')]=0x0;this[_0xcd5d('0x69')]=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0xeb2975['dialRecallMeTimeout']||0x1e;this[_0xcd5d('0x6a')]=_0xeb2975[_0xcd5d('0x6a')]||![];this[_0xcd5d('0x6b')]=!!_0xeb2975[_0xcd5d('0x6b')]||![];this['dialQueueProject2']=_0xeb2975['dialQueueProject2']||undefined;this[_0xcd5d('0x6c')]=_0xeb2975[_0xcd5d('0x6c')]||![];this['dialAgiAfterHangupAgent']=_0xeb2975[_0xcd5d('0x6d')]||![];this[_0xcd5d('0xa')]=monitorFormat[_0xeb2975['monitor_format']]?monitorFormat[_0xeb2975[_0xcd5d('0xa')]]:undefined;this[_0xcd5d('0x6e')]=_0xeb2975[_0xcd5d('0x6e')]||![];this[_0xcd5d('0x6f')]=_0xeb2975['mandatoryDispositionPause']?_0xeb2975['mandatoryDispositionPause']:undefined;}module[_0xcd5d('0x70')]=VoiceQueue; \ No newline at end of file +var _0xf011=['outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','invalid','unavailable','ringing','ringinuse','onhold','wav','gsm','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','acwTimeout','autopause','sendMessageOneNotActive','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay'];(function(_0x46827f,_0x14745b){var _0x329c12=function(_0x202494){while(--_0x202494){_0x46827f['push'](_0x46827f['shift']());}};_0x329c12(++_0x14745b);}(_0xf011,0x99));var _0x1f01=function(_0x28371d,_0x5316ab){_0x28371d=_0x28371d-0x0;var _0x2f28c3=_0xf011[_0x28371d];return _0x2f28c3;};'use strict';var statusDesc=[_0x1f01('0x0'),_0x1f01('0x1'),_0x1f01('0x2'),'busy',_0x1f01('0x3'),_0x1f01('0x4'),_0x1f01('0x5'),_0x1f01('0x6'),_0x1f01('0x7')];var monitorFormat={'wav':_0x1f01('0x8'),'wav49':'wav49','gsm':_0x1f01('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};function VoiceQueue(_0x1b3aa5){this['id']=_0x1b3aa5['id']||0x0;this[_0x1f01('0xa')]=_0x1b3aa5['name']||'';this['monitor_format']=_0x1b3aa5[_0x1f01('0xb')]||'';this[_0x1f01('0xc')]=_0x1b3aa5[_0x1f01('0xc')]||_0x1f01('0xd');this[_0x1f01('0xe')]=0x0;this['talking']=0x0;this[_0x1f01('0xf')]=0x0;this[_0x1f01('0x10')]=0x0;this[_0x1f01('0x11')]=0x0;this[_0x1f01('0x12')]=0x0;this[_0x1f01('0x13')]=0x0;this[_0x1f01('0x14')]=0x0;this[_0x1f01('0x15')]=0x0;this[_0x1f01('0x16')]=0x0;this['available']=0x0;this['acw']=_0x1b3aa5['acw']||![];this[_0x1f01('0x17')]=_0x1b3aa5[_0x1f01('0x17')]||0xa;this['autopause']=_0x1b3aa5[_0x1f01('0x18')]||'no';this[_0x1f01('0x19')]=!![];this[_0x1f01('0x1a')]='';this['originated']=0x0;this[_0x1f01('0x1b')]=0x0;this[_0x1f01('0x1c')]=_0x1b3aa5[_0x1f01('0x1c')]||null;this[_0x1f01('0x1d')]=_0x1b3aa5['dialGlobalInterval']?_0x1b3aa5['dialGlobalInterval']:null;this[_0x1f01('0x1e')]=_0x1b3aa5['dialActive'];this[_0x1f01('0x1f')]=_0x1b3aa5[_0x1f01('0x1f')]||_0x1f01('0x20');this[_0x1f01('0x21')]=_0x1b3aa5['dialLimitChannel']||0x0;this[_0x1f01('0x22')]=_0x1b3aa5[_0x1f01('0x22')]||0x0;this[_0x1f01('0x23')]=_0x1b3aa5[_0x1f01('0x23')]||0x1;this['dialPredictiveOptimization']=_0x1b3aa5[_0x1f01('0x24')]||_0x1f01('0x25');this[_0x1f01('0x26')]=_0x1b3aa5['dialPredictiveOptimizationPercentage']||0.03;this[_0x1f01('0x27')]=_0x1b3aa5['dialPredictiveInterval']||0x258;this[_0x1f01('0x28')]=_0x1b3aa5['dialOriginateCallerIdName']||'anonymous';this[_0x1f01('0x29')]=_0x1b3aa5['dialOriginateCallerIdNumber']||_0x1f01('0x2a');this[_0x1f01('0x2b')]=_0x1b3aa5[_0x1f01('0x2b')]||0x1e;this[_0x1f01('0x2c')]=_0x1b3aa5[_0x1f01('0x2c')]||'tTxX';this['dialQueueTimeout']=_0x1b3aa5['dialQueueTimeout']||0x3;this[_0x1f01('0x2d')]=_0x1b3aa5[_0x1f01('0x2d')]||undefined;this['dialCongestionMaxRetry']=_0x1b3aa5['dialCongestionMaxRetry']||0x3;this[_0x1f01('0x2e')]=_0x1b3aa5['dialCongestionRetryFrequency']||0x96;this['dialBusyMaxRetry']=_0x1b3aa5[_0x1f01('0x2f')]||0x3;this[_0x1f01('0x30')]=_0x1b3aa5[_0x1f01('0x30')]||0x96;this[_0x1f01('0x31')]=_0x1b3aa5[_0x1f01('0x31')]||0x3;this[_0x1f01('0x32')]=_0x1b3aa5[_0x1f01('0x32')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x1b3aa5[_0x1f01('0x33')]||0x3;this[_0x1f01('0x34')]=_0x1b3aa5[_0x1f01('0x34')]||0x96;this[_0x1f01('0x35')]=_0x1b3aa5[_0x1f01('0x35')]||0x3;this[_0x1f01('0x36')]=_0x1b3aa5[_0x1f01('0x36')]||0x96;this[_0x1f01('0x37')]=_0x1b3aa5[_0x1f01('0x37')]||0x3;this[_0x1f01('0x38')]=_0x1b3aa5[_0x1f01('0x38')]||0x96;this[_0x1f01('0x39')]=_0x1b3aa5[_0x1f01('0x39')]||0x3;this[_0x1f01('0x3a')]=_0x1b3aa5['dialMachineRetryFrequency']||0x96;this[_0x1f01('0x3b')]=_0x1b3aa5[_0x1f01('0x3b')]||0x3;this[_0x1f01('0x3c')]=_0x1b3aa5[_0x1f01('0x3c')]||0x96;this[_0x1f01('0x3d')]=_0x1b3aa5[_0x1f01('0x3d')]||0x4;this[_0x1f01('0x3e')]=_0x1b3aa5[_0x1f01('0x3e')]?_0x1b3aa5['Trunk']:undefined;this[_0x1f01('0x3f')]=_0x1b3aa5[_0x1f01('0x3f')]?_0x1b3aa5[_0x1f01('0x3f')]:undefined;this[_0x1f01('0x40')]=_0x1b3aa5[_0x1f01('0x40')]||undefined;this['Interval']=_0x1b3aa5['Interval']?_0x1b3aa5[_0x1f01('0x41')]:undefined;this[_0x1f01('0x42')]=_0x1b3aa5[_0x1f01('0x42')]||_0x1f01('0x43');this[_0x1f01('0x44')]=_0x1b3aa5['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x1f01('0x45')]=_0x1b3aa5[_0x1f01('0x45')]||undefined;this['strategy']=strategy[_0x1b3aa5[_0x1f01('0x46')]]||_0x1f01('0x47');this[_0x1f01('0x48')]=!![];this[_0x1f01('0x49')]=_0x1b3aa5['dialAMDActive']||![];this[_0x1f01('0x4a')]=_0x1b3aa5[_0x1f01('0x4a')];this[_0x1f01('0x4b')]=_0x1b3aa5[_0x1f01('0x4b')];this[_0x1f01('0x4c')]=_0x1b3aa5[_0x1f01('0x4c')];this[_0x1f01('0x4d')]=_0x1b3aa5[_0x1f01('0x4d')];this[_0x1f01('0x4e')]=_0x1b3aa5[_0x1f01('0x4e')];this[_0x1f01('0x4f')]=_0x1b3aa5[_0x1f01('0x4f')];this[_0x1f01('0x50')]=_0x1b3aa5[_0x1f01('0x50')];this[_0x1f01('0x51')]=_0x1b3aa5[_0x1f01('0x51')];this[_0x1f01('0x52')]=_0x1b3aa5['dialAMDMaximumWordLength'];this[_0x1f01('0x53')]=0x0;this[_0x1f01('0x54')]=0x0;this[_0x1f01('0x55')]=_0x1b3aa5[_0x1f01('0x55')];this[_0x1f01('0x56')]=0x0;this[_0x1f01('0x57')]=0x0;this[_0x1f01('0x58')]=0x0;this[_0x1f01('0x59')]=0x0;this[_0x1f01('0x5a')]=0x0;this[_0x1f01('0x5b')]=0x0;this[_0x1f01('0x5c')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x1f01('0x5d')]=0x0;this[_0x1f01('0x5e')]=0x0;this[_0x1f01('0x5f')]=0x0;this[_0x1f01('0x60')]=0x0;this[_0x1f01('0x61')]=0x0;this[_0x1f01('0x62')]=0x0;this[_0x1f01('0x63')]=undefined;this[_0x1f01('0x64')]=undefined;this['handlePredictive']=undefined;this[_0x1f01('0x65')]=1.05;this[_0x1f01('0x66')]=0x0;this[_0x1f01('0x67')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x1f01('0x68')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x1f01('0x69')]=0x0;this[_0x1f01('0x6a')]=0x0;this[_0x1f01('0x6b')]=_0x1b3aa5[_0x1f01('0x6c')]||0x14;this[_0x1f01('0x6d')]=_0x1b3aa5[_0x1f01('0x6c')]||0xa;this[_0x1f01('0x6e')]=0x0;this[_0x1f01('0x6f')]=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0x1f01('0x70')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x1f01('0x71')]=0x0;this[_0x1f01('0x72')]=_0x1b3aa5[_0x1f01('0x72')]||0x1e;this[_0x1f01('0x73')]=_0x1b3aa5[_0x1f01('0x73')]||![];this['dialPreviewAutoRecallMe']=!!_0x1b3aa5[_0x1f01('0x74')]||![];this[_0x1f01('0x75')]=_0x1b3aa5[_0x1f01('0x75')]||undefined;this['dialAgiAfterHangupClient']=_0x1b3aa5[_0x1f01('0x76')]||![];this[_0x1f01('0x77')]=_0x1b3aa5[_0x1f01('0x77')]||![];this[_0x1f01('0xb')]=monitorFormat[_0x1b3aa5[_0x1f01('0xb')]]?monitorFormat[_0x1b3aa5[_0x1f01('0xb')]]:undefined;this['mandatoryDisposition']=_0x1b3aa5['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x1b3aa5['mandatoryDispositionPause']?_0x1b3aa5[_0x1f01('0x78')]:undefined;}module[_0x1f01('0x79')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index bf52a4f..62b5455 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 _0xed4c=['Configurations','name','username','accessKey','remoteUri','serverUrl'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xed4c,0x1c9));var _0xced4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xed4c[_0x3dd15e];return _0x231fd0;};'use strict';function VtigerAccount(_0x5e0c63){this['id']=_0x5e0c63['id']||0x0;this[_0xced4('0x0')]=_0x5e0c63['name']||'';this[_0xced4('0x1')]=_0x5e0c63[_0xced4('0x1')]||'';this[_0xced4('0x2')]=_0x5e0c63[_0xced4('0x2')]||'';this[_0xced4('0x3')]=_0x5e0c63[_0xced4('0x3')]||'';this[_0xced4('0x4')]=_0x5e0c63[_0xced4('0x4')]||'';this[_0xced4('0x5')]=_0x5e0c63[_0xced4('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x5173=['name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x4b79e3,_0x399ddb){var _0x1fe9ef=function(_0x2033ec){while(--_0x2033ec){_0x4b79e3['push'](_0x4b79e3['shift']());}};_0x1fe9ef(++_0x399ddb);}(_0x5173,0xd8));var _0x3517=function(_0x2df66a,_0x315ba7){_0x2df66a=_0x2df66a-0x0;var _0x56bddd=_0x5173[_0x2df66a];return _0x56bddd;};'use strict';function VtigerAccount(_0x124272){this['id']=_0x124272['id']||0x0;this[_0x3517('0x0')]=_0x124272[_0x3517('0x0')]||'';this[_0x3517('0x1')]=_0x124272[_0x3517('0x1')]||'';this['accessKey']=_0x124272[_0x3517('0x2')]||'';this[_0x3517('0x3')]=_0x124272[_0x3517('0x3')]||'';this[_0x3517('0x4')]=_0x124272[_0x3517('0x4')]||'';this[_0x3517('0x5')]=_0x124272[_0x3517('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 18a202f..b2f133a 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 _0x9a94=['exports','name','username','authType','type','integrationTab','serverUrl','Configurations'];(function(_0x3d2ac7,_0x370d0d){var _0x5e1d92=function(_0x110aac){while(--_0x110aac){_0x3d2ac7['push'](_0x3d2ac7['shift']());}};_0x5e1d92(++_0x370d0d);}(_0x9a94,0x139));var _0x49a9=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0x9a94[_0x470bfb];return _0x2f5d97;};'use strict';function ZendeskAccount(_0x840878){this['id']=_0x840878['id']||0x0;this[_0x49a9('0x0')]=_0x840878[_0x49a9('0x0')]||'';this['username']=_0x840878[_0x49a9('0x1')]||'';this['password']=_0x840878['password']||'';this['token']=_0x840878['token']||'';this['remoteUri']=_0x840878['remoteUri']||'';this['authType']=_0x840878[_0x49a9('0x2')]||'';this[_0x49a9('0x3')]=_0x840878['type']||_0x49a9('0x4');this[_0x49a9('0x5')]=_0x840878[_0x49a9('0x5')]||'';this[_0x49a9('0x6')]=_0x840878[_0x49a9('0x6')]||{};}module[_0x49a9('0x7')]=ZendeskAccount; \ No newline at end of file +var _0xc970=['password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0x528fa3,_0x3c8282){var _0x5a3760=function(_0x7248db){while(--_0x7248db){_0x528fa3['push'](_0x528fa3['shift']());}};_0x5a3760(++_0x3c8282);}(_0xc970,0x17f));var _0x0c97=function(_0x41e678,_0x49c25e){_0x41e678=_0x41e678-0x0;var _0xfbba77=_0xc970[_0x41e678];return _0xfbba77;};'use strict';function ZendeskAccount(_0x9b31a0){this['id']=_0x9b31a0['id']||0x0;this[_0x0c97('0x0')]=_0x9b31a0[_0x0c97('0x0')]||'';this['username']=_0x9b31a0[_0x0c97('0x1')]||'';this[_0x0c97('0x2')]=_0x9b31a0['password']||'';this[_0x0c97('0x3')]=_0x9b31a0[_0x0c97('0x3')]||'';this[_0x0c97('0x4')]=_0x9b31a0['remoteUri']||'';this[_0x0c97('0x5')]=_0x9b31a0[_0x0c97('0x5')]||'';this[_0x0c97('0x6')]=_0x9b31a0['type']||_0x0c97('0x7');this[_0x0c97('0x8')]=_0x9b31a0['serverUrl']||'';this[_0x0c97('0x9')]=_0x9b31a0[_0x0c97('0x9')]||{};}module[_0x0c97('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 e6dd7b0..440ff9d 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 _0x64d2=['exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x3f7598,_0x212e37){var _0x51fb16=function(_0x4a5c0b){while(--_0x4a5c0b){_0x3f7598['push'](_0x3f7598['shift']());}};_0x51fb16(++_0x212e37);}(_0x64d2,0x64));var _0x264d=function(_0x378f89,_0x13f5c7){_0x378f89=_0x378f89-0x0;var _0x3239d5=_0x64d2[_0x378f89];return _0x3239d5;};'use strict';function ZohoAccount(_0x4dfd7a){this['id']=_0x4dfd7a['id']||0x0;this[_0x264d('0x0')]=_0x4dfd7a['name']||'';this[_0x264d('0x1')]=_0x4dfd7a[_0x264d('0x1')]||'';this[_0x264d('0x2')]=_0x4dfd7a['host']||'';this[_0x264d('0x3')]=_0x4dfd7a[_0x264d('0x3')]||'';this[_0x264d('0x4')]=_0x4dfd7a[_0x264d('0x4')]||'';this[_0x264d('0x5')]=_0x4dfd7a[_0x264d('0x5')]||'';this[_0x264d('0x6')]=_0x4dfd7a['serverUrl']||'';this[_0x264d('0x7')]=_0x4dfd7a[_0x264d('0x7')]||'';this['refreshToken']=_0x4dfd7a[_0x264d('0x8')]||'';this[_0x264d('0x9')]=_0x4dfd7a['Configurations']||{};}module[_0x264d('0xa')]=ZohoAccount; \ No newline at end of file +var _0x8574=['serverUrl','code','refreshToken','Configurations','name','description','host','zone','clientId','clientSecret'];(function(_0x165838,_0x464357){var _0x39723e=function(_0x2285b5){while(--_0x2285b5){_0x165838['push'](_0x165838['shift']());}};_0x39723e(++_0x464357);}(_0x8574,0x1da));var _0x4857=function(_0x3e3be2,_0x3a506a){_0x3e3be2=_0x3e3be2-0x0;var _0x43ada0=_0x8574[_0x3e3be2];return _0x43ada0;};'use strict';function ZohoAccount(_0x40af68){this['id']=_0x40af68['id']||0x0;this[_0x4857('0x0')]=_0x40af68[_0x4857('0x0')]||'';this[_0x4857('0x1')]=_0x40af68[_0x4857('0x1')]||'';this[_0x4857('0x2')]=_0x40af68[_0x4857('0x2')]||'';this['zone']=_0x40af68[_0x4857('0x3')]||'';this[_0x4857('0x4')]=_0x40af68[_0x4857('0x4')]||'';this[_0x4857('0x5')]=_0x40af68[_0x4857('0x5')]||'';this[_0x4857('0x6')]=_0x40af68[_0x4857('0x6')]||'';this[_0x4857('0x7')]=_0x40af68[_0x4857('0x7')]||'';this[_0x4857('0x8')]=_0x40af68[_0x4857('0x8')]||'';this[_0x4857('0x9')]=_0x40af68[_0x4857('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 1ddd17c..cd1a2c5 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 _0x2d23=['calleridname','Contact','phone','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','number','exports','util','lodash','isNil','string','idContact','name','type','campaigntype','queue','dialAnswer','membername','Agent','format'];(function(_0x12966a,_0x276df0){var _0x4f1495=function(_0x133c9f){while(--_0x133c9f){_0x12966a['push'](_0x12966a['shift']());}};_0x4f1495(++_0x276df0);}(_0x2d23,0x93));var _0x32d2=function(_0x4afa19,_0x4440ef){_0x4afa19=_0x4afa19-0x0;var _0x2e6278=_0x2d23[_0x4afa19];return _0x2e6278;};'use strict';var util=require(_0x32d2('0x0'));var _=require(_0x32d2('0x1'));var moment=require('moment');function checkNameSurname(_0x28caae,_0x3ad8e0,_0x3fa234){var _0x34753f='';if(!_[_0x32d2('0x2')](_0x3ad8e0)&&_0x32d2('0x3')===typeof _0x3ad8e0){_0x34753f+=_0x3ad8e0;}if(!_[_0x32d2('0x2')](_0x3fa234)&&_0x32d2('0x3')===typeof _0x3fa234){_0x34753f+='\x20'+_0x3fa234;}if(_0x34753f!==''){return _0x34753f;}return _0x28caae;}function Action(_0x15166b,_0x4c5d22,_0x4efabf,_0x410652,_0x1bd783){this['uniqueid']=_0x4efabf||undefined;this[_0x32d2('0x4')]=_0x15166b['id'];this['queue']=_0x4c5d22[_0x32d2('0x5')];this[_0x32d2('0x6')]=_0x4c5d22[_0x32d2('0x6')];this[_0x32d2('0x7')]=_0x32d2('0x8');this[_0x32d2('0x9')]=![];this[_0x32d2('0xa')]=_[_0x32d2('0x2')](_0x15166b['Agent'])?undefined:_0x15166b[_0x32d2('0xb')][_0x32d2('0x5')];this['channelAgent']=this[_0x32d2('0xa')]?util[_0x32d2('0xc')]('SIP/%s',this[_0x32d2('0xa')]):_0x410652||undefined;this[_0x32d2('0xd')]=checkNameSurname(_0x15166b[_0x32d2('0xe')][_0x32d2('0xf')],_0x15166b[_0x32d2('0xe')][_0x32d2('0x10')],_0x15166b[_0x32d2('0xe')][_0x32d2('0x11')]);this[_0x32d2('0x12')]=_0x15166b[_0x32d2('0x12')]||![];this['calleridnum']=_0x15166b['Contact'][_0x32d2('0xf')];this[_0x32d2('0x13')]=_0x15166b[_0x32d2('0x13')];this[_0x32d2('0x14')]=_0x15166b[_0x32d2('0x14')]||0x0;this[_0x32d2('0x15')]=_0x15166b[_0x32d2('0x15')]||0x0;this[_0x32d2('0x16')]=_0x15166b[_0x32d2('0x16')]||0x0;this[_0x32d2('0x17')]=(_0x15166b[_0x32d2('0x14')]||0x0)+(_0x15166b[_0x32d2('0x15')]||0x0)+(_0x15166b[_0x32d2('0x16')]||0x0)+(_0x15166b[_0x32d2('0x18')]||0x0)+(_0x15166b[_0x32d2('0x19')]||0x0)+(_0x15166b[_0x32d2('0x1a')]||0x0)+(_0x15166b[_0x32d2('0x1b')]||0x0)+(_0x15166b['countagentrejectretry']||0x0);this[_0x32d2('0x18')]=_0x15166b['countnosuchnumberretry']||0x0;this[_0x32d2('0x19')]=_0x15166b[_0x32d2('0x19')]||0x0;this[_0x32d2('0x1a')]=_0x15166b['countabandonedretry']||0x0;this[_0x32d2('0x1b')]=_0x15166b[_0x32d2('0x1b')]||0x0;this[_0x32d2('0x1c')]=_0x15166b['countagentrejectretry']||0x0;this[_0x32d2('0x1d')]=_0x15166b[_0x32d2('0x1d')];this[_0x32d2('0x1e')]=_0x15166b[_0x32d2('0x1e')];this[_0x32d2('0x1f')]=_0x15166b['callbackat'];this[_0x32d2('0x20')]=_0x15166b[_0x32d2('0x20')];this[_0x32d2('0x21')]=_0x15166b[_0x32d2('0x21')];this[_0x32d2('0x22')]=_0x15166b[_0x32d2('0x22')];this[_0x32d2('0x23')]=_['isNil'](_0x15166b[_0x32d2('0xb')])?_0x15166b['UserId']:_0x15166b[_0x32d2('0xb')]['id'];this['VoiceQueueId']=_0x15166b[_0x32d2('0x24')];this['originatecalleridnum']='';this[_0x32d2('0x25')]='';}Action['prototype']['getCaller']=function(){return util[_0x32d2('0xc')]('\x22%s\x22\x20<%s>',this[_0x32d2('0xd')],this[_0x32d2('0x26')]);};module[_0x32d2('0x27')]=Action; \ No newline at end of file +var _0x2eec=['firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','idContact','queue','name','type','campaigntype','dialAnswer','Agent','membername','calleridname','Contact'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x2eec,0xc8));var _0xc2ee=function(_0x55849c,_0x3ab6a1){_0x55849c=_0x55849c-0x0;var _0xf94a3d=_0x2eec[_0x55849c];return _0xf94a3d;};'use strict';var util=require(_0xc2ee('0x0'));var _=require(_0xc2ee('0x1'));var moment=require(_0xc2ee('0x2'));function checkNameSurname(_0x430309,_0x4c27af,_0x127075){var _0x1d2b78='';if(!_[_0xc2ee('0x3')](_0x4c27af)&&_0xc2ee('0x4')===typeof _0x4c27af){_0x1d2b78+=_0x4c27af;}if(!_[_0xc2ee('0x3')](_0x127075)&&_0xc2ee('0x4')===typeof _0x127075){_0x1d2b78+='\x20'+_0x127075;}if(_0x1d2b78!==''){return _0x1d2b78;}return _0x430309;}function Action(_0x8ac270,_0x60ad3a,_0x10fa77,_0x4e89e2,_0x47291d){this['uniqueid']=_0x10fa77||undefined;this[_0xc2ee('0x5')]=_0x8ac270['id'];this[_0xc2ee('0x6')]=_0x60ad3a[_0xc2ee('0x7')];this['type']=_0x60ad3a[_0xc2ee('0x8')];this[_0xc2ee('0x9')]=_0xc2ee('0x6');this[_0xc2ee('0xa')]=![];this['membername']=_['isNil'](_0x8ac270['Agent'])?undefined:_0x8ac270[_0xc2ee('0xb')][_0xc2ee('0x7')];this['channelAgent']=this[_0xc2ee('0xc')]?util['format']('SIP/%s',this[_0xc2ee('0xc')]):_0x4e89e2||undefined;this[_0xc2ee('0xd')]=checkNameSurname(_0x8ac270[_0xc2ee('0xe')]['phone'],_0x8ac270['Contact'][_0xc2ee('0xf')],_0x8ac270[_0xc2ee('0xe')][_0xc2ee('0x10')]);this['active']=_0x8ac270[_0xc2ee('0x11')]||![];this[_0xc2ee('0x12')]=_0x8ac270[_0xc2ee('0xe')]['phone'];this['scheduledat']=_0x8ac270[_0xc2ee('0x13')];this[_0xc2ee('0x14')]=_0x8ac270['countbusyretry']||0x0;this[_0xc2ee('0x15')]=_0x8ac270['countcongestionretry']||0x0;this[_0xc2ee('0x16')]=_0x8ac270['countnoanswerretry']||0x0;this[_0xc2ee('0x17')]=(_0x8ac270[_0xc2ee('0x14')]||0x0)+(_0x8ac270['countcongestionretry']||0x0)+(_0x8ac270[_0xc2ee('0x16')]||0x0)+(_0x8ac270[_0xc2ee('0x18')]||0x0)+(_0x8ac270[_0xc2ee('0x19')]||0x0)+(_0x8ac270[_0xc2ee('0x1a')]||0x0)+(_0x8ac270['countmachineretry']||0x0)+(_0x8ac270[_0xc2ee('0x1b')]||0x0);this[_0xc2ee('0x18')]=_0x8ac270[_0xc2ee('0x18')]||0x0;this[_0xc2ee('0x19')]=_0x8ac270['countdropretry']||0x0;this[_0xc2ee('0x1a')]=_0x8ac270[_0xc2ee('0x1a')]||0x0;this['countmachineretry']=_0x8ac270['countmachineretry']||0x0;this[_0xc2ee('0x1b')]=_0x8ac270[_0xc2ee('0x1b')]||0x0;this[_0xc2ee('0x1c')]=_0x8ac270[_0xc2ee('0x1c')];this[_0xc2ee('0x1d')]=_0x8ac270[_0xc2ee('0x1d')];this[_0xc2ee('0x1e')]=_0x8ac270[_0xc2ee('0x1e')];this[_0xc2ee('0x1f')]=_0x8ac270[_0xc2ee('0x1f')];this[_0xc2ee('0x20')]=_0x8ac270[_0xc2ee('0x20')];this[_0xc2ee('0x21')]=_0x8ac270[_0xc2ee('0x21')];this[_0xc2ee('0x22')]=_[_0xc2ee('0x3')](_0x8ac270[_0xc2ee('0xb')])?_0x8ac270[_0xc2ee('0x22')]:_0x8ac270[_0xc2ee('0xb')]['id'];this[_0xc2ee('0x23')]=_0x8ac270[_0xc2ee('0x23')];this['originatecalleridnum']='';this[_0xc2ee('0x24')]='';}Action[_0xc2ee('0x25')][_0xc2ee('0x26')]=function(){return util[_0xc2ee('0x27')](_0xc2ee('0x28'),this['calleridname'],this[_0xc2ee('0x29')]);};module[_0xc2ee('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 01b1cdc..37bfe27 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 _0xdbf5=['reachable','execRun','unlock','getContactPreview','recallme','isValid','checkIsBlackList','checkInBlack','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','campaign\x20Name:\x20','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','trim','substring','getCallerId','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','Action','variablesAction','[originated][increment]','OriginateError','actionid','clone','response','unlockContact','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','destlinkedid','addVariable','variables','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','socket.io-emitter','prototype','enqueue','tail','finally','campaignsPreview','trunks','actions','agents','syncOriginateResponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','syncNewExten','varset','syncVarSet','syncAttendedTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','available','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','clockClearZombieChannels','hasOwnProperty','booked','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','clearZombieChannel','Queue','originated:\x20','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','recallMe','getContactRecallMe','agentReadyId','then','isNil','length','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','totalGlobal','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','uniqueid','BUSY','countbusyretry','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','cloneAction','dialNoAnswerRetryFrequency','CONGESTION','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectRetryFrequency','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','originated','ANSWER','callProgressDetectingAgent','isUndefined','object','reason','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','logAgent','Busy','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','SIP/%s'];(function(_0x3c700f,_0x2ad2c8){var _0x1bf773=function(_0x205d1f){while(--_0x205d1f){_0x3c700f['push'](_0x3c700f['shift']());}};_0x1bf773(++_0x2ad2c8);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x4e8720,_0x290a87){_0x4e8720=_0x4e8720-0x0;var _0x4f5818=_0xdbf5[_0x4e8720];return _0x4f5818;};'use strict';var util=require('util');var _=require(_0x5dbf('0x0'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x5dbf('0x1'));var md5=require(_0x5dbf('0x2'));var Redis=require(_0x5dbf('0x3'));var config=require(_0x5dbf('0x4'));var logger=require(_0x5dbf('0x5'))(_0x5dbf('0x6'));var loggerAction=require(_0x5dbf('0x5'))(_0x5dbf('0x7'));var ami=require(_0x5dbf('0x8'));var rpcDb=require(_0x5dbf('0x9'));var Action=require(_0x5dbf('0xa'));var ut=require(_0x5dbf('0xb'));config[_0x5dbf('0xc')]=_['defaults'](config[_0x5dbf('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x5dbf('0xd'))(new Redis(config[_0x5dbf('0xc')]));var Sequence=function(){};Sequence[_0x5dbf('0xe')][_0x5dbf('0xf')]=function(_0x4efed3){this[_0x5dbf('0x10')]=this['tail']?this['tail'][_0x5dbf('0x11')](_0x4efed3):_0x4efed3();};function Preview(_0x5dbc97){this['sequence']=new Sequence();this[_0x5dbf('0x12')]=_0x5dbc97['voiceQueues'];this[_0x5dbf('0x13')]=_0x5dbc97[_0x5dbf('0x13')];this[_0x5dbf('0x14')]={};this[_0x5dbf('0x15')]=_0x5dbc97[_0x5dbf('0x15')];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this[_0x5dbf('0x16')][_0x5dbf('0x17')](this));ami['on']('hangup',this[_0x5dbf('0x18')][_0x5dbf('0x17')](this));ami['on'](_0x5dbf('0x19'),this[_0x5dbf('0x1a')][_0x5dbf('0x17')](this));ami['on'](_0x5dbf('0x1b'),this[_0x5dbf('0x1c')]['bind'](this));ami['on']('newexten',this[_0x5dbf('0x1d')][_0x5dbf('0x17')](this));ami['on'](_0x5dbf('0x1e'),this[_0x5dbf('0x1f')][_0x5dbf('0x17')](this));ami['on']('attendedtransfer',this[_0x5dbf('0x20')]['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x5dbf('0x17')](this));this[_0x5dbf('0x21')](this[_0x5dbf('0x12')]);}function emit(_0x2ab57c,_0x1e3cce,_0x5b2518){io['to'](_0x2ab57c)[_0x5dbf('0x22')](_0x1e3cce,_0x5b2518);}function emitCampaignPreview(_0x58e9ac){if(_0x58e9ac[_0x5dbf('0x23')]===_0x5dbf('0x24')){var _0x14d133={'id':_0x58e9ac['id'],'name':_0x58e9ac[_0x5dbf('0x25')],'strategy':_0x58e9ac[_0x5dbf('0x26')],'answered':_0x58e9ac[_0x5dbf('0x27')],'available':_0x58e9ac['available'],'loggedIn':_0x58e9ac[_0x5dbf('0x28')],'pTalking':_0x58e9ac[_0x5dbf('0x29')],'sumBillable':_0x58e9ac[_0x5dbf('0x2a')],'sumDuration':_0x58e9ac[_0x5dbf('0x2b')],'sumHoldTime':_0x58e9ac[_0x5dbf('0x2c')]||0x0,'talking':_0x58e9ac[_0x5dbf('0x2d')],'total':_0x58e9ac[_0x5dbf('0x2e')],'type':_0x58e9ac[_0x5dbf('0x23')],'unmanaged':_0x58e9ac[_0x5dbf('0x2f')],'abandoned':_0x58e9ac[_0x5dbf('0x30')],'waiting':_0x58e9ac[_0x5dbf('0x31')],'loggedInDb':_0x58e9ac[_0x5dbf('0x32')],'dialActive':_0x58e9ac[_0x5dbf('0x33')],'dialMethod':_0x58e9ac[_0x5dbf('0x34')],'dialOriginateCallerIdName':_0x58e9ac[_0x5dbf('0x35')],'dialOriginateCallerIdNumber':_0x58e9ac[_0x5dbf('0x36')],'dialOriginateTimeout':_0x58e9ac[_0x5dbf('0x37')],'dialPrefix':_0x58e9ac[_0x5dbf('0x38')],'outboundAnswerAgiCallsDay':_0x58e9ac[_0x5dbf('0x39')],'outboundAnswerCallsDay':_0x58e9ac[_0x5dbf('0x3a')],'outboundBlacklistCallsDay':_0x58e9ac[_0x5dbf('0x3b')],'outboundBusyCallsDay':_0x58e9ac[_0x5dbf('0x3c')],'outboundCongestionCallsDay':_0x58e9ac[_0x5dbf('0x3d')],'outboundDropCallsDayACS':_0x58e9ac['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x58e9ac[_0x5dbf('0x3e')],'outboundDropCallsDayTimeout':_0x58e9ac[_0x5dbf('0x3f')],'outboundNoAnswerCallsDay':_0x58e9ac[_0x5dbf('0x40')],'outboundNoSuchCallsDay':_0x58e9ac[_0x5dbf('0x41')],'outboundOriginateFailureCallsDay':_0x58e9ac[_0x5dbf('0x42')],'outboundReCallsDay':_0x58e9ac[_0x5dbf('0x43')],'outboundRejectCallsDay':_0x58e9ac[_0x5dbf('0x44')],'outboundUnknownCallsDay':_0x58e9ac[_0x5dbf('0x45')],'outboundAbandonedCallsDay':_0x58e9ac[_0x5dbf('0x46')],'predictiveIntervalAnsweredCalls':_0x58e9ac[_0x5dbf('0x47')],'predictiveIntervalAvgHoldtime':_0x58e9ac[_0x5dbf('0x48')],'predictiveIntervalAvgTalktime':_0x58e9ac['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x58e9ac['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x58e9ac[_0x5dbf('0x49')],'predictiveIntervalErlangCalls':_0x58e9ac[_0x5dbf('0x4a')],'predictiveIntervalErlangCallsDroppedCalls':_0x58e9ac[_0x5dbf('0x4b')],'predictiveIntervalHitRate':_0x58e9ac[_0x5dbf('0x4c')],'predictiveIntervalMultiplicativeFactor':_0x58e9ac[_0x5dbf('0x4d')],'predictiveIntervalPauses':_0x58e9ac['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x58e9ac['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x58e9ac[_0x5dbf('0x4e')],'message':_0x58e9ac[_0x5dbf('0x4f')],'originated':_0x58e9ac['originated'],'erlangCalls':_0x58e9ac[_0x5dbf('0x50')],'erlangCallToSecond':_0x58e9ac[_0x5dbf('0x51')],'erlangAbandonmentRate':_0x58e9ac[_0x5dbf('0x52')],'erlangBusyFactor':_0x58e9ac[_0x5dbf('0x53')],'startPredictive':_0x58e9ac[_0x5dbf('0x54')],'startProgressive':_0x58e9ac['startProgressive']};if(_0x58e9ac[_0x5dbf('0x55')]){_0x14d133[_0x5dbf('0x55')]={'id':_0x58e9ac[_0x5dbf('0x55')]['id'],'name':_0x58e9ac[_0x5dbf('0x55')][_0x5dbf('0x25')],'active':_0x58e9ac['Trunk'][_0x5dbf('0x56')],'callerid':_0x58e9ac[_0x5dbf('0x55')][_0x5dbf('0x57')]};}if(_0x58e9ac[_0x5dbf('0x58')]){_0x14d133['Interval']={'id':_0x58e9ac[_0x5dbf('0x58')]['id'],'name':_0x58e9ac[_0x5dbf('0x58')][_0x5dbf('0x25')]};}var _0x3439da=md5(JSON[_0x5dbf('0x59')](_0x14d133));if(_0x58e9ac[_0x5dbf('0x2')]!==_0x3439da){_0x58e9ac[_0x5dbf('0x2')]=_0x3439da;emit(util[_0x5dbf('0x5a')](_0x5dbf('0x5b'),_0x14d133[_0x5dbf('0x25')]),_0x5dbf('0x5c'),_0x14d133);}}}function emitVoiceQueueChannelRemove(_0x51c667){logger[_0x5dbf('0x5d')](_0x5dbf('0x5e'),JSON[_0x5dbf('0x59')](_0x51c667));emit(util['format'](_0x5dbf('0x5b'),_0x51c667[_0x5dbf('0x25')]),_0x5dbf('0x5f'),_0x51c667);io['emit'](_0x5dbf('0x60'),_0x51c667);}function notSendMessagesQueue(_0x45cb4d){if(_0x45cb4d[_0x5dbf('0x61')]){if(_0x45cb4d['originated']===0x0&&_0x45cb4d[_0x5dbf('0x29')]===0x0){_0x45cb4d[_0x5dbf('0x61')]=![];_0x45cb4d[_0x5dbf('0x62')]=0x0;_0x45cb4d[_0x5dbf('0x63')]=0x0;_0x45cb4d[_0x5dbf('0x4f')]=_0x5dbf('0x64');ut[_0x5dbf('0x65')](_0x5dbf('0x66'),_0x45cb4d['name']+'\x20is\x20not\x20active');}else{_0x45cb4d['message']='IS_DISACTIVED';ut[_0x5dbf('0x65')](_0x5dbf('0x66'),_0x45cb4d['name']+_0x5dbf('0x67'));}emitCampaignPreview(_0x45cb4d);}}Preview[_0x5dbf('0xe')]['loopCampaigns']=function(){var _0x1a7ea9=this;setInterval(function(){_0x1a7ea9[_0x5dbf('0x68')]();},0x7cf);};Preview[_0x5dbf('0xe')][_0x5dbf('0x68')]=function(){var _0x21ae10=this[_0x5dbf('0x12')];this[_0x5dbf('0x69')]+=0x1;for(var _0x1c020a in _0x21ae10){if(_0x21ae10[_0x5dbf('0x6a')](_0x1c020a)&&(_0x21ae10[_0x1c020a][_0x5dbf('0x34')]==='preview'||_0x21ae10[_0x1c020a][_0x5dbf('0x34')]===_0x5dbf('0x6b'))&&_0x21ae10[_0x1c020a][_0x5dbf('0x23')]==='outbound'){if(this[_0x5dbf('0x69')]>0x7){this[_0x5dbf('0x69')]=0x0;this[_0x5dbf('0x6c')]();}}if(_0x21ae10[_0x5dbf('0x6a')](_0x1c020a)&&_0x21ae10[_0x1c020a]['dialMethod']===_0x5dbf('0x6')&&_0x21ae10[_0x1c020a]['type']===_0x5dbf('0x24')){if(_0x21ae10[_0x1c020a][_0x5dbf('0x33')]){this[_0x5dbf('0x6d')](_0x21ae10[_0x1c020a]);if(_0x21ae10[_0x1c020a][_0x5dbf('0x6e')])this['recallMe'](_0x21ae10[_0x1c020a]);}else{notSendMessagesQueue(_0x21ae10[_0x1c020a]);}}}};Preview['prototype'][_0x5dbf('0x6f')]=function(_0x43f5e8){var _0x1246d7=this;this['sequence'][_0x5dbf('0xf')](function(){if(!_['isNil'](_0x1246d7['actions'][_0x43f5e8])){loggerAction['info']('[clearZombieChannels][talking]',_0x43f5e8,_0x5dbf('0x70'),_0x1246d7[_0x5dbf('0x14')][_0x43f5e8]['queue'],_0x5dbf('0x71'),JSON[_0x5dbf('0x59')](_0x1246d7['campaignsPreview'][_0x1246d7[_0x5dbf('0x14')][_0x43f5e8][_0x5dbf('0x72')]]['originated']),_0x5dbf('0x73'),JSON['stringify'](_0x1246d7['campaignsPreview'][_0x1246d7[_0x5dbf('0x14')][_0x43f5e8][_0x5dbf('0x72')]][_0x5dbf('0x29')]),JSON['stringify'](_0x1246d7['actions'][_0x43f5e8][_0x5dbf('0x74')]),JSON[_0x5dbf('0x59')](_[_0x5dbf('0x75')](_0x1246d7[_0x5dbf('0x14')][_0x43f5e8],[_0x5dbf('0x76'),_0x5dbf('0x77'),_0x5dbf('0x78'),_0x5dbf('0x79')])));return ami['Action']({'action':_0x5dbf('0x7a'),'channel':_0x1246d7[_0x5dbf('0x14')][_0x43f5e8][_0x5dbf('0x7b')]})[_0x5dbf('0x7c')](function(_0x22ed82){if(_0x22ed82[_0x5dbf('0x4f')]===_0x5dbf('0x7d')){setTimeout(function(){if(_0x1246d7['actions'][_0x43f5e8]){ut[_0x5dbf('0x7e')](_0x1246d7['campaignsPreview'][_0x1246d7[_0x5dbf('0x14')][_0x43f5e8][_0x5dbf('0x72')]],_0x5dbf('0x7f'));if(_0x1246d7[_0x5dbf('0x14')][_0x43f5e8][_0x5dbf('0x74')]===!![]){ut[_0x5dbf('0x80')](_0x1246d7[_0x5dbf('0x12')][_0x1246d7['actions'][_0x43f5e8]['queue']],'[clearZombieChannel]');ut[_0x5dbf('0x81')](_0x5dbf('0x82')+_0x43f5e8,_0x1246d7[_0x5dbf('0x14')][_0x43f5e8]['queue']);}ut['loggerError'](_0x5dbf('0x83')+_0x43f5e8,_0x1246d7[_0x5dbf('0x14')][_0x43f5e8][_0x5dbf('0x72')]);delete _0x1246d7['actions'][_0x43f5e8];}},0x2328);}});}});};Preview[_0x5dbf('0xe')]['clearZombieChannels']=function(){var _0x3ce224=this;loggerAction[_0x5dbf('0x5d')](_0x5dbf('0x84'),_['size'](this['actions']));for(var _0x1b316d in this[_0x5dbf('0x14')]){if(_0x3ce224[_0x5dbf('0x14')][_0x5dbf('0x6a')](_0x1b316d)){_0x3ce224['clearZombieChannel'](_0x1b316d);}}};Preview[_0x5dbf('0xe')][_0x5dbf('0x85')]=function(_0x478cc1){var _0x5485f3=this;rpcDb[_0x5dbf('0x86')](_0x478cc1['id'],ut[_0x5dbf('0x87')](this[_0x5dbf('0x15')]))[_0x5dbf('0x88')](function(_0x3e13cb){if(!_[_0x5dbf('0x89')](_0x3e13cb)){for(var _0x50a029=0x0;_0x50a029<_0x3e13cb[_0x5dbf('0x8a')];_0x50a029+=0x1){if(ut['getDiff'](_0x3e13cb[_0x50a029]['scheduledat'])<_0x478cc1['dialRecallMeTimeout']*0x3c){if(_0x3e13cb[_0x50a029][_0x5dbf('0x8b')]&&!_0x3e13cb[_0x50a029]['Agent'][_0x5dbf('0x8c')]){_0x5485f3[_0x5dbf('0x8d')](_0x3e13cb[_0x50a029]['id'])[_0x5dbf('0x88')](ut[_0x5dbf('0x8e')](_0x5dbf('0x8f')))[_0x5dbf('0x7c')](ut[_0x5dbf('0x8e')](_0x5dbf('0x8f')));}else{rpcDb[_0x5dbf('0x90')](_0x3e13cb[_0x50a029]['id']);}}else{var _0x1d91de=new Action(_0x3e13cb[_0x50a029],_0x478cc1);_0x1d91de[_0x5dbf('0x91')]=moment()[_0x5dbf('0x5a')](_0x5dbf('0x92'));_0x478cc1[_0x5dbf('0x43')]+=0x1;ut[_0x5dbf('0x93')](_0x1d91de,0x17,'RecallInQueue');if(_0x478cc1[_0x5dbf('0x94')]){rpcDb['rescheduleContactInQueue'](ut[_0x5dbf('0x95')](_0x3e13cb[_0x50a029]));rpcDb[_0x5dbf('0x96')](_0x1d91de,_0x5dbf('0x97'));}else{ut[_0x5dbf('0x93')](_0x1d91de,0x16,'RecallFailedTimeout');rpcDb[_0x5dbf('0x96')](_0x1d91de,_0x5dbf('0x98'));rpcDb[_0x5dbf('0x99')](_0x1d91de,_0x5dbf('0x98'));}}}}})[_0x5dbf('0x7c')](ut[_0x5dbf('0x8e')]('[getContactRecallMe]'));};Preview[_0x5dbf('0xe')][_0x5dbf('0x6d')]=function(_0x3b0465){_0x3b0465[_0x5dbf('0x61')]=!![];if(ut[_0x5dbf('0x9a')](_0x3b0465[_0x5dbf('0x28')])){_0x3b0465[_0x5dbf('0x4f')]=_0x5dbf('0x9b');}else if(!ut[_0x5dbf('0x9c')](_0x3b0465[_0x5dbf('0x33')])){_0x3b0465[_0x5dbf('0x4f')]=_0x5dbf('0x64');}else if(!this['isTrunkReachable'](_0x3b0465['Trunk'])){if(!this[_0x5dbf('0x9d')](_0x3b0465[_0x5dbf('0x9e')])){_0x3b0465[_0x5dbf('0x4f')]=_0x5dbf('0x9f');}else{_0x3b0465[_0x5dbf('0x4f')]=_0x5dbf('0xa0');}}else{_0x3b0465[_0x5dbf('0x4f')]=_0x5dbf('0xa0');}emitCampaignPreview(_0x3b0465);};Preview[_0x5dbf('0xe')]['callProgressDetectingCustomer']=function(_0x486397,_0x49005c,_0x4f4aa3){var _0x408b51=this;var _0x398326=this[_0x5dbf('0x14')][_0x49005c];var _0x27ca1f=this[_0x5dbf('0x12')][_0x398326[_0x5dbf('0x72')]];var _0x5331ff;if(_0x27ca1f){switch(_0x4f4aa3){case'1':_0x27ca1f['outboundNoSuchCallsDay']+=0x1;_0x398326[_0x5dbf('0xa1')]+=0x1;_0x398326[_0x5dbf('0xa2')]=ut['totalGlobal'](_0x398326);ut[_0x5dbf('0x93')](_0x398326,0x0,_0x5dbf('0xa3'));ami[_0x5dbf('0x22')](_0x5dbf('0xa4'),ut['buildObj'](_0x398326,_0x5dbf('0xa5')));rpcDb[_0x5dbf('0x96')](_0x398326,_0x5dbf('0xa6'));if(ut[_0x5dbf('0xa7')](_0x398326)>=_0x27ca1f[_0x5dbf('0xa8')]){_0x5331ff=ut['cloneAction'](_0x398326,0xf,_0x5dbf('0xa9'));rpcDb[_0x5dbf('0x99')](_0x5331ff,_0x5dbf('0xaa'));}else{if(_0x398326[_0x5dbf('0xa1')]>=_0x27ca1f['dialNoSuchNumberMaxRetry']){rpcDb[_0x5dbf('0x99')](_0x398326,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x5dbf('0xab')](ut[_0x5dbf('0xac')](_0x398326,_0x5dbf('0xa1'),_0x27ca1f['dialNoSuchNumberRetryFrequency']),_0x398326[_0x5dbf('0xad')],_0x398326[_0x5dbf('0xae')]);}}delete this[_0x5dbf('0x14')][_0x486397[_0x5dbf('0xaf')]];break;case'ANSWER':var _0x1f9d2d=moment()[_0x5dbf('0x5a')](_0x5dbf('0x92'));_0x398326[_0x5dbf('0xb0')]=_0x1f9d2d;_0x398326[_0x5dbf('0xb1')]=_0x1f9d2d;_0x398326[_0x5dbf('0x74')]=!![];_0x27ca1f['pTalking']+=0x1;logger[_0x5dbf('0x5d')](_0x5dbf('0xb2'),_0x398326['uniqueid'],_0x5dbf('0xb3'),_0x27ca1f[_0x5dbf('0x25')],_0x5dbf('0x73'),_0x27ca1f[_0x5dbf('0x29')]);ami[_0x5dbf('0x22')](_0x5dbf('0xb4'),ut[_0x5dbf('0xb5')](_0x398326,_0x5dbf('0xb6'),this[_0x5dbf('0x12')][_0x398326[_0x5dbf('0x72')]]));if(_0x27ca1f[_0x5dbf('0xb7')]){ami[_0x5dbf('0x22')](_0x5dbf('0xb8'),ut[_0x5dbf('0xb9')](_0x398326));}break;case'16':ami[_0x5dbf('0x22')](_0x5dbf('0xba'),ut['buildObj'](_0x398326,_0x5dbf('0xbb'),this[_0x5dbf('0x12')][_0x398326[_0x5dbf('0x72')]]));emitVoiceQueueChannelRemove(ut[_0x5dbf('0xb5')](_0x398326,'complete'));_0x27ca1f[_0x5dbf('0x3a')]+=0x1;_0x27ca1f[_0x5dbf('0x2e')]+=0x1;_0x27ca1f[_0x5dbf('0x27')]+=0x1;ut[_0x5dbf('0x80')](_0x27ca1f,_0x5dbf('0xbc'));_0x398326['countglobal']=ut[_0x5dbf('0xa7')](_0x398326);ut[_0x5dbf('0x93')](_0x398326,0x4,'Answer');rpcDb['createCustomerHistory'](_0x398326,_0x5dbf('0xbd'));rpcDb[_0x5dbf('0x99')](_0x398326,_0x5dbf('0xbe'));rpcDb[_0x5dbf('0xbf')](_0x398326);_0x27ca1f[_0x5dbf('0x2b')]+=_0x398326[_0x5dbf('0xc0')];_0x27ca1f[_0x5dbf('0x2a')]+=_0x398326['talktime'];logger[_0x5dbf('0x5d')](_0x5dbf('0xc1'),_0x398326[_0x5dbf('0xc2')],_0x5dbf('0xb3'),_0x27ca1f[_0x5dbf('0x25')],_0x5dbf('0x73'),_0x27ca1f['pTalking']);delete this[_0x5dbf('0x14')][_0x486397[_0x5dbf('0xaf')]];break;case _0x5dbf('0xc3'):_0x27ca1f[_0x5dbf('0x3c')]+=0x1;_0x398326[_0x5dbf('0xc4')]+=0x1;_0x398326['countglobal']=ut[_0x5dbf('0xa7')](_0x398326);ut['logCustomer'](_0x398326,0x5,'Busy');ami['emit']('custom:agentbusy',ut[_0x5dbf('0xb5')](_0x398326,_0x5dbf('0xc5')));rpcDb[_0x5dbf('0x96')](_0x398326,_0x5dbf('0xc6'));if(ut[_0x5dbf('0xa7')](_0x398326)>=_0x27ca1f['dialGlobalMaxRetry']){_0x5331ff=ut['cloneAction'](_0x398326,0xf,_0x5dbf('0xa9'));rpcDb['createCustomerFinal'](_0x5331ff,_0x5dbf('0xc7'));}else{if(_0x398326[_0x5dbf('0xc4')]>=_0x27ca1f['dialBusyMaxRetry']){rpcDb[_0x5dbf('0x99')](_0x398326,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x5dbf('0xab')](ut[_0x5dbf('0xac')](_0x398326,_0x5dbf('0xc4'),_0x27ca1f[_0x5dbf('0xc8')]),_0x398326[_0x5dbf('0xad')],_0x398326['activeContact']);}}break;case _0x5dbf('0xc9'):_0x27ca1f[_0x5dbf('0x40')]+=0x1;_0x398326[_0x5dbf('0xca')]+=0x1;_0x398326[_0x5dbf('0xa2')]=ut['totalGlobal'](_0x398326);ut[_0x5dbf('0x93')](_0x398326,0x3,_0x5dbf('0xcb'));ami[_0x5dbf('0x22')](_0x5dbf('0xcc'),ut[_0x5dbf('0xb5')](_0x398326,_0x5dbf('0xcd')));rpcDb[_0x5dbf('0x96')](_0x398326,_0x5dbf('0xce'));if(ut['totalGlobal'](_0x398326)>=_0x27ca1f['dialGlobalMaxRetry']){_0x5331ff=ut[_0x5dbf('0xcf')](_0x398326,0xf,_0x5dbf('0xa9'));rpcDb[_0x5dbf('0x99')](_0x5331ff,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x398326['countnoanswerretry']>=_0x27ca1f['dialNoAnswerMaxRetry']){rpcDb[_0x5dbf('0x99')](_0x398326,_0x5dbf('0xce'));}else{rpcDb[_0x5dbf('0xab')](ut[_0x5dbf('0xac')](_0x398326,_0x5dbf('0xca'),_0x27ca1f[_0x5dbf('0xd0')]),_0x398326['unlockAgent'],_0x398326[_0x5dbf('0xae')]);}}break;case _0x5dbf('0xd1'):_0x27ca1f['outboundCongestionCallsDay']+=0x1;_0x398326['countcongestionretry']+=0x1;_0x398326[_0x5dbf('0xa2')]=ut['totalGlobal'](_0x398326);ut['logCustomer'](_0x398326,0x8,_0x5dbf('0xd2'));ami[_0x5dbf('0x22')](_0x5dbf('0xd3'),ut['buildObj'](_0x398326,_0x5dbf('0xd4')));rpcDb[_0x5dbf('0x96')](_0x398326,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x5dbf('0xa7')](_0x398326)>=_0x27ca1f[_0x5dbf('0xa8')]){_0x5331ff=ut[_0x5dbf('0xcf')](_0x398326,0xf,_0x5dbf('0xa9'));rpcDb[_0x5dbf('0x99')](_0x5331ff,_0x5dbf('0xd5'));}else{if(_0x398326[_0x5dbf('0xd6')]>=_0x27ca1f[_0x5dbf('0xd7')]){rpcDb['createCustomerFinal'](_0x398326,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut[_0x5dbf('0xac')](_0x398326,_0x5dbf('0xd6'),_0x27ca1f[_0x5dbf('0xc8')]),_0x398326[_0x5dbf('0xad')],_0x398326[_0x5dbf('0xae')]);}}break;case _0x5dbf('0xd8'):_0x27ca1f[_0x5dbf('0x44')]+=0x1;_0x398326[_0x5dbf('0xd9')]+=0x1;_0x398326[_0x5dbf('0xa2')]=ut[_0x5dbf('0xa7')](_0x398326);ut['logCustomer'](_0x398326,0x14,_0x5dbf('0xda'));ami[_0x5dbf('0x22')](_0x5dbf('0xdb'),ut[_0x5dbf('0xb5')](_0x398326,_0x5dbf('0xdc')));rpcDb[_0x5dbf('0x96')](_0x398326,_0x5dbf('0xdd'));if(ut[_0x5dbf('0xa7')](_0x398326)>=_0x27ca1f['dialGlobalMaxRetry']){_0x5331ff=ut['cloneAction'](_0x398326,0x14,_0x5dbf('0xda'));rpcDb['createCustomerFinal'](_0x5331ff,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x398326[_0x5dbf('0xd9')]>=_0x27ca1f['dialAgentRejectMaxRetry']){rpcDb['createCustomerFinal'](_0x398326,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut[_0x5dbf('0xac')](_0x398326,'countagentrejectretry',_0x27ca1f[_0x5dbf('0xde')]),_0x398326[_0x5dbf('0xad')],_0x398326[_0x5dbf('0xae')]);}}break;case'ABANDONED':_0x27ca1f[_0x5dbf('0x46')]+=0x1;_0x398326[_0x5dbf('0xdf')]+=0x1;_0x398326[_0x5dbf('0xa2')]=ut['totalGlobal'](_0x398326);ut[_0x5dbf('0x93')](_0x398326,0xb,_0x5dbf('0xe0'));rpcDb[_0x5dbf('0x96')](_0x398326,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x5dbf('0xa7')](_0x398326)>=_0x27ca1f[_0x5dbf('0xa8')]){_0x5331ff=ut[_0x5dbf('0xcf')](_0x398326,0xf,'Global');rpcDb[_0x5dbf('0x99')](_0x5331ff,_0x5dbf('0xe1'));}else{if(_0x398326[_0x5dbf('0xe2')]>=_0x27ca1f['dialAbandonedMaxRety']){rpcDb['createCustomerFinal'](_0x398326,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x5dbf('0xab')](ut[_0x5dbf('0xac')](_0x398326,_0x5dbf('0xdf'),_0x27ca1f[_0x5dbf('0xe3')]),_0x398326[_0x5dbf('0xad')],_0x398326[_0x5dbf('0xae')]);}}break;case'18':_0x27ca1f['outboundUnknownCallsDay']+=0x1;_0x398326[_0x5dbf('0xe4')]+=0x1;_0x398326[_0x5dbf('0xa2')]=ut[_0x5dbf('0xa7')](_0x398326);ut['logCustomer'](_0x398326,0x12,_0x486397[_0x5dbf('0xe5')]||_0x486397[_0x5dbf('0xe6')]);ami[_0x5dbf('0x22')](_0x5dbf('0xe7'),ut[_0x5dbf('0xb5')](_0x398326,_0x5dbf('0xe8')));rpcDb[_0x5dbf('0x96')](_0x398326,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0x5dbf('0xa7')](_0x398326)>=_0x27ca1f['dialGlobalMaxRetry']){_0x5331ff=ut[_0x5dbf('0xcf')](_0x398326,0xf,_0x5dbf('0xa9'));rpcDb[_0x5dbf('0x99')](_0x5331ff,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb['createCustomerFinal'](_0x398326,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0x5dbf('0x14')][_0x486397[_0x5dbf('0xaf')]];break;case'19':_0x27ca1f['outboundUnknownCallsDay']+=0x1;_0x398326[_0x5dbf('0xa2')]=ut['totalGlobal'](_0x398326);ut[_0x5dbf('0x93')](_0x398326,0x13,_0x486397[_0x5dbf('0xe5')]||_0x486397[_0x5dbf('0xe6')]);ami['emit'](_0x5dbf('0xe7'),ut[_0x5dbf('0xb5')](_0x398326,_0x5dbf('0xe8')));rpcDb[_0x5dbf('0x96')](_0x398326,_0x5dbf('0xe9'));if(ut[_0x5dbf('0xa7')](_0x398326)>=_0x27ca1f[_0x5dbf('0xa8')]){_0x5331ff=ut['cloneAction'](_0x398326,0xf,_0x5dbf('0xa9'));rpcDb['createCustomerFinal'](_0x5331ff,_0x5dbf('0xe9'));}else{rpcDb[_0x5dbf('0x99')](_0x398326,_0x5dbf('0xe9'));}delete this['actions'][_0x486397[_0x5dbf('0xaf')]];break;default:if(_0x398326[_0x5dbf('0x74')]){ut[_0x5dbf('0x80')](_0x27ca1f,_0x5dbf('0xea'));ut[_0x5dbf('0x81')](_0x5dbf('0xeb')+_0x27ca1f['name'],_0x486397);}_0x27ca1f[_0x5dbf('0x45')]+=0x1;_0x398326['countglobal']=ut[_0x5dbf('0xa7')](_0x398326);ut[_0x5dbf('0x93')](_0x398326,0xc,_0x486397[_0x5dbf('0xe5')]||_0x486397[_0x5dbf('0xe6')]);rpcDb[_0x5dbf('0x96')](_0x398326,_0x5dbf('0xec'));if(ut['totalGlobal'](_0x398326)>=_0x27ca1f[_0x5dbf('0xa8')]){_0x5331ff=ut[_0x5dbf('0xcf')](_0x398326,0xf,_0x5dbf('0xa9'));rpcDb['createCustomerFinal'](_0x5331ff,_0x5dbf('0xed'));}else{rpcDb['createCustomerFinal'](_0x398326,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x5dbf('0x14')][_0x486397[_0x5dbf('0xaf')]];}if(!(_0x398326[_0x5dbf('0x74')]&&_0x4f4aa3==='16')){ut[_0x5dbf('0x7e')](_0x27ca1f,_0x5dbf('0xee'));logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0x398326['uniqueid'],_0x5dbf('0xb3'),_0x27ca1f[_0x5dbf('0x25')],_0x5dbf('0x71'),_0x27ca1f[_0x5dbf('0xef')]);}if(_0x4f4aa3!==_0x5dbf('0xf0')){delete this[_0x5dbf('0x14')][_0x486397[_0x5dbf('0xaf')]];delete this[_0x5dbf('0x14')][_0x486397['destlinkedid']];}}};Preview[_0x5dbf('0xe')][_0x5dbf('0xf1')]=function(_0x3e6a09,_0x1da4d8,_0xda5fa){if(_[_0x5dbf('0xf2')](_0x1da4d8)&&_0x5dbf('0xf3')!==typeof _0x1da4d8){return;}if(_[_0x5dbf('0xf2')](_0xda5fa)&&_0x5dbf('0xf3')!==typeof _0xda5fa){return;}switch(_0xda5fa[_0x5dbf('0xf4')]){case'0':ut['logAgent'](_0x3e6a09,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x3e6a09,_0x5dbf('0xf5'));break;case'3':ut['logAgent'](_0x3e6a09,0x3,_0x5dbf('0xcb'));rpcDb['createAgentHistory'](_0x3e6a09,_0x5dbf('0xf6'));break;case'5':ut[_0x5dbf('0xf7')](_0x3e6a09,0x5,_0x5dbf('0xf8'));rpcDb[_0x5dbf('0xf9')](_0x3e6a09,_0x5dbf('0xfa'));break;case'8':ut['logAgent'](_0x3e6a09,0x8,_0x5dbf('0xd2'));rpcDb[_0x5dbf('0xf9')](_0x3e6a09,_0x5dbf('0xfb'));break;case'22':ut[_0x5dbf('0xf7')](_0x3e6a09,0x16,_0x5dbf('0xfc'));rpcDb['createAgentHistory'](_0x3e6a09,_0x5dbf('0xfd'));break;default:ut[_0x5dbf('0xf7')](_0x3e6a09,0xc,_0xda5fa[_0x5dbf('0xf4')]);rpcDb[_0x5dbf('0xf9')](_0x3e6a09,'[callProgressDetectingAgent][logCongestion]');}ut[_0x5dbf('0x7e')](_0x1da4d8,_0x5dbf('0xfe'));logger[_0x5dbf('0x5d')](_0x5dbf('0xff'),_0x3e6a09[_0x5dbf('0xc2')],_0x5dbf('0xb3'),_0x1da4d8[_0x5dbf('0x25')],'originated:\x20',_0x1da4d8['originated']);delete this['actions'][_0x3e6a09[_0x5dbf('0xc2')]];};Preview[_0x5dbf('0xe')]['checkInBlack']=function(_0xc588a2,_0x488535,_0x19b748,_0x4b835e,_0x50b2be){var _0x2f7063=this;return new BPromise(function(_0x3540d0,_0x2eafe0){if(_[_0x5dbf('0x89')](_0x488535)||_[_0x5dbf('0x89')](_0x488535[_0x5dbf('0x100')])||_['isNil'](_0x488535[_0x5dbf('0x100')][_0x5dbf('0x101')])||_[_0x5dbf('0x89')](_0x488535[_0x5dbf('0x78')])){_0x2eafe0(ut[_0x5dbf('0x4f')](_0x5dbf('0x102'),_0x4b835e,_0x50b2be));return;}var _0x153401=uuid['v4']();var _0x33485d=_0x2f7063[_0x5dbf('0x12')][_0x488535['Queue'][_0x5dbf('0x25')]];var _0x10b457=_0x19b748?_0x2f7063[_0x5dbf('0x15')][_0x19b748]['id']:undefined;_0x2f7063[_0x5dbf('0x14')][_0x153401]=new Action(_0x488535,_0x33485d,_0x153401,_0x19b748,_0x10b457);var _0x380b2c=_0x2f7063[_0x5dbf('0x14')][_0x153401];_0x380b2c[_0x5dbf('0xad')]=_0x4b835e;_0x380b2c[_0x5dbf('0xae')]=_0x50b2be;_0x380b2c[_0x5dbf('0x103')]=_0x19b748;if(_[_0x5dbf('0x104')](_0xc588a2)){_0x2f7063[_0x5dbf('0x105')](_0x380b2c,_0x33485d,_0x488535,_0x19b748)[_0x5dbf('0x88')](function(_0x3f7001){logger[_0x5dbf('0x5d')](_0x5dbf('0x106'),_0x5dbf('0x107')+_0x380b2c[_0x5dbf('0x72')]+_0x5dbf('0x108')+_0x380b2c[_0x5dbf('0x109')],JSON['stringify'](_0x3f7001));ami[_0x5dbf('0x22')]('custom:agentcalled',ut[_0x5dbf('0xb5')](_0x380b2c,'called',_0x2f7063[_0x5dbf('0x12')][_0x380b2c['queue']]));_0x3540d0(ut[_0x5dbf('0x4f')](_0x5dbf('0x10a')));})[_0x5dbf('0x7c')](function(_0x4cf13a){ut[_0x5dbf('0x65')](_0x5dbf('0x10b'),_0x4cf13a);_0x2eafe0(ut[_0x5dbf('0x4f')](_0x5dbf('0x10c'),_0x4b835e,_0x50b2be));});}else{_0x33485d[_0x5dbf('0x3b')]+=0x1;ut[_0x5dbf('0x10d')](_0x380b2c);rpcDb[_0x5dbf('0x10e')](_0x380b2c,'[Blacklist][error]');delete _0x2f7063[_0x5dbf('0x14')][_0x153401];_0x2eafe0(ut[_0x5dbf('0x4f')]('Contact\x20in\x20black\x20List',_0x4b835e,_0x50b2be));}});};Preview[_0x5dbf('0xe')]['isTrunkReachable']=function(_0x4ebba4){return!_[_0x5dbf('0x89')](_0x4ebba4)&&!_[_0x5dbf('0x89')](_0x4ebba4['name'])&&!_[_0x5dbf('0x89')](_0x4ebba4['active'])&&_0x4ebba4['active']&&!_[_0x5dbf('0x89')](this['trunks'][util[_0x5dbf('0x5a')](_0x5dbf('0x10f'),_0x4ebba4[_0x5dbf('0x25')])])&&!_[_0x5dbf('0x89')](this[_0x5dbf('0x13')][util[_0x5dbf('0x5a')](_0x5dbf('0x10f'),_0x4ebba4[_0x5dbf('0x25')])][_0x5dbf('0x7a')])&&(this[_0x5dbf('0x13')][util[_0x5dbf('0x5a')](_0x5dbf('0x10f'),_0x4ebba4[_0x5dbf('0x25')])]['status']===_0x5dbf('0x110')||this[_0x5dbf('0x13')][util[_0x5dbf('0x5a')](_0x5dbf('0x10f'),_0x4ebba4[_0x5dbf('0x25')])][_0x5dbf('0x7a')]==='unmonitored');};Preview[_0x5dbf('0xe')][_0x5dbf('0x8d')]=function(_0x420e30,_0xcf0000){var _0x555530=this;return new BPromise(function(_0x13dfb8,_0x448656){_0x555530[_0x5dbf('0x111')](_0x420e30,_0xcf0000)[_0x5dbf('0x88')](function(_0x19b746){_0x13dfb8(_[_0x5dbf('0x75')](_0x19b746,[_0x5dbf('0x4f')]));})[_0x5dbf('0x7c')](function(_0x40ff7f){if(_0x40ff7f[_0x5dbf('0x112')]){rpcDb['unlockContact'](_0x420e30);}if(_0x40ff7f[_0x5dbf('0x56')]){rpcDb[_0x5dbf('0x90')](_0x420e30);}_0x448656(_['pick'](_0x40ff7f,[_0x5dbf('0x4f')]));});});};Preview[_0x5dbf('0xe')]['execRun']=function(_0x476d38,_0x1f37f7){var _0x5a3e62=this;return new BPromise(function(_0x2d5716,_0x4f4087){var _0x3be0f4,_0x32d300;rpcDb[_0x5dbf('0x113')](_0x476d38)[_0x5dbf('0x88')](function(_0x3feaf7){if(!_['isNil'](_0x3feaf7[0x0])){_0x32d300=_0x3feaf7[0x0][_0x5dbf('0x114')]?![]:!![];_0x3be0f4=_0x3feaf7[0x0][_0x5dbf('0x114')]?!![]:![];_0x3be0f4=_0x1f37f7?!![]:_0x3be0f4;}var _0x3e70a0=_0x5a3e62['validateContact'](_0x3feaf7);if(_0x3e70a0[_0x5dbf('0x115')]){rpcDb[_0x5dbf('0x116')](_[_0x5dbf('0x75')](_0x3feaf7[0x0],['VoiceQueueId','Contact.phone']))[_0x5dbf('0x88')](function(_0x50e32d){_0x5a3e62[_0x5dbf('0x117')](_0x50e32d,_0x3feaf7[0x0],_0x1f37f7,_0x32d300,_0x3be0f4)['then'](function(_0x1d7d3d){_0x2d5716(_0x1d7d3d);})[_0x5dbf('0x7c')](function(_0x51c882){_0x4f4087(_0x51c882);});})[_0x5dbf('0x7c')](function(_0x24d670){ut[_0x5dbf('0x65')]('[Preview][checkIsBlackList]',_0x24d670);_0x4f4087(ut[_0x5dbf('0x4f')](_0x5dbf('0x118'),_0x32d300,_0x3be0f4));});}else{_0x4f4087(ut[_0x5dbf('0x4f')](_0x3e70a0[_0x5dbf('0x4f')],_0x32d300,_0x3be0f4));}})[_0x5dbf('0x7c')](function(_0x24d2db){ut[_0x5dbf('0x65')](_0x5dbf('0x119'),_0x24d2db);_0x4f4087(ut[_0x5dbf('0x4f')](_0x5dbf('0x118'),![],!![]));});});};Preview[_0x5dbf('0xe')]['validateContact']=function(_0xbeb687){if(_['isNil'](_0xbeb687)||_['isEmpty'](_0xbeb687)||!_[_0x5dbf('0x89')](_0xbeb687[0x0][_0x5dbf('0x8b')])&&_['isNil'](_0xbeb687[0x0]['Agent'][_0x5dbf('0x25')])){ut['logger'](_0x5dbf('0x11a'),_0xbeb687);return{'isValid':![],'message':_0x5dbf('0x11b')};}var _0x19a6cd=this['campaignsPreview'][_0xbeb687[0x0][_0x5dbf('0x70')]['name']];_0x19a6cd['message']=_0x5dbf('0xa0');if(_[_0x5dbf('0x89')](_0x19a6cd)){ut[_0x5dbf('0x65')](_0x5dbf('0x11c'),_0x19a6cd);return{'isValid':![],'message':_0x5dbf('0x11d')};}if(!this[_0x5dbf('0x9d')](_0x19a6cd['Trunk'])){ut[_0x5dbf('0x65')](_0x5dbf('0x11e'),'campaign\x20Name:\x20'+_0x19a6cd[_0x5dbf('0x25')]+_0x5dbf('0x11f'));if(!this[_0x5dbf('0x9d')](_0x19a6cd[_0x5dbf('0x9e')])){ut['logger'](_0x5dbf('0x11e'),_0x19a6cd[_0x5dbf('0x25')]+_0x5dbf('0x120'));return{'isValid':![],'message':_0x5dbf('0x121')};}}if(!ut[_0x5dbf('0x9c')](_0x19a6cd['dialActive'])){ut[_0x5dbf('0x65')](_0x5dbf('0x122'),_0x19a6cd[_0x5dbf('0x25')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x5dbf('0x123')+_0x19a6cd['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x5dbf('0x124')};};Preview[_0x5dbf('0xe')][_0x5dbf('0x105')]=function(_0x3ec08f,_0x4af1ea,_0x40d991,_0x4a5d18){var _0x480164=this;return new BPromise(function(_0x4773d2,_0xa74f90){var _0x15cc70=_0x3ec08f[_0x5dbf('0xc2')];var _0x43f51a=_0x480164[_0x5dbf('0x9d')](_0x4af1ea[_0x5dbf('0x55')])?util[_0x5dbf('0x5a')](_0x5dbf('0x125'),_0x4af1ea[_0x5dbf('0x55')][_0x5dbf('0x25')],_[_0x5dbf('0x89')](_0x4af1ea[_0x5dbf('0x38')])?'':_0x4af1ea[_0x5dbf('0x38')]['trim']()||'',_0x4af1ea[_0x5dbf('0x126')]>0x0?_0x40d991[_0x5dbf('0x100')]['phone']['substring'](_0x4af1ea[_0x5dbf('0x126')]):_0x40d991['Contact'][_0x5dbf('0x101')]):util[_0x5dbf('0x5a')](_0x5dbf('0x125'),_[_0x5dbf('0x89')](_0x4af1ea[_0x5dbf('0x9e')])?_0x4af1ea[_0x5dbf('0x55')][_0x5dbf('0x25')]:_0x4af1ea[_0x5dbf('0x9e')][_0x5dbf('0x25')],_[_0x5dbf('0x89')](_0x4af1ea[_0x5dbf('0x38')])?'':_0x4af1ea[_0x5dbf('0x38')][_0x5dbf('0x127')]()||'',_0x4af1ea[_0x5dbf('0x126')]>0x0?_0x40d991['Contact'][_0x5dbf('0x101')][_0x5dbf('0x128')](_0x4af1ea['dialCutDigit']):_0x40d991[_0x5dbf('0x100')][_0x5dbf('0x101')]);var _0x38da0f=_0x480164[_0x5dbf('0x9d')](_0x4af1ea[_0x5dbf('0x55')])?ut[_0x5dbf('0x129')](_0x4af1ea[_0x5dbf('0x55')][_0x5dbf('0x57')],_0x4af1ea[_0x5dbf('0x35')],_0x4af1ea['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x5dbf('0x12a')](_0x4af1ea['dialOriginateCallerIdNumber'],_0x4af1ea[_0x5dbf('0x12b')]):_0x4af1ea[_0x5dbf('0x36')]):ut[_0x5dbf('0x129')](_[_0x5dbf('0x89')](_0x4af1ea['TrunkBackup'])?_0x4af1ea[_0x5dbf('0x55')][_0x5dbf('0x57')]:_0x4af1ea[_0x5dbf('0x9e')][_0x5dbf('0x57')],_0x4af1ea['dialOriginateCallerIdName'],_0x4af1ea[_0x5dbf('0x12b')]>0x0?ut[_0x5dbf('0x12a')](_0x4af1ea[_0x5dbf('0x36')],_0x4af1ea[_0x5dbf('0x12b')]):_0x4af1ea[_0x5dbf('0x36')]);if(_0x38da0f){_0x3ec08f[_0x5dbf('0x12c')]=ut[_0x5dbf('0x12d')](_0x38da0f);_0x3ec08f['originatecalleridnum']=ut[_0x5dbf('0x12e')](_0x38da0f);}var _0x48570f=ut[_0x5dbf('0x12f')](_0x4af1ea,_0x40d991,_0x43f51a,_0x38da0f,_0x15cc70,_0x3ec08f);_['merge'](_0x3ec08f,ut['toLowerVariables'](_0x48570f));_0x3ec08f['starttime']=moment()['format'](_0x5dbf('0x92'));ami[_0x5dbf('0x130')](ut[_0x5dbf('0x131')](_0x3ec08f,_0x4af1ea,_0x48570f,_0x3ec08f['activeContact'],_0x4a5d18))['then'](function(_0xe7cb4f){_0x4af1ea[_0x5dbf('0xef')]+=0x1;logger[_0x5dbf('0x5d')](_0x5dbf('0x132'),_0x15cc70,_0x5dbf('0xb3'),_0x4af1ea['name'],'originated:\x20',_0x4af1ea[_0x5dbf('0xef')]);_0x4773d2(_0xe7cb4f);})[_0x5dbf('0x7c')](function(_0x54ed76){ut['logAgent'](_0x3ec08f,0xe,_0x5dbf('0x133'));rpcDb['createAgentHistory'](_0x3ec08f,'[originateFailure][logOriginateFailure]');_0xa74f90(_0x54ed76);});});};Preview[_0x5dbf('0xe')][_0x5dbf('0x1d')]=function(_0x222be5){if(this[_0x5dbf('0x14')][_0x222be5['linkedid']]){this[_0x5dbf('0x14')][_0x222be5[_0x5dbf('0xaf')]]['channel']=_0x222be5[_0x5dbf('0x7b')];}};Preview['prototype'][_0x5dbf('0x16')]=function(_0x5e0627){var _0x471efa=this;var _0x288571=this['actions'][_0x5e0627[_0x5dbf('0x134')]];if(_0x288571){if(_0x288571[_0x5dbf('0x103')]&&this[_0x5dbf('0x15')][_0x288571['lookAgent']]){ut['logLookAgent'](_0x288571,this[_0x5dbf('0x15')][_0x288571[_0x5dbf('0x103')]][_0x5dbf('0x25')],this[_0x5dbf('0x15')][_0x288571[_0x5dbf('0x103')]]['id']);}var _0x263ac1=_[_0x5dbf('0x135')](_0x288571);_0x263ac1[_0x5dbf('0xb0')]=moment()[_0x5dbf('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1ded00=_0x471efa['campaignsPreview'][_0x288571[_0x5dbf('0x72')]];if(ut['isFailure'](_0x5e0627[_0x5dbf('0x136')])){if(_0x288571[_0x5dbf('0xad')]){rpcDb[_0x5dbf('0x137')](_0x288571[_0x5dbf('0x109')]);}if(_0x288571['activeContact']){rpcDb[_0x5dbf('0x90')](_0x288571['idContact']);}ami[_0x5dbf('0x22')](_0x5dbf('0x138'),ut[_0x5dbf('0xb5')](_0x288571,_0x5dbf('0x139'),this[_0x5dbf('0x12')][_0x288571[_0x5dbf('0x72')]]));this[_0x5dbf('0xf1')](_0x263ac1,_0x1ded00,_0x5e0627);}else{_0x288571[_0x5dbf('0x91')]=moment()[_0x5dbf('0x5a')](_0x5dbf('0x92'));ut[_0x5dbf('0xf7')](_0x263ac1,0x4,_0x5dbf('0x13a'));rpcDb[_0x5dbf('0xf9')](_0x263ac1,_0x5dbf('0x13b'));}}};Preview[_0x5dbf('0xe')][_0x5dbf('0x18')]=function(_0xdb7b07){var _0xc055e6=this;var _0x391fcf=this[_0x5dbf('0x14')][_0xdb7b07[_0x5dbf('0xaf')]];var _0x2c889c;if(_0x391fcf){_0x2c889c=this[_0x5dbf('0x12')][_0x391fcf[_0x5dbf('0x72')]];logger[_0x5dbf('0x5d')](_0x5dbf('0x13c'),_0xdb7b07[_0x5dbf('0xaf')],'\x20Queue',_0x2c889c[_0x5dbf('0x25')],_0x5dbf('0x73'),_0x2c889c[_0x5dbf('0x29')]);}if(this[_0x5dbf('0x14')][_0xdb7b07[_0x5dbf('0xaf')]]&&_0xdb7b07[_0x5dbf('0xaf')]!==_0xdb7b07['uniqueid']){if(_0xdb7b07[_0x5dbf('0x13d')]==='16'&&this[_0x5dbf('0x14')][_0xdb7b07[_0x5dbf('0xaf')]][_0x5dbf('0x74')]){this[_0x5dbf('0x13e')](_0xdb7b07,_0xdb7b07['linkedid'],_0xdb7b07[_0x5dbf('0x13d')]);}else if(this[_0x5dbf('0x14')][_0xdb7b07['linkedid']]['dialAnswer']){logger[_0x5dbf('0x5d')](_0x5dbf('0x13f'),_0xdb7b07[_0x5dbf('0xaf')],_0xdb7b07[_0x5dbf('0x13d')],_0x5dbf('0xb3'),_0x2c889c['name'],_0x5dbf('0x73'),_0x2c889c[_0x5dbf('0x29')]);this[_0x5dbf('0x13e')](_0xdb7b07,_0xdb7b07[_0x5dbf('0xaf')],_0xdb7b07[_0x5dbf('0x13d')]);}}else if(_0x391fcf&&_[_0x5dbf('0x89')](_0x391fcf[_0x5dbf('0x140')])&&_0x2c889c[_0x5dbf('0x141')]&&_0xdb7b07[_0x5dbf('0xaf')]===_0xdb7b07[_0x5dbf('0xc2')]&&_[_0x5dbf('0x89')](_0xdb7b07[_0x5dbf('0xf4')])&&_0xdb7b07[_0x5dbf('0x13d')]==='16'&&_0xdb7b07['channelstate']==='6'&&_[_0x5dbf('0xf2')](_0x391fcf[_0x5dbf('0x142')])){if(_0x391fcf['unlockAgent']){rpcDb[_0x5dbf('0x137')](_0x391fcf[_0x5dbf('0x109')]);}if(_0x391fcf[_0x5dbf('0xae')]){rpcDb[_0x5dbf('0x90')](_0x391fcf['idContact']);}_0xdb7b07[_0x5dbf('0xf4')]='22';this[_0x5dbf('0xf1')](_0x391fcf,_0x2c889c,_0xdb7b07);}else if(_0x391fcf&&_0x391fcf['transfer']){if(_0xdb7b07[_0x5dbf('0x13d')]==='16'&&this['actions'][_0xdb7b07[_0x5dbf('0xaf')]]['dialAnswer']){logger[_0x5dbf('0x5d')](_0x5dbf('0x143'),_0xdb7b07[_0x5dbf('0xaf')],_0xdb7b07[_0x5dbf('0x13d')],_0x5dbf('0xb3'),_0x2c889c[_0x5dbf('0x25')],'pTalking:\x20',_0x2c889c[_0x5dbf('0x29')]);this[_0x5dbf('0x13e')](_0xdb7b07,_0xdb7b07[_0x5dbf('0xaf')],_0xdb7b07['cause']);}else if(this[_0x5dbf('0x14')][_0xdb7b07[_0x5dbf('0xaf')]][_0x5dbf('0x74')]){logger[_0x5dbf('0x5d')](_0x5dbf('0x13f'),_0xdb7b07['linkedid'],_0xdb7b07[_0x5dbf('0x13d')],_0x5dbf('0xb3'),_0x2c889c[_0x5dbf('0x25')],'pTalking:\x20',_0x2c889c[_0x5dbf('0x29')]);this[_0x5dbf('0x13e')](_0xdb7b07,_0xdb7b07[_0x5dbf('0xaf')],_0xdb7b07[_0x5dbf('0x13d')]);}}};Preview[_0x5dbf('0xe')][_0x5dbf('0x1c')]=function(_0x378d5e){if(this['actions'][_0x378d5e[_0x5dbf('0x144')]]&&_0x378d5e[_0x5dbf('0x144')]!==_0x378d5e['destuniqueid']){this['callProgressDetectingCustomer'](_0x378d5e,_0x378d5e[_0x5dbf('0x144')],_0x378d5e[_0x5dbf('0xe6')]);}};Preview[_0x5dbf('0xe')][_0x5dbf('0x1a')]=function(_0x2e77e2){if(this[_0x5dbf('0x14')][_0x2e77e2[_0x5dbf('0xaf')]]&&_0x2e77e2[_0x5dbf('0xaf')]!==_0x2e77e2[_0x5dbf('0xc2')]&&!this[_0x5dbf('0x14')][_0x2e77e2[_0x5dbf('0xaf')]][_0x5dbf('0x74')]){if(_0x2e77e2[_0x5dbf('0x13d')]==='1'){this[_0x5dbf('0x13e')](_0x2e77e2,_0x2e77e2[_0x5dbf('0xaf')],_0x2e77e2[_0x5dbf('0x13d')]);}}};Preview['prototype'][_0x5dbf('0x145')]=function(_0x56f84c,_0x334560,_0x1c8bc0){if(this[_0x5dbf('0x14')][_0x56f84c]){if(_[_0x5dbf('0x89')](this[_0x5dbf('0x14')][_0x56f84c][_0x5dbf('0x146')])){this['actions'][_0x56f84c][_0x5dbf('0x146')]={};}this[_0x5dbf('0x14')][_0x56f84c][_0x5dbf('0x146')][_0x334560]=_0x1c8bc0;}};Preview[_0x5dbf('0xe')][_0x5dbf('0x1f')]=function(_0x41b2f3){try{if(!_['isNil'](_0x41b2f3)){if(ut['filterKey'](_['keys'](_0x41b2f3[_0x5dbf('0x147')])[0x0])){this[_0x5dbf('0x145')](_0x41b2f3[_0x5dbf('0xc2')],_['keys'](_0x41b2f3[_0x5dbf('0x147')])[0x0],_0x41b2f3[_0x5dbf('0x148')]);}}}catch(_0x137d00){logger[_0x5dbf('0x149')](_0x5dbf('0x14a'),util['inspect'](_0x137d00,{'showHidden':![],'depth':null}));}};Preview[_0x5dbf('0xe')]['syncAttendedTransfer']=function(_0x1573e3){if(_0x1573e3){if(this[_0x5dbf('0x14')][_0x1573e3['transfertargetlinkedid']]){this[_0x5dbf('0x14')][_0x1573e3[_0x5dbf('0x14b')]][_0x5dbf('0x142')]=!![];}}};Preview[_0x5dbf('0xe')][_0x5dbf('0x14c')]=function(_0x1a2fe4){if(_0x1a2fe4){if(this[_0x5dbf('0x14')][_0x1a2fe4[_0x5dbf('0x14d')]]){this[_0x5dbf('0x14')][_0x1a2fe4['transfererlinkedid']][_0x5dbf('0x142')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x723e=['variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','isFailure','response','idContact','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','transfertargetlinkedid','transfer','syncBlindTransfer','transfererlinkedid','exports','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','clockClearZombieChannels','hasOwnProperty','dialMethod','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','clearZombieChannel','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','agentReadyId','then','isNil','length','scheduledat','dialRecallMeTimeout','Agent','run','logger2','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','responsetime','answertime','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','talktime','[syncHangup][talking][decrement]','BUSY','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','scheduledAt','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','countagentrejectretry','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','countabandonedetry','dialAbandonedMaxRety','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','countmachineretry','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','Contact\x20is\x20undefined','Queue','agents','lookAgent','isEmpty','execCall','Queue:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlockContact','disableContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','trim','substring','dialCutDigit','phone','SIP/%s/%s%s','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','merge'];(function(_0x13d3e8,_0x37c385){var _0x142ce3=function(_0x5c1363){while(--_0x5c1363){_0x13d3e8['push'](_0x13d3e8['shift']());}};_0x142ce3(++_0x37c385);}(_0x723e,0x179));var _0xe723=function(_0x593f3c,_0x1e4ba1){_0x593f3c=_0x593f3c-0x0;var _0x16d9dc=_0x723e[_0x593f3c];return _0x16d9dc;};'use strict';var util=require('util');var _=require(_0xe723('0x0'));var BPromise=require(_0xe723('0x1'));var uuid=require(_0xe723('0x2'));var moment=require(_0xe723('0x3'));var md5=require(_0xe723('0x4'));var Redis=require(_0xe723('0x5'));var config=require(_0xe723('0x6'));var logger=require(_0xe723('0x7'))(_0xe723('0x8'));var loggerAction=require(_0xe723('0x7'))('actionPreview');var ami=require(_0xe723('0x9'));var rpcDb=require(_0xe723('0xa'));var Action=require(_0xe723('0xb'));var ut=require(_0xe723('0xc'));config[_0xe723('0xd')]=_[_0xe723('0xe')](config[_0xe723('0xd')],{'host':_0xe723('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe723('0xd')]));var Sequence=function(){};Sequence[_0xe723('0x10')][_0xe723('0x11')]=function(_0x5a43fb){this[_0xe723('0x12')]=this[_0xe723('0x12')]?this[_0xe723('0x12')]['finally'](_0x5a43fb):_0x5a43fb();};function Preview(_0x146098){this[_0xe723('0x13')]=new Sequence();this[_0xe723('0x14')]=_0x146098[_0xe723('0x15')];this[_0xe723('0x16')]=_0x146098['trunks'];this[_0xe723('0x17')]={};this['agents']=_0x146098['agents'];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this[_0xe723('0x18')][_0xe723('0x19')](this));ami['on'](_0xe723('0x1a'),this[_0xe723('0x1b')][_0xe723('0x19')](this));ami['on']('hanguprequest',this[_0xe723('0x1c')][_0xe723('0x19')](this));ami['on'](_0xe723('0x1d'),this[_0xe723('0x1e')][_0xe723('0x19')](this));ami['on'](_0xe723('0x1f'),this[_0xe723('0x20')][_0xe723('0x19')](this));ami['on'](_0xe723('0x21'),this[_0xe723('0x22')][_0xe723('0x19')](this));ami['on'](_0xe723('0x23'),this[_0xe723('0x24')][_0xe723('0x19')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xe723('0x19')](this));this[_0xe723('0x25')](this['campaignsPreview']);}function emit(_0x28caca,_0x2762e2,_0x5a8c73){io['to'](_0x28caca)[_0xe723('0x26')](_0x2762e2,_0x5a8c73);}function emitCampaignPreview(_0x52fe6e){if(_0x52fe6e[_0xe723('0x27')]===_0xe723('0x28')){var _0x3b82b2={'id':_0x52fe6e['id'],'name':_0x52fe6e[_0xe723('0x29')],'strategy':_0x52fe6e[_0xe723('0x2a')],'answered':_0x52fe6e[_0xe723('0x2b')],'available':_0x52fe6e[_0xe723('0x2c')],'loggedIn':_0x52fe6e[_0xe723('0x2d')],'pTalking':_0x52fe6e[_0xe723('0x2e')],'sumBillable':_0x52fe6e[_0xe723('0x2f')],'sumDuration':_0x52fe6e[_0xe723('0x30')],'sumHoldTime':_0x52fe6e[_0xe723('0x31')]||0x0,'talking':_0x52fe6e['talking'],'total':_0x52fe6e[_0xe723('0x32')],'type':_0x52fe6e['type'],'unmanaged':_0x52fe6e[_0xe723('0x33')],'abandoned':_0x52fe6e[_0xe723('0x34')],'waiting':_0x52fe6e[_0xe723('0x35')],'loggedInDb':_0x52fe6e[_0xe723('0x36')],'dialActive':_0x52fe6e[_0xe723('0x37')],'dialMethod':_0x52fe6e['dialMethod'],'dialOriginateCallerIdName':_0x52fe6e[_0xe723('0x38')],'dialOriginateCallerIdNumber':_0x52fe6e['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x52fe6e['dialOriginateTimeout'],'dialPrefix':_0x52fe6e[_0xe723('0x39')],'outboundAnswerAgiCallsDay':_0x52fe6e['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x52fe6e[_0xe723('0x3a')],'outboundBlacklistCallsDay':_0x52fe6e[_0xe723('0x3b')],'outboundBusyCallsDay':_0x52fe6e[_0xe723('0x3c')],'outboundCongestionCallsDay':_0x52fe6e['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x52fe6e[_0xe723('0x3d')],'outboundDropCallsDayCallersExit':_0x52fe6e[_0xe723('0x3e')],'outboundDropCallsDayTimeout':_0x52fe6e['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x52fe6e[_0xe723('0x3f')],'outboundNoSuchCallsDay':_0x52fe6e['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x52fe6e['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x52fe6e[_0xe723('0x40')],'outboundRejectCallsDay':_0x52fe6e[_0xe723('0x41')],'outboundUnknownCallsDay':_0x52fe6e[_0xe723('0x42')],'outboundAbandonedCallsDay':_0x52fe6e[_0xe723('0x43')],'predictiveIntervalAnsweredCalls':_0x52fe6e['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x52fe6e['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x52fe6e[_0xe723('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x52fe6e['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x52fe6e[_0xe723('0x45')],'predictiveIntervalErlangCalls':_0x52fe6e[_0xe723('0x46')],'predictiveIntervalErlangCallsDroppedCalls':_0x52fe6e[_0xe723('0x47')],'predictiveIntervalHitRate':_0x52fe6e[_0xe723('0x48')],'predictiveIntervalMultiplicativeFactor':_0x52fe6e[_0xe723('0x49')],'predictiveIntervalPauses':_0x52fe6e[_0xe723('0x4a')],'predictiveIntervalAvailable':_0x52fe6e[_0xe723('0x4b')],'predictiveIntervalTotalCalls':_0x52fe6e[_0xe723('0x4c')],'message':_0x52fe6e[_0xe723('0x4d')],'originated':_0x52fe6e[_0xe723('0x4e')],'erlangCalls':_0x52fe6e[_0xe723('0x4f')],'erlangCallToSecond':_0x52fe6e[_0xe723('0x50')],'erlangAbandonmentRate':_0x52fe6e[_0xe723('0x51')],'erlangBusyFactor':_0x52fe6e[_0xe723('0x52')],'startPredictive':_0x52fe6e['startPredictive'],'startProgressive':_0x52fe6e[_0xe723('0x53')]};if(_0x52fe6e['Trunk']){_0x3b82b2[_0xe723('0x54')]={'id':_0x52fe6e[_0xe723('0x54')]['id'],'name':_0x52fe6e['Trunk']['name'],'active':_0x52fe6e[_0xe723('0x54')][_0xe723('0x55')],'callerid':_0x52fe6e[_0xe723('0x54')][_0xe723('0x56')]};}if(_0x52fe6e[_0xe723('0x57')]){_0x3b82b2[_0xe723('0x57')]={'id':_0x52fe6e['Interval']['id'],'name':_0x52fe6e[_0xe723('0x57')][_0xe723('0x29')]};}var _0x1dc86f=md5(JSON[_0xe723('0x58')](_0x3b82b2));if(_0x52fe6e[_0xe723('0x4')]!==_0x1dc86f){_0x52fe6e[_0xe723('0x4')]=_0x1dc86f;emit(util[_0xe723('0x59')](_0xe723('0x5a'),_0x3b82b2[_0xe723('0x29')]),_0xe723('0x5b'),_0x3b82b2);}}}function emitVoiceQueueChannelRemove(_0x9918d9){logger[_0xe723('0x5c')](_0xe723('0x5d'),JSON[_0xe723('0x58')](_0x9918d9));emit(util[_0xe723('0x59')](_0xe723('0x5a'),_0x9918d9['name']),_0xe723('0x5e'),_0x9918d9);io[_0xe723('0x26')](_0xe723('0x5f'),_0x9918d9);}function notSendMessagesQueue(_0x3103de){if(_0x3103de['sendMessageOneNotActive']){if(_0x3103de['originated']===0x0&&_0x3103de[_0xe723('0x2e')]===0x0){_0x3103de[_0xe723('0x60')]=![];_0x3103de[_0xe723('0x2c')]=0x0;_0x3103de[_0xe723('0x61')]=0x0;_0x3103de['message']='NOT_ACTIVE';ut[_0xe723('0x62')](_0xe723('0x63'),_0x3103de[_0xe723('0x29')]+_0xe723('0x64'));}else{_0x3103de[_0xe723('0x4d')]=_0xe723('0x65');ut[_0xe723('0x62')](_0xe723('0x63'),_0x3103de[_0xe723('0x29')]+'\x20is\x20disactive');}emitCampaignPreview(_0x3103de);}}Preview['prototype'][_0xe723('0x25')]=function(){var _0x5bf636=this;setInterval(function(){_0x5bf636['syncCampaigns']();},0x7cf);};Preview[_0xe723('0x10')]['syncCampaigns']=function(){var _0x36272=this[_0xe723('0x14')];this[_0xe723('0x66')]+=0x1;for(var _0x2c2643 in _0x36272){if(_0x36272[_0xe723('0x67')](_0x2c2643)&&(_0x36272[_0x2c2643][_0xe723('0x68')]===_0xe723('0x8')||_0x36272[_0x2c2643]['dialMethod']==='booked')&&_0x36272[_0x2c2643][_0xe723('0x27')]==='outbound'){if(this[_0xe723('0x66')]>0x7){this['clockClearZombieChannels']=0x0;this[_0xe723('0x69')]();}}if(_0x36272[_0xe723('0x67')](_0x2c2643)&&_0x36272[_0x2c2643][_0xe723('0x68')]===_0xe723('0x8')&&_0x36272[_0x2c2643][_0xe723('0x27')]===_0xe723('0x28')){if(_0x36272[_0x2c2643][_0xe723('0x37')]){this[_0xe723('0x6a')](_0x36272[_0x2c2643]);if(_0x36272[_0x2c2643][_0xe723('0x6b')])this['recallMe'](_0x36272[_0x2c2643]);}else{notSendMessagesQueue(_0x36272[_0x2c2643]);}}}};Preview['prototype'][_0xe723('0x6c')]=function(_0x23425b){var _0x7baf6f=this;this['sequence']['enqueue'](function(){if(!_['isNil'](_0x7baf6f[_0xe723('0x17')][_0x23425b])){loggerAction[_0xe723('0x5c')](_0xe723('0x6d'),_0x23425b,'Queue',_0x7baf6f[_0xe723('0x17')][_0x23425b][_0xe723('0x6e')],_0xe723('0x6f'),JSON[_0xe723('0x58')](_0x7baf6f[_0xe723('0x14')][_0x7baf6f['actions'][_0x23425b][_0xe723('0x6e')]]['originated']),_0xe723('0x70'),JSON['stringify'](_0x7baf6f['campaignsPreview'][_0x7baf6f[_0xe723('0x17')][_0x23425b][_0xe723('0x6e')]][_0xe723('0x2e')]),JSON['stringify'](_0x7baf6f[_0xe723('0x17')][_0x23425b]['dialAnswer']),JSON[_0xe723('0x58')](_[_0xe723('0x71')](_0x7baf6f[_0xe723('0x17')][_0x23425b],[_0xe723('0x72'),_0xe723('0x73'),_0xe723('0x74'),_0xe723('0x75')])));return ami[_0xe723('0x76')]({'action':_0xe723('0x77'),'channel':_0x7baf6f['actions'][_0x23425b][_0xe723('0x78')]})[_0xe723('0x79')](function(_0x52def8){if(_0x52def8[_0xe723('0x4d')]===_0xe723('0x7a')){setTimeout(function(){if(_0x7baf6f['actions'][_0x23425b]){ut[_0xe723('0x7b')](_0x7baf6f['campaignsPreview'][_0x7baf6f['actions'][_0x23425b][_0xe723('0x6e')]],_0xe723('0x7c'));if(_0x7baf6f[_0xe723('0x17')][_0x23425b][_0xe723('0x7d')]===!![]){ut[_0xe723('0x7e')](_0x7baf6f['campaignsPreview'][_0x7baf6f[_0xe723('0x17')][_0x23425b][_0xe723('0x6e')]],_0xe723('0x7c'));ut[_0xe723('0x7f')](_0xe723('0x80')+_0x23425b,_0x7baf6f[_0xe723('0x17')][_0x23425b][_0xe723('0x6e')]);}ut[_0xe723('0x7f')](_0xe723('0x81')+_0x23425b,_0x7baf6f[_0xe723('0x17')][_0x23425b]['queue']);delete _0x7baf6f[_0xe723('0x17')][_0x23425b];}},0x2328);}});}});};Preview[_0xe723('0x10')][_0xe723('0x69')]=function(){var _0x4672be=this;loggerAction['info'](_0xe723('0x82'),_[_0xe723('0x83')](this['actions']));for(var _0x42e551 in this[_0xe723('0x17')]){if(_0x4672be[_0xe723('0x17')][_0xe723('0x67')](_0x42e551)){_0x4672be[_0xe723('0x6c')](_0x42e551);}}};Preview[_0xe723('0x10')]['recallMe']=function(_0x3a3dd7){var _0x508fda=this;rpcDb['getContactRecallMe'](_0x3a3dd7['id'],ut[_0xe723('0x84')](this['agents']))[_0xe723('0x85')](function(_0x2ef56d){if(!_[_0xe723('0x86')](_0x2ef56d)){for(var _0x45b93b=0x0;_0x45b93b<_0x2ef56d[_0xe723('0x87')];_0x45b93b+=0x1){if(ut['getDiff'](_0x2ef56d[_0x45b93b][_0xe723('0x88')])<_0x3a3dd7[_0xe723('0x89')]*0x3c){if(_0x2ef56d[_0x45b93b][_0xe723('0x8a')]&&!_0x2ef56d[_0x45b93b]['Agent']['voicePause']){_0x508fda[_0xe723('0x8b')](_0x2ef56d[_0x45b93b]['id'])[_0xe723('0x85')](ut[_0xe723('0x8c')]('[RecallMe]'))[_0xe723('0x79')](ut[_0xe723('0x8c')]('[RecallMe]'));}else{rpcDb['disableContact'](_0x2ef56d[_0x45b93b]['id']);}}else{var _0x2556bf=new Action(_0x2ef56d[_0x45b93b],_0x3a3dd7);_0x2556bf[_0xe723('0x8d')]=moment()[_0xe723('0x59')](_0xe723('0x8e'));_0x3a3dd7[_0xe723('0x40')]+=0x1;ut[_0xe723('0x8f')](_0x2556bf,0x17,_0xe723('0x90'));if(_0x3a3dd7['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x2ef56d[_0x45b93b]));rpcDb[_0xe723('0x91')](_0x2556bf,_0xe723('0x92'));}else{ut['logCustomer'](_0x2556bf,0x16,_0xe723('0x93'));rpcDb[_0xe723('0x91')](_0x2556bf,_0xe723('0x94'));rpcDb['createCustomerFinal'](_0x2556bf,'[HistoryRecallClose]');}}}}})[_0xe723('0x79')](ut[_0xe723('0x8c')](_0xe723('0x95')));};Preview['prototype']['setMessage']=function(_0x2d0ab5){_0x2d0ab5['sendMessageOneNotActive']=!![];if(ut[_0xe723('0x96')](_0x2d0ab5[_0xe723('0x2d')])){_0x2d0ab5[_0xe723('0x4d')]=_0xe723('0x97');}else if(!ut[_0xe723('0x98')](_0x2d0ab5[_0xe723('0x37')])){_0x2d0ab5[_0xe723('0x4d')]=_0xe723('0x99');}else if(!this[_0xe723('0x9a')](_0x2d0ab5['Trunk'])){if(!this[_0xe723('0x9a')](_0x2d0ab5[_0xe723('0x9b')])){_0x2d0ab5[_0xe723('0x4d')]=_0xe723('0x9c');}else{_0x2d0ab5[_0xe723('0x4d')]=_0xe723('0x9d');}}else{_0x2d0ab5['message']=_0xe723('0x9d');}emitCampaignPreview(_0x2d0ab5);};Preview[_0xe723('0x10')]['callProgressDetectingCustomer']=function(_0x57ecba,_0xcd1343,_0x2d5721){var _0xf91e1a=this;var _0x4fa5b2=this['actions'][_0xcd1343];var _0x3a92ac=this['campaignsPreview'][_0x4fa5b2[_0xe723('0x6e')]];var _0xbb0ff5;if(_0x3a92ac){switch(_0x2d5721){case'1':_0x3a92ac[_0xe723('0x9e')]+=0x1;_0x4fa5b2[_0xe723('0x9f')]+=0x1;_0x4fa5b2[_0xe723('0xa0')]=ut['totalGlobal'](_0x4fa5b2);ut['logCustomer'](_0x4fa5b2,0x0,_0xe723('0xa1'));ami[_0xe723('0x26')](_0xe723('0xa2'),ut['buildObj'](_0x4fa5b2,_0xe723('0xa3')));rpcDb['createCustomerHistory'](_0x4fa5b2,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0xe723('0xa4')](_0x4fa5b2)>=_0x3a92ac[_0xe723('0xa5')]){_0xbb0ff5=ut[_0xe723('0xa6')](_0x4fa5b2,0xf,_0xe723('0xa7'));rpcDb[_0xe723('0xa8')](_0xbb0ff5,_0xe723('0xa9'));}else{if(_0x4fa5b2['countnosuchnumberretry']>=_0x3a92ac[_0xe723('0xaa')]){rpcDb['createCustomerFinal'](_0x4fa5b2,_0xe723('0xa9'));}else{rpcDb[_0xe723('0xab')](ut['scheduledAt'](_0x4fa5b2,_0xe723('0x9f'),_0x3a92ac[_0xe723('0xac')]),_0x4fa5b2[_0xe723('0xad')],_0x4fa5b2[_0xe723('0xae')]);}}delete this[_0xe723('0x17')][_0x57ecba[_0xe723('0xaf')]];break;case _0xe723('0xb0'):var _0x3d8221=moment()[_0xe723('0x59')](_0xe723('0x8e'));_0x4fa5b2[_0xe723('0xb1')]=_0x3d8221;_0x4fa5b2[_0xe723('0xb2')]=_0x3d8221;_0x4fa5b2[_0xe723('0x7d')]=!![];_0x3a92ac[_0xe723('0x2e')]+=0x1;logger[_0xe723('0x5c')]('[syncHangup][talking][increment]',_0x4fa5b2[_0xe723('0xb3')],_0xe723('0xb4'),_0x3a92ac[_0xe723('0x29')],'pTalking:\x20',_0x3a92ac[_0xe723('0x2e')]);ami[_0xe723('0x26')](_0xe723('0xb5'),ut[_0xe723('0xb6')](_0x4fa5b2,_0xe723('0xb7'),this[_0xe723('0x14')][_0x4fa5b2[_0xe723('0x6e')]]));if(_0x3a92ac[_0xe723('0xb8')]){ami[_0xe723('0x26')](_0xe723('0xb9'),ut[_0xe723('0xba')](_0x4fa5b2));}break;case'16':ami[_0xe723('0x26')](_0xe723('0xbb'),ut[_0xe723('0xb6')](_0x4fa5b2,_0xe723('0xbc'),this[_0xe723('0x14')][_0x4fa5b2[_0xe723('0x6e')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x4fa5b2,_0xe723('0xbc')));_0x3a92ac[_0xe723('0x3a')]+=0x1;_0x3a92ac['total']+=0x1;_0x3a92ac['answered']+=0x1;ut[_0xe723('0x7e')](_0x3a92ac,_0xe723('0xbd'));_0x4fa5b2['countglobal']=ut[_0xe723('0xa4')](_0x4fa5b2);ut[_0xe723('0x8f')](_0x4fa5b2,0x4,'Answer');rpcDb['createCustomerHistory'](_0x4fa5b2,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xe723('0xa8')](_0x4fa5b2,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x4fa5b2);_0x3a92ac['sumDuration']+=_0x4fa5b2[_0xe723('0xbe')];_0x3a92ac[_0xe723('0x2f')]+=_0x4fa5b2[_0xe723('0xbe')];logger[_0xe723('0x5c')](_0xe723('0xbf'),_0x4fa5b2[_0xe723('0xb3')],_0xe723('0xb4'),_0x3a92ac['name'],_0xe723('0x70'),_0x3a92ac[_0xe723('0x2e')]);delete this[_0xe723('0x17')][_0x57ecba[_0xe723('0xaf')]];break;case _0xe723('0xc0'):_0x3a92ac[_0xe723('0x3c')]+=0x1;_0x4fa5b2['countbusyretry']+=0x1;_0x4fa5b2['countglobal']=ut[_0xe723('0xa4')](_0x4fa5b2);ut['logCustomer'](_0x4fa5b2,0x5,'Busy');ami[_0xe723('0x26')](_0xe723('0xc1'),ut['buildObj'](_0x4fa5b2,_0xe723('0xc2')));rpcDb[_0xe723('0x91')](_0x4fa5b2,_0xe723('0xc3'));if(ut['totalGlobal'](_0x4fa5b2)>=_0x3a92ac['dialGlobalMaxRetry']){_0xbb0ff5=ut[_0xe723('0xa6')](_0x4fa5b2,0xf,_0xe723('0xa7'));rpcDb[_0xe723('0xa8')](_0xbb0ff5,_0xe723('0xc4'));}else{if(_0x4fa5b2[_0xe723('0xc5')]>=_0x3a92ac[_0xe723('0xc6')]){rpcDb[_0xe723('0xa8')](_0x4fa5b2,_0xe723('0xc3'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x4fa5b2,'countbusyretry',_0x3a92ac[_0xe723('0xc7')]),_0x4fa5b2[_0xe723('0xad')],_0x4fa5b2[_0xe723('0xae')]);}}break;case _0xe723('0xc8'):_0x3a92ac[_0xe723('0x3f')]+=0x1;_0x4fa5b2['countnoanswerretry']+=0x1;_0x4fa5b2['countglobal']=ut['totalGlobal'](_0x4fa5b2);ut[_0xe723('0x8f')](_0x4fa5b2,0x3,_0xe723('0xc9'));ami[_0xe723('0x26')](_0xe723('0xca'),ut['buildObj'](_0x4fa5b2,'noanswer'));rpcDb['createCustomerHistory'](_0x4fa5b2,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0xe723('0xa4')](_0x4fa5b2)>=_0x3a92ac['dialGlobalMaxRetry']){_0xbb0ff5=ut[_0xe723('0xa6')](_0x4fa5b2,0xf,'Global');rpcDb['createCustomerFinal'](_0xbb0ff5,_0xe723('0xcb'));}else{if(_0x4fa5b2[_0xe723('0xcc')]>=_0x3a92ac[_0xe723('0xcd')]){rpcDb[_0xe723('0xa8')](_0x4fa5b2,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xe723('0xab')](ut[_0xe723('0xce')](_0x4fa5b2,_0xe723('0xcc'),_0x3a92ac[_0xe723('0xcf')]),_0x4fa5b2[_0xe723('0xad')],_0x4fa5b2[_0xe723('0xae')]);}}break;case _0xe723('0xd0'):_0x3a92ac[_0xe723('0xd1')]+=0x1;_0x4fa5b2[_0xe723('0xd2')]+=0x1;_0x4fa5b2[_0xe723('0xa0')]=ut[_0xe723('0xa4')](_0x4fa5b2);ut[_0xe723('0x8f')](_0x4fa5b2,0x8,_0xe723('0xd3'));ami[_0xe723('0x26')](_0xe723('0xd4'),ut[_0xe723('0xb6')](_0x4fa5b2,_0xe723('0xd5')));rpcDb[_0xe723('0x91')](_0x4fa5b2,_0xe723('0xd6'));if(ut[_0xe723('0xa4')](_0x4fa5b2)>=_0x3a92ac[_0xe723('0xa5')]){_0xbb0ff5=ut['cloneAction'](_0x4fa5b2,0xf,_0xe723('0xa7'));rpcDb['createCustomerFinal'](_0xbb0ff5,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x4fa5b2[_0xe723('0xd2')]>=_0x3a92ac[_0xe723('0xd7')]){rpcDb[_0xe723('0xa8')](_0x4fa5b2,_0xe723('0xd6'));}else{rpcDb['rescheduleContact'](ut[_0xe723('0xce')](_0x4fa5b2,'countcongestionretry',_0x3a92ac[_0xe723('0xc7')]),_0x4fa5b2[_0xe723('0xad')],_0x4fa5b2[_0xe723('0xae')]);}}break;case'CANCEL':_0x3a92ac[_0xe723('0x41')]+=0x1;_0x4fa5b2[_0xe723('0xd8')]+=0x1;_0x4fa5b2[_0xe723('0xa0')]=ut[_0xe723('0xa4')](_0x4fa5b2);ut['logCustomer'](_0x4fa5b2,0x14,_0xe723('0xd9'));ami['emit']('custom:agentreject',ut['buildObj'](_0x4fa5b2,'agentreject'));rpcDb['createCustomerHistory'](_0x4fa5b2,'[syncHangupRequest][logAgentReject]');if(ut['totalGlobal'](_0x4fa5b2)>=_0x3a92ac[_0xe723('0xa5')]){_0xbb0ff5=ut[_0xe723('0xa6')](_0x4fa5b2,0x14,_0xe723('0xd9'));rpcDb['createCustomerFinal'](_0xbb0ff5,_0xe723('0xda'));}else{if(_0x4fa5b2[_0xe723('0xd8')]>=_0x3a92ac[_0xe723('0xdb')]){rpcDb['createCustomerFinal'](_0x4fa5b2,_0xe723('0xda'));}else{rpcDb['rescheduleContact'](ut[_0xe723('0xce')](_0x4fa5b2,_0xe723('0xd8'),_0x3a92ac[_0xe723('0xdc')]),_0x4fa5b2[_0xe723('0xad')],_0x4fa5b2[_0xe723('0xae')]);}}break;case _0xe723('0xdd'):_0x3a92ac[_0xe723('0x43')]+=0x1;_0x4fa5b2[_0xe723('0xde')]+=0x1;_0x4fa5b2[_0xe723('0xa0')]=ut[_0xe723('0xa4')](_0x4fa5b2);ut[_0xe723('0x8f')](_0x4fa5b2,0xb,_0xe723('0xdf'));rpcDb[_0xe723('0x91')](_0x4fa5b2,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0xe723('0xa4')](_0x4fa5b2)>=_0x3a92ac[_0xe723('0xa5')]){_0xbb0ff5=ut[_0xe723('0xa6')](_0x4fa5b2,0xf,_0xe723('0xa7'));rpcDb['createCustomerFinal'](_0xbb0ff5,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x4fa5b2[_0xe723('0xe0')]>=_0x3a92ac[_0xe723('0xe1')]){rpcDb['createCustomerFinal'](_0x4fa5b2,_0xe723('0xe2'));}else{rpcDb[_0xe723('0xab')](ut['scheduledAt'](_0x4fa5b2,_0xe723('0xde'),_0x3a92ac[_0xe723('0xe3')]),_0x4fa5b2[_0xe723('0xad')],_0x4fa5b2[_0xe723('0xae')]);}}break;case'18':_0x3a92ac[_0xe723('0x42')]+=0x1;_0x4fa5b2[_0xe723('0xe4')]+=0x1;_0x4fa5b2[_0xe723('0xa0')]=ut[_0xe723('0xa4')](_0x4fa5b2);ut[_0xe723('0x8f')](_0x4fa5b2,0x12,_0x57ecba['cause-txt']||_0x57ecba['dialstatus']);ami[_0xe723('0x26')](_0xe723('0xe5'),ut[_0xe723('0xb6')](_0x4fa5b2,_0xe723('0xe6')));rpcDb['createCustomerHistory'](_0x4fa5b2,_0xe723('0xe7'));if(ut['totalGlobal'](_0x4fa5b2)>=_0x3a92ac[_0xe723('0xa5')]){_0xbb0ff5=ut[_0xe723('0xa6')](_0x4fa5b2,0xf,_0xe723('0xa7'));rpcDb[_0xe723('0xa8')](_0xbb0ff5,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xe723('0xa8')](_0x4fa5b2,_0xe723('0xe7'));}delete this[_0xe723('0x17')][_0x57ecba['linkedid']];break;case'19':_0x3a92ac[_0xe723('0x42')]+=0x1;_0x4fa5b2[_0xe723('0xa0')]=ut[_0xe723('0xa4')](_0x4fa5b2);ut['logCustomer'](_0x4fa5b2,0x13,_0x57ecba[_0xe723('0xe8')]||_0x57ecba[_0xe723('0xe9')]);ami[_0xe723('0x26')](_0xe723('0xe5'),ut[_0xe723('0xb6')](_0x4fa5b2,_0xe723('0xe6')));rpcDb[_0xe723('0x91')](_0x4fa5b2,_0xe723('0xea'));if(ut['totalGlobal'](_0x4fa5b2)>=_0x3a92ac[_0xe723('0xa5')]){_0xbb0ff5=ut[_0xe723('0xa6')](_0x4fa5b2,0xf,_0xe723('0xa7'));rpcDb[_0xe723('0xa8')](_0xbb0ff5,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xe723('0xa8')](_0x4fa5b2,_0xe723('0xea'));}delete this[_0xe723('0x17')][_0x57ecba[_0xe723('0xaf')]];break;default:if(_0x4fa5b2[_0xe723('0x7d')]){ut['decrementTalkink'](_0x3a92ac,_0xe723('0xeb'));ut[_0xe723('0x7f')](_0xe723('0xec')+_0x3a92ac[_0xe723('0x29')],_0x57ecba);}_0x3a92ac[_0xe723('0x42')]+=0x1;_0x4fa5b2[_0xe723('0xa0')]=ut[_0xe723('0xa4')](_0x4fa5b2);ut[_0xe723('0x8f')](_0x4fa5b2,0xc,_0x57ecba[_0xe723('0xe8')]||_0x57ecba[_0xe723('0xe9')]);rpcDb['createCustomerHistory'](_0x4fa5b2,'[callProgressDetectingCustomer][logUnknown]');if(ut['totalGlobal'](_0x4fa5b2)>=_0x3a92ac[_0xe723('0xa5')]){_0xbb0ff5=ut[_0xe723('0xa6')](_0x4fa5b2,0xf,_0xe723('0xa7'));rpcDb['createCustomerFinal'](_0xbb0ff5,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb['createCustomerFinal'](_0x4fa5b2,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x57ecba[_0xe723('0xaf')]];}if(!(_0x4fa5b2[_0xe723('0x7d')]&&_0x2d5721==='16')){ut[_0xe723('0x7b')](_0x3a92ac,_0xe723('0xed'));logger[_0xe723('0x5c')](_0xe723('0xee'),_0x4fa5b2[_0xe723('0xb3')],_0xe723('0xb4'),_0x3a92ac[_0xe723('0x29')],'originated:\x20',_0x3a92ac[_0xe723('0x4e')]);}if(_0x2d5721!=='ANSWER'){delete this[_0xe723('0x17')][_0x57ecba[_0xe723('0xaf')]];delete this[_0xe723('0x17')][_0x57ecba['destlinkedid']];}}};Preview['prototype'][_0xe723('0xef')]=function(_0x4dc764,_0x5adb50,_0x361430){if(_[_0xe723('0xf0')](_0x5adb50)&&_0xe723('0xf1')!==typeof _0x5adb50){return;}if(_[_0xe723('0xf0')](_0x361430)&&_0xe723('0xf1')!==typeof _0x361430){return;}switch(_0x361430[_0xe723('0xf2')]){case'0':ut[_0xe723('0xf3')](_0x4dc764,0x0,_0xe723('0xa1'));rpcDb[_0xe723('0xf4')](_0x4dc764,_0xe723('0xf5'));break;case'3':ut[_0xe723('0xf3')](_0x4dc764,0x3,'NoAnswer');rpcDb['createAgentHistory'](_0x4dc764,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xe723('0xf3')](_0x4dc764,0x5,'Busy');rpcDb[_0xe723('0xf4')](_0x4dc764,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xe723('0xf3')](_0x4dc764,0x8,_0xe723('0xd3'));rpcDb['createAgentHistory'](_0x4dc764,_0xe723('0xf6'));break;case'22':ut[_0xe723('0xf3')](_0x4dc764,0x16,_0xe723('0xf7'));rpcDb[_0xe723('0xf4')](_0x4dc764,_0xe723('0xf8'));break;default:ut[_0xe723('0xf3')](_0x4dc764,0xc,_0x361430[_0xe723('0xf2')]);rpcDb[_0xe723('0xf4')](_0x4dc764,_0xe723('0xf6'));}ut['updateOriginated'](_0x5adb50,_0xe723('0xf9'));logger[_0xe723('0x5c')](_0xe723('0xfa'),_0x4dc764[_0xe723('0xb3')],_0xe723('0xb4'),_0x5adb50[_0xe723('0x29')],_0xe723('0x6f'),_0x5adb50['originated']);delete this['actions'][_0x4dc764['uniqueid']];};Preview[_0xe723('0x10')]['checkInBlack']=function(_0xff97df,_0xc9c36c,_0x3133ba,_0xe699bd,_0x1c1d6e){var _0x32b4e6=this;return new BPromise(function(_0x1feea4,_0x29e51e){if(_['isNil'](_0xc9c36c)||_[_0xe723('0x86')](_0xc9c36c[_0xe723('0xfb')])||_[_0xe723('0x86')](_0xc9c36c['Contact']['phone'])||_['isNil'](_0xc9c36c[_0xe723('0x74')])){_0x29e51e(ut['message'](_0xe723('0xfc'),_0xe699bd,_0x1c1d6e));return;}var _0x29a67e=uuid['v4']();var _0x3da908=_0x32b4e6[_0xe723('0x14')][_0xc9c36c[_0xe723('0xfd')][_0xe723('0x29')]];var _0x2426d6=_0x3133ba?_0x32b4e6[_0xe723('0xfe')][_0x3133ba]['id']:undefined;_0x32b4e6[_0xe723('0x17')][_0x29a67e]=new Action(_0xc9c36c,_0x3da908,_0x29a67e,_0x3133ba,_0x2426d6);var _0x4b555b=_0x32b4e6[_0xe723('0x17')][_0x29a67e];_0x4b555b['unlockAgent']=_0xe699bd;_0x4b555b[_0xe723('0xae')]=_0x1c1d6e;_0x4b555b[_0xe723('0xff')]=_0x3133ba;if(_[_0xe723('0x100')](_0xff97df)){_0x32b4e6[_0xe723('0x101')](_0x4b555b,_0x3da908,_0xc9c36c,_0x3133ba)['then'](function(_0xcbed9b){logger[_0xe723('0x5c')]('[Preview][execCall][success]',_0xe723('0x102')+_0x4b555b[_0xe723('0x6e')]+'\x20IdHopper:\x20'+_0x4b555b['idContact'],JSON[_0xe723('0x58')](_0xcbed9b));ami['emit'](_0xe723('0x103'),ut[_0xe723('0xb6')](_0x4b555b,'called',_0x32b4e6[_0xe723('0x14')][_0x4b555b['queue']]));_0x1feea4(ut[_0xe723('0x4d')](_0xe723('0x104')));})[_0xe723('0x79')](function(_0x139ce1){ut[_0xe723('0x62')](_0xe723('0x105'),_0x139ce1);_0x29e51e(ut[_0xe723('0x4d')](_0xe723('0x106'),_0xe699bd,_0x1c1d6e));});}else{_0x3da908[_0xe723('0x3b')]+=0x1;ut[_0xe723('0x107')](_0x4b555b);rpcDb[_0xe723('0x108')](_0x4b555b,_0xe723('0x109'));delete _0x32b4e6[_0xe723('0x17')][_0x29a67e];_0x29e51e(ut['message'](_0xe723('0x10a'),_0xe699bd,_0x1c1d6e));}});};Preview[_0xe723('0x10')][_0xe723('0x9a')]=function(_0x2a4dff){return!_[_0xe723('0x86')](_0x2a4dff)&&!_[_0xe723('0x86')](_0x2a4dff[_0xe723('0x29')])&&!_[_0xe723('0x86')](_0x2a4dff[_0xe723('0x55')])&&_0x2a4dff[_0xe723('0x55')]&&!_[_0xe723('0x86')](this['trunks'][util['format'](_0xe723('0x10b'),_0x2a4dff[_0xe723('0x29')])])&&!_[_0xe723('0x86')](this[_0xe723('0x16')][util[_0xe723('0x59')](_0xe723('0x10b'),_0x2a4dff[_0xe723('0x29')])][_0xe723('0x77')])&&(this[_0xe723('0x16')][util[_0xe723('0x59')]('SIP/%s',_0x2a4dff['name'])][_0xe723('0x77')]===_0xe723('0x10c')||this[_0xe723('0x16')][util[_0xe723('0x59')](_0xe723('0x10b'),_0x2a4dff[_0xe723('0x29')])][_0xe723('0x77')]===_0xe723('0x10d'));};Preview[_0xe723('0x10')]['run']=function(_0x1cbd4b,_0x1b9ec3){var _0x19333a=this;return new BPromise(function(_0x659307,_0x12557a){_0x19333a[_0xe723('0x10e')](_0x1cbd4b,_0x1b9ec3)[_0xe723('0x85')](function(_0x5a1c38){_0x659307(_[_0xe723('0x71')](_0x5a1c38,['message']));})[_0xe723('0x79')](function(_0x12a058){if(_0x12a058['unlock']){rpcDb[_0xe723('0x10f')](_0x1cbd4b);}if(_0x12a058[_0xe723('0x55')]){rpcDb[_0xe723('0x110')](_0x1cbd4b);}_0x12557a(_[_0xe723('0x71')](_0x12a058,[_0xe723('0x4d')]));});});};Preview[_0xe723('0x10')]['execRun']=function(_0x45502a,_0x1fe00c){var _0x429e7e=this;return new BPromise(function(_0x3c0af4,_0x79f811){var _0xea34f5,_0x35aa7b;rpcDb[_0xe723('0x111')](_0x45502a)[_0xe723('0x85')](function(_0x4a8061){if(!_[_0xe723('0x86')](_0x4a8061[0x0])){_0x35aa7b=_0x4a8061[0x0]['recallme']?![]:!![];_0xea34f5=_0x4a8061[0x0][_0xe723('0x112')]?!![]:![];_0xea34f5=_0x1fe00c?!![]:_0xea34f5;}var _0x164a46=_0x429e7e[_0xe723('0x113')](_0x4a8061);if(_0x164a46[_0xe723('0x114')]){rpcDb[_0xe723('0x115')](_[_0xe723('0x71')](_0x4a8061[0x0],[_0xe723('0x74'),_0xe723('0x116')]))['then'](function(_0x1c25b4){_0x429e7e[_0xe723('0x117')](_0x1c25b4,_0x4a8061[0x0],_0x1fe00c,_0x35aa7b,_0xea34f5)['then'](function(_0x16db31){_0x3c0af4(_0x16db31);})[_0xe723('0x79')](function(_0x74cee6){_0x79f811(_0x74cee6);});})[_0xe723('0x79')](function(_0x169fe1){ut[_0xe723('0x62')](_0xe723('0x118'),_0x169fe1);_0x79f811(ut[_0xe723('0x4d')]('Call\x20unsuccessful',_0x35aa7b,_0xea34f5));});}else{_0x79f811(ut[_0xe723('0x4d')](_0x164a46[_0xe723('0x4d')],_0x35aa7b,_0xea34f5));}})[_0xe723('0x79')](function(_0x399de7){ut[_0xe723('0x62')]('[Preview][getContactPreview]',_0x399de7);_0x79f811(ut['message'](_0xe723('0x119'),![],!![]));});});};Preview[_0xe723('0x10')][_0xe723('0x113')]=function(_0x70ee94){if(_['isNil'](_0x70ee94)||_[_0xe723('0x100')](_0x70ee94)||!_['isNil'](_0x70ee94[0x0][_0xe723('0x8a')])&&_['isNil'](_0x70ee94[0x0][_0xe723('0x8a')]['name'])){ut['logger'](_0xe723('0x11a'),_0x70ee94);return{'isValid':![],'message':_0xe723('0x11b')};}var _0x3a61a3=this[_0xe723('0x14')][_0x70ee94[0x0][_0xe723('0xfd')]['name']];_0x3a61a3[_0xe723('0x4d')]=_0xe723('0x9d');if(_[_0xe723('0x86')](_0x3a61a3)){ut[_0xe723('0x62')](_0xe723('0x11c'),_0x3a61a3);return{'isValid':![],'message':_0xe723('0x11d')};}if(!this[_0xe723('0x9a')](_0x3a61a3['Trunk'])){ut[_0xe723('0x62')](_0xe723('0x11e'),_0xe723('0x11f')+_0x3a61a3[_0xe723('0x29')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xe723('0x9a')](_0x3a61a3['TrunkBackup'])){ut[_0xe723('0x62')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x3a61a3[_0xe723('0x29')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xe723('0x120')};}}if(!ut[_0xe723('0x98')](_0x3a61a3[_0xe723('0x37')])){ut[_0xe723('0x62')]('[Preview][validateContact][Campaign\x20Active]',_0x3a61a3['name']+_0xe723('0x121'));return{'isValid':![],'message':_0xe723('0x11f')+_0x3a61a3[_0xe723('0x29')]+_0xe723('0x121')};}return{'isValid':!![],'message':_0xe723('0x122')};};Preview[_0xe723('0x10')][_0xe723('0x101')]=function(_0xfe1af7,_0x2942fe,_0x393ae4,_0x4ac6b2){var _0x292aad=this;return new BPromise(function(_0x39acce,_0x4481bf){var _0x30608a=_0xfe1af7[_0xe723('0xb3')];var _0x13f41a=_0x292aad[_0xe723('0x9a')](_0x2942fe[_0xe723('0x54')])?util[_0xe723('0x59')]('SIP/%s/%s%s',_0x2942fe['Trunk'][_0xe723('0x29')],_[_0xe723('0x86')](_0x2942fe[_0xe723('0x39')])?'':_0x2942fe['dialPrefix'][_0xe723('0x123')]()||'',_0x2942fe['dialCutDigit']>0x0?_0x393ae4[_0xe723('0xfb')]['phone'][_0xe723('0x124')](_0x2942fe[_0xe723('0x125')]):_0x393ae4['Contact'][_0xe723('0x126')]):util[_0xe723('0x59')](_0xe723('0x127'),_['isNil'](_0x2942fe['TrunkBackup'])?_0x2942fe[_0xe723('0x54')]['name']:_0x2942fe[_0xe723('0x9b')][_0xe723('0x29')],_[_0xe723('0x86')](_0x2942fe[_0xe723('0x39')])?'':_0x2942fe['dialPrefix'][_0xe723('0x123')]()||'',_0x2942fe[_0xe723('0x125')]>0x0?_0x393ae4[_0xe723('0xfb')]['phone'][_0xe723('0x124')](_0x2942fe[_0xe723('0x125')]):_0x393ae4[_0xe723('0xfb')][_0xe723('0x126')]);var _0x120b9e=_0x292aad['isTrunkReachable'](_0x2942fe[_0xe723('0x54')])?ut[_0xe723('0x128')](_0x2942fe['Trunk']['callerid'],_0x2942fe[_0xe723('0x38')],_0x2942fe[_0xe723('0x129')]>0x0?ut[_0xe723('0x12a')](_0x2942fe[_0xe723('0x12b')],_0x2942fe[_0xe723('0x129')]):_0x2942fe[_0xe723('0x12b')]):ut[_0xe723('0x128')](_[_0xe723('0x86')](_0x2942fe[_0xe723('0x9b')])?_0x2942fe[_0xe723('0x54')][_0xe723('0x56')]:_0x2942fe[_0xe723('0x9b')][_0xe723('0x56')],_0x2942fe[_0xe723('0x38')],_0x2942fe[_0xe723('0x129')]>0x0?ut[_0xe723('0x12a')](_0x2942fe['dialOriginateCallerIdNumber'],_0x2942fe[_0xe723('0x129')]):_0x2942fe[_0xe723('0x12b')]);if(_0x120b9e){_0xfe1af7[_0xe723('0x12c')]=ut['extractCalleridName'](_0x120b9e);_0xfe1af7[_0xe723('0x12d')]=ut[_0xe723('0x12e')](_0x120b9e);}var _0x5efa86=ut[_0xe723('0x12f')](_0x2942fe,_0x393ae4,_0x13f41a,_0x120b9e,_0x30608a,_0xfe1af7);_[_0xe723('0x130')](_0xfe1af7,ut['toLowerVariables'](_0x5efa86));_0xfe1af7[_0xe723('0x8d')]=moment()[_0xe723('0x59')](_0xe723('0x8e'));ami['Action'](ut[_0xe723('0x131')](_0xfe1af7,_0x2942fe,_0x5efa86,_0xfe1af7[_0xe723('0xae')],_0x4ac6b2))[_0xe723('0x85')](function(_0x3fae3c){_0x2942fe[_0xe723('0x4e')]+=0x1;logger[_0xe723('0x5c')](_0xe723('0x132'),_0x30608a,_0xe723('0xb4'),_0x2942fe['name'],_0xe723('0x6f'),_0x2942fe[_0xe723('0x4e')]);_0x39acce(_0x3fae3c);})[_0xe723('0x79')](function(_0x2d64d3){ut[_0xe723('0xf3')](_0xfe1af7,0xe,_0xe723('0x133'));rpcDb[_0xe723('0xf4')](_0xfe1af7,_0xe723('0x134'));_0x4481bf(_0x2d64d3);});});};Preview[_0xe723('0x10')][_0xe723('0x20')]=function(_0x163ca2){if(this[_0xe723('0x17')][_0x163ca2[_0xe723('0xaf')]]){this['actions'][_0x163ca2[_0xe723('0xaf')]][_0xe723('0x78')]=_0x163ca2[_0xe723('0x78')];}};Preview[_0xe723('0x10')][_0xe723('0x18')]=function(_0x672f81){var _0x102e6c=this;var _0x5bd8ab=this['actions'][_0x672f81[_0xe723('0x135')]];if(_0x5bd8ab){if(_0x5bd8ab[_0xe723('0xff')]&&this['agents'][_0x5bd8ab[_0xe723('0xff')]]){ut[_0xe723('0x136')](_0x5bd8ab,this[_0xe723('0xfe')][_0x5bd8ab['lookAgent']]['name'],this[_0xe723('0xfe')][_0x5bd8ab[_0xe723('0xff')]]['id']);}var _0x11175c=_[_0xe723('0x137')](_0x5bd8ab);_0x11175c['responsetime']=moment()[_0xe723('0x59')](_0xe723('0x8e'));var _0x4a8106=_0x102e6c[_0xe723('0x14')][_0x5bd8ab[_0xe723('0x6e')]];if(ut[_0xe723('0x138')](_0x672f81[_0xe723('0x139')])){if(_0x5bd8ab['unlockAgent']){rpcDb[_0xe723('0x10f')](_0x5bd8ab[_0xe723('0x13a')]);}if(_0x5bd8ab[_0xe723('0xae')]){rpcDb[_0xe723('0x110')](_0x5bd8ab[_0xe723('0x13a')]);}ami[_0xe723('0x26')](_0xe723('0x13b'),ut[_0xe723('0xb6')](_0x5bd8ab,_0xe723('0x13c'),this[_0xe723('0x14')][_0x5bd8ab[_0xe723('0x6e')]]));this[_0xe723('0xef')](_0x11175c,_0x4a8106,_0x672f81);}else{_0x5bd8ab['starttime']=moment()[_0xe723('0x59')](_0xe723('0x8e'));ut[_0xe723('0xf3')](_0x11175c,0x4,_0xe723('0x13d'));rpcDb[_0xe723('0xf4')](_0x11175c,_0xe723('0x13e'));}}};Preview[_0xe723('0x10')][_0xe723('0x1b')]=function(_0x19b8f5){var _0x2602d9=this;var _0x593861=this[_0xe723('0x17')][_0x19b8f5['linkedid']];var _0x1b7203;if(_0x593861){_0x1b7203=this['campaignsPreview'][_0x593861[_0xe723('0x6e')]];logger['info'](_0xe723('0x13f'),_0x19b8f5[_0xe723('0xaf')],_0xe723('0xb4'),_0x1b7203[_0xe723('0x29')],_0xe723('0x70'),_0x1b7203[_0xe723('0x2e')]);}if(this[_0xe723('0x17')][_0x19b8f5[_0xe723('0xaf')]]&&_0x19b8f5[_0xe723('0xaf')]!==_0x19b8f5[_0xe723('0xb3')]){if(_0x19b8f5[_0xe723('0x140')]==='16'&&this['actions'][_0x19b8f5[_0xe723('0xaf')]][_0xe723('0x7d')]){this[_0xe723('0x141')](_0x19b8f5,_0x19b8f5[_0xe723('0xaf')],_0x19b8f5[_0xe723('0x140')]);}else if(this['actions'][_0x19b8f5[_0xe723('0xaf')]][_0xe723('0x7d')]){logger['info'](_0xe723('0x142'),_0x19b8f5[_0xe723('0xaf')],_0x19b8f5[_0xe723('0x140')],_0xe723('0xb4'),_0x1b7203['name'],_0xe723('0x70'),_0x1b7203[_0xe723('0x2e')]);this[_0xe723('0x141')](_0x19b8f5,_0x19b8f5[_0xe723('0xaf')],_0x19b8f5[_0xe723('0x140')]);}}else if(_0x593861&&_[_0xe723('0x86')](_0x593861[_0xe723('0x143')])&&_0x1b7203[_0xe723('0x144')]&&_0x19b8f5['linkedid']===_0x19b8f5[_0xe723('0xb3')]&&_[_0xe723('0x86')](_0x19b8f5[_0xe723('0xf2')])&&_0x19b8f5[_0xe723('0x140')]==='16'&&_0x19b8f5[_0xe723('0x145')]==='6'&&_[_0xe723('0xf0')](_0x593861['transfer'])){if(_0x593861[_0xe723('0xad')]){rpcDb[_0xe723('0x10f')](_0x593861[_0xe723('0x13a')]);}if(_0x593861[_0xe723('0xae')]){rpcDb[_0xe723('0x110')](_0x593861[_0xe723('0x13a')]);}_0x19b8f5[_0xe723('0xf2')]='22';this['callProgressDetectingAgent'](_0x593861,_0x1b7203,_0x19b8f5);}else if(_0x593861&&_0x593861['transfer']){if(_0x19b8f5[_0xe723('0x140')]==='16'&&this['actions'][_0x19b8f5[_0xe723('0xaf')]][_0xe723('0x7d')]){logger['info'](_0xe723('0x146'),_0x19b8f5['linkedid'],_0x19b8f5['cause'],_0xe723('0xb4'),_0x1b7203[_0xe723('0x29')],_0xe723('0x70'),_0x1b7203[_0xe723('0x2e')]);this[_0xe723('0x141')](_0x19b8f5,_0x19b8f5[_0xe723('0xaf')],_0x19b8f5['cause']);}else if(this[_0xe723('0x17')][_0x19b8f5['linkedid']][_0xe723('0x7d')]){logger[_0xe723('0x5c')](_0xe723('0x142'),_0x19b8f5[_0xe723('0xaf')],_0x19b8f5[_0xe723('0x140')],_0xe723('0xb4'),_0x1b7203[_0xe723('0x29')],_0xe723('0x70'),_0x1b7203[_0xe723('0x2e')]);this[_0xe723('0x141')](_0x19b8f5,_0x19b8f5[_0xe723('0xaf')],_0x19b8f5[_0xe723('0x140')]);}}};Preview['prototype']['syncDialEnd']=function(_0x2c427c){if(this[_0xe723('0x17')][_0x2c427c[_0xe723('0x147')]]&&_0x2c427c[_0xe723('0x147')]!==_0x2c427c[_0xe723('0x148')]){this[_0xe723('0x141')](_0x2c427c,_0x2c427c[_0xe723('0x147')],_0x2c427c['dialstatus']);}};Preview['prototype'][_0xe723('0x1c')]=function(_0x4750af){if(this[_0xe723('0x17')][_0x4750af[_0xe723('0xaf')]]&&_0x4750af[_0xe723('0xaf')]!==_0x4750af[_0xe723('0xb3')]&&!this[_0xe723('0x17')][_0x4750af['linkedid']]['dialAnswer']){if(_0x4750af[_0xe723('0x140')]==='1'){this[_0xe723('0x141')](_0x4750af,_0x4750af['linkedid'],_0x4750af[_0xe723('0x140')]);}}};Preview['prototype'][_0xe723('0x149')]=function(_0x2a8167,_0x10118f,_0x1ab9c0){if(this[_0xe723('0x17')][_0x2a8167]){if(_[_0xe723('0x86')](this[_0xe723('0x17')][_0x2a8167][_0xe723('0x14a')])){this[_0xe723('0x17')][_0x2a8167][_0xe723('0x14a')]={};}this['actions'][_0x2a8167][_0xe723('0x14a')][_0x10118f]=_0x1ab9c0;}};Preview['prototype'][_0xe723('0x22')]=function(_0x18abad){try{if(!_[_0xe723('0x86')](_0x18abad)){if(ut[_0xe723('0x14b')](_[_0xe723('0x14c')](_0x18abad['variable'])[0x0])){this[_0xe723('0x149')](_0x18abad[_0xe723('0xb3')],_['keys'](_0x18abad[_0xe723('0x14d')])[0x0],_0x18abad[_0xe723('0x14e')]);}}}catch(_0x42ce46){logger[_0xe723('0x14f')]('[syncVarSet][Preview]',util['inspect'](_0x42ce46,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x233408){if(_0x233408){if(this[_0xe723('0x17')][_0x233408[_0xe723('0x150')]]){this[_0xe723('0x17')][_0x233408[_0xe723('0x150')]][_0xe723('0x151')]=!![];}}};Preview[_0xe723('0x10')][_0xe723('0x152')]=function(_0x3c1d77){if(_0x3c1d77){if(this[_0xe723('0x17')][_0x3c1d77[_0xe723('0x153')]]){this[_0xe723('0x17')][_0x3c1d77[_0xe723('0x153')]][_0xe723('0x151')]=!![];}}};module[_0xe723('0x154')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 76c3b6e..b241004 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 _0x8b54=['../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','inspect','then','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','connectedlinename','membername','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperFinal'];(function(_0x35e92e,_0x21581b){var _0x1205a8=function(_0x4325d8){while(--_0x4325d8){_0x35e92e['push'](_0x35e92e['shift']());}};_0x1205a8(++_0x21581b);}(_0x8b54,0x19b));var _0x48b5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b54[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x48b5('0x0'));var BPromise=require(_0x48b5('0x1'));var logger=require('../../../config/logger')(_0x48b5('0x2'));var _=require('lodash');var cmHopper=require(_0x48b5('0x3'));var cmHopperFinal=require(_0x48b5('0x4'));var cmHopperHistory=require(_0x48b5('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x48b5('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x48b5('0x7'));function loggerCatch(_0x15b168){return function(_0x5a252d){logger[_0x48b5('0x8')](_0x15b168,util[_0x48b5('0x9')](_0x5a252d,{'showHidden':![],'depth':null}));};}function create(_0x3269eb){return BPromise['resolve']()[_0x48b5('0xa')](cmHopperHistory[_0x48b5('0xb')](_0x3269eb))[_0x48b5('0xc')](loggerCatch(_0x48b5('0xd')));}function createAgent(_0xd84dcb){return BPromise[_0x48b5('0xe')]()[_0x48b5('0xa')](agentReportPreview['createHistory'](_0xd84dcb))[_0x48b5('0xc')](loggerCatch(_0x48b5('0xd')));}function moveContact(_0x31ee60){return BPromise[_0x48b5('0xe')]()[_0x48b5('0xa')](cmHopper[_0x48b5('0xf')](_0x31ee60,!![]))['catch'](loggerCatch(_0x48b5('0x10')));}exports[_0x48b5('0x11')]=function(_0x51cfde){return BPromise['resolve']()['then'](cmHopperBlack[_0x48b5('0x11')](_0x51cfde))[_0x48b5('0xc')](loggerCatch(_0x48b5('0x12')));};exports[_0x48b5('0x13')]=function(_0x612ee4){return BPromise[_0x48b5('0xe')]()[_0x48b5('0xa')](cmHopper['getContactPreview'](_0x612ee4))[_0x48b5('0xc')](loggerCatch(_0x48b5('0x14')));};exports[_0x48b5('0xb')]=function(_0x125c8f,_0x399688){create(_0x125c8f)[_0x48b5('0xc')](loggerCatch(_0x399688));moveContact(_0x125c8f)[_0x48b5('0xc')](loggerCatch(_0x399688));};exports[_0x48b5('0x15')]=function(_0x3dbbdb,_0x531a79){createAgent(_0x3dbbdb)[_0x48b5('0xc')](loggerCatch(_0x531a79));};exports['createCustomerHistory']=function(_0x1d8b70,_0x5e6153){create(_0x1d8b70)['catch'](loggerCatch(_0x5e6153));};exports[_0x48b5('0x16')]=function(_0x4b1f30,_0x4a632b){moveContact(_0x4b1f30)[_0x48b5('0xc')](loggerCatch(_0x4a632b));};exports[_0x48b5('0x17')]=function(_0x1af64d,_0x5f47d2,_0x375f16){if(_0x5f47d2){_0x1af64d['UserId']=null;}if(_0x375f16){_0x1af64d[_0x48b5('0x18')]=![];}return BPromise[_0x48b5('0xe')]()[_0x48b5('0xa')](cmHopper[_0x48b5('0x17')](_0x1af64d))['catch'](loggerCatch(_0x48b5('0x19')));};exports[_0x48b5('0x1a')]=function(_0x4f5474){return BPromise[_0x48b5('0xe')]()['then'](cmHopper[_0x48b5('0x1a')](_0x4f5474))[_0x48b5('0xc')](loggerCatch('[countReScheduled]\x20'));};exports[_0x48b5('0x1b')]=function(_0x106e8d){return BPromise[_0x48b5('0xe')]()[_0x48b5('0xa')](cmHopper[_0x48b5('0x1b')]({'UserId':null},_0x106e8d,0x1))[_0x48b5('0xc')](loggerCatch(_0x48b5('0x1c')));};exports[_0x48b5('0x1d')]=function(_0x2090c0){return BPromise[_0x48b5('0xe')]()[_0x48b5('0xa')](cmHopper[_0x48b5('0x1b')]({'active':![]},_0x2090c0,0x1))['catch'](loggerCatch(_0x48b5('0x1e')));};exports[_0x48b5('0x1f')]=function(_0x5283b2){var _0x24b565={};_0x24b565['type']=_0x5283b2[_0x48b5('0x20')];_0x24b565[_0x48b5('0x21')]=_0x5283b2[_0x48b5('0x21')];_0x24b565[_0x48b5('0x22')]=_0x5283b2['calleridnum'];_0x24b565['calleridname']=_0x5283b2[_0x48b5('0x23')];_0x24b565[_0x48b5('0x24')]=_0x5283b2[_0x48b5('0x24')];_0x24b565['queuecallerjoinAt']=_0x5283b2[_0x48b5('0x25')];_0x24b565[_0x48b5('0x26')]=_0x5283b2[_0x48b5('0x25')];_0x24b565[_0x48b5('0x27')]=0x1;_0x24b565['queuecallercompleteAt']=_0x5283b2['endtime'];_0x24b565[_0x48b5('0x28')]=_0x5283b2[_0x48b5('0x29')];_0x24b565['context']='from-sip';_0x24b565[_0x48b5('0x2a')]=_0x48b5('0x2b');_0x24b565[_0x48b5('0x2c')]=0x0;_0x24b565[_0x48b5('0x2d')]=0x1;_0x24b565[_0x48b5('0x2e')]=_0x5283b2[_0x48b5('0x29')];_0x24b565[_0x48b5('0x2f')]=_0x48b5('0x30');return BPromise[_0x48b5('0xe')]()['then'](voiceQueueReport['create'](_0x24b565))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x48b5('0x31')]=function(_0x39112d,_0x423f6c){return BPromise[_0x48b5('0xe')]()['then'](cmHopper['getContactRecallMe'](_0x39112d,_0x423f6c))['catch'](loggerCatch(_0x48b5('0x32')));};exports['rescheduleContactInQueue']=function(_0x3dbee4){return BPromise[_0x48b5('0xe')]()[_0x48b5('0xa')](cmHopper[_0x48b5('0x17')](_0x3dbee4,!![],!![]))[_0x48b5('0xc')](loggerCatch(_0x48b5('0x33')));}; \ No newline at end of file +var _0xa56b=['queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','from-sip','exten','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','inspect','resolve','then','createHistory','catch','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime'];(function(_0xa31778,_0x30c4b2){var _0x4fadc4=function(_0x3d3ef7){while(--_0x3d3ef7){_0xa31778['push'](_0xa31778['shift']());}};_0x4fadc4(++_0x30c4b2);}(_0xa56b,0xb5));var _0xba56=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xa56b[_0x1573ea];return _0x51c0e2;};'use strict';var util=require(_0xba56('0x0'));var BPromise=require(_0xba56('0x1'));var logger=require(_0xba56('0x2'))('preview');var _=require(_0xba56('0x3'));var cmHopper=require(_0xba56('0x4'));var cmHopperFinal=require(_0xba56('0x5'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xba56('0x6'));var voiceQueueRt=require(_0xba56('0x7'));var agentReportPreview=require(_0xba56('0x8'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x143021){return function(_0x2bac97){logger['error'](_0x143021,util[_0xba56('0x9')](_0x2bac97,{'showHidden':![],'depth':null}));};}function create(_0x2e53b9){return BPromise[_0xba56('0xa')]()[_0xba56('0xb')](cmHopperHistory[_0xba56('0xc')](_0x2e53b9))[_0xba56('0xd')](loggerCatch(_0xba56('0xe')));}function createAgent(_0x1806a0){return BPromise['resolve']()[_0xba56('0xb')](agentReportPreview['createHistory'](_0x1806a0))[_0xba56('0xd')](loggerCatch(_0xba56('0xe')));}function moveContact(_0x286be1){return BPromise[_0xba56('0xa')]()['then'](cmHopper['moveContactManagedDialer'](_0x286be1,!![]))['catch'](loggerCatch(_0xba56('0xf')));}exports[_0xba56('0x10')]=function(_0x464947){return BPromise['resolve']()[_0xba56('0xb')](cmHopperBlack[_0xba56('0x10')](_0x464947))[_0xba56('0xd')](loggerCatch(_0xba56('0x11')));};exports[_0xba56('0x12')]=function(_0x5b0aeb){return BPromise[_0xba56('0xa')]()[_0xba56('0xb')](cmHopper[_0xba56('0x12')](_0x5b0aeb))['catch'](loggerCatch(_0xba56('0x13')));};exports[_0xba56('0xc')]=function(_0x47e8e0,_0x502a7d){create(_0x47e8e0)[_0xba56('0xd')](loggerCatch(_0x502a7d));moveContact(_0x47e8e0)[_0xba56('0xd')](loggerCatch(_0x502a7d));};exports[_0xba56('0x14')]=function(_0x1761fd,_0x277272){createAgent(_0x1761fd)['catch'](loggerCatch(_0x277272));};exports[_0xba56('0x15')]=function(_0x4585aa,_0x25e7e4){create(_0x4585aa)['catch'](loggerCatch(_0x25e7e4));};exports['createCustomerFinal']=function(_0x232030,_0x525ff3){moveContact(_0x232030)[_0xba56('0xd')](loggerCatch(_0x525ff3));};exports[_0xba56('0x16')]=function(_0x5f4f33,_0x2842c3,_0xe666d6){if(_0x2842c3){_0x5f4f33[_0xba56('0x17')]=null;}if(_0xe666d6){_0x5f4f33['active']=![];}return BPromise[_0xba56('0xa')]()[_0xba56('0xb')](cmHopper['rescheduleContact'](_0x5f4f33))[_0xba56('0xd')](loggerCatch(_0xba56('0x18')));};exports['countReScheduled']=function(_0x3363c1){return BPromise[_0xba56('0xa')]()[_0xba56('0xb')](cmHopper[_0xba56('0x19')](_0x3363c1))[_0xba56('0xd')](loggerCatch(_0xba56('0x1a')));};exports[_0xba56('0x1b')]=function(_0x1fdf8c){return BPromise[_0xba56('0xa')]()[_0xba56('0xb')](cmHopper[_0xba56('0x1b')]({'UserId':null},_0x1fdf8c,0x1))[_0xba56('0xd')](loggerCatch(_0xba56('0x1c')));};exports[_0xba56('0x1d')]=function(_0x5dc1aa){return BPromise[_0xba56('0xa')]()[_0xba56('0xb')](cmHopper[_0xba56('0x1b')]({'active':![]},_0x5dc1aa,0x1))[_0xba56('0xd')](loggerCatch(_0xba56('0x1e')));};exports[_0xba56('0x1f')]=function(_0x181652){var _0x44a93b={};_0x44a93b[_0xba56('0x20')]=_0x181652[_0xba56('0x20')];_0x44a93b[_0xba56('0x21')]=_0x181652['uniqueid'];_0x44a93b[_0xba56('0x22')]=_0x181652[_0xba56('0x22')];_0x44a93b[_0xba56('0x23')]=_0x181652['calleridname'];_0x44a93b[_0xba56('0x24')]=_0x181652[_0xba56('0x24')];_0x44a93b[_0xba56('0x25')]=_0x181652[_0xba56('0x26')];_0x44a93b[_0xba56('0x27')]=_0x181652['answertime'];_0x44a93b['queuecallercomplete']=0x1;_0x44a93b[_0xba56('0x28')]=_0x181652[_0xba56('0x29')];_0x44a93b[_0xba56('0x2a')]=_0x181652['membername'];_0x44a93b['context']=_0xba56('0x2b');_0x44a93b[_0xba56('0x2c')]=_0xba56('0x2d');_0x44a93b[_0xba56('0x2e')]=0x0;_0x44a93b[_0xba56('0x2f')]=0x1;_0x44a93b['lastAssignedTo']=_0x181652['membername'];_0x44a93b[_0xba56('0x30')]=_0xba56('0x31');return BPromise[_0xba56('0xa')]()[_0xba56('0xb')](voiceQueueReport['create'](_0x44a93b))['catch'](loggerCatch(_0xba56('0x32')));};exports['getContactRecallMe']=function(_0x2b62ac,_0x215ca4){return BPromise[_0xba56('0xa')]()[_0xba56('0xb')](cmHopper[_0xba56('0x33')](_0x2b62ac,_0x215ca4))[_0xba56('0xd')](loggerCatch(_0xba56('0x34')));};exports[_0xba56('0x35')]=function(_0x5c69d6){return BPromise[_0xba56('0xa')]()['then'](cmHopper[_0xba56('0x16')](_0x5c69d6,!![],!![]))['catch'](loggerCatch(_0xba56('0x36')));}; \ 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 9fa3064..3c25e08 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 _0xee0e=['UserId','logCustomer','ringtime','starttime','talktime','answertime','isFailure','variablesAction','RECALL','calleridname','uniqueid','originate','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','lastevent','queue','interface','motionChannel','mandatoryDisposition','buildAcw','channelAgent','agentReadyId','not_inuse','status','push','getDiff','createBody','filterKey','idContact','type','campaigntype','countglobal','callback','callbackuniqueid','callbackat','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','random','match','extractCalleridNumber','util','lodash','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','logger','inspect','loggerError','logger2','info','message','isUndefined','string','format','\x22%s\x22\x20<%s>','isEmpty','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','responsetime','endtime','logAgent','statedesc','membername'];(function(_0x496cc1,_0x289528){var _0x483597=function(_0x28659b){while(--_0x28659b){_0x496cc1['push'](_0x496cc1['shift']());}};_0x483597(++_0x289528);}(_0xee0e,0x171));var _0xeee0=function(_0x574ce3,_0x59eef4){_0x574ce3=_0x574ce3-0x0;var _0x3447a0=_0xee0e[_0x574ce3];return _0x3447a0;};'use strict';var util=require(_0xeee0('0x0'));var _=require(_0xeee0('0x1'));var moment=require('moment');var logger=require(_0xeee0('0x2'))(_0xeee0('0x3'));var ipAgi=process['env'][_0xeee0('0x4')]||_0xeee0('0x5');function getSeconds(_0x43114c,_0x1dd27f){var _0x167e35=moment(_0x43114c)['milliseconds'](0x0);var _0x2d0084=moment(_0x1dd27f)[_0xeee0('0x6')](0x0);return _0x167e35[_0xeee0('0x7')](_0x2d0084,_0xeee0('0x8'));}exports[_0xeee0('0x9')]=function(_0x2e2be7){return function(_0x8ddd4f){logger[_0xeee0('0xa')](_0x2e2be7,util['inspect'](_0x8ddd4f,{'showHidden':![],'depth':null}));};};exports[_0xeee0('0xb')]=function(_0x233548,_0x464b60){logger['info'](_0x233548,util[_0xeee0('0xc')](_0x464b60,{'showHidden':![],'depth':null}));};exports[_0xeee0('0xd')]=function(_0x43f1d7,_0x5c7543){logger[_0xeee0('0xa')](_0x43f1d7,util[_0xeee0('0xc')](_0x5c7543,{'showHidden':![],'depth':null}));};exports[_0xeee0('0xe')]=function(_0xde11c1){return function(_0x28e402){logger[_0xeee0('0xf')](_0xde11c1,util['inspect'](_0x28e402,{'showHidden':![],'depth':null}));};};exports[_0xeee0('0x10')]=function(_0x441758,_0x2e4ab5,_0x2ba7f3){return{'message':_0x441758,'unlock':_0x2e4ab5,'active':_0x2ba7f3};};exports['getCallerId']=function(_0x281e04,_0xf1e80c,_0x516f0c){if(!_[_0xeee0('0x11')](_0x516f0c)&&_0xeee0('0x12')===typeof _0x516f0c&&!_['isEmpty'](_0x516f0c)){if(!_[_0xeee0('0x11')](_0xf1e80c)&&_0xeee0('0x12')===typeof _0xf1e80c&&!_['isEmpty'](_0xf1e80c)){return util['format']('\x22%s\x22\x20<%s>',_0xf1e80c,_0x516f0c);}return util[_0xeee0('0x13')](_0xeee0('0x14'),_0x516f0c,_0x516f0c);}if(!_['isUndefined'](_0x281e04)&&_0xeee0('0x12')===typeof _0x281e04&&!_[_0xeee0('0x15')](_0x281e04)){return _0x281e04;}return _0xeee0('0x16');};exports[_0xeee0('0x17')]=function(_0x330ce4){if(_[_0xeee0('0x18')](_0x330ce4)){return![];}return _0x330ce4;};exports['addVariables']=function(_0x5403e6,_0x49af96,_0x532306,_0x358ed9,_0x19591e,_0x30e4c2){var _0x18dd64={'XMD-QUEUE':_0x49af96[_0xeee0('0x19')]?_0x49af96[_0xeee0('0x19')][_0xeee0('0x1a')]:'','XMD-CALLERID':_0x358ed9,'XMD-CALLERID-PREVIEW':_0x30e4c2?util['format'](_0xeee0('0x14'),_0x30e4c2['calleridname'],_0x30e4c2[_0xeee0('0x1b')]):_0x358ed9,'XMD-DIALID':_0x19591e,'XMD-CONTACTID':_0x49af96['ContactId'],'XMD-CDRTYPE':_0xeee0('0x1c'),'CALLERID(all)':_0x358ed9,'XMD-VOICEQUEUEID':_0x49af96[_0xeee0('0x1d')],'XMD-DIALCHANNEL':_0x532306,'XMD-DIALTIMEOUT':_0x5403e6[_0xeee0('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0xeee0('0x13')]('\x22rtTxX%s%s\x22',_0x5403e6[_0xeee0('0x1f')]?'g':'',_['isEmpty'](_0x5403e6[_0xeee0('0x20')])?'':_0xeee0('0x21')),'XMD-DIALURL':_0x5403e6['dialPreviewUrl']||'','XMD-AGI':_0x5403e6['dialQueueProject']?util[_0xeee0('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5403e6[_0xeee0('0x22')]):_0xeee0('0x23'),'XMD-AGIAFTER':_0x5403e6[_0xeee0('0x1f')]?util[_0xeee0('0x13')](_0xeee0('0x24'),ipAgi,_0x5403e6[_0xeee0('0x1f')]):_0xeee0('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x30e4c2?_0x30e4c2[_0xeee0('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x30e4c2?_0x30e4c2[_0xeee0('0x26')]:'','XMD-DESTINATION':_0xeee0('0x27'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xeee0('0x15')](_0x5403e6[_0xeee0('0x20')])){_0x18dd64[util[_0xeee0('0x13')]('%s',_0xeee0('0x28'))]=_0x5403e6[_0xeee0('0x20')];_0x18dd64[util[_0xeee0('0x13')]('%s',_0xeee0('0x29'))]=_0x19591e;}if(_0x49af96&&_0x49af96[_0xeee0('0x2a')]){for(var _0x548a43 in _0x49af96[_0xeee0('0x2a')]){if(_0x49af96[_0xeee0('0x2a')][_0xeee0('0x2b')](_0x548a43)){if(!_[_0xeee0('0x18')](_0x49af96['Contact'][_0x548a43])&&_0x548a43!=='id'&&_0x548a43!==_0xeee0('0x2c')&&_0x548a43!==_0xeee0('0x2d')&&_0x548a43!==_0xeee0('0x2e')){_0x18dd64[util[_0xeee0('0x13')]('%s%s',_0xeee0('0x2f'),_[_0xeee0('0x30')](_0x548a43))]=_0x49af96[_0xeee0('0x2a')][_0x548a43];}}}}return _0x18dd64;};exports[_0xeee0('0x31')]=function(_0x5280ab){var _0x126686={};for(var _0x283b3c in _0x5280ab){if(_0x5280ab[_0xeee0('0x2b')](_0x283b3c)){_0x126686[util[_0xeee0('0x13')]('%s',_[_0xeee0('0x32')](_0x283b3c))]=_0x5280ab[_0x283b3c];}}return{'variables':_0x126686};};exports[_0xeee0('0x33')]=function(_0xdb87b6,_0x138fe0){if(!_[_0xeee0('0x18')](_0xdb87b6)){if(_0xdb87b6[_0xeee0('0x2b')]('originated')){if(_0xdb87b6[_0xeee0('0x34')]>0x0){_0xdb87b6['originated']-=0x1;}else{logger[_0xeee0('0xa')](_0xeee0('0x35'),_0x138fe0);}}}else{logger['error'](_0xeee0('0x36'),_0x138fe0);}};exports[_0xeee0('0x37')]=function(_0x380be4){var _0x5845d0=moment()[_0xeee0('0x13')](_0xeee0('0x38'));_0x380be4[_0xeee0('0x39')]=0xd;_0x380be4['statedesc']='Blacklist';_0x380be4['starttime']=_0x5845d0;_0x380be4[_0xeee0('0x3a')]=_0x5845d0;_0x380be4[_0xeee0('0x3b')]=_0x5845d0;};exports[_0xeee0('0x3c')]=function(_0x28db74,_0x2575e0,_0x3613f7){var _0x20eab4=moment()[_0xeee0('0x13')](_0xeee0('0x38'));_0x28db74[_0xeee0('0x39')]=_0x2575e0;_0x28db74[_0xeee0('0x3d')]=_0x3613f7;_0x28db74[_0xeee0('0x3a')]=_0x20eab4;_0x28db74['ringtime']=getSeconds(_0x28db74[_0xeee0('0x3a')],_0x28db74['starttime']);};exports['logLookAgent']=function(_0xe0efa3,_0x566d84,_0x2a4b27){_0xe0efa3[_0xeee0('0x3e')]=_0x566d84;_0xe0efa3[_0xeee0('0x3f')]=_0x2a4b27;};exports[_0xeee0('0x40')]=function(_0x405f03,_0x37395b,_0x15b089){var _0xc69c6=moment()['format'](_0xeee0('0x38'));_0x405f03[_0xeee0('0x39')]=_0x37395b;_0x405f03[_0xeee0('0x3d')]=_0x15b089;_0x405f03[_0xeee0('0x3a')]=_0x405f03[_0xeee0('0x3a')]?_0x405f03[_0xeee0('0x3a')]:_0xc69c6;_0x405f03[_0xeee0('0x3b')]=_0x405f03[_0xeee0('0x3b')]?_0x405f03[_0xeee0('0x3b')]:_0xc69c6;_0x405f03[_0xeee0('0x41')]=getSeconds(_0x405f03[_0xeee0('0x3a')]||0x0,_0x405f03[_0xeee0('0x42')]||0x0);_0x405f03[_0xeee0('0x43')]=_0x405f03[_0xeee0('0x44')]?getSeconds(_0x405f03['endtime'],_0x405f03['answertime']):0x0;};exports[_0xeee0('0x45')]=function(_0x49e9b0){return _0x49e9b0==='Failure';};exports[_0xeee0('0x46')]=function(_0x18021d,_0x1f0054,_0x12fc0c,_0x1fcf69,_0x2afc11){var _0x3c96f1=_0x1fcf69?_0xeee0('0x47'):_0x18021d[_0xeee0('0x48')];_0x3c96f1=_0x2afc11?'BOOKED':_0x3c96f1;return{'actionid':_0x18021d[_0xeee0('0x49')],'action':_0xeee0('0x4a'),'channel':_0x18021d['channelAgent'],'callerid':util['format'](_0xeee0('0x14'),_0x3c96f1,_0x18021d[_0xeee0('0x1b')]),'Exten':_0xeee0('0x27'),'Context':_0xeee0('0x4b'),'Priority':'1','variable':_0x12fc0c,'timeout':(_0x1f0054[_0xeee0('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x18021d['uniqueid']};};exports[_0xeee0('0x4d')]=function(_0x459bf7){return _0x459bf7[_0xeee0('0x4e')]+_0x459bf7[_0xeee0('0x4f')]+_0x459bf7[_0xeee0('0x50')]+_0x459bf7['countagentrejectretry']+_0x459bf7[_0xeee0('0x51')];};exports[_0xeee0('0x52')]=function(_0x2e9f4c){var _0xfe5709=_[_0xeee0('0x53')](_0x2e9f4c);_0xfe5709[_0xeee0('0x39')]=0xf;_0xfe5709[_0xeee0('0x3d')]=_0xeee0('0x54');return _0xfe5709;};exports[_0xeee0('0x55')]=function(_0x2aa7a9,_0x5c5079,_0x57629a){var _0x36bf83={};_0x36bf83[_0x5c5079]=_0x2aa7a9[_0x5c5079];_0x36bf83[_0xeee0('0x56')]=![];_0x36bf83[_0xeee0('0x57')]=moment()['add'](_0x57629a,'minutes')['format'](_0xeee0('0x38'));_0x36bf83[_0xeee0('0x58')]=_0x2aa7a9[_0xeee0('0x58')];_0x36bf83[_0xeee0('0x59')]=_0x2aa7a9[_0xeee0('0x59')];_0x36bf83[_0xeee0('0x1d')]=_0x2aa7a9[_0xeee0('0x1d')]||undefined;return _0x36bf83;};exports[_0xeee0('0x5a')]=function(_0x5d400a,_0x2d48ff){if(!_[_0xeee0('0x18')](_0x5d400a)){if(_0x5d400a[_0xeee0('0x5b')]>0x0){_0x5d400a['pTalking']-=0x1;}else{logger[_0xeee0('0xa')](_0x2d48ff,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xeee0('0xa')](_0x2d48ff,_0xeee0('0x5c'));}};exports['IsNotLoggedIn']=function(_0x580ace){if(_0x580ace<=0x0){return!![];}return![];};exports[_0xeee0('0x5d')]=function(_0x460ebc,_0x49b185,_0x3a7e69){_0x460ebc[_0xeee0('0x5e')]=_0x49b185;_0x460ebc['name']=_0x460ebc[_0xeee0('0x5f')];_0x460ebc[_0xeee0('0x60')]=_0x460ebc['channelAgent'];_0x460ebc[_0xeee0('0x61')]='voice';if(_0x3a7e69){_0x460ebc['mandatoryDisposition']=_0x3a7e69[_0xeee0('0x62')];}return _0x460ebc;};exports[_0xeee0('0x63')]=function(_0x7173c5){var _0x134220={};_0x134220[_0xeee0('0x5f')]=_0x7173c5[_0xeee0('0x5f')];_0x134220['interface']=_0x7173c5[_0xeee0('0x64')];_0x134220[_0xeee0('0x49')]=_0x7173c5[_0xeee0('0x49')];return _0x134220;};exports[_0xeee0('0x65')]=function(_0x597ffe){var _0x4ec597=[];for(var _0x8a1c1 in _0x597ffe){if(_0x597ffe[_0xeee0('0x2b')](_0x8a1c1)){if(!_[_0xeee0('0x18')](_0x597ffe[_0x8a1c1])&&_0x597ffe[_0x8a1c1][_0xeee0('0x39')]===_0xeee0('0x66')&&_0x597ffe[_0x8a1c1][_0xeee0('0x67')]==='reachable'){_0x4ec597[_0xeee0('0x68')](_0x597ffe[_0x8a1c1]['id']);}}}return _0x4ec597;};exports[_0xeee0('0x69')]=function(_0x207df7){var _0x2f95bf=moment()[_0xeee0('0x6')](0x0);var _0x9a35c9=moment(_0x207df7)['milliseconds'](0x0);return _0x2f95bf[_0xeee0('0x7')](_0x9a35c9,_0xeee0('0x8'));};exports[_0xeee0('0x6a')]=function(_0x52cfa8){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x52cfa8[_0xeee0('0x58')],'ListId':_0x52cfa8['ListId'],'VoiceQueueId':_0x52cfa8[_0xeee0('0x1d')]||undefined,'CampaignId':_0x52cfa8['CampaignId']||undefined};};exports[_0xeee0('0x6b')]=function(_0x5a1fc6){if(_0x5a1fc6===_0xeee0('0x49')||_0x5a1fc6===_0xeee0('0x6c')||_0x5a1fc6==='queue'||_0x5a1fc6===_0xeee0('0x6d')||_0x5a1fc6===_0xeee0('0x6e')||_0x5a1fc6==='dialAnswer'||_0x5a1fc6===_0xeee0('0x3e')||_0x5a1fc6==='channelAgent'||_0x5a1fc6===_0xeee0('0x48')||_0x5a1fc6===_0xeee0('0x56')||_0x5a1fc6==='calleridnum'||_0x5a1fc6===_0xeee0('0x57')||_0x5a1fc6===_0xeee0('0x4e')||_0x5a1fc6===_0xeee0('0x4f')||_0x5a1fc6===_0xeee0('0x50')||_0x5a1fc6===_0xeee0('0x6f')||_0x5a1fc6===_0xeee0('0x70')||_0x5a1fc6===_0xeee0('0x71')||_0x5a1fc6===_0xeee0('0x72')||_0x5a1fc6==='recallme'||_0x5a1fc6===_0xeee0('0x58')||_0x5a1fc6===_0xeee0('0x59')||_0x5a1fc6==='UserId'||_0x5a1fc6==='VoiceQueueId'||_0x5a1fc6==='sipcallid'||_0x5a1fc6===_0xeee0('0x73')||_0x5a1fc6==='xmd-queue'||_0x5a1fc6===_0xeee0('0x74')||_0x5a1fc6===_0xeee0('0x75')||_0x5a1fc6===_0xeee0('0x76')||_0x5a1fc6===_0xeee0('0x77')||_0x5a1fc6===_0xeee0('0x78')||_0x5a1fc6===_0xeee0('0x79')||_0x5a1fc6===_0xeee0('0x7a')||_0x5a1fc6===_0xeee0('0x7b')||_0x5a1fc6===_0xeee0('0x7c')||_0x5a1fc6===_0xeee0('0x7d')||_0x5a1fc6===_0xeee0('0x7e')||_0x5a1fc6===_0xeee0('0x7f')||_0x5a1fc6===_0xeee0('0x80')||_0x5a1fc6==='rtpaudioqosbridged'||_0x5a1fc6===_0xeee0('0x81')||_0x5a1fc6==='rtpaudioqosjitterbridged'||_0x5a1fc6===_0xeee0('0x82')||_0x5a1fc6===_0xeee0('0x83')||_0x5a1fc6==='rtpaudioqosrtt'||_0x5a1fc6===_0xeee0('0x84')||_0x5a1fc6==='rtpaudioqos'||_0x5a1fc6===_0xeee0('0x85')||_0x5a1fc6===_0xeee0('0x81')||_0x5a1fc6===_0xeee0('0x86')||_0x5a1fc6==='rtpaudioqosloss'||_0x5a1fc6===_0xeee0('0x83')||_0x5a1fc6===_0xeee0('0x87')||_0x5a1fc6===_0xeee0('0x84')||_0x5a1fc6===_0xeee0('0x88')||_0x5a1fc6===_0xeee0('0x89')||_0x5a1fc6===_0xeee0('0x39')||_0x5a1fc6===_0xeee0('0x3d')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x21fd45,_0x3d27f9){var _0x369774,_0x1aa23b,_0x2cc172;if(_0x3d27f9<=0x0){_0x3d27f9=0x1;}_0x369774=new RegExp(_0xeee0('0x8a')+_0x3d27f9+'}$');_0x1aa23b=Math[_0xeee0('0x8b')](0xa,_0x3d27f9-0x1);_0x2cc172=Math[_0xeee0('0x8b')](0xa,_0x3d27f9)-0x1;return util[_0xeee0('0x13')]('%s',_[_0xeee0('0x8c')](_0x21fd45,_0x369774,_[_0xeee0('0x8d')](_0x1aa23b,_0x2cc172)));};exports['extractCalleridName']=function(_0x38ba53){var _0x1fa304=_0x38ba53[_0xeee0('0x8e')](/"(.*?)"/);return _0x1fa304?_0x1fa304[0x1]:_0x38ba53;};exports[_0xeee0('0x8f')]=function(_0x3baedf){var _0x1b684c=_0x3baedf['match'](/<(.*?)>/);return _0x1b684c?_0x1b684c[0x1]:_0x3baedf;}; \ No newline at end of file +var _0x0bd9=['pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','queue','interface','motionChannel','mandatoryDisposition','agentReadyId','not_inuse','reachable','push','getDiff','filterKey','idContact','type','campaigntype','dialAnswer','active','countnoanswerretry','countglobal','callback','callbackat','recallme','UserId','sipcallid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','preview','env','127.0.0.1','milliseconds','diff','seconds','error','inspect','logger','info','logger2','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isNil','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','monitor_format','dialPreviewUrl','dialQueueProject','NONE','dialQueueProject2','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','XMD-','toUpper','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','membername','answertime','isFailure','Failure','uniqueid','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','cloneAction','clone','scheduledAt','scheduledat','add','minutes','ContactId','ListId','decrementTalkink'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x0bd9,0xba));var _0x90bd=function(_0x20c7d9,_0x2f688c){_0x20c7d9=_0x20c7d9-0x0;var _0x355dcd=_0x0bd9[_0x20c7d9];return _0x355dcd;};'use strict';var util=require(_0x90bd('0x0'));var _=require(_0x90bd('0x1'));var moment=require(_0x90bd('0x2'));var logger=require('../../../../config/logger')(_0x90bd('0x3'));var ipAgi=process[_0x90bd('0x4')]['XCALLY_IP_AGI']||_0x90bd('0x5');function getSeconds(_0x3cfbd3,_0x599f8e){var _0x4222ac=moment(_0x3cfbd3)['milliseconds'](0x0);var _0x36136d=moment(_0x599f8e)[_0x90bd('0x6')](0x0);return _0x4222ac[_0x90bd('0x7')](_0x36136d,_0x90bd('0x8'));}exports['loggerCatch']=function(_0x22260f){return function(_0x597e97){logger[_0x90bd('0x9')](_0x22260f,util[_0x90bd('0xa')](_0x597e97,{'showHidden':![],'depth':null}));};};exports[_0x90bd('0xb')]=function(_0x47d282,_0x522771){logger[_0x90bd('0xc')](_0x47d282,util[_0x90bd('0xa')](_0x522771,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x124241,_0x5c57ae){logger[_0x90bd('0x9')](_0x124241,util[_0x90bd('0xa')](_0x5c57ae,{'showHidden':![],'depth':null}));};exports[_0x90bd('0xd')]=function(_0x383716){return function(_0x3fd705){logger[_0x90bd('0xc')](_0x383716,util[_0x90bd('0xa')](_0x3fd705,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x3a3118,_0x3f7b3b,_0x22a140){return{'message':_0x3a3118,'unlock':_0x3f7b3b,'active':_0x22a140};};exports[_0x90bd('0xe')]=function(_0x1f90f3,_0x15a5ad,_0x234edc){if(!_[_0x90bd('0xf')](_0x234edc)&&_0x90bd('0x10')===typeof _0x234edc&&!_[_0x90bd('0x11')](_0x234edc)){if(!_['isUndefined'](_0x15a5ad)&&'string'===typeof _0x15a5ad&&!_[_0x90bd('0x11')](_0x15a5ad)){return util['format'](_0x90bd('0x12'),_0x15a5ad,_0x234edc);}return util[_0x90bd('0x13')](_0x90bd('0x12'),_0x234edc,_0x234edc);}if(!_[_0x90bd('0xf')](_0x1f90f3)&&'string'===typeof _0x1f90f3&&!_[_0x90bd('0x11')](_0x1f90f3)){return _0x1f90f3;}return _0x90bd('0x14');};exports['isActive']=function(_0x1ea48a){if(_[_0x90bd('0x15')](_0x1ea48a)){return![];}return _0x1ea48a;};exports['addVariables']=function(_0xf14dbf,_0x4e2d0a,_0x48763d,_0x42d19e,_0x3de7fb,_0x18f427){var _0x4dd07a={'XMD-QUEUE':_0x4e2d0a[_0x90bd('0x16')]?_0x4e2d0a['Queue'][_0x90bd('0x17')]:'','XMD-CALLERID':_0x42d19e,'XMD-CALLERID-PREVIEW':_0x18f427?util['format'](_0x90bd('0x12'),_0x18f427[_0x90bd('0x18')],_0x18f427[_0x90bd('0x19')]):_0x42d19e,'XMD-DIALID':_0x3de7fb,'XMD-CONTACTID':_0x4e2d0a['ContactId'],'XMD-CDRTYPE':_0x90bd('0x1a'),'CALLERID(all)':_0x42d19e,'XMD-VOICEQUEUEID':_0x4e2d0a[_0x90bd('0x1b')],'XMD-DIALCHANNEL':_0x48763d,'XMD-DIALTIMEOUT':_0xf14dbf['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format'](_0x90bd('0x1c'),_0xf14dbf['dialQueueProject2']?'g':'',_[_0x90bd('0x11')](_0xf14dbf[_0x90bd('0x1d')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0xf14dbf[_0x90bd('0x1e')]||'','XMD-AGI':_0xf14dbf[_0x90bd('0x1f')]?util[_0x90bd('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0xf14dbf['dialQueueProject']):_0x90bd('0x20'),'XMD-AGIAFTER':_0xf14dbf[_0x90bd('0x21')]?util[_0x90bd('0x13')](_0x90bd('0x22'),ipAgi,_0xf14dbf['dialQueueProject2']):_0x90bd('0x20'),'XMD-ORIGINATECALLERIDNUM':_0x18f427?_0x18f427[_0x90bd('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x18f427?_0x18f427[_0x90bd('0x24')]:'','XMD-DESTINATION':_0x90bd('0x25'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x90bd('0x11')](_0xf14dbf[_0x90bd('0x1d')])){_0x4dd07a[util[_0x90bd('0x13')]('%s',_0x90bd('0x26'))]=_0xf14dbf[_0x90bd('0x1d')];_0x4dd07a[util['format']('%s',_0x90bd('0x27'))]=_0x3de7fb;}if(_0x4e2d0a&&_0x4e2d0a[_0x90bd('0x28')]){for(var _0x1b0a9b in _0x4e2d0a[_0x90bd('0x28')]){if(_0x4e2d0a[_0x90bd('0x28')][_0x90bd('0x29')](_0x1b0a9b)){if(!_['isNil'](_0x4e2d0a[_0x90bd('0x28')][_0x1b0a9b])&&_0x1b0a9b!=='id'&&_0x1b0a9b!==_0x90bd('0x2a')&&_0x1b0a9b!==_0x90bd('0x2b')&&_0x1b0a9b!==_0x90bd('0x2c')){_0x4dd07a[util[_0x90bd('0x13')]('%s%s',_0x90bd('0x2d'),_[_0x90bd('0x2e')](_0x1b0a9b))]=_0x4e2d0a[_0x90bd('0x28')][_0x1b0a9b];}}}}return _0x4dd07a;};exports['toLowerVariables']=function(_0x3b5ea2){var _0xecc817={};for(var _0x2b41ac in _0x3b5ea2){if(_0x3b5ea2[_0x90bd('0x29')](_0x2b41ac)){_0xecc817[util[_0x90bd('0x13')]('%s',_[_0x90bd('0x2f')](_0x2b41ac))]=_0x3b5ea2[_0x2b41ac];}}return{'variables':_0xecc817};};exports['updateOriginated']=function(_0x50dd16,_0x5ba836){if(!_[_0x90bd('0x15')](_0x50dd16)){if(_0x50dd16[_0x90bd('0x29')]('originated')){if(_0x50dd16[_0x90bd('0x30')]>0x0){_0x50dd16[_0x90bd('0x30')]-=0x1;}else{logger[_0x90bd('0x9')](_0x90bd('0x31'),_0x5ba836);}}}else{logger[_0x90bd('0x9')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x5ba836);}};exports[_0x90bd('0x32')]=function(_0x343fc1){var _0x2cd6dc=moment()['format'](_0x90bd('0x33'));_0x343fc1[_0x90bd('0x34')]=0xd;_0x343fc1[_0x90bd('0x35')]=_0x90bd('0x36');_0x343fc1[_0x90bd('0x37')]=_0x2cd6dc;_0x343fc1[_0x90bd('0x38')]=_0x2cd6dc;_0x343fc1[_0x90bd('0x39')]=_0x2cd6dc;};exports[_0x90bd('0x3a')]=function(_0x48d24c,_0x3a984b,_0x1540c1){var _0x365063=moment()[_0x90bd('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x48d24c[_0x90bd('0x34')]=_0x3a984b;_0x48d24c[_0x90bd('0x35')]=_0x1540c1;_0x48d24c[_0x90bd('0x38')]=_0x365063;_0x48d24c[_0x90bd('0x3b')]=getSeconds(_0x48d24c['responsetime'],_0x48d24c['starttime']);};exports[_0x90bd('0x3c')]=function(_0xd71240,_0x3e9bef,_0x132f38){_0xd71240[_0x90bd('0x3d')]=_0x3e9bef;_0xd71240['UserId']=_0x132f38;};exports['logCustomer']=function(_0x575b40,_0x12af27,_0x1db97d){var _0x5b2ffa=moment()[_0x90bd('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x575b40[_0x90bd('0x34')]=_0x12af27;_0x575b40['statedesc']=_0x1db97d;_0x575b40[_0x90bd('0x38')]=_0x575b40[_0x90bd('0x38')]?_0x575b40[_0x90bd('0x38')]:_0x5b2ffa;_0x575b40[_0x90bd('0x39')]=_0x575b40[_0x90bd('0x39')]?_0x575b40[_0x90bd('0x39')]:_0x5b2ffa;_0x575b40['ringtime']=getSeconds(_0x575b40[_0x90bd('0x38')]||0x0,_0x575b40[_0x90bd('0x37')]||0x0);_0x575b40['talktime']=_0x575b40[_0x90bd('0x3e')]?getSeconds(_0x575b40[_0x90bd('0x39')],_0x575b40['answertime']):0x0;};exports[_0x90bd('0x3f')]=function(_0x3a8afd){return _0x3a8afd===_0x90bd('0x40');};exports['variablesAction']=function(_0x34e7e9,_0x31511e,_0x4c8d76,_0x282896,_0x5c83f4){var _0x24f94a=_0x282896?'RECALL':_0x34e7e9[_0x90bd('0x18')];_0x24f94a=_0x5c83f4?'BOOKED':_0x24f94a;return{'actionid':_0x34e7e9[_0x90bd('0x41')],'action':'originate','channel':_0x34e7e9[_0x90bd('0x42')],'callerid':util[_0x90bd('0x13')](_0x90bd('0x12'),_0x24f94a,_0x34e7e9[_0x90bd('0x19')]),'Exten':_0x90bd('0x25'),'Context':_0x90bd('0x43'),'Priority':'1','variable':_0x4c8d76,'timeout':(_0x31511e[_0x90bd('0x44')]||0x1e)*0x3e8,'async':!![],'channelid':_0x34e7e9[_0x90bd('0x41')]};};exports[_0x90bd('0x45')]=function(_0x16eb84){return _0x16eb84[_0x90bd('0x46')]+_0x16eb84[_0x90bd('0x47')]+_0x16eb84['countnoanswerretry']+_0x16eb84[_0x90bd('0x48')]+_0x16eb84['countnosuchnumberretry'];};exports[_0x90bd('0x49')]=function(_0x278030){var _0x22e514=_[_0x90bd('0x4a')](_0x278030);_0x22e514[_0x90bd('0x34')]=0xf;_0x22e514[_0x90bd('0x35')]='Global';return _0x22e514;};exports[_0x90bd('0x4b')]=function(_0x94072e,_0xc85be3,_0x39a015){var _0x366555={};_0x366555[_0xc85be3]=_0x94072e[_0xc85be3];_0x366555['active']=![];_0x366555[_0x90bd('0x4c')]=moment()[_0x90bd('0x4d')](_0x39a015,_0x90bd('0x4e'))[_0x90bd('0x13')](_0x90bd('0x33'));_0x366555[_0x90bd('0x4f')]=_0x94072e['ContactId'];_0x366555[_0x90bd('0x50')]=_0x94072e[_0x90bd('0x50')];_0x366555['VoiceQueueId']=_0x94072e[_0x90bd('0x1b')]||undefined;return _0x366555;};exports[_0x90bd('0x51')]=function(_0x1f381b,_0x136eec){if(!_[_0x90bd('0x15')](_0x1f381b)){if(_0x1f381b['pTalking']>0x0){_0x1f381b[_0x90bd('0x52')]-=0x1;}else{logger[_0x90bd('0x9')](_0x136eec,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x90bd('0x9')](_0x136eec,_0x90bd('0x53'));}};exports['IsNotLoggedIn']=function(_0x31bf5c){if(_0x31bf5c<=0x0){return!![];}return![];};exports['buildObj']=function(_0xf24b52,_0xf971e,_0x36066f){_0xf24b52[_0x90bd('0x54')]=_0xf971e;_0xf24b52[_0x90bd('0x17')]=_0xf24b52[_0x90bd('0x55')];_0xf24b52[_0x90bd('0x56')]=_0xf24b52[_0x90bd('0x42')];_0xf24b52[_0x90bd('0x57')]='voice';if(_0x36066f){_0xf24b52[_0x90bd('0x58')]=_0x36066f[_0x90bd('0x58')];}return _0xf24b52;};exports['buildAcw']=function(_0x5cb06d){var _0xdc06ef={};_0xdc06ef[_0x90bd('0x55')]=_0x5cb06d[_0x90bd('0x55')];_0xdc06ef[_0x90bd('0x56')]=_0x5cb06d[_0x90bd('0x42')];_0xdc06ef['uniqueid']=_0x5cb06d[_0x90bd('0x41')];return _0xdc06ef;};exports[_0x90bd('0x59')]=function(_0x46f0a4){var _0xbe8f65=[];for(var _0x570a2f in _0x46f0a4){if(_0x46f0a4['hasOwnProperty'](_0x570a2f)){if(!_['isNil'](_0x46f0a4[_0x570a2f])&&_0x46f0a4[_0x570a2f][_0x90bd('0x34')]===_0x90bd('0x5a')&&_0x46f0a4[_0x570a2f]['status']===_0x90bd('0x5b')){_0xbe8f65[_0x90bd('0x5c')](_0x46f0a4[_0x570a2f]['id']);}}}return _0xbe8f65;};exports[_0x90bd('0x5d')]=function(_0x304bfc){var _0x2c4007=moment()[_0x90bd('0x6')](0x0);var _0x4e9681=moment(_0x304bfc)[_0x90bd('0x6')](0x0);return _0x2c4007['diff'](_0x4e9681,_0x90bd('0x8'));};exports['createBody']=function(_0x93c1d){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x93c1d['ContactId'],'ListId':_0x93c1d[_0x90bd('0x50')],'VoiceQueueId':_0x93c1d[_0x90bd('0x1b')]||undefined,'CampaignId':_0x93c1d['CampaignId']||undefined};};exports[_0x90bd('0x5e')]=function(_0x5b504f){if(_0x5b504f===_0x90bd('0x41')||_0x5b504f===_0x90bd('0x5f')||_0x5b504f===_0x90bd('0x55')||_0x5b504f===_0x90bd('0x60')||_0x5b504f===_0x90bd('0x61')||_0x5b504f===_0x90bd('0x62')||_0x5b504f==='membername'||_0x5b504f===_0x90bd('0x42')||_0x5b504f===_0x90bd('0x18')||_0x5b504f===_0x90bd('0x63')||_0x5b504f===_0x90bd('0x19')||_0x5b504f===_0x90bd('0x4c')||_0x5b504f===_0x90bd('0x46')||_0x5b504f===_0x90bd('0x47')||_0x5b504f===_0x90bd('0x64')||_0x5b504f===_0x90bd('0x65')||_0x5b504f===_0x90bd('0x66')||_0x5b504f==='callbackuniqueid'||_0x5b504f===_0x90bd('0x67')||_0x5b504f===_0x90bd('0x68')||_0x5b504f===_0x90bd('0x4f')||_0x5b504f===_0x90bd('0x50')||_0x5b504f===_0x90bd('0x69')||_0x5b504f===_0x90bd('0x1b')||_0x5b504f===_0x90bd('0x6a')||_0x5b504f==='xmd-voicequeueid'||_0x5b504f===_0x90bd('0x6b')||_0x5b504f==='xmd-phone'||_0x5b504f===_0x90bd('0x6c')||_0x5b504f===_0x90bd('0x6d')||_0x5b504f==='xmd-dialtimeout'||_0x5b504f===_0x90bd('0x6e')||_0x5b504f===_0x90bd('0x6f')||_0x5b504f===_0x90bd('0x70')||_0x5b504f==='xmd-contactid'||_0x5b504f===_0x90bd('0x71')||_0x5b504f===_0x90bd('0x72')||_0x5b504f===_0x90bd('0x73')||_0x5b504f===_0x90bd('0x74')||_0x5b504f===_0x90bd('0x75')||_0x5b504f===_0x90bd('0x76')||_0x5b504f===_0x90bd('0x77')||_0x5b504f===_0x90bd('0x78')||_0x5b504f===_0x90bd('0x79')||_0x5b504f===_0x90bd('0x7a')||_0x5b504f===_0x90bd('0x7b')||_0x5b504f===_0x90bd('0x7c')||_0x5b504f===_0x90bd('0x75')||_0x5b504f===_0x90bd('0x76')||_0x5b504f===_0x90bd('0x77')||_0x5b504f===_0x90bd('0x78')||_0x5b504f==='rtpaudioqosloss'||_0x5b504f===_0x90bd('0x7a')||_0x5b504f===_0x90bd('0x7b')||_0x5b504f==='rtpaudioqosrttbridged'||_0x5b504f===_0x90bd('0x7d')||_0x5b504f==='bridgepvtcallid'||_0x5b504f===_0x90bd('0x34')||_0x5b504f===_0x90bd('0x35')){return![];}return!![];};exports[_0x90bd('0x7e')]=function(_0x577af6,_0x5ebe24){var _0x78a4e7,_0x4102b9,_0x5252ee;if(_0x5ebe24<=0x0){_0x5ebe24=0x1;}_0x78a4e7=new RegExp(_0x90bd('0x7f')+_0x5ebe24+'}$');_0x4102b9=Math[_0x90bd('0x80')](0xa,_0x5ebe24-0x1);_0x5252ee=Math[_0x90bd('0x80')](0xa,_0x5ebe24)-0x1;return util[_0x90bd('0x13')]('%s',_[_0x90bd('0x81')](_0x577af6,_0x78a4e7,_[_0x90bd('0x82')](_0x4102b9,_0x5252ee)));};exports[_0x90bd('0x83')]=function(_0x4856c6){var _0x552f0f=_0x4856c6[_0x90bd('0x84')](/"(.*?)"/);return _0x552f0f?_0x552f0f[0x1]:_0x4856c6;};exports[_0x90bd('0x85')]=function(_0x22c33b){var _0x5883fb=_0x22c33b[_0x90bd('0x84')](/<(.*?)>/);return _0x5883fb?_0x5883fb[0x1]:_0x22c33b;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 3522fc5..26319df 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 _0xf3ea=['voicequeuechannelredirect','queueadd','string','number','boolean','voicequeuechannel'];(function(_0x3fe184,_0x5bf20b){var _0x32f10d=function(_0x49e85f){while(--_0x49e85f){_0x3fe184['push'](_0x3fe184['shift']());}};_0x32f10d(++_0x5bf20b);}(_0xf3ea,0xc1));var _0xaf3e=function(_0x314beb,_0x191505){_0x314beb=_0x314beb-0x0;var _0x21cd66=_0xf3ea[_0x314beb];return _0x21cd66;};'use strict';exports[_0xaf3e('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xaf3e('0x1'),'required':!![]},'membername':{'type':_0xaf3e('0x1'),'required':!![]},'penalty':{'type':_0xaf3e('0x2'),'required':![]},'paused':{'type':_0xaf3e('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0xaf3e('0x1'),'required':!![]},'interface':{'type':_0xaf3e('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0xaf3e('0x1'),'required':!![]},'paused':{'type':_0xaf3e('0x3')},'reason':{'type':_0xaf3e('0x1'),'required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports[_0xaf3e('0x4')]={'uniqueid':{'type':_0xaf3e('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0xaf3e('0x1')},'format':{'type':_0xaf3e('0x1')},'mixmonitorid':{'type':'string'}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0xaf3e('0x1'),'required':!![]}};exports[_0xaf3e('0x5')]={'uniqueid':{'type':_0xaf3e('0x1'),'required':!![]},'exten':{'type':_0xaf3e('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x3928=['queueadd','string','number','boolean','queueremove','reload','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect'];(function(_0x293a01,_0x54b044){var _0xb99a70=function(_0xaa8bf2){while(--_0xaa8bf2){_0x293a01['push'](_0x293a01['shift']());}};_0xb99a70(++_0x54b044);}(_0x3928,0x1dd));var _0x8392=function(_0x123301,_0x11f217){_0x123301=_0x123301-0x0;var _0x524881=_0x3928[_0x123301];return _0x524881;};'use strict';exports[_0x8392('0x0')]={'queue':{'type':_0x8392('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x8392('0x1'),'required':!![]},'penalty':{'type':_0x8392('0x2'),'required':![]},'paused':{'type':_0x8392('0x3'),'required':![]}};exports[_0x8392('0x4')]={'queue':{'type':_0x8392('0x1'),'required':!![]},'interface':{'type':_0x8392('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':'string','required':!![]},'paused':{'type':_0x8392('0x3')},'reason':{'type':'string','required':![]}};exports[_0x8392('0x5')]={'module':{'type':_0x8392('0x1'),'required':![]}};exports[_0x8392('0x6')]={'uniqueid':{'type':_0x8392('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':_0x8392('0x1')},'mixmonitorid':{'type':'string'}};exports[_0x8392('0x7')]={'uniqueid':{'type':_0x8392('0x1'),'required':!![]}};exports[_0x8392('0x8')]={'uniqueid':{'type':_0x8392('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x8392('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 17c33e8..14c732e 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 _0x236e=['freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','isNil','interface','total','answered','sumHoldTime','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','prototype','initAgents','length','isUndefined','mergeFromDatabase','initTriggers','initTemplates','templates','initZendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','vtigerAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','sumDuration','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','../model/agent','../model/telephone','../model/trunk','../model/template','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','outbound','channels','queueChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts'];(function(_0x28a348,_0x2c8aa8){var _0x3acbc4=function(_0xab5366){while(--_0xab5366){_0x28a348['push'](_0x28a348['shift']());}};_0x3acbc4(++_0x2c8aa8);}(_0x236e,0x18a));var _0xe236=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x236e[_0x4154a6];return _0x3b2786;};'use strict';var BPromise=require(_0xe236('0x0'));var util=require(_0xe236('0x1'));var _=require(_0xe236('0x2'));var moment=require('moment');var Agent=require(_0xe236('0x3'));var Telephone=require(_0xe236('0x4'));var Trunk=require(_0xe236('0x5'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require('../model/trigger');var Template=require(_0xe236('0x6'));var Campaign=require(_0xe236('0x7'));var VoiceExtension=require(_0xe236('0x8'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xe236('0x9'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xe236('0xa'));var ZohoAccount=require(_0xe236('0xb'));var DeskAccount=require(_0xe236('0xc'));var VtigerAccount=require(_0xe236('0xd'));var ServicenowAccount=require(_0xe236('0xe'));var Dynamics365Account=require(_0xe236('0xf'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xe236('0x10'));var Realtime=function(){this[_0xe236('0x11')]={};this[_0xe236('0x12')]={};this[_0xe236('0x13')]={};this[_0xe236('0x14')]={};this[_0xe236('0x15')]={};this[_0xe236('0x16')]={};this['templates']={};this[_0xe236('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xe236('0x18')]={};this[_0xe236('0x19')]={};this['outboundChannels']={};this[_0xe236('0x1a')]={};this['settings']={};this[_0xe236('0x1b')]={};this[_0xe236('0x1c')]={};this[_0xe236('0x1d')]={};this[_0xe236('0x1e')]={};this[_0xe236('0x1f')]={};this[_0xe236('0x20')]={};this['vtigerAccounts']={};this[_0xe236('0x21')]={};this[_0xe236('0x22')]={};this[_0xe236('0x23')]={};this[_0xe236('0x24')]={};};function freeIsNotKey(_0x4a921f,_0x6daad5,_0x1c412e){var _0x469a72=_[_0xe236('0x25')](_0x4a921f,function(_0x15dcfc,_0x461167){return _0x15dcfc[_0x1c412e];});for(var _0x39868e in _0x6daad5){if(_0x6daad5['hasOwnProperty'](_0x39868e)){if(!_0x469a72[_0x39868e]){delete _0x6daad5[_0x39868e];}}}}function freeIsNotKeySip(_0x363114,_0x2ca741){var _0x28ed61=_['mapKeys'](_0x363114,function(_0x5e7810,_0x52ca14){return util[_0xe236('0x26')](_0xe236('0x27'),_0x5e7810[_0xe236('0x28')]);});for(var _0x329be6 in _0x2ca741){if(_0x2ca741[_0xe236('0x29')](_0x329be6)){if(!_0x28ed61[_0x329be6]){delete _0x2ca741[_0x329be6];}}}}function freeIsNotKeyAgent(_0x1e762b,_0x270589){var _0x4ddc18=_['mapKeys'](_0x1e762b,function(_0x552221,_0x205341){var _0x2269f6=_[_0xe236('0x2a')](_0x552221[_0xe236('0x2b')])?util[_0xe236('0x26')](_0xe236('0x27'),_0x552221[_0xe236('0x28')]):_0x552221[_0xe236('0x2b')];return _0x2269f6;});for(var _0xde323b in _0x270589){if(_0x270589[_0xe236('0x29')](_0xde323b)){if(!_0x4ddc18[_0xde323b]){delete _0x270589[_0xde323b];}}}}function clearVoiceCallReports(_0x1688d0){_0x1688d0[_0xe236('0x2c')]=0x0;_0x1688d0[_0xe236('0x2d')]=0x0;_0x1688d0[_0xe236('0x2e')]=0x0;_0x1688d0['sumDuration']=0x0;_0x1688d0[_0xe236('0x2f')]=0x0;}function clearCampaigns(_0x1ac328){if(!_['isEmpty'](_0x1ac328)){for(var _0x518826 in _0x1ac328){if(_0x1ac328[_0xe236('0x29')](_0x518826)){_0x1ac328[_0x518826][_0xe236('0x30')]=0x0;_0x1ac328[_0x518826][_0xe236('0x31')]=0x0;}}}}function clearVoiceQueues(_0x5ca2ef){if(!_['isEmpty'](_0x5ca2ef)){for(var _0x3fe081 in _0x5ca2ef){if(_0x5ca2ef[_0xe236('0x29')](_0x3fe081)){_0x5ca2ef[_0x3fe081][_0xe236('0x2c')]=0x0;_0x5ca2ef[_0x3fe081]['answered']=0x0;_0x5ca2ef[_0x3fe081][_0xe236('0x32')]=0x0;_0x5ca2ef[_0x3fe081]['abandoned']=0x0;_0x5ca2ef[_0x3fe081][_0xe236('0x2e')]=0x0;_0x5ca2ef[_0x3fe081]['sumDuration']=0x0;_0x5ca2ef[_0x3fe081][_0xe236('0x2f')]=0x0;_0x5ca2ef[_0x3fe081][_0xe236('0x33')]=0x0;_0x5ca2ef[_0x3fe081]['outboundNoAnswerCallsDay']=0x0;_0x5ca2ef[_0x3fe081][_0xe236('0x34')]=0x0;_0x5ca2ef[_0x3fe081][_0xe236('0x35')]=0x0;_0x5ca2ef[_0x3fe081]['outboundNoSuchCallsDay']=0x0;_0x5ca2ef[_0x3fe081][_0xe236('0x36')]=0x0;_0x5ca2ef[_0x3fe081][_0xe236('0x37')]=0x0;_0x5ca2ef[_0x3fe081][_0xe236('0x38')]=0x0;_0x5ca2ef[_0x3fe081][_0xe236('0x39')]=0x0;_0x5ca2ef[_0x3fe081][_0xe236('0x3a')]=0x0;_0x5ca2ef[_0x3fe081][_0xe236('0x3b')]=0x0;_0x5ca2ef[_0x3fe081][_0xe236('0x3c')]=0x0;_0x5ca2ef[_0x3fe081][_0xe236('0x33')]=0x0;_0x5ca2ef[_0x3fe081]['outboundAnswerCallsDay']=0x0;_0x5ca2ef[_0x3fe081]['queueStatusComplete']=!![];}}}}Realtime[_0xe236('0x3d')]['mergeFromDatabase']=function(_0x3b7e79,_0x52a546){for(var _0x4ea8e3 in _0x52a546){if(_0x3b7e79['hasOwnProperty'](_0x4ea8e3)){_0x3b7e79[_0x4ea8e3]=_0x52a546[_0x4ea8e3];}}};Realtime['prototype'][_0xe236('0x3e')]=function(){var _0x107722=this;return function(_0x177998){if(_0x177998){freeIsNotKeyAgent(_0x177998,_0x107722[_0xe236('0x11')]);for(var _0x43f621=0x0,_0x48c467={},_0x1e3610={};_0x43f621<_0x177998[_0xe236('0x3f')];_0x43f621+=0x1){_0x48c467=_0x177998[_0x43f621];var _0x4be651=_[_0xe236('0x2a')](_0x48c467['interface'])?util['format']('SIP/%s',_0x48c467[_0xe236('0x28')]):_0x48c467[_0xe236('0x2b')];if(_['isUndefined'](_0x107722[_0xe236('0x11')][_0x4be651])){_0x107722['agents'][_0x4be651]=new Agent(_0x48c467);}else{_0x107722['mergeFromDatabase'](_0x107722[_0xe236('0x11')][_0x4be651],_0x48c467);}}}return _0x107722[_0xe236('0x11')];};};Realtime[_0xe236('0x3d')]['initTelephones']=function(){var _0xb36518=this;return function(_0x464dd9){if(_0x464dd9){freeIsNotKeySip(_0x464dd9,_0xb36518[_0xe236('0x12')]);for(var _0x42004d=0x0,_0x216623={},_0x2dd55e={};_0x42004d<_0x464dd9[_0xe236('0x3f')];_0x42004d+=0x1){_0x216623=_0x464dd9[_0x42004d];if(_[_0xe236('0x40')](_0xb36518[_0xe236('0x12')][util['format'](_0xe236('0x27'),_0x216623['name'])])){_0xb36518[_0xe236('0x12')][util[_0xe236('0x26')](_0xe236('0x27'),_0x216623[_0xe236('0x28')])]=new Telephone(_0x216623);}else{_0xb36518['mergeFromDatabase'](_0xb36518[_0xe236('0x12')][util['format'](_0xe236('0x27'),_0x216623[_0xe236('0x28')])],_0x216623);}}}return _0xb36518[_0xe236('0x12')];};};Realtime[_0xe236('0x3d')]['initTrunks']=function(){var _0x20e0d6=this;return function(_0xf39a46){if(_0xf39a46){freeIsNotKeySip(_0xf39a46,_0x20e0d6[_0xe236('0x13')]);for(var _0x1927f6=0x0,_0x177fe7={},_0x424314={};_0x1927f6<_0xf39a46[_0xe236('0x3f')];_0x1927f6+=0x1){_0x177fe7=_0xf39a46[_0x1927f6];if(_[_0xe236('0x40')](_0x20e0d6[_0xe236('0x13')][util[_0xe236('0x26')](_0xe236('0x27'),_0x177fe7[_0xe236('0x28')])])){_0x20e0d6[_0xe236('0x13')][util['format'](_0xe236('0x27'),_0x177fe7['name'])]=new Trunk(_0x177fe7);}else{_0x20e0d6[_0xe236('0x41')](_0x20e0d6['trunks'][util['format'](_0xe236('0x27'),_0x177fe7[_0xe236('0x28')])],_0x177fe7);}}}return _0x20e0d6[_0xe236('0x13')];};};Realtime[_0xe236('0x3d')]['initVoiceQueues']=function(){var _0x3068f3=this;return function(_0x25fb4c){if(_0x25fb4c){freeIsNotKey(_0x25fb4c,_0x3068f3[_0xe236('0x14')],'name');for(var _0x2413cb=0x0,_0x5c35cd={},_0x253046={};_0x2413cb<_0x25fb4c[_0xe236('0x3f')];_0x2413cb+=0x1){_0x5c35cd=_0x25fb4c[_0x2413cb];if(_[_0xe236('0x40')](_0x3068f3[_0xe236('0x14')][_0x5c35cd[_0xe236('0x28')]])){_0x3068f3[_0xe236('0x14')][_0x5c35cd[_0xe236('0x28')]]=new VoiceQueue(_0x5c35cd);}else{_0x3068f3[_0xe236('0x41')](_0x3068f3[_0xe236('0x14')][_0x5c35cd[_0xe236('0x28')]],_0x5c35cd);}}}return _0x3068f3[_0xe236('0x14')];};};Realtime['prototype'][_0xe236('0x42')]=function(){var _0x5e1a7e=this;return function(_0x37c111){if(_0x37c111){freeIsNotKey(_0x37c111,_0x5e1a7e['triggers'],'id');for(var _0x370988=0x0,_0x4b033a={},_0xd90982={};_0x370988<_0x37c111[_0xe236('0x3f')];_0x370988+=0x1){_0x4b033a=_0x37c111[_0x370988];if(_[_0xe236('0x40')](_0x5e1a7e['triggers'][_0x4b033a['id']])){_0x5e1a7e[_0xe236('0x15')][_0x4b033a['id']]=new Trigger(_0x4b033a);}else{_0x5e1a7e[_0xe236('0x41')](_0x5e1a7e['triggers'][_0x4b033a['id']],_0x4b033a);}}}return _0x5e1a7e[_0xe236('0x15')];};};Realtime[_0xe236('0x3d')][_0xe236('0x43')]=function(){var _0x38c275=this;return function(_0x5d667d){if(_0x5d667d){freeIsNotKey(_0x5d667d,_0x38c275[_0xe236('0x44')],'id');for(var _0x4bd8e8=0x0,_0x263150={},_0x190113={};_0x4bd8e8<_0x5d667d[_0xe236('0x3f')];_0x4bd8e8+=0x1){_0x263150=_0x5d667d[_0x4bd8e8];if(_['isUndefined'](_0x38c275['templates'][_0x263150['id']])){_0x38c275[_0xe236('0x44')][_0x263150['id']]=new Template(_0x263150);}else{_0x38c275[_0xe236('0x41')](_0x38c275[_0xe236('0x44')][_0x263150['id']],_0x263150);}}}return _0x38c275[_0xe236('0x44')];};};Realtime[_0xe236('0x3d')][_0xe236('0x45')]=function(){var _0x4ad9de=this;return function(_0x59daf2){if(_0x59daf2){freeIsNotKey(_0x59daf2,_0x4ad9de[_0xe236('0x1b')],'id');for(var _0x360e1b=0x0,_0x52e032={},_0x415445={};_0x360e1b<_0x59daf2[_0xe236('0x3f')];_0x360e1b+=0x1){_0x52e032=_0x59daf2[_0x360e1b];if(_[_0xe236('0x40')](_0x4ad9de['zendeskAccounts'][_0x52e032['id']])){_0x4ad9de[_0xe236('0x1b')][_0x52e032['id']]=new ZendeskAccount(_0x52e032);}else{_0x4ad9de[_0xe236('0x41')](_0x4ad9de['zendeskAccounts'][_0x52e032['id']],_0x52e032);}}}return _0x4ad9de[_0xe236('0x1b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x1ae67c=this;return function(_0x4f5d48){if(_0x4f5d48){freeIsNotKey(_0x4f5d48,_0x1ae67c[_0xe236('0x1c')],'id');for(var _0x584f04=0x0,_0x446946={},_0x468055={};_0x584f04<_0x4f5d48['length'];_0x584f04+=0x1){_0x446946=_0x4f5d48[_0x584f04];if(_['isUndefined'](_0x1ae67c['salesforceAccounts'][_0x446946['id']])){_0x1ae67c['salesforceAccounts'][_0x446946['id']]=new SalesforceAccount(_0x446946);}else{_0x1ae67c['mergeFromDatabase'](_0x1ae67c['salesforceAccounts'][_0x446946['id']],_0x446946);}}}return _0x1ae67c[_0xe236('0x1c')];};};Realtime[_0xe236('0x3d')][_0xe236('0x46')]=function(){var _0x4512f9=this;return function(_0x5a48f1){if(_0x5a48f1){freeIsNotKey(_0x5a48f1,_0x4512f9[_0xe236('0x1e')],'id');for(var _0xb21088=0x0,_0x22ca4d={},_0x66ab9={};_0xb21088<_0x5a48f1[_0xe236('0x3f')];_0xb21088+=0x1){_0x22ca4d=_0x5a48f1[_0xb21088];if(_['isUndefined'](_0x4512f9[_0xe236('0x1e')][_0x22ca4d['id']])){_0x4512f9[_0xe236('0x1e')][_0x22ca4d['id']]=new FreshdeskAccount(_0x22ca4d);}else{_0x4512f9[_0xe236('0x41')](_0x4512f9[_0xe236('0x1e')][_0x22ca4d['id']],_0x22ca4d);}}}return _0x4512f9['freshdeskAccounts'];};};Realtime[_0xe236('0x3d')][_0xe236('0x47')]=function(){var _0x17d416=this;return function(_0x1ce7b2){if(_0x1ce7b2){freeIsNotKey(_0x1ce7b2,_0x17d416[_0xe236('0x1f')],'id');for(var _0x5defe3=0x0,_0x35ce92={},_0xa93d0d={};_0x5defe3<_0x1ce7b2[_0xe236('0x3f')];_0x5defe3+=0x1){_0x35ce92=_0x1ce7b2[_0x5defe3];if(_[_0xe236('0x40')](_0x17d416[_0xe236('0x1f')][_0x35ce92['id']])){_0x17d416[_0xe236('0x1f')][_0x35ce92['id']]=new ZohoAccount(_0x35ce92);}else{_0x17d416[_0xe236('0x41')](_0x17d416['zohoAccounts'][_0x35ce92['id']],_0x35ce92);}}}return _0x17d416[_0xe236('0x1f')];};};Realtime[_0xe236('0x3d')][_0xe236('0x48')]=function(){var _0x52671e=this;return function(_0x307ffa){if(_0x307ffa){freeIsNotKey(_0x307ffa,_0x52671e[_0xe236('0x20')],'id');for(var _0xfd6870=0x0,_0x3e1296={},_0x55bcff={};_0xfd6870<_0x307ffa[_0xe236('0x3f')];_0xfd6870+=0x1){_0x3e1296=_0x307ffa[_0xfd6870];if(_['isUndefined'](_0x52671e[_0xe236('0x20')][_0x3e1296['id']])){_0x52671e[_0xe236('0x20')][_0x3e1296['id']]=new DeskAccount(_0x3e1296);}else{_0x52671e[_0xe236('0x41')](_0x52671e[_0xe236('0x20')][_0x3e1296['id']],_0x3e1296);}}}return _0x52671e[_0xe236('0x20')];};};Realtime['prototype'][_0xe236('0x49')]=function(){var _0x4c8425=this;return function(_0x9dee28){if(_0x9dee28){freeIsNotKey(_0x9dee28,_0x4c8425[_0xe236('0x1d')],'id');for(var _0x5e42e9=0x0,_0x148981={},_0x10f322={};_0x5e42e9<_0x9dee28['length'];_0x5e42e9+=0x1){_0x148981=_0x9dee28[_0x5e42e9];if(_['isUndefined'](_0x4c8425[_0xe236('0x1d')][_0x148981['id']])){_0x4c8425[_0xe236('0x1d')][_0x148981['id']]=new SugarcrmAccount(_0x148981);}else{_0x4c8425[_0xe236('0x41')](_0x4c8425[_0xe236('0x1d')][_0x148981['id']],_0x148981);}}}return _0x4c8425['sugarcrmAccounts'];};};Realtime[_0xe236('0x3d')]['initVtigerAccounts']=function(){var _0x3b37ec=this;return function(_0x507d96){if(_0x507d96){freeIsNotKey(_0x507d96,_0x3b37ec[_0xe236('0x4a')],'id');for(var _0x300175=0x0,_0x132928={},_0x225ddc={};_0x300175<_0x507d96[_0xe236('0x3f')];_0x300175+=0x1){_0x132928=_0x507d96[_0x300175];if(_[_0xe236('0x40')](_0x3b37ec[_0xe236('0x4a')][_0x132928['id']])){_0x3b37ec[_0xe236('0x4a')][_0x132928['id']]=new VtigerAccount(_0x132928);}else{_0x3b37ec[_0xe236('0x41')](_0x3b37ec[_0xe236('0x4a')][_0x132928['id']],_0x132928);}}}return _0x3b37ec[_0xe236('0x4a')];};};Realtime[_0xe236('0x3d')]['initServicenowAccounts']=function(){var _0x2aab07=this;return function(_0x1b2e15){if(_0x1b2e15){freeIsNotKey(_0x1b2e15,_0x2aab07[_0xe236('0x21')],'id');for(var _0x4894af=0x0,_0x1acb4a={},_0x3f44e7={};_0x4894af<_0x1b2e15[_0xe236('0x3f')];_0x4894af+=0x1){_0x1acb4a=_0x1b2e15[_0x4894af];if(_[_0xe236('0x40')](_0x2aab07[_0xe236('0x21')][_0x1acb4a['id']])){_0x2aab07[_0xe236('0x21')][_0x1acb4a['id']]=new ServicenowAccount(_0x1acb4a);}else{_0x2aab07[_0xe236('0x41')](_0x2aab07[_0xe236('0x21')][_0x1acb4a['id']],_0x1acb4a);}}}return _0x2aab07[_0xe236('0x21')];};};Realtime[_0xe236('0x3d')][_0xe236('0x4b')]=function(){var _0x4cb88c=this;return function(_0x2583c5){if(_0x2583c5){freeIsNotKey(_0x2583c5,_0x4cb88c['dynamics365Accounts'],'id');for(var _0x1d1e4b=0x0,_0x31e590={},_0x4aa2e1={};_0x1d1e4b<_0x2583c5[_0xe236('0x3f')];_0x1d1e4b+=0x1){_0x31e590=_0x2583c5[_0x1d1e4b];if(_[_0xe236('0x40')](_0x4cb88c[_0xe236('0x22')][_0x31e590['id']])){_0x4cb88c[_0xe236('0x22')][_0x31e590['id']]=new Dynamics365Account(_0x31e590);}else{_0x4cb88c['mergeFromDatabase'](_0x4cb88c[_0xe236('0x22')][_0x31e590['id']],_0x31e590);}}}return _0x4cb88c[_0xe236('0x22')];};};Realtime[_0xe236('0x3d')][_0xe236('0x4c')]=function(){var _0x4ad330=this;return function(_0x30e8d3){if(_0x30e8d3){freeIsNotKey(_0x30e8d3,_0x4ad330['freshsalesAccounts'],'id');for(var _0x39b681=0x0,_0x439524={},_0x162517={};_0x39b681<_0x30e8d3[_0xe236('0x3f')];_0x39b681+=0x1){_0x439524=_0x30e8d3[_0x39b681];if(_[_0xe236('0x40')](_0x4ad330[_0xe236('0x23')][_0x439524['id']])){_0x4ad330[_0xe236('0x23')][_0x439524['id']]=new FreshsalesAccount(_0x439524);}else{_0x4ad330[_0xe236('0x41')](_0x4ad330[_0xe236('0x23')][_0x439524['id']],_0x439524);}}}return _0x4ad330[_0xe236('0x23')];};};Realtime[_0xe236('0x3d')][_0xe236('0x4d')]=function(){var _0x5a9a01=this;return function(_0x5c29b0){for(var _0x5bab93=0x0;_0x5bab93<_0x5c29b0[_0xe236('0x3f')];_0x5bab93+=0x1){_[_0xe236('0x4e')](_0x5a9a01[_0xe236('0x14')][_0x5c29b0[_0x5bab93]['name']],_0x5c29b0[_0x5bab93]);}return _0x5a9a01[_0xe236('0x14')];};};Realtime[_0xe236('0x3d')][_0xe236('0x4f')]=function(){var _0x40e221=this;return function(_0x4e894a){clearVoiceQueues(_0x40e221[_0xe236('0x14')]);if(_0x4e894a){_0x4e894a=_[_0xe236('0x50')](_0x4e894a,_0xe236('0x51'));for(var _0x260227 in _0x4e894a){if(_0x4e894a[_0xe236('0x29')](_0x260227)){var _0x322720={};for(var _0x32a15b=0x0;_0x32a15b<_0x4e894a[_0x260227][_0xe236('0x3f')];_0x32a15b+=0x1){var _0x1712d5=_0x4e894a[_0x260227][_0x32a15b][_0xe236('0x52')];if(_0x40e221[_0xe236('0x14')][_0x1712d5]){if(_0x4e894a[_0x260227][_0x32a15b][_0xe236('0x53')]){_0x40e221['voiceQueues'][_0x1712d5][_0xe236('0x32')]+=0x1;}if(_0x4e894a[_0x260227][_0x32a15b]['queuecallerabandon']){_0x40e221[_0xe236('0x14')][_0x1712d5][_0xe236('0x54')]+=0x1;}_0x40e221['voiceQueues'][_0x1712d5][_0xe236('0x2e')]+=moment(_0x4e894a[_0x260227][_0x32a15b][_0xe236('0x55')])[_0xe236('0x56')](moment(_0x4e894a[_0x260227][_0x32a15b]['queuecallerjoinAt']),_0xe236('0x57'))||0x0;if(_0x32a15b===_0x4e894a[_0x260227][_0xe236('0x3f')]-0x1){_0x40e221[_0xe236('0x14')][_0x1712d5]['sumDuration']+=moment(_0x4e894a[_0x260227][_0x32a15b][_0xe236('0x58')]||_0x4e894a[_0x260227][_0x32a15b][_0xe236('0x59')]||_0x4e894a[_0x260227][_0x32a15b][_0xe236('0x5a')])['diff'](moment(_0x4e894a[_0x260227][_0x32a15b][_0xe236('0x5b')]),'seconds')||0x0;_0x40e221['voiceQueues'][_0x1712d5][_0xe236('0x2c')]+=0x1;if(_0x4e894a[_0x260227][_0x32a15b][_0xe236('0x5c')]){_0x40e221[_0xe236('0x14')][_0x1712d5]['answered']+=0x1;_0x40e221['voiceQueues'][_0x1712d5][_0xe236('0x2f')]+=moment(_0x4e894a[_0x260227][_0x32a15b]['queuecallercompleteAt'])['diff'](moment(_0x4e894a[_0x260227][_0x32a15b][_0xe236('0x55')]),'seconds')||0x0;}}else{_0x40e221[_0xe236('0x14')][_0x1712d5][_0xe236('0x5d')]+=_0x40e221[_0xe236('0x14')][_0x1712d5][_0xe236('0x2e')]||0x0;}}}}}}return _0x40e221[_0xe236('0x14')];};};Realtime[_0xe236('0x3d')][_0xe236('0x5e')]=function(){var _0xfddcf8=this;return function(_0x1b31a){clearVoiceCallReports(_0xfddcf8[_0xe236('0x17')]);if(_0x1b31a){for(var _0x5d29b0=0x0;_0x5d29b0<_0x1b31a[_0xe236('0x3f')];_0x5d29b0+=0x1){_0xfddcf8[_0xe236('0x17')]['total']+=0x1;_0xfddcf8[_0xe236('0x17')][_0xe236('0x5d')]+=_0x1b31a[_0x5d29b0][_0xe236('0x5f')];if(_0x1b31a[_0x5d29b0][_0xe236('0x60')]===_0xe236('0x61')){_0xfddcf8[_0xe236('0x17')]['answered']+=0x1;_0xfddcf8['outbound']['sumHoldTime']+=_0x1b31a[_0x5d29b0]['duration']-_0x1b31a[_0x5d29b0][_0xe236('0x62')]||0x0;_0xfddcf8[_0xe236('0x17')][_0xe236('0x2f')]+=_0x1b31a[_0x5d29b0][_0xe236('0x62')];}}}return _0xfddcf8['outbound'];};};Realtime['prototype'][_0xe236('0x63')]=function(){var _0x20389d=this;return function(_0x1c37c3){if(_0x1c37c3){freeIsNotKey(_0x1c37c3,_0x20389d[_0xe236('0x16')],'name');for(var _0x186601=0x0,_0x45f6c5={};_0x186601<_0x1c37c3[_0xe236('0x3f')];_0x186601+=0x1){_0x45f6c5=_0x1c37c3[_0x186601];if(_[_0xe236('0x40')](_0x20389d[_0xe236('0x16')][_0x45f6c5[_0xe236('0x28')]])){_0x20389d[_0xe236('0x16')][_0x45f6c5['name']]=new Campaign(_0x45f6c5);}else{_0x20389d[_0xe236('0x41')](_0x20389d[_0xe236('0x16')][_0x45f6c5[_0xe236('0x28')]],_0x45f6c5);_0x20389d[_0xe236('0x16')][_0x45f6c5[_0xe236('0x28')]]['dialQueueProject']=_0x45f6c5[_0xe236('0x64')]?_0x45f6c5[_0xe236('0x64')][_0xe236('0x28')]:undefined;}}}return _0x20389d[_0xe236('0x16')];};};Realtime[_0xe236('0x3d')][_0xe236('0x65')]=function(){var _0x88105c=this;return function(_0xfacab2){if(_0xfacab2){freeIsNotKey(_0xfacab2,_0x88105c[_0xe236('0x66')],'id');for(var _0x2d3212=0x0,_0x1f1f2a={};_0x2d3212<_0xfacab2[_0xe236('0x3f')];_0x2d3212+=0x1){_0x1f1f2a=_0xfacab2[_0x2d3212];if(_['isUndefined'](_0x88105c[_0xe236('0x66')][_0x1f1f2a['id']])){_0x88105c[_0xe236('0x66')][_0x1f1f2a['id']]=new VoiceExtension(_0x1f1f2a);}else{_0x88105c[_0xe236('0x41')](_0x88105c['voiceExtensions'][_0x1f1f2a['id']],_0x1f1f2a);}}}return _0x88105c[_0xe236('0x66')];};};Realtime['prototype'][_0xe236('0x67')]=function(){var _0x4f03bc=this;return function(_0x21a13b){clearCampaigns(_0x4f03bc['campaigns']);for(var _0x41f8f1=0x0;_0x41f8f1<_0x21a13b[_0xe236('0x3f')];_0x41f8f1+=0x1){_['merge'](_0x4f03bc[_0xe236('0x16')][_0x21a13b[_0x41f8f1]['name']],_0x21a13b[_0x41f8f1]);}return _0x4f03bc[_0xe236('0x16')];};};Realtime['prototype'][_0xe236('0x68')]=function(){var _0x30dd02=this;return function(_0x2043ec){if(_0x2043ec){freeIsNotKey(_0x2043ec,_0x30dd02['faxAccounts'],'id');for(var _0x3f8105=0x0,_0x5bcc7c={},_0x37933f={};_0x3f8105<_0x2043ec[_0xe236('0x3f')];_0x3f8105+=0x1){_0x5bcc7c=_0x2043ec[_0x3f8105];if(_[_0xe236('0x40')](_0x30dd02[_0xe236('0x24')][_0x5bcc7c['id']])){_0x30dd02[_0xe236('0x24')][_0x5bcc7c['id']]=new FaxAccount(_0x5bcc7c);}else{_0x30dd02[_0xe236('0x41')](_0x30dd02['faxAccounts'][_0x5bcc7c['id']],_0x5bcc7c);}}}return _0x30dd02['faxAccounts'];};};module[_0xe236('0x69')]=Realtime; \ No newline at end of file +var _0x0745=['answered','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','length','initTelephones','isUndefined','initTrunks','initVoiceQueues','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','duration','disposition','ANSWERED','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','initFaxAccounts','faxAccounts','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','hasOwnProperty','mapKeys','format','SIP/%s','isNil','interface','name','total','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x0745,0xa4));var _0x5074=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x0745[_0x29d915];return _0x160f86;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require('lodash');var moment=require(_0x5074('0x0'));var Agent=require(_0x5074('0x1'));var Telephone=require(_0x5074('0x2'));var Trunk=require(_0x5074('0x3'));var VoiceQueue=require(_0x5074('0x4'));var Trigger=require(_0x5074('0x5'));var Template=require(_0x5074('0x6'));var Campaign=require(_0x5074('0x7'));var VoiceExtension=require(_0x5074('0x8'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x5074('0x9'));var SugarcrmAccount=require(_0x5074('0xa'));var ZohoAccount=require(_0x5074('0xb'));var DeskAccount=require(_0x5074('0xc'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x5074('0xd'));var FreshsalesAccount=require(_0x5074('0xe'));var FaxAccount=require(_0x5074('0xf'));var Realtime=function(){this[_0x5074('0x10')]={};this[_0x5074('0x11')]={};this[_0x5074('0x12')]={};this[_0x5074('0x13')]={};this[_0x5074('0x14')]={};this[_0x5074('0x15')]={};this[_0x5074('0x16')]={};this[_0x5074('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x5074('0x18')]={};this[_0x5074('0x19')]={};this[_0x5074('0x1a')]={};this[_0x5074('0x1b')]={};this['timers']={};this['settings']={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0x5074('0x1c')]={};this[_0x5074('0x1d')]={};this[_0x5074('0x1e')]={};this['deskAccounts']={};this[_0x5074('0x1f')]={};this[_0x5074('0x20')]={};this[_0x5074('0x21')]={};this['freshsalesAccounts']={};this['faxAccounts']={};};function freeIsNotKey(_0x149d76,_0x4e476c,_0x58620c){var _0x35d10b=_['mapKeys'](_0x149d76,function(_0xa0164,_0x42334a){return _0xa0164[_0x58620c];});for(var _0x498a77 in _0x4e476c){if(_0x4e476c[_0x5074('0x22')](_0x498a77)){if(!_0x35d10b[_0x498a77]){delete _0x4e476c[_0x498a77];}}}}function freeIsNotKeySip(_0x58302e,_0x178ee9){var _0xae6c76=_[_0x5074('0x23')](_0x58302e,function(_0x24f36e,_0x1367ba){return util[_0x5074('0x24')](_0x5074('0x25'),_0x24f36e['name']);});for(var _0x50ae80 in _0x178ee9){if(_0x178ee9[_0x5074('0x22')](_0x50ae80)){if(!_0xae6c76[_0x50ae80]){delete _0x178ee9[_0x50ae80];}}}}function freeIsNotKeyAgent(_0x4bb6b7,_0x4d6a90){var _0x4681be=_[_0x5074('0x23')](_0x4bb6b7,function(_0x3c1360,_0xd35f09){var _0x53bdfc=_[_0x5074('0x26')](_0x3c1360[_0x5074('0x27')])?util[_0x5074('0x24')](_0x5074('0x25'),_0x3c1360[_0x5074('0x28')]):_0x3c1360[_0x5074('0x27')];return _0x53bdfc;});for(var _0x80c234 in _0x4d6a90){if(_0x4d6a90[_0x5074('0x22')](_0x80c234)){if(!_0x4681be[_0x80c234]){delete _0x4d6a90[_0x80c234];}}}}function clearVoiceCallReports(_0x2b1c9d){_0x2b1c9d[_0x5074('0x29')]=0x0;_0x2b1c9d['answered']=0x0;_0x2b1c9d[_0x5074('0x2a')]=0x0;_0x2b1c9d[_0x5074('0x2b')]=0x0;_0x2b1c9d[_0x5074('0x2c')]=0x0;}function clearCampaigns(_0x3928ea){if(!_[_0x5074('0x2d')](_0x3928ea)){for(var _0x4418c9 in _0x3928ea){if(_0x3928ea[_0x5074('0x22')](_0x4418c9)){_0x3928ea[_0x4418c9][_0x5074('0x2e')]=0x0;_0x3928ea[_0x4418c9][_0x5074('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x246225){if(!_[_0x5074('0x2d')](_0x246225)){for(var _0x1d9265 in _0x246225){if(_0x246225[_0x5074('0x22')](_0x1d9265)){_0x246225[_0x1d9265][_0x5074('0x29')]=0x0;_0x246225[_0x1d9265][_0x5074('0x30')]=0x0;_0x246225[_0x1d9265][_0x5074('0x31')]=0x0;_0x246225[_0x1d9265][_0x5074('0x32')]=0x0;_0x246225[_0x1d9265][_0x5074('0x2a')]=0x0;_0x246225[_0x1d9265]['sumDuration']=0x0;_0x246225[_0x1d9265][_0x5074('0x2c')]=0x0;_0x246225[_0x1d9265][_0x5074('0x33')]=0x0;_0x246225[_0x1d9265][_0x5074('0x34')]=0x0;_0x246225[_0x1d9265][_0x5074('0x35')]=0x0;_0x246225[_0x1d9265]['outboundCongestionCallsDay']=0x0;_0x246225[_0x1d9265]['outboundNoSuchCallsDay']=0x0;_0x246225[_0x1d9265][_0x5074('0x36')]=0x0;_0x246225[_0x1d9265][_0x5074('0x37')]=0x0;_0x246225[_0x1d9265][_0x5074('0x38')]=0x0;_0x246225[_0x1d9265]['outboundBlacklistCallsDay']=0x0;_0x246225[_0x1d9265][_0x5074('0x39')]=0x0;_0x246225[_0x1d9265][_0x5074('0x3a')]=0x0;_0x246225[_0x1d9265][_0x5074('0x3b')]=0x0;_0x246225[_0x1d9265][_0x5074('0x33')]=0x0;_0x246225[_0x1d9265][_0x5074('0x3c')]=0x0;_0x246225[_0x1d9265][_0x5074('0x3d')]=!![];}}}}Realtime['prototype'][_0x5074('0x3e')]=function(_0x4e1c04,_0x279e8e){for(var _0xc9286b in _0x279e8e){if(_0x4e1c04[_0x5074('0x22')](_0xc9286b)){_0x4e1c04[_0xc9286b]=_0x279e8e[_0xc9286b];}}};Realtime[_0x5074('0x3f')]['initAgents']=function(){var _0x436110=this;return function(_0x57b5c0){if(_0x57b5c0){freeIsNotKeyAgent(_0x57b5c0,_0x436110[_0x5074('0x10')]);for(var _0x25f8ff=0x0,_0x27486e={},_0x5e586f={};_0x25f8ff<_0x57b5c0[_0x5074('0x40')];_0x25f8ff+=0x1){_0x27486e=_0x57b5c0[_0x25f8ff];var _0x6f8fac=_[_0x5074('0x26')](_0x27486e[_0x5074('0x27')])?util[_0x5074('0x24')]('SIP/%s',_0x27486e[_0x5074('0x28')]):_0x27486e[_0x5074('0x27')];if(_['isUndefined'](_0x436110[_0x5074('0x10')][_0x6f8fac])){_0x436110[_0x5074('0x10')][_0x6f8fac]=new Agent(_0x27486e);}else{_0x436110[_0x5074('0x3e')](_0x436110[_0x5074('0x10')][_0x6f8fac],_0x27486e);}}}return _0x436110[_0x5074('0x10')];};};Realtime[_0x5074('0x3f')][_0x5074('0x41')]=function(){var _0x24b67b=this;return function(_0x21b714){if(_0x21b714){freeIsNotKeySip(_0x21b714,_0x24b67b[_0x5074('0x11')]);for(var _0x193b93=0x0,_0x312480={},_0x529d8e={};_0x193b93<_0x21b714[_0x5074('0x40')];_0x193b93+=0x1){_0x312480=_0x21b714[_0x193b93];if(_[_0x5074('0x42')](_0x24b67b[_0x5074('0x11')][util[_0x5074('0x24')](_0x5074('0x25'),_0x312480[_0x5074('0x28')])])){_0x24b67b[_0x5074('0x11')][util[_0x5074('0x24')](_0x5074('0x25'),_0x312480[_0x5074('0x28')])]=new Telephone(_0x312480);}else{_0x24b67b[_0x5074('0x3e')](_0x24b67b[_0x5074('0x11')][util[_0x5074('0x24')](_0x5074('0x25'),_0x312480[_0x5074('0x28')])],_0x312480);}}}return _0x24b67b['telephones'];};};Realtime['prototype'][_0x5074('0x43')]=function(){var _0x1e7162=this;return function(_0x40a5d8){if(_0x40a5d8){freeIsNotKeySip(_0x40a5d8,_0x1e7162['trunks']);for(var _0xd04ed6=0x0,_0x955a7a={},_0x990d9c={};_0xd04ed6<_0x40a5d8['length'];_0xd04ed6+=0x1){_0x955a7a=_0x40a5d8[_0xd04ed6];if(_['isUndefined'](_0x1e7162['trunks'][util[_0x5074('0x24')](_0x5074('0x25'),_0x955a7a[_0x5074('0x28')])])){_0x1e7162['trunks'][util[_0x5074('0x24')](_0x5074('0x25'),_0x955a7a[_0x5074('0x28')])]=new Trunk(_0x955a7a);}else{_0x1e7162[_0x5074('0x3e')](_0x1e7162[_0x5074('0x12')][util[_0x5074('0x24')]('SIP/%s',_0x955a7a['name'])],_0x955a7a);}}}return _0x1e7162['trunks'];};};Realtime[_0x5074('0x3f')][_0x5074('0x44')]=function(){var _0x531923=this;return function(_0x27b82e){if(_0x27b82e){freeIsNotKey(_0x27b82e,_0x531923[_0x5074('0x13')],_0x5074('0x28'));for(var _0x14f0c2=0x0,_0x214a3d={},_0x5ad132={};_0x14f0c2<_0x27b82e[_0x5074('0x40')];_0x14f0c2+=0x1){_0x214a3d=_0x27b82e[_0x14f0c2];if(_['isUndefined'](_0x531923[_0x5074('0x13')][_0x214a3d[_0x5074('0x28')]])){_0x531923[_0x5074('0x13')][_0x214a3d[_0x5074('0x28')]]=new VoiceQueue(_0x214a3d);}else{_0x531923[_0x5074('0x3e')](_0x531923[_0x5074('0x13')][_0x214a3d[_0x5074('0x28')]],_0x214a3d);}}}return _0x531923[_0x5074('0x13')];};};Realtime['prototype']['initTriggers']=function(){var _0x2f1052=this;return function(_0x136789){if(_0x136789){freeIsNotKey(_0x136789,_0x2f1052['triggers'],'id');for(var _0x582088=0x0,_0x16312f={},_0x4a4695={};_0x582088<_0x136789['length'];_0x582088+=0x1){_0x16312f=_0x136789[_0x582088];if(_[_0x5074('0x42')](_0x2f1052[_0x5074('0x14')][_0x16312f['id']])){_0x2f1052[_0x5074('0x14')][_0x16312f['id']]=new Trigger(_0x16312f);}else{_0x2f1052[_0x5074('0x3e')](_0x2f1052[_0x5074('0x14')][_0x16312f['id']],_0x16312f);}}}return _0x2f1052[_0x5074('0x14')];};};Realtime[_0x5074('0x3f')][_0x5074('0x45')]=function(){var _0x2aea7d=this;return function(_0x57c179){if(_0x57c179){freeIsNotKey(_0x57c179,_0x2aea7d['templates'],'id');for(var _0x3436a8=0x0,_0x38af17={},_0x3e9602={};_0x3436a8<_0x57c179[_0x5074('0x40')];_0x3436a8+=0x1){_0x38af17=_0x57c179[_0x3436a8];if(_[_0x5074('0x42')](_0x2aea7d[_0x5074('0x16')][_0x38af17['id']])){_0x2aea7d[_0x5074('0x16')][_0x38af17['id']]=new Template(_0x38af17);}else{_0x2aea7d['mergeFromDatabase'](_0x2aea7d[_0x5074('0x16')][_0x38af17['id']],_0x38af17);}}}return _0x2aea7d[_0x5074('0x16')];};};Realtime[_0x5074('0x3f')][_0x5074('0x46')]=function(){var _0x46cfb6=this;return function(_0xd93385){if(_0xd93385){freeIsNotKey(_0xd93385,_0x46cfb6[_0x5074('0x47')],'id');for(var _0x57cc99=0x0,_0x573b33={},_0x47b7b8={};_0x57cc99<_0xd93385[_0x5074('0x40')];_0x57cc99+=0x1){_0x573b33=_0xd93385[_0x57cc99];if(_[_0x5074('0x42')](_0x46cfb6[_0x5074('0x47')][_0x573b33['id']])){_0x46cfb6[_0x5074('0x47')][_0x573b33['id']]=new ZendeskAccount(_0x573b33);}else{_0x46cfb6[_0x5074('0x3e')](_0x46cfb6[_0x5074('0x47')][_0x573b33['id']],_0x573b33);}}}return _0x46cfb6['zendeskAccounts'];};};Realtime[_0x5074('0x3f')][_0x5074('0x48')]=function(){var _0x417726=this;return function(_0x59a7c7){if(_0x59a7c7){freeIsNotKey(_0x59a7c7,_0x417726['salesforceAccounts'],'id');for(var _0x5e2fd1=0x0,_0x103faa={},_0x41724b={};_0x5e2fd1<_0x59a7c7[_0x5074('0x40')];_0x5e2fd1+=0x1){_0x103faa=_0x59a7c7[_0x5e2fd1];if(_['isUndefined'](_0x417726[_0x5074('0x49')][_0x103faa['id']])){_0x417726[_0x5074('0x49')][_0x103faa['id']]=new SalesforceAccount(_0x103faa);}else{_0x417726[_0x5074('0x3e')](_0x417726[_0x5074('0x49')][_0x103faa['id']],_0x103faa);}}}return _0x417726['salesforceAccounts'];};};Realtime[_0x5074('0x3f')][_0x5074('0x4a')]=function(){var _0x15d38e=this;return function(_0x59cdff){if(_0x59cdff){freeIsNotKey(_0x59cdff,_0x15d38e['freshdeskAccounts'],'id');for(var _0x32857d=0x0,_0x20dd81={},_0x99115b={};_0x32857d<_0x59cdff[_0x5074('0x40')];_0x32857d+=0x1){_0x20dd81=_0x59cdff[_0x32857d];if(_[_0x5074('0x42')](_0x15d38e[_0x5074('0x1d')][_0x20dd81['id']])){_0x15d38e[_0x5074('0x1d')][_0x20dd81['id']]=new FreshdeskAccount(_0x20dd81);}else{_0x15d38e[_0x5074('0x3e')](_0x15d38e['freshdeskAccounts'][_0x20dd81['id']],_0x20dd81);}}}return _0x15d38e['freshdeskAccounts'];};};Realtime[_0x5074('0x3f')][_0x5074('0x4b')]=function(){var _0x1b27da=this;return function(_0x33c19b){if(_0x33c19b){freeIsNotKey(_0x33c19b,_0x1b27da[_0x5074('0x1e')],'id');for(var _0x516f2a=0x0,_0x4fe2c3={},_0x3007c2={};_0x516f2a<_0x33c19b[_0x5074('0x40')];_0x516f2a+=0x1){_0x4fe2c3=_0x33c19b[_0x516f2a];if(_[_0x5074('0x42')](_0x1b27da['zohoAccounts'][_0x4fe2c3['id']])){_0x1b27da[_0x5074('0x1e')][_0x4fe2c3['id']]=new ZohoAccount(_0x4fe2c3);}else{_0x1b27da[_0x5074('0x3e')](_0x1b27da['zohoAccounts'][_0x4fe2c3['id']],_0x4fe2c3);}}}return _0x1b27da[_0x5074('0x1e')];};};Realtime['prototype'][_0x5074('0x4c')]=function(){var _0xb17551=this;return function(_0x2913fd){if(_0x2913fd){freeIsNotKey(_0x2913fd,_0xb17551[_0x5074('0x4d')],'id');for(var _0x24cc7b=0x0,_0x5466ee={},_0x246b7e={};_0x24cc7b<_0x2913fd[_0x5074('0x40')];_0x24cc7b+=0x1){_0x5466ee=_0x2913fd[_0x24cc7b];if(_[_0x5074('0x42')](_0xb17551[_0x5074('0x4d')][_0x5466ee['id']])){_0xb17551[_0x5074('0x4d')][_0x5466ee['id']]=new DeskAccount(_0x5466ee);}else{_0xb17551[_0x5074('0x3e')](_0xb17551['deskAccounts'][_0x5466ee['id']],_0x5466ee);}}}return _0xb17551[_0x5074('0x4d')];};};Realtime[_0x5074('0x3f')][_0x5074('0x4e')]=function(){var _0x5e88a3=this;return function(_0x1d5487){if(_0x1d5487){freeIsNotKey(_0x1d5487,_0x5e88a3[_0x5074('0x1c')],'id');for(var _0x1cd07c=0x0,_0x28e280={},_0x41f2ce={};_0x1cd07c<_0x1d5487['length'];_0x1cd07c+=0x1){_0x28e280=_0x1d5487[_0x1cd07c];if(_['isUndefined'](_0x5e88a3[_0x5074('0x1c')][_0x28e280['id']])){_0x5e88a3[_0x5074('0x1c')][_0x28e280['id']]=new SugarcrmAccount(_0x28e280);}else{_0x5e88a3[_0x5074('0x3e')](_0x5e88a3[_0x5074('0x1c')][_0x28e280['id']],_0x28e280);}}}return _0x5e88a3[_0x5074('0x1c')];};};Realtime['prototype'][_0x5074('0x4f')]=function(){var _0x530368=this;return function(_0xf33af8){if(_0xf33af8){freeIsNotKey(_0xf33af8,_0x530368['vtigerAccounts'],'id');for(var _0x23c734=0x0,_0x362198={},_0x17692e={};_0x23c734<_0xf33af8[_0x5074('0x40')];_0x23c734+=0x1){_0x362198=_0xf33af8[_0x23c734];if(_[_0x5074('0x42')](_0x530368[_0x5074('0x1f')][_0x362198['id']])){_0x530368[_0x5074('0x1f')][_0x362198['id']]=new VtigerAccount(_0x362198);}else{_0x530368[_0x5074('0x3e')](_0x530368[_0x5074('0x1f')][_0x362198['id']],_0x362198);}}}return _0x530368[_0x5074('0x1f')];};};Realtime[_0x5074('0x3f')]['initServicenowAccounts']=function(){var _0x30373f=this;return function(_0x18e679){if(_0x18e679){freeIsNotKey(_0x18e679,_0x30373f['servicenowAccounts'],'id');for(var _0x5121c2=0x0,_0x56e921={},_0xfd6a24={};_0x5121c2<_0x18e679[_0x5074('0x40')];_0x5121c2+=0x1){_0x56e921=_0x18e679[_0x5121c2];if(_['isUndefined'](_0x30373f[_0x5074('0x20')][_0x56e921['id']])){_0x30373f[_0x5074('0x20')][_0x56e921['id']]=new ServicenowAccount(_0x56e921);}else{_0x30373f[_0x5074('0x3e')](_0x30373f['servicenowAccounts'][_0x56e921['id']],_0x56e921);}}}return _0x30373f[_0x5074('0x20')];};};Realtime[_0x5074('0x3f')][_0x5074('0x50')]=function(){var _0x119e39=this;return function(_0x4edc53){if(_0x4edc53){freeIsNotKey(_0x4edc53,_0x119e39[_0x5074('0x21')],'id');for(var _0x128811=0x0,_0x5af4d8={},_0x20d158={};_0x128811<_0x4edc53[_0x5074('0x40')];_0x128811+=0x1){_0x5af4d8=_0x4edc53[_0x128811];if(_[_0x5074('0x42')](_0x119e39[_0x5074('0x21')][_0x5af4d8['id']])){_0x119e39[_0x5074('0x21')][_0x5af4d8['id']]=new Dynamics365Account(_0x5af4d8);}else{_0x119e39[_0x5074('0x3e')](_0x119e39['dynamics365Accounts'][_0x5af4d8['id']],_0x5af4d8);}}}return _0x119e39[_0x5074('0x21')];};};Realtime[_0x5074('0x3f')][_0x5074('0x51')]=function(){var _0x4c802c=this;return function(_0x3c898d){if(_0x3c898d){freeIsNotKey(_0x3c898d,_0x4c802c['freshsalesAccounts'],'id');for(var _0x5093fb=0x0,_0x453d71={},_0x4d1f60={};_0x5093fb<_0x3c898d[_0x5074('0x40')];_0x5093fb+=0x1){_0x453d71=_0x3c898d[_0x5093fb];if(_['isUndefined'](_0x4c802c['freshsalesAccounts'][_0x453d71['id']])){_0x4c802c['freshsalesAccounts'][_0x453d71['id']]=new FreshsalesAccount(_0x453d71);}else{_0x4c802c[_0x5074('0x3e')](_0x4c802c[_0x5074('0x52')][_0x453d71['id']],_0x453d71);}}}return _0x4c802c[_0x5074('0x52')];};};Realtime[_0x5074('0x3f')][_0x5074('0x53')]=function(){var _0x2f2653=this;return function(_0x327331){for(var _0x2354df=0x0;_0x2354df<_0x327331[_0x5074('0x40')];_0x2354df+=0x1){_[_0x5074('0x54')](_0x2f2653[_0x5074('0x13')][_0x327331[_0x2354df][_0x5074('0x28')]],_0x327331[_0x2354df]);}return _0x2f2653[_0x5074('0x13')];};};Realtime[_0x5074('0x3f')][_0x5074('0x55')]=function(){var _0x54aeb1=this;return function(_0x42c193){clearVoiceQueues(_0x54aeb1[_0x5074('0x13')]);if(_0x42c193){_0x42c193=_[_0x5074('0x56')](_0x42c193,_0x5074('0x57'));for(var _0x33c574 in _0x42c193){if(_0x42c193['hasOwnProperty'](_0x33c574)){var _0x488586={};for(var _0x5440d6=0x0;_0x5440d6<_0x42c193[_0x33c574][_0x5074('0x40')];_0x5440d6+=0x1){var _0x42ebbf=_0x42c193[_0x33c574][_0x5440d6][_0x5074('0x58')];if(_0x54aeb1['voiceQueues'][_0x42ebbf]){if(_0x42c193[_0x33c574][_0x5440d6][_0x5074('0x59')]){_0x54aeb1[_0x5074('0x13')][_0x42ebbf]['unmanaged']+=0x1;}if(_0x42c193[_0x33c574][_0x5440d6][_0x5074('0x5a')]){_0x54aeb1[_0x5074('0x13')][_0x42ebbf][_0x5074('0x32')]+=0x1;}_0x54aeb1[_0x5074('0x13')][_0x42ebbf][_0x5074('0x2a')]+=moment(_0x42c193[_0x33c574][_0x5440d6]['queuecallerleaveAt'])[_0x5074('0x5b')](moment(_0x42c193[_0x33c574][_0x5440d6]['queuecallerjoinAt']),_0x5074('0x5c'))||0x0;if(_0x5440d6===_0x42c193[_0x33c574][_0x5074('0x40')]-0x1){_0x54aeb1['voiceQueues'][_0x42ebbf][_0x5074('0x2b')]+=moment(_0x42c193[_0x33c574][_0x5440d6][_0x5074('0x5d')]||_0x42c193[_0x33c574][_0x5440d6]['queuecallerabandonAt']||_0x42c193[_0x33c574][_0x5440d6][_0x5074('0x5e')])['diff'](moment(_0x42c193[_0x33c574][_0x5440d6][_0x5074('0x5f')]),_0x5074('0x5c'))||0x0;_0x54aeb1[_0x5074('0x13')][_0x42ebbf][_0x5074('0x29')]+=0x1;if(_0x42c193[_0x33c574][_0x5440d6][_0x5074('0x60')]){_0x54aeb1[_0x5074('0x13')][_0x42ebbf][_0x5074('0x30')]+=0x1;_0x54aeb1[_0x5074('0x13')][_0x42ebbf][_0x5074('0x2c')]+=moment(_0x42c193[_0x33c574][_0x5440d6][_0x5074('0x5d')])[_0x5074('0x5b')](moment(_0x42c193[_0x33c574][_0x5440d6]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x54aeb1[_0x5074('0x13')][_0x42ebbf][_0x5074('0x2b')]+=_0x54aeb1[_0x5074('0x13')][_0x42ebbf][_0x5074('0x2a')]||0x0;}}}}}}return _0x54aeb1['voiceQueues'];};};Realtime[_0x5074('0x3f')]['initVoiceCallReports']=function(){var _0x13020a=this;return function(_0xf7ca82){clearVoiceCallReports(_0x13020a['outbound']);if(_0xf7ca82){for(var _0x567397=0x0;_0x567397<_0xf7ca82[_0x5074('0x40')];_0x567397+=0x1){_0x13020a[_0x5074('0x17')][_0x5074('0x29')]+=0x1;_0x13020a[_0x5074('0x17')][_0x5074('0x2b')]+=_0xf7ca82[_0x567397][_0x5074('0x61')];if(_0xf7ca82[_0x567397][_0x5074('0x62')]===_0x5074('0x63')){_0x13020a[_0x5074('0x17')][_0x5074('0x30')]+=0x1;_0x13020a[_0x5074('0x17')][_0x5074('0x2a')]+=_0xf7ca82[_0x567397][_0x5074('0x61')]-_0xf7ca82[_0x567397][_0x5074('0x64')]||0x0;_0x13020a['outbound']['sumBillable']+=_0xf7ca82[_0x567397][_0x5074('0x64')];}}}return _0x13020a['outbound'];};};Realtime['prototype']['initCampaigns']=function(){var _0x5ba451=this;return function(_0x1e3754){if(_0x1e3754){freeIsNotKey(_0x1e3754,_0x5ba451[_0x5074('0x15')],'name');for(var _0x509d2f=0x0,_0x9976b4={};_0x509d2f<_0x1e3754[_0x5074('0x40')];_0x509d2f+=0x1){_0x9976b4=_0x1e3754[_0x509d2f];if(_[_0x5074('0x42')](_0x5ba451[_0x5074('0x15')][_0x9976b4[_0x5074('0x28')]])){_0x5ba451[_0x5074('0x15')][_0x9976b4[_0x5074('0x28')]]=new Campaign(_0x9976b4);}else{_0x5ba451[_0x5074('0x3e')](_0x5ba451[_0x5074('0x15')][_0x9976b4[_0x5074('0x28')]],_0x9976b4);_0x5ba451[_0x5074('0x15')][_0x9976b4[_0x5074('0x28')]][_0x5074('0x65')]=_0x9976b4[_0x5074('0x66')]?_0x9976b4[_0x5074('0x66')]['name']:undefined;}}}return _0x5ba451[_0x5074('0x15')];};};Realtime[_0x5074('0x3f')][_0x5074('0x67')]=function(){var _0x100130=this;return function(_0x9f8f71){if(_0x9f8f71){freeIsNotKey(_0x9f8f71,_0x100130[_0x5074('0x18')],'id');for(var _0x198052=0x0,_0x49320b={};_0x198052<_0x9f8f71[_0x5074('0x40')];_0x198052+=0x1){_0x49320b=_0x9f8f71[_0x198052];if(_[_0x5074('0x42')](_0x100130['voiceExtensions'][_0x49320b['id']])){_0x100130[_0x5074('0x18')][_0x49320b['id']]=new VoiceExtension(_0x49320b);}else{_0x100130['mergeFromDatabase'](_0x100130[_0x5074('0x18')][_0x49320b['id']],_0x49320b);}}}return _0x100130[_0x5074('0x18')];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x412def=this;return function(_0x49fb19){clearCampaigns(_0x412def[_0x5074('0x15')]);for(var _0x4890cb=0x0;_0x4890cb<_0x49fb19[_0x5074('0x40')];_0x4890cb+=0x1){_[_0x5074('0x54')](_0x412def['campaigns'][_0x49fb19[_0x4890cb][_0x5074('0x28')]],_0x49fb19[_0x4890cb]);}return _0x412def[_0x5074('0x15')];};};Realtime[_0x5074('0x3f')][_0x5074('0x68')]=function(){var _0x3f5530=this;return function(_0x2e6b03){if(_0x2e6b03){freeIsNotKey(_0x2e6b03,_0x3f5530[_0x5074('0x69')],'id');for(var _0x4613ac=0x0,_0x7e728e={},_0x1d5b40={};_0x4613ac<_0x2e6b03[_0x5074('0x40')];_0x4613ac+=0x1){_0x7e728e=_0x2e6b03[_0x4613ac];if(_['isUndefined'](_0x3f5530[_0x5074('0x69')][_0x7e728e['id']])){_0x3f5530[_0x5074('0x69')][_0x7e728e['id']]=new FaxAccount(_0x7e728e);}else{_0x3f5530[_0x5074('0x3e')](_0x3f5530[_0x5074('0x69')][_0x7e728e['id']],_0x7e728e);}}}return _0x3f5530[_0x5074('0x69')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index f770375..e5f2dcf 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 _0x0d8a=['./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','findAgent','accountcode','name','isNil','find','interface','format','connectedlinenum','assigned','lastAssignedTo','SIP/%s','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','length','getCallType','calleridnum','destination','exten','type','dialer','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','channel','disposition','ANSWERED','\x22%s\x22\x20<%s>','linkedid','transfereelinkedid','uniqueid','split','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','calleridname','connectedlinename','isArray','forEach','startsWith','substring','indexOf','mobile','lastIndexOf','transfers','transfererlinkedid','attendedTransfer','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport'];(function(_0x2c50e4,_0x15cd2f){var _0x474118=function(_0xb0201){while(--_0xb0201){_0x2c50e4['push'](_0x2c50e4['shift']());}};_0x474118(++_0x15cd2f);}(_0x0d8a,0xae));var _0xa0d8=function(_0x4c8230,_0x2e7167){_0x4c8230=_0x4c8230-0x0;var _0x57f275=_0x0d8a[_0x4c8230];return _0x57f275;};'use strict';var _=require(_0xa0d8('0x0'));var moment=require(_0xa0d8('0x1'));var util=require(_0xa0d8('0x2'));var config=require(_0xa0d8('0x3'));var ami=require(_0xa0d8('0x4'));var RpcVoiceAgentReport=require(_0xa0d8('0x5'));var RpcVoiceCallReport=require(_0xa0d8('0x6'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xa0d8('0x7'));var RpcVoiceQueueReport=require(_0xa0d8('0x8'));var RpcVoiceRecording=require(_0xa0d8('0x9'));var RpcVoiceTransferReport=require(_0xa0d8('0xa'));var VoiceQueueReport=require(_0xa0d8('0xb'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xa0d8('0xc'));var VoiceDialReport=require(_0xa0d8('0xd'));var UserReport=require(_0xa0d8('0xe'));function Report(_0x11b525){this[_0xa0d8('0xf')]=_0x11b525;this[_0xa0d8('0x10')]=_0x11b525['agents'];this[_0xa0d8('0x11')]=_0x11b525['telephones'];}Report[_0xa0d8('0x12')][_0xa0d8('0x13')]=function(_0x2c73b2){var _0x2f4718=new VoiceQueueReport(this['realtime']);var _0x1c1dd0=new VoiceAgentReport(this[_0xa0d8('0xf')]);var _0x3e89bc=new VoiceDialReport(this[_0xa0d8('0xf')]);var _0x306070=new VoiceCallReport(this['realtime']);var _0x225f9f=new UserReport(this[_0xa0d8('0xf')]);if(config[_0xa0d8('0x14')]&&config[_0xa0d8('0x14')]['disabled']){ami['on'](_0xa0d8('0x15'),this[_0xa0d8('0x16')][_0xa0d8('0x17')](this));ami['on'](_0xa0d8('0x18'),this[_0xa0d8('0x19')][_0xa0d8('0x17')](this));ami['on'](_0xa0d8('0x1a'),this[_0xa0d8('0x1b')][_0xa0d8('0x17')](this));ami['on']('custom:voiceDialReport',this[_0xa0d8('0x1c')][_0xa0d8('0x17')](this));ami['on'](_0xa0d8('0x1d'),this[_0xa0d8('0x1e')][_0xa0d8('0x17')](this));ami['on'](_0xa0d8('0x1f'),this['attendedTransfer'][_0xa0d8('0x17')](this));}};Report['prototype'][_0xa0d8('0x20')]=function(_0x33106e){var _0x412b2b;_0x412b2b=_['find'](this[_0xa0d8('0x10')],function(_0x164767){return _0x164767[_0xa0d8('0x21')]==_0x33106e||_0x164767[_0xa0d8('0x22')]==_0x33106e;});if(_[_0xa0d8('0x23')](_0x412b2b)){var _0x3c076e=_[_0xa0d8('0x24')](this[_0xa0d8('0x11')],function(_0x18642a){return _0x18642a['accountcode']==_0x33106e||_0x18642a[_0xa0d8('0x22')]==_0x33106e;});if(_0x3c076e){_0x412b2b=_[_0xa0d8('0x24')](this[_0xa0d8('0x10')],function(_0x54ed07){return _0x54ed07[_0xa0d8('0x25')]==util[_0xa0d8('0x26')]('SIP/%s',_0x3c076e[_0xa0d8('0x22')]);});}}return _0x412b2b;};Report['prototype']['voiceQueueReport']=function(_0x1d64bf){for(var _0x3a7a3e=0x0;_0x3a7a3e<_0x1d64bf['length'];_0x3a7a3e+=0x1){var _0x2b32fa=this[_0xa0d8('0x20')](_0x1d64bf[_0x3a7a3e][_0xa0d8('0x27')]);if(_0x2b32fa){_0x1d64bf[_0x3a7a3e]['accountcode']=_0x2b32fa[_0xa0d8('0x21')];_0x1d64bf[_0x3a7a3e][_0xa0d8('0x28')]=!![];_0x1d64bf[_0x3a7a3e][_0xa0d8('0x29')]=_0x2b32fa[_0xa0d8('0x22')];_0x1d64bf[_0x3a7a3e][_0xa0d8('0x25')]=_[_0xa0d8('0x23')](_0x2b32fa['interface'])?util['format'](_0xa0d8('0x2a'),_0x2b32fa['name']):_0x2b32fa[_0xa0d8('0x25')];if(_0x1d64bf[_0x3a7a3e][_0xa0d8('0x2b')]){_0x1d64bf[_0x3a7a3e]['queuecallercompleteAt']=moment()['format'](_0xa0d8('0x2c'));}if(_0x1d64bf[_0x3a7a3e][_0xa0d8('0x2d')]){_0x1d64bf[_0x3a7a3e][_0xa0d8('0x2e')]=moment()[_0xa0d8('0x26')](_0xa0d8('0x2c'));}RpcMemberReport[_0xa0d8('0x16')](_0x1d64bf[_0x3a7a3e]);}RpcVoiceQueueReport[_0xa0d8('0x2f')](_0x1d64bf[_0x3a7a3e]);}};function extractCalleridNumber(_0x4082ca){var _0x19269b=_0x4082ca[_0xa0d8('0x30')](/<(.*?)>/);return _0x19269b?_0x19269b[0x1]:_0x4082ca;}Report['prototype'][_0xa0d8('0x31')]=function(_0x23934f){for(var _0x4dec1a=0x0;_0x4dec1a','calleridname','transfers','linkedid','uniqueid','UserId','membername','monitors','filename','createdAt','exten','connectedlinename','xcally-motion-dialer','isArray','forEach','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','SIP/%s','length','connectedlinenum','lastAssignedTo','interface','format','queuecallercomplete','queuecallerexit','YYYY-MM-DD\x20HH:mm:ss','create','match','getAgentByInternal','keys','getCallType','split','calleridnum','internal','destination','type','dialer'];(function(_0x2977ef,_0x3cf56c){var _0x30b4cc=function(_0x573d20){while(--_0x573d20){_0x2977ef['push'](_0x2977ef['shift']());}};_0x30b4cc(++_0x3cf56c);}(_0x9eef,0x81));var _0xf9ee=function(_0x4e0eb6,_0x240784){_0x4e0eb6=_0x4e0eb6-0x0;var _0x46e432=_0x9eef[_0x4e0eb6];return _0x46e432;};'use strict';var _=require(_0xf9ee('0x0'));var moment=require(_0xf9ee('0x1'));var util=require(_0xf9ee('0x2'));var config=require(_0xf9ee('0x3'));var ami=require(_0xf9ee('0x4'));var RpcVoiceAgentReport=require(_0xf9ee('0x5'));var RpcVoiceCallReport=require(_0xf9ee('0x6'));var RpcVoiceDialReport=require(_0xf9ee('0x7'));var RpcMemberReport=require(_0xf9ee('0x8'));var RpcVoiceQueueReport=require(_0xf9ee('0x9'));var RpcVoiceRecording=require(_0xf9ee('0xa'));var RpcVoiceTransferReport=require(_0xf9ee('0xb'));var VoiceQueueReport=require(_0xf9ee('0xc'));var VoiceCallReport=require(_0xf9ee('0xd'));var VoiceAgentReport=require(_0xf9ee('0xe'));var VoiceDialReport=require(_0xf9ee('0xf'));var UserReport=require('./userReport');function Report(_0x2406aa){this[_0xf9ee('0x10')]=_0x2406aa;this[_0xf9ee('0x11')]=_0x2406aa[_0xf9ee('0x11')];this[_0xf9ee('0x12')]=_0x2406aa[_0xf9ee('0x12')];}Report[_0xf9ee('0x13')][_0xf9ee('0x14')]=function(_0x5287a0){var _0x812d05=new VoiceQueueReport(this[_0xf9ee('0x10')]);var _0x1d5e18=new VoiceAgentReport(this[_0xf9ee('0x10')]);var _0x11fad5=new VoiceDialReport(this['realtime']);var _0x153f5a=new VoiceCallReport(this[_0xf9ee('0x10')]);var _0x4e2369=new UserReport(this['realtime']);if(config[_0xf9ee('0x15')]&&config[_0xf9ee('0x15')][_0xf9ee('0x16')]){ami['on'](_0xf9ee('0x17'),this[_0xf9ee('0x18')][_0xf9ee('0x19')](this));ami['on'](_0xf9ee('0x1a'),this[_0xf9ee('0x1b')][_0xf9ee('0x19')](this));ami['on']('custom:voiceAgentReport',this[_0xf9ee('0x1c')][_0xf9ee('0x19')](this));ami['on'](_0xf9ee('0x1d'),this[_0xf9ee('0x1e')]['bind'](this));ami['on']('blindtransfer',this[_0xf9ee('0x1f')][_0xf9ee('0x19')](this));ami['on'](_0xf9ee('0x20'),this[_0xf9ee('0x21')][_0xf9ee('0x19')](this));}};Report[_0xf9ee('0x13')][_0xf9ee('0x22')]=function(_0x17e1ca){var _0x5471d9;_0x5471d9=_[_0xf9ee('0x23')](this[_0xf9ee('0x11')],function(_0x144579){return _0x144579[_0xf9ee('0x24')]==_0x17e1ca||_0x144579[_0xf9ee('0x25')]==_0x17e1ca;});if(_[_0xf9ee('0x26')](_0x5471d9)){var _0x3de60a=_[_0xf9ee('0x23')](this['telephones'],function(_0x4b095f){return _0x4b095f[_0xf9ee('0x24')]==_0x17e1ca||_0x4b095f[_0xf9ee('0x25')]==_0x17e1ca;});if(_0x3de60a){_0x5471d9=_[_0xf9ee('0x23')](this['agents'],function(_0x3770b3){return _0x3770b3['interface']==util['format'](_0xf9ee('0x27'),_0x3de60a[_0xf9ee('0x25')]);});}}return _0x5471d9;};Report[_0xf9ee('0x13')][_0xf9ee('0x18')]=function(_0x35b0f5){for(var _0x31994f=0x0;_0x31994f<_0x35b0f5[_0xf9ee('0x28')];_0x31994f+=0x1){var _0x479257=this[_0xf9ee('0x22')](_0x35b0f5[_0x31994f][_0xf9ee('0x29')]);if(_0x479257){_0x35b0f5[_0x31994f][_0xf9ee('0x24')]=_0x479257[_0xf9ee('0x24')];_0x35b0f5[_0x31994f]['assigned']=!![];_0x35b0f5[_0x31994f][_0xf9ee('0x2a')]=_0x479257[_0xf9ee('0x25')];_0x35b0f5[_0x31994f][_0xf9ee('0x2b')]=_['isNil'](_0x479257[_0xf9ee('0x2b')])?util[_0xf9ee('0x2c')](_0xf9ee('0x27'),_0x479257[_0xf9ee('0x25')]):_0x479257[_0xf9ee('0x2b')];if(_0x35b0f5[_0x31994f][_0xf9ee('0x2d')]){_0x35b0f5[_0x31994f]['queuecallercompleteAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x35b0f5[_0x31994f][_0xf9ee('0x2e')]){_0x35b0f5[_0x31994f]['queuecallerexitAt']=moment()['format'](_0xf9ee('0x2f'));}RpcMemberReport[_0xf9ee('0x18')](_0x35b0f5[_0x31994f]);}RpcVoiceQueueReport[_0xf9ee('0x30')](_0x35b0f5[_0x31994f]);}};function extractCalleridNumber(_0x36e49c){var _0x4af45e=_0x36e49c[_0xf9ee('0x31')](/<(.*?)>/);return _0x4af45e?_0x4af45e[0x1]:_0x36e49c;}Report['prototype'][_0xf9ee('0x32')]=function(_0x22bdd2){for(var _0x27cb01=0x0;_0x27cb010x0?_0x35097a:0x0;this[_0x977d('0xf')][_0x3c32c7[_0x977d('0x62')]][_0x977d('0x2b')]=this[_0x977d('0xf')][_0x3c32c7[_0x977d('0x62')]]['talking']>_[_0x977d('0x68')](_0x3c32c7[_0x977d('0x69')])?_[_0x977d('0x68')](_0x3c32c7[_0x977d('0x69')]):this[_0x977d('0xf')][_0x3c32c7[_0x977d('0x62')]]['talking'];this[_0x977d('0x6a')](this[_0x977d('0xf')][_0x3c32c7[_0x977d('0x62')]],'queuesummary');}logger[_0x977d('0x40')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util['inspect'](this['voiceQueues'][_0x3c32c7[_0x977d('0x62')]],{'showHidden':![],'depth':null}));ami[_0x977d('0x3e')](_0x977d('0x6b'),this[_0x977d('0xf')][_0x3c32c7[_0x977d('0x62')]]);}}}catch(_0x41bdd6){logger['error'](_0x977d('0x5f'),util['inspect'](_0x41bdd6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x977d('0x7')][_0x977d('0x16')]=function(_0x12a5f6){logger[_0x977d('0x40')](_0x977d('0x6c'),util[_0x977d('0x38')](_0x12a5f6,{'showHidden':![],'depth':null}));this[_0x977d('0x10')]=!![];};VoiceQueueReport[_0x977d('0x7')][_0x977d('0x6d')]=function(_0x11a1cd){try{if(this[_0x977d('0x61')](_0x11a1cd)){logger[_0x977d('0x40')]('[%s][voiceQueueReport][queuecallerjoin]',_0x11a1cd[_0x977d('0x48')],util[_0x977d('0x38')](_0x11a1cd,{'showHidden':![],'depth':null}));if(_[_0x977d('0x5c')](this[_0x977d('0xb')][_0x11a1cd['uniqueid']]))this[_0x977d('0xb')][_0x11a1cd[_0x977d('0x48')]]=[];if(_[_0x977d('0x5c')](this['channels'][_0x11a1cd[_0x977d('0x48')]]))this['channels'][_0x11a1cd[_0x977d('0x48')]]={};var _0x49313b=new QueueReport();_0x49313b[_0x977d('0x44')]=_0x11a1cd[_0x977d('0x62')];_0x49313b['type']=this[_0x977d('0xf')][_0x49313b[_0x977d('0x44')]]&&this['voiceQueues'][_0x49313b['name']][_0x977d('0x49')]?this[_0x977d('0xf')][_0x49313b[_0x977d('0x44')]][_0x977d('0x49')]||_0x977d('0x4a'):_0x977d('0x4a');_0x49313b[_0x977d('0x62')]=_0x11a1cd['queue'];_0x49313b[_0x977d('0x6e')]=moment()[_0x977d('0x42')](_0x977d('0x6f'));_0x49313b[_0x977d('0x70')]=_0x11a1cd[_0x977d('0x70')];_0x49313b[_0x977d('0x71')]=_0x11a1cd['count'];_0x49313b[_0x977d('0x48')]=_0x11a1cd[_0x977d('0x48')];_0x49313b[_0x977d('0x72')]=this[_0x977d('0xd')][_0x11a1cd[_0x977d('0x48')]]['routealias'];logger['info'](_0x977d('0x73'),_0x49313b['name'],_0x49313b[_0x977d('0x49')]);_['merge'](_0x49313b,_['pick'](_0x11a1cd,_[_0x977d('0x74')](_0x49313b)));this[_0x977d('0xb')][_0x11a1cd['uniqueid']][_0x977d('0x75')](_0x49313b);this[_0x977d('0xd')][_0x11a1cd[_0x977d('0x48')]]=_0x49313b;this[_0x977d('0x3f')](_0x49313b,_0x977d('0x17'));}}catch(_0x4c5e2c){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x11a1cd[_0x977d('0x48')],util[_0x977d('0x38')](_0x4c5e2c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x977d('0x7')]['syncQueueCallerAbandon']=function(_0xc26029){try{if(this[_0x977d('0x61')](_0xc26029)){logger[_0x977d('0x40')](_0x977d('0x76'),_0xc26029[_0x977d('0x48')],util['inspect'](_0xc26029,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xc26029[_0x977d('0x48')]]){var _0x4b4733=_[_0x977d('0x77')](this['queueReports'][_0xc26029[_0x977d('0x48')]]);_0x4b4733[_0x977d('0x78')]=![];_0x4b4733[_0x977d('0x79')]=null;_0x4b4733[_0x977d('0x7a')]=_0xc26029[_0x977d('0x7a')];_0x4b4733[_0x977d('0x7b')]=_0xc26029[_0x977d('0x7b')];_0x4b4733['queuecallerabandon']=!![];_0x4b4733['queuecallerabandonAt']=moment()[_0x977d('0x42')](_0x977d('0x6f'));_0x4b4733['queuecallerexitreason']=_0x977d('0x7c');_0x4b4733[_0x977d('0x7d')]=null;logger[_0x977d('0x64')](_0x977d('0x7e'),_0x4b4733[_0x977d('0x44')],_0x4b4733[_0x977d('0x49')]);this[_0x977d('0xd')][_0xc26029[_0x977d('0x48')]]=_0x4b4733;this[_0x977d('0x3c')](_0x4b4733,'queuecallerabandon');}}}catch(_0x503526){logger[_0x977d('0x35')](_0x977d('0x76'),_0xc26029['uniqueid'],util['inspect'](_0x503526,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x977d('0x7')][_0x977d('0x1a')]=function(_0x5e9b82){try{if(this[_0x977d('0x61')](_0x5e9b82)){logger[_0x977d('0x40')]('[%s][voiceQueueReport][queuecallerleave]',_0x5e9b82[_0x977d('0x48')],util[_0x977d('0x38')](_0x5e9b82,{'showHidden':![],'depth':null}));if(this[_0x977d('0xb')][_0x5e9b82[_0x977d('0x48')]]){var _0x4081b5=_[_0x977d('0x77')](this[_0x977d('0xb')][_0x5e9b82[_0x977d('0x48')]]);_0x4081b5[_0x977d('0x7f')]=moment()[_0x977d('0x42')]('YYYY-MM-DD\x20HH:mm:ss');_0x4081b5['connectedlinenum']=_0x5e9b82[_0x977d('0x80')];_0x4081b5['connectedlinename']=_0x5e9b82[_0x977d('0x81')];logger[_0x977d('0x64')](_0x977d('0x82'),_0x4081b5['name'],_0x4081b5[_0x977d('0x49')],_0x5e9b82['connectedlinenum'],_0x5e9b82[_0x977d('0x81')]);this[_0x977d('0xd')][_0x5e9b82[_0x977d('0x48')]]=_0x4081b5;this[_0x977d('0x3f')](_0x4081b5,_0x977d('0x19'));}}}catch(_0x4f3af7){logger[_0x977d('0x35')](_0x977d('0x83'),_0x5e9b82[_0x977d('0x48')],util[_0x977d('0x38')](_0x4f3af7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x977d('0x7')][_0x977d('0x1e')]=function(_0x14a00c){try{if(this[_0x977d('0x61')](_0x14a00c)){logger[_0x977d('0x40')](_0x977d('0x84'),_0x14a00c[_0x977d('0x48')],util[_0x977d('0x38')](_0x14a00c,{'showHidden':![],'depth':null}));if(this[_0x977d('0xb')][_0x14a00c['uniqueid']]){var _0x46e4bb=_[_0x977d('0x77')](this['queueReports'][_0x14a00c['uniqueid']]);_0x46e4bb[_0x977d('0x78')]=!![];_0x46e4bb[_0x977d('0x85')]=_0x977d('0x86');logger[_0x977d('0x64')](_0x977d('0x87'),_0x46e4bb[_0x977d('0x44')],_0x46e4bb['type']);}}}catch(_0x1b4d63){logger[_0x977d('0x35')](_0x977d('0x84'),_0x14a00c['uniqueid'],util['inspect'](_0x1b4d63,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x977d('0x1c')]=function(_0x4f19a2){try{if(this[_0x977d('0x61')](_0x4f19a2)){logger[_0x977d('0x40')](_0x977d('0x88'),_0x4f19a2['uniqueid'],util['inspect'](_0x4f19a2,{'showHidden':![],'depth':null}));if(this[_0x977d('0xb')][_0x4f19a2[_0x977d('0x48')]]){var _0x45dfc2=_[_0x977d('0x77')](this[_0x977d('0xb')][_0x4f19a2[_0x977d('0x48')]]);_0x45dfc2[_0x977d('0x89')]=![];_0x45dfc2[_0x977d('0x8a')]=null;_0x45dfc2[_0x977d('0x8b')]=!![];_0x45dfc2['lastAssignedTo']=_0x4f19a2[_0x977d('0x8c')];_0x45dfc2['holdtime']=_0x4f19a2[_0x977d('0x7a')];_0x45dfc2[_0x977d('0x78')]=!![];_0x45dfc2[_0x977d('0x8d')]=![];_0x45dfc2[_0x977d('0x8e')]=null;if(!_0x45dfc2[_0x977d('0x8f')]){if(_0x4f19a2[_0x977d('0x90')]==_0x977d('0x8f')){_0x45dfc2[_0x977d('0x85')]=_0x977d('0x91');logger[_0x977d('0x64')](_0x977d('0x92'),_0x45dfc2[_0x977d('0x44')],_0x45dfc2[_0x977d('0x49')]);}else{if(_[_0x977d('0x93')](_0x4f19a2[_0x977d('0x94')][_0x977d('0x95')](),_0x977d('0x96'))){if(this[_0x977d('0xb')][_0x4f19a2[_0x977d('0x97')]]){var _0x11c562=_[_0x977d('0x77')](this[_0x977d('0xb')][_0x4f19a2['linkedid']]);_0x11c562[_0x977d('0x78')]=![];_0x11c562['queuecallerexit']=!![];_0x11c562[_0x977d('0x8e')]=moment(_0x45dfc2[_0x977d('0x6e')])[_0x977d('0x98')](_0x4f19a2['holdtime'],_0x977d('0x99'))[_0x977d('0x42')](_0x977d('0x6f'));_0x11c562[_0x977d('0x85')]=_0x977d('0x9a');_0x11c562[_0x977d('0x8f')]=!![];_0x11c562[_0x977d('0x9b')]='FORWARD';_0x11c562['transferexten']=_0x4f19a2[_0x977d('0x9c')];_0x11c562[_0x977d('0x9d')]=_0x4f19a2[_0x977d('0x48')];logger[_0x977d('0x64')](_0x977d('0x9e'),_0x11c562[_0x977d('0x44')],_0x11c562[_0x977d('0x49')]);var _0x22fc09=this[_0x977d('0xb')][_0x4f19a2[_0x977d('0x97')]];this[_0x977d('0xb')][_0x4f19a2[_0x977d('0x97')]]=this['queueReports'][_0x4f19a2[_0x977d('0x48')]];this['queueReports'][_0x4f19a2[_0x977d('0x48')]]=_0x22fc09;}}else{_0x45dfc2[_0x977d('0x85')]=_0x977d('0x9f')+_0x4f19a2[_0x977d('0x90')][_0x977d('0xa0')]();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x45dfc2[_0x977d('0x44')],_0x45dfc2[_0x977d('0x49')],_0x45dfc2[_0x977d('0x85')]);}}}this[_0x977d('0xd')][_0x4f19a2[_0x977d('0x48')]]=_0x45dfc2;this[_0x977d('0x3c')](_0x45dfc2,_0x977d('0x1b'));}}}catch(_0xd5ec5a){logger['error'](_0x977d('0x88'),_0x4f19a2[_0x977d('0x48')],util[_0x977d('0x38')](_0xd5ec5a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x977d('0x7')][_0x977d('0xa1')]=function(_0x1f11ac){try{if(this['isNotNull'](_0x1f11ac)){logger['debug']('[%s][voiceQueueReport][varset]',_0x1f11ac[_0x977d('0x48')],util[_0x977d('0x38')](_0x1f11ac,{'showHidden':![],'depth':null}));this['addVariable'](_0x1f11ac[_0x977d('0x48')],_[_0x977d('0x74')](_0x1f11ac[_0x977d('0xa2')])[0x0],_0x1f11ac['value']);if(this[_0x977d('0xb')][_0x1f11ac['uniqueid']]){var _0xb867c6=_['last'](this[_0x977d('0xb')][_0x1f11ac[_0x977d('0x48')]]);if(_0xb867c6){if(this[_0x977d('0x61')](_0x1f11ac[_0x977d('0xa2')])&&this[_0x977d('0x61')](_0x1f11ac[_0x977d('0xa2')]['queuestatus'])){switch(_0x1f11ac[_0x977d('0xa3')]){case _0x977d('0xa4'):_0xb867c6[_0x977d('0x8d')]=![];_0xb867c6[_0x977d('0x8e')]=null;break;case _0x977d('0xa5'):_0xb867c6[_0x977d('0xa6')]=_0x977d('0xa7');_0xb867c6['queuecallerexit']=!![];_0xb867c6['queuecallerexitAt']=moment()[_0x977d('0x42')]('YYYY-MM-DD\x20HH:mm:ss');_0xb867c6[_0x977d('0x7f')]=moment()[_0x977d('0x42')](_0x977d('0x6f'));logger[_0x977d('0x40')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x1f11ac['uniqueid'],util['inspect'](_0xb867c6,{'showHidden':![],'depth':null}));ami[_0x977d('0x3e')](_0x977d('0xa8'),_0xb867c6);break;default:_0xb867c6[_0x977d('0x8d')]=!![];_0xb867c6[_0x977d('0x8e')]=moment()['format'](_0x977d('0x6f'));_0xb867c6[_0x977d('0x7f')]=moment()[_0x977d('0x42')](_0x977d('0x6f'));}_0xb867c6[_0x977d('0x89')]=![];_0xb867c6['queuecallerabandonAt']=null;_0xb867c6[_0x977d('0x85')]=_0x1f11ac[_0x977d('0xa3')];this[_0x977d('0xd')][_0x1f11ac[_0x977d('0x48')]]=_0xb867c6;this[_0x977d('0x3c')](_0xb867c6,_0x977d('0x1f'));}else if(this[_0x977d('0x61')](_0x1f11ac[_0x977d('0xa2')])&&this['isNotNull'](_0x1f11ac[_0x977d('0xa2')]['queueposition'])){if(!_0xb867c6[_0x977d('0x89')]){_0xb867c6[_0x977d('0x8d')]=!![];_0xb867c6[_0x977d('0x8e')]=moment()[_0x977d('0x42')]('YYYY-MM-DD\x20HH:mm:ss');_0xb867c6[_0x977d('0x85')]=_0x977d('0xa9');_0xb867c6['queuecallerleaveAt']=moment()[_0x977d('0x42')](_0x977d('0x6f'));this[_0x977d('0xd')][_0x1f11ac['uniqueid']]=_0xb867c6;}}logger[_0x977d('0x64')](_0x977d('0xaa'),_0x1f11ac[_0x977d('0x48')],_0xb867c6[_0x977d('0x44')],_0xb867c6['type'],_[_0x977d('0x74')](_0x1f11ac[_0x977d('0xa2')])[0x0],_0x1f11ac[_0x977d('0xa3')]);_0xb867c6[_0x977d('0x12')]=this[_0x977d('0x12')][_0x1f11ac[_0x977d('0x48')]];}}}}catch(_0xf10d1c){logger[_0x977d('0x35')](_0x977d('0xab'),_0x1f11ac['uniqueid'],util[_0x977d('0x38')](_0xf10d1c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x977d('0x7')][_0x977d('0xac')]=function(_0x9da08e,_0x5cd48d,_0x5e4f7d){var _0x4fbd2c=['rtpaudioqos',_0x977d('0xad'),_0x977d('0xae'),_0x977d('0xaf'),'rtpaudioqosloss',_0x977d('0xb0'),_0x977d('0xb1'),_0x977d('0xb2'),_0x977d('0xb3'),_0x977d('0xb4'),_0x977d('0xb5'),_0x977d('0xb6'),'membercalls',_0x977d('0xb7'),_0x977d('0xb8'),_0x977d('0xb9'),'membername','memberpenalty','memberrealtime'];if(!_[_0x977d('0x31')](_0x5cd48d)&&!_[_0x977d('0xba')](_0x4fbd2c,_0x5cd48d)){if(_[_0x977d('0x5c')](this['variables'][_0x9da08e])){this[_0x977d('0x12')][_0x9da08e]={};}this[_0x977d('0x12')][_0x9da08e][_0x5cd48d]=_0x5e4f7d;}};VoiceQueueReport[_0x977d('0x7')][_0x977d('0x20')]=function(_0x3547d9){try{if(this[_0x977d('0x61')](_0x3547d9)){logger['debug'](_0x977d('0xbb'),_0x3547d9[_0x977d('0x48')],util[_0x977d('0x38')](_0x3547d9,{'showHidden':![],'depth':null}));if(this[_0x977d('0xb')][_0x3547d9['uniqueid']]){for(var _0x4a20b0=0x0,_0x2638a5={};_0x4a20b00x0?_0x255e4c:0x0;this[_0x0728('0x10')][_0x1bc6a8['queue']][_0x0728('0x2f')]=this['voiceQueues'][_0x1bc6a8[_0x0728('0x67')]]['talking']>_[_0x0728('0x6c')](_0x1bc6a8[_0x0728('0x6d')])?_[_0x0728('0x6c')](_0x1bc6a8[_0x0728('0x6d')]):this[_0x0728('0x10')][_0x1bc6a8['queue']][_0x0728('0x2f')];this[_0x0728('0x4d')](this[_0x0728('0x10')][_0x1bc6a8[_0x0728('0x67')]],_0x0728('0x13'));}logger['debug'](_0x0728('0x6e'),util[_0x0728('0x3c')](this[_0x0728('0x10')][_0x1bc6a8['queue']],{'showHidden':![],'depth':null}));ami[_0x0728('0x42')]('custom:queuesummary',this[_0x0728('0x10')][_0x1bc6a8['queue']]);}}}catch(_0x57d3b6){logger[_0x0728('0x3e')](_0x0728('0x65'),util[_0x0728('0x3c')](_0x57d3b6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0728('0xa')]['syncQueueSummaryComplete']=function(_0x1292ea){logger[_0x0728('0x49')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x0728('0x3c')](_0x1292ea,{'showHidden':![],'depth':null}));this[_0x0728('0x63')]=!![];};VoiceQueueReport[_0x0728('0xa')][_0x0728('0x6f')]=function(_0x15f9ac){try{if(this['isNotNull'](_0x15f9ac)){logger[_0x0728('0x49')]('[%s][voiceQueueReport][queuecallerjoin]',_0x15f9ac[_0x0728('0x43')],util[_0x0728('0x3c')](_0x15f9ac,{'showHidden':![],'depth':null}));if(_[_0x0728('0x70')](this['queueReports'][_0x15f9ac[_0x0728('0x43')]]))this['queueReports'][_0x15f9ac[_0x0728('0x43')]]=[];if(_[_0x0728('0x70')](this['channels'][_0x15f9ac['uniqueid']]))this[_0x0728('0x33')][_0x15f9ac['uniqueid']]={};var _0x44f6dd=new QueueReport();_0x44f6dd[_0x0728('0x46')]=_0x15f9ac[_0x0728('0x67')];_0x44f6dd['type']=this[_0x0728('0x10')][_0x44f6dd[_0x0728('0x46')]]&&this[_0x0728('0x10')][_0x44f6dd[_0x0728('0x46')]][_0x0728('0x57')]?this[_0x0728('0x10')][_0x44f6dd['name']][_0x0728('0x57')]||_0x0728('0x4e'):_0x0728('0x4e');_0x44f6dd[_0x0728('0x67')]=_0x15f9ac[_0x0728('0x67')];_0x44f6dd[_0x0728('0x71')]=moment()[_0x0728('0x44')](_0x0728('0x72'));_0x44f6dd[_0x0728('0x73')]=_0x15f9ac['position'];_0x44f6dd[_0x0728('0x74')]=_0x15f9ac['count'];_0x44f6dd[_0x0728('0x43')]=_0x15f9ac[_0x0728('0x43')];_0x44f6dd[_0x0728('0x75')]=this[_0x0728('0x33')][_0x15f9ac[_0x0728('0x43')]]['routealias'];logger[_0x0728('0x76')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x44f6dd['name'],_0x44f6dd['type']);_[_0x0728('0x77')](_0x44f6dd,_[_0x0728('0x78')](_0x15f9ac,_[_0x0728('0x79')](_0x44f6dd)));this['queueReports'][_0x15f9ac['uniqueid']]['push'](_0x44f6dd);this[_0x0728('0x33')][_0x15f9ac[_0x0728('0x43')]]=_0x44f6dd;this[_0x0728('0x7a')](_0x44f6dd,_0x0728('0x16'));}}catch(_0x125986){logger[_0x0728('0x3e')](_0x0728('0x7b'),_0x15f9ac[_0x0728('0x43')],util[_0x0728('0x3c')](_0x125986,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0728('0xa')][_0x0728('0x18')]=function(_0x7b045e){try{if(this[_0x0728('0x5f')](_0x7b045e)){logger['debug'](_0x0728('0x7c'),_0x7b045e[_0x0728('0x43')],util[_0x0728('0x3c')](_0x7b045e,{'showHidden':![],'depth':null}));if(this[_0x0728('0x3d')][_0x7b045e[_0x0728('0x43')]]){var _0x595dcb=_['last'](this[_0x0728('0x3d')][_0x7b045e[_0x0728('0x43')]]);_0x595dcb[_0x0728('0x7d')]=![];_0x595dcb['queuecallercompleteAt']=null;_0x595dcb[_0x0728('0x7e')]=_0x7b045e[_0x0728('0x7e')];_0x595dcb['originalposition']=_0x7b045e[_0x0728('0x7f')];_0x595dcb[_0x0728('0x17')]=!![];_0x595dcb[_0x0728('0x80')]=moment()[_0x0728('0x44')](_0x0728('0x72'));_0x595dcb[_0x0728('0x81')]=_0x0728('0x82');_0x595dcb[_0x0728('0x83')]=null;logger['info'](_0x0728('0x84'),_0x595dcb[_0x0728('0x46')],_0x595dcb[_0x0728('0x57')]);this['channels'][_0x7b045e[_0x0728('0x43')]]=_0x595dcb;this[_0x0728('0x41')](_0x595dcb,_0x0728('0x17'));}}}catch(_0x25bdf9){logger[_0x0728('0x3e')]('[%s][voiceQueueReport][queuecallerabandon]',_0x7b045e[_0x0728('0x43')],util[_0x0728('0x3c')](_0x25bdf9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0728('0xa')][_0x0728('0x1a')]=function(_0x3a6ec9){try{if(this[_0x0728('0x5f')](_0x3a6ec9)){logger[_0x0728('0x49')](_0x0728('0x85'),_0x3a6ec9['uniqueid'],util['inspect'](_0x3a6ec9,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3a6ec9[_0x0728('0x43')]]){var _0x479e44=_['last'](this['queueReports'][_0x3a6ec9[_0x0728('0x43')]]);_0x479e44[_0x0728('0x86')]=moment()[_0x0728('0x44')](_0x0728('0x72'));_0x479e44[_0x0728('0x87')]=_0x3a6ec9[_0x0728('0x87')];_0x479e44[_0x0728('0x88')]=_0x3a6ec9[_0x0728('0x88')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x479e44['name'],_0x479e44[_0x0728('0x57')],_0x3a6ec9[_0x0728('0x87')],_0x3a6ec9[_0x0728('0x88')]);this[_0x0728('0x33')][_0x3a6ec9['uniqueid']]=_0x479e44;this[_0x0728('0x7a')](_0x479e44,_0x0728('0x19'));}}}catch(_0x2a03b9){logger[_0x0728('0x3e')](_0x0728('0x85'),_0x3a6ec9['uniqueid'],util[_0x0728('0x3c')](_0x2a03b9,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0728('0x89')]=function(_0x25da44){try{if(this[_0x0728('0x5f')](_0x25da44)){logger[_0x0728('0x49')](_0x0728('0x8a'),_0x25da44['uniqueid'],util[_0x0728('0x3c')](_0x25da44,{'showHidden':![],'depth':null}));if(this[_0x0728('0x3d')][_0x25da44['uniqueid']]){var _0x3b70c4=_['last'](this['queueReports'][_0x25da44['uniqueid']]);_0x3b70c4['queuecallercomplete']=!![];_0x3b70c4[_0x0728('0x81')]=_0x0728('0x8b');logger[_0x0728('0x76')](_0x0728('0x8c'),_0x3b70c4['name'],_0x3b70c4[_0x0728('0x57')]);}}}catch(_0xe29ac9){logger[_0x0728('0x3e')]('[%s][voiceQueueReport][agentconnect]',_0x25da44['uniqueid'],util[_0x0728('0x3c')](_0xe29ac9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0728('0xa')][_0x0728('0x8d')]=function(_0x19751c){try{if(this[_0x0728('0x5f')](_0x19751c)){logger[_0x0728('0x49')](_0x0728('0x8e'),_0x19751c[_0x0728('0x43')],util[_0x0728('0x3c')](_0x19751c,{'showHidden':![],'depth':null}));if(this[_0x0728('0x3d')][_0x19751c[_0x0728('0x43')]]){var _0x2c17f7=_[_0x0728('0x8f')](this[_0x0728('0x3d')][_0x19751c[_0x0728('0x43')]]);_0x2c17f7[_0x0728('0x17')]=![];_0x2c17f7[_0x0728('0x80')]=null;_0x2c17f7[_0x0728('0x90')]=!![];_0x2c17f7[_0x0728('0x83')]=_0x19751c[_0x0728('0x91')];_0x2c17f7[_0x0728('0x7e')]=_0x19751c[_0x0728('0x7e')];_0x2c17f7['queuecallercomplete']=!![];_0x2c17f7[_0x0728('0x92')]=![];_0x2c17f7[_0x0728('0x93')]=null;if(!_0x2c17f7['transfer']){if(_0x19751c[_0x0728('0x94')]=='transfer'){_0x2c17f7[_0x0728('0x81')]=_0x0728('0x95');logger[_0x0728('0x76')](_0x0728('0x96'),_0x2c17f7[_0x0728('0x46')],_0x2c17f7[_0x0728('0x57')]);}else{if(_['startsWith'](_0x19751c[_0x0728('0x38')][_0x0728('0x97')](),_0x0728('0x98'))){if(this['queueReports'][_0x19751c[_0x0728('0x99')]]){var _0x1dfe71=_['last'](this[_0x0728('0x3d')][_0x19751c[_0x0728('0x99')]]);_0x1dfe71[_0x0728('0x7d')]=![];_0x1dfe71[_0x0728('0x92')]=!![];_0x1dfe71[_0x0728('0x93')]=moment(_0x2c17f7[_0x0728('0x71')])[_0x0728('0x9a')](_0x19751c['holdtime'],_0x0728('0x9b'))[_0x0728('0x44')](_0x0728('0x72'));_0x1dfe71[_0x0728('0x81')]=_0x0728('0x9c');_0x1dfe71['transfer']=!![];_0x1dfe71['transfertype']=_0x0728('0x9d');_0x1dfe71[_0x0728('0x9e')]=_0x19751c[_0x0728('0x9f')];_0x1dfe71[_0x0728('0xa0')]=_0x19751c[_0x0728('0x43')];logger[_0x0728('0x76')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x1dfe71[_0x0728('0x46')],_0x1dfe71[_0x0728('0x57')]);var _0x300375=this[_0x0728('0x3d')][_0x19751c[_0x0728('0x99')]];this[_0x0728('0x3d')][_0x19751c['linkedid']]=this[_0x0728('0x3d')][_0x19751c[_0x0728('0x43')]];this[_0x0728('0x3d')][_0x19751c[_0x0728('0x43')]]=_0x300375;}}else{_0x2c17f7[_0x0728('0x81')]=_0x0728('0xa1')+_0x19751c[_0x0728('0x94')]['toUpperCase']();logger[_0x0728('0x76')](_0x0728('0xa2'),_0x2c17f7[_0x0728('0x46')],_0x2c17f7['type'],_0x2c17f7[_0x0728('0x81')]);}}}this[_0x0728('0x33')][_0x19751c[_0x0728('0x43')]]=_0x2c17f7;this['emitVoiceQueueChannelRemove'](_0x2c17f7,_0x0728('0x1b'));}}}catch(_0x375d6a){logger[_0x0728('0x3e')](_0x0728('0x8e'),_0x19751c[_0x0728('0x43')],util[_0x0728('0x3c')](_0x375d6a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0728('0xa')][_0x0728('0xa3')]=function(_0x447dfd){try{if(this[_0x0728('0x5f')](_0x447dfd)){logger['debug'](_0x0728('0xa4'),_0x447dfd[_0x0728('0x43')],util[_0x0728('0x3c')](_0x447dfd,{'showHidden':![],'depth':null}));this[_0x0728('0xa5')](_0x447dfd[_0x0728('0x43')],_[_0x0728('0x79')](_0x447dfd[_0x0728('0xa6')])[0x0],_0x447dfd['value']);if(this[_0x0728('0x3d')][_0x447dfd[_0x0728('0x43')]]){var _0x3bdcf1=_[_0x0728('0x8f')](this[_0x0728('0x3d')][_0x447dfd[_0x0728('0x43')]]);if(_0x3bdcf1){if(this[_0x0728('0x5f')](_0x447dfd[_0x0728('0xa6')])&&this[_0x0728('0x5f')](_0x447dfd[_0x0728('0xa6')]['queuestatus'])){switch(_0x447dfd[_0x0728('0xa7')]){case _0x0728('0xa8'):_0x3bdcf1[_0x0728('0x92')]=![];_0x3bdcf1[_0x0728('0x93')]=null;break;case'TIMEOUT':_0x3bdcf1[_0x0728('0xa9')]=_0x0728('0xaa');_0x3bdcf1['queuecallerexit']=!![];_0x3bdcf1['queuecallerexitAt']=moment()[_0x0728('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x3bdcf1['queuecallerleaveAt']=moment()[_0x0728('0x44')](_0x0728('0x72'));logger[_0x0728('0x49')](_0x0728('0xab'),_0x447dfd['uniqueid'],util[_0x0728('0x3c')](_0x3bdcf1,{'showHidden':![],'depth':null}));ami[_0x0728('0x42')]('custom:timeout',_0x3bdcf1);break;default:_0x3bdcf1[_0x0728('0x92')]=!![];_0x3bdcf1[_0x0728('0x93')]=moment()[_0x0728('0x44')](_0x0728('0x72'));_0x3bdcf1[_0x0728('0x86')]=moment()[_0x0728('0x44')](_0x0728('0x72'));}_0x3bdcf1[_0x0728('0x17')]=![];_0x3bdcf1[_0x0728('0x80')]=null;_0x3bdcf1[_0x0728('0x81')]=_0x447dfd[_0x0728('0xa7')];this[_0x0728('0x33')][_0x447dfd[_0x0728('0x43')]]=_0x3bdcf1;this[_0x0728('0x41')](_0x3bdcf1,_0x0728('0xac'));}else if(this[_0x0728('0x5f')](_0x447dfd[_0x0728('0xa6')])&&this[_0x0728('0x5f')](_0x447dfd['variable']['queueposition'])){if(!_0x3bdcf1[_0x0728('0x17')]){_0x3bdcf1[_0x0728('0x92')]=!![];_0x3bdcf1[_0x0728('0x93')]=moment()[_0x0728('0x44')](_0x0728('0x72'));_0x3bdcf1[_0x0728('0x81')]='EXITWITHKEY';_0x3bdcf1[_0x0728('0x86')]=moment()[_0x0728('0x44')](_0x0728('0x72'));this['channels'][_0x447dfd[_0x0728('0x43')]]=_0x3bdcf1;}}logger[_0x0728('0x76')](_0x0728('0xad'),_0x447dfd[_0x0728('0x43')],_0x3bdcf1['name'],_0x3bdcf1[_0x0728('0x57')],_['keys'](_0x447dfd[_0x0728('0xa6')])[0x0],_0x447dfd[_0x0728('0xa7')]);_0x3bdcf1[_0x0728('0x12')]=this[_0x0728('0x12')][_0x447dfd[_0x0728('0x43')]];}}}}catch(_0x2c0a11){logger[_0x0728('0x3e')](_0x0728('0xa4'),_0x447dfd[_0x0728('0x43')],util['inspect'](_0x2c0a11,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0728('0xa5')]=function(_0x396572,_0x1ff074,_0x4e6379){var _0x44dab2=['rtpaudioqos',_0x0728('0xae'),'rtpaudioqosjitter',_0x0728('0xaf'),_0x0728('0xb0'),'rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged',_0x0728('0xb1'),_0x0728('0xb2'),_0x0728('0xb3'),_0x0728('0xb4'),_0x0728('0xb5'),_0x0728('0xb6'),_0x0728('0xb7'),_0x0728('0xb8'),_0x0728('0x91'),_0x0728('0xb9'),'memberrealtime'];if(!_[_0x0728('0x35')](_0x1ff074)&&!_[_0x0728('0xba')](_0x44dab2,_0x1ff074)){if(_['isUndefined'](this[_0x0728('0x12')][_0x396572])){this['variables'][_0x396572]={};}this[_0x0728('0x12')][_0x396572][_0x1ff074]=_0x4e6379;}};VoiceQueueReport[_0x0728('0xa')][_0x0728('0x1e')]=function(_0x4d3682){try{if(this[_0x0728('0x5f')](_0x4d3682)){logger['debug'](_0x0728('0xbb'),_0x4d3682[_0x0728('0x43')],util[_0x0728('0x3c')](_0x4d3682,{'showHidden':![],'depth':null}));if(this[_0x0728('0x3d')][_0x4d3682['uniqueid']]){for(var _0x938a8b=0x0,_0x446e02={};_0x938a8b=0x0?moment(_0x4444b5[_0xbc8d('0x1c')])[_0xbc8d('0xf')](_0x4444b5[_0xbc8d('0x1b')],_0xbc8d('0x10')):null,'data1':'outbound','data2':_0x4444b5[_0xbc8d('0x16')],'data3':_0x4444b5[_0xbc8d('0x13')],'data4':_0x4444b5[_0xbc8d('0x1d')]||null,'role':_0xbc8d('0x15'),'internal':_0x4444b5[_0xbc8d('0x16')]?_['toNumber'](_0x4444b5[_0xbc8d('0x16')]):undefined,'uniqueid':_0x4444b5[_0xbc8d('0x18')]},'log':_0xbc8d('0x7')});}; \ No newline at end of file +var _0x5a2b=['SIP/%s','diff','exten','queue','agent','accountcode','toNumber','uniqueid','membername','TALKING','starttime','endtime','outbound','dialstring','moment','lodash','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','interface','format'];(function(_0x45616f,_0xddc0dd){var _0xa3f0f8=function(_0x170c10){while(--_0x170c10){_0x45616f['push'](_0x45616f['shift']());}};_0xa3f0f8(++_0xddc0dd);}(_0x5a2b,0x16c));var _0xb5a2=function(_0x7aa2c5,_0x1e870a){_0x7aa2c5=_0x7aa2c5-0x0;var _0x4d933e=_0x5a2b[_0x7aa2c5];return _0x4d933e;};'use strict';var moment=require(_0xb5a2('0x0'));var _=require(_0xb5a2('0x1'));var util=require('util');var client=require('../client');exports[_0xb5a2('0x2')]=function(_0x5cf170){var _0x3d3a97=_0x5cf170[_0xb5a2('0x3')]||_0x5cf170[_0xb5a2('0x4')];return client[_0xb5a2('0x5')](_0xb5a2('0x6'),{'body':{'channel':_0xb5a2('0x7'),'membername':_0x5cf170[_0xb5a2('0x8')],'interface':_['isNil'](_0x5cf170[_0xb5a2('0x9')])?util[_0xb5a2('0xa')](_0xb5a2('0xb'),_0x5cf170[_0xb5a2('0x8')]):_0x5cf170[_0xb5a2('0x9')],'type':'TALKING','enterAt':_0x5cf170['queuecallerleaveAt'],'exitAt':_0x3d3a97,'duration':moment(_0x3d3a97)[_0xb5a2('0xc')](_0x5cf170['queuecallerleaveAt'],'seconds'),'data1':'inbound','data2':_0x5cf170['calleridnum'],'data3':_0x5cf170[_0xb5a2('0xd')],'data4':null,'data5':_0x5cf170[_0xb5a2('0xe')],'role':_0xb5a2('0xf'),'internal':_0x5cf170[_0xb5a2('0x10')]?_[_0xb5a2('0x11')](_0x5cf170['accountcode']):undefined,'uniqueid':_0x5cf170[_0xb5a2('0x12')]},'log':_0xb5a2('0x6')});};exports['voiceDialReport']=function(_0x4b69b2){return client[_0xb5a2('0x5')](_0xb5a2('0x6'),{'body':{'channel':_0xb5a2('0x7'),'membername':_0x4b69b2[_0xb5a2('0x13')],'interface':_0x4b69b2[_0xb5a2('0x9')],'type':_0xb5a2('0x14'),'enterAt':_0x4b69b2[_0xb5a2('0x15')],'exitAt':_0x4b69b2['endtime'],'duration':moment(_0x4b69b2[_0xb5a2('0x16')])['diff'](_0x4b69b2[_0xb5a2('0x15')],'seconds')>=0x0?moment(_0x4b69b2[_0xb5a2('0x16')])['diff'](_0x4b69b2[_0xb5a2('0x15')],'seconds'):null,'data1':_0xb5a2('0x17'),'data2':_0x4b69b2[_0xb5a2('0x10')],'data3':_0x4b69b2[_0xb5a2('0xd')],'data4':_0x4b69b2[_0xb5a2('0x18')]||null,'role':_0xb5a2('0xf'),'internal':_0x4b69b2[_0xb5a2('0x10')]?_[_0xb5a2('0x11')](_0x4b69b2['accountcode']):undefined,'uniqueid':_0x4b69b2[_0xb5a2('0x12')]},'log':_0xb5a2('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 96d41a4..566389d 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 _0xd01f=['stopRecordingOnTransfer','GetSettings','../client','Request'];(function(_0x379d04,_0x123f92){var _0x2d9897=function(_0x593902){while(--_0x593902){_0x379d04['push'](_0x379d04['shift']());}};_0x2d9897(++_0x123f92);}(_0xd01f,0x1d6));var _0xfd01=function(_0x25c7c5,_0x39a482){_0x25c7c5=_0x25c7c5-0x0;var _0x2f08bd=_0xd01f[_0x25c7c5];return _0x2f08bd;};'use strict';var client=require(_0xfd01('0x0'));exports['getSettings']=function(){return client[_0xfd01('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xfd01('0x2')]},'log':_0xfd01('0x3')});}; \ No newline at end of file +var _0x0bb5=['../client','getSettings','stopRecordingOnTransfer','GetSettings'];(function(_0x1a0967,_0x51bc82){var _0x5a169f=function(_0x43fda2){while(--_0x43fda2){_0x1a0967['push'](_0x1a0967['shift']());}};_0x5a169f(++_0x51bc82);}(_0x0bb5,0x148));var _0x50bb=function(_0x3b5f9b,_0x9015ee){_0x3b5f9b=_0x3b5f9b-0x0;var _0x48e627=_0x0bb5[_0x3b5f9b];return _0x48e627;};'use strict';var client=require(_0x50bb('0x0'));exports[_0x50bb('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x50bb('0x2')]},'log':_0x50bb('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index d68ea5f..bd9bd9a 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 _0x09b0=['Request','html','GetTemplate','../client'];(function(_0x1fdb22,_0x3f3832){var _0x27d33e=function(_0x18cfb7){while(--_0x18cfb7){_0x1fdb22['push'](_0x1fdb22['shift']());}};_0x27d33e(++_0x3f3832);}(_0x09b0,0x1f3));var _0x009b=function(_0x4fd6a9,_0x4ad37b){_0x4fd6a9=_0x4fd6a9-0x0;var _0xc02dcc=_0x09b0[_0x4fd6a9];return _0xc02dcc;};'use strict';var client=require(_0x009b('0x0'));exports['getTemplates']=function(_0x1c2fe2){return function(_0x5e6a50){return client[_0x009b('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id','name',_0x009b('0x2')]},'log':_0x009b('0x3')});};}; \ No newline at end of file +var _0x5081=['name','html','../client','getTemplates','Request','GetTemplate'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5081,0x1a0));var _0x1508=function(_0x2bbc39,_0x1bb4a0){_0x2bbc39=_0x2bbc39-0x0;var _0x47ad8a=_0x5081[_0x2bbc39];return _0x47ad8a;};'use strict';var client=require(_0x1508('0x0'));exports[_0x1508('0x1')]=function(_0x143338){return function(_0x29a6ba){return client[_0x1508('0x2')](_0x1508('0x3'),{'options':{'raw':!![],'attributes':['id',_0x1508('0x4'),_0x1508('0x5')]},'log':_0x1508('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index e3b273e..9267e49 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 _0x2207=['getTriggers','Request','channel','Condition','operator','field','value','Action','Actions','data1','data4','data6','GetTrigger','../client'];(function(_0x513ebc,_0x4ce279){var _0x49f9bd=function(_0x9ea59d){while(--_0x9ea59d){_0x513ebc['push'](_0x513ebc['shift']());}};_0x49f9bd(++_0x4ce279);}(_0x2207,0x15d));var _0x7220=function(_0x2a7d02,_0x136e24){_0x2a7d02=_0x2a7d02-0x0;var _0x3cd79d=_0x2207[_0x2a7d02];return _0x3cd79d;};'use strict';var client=require(_0x7220('0x0'));exports[_0x7220('0x1')]=function(_0xddd51f){return function(_0x5e3ad1){return client[_0x7220('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name',_0x7220('0x3'),'status'],'include':[{'model':_0x7220('0x4'),'as':'AllConditions','attributes':['id','field',_0x7220('0x5'),'value']},{'model':'Condition','as':'AnyConditions','attributes':['id',_0x7220('0x6'),_0x7220('0x5'),_0x7220('0x7')]},{'model':_0x7220('0x8'),'as':_0x7220('0x9'),'attributes':['id','action',_0x7220('0xa'),'data2','data3',_0x7220('0xb'),'data5',_0x7220('0xc'),'data7']}]},'log':_0x7220('0xd')});};}; \ No newline at end of file +var _0x3f97=['data6','data7','../client','Request','GetTrigger','Condition','AllConditions','operator','value','AnyConditions','Action','Actions','action','data1','data2','data4','data5'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x3f97,0x1ef));var _0x73f9=function(_0x1ba7b7,_0x16dafa){_0x1ba7b7=_0x1ba7b7-0x0;var _0x3dde3e=_0x3f97[_0x1ba7b7];return _0x3dde3e;};'use strict';var client=require(_0x73f9('0x0'));exports['getTriggers']=function(_0x3eee9a){return function(_0x1a651a){return client[_0x73f9('0x1')](_0x73f9('0x2'),{'options':{'raw':![],'attributes':['id','name','channel','status'],'include':[{'model':_0x73f9('0x3'),'as':_0x73f9('0x4'),'attributes':['id','field',_0x73f9('0x5'),_0x73f9('0x6')]},{'model':_0x73f9('0x3'),'as':_0x73f9('0x7'),'attributes':['id','field','operator','value']},{'model':_0x73f9('0x8'),'as':_0x73f9('0x9'),'attributes':['id',_0x73f9('0xa'),_0x73f9('0xb'),_0x73f9('0xc'),'data3',_0x73f9('0xd'),_0x73f9('0xe'),_0x73f9('0xf'),_0x73f9('0x10')]}]},'log':_0x73f9('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index a3dc7f3..9166924 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 _0x07bd=['getTrunks','Request','name','defaultuser','../client'];(function(_0x90da70,_0xac8f7c){var _0x5064a0=function(_0x3c748f){while(--_0x3c748f){_0x90da70['push'](_0x90da70['shift']());}};_0x5064a0(++_0xac8f7c);}(_0x07bd,0xea));var _0xd07b=function(_0x1e5b31,_0x2e4610){_0x1e5b31=_0x1e5b31-0x0;var _0x536484=_0x07bd[_0x1e5b31];return _0x536484;};'use strict';var client=require(_0xd07b('0x0'));exports[_0xd07b('0x1')]=function(_0x2bb395){return function(_0xfc5b94){return client[_0xd07b('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xd07b('0x3'),'registry',_0xd07b('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0xee39=['name','registry','defaultuser','../client','getTrunks','Request','GetTrunk'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee39,0x1e6));var _0x9ee3=function(_0x44bfc9,_0x6f7df4){_0x44bfc9=_0x44bfc9-0x0;var _0xb7eb53=_0xee39[_0x44bfc9];return _0xb7eb53;};'use strict';var client=require(_0x9ee3('0x0'));exports[_0x9ee3('0x1')]=function(_0xe604cf){return function(_0x58cf62){return client[_0x9ee3('0x2')](_0x9ee3('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x9ee3('0x4'),_0x9ee3('0x5'),_0x9ee3('0x6')]},'log':_0x9ee3('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index bd12598..bc12355 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 _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file +var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xe706,0xa3));var _0x6e70=function(_0x5ac7d7,_0x109040){_0x5ac7d7=_0x5ac7d7-0x0;var _0x23955f=_0xe706[_0x5ac7d7];return _0x23955f;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index ea20078..4796c09 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 _0xde06=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x27f44f,_0x3fae5f){var _0x4e703e=function(_0xecd11a){while(--_0xecd11a){_0x27f44f['push'](_0x27f44f['shift']());}};_0x4e703e(++_0x3fae5f);}(_0xde06,0x147));var _0x6de0=function(_0x1a0151,_0x478faf){_0x1a0151=_0x1a0151-0x0;var _0x5929c1=_0xde06[_0x1a0151];return _0x5929c1;};'use strict';var client=require(_0x6de0('0x0'));exports[_0x6de0('0x1')]=function(_0x2d57dc){return client[_0x6de0('0x2')](_0x6de0('0x3'),{'body':_0x2d57dc,'log':_0x6de0('0x3')});};exports[_0x6de0('0x4')]=function(_0xdfa8,_0x501a32,_0x1818bc){return client['Request'](_0x6de0('0x5'),{'body':_0xdfa8,'options':{'where':{'uniqueid':_0x501a32,'interface':_0x1818bc,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x67d8=['create','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x67d8,0x1cb));var _0x867d=function(_0x20c430,_0x442c41){_0x20c430=_0x20c430-0x0;var _0x108be8=_0x67d8[_0x20c430];return _0x108be8;};'use strict';var client=require(_0x867d('0x0'));exports[_0x867d('0x1')]=function(_0x33ea68){return client[_0x867d('0x2')](_0x867d('0x3'),{'body':_0x33ea68,'log':_0x867d('0x3')});};exports['update']=function(_0x257158,_0xc53776,_0x4531ce){return client['Request'](_0x867d('0x4'),{'body':_0x257158,'options':{'where':{'uniqueid':_0xc53776,'interface':_0x4531ce,'agentcomplete':!![]}},'log':_0x867d('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 9ea8b47..29e66bb 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 _0x2377=['YYYY-MM-DD\x20HH:mm:ss','endOf','day','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','calleridnum','context','callerid','outbound','startOf','format'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x2377,0x10b));var _0x7237=function(_0x9a2468,_0x214173){_0x9a2468=_0x9a2468-0x0;var _0x151f76=_0x2377[_0x9a2468];return _0x151f76;};'use strict';var moment=require(_0x7237('0x0'));var util=require(_0x7237('0x1'));var _=require(_0x7237('0x2'));var client=require(_0x7237('0x3'));exports[_0x7237('0x4')]=function(_0x25434e){return client[_0x7237('0x5')](_0x7237('0x6'),{'body':_['merge'](_0x25434e,{'source':_0x25434e[_0x7237('0x7')],'destinationcontext':_0x25434e[_0x7237('0x8')],'callerid':_0x25434e[_0x7237('0x9')],'amaflags':'DOCUMENTATION'}),'log':_0x7237('0x6')});};exports['getVoiceCallReports']=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0x7237('0xa')],'createdAt':{'$between':[moment()[_0x7237('0xb')]('day')[_0x7237('0xc')](_0x7237('0xd')),moment()[_0x7237('0xe')](_0x7237('0xf'))['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0x7237('0x10'),_0x7237('0x11'),_0x7237('0x12')]},'log':_0x7237('0x13')});};}; \ No newline at end of file +var _0x644e=['endOf','format','type','disposition','duration','GetVoiceCallReports','util','lodash','../client','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x644e,0x1bf));var _0xe644=function(_0x1e3fd1,_0x50c97){_0x1e3fd1=_0x1e3fd1-0x0;var _0x2d66a4=_0x644e[_0x1e3fd1];return _0x2d66a4;};'use strict';var moment=require('moment');var util=require(_0xe644('0x0'));var _=require(_0xe644('0x1'));var client=require(_0xe644('0x2'));exports['create']=function(_0x193031){return client['Request'](_0xe644('0x3'),{'body':_[_0xe644('0x4')](_0x193031,{'source':_0x193031[_0xe644('0x5')],'destinationcontext':_0x193031[_0xe644('0x6')],'callerid':_0x193031[_0xe644('0x7')],'amaflags':_0xe644('0x8')}),'log':_0xe644('0x3')});};exports[_0xe644('0x9')]=function(){return function(){return client['Request'](_0xe644('0xa'),{'options':{'where':{'type':[_0xe644('0xb')],'createdAt':{'$between':[moment()[_0xe644('0xc')](_0xe644('0xd'))['format'](_0xe644('0xe')),moment()[_0xe644('0xf')]('day')[_0xe644('0x10')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xe644('0x11'),_0xe644('0x12'),_0xe644('0x13'),'billableseconds']},'log':_0xe644('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 77cb6ed..bf7f0ac 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 _0x76df=['CreateVoiceDialReport','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x76df,0x101));var _0xf76d=function(_0x2b20c7,_0x278d49){_0x2b20c7=_0x2b20c7-0x0;var _0x3a6e02=_0x76df[_0x2b20c7];return _0x3a6e02;};'use strict';var client=require(_0xf76d('0x0'));exports['create']=function(_0x210753){return client['Request'](_0xf76d('0x1'),{'body':_0x210753,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0xa1f4=['Request','CreateVoiceDialReport','../client','create'];(function(_0x84d00a,_0x25b4d9){var _0x248972=function(_0x72e3f3){while(--_0x72e3f3){_0x84d00a['push'](_0x84d00a['shift']());}};_0x248972(++_0x25b4d9);}(_0xa1f4,0x16e));var _0x4a1f=function(_0x39eb8c,_0xbcc2c6){_0x39eb8c=_0x39eb8c-0x0;var _0x465513=_0xa1f4[_0x39eb8c];return _0x465513;};'use strict';var client=require(_0x4a1f('0x0'));exports[_0x4a1f('0x1')]=function(_0x22e987){return client[_0x4a1f('0x2')](_0x4a1f('0x3'),{'body':_0x22e987,'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 d5373b3..d0fa452 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 _0x6075=['GetVoiceExtension','exten','../client','getVoiceExtensions'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x6075,0x142));var _0x5607=function(_0x4a0c0c,_0x5e47ac){_0x4a0c0c=_0x4a0c0c-0x0;var _0x569d3d=_0x6075[_0x4a0c0c];return _0x569d3d;};'use strict';var client=require(_0x5607('0x0'));exports[_0x5607('0x1')]=function(){return function(){return client['Request'](_0x5607('0x2'),{'options':{'raw':!![],'attributes':['id',_0x5607('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xc901=['getVoiceExtensions','../client','recordingFormat'];(function(_0x211dac,_0x3ceeb3){var _0xbb1206=function(_0x5a9857){while(--_0x5a9857){_0x211dac['push'](_0x211dac['shift']());}};_0xbb1206(++_0x3ceeb3);}(_0xc901,0x142));var _0x1c90=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc901[_0x4a9fb1];return _0x348672;};'use strict';var client=require(_0x1c90('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten',_0x1c90('0x1')],'where':{'VoiceExtensionId':null}},'log':_0x1c90('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 50a7d57..6934acd 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 _0x2eb2=['dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','monitor_format','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt'];(function(_0x4fc2bc,_0x21d917){var _0x3e1cbe=function(_0x31ed4f){while(--_0x31ed4f){_0x4fc2bc['push'](_0x4fc2bc['shift']());}};_0x3e1cbe(++_0x21d917);}(_0x2eb2,0x19f));var _0x22eb=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x2eb2[_0x2cf2e9];return _0xd3670d;};'use strict';var client=require('../client');exports[_0x22eb('0x0')]=function(){return function(){return client[_0x22eb('0x1')](_0x22eb('0x2'),{'options':{'raw':![],'attributes':['id',_0x22eb('0x3'),_0x22eb('0x4'),_0x22eb('0x5'),'autopause',_0x22eb('0x6'),'type','dialActive',_0x22eb('0x7'),_0x22eb('0x8'),_0x22eb('0x9'),_0x22eb('0xa'),_0x22eb('0xb'),_0x22eb('0xc'),_0x22eb('0xd'),_0x22eb('0xe'),_0x22eb('0xf'),_0x22eb('0x10'),_0x22eb('0x11'),_0x22eb('0x12'),'dialQueueProject',_0x22eb('0x13'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0x22eb('0x14'),'dialNoAnswerMaxRetry',_0x22eb('0x15'),_0x22eb('0x16'),'dialTimezone','dialGlobalInterval',_0x22eb('0x17'),_0x22eb('0x18'),_0x22eb('0x19'),_0x22eb('0x1a'),_0x22eb('0x1b'),'dialAMDAfterGreetingSilence',_0x22eb('0x1c'),'dialAMDMinWordLength',_0x22eb('0x1d'),'dialAMDMaximumNumberOfWords',_0x22eb('0x1e'),_0x22eb('0x1f'),'timeout','dialRecallMeTimeout','dialRecallInQueue',_0x22eb('0x20'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0x22eb('0x21'),'monitor_format','strategy',_0x22eb('0x22'),_0x22eb('0x23'),_0x22eb('0x24'),_0x22eb('0x25'),_0x22eb('0x26'),'dialDropRetryFrequency',_0x22eb('0x27'),_0x22eb('0x28'),_0x22eb('0x29'),_0x22eb('0x2a'),_0x22eb('0x2b'),'dialAgentRejectRetryFrequency',_0x22eb('0x2c'),_0x22eb('0x2d'),_0x22eb('0x2e'),'dialPreviewAutoRecallMe'],'include':[{'model':'Trunk','as':_0x22eb('0x2f'),'attributes':['id',_0x22eb('0x3'),_0x22eb('0x30'),_0x22eb('0x31')]},{'model':_0x22eb('0x32'),'as':_0x22eb('0x33'),'attributes':['id',_0x22eb('0x3')]},{'model':'Trunk','as':_0x22eb('0x34'),'attributes':['id',_0x22eb('0x3'),_0x22eb('0x30'),_0x22eb('0x31')]},{'model':_0x22eb('0x35'),'as':'Interval','attributes':['id',_0x22eb('0x3')],'include':[{'model':_0x22eb('0x35'),'as':_0x22eb('0x36'),'attributes':['id','name',_0x22eb('0x37')]}]}]},'log':_0x22eb('0x0')});};}; \ No newline at end of file +var _0xf722=['dialQueueProject2','strategy','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','name','callerid','active','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient'];(function(_0x15fbf2,_0x4391e9){var _0x2ed78e=function(_0x44769f){while(--_0x44769f){_0x15fbf2['push'](_0x15fbf2['shift']());}};_0x2ed78e(++_0x4391e9);}(_0xf722,0x18f));var _0x2f72=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xf722[_0x5b644e];return _0x49c6bf;};'use strict';var client=require(_0x2f72('0x0'));exports[_0x2f72('0x1')]=function(){return function(){return client[_0x2f72('0x2')](_0x2f72('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x2f72('0x4'),_0x2f72('0x5'),_0x2f72('0x6'),_0x2f72('0x7'),'type',_0x2f72('0x8'),_0x2f72('0x9'),_0x2f72('0xa'),'dialLimitQueue','dialPowerLevel',_0x2f72('0xb'),_0x2f72('0xc'),_0x2f72('0xd'),_0x2f72('0xe'),_0x2f72('0xf'),_0x2f72('0x10'),_0x2f72('0x11'),_0x2f72('0x12'),_0x2f72('0x13'),_0x2f72('0x14'),_0x2f72('0x15'),_0x2f72('0x16'),_0x2f72('0x17'),_0x2f72('0x18'),'dialNoAnswerRetryFrequency',_0x2f72('0x19'),_0x2f72('0x1a'),_0x2f72('0x1b'),_0x2f72('0x1c'),_0x2f72('0x1d'),_0x2f72('0x1e'),_0x2f72('0x1f'),'dialAMDGreeting','dialAMDAfterGreetingSilence',_0x2f72('0x20'),_0x2f72('0x21'),'dialAMDBetweenWordsSilence',_0x2f72('0x22'),_0x2f72('0x23'),_0x2f72('0x24'),'timeout',_0x2f72('0x25'),_0x2f72('0x26'),_0x2f72('0x27'),_0x2f72('0x28'),_0x2f72('0x29'),_0x2f72('0x2a'),_0x2f72('0x7'),_0x2f72('0x2b'),'dialRandomLastDigitCallerIdNumber','dialCutDigit',_0x2f72('0x2c'),_0x2f72('0x2d'),_0x2f72('0x2e'),_0x2f72('0x2f'),'dialAbandonedMaxRetry','dialAbandonedRetryFrequency',_0x2f72('0x30'),_0x2f72('0x31'),'dialAgentRejectMaxRetry',_0x2f72('0x32'),_0x2f72('0x33'),'dialPredictiveIntervalMaxThreshold',_0x2f72('0x34'),_0x2f72('0x35')],'include':[{'model':_0x2f72('0x36'),'as':_0x2f72('0x36'),'attributes':['id',_0x2f72('0x37'),_0x2f72('0x38'),_0x2f72('0x39')]},{'model':'Pause','as':_0x2f72('0x3a'),'attributes':['id',_0x2f72('0x37')]},{'model':_0x2f72('0x36'),'as':_0x2f72('0x3b'),'attributes':['id',_0x2f72('0x37'),'callerid',_0x2f72('0x39')]},{'model':_0x2f72('0x3c'),'as':_0x2f72('0x3c'),'attributes':['id',_0x2f72('0x37')],'include':[{'model':'Interval','as':_0x2f72('0x3d'),'attributes':['id','name',_0x2f72('0x3e')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 2a62ce6..cb09600 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(_0x3dc482,_0x336615){var _0x2ddcb1=function(_0x41fb94){while(--_0x41fb94){_0x3dc482['push'](_0x3dc482['shift']());}};_0x2ddcb1(++_0x336615);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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(_0x331c90,_0x37d369){var _0x1543c7=function(_0x3a0b63){while(--_0x3a0b63){_0x331c90['push'](_0x331c90['shift']());}};_0x1543c7(++_0x37d369);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 b9a1dab..24497de 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 _0xcd04=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x24679e,_0x22d9d7){var _0x291f21=function(_0x329529){while(--_0x329529){_0x24679e['push'](_0x24679e['shift']());}};_0x291f21(++_0x22d9d7);}(_0xcd04,0xf8));var _0x4cd0=function(_0x39b9fe,_0x1cce03){_0x39b9fe=_0x39b9fe-0x0;var _0x3631d7=_0xcd04[_0x39b9fe];return _0x3631d7;};'use strict';var client=require(_0x4cd0('0x0'));exports[_0x4cd0('0x1')]=function(_0x5c89fe){return function(){return client[_0x4cd0('0x2')](_0x4cd0('0x3'),{'options':{'where':{'VoiceQueueId':_0x5c89fe,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xbf96=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','Request'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xbf96,0x1ea));var _0x6bf9=function(_0x5ebca9,_0x3a5167){_0x5ebca9=_0x5ebca9-0x0;var _0x34de42=_0xbf96[_0x5ebca9];return _0x34de42;};'use strict';var client=require('../client');exports[_0x6bf9('0x0')]=function(_0x33f8b8){return function(){return client[_0x6bf9('0x1')](_0x6bf9('0x2'),{'options':{'where':{'VoiceQueueId':_0x33f8b8,'paused':!![]},'raw':!![]},'log':_0x6bf9('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 1664ef2..fbfefd0 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x1f7b9e,_0x5111e9){var _0x1aec4f=function(_0x27da58){while(--_0x27da58){_0x1f7b9e['push'](_0x1f7b9e['shift']());}};_0x1aec4f(++_0x5111e9);}(_0x7a54,0x106));var _0x47a5=function(_0x2e16c1,_0x55c0b3){_0x2e16c1=_0x2e16c1-0x0;var _0x2440d7=_0x7a54[_0x2e16c1];return _0x2440d7;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x1efe94,_0x4b34c1){var _0x1d17cc=function(_0x429fc6){while(--_0x429fc6){_0x1efe94['push'](_0x1efe94['shift']());}};_0x1d17cc(++_0x4b34c1);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 49f784f..fb56691 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 _0xa70f=['../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transferercontext','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','blind','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended'];(function(_0x412686,_0x3fde24){var _0x18619e=function(_0x862bd1){while(--_0x862bd1){_0x412686['push'](_0x412686['shift']());}};_0x18619e(++_0x3fde24);}(_0xa70f,0xbe));var _0xfa70=function(_0x30df17,_0x235565){_0x30df17=_0x30df17-0x0;var _0x862b38=_0xa70f[_0x30df17];return _0x862b38;};'use strict';var client=require(_0xfa70('0x0'));exports['transfers']={};exports[_0xfa70('0x1')]=function(_0x59a86e){return client[_0xfa70('0x2')](_0xfa70('0x3'),{'body':{'result':_0x59a86e[_0xfa70('0x4')],'transfererchannel':_0x59a86e[_0xfa70('0x5')],'transferercalleridnum':_0x59a86e[_0xfa70('0x6')],'transferercalleridname':_0x59a86e[_0xfa70('0x7')],'transfererconnectedlinenum':_0x59a86e[_0xfa70('0x8')],'transfererconnectedlinename':_0x59a86e['transfererconnectedlinename'],'transfereraccountcode':_0x59a86e['transfereraccountcode'],'transferercontext':_0x59a86e[_0xfa70('0x9')],'transfererexten':_0x59a86e['transfererexten'],'transfererlinkedid':_0x59a86e[_0xfa70('0xa')],'transfereechannel':_0x59a86e['transfereechannel'],'transfereecalleridnum':_0x59a86e[_0xfa70('0xb')],'transfereecalleridname':_0x59a86e[_0xfa70('0xc')],'transfereeconnectedlinenum':_0x59a86e[_0xfa70('0xd')],'transfereeconnectedlinename':_0x59a86e[_0xfa70('0xe')],'transfereeaccountcode':_0x59a86e['transfereeaccountcode'],'transfereecontext':_0x59a86e[_0xfa70('0xf')],'transfereeexten':_0x59a86e[_0xfa70('0x10')],'transfereelinkedid':_0x59a86e[_0xfa70('0x11')],'isexternal':_0x59a86e[_0xfa70('0x12')],'context':_0x59a86e['context'],'extension':_0x59a86e[_0xfa70('0x13')],'type':_0xfa70('0x14')},'log':_0xfa70('0x3')});};exports['attendedTransfer']=function(_0x40d096){return client[_0xfa70('0x2')](_0xfa70('0x3'),{'body':{'result':_0x40d096[_0xfa70('0x4')],'transfererchannel':_0x40d096[_0xfa70('0x15')],'transferercalleridnum':_0x40d096[_0xfa70('0x16')],'transferercalleridname':_0x40d096[_0xfa70('0x17')],'transfererconnectedlinenum':_0x40d096[_0xfa70('0x18')],'transfererconnectedlinename':_0x40d096[_0xfa70('0x19')],'transfereraccountcode':_0x40d096['origtransfereraccountcode'],'transferercontext':_0x40d096[_0xfa70('0x1a')],'transfererexten':_0x40d096[_0xfa70('0x1b')],'transfererlinkedid':_0x40d096[_0xfa70('0x1c')],'transfereechannel':_0x40d096[_0xfa70('0x1d')],'transfereecalleridnum':_0x40d096[_0xfa70('0x1e')],'transfereecalleridname':_0x40d096[_0xfa70('0x1f')],'transfereeconnectedlinenum':_0x40d096[_0xfa70('0x20')],'transfereeconnectedlinename':_0x40d096['transfertargetconnectedlinename'],'transfereeaccountcode':_0x40d096[_0xfa70('0x21')],'transfereecontext':_0x40d096['transfertargetcontext'],'transfereeexten':_0x40d096[_0xfa70('0x22')],'transfereelinkedid':_0x40d096[_0xfa70('0x23')],'isexternal':_0x40d096[_0xfa70('0x12')],'context':_0x40d096['origtransferercontext'],'extension':_0x40d096[_0xfa70('0x24')],'type':_0xfa70('0x25')},'log':_0xfa70('0x3')});}; \ No newline at end of file +var _0xc35e=['extension','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer','Request','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','context'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xc35e,0x1a5));var _0xec35=function(_0x1fbe59,_0x45dd45){_0x1fbe59=_0x1fbe59-0x0;var _0x315b32=_0xc35e[_0x1fbe59];return _0x315b32;};'use strict';var client=require('../client');exports[_0xec35('0x0')]={};exports[_0xec35('0x1')]=function(_0x5a6037){return client[_0xec35('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x5a6037[_0xec35('0x3')],'transfererchannel':_0x5a6037['transfererchannel'],'transferercalleridnum':_0x5a6037[_0xec35('0x4')],'transferercalleridname':_0x5a6037[_0xec35('0x5')],'transfererconnectedlinenum':_0x5a6037[_0xec35('0x6')],'transfererconnectedlinename':_0x5a6037['transfererconnectedlinename'],'transfereraccountcode':_0x5a6037['transfereraccountcode'],'transferercontext':_0x5a6037[_0xec35('0x7')],'transfererexten':_0x5a6037[_0xec35('0x8')],'transfererlinkedid':_0x5a6037[_0xec35('0x9')],'transfereechannel':_0x5a6037[_0xec35('0xa')],'transfereecalleridnum':_0x5a6037[_0xec35('0xb')],'transfereecalleridname':_0x5a6037[_0xec35('0xc')],'transfereeconnectedlinenum':_0x5a6037[_0xec35('0xd')],'transfereeconnectedlinename':_0x5a6037[_0xec35('0xe')],'transfereeaccountcode':_0x5a6037['transfereeaccountcode'],'transfereecontext':_0x5a6037[_0xec35('0xf')],'transfereeexten':_0x5a6037[_0xec35('0x10')],'transfereelinkedid':_0x5a6037[_0xec35('0x11')],'isexternal':_0x5a6037['isexternal'],'context':_0x5a6037[_0xec35('0x12')],'extension':_0x5a6037[_0xec35('0x13')],'type':'blind'},'log':_0xec35('0x14')});};exports[_0xec35('0x15')]=function(_0x2cfa50){return client[_0xec35('0x2')](_0xec35('0x14'),{'body':{'result':_0x2cfa50[_0xec35('0x3')],'transfererchannel':_0x2cfa50[_0xec35('0x16')],'transferercalleridnum':_0x2cfa50[_0xec35('0x17')],'transferercalleridname':_0x2cfa50['origtransferercalleridname'],'transfererconnectedlinenum':_0x2cfa50['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2cfa50['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2cfa50[_0xec35('0x18')],'transferercontext':_0x2cfa50[_0xec35('0x19')],'transfererexten':_0x2cfa50[_0xec35('0x1a')],'transfererlinkedid':_0x2cfa50[_0xec35('0x1b')],'transfereechannel':_0x2cfa50['transfertargetchannel'],'transfereecalleridnum':_0x2cfa50[_0xec35('0x1c')],'transfereecalleridname':_0x2cfa50[_0xec35('0x1d')],'transfereeconnectedlinenum':_0x2cfa50[_0xec35('0x1e')],'transfereeconnectedlinename':_0x2cfa50[_0xec35('0x1f')],'transfereeaccountcode':_0x2cfa50[_0xec35('0x20')],'transfereecontext':_0x2cfa50[_0xec35('0x21')],'transfereeexten':_0x2cfa50[_0xec35('0x22')],'transfereelinkedid':_0x2cfa50[_0xec35('0x23')],'isexternal':_0x2cfa50[_0xec35('0x24')],'context':_0x2cfa50[_0xec35('0x25')],'extension':_0x2cfa50[_0xec35('0x26')],'type':_0xec35('0x27')},'log':_0xec35('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 2ec18cc..3ffc4a1 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 _0x90b1=['/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','rec','status','MixMonitor\x20Success','mixmonitorid','Channel\x20doesn\x27t\x20exist','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','trunks','outboundChannels','campaigns','run','event','emit','custom:','faxAccounts','send','server','http','listen','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','moment','../../../config/environment','../properties','../ami','%s/%s','SIP','name','timers','timer','agents','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Action','message','catch','command','Command','then','content','voiceQueues','strategy','available','loggedIn','pTalking','sumHoldTime','total','type','abandoned','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','undefined','values','channels','voicechannel','validate','map','uniqueid','channel','format','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors'];(function(_0x466721,_0x42de63){var _0x1ab0ba=function(_0x11f6b6){while(--_0x11f6b6){_0x466721['push'](_0x466721['shift']());}};_0x1ab0ba(++_0x42de63);}(_0x90b1,0x1bb));var _0x190b=function(_0x237f8b,_0xc5eddb){_0x237f8b=_0x237f8b-0x0;var _0x423f94=_0x90b1[_0x237f8b];return _0x423f94;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var jayson=require(_0x190b('0x2'));var schema=require('validate');var BPromise=require('bluebird');var moment=require(_0x190b('0x3'));var config=require(_0x190b('0x4'));var properties=require(_0x190b('0x5'));var ami=require(_0x190b('0x6'));exports['listen']=function(_0x4c355f,_0x5cbebb,_0x5da9c1){return new BPromise(function(_0x27ff8c,_0x34a689){var _0x3b57f7={'QueuePause':function(_0x626aa1){return new Promise(function(_0x311161,_0x802924){var _0x32c30c=util['format'](_0x190b('0x7'),_0x190b('0x8'),_0x626aa1[_0x190b('0x9')]);if(_0x4c355f[_0x190b('0xa')]&&_0x4c355f[_0x190b('0xa')][_0x32c30c]&&_0x4c355f[_0x190b('0xa')][_0x32c30c][_0x190b('0xb')]){_0x4c355f[_0x190b('0xa')][_0x32c30c]['updateAcw']();}if(_0x4c355f[_0x190b('0xc')][_0x32c30c]){_0x4c355f[_0x190b('0xc')][_0x32c30c]['updateStatusRealtime']({'statePause':_0x626aa1[_0x190b('0xd')]?!![]:![]});}_0x311161({'code':0xc8,'message':_0x190b('0xe')});});},'Reload':function(_0x286c81){var _0x40763c=this;return new Promise(function(_0x3cd4cd,_0x1e1fd5){if(ami[_0x190b('0xf')]()==![]){return _0x1e1fd5(_0x40763c[_0x190b('0x10')](0x1f4,[config[_0x190b('0x11')]['ip'],config[_0x190b('0x11')][_0x190b('0x12')],_0x190b('0x13')][_0x190b('0x14')]('\x20')));}_0x286c81=_[_0x190b('0x15')](_0x286c81,_[_0x190b('0x16')](properties[_0x190b('0x17')]));_0x286c81[_0x190b('0x18')]='Reload';return ami[_0x190b('0x19')](_0x286c81)['then'](function(_0x2a9323){_0x3cd4cd({'code':0xc8,'message':_0x2a9323[_0x190b('0x1a')]});})[_0x190b('0x1b')](function(_0x16c009){_0x1e1fd5(_0x40763c['error'](0x1f5,_0x16c009[_0x190b('0x1a')]));});});},'Command':function(_0x22d946){var _0x441a2b=this;return new Promise(function(_0x3c64d9,_0x1b5427){if(ami[_0x190b('0xf')]()==![]){return _0x1b5427(_0x441a2b['error'](0x1f4,[config[_0x190b('0x11')]['ip'],config[_0x190b('0x11')]['username'],_0x190b('0x13')]['join']('\x20')));}_0x22d946=_['pick'](_0x22d946,_0x190b('0x1c'));_0x22d946[_0x190b('0x18')]=_0x190b('0x1d');return ami['Action'](_0x22d946)[_0x190b('0x1e')](function(_0x2e633e){_0x3c64d9({'code':0xc8,'message':_0x2e633e[_0x190b('0x1f')]});})[_0x190b('0x1b')](function(_0x3b8c74){_0x1b5427(_0x441a2b[_0x190b('0x10')](0x1f5,_0x3b8c74[_0x190b('0x1a')]));});});},'VoiceQueues':function(_0x519a76){return new Promise(function(_0x55b1f5,_0x262a63){var _0x1a5f86=[];for(var _0x50605b in _0x4c355f['voiceQueues']){if(_0x4c355f[_0x190b('0x20')]['hasOwnProperty'](_0x50605b)){var _0x328e5e=_0x4c355f[_0x190b('0x20')][_0x50605b];var _0x51f8b4={'id':_0x328e5e['id'],'name':_0x328e5e[_0x190b('0x9')],'strategy':_0x328e5e[_0x190b('0x21')],'answered':_0x328e5e['answered'],'available':_0x328e5e[_0x190b('0x22')],'loggedIn':_0x328e5e[_0x190b('0x23')],'pTalking':_0x328e5e[_0x190b('0x24')],'sumBillable':_0x328e5e['sumBillable'],'sumDuration':_0x328e5e['sumDuration'],'sumHoldTime':_0x328e5e[_0x190b('0x25')]||0x0,'talking':_0x328e5e['talking'],'total':_0x328e5e[_0x190b('0x26')],'type':_0x328e5e[_0x190b('0x27')],'unmanaged':_0x328e5e['unmanaged'],'abandoned':_0x328e5e[_0x190b('0x28')],'waiting':_0x328e5e['waiting'],'loggedInDb':_0x328e5e[_0x190b('0x29')]};if(_0x328e5e['type']===_0x190b('0x2a')){_0x51f8b4['dialActive']=_0x328e5e[_0x190b('0x2b')];_0x51f8b4[_0x190b('0x2c')]=_0x328e5e['dialMethod'];_0x51f8b4[_0x190b('0x2d')]=_0x328e5e[_0x190b('0x2d')];_0x51f8b4[_0x190b('0x2e')]=_0x328e5e[_0x190b('0x2e')];_0x51f8b4[_0x190b('0x2f')]=_0x328e5e[_0x190b('0x2f')];_0x51f8b4[_0x190b('0x30')]=_0x328e5e[_0x190b('0x30')];_0x51f8b4['temp']=_0x328e5e['temp'];_0x51f8b4[_0x190b('0x31')]=_0x328e5e[_0x190b('0x31')];_0x51f8b4['outboundAnswerCallsDay']=_0x328e5e[_0x190b('0x32')];_0x51f8b4[_0x190b('0x33')]=_0x328e5e[_0x190b('0x33')];_0x51f8b4[_0x190b('0x34')]=_0x328e5e[_0x190b('0x34')];_0x51f8b4[_0x190b('0x35')]=_0x328e5e[_0x190b('0x35')];_0x51f8b4['outboundDropCallsDayACS']=_0x328e5e['outboundDropCallsDayACS'];_0x51f8b4[_0x190b('0x36')]=_0x328e5e[_0x190b('0x36')];_0x51f8b4[_0x190b('0x37')]=_0x328e5e['outboundDropCallsDayTimeout'];_0x51f8b4[_0x190b('0x38')]=_0x328e5e[_0x190b('0x38')];_0x51f8b4[_0x190b('0x39')]=_0x328e5e['outboundNoSuchCallsDay'];_0x51f8b4[_0x190b('0x3a')]=_0x328e5e['outboundOriginateFailureCallsDay'];_0x51f8b4['outboundReCallsDay']=_0x328e5e[_0x190b('0x3b')];_0x51f8b4[_0x190b('0x3c')]=_0x328e5e['outboundRejectCallsDay'];_0x51f8b4[_0x190b('0x3d')]=_0x328e5e[_0x190b('0x3d')];_0x51f8b4[_0x190b('0x3e')]=_0x328e5e['predictiveIntervalAnsweredCalls'];_0x51f8b4[_0x190b('0x3f')]=_0x328e5e[_0x190b('0x3f')];_0x51f8b4['predictiveIntervalAvgTalktime']=_0x328e5e['predictiveIntervalAvgTalktime'];_0x51f8b4[_0x190b('0x40')]=_0x328e5e['predictiveIntervalDroppedCallsCallersExit'];_0x51f8b4[_0x190b('0x41')]=_0x328e5e[_0x190b('0x41')];_0x51f8b4[_0x190b('0x42')]=_0x328e5e[_0x190b('0x42')];_0x51f8b4['predictiveIntervalErlangCallsDroppedCalls']=_0x328e5e[_0x190b('0x43')];_0x51f8b4['predictiveIntervalHitRate']=_0x328e5e[_0x190b('0x44')];_0x51f8b4[_0x190b('0x45')]=_0x328e5e['predictiveIntervalMultiplicativeFactor'];_0x51f8b4[_0x190b('0x46')]=_0x328e5e[_0x190b('0x46')];_0x51f8b4[_0x190b('0x47')]=_0x328e5e['predictiveIntervalAvailable'];_0x51f8b4[_0x190b('0x48')]=_0x328e5e['predictiveIntervalTotalCalls'];_0x51f8b4['message']=_0x328e5e['message'];_0x51f8b4[_0x190b('0x49')]=_0x328e5e[_0x190b('0x49')];_0x51f8b4[_0x190b('0x4a')]=_0x328e5e[_0x190b('0x4a')];_0x51f8b4['erlangCallToSecond']=_0x328e5e['erlangCallToSecond'];_0x51f8b4[_0x190b('0x4b')]=_0x328e5e['erlangAbandonmentRate'];_0x51f8b4[_0x190b('0x4c')]=_0x328e5e[_0x190b('0x4c')];_0x51f8b4['startPredictive']=_0x328e5e[_0x190b('0x4d')];_0x51f8b4[_0x190b('0x4e')]=_0x328e5e[_0x190b('0x4e')];}if(_0x328e5e['Trunk']){_0x51f8b4[_0x190b('0x4f')]={'id':_0x328e5e[_0x190b('0x4f')]['id'],'name':_0x328e5e['Trunk'][_0x190b('0x9')],'active':_0x328e5e['Trunk'][_0x190b('0x50')],'callerid':_0x328e5e[_0x190b('0x4f')][_0x190b('0x51')]};}if(_0x328e5e['Interval']){_0x51f8b4[_0x190b('0x52')]={'id':_0x328e5e['Interval']['id'],'name':_0x328e5e[_0x190b('0x52')][_0x190b('0x9')]};}_0x1a5f86[_0x190b('0x53')](_0x51f8b4);}}_0x55b1f5({'count':_0x1a5f86[_0x190b('0x54')],'rows':_0x1a5f86});});},'UpdateVoiceQueue':function(_0x263d1a){return new Promise(function(_0xe736d9,_0x10bb82){var _0x5deb30=_[_0x190b('0x55')](_0x4c355f[_0x190b('0x20')],{'id':parseInt(_0x263d1a['id'])});var _0x24a2a0=_['omit'](_0x263d1a,['id']);if(_0x5deb30){for(var _0x1b71d5 in _0x24a2a0){if(typeof _0x24a2a0[_0x1b71d5]!==_0x190b('0x56')&&typeof _0x5deb30[_0x1b71d5]!==_0x190b('0x56')){_0x5deb30[_0x1b71d5]=_0x24a2a0[_0x1b71d5];}}_0xe736d9(_0x5deb30);}else{_0x10bb82();}});},'VoiceChannels':function(_0x576660){return new Promise(function(_0x37d130,_0x5ec0e5){var _0x1f2262=_[_0x190b('0x57')](_0x4c355f[_0x190b('0x58')]);_0x37d130({'count':_0x1f2262['length'],'rows':_0x1f2262});});},'VoiceChannelMixMonitor':function(_0x129a53){var _0x27591f=this;return new Promise(function(_0x2b0a3a,_0x505e52){if(ami['isConnected']()==![]){return _0x505e52(_0x27591f[_0x190b('0x10')](0x1f4,[config[_0x190b('0x11')]['ip'],config[_0x190b('0x11')][_0x190b('0x12')],_0x190b('0x13')][_0x190b('0x14')]('\x20')));}var _0x49654b=schema(properties[_0x190b('0x59')])[_0x190b('0x5a')](_0x129a53);if(_0x49654b[_0x190b('0x54')]>0x0){return _0x505e52(_0x27591f['error'](0x1f4,_[_0x190b('0x5b')](_0x49654b,_0x190b('0x1a'))[_0x190b('0x14')](',\x20')));}var _0x503700=_[_0x190b('0x55')](_0x4c355f[_0x190b('0x58')],{'uniqueid':_0x129a53[_0x190b('0x5c')]});if(_0x503700&&_0x503700[_0x190b('0x5d')]){var _0x416533=util[_0x190b('0x5e')](_0x190b('0x5f'),_0x129a53[_0x190b('0x60')]||_0x129a53[_0x190b('0x5c')],_0x129a53[_0x190b('0x5e')]||_0x190b('0x61'));return ami['Action']({'action':_0x190b('0x62'),'channel':_0x503700['channel'],'file':_0x416533,'options':_0x190b('0x63')})[_0x190b('0x1e')](function(_0x4b2815){var _0x2a5045=_[_0x190b('0x55')](_0x503700[_0x190b('0x64')],{'filename':_0x190b('0x65')+_0x416533[_0x190b('0x66')]()});if(_[_0x190b('0x67')](_0x2a5045)){_0x503700[_0x190b('0x64')][_0x190b('0x53')]({'filename':'/var/spool/asterisk/monitor/'+_0x416533[_0x190b('0x66')](),'createdAt':moment()[_0x190b('0x5e')](_0x190b('0x68')),'mixmonitorid':_0x4b2815['mixmonitorid'],'status':_0x190b('0x69')});}else{_0x2a5045['mixmonitorid']=_0x4b2815['mixmonitorid'];_0x2a5045[_0x190b('0x6a')]=_0x190b('0x69');}_0x2b0a3a({'code':0xc8,'message':[_0x129a53[_0x190b('0x5c')],_0x190b('0x6b'),_0x4b2815[_0x190b('0x6c')]][_0x190b('0x14')]('\x20'),'mixmonitorid':_0x4b2815[_0x190b('0x6c')]});})[_0x190b('0x1b')](function(_0x3e9851){_0x505e52(_0x27591f[_0x190b('0x10')](0x1f5,[_0x129a53[_0x190b('0x5c')],_0x3e9851[_0x190b('0x1a')][_0x190b('0x66')]()][_0x190b('0x14')]('\x20')));});}else{return _0x505e52(_0x27591f['error'](0x1f5,_0x190b('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x2fa65a){var _0x286355=this;return new Promise(function(_0x219aa8,_0x53d740){if(ami['isConnected']()==![]){return _0x53d740(_0x286355[_0x190b('0x10')](0x1f4,[config[_0x190b('0x11')]['ip'],config['asterisk'][_0x190b('0x12')],'ami\x20disconnected'][_0x190b('0x14')]('\x20')));}var _0x1aae8e=schema(properties[_0x190b('0x59')])['validate'](_0x2fa65a);if(_0x1aae8e[_0x190b('0x54')]>0x0){return _0x53d740(_0x286355[_0x190b('0x10')](0x1f4,_[_0x190b('0x5b')](_0x1aae8e,_0x190b('0x1a'))[_0x190b('0x14')](',\x20')));}var _0x12724e=_[_0x190b('0x55')](_0x4c355f[_0x190b('0x58')],{'uniqueid':_0x2fa65a[_0x190b('0x5c')]});if(_0x12724e){return BPromise['resolve']()['then'](function(){if(_0x12724e[_0x190b('0x5d')]){return ami[_0x190b('0x19')]({'action':_0x190b('0x6e'),'channel':_0x12724e[_0x190b('0x5d')],'mixmonitorid':_0x2fa65a['mixmonitorid']})[_0x190b('0x1b')](function(_0x43003f){});}})['then'](function(){if(_0x12724e[_0x190b('0x6f')]){return ami[_0x190b('0x19')]({'action':_0x190b('0x6e'),'channel':_0x12724e[_0x190b('0x6f')],'mixmonitorid':_0x2fa65a[_0x190b('0x6c')]})[_0x190b('0x1b')](function(_0x8f95e9){});}})[_0x190b('0x1e')](function(_0x550d04){var _0x14d1b8=_['find'](_0x12724e['monitors'],{'mixmonitorid':_0x2fa65a[_0x190b('0x6c')]});if(_0x14d1b8){_0x14d1b8[_0x190b('0x6a')]=_0x190b('0x70');}})['then'](function(){var _0x4da603=util[_0x190b('0x5e')](_0x190b('0x5f'),_0x2fa65a[_0x190b('0x60')]||_0x2fa65a[_0x190b('0x5c')],_0x2fa65a[_0x190b('0x5e')]||_0x190b('0x61'));var _0xf3a6d0=_[_0x190b('0x55')](_0x12724e['monitors'],{'filename':_0x190b('0x65')+_0x4da603[_0x190b('0x66')]()});if(_0xf3a6d0){_0xf3a6d0[_0x190b('0x6a')]=_0x190b('0x70');}})[_0x190b('0x1e')](function(){_0x219aa8({'code':0xc8,'message':[_0x2fa65a['uniqueid'],_0x190b('0x71')][_0x190b('0x14')]('\x20')});})[_0x190b('0x1b')](function(_0x4c877e){_0x53d740(_0x286355[_0x190b('0x10')](0x1f5,[_0x2fa65a[_0x190b('0x5c')],_0x4c877e[_0x190b('0x1a')][_0x190b('0x66')]()]['join']('\x20')));});}else{return _0x53d740(_0x286355[_0x190b('0x10')](0x1f5,_0x190b('0x6d')));}});},'VoiceQueuesChannels':function(_0x2bf55e){return new Promise(function(_0x2f97ef,_0x5b207d){var _0xc6cc52=_['values'](_0x4c355f[_0x190b('0x72')]);_0x2f97ef({'count':_0xc6cc52[_0x190b('0x54')],'rows':_0xc6cc52});});},'VoiceQueuesChannel':function(_0x360d39){var _0x1ac2ef=this;return new Promise(function(_0x52ba56,_0x2a36b3){var _0x52fa63=schema(properties[_0x190b('0x73')])['validate'](_0x360d39);if(_0x52fa63['length']>0x0){return _0x2a36b3(_0x1ac2ef[_0x190b('0x10')](0x1f4,_['map'](_0x52fa63,_0x190b('0x1a'))[_0x190b('0x14')](',\x20')));}var _0x24ff6a=_[_0x190b('0x55')](_0x4c355f[_0x190b('0x72')],{'uniqueid':_0x360d39['uniqueid']});if(_0x24ff6a){_0x52ba56(_0x24ff6a);}else{return _0x2a36b3(_0x1ac2ef[_0x190b('0x10')](0x1f5,_0x190b('0x6d')));}});},'VoiceQueuesChannelHangup':function(_0xdafef7){var _0x519a92=this;return new Promise(function(_0x1d7e47,_0x311c85){if(ami['isConnected']()==![]){return _0x311c85(_0x519a92[_0x190b('0x10')](0x1f4,[config[_0x190b('0x11')]['ip'],config[_0x190b('0x11')]['username'],_0x190b('0x13')][_0x190b('0x14')]('\x20')));}var _0x4030ba=schema(properties[_0x190b('0x74')])['validate'](_0xdafef7);if(_0x4030ba[_0x190b('0x54')]>0x0){return _0x311c85(_0x519a92[_0x190b('0x10')](0x1f4,_[_0x190b('0x5b')](_0x4030ba,'message')[_0x190b('0x14')](',\x20')));}var _0x31c72c=_[_0x190b('0x55')](_0x4c355f['queueChannels'],{'uniqueid':_0xdafef7[_0x190b('0x5c')]});if(_0x31c72c&&_0x31c72c[_0x190b('0x5d')]){return ami[_0x190b('0x19')]({'action':_0x190b('0x75'),'channel':_0x31c72c[_0x190b('0x5d')]})['then'](function(_0x48eb52){_0x1d7e47({'code':0xc8,'message':[_0xdafef7[_0x190b('0x5c')],_0x48eb52[_0x190b('0x1a')]['toLowerCase']()][_0x190b('0x14')]('\x20')});})[_0x190b('0x1b')](function(_0x4c8d4c){_0x311c85(_0x519a92['error'](0x1f5,[_0xdafef7[_0x190b('0x5c')],_0x4c8d4c[_0x190b('0x1a')]['toLowerCase']()]['join']('\x20')));});}else{return _0x311c85(_0x519a92[_0x190b('0x10')](0x1f5,_0x190b('0x6d')));}});},'VoiceQueuesChannelRedirect':function(_0xb5f29c){var _0x435377=this;return new Promise(function(_0x172dbf,_0x47c9c6){if(ami['isConnected']()==![]){return _0x47c9c6(_0x435377[_0x190b('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x190b('0x11')][_0x190b('0x12')],_0x190b('0x13')][_0x190b('0x14')]('\x20')));}var _0x16b41f=schema(properties[_0x190b('0x76')])[_0x190b('0x5a')](_0xb5f29c);if(_0x16b41f[_0x190b('0x54')]>0x0){return _0x47c9c6(_0x435377[_0x190b('0x10')](0x1f4,_[_0x190b('0x5b')](_0x16b41f,_0x190b('0x1a'))['join'](',\x20')));}var _0xaee442=_[_0x190b('0x55')](_0x4c355f[_0x190b('0x72')],{'uniqueid':_0xb5f29c['uniqueid']});if(_0xaee442&&_0xaee442['channel']){return ami[_0x190b('0x19')]({'action':_0x190b('0x77'),'channel':_0xaee442['channel'],'exten':_0xb5f29c[_0x190b('0x78')],'context':_0xb5f29c[_0x190b('0x79')]||_0xaee442[_0x190b('0x79')],'priority':0x1})['then'](function(_0xca7149){_0x172dbf({'code':0xc8,'message':[_0xb5f29c[_0x190b('0x5c')],_0xca7149['message'][_0x190b('0x66')]()][_0x190b('0x14')]('\x20')});})['catch'](function(_0x60705e){_0x47c9c6(_0x435377['error'](0x1f5,[_0xb5f29c['uniqueid'],_0x60705e['message']['toLowerCase']()][_0x190b('0x14')]('\x20')));});}else{return _0x47c9c6(_0x435377[_0x190b('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x26e8ce){return new Promise(function(_0x469085,_0x57fa9e){var _0x2d4b5d=_[_0x190b('0x57')](_0x4c355f[_0x190b('0xc')]);_0x469085({'count':_0x2d4b5d[_0x190b('0x54')],'rows':_0x2d4b5d});});},'Telephones':function(_0x74036e){return new Promise(function(_0x3d5f12,_0x1c1228){var _0x29e335=_[_0x190b('0x57')](_0x4c355f['telephones']);_0x3d5f12({'count':_0x29e335[_0x190b('0x54')],'rows':_0x29e335});});},'Trunks':function(_0x5865b5){return new Promise(function(_0x581507,_0x2c7328){var _0x27769c=_[_0x190b('0x57')](_0x4c355f[_0x190b('0x7a')]);_0x581507({'count':_0x27769c[_0x190b('0x54')],'rows':_0x27769c});});},'OutboundChannels':function(_0xb0140c){return new Promise(function(_0x3c5c11,_0x742be5){var _0x35a4df=_[_0x190b('0x57')](_0x4c355f[_0x190b('0x7b')]);_0x3c5c11({'count':_0x35a4df[_0x190b('0x54')],'rows':_0x35a4df});});},'Outbound':function(_0x563c57){return new Promise(function(_0x305095,_0x18ddf9){_0x305095(_0x4c355f[_0x190b('0x2a')]);});},'Campaigns':function(_0x4287d5){return new Promise(function(_0x418a4b,_0x2b6d4a){var _0xa06f5e=_[_0x190b('0x57')](_0x4c355f[_0x190b('0x7c')]);_0x418a4b({'count':_0xa06f5e['length'],'rows':_0xa06f5e});});},'VoiceQueuesPreview':function(_0x417ce2){var _0x8e1010=this;return new Promise(function(_0xa392be,_0x535212){_0x5cbebb[_0x190b('0x7d')](_0x417ce2['id'])[_0x190b('0x1e')](function(_0x4e73ad){_0xa392be({'code':0xc8,'message':_0x4e73ad['message']});})[_0x190b('0x1b')](function(_0x25fba1){_0x535212(_0x8e1010[_0x190b('0x10')](0x1f4,_0x25fba1[_0x190b('0x1a')]));});});},'EventManager':function(_0x15c495){var _0x2f8e3f=this;return new Promise(function(_0x31fe41,_0x11d8bd){if(!_0x15c495[_0x190b('0x7e')]){return _0x11d8bd(_0x2f8e3f[_0x190b('0x10')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x190b('0x7f')](_0x190b('0x80')+_0x15c495[_0x190b('0x7e')],_0x15c495['message']);_0x31fe41({'code':0xc8,'message':_0x15c495});});},'FaxAccounts':function(_0x3da562){return new Promise(function(_0xe7f8e5,_0x340e40){var _0x3ac90d=_[_0x190b('0x57')](_0x4c355f[_0x190b('0x81')]);_0xe7f8e5({'count':_0x3ac90d['length'],'rows':_0x3ac90d});});},'SendFax':function(_0x476c86){var _0x298824=this;return new Promise(function(_0x5e7c76,_0x282768){_0x5da9c1[_0x190b('0x82')](_0x476c86)[_0x190b('0x1e')](function(_0x1697a6){_0x5e7c76({'code':0xc8,'message':_0x1697a6[_0x190b('0x1a')]});})[_0x190b('0x1b')](function(_0x3abe8f){_0x282768(_0x298824[_0x190b('0x10')](0x1f4,_0x3abe8f['message']));});});},'CheckAfterSend':function(_0x33c4da){var _0x1b3168=this;return new Promise(function(_0x3f9302,_0x22aad4){_0x5da9c1['checkAfterSend'](_0x33c4da)[_0x190b('0x1e')](function(_0x1936f6){_0x3f9302({'code':0xc8,'message':_0x1936f6['message']});})[_0x190b('0x1b')](function(_0x19bd5c){_0x22aad4(_0x1b3168[_0x190b('0x10')](0x1f4,_0x19bd5c[_0x190b('0x1a')]));});});}};var _0x3835d7=jayson[_0x190b('0x83')](_0x3b57f7)[_0x190b('0x84')]();_0x3835d7['on']('error',function(_0x46f330){return _0x34a689(_0x46f330);});_0x3835d7[_0x190b('0x85')](0x232a,_0x190b('0x86'),function(){console['log'](_0x190b('0x87'),0x232a);return _0x27ff8c('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x8b8e=['format','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','catch','message','username','command','Command','voiceQueues','hasOwnProperty','answered','loggedIn','pTalking','sumBillable','sumDuration','total','type','unmanaged','abandoned','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','values','channels','voicechannel','validate','map','uniqueid','channel','%s.%s','wav','MixMonitor','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','filename','queueChannels','exten','context','telephones','trunks','outboundChannels','campaigns','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','bluebird','../properties','../ami','listen'];(function(_0x3fb030,_0x12aebe){var _0xd6899b=function(_0x327646){while(--_0x327646){_0x3fb030['push'](_0x3fb030['shift']());}};_0xd6899b(++_0x12aebe);}(_0x8b8e,0x108));var _0xe8b8=function(_0x3a8775,_0xe0ff29){_0x3a8775=_0x3a8775-0x0;var _0x556776=_0x8b8e[_0x3a8775];return _0x556776;};'use strict';var _=require(_0xe8b8('0x0'));var util=require('util');var jayson=require(_0xe8b8('0x1'));var schema=require('validate');var BPromise=require(_0xe8b8('0x2'));var moment=require('moment');var config=require('../../../config/environment');var properties=require(_0xe8b8('0x3'));var ami=require(_0xe8b8('0x4'));exports[_0xe8b8('0x5')]=function(_0x221ccc,_0x42bef9,_0x3f5dd7){return new BPromise(function(_0x1c0548,_0x2b3269){var _0x229e0b={'QueuePause':function(_0x2540e3){return new Promise(function(_0x4ce796,_0x2a4ccd){var _0x5cd238=util[_0xe8b8('0x6')]('%s/%s','SIP',_0x2540e3[_0xe8b8('0x7')]);if(_0x221ccc[_0xe8b8('0x8')]&&_0x221ccc['timers'][_0x5cd238]&&_0x221ccc['timers'][_0x5cd238][_0xe8b8('0x9')]){_0x221ccc[_0xe8b8('0x8')][_0x5cd238][_0xe8b8('0xa')]();}if(_0x221ccc[_0xe8b8('0xb')][_0x5cd238]){_0x221ccc[_0xe8b8('0xb')][_0x5cd238][_0xe8b8('0xc')]({'statePause':_0x2540e3[_0xe8b8('0xd')]?!![]:![]});}_0x4ce796({'code':0xc8,'message':_0xe8b8('0xe')});});},'Reload':function(_0x151e09){var _0x3b3871=this;return new Promise(function(_0x1c5062,_0x384780){if(ami[_0xe8b8('0xf')]()==![]){return _0x384780(_0x3b3871[_0xe8b8('0x10')](0x1f4,[config['asterisk']['ip'],config[_0xe8b8('0x11')]['username'],_0xe8b8('0x12')][_0xe8b8('0x13')]('\x20')));}_0x151e09=_[_0xe8b8('0x14')](_0x151e09,_[_0xe8b8('0x15')](properties[_0xe8b8('0x16')]));_0x151e09[_0xe8b8('0x17')]=_0xe8b8('0x18');return ami[_0xe8b8('0x19')](_0x151e09)[_0xe8b8('0x1a')](function(_0x3a1329){_0x1c5062({'code':0xc8,'message':_0x3a1329['message']});})[_0xe8b8('0x1b')](function(_0xaba717){_0x384780(_0x3b3871['error'](0x1f5,_0xaba717[_0xe8b8('0x1c')]));});});},'Command':function(_0xe48622){var _0x2b2b80=this;return new Promise(function(_0x2f54c3,_0xbd89e){if(ami[_0xe8b8('0xf')]()==![]){return _0xbd89e(_0x2b2b80[_0xe8b8('0x10')](0x1f4,[config[_0xe8b8('0x11')]['ip'],config[_0xe8b8('0x11')][_0xe8b8('0x1d')],_0xe8b8('0x12')][_0xe8b8('0x13')]('\x20')));}_0xe48622=_[_0xe8b8('0x14')](_0xe48622,_0xe8b8('0x1e'));_0xe48622[_0xe8b8('0x17')]=_0xe8b8('0x1f');return ami[_0xe8b8('0x19')](_0xe48622)['then'](function(_0x57faf7){_0x2f54c3({'code':0xc8,'message':_0x57faf7['content']});})[_0xe8b8('0x1b')](function(_0x51297e){_0xbd89e(_0x2b2b80[_0xe8b8('0x10')](0x1f5,_0x51297e['message']));});});},'VoiceQueues':function(_0x11d48b){return new Promise(function(_0x141cec,_0x5e3fa2){var _0x5ac435=[];for(var _0x19f7b3 in _0x221ccc[_0xe8b8('0x20')]){if(_0x221ccc['voiceQueues'][_0xe8b8('0x21')](_0x19f7b3)){var _0x32141f=_0x221ccc[_0xe8b8('0x20')][_0x19f7b3];var _0x46b2dc={'id':_0x32141f['id'],'name':_0x32141f[_0xe8b8('0x7')],'strategy':_0x32141f['strategy'],'answered':_0x32141f[_0xe8b8('0x22')],'available':_0x32141f['available'],'loggedIn':_0x32141f[_0xe8b8('0x23')],'pTalking':_0x32141f[_0xe8b8('0x24')],'sumBillable':_0x32141f[_0xe8b8('0x25')],'sumDuration':_0x32141f[_0xe8b8('0x26')],'sumHoldTime':_0x32141f['sumHoldTime']||0x0,'talking':_0x32141f['talking'],'total':_0x32141f[_0xe8b8('0x27')],'type':_0x32141f[_0xe8b8('0x28')],'unmanaged':_0x32141f[_0xe8b8('0x29')],'abandoned':_0x32141f[_0xe8b8('0x2a')],'waiting':_0x32141f[_0xe8b8('0x2b')],'loggedInDb':_0x32141f['loggedInDb']};if(_0x32141f[_0xe8b8('0x28')]===_0xe8b8('0x2c')){_0x46b2dc[_0xe8b8('0x2d')]=_0x32141f[_0xe8b8('0x2d')];_0x46b2dc[_0xe8b8('0x2e')]=_0x32141f[_0xe8b8('0x2e')];_0x46b2dc[_0xe8b8('0x2f')]=_0x32141f[_0xe8b8('0x2f')];_0x46b2dc[_0xe8b8('0x30')]=_0x32141f[_0xe8b8('0x30')];_0x46b2dc[_0xe8b8('0x31')]=_0x32141f['dialOriginateTimeout'];_0x46b2dc[_0xe8b8('0x32')]=_0x32141f[_0xe8b8('0x32')];_0x46b2dc[_0xe8b8('0x33')]=_0x32141f['temp'];_0x46b2dc[_0xe8b8('0x34')]=_0x32141f[_0xe8b8('0x34')];_0x46b2dc[_0xe8b8('0x35')]=_0x32141f[_0xe8b8('0x35')];_0x46b2dc[_0xe8b8('0x36')]=_0x32141f[_0xe8b8('0x36')];_0x46b2dc[_0xe8b8('0x37')]=_0x32141f[_0xe8b8('0x37')];_0x46b2dc[_0xe8b8('0x38')]=_0x32141f['outboundCongestionCallsDay'];_0x46b2dc[_0xe8b8('0x39')]=_0x32141f[_0xe8b8('0x39')];_0x46b2dc['outboundDropCallsDayCallersExit']=_0x32141f[_0xe8b8('0x3a')];_0x46b2dc[_0xe8b8('0x3b')]=_0x32141f[_0xe8b8('0x3b')];_0x46b2dc[_0xe8b8('0x3c')]=_0x32141f[_0xe8b8('0x3c')];_0x46b2dc['outboundNoSuchCallsDay']=_0x32141f[_0xe8b8('0x3d')];_0x46b2dc[_0xe8b8('0x3e')]=_0x32141f[_0xe8b8('0x3e')];_0x46b2dc[_0xe8b8('0x3f')]=_0x32141f[_0xe8b8('0x3f')];_0x46b2dc[_0xe8b8('0x40')]=_0x32141f['outboundRejectCallsDay'];_0x46b2dc[_0xe8b8('0x41')]=_0x32141f['outboundUnknownCallsDay'];_0x46b2dc[_0xe8b8('0x42')]=_0x32141f[_0xe8b8('0x42')];_0x46b2dc['predictiveIntervalAvgHoldtime']=_0x32141f['predictiveIntervalAvgHoldtime'];_0x46b2dc[_0xe8b8('0x43')]=_0x32141f[_0xe8b8('0x43')];_0x46b2dc[_0xe8b8('0x44')]=_0x32141f[_0xe8b8('0x44')];_0x46b2dc['predictiveIntervalDroppedCallsTimeout']=_0x32141f[_0xe8b8('0x45')];_0x46b2dc[_0xe8b8('0x46')]=_0x32141f[_0xe8b8('0x46')];_0x46b2dc[_0xe8b8('0x47')]=_0x32141f[_0xe8b8('0x47')];_0x46b2dc[_0xe8b8('0x48')]=_0x32141f[_0xe8b8('0x48')];_0x46b2dc[_0xe8b8('0x49')]=_0x32141f['predictiveIntervalMultiplicativeFactor'];_0x46b2dc['predictiveIntervalPauses']=_0x32141f[_0xe8b8('0x4a')];_0x46b2dc[_0xe8b8('0x4b')]=_0x32141f[_0xe8b8('0x4b')];_0x46b2dc['predictiveIntervalTotalCalls']=_0x32141f[_0xe8b8('0x4c')];_0x46b2dc[_0xe8b8('0x1c')]=_0x32141f[_0xe8b8('0x1c')];_0x46b2dc[_0xe8b8('0x4d')]=_0x32141f[_0xe8b8('0x4d')];_0x46b2dc[_0xe8b8('0x4e')]=_0x32141f[_0xe8b8('0x4e')];_0x46b2dc['erlangCallToSecond']=_0x32141f['erlangCallToSecond'];_0x46b2dc['erlangAbandonmentRate']=_0x32141f[_0xe8b8('0x4f')];_0x46b2dc[_0xe8b8('0x50')]=_0x32141f[_0xe8b8('0x50')];_0x46b2dc[_0xe8b8('0x51')]=_0x32141f['startPredictive'];_0x46b2dc[_0xe8b8('0x52')]=_0x32141f[_0xe8b8('0x52')];}if(_0x32141f[_0xe8b8('0x53')]){_0x46b2dc[_0xe8b8('0x53')]={'id':_0x32141f['Trunk']['id'],'name':_0x32141f['Trunk'][_0xe8b8('0x7')],'active':_0x32141f[_0xe8b8('0x53')][_0xe8b8('0x54')],'callerid':_0x32141f['Trunk'][_0xe8b8('0x55')]};}if(_0x32141f[_0xe8b8('0x56')]){_0x46b2dc[_0xe8b8('0x56')]={'id':_0x32141f[_0xe8b8('0x56')]['id'],'name':_0x32141f['Interval'][_0xe8b8('0x7')]};}_0x5ac435[_0xe8b8('0x57')](_0x46b2dc);}}_0x141cec({'count':_0x5ac435[_0xe8b8('0x58')],'rows':_0x5ac435});});},'UpdateVoiceQueue':function(_0xb2cae7){return new Promise(function(_0x2054cc,_0xb22887){var _0x1a8380=_[_0xe8b8('0x59')](_0x221ccc[_0xe8b8('0x20')],{'id':parseInt(_0xb2cae7['id'])});var _0x2e85f1=_[_0xe8b8('0x5a')](_0xb2cae7,['id']);if(_0x1a8380){for(var _0xb51b61 in _0x2e85f1){if(typeof _0x2e85f1[_0xb51b61]!=='undefined'&&typeof _0x1a8380[_0xb51b61]!=='undefined'){_0x1a8380[_0xb51b61]=_0x2e85f1[_0xb51b61];}}_0x2054cc(_0x1a8380);}else{_0xb22887();}});},'VoiceChannels':function(_0x442c58){return new Promise(function(_0x289347,_0x39bab6){var _0x340880=_[_0xe8b8('0x5b')](_0x221ccc[_0xe8b8('0x5c')]);_0x289347({'count':_0x340880[_0xe8b8('0x58')],'rows':_0x340880});});},'VoiceChannelMixMonitor':function(_0x4fd7d9){var _0x554482=this;return new Promise(function(_0x3a956a,_0x30595a){if(ami['isConnected']()==![]){return _0x30595a(_0x554482[_0xe8b8('0x10')](0x1f4,[config[_0xe8b8('0x11')]['ip'],config[_0xe8b8('0x11')][_0xe8b8('0x1d')],_0xe8b8('0x12')][_0xe8b8('0x13')]('\x20')));}var _0x1ced4c=schema(properties[_0xe8b8('0x5d')])[_0xe8b8('0x5e')](_0x4fd7d9);if(_0x1ced4c[_0xe8b8('0x58')]>0x0){return _0x30595a(_0x554482[_0xe8b8('0x10')](0x1f4,_[_0xe8b8('0x5f')](_0x1ced4c,'message')[_0xe8b8('0x13')](',\x20')));}var _0x5b4316=_[_0xe8b8('0x59')](_0x221ccc[_0xe8b8('0x5c')],{'uniqueid':_0x4fd7d9[_0xe8b8('0x60')]});if(_0x5b4316&&_0x5b4316[_0xe8b8('0x61')]){var _0x517894=util[_0xe8b8('0x6')](_0xe8b8('0x62'),_0x4fd7d9['filename']||_0x4fd7d9[_0xe8b8('0x60')],_0x4fd7d9[_0xe8b8('0x6')]||_0xe8b8('0x63'));return ami[_0xe8b8('0x19')]({'action':_0xe8b8('0x64'),'channel':_0x5b4316[_0xe8b8('0x61')],'file':_0x517894,'options':'ai(mixmonitorid)'})[_0xe8b8('0x1a')](function(_0x4d9971){var _0x53cef6=_[_0xe8b8('0x59')](_0x5b4316[_0xe8b8('0x65')],{'filename':_0xe8b8('0x66')+_0x517894[_0xe8b8('0x67')]()});if(_[_0xe8b8('0x68')](_0x53cef6)){_0x5b4316[_0xe8b8('0x65')][_0xe8b8('0x57')]({'filename':_0xe8b8('0x66')+_0x517894[_0xe8b8('0x67')](),'createdAt':moment()[_0xe8b8('0x6')](_0xe8b8('0x69')),'mixmonitorid':_0x4d9971['mixmonitorid'],'status':_0xe8b8('0x6a')});}else{_0x53cef6[_0xe8b8('0x6b')]=_0x4d9971[_0xe8b8('0x6b')];_0x53cef6[_0xe8b8('0x6c')]='rec';}_0x3a956a({'code':0xc8,'message':[_0x4fd7d9[_0xe8b8('0x60')],'MixMonitor\x20Success',_0x4d9971[_0xe8b8('0x6b')]][_0xe8b8('0x13')]('\x20'),'mixmonitorid':_0x4d9971['mixmonitorid']});})[_0xe8b8('0x1b')](function(_0x4c4752){_0x30595a(_0x554482[_0xe8b8('0x10')](0x1f5,[_0x4fd7d9[_0xe8b8('0x60')],_0x4c4752[_0xe8b8('0x1c')]['toLowerCase']()][_0xe8b8('0x13')]('\x20')));});}else{return _0x30595a(_0x554482[_0xe8b8('0x10')](0x1f5,_0xe8b8('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x2c6603){var _0x2178bb=this;return new Promise(function(_0x293255,_0x4d4828){if(ami[_0xe8b8('0xf')]()==![]){return _0x4d4828(_0x2178bb[_0xe8b8('0x10')](0x1f4,[config[_0xe8b8('0x11')]['ip'],config[_0xe8b8('0x11')][_0xe8b8('0x1d')],_0xe8b8('0x12')][_0xe8b8('0x13')]('\x20')));}var _0x452285=schema(properties[_0xe8b8('0x5d')])['validate'](_0x2c6603);if(_0x452285['length']>0x0){return _0x4d4828(_0x2178bb['error'](0x1f4,_['map'](_0x452285,_0xe8b8('0x1c'))[_0xe8b8('0x13')](',\x20')));}var _0xc6f8c7=_[_0xe8b8('0x59')](_0x221ccc[_0xe8b8('0x5c')],{'uniqueid':_0x2c6603[_0xe8b8('0x60')]});if(_0xc6f8c7){return BPromise[_0xe8b8('0x6e')]()[_0xe8b8('0x1a')](function(){if(_0xc6f8c7[_0xe8b8('0x61')]){return ami[_0xe8b8('0x19')]({'action':_0xe8b8('0x6f'),'channel':_0xc6f8c7[_0xe8b8('0x61')],'mixmonitorid':_0x2c6603[_0xe8b8('0x6b')]})['catch'](function(_0x1af57a){});}})['then'](function(){if(_0xc6f8c7[_0xe8b8('0x70')]){return ami['Action']({'action':_0xe8b8('0x6f'),'channel':_0xc6f8c7[_0xe8b8('0x70')],'mixmonitorid':_0x2c6603[_0xe8b8('0x6b')]})[_0xe8b8('0x1b')](function(_0x3b52ab){});}})['then'](function(_0x15c318){var _0x39c471=_['find'](_0xc6f8c7[_0xe8b8('0x65')],{'mixmonitorid':_0x2c6603[_0xe8b8('0x6b')]});if(_0x39c471){_0x39c471['status']=_0xe8b8('0x71');}})[_0xe8b8('0x1a')](function(){var _0x3864d1=util['format'](_0xe8b8('0x62'),_0x2c6603[_0xe8b8('0x72')]||_0x2c6603[_0xe8b8('0x60')],_0x2c6603[_0xe8b8('0x6')]||_0xe8b8('0x63'));var _0x1466b9=_[_0xe8b8('0x59')](_0xc6f8c7[_0xe8b8('0x65')],{'filename':_0xe8b8('0x66')+_0x3864d1[_0xe8b8('0x67')]()});if(_0x1466b9){_0x1466b9[_0xe8b8('0x6c')]=_0xe8b8('0x71');}})[_0xe8b8('0x1a')](function(){_0x293255({'code':0xc8,'message':[_0x2c6603[_0xe8b8('0x60')],'StopMixMonitor\x20Success'][_0xe8b8('0x13')]('\x20')});})['catch'](function(_0x49d044){_0x4d4828(_0x2178bb['error'](0x1f5,[_0x2c6603[_0xe8b8('0x60')],_0x49d044[_0xe8b8('0x1c')][_0xe8b8('0x67')]()][_0xe8b8('0x13')]('\x20')));});}else{return _0x4d4828(_0x2178bb['error'](0x1f5,_0xe8b8('0x6d')));}});},'VoiceQueuesChannels':function(_0x51c7fd){return new Promise(function(_0x41bdf9,_0x539435){var _0x8ddffe=_[_0xe8b8('0x5b')](_0x221ccc[_0xe8b8('0x73')]);_0x41bdf9({'count':_0x8ddffe[_0xe8b8('0x58')],'rows':_0x8ddffe});});},'VoiceQueuesChannel':function(_0x4ae5bb){var _0x119c90=this;return new Promise(function(_0xa845b6,_0x4c3bde){var _0x3dcf9a=schema(properties['voicequeuechannel'])['validate'](_0x4ae5bb);if(_0x3dcf9a[_0xe8b8('0x58')]>0x0){return _0x4c3bde(_0x119c90[_0xe8b8('0x10')](0x1f4,_[_0xe8b8('0x5f')](_0x3dcf9a,_0xe8b8('0x1c'))[_0xe8b8('0x13')](',\x20')));}var _0x110195=_[_0xe8b8('0x59')](_0x221ccc[_0xe8b8('0x73')],{'uniqueid':_0x4ae5bb[_0xe8b8('0x60')]});if(_0x110195){_0xa845b6(_0x110195);}else{return _0x4c3bde(_0x119c90[_0xe8b8('0x10')](0x1f5,_0xe8b8('0x6d')));}});},'VoiceQueuesChannelHangup':function(_0x4f2c0d){var _0x21ec32=this;return new Promise(function(_0x462ed8,_0x54c930){if(ami[_0xe8b8('0xf')]()==![]){return _0x54c930(_0x21ec32['error'](0x1f4,[config[_0xe8b8('0x11')]['ip'],config[_0xe8b8('0x11')][_0xe8b8('0x1d')],_0xe8b8('0x12')][_0xe8b8('0x13')]('\x20')));}var _0x33c765=schema(properties['voicequeuechannelhangup'])[_0xe8b8('0x5e')](_0x4f2c0d);if(_0x33c765[_0xe8b8('0x58')]>0x0){return _0x54c930(_0x21ec32['error'](0x1f4,_[_0xe8b8('0x5f')](_0x33c765,_0xe8b8('0x1c'))[_0xe8b8('0x13')](',\x20')));}var _0x3a4161=_['find'](_0x221ccc[_0xe8b8('0x73')],{'uniqueid':_0x4f2c0d[_0xe8b8('0x60')]});if(_0x3a4161&&_0x3a4161[_0xe8b8('0x61')]){return ami[_0xe8b8('0x19')]({'action':'Hangup','channel':_0x3a4161[_0xe8b8('0x61')]})[_0xe8b8('0x1a')](function(_0x1d643f){_0x462ed8({'code':0xc8,'message':[_0x4f2c0d[_0xe8b8('0x60')],_0x1d643f['message']['toLowerCase']()]['join']('\x20')});})[_0xe8b8('0x1b')](function(_0x1be51b){_0x54c930(_0x21ec32[_0xe8b8('0x10')](0x1f5,[_0x4f2c0d[_0xe8b8('0x60')],_0x1be51b[_0xe8b8('0x1c')][_0xe8b8('0x67')]()]['join']('\x20')));});}else{return _0x54c930(_0x21ec32[_0xe8b8('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0xd26530){var _0x279e9f=this;return new Promise(function(_0x5ab64e,_0x2d2580){if(ami[_0xe8b8('0xf')]()==![]){return _0x2d2580(_0x279e9f[_0xe8b8('0x10')](0x1f4,[config[_0xe8b8('0x11')]['ip'],config['asterisk'][_0xe8b8('0x1d')],_0xe8b8('0x12')][_0xe8b8('0x13')]('\x20')));}var _0x536bc3=schema(properties['voicequeuechannelredirect'])['validate'](_0xd26530);if(_0x536bc3[_0xe8b8('0x58')]>0x0){return _0x2d2580(_0x279e9f[_0xe8b8('0x10')](0x1f4,_[_0xe8b8('0x5f')](_0x536bc3,_0xe8b8('0x1c'))[_0xe8b8('0x13')](',\x20')));}var _0x5e073=_[_0xe8b8('0x59')](_0x221ccc[_0xe8b8('0x73')],{'uniqueid':_0xd26530[_0xe8b8('0x60')]});if(_0x5e073&&_0x5e073[_0xe8b8('0x61')]){return ami[_0xe8b8('0x19')]({'action':'Redirect','channel':_0x5e073[_0xe8b8('0x61')],'exten':_0xd26530[_0xe8b8('0x74')],'context':_0xd26530[_0xe8b8('0x75')]||_0x5e073['context'],'priority':0x1})[_0xe8b8('0x1a')](function(_0x51baf7){_0x5ab64e({'code':0xc8,'message':[_0xd26530[_0xe8b8('0x60')],_0x51baf7[_0xe8b8('0x1c')][_0xe8b8('0x67')]()][_0xe8b8('0x13')]('\x20')});})[_0xe8b8('0x1b')](function(_0x5d4f84){_0x2d2580(_0x279e9f[_0xe8b8('0x10')](0x1f5,[_0xd26530[_0xe8b8('0x60')],_0x5d4f84['message'][_0xe8b8('0x67')]()][_0xe8b8('0x13')]('\x20')));});}else{return _0x2d2580(_0x279e9f[_0xe8b8('0x10')](0x1f5,_0xe8b8('0x6d')));}});},'Agents':function(_0x5a75b5){return new Promise(function(_0xbea51c,_0x2d8e84){var _0x180c66=_[_0xe8b8('0x5b')](_0x221ccc[_0xe8b8('0xb')]);_0xbea51c({'count':_0x180c66[_0xe8b8('0x58')],'rows':_0x180c66});});},'Telephones':function(_0x32c6d2){return new Promise(function(_0x3d71e3,_0xea0155){var _0x40830a=_[_0xe8b8('0x5b')](_0x221ccc[_0xe8b8('0x76')]);_0x3d71e3({'count':_0x40830a['length'],'rows':_0x40830a});});},'Trunks':function(_0x5f4146){return new Promise(function(_0x473ab2,_0x3232d4){var _0x523452=_[_0xe8b8('0x5b')](_0x221ccc[_0xe8b8('0x77')]);_0x473ab2({'count':_0x523452[_0xe8b8('0x58')],'rows':_0x523452});});},'OutboundChannels':function(_0x11f95c){return new Promise(function(_0x189f2b,_0x3f1950){var _0x2aa755=_['values'](_0x221ccc[_0xe8b8('0x78')]);_0x189f2b({'count':_0x2aa755[_0xe8b8('0x58')],'rows':_0x2aa755});});},'Outbound':function(_0x3801bb){return new Promise(function(_0x364528,_0x492578){_0x364528(_0x221ccc[_0xe8b8('0x2c')]);});},'Campaigns':function(_0x30a009){return new Promise(function(_0x1fe4b1,_0x3a4c7a){var _0x513e06=_[_0xe8b8('0x5b')](_0x221ccc[_0xe8b8('0x79')]);_0x1fe4b1({'count':_0x513e06[_0xe8b8('0x58')],'rows':_0x513e06});});},'VoiceQueuesPreview':function(_0x5ba2af){var _0x20de91=this;return new Promise(function(_0x36604c,_0x2ec9b7){_0x42bef9['run'](_0x5ba2af['id'])[_0xe8b8('0x1a')](function(_0x56bf5f){_0x36604c({'code':0xc8,'message':_0x56bf5f[_0xe8b8('0x1c')]});})[_0xe8b8('0x1b')](function(_0x13bd6d){_0x2ec9b7(_0x20de91[_0xe8b8('0x10')](0x1f4,_0x13bd6d[_0xe8b8('0x1c')]));});});},'EventManager':function(_0x5ce501){var _0x560e46=this;return new Promise(function(_0x1dee89,_0x11363d){if(!_0x5ce501[_0xe8b8('0x7a')]){return _0x11363d(_0x560e46[_0xe8b8('0x10')](0x1f4,_0xe8b8('0x7b')));}ami[_0xe8b8('0x7c')](_0xe8b8('0x7d')+_0x5ce501[_0xe8b8('0x7a')],_0x5ce501[_0xe8b8('0x1c')]);_0x1dee89({'code':0xc8,'message':_0x5ce501});});},'FaxAccounts':function(_0x31c65a){return new Promise(function(_0xe3c531,_0xeab356){var _0x958f82=_[_0xe8b8('0x5b')](_0x221ccc[_0xe8b8('0x7e')]);_0xe3c531({'count':_0x958f82[_0xe8b8('0x58')],'rows':_0x958f82});});},'SendFax':function(_0x54fe1f){var _0x1e1a72=this;return new Promise(function(_0x11d7fc,_0x48dd00){_0x3f5dd7[_0xe8b8('0x7f')](_0x54fe1f)[_0xe8b8('0x1a')](function(_0x2c49b7){_0x11d7fc({'code':0xc8,'message':_0x2c49b7['message']});})[_0xe8b8('0x1b')](function(_0x4d52d7){_0x48dd00(_0x1e1a72[_0xe8b8('0x10')](0x1f4,_0x4d52d7[_0xe8b8('0x1c')]));});});},'CheckAfterSend':function(_0x2634f6){var _0x678ee2=this;return new Promise(function(_0x1f2217,_0x51c7d1){_0x3f5dd7[_0xe8b8('0x80')](_0x2634f6)[_0xe8b8('0x1a')](function(_0x2ac568){_0x1f2217({'code':0xc8,'message':_0x2ac568[_0xe8b8('0x1c')]});})[_0xe8b8('0x1b')](function(_0x254700){_0x51c7d1(_0x678ee2[_0xe8b8('0x10')](0x1f4,_0x254700[_0xe8b8('0x1c')]));});});}};var _0x398bc5=jayson[_0xe8b8('0x81')](_0x229e0b)[_0xe8b8('0x82')]();_0x398bc5['on'](_0xe8b8('0x10'),function(_0x5b4bd9){return _0x2b3269(_0x5b4bd9);});_0x398bc5[_0xe8b8('0x5')](0x232a,_0xe8b8('0x83'),function(){console[_0xe8b8('0x84')](_0xe8b8('0x85'),0x232a);return _0x1c0548(_0xe8b8('0x86')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index a043cf7..6a135fc 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 _0xedd9=['data3','phone','$or','map','routeId','destcalleridnum','lastName','scheduledAt','union','resolve','then','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','isNil','calleridnum','firstName','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','user:%s','name','format','trigger:%s','action','toLowerCase','merge','length','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','data1','data2','data5','xmd-contactid','ListId'];(function(_0x4fbb97,_0x38f210){var _0x421f23=function(_0x490886){while(--_0x490886){_0x4fbb97['push'](_0x4fbb97['shift']());}};_0x421f23(++_0x38f210);}(_0xedd9,0xfc));var _0x9edd=function(_0x3a2f90,_0x27dd86){_0x3a2f90=_0x3a2f90-0x0;var _0x122e21=_0xedd9[_0x3a2f90];return _0x122e21;};'use strict';var _=require('lodash');var BPromise=require(_0x9edd('0x0'));var Redis=require(_0x9edd('0x1'));var util=require(_0x9edd('0x2'));var config=require(_0x9edd('0x3'));var logger=require(_0x9edd('0x4'))(_0x9edd('0x5'));var cmContactRpc=require(_0x9edd('0x6'));config[_0x9edd('0x7')]=_['defaults'](config[_0x9edd('0x7')],{'host':_0x9edd('0x8'),'port':0x18eb});var io=require(_0x9edd('0x9'))(new Redis(config[_0x9edd('0x7')]));function emit(_0x5319f7,_0xf0b2d8,_0x571af9,_0x172522,_0x190185){logger[_0x9edd('0xa')](_0x9edd('0xb'),_0x5319f7,_0xf0b2d8['id'],_0x571af9,_0x172522,JSON['stringify'](_0x190185));io['to'](_0x571af9)[_0x9edd('0xc')](_0x172522,_0x190185);}exports['exec']=function(_0x2076fc,_0x138767,_0x523026,_0xbf9da6){var _0x13dc4f,_0x5b6c00;var _0x30c0d7={};var _0x1b73d1=Number(_0x523026[_0x9edd('0xd')]);var _0xfd544a=_0x523026[_0x9edd('0xe')]?Boolean(Number(_0x523026[_0x9edd('0xe')])):![];var _0xfca576;var _0xef5498=![];if(!_['isNil'](_0x523026[_0x9edd('0xf')])){if(_0x523026[_0x9edd('0xf')]=='1')_0xef5498=!![];}if(!_0xef5498){if(_0xbf9da6[_0x9edd('0x10')]){_0x30c0d7['id']=_0xbf9da6[_0x9edd('0x10')];}}if(!_0x30c0d7['id']){_0x30c0d7[_0x9edd('0x11')]=_0x1b73d1;_0xfca576=_0x523026[_0x9edd('0x12')]&&_0x523026[_0x9edd('0x12')]!=='0'?_0x523026[_0x9edd('0x12')]['split'](','):[_0x9edd('0x13')];_0x30c0d7[_0x9edd('0x14')]=_[_0x9edd('0x15')](_0xfca576,function(_0x5acf65){var _0x1b54c0={};_0x1b54c0[_0x5acf65]=_0xbf9da6[_0x9edd('0x16')]?_0xbf9da6[_0x9edd('0x17')]:_0xbf9da6['calleridnum'];return _0x1b54c0;});}var _0x43dc70=['id','firstName',_0x9edd('0x18'),_0x9edd('0x13'),'mobile','fax',_0x9edd('0x11'),'createdAt',_0x9edd('0x19'),'updatedAt'];var _0x535f37=_[_0x9edd('0x1a')](_0x43dc70,_0xfca576);BPromise[_0x9edd('0x1b')]()['then'](cmContactRpc['getContacts']({'attributes':_0x535f37,'where':_0x30c0d7}))[_0x9edd('0x1c')](function(_0x186186){_0x5b6c00=_0x186186;if(!_[_0x9edd('0x1d')](_0x5b6c00)){if(_0x5b6c00['length']===0x1){_0x13dc4f=_0x5b6c00[0x0];logger[_0x9edd('0xa')](_0x9edd('0x1e'),_0xbf9da6[_0x9edd('0x1f')],_0x138767['id'],_0x13dc4f['id']);}else{logger[_0x9edd('0xa')](_0x9edd('0x20'),_0xbf9da6['uniqueid'],_0x138767['id'],_[_0x9edd('0x15')](_0x5b6c00,'id')[_0x9edd('0x21')](','));}return;}else{logger[_0x9edd('0xa')](_0x9edd('0x22'),_0xbf9da6[_0x9edd('0x1f')],_0x138767['id']);var _0x4d507f={'ListId':_0x1b73d1};var _0x4b3d1b=_0x523026[_0x9edd('0x23')]&&_0x523026[_0x9edd('0x23')]!=='0'?_0x523026[_0x9edd('0x23')]:_0x9edd('0x13');if(_0xfd544a){logger[_0x9edd('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0xbf9da6['uniqueid'],_0x138767['id']);_0x4d507f[_0x4b3d1b]=_[_0x9edd('0x24')](_0xbf9da6[_0x9edd('0x16')])?_0xbf9da6[_0x9edd('0x25')]:_0xbf9da6['destcalleridnum'];if(_[_0x9edd('0x24')](_0xbf9da6[_0x9edd('0x16')])){_0x4d507f[_0x9edd('0x26')]=_0xbf9da6[_0x9edd('0x27')]&&_0xbf9da6['calleridname']!==_0x9edd('0x28')?_0xbf9da6[_0x9edd('0x27')]:_0x9edd('0x29');}else{_0x4d507f[_0x9edd('0x26')]=_0xbf9da6[_0x9edd('0x2a')]&&_0xbf9da6[_0x9edd('0x2a')]!==_0x9edd('0x28')?_0xbf9da6[_0x9edd('0x2a')]:_0x9edd('0x29');}return BPromise[_0x9edd('0x1b')]()[_0x9edd('0x1c')](cmContactRpc[_0x9edd('0x2b')](_0x4d507f))[_0x9edd('0x1c')](function(_0xa55906){_0x13dc4f=_0xa55906;_0x5b6c00[_0x9edd('0x2c')](_0xa55906);if(_0x13dc4f){logger['info'](_0x9edd('0x2d'),_0xbf9da6[_0x9edd('0x1f')],_0x138767['id'],_0x13dc4f['id']);}return;});}else{logger[_0x9edd('0xa')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0xbf9da6[_0x9edd('0x1f')],_0x138767['id']);_0x4d507f[_0x4b3d1b]=_[_0x9edd('0x24')](_0xbf9da6[_0x9edd('0x16')])?_0xbf9da6[_0x9edd('0x25')]:_0xbf9da6[_0x9edd('0x17')];if(_[_0x9edd('0x24')](_0xbf9da6[_0x9edd('0x16')])){_0x4d507f[_0x9edd('0x26')]=_0xbf9da6[_0x9edd('0x27')]&&_0xbf9da6[_0x9edd('0x27')]!==_0x9edd('0x28')?_0xbf9da6[_0x9edd('0x27')]:_0x9edd('0x29');}else{_0x4d507f[_0x9edd('0x26')]=_0xbf9da6['destcalleridname']&&_0xbf9da6[_0x9edd('0x2a')]!==''?_0xbf9da6[_0x9edd('0x2a')]:_0x9edd('0x29');}_0x13dc4f=_0x4d507f;_0x5b6c00[_0x9edd('0x2c')](_0x4d507f);return;}}})[_0x9edd('0x1c')](function(){if(_0x2076fc){emit(_0xbf9da6[_0x9edd('0x1f')],_0x138767,util['format'](_0x9edd('0x2e'),_0x2076fc[_0x9edd('0x2f')]),util[_0x9edd('0x30')](_0x9edd('0x31'),_0x523026[_0x9edd('0x32')][_0x9edd('0x33')]()),{'evt':_[_0x9edd('0x34')](_0xbf9da6,{'autoCreate':_0xfd544a}),'contact':_0x13dc4f===undefined?{}:_0x13dc4f,'contacts':_0x5b6c00[_0x9edd('0x35')]===0x0?undefined:_0x5b6c00});}});}; \ No newline at end of file +var _0x9c44=['','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Contact\x20created:%s','destcalleridnum','push','format','name','trigger:%s','action','merge','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','socket.io-emitter','info','[CM][%s][%s]','stringify','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','firstName','lastName','mobile','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','length','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridnum','calleridname'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var Redis=require(_0x49c4('0x0'));var util=require(_0x49c4('0x1'));var config=require(_0x49c4('0x2'));var logger=require(_0x49c4('0x3'))(_0x49c4('0x4'));var cmContactRpc=require(_0x49c4('0x5'));config['redis']=_['defaults'](config[_0x49c4('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x49c4('0x7'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x69bc41,_0x2c4e2e,_0x436234,_0x511d53,_0x11c586){logger[_0x49c4('0x8')](_0x49c4('0x9'),_0x69bc41,_0x2c4e2e['id'],_0x436234,_0x511d53,JSON[_0x49c4('0xa')](_0x11c586));io['to'](_0x436234)['emit'](_0x511d53,_0x11c586);}exports['exec']=function(_0x451ea6,_0x313e73,_0x58cad7,_0xb611a1){var _0x459d09,_0x4adb3c;var _0x536d42={};var _0x1d19bf=Number(_0x58cad7[_0x49c4('0xb')]);var _0x5487cd=_0x58cad7[_0x49c4('0xc')]?Boolean(Number(_0x58cad7[_0x49c4('0xc')])):![];var _0x5f2fd9;var _0x1909fe=![];if(!_[_0x49c4('0xd')](_0x58cad7[_0x49c4('0xe')])){if(_0x58cad7[_0x49c4('0xe')]=='1')_0x1909fe=!![];}if(!_0x1909fe){if(_0xb611a1[_0x49c4('0xf')]){_0x536d42['id']=_0xb611a1[_0x49c4('0xf')];}}if(!_0x536d42['id']){_0x536d42[_0x49c4('0x10')]=_0x1d19bf;_0x5f2fd9=_0x58cad7[_0x49c4('0x11')]&&_0x58cad7['data3']!=='0'?_0x58cad7[_0x49c4('0x11')][_0x49c4('0x12')](','):[_0x49c4('0x13')];_0x536d42[_0x49c4('0x14')]=_[_0x49c4('0x15')](_0x5f2fd9,function(_0x53e3a2){var _0x44e607={};_0x44e607[_0x53e3a2]=_0xb611a1[_0x49c4('0x16')]?_0xb611a1['destcalleridnum']:_0xb611a1['calleridnum'];return _0x44e607;});}var _0x3c782d=['id',_0x49c4('0x17'),_0x49c4('0x18'),'phone',_0x49c4('0x19'),'fax',_0x49c4('0x10'),_0x49c4('0x1a'),_0x49c4('0x1b'),_0x49c4('0x1c')];var _0x382040=_[_0x49c4('0x1d')](_0x3c782d,_0x5f2fd9);BPromise[_0x49c4('0x1e')]()[_0x49c4('0x1f')](cmContactRpc[_0x49c4('0x20')]({'attributes':_0x382040,'where':_0x536d42}))['then'](function(_0x527126){_0x4adb3c=_0x527126;if(!_['isEmpty'](_0x4adb3c)){if(_0x4adb3c[_0x49c4('0x21')]===0x1){_0x459d09=_0x4adb3c[0x0];logger['info']('[CM][%s][%s]\x20Contact\x20found:%s',_0xb611a1[_0x49c4('0x22')],_0x313e73['id'],_0x459d09['id']);}else{logger[_0x49c4('0x8')](_0x49c4('0x23'),_0xb611a1[_0x49c4('0x22')],_0x313e73['id'],_['map'](_0x4adb3c,'id')['join'](','));}return;}else{logger[_0x49c4('0x8')](_0x49c4('0x24'),_0xb611a1['uniqueid'],_0x313e73['id']);var _0x207358={'ListId':_0x1d19bf};var _0x43e014=_0x58cad7[_0x49c4('0x25')]&&_0x58cad7[_0x49c4('0x25')]!=='0'?_0x58cad7['data4']:'phone';if(_0x5487cd){logger[_0x49c4('0x8')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0xb611a1[_0x49c4('0x22')],_0x313e73['id']);_0x207358[_0x43e014]=_[_0x49c4('0xd')](_0xb611a1[_0x49c4('0x16')])?_0xb611a1[_0x49c4('0x26')]:_0xb611a1['destcalleridnum'];if(_[_0x49c4('0xd')](_0xb611a1[_0x49c4('0x16')])){_0x207358[_0x49c4('0x17')]=_0xb611a1[_0x49c4('0x27')]&&_0xb611a1[_0x49c4('0x27')]!==_0x49c4('0x28')?_0xb611a1[_0x49c4('0x27')]:_0x49c4('0x29');}else{_0x207358[_0x49c4('0x17')]=_0xb611a1[_0x49c4('0x2a')]&&_0xb611a1[_0x49c4('0x2a')]!==''?_0xb611a1['destcalleridname']:'Unknown';}return BPromise[_0x49c4('0x1e')]()[_0x49c4('0x1f')](cmContactRpc[_0x49c4('0x2b')](_0x207358))[_0x49c4('0x1f')](function(_0x28eb47){_0x459d09=_0x28eb47;_0x4adb3c['push'](_0x28eb47);if(_0x459d09){logger[_0x49c4('0x8')](_0x49c4('0x2c'),_0xb611a1[_0x49c4('0x22')],_0x313e73['id'],_0x459d09['id']);}return;});}else{logger[_0x49c4('0x8')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0xb611a1['uniqueid'],_0x313e73['id']);_0x207358[_0x43e014]=_[_0x49c4('0xd')](_0xb611a1[_0x49c4('0x16')])?_0xb611a1[_0x49c4('0x26')]:_0xb611a1[_0x49c4('0x2d')];if(_[_0x49c4('0xd')](_0xb611a1['routeId'])){_0x207358[_0x49c4('0x17')]=_0xb611a1[_0x49c4('0x27')]&&_0xb611a1[_0x49c4('0x27')]!==''?_0xb611a1['calleridname']:_0x49c4('0x29');}else{_0x207358[_0x49c4('0x17')]=_0xb611a1[_0x49c4('0x2a')]&&_0xb611a1[_0x49c4('0x2a')]!==_0x49c4('0x28')?_0xb611a1[_0x49c4('0x2a')]:_0x49c4('0x29');}_0x459d09=_0x207358;_0x4adb3c[_0x49c4('0x2e')](_0x207358);return;}}})[_0x49c4('0x1f')](function(){if(_0x451ea6){emit(_0xb611a1['uniqueid'],_0x313e73,util[_0x49c4('0x2f')]('user:%s',_0x451ea6[_0x49c4('0x30')]),util[_0x49c4('0x2f')](_0x49c4('0x31'),_0x58cad7[_0x49c4('0x32')]['toLowerCase']()),{'evt':_[_0x49c4('0x33')](_0xb611a1,{'autoCreate':_0x5487cd}),'contact':_0x459d09===undefined?{}:_0x459d09,'contacts':_0x4adb3c[_0x49c4('0x21')]===0x0?undefined:_0x4adb3c});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index f44c44f..f45301a 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 _0xf156=['motionChannel','undefined','voice','checkTriggers','interface','hasOwnProperty','merge','length','action','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','html','template\x20not\x20found','buildUri','isNil','data3','data4','location','uriLocation','data5','800','windowHeight','600','data6','render','winArguments','emit','format','user:%s','name','trigger:%s:%s','jscripty','trigger:%s','exec','integration','accounts','queue','routeId','script','parse','query','replace','channel','AllConditions','every','checkConditions','AnyConditions','some','field','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','agent','membername','lastevent','mailSubstatus','null','substatus','exports','lodash','mustache','./urlforward','./integration','./cmContact','./script','../../../config/environment','../ami','redis','localhost','socket.io-emitter','popup','url','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','custom:agentcalled','bind','syncCustomEvent','custom:agentnoanswer','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialend','custom:newinteraction','custom:substatus','custom:outgoingmessage','prototype','info','stringify'];(function(_0x107d6d,_0x2e0f67){var _0x31ec9a=function(_0xd42aab){while(--_0xd42aab){_0x107d6d['push'](_0x107d6d['shift']());}};_0x31ec9a(++_0x2e0f67);}(_0xf156,0x127));var _0x6f15=function(_0x589fc7,_0x590a5b){_0x589fc7=_0x589fc7-0x0;var _0x44cb75=_0xf156[_0x589fc7];return _0x44cb75;};'use strict';var util=require('util');var _=require(_0x6f15('0x0'));var url=require('url');var Mustache=require(_0x6f15('0x1'));var Redis=require('ioredis');var urlforward=require(_0x6f15('0x2'));var integration=require(_0x6f15('0x3'));var cmContact=require(_0x6f15('0x4'));var script=require(_0x6f15('0x5'));var config=require(_0x6f15('0x6'));var logger=require('../../../config/logger')('trigger');var ami=require(_0x6f15('0x7'));config[_0x6f15('0x8')]=_['defaults'](config[_0x6f15('0x8')],{'host':_0x6f15('0x9'),'port':0x18eb});var io=require(_0x6f15('0xa'))(new Redis(config[_0x6f15('0x8')]));var operators={'equals':function(_0x21f01f,_0x79aa88){return _0x21f01f==_0x79aa88;},'not_equals':function(_0x4e3157,_0x391135){return _0x4e3157!=_0x391135;}};var barAndWebActions=[_0x6f15('0xb'),_0x6f15('0xc'),_0x6f15('0xd')];function Trigger(_0x119380){this[_0x6f15('0xe')]=_0x119380['triggers'];this['agents']=_0x119380[_0x6f15('0xf')];this[_0x6f15('0x10')]=_0x119380[_0x6f15('0x10')];this[_0x6f15('0x11')]=_0x119380[_0x6f15('0x11')];this[_0x6f15('0x12')]=_0x119380['voiceExtensions'];this[_0x6f15('0x13')]=_0x119380[_0x6f15('0x13')];this[_0x6f15('0x14')]=_0x119380['freshdeskAccounts'];this[_0x6f15('0x15')]=_0x119380[_0x6f15('0x15')];this[_0x6f15('0x16')]=_0x119380[_0x6f15('0x16')];this[_0x6f15('0x17')]=_0x119380[_0x6f15('0x17')];this[_0x6f15('0x18')]=_0x119380[_0x6f15('0x18')];this['vtigerAccounts']=_0x119380[_0x6f15('0x19')];this['servicenowAccounts']=_0x119380[_0x6f15('0x1a')];this['dynamics365Accounts']=_0x119380['dynamics365Accounts'];this[_0x6f15('0x1b')]=_0x119380[_0x6f15('0x1b')];this['accounts']={'zendesk':this[_0x6f15('0x13')],'salesforce':this[_0x6f15('0x15')],'freshdesk':this[_0x6f15('0x14')],'sugarcrm':this[_0x6f15('0x16')],'zoho':this[_0x6f15('0x17')],'desk':this[_0x6f15('0x18')],'vtiger':this[_0x6f15('0x19')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x6f15('0x1b')],'servicenow':this[_0x6f15('0x1a')]};ami['on'](_0x6f15('0x1c'),this['syncCustomEvent'][_0x6f15('0x1d')](this));ami['on']('custom:agentconnect',this['syncCustomEvent'][_0x6f15('0x1d')](this));ami['on']('custom:agentringnoanswer',this['syncCustomEvent']['bind'](this));ami['on']('custom:agentcomplete',this['syncCustomEvent']['bind'](this));ami['on']('custom:agentnosuchnumber',this[_0x6f15('0x1e')][_0x6f15('0x1d')](this));ami['on'](_0x6f15('0x1f'),this[_0x6f15('0x1e')][_0x6f15('0x1d')](this));ami['on']('custom:agentbusy',this[_0x6f15('0x1e')][_0x6f15('0x1d')](this));ami['on'](_0x6f15('0x20'),this[_0x6f15('0x1e')]['bind'](this));ami['on'](_0x6f15('0x21'),this[_0x6f15('0x1e')][_0x6f15('0x1d')](this));ami['on']('custom:amd',this[_0x6f15('0x1e')][_0x6f15('0x1d')](this));ami['on'](_0x6f15('0x22'),this['syncCustomEvent'][_0x6f15('0x1d')](this));ami['on']('custom:timeout',this[_0x6f15('0x1e')][_0x6f15('0x1d')](this));ami['on'](_0x6f15('0x23'),this[_0x6f15('0x24')][_0x6f15('0x1d')](this));ami['on']('custom:dialconnect',this['syncAgentDial'][_0x6f15('0x1d')](this));ami['on'](_0x6f15('0x25'),this[_0x6f15('0x24')][_0x6f15('0x1d')](this));ami['on'](_0x6f15('0x26'),this[_0x6f15('0x1e')][_0x6f15('0x1d')](this));ami['on']('custom:closedinteraction',this[_0x6f15('0x1e')][_0x6f15('0x1d')](this));ami['on'](_0x6f15('0x27'),this[_0x6f15('0x1e')][_0x6f15('0x1d')](this));ami['on']('custom:incomingmessage',this[_0x6f15('0x1e')]['bind'](this));ami['on'](_0x6f15('0x28'),this['syncCustomEvent']['bind'](this));ami['on']('custom:acceptmessage',this[_0x6f15('0x1e')]['bind'](this));ami['on']('custom:rejectmessage',this[_0x6f15('0x1e')][_0x6f15('0x1d')](this));}Trigger[_0x6f15('0x29')]['emit']=function(_0x491b16,_0x1d1f2c,_0x5a31ee){logger[_0x6f15('0x2a')](_0x491b16,_0x1d1f2c,JSON[_0x6f15('0x2b')](_0x5a31ee));io['to'](_0x491b16)['emit'](_0x1d1f2c,_0x5a31ee);};Trigger[_0x6f15('0x29')][_0x6f15('0x1e')]=function(_0x1bae86){var _0x4d7fd9=_['clone'](_0x1bae86);if(typeof _0x4d7fd9[_0x6f15('0x2c')]===_0x6f15('0x2d')){_0x4d7fd9[_0x6f15('0x2c')]=_0x6f15('0x2e');}this[_0x6f15('0x2f')](_0x4d7fd9);};Trigger[_0x6f15('0x29')][_0x6f15('0x24')]=function(_0x1c7209){if(this[_0x6f15('0xf')][_0x1c7209[_0x6f15('0x30')]]){this[_0x6f15('0x1e')](_0x1c7209);}};Trigger[_0x6f15('0x29')]['checkTriggers']=function(_0x4f774d){var _0x11dfa6;for(var _0x34deeb in this[_0x6f15('0xe')]){if(this[_0x6f15('0xe')][_0x6f15('0x31')](_0x34deeb)){if(this[_0x6f15('0xe')][_0x34deeb]['status']){_0x11dfa6=this['checkTrigger'](this[_0x6f15('0xe')][_0x34deeb],_0x4f774d);if(_0x11dfa6){_[_0x6f15('0x32')](_0x4f774d,_0x4f774d['variables']);for(var _0x4652c2=0x0,_0x12724b,_0x314c51,_0x260aad;_0x4652c20x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file +var _0x326f=['catch','stringify','unmanaged','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','desk','redis','defaults','localhost','validateEmail','info','Getting\x20agent\x20with\x20email','%s/users','then','total_entries','_embedded','entries','Agent\x20found!','format','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','debug','[HTTP]','GET','authType','basic','password','%s/token:%s','Basic\x20%s','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','work','map','length','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','toString','variable','variableName','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','xCALLY','concat','Descriptions','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','integrationTab','%s/agent/tickets/%s'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x326f,0xd1));var _0xf326=function(_0x3da3f1,_0x3ca4d6){_0x3da3f1=_0x3da3f1-0x0;var _0x185227=_0x326f[_0x3da3f1];return _0x185227;};'use strict';var _=require(_0xf326('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xf326('0x1'));var Redis=require(_0xf326('0x2'));var intUtil=require(_0xf326('0x3'));var config=require(_0xf326('0x4'));var logger=require(_0xf326('0x5'))(_0xf326('0x6'));config[_0xf326('0x7')]=_[_0xf326('0x8')](config[_0xf326('0x7')],{'host':_0xf326('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf326('0x7')]));function emit(_0x3851eb,_0x165f95,_0x1e7b8a){io['to'](_0x3851eb)['emit'](_0x165f95,_0x1e7b8a);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x3bacf2,_0x1fc80e){if(intUtil[_0xf326('0xa')](_0x1fc80e)===!![]){logger[_0xf326('0xb')](_0xf326('0xc'),_0x1fc80e);return request({'uri':util['format'](_0xf326('0xd'),_0x3bacf2['remoteUri'])})[_0xf326('0xe')](function(_0x4aaf3a){if(_0x4aaf3a[_0xf326('0xf')]){return _['find'](_0x4aaf3a[_0xf326('0x10')][_0xf326('0x11')],{'email':_0x1fc80e});}})['then'](function(_0x342fe5){if(_0x342fe5){logger[_0xf326('0xb')](_0xf326('0x12'));return _0x342fe5;}else{logger[_0xf326('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf326('0x13')]('%s/users/me',_0x3bacf2['remoteUri'])});}});}else{logger[_0xf326('0xb')](_0xf326('0x14'));return request({'uri':util[_0xf326('0x13')](_0xf326('0x15'),_0x3bacf2[_0xf326('0x16')])});}}function request(_0x287a2a){logger[_0xf326('0x17')](_0xf326('0x18'),JSON['stringify'](_0x287a2a));return rp(_[_0xf326('0x8')](_0x287a2a,{'method':_0xf326('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x18bee3){var _0x31ffb9;if(_0x18bee3[_0xf326('0x1a')]===_0xf326('0x1b')){_0x31ffb9=util['format']('%s:%s',_0x18bee3['username'],_0x18bee3[_0xf326('0x1c')]);}else if(_0x18bee3[_0xf326('0x1a')]==='token'){_0x31ffb9=util['format'](_0xf326('0x1d'),_0x18bee3['username'],_0x18bee3['token']);}return util[_0xf326('0x13')](_0xf326('0x1e'),new Buffer(_0x31ffb9)['toString']('base64'));}function getEndUser(_0x19b8ba,_0xb1efcf,_0x5f21a2){logger[_0xf326('0xb')](_0xf326('0x1f'),_0x5f21a2);return request({'uri':util[_0xf326('0x13')](_0xf326('0x20'),_0x19b8ba[_0xf326('0x16')]),'qs':{'phone':_0x5f21a2}})[_0xf326('0xe')](function(_0x5ce532){if(_0x5ce532['total_entries']){logger['info'](_0xf326('0x21'));return _0x5ce532[_0xf326('0x10')][_0xf326('0x11')][0x0];}else{logger[_0xf326('0xb')](_0xf326('0x22'));return request({'uri':util[_0xf326('0x13')]('%s/customers',_0x19b8ba[_0xf326('0x16')]),'method':_0xf326('0x23'),'body':{'first_name':_0xb1efcf,'title':_0xb1efcf,'phone_numbers':[{'type':_0xf326('0x24'),'value':_0x5f21a2}]}});}});}function getTags(_0x581531,_0x1617d2){var _0x55ad0f=[];if(_0x581531&&_0x581531['length']>0x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 4af31da..43594fb 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 _0x02a9=['lastIndexOf','enduserId','GET','%2b','telephone1','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','includes','string','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','assign','getString','Subjects','Descriptions','Fields','phonecall','callDirection','/contacts(','queue','POST','phonecalls','format','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','remoteUri','username','password','clientSecret','then','catch','error','toUpperCase','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','userEmail','email','length','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','message','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','Bearer\x20','headers','odata-entityid','substring'];(function(_0x1507be,_0x2f8b5f){var _0x463a5f=function(_0x5d86e9){while(--_0x5d86e9){_0x1507be['push'](_0x1507be['shift']());}};_0x463a5f(++_0x2f8b5f);}(_0x02a9,0x1c3));var _0x902a=function(_0x7f90e1,_0x43e6c3){_0x7f90e1=_0x7f90e1-0x0;var _0x246495=_0x02a9[_0x7f90e1];return _0x246495;};'use strict';var _=require('lodash');var BPromise=require(_0x902a('0x0'));var rp=require(_0x902a('0x1'));var util=require(_0x902a('0x2'));var intUtil=require(_0x902a('0x3'));var md5=require(_0x902a('0x4'));var Redis=require(_0x902a('0x5'));var logger=require(_0x902a('0x6'))('dynamics365');var config=require(_0x902a('0x7'));config[_0x902a('0x8')]=_[_0x902a('0x9')](config[_0x902a('0x8')],{'host':_0x902a('0xa'),'port':0x18eb});var io=require(_0x902a('0xb'))(new Redis(config[_0x902a('0x8')]));function getAuthToken(_0x377845,_0x420f63,_0x5e5caa){var _0x12a649={'method':'POST','uri':_0x420f63,'form':{'client_id':_0x377845['clientId'],'resource':_0x377845[_0x902a('0xc')],'username':_0x377845[_0x902a('0xd')],'password':_0x377845[_0x902a('0xe')],'grant_type':'password','client_secret':_0x377845[_0x902a('0xf')]},'json':!![]};return rp(_0x12a649)[_0x902a('0x10')](function(_0x5c1034){return _0x5c1034['access_token'];})[_0x902a('0x11')](function(_0x51ef19){logger[_0x902a('0x12')]('['+[_0x5e5caa[_0x902a('0x13')]()]+']\x20Wrong\x20credentials!');return _0x51ef19['message'];});}function getUser(_0x33e2b5,_0xb5166a,_0x3d5737,_0x25a106,_0x3d508f,_0x42871b){return new BPromise(function(_0x377979,_0xa4c7bb){return getAuthToken(_0xb5166a,_0x25a106,_0x42871b)[_0x902a('0x10')](function(_0x46d09b){var _0x4d3343={'method':'GET','uri':_0x3d508f+_0x902a('0x14'),'headers':{'Authorization':'Bearer\x20'+_0x46d09b,'OData-Version':_0x902a('0x15')},'json':!![]};return rp(_0x4d3343);})[_0x902a('0x10')](function(_0x18d2f3){var _0x2b7ada=_0x18d2f3[_0x902a('0x16')];var _0x248734=![];var _0x2b29c6=null;if(!_[_0x902a('0x17')](_0x3d5737)){if(intUtil['validateEmail'](_0x3d5737['email'])){_0x33e2b5[_0x902a('0x18')]=_0x3d5737[_0x902a('0x19')];for(_0x2b29c6=0x0;_0x2b29c6<_0x2b7ada[_0x902a('0x1a')];_0x2b29c6++){if(_0x2b7ada[_0x2b29c6]['internalemailaddress']===_0x3d5737[_0x902a('0x19')]&&!_0x2b7ada[_0x2b29c6]['isdisabled']){_0x248734=!![];logger[_0x902a('0x1b')]('['+[_0x42871b[_0x902a('0x13')]()]+_0x902a('0x1c')+_0x2b7ada[_0x2b29c6][_0x902a('0x1d')]+'!');_0x33e2b5[_0x902a('0x1e')]=_0x2b7ada[_0x2b29c6][_0x902a('0x1d')];}}}}if(!_0x248734){logger['info']('['+[_0x42871b[_0x902a('0x13')]()]+_0x902a('0x1f'));_0x33e2b5[_0x902a('0x18')]=_0xb5166a[_0x902a('0xd')];for(_0x2b29c6=0x0;_0x2b29c6<_0x2b7ada['length'];_0x2b29c6++){if(_0x2b7ada[_0x2b29c6][_0x902a('0x20')]===_0xb5166a[_0x902a('0xd')]){_0x33e2b5[_0x902a('0x1e')]=_0x2b7ada[_0x2b29c6][_0x902a('0x1d')];}}}_0x377979(_0x33e2b5);})[_0x902a('0x11')](function(_0x356525){_0xa4c7bb(_0x356525[_0x902a('0x21')]);});});}function createEndUser(_0x103747,_0x238051,_0x479283,_0x25fc77,_0x626ba8,_0x213dcb){return new BPromise(function(_0x43190d,_0x2db30f){return getAuthToken(_0x238051,_0x479283,_0x213dcb)[_0x902a('0x10')](function(_0x14f214){var _0x54d5ca=_0x213dcb[_0x902a('0x22')]()===_0x902a('0x23')?_0x626ba8[_0x902a('0x24')]:_0x626ba8[_0x902a('0x25')];var _0x1d6a5b={'method':'POST','uri':_0x25fc77+_0x902a('0x26'),'body':{'telephone1':_0x54d5ca,'fullname':_0x54d5ca,'firstname':_0x54d5ca,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x902a('0x27')+_0x103747[_0x902a('0x1e')]+')'},'headers':{'Authorization':_0x902a('0x28')+_0x14f214,'OData-Version':_0x902a('0x15')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x1d6a5b);})[_0x902a('0x10')](function(_0x43ce1b){var _0x51bba7=_0x43ce1b[_0x902a('0x29')][_0x902a('0x2a')];var _0x596ae0=_0x51bba7[_0x902a('0x2b')](_0x51bba7[_0x902a('0x2c')]('(')+0x1,_0x51bba7[_0x902a('0x2c')](')'));_0x103747[_0x902a('0x2d')]=_0x596ae0;_0x43190d(_0x103747);})[_0x902a('0x11')](function(_0x4021ae){_0x2db30f(_0x4021ae['message']);});});}function getEndUser(_0x23d9c7,_0xd04931,_0xc08512,_0x587296,_0xdcf18c,_0x246b63,_0x3572dc){var _0x1a336d=_0x246b63[_0x902a('0x22')]()==='outbound'?_0xdcf18c[_0x902a('0x24')]:_0xdcf18c[_0x902a('0x25')];return getAuthToken(_0xd04931,_0xc08512,_0x246b63)[_0x902a('0x10')](function(_0x21a927){var _0x56405d={'method':_0x902a('0x2e'),'uri':_0x587296+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x1a336d['replace']('+',_0x902a('0x2f'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x21a927,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x56405d);})[_0x902a('0x10')](function(_0x2035d5){var _0x4059d4=![];if(!_0x2035d5)return _0x4059d4;var _0x53a344=_0x2035d5[_0x902a('0x16')];for(var _0x18495b=0x0;_0x18495b<_0x53a344['length'];_0x18495b++){if(_0x53a344[_0x18495b][_0x902a('0x30')]===_0x1a336d){_0x4059d4=!![];_0x23d9c7[_0x902a('0x2d')]=_0x53a344[_0x18495b]['contactid'];}}return _0x4059d4;})[_0x902a('0x10')](function(_0x30106b){if(_0x30106b)return _0x23d9c7;if(_0x3572dc===_0x902a('0x31')){logger['info']('['+[_0x246b63['toUpperCase']()]+_0x902a('0x32'));return _0x23d9c7;}return createEndUser(_0x23d9c7,_0xd04931,_0xc08512,_0x587296,_0xdcf18c,_0x246b63)[_0x902a('0x10')](function(_0x45d495){logger[_0x902a('0x1b')]('['+[_0x246b63[_0x902a('0x13')]()]+']\x20Enduser\x20created!',_0x45d495[_0x902a('0x2d')]);return _0x45d495;});});}function getCustomFields(_0x464a89,_0x56b1fb,_0x15d22f){var _0x345ae6={};if(_0x464a89[_0x902a('0x1a')]>0x0){_['forEach'](_0x464a89,function(_0x362565){if(_[_0x902a('0x33')]([_0x902a('0x34'),_0x902a('0x35')],_0x362565[_0x902a('0x36')])&&_0x362565[_0x902a('0x37')]&&!_0x362565[_0x902a('0x38')]){var _0x2895ad=_0x362565[_0x902a('0x39')]['toLowerCase']();var _0x1f4711=_0x2895ad['substring'](0x0,_0x2895ad[_0x902a('0x3a')]('_'));var _0x458ebf=_0x2895ad[_0x902a('0x2b')](_0x2895ad[_0x902a('0x3a')]('_')+0x1);if(_0x1f4711===_0x15d22f){_0x345ae6[_0x458ebf]=_0x362565[_0x902a('0x3b')];}}});}return _0x345ae6;}function getTicket(_0x448cd2,_0x3643ac,_0x2dbba3,_0x24ebd9,_0x3df5ee,_0x114177,_0x2658fe){return new BPromise(function(_0x2486b8,_0x44d741){var _0x63ce5f;return getAuthToken(_0x3643ac,_0x2dbba3,_0x2658fe)[_0x902a('0x10')](function(_0x5f06cb){if(_0x114177[_0x902a('0x3c')]===_0x902a('0x3d')){_0x63ce5f={'method':'POST','uri':_0x24ebd9+'incidents','body':Object[_0x902a('0x3e')]({},{'title':intUtil[_0x902a('0x3f')](_0x114177[_0x902a('0x40')],_0x3df5ee,'\x20'),'description':intUtil[_0x902a('0x3f')](_0x114177[_0x902a('0x41')],_0x3df5ee,'\x0a'),'customerid_contact@odata.bind':_0x448cd2[_0x902a('0x2d')]?'/contacts('+_0x448cd2[_0x902a('0x2d')]+')':undefined,'ownerid@odata.bind':_0x902a('0x27')+_0x448cd2[_0x902a('0x1e')]+')','caseorigincode':'1'},getCustomFields(_0x114177[_0x902a('0x42')],_0x3df5ee,_0x114177[_0x902a('0x3c')])),'headers':{'Authorization':'Bearer\x20'+_0x5f06cb,'OData-Version':_0x902a('0x15')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x114177[_0x902a('0x3c')]===_0x902a('0x43')){var _0x5301aa=_0x448cd2[_0x902a('0x2d')]?[{'partyid_systemuser@odata.bind':_0x902a('0x27')+_0x448cd2[_0x902a('0x1e')]+')','participationtypemask':_0x448cd2[_0x902a('0x44')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x902a('0x45')+_0x448cd2['enduserId']+')','participationtypemask':_0x448cd2[_0x902a('0x44')]===_0x902a('0x46')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x902a('0x27')+_0x448cd2[_0x902a('0x1e')]+')','participationtypemask':_0x448cd2[_0x902a('0x44')]==='queue'?0x2:0x1}];_0x63ce5f={'method':_0x902a('0x47'),'uri':_0x24ebd9+_0x902a('0x48'),'body':Object['assign']({},{'subject':intUtil[_0x902a('0x3f')](_0x114177[_0x902a('0x40')],_0x3df5ee,'\x20'),'phonenumber':String(_0x3df5ee[_0x902a('0x25')]),'description':intUtil['getString'](_0x114177['Descriptions'],_0x3df5ee,'\x0a'),'regardingobjectid_contact@odata.bind':_0x448cd2[_0x902a('0x2d')]?_0x902a('0x45')+_0x448cd2[_0x902a('0x2d')]+')':undefined,'ownerid@odata.bind':_0x902a('0x27')+_0x448cd2[_0x902a('0x1e')]+')','directioncode':_0x448cd2[_0x902a('0x44')]==='queue'?![]:!![],'phonecall_activity_parties':_0x5301aa},getCustomFields(_0x114177[_0x902a('0x42')],_0x3df5ee,_0x114177[_0x902a('0x3c')])),'headers':{'Authorization':_0x902a('0x28')+_0x5f06cb,'OData-Version':_0x902a('0x15')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x63ce5f);})[_0x902a('0x10')](function(_0x59bfe2){var _0x1a2693=_0x59bfe2[_0x902a('0x29')]['odata-entityid'];var _0x1f3c9b=_0x1a2693['substring'](_0x1a2693[_0x902a('0x2c')]('(')+0x1,_0x1a2693[_0x902a('0x2c')](')'));_0x448cd2['ticketId']=_0x1f3c9b;_0x2486b8(_0x448cd2);})['catch'](function(_0xa7e9c9){_0x44d741(_0xa7e9c9[_0x902a('0x21')]);});});}function emit(_0x3dc378,_0x2d42f2,_0x39d70a,_0x36a70f){var _0x52d3af={'uri':util[_0x902a('0x49')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x3dc378,_0x39d70a,_0x36a70f)};io['to'](util[_0x902a('0x49')](_0x902a('0x4a'),_0x2d42f2))['emit'](_0x902a('0x4b'),_0x52d3af);}exports['cs']=function(_0xfc6dc9,_0x1d68b2,_0x4463e5,_0x5f026d,_0x4ea041,_0x18cba6,_0x25228e,_0x20e361){var _0x14a739={};_0x18cba6[_0x902a('0xc')]=intUtil[_0x902a('0x4c')](_0x18cba6[_0x902a('0xc')]);_0x18cba6[_0x902a('0x4d')]=intUtil[_0x902a('0x4c')](_0x18cba6[_0x902a('0x4d')]);_0x14a739['callDirection']=_0x20e361==='queue'||_0x20e361===_0x902a('0x4e')?_0x902a('0x46'):_0x902a('0x23');var _0x288ee2=util[_0x902a('0x49')](_0x902a('0x4f'),_0x18cba6[_0x902a('0xc')]);var _0x4fb7f6=util[_0x902a('0x49')](_0x902a('0x50'),_0x18cba6[_0x902a('0x51')]);var _0x481cbb=util[_0x902a('0x49')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x18cba6['serverUrl'],_0x1d68b2[_0x902a('0x52')],md5(_0x1d68b2[_0x902a('0x52')]));if(_0x4ea041&&_0x4ea041[_0x902a('0x53')]){logger['info']('[QUEUE]',_0x902a('0x54'));_0x1d68b2[_0x902a('0x55')]=_0x481cbb;}else if(_0x25228e&&_0x25228e['recordingFormat']&&_0x25228e[_0x902a('0x56')]!==_0x902a('0x57')){logger[_0x902a('0x1b')](_0x902a('0x58'),_0x902a('0x54'));_0x1d68b2['recordingURL']=_0x481cbb;}else{_0x1d68b2['recordingURL']='';}return getUser(_0x14a739,_0x18cba6,_0x5f026d,_0x4fb7f6,_0x288ee2,_0x20e361)['then'](function(_0xed1f8d){logger['info']('['+_0x20e361[_0x902a('0x13')]()+_0x902a('0x59'),_0xed1f8d[_0x902a('0x1e')]);logger[_0x902a('0x1b')]('['+_0x20e361[_0x902a('0x13')]()+_0x902a('0x5a'),_0xed1f8d[_0x902a('0x18')]);return getEndUser(_0xed1f8d,_0x18cba6,_0x4fb7f6,_0x288ee2,_0x1d68b2,_0x20e361,_0x4463e5[_0x902a('0x5b')]);})[_0x902a('0x10')](function(_0x3dddf0){logger[_0x902a('0x1b')]('['+_0x20e361[_0x902a('0x13')]()+_0x902a('0x5c'),_0x3dddf0['enduserId']);logger['info']('['+_0x20e361['toUpperCase']()+_0x902a('0x5d'),_0x1d68b2[_0x902a('0x25')]);return getTicket(_0x3dddf0,_0x18cba6,_0x4fb7f6,_0x288ee2,_0x1d68b2,_0x4463e5,_0x20e361);})[_0x902a('0x10')](function(_0xbf549d){logger[_0x902a('0x1b')](util[_0x902a('0x49')]('['+_0x20e361[_0x902a('0x13')]()+_0x902a('0x5e'),_0x4463e5[_0x902a('0x3c')],_0xbf549d[_0x902a('0x5f')]));logger[_0x902a('0x1b')](util[_0x902a('0x49')]('['+_0x20e361[_0x902a('0x13')]()+_0x902a('0x60'),_0x20e361));if(_0x20e361!==_0x902a('0x4e')){logger[_0x902a('0x1b')]('['+_0x20e361[_0x902a('0x13')]()+']',_0x902a('0x61'));emit(_0x18cba6['remoteUri'],_0x5f026d[_0x902a('0x62')],_0x4463e5[_0x902a('0x3c')],_0xbf549d[_0x902a('0x5f')]);}})['catch'](function(_0x22738f){logger[_0x902a('0x12')]('['+_0x20e361[_0x902a('0x13')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util['inspect'](_0x22738f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe86f=['inspect','lodash','util','./util','md5','ioredis','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','POST','clientId','remoteUri','password','clientSecret','access_token','catch','toUpperCase','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','userEmail','email','internalemailaddress','isdisabled','info','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','length','userId','toLowerCase','outbound','destcalleridnum','contacts','/systemusers(','headers','lastIndexOf','enduserId','calleridnum','replace','%2b','telephone1','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','includes','string','picklist','type','nameField','customField','substring','indexOf','incident','incidents','getString','Subjects','/contacts(','Fields','ticketType','phonecall','callDirection','queue','assign','Descriptions','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','name'];(function(_0x5cec56,_0x55805a){var _0xbe5fda=function(_0x54d392){while(--_0x54d392){_0x5cec56['push'](_0x5cec56['shift']());}};_0xbe5fda(++_0x55805a);}(_0xe86f,0x12a));var _0xfe86=function(_0xa08531,_0x41cd82){_0xa08531=_0xa08531-0x0;var _0x29446d=_0xe86f[_0xa08531];return _0x29446d;};'use strict';var _=require(_0xfe86('0x0'));var BPromise=require('bluebird');var rp=require('request-promise');var util=require(_0xfe86('0x1'));var intUtil=require(_0xfe86('0x2'));var md5=require(_0xfe86('0x3'));var Redis=require(_0xfe86('0x4'));var logger=require('../../../../config/logger')(_0xfe86('0x5'));var config=require(_0xfe86('0x6'));config[_0xfe86('0x7')]=_[_0xfe86('0x8')](config[_0xfe86('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xfe86('0x9'))(new Redis(config[_0xfe86('0x7')]));function getAuthToken(_0x51dba4,_0x1dd271,_0x27f8d5){var _0xeaeac5={'method':_0xfe86('0xa'),'uri':_0x1dd271,'form':{'client_id':_0x51dba4[_0xfe86('0xb')],'resource':_0x51dba4[_0xfe86('0xc')],'username':_0x51dba4['username'],'password':_0x51dba4[_0xfe86('0xd')],'grant_type':_0xfe86('0xd'),'client_secret':_0x51dba4[_0xfe86('0xe')]},'json':!![]};return rp(_0xeaeac5)['then'](function(_0x47ceea){return _0x47ceea[_0xfe86('0xf')];})[_0xfe86('0x10')](function(_0x459445){logger['error']('['+[_0x27f8d5[_0xfe86('0x11')]()]+']\x20Wrong\x20credentials!');return _0x459445[_0xfe86('0x12')];});}function getUser(_0x241be8,_0x4765dd,_0x51035b,_0x409ec1,_0x226634,_0x2219d1){return new BPromise(function(_0x5537ef,_0x44cb1d){return getAuthToken(_0x4765dd,_0x409ec1,_0x2219d1)[_0xfe86('0x13')](function(_0x54330b){var _0x560822={'method':_0xfe86('0x14'),'uri':_0x226634+_0xfe86('0x15'),'headers':{'Authorization':_0xfe86('0x16')+_0x54330b,'OData-Version':_0xfe86('0x17')},'json':!![]};return rp(_0x560822);})[_0xfe86('0x13')](function(_0x19478d){var _0x27d9d3=_0x19478d[_0xfe86('0x18')];var _0x49e78a=![];var _0x3750ff=null;if(!_['isNil'](_0x51035b)){if(intUtil[_0xfe86('0x19')](_0x51035b['email'])){_0x241be8[_0xfe86('0x1a')]=_0x51035b[_0xfe86('0x1b')];for(_0x3750ff=0x0;_0x3750ff<_0x27d9d3['length'];_0x3750ff++){if(_0x27d9d3[_0x3750ff][_0xfe86('0x1c')]===_0x51035b[_0xfe86('0x1b')]&&!_0x27d9d3[_0x3750ff][_0xfe86('0x1d')]){_0x49e78a=!![];logger[_0xfe86('0x1e')]('['+[_0x2219d1[_0xfe86('0x11')]()]+']\x20Agent\x20found\x20'+_0x27d9d3[_0x3750ff][_0xfe86('0x1f')]+'!');_0x241be8['userId']=_0x27d9d3[_0x3750ff][_0xfe86('0x1f')];}}}}if(!_0x49e78a){logger[_0xfe86('0x1e')]('['+[_0x2219d1[_0xfe86('0x11')]()]+_0xfe86('0x20'));_0x241be8[_0xfe86('0x1a')]=_0x4765dd[_0xfe86('0x21')];for(_0x3750ff=0x0;_0x3750ff<_0x27d9d3[_0xfe86('0x22')];_0x3750ff++){if(_0x27d9d3[_0x3750ff][_0xfe86('0x1c')]===_0x4765dd[_0xfe86('0x21')]){_0x241be8[_0xfe86('0x23')]=_0x27d9d3[_0x3750ff][_0xfe86('0x1f')];}}}_0x5537ef(_0x241be8);})[_0xfe86('0x10')](function(_0x32b996){_0x44cb1d(_0x32b996[_0xfe86('0x12')]);});});}function createEndUser(_0x9d2bd5,_0x4abea3,_0x470f0c,_0x1eecb8,_0x3ad92a,_0x1c0132){return new BPromise(function(_0x359548,_0x47565b){return getAuthToken(_0x4abea3,_0x470f0c,_0x1c0132)[_0xfe86('0x13')](function(_0x5a1edd){var _0x3d025a=_0x1c0132[_0xfe86('0x24')]()===_0xfe86('0x25')?_0x3ad92a[_0xfe86('0x26')]:_0x3ad92a['calleridnum'];var _0x1d9e57={'method':_0xfe86('0xa'),'uri':_0x1eecb8+_0xfe86('0x27'),'body':{'telephone1':_0x3d025a,'fullname':_0x3d025a,'firstname':_0x3d025a,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xfe86('0x28')+_0x9d2bd5[_0xfe86('0x23')]+')'},'headers':{'Authorization':_0xfe86('0x16')+_0x5a1edd,'OData-Version':_0xfe86('0x17')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x1d9e57);})['then'](function(_0x2a491b){var _0x38c7d6=_0x2a491b[_0xfe86('0x29')]['odata-entityid'];var _0xc919ce=_0x38c7d6['substring'](_0x38c7d6[_0xfe86('0x2a')]('(')+0x1,_0x38c7d6['lastIndexOf'](')'));_0x9d2bd5[_0xfe86('0x2b')]=_0xc919ce;_0x359548(_0x9d2bd5);})[_0xfe86('0x10')](function(_0x4ffb01){_0x47565b(_0x4ffb01[_0xfe86('0x12')]);});});}function getEndUser(_0x764c14,_0x3988d9,_0xc0490a,_0x3e8adf,_0x578978,_0x345427,_0x4e35c2){var _0x2d6b16=_0x345427['toLowerCase']()===_0xfe86('0x25')?_0x578978[_0xfe86('0x26')]:_0x578978[_0xfe86('0x2c')];return getAuthToken(_0x3988d9,_0xc0490a,_0x345427)[_0xfe86('0x13')](function(_0x177ccd){var _0x26f271={'method':_0xfe86('0x14'),'uri':_0x3e8adf+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x2d6b16[_0xfe86('0x2d')]('+',_0xfe86('0x2e'))+'\x27','headers':{'Authorization':_0xfe86('0x16')+_0x177ccd,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x26f271);})[_0xfe86('0x13')](function(_0x296879){var _0x140e82=![];if(!_0x296879)return _0x140e82;var _0x183fbb=_0x296879[_0xfe86('0x18')];for(var _0x24febf=0x0;_0x24febf<_0x183fbb[_0xfe86('0x22')];_0x24febf++){if(_0x183fbb[_0x24febf][_0xfe86('0x2f')]===_0x2d6b16){_0x140e82=!![];_0x764c14[_0xfe86('0x2b')]=_0x183fbb[_0x24febf]['contactid'];}}return _0x140e82;})[_0xfe86('0x13')](function(_0x56194e){if(_0x56194e)return _0x764c14;if(_0x4e35c2===_0xfe86('0x30')){logger[_0xfe86('0x1e')]('['+[_0x345427['toUpperCase']()]+_0xfe86('0x31'));return _0x764c14;}return createEndUser(_0x764c14,_0x3988d9,_0xc0490a,_0x3e8adf,_0x578978,_0x345427)[_0xfe86('0x13')](function(_0x57f38e){logger[_0xfe86('0x1e')]('['+[_0x345427[_0xfe86('0x11')]()]+_0xfe86('0x32'),_0x57f38e[_0xfe86('0x2b')]);return _0x57f38e;});});}function getCustomFields(_0x84f89a,_0x2ffbea,_0x2d5199){var _0x590fc9={};if(_0x84f89a['length']>0x0){_['forEach'](_0x84f89a,function(_0x102c04){if(_[_0xfe86('0x33')]([_0xfe86('0x34'),_0xfe86('0x35')],_0x102c04[_0xfe86('0x36')])&&_0x102c04[_0xfe86('0x37')]&&!_0x102c04[_0xfe86('0x38')]){var _0x2f0dcd=_0x102c04['idField'][_0xfe86('0x24')]();var _0x3acb33=_0x2f0dcd[_0xfe86('0x39')](0x0,_0x2f0dcd['indexOf']('_'));var _0x5ef9e5=_0x2f0dcd[_0xfe86('0x39')](_0x2f0dcd[_0xfe86('0x3a')]('_')+0x1);if(_0x3acb33===_0x2d5199){_0x590fc9[_0x5ef9e5]=_0x102c04['content'];}}});}return _0x590fc9;}function getTicket(_0x538230,_0x20daa5,_0x5d2e96,_0x24725e,_0x5d50d3,_0x3533c4,_0x4810ba){return new BPromise(function(_0x585f9a,_0x5afe4a){var _0x2494d5;return getAuthToken(_0x20daa5,_0x5d2e96,_0x4810ba)[_0xfe86('0x13')](function(_0x9f75fe){if(_0x3533c4['ticketType']===_0xfe86('0x3b')){_0x2494d5={'method':_0xfe86('0xa'),'uri':_0x24725e+_0xfe86('0x3c'),'body':Object['assign']({},{'title':intUtil[_0xfe86('0x3d')](_0x3533c4[_0xfe86('0x3e')],_0x5d50d3,'\x20'),'description':intUtil[_0xfe86('0x3d')](_0x3533c4['Descriptions'],_0x5d50d3,'\x0a'),'customerid_contact@odata.bind':_0x538230['enduserId']?_0xfe86('0x3f')+_0x538230[_0xfe86('0x2b')]+')':undefined,'ownerid@odata.bind':_0xfe86('0x28')+_0x538230[_0xfe86('0x23')]+')','caseorigincode':'1'},getCustomFields(_0x3533c4[_0xfe86('0x40')],_0x5d50d3,_0x3533c4[_0xfe86('0x41')])),'headers':{'Authorization':_0xfe86('0x16')+_0x9f75fe,'OData-Version':_0xfe86('0x17')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3533c4['ticketType']===_0xfe86('0x42')){var _0x52067d=_0x538230[_0xfe86('0x2b')]?[{'partyid_systemuser@odata.bind':_0xfe86('0x28')+_0x538230[_0xfe86('0x23')]+')','participationtypemask':_0x538230[_0xfe86('0x43')]===_0xfe86('0x44')?0x2:0x1},{'partyid_contact@odata.bind':_0xfe86('0x3f')+_0x538230[_0xfe86('0x2b')]+')','participationtypemask':_0x538230[_0xfe86('0x43')]===_0xfe86('0x44')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xfe86('0x28')+_0x538230['userId']+')','participationtypemask':_0x538230[_0xfe86('0x43')]===_0xfe86('0x44')?0x2:0x1}];_0x2494d5={'method':_0xfe86('0xa'),'uri':_0x24725e+'phonecalls','body':Object[_0xfe86('0x45')]({},{'subject':intUtil[_0xfe86('0x3d')](_0x3533c4[_0xfe86('0x3e')],_0x5d50d3,'\x20'),'phonenumber':String(_0x5d50d3[_0xfe86('0x2c')]),'description':intUtil['getString'](_0x3533c4[_0xfe86('0x46')],_0x5d50d3,'\x0a'),'regardingobjectid_contact@odata.bind':_0x538230['enduserId']?'/contacts('+_0x538230[_0xfe86('0x2b')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x538230[_0xfe86('0x23')]+')','directioncode':_0x538230[_0xfe86('0x43')]===_0xfe86('0x44')?![]:!![],'phonecall_activity_parties':_0x52067d},getCustomFields(_0x3533c4['Fields'],_0x5d50d3,_0x3533c4['ticketType'])),'headers':{'Authorization':_0xfe86('0x16')+_0x9f75fe,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2494d5);})[_0xfe86('0x13')](function(_0x36b693){var _0xc5d313=_0x36b693['headers'][_0xfe86('0x47')];var _0x536b50=_0xc5d313[_0xfe86('0x39')](_0xc5d313[_0xfe86('0x2a')]('(')+0x1,_0xc5d313[_0xfe86('0x2a')](')'));_0x538230[_0xfe86('0x48')]=_0x536b50;_0x585f9a(_0x538230);})[_0xfe86('0x10')](function(_0x261303){_0x5afe4a(_0x261303[_0xfe86('0x12')]);});});}function emit(_0x3d4388,_0x956b6d,_0x583866,_0x202301){var _0x5bd076={'uri':util[_0xfe86('0x49')](_0xfe86('0x4a'),_0x3d4388,_0x583866,_0x202301)};io['to'](util[_0xfe86('0x49')](_0xfe86('0x4b'),_0x956b6d))[_0xfe86('0x4c')](_0xfe86('0x4d'),_0x5bd076);}exports['cs']=function(_0x284aba,_0xf1ca78,_0x508c54,_0x30d760,_0xb2c0ad,_0xf4efc,_0x41f6d6,_0x4d4775){var _0x2044dd={};_0xf4efc['remoteUri']=intUtil[_0xfe86('0x4e')](_0xf4efc['remoteUri']);_0xf4efc[_0xfe86('0x4f')]=intUtil['stripTrailingSlash'](_0xf4efc[_0xfe86('0x4f')]);_0x2044dd[_0xfe86('0x43')]=_0x4d4775===_0xfe86('0x44')||_0x4d4775===_0xfe86('0x50')?_0xfe86('0x44'):_0xfe86('0x25');var _0x466a7e=util[_0xfe86('0x49')](_0xfe86('0x51'),_0xf4efc[_0xfe86('0xc')]);var _0x41f4b1=util['format'](_0xfe86('0x52'),_0xf4efc['tenantId']);var _0x10371d=util[_0xfe86('0x49')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xf4efc[_0xfe86('0x4f')],_0xf1ca78[_0xfe86('0x53')],md5(_0xf1ca78['uniqueid']));if(_0xb2c0ad&&_0xb2c0ad[_0xfe86('0x54')]){logger['info'](_0xfe86('0x55'),_0xfe86('0x56'));_0xf1ca78[_0xfe86('0x57')]=_0x10371d;}else if(_0x41f6d6&&_0x41f6d6['recordingFormat']&&_0x41f6d6[_0xfe86('0x58')]!==_0xfe86('0x59')){logger[_0xfe86('0x1e')](_0xfe86('0x5a'),_0xfe86('0x56'));_0xf1ca78[_0xfe86('0x57')]=_0x10371d;}else{_0xf1ca78[_0xfe86('0x57')]='';}return getUser(_0x2044dd,_0xf4efc,_0x30d760,_0x41f4b1,_0x466a7e,_0x4d4775)[_0xfe86('0x13')](function(_0x3fb41d){logger['info']('['+_0x4d4775[_0xfe86('0x11')]()+_0xfe86('0x5b'),_0x3fb41d[_0xfe86('0x23')]);logger[_0xfe86('0x1e')]('['+_0x4d4775[_0xfe86('0x11')]()+_0xfe86('0x5c'),_0x3fb41d[_0xfe86('0x1a')]);return getEndUser(_0x3fb41d,_0xf4efc,_0x41f4b1,_0x466a7e,_0xf1ca78,_0x4d4775,_0x508c54[_0xfe86('0x5d')]);})[_0xfe86('0x13')](function(_0x347ed){logger['info']('['+_0x4d4775[_0xfe86('0x11')]()+_0xfe86('0x5e'),_0x347ed[_0xfe86('0x2b')]);logger['info']('['+_0x4d4775['toUpperCase']()+_0xfe86('0x5f'),_0xf1ca78['calleridnum']);return getTicket(_0x347ed,_0xf4efc,_0x41f4b1,_0x466a7e,_0xf1ca78,_0x508c54,_0x4d4775);})[_0xfe86('0x13')](function(_0x22ad37){logger[_0xfe86('0x1e')](util[_0xfe86('0x49')]('['+_0x4d4775[_0xfe86('0x11')]()+_0xfe86('0x60'),_0x508c54[_0xfe86('0x41')],_0x22ad37[_0xfe86('0x48')]));logger[_0xfe86('0x1e')](util[_0xfe86('0x49')]('['+_0x4d4775[_0xfe86('0x11')]()+']\x20Call\x20direction:\x20%s',_0x4d4775));if(_0x4d4775!=='unmanaged'){logger[_0xfe86('0x1e')]('['+_0x4d4775[_0xfe86('0x11')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0xf4efc[_0xfe86('0xc')],_0x30d760[_0xfe86('0x61')],_0x508c54[_0xfe86('0x41')],_0x22ad37['ticketId']);}})['catch'](function(_0x49913f){logger['error']('['+_0x4d4775[_0xfe86('0x11')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0xfe86('0x62')](_0x49913f,{'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 270723b..7bcac8f 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 _0x49f1=['none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','lastevent','toUpperCase','The\x20Enduser\x20ID\x20is:','request-promise','md5','util','./util','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','info','Ticket\x20created!','validateEmail','format','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20created.','apiKey','toString','base64','[HTTP]','GET','map','forEach','includes','string','picklist','type','nameField','toLowerCase','content','idField','customField','variable','variableName','push','Variable','queue','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','Authorization','The\x20User\x20ID\x20is:','[QUEUE]','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat'];(function(_0x253cee,_0x2678f8){var _0xb0069a=function(_0x3e21b1){while(--_0x3e21b1){_0x253cee['push'](_0x253cee['shift']());}};_0xb0069a(++_0x2678f8);}(_0x49f1,0x65));var _0x149f=function(_0x5dfd07,_0x11f42e){_0x5dfd07=_0x5dfd07-0x0;var _0x10cd46=_0x49f1[_0x5dfd07];return _0x10cd46;};'use strict';var _=require('lodash');var rp=require(_0x149f('0x0'));var md5=require(_0x149f('0x1'));var util=require(_0x149f('0x2'));var Redis=require('ioredis');var intUtil=require(_0x149f('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x149f('0x4'));config[_0x149f('0x5')]=_[_0x149f('0x6')](config[_0x149f('0x5')],{'host':_0x149f('0x7'),'port':0x18eb});var io=require(_0x149f('0x8'))(new Redis(config[_0x149f('0x5')]));var headers={'Content-Type':_0x149f('0x9'),'Accept':_0x149f('0x9')};function emit(_0x58bb88,_0x3cb0cf,_0x174bb0){io['to'](_0x58bb88)[_0x149f('0xa')](_0x3cb0cf,_0x174bb0);}function getTicket(_0x106595,_0x17e5ef,_0x1cb502,_0x4353bc,_0x2f777a){logger['info'](_0x149f('0xb'));var _0x5167e5=_['merge']({'responder_id':_0x17e5ef['id'],'requester_id':_0x1cb502['id'],'name':util['format'](_0x149f('0xc'),_0x2f777a[_0x149f('0xd')]),'phone':_0x2f777a[_0x149f('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x149f('0xf')](_0x4353bc[_0x149f('0x10')],_0x2f777a,'\x20'),'description':intUtil[_0x149f('0xf')](_0x4353bc[_0x149f('0x11')],_0x2f777a,'
'),'tags':getTags(_0x4353bc['Tags'],_0x149f('0x12'))},getCustomFields(_0x4353bc[_0x149f('0x13')],_0x2f777a));_0x5167e5[_0x149f('0x14')]=_[_0x149f('0x15')](_[_0x149f('0x16')](_0x5167e5['custom_fields'],'id'),_0x149f('0x17'));return request({'uri':util['format'](_0x149f('0x18'),_0x106595[_0x149f('0x19')]),'method':_0x149f('0x1a'),'body':_0x5167e5})[_0x149f('0x1b')](function(_0x315e48){logger[_0x149f('0x1c')](_0x149f('0x1d'));return _0x315e48;});}function getUser(_0x3ad53f,_0x433706){if(intUtil[_0x149f('0x1e')](_0x433706)){return request({'uri':util[_0x149f('0x1f')](_0x149f('0x20'),_0x3ad53f[_0x149f('0x19')]),'qs':{'email':_0x433706}})['then'](function(_0x354c12){if(_0x354c12[_0x149f('0x21')]){logger['info'](_0x149f('0x22'));return _[_0x149f('0x23')](_0x354c12,function(_0x4d155c){return _0x4d155c[_0x149f('0x24')][_0x149f('0x25')]===_0x433706;});}else{logger[_0x149f('0x1c')](_0x149f('0x26'));return request({'uri':util[_0x149f('0x1f')]('%s/api/v2/agents/me',_0x3ad53f['remoteUri'])})[_0x149f('0x1b')](function(_0x3a70bf){logger['info']('Admin\x20account\x20selected.');return _0x3a70bf;});}});}else{logger[_0x149f('0x1c')](_0x149f('0x27'));return request({'uri':util[_0x149f('0x1f')]('%s/api/v2/agents/me',_0x3ad53f[_0x149f('0x19')])})[_0x149f('0x1b')](function(_0x548e2c){logger[_0x149f('0x1c')](_0x149f('0x28'));return _0x548e2c;});}}function getEndUser(_0x5d286f,_0x4fb7b9,_0x3394cd){logger[_0x149f('0x1c')](_0x149f('0x29'),_0x3394cd);return request({'uri':util[_0x149f('0x1f')](_0x149f('0x2a'),_0x5d286f[_0x149f('0x19')]),'qs':{'phone':_0x3394cd}})[_0x149f('0x1b')](function(_0x161fed){if(_0x161fed[_0x149f('0x21')]){logger[_0x149f('0x1c')](_0x149f('0x2b'));return _['find'](_0x161fed,{'phone':_0x3394cd});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x149f('0x1f')](_0x149f('0x2a'),_0x5d286f[_0x149f('0x19')]),'method':_0x149f('0x1a'),'body':{'name':_0x4fb7b9,'phone':_0x3394cd}})[_0x149f('0x1b')](function(_0x42c4c6){logger[_0x149f('0x1c')](_0x149f('0x2c'));return _0x42c4c6;});}});}function getAuth(_0x4b2ca7){return util[_0x149f('0x1f')]('Basic\x20%s',new Buffer(_0x4b2ca7[_0x149f('0x2d')]+':X')[_0x149f('0x2e')](_0x149f('0x2f')));}function request(_0xc08609){logger['debug'](_0x149f('0x30'),JSON['stringify'](_0xc08609));return rp(_[_0x149f('0x6')](_0xc08609,{'method':_0x149f('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x3257b2,_0x58c121){var _0x11a0ec=[];if(_0x3257b2&&_0x3257b2[_0x149f('0x21')]>0x0){_0x11a0ec=_[_0x149f('0x32')](_0x3257b2,_0x58c121);}return _0x11a0ec;}function getCustomFields(_0x7b8da8,_0x5f53a7){var _0x35a140=[];var _0x4582e9={'custom_fields':[]};if(_0x7b8da8[_0x149f('0x21')]>0x0){_[_0x149f('0x33')](_0x7b8da8,function(_0x4e062a){if(_[_0x149f('0x34')]([_0x149f('0x35'),_0x149f('0x36')],_0x4e062a[_0x149f('0x37')])&&_0x4e062a[_0x149f('0x38')]&&!_0x4e062a['customField']){_0x4582e9[_0x4e062a[_0x149f('0x38')][_0x149f('0x39')]()]=_0x4e062a[_0x149f('0x3a')][_0x149f('0x2e')]();}else if(_[_0x149f('0x34')]([_0x149f('0x35'),_0x149f('0x36')],_0x4e062a['type'])&&_0x4e062a[_0x149f('0x3b')]&&_0x4e062a[_0x149f('0x3c')]){_0x4582e9['custom_fields']['push']({'id':_0x4e062a[_0x149f('0x3b')],'value':_0x4e062a[_0x149f('0x3a')][_0x149f('0x2e')]()});}else if(_0x4e062a['type']===_0x149f('0x3d')&&_0x4e062a['variableName']&&_0x4e062a[_0x149f('0x3b')]&&_0x4e062a[_0x149f('0x3c')]){_0x5f53a7[_0x4e062a[_0x149f('0x3e')]]&&_0x4582e9[_0x149f('0x14')][_0x149f('0x3f')]({'id':_0x4e062a[_0x149f('0x3b')],'value':_0x5f53a7[_0x4e062a[_0x149f('0x3e')]][_0x149f('0x2e')]()});}else if(_0x4e062a[_0x149f('0x37')]==='customVariable'&&_0x4e062a[_0x149f('0x40')]&&_0x4e062a[_0x149f('0x40')][_0x149f('0x12')]&&_0x4e062a['idField']&&_0x4e062a[_0x149f('0x3c')]){_0x5f53a7[_0x4e062a['Variable'][_0x149f('0x12')][_0x149f('0x39')]()]&&_0x4582e9[_0x149f('0x14')]['push']({'id':_0x4e062a[_0x149f('0x3b')],'value':_0x5f53a7[_0x4e062a[_0x149f('0x40')]['name'][_0x149f('0x39')]()][_0x149f('0x2e')]()});}});}return _0x4582e9;}exports[_0x149f('0x41')]=function(_0x4854ea,_0x1904bb,_0x1a2b78,_0x3d7a29,_0x24dd01,_0x3846c4){var _0x4014cd,_0x3a5ca3;_0x3846c4[_0x149f('0x19')]=intUtil[_0x149f('0x42')](_0x3846c4['remoteUri']);_0x3846c4['serverUrl']=intUtil['stripTrailingSlash'](_0x3846c4['serverUrl']);if(_0x24dd01&&_0x24dd01[_0x149f('0x43')]){logger[_0x149f('0x1c')]('[QUEUE]',_0x149f('0x44'));_0x1904bb[_0x149f('0x45')]=util['format'](_0x149f('0x46'),_0x3846c4[_0x149f('0x47')],_0x1904bb[_0x149f('0x48')],md5(_0x1904bb[_0x149f('0x48')]));}else{_0x1904bb[_0x149f('0x45')]='';}headers[_0x149f('0x49')]=getAuth(_0x3846c4);return getUser(_0x3846c4,_0x3d7a29['email'])['then'](function(_0x3f1b9e){_0x4014cd=_0x3f1b9e;logger[_0x149f('0x1c')](_0x149f('0x4a'),_0x4014cd['id']);return getEndUser(_0x3846c4,_0x1904bb[_0x149f('0xd')],_0x1904bb[_0x149f('0xe')]);})[_0x149f('0x1b')](function(_0x8630d1){_0x3a5ca3=_0x8630d1;logger[_0x149f('0x1c')]('The\x20Enduser\x20ID\x20is:',_0x3a5ca3['id']);return getTicket(_0x3846c4,_0x4014cd,_0x3a5ca3,_0x1a2b78,_0x1904bb);})[_0x149f('0x1b')](function(_0x4f506d){if(_0x4f506d&&_0x4f506d['id']){logger[_0x149f('0x1c')](_0x149f('0x1d'));logger[_0x149f('0x1c')]('The\x20Ticket\x20ID\x20is:',_0x4f506d['id']);logger[_0x149f('0x1c')](_0x149f('0x4b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x149f('0x1f')]('user:%s',_0x3d7a29[_0x149f('0x12')]),_0x149f('0x4c'),{'uri':util[_0x149f('0x1f')](_0x149f('0x4d'),_0x3846c4[_0x149f('0x19')],_0x4f506d['id'])});}})[_0x149f('0x4e')](function(_0x15fa3c){logger[_0x149f('0x4f')]('[QUEUE]',JSON[_0x149f('0x50')](_0x15fa3c));});};exports[_0x149f('0x51')]=function(_0x2b2bbd,_0xecfdfd,_0x267648,_0x4a7e7f,_0x90db32,_0x44371,_0x4a8617){var _0x10600a,_0x4d6415;_0x44371[_0x149f('0x19')]=intUtil[_0x149f('0x42')](_0x44371[_0x149f('0x19')]);_0x44371[_0x149f('0x47')]=intUtil[_0x149f('0x42')](_0x44371[_0x149f('0x47')]);if(_0x4a8617&&_0x4a8617[_0x149f('0x52')]&&_0x4a8617[_0x149f('0x52')]!==_0x149f('0x53')){logger[_0x149f('0x1c')](_0x149f('0x54'),_0x149f('0x44'));_0xecfdfd[_0x149f('0x45')]=util[_0x149f('0x1f')](_0x149f('0x46'),_0x44371[_0x149f('0x47')],_0xecfdfd[_0x149f('0x48')],md5(_0xecfdfd[_0x149f('0x48')]));}headers[_0x149f('0x49')]=getAuth(_0x44371);return getUser(_0x44371,_0x4a7e7f['email'])[_0x149f('0x1b')](function(_0x1f117d){_0x10600a=_0x1f117d;logger[_0x149f('0x1c')](_0x149f('0x4a'),_0x10600a['id']);return getEndUser(_0x44371,_0xecfdfd[_0x149f('0x55')],_0xecfdfd[_0x149f('0x56')]);})[_0x149f('0x1b')](function(_0xb18697){_0x4d6415=_0xb18697;logger[_0x149f('0x1c')]('The\x20Enduser\x20ID\x20is:',_0x4d6415['id']);return getTicket(_0x44371,_0x10600a,_0x4d6415,_0x267648,_0xecfdfd);})[_0x149f('0x1b')](function(_0x54264a){if(_0x54264a&&_0x54264a['id']){logger[_0x149f('0x1c')](_0x149f('0x1d'));logger['info'](_0x149f('0x57'),_0x54264a['id']);logger[_0x149f('0x1c')](_0x149f('0x54'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x149f('0x1f')](_0x149f('0x58'),_0x4a7e7f[_0x149f('0x12')]),_0x149f('0x4c'),{'uri':util[_0x149f('0x1f')](_0x149f('0x4d'),_0x44371[_0x149f('0x19')],_0x54264a['id'])});}})[_0x149f('0x4e')](function(_0xdc64cd){logger[_0x149f('0x4f')]('[OUTBOUND]',JSON[_0x149f('0x50')](_0xdc64cd));});};exports['unmanaged']=function(_0x12020a,_0x5c566d,_0x365f8c,_0x478b1a,_0x5d506a,_0x3b6653){var _0x32a1e2,_0x3d7cfa;_0x3b6653['remoteUri']=intUtil[_0x149f('0x42')](_0x3b6653['remoteUri']);_0x3b6653[_0x149f('0x47')]=intUtil['stripTrailingSlash'](_0x3b6653[_0x149f('0x47')]);if(_0x5d506a&&_0x5d506a[_0x149f('0x43')]){logger['info']('['+_0x5c566d[_0x149f('0x59')][_0x149f('0x5a')]()+']',_0x149f('0x44'));_0x5c566d[_0x149f('0x45')]=util[_0x149f('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3b6653[_0x149f('0x47')],_0x5c566d[_0x149f('0x48')],md5(_0x5c566d[_0x149f('0x48')]));}else{_0x5c566d['recordingURL']='';}headers[_0x149f('0x49')]=getAuth(_0x3b6653);return getUser(_0x3b6653,'')['then'](function(_0x4d5cc4){_0x32a1e2=_0x4d5cc4;logger['info'](_0x149f('0x4a'),_0x32a1e2['id']);return getEndUser(_0x3b6653,_0x5c566d[_0x149f('0xd')],_0x5c566d['calleridnum']);})['then'](function(_0x3df601){_0x3d7cfa=_0x3df601;logger[_0x149f('0x1c')](_0x149f('0x5b'),_0x3d7cfa['id']);return getTicket(_0x3b6653,_0x32a1e2,_0x3d7cfa,_0x365f8c,_0x5c566d);})[_0x149f('0x1b')](function(_0x1208ab){if(_0x1208ab){logger[_0x149f('0x1c')](_0x149f('0x1d'));logger[_0x149f('0x1c')](_0x149f('0x57'),_0x1208ab['id']);}})['catch'](function(_0x5c60ff){logger[_0x149f('0x4f')]('['+_0x5c566d[_0x149f('0x59')][_0x149f('0x5a')]()+']',JSON[_0x149f('0x50')](_0x5c60ff));});}; \ No newline at end of file +var _0xf5ac=['customField','toLowerCase','content','idField','push','variable','variableName','Variable','queue','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20Enduser\x20ID\x20is:','user:%s','catch','error','stripTrailingSlash','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','unmanaged','lastevent','toUpperCase','The\x20User\x20ID\x20is:','lodash','request-promise','util','ioredis','./util','defaults','redis','localhost','socket.io-emitter','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','
','name','Fields','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','remoteUri','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','find','POST','Basic\x20%s','apiKey','toString','base64','debug','stringify','forEach','string','picklist','type','nameField'];(function(_0x4e95ee,_0x10ecff){var _0x2854ce=function(_0x5bcdae){while(--_0x5bcdae){_0x4e95ee['push'](_0x4e95ee['shift']());}};_0x2854ce(++_0x10ecff);}(_0xf5ac,0x18b));var _0xcf5a=function(_0x5c94fd,_0xb3fd05){_0x5c94fd=_0x5c94fd-0x0;var _0x6b10ab=_0xf5ac[_0x5c94fd];return _0x6b10ab;};'use strict';var _=require(_0xcf5a('0x0'));var rp=require(_0xcf5a('0x1'));var md5=require('md5');var util=require(_0xcf5a('0x2'));var Redis=require(_0xcf5a('0x3'));var intUtil=require(_0xcf5a('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('freshdesk');config['redis']=_[_0xcf5a('0x5')](config[_0xcf5a('0x6')],{'host':_0xcf5a('0x7'),'port':0x18eb});var io=require(_0xcf5a('0x8'))(new Redis(config[_0xcf5a('0x6')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0xf14d48,_0x25387f,_0x3c97e6){io['to'](_0xf14d48)[_0xcf5a('0x9')](_0x25387f,_0x3c97e6);}function getTicket(_0x231ba7,_0x57f47c,_0x3ee5cc,_0x2e5642,_0x2e39e2){logger['info'](_0xcf5a('0xa'));var _0x4233a4=_[_0xcf5a('0xb')]({'responder_id':_0x57f47c['id'],'requester_id':_0x3ee5cc['id'],'name':util[_0xcf5a('0xc')](_0xcf5a('0xd'),_0x2e39e2[_0xcf5a('0xe')]),'phone':_0x2e39e2[_0xcf5a('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xcf5a('0x10')](_0x2e5642['Subjects'],_0x2e39e2,'\x20'),'description':intUtil[_0xcf5a('0x10')](_0x2e5642[_0xcf5a('0x11')],_0x2e39e2,_0xcf5a('0x12')),'tags':getTags(_0x2e5642['Tags'],_0xcf5a('0x13'))},getCustomFields(_0x2e5642[_0xcf5a('0x14')],_0x2e39e2));_0x4233a4['custom_fields']=_[_0xcf5a('0x15')](_[_0xcf5a('0x16')](_0x4233a4[_0xcf5a('0x17')],'id'),_0xcf5a('0x18'));return request({'uri':util[_0xcf5a('0xc')](_0xcf5a('0x19'),_0x231ba7['remoteUri']),'method':'POST','body':_0x4233a4})[_0xcf5a('0x1a')](function(_0x3cb9f8){logger[_0xcf5a('0x1b')](_0xcf5a('0x1c'));return _0x3cb9f8;});}function getUser(_0x11191b,_0x2d5eca){if(intUtil[_0xcf5a('0x1d')](_0x2d5eca)){return request({'uri':util[_0xcf5a('0xc')](_0xcf5a('0x1e'),_0x11191b['remoteUri']),'qs':{'email':_0x2d5eca}})[_0xcf5a('0x1a')](function(_0x3cf61f){if(_0x3cf61f[_0xcf5a('0x1f')]){logger['info'](_0xcf5a('0x20'));return _['find'](_0x3cf61f,function(_0xd86e8f){return _0xd86e8f[_0xcf5a('0x21')]['email']===_0x2d5eca;});}else{logger[_0xcf5a('0x1b')](_0xcf5a('0x22'));return request({'uri':util[_0xcf5a('0xc')](_0xcf5a('0x23'),_0x11191b[_0xcf5a('0x24')])})[_0xcf5a('0x1a')](function(_0x3825dd){logger[_0xcf5a('0x1b')](_0xcf5a('0x25'));return _0x3825dd;});}});}else{logger[_0xcf5a('0x1b')](_0xcf5a('0x26'));return request({'uri':util[_0xcf5a('0xc')](_0xcf5a('0x23'),_0x11191b['remoteUri'])})[_0xcf5a('0x1a')](function(_0x1b519d){logger[_0xcf5a('0x1b')]('Admin\x20account\x20selected.');return _0x1b519d;});}}function getEndUser(_0x15a44f,_0x384fd3,_0x5ab8d0){logger[_0xcf5a('0x1b')](_0xcf5a('0x27'),_0x5ab8d0);return request({'uri':util[_0xcf5a('0xc')](_0xcf5a('0x28'),_0x15a44f[_0xcf5a('0x24')]),'qs':{'phone':_0x5ab8d0}})['then'](function(_0x1c994a){if(_0x1c994a[_0xcf5a('0x1f')]){logger[_0xcf5a('0x1b')](_0xcf5a('0x29'));return _[_0xcf5a('0x2a')](_0x1c994a,{'phone':_0x5ab8d0});}else{logger[_0xcf5a('0x1b')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xcf5a('0xc')](_0xcf5a('0x28'),_0x15a44f[_0xcf5a('0x24')]),'method':_0xcf5a('0x2b'),'body':{'name':_0x384fd3,'phone':_0x5ab8d0}})['then'](function(_0x502b11){logger[_0xcf5a('0x1b')]('Enduser\x20created.');return _0x502b11;});}});}function getAuth(_0x21ba03){return util['format'](_0xcf5a('0x2c'),new Buffer(_0x21ba03[_0xcf5a('0x2d')]+':X')[_0xcf5a('0x2e')](_0xcf5a('0x2f')));}function request(_0x24f696){logger[_0xcf5a('0x30')]('[HTTP]',JSON[_0xcf5a('0x31')](_0x24f696));return rp(_[_0xcf5a('0x5')](_0x24f696,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x1dab66,_0x2ccc37){var _0x5e6f99=[];if(_0x1dab66&&_0x1dab66[_0xcf5a('0x1f')]>0x0){_0x5e6f99=_['map'](_0x1dab66,_0x2ccc37);}return _0x5e6f99;}function getCustomFields(_0x3e6616,_0x36a9e7){var _0xa4e07e=[];var _0x4ed345={'custom_fields':[]};if(_0x3e6616[_0xcf5a('0x1f')]>0x0){_[_0xcf5a('0x32')](_0x3e6616,function(_0x2bf720){if(_['includes']([_0xcf5a('0x33'),_0xcf5a('0x34')],_0x2bf720[_0xcf5a('0x35')])&&_0x2bf720[_0xcf5a('0x36')]&&!_0x2bf720[_0xcf5a('0x37')]){_0x4ed345[_0x2bf720['nameField'][_0xcf5a('0x38')]()]=_0x2bf720[_0xcf5a('0x39')]['toString']();}else if(_['includes']([_0xcf5a('0x33'),_0xcf5a('0x34')],_0x2bf720[_0xcf5a('0x35')])&&_0x2bf720[_0xcf5a('0x3a')]&&_0x2bf720[_0xcf5a('0x37')]){_0x4ed345[_0xcf5a('0x17')][_0xcf5a('0x3b')]({'id':_0x2bf720[_0xcf5a('0x3a')],'value':_0x2bf720['content'][_0xcf5a('0x2e')]()});}else if(_0x2bf720[_0xcf5a('0x35')]===_0xcf5a('0x3c')&&_0x2bf720[_0xcf5a('0x3d')]&&_0x2bf720[_0xcf5a('0x3a')]&&_0x2bf720[_0xcf5a('0x37')]){_0x36a9e7[_0x2bf720['variableName']]&&_0x4ed345[_0xcf5a('0x17')][_0xcf5a('0x3b')]({'id':_0x2bf720[_0xcf5a('0x3a')],'value':_0x36a9e7[_0x2bf720['variableName']][_0xcf5a('0x2e')]()});}else if(_0x2bf720[_0xcf5a('0x35')]==='customVariable'&&_0x2bf720[_0xcf5a('0x3e')]&&_0x2bf720['Variable']['name']&&_0x2bf720[_0xcf5a('0x3a')]&&_0x2bf720[_0xcf5a('0x37')]){_0x36a9e7[_0x2bf720[_0xcf5a('0x3e')][_0xcf5a('0x13')]['toLowerCase']()]&&_0x4ed345[_0xcf5a('0x17')]['push']({'id':_0x2bf720['idField'],'value':_0x36a9e7[_0x2bf720[_0xcf5a('0x3e')]['name'][_0xcf5a('0x38')]()][_0xcf5a('0x2e')]()});}});}return _0x4ed345;}exports[_0xcf5a('0x3f')]=function(_0x473458,_0x162ef3,_0x500fb7,_0x5ad360,_0x520b0e,_0x28b345){var _0x18a7ce,_0x1b70e8;_0x28b345[_0xcf5a('0x24')]=intUtil['stripTrailingSlash'](_0x28b345[_0xcf5a('0x24')]);_0x28b345['serverUrl']=intUtil['stripTrailingSlash'](_0x28b345[_0xcf5a('0x40')]);if(_0x520b0e&&_0x520b0e[_0xcf5a('0x41')]){logger['info'](_0xcf5a('0x42'),_0xcf5a('0x43'));_0x162ef3['recordingURL']=util[_0xcf5a('0xc')](_0xcf5a('0x44'),_0x28b345[_0xcf5a('0x40')],_0x162ef3['uniqueid'],md5(_0x162ef3[_0xcf5a('0x45')]));}else{_0x162ef3[_0xcf5a('0x46')]='';}headers[_0xcf5a('0x47')]=getAuth(_0x28b345);return getUser(_0x28b345,_0x5ad360[_0xcf5a('0x48')])[_0xcf5a('0x1a')](function(_0xf469cf){_0x18a7ce=_0xf469cf;logger['info']('The\x20User\x20ID\x20is:',_0x18a7ce['id']);return getEndUser(_0x28b345,_0x162ef3[_0xcf5a('0xe')],_0x162ef3['calleridnum']);})['then'](function(_0x3f2f89){_0x1b70e8=_0x3f2f89;logger[_0xcf5a('0x1b')](_0xcf5a('0x49'),_0x1b70e8['id']);return getTicket(_0x28b345,_0x18a7ce,_0x1b70e8,_0x500fb7,_0x162ef3);})[_0xcf5a('0x1a')](function(_0x2952c4){if(_0x2952c4&&_0x2952c4['id']){logger[_0xcf5a('0x1b')](_0xcf5a('0x1c'));logger[_0xcf5a('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x2952c4['id']);logger[_0xcf5a('0x1b')](_0xcf5a('0x42'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xcf5a('0xc')](_0xcf5a('0x4a'),_0x5ad360[_0xcf5a('0x13')]),'trigger:browser:url',{'uri':util['format']('%s/helpdesk/tickets/%d',_0x28b345['remoteUri'],_0x2952c4['id'])});}})[_0xcf5a('0x4b')](function(_0x3ede17){logger[_0xcf5a('0x4c')](_0xcf5a('0x42'),JSON[_0xcf5a('0x31')](_0x3ede17));});};exports['outbound']=function(_0x21b04f,_0x39b3ca,_0x4ece5b,_0x36a1d0,_0x5731dd,_0x109576,_0x22aa5c){var _0x35dbb7,_0x2281d5;_0x109576[_0xcf5a('0x24')]=intUtil[_0xcf5a('0x4d')](_0x109576['remoteUri']);_0x109576[_0xcf5a('0x40')]=intUtil[_0xcf5a('0x4d')](_0x109576[_0xcf5a('0x40')]);if(_0x22aa5c&&_0x22aa5c[_0xcf5a('0x4e')]&&_0x22aa5c['recordingFormat']!=='none'){logger[_0xcf5a('0x1b')](_0xcf5a('0x4f'),_0xcf5a('0x43'));_0x39b3ca[_0xcf5a('0x46')]=util[_0xcf5a('0xc')](_0xcf5a('0x44'),_0x109576['serverUrl'],_0x39b3ca[_0xcf5a('0x45')],md5(_0x39b3ca[_0xcf5a('0x45')]));}headers['Authorization']=getAuth(_0x109576);return getUser(_0x109576,_0x36a1d0[_0xcf5a('0x48')])[_0xcf5a('0x1a')](function(_0x4edcc7){_0x35dbb7=_0x4edcc7;logger[_0xcf5a('0x1b')]('The\x20User\x20ID\x20is:',_0x35dbb7['id']);return getEndUser(_0x109576,_0x39b3ca[_0xcf5a('0x50')],_0x39b3ca[_0xcf5a('0x51')]);})[_0xcf5a('0x1a')](function(_0x440c86){_0x2281d5=_0x440c86;logger[_0xcf5a('0x1b')](_0xcf5a('0x49'),_0x2281d5['id']);return getTicket(_0x109576,_0x35dbb7,_0x2281d5,_0x4ece5b,_0x39b3ca);})[_0xcf5a('0x1a')](function(_0x28e20d){if(_0x28e20d&&_0x28e20d['id']){logger[_0xcf5a('0x1b')](_0xcf5a('0x1c'));logger['info'](_0xcf5a('0x52'),_0x28e20d['id']);logger[_0xcf5a('0x1b')](_0xcf5a('0x4f'),_0xcf5a('0x53'));emit(util['format'](_0xcf5a('0x4a'),_0x36a1d0[_0xcf5a('0x13')]),_0xcf5a('0x54'),{'uri':util[_0xcf5a('0xc')](_0xcf5a('0x55'),_0x109576[_0xcf5a('0x24')],_0x28e20d['id'])});}})[_0xcf5a('0x4b')](function(_0x3c0558){logger[_0xcf5a('0x4c')](_0xcf5a('0x4f'),JSON[_0xcf5a('0x31')](_0x3c0558));});};exports[_0xcf5a('0x56')]=function(_0x1c2f22,_0x3bc261,_0x45343c,_0x1a0403,_0x1225cc,_0x37fa51){var _0x20c2a4,_0x51691d;_0x37fa51[_0xcf5a('0x24')]=intUtil[_0xcf5a('0x4d')](_0x37fa51['remoteUri']);_0x37fa51['serverUrl']=intUtil[_0xcf5a('0x4d')](_0x37fa51[_0xcf5a('0x40')]);if(_0x1225cc&&_0x1225cc[_0xcf5a('0x41')]){logger['info']('['+_0x3bc261[_0xcf5a('0x57')][_0xcf5a('0x58')]()+']',_0xcf5a('0x43'));_0x3bc261[_0xcf5a('0x46')]=util[_0xcf5a('0xc')](_0xcf5a('0x44'),_0x37fa51[_0xcf5a('0x40')],_0x3bc261[_0xcf5a('0x45')],md5(_0x3bc261[_0xcf5a('0x45')]));}else{_0x3bc261[_0xcf5a('0x46')]='';}headers[_0xcf5a('0x47')]=getAuth(_0x37fa51);return getUser(_0x37fa51,'')[_0xcf5a('0x1a')](function(_0x54a306){_0x20c2a4=_0x54a306;logger[_0xcf5a('0x1b')](_0xcf5a('0x59'),_0x20c2a4['id']);return getEndUser(_0x37fa51,_0x3bc261[_0xcf5a('0xe')],_0x3bc261[_0xcf5a('0xf')]);})['then'](function(_0x2848d6){_0x51691d=_0x2848d6;logger[_0xcf5a('0x1b')]('The\x20Enduser\x20ID\x20is:',_0x51691d['id']);return getTicket(_0x37fa51,_0x20c2a4,_0x51691d,_0x45343c,_0x3bc261);})['then'](function(_0x285a53){if(_0x285a53){logger['info'](_0xcf5a('0x1c'));logger[_0xcf5a('0x1b')](_0xcf5a('0x52'),_0x285a53['id']);}})[_0xcf5a('0x4b')](function(_0x50fdf5){logger['error']('['+_0x3bc261[_0xcf5a('0x57')][_0xcf5a('0x58')]()+']',JSON[_0xcf5a('0x31')](_0x50fdf5));});}; \ 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 c2a18b9..a207dff 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 _0x63ef=['lodash','util','moment','ioredis','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','headers','then','length','email','adminEmail','info','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','message','Getting\x20user\x20list','users','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','toUpperCase','&f=','&entities=contact','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','getString','Contact','add','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','toLowerCase','callDirection','unmanaged','queue','outbound','agentEmail','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','name','inspect'];(function(_0x2e6ddb,_0x4784bf){var _0x4806ba=function(_0x3275c9){while(--_0x3275c9){_0x2e6ddb['push'](_0x2e6ddb['shift']());}};_0x4806ba(++_0x4784bf);}(_0x63ef,0x17c));var _0xf63e=function(_0x5af97c,_0x24a49f){_0x5af97c=_0x5af97c-0x0;var _0x3472ae=_0x63ef[_0x5af97c];return _0x3472ae;};'use strict';var _=require(_0xf63e('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xf63e('0x1'));var moment=require(_0xf63e('0x2'));var Promise=require('bluebird');var Redis=require(_0xf63e('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xf63e('0x4'))(_0xf63e('0x5'));config[_0xf63e('0x6')]=_[_0xf63e('0x7')](config[_0xf63e('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xf63e('0x8'))(new Redis(config[_0xf63e('0x6')]));function getAdminId(_0x4b31b3,_0x4cf1f0,_0x41a01a,_0x3e1eff){return new Promise(function(_0x121ca7,_0x27d561){var _0x2d8d46=![];var _0x28af72={'method':_0xf63e('0x9'),'uri':_0x3e1eff+_0xf63e('0xa'),'json':!![]};_0x28af72[_0xf63e('0xb')]=_0x41a01a;logger['info']('Getting\x20admin\x20information');return rp(_0x28af72)[_0xf63e('0xc')](function(_0x5d4768){if(_0x5d4768){var _0x52b62e=_0x5d4768['users'];var _0xcf5886=null;for(_0xcf5886=0x0;_0xcf5886<_0x52b62e[_0xf63e('0xd')];_0xcf5886++){if(_0x52b62e[_0xcf5886][_0xf63e('0xe')]===_0x4b31b3[_0xf63e('0xf')]){_0x4b31b3['adminId']=_0x52b62e[_0xcf5886]['id'];_0x2d8d46=!![];}}if(_0x2d8d46){logger[_0xf63e('0x10')](_0xf63e('0x11'),_0x4b31b3[_0xf63e('0x12')]);_0x121ca7(_0x4b31b3);}else{_0x27d561({'statusCode':0x194,'message':_0xf63e('0x13')});}}else{_0x27d561({'statusCode':0x194,'message':_0xf63e('0x13')});}})[_0xf63e('0x14')](function(_0x33b846){logger[_0xf63e('0x15')]('['+[_0x4cf1f0['toUpperCase']()]+']',_0x33b846[_0xf63e('0x16')]);_0x27d561(_0x33b846);});});}function getUser(_0x1177e1,_0x17259c,_0x51187b){return function(_0x43a87b){return new Promise(function(_0x19bfe9,_0x378c99){var _0x586232={'method':_0xf63e('0x9'),'uri':_0x51187b+'/api/selector/owners','json':!![]};_0x586232['headers']=_0x17259c;logger['info'](_0xf63e('0x17'));return rp(_0x586232)[_0xf63e('0xc')](function(_0x1da3d){if(_0x1da3d){var _0x127971=_0x1da3d[_0xf63e('0x18')];var _0x21de89=![];var _0x3c1d84=null;if(_0x43a87b['agentEmail']!==null){logger[_0xf63e('0x10')](_0xf63e('0x19'),_0x43a87b['agentEmail']);_0x43a87b[_0xf63e('0x1a')]=_0x43a87b['agentEmail'];for(_0x3c1d84=0x0;_0x3c1d84<_0x127971[_0xf63e('0xd')];_0x3c1d84++){if(_0x127971[_0x3c1d84][_0xf63e('0xe')]===_0x43a87b['agentEmail']){_0x21de89=!![];_0x43a87b[_0xf63e('0x1b')]=_0x127971[_0x3c1d84]['id'];logger['info'](_0xf63e('0x1c'),_0x43a87b[_0xf63e('0x1b')]);}}}if(!_0x21de89){logger['info'](_0xf63e('0x1d'));_0x43a87b[_0xf63e('0x1a')]=_0x43a87b['adminEmail'];_0x43a87b[_0xf63e('0x1b')]=_0x43a87b[_0xf63e('0x12')];_0x21de89=!![];}if(_0x21de89){_0x19bfe9(_0x43a87b);}else{_0x378c99({'statusCode':0x194,'message':_0xf63e('0x13')});}}else{_0x378c99({'statusCode':0x194,'message':_0xf63e('0x13')});}})['catch'](function(_0xb8de29){logger[_0xf63e('0x15')]('['+[_0x1177e1[_0xf63e('0x1e')]()]+']',_0xb8de29[_0xf63e('0x16')]);_0x378c99(_0xb8de29);});});};}function searchContact(_0x3e2766,_0x100422,_0x3cab27,_0xbe49d8){return new Promise(function(_0xe68c7f,_0x5310a9){var _0x2b6bf1={'method':'GET','headers':_0x100422,'uri':_0x3e2766+'/api/lookup?q='+_0xbe49d8+_0xf63e('0x1f')+_0x3cab27+_0xf63e('0x20'),'json':!![]};rp(_0x2b6bf1)['then'](function(_0x4fed14){var _0x5378de=_['find'](_0x4fed14['contacts']['contacts'],[_0x3cab27,_0xbe49d8]);_0xe68c7f(_0x5378de);})['catch'](function(_0x4b1573){_0x5310a9(_0x4b1573);});});}function getEndUser(_0x26ca08,_0x5b118a,_0x2e28aa){return function(_0x3e887f){return new Promise(function(_0x1738d6,_0x34675d){logger[_0xf63e('0x10')](util[_0xf63e('0x21')](_0xf63e('0x22'),_0x3e887f[_0xf63e('0x23')]));searchContact(_0x2e28aa,_0x5b118a,_0xf63e('0x24'),_0x3e887f[_0xf63e('0x23')])['then'](function(_0x214245){if(_0x214245){_0x3e887f[_0xf63e('0x25')]=_0x214245['id'];logger[_0xf63e('0x10')]('Contact\x20found\x20mobile_number:',_0x3e887f[_0xf63e('0x25')]);return _0x1738d6(_0x3e887f);}searchContact(_0x2e28aa,_0x5b118a,_0xf63e('0x26'),_0x3e887f['contactNumber'])[_0xf63e('0xc')](function(_0x7672a0){if(_0x7672a0){_0x3e887f[_0xf63e('0x25')]=_0x7672a0['id'];logger[_0xf63e('0x10')](_0xf63e('0x27'),_0x3e887f[_0xf63e('0x25')]);return _0x1738d6(_0x3e887f);}createEndUser(_0x3e887f,_0x26ca08,_0x5b118a,_0x2e28aa)['then'](function(_0x6ffee7){logger[_0xf63e('0x10')](_0xf63e('0x28'),_0x6ffee7[_0xf63e('0x25')]);return _0x1738d6(_0x6ffee7);});});})[_0xf63e('0x14')](function(_0x5c4441){_0x34675d(_0x5c4441);});});};}function createEndUser(_0x4f0da9,_0x3f6097,_0x1e1581,_0x5da365){return new Promise(function(_0x61ee18,_0x139c63){var _0x171b0d=moment();var _0x498d5d={'method':_0xf63e('0x29'),'uri':_0x5da365+_0xf63e('0x2a'),'body':{'contact':{'last_name':_0x4f0da9['contactNumber'],'work_number':_0x4f0da9['contactNumber'],'mobile_number':_0x4f0da9[_0xf63e('0x23')],'owner_id':_0x4f0da9['userId'],'created_at':_0x171b0d[_0xf63e('0x21')](_0xf63e('0x2b'))}},'json':!![]};_0x498d5d['headers']=_0x1e1581;logger[_0xf63e('0x10')](_0xf63e('0x2c'));return rp(_0x498d5d)[_0xf63e('0xc')](function(_0x3f520d){_0x4f0da9[_0xf63e('0x25')]=_0x3f520d['contact']['id'];_0x61ee18(_0x4f0da9);})[_0xf63e('0x14')](function(_0xb8a318){logger[_0xf63e('0x15')]('['+[_0x3f6097[_0xf63e('0x1e')]()]+']',_0xb8a318[_0xf63e('0x16')]);_0x139c63(_0xb8a318[_0xf63e('0x16')]);});});}function getTicket(_0x459376,_0x5b8d9b,_0x45bb36,_0x43ebdb,_0x4eeab9){return function(_0x573d6b){logger[_0xf63e('0x10')](_0xf63e('0x2d'));return new Promise(function(_0x13010c,_0x2739fb){var _0x5d5dad=moment();var _0x3c3291={'method':_0xf63e('0x29'),'uri':_0x45bb36+'/api/tasks','body':{'title':intUtil[_0xf63e('0x2e')](_0x43ebdb['Subjects'],_0x4eeab9,'\x20'),'description':intUtil[_0xf63e('0x2e')](_0x43ebdb['Descriptions'],_0x4eeab9,'\x0a'),'owner_id':_0x573d6b[_0xf63e('0x1b')],'creater_id':_0x573d6b[_0xf63e('0x12')],'targetable_id':_0x573d6b['endUserId'],'targetable_type':_0xf63e('0x2f'),'created_at':_0x5d5dad[_0xf63e('0x21')](_0xf63e('0x2b')),'due_date':_0x5d5dad[_0xf63e('0x30')](0x1e,'m')[_0xf63e('0x21')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x3c3291[_0xf63e('0xb')]=_0x5b8d9b;return rp(_0x3c3291)[_0xf63e('0xc')](function(_0x620525){_0x573d6b[_0xf63e('0x31')]=_0x620525['task']['id'];logger[_0xf63e('0x10')]('Task\x20created:',_0x573d6b[_0xf63e('0x31')]);_0x13010c(_0x573d6b);})[_0xf63e('0x14')](function(_0x5c092a){logger[_0xf63e('0x15')]('['+[_0x459376[_0xf63e('0x1e')]()]+']',_0x5c092a[_0xf63e('0x16')]);_0x2739fb(_0x5c092a[_0xf63e('0x16')]);});});};}function emit(_0x1105e2,_0x162ede,_0x240d0b){var _0x2684e7={'uri':_0x1105e2+_0xf63e('0x32')+_0x240d0b};io['to'](util[_0xf63e('0x21')](_0xf63e('0x33'),_0x162ede))[_0xf63e('0x34')](_0xf63e('0x35'),_0x2684e7);}exports['cs']=function(_0x544b93,_0x2eec7b,_0x30bfa8,_0x14e0ee,_0x1740b8,_0xa31900,_0x4746f4,_0x2564e0){var _0x4fe3ef={};var _0x537d5f={'Authorization':_0xf63e('0x36')+_0xa31900[_0xf63e('0x37')]};_0xa31900[_0xf63e('0x38')]=intUtil['stripTrailingSlash'](_0xa31900[_0xf63e('0x38')]);_0xa31900[_0xf63e('0x39')]=intUtil[_0xf63e('0x3a')](_0xa31900['serverUrl']);var _0x42e0c5=_0xa31900[_0xf63e('0x38')];_0x4fe3ef[_0xf63e('0xf')]=_0xa31900['username'];_0x4fe3ef[_0xf63e('0x23')]=_0x2564e0[_0xf63e('0x3b')]()==='outbound'?_0x2eec7b['destcalleridnum']:_0x2eec7b['calleridnum'];_0x4fe3ef[_0xf63e('0x3c')]=_0x2564e0==='queue'||_0x2564e0===_0xf63e('0x3d')?_0xf63e('0x3e'):_0xf63e('0x3f');if(_0x14e0ee){_0x4fe3ef[_0xf63e('0x40')]=_0x14e0ee[_0xf63e('0xe')];}var _0x2b96df=util['format'](_0xf63e('0x41'),_0xa31900['serverUrl'],_0x2eec7b[_0xf63e('0x42')],md5(_0x2eec7b[_0xf63e('0x42')]));if(_0x1740b8&&_0x1740b8[_0xf63e('0x43')]){logger['info'](_0xf63e('0x44'),_0xf63e('0x45'));_0x2eec7b[_0xf63e('0x46')]=_0x2b96df;}else if(_0x4746f4&&_0x4746f4[_0xf63e('0x47')]&&_0x4746f4['recordingFormat']!=='none'){logger[_0xf63e('0x10')](_0xf63e('0x48'),_0xf63e('0x45'));_0x2eec7b['recordingURL']=_0x2b96df;}else{_0x2eec7b[_0xf63e('0x46')]='';}return getAdminId(_0x4fe3ef,_0x2564e0,_0x537d5f,_0x42e0c5)[_0xf63e('0xc')](getUser(_0x2564e0,_0x537d5f,_0x42e0c5))[_0xf63e('0xc')](getEndUser(_0x2564e0,_0x537d5f,_0x42e0c5))['then'](getTicket(_0x2564e0,_0x537d5f,_0x42e0c5,_0x30bfa8,_0x2eec7b))[_0xf63e('0xc')](function(_0x3c9003){logger[_0xf63e('0x10')](util[_0xf63e('0x21')](_0xf63e('0x49'),_0x3c9003[_0xf63e('0x31')]));if(_0x2564e0!==_0xf63e('0x3d')){logger[_0xf63e('0x10')]('['+[_0x2564e0[_0xf63e('0x1e')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x42e0c5,_0x14e0ee[_0xf63e('0x4a')],_0x3c9003[_0xf63e('0x25')]);}})[_0xf63e('0x14')](function(_0x3ac0e3){logger[_0xf63e('0x15')]('['+[_0x2564e0[_0xf63e('0x1e')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xf63e('0x4b')](_0x3ac0e3,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x6130=['outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','GET','headers','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','then','agentEmail','Getting\x20user\x20with\x20email','userId','Admin\x20selected','userEmail','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Creating\x20new\x20task','/api/tasks','getString','Descriptions','add','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase'];(function(_0x47386e,_0x5c1c2d){var _0x103bca=function(_0x11ed22){while(--_0x11ed22){_0x47386e['push'](_0x47386e['shift']());}};_0x103bca(++_0x5c1c2d);}(_0x6130,0x65));var _0x0613=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x6130[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x0613('0x0'));var rp=require(_0x0613('0x1'));var md5=require(_0x0613('0x2'));var util=require('util');var moment=require(_0x0613('0x3'));var Promise=require(_0x0613('0x4'));var Redis=require('ioredis');var intUtil=require(_0x0613('0x5'));var config=require(_0x0613('0x6'));var logger=require(_0x0613('0x7'))(_0x0613('0x8'));config[_0x0613('0x9')]=_['defaults'](config[_0x0613('0x9')],{'host':_0x0613('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0613('0x9')]));function getAdminId(_0x3f7754,_0x1a393b,_0x127483,_0x109bfe){return new Promise(function(_0x6626ab,_0x24eb98){var _0x2997d0=![];var _0x53900e={'method':_0x0613('0xb'),'uri':_0x109bfe+'/api/selector/owners','json':!![]};_0x53900e[_0x0613('0xc')]=_0x127483;logger['info'](_0x0613('0xd'));return rp(_0x53900e)['then'](function(_0x7f3cee){if(_0x7f3cee){var _0x346701=_0x7f3cee[_0x0613('0xe')];var _0x16613d=null;for(_0x16613d=0x0;_0x16613d<_0x346701[_0x0613('0xf')];_0x16613d++){if(_0x346701[_0x16613d][_0x0613('0x10')]===_0x3f7754[_0x0613('0x11')]){_0x3f7754[_0x0613('0x12')]=_0x346701[_0x16613d]['id'];_0x2997d0=!![];}}if(_0x2997d0){logger[_0x0613('0x13')](_0x0613('0x14'),_0x3f7754['adminId']);_0x6626ab(_0x3f7754);}else{_0x24eb98({'statusCode':0x194,'message':_0x0613('0x15')});}}else{_0x24eb98({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x0613('0x16')](function(_0x16cc02){logger[_0x0613('0x17')]('['+[_0x1a393b[_0x0613('0x18')]()]+']',_0x16cc02[_0x0613('0x19')]);_0x24eb98(_0x16cc02);});});}function getUser(_0x44c451,_0xd41754,_0x100f4d){return function(_0x1224c5){return new Promise(function(_0x2ae613,_0x313eca){var _0x20a200={'method':'GET','uri':_0x100f4d+'/api/selector/owners','json':!![]};_0x20a200[_0x0613('0xc')]=_0xd41754;logger[_0x0613('0x13')]('Getting\x20user\x20list');return rp(_0x20a200)[_0x0613('0x1a')](function(_0x534a51){if(_0x534a51){var _0x239c07=_0x534a51['users'];var _0x20dc5c=![];var _0x2e5327=null;if(_0x1224c5[_0x0613('0x1b')]!==null){logger[_0x0613('0x13')](_0x0613('0x1c'),_0x1224c5[_0x0613('0x1b')]);_0x1224c5['userEmail']=_0x1224c5[_0x0613('0x1b')];for(_0x2e5327=0x0;_0x2e5327<_0x239c07[_0x0613('0xf')];_0x2e5327++){if(_0x239c07[_0x2e5327]['email']===_0x1224c5[_0x0613('0x1b')]){_0x20dc5c=!![];_0x1224c5[_0x0613('0x1d')]=_0x239c07[_0x2e5327]['id'];logger[_0x0613('0x13')]('User\x20found:',_0x1224c5[_0x0613('0x1d')]);}}}if(!_0x20dc5c){logger[_0x0613('0x13')](_0x0613('0x1e'));_0x1224c5[_0x0613('0x1f')]=_0x1224c5[_0x0613('0x11')];_0x1224c5[_0x0613('0x1d')]=_0x1224c5[_0x0613('0x12')];_0x20dc5c=!![];}if(_0x20dc5c){_0x2ae613(_0x1224c5);}else{_0x313eca({'statusCode':0x194,'message':_0x0613('0x15')});}}else{_0x313eca({'statusCode':0x194,'message':_0x0613('0x15')});}})[_0x0613('0x16')](function(_0x50bf5f){logger[_0x0613('0x17')]('['+[_0x44c451['toUpperCase']()]+']',_0x50bf5f['message']);_0x313eca(_0x50bf5f);});});};}function searchContact(_0x26af5e,_0x49a988,_0xb5bdfc,_0x1185d9){return new Promise(function(_0x499abf,_0x2fa938){var _0x365190={'method':_0x0613('0xb'),'headers':_0x49a988,'uri':_0x26af5e+'/api/lookup?q='+_0x1185d9+'&f='+_0xb5bdfc+_0x0613('0x20'),'json':!![]};rp(_0x365190)[_0x0613('0x1a')](function(_0x263487){var _0x42eb2b=_[_0x0613('0x21')](_0x263487[_0x0613('0x22')][_0x0613('0x22')],[_0xb5bdfc,_0x1185d9]);_0x499abf(_0x42eb2b);})[_0x0613('0x16')](function(_0x574e1f){_0x2fa938(_0x574e1f);});});}function getEndUser(_0x11cd06,_0x5ef7e4,_0x105338){return function(_0x4d06ab){return new Promise(function(_0x1d349b,_0x43eb49){logger['info'](util[_0x0613('0x23')](_0x0613('0x24'),_0x4d06ab['contactNumber']));searchContact(_0x105338,_0x5ef7e4,_0x0613('0x25'),_0x4d06ab[_0x0613('0x26')])[_0x0613('0x1a')](function(_0x55d443){if(_0x55d443){_0x4d06ab[_0x0613('0x27')]=_0x55d443['id'];logger[_0x0613('0x13')](_0x0613('0x28'),_0x4d06ab[_0x0613('0x27')]);return _0x1d349b(_0x4d06ab);}searchContact(_0x105338,_0x5ef7e4,_0x0613('0x29'),_0x4d06ab[_0x0613('0x26')])['then'](function(_0x536c61){if(_0x536c61){_0x4d06ab[_0x0613('0x27')]=_0x536c61['id'];logger['info'](_0x0613('0x2a'),_0x4d06ab['endUserId']);return _0x1d349b(_0x4d06ab);}createEndUser(_0x4d06ab,_0x11cd06,_0x5ef7e4,_0x105338)[_0x0613('0x1a')](function(_0x5536fd){logger[_0x0613('0x13')](_0x0613('0x2b'),_0x5536fd[_0x0613('0x27')]);return _0x1d349b(_0x5536fd);});});})[_0x0613('0x16')](function(_0x406612){_0x43eb49(_0x406612);});});};}function createEndUser(_0x2a4971,_0x53f7a2,_0x4daa00,_0x5a4294){return new Promise(function(_0x4513c4,_0x56df00){var _0x32c868=moment();var _0x49a21d={'method':_0x0613('0x2c'),'uri':_0x5a4294+_0x0613('0x2d'),'body':{'contact':{'last_name':_0x2a4971['contactNumber'],'work_number':_0x2a4971[_0x0613('0x26')],'mobile_number':_0x2a4971[_0x0613('0x26')],'owner_id':_0x2a4971[_0x0613('0x1d')],'created_at':_0x32c868[_0x0613('0x23')](_0x0613('0x2e'))}},'json':!![]};_0x49a21d[_0x0613('0xc')]=_0x4daa00;logger['info']('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x49a21d)[_0x0613('0x1a')](function(_0x59a988){_0x2a4971[_0x0613('0x27')]=_0x59a988['contact']['id'];_0x4513c4(_0x2a4971);})[_0x0613('0x16')](function(_0x3bb76c){logger[_0x0613('0x17')]('['+[_0x53f7a2[_0x0613('0x18')]()]+']',_0x3bb76c[_0x0613('0x19')]);_0x56df00(_0x3bb76c['message']);});});}function getTicket(_0x4dfa5f,_0x17fb52,_0x1d7d6c,_0x3551ae,_0x36305a){return function(_0x25f6ff){logger[_0x0613('0x13')](_0x0613('0x2f'));return new Promise(function(_0x2ac132,_0x24e533){var _0x339525=moment();var _0xeb0e7b={'method':_0x0613('0x2c'),'uri':_0x1d7d6c+_0x0613('0x30'),'body':{'title':intUtil[_0x0613('0x31')](_0x3551ae['Subjects'],_0x36305a,'\x20'),'description':intUtil[_0x0613('0x31')](_0x3551ae[_0x0613('0x32')],_0x36305a,'\x0a'),'owner_id':_0x25f6ff['userId'],'creater_id':_0x25f6ff[_0x0613('0x12')],'targetable_id':_0x25f6ff[_0x0613('0x27')],'targetable_type':'Contact','created_at':_0x339525[_0x0613('0x23')](_0x0613('0x2e')),'due_date':_0x339525[_0x0613('0x33')](0x1e,'m')[_0x0613('0x23')](_0x0613('0x2e'))},'json':!![]};_0xeb0e7b[_0x0613('0xc')]=_0x17fb52;return rp(_0xeb0e7b)[_0x0613('0x1a')](function(_0x2fb862){_0x25f6ff[_0x0613('0x34')]=_0x2fb862[_0x0613('0x35')]['id'];logger[_0x0613('0x13')](_0x0613('0x36'),_0x25f6ff[_0x0613('0x34')]);_0x2ac132(_0x25f6ff);})[_0x0613('0x16')](function(_0x152868){logger[_0x0613('0x17')]('['+[_0x4dfa5f['toUpperCase']()]+']',_0x152868['message']);_0x24e533(_0x152868[_0x0613('0x19')]);});});};}function emit(_0x23f72d,_0x5e4abe,_0x42b023){var _0x1adab0={'uri':_0x23f72d+'/contacts/'+_0x42b023};io['to'](util[_0x0613('0x23')](_0x0613('0x37'),_0x5e4abe))[_0x0613('0x38')](_0x0613('0x39'),_0x1adab0);}exports['cs']=function(_0xe4129c,_0x2564b1,_0x30d2ad,_0x4d6e19,_0x53a147,_0x25c8ee,_0x162ec3,_0x2f3333){var _0x34ef02={};var _0x15eba5={'Authorization':_0x0613('0x3a')+_0x25c8ee[_0x0613('0x3b')]};_0x25c8ee[_0x0613('0x3c')]=intUtil[_0x0613('0x3d')](_0x25c8ee[_0x0613('0x3c')]);_0x25c8ee[_0x0613('0x3e')]=intUtil[_0x0613('0x3d')](_0x25c8ee[_0x0613('0x3e')]);var _0x259124=_0x25c8ee[_0x0613('0x3c')];_0x34ef02[_0x0613('0x11')]=_0x25c8ee[_0x0613('0x3f')];_0x34ef02[_0x0613('0x26')]=_0x2f3333[_0x0613('0x40')]()===_0x0613('0x41')?_0x2564b1[_0x0613('0x42')]:_0x2564b1[_0x0613('0x43')];_0x34ef02[_0x0613('0x44')]=_0x2f3333===_0x0613('0x45')||_0x2f3333===_0x0613('0x46')?_0x0613('0x45'):_0x0613('0x41');if(_0x4d6e19){_0x34ef02[_0x0613('0x1b')]=_0x4d6e19[_0x0613('0x10')];}var _0x413c66=util[_0x0613('0x23')](_0x0613('0x47'),_0x25c8ee[_0x0613('0x3e')],_0x2564b1[_0x0613('0x48')],md5(_0x2564b1[_0x0613('0x48')]));if(_0x53a147&&_0x53a147[_0x0613('0x49')]){logger[_0x0613('0x13')](_0x0613('0x4a'),_0x0613('0x4b'));_0x2564b1[_0x0613('0x4c')]=_0x413c66;}else if(_0x162ec3&&_0x162ec3[_0x0613('0x4d')]&&_0x162ec3[_0x0613('0x4d')]!==_0x0613('0x4e')){logger['info'](_0x0613('0x4f'),_0x0613('0x4b'));_0x2564b1['recordingURL']=_0x413c66;}else{_0x2564b1[_0x0613('0x4c')]='';}return getAdminId(_0x34ef02,_0x2f3333,_0x15eba5,_0x259124)[_0x0613('0x1a')](getUser(_0x2f3333,_0x15eba5,_0x259124))[_0x0613('0x1a')](getEndUser(_0x2f3333,_0x15eba5,_0x259124))[_0x0613('0x1a')](getTicket(_0x2f3333,_0x15eba5,_0x259124,_0x30d2ad,_0x2564b1))[_0x0613('0x1a')](function(_0x2e45d8){logger[_0x0613('0x13')](util[_0x0613('0x23')](_0x0613('0x50'),_0x2e45d8[_0x0613('0x34')]));if(_0x2f3333!==_0x0613('0x46')){logger[_0x0613('0x13')]('['+[_0x2f3333[_0x0613('0x18')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x259124,_0x4d6e19['name'],_0x2e45d8[_0x0613('0x27')]);}})[_0x0613('0x16')](function(_0x38ebe3){logger[_0x0613('0x17')]('['+[_0x2f3333[_0x0613('0x18')]()]+_0x0613('0x51'),util[_0x0613('0x52')](_0x38ebe3,{'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 710c6e0..6d87fad 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 _0x5408=['exec','includes','data1','toLowerCase','Configurations','data3','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','zendesk','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow'];(function(_0xd5b8d4,_0x40174d){var _0x5dbfb4=function(_0x2651da){while(--_0x2651da){_0xd5b8d4['push'](_0xd5b8d4['shift']());}};_0x5dbfb4(++_0x40174d);}(_0x5408,0x131));var _0x8540=function(_0xe485c4,_0x3d0f36){_0xe485c4=_0xe485c4-0x0;var _0x24cb58=_0x5408[_0xe485c4];return _0x24cb58;};'use strict';var _=require(_0x8540('0x0'));var util=require(_0x8540('0x1'));var zendesk=require(_0x8540('0x2'));var salesforce=require(_0x8540('0x3'));var sugarcrm=require(_0x8540('0x4'));var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require(_0x8540('0x5'));var vtiger=require(_0x8540('0x6'));var servicenow=require(_0x8540('0x7'));var dynamics365=require(_0x8540('0x8'));var freshsales=require(_0x8540('0x9'));var integrations=['zendesk',_0x8540('0xa'),_0x8540('0xb'),_0x8540('0xc'),_0x8540('0xd'),_0x8540('0xe'),_0x8540('0xf'),_0x8540('0x10'),_0x8540('0x11'),_0x8540('0x12')];exports[_0x8540('0x13')]=function(_0x281b65,_0x5914ed,_0x2705f0,_0x106c8f,_0x12379f,_0x50327e){if(_0x2705f0){if(_[_0x8540('0x14')](integrations,_0x281b65[_0x8540('0x15')][_0x8540('0x16')]())){try{var _0xa28fa9=null;var _0x1e24f3='';var _0x33e5ef=_0x2705f0[_0x281b65[_0x8540('0x15')]['toLowerCase']()];if(_0x33e5ef){var _0x386bba=_0x33e5ef[_0x281b65['data2']];if(_0x386bba){var _0x2b8648=_['find'](_0x386bba[_0x8540('0x17')],{'id':parseInt(_0x281b65[_0x8540('0x18')],0xa)});if(_0x2b8648){if(_0x106c8f){if(_0x12379f&&_0x5914ed[_0x8540('0x19')]){_0x1e24f3=_0x8540('0x19');}else if(_0x5914ed['routeId']){_0x1e24f3=_0x8540('0x1a');}else{console[_0x8540('0x1b')](_0x8540('0x1c'),_0x5914ed);}}else{_0x1e24f3=_0x8540('0x1d');}switch(_0x281b65[_0x8540('0x15')]['toLowerCase']()){case _0x8540('0x1e'):zendesk[_0x1e24f3](_0x281b65,_0x5914ed,_0x2b8648,_0x106c8f,_0x12379f,_0x386bba,_0x50327e);break;case _0x8540('0xa'):salesforce[_0x1e24f3](_0x281b65,_0x5914ed,_0x2b8648,_0x106c8f,_0x12379f,_0x386bba,_0x50327e);break;case _0x8540('0xb'):sugarcrm[_0x1e24f3](_0x281b65,_0x5914ed,_0x2b8648,_0x106c8f,_0x12379f,_0x386bba,_0x50327e);break;case'freshdesk':freshdesk[_0x1e24f3](_0x281b65,_0x5914ed,_0x2b8648,_0x106c8f,_0x12379f,_0x386bba,_0x50327e);break;case'zoho':zoho[_0x1e24f3](_0x281b65,_0x5914ed,_0x2b8648,_0x106c8f,_0x12379f,_0x386bba,_0x50327e);break;case _0x8540('0xe'):desk[_0x1e24f3](_0x281b65,_0x5914ed,_0x2b8648,_0x106c8f,_0x12379f,_0x386bba,_0x50327e);break;case _0x8540('0xf'):vtiger[_0x1e24f3](_0x281b65,_0x5914ed,_0x2b8648,_0x106c8f,_0x12379f,_0x386bba,_0x50327e);break;case _0x8540('0x11'):freshsales['cs'](_0x281b65,_0x5914ed,_0x2b8648,_0x106c8f,_0x12379f,_0x386bba,_0x50327e,_0x1e24f3);break;case _0x8540('0x12'):servicenow['cs'](_0x281b65,_0x5914ed,_0x2b8648,_0x106c8f,_0x12379f,_0x386bba,_0x50327e,_0x1e24f3);break;case _0x8540('0x10'):dynamics365['cs'](_0x281b65,_0x5914ed,_0x2b8648,_0x106c8f,_0x12379f,_0x386bba,_0x50327e,_0x1e24f3);break;default:console[_0x8540('0x1b')]('unknown\x20integration');}}else{_0xa28fa9=require(_0x8540('0x1f'))(_0x281b65[_0x8540('0x15')][_0x8540('0x16')]());_0xa28fa9[_0x8540('0x20')]('[EXEC]',util[_0x8540('0x21')](_0x8540('0x22'),_0x281b65[_0x8540('0x15')][_0x8540('0x16')](),_0x281b65[_0x8540('0x18')]));}}else{_0xa28fa9=require('../../../../config/logger')(_0x281b65[_0x8540('0x15')][_0x8540('0x16')]());_0xa28fa9[_0x8540('0x20')]('[EXEC]',util['format'](_0x8540('0x23'),_0x281b65[_0x8540('0x15')][_0x8540('0x16')](),_0x281b65['data2']));}}else{}}catch(_0x4937e0){console[_0x8540('0x20')](_0x4937e0);}}}}; \ No newline at end of file +var _0x02b4=['routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshdesk','servicenow','unknown\x20integration','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','util','./zendesk','./salesforce','./zoho','./desk','./vtiger','./dynamics365','zendesk','salesforce','sugarcrm','zoho','desk','vtiger','dynamics365','freshsales','exec','includes','toLowerCase','data1','data2','find','Configurations','data3','queue'];(function(_0x19b614,_0x4a2eb3){var _0x1ae762=function(_0x4c0843){while(--_0x4c0843){_0x19b614['push'](_0x19b614['shift']());}};_0x1ae762(++_0x4a2eb3);}(_0x02b4,0x110));var _0x402b=function(_0xe2f66a,_0x47c439){_0xe2f66a=_0xe2f66a-0x0;var _0x1bba52=_0x02b4[_0xe2f66a];return _0x1bba52;};'use strict';var _=require('lodash');var util=require(_0x402b('0x0'));var zendesk=require(_0x402b('0x1'));var salesforce=require(_0x402b('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0x402b('0x3'));var desk=require(_0x402b('0x4'));var vtiger=require(_0x402b('0x5'));var servicenow=require('./servicenow');var dynamics365=require(_0x402b('0x6'));var freshsales=require('./freshsales');var integrations=[_0x402b('0x7'),_0x402b('0x8'),_0x402b('0x9'),'freshdesk',_0x402b('0xa'),_0x402b('0xb'),_0x402b('0xc'),_0x402b('0xd'),_0x402b('0xe'),'servicenow'];exports[_0x402b('0xf')]=function(_0x205091,_0x40041f,_0x589144,_0x2c7a7a,_0x518d76,_0x2c046e){if(_0x589144){if(_[_0x402b('0x10')](integrations,_0x205091['data1'][_0x402b('0x11')]())){try{var _0x1a286c=null;var _0x2e698b='';var _0x118ab6=_0x589144[_0x205091[_0x402b('0x12')][_0x402b('0x11')]()];if(_0x118ab6){var _0x6f7267=_0x118ab6[_0x205091[_0x402b('0x13')]];if(_0x6f7267){var _0x33c16e=_[_0x402b('0x14')](_0x6f7267[_0x402b('0x15')],{'id':parseInt(_0x205091[_0x402b('0x16')],0xa)});if(_0x33c16e){if(_0x2c7a7a){if(_0x518d76&&_0x40041f['queue']){_0x2e698b=_0x402b('0x17');}else if(_0x40041f[_0x402b('0x18')]){_0x2e698b=_0x402b('0x19');}else{console[_0x402b('0x1a')](_0x402b('0x1b'),_0x40041f);}}else{_0x2e698b=_0x402b('0x1c');}switch(_0x205091['data1'][_0x402b('0x11')]()){case'zendesk':zendesk[_0x2e698b](_0x205091,_0x40041f,_0x33c16e,_0x2c7a7a,_0x518d76,_0x6f7267,_0x2c046e);break;case _0x402b('0x8'):salesforce[_0x2e698b](_0x205091,_0x40041f,_0x33c16e,_0x2c7a7a,_0x518d76,_0x6f7267,_0x2c046e);break;case'sugarcrm':sugarcrm[_0x2e698b](_0x205091,_0x40041f,_0x33c16e,_0x2c7a7a,_0x518d76,_0x6f7267,_0x2c046e);break;case _0x402b('0x1d'):freshdesk[_0x2e698b](_0x205091,_0x40041f,_0x33c16e,_0x2c7a7a,_0x518d76,_0x6f7267,_0x2c046e);break;case _0x402b('0xa'):zoho[_0x2e698b](_0x205091,_0x40041f,_0x33c16e,_0x2c7a7a,_0x518d76,_0x6f7267,_0x2c046e);break;case _0x402b('0xb'):desk[_0x2e698b](_0x205091,_0x40041f,_0x33c16e,_0x2c7a7a,_0x518d76,_0x6f7267,_0x2c046e);break;case _0x402b('0xc'):vtiger[_0x2e698b](_0x205091,_0x40041f,_0x33c16e,_0x2c7a7a,_0x518d76,_0x6f7267,_0x2c046e);break;case _0x402b('0xe'):freshsales['cs'](_0x205091,_0x40041f,_0x33c16e,_0x2c7a7a,_0x518d76,_0x6f7267,_0x2c046e,_0x2e698b);break;case _0x402b('0x1e'):servicenow['cs'](_0x205091,_0x40041f,_0x33c16e,_0x2c7a7a,_0x518d76,_0x6f7267,_0x2c046e,_0x2e698b);break;case _0x402b('0xd'):dynamics365['cs'](_0x205091,_0x40041f,_0x33c16e,_0x2c7a7a,_0x518d76,_0x6f7267,_0x2c046e,_0x2e698b);break;default:console[_0x402b('0x1a')](_0x402b('0x1f'));}}else{_0x1a286c=require('../../../../config/logger')(_0x205091['data1']['toLowerCase']());_0x1a286c[_0x402b('0x20')](_0x402b('0x21'),util[_0x402b('0x22')](_0x402b('0x23'),_0x205091[_0x402b('0x12')][_0x402b('0x11')](),_0x205091[_0x402b('0x16')]));}}else{_0x1a286c=require(_0x402b('0x24'))(_0x205091[_0x402b('0x12')][_0x402b('0x11')]());_0x1a286c[_0x402b('0x20')](_0x402b('0x21'),util['format']('%s\x20account\x20#%s\x20not\x20found',_0x205091['data1']['toLowerCase'](),_0x205091[_0x402b('0x13')]));}}else{}}catch(_0x7d4539){console['error'](_0x7d4539);}}}}; \ 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 77c369e..5c74b43 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 _0x8cc5=['util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','Subjects','getString','Descriptions','ticketType','utc','IsReminderSet','IsRecurrence','endUserType','WhoId','WhatId','Case','contact','ContactId','account','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','then','length','resolve','Name','identity','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','merge','Lead','account_contact_lead','additionalSearchAccount','Account','additionalSearchLead','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','upperFirst','forEach','includes','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','trigger:salesforce:display','instanceUrl','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','Fields',']\x20Ticket\x20%s\x20created.','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x8cc5,0x109));var _0x58cc=function(_0x4dfc9b,_0x17d7d5){_0x4dfc9b=_0x4dfc9b-0x0;var _0x3ee3bf=_0x8cc5[_0x4dfc9b];return _0x3ee3bf;};'use strict';var _=require(_0x58cc('0x0'));var rp=require(_0x58cc('0x1'));var moment=require(_0x58cc('0x2'));var BPromise=require(_0x58cc('0x3'));var md5=require('md5');var jsforce=require(_0x58cc('0x4'));var util=require(_0x58cc('0x5'));var Redis=require(_0x58cc('0x6'));var intUtil=require(_0x58cc('0x7'));var config=require(_0x58cc('0x8'));var logger=require(_0x58cc('0x9'))(_0x58cc('0xa'));config[_0x58cc('0xb')]=_[_0x58cc('0xc')](config[_0x58cc('0xb')],{'host':_0x58cc('0xd'),'port':0x18eb});var io=require(_0x58cc('0xe'))(new Redis(config[_0x58cc('0xb')]));function emit(_0x1ff918,_0x7a3504,_0x1f2637){io['to'](_0x1ff918)[_0x58cc('0xf')](_0x7a3504,_0x1f2637);}function getTicket(_0xb06d1d,_0x51858a,_0x1235d7,_0x35036b,_0x13cd8c,_0x438a3c,_0xad2af8,_0x34d055){var _0x2f6be5=Object[_0x58cc('0x10')]({},{'OwnerId':_0x51858a['id'],'Subject':intUtil['getString'](_0x35036b[_0x58cc('0x11')],_0x13cd8c,'\x20'),'Description':intUtil[_0x58cc('0x12')](_0x35036b[_0x58cc('0x13')],_0x13cd8c,'\x0a')},getCustomFields(_0x438a3c,_0x13cd8c));if(_0x1235d7){if(_0x35036b[_0x58cc('0x14')]==='Task'){_0x2f6be5['ActivityDate']=moment[_0x58cc('0x15')]();_0x2f6be5[_0x58cc('0x16')]=![];_0x2f6be5[_0x58cc('0x17')]=![];if(_0x1235d7[_0x58cc('0x18')]==='contact'||_0x1235d7['endUserType']==='lead'){_0x2f6be5[_0x58cc('0x19')]=_0x1235d7['id'];}else if(_0x1235d7[_0x58cc('0x18')]==='account'){_0x2f6be5[_0x58cc('0x1a')]=_0x1235d7['id'];}}else if(_0x35036b[_0x58cc('0x14')]===_0x58cc('0x1b')){if(_0x1235d7[_0x58cc('0x18')]===_0x58cc('0x1c')){_0x2f6be5[_0x58cc('0x1d')]=_0x1235d7['id'];}else if(_0x1235d7['endUserType']===_0x58cc('0x1e')){_0x2f6be5['AccountId']=_0x1235d7['id'];}else if(_0x1235d7[_0x58cc('0x18')]===_0x58cc('0x1f')&&_0x35036b[_0x58cc('0x20')]){_0x2f6be5[_0x35036b['leadId']]=_0x1235d7['id'];}else{logger[_0x58cc('0x21')](_0x58cc('0x22'));}}}return _0xad2af8[_0x58cc('0x23')](_0x35036b['ticketType'])[_0x58cc('0x24')](_0x2f6be5);}function getUser(_0xace385,_0x1ee5ca,_0x41f35d){if(!_[_0x58cc('0x25')](_0x1ee5ca)&&intUtil[_0x58cc('0x26')](_0x1ee5ca)){var _0x50009e={'Email':_0x1ee5ca};var _0x3e9711={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x41f35d[_0x58cc('0x23')](_0x58cc('0x27'))[_0x58cc('0x28')](_0x50009e,_0x3e9711)[_0x58cc('0x29')]()[_0x58cc('0x2a')](function(_0x57c9b5){if(_0x57c9b5[_0x58cc('0x2b')]){var _0x1e8c2a=_['find'](_0x57c9b5,function(_0x356b91){return _0x356b91['Email']===_0x1ee5ca;});if(_0x1e8c2a){logger[_0x58cc('0x21')]('Agent\x20%s\x20found.',_0x1ee5ca);return BPromise[_0x58cc('0x2c')]({'id':_0x1e8c2a['Id'],'name':_0x1e8c2a[_0x58cc('0x2d')]});}}else{logger[_0x58cc('0x21')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x1ee5ca);return _0x41f35d[_0x58cc('0x2e')]()[_0x58cc('0x2a')](function(_0x9be671){return BPromise[_0x58cc('0x2c')]({'id':_0x9be671['user_id'],'name':_0x9be671['display_name']});});}});}else{logger[_0x58cc('0x21')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x1ee5ca);return _0x41f35d[_0x58cc('0x2e')]()[_0x58cc('0x2a')](function(_0x357479){return BPromise[_0x58cc('0x2c')]({'id':_0x357479[_0x58cc('0x2f')],'name':_0x357479['display_name']});});}}function getEndUser(_0x5a0f55,_0x2d2c48,_0x57b592,_0x1bcfa6,_0x1bde01){var _0x2bb9b8={'$or':{'Phone':_0x1bcfa6}};var _0x436dce={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x58cc('0x2c')]()[_0x58cc('0x2a')](function(){logger[_0x58cc('0x21')](_0x58cc('0x30'),_0x1bcfa6,_0x2d2c48['moduleSearch']);switch(_0x2d2c48['moduleSearch']){case _0x58cc('0x31'):var _0x51d37c=_[_0x58cc('0x32')](_0x2bb9b8);if(_0x2d2c48[_0x58cc('0x33')]){var _0x4ad708={};_0x4ad708[_0x2d2c48[_0x58cc('0x33')]]=_0x1bcfa6;_['merge'](_0x51d37c[_0x58cc('0x34')],_0x4ad708);}return _0x1bde01[_0x58cc('0x23')](_0x58cc('0x35'))['find'](_0x51d37c,_0x436dce)[_0x58cc('0x29')]()['then'](function(_0x59894c){if(_0x59894c&&_0x59894c[_0x58cc('0x2b')]){return _0x59894c;}else{var _0x3583f1=_[_0x58cc('0x32')](_0x2bb9b8);if(_0x2d2c48['additionalSearchLead']){var _0x2aec91={};_0x2aec91[_0x2d2c48['additionalSearchLead']]=_0x1bcfa6;_[_0x58cc('0x36')](_0x3583f1['$or'],_0x2aec91);}return _0x1bde01['sobject'](_0x58cc('0x37'))['find'](_0x3583f1,_0x436dce);}});case _0x58cc('0x38'):var _0x10a557=_[_0x58cc('0x32')](_0x2bb9b8);if(_0x2d2c48[_0x58cc('0x39')]){var _0x4ad708={};_0x4ad708[_0x2d2c48[_0x58cc('0x39')]]=_0x1bcfa6;_[_0x58cc('0x36')](_0x10a557[_0x58cc('0x34')],_0x4ad708);}return _0x1bde01[_0x58cc('0x23')](_0x58cc('0x3a'))[_0x58cc('0x28')](_0x10a557,_0x436dce)[_0x58cc('0x29')]()[_0x58cc('0x2a')](function(_0x32c8b2){if(_0x32c8b2&&_0x32c8b2[_0x58cc('0x2b')]){return _0x32c8b2;}else{var _0x280bc3=_['cloneDeep'](_0x2bb9b8);if(_0x2d2c48[_0x58cc('0x33')]){var _0x266a7f={};_0x266a7f[_0x2d2c48[_0x58cc('0x33')]]=_0x1bcfa6;_[_0x58cc('0x36')](_0x280bc3['$or'],_0x266a7f);}return _0x1bde01[_0x58cc('0x23')](_0x58cc('0x35'))[_0x58cc('0x28')](_0x280bc3,_0x436dce)[_0x58cc('0x2a')](function(_0x524b9b){if(_0x524b9b&&_0x524b9b['length']){return _0x524b9b;}else{var _0x1be2d0=_[_0x58cc('0x32')](_0x2bb9b8);if(_0x2d2c48[_0x58cc('0x3b')]){var _0x53b2c3={};_0x53b2c3[_0x2d2c48[_0x58cc('0x3b')]]=_0x1bcfa6;_['merge'](_0x1be2d0[_0x58cc('0x34')],_0x53b2c3);}return _0x1bde01[_0x58cc('0x23')](_0x58cc('0x37'))[_0x58cc('0x28')](_0x1be2d0,_0x436dce);}});}});case'contact':var _0x51d37c=_[_0x58cc('0x32')](_0x2bb9b8);if(_0x2d2c48[_0x58cc('0x33')]){var _0x4ad708={};_0x4ad708[_0x2d2c48[_0x58cc('0x33')]]=_0x1bcfa6;_[_0x58cc('0x36')](_0x51d37c[_0x58cc('0x34')],_0x4ad708);}return _0x1bde01[_0x58cc('0x23')](_0x58cc('0x35'))[_0x58cc('0x28')](_0x51d37c,_0x436dce)[_0x58cc('0x29')]();case _0x58cc('0x1f'):var _0xb7cb9d=_[_0x58cc('0x32')](_0x2bb9b8);if(_0x2d2c48['additionalSearchLead']){var _0x4ad708={};_0x4ad708[_0x2d2c48['additionalSearchLead']]=_0x1bcfa6;_[_0x58cc('0x36')](_0xb7cb9d[_0x58cc('0x34')],_0x4ad708);}return _0x1bde01[_0x58cc('0x23')]('Lead')['find'](_0xb7cb9d,_0x436dce);case _0x58cc('0x1e'):var _0x10a557=_[_0x58cc('0x32')](_0x2bb9b8);if(_0x2d2c48[_0x58cc('0x39')]){var _0x4ad708={};_0x4ad708[_0x2d2c48[_0x58cc('0x39')]]=_0x1bcfa6;_[_0x58cc('0x36')](_0x10a557[_0x58cc('0x34')],_0x4ad708);}return _0x1bde01[_0x58cc('0x23')]('Account')[_0x58cc('0x28')](_0x10a557,_0x436dce);default:return null;}})[_0x58cc('0x2a')](function(_0x4faa10){if(_0x4faa10&&_0x4faa10['length']){var _0x46664a=_[_0x58cc('0x3c')](_0x4faa10);if(_0x46664a){return BPromise['resolve']({'id':_0x46664a['Id'],'name':_0x46664a['Name'],'phone':_0x46664a[_0x58cc('0x3d')],'endUserType':_0x46664a[_0x58cc('0x3e')][_0x58cc('0x3f')][_0x58cc('0x40')]()});}}})['then'](function(_0x542f64){if(_0x542f64){logger[_0x58cc('0x21')](_0x58cc('0x41'),_0x542f64[_0x58cc('0x18')],_0x1bcfa6);return BPromise[_0x58cc('0x2c')](_0x542f64);}else{logger['info'](_0x58cc('0x42'),_0x1bcfa6);var _0x38e38d={'Phone':_0x1bcfa6};if(_0x2d2c48[_0x58cc('0x43')]){if(_0x2d2c48['moduleCreate']===_0x58cc('0x1c')){logger[_0x58cc('0x21')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x1bcfa6,_0x2d2c48[_0x58cc('0x43')]);_0x38e38d[_0x58cc('0x44')]=_0x57b592!==_0x58cc('0x45')?_0x57b592:util[_0x58cc('0x46')](_0x58cc('0x47'),_0x1bcfa6);}else if(_0x2d2c48[_0x58cc('0x43')]===_0x58cc('0x1f')){logger[_0x58cc('0x21')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x1bcfa6,_0x2d2c48[_0x58cc('0x43')]);_0x38e38d[_0x58cc('0x44')]=_0x57b592!==''?_0x57b592:util[_0x58cc('0x46')](_0x58cc('0x47'),_0x1bcfa6);_0x38e38d[_0x58cc('0x48')]=_0x58cc('0x49');}else if(_0x2d2c48[_0x58cc('0x43')]===_0x58cc('0x1e')){logger[_0x58cc('0x21')](_0x58cc('0x4a'),_0x1bcfa6,_0x2d2c48[_0x58cc('0x43')]);_0x38e38d[_0x58cc('0x2d')]=_0x57b592!==''?_0x57b592:util['format'](_0x58cc('0x47'),_0x1bcfa6);}else{return null;}}return _0x1bde01[_0x58cc('0x23')](_[_0x58cc('0x4b')](_0x2d2c48[_0x58cc('0x43')]))[_0x58cc('0x24')](_0x38e38d)[_0x58cc('0x2a')](function(_0x48ad81){return BPromise['resolve']({'id':_0x48ad81['id'],'endUserType':_0x2d2c48['moduleCreate']});});}});}function getCustomFields(_0x3d843d,_0x23122a){var _0x46d3a6={};if(_0x3d843d[_0x58cc('0x2b')]>0x0){_[_0x58cc('0x4c')](_0x3d843d,function(_0x3b6c71){if(_[_0x58cc('0x4d')](['string',_0x58cc('0x4e')],_0x3b6c71['type'])&&_0x3b6c71[_0x58cc('0x4f')]){_0x46d3a6[_0x3b6c71[_0x58cc('0x4f')]]=_0x3b6c71[_0x58cc('0x50')][_0x58cc('0x51')]();}else if(_0x3b6c71[_0x58cc('0x3f')]===_0x58cc('0x52')&&_0x3b6c71['variableName']&&_0x3b6c71['idField']){_0x23122a[_0x3b6c71[_0x58cc('0x53')]]&&(_0x46d3a6[_0x3b6c71[_0x58cc('0x4f')]]=_0x23122a[_0x3b6c71[_0x58cc('0x53')]][_0x58cc('0x51')]());}else if(_0x3b6c71[_0x58cc('0x3f')]===_0x58cc('0x54')&&_0x3b6c71[_0x58cc('0x55')]&&_0x3b6c71[_0x58cc('0x55')][_0x58cc('0x56')]&&_0x3b6c71[_0x58cc('0x4f')]){_0x23122a[_0x3b6c71[_0x58cc('0x55')][_0x58cc('0x56')]['toLowerCase']()]&&(_0x46d3a6[_0x3b6c71[_0x58cc('0x4f')]]=_0x23122a[_0x3b6c71['Variable'][_0x58cc('0x56')]['toLowerCase']()][_0x58cc('0x51')]());}});}return _0x46d3a6;}function getConnection(_0x812b4f){var _0x47e099=_0x812b4f[_0x58cc('0x57')][_0x58cc('0x58')](_0x812b4f[_0x58cc('0x59')]);var _0xe799c5=new jsforce[(_0x58cc('0x5a'))]({'oauth2':{'loginUrl':_0x812b4f[_0x58cc('0x5b')]||_0x58cc('0x5c'),'clientId':_0x812b4f[_0x58cc('0x5d')],'clientSecret':_0x812b4f[_0x58cc('0x5e')]}});return _0xe799c5[_0x58cc('0x5f')](_0x812b4f[_0x58cc('0x60')],_0x47e099)['then'](function(){logger[_0x58cc('0x21')](_0x58cc('0x61'));return _0xe799c5;});}exports['queue']=function(_0x5edcb9,_0x3f15c1,_0x15ac4c,_0x53d47c,_0x511032,_0xc3963c){var _0xe635b4,_0x29d108,_0x156974,_0x5e8759;_0xc3963c[_0x58cc('0x62')]=intUtil[_0x58cc('0x63')](_0xc3963c[_0x58cc('0x62')]);_0xc3963c[_0x58cc('0x5b')]=intUtil[_0x58cc('0x63')](_0xc3963c[_0x58cc('0x5b')]);if(_0x511032&&_0x511032[_0x58cc('0x64')]){logger[_0x58cc('0x21')](_0x58cc('0x65'),_0x58cc('0x66'));_0x3f15c1[_0x58cc('0x67')]=util[_0x58cc('0x46')](_0x58cc('0x68'),_0xc3963c[_0x58cc('0x62')],_0x3f15c1['uniqueid'],md5(_0x3f15c1[_0x58cc('0x69')]));}else{_0x3f15c1[_0x58cc('0x67')]='';}return getConnection(_0xc3963c)[_0x58cc('0x2a')](function(_0x54c4a1){_0x5e8759=_0x54c4a1;return getUser(_0xc3963c,_0x53d47c[_0x58cc('0x6a')],_0x5e8759);})['then'](function(_0x274142){_0xe635b4=_0x274142;return getEndUser(_0xc3963c,_0x15ac4c,_0x3f15c1[_0x58cc('0x6b')],_0x3f15c1[_0x58cc('0x6c')],_0x5e8759);})[_0x58cc('0x2a')](function(_0x2a6949){_0x29d108=_0x2a6949;return getTicket(_0xc3963c,_0xe635b4,_0x29d108,_0x15ac4c,_0x3f15c1,_0x15ac4c['Fields'],_0x5e8759,'queue');})['then'](function(_0x471a0b){_0x156974=_0x471a0b;logger['info'](_0x58cc('0x6d'),_0x156974['id']);logger['info'](_0x58cc('0x6e'),_0x156974['id'],_0x53d47c[_0x58cc('0x56')],_0xc3963c[_0x58cc('0x3f')]);switch(_0xc3963c['type']){case _0x58cc('0x6f'):emit(util[_0x58cc('0x46')](_0x58cc('0x70'),_0x53d47c[_0x58cc('0x56')]),'trigger:salesforce:display',{'recordId':_0x156974['id']});break;case _0x58cc('0x71'):emit(util[_0x58cc('0x46')](_0x58cc('0x70'),_0x53d47c['name']),_0x58cc('0x72'),{'uri':util[_0x58cc('0x46')](_0x58cc('0x73'),_0x5e8759['instanceUrl'],_0x156974['id'])});break;default:logger[_0x58cc('0x74')](_0x58cc('0x75'));}})[_0x58cc('0x76')](function(_0x330e0c){logger[_0x58cc('0x74')](_0x58cc('0x65'),_0x330e0c);});};exports[_0x58cc('0x77')]=function(_0x5cec03,_0x2aafcf,_0x20f301,_0x41b0fc,_0x2d63b5,_0x2b54a7,_0x469be3){var _0x1cbd32,_0x4b8b35,_0x5b09e7,_0x6c4be7;_0x2b54a7[_0x58cc('0x62')]=intUtil[_0x58cc('0x63')](_0x2b54a7[_0x58cc('0x62')]);_0x2b54a7['remoteUri']=intUtil[_0x58cc('0x63')](_0x2b54a7['remoteUri']);if(_0x469be3&&_0x469be3[_0x58cc('0x78')]&&_0x469be3[_0x58cc('0x78')]!==_0x58cc('0x79')){logger['info']('[OUTBOUND]',_0x58cc('0x66'));_0x2aafcf[_0x58cc('0x67')]=util[_0x58cc('0x46')](_0x58cc('0x68'),_0x2b54a7[_0x58cc('0x62')],_0x2aafcf[_0x58cc('0x69')],md5(_0x2aafcf[_0x58cc('0x69')]));}return getConnection(_0x2b54a7)['then'](function(_0x276d85){_0x6c4be7=_0x276d85;return getUser(_0x2b54a7,_0x41b0fc[_0x58cc('0x6a')],_0x6c4be7);})[_0x58cc('0x2a')](function(_0x4869bd){_0x1cbd32=_0x4869bd;return getEndUser(_0x2b54a7,_0x20f301,_0x2aafcf[_0x58cc('0x7a')],_0x2aafcf[_0x58cc('0x7b')],_0x6c4be7);})['then'](function(_0x1302a6){_0x4b8b35=_0x1302a6;return getTicket(_0x2b54a7,_0x1cbd32,_0x4b8b35,_0x20f301,_0x2aafcf,_0x20f301['Fields'],_0x6c4be7,_0x58cc('0x77'));})[_0x58cc('0x2a')](function(_0x107be6){_0x5b09e7=_0x107be6;logger[_0x58cc('0x21')](_0x58cc('0x7c'),_0x5b09e7['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x5b09e7['id'],_0x41b0fc[_0x58cc('0x56')],_0x2b54a7['type']);switch(_0x2b54a7[_0x58cc('0x3f')]){case _0x58cc('0x6f'):emit(util['format'](_0x58cc('0x70'),_0x41b0fc[_0x58cc('0x56')]),_0x58cc('0x7d'),{'recordId':_0x5b09e7['id']});break;case'newTab':emit(util[_0x58cc('0x46')]('user:%s',_0x41b0fc['name']),_0x58cc('0x72'),{'uri':util[_0x58cc('0x46')](_0x58cc('0x73'),_0x6c4be7[_0x58cc('0x7e')],_0x5b09e7['id'])});break;default:logger['error'](_0x58cc('0x7f'),_0x58cc('0x80'));}})['catch'](function(_0x59b231){logger[_0x58cc('0x74')](_0x58cc('0x7f'),_0x59b231);});};exports[_0x58cc('0x81')]=function(_0x39c65c,_0xba9759,_0x5f14bb,_0x3361a6,_0x3b2934,_0x574530){var _0xb9d9a1,_0x1a547c,_0x3be20e,_0x84a5a6;_0x574530[_0x58cc('0x62')]=intUtil[_0x58cc('0x63')](_0x574530[_0x58cc('0x62')]);_0x574530[_0x58cc('0x5b')]=intUtil[_0x58cc('0x63')](_0x574530[_0x58cc('0x5b')]);if(_0x3b2934&&_0x3b2934['monitor_format']){logger[_0x58cc('0x21')]('['+_0xba9759[_0x58cc('0x82')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0xba9759['recordingURL']=util[_0x58cc('0x46')](_0x58cc('0x68'),_0x574530['serverUrl'],_0xba9759[_0x58cc('0x69')],md5(_0xba9759[_0x58cc('0x69')]));}else{_0xba9759[_0x58cc('0x67')]='';}return getConnection(_0x574530)[_0x58cc('0x2a')](function(_0x1c8822){_0x84a5a6=_0x1c8822;if(!_[_0x58cc('0x25')](_0x3361a6)){return getUser(_0x574530,_0x3361a6['name'],_0x84a5a6);}else{return getUser(_0x574530,null,_0x84a5a6);}})[_0x58cc('0x2a')](function(_0x25c527){_0xb9d9a1=_0x25c527;return getEndUser(_0x574530,_0x5f14bb,_0xba9759[_0x58cc('0x6b')],_0xba9759['calleridnum'],_0x84a5a6);})[_0x58cc('0x2a')](function(_0x1a3203){_0x1a547c=_0x1a3203;return getTicket(_0x574530,_0xb9d9a1,_0x1a547c,_0x5f14bb,_0xba9759,_0x5f14bb[_0x58cc('0x83')],_0x84a5a6);})[_0x58cc('0x2a')](function(_0x145325){_0x3be20e=_0x145325;logger['info']('['+_0xba9759['lastevent']['toUpperCase']()+_0x58cc('0x84'),_0x3be20e['id']);logger[_0x58cc('0x21')]('['+_0xba9759[_0x58cc('0x82')][_0x58cc('0x85')]()+_0x58cc('0x86'),_0x574530[_0x58cc('0x3f')]);})[_0x58cc('0x76')](function(_0x764ada){logger[_0x58cc('0x74')]('['+_0xba9759[_0x58cc('0x82')][_0x58cc('0x85')]()+']',_0x764ada);});}; \ No newline at end of file +var _0x093d=['Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','Caller\x20-\x20%s','format','Company','includes','string','idField','content','variable','variableName','toString','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','jsforce','util','ioredis','./util','../../../../config/logger','salesforce','redis','defaults','localhost','assign','getString','Descriptions','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','ticketType','contact','ContactId','account','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','length','Email','Agent\x20%s\x20found.','resolve','Name','identity','then','user_id','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase'];(function(_0x4b91c4,_0x23f35f){var _0x25cb80=function(_0x48e283){while(--_0x48e283){_0x4b91c4['push'](_0x4b91c4['shift']());}};_0x25cb80(++_0x23f35f);}(_0x093d,0x1b0));var _0xd093=function(_0x127074,_0x3bd855){_0x127074=_0x127074-0x0;var _0x4c9463=_0x093d[_0x127074];return _0x4c9463;};'use strict';var _=require(_0xd093('0x0'));var rp=require(_0xd093('0x1'));var moment=require(_0xd093('0x2'));var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0xd093('0x3'));var util=require(_0xd093('0x4'));var Redis=require(_0xd093('0x5'));var intUtil=require(_0xd093('0x6'));var config=require('../../../../config/environment');var logger=require(_0xd093('0x7'))(_0xd093('0x8'));config[_0xd093('0x9')]=_[_0xd093('0xa')](config[_0xd093('0x9')],{'host':_0xd093('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd093('0x9')]));function emit(_0x32d2a9,_0x4f4dea,_0x5898f2){io['to'](_0x32d2a9)['emit'](_0x4f4dea,_0x5898f2);}function getTicket(_0x376c3c,_0x5a62ff,_0x4124de,_0x45523d,_0x13e905,_0x4bb43b,_0x30f883,_0x2b6459){var _0x4b31c1=Object[_0xd093('0xc')]({},{'OwnerId':_0x5a62ff['id'],'Subject':intUtil[_0xd093('0xd')](_0x45523d['Subjects'],_0x13e905,'\x20'),'Description':intUtil[_0xd093('0xd')](_0x45523d[_0xd093('0xe')],_0x13e905,'\x0a')},getCustomFields(_0x4bb43b,_0x13e905));if(_0x4124de){if(_0x45523d['ticketType']==='Task'){_0x4b31c1[_0xd093('0xf')]=moment[_0xd093('0x10')]();_0x4b31c1[_0xd093('0x11')]=![];_0x4b31c1[_0xd093('0x12')]=![];if(_0x4124de[_0xd093('0x13')]==='contact'||_0x4124de[_0xd093('0x13')]===_0xd093('0x14')){_0x4b31c1[_0xd093('0x15')]=_0x4124de['id'];}else if(_0x4124de[_0xd093('0x13')]==='account'){_0x4b31c1['WhatId']=_0x4124de['id'];}}else if(_0x45523d[_0xd093('0x16')]==='Case'){if(_0x4124de[_0xd093('0x13')]===_0xd093('0x17')){_0x4b31c1[_0xd093('0x18')]=_0x4124de['id'];}else if(_0x4124de[_0xd093('0x13')]===_0xd093('0x19')){_0x4b31c1['AccountId']=_0x4124de['id'];}else if(_0x4124de[_0xd093('0x13')]==='lead'&&_0x45523d[_0xd093('0x1a')]){_0x4b31c1[_0x45523d[_0xd093('0x1a')]]=_0x4124de['id'];}else{logger[_0xd093('0x1b')](_0xd093('0x1c'));}}}return _0x30f883[_0xd093('0x1d')](_0x45523d[_0xd093('0x16')])[_0xd093('0x1e')](_0x4b31c1);}function getUser(_0x1d8ad6,_0x3f2f06,_0xab206a){if(!_[_0xd093('0x1f')](_0x3f2f06)&&intUtil[_0xd093('0x20')](_0x3f2f06)){var _0x14fb91={'Email':_0x3f2f06};var _0x539c69={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xab206a[_0xd093('0x1d')](_0xd093('0x21'))[_0xd093('0x22')](_0x14fb91,_0x539c69)[_0xd093('0x23')]()['then'](function(_0x1e1fc1){if(_0x1e1fc1[_0xd093('0x24')]){var _0x345c12=_[_0xd093('0x22')](_0x1e1fc1,function(_0x5a376f){return _0x5a376f[_0xd093('0x25')]===_0x3f2f06;});if(_0x345c12){logger[_0xd093('0x1b')](_0xd093('0x26'),_0x3f2f06);return BPromise[_0xd093('0x27')]({'id':_0x345c12['Id'],'name':_0x345c12[_0xd093('0x28')]});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x3f2f06);return _0xab206a[_0xd093('0x29')]()[_0xd093('0x2a')](function(_0x3406fd){return BPromise['resolve']({'id':_0x3406fd[_0xd093('0x2b')],'name':_0x3406fd['display_name']});});}});}else{logger['info'](_0xd093('0x2c'),_0x3f2f06);return _0xab206a['identity']()['then'](function(_0x5526f4){return BPromise[_0xd093('0x27')]({'id':_0x5526f4[_0xd093('0x2b')],'name':_0x5526f4[_0xd093('0x2d')]});});}}function getEndUser(_0x1a3082,_0x1007e9,_0x5c6b05,_0x37dbc4,_0x4eddd0){var _0x2ed9d8={'$or':{'Phone':_0x37dbc4}};var _0x3f5ef0={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xd093('0x27')]()[_0xd093('0x2a')](function(){logger[_0xd093('0x1b')](_0xd093('0x2e'),_0x37dbc4,_0x1007e9[_0xd093('0x2f')]);switch(_0x1007e9['moduleSearch']){case _0xd093('0x30'):var _0x4b9b42=_[_0xd093('0x31')](_0x2ed9d8);if(_0x1007e9[_0xd093('0x32')]){var _0x11bd8e={};_0x11bd8e[_0x1007e9[_0xd093('0x32')]]=_0x37dbc4;_[_0xd093('0x33')](_0x4b9b42[_0xd093('0x34')],_0x11bd8e);}return _0x4eddd0[_0xd093('0x1d')](_0xd093('0x35'))[_0xd093('0x22')](_0x4b9b42,_0x3f5ef0)[_0xd093('0x23')]()[_0xd093('0x2a')](function(_0x37e700){if(_0x37e700&&_0x37e700['length']){return _0x37e700;}else{var _0x4aa335=_[_0xd093('0x31')](_0x2ed9d8);if(_0x1007e9['additionalSearchLead']){var _0x4fa920={};_0x4fa920[_0x1007e9[_0xd093('0x36')]]=_0x37dbc4;_[_0xd093('0x33')](_0x4aa335['$or'],_0x4fa920);}return _0x4eddd0[_0xd093('0x1d')](_0xd093('0x37'))[_0xd093('0x22')](_0x4aa335,_0x3f5ef0);}});case _0xd093('0x38'):var _0x19df58=_[_0xd093('0x31')](_0x2ed9d8);if(_0x1007e9[_0xd093('0x39')]){var _0x11bd8e={};_0x11bd8e[_0x1007e9[_0xd093('0x39')]]=_0x37dbc4;_[_0xd093('0x33')](_0x19df58[_0xd093('0x34')],_0x11bd8e);}return _0x4eddd0['sobject']('Account')[_0xd093('0x22')](_0x19df58,_0x3f5ef0)[_0xd093('0x23')]()[_0xd093('0x2a')](function(_0x310e28){if(_0x310e28&&_0x310e28[_0xd093('0x24')]){return _0x310e28;}else{var _0x27fe7d=_[_0xd093('0x31')](_0x2ed9d8);if(_0x1007e9[_0xd093('0x32')]){var _0x26ea55={};_0x26ea55[_0x1007e9['additionalSearchContact']]=_0x37dbc4;_['merge'](_0x27fe7d[_0xd093('0x34')],_0x26ea55);}return _0x4eddd0['sobject'](_0xd093('0x35'))[_0xd093('0x22')](_0x27fe7d,_0x3f5ef0)['then'](function(_0x4c9518){if(_0x4c9518&&_0x4c9518[_0xd093('0x24')]){return _0x4c9518;}else{var _0x4e71e5=_[_0xd093('0x31')](_0x2ed9d8);if(_0x1007e9[_0xd093('0x36')]){var _0x3ea19a={};_0x3ea19a[_0x1007e9[_0xd093('0x36')]]=_0x37dbc4;_['merge'](_0x4e71e5['$or'],_0x3ea19a);}return _0x4eddd0['sobject'](_0xd093('0x37'))['find'](_0x4e71e5,_0x3f5ef0);}});}});case _0xd093('0x17'):var _0x4b9b42=_['cloneDeep'](_0x2ed9d8);if(_0x1007e9[_0xd093('0x32')]){var _0x11bd8e={};_0x11bd8e[_0x1007e9[_0xd093('0x32')]]=_0x37dbc4;_[_0xd093('0x33')](_0x4b9b42[_0xd093('0x34')],_0x11bd8e);}return _0x4eddd0[_0xd093('0x1d')](_0xd093('0x35'))[_0xd093('0x22')](_0x4b9b42,_0x3f5ef0)['execute']();case _0xd093('0x14'):var _0x380a92=_[_0xd093('0x31')](_0x2ed9d8);if(_0x1007e9[_0xd093('0x36')]){var _0x11bd8e={};_0x11bd8e[_0x1007e9['additionalSearchLead']]=_0x37dbc4;_[_0xd093('0x33')](_0x380a92['$or'],_0x11bd8e);}return _0x4eddd0[_0xd093('0x1d')](_0xd093('0x37'))[_0xd093('0x22')](_0x380a92,_0x3f5ef0);case'account':var _0x19df58=_[_0xd093('0x31')](_0x2ed9d8);if(_0x1007e9[_0xd093('0x39')]){var _0x11bd8e={};_0x11bd8e[_0x1007e9[_0xd093('0x39')]]=_0x37dbc4;_[_0xd093('0x33')](_0x19df58[_0xd093('0x34')],_0x11bd8e);}return _0x4eddd0[_0xd093('0x1d')](_0xd093('0x3a'))[_0xd093('0x22')](_0x19df58,_0x3f5ef0);default:return null;}})[_0xd093('0x2a')](function(_0x5cd5e3){if(_0x5cd5e3&&_0x5cd5e3[_0xd093('0x24')]){var _0x15d235=_[_0xd093('0x3b')](_0x5cd5e3);if(_0x15d235){return BPromise['resolve']({'id':_0x15d235['Id'],'name':_0x15d235[_0xd093('0x28')],'phone':_0x15d235[_0xd093('0x3c')],'endUserType':_0x15d235[_0xd093('0x3d')][_0xd093('0x3e')][_0xd093('0x3f')]()});}}})[_0xd093('0x2a')](function(_0x2db35c){if(_0x2db35c){logger[_0xd093('0x1b')](_0xd093('0x40'),_0x2db35c[_0xd093('0x13')],_0x37dbc4);return BPromise[_0xd093('0x27')](_0x2db35c);}else{logger[_0xd093('0x1b')](_0xd093('0x41'),_0x37dbc4);var _0x328fee={'Phone':_0x37dbc4};if(_0x1007e9[_0xd093('0x42')]){if(_0x1007e9[_0xd093('0x42')]===_0xd093('0x17')){logger['info'](_0xd093('0x43'),_0x37dbc4,_0x1007e9[_0xd093('0x42')]);_0x328fee[_0xd093('0x44')]=_0x5c6b05!==_0xd093('0x45')?_0x5c6b05:util['format'](_0xd093('0x46'),_0x37dbc4);}else if(_0x1007e9[_0xd093('0x42')]===_0xd093('0x14')){logger[_0xd093('0x1b')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x37dbc4,_0x1007e9['moduleCreate']);_0x328fee[_0xd093('0x44')]=_0x5c6b05!==''?_0x5c6b05:util[_0xd093('0x47')]('Caller\x20-\x20%s',_0x37dbc4);_0x328fee[_0xd093('0x48')]='No\x20Company';}else if(_0x1007e9['moduleCreate']===_0xd093('0x19')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x37dbc4,_0x1007e9[_0xd093('0x42')]);_0x328fee['Name']=_0x5c6b05!==_0xd093('0x45')?_0x5c6b05:util[_0xd093('0x47')](_0xd093('0x46'),_0x37dbc4);}else{return null;}}return _0x4eddd0[_0xd093('0x1d')](_['upperFirst'](_0x1007e9[_0xd093('0x42')]))[_0xd093('0x1e')](_0x328fee)[_0xd093('0x2a')](function(_0x3d0911){return BPromise[_0xd093('0x27')]({'id':_0x3d0911['id'],'endUserType':_0x1007e9[_0xd093('0x42')]});});}});}function getCustomFields(_0x405de0,_0x3ab08d){var _0x1d86a0={};if(_0x405de0[_0xd093('0x24')]>0x0){_['forEach'](_0x405de0,function(_0x77ac2e){if(_[_0xd093('0x49')]([_0xd093('0x4a'),'picklist'],_0x77ac2e[_0xd093('0x3e')])&&_0x77ac2e[_0xd093('0x4b')]){_0x1d86a0[_0x77ac2e['idField']]=_0x77ac2e[_0xd093('0x4c')]['toString']();}else if(_0x77ac2e[_0xd093('0x3e')]===_0xd093('0x4d')&&_0x77ac2e[_0xd093('0x4e')]&&_0x77ac2e['idField']){_0x3ab08d[_0x77ac2e[_0xd093('0x4e')]]&&(_0x1d86a0[_0x77ac2e['idField']]=_0x3ab08d[_0x77ac2e[_0xd093('0x4e')]][_0xd093('0x4f')]());}else if(_0x77ac2e[_0xd093('0x3e')]==='customVariable'&&_0x77ac2e[_0xd093('0x50')]&&_0x77ac2e[_0xd093('0x50')]['name']&&_0x77ac2e[_0xd093('0x4b')]){_0x3ab08d[_0x77ac2e[_0xd093('0x50')][_0xd093('0x51')]['toLowerCase']()]&&(_0x1d86a0[_0x77ac2e[_0xd093('0x4b')]]=_0x3ab08d[_0x77ac2e[_0xd093('0x50')]['name']['toLowerCase']()][_0xd093('0x4f')]());}});}return _0x1d86a0;}function getConnection(_0x53d5ef){var _0x1757b7=_0x53d5ef[_0xd093('0x52')][_0xd093('0x53')](_0x53d5ef[_0xd093('0x54')]);var _0x305e77=new jsforce['Connection']({'oauth2':{'loginUrl':_0x53d5ef[_0xd093('0x55')]||_0xd093('0x56'),'clientId':_0x53d5ef[_0xd093('0x57')],'clientSecret':_0x53d5ef[_0xd093('0x58')]}});return _0x305e77['login'](_0x53d5ef['username'],_0x1757b7)[_0xd093('0x2a')](function(){logger[_0xd093('0x1b')]('Connection\x20established.');return _0x305e77;});}exports[_0xd093('0x59')]=function(_0x284341,_0x5e9b29,_0x2a4304,_0x363ad1,_0x21c5cc,_0x2f973c){var _0x420103,_0x53f244,_0x4bbe8c,_0x4516ff;_0x2f973c[_0xd093('0x5a')]=intUtil[_0xd093('0x5b')](_0x2f973c['serverUrl']);_0x2f973c[_0xd093('0x55')]=intUtil[_0xd093('0x5b')](_0x2f973c[_0xd093('0x55')]);if(_0x21c5cc&&_0x21c5cc[_0xd093('0x5c')]){logger[_0xd093('0x1b')](_0xd093('0x5d'),_0xd093('0x5e'));_0x5e9b29[_0xd093('0x5f')]=util[_0xd093('0x47')](_0xd093('0x60'),_0x2f973c[_0xd093('0x5a')],_0x5e9b29['uniqueid'],md5(_0x5e9b29[_0xd093('0x61')]));}else{_0x5e9b29['recordingURL']='';}return getConnection(_0x2f973c)[_0xd093('0x2a')](function(_0x1b4666){_0x4516ff=_0x1b4666;return getUser(_0x2f973c,_0x363ad1[_0xd093('0x62')],_0x4516ff);})[_0xd093('0x2a')](function(_0x31ae5c){_0x420103=_0x31ae5c;return getEndUser(_0x2f973c,_0x2a4304,_0x5e9b29[_0xd093('0x63')],_0x5e9b29[_0xd093('0x64')],_0x4516ff);})[_0xd093('0x2a')](function(_0xae000){_0x53f244=_0xae000;return getTicket(_0x2f973c,_0x420103,_0x53f244,_0x2a4304,_0x5e9b29,_0x2a4304[_0xd093('0x65')],_0x4516ff,'queue');})[_0xd093('0x2a')](function(_0x6e9c25){_0x4bbe8c=_0x6e9c25;logger[_0xd093('0x1b')](_0xd093('0x66'),_0x4bbe8c['id']);logger[_0xd093('0x1b')](_0xd093('0x67'),_0x4bbe8c['id'],_0x363ad1['name'],_0x2f973c[_0xd093('0x3e')]);switch(_0x2f973c[_0xd093('0x3e')]){case _0xd093('0x68'):emit(util[_0xd093('0x47')](_0xd093('0x69'),_0x363ad1[_0xd093('0x51')]),'trigger:salesforce:display',{'recordId':_0x4bbe8c['id']});break;case _0xd093('0x6a'):emit(util[_0xd093('0x47')]('user:%s',_0x363ad1[_0xd093('0x51')]),_0xd093('0x6b'),{'uri':util[_0xd093('0x47')](_0xd093('0x6c'),_0x4516ff[_0xd093('0x6d')],_0x4bbe8c['id'])});break;default:logger[_0xd093('0x6e')](_0xd093('0x6f'));}})[_0xd093('0x70')](function(_0xef5d38){logger[_0xd093('0x6e')](_0xd093('0x5d'),_0xef5d38);});};exports[_0xd093('0x71')]=function(_0x19b242,_0x4840ac,_0x5c50e4,_0x46b7eb,_0x3366f0,_0x3c36b4,_0x51bbe0){var _0x2c839f,_0xe059da,_0x806883,_0x411d2c;_0x3c36b4[_0xd093('0x5a')]=intUtil[_0xd093('0x5b')](_0x3c36b4[_0xd093('0x5a')]);_0x3c36b4['remoteUri']=intUtil[_0xd093('0x5b')](_0x3c36b4[_0xd093('0x55')]);if(_0x51bbe0&&_0x51bbe0['recordingFormat']&&_0x51bbe0[_0xd093('0x72')]!==_0xd093('0x73')){logger[_0xd093('0x1b')](_0xd093('0x74'),_0xd093('0x5e'));_0x4840ac[_0xd093('0x5f')]=util[_0xd093('0x47')](_0xd093('0x60'),_0x3c36b4[_0xd093('0x5a')],_0x4840ac['uniqueid'],md5(_0x4840ac[_0xd093('0x61')]));}return getConnection(_0x3c36b4)['then'](function(_0x44a997){_0x411d2c=_0x44a997;return getUser(_0x3c36b4,_0x46b7eb[_0xd093('0x62')],_0x411d2c);})[_0xd093('0x2a')](function(_0x74de2b){_0x2c839f=_0x74de2b;return getEndUser(_0x3c36b4,_0x5c50e4,_0x4840ac[_0xd093('0x75')],_0x4840ac[_0xd093('0x76')],_0x411d2c);})[_0xd093('0x2a')](function(_0x5008ac){_0xe059da=_0x5008ac;return getTicket(_0x3c36b4,_0x2c839f,_0xe059da,_0x5c50e4,_0x4840ac,_0x5c50e4['Fields'],_0x411d2c,_0xd093('0x71'));})[_0xd093('0x2a')](function(_0x4ca334){_0x806883=_0x4ca334;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x806883['id']);logger[_0xd093('0x1b')](_0xd093('0x77'),_0x806883['id'],_0x46b7eb[_0xd093('0x51')],_0x3c36b4[_0xd093('0x3e')]);switch(_0x3c36b4[_0xd093('0x3e')]){case'integrationTab':emit(util[_0xd093('0x47')](_0xd093('0x69'),_0x46b7eb[_0xd093('0x51')]),'trigger:salesforce:display',{'recordId':_0x806883['id']});break;case _0xd093('0x6a'):emit(util[_0xd093('0x47')](_0xd093('0x69'),_0x46b7eb[_0xd093('0x51')]),_0xd093('0x6b'),{'uri':util[_0xd093('0x47')](_0xd093('0x6c'),_0x411d2c['instanceUrl'],_0x806883['id'])});break;default:logger['error'](_0xd093('0x74'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xd093('0x70')](function(_0x5d1252){logger[_0xd093('0x6e')]('[OUTBOUND]',_0x5d1252);});};exports[_0xd093('0x78')]=function(_0x272b0b,_0x3df635,_0x3a5c1a,_0x1897ec,_0x47a494,_0x1a50a3){var _0x374430,_0x440fb3,_0x30a0fe,_0x21c928;_0x1a50a3[_0xd093('0x5a')]=intUtil[_0xd093('0x5b')](_0x1a50a3[_0xd093('0x5a')]);_0x1a50a3[_0xd093('0x55')]=intUtil[_0xd093('0x5b')](_0x1a50a3[_0xd093('0x55')]);if(_0x47a494&&_0x47a494[_0xd093('0x5c')]){logger[_0xd093('0x1b')]('['+_0x3df635[_0xd093('0x79')][_0xd093('0x7a')]()+']',_0xd093('0x5e'));_0x3df635[_0xd093('0x5f')]=util[_0xd093('0x47')](_0xd093('0x60'),_0x1a50a3[_0xd093('0x5a')],_0x3df635[_0xd093('0x61')],md5(_0x3df635['uniqueid']));}else{_0x3df635[_0xd093('0x5f')]='';}return getConnection(_0x1a50a3)[_0xd093('0x2a')](function(_0x178c6f){_0x21c928=_0x178c6f;if(!_[_0xd093('0x1f')](_0x1897ec)){return getUser(_0x1a50a3,_0x1897ec[_0xd093('0x51')],_0x21c928);}else{return getUser(_0x1a50a3,null,_0x21c928);}})['then'](function(_0x551760){_0x374430=_0x551760;return getEndUser(_0x1a50a3,_0x3a5c1a,_0x3df635[_0xd093('0x63')],_0x3df635[_0xd093('0x64')],_0x21c928);})[_0xd093('0x2a')](function(_0x52b73f){_0x440fb3=_0x52b73f;return getTicket(_0x1a50a3,_0x374430,_0x440fb3,_0x3a5c1a,_0x3df635,_0x3a5c1a['Fields'],_0x21c928);})[_0xd093('0x2a')](function(_0x3ab09f){_0x30a0fe=_0x3ab09f;logger[_0xd093('0x1b')]('['+_0x3df635[_0xd093('0x79')][_0xd093('0x7a')]()+_0xd093('0x7b'),_0x30a0fe['id']);logger[_0xd093('0x1b')]('['+_0x3df635['lastevent']['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x1a50a3[_0xd093('0x3e')]);})[_0xd093('0x70')](function(_0x99649d){logger['error']('['+_0x3df635[_0xd093('0x79')][_0xd093('0x7a')]()+']',_0x99649d);});}; \ 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 cae4a93..5ea0a0d 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 _0xa252=['../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','length','adminId','result','sys_id','catch','toUpperCase','message','info','],\x20getUser\x20input\x20crm','GET','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','active','userId','adminEmail','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserNumber','],\x20getEndUser\x20crm','forEach','includes','string','picklist','type','nameField','toString','idField','content','variable','customField','toLowerCase','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','true','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all','Tags','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','sysparm_limit=1','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','isNil','email','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','request-promise','util','md5','ioredis','./util'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa252,0x1ae));var _0x2a25=function(_0x66bc97,_0x176c06){_0x66bc97=_0x66bc97-0x0;var _0x4e0cc6=_0xa252[_0x66bc97];return _0x4e0cc6;};'use strict';var _=require(_0x2a25('0x0'));var Promise=require('bluebird');var rp=require(_0x2a25('0x1'));var util=require(_0x2a25('0x2'));var md5=require(_0x2a25('0x3'));var Redis=require(_0x2a25('0x4'));var intUtil=require(_0x2a25('0x5'));var config=require(_0x2a25('0x6'));var logger=require(_0x2a25('0x7'))(_0x2a25('0x8'));config[_0x2a25('0x9')]=_[_0x2a25('0xa')](config['redis'],{'host':_0x2a25('0xb'),'port':0x18eb});var io=require(_0x2a25('0xc'))(new Redis(config[_0x2a25('0x9')]));function getAdminUser(_0x5ce775,_0x609caf,_0x5a9aab,_0x5adb43,_0x1058d4,_0x1471bd){return new Promise(function(_0x28da1b,_0x49bab6){var _0x31390f={'method':'GET','uri':_0x5adb43+_0x2a25('0xd')+'&'+_0x1058d4+'&'+_0x1471bd,'auth':_0x609caf,'json':!![]};return rp(_0x31390f)['then'](function(_0x1db92a){if(_0x1db92a['result'][_0x2a25('0xe')]>0x0){_0x5a9aab[_0x2a25('0xf')]=_0x1db92a[_0x2a25('0x10')][0x0][_0x2a25('0x11')];}logger['info']('['+[_0x5ce775['toUpperCase']()]+'],\x20getAdminUser\x20crm',_0x5a9aab);_0x28da1b(_0x5a9aab);})[_0x2a25('0x12')](function(_0x591546){logger['error']('['+[_0x5ce775[_0x2a25('0x13')]()]+']',_0x591546[_0x2a25('0x14')]);_0x49bab6(_0x591546['message']);});});}function getUser(_0x141112,_0x6dc154,_0x2f142d,_0x355c9b,_0x1327b3){return function(_0x3550f3){logger[_0x2a25('0x15')]('['+[_0x141112[_0x2a25('0x13')]()]+_0x2a25('0x16'),_0x3550f3);return new Promise(function(_0x471f49,_0x415f9a){if(intUtil['validateEmail'](_0x3550f3['userEmail'])){var _0x7d5776={'method':_0x2a25('0x17'),'uri':_0x2f142d+_0x2a25('0x18')+_0x3550f3[_0x2a25('0x19')]+'&'+_0x355c9b+'&'+_0x1327b3,'auth':_0x6dc154,'json':!![]};logger['info']('['+[_0x141112[_0x2a25('0x13')]()]+_0x2a25('0x1a'),_0x7d5776);return rp(_0x7d5776)[_0x2a25('0x1b')](function(_0x14ba44){logger[_0x2a25('0x15')]('['+[_0x141112['toUpperCase']()]+_0x2a25('0x1c'),_0x14ba44);if(_0x14ba44[_0x2a25('0x10')]['length']>0x0&&String(_0x14ba44[_0x2a25('0x10')][0x0][_0x2a25('0x1d')])==='true'){_0x3550f3[_0x2a25('0x1e')]=_0x14ba44[_0x2a25('0x10')][0x0]['sys_id'];}else{_0x3550f3[_0x2a25('0x1e')]=_0x3550f3[_0x2a25('0xf')];_0x3550f3[_0x2a25('0x19')]=_0x3550f3[_0x2a25('0x1f')];}logger[_0x2a25('0x15')]('['+[_0x141112['toUpperCase']()]+_0x2a25('0x20'),_0x3550f3);_0x471f49(_0x3550f3);})['catch'](function(_0x425f99){logger[_0x2a25('0x21')]('['+[_0x141112[_0x2a25('0x13')]()]+']',_0x425f99[_0x2a25('0x14')]);_0x415f9a(_0x425f99[_0x2a25('0x14')]);});}else{logger[_0x2a25('0x15')]('['+[_0x141112[_0x2a25('0x13')]()]+_0x2a25('0x22'));_0x3550f3[_0x2a25('0x1e')]=_0x3550f3[_0x2a25('0xf')];_0x3550f3[_0x2a25('0x19')]=_0x3550f3['adminEmail'];_0x471f49(_0x3550f3);}});};}function createEndUser(_0x672175,_0x9f06de,_0x7d10bb,_0x9b9de4,_0x2f384e){logger['info']('['+[_0x672175['toUpperCase']()]+_0x2a25('0x23'),_0x7d10bb);return new Promise(function(_0xb8673a,_0x3d36e1){var _0x5ac0b6={'method':_0x2a25('0x24'),'uri':_0x9b9de4+_0x2a25('0x25')+_0x2f384e,'body':{'user_name':_0x7d10bb['endUserNumber'],'roles':_0x2a25('0x26'),'first_name':_0x7d10bb['endUserNumber'],'active':'true','date_format':'System','phone':_0x7d10bb['endUserNumber']},'auth':_0x9f06de,'json':!![]};return rp(_0x5ac0b6)[_0x2a25('0x1b')](function(_0x2f65fa){logger['info']('['+[_0x672175[_0x2a25('0x13')]()]+_0x2a25('0x27'),_0x2f65fa[_0x2a25('0x10')]);_0x7d10bb[_0x2a25('0x28')]=_0x2f65fa[_0x2a25('0x10')][_0x2a25('0x11')];_0xb8673a(_0x7d10bb);})['catch'](function(_0x3daa81){logger['error']('['+[_0x672175[_0x2a25('0x13')]()]+']',_0x3daa81['message']);_0x3d36e1(_0x3daa81[_0x2a25('0x14')]);});});}function getEndUser(_0xa8543b,_0x3dab25,_0x366600,_0x683c28,_0x1a2d31){return function(_0x33647d){logger[_0x2a25('0x15')]('['+[_0xa8543b[_0x2a25('0x13')]()]+_0x2a25('0x29'),_0x33647d);return new Promise(function(_0x35fe7c,_0x239a49){var _0x28abc0={'method':_0x2a25('0x17'),'uri':_0x366600+_0x2a25('0x2a')+_0x33647d[_0x2a25('0x2b')]+'&'+_0x683c28+'&'+_0x1a2d31,'auth':_0x3dab25,'json':!![]};return rp(_0x28abc0)[_0x2a25('0x1b')](function(_0x327458){if(_0x327458['result']['length']>0x0){_0x33647d[_0x2a25('0x28')]=_0x327458[_0x2a25('0x10')][0x0]['sys_id'];logger[_0x2a25('0x15')]('['+[_0xa8543b[_0x2a25('0x13')]()]+_0x2a25('0x2c'),_0x33647d);_0x35fe7c(_0x33647d);}else{return createEndUser(_0xa8543b,_0x3dab25,_0x33647d,_0x366600,_0x683c28)[_0x2a25('0x1b')](function(_0x258ecb){logger[_0x2a25('0x15')]('['+[_0xa8543b[_0x2a25('0x13')]()]+'],\x20createEndUser\x20crm',_0x258ecb);_0x35fe7c(_0x258ecb);});}})[_0x2a25('0x12')](function(_0xa9f08d){logger[_0x2a25('0x21')]('['+[_0xa8543b[_0x2a25('0x13')]()]+']',_0xa9f08d[_0x2a25('0x14')]);_0x239a49(_0xa9f08d[_0x2a25('0x14')]);});});};}function getCustomFields(_0x2fbb6c,_0x3f0173){var _0x20c71a={};if(_0x2fbb6c[_0x2a25('0xe')]>0x0){_[_0x2a25('0x2d')](_0x2fbb6c,function(_0x1cf13d){if(_[_0x2a25('0x2e')]([_0x2a25('0x2f'),_0x2a25('0x30')],_0x1cf13d[_0x2a25('0x31')])&&_0x1cf13d[_0x2a25('0x32')]&&!_0x1cf13d['customField']){_0x20c71a[_0x1cf13d[_0x2a25('0x32')]['toLowerCase']()]=_0x1cf13d['content'][_0x2a25('0x33')]();}else if(_[_0x2a25('0x2e')]([_0x2a25('0x2f'),_0x2a25('0x30')],_0x1cf13d['type'])&&_0x1cf13d['idField']&&_0x1cf13d['customField']){_0x20c71a[_0x1cf13d[_0x2a25('0x34')]['toLowerCase']()]=_0x1cf13d[_0x2a25('0x35')][_0x2a25('0x33')]();}else if(_0x1cf13d['type']===_0x2a25('0x36')&&_0x1cf13d['variableName']&&_0x1cf13d[_0x2a25('0x34')]&&_0x1cf13d[_0x2a25('0x37')]){_0x20c71a[_0x1cf13d[_0x2a25('0x34')][_0x2a25('0x38')]()]=_0x3f0173[_0x1cf13d[_0x2a25('0x39')]][_0x2a25('0x33')]();}else if(_0x1cf13d[_0x2a25('0x31')]==='customVariable'&&_0x1cf13d[_0x2a25('0x3a')]&&_0x1cf13d[_0x2a25('0x3a')][_0x2a25('0x3b')]&&_0x1cf13d['idField']&&_0x1cf13d[_0x2a25('0x37')]){_0x20c71a[_0x1cf13d[_0x2a25('0x34')][_0x2a25('0x38')]()]=_0x3f0173[_0x1cf13d[_0x2a25('0x3a')][_0x2a25('0x3b')][_0x2a25('0x38')]()][_0x2a25('0x33')]();}});}return _0x20c71a;}function getTicket(_0x32fb6e,_0x223908,_0x427039,_0xfb72ed,_0x2f6732,_0x5409cc){return function(_0x225e64){logger['info']('['+[_0x32fb6e[_0x2a25('0x13')]()]+_0x2a25('0x3c'),_0x225e64);return new Promise(function(_0xd36cd,_0x36bf3c){var _0x19fc1a=_0x32fb6e[_0x2a25('0x38')]()===_0x2a25('0x3d')?_0x225e64[_0x2a25('0x1e')]:_0x225e64[_0x2a25('0x28')];var _0x22a725={'method':'POST','uri':_0x427039+_0x2a25('0x3e')+'?'+_0x5409cc,'body':Object[_0x2a25('0x3f')]({},{'active':_0x2a25('0x40'),'caller_id':_0x19fc1a,'assigned_to':_0x225e64['userId'],'short_description':intUtil[_0x2a25('0x41')](_0xfb72ed[_0x2a25('0x42')],_0x2f6732,'\x20'),'description':intUtil[_0x2a25('0x41')](_0xfb72ed[_0x2a25('0x43')],_0x2f6732,'\x0a')},getCustomFields(_0xfb72ed['Fields'],_0x2f6732)),'auth':_0x223908,'json':!![]};return rp(_0x22a725)['then'](function(_0x231904){logger['info']('['+[_0x32fb6e['toUpperCase']()]+_0x2a25('0x44'),_0x231904[_0x2a25('0x10')]);_0x225e64[_0x2a25('0x45')]=_0x231904[_0x2a25('0x10')][_0x2a25('0x11')];_0x225e64[_0x2a25('0x46')]=_0x231904[_0x2a25('0x10')]['number'];logger[_0x2a25('0x15')]('['+[_0x32fb6e[_0x2a25('0x13')]()]+_0x2a25('0x47'),_0x225e64);_0xd36cd(_0x225e64);})['catch'](function(_0x2dc58e){logger[_0x2a25('0x21')]('['+[_0x32fb6e[_0x2a25('0x13')]()]+']',_0x2dc58e['message']);_0x36bf3c(_0x2dc58e[_0x2a25('0x14')]);});});};}function createRemoteTag(_0x41bf09,_0x5bebe7,_0x8e144d,_0x24342c){return new Promise(function(_0x1f18da,_0x554adc){var _0x5a37b7={'method':_0x2a25('0x24'),'uri':_0x8e144d+_0x2a25('0x48')+'?'+_0x24342c,'body':{'short_description':_0x41bf09,'global':!![],'active':!![],'name':_0x41bf09},'auth':_0x5bebe7,'json':!![]};return rp(_0x5a37b7)['then'](function(_0x1db497){var _0x2f2072=_0x1db497[_0x2a25('0x10')][_0x2a25('0x11')];_0x1f18da(_0x2f2072);});});}function getRemoteTag(_0x235614,_0x460830,_0x449a80,_0x1d659e,_0x275f15){return new Promise(function(_0xadf450,_0x378c22){var _0x5dec8b={'method':'GET','uri':_0x449a80+'label'+_0x2a25('0x49')+_0x235614+'&'+_0x1d659e,'auth':_0x460830,'json':!![]};return rp(_0x5dec8b)[_0x2a25('0x1b')](function(_0x3c7f6a){if(_0x3c7f6a[_0x2a25('0x10')][_0x2a25('0xe')]>0x0){var _0x3443df=_0x3c7f6a[_0x2a25('0x10')][0x0][_0x2a25('0x11')];_0xadf450(_0x3443df);}else{return createRemoteTag(_0x235614,_0x460830,_0x449a80,_0x1d659e)[_0x2a25('0x1b')](function(_0x3e3eec){_0xadf450(_0x3e3eec);});}});});}function assignTagToIncident(_0x36a613,_0x3d25b3,_0x5c21e7,_0xda8e84,_0x492088){return new Promise(function(_0x7d93e7,_0x244f76){var _0x4e96f4={'method':'POST','uri':_0x5c21e7+_0x2a25('0x4a')+'?'+_0x492088,'body':{'label':_0x36a613,'table':_0x2a25('0x3e'),'id_type':_0x2a25('0x4b'),'table_key':_0xda8e84[_0x2a25('0x45')],'title':_0x2a25('0x4c')+_0xda8e84['ticketNumber'],'id_display':_0xda8e84[_0x2a25('0x46')]},'auth':_0x3d25b3,'json':!![]};return rp(_0x4e96f4)[_0x2a25('0x1b')](function(_0x1b4601){_0x7d93e7();})[_0x2a25('0x12')](function(){_0x7d93e7();});});}function manageTags(_0x55ed95,_0xc14cce,_0x1629c6,_0x41fb6e,_0x5468a4,_0x4d24ac,_0x19f4aa){return new Promise(function(_0x4a7fc9,_0x4d5351){var _0x404d22=[];_0xc14cce[_0x2a25('0x2d')](function(_0x5004ed){_0x404d22[_0x2a25('0x4d')](getRemoteTag(_0x5004ed,_0x1629c6,_0x41fb6e,_0x4d24ac,_0x19f4aa));});return Promise['all'](_0x404d22)[_0x2a25('0x1b')](function(_0x4a102b){if(_0x4a102b[_0x2a25('0xe')]){logger[_0x2a25('0x15')]('['+[_0x55ed95[_0x2a25('0x13')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x4a102b);var _0x2611e4=[];_0x4a102b[_0x2a25('0x2d')](function(_0x7ec67d){_0x2611e4['push'](assignTagToIncident(_0x7ec67d,_0x1629c6,_0x41fb6e,_0x5468a4,_0x4d24ac));});return Promise[_0x2a25('0x4e')](_0x2611e4)[_0x2a25('0x1b')](function(){_0x4a7fc9();})[_0x2a25('0x12')](function(){_0x4a7fc9();});}else{_0x4a7fc9();}});});}function getTags(_0x433b52,_0x56102c,_0x4e57aa,_0x34ec80,_0x4fb472,_0x248ea8){return function(_0x2c5573){return new Promise(function(_0x5cf37a,_0x36ff71){var _0x57d83b=[];var _0x558368=_0x34ec80[_0x2a25('0x4f')];if(_0x558368&&_0x558368[_0x2a25('0xe')]>0x0){_0x57d83b=_['map'](_0x558368,_0x2a25('0x3b'));}if(_0x57d83b['length']>0x0){return manageTags(_0x433b52,_0x57d83b,_0x56102c,_0x4e57aa,_0x2c5573,_0x4fb472,_0x248ea8)[_0x2a25('0x1b')](function(){_0x5cf37a(_0x2c5573);});}else{_0x5cf37a(_0x2c5573);}});};}function emit(_0xc7d327,_0x386fcb,_0x1d6c2d){var _0x5d1d5c='%26sysparm_record_target%3Dincident'+_0x2a25('0x50')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x2a25('0x51');var _0x46d4ba={'uri':_0xc7d327+_0x2a25('0x52')+_0x1d6c2d+_0x5d1d5c};io['to'](util[_0x2a25('0x53')]('user:%s',_0x386fcb))[_0x2a25('0x54')](_0x2a25('0x55'),_0x46d4ba);}exports['cs']=function(_0x2074d1,_0x16f5c9,_0x28a979,_0x505a47,_0x4c1d6b,_0x21986f,_0x48e51e,_0xd6872b){var _0x1c4fd0={};var _0x2fd1bf={'user':_0x21986f['username'],'pass':_0x21986f['password']};var _0x2a1137=_0x2a25('0x56');var _0x39c873='sysparm_display_value=true';_0x21986f[_0x2a25('0x57')]=intUtil['stripTrailingSlash'](_0x21986f[_0x2a25('0x57')]);_0x21986f[_0x2a25('0x58')]=intUtil[_0x2a25('0x59')](_0x21986f[_0x2a25('0x58')]);var _0x21db1f=util[_0x2a25('0x53')](_0x2a25('0x5a'),_0x21986f[_0x2a25('0x57')]);_0x1c4fd0[_0x2a25('0x19')]=!_[_0x2a25('0x5b')](_0x505a47)?_0x505a47['email']:null;_0x1c4fd0['adminEmail']=_0x21986f[_0x2a25('0x5c')];_0x1c4fd0['endUserNumber']=_0xd6872b[_0x2a25('0x38')]()==='outbound'?_0x16f5c9['destcalleridnum']:_0x16f5c9[_0x2a25('0x5d')];_0x1c4fd0[_0x2a25('0x5e')]=_0xd6872b===_0x2a25('0x5f')||_0xd6872b===_0x2a25('0x60')?'queue':_0x2a25('0x3d');var _0x13e88a=util[_0x2a25('0x53')](_0x2a25('0x61'),_0x21986f[_0x2a25('0x58')],_0x16f5c9[_0x2a25('0x62')],md5(_0x16f5c9[_0x2a25('0x62')]));if(_0x4c1d6b&&_0x4c1d6b[_0x2a25('0x63')]){logger[_0x2a25('0x15')](_0x2a25('0x64'),_0x2a25('0x65'));_0x16f5c9[_0x2a25('0x66')]=_0x13e88a;}else if(_0x48e51e&&_0x48e51e['recordingFormat']&&_0x48e51e[_0x2a25('0x67')]!==_0x2a25('0x68')){logger[_0x2a25('0x15')](_0x2a25('0x69'),_0x2a25('0x65'));_0x16f5c9[_0x2a25('0x66')]=_0x13e88a;}else{_0x16f5c9['recordingURL']='';}return getAdminUser(_0xd6872b,_0x2fd1bf,_0x1c4fd0,_0x21db1f,_0x39c873,_0x2a1137)[_0x2a25('0x1b')](getUser(_0xd6872b,_0x2fd1bf,_0x21db1f,_0x39c873,_0x2a1137))[_0x2a25('0x1b')](getEndUser(_0xd6872b,_0x2fd1bf,_0x21db1f,_0x39c873,_0x2a1137))[_0x2a25('0x1b')](getTicket(_0xd6872b,_0x2fd1bf,_0x21db1f,_0x28a979,_0x16f5c9,_0x39c873))[_0x2a25('0x1b')](function(_0x351979){logger[_0x2a25('0x15')](util[_0x2a25('0x53')]('The\x20ticket\x20ID\x20is:\x20%s',_0x351979['ticketId']));logger[_0x2a25('0x15')](util['format'](_0x2a25('0x6a'),_0xd6872b));if(_0xd6872b!==_0x2a25('0x60')){logger['info']('['+[_0xd6872b[_0x2a25('0x13')]()]+']',_0x2a25('0x6b'));emit(_0x21986f[_0x2a25('0x57')],_0x505a47['name'],_0x351979[_0x2a25('0x45')]);}})[_0x2a25('0x12')](function(_0x65822c){logger[_0x2a25('0x21')]('['+[_0xd6872b[_0x2a25('0x13')]()]+_0x2a25('0x6c'),util['inspect'](_0x65822c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2a34=['ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','],\x20getAdminUser\x20crm','catch','error','message','info','toUpperCase','],\x20getUser\x20input\x20crm','validateEmail','GET','],\x20getUser\x20rp\x20obj','length','true','userId','sys_id','userEmail','adminEmail','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','endUserId','],\x20getEndUser\x20input\x20crm','forEach','includes','string','picklist','type','customField','nameField','toLowerCase','toString','idField','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','assign','Subjects','getString','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','ticketNumber','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','username','password','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','isNil','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5'];(function(_0x2fdcb9,_0x50f712){var _0x597b04=function(_0x280887){while(--_0x280887){_0x2fdcb9['push'](_0x2fdcb9['shift']());}};_0x597b04(++_0x50f712);}(_0x2a34,0x11e));var _0x42a3=function(_0x5d1d2a,_0x101b88){_0x5d1d2a=_0x5d1d2a-0x0;var _0x1b07b7=_0x2a34[_0x5d1d2a];return _0x1b07b7;};'use strict';var _=require(_0x42a3('0x0'));var Promise=require(_0x42a3('0x1'));var rp=require(_0x42a3('0x2'));var util=require(_0x42a3('0x3'));var md5=require(_0x42a3('0x4'));var Redis=require(_0x42a3('0x5'));var intUtil=require('./util');var config=require(_0x42a3('0x6'));var logger=require(_0x42a3('0x7'))(_0x42a3('0x8'));config[_0x42a3('0x9')]=_['defaults'](config['redis'],{'host':_0x42a3('0xa'),'port':0x18eb});var io=require(_0x42a3('0xb'))(new Redis(config[_0x42a3('0x9')]));function getAdminUser(_0x2a5c8b,_0x2ad377,_0x1c5be0,_0x124fee,_0x1b43d0,_0x386592){return new Promise(function(_0x42a25c,_0x4f2e12){var _0x7b6357={'method':'GET','uri':_0x124fee+_0x42a3('0xc')+'&'+_0x1b43d0+'&'+_0x386592,'auth':_0x2ad377,'json':!![]};return rp(_0x7b6357)[_0x42a3('0xd')](function(_0x3eb617){if(_0x3eb617[_0x42a3('0xe')]['length']>0x0){_0x1c5be0[_0x42a3('0xf')]=_0x3eb617[_0x42a3('0xe')][0x0]['sys_id'];}logger['info']('['+[_0x2a5c8b['toUpperCase']()]+_0x42a3('0x10'),_0x1c5be0);_0x42a25c(_0x1c5be0);})[_0x42a3('0x11')](function(_0x262a71){logger[_0x42a3('0x12')]('['+[_0x2a5c8b['toUpperCase']()]+']',_0x262a71['message']);_0x4f2e12(_0x262a71[_0x42a3('0x13')]);});});}function getUser(_0x5bb1ae,_0x3d2d95,_0x23e452,_0x5dc890,_0x3684ae){return function(_0xba674f){logger[_0x42a3('0x14')]('['+[_0x5bb1ae[_0x42a3('0x15')]()]+_0x42a3('0x16'),_0xba674f);return new Promise(function(_0x2852b7,_0x35832f){if(intUtil[_0x42a3('0x17')](_0xba674f['userEmail'])){var _0x17cf63={'method':_0x42a3('0x18'),'uri':_0x23e452+'sys_user?sysparm_query=email%3D'+_0xba674f['userEmail']+'&'+_0x5dc890+'&'+_0x3684ae,'auth':_0x3d2d95,'json':!![]};logger[_0x42a3('0x14')]('['+[_0x5bb1ae[_0x42a3('0x15')]()]+_0x42a3('0x19'),_0x17cf63);return rp(_0x17cf63)['then'](function(_0x30b71c){logger[_0x42a3('0x14')]('['+[_0x5bb1ae[_0x42a3('0x15')]()]+'],\x20getUser\x20entity',_0x30b71c);if(_0x30b71c[_0x42a3('0xe')][_0x42a3('0x1a')]>0x0&&String(_0x30b71c[_0x42a3('0xe')][0x0]['active'])===_0x42a3('0x1b')){_0xba674f[_0x42a3('0x1c')]=_0x30b71c[_0x42a3('0xe')][0x0][_0x42a3('0x1d')];}else{_0xba674f['userId']=_0xba674f[_0x42a3('0xf')];_0xba674f[_0x42a3('0x1e')]=_0xba674f[_0x42a3('0x1f')];}logger['info']('['+[_0x5bb1ae[_0x42a3('0x15')]()]+'],\x20getUser\x20crm',_0xba674f);_0x2852b7(_0xba674f);})[_0x42a3('0x11')](function(_0x1e449e){logger[_0x42a3('0x12')]('['+[_0x5bb1ae[_0x42a3('0x15')]()]+']',_0x1e449e['message']);_0x35832f(_0x1e449e[_0x42a3('0x13')]);});}else{logger[_0x42a3('0x14')]('['+[_0x5bb1ae[_0x42a3('0x15')]()]+']\x20using\x20admin\x20profile');_0xba674f['userId']=_0xba674f[_0x42a3('0xf')];_0xba674f[_0x42a3('0x1e')]=_0xba674f['adminEmail'];_0x2852b7(_0xba674f);}});};}function createEndUser(_0x2baf18,_0x340784,_0x3e9f42,_0x589083,_0x3ea2af){logger[_0x42a3('0x14')]('['+[_0x2baf18['toUpperCase']()]+_0x42a3('0x20'),_0x3e9f42);return new Promise(function(_0x1e4e75,_0x21ae8e){var _0x5f4a48={'method':_0x42a3('0x21'),'uri':_0x589083+'sys_user?'+_0x3ea2af,'body':{'user_name':_0x3e9f42[_0x42a3('0x22')],'roles':'user','first_name':_0x3e9f42['endUserNumber'],'active':_0x42a3('0x1b'),'date_format':_0x42a3('0x23'),'phone':_0x3e9f42[_0x42a3('0x22')]},'auth':_0x340784,'json':!![]};return rp(_0x5f4a48)[_0x42a3('0xd')](function(_0x429766){logger[_0x42a3('0x14')]('['+[_0x2baf18[_0x42a3('0x15')]()]+'],\x20EndUser\x20schema',_0x429766[_0x42a3('0xe')]);_0x3e9f42[_0x42a3('0x24')]=_0x429766[_0x42a3('0xe')]['sys_id'];_0x1e4e75(_0x3e9f42);})['catch'](function(_0x4b6b43){logger[_0x42a3('0x12')]('['+[_0x2baf18[_0x42a3('0x15')]()]+']',_0x4b6b43['message']);_0x21ae8e(_0x4b6b43[_0x42a3('0x13')]);});});}function getEndUser(_0x305e3a,_0x3326c0,_0xa6ce75,_0x2782c4,_0x17beda){return function(_0x4f42dc){logger[_0x42a3('0x14')]('['+[_0x305e3a[_0x42a3('0x15')]()]+_0x42a3('0x25'),_0x4f42dc);return new Promise(function(_0x23d275,_0x4ae240){var _0x554f64={'method':_0x42a3('0x18'),'uri':_0xa6ce75+'sys_user?sysparm_query=phone%3D'+_0x4f42dc[_0x42a3('0x22')]+'&'+_0x2782c4+'&'+_0x17beda,'auth':_0x3326c0,'json':!![]};return rp(_0x554f64)[_0x42a3('0xd')](function(_0x18a18f){if(_0x18a18f[_0x42a3('0xe')][_0x42a3('0x1a')]>0x0){_0x4f42dc[_0x42a3('0x24')]=_0x18a18f[_0x42a3('0xe')][0x0][_0x42a3('0x1d')];logger['info']('['+[_0x305e3a[_0x42a3('0x15')]()]+'],\x20getEndUser\x20crm',_0x4f42dc);_0x23d275(_0x4f42dc);}else{return createEndUser(_0x305e3a,_0x3326c0,_0x4f42dc,_0xa6ce75,_0x2782c4)[_0x42a3('0xd')](function(_0x320900){logger[_0x42a3('0x14')]('['+[_0x305e3a[_0x42a3('0x15')]()]+'],\x20createEndUser\x20crm',_0x320900);_0x23d275(_0x320900);});}})[_0x42a3('0x11')](function(_0x20edf6){logger[_0x42a3('0x12')]('['+[_0x305e3a[_0x42a3('0x15')]()]+']',_0x20edf6['message']);_0x4ae240(_0x20edf6[_0x42a3('0x13')]);});});};}function getCustomFields(_0x40f7ff,_0x17f42c){var _0x5c9b6d={};if(_0x40f7ff[_0x42a3('0x1a')]>0x0){_[_0x42a3('0x26')](_0x40f7ff,function(_0x4ce019){if(_[_0x42a3('0x27')]([_0x42a3('0x28'),_0x42a3('0x29')],_0x4ce019[_0x42a3('0x2a')])&&_0x4ce019['nameField']&&!_0x4ce019[_0x42a3('0x2b')]){_0x5c9b6d[_0x4ce019[_0x42a3('0x2c')][_0x42a3('0x2d')]()]=_0x4ce019['content'][_0x42a3('0x2e')]();}else if(_['includes']([_0x42a3('0x28'),'picklist'],_0x4ce019[_0x42a3('0x2a')])&&_0x4ce019[_0x42a3('0x2f')]&&_0x4ce019[_0x42a3('0x2b')]){_0x5c9b6d[_0x4ce019[_0x42a3('0x2f')][_0x42a3('0x2d')]()]=_0x4ce019['content'][_0x42a3('0x2e')]();}else if(_0x4ce019[_0x42a3('0x2a')]==='variable'&&_0x4ce019[_0x42a3('0x30')]&&_0x4ce019[_0x42a3('0x2f')]&&_0x4ce019[_0x42a3('0x2b')]){_0x5c9b6d[_0x4ce019['idField'][_0x42a3('0x2d')]()]=_0x17f42c[_0x4ce019['variableName']][_0x42a3('0x2e')]();}else if(_0x4ce019[_0x42a3('0x2a')]===_0x42a3('0x31')&&_0x4ce019[_0x42a3('0x32')]&&_0x4ce019[_0x42a3('0x32')][_0x42a3('0x33')]&&_0x4ce019[_0x42a3('0x2f')]&&_0x4ce019['customField']){_0x5c9b6d[_0x4ce019[_0x42a3('0x2f')]['toLowerCase']()]=_0x17f42c[_0x4ce019[_0x42a3('0x32')][_0x42a3('0x33')][_0x42a3('0x2d')]()][_0x42a3('0x2e')]();}});}return _0x5c9b6d;}function getTicket(_0x427099,_0x396b7f,_0x5a5856,_0x6eecb2,_0x42fef5,_0x1e47b7){return function(_0x470266){logger[_0x42a3('0x14')]('['+[_0x427099['toUpperCase']()]+_0x42a3('0x34'),_0x470266);return new Promise(function(_0x180883,_0x146f7c){var _0x165160=_0x427099[_0x42a3('0x2d')]()==='outbound'?_0x470266[_0x42a3('0x1c')]:_0x470266[_0x42a3('0x24')];var _0x585dd2={'method':_0x42a3('0x21'),'uri':_0x5a5856+'incident'+'?'+_0x1e47b7,'body':Object[_0x42a3('0x35')]({},{'active':_0x42a3('0x1b'),'caller_id':_0x165160,'assigned_to':_0x470266[_0x42a3('0x1c')],'short_description':intUtil['getString'](_0x6eecb2[_0x42a3('0x36')],_0x42fef5,'\x20'),'description':intUtil[_0x42a3('0x37')](_0x6eecb2[_0x42a3('0x38')],_0x42fef5,'\x0a')},getCustomFields(_0x6eecb2['Fields'],_0x42fef5)),'auth':_0x396b7f,'json':!![]};return rp(_0x585dd2)[_0x42a3('0xd')](function(_0xf8c241){logger[_0x42a3('0x14')]('['+[_0x427099['toUpperCase']()]+_0x42a3('0x39'),_0xf8c241[_0x42a3('0xe')]);_0x470266[_0x42a3('0x3a')]=_0xf8c241[_0x42a3('0xe')][_0x42a3('0x1d')];_0x470266['ticketNumber']=_0xf8c241[_0x42a3('0xe')][_0x42a3('0x3b')];logger[_0x42a3('0x14')]('['+[_0x427099['toUpperCase']()]+_0x42a3('0x3c'),_0x470266);_0x180883(_0x470266);})['catch'](function(_0x58f5b8){logger[_0x42a3('0x12')]('['+[_0x427099[_0x42a3('0x15')]()]+']',_0x58f5b8[_0x42a3('0x13')]);_0x146f7c(_0x58f5b8[_0x42a3('0x13')]);});});};}function createRemoteTag(_0x5ad725,_0x563c69,_0x37ece3,_0x3cdb18){return new Promise(function(_0x4caab4,_0x595b2d){var _0x21af98={'method':_0x42a3('0x21'),'uri':_0x37ece3+_0x42a3('0x3d')+'?'+_0x3cdb18,'body':{'short_description':_0x5ad725,'global':!![],'active':!![],'name':_0x5ad725},'auth':_0x563c69,'json':!![]};return rp(_0x21af98)[_0x42a3('0xd')](function(_0x104df5){var _0x1c1b26=_0x104df5['result']['sys_id'];_0x4caab4(_0x1c1b26);});});}function getRemoteTag(_0x54c7c2,_0x5cb148,_0x489ecf,_0x3a074e,_0x278139){return new Promise(function(_0x5830f8,_0x2cf14e){var _0xa7a890={'method':_0x42a3('0x18'),'uri':_0x489ecf+_0x42a3('0x3d')+_0x42a3('0x3e')+_0x54c7c2+'&'+_0x3a074e,'auth':_0x5cb148,'json':!![]};return rp(_0xa7a890)[_0x42a3('0xd')](function(_0x29a007){if(_0x29a007[_0x42a3('0xe')][_0x42a3('0x1a')]>0x0){var _0x42486a=_0x29a007[_0x42a3('0xe')][0x0][_0x42a3('0x1d')];_0x5830f8(_0x42486a);}else{return createRemoteTag(_0x54c7c2,_0x5cb148,_0x489ecf,_0x3a074e)[_0x42a3('0xd')](function(_0x44df82){_0x5830f8(_0x44df82);});}});});}function assignTagToIncident(_0x6ab50c,_0x47ff1b,_0x308b51,_0x4d091a,_0x113678){return new Promise(function(_0x2a0490,_0x17924a){var _0x27e2db={'method':'POST','uri':_0x308b51+_0x42a3('0x3f')+'?'+_0x113678,'body':{'label':_0x6ab50c,'table':'incident','id_type':'Incident','table_key':_0x4d091a[_0x42a3('0x3a')],'title':_0x42a3('0x40')+_0x4d091a['ticketNumber'],'id_display':_0x4d091a[_0x42a3('0x41')]},'auth':_0x47ff1b,'json':!![]};return rp(_0x27e2db)[_0x42a3('0xd')](function(_0x5dbb99){_0x2a0490();})[_0x42a3('0x11')](function(){_0x2a0490();});});}function manageTags(_0x5a3bf2,_0x3b6286,_0x43632a,_0x596beb,_0x9dda96,_0x5cfba4,_0x4b8023){return new Promise(function(_0x4e3059,_0x244460){var _0x41d14a=[];_0x3b6286[_0x42a3('0x26')](function(_0x4084a6){_0x41d14a['push'](getRemoteTag(_0x4084a6,_0x43632a,_0x596beb,_0x5cfba4,_0x4b8023));});return Promise[_0x42a3('0x42')](_0x41d14a)[_0x42a3('0xd')](function(_0x519677){if(_0x519677[_0x42a3('0x1a')]){logger[_0x42a3('0x14')]('['+[_0x5a3bf2['toUpperCase']()]+_0x42a3('0x43'),_0x519677);var _0x407014=[];_0x519677[_0x42a3('0x26')](function(_0x328ae9){_0x407014['push'](assignTagToIncident(_0x328ae9,_0x43632a,_0x596beb,_0x9dda96,_0x5cfba4));});return Promise['all'](_0x407014)[_0x42a3('0xd')](function(){_0x4e3059();})['catch'](function(){_0x4e3059();});}else{_0x4e3059();}});});}function getTags(_0xfafdab,_0x5e288e,_0x297a30,_0x643331,_0x4ef2e4,_0x4b57d6){return function(_0x16015b){return new Promise(function(_0x1bae7f,_0xe49d74){var _0x575105=[];var _0x680eb1=_0x643331[_0x42a3('0x44')];if(_0x680eb1&&_0x680eb1[_0x42a3('0x1a')]>0x0){_0x575105=_['map'](_0x680eb1,_0x42a3('0x33'));}if(_0x575105[_0x42a3('0x1a')]>0x0){return manageTags(_0xfafdab,_0x575105,_0x5e288e,_0x297a30,_0x16015b,_0x4ef2e4,_0x4b57d6)[_0x42a3('0xd')](function(){_0x1bae7f(_0x16015b);});}else{_0x1bae7f(_0x16015b);}});};}function emit(_0x4748f5,_0x361e3f,_0x590dbd){var _0x27e3f2='%26sysparm_record_target%3Dincident'+_0x42a3('0x45')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x42a3('0x46');var _0x177e06={'uri':_0x4748f5+_0x42a3('0x47')+_0x590dbd+_0x27e3f2};io['to'](util[_0x42a3('0x48')](_0x42a3('0x49'),_0x361e3f))['emit']('trigger:browser:url',_0x177e06);}exports['cs']=function(_0x3294d2,_0x585686,_0x5b4968,_0x2e5353,_0x1abf9f,_0x257b24,_0xc06481,_0x465e87){var _0x3ca548={};var _0x2842fb={'user':_0x257b24[_0x42a3('0x4a')],'pass':_0x257b24[_0x42a3('0x4b')]};var _0x411d6e=_0x42a3('0x4c');var _0x55a666='sysparm_display_value=true';_0x257b24[_0x42a3('0x4d')]=intUtil[_0x42a3('0x4e')](_0x257b24['remoteUri']);_0x257b24[_0x42a3('0x4f')]=intUtil[_0x42a3('0x4e')](_0x257b24[_0x42a3('0x4f')]);var _0x4bdefd=util['format']('%s/api/now/table/',_0x257b24[_0x42a3('0x4d')]);_0x3ca548[_0x42a3('0x1e')]=!_[_0x42a3('0x50')](_0x2e5353)?_0x2e5353['email']:null;_0x3ca548['adminEmail']=_0x257b24['email'];_0x3ca548[_0x42a3('0x22')]=_0x465e87[_0x42a3('0x2d')]()==='outbound'?_0x585686['destcalleridnum']:_0x585686[_0x42a3('0x51')];_0x3ca548[_0x42a3('0x52')]=_0x465e87===_0x42a3('0x53')||_0x465e87===_0x42a3('0x54')?_0x42a3('0x53'):'outbound';var _0x137de7=util[_0x42a3('0x48')](_0x42a3('0x55'),_0x257b24[_0x42a3('0x4f')],_0x585686[_0x42a3('0x56')],md5(_0x585686[_0x42a3('0x56')]));if(_0x1abf9f&&_0x1abf9f[_0x42a3('0x57')]){logger[_0x42a3('0x14')](_0x42a3('0x58'),_0x42a3('0x59'));_0x585686['recordingURL']=_0x137de7;}else if(_0xc06481&&_0xc06481[_0x42a3('0x5a')]&&_0xc06481[_0x42a3('0x5a')]!==_0x42a3('0x5b')){logger[_0x42a3('0x14')]('[OUTBOUND]',_0x42a3('0x59'));_0x585686[_0x42a3('0x5c')]=_0x137de7;}else{_0x585686[_0x42a3('0x5c')]='';}return getAdminUser(_0x465e87,_0x2842fb,_0x3ca548,_0x4bdefd,_0x55a666,_0x411d6e)[_0x42a3('0xd')](getUser(_0x465e87,_0x2842fb,_0x4bdefd,_0x55a666,_0x411d6e))[_0x42a3('0xd')](getEndUser(_0x465e87,_0x2842fb,_0x4bdefd,_0x55a666,_0x411d6e))[_0x42a3('0xd')](getTicket(_0x465e87,_0x2842fb,_0x4bdefd,_0x5b4968,_0x585686,_0x55a666))['then'](function(_0x3b2bf4){logger[_0x42a3('0x14')](util[_0x42a3('0x48')]('The\x20ticket\x20ID\x20is:\x20%s',_0x3b2bf4[_0x42a3('0x3a')]));logger[_0x42a3('0x14')](util[_0x42a3('0x48')](_0x42a3('0x5d'),_0x465e87));if(_0x465e87!=='unmanaged'){logger[_0x42a3('0x14')]('['+[_0x465e87['toUpperCase']()]+']',_0x42a3('0x5e'));emit(_0x257b24[_0x42a3('0x4d')],_0x2e5353[_0x42a3('0x33')],_0x3b2bf4[_0x42a3('0x3a')]);}})[_0x42a3('0x11')](function(_0x39e26e){logger[_0x42a3('0x12')]('['+[_0x465e87[_0x42a3('0x15')]()]+_0x42a3('0x5f'),util[_0x42a3('0x60')](_0x39e26e,{'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 e066440..dedbdf0 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 _0x36b6=['Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','stripTrailingSlash','%s/service/v4_1/rest.php','none','[OUTBOUND]','uniqueid','destcalleridname','The\x20Enduser\x20ID\x20is:','Outbound','The\x20Ticket\x20ID\x20is:','unmanaged','lastevent','users','contacts','toUpperCase','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','sugarcrm','defaults','redis','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','created_by','Descriptions','date_start','toISOString','slice','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','length','variableName','idField','set_entry','JSON','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','stringify','Getting\x20agent\x20with\x20name','get_entry_list','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','entry_list','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','map','string','nameField','customField','toLowerCase','content','type','custom_fields','push','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','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'];(function(_0x4e7af4,_0x758572){var _0x2548f1=function(_0xa849c){while(--_0xa849c){_0x4e7af4['push'](_0x4e7af4['shift']());}};_0x2548f1(++_0x758572);}(_0x36b6,0x102));var _0x636b=function(_0x52fd63,_0x14e24e){_0x52fd63=_0x52fd63-0x0;var _0x254c36=_0x36b6[_0x52fd63];return _0x254c36;};'use strict';var _=require('lodash');var rp=require(_0x636b('0x0'));var BPromise=require(_0x636b('0x1'));var md5=require('md5');var util=require(_0x636b('0x2'));var Redis=require(_0x636b('0x3'));var intUtil=require(_0x636b('0x4'));var config=require(_0x636b('0x5'));var logger=require('../../../../config/logger')(_0x636b('0x6'));config['redis']=_[_0x636b('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x636b('0x8')]));var def={'method':_0x636b('0x9'),'json':!![]};function emit(_0x51ef73,_0x117dad,_0x566c9e){io['to'](_0x51ef73)[_0x636b('0xa')](_0x117dad,_0x566c9e);}function getTicket(_0x353bce,_0x56e942,_0x34d2af,_0x10583f,_0x50b9b6,_0x352eaf,_0x170921,_0x336378){logger[_0x636b('0xb')](_0x636b('0xc'));var _0x24bd9c=new Date();var _0x15bcea=[{'name':_0x636b('0xd'),'value':intUtil['getString'](_0x10583f[_0x636b('0xe')],_0x50b9b6,'\x20')},{'name':'assigned_user_id','value':_0x56e942['id']},{'name':_0x636b('0xf'),'value':_0x56e942['id']},{'name':'description','value':intUtil['getString'](_0x10583f[_0x636b('0x10')],_0x50b9b6,'\x0a')},{'name':_0x636b('0x11'),'value':_0x24bd9c[_0x636b('0x12')]()[_0x636b('0x13')](0x0,0x13)['replace']('T','\x20')},{'name':_0x636b('0x14'),'value':'0'},{'name':_0x636b('0x15'),'value':'15'},{'name':_0x636b('0x16'),'value':_0x34d2af['id']},{'name':_0x636b('0x17'),'value':'Contacts'},{'name':_0x636b('0x18'),'value':_0x34d2af['name']},{'name':_0x636b('0x19'),'value':_0x336378}];if(_0x352eaf[_0x636b('0x1a')]){_['forEach'](_0x352eaf,function(_0x36c79b){if(_0x50b9b6[_0x36c79b[_0x636b('0x1b')]]){_0x15bcea['push']({'name':_0x36c79b[_0x636b('0x1c')],'value':_0x50b9b6[_0x36c79b[_0x636b('0x1b')]]});}});}return request({'form':{'method':_0x636b('0x1d'),'input_type':_0x636b('0x1e'),'response_type':_0x636b('0x1e'),'rest_data':JSON['stringify']({'session':_0x170921['id'],'module_name':_0x636b('0x1f'),'name_value_list':_0x15bcea})}});}function getAuth(_0x6a07cf){return util['format'](_0x636b('0x20'),new Buffer(_0x6a07cf[_0x636b('0x21')]+':X')[_0x636b('0x22')](_0x636b('0x23')));}function getServerInfo(_0x4f5b4f){return request({'form':{'method':_0x636b('0x24'),'input_type':'JSON','response_type':_0x636b('0x1e'),'rest_data':JSON[_0x636b('0x25')]({'session':_0x4f5b4f['id']})}});}function getUser(_0x400cc6,_0x954fc2,_0x33bd26){if(!_['isNil'](_0x954fc2)){logger[_0x636b('0xb')](_0x636b('0x26'),_0x954fc2);return request({'form':{'method':_0x636b('0x27'),'input_type':_0x636b('0x1e'),'response_type':_0x636b('0x1e'),'rest_data':JSON['stringify']({'session':_0x33bd26['id'],'module_name':'Employees','query':util[_0x636b('0x28')](_0x636b('0x29'),_0x954fc2),'order_by':'','offset':'0','select_fields':['id',_0x636b('0xd'),_0x636b('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x636b('0x2b')](function(_0x566cce){if(_0x566cce['entry_list'][_0x636b('0x1a')]){var _0x37e301=_[_0x636b('0x2c')](_0x566cce[_0x636b('0x2d')],function(_0x40e5b3){return _0x40e5b3[_0x636b('0x2e')][_0x636b('0x2a')][_0x636b('0x2f')]===_0x954fc2;});if(_0x37e301){logger[_0x636b('0xb')]('Agent\x20found!');return BPromise[_0x636b('0x30')]({'id':_0x37e301[_0x636b('0x2e')]['id'][_0x636b('0x2f')],'name':_0x37e301[_0x636b('0x2e')][_0x636b('0xd')][_0x636b('0x2f')]});}}logger[_0x636b('0xb')](_0x636b('0x31'));return BPromise[_0x636b('0x30')]({'id':_0x33bd26['name_value_list'][_0x636b('0x32')][_0x636b('0x2f')],'name':_0x33bd26[_0x636b('0x2e')][_0x636b('0x2a')][_0x636b('0x2f')]});});}else{logger[_0x636b('0xb')](_0x636b('0x33'));return BPromise[_0x636b('0x30')]({'id':_0x33bd26['name_value_list'][_0x636b('0x32')][_0x636b('0x2f')],'name':_0x33bd26['name_value_list']['user_name'][_0x636b('0x2f')]});}}function getEndUser(_0x33be27,_0x2e951a,_0x36353f,_0x4008f2){logger[_0x636b('0xb')](_0x636b('0x34'),_0x36353f);return request({'form':{'method':'get_entry_list','input_type':_0x636b('0x1e'),'response_type':_0x636b('0x1e'),'rest_data':JSON[_0x636b('0x25')]({'session':_0x4008f2['id'],'module_name':_0x636b('0x35'),'query':util[_0x636b('0x28')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x36353f),'order_by':'','offset':'0','select_fields':['id',_0x636b('0xd'),_0x636b('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x636b('0x2b')](function(_0x5bf645){if(_0x5bf645['entry_list'][_0x636b('0x1a')]){var _0x48bb8b=_[_0x636b('0x2c')](_0x5bf645[_0x636b('0x2d')],function(_0x41edb2){return _0x41edb2[_0x636b('0x2e')][_0x636b('0x36')][_0x636b('0x2f')]===_0x36353f;});if(_0x48bb8b){logger['info']('Enduser\x20found!');return BPromise[_0x636b('0x30')]({'id':_0x48bb8b['name_value_list']['id'][_0x636b('0x2f')],'name':_0x48bb8b[_0x636b('0x2e')][_0x636b('0xd')]['value'],'phone':_0x48bb8b['name_value_list'][_0x636b('0x36')][_0x636b('0x2f')]});}}else{logger[_0x636b('0xb')](_0x636b('0x37'));return request({'form':{'method':'set_entry','input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x4008f2['id'],'module_name':_0x636b('0x35'),'name_value_list':[{'name':_0x636b('0x38'),'value':_0x2e951a!==_0x636b('0x39')?_0x2e951a:util['format'](_0x636b('0x3a'),_0x36353f)},{'name':_0x636b('0x36'),'value':_0x36353f}]})}})[_0x636b('0x2b')](function(_0x4aa80d){logger[_0x636b('0xb')](_0x636b('0x3b'));return BPromise[_0x636b('0x30')]({'id':_0x4aa80d['id'],'name':_0x4aa80d['entry_list'][_0x636b('0x38')][_0x636b('0x2f')],'phone':_0x4aa80d[_0x636b('0x2d')][_0x636b('0x36')]['value']});});}});}function request(_0x4027fb){logger[_0x636b('0x3c')]('[HTTP]',JSON['stringify'](_0x4027fb));return rp(_['merge'](def,_0x4027fb));}function getTags(_0x26bb07,_0x553b64){var _0x40695f=[];if(_0x26bb07&&_0x26bb07[_0x636b('0x1a')]>0x0){_0x40695f=_[_0x636b('0x3d')](_0x26bb07,_0x553b64);}return _0x40695f;}function getCustomFields(_0x4314a6,_0x4718d3){var _0x362330=[];var _0xe9af02={'custom_fields':[]};if(_0x4314a6[_0x636b('0x1a')]>0x0){_['forEach'](_0x4314a6,function(_0x1da354){if(_0x1da354['type']===_0x636b('0x3e')&&_0x1da354[_0x636b('0x3f')]&&!_0x1da354[_0x636b('0x40')]){_0xe9af02[_0x1da354[_0x636b('0x3f')][_0x636b('0x41')]()]=_0x1da354[_0x636b('0x42')][_0x636b('0x22')]();}else if(_0x1da354[_0x636b('0x43')]===_0x636b('0x3e')&&_0x1da354[_0x636b('0x1c')]&&_0x1da354[_0x636b('0x40')]){_0xe9af02[_0x636b('0x44')][_0x636b('0x45')]({'id':_0x1da354[_0x636b('0x1c')],'value':_0x1da354['content'][_0x636b('0x22')]()});}else if(_0x1da354[_0x636b('0x43')]===_0x636b('0x46')&&_0x1da354[_0x636b('0x1b')]&&_0x1da354['idField']&&_0x1da354[_0x636b('0x40')]){_0x4718d3[_0x1da354[_0x636b('0x1b')]]&&_0xe9af02[_0x636b('0x44')][_0x636b('0x45')]({'id':_0x1da354[_0x636b('0x1c')],'value':_0x4718d3[_0x1da354[_0x636b('0x1b')]][_0x636b('0x22')]()});}else if(_0x1da354[_0x636b('0x43')]===_0x636b('0x47')&&_0x1da354[_0x636b('0x48')]&&_0x1da354[_0x636b('0x48')][_0x636b('0xd')]&&_0x1da354['idField']&&_0x1da354['customField']){_0x4718d3[_0x1da354[_0x636b('0x48')][_0x636b('0xd')]['toLowerCase']()]&&_0xe9af02['custom_fields'][_0x636b('0x45')]({'id':_0x1da354[_0x636b('0x1c')],'value':_0x4718d3[_0x1da354['Variable'][_0x636b('0xd')]['toLowerCase']()][_0x636b('0x22')]()});}});}return _0xe9af02;}function getConnection(_0x5c1ea6){return request({'method':_0x636b('0x9'),'form':{'method':_0x636b('0x49'),'input_type':'JSON','response_type':_0x636b('0x1e'),'rest_data':JSON[_0x636b('0x25')]({'user_auth':{'user_name':_0x5c1ea6[_0x636b('0x4a')],'password':_0x5c1ea6[_0x636b('0x4b')],'encryption':_0x636b('0x4c')},'application':_0x636b('0x4d')})}})[_0x636b('0x2b')](function(_0x45fc0d){var _0x27f960=_0x45fc0d;if(_0x27f960['id']){def['sessionID']=_0x27f960['id'];return BPromise[_0x636b('0x30')](_0x27f960);}else{throw new Error(util['format'](_0x636b('0x4e'),_0x5c1ea6['id']));}});}function setRelationship(_0x1ff860,_0x1df968,_0x15abb4,_0x5e7001){return request({'form':{'method':_0x636b('0x4f'),'input_type':_0x636b('0x1e'),'response_type':'JSON','rest_data':JSON[_0x636b('0x25')]({'session':_0x1ff860['id'],'module_name':_0x636b('0x1f'),'module_id':_0x15abb4['id'],'link_field_name':_0x5e7001,'related_ids':[_0x1df968['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x636b('0x50')]=function(_0x22cb4a,_0x56f07b,_0x3ddd47,_0x5e3d19,_0x408204,_0x25e445){var _0x408c89,_0x2f344b,_0x5b648a,_0x586bee;_0x25e445[_0x636b('0x51')]=intUtil['stripTrailingSlash'](_0x25e445[_0x636b('0x51')]);_0x25e445[_0x636b('0x52')]=intUtil['stripTrailingSlash'](_0x25e445[_0x636b('0x52')]);def[_0x636b('0x53')]=util['format']('%s/service/v4_1/rest.php',_0x25e445['remoteUri']);if(_0x408204&&_0x408204[_0x636b('0x54')]){logger[_0x636b('0xb')](_0x636b('0x55'),_0x636b('0x56'));_0x56f07b['recordingURL']=util[_0x636b('0x28')](_0x636b('0x57'),_0x25e445['serverUrl'],_0x56f07b['uniqueid'],md5(_0x56f07b['uniqueid']));}else{_0x56f07b[_0x636b('0x58')]='';}return getConnection(_0x25e445)[_0x636b('0x2b')](function(_0x5b1cfd){_0x586bee=_0x5b1cfd;return getUser(_0x25e445,_0x5e3d19[_0x636b('0xd')],_0x586bee);})['then'](function(_0x34dbfc){_0x408c89=_0x34dbfc;logger['info'](_0x636b('0x59'),_0x408c89['id']);return getEndUser(_0x25e445,_0x56f07b[_0x636b('0x5a')],_0x56f07b[_0x636b('0x5b')],_0x586bee);})[_0x636b('0x2b')](function(_0x162137){_0x2f344b=_0x162137;logger[_0x636b('0xb')]('The\x20Enduser\x20ID\x20is:',_0x2f344b['id']);return getTicket(_0x25e445,_0x408c89,_0x2f344b,_0x3ddd47,_0x56f07b,_0x3ddd47[_0x636b('0x5c')],_0x586bee,_0x636b('0x5d'));})[_0x636b('0x2b')](function(_0x1b3cc3){_0x5b648a=_0x1b3cc3;logger[_0x636b('0xb')](_0x636b('0x5e'));logger[_0x636b('0xb')]('The\x20Ticket\x20ID\x20is:',_0x5b648a['id']);return setRelationship(_0x586bee,_0x408c89,_0x5b648a,'users');})[_0x636b('0x2b')](function(){return setRelationship(_0x586bee,_0x2f344b,_0x5b648a,'contacts');})['then'](function(){return getServerInfo(_0x586bee);})['then'](function(_0x5a081a){var _0x416d62=parseInt(_0x5a081a[_0x636b('0x5f')][_0x636b('0x60')](0x0));var _0x26156c=util[_0x636b('0x28')](_0x636b('0x61'),_0x25e445[_0x636b('0x51')],_0x5b648a['id']);if(_0x416d62>0x6){_0x26156c=util[_0x636b('0x28')](_0x636b('0x62'),_0x25e445[_0x636b('0x51')],_0x5b648a['id']);}logger[_0x636b('0xb')](_0x636b('0x55'),_0x636b('0x63'));emit(util[_0x636b('0x28')](_0x636b('0x64'),_0x5e3d19['name']),_0x636b('0x65'),{'uri':_0x26156c});})[_0x636b('0x66')](function(_0x16dd2e){logger[_0x636b('0x67')](_0x636b('0x55'),JSON['stringify'](_0x16dd2e));});};exports[_0x636b('0x68')]=function(_0x240b71,_0x11a859,_0x327b03,_0x5e794a,_0x337837,_0x13c899,_0x5bb211){var _0x3cee76,_0x1b2b08,_0x1145d8,_0x4d5390;_0x13c899[_0x636b('0x51')]=intUtil[_0x636b('0x69')](_0x13c899[_0x636b('0x51')]);_0x13c899[_0x636b('0x52')]=intUtil[_0x636b('0x69')](_0x13c899[_0x636b('0x52')]);def[_0x636b('0x53')]=util[_0x636b('0x28')](_0x636b('0x6a'),_0x13c899[_0x636b('0x51')]);if(_0x5bb211&&_0x5bb211['recordingFormat']&&_0x5bb211['recordingFormat']!==_0x636b('0x6b')){logger['info'](_0x636b('0x6c'),'Recording\x20is\x20enabled!');_0x11a859[_0x636b('0x58')]=util[_0x636b('0x28')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x13c899[_0x636b('0x52')],_0x11a859['uniqueid'],md5(_0x11a859[_0x636b('0x6d')]));}return getConnection(_0x13c899)['then'](function(_0x1b478b){_0x4d5390=_0x1b478b;return getUser(_0x13c899,_0x5e794a[_0x636b('0xd')],_0x4d5390);})[_0x636b('0x2b')](function(_0x31166c){_0x3cee76=_0x31166c;logger[_0x636b('0xb')]('The\x20User\x20ID\x20is:',_0x3cee76['id']);return getEndUser(_0x13c899,_0x11a859[_0x636b('0x6e')],_0x11a859['destcalleridnum'],_0x4d5390);})['then'](function(_0x262746){_0x1b2b08=_0x262746;logger['info'](_0x636b('0x6f'),_0x1b2b08['id']);return getTicket(_0x13c899,_0x3cee76,_0x1b2b08,_0x327b03,_0x11a859,_0x327b03[_0x636b('0x5c')],_0x4d5390,_0x636b('0x70'));})['then'](function(_0x4bca4f){_0x1145d8=_0x4bca4f;logger['info'](_0x636b('0x5e'));logger[_0x636b('0xb')](_0x636b('0x71'),_0x1145d8['id']);return setRelationship(_0x4d5390,_0x3cee76,_0x1145d8,'users');})[_0x636b('0x2b')](function(){return setRelationship(_0x4d5390,_0x1b2b08,_0x1145d8,'contacts');})['then'](function(){return getServerInfo(_0x4d5390);})[_0x636b('0x2b')](function(_0x5284ba){var _0x35e761=parseInt(_0x5284ba[_0x636b('0x5f')]['charAt'](0x0));var _0x3397bf=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x13c899['remoteUri'],_0x1145d8['id']);if(_0x35e761>0x6){_0x3397bf=util[_0x636b('0x28')](_0x636b('0x62'),_0x13c899['remoteUri'],_0x1145d8['id']);}logger[_0x636b('0xb')](_0x636b('0x6c'),_0x636b('0x63'));emit(util[_0x636b('0x28')](_0x636b('0x64'),_0x5e794a[_0x636b('0xd')]),_0x636b('0x65'),{'uri':_0x3397bf});})[_0x636b('0x66')](function(_0xca37b3){logger[_0x636b('0x67')]('[OUTBOUND]',JSON[_0x636b('0x25')](_0xca37b3));});};exports[_0x636b('0x72')]=function(_0x986b36,_0x508585,_0x24b363,_0x39593b,_0x45c9c6,_0x59085c){var _0x4397df,_0x39204a,_0x549cff,_0x7563ed;_0x59085c[_0x636b('0x51')]=intUtil[_0x636b('0x69')](_0x59085c[_0x636b('0x51')]);_0x59085c[_0x636b('0x52')]=intUtil['stripTrailingSlash'](_0x59085c[_0x636b('0x52')]);def[_0x636b('0x53')]=util[_0x636b('0x28')](_0x636b('0x6a'),_0x59085c[_0x636b('0x51')]);if(_0x45c9c6&&_0x45c9c6['monitor_format']){logger[_0x636b('0xb')]('['+_0x508585[_0x636b('0x73')]['toUpperCase']()+']',_0x636b('0x56'));_0x508585[_0x636b('0x58')]=util[_0x636b('0x28')](_0x636b('0x57'),_0x59085c[_0x636b('0x52')],_0x508585['uniqueid'],md5(_0x508585['uniqueid']));}else{_0x508585[_0x636b('0x58')]='';}return getConnection(_0x59085c)[_0x636b('0x2b')](function(_0x16b0fe){_0x7563ed=_0x16b0fe;if(!_['isNil'](_0x39593b)){return getUser(_0x59085c,_0x39593b[_0x636b('0xd')],_0x7563ed);}else{return getUser(_0x59085c,null,_0x7563ed);}})[_0x636b('0x2b')](function(_0x48d3e8){_0x4397df=_0x48d3e8;logger[_0x636b('0xb')](_0x636b('0x59'),_0x4397df['id']);return getEndUser(_0x59085c,_0x508585[_0x636b('0x5a')],_0x508585['calleridnum'],_0x7563ed);})[_0x636b('0x2b')](function(_0x363dce){_0x39204a=_0x363dce;logger[_0x636b('0xb')](_0x636b('0x6f'),_0x39204a['id']);return getTicket(_0x59085c,_0x4397df,_0x39204a,_0x24b363,_0x508585,_0x24b363[_0x636b('0x5c')],_0x7563ed,_0x636b('0x5d'));})['then'](function(_0x1c4fb4){_0x549cff=_0x1c4fb4;logger['info']('Ticket\x20created!');logger[_0x636b('0xb')](_0x636b('0x71'),_0x549cff['id']);return setRelationship(_0x7563ed,_0x4397df,_0x549cff,_0x636b('0x74'));})['then'](function(){return setRelationship(_0x7563ed,_0x39204a,_0x549cff,_0x636b('0x75'));})[_0x636b('0x2b')](function(){return getServerInfo(_0x7563ed);})['catch'](function(_0x3a2800){logger[_0x636b('0x67')]('['+_0x508585[_0x636b('0x73')][_0x636b('0x76')]()+']',JSON[_0x636b('0x25')](_0x3a2800));});}; \ No newline at end of file +var _0x9ee5=['created_by','description','getString','Descriptions','toISOString','slice','duration_hours','duration_minutes','parent_id','parent_type','parent_name','name','forEach','variableName','push','idField','JSON','stringify','Calls','format','Basic\x20%s','toString','get_server_info','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','length','find','user_name','value','Agent\x20found!','name_value_list','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','first_name','','Enduser\x20created.','debug','[HTTP]','merge','map','string','nameField','toLowerCase','type','customField','custom_fields','content','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','destcalleridname','destcalleridnum','Outbound','unmanaged','lastevent','toUpperCase','isNil','calleridname','calleridnum','Inbound','lodash','request-promise','bluebird','util','./util','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','Subjects'];(function(_0x7ac78c,_0x5339d3){var _0x19161f=function(_0x374799){while(--_0x374799){_0x7ac78c['push'](_0x7ac78c['shift']());}};_0x19161f(++_0x5339d3);}(_0x9ee5,0x1d2));var _0x59ee=function(_0xa9b4a0,_0x1f2cca){_0xa9b4a0=_0xa9b4a0-0x0;var _0x2fb029=_0x9ee5[_0xa9b4a0];return _0x2fb029;};'use strict';var _=require(_0x59ee('0x0'));var rp=require(_0x59ee('0x1'));var BPromise=require(_0x59ee('0x2'));var md5=require('md5');var util=require(_0x59ee('0x3'));var Redis=require('ioredis');var intUtil=require(_0x59ee('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x59ee('0x5'));config[_0x59ee('0x6')]=_[_0x59ee('0x7')](config[_0x59ee('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x59ee('0x8'))(new Redis(config[_0x59ee('0x6')]));var def={'method':_0x59ee('0x9'),'json':!![]};function emit(_0x2d7674,_0x46a9db,_0x253251){io['to'](_0x2d7674)[_0x59ee('0xa')](_0x46a9db,_0x253251);}function getTicket(_0x584ab5,_0x3e10af,_0x1e0c6b,_0x375c52,_0x29af3a,_0x48d99d,_0x18ce58,_0x1dd4f6){logger[_0x59ee('0xb')](_0x59ee('0xc'));var _0x56f55e=new Date();var _0x5f44b6=[{'name':'name','value':intUtil['getString'](_0x375c52[_0x59ee('0xd')],_0x29af3a,'\x20')},{'name':'assigned_user_id','value':_0x3e10af['id']},{'name':_0x59ee('0xe'),'value':_0x3e10af['id']},{'name':_0x59ee('0xf'),'value':intUtil[_0x59ee('0x10')](_0x375c52[_0x59ee('0x11')],_0x29af3a,'\x0a')},{'name':'date_start','value':_0x56f55e[_0x59ee('0x12')]()[_0x59ee('0x13')](0x0,0x13)['replace']('T','\x20')},{'name':_0x59ee('0x14'),'value':'0'},{'name':_0x59ee('0x15'),'value':'15'},{'name':_0x59ee('0x16'),'value':_0x1e0c6b['id']},{'name':_0x59ee('0x17'),'value':'Contacts'},{'name':_0x59ee('0x18'),'value':_0x1e0c6b[_0x59ee('0x19')]},{'name':'direction','value':_0x1dd4f6}];if(_0x48d99d['length']){_[_0x59ee('0x1a')](_0x48d99d,function(_0x437926){if(_0x29af3a[_0x437926[_0x59ee('0x1b')]]){_0x5f44b6[_0x59ee('0x1c')]({'name':_0x437926[_0x59ee('0x1d')],'value':_0x29af3a[_0x437926[_0x59ee('0x1b')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x59ee('0x1e'),'rest_data':JSON[_0x59ee('0x1f')]({'session':_0x18ce58['id'],'module_name':_0x59ee('0x20'),'name_value_list':_0x5f44b6})}});}function getAuth(_0x4f944d){return util[_0x59ee('0x21')](_0x59ee('0x22'),new Buffer(_0x4f944d['apiKey']+':X')[_0x59ee('0x23')]('base64'));}function getServerInfo(_0x19d221){return request({'form':{'method':_0x59ee('0x24'),'input_type':_0x59ee('0x1e'),'response_type':'JSON','rest_data':JSON[_0x59ee('0x1f')]({'session':_0x19d221['id']})}});}function getUser(_0x1773d5,_0x55962d,_0x4e98ab){if(!_['isNil'](_0x55962d)){logger[_0x59ee('0xb')]('Getting\x20agent\x20with\x20name',_0x55962d);return request({'form':{'method':_0x59ee('0x25'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x4e98ab['id'],'module_name':_0x59ee('0x26'),'query':util[_0x59ee('0x21')](_0x59ee('0x27'),_0x55962d),'order_by':'','offset':'0','select_fields':['id',_0x59ee('0x19'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x59ee('0x28')](function(_0x52477e){if(_0x52477e[_0x59ee('0x29')][_0x59ee('0x2a')]){var _0x41aa03=_[_0x59ee('0x2b')](_0x52477e[_0x59ee('0x29')],function(_0x12a273){return _0x12a273['name_value_list'][_0x59ee('0x2c')][_0x59ee('0x2d')]===_0x55962d;});if(_0x41aa03){logger['info'](_0x59ee('0x2e'));return BPromise['resolve']({'id':_0x41aa03[_0x59ee('0x2f')]['id']['value'],'name':_0x41aa03['name_value_list'][_0x59ee('0x19')][_0x59ee('0x2d')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x59ee('0x30')]({'id':_0x4e98ab[_0x59ee('0x2f')][_0x59ee('0x31')]['value'],'name':_0x4e98ab[_0x59ee('0x2f')][_0x59ee('0x2c')]['value']});});}else{logger[_0x59ee('0xb')](_0x59ee('0x32'));return BPromise[_0x59ee('0x30')]({'id':_0x4e98ab[_0x59ee('0x2f')]['user_id'][_0x59ee('0x2d')],'name':_0x4e98ab[_0x59ee('0x2f')][_0x59ee('0x2c')][_0x59ee('0x2d')]});}}function getEndUser(_0x563acc,_0x28884e,_0x151bf1,_0x49ba61){logger[_0x59ee('0xb')](_0x59ee('0x33'),_0x151bf1);return request({'form':{'method':'get_entry_list','input_type':_0x59ee('0x1e'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x49ba61['id'],'module_name':'Contacts','query':util[_0x59ee('0x21')](_0x59ee('0x34'),_0x151bf1),'order_by':'','offset':'0','select_fields':['id',_0x59ee('0x19'),_0x59ee('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x59ee('0x28')](function(_0x2dbda0){if(_0x2dbda0[_0x59ee('0x29')][_0x59ee('0x2a')]){var _0x2e7a21=_['find'](_0x2dbda0[_0x59ee('0x29')],function(_0x4464bd){return _0x4464bd[_0x59ee('0x2f')][_0x59ee('0x35')][_0x59ee('0x2d')]===_0x151bf1;});if(_0x2e7a21){logger[_0x59ee('0xb')](_0x59ee('0x36'));return BPromise[_0x59ee('0x30')]({'id':_0x2e7a21[_0x59ee('0x2f')]['id'][_0x59ee('0x2d')],'name':_0x2e7a21[_0x59ee('0x2f')][_0x59ee('0x19')][_0x59ee('0x2d')],'phone':_0x2e7a21['name_value_list'][_0x59ee('0x35')][_0x59ee('0x2d')]});}}else{logger['info'](_0x59ee('0x37'));return request({'form':{'method':'set_entry','input_type':_0x59ee('0x1e'),'response_type':_0x59ee('0x1e'),'rest_data':JSON[_0x59ee('0x1f')]({'session':_0x49ba61['id'],'module_name':_0x59ee('0x38'),'name_value_list':[{'name':_0x59ee('0x39'),'value':_0x28884e!==_0x59ee('0x3a')?_0x28884e:util[_0x59ee('0x21')]('Caller\x20-\x20%s',_0x151bf1)},{'name':_0x59ee('0x35'),'value':_0x151bf1}]})}})[_0x59ee('0x28')](function(_0x50f0f8){logger[_0x59ee('0xb')](_0x59ee('0x3b'));return BPromise[_0x59ee('0x30')]({'id':_0x50f0f8['id'],'name':_0x50f0f8['entry_list'][_0x59ee('0x39')]['value'],'phone':_0x50f0f8[_0x59ee('0x29')]['phone_home'][_0x59ee('0x2d')]});});}});}function request(_0xa8e77a){logger[_0x59ee('0x3c')](_0x59ee('0x3d'),JSON[_0x59ee('0x1f')](_0xa8e77a));return rp(_[_0x59ee('0x3e')](def,_0xa8e77a));}function getTags(_0x3fd8c6,_0x5167fb){var _0x3839b2=[];if(_0x3fd8c6&&_0x3fd8c6[_0x59ee('0x2a')]>0x0){_0x3839b2=_[_0x59ee('0x3f')](_0x3fd8c6,_0x5167fb);}return _0x3839b2;}function getCustomFields(_0x5bfa34,_0x15f4f2){var _0x15422b=[];var _0x33bb13={'custom_fields':[]};if(_0x5bfa34[_0x59ee('0x2a')]>0x0){_['forEach'](_0x5bfa34,function(_0x16a755){if(_0x16a755['type']===_0x59ee('0x40')&&_0x16a755['nameField']&&!_0x16a755['customField']){_0x33bb13[_0x16a755[_0x59ee('0x41')][_0x59ee('0x42')]()]=_0x16a755['content'][_0x59ee('0x23')]();}else if(_0x16a755[_0x59ee('0x43')]===_0x59ee('0x40')&&_0x16a755[_0x59ee('0x1d')]&&_0x16a755[_0x59ee('0x44')]){_0x33bb13[_0x59ee('0x45')][_0x59ee('0x1c')]({'id':_0x16a755[_0x59ee('0x1d')],'value':_0x16a755[_0x59ee('0x46')][_0x59ee('0x23')]()});}else if(_0x16a755[_0x59ee('0x43')]==='variable'&&_0x16a755[_0x59ee('0x1b')]&&_0x16a755['idField']&&_0x16a755['customField']){_0x15f4f2[_0x16a755['variableName']]&&_0x33bb13[_0x59ee('0x45')]['push']({'id':_0x16a755[_0x59ee('0x1d')],'value':_0x15f4f2[_0x16a755[_0x59ee('0x1b')]]['toString']()});}else if(_0x16a755['type']==='customVariable'&&_0x16a755[_0x59ee('0x47')]&&_0x16a755[_0x59ee('0x47')]['name']&&_0x16a755[_0x59ee('0x1d')]&&_0x16a755[_0x59ee('0x44')]){_0x15f4f2[_0x16a755[_0x59ee('0x47')][_0x59ee('0x19')]['toLowerCase']()]&&_0x33bb13[_0x59ee('0x45')][_0x59ee('0x1c')]({'id':_0x16a755[_0x59ee('0x1d')],'value':_0x15f4f2[_0x16a755[_0x59ee('0x47')][_0x59ee('0x19')][_0x59ee('0x42')]()][_0x59ee('0x23')]()});}});}return _0x33bb13;}function getConnection(_0x1900a8){return request({'method':_0x59ee('0x9'),'form':{'method':_0x59ee('0x48'),'input_type':_0x59ee('0x1e'),'response_type':_0x59ee('0x1e'),'rest_data':JSON[_0x59ee('0x1f')]({'user_auth':{'user_name':_0x1900a8['username'],'password':_0x1900a8[_0x59ee('0x49')],'encryption':_0x59ee('0x4a')},'application':_0x59ee('0x4b')})}})[_0x59ee('0x28')](function(_0x5d9b95){var _0x6677e1=_0x5d9b95;if(_0x6677e1['id']){def[_0x59ee('0x4c')]=_0x6677e1['id'];return BPromise[_0x59ee('0x30')](_0x6677e1);}else{throw new Error(util[_0x59ee('0x21')](_0x59ee('0x4d'),_0x1900a8['id']));}});}function setRelationship(_0x26f4bc,_0x1beb34,_0x4aa1e8,_0x42ac2d){return request({'form':{'method':_0x59ee('0x4e'),'input_type':_0x59ee('0x1e'),'response_type':'JSON','rest_data':JSON[_0x59ee('0x1f')]({'session':_0x26f4bc['id'],'module_name':'Calls','module_id':_0x4aa1e8['id'],'link_field_name':_0x42ac2d,'related_ids':[_0x1beb34['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x354ebf,_0x164b95,_0x338d5d,_0x3cd6bd,_0x26877a,_0xabd07d){var _0x3b8d39,_0x67f389,_0xf739d5,_0x26e80a;_0xabd07d[_0x59ee('0x4f')]=intUtil[_0x59ee('0x50')](_0xabd07d[_0x59ee('0x4f')]);_0xabd07d[_0x59ee('0x51')]=intUtil['stripTrailingSlash'](_0xabd07d[_0x59ee('0x51')]);def[_0x59ee('0x52')]=util[_0x59ee('0x21')](_0x59ee('0x53'),_0xabd07d[_0x59ee('0x4f')]);if(_0x26877a&&_0x26877a[_0x59ee('0x54')]){logger[_0x59ee('0xb')]('[QUEUE]',_0x59ee('0x55'));_0x164b95['recordingURL']=util['format'](_0x59ee('0x56'),_0xabd07d['serverUrl'],_0x164b95['uniqueid'],md5(_0x164b95[_0x59ee('0x57')]));}else{_0x164b95['recordingURL']='';}return getConnection(_0xabd07d)[_0x59ee('0x28')](function(_0x33f627){_0x26e80a=_0x33f627;return getUser(_0xabd07d,_0x3cd6bd[_0x59ee('0x19')],_0x26e80a);})[_0x59ee('0x28')](function(_0x42a253){_0x3b8d39=_0x42a253;logger[_0x59ee('0xb')](_0x59ee('0x58'),_0x3b8d39['id']);return getEndUser(_0xabd07d,_0x164b95['calleridname'],_0x164b95['calleridnum'],_0x26e80a);})[_0x59ee('0x28')](function(_0x136018){_0x67f389=_0x136018;logger[_0x59ee('0xb')](_0x59ee('0x59'),_0x67f389['id']);return getTicket(_0xabd07d,_0x3b8d39,_0x67f389,_0x338d5d,_0x164b95,_0x338d5d[_0x59ee('0x5a')],_0x26e80a,'Inbound');})[_0x59ee('0x28')](function(_0x3fd5a9){_0xf739d5=_0x3fd5a9;logger[_0x59ee('0xb')](_0x59ee('0x5b'));logger[_0x59ee('0xb')](_0x59ee('0x5c'),_0xf739d5['id']);return setRelationship(_0x26e80a,_0x3b8d39,_0xf739d5,_0x59ee('0x5d'));})[_0x59ee('0x28')](function(){return setRelationship(_0x26e80a,_0x67f389,_0xf739d5,_0x59ee('0x5e'));})[_0x59ee('0x28')](function(){return getServerInfo(_0x26e80a);})[_0x59ee('0x28')](function(_0x3c9c4d){var _0x4824cf=parseInt(_0x3c9c4d[_0x59ee('0x5f')][_0x59ee('0x60')](0x0));var _0x22fc1c=util[_0x59ee('0x21')](_0x59ee('0x61'),_0xabd07d[_0x59ee('0x4f')],_0xf739d5['id']);if(_0x4824cf>0x6){_0x22fc1c=util[_0x59ee('0x21')](_0x59ee('0x62'),_0xabd07d[_0x59ee('0x4f')],_0xf739d5['id']);}logger[_0x59ee('0xb')](_0x59ee('0x63'),_0x59ee('0x64'));emit(util[_0x59ee('0x21')](_0x59ee('0x65'),_0x3cd6bd[_0x59ee('0x19')]),_0x59ee('0x66'),{'uri':_0x22fc1c});})[_0x59ee('0x67')](function(_0x476fbd){logger[_0x59ee('0x68')](_0x59ee('0x63'),JSON['stringify'](_0x476fbd));});};exports[_0x59ee('0x69')]=function(_0x2481a7,_0x14b1af,_0x18ad0a,_0x3bd39e,_0x58e9fe,_0x5db8b8,_0x22dbcd){var _0x18333b,_0x36c1a3,_0x5d0017,_0x444ad7;_0x5db8b8[_0x59ee('0x4f')]=intUtil[_0x59ee('0x50')](_0x5db8b8['remoteUri']);_0x5db8b8[_0x59ee('0x51')]=intUtil[_0x59ee('0x50')](_0x5db8b8[_0x59ee('0x51')]);def[_0x59ee('0x52')]=util[_0x59ee('0x21')](_0x59ee('0x53'),_0x5db8b8[_0x59ee('0x4f')]);if(_0x22dbcd&&_0x22dbcd['recordingFormat']&&_0x22dbcd[_0x59ee('0x6a')]!==_0x59ee('0x6b')){logger['info'](_0x59ee('0x6c'),_0x59ee('0x55'));_0x14b1af[_0x59ee('0x6d')]=util[_0x59ee('0x21')](_0x59ee('0x56'),_0x5db8b8[_0x59ee('0x51')],_0x14b1af[_0x59ee('0x57')],md5(_0x14b1af[_0x59ee('0x57')]));}return getConnection(_0x5db8b8)[_0x59ee('0x28')](function(_0x2f95c5){_0x444ad7=_0x2f95c5;return getUser(_0x5db8b8,_0x3bd39e[_0x59ee('0x19')],_0x444ad7);})[_0x59ee('0x28')](function(_0x199bd9){_0x18333b=_0x199bd9;logger[_0x59ee('0xb')](_0x59ee('0x58'),_0x18333b['id']);return getEndUser(_0x5db8b8,_0x14b1af[_0x59ee('0x6e')],_0x14b1af[_0x59ee('0x6f')],_0x444ad7);})[_0x59ee('0x28')](function(_0x188fc9){_0x36c1a3=_0x188fc9;logger[_0x59ee('0xb')]('The\x20Enduser\x20ID\x20is:',_0x36c1a3['id']);return getTicket(_0x5db8b8,_0x18333b,_0x36c1a3,_0x18ad0a,_0x14b1af,_0x18ad0a[_0x59ee('0x5a')],_0x444ad7,_0x59ee('0x70'));})[_0x59ee('0x28')](function(_0x3afb3d){_0x5d0017=_0x3afb3d;logger[_0x59ee('0xb')](_0x59ee('0x5b'));logger['info'](_0x59ee('0x5c'),_0x5d0017['id']);return setRelationship(_0x444ad7,_0x18333b,_0x5d0017,_0x59ee('0x5d'));})['then'](function(){return setRelationship(_0x444ad7,_0x36c1a3,_0x5d0017,'contacts');})['then'](function(){return getServerInfo(_0x444ad7);})['then'](function(_0x2ab469){var _0x26c688=parseInt(_0x2ab469['version'][_0x59ee('0x60')](0x0));var _0x4f526f=util[_0x59ee('0x21')](_0x59ee('0x61'),_0x5db8b8[_0x59ee('0x4f')],_0x5d0017['id']);if(_0x26c688>0x6){_0x4f526f=util[_0x59ee('0x21')](_0x59ee('0x62'),_0x5db8b8[_0x59ee('0x4f')],_0x5d0017['id']);}logger[_0x59ee('0xb')](_0x59ee('0x6c'),_0x59ee('0x64'));emit(util[_0x59ee('0x21')](_0x59ee('0x65'),_0x3bd39e['name']),'trigger:browser:url',{'uri':_0x4f526f});})[_0x59ee('0x67')](function(_0x5eccea){logger[_0x59ee('0x68')](_0x59ee('0x6c'),JSON['stringify'](_0x5eccea));});};exports[_0x59ee('0x71')]=function(_0x5bb564,_0x780bc9,_0x5a482f,_0x6afc18,_0x2cfda1,_0x40dbf7){var _0x220a2b,_0x55d446,_0x2ef690,_0x9477e8;_0x40dbf7[_0x59ee('0x4f')]=intUtil[_0x59ee('0x50')](_0x40dbf7[_0x59ee('0x4f')]);_0x40dbf7[_0x59ee('0x51')]=intUtil['stripTrailingSlash'](_0x40dbf7[_0x59ee('0x51')]);def['uri']=util[_0x59ee('0x21')](_0x59ee('0x53'),_0x40dbf7[_0x59ee('0x4f')]);if(_0x2cfda1&&_0x2cfda1[_0x59ee('0x54')]){logger['info']('['+_0x780bc9[_0x59ee('0x72')][_0x59ee('0x73')]()+']',_0x59ee('0x55'));_0x780bc9[_0x59ee('0x6d')]=util[_0x59ee('0x21')](_0x59ee('0x56'),_0x40dbf7[_0x59ee('0x51')],_0x780bc9[_0x59ee('0x57')],md5(_0x780bc9[_0x59ee('0x57')]));}else{_0x780bc9['recordingURL']='';}return getConnection(_0x40dbf7)[_0x59ee('0x28')](function(_0x14e26b){_0x9477e8=_0x14e26b;if(!_[_0x59ee('0x74')](_0x6afc18)){return getUser(_0x40dbf7,_0x6afc18[_0x59ee('0x19')],_0x9477e8);}else{return getUser(_0x40dbf7,null,_0x9477e8);}})[_0x59ee('0x28')](function(_0x5c986b){_0x220a2b=_0x5c986b;logger['info'](_0x59ee('0x58'),_0x220a2b['id']);return getEndUser(_0x40dbf7,_0x780bc9[_0x59ee('0x75')],_0x780bc9[_0x59ee('0x76')],_0x9477e8);})[_0x59ee('0x28')](function(_0x3da581){_0x55d446=_0x3da581;logger['info'](_0x59ee('0x59'),_0x55d446['id']);return getTicket(_0x40dbf7,_0x220a2b,_0x55d446,_0x5a482f,_0x780bc9,_0x5a482f[_0x59ee('0x5a')],_0x9477e8,_0x59ee('0x77'));})[_0x59ee('0x28')](function(_0x136203){_0x2ef690=_0x136203;logger['info'](_0x59ee('0x5b'));logger[_0x59ee('0xb')](_0x59ee('0x5c'),_0x2ef690['id']);return setRelationship(_0x9477e8,_0x220a2b,_0x2ef690,_0x59ee('0x5d'));})[_0x59ee('0x28')](function(){return setRelationship(_0x9477e8,_0x55d446,_0x2ef690,_0x59ee('0x5e'));})[_0x59ee('0x28')](function(){return getServerInfo(_0x9477e8);})[_0x59ee('0x67')](function(_0x45a1dd){logger[_0x59ee('0x68')]('['+_0x780bc9[_0x59ee('0x72')][_0x59ee('0x73')]()+']',JSON['stringify'](_0x45a1dd));});}; \ 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 a01144f..5eb6c61 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 _0xdec3=['lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','content','variable','variableName','push','toString','type','customVariable','Variable','name','toLowerCase','keyType','string','format','%s:\x20%s','key','keyContent','stripTrailingSlash','slice','substring'];(function(_0x13e300,_0x1bcb41){var _0x5a3eea=function(_0x2dfd2a){while(--_0x2dfd2a){_0x13e300['push'](_0x13e300['shift']());}};_0x5a3eea(++_0x1bcb41);}(_0xdec3,0xe4));var _0x3dec=function(_0x1f703f,_0x266ba9){_0x1f703f=_0x1f703f-0x0;var _0x3ad2ec=_0xdec3[_0x1f703f];return _0x3ad2ec;};'use strict';var _=require(_0x3dec('0x0'));var util=require(_0x3dec('0x1'));exports[_0x3dec('0x2')]=function(_0x4747c9,_0x4452a3,_0x21f8ce){var _0x3bbb12=[];if(_0x4747c9[_0x3dec('0x3')]>0x0){var _0x18ef60=_[_0x3dec('0x4')](_0x4747c9,['id']);for(var _0x3c6886=0x0;_0x3c6886<_0x18ef60[_0x3dec('0x3')];_0x3c6886++){var _0x14563f=_0x18ef60[_0x3c6886];if(_0x14563f['type']==='string'){_0x3bbb12['push'](_0x14563f[_0x3dec('0x5')]);}else if(_0x14563f['type']===_0x3dec('0x6')&&_0x14563f[_0x3dec('0x7')]){_0x4452a3[_0x14563f['variableName']]&&_0x3bbb12[_0x3dec('0x8')](_0x4452a3[_0x14563f['variableName']][_0x3dec('0x9')]());}else if(_0x14563f[_0x3dec('0xa')]===_0x3dec('0xb')&&_0x14563f[_0x3dec('0xc')]&&_0x14563f[_0x3dec('0xc')]['name']){_0x4452a3[_0x14563f['Variable'][_0x3dec('0xd')]['toLowerCase']()]&&_0x3bbb12[_0x3dec('0x8')](_0x4452a3[_0x14563f[_0x3dec('0xc')][_0x3dec('0xd')][_0x3dec('0xe')]()][_0x3dec('0x9')]());}else if(_0x14563f[_0x3dec('0xa')]==='keyValue'){if(_0x14563f[_0x3dec('0xf')]===_0x3dec('0x10')&&_0x14563f['key']){_0x3bbb12[_0x3dec('0x8')](util[_0x3dec('0x11')](_0x3dec('0x12'),_0x14563f[_0x3dec('0x13')],_0x14563f[_0x3dec('0x14')]));}else if(_0x14563f[_0x3dec('0xf')]===_0x3dec('0x6')&&_0x14563f[_0x3dec('0x7')]&&_0x14563f[_0x3dec('0x13')]){_0x4452a3[_0x14563f[_0x3dec('0x7')]]&&_0x3bbb12['push'](util[_0x3dec('0x11')](_0x3dec('0x12'),_0x14563f['key'],_0x4452a3[_0x14563f[_0x3dec('0x7')]]));}else if(_0x14563f[_0x3dec('0xf')]===_0x3dec('0xb')&&_0x14563f[_0x3dec('0xc')]&&_0x14563f[_0x3dec('0xc')][_0x3dec('0xd')]&&_0x14563f[_0x3dec('0x13')]){_0x4452a3[_0x14563f[_0x3dec('0xc')][_0x3dec('0xd')][_0x3dec('0xe')]()]&&_0x3bbb12[_0x3dec('0x8')](util[_0x3dec('0x11')](_0x3dec('0x12'),_0x14563f['key'],_0x4452a3[_0x14563f[_0x3dec('0xc')][_0x3dec('0xd')][_0x3dec('0xe')]()]));}}}}return _0x3bbb12['join'](_0x21f8ce);};exports[_0x3dec('0x15')]=function(_0x287dbe){var _0x1b0b5b=_0x287dbe[_0x3dec('0x16')](-0x1);if(_0x1b0b5b==='/'){_0x287dbe=_0x287dbe[_0x3dec('0x17')](0x0,_0x287dbe[_0x3dec('0x18')](_0x1b0b5b));}return _0x287dbe;};exports[_0x3dec('0x19')]=function(_0x5525e1){if(!_[_0x3dec('0x1a')](_0x5525e1)&&_0x5525e1!==''){var _0x1881f8=/^(([^<>()\[\]\\.,;:\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 _0x1881f8[_0x3dec('0x1b')](String(_0x5525e1)[_0x3dec('0xe')]());}else{return![];}}; \ No newline at end of file +var _0x42a0=['key','format','%s:\x20%s','keyContent','keyType','customVariable','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','util','getString','length','sortBy','type','string','push','variable','variableName','toString','Variable','name','toLowerCase','keyValue'];(function(_0x51a877,_0x294ccb){var _0x32f1f7=function(_0xc19fd){while(--_0xc19fd){_0x51a877['push'](_0x51a877['shift']());}};_0x32f1f7(++_0x294ccb);}(_0x42a0,0x1a2));var _0x042a=function(_0x3aa564,_0x398f19){_0x3aa564=_0x3aa564-0x0;var _0x51f7a6=_0x42a0[_0x3aa564];return _0x51f7a6;};'use strict';var _=require('lodash');var util=require(_0x042a('0x0'));exports[_0x042a('0x1')]=function(_0x2f95d9,_0x3429fc,_0x1a506c){var _0x2dac37=[];if(_0x2f95d9[_0x042a('0x2')]>0x0){var _0x2c646a=_[_0x042a('0x3')](_0x2f95d9,['id']);for(var _0x24e766=0x0;_0x24e766<_0x2c646a['length'];_0x24e766++){var _0x436a08=_0x2c646a[_0x24e766];if(_0x436a08[_0x042a('0x4')]===_0x042a('0x5')){_0x2dac37[_0x042a('0x6')](_0x436a08['content']);}else if(_0x436a08[_0x042a('0x4')]===_0x042a('0x7')&&_0x436a08[_0x042a('0x8')]){_0x3429fc[_0x436a08[_0x042a('0x8')]]&&_0x2dac37['push'](_0x3429fc[_0x436a08[_0x042a('0x8')]][_0x042a('0x9')]());}else if(_0x436a08['type']==='customVariable'&&_0x436a08[_0x042a('0xa')]&&_0x436a08[_0x042a('0xa')]['name']){_0x3429fc[_0x436a08[_0x042a('0xa')][_0x042a('0xb')][_0x042a('0xc')]()]&&_0x2dac37[_0x042a('0x6')](_0x3429fc[_0x436a08[_0x042a('0xa')]['name']['toLowerCase']()][_0x042a('0x9')]());}else if(_0x436a08[_0x042a('0x4')]===_0x042a('0xd')){if(_0x436a08['keyType']===_0x042a('0x5')&&_0x436a08[_0x042a('0xe')]){_0x2dac37[_0x042a('0x6')](util[_0x042a('0xf')](_0x042a('0x10'),_0x436a08[_0x042a('0xe')],_0x436a08[_0x042a('0x11')]));}else if(_0x436a08[_0x042a('0x12')]===_0x042a('0x7')&&_0x436a08[_0x042a('0x8')]&&_0x436a08['key']){_0x3429fc[_0x436a08[_0x042a('0x8')]]&&_0x2dac37[_0x042a('0x6')](util[_0x042a('0xf')](_0x042a('0x10'),_0x436a08[_0x042a('0xe')],_0x3429fc[_0x436a08['variableName']]));}else if(_0x436a08[_0x042a('0x12')]===_0x042a('0x13')&&_0x436a08[_0x042a('0xa')]&&_0x436a08[_0x042a('0xa')][_0x042a('0xb')]&&_0x436a08['key']){_0x3429fc[_0x436a08[_0x042a('0xa')][_0x042a('0xb')][_0x042a('0xc')]()]&&_0x2dac37['push'](util['format'](_0x042a('0x10'),_0x436a08['key'],_0x3429fc[_0x436a08[_0x042a('0xa')][_0x042a('0xb')]['toLowerCase']()]));}}}}return _0x2dac37[_0x042a('0x14')](_0x1a506c);};exports[_0x042a('0x15')]=function(_0x342bdc){var _0x50a136=_0x342bdc[_0x042a('0x16')](-0x1);if(_0x50a136==='/'){_0x342bdc=_0x342bdc[_0x042a('0x17')](0x0,_0x342bdc[_0x042a('0x18')](_0x50a136));}return _0x342bdc;};exports[_0x042a('0x19')]=function(_0x391aaf){if(!_[_0x042a('0x1a')](_0x391aaf)&&_0x391aaf!==''){var _0x50e585=/^(([^<>()\[\]\\.,;:\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 _0x50e585['test'](String(_0x391aaf)[_0x042a('0xc')]());}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 f5707e2..cc7a40e 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 _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','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','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0xc6afe9,_0x3eae56){var _0x21d51c=function(_0x28cc68){while(--_0x28cc68){_0xc6afe9['push'](_0xc6afe9['shift']());}};_0x21d51c(++_0x3eae56);}(_0xe706,0xa3));var _0x6e70=function(_0x1e6659,_0x1f860c){_0x1e6659=_0x1e6659-0x0;var _0x4d16e4=_0xe706[_0x1e6659];return _0x4d16e4;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ 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(_0x435d8c,_0x3eb996){var _0x9698a0=function(_0x40a7da){while(--_0x40a7da){_0x435d8c['push'](_0x435d8c['shift']());}};_0x9698a0(++_0x3eb996);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'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 4c544a0..ff9a921 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 _0xab01=['name','getString','Subjects','Descriptions','Fields','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','end-user','first','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','base64','[HTTP]','stringify','map','includes','string','picklist','type','customField','nameField','content','toString','idField','push','variable','variableName','custom_fields','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','replace','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:browser:url','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','application/json','info','%s/tickets.json','remoteUri','POST','merge','Tags'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xab01,0x12e));var _0x1ab0=function(_0xafc244,_0x19c0ae){_0xafc244=_0xafc244-0x0;var _0xb91010=_0xab01[_0xafc244];return _0xb91010;};'use strict';var _=require('lodash');var rp=require(_0x1ab0('0x0'));var md5=require(_0x1ab0('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x1ab0('0x2'));var config=require(_0x1ab0('0x3'));var logger=require(_0x1ab0('0x4'))(_0x1ab0('0x5'));config[_0x1ab0('0x6')]=_[_0x1ab0('0x7')](config[_0x1ab0('0x6')],{'host':_0x1ab0('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1ab0('0x6')]));function emit(_0x570cc2,_0xf80365,_0x2c8251){io['to'](_0x570cc2)['emit'](_0xf80365,_0x2c8251);}var headers={'Content-Type':_0x1ab0('0x9'),'Accept':_0x1ab0('0x9')};function getTicket(_0x349b66,_0x4b6cbd,_0x4ac149,_0x100b45,_0x2df970){logger[_0x1ab0('0xa')]('Creating\x20new\x20ticket...');return request({'uri':util['format'](_0x1ab0('0xb'),_0x349b66[_0x1ab0('0xc')]),'method':_0x1ab0('0xd'),'body':{'ticket':_[_0x1ab0('0xe')]({'requester_id':_0x4ac149['id'],'submitter_id':_0x4b6cbd?_0x4b6cbd['id']:undefined,'assignee_id':_0x4b6cbd?_0x4b6cbd['id']:undefined,'tags':getTags(_0x100b45[_0x1ab0('0xf')],_0x1ab0('0x10')),'subject':intUtil[_0x1ab0('0x11')](_0x100b45[_0x1ab0('0x12')],_0x2df970,'\x20'),'description':intUtil[_0x1ab0('0x11')](_0x100b45[_0x1ab0('0x13')],_0x2df970,'\x0a'),'comment':{'public':![],'body':intUtil[_0x1ab0('0x11')](_0x100b45[_0x1ab0('0x13')],_0x2df970,'\x0a')}},getCustomFields(_0x100b45[_0x1ab0('0x14')],_0x2df970))}})['then'](function(_0x2157ff){logger['info'](_0x1ab0('0x15'));return _0x2157ff[_0x1ab0('0x16')];});}function getUser(_0x55dc7e,_0x2ec497){if(intUtil[_0x1ab0('0x17')](_0x2ec497)){logger['info'](_0x1ab0('0x18'),_0x2ec497);return request({'uri':util[_0x1ab0('0x19')](_0x1ab0('0x1a'),_0x55dc7e[_0x1ab0('0xc')]),'qs':{'query':util[_0x1ab0('0x19')](_0x1ab0('0x1b'),_0x2ec497)}})[_0x1ab0('0x1c')](function(_0x46d0ed){if(_0x46d0ed[_0x1ab0('0x1d')]){logger[_0x1ab0('0xa')](_0x1ab0('0x1e'));return _['find'](_0x46d0ed['results'],{'email':_0x2ec497,'role':_0x1ab0('0x1f')});}else{logger[_0x1ab0('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x1ab0('0x19')](_0x1ab0('0x20'),_0x55dc7e['remoteUri'])})['then'](function(_0x16e20b){logger[_0x1ab0('0xa')](_0x1ab0('0x21'));return _0x16e20b[_0x1ab0('0x22')];});}});}else{logger[_0x1ab0('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x1ab0('0x19')]('%s/users/me.json',_0x55dc7e[_0x1ab0('0xc')])})[_0x1ab0('0x1c')](function(_0x19409d){logger[_0x1ab0('0xa')](_0x1ab0('0x21'));return _0x19409d['user'];});}}function getEndUser(_0x2fc909,_0xdd859a,_0x18ea8f){logger[_0x1ab0('0xa')](_0x1ab0('0x23'),_0x18ea8f);return request({'uri':util['format'](_0x1ab0('0x1a'),_0x2fc909[_0x1ab0('0xc')]),'qs':{'query':util[_0x1ab0('0x19')](_0x1ab0('0x24'),_0x18ea8f)}})['then'](function(_0x42fe96){var _0x31c9db;if(_0x42fe96[_0x1ab0('0x25')][_0x1ab0('0x26')]){_0x42fe96[_0x1ab0('0x25')]=_['filter'](_0x42fe96[_0x1ab0('0x25')],{'suspended':![],'role':_0x1ab0('0x27')});if(_0x42fe96['results'][_0x1ab0('0x26')]){_0x31c9db=_[_0x1ab0('0x28')](_0x42fe96[_0x1ab0('0x25')]);}}if(_0x31c9db){logger[_0x1ab0('0xa')]('Enduser\x20found!');return _0x31c9db;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x1ab0('0x19')](_0x1ab0('0x29'),_0x2fc909[_0x1ab0('0xc')]),'method':_0x1ab0('0xd'),'body':{'user':{'role':_0x1ab0('0x27'),'name':util['format'](_0x1ab0('0x2a'),_0xdd859a||_0x18ea8f),'phone':_0x18ea8f}}})['then'](function(_0x53b3b0){logger['info'](_0x1ab0('0x2b'));return _0x53b3b0[_0x1ab0('0x22')];});}});}function getAuth(_0x362b19){var _0x519244;if(_0x362b19[_0x1ab0('0x2c')]===_0x1ab0('0x2d')){_0x519244=util[_0x1ab0('0x19')]('%s:%s',_0x362b19[_0x1ab0('0x2e')],_0x362b19[_0x1ab0('0x2d')]);}else if(_0x362b19['authType']===_0x1ab0('0x2f')){_0x519244=util[_0x1ab0('0x19')]('%s/token:%s',_0x362b19['username'],_0x362b19['token']);}return util[_0x1ab0('0x19')]('Basic\x20%s',new Buffer(_0x519244)['toString'](_0x1ab0('0x30')));}function request(_0xbc8409){logger['debug'](_0x1ab0('0x31'),JSON[_0x1ab0('0x32')](_0xbc8409));return rp(_[_0x1ab0('0x7')](_0xbc8409,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x1ffeb0,_0x5bf76e){var _0x300e5e=[];if(_0x1ffeb0&&_0x1ffeb0[_0x1ab0('0x26')]>0x0){_0x300e5e=_[_0x1ab0('0x33')](_0x1ffeb0,_0x5bf76e);}return _0x300e5e;}function getCustomFields(_0x24e276,_0xf560bf){var _0x2a0c93=[];var _0x31eacc={'custom_fields':[]};if(_0x24e276['length']>0x0){_['forEach'](_0x24e276,function(_0x230f24){if(_[_0x1ab0('0x34')]([_0x1ab0('0x35'),_0x1ab0('0x36')],_0x230f24[_0x1ab0('0x37')])&&_0x230f24['nameField']&&!_0x230f24[_0x1ab0('0x38')]){_0x31eacc[_0x230f24[_0x1ab0('0x39')]['toLowerCase']()]=_0x230f24[_0x1ab0('0x3a')][_0x1ab0('0x3b')]();}else if(_[_0x1ab0('0x34')]([_0x1ab0('0x35'),_0x1ab0('0x36')],_0x230f24[_0x1ab0('0x37')])&&_0x230f24[_0x1ab0('0x3c')]&&_0x230f24[_0x1ab0('0x38')]){_0x31eacc['custom_fields'][_0x1ab0('0x3d')]({'id':_0x230f24[_0x1ab0('0x3c')],'value':_0x230f24[_0x1ab0('0x3a')][_0x1ab0('0x3b')]()});}else if(_0x230f24[_0x1ab0('0x37')]===_0x1ab0('0x3e')&&_0x230f24[_0x1ab0('0x3f')]&&_0x230f24[_0x1ab0('0x3c')]&&_0x230f24[_0x1ab0('0x38')]){_0xf560bf[_0x230f24[_0x1ab0('0x3f')]]&&_0x31eacc[_0x1ab0('0x40')][_0x1ab0('0x3d')]({'id':_0x230f24[_0x1ab0('0x3c')],'value':_0xf560bf[_0x230f24['variableName']][_0x1ab0('0x3b')]()});}else if(_0x230f24['type']===_0x1ab0('0x41')&&_0x230f24[_0x1ab0('0x42')]&&_0x230f24['Variable'][_0x1ab0('0x10')]&&_0x230f24[_0x1ab0('0x3c')]&&_0x230f24[_0x1ab0('0x38')]){_0xf560bf[_0x230f24[_0x1ab0('0x42')][_0x1ab0('0x10')][_0x1ab0('0x43')]()]&&_0x31eacc[_0x1ab0('0x40')][_0x1ab0('0x3d')]({'id':_0x230f24[_0x1ab0('0x3c')],'value':_0xf560bf[_0x230f24[_0x1ab0('0x42')][_0x1ab0('0x10')][_0x1ab0('0x43')]()]['toString']()});}});}return _0x31eacc;}exports[_0x1ab0('0x44')]=function(_0x45e7a0,_0x2b336b,_0x3762ff,_0x57dd35,_0x32534,_0x48173b){var _0x17a6be,_0x3091a5;_0x48173b[_0x1ab0('0xc')]=intUtil[_0x1ab0('0x45')](_0x48173b[_0x1ab0('0xc')]);_0x48173b['serverUrl']=intUtil['stripTrailingSlash'](_0x48173b['serverUrl']);if(_0x32534&&_0x32534[_0x1ab0('0x46')]){logger[_0x1ab0('0xa')]('[QUEUE]',_0x1ab0('0x47'));_0x2b336b[_0x1ab0('0x48')]=util[_0x1ab0('0x19')](_0x1ab0('0x49'),_0x48173b[_0x1ab0('0x4a')],_0x2b336b[_0x1ab0('0x4b')],md5(_0x2b336b[_0x1ab0('0x4b')]));}else{_0x2b336b[_0x1ab0('0x48')]='';}headers['Authorization']=getAuth(_0x48173b);return getUser(_0x48173b,_0x57dd35[_0x1ab0('0x4c')])[_0x1ab0('0x1c')](function(_0x659adb){_0x17a6be=_0x659adb;logger[_0x1ab0('0xa')](_0x1ab0('0x4d'),_0x17a6be['id']);return getEndUser(_0x48173b,_0x2b336b[_0x1ab0('0x4e')],_0x2b336b[_0x1ab0('0x4f')]);})[_0x1ab0('0x1c')](function(_0x37d2c8){_0x3091a5=_0x37d2c8;logger['info']('The\x20Enduser\x20ID\x20is:',_0x3091a5['id']);return getTicket(_0x48173b,_0x17a6be,_0x3091a5,_0x3762ff,_0x2b336b);})[_0x1ab0('0x1c')](function(_0x478de0){if(_0x478de0){logger[_0x1ab0('0xa')](_0x1ab0('0x50'),_0x478de0['id']);switch(_0x48173b[_0x1ab0('0x37')]){case _0x1ab0('0x51'):logger['info'](_0x1ab0('0x52'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x1ab0('0x53'),_0x48173b['remoteUri'],_0x17a6be['id'],_0x478de0['id']),'method':_0x1ab0('0xd')});case _0x1ab0('0x54'):logger[_0x1ab0('0xa')](_0x1ab0('0x52'),_0x1ab0('0x55'));emit(util[_0x1ab0('0x19')]('user:%s',_0x57dd35[_0x1ab0('0x10')]),'trigger:browser:url',{'uri':util[_0x1ab0('0x19')]('%s/agent/tickets/%s',_0x48173b[_0x1ab0('0xc')][_0x1ab0('0x56')]('/api/v2',''),_0x478de0['id'])});break;default:logger[_0x1ab0('0x57')](_0x1ab0('0x52'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x447f74){logger[_0x1ab0('0x57')](_0x1ab0('0x58'),util[_0x1ab0('0x59')](_0x447f74,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x5de67f,_0x281b60,_0x47239d,_0x2399d3,_0x44745c,_0x49323b,_0x54afbf){var _0x535eb6,_0x577272;_0x49323b[_0x1ab0('0xc')]=intUtil['stripTrailingSlash'](_0x49323b[_0x1ab0('0xc')]);_0x49323b[_0x1ab0('0x4a')]=intUtil['stripTrailingSlash'](_0x49323b[_0x1ab0('0x4a')]);if(_0x54afbf&&_0x54afbf[_0x1ab0('0x5a')]&&_0x54afbf[_0x1ab0('0x5a')]!==_0x1ab0('0x5b')){logger[_0x1ab0('0xa')](_0x1ab0('0x5c'),_0x1ab0('0x47'));_0x281b60['recordingURL']=util['format'](_0x1ab0('0x49'),_0x49323b[_0x1ab0('0x4a')],_0x281b60['uniqueid'],md5(_0x281b60[_0x1ab0('0x4b')]));}headers[_0x1ab0('0x5d')]=getAuth(_0x49323b);return getUser(_0x49323b,_0x2399d3[_0x1ab0('0x4c')])[_0x1ab0('0x1c')](function(_0x292e6b){_0x535eb6=_0x292e6b;logger[_0x1ab0('0xa')]('The\x20User\x20ID\x20is:',_0x535eb6['id']);return getEndUser(_0x49323b,_0x281b60[_0x1ab0('0x5e')],_0x281b60['destcalleridnum']);})[_0x1ab0('0x1c')](function(_0x436a9b){_0x577272=_0x436a9b;logger[_0x1ab0('0xa')](_0x1ab0('0x5f'),_0x577272['id']);return getTicket(_0x49323b,_0x535eb6,_0x577272,_0x47239d,_0x281b60);})['then'](function(_0x1c25e9){if(_0x1c25e9){logger[_0x1ab0('0xa')]('The\x20Ticket\x20ID\x20is:',_0x1c25e9['id']);switch(_0x49323b['type']){case _0x1ab0('0x51'):logger['info'](_0x1ab0('0x5c'),_0x1ab0('0x60'));return request({'uri':util[_0x1ab0('0x19')](_0x1ab0('0x53'),_0x49323b[_0x1ab0('0xc')],_0x535eb6['id'],_0x1c25e9['id']),'method':_0x1ab0('0xd')});case _0x1ab0('0x54'):logger[_0x1ab0('0xa')](_0x1ab0('0x5c'),_0x1ab0('0x55'));emit(util['format'](_0x1ab0('0x61'),_0x2399d3[_0x1ab0('0x10')]),_0x1ab0('0x62'),{'uri':util[_0x1ab0('0x19')](_0x1ab0('0x63'),_0x49323b['remoteUri'][_0x1ab0('0x56')]('/api/v2',''),_0x1c25e9['id'])});break;default:logger[_0x1ab0('0x57')]('[OUTBOUND]',_0x1ab0('0x64'));}}})[_0x1ab0('0x65')](function(_0x46d420){logger[_0x1ab0('0x57')](_0x1ab0('0x66'),util[_0x1ab0('0x59')](_0x46d420,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x2dfdfa,_0x4be334,_0x2cd18b,_0x4b4e1d,_0x3c1656,_0x4ff042){var _0x31c87a,_0x57af8b;_0x4ff042[_0x1ab0('0xc')]=intUtil[_0x1ab0('0x45')](_0x4ff042[_0x1ab0('0xc')]);_0x4ff042[_0x1ab0('0x4a')]=intUtil[_0x1ab0('0x45')](_0x4ff042[_0x1ab0('0x4a')]);if(_0x3c1656&&_0x3c1656['monitor_format']){logger['info']('['+_0x4be334[_0x1ab0('0x67')][_0x1ab0('0x68')]()+']',_0x1ab0('0x47'));_0x4be334[_0x1ab0('0x48')]=util[_0x1ab0('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4ff042[_0x1ab0('0x4a')],_0x4be334[_0x1ab0('0x4b')],md5(_0x4be334[_0x1ab0('0x4b')]));}else{_0x4be334[_0x1ab0('0x48')]='';}headers[_0x1ab0('0x5d')]=getAuth(_0x4ff042);return getUser(_0x4ff042)[_0x1ab0('0x1c')](function(_0x1c2b05){_0x31c87a=_0x1c2b05;logger[_0x1ab0('0xa')](_0x1ab0('0x4d'),_0x31c87a['id']);return getEndUser(_0x4ff042,_0x4be334[_0x1ab0('0x4e')],_0x4be334['calleridnum']);})[_0x1ab0('0x1c')](function(_0xe2d2b2){_0x57af8b=_0xe2d2b2;logger[_0x1ab0('0xa')]('The\x20Enduser\x20ID\x20is:',_0x57af8b['id']);return getTicket(_0x4ff042,_0x31c87a,_0x57af8b,_0x2cd18b,_0x4be334);})[_0x1ab0('0x1c')](function(_0x36a6b6){if(_0x36a6b6){logger[_0x1ab0('0xa')](_0x1ab0('0x50'),_0x36a6b6['id']);}})[_0x1ab0('0x65')](function(_0x900ee6){logger[_0x1ab0('0x57')]('['+_0x4be334[_0x1ab0('0x67')][_0x1ab0('0x68')]()+']'+_0x1ab0('0x69'),util[_0x1ab0('0x59')](_0x900ee6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x12dc=['catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','toUpperCase','lastevent','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','application/json','format','%s/tickets.json','remoteUri','POST','getString','Descriptions','Fields','then','info','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','results','length','filter','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','authType','password','username','%s/token:%s','token','base64','stringify','GET','map','forEach','includes','string','type','nameField','customField','toLowerCase','picklist','custom_fields','push','content','toString','idField','variableName','customVariable','Variable','name','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x12dc,0xdb));var _0xc12d=function(_0x25d553,_0xc32640){_0x25d553=_0x25d553-0x0;var _0x2678bc=_0x12dc[_0x25d553];return _0x2678bc;};'use strict';var _=require(_0xc12d('0x0'));var rp=require(_0xc12d('0x1'));var md5=require(_0xc12d('0x2'));var util=require(_0xc12d('0x3'));var Redis=require(_0xc12d('0x4'));var intUtil=require(_0xc12d('0x5'));var config=require(_0xc12d('0x6'));var logger=require(_0xc12d('0x7'))('zendesk');config['redis']=_[_0xc12d('0x8')](config[_0xc12d('0x9')],{'host':_0xc12d('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc12d('0x9')]));function emit(_0x3f2b7f,_0x4537f2,_0x4339f4){io['to'](_0x3f2b7f)['emit'](_0x4537f2,_0x4339f4);}var headers={'Content-Type':'application/json','Accept':_0xc12d('0xb')};function getTicket(_0x20ff32,_0x348916,_0x150580,_0x336ac4,_0x1d76ed){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util[_0xc12d('0xc')](_0xc12d('0xd'),_0x20ff32[_0xc12d('0xe')]),'method':_0xc12d('0xf'),'body':{'ticket':_['merge']({'requester_id':_0x150580['id'],'submitter_id':_0x348916?_0x348916['id']:undefined,'assignee_id':_0x348916?_0x348916['id']:undefined,'tags':getTags(_0x336ac4['Tags'],'name'),'subject':intUtil[_0xc12d('0x10')](_0x336ac4['Subjects'],_0x1d76ed,'\x20'),'description':intUtil[_0xc12d('0x10')](_0x336ac4[_0xc12d('0x11')],_0x1d76ed,'\x0a'),'comment':{'public':![],'body':intUtil[_0xc12d('0x10')](_0x336ac4[_0xc12d('0x11')],_0x1d76ed,'\x0a')}},getCustomFields(_0x336ac4[_0xc12d('0x12')],_0x1d76ed))}})[_0xc12d('0x13')](function(_0x7de53){logger[_0xc12d('0x14')](_0xc12d('0x15'));return _0x7de53[_0xc12d('0x16')];});}function getUser(_0xf6dea3,_0x1671b3){if(intUtil['validateEmail'](_0x1671b3)){logger[_0xc12d('0x14')](_0xc12d('0x17'),_0x1671b3);return request({'uri':util[_0xc12d('0xc')](_0xc12d('0x18'),_0xf6dea3[_0xc12d('0xe')]),'qs':{'query':util[_0xc12d('0xc')](_0xc12d('0x19'),_0x1671b3)}})[_0xc12d('0x13')](function(_0x52b569){if(_0x52b569[_0xc12d('0x1a')]){logger['info'](_0xc12d('0x1b'));return _[_0xc12d('0x1c')](_0x52b569['results'],{'email':_0x1671b3,'role':_0xc12d('0x1d')});}else{logger[_0xc12d('0x14')](_0xc12d('0x1e'));return request({'uri':util[_0xc12d('0xc')](_0xc12d('0x1f'),_0xf6dea3[_0xc12d('0xe')])})['then'](function(_0x2b8733){logger[_0xc12d('0x14')](_0xc12d('0x20'));return _0x2b8733[_0xc12d('0x21')];});}});}else{logger['info'](_0xc12d('0x1e'));return request({'uri':util[_0xc12d('0xc')](_0xc12d('0x1f'),_0xf6dea3[_0xc12d('0xe')])})[_0xc12d('0x13')](function(_0x25694e){logger[_0xc12d('0x14')](_0xc12d('0x20'));return _0x25694e[_0xc12d('0x21')];});}}function getEndUser(_0x5dd7ef,_0x343102,_0x202818){logger[_0xc12d('0x14')](_0xc12d('0x22'),_0x202818);return request({'uri':util['format'](_0xc12d('0x18'),_0x5dd7ef[_0xc12d('0xe')]),'qs':{'query':util[_0xc12d('0xc')]('type:user\x20role:end-user\x20phone:%s',_0x202818)}})[_0xc12d('0x13')](function(_0x58d5df){var _0x1c6edc;if(_0x58d5df[_0xc12d('0x23')][_0xc12d('0x24')]){_0x58d5df['results']=_[_0xc12d('0x25')](_0x58d5df[_0xc12d('0x23')],{'suspended':![],'role':'end-user'});if(_0x58d5df['results']['length']){_0x1c6edc=_[_0xc12d('0x26')](_0x58d5df[_0xc12d('0x23')]);}}if(_0x1c6edc){logger[_0xc12d('0x14')]('Enduser\x20found!');return _0x1c6edc;}else{logger[_0xc12d('0x14')](_0xc12d('0x27'));return request({'uri':util[_0xc12d('0xc')](_0xc12d('0x28'),_0x5dd7ef[_0xc12d('0xe')]),'method':_0xc12d('0xf'),'body':{'user':{'role':_0xc12d('0x29'),'name':util['format'](_0xc12d('0x2a'),_0x343102||_0x202818),'phone':_0x202818}}})['then'](function(_0x2f25a2){logger[_0xc12d('0x14')]('Enduser\x20created.');return _0x2f25a2[_0xc12d('0x21')];});}});}function getAuth(_0x7c73c0){var _0x15d302;if(_0x7c73c0[_0xc12d('0x2b')]===_0xc12d('0x2c')){_0x15d302=util['format']('%s:%s',_0x7c73c0[_0xc12d('0x2d')],_0x7c73c0['password']);}else if(_0x7c73c0['authType']==='token'){_0x15d302=util[_0xc12d('0xc')](_0xc12d('0x2e'),_0x7c73c0[_0xc12d('0x2d')],_0x7c73c0[_0xc12d('0x2f')]);}return util[_0xc12d('0xc')]('Basic\x20%s',new Buffer(_0x15d302)['toString'](_0xc12d('0x30')));}function request(_0x47a520){logger['debug']('[HTTP]',JSON[_0xc12d('0x31')](_0x47a520));return rp(_['defaults'](_0x47a520,{'method':_0xc12d('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x523cfd,_0x27f462){var _0x107aeb=[];if(_0x523cfd&&_0x523cfd[_0xc12d('0x24')]>0x0){_0x107aeb=_[_0xc12d('0x33')](_0x523cfd,_0x27f462);}return _0x107aeb;}function getCustomFields(_0x22e26c,_0x19feb9){var _0x4c6308=[];var _0x1da37b={'custom_fields':[]};if(_0x22e26c[_0xc12d('0x24')]>0x0){_[_0xc12d('0x34')](_0x22e26c,function(_0x2ea061){if(_[_0xc12d('0x35')]([_0xc12d('0x36'),'picklist'],_0x2ea061[_0xc12d('0x37')])&&_0x2ea061[_0xc12d('0x38')]&&!_0x2ea061[_0xc12d('0x39')]){_0x1da37b[_0x2ea061['nameField'][_0xc12d('0x3a')]()]=_0x2ea061['content']['toString']();}else if(_['includes']([_0xc12d('0x36'),_0xc12d('0x3b')],_0x2ea061[_0xc12d('0x37')])&&_0x2ea061['idField']&&_0x2ea061[_0xc12d('0x39')]){_0x1da37b[_0xc12d('0x3c')][_0xc12d('0x3d')]({'id':_0x2ea061['idField'],'value':_0x2ea061[_0xc12d('0x3e')][_0xc12d('0x3f')]()});}else if(_0x2ea061['type']==='variable'&&_0x2ea061['variableName']&&_0x2ea061[_0xc12d('0x40')]&&_0x2ea061['customField']){_0x19feb9[_0x2ea061[_0xc12d('0x41')]]&&_0x1da37b['custom_fields']['push']({'id':_0x2ea061[_0xc12d('0x40')],'value':_0x19feb9[_0x2ea061['variableName']]['toString']()});}else if(_0x2ea061[_0xc12d('0x37')]===_0xc12d('0x42')&&_0x2ea061[_0xc12d('0x43')]&&_0x2ea061['Variable'][_0xc12d('0x44')]&&_0x2ea061['idField']&&_0x2ea061[_0xc12d('0x39')]){_0x19feb9[_0x2ea061[_0xc12d('0x43')][_0xc12d('0x44')][_0xc12d('0x3a')]()]&&_0x1da37b['custom_fields']['push']({'id':_0x2ea061['idField'],'value':_0x19feb9[_0x2ea061['Variable'][_0xc12d('0x44')][_0xc12d('0x3a')]()][_0xc12d('0x3f')]()});}});}return _0x1da37b;}exports['queue']=function(_0xa54e70,_0x4c54af,_0x5186fb,_0x71ce08,_0x33d814,_0x4563ea){var _0x479439,_0x4ee020;_0x4563ea['remoteUri']=intUtil[_0xc12d('0x45')](_0x4563ea[_0xc12d('0xe')]);_0x4563ea[_0xc12d('0x46')]=intUtil[_0xc12d('0x45')](_0x4563ea['serverUrl']);if(_0x33d814&&_0x33d814[_0xc12d('0x47')]){logger[_0xc12d('0x14')](_0xc12d('0x48'),_0xc12d('0x49'));_0x4c54af['recordingURL']=util[_0xc12d('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4563ea[_0xc12d('0x46')],_0x4c54af[_0xc12d('0x4a')],md5(_0x4c54af[_0xc12d('0x4a')]));}else{_0x4c54af[_0xc12d('0x4b')]='';}headers[_0xc12d('0x4c')]=getAuth(_0x4563ea);return getUser(_0x4563ea,_0x71ce08['email'])['then'](function(_0xf3a3f5){_0x479439=_0xf3a3f5;logger[_0xc12d('0x14')](_0xc12d('0x4d'),_0x479439['id']);return getEndUser(_0x4563ea,_0x4c54af[_0xc12d('0x4e')],_0x4c54af[_0xc12d('0x4f')]);})['then'](function(_0x57ddd9){_0x4ee020=_0x57ddd9;logger[_0xc12d('0x14')](_0xc12d('0x50'),_0x4ee020['id']);return getTicket(_0x4563ea,_0x479439,_0x4ee020,_0x5186fb,_0x4c54af);})['then'](function(_0xb708c7){if(_0xb708c7){logger['info'](_0xc12d('0x51'),_0xb708c7['id']);switch(_0x4563ea[_0xc12d('0x37')]){case _0xc12d('0x52'):logger[_0xc12d('0x14')](_0xc12d('0x48'),_0xc12d('0x53'));return request({'uri':util[_0xc12d('0xc')](_0xc12d('0x54'),_0x4563ea[_0xc12d('0xe')],_0x479439['id'],_0xb708c7['id']),'method':'POST'});case _0xc12d('0x55'):logger[_0xc12d('0x14')](_0xc12d('0x48'),_0xc12d('0x56'));emit(util[_0xc12d('0xc')](_0xc12d('0x57'),_0x71ce08[_0xc12d('0x44')]),_0xc12d('0x58'),{'uri':util[_0xc12d('0xc')](_0xc12d('0x59'),_0x4563ea[_0xc12d('0xe')]['replace'](_0xc12d('0x5a'),''),_0xb708c7['id'])});break;default:logger[_0xc12d('0x5b')]('[QUEUE]',_0xc12d('0x5c'));}}})[_0xc12d('0x5d')](function(_0xae73fe){logger['error'](_0xc12d('0x5e'),util[_0xc12d('0x5f')](_0xae73fe,{'showHidden':!![],'depth':null}));});};exports[_0xc12d('0x60')]=function(_0x487922,_0x185891,_0x5624ed,_0x3fef4d,_0x53d562,_0x27ae16,_0xd4ca4f){var _0x1c788d,_0x1f8d39;_0x27ae16[_0xc12d('0xe')]=intUtil[_0xc12d('0x45')](_0x27ae16[_0xc12d('0xe')]);_0x27ae16['serverUrl']=intUtil[_0xc12d('0x45')](_0x27ae16[_0xc12d('0x46')]);if(_0xd4ca4f&&_0xd4ca4f[_0xc12d('0x61')]&&_0xd4ca4f[_0xc12d('0x61')]!==_0xc12d('0x62')){logger[_0xc12d('0x14')](_0xc12d('0x63'),'Recording\x20is\x20enabled!');_0x185891['recordingURL']=util[_0xc12d('0xc')](_0xc12d('0x64'),_0x27ae16[_0xc12d('0x46')],_0x185891[_0xc12d('0x4a')],md5(_0x185891[_0xc12d('0x4a')]));}headers[_0xc12d('0x4c')]=getAuth(_0x27ae16);return getUser(_0x27ae16,_0x3fef4d['email'])[_0xc12d('0x13')](function(_0x4b0538){_0x1c788d=_0x4b0538;logger[_0xc12d('0x14')](_0xc12d('0x4d'),_0x1c788d['id']);return getEndUser(_0x27ae16,_0x185891['destcalleridname'],_0x185891['destcalleridnum']);})[_0xc12d('0x13')](function(_0x40ca81){_0x1f8d39=_0x40ca81;logger[_0xc12d('0x14')]('The\x20Enduser\x20ID\x20is:',_0x1f8d39['id']);return getTicket(_0x27ae16,_0x1c788d,_0x1f8d39,_0x5624ed,_0x185891);})[_0xc12d('0x13')](function(_0x44d492){if(_0x44d492){logger['info']('The\x20Ticket\x20ID\x20is:',_0x44d492['id']);switch(_0x27ae16[_0xc12d('0x37')]){case _0xc12d('0x52'):logger[_0xc12d('0x14')]('[OUTBOUND]',_0xc12d('0x53'));return request({'uri':util[_0xc12d('0xc')](_0xc12d('0x54'),_0x27ae16[_0xc12d('0xe')],_0x1c788d['id'],_0x44d492['id']),'method':_0xc12d('0xf')});case _0xc12d('0x55'):logger[_0xc12d('0x14')](_0xc12d('0x63'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc12d('0xc')](_0xc12d('0x57'),_0x3fef4d[_0xc12d('0x44')]),'trigger:browser:url',{'uri':util[_0xc12d('0xc')](_0xc12d('0x59'),_0x27ae16[_0xc12d('0xe')]['replace'](_0xc12d('0x5a'),''),_0x44d492['id'])});break;default:logger[_0xc12d('0x5b')](_0xc12d('0x63'),_0xc12d('0x5c'));}}})[_0xc12d('0x5d')](function(_0x2acf77){logger[_0xc12d('0x5b')](_0xc12d('0x65'),util[_0xc12d('0x5f')](_0x2acf77,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x1e7fd1,_0x1a1c64,_0x36a390,_0x43c687,_0x599f05,_0x19d992){var _0x4bff74,_0x504575;_0x19d992[_0xc12d('0xe')]=intUtil[_0xc12d('0x45')](_0x19d992[_0xc12d('0xe')]);_0x19d992['serverUrl']=intUtil[_0xc12d('0x45')](_0x19d992['serverUrl']);if(_0x599f05&&_0x599f05[_0xc12d('0x47')]){logger[_0xc12d('0x14')]('['+_0x1a1c64['lastevent'][_0xc12d('0x66')]()+']',_0xc12d('0x49'));_0x1a1c64[_0xc12d('0x4b')]=util[_0xc12d('0xc')](_0xc12d('0x64'),_0x19d992[_0xc12d('0x46')],_0x1a1c64[_0xc12d('0x4a')],md5(_0x1a1c64['uniqueid']));}else{_0x1a1c64[_0xc12d('0x4b')]='';}headers[_0xc12d('0x4c')]=getAuth(_0x19d992);return getUser(_0x19d992)[_0xc12d('0x13')](function(_0x24bd67){_0x4bff74=_0x24bd67;logger['info'](_0xc12d('0x4d'),_0x4bff74['id']);return getEndUser(_0x19d992,_0x1a1c64['calleridname'],_0x1a1c64[_0xc12d('0x4f')]);})['then'](function(_0x2d5b62){_0x504575=_0x2d5b62;logger[_0xc12d('0x14')](_0xc12d('0x50'),_0x504575['id']);return getTicket(_0x19d992,_0x4bff74,_0x504575,_0x36a390,_0x1a1c64);})['then'](function(_0x3cebcb){if(_0x3cebcb){logger[_0xc12d('0x14')](_0xc12d('0x51'),_0x3cebcb['id']);}})[_0xc12d('0x5d')](function(_0x4dbaf7){logger[_0xc12d('0x5b')]('['+_0x1a1c64[_0xc12d('0x67')]['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xc12d('0x5f')](_0x4dbaf7,{'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 9f65d65..95731c1 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 _0xb64e=['type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','isArrayLikeObject','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','then','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','last_name','data','SUCCESS','Error:\x20','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','contact','Contacts','nothing','lead','Leads','Creating\x20new\x20call...','administrator','first_name','Subject','getString','Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','mm:ss','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','lastevent','Call_Result','Called','complete','connect','Answered','rejected','abandoned','Abandoned','timeout','Timeout','agentcalledAt','Inbound','merge','/crm/v2/Calls','code','Call\x20created!','details','err','stack','log','queue','host','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','The\x20User\x20ID\x20is:','calleridnum','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','com','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','calleridname','toUpperCase','lodash','request-promise','util','./util','moment','ioredis','bluebird','zoho','redis','defaults','localhost','socket.io-emitter','[HTTP]','stringify','forEach','includes','picklist'];(function(_0x44714c,_0x2ac454){var _0x57d4d5=function(_0x5aca44){while(--_0x5aca44){_0x44714c['push'](_0x44714c['shift']());}};_0x57d4d5(++_0x2ac454);}(_0xb64e,0x89));var _0xeb64=function(_0x22cd32,_0x57feb5){_0x22cd32=_0x22cd32-0x0;var _0x48fa30=_0xb64e[_0x22cd32];return _0x48fa30;};'use strict';var _=require(_0xeb64('0x0'));var rp=require(_0xeb64('0x1'));var md5=require('md5');var util=require(_0xeb64('0x2'));var intUtil=require(_0xeb64('0x3'));var moment=require(_0xeb64('0x4'));var Redis=require(_0xeb64('0x5'));var BPromise=require(_0xeb64('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xeb64('0x7'));config[_0xeb64('0x8')]=_[_0xeb64('0x9')](config[_0xeb64('0x8')],{'host':_0xeb64('0xa'),'port':0x18eb});var io=require(_0xeb64('0xb'))(new Redis(config[_0xeb64('0x8')]));function emit(_0x303707,_0x5a2c1b,_0x15465c){io['to'](_0x303707)['emit'](_0x5a2c1b,_0x15465c);}function request(_0x33ecb7){logger['debug'](_0xeb64('0xc'),JSON[_0xeb64('0xd')](_0x33ecb7));return rp(_0x33ecb7);}function getCustomFields(_0x3e2001,_0x23930d){var _0x12c658={};if(_0x3e2001['length']>0x0){_[_0xeb64('0xe')](_0x3e2001,function(_0x1d7c53){if(_[_0xeb64('0xf')](['string',_0xeb64('0x10')],_0x1d7c53[_0xeb64('0x11')])&&_0x1d7c53[_0xeb64('0x12')]){_0x12c658[_0x1d7c53[_0xeb64('0x12')]]=_0x1d7c53[_0xeb64('0x13')][_0xeb64('0x14')]();}else if(_0x1d7c53[_0xeb64('0x11')]===_0xeb64('0x15')&&_0x1d7c53[_0xeb64('0x16')]&&_0x1d7c53[_0xeb64('0x12')]&&_0x23930d[_0x1d7c53[_0xeb64('0x16')]]){_0x12c658[_0x1d7c53[_0xeb64('0x12')]]=_0x23930d[_0x1d7c53[_0xeb64('0x16')]][_0xeb64('0x14')]();}else if(_0x1d7c53['type']==='customVariable'&&_0x1d7c53[_0xeb64('0x17')]&&_0x1d7c53[_0xeb64('0x17')][_0xeb64('0x18')]&&_0x1d7c53[_0xeb64('0x12')]&&_0x23930d[_0x1d7c53[_0xeb64('0x17')][_0xeb64('0x18')][_0xeb64('0x19')]()]){_0x12c658[_0x1d7c53[_0xeb64('0x12')]]=_0x23930d[_0x1d7c53[_0xeb64('0x17')][_0xeb64('0x18')][_0xeb64('0x19')]()][_0xeb64('0x14')]();}});}return _0x12c658;}function getName(_0xd05b9f){if(_0xd05b9f[_0xeb64('0x1a')]('\x20')>0x0){var _0x4efbef=_0xd05b9f[_0xeb64('0x1b')](/ (.+)/);if(_0x4efbef[0x1]){return _0x4efbef;}}return[_0xd05b9f,_0xd05b9f];}var accountsTokens={};function getAccessToken(_0x537417){return new Promise(function(_0x4f4aaa,_0xefa0f9){if(!_['isNil'](accountsTokens[_0x537417['id']])&&!_[_0xeb64('0x1c')](accountsTokens[_0x537417['id']][_0xeb64('0x1d')])){if(moment()[_0xeb64('0x1e')](accountsTokens[_0x537417['id']]['expires_in'])){_0x4f4aaa(accountsTokens[_0x537417['id']][_0xeb64('0x1d')]);}}var _0x598d81;switch(_0x537417[_0xeb64('0x1f')]){case'US':_0x598d81=_0xeb64('0x20');break;case'AU':_0x598d81='https://accounts.zoho.com.au';break;case'EU':_0x598d81=_0xeb64('0x21');break;case'IN':_0x598d81=_0xeb64('0x22');break;case'CN':_0x598d81=_0xeb64('0x23');break;default:_0x598d81=_0xeb64('0x21');break;}var _0x251884={'method':_0xeb64('0x24'),'uri':_0x598d81+_0xeb64('0x25'),'qs':{'refresh_token':_0x537417[_0xeb64('0x26')],'client_id':_0x537417[_0xeb64('0x27')],'client_secret':_0x537417[_0xeb64('0x28')],'grant_type':_0xeb64('0x29')},'json':!![]};return rp(_0x251884)['then'](function(_0x5433ff){accountsTokens[_0x537417['id']]={'access_token':_0x5433ff[_0xeb64('0x1d')],'expires_in':moment()['add'](_0x5433ff[_0xeb64('0x2a')],_0xeb64('0x2b'))};_0x4f4aaa(_0x5433ff[_0xeb64('0x1d')]);})[_0xeb64('0x2c')](function(_0x2f1643){logger[_0xeb64('0x2d')](_0xeb64('0x2e'),_0x2f1643['stack']);_0xefa0f9(_0x2f1643);});});}function getUser(_0x5906c6,_0x3da022,_0x5d3b45,_0x35ba3a){logger[_0xeb64('0x2f')](_0xeb64('0x30'));return request({'method':_0xeb64('0x31'),'uri':util[_0xeb64('0x32')](_0xeb64('0x33'),_0x3da022),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xeb64('0x34')+_0x5906c6},'json':!![]})['then'](function(_0x2a3c27){if(_0x2a3c27[_0xeb64('0x35')]){var _0x3720d7=-0x1;if(_[_0xeb64('0x36')](_0x2a3c27['users'])){if(!_['isNil'](_0x35ba3a)){_0x3720d7=_['findIndex'](_0x2a3c27['users'],function(_0x167d78){return _0x167d78[_0xeb64('0x37')]===_0x35ba3a;});}if(_0x3720d7>=0x0){logger[_0xeb64('0x2f')](_0xeb64('0x38'));}else{logger['info'](_0xeb64('0x39'));_0x3720d7=_[_0xeb64('0x3a')](_0x2a3c27[_0xeb64('0x35')],function(_0x72193e){return _0x72193e[_0xeb64('0x3b')]['name']===_0xeb64('0x3c');});}return _0x2a3c27[_0xeb64('0x35')][_0x3720d7];}else{if(_0x2a3c27[_0xeb64('0x3d')][_0xeb64('0x3b')]['name']==='Administrator'){logger[_0xeb64('0x2f')](_0xeb64('0x39'));user=_0x2a3c27[_0xeb64('0x3d')];return user;}else{logger[_0xeb64('0x2d')]('The\x20failing\x20result\x20is',JSON[_0xeb64('0xd')](_0x2a3c27));throw new Error(_0xeb64('0x3e')+JSON[_0xeb64('0xd')](_0x2a3c27));}}}else{logger[_0xeb64('0x2d')](_0xeb64('0x3f'),JSON[_0xeb64('0xd')](_0x2a3c27));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x2a3c27));}})[_0xeb64('0x2c')](function(_0x1d37e6){console[_0xeb64('0x2d')](_0x1d37e6);});}function getZohoUser(_0x14e5ee,_0x45f11b){return new BPromise(function(_0x2579cd,_0x4c2dc3){request(_0x14e5ee)[_0xeb64('0x40')](function(_0x4c9aae){var _0x4184b1=null;if(_0x4c9aae){_0x4184b1=_0x4c9aae['data'][0x0];_0x4184b1[_0xeb64('0x41')]=_0x45f11b;}_0x2579cd(_0x4184b1);})[_0xeb64('0x2c')](function(_0x16c028){_0x4c2dc3(_0x16c028);});});}function createEndUser(_0x1fef90,_0x491c21,_0xd60096,_0x182c0c,_0x397f6f,_0x3a0ec1){var _0xd60096=getName(_0xd60096);return request({'method':_0xeb64('0x24'),'uri':_0xeb64('0x42')+_0x491c21+_0xeb64('0x43')+_[_0xeb64('0x44')](_0x3a0ec1[_0xeb64('0x45')])+'s','body':{'data':[{'Last_Name':_0xd60096[0x1],'First_Name':_0xd60096[0x0],'Phone':_0x182c0c,'Owner':{'name':!_[_0xeb64('0x1c')](_0x397f6f[_0xeb64('0x46')][_0xeb64('0x18')])?_0x397f6f[_0xeb64('0x46')]['name']:!_['isNil'](_0x397f6f['first_name'])?_0x397f6f['first_name']+'\x20'+_0x397f6f[_0xeb64('0x47')]:_0x397f6f['last_name'],'id':_0x397f6f['id']}}]},'headers':{'Authorization':_0xeb64('0x34')+_0x1fef90},'json':!![]})['then'](function(_0x1fe06c){if(_0x1fe06c&&_0x1fe06c[_0xeb64('0x48')][0x0]['code']===_0xeb64('0x49')){var _0x5a14ef=_0x1fe06c[_0xeb64('0x48')][0x0]['details'];_0x5a14ef[_0xeb64('0x41')]=_[_0xeb64('0x44')](_0x3a0ec1[_0xeb64('0x45')])+'s';return _0x5a14ef;}logger['error']('The\x20failing\x20result\x20is',JSON[_0xeb64('0xd')](data));throw new Error(_0xeb64('0x4a')+JSON['stringify'](data));})['catch'](function(_0x1ab2eb){console['log']('CREATE\x20ERROR',_0x1ab2eb);});}function getEndUser(_0x4f8f6a,_0x5cd0c9,_0xa36d98,_0x5535be,_0x23bc6c,_0x5649d6,_0x2ae70c){var _0x1d7eb5={'method':_0xeb64('0x31'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4f8f6a},'json':!![]};switch(_0x2ae70c[_0xeb64('0x4b')]){case'contact_lead':_0x1d7eb5[_0xeb64('0x4c')]=_0xeb64('0x42')+_0x5cd0c9+_0xeb64('0x4d')+_0x23bc6c+'))';return getZohoUser(_0x1d7eb5,'Contacts')[_0xeb64('0x40')](function(_0x509192){if(_0x509192)return _0x509192;_0x1d7eb5['uri']=_0xeb64('0x42')+_0x5cd0c9+_0xeb64('0x4e')+_0x23bc6c+'))';return getZohoUser(_0x1d7eb5,'Leads')[_0xeb64('0x40')](function(_0x1be6e3){if(_0x1be6e3)return _0x1be6e3;if(_0x2ae70c[_0xeb64('0x45')]!='nothing'){return createEndUser(_0x4f8f6a,_0x5cd0c9,_0x5535be,_0x23bc6c,_0x5649d6,_0x2ae70c);}else{return{};}});});break;case _0xeb64('0x4f'):_0x1d7eb5['uri']=_0xeb64('0x42')+_0x5cd0c9+_0xeb64('0x4d')+_0x23bc6c+'))';return getZohoUser(_0x1d7eb5,_0xeb64('0x50'))[_0xeb64('0x40')](function(_0x35dc52){if(_0x35dc52)return _0x35dc52;if(_0x2ae70c[_0xeb64('0x45')]!=_0xeb64('0x51')){return createEndUser(_0x4f8f6a,_0x5cd0c9,_0x5535be,_0x23bc6c,_0x5649d6,_0x2ae70c);}else{return{};}});break;case _0xeb64('0x52'):_0x1d7eb5[_0xeb64('0x4c')]='https://www.zohoapis.'+_0x5cd0c9+_0xeb64('0x4e')+_0x23bc6c+'))';return getZohoUser(_0x1d7eb5,_0xeb64('0x53'))['then'](function(_0x4ed213){if(_0x4ed213)return _0x4ed213;if(_0x2ae70c[_0xeb64('0x45')]!='nothing'){return createEndUser(_0x4f8f6a,_0x5cd0c9,_0x5535be,_0x23bc6c,_0x5649d6,_0x2ae70c);}else{return{};}});break;}}function getCall(_0x3b25ff,_0x524b8a,_0x216bdd,_0x1187a0,_0x286b54,_0xb08cad,_0x3f59e4,_0x282c83){logger[_0xeb64('0x2f')](_0xeb64('0x54'));var _0x1fc37b={};_0x1fc37b['Owner']={'name':!_[_0xeb64('0x1c')](_0x1187a0[_0xeb64('0x46')]['name'])&&!_['isNil'](_0x1187a0[_0xeb64('0x3b')][_0xeb64('0x18')])&&_0x1187a0[_0xeb64('0x3b')][_0xeb64('0x18')]===_0xeb64('0x55')?_0x1187a0['role'][_0xeb64('0x18')]:!_['isNil'](_0x1187a0['first_name'])?_0x1187a0[_0xeb64('0x56')]+'\x20'+_0x1187a0[_0xeb64('0x47')]:_0x1187a0[_0xeb64('0x47')],'id':_0x1187a0['id']};_0x1fc37b[_0xeb64('0x57')]=intUtil[_0xeb64('0x58')](_0xb08cad[_0xeb64('0x59')],_0x3f59e4,'\x20');_0x1fc37b[_0xeb64('0x5a')]=intUtil[_0xeb64('0x58')](_0xb08cad[_0xeb64('0x5b')],_0x3f59e4,'\x0a');if(_0x286b54[_0xeb64('0x41')]==='Contacts'){_0x1fc37b['Who_Id']={'name':!_['isNil'](_0x286b54[_0xeb64('0x5c')])?_0x286b54[_0xeb64('0x5c')]:!_[_0xeb64('0x1c')](_0x286b54[_0xeb64('0x5d')])?_0x286b54[_0xeb64('0x5d')]+'\x20'+_0x286b54[_0xeb64('0x5e')]:_0x286b54[_0xeb64('0x5e')],'id':_0x286b54['id']};}if(_0x286b54[_0xeb64('0x41')]===_0xeb64('0x53')){_0x1fc37b[_0xeb64('0x5f')]={'name':!_['isNil'](_0x286b54[_0xeb64('0x5c')])?_0x286b54[_0xeb64('0x5c')]:!_['isNil'](_0x286b54[_0xeb64('0x5d')])?_0x286b54['First_Name']+'\x20'+_0x286b54[_0xeb64('0x5e')]:_0x286b54[_0xeb64('0x5e')],'id':_0x286b54['id']};_0x1fc37b['$se_module']=_[_0xeb64('0x44')](_0x286b54[_0xeb64('0x41')]);}if(_0x3f59e4[_0xeb64('0x60')]){_0x1fc37b[_0xeb64('0x61')]=moment['utc'](parseInt(_0x3f59e4[_0xeb64('0x60')])*0x3e8)[_0xeb64('0x32')](_0xeb64('0x62'));}else if(_0x3f59e4[_0xeb64('0x63')]&&_0x3f59e4[_0xeb64('0x64')]){_0x1fc37b[_0xeb64('0x61')]=moment[_0xeb64('0x65')](moment(_0x3f59e4['endtime'],_0xeb64('0x66'))['diff'](moment(_0x3f59e4['starttime'],_0xeb64('0x66'))))[_0xeb64('0x32')](_0xeb64('0x62'));}switch(_0x3f59e4[_0xeb64('0x67')]){case'called':_0x1fc37b[_0xeb64('0x68')]=_0xeb64('0x69');break;case _0xeb64('0x6a'):case _0xeb64('0x6b'):_0x1fc37b['Call_Result']=_0xeb64('0x6c');break;case _0xeb64('0x6d'):_0x1fc37b[_0xeb64('0x68')]='Rejected';break;case _0xeb64('0x6e'):_0x1fc37b[_0xeb64('0x68')]=_0xeb64('0x6f');break;case _0xeb64('0x70'):_0x1fc37b[_0xeb64('0x68')]=_0xeb64('0x71');default:}_0x1fc37b['Call_Start_Time']=(_0x282c83==='outbound'?moment(_0x3f59e4['starttime'])[_0xeb64('0x32')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x3f59e4[_0xeb64('0x72')])[_0xeb64('0x32')](_0xeb64('0x66')))||moment()['format']('YYYY-MM-DDTHH:mm:ss');_0x1fc37b['Call_Type']=_0x282c83||_0xeb64('0x73');_0x1fc37b=_[_0xeb64('0x74')](_0x1fc37b,getCustomFields(_0xb08cad['Fields'],_0x3f59e4));return request({'method':_0xeb64('0x24'),'uri':'https://www.zohoapis.'+_0x524b8a+_0xeb64('0x75'),'headers':{'Authorization':_0xeb64('0x34')+_0x3b25ff},'body':{'data':[_0x1fc37b]},'json':!![]})['then'](function(_0x5e96ba){if(_0x5e96ba&&_0x5e96ba[_0xeb64('0x48')][0x0][_0xeb64('0x76')]===_0xeb64('0x49')){logger[_0xeb64('0x2f')](_0xeb64('0x77'));return{'id':_0x5e96ba[_0xeb64('0x48')][0x0][_0xeb64('0x78')]['id']};}})['catch'](function(_0x696230){logger[_0xeb64('0x2f')](_0xeb64('0x79'),_0x696230[_0xeb64('0x7a')]);console[_0xeb64('0x7b')](_0xeb64('0x79'),_0x696230);});}exports[_0xeb64('0x7c')]=function(_0x280453,_0x509b86,_0x2313f1,_0x102a1b,_0x461202,_0x401813){var _0x1a52bb,_0x18c32d,_0x3bfb30;_0x401813[_0xeb64('0x7d')]=intUtil['stripTrailingSlash'](_0x401813[_0xeb64('0x7d')]);_0x401813[_0xeb64('0x7e')]=intUtil['stripTrailingSlash'](_0x401813['serverUrl']);if(_0x461202&&_0x461202[_0xeb64('0x7f')]){logger['info']('[QUEUE]',_0xeb64('0x80'));_0x509b86[_0xeb64('0x81')]=_0x401813['serverUrl']+_0xeb64('0x82')+_0x509b86[_0xeb64('0x83')]+_0xeb64('0x84')+md5(_0x509b86[_0xeb64('0x83')]);}else{_0x509b86[_0xeb64('0x81')]='';}var _0x4e3543=_0x401813[_0xeb64('0x7d')]===_0xeb64('0x85')?'eu':'com';return getAccessToken(_0x401813)[_0xeb64('0x40')](function(_0x1c1ec4){_0x3bfb30=_0x1c1ec4;return getUser(_0x3bfb30,_0x4e3543,_0x401813,_0x102a1b[_0xeb64('0x37')]);})[_0xeb64('0x40')](function(_0x3fe00a){_0x1a52bb=_0x3fe00a;logger['info'](_0xeb64('0x86'),_0x1a52bb['id']);return getEndUser(_0x3bfb30,_0x4e3543,_0x401813,_0x509b86['calleridname'],_0x509b86[_0xeb64('0x87')],_0x1a52bb,_0x2313f1);})[_0xeb64('0x40')](function(_0x16cef3){_0x18c32d=_0x16cef3;return getCall(_0x3bfb30,_0x4e3543,_0x401813,_0x1a52bb,_0x18c32d,_0x2313f1,_0x509b86,_0xeb64('0x73'));})['then'](function(_0x34d088){if(_0x34d088){logger[_0xeb64('0x2f')]('The\x20Call\x20ID\x20is:',_0x34d088['id']);logger['info'](_0xeb64('0x88'),_0xeb64('0x89'));emit(util['format'](_0xeb64('0x8a'),_0x102a1b[_0xeb64('0x18')]),_0xeb64('0x8b'),{'uri':_0xeb64('0x8c')+_0x401813['host']+_0xeb64('0x8d')+_0x34d088['id']});}})[_0xeb64('0x2c')](function(_0x15fc31){logger[_0xeb64('0x2d')]('[QUEUE]',JSON[_0xeb64('0xd')](_0x15fc31));});};exports[_0xeb64('0x8e')]=function(_0xc114bb,_0x5ec7ed,_0x2ca702,_0x38db78,_0xf6df1e,_0x5ea066,_0x25028f){var _0xdc9dda,_0x41fc9b,_0x4c0912;_0x5ea066[_0xeb64('0x7d')]=intUtil[_0xeb64('0x8f')](_0x5ea066[_0xeb64('0x7d')]);_0x5ea066[_0xeb64('0x7e')]=intUtil[_0xeb64('0x8f')](_0x5ea066[_0xeb64('0x7e')]);if(_0x25028f&&_0x25028f['recordingFormat']&&_0x25028f[_0xeb64('0x90')]!==_0xeb64('0x91')){logger[_0xeb64('0x2f')](_0xeb64('0x92'),_0xeb64('0x80'));_0x5ec7ed[_0xeb64('0x81')]=_0x5ea066[_0xeb64('0x7e')]+'/api/voice/recordings/'+_0x5ec7ed[_0xeb64('0x83')]+_0xeb64('0x84')+md5(_0x5ec7ed[_0xeb64('0x83')]);}var _0x38a381=_0x5ea066['host']===_0xeb64('0x85')?'eu':_0xeb64('0x93');return getAccessToken(_0x5ea066)['then'](function(_0x9f3a3a){_0x4c0912=_0x9f3a3a;return getUser(_0x4c0912,_0x38a381,_0x5ea066,_0x38db78[_0xeb64('0x37')]);})['then'](function(_0x51d145){_0xdc9dda=_0x51d145;logger[_0xeb64('0x2f')](_0xeb64('0x86'),_0xdc9dda['id']);return getEndUser(_0x4c0912,_0x38a381,_0x5ea066,_0x5ec7ed[_0xeb64('0x94')],_0x5ec7ed[_0xeb64('0x95')],_0xdc9dda,_0x2ca702);})['then'](function(_0x46b5f3){_0x41fc9b=_0x46b5f3;return getCall(_0x4c0912,_0x38a381,_0x5ea066,_0xdc9dda,_0x41fc9b,_0x2ca702,_0x5ec7ed,_0xeb64('0x96'));})[_0xeb64('0x40')](function(_0x2dbe9f){if(_0x2dbe9f){logger[_0xeb64('0x2f')](_0xeb64('0x97'),_0x2dbe9f['id']);logger[_0xeb64('0x2f')]('[OUTBOUND]',_0xeb64('0x89'));emit(util['format'](_0xeb64('0x8a'),_0x38db78[_0xeb64('0x18')]),'trigger:browser:url',{'uri':_0xeb64('0x8c')+_0x5ea066['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x2dbe9f['id']});}})[_0xeb64('0x2c')](function(_0x45f0be){logger['error'](_0xeb64('0x92'),JSON[_0xeb64('0xd')](_0x45f0be));});};exports['unmanaged']=function(_0x1d13c1,_0x11be44,_0x18733b,_0x30d573,_0x461539,_0x45109e){var _0xa007a4,_0x18d3c0,_0xfd6279;_0x45109e[_0xeb64('0x7d')]=intUtil[_0xeb64('0x8f')](_0x45109e[_0xeb64('0x7d')]);_0x45109e[_0xeb64('0x7e')]=intUtil['stripTrailingSlash'](_0x45109e['serverUrl']);if(_0x461539&&_0x461539['monitor_format']){logger[_0xeb64('0x2f')]('['+_0x11be44[_0xeb64('0x67')]['toUpperCase']()+']',_0xeb64('0x80'));_0x11be44[_0xeb64('0x81')]=_0x45109e[_0xeb64('0x7e')]+_0xeb64('0x82')+_0x11be44[_0xeb64('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x11be44[_0xeb64('0x83')]);}else{_0x11be44['recordingURL']='';}var _0x510ced=_0x45109e[_0xeb64('0x7d')]===_0xeb64('0x85')?'eu':_0xeb64('0x93');return getAccessToken(_0x45109e)[_0xeb64('0x40')](function(_0x502502){_0xfd6279=_0x502502;return getUser(_0xfd6279,_0x510ced,_0x45109e);})[_0xeb64('0x40')](function(_0x568dc6){_0xa007a4=_0x568dc6;logger[_0xeb64('0x2f')](_0xeb64('0x86'),_0xa007a4['id']);return getEndUser(_0xfd6279,_0x510ced,_0x45109e,_0x11be44[_0xeb64('0x98')],_0x11be44[_0xeb64('0x87')],_0xa007a4,_0x18733b);})[_0xeb64('0x40')](function(_0x2c1982){_0x18d3c0=_0x2c1982;return getCall(_0xfd6279,_0x510ced,_0x45109e,_0xa007a4,_0x18d3c0,_0x18733b,_0x11be44,'Inbound');})['then'](function(_0x5124ab){if(_0x5124ab){logger[_0xeb64('0x2f')](_0xeb64('0x97'),_0x5124ab['id']);}})[_0xeb64('0x2c')](function(_0x1a4927){logger[_0xeb64('0x2d')]('['+_0x11be44[_0xeb64('0x67')][_0xeb64('0x99')]()+']',JSON[_0xeb64('0xd')](_0x1a4927));});}; \ No newline at end of file +var _0xb6e6=['timeout','Timeout','Call_Start_Time','agentcalledAt','Inbound','merge','Fields','Call\x20created!','stack','log','err','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','host','com','The\x20User\x20ID\x20is:','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','zoho.eu','destcalleridname','Outbound','trigger:browser:url','calleridname','calleridnum','toUpperCase','lodash','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','picklist','type','idField','content','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','moduleCreate','first_name','last_name','code','SUCCESS','startCase','Error:\x20','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Creating\x20new\x20call...','Owner','role','profile','administrator','Subject','getString','Subjects','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Rejected'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0xb6e6,0xbf));var _0x6b6e=function(_0x512d0d,_0x31a958){_0x512d0d=_0x512d0d-0x0;var _0x2ef6ab=_0xb6e6[_0x512d0d];return _0x2ef6ab;};'use strict';var _=require(_0x6b6e('0x0'));var rp=require('request-promise');var md5=require(_0x6b6e('0x1'));var util=require(_0x6b6e('0x2'));var intUtil=require(_0x6b6e('0x3'));var moment=require(_0x6b6e('0x4'));var Redis=require(_0x6b6e('0x5'));var BPromise=require(_0x6b6e('0x6'));var config=require(_0x6b6e('0x7'));var logger=require(_0x6b6e('0x8'))(_0x6b6e('0x9'));config[_0x6b6e('0xa')]=_[_0x6b6e('0xb')](config[_0x6b6e('0xa')],{'host':_0x6b6e('0xc'),'port':0x18eb});var io=require(_0x6b6e('0xd'))(new Redis(config[_0x6b6e('0xa')]));function emit(_0x3ea5ca,_0x51b149,_0x1f64ce){io['to'](_0x3ea5ca)[_0x6b6e('0xe')](_0x51b149,_0x1f64ce);}function request(_0x3ea92d){logger[_0x6b6e('0xf')](_0x6b6e('0x10'),JSON[_0x6b6e('0x11')](_0x3ea92d));return rp(_0x3ea92d);}function getCustomFields(_0x7e6a52,_0x5672f0){var _0x4218b4={};if(_0x7e6a52[_0x6b6e('0x12')]>0x0){_['forEach'](_0x7e6a52,function(_0x4326f5){if(_['includes'](['string',_0x6b6e('0x13')],_0x4326f5[_0x6b6e('0x14')])&&_0x4326f5[_0x6b6e('0x15')]){_0x4218b4[_0x4326f5[_0x6b6e('0x15')]]=_0x4326f5[_0x6b6e('0x16')]['toString']();}else if(_0x4326f5[_0x6b6e('0x14')]==='variable'&&_0x4326f5[_0x6b6e('0x17')]&&_0x4326f5[_0x6b6e('0x15')]&&_0x5672f0[_0x4326f5[_0x6b6e('0x17')]]){_0x4218b4[_0x4326f5[_0x6b6e('0x15')]]=_0x5672f0[_0x4326f5[_0x6b6e('0x17')]][_0x6b6e('0x18')]();}else if(_0x4326f5['type']===_0x6b6e('0x19')&&_0x4326f5[_0x6b6e('0x1a')]&&_0x4326f5['Variable'][_0x6b6e('0x1b')]&&_0x4326f5[_0x6b6e('0x15')]&&_0x5672f0[_0x4326f5['Variable'][_0x6b6e('0x1b')][_0x6b6e('0x1c')]()]){_0x4218b4[_0x4326f5[_0x6b6e('0x15')]]=_0x5672f0[_0x4326f5[_0x6b6e('0x1a')][_0x6b6e('0x1b')]['toLowerCase']()][_0x6b6e('0x18')]();}});}return _0x4218b4;}function getName(_0x34c626){if(_0x34c626[_0x6b6e('0x1d')]('\x20')>0x0){var _0x9cf73a=_0x34c626[_0x6b6e('0x1e')](/ (.+)/);if(_0x9cf73a[0x1]){return _0x9cf73a;}}return[_0x34c626,_0x34c626];}var accountsTokens={};function getAccessToken(_0x5aedae){return new Promise(function(_0x35346d,_0x24ab56){if(!_['isNil'](accountsTokens[_0x5aedae['id']])&&!_[_0x6b6e('0x1f')](accountsTokens[_0x5aedae['id']][_0x6b6e('0x20')])){if(moment()['isBefore'](accountsTokens[_0x5aedae['id']][_0x6b6e('0x21')])){_0x35346d(accountsTokens[_0x5aedae['id']]['access_token']);}}var _0x37e5e3;switch(_0x5aedae[_0x6b6e('0x22')]){case'US':_0x37e5e3=_0x6b6e('0x23');break;case'AU':_0x37e5e3=_0x6b6e('0x24');break;case'EU':_0x37e5e3=_0x6b6e('0x25');break;case'IN':_0x37e5e3=_0x6b6e('0x26');break;case'CN':_0x37e5e3='https://accounts.zoho.com.cn';break;default:_0x37e5e3=_0x6b6e('0x25');break;}var _0x574313={'method':_0x6b6e('0x27'),'uri':_0x37e5e3+'/oauth/v2/token','qs':{'refresh_token':_0x5aedae[_0x6b6e('0x28')],'client_id':_0x5aedae[_0x6b6e('0x29')],'client_secret':_0x5aedae[_0x6b6e('0x2a')],'grant_type':_0x6b6e('0x2b')},'json':!![]};return rp(_0x574313)[_0x6b6e('0x2c')](function(_0x538ba2){accountsTokens[_0x5aedae['id']]={'access_token':_0x538ba2[_0x6b6e('0x20')],'expires_in':moment()[_0x6b6e('0x2d')](_0x538ba2[_0x6b6e('0x21')],_0x6b6e('0x2e'))};_0x35346d(_0x538ba2[_0x6b6e('0x20')]);})[_0x6b6e('0x2f')](function(_0x4ad20e){logger[_0x6b6e('0x30')](_0x6b6e('0x31'),_0x4ad20e['stack']);_0x24ab56(_0x4ad20e);});});}function getUser(_0x4fb390,_0x2d0b03,_0x57eeda,_0x5c9157){logger[_0x6b6e('0x32')](_0x6b6e('0x33'));return request({'method':_0x6b6e('0x34'),'uri':util[_0x6b6e('0x35')](_0x6b6e('0x36'),_0x2d0b03),'qs':{'type':_0x6b6e('0x37')},'headers':{'Authorization':_0x6b6e('0x38')+_0x4fb390},'json':!![]})['then'](function(_0x353b22){if(_0x353b22[_0x6b6e('0x39')]){var _0x43ac9e=-0x1;if(_[_0x6b6e('0x3a')](_0x353b22[_0x6b6e('0x39')])){if(!_[_0x6b6e('0x1f')](_0x5c9157)){_0x43ac9e=_[_0x6b6e('0x3b')](_0x353b22[_0x6b6e('0x39')],function(_0x49343a){return _0x49343a[_0x6b6e('0x3c')]===_0x5c9157;});}if(_0x43ac9e>=0x0){logger[_0x6b6e('0x32')](_0x6b6e('0x3d'));}else{logger[_0x6b6e('0x32')](_0x6b6e('0x3e'));_0x43ac9e=_['findIndex'](_0x353b22[_0x6b6e('0x39')],function(_0x3a8a1e){return _0x3a8a1e['profile']['name']==='Administrator';});}return _0x353b22[_0x6b6e('0x39')][_0x43ac9e];}else{if(_0x353b22[_0x6b6e('0x3f')]['profile'][_0x6b6e('0x1b')]==='Administrator'){logger['info']('Using\x20the\x20admin\x20account!');user=_0x353b22[_0x6b6e('0x3f')];return user;}else{logger['error'](_0x6b6e('0x40'),JSON['stringify'](_0x353b22));throw new Error(_0x6b6e('0x41')+JSON[_0x6b6e('0x11')](_0x353b22));}}}else{logger[_0x6b6e('0x30')](_0x6b6e('0x40'),JSON[_0x6b6e('0x11')](_0x353b22));throw new Error(_0x6b6e('0x41')+JSON[_0x6b6e('0x11')](_0x353b22));}})['catch'](function(_0x533eda){console['error'](_0x533eda);});}function getZohoUser(_0x3eed54,_0x23e1e4){return new BPromise(function(_0x547cb7,_0x23aff7){request(_0x3eed54)['then'](function(_0x5a722c){var _0xe58a6f=null;if(_0x5a722c){_0xe58a6f=_0x5a722c[_0x6b6e('0x42')][0x0];_0xe58a6f[_0x6b6e('0x43')]=_0x23e1e4;}_0x547cb7(_0xe58a6f);})[_0x6b6e('0x2f')](function(_0x29e49e){_0x23aff7(_0x29e49e);});});}function createEndUser(_0x175649,_0x581a55,_0x7d7c94,_0x4028d3,_0x5db89d,_0x5d276b){var _0x7d7c94=getName(_0x7d7c94);return request({'method':_0x6b6e('0x27'),'uri':_0x6b6e('0x44')+_0x581a55+'/crm/v2/'+_['startCase'](_0x5d276b[_0x6b6e('0x45')])+'s','body':{'data':[{'Last_Name':_0x7d7c94[0x1],'First_Name':_0x7d7c94[0x0],'Phone':_0x4028d3,'Owner':{'name':!_[_0x6b6e('0x1f')](_0x5db89d['role'][_0x6b6e('0x1b')])?_0x5db89d['role'][_0x6b6e('0x1b')]:!_['isNil'](_0x5db89d[_0x6b6e('0x46')])?_0x5db89d[_0x6b6e('0x46')]+'\x20'+_0x5db89d[_0x6b6e('0x47')]:_0x5db89d[_0x6b6e('0x47')],'id':_0x5db89d['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x175649},'json':!![]})[_0x6b6e('0x2c')](function(_0x174e1b){if(_0x174e1b&&_0x174e1b['data'][0x0][_0x6b6e('0x48')]===_0x6b6e('0x49')){var _0x42f6e1=_0x174e1b[_0x6b6e('0x42')][0x0]['details'];_0x42f6e1['enduserType']=_[_0x6b6e('0x4a')](_0x5d276b['moduleCreate'])+'s';return _0x42f6e1;}logger[_0x6b6e('0x30')]('The\x20failing\x20result\x20is',JSON[_0x6b6e('0x11')](data));throw new Error(_0x6b6e('0x4b')+JSON[_0x6b6e('0x11')](data));})['catch'](function(_0x4c53fa){console['log'](_0x6b6e('0x4c'),_0x4c53fa);});}function getEndUser(_0x5e2815,_0x21151a,_0x107ba9,_0x4f294f,_0x4ad10f,_0x576bf4,_0x2fb3a9){var _0xcd616={'method':_0x6b6e('0x34'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5e2815},'json':!![]};switch(_0x2fb3a9[_0x6b6e('0x4d')]){case _0x6b6e('0x4e'):_0xcd616[_0x6b6e('0x4f')]=_0x6b6e('0x44')+_0x21151a+_0x6b6e('0x50')+_0x4ad10f+'))';return getZohoUser(_0xcd616,_0x6b6e('0x51'))[_0x6b6e('0x2c')](function(_0x540940){if(_0x540940)return _0x540940;_0xcd616['uri']=_0x6b6e('0x44')+_0x21151a+_0x6b6e('0x52')+_0x4ad10f+'))';return getZohoUser(_0xcd616,_0x6b6e('0x53'))['then'](function(_0x5d92fe){if(_0x5d92fe)return _0x5d92fe;if(_0x2fb3a9[_0x6b6e('0x45')]!=_0x6b6e('0x54')){return createEndUser(_0x5e2815,_0x21151a,_0x4f294f,_0x4ad10f,_0x576bf4,_0x2fb3a9);}else{return{};}});});break;case _0x6b6e('0x55'):_0xcd616['uri']='https://www.zohoapis.'+_0x21151a+_0x6b6e('0x50')+_0x4ad10f+'))';return getZohoUser(_0xcd616,_0x6b6e('0x51'))[_0x6b6e('0x2c')](function(_0x392ce6){if(_0x392ce6)return _0x392ce6;if(_0x2fb3a9[_0x6b6e('0x45')]!='nothing'){return createEndUser(_0x5e2815,_0x21151a,_0x4f294f,_0x4ad10f,_0x576bf4,_0x2fb3a9);}else{return{};}});break;case'lead':_0xcd616[_0x6b6e('0x4f')]='https://www.zohoapis.'+_0x21151a+_0x6b6e('0x52')+_0x4ad10f+'))';return getZohoUser(_0xcd616,_0x6b6e('0x53'))['then'](function(_0x33dc10){if(_0x33dc10)return _0x33dc10;if(_0x2fb3a9[_0x6b6e('0x45')]!=_0x6b6e('0x54')){return createEndUser(_0x5e2815,_0x21151a,_0x4f294f,_0x4ad10f,_0x576bf4,_0x2fb3a9);}else{return{};}});break;}}function getCall(_0x15a6c1,_0x125d6b,_0x401a17,_0x1a8f1c,_0x3d3a1d,_0x832f1,_0x1b7fec,_0x37a783){logger[_0x6b6e('0x32')](_0x6b6e('0x56'));var _0x1f469e={};_0x1f469e[_0x6b6e('0x57')]={'name':!_[_0x6b6e('0x1f')](_0x1a8f1c[_0x6b6e('0x58')][_0x6b6e('0x1b')])&&!_[_0x6b6e('0x1f')](_0x1a8f1c['profile']['name'])&&_0x1a8f1c[_0x6b6e('0x59')][_0x6b6e('0x1b')]===_0x6b6e('0x5a')?_0x1a8f1c[_0x6b6e('0x58')][_0x6b6e('0x1b')]:!_[_0x6b6e('0x1f')](_0x1a8f1c[_0x6b6e('0x46')])?_0x1a8f1c['first_name']+'\x20'+_0x1a8f1c[_0x6b6e('0x47')]:_0x1a8f1c['last_name'],'id':_0x1a8f1c['id']};_0x1f469e[_0x6b6e('0x5b')]=intUtil[_0x6b6e('0x5c')](_0x832f1[_0x6b6e('0x5d')],_0x1b7fec,'\x20');_0x1f469e['Description']=intUtil[_0x6b6e('0x5c')](_0x832f1['Descriptions'],_0x1b7fec,'\x0a');if(_0x3d3a1d[_0x6b6e('0x43')]===_0x6b6e('0x51')){_0x1f469e['Who_Id']={'name':!_[_0x6b6e('0x1f')](_0x3d3a1d['Full_Name'])?_0x3d3a1d[_0x6b6e('0x5e')]:!_[_0x6b6e('0x1f')](_0x3d3a1d[_0x6b6e('0x5f')])?_0x3d3a1d[_0x6b6e('0x5f')]+'\x20'+_0x3d3a1d['Last_Name']:_0x3d3a1d[_0x6b6e('0x60')],'id':_0x3d3a1d['id']};}if(_0x3d3a1d[_0x6b6e('0x43')]==='Leads'){_0x1f469e[_0x6b6e('0x61')]={'name':!_['isNil'](_0x3d3a1d['Full_Name'])?_0x3d3a1d[_0x6b6e('0x5e')]:!_['isNil'](_0x3d3a1d['First_Name'])?_0x3d3a1d[_0x6b6e('0x5f')]+'\x20'+_0x3d3a1d[_0x6b6e('0x60')]:_0x3d3a1d[_0x6b6e('0x60')],'id':_0x3d3a1d['id']};_0x1f469e[_0x6b6e('0x62')]=_['startCase'](_0x3d3a1d['enduserType']);}if(_0x1b7fec['talktime']){_0x1f469e[_0x6b6e('0x63')]=moment[_0x6b6e('0x64')](parseInt(_0x1b7fec[_0x6b6e('0x65')])*0x3e8)[_0x6b6e('0x35')](_0x6b6e('0x66'));}else if(_0x1b7fec[_0x6b6e('0x67')]&&_0x1b7fec[_0x6b6e('0x68')]){_0x1f469e[_0x6b6e('0x63')]=moment[_0x6b6e('0x64')](moment(_0x1b7fec[_0x6b6e('0x68')],_0x6b6e('0x69'))[_0x6b6e('0x6a')](moment(_0x1b7fec[_0x6b6e('0x6b')],_0x6b6e('0x69'))))[_0x6b6e('0x35')](_0x6b6e('0x66'));}switch(_0x1b7fec[_0x6b6e('0x6c')]){case _0x6b6e('0x6d'):_0x1f469e[_0x6b6e('0x6e')]=_0x6b6e('0x6f');break;case _0x6b6e('0x70'):case _0x6b6e('0x71'):_0x1f469e[_0x6b6e('0x6e')]='Answered';break;case'rejected':_0x1f469e[_0x6b6e('0x6e')]=_0x6b6e('0x72');break;case'abandoned':_0x1f469e[_0x6b6e('0x6e')]='Abandoned';break;case _0x6b6e('0x73'):_0x1f469e[_0x6b6e('0x6e')]=_0x6b6e('0x74');default:}_0x1f469e[_0x6b6e('0x75')]=(_0x37a783==='outbound'?moment(_0x1b7fec[_0x6b6e('0x6b')])[_0x6b6e('0x35')](_0x6b6e('0x69')):moment(_0x1b7fec[_0x6b6e('0x76')])[_0x6b6e('0x35')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x6b6e('0x35')](_0x6b6e('0x69'));_0x1f469e['Call_Type']=_0x37a783||_0x6b6e('0x77');_0x1f469e=_[_0x6b6e('0x78')](_0x1f469e,getCustomFields(_0x832f1[_0x6b6e('0x79')],_0x1b7fec));return request({'method':_0x6b6e('0x27'),'uri':_0x6b6e('0x44')+_0x125d6b+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x15a6c1},'body':{'data':[_0x1f469e]},'json':!![]})[_0x6b6e('0x2c')](function(_0x165900){if(_0x165900&&_0x165900[_0x6b6e('0x42')][0x0]['code']===_0x6b6e('0x49')){logger[_0x6b6e('0x32')](_0x6b6e('0x7a'));return{'id':_0x165900['data'][0x0]['details']['id']};}})[_0x6b6e('0x2f')](function(_0x42fdaa){logger[_0x6b6e('0x32')]('err',_0x42fdaa[_0x6b6e('0x7b')]);console[_0x6b6e('0x7c')](_0x6b6e('0x7d'),_0x42fdaa);});}exports['queue']=function(_0x768d34,_0x2e8412,_0x5c0121,_0x1cb334,_0x5283b7,_0x2d0403){var _0x3af06d,_0x3ebcd9,_0x24c215;_0x2d0403['host']=intUtil[_0x6b6e('0x7e')](_0x2d0403['host']);_0x2d0403[_0x6b6e('0x7f')]=intUtil[_0x6b6e('0x7e')](_0x2d0403[_0x6b6e('0x7f')]);if(_0x5283b7&&_0x5283b7[_0x6b6e('0x80')]){logger[_0x6b6e('0x32')]('[QUEUE]',_0x6b6e('0x81'));_0x2e8412['recordingURL']=_0x2d0403[_0x6b6e('0x7f')]+_0x6b6e('0x82')+_0x2e8412[_0x6b6e('0x83')]+_0x6b6e('0x84')+md5(_0x2e8412[_0x6b6e('0x83')]);}else{_0x2e8412['recordingURL']='';}var _0x3c5a0a=_0x2d0403[_0x6b6e('0x85')]==='zoho.eu'?'eu':_0x6b6e('0x86');return getAccessToken(_0x2d0403)[_0x6b6e('0x2c')](function(_0xc0963){_0x24c215=_0xc0963;return getUser(_0x24c215,_0x3c5a0a,_0x2d0403,_0x1cb334['email']);})['then'](function(_0x25b9ca){_0x3af06d=_0x25b9ca;logger[_0x6b6e('0x32')](_0x6b6e('0x87'),_0x3af06d['id']);return getEndUser(_0x24c215,_0x3c5a0a,_0x2d0403,_0x2e8412['calleridname'],_0x2e8412['calleridnum'],_0x3af06d,_0x5c0121);})[_0x6b6e('0x2c')](function(_0x2817e7){_0x3ebcd9=_0x2817e7;return getCall(_0x24c215,_0x3c5a0a,_0x2d0403,_0x3af06d,_0x3ebcd9,_0x5c0121,_0x2e8412,_0x6b6e('0x77'));})[_0x6b6e('0x2c')](function(_0x4d9bcf){if(_0x4d9bcf){logger[_0x6b6e('0x32')](_0x6b6e('0x88'),_0x4d9bcf['id']);logger[_0x6b6e('0x32')](_0x6b6e('0x89'),_0x6b6e('0x8a'));emit(util[_0x6b6e('0x35')](_0x6b6e('0x8b'),_0x1cb334[_0x6b6e('0x1b')]),'trigger:browser:url',{'uri':'https://crm.'+_0x2d0403[_0x6b6e('0x85')]+_0x6b6e('0x8c')+_0x4d9bcf['id']});}})['catch'](function(_0x171ed6){logger['error']('[QUEUE]',JSON[_0x6b6e('0x11')](_0x171ed6));});};exports[_0x6b6e('0x8d')]=function(_0x568413,_0x203d7a,_0xaf75af,_0x27986b,_0x2d63dd,_0x2444fc,_0x1c301e){var _0x4c398d,_0x305be0,_0x22034a;_0x2444fc[_0x6b6e('0x85')]=intUtil['stripTrailingSlash'](_0x2444fc[_0x6b6e('0x85')]);_0x2444fc[_0x6b6e('0x7f')]=intUtil[_0x6b6e('0x7e')](_0x2444fc['serverUrl']);if(_0x1c301e&&_0x1c301e[_0x6b6e('0x8e')]&&_0x1c301e['recordingFormat']!==_0x6b6e('0x8f')){logger['info'](_0x6b6e('0x90'),_0x6b6e('0x81'));_0x203d7a[_0x6b6e('0x91')]=_0x2444fc['serverUrl']+'/api/voice/recordings/'+_0x203d7a[_0x6b6e('0x83')]+_0x6b6e('0x84')+md5(_0x203d7a[_0x6b6e('0x83')]);}var _0x197bfd=_0x2444fc[_0x6b6e('0x85')]===_0x6b6e('0x92')?'eu':_0x6b6e('0x86');return getAccessToken(_0x2444fc)[_0x6b6e('0x2c')](function(_0x331459){_0x22034a=_0x331459;return getUser(_0x22034a,_0x197bfd,_0x2444fc,_0x27986b[_0x6b6e('0x3c')]);})[_0x6b6e('0x2c')](function(_0x18d2bc){_0x4c398d=_0x18d2bc;logger[_0x6b6e('0x32')](_0x6b6e('0x87'),_0x4c398d['id']);return getEndUser(_0x22034a,_0x197bfd,_0x2444fc,_0x203d7a[_0x6b6e('0x93')],_0x203d7a['destcalleridnum'],_0x4c398d,_0xaf75af);})[_0x6b6e('0x2c')](function(_0x2ba170){_0x305be0=_0x2ba170;return getCall(_0x22034a,_0x197bfd,_0x2444fc,_0x4c398d,_0x305be0,_0xaf75af,_0x203d7a,_0x6b6e('0x94'));})[_0x6b6e('0x2c')](function(_0x19f0f1){if(_0x19f0f1){logger[_0x6b6e('0x32')](_0x6b6e('0x88'),_0x19f0f1['id']);logger[_0x6b6e('0x32')](_0x6b6e('0x90'),_0x6b6e('0x8a'));emit(util[_0x6b6e('0x35')](_0x6b6e('0x8b'),_0x27986b['name']),_0x6b6e('0x95'),{'uri':'https://crm.'+_0x2444fc[_0x6b6e('0x85')]+'/crm/EntityInfo.do?module=Calls&id='+_0x19f0f1['id']});}})[_0x6b6e('0x2f')](function(_0x449826){logger[_0x6b6e('0x30')](_0x6b6e('0x90'),JSON['stringify'](_0x449826));});};exports['unmanaged']=function(_0x2859b0,_0xb282fa,_0x11f108,_0x3c9eb3,_0x4d87ec,_0x239580){var _0x4a3231,_0x181e8e,_0x14e007;_0x239580[_0x6b6e('0x85')]=intUtil['stripTrailingSlash'](_0x239580[_0x6b6e('0x85')]);_0x239580[_0x6b6e('0x7f')]=intUtil[_0x6b6e('0x7e')](_0x239580[_0x6b6e('0x7f')]);if(_0x4d87ec&&_0x4d87ec[_0x6b6e('0x80')]){logger[_0x6b6e('0x32')]('['+_0xb282fa['lastevent']['toUpperCase']()+']',_0x6b6e('0x81'));_0xb282fa['recordingURL']=_0x239580[_0x6b6e('0x7f')]+'/api/voice/recordings/'+_0xb282fa[_0x6b6e('0x83')]+_0x6b6e('0x84')+md5(_0xb282fa['uniqueid']);}else{_0xb282fa[_0x6b6e('0x91')]='';}var _0x298183=_0x239580[_0x6b6e('0x85')]===_0x6b6e('0x92')?'eu':'com';return getAccessToken(_0x239580)[_0x6b6e('0x2c')](function(_0x520aa8){_0x14e007=_0x520aa8;return getUser(_0x14e007,_0x298183,_0x239580);})[_0x6b6e('0x2c')](function(_0x3a3de9){_0x4a3231=_0x3a3de9;logger[_0x6b6e('0x32')](_0x6b6e('0x87'),_0x4a3231['id']);return getEndUser(_0x14e007,_0x298183,_0x239580,_0xb282fa[_0x6b6e('0x96')],_0xb282fa[_0x6b6e('0x97')],_0x4a3231,_0x11f108);})['then'](function(_0x5618b3){_0x181e8e=_0x5618b3;return getCall(_0x14e007,_0x298183,_0x239580,_0x4a3231,_0x181e8e,_0x11f108,_0xb282fa,_0x6b6e('0x77'));})['then'](function(_0x177525){if(_0x177525){logger[_0x6b6e('0x32')](_0x6b6e('0x88'),_0x177525['id']);}})['catch'](function(_0x265e14){logger['error']('['+_0xb282fa[_0x6b6e('0x6c')][_0x6b6e('0x98')]()+']',JSON[_0x6b6e('0x11')](_0x265e14));});}; \ 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 ab267cf..3a986d2 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 _0x1bb7=['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','trigger','data2','Script','data3','render','exec'];(function(_0x6de67d,_0x4d3e54){var _0x4789e9=function(_0x249ac0){while(--_0x249ac0){_0x6de67d['push'](_0x6de67d['shift']());}};_0x4789e9(++_0x4d3e54);}(_0x1bb7,0x9f));var _0x71bb=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x1bb7[_0xbd08b4];return _0x314f1e;};'use strict';var util=require(_0x71bb('0x0'));var sh=require(_0x71bb('0x1'));var Mustache=require(_0x71bb('0x2'));var logger=require('../../../../config/logger')(_0x71bb('0x3'));exports['exec']=function(_0x4b44b8,_0x2cb2c4){var _0x52c711=_0x4b44b8[_0x71bb('0x4')]?_0x4b44b8['data2']:_0x71bb('0x5');var _0x2b1957=_0x4b44b8[_0x71bb('0x6')]?Mustache[_0x71bb('0x7')](_0x4b44b8[_0x71bb('0x6')],_0x2cb2c4):_0x2cb2c4;sh[_0x71bb('0x8')](_0x2b1957,function(_0x321f87,_0x52ae7b,_0x3f4939){if(_0x321f87!==0x0){logger[_0x71bb('0x9')](util[_0x71bb('0xa')](_0x71bb('0xb'),_0x52c711,_0x2b1957,_0x321f87,_0x3f4939));}else{logger[_0x71bb('0xc')](util['format'](_0x71bb('0xd'),_0x52c711,_0x2b1957,_0x52ae7b));}});}; \ No newline at end of file +var _0x8263=['mustache','../../../../config/logger','trigger','data2','Script','data3','exec','error','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s'];(function(_0x14a0a0,_0x45d0cf){var _0x56b651=function(_0x1fae09){while(--_0x1fae09){_0x14a0a0['push'](_0x14a0a0['shift']());}};_0x56b651(++_0x45d0cf);}(_0x8263,0x186));var _0x3826=function(_0x96423,_0x57bdcd){_0x96423=_0x96423-0x0;var _0x27f1cf=_0x8263[_0x96423];return _0x27f1cf;};'use strict';var util=require('util');var sh=require('shelljs');var Mustache=require(_0x3826('0x0'));var logger=require(_0x3826('0x1'))(_0x3826('0x2'));exports['exec']=function(_0x50672a,_0x7006f4){var _0x2c4b14=_0x50672a[_0x3826('0x3')]?_0x50672a[_0x3826('0x3')]:_0x3826('0x4');var _0x17ac62=_0x50672a[_0x3826('0x5')]?Mustache['render'](_0x50672a[_0x3826('0x5')],_0x7006f4):_0x7006f4;sh[_0x3826('0x6')](_0x17ac62,function(_0x4a9256,_0x2f0b20,_0x3389f1){if(_0x4a9256!==0x0){logger[_0x3826('0x7')](util[_0x3826('0x8')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x2c4b14,_0x17ac62,_0x4a9256,_0x3389f1));}else{logger['info'](util['format'](_0x3826('0x9'),_0x2c4b14,_0x17ac62,_0x2f0b20));}});}; \ 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 2ce78cb..d74c1ea 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 _0x3bab=['parse','stack','GET','POST','PUT','data7','body','error','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil',',\x20request\x20body:\x20','object','stringify','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','trigger','exec','data1','toUpperCase','render','data2','data5','number','headers','data6'];(function(_0x1daaa9,_0x220393){var _0x1dd221=function(_0x492c61){while(--_0x492c61){_0x1daaa9['push'](_0x1daaa9['shift']());}};_0x1dd221(++_0x220393);}(_0x3bab,0x1ea));var _0xb3ba=function(_0x33a905,_0x31e3ea){_0x33a905=_0x33a905-0x0;var _0x3564b7=_0x3bab[_0x33a905];return _0x3564b7;};'use strict';var rp=require(_0xb3ba('0x0'));var util=require(_0xb3ba('0x1'));var _=require(_0xb3ba('0x2'));var Mustache=require(_0xb3ba('0x3'));var logger=require('../../../../config/logger')(_0xb3ba('0x4'));exports[_0xb3ba('0x5')]=function(_0x28b721,_0xbc674f){var _0x3801f8,_0x2be62a;var _0x536cf7={'method':_0x28b721[_0xb3ba('0x6')][_0xb3ba('0x7')](),'uri':Mustache[_0xb3ba('0x8')](_0x28b721[_0xb3ba('0x9')],_0xbc674f),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x28b721[_0xb3ba('0xa')])===_0xb3ba('0xb')&&parseInt(_0x28b721[_0xb3ba('0xa')])>=0x1&&parseInt(_0x28b721[_0xb3ba('0xa')])<=0xa?parseInt(_0x28b721[_0xb3ba('0xa')])*0x3e8:0x5*0x3e8};try{_0x536cf7[_0xb3ba('0xc')]=_0x28b721[_0xb3ba('0xd')]?JSON[_0xb3ba('0xe')](Mustache[_0xb3ba('0x8')](_0x28b721['data6'],_0xbc674f)):{};}catch(_0x57b844){logger['error'](_0x57b844[_0xb3ba('0xf')]);}switch(_0x28b721[_0xb3ba('0x6')][_0xb3ba('0x7')]()){case _0xb3ba('0x10'):case'DELETE':_0x3801f8=null;_0x536cf7['qs']=_0xbc674f;break;case _0xb3ba('0x11'):case _0xb3ba('0x12'):if(_0x28b721[_0xb3ba('0x13')]){try{_0x3801f8=JSON[_0xb3ba('0xe')](Mustache[_0xb3ba('0x8')](_0x28b721[_0xb3ba('0x13')],_0xbc674f));_0x536cf7[_0xb3ba('0x14')]=_0x3801f8;}catch(_0x5b7515){logger[_0xb3ba('0x15')](_0x5b7515['stack']);logger[_0xb3ba('0x15')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x3801f8=_0xbc674f;_0x536cf7[_0xb3ba('0x14')]=_0x3801f8;}break;}logger['info'](util[_0xb3ba('0x16')](_0xb3ba('0x17'),_0x28b721[_0xb3ba('0x6')],_0x28b721[_0xb3ba('0x9')],JSON['stringify'](_0x536cf7)));rp(_0x536cf7)[_0xb3ba('0x18')](function(_0x199244){_0x3801f8=!_[_0xb3ba('0x19')](_0x3801f8)?_0xb3ba('0x1a')+_0x3801f8:'';_0x2be62a=typeof _0x199244[_0xb3ba('0x14')]===_0xb3ba('0x1b')?JSON[_0xb3ba('0x1c')](_0x199244['body']):_0x199244['body'];logger[_0xb3ba('0x1d')](util[_0xb3ba('0x16')](_0xb3ba('0x1e'),_0x28b721[_0xb3ba('0x6')],_0x28b721[_0xb3ba('0x9')],_0x199244[_0xb3ba('0x1f')],_0x2be62a));})[_0xb3ba('0x20')](function(_0x25c82d){logger['error'](util[_0xb3ba('0x16')](_0xb3ba('0x21'),_0x28b721['data1'],_0x28b721['data2'],_0x25c82d[_0xb3ba('0x1f')],_0x25c82d[_0xb3ba('0x22')],_0x25c82d[_0xb3ba('0x23')]));});}; \ No newline at end of file +var _0x731a=['catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','util','toUpperCase','render','data2','data5','headers','data6','parse','stack','data1','DELETE','POST','PUT','data7','body','error','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify',',\x20request\x20body:\x20','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode'];(function(_0x43a5d8,_0x2d77ff){var _0x567992=function(_0x34ebd0){while(--_0x34ebd0){_0x43a5d8['push'](_0x43a5d8['shift']());}};_0x567992(++_0x2d77ff);}(_0x731a,0x1b3));var _0xa731=function(_0x256ffb,_0x19f08f){_0x256ffb=_0x256ffb-0x0;var _0x3c9a19=_0x731a[_0x256ffb];return _0x3c9a19;};'use strict';var rp=require(_0xa731('0x0'));var util=require(_0xa731('0x1'));var _=require('lodash');var Mustache=require('mustache');var logger=require('../../../../config/logger')('trigger');exports['exec']=function(_0x224bee,_0x1eeb7a){var _0x32b950,_0x1d5ea8;var _0x2afbbb={'method':_0x224bee['data1'][_0xa731('0x2')](),'uri':Mustache[_0xa731('0x3')](_0x224bee[_0xa731('0x4')],_0x1eeb7a),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x224bee[_0xa731('0x5')])==='number'&&parseInt(_0x224bee[_0xa731('0x5')])>=0x1&&parseInt(_0x224bee[_0xa731('0x5')])<=0xa?parseInt(_0x224bee['data5'])*0x3e8:0x5*0x3e8};try{_0x2afbbb[_0xa731('0x6')]=_0x224bee[_0xa731('0x7')]?JSON[_0xa731('0x8')](Mustache[_0xa731('0x3')](_0x224bee[_0xa731('0x7')],_0x1eeb7a)):{};}catch(_0x352980){logger['error'](_0x352980[_0xa731('0x9')]);}switch(_0x224bee[_0xa731('0xa')]['toUpperCase']()){case'GET':case _0xa731('0xb'):_0x32b950=null;_0x2afbbb['qs']=_0x1eeb7a;break;case _0xa731('0xc'):case _0xa731('0xd'):if(_0x224bee[_0xa731('0xe')]){try{_0x32b950=JSON[_0xa731('0x8')](Mustache['render'](_0x224bee[_0xa731('0xe')],_0x1eeb7a));_0x2afbbb[_0xa731('0xf')]=_0x32b950;}catch(_0x2e480b){logger[_0xa731('0x10')](_0x2e480b[_0xa731('0x9')]);logger[_0xa731('0x10')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x32b950=_0x1eeb7a;_0x2afbbb[_0xa731('0xf')]=_0x32b950;}break;}logger['info'](util[_0xa731('0x11')](_0xa731('0x12'),_0x224bee[_0xa731('0xa')],_0x224bee[_0xa731('0x4')],JSON[_0xa731('0x13')](_0x2afbbb)));rp(_0x2afbbb)['then'](function(_0x510612){_0x32b950=!_['isNil'](_0x32b950)?_0xa731('0x14')+_0x32b950:'';_0x1d5ea8=typeof _0x510612['body']==='object'?JSON['stringify'](_0x510612[_0xa731('0xf')]):_0x510612['body'];logger[_0xa731('0x15')](util[_0xa731('0x11')](_0xa731('0x16'),_0x224bee[_0xa731('0xa')],_0x224bee['data2'],_0x510612[_0xa731('0x17')],_0x1d5ea8));})[_0xa731('0x18')](function(_0x55543d){logger[_0xa731('0x10')](util[_0xa731('0x11')](_0xa731('0x19'),_0x224bee['data1'],_0x224bee[_0xa731('0x4')],_0x55543d[_0xa731('0x17')],_0x55543d['name'],_0x55543d[_0xa731('0x1a')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index ebb7a1c..a5fb8b2 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 _0xc950=['result','catch','exports','jayson/promise','bluebird','http','Request','request','then','debug','rpc','routing','error','message'];(function(_0x1fe8b9,_0xd87696){var _0x25d006=function(_0x35727f){while(--_0x35727f){_0x1fe8b9['push'](_0x1fe8b9['shift']());}};_0x25d006(++_0xd87696);}(_0xc950,0x8f));var _0x0c95=function(_0x2c5d31,_0x1bb0e4){_0x2c5d31=_0x2c5d31-0x0;var _0x4a0270=_0xc950[_0x2c5d31];return _0x4a0270;};'use strict';var jayson=require(_0x0c95('0x0'));var BPromise=require(_0x0c95('0x1'));var logger=require('../../config/logger')('routing');var client=jayson['client'][_0x0c95('0x2')]({'port':0x2329});client[_0x0c95('0x3')]=function(_0x5628ee,_0x272184){return new BPromise(function(_0x2bccf1,_0x5940a1){return client[_0x0c95('0x4')](_0x5628ee,_0x272184)[_0x0c95('0x5')](function(_0x1fe903){logger[_0x0c95('0x6')](_0x0c95('0x7'),_0x0c95('0x8'),_0x5628ee,_0x272184,_0x1fe903);if(_0x1fe903[_0x0c95('0x9')]){logger[_0x0c95('0x9')](_0x0c95('0x7'),_0x0c95('0x8'),_0x5628ee,_0x1fe903[_0x0c95('0x9')][_0x0c95('0xa')],_0x272184);return _0x5940a1(_0x1fe903['error']['message']);}else{return _0x2bccf1(_0x1fe903[_0x0c95('0xb')]);}})[_0x0c95('0xc')](function(_0x17de13){logger['error']('rpc',_0x0c95('0x8'),_0x5628ee,_0x17de13,_0x272184);return _0x5940a1(_0x17de13);});});};module[_0x0c95('0xd')]=client; \ No newline at end of file +var _0xee90=['then','debug','rpc','error','message','result','catch','exports','bluebird','../../config/logger','routing','client','http','Request','request'];(function(_0x3697ab,_0x16b669){var _0x32dd4c=function(_0x1ec222){while(--_0x1ec222){_0x3697ab['push'](_0x3697ab['shift']());}};_0x32dd4c(++_0x16b669);}(_0xee90,0x1d9));var _0x0ee9=function(_0x144db7,_0x592719){_0x144db7=_0x144db7-0x0;var _0x3efe6a=_0xee90[_0x144db7];return _0x3efe6a;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x0ee9('0x0'));var logger=require(_0x0ee9('0x1'))(_0x0ee9('0x2'));var client=jayson[_0x0ee9('0x3')][_0x0ee9('0x4')]({'port':0x2329});client[_0x0ee9('0x5')]=function(_0x5ee098,_0x217520){return new BPromise(function(_0x54f8f9,_0x1d792f){return client[_0x0ee9('0x6')](_0x5ee098,_0x217520)[_0x0ee9('0x7')](function(_0x1a4029){logger[_0x0ee9('0x8')](_0x0ee9('0x9'),_0x0ee9('0x2'),_0x5ee098,_0x217520,_0x1a4029);if(_0x1a4029[_0x0ee9('0xa')]){logger[_0x0ee9('0xa')]('rpc','routing',_0x5ee098,_0x1a4029[_0x0ee9('0xa')][_0x0ee9('0xb')],_0x217520);return _0x1d792f(_0x1a4029[_0x0ee9('0xa')][_0x0ee9('0xb')]);}else{return _0x54f8f9(_0x1a4029[_0x0ee9('0xc')]);}})[_0x0ee9('0xd')](function(_0x5a8006){logger[_0x0ee9('0xa')](_0x0ee9('0x9'),_0x0ee9('0x2'),_0x5ee098,_0x5a8006,_0x217520);return _0x1d792f(_0x5a8006);});});};module[_0x0ee9('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index f0f462d..c64c9e4 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 _0xe1a1=['error','Email\x20service\x20initialization','./server','./realtime','./rpc/mailAccount','./rpc/setting','../../config/logger','resolve','getMailAccounts','then','initMailAccounts','mailAccounts','listen','getSettings'];(function(_0xdc05be,_0x4b38e0){var _0x2e9bde=function(_0x2edba8){while(--_0x2edba8){_0xdc05be['push'](_0xdc05be['shift']());}};_0x2e9bde(++_0x4b38e0);}(_0xe1a1,0x1d0));var _0x1e1a=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xe1a1[_0x4c12ec];return _0x3ae42c;};'use strict';var server=require(_0x1e1a('0x0'));var Realtime=require(_0x1e1a('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x1e1a('0x2'));var setting=require(_0x1e1a('0x3'));var logger=require(_0x1e1a('0x4'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x1e1a('0x5')]()['then'](mailAccount[_0x1e1a('0x6')]())[_0x1e1a('0x7')](realtime[_0x1e1a('0x8')]())['then'](function(){email['refresh'](realtime[_0x1e1a('0x9')]);return realtime;});}function main(){return server[_0x1e1a('0xa')](realtime,email)[_0x1e1a('0x7')](function(){return initRealtime();})[_0x1e1a('0x7')](function(){return setting[_0x1e1a('0xb')]();})['then'](function(_0x4faa33){return setInterval(initRealtime,_0x4faa33['loginMailFrequency']*0x3e8);})['catch'](function(_0x1e58e5){logger[_0x1e1a('0xc')](_0x1e1a('0xd'),_0x1e58e5);});}main(); \ No newline at end of file +var _0xc6d3=['./server','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','resolve','then','getMailAccounts','initMailAccounts','mailAccounts','listen','getSettings','loginMailFrequency','catch','error'];(function(_0x51beba,_0x202d19){var _0x167ee0=function(_0x2d5b21){while(--_0x2d5b21){_0x51beba['push'](_0x51beba['shift']());}};_0x167ee0(++_0x202d19);}(_0xc6d3,0x168));var _0x3c6d=function(_0x1c36e2,_0x2b8c1d){_0x1c36e2=_0x1c36e2-0x0;var _0x1876a8=_0xc6d3[_0x1c36e2];return _0x1876a8;};'use strict';var server=require(_0x3c6d('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x3c6d('0x1'));var mailAccount=require(_0x3c6d('0x2'));var setting=require(_0x3c6d('0x3'));var logger=require(_0x3c6d('0x4'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x3c6d('0x5')]()[_0x3c6d('0x6')](mailAccount[_0x3c6d('0x7')]())[_0x3c6d('0x6')](realtime[_0x3c6d('0x8')]())[_0x3c6d('0x6')](function(){email['refresh'](realtime[_0x3c6d('0x9')]);return realtime;});}function main(){return server[_0x3c6d('0xa')](realtime,email)[_0x3c6d('0x6')](function(){return initRealtime();})[_0x3c6d('0x6')](function(){return setting[_0x3c6d('0xb')]();})[_0x3c6d('0x6')](function(_0x54e84e){return setInterval(initRealtime,_0x54e84e[_0x3c6d('0xc')]*0x3e8);})[_0x3c6d('0xd')](function(_0x31cf54){logger[_0x3c6d('0xe')]('Email\x20service\x20initialization',_0x31cf54);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 518effb..826f945 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 _0x9f85=['isNil','stringify','refresh','service','provider','box','handleImapEmail','bind','end','handleImapEnd','error','handleImapError','disabled','messageStatus','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','catch','sendMail','send','verifySmtp','Smtp','verify','verified','lodash','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','Imap','status','total'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x9f85,0xf5));var _0x59f8=function(_0x4f7c4d,_0x383cb0){_0x4f7c4d=_0x4f7c4d-0x0;var _0x3b5eea=_0x9f85[_0x4f7c4d];return _0x3b5eea;};'use strict';var _=require(_0x59f8('0x0'));var moment=require('moment');var BPromise=require(_0x59f8('0x1'));var md5=require(_0x59f8('0x2'));var Redis=require(_0x59f8('0x3'));var config=require(_0x59f8('0x4'));var logger=require(_0x59f8('0x5'))(_0x59f8('0x6'));config[_0x59f8('0x7')]=_[_0x59f8('0x8')](config[_0x59f8('0x7')],{'host':_0x59f8('0x9'),'port':0x18eb});var io=require(_0x59f8('0xa'))(new Redis(config[_0x59f8('0x7')]));var EmailImap=require(_0x59f8('0xb'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x59f8('0xc'));var md5Accounts={};function EmailChannel(_0x174672){logger[_0x59f8('0xd')](_0x59f8('0xe'));this[_0x59f8('0xf')]=_0x174672[_0x59f8('0xf')];this[_0x59f8('0x10')]={};this[_0x59f8('0x11')]=new EmailSmtp();}EmailChannel[_0x59f8('0x12')][_0x59f8('0x13')]=function(_0xab64e0){var _0x1f584c=this['mailAccounts'][_0xab64e0];var _0x13130d={'id':_0x1f584c['id'],'name':_0x1f584c[_0x59f8('0x14')],'key':_0x1f584c[_0x59f8('0x15')],'active':_0x1f584c['active'],'Imap':{'status':_0x1f584c[_0x59f8('0x16')][_0x59f8('0x17')],'messageStatus':_0x1f584c[_0x59f8('0x16')]['messageStatus'],'total':_0x1f584c['Imap'][_0x59f8('0x18')]}};if(_[_0x59f8('0x19')](md5Accounts[_0xab64e0])){md5Accounts[_0xab64e0]={};}var _0xfe5525=md5(JSON[_0x59f8('0x1a')](_0x13130d));if(md5Accounts[_0xab64e0][_0x59f8('0x2')]!==_0xfe5525){md5Accounts[_0xab64e0][_0x59f8('0x2')]=_0xfe5525;io['emit']('mailAccount:update',_0x13130d);}};EmailChannel['prototype'][_0x59f8('0x1b')]=function(_0x571627){for(var _0x44b3c4 in _0x571627){if(_0x571627['hasOwnProperty'](_0x44b3c4)){if(_0x571627[_0x44b3c4]['Imap']&&_0x571627[_0x44b3c4]['active']){var _0x76874f=_0x571627[_0x44b3c4][_0x59f8('0x16')];if(!_0x76874f[_0x59f8('0x1c')])_0x76874f['service']=_0x571627[_0x44b3c4][_0x59f8('0x1d')];if(!this['imapAccounts']['hasOwnProperty'](_0x76874f['id'])){this[_0x59f8('0x10')][_0x76874f['id']]=new EmailImap(_0x76874f,_0x571627[_0x44b3c4][_0x59f8('0x6')]);this[_0x59f8('0x10')][_0x76874f['id']]['on'](_0x59f8('0x1e'),this['handleImapBox']['bind'](this,_0x44b3c4));this[_0x59f8('0x10')][_0x76874f['id']]['on'](_0x59f8('0x6'),this[_0x59f8('0x1f')][_0x59f8('0x20')](this,_0x44b3c4));this[_0x59f8('0x10')][_0x76874f['id']]['on'](_0x59f8('0x21'),this[_0x59f8('0x22')][_0x59f8('0x20')](this,_0x44b3c4));this[_0x59f8('0x10')][_0x76874f['id']]['on'](_0x59f8('0x23'),this[_0x59f8('0x24')][_0x59f8('0x20')](this,_0x44b3c4));}}else{if(_[_0x59f8('0x19')](this[_0x59f8('0xf')][_0x44b3c4]['Imap'])){this[_0x59f8('0xf')][_0x44b3c4]['Imap']={};}this[_0x59f8('0xf')][_0x44b3c4][_0x59f8('0x16')]['status']=_0x59f8('0x25');this[_0x59f8('0xf')][_0x44b3c4][_0x59f8('0x16')][_0x59f8('0x26')]='';this[_0x59f8('0x13')](_0x44b3c4);}}}};EmailChannel['prototype'][_0x59f8('0x27')]=function(_0x9f28f0,_0x4e3a96){if(this['mailAccounts'][_0x9f28f0]){this[_0x59f8('0xf')][_0x9f28f0][_0x59f8('0x16')][_0x59f8('0x17')]=_0x59f8('0x28');this[_0x59f8('0xf')][_0x9f28f0][_0x59f8('0x16')][_0x59f8('0x26')]=_0x4e3a96[_0x59f8('0x14')];if(_0x4e3a96[_0x59f8('0x29')]){this['mailAccounts'][_0x9f28f0][_0x59f8('0x16')][_0x59f8('0x18')]=_0x4e3a96[_0x59f8('0x29')][_0x59f8('0x18')];}return this[_0x59f8('0x13')](_0x9f28f0);}};EmailChannel['prototype'][_0x59f8('0x1f')]=function(_0xaa5532,_0x551bbb){logger[_0x59f8('0xd')](_0x59f8('0x2a'),_0x551bbb[_0x59f8('0x2b')],_0x551bbb[_0x59f8('0x2c')],_0x551bbb[_0x59f8('0x2d')],_0xaa5532);if(this[_0x59f8('0xf')][_0xaa5532]){return mailAccount[_0x59f8('0x2e')](_0xaa5532,_0x551bbb)['then'](function(_0xa3deb0){if(_0xa3deb0){logger['info']('Mail\x20accepted\x20from\x20routing');}})[_0x59f8('0x2f')](function(_0x4a16d7){logger['error']('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x59f8('0x1a')](_0x4a16d7));});}};EmailChannel[_0x59f8('0x12')][_0x59f8('0x22')]=function(_0x26951d){if(this[_0x59f8('0xf')][_0x26951d]&&this['mailAccounts'][_0x26951d][_0x59f8('0x16')]){if(this[_0x59f8('0x10')][this['mailAccounts'][_0x26951d]['Imap']['id']]){delete this[_0x59f8('0x10')][this['mailAccounts'][_0x26951d][_0x59f8('0x16')]['id']];}this[_0x59f8('0xf')][_0x26951d][_0x59f8('0x16')]['lastSync']=moment();this[_0x59f8('0x13')](_0x26951d);}};EmailChannel[_0x59f8('0x12')][_0x59f8('0x24')]=function(_0x563690,_0x3baec1){if(this[_0x59f8('0xf')][_0x563690]){this['mailAccounts'][_0x563690][_0x59f8('0x16')][_0x59f8('0x17')]=_0x59f8('0x23');this['mailAccounts'][_0x563690][_0x59f8('0x16')][_0x59f8('0x26')]=_0x3baec1;return this['emit'](_0x563690);}};EmailChannel[_0x59f8('0x12')][_0x59f8('0x30')]=function(_0x4cd087,_0x1f0b25){return this[_0x59f8('0x11')][_0x59f8('0x31')](_0x4cd087,_0x1f0b25);};EmailChannel['prototype'][_0x59f8('0x32')]=function(_0x2a7953){var _0x412009=this;if(this[_0x59f8('0xf')][_0x2a7953['id']]){if(_[_0x59f8('0x19')](this[_0x59f8('0xf')][_0x2a7953['id']]['Smtp'])){this['mailAccounts'][_0x2a7953['id']][_0x59f8('0x33')]={};}this[_0x59f8('0xf')][_0x2a7953['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x5b87d6,_0xbaf485){return _0x412009['smtp'][_0x59f8('0x34')](_0x2a7953)['then'](function(_0x26206a){_0x412009[_0x59f8('0xf')][_0x2a7953['id']][_0x59f8('0x33')][_0x59f8('0x17')]=_0x59f8('0x35');_0x412009['mailAccounts'][_0x2a7953['id']][_0x59f8('0x33')]['messageStatus']='';_0x412009[_0x59f8('0x13')](_0x2a7953['id']);_0x5b87d6(_0x26206a);})[_0x59f8('0x2f')](function(_0x110760){_0x412009['mailAccounts'][_0x2a7953['id']][_0x59f8('0x33')][_0x59f8('0x17')]=_0x59f8('0x23');_0x412009[_0x59f8('0xf')][_0x2a7953['id']][_0x59f8('0x33')][_0x59f8('0x26')]=_0x110760;_0x412009[_0x59f8('0x13')](_0x2a7953['id']);_0xbaf485(_0x110760);});});}return this['smtp'][_0x59f8('0x34')](_0x2a7953);};module['exports']=EmailChannel; \ No newline at end of file +var _0x1184=['md5','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','mailAccounts','smtp','prototype','name','Imap','messageStatus','total','stringify','emit','refresh','hasOwnProperty','active','service','provider','imapAccounts','box','handleImapBox','handleImapEmail','bind','end','error','handleImapError','status','disabled','connected','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','handleImapEnd','lastSync','send','isNil','Smtp','verify','verified','exports','lodash','bluebird'];(function(_0x17a3f9,_0x166965){var _0xb3aba7=function(_0x42169b){while(--_0x42169b){_0x17a3f9['push'](_0x17a3f9['shift']());}};_0xb3aba7(++_0x166965);}(_0x1184,0xa0));var _0x4118=function(_0x1ecf48,_0x5a6816){_0x1ecf48=_0x1ecf48-0x0;var _0x305af5=_0x1184[_0x1ecf48];return _0x305af5;};'use strict';var _=require(_0x4118('0x0'));var moment=require('moment');var BPromise=require(_0x4118('0x1'));var md5=require(_0x4118('0x2'));var Redis=require('ioredis');var config=require(_0x4118('0x3'));var logger=require(_0x4118('0x4'))(_0x4118('0x5'));config[_0x4118('0x6')]=_['defaults'](config[_0x4118('0x6')],{'host':_0x4118('0x7'),'port':0x18eb});var io=require(_0x4118('0x8'))(new Redis(config[_0x4118('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x4118('0x9'));var mailAccount=require(_0x4118('0xa'));var md5Accounts={};function EmailChannel(_0x44ee75){logger['info']('start\x20email\x20channel');this[_0x4118('0xb')]=_0x44ee75['mailAccounts'];this['imapAccounts']={};this[_0x4118('0xc')]=new EmailSmtp();}EmailChannel[_0x4118('0xd')]['emit']=function(_0x5cc339){var _0x57c63e=this[_0x4118('0xb')][_0x5cc339];var _0x59a9a6={'id':_0x57c63e['id'],'name':_0x57c63e[_0x4118('0xe')],'key':_0x57c63e['key'],'active':_0x57c63e['active'],'Imap':{'status':_0x57c63e[_0x4118('0xf')]['status'],'messageStatus':_0x57c63e['Imap'][_0x4118('0x10')],'total':_0x57c63e[_0x4118('0xf')][_0x4118('0x11')]}};if(_['isNil'](md5Accounts[_0x5cc339])){md5Accounts[_0x5cc339]={};}var _0x292086=md5(JSON[_0x4118('0x12')](_0x59a9a6));if(md5Accounts[_0x5cc339][_0x4118('0x2')]!==_0x292086){md5Accounts[_0x5cc339]['md5']=_0x292086;io[_0x4118('0x13')]('mailAccount:update',_0x59a9a6);}};EmailChannel[_0x4118('0xd')][_0x4118('0x14')]=function(_0x38189b){for(var _0x4abf64 in _0x38189b){if(_0x38189b[_0x4118('0x15')](_0x4abf64)){if(_0x38189b[_0x4abf64][_0x4118('0xf')]&&_0x38189b[_0x4abf64][_0x4118('0x16')]){var _0xa88d23=_0x38189b[_0x4abf64][_0x4118('0xf')];if(!_0xa88d23['service'])_0xa88d23[_0x4118('0x17')]=_0x38189b[_0x4abf64][_0x4118('0x18')];if(!this[_0x4118('0x19')][_0x4118('0x15')](_0xa88d23['id'])){this[_0x4118('0x19')][_0xa88d23['id']]=new EmailImap(_0xa88d23,_0x38189b[_0x4abf64]['email']);this[_0x4118('0x19')][_0xa88d23['id']]['on'](_0x4118('0x1a'),this[_0x4118('0x1b')]['bind'](this,_0x4abf64));this[_0x4118('0x19')][_0xa88d23['id']]['on'](_0x4118('0x5'),this[_0x4118('0x1c')][_0x4118('0x1d')](this,_0x4abf64));this[_0x4118('0x19')][_0xa88d23['id']]['on'](_0x4118('0x1e'),this['handleImapEnd'][_0x4118('0x1d')](this,_0x4abf64));this[_0x4118('0x19')][_0xa88d23['id']]['on'](_0x4118('0x1f'),this[_0x4118('0x20')][_0x4118('0x1d')](this,_0x4abf64));}}else{if(_['isNil'](this['mailAccounts'][_0x4abf64]['Imap'])){this['mailAccounts'][_0x4abf64]['Imap']={};}this[_0x4118('0xb')][_0x4abf64][_0x4118('0xf')][_0x4118('0x21')]=_0x4118('0x22');this['mailAccounts'][_0x4abf64][_0x4118('0xf')]['messageStatus']='';this[_0x4118('0x13')](_0x4abf64);}}}};EmailChannel[_0x4118('0xd')][_0x4118('0x1b')]=function(_0x2773b2,_0x35d809){if(this[_0x4118('0xb')][_0x2773b2]){this['mailAccounts'][_0x2773b2][_0x4118('0xf')][_0x4118('0x21')]=_0x4118('0x23');this[_0x4118('0xb')][_0x2773b2]['Imap']['messageStatus']=_0x35d809[_0x4118('0xe')];if(_0x35d809[_0x4118('0x24')]){this[_0x4118('0xb')][_0x2773b2][_0x4118('0xf')][_0x4118('0x11')]=_0x35d809['messages']['total'];}return this[_0x4118('0x13')](_0x2773b2);}};EmailChannel[_0x4118('0xd')][_0x4118('0x1c')]=function(_0x2662a7,_0x3be5d9){logger[_0x4118('0x25')](_0x4118('0x26'),_0x3be5d9[_0x4118('0x27')],_0x3be5d9[_0x4118('0x28')],_0x3be5d9[_0x4118('0x29')],_0x2662a7);if(this[_0x4118('0xb')][_0x2662a7]){return mailAccount[_0x4118('0x2a')](_0x2662a7,_0x3be5d9)[_0x4118('0x2b')](function(_0x2f6789){if(_0x2f6789){logger[_0x4118('0x25')](_0x4118('0x2c'));}})[_0x4118('0x2d')](function(_0x32a3c5){logger[_0x4118('0x1f')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x4118('0x12')](_0x32a3c5));});}};EmailChannel[_0x4118('0xd')][_0x4118('0x2e')]=function(_0x2c82ed){if(this[_0x4118('0xb')][_0x2c82ed]&&this[_0x4118('0xb')][_0x2c82ed]['Imap']){if(this[_0x4118('0x19')][this['mailAccounts'][_0x2c82ed]['Imap']['id']]){delete this[_0x4118('0x19')][this[_0x4118('0xb')][_0x2c82ed]['Imap']['id']];}this[_0x4118('0xb')][_0x2c82ed][_0x4118('0xf')][_0x4118('0x2f')]=moment();this['emit'](_0x2c82ed);}};EmailChannel[_0x4118('0xd')][_0x4118('0x20')]=function(_0x3ad64d,_0x571d40){if(this['mailAccounts'][_0x3ad64d]){this[_0x4118('0xb')][_0x3ad64d][_0x4118('0xf')][_0x4118('0x21')]=_0x4118('0x1f');this[_0x4118('0xb')][_0x3ad64d][_0x4118('0xf')]['messageStatus']=_0x571d40;return this[_0x4118('0x13')](_0x3ad64d);}};EmailChannel['prototype']['sendMail']=function(_0x5be71d,_0x509de1){return this[_0x4118('0xc')][_0x4118('0x30')](_0x5be71d,_0x509de1);};EmailChannel[_0x4118('0xd')]['verifySmtp']=function(_0x334a82){var _0x1ef488=this;if(this[_0x4118('0xb')][_0x334a82['id']]){if(_[_0x4118('0x31')](this[_0x4118('0xb')][_0x334a82['id']][_0x4118('0x32')])){this[_0x4118('0xb')][_0x334a82['id']][_0x4118('0x32')]={};}this['mailAccounts'][_0x334a82['id']][_0x4118('0x32')][_0x4118('0x2f')]=moment();return new BPromise(function(_0x3b8aa2,_0x12cac6){return _0x1ef488[_0x4118('0xc')][_0x4118('0x33')](_0x334a82)[_0x4118('0x2b')](function(_0xeed834){_0x1ef488['mailAccounts'][_0x334a82['id']][_0x4118('0x32')]['status']=_0x4118('0x34');_0x1ef488[_0x4118('0xb')][_0x334a82['id']]['Smtp']['messageStatus']='';_0x1ef488[_0x4118('0x13')](_0x334a82['id']);_0x3b8aa2(_0xeed834);})[_0x4118('0x2d')](function(_0x3c929f){_0x1ef488[_0x4118('0xb')][_0x334a82['id']]['Smtp']['status']='error';_0x1ef488['mailAccounts'][_0x334a82['id']][_0x4118('0x32')]['messageStatus']=_0x3c929f;_0x1ef488[_0x4118('0x13')](_0x334a82['id']);_0x12cac6(_0x3c929f);});});}return this[_0x4118('0xc')][_0x4118('0x33')](_0x334a82);};module[_0x4118('0x35')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 2775d02..9411ce7 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 _0x4975=['upperFirst','exports','lodash','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','INBOX','account','getAccount','once','ready','handleReady','bind','end','handleEnd','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','handleCloseBox','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','error','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','handleMessageAttributes','handleSimpleParser','handleMessageEnd','stringify','textCode','hasOwnProperty'];(function(_0x44aac2,_0x336163){var _0x38a6bc=function(_0x423444){while(--_0x423444){_0x44aac2['push'](_0x44aac2['shift']());}};_0x38a6bc(++_0x336163);}(_0x4975,0x86));var _0x5497=function(_0x2ea1df,_0x25cb53){_0x2ea1df=_0x2ea1df-0x0;var _0x21c130=_0x4975[_0x2ea1df];return _0x21c130;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var Imap=require(_0x5497('0x1'));var simpleParser=require(_0x5497('0x2'))[_0x5497('0x3')];var Iconv=require(_0x5497('0x4'))[_0x5497('0x5')];var EventEmitter=require(_0x5497('0x6'))[_0x5497('0x7')];var utils=require(_0x5497('0x8'));var logger=require(_0x5497('0x9'))(_0x5497('0xa'));function EmailImap(_0x539a27,_0x37e48d){this['mailbox']=_0x5497('0xb');this[_0x5497('0xc')]=this[_0x5497('0xd')](_0x539a27,_0x37e48d);this['imap']=new Imap(this[_0x5497('0xc')]);this['imap'][_0x5497('0xe')](_0x5497('0xf'),this[_0x5497('0x10')][_0x5497('0x11')](this));this[_0x5497('0x1')][_0x5497('0xe')](_0x5497('0x12'),this[_0x5497('0x13')]['bind'](this));this['imap']['on']('error',this[_0x5497('0x14')][_0x5497('0x11')](this));this[_0x5497('0x1')][_0x5497('0x15')]();}util[_0x5497('0x16')](EmailImap,EventEmitter);EmailImap[_0x5497('0x17')][_0x5497('0xd')]=function(_0xaca97d,_0x363a5b){var _0x1a4c74={'connTimeout':_0xaca97d['connTimeout']?_0xaca97d[_0x5497('0x18')]*0x3e8:0x2710,'authTimeout':_0xaca97d['authTimeout']?_0xaca97d[_0x5497('0x19')]*0x3e8:0x1388};if(_[_0x5497('0x1a')](_0xaca97d[_0x5497('0x1b')])){if(_0xaca97d[_0x5497('0x1c')]){_0x1a4c74[_0x5497('0x1d')]=_0xaca97d[_0x5497('0x1d')];_0x1a4c74[_0x5497('0x1e')]=_0xaca97d['password'];}_0x1a4c74['host']=_0xaca97d[_0x5497('0x1f')];_0x1a4c74[_0x5497('0x20')]=_0xaca97d[_0x5497('0x20')]||0x3e1;if(_0xaca97d['tls']){_0x1a4c74[_0x5497('0x21')]=!![];}else{_0x1a4c74[_0x5497('0x21')]=![];_0x1a4c74[_0x5497('0x22')]=_0x5497('0x23');}}else{if(_0xaca97d[_0x5497('0x24')]){_0x1a4c74[_0x5497('0x25')]=utils[_0x5497('0x26')](_0xaca97d[_0x5497('0x27')][_0x5497('0x28')],_0xaca97d[_0x5497('0x1d')]);_0x1a4c74[_0x5497('0x1d')]=_0xaca97d['user'];}else{_0x1a4c74[_0x5497('0x1d')]=_0xaca97d['user'];_0x1a4c74[_0x5497('0x1e')]=_0xaca97d[_0x5497('0x1e')];}_0x1a4c74[_0x5497('0x1f')]=utils[_0x5497('0x29')](_0xaca97d[_0x5497('0x1b')]);_0x1a4c74[_0x5497('0x20')]=0x3e1;_0x1a4c74['tls']=!![];}_0x1a4c74['email']=_0x363a5b||_0xaca97d[_0x5497('0x1d')]||_0x5497('0x2a');return _0x1a4c74;};EmailImap[_0x5497('0x17')][_0x5497('0x10')]=function(){this['imap'][_0x5497('0x2b')](this['mailbox'],![],this[_0x5497('0x2c')][_0x5497('0x11')](this));};EmailImap[_0x5497('0x17')][_0x5497('0x2c')]=function(_0x163a30,_0x31cd01){if(_0x163a30){this['handleError'](_0x163a30,!![]);}else{this[_0x5497('0x2d')]('box',_0x31cd01);this['readUnseen']();}};EmailImap['prototype'][_0x5497('0x2e')]=function(_0x48d146){if(_0x48d146){this['handleError'](_0x48d146,!![]);}else{this[_0x5497('0x1')][_0x5497('0x12')]();}};EmailImap[_0x5497('0x17')]['readUnseen']=function(){this['imap']['search']([_0x5497('0x2f')],this[_0x5497('0x30')][_0x5497('0x11')](this));};EmailImap['prototype']['handleReadUnseen']=function(_0x594866,_0xa28dd8){if(_0x594866){this['handleError'](_0x594866,!![]);}else{if(_0xa28dd8[_0x5497('0x31')]){try{var _0x258c2d=this[_0x5497('0x1')]['fetch'](_0xa28dd8,{'bodies':'','markSeen':!![]});_0x258c2d['on'](_0x5497('0x32'),this[_0x5497('0x33')]['bind'](this));_0x258c2d[_0x5497('0xe')](_0x5497('0x34'),this[_0x5497('0x35')]['bind'](this));_0x258c2d[_0x5497('0xe')](_0x5497('0x12'),this[_0x5497('0x36')][_0x5497('0x11')](this));}catch(_0x412f5b){logger['error'](_0x412f5b);}}else{this[_0x5497('0x1')][_0x5497('0x37')](!![],this['handleCloseBox'][_0x5497('0x11')](this));}}};EmailImap[_0x5497('0x17')][_0x5497('0x33')]=function(_0x1b9cd8){_0x1b9cd8['on'](_0x5497('0x38'),this[_0x5497('0x39')]['bind'](this));_0x1b9cd8[_0x5497('0xe')]('attributes',this[_0x5497('0x3a')][_0x5497('0x11')](this));_0x1b9cd8[_0x5497('0xe')]('end',this['handleMessageEnd'][_0x5497('0x11')](this));};EmailImap[_0x5497('0x17')][_0x5497('0x39')]=function(_0x429cbf){simpleParser(_0x429cbf,{'Iconv':Iconv},this[_0x5497('0x3b')][_0x5497('0x11')](this));};EmailImap['prototype'][_0x5497('0x3a')]=function(){};EmailImap[_0x5497('0x17')][_0x5497('0x3c')]=function(){};EmailImap[_0x5497('0x17')][_0x5497('0x3b')]=function(_0x468902,_0x1e3b6a){if(_0x468902){logger[_0x5497('0x34')](_0x468902);}else{var _0x59627b=this;utils['parser'](this[_0x5497('0xc')],_0x1e3b6a,function(_0x32fa2b){_0x59627b[_0x5497('0x2d')](_0x5497('0xa'),_0x32fa2b);});}};EmailImap[_0x5497('0x17')][_0x5497('0x36')]=function(){this[_0x5497('0x1')]['closeBox'](!![],this[_0x5497('0x2e')][_0x5497('0x11')](this));};EmailImap[_0x5497('0x17')][_0x5497('0x35')]=function(_0x1b251b){this[_0x5497('0x14')](_0x1b251b);this[_0x5497('0x1')]['closeBox'](!![],this[_0x5497('0x2e')][_0x5497('0x11')](this));};EmailImap[_0x5497('0x17')][_0x5497('0x13')]=function(){this[_0x5497('0x2d')](_0x5497('0x12'));};EmailImap[_0x5497('0x17')][_0x5497('0x14')]=function(_0x2021ae,_0x28d6cb){logger['error'](_0x5497('0x14'),this['account'][_0x5497('0xa')],JSON[_0x5497('0x3d')](_0x2021ae));var _0x26ef01='';if(_0x2021ae){if(_0x2021ae[_0x5497('0x3e')]){_0x26ef01=_0x2021ae[_0x5497('0x3e')];}else{for(var _0x510cfd in _0x2021ae){if(_0x2021ae[_0x5497('0x3f')](_0x510cfd)){_0x26ef01+=_[_0x5497('0x40')](_0x510cfd)+':\x20'+_0x2021ae[_0x510cfd]+'\x0a';}}}}if(_0x28d6cb){this['imap'][_0x5497('0x12')]();}else{this['emit'](_0x5497('0x34'),_0x26ef01);this['emit'](_0x5497('0x12'));}};module[_0x5497('0x41')]=EmailImap; \ No newline at end of file +var _0xb016=['isNil','service','authentication','user','password','host','port','tls','autotls','required','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','getHost','anonymous@xcally.com','openBox','mailbox','handleOpenBox','handleError','emit','box','readUnseen','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','stringify','textCode','lodash','util','simpleParser','Iconv','events','EventEmitter','./utils','email','account','getAccount','imap','once','ready','handleReady','bind','end','handleEnd','error','inherits','prototype','connTimeout'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xb016,0x159));var _0x6b01=function(_0x4c01c8,_0x409d93){_0x4c01c8=_0x4c01c8-0x0;var _0x932637=_0xb016[_0x4c01c8];return _0x932637;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var Imap=require('imap');var simpleParser=require('mailparser')[_0x6b01('0x2')];var Iconv=require('iconv')[_0x6b01('0x3')];var EventEmitter=require(_0x6b01('0x4'))[_0x6b01('0x5')];var utils=require(_0x6b01('0x6'));var logger=require('../../../config/logger')(_0x6b01('0x7'));function EmailImap(_0x65407a,_0x192b2d){this['mailbox']='INBOX';this[_0x6b01('0x8')]=this[_0x6b01('0x9')](_0x65407a,_0x192b2d);this['imap']=new Imap(this['account']);this[_0x6b01('0xa')][_0x6b01('0xb')](_0x6b01('0xc'),this[_0x6b01('0xd')][_0x6b01('0xe')](this));this['imap']['once'](_0x6b01('0xf'),this[_0x6b01('0x10')][_0x6b01('0xe')](this));this['imap']['on'](_0x6b01('0x11'),this['handleError']['bind'](this));this[_0x6b01('0xa')]['connect']();}util[_0x6b01('0x12')](EmailImap,EventEmitter);EmailImap[_0x6b01('0x13')]['getAccount']=function(_0x2c305e,_0x4ea5fa){var _0x50d778={'connTimeout':_0x2c305e['connTimeout']?_0x2c305e[_0x6b01('0x14')]*0x3e8:0x2710,'authTimeout':_0x2c305e['authTimeout']?_0x2c305e['authTimeout']*0x3e8:0x1388};if(_[_0x6b01('0x15')](_0x2c305e[_0x6b01('0x16')])){if(_0x2c305e[_0x6b01('0x17')]){_0x50d778[_0x6b01('0x18')]=_0x2c305e[_0x6b01('0x18')];_0x50d778[_0x6b01('0x19')]=_0x2c305e[_0x6b01('0x19')];}_0x50d778[_0x6b01('0x1a')]=_0x2c305e[_0x6b01('0x1a')];_0x50d778[_0x6b01('0x1b')]=_0x2c305e[_0x6b01('0x1b')]||0x3e1;if(_0x2c305e['tls']){_0x50d778[_0x6b01('0x1c')]=!![];}else{_0x50d778[_0x6b01('0x1c')]=![];_0x50d778[_0x6b01('0x1d')]=_0x6b01('0x1e');}}else{if(_0x2c305e[_0x6b01('0x1f')]){_0x50d778[_0x6b01('0x20')]=utils[_0x6b01('0x21')](_0x2c305e[_0x6b01('0x22')]['data5'],_0x2c305e[_0x6b01('0x18')]);_0x50d778[_0x6b01('0x18')]=_0x2c305e[_0x6b01('0x18')];}else{_0x50d778[_0x6b01('0x18')]=_0x2c305e[_0x6b01('0x18')];_0x50d778[_0x6b01('0x19')]=_0x2c305e[_0x6b01('0x19')];}_0x50d778['host']=utils[_0x6b01('0x23')](_0x2c305e[_0x6b01('0x16')]);_0x50d778[_0x6b01('0x1b')]=0x3e1;_0x50d778['tls']=!![];}_0x50d778[_0x6b01('0x7')]=_0x4ea5fa||_0x2c305e[_0x6b01('0x18')]||_0x6b01('0x24');return _0x50d778;};EmailImap[_0x6b01('0x13')][_0x6b01('0xd')]=function(){this[_0x6b01('0xa')][_0x6b01('0x25')](this[_0x6b01('0x26')],![],this[_0x6b01('0x27')][_0x6b01('0xe')](this));};EmailImap[_0x6b01('0x13')][_0x6b01('0x27')]=function(_0x154dfc,_0x55ca4b){if(_0x154dfc){this[_0x6b01('0x28')](_0x154dfc,!![]);}else{this[_0x6b01('0x29')](_0x6b01('0x2a'),_0x55ca4b);this[_0x6b01('0x2b')]();}};EmailImap[_0x6b01('0x13')]['handleCloseBox']=function(_0x54f030){if(_0x54f030){this[_0x6b01('0x28')](_0x54f030,!![]);}else{this[_0x6b01('0xa')][_0x6b01('0xf')]();}};EmailImap[_0x6b01('0x13')][_0x6b01('0x2b')]=function(){this[_0x6b01('0xa')]['search']([_0x6b01('0x2c')],this['handleReadUnseen'][_0x6b01('0xe')](this));};EmailImap['prototype'][_0x6b01('0x2d')]=function(_0xa6b2b6,_0x473201){if(_0xa6b2b6){this[_0x6b01('0x28')](_0xa6b2b6,!![]);}else{if(_0x473201[_0x6b01('0x2e')]){try{var _0x54575c=this[_0x6b01('0xa')][_0x6b01('0x2f')](_0x473201,{'bodies':'','markSeen':!![]});_0x54575c['on'](_0x6b01('0x30'),this['handleFetchMessage']['bind'](this));_0x54575c[_0x6b01('0xb')]('error',this[_0x6b01('0x31')][_0x6b01('0xe')](this));_0x54575c[_0x6b01('0xb')]('end',this[_0x6b01('0x32')][_0x6b01('0xe')](this));}catch(_0x186a6d){logger['error'](_0x186a6d);}}else{this[_0x6b01('0xa')][_0x6b01('0x33')](!![],this[_0x6b01('0x34')][_0x6b01('0xe')](this));}}};EmailImap[_0x6b01('0x13')]['handleFetchMessage']=function(_0xa041ea){_0xa041ea['on'](_0x6b01('0x35'),this[_0x6b01('0x36')][_0x6b01('0xe')](this));_0xa041ea[_0x6b01('0xb')](_0x6b01('0x37'),this[_0x6b01('0x38')][_0x6b01('0xe')](this));_0xa041ea['once'](_0x6b01('0xf'),this['handleMessageEnd'][_0x6b01('0xe')](this));};EmailImap[_0x6b01('0x13')][_0x6b01('0x36')]=function(_0x318b8b){simpleParser(_0x318b8b,{'Iconv':Iconv},this[_0x6b01('0x39')][_0x6b01('0xe')](this));};EmailImap[_0x6b01('0x13')]['handleMessageAttributes']=function(){};EmailImap[_0x6b01('0x13')][_0x6b01('0x3a')]=function(){};EmailImap[_0x6b01('0x13')][_0x6b01('0x39')]=function(_0x1ca3aa,_0x2c4205){if(_0x1ca3aa){logger[_0x6b01('0x11')](_0x1ca3aa);}else{var _0x44bf46=this;utils['parser'](this[_0x6b01('0x8')],_0x2c4205,function(_0x55907f){_0x44bf46[_0x6b01('0x29')](_0x6b01('0x7'),_0x55907f);});}};EmailImap['prototype'][_0x6b01('0x32')]=function(){this[_0x6b01('0xa')][_0x6b01('0x33')](!![],this[_0x6b01('0x34')][_0x6b01('0xe')](this));};EmailImap[_0x6b01('0x13')][_0x6b01('0x31')]=function(_0x93737a){this[_0x6b01('0x28')](_0x93737a);this[_0x6b01('0xa')]['closeBox'](!![],this[_0x6b01('0x34')][_0x6b01('0xe')](this));};EmailImap['prototype']['handleEnd']=function(){this[_0x6b01('0x29')](_0x6b01('0xf'));};EmailImap['prototype'][_0x6b01('0x28')]=function(_0x3f9e46,_0x55bf71){logger[_0x6b01('0x11')]('handleError',this[_0x6b01('0x8')][_0x6b01('0x7')],JSON[_0x6b01('0x3b')](_0x3f9e46));var _0x50b13d='';if(_0x3f9e46){if(_0x3f9e46[_0x6b01('0x3c')]){_0x50b13d=_0x3f9e46[_0x6b01('0x3c')];}else{for(var _0x52cc57 in _0x3f9e46){if(_0x3f9e46['hasOwnProperty'](_0x52cc57)){_0x50b13d+=_['upperFirst'](_0x52cc57)+':\x20'+_0x3f9e46[_0x52cc57]+'\x0a';}}}}if(_0x55bf71){this[_0x6b01('0xa')][_0x6b01('0xf')]();}else{this[_0x6b01('0x29')](_0x6b01('0x11'),_0x50b13d);this[_0x6b01('0x29')](_0x6b01('0xf'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index e8686f7..a140abb 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 _0x4991=['prototype','createTransport','use','compile','toString','verify','exports','nodemailer'];(function(_0x4fc18e,_0x19da98){var _0x1bda0f=function(_0x21db96){while(--_0x21db96){_0x4fc18e['push'](_0x4fc18e['shift']());}};_0x1bda0f(++_0x19da98);}(_0x4991,0xf7));var _0x1499=function(_0x2554eb,_0x499afb){_0x2554eb=_0x2554eb-0x0;var _0x3e2e44=_0x4991[_0x2554eb];return _0x3e2e44;};'use strict';var nodemailer=require(_0x1499('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x1499('0x1')]['send']=function(_0x30d640,_0x256e41){return new Promise(function(_0x16ac22,_0x47272e){var _0x1b291f=nodemailer[_0x1499('0x2')](_0x30d640);_0x1b291f[_0x1499('0x3')](_0x1499('0x4'),inlineBase64());_0x1b291f['sendMail'](_0x256e41,function(_0x2a8e96,_0x1c3bd7){if(_0x2a8e96)return _0x47272e(_0x2a8e96[_0x1499('0x5')]());return _0x16ac22(_0x1c3bd7);});});};EmailSmtp[_0x1499('0x1')][_0x1499('0x6')]=function(_0x380e48){return new Promise(function(_0x3277b3,_0x15b291){var _0x48d2ca=nodemailer[_0x1499('0x2')](_0x380e48);_0x48d2ca[_0x1499('0x6')](function(_0x575251,_0x2a4816){if(_0x575251)return _0x15b291(_0x575251[_0x1499('0x5')]());if(!_0x2a4816)return _0x15b291('Not\x20verified');return _0x3277b3(_0x2a4816);});});};module[_0x1499('0x7')]=EmailSmtp; \ No newline at end of file +var _0xadb5=['verify','Not\x20verified','exports','nodemailer-plugin-inline-base64','send','createTransport','compile','sendMail','toString','prototype'];(function(_0x28d4fe,_0x49bab2){var _0x1fec81=function(_0x28a133){while(--_0x28a133){_0x28d4fe['push'](_0x28d4fe['shift']());}};_0x1fec81(++_0x49bab2);}(_0xadb5,0xad));var _0x5adb=function(_0x71ef6c,_0x14256e){_0x71ef6c=_0x71ef6c-0x0;var _0x36d042=_0xadb5[_0x71ef6c];return _0x36d042;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x5adb('0x0'));function EmailSmtp(){}EmailSmtp['prototype'][_0x5adb('0x1')]=function(_0x38f67f,_0x3129c3){return new Promise(function(_0x4aecec,_0x248dc6){var _0x31457=nodemailer[_0x5adb('0x2')](_0x38f67f);_0x31457['use'](_0x5adb('0x3'),inlineBase64());_0x31457[_0x5adb('0x4')](_0x3129c3,function(_0x3e2555,_0x3213e8){if(_0x3e2555)return _0x248dc6(_0x3e2555[_0x5adb('0x5')]());return _0x4aecec(_0x3213e8);});});};EmailSmtp[_0x5adb('0x6')][_0x5adb('0x7')]=function(_0x6d1b45){return new Promise(function(_0x41261c,_0x7293ab){var _0x34f59d=nodemailer[_0x5adb('0x2')](_0x6d1b45);_0x34f59d[_0x5adb('0x7')](function(_0x275428,_0x563d86){if(_0x275428)return _0x7293ab(_0x275428['toString']());if(!_0x563d86)return _0x7293ab(_0x5adb('0x8'));return _0x41261c(_0x563d86);});});};module[_0x5adb('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 9ca7220..a7ed198 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 _0xde8b=['isAutoreply','from','inReplyTo','format','YYYY-MM-DD\x20HH:mm:ss','application/ms-tnef','messageId','parseBuffer','first','content','BodyHTML','Attachments','Data','gmail','yahoo','hotmail','imap-mail.outlook.com','outlook.office365.com','generateXOAuth2Token','user=','utf-8','toString','base64','moment','path','util','node-tnef','../../../config/logger','../../../config/environment','value','address','generate','head','name','substring','indexOf','split','length','slice','join','Anonymous','isEmpty','anonymous','@xcally.com','test','html','replace','includes','\x20[Attachment:\x20','\x20]','body','0x1?_0x3f78be[_0xbde8('0xf')](0x0,-0x1)[_0xbde8('0x10')]('\x20'):_0x5b5eb2['name'];}return _0xbde8('0x11');}function getLastName(_0x3e0268){var _0x2d05ab=_[_0xbde8('0x9')](_0x3e0268[_0xbde8('0x6')]);if(_0x2d05ab&&_0x2d05ab['name']){var _0x390733=_0x2d05ab['name'][_0xbde8('0xd')](/\s+/);return _0x390733[_0xbde8('0xe')]>0x1?_0x390733['pop']():'';}return'';}function getMails(_0x245437,_0x1112f1){var _0x589cfa='';for(var _0x4fb8a4=0x0;_0x4fb8a4<_0x1112f1[_0xbde8('0x6')]['length'];_0x4fb8a4+=0x1){if(_0x1112f1[_0xbde8('0x6')][_0x4fb8a4][_0xbde8('0x7')]!==_0x245437){if(!_[_0xbde8('0x12')](_0x589cfa)){_0x589cfa+=',';}_0x589cfa+=_0x1112f1['value'][_0x4fb8a4][_0xbde8('0xa')]||_0x1112f1[_0xbde8('0x6')][_0x4fb8a4][_0xbde8('0x7')]||'';_0x589cfa+='\x20<';_0x589cfa+=_0x1112f1[_0xbde8('0x6')][_0x4fb8a4]['address']?_0x1112f1['value'][_0x4fb8a4]['address']:_0xbde8('0x13')+random[_0xbde8('0x8')](0x6)+_0xbde8('0x14');_0x589cfa+='>';}}return _0x589cfa;}function parseEmail(_0x2932c5,_0x18d4bb,_0x154b4d){if(_0x18d4bb['html']){var _0x135782=/)<[^<]*)*<\/script>/gi;while(_0x135782[_0xbde8('0x15')](_0x18d4bb[_0xbde8('0x16')])){_0x18d4bb[_0xbde8('0x16')]=_0x18d4bb['html'][_0xbde8('0x17')](_0x135782,'');}if(_0x18d4bb[_0xbde8('0x16')][_0xbde8('0x18')](_0xbde8('0x19'))){var _0x484fe6=[];_0x18d4bb[_0xbde8('0x1a')][_0xbde8('0x1b')](_0x2195c2=>{_0x484fe6[_0xbde8('0x1c')](_0x2195c2[_0xbde8('0x1d')]);});var _0x3fb0ef=/]+>/g;var _0xaf84cd=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x550685=_0x18d4bb['html'][_0xbde8('0x17')](_0xaf84cd,_0xbde8('0x1e'));var _0x1381d8=_0x550685[_0xbde8('0x17')](_0x3fb0ef,_0xbde8('0x1f'));for(let _0x35c2d3=0x0;_0x35c2d3<_0x484fe6[_0xbde8('0xe')];_0x35c2d3++){var _0x4019e0=_0x1381d8[_0xbde8('0x17')](_0xbde8('0x1f'),_0xbde8('0x20')+_0x484fe6[_0x35c2d3]+_0xbde8('0x21'));_0x1381d8=_0x4019e0;}_0x18d4bb[_0xbde8('0x16')]=_0x1381d8;}_0x154b4d[_0xbde8('0x22')]=_0x18d4bb[_0xbde8('0x16')];}else{_0x154b4d[_0xbde8('0x22')]=_0x18d4bb['textAsHtml'];}if(_0x154b4d[_0xbde8('0x22')]){_0x154b4d[_0xbde8('0x22')]=_0x154b4d[_0xbde8('0x22')]['replace'](/0x0){var _0x2f4bb6=[_0xbde8('0x31'),_0xbde8('0x32'),_0xbde8('0x33')];for(var _0x5509d4=0x0;_0x5509d4<_0x18d4bb['headerLines'][_0xbde8('0xe')];_0x5509d4++){var _0x36d930=_[_0xbde8('0xc')](_0x2f4bb6,_0x18d4bb[_0xbde8('0x30')][_0x5509d4][_0xbde8('0x34')]);if(_0x36d930>=0x0){_0x154b4d[_0xbde8('0x35')]=!![];}}}return _0x154b4d;}exports['parser']=function(_0x570ee7,_0x1987d9,_0x581378){var _0x444a65={'from':getAddress(_0x1987d9['from']),'firstName':getFirstName(_0x1987d9[_0xbde8('0x36')]),'lastName':getLastName(_0x1987d9[_0xbde8('0x36')]),'mapKey':_0xbde8('0x27'),'message':{'from':getMails(_0x570ee7[_0xbde8('0x27')],_0x1987d9[_0xbde8('0x36')]),'to':_0x570ee7[_0xbde8('0x27')],'cc':'','subject':_0x1987d9['subject']||'','messageId':_0x1987d9['messageId'],'inReplyTo':_0x1987d9[_0xbde8('0x37')],'sentAt':moment(_0x1987d9['date'])[_0xbde8('0x38')](_0xbde8('0x39')),'attach':![],'attachments':[]}};if(!_0x1987d9[_0xbde8('0x16')]&&!_0x1987d9['textAsHtml']){var _0x2b8c69=_['filter'](_0x1987d9[_0xbde8('0x1a')],{'contentType':_0xbde8('0x3a')});if(_0x2b8c69[_0xbde8('0xe')]){logger['info'](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x1987d9[_0xbde8('0x3b')]));tnef[_0xbde8('0x3c')](_[_0xbde8('0x3d')](_0x2b8c69)[_0xbde8('0x3e')],function(_0x3aafa9,_0x1559ce){if(_0x1559ce){_0x1987d9['html']=_0x1559ce[_0xbde8('0x3f')]||'

Empty\x20message

';if(_0x1559ce[_0xbde8('0x40')]){for(var _0x32331c=0x0;_0x32331c<_0x1559ce[_0xbde8('0x40')]['length'];_0x32331c++){var _0xc455c8=_0x1559ce['Attachments'][_0x32331c];_0x444a65[_0xbde8('0x24')][_0xbde8('0x1a')][_0xbde8('0x1c')]({'filename':_0xc455c8['Title'],'content':Buffer['from'](_0xc455c8[_0xbde8('0x41')])});}}}_0x581378(parseEmail(_0x570ee7,_0x1987d9,_0x444a65));});}else{_0x1987d9['html']='

Empty\x20message

';_0x581378(parseEmail(_0x570ee7,_0x1987d9,_0x444a65));}}else{_0x581378(parseEmail(_0x570ee7,_0x1987d9,_0x444a65));}};exports['getHost']=function(_0x42b6c3){switch(_0x42b6c3){case _0xbde8('0x42'):return'imap.gmail.com';case _0xbde8('0x43'):return'imap.mail.yahoo.com';case _0xbde8('0x44'):return _0xbde8('0x45');case'outlook365':return _0xbde8('0x46');}return'127.0.0.1';};exports[_0xbde8('0x47')]=function(_0x389944,_0x3b07e2){var _0x44c18d=[_0xbde8('0x48')+(_0x3b07e2||''),'auth=Bearer\x20'+_0x389944,'',''];return Buffer['from'](_0x44c18d[_0xbde8('0x10')](''),_0xbde8('0x49'))[_0xbde8('0x4a')](_0xbde8('0x4b'));}; \ No newline at end of file +var _0xa62d=['anonymous','generate','@xcally.com','name','substring','split','length','slice','join','Anonymous','isEmpty','test','html','replace','includes','forEach','filename','_IMG','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','auth=Bearer\x20','utf-8','toString','lodash','moment','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address'];(function(_0x446d66,_0x1b247a){var _0xd7f6e6=function(_0x1410df){while(--_0x1410df){_0x446d66['push'](_0x446d66['shift']());}};_0xd7f6e6(++_0x1b247a);}(_0xa62d,0xe5));var _0xda62=function(_0xc1b0ac,_0x37847c){_0xc1b0ac=_0xc1b0ac-0x0;var _0x497bac=_0xa62d[_0xc1b0ac];return _0x497bac;};'use strict';var _=require(_0xda62('0x0'));var moment=require(_0xda62('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0xda62('0x2'));var util=require(_0xda62('0x3'));var tnef=require(_0xda62('0x4'));var logger=require(_0xda62('0x5'))(_0xda62('0x6'));var config=require(_0xda62('0x7'));function getAddress(_0x3d80b3){var _0x54db07=_[_0xda62('0x8')](_0x3d80b3[_0xda62('0x9')]);return _0x54db07&&_0x54db07['address']?_0x54db07[_0xda62('0xa')]:_0xda62('0xb')+random[_0xda62('0xc')](0x6)+_0xda62('0xd');}function getFirstName(_0x4d06c8){var _0x100037=_[_0xda62('0x8')](_0x4d06c8[_0xda62('0x9')]);if(_0x100037&&_0x100037['name']){if(_0x100037[_0xda62('0xe')]==_0x100037[_0xda62('0xa')]){return _0x100037[_0xda62('0xe')][_0xda62('0xf')](0x0,_0x100037['name']['indexOf']('@'));}var _0xa8ddef=_0x100037[_0xda62('0xe')][_0xda62('0x10')](/\s+/);return _0xa8ddef[_0xda62('0x11')]>0x1?_0xa8ddef[_0xda62('0x12')](0x0,-0x1)[_0xda62('0x13')]('\x20'):_0x100037['name'];}return _0xda62('0x14');}function getLastName(_0xa351c5){var _0x29d6b7=_[_0xda62('0x8')](_0xa351c5[_0xda62('0x9')]);if(_0x29d6b7&&_0x29d6b7[_0xda62('0xe')]){var _0x25e72b=_0x29d6b7['name'][_0xda62('0x10')](/\s+/);return _0x25e72b[_0xda62('0x11')]>0x1?_0x25e72b['pop']():'';}return'';}function getMails(_0x58606c,_0x1acc15){var _0xd9c149='';for(var _0x296506=0x0;_0x296506<_0x1acc15['value'][_0xda62('0x11')];_0x296506+=0x1){if(_0x1acc15[_0xda62('0x9')][_0x296506]['address']!==_0x58606c){if(!_[_0xda62('0x15')](_0xd9c149)){_0xd9c149+=',';}_0xd9c149+=_0x1acc15[_0xda62('0x9')][_0x296506][_0xda62('0xe')]||_0x1acc15[_0xda62('0x9')][_0x296506]['address']||'';_0xd9c149+='\x20<';_0xd9c149+=_0x1acc15[_0xda62('0x9')][_0x296506][_0xda62('0xa')]?_0x1acc15[_0xda62('0x9')][_0x296506][_0xda62('0xa')]:_0xda62('0xb')+random['generate'](0x6)+_0xda62('0xd');_0xd9c149+='>';}}return _0xd9c149;}function parseEmail(_0x3026a8,_0x5dd177,_0x181699){if(_0x5dd177['html']){var _0x33a5b4=/)<[^<]*)*<\/script>/gi;while(_0x33a5b4[_0xda62('0x16')](_0x5dd177[_0xda62('0x17')])){_0x5dd177['html']=_0x5dd177[_0xda62('0x17')][_0xda62('0x18')](_0x33a5b4,'');}if(_0x5dd177[_0xda62('0x17')][_0xda62('0x19')]('{_0xb18aaa['push'](_0x32c734[_0xda62('0x1b')]);});var _0x55da9d=/]+>/g;var _0x4726ec=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1e9ef9=_0x5dd177[_0xda62('0x17')][_0xda62('0x18')](_0x4726ec,'_SRC');var _0x1a1b0d=_0x1e9ef9[_0xda62('0x18')](_0x55da9d,_0xda62('0x1c'));for(let _0x20e0b7=0x0;_0x20e0b7<_0xb18aaa['length'];_0x20e0b7++){var _0x58bd07=_0x1a1b0d['replace']('_IMG','\x20[Attachment:\x20'+_0xb18aaa[_0x20e0b7]+_0xda62('0x1d'));_0x1a1b0d=_0x58bd07;}_0x5dd177['html']=_0x1a1b0d;}_0x181699[_0xda62('0x1e')]=_0x5dd177[_0xda62('0x17')];}else{_0x181699[_0xda62('0x1e')]=_0x5dd177[_0xda62('0x1f')];}if(_0x181699[_0xda62('0x1e')]){_0x181699[_0xda62('0x1e')]=_0x181699['body'][_0xda62('0x18')](/0x0){var _0x592546=[_0xda62('0x2f'),_0xda62('0x30'),_0xda62('0x31')];for(var _0x35d8af=0x0;_0x35d8af<_0x5dd177[_0xda62('0x2e')][_0xda62('0x11')];_0x35d8af++){var _0x337e2a=_[_0xda62('0x32')](_0x592546,_0x5dd177[_0xda62('0x2e')][_0x35d8af][_0xda62('0x33')]);if(_0x337e2a>=0x0){_0x181699[_0xda62('0x34')]=!![];}}}return _0x181699;}exports[_0xda62('0x35')]=function(_0x195cbe,_0x4c3433,_0x57a507){var _0xe7459b={'from':getAddress(_0x4c3433['from']),'firstName':getFirstName(_0x4c3433['from']),'lastName':getLastName(_0x4c3433[_0xda62('0x36')]),'mapKey':_0xda62('0x6'),'message':{'from':getMails(_0x195cbe[_0xda62('0x6')],_0x4c3433[_0xda62('0x36')]),'to':_0x195cbe['email'],'cc':'','subject':_0x4c3433['subject']||'','messageId':_0x4c3433[_0xda62('0x37')],'inReplyTo':_0x4c3433[_0xda62('0x38')],'sentAt':moment(_0x4c3433[_0xda62('0x39')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x4c3433['html']&&!_0x4c3433[_0xda62('0x1f')]){var _0x74cd67=_[_0xda62('0x3a')](_0x4c3433[_0xda62('0x24')],{'contentType':_0xda62('0x3b')});if(_0x74cd67[_0xda62('0x11')]){logger[_0xda62('0x3c')](util[_0xda62('0x27')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x4c3433[_0xda62('0x37')]));tnef[_0xda62('0x3d')](_[_0xda62('0x3e')](_0x74cd67)[_0xda62('0x2c')],function(_0x16873c,_0x5846af){if(_0x5846af){_0x4c3433[_0xda62('0x17')]=_0x5846af['BodyHTML']||_0xda62('0x3f');if(_0x5846af[_0xda62('0x40')]){for(var _0x151687=0x0;_0x151687<_0x5846af[_0xda62('0x40')]['length'];_0x151687++){var _0x57a53c=_0x5846af[_0xda62('0x40')][_0x151687];_0xe7459b[_0xda62('0x22')][_0xda62('0x24')]['push']({'filename':_0x57a53c[_0xda62('0x41')],'content':Buffer[_0xda62('0x36')](_0x57a53c[_0xda62('0x42')])});}}}_0x57a507(parseEmail(_0x195cbe,_0x4c3433,_0xe7459b));});}else{_0x4c3433[_0xda62('0x17')]=_0xda62('0x3f');_0x57a507(parseEmail(_0x195cbe,_0x4c3433,_0xe7459b));}}else{_0x57a507(parseEmail(_0x195cbe,_0x4c3433,_0xe7459b));}};exports[_0xda62('0x43')]=function(_0x3b6e05){switch(_0x3b6e05){case _0xda62('0x44'):return _0xda62('0x45');case _0xda62('0x46'):return _0xda62('0x47');case _0xda62('0x48'):return _0xda62('0x49');case _0xda62('0x4a'):return _0xda62('0x4b');}return _0xda62('0x4c');};exports['generateXOAuth2Token']=function(_0x4cd8c0,_0x506000){var _0x5520b6=['user='+(_0x506000||''),_0xda62('0x4d')+_0x4cd8c0,'',''];return Buffer[_0xda62('0x36')](_0x5520b6[_0xda62('0x13')](''),_0xda62('0x4e'))[_0xda62('0x4f')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 0ca839b..ae4c8cc 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 _0xc0cd=['key','SERV','active','Imap','Smtp','name','Service'];(function(_0x3ec302,_0x9111e3){var _0x251a50=function(_0x9282c1){while(--_0x9282c1){_0x3ec302['push'](_0x3ec302['shift']());}};_0x251a50(++_0x9111e3);}(_0xc0cd,0x17f));var _0xdc0c=function(_0x276fed,_0x4057a2){_0x276fed=_0x276fed-0x0;var _0x548176=_0xc0cd[_0x276fed];return _0x548176;};'use strict';var _=require('lodash');function MailAccount(_0x247458){this['id']=_0x247458['id']||0x0;this[_0xdc0c('0x0')]=_0x247458['name']||_0xdc0c('0x1');this['key']=_0x247458[_0xdc0c('0x2')]||_0xdc0c('0x3');this[_0xdc0c('0x4')]=_0x247458[_0xdc0c('0x4')]||![];this['Imap']=_0x247458[_0xdc0c('0x5')]||[];this['Smtp']=_0x247458[_0xdc0c('0x6')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0xc3fb=['Imap','Smtp','exports','lodash','name','Service','key','SERV','active'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xc3fb,0x108));var _0xbc3f=function(_0xb42798,_0x1bcbc5){_0xb42798=_0xb42798-0x0;var _0x97d531=_0xc3fb[_0xb42798];return _0x97d531;};'use strict';var _=require(_0xbc3f('0x0'));function MailAccount(_0x27f8d5){this['id']=_0x27f8d5['id']||0x0;this['name']=_0x27f8d5[_0xbc3f('0x1')]||_0xbc3f('0x2');this[_0xbc3f('0x3')]=_0x27f8d5['key']||_0xbc3f('0x4');this['active']=_0x27f8d5[_0xbc3f('0x5')]||![];this['Imap']=_0x27f8d5[_0xbc3f('0x6')]||[];this[_0xbc3f('0x7')]=_0x27f8d5[_0xbc3f('0x7')]||[];}module[_0xbc3f('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index e9c39a9..3994c5e 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 _0x90e4=['mailAccounts','merge','exports','lodash','../model/mailAccount','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined'];(function(_0x49b286,_0x9c22da){var _0x240c63=function(_0xc7514b){while(--_0xc7514b){_0x49b286['push'](_0x49b286['shift']());}};_0x240c63(++_0x9c22da);}(_0x90e4,0xa8));var _0x490e=function(_0x111494,_0x1d73da){_0x111494=_0x111494-0x0;var _0x1d0d8b=_0x90e4[_0x111494];return _0x1d0d8b;};'use strict';var _=require(_0x490e('0x0'));var MailAccount=require(_0x490e('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x2b8d02,_0x2834d1,_0x32db67){var _0x570daa=_['mapKeys'](_0x2b8d02,function(_0xdb13a5,_0x5ac02a){return _0xdb13a5[_0x32db67];});for(var _0x537ea9 in _0x2834d1){if(_0x2834d1[_0x490e('0x2')](_0x537ea9)){if(!_0x570daa[_0x537ea9]){delete _0x2834d1[_0x537ea9];}}}}Realtime[_0x490e('0x3')][_0x490e('0x4')]=function(_0x8b07e6,_0x4f92bd){for(var _0x16e9c8 in _0x4f92bd){if(_0x8b07e6[_0x490e('0x2')](_0x16e9c8)){_0x8b07e6[_0x16e9c8]=_0x4f92bd[_0x16e9c8];}}};Realtime[_0x490e('0x3')][_0x490e('0x5')]=function(){var _0x12fba=this;return function(_0x227247){if(_0x227247){freeIsNotKey(_0x227247,_0x12fba['mailAccounts'],'id');for(var _0x358dc7=0x0,_0x13ac80={},_0x33a178={};_0x358dc7<_0x227247[_0x490e('0x6')];_0x358dc7+=0x1){_0x13ac80=_0x227247[_0x358dc7];if(_[_0x490e('0x7')](_0x12fba[_0x490e('0x8')][_0x13ac80['id']])){_0x12fba[_0x490e('0x8')][_0x13ac80['id']]=new MailAccount(_0x13ac80);}else{_[_0x490e('0x9')](_0x12fba['mailAccounts'][_0x13ac80['id']],_0x13ac80);}}}return _0x12fba['mailAccounts'];};};module[_0x490e('0xa')]=Realtime; \ No newline at end of file +var _0xe729=['lodash','../model/mailAccount','mapKeys','hasOwnProperty','mergeFromDatabase','prototype','mailAccounts','isUndefined','merge','exports'];(function(_0x5773e7,_0x435e69){var _0x5e6621=function(_0x112829){while(--_0x112829){_0x5773e7['push'](_0x5773e7['shift']());}};_0x5e6621(++_0x435e69);}(_0xe729,0xfa));var _0x9e72=function(_0x2043e0,_0x3ef66d){_0x2043e0=_0x2043e0-0x0;var _0x930a79=_0xe729[_0x2043e0];return _0x930a79;};'use strict';var _=require(_0x9e72('0x0'));var MailAccount=require(_0x9e72('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x592345,_0x5ebf7d,_0x7ea338){var _0xe11c2d=_[_0x9e72('0x2')](_0x592345,function(_0x19e5ee,_0x4720e4){return _0x19e5ee[_0x7ea338];});for(var _0x42b6cd in _0x5ebf7d){if(_0x5ebf7d[_0x9e72('0x3')](_0x42b6cd)){if(!_0xe11c2d[_0x42b6cd]){delete _0x5ebf7d[_0x42b6cd];}}}}Realtime['prototype'][_0x9e72('0x4')]=function(_0x2cadf3,_0xf93ff8){for(var _0x567de2 in _0xf93ff8){if(_0x2cadf3[_0x9e72('0x3')](_0x567de2)){_0x2cadf3[_0x567de2]=_0xf93ff8[_0x567de2];}}};Realtime[_0x9e72('0x5')]['initMailAccounts']=function(){var _0x2e0644=this;return function(_0x4f8703){if(_0x4f8703){freeIsNotKey(_0x4f8703,_0x2e0644[_0x9e72('0x6')],'id');for(var _0x47590c=0x0,_0x1ed1fc={},_0x1ea91b={};_0x47590c<_0x4f8703['length'];_0x47590c+=0x1){_0x1ed1fc=_0x4f8703[_0x47590c];if(_[_0x9e72('0x7')](_0x2e0644['mailAccounts'][_0x1ed1fc['id']])){_0x2e0644[_0x9e72('0x6')][_0x1ed1fc['id']]=new MailAccount(_0x1ed1fc);}else{_[_0x9e72('0x8')](_0x2e0644['mailAccounts'][_0x1ed1fc['id']],_0x1ed1fc);}}}return _0x2e0644[_0x9e72('0x6')];};};module[_0x9e72('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 3237659..32ac866 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 _0x58b9=['active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','MailServerOut','getMailAccount','notify','NotifyMailAccount','../client','Request','GetMailAccount','name','provider','service','email'];(function(_0x4a418c,_0x3ed2ca){var _0x5301a5=function(_0x339e1d){while(--_0x339e1d){_0x4a418c['push'](_0x4a418c['shift']());}};_0x5301a5(++_0x3ed2ca);}(_0x58b9,0xad));var _0x958b=function(_0xf8fa15,_0x4d90f2){_0xf8fa15=_0xf8fa15-0x0;var _0x4bb81f=_0x58b9[_0xf8fa15];return _0x4bb81f;};'use strict';var client=require(_0x958b('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x958b('0x1')](_0x958b('0x2'),{'options':{'attributes':['id',_0x958b('0x3'),_0x958b('0x4'),_0x958b('0x5'),_0x958b('0x6'),_0x958b('0x7'),_0x958b('0x8'),_0x958b('0x9'),_0x958b('0xa')],'raw':![],'include':[{'model':_0x958b('0xb'),'as':_0x958b('0xc'),'include':[{'model':_0x958b('0xd'),'attributes':['id',_0x958b('0x3'),_0x958b('0x5'),_0x958b('0xe'),_0x958b('0xf')],'as':_0x958b('0xd')}]},{'model':_0x958b('0x10'),'as':'Smtp','include':[{'model':_0x958b('0xd'),'attributes':['id','name',_0x958b('0x5'),_0x958b('0xe'),_0x958b('0xf')],'as':'CloudProvider'}]}]},'log':_0x958b('0x11')});};};exports[_0x958b('0x12')]=function(_0x12c124,_0x144b20){return client[_0x958b('0x1')](_0x958b('0x13'),{'account':{'id':_0x12c124},'body':_0x144b20,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x0257=['Imap','CloudProvider','data5','MailServerOut','type','notify','NotifyMailAccount','getMailAccounts','Request','GetMailAccount','name','provider','service','email','active','key','TemplateId','MailServerIn'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x0257,0x1db));var _0x7025=function(_0x54f978,_0x3a6b7e){_0x54f978=_0x54f978-0x0;var _0x5d40b3=_0x0257[_0x54f978];return _0x5d40b3;};'use strict';var client=require('../client');exports[_0x7025('0x0')]=function(){return function(){return client[_0x7025('0x1')](_0x7025('0x2'),{'options':{'attributes':['id',_0x7025('0x3'),_0x7025('0x4'),_0x7025('0x5'),_0x7025('0x6'),_0x7025('0x7'),_0x7025('0x8'),'ListId',_0x7025('0x9')],'raw':![],'include':[{'model':_0x7025('0xa'),'as':_0x7025('0xb'),'include':[{'model':_0x7025('0xc'),'attributes':['id',_0x7025('0x3'),_0x7025('0x5'),'type',_0x7025('0xd')],'as':_0x7025('0xc')}]},{'model':_0x7025('0xe'),'as':'Smtp','include':[{'model':'CloudProvider','attributes':['id',_0x7025('0x3'),_0x7025('0x5'),_0x7025('0xf'),_0x7025('0xd')],'as':_0x7025('0xc')}]}]},'log':'getMailAccount'});};};exports[_0x7025('0x10')]=function(_0x2dd6ee,_0x2abb6e){return client[_0x7025('0x1')](_0x7025('0x11'),{'account':{'id':_0x2dd6ee},'body':_0x2abb6e,'log':_0x7025('0x11')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index ce5187c..3cb333d 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 _0x17dd=['Request','ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0x1a5639,_0xcef6d6){var _0x5039be=function(_0xda0dc4){while(--_0xda0dc4){_0x1a5639['push'](_0x1a5639['shift']());}};_0x5039be(++_0xcef6d6);}(_0x17dd,0x1d5));var _0xd17d=function(_0x5554eb,_0x4c7dbe){_0x5554eb=_0x5554eb-0x0;var _0x51adf5=_0x17dd[_0x5554eb];return _0x51adf5;};'use strict';var client=require(_0xd17d('0x0'));exports['getSettings']=function(){return client[_0xd17d('0x1')](_0xd17d('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xd17d('0x3')]},'log':_0xd17d('0x4')});}; \ No newline at end of file +var _0x096c=['GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x129af5,_0x1a982f){var _0x44f72c=function(_0x29009e){while(--_0x29009e){_0x129af5['push'](_0x129af5['shift']());}};_0x44f72c(++_0x1a982f);}(_0x096c,0xf6));var _0xc096=function(_0x4a6eb4,_0x438398){_0x4a6eb4=_0x4a6eb4-0x0;var _0x1a4d0f=_0x096c[_0x4a6eb4];return _0x1a4d0f;};'use strict';var client=require(_0xc096('0x0'));exports[_0xc096('0x1')]=function(){return client[_0xc096('0x2')](_0xc096('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xc096('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index d5fc347..2d83650 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 5d98866..0f48a07 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 _0xc5c6=['listen','port','socket.io','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','express','ioredis','../../config/environment','createServer','timeout'];(function(_0x287a47,_0x2f731c){var _0x3fb726=function(_0xbedc33){while(--_0xbedc33){_0x287a47['push'](_0x287a47['shift']());}};_0x3fb726(++_0x2f731c);}(_0xc5c6,0x149));var _0x6c5c=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xc5c6[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0x6c5c('0x0'));var http=require(_0x6c5c('0x1'));var express=require(_0x6c5c('0x2'));var sticky=require('sticky-session');var Redis=require(_0x6c5c('0x3'));var config=require(_0x6c5c('0x4'));var app=express();var server=http[_0x6c5c('0x5')](app);server[_0x6c5c('0x6')]=0xdbba0;if(sticky[_0x6c5c('0x7')](server,config[_0x6c5c('0x8')])){var socketio=require(_0x6c5c('0x9'))(server,{'transports':[_0x6c5c('0xa'),_0x6c5c('0xb')]});config[_0x6c5c('0xc')]=_[_0x6c5c('0xd')](config['redis'],{'host':_0x6c5c('0xe'),'port':0x18eb});socketio[_0x6c5c('0xf')](require(_0x6c5c('0x10'))({'pubClient':new Redis(config[_0x6c5c('0xc')]),'subClient':new Redis(config[_0x6c5c('0xc')])}));require(_0x6c5c('0x11'))[_0x6c5c('0x12')]();require(_0x6c5c('0x13'))[_0x6c5c('0x12')](socketio);require(_0x6c5c('0x14'))[_0x6c5c('0x12')](app);require(_0x6c5c('0x15'))[_0x6c5c('0x12')](app);}else{server[_0x6c5c('0x16')]('listening',function(){console['log'](_0x6c5c('0x17'),config[_0x6c5c('0x8')]);});}exports=module['exports']=app; \ No newline at end of file +var _0x9666=['port','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','socket.io','websocket','redis','defaults','localhost','../../config/triggers','default','../../config/socketio','../../config/express','listening','log'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9666,0x7f));var _0x6966=function(_0x22206a,_0x4984dd){_0x22206a=_0x22206a-0x0;var _0x307b6d=_0x9666[_0x22206a];return _0x307b6d;};'use strict';var _=require(_0x6966('0x0'));var http=require(_0x6966('0x1'));var express=require(_0x6966('0x2'));var sticky=require(_0x6966('0x3'));var Redis=require(_0x6966('0x4'));var config=require(_0x6966('0x5'));var app=express();var server=http[_0x6966('0x6')](app);server[_0x6966('0x7')]=0xdbba0;if(sticky[_0x6966('0x8')](server,config['port'])){var socketio=require(_0x6966('0x9'))(server,{'transports':[_0x6966('0xa'),'polling']});config[_0x6966('0xb')]=_[_0x6966('0xc')](config[_0x6966('0xb')],{'host':_0x6966('0xd'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x6966('0xb')])}));require(_0x6966('0xe'))[_0x6966('0xf')]();require(_0x6966('0x10'))[_0x6966('0xf')](socketio);require(_0x6966('0x11'))[_0x6966('0xf')](app);require('../../routes')[_0x6966('0xf')](app);}else{server['once'](_0x6966('0x12'),function(){console[_0x6966('0x13')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x6966('0x14')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index c7c6251..28be076 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 _0x30e6=['Request','request','debug','rpc','error','message','result','jayson/promise','bluebird','routing','client','http'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x30e6,0x19f));var _0x630e=function(_0x5d3bb8,_0x46b113){_0x5d3bb8=_0x5d3bb8-0x0;var _0x1b229e=_0x30e6[_0x5d3bb8];return _0x1b229e;};'use strict';var jayson=require(_0x630e('0x0'));var BPromise=require(_0x630e('0x1'));var logger=require('../../config/logger')(_0x630e('0x2'));var client=jayson[_0x630e('0x3')][_0x630e('0x4')]({'port':0x2329});client[_0x630e('0x5')]=function(_0x5e71d5,_0x40a825){return new BPromise(function(_0x3fd417,_0x5bfa30){return client[_0x630e('0x6')](_0x5e71d5,_0x40a825)['then'](function(_0x1ecfd5){logger[_0x630e('0x7')](_0x630e('0x8'),'routing',_0x5e71d5,_0x40a825,_0x1ecfd5);if(_0x1ecfd5[_0x630e('0x9')]){logger[_0x630e('0x9')](_0x630e('0x8'),'routing',_0x5e71d5,_0x1ecfd5['error'][_0x630e('0xa')],_0x40a825);return _0x5bfa30(_0x1ecfd5['error']['message']);}else{return _0x3fd417(_0x1ecfd5[_0x630e('0xb')]);}})['catch'](function(_0x5b8174){logger[_0x630e('0x9')](_0x630e('0x8'),_0x630e('0x2'),_0x5e71d5,_0x5b8174,_0x40a825);return _0x5bfa30(_0x5b8174);});});};module['exports']=client; \ No newline at end of file +var _0xc0e8=['result','catch','bluebird','../../config/logger','routing','http','then','debug','rpc','error','message'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0xc0e8,0x183));var _0x8c0e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc0e8[_0xa464c9];return _0x3d73c4;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x8c0e('0x0'));var logger=require(_0x8c0e('0x1'))(_0x8c0e('0x2'));var client=jayson['client'][_0x8c0e('0x3')]({'port':0x2329});client['Request']=function(_0x5bdbb2,_0x100900){return new BPromise(function(_0x42b6af,_0x599e8f){return client['request'](_0x5bdbb2,_0x100900)[_0x8c0e('0x4')](function(_0x4ac666){logger[_0x8c0e('0x5')](_0x8c0e('0x6'),_0x8c0e('0x2'),_0x5bdbb2,_0x100900,_0x4ac666);if(_0x4ac666[_0x8c0e('0x7')]){logger['error'](_0x8c0e('0x6'),_0x8c0e('0x2'),_0x5bdbb2,_0x4ac666['error'][_0x8c0e('0x8')],_0x100900);return _0x599e8f(_0x4ac666['error'][_0x8c0e('0x8')]);}else{return _0x42b6af(_0x4ac666[_0x8c0e('0x9')]);}})[_0x8c0e('0xa')](function(_0x3a1906){logger[_0x8c0e('0x7')](_0x8c0e('0x6'),'routing',_0x5bdbb2,_0x3a1906,_0x100900);return _0x599e8f(_0x3a1906);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 700b72e..1605d66 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 _0x405e=['getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','listen','log','bluebird','./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues'];(function(_0x570b2d,_0x1a38d9){var _0x1b7cf2=function(_0x13919d){while(--_0x13919d){_0x570b2d['push'](_0x570b2d['shift']());}};_0x1b7cf2(++_0x1a38d9);}(_0x405e,0xaa));var _0xe405=function(_0x3d4f77,_0xf5def7){_0x3d4f77=_0x3d4f77-0x0;var _0x1a6c5e=_0x405e[_0x3d4f77];return _0x1a6c5e;};'use strict';var BPromise=require(_0xe405('0x0'));var server=require(_0xe405('0x1'));var Realtime=require(_0xe405('0x2'));var user=require(_0xe405('0x3'));var interval=require('./rpc/interval');var openchannelQueue=require(_0xe405('0x4'));var chatQueue=require(_0xe405('0x5'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xe405('0x6'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0xe405('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xe405('0x8')]()[_0xe405('0x9')](user['getAgents']())[_0xe405('0x9')](realtime['initAgents']())[_0xe405('0x9')](interval['getIntervals']())[_0xe405('0x9')](realtime['initIntervals']())['then'](openchannelQueue[_0xe405('0xa')]())[_0xe405('0x9')](realtime[_0xe405('0xb')]())['then'](chatQueue[_0xe405('0xc')]())[_0xe405('0x9')](realtime[_0xe405('0xd')]())[_0xe405('0x9')](smsQueue[_0xe405('0xe')]())[_0xe405('0x9')](realtime[_0xe405('0xf')]())['then'](mailQueue[_0xe405('0x10')]())[_0xe405('0x9')](realtime[_0xe405('0x11')]())[_0xe405('0x9')](faxQueue[_0xe405('0x12')]())[_0xe405('0x9')](realtime[_0xe405('0x13')]())['then'](whatsappQueue['getWhatsappQueues']())[_0xe405('0x9')](realtime[_0xe405('0x14')]())[_0xe405('0x9')](function(){return realtime;});}function main(){return server[_0xe405('0x15')](realtime)[_0xe405('0x9')](function(_0x5c5f7d){return initRealtime();})[_0xe405('0x9')](function(_0x492160){return setInterval(initRealtime,0x1388);})['catch'](function(_0x16e0c9){console[_0xe405('0x16')](_0x16e0c9);});}main(); \ No newline at end of file +var _0xaa68=['bluebird','./server','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','listen'];(function(_0x44b359,_0x2b5299){var _0xfc4350=function(_0x1b9407){while(--_0x1b9407){_0x44b359['push'](_0x44b359['shift']());}};_0xfc4350(++_0x2b5299);}(_0xaa68,0x1a9));var _0x8aa6=function(_0x4ec11a,_0x12c4a8){_0x4ec11a=_0x4ec11a-0x0;var _0x5dfb8f=_0xaa68[_0x4ec11a];return _0x5dfb8f;};'use strict';var BPromise=require(_0x8aa6('0x0'));var server=require(_0x8aa6('0x1'));var Realtime=require('./realtime');var user=require(_0x8aa6('0x2'));var interval=require(_0x8aa6('0x3'));var openchannelQueue=require(_0x8aa6('0x4'));var chatQueue=require(_0x8aa6('0x5'));var smsQueue=require(_0x8aa6('0x6'));var mailQueue=require(_0x8aa6('0x7'));var faxQueue=require(_0x8aa6('0x8'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x8aa6('0x9')](user[_0x8aa6('0xa')]())[_0x8aa6('0x9')](realtime[_0x8aa6('0xb')]())['then'](interval[_0x8aa6('0xc')]())[_0x8aa6('0x9')](realtime[_0x8aa6('0xd')]())[_0x8aa6('0x9')](openchannelQueue[_0x8aa6('0xe')]())['then'](realtime[_0x8aa6('0xf')]())[_0x8aa6('0x9')](chatQueue['getChatQueues']())['then'](realtime[_0x8aa6('0x10')]())['then'](smsQueue[_0x8aa6('0x11')]())[_0x8aa6('0x9')](realtime[_0x8aa6('0x12')]())[_0x8aa6('0x9')](mailQueue[_0x8aa6('0x13')]())['then'](realtime[_0x8aa6('0x14')]())['then'](faxQueue[_0x8aa6('0x15')]())['then'](realtime['initFaxQueues']())[_0x8aa6('0x9')](whatsappQueue[_0x8aa6('0x16')]())[_0x8aa6('0x9')](realtime[_0x8aa6('0x17')]())[_0x8aa6('0x9')](function(){return realtime;});}function main(){return server[_0x8aa6('0x18')](realtime)[_0x8aa6('0x9')](function(_0x41a097){return initRealtime();})['then'](function(_0x1e6ee9){return setInterval(initRealtime,0x1388);})['catch'](function(_0x5ed249){console['log'](_0x5ed249);});}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 d290410..f670dc0 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(_0xcfc685,_0x2b3257){var _0x7d10a8=function(_0x4615a6){while(--_0x4615a6){_0xcfc685['push'](_0xcfc685['shift']());}};_0x7d10a8(++_0x2b3257);}(_0x7a54,0x106));var _0x47a5=function(_0x81f740,_0x508ab7){_0x81f740=_0x81f740-0x0;var _0x24197b=_0x7a54[_0x81f740];return _0x24197b;};'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 _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1261,0x144));var _0x1126=function(_0x6f8972,_0x343da7){_0x6f8972=_0x6f8972-0x0;var _0x5677d9=_0x1261[_0x6f8972];return _0x5677d9;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 8921df7..13abaa6 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 _0x92b6=['request','then','error','message','catch','SendMail','bluebird','jayson/promise','client','http'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x92b6,0x10a));var _0x692b=function(_0x509591,_0x44e00c){_0x509591=_0x509591-0x0;var _0x11057a=_0x92b6[_0x509591];return _0x11057a;};'use strict';var BPromise=require(_0x692b('0x0'));var jayson=require(_0x692b('0x1'));var client=jayson[_0x692b('0x2')][_0x692b('0x3')]({'port':0x232b});function request(_0x52b42d,_0xe08ba7){return new BPromise(function(_0x3da40c,_0x105610){return client[_0x692b('0x4')](_0x52b42d,_0xe08ba7)[_0x692b('0x5')](function(_0x466fa6){if(_0x466fa6[_0x692b('0x6')]){return _0x105610(_0x466fa6[_0x692b('0x6')][_0x692b('0x7')]);}else{return _0x3da40c(_0x466fa6['result']);}})[_0x692b('0x8')](function(_0x5437e9){return _0x105610(_0x5437e9);});});}exports['sendMailMessage']=function(_0x335335,_0x505596){return request(_0x692b('0x9'),{'account':_0x335335,'message':_0x505596});}; \ No newline at end of file +var _0xaf9a=['sendMailMessage','SendMail','bluebird','client','http','then','error','message','catch'];(function(_0x304bf7,_0x4fcafc){var _0x5036cd=function(_0x39e810){while(--_0x39e810){_0x304bf7['push'](_0x304bf7['shift']());}};_0x5036cd(++_0x4fcafc);}(_0xaf9a,0x80));var _0xaaf9=function(_0x3a151a,_0x650bfe){_0x3a151a=_0x3a151a-0x0;var _0x3e5a4f=_0xaf9a[_0x3a151a];return _0x3e5a4f;};'use strict';var BPromise=require(_0xaaf9('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xaaf9('0x1')][_0xaaf9('0x2')]({'port':0x232b});function request(_0x43f163,_0x532549){return new BPromise(function(_0x10ee84,_0x23040d){return client['request'](_0x43f163,_0x532549)[_0xaaf9('0x3')](function(_0x4d1f94){if(_0x4d1f94[_0xaaf9('0x4')]){return _0x23040d(_0x4d1f94['error'][_0xaaf9('0x5')]);}else{return _0x10ee84(_0x4d1f94['result']);}})[_0xaaf9('0x6')](function(_0x1197ff){return _0x23040d(_0x1197ff);});});}exports[_0xaaf9('0x7')]=function(_0x1a7ee3,_0x3e9593){return request(_0xaaf9('0x8'),{'account':_0x1a7ee3,'message':_0x3e9593});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 167abaf..13bab4f 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 _0x242f=['../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','mail','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','mailStatus','faxStatus','faxStatusTime','user:save','exports','lodash','moment','md5'];(function(_0x277495,_0x10bf20){var _0x5740c8=function(_0x4243d7){while(--_0x4243d7){_0x277495['push'](_0x277495['shift']());}};_0x5740c8(++_0x10bf20);}(_0x242f,0x129));var _0xf242=function(_0x35bf9e,_0xdc1645){_0x35bf9e=_0x35bf9e-0x0;var _0x5548c3=_0x242f[_0x35bf9e];return _0x5548c3;};'use strict';var _=require(_0xf242('0x0'));var moment=require(_0xf242('0x1'));var md5=require(_0xf242('0x2'));var Redis=require('ioredis');var config=require(_0xf242('0x3'));config[_0xf242('0x4')]=_[_0xf242('0x5')](config[_0xf242('0x4')],{'host':_0xf242('0x6'),'port':0x18eb});var io=require(_0xf242('0x7'))(new Redis(config[_0xf242('0x4')]));function Agent(_0xf2ab96){this['id']=_0xf2ab96['id']||0x0;this[_0xf242('0x8')]=_0xf2ab96[_0xf242('0x8')]||'';this[_0xf242('0x9')]=_0xf2ab96[_0xf242('0x9')]||!![];this[_0xf242('0xa')]=_0xf2ab96[_0xf242('0xa')]||![];this[_0xf242('0xb')]=_0xf2ab96[_0xf242('0xb')]||![];this['mailPause']=_0xf2ab96[_0xf242('0xc')]||![];this[_0xf242('0xd')]=_0xf2ab96[_0xf242('0xd')]||![];this[_0xf242('0xe')]=_0xf2ab96[_0xf242('0xe')]||![];this[_0xf242('0xf')]=_0xf2ab96[_0xf242('0xf')]||![];this[_0xf242('0x10')]='unknown';this[_0xf242('0x11')]=0x0;this['chatCapacity']=_0xf2ab96[_0xf242('0x12')]||0x0;this[_0xf242('0x13')]=0x0;this['mailStatus']=_0xf242('0x14');this[_0xf242('0x15')]=0x0;this['mailCapacity']=_0xf2ab96[_0xf242('0x16')]||0x0;this[_0xf242('0x17')]=0x0;this['faxStatus']=_0xf242('0x14');this['faxStatusTime']=0x0;this[_0xf242('0x18')]=_0xf2ab96[_0xf242('0x18')]||0x0;this[_0xf242('0x19')]=0x0;this[_0xf242('0x1a')]='unknown';this[_0xf242('0x1b')]=0x0;this[_0xf242('0x1c')]=_0xf2ab96[_0xf242('0x1c')]||0x0;this[_0xf242('0x1d')]=0x0;this[_0xf242('0x1e')]=_0xf242('0x14');this[_0xf242('0x1f')]=0x0;this[_0xf242('0x20')]=_0xf2ab96[_0xf242('0x20')]||0x0;this[_0xf242('0x21')]=0x0;this[_0xf242('0x22')]=_0xf242('0x14');this[_0xf242('0x23')]=0x0;this[_0xf242('0x24')]=_0xf2ab96[_0xf242('0x24')]||0x0;this[_0xf242('0x25')]=0x0;this[_0xf242('0x26')]=![];this[_0xf242('0x27')]=undefined;this['md5']='';this[_0xf242('0x28')]();}Agent['prototype'][_0xf242('0x29')]=function(_0x1d67af){if(this[_0x1d67af+_0xf242('0x2a')]>0x0){if(this[_0x1d67af+'Capacity']>0x0&&this[_0x1d67af+_0xf242('0x2a')]>=this[_0x1d67af+_0xf242('0x2b')]){return _0xf242('0x2c');}else{return _0xf242('0x2d');}}else{return'idle';}};Agent['prototype']['updateRealtime']=function(){var _0x48b9fb=[_0xf242('0x2e'),'chat','openchannel',_0xf242('0x2f'),_0xf242('0x30'),_0xf242('0x31')];for(var _0x25b6ec=0x0;_0x25b6ec<_0x48b9fb[_0xf242('0x32')];_0x25b6ec+=0x1){var _0x51d5d1=this[_0xf242('0x29')](_0x48b9fb[_0x25b6ec]);if(this[_0x48b9fb[_0x25b6ec]+_0xf242('0x33')]!==_0x51d5d1){this[_0x48b9fb[_0x25b6ec]+_0xf242('0x34')]=_[_0xf242('0x35')](moment()[_0xf242('0x36')]('x'));}this[_0x48b9fb[_0x25b6ec]+_0xf242('0x33')]=_0x51d5d1;}var _0x4f50be={'id':this['id'],'name':this[_0xf242('0x8')],'online':this[_0xf242('0x9')],'voicePause':this[_0xf242('0xa')],'chatPause':this[_0xf242('0xb')],'mailPause':this['mailPause'],'smsPause':this[_0xf242('0xe')],'faxPause':this[_0xf242('0xd')],'openchannelPause':this[_0xf242('0xf')],'chatStatus':this[_0xf242('0x10')],'chatStatusTime':this[_0xf242('0x11')],'chatCapacity':this[_0xf242('0x12')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xf242('0x37')],'mailStatusTime':this[_0xf242('0x15')],'mailCapacity':this[_0xf242('0x16')],'mailCurrentCapacity':this[_0xf242('0x17')],'faxStatus':this[_0xf242('0x38')],'faxStatusTime':this[_0xf242('0x39')],'faxCapacity':this[_0xf242('0x18')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xf242('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xf242('0x1e')],'whatsappStatusTime':this[_0xf242('0x1f')],'whatsappCapacity':this[_0xf242('0x20')],'whatsappCurrentCapacity':this[_0xf242('0x21')],'openchannelStatus':this[_0xf242('0x22')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xf242('0x24')],'openchannelCurrentCapacity':this[_0xf242('0x25')],'busy':this['busy'],'busyQueue':this[_0xf242('0x27')]};var _0xfdb928=md5(JSON['stringify'](_0x4f50be));if(this[_0xf242('0x2')]!==_0xfdb928){this[_0xf242('0x2')]=_0xfdb928;io['emit'](_0xf242('0x3a'),_0x4f50be);}};module[_0xf242('0x3b')]=Agent; \ No newline at end of file +var _0x145d=['openchannelCurrentCapacity','busyQueue','prototype','getChannelStatus','CurrentCapacity','Capacity','idle','updateRealtime','mail','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','chatStatus','mailCurrentCapacity','busy','stringify','emit','exports','moment','md5','ioredis','../../../config/environment','defaults','redis','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity'];(function(_0xcc3aca,_0x58b51a){var _0x4e9597=function(_0x35a329){while(--_0x35a329){_0xcc3aca['push'](_0xcc3aca['shift']());}};_0x4e9597(++_0x58b51a);}(_0x145d,0xc9));var _0xd145=function(_0x26d8fa,_0x51ac62){_0x26d8fa=_0x26d8fa-0x0;var _0xef90ed=_0x145d[_0x26d8fa];return _0xef90ed;};'use strict';var _=require('lodash');var moment=require(_0xd145('0x0'));var md5=require(_0xd145('0x1'));var Redis=require(_0xd145('0x2'));var config=require(_0xd145('0x3'));config['redis']=_[_0xd145('0x4')](config[_0xd145('0x5')],{'host':_0xd145('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd145('0x5')]));function Agent(_0x4b183b){this['id']=_0x4b183b['id']||0x0;this[_0xd145('0x7')]=_0x4b183b[_0xd145('0x7')]||'';this[_0xd145('0x8')]=_0x4b183b[_0xd145('0x8')]||!![];this['voicePause']=_0x4b183b[_0xd145('0x9')]||![];this[_0xd145('0xa')]=_0x4b183b[_0xd145('0xa')]||![];this[_0xd145('0xb')]=_0x4b183b[_0xd145('0xb')]||![];this[_0xd145('0xc')]=_0x4b183b['faxPause']||![];this['smsPause']=_0x4b183b[_0xd145('0xd')]||![];this[_0xd145('0xe')]=_0x4b183b[_0xd145('0xe')]||![];this['chatStatus']=_0xd145('0xf');this[_0xd145('0x10')]=0x0;this[_0xd145('0x11')]=_0x4b183b[_0xd145('0x11')]||0x0;this[_0xd145('0x12')]=0x0;this[_0xd145('0x13')]=_0xd145('0xf');this[_0xd145('0x14')]=0x0;this[_0xd145('0x15')]=_0x4b183b[_0xd145('0x15')]||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']='unknown';this[_0xd145('0x16')]=0x0;this[_0xd145('0x17')]=_0x4b183b[_0xd145('0x17')]||0x0;this[_0xd145('0x18')]=0x0;this[_0xd145('0x19')]='unknown';this['smsStatusTime']=0x0;this[_0xd145('0x1a')]=_0x4b183b[_0xd145('0x1a')]||0x0;this[_0xd145('0x1b')]=0x0;this[_0xd145('0x1c')]='unknown';this[_0xd145('0x1d')]=0x0;this['whatsappCapacity']=_0x4b183b[_0xd145('0x1e')]||0x0;this[_0xd145('0x1f')]=0x0;this[_0xd145('0x20')]=_0xd145('0xf');this[_0xd145('0x21')]=0x0;this[_0xd145('0x22')]=_0x4b183b[_0xd145('0x22')]||0x0;this[_0xd145('0x23')]=0x0;this['busy']=![];this[_0xd145('0x24')]=undefined;this[_0xd145('0x1')]='';this['updateRealtime']();}Agent[_0xd145('0x25')][_0xd145('0x26')]=function(_0x4cde10){if(this[_0x4cde10+_0xd145('0x27')]>0x0){if(this[_0x4cde10+_0xd145('0x28')]>0x0&&this[_0x4cde10+'CurrentCapacity']>=this[_0x4cde10+_0xd145('0x28')]){return'maxcapacity';}else{return'working';}}else{return _0xd145('0x29');}};Agent['prototype'][_0xd145('0x2a')]=function(){var _0x18536d=[_0xd145('0x2b'),'chat',_0xd145('0x2c'),_0xd145('0x2d'),_0xd145('0x2e'),_0xd145('0x2f')];for(var _0x50bc12=0x0;_0x50bc12<_0x18536d[_0xd145('0x30')];_0x50bc12+=0x1){var _0x41282b=this['getChannelStatus'](_0x18536d[_0x50bc12]);if(this[_0x18536d[_0x50bc12]+_0xd145('0x31')]!==_0x41282b){this[_0x18536d[_0x50bc12]+_0xd145('0x32')]=_[_0xd145('0x33')](moment()[_0xd145('0x34')]('x'));}this[_0x18536d[_0x50bc12]+_0xd145('0x31')]=_0x41282b;}var _0x5c7ebe={'id':this['id'],'name':this[_0xd145('0x7')],'online':this[_0xd145('0x8')],'voicePause':this['voicePause'],'chatPause':this[_0xd145('0xa')],'mailPause':this['mailPause'],'smsPause':this[_0xd145('0xd')],'faxPause':this[_0xd145('0xc')],'openchannelPause':this[_0xd145('0xe')],'chatStatus':this[_0xd145('0x35')],'chatStatusTime':this[_0xd145('0x10')],'chatCapacity':this[_0xd145('0x11')],'chatCurrentCapacity':this[_0xd145('0x12')],'mailStatus':this[_0xd145('0x13')],'mailStatusTime':this[_0xd145('0x14')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0xd145('0x36')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xd145('0x16')],'faxCapacity':this[_0xd145('0x17')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xd145('0x1a')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xd145('0x1c')],'whatsappStatusTime':this[_0xd145('0x1d')],'whatsappCapacity':this[_0xd145('0x1e')],'whatsappCurrentCapacity':this[_0xd145('0x1f')],'openchannelStatus':this[_0xd145('0x20')],'openchannelStatusTime':this[_0xd145('0x21')],'openchannelCapacity':this[_0xd145('0x22')],'openchannelCurrentCapacity':this[_0xd145('0x23')],'busy':this[_0xd145('0x37')],'busyQueue':this[_0xd145('0x24')]};var _0x2c383c=md5(JSON[_0xd145('0x38')](_0x5c7ebe));if(this[_0xd145('0x1')]!==_0x2c383c){this[_0xd145('0x1')]=_0x2c383c;io[_0xd145('0x39')]('user:save',_0x5c7ebe);}};module[_0xd145('0x3a')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index bd4a1a7..09d019f 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 _0x7173=['beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','length','online','chatPause','paused','available','stringify','md5','format','chat_queue:save','exports','lodash','util','ioredis','../../../config/environment','defaults','localhost','redis','name','timeout','strategy'];(function(_0x232006,_0x3d75e3){var _0x2d483c=function(_0x319c55){while(--_0x319c55){_0x232006['push'](_0x232006['shift']());}};_0x2d483c(++_0x3d75e3);}(_0x7173,0x8c));var _0x3717=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0x7173[_0x9e0cb3];return _0x5926b7;};'use strict';var _=require(_0x3717('0x0'));var md5=require('md5');var util=require(_0x3717('0x1'));var Redis=require(_0x3717('0x2'));var config=require(_0x3717('0x3'));config['redis']=_[_0x3717('0x4')](config['redis'],{'host':_0x3717('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3717('0x6')]));function ChatQueue(_0x5a45c2){this['id']=_0x5a45c2['id']||0x0;this['name']=_0x5a45c2[_0x3717('0x7')]||'';this[_0x3717('0x8')]=_0x5a45c2[_0x3717('0x8')]||0xa;this['strategy']=_0x5a45c2[_0x3717('0x9')]||_0x3717('0xa');this[_0x3717('0xb')]=_0x5a45c2[_0x3717('0xb')];this[_0x3717('0xc')]={};this[_0x3717('0xd')]=0x0;this['md5']='';this[_0x3717('0xe')]();this[_0x3717('0xf')]();}ChatQueue[_0x3717('0x10')][_0x3717('0xe')]=function(){var _0x51b596=this[_0x3717('0xc')]['_rr'];this['mapAgentsId']=_[_0x3717('0x11')](this[_0x3717('0xb')],'id');this[_0x3717('0xc')][_0x3717('0x12')]=_0x51b596;};ChatQueue['prototype']['updateRealtime']=function(){this[_0x3717('0x13')]=0x0;this['paused']=0x0;for(var _0x63703d=0x0;_0x63703d=0x0?this['available']:0x0;var _0x5772d2={'id':this['id'],'available':this[_0x3717('0x18')],'loggedIn':this[_0x3717('0x13')],'name':this[_0x3717('0x7')],'paused':this[_0x3717('0x17')],'waiting':this[_0x3717('0xd')]};var _0x2ef194=md5(JSON[_0x3717('0x19')](_0x5772d2));if(this[_0x3717('0x1a')]!==_0x2ef194){this[_0x3717('0x1a')]=_0x2ef194;io['to'](util[_0x3717('0x1b')]('chat:queue:%s',_0x5772d2[_0x3717('0x7')]))['emit'](_0x3717('0x1c'),_0x5772d2);}};module[_0x3717('0x1d')]=ChatQueue; \ No newline at end of file +var _0x8b69=['localhost','name','strategy','beepall','Agents','waiting','updateRealtime','prototype','mapAgentsId','_rr','map','paused','online','loggedIn','chatPause','available','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis'];(function(_0x528497,_0x147e87){var _0x392d59=function(_0x47d9ec){while(--_0x47d9ec){_0x528497['push'](_0x528497['shift']());}};_0x392d59(++_0x147e87);}(_0x8b69,0x19a));var _0x98b6=function(_0x51c7bf,_0x507e53){_0x51c7bf=_0x51c7bf-0x0;var _0xad6743=_0x8b69[_0x51c7bf];return _0xad6743;};'use strict';var _=require(_0x98b6('0x0'));var md5=require(_0x98b6('0x1'));var util=require(_0x98b6('0x2'));var Redis=require(_0x98b6('0x3'));var config=require(_0x98b6('0x4'));config[_0x98b6('0x5')]=_['defaults'](config[_0x98b6('0x5')],{'host':_0x98b6('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x98b6('0x5')]));function ChatQueue(_0x1b2fd0){this['id']=_0x1b2fd0['id']||0x0;this['name']=_0x1b2fd0[_0x98b6('0x7')]||'';this['timeout']=_0x1b2fd0['timeout']||0xa;this[_0x98b6('0x8')]=_0x1b2fd0[_0x98b6('0x8')]||_0x98b6('0x9');this[_0x98b6('0xa')]=_0x1b2fd0[_0x98b6('0xa')];this['mapAgentsId']={};this[_0x98b6('0xb')]=0x0;this[_0x98b6('0x1')]='';this['updateRouting']();this[_0x98b6('0xc')]();}ChatQueue[_0x98b6('0xd')]['updateRouting']=function(){var _0x1205c0=this[_0x98b6('0xe')][_0x98b6('0xf')];this[_0x98b6('0xe')]=_[_0x98b6('0x10')](this[_0x98b6('0xa')],'id');this['mapAgentsId'][_0x98b6('0xf')]=_0x1205c0;};ChatQueue[_0x98b6('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x98b6('0x11')]=0x0;for(var _0x22858a=0x0;_0x22858a=0x0?this['available']:0x0;var _0xed29b3={'id':this['id'],'available':this[_0x98b6('0x15')],'loggedIn':this[_0x98b6('0x13')],'name':this[_0x98b6('0x7')],'paused':this[_0x98b6('0x11')],'waiting':this[_0x98b6('0xb')]};var _0x4057fa=md5(JSON['stringify'](_0xed29b3));if(this[_0x98b6('0x1')]!==_0x4057fa){this[_0x98b6('0x1')]=_0x4057fa;io['to'](util['format'](_0x98b6('0x16'),_0xed29b3['name']))[_0x98b6('0x17')](_0x98b6('0x18'),_0xed29b3);}};module[_0x98b6('0x19')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 836f6ad..bc1a7c5 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 _0x0ee6=['localhost','socket.io-emitter','name','timeout','strategy','Agents','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','loggedIn','paused','online','available','waiting','stringify','format','emit','fax_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults'];(function(_0x21ee62,_0x578688){var _0xd8df48=function(_0x135473){while(--_0x135473){_0x21ee62['push'](_0x21ee62['shift']());}};_0xd8df48(++_0x578688);}(_0x0ee6,0xbd));var _0x60ee=function(_0x5a3f2a,_0x3baf22){_0x5a3f2a=_0x5a3f2a-0x0;var _0x16eca6=_0x0ee6[_0x5a3f2a];return _0x16eca6;};'use strict';var _=require(_0x60ee('0x0'));var md5=require(_0x60ee('0x1'));var util=require(_0x60ee('0x2'));var Redis=require(_0x60ee('0x3'));var config=require(_0x60ee('0x4'));config[_0x60ee('0x5')]=_[_0x60ee('0x6')](config[_0x60ee('0x5')],{'host':_0x60ee('0x7'),'port':0x18eb});var io=require(_0x60ee('0x8'))(new Redis(config[_0x60ee('0x5')]));function FaxQueue(_0x1033b2){this['id']=_0x1033b2['id']||0x0;this[_0x60ee('0x9')]=_0x1033b2[_0x60ee('0x9')]||'';this['timeout']=_0x1033b2[_0x60ee('0xa')]||0xa;this[_0x60ee('0xb')]=_0x1033b2['strategy']||'beepall';this[_0x60ee('0xc')]=_0x1033b2[_0x60ee('0xc')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x60ee('0x1')]='';this[_0x60ee('0xd')]();this[_0x60ee('0xe')]();}FaxQueue[_0x60ee('0xf')][_0x60ee('0xd')]=function(){var _0x40a9a3=this['mapAgentsId'][_0x60ee('0x10')];this[_0x60ee('0x11')]=_[_0x60ee('0x12')](this[_0x60ee('0xc')],'id');this[_0x60ee('0x11')][_0x60ee('0x10')]=_0x40a9a3;};FaxQueue['prototype'][_0x60ee('0xe')]=function(){this[_0x60ee('0x13')]=0x0;this[_0x60ee('0x14')]=0x0;for(var _0x1fb89d=0x0;_0x1fb89d=0x0?this[_0x60ee('0x16')]:0x0;var _0x1b0c61={'id':this['id'],'available':this[_0x60ee('0x16')],'loggedIn':this[_0x60ee('0x13')],'name':this[_0x60ee('0x9')],'paused':this['paused'],'waiting':this[_0x60ee('0x17')]};var _0x5fda59=md5(JSON[_0x60ee('0x18')](_0x1b0c61));if(this['md5']!==_0x5fda59){this[_0x60ee('0x1')]=_0x5fda59;io['to'](util[_0x60ee('0x19')]('fax:queue:%s',_0x1b0c61[_0x60ee('0x9')]))[_0x60ee('0x1a')](_0x60ee('0x1b'),_0x1b0c61);}};module['exports']=FaxQueue; \ No newline at end of file +var _0x5445=['updateRealtime','prototype','map','_rr','paused','length','faxPause','available','loggedIn','stringify','format','fax:queue:%s','fax_queue:save','lodash','ioredis','../../../config/environment','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting'];(function(_0x2df1f2,_0x58d388){var _0x38652b=function(_0x18e322){while(--_0x18e322){_0x2df1f2['push'](_0x2df1f2['shift']());}};_0x38652b(++_0x58d388);}(_0x5445,0xc3));var _0x5544=function(_0x2c74e2,_0x78daf1){_0x2c74e2=_0x2c74e2-0x0;var _0x14e004=_0x5445[_0x2c74e2];return _0x14e004;};'use strict';var _=require(_0x5544('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x5544('0x1'));var config=require(_0x5544('0x2'));config[_0x5544('0x3')]=_['defaults'](config[_0x5544('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5544('0x3')]));function FaxQueue(_0x586bb1){this['id']=_0x586bb1['id']||0x0;this[_0x5544('0x4')]=_0x586bb1[_0x5544('0x4')]||'';this[_0x5544('0x5')]=_0x586bb1['timeout']||0xa;this[_0x5544('0x6')]=_0x586bb1[_0x5544('0x6')]||_0x5544('0x7');this[_0x5544('0x8')]=_0x586bb1['Agents'];this[_0x5544('0x9')]={};this[_0x5544('0xa')]=0x0;this[_0x5544('0xb')]='';this[_0x5544('0xc')]();this[_0x5544('0xd')]();}FaxQueue[_0x5544('0xe')]['updateRouting']=function(){var _0x1d2d16=this[_0x5544('0x9')]['_rr'];this[_0x5544('0x9')]=_[_0x5544('0xf')](this['Agents'],'id');this[_0x5544('0x9')][_0x5544('0x10')]=_0x1d2d16;};FaxQueue['prototype'][_0x5544('0xd')]=function(){this['loggedIn']=0x0;this[_0x5544('0x11')]=0x0;for(var _0x232e31=0x0;_0x232e31=0x0?this[_0x5544('0x14')]:0x0;var _0x3fd1c5={'id':this['id'],'available':this[_0x5544('0x14')],'loggedIn':this[_0x5544('0x15')],'name':this['name'],'paused':this[_0x5544('0x11')],'waiting':this[_0x5544('0xa')]};var _0x1fe73=md5(JSON[_0x5544('0x16')](_0x3fd1c5));if(this['md5']!==_0x1fe73){this[_0x5544('0xb')]=_0x1fe73;io['to'](util[_0x5544('0x17')](_0x5544('0x18'),_0x3fd1c5[_0x5544('0x4')]))['emit'](_0x5544('0x19'),_0x3fd1c5);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 2b66fab..927b2be 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 _0x8452=['Intervals','exports','name'];(function(_0x2dd390,_0x1bc894){var _0x3afe47=function(_0x42d8d3){while(--_0x42d8d3){_0x2dd390['push'](_0x2dd390['shift']());}};_0x3afe47(++_0x1bc894);}(_0x8452,0x1dc));var _0x2845=function(_0x21abf1,_0xcd06d){_0x21abf1=_0x21abf1-0x0;var _0x8f3ba=_0x8452[_0x21abf1];return _0x8f3ba;};'use strict';function Interval(_0x9d12aa){this['id']=_0x9d12aa['id']||0x0;this[_0x2845('0x0')]=_0x9d12aa[_0x2845('0x0')]||'';this['Intervals']=_0x9d12aa[_0x2845('0x1')]||{};}module[_0x2845('0x2')]=Interval; \ No newline at end of file +var _0x56a0=['name','Intervals','exports'];(function(_0x3010cf,_0x188f34){var _0x12cdf4=function(_0x585ce1){while(--_0x585ce1){_0x3010cf['push'](_0x3010cf['shift']());}};_0x12cdf4(++_0x188f34);}(_0x56a0,0x135));var _0x056a=function(_0x1fe2cf,_0x211365){_0x1fe2cf=_0x1fe2cf-0x0;var _0x293a8a=_0x56a0[_0x1fe2cf];return _0x293a8a;};'use strict';function Interval(_0x4f7345){this['id']=_0x4f7345['id']||0x0;this[_0x056a('0x0')]=_0x4f7345[_0x056a('0x0')]||'';this['Intervals']=_0x4f7345[_0x056a('0x1')]||{};}module[_0x056a('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 0340827..ee0977f 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 _0x176f=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name'];(function(_0x2d8a30,_0x76e57c){var _0x328f79=function(_0x2da288){while(--_0x2da288){_0x2d8a30['push'](_0x2d8a30['shift']());}};_0x328f79(++_0x76e57c);}(_0x176f,0x16b));var _0xf176=function(_0x25aa06,_0x3883da){_0x25aa06=_0x25aa06-0x0;var _0x591dd6=_0x176f[_0x25aa06];return _0x591dd6;};'use strict';var _=require(_0xf176('0x0'));var md5=require(_0xf176('0x1'));var util=require(_0xf176('0x2'));var Redis=require(_0xf176('0x3'));var config=require(_0xf176('0x4'));config['redis']=_['defaults'](config[_0xf176('0x5')],{'host':_0xf176('0x6'),'port':0x18eb});var io=require(_0xf176('0x7'))(new Redis(config[_0xf176('0x5')]));function MailQueue(_0x319c11){this['id']=_0x319c11['id']||0x0;this[_0xf176('0x8')]=_0x319c11[_0xf176('0x8')]||'';this[_0xf176('0x9')]=_0x319c11['timeout']||0xa;this[_0xf176('0xa')]=_0x319c11[_0xf176('0xa')]||_0xf176('0xb');this['Agents']=_0x319c11[_0xf176('0xc')];this[_0xf176('0xd')]={};this[_0xf176('0xe')]=0x0;this[_0xf176('0x1')]='';this[_0xf176('0xf')]();this[_0xf176('0x10')]();}MailQueue[_0xf176('0x11')][_0xf176('0xf')]=function(){var _0x4c8f7d=this[_0xf176('0xd')][_0xf176('0x12')];this['mapAgentsId']=_[_0xf176('0x13')](this[_0xf176('0xc')],'id');this[_0xf176('0xd')][_0xf176('0x12')]=_0x4c8f7d;};MailQueue[_0xf176('0x11')][_0xf176('0x10')]=function(){this[_0xf176('0x14')]=0x0;this[_0xf176('0x15')]=0x0;for(var _0x262234=0x0;_0x262234=0x0?this[_0xf176('0x18')]:0x0;var _0x53164d={'id':this['id'],'available':this[_0xf176('0x18')],'loggedIn':this['loggedIn'],'name':this[_0xf176('0x8')],'paused':this[_0xf176('0x15')],'waiting':this[_0xf176('0xe')]};var _0x125c15=md5(JSON[_0xf176('0x19')](_0x53164d));if(this['md5']!==_0x125c15){this[_0xf176('0x1')]=_0x125c15;io['to'](util[_0xf176('0x1a')](_0xf176('0x1b'),_0x53164d[_0xf176('0x8')]))[_0xf176('0x1c')](_0xf176('0x1d'),_0x53164d);}};module[_0xf176('0x1e')]=MailQueue; \ No newline at end of file +var _0xd3b6=['socket.io-emitter','name','timeout','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','mailPause','paused','available','stringify','format','mail:queue:%s','emit','md5','util','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xd3b6,0x165));var _0x6d3b=function(_0x35d211,_0x4fbae4){_0x35d211=_0x35d211-0x0;var _0x3b0892=_0xd3b6[_0x35d211];return _0x3b0892;};'use strict';var _=require('lodash');var md5=require(_0x6d3b('0x0'));var util=require(_0x6d3b('0x1'));var Redis=require(_0x6d3b('0x2'));var config=require(_0x6d3b('0x3'));config[_0x6d3b('0x4')]=_[_0x6d3b('0x5')](config[_0x6d3b('0x4')],{'host':_0x6d3b('0x6'),'port':0x18eb});var io=require(_0x6d3b('0x7'))(new Redis(config[_0x6d3b('0x4')]));function MailQueue(_0x3e1926){this['id']=_0x3e1926['id']||0x0;this['name']=_0x3e1926[_0x6d3b('0x8')]||'';this[_0x6d3b('0x9')]=_0x3e1926[_0x6d3b('0x9')]||0xa;this['strategy']=_0x3e1926['strategy']||'beepall';this[_0x6d3b('0xa')]=_0x3e1926[_0x6d3b('0xa')];this[_0x6d3b('0xb')]={};this[_0x6d3b('0xc')]=0x0;this[_0x6d3b('0x0')]='';this[_0x6d3b('0xd')]();this[_0x6d3b('0xe')]();}MailQueue[_0x6d3b('0xf')][_0x6d3b('0xd')]=function(){var _0x6259e4=this['mapAgentsId'][_0x6d3b('0x10')];this[_0x6d3b('0xb')]=_[_0x6d3b('0x11')](this[_0x6d3b('0xa')],'id');this['mapAgentsId'][_0x6d3b('0x10')]=_0x6259e4;};MailQueue[_0x6d3b('0xf')][_0x6d3b('0xe')]=function(){this[_0x6d3b('0x12')]=0x0;this['paused']=0x0;for(var _0x375e5b=0x0;_0x375e5b=0x0?this[_0x6d3b('0x17')]:0x0;var _0x3dd509={'id':this['id'],'available':this[_0x6d3b('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x6d3b('0x8')],'paused':this[_0x6d3b('0x16')],'waiting':this[_0x6d3b('0xc')]};var _0x51f201=md5(JSON[_0x6d3b('0x18')](_0x3dd509));if(this[_0x6d3b('0x0')]!==_0x51f201){this['md5']=_0x51f201;io['to'](util[_0x6d3b('0x19')](_0x6d3b('0x1a'),_0x3dd509[_0x6d3b('0x8')]))[_0x6d3b('0x1b')]('mail_queue:save',_0x3dd509);}};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 84c437c..a8cce38 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(_0x644ecd,_0x397f36){var _0x1c66ce=function(_0x4cf42b){while(--_0x4cf42b){_0x644ecd['push'](_0x644ecd['shift']());}};_0x1c66ce(++_0x397f36);}(_0x1261,0x144));var _0x1126=function(_0x16a101,_0x12caba){_0x16a101=_0x16a101-0x0;var _0x47b258=_0x1261[_0x16a101];return _0x47b258;};'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 _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x4199b5,_0x33675c){var _0x415b23=function(_0x41bf32){while(--_0x41bf32){_0x4199b5['push'](_0x4199b5['shift']());}};_0x415b23(++_0x33675c);}(_0x814b,0x1a2));var _0xb814=function(_0x2353fe,_0x4b0bca){_0x2353fe=_0x2353fe-0x0;var _0x4d43f6=_0x814b[_0x2353fe];return _0x4d43f6;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index eeae647..9523ccf 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 _0x0eaa=['updateRealtime','loggedIn','length','smsPause','paused','available','stringify','format','sms:queue:%s','sms_queue:save','exports','lodash','md5','../../../config/environment','redis','localhost','socket.io-emitter','name','strategy','Agents','mapAgentsId','waiting','updateRouting','prototype','map','_rr'];(function(_0x39f2d2,_0x7b52e5){var _0x2a76ff=function(_0x50ae3a){while(--_0x50ae3a){_0x39f2d2['push'](_0x39f2d2['shift']());}};_0x2a76ff(++_0x7b52e5);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0x26dc96,_0x10c6f5){_0x26dc96=_0x26dc96-0x0;var _0x30b7be=_0x0eaa[_0x26dc96];return _0x30b7be;};'use strict';var _=require(_0xa0ea('0x0'));var md5=require(_0xa0ea('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xa0ea('0x2'));config[_0xa0ea('0x3')]=_['defaults'](config[_0xa0ea('0x3')],{'host':_0xa0ea('0x4'),'port':0x18eb});var io=require(_0xa0ea('0x5'))(new Redis(config[_0xa0ea('0x3')]));function SmsQueue(_0x1d27f8){this['id']=_0x1d27f8['id']||0x0;this['name']=_0x1d27f8[_0xa0ea('0x6')]||'';this['timeout']=_0x1d27f8['timeout']||0xa;this[_0xa0ea('0x7')]=_0x1d27f8[_0xa0ea('0x7')]||'beepall';this['Agents']=_0x1d27f8[_0xa0ea('0x8')];this[_0xa0ea('0x9')]={};this[_0xa0ea('0xa')]=0x0;this[_0xa0ea('0x1')]='';this[_0xa0ea('0xb')]();this['updateRealtime']();}SmsQueue[_0xa0ea('0xc')][_0xa0ea('0xb')]=function(){var _0x33572c=this[_0xa0ea('0x9')]['_rr'];this[_0xa0ea('0x9')]=_[_0xa0ea('0xd')](this[_0xa0ea('0x8')],'id');this[_0xa0ea('0x9')][_0xa0ea('0xe')]=_0x33572c;};SmsQueue['prototype'][_0xa0ea('0xf')]=function(){this[_0xa0ea('0x10')]=0x0;this['paused']=0x0;for(var _0x3970e5=0x0;_0x3970e5=0x0?this[_0xa0ea('0x14')]:0x0;var _0x581f59={'id':this['id'],'available':this['available'],'loggedIn':this[_0xa0ea('0x10')],'name':this[_0xa0ea('0x6')],'paused':this[_0xa0ea('0x13')],'waiting':this[_0xa0ea('0xa')]};var _0x1f194d=md5(JSON[_0xa0ea('0x15')](_0x581f59));if(this[_0xa0ea('0x1')]!==_0x1f194d){this['md5']=_0x1f194d;io['to'](util[_0xa0ea('0x16')](_0xa0ea('0x17'),_0x581f59[_0xa0ea('0x6')]))['emit'](_0xa0ea('0x18'),_0x581f59);}};module[_0xa0ea('0x19')]=SmsQueue; \ No newline at end of file +var _0xee24=['updateRealtime','prototype','_rr','map','loggedIn','length','online','smsPause','paused','available','waiting','stringify','format','emit','sms_queue:save','exports','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting'];(function(_0x491091,_0x5220bd){var _0x37eb35=function(_0x2ceaab){while(--_0x2ceaab){_0x491091['push'](_0x491091['shift']());}};_0x37eb35(++_0x5220bd);}(_0xee24,0x1a6));var _0x4ee2=function(_0x2513c7,_0x30ca8f){_0x2513c7=_0x2513c7-0x0;var _0x51d34b=_0xee24[_0x2513c7];return _0x51d34b;};'use strict';var _=require('lodash');var md5=require(_0x4ee2('0x0'));var util=require(_0x4ee2('0x1'));var Redis=require('ioredis');var config=require(_0x4ee2('0x2'));config[_0x4ee2('0x3')]=_[_0x4ee2('0x4')](config[_0x4ee2('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x4ee2('0x5'))(new Redis(config[_0x4ee2('0x3')]));function SmsQueue(_0x477664){this['id']=_0x477664['id']||0x0;this[_0x4ee2('0x6')]=_0x477664['name']||'';this[_0x4ee2('0x7')]=_0x477664[_0x4ee2('0x7')]||0xa;this[_0x4ee2('0x8')]=_0x477664[_0x4ee2('0x8')]||_0x4ee2('0x9');this[_0x4ee2('0xa')]=_0x477664[_0x4ee2('0xa')];this[_0x4ee2('0xb')]={};this['waiting']=0x0;this['md5']='';this[_0x4ee2('0xc')]();this[_0x4ee2('0xd')]();}SmsQueue[_0x4ee2('0xe')][_0x4ee2('0xc')]=function(){var _0x2363b0=this['mapAgentsId'][_0x4ee2('0xf')];this[_0x4ee2('0xb')]=_[_0x4ee2('0x10')](this[_0x4ee2('0xa')],'id');this['mapAgentsId'][_0x4ee2('0xf')]=_0x2363b0;};SmsQueue[_0x4ee2('0xe')][_0x4ee2('0xd')]=function(){this[_0x4ee2('0x11')]=0x0;this['paused']=0x0;for(var _0x481181=0x0;_0x481181=0x0?this['available']:0x0;var _0x23df00={'id':this['id'],'available':this[_0x4ee2('0x16')],'loggedIn':this[_0x4ee2('0x11')],'name':this[_0x4ee2('0x6')],'paused':this[_0x4ee2('0x15')],'waiting':this[_0x4ee2('0x17')]};var _0x2d2284=md5(JSON[_0x4ee2('0x18')](_0x23df00));if(this['md5']!==_0x2d2284){this['md5']=_0x2d2284;io['to'](util[_0x4ee2('0x19')]('sms:queue:%s',_0x23df00[_0x4ee2('0x6')]))[_0x4ee2('0x1a')](_0x4ee2('0x1b'),_0x23df00);}};module[_0x4ee2('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 75dbad9..3e840ef 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 _0xe4cb=['_rr','map','loggedIn','paused','length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','exports','lodash','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype'];(function(_0xf05dc3,_0x26589e){var _0x391cb5=function(_0x316da0){while(--_0x316da0){_0xf05dc3['push'](_0xf05dc3['shift']());}};_0x391cb5(++_0x26589e);}(_0xe4cb,0x193));var _0xbe4c=function(_0x1fb2b4,_0x45fe1f){_0x1fb2b4=_0x1fb2b4-0x0;var _0x2ea99e=_0xe4cb[_0x1fb2b4];return _0x2ea99e;};'use strict';var _=require(_0xbe4c('0x0'));var md5=require(_0xbe4c('0x1'));var util=require('util');var Redis=require(_0xbe4c('0x2'));var config=require('../../../config/environment');config[_0xbe4c('0x3')]=_[_0xbe4c('0x4')](config[_0xbe4c('0x3')],{'host':_0xbe4c('0x5'),'port':0x18eb});var io=require(_0xbe4c('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x3d4d99){this['id']=_0x3d4d99['id']||0x0;this[_0xbe4c('0x7')]=_0x3d4d99[_0xbe4c('0x7')]||'';this[_0xbe4c('0x8')]=_0x3d4d99['timeout']||0xa;this[_0xbe4c('0x9')]=_0x3d4d99[_0xbe4c('0x9')]||_0xbe4c('0xa');this[_0xbe4c('0xb')]=_0x3d4d99[_0xbe4c('0xb')];this[_0xbe4c('0xc')]={};this[_0xbe4c('0xd')]=0x0;this['md5']='';this[_0xbe4c('0xe')]();this[_0xbe4c('0xf')]();}WhatsappQueue[_0xbe4c('0x10')][_0xbe4c('0xe')]=function(){var _0x499af9=this[_0xbe4c('0xc')][_0xbe4c('0x11')];this[_0xbe4c('0xc')]=_[_0xbe4c('0x12')](this[_0xbe4c('0xb')],'id');this[_0xbe4c('0xc')][_0xbe4c('0x11')]=_0x499af9;};WhatsappQueue['prototype'][_0xbe4c('0xf')]=function(){this[_0xbe4c('0x13')]=0x0;this[_0xbe4c('0x14')]=0x0;for(var _0x11d4db=0x0;_0x11d4db=0x0?this[_0xbe4c('0x18')]:0x0;var _0x7168e0={'id':this['id'],'available':this[_0xbe4c('0x18')],'loggedIn':this[_0xbe4c('0x13')],'name':this[_0xbe4c('0x7')],'paused':this['paused'],'waiting':this[_0xbe4c('0xd')]};var _0x51b961=md5(JSON[_0xbe4c('0x19')](_0x7168e0));if(this[_0xbe4c('0x1')]!==_0x51b961){this['md5']=_0x51b961;io['to'](util[_0xbe4c('0x1a')](_0xbe4c('0x1b'),_0x7168e0[_0xbe4c('0x7')]))[_0xbe4c('0x1c')]('whatsapp_queue:save',_0x7168e0);}};module[_0xbe4c('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0x97dc=['whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','util','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','_rr','map','prototype','loggedIn','paused','online','whatsappPause','available','format'];(function(_0x41e09d,_0x169fbc){var _0x4bd9c0=function(_0x36eb73){while(--_0x36eb73){_0x41e09d['push'](_0x41e09d['shift']());}};_0x4bd9c0(++_0x169fbc);}(_0x97dc,0x1b4));var _0xc97d=function(_0x4a9984,_0xc0dd7e){_0x4a9984=_0x4a9984-0x0;var _0xbc7861=_0x97dc[_0x4a9984];return _0xbc7861;};'use strict';var _=require('lodash');var md5=require(_0xc97d('0x0'));var util=require(_0xc97d('0x1'));var Redis=require('ioredis');var config=require(_0xc97d('0x2'));config['redis']=_['defaults'](config[_0xc97d('0x3')],{'host':_0xc97d('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc97d('0x3')]));function WhatsappQueue(_0x4bcb91){this['id']=_0x4bcb91['id']||0x0;this[_0xc97d('0x5')]=_0x4bcb91[_0xc97d('0x5')]||'';this[_0xc97d('0x6')]=_0x4bcb91[_0xc97d('0x6')]||0xa;this[_0xc97d('0x7')]=_0x4bcb91[_0xc97d('0x7')]||_0xc97d('0x8');this['Agents']=_0x4bcb91[_0xc97d('0x9')];this['mapAgentsId']={};this[_0xc97d('0xa')]=0x0;this[_0xc97d('0x0')]='';this[_0xc97d('0xb')]();this[_0xc97d('0xc')]();}WhatsappQueue['prototype'][_0xc97d('0xb')]=function(){var _0x1c6e53=this[_0xc97d('0xd')][_0xc97d('0xe')];this['mapAgentsId']=_[_0xc97d('0xf')](this[_0xc97d('0x9')],'id');this[_0xc97d('0xd')][_0xc97d('0xe')]=_0x1c6e53;};WhatsappQueue[_0xc97d('0x10')][_0xc97d('0xc')]=function(){this[_0xc97d('0x11')]=0x0;this[_0xc97d('0x12')]=0x0;for(var _0xab0e3b=0x0;_0xab0e3b=0x0?this[_0xc97d('0x15')]:0x0;var _0x487203={'id':this['id'],'available':this[_0xc97d('0x15')],'loggedIn':this[_0xc97d('0x11')],'name':this['name'],'paused':this[_0xc97d('0x12')],'waiting':this[_0xc97d('0xa')]};var _0x4f2462=md5(JSON['stringify'](_0x487203));if(this[_0xc97d('0x0')]!==_0x4f2462){this[_0xc97d('0x0')]=_0x4f2462;io['to'](util[_0xc97d('0x16')](_0xc97d('0x17'),_0x487203[_0xc97d('0x5')]))[_0xc97d('0x18')](_0xc97d('0x19'),_0x487203);}};module[_0xc97d('0x1a')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index ca479a3..3f900db 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(_0xf62a50,_0x289b50){var _0x41394d=function(_0x4e1665){while(--_0x4e1665){_0xf62a50['push'](_0xf62a50['shift']());}};_0x41394d(++_0x289b50);}(_0xb10b,0x12a));var _0xbb10=function(_0xe89d97,_0x33e5ac){_0xe89d97=_0xe89d97-0x0;var _0x1b6e5d=_0xb10b[_0xe89d97];return _0x1b6e5d;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 4e59671..4e32b60 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 _0x0941=['addTagsToChatInteraction','../client','update','UpdateChatInteraction','updateChatInteraction','Request','AddTagsToChatInteraction'];(function(_0x38f0d5,_0x5a3f11){var _0x1212a5=function(_0x111614){while(--_0x111614){_0x38f0d5['push'](_0x38f0d5['shift']());}};_0x1212a5(++_0x5a3f11);}(_0x0941,0x71));var _0x1094=function(_0x5e59a4,_0x2b99a4){_0x5e59a4=_0x5e59a4-0x0;var _0x4caff9=_0x0941[_0x5e59a4];return _0x4caff9;};'use strict';var client=require(_0x1094('0x0'));exports[_0x1094('0x1')]=function(_0x5847bc,_0x3bb2e7){return client['Request'](_0x1094('0x2'),{'body':_0x3bb2e7,'options':{'where':{'id':_0x5847bc}},'log':_0x1094('0x3')});};exports['addTags']=function(_0x42e5b8,_0x506fbb){return client[_0x1094('0x4')](_0x1094('0x5'),{'body':_0x506fbb,'options':{'where':{'id':_0x42e5b8}},'log':_0x1094('0x6')});}; \ No newline at end of file +var _0x7bd6=['AddTagsToChatInteraction','../client','Request','UpdateChatInteraction','addTags'];(function(_0x28e520,_0x382e03){var _0x289aea=function(_0x3b23fc){while(--_0x3b23fc){_0x28e520['push'](_0x28e520['shift']());}};_0x289aea(++_0x382e03);}(_0x7bd6,0x1d7));var _0x67bd=function(_0x1559a5,_0x41924e){_0x1559a5=_0x1559a5-0x0;var _0x17a783=_0x7bd6[_0x1559a5];return _0x17a783;};'use strict';var client=require(_0x67bd('0x0'));exports['update']=function(_0x39fa26,_0x7de3dd){return client[_0x67bd('0x1')](_0x67bd('0x2'),{'body':_0x7de3dd,'options':{'where':{'id':_0x39fa26}},'log':'updateChatInteraction'});};exports[_0x67bd('0x3')]=function(_0x3876ce,_0x525f59){return client['Request'](_0x67bd('0x4'),{'body':_0x525f59,'options':{'where':{'id':_0x3876ce}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index c431447..d960924 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 _0x69ac=['Request','CreateChatMessage','../client'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x69ac,0xf2));var _0xc69a=function(_0x562116,_0x318e8a){_0x562116=_0x562116-0x0;var _0x45d755=_0x69ac[_0x562116];return _0x45d755;};'use strict';var client=require(_0xc69a('0x0'));exports['create']=function(_0x4682cf){return client[_0xc69a('0x1')](_0xc69a('0x2'),{'body':_0x4682cf,'log':'createChatMessage'});}; \ No newline at end of file +var _0x38c1=['create','Request','createChatMessage'];(function(_0x2cf155,_0x18b00b){var _0x39ee3f=function(_0x1b371b){while(--_0x1b371b){_0x2cf155['push'](_0x2cf155['shift']());}};_0x39ee3f(++_0x18b00b);}(_0x38c1,0x8a));var _0x138c=function(_0x1cb73e,_0xce62f4){_0x1cb73e=_0x1cb73e-0x0;var _0x5c1e4c=_0x38c1[_0x1cb73e];return _0x5c1e4c;};'use strict';var client=require('../client');exports[_0x138c('0x0')]=function(_0x26a8fe){return client[_0x138c('0x1')]('CreateChatMessage',{'body':_0x26a8fe,'log':_0x138c('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index aeab2c7..b796321 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 _0x3bd7=['getChatQueues','Request','GetChatQueue','name','strategy','User','Agents','online'];(function(_0x41f92f,_0xee690){var _0x497de6=function(_0x2ee4f7){while(--_0x2ee4f7){_0x41f92f['push'](_0x41f92f['shift']());}};_0x497de6(++_0xee690);}(_0x3bd7,0x199));var _0x73bd=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x3bd7[_0x3740fe];return _0x55492b;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client[_0x73bd('0x0')](_0x73bd('0x1'),{'options':{'raw':![],'attributes':['id',_0x73bd('0x2'),'timeout',_0x73bd('0x3')],'include':[{'model':_0x73bd('0x4'),'as':_0x73bd('0x5'),'attributes':['id','name',_0x73bd('0x6'),'chatPause']}]},'log':_0x73bd('0x7')});};}; \ No newline at end of file +var _0x0207=['strategy','User','Agents','online','getChatQueues','name','timeout'];(function(_0x48b5e0,_0xb3826){var _0x4287ea=function(_0x14519e){while(--_0x14519e){_0x48b5e0['push'](_0x48b5e0['shift']());}};_0x4287ea(++_0xb3826);}(_0x0207,0x162));var _0x7020=function(_0x3b33b9,_0x106957){_0x3b33b9=_0x3b33b9-0x0;var _0x38b257=_0x0207[_0x3b33b9];return _0x38b257;};'use strict';var client=require('../client');exports[_0x7020('0x0')]=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x7020('0x1'),_0x7020('0x2'),_0x7020('0x3')],'include':[{'model':_0x7020('0x4'),'as':_0x7020('0x5'),'attributes':['id',_0x7020('0x1'),_0x7020('0x6'),'chatPause']}]},'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 320d5d2..272eb2d 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 _0xb43b=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client'];(function(_0x1e7701,_0x13fd0f){var _0x3ab707=function(_0x3c5242){while(--_0x3c5242){_0x1e7701['push'](_0x1e7701['shift']());}};_0x3ab707(++_0x13fd0f);}(_0xb43b,0xbf));var _0xbb43=function(_0x24f1f5,_0x7a4fc4){_0x24f1f5=_0x24f1f5-0x0;var _0x3e8c68=_0xb43b[_0x24f1f5];return _0x3e8c68;};'use strict';var client=require(_0xbb43('0x0'));exports['create']=function(_0x1b9ba2){return client[_0xbb43('0x1')](_0xbb43('0x2'),{'body':_0x1b9ba2,'log':_0xbb43('0x2')});};exports[_0xbb43('0x3')]=function(_0xeeec7c,_0x2e9c09){return client[_0xbb43('0x1')](_0xbb43('0x4'),{'body':_0x2e9c09,'options':{'where':{'uniqueid':_0xeeec7c},'order':[['id',_0xbb43('0x5')]],'limit':0x1},'log':_0xbb43('0x4')});}; \ No newline at end of file +var _0x9335=['CreateChatQueueReport','update','DESC','../client','create','Request'];(function(_0x37e188,_0x49d9b9){var _0xd8f577=function(_0x2925f8){while(--_0x2925f8){_0x37e188['push'](_0x37e188['shift']());}};_0xd8f577(++_0x49d9b9);}(_0x9335,0xab));var _0x5933=function(_0x2ea20b,_0x1ba34f){_0x2ea20b=_0x2ea20b-0x0;var _0x6239bd=_0x9335[_0x2ea20b];return _0x6239bd;};'use strict';var client=require(_0x5933('0x0'));exports[_0x5933('0x1')]=function(_0x49884a){return client[_0x5933('0x2')](_0x5933('0x3'),{'body':_0x49884a,'log':_0x5933('0x3')});};exports[_0x5933('0x4')]=function(_0x934663,_0xc3fbd1){return client[_0x5933('0x2')]('UpdateChatQueueReport',{'body':_0xc3fbd1,'options':{'where':{'uniqueid':_0x934663},'order':[['id',_0x5933('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 88dfece..973333d 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(_0x5093e9,_0x5154d0){var _0x4c9a22=function(_0x15176d){while(--_0x15176d){_0x5093e9['push'](_0x5093e9['shift']());}};_0x4c9a22(++_0x5154d0);}(_0x7a54,0x106));var _0x47a5=function(_0x4cf88e,_0x320285){_0x4cf88e=_0x4cf88e-0x0;var _0x5c0bc8=_0x7a54[_0x4cf88e];return _0x5c0bc8;};'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(_0x19155c,_0x349ee1){var _0x584e8f=function(_0x301b6d){while(--_0x301b6d){_0x19155c['push'](_0x19155c['shift']());}};_0x584e8f(++_0x349ee1);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index ee3a066..adbc112 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 _0x4e91=['../client','create','Request','CreateFaxMessage'];(function(_0x4c10a7,_0x2ec115){var _0x4375d7=function(_0x462116){while(--_0x462116){_0x4c10a7['push'](_0x4c10a7['shift']());}};_0x4375d7(++_0x2ec115);}(_0x4e91,0xc0));var _0x14e9=function(_0x44fef1,_0x132cf4){_0x44fef1=_0x44fef1-0x0;var _0x3c3a04=_0x4e91[_0x44fef1];return _0x3c3a04;};'use strict';var client=require(_0x14e9('0x0'));exports[_0x14e9('0x1')]=function(_0x7aafc2){return client[_0x14e9('0x2')](_0x14e9('0x3'),{'body':_0x7aafc2,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x89a4=['create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x29f80e,_0x9027ff){var _0x5c7eaa=function(_0x48ec7c){while(--_0x48ec7c){_0x29f80e['push'](_0x29f80e['shift']());}};_0x5c7eaa(++_0x9027ff);}(_0x89a4,0x1b0));var _0x489a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x89a4[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x489a('0x0')]=function(_0xb60934){return client[_0x489a('0x1')](_0x489a('0x2'),{'body':_0xb60934,'log':_0x489a('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index f656464..50bb9aa 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 _0xdc65=['name','../client','Request','timeout'];(function(_0x155075,_0x3abe8e){var _0x458df6=function(_0x2ac6a9){while(--_0x2ac6a9){_0x155075['push'](_0x155075['shift']());}};_0x458df6(++_0x3abe8e);}(_0xdc65,0x1a5));var _0x5dc6=function(_0x5e90d4,_0x4c5748){_0x5e90d4=_0x5e90d4-0x0;var _0x117c7e=_0xdc65[_0x5e90d4];return _0x117c7e;};'use strict';var client=require(_0x5dc6('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x5dc6('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name',_0x5dc6('0x2'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0x5dc6('0x3'),'online','faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x110b=['strategy','name','online','faxPause','../client','getFaxQueues'];(function(_0x333fc8,_0x2b292c){var _0x432439=function(_0x5501b6){while(--_0x5501b6){_0x333fc8['push'](_0x333fc8['shift']());}};_0x432439(++_0x2b292c);}(_0x110b,0x166));var _0xb110=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x110b[_0x6cf19c];return _0xce14f3;};'use strict';var client=require(_0xb110('0x0'));exports[_0xb110('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0xb110('0x2')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xb110('0x3'),_0xb110('0x4'),_0xb110('0x5')]}]},'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 ced59a4..6f7c89a 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 _0x23e0=['DESC','../client','create','Request','CreateFaxQueueReport','UpdateFaxQueueReport'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x23e0,0x79));var _0x023e=function(_0x111df9,_0x37f4e3){_0x111df9=_0x111df9-0x0;var _0x573b26=_0x23e0[_0x111df9];return _0x573b26;};'use strict';var client=require(_0x023e('0x0'));exports[_0x023e('0x1')]=function(_0x4b5b21){return client[_0x023e('0x2')](_0x023e('0x3'),{'body':_0x4b5b21,'log':_0x023e('0x3')});};exports['update']=function(_0x24fc3e,_0x243fbb){return client[_0x023e('0x2')](_0x023e('0x4'),{'body':_0x243fbb,'options':{'where':{'uniqueid':_0x24fc3e},'order':[['id',_0x023e('0x5')]],'limit':0x1},'log':_0x023e('0x4')});}; \ No newline at end of file +var _0x5623=['create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client'];(function(_0x24c86a,_0x4131b5){var _0x3412ff=function(_0x5877f4){while(--_0x5877f4){_0x24c86a['push'](_0x24c86a['shift']());}};_0x3412ff(++_0x4131b5);}(_0x5623,0x11e));var _0x3562=function(_0x4c0345,_0x4b597e){_0x4c0345=_0x4c0345-0x0;var _0x1c4e43=_0x5623[_0x4c0345];return _0x1c4e43;};'use strict';var client=require(_0x3562('0x0'));exports[_0x3562('0x1')]=function(_0x13b59d){return client[_0x3562('0x2')]('CreateFaxQueueReport',{'body':_0x13b59d,'log':_0x3562('0x3')});};exports[_0x3562('0x4')]=function(_0x3ac7ba,_0x49cfa1){return client['Request'](_0x3562('0x5'),{'body':_0x49cfa1,'options':{'where':{'uniqueid':_0x3ac7ba},'order':[['id',_0x3562('0x6')]],'limit':0x1},'log':_0x3562('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index d7a6174..eb008c9 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 _0x7a94=['Intervals','../client','getIntervals','Request','GetInterval','name','Interval'];(function(_0x50c3ea,_0xd85753){var _0x404120=function(_0x52bcce){while(--_0x52bcce){_0x50c3ea['push'](_0x50c3ea['shift']());}};_0x404120(++_0xd85753);}(_0x7a94,0x119));var _0x47a9=function(_0x1fc93b,_0x5e7377){_0x1fc93b=_0x1fc93b-0x0;var _0x5ed3b3=_0x7a94[_0x1fc93b];return _0x5ed3b3;};'use strict';var client=require(_0x47a9('0x0'));exports[_0x47a9('0x1')]=function(){return function(){return client[_0x47a9('0x2')](_0x47a9('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x47a9('0x4')],'include':[{'model':_0x47a9('0x5'),'as':_0x47a9('0x6'),'attributes':['id','name','interval']}]},'log':_0x47a9('0x1')});};}; \ No newline at end of file +var _0xb24a=['getIntervals','../client','Request','GetInterval','Interval','Intervals'];(function(_0x1d30a3,_0x5f428c){var _0x32bba1=function(_0x5a60cc){while(--_0x5a60cc){_0x1d30a3['push'](_0x1d30a3['shift']());}};_0x32bba1(++_0x5f428c);}(_0xb24a,0x1cf));var _0xab24=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xb24a[_0x4154a6];return _0x3b2786;};'use strict';var client=require(_0xab24('0x0'));exports['getIntervals']=function(){return function(){return client[_0xab24('0x1')](_0xab24('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xab24('0x3'),'as':_0xab24('0x4'),'attributes':['id','name','interval']}]},'log':_0xab24('0x5')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 0a164d3..a647750 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 _0xa30a=['Request','UpdateMailInteraction','updateMailInteraction','addTags','addTagsToChatInteraction','../client','update'];(function(_0x2ff51f,_0x42f3a0){var _0x3a9779=function(_0x269b99){while(--_0x269b99){_0x2ff51f['push'](_0x2ff51f['shift']());}};_0x3a9779(++_0x42f3a0);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xaa30('0x0'));exports[_0xaa30('0x1')]=function(_0x25634b,_0x4dfa7e){return client[_0xaa30('0x2')](_0xaa30('0x3'),{'body':_0x4dfa7e,'options':{'where':{'id':_0x25634b}},'log':_0xaa30('0x4')});};exports[_0xaa30('0x5')]=function(_0x2a9b06,_0x271425){return client[_0xaa30('0x2')]('AddTagsToMailInteraction',{'body':_0x271425,'options':{'where':{'id':_0x2a9b06}},'log':_0xaa30('0x6')});}; \ No newline at end of file +var _0x2ef3=['../client','update','Request','UpdateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x2ef3,0xba));var _0x32ef=function(_0x136c10,_0x5dfc5f){_0x136c10=_0x136c10-0x0;var _0x91013=_0x2ef3[_0x136c10];return _0x91013;};'use strict';var client=require(_0x32ef('0x0'));exports[_0x32ef('0x1')]=function(_0x47513a,_0x26e56e){return client[_0x32ef('0x2')](_0x32ef('0x3'),{'body':_0x26e56e,'options':{'where':{'id':_0x47513a}},'log':'updateMailInteraction'});};exports[_0x32ef('0x4')]=function(_0x38b7f3,_0x524ab6){return client[_0x32ef('0x2')](_0x32ef('0x5'),{'body':_0x524ab6,'options':{'where':{'id':_0x38b7f3}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index d461fad..1b4a0b7 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 _0xdb12=['../client','create','Request','CreateMailMessage','createMailMessage'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xdb12,0xcd));var _0x2db1=function(_0x3ff2f9,_0x544ba1){_0x3ff2f9=_0x3ff2f9-0x0;var _0x3b0913=_0xdb12[_0x3ff2f9];return _0x3b0913;};'use strict';var client=require(_0x2db1('0x0'));exports[_0x2db1('0x1')]=function(_0x27ac02){return client[_0x2db1('0x2')](_0x2db1('0x3'),{'body':_0x27ac02,'log':_0x2db1('0x4')});}; \ No newline at end of file +var _0x1ea4=['CreateMailMessage','../client','create','Request'];(function(_0x2b2d33,_0x364135){var _0x29d035=function(_0x2eeb8e){while(--_0x2eeb8e){_0x2b2d33['push'](_0x2b2d33['shift']());}};_0x29d035(++_0x364135);}(_0x1ea4,0x89));var _0x41ea=function(_0x163126,_0x332146){_0x163126=_0x163126-0x0;var _0x38f001=_0x1ea4[_0x163126];return _0x38f001;};'use strict';var client=require(_0x41ea('0x0'));exports[_0x41ea('0x1')]=function(_0x354cad){return client[_0x41ea('0x2')](_0x41ea('0x3'),{'body':_0x354cad,'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 781844d..b51ca8b 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 _0x6db3=['timeout','strategy','online','mailPause','../client','getMailQueues','Request','GetMailQueue','name'];(function(_0x23be3b,_0x38cb8e){var _0x37f0fa=function(_0x14e481){while(--_0x14e481){_0x23be3b['push'](_0x23be3b['shift']());}};_0x37f0fa(++_0x38cb8e);}(_0x6db3,0x1a2));var _0x36db=function(_0xf9726c,_0x5c9e05){_0xf9726c=_0xf9726c-0x0;var _0x8a7159=_0x6db3[_0xf9726c];return _0x8a7159;};'use strict';var client=require(_0x36db('0x0'));exports[_0x36db('0x1')]=function(){return function(){return client[_0x36db('0x2')](_0x36db('0x3'),{'options':{'raw':![],'attributes':['id',_0x36db('0x4'),_0x36db('0x5'),_0x36db('0x6')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x36db('0x7'),_0x36db('0x8')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0xa8a7=['Request','name','timeout','strategy','User','Agents','mailPause','../client','getMailQueues'];(function(_0x3793f6,_0x191600){var _0x4d41e3=function(_0x633c5){while(--_0x633c5){_0x3793f6['push'](_0x3793f6['shift']());}};_0x4d41e3(++_0x191600);}(_0xa8a7,0xd6));var _0x7a8a=function(_0x1604d4,_0x5dffe8){_0x1604d4=_0x1604d4-0x0;var _0x3e6816=_0xa8a7[_0x1604d4];return _0x3e6816;};'use strict';var client=require(_0x7a8a('0x0'));exports[_0x7a8a('0x1')]=function(){return function(){return client[_0x7a8a('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x7a8a('0x3'),_0x7a8a('0x4'),_0x7a8a('0x5')],'include':[{'model':_0x7a8a('0x6'),'as':_0x7a8a('0x7'),'attributes':['id',_0x7a8a('0x3'),'online',_0x7a8a('0x8')]}]},'log':_0x7a8a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 0f25895..ede0a8a 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 _0xd712=['create','Request','CreateMailQueueReport','update','DESC','UpdateMailQueueReport'];(function(_0x22be54,_0x438d3d){var _0x319680=function(_0x475e86){while(--_0x475e86){_0x22be54['push'](_0x22be54['shift']());}};_0x319680(++_0x438d3d);}(_0xd712,0x15c));var _0x2d71=function(_0x1457e2,_0x184fd5){_0x1457e2=_0x1457e2-0x0;var _0x32b612=_0xd712[_0x1457e2];return _0x32b612;};'use strict';var client=require('../client');exports[_0x2d71('0x0')]=function(_0x13bb2b){return client[_0x2d71('0x1')](_0x2d71('0x2'),{'body':_0x13bb2b,'log':_0x2d71('0x2')});};exports[_0x2d71('0x3')]=function(_0xdd6f5,_0x1878df){return client[_0x2d71('0x1')]('UpdateMailQueueReport',{'body':_0x1878df,'options':{'where':{'uniqueid':_0xdd6f5},'order':[['id',_0x2d71('0x4')]],'limit':0x1},'log':_0x2d71('0x5')});}; \ No newline at end of file +var _0xe72c=['DESC','../client','create','CreateMailQueueReport','update','Request','UpdateMailQueueReport'];(function(_0x96a799,_0x3e4f1a){var _0x948af7=function(_0x534ad3){while(--_0x534ad3){_0x96a799['push'](_0x96a799['shift']());}};_0x948af7(++_0x3e4f1a);}(_0xe72c,0x120));var _0xce72=function(_0x4dbb9d,_0x54d334){_0x4dbb9d=_0x4dbb9d-0x0;var _0x5474d7=_0xe72c[_0x4dbb9d];return _0x5474d7;};'use strict';var client=require(_0xce72('0x0'));exports[_0xce72('0x1')]=function(_0x24f36d){return client['Request'](_0xce72('0x2'),{'body':_0x24f36d,'log':_0xce72('0x2')});};exports[_0xce72('0x3')]=function(_0xe1de40,_0x292689){return client[_0xce72('0x4')](_0xce72('0x5'),{'body':_0x292689,'options':{'where':{'uniqueid':_0xe1de40},'order':[['id',_0xce72('0x6')]],'limit':0x1},'log':_0xce72('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 9bde949..add6676 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 _0x8ea9=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x20180f,_0x14e164){var _0xd7467d=function(_0x322546){while(--_0x322546){_0x20180f['push'](_0x20180f['shift']());}};_0xd7467d(++_0x14e164);}(_0x8ea9,0x1ec));var _0x98ea=function(_0x3fb224,_0x2435a7){_0x3fb224=_0x3fb224-0x0;var _0x59da10=_0x8ea9[_0x3fb224];return _0x59da10;};'use strict';var client=require(_0x98ea('0x0'));exports['update']=function(_0x3d4fa1,_0x521896){return client[_0x98ea('0x1')](_0x98ea('0x2'),{'body':_0x521896,'options':{'where':{'id':_0x3d4fa1}},'log':_0x98ea('0x3')});};exports[_0x98ea('0x4')]=function(_0x525853,_0x1f7467){return client[_0x98ea('0x1')](_0x98ea('0x5'),{'body':_0x1f7467,'options':{'where':{'id':_0x525853}},'log':_0x98ea('0x6')});}; \ No newline at end of file +var _0xd20d=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','addTags'];(function(_0x35515a,_0x152831){var _0x368a52=function(_0x3e0de4){while(--_0x3e0de4){_0x35515a['push'](_0x35515a['shift']());}};_0x368a52(++_0x152831);}(_0xd20d,0x8c));var _0xdd20=function(_0x2474b1,_0x3d7e08){_0x2474b1=_0x2474b1-0x0;var _0xbbdb6c=_0xd20d[_0x2474b1];return _0xbbdb6c;};'use strict';var client=require(_0xdd20('0x0'));exports[_0xdd20('0x1')]=function(_0x3a6497,_0x1c2d7b){return client[_0xdd20('0x2')]('UpdateOpenchannelInteraction',{'body':_0x1c2d7b,'options':{'where':{'id':_0x3a6497}},'log':'updateOpenchannelInteraction'});};exports[_0xdd20('0x3')]=function(_0x1240d8,_0x2246db){return client[_0xdd20('0x2')](_0xdd20('0x4'),{'body':_0x2246db,'options':{'where':{'id':_0x1240d8}},'log':_0xdd20('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 7a2214a..fe1dc50 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 _0xd78d=['createOpenchannelMessage','../client','Request'];(function(_0x5194cc,_0x4bdd79){var _0xd4d83e=function(_0x38c4fc){while(--_0x38c4fc){_0x5194cc['push'](_0x5194cc['shift']());}};_0xd4d83e(++_0x4bdd79);}(_0xd78d,0x127));var _0xdd78=function(_0x3e5b9b,_0x2b58da){_0x3e5b9b=_0x3e5b9b-0x0;var _0x2965d2=_0xd78d[_0x3e5b9b];return _0x2965d2;};'use strict';var client=require(_0xdd78('0x0'));exports['create']=function(_0x2a45db){return client[_0xdd78('0x1')]('CreateOpenchannelMessage',{'body':_0x2a45db,'log':_0xdd78('0x2')});}; \ No newline at end of file +var _0x8152=['../client','create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x267896,_0x54de6d){var _0x561ca2=function(_0x1a9cee){while(--_0x1a9cee){_0x267896['push'](_0x267896['shift']());}};_0x561ca2(++_0x54de6d);}(_0x8152,0xaf));var _0x2815=function(_0x447559,_0x437478){_0x447559=_0x447559-0x0;var _0x272a0c=_0x8152[_0x447559];return _0x272a0c;};'use strict';var client=require(_0x2815('0x0'));exports[_0x2815('0x1')]=function(_0x26fe62){return client[_0x2815('0x2')](_0x2815('0x3'),{'body':_0x26fe62,'log':_0x2815('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index a3a71de..4934572 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 _0x3049=['online','openchannelPause','getOpenchannelQueues','../client','Request','name','timeout','strategy','Agents'];(function(_0x59c59b,_0x3cae3e){var _0x2ca7bb=function(_0x54b689){while(--_0x54b689){_0x59c59b['push'](_0x59c59b['shift']());}};_0x2ca7bb(++_0x3cae3e);}(_0x3049,0x1e9));var _0x9304=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x3049[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0x9304('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x9304('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x9304('0x2'),_0x9304('0x3'),_0x9304('0x4')],'include':[{'model':'User','as':_0x9304('0x5'),'attributes':['id',_0x9304('0x2'),_0x9304('0x6'),_0x9304('0x7')]}]},'log':_0x9304('0x8')});};}; \ No newline at end of file +var _0x51c8=['name','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout','strategy','User','Agents'];(function(_0xdd0313,_0x251c2b){var _0x2bd7e8=function(_0x340f1f){while(--_0x340f1f){_0xdd0313['push'](_0xdd0313['shift']());}};_0x2bd7e8(++_0x251c2b);}(_0x51c8,0x1bb));var _0x851c=function(_0x5bc8e2,_0x3e0e60){_0x5bc8e2=_0x5bc8e2-0x0;var _0x38ef45=_0x51c8[_0x5bc8e2];return _0x38ef45;};'use strict';var client=require(_0x851c('0x0'));exports[_0x851c('0x1')]=function(){return function(){return client[_0x851c('0x2')](_0x851c('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x851c('0x4'),_0x851c('0x5')],'include':[{'model':_0x851c('0x6'),'as':_0x851c('0x7'),'attributes':['id',_0x851c('0x8'),_0x851c('0x9'),_0x851c('0xa')]}]},'log':_0x851c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 7d9e8aa..6d33d4f 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 _0x7d13=['create','Request','CreateOpenchannelQueueReport','update','DESC','UpdateOpenchannelQueueReport'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x7d13,0x6c));var _0x37d1=function(_0x386c0b,_0x25a98b){_0x386c0b=_0x386c0b-0x0;var _0x1ebc25=_0x7d13[_0x386c0b];return _0x1ebc25;};'use strict';var client=require('../client');exports[_0x37d1('0x0')]=function(_0x59c6ac){return client[_0x37d1('0x1')]('CreateOpenchannelQueueReport',{'body':_0x59c6ac,'log':_0x37d1('0x2')});};exports[_0x37d1('0x3')]=function(_0x37d712,_0x1b93e3){return client[_0x37d1('0x1')]('UpdateOpenchannelQueueReport',{'body':_0x1b93e3,'options':{'where':{'uniqueid':_0x37d712},'order':[['id',_0x37d1('0x4')]],'limit':0x1},'log':_0x37d1('0x5')});}; \ No newline at end of file +var _0x76ef=['update','UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x2c9c29,_0x2e929b){var _0x53ef22=function(_0x26cf08){while(--_0x26cf08){_0x2c9c29['push'](_0x2c9c29['shift']());}};_0x53ef22(++_0x2e929b);}(_0x76ef,0xb6));var _0xf76e=function(_0xa18b68,_0x5bf2af){_0xa18b68=_0xa18b68-0x0;var _0x209f66=_0x76ef[_0xa18b68];return _0x209f66;};'use strict';var client=require(_0xf76e('0x0'));exports[_0xf76e('0x1')]=function(_0x19eca1){return client[_0xf76e('0x2')](_0xf76e('0x3'),{'body':_0x19eca1,'log':_0xf76e('0x3')});};exports[_0xf76e('0x4')]=function(_0x21dc12,_0x44a888){return client[_0xf76e('0x2')](_0xf76e('0x5'),{'body':_0x44a888,'options':{'where':{'uniqueid':_0x21dc12},'order':[['id','DESC']],'limit':0x1},'log':_0xf76e('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 0c5f2e9..4189e27 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 _0x3dd6=['addTags','addTagsToSmsInteraction','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x3c01b1,_0x1aaedc){var _0xcdf2a8=function(_0x2b2d7b){while(--_0x2b2d7b){_0x3c01b1['push'](_0x3c01b1['shift']());}};_0xcdf2a8(++_0x1aaedc);}(_0x3dd6,0xcf));var _0x63dd=function(_0x28770f,_0x5cff78){_0x28770f=_0x28770f-0x0;var _0x51bfe2=_0x3dd6[_0x28770f];return _0x51bfe2;};'use strict';var client=require('../client');exports['update']=function(_0x56e95f,_0x30ce59){return client[_0x63dd('0x0')](_0x63dd('0x1'),{'body':_0x30ce59,'options':{'where':{'id':_0x56e95f}},'log':_0x63dd('0x2')});};exports[_0x63dd('0x3')]=function(_0x3f5da2,_0x5b482d){return client[_0x63dd('0x0')]('AddTagsToSmsInteraction',{'body':_0x5b482d,'options':{'where':{'id':_0x3f5da2}},'log':_0x63dd('0x4')});}; \ No newline at end of file +var _0xb2f1=['../client','update','Request','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xb2f1,0xee));var _0x1b2f=function(_0x3c0abb,_0x2740ea){_0x3c0abb=_0x3c0abb-0x0;var _0x25e770=_0xb2f1[_0x3c0abb];return _0x25e770;};'use strict';var client=require(_0x1b2f('0x0'));exports[_0x1b2f('0x1')]=function(_0x55733a,_0x33346a){return client[_0x1b2f('0x2')]('UpdateSmsInteraction',{'body':_0x33346a,'options':{'where':{'id':_0x55733a}},'log':_0x1b2f('0x3')});};exports[_0x1b2f('0x4')]=function(_0x501165,_0x47a72f){return client[_0x1b2f('0x2')](_0x1b2f('0x5'),{'body':_0x47a72f,'options':{'where':{'id':_0x501165}},'log':_0x1b2f('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index f4f3c58..2a08e45 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 _0x41fd=['createSmsMessage','../client','CreateSmsMessage'];(function(_0x5cda76,_0x4e3ff8){var _0x299956=function(_0xd9ed62){while(--_0xd9ed62){_0x5cda76['push'](_0x5cda76['shift']());}};_0x299956(++_0x4e3ff8);}(_0x41fd,0xd9));var _0xd41f=function(_0x5f234e,_0x33c4b2){_0x5f234e=_0x5f234e-0x0;var _0x39b588=_0x41fd[_0x5f234e];return _0x39b588;};'use strict';var client=require(_0xd41f('0x0'));exports['create']=function(_0x2de6a1){return client['Request'](_0xd41f('0x1'),{'body':_0x2de6a1,'log':_0xd41f('0x2')});}; \ No newline at end of file +var _0x608f=['createSmsMessage','create','Request','CreateSmsMessage'];(function(_0x5b0bc8,_0x3f86b0){var _0x1626a5=function(_0x204b97){while(--_0x204b97){_0x5b0bc8['push'](_0x5b0bc8['shift']());}};_0x1626a5(++_0x3f86b0);}(_0x608f,0x1cd));var _0xf608=function(_0x4a5e9a,_0x285a07){_0x4a5e9a=_0x4a5e9a-0x0;var _0x441541=_0x608f[_0x4a5e9a];return _0x441541;};'use strict';var client=require('../client');exports[_0xf608('0x0')]=function(_0xf141c0){return client[_0xf608('0x1')](_0xf608('0x2'),{'body':_0xf141c0,'log':_0xf608('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 825ef70..06f0e21 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x14b1e8,_0x516676){var _0x5b0260=function(_0x595b62){while(--_0x595b62){_0x14b1e8['push'](_0x14b1e8['shift']());}};_0x5b0260(++_0x516676);}(_0xe706,0xa3));var _0x6e70=function(_0x590941,_0x1981e0){_0x590941=_0x590941-0x0;var _0x43c7bc=_0xe706[_0x590941];return _0x43c7bc;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file +var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x2d3d18,_0x475f4c){var _0x202f49=function(_0x41abb5){while(--_0x41abb5){_0x2d3d18['push'](_0x2d3d18['shift']());}};_0x202f49(++_0x475f4c);}(_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 diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index da38879..faabc88 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 _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0xa68ac1,_0x444528){var _0x4d06c5=function(_0x133da9){while(--_0x133da9){_0xa68ac1['push'](_0xa68ac1['shift']());}};_0x4d06c5(++_0x444528);}(_0x34e8,0x12c));var _0x834e=function(_0x155a3d,_0x40fa5f){_0x155a3d=_0x155a3d-0x0;var _0x2b719e=_0x34e8[_0x155a3d];return _0x2b719e;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x36c746,_0x2b1e44){var _0x28232f=function(_0x5e322f){while(--_0x5e322f){_0x36c746['push'](_0x36c746['shift']());}};_0x28232f(++_0x2b1e44);}(_0x34e8,0x12c));var _0x834e=function(_0x557654,_0x14e5b0){_0x557654=_0x557654-0x0;var _0x413f48=_0x34e8[_0x557654];return _0x413f48;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index a3cbf4e..92aaea0 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(_0x5b840b,_0x570928){var _0x50e6c2=function(_0x124cb3){while(--_0x124cb3){_0x5b840b['push'](_0x5b840b['shift']());}};_0x50e6c2(++_0x570928);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x77fa0a,_0x5753e4){var _0x209389=function(_0x1ce310){while(--_0x1ce310){_0x77fa0a['push'](_0x77fa0a['shift']());}};_0x209389(++_0x5753e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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 31929d1..b105ed9 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 _0x46ed=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction'];(function(_0x167307,_0x5a60ae){var _0x550140=function(_0x5b5009){while(--_0x5b5009){_0x167307['push'](_0x167307['shift']());}};_0x550140(++_0x5a60ae);}(_0x46ed,0x168));var _0xd46e=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x46ed[_0x5d6456];return _0x4d66c1;};'use strict';var client=require(_0xd46e('0x0'));exports[_0xd46e('0x1')]=function(_0x493012,_0x392bc1){return client[_0xd46e('0x2')](_0xd46e('0x3'),{'body':_0x392bc1,'options':{'where':{'id':_0x493012}},'log':'updateWhatsappInteraction'});};exports[_0xd46e('0x4')]=function(_0x4518b8,_0x54ef98){return client[_0xd46e('0x2')](_0xd46e('0x5'),{'body':_0x54ef98,'options':{'where':{'id':_0x4518b8}},'log':_0xd46e('0x6')});}; \ No newline at end of file +var _0x5fc3=['../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x34933a,_0x327378){var _0x36abb4=function(_0x2d6814){while(--_0x2d6814){_0x34933a['push'](_0x34933a['shift']());}};_0x36abb4(++_0x327378);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x5fc3[_0x5bd426];return _0x23a7eb;};'use strict';var client=require(_0x35fc('0x0'));exports[_0x35fc('0x1')]=function(_0x5a8343,_0x253d6e){return client[_0x35fc('0x2')](_0x35fc('0x3'),{'body':_0x253d6e,'options':{'where':{'id':_0x5a8343}},'log':_0x35fc('0x4')});};exports[_0x35fc('0x5')]=function(_0x5e75e6,_0x2d1404){return client[_0x35fc('0x2')](_0x35fc('0x6'),{'body':_0x2d1404,'options':{'where':{'id':_0x5e75e6}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 6be803e..e11a2b7 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 _0xaf2b=['CreateWhatsappMessage','createWhatsappMessage','create'];(function(_0x671369,_0x433da5){var _0x33f2b4=function(_0x2e9db2){while(--_0x2e9db2){_0x671369['push'](_0x671369['shift']());}};_0x33f2b4(++_0x433da5);}(_0xaf2b,0x1b8));var _0xbaf2=function(_0x237219,_0x28c29b){_0x237219=_0x237219-0x0;var _0x5f45bc=_0xaf2b[_0x237219];return _0x5f45bc;};'use strict';var client=require('../client');exports[_0xbaf2('0x0')]=function(_0x3878b8){return client['Request'](_0xbaf2('0x1'),{'body':_0x3878b8,'log':_0xbaf2('0x2')});}; \ No newline at end of file +var _0x0fbe=['createWhatsappMessage','../client','create','Request','CreateWhatsappMessage'];(function(_0x5e42b4,_0x1b9678){var _0x3f89c8=function(_0xa6e2e8){while(--_0xa6e2e8){_0x5e42b4['push'](_0x5e42b4['shift']());}};_0x3f89c8(++_0x1b9678);}(_0x0fbe,0x1d2));var _0xe0fb=function(_0x59d482,_0x43e5e9){_0x59d482=_0x59d482-0x0;var _0x4b6c63=_0x0fbe[_0x59d482];return _0x4b6c63;};'use strict';var client=require(_0xe0fb('0x0'));exports[_0xe0fb('0x1')]=function(_0x52952d){return client[_0xe0fb('0x2')](_0xe0fb('0x3'),{'body':_0x52952d,'log':_0xe0fb('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 0b353b0..06b5918 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 _0xe668=['Agents','online','../client','getWhatsappQueues','GetWhatsappQueue','name','timeout','strategy','User'];(function(_0x17b807,_0x139f04){var _0x3686ed=function(_0x4952c3){while(--_0x4952c3){_0x17b807['push'](_0x17b807['shift']());}};_0x3686ed(++_0x139f04);}(_0xe668,0x80));var _0x8e66=function(_0x75e866,_0x30b4de){_0x75e866=_0x75e866-0x0;var _0x5e4b64=_0xe668[_0x75e866];return _0x5e4b64;};'use strict';var client=require(_0x8e66('0x0'));exports[_0x8e66('0x1')]=function(){return function(){return client['Request'](_0x8e66('0x2'),{'options':{'raw':![],'attributes':['id',_0x8e66('0x3'),_0x8e66('0x4'),_0x8e66('0x5')],'include':[{'model':_0x8e66('0x6'),'as':_0x8e66('0x7'),'attributes':['id',_0x8e66('0x3'),_0x8e66('0x8'),'whatsappPause']}]},'log':_0x8e66('0x1')});};}; \ No newline at end of file +var _0xb2ea=['User','online','../client','getWhatsappQueues','GetWhatsappQueue','name','timeout','strategy'];(function(_0x34e206,_0x1e9b62){var _0x3a4547=function(_0x45510b){while(--_0x45510b){_0x34e206['push'](_0x34e206['shift']());}};_0x3a4547(++_0x1e9b62);}(_0xb2ea,0x1d2));var _0xab2e=function(_0x38fff7,_0x3d2f6f){_0x38fff7=_0x38fff7-0x0;var _0x335292=_0xb2ea[_0x38fff7];return _0x335292;};'use strict';var client=require(_0xab2e('0x0'));exports[_0xab2e('0x1')]=function(){return function(){return client['Request'](_0xab2e('0x2'),{'options':{'raw':![],'attributes':['id',_0xab2e('0x3'),_0xab2e('0x4'),_0xab2e('0x5')],'include':[{'model':_0xab2e('0x6'),'as':'Agents','attributes':['id',_0xab2e('0x3'),_0xab2e('0x7'),'whatsappPause']}]},'log':_0xab2e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 21caea6..a16bd8a 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 _0x016b=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client','create'];(function(_0x8c2e66,_0xf79589){var _0x31492f=function(_0xfe56f){while(--_0xfe56f){_0x8c2e66['push'](_0x8c2e66['shift']());}};_0x31492f(++_0xf79589);}(_0x016b,0x140));var _0xb016=function(_0x12d540,_0x3ed20a){_0x12d540=_0x12d540-0x0;var _0xf4cd9e=_0x016b[_0x12d540];return _0xf4cd9e;};'use strict';var client=require(_0xb016('0x0'));exports[_0xb016('0x1')]=function(_0x23804b){return client[_0xb016('0x2')](_0xb016('0x3'),{'body':_0x23804b,'log':_0xb016('0x3')});};exports[_0xb016('0x4')]=function(_0x4cc852,_0x10f7e5){return client[_0xb016('0x2')](_0xb016('0x5'),{'body':_0x10f7e5,'options':{'where':{'uniqueid':_0x4cc852},'order':[['id',_0xb016('0x6')]],'limit':0x1},'log':_0xb016('0x5')});}; \ No newline at end of file +var _0xb08e=['../client','create','Request','update','UpdateWhatsappQueueReport','DESC'];(function(_0x22663b,_0xc8c6e3){var _0x310d0a=function(_0x151e66){while(--_0x151e66){_0x22663b['push'](_0x22663b['shift']());}};_0x310d0a(++_0xc8c6e3);}(_0xb08e,0x144));var _0xeb08=function(_0x3efd41,_0x21aac6){_0x3efd41=_0x3efd41-0x0;var _0x4ca5ba=_0xb08e[_0x3efd41];return _0x4ca5ba;};'use strict';var client=require(_0xeb08('0x0'));exports[_0xeb08('0x1')]=function(_0x398790){return client[_0xeb08('0x2')]('CreateWhatsappQueueReport',{'body':_0x398790,'log':'CreateWhatsappQueueReport'});};exports[_0xeb08('0x3')]=function(_0x27c602,_0x56bd6d){return client[_0xeb08('0x2')](_0xeb08('0x4'),{'body':_0x56bd6d,'options':{'where':{'uniqueid':_0x27c602},'order':[['id',_0xeb08('0x5')]],'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 8a8d851..c643f39 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 _0xe18d=['seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','stop','createQueue','atimeout','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','next','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util'];(function(_0x58b6c7,_0x3bf35e){var _0x5f50d0=function(_0x532e10){while(--_0x532e10){_0x58b6c7['push'](_0x58b6c7['shift']());}};_0x5f50d0(++_0x3bf35e);}(_0xe18d,0x1ce));var _0xde18=function(_0x545c96,_0x377003){_0x545c96=_0x545c96-0x0;var _0x3d8c1f=_0xe18d[_0x545c96];return _0x3d8c1f;};'use strict';var schema=require(_0xde18('0x0'));var _=require(_0xde18('0x1'));var util=require(_0xde18('0x2'));var seqqueue=require(_0xde18('0x3'));var logger=require(_0xde18('0x4'))(_0xde18('0x5'));var strategy=require(_0xde18('0x6'));var queue=schema({'name':{'type':_0xde18('0x7'),'required':!![],'message':_0xde18('0x8')},'timeout':{'type':_0xde18('0x9'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x352ead,_0x295844,_0x41ea6c){return logger[_0xde18('0xa')](util[_0xde18('0xb')](_0xde18('0xc'),_0x352ead,_0x295844[_0xde18('0xd')],_0x41ea6c));}function handleFindAgent(_0x2d8572){return function(_0x1cdedb){return _0x1cdedb[_0xde18('0xd')][_0xde18('0xe')]()===_0x2d8572[_0xde18('0xe')]();};}exports[_0xde18('0xf')]=function(_0x38b49e,_0x40715e,_0x3f1dc4,_0x170b05){return function(_0x529c94){try{var _0x18746b={'name':_0x40715e[0x0],'timeout':_0x40715e[0x1]};var _0x2ab4ff=queue[_0xde18('0x0')](_0x18746b,{'typecast':!![]});if(_0x2ab4ff[_0xde18('0x10')]){logger[_0xde18('0x11')](_0xde18('0x12'),_0x38b49e,_[_0xde18('0x13')](_0x2ab4ff,'message')['join'](',\x20'));_0x529c94[_0xde18('0x14')]();}else{var _0x553cee=_['find'](_0x3f1dc4['agents'],handleFindAgent(_0x18746b[_0xde18('0xd')]));if(_0x553cee){var _0x4c53a7=(_0x18746b['timeout']||0xa)*0x3e8;var _0x15da1e,_0x51ea0f;var _0x155ab1=seqqueue[_0xde18('0x15')](_0x4c53a7);_0x155ab1['id']=_0x38b49e;_0x155ab1[_0xde18('0x16')]=_0x4c53a7;_0x155ab1['channel']=_0x170b05['channel'];writeLog(_0x38b49e,_0x553cee,util[_0xde18('0xb')](_0xde18('0x17'),_0x4c53a7));_0x3f1dc4[_0xde18('0x18')][_0x38b49e]['on']('end',function(){logger[_0xde18('0xa')](_0xde18('0x19'),_0x38b49e);clearTimeout(_0x51ea0f);_0x51ea0f=undefined;_0x155ab1[_0xde18('0x1a')]();if(_0x3f1dc4[_0xde18('0x18')][_0x38b49e]){delete _0x3f1dc4['rules'][_0x38b49e];}_0x529c94[_0xde18('0x14')]();});_0x3f1dc4[_0xde18('0x18')][_0x38b49e]['on']('complete',function(){if(_0x3f1dc4[_0xde18('0x18')][_0x38b49e]){delete _0x3f1dc4['rules'][_0x38b49e];}});_0x51ea0f=setTimeout(function(){logger[_0xde18('0xa')]('[%s][AGENT]\x20ROUTING\x20END',_0x38b49e);clearTimeout(_0x51ea0f);_0x155ab1['close']();_0x529c94[_0xde18('0x1b')]();},_0x4c53a7);strategy['agent'](_0x155ab1,_0x553cee,_0x3f1dc4,_0x170b05);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x38b49e,_0x18746b['name']);_0x529c94[_0xde18('0x14')]();}}}catch(_0x4010c4){console[_0xde18('0x1c')](_0x4010c4);logger[_0xde18('0x11')](_0xde18('0x1d'),_0x38b49e,_0x4010c4[_0xde18('0x1e')]);_0x529c94[_0xde18('0x14')]();}};}; \ No newline at end of file +var _0x6d04=['next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','util','seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','validate','length','map','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','end','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END'];(function(_0x386f2d,_0x469a2c){var _0x56d215=function(_0x2efc21){while(--_0x2efc21){_0x386f2d['push'](_0x386f2d['shift']());}};_0x56d215(++_0x469a2c);}(_0x6d04,0x113));var _0x46d0=function(_0x2fde14,_0xb161dc){_0x2fde14=_0x2fde14-0x0;var _0x36bc78=_0x6d04[_0x2fde14];return _0x36bc78;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x46d0('0x0'));var seqqueue=require(_0x46d0('0x1'));var logger=require(_0x46d0('0x2'))('routing');var strategy=require(_0x46d0('0x3'));var queue=schema({'name':{'type':_0x46d0('0x4'),'required':!![],'message':_0x46d0('0x5')},'timeout':{'type':_0x46d0('0x6'),'message':_0x46d0('0x7')}});function writeLog(_0x16a817,_0x30a18c,_0x1fd7b8){return logger[_0x46d0('0x8')](util[_0x46d0('0x9')](_0x46d0('0xa'),_0x16a817,_0x30a18c[_0x46d0('0xb')],_0x1fd7b8));}function handleFindAgent(_0x5abba1){return function(_0x426117){return _0x426117['name'][_0x46d0('0xc')]()===_0x5abba1[_0x46d0('0xc')]();};}exports['consequence']=function(_0x1b2fed,_0x1cb195,_0x4e86c1,_0x4a43e4){return function(_0x5735ee){try{var _0x39f50e={'name':_0x1cb195[0x0],'timeout':_0x1cb195[0x1]};var _0x225798=queue[_0x46d0('0xd')](_0x39f50e,{'typecast':!![]});if(_0x225798[_0x46d0('0xe')]){logger['error']('[%s][AGENT]\x20%s',_0x1b2fed,_[_0x46d0('0xf')](_0x225798,_0x46d0('0x10'))[_0x46d0('0x11')](',\x20'));_0x5735ee[_0x46d0('0x12')]();}else{var _0x17c00e=_[_0x46d0('0x13')](_0x4e86c1[_0x46d0('0x14')],handleFindAgent(_0x39f50e[_0x46d0('0xb')]));if(_0x17c00e){var _0x16be95=(_0x39f50e[_0x46d0('0x15')]||0xa)*0x3e8;var _0x325f13,_0x5df05f;var _0x595fb8=seqqueue[_0x46d0('0x16')](_0x16be95);_0x595fb8['id']=_0x1b2fed;_0x595fb8[_0x46d0('0x17')]=_0x16be95;_0x595fb8[_0x46d0('0x18')]=_0x4a43e4[_0x46d0('0x18')];writeLog(_0x1b2fed,_0x17c00e,util[_0x46d0('0x9')](_0x46d0('0x19'),_0x16be95));_0x4e86c1['rules'][_0x1b2fed]['on'](_0x46d0('0x1a'),function(){logger[_0x46d0('0x8')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x1b2fed);clearTimeout(_0x5df05f);_0x5df05f=undefined;_0x595fb8[_0x46d0('0x1b')]();if(_0x4e86c1['rules'][_0x1b2fed]){delete _0x4e86c1['rules'][_0x1b2fed];}_0x5735ee[_0x46d0('0x12')]();});_0x4e86c1[_0x46d0('0x1c')][_0x1b2fed]['on'](_0x46d0('0x1d'),function(){if(_0x4e86c1['rules'][_0x1b2fed]){delete _0x4e86c1['rules'][_0x1b2fed];}});_0x5df05f=setTimeout(function(){logger[_0x46d0('0x8')](_0x46d0('0x1e'),_0x1b2fed);clearTimeout(_0x5df05f);_0x595fb8['close']();_0x5735ee[_0x46d0('0x1f')]();},_0x16be95);strategy[_0x46d0('0x20')](_0x595fb8,_0x17c00e,_0x4e86c1,_0x4a43e4);}else{logger['error'](_0x46d0('0x21'),_0x1b2fed,_0x39f50e[_0x46d0('0xb')]);_0x5735ee['stop']();}}}catch(_0x44fafa){console['log'](_0x44fafa);logger['error']('[%s][QUEUE]\x20%s',_0x1b2fed,_0x44fafa['stack']);_0x5735ee['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 93c1a84..825dd4e 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 _0x4695=['body','Message','create','then','info','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerResponse','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty'];(function(_0x2bfa77,_0x50e556){var _0xce0c2f=function(_0x4b32f0){while(--_0x4b32f0){_0x2bfa77['push'](_0x2bfa77['shift']());}};_0xce0c2f(++_0x50e556);}(_0x4695,0x73));var _0x5469=function(_0x5bb794,_0x247e62){_0x5bb794=_0x5bb794-0x0;var _0x16f1a8=_0x4695[_0x5bb794];return _0x16f1a8;};'use strict';var _=require(_0x5469('0x0'));var moment=require(_0x5469('0x1'));var AWS=require(_0x5469('0x2'));var utils=require(_0x5469('0x3'));var logger=require(_0x5469('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x5469('0x5')),'mailMessage':require(_0x5469('0x6')),'smsMessage':require(_0x5469('0x7')),'faxMessage':require(_0x5469('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x5469('0x9')]=function(_0x35d0fb,_0x1157c5){return function(_0x4f7332){try{if(!_[_0x5469('0xa')](this[_0x5469('0xb')][_0x5469('0xc')])){logger['info'](_0x5469('0xd'),_0x35d0fb,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4f7332[_0x5469('0xe')]();}var _0xdd659e={'ContactId':this[_0x5469('0xf')]['id'],'sentAt':moment()['format'](_0x5469('0x10')),'direction':_0x5469('0x11')};if(this[_0x5469('0x12')]==='sms'||this[_0x5469('0x12')]===_0x5469('0x13')){_0xdd659e[_0x5469('0x14')]=this['interaction']['phone'];}var _0x39ba22=this['channel'];if(_0x39ba22===_0x5469('0x15')){_0xdd659e[_0x5469('0x16')]=this[_0x5469('0x17')]['id'];}else{_0xdd659e[_[_0x5469('0x18')](_0x39ba22)+_0x5469('0x19')]=this[_0x5469('0x17')]['id'];}_0xdd659e[_[_0x5469('0x18')](_0x39ba22)+_0x5469('0x1a')]=this[_0x5469('0xb')]['id'];if(this[_0x5469('0xb')][_0x5469('0x1b')]){var _0x3d166a=_0x1157c5[0x4];if(!_[_0x5469('0x1c')](_0x3d166a)){_0xdd659e[_0x5469('0x1d')]=utils['getMustacheRender'](_0x3d166a,this);return rpc[_0x39ba22+_0x5469('0x1e')][_0x5469('0x1f')](_0xdd659e)[_0x5469('0x20')](function(_0x363c37){logger[_0x5469('0x21')]('[%s][AMAZONLEX]\x20%s',_0x35d0fb,_0xdd659e['body']);})[_0x5469('0x22')](function(_0xa3dba){logger[_0x5469('0x23')]('[%s][AMAZONLEX]\x20%s',_0x35d0fb,JSON[_0x5469('0x24')](_0xa3dba));})['finally'](function(){logger[_0x5469('0x21')](_0x5469('0x25'),_0x35d0fb);_0x4f7332[_0x5469('0x26')]();});}else{logger[_0x5469('0x21')](_0x5469('0x27'),_0x35d0fb);_0x4f7332['stop']();}}else{var _0x35ae4e=this;var _0x1a96d7=new AWS[(_0x5469('0x28'))]({'accessKeyId':_0x1157c5[0x0],'secretAccessKey':_0x1157c5[0x1],'region':_0x1157c5[0x2]});var _0xe1522a={'botAlias':_0x5469('0x29'),'botName':_0x1157c5[0x3],'inputText':this[_0x5469('0x2a')][_0x5469('0x1d')],'userId':this[_0x5469('0x12')]+':'+this[_0x5469('0xb')]['id'][_0x5469('0x2b')]()};_0x1a96d7[_0x5469('0x2c')](_0xe1522a,function(_0x2922b4,_0x452fef){if(_0x2922b4){logger['error'](_0x5469('0xd'),_0x35d0fb,_0x2922b4['message']);_0x4f7332[_0x5469('0xe')]();}else if(_0x452fef&&_0x452fef['message']){_0x35ae4e[_0x5469('0x1d')][_0x5469('0x2d')]=_0x452fef;_0xdd659e[_0x5469('0x1d')]=_0x452fef['message'];_0xdd659e['providerName']=_0x5469('0x2d');_0xdd659e[_0x5469('0x2e')]=JSON[_0x5469('0x24')](_0x452fef);return rpc[_0x39ba22+_0x5469('0x1e')][_0x5469('0x1f')](_0xdd659e)[_0x5469('0x20')](function(_0x5af9e0){logger[_0x5469('0x21')]('[%s][AMAZONLEX]\x20%s',_0x35d0fb,_0xdd659e['body']);if(_0x452fef['dialogState']==_0x5469('0x2f')){_0x4f7332['next']();}else{_0x4f7332['stop']();}})[_0x5469('0x22')](function(_0x3556dc){logger[_0x5469('0x23')]('[%s][AMAZONLEX]\x20%s',_0x35d0fb,JSON['stringify'](_0x3556dc));_0x4f7332[_0x5469('0xe')]();});}else{_0x4f7332[_0x5469('0xe')]();}});}}catch(_0x503346){logger['error'](_0x5469('0xd'),_0x35d0fb,JSON[_0x5469('0x24')](_0x503346));_0x4f7332[_0x5469('0x26')]();}};}; \ No newline at end of file +var _0x02bc=['[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','isEmpty','body','getMustacheRender','create','then','info','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerResponse','Message','dialogState','stop','catch','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0x02bc,0x184));var _0xc02b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x02bc[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xc02b('0x0'));var moment=require(_0xc02b('0x1'));var AWS=require(_0xc02b('0x2'));var utils=require(_0xc02b('0x3'));var logger=require(_0xc02b('0x4'))('routing');var rpc={'chatMessage':require(_0xc02b('0x5')),'openchannelMessage':require(_0xc02b('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xc02b('0x7')),'whatsappMessage':require(_0xc02b('0x8'))};exports[_0xc02b('0x9')]=function(_0x73549b,_0x32707c){return function(_0x5d5931){try{if(!_['isNil'](this[_0xc02b('0xa')][_0xc02b('0xb')])){logger['info'](_0xc02b('0xc'),_0x73549b,_0xc02b('0xd'));return _0x5d5931[_0xc02b('0xe')]();}var _0x9eed2a={'ContactId':this[_0xc02b('0xf')]['id'],'sentAt':moment()[_0xc02b('0x10')](_0xc02b('0x11')),'direction':'out'};if(this['channel']===_0xc02b('0x12')||this[_0xc02b('0x13')]===_0xc02b('0x14')){_0x9eed2a[_0xc02b('0x15')]=this[_0xc02b('0xa')][_0xc02b('0x15')];}var _0x262134=this['channel'];if(_0x262134===_0xc02b('0x16')){_0x9eed2a[_0xc02b('0x17')]=this[_0xc02b('0x18')]['id'];}else{_0x9eed2a[_['upperFirst'](_0x262134)+_0xc02b('0x19')]=this[_0xc02b('0x18')]['id'];}_0x9eed2a[_[_0xc02b('0x1a')](_0x262134)+_0xc02b('0x1b')]=this[_0xc02b('0xa')]['id'];if(this[_0xc02b('0xa')]['created']){var _0x26ce62=_0x32707c[0x4];if(!_[_0xc02b('0x1c')](_0x26ce62)){_0x9eed2a[_0xc02b('0x1d')]=utils[_0xc02b('0x1e')](_0x26ce62,this);return rpc[_0x262134+'Message'][_0xc02b('0x1f')](_0x9eed2a)[_0xc02b('0x20')](function(_0x10afcb){logger[_0xc02b('0x21')](_0xc02b('0xc'),_0x73549b,_0x9eed2a[_0xc02b('0x1d')]);})['catch'](function(_0x1d9cc9){logger[_0xc02b('0x22')](_0xc02b('0xc'),_0x73549b,JSON[_0xc02b('0x23')](_0x1d9cc9));})[_0xc02b('0x24')](function(){logger[_0xc02b('0x21')](_0xc02b('0x25'),_0x73549b);_0x5d5931['stop']();});}else{logger[_0xc02b('0x21')](_0xc02b('0x26'),_0x73549b);_0x5d5931['stop']();}}else{var _0x2e6a70=this;var _0x478669=new AWS[(_0xc02b('0x27'))]({'accessKeyId':_0x32707c[0x0],'secretAccessKey':_0x32707c[0x1],'region':_0x32707c[0x2]});var _0x133ff7={'botAlias':_0xc02b('0x28'),'botName':_0x32707c[0x3],'inputText':this[_0xc02b('0x29')][_0xc02b('0x1d')],'userId':this[_0xc02b('0x13')]+':'+this[_0xc02b('0xa')]['id'][_0xc02b('0x2a')]()};_0x478669[_0xc02b('0x2b')](_0x133ff7,function(_0x281e9d,_0x411163){if(_0x281e9d){logger['error'](_0xc02b('0xc'),_0x73549b,_0x281e9d[_0xc02b('0x29')]);_0x5d5931[_0xc02b('0xe')]();}else if(_0x411163&&_0x411163[_0xc02b('0x29')]){_0x2e6a70[_0xc02b('0x1d')][_0xc02b('0x2c')]=_0x411163;_0x9eed2a[_0xc02b('0x1d')]=_0x411163[_0xc02b('0x29')];_0x9eed2a['providerName']=_0xc02b('0x2c');_0x9eed2a[_0xc02b('0x2d')]=JSON[_0xc02b('0x23')](_0x411163);return rpc[_0x262134+_0xc02b('0x2e')]['create'](_0x9eed2a)[_0xc02b('0x20')](function(_0x192ddb){logger[_0xc02b('0x21')](_0xc02b('0xc'),_0x73549b,_0x9eed2a[_0xc02b('0x1d')]);if(_0x411163[_0xc02b('0x2f')]=='Failed'){_0x5d5931[_0xc02b('0xe')]();}else{_0x5d5931[_0xc02b('0x30')]();}})[_0xc02b('0x31')](function(_0x2f54e5){logger[_0xc02b('0x22')](_0xc02b('0xc'),_0x73549b,JSON[_0xc02b('0x23')](_0x2f54e5));_0x5d5931[_0xc02b('0xe')]();});}else{_0x5d5931[_0xc02b('0xe')]();}});}}catch(_0x162962){logger['error']('[%s][AMAZONLEX]\x20%s',_0x73549b,JSON[_0xc02b('0x23')](_0x162962));_0x5d5931[_0xc02b('0x30')]();}};}; \ 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 6a3ba68..16c24d3 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 _0x70f4=['../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','phone','subject','startsWith','Re:','Re:\x20','chat','account','upperFirst','AccountId','InteractionId','Message','service','host','Smtp','port','secure','authentication','auth','pass','messageId','','';_0x416abf[_0x470f('0x39')]={'Auto-Submitted':_0x470f('0x3a'),'X-Auto-Response-Suppress':_0x470f('0x3b'),'Precedence':'auto_reply'};return mailRpc[_0x470f('0x3c')](_0x551794,_0x416abf)[_0x470f('0x3d')](function(_0x2615db){logger[_0x470f('0x13')](_0x470f('0x3e'),_0xf415c1);_0x416abf['messageId']=_0x2615db[_0x470f('0x21')][_0x470f('0x35')];return rpc[_0x58c7a1+_0x470f('0x2c')][_0x470f('0x3f')](_0x416abf);})[_0x470f('0x3d')](function(_0x2c2d58){logger[_0x470f('0x13')](_0x470f('0x17'),_0xf415c1,JSON['stringify'](_0x2c2d58));})[_0x470f('0x40')](function(_0x2c3cd4){logger[_0x470f('0x41')]('[RPC][%s][AUTOREPLY]\x20%s',_0xf415c1,JSON['stringify'](_0x2c3cd4));})[_0x470f('0x42')](function(){Promise['resolve']()[_0x470f('0x3d')](function(){if(_0x147c4b[0x0]!=='2'||_0xeba73a[_0x470f('0x19')])return;return rpc[_0x58c7a1+_0x470f('0x43')][_0x470f('0x44')](_0xeba73a['id'],{'autoreplyExecuted':!![]})[_0x470f('0x3d')](function(_0x44a15b){logger[_0x470f('0x13')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xf415c1,JSON[_0x470f('0x45')](_0x44a15b));})[_0x470f('0x40')](function(_0x26bf17){logger['error'](_0x470f('0x46'),_0xf415c1,JSON['stringify'](_0x26bf17));});})[_0x470f('0x3d')](function(){_0x5b3a1a['next']();});});}else{return rpc[this['channel']+_0x470f('0x2c')][_0x470f('0x3f')](_0x416abf)['then'](function(_0x10c9f3){logger['info'](_0x470f('0x17'),_0xf415c1,_0x416abf[_0x470f('0x11')]);})[_0x470f('0x40')](function(_0x157c39){logger[_0x470f('0x41')](_0x470f('0x17'),_0xf415c1,JSON[_0x470f('0x45')](_0x157c39));})[_0x470f('0x42')](function(){Promise[_0x470f('0x47')]()['then'](function(){if(_0x147c4b[0x0]!=='2'||_0xeba73a[_0x470f('0x19')])return;return rpc[_0x58c7a1+_0x470f('0x43')][_0x470f('0x44')](_0xeba73a['id'],{'autoreplyExecuted':!![]})['then'](function(_0x3a1227){logger[_0x470f('0x13')](_0x470f('0x1a'),_0xf415c1,JSON['stringify'](_0x3a1227));})[_0x470f('0x40')](function(_0x300a68){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xf415c1,JSON['stringify'](_0x300a68));});})[_0x470f('0x3d')](function(){_0x5b3a1a[_0x470f('0x48')]();});});}}}catch(_0xc941a5){logger[_0x470f('0x41')]('[%s][AUTOREPLY]\x20%s',_0xf415c1,JSON[_0x470f('0x45')](_0xc941a5));_0x5b3a1a[_0x470f('0x49')]();}};}; \ No newline at end of file +var _0xd84d=['../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','next','created','interaction','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','account','upperFirst','AccountId','InteractionId','Message','Smtp','service','host','port','secure','authentication','user','inReplyTo','html','','replace','';_0x3ae086['headers']={'Auto-Submitted':_0xdd84('0x39'),'X-Auto-Response-Suppress':'All','Precedence':_0xdd84('0x3a')};return mailRpc[_0xdd84('0x3b')](_0x46c2cf,_0x3ae086)[_0xdd84('0x3c')](function(_0x7b5fb5){logger[_0xdd84('0x11')](_0xdd84('0x3d'),_0x3e5573);_0x3ae086[_0xdd84('0x3e')]=_0x7b5fb5['message'][_0xdd84('0x3e')];return rpc[_0x37057c+_0xdd84('0x2b')]['create'](_0x3ae086);})[_0xdd84('0x3c')](function(_0x3971d1){logger['info'](_0xdd84('0x12'),_0x3e5573,JSON['stringify'](_0x3971d1));})[_0xdd84('0x3f')](function(_0x59e2ab){logger[_0xdd84('0x40')]('[RPC][%s][AUTOREPLY]\x20%s',_0x3e5573,JSON[_0xdd84('0x41')](_0x59e2ab));})[_0xdd84('0x42')](function(){Promise['resolve']()['then'](function(){if(_0x288420[0x0]!=='2'||_0x596cf4['autoreplyExecuted'])return;return rpc[_0x37057c+_0xdd84('0x43')][_0xdd84('0x44')](_0x596cf4['id'],{'autoreplyExecuted':!![]})[_0xdd84('0x3c')](function(_0x389a76){logger[_0xdd84('0x11')](_0xdd84('0x17'),_0x3e5573,JSON[_0xdd84('0x41')](_0x389a76));})[_0xdd84('0x3f')](function(_0x11afb0){logger[_0xdd84('0x40')](_0xdd84('0x45'),_0x3e5573,JSON[_0xdd84('0x41')](_0x11afb0));});})[_0xdd84('0x3c')](function(){_0x4a44e2['next']();});});}else{return rpc[this[_0xdd84('0xd')]+_0xdd84('0x2b')][_0xdd84('0x46')](_0x3ae086)[_0xdd84('0x3c')](function(_0x28ef02){logger[_0xdd84('0x11')]('[%s][AUTOREPLY]\x20%s',_0x3e5573,_0x3ae086[_0xdd84('0xf')]);})['catch'](function(_0x4683d4){logger[_0xdd84('0x40')](_0xdd84('0x12'),_0x3e5573,JSON['stringify'](_0x4683d4));})['finally'](function(){Promise[_0xdd84('0x47')]()[_0xdd84('0x3c')](function(){if(_0x288420[0x0]!=='2'||_0x596cf4[_0xdd84('0x48')])return;return rpc[_0x37057c+_0xdd84('0x43')][_0xdd84('0x44')](_0x596cf4['id'],{'autoreplyExecuted':!![]})['then'](function(_0x38f9d0){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3e5573,JSON[_0xdd84('0x41')](_0x38f9d0));})[_0xdd84('0x3f')](function(_0x3a261f){logger['error'](_0xdd84('0x45'),_0x3e5573,JSON[_0xdd84('0x41')](_0x3a261f));});})[_0xdd84('0x3c')](function(){_0x4a44e2['next']();});});}}}catch(_0xb31b52){logger[_0xdd84('0x40')]('[%s][AUTOREPLY]\x20%s',_0x3e5573,JSON[_0xdd84('0x41')](_0xb31b52));_0x4a44e2[_0xdd84('0x49')]();}};}; \ 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 2ac3b7d..7ff9ca1 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 _0x5c4a=['../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','finally','stop','stringify','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction'];(function(_0x429370,_0x46ff4c){var _0x41a3ad=function(_0x47d51e){while(--_0x47d51e){_0x429370['push'](_0x429370['shift']());}};_0x41a3ad(++_0x46ff4c);}(_0x5c4a,0xa0));var _0xa5c4=function(_0x153ef,_0x49391e){_0x153ef=_0x153ef-0x0;var _0x5038a9=_0x5c4a[_0x153ef];return _0x5038a9;};'use strict';var moment=require(_0xa5c4('0x0'));var logger=require(_0xa5c4('0x1'))(_0xa5c4('0x2'));var rpc={'chatInteraction':require(_0xa5c4('0x3')),'openchannelInteraction':require(_0xa5c4('0x4')),'smsInteraction':require(_0xa5c4('0x5')),'mailInteraction':require(_0xa5c4('0x6')),'faxInteraction':require(_0xa5c4('0x7')),'whatsappInteraction':require(_0xa5c4('0x8'))};exports[_0xa5c4('0x9')]=function(_0x4d39e1,_0x21a823,_0x199b52,_0x3dce90){return function(_0xbe950f){try{logger[_0xa5c4('0xa')](_0xa5c4('0xb'),_0x4d39e1,_0x21a823[0x0]);var _0x22ea6f={'closed':0x1,'closedAt':moment()[_0xa5c4('0xc')](_0xa5c4('0xd')),'closeReason':_0xa5c4('0xe'),'disposition':_0x21a823[0x0]};if(rpc[_0x3dce90[_0xa5c4('0xf')]+'Interaction']){rpc[_0x3dce90[_0xa5c4('0xf')]+'Interaction'][_0xa5c4('0x10')](_0x3dce90[_0xa5c4('0x11')]['id'],_0x22ea6f)['then'](function(_0x54c0a1){logger[_0xa5c4('0xa')](_0xa5c4('0x12'),_0x4d39e1,_0x3dce90[_0xa5c4('0x11')]['id']);})[_0xa5c4('0x13')](function(_0xc2c7bd){logger[_0xa5c4('0x14')]('[%s][CLOSE]\x20%s',_0x4d39e1,JSON['stringify'](_0xc2c7bd));})[_0xa5c4('0x15')](function(){_0xbe950f[_0xa5c4('0x16')]();});}}catch(_0x4ce9b5){logger[_0xa5c4('0x14')]('[%s][CLOSE]\x20%s',_0x4d39e1,JSON[_0xa5c4('0x17')](_0x4ce9b5));_0xbe950f[_0xa5c4('0x16')]();}};}; \ No newline at end of file +var _0x8d35=['../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','stringify','finally','[%s][CLOSE]\x20%s','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x8d35,0xc1));var _0x58d3=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x8d35[_0x34843e];return _0x598f7f;};'use strict';var moment=require(_0x58d3('0x0'));var logger=require(_0x58d3('0x1'))(_0x58d3('0x2'));var rpc={'chatInteraction':require(_0x58d3('0x3')),'openchannelInteraction':require(_0x58d3('0x4')),'smsInteraction':require(_0x58d3('0x5')),'mailInteraction':require(_0x58d3('0x6')),'faxInteraction':require(_0x58d3('0x7')),'whatsappInteraction':require(_0x58d3('0x8'))};exports[_0x58d3('0x9')]=function(_0x502296,_0x33b8fe,_0x2c3fa2,_0x58f439){return function(_0x1ff7e7){try{logger[_0x58d3('0xa')](_0x58d3('0xb'),_0x502296,_0x33b8fe[0x0]);var _0x3a503d={'closed':0x1,'closedAt':moment()['format'](_0x58d3('0xc')),'closeReason':_0x58d3('0xd'),'disposition':_0x33b8fe[0x0]};if(rpc[_0x58f439[_0x58d3('0xe')]+_0x58d3('0xf')]){rpc[_0x58f439[_0x58d3('0xe')]+'Interaction'][_0x58d3('0x10')](_0x58f439[_0x58d3('0x11')]['id'],_0x3a503d)[_0x58d3('0x12')](function(_0x2af690){logger['info'](_0x58d3('0x13'),_0x502296,_0x58f439['interaction']['id']);})[_0x58d3('0x14')](function(_0x3e824d){logger[_0x58d3('0x15')]('[%s][CLOSE]\x20%s',_0x502296,JSON[_0x58d3('0x16')](_0x3e824d));})[_0x58d3('0x17')](function(){_0x1ff7e7['stop']();});}}catch(_0x190da4){logger[_0x58d3('0x15')](_0x58d3('0x18'),_0x502296,JSON['stringify'](_0x190da4));_0x1ff7e7['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 10ec5dd..8cdb277 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 _0x0c23=['lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','info','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','fulfillment','speech','providerName','providerResponse','metadata','next'];(function(_0x51812d,_0x568d00){var _0x1c3808=function(_0x27cf17){while(--_0x27cf17){_0x51812d['push'](_0x51812d['shift']());}};_0x1c3808(++_0x568d00);}(_0x0c23,0x13e));var _0x30c2=function(_0x5a08a8,_0x4890bc){_0x5a08a8=_0x5a08a8-0x0;var _0x2cb370=_0x0c23[_0x5a08a8];return _0x2cb370;};'use strict';var _=require(_0x30c2('0x0'));var moment=require(_0x30c2('0x1'));var apiai=require(_0x30c2('0x2'));var md5=require(_0x30c2('0x3'));var utils=require(_0x30c2('0x4'));var logger=require(_0x30c2('0x5'))(_0x30c2('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x30c2('0x7')),'mailMessage':require(_0x30c2('0x8')),'smsMessage':require(_0x30c2('0x9')),'faxMessage':require(_0x30c2('0xa')),'whatsappMessage':require(_0x30c2('0xb'))};exports[_0x30c2('0xc')]=function(_0x4f1eba,_0x406fd0){return function(_0x41b74d){try{if(!_[_0x30c2('0xd')](this[_0x30c2('0xe')][_0x30c2('0xf')])){logger['info'](_0x30c2('0x10'),_0x4f1eba,_0x30c2('0x11'));return _0x41b74d['next']();}var _0x3365c5={'ContactId':this[_0x30c2('0x12')]['id'],'sentAt':moment()[_0x30c2('0x13')](_0x30c2('0x14')),'direction':_0x30c2('0x15')};if(this[_0x30c2('0x16')]==='sms'||this['channel']==='whatsapp'){_0x3365c5[_0x30c2('0x17')]=this[_0x30c2('0xe')][_0x30c2('0x17')];}var _0x26d859=this[_0x30c2('0x16')];if(_0x26d859===_0x30c2('0x18')){_0x3365c5[_0x30c2('0x19')]=this['account']['id'];}else{_0x3365c5[_[_0x30c2('0x1a')](_0x26d859)+_0x30c2('0x1b')]=this['account']['id'];}_0x3365c5[_[_0x30c2('0x1a')](_0x26d859)+_0x30c2('0x1c')]=this[_0x30c2('0xe')]['id'];if(this[_0x30c2('0xe')][_0x30c2('0x1d')]){var _0x45f970=_0x406fd0[0x2];if(!_[_0x30c2('0x1e')](_0x45f970)){_0x3365c5[_0x30c2('0x1f')]=utils[_0x30c2('0x20')](_0x45f970,this);return rpc[_0x26d859+_0x30c2('0x21')][_0x30c2('0x22')](_0x3365c5)[_0x30c2('0x23')](function(_0x549e8c){logger[_0x30c2('0x24')]('[%s][DIALOGFLOW]\x20%s',_0x4f1eba,_0x3365c5['body']);})[_0x30c2('0x25')](function(_0x450006){logger[_0x30c2('0x26')]('[%s][DIALOGFLOW]\x20%s',_0x4f1eba,JSON[_0x30c2('0x27')](_0x450006));})[_0x30c2('0x28')](function(){logger[_0x30c2('0x24')](_0x30c2('0x29'),_0x4f1eba);_0x41b74d[_0x30c2('0x2a')]();});}else{logger[_0x30c2('0x24')](_0x30c2('0x2b'),_0x4f1eba);_0x41b74d[_0x30c2('0x2a')]();}}else{var _0x4d9b3f=this;var _0x57b861=apiai(_0x406fd0[0x0],{'language':_0x406fd0[0x1]||'en'});return _0x57b861[_0x30c2('0x2c')](this[_0x30c2('0x2d')][_0x30c2('0x1f')],{'sessionId':md5(this[_0x30c2('0xe')]['id'])})[_0x30c2('0x23')](function(_0x5a72f5){_0x4d9b3f[_0x30c2('0x1f')][_0x30c2('0x2e')]=_0x5a72f5;_0x3365c5[_0x30c2('0x1f')]=_0x5a72f5['result'][_0x30c2('0x2f')][_0x30c2('0x30')];_0x3365c5[_0x30c2('0x31')]='dialogflow';_0x3365c5[_0x30c2('0x32')]=JSON[_0x30c2('0x27')](_0x5a72f5);return rpc[_0x26d859+_0x30c2('0x21')]['create'](_0x3365c5)[_0x30c2('0x23')](function(_0x44f237){logger[_0x30c2('0x24')](_0x30c2('0x10'),_0x4f1eba,_0x3365c5['body']);if(_0x5a72f5['result'][_0x30c2('0x33')]['endConversation']){_0x41b74d[_0x30c2('0x34')]();}else{_0x41b74d[_0x30c2('0x2a')]();}})[_0x30c2('0x25')](function(_0x5227bb){logger[_0x30c2('0x26')](_0x30c2('0x10'),_0x4f1eba,JSON['stringify'](_0x5227bb));_0x41b74d[_0x30c2('0x34')]();});})[_0x30c2('0x25')](function(_0x1434f7){logger[_0x30c2('0x26')](_0x30c2('0x10'),_0x4f1eba,_0x1434f7[_0x30c2('0x2d')]);_0x41b74d[_0x30c2('0x34')]();});}}catch(_0x1b2b92){logger[_0x30c2('0x26')](_0x30c2('0x10'),_0x4f1eba,JSON[_0x30c2('0x27')](_0x1b2b92));_0x41b74d[_0x30c2('0x2a')]();}};}; \ No newline at end of file +var _0xf494=['interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','Message','create','body','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','then','result','speech','providerName','dialogflow','metadata','endConversation','lodash','moment','apiai-promise','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xf494,0x1c6));var _0x4f49=function(_0x1af6a4,_0x5ccef3){_0x1af6a4=_0x1af6a4-0x0;var _0x14b3bd=_0xf494[_0x1af6a4];return _0x14b3bd;};'use strict';var _=require(_0x4f49('0x0'));var moment=require(_0x4f49('0x1'));var apiai=require(_0x4f49('0x2'));var md5=require('md5');var utils=require(_0x4f49('0x3'));var logger=require(_0x4f49('0x4'))(_0x4f49('0x5'));var rpc={'chatMessage':require(_0x4f49('0x6')),'openchannelMessage':require(_0x4f49('0x7')),'mailMessage':require(_0x4f49('0x8')),'smsMessage':require(_0x4f49('0x9')),'faxMessage':require(_0x4f49('0xa')),'whatsappMessage':require(_0x4f49('0xb'))};exports[_0x4f49('0xc')]=function(_0x42b0e8,_0x5eb186){return function(_0x58e9a0){try{if(!_[_0x4f49('0xd')](this[_0x4f49('0xe')][_0x4f49('0xf')])){logger[_0x4f49('0x10')](_0x4f49('0x11'),_0x42b0e8,_0x4f49('0x12'));return _0x58e9a0[_0x4f49('0x13')]();}var _0x410884={'ContactId':this['contact']['id'],'sentAt':moment()[_0x4f49('0x14')](_0x4f49('0x15')),'direction':'out'};if(this[_0x4f49('0x16')]==='sms'||this['channel']===_0x4f49('0x17')){_0x410884[_0x4f49('0x18')]=this['interaction'][_0x4f49('0x18')];}var _0x111a8b=this[_0x4f49('0x16')];if(_0x111a8b===_0x4f49('0x19')){_0x410884[_0x4f49('0x1a')]=this[_0x4f49('0x1b')]['id'];}else{_0x410884[_[_0x4f49('0x1c')](_0x111a8b)+'AccountId']=this[_0x4f49('0x1b')]['id'];}_0x410884[_[_0x4f49('0x1c')](_0x111a8b)+_0x4f49('0x1d')]=this['interaction']['id'];if(this['interaction'][_0x4f49('0x1e')]){var _0x2ecaaa=_0x5eb186[0x2];if(!_[_0x4f49('0x1f')](_0x2ecaaa)){_0x410884['body']=utils[_0x4f49('0x20')](_0x2ecaaa,this);return rpc[_0x111a8b+_0x4f49('0x21')][_0x4f49('0x22')](_0x410884)['then'](function(_0x5bb23b){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x42b0e8,_0x410884[_0x4f49('0x23')]);})[_0x4f49('0x24')](function(_0x1c2d70){logger[_0x4f49('0x25')]('[%s][DIALOGFLOW]\x20%s',_0x42b0e8,JSON[_0x4f49('0x26')](_0x1c2d70));})[_0x4f49('0x27')](function(){logger[_0x4f49('0x10')](_0x4f49('0x28'),_0x42b0e8);_0x58e9a0[_0x4f49('0x29')]();});}else{logger['info'](_0x4f49('0x2a'),_0x42b0e8);_0x58e9a0[_0x4f49('0x29')]();}}else{var _0x3ae590=this;var _0x53b57d=apiai(_0x5eb186[0x0],{'language':_0x5eb186[0x1]||'en'});return _0x53b57d[_0x4f49('0x2b')](this[_0x4f49('0x2c')][_0x4f49('0x23')],{'sessionId':md5(this[_0x4f49('0xe')]['id'])})[_0x4f49('0x2d')](function(_0x36187b){_0x3ae590['body']['dialogflow']=_0x36187b;_0x410884[_0x4f49('0x23')]=_0x36187b[_0x4f49('0x2e')]['fulfillment'][_0x4f49('0x2f')];_0x410884[_0x4f49('0x30')]=_0x4f49('0x31');_0x410884['providerResponse']=JSON[_0x4f49('0x26')](_0x36187b);return rpc[_0x111a8b+_0x4f49('0x21')][_0x4f49('0x22')](_0x410884)[_0x4f49('0x2d')](function(_0xfefbab){logger[_0x4f49('0x10')]('[%s][DIALOGFLOW]\x20%s',_0x42b0e8,_0x410884['body']);if(_0x36187b[_0x4f49('0x2e')][_0x4f49('0x32')][_0x4f49('0x33')]){_0x58e9a0['next']();}else{_0x58e9a0[_0x4f49('0x29')]();}})[_0x4f49('0x24')](function(_0x43d8e3){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x42b0e8,JSON[_0x4f49('0x26')](_0x43d8e3));_0x58e9a0[_0x4f49('0x13')]();});})[_0x4f49('0x24')](function(_0x5e7076){logger[_0x4f49('0x25')](_0x4f49('0x11'),_0x42b0e8,_0x5e7076[_0x4f49('0x2c')]);_0x58e9a0[_0x4f49('0x13')]();});}}catch(_0x3e103b){logger[_0x4f49('0x25')](_0x4f49('0x11'),_0x42b0e8,JSON[_0x4f49('0x26')](_0x3e103b));_0x58e9a0[_0x4f49('0x29')]();}};}; \ 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 04d1755..350ef82 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 _0x1d50=['created','isEmpty','getMustacheRender','error','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','length','dialogflowV2','diagnosticInfo','queryResult','end_conversation','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','fields','boolValue','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','intentDetectionConfidence','providerName','fulfillmentText','push','all','lodash','dialogflow','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','Message','create','then','[%s][DIALOGFLOWV2]\x20%s','body','catch','stringify','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','sms','channel','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1d50,0x1c7));var _0x01d5=function(_0x2d7407,_0x607abc){_0x2d7407=_0x2d7407-0x0;var _0x2b3cca=_0x1d50[_0x2d7407];return _0x2b3cca;};'use strict';var _=require(_0x01d5('0x0'));var dialogflow=require(_0x01d5('0x1'));var md5=require('md5');var moment=require('moment');var Promise=require('bluebird');var logger=require('../../../../config/logger')(_0x01d5('0x2'));var utils=require(_0x01d5('0x3'));var rpc={'chatMessage':require(_0x01d5('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x01d5('0x5')),'smsMessage':require(_0x01d5('0x6')),'faxMessage':require(_0x01d5('0x7')),'whatsappMessage':require(_0x01d5('0x8'))};function createMessage(_0x265815,_0x234d74,_0x5bd859,_0x34e873){return new Promise(function(_0x204030,_0x558b84){var _0x55c6d2=_[_0x01d5('0x9')](_0x5bd859);_0x55c6d2['body']=_0x34e873;return rpc[_0x234d74+_0x01d5('0xa')][_0x01d5('0xb')](_0x55c6d2)[_0x01d5('0xc')](function(){logger['info'](_0x01d5('0xd'),_0x265815,_0x55c6d2[_0x01d5('0xe')]);_0x204030();})[_0x01d5('0xf')](function(_0x5d5851){logger['error'](_0x01d5('0xd'),_0x265815,JSON[_0x01d5('0x10')](_0x5d5851));_0x558b84(_0x5d5851);});});}exports[_0x01d5('0x11')]=function(_0x1481a0,_0x29123c){return function(_0x2c2a29){try{if(!_[_0x01d5('0x12')](this[_0x01d5('0x13')][_0x01d5('0x14')])){logger[_0x01d5('0x15')]('[%s][DIALOGFLOWV2]\x20%s',_0x1481a0,_0x01d5('0x16'));return _0x2c2a29[_0x01d5('0x17')]();}var _0x23e0b1={'ContactId':this[_0x01d5('0x18')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x01d5('0x19')};if(this['channel']===_0x01d5('0x1a')||this[_0x01d5('0x1b')]==='whatsapp'){_0x23e0b1[_0x01d5('0x1c')]=this[_0x01d5('0x13')][_0x01d5('0x1c')];}var _0xe02251=this[_0x01d5('0x1b')];if(_0xe02251===_0x01d5('0x1d')){_0x23e0b1[_0x01d5('0x1e')]=this[_0x01d5('0x1f')]['id'];}else{_0x23e0b1[_[_0x01d5('0x20')](_0xe02251)+_0x01d5('0x21')]=this[_0x01d5('0x1f')]['id'];}_0x23e0b1[_['upperFirst'](_0xe02251)+_0x01d5('0x22')]=this[_0x01d5('0x13')]['id'];if(this[_0x01d5('0x13')][_0x01d5('0x23')]){var _0x5ec127=_0x29123c[0x4];if(!_[_0x01d5('0x24')](_0x5ec127)){_0x23e0b1['body']=utils[_0x01d5('0x25')](_0x5ec127,this);return rpc[_0xe02251+_0x01d5('0xa')][_0x01d5('0xb')](_0x23e0b1)[_0x01d5('0xc')](function(_0x191cbe){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x1481a0,_0x23e0b1[_0x01d5('0xe')]);})[_0x01d5('0xf')](function(_0x434760){logger[_0x01d5('0x26')](_0x01d5('0xd'),_0x1481a0,JSON['stringify'](_0x434760));})[_0x01d5('0x27')](function(){logger[_0x01d5('0x15')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1481a0);_0x2c2a29[_0x01d5('0x28')]();});}else{logger['info'](_0x01d5('0x29'),_0x1481a0);_0x2c2a29[_0x01d5('0x28')]();}}else{var _0x4622e7=this;var _0x15ffd4=_0x29123c[0x2][_0x01d5('0x2a')](/\\n/g,'\x0a');var _0x3e9b33={'credentials':{'private_key':_0x15ffd4,'client_email':_0x29123c[0x1]}};var _0x2270e8=new dialogflow[(_0x01d5('0x2b'))](_0x3e9b33);var _0x3c9edc=_0x2270e8[_0x01d5('0x2c')](_0x29123c[0x0],md5(_0x4622e7[_0x01d5('0x13')]['id']));var _0x3784ec={'session':_0x3c9edc,'queryInput':{'text':{'text':_0x4622e7[_0x01d5('0x2d')]['body'],'languageCode':_0x29123c[0x3]||'en'}}};return _0x2270e8['detectIntent'](_0x3784ec)[_0x01d5('0xc')](function(_0x335011){if(_0x335011&&_0x335011[_0x01d5('0x2e')]){_0x4622e7[_0x01d5('0xe')][_0x01d5('0x2f')]=_0x335011;var _0x6a59de=_0x335011[0x0];var _0x36641f=_0x6a59de['queryResult'][_0x01d5('0x30')]&&_0x6a59de[_0x01d5('0x31')][_0x01d5('0x30')]['fields']?_0x6a59de[_0x01d5('0x31')][_0x01d5('0x30')]['fields'][_0x01d5('0x32')]['boolValue']:![];_0x4622e7['body'][_0x01d5('0x33')]=_0x6a59de[_0x01d5('0x31')][_0x01d5('0x34')];_0x4622e7[_0x01d5('0xe')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x6a59de[_0x01d5('0x31')][_0x01d5('0x35')];_0x4622e7[_0x01d5('0xe')][_0x01d5('0x36')]=_0x6a59de[_0x01d5('0x31')][_0x01d5('0x30')]&&_0x6a59de[_0x01d5('0x31')][_0x01d5('0x30')][_0x01d5('0x37')]?_0x6a59de['queryResult'][_0x01d5('0x30')]['fields'][_0x01d5('0x32')][_0x01d5('0x38')]:![];_0x4622e7[_0x01d5('0xe')][_0x01d5('0x39')]=_0x6a59de[_0x01d5('0x31')][_0x01d5('0x3a')]['name'];_0x4622e7[_0x01d5('0xe')][_0x01d5('0x3b')]=_0x6a59de[_0x01d5('0x31')][_0x01d5('0x3a')][_0x01d5('0x3c')];_0x4622e7['body']['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x6a59de[_0x01d5('0x31')]['intent'][_0x01d5('0x3d')];_0x4622e7[_0x01d5('0xe')][_0x01d5('0x3e')]=_0x6a59de[_0x01d5('0x31')][_0x01d5('0x3f')];_0x4622e7[_0x01d5('0xe')][_0x01d5('0x40')]=_0x6a59de['queryResult']['queryText'];_0x4622e7['body']['DIALOGFLOWV2_SCORE']=_0x6a59de[_0x01d5('0x31')][_0x01d5('0x41')];_0x23e0b1[_0x01d5('0x42')]=_0x01d5('0x2f');_0x23e0b1['providerResponse']=JSON[_0x01d5('0x10')](_0x335011);var _0x3f1648=[];for(var _0x15c58e=0x0;_0x15c58e<_0x335011[_0x01d5('0x2e')];_0x15c58e++){var _0x5c96da=_0x335011[_0x15c58e];if(_0x5c96da&&_0x5c96da[_0x01d5('0x31')]&&_0x5c96da['queryResult'][_0x01d5('0x43')]){_0x3f1648[_0x01d5('0x44')](createMessage(_0x1481a0,_0xe02251,_0x23e0b1,_0x5c96da[_0x01d5('0x31')]['fulfillmentText']));}}return Promise[_0x01d5('0x45')](_0x3f1648)[_0x01d5('0xc')](function(){if(_0x36641f){_0x2c2a29[_0x01d5('0x17')]();}else{_0x2c2a29['stop']();}})['catch'](function(_0xe64722){logger[_0x01d5('0x26')](_0x01d5('0xd'),_0x1481a0,JSON['stringify'](_0xe64722));_0x2c2a29[_0x01d5('0x17')]();});}})[_0x01d5('0xf')](function(_0x1268e6){logger['error'](_0x01d5('0xd'),_0x1481a0,_0x1268e6[_0x01d5('0x2d')]);_0x2c2a29[_0x01d5('0x17')]();});}}catch(_0x447185){logger[_0x01d5('0x26')](_0x01d5('0xd'),_0x1481a0,JSON[_0x01d5('0x10')](_0x447185));_0x2c2a29['stop']();}};}; \ No newline at end of file +var _0xe6c4=['name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','length','push','fulfillmentText','all','md5','bluebird','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','body','Message','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','whatsapp','phone','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','created','isEmpty','getMustacheRender','create','then','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','dialogflowV2','queryResult','fields','diagnosticInfo','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent'];(function(_0x14fad0,_0x278d75){var _0x5c665f=function(_0xe43a83){while(--_0xe43a83){_0x14fad0['push'](_0x14fad0['shift']());}};_0x5c665f(++_0x278d75);}(_0xe6c4,0x136));var _0x4e6c=function(_0x6315dd,_0x30d76f){_0x6315dd=_0x6315dd-0x0;var _0x2ff3f9=_0xe6c4[_0x6315dd];return _0x2ff3f9;};'use strict';var _=require('lodash');var dialogflow=require('dialogflow');var md5=require(_0x4e6c('0x0'));var moment=require('moment');var Promise=require(_0x4e6c('0x1'));var logger=require(_0x4e6c('0x2'))('routing');var utils=require('./utils');var rpc={'chatMessage':require(_0x4e6c('0x3')),'openchannelMessage':require(_0x4e6c('0x4')),'mailMessage':require(_0x4e6c('0x5')),'smsMessage':require(_0x4e6c('0x6')),'faxMessage':require(_0x4e6c('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x316048,_0x1af1ad,_0x22030b,_0x1836b9){return new Promise(function(_0x43c0e4,_0x2e2525){var _0x5e31dc=_['clone'](_0x22030b);_0x5e31dc[_0x4e6c('0x8')]=_0x1836b9;return rpc[_0x1af1ad+_0x4e6c('0x9')]['create'](_0x5e31dc)['then'](function(){logger[_0x4e6c('0xa')](_0x4e6c('0xb'),_0x316048,_0x5e31dc[_0x4e6c('0x8')]);_0x43c0e4();})[_0x4e6c('0xc')](function(_0x51f7ab){logger[_0x4e6c('0xd')](_0x4e6c('0xb'),_0x316048,JSON[_0x4e6c('0xe')](_0x51f7ab));_0x2e2525(_0x51f7ab);});});}exports['consequence']=function(_0x2cabcd,_0x97e7eb){return function(_0x553010){try{if(!_[_0x4e6c('0xf')](this[_0x4e6c('0x10')][_0x4e6c('0x11')])){logger['info'](_0x4e6c('0xb'),_0x2cabcd,_0x4e6c('0x12'));return _0x553010[_0x4e6c('0x13')]();}var _0x35fe99={'ContactId':this[_0x4e6c('0x14')]['id'],'sentAt':moment()[_0x4e6c('0x15')](_0x4e6c('0x16')),'direction':_0x4e6c('0x17')};if(this['channel']===_0x4e6c('0x18')||this['channel']===_0x4e6c('0x19')){_0x35fe99['phone']=this[_0x4e6c('0x10')][_0x4e6c('0x1a')];}var _0x3ba19a=this[_0x4e6c('0x1b')];if(_0x3ba19a===_0x4e6c('0x1c')){_0x35fe99[_0x4e6c('0x1d')]=this[_0x4e6c('0x1e')]['id'];}else{_0x35fe99[_['upperFirst'](_0x3ba19a)+_0x4e6c('0x1f')]=this[_0x4e6c('0x1e')]['id'];}_0x35fe99[_[_0x4e6c('0x20')](_0x3ba19a)+_0x4e6c('0x21')]=this[_0x4e6c('0x10')]['id'];if(this[_0x4e6c('0x10')][_0x4e6c('0x22')]){var _0x26bcc3=_0x97e7eb[0x4];if(!_[_0x4e6c('0x23')](_0x26bcc3)){_0x35fe99['body']=utils[_0x4e6c('0x24')](_0x26bcc3,this);return rpc[_0x3ba19a+_0x4e6c('0x9')][_0x4e6c('0x25')](_0x35fe99)[_0x4e6c('0x26')](function(_0x3bc46d){logger[_0x4e6c('0xa')]('[%s][DIALOGFLOWV2]\x20%s',_0x2cabcd,_0x35fe99[_0x4e6c('0x8')]);})['catch'](function(_0x3838f9){logger[_0x4e6c('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x2cabcd,JSON['stringify'](_0x3838f9));})[_0x4e6c('0x27')](function(){logger[_0x4e6c('0xa')](_0x4e6c('0x28'),_0x2cabcd);_0x553010[_0x4e6c('0x29')]();});}else{logger[_0x4e6c('0xa')](_0x4e6c('0x2a'),_0x2cabcd);_0x553010['stop']();}}else{var _0x19badc=this;var _0x200ac0=_0x97e7eb[0x2][_0x4e6c('0x2b')](/\\n/g,'\x0a');var _0x5e9883={'credentials':{'private_key':_0x200ac0,'client_email':_0x97e7eb[0x1]}};var _0xaba0f1=new dialogflow[(_0x4e6c('0x2c'))](_0x5e9883);var _0x3b8865=_0xaba0f1[_0x4e6c('0x2d')](_0x97e7eb[0x0],md5(_0x19badc[_0x4e6c('0x10')]['id']));var _0x7a4991={'session':_0x3b8865,'queryInput':{'text':{'text':_0x19badc[_0x4e6c('0x2e')][_0x4e6c('0x8')],'languageCode':_0x97e7eb[0x3]||'en'}}};return _0xaba0f1[_0x4e6c('0x2f')](_0x7a4991)[_0x4e6c('0x26')](function(_0x302d94){if(_0x302d94&&_0x302d94['length']){_0x19badc['body'][_0x4e6c('0x30')]=_0x302d94;var _0x3901a8=_0x302d94[0x0];var _0x10bdc2=_0x3901a8['queryResult']['diagnosticInfo']&&_0x3901a8[_0x4e6c('0x31')]['diagnosticInfo'][_0x4e6c('0x32')]?_0x3901a8[_0x4e6c('0x31')][_0x4e6c('0x33')]['fields'][_0x4e6c('0x34')][_0x4e6c('0x35')]:![];_0x19badc[_0x4e6c('0x8')][_0x4e6c('0x36')]=_0x3901a8['queryResult'][_0x4e6c('0x37')];_0x19badc[_0x4e6c('0x8')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x3901a8['queryResult'][_0x4e6c('0x38')];_0x19badc['body'][_0x4e6c('0x39')]=_0x3901a8['queryResult'][_0x4e6c('0x33')]&&_0x3901a8['queryResult'][_0x4e6c('0x33')][_0x4e6c('0x32')]?_0x3901a8[_0x4e6c('0x31')][_0x4e6c('0x33')][_0x4e6c('0x32')]['end_conversation'][_0x4e6c('0x35')]:![];_0x19badc['body'][_0x4e6c('0x3a')]=_0x3901a8[_0x4e6c('0x31')][_0x4e6c('0x3b')][_0x4e6c('0x3c')];_0x19badc[_0x4e6c('0x8')][_0x4e6c('0x3d')]=_0x3901a8[_0x4e6c('0x31')][_0x4e6c('0x3b')][_0x4e6c('0x3e')];_0x19badc[_0x4e6c('0x8')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x3901a8[_0x4e6c('0x31')][_0x4e6c('0x3b')][_0x4e6c('0x3f')];_0x19badc['body'][_0x4e6c('0x40')]=_0x3901a8[_0x4e6c('0x31')][_0x4e6c('0x41')];_0x19badc['body'][_0x4e6c('0x42')]=_0x3901a8[_0x4e6c('0x31')]['queryText'];_0x19badc['body'][_0x4e6c('0x43')]=_0x3901a8[_0x4e6c('0x31')][_0x4e6c('0x44')];_0x35fe99[_0x4e6c('0x45')]=_0x4e6c('0x30');_0x35fe99['providerResponse']=JSON[_0x4e6c('0xe')](_0x302d94);var _0x3e92cc=[];for(var _0x3c6ca1=0x0;_0x3c6ca1<_0x302d94[_0x4e6c('0x46')];_0x3c6ca1++){var _0x39acca=_0x302d94[_0x3c6ca1];if(_0x39acca&&_0x39acca[_0x4e6c('0x31')]&&_0x39acca[_0x4e6c('0x31')]['fulfillmentText']){_0x3e92cc[_0x4e6c('0x47')](createMessage(_0x2cabcd,_0x3ba19a,_0x35fe99,_0x39acca[_0x4e6c('0x31')][_0x4e6c('0x48')]));}}return Promise[_0x4e6c('0x49')](_0x3e92cc)['then'](function(){if(_0x10bdc2){_0x553010[_0x4e6c('0x13')]();}else{_0x553010['stop']();}})[_0x4e6c('0xc')](function(_0x37ed9d){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x2cabcd,JSON[_0x4e6c('0xe')](_0x37ed9d));_0x553010['next']();});}})[_0x4e6c('0xc')](function(_0x248805){logger[_0x4e6c('0xd')](_0x4e6c('0xb'),_0x2cabcd,_0x248805[_0x4e6c('0x2e')]);_0x553010[_0x4e6c('0x13')]();});}}catch(_0x3a558b){logger[_0x4e6c('0xd')](_0x4e6c('0xb'),_0x2cabcd,JSON[_0x4e6c('0xe')](_0x3a558b));_0x553010['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 66ea02b..bf1ff77 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 _0xdbd3=['rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','stringify','html-to-text','./utils','../../../../config/logger','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','validate','length','error','[%s][GOTOIF]\x20%s','map','join','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next'];(function(_0x216d45,_0x4989fe){var _0xbaac0b=function(_0x308a41){while(--_0x308a41){_0x216d45['push'](_0x216d45['shift']());}};_0xbaac0b(++_0x4989fe);}(_0xdbd3,0x101));var _0x3dbd=function(_0x201efd,_0x561cd2){_0x201efd=_0x201efd-0x0;var _0x328cdb=_0xdbd3[_0x201efd];return _0x328cdb;};'use strict';var schema=require('validate');var _=require('lodash');var htmlToText=require(_0x3dbd('0x0'));var utils=require(_0x3dbd('0x1'));var logger=require(_0x3dbd('0x2'))('routing');var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x3dbd('0x3')},'priorityTrue':{'type':_0x3dbd('0x4'),'message':_0x3dbd('0x5')},'priorityFalse':{'type':_0x3dbd('0x4'),'message':_0x3dbd('0x6')}});exports[_0x3dbd('0x7')]=function(_0x495df0,_0x82bf6d){return function(_0x2d2723){try{var _0x58b0ee={'condition':htmlToText[_0x3dbd('0x8')](utils[_0x3dbd('0x9')](_0x82bf6d[0x0],this),{'wordwrap':![]})[_0x3dbd('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x82bf6d[0x1],'priorityFalse':_0x82bf6d[0x2]};var _0x5e193b=gotoif[_0x3dbd('0xb')](_0x58b0ee,{'typecast':!![]});if(_0x5e193b[_0x3dbd('0xc')]){logger[_0x3dbd('0xd')](_0x3dbd('0xe'),_0x495df0,_[_0x3dbd('0xf')](_0x5e193b,'message')[_0x3dbd('0x10')](',\x20'));_0x2d2723['stop']();}else{try{var _0x1d4139=eval('('+_0x58b0ee[_0x3dbd('0x11')]+')');var _0x284648=_0x1d4139?_0x58b0ee[_0x3dbd('0x12')]:_0x58b0ee[_0x3dbd('0x13')];logger[_0x3dbd('0x14')](_0x3dbd('0x15'),_0x495df0,_0x58b0ee[_0x3dbd('0x11')],_0x1d4139,_0x284648||_0x3dbd('0x16'));if(_0x284648){var _0x2e16d0=_['findIndex'](_0x2d2723[_0x3dbd('0x17')](),{'p':_0x284648});if(_0x2e16d0>=0x0){logger[_0x3dbd('0x14')](_0x3dbd('0x18'),_0x495df0,_0x284648||_0x3dbd('0x16'),_0x2e16d0);_0x2d2723[_0x3dbd('0x16')](_0x2e16d0);}else{logger[_0x3dbd('0x14')](_0x3dbd('0x19'),_0x495df0,_0x284648||_0x3dbd('0x16'));_0x2d2723['stop']();}}else{_0x2d2723[_0x3dbd('0x16')]();}}catch(_0x5cc0b1){logger[_0x3dbd('0xd')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x495df0,_0x5cc0b1['message']);_0x2d2723[_0x3dbd('0x1a')]();}}}catch(_0x4adf0b){logger[_0x3dbd('0xd')]('[%s][GOTOIF]\x20%s',_0x495df0,JSON[_0x3dbd('0x1b')](_0x4adf0b));_0x2d2723[_0x3dbd('0x1a')]();}};}; \ No newline at end of file +var _0x4fb5=['routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','info','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','error','stringify','lodash','html-to-text','./utils'];(function(_0x4c83a9,_0x3d0c29){var _0x171e21=function(_0x36ac63){while(--_0x36ac63){_0x4c83a9['push'](_0x4c83a9['shift']());}};_0x171e21(++_0x3d0c29);}(_0x4fb5,0x15c));var _0x54fb=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x4fb5[_0x4e9d3c];return _0x2d0825;};'use strict';var schema=require('validate');var _=require(_0x54fb('0x0'));var htmlToText=require(_0x54fb('0x1'));var utils=require(_0x54fb('0x2'));var logger=require('../../../../config/logger')(_0x54fb('0x3'));var gotoif=schema({'condition':{'type':_0x54fb('0x4'),'required':!![],'message':_0x54fb('0x5')},'priorityTrue':{'type':'number','message':_0x54fb('0x6')},'priorityFalse':{'type':_0x54fb('0x7'),'message':_0x54fb('0x8')}});exports['consequence']=function(_0x4bfd73,_0x1f0a02){return function(_0x2d967e){try{var _0x38c696={'condition':htmlToText[_0x54fb('0x9')](utils[_0x54fb('0xa')](_0x1f0a02[0x0],this),{'wordwrap':![]})[_0x54fb('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1f0a02[0x1],'priorityFalse':_0x1f0a02[0x2]};var _0x678605=gotoif['validate'](_0x38c696,{'typecast':!![]});if(_0x678605[_0x54fb('0xc')]){logger['error'](_0x54fb('0xd'),_0x4bfd73,_[_0x54fb('0xe')](_0x678605,_0x54fb('0xf'))[_0x54fb('0x10')](',\x20'));_0x2d967e[_0x54fb('0x11')]();}else{try{var _0x844551=eval('('+_0x38c696[_0x54fb('0x12')]+')');var _0x2764be=_0x844551?_0x38c696['priorityTrue']:_0x38c696['priorityFalse'];logger[_0x54fb('0x13')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x4bfd73,_0x38c696[_0x54fb('0x12')],_0x844551,_0x2764be||_0x54fb('0x14'));if(_0x2764be){var _0x20147a=_['findIndex'](_0x2d967e[_0x54fb('0x15')](),{'p':_0x2764be});if(_0x20147a>=0x0){logger[_0x54fb('0x13')](_0x54fb('0x16'),_0x4bfd73,_0x2764be||'next',_0x20147a);_0x2d967e[_0x54fb('0x14')](_0x20147a);}else{logger['info'](_0x54fb('0x17'),_0x4bfd73,_0x2764be||'next');_0x2d967e[_0x54fb('0x11')]();}}else{_0x2d967e[_0x54fb('0x14')]();}}catch(_0x3fea77){logger['error'](_0x54fb('0x18'),_0x4bfd73,_0x3fea77['message']);_0x2d967e[_0x54fb('0x11')]();}}}catch(_0x30da1a){logger[_0x54fb('0x19')]('[%s][GOTOIF]\x20%s',_0x4bfd73,JSON[_0x54fb('0x1a')](_0x30da1a));_0x2d967e[_0x54fb('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 0bc536d..0c13ac0 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 _0x9e39=['rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','lodash','../../../../config/logger','routing','number','error','[%s][GOTOP]\x20%s','map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex'];(function(_0x362057,_0x448ff9){var _0x397f79=function(_0x22b0ff){while(--_0x22b0ff){_0x362057['push'](_0x362057['shift']());}};_0x397f79(++_0x448ff9);}(_0x9e39,0x114));var _0x99e3=function(_0x44ef0f,_0x6131bf){_0x44ef0f=_0x44ef0f-0x0;var _0x13fe43=_0x9e39[_0x44ef0f];return _0x13fe43;};'use strict';var schema=require('validate');var _=require(_0x99e3('0x0'));var logger=require(_0x99e3('0x1'))(_0x99e3('0x2'));var gotop=schema({'priority':{'type':_0x99e3('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x440066,_0x14d5ca){return function(_0x34363c){try{var _0x458822={'priority':_0x14d5ca[0x0]};var _0x791c35=gotop['validate'](_0x458822,{'typecast':!![]});if(_0x791c35['length']){logger[_0x99e3('0x4')](_0x99e3('0x5'),_0x440066,_[_0x99e3('0x6')](_0x791c35,'message')[_0x99e3('0x7')](',\x20'));_0x34363c[_0x99e3('0x8')]();}else{logger[_0x99e3('0x9')](_0x99e3('0xa'),_0x440066,_0x458822[_0x99e3('0xb')]);if(_0x458822[_0x99e3('0xb')]){var _0x5c54ac=_[_0x99e3('0xc')](_0x34363c[_0x99e3('0xd')](),{'p':_0x458822[_0x99e3('0xb')]});if(_0x5c54ac>=0x0){logger[_0x99e3('0x9')](_0x99e3('0xe'),_0x440066,_0x458822[_0x99e3('0xb')]||'next',_0x5c54ac);_0x34363c['next'](_0x5c54ac);}else{logger[_0x99e3('0x9')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x440066,_0x458822['priority']||_0x99e3('0xf'));_0x34363c[_0x99e3('0x8')]();}}else{_0x34363c[_0x99e3('0xf')]();}}}catch(_0xcab39e){logger[_0x99e3('0x4')]('[%s][GOTOP]\x20%s',_0x440066,JSON[_0x99e3('0x10')](_0xcab39e));_0x34363c['stop']();}};}; \ No newline at end of file +var _0x839d=['rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20%s','lodash','../../../../config/logger','routing','number','consequence','length','error','map','message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex'];(function(_0x1a160b,_0x2d0aa4){var _0x214166=function(_0x546d34){while(--_0x546d34){_0x1a160b['push'](_0x1a160b['shift']());}};_0x214166(++_0x2d0aa4);}(_0x839d,0xb8));var _0xd839=function(_0x1a8c5e,_0x323310){_0x1a8c5e=_0x1a8c5e-0x0;var _0x5dca62=_0x839d[_0x1a8c5e];return _0x5dca62;};'use strict';var schema=require('validate');var _=require(_0xd839('0x0'));var logger=require(_0xd839('0x1'))(_0xd839('0x2'));var gotop=schema({'priority':{'type':_0xd839('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xd839('0x4')]=function(_0x24fc40,_0x4e7389){return function(_0x38824e){try{var _0xd21763={'priority':_0x4e7389[0x0]};var _0x181bea=gotop['validate'](_0xd21763,{'typecast':!![]});if(_0x181bea[_0xd839('0x5')]){logger[_0xd839('0x6')]('[%s][GOTOP]\x20%s',_0x24fc40,_[_0xd839('0x7')](_0x181bea,_0xd839('0x8'))[_0xd839('0x9')](',\x20'));_0x38824e[_0xd839('0xa')]();}else{logger['info'](_0xd839('0xb'),_0x24fc40,_0xd21763[_0xd839('0xc')]);if(_0xd21763[_0xd839('0xc')]){var _0x29e705=_[_0xd839('0xd')](_0x38824e[_0xd839('0xe')](),{'p':_0xd21763[_0xd839('0xc')]});if(_0x29e705>=0x0){logger['info'](_0xd839('0xf'),_0x24fc40,_0xd21763['priority']||_0xd839('0x10'),_0x29e705);_0x38824e['next'](_0x29e705);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x24fc40,_0xd21763[_0xd839('0xc')]||_0xd839('0x10'));_0x38824e['stop']();}}else{_0x38824e[_0xd839('0x10')]();}}}catch(_0x354dfb){logger[_0xd839('0x6')](_0xd839('0x11'),_0x24fc40,JSON['stringify'](_0x354dfb));_0x38824e[_0xd839('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index a62441c..57af4b9 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 _0x0135=['stop','lodash','./utils','../../../../config/logger','routing','../../rpc/smsMessage','../../rpc/whatsappMessage','contact','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','create','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify'];(function(_0x84f7ae,_0x1c0a9a){var _0x2cdb7a=function(_0x377fe2){while(--_0x377fe2){_0x84f7ae['push'](_0x84f7ae['shift']());}};_0x2cdb7a(++_0x1c0a9a);}(_0x0135,0x188));var _0x5013=function(_0x5b64f6,_0x164b28){_0x5b64f6=_0x5b64f6-0x0;var _0x3e7de3=_0x0135[_0x5b64f6];return _0x3e7de3;};'use strict';var _=require(_0x5013('0x0'));var utils=require(_0x5013('0x1'));var logger=require(_0x5013('0x2'))(_0x5013('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x5013('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x5013('0x5'))};exports['consequence']=function(_0x18053e,_0x18e91b){return function(_0x5046c8){try{var _0x524c20={'body':utils['getMustacheRender'](_0x18e91b[0x0],this),'ContactId':this[_0x5013('0x6')]['id']};if(this[_0x5013('0x7')]===_0x5013('0x8')){_0x524c20[_0x5013('0x9')]=this[_0x5013('0xa')]['id'];}else{_0x524c20[_[_0x5013('0xb')](this['channel'])+'AccountId']=this['account']['id'];}_0x524c20[_[_0x5013('0xb')](this[_0x5013('0x7')])+_0x5013('0xc')]=this[_0x5013('0xd')]['id'];if(rpc[this['channel']+_0x5013('0xe')]){return rpc[this[_0x5013('0x7')]+'Message'][_0x5013('0xf')](_0x524c20)['then'](function(_0x28b75e){logger['info'](_0x5013('0x10'),_0x18053e,_0x524c20[_0x5013('0x11')]);_0x5046c8[_0x5013('0x12')]();})[_0x5013('0x13')](function(_0x3bdf65){logger[_0x5013('0x14')](_0x5013('0x10'),_0x18053e,JSON[_0x5013('0x15')](_0x3bdf65));_0x5046c8[_0x5013('0x16')]();});}}catch(_0x2033ae){logger[_0x5013('0x14')](_0x5013('0x10'),_0x18053e,JSON[_0x5013('0x15')](_0x2033ae));_0x5046c8['stop']();}};}; \ No newline at end of file +var _0x8c9c=['then','info','body','catch','stringify','error','[%s][MESSAGE]\x20%s','stop','./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create'];(function(_0x2e65ae,_0x4be0b9){var _0x2849e8=function(_0x235ae0){while(--_0x235ae0){_0x2e65ae['push'](_0x2e65ae['shift']());}};_0x2849e8(++_0x4be0b9);}(_0x8c9c,0x131));var _0xc8c9=function(_0x39a823,_0x100f92){_0x39a823=_0x39a823-0x0;var _0x5005bb=_0x8c9c[_0x39a823];return _0x5005bb;};'use strict';var _=require('lodash');var utils=require(_0xc8c9('0x0'));var logger=require(_0xc8c9('0x1'))(_0xc8c9('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc8c9('0x3')),'smsMessage':require(_0xc8c9('0x4')),'faxMessage':require(_0xc8c9('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xc8c9('0x6')]=function(_0x25032c,_0x57adce){return function(_0xe27865){try{var _0x519cda={'body':utils[_0xc8c9('0x7')](_0x57adce[0x0],this),'ContactId':this[_0xc8c9('0x8')]['id']};if(this[_0xc8c9('0x9')]===_0xc8c9('0xa')){_0x519cda[_0xc8c9('0xb')]=this[_0xc8c9('0xc')]['id'];}else{_0x519cda[_[_0xc8c9('0xd')](this[_0xc8c9('0x9')])+_0xc8c9('0xe')]=this[_0xc8c9('0xc')]['id'];}_0x519cda[_[_0xc8c9('0xd')](this[_0xc8c9('0x9')])+_0xc8c9('0xf')]=this[_0xc8c9('0x10')]['id'];if(rpc[this[_0xc8c9('0x9')]+_0xc8c9('0x11')]){return rpc[this['channel']+_0xc8c9('0x11')][_0xc8c9('0x12')](_0x519cda)[_0xc8c9('0x13')](function(_0x12ed66){logger[_0xc8c9('0x14')]('[%s][MESSAGE]\x20%s',_0x25032c,_0x519cda[_0xc8c9('0x15')]);_0xe27865['next']();})[_0xc8c9('0x16')](function(_0x24d593){logger['error']('[%s][MESSAGE]\x20%s',_0x25032c,JSON[_0xc8c9('0x17')](_0x24d593));_0xe27865['stop']();});}}catch(_0xa1afd8){logger[_0xc8c9('0x18')](_0xc8c9('0x19'),_0x25032c,JSON[_0xc8c9('0x17')](_0xa1afd8));_0xe27865[_0xc8c9('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 ef0c1af..cd95400 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 _0x121f=['next','stringify','stop','./utils','routing','info','[%s][NOOP]\x20%s'];(function(_0x29dcc5,_0x44f924){var _0x2a74e1=function(_0x3ece6d){while(--_0x3ece6d){_0x29dcc5['push'](_0x29dcc5['shift']());}};_0x2a74e1(++_0x44f924);}(_0x121f,0x96));var _0xf121=function(_0x1fb4e1,_0x3d4ce6){_0x1fb4e1=_0x1fb4e1-0x0;var _0x22d1b0=_0x121f[_0x1fb4e1];return _0x22d1b0;};'use strict';var utils=require(_0xf121('0x0'));var logger=require('../../../../config/logger')(_0xf121('0x1'));exports['consequence']=function(_0x553c2c,_0x38e6fb){return function(_0x645a44){try{logger[_0xf121('0x2')](_0xf121('0x3'),_0x553c2c,utils['getMustacheRender'](_0x38e6fb[0x0],this));_0x645a44[_0xf121('0x4')]();}catch(_0x5b8a9b){logger['error'](_0xf121('0x3'),_0x553c2c,JSON[_0xf121('0x5')](_0x5b8a9b));_0x645a44[_0xf121('0x6')]();}};}; \ No newline at end of file +var _0x9fa3=['consequence','info','getMustacheRender','next','error','[%s][NOOP]\x20%s','stringify','stop','./utils','../../../../config/logger'];(function(_0x2cc021,_0x54b3ec){var _0x4bb381=function(_0x5e31e5){while(--_0x5e31e5){_0x2cc021['push'](_0x2cc021['shift']());}};_0x4bb381(++_0x54b3ec);}(_0x9fa3,0xda));var _0x39fa=function(_0x2b1ef6,_0x990719){_0x2b1ef6=_0x2b1ef6-0x0;var _0x36cf88=_0x9fa3[_0x2b1ef6];return _0x36cf88;};'use strict';var utils=require(_0x39fa('0x0'));var logger=require(_0x39fa('0x1'))('routing');exports[_0x39fa('0x2')]=function(_0x519a88,_0x1727f2){return function(_0xb30ead){try{logger[_0x39fa('0x3')]('[%s][NOOP]\x20%s',_0x519a88,utils[_0x39fa('0x4')](_0x1727f2[0x0],this));_0xb30ead[_0x39fa('0x5')]();}catch(_0x45b1f8){logger[_0x39fa('0x6')](_0x39fa('0x7'),_0x519a88,JSON[_0x39fa('0x8')](_0x45b1f8));_0xb30ead[_0x39fa('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index fd1d507..87e998d 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 _0x23c6=['QueueReport','update','timeout','[%s][END:QUEUE][NAME:%s]','body','toLowerCase','length','join','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/faxQueueReport','timeout\x20is\x20a\x20number','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','InteractionId','interaction','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','create','catch','error','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0x23c6,0x19c));var _0x623c=function(_0x44b913,_0x29ca8d){_0x44b913=_0x44b913-0x0;var _0x481966=_0x23c6[_0x44b913];return _0x481966;};'use strict';var schema=require(_0x623c('0x0'));var _=require(_0x623c('0x1'));var util=require(_0x623c('0x2'));var seqqueue=require(_0x623c('0x3'));var moment=require(_0x623c('0x4'));var Redis=require(_0x623c('0x5'));var config=require(_0x623c('0x6'));var logger=require('../../../../config/logger')(_0x623c('0x7'));var strategy=require(_0x623c('0x8'));config[_0x623c('0x9')]=_['defaults'](config[_0x623c('0x9')],{'host':_0x623c('0xa'),'port':0x18eb});var io=require(_0x623c('0xb'))(new Redis(config[_0x623c('0x9')]));var attributes=['id',_0x623c('0xc'),_0x623c('0xd'),_0x623c('0xe'),_0x623c('0xf'),_0x623c('0x10')];function emit(_0x531d8d,_0x2a2ba9,_0x478117){io['to'](_0x531d8d)[_0x623c('0x11')](_0x2a2ba9,_0x478117);}function emitChannelQueueInteraction(_0x11078f,_0x3a5603,_0x4186e6,_0x4c02ee,_0x496f40,_0x302755,_0x59954c,_0x300166){var _0x49d0ae=_[_0x623c('0x12')](_0x4186e6);_0x49d0ae[_0x623c('0xc')]=_0x300166;_0x49d0ae[_0x623c('0xe')]=_0x3a5603;_0x49d0ae[_0x623c('0xd')]=_0x4c02ee;_0x49d0ae['id']=_0x496f40;if(_0x302755){_0x59954c[util[_0x623c('0x13')](_0x623c('0x14'),_0x11078f)][_0x496f40]=_[_0x623c('0x15')](_0x49d0ae,attributes);}else{delete _0x59954c[util['format'](_0x623c('0x14'),_0x11078f)][_0x496f40];}emit(util[_0x623c('0x13')](_0x623c('0x16'),_0x11078f,_0x3a5603),util[_0x623c('0x13')]('%s_queue_waiting_interaction:%s',_0x11078f,_0x302755?_0x623c('0x17'):_0x623c('0x18')),_['pick'](_0x49d0ae,attributes));}var rpc={'openchannelQueueReport':require(_0x623c('0x19')),'mailQueueReport':require(_0x623c('0x1a')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x623c('0x1b')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x623c('0x1c')}});function startRouting(_0x5b7746,_0x3d2f10,_0x11ba5a,_0x180f67){if(_0x5b7746&&_0x3d2f10&&_0x11ba5a){_0x3d2f10['waiting']+=0x1;var _0x43e0ef={'uniqueid':_0x5b7746,'from':_0x11ba5a['body']?_0x11ba5a['body'][_0x623c('0xf')]:'','joinAt':moment()[_0x623c('0x13')](_0x623c('0x1d')),'ContactId':_0x11ba5a[_0x623c('0x1e')]?_0x11ba5a[_0x623c('0x1e')]['id']:null,'ListId':_0x11ba5a[_0x623c('0x1f')]?_0x11ba5a[_0x623c('0x1f')]['id']:null};_0x43e0ef[_['upperFirst'](_0x11ba5a[_0x623c('0x20')])+_0x623c('0x21')]=_0x3d2f10['id']||null;_0x43e0ef[_[_0x623c('0x22')](_0x11ba5a[_0x623c('0x20')])+_0x623c('0x23')]=_0x11ba5a[_0x623c('0x24')]?_0x11ba5a[_0x623c('0x24')]['id']:null;_0x43e0ef[_[_0x623c('0x22')](_0x11ba5a[_0x623c('0x20')])+'MessageId']=_0x11ba5a[_0x623c('0x25')]?_0x11ba5a['message']['id']:null;_0x43e0ef[_[_0x623c('0x22')](_0x11ba5a[_0x623c('0x20')])+(_0x11ba5a[_0x623c('0x20')]!==_0x623c('0x26')?_0x623c('0x27'):_0x623c('0x28'))]=_0x11ba5a['account']?_0x11ba5a[_0x623c('0xd')]['id']:null;logger[_0x623c('0x29')](util['format'](_0x623c('0x2a'),_0x5b7746,_0x3d2f10['name']));emitChannelQueueInteraction(_0x11ba5a[_0x623c('0x20')],_0x3d2f10[_0x623c('0x2b')],_0x43e0ef,_0x11ba5a[_0x623c('0xd')][_0x623c('0x2b')],_0x11ba5a[_0x623c('0x25')]['id'],!![],_0x180f67,_0x3d2f10['id']);if(rpc[_0x11ba5a[_0x623c('0x20')]+'QueueReport']){return rpc[_0x11ba5a['channel']+'QueueReport'][_0x623c('0x2c')](_0x43e0ef)[_0x623c('0x2d')](function(_0x5984ec){logger[_0x623c('0x2e')]('create\x20queue\x20report');});}}}function stopRouting(_0x20ec4d,_0x29d9c8,_0x5c033f,_0x2ebffc){if(_0x20ec4d&&_0x29d9c8){_0x29d9c8[_0x623c('0x2f')]-=0x1;var _0x20d508={'leaveAt':moment()[_0x623c('0x13')](_0x623c('0x1d')),'acceptAt':moment()[_0x623c('0x13')](_0x623c('0x1d')),'reason':_0x623c('0x30')};logger[_0x623c('0x29')](util[_0x623c('0x13')](_0x623c('0x31'),_0x20ec4d,_0x29d9c8[_0x623c('0x2b')]));emitChannelQueueInteraction(_0x5c033f[_0x623c('0x20')],_0x29d9c8[_0x623c('0x2b')],_0x5c033f['body'],_0x5c033f['account'][_0x623c('0x2b')],_0x5c033f['message']['id'],![],_0x2ebffc,_0x29d9c8['id']);if(rpc[_0x5c033f[_0x623c('0x20')]+_0x623c('0x32')]){return rpc[_0x5c033f[_0x623c('0x20')]+_0x623c('0x32')][_0x623c('0x33')](_0x20ec4d,_0x20d508)['catch'](function(_0x2da407){logger[_0x623c('0x2e')]('update\x20queue\x20report');});}}}function endRouting(_0x20301e,_0x1a24b8,_0x33ea4e,_0x3e89fd){if(_0x20301e&&_0x1a24b8){_0x1a24b8[_0x623c('0x2f')]-=0x1;var _0x11b23f={'leaveAt':moment()['format'](_0x623c('0x1d')),'exitAt':moment()[_0x623c('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x623c('0x34')};logger[_0x623c('0x29')](util[_0x623c('0x13')](_0x623c('0x35'),_0x20301e,_0x1a24b8[_0x623c('0x2b')]));emitChannelQueueInteraction(_0x33ea4e['channel'],_0x1a24b8[_0x623c('0x2b')],_0x33ea4e[_0x623c('0x36')],_0x33ea4e[_0x623c('0xd')][_0x623c('0x2b')],_0x33ea4e[_0x623c('0x25')]['id'],![],_0x3e89fd);if(rpc[_0x33ea4e[_0x623c('0x20')]+'QueueReport']){return rpc[_0x33ea4e[_0x623c('0x20')]+'QueueReport'][_0x623c('0x33')](_0x20301e,_0x11b23f)['catch'](function(_0x42f525){logger[_0x623c('0x2e')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x49a6c1){return function(_0x3f05d1){return _0x3f05d1['name'][_0x623c('0x37')]()===_0x49a6c1['toLowerCase']();};}exports['consequence']=function(_0x3dac8a,_0x460f3c,_0x44d33f,_0x25e321){return function(_0x137f71){try{var _0x399235={'name':_0x460f3c[0x0],'timeout':_0x460f3c[0x1]};var _0x11d546=queue[_0x623c('0x0')](_0x399235,{'typecast':!![]});if(_0x11d546[_0x623c('0x38')]){logger[_0x623c('0x2e')]('[%s][QUEUE]\x20%s',_0x3dac8a,_['map'](_0x11d546,_0x623c('0x25'))[_0x623c('0x39')](',\x20'));_0x137f71[_0x623c('0x3a')]();}else{var _0x3405a8=_[_0x623c('0x3b')](_0x44d33f[_0x25e321[_0x623c('0x20')]+_0x623c('0x3c')],handleFindQueue(_0x399235['name']));if(_0x3405a8){startRouting(_0x3dac8a,_0x3405a8,_0x25e321,_0x44d33f);var _0x328c24=(_0x3405a8['timeout']||0xa)*0x3e8;var _0x10f31b=(_0x399235[_0x623c('0x34')]||0x14)*0x3e8;var _0x5b5d02,_0x4bfe41;if(_0x328c24>_0x10f31b){_0x10f31b=_0x328c24;}var _0x5c1155=seqqueue[_0x623c('0x3d')](_0x328c24);_0x5c1155['id']=_0x3dac8a;_0x5c1155[_0x623c('0x3e')]=_0x328c24;_0x5c1155[_0x623c('0x3f')]=_0x10f31b;_0x5c1155[_0x623c('0x20')]=_0x25e321['channel'];_0x44d33f[_0x623c('0x40')][_0x3dac8a]['on'](_0x623c('0x41'),function(){logger[_0x623c('0x29')](_0x623c('0x42'),_0x3dac8a);stopRouting(_0x3dac8a,_0x3405a8,_0x25e321,_0x44d33f);clearTimeout(_0x5b5d02);_0x5b5d02=undefined;_0x5c1155[_0x623c('0x43')](!![]);if(_0x44d33f['rules'][_0x3dac8a]){delete _0x44d33f[_0x623c('0x40')][_0x3dac8a];}_0x137f71['stop']();});_0x44d33f[_0x623c('0x40')][_0x3dac8a]['on'](_0x623c('0x44'),function(){if(_0x44d33f[_0x623c('0x40')][_0x3dac8a]){delete _0x44d33f[_0x623c('0x40')][_0x3dac8a];}});_0x5b5d02=setTimeout(function(){logger['info'](_0x623c('0x45'),_0x3dac8a);endRouting(_0x3dac8a,_0x3405a8,_0x25e321,_0x44d33f);clearTimeout(_0x5b5d02);_0x5c1155[_0x623c('0x43')](!![]);_0x137f71[_0x623c('0x46')]();},_0x10f31b);switch(_0x3405a8['strategy']){case _0x623c('0x47'):strategy[_0x623c('0x47')](_0x5c1155,_0x3405a8,_0x44d33f,_0x25e321);break;default:strategy[_0x623c('0x48')](_0x5c1155,_0x3405a8,_0x44d33f,_0x25e321);}}else{logger[_0x623c('0x2e')](_0x623c('0x49'),_0x3dac8a,_0x399235[_0x623c('0x2b')]);_0x137f71[_0x623c('0x3a')]();}}}catch(_0x1ec967){console[_0x623c('0x4a')](_0x1ec967);logger['error'](_0x623c('0x4b'),_0x3dac8a,_0x1ec967[_0x623c('0x4c')]);_0x137f71[_0x623c('0x3a')]();}};}; \ No newline at end of file +var _0x8d05=['util','seq-queue','moment','../../../../config/logger','routing','./strategy','redis','localhost','account','queue','from','joinAt','emit','clone','queue_id','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../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','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','interaction','MessageId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','join','Queues','timeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','log','validate','lodash'];(function(_0x9feefe,_0x120ab8){var _0x4ffa93=function(_0x41bae5){while(--_0x41bae5){_0x9feefe['push'](_0x9feefe['shift']());}};_0x4ffa93(++_0x120ab8);}(_0x8d05,0xe8));var _0x58d0=function(_0x40caa7,_0x1b47c4){_0x40caa7=_0x40caa7-0x0;var _0x52e77d=_0x8d05[_0x40caa7];return _0x52e77d;};'use strict';var schema=require(_0x58d0('0x0'));var _=require(_0x58d0('0x1'));var util=require(_0x58d0('0x2'));var seqqueue=require(_0x58d0('0x3'));var moment=require(_0x58d0('0x4'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x58d0('0x5'))(_0x58d0('0x6'));var strategy=require(_0x58d0('0x7'));config[_0x58d0('0x8')]=_['defaults'](config[_0x58d0('0x8')],{'host':_0x58d0('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x58d0('0x8')]));var attributes=['id','queue_id',_0x58d0('0xa'),_0x58d0('0xb'),_0x58d0('0xc'),_0x58d0('0xd')];function emit(_0x1d070a,_0x492edf,_0x35d080){io['to'](_0x1d070a)[_0x58d0('0xe')](_0x492edf,_0x35d080);}function emitChannelQueueInteraction(_0x52bab1,_0x1ce0e7,_0x60bcaf,_0x555e46,_0x4c8a93,_0x2bac57,_0x3e4c78,_0x85352e){var _0x1efa0d=_[_0x58d0('0xf')](_0x60bcaf);_0x1efa0d[_0x58d0('0x10')]=_0x85352e;_0x1efa0d[_0x58d0('0xb')]=_0x1ce0e7;_0x1efa0d[_0x58d0('0xa')]=_0x555e46;_0x1efa0d['id']=_0x4c8a93;if(_0x2bac57){_0x3e4c78[util[_0x58d0('0x11')](_0x58d0('0x12'),_0x52bab1)][_0x4c8a93]=_[_0x58d0('0x13')](_0x1efa0d,attributes);}else{delete _0x3e4c78[util[_0x58d0('0x11')](_0x58d0('0x12'),_0x52bab1)][_0x4c8a93];}emit(util[_0x58d0('0x11')](_0x58d0('0x14'),_0x52bab1,_0x1ce0e7),util[_0x58d0('0x11')](_0x58d0('0x15'),_0x52bab1,_0x2bac57?_0x58d0('0x16'):_0x58d0('0x17')),_['pick'](_0x1efa0d,attributes));}var rpc={'openchannelQueueReport':require(_0x58d0('0x18')),'mailQueueReport':require(_0x58d0('0x19')),'chatQueueReport':require(_0x58d0('0x1a')),'smsQueueReport':require(_0x58d0('0x1b')),'faxQueueReport':require(_0x58d0('0x1c')),'whatsappQueueReport':require(_0x58d0('0x1d'))};var queue=schema({'name':{'type':_0x58d0('0x1e'),'required':!![],'message':_0x58d0('0x1f')},'timeout':{'type':_0x58d0('0x20'),'message':_0x58d0('0x21')}});function startRouting(_0x1e0c2e,_0x27796a,_0x363e6c,_0x3216b7){if(_0x1e0c2e&&_0x27796a&&_0x363e6c){_0x27796a['waiting']+=0x1;var _0x3072f9={'uniqueid':_0x1e0c2e,'from':_0x363e6c[_0x58d0('0x22')]?_0x363e6c[_0x58d0('0x22')]['from']:'','joinAt':moment()[_0x58d0('0x11')](_0x58d0('0x23')),'ContactId':_0x363e6c[_0x58d0('0x24')]?_0x363e6c['contact']['id']:null,'ListId':_0x363e6c[_0x58d0('0x25')]?_0x363e6c['list']['id']:null};_0x3072f9[_['upperFirst'](_0x363e6c[_0x58d0('0x26')])+_0x58d0('0x27')]=_0x27796a['id']||null;_0x3072f9[_[_0x58d0('0x28')](_0x363e6c[_0x58d0('0x26')])+'InteractionId']=_0x363e6c[_0x58d0('0x29')]?_0x363e6c[_0x58d0('0x29')]['id']:null;_0x3072f9[_[_0x58d0('0x28')](_0x363e6c['channel'])+_0x58d0('0x2a')]=_0x363e6c[_0x58d0('0x2b')]?_0x363e6c['message']['id']:null;_0x3072f9[_[_0x58d0('0x28')](_0x363e6c[_0x58d0('0x26')])+(_0x363e6c[_0x58d0('0x26')]!==_0x58d0('0x2c')?_0x58d0('0x2d'):'WebsiteId')]=_0x363e6c['account']?_0x363e6c[_0x58d0('0xa')]['id']:null;logger[_0x58d0('0x2e')](util[_0x58d0('0x11')](_0x58d0('0x2f'),_0x1e0c2e,_0x27796a[_0x58d0('0x30')]));emitChannelQueueInteraction(_0x363e6c['channel'],_0x27796a[_0x58d0('0x30')],_0x3072f9,_0x363e6c['account'][_0x58d0('0x30')],_0x363e6c[_0x58d0('0x2b')]['id'],!![],_0x3216b7,_0x27796a['id']);if(rpc[_0x363e6c[_0x58d0('0x26')]+_0x58d0('0x31')]){return rpc[_0x363e6c['channel']+_0x58d0('0x31')][_0x58d0('0x32')](_0x3072f9)[_0x58d0('0x33')](function(_0x4f7db5){logger[_0x58d0('0x34')](_0x58d0('0x35'));});}}}function stopRouting(_0x2b35b3,_0x42174b,_0x567040,_0x329567){if(_0x2b35b3&&_0x42174b){_0x42174b[_0x58d0('0x36')]-=0x1;var _0x4fe86f={'leaveAt':moment()[_0x58d0('0x11')](_0x58d0('0x23')),'acceptAt':moment()['format'](_0x58d0('0x23')),'reason':_0x58d0('0x37')};logger[_0x58d0('0x2e')](util[_0x58d0('0x11')](_0x58d0('0x38'),_0x2b35b3,_0x42174b[_0x58d0('0x30')]));emitChannelQueueInteraction(_0x567040[_0x58d0('0x26')],_0x42174b[_0x58d0('0x30')],_0x567040[_0x58d0('0x22')],_0x567040[_0x58d0('0xa')]['name'],_0x567040[_0x58d0('0x2b')]['id'],![],_0x329567,_0x42174b['id']);if(rpc[_0x567040[_0x58d0('0x26')]+_0x58d0('0x31')]){return rpc[_0x567040[_0x58d0('0x26')]+_0x58d0('0x31')][_0x58d0('0x39')](_0x2b35b3,_0x4fe86f)[_0x58d0('0x33')](function(_0x57da7b){logger['error'](_0x58d0('0x3a'));});}}}function endRouting(_0x96908e,_0x4e3b4d,_0x3050f2,_0x3b1268){if(_0x96908e&&_0x4e3b4d){_0x4e3b4d[_0x58d0('0x36')]-=0x1;var _0x290226={'leaveAt':moment()[_0x58d0('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x58d0('0x23')),'reason':'timeout'};logger['info'](util['format'](_0x58d0('0x3b'),_0x96908e,_0x4e3b4d['name']));emitChannelQueueInteraction(_0x3050f2[_0x58d0('0x26')],_0x4e3b4d['name'],_0x3050f2[_0x58d0('0x22')],_0x3050f2['account']['name'],_0x3050f2['message']['id'],![],_0x3b1268);if(rpc[_0x3050f2[_0x58d0('0x26')]+_0x58d0('0x31')]){return rpc[_0x3050f2['channel']+_0x58d0('0x31')]['update'](_0x96908e,_0x290226)[_0x58d0('0x33')](function(_0x32008e){logger['error'](_0x58d0('0x3a'));});}}}function handleFindQueue(_0x5e7e9f){return function(_0x9cb078){return _0x9cb078[_0x58d0('0x30')][_0x58d0('0x3c')]()===_0x5e7e9f[_0x58d0('0x3c')]();};}exports[_0x58d0('0x3d')]=function(_0x492262,_0x490e03,_0x53b007,_0x432cb6){return function(_0x2f5947){try{var _0x5a12b7={'name':_0x490e03[0x0],'timeout':_0x490e03[0x1]};var _0x219eea=queue['validate'](_0x5a12b7,{'typecast':!![]});if(_0x219eea['length']){logger[_0x58d0('0x34')](_0x58d0('0x3e'),_0x492262,_[_0x58d0('0x3f')](_0x219eea,_0x58d0('0x2b'))[_0x58d0('0x40')](',\x20'));_0x2f5947['stop']();}else{var _0x5ad231=_['find'](_0x53b007[_0x432cb6[_0x58d0('0x26')]+_0x58d0('0x41')],handleFindQueue(_0x5a12b7[_0x58d0('0x30')]));if(_0x5ad231){startRouting(_0x492262,_0x5ad231,_0x432cb6,_0x53b007);var _0xb1dc98=(_0x5ad231[_0x58d0('0x42')]||0xa)*0x3e8;var _0x1eb761=(_0x5a12b7[_0x58d0('0x42')]||0x14)*0x3e8;var _0x528920,_0x313cf5;if(_0xb1dc98>_0x1eb761){_0x1eb761=_0xb1dc98;}var _0x248842=seqqueue['createQueue'](_0xb1dc98);_0x248842['id']=_0x492262;_0x248842['atimeout']=_0xb1dc98;_0x248842[_0x58d0('0x43')]=_0x1eb761;_0x248842[_0x58d0('0x26')]=_0x432cb6[_0x58d0('0x26')];_0x53b007[_0x58d0('0x44')][_0x492262]['on'](_0x58d0('0x45'),function(){logger[_0x58d0('0x2e')](_0x58d0('0x46'),_0x492262);stopRouting(_0x492262,_0x5ad231,_0x432cb6,_0x53b007);clearTimeout(_0x528920);_0x528920=undefined;_0x248842[_0x58d0('0x47')](!![]);if(_0x53b007[_0x58d0('0x44')][_0x492262]){delete _0x53b007['rules'][_0x492262];}_0x2f5947[_0x58d0('0x48')]();});_0x53b007[_0x58d0('0x44')][_0x492262]['on']('complete',function(){if(_0x53b007['rules'][_0x492262]){delete _0x53b007[_0x58d0('0x44')][_0x492262];}});_0x528920=setTimeout(function(){logger['info'](_0x58d0('0x49'),_0x492262);endRouting(_0x492262,_0x5ad231,_0x432cb6,_0x53b007);clearTimeout(_0x528920);_0x248842['close'](!![]);_0x2f5947['next']();},_0x1eb761);switch(_0x5ad231[_0x58d0('0x4a')]){case _0x58d0('0x4b'):strategy[_0x58d0('0x4b')](_0x248842,_0x5ad231,_0x53b007,_0x432cb6);break;default:strategy[_0x58d0('0x4c')](_0x248842,_0x5ad231,_0x53b007,_0x432cb6);}}else{logger[_0x58d0('0x34')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x492262,_0x5a12b7[_0x58d0('0x30')]);_0x2f5947[_0x58d0('0x48')]();}}}catch(_0x17ba25){console[_0x58d0('0x4d')](_0x17ba25);logger[_0x58d0('0x34')]('[%s][QUEUE]\x20%s',_0x492262,_0x17ba25['stack']);_0x2f5947[_0x58d0('0x48')]();}};}; \ 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 1e1fea3..db27b7f 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 _0xb38c=['isAgentAvailable','channel','busy','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','STOP','lodash','uuid','./util','notificationId','agent','realtime','routing','squeue','push','handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership'];(function(_0x244463,_0xffca77){var _0x15955b=function(_0x1593a4){while(--_0x1593a4){_0x244463['push'](_0x244463['shift']());}};_0x15955b(++_0xffca77);}(_0xb38c,0x6a));var _0xcb38=function(_0xfb0281,_0x3ff38b){_0xfb0281=_0xfb0281-0x0;var _0x408dd3=_0xb38c[_0xfb0281];return _0x408dd3;};'use strict';var _=require(_0xcb38('0x0'));var uuid=require(_0xcb38('0x1'));var util=require(_0xcb38('0x2'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x8839a6,_0x96dbf8,_0x2cbe98,_0x32b8a0){this[_0xcb38('0x3')]=uuid['v4']();this['squeue']=_0x8839a6;this[_0xcb38('0x4')]=_0x96dbf8;this[_0xcb38('0x5')]=_0x2cbe98;this[_0xcb38('0x6')]=_0x32b8a0;this[_0xcb38('0x7')][_0xcb38('0x8')](this[_0xcb38('0x9')]['bind'](this),this[_0xcb38('0xa')][_0xcb38('0xb')](this));this[_0xcb38('0x7')]['on'](_0xcb38('0xc'),this[_0xcb38('0xa')][_0xcb38('0xb')](this));this[_0xcb38('0x7')]['on'](_0xcb38('0xd'),this[_0xcb38('0xe')]['bind'](this));};Agent[_0xcb38('0xf')][_0xcb38('0x8')]=function(){this[_0xcb38('0x7')][_0xcb38('0x8')](this[_0xcb38('0x9')][_0xcb38('0xb')](this),this[_0xcb38('0xa')][_0xcb38('0xb')](this));};Agent['prototype'][_0xcb38('0xe')]=function(){this[_0xcb38('0xa')](!![]);};Agent[_0xcb38('0xf')][_0xcb38('0x9')]=function(_0x2e43e4){logger[_0xcb38('0x10')](_0xcb38('0x11'),this[_0xcb38('0x7')]['id'],this[_0xcb38('0x4')]['id']);if(_[_0xcb38('0x12')](this[_0xcb38('0x5')][_0xcb38('0x13')][this[_0xcb38('0x4')]['id']])){logger[_0xcb38('0x10')](_0xcb38('0x14'),this[_0xcb38('0x7')]['id'],this['agent']['id']);setTimeout(this[_0xcb38('0x8')][_0xcb38('0xb')](this),0x3e8);}else{if(this[_0xcb38('0x6')][_0xcb38('0x15')]||util[_0xcb38('0x16')](this[_0xcb38('0x7')]['id'],this[_0xcb38('0x5')][_0xcb38('0x13')][this[_0xcb38('0x4')]['id']],this['squeue'][_0xcb38('0x17')],![])){this[_0xcb38('0x5')][_0xcb38('0x13')][this[_0xcb38('0x4')]['id']][_0xcb38('0x18')]=!![];this[_0xcb38('0x5')][_0xcb38('0x13')][this[_0xcb38('0x4')]['id']]['busyQueue']=undefined;util['showNotification'](this[_0xcb38('0x3')],this[_0xcb38('0x7')]['id'],this[_0xcb38('0x5')]['agents'][this['agent']['id']],null,this[_0xcb38('0x6')]);util[_0xcb38('0x19')](this[_0xcb38('0x7')]['id'],this[_0xcb38('0x5')][_0xcb38('0x13')][this[_0xcb38('0x4')]['id']],'RINGING'+(this[_0xcb38('0x6')]['forcedOwnership']?_0xcb38('0x1a'):''));}else{logger[_0xcb38('0x10')](_0xcb38('0x1b'),this[_0xcb38('0x7')]['id'],this[_0xcb38('0x4')]['id']);setTimeout(this['push'][_0xcb38('0xb')](this),0x3e8);}}};Agent['prototype'][_0xcb38('0xa')]=function(_0x6e2eb6){if(_[_0xcb38('0x12')](this[_0xcb38('0x5')][_0xcb38('0x13')][this[_0xcb38('0x4')]['id']])){return logger[_0xcb38('0x10')](_0xcb38('0x14'),this['squeue']['id'],this[_0xcb38('0x4')]['id']);}else{logger[_0xcb38('0x10')](_0xcb38('0x1c'),this[_0xcb38('0x7')]['id'],this[_0xcb38('0x4')]['id']);util[_0xcb38('0x1d')](this[_0xcb38('0x3')],this['squeue']['id'],this[_0xcb38('0x5')][_0xcb38('0x13')][this[_0xcb38('0x4')]['id']],null,this[_0xcb38('0x6')]);this[_0xcb38('0x5')][_0xcb38('0x13')][this[_0xcb38('0x4')]['id']][_0xcb38('0x18')]=![];this[_0xcb38('0x5')][_0xcb38('0x13')][this[_0xcb38('0x4')]['id']][_0xcb38('0x1e')]=undefined;util[_0xcb38('0x19')](this['squeue']['id'],this[_0xcb38('0x5')]['agents'][this[_0xcb38('0x4')]['id']],_0x6e2eb6?_0xcb38('0x1f'):'TIMEOUT');}if(!_0x6e2eb6){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x3a7a72,_0x4c2462,_0x2fb5e3,_0x3fe6b5){return new Agent(_0x3a7a72,_0x4c2462,_0x2fb5e3,_0x3fe6b5);}module['exports']=agent; \ No newline at end of file +var _0xa6fc=['push','bind','handleTimeout','handleDrained','prototype','handleRun','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','agent','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busyQueue','showNotification','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','info','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','TIMEOUT','exports','lodash','uuid','./util','notificationId','squeue','realtime','routing'];(function(_0x22c854,_0x261dad){var _0x5c2377=function(_0x385bfe){while(--_0x385bfe){_0x22c854['push'](_0x22c854['shift']());}};_0x5c2377(++_0x261dad);}(_0xa6fc,0xd2));var _0xca6f=function(_0x1e6f0c,_0x5f0a56){_0x1e6f0c=_0x1e6f0c-0x0;var _0x18108f=_0xa6fc[_0x1e6f0c];return _0x18108f;};'use strict';var _=require(_0xca6f('0x0'));var uuid=require(_0xca6f('0x1'));var util=require(_0xca6f('0x2'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x1c7824,_0x604bb8,_0x455e5c,_0x456280){this[_0xca6f('0x3')]=uuid['v4']();this[_0xca6f('0x4')]=_0x1c7824;this['agent']=_0x604bb8;this[_0xca6f('0x5')]=_0x455e5c;this[_0xca6f('0x6')]=_0x456280;this[_0xca6f('0x4')][_0xca6f('0x7')](this['handleRun'][_0xca6f('0x8')](this),this['handleTimeout'][_0xca6f('0x8')](this));this['squeue']['on']('timeout',this[_0xca6f('0x9')][_0xca6f('0x8')](this));this['squeue']['on']('drained',this[_0xca6f('0xa')][_0xca6f('0x8')](this));};Agent[_0xca6f('0xb')]['push']=function(){this['squeue'][_0xca6f('0x7')](this[_0xca6f('0xc')][_0xca6f('0x8')](this),this[_0xca6f('0x9')][_0xca6f('0x8')](this));};Agent[_0xca6f('0xb')]['handleDrained']=function(){this[_0xca6f('0x9')](!![]);};Agent[_0xca6f('0xb')][_0xca6f('0xc')]=function(_0x40a4e0){logger['info'](_0xca6f('0xd'),this[_0xca6f('0x4')]['id'],this['agent']['id']);if(_[_0xca6f('0xe')](this[_0xca6f('0x5')][_0xca6f('0xf')][this[_0xca6f('0x10')]['id']])){logger['info'](_0xca6f('0x11'),this[_0xca6f('0x4')]['id'],this[_0xca6f('0x10')]['id']);setTimeout(this['push'][_0xca6f('0x8')](this),0x3e8);}else{if(this[_0xca6f('0x6')][_0xca6f('0x12')]||util[_0xca6f('0x13')](this[_0xca6f('0x4')]['id'],this[_0xca6f('0x5')][_0xca6f('0xf')][this[_0xca6f('0x10')]['id']],this[_0xca6f('0x4')][_0xca6f('0x14')],![])){this[_0xca6f('0x5')][_0xca6f('0xf')][this[_0xca6f('0x10')]['id']]['busy']=!![];this[_0xca6f('0x5')][_0xca6f('0xf')][this[_0xca6f('0x10')]['id']][_0xca6f('0x15')]=undefined;util[_0xca6f('0x16')](this[_0xca6f('0x3')],this[_0xca6f('0x4')]['id'],this[_0xca6f('0x5')][_0xca6f('0xf')][this['agent']['id']],null,this[_0xca6f('0x6')]);util[_0xca6f('0x17')](this[_0xca6f('0x4')]['id'],this['realtime']['agents'][this[_0xca6f('0x10')]['id']],'RINGING'+(this['routing'][_0xca6f('0x12')]?_0xca6f('0x18'):''));}else{logger['info'](_0xca6f('0x19'),this[_0xca6f('0x4')]['id'],this[_0xca6f('0x10')]['id']);setTimeout(this['push'][_0xca6f('0x8')](this),0x3e8);}}};Agent[_0xca6f('0xb')][_0xca6f('0x9')]=function(_0x387003){if(_[_0xca6f('0xe')](this[_0xca6f('0x5')][_0xca6f('0xf')][this[_0xca6f('0x10')]['id']])){return logger['info'](_0xca6f('0x11'),this[_0xca6f('0x4')]['id'],this[_0xca6f('0x10')]['id']);}else{logger[_0xca6f('0x1a')](_0xca6f('0x1b'),this['squeue']['id'],this['agent']['id']);util[_0xca6f('0x1c')](this[_0xca6f('0x3')],this['squeue']['id'],this[_0xca6f('0x5')][_0xca6f('0xf')][this[_0xca6f('0x10')]['id']],null,this[_0xca6f('0x6')]);this['realtime'][_0xca6f('0xf')][this[_0xca6f('0x10')]['id']]['busy']=![];this[_0xca6f('0x5')][_0xca6f('0xf')][this['agent']['id']][_0xca6f('0x15')]=undefined;util[_0xca6f('0x17')](this[_0xca6f('0x4')]['id'],this['realtime']['agents'][this[_0xca6f('0x10')]['id']],_0x387003?'STOP':_0xca6f('0x1d'));}if(!_0x387003){setTimeout(this['push'][_0xca6f('0x8')](this),0x3e8);}};function agent(_0x1b3d15,_0x24b8d7,_0x3abf4e,_0x536a37){return new Agent(_0x1b3d15,_0x24b8d7,_0x3abf4e,_0x536a37);}module[_0xca6f('0x1e')]=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 0df5c4f..538c22a 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 _0xbf07=['realtime','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','busy','busyQueue','name','showNotification','notificationId','routing','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','writeLog','STOP','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','squeue','handleRun','handleTimeout','bind','timeout','drained','prototype','push','handleDrained','isNil','queue','Agents','length'];(function(_0x5e42a7,_0x3eba35){var _0x36d21b=function(_0x567f0a){while(--_0x567f0a){_0x5e42a7['push'](_0x5e42a7['shift']());}};_0x36d21b(++_0x3eba35);}(_0xbf07,0x77));var _0x7bf0=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xbf07[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x7bf0('0x0'));var uuid=require(_0x7bf0('0x1'));var util=require(_0x7bf0('0x2'));var logger=require(_0x7bf0('0x3'))('routing');var Beepall=function(_0x1e2f22,_0x34b2f2,_0x584995,_0x4dbbc4){this['notificationId']=uuid['v4']();this[_0x7bf0('0x4')]=_0x1e2f22;this['queue']=_0x34b2f2;this['realtime']=_0x584995;this['routing']=_0x4dbbc4;this[_0x7bf0('0x4')]['push'](this[_0x7bf0('0x5')]['bind'](this),this[_0x7bf0('0x6')][_0x7bf0('0x7')](this));this[_0x7bf0('0x4')]['on'](_0x7bf0('0x8'),this[_0x7bf0('0x6')][_0x7bf0('0x7')](this));this['squeue']['on'](_0x7bf0('0x9'),this['handleDrained'][_0x7bf0('0x7')](this));};Beepall[_0x7bf0('0xa')][_0x7bf0('0xb')]=function(){this[_0x7bf0('0x4')][_0x7bf0('0xb')](this[_0x7bf0('0x5')][_0x7bf0('0x7')](this),this[_0x7bf0('0x6')][_0x7bf0('0x7')](this));};Beepall[_0x7bf0('0xa')][_0x7bf0('0xc')]=function(_0x4300ce){this[_0x7bf0('0x6')](!![]);};Beepall[_0x7bf0('0xa')][_0x7bf0('0x5')]=function(_0x16a7a4){var _0x4424a5=!![];if(!_[_0x7bf0('0xd')](this[_0x7bf0('0xe')])&&!_[_0x7bf0('0xd')](this['queue'][_0x7bf0('0xf')])&&this[_0x7bf0('0xe')][_0x7bf0('0xf')][_0x7bf0('0x10')]>0x0){for(var _0x13c9bb=0x0,_0x5e7ed2;_0x13c9bb0x0){for(var _0x51f365=0x0,_0x119a91;_0x51f3650x0&&_0x41c4c8[_0x3a081e+'CurrentCapacity']>=_0x41c4c8[_0x3a081e+_0xcc6a('0x28')]){writeLog(_0x51be9a,_0x41c4c8,_0x3a081e[_0xcc6a('0x29')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xcc6a('0x2a')]=function(_0x8b1b2b,_0x3233d1,_0x473f88,_0x5d7399,_0x194aab){return sendNotification(!![],_0x8b1b2b,_0x3233d1,_0x473f88,_0x5d7399,_0x194aab);};exports[_0xcc6a('0x2b')]=function(_0x2c6d88,_0x4f176b,_0x2590a2,_0x5308d4,_0x4f67d3){return sendNotification(![],_0x2c6d88,_0x4f176b,_0x2590a2,_0x5308d4,_0x4f67d3);};exports[_0xcc6a('0x2c')]=writeLog; \ No newline at end of file +var _0xaa3f=['redis','localhost','emit','user:%s','name','user:save','account','notificationSound','notificationShake','body','queue','getMustacheRender','notificationTemplate','message','format','notification:%s','save','remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','lodash','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing'];(function(_0x515e7f,_0x6a8657){var _0x397863=function(_0xc9cbe1){while(--_0xc9cbe1){_0x515e7f['push'](_0x515e7f['shift']());}};_0x397863(++_0x6a8657);}(_0xaa3f,0xbb));var _0xfaa3=function(_0xdfd790,_0x4f39ff){_0xdfd790=_0xdfd790-0x0;var _0x3d5eae=_0xaa3f[_0xdfd790];return _0x3d5eae;};'use strict';var _=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var utils=require(_0xfaa3('0x2'));var Mustache=require(_0xfaa3('0x3'));var Redis=require(_0xfaa3('0x4'));var config=require(_0xfaa3('0x5'));var logger=require(_0xfaa3('0x6'))(_0xfaa3('0x7'));config[_0xfaa3('0x8')]=_['defaults'](config['redis'],{'host':_0xfaa3('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfaa3('0x8')]));function emit(_0xeecce5,_0x352958,_0xbf270c){io['to'](_0xeecce5)[_0xfaa3('0xa')](_0x352958,_0xbf270c);}function sendNotification(_0x2e422d,_0xf420ec,_0x54fb06,_0x37bcd5,_0x28de66,_0x49380c){io['to'](util['format'](_0xfaa3('0xb'),_0x37bcd5[_0xfaa3('0xc')]))[_0xfaa3('0xa')](_0xfaa3('0xd'),_0x37bcd5);var _0x23e4b6=_0x49380c||{};var _0x32866b=_0x54fb06['split']('.');var _0x10ea75={'uniqueid':_0xf420ec,'channel':_0x32866b[0x0],'id':_0x32866b[0x1],'title':_0x32866b[0x0]+'\x20interaction','interactionId':_0x32866b[0x2],'queue':_0x28de66?_0x28de66[_0xfaa3('0xc')]:null,'sound':_0x23e4b6[_0xfaa3('0xe')][_0xfaa3('0xf')],'shake':_0x23e4b6['account'][_0xfaa3('0x10')]};try{if(!_0x23e4b6['body']){_0x23e4b6[_0xfaa3('0x11')]={};}if(_0x28de66){_0x23e4b6[_0xfaa3('0x11')][_0xfaa3('0x12')]=_0x28de66;}else if(_0x23e4b6[_0xfaa3('0x11')][_0xfaa3('0x12')]){delete _0x23e4b6[_0xfaa3('0x11')]['queue'];}_0x10ea75['msg']=utils[_0xfaa3('0x13')](_0x23e4b6[_0xfaa3('0xe')][_0xfaa3('0x14')],_0x23e4b6);}catch(_0xdc069d){_0x10ea75['msg']='I\x20can\x27t\x20render\x20your\x20template';logger['error'](util['format']('[%s][QUEUE]\x20%s',_0xf420ec,_0xdc069d[_0xfaa3('0x15')]));}io['to'](util['format'](_0xfaa3('0xb'),_0x37bcd5[_0xfaa3('0xc')]))[_0xfaa3('0xa')](util[_0xfaa3('0x16')](_0xfaa3('0x17'),_0x2e422d?_0xfaa3('0x18'):_0xfaa3('0x19')),_0x10ea75);}function writeLog(_0x1ab9cc,_0x220c9e,_0x39e91e){return logger['info'](util[_0xfaa3('0x16')](_0xfaa3('0x1a'),_0x1ab9cc,_0x220c9e[_0xfaa3('0xc')],_0x39e91e));}exports[_0xfaa3('0x1b')]=function(_0x50dc4a,_0x1f7324,_0x2d4087,_0x2f077c){if(_0x1f7324[_0xfaa3('0x1c')]){writeLog(_0x50dc4a,_0x1f7324,_0xfaa3('0x1d'));return![];}if(!_0x1f7324[_0xfaa3('0x1e')]){writeLog(_0x50dc4a,_0x1f7324,_0xfaa3('0x1f'));return![];}if(_0x1f7324[_0x2d4087+_0xfaa3('0x20')]){writeLog(_0x50dc4a,_0x1f7324,'PAUSE');return![];}if(_0x2f077c&&_0x1f7324[_0xfaa3('0x21')](_0x2d4087+_0xfaa3('0x22'))&&_0x1f7324[_0xfaa3('0x21')](_0x2d4087+_0xfaa3('0x23'))){if(_0x1f7324[_0x2d4087+_0xfaa3('0x22')]>0x0&&_0x1f7324[_0x2d4087+_0xfaa3('0x23')]>=_0x1f7324[_0x2d4087+_0xfaa3('0x22')]){writeLog(_0x50dc4a,_0x1f7324,_0x2d4087[_0xfaa3('0x24')]()+_0xfaa3('0x25'));return![];}}return!![];};exports[_0xfaa3('0x26')]=function(_0x36714d,_0x7df1f3,_0x18bd3e,_0x1bc202,_0x2d7c43){return sendNotification(!![],_0x36714d,_0x7df1f3,_0x18bd3e,_0x1bc202,_0x2d7c43);};exports['hideNotification']=function(_0x230430,_0x104343,_0xc2e71,_0x54bc09,_0x289f13){return sendNotification(![],_0x230430,_0x104343,_0xc2e71,_0x54bc09,_0x289f13);};exports['writeLog']=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 51859ff..185ac69 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 _0xc1d1=['info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','consequence','length','error','map','join'];(function(_0x5d3fe7,_0x311675){var _0x2352b6=function(_0x58efcd){while(--_0x58efcd){_0x5d3fe7['push'](_0x5d3fe7['shift']());}};_0x2352b6(++_0x311675);}(_0xc1d1,0x1a5));var _0x1c1d=function(_0x311694,_0x2723a0){_0x311694=_0x311694-0x0;var _0x9595d2=_0xc1d1[_0x311694];return _0x9595d2;};'use strict';var schema=require(_0x1c1d('0x0'));var sh=require(_0x1c1d('0x1'));var _=require(_0x1c1d('0x2'));var utils=require(_0x1c1d('0x3'));var logger=require(_0x1c1d('0x4'))(_0x1c1d('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x1c1d('0x6')]=function(_0xb104bc,_0x26f7e5){return function(_0x138352){try{var _0xabb374={'command':_0x26f7e5[0x0]};var _0x3efa14=system[_0x1c1d('0x0')](_0xabb374,{'typecast':!![]});if(_0x3efa14[_0x1c1d('0x7')]){logger[_0x1c1d('0x8')]('[%s][SYSTEM]\x20%s',_0xb104bc,_[_0x1c1d('0x9')](_0x3efa14,'message')[_0x1c1d('0xa')](',\x20'));logger[_0x1c1d('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0xb104bc);_0x138352[_0x1c1d('0xc')]();}else{var _0x19e856=this;var _0xdbf031=utils[_0x1c1d('0xd')](_0x26f7e5[0x0],this);logger[_0x1c1d('0xb')](_0x1c1d('0xe'),_0xb104bc,_0xdbf031);sh[_0x1c1d('0xf')](_[_0x1c1d('0x10')](_0xdbf031),function(_0x53680d,_0x1bc8d5){logger[_0x1c1d('0xb')](_0x1c1d('0x11'),_0xb104bc,_0x53680d);if(_0x53680d==0x0){var _0x4adfc9=_0x1bc8d5[_0x1c1d('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x1c1d('0x13')](_0x26f7e5[0x1])||_['isEmpty'](_0x26f7e5[0x1])){logger[_0x1c1d('0xb')](_0x1c1d('0x14'),_0xb104bc);_0x19e856['body'][_0x26f7e5[0x1]]=_0x4adfc9;}else{logger[_0x1c1d('0xb')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0xb104bc,_0x26f7e5[0x1],_0x4adfc9);_0x19e856[_0x1c1d('0x15')][_0x26f7e5[0x1]]=_0x4adfc9;}}_0x138352['next']();});}}catch(_0x8ed874){logger['error']('[%s][SYSTEM]\x20%s',_0xb104bc,_[_0x1c1d('0x16')](_0x8ed874)?JSON[_0x1c1d('0x17')](_0x8ed874):_0x8ed874);logger[_0x1c1d('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0xb104bc);_0x138352[_0x1c1d('0xc')]();}};}; \ No newline at end of file +var _0xfc26=['isObject','stringify','validate','lodash','../../../../config/logger','routing','string','consequence','length','error','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s'];(function(_0x4c5f21,_0x4f1bd4){var _0x2bfadc=function(_0x369fd1){while(--_0x369fd1){_0x4c5f21['push'](_0x4c5f21['shift']());}};_0x2bfadc(++_0x4f1bd4);}(_0xfc26,0x115));var _0x6fc2=function(_0x34ad72,_0x1e43f6){_0x34ad72=_0x34ad72-0x0;var _0x5c9aa8=_0xfc26[_0x34ad72];return _0x5c9aa8;};'use strict';var schema=require(_0x6fc2('0x0'));var sh=require('shelljs');var _=require(_0x6fc2('0x1'));var utils=require('./utils');var logger=require(_0x6fc2('0x2'))(_0x6fc2('0x3'));var system=schema({'command':{'type':_0x6fc2('0x4'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x6fc2('0x5')]=function(_0x551d98,_0x5c231c){return function(_0x47871c){try{var _0xddf5ac={'command':_0x5c231c[0x0]};var _0x1042a8=system['validate'](_0xddf5ac,{'typecast':!![]});if(_0x1042a8[_0x6fc2('0x6')]){logger[_0x6fc2('0x7')]('[%s][SYSTEM]\x20%s',_0x551d98,_[_0x6fc2('0x8')](_0x1042a8,_0x6fc2('0x9'))[_0x6fc2('0xa')](',\x20'));logger[_0x6fc2('0xb')](_0x6fc2('0xc'),_0x551d98);_0x47871c[_0x6fc2('0xd')]();}else{var _0x1e4121=this;var _0x31eb53=utils[_0x6fc2('0xe')](_0x5c231c[0x0],this);logger[_0x6fc2('0xb')](_0x6fc2('0xf'),_0x551d98,_0x31eb53);sh[_0x6fc2('0x10')](_['trim'](_0x31eb53),function(_0x4a9504,_0x56ddff){logger[_0x6fc2('0xb')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x551d98,_0x4a9504);if(_0x4a9504==0x0){var _0x135565=_0x56ddff[_0x6fc2('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x6fc2('0x12')](_0x5c231c[0x1])||_[_0x6fc2('0x13')](_0x5c231c[0x1])){logger[_0x6fc2('0xb')](_0x6fc2('0x14'),_0x551d98);_0x1e4121[_0x6fc2('0x15')][_0x5c231c[0x1]]=_0x135565;}else{logger['info'](_0x6fc2('0x16'),_0x551d98,_0x5c231c[0x1],_0x135565);_0x1e4121['body'][_0x5c231c[0x1]]=_0x135565;}}_0x47871c[_0x6fc2('0xd')]();});}}catch(_0x48dde2){logger[_0x6fc2('0x7')]('[%s][SYSTEM]\x20%s',_0x551d98,_[_0x6fc2('0x17')](_0x48dde2)?JSON[_0x6fc2('0x18')](_0x48dde2):_0x48dde2);logger[_0x6fc2('0xb')](_0x6fc2('0xc'),_0x551d98);_0x47871c['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index a3e611d..4f069ac 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 _0x1999=['../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','consequence','validate','length','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','channel','interaction','error','isObject','stringify','next','lodash','../../rpc/chatInteraction'];(function(_0x56f335,_0x26ea68){var _0x4c3fdb=function(_0x55f47f){while(--_0x55f47f){_0x56f335['push'](_0x56f335['shift']());}};_0x4c3fdb(++_0x26ea68);}(_0x1999,0x142));var _0x9199=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x1999[_0x36eaaa];return _0x461349;};'use strict';var schema=require('validate');var _=require(_0x9199('0x0'));var rpc={'chatInteraction':require(_0x9199('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x9199('0x2')),'mailInteraction':require(_0x9199('0x3')),'faxInteraction':require(_0x9199('0x4')),'whatsappInteraction':require(_0x9199('0x5'))};var logger=require(_0x9199('0x6'))(_0x9199('0x7'));var tag=schema({'tag':{'type':_0x9199('0x8'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x9199('0x9')]=function(_0xc22fc,_0x23c1f1,_0x1825e4,_0xeb40a){return function(_0x3c0c9b){try{var _0x17a6a6={'tag':_0x23c1f1[0x0]};var _0x58c9e1=tag[_0x9199('0xa')](_0x17a6a6,{'typecast':!![]});if(_0x58c9e1[_0x9199('0xb')]){logger['error']('[%s][TAG]\x20%s',_0xc22fc,_[_0x9199('0xc')](_0x58c9e1,_0x9199('0xd'))[_0x9199('0xe')](',\x20'));logger[_0x9199('0xf')](_0x9199('0x10'),_0xc22fc);_0x3c0c9b['next']();}else{var _0x1fb929={'ids':[_0x23c1f1[0x0]]};if(rpc[_0xeb40a['channel']+'Interaction']){rpc[_0xeb40a['channel']+_0x9199('0x11')][_0x9199('0x12')](_0xeb40a['interaction']['id'],_0x1fb929)[_0x9199('0x13')](function(_0x3a0b35){logger['info'](_0x9199('0x14'),_0xc22fc,_0x23c1f1[0x1],_0xeb40a[_0x9199('0x15')],_0xeb40a[_0x9199('0x16')]['id']);})['catch'](function(_0x5e77d5){logger[_0x9199('0x17')]('[%s][TAG]\x20%s',_0xc22fc,JSON['stringify'](_0x5e77d5));logger[_0x9199('0xf')](_0x9199('0x10'),_0xc22fc);})['finally'](function(){_0x3c0c9b['next']();});}}}catch(_0x5739ea){logger['error']('[%s][TAG]\x20%s',_0xc22fc,_[_0x9199('0x18')](_0x5739ea)?JSON[_0x9199('0x19')](_0x5739ea):_0x5739ea);logger[_0x9199('0xf')](_0x9199('0x10'),_0xc22fc);_0x3c0c9b[_0x9199('0x1a')]();}};}; \ No newline at end of file +var _0xed14=['length','[%s][TAG]\x20%s','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','next','isObject','lodash','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','consequence'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xed14,0x152));var _0x4ed1=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xed14[_0x25e7cb];return _0x375d92;};'use strict';var schema=require('validate');var _=require(_0x4ed1('0x0'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x4ed1('0x1')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x4ed1('0x2')),'whatsappInteraction':require(_0x4ed1('0x3'))};var logger=require(_0x4ed1('0x4'))(_0x4ed1('0x5'));var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x4ed1('0x6')]=function(_0x3ffe2a,_0x56afcc,_0x18d324,_0x572aab){return function(_0x504011){try{var _0x3c6789={'tag':_0x56afcc[0x0]};var _0x2fd2fa=tag['validate'](_0x3c6789,{'typecast':!![]});if(_0x2fd2fa[_0x4ed1('0x7')]){logger['error'](_0x4ed1('0x8'),_0x3ffe2a,_[_0x4ed1('0x9')](_0x2fd2fa,'message')[_0x4ed1('0xa')](',\x20'));logger[_0x4ed1('0xb')](_0x4ed1('0xc'),_0x3ffe2a);_0x504011['next']();}else{var _0xd17031={'ids':[_0x56afcc[0x0]]};if(rpc[_0x572aab[_0x4ed1('0xd')]+_0x4ed1('0xe')]){rpc[_0x572aab[_0x4ed1('0xd')]+_0x4ed1('0xe')][_0x4ed1('0xf')](_0x572aab['interaction']['id'],_0xd17031)[_0x4ed1('0x10')](function(_0x413c20){logger[_0x4ed1('0xb')](_0x4ed1('0x11'),_0x3ffe2a,_0x56afcc[0x1],_0x572aab[_0x4ed1('0xd')],_0x572aab['interaction']['id']);})[_0x4ed1('0x12')](function(_0xb85caa){logger['error'](_0x4ed1('0x8'),_0x3ffe2a,JSON[_0x4ed1('0x13')](_0xb85caa));logger[_0x4ed1('0xb')](_0x4ed1('0xc'),_0x3ffe2a);})[_0x4ed1('0x14')](function(){_0x504011[_0x4ed1('0x15')]();});}}}catch(_0x3ec562){logger['error'](_0x4ed1('0x8'),_0x3ffe2a,_[_0x4ed1('0x16')](_0x3ec562)?JSON[_0x4ed1('0x13')](_0x3ec562):_0x3ec562);logger[_0x4ed1('0xb')](_0x4ed1('0xc'),_0x3ffe2a);_0x504011[_0x4ed1('0x15')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 694bde7..a9fdecc 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x47c9=['title','jsonrpc','2.0','utf8','POST','then','parse','result','logged','channelId=','&serviceId=','&sessionId=','&data=','stringify','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20%s','isObject','info','next','request-promise','routing','consequence','\x20-\x20','replace','includes','push','urlOnAnswer','?params=','urlOnRing'];(function(_0x11ca63,_0xea9f9c){var _0x41f1f6=function(_0xb80b69){while(--_0xb80b69){_0x11ca63['push'](_0x11ca63['shift']());}};_0x41f1f6(++_0xea9f9c);}(_0x47c9,0x1e6));var _0x947c=function(_0x5e3afc,_0x1427e7){_0x5e3afc=_0x5e3afc-0x0;var _0x1bbaf0=_0x47c9[_0x5e3afc];return _0x1bbaf0;};'use strict';var rp=require(_0x947c('0x0'));var logger=require('../../../../config/logger')(_0x947c('0x1'));var _=require('lodash');var arr=[];exports[_0x947c('0x2')]=function(_0x41e0d5,_0x2a6a5b){return function(_0x23586f){var _0x214584=_0x2a6a5b[0xa];var _0x36a079=_0x2a6a5b[0xb];var _0x5c0119=_0x2a6a5b[0xc];var _0x1616bc=_0x2a6a5b[0xd];var _0x3903ef=_0x2a6a5b[0xe];var _0x183d20=_0x2a6a5b[0xf]['replace'](/\n/g,_0x947c('0x3'));var _0x46dd82=_0x2a6a5b[0x10][_0x947c('0x4')](/\n/g,'\x20');if(!arr[_0x947c('0x5')](_0x36a079)){arr[_0x947c('0x6')](_0x36a079);var _0x300c7a=_0x2a6a5b[0x3];var _0x1642d2=_0x2a6a5b[0x4];var _0x576121=_0x2a6a5b[0x1];var _0x59d22f=_0x2a6a5b[0x0];var _0x6b30d2={};_0x6b30d2[_0x947c('0x7')]=_0x2a6a5b[0x8]+_0x947c('0x8')+_0x5c0119+'|'+_0x214584+'|'+_0x1616bc+'|'+_0x36a079+'|'+_0x3903ef;_0x6b30d2[_0x947c('0x9')]=_0x2a6a5b[0x7]+_0x947c('0x8')+_0x5c0119+'|'+_0x214584+'|'+_0x1616bc+'|'+_0x36a079+'|'+_0x3903ef+'|'+_0x183d20+'|'+_0x46dd82;_0x6b30d2[_0x947c('0xa')]=_0x2a6a5b[0x9];var _0x2b0836={};_0x2b0836[_0x947c('0xb')]=_0x947c('0xc');_0x2b0836['method']='login';var _0x32249e=[];_0x32249e[_0x947c('0x6')](_0x2a6a5b[0x2]);_0x32249e[_0x947c('0x6')](_0x2a6a5b[0x5]);_0x32249e[_0x947c('0x6')](_0x2a6a5b[0x6]);_0x2b0836['params']=_0x32249e;_0x2b0836['id']=0x1;var _0x32f183=JSON['stringify'](_0x2b0836);var _0xd916a5={'encoding':_0x947c('0xd'),'method':_0x947c('0xe'),'timeout':0x2710,'url':_0x300c7a,'headers':{'Content-Type':'application/json-rpc'},'body':_0x32f183};return rp(_0xd916a5)[_0x947c('0xf')](function(_0x38a33f){const _0xa5fcd7=JSON[_0x947c('0x10')](_0x38a33f);if(!_0xa5fcd7[_0x947c('0x11')][_0x947c('0x12')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x65bd01=_0x36a079;var _0x2d3480=_0x947c('0x13')+_0x576121+_0x947c('0x14')+_0x59d22f+_0x947c('0x15')+_0x65bd01+_0x947c('0x16')+JSON[_0x947c('0x17')](_0x6b30d2);var _0x1aad7d=_0x1642d2+'?'+_0x2d3480;return rp(_0x1aad7d);})['then'](function(_0x44fffa){logger['info'](_0x947c('0x18'),_0x41e0d5,_0x44fffa);_0x23586f[_0x947c('0x19')]();})[_0x947c('0x1a')](function(_0x1a2e7b){logger['error'](_0x947c('0x1b'),_0x41e0d5,_[_0x947c('0x1c')](_0x1a2e7b)?JSON[_0x947c('0x17')](_0x1a2e7b):_0x1a2e7b);_0x23586f['stop']();});}else{logger[_0x947c('0x1d')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x41e0d5);_0x23586f[_0x947c('0x1e')]();}};}; \ No newline at end of file +var _0x5487=['[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','2.0','method','login','params','application/json-rpc','then','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s'];(function(_0x5a323d,_0x952135){var _0x56a026=function(_0x59d595){while(--_0x59d595){_0x5a323d['push'](_0x5a323d['shift']());}};_0x56a026(++_0x952135);}(_0x5487,0x175));var _0x7548=function(_0x302fcf,_0x4e4901){_0x302fcf=_0x302fcf-0x0;var _0x2de7b7=_0x5487[_0x302fcf];return _0x2de7b7;};'use strict';var rp=require(_0x7548('0x0'));var logger=require('../../../../config/logger')(_0x7548('0x1'));var _=require(_0x7548('0x2'));var arr=[];exports[_0x7548('0x3')]=function(_0x38255a,_0x3ca042){return function(_0x330f7d){var _0x399b52=_0x3ca042[0xa];var _0x340059=_0x3ca042[0xb];var _0x1b24a7=_0x3ca042[0xc];var _0xc5368c=_0x3ca042[0xd];var _0x2198e5=_0x3ca042[0xe];var _0x5e3e92=_0x3ca042[0xf][_0x7548('0x4')](/\n/g,_0x7548('0x5'));var _0x4bda36=_0x3ca042[0x10][_0x7548('0x4')](/\n/g,'\x20');if(!arr[_0x7548('0x6')](_0x340059)){arr[_0x7548('0x7')](_0x340059);var _0x15c1f2=_0x3ca042[0x3];var _0x5582bf=_0x3ca042[0x4];var _0x10fc9b=_0x3ca042[0x1];var _0x4198de=_0x3ca042[0x0];var _0x3cb461={};_0x3cb461[_0x7548('0x8')]=_0x3ca042[0x8]+_0x7548('0x9')+_0x1b24a7+'|'+_0x399b52+'|'+_0xc5368c+'|'+_0x340059+'|'+_0x2198e5;_0x3cb461[_0x7548('0xa')]=_0x3ca042[0x7]+'?params='+_0x1b24a7+'|'+_0x399b52+'|'+_0xc5368c+'|'+_0x340059+'|'+_0x2198e5+'|'+_0x5e3e92+'|'+_0x4bda36;_0x3cb461[_0x7548('0xb')]=_0x3ca042[0x9];var _0x43e750={};_0x43e750['jsonrpc']=_0x7548('0xc');_0x43e750[_0x7548('0xd')]=_0x7548('0xe');var _0x2c8b2e=[];_0x2c8b2e[_0x7548('0x7')](_0x3ca042[0x2]);_0x2c8b2e[_0x7548('0x7')](_0x3ca042[0x5]);_0x2c8b2e['push'](_0x3ca042[0x6]);_0x43e750[_0x7548('0xf')]=_0x2c8b2e;_0x43e750['id']=0x1;var _0x4aaa04=JSON['stringify'](_0x43e750);var _0x204f45={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x15c1f2,'headers':{'Content-Type':_0x7548('0x10')},'body':_0x4aaa04};return rp(_0x204f45)[_0x7548('0x11')](function(_0x327c86){const _0x20e07e=JSON['parse'](_0x327c86);if(!_0x20e07e[_0x7548('0x12')][_0x7548('0x13')]){throw new Error(_0x7548('0x14'));}var _0x3f0350=_0x340059;var _0x446625=_0x7548('0x15')+_0x10fc9b+_0x7548('0x16')+_0x4198de+'&sessionId='+_0x3f0350+'&data='+JSON[_0x7548('0x17')](_0x3cb461);var _0x2461d1=_0x5582bf+'?'+_0x446625;return rp(_0x2461d1);})[_0x7548('0x11')](function(_0x45ac93){logger[_0x7548('0x18')](_0x7548('0x19'),_0x38255a,_0x45ac93);_0x330f7d[_0x7548('0x1a')]();})[_0x7548('0x1b')](function(_0x2395cd){logger[_0x7548('0x1c')](_0x7548('0x1d'),_0x38255a,_['isObject'](_0x2395cd)?JSON[_0x7548('0x17')](_0x2395cd):_0x2395cd);_0x330f7d[_0x7548('0x1a')]();});}else{logger['info'](_0x7548('0x1e'),_0x38255a);_0x330f7d['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 1ff0d1d..d133704 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(_0x4b7af0,_0x145edb){var _0x4eb959=function(_0x3324dd){while(--_0x3324dd){_0x4b7af0['push'](_0x4b7af0['shift']());}};_0x4eb959(++_0x145edb);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x110959,_0x370201){var _0x124f79=function(_0x2de067){while(--_0x2de067){_0x110959['push'](_0x110959['shift']());}};_0x124f79(++_0x370201);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index afb7a4a..ccd7a5f 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 _0x2ce1=['matchPath','complete','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','busy','agents','busyQueue','emit','QueueReport','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','paused','waiting','mailQueues','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','values','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','uuid','./applications/utils','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','%s.%s.%s','IntervalId','Intervals','map','interval','isNil','rules','message','interaction','isArray','applications','length','app','.js','toLowerCase','autoreply','appdata','channel','push','slice','join','dialogflow','split','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify'];(function(_0x4f5ef9,_0x2eaea0){var _0x4e43c1=function(_0x5845ca){while(--_0x5845ca){_0x4f5ef9['push'](_0x4f5ef9['shift']());}};_0x4e43c1(++_0x2eaea0);}(_0x2ce1,0x8b));var _0x12ce=function(_0x2a5e0e,_0x4b0c2e){_0x2a5e0e=_0x2a5e0e-0x0;var _0xe92127=_0x2ce1[_0x2a5e0e];return _0xe92127;};'use strict';var _=require('lodash');var util=require('util');var path=require('path');var fs=require('fs');var jayson=require(_0x12ce('0x0'));var BPromise=require(_0x12ce('0x1'));var uuid=require(_0x12ce('0x2'));var utils=require(_0x12ce('0x3'));var config=require('../../../config/environment');var logger=require(_0x12ce('0x4'))(_0x12ce('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x12ce('0x6')),'chatQueueReport':require(_0x12ce('0x7')),'smsQueueReport':require(_0x12ce('0x8')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x12ce('0x9'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x21ef24,_0x276bce,_0x3dc12e){return util['format'](_0x12ce('0xa'),_0x21ef24,_0x276bce||0x0,_0x3dc12e||0x0);}function getIntervals(_0x23b72f,_0x3e1ee9){var _0x1bf7f1=[];if(!_['isNil'](_0x3e1ee9[_0x12ce('0xb')])&&!_['isNil'](_0x23b72f[_0x3e1ee9[_0x12ce('0xb')]])&&!_['isNil'](_0x23b72f[_0x3e1ee9['IntervalId']][_0x12ce('0xc')])){_0x1bf7f1=_[_0x12ce('0xd')](_0x23b72f[_0x3e1ee9[_0x12ce('0xb')]][_0x12ce('0xc')],_0x12ce('0xe'));}else if(!_[_0x12ce('0xf')](_0x3e1ee9['interval'])){_0x1bf7f1=[_0x3e1ee9[_0x12ce('0xe')]];}return _0x1bf7f1;}exports['listen']=function(_0x12bcf2){_0x12bcf2[_0x12ce('0x10')]={};return new BPromise(function(_0x302e3e,_0x4e3d27){var _0x2171d2={'Start':function(_0x288cff){var _0x2ac396=this;return new Promise(function(_0x39e4ec,_0x134831){if(_0x288cff){try{var _0x188408=[];var _0x56a72a=getId(_0x288cff['channel'],_0x288cff[_0x12ce('0x11')]?_0x288cff['message']['id']:0x0,_0x288cff[_0x12ce('0x12')]?_0x288cff[_0x12ce('0x12')]['id']:0x0);if(_0x288cff['applications']&&_[_0x12ce('0x13')](_0x288cff['applications'])&&_0x288cff[_0x12ce('0x14')]['length']){for(var _0xe24a11=0x0;_0xe24a11<_0x288cff['applications'][_0x12ce('0x15')];_0xe24a11+=0x1){var _0x4f5eab=_0x288cff[_0x12ce('0x14')][_0xe24a11];if(fs['existsSync'](path['join'](__dirname,_0x12ce('0x14'),_0x4f5eab[_0x12ce('0x16')]+_0x12ce('0x17')))){var _0x31656e=[];switch(_0x4f5eab['app'][_0x12ce('0x18')]()){case _0x12ce('0x19'):var _0x57e920=_0x4f5eab[_0x12ce('0x1a')]['split'](',');if(_0x288cff[_0x12ce('0x1b')]==='mail'){_0x31656e[_0x12ce('0x1c')](_0x57e920[0x0]);_0x31656e[_0x12ce('0x1c')](_0x57e920[0x1]);_0x31656e[_0x12ce('0x1c')](_0x57e920[_0x12ce('0x1d')](0x2,_0x57e920[_0x12ce('0x15')])[_0x12ce('0x1e')](','));}else{_0x31656e[_0x12ce('0x1c')](_0x57e920[0x0]);_0x31656e[_0x12ce('0x1c')](_0x57e920['slice'](0x1,_0x57e920['length'])[_0x12ce('0x1e')](','));}break;case _0x12ce('0x1f'):var _0x10232e=_0x4f5eab[_0x12ce('0x1a')]['split'](',');_0x31656e[_0x12ce('0x1c')](_0x10232e[0x0]);_0x31656e[_0x12ce('0x1c')](_0x10232e[0x1]);_0x31656e[_0x12ce('0x1c')](_0x10232e[_0x12ce('0x1d')](0x2,_0x10232e['length'])[_0x12ce('0x1e')](','));break;case'dialogflowv2':var _0x3ac1e3=_0x4f5eab[_0x12ce('0x1a')]['split'](',');_0x31656e[_0x12ce('0x1c')](_0x3ac1e3[0x0]);_0x31656e[_0x12ce('0x1c')](_0x3ac1e3[0x1]);_0x31656e[_0x12ce('0x1c')](_0x3ac1e3[0x2]);_0x31656e[_0x12ce('0x1c')](_0x3ac1e3[0x3]);_0x31656e[_0x12ce('0x1c')](_0x3ac1e3[_0x12ce('0x1d')](0x4,_0x3ac1e3[_0x12ce('0x15')])[_0x12ce('0x1e')](','));break;case'amazonlex':var _0x2f29fc=_0x4f5eab[_0x12ce('0x1a')][_0x12ce('0x20')](',');_0x31656e[_0x12ce('0x1c')](_0x2f29fc[0x0]);_0x31656e[_0x12ce('0x1c')](_0x2f29fc[0x1]);_0x31656e['push'](_0x2f29fc[0x2]);_0x31656e[_0x12ce('0x1c')](_0x2f29fc[0x3]);_0x31656e[_0x12ce('0x1c')](_0x2f29fc['slice'](0x4,_0x2f29fc['length'])['join'](','));break;case _0x12ce('0x11'):_0x31656e[_0x12ce('0x1c')](_0x4f5eab[_0x12ce('0x1a')]);break;case _0x12ce('0x21'):_0x31656e[_0x12ce('0x1c')](_0x4f5eab[_0x12ce('0x22')]);_0x31656e['push'](_0x4f5eab[_0x12ce('0x1a')]);break;case _0x12ce('0x23'):var _0xef41f2=utils[_0x12ce('0x24')](_0x288cff[_0x12ce('0x25')][_0x12ce('0x26')],_0x288cff);var _0x6c46d2=_0x4f5eab[_0x12ce('0x1a')]['split'](',');_0x31656e[_0x12ce('0x1c')](_0x6c46d2[0x0]);_0x31656e[_0x12ce('0x1c')](_0x6c46d2[0x1]);_0x31656e[_0x12ce('0x1c')](_0x6c46d2[0x2]);_0x31656e['push'](_0x6c46d2[0x3]);_0x31656e[_0x12ce('0x1c')](_0x6c46d2[0x4]);_0x31656e[_0x12ce('0x1c')](_0x6c46d2[0x5]);_0x31656e[_0x12ce('0x1c')](_0x6c46d2[0x6]);_0x31656e['push'](_0x6c46d2[0x7]);_0x31656e[_0x12ce('0x1c')](_0x6c46d2[0x8]);_0x31656e['push'](_0x6c46d2[0x9]);_0x31656e['push'](_0x6c46d2[0xa]);_0x31656e[_0x12ce('0x1c')](_0x288cff['interaction']['id']);_0x31656e[_0x12ce('0x1c')](_0x288cff[_0x12ce('0x11')]['id']);_0x31656e[_0x12ce('0x1c')](_0x4f5eab['ChatWebsiteId']);_0x31656e[_0x12ce('0x1c')](_0x288cff[_0x12ce('0x12')][_0x12ce('0x27')]);_0x31656e[_0x12ce('0x1c')](_0x288cff[_0x12ce('0x28')][_0x12ce('0x28')]);_0x31656e['push'](_0xef41f2);break;default:_0x31656e=_['isNil'](_0x4f5eab['appdata'])?[]:_0x4f5eab[_0x12ce('0x1a')][_0x12ce('0x20')](',');}var _0x26fd9e={'id':util['format'](_0x12ce('0x29'),_0x56a72a,_0x4f5eab['id'],_0x4f5eab[_0x12ce('0x16')]),'condition':require(_0x12ce('0x2a'))[_0x12ce('0x2b')](_0x56a72a,getIntervals(_0x12bcf2[_0x12ce('0x2c')],_0x4f5eab),_0x12bcf2),'consequence':require(_0x12ce('0x2d')+_0x4f5eab['app'])[_0x12ce('0x2e')](_0x56a72a,_0x31656e,_0x12bcf2,_0x288cff),'p':_0x4f5eab[_0x12ce('0x2f')]||0x0};logger[_0x12ce('0x30')]('Push\x20new\x20rule',_0x26fd9e['id'],_0x12ce('0x31'),getIntervals(_0x12bcf2[_0x12ce('0x2c')],_0x4f5eab)[_0x12ce('0x1e')]('\x20|\x20'));_0x188408['push'](_0x26fd9e);}else{logger[_0x12ce('0x32')](_0x12ce('0x33'),path[_0x12ce('0x1e')](__dirname,'applications',_0x4f5eab[_0x12ce('0x16')]+_0x12ce('0x17')));}}_0x12bcf2[_0x12ce('0x10')][_0x56a72a]=new RuleEngine(_0x188408);_0x12bcf2[_0x12ce('0x10')][_0x56a72a][_0x12ce('0x34')](_0x288cff,function(_0x43dced){logger[_0x12ce('0x30')](_0x12ce('0x35'),JSON[_0x12ce('0x36')](_0x43dced[_0x12ce('0x37')]));if(_0x12bcf2[_0x12ce('0x10')][_0x56a72a]){_0x12bcf2['rules'][_0x56a72a]['emit'](_0x12ce('0x38'));}});return _0x39e4ec({'code':0xc8,'message':_0x288cff});}else{logger[_0x12ce('0x30')](_0x12ce('0x39'));return _0x39e4ec({'code':0xc8,'message':_0x288cff});}}catch(_0x51beb0){logger['error'](_0x51beb0['stack']);return _0x134831(_0x2ac396[_0x12ce('0x32')](0x1f4,_0x51beb0));}}return _0x134831(_0x12ce('0x3a'));});},'AcceptMessage':function(_0x17d419){var _0x1982b4=this;return new Promise(function(_0x2f11a4,_0x21044f){if(_0x17d419[_0x12ce('0x3b')]&&_0x17d419['agent']['id']){if(_0x12bcf2['agents'][_0x17d419[_0x12ce('0x3b')]['id']]){_0x12bcf2['agents'][_0x17d419[_0x12ce('0x3b')]['id']][_0x12ce('0x3c')]=![];_0x12bcf2[_0x12ce('0x3d')][_0x17d419[_0x12ce('0x3b')]['id']][_0x12ce('0x3e')]=undefined;}}if(_0x17d419[_0x12ce('0x11')]&&_0x17d419['message']['id']){try{var _0xfc17ea=getId(_0x17d419['channel'],_0x17d419[_0x12ce('0x11')]?_0x17d419[_0x12ce('0x11')]['id']:0x0,_0x17d419[_0x12ce('0x12')]?_0x17d419[_0x12ce('0x12')]['id']:0x0);if(_0x12bcf2[_0x12ce('0x10')][_0xfc17ea]){_0x12bcf2[_0x12ce('0x10')][_0xfc17ea][_0x12ce('0x3f')]('end');if(rpc[_0x17d419['channel']+_0x12ce('0x40')]){rpc[_0x17d419[_0x12ce('0x1b')]+'QueueReport']['update'](_0xfc17ea,{'UserId':_0x17d419[_0x12ce('0x11')][_0x12ce('0x41')]})[_0x12ce('0x42')](function(_0x3f5eef){logger[_0x12ce('0x32')](_0x12ce('0x43'));});}}return _0x2f11a4({'code':0xc8,'message':_0x17d419});}catch(_0x148500){logger[_0x12ce('0x32')](_0x148500[_0x12ce('0x44')]);return _0x21044f(_0x1982b4[_0x12ce('0x32')](0x1f4,_0x148500));}}logger[_0x12ce('0x32')](_0x12ce('0x45'));return _0x21044f(_0x1982b4[_0x12ce('0x32')](0x1f4,_0x12ce('0x45')));});},'RejectMessage':function(_0x455f03){var _0x4a4595=this;return new Promise(function(_0x4c4a5c,_0x497187){if(_0x455f03[_0x12ce('0x3b')]&&_0x455f03['agent']['id']){try{if(_0x12bcf2[_0x12ce('0x3d')][_0x455f03[_0x12ce('0x3b')]['id']]){_0x12bcf2['agents'][_0x455f03[_0x12ce('0x3b')]['id']][_0x12ce('0x3c')]=![];_0x12bcf2[_0x12ce('0x3d')][_0x455f03[_0x12ce('0x3b')]['id']][_0x12ce('0x3e')]=undefined;}return _0x4c4a5c({'code':0xc8,'message':_0x455f03});}catch(_0x12e627){logger[_0x12ce('0x32')](_0x12e627[_0x12ce('0x44')]);return _0x497187(_0x4a4595[_0x12ce('0x32')](0x1f4,_0x12e627));}}logger['error'](_0x12ce('0x45'));return _0x497187(_0x4a4595[_0x12ce('0x32')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x40d7c7){var _0x3430c0=this;return new Promise(function(_0x31fc53,_0x4a7a68){if(_0x40d7c7[_0x12ce('0x1b')]&&_0x40d7c7[_0x12ce('0x12')]&&_0x40d7c7['interaction']['id']){try{var _0x32e105=getId(_0x40d7c7[_0x12ce('0x1b')],_0x40d7c7[_0x12ce('0x11')]?_0x40d7c7[_0x12ce('0x11')]['id']:0x0,_0x40d7c7[_0x12ce('0x12')]?_0x40d7c7['interaction']['id']:0x0);if(_0x12bcf2[_0x12ce('0x10')][_0x32e105]){_0x12bcf2[_0x12ce('0x10')][_0x32e105][_0x12ce('0x3f')]('end');}return _0x31fc53({'code':0xc8,'message':_0x40d7c7});}catch(_0x3a730b){logger['error'](_0x3a730b['stack']);return _0x4a7a68(_0x3430c0['error'](0x1f4,_0x3a730b));}}logger['error'](_0x12ce('0x45'));return _0x4a7a68(_0x3430c0[_0x12ce('0x32')](0x1f4,_0x12ce('0x45')));});},'AgentCapacity':function(_0xbac09c){var _0x449df4=this;return new Promise(function(_0x56e276,_0x4d0775){if(_0x12bcf2[_0x12ce('0x3d')][_0x12ce('0x46')](_0xbac09c['id'])){for(var _0x31a04b in _0xbac09c[_0x12ce('0x47')]){if(_0xbac09c[_0x12ce('0x47')][_0x12ce('0x46')](_0x31a04b)){if(_0x12bcf2[_0x12ce('0x3d')][_0xbac09c['id']]['hasOwnProperty'](_0x31a04b+_0x12ce('0x48'))){_0x12bcf2[_0x12ce('0x3d')][_0xbac09c['id']][_0x31a04b+_0x12ce('0x48')]=parseInt(_0xbac09c['capacity'][_0x31a04b],0xa);}}}_0x12bcf2[_0x12ce('0x3d')][_0xbac09c['id']][_0x12ce('0x49')]();return _0x56e276({'code':0xc8,'message':_0x12bcf2['agents'][_0xbac09c['id']]});}else{return _0x4d0775(_0x449df4[_0x12ce('0x32')](0x1f4,_0x12ce('0x4a')));}});},'Agents':function(_0x532539){return new Promise(function(_0x49b911,_0x26b343){var _0x5c2e63=_['values'](_0x12bcf2[_0x12ce('0x3d')]);_0x49b911({'count':_0x5c2e63['length'],'rows':_0x5c2e63});});},'ChatQueues':function(_0x259f20){return new Promise(function(_0x3ffcdf,_0x153954){var _0x5ec96e=[];for(var _0x1d79ff in _0x12bcf2[_0x12ce('0x4b')]){if(_0x12bcf2[_0x12ce('0x4b')][_0x12ce('0x46')](_0x1d79ff)){var _0x5d7ebc=_0x12bcf2[_0x12ce('0x4b')][_0x1d79ff];var _0x5b0fe7={'id':_0x5d7ebc['id'],'available':_0x5d7ebc[_0x12ce('0x4c')],'loggedIn':_0x5d7ebc[_0x12ce('0x4d')],'name':_0x5d7ebc['name'],'paused':_0x5d7ebc[_0x12ce('0x4e')],'waiting':_0x5d7ebc[_0x12ce('0x4f')]};_0x5ec96e[_0x12ce('0x1c')](_0x5b0fe7);}}_0x3ffcdf({'count':_0x5ec96e[_0x12ce('0x15')],'rows':_0x5ec96e});});},'MailQueues':function(_0x1ab419){return new Promise(function(_0x127c2d,_0x32fd96){var _0x230425=[];for(var _0x3bad0d in _0x12bcf2[_0x12ce('0x50')]){if(_0x12bcf2[_0x12ce('0x50')][_0x12ce('0x46')](_0x3bad0d)){var _0x427e39=_0x12bcf2['mailQueues'][_0x3bad0d];var _0x17f3af={'id':_0x427e39['id'],'available':_0x427e39[_0x12ce('0x4c')],'loggedIn':_0x427e39['loggedIn'],'name':_0x427e39[_0x12ce('0x51')],'paused':_0x427e39['paused'],'waiting':_0x427e39[_0x12ce('0x4f')]};_0x230425[_0x12ce('0x1c')](_0x17f3af);}}_0x127c2d({'count':_0x230425[_0x12ce('0x15')],'rows':_0x230425});});},'OpenchannelQueues':function(_0x17a3ae){return new Promise(function(_0x360c80,_0x12d8d5){var _0x5d934b=[];for(var _0x7fe407 in _0x12bcf2[_0x12ce('0x52')]){if(_0x12bcf2[_0x12ce('0x52')][_0x12ce('0x46')](_0x7fe407)){var _0x572aec=_0x12bcf2['openchannelQueues'][_0x7fe407];var _0x2ab52b={'id':_0x572aec['id'],'available':_0x572aec['available'],'loggedIn':_0x572aec[_0x12ce('0x4d')],'name':_0x572aec[_0x12ce('0x51')],'paused':_0x572aec[_0x12ce('0x4e')],'waiting':_0x572aec[_0x12ce('0x4f')]};_0x5d934b['push'](_0x2ab52b);}}_0x360c80({'count':_0x5d934b['length'],'rows':_0x5d934b});});},'SmsQueues':function(_0x90f4f8){return new Promise(function(_0x132235,_0x3b6747){var _0x2f9453=[];for(var _0x3d7cb5 in _0x12bcf2[_0x12ce('0x53')]){if(_0x12bcf2[_0x12ce('0x53')]['hasOwnProperty'](_0x3d7cb5)){var _0x27b312=_0x12bcf2[_0x12ce('0x53')][_0x3d7cb5];var _0x1d353a={'id':_0x27b312['id'],'available':_0x27b312[_0x12ce('0x4c')],'loggedIn':_0x27b312[_0x12ce('0x4d')],'name':_0x27b312[_0x12ce('0x51')],'paused':_0x27b312[_0x12ce('0x4e')],'waiting':_0x27b312[_0x12ce('0x4f')]};_0x2f9453[_0x12ce('0x1c')](_0x1d353a);}}_0x132235({'count':_0x2f9453[_0x12ce('0x15')],'rows':_0x2f9453});});},'FaxQueues':function(_0x2c488d){return new Promise(function(_0x4ac85a,_0x4df713){var _0x408f7e=[];for(var _0x2fe6f4 in _0x12bcf2['faxQueues']){if(_0x12bcf2[_0x12ce('0x54')][_0x12ce('0x46')](_0x2fe6f4)){var _0xc801cd=_0x12bcf2[_0x12ce('0x54')][_0x2fe6f4];var _0x2d7665={'id':_0xc801cd['id'],'available':_0xc801cd[_0x12ce('0x4c')],'loggedIn':_0xc801cd[_0x12ce('0x4d')],'name':_0xc801cd[_0x12ce('0x51')],'paused':_0xc801cd['paused'],'waiting':_0xc801cd[_0x12ce('0x4f')]};_0x408f7e[_0x12ce('0x1c')](_0x2d7665);}}_0x4ac85a({'count':_0x408f7e[_0x12ce('0x15')],'rows':_0x408f7e});});},'WhatsappQueues':function(_0x2c0f57){return new Promise(function(_0x3aa4a8,_0x41bc51){var _0x21afcb=[];for(var _0x4ce319 in _0x12bcf2[_0x12ce('0x55')]){if(_0x12bcf2[_0x12ce('0x55')][_0x12ce('0x46')](_0x4ce319)){var _0x7a3c81=_0x12bcf2['whatsappQueues'][_0x4ce319];var _0x237793={'id':_0x7a3c81['id'],'available':_0x7a3c81[_0x12ce('0x4c')],'loggedIn':_0x7a3c81[_0x12ce('0x4d')],'name':_0x7a3c81[_0x12ce('0x51')],'paused':_0x7a3c81['paused'],'waiting':_0x7a3c81[_0x12ce('0x4f')]};_0x21afcb['push'](_0x237793);}}_0x3aa4a8({'count':_0x21afcb['length'],'rows':_0x21afcb});});},'ChatQueuesWaitingInteractions':function(_0xcafea9){return new Promise(function(_0x3f50f9,_0x128049){var _0x5c926c=_['values'](_0x12bcf2[_0x12ce('0x56')]);_0x3f50f9({'count':_0x5c926c[_0x12ce('0x15')],'rows':_0x5c926c});});},'MailQueuesWaitingInteractions':function(_0x36edc4){return new Promise(function(_0x2aefe4,_0xe960be){var _0x3ddc17=_[_0x12ce('0x57')](_0x12bcf2['mailQueuesWaitingInteractions']);_0x2aefe4({'count':_0x3ddc17['length'],'rows':_0x3ddc17});});},'OpenchannelQueuesWaitingInteractions':function(_0x1c439a){return new Promise(function(_0x4d3980,_0x2d8e83){var _0x240e95=_['values'](_0x12bcf2[_0x12ce('0x58')]);_0x4d3980({'count':_0x240e95[_0x12ce('0x15')],'rows':_0x240e95});});},'SmsQueuesWaitingInteractions':function(_0x5bf370){return new Promise(function(_0x294982,_0x7f61c){var _0x316d75=_[_0x12ce('0x57')](_0x12bcf2[_0x12ce('0x59')]);_0x294982({'count':_0x316d75['length'],'rows':_0x316d75});});},'FaxQueuesWaitingInteractions':function(_0x44b106){return new Promise(function(_0x4facd8,_0x55bc1e){var _0xf97227=_[_0x12ce('0x57')](_0x12bcf2[_0x12ce('0x5a')]);_0x4facd8({'count':_0xf97227[_0x12ce('0x15')],'rows':_0xf97227});});},'WhatsappQueuesWaitingInteractions':function(_0xb86d7d){return new Promise(function(_0x294aee,_0x4bc3db){var _0x1f0221=_[_0x12ce('0x57')](_0x12bcf2[_0x12ce('0x5b')]);_0x294aee({'count':_0x1f0221[_0x12ce('0x15')],'rows':_0x1f0221});});}};var _0x3a2e9a=jayson['server'](_0x2171d2)[_0x12ce('0x5c')]();_0x3a2e9a['on'](_0x12ce('0x32'),function(_0x4157e3){logger[_0x12ce('0x32')](JSON[_0x12ce('0x36')](_0x4157e3));return _0x4e3d27(_0x4157e3);});_0x3a2e9a['listen'](0x232c,_0x12ce('0x5d'),function(){console[_0x12ce('0x5e')](_0x12ce('0x5f'),0x232c);return _0x302e3e(_0x12ce('0x60')+0x232c);});});}; \ No newline at end of file +var _0xe739=['app','toLowerCase','autoreply','split','mail','push','slice','dialogflow','dialogflowv2','appdata','tag','TagId','tvox','getMustacheRender','account','interaction','ChatWebsiteId','ContactId','body','%s:%s:%s','./applications/','priority','info','error','Please\x20create\x20a\x20new\x20file\x20under','.js','rules','execute','stringify','matchPath','emit','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','channel','message','applications','isArray','length','join'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe739,0x105));var _0x9e73=function(_0x180484,_0x558947){_0x180484=_0x180484-0x0;var _0x12ffa3=_0xe739[_0x180484];return _0x12ffa3;};'use strict';var _=require(_0x9e73('0x0'));var util=require('util');var path=require(_0x9e73('0x1'));var fs=require('fs');var jayson=require(_0x9e73('0x2'));var BPromise=require(_0x9e73('0x3'));var uuid=require('uuid');var utils=require('./applications/utils');var config=require('../../../config/environment');var logger=require(_0x9e73('0x4'))(_0x9e73('0x5'));var rpc={'openchannelQueueReport':require(_0x9e73('0x6')),'mailQueueReport':require(_0x9e73('0x7')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x9e73('0x8')),'faxQueueReport':require(_0x9e73('0x9')),'whatsappQueueReport':require(_0x9e73('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0xa49f86,_0x1ee042,_0x471872){return util[_0x9e73('0xb')](_0x9e73('0xc'),_0xa49f86,_0x1ee042||0x0,_0x471872||0x0);}function getIntervals(_0x2edd7b,_0x52393d){var _0x33ce2d=[];if(!_['isNil'](_0x52393d['IntervalId'])&&!_[_0x9e73('0xd')](_0x2edd7b[_0x52393d['IntervalId']])&&!_[_0x9e73('0xd')](_0x2edd7b[_0x52393d[_0x9e73('0xe')]][_0x9e73('0xf')])){_0x33ce2d=_['map'](_0x2edd7b[_0x52393d[_0x9e73('0xe')]][_0x9e73('0xf')],_0x9e73('0x10'));}else if(!_[_0x9e73('0xd')](_0x52393d['interval'])){_0x33ce2d=[_0x52393d[_0x9e73('0x10')]];}return _0x33ce2d;}exports[_0x9e73('0x11')]=function(_0x3a7bd5){_0x3a7bd5['rules']={};return new BPromise(function(_0x358827,_0x378603){var _0x597492={'Start':function(_0x367857){var _0x327305=this;return new Promise(function(_0x21bd3a,_0x5633e1){if(_0x367857){try{var _0x16b2a9=[];var _0x51968a=getId(_0x367857[_0x9e73('0x12')],_0x367857['message']?_0x367857[_0x9e73('0x13')]['id']:0x0,_0x367857['interaction']?_0x367857['interaction']['id']:0x0);if(_0x367857[_0x9e73('0x14')]&&_[_0x9e73('0x15')](_0x367857[_0x9e73('0x14')])&&_0x367857[_0x9e73('0x14')][_0x9e73('0x16')]){for(var _0x398a0d=0x0;_0x398a0d<_0x367857[_0x9e73('0x14')][_0x9e73('0x16')];_0x398a0d+=0x1){var _0x2235fa=_0x367857[_0x9e73('0x14')][_0x398a0d];if(fs['existsSync'](path[_0x9e73('0x17')](__dirname,'applications',_0x2235fa[_0x9e73('0x18')]+'.js'))){var _0x31d354=[];switch(_0x2235fa['app'][_0x9e73('0x19')]()){case _0x9e73('0x1a'):var _0x5032cf=_0x2235fa['appdata'][_0x9e73('0x1b')](',');if(_0x367857[_0x9e73('0x12')]===_0x9e73('0x1c')){_0x31d354[_0x9e73('0x1d')](_0x5032cf[0x0]);_0x31d354[_0x9e73('0x1d')](_0x5032cf[0x1]);_0x31d354['push'](_0x5032cf[_0x9e73('0x1e')](0x2,_0x5032cf[_0x9e73('0x16')])['join'](','));}else{_0x31d354['push'](_0x5032cf[0x0]);_0x31d354[_0x9e73('0x1d')](_0x5032cf['slice'](0x1,_0x5032cf['length'])[_0x9e73('0x17')](','));}break;case _0x9e73('0x1f'):var _0x46991c=_0x2235fa['appdata'][_0x9e73('0x1b')](',');_0x31d354[_0x9e73('0x1d')](_0x46991c[0x0]);_0x31d354['push'](_0x46991c[0x1]);_0x31d354[_0x9e73('0x1d')](_0x46991c[_0x9e73('0x1e')](0x2,_0x46991c[_0x9e73('0x16')])[_0x9e73('0x17')](','));break;case _0x9e73('0x20'):var _0x511e35=_0x2235fa[_0x9e73('0x21')]['split'](',');_0x31d354[_0x9e73('0x1d')](_0x511e35[0x0]);_0x31d354[_0x9e73('0x1d')](_0x511e35[0x1]);_0x31d354[_0x9e73('0x1d')](_0x511e35[0x2]);_0x31d354[_0x9e73('0x1d')](_0x511e35[0x3]);_0x31d354[_0x9e73('0x1d')](_0x511e35['slice'](0x4,_0x511e35[_0x9e73('0x16')])[_0x9e73('0x17')](','));break;case'amazonlex':var _0x4e5ab0=_0x2235fa[_0x9e73('0x21')][_0x9e73('0x1b')](',');_0x31d354[_0x9e73('0x1d')](_0x4e5ab0[0x0]);_0x31d354[_0x9e73('0x1d')](_0x4e5ab0[0x1]);_0x31d354[_0x9e73('0x1d')](_0x4e5ab0[0x2]);_0x31d354[_0x9e73('0x1d')](_0x4e5ab0[0x3]);_0x31d354['push'](_0x4e5ab0[_0x9e73('0x1e')](0x4,_0x4e5ab0[_0x9e73('0x16')])[_0x9e73('0x17')](','));break;case _0x9e73('0x13'):_0x31d354[_0x9e73('0x1d')](_0x2235fa[_0x9e73('0x21')]);break;case _0x9e73('0x22'):_0x31d354[_0x9e73('0x1d')](_0x2235fa[_0x9e73('0x23')]);_0x31d354[_0x9e73('0x1d')](_0x2235fa['appdata']);break;case _0x9e73('0x24'):var _0x2c2ebd=utils[_0x9e73('0x25')](_0x367857[_0x9e73('0x26')]['notificationTemplate'],_0x367857);var _0x3d2608=_0x2235fa[_0x9e73('0x21')]['split'](',');_0x31d354['push'](_0x3d2608[0x0]);_0x31d354[_0x9e73('0x1d')](_0x3d2608[0x1]);_0x31d354[_0x9e73('0x1d')](_0x3d2608[0x2]);_0x31d354[_0x9e73('0x1d')](_0x3d2608[0x3]);_0x31d354[_0x9e73('0x1d')](_0x3d2608[0x4]);_0x31d354[_0x9e73('0x1d')](_0x3d2608[0x5]);_0x31d354[_0x9e73('0x1d')](_0x3d2608[0x6]);_0x31d354['push'](_0x3d2608[0x7]);_0x31d354['push'](_0x3d2608[0x8]);_0x31d354['push'](_0x3d2608[0x9]);_0x31d354[_0x9e73('0x1d')](_0x3d2608[0xa]);_0x31d354[_0x9e73('0x1d')](_0x367857[_0x9e73('0x27')]['id']);_0x31d354['push'](_0x367857['message']['id']);_0x31d354['push'](_0x2235fa[_0x9e73('0x28')]);_0x31d354[_0x9e73('0x1d')](_0x367857[_0x9e73('0x27')][_0x9e73('0x29')]);_0x31d354['push'](_0x367857[_0x9e73('0x2a')][_0x9e73('0x2a')]);_0x31d354[_0x9e73('0x1d')](_0x2c2ebd);break;default:_0x31d354=_[_0x9e73('0xd')](_0x2235fa[_0x9e73('0x21')])?[]:_0x2235fa[_0x9e73('0x21')][_0x9e73('0x1b')](',');}var _0x3431a8={'id':util[_0x9e73('0xb')](_0x9e73('0x2b'),_0x51968a,_0x2235fa['id'],_0x2235fa['app']),'condition':require('./interval')['condition'](_0x51968a,getIntervals(_0x3a7bd5['intervals'],_0x2235fa),_0x3a7bd5),'consequence':require(_0x9e73('0x2c')+_0x2235fa[_0x9e73('0x18')])['consequence'](_0x51968a,_0x31d354,_0x3a7bd5,_0x367857),'p':_0x2235fa[_0x9e73('0x2d')]||0x0};logger[_0x9e73('0x2e')]('Push\x20new\x20rule',_0x3431a8['id'],'on\x20interval',getIntervals(_0x3a7bd5['intervals'],_0x2235fa)['join']('\x20|\x20'));_0x16b2a9[_0x9e73('0x1d')](_0x3431a8);}else{logger[_0x9e73('0x2f')](_0x9e73('0x30'),path[_0x9e73('0x17')](__dirname,'applications',_0x2235fa['app']+_0x9e73('0x31')));}}_0x3a7bd5[_0x9e73('0x32')][_0x51968a]=new RuleEngine(_0x16b2a9);_0x3a7bd5[_0x9e73('0x32')][_0x51968a][_0x9e73('0x33')](_0x367857,function(_0x3f348f){logger[_0x9e73('0x2e')]('Applications\x20executed',JSON[_0x9e73('0x34')](_0x3f348f[_0x9e73('0x35')]));if(_0x3a7bd5['rules'][_0x51968a]){_0x3a7bd5[_0x9e73('0x32')][_0x51968a][_0x9e73('0x36')]('complete');}});return _0x21bd3a({'code':0xc8,'message':_0x367857});}else{logger[_0x9e73('0x2e')](_0x9e73('0x37'));return _0x21bd3a({'code':0xc8,'message':_0x367857});}}catch(_0x4ea68c){logger[_0x9e73('0x2f')](_0x4ea68c[_0x9e73('0x38')]);return _0x5633e1(_0x327305[_0x9e73('0x2f')](0x1f4,_0x4ea68c));}}return _0x5633e1(_0x9e73('0x39'));});},'AcceptMessage':function(_0x1977b6){var _0x3933b5=this;return new Promise(function(_0x20c4cd,_0x18b983){if(_0x1977b6[_0x9e73('0x3a')]&&_0x1977b6[_0x9e73('0x3a')]['id']){if(_0x3a7bd5[_0x9e73('0x3b')][_0x1977b6[_0x9e73('0x3a')]['id']]){_0x3a7bd5[_0x9e73('0x3b')][_0x1977b6[_0x9e73('0x3a')]['id']][_0x9e73('0x3c')]=![];_0x3a7bd5[_0x9e73('0x3b')][_0x1977b6['agent']['id']][_0x9e73('0x3d')]=undefined;}}if(_0x1977b6['message']&&_0x1977b6['message']['id']){try{var _0xa66b24=getId(_0x1977b6[_0x9e73('0x12')],_0x1977b6['message']?_0x1977b6['message']['id']:0x0,_0x1977b6[_0x9e73('0x27')]?_0x1977b6[_0x9e73('0x27')]['id']:0x0);if(_0x3a7bd5[_0x9e73('0x32')][_0xa66b24]){_0x3a7bd5[_0x9e73('0x32')][_0xa66b24][_0x9e73('0x36')](_0x9e73('0x3e'));if(rpc[_0x1977b6[_0x9e73('0x12')]+_0x9e73('0x3f')]){rpc[_0x1977b6[_0x9e73('0x12')]+_0x9e73('0x3f')][_0x9e73('0x40')](_0xa66b24,{'UserId':_0x1977b6[_0x9e73('0x13')][_0x9e73('0x41')]})[_0x9e73('0x42')](function(_0x5a5ba9){logger[_0x9e73('0x2f')](_0x9e73('0x43'));});}}return _0x20c4cd({'code':0xc8,'message':_0x1977b6});}catch(_0x1289f9){logger[_0x9e73('0x2f')](_0x1289f9[_0x9e73('0x38')]);return _0x18b983(_0x3933b5[_0x9e73('0x2f')](0x1f4,_0x1289f9));}}logger[_0x9e73('0x2f')](_0x9e73('0x44'));return _0x18b983(_0x3933b5['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x4d9056){var _0xd78532=this;return new Promise(function(_0x55a07f,_0x22f69a){if(_0x4d9056['agent']&&_0x4d9056[_0x9e73('0x3a')]['id']){try{if(_0x3a7bd5['agents'][_0x4d9056[_0x9e73('0x3a')]['id']]){_0x3a7bd5[_0x9e73('0x3b')][_0x4d9056[_0x9e73('0x3a')]['id']][_0x9e73('0x3c')]=![];_0x3a7bd5[_0x9e73('0x3b')][_0x4d9056[_0x9e73('0x3a')]['id']][_0x9e73('0x3d')]=undefined;}return _0x55a07f({'code':0xc8,'message':_0x4d9056});}catch(_0x5cef36){logger[_0x9e73('0x2f')](_0x5cef36['stack']);return _0x22f69a(_0xd78532[_0x9e73('0x2f')](0x1f4,_0x5cef36));}}logger[_0x9e73('0x2f')](_0x9e73('0x44'));return _0x22f69a(_0xd78532['error'](0x1f4,_0x9e73('0x44')));});},'AbandonInteraction':function(_0x2e61eb){var _0x50737d=this;return new Promise(function(_0x26490c,_0x1c6b08){if(_0x2e61eb[_0x9e73('0x12')]&&_0x2e61eb[_0x9e73('0x27')]&&_0x2e61eb[_0x9e73('0x27')]['id']){try{var _0x5d7422=getId(_0x2e61eb[_0x9e73('0x12')],_0x2e61eb[_0x9e73('0x13')]?_0x2e61eb['message']['id']:0x0,_0x2e61eb[_0x9e73('0x27')]?_0x2e61eb[_0x9e73('0x27')]['id']:0x0);if(_0x3a7bd5[_0x9e73('0x32')][_0x5d7422]){_0x3a7bd5['rules'][_0x5d7422][_0x9e73('0x36')](_0x9e73('0x3e'));}return _0x26490c({'code':0xc8,'message':_0x2e61eb});}catch(_0x5b2021){logger[_0x9e73('0x2f')](_0x5b2021[_0x9e73('0x38')]);return _0x1c6b08(_0x50737d[_0x9e73('0x2f')](0x1f4,_0x5b2021));}}logger[_0x9e73('0x2f')](_0x9e73('0x44'));return _0x1c6b08(_0x50737d[_0x9e73('0x2f')](0x1f4,_0x9e73('0x44')));});},'AgentCapacity':function(_0x405b8b){var _0x25c13c=this;return new Promise(function(_0x2dec97,_0x22c2cd){if(_0x3a7bd5[_0x9e73('0x3b')]['hasOwnProperty'](_0x405b8b['id'])){for(var _0x16d781 in _0x405b8b[_0x9e73('0x45')]){if(_0x405b8b[_0x9e73('0x45')]['hasOwnProperty'](_0x16d781)){if(_0x3a7bd5['agents'][_0x405b8b['id']][_0x9e73('0x46')](_0x16d781+_0x9e73('0x47'))){_0x3a7bd5[_0x9e73('0x3b')][_0x405b8b['id']][_0x16d781+_0x9e73('0x47')]=parseInt(_0x405b8b[_0x9e73('0x45')][_0x16d781],0xa);}}}_0x3a7bd5[_0x9e73('0x3b')][_0x405b8b['id']][_0x9e73('0x48')]();return _0x2dec97({'code':0xc8,'message':_0x3a7bd5[_0x9e73('0x3b')][_0x405b8b['id']]});}else{return _0x22c2cd(_0x25c13c[_0x9e73('0x2f')](0x1f4,_0x9e73('0x49')));}});},'Agents':function(_0x26a01e){return new Promise(function(_0x37fb09,_0x5e256b){var _0x2a9668=_[_0x9e73('0x4a')](_0x3a7bd5[_0x9e73('0x3b')]);_0x37fb09({'count':_0x2a9668[_0x9e73('0x16')],'rows':_0x2a9668});});},'ChatQueues':function(_0x13995b){return new Promise(function(_0x1faedc,_0x3a9709){var _0x2a15f0=[];for(var _0x592593 in _0x3a7bd5['chatQueues']){if(_0x3a7bd5[_0x9e73('0x4b')]['hasOwnProperty'](_0x592593)){var _0x598657=_0x3a7bd5[_0x9e73('0x4b')][_0x592593];var _0x5b8a3e={'id':_0x598657['id'],'available':_0x598657[_0x9e73('0x4c')],'loggedIn':_0x598657[_0x9e73('0x4d')],'name':_0x598657[_0x9e73('0x4e')],'paused':_0x598657[_0x9e73('0x4f')],'waiting':_0x598657[_0x9e73('0x50')]};_0x2a15f0['push'](_0x5b8a3e);}}_0x1faedc({'count':_0x2a15f0['length'],'rows':_0x2a15f0});});},'MailQueues':function(_0x263340){return new Promise(function(_0x28e6e2,_0xa5a487){var _0x11f92b=[];for(var _0xf3fad3 in _0x3a7bd5[_0x9e73('0x51')]){if(_0x3a7bd5[_0x9e73('0x51')][_0x9e73('0x46')](_0xf3fad3)){var _0x2f06eb=_0x3a7bd5[_0x9e73('0x51')][_0xf3fad3];var _0x1e39f7={'id':_0x2f06eb['id'],'available':_0x2f06eb[_0x9e73('0x4c')],'loggedIn':_0x2f06eb['loggedIn'],'name':_0x2f06eb[_0x9e73('0x4e')],'paused':_0x2f06eb[_0x9e73('0x4f')],'waiting':_0x2f06eb[_0x9e73('0x50')]};_0x11f92b[_0x9e73('0x1d')](_0x1e39f7);}}_0x28e6e2({'count':_0x11f92b[_0x9e73('0x16')],'rows':_0x11f92b});});},'OpenchannelQueues':function(_0x39a5ae){return new Promise(function(_0x256487,_0x107f44){var _0xff77be=[];for(var _0x333238 in _0x3a7bd5[_0x9e73('0x52')]){if(_0x3a7bd5[_0x9e73('0x52')][_0x9e73('0x46')](_0x333238)){var _0x35eb62=_0x3a7bd5[_0x9e73('0x52')][_0x333238];var _0x11d3f1={'id':_0x35eb62['id'],'available':_0x35eb62['available'],'loggedIn':_0x35eb62[_0x9e73('0x4d')],'name':_0x35eb62[_0x9e73('0x4e')],'paused':_0x35eb62[_0x9e73('0x4f')],'waiting':_0x35eb62[_0x9e73('0x50')]};_0xff77be[_0x9e73('0x1d')](_0x11d3f1);}}_0x256487({'count':_0xff77be['length'],'rows':_0xff77be});});},'SmsQueues':function(_0x23868a){return new Promise(function(_0x4a8d5d,_0x1b9b5f){var _0x4c37a4=[];for(var _0x5299d0 in _0x3a7bd5[_0x9e73('0x53')]){if(_0x3a7bd5[_0x9e73('0x53')]['hasOwnProperty'](_0x5299d0)){var _0x401ff5=_0x3a7bd5[_0x9e73('0x53')][_0x5299d0];var _0x2aab80={'id':_0x401ff5['id'],'available':_0x401ff5[_0x9e73('0x4c')],'loggedIn':_0x401ff5[_0x9e73('0x4d')],'name':_0x401ff5[_0x9e73('0x4e')],'paused':_0x401ff5['paused'],'waiting':_0x401ff5[_0x9e73('0x50')]};_0x4c37a4[_0x9e73('0x1d')](_0x2aab80);}}_0x4a8d5d({'count':_0x4c37a4['length'],'rows':_0x4c37a4});});},'FaxQueues':function(_0x286279){return new Promise(function(_0x31cf5d,_0x242ca4){var _0xf24e8c=[];for(var _0x5836c8 in _0x3a7bd5['faxQueues']){if(_0x3a7bd5[_0x9e73('0x54')][_0x9e73('0x46')](_0x5836c8)){var _0x52aac2=_0x3a7bd5['faxQueues'][_0x5836c8];var _0x19b846={'id':_0x52aac2['id'],'available':_0x52aac2[_0x9e73('0x4c')],'loggedIn':_0x52aac2[_0x9e73('0x4d')],'name':_0x52aac2[_0x9e73('0x4e')],'paused':_0x52aac2[_0x9e73('0x4f')],'waiting':_0x52aac2[_0x9e73('0x50')]};_0xf24e8c[_0x9e73('0x1d')](_0x19b846);}}_0x31cf5d({'count':_0xf24e8c[_0x9e73('0x16')],'rows':_0xf24e8c});});},'WhatsappQueues':function(_0x424d15){return new Promise(function(_0xf77390,_0x78d3bb){var _0x49a4a6=[];for(var _0x1095cf in _0x3a7bd5[_0x9e73('0x55')]){if(_0x3a7bd5[_0x9e73('0x55')][_0x9e73('0x46')](_0x1095cf)){var _0x238e26=_0x3a7bd5['whatsappQueues'][_0x1095cf];var _0x47b565={'id':_0x238e26['id'],'available':_0x238e26['available'],'loggedIn':_0x238e26[_0x9e73('0x4d')],'name':_0x238e26[_0x9e73('0x4e')],'paused':_0x238e26['paused'],'waiting':_0x238e26[_0x9e73('0x50')]};_0x49a4a6['push'](_0x47b565);}}_0xf77390({'count':_0x49a4a6[_0x9e73('0x16')],'rows':_0x49a4a6});});},'ChatQueuesWaitingInteractions':function(_0x495915){return new Promise(function(_0x4fac8f,_0x18f5e4){var _0x5485ba=_['values'](_0x3a7bd5['chatQueuesWaitingInteractions']);_0x4fac8f({'count':_0x5485ba[_0x9e73('0x16')],'rows':_0x5485ba});});},'MailQueuesWaitingInteractions':function(_0xf5f4e7){return new Promise(function(_0x102248,_0x20ceff){var _0x2db63b=_[_0x9e73('0x4a')](_0x3a7bd5[_0x9e73('0x56')]);_0x102248({'count':_0x2db63b[_0x9e73('0x16')],'rows':_0x2db63b});});},'OpenchannelQueuesWaitingInteractions':function(_0x4645e0){return new Promise(function(_0xd23383,_0x3b1d4c){var _0x262d68=_[_0x9e73('0x4a')](_0x3a7bd5['openchannelQueuesWaitingInteractions']);_0xd23383({'count':_0x262d68[_0x9e73('0x16')],'rows':_0x262d68});});},'SmsQueuesWaitingInteractions':function(_0x4da984){return new Promise(function(_0x3e7d62,_0x2fac60){var _0x270cb2=_[_0x9e73('0x4a')](_0x3a7bd5[_0x9e73('0x57')]);_0x3e7d62({'count':_0x270cb2[_0x9e73('0x16')],'rows':_0x270cb2});});},'FaxQueuesWaitingInteractions':function(_0x4ea842){return new Promise(function(_0xbf291a,_0x1d306b){var _0xa9818=_[_0x9e73('0x4a')](_0x3a7bd5[_0x9e73('0x58')]);_0xbf291a({'count':_0xa9818[_0x9e73('0x16')],'rows':_0xa9818});});},'WhatsappQueuesWaitingInteractions':function(_0x2df257){return new Promise(function(_0x311e1e,_0x1c9c2a){var _0x47d05a=_[_0x9e73('0x4a')](_0x3a7bd5[_0x9e73('0x59')]);_0x311e1e({'count':_0x47d05a['length'],'rows':_0x47d05a});});}};var _0x3d9176=jayson[_0x9e73('0x5a')](_0x597492)[_0x9e73('0x5b')]();_0x3d9176['on']('error',function(_0x123d01){logger[_0x9e73('0x2f')](JSON[_0x9e73('0x34')](_0x123d01));return _0x378603(_0x123d01);});_0x3d9176[_0x9e73('0x11')](0x232c,_0x9e73('0x5c'),function(){console[_0x9e73('0x5d')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x358827(_0x9e73('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 86ff8f7..82183cb 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 _0x16e3=['client','http','request','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','message','indexOf','true','all','then','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','bluebird','../../../config/logger','routing'];(function(_0x2bbe4c,_0x3eb0ab){var _0x39f49d=function(_0x59903b){while(--_0x59903b){_0x2bbe4c['push'](_0x2bbe4c['shift']());}};_0x39f49d(++_0x3eb0ab);}(_0x16e3,0x1dc));var _0x316e=function(_0xbb3405,_0x3893e1){_0xbb3405=_0xbb3405-0x0;var _0x3687cd=_0x16e3[_0xbb3405];return _0x3687cd;};'use strict';var util=require(_0x316e('0x0'));var BPromise=require(_0x316e('0x1'));var jayson=require('jayson/promise');var _=require('lodash');var logger=require(_0x316e('0x2'))(_0x316e('0x3'));var client=jayson[_0x316e('0x4')][_0x316e('0x5')]({'port':0x232a});function request(_0x380afd,_0x4257ca){return new BPromise(function(_0x389bec,_0x2468ac){return client[_0x316e('0x6')](_0x380afd,_0x4257ca)['then'](function(_0x1bb9ce){if(_0x1bb9ce['error']){return _0x2468ac(_0x1bb9ce[_0x316e('0x7')]['message']);}else{return _0x389bec(_0x1bb9ce[_0x316e('0x8')]);}})[_0x316e('0x9')](function(_0x5052d2){return _0x2468ac(_0x5052d2);});});}exports[_0x316e('0xa')]=function(_0x370ed5,_0x1f6b98,_0x24fdd7){return function(_0x53b975){if(_0x24fdd7[_0x316e('0xb')]&&!_0x24fdd7[_0x316e('0xb')][_0x370ed5]){logger[_0x316e('0xc')](_0x316e('0xd'),_0x370ed5);return _0x53b975[_0x316e('0xe')]();}var _0x49209c=[];for(var _0x34aa0a=0x0;_0x34aa0a<_0x1f6b98[_0x316e('0xf')];_0x34aa0a+=0x1){_0x49209c[_0x316e('0x10')](request(_0x316e('0x11'),{'command':util[_0x316e('0x12')](_0x316e('0x13'),_0x1f6b98[_0x34aa0a])})['then'](function(_0x7efe07){return _0x7efe07&&_0x7efe07[_0x316e('0x14')]&&_0x7efe07['message'][_0x316e('0x15')](_0x316e('0x16'))>=0x0?!![]:![];})[_0x316e('0x9')](function(_0x1e36a1){logger['error']('[%s][INTERVAL]\x20%s',_0x370ed5,_0x1f6b98[_0x34aa0a]);}));}BPromise[_0x316e('0x17')](_0x49209c)[_0x316e('0x18')](function(_0x59eb8c){var _0x10aade=_[_0x316e('0x19')](_0x59eb8c);logger[_0x316e('0xc')](_0x316e('0x1a'),_0x370ed5,_0x1f6b98[_0x316e('0x1b')](_0x316e('0x1c')),_0x10aade);_0x53b975[_0x316e('0x1d')](_0x10aade);})['catch'](function(_0x501398){console[_0x316e('0x1e')](_0x501398);logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x370ed5,_0x1f6b98[_0x316e('0x1b')](_0x316e('0x1c')),_0x501398[_0x316e('0x1f')]);_0x53b975['stop']();});};}; \ No newline at end of file +var _0xad50=['routing','client','http','request','then','error','message','result','catch','condition','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','format','iftime\x20%s','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','log','join','stack','util','bluebird','lodash','../../../config/logger'];(function(_0x3bf1e0,_0x1580be){var _0x5a9ded=function(_0x229240){while(--_0x229240){_0x3bf1e0['push'](_0x3bf1e0['shift']());}};_0x5a9ded(++_0x1580be);}(_0xad50,0xc7));var _0x0ad5=function(_0x3ebb69,_0x3e612e){_0x3ebb69=_0x3ebb69-0x0;var _0x421e59=_0xad50[_0x3ebb69];return _0x421e59;};'use strict';var util=require(_0x0ad5('0x0'));var BPromise=require(_0x0ad5('0x1'));var jayson=require('jayson/promise');var _=require(_0x0ad5('0x2'));var logger=require(_0x0ad5('0x3'))(_0x0ad5('0x4'));var client=jayson[_0x0ad5('0x5')][_0x0ad5('0x6')]({'port':0x232a});function request(_0x409ba0,_0x57a40e){return new BPromise(function(_0x48fb83,_0x504d17){return client[_0x0ad5('0x7')](_0x409ba0,_0x57a40e)[_0x0ad5('0x8')](function(_0x46824e){if(_0x46824e[_0x0ad5('0x9')]){return _0x504d17(_0x46824e['error'][_0x0ad5('0xa')]);}else{return _0x48fb83(_0x46824e[_0x0ad5('0xb')]);}})[_0x0ad5('0xc')](function(_0x57a435){return _0x504d17(_0x57a435);});});}exports[_0x0ad5('0xd')]=function(_0xf97322,_0x1b1896,_0x32c654){return function(_0x3bf7ec){if(_0x32c654['rules']&&!_0x32c654['rules'][_0xf97322]){logger[_0x0ad5('0xe')](_0x0ad5('0xf'),_0xf97322);return _0x3bf7ec[_0x0ad5('0x10')]();}var _0x221e0f=[];for(var _0xbec324=0x0;_0xbec324<_0x1b1896[_0x0ad5('0x11')];_0xbec324+=0x1){_0x221e0f['push'](request(_0x0ad5('0x12'),{'command':util[_0x0ad5('0x13')](_0x0ad5('0x14'),_0x1b1896[_0xbec324])})[_0x0ad5('0x8')](function(_0x5ca4ae){return _0x5ca4ae&&_0x5ca4ae['message']&&_0x5ca4ae[_0x0ad5('0xa')]['indexOf']('true')>=0x0?!![]:![];})[_0x0ad5('0xc')](function(_0x6e7a0e){logger[_0x0ad5('0x9')](_0x0ad5('0x15'),_0xf97322,_0x1b1896[_0xbec324]);}));}BPromise[_0x0ad5('0x16')](_0x221e0f)[_0x0ad5('0x8')](function(_0x262def){var _0x366808=_[_0x0ad5('0x17')](_0x262def);logger[_0x0ad5('0xe')](_0x0ad5('0x18'),_0xf97322,_0x1b1896['join'](_0x0ad5('0x19')),_0x366808);_0x3bf7ec['when'](_0x366808);})['catch'](function(_0x568835){console[_0x0ad5('0x1a')](_0x568835);logger[_0x0ad5('0x9')](_0x0ad5('0x18'),_0xf97322,_0x1b1896[_0x0ad5('0x1b')](_0x0ad5('0x19')),_0x568835[_0x0ad5('0x1c')]);_0x3bf7ec['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 0e6fd2c..faae5aa 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 _0xe5b5=['[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','blind','transferexten','extension','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','transfertargetuniqueid','[%s][agents][attendedtransfer]','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','diffTime','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentcomplete','acwtime','agentacw','acwTimeout','request','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','ringtime','talktime','push','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','abandoned','reason','holdtime','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentconnect]'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x38ff1e,_0x3b9385){_0x38ff1e=_0x38ff1e-0x0;var _0x3755d4=_0xe5b5[_0x38ff1e];return _0x3755d4;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var utils=require(_0x5e5b('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x3b3efd,_0x208070){utils[_0x5e5b('0x3')](util[_0x5e5b('0x4')](_0x5e5b('0x5'),_0x3b3efd[_0x5e5b('0x6')],_0x3b3efd[_0x5e5b('0x7')],_0x3b3efd[_0x5e5b('0x8')],_0x3b3efd[_0x5e5b('0x9')],_0x3b3efd[_0x5e5b('0xa')],_0x3b3efd[_0x5e5b('0xb')],_0x3b3efd[_0x5e5b('0xc')],_0x3b3efd[_0x5e5b('0xd')]));if(_0x3b3efd[_0x5e5b('0x8')]){utils[_0x5e5b('0xe')](_0x3b3efd[_0x5e5b('0x8')])[_0x5e5b('0xf')](function(_0x2aabb5){if(_0x2aabb5){_0x3b3efd[_0x5e5b('0x10')]=_0x2aabb5[_0x5e5b('0x10')];_0x3b3efd['agentacw']=_0x3b3efd[_0x5e5b('0x11')]?_0x2aabb5['acw']:![];_0x3b3efd[_0x5e5b('0x12')]=_0x3b3efd[_0x5e5b('0x13')]?_0x2aabb5[_0x5e5b('0x14')]:0x0;}utils[_0x5e5b('0x15')]('CreateVoiceAgentReport',_0x3b3efd);});}else{utils['request']('CreateVoiceAgentReport',_0x3b3efd);}if(_0x208070){delete transfers[_0x3b3efd[_0x5e5b('0x6')]];}else{delete agents[_0x3b3efd[_0x5e5b('0x16')]];}}exports[_0x5e5b('0x17')]=function(_0x1694ff){try{utils[_0x5e5b('0x18')](util[_0x5e5b('0x4')](_0x5e5b('0x19'),_0x1694ff['uniqueid']),_0x1694ff);agents[_0x1694ff[_0x5e5b('0x16')]]=_0x1694ff;agents[_0x1694ff[_0x5e5b('0x16')]]['agentcalledAt']=utils[_0x5e5b('0x1a')]();agents[_0x1694ff['destuniqueid']]['lastevent']=_0x5e5b('0x1b');agents[_0x1694ff[_0x5e5b('0x16')]][_0x5e5b('0xc')]=null;agents[_0x1694ff['destuniqueid']][_0x5e5b('0x1c')]=null;utils['info'](util[_0x5e5b('0x4')](_0x5e5b('0x1d'),_0x1694ff['uniqueid'],agents[_0x1694ff[_0x5e5b('0x16')]][_0x5e5b('0x9')],_0x1694ff[_0x5e5b('0x16')]));}catch(_0x538074){utils[_0x5e5b('0x1e')](util[_0x5e5b('0x4')]('[%s][agents][agentcalled]',_0x1694ff[_0x5e5b('0x6')]),_0x538074);}};exports[_0x5e5b('0x1f')]=function(_0x3c488e){try{if(!_[_0x5e5b('0x20')](agents[_0x3c488e[_0x5e5b('0x16')]])){utils[_0x5e5b('0x18')](util[_0x5e5b('0x4')](_0x5e5b('0x21'),_0x3c488e['uniqueid']),_0x3c488e);utils['info'](util[_0x5e5b('0x4')](_0x5e5b('0x22'),_0x3c488e[_0x5e5b('0x6')],agents[_0x3c488e[_0x5e5b('0x16')]][_0x5e5b('0x9')],_0x3c488e[_0x5e5b('0x16')]));agents[_0x3c488e[_0x5e5b('0x16')]][_0x5e5b('0x1f')]=!![];agents[_0x3c488e[_0x5e5b('0x16')]][_0x5e5b('0x23')]=utils[_0x5e5b('0x1a')]();agents[_0x3c488e['destuniqueid']][_0x5e5b('0xd')]=_0x5e5b('0x24');agents[_0x3c488e[_0x5e5b('0x16')]]['reason']=_0x5e5b('0x24');agents[_0x3c488e[_0x5e5b('0x16')]]['holdtime']=_0x3c488e[_0x5e5b('0x25')]?parseInt(_0x3c488e[_0x5e5b('0x25')])/0x3e8:0x0;agents[_0x3c488e[_0x5e5b('0x16')]][_0x5e5b('0x26')]=0x0;unanswered[_0x5e5b('0x27')](_0x3c488e[_0x5e5b('0x16')]);}}catch(_0x2cb695){utils[_0x5e5b('0x1e')](util[_0x5e5b('0x4')](_0x5e5b('0x21'),_0x3c488e[_0x5e5b('0x6')]),_0x2cb695);}};exports[_0x5e5b('0x28')]=function(_0x4ed688){try{_['forIn'](agents,function(_0x365f6f,_0x289f54){if(_0x365f6f[_0x5e5b('0x6')]==_0x4ed688[_0x5e5b('0x6')]&&!_[_0x5e5b('0x29')](unanswered,_0x365f6f['destuniqueid'])){utils[_0x5e5b('0x18')](util['format'](_0x5e5b('0x2a'),_0x4ed688[_0x5e5b('0x6')]),_0x4ed688);utils[_0x5e5b('0x3')](util[_0x5e5b('0x4')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x4ed688[_0x5e5b('0x6')],_0x365f6f[_0x5e5b('0x9')],_0x365f6f['destuniqueid']));_0x365f6f[_0x5e5b('0x1f')]=!![];_0x365f6f[_0x5e5b('0x23')]=utils[_0x5e5b('0x1a')]();_0x365f6f[_0x5e5b('0xd')]=_0x5e5b('0x2b');_0x365f6f[_0x5e5b('0x2c')]=_0x5e5b('0x2b');_0x365f6f[_0x5e5b('0x2d')]=_0x4ed688['holdtime'];_0x365f6f[_0x5e5b('0x26')]=0x0;writeDB(_0x365f6f);}});}catch(_0x37b5be){utils[_0x5e5b('0x1e')](util[_0x5e5b('0x4')](_0x5e5b('0x2a'),_0x4ed688[_0x5e5b('0x6')]),_0x37b5be);}};exports['agentconnect']=function(_0x5b2ba5){try{if(agents[_0x5b2ba5[_0x5e5b('0x16')]]){utils[_0x5e5b('0x18')](util[_0x5e5b('0x4')]('[%s][agents][agentconnect]',_0x5b2ba5[_0x5e5b('0x6')]),_0x5b2ba5);utils[_0x5e5b('0x3')](util[_0x5e5b('0x4')](_0x5e5b('0x2e'),_0x5b2ba5['uniqueid'],agents[_0x5b2ba5[_0x5e5b('0x16')]][_0x5e5b('0x9')],_0x5b2ba5['destuniqueid']));agents[_0x5b2ba5['destuniqueid']][_0x5e5b('0x2f')]=utils[_0x5e5b('0x1a')]();agents[_0x5b2ba5[_0x5e5b('0x16')]]['connectedlinenum']=_0x5b2ba5[_0x5e5b('0xc')];agents[_0x5b2ba5['destuniqueid']]['connectedlinename']=_0x5b2ba5[_0x5e5b('0x1c')];agents[_0x5b2ba5[_0x5e5b('0x16')]][_0x5e5b('0x2d')]=_0x5b2ba5[_0x5e5b('0x25')];agents[_0x5b2ba5[_0x5e5b('0x16')]][_0x5e5b('0xd')]=_0x5e5b('0x30');_[_0x5e5b('0x31')](agents,function(_0x1034fa,_0x53b88f){if(_0x1034fa[_0x5e5b('0x16')]!=_0x5b2ba5[_0x5e5b('0x16')]&&_0x1034fa['uniqueid']==_0x5b2ba5[_0x5e5b('0x6')]){_0x1034fa['talktime']=0x0;_0x1034fa[_0x5e5b('0x2d')]=_0x5b2ba5[_0x5e5b('0x25')];_0x1034fa[_0x5e5b('0x1f')]=!![];_0x1034fa[_0x5e5b('0x23')]=utils[_0x5e5b('0x1a')]();_0x1034fa[_0x5e5b('0xd')]=_0x5e5b('0x32');_0x1034fa[_0x5e5b('0x2c')]=_0x5e5b('0x32');_0x1034fa[_0x5e5b('0x33')]=_0x5b2ba5[_0x5e5b('0x16')];_0x1034fa['answeredelsewheremembername']=_0x5b2ba5[_0x5e5b('0x9')];writeDB(_0x1034fa);}});}}catch(_0x40e8ce){utils[_0x5e5b('0x1e')](util['format'](_0x5e5b('0x34'),_0x5b2ba5[_0x5e5b('0x6')]),_0x40e8ce);}};exports['agentcomplete']=function(_0x6672d9){try{if(!_[_0x5e5b('0x20')](agents[_0x6672d9['destuniqueid']])){utils[_0x5e5b('0x18')](util['format']('[%s][agents][agentcomplete]',_0x6672d9['uniqueid']),_0x6672d9);utils[_0x5e5b('0x3')](util['format'](_0x5e5b('0x35'),_0x6672d9['uniqueid'],agents[_0x6672d9[_0x5e5b('0x16')]][_0x5e5b('0x9')],_0x6672d9[_0x5e5b('0x16')]));agents[_0x6672d9[_0x5e5b('0x16')]][_0x5e5b('0x11')]=!![];agents[_0x6672d9[_0x5e5b('0x16')]][_0x5e5b('0x36')]=utils['now']();agents[_0x6672d9['destuniqueid']][_0x5e5b('0x26')]=utils['diffTime'](agents[_0x6672d9['destuniqueid']]['agentcompleteAt'],agents[_0x6672d9[_0x5e5b('0x16')]]['agentconnectAt']);agents[_0x6672d9[_0x5e5b('0x16')]][_0x5e5b('0x2c')]=_0x6672d9[_0x5e5b('0x2c')];agents[_0x6672d9[_0x5e5b('0x16')]][_0x5e5b('0xd')]=_0x5e5b('0x37');writeDB(agents[_0x6672d9['destuniqueid']]);}}catch(_0x26a0ff){utils[_0x5e5b('0x1e')](util['format'](_0x5e5b('0x38'),_0x6672d9['uniqueid']),_0x26a0ff);}};exports[_0x5e5b('0x39')]=function(_0x36d8fa){try{if(!_[_0x5e5b('0x20')](agents[_0x36d8fa[_0x5e5b('0x3a')]])){utils['debug'](util[_0x5e5b('0x4')](_0x5e5b('0x3b'),_0x36d8fa['uniqueid']),_0x36d8fa);utils[_0x5e5b('0x3')](util[_0x5e5b('0x4')](_0x5e5b('0x3c'),_0x36d8fa[_0x5e5b('0x6')],agents[_0x36d8fa[_0x5e5b('0x3a')]][_0x5e5b('0x9')],agents[_0x36d8fa['transfereruniqueid']][_0x5e5b('0x6')]));agents[_0x36d8fa[_0x5e5b('0x3a')]]['transfer']=!![];agents[_0x36d8fa[_0x5e5b('0x3a')]][_0x5e5b('0x3d')]=_0x5e5b('0x3e');agents[_0x36d8fa['transfereruniqueid']][_0x5e5b('0x3f')]=_0x36d8fa[_0x5e5b('0x40')];agents[_0x36d8fa[_0x5e5b('0x3a')]]['transferuniqueid']=agents[_0x36d8fa[_0x5e5b('0x3a')]][_0x5e5b('0x6')];}}catch(_0x239804){utils['error'](util['format'](_0x5e5b('0x3b'),_0x36d8fa['uniqueid']),_0x239804);}};exports['attendedtransfer']=function(_0x1dfe5d){try{utils[_0x5e5b('0x18')](util[_0x5e5b('0x4')]('[%s][agents][attendedtransfer]',_0x1dfe5d[_0x5e5b('0x41')]),_0x1dfe5d);if(_0x1dfe5d[_0x5e5b('0x41')]==_0x1dfe5d[_0x5e5b('0x42')]){if(!_[_0x5e5b('0x20')](agents[_0x1dfe5d[_0x5e5b('0x43')]])){utils[_0x5e5b('0x3')](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x1dfe5d[_0x5e5b('0x41')],agents[_0x1dfe5d[_0x5e5b('0x43')]][_0x5e5b('0x9')]));agents[_0x1dfe5d[_0x5e5b('0x43')]]['transfer']=!![];agents[_0x1dfe5d[_0x5e5b('0x43')]]['transfertype']=_0x5e5b('0x44');agents[_0x1dfe5d[_0x5e5b('0x43')]][_0x5e5b('0x3f')]=_0x1dfe5d[_0x5e5b('0x45')];agents[_0x1dfe5d[_0x5e5b('0x43')]][_0x5e5b('0x46')]=_0x1dfe5d[_0x5e5b('0x41')];}if(_0x1dfe5d[_0x5e5b('0x47')]&&agents[_0x1dfe5d['transfereeuniqueid']]){agents[_0x1dfe5d[_0x5e5b('0x47')]][_0x5e5b('0x48')]=0x1;transfers[_0x1dfe5d[_0x5e5b('0x47')]]=_[_0x5e5b('0x49')](agents[_0x1dfe5d[_0x5e5b('0x47')]]);transfers[_0x1dfe5d['transfereeuniqueid']][_0x5e5b('0xb')]=agents[_0x1dfe5d[_0x5e5b('0x43')]][_0x5e5b('0xb')];transfers[_0x1dfe5d[_0x5e5b('0x47')]][_0x5e5b('0x4a')]=agents[_0x1dfe5d['secondtransfereruniqueid']][_0x5e5b('0x4a')];transfers[_0x1dfe5d['transfereeuniqueid']][_0x5e5b('0x4b')]=utils['now']();transfers[_0x1dfe5d[_0x5e5b('0x47')]][_0x5e5b('0x2f')]=utils[_0x5e5b('0x1a')]();transfers[_0x1dfe5d[_0x5e5b('0x47')]][_0x5e5b('0x2d')]=0x0;transfers[_0x1dfe5d[_0x5e5b('0x47')]]['agententerreason']=0x2;}}else if(_0x1dfe5d[_0x5e5b('0x43')]==_0x1dfe5d[_0x5e5b('0x4c')]){if(!_[_0x5e5b('0x20')](agents[_0x1dfe5d[_0x5e5b('0x41')]])){utils['info'](util['format'](_0x5e5b('0x4d'),_0x1dfe5d[_0x5e5b('0x41')],agents[_0x1dfe5d['origtransfereruniqueid']][_0x5e5b('0x9')]));agents[_0x1dfe5d[_0x5e5b('0x41')]][_0x5e5b('0x4e')]=!![];agents[_0x1dfe5d[_0x5e5b('0x41')]][_0x5e5b('0x3d')]='ATTENDED';agents[_0x1dfe5d[_0x5e5b('0x41')]][_0x5e5b('0x3f')]=_0x1dfe5d['secondtransfererexten'];agents[_0x1dfe5d['origtransfereruniqueid']]['transferuniqueid']=_0x1dfe5d[_0x5e5b('0x43')];}if(_0x1dfe5d[_0x5e5b('0x4f')]&&agents[_0x1dfe5d[_0x5e5b('0x4f')]]){agents[_0x1dfe5d[_0x5e5b('0x4f')]][_0x5e5b('0x48')]=0x1;transfers[_0x1dfe5d['transfertargetuniqueid']]=_[_0x5e5b('0x49')](agents[_0x1dfe5d[_0x5e5b('0x4f')]]);transfers[_0x1dfe5d['transfertargetuniqueid']][_0x5e5b('0xb')]=agents[_0x1dfe5d['origtransfereruniqueid']]['calleridnum'];transfers[_0x1dfe5d[_0x5e5b('0x4f')]][_0x5e5b('0x4a')]=agents[_0x1dfe5d[_0x5e5b('0x41')]][_0x5e5b('0x4a')];transfers[_0x1dfe5d[_0x5e5b('0x4f')]][_0x5e5b('0x4b')]=utils[_0x5e5b('0x1a')]();transfers[_0x1dfe5d['transfertargetuniqueid']][_0x5e5b('0x2f')]=utils[_0x5e5b('0x1a')]();transfers[_0x1dfe5d[_0x5e5b('0x4f')]][_0x5e5b('0x2d')]=0x0;transfers[_0x1dfe5d[_0x5e5b('0x4f')]][_0x5e5b('0x48')]=0x2;}}}catch(_0x32874c){utils[_0x5e5b('0x1e')](util[_0x5e5b('0x4')](_0x5e5b('0x50'),_0x1dfe5d[_0x5e5b('0x41')]),_0x32874c);}};exports['hangup']=function(_0x2c8b25){try{utils[_0x5e5b('0x18')](util[_0x5e5b('0x4')](_0x5e5b('0x51'),_0x2c8b25[_0x5e5b('0x6')]),_0x2c8b25);if(agents[_0x2c8b25['uniqueid']]&&agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x2c')]===_0x5e5b('0x24')){if(_0x2c8b25[_0x5e5b('0x52')]==='21'){agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x2c')]='rejected';agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0xd')]=_0x5e5b('0x53');}utils['info'](util[_0x5e5b('0x4')](_0x5e5b('0x54'),_0x2c8b25[_0x5e5b('0x6')],agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x9')],agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x2c')],agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0xd')]));writeDB(agents[_0x2c8b25['uniqueid']]);var _0x19035d=unanswered['indexOf'](_0x2c8b25[_0x5e5b('0x6')]);if(_0x19035d>-0x1){unanswered[_0x5e5b('0x55')](_0x19035d,0x1);}}if(transfers[_0x2c8b25['uniqueid']]){transfers[_0x2c8b25['uniqueid']][_0x5e5b('0x11')]=!![];transfers[_0x2c8b25[_0x5e5b('0x6')]]['agentcompleteAt']=utils[_0x5e5b('0x1a')]();transfers[_0x2c8b25['uniqueid']]['talktime']=utils[_0x5e5b('0x56')](transfers[_0x2c8b25['uniqueid']][_0x5e5b('0x36')],transfers[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x2f')]);transfers[_0x2c8b25['uniqueid']][_0x5e5b('0x2c')]=_0x5e5b('0x57');transfers[_0x2c8b25[_0x5e5b('0x6')]]['lastevent']=_0x5e5b('0x37');utils[_0x5e5b('0x3')](util['format'](_0x5e5b('0x54'),_0x2c8b25['uniqueid'],transfers[_0x2c8b25['uniqueid']][_0x5e5b('0x9')],transfers[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x2c')],transfers[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0xd')]));writeDB(transfers[_0x2c8b25['uniqueid']],!![]);}if(agents[_0x2c8b25[_0x5e5b('0x6')]]&&agents[_0x2c8b25[_0x5e5b('0x6')]]['agentconnectAt']){agents[_0x2c8b25['uniqueid']][_0x5e5b('0x11')]=!![];agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x36')]=utils[_0x5e5b('0x1a')]();agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x26')]=utils['diffTime'](agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x36')],agents[_0x2c8b25[_0x5e5b('0x6')]]['agentconnectAt']);agents[_0x2c8b25['uniqueid']][_0x5e5b('0x2c')]=agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x4e')]?'transfer':_0x5e5b('0x57');agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0xd')]='complete';utils[_0x5e5b('0x3')](util[_0x5e5b('0x4')](_0x5e5b('0x54'),_0x2c8b25['uniqueid'],agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x9')],agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x2c')],agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0xd')]));writeDB(agents[_0x2c8b25['uniqueid']]);}}catch(_0x202d01){utils[_0x5e5b('0x1e')](util['format'](_0x5e5b('0x51'),_0x2c8b25['uniqueid']),_0x202d01);}}; \ No newline at end of file +var _0x593e=['answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','agentcompleteAt','agentconnectAt','complete','isNil','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','acw','acwtime','agentacw','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','holdtime','ringtime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','talktime','[%s][agents][agentconnect]','connect','answered_elsewhere'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x593e,0xcb));var _0xe593=function(_0x67f348,_0x4db7b8){_0x67f348=_0x67f348-0x0;var _0x240c9e=_0x593e[_0x67f348];return _0x240c9e;};'use strict';var _=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var utils=require(_0xe593('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x28f28c,_0x43dabb){utils[_0xe593('0x3')](util[_0xe593('0x4')](_0xe593('0x5'),_0x28f28c['uniqueid'],_0x28f28c[_0xe593('0x6')],_0x28f28c[_0xe593('0x7')],_0x28f28c[_0xe593('0x8')],_0x28f28c[_0xe593('0x9')],_0x28f28c[_0xe593('0xa')],_0x28f28c[_0xe593('0xb')],_0x28f28c[_0xe593('0xc')]));if(_0x28f28c[_0xe593('0x7')]){utils[_0xe593('0xd')](_0x28f28c[_0xe593('0x7')])['then'](function(_0x38c470){if(_0x38c470){_0x28f28c[_0xe593('0xe')]=_0x38c470[_0xe593('0xe')];_0x28f28c['agentacw']=_0x28f28c['agentcomplete']?_0x38c470[_0xe593('0xf')]:![];_0x28f28c[_0xe593('0x10')]=_0x28f28c[_0xe593('0x11')]?_0x38c470['acwTimeout']:0x0;}utils[_0xe593('0x12')](_0xe593('0x13'),_0x28f28c);});}else{utils[_0xe593('0x12')](_0xe593('0x13'),_0x28f28c);}if(_0x43dabb){delete transfers[_0x28f28c[_0xe593('0x14')]];}else{delete agents[_0x28f28c[_0xe593('0x15')]];}}exports[_0xe593('0x16')]=function(_0xa4d5e9){try{utils[_0xe593('0x17')](util[_0xe593('0x4')]('[%s][agents][agentcalled]',_0xa4d5e9[_0xe593('0x14')]),_0xa4d5e9);agents[_0xa4d5e9[_0xe593('0x15')]]=_0xa4d5e9;agents[_0xa4d5e9['destuniqueid']][_0xe593('0x18')]=utils[_0xe593('0x19')]();agents[_0xa4d5e9['destuniqueid']][_0xe593('0xc')]=_0xe593('0x1a');agents[_0xa4d5e9[_0xe593('0x15')]][_0xe593('0xb')]=null;agents[_0xa4d5e9[_0xe593('0x15')]][_0xe593('0x1b')]=null;utils['info'](util[_0xe593('0x4')](_0xe593('0x1c'),_0xa4d5e9['uniqueid'],agents[_0xa4d5e9[_0xe593('0x15')]][_0xe593('0x8')],_0xa4d5e9['destuniqueid']));}catch(_0x1c94aa){utils[_0xe593('0x1d')](util[_0xe593('0x4')](_0xe593('0x1e'),_0xa4d5e9[_0xe593('0x14')]),_0x1c94aa);}};exports[_0xe593('0x1f')]=function(_0x3d2a51){try{if(!_['isNil'](agents[_0x3d2a51['destuniqueid']])){utils[_0xe593('0x17')](util['format']('[%s][agents][agentringnoanswer]',_0x3d2a51[_0xe593('0x14')]),_0x3d2a51);utils[_0xe593('0x3')](util['format'](_0xe593('0x20'),_0x3d2a51['uniqueid'],agents[_0x3d2a51[_0xe593('0x15')]][_0xe593('0x8')],_0x3d2a51[_0xe593('0x15')]));agents[_0x3d2a51[_0xe593('0x15')]][_0xe593('0x1f')]=!![];agents[_0x3d2a51[_0xe593('0x15')]][_0xe593('0x21')]=utils[_0xe593('0x19')]();agents[_0x3d2a51['destuniqueid']][_0xe593('0xc')]=_0xe593('0x22');agents[_0x3d2a51['destuniqueid']]['reason']=_0xe593('0x22');agents[_0x3d2a51[_0xe593('0x15')]][_0xe593('0x23')]=_0x3d2a51[_0xe593('0x24')]?parseInt(_0x3d2a51[_0xe593('0x24')])/0x3e8:0x0;agents[_0x3d2a51[_0xe593('0x15')]]['talktime']=0x0;unanswered[_0xe593('0x25')](_0x3d2a51['destuniqueid']);}}catch(_0x1dacf6){utils[_0xe593('0x1d')](util['format'](_0xe593('0x26'),_0x3d2a51['uniqueid']),_0x1dacf6);}};exports[_0xe593('0x27')]=function(_0x1c147b){try{_[_0xe593('0x28')](agents,function(_0x501e54,_0x1ae8d9){if(_0x501e54[_0xe593('0x14')]==_0x1c147b[_0xe593('0x14')]&&!_[_0xe593('0x29')](unanswered,_0x501e54[_0xe593('0x15')])){utils[_0xe593('0x17')](util[_0xe593('0x4')]('[%s][agents][queuecallerabandon]',_0x1c147b[_0xe593('0x14')]),_0x1c147b);utils[_0xe593('0x3')](util['format'](_0xe593('0x2a'),_0x1c147b['uniqueid'],_0x501e54[_0xe593('0x8')],_0x501e54[_0xe593('0x15')]));_0x501e54[_0xe593('0x1f')]=!![];_0x501e54[_0xe593('0x21')]=utils[_0xe593('0x19')]();_0x501e54[_0xe593('0xc')]=_0xe593('0x2b');_0x501e54[_0xe593('0x2c')]=_0xe593('0x2b');_0x501e54[_0xe593('0x23')]=_0x1c147b['holdtime'];_0x501e54[_0xe593('0x2d')]=0x0;writeDB(_0x501e54);}});}catch(_0x2c0a30){utils[_0xe593('0x1d')](util['format']('[%s][agents][queuecallerabandon]',_0x1c147b[_0xe593('0x14')]),_0x2c0a30);}};exports['agentconnect']=function(_0x232bf1){try{if(agents[_0x232bf1[_0xe593('0x15')]]){utils[_0xe593('0x17')](util[_0xe593('0x4')](_0xe593('0x2e'),_0x232bf1[_0xe593('0x14')]),_0x232bf1);utils[_0xe593('0x3')](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x232bf1[_0xe593('0x14')],agents[_0x232bf1['destuniqueid']][_0xe593('0x8')],_0x232bf1['destuniqueid']));agents[_0x232bf1[_0xe593('0x15')]]['agentconnectAt']=utils['now']();agents[_0x232bf1[_0xe593('0x15')]][_0xe593('0xb')]=_0x232bf1[_0xe593('0xb')];agents[_0x232bf1['destuniqueid']]['connectedlinename']=_0x232bf1['connectedlinename'];agents[_0x232bf1[_0xe593('0x15')]]['holdtime']=_0x232bf1[_0xe593('0x24')];agents[_0x232bf1[_0xe593('0x15')]][_0xe593('0xc')]=_0xe593('0x2f');_['forIn'](agents,function(_0x196325,_0x53ed3c){if(_0x196325[_0xe593('0x15')]!=_0x232bf1['destuniqueid']&&_0x196325['uniqueid']==_0x232bf1['uniqueid']){_0x196325[_0xe593('0x2d')]=0x0;_0x196325['holdtime']=_0x232bf1[_0xe593('0x24')];_0x196325[_0xe593('0x1f')]=!![];_0x196325[_0xe593('0x21')]=utils['now']();_0x196325[_0xe593('0xc')]=_0xe593('0x30');_0x196325[_0xe593('0x2c')]=_0xe593('0x30');_0x196325[_0xe593('0x31')]=_0x232bf1[_0xe593('0x15')];_0x196325[_0xe593('0x32')]=_0x232bf1[_0xe593('0x8')];writeDB(_0x196325);}});}}catch(_0x4b36e1){utils[_0xe593('0x1d')](util[_0xe593('0x4')](_0xe593('0x2e'),_0x232bf1[_0xe593('0x14')]),_0x4b36e1);}};exports[_0xe593('0x33')]=function(_0x4d3018){try{if(!_['isNil'](agents[_0x4d3018[_0xe593('0x15')]])){utils[_0xe593('0x17')](util[_0xe593('0x4')]('[%s][agents][agentcomplete]',_0x4d3018[_0xe593('0x14')]),_0x4d3018);utils[_0xe593('0x3')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x4d3018[_0xe593('0x14')],agents[_0x4d3018[_0xe593('0x15')]][_0xe593('0x8')],_0x4d3018['destuniqueid']));agents[_0x4d3018[_0xe593('0x15')]][_0xe593('0x33')]=!![];agents[_0x4d3018[_0xe593('0x15')]][_0xe593('0x34')]=utils['now']();agents[_0x4d3018['destuniqueid']]['talktime']=utils['diffTime'](agents[_0x4d3018[_0xe593('0x15')]]['agentcompleteAt'],agents[_0x4d3018[_0xe593('0x15')]][_0xe593('0x35')]);agents[_0x4d3018[_0xe593('0x15')]][_0xe593('0x2c')]=_0x4d3018[_0xe593('0x2c')];agents[_0x4d3018[_0xe593('0x15')]][_0xe593('0xc')]=_0xe593('0x36');writeDB(agents[_0x4d3018['destuniqueid']]);}}catch(_0x3dbb46){utils[_0xe593('0x1d')](util[_0xe593('0x4')]('[%s][agents][agentcomplete]',_0x4d3018[_0xe593('0x14')]),_0x3dbb46);}};exports['blindtransfer']=function(_0x39ec9e){try{if(!_[_0xe593('0x37')](agents[_0x39ec9e[_0xe593('0x38')]])){utils['debug'](util['format'](_0xe593('0x39'),_0x39ec9e[_0xe593('0x14')]),_0x39ec9e);utils['info'](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x39ec9e['uniqueid'],agents[_0x39ec9e['transfereruniqueid']][_0xe593('0x8')],agents[_0x39ec9e[_0xe593('0x38')]][_0xe593('0x14')]));agents[_0x39ec9e[_0xe593('0x38')]][_0xe593('0x3a')]=!![];agents[_0x39ec9e[_0xe593('0x38')]][_0xe593('0x3b')]=_0xe593('0x3c');agents[_0x39ec9e[_0xe593('0x38')]][_0xe593('0x3d')]=_0x39ec9e[_0xe593('0x3e')];agents[_0x39ec9e[_0xe593('0x38')]][_0xe593('0x3f')]=agents[_0x39ec9e[_0xe593('0x38')]][_0xe593('0x14')];}}catch(_0x46544d){utils['error'](util[_0xe593('0x4')](_0xe593('0x39'),_0x39ec9e[_0xe593('0x14')]),_0x46544d);}};exports[_0xe593('0x40')]=function(_0x1204d8){try{utils[_0xe593('0x17')](util[_0xe593('0x4')](_0xe593('0x41'),_0x1204d8[_0xe593('0x42')]),_0x1204d8);if(_0x1204d8[_0xe593('0x42')]==_0x1204d8[_0xe593('0x43')]){if(!_[_0xe593('0x37')](agents[_0x1204d8[_0xe593('0x44')]])){utils[_0xe593('0x3')](util[_0xe593('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x1204d8[_0xe593('0x42')],agents[_0x1204d8[_0xe593('0x44')]][_0xe593('0x8')]));agents[_0x1204d8[_0xe593('0x44')]][_0xe593('0x3a')]=!![];agents[_0x1204d8['secondtransfereruniqueid']]['transfertype']=_0xe593('0x45');agents[_0x1204d8[_0xe593('0x44')]][_0xe593('0x3d')]=_0x1204d8[_0xe593('0x46')];agents[_0x1204d8[_0xe593('0x44')]][_0xe593('0x3f')]=_0x1204d8[_0xe593('0x42')];}if(_0x1204d8['transfereeuniqueid']&&agents[_0x1204d8['transfereeuniqueid']]){agents[_0x1204d8[_0xe593('0x47')]][_0xe593('0x48')]=0x1;transfers[_0x1204d8['transfereeuniqueid']]=_[_0xe593('0x49')](agents[_0x1204d8[_0xe593('0x47')]]);transfers[_0x1204d8[_0xe593('0x47')]][_0xe593('0xa')]=agents[_0x1204d8[_0xe593('0x44')]][_0xe593('0xa')];transfers[_0x1204d8[_0xe593('0x47')]][_0xe593('0x4a')]=agents[_0x1204d8[_0xe593('0x44')]][_0xe593('0x4a')];transfers[_0x1204d8['transfereeuniqueid']][_0xe593('0x18')]=utils[_0xe593('0x19')]();transfers[_0x1204d8[_0xe593('0x47')]][_0xe593('0x35')]=utils[_0xe593('0x19')]();transfers[_0x1204d8[_0xe593('0x47')]][_0xe593('0x23')]=0x0;transfers[_0x1204d8['transfereeuniqueid']][_0xe593('0x48')]=0x2;}}else if(_0x1204d8[_0xe593('0x44')]==_0x1204d8[_0xe593('0x4b')]){if(!_[_0xe593('0x37')](agents[_0x1204d8['origtransfereruniqueid']])){utils[_0xe593('0x3')](util[_0xe593('0x4')](_0xe593('0x4c'),_0x1204d8[_0xe593('0x42')],agents[_0x1204d8[_0xe593('0x42')]]['membername']));agents[_0x1204d8[_0xe593('0x42')]][_0xe593('0x3a')]=!![];agents[_0x1204d8[_0xe593('0x42')]][_0xe593('0x3b')]=_0xe593('0x45');agents[_0x1204d8[_0xe593('0x42')]][_0xe593('0x3d')]=_0x1204d8[_0xe593('0x4d')];agents[_0x1204d8['origtransfereruniqueid']][_0xe593('0x3f')]=_0x1204d8[_0xe593('0x44')];}if(_0x1204d8[_0xe593('0x4e')]&&agents[_0x1204d8[_0xe593('0x4e')]]){agents[_0x1204d8[_0xe593('0x4e')]][_0xe593('0x48')]=0x1;transfers[_0x1204d8[_0xe593('0x4e')]]=_[_0xe593('0x49')](agents[_0x1204d8[_0xe593('0x4e')]]);transfers[_0x1204d8[_0xe593('0x4e')]]['calleridnum']=agents[_0x1204d8[_0xe593('0x42')]][_0xe593('0xa')];transfers[_0x1204d8[_0xe593('0x4e')]]['calleridname']=agents[_0x1204d8[_0xe593('0x42')]][_0xe593('0x4a')];transfers[_0x1204d8[_0xe593('0x4e')]][_0xe593('0x18')]=utils[_0xe593('0x19')]();transfers[_0x1204d8['transfertargetuniqueid']][_0xe593('0x35')]=utils[_0xe593('0x19')]();transfers[_0x1204d8['transfertargetuniqueid']][_0xe593('0x23')]=0x0;transfers[_0x1204d8[_0xe593('0x4e')]][_0xe593('0x48')]=0x2;}}}catch(_0x3486b3){utils['error'](util[_0xe593('0x4')](_0xe593('0x41'),_0x1204d8[_0xe593('0x42')]),_0x3486b3);}};exports['hangup']=function(_0x43dcb0){try{utils[_0xe593('0x17')](util[_0xe593('0x4')]('[%s][agents][hangup]',_0x43dcb0[_0xe593('0x14')]),_0x43dcb0);if(agents[_0x43dcb0[_0xe593('0x14')]]&&agents[_0x43dcb0[_0xe593('0x14')]][_0xe593('0x2c')]===_0xe593('0x22')){if(_0x43dcb0['cause']==='21'){agents[_0x43dcb0[_0xe593('0x14')]][_0xe593('0x2c')]=_0xe593('0x4f');agents[_0x43dcb0[_0xe593('0x14')]][_0xe593('0xc')]=_0xe593('0x4f');}utils[_0xe593('0x3')](util[_0xe593('0x4')](_0xe593('0x50'),_0x43dcb0[_0xe593('0x14')],agents[_0x43dcb0[_0xe593('0x14')]][_0xe593('0x8')],agents[_0x43dcb0[_0xe593('0x14')]][_0xe593('0x2c')],agents[_0x43dcb0['uniqueid']][_0xe593('0xc')]));writeDB(agents[_0x43dcb0[_0xe593('0x14')]]);var _0x9427d6=unanswered[_0xe593('0x51')](_0x43dcb0[_0xe593('0x14')]);if(_0x9427d6>-0x1){unanswered[_0xe593('0x52')](_0x9427d6,0x1);}}if(transfers[_0x43dcb0[_0xe593('0x14')]]){transfers[_0x43dcb0[_0xe593('0x14')]]['agentcomplete']=!![];transfers[_0x43dcb0['uniqueid']]['agentcompleteAt']=utils[_0xe593('0x19')]();transfers[_0x43dcb0[_0xe593('0x14')]][_0xe593('0x2d')]=utils['diffTime'](transfers[_0x43dcb0['uniqueid']][_0xe593('0x34')],transfers[_0x43dcb0['uniqueid']][_0xe593('0x35')]);transfers[_0x43dcb0[_0xe593('0x14')]][_0xe593('0x2c')]='agent';transfers[_0x43dcb0[_0xe593('0x14')]][_0xe593('0xc')]=_0xe593('0x36');utils[_0xe593('0x3')](util[_0xe593('0x4')](_0xe593('0x50'),_0x43dcb0[_0xe593('0x14')],transfers[_0x43dcb0['uniqueid']][_0xe593('0x8')],transfers[_0x43dcb0[_0xe593('0x14')]]['reason'],transfers[_0x43dcb0[_0xe593('0x14')]][_0xe593('0xc')]));writeDB(transfers[_0x43dcb0[_0xe593('0x14')]],!![]);}if(agents[_0x43dcb0['uniqueid']]&&agents[_0x43dcb0[_0xe593('0x14')]][_0xe593('0x35')]){agents[_0x43dcb0[_0xe593('0x14')]][_0xe593('0x33')]=!![];agents[_0x43dcb0[_0xe593('0x14')]][_0xe593('0x34')]=utils['now']();agents[_0x43dcb0['uniqueid']][_0xe593('0x2d')]=utils['diffTime'](agents[_0x43dcb0['uniqueid']]['agentcompleteAt'],agents[_0x43dcb0[_0xe593('0x14')]][_0xe593('0x35')]);agents[_0x43dcb0[_0xe593('0x14')]][_0xe593('0x2c')]=agents[_0x43dcb0[_0xe593('0x14')]]['transfer']?'transfer':_0xe593('0x53');agents[_0x43dcb0[_0xe593('0x14')]][_0xe593('0xc')]=_0xe593('0x36');utils['info'](util[_0xe593('0x4')](_0xe593('0x50'),_0x43dcb0[_0xe593('0x14')],agents[_0x43dcb0['uniqueid']][_0xe593('0x8')],agents[_0x43dcb0[_0xe593('0x14')]]['reason'],agents[_0x43dcb0[_0xe593('0x14')]][_0xe593('0xc')]));writeDB(agents[_0x43dcb0['uniqueid']]);}}catch(_0x5bb9e2){utils['error'](util['format']('[%s][agents][hangup]',_0x43dcb0['uniqueid']),_0x5bb9e2);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 56d3aa9..eab8d10 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 _0xa965=['xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','xmd-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','includes','noop','execif','gotoif','[%s][calls][newexten]','./transfers.controller','NO\x20ANSWER','FAILED','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','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','ANSWERED','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','duration','diffTime','endtime','starttime','billableseconds','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','transfertargetchannel','origtransfererchannel','userfield','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa965,0x172));var _0x5a96=function(_0x279ce4,_0x13a3c8){_0x279ce4=_0x279ce4-0x0;var _0x3e8bcd=_0xa965[_0x279ce4];return _0x3e8bcd;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var transfers=require(_0x5a96('0x0'));var dispositions=[_0x5a96('0x1'),_0x5a96('0x2'),_0x5a96('0x2'),'NO\x20ANSWER','NO\x20ANSWER',_0x5a96('0x1'),'ANSWERED',_0x5a96('0x3'),_0x5a96('0x2'),_0x5a96('0x2'),_0x5a96('0x2')];var channels={};function writeDB(_0x560592){var _0x10d530;if(transfers[_0x5a96('0x4')][_0x560592[_0x5a96('0x5')]]){_0x10d530=_0x560592[_0x5a96('0x5')];_0x560592['uniqueid']=transfers[_0x5a96('0x4')][_0x560592[_0x5a96('0x5')]][_0x5a96('0x6')];}utils['info'](util[_0x5a96('0x7')](_0x5a96('0x8'),_0x560592[_0x5a96('0x5')],_0x560592[_0x5a96('0x9')],_0x560592[_0x5a96('0xa')],_0x560592[_0x5a96('0xb')],_0x560592[_0x5a96('0xc')],_0x560592[_0x5a96('0xd')],_0x560592[_0x5a96('0xe')],_0x560592[_0x5a96('0xf')]));if(_0x560592[_0x5a96('0x10')]){utils[_0x5a96('0x11')](_0x560592[_0x5a96('0x10')])[_0x5a96('0x12')](function(_0x33a156){if(_0x33a156){_0x560592[_0x5a96('0x13')]=_0x33a156['id'];}utils[_0x5a96('0x14')](_0x5a96('0x15'),_0x560592);});}else{utils['request'](_0x5a96('0x15'),_0x560592);}if(channels[_0x560592[_0x5a96('0x5')]]){delete channels[_0x560592['uniqueid']];}else if(_0x10d530&&channels[_0x10d530]){if(!transfers[_0x5a96('0x4')][_0x10d530][_0x5a96('0x16')])delete transfers[_0x5a96('0x4')][_0x10d530];delete channels[_0x10d530];}}exports[_0x5a96('0x17')]=function(_0x31e785){try{utils[_0x5a96('0x18')](util[_0x5a96('0x7')](_0x5a96('0x19'),_0x31e785['uniqueid']),_0x31e785);if(_0x31e785[_0x5a96('0x5')]==_0x31e785[_0x5a96('0x1a')]&&_0x31e785[_0x5a96('0x9')]!='OutgoingSpoolFailed'){utils[_0x5a96('0x1b')](util[_0x5a96('0x7')](_0x5a96('0x1c'),_0x31e785[_0x5a96('0x5')],_0x31e785['context'],_0x31e785['exten']));channels[_0x31e785['uniqueid']]={'uniqueid':_0x31e785[_0x5a96('0x5')],'accountcode':_0x31e785[_0x5a96('0x10')],'source':_0x31e785[_0x5a96('0xd')],'destination':_0x31e785[_0x5a96('0x1d')],'destinationcontext':_0x31e785[_0x5a96('0x1e')],'channel':_0x31e785[_0x5a96('0x9')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x5a96('0x1'),'amaflags':_0x5a96('0x1f')};}}catch(_0x53508b){utils[_0x5a96('0x20')](util[_0x5a96('0x7')](_0x5a96('0x19'),_0x31e785[_0x5a96('0x5')]),_0x53508b);}};exports[_0x5a96('0x21')]=function(_0x5c16af){try{utils[_0x5a96('0x18')](util[_0x5a96('0x7')](_0x5a96('0x22'),_0x5c16af[_0x5a96('0x5')]),_0x5c16af);if(!_[_0x5a96('0x23')](channels[_0x5c16af[_0x5a96('0x5')]])&&_0x5c16af[_0x5a96('0x24')]==0x6){utils[_0x5a96('0x1b')](util[_0x5a96('0x7')](_0x5a96('0x25'),_0x5c16af[_0x5a96('0x5')],_0x5c16af[_0x5a96('0x1e')],_0x5c16af[_0x5a96('0x9')]));if(_[_0x5a96('0x23')](channels[_0x5c16af['uniqueid']][_0x5a96('0x26')])){channels[_0x5c16af['uniqueid']][_0x5a96('0x26')]=utils[_0x5a96('0x27')]();}}else if(!_[_0x5a96('0x23')](channels[_0x5c16af[_0x5a96('0x1a')]])&&_0x5c16af[_0x5a96('0x24')]==0x6&&_0x5c16af[_0x5a96('0x1e')]!=_0x5a96('0x28')){utils[_0x5a96('0x1b')](util[_0x5a96('0x7')](_0x5a96('0x29'),_0x5c16af[_0x5a96('0x5')],_0x5c16af[_0x5a96('0x1a')],_0x5c16af['context'],_0x5c16af[_0x5a96('0x9')]));channels[_0x5c16af[_0x5a96('0x1a')]]['accountcode']=_0x5c16af['accountcode'];channels[_0x5c16af[_0x5a96('0x1a')]][_0x5a96('0x2a')]=_0x5c16af[_0x5a96('0x9')];if(_[_0x5a96('0x23')](channels[_0x5c16af['linkedid']]['answertime'])){channels[_0x5c16af['linkedid']][_0x5a96('0x2b')]=utils[_0x5a96('0x27')]();}channels[_0x5c16af['linkedid']][_0x5a96('0x2c')]=dispositions[_[_0x5a96('0x2d')](_0x5c16af['channelstate'])]||_0x5a96('0x2e');}}catch(_0x362b08){utils['error'](util[_0x5a96('0x7')]('[%s][calls][newstate]',_0x5c16af[_0x5a96('0x5')]),_0x362b08);}};exports['hangup']=function(_0x54e81f){try{if(!_[_0x5a96('0x23')](channels[_0x54e81f[_0x5a96('0x5')]])){utils['debug'](util[_0x5a96('0x7')](_0x5a96('0x2f'),_0x54e81f[_0x5a96('0x5')]),_0x54e81f);if(_['isNil'](channels[_0x54e81f[_0x5a96('0x5')]][_0x5a96('0x30')])){channels[_0x54e81f[_0x5a96('0x5')]][_0x5a96('0x30')]=_0x54e81f['calleridname']+'\x20<'+_0x54e81f[_0x5a96('0xd')]+'>';}utils[_0x5a96('0x1b')](util[_0x5a96('0x7')](_0x5a96('0x31'),_0x54e81f[_0x5a96('0x5')],channels[_0x54e81f[_0x5a96('0x5')]][_0x5a96('0x30')],_0x54e81f['cause-txt']));channels[_0x54e81f['uniqueid']]['endtime']=utils[_0x5a96('0x27')]();channels[_0x54e81f[_0x5a96('0x5')]][_0x5a96('0x32')]=utils[_0x5a96('0x33')](channels[_0x54e81f[_0x5a96('0x5')]][_0x5a96('0x34')],channels[_0x54e81f[_0x5a96('0x5')]][_0x5a96('0x35')]);channels[_0x54e81f['uniqueid']][_0x5a96('0x36')]=channels[_0x54e81f[_0x5a96('0x5')]][_0x5a96('0x2b')]?utils['diffTime'](channels[_0x54e81f[_0x5a96('0x5')]]['endtime'],channels[_0x54e81f['uniqueid']][_0x5a96('0x2b')]):0x0;writeDB(channels[_0x54e81f[_0x5a96('0x5')]]);}}catch(_0x5b24cb){utils[_0x5a96('0x20')](util[_0x5a96('0x7')](_0x5a96('0x2f'),_0x54e81f[_0x5a96('0x5')]),_0x5b24cb);}};exports['attendedtransfer']=function(_0x3a2be8){try{if(!_['isNil'](channels[_0x3a2be8['localtwolinkedid']])){utils['debug'](util[_0x5a96('0x7')](_0x5a96('0x37'),_0x3a2be8[_0x5a96('0x38')]),_0x3a2be8);if(channels[_0x3a2be8[_0x5a96('0x39')]]['channel']==_0x3a2be8[_0x5a96('0x3a')]){utils[_0x5a96('0x1b')](util[_0x5a96('0x7')](_0x5a96('0x3b'),_0x3a2be8[_0x5a96('0x38')],_0x3a2be8['localtwolinkedid'],_0x3a2be8[_0x5a96('0x3c')]));channels[_0x3a2be8['localtwolinkedid']][_0x5a96('0x2a')]=_0x3a2be8[_0x5a96('0x3c')];channels[_0x3a2be8[_0x5a96('0x39')]]['userfield']='_attended';}else if(channels[_0x3a2be8[_0x5a96('0x39')]][_0x5a96('0x9')]=_0x3a2be8[_0x5a96('0x3d')]){utils[_0x5a96('0x1b')](util[_0x5a96('0x7')](_0x5a96('0x3b'),_0x3a2be8[_0x5a96('0x38')],_0x3a2be8[_0x5a96('0x39')],_0x3a2be8['origtransfererchannel']));channels[_0x3a2be8[_0x5a96('0x39')]]['destinationchannel']=_0x3a2be8[_0x5a96('0x3e')];channels[_0x3a2be8[_0x5a96('0x39')]][_0x5a96('0x3f')]=_0x5a96('0x40');}}}catch(_0x38e4bc){utils['error'](util['format']('[%s][calls][attendedtransfer]',_0x3a2be8[_0x5a96('0x38')]),_0x38e4bc);}};exports[_0x5a96('0x41')]=function(_0x5bda80){try{if(!_[_0x5a96('0x23')](channels[_0x5bda80[_0x5a96('0x5')]])){utils[_0x5a96('0x18')](util[_0x5a96('0x7')](_0x5a96('0x42'),_0x5bda80[_0x5a96('0x5')]),_0x5bda80);channels[_0x5bda80[_0x5a96('0x5')]][_0x5a96('0x43')]=utils[_0x5a96('0x27')]();utils['info'](util['format'](_0x5a96('0x44'),_0x5bda80[_0x5a96('0x5')],channels[_0x5bda80[_0x5a96('0x5')]][_0x5a96('0x43')]));}}catch(_0x137049){utils[_0x5a96('0x20')](util[_0x5a96('0x7')]('[%s][calls][musiconholdstart]',_0x5bda80[_0x5a96('0x5')]),_0x137049);}};exports[_0x5a96('0x45')]=function(_0x246360){try{if(!_['isNil'](channels[_0x246360[_0x5a96('0x5')]])){utils[_0x5a96('0x18')](util['format'](_0x5a96('0x46'),_0x246360[_0x5a96('0x5')]),_0x246360);if(!_[_0x5a96('0x23')](channels[_0x246360[_0x5a96('0x5')]]['musiconholdstartAt'])){channels[_0x246360[_0x5a96('0x5')]][_0x5a96('0x47')]+=utils[_0x5a96('0x33')](utils[_0x5a96('0x27')](),channels[_0x246360[_0x5a96('0x5')]]['musiconholdstartAt']);utils[_0x5a96('0x1b')](util[_0x5a96('0x7')](_0x5a96('0x48'),_0x246360[_0x5a96('0x5')],channels[_0x246360[_0x5a96('0x5')]]['mohtime']));delete channels[_0x246360['uniqueid']][_0x5a96('0x43')];}}}catch(_0x5ed43f){utils[_0x5a96('0x20')](util[_0x5a96('0x7')](_0x5a96('0x46'),_0x246360[_0x5a96('0x5')]),_0x5ed43f);}};exports[_0x5a96('0x49')]=function(_0x13d9e5){try{if(!_[_0x5a96('0x23')](channels[_0x13d9e5[_0x5a96('0x5')]])){utils[_0x5a96('0x18')](util['format'](_0x5a96('0x4a'),_0x13d9e5[_0x5a96('0x5')]),_0x13d9e5);if(!_[_0x5a96('0x23')](_0x13d9e5[_0x5a96('0x4b')][_0x5a96('0x4c')])){utils[_0x5a96('0x1b')](util[_0x5a96('0x7')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x13d9e5['uniqueid'],_0x13d9e5['value']));channels[_0x13d9e5[_0x5a96('0x5')]]['source']=_0x13d9e5[_0x5a96('0x4d')];}if(!_[_0x5a96('0x23')](_0x13d9e5[_0x5a96('0x4b')][_0x5a96('0x4e')])){utils[_0x5a96('0x1b')](util['format'](_0x5a96('0x4f'),_0x13d9e5['uniqueid'],_0x13d9e5[_0x5a96('0x4d')]));channels[_0x13d9e5[_0x5a96('0x5')]][_0x5a96('0x50')]=_0x13d9e5[_0x5a96('0x4d')];channels[_0x13d9e5[_0x5a96('0x5')]]['callerid']='\x22'+_0x13d9e5['value']+_0x5a96('0x51')+_0x13d9e5[_0x5a96('0x4d')]+'>';}if(!_['isNil'](_0x13d9e5[_0x5a96('0x4b')][_0x5a96('0x52')])||!_[_0x5a96('0x23')](_0x13d9e5[_0x5a96('0x4b')][_0x5a96('0x53')])){utils['info'](util[_0x5a96('0x7')](_0x5a96('0x54'),_0x13d9e5[_0x5a96('0x5')],!_[_0x5a96('0x23')](_0x13d9e5['variable'][_0x5a96('0x52')])?_0x5a96('0x52'):'xmd-callerid',_0x13d9e5[_0x5a96('0x4d')]));channels[_0x13d9e5[_0x5a96('0x5')]]['callerid']=_0x13d9e5['value'];}if(!_['isNil'](_0x13d9e5['variable']['xmd-queue'])||!_[_0x5a96('0x23')](_0x13d9e5[_0x5a96('0x4b')][_0x5a96('0x55')])){utils[_0x5a96('0x1b')](util[_0x5a96('0x7')](_0x5a96('0x54'),_0x13d9e5[_0x5a96('0x5')],!_[_0x5a96('0x23')](_0x13d9e5[_0x5a96('0x4b')][_0x5a96('0x56')])?_0x5a96('0x56'):'xmcs-queue',_0x13d9e5[_0x5a96('0x4d')]));channels[_0x13d9e5[_0x5a96('0x5')]][_0x5a96('0x57')]=_0x5a96('0x58');channels[_0x13d9e5[_0x5a96('0x5')]][_0x5a96('0x59')]=_0x13d9e5[_0x5a96('0x4d')];channels[_0x13d9e5[_0x5a96('0x5')]][_0x5a96('0xa')]=!![];}if(!_['isNil'](_0x13d9e5[_0x5a96('0x4b')][_0x5a96('0x5a')])){utils[_0x5a96('0x1b')](util[_0x5a96('0x7')](_0x5a96('0x5b'),_0x13d9e5['uniqueid'],_0x13d9e5[_0x5a96('0x4d')]));channels[_0x13d9e5[_0x5a96('0x5')]]['ContactId']=_0x13d9e5[_0x5a96('0x4d')];}if(!_[_0x5a96('0x23')](_0x13d9e5[_0x5a96('0x4b')][_0x5a96('0x5c')])){utils[_0x5a96('0x1b')](util[_0x5a96('0x7')](_0x5a96('0x5d'),_0x13d9e5['uniqueid'],_0x13d9e5[_0x5a96('0x4d')]));channels[_0x13d9e5['uniqueid']][_0x5a96('0x5e')]=_0x13d9e5[_0x5a96('0x4d')];}if(!_[_0x5a96('0x23')](_0x13d9e5[_0x5a96('0x4b')][_0x5a96('0x5f')])){utils['info'](util[_0x5a96('0x7')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x13d9e5[_0x5a96('0x5')],_0x13d9e5['value']));channels[_0x13d9e5[_0x5a96('0x5')]][_0x5a96('0x60')]=_0x13d9e5[_0x5a96('0x4d')];}if(!_['isNil'](_0x13d9e5[_0x5a96('0x4b')][_0x5a96('0x61')])){utils[_0x5a96('0x1b')](util['format'](_0x5a96('0x62'),_0x13d9e5[_0x5a96('0x5')],_0x13d9e5[_0x5a96('0x4d')]));channels[_0x13d9e5[_0x5a96('0x5')]][_0x5a96('0x61')]=_0x13d9e5[_0x5a96('0x4d')];}}}catch(_0x114744){utils[_0x5a96('0x20')](util[_0x5a96('0x7')](_0x5a96('0x4a'),_0x13d9e5[_0x5a96('0x5')]),_0x114744);}};exports[_0x5a96('0x63')]=function(_0x356b36){try{if(!_[_0x5a96('0x23')](channels[_0x356b36[_0x5a96('0x5')]])){utils[_0x5a96('0x18')](util[_0x5a96('0x7')]('[%s][calls][newexten]',_0x356b36[_0x5a96('0x5')]),_0x356b36);utils[_0x5a96('0x1b')](util[_0x5a96('0x7')](_0x5a96('0x64'),_0x356b36[_0x5a96('0x5')],_0x356b36[_0x5a96('0x65')],_0x356b36[_0x5a96('0x66')]));if(_0x356b36[_0x5a96('0x65')][_0x5a96('0x67')]()==_0x5a96('0x68')&&_[_0x5a96('0x69')](_0x356b36[_0x5a96('0x66')][_0x5a96('0x67')](),'cdr')){var _0x22f408=_0x356b36['appdata'][_0x5a96('0x6a')]('=');var _0x2aa9fe=_0x22f408[0x0]['substring'](_0x22f408[0x0]['lastIndexOf']('(')+0x1,_0x22f408[0x0]['lastIndexOf'](')'));var _0x477cab=_0x22f408[0x1];channels[_0x356b36[_0x5a96('0x5')]][_0x2aa9fe]=_0x477cab;}if(!_[_0x5a96('0x6b')](['hangup',_0x5a96('0x6c'),_0x5a96('0x6d'),_0x5a96('0x68'),_0x5a96('0x6e')],_0x356b36[_0x5a96('0x65')]['toLowerCase']())){channels[_0x356b36['uniqueid']][_0x5a96('0x57')]=_0x356b36['application'];channels[_0x356b36[_0x5a96('0x5')]]['lastdata']=_0x356b36[_0x5a96('0x66')];}}}catch(_0xa91fe1){utils[_0x5a96('0x20')](util[_0x5a96('0x7')](_0x5a96('0x6f'),_0x356b36[_0x5a96('0x5')]),_0xa91fe1);}}; \ No newline at end of file +var _0x2e65=['[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime','billableseconds','error','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','variable','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','includes','noop','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','lastevent','accountcode','then','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','linkedid','OutgoingSpoolFailed','format','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','calleridnum','context','[%s][calls][newchannel]','newstate','isNil','channelstate','info'];(function(_0x14c0e0,_0x3ad847){var _0x4cbd72=function(_0x401e2e){while(--_0x401e2e){_0x14c0e0['push'](_0x14c0e0['shift']());}};_0x4cbd72(++_0x3ad847);}(_0x2e65,0x193));var _0x52e6=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x2e65[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0x52e6('0x0'));var util=require(_0x52e6('0x1'));var utils=require(_0x52e6('0x2'));var transfers=require(_0x52e6('0x3'));var dispositions=[_0x52e6('0x4'),_0x52e6('0x5'),_0x52e6('0x5'),_0x52e6('0x4'),'NO\x20ANSWER',_0x52e6('0x4'),_0x52e6('0x6'),_0x52e6('0x7'),_0x52e6('0x5'),_0x52e6('0x5'),_0x52e6('0x5')];var channels={};function writeDB(_0x15e4af){var _0x1401a3;if(transfers[_0x52e6('0x8')][_0x15e4af[_0x52e6('0x9')]]){_0x1401a3=_0x15e4af['uniqueid'];_0x15e4af[_0x52e6('0x9')]=transfers[_0x52e6('0x8')][_0x15e4af['uniqueid']][_0x52e6('0xa')];}utils['info'](util['format'](_0x52e6('0xb'),_0x15e4af[_0x52e6('0x9')],_0x15e4af[_0x52e6('0xc')],_0x15e4af[_0x52e6('0xd')],_0x15e4af[_0x52e6('0xe')],_0x15e4af[_0x52e6('0xf')],_0x15e4af['calleridnum'],_0x15e4af['connectedlinenum'],_0x15e4af[_0x52e6('0x10')]));if(_0x15e4af[_0x52e6('0x11')]){utils['getUserByInternal'](_0x15e4af[_0x52e6('0x11')])[_0x52e6('0x12')](function(_0x4362e3){if(_0x4362e3){_0x15e4af[_0x52e6('0x13')]=_0x4362e3['id'];}utils[_0x52e6('0x14')](_0x52e6('0x15'),_0x15e4af);});}else{utils[_0x52e6('0x14')](_0x52e6('0x15'),_0x15e4af);}if(channels[_0x15e4af[_0x52e6('0x9')]]){delete channels[_0x15e4af[_0x52e6('0x9')]];}else if(_0x1401a3&&channels[_0x1401a3]){if(!transfers[_0x52e6('0x8')][_0x1401a3][_0x52e6('0x16')])delete transfers[_0x52e6('0x8')][_0x1401a3];delete channels[_0x1401a3];}}exports[_0x52e6('0x17')]=function(_0x5afe24){try{utils[_0x52e6('0x18')](util['format']('[%s][calls][newchannel]',_0x5afe24[_0x52e6('0x9')]),_0x5afe24);if(_0x5afe24[_0x52e6('0x9')]==_0x5afe24[_0x52e6('0x19')]&&_0x5afe24['channel']!=_0x52e6('0x1a')){utils['info'](util[_0x52e6('0x1b')](_0x52e6('0x1c'),_0x5afe24[_0x52e6('0x9')],_0x5afe24['context'],_0x5afe24[_0x52e6('0x1d')]));channels[_0x5afe24['uniqueid']]={'uniqueid':_0x5afe24[_0x52e6('0x9')],'accountcode':_0x5afe24[_0x52e6('0x11')],'source':_0x5afe24[_0x52e6('0x1e')],'destination':_0x5afe24['exten'],'destinationcontext':_0x5afe24[_0x52e6('0x1f')],'channel':_0x5afe24[_0x52e6('0xc')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x35d4b7){utils['error'](util[_0x52e6('0x1b')](_0x52e6('0x20'),_0x5afe24[_0x52e6('0x9')]),_0x35d4b7);}};exports[_0x52e6('0x21')]=function(_0x73e1f9){try{utils['debug'](util[_0x52e6('0x1b')]('[%s][calls][newstate]',_0x73e1f9[_0x52e6('0x9')]),_0x73e1f9);if(!_[_0x52e6('0x22')](channels[_0x73e1f9[_0x52e6('0x9')]])&&_0x73e1f9[_0x52e6('0x23')]==0x6){utils[_0x52e6('0x24')](util[_0x52e6('0x1b')](_0x52e6('0x25'),_0x73e1f9[_0x52e6('0x9')],_0x73e1f9[_0x52e6('0x1f')],_0x73e1f9[_0x52e6('0xc')]));if(_['isNil'](channels[_0x73e1f9[_0x52e6('0x9')]][_0x52e6('0x26')])){channels[_0x73e1f9[_0x52e6('0x9')]][_0x52e6('0x26')]=utils[_0x52e6('0x27')]();}}else if(!_[_0x52e6('0x22')](channels[_0x73e1f9[_0x52e6('0x19')]])&&_0x73e1f9['channelstate']==0x6&&_0x73e1f9['context']!=_0x52e6('0x28')){utils[_0x52e6('0x24')](util[_0x52e6('0x1b')](_0x52e6('0x29'),_0x73e1f9[_0x52e6('0x9')],_0x73e1f9['linkedid'],_0x73e1f9['context'],_0x73e1f9[_0x52e6('0xc')]));channels[_0x73e1f9[_0x52e6('0x19')]][_0x52e6('0x11')]=_0x73e1f9[_0x52e6('0x11')];channels[_0x73e1f9[_0x52e6('0x19')]]['destinationchannel']=_0x73e1f9[_0x52e6('0xc')];if(_[_0x52e6('0x22')](channels[_0x73e1f9['linkedid']][_0x52e6('0x2a')])){channels[_0x73e1f9[_0x52e6('0x19')]][_0x52e6('0x2a')]=utils[_0x52e6('0x27')]();}channels[_0x73e1f9['linkedid']][_0x52e6('0x2b')]=dispositions[_[_0x52e6('0x2c')](_0x73e1f9['channelstate'])]||_0x52e6('0x6');}}catch(_0x46c350){utils['error'](util['format'](_0x52e6('0x2d'),_0x73e1f9[_0x52e6('0x9')]),_0x46c350);}};exports[_0x52e6('0x2e')]=function(_0x5ee1cf){try{if(!_[_0x52e6('0x22')](channels[_0x5ee1cf[_0x52e6('0x9')]])){utils[_0x52e6('0x18')](util[_0x52e6('0x1b')](_0x52e6('0x2f'),_0x5ee1cf[_0x52e6('0x9')]),_0x5ee1cf);if(_['isNil'](channels[_0x5ee1cf[_0x52e6('0x9')]][_0x52e6('0x30')])){channels[_0x5ee1cf['uniqueid']][_0x52e6('0x30')]=_0x5ee1cf[_0x52e6('0x31')]+'\x20<'+_0x5ee1cf[_0x52e6('0x1e')]+'>';}utils['info'](util[_0x52e6('0x1b')](_0x52e6('0x32'),_0x5ee1cf['uniqueid'],channels[_0x5ee1cf[_0x52e6('0x9')]][_0x52e6('0x30')],_0x5ee1cf[_0x52e6('0x33')]));channels[_0x5ee1cf[_0x52e6('0x9')]][_0x52e6('0x34')]=utils[_0x52e6('0x27')]();channels[_0x5ee1cf[_0x52e6('0x9')]]['duration']=utils[_0x52e6('0x35')](channels[_0x5ee1cf['uniqueid']][_0x52e6('0x34')],channels[_0x5ee1cf['uniqueid']][_0x52e6('0x36')]);channels[_0x5ee1cf[_0x52e6('0x9')]][_0x52e6('0x37')]=channels[_0x5ee1cf[_0x52e6('0x9')]][_0x52e6('0x2a')]?utils['diffTime'](channels[_0x5ee1cf[_0x52e6('0x9')]][_0x52e6('0x34')],channels[_0x5ee1cf['uniqueid']][_0x52e6('0x2a')]):0x0;writeDB(channels[_0x5ee1cf[_0x52e6('0x9')]]);}}catch(_0x498bf2){utils[_0x52e6('0x38')](util[_0x52e6('0x1b')](_0x52e6('0x2f'),_0x5ee1cf[_0x52e6('0x9')]),_0x498bf2);}};exports[_0x52e6('0x39')]=function(_0x4cc2b7){try{if(!_[_0x52e6('0x22')](channels[_0x4cc2b7[_0x52e6('0x3a')]])){utils[_0x52e6('0x18')](util[_0x52e6('0x1b')](_0x52e6('0x3b'),_0x4cc2b7[_0x52e6('0x3c')]),_0x4cc2b7);if(channels[_0x4cc2b7['localtwolinkedid']][_0x52e6('0xc')]==_0x4cc2b7[_0x52e6('0x3d')]){utils[_0x52e6('0x24')](util[_0x52e6('0x1b')](_0x52e6('0x3e'),_0x4cc2b7[_0x52e6('0x3c')],_0x4cc2b7[_0x52e6('0x3a')],_0x4cc2b7[_0x52e6('0x3f')]));channels[_0x4cc2b7[_0x52e6('0x3a')]][_0x52e6('0x40')]=_0x4cc2b7[_0x52e6('0x3f')];channels[_0x4cc2b7[_0x52e6('0x3a')]][_0x52e6('0x41')]=_0x52e6('0x42');}else if(channels[_0x4cc2b7['localtwolinkedid']][_0x52e6('0xc')]=_0x4cc2b7['transfertargetchannel']){utils[_0x52e6('0x24')](util['format'](_0x52e6('0x3e'),_0x4cc2b7[_0x52e6('0x3c')],_0x4cc2b7['localtwolinkedid'],_0x4cc2b7['origtransfererchannel']));channels[_0x4cc2b7[_0x52e6('0x3a')]][_0x52e6('0x40')]=_0x4cc2b7['origtransfererchannel'];channels[_0x4cc2b7['localtwolinkedid']][_0x52e6('0x41')]='_attended';}}}catch(_0x1e882a){utils[_0x52e6('0x38')](util[_0x52e6('0x1b')]('[%s][calls][attendedtransfer]',_0x4cc2b7[_0x52e6('0x3c')]),_0x1e882a);}};exports['musiconholdstart']=function(_0x32bc0e){try{if(!_[_0x52e6('0x22')](channels[_0x32bc0e['uniqueid']])){utils['debug'](util['format'](_0x52e6('0x43'),_0x32bc0e['uniqueid']),_0x32bc0e);channels[_0x32bc0e[_0x52e6('0x9')]][_0x52e6('0x44')]=utils[_0x52e6('0x27')]();utils['info'](util[_0x52e6('0x1b')](_0x52e6('0x45'),_0x32bc0e[_0x52e6('0x9')],channels[_0x32bc0e[_0x52e6('0x9')]]['musiconholdstartAt']));}}catch(_0x881bc){utils[_0x52e6('0x38')](util['format'](_0x52e6('0x43'),_0x32bc0e[_0x52e6('0x9')]),_0x881bc);}};exports['musiconholdstop']=function(_0x1c4307){try{if(!_[_0x52e6('0x22')](channels[_0x1c4307[_0x52e6('0x9')]])){utils[_0x52e6('0x18')](util['format']('[%s][calls][musiconholdstop]',_0x1c4307[_0x52e6('0x9')]),_0x1c4307);if(!_['isNil'](channels[_0x1c4307[_0x52e6('0x9')]][_0x52e6('0x44')])){channels[_0x1c4307[_0x52e6('0x9')]][_0x52e6('0x46')]+=utils[_0x52e6('0x35')](utils[_0x52e6('0x27')](),channels[_0x1c4307['uniqueid']][_0x52e6('0x44')]);utils[_0x52e6('0x24')](util[_0x52e6('0x1b')](_0x52e6('0x47'),_0x1c4307[_0x52e6('0x9')],channels[_0x1c4307[_0x52e6('0x9')]][_0x52e6('0x46')]));delete channels[_0x1c4307[_0x52e6('0x9')]][_0x52e6('0x44')];}}}catch(_0x525239){utils['error'](util[_0x52e6('0x1b')](_0x52e6('0x48'),_0x1c4307[_0x52e6('0x9')]),_0x525239);}};exports[_0x52e6('0x49')]=function(_0x1071e6){try{if(!_[_0x52e6('0x22')](channels[_0x1071e6[_0x52e6('0x9')]])){utils[_0x52e6('0x18')](util[_0x52e6('0x1b')](_0x52e6('0x4a'),_0x1071e6[_0x52e6('0x9')]),_0x1071e6);if(!_[_0x52e6('0x22')](_0x1071e6['variable'][_0x52e6('0x4b')])){utils[_0x52e6('0x24')](util['format'](_0x52e6('0x4c'),_0x1071e6['uniqueid'],_0x1071e6['value']));channels[_0x1071e6[_0x52e6('0x9')]]['source']=_0x1071e6[_0x52e6('0x4d')];}if(!_[_0x52e6('0x22')](_0x1071e6['variable'][_0x52e6('0x4e')])){utils[_0x52e6('0x24')](util['format'](_0x52e6('0x4f'),_0x1071e6[_0x52e6('0x9')],_0x1071e6[_0x52e6('0x4d')]));channels[_0x1071e6['uniqueid']][_0x52e6('0x50')]=_0x1071e6['value'];channels[_0x1071e6[_0x52e6('0x9')]]['callerid']='\x22'+_0x1071e6[_0x52e6('0x4d')]+_0x52e6('0x51')+_0x1071e6[_0x52e6('0x4d')]+'>';}if(!_[_0x52e6('0x22')](_0x1071e6[_0x52e6('0x52')]['xmd-callerid-preview'])||!_[_0x52e6('0x22')](_0x1071e6[_0x52e6('0x52')][_0x52e6('0x53')])){utils['info'](util['format'](_0x52e6('0x54'),_0x1071e6[_0x52e6('0x9')],!_['isNil'](_0x1071e6[_0x52e6('0x52')][_0x52e6('0x55')])?_0x52e6('0x55'):_0x52e6('0x53'),_0x1071e6[_0x52e6('0x4d')]));channels[_0x1071e6[_0x52e6('0x9')]][_0x52e6('0x30')]=_0x1071e6['value'];}if(!_['isNil'](_0x1071e6[_0x52e6('0x52')][_0x52e6('0x56')])||!_[_0x52e6('0x22')](_0x1071e6[_0x52e6('0x52')]['xmcs-queue'])){utils[_0x52e6('0x24')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x1071e6[_0x52e6('0x9')],!_[_0x52e6('0x22')](_0x1071e6[_0x52e6('0x52')][_0x52e6('0x56')])?_0x52e6('0x56'):_0x52e6('0x57'),_0x1071e6['value']));channels[_0x1071e6[_0x52e6('0x9')]][_0x52e6('0x58')]='Queue';channels[_0x1071e6['uniqueid']][_0x52e6('0x59')]=_0x1071e6[_0x52e6('0x4d')];channels[_0x1071e6[_0x52e6('0x9')]][_0x52e6('0xd')]=!![];}if(!_[_0x52e6('0x22')](_0x1071e6['variable'][_0x52e6('0x5a')])){utils[_0x52e6('0x24')](util['format'](_0x52e6('0x5b'),_0x1071e6[_0x52e6('0x9')],_0x1071e6[_0x52e6('0x4d')]));channels[_0x1071e6[_0x52e6('0x9')]]['ContactId']=_0x1071e6[_0x52e6('0x4d')];}if(!_['isNil'](_0x1071e6['variable'][_0x52e6('0x5c')])){utils['info'](util[_0x52e6('0x1b')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x1071e6[_0x52e6('0x9')],_0x1071e6['value']));channels[_0x1071e6[_0x52e6('0x9')]]['type']=_0x1071e6['value'];}if(!_[_0x52e6('0x22')](_0x1071e6[_0x52e6('0x52')]['outboundrouteid'])){utils[_0x52e6('0x24')](util['format']('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x1071e6['uniqueid'],_0x1071e6['value']));channels[_0x1071e6[_0x52e6('0x9')]][_0x52e6('0x5d')]=_0x1071e6[_0x52e6('0x4d')];}if(!_[_0x52e6('0x22')](_0x1071e6[_0x52e6('0x52')][_0x52e6('0x5e')])){utils[_0x52e6('0x24')](util[_0x52e6('0x1b')](_0x52e6('0x5f'),_0x1071e6[_0x52e6('0x9')],_0x1071e6[_0x52e6('0x4d')]));channels[_0x1071e6[_0x52e6('0x9')]]['sipcallid']=_0x1071e6[_0x52e6('0x4d')];}}}catch(_0x36cb18){utils[_0x52e6('0x38')](util[_0x52e6('0x1b')](_0x52e6('0x4a'),_0x1071e6[_0x52e6('0x9')]),_0x36cb18);}};exports[_0x52e6('0x60')]=function(_0x426966){try{if(!_['isNil'](channels[_0x426966[_0x52e6('0x9')]])){utils[_0x52e6('0x18')](util[_0x52e6('0x1b')](_0x52e6('0x61'),_0x426966[_0x52e6('0x9')]),_0x426966);utils[_0x52e6('0x24')](util['format'](_0x52e6('0x62'),_0x426966['uniqueid'],_0x426966[_0x52e6('0x63')],_0x426966[_0x52e6('0x64')]));if(_0x426966[_0x52e6('0x63')][_0x52e6('0x65')]()==_0x52e6('0x66')&&_[_0x52e6('0x67')](_0x426966[_0x52e6('0x64')]['toLowerCase'](),'cdr')){var _0x10e94f=_0x426966['appdata'][_0x52e6('0x68')]('=');var _0x573fac=_0x10e94f[0x0][_0x52e6('0x69')](_0x10e94f[0x0][_0x52e6('0x6a')]('(')+0x1,_0x10e94f[0x0][_0x52e6('0x6a')](')'));var _0x423cfd=_0x10e94f[0x1];channels[_0x426966[_0x52e6('0x9')]][_0x573fac]=_0x423cfd;}if(!_[_0x52e6('0x6b')]([_0x52e6('0x2e'),_0x52e6('0x6c'),'execif',_0x52e6('0x66'),_0x52e6('0x6d')],_0x426966['application'][_0x52e6('0x65')]())){channels[_0x426966['uniqueid']]['lastapplication']=_0x426966[_0x52e6('0x63')];channels[_0x426966[_0x52e6('0x9')]]['lastdata']=_0x426966[_0x52e6('0x64')];}}}catch(_0x4e5339){utils[_0x52e6('0x38')](util['format'](_0x52e6('0x61'),_0x426966[_0x52e6('0x9')]),_0x4e5339);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 022a6b0..2b3b084 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 _0xa11f=['[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted','close','[core]\x20close','info'];(function(_0x4881a0,_0x116a30){var _0x3becd5=function(_0x3f304a){while(--_0x3f304a){_0x4881a0['push'](_0x4881a0['shift']());}};_0x3becd5(++_0x116a30);}(_0xa11f,0x148));var _0xfa11=function(_0x334fea,_0x1f1e18){_0x334fea=_0x334fea-0x0;var _0x3c5829=_0xa11f[_0x334fea];return _0x3c5829;};'use strict';var utils=require('./utils');exports['connect']=function(){utils[_0xfa11('0x0')](_0xfa11('0x1'));};exports[_0xfa11('0x2')]=function(){utils['info']('[core]\x20shutdown');};exports[_0xfa11('0x3')]=function(){utils[_0xfa11('0x0')](_0xfa11('0x4'));};exports['error']=function(_0x184846){utils['error']('[core]\x20error',_0x184846);};exports[_0xfa11('0x5')]=function(){utils['info'](_0xfa11('0x6'));};exports['managerevent']=function(_0x3aae4f){}; \ No newline at end of file +var _0xa008=['fullybooted','[core]\x20fullybooted','error','[core]\x20close','managerevent','info','[core]\x20connected','shutdown'];(function(_0x46bad7,_0x2e53ee){var _0x217f0a=function(_0x1d949f){while(--_0x1d949f){_0x46bad7['push'](_0x46bad7['shift']());}};_0x217f0a(++_0x2e53ee);}(_0xa008,0x1dd));var _0x8a00=function(_0x11e26e,_0xe81296){_0x11e26e=_0x11e26e-0x0;var _0x3d4353=_0xa008[_0x11e26e];return _0x3d4353;};'use strict';var utils=require('./utils');exports['connect']=function(){utils[_0x8a00('0x0')](_0x8a00('0x1'));};exports[_0x8a00('0x2')]=function(){utils[_0x8a00('0x0')]('[core]\x20shutdown');};exports[_0x8a00('0x3')]=function(){utils['info'](_0x8a00('0x4'));};exports[_0x8a00('0x5')]=function(_0x391241){utils[_0x8a00('0x5')]('[core]\x20error',_0x391241);};exports['close']=function(){utils['info'](_0x8a00('0x6'));};exports[_0x8a00('0x7')]=function(_0x56e9c2){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index c8784e2..a2492b3 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 _0x965d=['dialstatus','request','CreateVoiceDialReport','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','debug','[%s][dials][varset]','isNil','variable','outboundrouteid','value','[%s][dials][dialbegin]','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','error','dialend','ANSWER','assign','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','starttime','holdtime','util','./utils','info','uniqueid','dialstring','calleridnum'];(function(_0x8d5a68,_0x4369e4){var _0x5359f1=function(_0x2b9aac){while(--_0x2b9aac){_0x8d5a68['push'](_0x8d5a68['shift']());}};_0x5359f1(++_0x4369e4);}(_0x965d,0xea));var _0xd965=function(_0x518432,_0x2ca0e1){_0x518432=_0x518432-0x0;var _0x65e2d0=_0x965d[_0x518432];return _0x65e2d0;};'use strict';var _=require('lodash');var util=require(_0xd965('0x0'));var utils=require(_0xd965('0x1'));var dials={};function writeDB(_0x157517){utils[_0xd965('0x2')](util['format']('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x157517[_0xd965('0x3')],_0x157517['channel'],_0x157517[_0xd965('0x4')],_0x157517[_0xd965('0x5')],_0x157517['connectedlinenum'],_0x157517[_0xd965('0x6')]));utils[_0xd965('0x7')](_0xd965('0x8'),_0x157517);delete dials[_0x157517[_0xd965('0x3')]];}exports['newexten']=function(_0x27cedf){try{utils['debug'](util[_0xd965('0x9')](_0xd965('0xa'),_0x27cedf[_0xd965('0x3')]),_0x27cedf);utils[_0xd965('0x2')](util[_0xd965('0x9')](_0xd965('0xb'),_0x27cedf[_0xd965('0x3')],_0x27cedf[_0xd965('0xc')],_0x27cedf['appdata']));if(_0x27cedf[_0xd965('0xc')][_0xd965('0xd')]()==_0xd965('0xe')&&_[_0xd965('0xf')](_0x27cedf[_0xd965('0x10')][_0xd965('0xd')](),_0xd965('0x11'))){var _0x5e2aa4=_0x27cedf[_0xd965('0x10')][_0xd965('0x12')]('=');dials[_0x27cedf[_0xd965('0x3')]]={'routeId':_0x5e2aa4[0x1]};}}catch(_0x3800b0){utils['error'](util['format'](_0xd965('0xa'),_0x27cedf[_0xd965('0x3')]),_0x3800b0);}};exports['varset']=function(_0xe00205){try{utils[_0xd965('0x13')](util[_0xd965('0x9')](_0xd965('0x14'),_0xe00205[_0xd965('0x3')]),_0xe00205);if(!_[_0xd965('0x15')](_0xe00205[_0xd965('0x16')][_0xd965('0x17')])){utils[_0xd965('0x2')](util['format']('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0xe00205[_0xd965('0x3')],_0xe00205[_0xd965('0x18')]));dials[_0xe00205[_0xd965('0x3')]]={'routeId':_0xe00205[_0xd965('0x18')]};}}catch(_0x4a3108){utils['error'](util[_0xd965('0x9')](_0xd965('0x14'),_0xe00205[_0xd965('0x3')]),_0x4a3108);}};exports['dialbegin']=function(_0x23e6f4){try{if(!_['isNil'](dials[_0x23e6f4['uniqueid']])){utils[_0xd965('0x13')](util[_0xd965('0x9')](_0xd965('0x19'),_0x23e6f4['uniqueid']),_0x23e6f4);dials[_0x23e6f4[_0xd965('0x3')]]=_['assign'](dials[_0x23e6f4[_0xd965('0x3')]],_0x23e6f4);dials[_0x23e6f4['uniqueid']]['starttime']=utils['now']();dials[_0x23e6f4['uniqueid']][_0xd965('0x1a')]='called';utils[_0xd965('0x2')](util[_0xd965('0x9')](_0xd965('0x1b'),_0x23e6f4[_0xd965('0x3')],dials[_0x23e6f4['uniqueid']]['starttime']));}}catch(_0x31c767){utils[_0xd965('0x1c')](util[_0xd965('0x9')](_0xd965('0x19'),_0x23e6f4[_0xd965('0x3')]),_0x31c767);}};exports[_0xd965('0x1d')]=function(_0x18e5f1){try{if(!_[_0xd965('0x15')](dials[_0x18e5f1['uniqueid']])){utils['debug'](util[_0xd965('0x9')]('[%s][dials][dialend]',_0x18e5f1['uniqueid']),_0x18e5f1);dials[_0x18e5f1[_0xd965('0x3')]][_0xd965('0x6')]=_0x18e5f1['dialstatus'];if(_0x18e5f1[_0xd965('0x6')]==_0xd965('0x1e')){dials[_0x18e5f1[_0xd965('0x3')]]=_[_0xd965('0x1f')](dials[_0x18e5f1[_0xd965('0x3')]],_0x18e5f1);dials[_0x18e5f1[_0xd965('0x3')]][_0xd965('0x20')]=utils[_0xd965('0x21')]();dials[_0x18e5f1['uniqueid']][_0xd965('0x1a')]=_0xd965('0x22');utils[_0xd965('0x2')](util[_0xd965('0x9')](_0xd965('0x23'),_0x18e5f1[_0xd965('0x3')],_0x18e5f1[_0xd965('0x6')],dials[_0x18e5f1[_0xd965('0x3')]][_0xd965('0x20')]));}else{utils[_0xd965('0x2')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x18e5f1[_0xd965('0x3')],_0x18e5f1[_0xd965('0x6')]));}}}catch(_0x3bc84a){utils['error'](util[_0xd965('0x9')](_0xd965('0x24'),_0x18e5f1[_0xd965('0x3')]),_0x3bc84a);}};exports[_0xd965('0x25')]=function(_0xe53367){try{if(!_[_0xd965('0x15')](dials[_0xe53367[_0xd965('0x3')]])){utils['debug'](util['format'](_0xd965('0x26'),_0xe53367[_0xd965('0x3')]),_0xe53367);utils[_0xd965('0x2')](util[_0xd965('0x9')](_0xd965('0x27'),_0xe53367[_0xd965('0x3')],_0xe53367[_0xd965('0x5')],_0xe53367[_0xd965('0x28')],_0xe53367[_0xd965('0x29')]));dials[_0xe53367['uniqueid']]=_[_0xd965('0x1f')](dials[_0xe53367[_0xd965('0x3')]],{'endtime':utils[_0xd965('0x21')](),'lastevent':_0xd965('0x2a')});dials[_0xe53367['uniqueid']][_0xd965('0x2b')]=utils[_0xd965('0x2c')](dials[_0xe53367[_0xd965('0x3')]][_0xd965('0x2d')],dials[_0xe53367[_0xd965('0x3')]][_0xd965('0x2e')]);dials[_0xe53367[_0xd965('0x3')]][_0xd965('0x2f')]=utils[_0xd965('0x2c')](dials[_0xe53367[_0xd965('0x3')]]['answertime']||dials[_0xe53367[_0xd965('0x3')]]['endtime'],dials[_0xe53367[_0xd965('0x3')]][_0xd965('0x2e')]);dials[_0xe53367[_0xd965('0x3')]]['billableseconds']=dials[_0xe53367[_0xd965('0x3')]][_0xd965('0x20')]?utils[_0xd965('0x2c')](dials[_0xe53367[_0xd965('0x3')]][_0xd965('0x2d')],dials[_0xe53367[_0xd965('0x3')]][_0xd965('0x20')]):0x0;writeDB(dials[_0xe53367[_0xd965('0x3')]]);}}catch(_0x4c2a2e){utils[_0xd965('0x1c')](util[_0xd965('0x9')](_0xd965('0x26'),_0xe53367[_0xd965('0x3')]),_0x4c2a2e);}}; \ No newline at end of file +var _0x67ef=['connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','split','error','varset','[%s][dials][varset]','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','isNil','[%s][dials][dialbegin]','assign','starttime','lastevent','called','dialend','ANSWER','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','[%s][dials][hangup]','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum'];(function(_0x5f25b3,_0x35481a){var _0x4ab9bf=function(_0x49baf7){while(--_0x49baf7){_0x5f25b3['push'](_0x5f25b3['shift']());}};_0x4ab9bf(++_0x35481a);}(_0x67ef,0x16a));var _0xf67e=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x67ef[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0xf67e('0x0'));var util=require(_0xf67e('0x1'));var utils=require(_0xf67e('0x2'));var dials={};function writeDB(_0x1004a7){utils[_0xf67e('0x3')](util[_0xf67e('0x4')](_0xf67e('0x5'),_0x1004a7[_0xf67e('0x6')],_0x1004a7[_0xf67e('0x7')],_0x1004a7['dialstring'],_0x1004a7[_0xf67e('0x8')],_0x1004a7[_0xf67e('0x9')],_0x1004a7[_0xf67e('0xa')]));utils[_0xf67e('0xb')](_0xf67e('0xc'),_0x1004a7);delete dials[_0x1004a7[_0xf67e('0x6')]];}exports[_0xf67e('0xd')]=function(_0xd8590b){try{utils[_0xf67e('0xe')](util[_0xf67e('0x4')](_0xf67e('0xf'),_0xd8590b[_0xf67e('0x6')]),_0xd8590b);utils[_0xf67e('0x3')](util[_0xf67e('0x4')](_0xf67e('0x10'),_0xd8590b[_0xf67e('0x6')],_0xd8590b[_0xf67e('0x11')],_0xd8590b['appdata']));if(_0xd8590b['application'][_0xf67e('0x12')]()==_0xf67e('0x13')&&_[_0xf67e('0x14')](_0xd8590b[_0xf67e('0x15')][_0xf67e('0x12')](),'cdr(routeid)')){var _0x4ed420=_0xd8590b[_0xf67e('0x15')][_0xf67e('0x16')]('=');dials[_0xd8590b[_0xf67e('0x6')]]={'routeId':_0x4ed420[0x1]};}}catch(_0xd73cf0){utils[_0xf67e('0x17')](util[_0xf67e('0x4')](_0xf67e('0xf'),_0xd8590b[_0xf67e('0x6')]),_0xd73cf0);}};exports[_0xf67e('0x18')]=function(_0x2134fc){try{utils[_0xf67e('0xe')](util[_0xf67e('0x4')](_0xf67e('0x19'),_0x2134fc['uniqueid']),_0x2134fc);if(!_['isNil'](_0x2134fc[_0xf67e('0x1a')]['outboundrouteid'])){utils[_0xf67e('0x3')](util[_0xf67e('0x4')](_0xf67e('0x1b'),_0x2134fc['uniqueid'],_0x2134fc[_0xf67e('0x1c')]));dials[_0x2134fc['uniqueid']]={'routeId':_0x2134fc[_0xf67e('0x1c')]};}}catch(_0x32b73c){utils[_0xf67e('0x17')](util[_0xf67e('0x4')](_0xf67e('0x19'),_0x2134fc[_0xf67e('0x6')]),_0x32b73c);}};exports[_0xf67e('0x1d')]=function(_0x5a8df6){try{if(!_[_0xf67e('0x1e')](dials[_0x5a8df6[_0xf67e('0x6')]])){utils['debug'](util[_0xf67e('0x4')](_0xf67e('0x1f'),_0x5a8df6[_0xf67e('0x6')]),_0x5a8df6);dials[_0x5a8df6[_0xf67e('0x6')]]=_[_0xf67e('0x20')](dials[_0x5a8df6[_0xf67e('0x6')]],_0x5a8df6);dials[_0x5a8df6[_0xf67e('0x6')]][_0xf67e('0x21')]=utils['now']();dials[_0x5a8df6[_0xf67e('0x6')]][_0xf67e('0x22')]=_0xf67e('0x23');utils[_0xf67e('0x3')](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x5a8df6['uniqueid'],dials[_0x5a8df6['uniqueid']][_0xf67e('0x21')]));}}catch(_0x199ed4){utils[_0xf67e('0x17')](util['format']('[%s][dials][dialbegin]',_0x5a8df6[_0xf67e('0x6')]),_0x199ed4);}};exports[_0xf67e('0x24')]=function(_0x339c18){try{if(!_['isNil'](dials[_0x339c18[_0xf67e('0x6')]])){utils[_0xf67e('0xe')](util[_0xf67e('0x4')]('[%s][dials][dialend]',_0x339c18[_0xf67e('0x6')]),_0x339c18);dials[_0x339c18[_0xf67e('0x6')]]['dialstatus']=_0x339c18[_0xf67e('0xa')];if(_0x339c18['dialstatus']==_0xf67e('0x25')){dials[_0x339c18[_0xf67e('0x6')]]=_['assign'](dials[_0x339c18[_0xf67e('0x6')]],_0x339c18);dials[_0x339c18[_0xf67e('0x6')]][_0xf67e('0x26')]=utils[_0xf67e('0x27')]();dials[_0x339c18[_0xf67e('0x6')]][_0xf67e('0x22')]=_0xf67e('0x28');utils[_0xf67e('0x3')](util[_0xf67e('0x4')](_0xf67e('0x29'),_0x339c18[_0xf67e('0x6')],_0x339c18['dialstatus'],dials[_0x339c18['uniqueid']]['answertime']));}else{utils['info'](util[_0xf67e('0x4')](_0xf67e('0x2a'),_0x339c18[_0xf67e('0x6')],_0x339c18[_0xf67e('0xa')]));}}}catch(_0x5ca657){utils[_0xf67e('0x17')](util[_0xf67e('0x4')](_0xf67e('0x2b'),_0x339c18['uniqueid']),_0x5ca657);}};exports['hangup']=function(_0x826f2){try{if(!_[_0xf67e('0x1e')](dials[_0x826f2[_0xf67e('0x6')]])){utils[_0xf67e('0xe')](util[_0xf67e('0x4')]('[%s][dials][hangup]',_0x826f2[_0xf67e('0x6')]),_0x826f2);utils['info'](util[_0xf67e('0x4')](_0xf67e('0x2c'),_0x826f2['uniqueid'],_0x826f2[_0xf67e('0x8')],_0x826f2[_0xf67e('0x2d')],_0x826f2[_0xf67e('0x2e')]));dials[_0x826f2['uniqueid']]=_[_0xf67e('0x20')](dials[_0x826f2[_0xf67e('0x6')]],{'endtime':utils[_0xf67e('0x27')](),'lastevent':_0xf67e('0x2f')});dials[_0x826f2[_0xf67e('0x6')]][_0xf67e('0x30')]=utils[_0xf67e('0x31')](dials[_0x826f2[_0xf67e('0x6')]][_0xf67e('0x32')],dials[_0x826f2[_0xf67e('0x6')]][_0xf67e('0x21')]);dials[_0x826f2[_0xf67e('0x6')]][_0xf67e('0x33')]=utils[_0xf67e('0x31')](dials[_0x826f2[_0xf67e('0x6')]]['answertime']||dials[_0x826f2[_0xf67e('0x6')]][_0xf67e('0x32')],dials[_0x826f2[_0xf67e('0x6')]][_0xf67e('0x21')]);dials[_0x826f2['uniqueid']]['billableseconds']=dials[_0x826f2[_0xf67e('0x6')]][_0xf67e('0x26')]?utils['diffTime'](dials[_0x826f2[_0xf67e('0x6')]][_0xf67e('0x32')],dials[_0x826f2['uniqueid']][_0xf67e('0x26')]):0x0;writeDB(dials[_0x826f2[_0xf67e('0x6')]]);}}catch(_0x2b29ae){utils[_0xf67e('0x17')](util[_0xf67e('0x4')](_0xf67e('0x34'),_0x826f2['uniqueid']),_0x2b29ae);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 268def5..338287f 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 _0xae6e=['connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','dialend','asterisk-manager','../../config/environment','util','asterisk','port','username','password','keepConnected','xdr','XDR\x20DISABLED','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller'];(function(_0x485515,_0x3a4803){var _0x4daab8=function(_0x555d1a){while(--_0x555d1a){_0x485515['push'](_0x485515['shift']());}};_0x4daab8(++_0x3a4803);}(_0xae6e,0x165));var _0xeae6=function(_0x40fb4d,_0x1d6984){_0x40fb4d=_0x40fb4d-0x0;var _0x2ad87e=_0xae6e[_0x40fb4d];return _0x2ad87e;};var AsteriskManager=require(_0xeae6('0x0'));var config=require(_0xeae6('0x1'));var utils=require('./utils');var util=require(_0xeae6('0x2'));var ami=new AsteriskManager(config[_0xeae6('0x3')][_0xeae6('0x4')],config[_0xeae6('0x3')]['ip'],config[_0xeae6('0x3')][_0xeae6('0x5')],config['asterisk'][_0xeae6('0x6')],!![]);ami[_0xeae6('0x7')]();if(config[_0xeae6('0x8')]&&config[_0xeae6('0x8')]['disabled']){utils['info'](_0xeae6('0x9'));}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require(_0xeae6('0xa'));var recordings=require(_0xeae6('0xb'));var members=require(_0xeae6('0xc'));var dials=require(_0xeae6('0xd'));var transfers=require('./transfers.controller');var core=require(_0xeae6('0xe'));ami['on'](_0xeae6('0xf'),core[_0xeae6('0xf')]);ami['on'](_0xeae6('0x10'),core[_0xeae6('0x10')]);ami['on'](_0xeae6('0x11'),core['fullybooted']);ami['on'](_0xeae6('0x12'),core[_0xeae6('0x12')]);ami['on'](_0xeae6('0x13'),core[_0xeae6('0x13')]);ami['on'](_0xeae6('0x14'),core['managerevent']);ami['on'](_0xeae6('0x15'),function(_0x5e6303){try{utils[_0xeae6('0x16')](util[_0xeae6('0x17')](_0xeae6('0x18'),_0x5e6303[_0xeae6('0x19')]),_0x5e6303);members['devicestatechange'](_0x5e6303);}catch(_0x228d29){utils[_0xeae6('0x12')](util['format'](_0xeae6('0x18'),_0x5e6303[_0xeae6('0x19')]),_0x228d29);}});ami['on'](_0xeae6('0x1a'),function(_0x14cbac){try{utils[_0xeae6('0x16')](util[_0xeae6('0x17')](_0xeae6('0x1b'),_0x14cbac[_0xeae6('0x1c')]),_0x14cbac);agents[_0xeae6('0x1a')](_0x14cbac);}catch(_0x50363f){utils[_0xeae6('0x12')](util['format'](_0xeae6('0x1b'),_0x14cbac[_0xeae6('0x1c')]),_0x50363f);}});ami['on'](_0xeae6('0x1d'),function(_0x5a112c){try{utils[_0xeae6('0x16')](util[_0xeae6('0x17')](_0xeae6('0x1e'),_0x5a112c[_0xeae6('0x1c')]),_0x5a112c);agents[_0xeae6('0x1d')](_0x5a112c);}catch(_0x206d08){utils[_0xeae6('0x12')](util[_0xeae6('0x17')]('[%s][index][agentringnoanswer]',_0x5a112c[_0xeae6('0x1c')]),_0x206d08);}});ami['on'](_0xeae6('0x1f'),function(_0x1cf599){try{utils[_0xeae6('0x16')](util[_0xeae6('0x17')]('[%s][index][agentconnect]',_0x1cf599[_0xeae6('0x1c')]),_0x1cf599);agents[_0xeae6('0x1f')](_0x1cf599);queues['agentconnect'](_0x1cf599);}catch(_0x1b6375){utils[_0xeae6('0x12')](util['format']('[%s][index][agentconnect]',_0x1cf599[_0xeae6('0x1c')]),_0x1b6375);}});ami['on'](_0xeae6('0x20'),function(_0x33b0fc){try{utils[_0xeae6('0x16')](util[_0xeae6('0x17')](_0xeae6('0x21'),_0x33b0fc[_0xeae6('0x1c')]),_0x33b0fc);agents[_0xeae6('0x20')](_0x33b0fc);queues[_0xeae6('0x20')](_0x33b0fc);members['agentcomplete'](_0x33b0fc);}catch(_0x1b4391){utils['error'](util[_0xeae6('0x17')](_0xeae6('0x21'),_0x33b0fc['uniqueid']),_0x1b4391);}});ami['on'](_0xeae6('0x22'),function(_0x24eb7a){try{utils[_0xeae6('0x16')](util['format']('[%s][index][queuecallerabandon]',_0x24eb7a[_0xeae6('0x1c')]),_0x24eb7a);agents[_0xeae6('0x22')](_0x24eb7a);queues[_0xeae6('0x22')](_0x24eb7a);}catch(_0x4a596a){utils['error'](util['format']('[%s][index][queuecallerabandon]',_0x24eb7a[_0xeae6('0x1c')]),_0x4a596a);}});ami['on']('queuecallerjoin',function(_0x5a9908){try{utils[_0xeae6('0x16')](util['format'](_0xeae6('0x23'),_0x5a9908[_0xeae6('0x1c')]),_0x5a9908);queues[_0xeae6('0x24')](_0x5a9908);recordings[_0xeae6('0x24')](_0x5a9908);}catch(_0xab516b){utils['error'](util[_0xeae6('0x17')](_0xeae6('0x23'),_0x5a9908['uniqueid']),_0xab516b);}});ami['on'](_0xeae6('0x25'),function(_0x2c39d6){try{utils[_0xeae6('0x16')](util[_0xeae6('0x17')](_0xeae6('0x26'),_0x2c39d6['uniqueid']),_0x2c39d6);queues[_0xeae6('0x25')](_0x2c39d6);}catch(_0x39e8ea){utils[_0xeae6('0x12')](util[_0xeae6('0x17')](_0xeae6('0x26'),_0x2c39d6[_0xeae6('0x1c')]),_0x39e8ea);}});ami['on'](_0xeae6('0x27'),function(_0x1d4211){try{utils[_0xeae6('0x16')](util[_0xeae6('0x17')](_0xeae6('0x28'),_0x1d4211['uniqueid']),_0x1d4211);queues[_0xeae6('0x27')](_0x1d4211);calls[_0xeae6('0x27')](_0x1d4211);}catch(_0x4435a4){utils[_0xeae6('0x12')](util['format']('[%s][index][musiconholdstart]',_0x1d4211[_0xeae6('0x1c')]),_0x4435a4);}});ami['on'](_0xeae6('0x29'),function(_0xe88f6e){try{utils[_0xeae6('0x16')](util[_0xeae6('0x17')](_0xeae6('0x2a'),_0xe88f6e[_0xeae6('0x1c')]),_0xe88f6e);queues[_0xeae6('0x29')](_0xe88f6e);calls[_0xeae6('0x29')](_0xe88f6e);}catch(_0x361552){utils[_0xeae6('0x12')](util['format'](_0xeae6('0x2a'),_0xe88f6e[_0xeae6('0x1c')]),_0x361552);}});ami['on'](_0xeae6('0x2b'),function(_0x324839){try{utils[_0xeae6('0x16')](util[_0xeae6('0x17')](_0xeae6('0x2c'),_0x324839['uniqueid']),_0x324839);calls[_0xeae6('0x2b')](_0x324839);recordings[_0xeae6('0x2b')](_0x324839);}catch(_0xd12978){utils[_0xeae6('0x12')](util[_0xeae6('0x17')](_0xeae6('0x2c'),_0x324839[_0xeae6('0x1c')]),_0xd12978);}});ami['on'](_0xeae6('0x2d'),function(_0x14427f){try{utils['debug'](util[_0xeae6('0x17')](_0xeae6('0x2e'),_0x14427f[_0xeae6('0x1c')]),_0x14427f);calls['hangup'](_0x14427f);recordings['hangup'](_0x14427f);dials[_0xeae6('0x2d')](_0x14427f);agents[_0xeae6('0x2d')](_0x14427f);queues[_0xeae6('0x2d')](_0x14427f);}catch(_0x2f0757){utils['error'](util[_0xeae6('0x17')]('[%s][index][hangup]',_0x14427f[_0xeae6('0x1c')]),_0x2f0757);}});ami['on'](_0xeae6('0x2f'),function(_0x1137e2){try{utils[_0xeae6('0x16')](util['format'](_0xeae6('0x30'),_0x1137e2['uniqueid']),_0x1137e2);members['cdr'](_0x1137e2);}catch(_0x38af3a){utils[_0xeae6('0x12')](util[_0xeae6('0x17')](_0xeae6('0x30'),_0x1137e2[_0xeae6('0x1c')]),_0x38af3a);}});ami['on'](_0xeae6('0x31'),function(_0x1b1de0){try{utils[_0xeae6('0x16')](util[_0xeae6('0x17')](_0xeae6('0x32'),_0x1b1de0[_0xeae6('0x1c')]),_0x1b1de0);queues[_0xeae6('0x31')](_0x1b1de0);agents[_0xeae6('0x31')](_0x1b1de0);transfers[_0xeae6('0x31')](_0x1b1de0);recordings[_0xeae6('0x31')](_0x1b1de0);}catch(_0x33a45f){utils[_0xeae6('0x12')](util[_0xeae6('0x17')](_0xeae6('0x32'),_0x1b1de0[_0xeae6('0x1c')]),_0x33a45f);}});ami['on'](_0xeae6('0x33'),function(_0x43d48){try{utils[_0xeae6('0x16')](util['format'](_0xeae6('0x34'),_0x43d48[_0xeae6('0x35')]),_0x43d48);queues[_0xeae6('0x33')](_0x43d48);transfers[_0xeae6('0x33')](_0x43d48);agents[_0xeae6('0x33')](_0x43d48);calls['attendedtransfer'](_0x43d48);}catch(_0xb5dae2){utils[_0xeae6('0x12')](util[_0xeae6('0x17')](_0xeae6('0x34'),_0x43d48['origtransfereruniqueid']),_0xb5dae2);}});ami['on'](_0xeae6('0x36'),function(_0x5a0c49){try{utils[_0xeae6('0x16')](util[_0xeae6('0x17')](_0xeae6('0x37'),_0x5a0c49[_0xeae6('0x1c')]),_0x5a0c49);queues['varset'](_0x5a0c49);recordings['varset'](_0x5a0c49);calls['varset'](_0x5a0c49);dials['varset'](_0x5a0c49);}catch(_0x2153f8){utils['error'](util['format'](_0xeae6('0x37'),_0x5a0c49[_0xeae6('0x1c')]),_0x2153f8);}});ami['on'](_0xeae6('0x38'),function(_0x5c1619){try{utils[_0xeae6('0x16')](util[_0xeae6('0x17')](_0xeae6('0x39'),_0x5c1619[_0xeae6('0x1c')]),_0x5c1619);calls[_0xeae6('0x38')](_0x5c1619);recordings['newexten'](_0x5c1619);dials['newexten'](_0x5c1619);}catch(_0x32e018){utils[_0xeae6('0x12')](util[_0xeae6('0x17')](_0xeae6('0x39'),_0x5c1619[_0xeae6('0x1c')]),_0x32e018);}});ami['on'](_0xeae6('0x3a'),function(_0x5c1055){try{utils['debug'](util[_0xeae6('0x17')](_0xeae6('0x3b'),_0x5c1055[_0xeae6('0x1c')]),_0x5c1055);calls[_0xeae6('0x3a')](_0x5c1055);recordings[_0xeae6('0x3a')](_0x5c1055);}catch(_0x2b3efe){utils[_0xeae6('0x12')](util['format'](_0xeae6('0x3b'),_0x5c1055[_0xeae6('0x1c')]),_0x2b3efe);}});ami['on'](_0xeae6('0x3c'),function(_0x4fb364){try{utils[_0xeae6('0x16')](util[_0xeae6('0x17')]('[%s][index][dialbegin]',_0x4fb364['uniqueid']),_0x4fb364);dials[_0xeae6('0x3c')](_0x4fb364);}catch(_0x263c88){utils[_0xeae6('0x12')](util[_0xeae6('0x17')]('[%s]dialbegin',_0x4fb364['uniqueid']),_0x263c88);}});ami['on']('dialend',function(_0xdda752){try{utils[_0xeae6('0x16')](util['format']('[%s][index][dialend]',_0xdda752[_0xeae6('0x1c')]),_0xdda752);dials[_0xeae6('0x3d')](_0xdda752);}catch(_0x2c999a){utils[_0xeae6('0x12')](util[_0xeae6('0x17')]('[%s][index][dialend]',_0xdda752[_0xeae6('0x1c')]),_0x2c999a);}});} \ No newline at end of file +var _0xf19b=['[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','asterisk','port','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','hangup','[%s][index][hangup]','cdr','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','[%s][index][varset]','varset','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s]dialbegin','dialend'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf19b,0x1e4));var _0xbf19=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xf19b[_0x311c35];return _0x5cc50c;};var AsteriskManager=require(_0xbf19('0x0'));var config=require(_0xbf19('0x1'));var utils=require(_0xbf19('0x2'));var util=require(_0xbf19('0x3'));var ami=new AsteriskManager(config[_0xbf19('0x4')][_0xbf19('0x5')],config['asterisk']['ip'],config['asterisk'][_0xbf19('0x6')],config['asterisk'][_0xbf19('0x7')],!![]);ami[_0xbf19('0x8')]();if(config['xdr']&&config[_0xbf19('0x9')][_0xbf19('0xa')]){utils[_0xbf19('0xb')](_0xbf19('0xc'));}else{var agents=require(_0xbf19('0xd'));var calls=require(_0xbf19('0xe'));var queues=require(_0xbf19('0xf'));var recordings=require(_0xbf19('0x10'));var members=require(_0xbf19('0x11'));var dials=require(_0xbf19('0x12'));var transfers=require(_0xbf19('0x13'));var core=require(_0xbf19('0x14'));ami['on'](_0xbf19('0x15'),core['connect']);ami['on']('shutdown',core['shutdown']);ami['on']('fullybooted',core[_0xbf19('0x16')]);ami['on']('error',core[_0xbf19('0x17')]);ami['on'](_0xbf19('0x18'),core[_0xbf19('0x18')]);ami['on'](_0xbf19('0x19'),core['managerevent']);ami['on'](_0xbf19('0x1a'),function(_0x274722){try{utils[_0xbf19('0x1b')](util[_0xbf19('0x1c')](_0xbf19('0x1d'),_0x274722[_0xbf19('0x1e')]),_0x274722);members[_0xbf19('0x1a')](_0x274722);}catch(_0x3dbf4f){utils['error'](util[_0xbf19('0x1c')](_0xbf19('0x1d'),_0x274722[_0xbf19('0x1e')]),_0x3dbf4f);}});ami['on']('agentcalled',function(_0x461276){try{utils[_0xbf19('0x1b')](util[_0xbf19('0x1c')](_0xbf19('0x1f'),_0x461276[_0xbf19('0x20')]),_0x461276);agents[_0xbf19('0x21')](_0x461276);}catch(_0x44fc20){utils[_0xbf19('0x17')](util[_0xbf19('0x1c')](_0xbf19('0x1f'),_0x461276[_0xbf19('0x20')]),_0x44fc20);}});ami['on'](_0xbf19('0x22'),function(_0x305cff){try{utils['debug'](util[_0xbf19('0x1c')]('[%s][index][agentringnoanswer]',_0x305cff['uniqueid']),_0x305cff);agents[_0xbf19('0x22')](_0x305cff);}catch(_0x2340c1){utils[_0xbf19('0x17')](util[_0xbf19('0x1c')](_0xbf19('0x23'),_0x305cff[_0xbf19('0x20')]),_0x2340c1);}});ami['on']('agentconnect',function(_0x53f770){try{utils[_0xbf19('0x1b')](util[_0xbf19('0x1c')](_0xbf19('0x24'),_0x53f770[_0xbf19('0x20')]),_0x53f770);agents[_0xbf19('0x25')](_0x53f770);queues[_0xbf19('0x25')](_0x53f770);}catch(_0xd14bd){utils[_0xbf19('0x17')](util[_0xbf19('0x1c')]('[%s][index][agentconnect]',_0x53f770[_0xbf19('0x20')]),_0xd14bd);}});ami['on'](_0xbf19('0x26'),function(_0x2545e7){try{utils['debug'](util[_0xbf19('0x1c')](_0xbf19('0x27'),_0x2545e7[_0xbf19('0x20')]),_0x2545e7);agents[_0xbf19('0x26')](_0x2545e7);queues[_0xbf19('0x26')](_0x2545e7);members['agentcomplete'](_0x2545e7);}catch(_0x50490f){utils['error'](util[_0xbf19('0x1c')]('[%s][index][agentcomplete]',_0x2545e7[_0xbf19('0x20')]),_0x50490f);}});ami['on'](_0xbf19('0x28'),function(_0x4a4b23){try{utils[_0xbf19('0x1b')](util[_0xbf19('0x1c')](_0xbf19('0x29'),_0x4a4b23[_0xbf19('0x20')]),_0x4a4b23);agents['queuecallerabandon'](_0x4a4b23);queues['queuecallerabandon'](_0x4a4b23);}catch(_0x18b11a){utils[_0xbf19('0x17')](util[_0xbf19('0x1c')](_0xbf19('0x29'),_0x4a4b23[_0xbf19('0x20')]),_0x18b11a);}});ami['on'](_0xbf19('0x2a'),function(_0x462067){try{utils['debug'](util[_0xbf19('0x1c')](_0xbf19('0x2b'),_0x462067[_0xbf19('0x20')]),_0x462067);queues[_0xbf19('0x2a')](_0x462067);recordings[_0xbf19('0x2a')](_0x462067);}catch(_0x1c2c7b){utils['error'](util['format'](_0xbf19('0x2b'),_0x462067[_0xbf19('0x20')]),_0x1c2c7b);}});ami['on'](_0xbf19('0x2c'),function(_0x819f02){try{utils[_0xbf19('0x1b')](util[_0xbf19('0x1c')](_0xbf19('0x2d'),_0x819f02[_0xbf19('0x20')]),_0x819f02);queues['queuecallerleave'](_0x819f02);}catch(_0x1c928f){utils[_0xbf19('0x17')](util['format']('[%s][index][queuecallerleave]',_0x819f02[_0xbf19('0x20')]),_0x1c928f);}});ami['on'](_0xbf19('0x2e'),function(_0x68f79b){try{utils[_0xbf19('0x1b')](util[_0xbf19('0x1c')](_0xbf19('0x2f'),_0x68f79b[_0xbf19('0x20')]),_0x68f79b);queues[_0xbf19('0x2e')](_0x68f79b);calls[_0xbf19('0x2e')](_0x68f79b);}catch(_0xcd0f28){utils[_0xbf19('0x17')](util[_0xbf19('0x1c')](_0xbf19('0x2f'),_0x68f79b[_0xbf19('0x20')]),_0xcd0f28);}});ami['on'](_0xbf19('0x30'),function(_0x5d7f13){try{utils[_0xbf19('0x1b')](util[_0xbf19('0x1c')](_0xbf19('0x31'),_0x5d7f13[_0xbf19('0x20')]),_0x5d7f13);queues['musiconholdstop'](_0x5d7f13);calls['musiconholdstop'](_0x5d7f13);}catch(_0x5479af){utils[_0xbf19('0x17')](util['format']('[%s][index][musiconholdstop]',_0x5d7f13['uniqueid']),_0x5479af);}});ami['on'](_0xbf19('0x32'),function(_0x425c1a){try{utils[_0xbf19('0x1b')](util[_0xbf19('0x1c')]('[%s][index][newstate]',_0x425c1a['uniqueid']),_0x425c1a);calls[_0xbf19('0x32')](_0x425c1a);recordings[_0xbf19('0x32')](_0x425c1a);}catch(_0x2d451f){utils[_0xbf19('0x17')](util[_0xbf19('0x1c')]('[%s][index][newstate]',_0x425c1a['uniqueid']),_0x2d451f);}});ami['on'](_0xbf19('0x33'),function(_0x3ee3f8){try{utils[_0xbf19('0x1b')](util['format'](_0xbf19('0x34'),_0x3ee3f8[_0xbf19('0x20')]),_0x3ee3f8);calls[_0xbf19('0x33')](_0x3ee3f8);recordings[_0xbf19('0x33')](_0x3ee3f8);dials[_0xbf19('0x33')](_0x3ee3f8);agents['hangup'](_0x3ee3f8);queues[_0xbf19('0x33')](_0x3ee3f8);}catch(_0x7ecaef){utils['error'](util[_0xbf19('0x1c')](_0xbf19('0x34'),_0x3ee3f8[_0xbf19('0x20')]),_0x7ecaef);}});ami['on'](_0xbf19('0x35'),function(_0x16dfa7){try{utils['debug'](util['format']('[%s][index][cdr]',_0x16dfa7[_0xbf19('0x20')]),_0x16dfa7);members[_0xbf19('0x35')](_0x16dfa7);}catch(_0x3d9f6e){utils['error'](util[_0xbf19('0x1c')]('[%s][index][cdr]',_0x16dfa7[_0xbf19('0x20')]),_0x3d9f6e);}});ami['on'](_0xbf19('0x36'),function(_0x4a8b2c){try{utils[_0xbf19('0x1b')](util[_0xbf19('0x1c')](_0xbf19('0x37'),_0x4a8b2c['uniqueid']),_0x4a8b2c);queues[_0xbf19('0x36')](_0x4a8b2c);agents[_0xbf19('0x36')](_0x4a8b2c);transfers[_0xbf19('0x36')](_0x4a8b2c);recordings[_0xbf19('0x36')](_0x4a8b2c);}catch(_0x54d852){utils[_0xbf19('0x17')](util['format'](_0xbf19('0x37'),_0x4a8b2c[_0xbf19('0x20')]),_0x54d852);}});ami['on']('attendedtransfer',function(_0x17c697){try{utils['debug'](util[_0xbf19('0x1c')](_0xbf19('0x38'),_0x17c697[_0xbf19('0x39')]),_0x17c697);queues[_0xbf19('0x3a')](_0x17c697);transfers[_0xbf19('0x3a')](_0x17c697);agents[_0xbf19('0x3a')](_0x17c697);calls[_0xbf19('0x3a')](_0x17c697);}catch(_0x4682ac){utils[_0xbf19('0x17')](util[_0xbf19('0x1c')]('[%s][index][attendedtransfer]',_0x17c697[_0xbf19('0x39')]),_0x4682ac);}});ami['on']('varset',function(_0x2fd825){try{utils[_0xbf19('0x1b')](util['format'](_0xbf19('0x3b'),_0x2fd825[_0xbf19('0x20')]),_0x2fd825);queues[_0xbf19('0x3c')](_0x2fd825);recordings[_0xbf19('0x3c')](_0x2fd825);calls[_0xbf19('0x3c')](_0x2fd825);dials[_0xbf19('0x3c')](_0x2fd825);}catch(_0x33e68e){utils['error'](util[_0xbf19('0x1c')](_0xbf19('0x3b'),_0x2fd825['uniqueid']),_0x33e68e);}});ami['on'](_0xbf19('0x3d'),function(_0xb69c5c){try{utils[_0xbf19('0x1b')](util[_0xbf19('0x1c')](_0xbf19('0x3e'),_0xb69c5c['uniqueid']),_0xb69c5c);calls[_0xbf19('0x3d')](_0xb69c5c);recordings[_0xbf19('0x3d')](_0xb69c5c);dials[_0xbf19('0x3d')](_0xb69c5c);}catch(_0x556cf5){utils[_0xbf19('0x17')](util[_0xbf19('0x1c')](_0xbf19('0x3e'),_0xb69c5c[_0xbf19('0x20')]),_0x556cf5);}});ami['on']('newchannel',function(_0x31169b){try{utils[_0xbf19('0x1b')](util[_0xbf19('0x1c')](_0xbf19('0x3f'),_0x31169b[_0xbf19('0x20')]),_0x31169b);calls[_0xbf19('0x40')](_0x31169b);recordings['newchannel'](_0x31169b);}catch(_0x529ce5){utils['error'](util['format'](_0xbf19('0x3f'),_0x31169b[_0xbf19('0x20')]),_0x529ce5);}});ami['on'](_0xbf19('0x41'),function(_0x239afa){try{utils[_0xbf19('0x1b')](util['format']('[%s][index][dialbegin]',_0x239afa[_0xbf19('0x20')]),_0x239afa);dials[_0xbf19('0x41')](_0x239afa);}catch(_0x21d071){utils[_0xbf19('0x17')](util['format'](_0xbf19('0x42'),_0x239afa['uniqueid']),_0x21d071);}});ami['on'](_0xbf19('0x43'),function(_0x38b69d){try{utils[_0xbf19('0x1b')](util['format'](_0xbf19('0x44'),_0x38b69d['uniqueid']),_0x38b69d);dials['dialend'](_0x38b69d);}catch(_0x51f797){utils[_0xbf19('0x17')](util[_0xbf19('0x1c')](_0xbf19('0x44'),_0x38b69d[_0xbf19('0x20')]),_0x51f797);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 3ae9233..5f931d7 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 _0xa4e8=['[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','membername','type','then','name','internal','request','getUserByName','split','CreateMemberReport','[%s][members][writeDB]','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','now','agent','NOT_INUSE','isNil','duration','diffTime','exitAt','enterAt','error','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','channel','data2','source','data3','destination','data1','destinationchannel'];(function(_0x2b27f1,_0x2b81f3){var _0x2c9db3=function(_0x462fce){while(--_0x462fce){_0x2b27f1['push'](_0x2b27f1['shift']());}};_0x2c9db3(++_0x2b81f3);}(_0xa4e8,0x1a1));var _0x8a4e=function(_0x575087,_0x3fc550){_0x575087=_0x575087-0x0;var _0x36b9c6=_0xa4e8[_0x575087];return _0x36b9c6;};'use strict';var _=require(_0x8a4e('0x0'));var util=require('util');var utils=require('./utils');var members={};var exclude=[_0x8a4e('0x1'),_0x8a4e('0x2')];function writeDB(_0x4d4a30){utils[_0x8a4e('0x3')](util[_0x8a4e('0x4')](_0x8a4e('0x5'),_0x4d4a30[_0x8a4e('0x6')],_0x4d4a30[_0x8a4e('0x7')],_0x4d4a30['channel'],_0x4d4a30['data2'],_0x4d4a30[_0x8a4e('0x8')],_0x4d4a30[_0x8a4e('0x9')]));if(_0x4d4a30[_0x8a4e('0x7')]){utils['getUserByInterface'](_0x4d4a30[_0x8a4e('0x7')])[_0x8a4e('0xa')](function(_0x36e92c){if(_0x36e92c){_0x4d4a30[_0x8a4e('0x8')]=_0x36e92c[_0x8a4e('0xb')];_0x4d4a30[_0x8a4e('0xc')]=_0x36e92c['internal'];utils[_0x8a4e('0xd')]('CreateMemberReport',_0x4d4a30);}else{utils[_0x8a4e('0xe')](_0x4d4a30[_0x8a4e('0x7')][_0x8a4e('0xf')]('/')[0x1])[_0x8a4e('0xa')](function(_0x3188b1){if(_0x3188b1){_0x4d4a30[_0x8a4e('0x8')]=_0x3188b1['name'];_0x4d4a30[_0x8a4e('0xc')]=_0x3188b1[_0x8a4e('0xc')];utils[_0x8a4e('0xd')](_0x8a4e('0x10'),_0x4d4a30);}});}})['catch'](function(_0x297712){utils['error'](util[_0x8a4e('0x4')](_0x8a4e('0x11'),_0x4d4a30[_0x8a4e('0x6')]),_0x297712);});}delete members[_0x4d4a30[_0x8a4e('0x7')]];}function startsWith(_0x54d021,_0x4a8a12){return _['some'](_0x54d021,function(_0x37c217){return _[_0x8a4e('0x12')](_0x4a8a12,_0x37c217);});}exports[_0x8a4e('0x13')]=function(_0x9af22a){try{utils[_0x8a4e('0x14')](util['format'](_0x8a4e('0x15'),members[_0x9af22a[_0x8a4e('0x16')]]?members[_0x9af22a[_0x8a4e('0x16')]][_0x8a4e('0x6')]:_0x9af22a[_0x8a4e('0x16')]),_0x9af22a);utils[_0x8a4e('0x3')](util[_0x8a4e('0x4')](_0x8a4e('0x17'),members[_0x9af22a['device']]?members[_0x9af22a[_0x8a4e('0x16')]][_0x8a4e('0x6')]:_0x9af22a[_0x8a4e('0x16')],_0x9af22a[_0x8a4e('0x18')],_0x9af22a[_0x8a4e('0x16')]));switch(_0x9af22a[_0x8a4e('0x18')]){case _0x8a4e('0x19'):case _0x8a4e('0x1a'):if(!startsWith(exclude,_0x9af22a['device'])){members[_0x9af22a['device']]={'channel':'voice','interface':_0x9af22a['device'],'type':_0x8a4e('0x1b'),'enterAt':utils[_0x8a4e('0x1c')](),'role':_0x8a4e('0x1d')};}break;case _0x8a4e('0x1e'):if(!_[_0x8a4e('0x1f')](members[_0x9af22a[_0x8a4e('0x16')]])){members[_0x9af22a[_0x8a4e('0x16')]]['exitAt']=utils[_0x8a4e('0x1c')]();members[_0x9af22a[_0x8a4e('0x16')]][_0x8a4e('0x20')]=utils[_0x8a4e('0x21')](members[_0x9af22a['device']][_0x8a4e('0x22')],members[_0x9af22a[_0x8a4e('0x16')]][_0x8a4e('0x23')]);if(members[_0x9af22a[_0x8a4e('0x16')]][_0x8a4e('0x6')]){writeDB(members[_0x9af22a['device']]);}}break;default:break;}}catch(_0x2cd3f5){utils[_0x8a4e('0x24')](util['format'](_0x8a4e('0x15'),members[_0x9af22a[_0x8a4e('0x16')]]?members[_0x9af22a['device']][_0x8a4e('0x6')]:_0x9af22a[_0x8a4e('0x16')]),_0x2cd3f5);}};exports[_0x8a4e('0x25')]=function(_0x17bb51){try{if(!_[_0x8a4e('0x1f')](members[_0x17bb51[_0x8a4e('0x7')]])){utils['debug'](util[_0x8a4e('0x4')](_0x8a4e('0x26'),_0x17bb51['uniqueid']),_0x17bb51);utils['info'](util[_0x8a4e('0x4')](_0x8a4e('0x27'),_0x17bb51[_0x8a4e('0x6')],_0x17bb51[_0x8a4e('0x7')],_0x17bb51[_0x8a4e('0x28')]));members[_0x17bb51[_0x8a4e('0x7')]]=_[_0x8a4e('0x29')](members[_0x17bb51[_0x8a4e('0x7')]],{'data4':_0x17bb51['queue'],'uniqueid':_0x17bb51[_0x8a4e('0x6')]});}}catch(_0x3a81ba){utils[_0x8a4e('0x24')](util[_0x8a4e('0x4')]('[%s][members][agentcomplete]',_0x17bb51['uniqueid']),_0x3a81ba);}};exports[_0x8a4e('0x2a')]=function(_0x577d7d){try{utils[_0x8a4e('0x14')](util[_0x8a4e('0x4')](_0x8a4e('0x2b'),_0x577d7d[_0x8a4e('0x6')]),_0x577d7d);if(_0x577d7d[_0x8a4e('0x2c')]){var _0x566f4b=_0x577d7d[_0x8a4e('0x2c')][_0x8a4e('0xf')]('-')[0x0];if(!_['isNil'](members[_0x566f4b])){members[_0x566f4b]=_['assign'](members[_0x566f4b],{'data1':members[_0x566f4b]['data1']||_0x577d7d[_0x8a4e('0x9')],'data2':members[_0x566f4b][_0x8a4e('0x2d')]||_0x577d7d[_0x8a4e('0x2e')],'data3':members[_0x566f4b][_0x8a4e('0x2f')]||_0x577d7d[_0x8a4e('0x30')],'uniqueid':members[_0x566f4b]['uniqueid']||_0x577d7d[_0x8a4e('0x6')]});utils[_0x8a4e('0x3')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x577d7d['uniqueid'],members[_0x566f4b][_0x8a4e('0x31')],members[_0x566f4b][_0x8a4e('0x2d')],members[_0x566f4b]['data3']));if(members[_0x566f4b]['exitAt']){writeDB(members[_0x566f4b]);}}}if(_0x577d7d['destinationchannel']){var _0x147e87=_0x577d7d[_0x8a4e('0x32')][_0x8a4e('0xf')]('-')[0x0];if(!_[_0x8a4e('0x1f')](members[_0x147e87])){members[_0x147e87]=_[_0x8a4e('0x29')](members[_0x147e87],{'data1':members[_0x147e87]['data1']||_0x577d7d[_0x8a4e('0x9')],'data2':members[_0x147e87][_0x8a4e('0x2d')]||_0x577d7d[_0x8a4e('0x2e')],'data3':members[_0x147e87][_0x8a4e('0x2f')]||_0x577d7d[_0x8a4e('0x30')],'uniqueid':members[_0x147e87][_0x8a4e('0x6')]||_0x577d7d[_0x8a4e('0x6')]});utils[_0x8a4e('0x3')](util[_0x8a4e('0x4')](_0x8a4e('0x33'),_0x577d7d['uniqueid'],members[_0x147e87][_0x8a4e('0x31')],members[_0x147e87][_0x8a4e('0x2d')],members[_0x147e87][_0x8a4e('0x2f')]));if(members[_0x147e87][_0x8a4e('0x22')]){writeDB(members[_0x147e87]);}}}}catch(_0x2757e1){utils[_0x8a4e('0x24')](util[_0x8a4e('0x4')](_0x8a4e('0x2b'),_0x577d7d['uniqueid']),_0x2757e1);}}; \ No newline at end of file +var _0xd6d9=['uniqueid','channel','data2','membername','type','interface','then','internal','request','CreateMemberReport','name','catch','error','some','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','TALKING','now','NOT_INUSE','isNil','exitAt','duration','diffTime','agentcomplete','[%s][members][agentcomplete]','queue','assign','[%s][members][cdr]','split','source','destination','data3','destinationchannel','data1','util','./utils','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s'];(function(_0x15f3c0,_0x165a64){var _0x1adfe0=function(_0x212cfc){while(--_0x212cfc){_0x15f3c0['push'](_0x15f3c0['shift']());}};_0x1adfe0(++_0x165a64);}(_0xd6d9,0x16a));var _0x9d6d=function(_0x5201b9,_0x148222){_0x5201b9=_0x5201b9-0x0;var _0x6d23ae=_0xd6d9[_0x5201b9];return _0x6d23ae;};'use strict';var _=require('lodash');var util=require(_0x9d6d('0x0'));var utils=require(_0x9d6d('0x1'));var members={};var exclude=['Local/_attended@transfer',_0x9d6d('0x2')];function writeDB(_0x5b8793){utils[_0x9d6d('0x3')](util[_0x9d6d('0x4')](_0x9d6d('0x5'),_0x5b8793[_0x9d6d('0x6')],_0x5b8793['interface'],_0x5b8793[_0x9d6d('0x7')],_0x5b8793[_0x9d6d('0x8')],_0x5b8793[_0x9d6d('0x9')],_0x5b8793[_0x9d6d('0xa')]));if(_0x5b8793['interface']){utils['getUserByInterface'](_0x5b8793[_0x9d6d('0xb')])[_0x9d6d('0xc')](function(_0x1973a5){if(_0x1973a5){_0x5b8793[_0x9d6d('0x9')]=_0x1973a5['name'];_0x5b8793['internal']=_0x1973a5[_0x9d6d('0xd')];utils[_0x9d6d('0xe')](_0x9d6d('0xf'),_0x5b8793);}else{utils['getUserByName'](_0x5b8793[_0x9d6d('0xb')]['split']('/')[0x1])['then'](function(_0x45ee91){if(_0x45ee91){_0x5b8793['membername']=_0x45ee91[_0x9d6d('0x10')];_0x5b8793[_0x9d6d('0xd')]=_0x45ee91['internal'];utils[_0x9d6d('0xe')](_0x9d6d('0xf'),_0x5b8793);}});}})[_0x9d6d('0x11')](function(_0x288047){utils[_0x9d6d('0x12')](util[_0x9d6d('0x4')]('[%s][members][writeDB]',_0x5b8793[_0x9d6d('0x6')]),_0x288047);});}delete members[_0x5b8793[_0x9d6d('0xb')]];}function startsWith(_0x55a4d1,_0x3c472d){return _[_0x9d6d('0x13')](_0x55a4d1,function(_0x5202c6){return _['startsWith'](_0x3c472d,_0x5202c6);});}exports[_0x9d6d('0x14')]=function(_0x59eb55){try{utils[_0x9d6d('0x15')](util[_0x9d6d('0x4')](_0x9d6d('0x16'),members[_0x59eb55[_0x9d6d('0x17')]]?members[_0x59eb55[_0x9d6d('0x17')]][_0x9d6d('0x6')]:_0x59eb55[_0x9d6d('0x17')]),_0x59eb55);utils[_0x9d6d('0x3')](util[_0x9d6d('0x4')](_0x9d6d('0x18'),members[_0x59eb55[_0x9d6d('0x17')]]?members[_0x59eb55[_0x9d6d('0x17')]][_0x9d6d('0x6')]:_0x59eb55['device'],_0x59eb55[_0x9d6d('0x19')],_0x59eb55[_0x9d6d('0x17')]));switch(_0x59eb55[_0x9d6d('0x19')]){case _0x9d6d('0x1a'):case'BUSY':if(!startsWith(exclude,_0x59eb55[_0x9d6d('0x17')])){members[_0x59eb55['device']]={'channel':_0x9d6d('0x1b'),'interface':_0x59eb55[_0x9d6d('0x17')],'type':_0x9d6d('0x1c'),'enterAt':utils[_0x9d6d('0x1d')](),'role':'agent'};}break;case _0x9d6d('0x1e'):if(!_[_0x9d6d('0x1f')](members[_0x59eb55['device']])){members[_0x59eb55[_0x9d6d('0x17')]][_0x9d6d('0x20')]=utils[_0x9d6d('0x1d')]();members[_0x59eb55[_0x9d6d('0x17')]][_0x9d6d('0x21')]=utils[_0x9d6d('0x22')](members[_0x59eb55[_0x9d6d('0x17')]]['exitAt'],members[_0x59eb55[_0x9d6d('0x17')]]['enterAt']);if(members[_0x59eb55[_0x9d6d('0x17')]]['uniqueid']){writeDB(members[_0x59eb55[_0x9d6d('0x17')]]);}}break;default:break;}}catch(_0x206e0){utils[_0x9d6d('0x12')](util[_0x9d6d('0x4')](_0x9d6d('0x16'),members[_0x59eb55[_0x9d6d('0x17')]]?members[_0x59eb55['device']][_0x9d6d('0x6')]:_0x59eb55['device']),_0x206e0);}};exports[_0x9d6d('0x23')]=function(_0x10552e){try{if(!_['isNil'](members[_0x10552e[_0x9d6d('0xb')]])){utils[_0x9d6d('0x15')](util[_0x9d6d('0x4')](_0x9d6d('0x24'),_0x10552e[_0x9d6d('0x6')]),_0x10552e);utils[_0x9d6d('0x3')](util['format']('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x10552e[_0x9d6d('0x6')],_0x10552e[_0x9d6d('0xb')],_0x10552e[_0x9d6d('0x25')]));members[_0x10552e['interface']]=_[_0x9d6d('0x26')](members[_0x10552e[_0x9d6d('0xb')]],{'data4':_0x10552e[_0x9d6d('0x25')],'uniqueid':_0x10552e[_0x9d6d('0x6')]});}}catch(_0x4c4eb5){utils[_0x9d6d('0x12')](util[_0x9d6d('0x4')](_0x9d6d('0x24'),_0x10552e['uniqueid']),_0x4c4eb5);}};exports['cdr']=function(_0x38df55){try{utils[_0x9d6d('0x15')](util[_0x9d6d('0x4')](_0x9d6d('0x27'),_0x38df55[_0x9d6d('0x6')]),_0x38df55);if(_0x38df55[_0x9d6d('0x7')]){var _0xa4103f=_0x38df55[_0x9d6d('0x7')][_0x9d6d('0x28')]('-')[0x0];if(!_[_0x9d6d('0x1f')](members[_0xa4103f])){members[_0xa4103f]=_['assign'](members[_0xa4103f],{'data1':members[_0xa4103f]['data1']||_0x38df55[_0x9d6d('0xa')],'data2':members[_0xa4103f][_0x9d6d('0x8')]||_0x38df55[_0x9d6d('0x29')],'data3':members[_0xa4103f]['data3']||_0x38df55[_0x9d6d('0x2a')],'uniqueid':members[_0xa4103f]['uniqueid']||_0x38df55['uniqueid']});utils['info'](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x38df55[_0x9d6d('0x6')],members[_0xa4103f]['data1'],members[_0xa4103f][_0x9d6d('0x8')],members[_0xa4103f][_0x9d6d('0x2b')]));if(members[_0xa4103f][_0x9d6d('0x20')]){writeDB(members[_0xa4103f]);}}}if(_0x38df55[_0x9d6d('0x2c')]){var _0x39653=_0x38df55['destinationchannel'][_0x9d6d('0x28')]('-')[0x0];if(!_[_0x9d6d('0x1f')](members[_0x39653])){members[_0x39653]=_[_0x9d6d('0x26')](members[_0x39653],{'data1':members[_0x39653]['data1']||_0x38df55[_0x9d6d('0xa')],'data2':members[_0x39653][_0x9d6d('0x8')]||_0x38df55['source'],'data3':members[_0x39653]['data3']||_0x38df55[_0x9d6d('0x2a')],'uniqueid':members[_0x39653][_0x9d6d('0x6')]||_0x38df55[_0x9d6d('0x6')]});utils[_0x9d6d('0x3')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x38df55[_0x9d6d('0x6')],members[_0x39653][_0x9d6d('0x2d')],members[_0x39653]['data2'],members[_0x39653][_0x9d6d('0x2b')]));if(members[_0x39653][_0x9d6d('0x20')]){writeDB(members[_0x39653]);}}}}catch(_0x4287f5){utils[_0x9d6d('0x12')](util[_0x9d6d('0x4')](_0x9d6d('0x27'),_0x38df55[_0x9d6d('0x6')]),_0x4287f5);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 5cc65f2..8dd9b61 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 _0xb13d=['transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','extension','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','lastAssignedTo','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','info','uniqueid','position','now','format','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','CONTINUE','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','value','EXITWITHKEY','error','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','membername','reason','transfer','TRANSFER','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer'];(function(_0x478c8a,_0x9afc92){var _0x3b6b3e=function(_0x37634e){while(--_0x37634e){_0x478c8a['push'](_0x478c8a['shift']());}};_0x3b6b3e(++_0x9afc92);}(_0xb13d,0x8b));var _0xdb13=function(_0x17d44d,_0x510ff8){_0x17d44d=_0x17d44d-0x0;var _0x22c785=_0xb13d[_0x17d44d];return _0x22c785;};'use strict';var _=require(_0xdb13('0x0'));var util=require(_0xdb13('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x1afa35){utils['info'](util['format'](_0xdb13('0x2'),_0x1afa35['uniqueid'],_0x1afa35[_0xdb13('0x3')],_0x1afa35['queue'],_0x1afa35[_0xdb13('0x4')],_0x1afa35['calleridnum'],_0x1afa35[_0xdb13('0x5')],_0x1afa35[_0xdb13('0x6')]));if(_0x1afa35[_0xdb13('0x7')]){utils[_0xdb13('0x8')](_0x1afa35[_0xdb13('0x7')])[_0xdb13('0x9')](function(_0x394658){if(_0x394658){_0x1afa35[_0xdb13('0xa')]=_0x394658['type'];}utils[_0xdb13('0xb')]('CreateVoiceQueueReport',_0x1afa35);});}else{utils[_0xdb13('0xb')](_0xdb13('0xc'),_0x1afa35);}if(_0x1afa35['transfereduniqueid']){delete queues[_0x1afa35[_0xdb13('0xd')]];}else{delete queues[_0x1afa35['uniqueid']];}}exports['queuecallerjoin']=function(_0xddb49a){try{utils[_0xdb13('0xe')](util['format'](_0xdb13('0xf'),_0xddb49a['uniqueid']),_0xddb49a);utils[_0xdb13('0x10')](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0xddb49a[_0xdb13('0x11')],_0xddb49a[_0xdb13('0x7')],_0xddb49a['position']));queues[_0xddb49a[_0xdb13('0x11')]]=_['assign'](_0xddb49a,{'originalposition':_0xddb49a[_0xdb13('0x12')],'queuecallerjoinAt':utils[_0xdb13('0x13')](),'mohtime':0x0});}catch(_0x2fbaf2){utils['error'](util[_0xdb13('0x14')](_0xdb13('0xf'),_0xddb49a[_0xdb13('0x11')]),_0x2fbaf2);}};exports[_0xdb13('0x15')]=function(_0x5d488a){try{if(!_[_0xdb13('0x16')](queues[_0x5d488a[_0xdb13('0x11')]])){utils[_0xdb13('0xe')](util[_0xdb13('0x14')](_0xdb13('0x17'),_0x5d488a['uniqueid']),_0x5d488a);if(queues[_0x5d488a['uniqueid']][_0xdb13('0x18')]){if(!queues[_0x5d488a[_0xdb13('0x11')]][_0xdb13('0x19')]&&!queues[_0x5d488a[_0xdb13('0x11')]]['queuecallerexit']){queues[_0x5d488a[_0xdb13('0x11')]][_0xdb13('0x1a')]=!![];queues[_0x5d488a[_0xdb13('0x11')]][_0xdb13('0x1b')]=utils[_0xdb13('0x13')]();queues[_0x5d488a['uniqueid']]['queuecallerexitreason']=_0xdb13('0x1c');}utils[_0xdb13('0x10')](util['format'](_0xdb13('0x1d'),_0x5d488a[_0xdb13('0x11')],queues[_0x5d488a[_0xdb13('0x11')]][_0xdb13('0x1e')],queues[_0x5d488a[_0xdb13('0x11')]]['queuecallerexitreason']));writeDB(queues[_0x5d488a[_0xdb13('0x11')]]);}else if(queues[_0x5d488a[_0xdb13('0x11')]][_0xdb13('0xd')]){utils[_0xdb13('0x10')](util[_0xdb13('0x14')](_0xdb13('0x1f'),_0x5d488a[_0xdb13('0x11')],queues[_0x5d488a[_0xdb13('0x11')]]['name'],queues[_0x5d488a[_0xdb13('0x11')]][_0xdb13('0xd')]));queues[queues[_0x5d488a[_0xdb13('0x11')]]['transfereduniqueid']]=queues[_0x5d488a[_0xdb13('0x11')]];queues[queues[_0x5d488a[_0xdb13('0x11')]][_0xdb13('0xd')]][_0xdb13('0x20')]=0x2;delete queues[_0x5d488a[_0xdb13('0x11')]];}}}catch(_0x58dba3){utils['error'](util[_0xdb13('0x14')]('[%s][queues][hangup]',_0x5d488a[_0xdb13('0x11')]),_0x58dba3);}};exports[_0xdb13('0x21')]=function(_0x3f5a24){try{utils[_0xdb13('0xe')](util[_0xdb13('0x14')](_0xdb13('0x22'),_0x3f5a24[_0xdb13('0x11')]),_0x3f5a24);if(!_[_0xdb13('0x16')](_0x3f5a24[_0xdb13('0x23')][_0xdb13('0x24')])&&_0x3f5a24['value']['toUpperCase']()!==_0xdb13('0x25')){if(!_[_0xdb13('0x16')](queues[_0x3f5a24['uniqueid']])){queues[_0x3f5a24[_0xdb13('0x11')]][_0xdb13('0x19')]=![];queues[_0x3f5a24[_0xdb13('0x11')]][_0xdb13('0x26')]=null;queues[_0x3f5a24[_0xdb13('0x11')]][_0xdb13('0x27')]=!![];queues[_0x3f5a24['uniqueid']][_0xdb13('0x28')]=utils[_0xdb13('0x13')]();queues[_0x3f5a24['uniqueid']]['queuecallerexitreason']=_0x3f5a24['value']['toUpperCase']();utils[_0xdb13('0x10')](util['format'](_0xdb13('0x29'),_0x3f5a24[_0xdb13('0x11')],queues[_0x3f5a24['uniqueid']][_0xdb13('0x1e')],_0x3f5a24[_0xdb13('0x2a')],queues[_0x3f5a24[_0xdb13('0x11')]][_0xdb13('0x6')]));writeDB(queues[_0x3f5a24['uniqueid']]);}}else if(!_['isNil'](_0x3f5a24[_0xdb13('0x23')]['queueposition'])){if(!_[_0xdb13('0x16')](queues[_0x3f5a24[_0xdb13('0x11')]])&&!queues[_0x3f5a24[_0xdb13('0x11')]][_0xdb13('0x19')]){queues[_0x3f5a24[_0xdb13('0x11')]][_0xdb13('0x19')]=![];queues[_0x3f5a24['uniqueid']][_0xdb13('0x26')]=null;queues[_0x3f5a24[_0xdb13('0x11')]][_0xdb13('0x27')]=!![];queues[_0x3f5a24[_0xdb13('0x11')]]['queuecallerexitAt']=utils[_0xdb13('0x13')]();queues[_0x3f5a24[_0xdb13('0x11')]]['queuecallerexitreason']=_0xdb13('0x2b');utils[_0xdb13('0x10')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x3f5a24[_0xdb13('0x11')],queues[_0x3f5a24[_0xdb13('0x11')]][_0xdb13('0x1e')],_0x3f5a24[_0xdb13('0x2a')],queues[_0x3f5a24[_0xdb13('0x11')]][_0xdb13('0x6')]));}}}catch(_0x13e907){utils[_0xdb13('0x2c')](util['format'](_0xdb13('0x22'),_0x3f5a24[_0xdb13('0x11')]),_0x13e907);}};exports[_0xdb13('0x19')]=function(_0x5caa0f){try{if(!_[_0xdb13('0x16')](queues[_0x5caa0f['uniqueid']])){utils['debug'](util[_0xdb13('0x14')](_0xdb13('0x2d'),_0x5caa0f[_0xdb13('0x11')]),_0x5caa0f);queues[_0x5caa0f[_0xdb13('0x11')]]['queuecallerexit']=![];queues[_0x5caa0f[_0xdb13('0x11')]][_0xdb13('0x28')]=null;queues[_0x5caa0f[_0xdb13('0x11')]][_0xdb13('0x19')]=!![];queues[_0x5caa0f[_0xdb13('0x11')]][_0xdb13('0x26')]=utils[_0xdb13('0x13')]();queues[_0x5caa0f['uniqueid']][_0xdb13('0x6')]=_0xdb13('0x2e');utils[_0xdb13('0x10')](util[_0xdb13('0x14')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x5caa0f[_0xdb13('0x11')],queues[_0x5caa0f[_0xdb13('0x11')]][_0xdb13('0x1e')],queues[_0x5caa0f[_0xdb13('0x11')]][_0xdb13('0x6')]));}}catch(_0x3070f4){utils['error'](util[_0xdb13('0x14')](_0xdb13('0x2d'),_0x5caa0f[_0xdb13('0x11')]),_0x3070f4);}};exports['queuecallerleave']=function(_0xe46a58){try{if(!_['isNil'](queues[_0xe46a58['uniqueid']])){utils['debug'](util[_0xdb13('0x14')](_0xdb13('0x2f'),_0xe46a58[_0xdb13('0x11')]),_0xe46a58);utils[_0xdb13('0x10')](util[_0xdb13('0x14')](_0xdb13('0x30'),_0xe46a58[_0xdb13('0x11')],queues[_0xe46a58[_0xdb13('0x11')]][_0xdb13('0x1e')],_0xe46a58[_0xdb13('0x31')],_0xe46a58[_0xdb13('0x32')]));queues[_0xe46a58[_0xdb13('0x11')]]['queuecallerleave']=!![];queues[_0xe46a58[_0xdb13('0x11')]][_0xdb13('0x18')]=utils[_0xdb13('0x13')]();queues[_0xe46a58['uniqueid']][_0xdb13('0x33')]=utils[_0xdb13('0x34')](queues[_0xe46a58[_0xdb13('0x11')]][_0xdb13('0x18')],queues[_0xe46a58[_0xdb13('0x11')]][_0xdb13('0x35')]);queues[_0xe46a58[_0xdb13('0x11')]][_0xdb13('0x12')]=_0xe46a58[_0xdb13('0x12')];queues[_0xe46a58[_0xdb13('0x11')]][_0xdb13('0x36')]=_0xe46a58[_0xdb13('0x36')];queues[_0xe46a58[_0xdb13('0x11')]]['connectedlinenum']=_0xe46a58['connectedlinenum'];queues[_0xe46a58[_0xdb13('0x11')]]['connectedlinename']=_0xe46a58[_0xdb13('0x32')];}}catch(_0x2f9f52){utils[_0xdb13('0x2c')](util[_0xdb13('0x14')]('[%s][queues][queuecallerleave]',_0xe46a58[_0xdb13('0x11')]),_0x2f9f52);}};exports[_0xdb13('0x37')]=function(_0x156531){try{if(!_['isNil'](queues[_0x156531[_0xdb13('0x11')]])){utils['debug'](util[_0xdb13('0x14')]('[%s][queues][agentconnect]',_0x156531[_0xdb13('0x11')]),_0x156531);utils[_0xdb13('0x10')](util[_0xdb13('0x14')](_0xdb13('0x38'),_0x156531[_0xdb13('0x11')],queues[_0x156531['uniqueid']][_0xdb13('0x1e')],_0x156531['membername'],_0x156531[_0xdb13('0x39')]));queues[_0x156531[_0xdb13('0x11')]][_0xdb13('0x19')]=![];queues[_0x156531[_0xdb13('0x11')]][_0xdb13('0x19')]=![];queues[_0x156531[_0xdb13('0x11')]][_0xdb13('0x26')]=null;queues[_0x156531['uniqueid']][_0xdb13('0x27')]=![];queues[_0x156531['uniqueid']][_0xdb13('0x6')]=null;queues[_0x156531[_0xdb13('0x11')]][_0xdb13('0x28')]=null;queues[_0x156531[_0xdb13('0x11')]][_0xdb13('0x3a')]=!![];queues[_0x156531['uniqueid']][_0xdb13('0x5')]=_0x156531[_0xdb13('0x39')];queues[_0x156531[_0xdb13('0x11')]][_0xdb13('0x4')]=_0x156531['membername'];}}catch(_0x402d7e){utils['error'](util['format'](_0xdb13('0x3b'),_0x156531[_0xdb13('0x11')]),_0x402d7e);}};exports[_0xdb13('0x3c')]=function(_0xf85bab){try{if(!_[_0xdb13('0x16')](queues[_0xf85bab[_0xdb13('0x11')]])){if(queues[_0xf85bab[_0xdb13('0x11')]][_0xdb13('0x18')]){utils[_0xdb13('0xe')](util[_0xdb13('0x14')](_0xdb13('0x3d'),_0xf85bab[_0xdb13('0x11')]),_0xf85bab);queues[_0xf85bab[_0xdb13('0x11')]][_0xdb13('0x19')]=![];queues[_0xf85bab[_0xdb13('0x11')]]['queuecallerabandon']=![];queues[_0xf85bab[_0xdb13('0x11')]]['queuecallerabandonAt']=null;queues[_0xf85bab[_0xdb13('0x11')]]['queuecallerexit']=![];queues[_0xf85bab[_0xdb13('0x11')]][_0xdb13('0x28')]=null;queues[_0xf85bab['uniqueid']][_0xdb13('0x3a')]=!![];queues[_0xf85bab['uniqueid']][_0xdb13('0x4')]=_0xf85bab[_0xdb13('0x3e')];queues[_0xf85bab[_0xdb13('0x11')]][_0xdb13('0x1a')]=!![];queues[_0xf85bab['uniqueid']]['queuecallercompleteAt']=utils['now']();if(_0xf85bab[_0xdb13('0x3f')]==_0xdb13('0x40')){if(!queues[_0xf85bab['uniqueid']][_0xdb13('0x40')]){queues[_0xf85bab['uniqueid']][_0xdb13('0x6')]=_0xdb13('0x41');}}else{queues[_0xf85bab[_0xdb13('0x11')]][_0xdb13('0x6')]='COMPLETEDBY'+_0xf85bab['reason'][_0xdb13('0x42')]();}utils[_0xdb13('0x10')](util['format'](_0xdb13('0x43'),_0xf85bab[_0xdb13('0x11')],queues[_0xf85bab['uniqueid']][_0xdb13('0x1e')],_0xf85bab[_0xdb13('0x3e')],queues[_0xf85bab[_0xdb13('0x11')]]['queuecallerexitreason']));writeDB(queues[_0xf85bab[_0xdb13('0x11')]]);}}}catch(_0x3259ad){utils[_0xdb13('0x2c')](util['format'](_0xdb13('0x3d'),_0xf85bab[_0xdb13('0x11')]),_0x3259ad);}};exports[_0xdb13('0x44')]=function(_0x109812){try{if(!_['isNil'](queues[_0x109812[_0xdb13('0x45')]])){utils[_0xdb13('0xe')](util[_0xdb13('0x14')](_0xdb13('0x46'),_0x109812['uniqueid']),_0x109812);queues[_0x109812[_0xdb13('0x45')]][_0xdb13('0x40')]=!![];queues[_0x109812['transfereeuniqueid']][_0xdb13('0x47')]=_0xdb13('0x48');queues[_0x109812[_0xdb13('0x45')]][_0xdb13('0x49')]=_0x109812['extension'];queues[_0x109812[_0xdb13('0x45')]][_0xdb13('0x4a')]=_0x109812[_0xdb13('0x45')];queues[_0x109812['transfereeuniqueid']][_0xdb13('0x6')]=_0xdb13('0x4b');utils[_0xdb13('0x10')](util['format']('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x109812['uniqueid'],queues[_0x109812['transfereeuniqueid']]['name'],_0x109812['transfereeuniqueid'],_0x109812[_0xdb13('0x4c')]));}}catch(_0x16474c){utils[_0xdb13('0x2c')](util[_0xdb13('0x14')](_0xdb13('0x46'),_0x109812['uniqueid']),_0x16474c);}};exports['attendedtransfer']=function(_0x10403e){try{utils[_0xdb13('0xe')](util[_0xdb13('0x14')](_0xdb13('0x4d'),_0x10403e[_0xdb13('0x4e')]),_0x10403e);if(_0x10403e[_0xdb13('0x4e')]==_0x10403e[_0xdb13('0x4f')]){if(!_['isNil'](queues[_0x10403e[_0xdb13('0x50')]])){utils['info'](util[_0xdb13('0x14')](_0xdb13('0x51'),_0x10403e[_0xdb13('0x4e')],queues[_0x10403e[_0xdb13('0x50')]][_0xdb13('0x1e')],_0x10403e[_0xdb13('0x52')]));queues[_0x10403e[_0xdb13('0x50')]]['transfer']=!![];queues[_0x10403e[_0xdb13('0x50')]][_0xdb13('0x47')]=_0xdb13('0x53');queues[_0x10403e[_0xdb13('0x50')]][_0xdb13('0x49')]=_0x10403e[_0xdb13('0x52')];queues[_0x10403e[_0xdb13('0x50')]][_0xdb13('0x4a')]=_0x10403e['origtransfereruniqueid'];queues[_0x10403e[_0xdb13('0x50')]][_0xdb13('0x6')]=_0xdb13('0x54');}if(!_[_0xdb13('0x16')](queues[_0x10403e[_0xdb13('0x4f')]])){if(_0x10403e[_0xdb13('0x55')]&&queues[_0x10403e[_0xdb13('0x55')]]){queues[_0x10403e['transfereelinkedid']][_0xdb13('0x20')]=0x1;queues[_0x10403e['transfereeuniqueid']]=_[_0xdb13('0x56')](queues[_0x10403e['transfereelinkedid']]);queues[_0x10403e[_0xdb13('0x45')]][_0xdb13('0xd')]=_0x10403e[_0xdb13('0x57')];queues[_0x10403e[_0xdb13('0x45')]][_0xdb13('0x20')]=0x2;queues[_0x10403e[_0xdb13('0x45')]][_0xdb13('0x58')]=queues[_0x10403e[_0xdb13('0x50')]][_0xdb13('0x58')];queues[_0x10403e[_0xdb13('0x45')]][_0xdb13('0x59')]=queues[_0x10403e['secondtransfererlinkedid']][_0xdb13('0x59')];queues[_0x10403e[_0xdb13('0x45')]][_0xdb13('0x35')]=utils[_0xdb13('0x13')]();queues[_0x10403e['transfereeuniqueid']][_0xdb13('0x18')]=utils['now']();queues[_0x10403e[_0xdb13('0x45')]][_0xdb13('0x33')]=0x0;queues[_0x10403e['transfereeuniqueid']][_0xdb13('0x5a')]=0x0;utils['info'](util['format'](_0xdb13('0x5b'),_0x10403e[_0xdb13('0x4e')],queues[_0x10403e[_0xdb13('0x45')]]['name'],queues[_0x10403e[_0xdb13('0x45')]][_0xdb13('0x58')],queues[_0x10403e[_0xdb13('0x45')]][_0xdb13('0x59')]));}else{utils[_0xdb13('0x10')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x10403e[_0xdb13('0x4e')],queues[_0x10403e[_0xdb13('0x4f')]][_0xdb13('0x1e')],_0x10403e[_0xdb13('0x50')]));queues[_0x10403e[_0xdb13('0x4f')]][_0xdb13('0xd')]=_0x10403e[_0xdb13('0x50')];}}}else if(_0x10403e[_0xdb13('0x5c')]==_0x10403e[_0xdb13('0x50')]){if(!_['isNil'](queues[_0x10403e[_0xdb13('0x4f')]])){utils[_0xdb13('0x10')](util[_0xdb13('0x14')](_0xdb13('0x5d'),_0x10403e[_0xdb13('0x4e')],queues[_0x10403e[_0xdb13('0x4f')]][_0xdb13('0x1e')],_0x10403e[_0xdb13('0x5c')],_0x10403e[_0xdb13('0x5e')]));queues[_0x10403e[_0xdb13('0x4f')]][_0xdb13('0x40')]=!![];queues[_0x10403e[_0xdb13('0x4f')]][_0xdb13('0x47')]='ATTENDED';queues[_0x10403e[_0xdb13('0x4f')]]['transferexten']=_0x10403e[_0xdb13('0x5e')];queues[_0x10403e['origtransfererlinkedid']][_0xdb13('0x4a')]=_0x10403e[_0xdb13('0x5c')];queues[_0x10403e[_0xdb13('0x4f')]][_0xdb13('0x6')]=_0xdb13('0x54');}if(!_['isNil'](queues[_0x10403e[_0xdb13('0x50')]])){if(_0x10403e[_0xdb13('0x5f')]&&queues[_0x10403e[_0xdb13('0x5f')]]){queues[_0x10403e[_0xdb13('0x5f')]][_0xdb13('0x20')]=0x1;queues[_0x10403e['transfertargetuniqueid']]=_['clone'](queues[_0x10403e[_0xdb13('0x5f')]]);queues[_0x10403e['transfertargetuniqueid']][_0xdb13('0xd')]=_0x10403e['transfertargetuniqueid'];queues[_0x10403e['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0x10403e[_0xdb13('0x57')]][_0xdb13('0x58')]=queues[_0x10403e[_0xdb13('0x4f')]][_0xdb13('0x58')];queues[_0x10403e[_0xdb13('0x57')]][_0xdb13('0x59')]=queues[_0x10403e[_0xdb13('0x4f')]][_0xdb13('0x59')];queues[_0x10403e[_0xdb13('0x57')]][_0xdb13('0x35')]=utils[_0xdb13('0x13')]();queues[_0x10403e[_0xdb13('0x57')]]['queuecallerleaveAt']=utils[_0xdb13('0x13')]();queues[_0x10403e[_0xdb13('0x57')]][_0xdb13('0x33')]=0x0;queues[_0x10403e[_0xdb13('0x57')]][_0xdb13('0x5a')]=0x0;utils['info'](util[_0xdb13('0x14')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x10403e[_0xdb13('0x4e')],queues[_0x10403e[_0xdb13('0x57')]][_0xdb13('0x1e')],queues[_0x10403e[_0xdb13('0x57')]]['transfereduniqueid'],queues[_0x10403e[_0xdb13('0x57')]]['calleridnum'],queues[_0x10403e[_0xdb13('0x57')]]['calleridname']));}else{utils[_0xdb13('0x10')](util[_0xdb13('0x14')](_0xdb13('0x60'),_0x10403e['origtransfereruniqueid'],queues[_0x10403e[_0xdb13('0x50')]][_0xdb13('0x1e')],_0x10403e[_0xdb13('0x4f')]));queues[_0x10403e[_0xdb13('0x50')]][_0xdb13('0xd')]=_0x10403e[_0xdb13('0x4f')];}}}}catch(_0x4e40cf){utils[_0xdb13('0x2c')](util[_0xdb13('0x14')](_0xdb13('0x4d'),_0x10403e['origtransfereruniqueid']),_0x4e40cf);}};exports[_0xdb13('0x61')]=function(_0x3dfe57){try{if(!_['isNil'](queues[_0x3dfe57[_0xdb13('0x11')]])){utils['debug'](util[_0xdb13('0x14')](_0xdb13('0x62'),_0x3dfe57[_0xdb13('0x11')]),_0x3dfe57);queues[_0x3dfe57['uniqueid']][_0xdb13('0x63')]=utils[_0xdb13('0x13')]();utils[_0xdb13('0x10')](util[_0xdb13('0x14')](_0xdb13('0x64'),_0x3dfe57[_0xdb13('0x11')],queues[_0x3dfe57[_0xdb13('0x11')]][_0xdb13('0x1e')],queues[_0x3dfe57[_0xdb13('0x11')]][_0xdb13('0x63')]));}}catch(_0x542744){utils[_0xdb13('0x2c')](util[_0xdb13('0x14')](_0xdb13('0x62'),_0x3dfe57[_0xdb13('0x11')]),_0x542744);}};exports[_0xdb13('0x65')]=function(_0x2cfcac){try{if(!_['isNil'](queues[_0x2cfcac[_0xdb13('0x11')]])){if(!_['isNil'](queues[_0x2cfcac[_0xdb13('0x11')]][_0xdb13('0x63')])){utils[_0xdb13('0xe')](util[_0xdb13('0x14')](_0xdb13('0x66'),_0x2cfcac[_0xdb13('0x11')]),_0x2cfcac);queues[_0x2cfcac['uniqueid']][_0xdb13('0x5a')]+=utils[_0xdb13('0x34')](utils[_0xdb13('0x13')](),queues[_0x2cfcac[_0xdb13('0x11')]][_0xdb13('0x63')]);utils[_0xdb13('0x10')](util[_0xdb13('0x14')](_0xdb13('0x67'),_0x2cfcac[_0xdb13('0x11')],queues[_0x2cfcac[_0xdb13('0x11')]][_0xdb13('0x1e')],queues[_0x2cfcac[_0xdb13('0x11')]]['mohtime']));delete queues[_0x2cfcac[_0xdb13('0x11')]][_0xdb13('0x63')];}}}catch(_0x285ee2){utils[_0xdb13('0x2c')](util[_0xdb13('0x14')](_0xdb13('0x66'),_0x2cfcac[_0xdb13('0x11')]),_0x285ee2);}}; \ No newline at end of file +var _0x3830=['connectedlinename','holdtime','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','transfer','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','transfertype','ATTENDED','transfereelinkedid','clone','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]','diffTime','lodash','util','./utils','format','uniqueid','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','variable','queuestatus','value','CONTINUE','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum'];(function(_0x182df7,_0x2f2196){var _0x2dff06=function(_0x26c076){while(--_0x26c076){_0x182df7['push'](_0x182df7['shift']());}};_0x2dff06(++_0x2f2196);}(_0x3830,0x1d6));var _0x0383=function(_0x4fc583,_0x1c9563){_0x4fc583=_0x4fc583-0x0;var _0x3b884d=_0x3830[_0x4fc583];return _0x3b884d;};'use strict';var _=require(_0x0383('0x0'));var util=require(_0x0383('0x1'));var utils=require(_0x0383('0x2'));var queues={};function writeDB(_0x45f48c){utils['info'](util[_0x0383('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x45f48c[_0x0383('0x4')],_0x45f48c['channel'],_0x45f48c[_0x0383('0x5')],_0x45f48c[_0x0383('0x6')],_0x45f48c[_0x0383('0x7')],_0x45f48c[_0x0383('0x8')],_0x45f48c['queuecallerexitreason']));if(_0x45f48c[_0x0383('0x5')]){utils[_0x0383('0x9')](_0x45f48c[_0x0383('0x5')])[_0x0383('0xa')](function(_0x18cfcf){if(_0x18cfcf){_0x45f48c[_0x0383('0xb')]=_0x18cfcf[_0x0383('0xb')];}utils[_0x0383('0xc')](_0x0383('0xd'),_0x45f48c);});}else{utils['request'](_0x0383('0xd'),_0x45f48c);}if(_0x45f48c[_0x0383('0xe')]){delete queues[_0x45f48c[_0x0383('0xe')]];}else{delete queues[_0x45f48c[_0x0383('0x4')]];}}exports['queuecallerjoin']=function(_0x4bd964){try{utils['debug'](util['format'](_0x0383('0xf'),_0x4bd964[_0x0383('0x4')]),_0x4bd964);utils[_0x0383('0x10')](util['format'](_0x0383('0x11'),_0x4bd964[_0x0383('0x4')],_0x4bd964[_0x0383('0x5')],_0x4bd964[_0x0383('0x12')]));queues[_0x4bd964[_0x0383('0x4')]]=_[_0x0383('0x13')](_0x4bd964,{'originalposition':_0x4bd964[_0x0383('0x12')],'queuecallerjoinAt':utils[_0x0383('0x14')](),'mohtime':0x0});}catch(_0x2d3bc8){utils[_0x0383('0x15')](util[_0x0383('0x3')]('[%s][queues][queuecallerjoin]',_0x4bd964['uniqueid']),_0x2d3bc8);}};exports[_0x0383('0x16')]=function(_0x576fdb){try{if(!_[_0x0383('0x17')](queues[_0x576fdb[_0x0383('0x4')]])){utils[_0x0383('0x18')](util[_0x0383('0x3')](_0x0383('0x19'),_0x576fdb[_0x0383('0x4')]),_0x576fdb);if(queues[_0x576fdb[_0x0383('0x4')]][_0x0383('0x1a')]){if(!queues[_0x576fdb[_0x0383('0x4')]][_0x0383('0x1b')]&&!queues[_0x576fdb['uniqueid']][_0x0383('0x1c')]){queues[_0x576fdb[_0x0383('0x4')]][_0x0383('0x1d')]=!![];queues[_0x576fdb[_0x0383('0x4')]][_0x0383('0x1e')]=utils[_0x0383('0x14')]();queues[_0x576fdb[_0x0383('0x4')]][_0x0383('0x1f')]=_0x0383('0x20');}utils[_0x0383('0x10')](util[_0x0383('0x3')](_0x0383('0x21'),_0x576fdb[_0x0383('0x4')],queues[_0x576fdb['uniqueid']]['name'],queues[_0x576fdb['uniqueid']][_0x0383('0x1f')]));writeDB(queues[_0x576fdb[_0x0383('0x4')]]);}else if(queues[_0x576fdb['uniqueid']][_0x0383('0xe')]){utils[_0x0383('0x10')](util[_0x0383('0x3')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x576fdb[_0x0383('0x4')],queues[_0x576fdb[_0x0383('0x4')]][_0x0383('0x22')],queues[_0x576fdb[_0x0383('0x4')]]['transfereduniqueid']));queues[queues[_0x576fdb[_0x0383('0x4')]][_0x0383('0xe')]]=queues[_0x576fdb[_0x0383('0x4')]];queues[queues[_0x576fdb[_0x0383('0x4')]]['transfereduniqueid']][_0x0383('0x23')]=0x2;delete queues[_0x576fdb[_0x0383('0x4')]];}}}catch(_0x2953a7){utils[_0x0383('0x15')](util['format'](_0x0383('0x19'),_0x576fdb[_0x0383('0x4')]),_0x2953a7);}};exports[_0x0383('0x24')]=function(_0x9792bc){try{utils[_0x0383('0x18')](util['format']('[%s][queues][varset]',_0x9792bc[_0x0383('0x4')]),_0x9792bc);if(!_[_0x0383('0x17')](_0x9792bc[_0x0383('0x25')][_0x0383('0x26')])&&_0x9792bc[_0x0383('0x27')]['toUpperCase']()!==_0x0383('0x28')){if(!_[_0x0383('0x17')](queues[_0x9792bc[_0x0383('0x4')]])){queues[_0x9792bc[_0x0383('0x4')]][_0x0383('0x1b')]=![];queues[_0x9792bc[_0x0383('0x4')]]['queuecallerabandonAt']=null;queues[_0x9792bc[_0x0383('0x4')]][_0x0383('0x1c')]=!![];queues[_0x9792bc[_0x0383('0x4')]][_0x0383('0x29')]=utils[_0x0383('0x14')]();queues[_0x9792bc[_0x0383('0x4')]][_0x0383('0x1f')]=_0x9792bc[_0x0383('0x27')][_0x0383('0x2a')]();utils['info'](util['format'](_0x0383('0x2b'),_0x9792bc['uniqueid'],queues[_0x9792bc[_0x0383('0x4')]][_0x0383('0x22')],_0x9792bc[_0x0383('0x27')],queues[_0x9792bc[_0x0383('0x4')]][_0x0383('0x1f')]));writeDB(queues[_0x9792bc[_0x0383('0x4')]]);}}else if(!_[_0x0383('0x17')](_0x9792bc[_0x0383('0x25')][_0x0383('0x2c')])){if(!_[_0x0383('0x17')](queues[_0x9792bc[_0x0383('0x4')]])&&!queues[_0x9792bc['uniqueid']]['queuecallerabandon']){queues[_0x9792bc[_0x0383('0x4')]]['queuecallerabandon']=![];queues[_0x9792bc[_0x0383('0x4')]][_0x0383('0x2d')]=null;queues[_0x9792bc[_0x0383('0x4')]][_0x0383('0x1c')]=!![];queues[_0x9792bc[_0x0383('0x4')]][_0x0383('0x29')]=utils[_0x0383('0x14')]();queues[_0x9792bc[_0x0383('0x4')]][_0x0383('0x1f')]=_0x0383('0x2e');utils[_0x0383('0x10')](util[_0x0383('0x3')](_0x0383('0x2f'),_0x9792bc[_0x0383('0x4')],queues[_0x9792bc[_0x0383('0x4')]][_0x0383('0x22')],_0x9792bc['value'],queues[_0x9792bc[_0x0383('0x4')]]['queuecallerexitreason']));}}}catch(_0x4d84b4){utils[_0x0383('0x15')](util[_0x0383('0x3')](_0x0383('0x30'),_0x9792bc[_0x0383('0x4')]),_0x4d84b4);}};exports[_0x0383('0x1b')]=function(_0x3a5489){try{if(!_[_0x0383('0x17')](queues[_0x3a5489[_0x0383('0x4')]])){utils[_0x0383('0x18')](util['format'](_0x0383('0x31'),_0x3a5489[_0x0383('0x4')]),_0x3a5489);queues[_0x3a5489['uniqueid']][_0x0383('0x1c')]=![];queues[_0x3a5489[_0x0383('0x4')]][_0x0383('0x29')]=null;queues[_0x3a5489['uniqueid']][_0x0383('0x1b')]=!![];queues[_0x3a5489[_0x0383('0x4')]]['queuecallerabandonAt']=utils['now']();queues[_0x3a5489[_0x0383('0x4')]][_0x0383('0x1f')]=_0x0383('0x32');utils[_0x0383('0x10')](util[_0x0383('0x3')](_0x0383('0x33'),_0x3a5489['uniqueid'],queues[_0x3a5489['uniqueid']][_0x0383('0x22')],queues[_0x3a5489[_0x0383('0x4')]][_0x0383('0x1f')]));}}catch(_0x3f5acb){utils['error'](util[_0x0383('0x3')](_0x0383('0x31'),_0x3a5489[_0x0383('0x4')]),_0x3f5acb);}};exports['queuecallerleave']=function(_0x51d69e){try{if(!_[_0x0383('0x17')](queues[_0x51d69e[_0x0383('0x4')]])){utils[_0x0383('0x18')](util[_0x0383('0x3')](_0x0383('0x34'),_0x51d69e[_0x0383('0x4')]),_0x51d69e);utils[_0x0383('0x10')](util[_0x0383('0x3')](_0x0383('0x35'),_0x51d69e[_0x0383('0x4')],queues[_0x51d69e[_0x0383('0x4')]][_0x0383('0x22')],_0x51d69e[_0x0383('0x36')],_0x51d69e[_0x0383('0x37')]));queues[_0x51d69e[_0x0383('0x4')]]['queuecallerleave']=!![];queues[_0x51d69e[_0x0383('0x4')]][_0x0383('0x1a')]=utils[_0x0383('0x14')]();queues[_0x51d69e[_0x0383('0x4')]][_0x0383('0x38')]=utils['diffTime'](queues[_0x51d69e[_0x0383('0x4')]][_0x0383('0x1a')],queues[_0x51d69e['uniqueid']]['queuecallerjoinAt']);queues[_0x51d69e[_0x0383('0x4')]]['position']=_0x51d69e[_0x0383('0x12')];queues[_0x51d69e[_0x0383('0x4')]][_0x0383('0x39')]=_0x51d69e[_0x0383('0x39')];queues[_0x51d69e[_0x0383('0x4')]][_0x0383('0x36')]=_0x51d69e[_0x0383('0x36')];queues[_0x51d69e['uniqueid']][_0x0383('0x37')]=_0x51d69e[_0x0383('0x37')];}}catch(_0x465a5b){utils[_0x0383('0x15')](util[_0x0383('0x3')](_0x0383('0x34'),_0x51d69e[_0x0383('0x4')]),_0x465a5b);}};exports[_0x0383('0x3a')]=function(_0xc3250a){try{if(!_[_0x0383('0x17')](queues[_0xc3250a[_0x0383('0x4')]])){utils['debug'](util[_0x0383('0x3')](_0x0383('0x3b'),_0xc3250a[_0x0383('0x4')]),_0xc3250a);utils[_0x0383('0x10')](util['format'](_0x0383('0x3c'),_0xc3250a[_0x0383('0x4')],queues[_0xc3250a['uniqueid']][_0x0383('0x22')],_0xc3250a[_0x0383('0x3d')],_0xc3250a[_0x0383('0x3e')]));queues[_0xc3250a[_0x0383('0x4')]][_0x0383('0x1b')]=![];queues[_0xc3250a[_0x0383('0x4')]][_0x0383('0x1b')]=![];queues[_0xc3250a[_0x0383('0x4')]]['queuecallerabandonAt']=null;queues[_0xc3250a[_0x0383('0x4')]][_0x0383('0x1c')]=![];queues[_0xc3250a[_0x0383('0x4')]][_0x0383('0x1f')]=null;queues[_0xc3250a[_0x0383('0x4')]]['queuecallerexitAt']=null;queues[_0xc3250a[_0x0383('0x4')]][_0x0383('0x3f')]=!![];queues[_0xc3250a[_0x0383('0x4')]][_0x0383('0x8')]=_0xc3250a['destaccountcode'];queues[_0xc3250a[_0x0383('0x4')]][_0x0383('0x6')]=_0xc3250a[_0x0383('0x3d')];}}catch(_0x53e5c1){utils[_0x0383('0x15')](util['format']('[%s][queues][agentconnect]',_0xc3250a[_0x0383('0x4')]),_0x53e5c1);}};exports[_0x0383('0x40')]=function(_0x544f0f){try{if(!_['isNil'](queues[_0x544f0f['uniqueid']])){if(queues[_0x544f0f[_0x0383('0x4')]][_0x0383('0x1a')]){utils[_0x0383('0x18')](util[_0x0383('0x3')](_0x0383('0x41'),_0x544f0f[_0x0383('0x4')]),_0x544f0f);queues[_0x544f0f[_0x0383('0x4')]]['queuecallerabandon']=![];queues[_0x544f0f[_0x0383('0x4')]]['queuecallerabandon']=![];queues[_0x544f0f[_0x0383('0x4')]][_0x0383('0x2d')]=null;queues[_0x544f0f[_0x0383('0x4')]][_0x0383('0x1c')]=![];queues[_0x544f0f[_0x0383('0x4')]][_0x0383('0x29')]=null;queues[_0x544f0f['uniqueid']][_0x0383('0x3f')]=!![];queues[_0x544f0f[_0x0383('0x4')]][_0x0383('0x6')]=_0x544f0f[_0x0383('0x3d')];queues[_0x544f0f[_0x0383('0x4')]]['queuecallercomplete']=!![];queues[_0x544f0f[_0x0383('0x4')]]['queuecallercompleteAt']=utils['now']();if(_0x544f0f['reason']==_0x0383('0x42')){if(!queues[_0x544f0f[_0x0383('0x4')]][_0x0383('0x42')]){queues[_0x544f0f[_0x0383('0x4')]]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x544f0f['uniqueid']][_0x0383('0x1f')]=_0x0383('0x43')+_0x544f0f[_0x0383('0x44')]['toUpperCase']();}utils[_0x0383('0x10')](util[_0x0383('0x3')](_0x0383('0x45'),_0x544f0f[_0x0383('0x4')],queues[_0x544f0f['uniqueid']][_0x0383('0x22')],_0x544f0f[_0x0383('0x3d')],queues[_0x544f0f[_0x0383('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x544f0f['uniqueid']]);}}}catch(_0x2ca353){utils[_0x0383('0x15')](util[_0x0383('0x3')](_0x0383('0x41'),_0x544f0f[_0x0383('0x4')]),_0x2ca353);}};exports[_0x0383('0x46')]=function(_0x496ec9){try{if(!_['isNil'](queues[_0x496ec9[_0x0383('0x47')]])){utils[_0x0383('0x18')](util[_0x0383('0x3')](_0x0383('0x48'),_0x496ec9['uniqueid']),_0x496ec9);queues[_0x496ec9[_0x0383('0x47')]]['transfer']=!![];queues[_0x496ec9[_0x0383('0x47')]]['transfertype']='BLIND';queues[_0x496ec9[_0x0383('0x47')]][_0x0383('0x49')]=_0x496ec9[_0x0383('0x4a')];queues[_0x496ec9['transfereeuniqueid']][_0x0383('0x4b')]=_0x496ec9[_0x0383('0x47')];queues[_0x496ec9['transfereeuniqueid']][_0x0383('0x1f')]='BLINDTRANSFER';utils[_0x0383('0x10')](util['format'](_0x0383('0x4c'),_0x496ec9['uniqueid'],queues[_0x496ec9[_0x0383('0x47')]][_0x0383('0x22')],_0x496ec9[_0x0383('0x47')],_0x496ec9[_0x0383('0x4a')]));}}catch(_0x3e2d94){utils[_0x0383('0x15')](util[_0x0383('0x3')](_0x0383('0x48'),_0x496ec9[_0x0383('0x4')]),_0x3e2d94);}};exports[_0x0383('0x4d')]=function(_0x549b40){try{utils['debug'](util[_0x0383('0x3')](_0x0383('0x4e'),_0x549b40[_0x0383('0x4f')]),_0x549b40);if(_0x549b40[_0x0383('0x4f')]==_0x549b40[_0x0383('0x50')]){if(!_[_0x0383('0x17')](queues[_0x549b40['secondtransfererlinkedid']])){utils['info'](util[_0x0383('0x3')](_0x0383('0x51'),_0x549b40['origtransfereruniqueid'],queues[_0x549b40[_0x0383('0x52')]]['name'],_0x549b40[_0x0383('0x53')]));queues[_0x549b40[_0x0383('0x52')]][_0x0383('0x42')]=!![];queues[_0x549b40[_0x0383('0x52')]][_0x0383('0x54')]=_0x0383('0x55');queues[_0x549b40[_0x0383('0x52')]][_0x0383('0x49')]=_0x549b40['origtransfererexten'];queues[_0x549b40['secondtransfererlinkedid']][_0x0383('0x4b')]=_0x549b40['origtransfereruniqueid'];queues[_0x549b40[_0x0383('0x52')]][_0x0383('0x1f')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x549b40[_0x0383('0x50')]])){if(_0x549b40[_0x0383('0x56')]&&queues[_0x549b40[_0x0383('0x56')]]){queues[_0x549b40['transfereelinkedid']][_0x0383('0x23')]=0x1;queues[_0x549b40[_0x0383('0x47')]]=_[_0x0383('0x57')](queues[_0x549b40['transfereelinkedid']]);queues[_0x549b40[_0x0383('0x47')]][_0x0383('0xe')]=_0x549b40[_0x0383('0x58')];queues[_0x549b40[_0x0383('0x47')]][_0x0383('0x23')]=0x2;queues[_0x549b40[_0x0383('0x47')]][_0x0383('0x7')]=queues[_0x549b40[_0x0383('0x52')]][_0x0383('0x7')];queues[_0x549b40[_0x0383('0x47')]]['calleridname']=queues[_0x549b40[_0x0383('0x52')]][_0x0383('0x59')];queues[_0x549b40[_0x0383('0x47')]]['queuecallerjoinAt']=utils[_0x0383('0x14')]();queues[_0x549b40[_0x0383('0x47')]][_0x0383('0x1a')]=utils['now']();queues[_0x549b40[_0x0383('0x47')]][_0x0383('0x38')]=0x0;queues[_0x549b40[_0x0383('0x47')]]['mohtime']=0x0;utils[_0x0383('0x10')](util[_0x0383('0x3')](_0x0383('0x5a'),_0x549b40[_0x0383('0x4f')],queues[_0x549b40[_0x0383('0x47')]]['name'],queues[_0x549b40[_0x0383('0x47')]][_0x0383('0x7')],queues[_0x549b40[_0x0383('0x47')]][_0x0383('0x59')]));}else{utils['info'](util[_0x0383('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x549b40[_0x0383('0x4f')],queues[_0x549b40[_0x0383('0x50')]][_0x0383('0x22')],_0x549b40[_0x0383('0x52')]));queues[_0x549b40[_0x0383('0x50')]][_0x0383('0xe')]=_0x549b40['secondtransfererlinkedid'];}}}else if(_0x549b40['secondtransfereruniqueid']==_0x549b40[_0x0383('0x52')]){if(!_[_0x0383('0x17')](queues[_0x549b40['origtransfererlinkedid']])){utils[_0x0383('0x10')](util[_0x0383('0x3')](_0x0383('0x5b'),_0x549b40[_0x0383('0x4f')],queues[_0x549b40[_0x0383('0x50')]][_0x0383('0x22')],_0x549b40[_0x0383('0x5c')],_0x549b40[_0x0383('0x5d')]));queues[_0x549b40[_0x0383('0x50')]]['transfer']=!![];queues[_0x549b40['origtransfererlinkedid']][_0x0383('0x54')]='ATTENDED';queues[_0x549b40[_0x0383('0x50')]][_0x0383('0x49')]=_0x549b40['secondtransfererexten'];queues[_0x549b40[_0x0383('0x50')]][_0x0383('0x4b')]=_0x549b40[_0x0383('0x5c')];queues[_0x549b40[_0x0383('0x50')]][_0x0383('0x1f')]=_0x0383('0x5e');}if(!_['isNil'](queues[_0x549b40[_0x0383('0x52')]])){if(_0x549b40[_0x0383('0x5f')]&&queues[_0x549b40[_0x0383('0x5f')]]){queues[_0x549b40['transfertargetlinkedid']][_0x0383('0x23')]=0x1;queues[_0x549b40[_0x0383('0x58')]]=_[_0x0383('0x57')](queues[_0x549b40[_0x0383('0x5f')]]);queues[_0x549b40[_0x0383('0x58')]][_0x0383('0xe')]=_0x549b40[_0x0383('0x58')];queues[_0x549b40[_0x0383('0x58')]][_0x0383('0x23')]=0x2;queues[_0x549b40['transfertargetuniqueid']]['calleridnum']=queues[_0x549b40[_0x0383('0x50')]][_0x0383('0x7')];queues[_0x549b40['transfertargetuniqueid']][_0x0383('0x59')]=queues[_0x549b40[_0x0383('0x50')]][_0x0383('0x59')];queues[_0x549b40[_0x0383('0x58')]][_0x0383('0x60')]=utils[_0x0383('0x14')]();queues[_0x549b40[_0x0383('0x58')]][_0x0383('0x1a')]=utils[_0x0383('0x14')]();queues[_0x549b40[_0x0383('0x58')]][_0x0383('0x38')]=0x0;queues[_0x549b40[_0x0383('0x58')]][_0x0383('0x61')]=0x0;utils[_0x0383('0x10')](util[_0x0383('0x3')](_0x0383('0x62'),_0x549b40[_0x0383('0x4f')],queues[_0x549b40['transfertargetuniqueid']][_0x0383('0x22')],queues[_0x549b40[_0x0383('0x58')]][_0x0383('0xe')],queues[_0x549b40[_0x0383('0x58')]][_0x0383('0x7')],queues[_0x549b40['transfertargetuniqueid']][_0x0383('0x59')]));}else{utils[_0x0383('0x10')](util[_0x0383('0x3')](_0x0383('0x63'),_0x549b40[_0x0383('0x4f')],queues[_0x549b40[_0x0383('0x52')]][_0x0383('0x22')],_0x549b40[_0x0383('0x50')]));queues[_0x549b40[_0x0383('0x52')]][_0x0383('0xe')]=_0x549b40['origtransfererlinkedid'];}}}}catch(_0x19fdf0){utils[_0x0383('0x15')](util[_0x0383('0x3')](_0x0383('0x4e'),_0x549b40[_0x0383('0x4f')]),_0x19fdf0);}};exports['musiconholdstart']=function(_0x4874f2){try{if(!_[_0x0383('0x17')](queues[_0x4874f2[_0x0383('0x4')]])){utils['debug'](util['format']('[%s][queues][musiconholdstart]',_0x4874f2[_0x0383('0x4')]),_0x4874f2);queues[_0x4874f2[_0x0383('0x4')]][_0x0383('0x64')]=utils[_0x0383('0x14')]();utils[_0x0383('0x10')](util[_0x0383('0x3')](_0x0383('0x65'),_0x4874f2[_0x0383('0x4')],queues[_0x4874f2[_0x0383('0x4')]]['name'],queues[_0x4874f2[_0x0383('0x4')]][_0x0383('0x64')]));}}catch(_0x3285b5){utils[_0x0383('0x15')](util[_0x0383('0x3')](_0x0383('0x66'),_0x4874f2[_0x0383('0x4')]),_0x3285b5);}};exports['musiconholdstop']=function(_0xf91bcb){try{if(!_[_0x0383('0x17')](queues[_0xf91bcb[_0x0383('0x4')]])){if(!_[_0x0383('0x17')](queues[_0xf91bcb[_0x0383('0x4')]][_0x0383('0x64')])){utils[_0x0383('0x18')](util[_0x0383('0x3')](_0x0383('0x67'),_0xf91bcb[_0x0383('0x4')]),_0xf91bcb);queues[_0xf91bcb[_0x0383('0x4')]][_0x0383('0x61')]+=utils[_0x0383('0x68')](utils['now'](),queues[_0xf91bcb[_0x0383('0x4')]][_0x0383('0x64')]);utils[_0x0383('0x10')](util[_0x0383('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0xf91bcb[_0x0383('0x4')],queues[_0xf91bcb[_0x0383('0x4')]][_0x0383('0x22')],queues[_0xf91bcb[_0x0383('0x4')]][_0x0383('0x61')]));delete queues[_0xf91bcb[_0x0383('0x4')]]['musiconholdstartAt'];}}}catch(_0x509fb5){utils['error'](util['format'](_0x0383('0x67'),_0xf91bcb['uniqueid']),_0x509fb5);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 6b81488..80ffefa 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 _0x6a20=['replace','.WAV','monitors','[%s][recordings][varset]','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','outbound','connectedlinename','forEach','clone','[%s][recordings][hangup]','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','blindtransfer','[%s][recordings][blindtransfer]','transferercalleridnum','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','util','./utils','./transfers.controller','info','[%s][recordings][writeDB]','uniqueid','blinds','getUserByInternal','accountcode','membername','name','UserId','request','CreateVoiceRecording','newchannel','format','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','debug','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49'];(function(_0x1d0fa7,_0x1ad70f){var _0x5b2d91=function(_0x4ff922){while(--_0x4ff922){_0x1d0fa7['push'](_0x1d0fa7['shift']());}};_0x5b2d91(++_0x1ad70f);}(_0x6a20,0xb9));var _0x06a2=function(_0x552804,_0x3c3d1e){_0x552804=_0x552804-0x0;var _0x32be66=_0x6a20[_0x552804];return _0x32be66;};'use strict';var _=require('lodash');var util=require(_0x06a2('0x0'));var utils=require(_0x06a2('0x1'));var transfers=require(_0x06a2('0x2'));var recordings={};function writeDB(_0xd900f6){var _0x451b36;utils[_0x06a2('0x3')](util['format'](_0x06a2('0x4'),_0xd900f6[_0x06a2('0x5')]));if(transfers[_0x06a2('0x6')][_0xd900f6[_0x06a2('0x5')]]){_0x451b36=_0xd900f6[_0x06a2('0x5')];_0xd900f6[_0x06a2('0x5')]=transfers[_0x06a2('0x6')][_0xd900f6[_0x06a2('0x5')]]['transfereeuniqueid'];}if(_0xd900f6['accountcode']){utils[_0x06a2('0x7')](_0xd900f6[_0x06a2('0x8')])['then'](function(_0xa92c19){if(_0xa92c19){_0xd900f6[_0x06a2('0x9')]=_0xa92c19[_0x06a2('0xa')];_0xd900f6[_0x06a2('0xb')]=_0xa92c19['id'];}utils[_0x06a2('0xc')](_0x06a2('0xd'),_0xd900f6);});}else{utils[_0x06a2('0xc')](_0x06a2('0xd'),_0xd900f6);}if(_0x451b36)delete transfers['blinds'][_0x451b36];}exports[_0x06a2('0xe')]=function(_0x46751f){try{utils['debug'](util[_0x06a2('0xf')](_0x06a2('0x10'),_0x46751f['uniqueid']),_0x46751f);if(_0x46751f[_0x06a2('0x5')]==_0x46751f[_0x06a2('0x11')]){utils['info'](util[_0x06a2('0xf')](_0x06a2('0x12'),_0x46751f[_0x06a2('0x5')],_0x46751f['context'],_0x46751f[_0x06a2('0x13')]));recordings[_0x46751f['uniqueid']]={'uniqueid':_0x46751f['uniqueid'],'accountcode':_0x46751f[_0x06a2('0x8')],'exten':_0x46751f[_0x06a2('0x13')],'context':_0x46751f[_0x06a2('0x14')],'channel':_0x46751f[_0x06a2('0x15')],'monitors':[]};}}catch(_0x158d84){utils['error'](util[_0x06a2('0xf')](_0x06a2('0x10'),_0x46751f[_0x06a2('0x5')]),_0x158d84);}};exports[_0x06a2('0x16')]=function(_0x1c4c8d){try{utils['debug'](util[_0x06a2('0xf')](_0x06a2('0x17'),_0x1c4c8d[_0x06a2('0x5')]),_0x1c4c8d);if(!_[_0x06a2('0x18')](recordings[_0x1c4c8d[_0x06a2('0x5')]])&&_0x1c4c8d[_0x06a2('0x19')]==0x6){utils['info'](util[_0x06a2('0xf')](_0x06a2('0x1a'),_0x1c4c8d[_0x06a2('0x5')],_0x1c4c8d[_0x06a2('0x14')],_0x1c4c8d['channel']));}else if(!_[_0x06a2('0x18')](recordings[_0x1c4c8d['linkedid']])&&_0x1c4c8d['channelstate']==0x6&&_0x1c4c8d[_0x06a2('0x14')]!=_0x06a2('0x1b')){utils[_0x06a2('0x3')](util[_0x06a2('0xf')](_0x06a2('0x1c'),_0x1c4c8d[_0x06a2('0x5')],_0x1c4c8d[_0x06a2('0x11')],_0x1c4c8d['context'],_0x1c4c8d[_0x06a2('0x15')]));recordings[_0x1c4c8d[_0x06a2('0x11')]][_0x06a2('0x8')]=_0x1c4c8d[_0x06a2('0x8')];}}catch(_0x1eab67){utils[_0x06a2('0x1d')](util['format'](_0x06a2('0x17'),_0x1c4c8d['uniqueid']),_0x1eab67);}};exports[_0x06a2('0x1e')]=function(_0x3cc311){try{if(!_['isNil'](_0x3cc311[_0x06a2('0x1f')])&&!_[_0x06a2('0x18')](_0x3cc311[_0x06a2('0x1f')]['mixmonitor_filename'])){utils[_0x06a2('0x20')](util['format']('[%s][recordings][varset]',_0x3cc311['uniqueid']),_0x3cc311);utils[_0x06a2('0x3')](util[_0x06a2('0xf')](_0x06a2('0x21'),_0x3cc311['uniqueid'],_0x3cc311['variable'],_0x3cc311[_0x06a2('0x22')]));if(_[_0x06a2('0x23')](_0x3cc311['value'],_0x06a2('0x24'))){_0x3cc311[_0x06a2('0x22')]=_0x3cc311[_0x06a2('0x22')][_0x06a2('0x25')](_0x06a2('0x24'),_0x06a2('0x26'));}if(recordings[_0x3cc311[_0x06a2('0x11')]]){var _0x310d91=_['find'](recordings[_0x3cc311[_0x06a2('0x11')]][_0x06a2('0x27')],{'value':_0x3cc311['value']});if(_['isNil'](_0x310d91)){recordings[_0x3cc311[_0x06a2('0x11')]]['monitors']['push']({'value':_0x3cc311[_0x06a2('0x22')]});}}}}catch(_0x32ce1f){utils[_0x06a2('0x1d')](util[_0x06a2('0xf')](_0x06a2('0x28'),_0x3cc311[_0x06a2('0x5')]),_0x32ce1f);}};exports[_0x06a2('0x29')]=function(_0x2c48aa){try{if(!_['isNil'](recordings[_0x2c48aa['uniqueid']])){utils[_0x06a2('0x20')](util[_0x06a2('0xf')]('[%s][recordings][hangup]',_0x2c48aa['uniqueid']),_0x2c48aa);utils['info'](util['format'](_0x06a2('0x2a'),_0x2c48aa[_0x06a2('0x5')],_0x2c48aa['calleridnum'],_0x2c48aa[_0x06a2('0x2b')],_0x2c48aa[_0x06a2('0x2c')]));recordings[_0x2c48aa[_0x06a2('0x5')]]['calleridnum']=_0x2c48aa[_0x06a2('0x2d')];recordings[_0x2c48aa[_0x06a2('0x5')]][_0x06a2('0x2b')]=_0x2c48aa[_0x06a2('0x2b')];recordings[_0x2c48aa['uniqueid']][_0x06a2('0x2e')]=_0x2c48aa[_0x06a2('0x2e')];recordings[_0x2c48aa[_0x06a2('0x5')]]['connectedlinename']=_0x2c48aa['connectedlinename'];if(recordings[_0x2c48aa[_0x06a2('0x5')]]['type']==_0x06a2('0x2f')&&recordings[_0x2c48aa[_0x06a2('0x5')]]['accountcode']){recordings[_0x2c48aa[_0x06a2('0x5')]][_0x06a2('0x2e')]=recordings[_0x2c48aa[_0x06a2('0x5')]][_0x06a2('0x8')];recordings[_0x2c48aa[_0x06a2('0x5')]][_0x06a2('0x30')]='';}recordings[_0x2c48aa[_0x06a2('0x5')]][_0x06a2('0x27')][_0x06a2('0x31')](function(_0x36252e){var _0x19303e=_[_0x06a2('0x32')](recordings[_0x2c48aa[_0x06a2('0x5')]]);_0x19303e['value']=_0x36252e['value'];writeDB(_0x19303e);});delete recordings[_0x2c48aa[_0x06a2('0x5')]];}}catch(_0x53086e){utils[_0x06a2('0x1d')](util[_0x06a2('0xf')](_0x06a2('0x33'),_0x2c48aa[_0x06a2('0x5')]),_0x53086e);}};exports[_0x06a2('0x34')]=function(_0x1dea81){try{if(!_[_0x06a2('0x18')](recordings[_0x1dea81[_0x06a2('0x5')]])){utils[_0x06a2('0x20')](util[_0x06a2('0xf')](_0x06a2('0x35'),_0x1dea81[_0x06a2('0x5')]),_0x1dea81);utils[_0x06a2('0x3')](util[_0x06a2('0xf')](_0x06a2('0x36'),_0x1dea81[_0x06a2('0x5')],_0x1dea81[_0x06a2('0x37')],_0x1dea81[_0x06a2('0x38')]));if(_0x1dea81['application'][_0x06a2('0x39')]()==_0x06a2('0x3a')&&_[_0x06a2('0x3b')](_0x1dea81[_0x06a2('0x38')][_0x06a2('0x39')](),_0x06a2('0x3c'))){var _0x433b9d=_0x1dea81['appdata'][_0x06a2('0x3d')]('=');var _0x3537f1=_0x433b9d[0x0][_0x06a2('0x3e')](_0x433b9d[0x0][_0x06a2('0x3f')]('(')+0x1,_0x433b9d[0x0][_0x06a2('0x3f')](')'));var _0x5d53c2=_0x433b9d[0x1];recordings[_0x1dea81['uniqueid']][_0x3537f1]=_0x5d53c2;}}}catch(_0x56646d){utils[_0x06a2('0x1d')](util[_0x06a2('0xf')]('[%s][recordings][newexten]',_0x1dea81[_0x06a2('0x5')]),_0x56646d);}};exports[_0x06a2('0x40')]=function(_0x1701b3){try{if(!_[_0x06a2('0x18')](recordings[_0x1701b3[_0x06a2('0x5')]])){utils[_0x06a2('0x20')](util[_0x06a2('0xf')](_0x06a2('0x41'),_0x1701b3[_0x06a2('0x5')]),_0x1701b3);utils[_0x06a2('0x3')](util[_0x06a2('0xf')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x1701b3['uniqueid'],_0x1701b3[_0x06a2('0x42')]));recordings[_0x1701b3[_0x06a2('0x5')]][_0x06a2('0x42')]=_0x1701b3[_0x06a2('0x42')];}}catch(_0x49c296){utils['error'](util[_0x06a2('0xf')](_0x06a2('0x41'),_0x1701b3[_0x06a2('0x5')]),_0x49c296);}};exports[_0x06a2('0x43')]=function(_0x3e1b43){try{utils['debug'](util[_0x06a2('0xf')](_0x06a2('0x44'),_0x3e1b43['uniqueid']),_0x3e1b43);utils[_0x06a2('0x3')](util[_0x06a2('0xf')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x3e1b43[_0x06a2('0x5')],_0x3e1b43[_0x06a2('0x45')],_0x3e1b43['transferercalleridname'],_0x3e1b43[_0x06a2('0x46')],_0x3e1b43[_0x06a2('0x47')]));if(recordings[_0x3e1b43[_0x06a2('0x48')]]&&transfers[_0x06a2('0x6')][_0x3e1b43[_0x06a2('0x48')]]){transfers[_0x06a2('0x6')][_0x3e1b43[_0x06a2('0x48')]][_0x06a2('0x49')]=!![];}}catch(_0x4fbe23){utils[_0x06a2('0x1d')](util['format']('[%s][recordings][blindtransfer]',_0x3e1b43[_0x06a2('0x5')]),_0x4fbe23);}}; \ No newline at end of file +var _0x7382=['lastIndexOf','queuecallerjoin','queue','[%s][recordings][queuecallerjoin]','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','accountcode','getUserByInternal','membername','request','newchannel','debug','[%s][recordings][newchannel]','linkedid','exten','context','channel','error','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][hangup]','[%s][recordings][newexten]','application','appdata','toLowerCase','set','startsWith','cdr','split','substring'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7382,0x9a));var _0x2738=function(_0x11b176,_0x1a3caf){_0x11b176=_0x11b176-0x0;var _0x4052b8=_0x7382[_0x11b176];return _0x4052b8;};'use strict';var _=require(_0x2738('0x0'));var util=require(_0x2738('0x1'));var utils=require(_0x2738('0x2'));var transfers=require(_0x2738('0x3'));var recordings={};function writeDB(_0x2f3933){var _0x367d02;utils[_0x2738('0x4')](util[_0x2738('0x5')](_0x2738('0x6'),_0x2f3933[_0x2738('0x7')]));if(transfers[_0x2738('0x8')][_0x2f3933[_0x2738('0x7')]]){_0x367d02=_0x2f3933[_0x2738('0x7')];_0x2f3933['uniqueid']=transfers['blinds'][_0x2f3933['uniqueid']]['transfereeuniqueid'];}if(_0x2f3933[_0x2738('0x9')]){utils[_0x2738('0xa')](_0x2f3933[_0x2738('0x9')])['then'](function(_0x5e5fe0){if(_0x5e5fe0){_0x2f3933[_0x2738('0xb')]=_0x5e5fe0['name'];_0x2f3933['UserId']=_0x5e5fe0['id'];}utils[_0x2738('0xc')]('CreateVoiceRecording',_0x2f3933);});}else{utils[_0x2738('0xc')]('CreateVoiceRecording',_0x2f3933);}if(_0x367d02)delete transfers[_0x2738('0x8')][_0x367d02];}exports[_0x2738('0xd')]=function(_0x3c803a){try{utils[_0x2738('0xe')](util[_0x2738('0x5')](_0x2738('0xf'),_0x3c803a[_0x2738('0x7')]),_0x3c803a);if(_0x3c803a[_0x2738('0x7')]==_0x3c803a[_0x2738('0x10')]){utils[_0x2738('0x4')](util[_0x2738('0x5')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x3c803a[_0x2738('0x7')],_0x3c803a['context'],_0x3c803a[_0x2738('0x11')]));recordings[_0x3c803a[_0x2738('0x7')]]={'uniqueid':_0x3c803a[_0x2738('0x7')],'accountcode':_0x3c803a[_0x2738('0x9')],'exten':_0x3c803a[_0x2738('0x11')],'context':_0x3c803a[_0x2738('0x12')],'channel':_0x3c803a[_0x2738('0x13')],'monitors':[]};}}catch(_0x1692fa){utils[_0x2738('0x14')](util[_0x2738('0x5')](_0x2738('0xf'),_0x3c803a[_0x2738('0x7')]),_0x1692fa);}};exports['newstate']=function(_0x404a17){try{utils['debug'](util[_0x2738('0x5')](_0x2738('0x15'),_0x404a17['uniqueid']),_0x404a17);if(!_[_0x2738('0x16')](recordings[_0x404a17[_0x2738('0x7')]])&&_0x404a17[_0x2738('0x17')]==0x6){utils[_0x2738('0x4')](util['format'](_0x2738('0x18'),_0x404a17[_0x2738('0x7')],_0x404a17[_0x2738('0x12')],_0x404a17[_0x2738('0x13')]));}else if(!_[_0x2738('0x16')](recordings[_0x404a17['linkedid']])&&_0x404a17[_0x2738('0x17')]==0x6&&_0x404a17[_0x2738('0x12')]!=_0x2738('0x19')){utils[_0x2738('0x4')](util['format'](_0x2738('0x1a'),_0x404a17[_0x2738('0x7')],_0x404a17[_0x2738('0x10')],_0x404a17['context'],_0x404a17[_0x2738('0x13')]));recordings[_0x404a17[_0x2738('0x10')]]['accountcode']=_0x404a17[_0x2738('0x9')];}}catch(_0x5df434){utils[_0x2738('0x14')](util[_0x2738('0x5')](_0x2738('0x15'),_0x404a17[_0x2738('0x7')]),_0x5df434);}};exports['varset']=function(_0xf61897){try{if(!_[_0x2738('0x16')](_0xf61897[_0x2738('0x1b')])&&!_[_0x2738('0x16')](_0xf61897[_0x2738('0x1b')][_0x2738('0x1c')])){utils[_0x2738('0xe')](util[_0x2738('0x5')](_0x2738('0x1d'),_0xf61897['uniqueid']),_0xf61897);utils[_0x2738('0x4')](util[_0x2738('0x5')](_0x2738('0x1e'),_0xf61897[_0x2738('0x7')],_0xf61897[_0x2738('0x1b')],_0xf61897['value']));if(_[_0x2738('0x1f')](_0xf61897['value'],'.wav49')){_0xf61897['value']=_0xf61897[_0x2738('0x20')]['replace'](_0x2738('0x21'),_0x2738('0x22'));}if(recordings[_0xf61897['linkedid']]){var _0x583ad2=_[_0x2738('0x23')](recordings[_0xf61897[_0x2738('0x10')]][_0x2738('0x24')],{'value':_0xf61897[_0x2738('0x20')]});if(_[_0x2738('0x16')](_0x583ad2)){recordings[_0xf61897[_0x2738('0x10')]][_0x2738('0x24')][_0x2738('0x25')]({'value':_0xf61897[_0x2738('0x20')]});}}}}catch(_0x48b808){utils[_0x2738('0x14')](util[_0x2738('0x5')]('[%s][recordings][varset]',_0xf61897['uniqueid']),_0x48b808);}};exports[_0x2738('0x26')]=function(_0x1fcee6){try{if(!_['isNil'](recordings[_0x1fcee6['uniqueid']])){utils['debug'](util['format']('[%s][recordings][hangup]',_0x1fcee6['uniqueid']),_0x1fcee6);utils[_0x2738('0x4')](util[_0x2738('0x5')](_0x2738('0x27'),_0x1fcee6[_0x2738('0x7')],_0x1fcee6[_0x2738('0x28')],_0x1fcee6[_0x2738('0x29')],_0x1fcee6[_0x2738('0x2a')]));recordings[_0x1fcee6[_0x2738('0x7')]][_0x2738('0x28')]=_0x1fcee6['calleridnum'];recordings[_0x1fcee6[_0x2738('0x7')]][_0x2738('0x29')]=_0x1fcee6[_0x2738('0x29')];recordings[_0x1fcee6['uniqueid']][_0x2738('0x2b')]=_0x1fcee6[_0x2738('0x2b')];recordings[_0x1fcee6[_0x2738('0x7')]]['connectedlinename']=_0x1fcee6[_0x2738('0x2c')];if(recordings[_0x1fcee6[_0x2738('0x7')]][_0x2738('0x2d')]==_0x2738('0x2e')&&recordings[_0x1fcee6['uniqueid']][_0x2738('0x9')]){recordings[_0x1fcee6[_0x2738('0x7')]][_0x2738('0x2b')]=recordings[_0x1fcee6[_0x2738('0x7')]][_0x2738('0x9')];recordings[_0x1fcee6[_0x2738('0x7')]]['connectedlinename']='';}recordings[_0x1fcee6[_0x2738('0x7')]][_0x2738('0x24')][_0x2738('0x2f')](function(_0x551049){var _0x593508=_[_0x2738('0x30')](recordings[_0x1fcee6['uniqueid']]);_0x593508[_0x2738('0x20')]=_0x551049[_0x2738('0x20')];writeDB(_0x593508);});delete recordings[_0x1fcee6['uniqueid']];}}catch(_0xbf33da){utils['error'](util['format'](_0x2738('0x31'),_0x1fcee6['uniqueid']),_0xbf33da);}};exports['newexten']=function(_0x505a49){try{if(!_['isNil'](recordings[_0x505a49[_0x2738('0x7')]])){utils[_0x2738('0xe')](util['format'](_0x2738('0x32'),_0x505a49['uniqueid']),_0x505a49);utils['info'](util[_0x2738('0x5')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x505a49[_0x2738('0x7')],_0x505a49[_0x2738('0x33')],_0x505a49[_0x2738('0x34')]));if(_0x505a49[_0x2738('0x33')][_0x2738('0x35')]()==_0x2738('0x36')&&_[_0x2738('0x37')](_0x505a49[_0x2738('0x34')][_0x2738('0x35')](),_0x2738('0x38'))){var _0x2f5ac8=_0x505a49[_0x2738('0x34')][_0x2738('0x39')]('=');var _0x446640=_0x2f5ac8[0x0][_0x2738('0x3a')](_0x2f5ac8[0x0][_0x2738('0x3b')]('(')+0x1,_0x2f5ac8[0x0][_0x2738('0x3b')](')'));var _0x1b4e7b=_0x2f5ac8[0x1];recordings[_0x505a49['uniqueid']][_0x446640]=_0x1b4e7b;}}}catch(_0x11d66e){utils['error'](util[_0x2738('0x5')](_0x2738('0x32'),_0x505a49[_0x2738('0x7')]),_0x11d66e);}};exports[_0x2738('0x3c')]=function(_0x357abc){try{if(!_[_0x2738('0x16')](recordings[_0x357abc['uniqueid']])){utils['debug'](util['format']('[%s][recordings][queuecallerjoin]',_0x357abc[_0x2738('0x7')]),_0x357abc);utils[_0x2738('0x4')](util[_0x2738('0x5')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x357abc[_0x2738('0x7')],_0x357abc['queue']));recordings[_0x357abc[_0x2738('0x7')]][_0x2738('0x3d')]=_0x357abc['queue'];}}catch(_0x1ca136){utils[_0x2738('0x14')](util['format'](_0x2738('0x3e'),_0x357abc[_0x2738('0x7')]),_0x1ca136);}};exports[_0x2738('0x3f')]=function(_0x4e66b3){try{utils[_0x2738('0xe')](util[_0x2738('0x5')](_0x2738('0x40'),_0x4e66b3['uniqueid']),_0x4e66b3);utils[_0x2738('0x4')](util[_0x2738('0x5')](_0x2738('0x41'),_0x4e66b3['uniqueid'],_0x4e66b3['transferercalleridnum'],_0x4e66b3[_0x2738('0x42')],_0x4e66b3[_0x2738('0x43')],_0x4e66b3[_0x2738('0x44')]));if(recordings[_0x4e66b3[_0x2738('0x45')]]&&transfers[_0x2738('0x8')][_0x4e66b3[_0x2738('0x45')]]){transfers[_0x2738('0x8')][_0x4e66b3[_0x2738('0x45')]][_0x2738('0x46')]=!![];}}catch(_0x5df170){utils[_0x2738('0x14')](util['format']('[%s][recordings][blindtransfer]',_0x4e66b3[_0x2738('0x7')]),_0x5df170);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 09f7595..9c1e6a4 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 _0x9c2f=['origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','error','lodash','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','origtransfereruniqueid','type','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','uniqueid','transferercalleridnum','transferercalleridname','transfereecalleridname','blind','transfereruniqueid','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum'];(function(_0x269ee8,_0x477226){var _0x4d98bd=function(_0x20d4c4){while(--_0x20d4c4){_0x269ee8['push'](_0x269ee8['shift']());}};_0x4d98bd(++_0x477226);}(_0x9c2f,0x196));var _0xf9c2=function(_0x1811e0,_0x487da0){_0x1811e0=_0x1811e0-0x0;var _0x3ce439=_0x9c2f[_0x1811e0];return _0x3ce439;};'use strict';var _=require(_0xf9c2('0x0'));var util=require('util');var utils=require(_0xf9c2('0x1'));function writeDB(_0x7fbdee){utils[_0xf9c2('0x2')](util[_0xf9c2('0x3')](_0xf9c2('0x4'),_0x7fbdee['type']==='attended'?_0x7fbdee[_0xf9c2('0x5')]:_0x7fbdee['uniqueid'],_0x7fbdee[_0xf9c2('0x6')]));utils[_0xf9c2('0x7')](_0xf9c2('0x8'),_0x7fbdee);}exports[_0xf9c2('0x9')]={};exports[_0xf9c2('0xa')]=function(_0x32c30b){try{utils[_0xf9c2('0xb')](util[_0xf9c2('0x3')](_0xf9c2('0xc'),_0x32c30b['uniqueid']),_0x32c30b);utils[_0xf9c2('0x2')](util[_0xf9c2('0x3')](_0xf9c2('0xd'),_0x32c30b[_0xf9c2('0xe')],_0x32c30b[_0xf9c2('0xf')],_0x32c30b[_0xf9c2('0x10')],_0x32c30b['transfereecalleridnum'],_0x32c30b[_0xf9c2('0x11')]));_0x32c30b[_0xf9c2('0x6')]=_0xf9c2('0x12');exports[_0xf9c2('0x9')][_0x32c30b[_0xf9c2('0x13')]]=_0x32c30b;writeDB(_0x32c30b);}catch(_0x3c086c){utils['error'](util[_0xf9c2('0x3')](_0xf9c2('0xc'),_0x32c30b[_0xf9c2('0xe')]),_0x3c086c);}};exports[_0xf9c2('0x14')]=function(_0x2058d1){try{utils[_0xf9c2('0xb')](util[_0xf9c2('0x3')](_0xf9c2('0x15'),_0x2058d1[_0xf9c2('0x5')]),_0x2058d1);utils[_0xf9c2('0x2')](util[_0xf9c2('0x3')](_0xf9c2('0x16'),_0x2058d1[_0xf9c2('0x5')],_0x2058d1[_0xf9c2('0x17')],_0x2058d1[_0xf9c2('0x18')],_0x2058d1['transfertargetcalleridnum'],_0x2058d1[_0xf9c2('0x19')]));_0x2058d1=_[_0xf9c2('0x1a')](_0x2058d1,{'transfererchannel':_0x2058d1[_0xf9c2('0x1b')],'transferercalleridnum':_0x2058d1['origtransferercalleridnum'],'transferercalleridname':_0x2058d1['origtransferercalleridname'],'transfererconnectedlinenum':_0x2058d1[_0xf9c2('0x1c')],'transfererconnectedlinename':_0x2058d1[_0xf9c2('0x1d')],'transfereraccountcode':_0x2058d1[_0xf9c2('0x1e')],'transferercontext':_0x2058d1['secondtransferercontext'],'transfererexten':_0x2058d1['secondtransfererexten'],'transfererlinkedid':_0x2058d1[_0xf9c2('0x1f')],'context':_0x2058d1[_0xf9c2('0x20')],'extension':_0x2058d1[_0xf9c2('0x21')],'type':_0xf9c2('0x22')});if(_[_0xf9c2('0x23')](_0x2058d1[_0xf9c2('0x24')])){_0x2058d1=_[_0xf9c2('0x1a')](_0x2058d1,{'transfereechannel':_0x2058d1[_0xf9c2('0x25')],'transfereecalleridnum':_0x2058d1['transfertargetcalleridnum'],'transfereecalleridname':_0x2058d1[_0xf9c2('0x19')],'transfereeconnectedlinenum':_0x2058d1[_0xf9c2('0x26')],'transfereeconnectedlinename':_0x2058d1[_0xf9c2('0x27')],'transfereeaccountcode':_0x2058d1[_0xf9c2('0x28')],'transfereecontext':_0x2058d1[_0xf9c2('0x29')],'transfereeexten':_0x2058d1['transfertargetexten'],'transfereelinkedid':_0x2058d1['transfertargetlinkedid']});}writeDB(_0x2058d1);}catch(_0x3810ed){utils[_0xf9c2('0x2a')](util['format']('[%s][transfers][attendedtransfer]',_0x2058d1[_0xf9c2('0x5')]),_0x3810ed);}}; \ No newline at end of file +var _0x0bd2=['[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfereecalleridnum','transfereecalleridname','blind','blinds','transfereruniqueid','error','attendedtransfer','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','[%s][transfers][attendedtransfer]','lodash','util','info','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','format','[%s][transfers][blindtransfer]'];(function(_0x59c60a,_0x2bcb85){var _0x4d0ab0=function(_0x581a40){while(--_0x581a40){_0x59c60a['push'](_0x59c60a['shift']());}};_0x4d0ab0(++_0x2bcb85);}(_0x0bd2,0x1eb));var _0x20bd=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x0bd2[_0x256b72];return _0x2183e3;};'use strict';var _=require(_0x20bd('0x0'));var util=require(_0x20bd('0x1'));var utils=require('./utils');function writeDB(_0x1c7879){utils[_0x20bd('0x2')](util['format'](_0x20bd('0x3'),_0x1c7879[_0x20bd('0x4')]==='attended'?_0x1c7879[_0x20bd('0x5')]:_0x1c7879[_0x20bd('0x6')],_0x1c7879[_0x20bd('0x4')]));utils[_0x20bd('0x7')](_0x20bd('0x8'),_0x1c7879);}exports['blinds']={};exports[_0x20bd('0x9')]=function(_0x4750b9){try{utils[_0x20bd('0xa')](util[_0x20bd('0xb')](_0x20bd('0xc'),_0x4750b9['uniqueid']),_0x4750b9);utils[_0x20bd('0x2')](util[_0x20bd('0xb')](_0x20bd('0xd'),_0x4750b9[_0x20bd('0x6')],_0x4750b9['transferercalleridnum'],_0x4750b9['transferercalleridname'],_0x4750b9[_0x20bd('0xe')],_0x4750b9[_0x20bd('0xf')]));_0x4750b9[_0x20bd('0x4')]=_0x20bd('0x10');exports[_0x20bd('0x11')][_0x4750b9[_0x20bd('0x12')]]=_0x4750b9;writeDB(_0x4750b9);}catch(_0x1ad44c){utils[_0x20bd('0x13')](util['format'](_0x20bd('0xc'),_0x4750b9[_0x20bd('0x6')]),_0x1ad44c);}};exports[_0x20bd('0x14')]=function(_0x2bc7f8){try{utils[_0x20bd('0xa')](util[_0x20bd('0xb')]('[%s][transfers][attendedtransfer]',_0x2bc7f8[_0x20bd('0x5')]),_0x2bc7f8);utils['info'](util[_0x20bd('0xb')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x2bc7f8[_0x20bd('0x5')],_0x2bc7f8[_0x20bd('0x15')],_0x2bc7f8[_0x20bd('0x16')],_0x2bc7f8[_0x20bd('0x17')],_0x2bc7f8[_0x20bd('0x18')]));_0x2bc7f8=_[_0x20bd('0x19')](_0x2bc7f8,{'transfererchannel':_0x2bc7f8[_0x20bd('0x1a')],'transferercalleridnum':_0x2bc7f8[_0x20bd('0x15')],'transferercalleridname':_0x2bc7f8['origtransferercalleridname'],'transfererconnectedlinenum':_0x2bc7f8['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2bc7f8[_0x20bd('0x1b')],'transfereraccountcode':_0x2bc7f8[_0x20bd('0x1c')],'transferercontext':_0x2bc7f8[_0x20bd('0x1d')],'transfererexten':_0x2bc7f8[_0x20bd('0x1e')],'transfererlinkedid':_0x2bc7f8[_0x20bd('0x1f')],'context':_0x2bc7f8[_0x20bd('0x20')],'extension':_0x2bc7f8[_0x20bd('0x21')],'type':_0x20bd('0x22')});if(_[_0x20bd('0x23')](_0x2bc7f8[_0x20bd('0x24')])){_0x2bc7f8=_[_0x20bd('0x19')](_0x2bc7f8,{'transfereechannel':_0x2bc7f8[_0x20bd('0x25')],'transfereecalleridnum':_0x2bc7f8['transfertargetcalleridnum'],'transfereecalleridname':_0x2bc7f8['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x2bc7f8[_0x20bd('0x26')],'transfereeconnectedlinename':_0x2bc7f8['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2bc7f8[_0x20bd('0x27')],'transfereecontext':_0x2bc7f8[_0x20bd('0x28')],'transfereeexten':_0x2bc7f8['transfertargetexten'],'transfereelinkedid':_0x2bc7f8['transfertargetlinkedid']});}writeDB(_0x2bc7f8);}catch(_0x18aee6){utils[_0x20bd('0x13')](util[_0x20bd('0xb')](_0x20bd('0x29'),_0x2bc7f8[_0x20bd('0x5')]),_0x18aee6);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 7108d29..47636ff 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 _0x15b5=['getUserByName','getVoiceQueueByName','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','../../config/logger','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','result','getUserByInternal','then','[utils][getUserByInternal]\x20internal:%s\x20%s','[utils][getUserByInternal]','found','notfound','[utils][getUserByInterface]'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x15b5,0x1bf));var _0x515b=function(_0x15797a,_0x16274f){_0x15797a=_0x15797a-0x0;var _0x3e2618=_0x15b5[_0x15797a];return _0x3e2618;};'use strict';var BPromise=require(_0x515b('0x0'));var jayson=require('jayson/promise');var moment=require('moment');var util=require('util');var client=jayson['client']['http']({'port':0x2329});var logger=require(_0x515b('0x1'))(_0x515b('0x2'));exports[_0x515b('0x3')]=function(_0x4114a7,_0x1ae088){logger[_0x515b('0x3')](_0x4114a7,_0x1ae088?util[_0x515b('0x4')](_0x1ae088,{'showHidden':![],'depth':null}):'');};exports[_0x515b('0x5')]=function(_0x546d7e,_0x160864){logger[_0x515b('0x5')](_0x546d7e,_0x160864?util['inspect'](_0x160864,{'showHidden':![],'depth':null}):'');};exports[_0x515b('0x6')]=function(_0x37c63f,_0x1be803){logger['error'](_0x37c63f,_0x1be803?util[_0x515b('0x4')](_0x1be803,{'showHidden':![],'depth':null}):'');};exports[_0x515b('0x7')]=function(_0x274700,_0x5c94dd){return client[_0x515b('0x7')](_0x274700,{'body':_0x5c94dd})['then'](function(_0x35b33e){logger[_0x515b('0x5')](_0x515b('0x8'),_0x274700,_0x35b33e?util[_0x515b('0x4')](_0x35b33e,{'showHidden':![],'depth':null}):'');})[_0x515b('0x9')](function(_0x49b1e1){logger[_0x515b('0x6')](_0x515b('0x8'),_0x274700,_0x49b1e1?util['inspect'](_0x49b1e1,{'showHidden':![],'depth':null}):'');});};function getUser(_0x369731){return client[_0x515b('0x7')](_0x515b('0xa'),{'options':{'raw':!![],'attributes':['id',_0x515b('0xb'),_0x515b('0xc'),'interface'],'where':_0x369731,'limit':0x1}})['then'](function(_0x1354dc){logger[_0x515b('0x5')]('[utils][getUser]\x20where:%s',JSON['stringify'](_0x369731),_0x1354dc?util['inspect'](_0x1354dc,{'showHidden':![],'depth':null}):'');return _0x1354dc[_0x515b('0xd')]['length']?_0x1354dc[_0x515b('0xd')][0x0]:null;});}exports[_0x515b('0xe')]=function(_0x170636){return new BPromise(function(_0x183df1,_0x1b6dda){if(_0x170636){return getUser({'internal':_0x170636})[_0x515b('0xf')](function(_0x1a1c32){logger[_0x515b('0x3')](_0x515b('0x10'),_0x170636,_0x1a1c32?'found':'notfound');return _0x183df1(_0x1a1c32);})['catch'](function(_0x377743){logger[_0x515b('0x6')](_0x515b('0x11'),_0x377743?util[_0x515b('0x4')](_0x377743,{'showHidden':![],'depth':null}):'');return _0x183df1(null);});}return _0x183df1(null);});};exports['getUserByInterface']=function(_0x993ed4){return new BPromise(function(_0x1c57bf,_0x1031e2){if(_0x993ed4){return getUser({'interface':_0x993ed4})['then'](function(_0x4731c5){logger[_0x515b('0x3')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x993ed4,_0x4731c5?_0x515b('0x12'):_0x515b('0x13'));return _0x1c57bf(_0x4731c5);})['catch'](function(_0xb71d07){logger[_0x515b('0x6')](_0x515b('0x14'),_0xb71d07?util['inspect'](_0xb71d07,{'showHidden':![],'depth':null}):'');return _0x1c57bf(null);});}return _0x1c57bf(null);});};exports[_0x515b('0x15')]=function(_0x21a046){return new BPromise(function(_0x355aed,_0x8cc995){if(_0x21a046){return getUser({'name':_0x21a046})[_0x515b('0xf')](function(_0x20a682){logger[_0x515b('0x3')]('[utils][getUserByName]\x20name:%s\x20%s',_0x21a046,_0x20a682?_0x515b('0x12'):_0x515b('0x13'));return _0x355aed(_0x20a682);})[_0x515b('0x9')](function(_0x547f97){logger[_0x515b('0x6')]('[utils][getUserByName]',_0x547f97?util['inspect'](_0x547f97,{'showHidden':![],'depth':null}):'');return _0x355aed(null);});}return _0x355aed(null);});};exports[_0x515b('0x16')]=function(_0x42d4b3){return new BPromise(function(_0x4775bb,_0x539515){if(_0x42d4b3){return client['request'](_0x515b('0x17'),{'options':{'raw':!![],'attributes':['id','name',_0x515b('0x18'),_0x515b('0x19'),'acwTimeout'],'where':{'name':_0x42d4b3},'limit':0x1}})[_0x515b('0xf')](function(_0x5a52f2){logger[_0x515b('0x5')](_0x515b('0x1a'),_0x42d4b3,_0x5a52f2?util['inspect'](_0x5a52f2,{'showHidden':![],'depth':null}):'');logger[_0x515b('0x3')](_0x515b('0x1b'),_0x42d4b3,_0x5a52f2?_0x515b('0x12'):_0x515b('0x13'));return _0x4775bb(_0x5a52f2[_0x515b('0xd')]['length']?_0x5a52f2['result'][0x0]:null);})[_0x515b('0x9')](function(_0x12f8e5){logger[_0x515b('0x6')](_0x515b('0x1c'),_0x12f8e5?util['inspect'](_0x12f8e5,{'showHidden':![],'depth':null}):'');return _0x4775bb(null);});}return _0x4775bb(null);});};exports['addTime']=function(_0x45f988,_0x1c4635){return moment(_0x45f988)[_0x515b('0x1d')](_0x1c4635,_0x515b('0x1e'))[_0x515b('0x1f')](_0x515b('0x20'));};exports['subtractTime']=function(_0x2e495c,_0x55c923){return moment(_0x2e495c)['subtract'](_0x55c923,_0x515b('0x1e'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x515b('0x21')]=function(_0x234abe,_0x2fb26a){return moment(_0x234abe)[_0x515b('0x22')](moment(_0x2fb26a),_0x515b('0x1e'));};exports[_0x515b('0x23')]=function(_0x306b08,_0x577bfd){return parseInt(_0x306b08,0xa)+parseInt(_0x577bfd,0xa);};exports[_0x515b('0x24')]=function(){return moment()['format'](_0x515b('0x20'));};exports[_0x515b('0x25')]=function(_0x3a54b0,_0x3b185b){if(_0x3b185b){return moment(_0x3a54b0)['isAfter'](_0x3b185b);}return!![];};exports[_0x515b('0x26')]=function(_0x26637f,_0x360a62){if(_0x360a62){return moment(_0x26637f)['isBefore'](_0x360a62);}else if(_0x26637f){return!![];}return![];}; \ No newline at end of file +var _0x2202=['info','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','debug','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtract','format','diffTime','sumTime','now','isAfter','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','inspect','then','catch','error','request','GetUser','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal'];(function(_0x1bb939,_0x5905e9){var _0xf8e8a6=function(_0xb86dce){while(--_0xb86dce){_0x1bb939['push'](_0x1bb939['shift']());}};_0xf8e8a6(++_0x5905e9);}(_0x2202,0xab));var _0x2220=function(_0x376543,_0x1e1d48){_0x376543=_0x376543-0x0;var _0x4946cd=_0x2202[_0x376543];return _0x4946cd;};'use strict';var BPromise=require(_0x2220('0x0'));var jayson=require(_0x2220('0x1'));var moment=require(_0x2220('0x2'));var util=require(_0x2220('0x3'));var client=jayson[_0x2220('0x4')][_0x2220('0x5')]({'port':0x2329});var logger=require(_0x2220('0x6'))(_0x2220('0x7'));exports['info']=function(_0x5944fc,_0x3f96a5){logger['info'](_0x5944fc,_0x3f96a5?util[_0x2220('0x8')](_0x3f96a5,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x5a521e,_0x3dd968){logger['debug'](_0x5a521e,_0x3dd968?util[_0x2220('0x8')](_0x3dd968,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x5627cc,_0x2d850e){logger['error'](_0x5627cc,_0x2d850e?util[_0x2220('0x8')](_0x2d850e,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x138bfb,_0x147c5c){return client['request'](_0x138bfb,{'body':_0x147c5c})[_0x2220('0x9')](function(_0x4f7885){logger['debug']('[utils][request]\x20name:%s',_0x138bfb,_0x4f7885?util[_0x2220('0x8')](_0x4f7885,{'showHidden':![],'depth':null}):'');})[_0x2220('0xa')](function(_0x1c981d){logger[_0x2220('0xb')]('[utils][request]\x20name:%s',_0x138bfb,_0x1c981d?util['inspect'](_0x1c981d,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1f24c5){return client[_0x2220('0xc')](_0x2220('0xd'),{'options':{'raw':!![],'attributes':['id','internal',_0x2220('0xe'),_0x2220('0xf')],'where':_0x1f24c5,'limit':0x1}})[_0x2220('0x9')](function(_0x437d67){logger['debug'](_0x2220('0x10'),JSON[_0x2220('0x11')](_0x1f24c5),_0x437d67?util[_0x2220('0x8')](_0x437d67,{'showHidden':![],'depth':null}):'');return _0x437d67['result'][_0x2220('0x12')]?_0x437d67[_0x2220('0x13')][0x0]:null;});}exports[_0x2220('0x14')]=function(_0x17b51f){return new BPromise(function(_0x3b87ff,_0xf0f0de){if(_0x17b51f){return getUser({'internal':_0x17b51f})[_0x2220('0x9')](function(_0x86254){logger[_0x2220('0x15')](_0x2220('0x16'),_0x17b51f,_0x86254?_0x2220('0x17'):'notfound');return _0x3b87ff(_0x86254);})[_0x2220('0xa')](function(_0x56002d){logger['error'](_0x2220('0x18'),_0x56002d?util[_0x2220('0x8')](_0x56002d,{'showHidden':![],'depth':null}):'');return _0x3b87ff(null);});}return _0x3b87ff(null);});};exports[_0x2220('0x19')]=function(_0x5cfe45){return new BPromise(function(_0x5a3749,_0x87d6ca){if(_0x5cfe45){return getUser({'interface':_0x5cfe45})[_0x2220('0x9')](function(_0xc3b971){logger[_0x2220('0x15')](_0x2220('0x1a'),_0x5cfe45,_0xc3b971?_0x2220('0x17'):_0x2220('0x1b'));return _0x5a3749(_0xc3b971);})[_0x2220('0xa')](function(_0x206c87){logger[_0x2220('0xb')]('[utils][getUserByInterface]',_0x206c87?util[_0x2220('0x8')](_0x206c87,{'showHidden':![],'depth':null}):'');return _0x5a3749(null);});}return _0x5a3749(null);});};exports['getUserByName']=function(_0x4a49e8){return new BPromise(function(_0x33d209,_0xec5e15){if(_0x4a49e8){return getUser({'name':_0x4a49e8})[_0x2220('0x9')](function(_0x4ab0b1){logger['info'](_0x2220('0x1c'),_0x4a49e8,_0x4ab0b1?_0x2220('0x17'):_0x2220('0x1b'));return _0x33d209(_0x4ab0b1);})[_0x2220('0xa')](function(_0x5e69d9){logger['error'](_0x2220('0x1d'),_0x5e69d9?util['inspect'](_0x5e69d9,{'showHidden':![],'depth':null}):'');return _0x33d209(null);});}return _0x33d209(null);});};exports[_0x2220('0x1e')]=function(_0x24b8e0){return new BPromise(function(_0xc4164d,_0x26b310){if(_0x24b8e0){return client[_0x2220('0xc')](_0x2220('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x2220('0xe'),_0x2220('0x20'),_0x2220('0x21'),_0x2220('0x22')],'where':{'name':_0x24b8e0},'limit':0x1}})[_0x2220('0x9')](function(_0x5c33be){logger[_0x2220('0x23')](_0x2220('0x24'),_0x24b8e0,_0x5c33be?util[_0x2220('0x8')](_0x5c33be,{'showHidden':![],'depth':null}):'');logger[_0x2220('0x15')](_0x2220('0x25'),_0x24b8e0,_0x5c33be?_0x2220('0x17'):_0x2220('0x1b'));return _0xc4164d(_0x5c33be['result']['length']?_0x5c33be[_0x2220('0x13')][0x0]:null);})[_0x2220('0xa')](function(_0x2e4548){logger[_0x2220('0xb')](_0x2220('0x26'),_0x2e4548?util[_0x2220('0x8')](_0x2e4548,{'showHidden':![],'depth':null}):'');return _0xc4164d(null);});}return _0xc4164d(null);});};exports['addTime']=function(_0x3d066e,_0x392b88){return moment(_0x3d066e)[_0x2220('0x27')](_0x392b88,_0x2220('0x28'))['format'](_0x2220('0x29'));};exports['subtractTime']=function(_0x275194,_0x262b9c){return moment(_0x275194)[_0x2220('0x2a')](_0x262b9c,'seconds')[_0x2220('0x2b')](_0x2220('0x29'));};exports[_0x2220('0x2c')]=function(_0x152db1,_0x287a5b){return moment(_0x152db1)['diff'](moment(_0x287a5b),_0x2220('0x28'));};exports[_0x2220('0x2d')]=function(_0x46b14b,_0xb8f8a8){return parseInt(_0x46b14b,0xa)+parseInt(_0xb8f8a8,0xa);};exports[_0x2220('0x2e')]=function(){return moment()[_0x2220('0x2b')](_0x2220('0x29'));};exports[_0x2220('0x2f')]=function(_0x2ee52b,_0xebad93){if(_0xebad93){return moment(_0x2ee52b)[_0x2220('0x2f')](_0xebad93);}return!![];};exports['isBefore']=function(_0x1adf31,_0x4fce3c){if(_0x4fce3c){return moment(_0x1adf31)['isBefore'](_0x4fce3c);}else if(_0x1adf31){return!![];}return![];}; \ No newline at end of file